From: support Date: Tue, 27 Dec 2022 14:20:46 +0000 (+0000) Subject: Built motion from commit 44b1f254.|2.6.26 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=281c7c44c999cf345f8ddd0dc8e257cfefc018ba;p=motion2.git Built motion from commit 44b1f254.|2.6.26 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 17b1628..f736d5d 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-12-27T13:58:36.124Z", + "time": "2022-12-27T14:12:18.723Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index be2c67e..a3d422f 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-12-27T13:58:36.124Z", + "time": "2022-12-27T14:12:18.723Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 0298244..9d4eff7 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 _0x47d4=['motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','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','urlForward[body]','exports','VIRTUAL','getDataValue','action','contactManager','integration'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x47d4,0xfe));var _0x447d=function(_0x384998,_0x5f4964){_0x384998=_0x384998-0x0;var _0x48d50b=_0x47d4[_0x384998];return _0x48d50b;};'use strict';var Sequelize=require('sequelize');module[_0x447d('0x0')]={'name':{'type':Sequelize[_0x447d('0x1')],'get':function(_0x1d7c6b){return this[_0x447d('0x2')](_0x447d('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x447d('0x4'),_0x447d('0x5'),_0x447d('0x6'),_0x447d('0x7'),_0x447d('0x8'),'browser',_0x447d('0x9'),_0x447d('0xa')]],'msg':_0x447d('0xb')}},'comment':_0x447d('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0x447d('0xc')](0x1000),'comment':_0x447d('0xd')},'data3':{'type':Sequelize[_0x447d('0xc')](0x1000),'comment':_0x447d('0xe')},'data4':{'type':Sequelize[_0x447d('0xc')](0x1000),'comments':_0x447d('0xf')},'data5':{'type':Sequelize[_0x447d('0xc')](0x1000),'comments':_0x447d('0x10')},'data6':{'type':Sequelize[_0x447d('0xc')],'comments':_0x447d('0x11')},'data7':{'type':Sequelize[_0x447d('0x12')],'comments':_0x447d('0x13')}}; \ No newline at end of file +var _0x2691=['urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','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[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty'];(function(_0x3678d2,_0x579d26){var _0x2cd79e=function(_0xaa4401){while(--_0xaa4401){_0x3678d2['push'](_0x3678d2['shift']());}};_0x2cd79e(++_0x579d26);}(_0x2691,0x132));var _0x1269=function(_0x55e970,_0x2bd530){_0x55e970=_0x55e970-0x0;var _0x22603c=_0x2691[_0x55e970];return _0x22603c;};'use strict';var Sequelize=require(_0x1269('0x0'));module[_0x1269('0x1')]={'name':{'type':Sequelize[_0x1269('0x2')],'get':function(_0x2820aa){return this[_0x1269('0x3')](_0x1269('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x1269('0x5'),_0x1269('0x6'),_0x1269('0x7'),_0x1269('0x8'),_0x1269('0x9'),_0x1269('0xa'),_0x1269('0xb'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x1269('0xc')},'data1':{'type':Sequelize[_0x1269('0xd')](0x1000),'comment':_0x1269('0xe')},'data2':{'type':Sequelize[_0x1269('0xd')](0x1000),'comment':_0x1269('0xf')},'data3':{'type':Sequelize[_0x1269('0xd')](0x1000),'comment':_0x1269('0x10')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x1269('0xd')](0x1000),'comments':_0x1269('0x11')},'data6':{'type':Sequelize[_0x1269('0xd')],'comments':_0x1269('0x12')},'data7':{'type':Sequelize[_0x1269('0x13')],'comments':_0x1269('0x14')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index ea19f1f..4c37a19 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 _0x55d9=['zip-dir','request-promise','moment','bluebird','path','sox','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','name','send','body','Action','find','catch','params','eml-format','rimraf'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x55d9,0x12b));var _0x955d=function(_0x31acc7,_0x168431){_0x31acc7=_0x31acc7-0x0;var _0x10d549=_0x55d9[_0x31acc7];return _0x10d549;};'use strict';var emlformat=require(_0x955d('0x0'));var rimraf=require(_0x955d('0x1'));var zipdir=require(_0x955d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x955d('0x3'));var moment=require(_0x955d('0x4'));var BPromise=require(_0x955d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x955d('0x6'));var sox=require(_0x955d('0x7'));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(_0x955d('0x8'));var crypto=require('crypto');var jsforce=require(_0x955d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x955d('0xa'));var querystring=require(_0x955d('0xb'));var Papa=require(_0x955d('0xc'));var Redis=require('ioredis');var authService=require(_0x955d('0xd'));var qs=require(_0x955d('0xe'));var as=require(_0x955d('0xf'));var hardwareService=require(_0x955d('0x10'));var logger=require(_0x955d('0x11'))(_0x955d('0x12'));var utils=require('../../config/utils');var config=require(_0x955d('0x13'));var licenseUtil=require(_0x955d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37352d,_0x4e2817){_0x4e2817=_0x4e2817||0xcc;return function(_0x1fb4e6){if(_0x1fb4e6){return _0x37352d[_0x955d('0x15')](_0x4e2817);}return _0x37352d[_0x955d('0x16')](_0x4e2817)[_0x955d('0x17')]();};}function respondWithResult(_0x57cf5f,_0x361f39){_0x361f39=_0x361f39||0xc8;return function(_0x4e2873){if(_0x4e2873){return _0x57cf5f['status'](_0x361f39)[_0x955d('0x18')](_0x4e2873);}};}function respondWithFilteredResult(_0x39bd0a,_0x43a233){return function(_0x41edb0){if(_0x41edb0){var _0x1a3a41=typeof _0x43a233[_0x955d('0x19')]===_0x955d('0x1a')&&typeof _0x43a233[_0x955d('0x1b')]===_0x955d('0x1a');var _0x1ffffb=_0x41edb0[_0x955d('0x1c')];var _0x588e8d=_0x1a3a41?0x0:_0x43a233[_0x955d('0x19')];var _0x27f073=_0x1a3a41?_0x41edb0['count']:_0x43a233[_0x955d('0x19')]+_0x43a233['limit'];var _0x3732c4;if(_0x27f073>=_0x1ffffb){_0x27f073=_0x1ffffb;_0x3732c4=0xc8;}else{_0x3732c4=0xce;}_0x39bd0a[_0x955d('0x16')](_0x3732c4);return _0x39bd0a['set'](_0x955d('0x1d'),_0x588e8d+'-'+_0x27f073+'/'+_0x1ffffb)[_0x955d('0x18')](_0x41edb0);}return null;};}function patchUpdates(_0x50440d){return function(_0x18d43e){try{jsonpatch[_0x955d('0x1e')](_0x18d43e,_0x50440d,!![]);}catch(_0x69f8b4){return BPromise[_0x955d('0x1f')](_0x69f8b4);}return _0x18d43e[_0x955d('0x20')]();};}function saveUpdates(_0x3ea433,_0x221eb6){return function(_0x4c7618){if(_0x4c7618){return _0x4c7618[_0x955d('0x21')](_0x3ea433)['then'](function(_0x3f14bc){return _0x3f14bc;});}return null;};}function removeEntity(_0x2e1d21,_0x297068){return function(_0xacdf41){if(_0xacdf41){return _0xacdf41[_0x955d('0x22')]()[_0x955d('0x23')](function(){_0x2e1d21['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc1e3e3,_0x4496b5){return function(_0x590a4d){if(!_0x590a4d){_0xc1e3e3[_0x955d('0x15')](0x194);}return _0x590a4d;};}function handleError(_0x512e02,_0x2d9746){_0x2d9746=_0x2d9746||0x1f4;return function(_0x1d607b){logger['error'](_0x1d607b['stack']);if(_0x1d607b[_0x955d('0x24')]){delete _0x1d607b[_0x955d('0x24')];}_0x512e02[_0x955d('0x16')](_0x2d9746)[_0x955d('0x25')](_0x1d607b);};}exports[_0x955d('0x21')]=function(_0x4e2446,_0x16168a){if(_0x4e2446['body']['id']){delete _0x4e2446[_0x955d('0x26')]['id'];}return db[_0x955d('0x27')][_0x955d('0x28')]({'where':{'id':_0x4e2446['params']['id']}})[_0x955d('0x23')](handleEntityNotFound(_0x16168a,null))[_0x955d('0x23')](saveUpdates(_0x4e2446[_0x955d('0x26')],null))[_0x955d('0x23')](respondWithResult(_0x16168a,null))[_0x955d('0x29')](handleError(_0x16168a,null));};exports['destroy']=function(_0x5ccd49,_0x4f94a0){return db[_0x955d('0x27')][_0x955d('0x28')]({'where':{'id':_0x5ccd49[_0x955d('0x2a')]['id']}})[_0x955d('0x23')](handleEntityNotFound(_0x4f94a0,null))[_0x955d('0x23')](removeEntity(_0x4f94a0,null))[_0x955d('0x29')](handleError(_0x4f94a0,null));}; \ No newline at end of file +var _0x407d=['ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','error','name','send','update','body','Action','find','params','then','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv'];(function(_0x212dad,_0xb862ef){var _0x4fea3f=function(_0x31664b){while(--_0x31664b){_0x212dad['push'](_0x212dad['shift']());}};_0x4fea3f(++_0xb862ef);}(_0x407d,0x140));var _0xd407=function(_0x1e5cc7,_0x537a56){_0x1e5cc7=_0x1e5cc7-0x0;var _0x492e25=_0x407d[_0x1e5cc7];return _0x492e25;};'use strict';var emlformat=require(_0xd407('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd407('0x1'));var jsonpatch=require(_0xd407('0x2'));var rp=require(_0xd407('0x3'));var moment=require(_0xd407('0x4'));var BPromise=require(_0xd407('0x5'));var Mustache=require(_0xd407('0x6'));var util=require('util');var path=require(_0xd407('0x7'));var sox=require('sox');var csv=require(_0xd407('0x8'));var ejs=require(_0xd407('0x9'));var fs=require('fs');var fs_extra=require(_0xd407('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd407('0xb'));var deskjs=require(_0xd407('0xc'));var toCsv=require(_0xd407('0x8'));var querystring=require(_0xd407('0xd'));var Papa=require(_0xd407('0xe'));var Redis=require('ioredis');var authService=require(_0xd407('0xf'));var qs=require(_0xd407('0x10'));var as=require(_0xd407('0x11'));var hardwareService=require(_0xd407('0x12'));var logger=require(_0xd407('0x13'))(_0xd407('0x14'));var utils=require(_0xd407('0x15'));var config=require(_0xd407('0x16'));var licenseUtil=require(_0xd407('0x17'));var db=require(_0xd407('0x18'))['db'];function respondWithStatusCode(_0x4fb4c6,_0x42b2c9){_0x42b2c9=_0x42b2c9||0xcc;return function(_0x49e947){if(_0x49e947){return _0x4fb4c6[_0xd407('0x19')](_0x42b2c9);}return _0x4fb4c6[_0xd407('0x1a')](_0x42b2c9)[_0xd407('0x1b')]();};}function respondWithResult(_0x317021,_0x8625ee){_0x8625ee=_0x8625ee||0xc8;return function(_0x277d86){if(_0x277d86){return _0x317021[_0xd407('0x1a')](_0x8625ee)['json'](_0x277d86);}};}function respondWithFilteredResult(_0x928250,_0x5c456c){return function(_0x1a58b9){if(_0x1a58b9){var _0x29cecf=typeof _0x5c456c[_0xd407('0x1c')]===_0xd407('0x1d')&&typeof _0x5c456c[_0xd407('0x1e')]===_0xd407('0x1d');var _0x5550d1=_0x1a58b9[_0xd407('0x1f')];var _0xe4c910=_0x29cecf?0x0:_0x5c456c[_0xd407('0x1c')];var _0x2bd38d=_0x29cecf?_0x1a58b9[_0xd407('0x1f')]:_0x5c456c['offset']+_0x5c456c['limit'];var _0x217816;if(_0x2bd38d>=_0x5550d1){_0x2bd38d=_0x5550d1;_0x217816=0xc8;}else{_0x217816=0xce;}_0x928250[_0xd407('0x1a')](_0x217816);return _0x928250[_0xd407('0x20')](_0xd407('0x21'),_0xe4c910+'-'+_0x2bd38d+'/'+_0x5550d1)['json'](_0x1a58b9);}return null;};}function patchUpdates(_0x487ba1){return function(_0x322d06){try{jsonpatch[_0xd407('0x22')](_0x322d06,_0x487ba1,!![]);}catch(_0x54921f){return BPromise[_0xd407('0x23')](_0x54921f);}return _0x322d06['save']();};}function saveUpdates(_0x1df949,_0x356e02){return function(_0x4b617f){if(_0x4b617f){return _0x4b617f['update'](_0x1df949)['then'](function(_0x5c3969){return _0x5c3969;});}return null;};}function removeEntity(_0x41efb9,_0x5c99f8){return function(_0x5961d4){if(_0x5961d4){return _0x5961d4[_0xd407('0x24')]()['then'](function(){_0x41efb9[_0xd407('0x1a')](0xcc)[_0xd407('0x1b')]();});}};}function handleEntityNotFound(_0x1d3d75,_0x45aa94){return function(_0x818cbd){if(!_0x818cbd){_0x1d3d75['sendStatus'](0x194);}return _0x818cbd;};}function handleError(_0x483094,_0x570bff){_0x570bff=_0x570bff||0x1f4;return function(_0x34c915){logger[_0xd407('0x25')](_0x34c915['stack']);if(_0x34c915[_0xd407('0x26')]){delete _0x34c915[_0xd407('0x26')];}_0x483094['status'](_0x570bff)[_0xd407('0x27')](_0x34c915);};}exports[_0xd407('0x28')]=function(_0x3c0cce,_0x2f9a48){if(_0x3c0cce[_0xd407('0x29')]['id']){delete _0x3c0cce['body']['id'];}return db[_0xd407('0x2a')][_0xd407('0x2b')]({'where':{'id':_0x3c0cce[_0xd407('0x2c')]['id']}})[_0xd407('0x2d')](handleEntityNotFound(_0x2f9a48,null))[_0xd407('0x2d')](saveUpdates(_0x3c0cce[_0xd407('0x29')],null))[_0xd407('0x2d')](respondWithResult(_0x2f9a48,null))[_0xd407('0x2e')](handleError(_0x2f9a48,null));};exports[_0xd407('0x24')]=function(_0x202770,_0x5cd199){return db['Action'][_0xd407('0x2b')]({'where':{'id':_0x202770[_0xd407('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5cd199,null))['then'](removeEntity(_0x5cd199,null))['catch'](handleError(_0x5cd199,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 7cc8422..4e73a9b 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 _0xbe33=['path','rimraf','./action.attributes','exports','define','Action','tools_actions','../../config/logger','moment','request-promise'];(function(_0x391af7,_0x4f4ce8){var _0x3ebba8=function(_0x37933d){while(--_0x37933d){_0x391af7['push'](_0x391af7['shift']());}};_0x3ebba8(++_0x4f4ce8);}(_0xbe33,0x183));var _0x3be3=function(_0x44ec14,_0x8a1bb6){_0x44ec14=_0x44ec14-0x0;var _0x2ffa38=_0xbe33[_0x44ec14];return _0x2ffa38;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3be3('0x0'))('api');var moment=require(_0x3be3('0x1'));var BPromise=require('bluebird');var rp=require(_0x3be3('0x2'));var fs=require('fs');var path=require(_0x3be3('0x3'));var rimraf=require(_0x3be3('0x4'));var config=require('../../config/environment');var attributes=require(_0x3be3('0x5'));module[_0x3be3('0x6')]=function(_0x137169,_0x698c4c){return _0x137169[_0x3be3('0x7')](_0x3be3('0x8'),attributes,{'tableName':_0x3be3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe62=['rimraf','../../config/environment','exports','Action','util','request-promise','path'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xbe62,0x9e));var _0x2be6=function(_0x5c5e92,_0xb45055){_0x5c5e92=_0x5c5e92-0x0;var _0x57bb70=_0xbe62[_0x5c5e92];return _0x57bb70;};'use strict';var _=require('lodash');var util=require(_0x2be6('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2be6('0x1'));var fs=require('fs');var path=require(_0x2be6('0x2'));var rimraf=require(_0x2be6('0x3'));var config=require(_0x2be6('0x4'));var attributes=require('./action.attributes');module[_0x2be6('0x5')]=function(_0x15a434,_0x2e6c00){return _0x15a434['define'](_0x2be6('0x6'),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 6d0449d..b9c266f 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x486c3b,_0x4aeb79){var _0x4ed294=function(_0xdc628c){while(--_0xdc628c){_0x486c3b['push'](_0x486c3b['shift']());}};_0x4ed294(++_0x4aeb79);}(_0xabce,0x103));var _0xeabc=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xabce[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4ede81,_0x566ea6){_0x4ede81=_0x4ede81-0x0;var _0x2fb78d=_0x1cb9[_0x4ede81];return _0x2fb78d;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b93909e..5ef6b47 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 _0xa113=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./action.controller','put','update','/:id','isAuthenticated','destroy','exports','multer','util','path'];(function(_0x11c894,_0x2b69de){var _0x24dc88=function(_0x3b8602){while(--_0x3b8602){_0x11c894['push'](_0x11c894['shift']());}};_0x24dc88(++_0x2b69de);}(_0xa113,0xfd));var _0x3a11=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0xa113[_0x39fd11];return _0x302799;};'use strict';var multer=require(_0x3a11('0x0'));var util=require(_0x3a11('0x1'));var path=require(_0x3a11('0x2'));var timeout=require(_0x3a11('0x3'));var express=require(_0x3a11('0x4'));var router=express[_0x3a11('0x5')]();var fs_extra=require(_0x3a11('0x6'));var auth=require(_0x3a11('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3a11('0x8'));var controller=require(_0x3a11('0x9'));router[_0x3a11('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x3a11('0xb')]);router['delete'](_0x3a11('0xc'),auth[_0x3a11('0xd')](),controller[_0x3a11('0xe')]);module[_0x3a11('0xf')]=router; \ No newline at end of file +var _0xa541=['multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0xf9d583,_0xc9c988){var _0x52d96b=function(_0x76bf46){while(--_0x76bf46){_0xf9d583['push'](_0xf9d583['shift']());}};_0x52d96b(++_0xc9c988);}(_0xa541,0x1ee));var _0x1a54=function(_0x5b51d7,_0x5717ce){_0x5b51d7=_0x5b51d7-0x0;var _0x482749=_0xa541[_0x5b51d7];return _0x482749;};'use strict';var multer=require(_0x1a54('0x0'));var util=require('util');var path=require(_0x1a54('0x1'));var timeout=require(_0x1a54('0x2'));var express=require('express');var router=express[_0x1a54('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1a54('0x4'));var config=require(_0x1a54('0x5'));var controller=require(_0x1a54('0x6'));router[_0x1a54('0x7')](_0x1a54('0x8'),auth[_0x1a54('0x9')](),controller[_0x1a54('0xa')]);router[_0x1a54('0xb')](_0x1a54('0x8'),auth[_0x1a54('0x9')](),controller[_0x1a54('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 f488d33..2ad0e73 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 _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0x565aa4,_0x1a5a32){var _0x4de3ea=function(_0x28dc46){while(--_0x28dc46){_0x565aa4['push'](_0x565aa4['shift']());}};_0x4de3ea(++_0x1a5a32);}(_0xeff8,0x186));var _0x8eff=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0xeff8[_0x490be3];return _0x3f5140;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file +var _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x277cf1,_0x2367c4){var _0x106235=function(_0x54111e){while(--_0x54111e){_0x277cf1['push'](_0x277cf1['shift']());}};_0x106235(++_0x2367c4);}(_0xb138,0x1dd));var _0x8b13=function(_0x511a69,_0x2a0c25){_0x511a69=_0x511a69-0x0;var _0x552b6e=_0xb138[_0x511a69];return _0x552b6e;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 4104ce7..88be104 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 _0x98ee=['mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','model','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','include','params','keys','fields','length','includeAll','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','from','table','MetricId','function','replace','format','groupBy','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','join','COUNT(%s)','IS\x20NOT\x20EMPTY','getFields','metric','orderBy','alias','clone','output','web','fullPath','%s-%s.%s','generate','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../files/reports','select','countTable','COUNT(*)','QueryTypes','SELECT','run','runReport','SUM(%s)','DATE(%s)','DESC','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3472c6,_0x24af4c){var _0x5b85e8=function(_0x43eb06){while(--_0x43eb06){_0x3472c6['push'](_0x3472c6['shift']());}};_0x5b85e8(++_0x24af4c);}(_0x98ee,0x131));var _0xe98e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x98ee[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xe98e('0x0'));var rimraf=require(_0xe98e('0x1'));var zipdir=require(_0xe98e('0x2'));var jsonpatch=require(_0xe98e('0x3'));var rp=require(_0xe98e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe98e('0x5'));var util=require(_0xe98e('0x6'));var path=require(_0xe98e('0x7'));var sox=require(_0xe98e('0x8'));var csv=require(_0xe98e('0x9'));var ejs=require(_0xe98e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe98e('0xb'));var squel=require('squel');var crypto=require(_0xe98e('0xc'));var jsforce=require(_0xe98e('0xd'));var deskjs=require(_0xe98e('0xe'));var toCsv=require(_0xe98e('0x9'));var querystring=require('querystring');var Papa=require(_0xe98e('0xf'));var Redis=require('ioredis');var authService=require(_0xe98e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe98e('0x11'));var hardwareService=require(_0xe98e('0x12'));var logger=require(_0xe98e('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe98e('0x14'));var db=require(_0xe98e('0x15'))['db'];var dbH=require('../../mysqldb')[_0xe98e('0x16')];function respondWithStatusCode(_0x26553d,_0x3c9d12){_0x3c9d12=_0x3c9d12||0xcc;return function(_0x2c8521){if(_0x2c8521){return _0x26553d[_0xe98e('0x17')](_0x3c9d12);}return _0x26553d[_0xe98e('0x18')](_0x3c9d12)[_0xe98e('0x19')]();};}function respondWithResult(_0x44f80e,_0x4d6e5c){_0x4d6e5c=_0x4d6e5c||0xc8;return function(_0x429f24){if(_0x429f24){return _0x44f80e['status'](_0x4d6e5c)[_0xe98e('0x1a')](_0x429f24);}};}function respondWithFilteredResult(_0x3735b1,_0x1549a1){return function(_0x2afe98){if(_0x2afe98){var _0x5b7c7b=typeof _0x1549a1[_0xe98e('0x1b')]===_0xe98e('0x1c')&&typeof _0x1549a1[_0xe98e('0x1d')]===_0xe98e('0x1c');var _0x1eacdb=_0x2afe98['count'];var _0x27fe66=_0x5b7c7b?0x0:_0x1549a1[_0xe98e('0x1b')];var _0x213bbe=_0x5b7c7b?_0x2afe98[_0xe98e('0x1e')]:_0x1549a1[_0xe98e('0x1b')]+_0x1549a1['limit'];var _0x5afe6d;if(_0x213bbe>=_0x1eacdb){_0x213bbe=_0x1eacdb;_0x5afe6d=0xc8;}else{_0x5afe6d=0xce;}_0x3735b1[_0xe98e('0x18')](_0x5afe6d);return _0x3735b1['set']('Content-Range',_0x27fe66+'-'+_0x213bbe+'/'+_0x1eacdb)['json'](_0x2afe98);}return null;};}function patchUpdates(_0x3057d6){return function(_0x12398a){try{jsonpatch['apply'](_0x12398a,_0x3057d6,!![]);}catch(_0x12b1b3){return BPromise[_0xe98e('0x1f')](_0x12b1b3);}return _0x12398a[_0xe98e('0x20')]();};}function saveUpdates(_0x389812,_0x2823e3){return function(_0x1f051e){if(_0x1f051e){return _0x1f051e[_0xe98e('0x21')](_0x389812)[_0xe98e('0x22')](function(_0x519162){return _0x519162;});}return null;};}function removeEntity(_0xd33468,_0x995f8c){return function(_0x35b6cf){if(_0x35b6cf){return _0x35b6cf[_0xe98e('0x23')]()['then'](function(){var _0x22fad5=_0x35b6cf[_0xe98e('0x24')]({'plain':!![]});var _0x3ad40b=_0xe98e('0x25');return db[_0xe98e('0x26')]['destroy']({'where':{'type':_0x3ad40b,'resourceId':_0x22fad5['id']}})[_0xe98e('0x22')](function(){return _0x35b6cf;});})['then'](function(){_0xd33468[_0xe98e('0x18')](0xcc)[_0xe98e('0x19')]();});}};}function handleEntityNotFound(_0x25d04d,_0x5c1e66){return function(_0x5bd850){if(!_0x5bd850){_0x25d04d[_0xe98e('0x17')](0x194);}return _0x5bd850;};}function handleError(_0x566858,_0x57438c){_0x57438c=_0x57438c||0x1f4;return function(_0xd3b22e){logger[_0xe98e('0x27')](_0xd3b22e[_0xe98e('0x28')]);if(_0xd3b22e['name']){delete _0xd3b22e[_0xe98e('0x29')];}_0x566858[_0xe98e('0x18')](_0x57438c)[_0xe98e('0x2a')](_0xd3b22e);};}exports[_0xe98e('0x2b')]=function(_0xe380d9,_0x513e16){var _0x26590c={},_0x248de1={},_0x288452={'count':0x0,'rows':[]};var _0x4a8143=_[_0xe98e('0x2c')](db[_0xe98e('0x2d')]['rawAttributes'],function(_0x3645a5){return{'name':_0x3645a5['fieldName'],'type':_0x3645a5['type']['key']};});_0x248de1[_0xe98e('0x2e')]=_[_0xe98e('0x2c')](_0x4a8143,_0xe98e('0x29'));_0x248de1[_0xe98e('0x2f')]=_['keys'](_0xe380d9[_0xe98e('0x2f')]);_0x248de1[_0xe98e('0x30')]=_['intersection'](_0x248de1['model'],_0x248de1[_0xe98e('0x2f')]);_0x26590c[_0xe98e('0x31')]=_[_0xe98e('0x32')](_0x248de1[_0xe98e('0x2e')],qs['fields'](_0xe380d9[_0xe98e('0x2f')]['fields']));_0x26590c[_0xe98e('0x31')]=_0x26590c[_0xe98e('0x31')]['length']?_0x26590c[_0xe98e('0x31')]:_0x248de1[_0xe98e('0x2e')];if(!_0xe380d9[_0xe98e('0x2f')][_0xe98e('0x33')](_0xe98e('0x34'))){_0x26590c['limit']=qs[_0xe98e('0x1d')](_0xe380d9['query'][_0xe98e('0x1d')]);_0x26590c[_0xe98e('0x1b')]=qs[_0xe98e('0x1b')](_0xe380d9[_0xe98e('0x2f')][_0xe98e('0x1b')]);}_0x26590c[_0xe98e('0x35')]=qs[_0xe98e('0x36')](_0xe380d9[_0xe98e('0x2f')]['sort']);_0x26590c[_0xe98e('0x37')]=qs[_0xe98e('0x30')](_['pick'](_0xe380d9[_0xe98e('0x2f')],_0x248de1[_0xe98e('0x30')]),_0x4a8143);if(_0xe380d9[_0xe98e('0x2f')][_0xe98e('0x38')]){_0x26590c[_0xe98e('0x37')]=_['merge'](_0x26590c['where'],{'$or':_[_0xe98e('0x2c')](_0x4a8143,function(_0x75476d){if(_0x75476d['type']!==_0xe98e('0x39')){var _0x22245b={};_0x22245b[_0x75476d[_0xe98e('0x29')]]={'$like':'%'+_0xe380d9[_0xe98e('0x2f')]['filter']+'%'};return _0x22245b;}})});}_0x26590c=_['merge']({},_0x26590c,_0xe380d9['options']);var _0x3f8fed={'where':_0x26590c[_0xe98e('0x37')]};return db['AnalyticCustomReport'][_0xe98e('0x1e')](_0x3f8fed)[_0xe98e('0x22')](function(_0x1c0bda){_0x288452[_0xe98e('0x1e')]=_0x1c0bda;if(_0xe380d9['query']['includeAll']){_0x26590c[_0xe98e('0x3a')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x26590c);})[_0xe98e('0x22')](function(_0x5c5ae9){_0x288452['rows']=_0x5c5ae9;return _0x288452;})[_0xe98e('0x22')](respondWithFilteredResult(_0x513e16,_0x26590c))['catch'](handleError(_0x513e16,null));};exports['show']=function(_0x227f53,_0x54d4e5){var _0x519416={'raw':![],'where':{'id':_0x227f53[_0xe98e('0x3b')]['id']}},_0x495928={};_0x495928['model']=_[_0xe98e('0x3c')](db['AnalyticCustomReport']['rawAttributes']);_0x495928[_0xe98e('0x2f')]=_['keys'](_0x227f53[_0xe98e('0x2f')]);_0x495928['filters']=_[_0xe98e('0x32')](_0x495928[_0xe98e('0x2e')],_0x495928[_0xe98e('0x2f')]);_0x519416['attributes']=_[_0xe98e('0x32')](_0x495928[_0xe98e('0x2e')],qs['fields'](_0x227f53[_0xe98e('0x2f')][_0xe98e('0x3d')]));_0x519416[_0xe98e('0x31')]=_0x519416[_0xe98e('0x31')][_0xe98e('0x3e')]?_0x519416[_0xe98e('0x31')]:_0x495928[_0xe98e('0x2e')];if(_0x227f53[_0xe98e('0x2f')][_0xe98e('0x3f')]){_0x519416[_0xe98e('0x3a')]=[{'all':!![]}];}_0x519416=_[_0xe98e('0x40')]({},_0x519416,_0x227f53[_0xe98e('0x41')]);return db['AnalyticCustomReport'][_0xe98e('0x42')](_0x519416)['then'](handleEntityNotFound(_0x54d4e5,null))[_0xe98e('0x22')](respondWithResult(_0x54d4e5,null))[_0xe98e('0x43')](handleError(_0x54d4e5,null));};exports['create']=function(_0x5627e4,_0x489344){return db[_0xe98e('0x2d')][_0xe98e('0x44')](_0x5627e4[_0xe98e('0x45')],{})[_0xe98e('0x22')](function(_0x43103c){var _0x935800=_0x5627e4['user'][_0xe98e('0x24')]({'plain':!![]});if(!_0x935800)throw new Error(_0xe98e('0x46'));if(_0x935800['role']==='user'){var _0x241507=_0x43103c[_0xe98e('0x24')]({'plain':!![]});var _0x34332d='Reports';return db[_0xe98e('0x47')][_0xe98e('0x42')]({'where':{'name':_0x34332d,'userProfileId':_0x935800['userProfileId']},'raw':!![]})[_0xe98e('0x22')](function(_0x3e036e){if(_0x3e036e&&_0x3e036e[_0xe98e('0x48')]===0x0){return db[_0xe98e('0x26')]['create']({'name':_0x241507[_0xe98e('0x29')],'resourceId':_0x241507['id'],'type':_0xe98e('0x25'),'sectionId':_0x3e036e['id']},{})[_0xe98e('0x22')](function(){return _0x43103c;});}else{return _0x43103c;}})['catch'](function(_0x420491){logger[_0xe98e('0x27')](_0xe98e('0x49'),_0x420491);throw _0x420491;});}return _0x43103c;})[_0xe98e('0x22')](respondWithResult(_0x489344,0xc9))[_0xe98e('0x43')](handleError(_0x489344,null));};exports[_0xe98e('0x21')]=function(_0x4d0144,_0x4159ff){if(_0x4d0144['body']['id']){delete _0x4d0144['body']['id'];}return db[_0xe98e('0x2d')][_0xe98e('0x42')]({'where':{'id':_0x4d0144[_0xe98e('0x3b')]['id']}})[_0xe98e('0x22')](handleEntityNotFound(_0x4159ff,null))[_0xe98e('0x22')](saveUpdates(_0x4d0144[_0xe98e('0x45')],null))[_0xe98e('0x22')](respondWithResult(_0x4159ff,null))[_0xe98e('0x43')](handleError(_0x4159ff,null));};exports[_0xe98e('0x23')]=function(_0x235caf,_0x5d8108){return db[_0xe98e('0x2d')]['find']({'where':{'id':_0x235caf['params']['id']}})[_0xe98e('0x22')](handleEntityNotFound(_0x5d8108,null))[_0xe98e('0x22')](removeEntity(_0x5d8108,null))['catch'](handleError(_0x5d8108,null));};exports[_0xe98e('0x4a')]=function(_0x29725c,_0x5192a9){var _0x52712d=0xa;var _0x2baa81=['join',_0xe98e('0x4b'),_0xe98e('0x4c'),_0xe98e('0x4d')];var _0x5bf7ab={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe98e('0x4e'),'MAX':_0xe98e('0x4f'),'MIN':_0xe98e('0x50'),'AVG':_0xe98e('0x51'),'GROUP_CONCAT':_0xe98e('0x52'),'GROUP_CONCAT ASC':_0xe98e('0x53'),'GROUP_CONCAT DESC':_0xe98e('0x54')};var _0x152975={'SEC_TO_TIME':_0xe98e('0x55'),'DATE':'DATE(%s)','HOUR':_0xe98e('0x56'),'ROUND':_0xe98e('0x57'),'UNIX_TIMESTAMP':_0xe98e('0x58')};var _0x3e0a20=function(_0x109fd7){return!_[_0xe98e('0x59')]([_0xe98e('0x5a'),_0xe98e('0x5b'),_0xe98e('0x5c'),'IS\x20NOT\x20EMPTY'],_0x109fd7);};var _0x127363=function(_0x5c1117){if(!_0x5c1117||!_0x5c1117['rules'][_0xe98e('0x3e')]){return'';}for(var _0x426431='(',_0x5c1f8e=0x0;_0x5c1f8e<_0x5c1117[_0xe98e('0x5d')][_0xe98e('0x3e')];_0x5c1f8e+=0x1){_0x5c1f8e>0x0&&(_0x426431+='\x20'+_0x5c1117[_0xe98e('0x5e')]+'\x20');_0x426431+=_0x5c1117['rules'][_0x5c1f8e][_0xe98e('0x5f')]?_0x127363(_0x5c1117[_0xe98e('0x5d')][_0x5c1f8e]['group']):_0x5c1117[_0xe98e('0x5d')][_0x5c1f8e][_0xe98e('0x60')]+'\x20'+_0x5c1117[_0xe98e('0x5d')][_0x5c1f8e][_0xe98e('0x61')]+(_0x3e0a20(_0x5c1117[_0xe98e('0x5d')][_0x5c1f8e]['condition'])?'\x20'+_0x5c1117['rules'][_0x5c1f8e][_0xe98e('0x62')]:'');}return _0x426431+')';};var _0x573666={'where':{'id':_0x29725c[_0xe98e('0x3b')]['id']}},_0x383248,_0x4ecd11,_0x33cb2f,_0x1e01b8,_0x3140b3;_0x573666=_[_0xe98e('0x40')]({},_0x573666,_0x29725c['options']);return db[_0xe98e('0x2d')][_0xe98e('0x42')](_0x573666)[_0xe98e('0x22')](function(_0xa0cb19){if(_0xa0cb19){_0x383248=_0xa0cb19;return _0xa0cb19['getFields']();}return null;})['then'](function(_0x475dc1){if(_0x475dc1){if(!_0x475dc1[_0xe98e('0x3e')]){throw new db[(_0xe98e('0x63'))][(_0xe98e('0x64'))](_0xe98e('0x65'),0x193);}_0x4ecd11=_0x475dc1;return db[_0xe98e('0x66')][_0xe98e('0x67')]({'raw':!![]});}return null;})[_0xe98e('0x22')](function(_0x12e2ce){if(_0x12e2ce){_0x33cb2f=_[_0xe98e('0x68')](_0x12e2ce,'id');var _0x478987;var _0x4617cf=squel['select']();_0x4617cf[_0xe98e('0x69')](_0x383248[_0xe98e('0x6a')]);for(var _0x443721=0x0;_0x443721<_0x4ecd11[_0xe98e('0x3e')];_0x443721+=0x1){_0x478987=_0x4ecd11[_0x443721][_0xe98e('0x6b')]?_0x33cb2f[_0x4ecd11[_0x443721][_0xe98e('0x6b')]]['metric']:_0x4ecd11[_0x443721][_0xe98e('0x60')];_0x478987=_0x4ecd11[_0x443721][_0xe98e('0x6c')]?_[_0xe98e('0x6d')](_0x5bf7ab[_0x4ecd11[_0x443721][_0xe98e('0x6c')]],'%s',_0x478987):_0x478987;_0x478987=_0x4ecd11[_0x443721][_0xe98e('0x6e')]?_['replace'](_0x152975[_0x4ecd11[_0x443721][_0xe98e('0x6e')]],'%s',_0x478987):_0x478987;if(_0x4ecd11[_0x443721][_0xe98e('0x6f')]){_0x4617cf[_0xe98e('0x5f')](_0x478987);}_0x4ecd11[_0x443721]['orderBy']&&_0x4617cf[_0xe98e('0x35')](_0x478987,_0x4ecd11[_0x443721]['orderBy']==='DESC'?![]:!![]);_0x4617cf[_0xe98e('0x60')](_0x478987,_0x4ecd11[_0x443721]['alias']||_0x478987);}if(_0x383248[_0xe98e('0x70')]){_0x383248[_0xe98e('0x70')]=JSON[_0xe98e('0x71')](_0x383248[_0xe98e('0x70')]);for(var _0x35792a=0x0;_0x35792a<_0x383248[_0xe98e('0x70')]['length'];_0x35792a+=0x1){if(_0x383248[_0xe98e('0x70')][_0x35792a]['type']&&_['includes'](_0x2baa81,_0x383248[_0xe98e('0x70')][_0x35792a][_0xe98e('0x72')])&&_0x383248['joins'][_0x35792a][_0xe98e('0x73')]&&_0x383248['joins'][_0x35792a][_0xe98e('0x74')]&&_0x383248['joins'][_0x35792a][_0xe98e('0x75')]){_0x4617cf[_0x383248[_0xe98e('0x70')][_0x35792a][_0xe98e('0x72')]](_0x383248[_0xe98e('0x70')][_0x35792a]['foreignTable'],null,util[_0xe98e('0x6e')](_0xe98e('0x76'),_0x383248[_0xe98e('0x6a')],_0x383248[_0xe98e('0x70')][_0x35792a][_0xe98e('0x73')],_0x383248[_0xe98e('0x70')][_0x35792a][_0xe98e('0x74')],_0x383248['joins'][_0x35792a][_0xe98e('0x75')]));}}}if(_0x383248[_0xe98e('0x77')]){_0x383248[_0xe98e('0x77')]=JSON[_0xe98e('0x71')](_0x383248[_0xe98e('0x77')]);_0x4617cf[_0xe98e('0x37')](_0x127363(_0x383248[_0xe98e('0x77')][_0xe98e('0x5f')]));}_0x3140b3=_0x4617cf['clone']();_0x4617cf[_0xe98e('0x1d')](_0x52712d);_0x4617cf['offset'](0x0);logger[_0xe98e('0x78')](_0xe98e('0x79'),_0x4617cf[_0xe98e('0x7a')]());return dbH[_0xe98e('0x7b')]['query'](_0x4617cf[_0xe98e('0x7a')](),{'type':dbH[_0xe98e('0x7b')]['QueryTypes']['SELECT']});}})['then'](respondWithResult(_0x5192a9,null))[_0xe98e('0x43')](handleError(_0x5192a9,null));};function runReport(_0x28d7e3,_0x204830,_0x56716a){var _0x3e6352=_0x204830[_0xe98e('0x29')];var _0x1512a4=0xa;var _0xd09344=[_0xe98e('0x7c'),'left_join','right_join',_0xe98e('0x4d')];var _0x507c98={'SUM':'SUM(%s)','COUNT':_0xe98e('0x7d'),'COUNT DISTINCT':_0xe98e('0x4e'),'MAX':_0xe98e('0x4f'),'MIN':_0xe98e('0x50'),'AVG':_0xe98e('0x51'),'GROUP_CONCAT':_0xe98e('0x52'),'GROUP_CONCAT ASC':_0xe98e('0x53'),'GROUP_CONCAT DESC':_0xe98e('0x54')};var _0x186ca0={'SEC_TO_TIME':_0xe98e('0x55'),'DATE':'DATE(%s)','HOUR':_0xe98e('0x56'),'ROUND':_0xe98e('0x57'),'UNIX_TIMESTAMP':_0xe98e('0x58')};var _0x3c9a96=function(_0x28dc14){return!_[_0xe98e('0x59')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xe98e('0x5c'),_0xe98e('0x7e')],_0x28dc14);};var _0x3edd86=function(_0x3d1cb5){if(!_0x3d1cb5||!_0x3d1cb5['rules'][_0xe98e('0x3e')]){return'';}for(var _0x428be1='(',_0x5b330f=0x0;_0x5b330f<_0x3d1cb5[_0xe98e('0x5d')][_0xe98e('0x3e')];_0x5b330f+=0x1){_0x5b330f>0x0&&(_0x428be1+='\x20'+_0x3d1cb5[_0xe98e('0x5e')]+'\x20');_0x428be1+=_0x3d1cb5[_0xe98e('0x5d')][_0x5b330f]['group']?_0x3edd86(_0x3d1cb5[_0xe98e('0x5d')][_0x5b330f][_0xe98e('0x5f')]):_0x3d1cb5[_0xe98e('0x5d')][_0x5b330f]['field']+'\x20'+_0x3d1cb5[_0xe98e('0x5d')][_0x5b330f][_0xe98e('0x61')]+(_0x3c9a96(_0x3d1cb5[_0xe98e('0x5d')][_0x5b330f][_0xe98e('0x61')])?'\x20'+_0x3d1cb5['rules'][_0x5b330f][_0xe98e('0x62')]:'');}return _0x428be1+')';};var _0x30477c={'where':{'id':_0x28d7e3['id']}},_0x3120be,_0x19ee16,_0x21a732,_0x15471b,_0x4a4ab2;_0x30477c=_[_0xe98e('0x40')]({},_0x30477c,_0x56716a);return db[_0xe98e('0x2d')]['find'](_0x30477c)['then'](function(_0x22715b){if(_0x22715b){_0x3120be=_0x22715b;return _0x22715b[_0xe98e('0x7f')]();}return null;})[_0xe98e('0x22')](function(_0x2d9997){if(_0x2d9997){if(!_0x2d9997[_0xe98e('0x3e')]){throw new db[(_0xe98e('0x63'))][(_0xe98e('0x64'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x19ee16=_0x2d9997;return db[_0xe98e('0x66')][_0xe98e('0x67')]({'raw':!![]});}return null;})[_0xe98e('0x22')](function(_0x2e9b50){if(_0x2e9b50){_0x21a732=_['keyBy'](_0x2e9b50,'id');var _0x20a44a;var _0x3b256f=squel['select']();_0x3b256f[_0xe98e('0x69')](_0x3120be[_0xe98e('0x6a')]);for(var _0x225eb0=0x0;_0x225eb0<_0x19ee16['length'];_0x225eb0+=0x1){_0x20a44a=_0x19ee16[_0x225eb0][_0xe98e('0x6b')]?_0x21a732[_0x19ee16[_0x225eb0][_0xe98e('0x6b')]][_0xe98e('0x80')]:_0x19ee16[_0x225eb0][_0xe98e('0x60')];_0x20a44a=_0x19ee16[_0x225eb0][_0xe98e('0x6c')]?_['replace'](_0x507c98[_0x19ee16[_0x225eb0][_0xe98e('0x6c')]],'%s',_0x20a44a):_0x20a44a;_0x20a44a=_0x19ee16[_0x225eb0][_0xe98e('0x6e')]?_['replace'](_0x186ca0[_0x19ee16[_0x225eb0][_0xe98e('0x6e')]],'%s',_0x20a44a):_0x20a44a;if(_0x19ee16[_0x225eb0]['groupBy']){_0x3b256f[_0xe98e('0x5f')](_0x20a44a);}_0x19ee16[_0x225eb0][_0xe98e('0x81')]&&_0x3b256f['order'](_0x20a44a,_0x19ee16[_0x225eb0][_0xe98e('0x81')]==='DESC'?![]:!![]);_0x3b256f[_0xe98e('0x60')](_0x20a44a,_0x19ee16[_0x225eb0][_0xe98e('0x82')]||_0x20a44a);}if(_0x3120be['joins']){_0x3120be[_0xe98e('0x70')]=JSON[_0xe98e('0x71')](_0x3120be[_0xe98e('0x70')]);for(var _0x582617=0x0;_0x582617<_0x3120be[_0xe98e('0x70')][_0xe98e('0x3e')];_0x582617+=0x1){if(_0x3120be['joins'][_0x582617]['type']&&_[_0xe98e('0x59')](_0xd09344,_0x3120be['joins'][_0x582617][_0xe98e('0x72')])&&_0x3120be['joins'][_0x582617][_0xe98e('0x73')]&&_0x3120be[_0xe98e('0x70')][_0x582617]['foreignTable']&&_0x3120be[_0xe98e('0x70')][_0x582617][_0xe98e('0x75')]){_0x3b256f[_0x3120be[_0xe98e('0x70')][_0x582617]['type']](_0x3120be[_0xe98e('0x70')][_0x582617][_0xe98e('0x74')],null,util['format'](_0xe98e('0x76'),_0x3120be[_0xe98e('0x6a')],_0x3120be[_0xe98e('0x70')][_0x582617]['parentKey'],_0x3120be[_0xe98e('0x70')][_0x582617][_0xe98e('0x74')],_0x3120be['joins'][_0x582617]['foreignKey']));}}}if(_0x3120be[_0xe98e('0x77')]){_0x3120be[_0xe98e('0x77')]=JSON[_0xe98e('0x71')](_0x3120be[_0xe98e('0x77')]);_0x3b256f[_0xe98e('0x37')](_0x3edd86(_0x3120be[_0xe98e('0x77')][_0xe98e('0x5f')]));}_0x4a4ab2=_0x3b256f[_0xe98e('0x83')]();_0x3b256f[_0xe98e('0x1d')](_0x1512a4);_0x3b256f[_0xe98e('0x1b')](0x0);return;}})[_0xe98e('0x22')](function(){if(_0x204830[_0xe98e('0x84')]===_0xe98e('0x85')){return null;}var _0x3e3934=_[_0xe98e('0x40')](_0x204830,{'name':_0x204830[_0xe98e('0x86')]||_0x204830[_0xe98e('0x29')]||_0x3120be[_0xe98e('0x29')],'basename':_0x3e6352,'savename':util[_0xe98e('0x6e')](_0xe98e('0x87'),_0x204830[_0xe98e('0x29')]||_0x3120be[_0xe98e('0x29')],require('randomstring')[_0xe98e('0x88')](0x4),_0x204830['output']||'csv'),'reportId':_0x3120be['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xe98e('0x44')](_0x3e3934,{'raw':!![]});})[_0xe98e('0x22')](function(_0x55ca63){if(_0x3120be[_0xe98e('0x6a')]===_0xe98e('0x89')){_0x4a4ab2[_0xe98e('0x37')](_0x3120be[_0xe98e('0x6a')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x204830[_0xe98e('0x8a')],_0x204830[_0xe98e('0x8b')]);}else{_0x4a4ab2[_0xe98e('0x37')](_0x3120be[_0xe98e('0x6a')]+_0xe98e('0x8c'),_0x204830[_0xe98e('0x8a')],_0x204830[_0xe98e('0x8b')]);}if(_0x55ca63){logger[_0xe98e('0x8d')]('Run\x20Query:',_0x4a4ab2[_0xe98e('0x7a')]());require(_0xe98e('0x8e'))[_0xe98e('0x8f')](path[_0xe98e('0x7c')](__dirname,'../../components/export/',_0x55ca63[_0xe98e('0x84')]),[_0x55ca63['id'],_0x4a4ab2[_0xe98e('0x7a')](),path[_0xe98e('0x7c')](__dirname,_0xe98e('0x90'),_0x55ca63['savename']),_0x3e6352]);return _0x55ca63;}else{var _0x2e00de=squel[_0xe98e('0x91')]();_0x2e00de[_0xe98e('0x69')]('('+_0x4a4ab2['toString']()+')',_0xe98e('0x92'));_0x2e00de[_0xe98e('0x60')](_0xe98e('0x93'),_0xe98e('0x1e'));_0x4a4ab2['limit'](_0x204830[_0xe98e('0x1d')]||_0x1512a4);_0x4a4ab2['offset'](_0x204830['offset']||0x0);return dbH[_0xe98e('0x7b')][_0xe98e('0x2f')](_0x2e00de[_0xe98e('0x7a')](),{'type':dbH[_0xe98e('0x7b')][_0xe98e('0x94')][_0xe98e('0x95')]})[_0xe98e('0x22')](function(_0x54c1a8){if(!_0x54c1a8[_0xe98e('0x3e')]){_0x15471b=0x0;}else{_0x15471b=_0x54c1a8[0x0][_0xe98e('0x1e')]||0x0;}return dbH[_0xe98e('0x7b')][_0xe98e('0x2f')](_0x4a4ab2[_0xe98e('0x7a')](),{'type':dbH[_0xe98e('0x7b')]['QueryTypes'][_0xe98e('0x95')]});})['then'](function(_0xa165cf){return{'rows':_0xa165cf||[],'count':_0x15471b};});}});}exports[_0xe98e('0x96')]=function(_0x3d9f3f,_0x51b47b){return runReport(_0x3d9f3f[_0xe98e('0x3b')],_0x3d9f3f[_0xe98e('0x2f')],_0x3d9f3f[_0xe98e('0x41')])[_0xe98e('0x22')](respondWithResult(_0x51b47b,null))['catch'](handleError(_0x51b47b,null));};exports[_0xe98e('0x97')]=runReport;exports[_0xe98e('0x2f')]=function(_0x11d570,_0x5c452f){var _0x306bae=0xa;var _0x1978cc=[_0xe98e('0x7c'),_0xe98e('0x4b'),'right_join',_0xe98e('0x4d')];var _0x22e991={'SUM':_0xe98e('0x98'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe98e('0x4e'),'MAX':_0xe98e('0x4f'),'MIN':_0xe98e('0x50'),'AVG':_0xe98e('0x51'),'GROUP_CONCAT':_0xe98e('0x52'),'GROUP_CONCAT ASC':_0xe98e('0x53'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x54718b={'SEC_TO_TIME':_0xe98e('0x55'),'DATE':_0xe98e('0x99'),'HOUR':_0xe98e('0x56'),'ROUND':_0xe98e('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5a5039=function(_0xac35){return!_['includes']([_0xe98e('0x5a'),_0xe98e('0x5b'),_0xe98e('0x5c'),_0xe98e('0x7e')],_0xac35);};var _0x12979c=function(_0x418dae){if(!_0x418dae||!_0x418dae[_0xe98e('0x5d')][_0xe98e('0x3e')]){return'';}for(var _0x26166a='(',_0x35e346=0x0;_0x35e346<_0x418dae[_0xe98e('0x5d')]['length'];_0x35e346+=0x1){_0x35e346>0x0&&(_0x26166a+='\x20'+_0x418dae[_0xe98e('0x5e')]+'\x20');_0x26166a+=_0x418dae[_0xe98e('0x5d')][_0x35e346][_0xe98e('0x5f')]?_0x12979c(_0x418dae[_0xe98e('0x5d')][_0x35e346][_0xe98e('0x5f')]):_0x418dae[_0xe98e('0x5d')][_0x35e346]['field']+'\x20'+_0x418dae[_0xe98e('0x5d')][_0x35e346]['condition']+(_0x5a5039(_0x418dae[_0xe98e('0x5d')][_0x35e346][_0xe98e('0x61')])?'\x20'+_0x418dae[_0xe98e('0x5d')][_0x35e346][_0xe98e('0x62')]:'');}return _0x26166a+')';};var _0x2c1828={'where':{'id':_0x11d570[_0xe98e('0x3b')]['id']}},_0x106046,_0x35e003,_0x5cc834,_0x299a22,_0x4a9138;_0x2c1828=_[_0xe98e('0x40')]({},_0x2c1828,_0x11d570[_0xe98e('0x41')]);return db[_0xe98e('0x2d')][_0xe98e('0x42')](_0x2c1828)[_0xe98e('0x22')](function(_0x11b8ef){if(_0x11b8ef){_0x106046=_0x11b8ef;return _0x11b8ef[_0xe98e('0x7f')]();}return null;})['then'](function(_0x132c35){if(_0x132c35){if(!_0x132c35['length']){throw new db[(_0xe98e('0x63'))]['ValidationErrorItem'](_0xe98e('0x65'),0x193);}_0x35e003=_0x132c35;return db[_0xe98e('0x66')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x2916dd){if(_0x2916dd){_0x5cc834=_['keyBy'](_0x2916dd,'id');var _0x4f9159;var _0x3c3164=squel['select']();_0x3c3164[_0xe98e('0x69')](_0x106046[_0xe98e('0x6a')]);for(var _0xbb36e=0x0;_0xbb36e<_0x35e003[_0xe98e('0x3e')];_0xbb36e+=0x1){_0x4f9159=_0x35e003[_0xbb36e][_0xe98e('0x6b')]?_0x5cc834[_0x35e003[_0xbb36e][_0xe98e('0x6b')]]['metric']:_0x35e003[_0xbb36e][_0xe98e('0x60')];_0x4f9159=_0x35e003[_0xbb36e]['function']?_[_0xe98e('0x6d')](_0x22e991[_0x35e003[_0xbb36e][_0xe98e('0x6c')]],'%s',_0x4f9159):_0x4f9159;_0x4f9159=_0x35e003[_0xbb36e][_0xe98e('0x6e')]?_[_0xe98e('0x6d')](_0x54718b[_0x35e003[_0xbb36e][_0xe98e('0x6e')]],'%s',_0x4f9159):_0x4f9159;if(_0x35e003[_0xbb36e][_0xe98e('0x6f')]){_0x3c3164['group'](_0x4f9159);}_0x35e003[_0xbb36e][_0xe98e('0x81')]&&_0x3c3164[_0xe98e('0x35')](_0x4f9159,_0x35e003[_0xbb36e][_0xe98e('0x81')]===_0xe98e('0x9a')?![]:!![]);_0x3c3164[_0xe98e('0x60')](_0x4f9159,_0x35e003[_0xbb36e][_0xe98e('0x82')]||_0x4f9159);}if(_0x106046[_0xe98e('0x70')]){_0x106046[_0xe98e('0x70')]=JSON[_0xe98e('0x71')](_0x106046['joins']);for(var _0x5b16a7=0x0;_0x5b16a7<_0x106046['joins']['length'];_0x5b16a7+=0x1){if(_0x106046[_0xe98e('0x70')][_0x5b16a7][_0xe98e('0x72')]&&_[_0xe98e('0x59')](_0x1978cc,_0x106046['joins'][_0x5b16a7][_0xe98e('0x72')])&&_0x106046[_0xe98e('0x70')][_0x5b16a7][_0xe98e('0x73')]&&_0x106046[_0xe98e('0x70')][_0x5b16a7][_0xe98e('0x74')]&&_0x106046['joins'][_0x5b16a7][_0xe98e('0x75')]){_0x3c3164[_0x106046[_0xe98e('0x70')][_0x5b16a7][_0xe98e('0x72')]](_0x106046['joins'][_0x5b16a7][_0xe98e('0x74')],null,util[_0xe98e('0x6e')]('%s.%s\x20=\x20%s.%s',_0x106046[_0xe98e('0x6a')],_0x106046['joins'][_0x5b16a7]['parentKey'],_0x106046[_0xe98e('0x70')][_0x5b16a7][_0xe98e('0x74')],_0x106046[_0xe98e('0x70')][_0x5b16a7][_0xe98e('0x75')]));}}}if(_0x106046[_0xe98e('0x77')]){_0x106046['conditions']=JSON['parse'](_0x106046[_0xe98e('0x77')]);_0x3c3164[_0xe98e('0x37')](_0x12979c(_0x106046[_0xe98e('0x77')][_0xe98e('0x5f')]));}_0x4a9138=_0x3c3164['clone']();_0x3c3164[_0xe98e('0x1d')](_0x306bae);_0x3c3164[_0xe98e('0x1b')](0x0);logger[_0xe98e('0x78')](_0xe98e('0x79'),_0x3c3164[_0xe98e('0x7a')]());return dbH[_0xe98e('0x7b')]['query'](_0x3c3164['toString'](),{'type':dbH[_0xe98e('0x7b')][_0xe98e('0x94')]['SELECT']});}})[_0xe98e('0x22')](function(){return{'sql':_0x4a9138[_0xe98e('0x7a')]()};})[_0xe98e('0x22')](respondWithResult(_0x5c452f,null))[_0xe98e('0x43')](handleError(_0x5c452f,null));}; \ No newline at end of file +var _0x087b=['type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','AnalyticCustomReport','include','findAll','catch','params','find','create','body','user','get','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','format','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','operator','value','ValidationErrorItem','output','fullPath','%s-%s.%s','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','../../files/reports','from','countTable','COUNT(*)','QueryTypes','run','runReport','UNIX_TIMESTAMP(%s)','eml-format','rimraf','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName'];(function(_0x24c1f4,_0xf7c1ca){var _0x538cda=function(_0xa338a1){while(--_0xa338a1){_0x24c1f4['push'](_0x24c1f4['shift']());}};_0x538cda(++_0xf7c1ca);}(_0x087b,0x11a));var _0xb087=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x087b[_0x4dc7b9];return _0x3ab114;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];var dbH=require(_0xb087('0x1a'))[_0xb087('0x1b')];function respondWithStatusCode(_0x51ceaa,_0x3001e3){_0x3001e3=_0x3001e3||0xcc;return function(_0x3f145e){if(_0x3f145e){return _0x51ceaa[_0xb087('0x1c')](_0x3001e3);}return _0x51ceaa[_0xb087('0x1d')](_0x3001e3)[_0xb087('0x1e')]();};}function respondWithResult(_0x12d0db,_0x5e9757){_0x5e9757=_0x5e9757||0xc8;return function(_0x5147e3){if(_0x5147e3){return _0x12d0db[_0xb087('0x1d')](_0x5e9757)[_0xb087('0x1f')](_0x5147e3);}};}function respondWithFilteredResult(_0x5193a4,_0x43e576){return function(_0x412b48){if(_0x412b48){var _0x597478=typeof _0x43e576[_0xb087('0x20')]===_0xb087('0x21')&&typeof _0x43e576[_0xb087('0x22')]==='undefined';var _0x330005=_0x412b48[_0xb087('0x23')];var _0x17200d=_0x597478?0x0:_0x43e576[_0xb087('0x20')];var _0x4e333b=_0x597478?_0x412b48[_0xb087('0x23')]:_0x43e576[_0xb087('0x20')]+_0x43e576[_0xb087('0x22')];var _0x23c1b6;if(_0x4e333b>=_0x330005){_0x4e333b=_0x330005;_0x23c1b6=0xc8;}else{_0x23c1b6=0xce;}_0x5193a4['status'](_0x23c1b6);return _0x5193a4['set']('Content-Range',_0x17200d+'-'+_0x4e333b+'/'+_0x330005)['json'](_0x412b48);}return null;};}function patchUpdates(_0x45a6cf){return function(_0x17be8e){try{jsonpatch[_0xb087('0x24')](_0x17be8e,_0x45a6cf,!![]);}catch(_0x1f3c0e){return BPromise[_0xb087('0x25')](_0x1f3c0e);}return _0x17be8e[_0xb087('0x26')]();};}function saveUpdates(_0x31ae01,_0x5587f7){return function(_0x1d1424){if(_0x1d1424){return _0x1d1424[_0xb087('0x27')](_0x31ae01)[_0xb087('0x28')](function(_0x1cfb3e){return _0x1cfb3e;});}return null;};}function removeEntity(_0x3ad74e,_0x4d9028){return function(_0x183eab){if(_0x183eab){return _0x183eab[_0xb087('0x29')]()['then'](function(){var _0x5a2dc6=_0x183eab['get']({'plain':!![]});var _0x598b99='CustomReports';return db[_0xb087('0x2a')][_0xb087('0x29')]({'where':{'type':_0x598b99,'resourceId':_0x5a2dc6['id']}})[_0xb087('0x28')](function(){return _0x183eab;});})[_0xb087('0x28')](function(){_0x3ad74e[_0xb087('0x1d')](0xcc)[_0xb087('0x1e')]();});}};}function handleEntityNotFound(_0xf3f41f,_0x35a52c){return function(_0x6cfb22){if(!_0x6cfb22){_0xf3f41f[_0xb087('0x1c')](0x194);}return _0x6cfb22;};}function handleError(_0x18058c,_0x31e3e6){_0x31e3e6=_0x31e3e6||0x1f4;return function(_0xb0baf6){logger[_0xb087('0x2b')](_0xb0baf6['stack']);if(_0xb0baf6[_0xb087('0x2c')]){delete _0xb0baf6[_0xb087('0x2c')];}_0x18058c[_0xb087('0x1d')](_0x31e3e6)[_0xb087('0x2d')](_0xb0baf6);};}exports[_0xb087('0x2e')]=function(_0xa6d90c,_0x2e1c57){var _0x13fb2f={},_0x53a535={},_0x4c48f8={'count':0x0,'rows':[]};var _0x3f9311=_[_0xb087('0x2f')](db['AnalyticCustomReport'][_0xb087('0x30')],function(_0x7d3776){return{'name':_0x7d3776[_0xb087('0x31')],'type':_0x7d3776[_0xb087('0x32')][_0xb087('0x33')]};});_0x53a535[_0xb087('0x34')]=_[_0xb087('0x2f')](_0x3f9311,_0xb087('0x2c'));_0x53a535[_0xb087('0x35')]=_[_0xb087('0x36')](_0xa6d90c[_0xb087('0x35')]);_0x53a535[_0xb087('0x37')]=_['intersection'](_0x53a535[_0xb087('0x34')],_0x53a535['query']);_0x13fb2f[_0xb087('0x38')]=_[_0xb087('0x39')](_0x53a535[_0xb087('0x34')],qs[_0xb087('0x3a')](_0xa6d90c[_0xb087('0x35')][_0xb087('0x3a')]));_0x13fb2f[_0xb087('0x38')]=_0x13fb2f[_0xb087('0x38')][_0xb087('0x3b')]?_0x13fb2f['attributes']:_0x53a535['model'];if(!_0xa6d90c[_0xb087('0x35')][_0xb087('0x3c')](_0xb087('0x3d'))){_0x13fb2f[_0xb087('0x22')]=qs[_0xb087('0x22')](_0xa6d90c['query'][_0xb087('0x22')]);_0x13fb2f[_0xb087('0x20')]=qs['offset'](_0xa6d90c['query'][_0xb087('0x20')]);}_0x13fb2f[_0xb087('0x3e')]=qs[_0xb087('0x3f')](_0xa6d90c['query'][_0xb087('0x3f')]);_0x13fb2f[_0xb087('0x40')]=qs[_0xb087('0x37')](_[_0xb087('0x41')](_0xa6d90c[_0xb087('0x35')],_0x53a535['filters']),_0x3f9311);if(_0xa6d90c[_0xb087('0x35')]['filter']){_0x13fb2f[_0xb087('0x40')]=_['merge'](_0x13fb2f[_0xb087('0x40')],{'$or':_[_0xb087('0x2f')](_0x3f9311,function(_0x513332){if(_0x513332[_0xb087('0x32')]!=='VIRTUAL'){var _0x46d12a={};_0x46d12a[_0x513332['name']]={'$like':'%'+_0xa6d90c[_0xb087('0x35')][_0xb087('0x42')]+'%'};return _0x46d12a;}})});}_0x13fb2f=_[_0xb087('0x43')]({},_0x13fb2f,_0xa6d90c[_0xb087('0x44')]);var _0x1785e0={'where':_0x13fb2f[_0xb087('0x40')]};return db[_0xb087('0x45')]['count'](_0x1785e0)[_0xb087('0x28')](function(_0x5662c6){_0x4c48f8[_0xb087('0x23')]=_0x5662c6;if(_0xa6d90c[_0xb087('0x35')]['includeAll']){_0x13fb2f[_0xb087('0x46')]=[{'all':!![]}];}return db[_0xb087('0x45')][_0xb087('0x47')](_0x13fb2f);})['then'](function(_0x2789ca){_0x4c48f8['rows']=_0x2789ca;return _0x4c48f8;})[_0xb087('0x28')](respondWithFilteredResult(_0x2e1c57,_0x13fb2f))[_0xb087('0x48')](handleError(_0x2e1c57,null));};exports['show']=function(_0x38cb9d,_0x302ce7){var _0x4addbd={'raw':![],'where':{'id':_0x38cb9d[_0xb087('0x49')]['id']}},_0x2b969a={};_0x2b969a['model']=_[_0xb087('0x36')](db[_0xb087('0x45')][_0xb087('0x30')]);_0x2b969a[_0xb087('0x35')]=_['keys'](_0x38cb9d['query']);_0x2b969a[_0xb087('0x37')]=_[_0xb087('0x39')](_0x2b969a[_0xb087('0x34')],_0x2b969a[_0xb087('0x35')]);_0x4addbd[_0xb087('0x38')]=_[_0xb087('0x39')](_0x2b969a['model'],qs['fields'](_0x38cb9d[_0xb087('0x35')]['fields']));_0x4addbd[_0xb087('0x38')]=_0x4addbd[_0xb087('0x38')][_0xb087('0x3b')]?_0x4addbd[_0xb087('0x38')]:_0x2b969a['model'];if(_0x38cb9d[_0xb087('0x35')]['includeAll']){_0x4addbd[_0xb087('0x46')]=[{'all':!![]}];}_0x4addbd=_[_0xb087('0x43')]({},_0x4addbd,_0x38cb9d[_0xb087('0x44')]);return db[_0xb087('0x45')][_0xb087('0x4a')](_0x4addbd)['then'](handleEntityNotFound(_0x302ce7,null))[_0xb087('0x28')](respondWithResult(_0x302ce7,null))[_0xb087('0x48')](handleError(_0x302ce7,null));};exports[_0xb087('0x4b')]=function(_0x4fba31,_0x829031){return db['AnalyticCustomReport']['create'](_0x4fba31[_0xb087('0x4c')],{})[_0xb087('0x28')](function(_0x5eacf3){var _0x4362d4=_0x4fba31[_0xb087('0x4d')][_0xb087('0x4e')]({'plain':!![]});if(!_0x4362d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4362d4['role']===_0xb087('0x4d')){var _0x54862a=_0x5eacf3['get']({'plain':!![]});var _0x1e52e4=_0xb087('0x4f');return db[_0xb087('0x50')][_0xb087('0x4a')]({'where':{'name':_0x1e52e4,'userProfileId':_0x4362d4[_0xb087('0x51')]},'raw':!![]})[_0xb087('0x28')](function(_0xbd849d){if(_0xbd849d&&_0xbd849d[_0xb087('0x52')]===0x0){return db[_0xb087('0x2a')][_0xb087('0x4b')]({'name':_0x54862a[_0xb087('0x2c')],'resourceId':_0x54862a['id'],'type':_0xb087('0x53'),'sectionId':_0xbd849d['id']},{})['then'](function(){return _0x5eacf3;});}else{return _0x5eacf3;}})[_0xb087('0x48')](function(_0x46548e){logger['error'](_0xb087('0x54'),_0x46548e);throw _0x46548e;});}return _0x5eacf3;})[_0xb087('0x28')](respondWithResult(_0x829031,0xc9))[_0xb087('0x48')](handleError(_0x829031,null));};exports[_0xb087('0x27')]=function(_0x401901,_0x3c85d1){if(_0x401901[_0xb087('0x4c')]['id']){delete _0x401901[_0xb087('0x4c')]['id'];}return db[_0xb087('0x45')][_0xb087('0x4a')]({'where':{'id':_0x401901[_0xb087('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c85d1,null))[_0xb087('0x28')](saveUpdates(_0x401901['body'],null))[_0xb087('0x28')](respondWithResult(_0x3c85d1,null))['catch'](handleError(_0x3c85d1,null));};exports[_0xb087('0x29')]=function(_0x56c67,_0x187ffd){return db[_0xb087('0x45')][_0xb087('0x4a')]({'where':{'id':_0x56c67[_0xb087('0x49')]['id']}})[_0xb087('0x28')](handleEntityNotFound(_0x187ffd,null))[_0xb087('0x28')](removeEntity(_0x187ffd,null))[_0xb087('0x48')](handleError(_0x187ffd,null));};exports[_0xb087('0x55')]=function(_0x300e9b,_0x2ee0a3){var _0x3834a6=0xa;var _0x22be05=[_0xb087('0x56'),_0xb087('0x57'),_0xb087('0x58'),_0xb087('0x59')];var _0x40ff74={'SUM':_0xb087('0x5a'),'COUNT':_0xb087('0x5b'),'COUNT DISTINCT':_0xb087('0x5c'),'MAX':'MAX(%s)','MIN':_0xb087('0x5d'),'AVG':_0xb087('0x5e'),'GROUP_CONCAT':_0xb087('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb087('0x60')};var _0x1858fe={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb087('0x61'),'HOUR':_0xb087('0x62'),'ROUND':_0xb087('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x133c58=function(_0x257894){return!_[_0xb087('0x64')]([_0xb087('0x65'),_0xb087('0x66'),_0xb087('0x67'),_0xb087('0x68')],_0x257894);};var _0x450ee4=function(_0x4ff2db){if(!_0x4ff2db||!_0x4ff2db[_0xb087('0x69')][_0xb087('0x3b')]){return'';}for(var _0x44548f='(',_0x47b2c7=0x0;_0x47b2c7<_0x4ff2db[_0xb087('0x69')]['length'];_0x47b2c7+=0x1){_0x47b2c7>0x0&&(_0x44548f+='\x20'+_0x4ff2db['operator']+'\x20');_0x44548f+=_0x4ff2db[_0xb087('0x69')][_0x47b2c7][_0xb087('0x6a')]?_0x450ee4(_0x4ff2db['rules'][_0x47b2c7][_0xb087('0x6a')]):_0x4ff2db['rules'][_0x47b2c7][_0xb087('0x6b')]+'\x20'+_0x4ff2db[_0xb087('0x69')][_0x47b2c7]['condition']+(_0x133c58(_0x4ff2db['rules'][_0x47b2c7][_0xb087('0x6c')])?'\x20'+_0x4ff2db['rules'][_0x47b2c7]['value']:'');}return _0x44548f+')';};var _0x3c97ab={'where':{'id':_0x300e9b[_0xb087('0x49')]['id']}},_0x52d72a,_0x34ad78,_0x5939e9,_0x2274f5,_0x132dd8;_0x3c97ab=_[_0xb087('0x43')]({},_0x3c97ab,_0x300e9b[_0xb087('0x44')]);return db[_0xb087('0x45')]['find'](_0x3c97ab)[_0xb087('0x28')](function(_0x4b8a79){if(_0x4b8a79){_0x52d72a=_0x4b8a79;return _0x4b8a79[_0xb087('0x6d')]();}return null;})[_0xb087('0x28')](function(_0x1060e1){if(_0x1060e1){if(!_0x1060e1['length']){throw new db[(_0xb087('0x6e'))]['ValidationErrorItem'](_0xb087('0x6f'),0x193);}_0x34ad78=_0x1060e1;return db[_0xb087('0x70')][_0xb087('0x47')]({'raw':!![]});}return null;})[_0xb087('0x28')](function(_0x16cb87){if(_0x16cb87){_0x5939e9=_[_0xb087('0x71')](_0x16cb87,'id');var _0x4cd4ac;var _0x245d68=squel[_0xb087('0x72')]();_0x245d68['from'](_0x52d72a[_0xb087('0x73')]);for(var _0x58de88=0x0;_0x58de88<_0x34ad78[_0xb087('0x3b')];_0x58de88+=0x1){_0x4cd4ac=_0x34ad78[_0x58de88][_0xb087('0x74')]?_0x5939e9[_0x34ad78[_0x58de88][_0xb087('0x74')]][_0xb087('0x75')]:_0x34ad78[_0x58de88][_0xb087('0x6b')];_0x4cd4ac=_0x34ad78[_0x58de88][_0xb087('0x76')]?_[_0xb087('0x77')](_0x40ff74[_0x34ad78[_0x58de88][_0xb087('0x76')]],'%s',_0x4cd4ac):_0x4cd4ac;_0x4cd4ac=_0x34ad78[_0x58de88]['format']?_['replace'](_0x1858fe[_0x34ad78[_0x58de88]['format']],'%s',_0x4cd4ac):_0x4cd4ac;if(_0x34ad78[_0x58de88][_0xb087('0x78')]){_0x245d68['group'](_0x4cd4ac);}_0x34ad78[_0x58de88][_0xb087('0x79')]&&_0x245d68['order'](_0x4cd4ac,_0x34ad78[_0x58de88][_0xb087('0x79')]===_0xb087('0x7a')?![]:!![]);_0x245d68[_0xb087('0x6b')](_0x4cd4ac,_0x34ad78[_0x58de88][_0xb087('0x7b')]||_0x4cd4ac);}if(_0x52d72a['joins']){_0x52d72a[_0xb087('0x7c')]=JSON['parse'](_0x52d72a[_0xb087('0x7c')]);for(var _0x2e29e9=0x0;_0x2e29e9<_0x52d72a[_0xb087('0x7c')][_0xb087('0x3b')];_0x2e29e9+=0x1){if(_0x52d72a['joins'][_0x2e29e9]['type']&&_[_0xb087('0x64')](_0x22be05,_0x52d72a['joins'][_0x2e29e9][_0xb087('0x32')])&&_0x52d72a[_0xb087('0x7c')][_0x2e29e9][_0xb087('0x7d')]&&_0x52d72a[_0xb087('0x7c')][_0x2e29e9]['foreignTable']&&_0x52d72a['joins'][_0x2e29e9][_0xb087('0x7e')]){_0x245d68[_0x52d72a['joins'][_0x2e29e9][_0xb087('0x32')]](_0x52d72a[_0xb087('0x7c')][_0x2e29e9][_0xb087('0x7f')],null,util[_0xb087('0x80')](_0xb087('0x81'),_0x52d72a['table'],_0x52d72a[_0xb087('0x7c')][_0x2e29e9][_0xb087('0x7d')],_0x52d72a['joins'][_0x2e29e9]['foreignTable'],_0x52d72a['joins'][_0x2e29e9][_0xb087('0x7e')]));}}}if(_0x52d72a[_0xb087('0x82')]){_0x52d72a[_0xb087('0x82')]=JSON[_0xb087('0x83')](_0x52d72a[_0xb087('0x82')]);_0x245d68[_0xb087('0x40')](_0x450ee4(_0x52d72a['conditions'][_0xb087('0x6a')]));}_0x132dd8=_0x245d68[_0xb087('0x84')]();_0x245d68[_0xb087('0x22')](_0x3834a6);_0x245d68[_0xb087('0x20')](0x0);logger[_0xb087('0x85')](_0xb087('0x86'),_0x245d68[_0xb087('0x87')]());return dbH['sequelize'][_0xb087('0x35')](_0x245d68[_0xb087('0x87')](),{'type':dbH[_0xb087('0x88')]['QueryTypes'][_0xb087('0x89')]});}})['then'](respondWithResult(_0x2ee0a3,null))[_0xb087('0x48')](handleError(_0x2ee0a3,null));};function runReport(_0x5fb869,_0x45da69,_0x267dea){var _0x463791=_0x45da69[_0xb087('0x2c')];var _0x5d3107=0xa;var _0x4ae3bb=[_0xb087('0x56'),_0xb087('0x57'),'right_join',_0xb087('0x59')];var _0xc9b209={'SUM':_0xb087('0x5a'),'COUNT':_0xb087('0x5b'),'COUNT DISTINCT':_0xb087('0x5c'),'MAX':_0xb087('0x8a'),'MIN':'MIN(%s)','AVG':_0xb087('0x5e'),'GROUP_CONCAT':_0xb087('0x5f'),'GROUP_CONCAT ASC':_0xb087('0x8b'),'GROUP_CONCAT DESC':_0xb087('0x60')};var _0x416e05={'SEC_TO_TIME':_0xb087('0x8c'),'DATE':_0xb087('0x61'),'HOUR':_0xb087('0x62'),'ROUND':_0xb087('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2dc3ef=function(_0x50685d){return!_[_0xb087('0x64')]([_0xb087('0x65'),'IS\x20NOT\x20NULL',_0xb087('0x67'),_0xb087('0x68')],_0x50685d);};var _0x8b1a5b=function(_0x2a076b){if(!_0x2a076b||!_0x2a076b[_0xb087('0x69')][_0xb087('0x3b')]){return'';}for(var _0x573ba1='(',_0xacc1f4=0x0;_0xacc1f4<_0x2a076b[_0xb087('0x69')][_0xb087('0x3b')];_0xacc1f4+=0x1){_0xacc1f4>0x0&&(_0x573ba1+='\x20'+_0x2a076b[_0xb087('0x8d')]+'\x20');_0x573ba1+=_0x2a076b[_0xb087('0x69')][_0xacc1f4]['group']?_0x8b1a5b(_0x2a076b[_0xb087('0x69')][_0xacc1f4][_0xb087('0x6a')]):_0x2a076b[_0xb087('0x69')][_0xacc1f4][_0xb087('0x6b')]+'\x20'+_0x2a076b[_0xb087('0x69')][_0xacc1f4][_0xb087('0x6c')]+(_0x2dc3ef(_0x2a076b[_0xb087('0x69')][_0xacc1f4][_0xb087('0x6c')])?'\x20'+_0x2a076b[_0xb087('0x69')][_0xacc1f4][_0xb087('0x8e')]:'');}return _0x573ba1+')';};var _0x25cec3={'where':{'id':_0x5fb869['id']}},_0x5d4953,_0x59121a,_0x10a83d,_0x442237,_0x3fbbb6;_0x25cec3=_[_0xb087('0x43')]({},_0x25cec3,_0x267dea);return db[_0xb087('0x45')]['find'](_0x25cec3)[_0xb087('0x28')](function(_0x7648a1){if(_0x7648a1){_0x5d4953=_0x7648a1;return _0x7648a1[_0xb087('0x6d')]();}return null;})[_0xb087('0x28')](function(_0x3e58be){if(_0x3e58be){if(!_0x3e58be[_0xb087('0x3b')]){throw new db['Sequelize'][(_0xb087('0x8f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x59121a=_0x3e58be;return db['AnalyticMetric'][_0xb087('0x47')]({'raw':!![]});}return null;})[_0xb087('0x28')](function(_0x3a446d){if(_0x3a446d){_0x10a83d=_[_0xb087('0x71')](_0x3a446d,'id');var _0x4859c8;var _0x313c9b=squel[_0xb087('0x72')]();_0x313c9b['from'](_0x5d4953[_0xb087('0x73')]);for(var _0x4a2867=0x0;_0x4a2867<_0x59121a['length'];_0x4a2867+=0x1){_0x4859c8=_0x59121a[_0x4a2867][_0xb087('0x74')]?_0x10a83d[_0x59121a[_0x4a2867][_0xb087('0x74')]][_0xb087('0x75')]:_0x59121a[_0x4a2867][_0xb087('0x6b')];_0x4859c8=_0x59121a[_0x4a2867][_0xb087('0x76')]?_['replace'](_0xc9b209[_0x59121a[_0x4a2867][_0xb087('0x76')]],'%s',_0x4859c8):_0x4859c8;_0x4859c8=_0x59121a[_0x4a2867][_0xb087('0x80')]?_[_0xb087('0x77')](_0x416e05[_0x59121a[_0x4a2867][_0xb087('0x80')]],'%s',_0x4859c8):_0x4859c8;if(_0x59121a[_0x4a2867]['groupBy']){_0x313c9b['group'](_0x4859c8);}_0x59121a[_0x4a2867]['orderBy']&&_0x313c9b['order'](_0x4859c8,_0x59121a[_0x4a2867][_0xb087('0x79')]===_0xb087('0x7a')?![]:!![]);_0x313c9b[_0xb087('0x6b')](_0x4859c8,_0x59121a[_0x4a2867][_0xb087('0x7b')]||_0x4859c8);}if(_0x5d4953[_0xb087('0x7c')]){_0x5d4953[_0xb087('0x7c')]=JSON[_0xb087('0x83')](_0x5d4953['joins']);for(var _0x5d45e7=0x0;_0x5d45e7<_0x5d4953[_0xb087('0x7c')][_0xb087('0x3b')];_0x5d45e7+=0x1){if(_0x5d4953[_0xb087('0x7c')][_0x5d45e7][_0xb087('0x32')]&&_['includes'](_0x4ae3bb,_0x5d4953[_0xb087('0x7c')][_0x5d45e7]['type'])&&_0x5d4953[_0xb087('0x7c')][_0x5d45e7]['parentKey']&&_0x5d4953[_0xb087('0x7c')][_0x5d45e7][_0xb087('0x7f')]&&_0x5d4953[_0xb087('0x7c')][_0x5d45e7][_0xb087('0x7e')]){_0x313c9b[_0x5d4953['joins'][_0x5d45e7][_0xb087('0x32')]](_0x5d4953['joins'][_0x5d45e7]['foreignTable'],null,util['format'](_0xb087('0x81'),_0x5d4953['table'],_0x5d4953[_0xb087('0x7c')][_0x5d45e7][_0xb087('0x7d')],_0x5d4953[_0xb087('0x7c')][_0x5d45e7][_0xb087('0x7f')],_0x5d4953[_0xb087('0x7c')][_0x5d45e7][_0xb087('0x7e')]));}}}if(_0x5d4953[_0xb087('0x82')]){_0x5d4953[_0xb087('0x82')]=JSON[_0xb087('0x83')](_0x5d4953[_0xb087('0x82')]);_0x313c9b[_0xb087('0x40')](_0x8b1a5b(_0x5d4953[_0xb087('0x82')][_0xb087('0x6a')]));}_0x3fbbb6=_0x313c9b[_0xb087('0x84')]();_0x313c9b[_0xb087('0x22')](_0x5d3107);_0x313c9b[_0xb087('0x20')](0x0);return;}})[_0xb087('0x28')](function(){if(_0x45da69[_0xb087('0x90')]==='web'){return null;}var _0x15e2f9=_['merge'](_0x45da69,{'name':_0x45da69[_0xb087('0x91')]||_0x45da69[_0xb087('0x2c')]||_0x5d4953[_0xb087('0x2c')],'basename':_0x463791,'savename':util[_0xb087('0x80')](_0xb087('0x92'),_0x45da69[_0xb087('0x2c')]||_0x5d4953[_0xb087('0x2c')],require('randomstring')['generate'](0x4),_0x45da69['output']||_0xb087('0x93')),'reportId':_0x5d4953['id'],'reportType':_0xb087('0x94')});return db[_0xb087('0x95')][_0xb087('0x4b')](_0x15e2f9,{'raw':!![]});})[_0xb087('0x28')](function(_0x3187d7){if(_0x5d4953[_0xb087('0x73')]===_0xb087('0x96')){_0x3fbbb6[_0xb087('0x40')](_0x5d4953['table']+_0xb087('0x97'),_0x45da69['startDate'],_0x45da69[_0xb087('0x98')]);}else{_0x3fbbb6[_0xb087('0x40')](_0x5d4953['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x45da69[_0xb087('0x99')],_0x45da69[_0xb087('0x98')]);}if(_0x3187d7){logger[_0xb087('0x9a')](_0xb087('0x9b'),_0x3fbbb6['toString']());require(_0xb087('0x9c'))[_0xb087('0x9d')](path['join'](__dirname,'../../components/export/',_0x3187d7[_0xb087('0x90')]),[_0x3187d7['id'],_0x3fbbb6['toString'](),path['join'](__dirname,_0xb087('0x9e'),_0x3187d7['savename']),_0x463791]);return _0x3187d7;}else{var _0x4059ac=squel[_0xb087('0x72')]();_0x4059ac[_0xb087('0x9f')]('('+_0x3fbbb6[_0xb087('0x87')]()+')',_0xb087('0xa0'));_0x4059ac[_0xb087('0x6b')](_0xb087('0xa1'),_0xb087('0x23'));_0x3fbbb6['limit'](_0x45da69[_0xb087('0x22')]||_0x5d3107);_0x3fbbb6['offset'](_0x45da69['offset']||0x0);return dbH[_0xb087('0x88')][_0xb087('0x35')](_0x4059ac[_0xb087('0x87')](),{'type':dbH['sequelize'][_0xb087('0xa2')][_0xb087('0x89')]})[_0xb087('0x28')](function(_0x177bde){if(!_0x177bde['length']){_0x442237=0x0;}else{_0x442237=_0x177bde[0x0][_0xb087('0x23')]||0x0;}return dbH[_0xb087('0x88')][_0xb087('0x35')](_0x3fbbb6[_0xb087('0x87')](),{'type':dbH[_0xb087('0x88')][_0xb087('0xa2')][_0xb087('0x89')]});})['then'](function(_0x1de68b){return{'rows':_0x1de68b||[],'count':_0x442237};});}});}exports[_0xb087('0xa3')]=function(_0x321f55,_0x29a36d){return runReport(_0x321f55[_0xb087('0x49')],_0x321f55[_0xb087('0x35')],_0x321f55['options'])[_0xb087('0x28')](respondWithResult(_0x29a36d,null))[_0xb087('0x48')](handleError(_0x29a36d,null));};exports[_0xb087('0xa4')]=runReport;exports['query']=function(_0x56f173,_0x2adb5d){var _0x12c676=0xa;var _0xee09f5=[_0xb087('0x56'),_0xb087('0x57'),_0xb087('0x58'),_0xb087('0x59')];var _0x2795e9={'SUM':_0xb087('0x5a'),'COUNT':_0xb087('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb087('0x8a'),'MIN':_0xb087('0x5d'),'AVG':_0xb087('0x5e'),'GROUP_CONCAT':_0xb087('0x5f'),'GROUP_CONCAT ASC':_0xb087('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x33756c={'SEC_TO_TIME':_0xb087('0x8c'),'DATE':_0xb087('0x61'),'HOUR':_0xb087('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb087('0xa5')};var _0x547968=function(_0x4208ac){return!_['includes'](['IS\x20NULL',_0xb087('0x66'),_0xb087('0x67'),_0xb087('0x68')],_0x4208ac);};var _0x572d78=function(_0x595faa){if(!_0x595faa||!_0x595faa[_0xb087('0x69')][_0xb087('0x3b')]){return'';}for(var _0x169e2b='(',_0x237960=0x0;_0x237960<_0x595faa[_0xb087('0x69')]['length'];_0x237960+=0x1){_0x237960>0x0&&(_0x169e2b+='\x20'+_0x595faa[_0xb087('0x8d')]+'\x20');_0x169e2b+=_0x595faa[_0xb087('0x69')][_0x237960][_0xb087('0x6a')]?_0x572d78(_0x595faa[_0xb087('0x69')][_0x237960][_0xb087('0x6a')]):_0x595faa[_0xb087('0x69')][_0x237960]['field']+'\x20'+_0x595faa['rules'][_0x237960][_0xb087('0x6c')]+(_0x547968(_0x595faa[_0xb087('0x69')][_0x237960]['condition'])?'\x20'+_0x595faa[_0xb087('0x69')][_0x237960]['value']:'');}return _0x169e2b+')';};var _0x5984d9={'where':{'id':_0x56f173[_0xb087('0x49')]['id']}},_0x471c54,_0x3193c8,_0x40a3f5,_0x2818b5,_0xc9faba;_0x5984d9=_[_0xb087('0x43')]({},_0x5984d9,_0x56f173[_0xb087('0x44')]);return db[_0xb087('0x45')][_0xb087('0x4a')](_0x5984d9)['then'](function(_0x5cccfb){if(_0x5cccfb){_0x471c54=_0x5cccfb;return _0x5cccfb['getFields']();}return null;})[_0xb087('0x28')](function(_0x5947e7){if(_0x5947e7){if(!_0x5947e7[_0xb087('0x3b')]){throw new db['Sequelize']['ValidationErrorItem'](_0xb087('0x6f'),0x193);}_0x3193c8=_0x5947e7;return db[_0xb087('0x70')][_0xb087('0x47')]({'raw':!![]});}return null;})[_0xb087('0x28')](function(_0xd57743){if(_0xd57743){_0x40a3f5=_[_0xb087('0x71')](_0xd57743,'id');var _0x187df1;var _0x778002=squel[_0xb087('0x72')]();_0x778002[_0xb087('0x9f')](_0x471c54['table']);for(var _0x49d68a=0x0;_0x49d68a<_0x3193c8['length'];_0x49d68a+=0x1){_0x187df1=_0x3193c8[_0x49d68a][_0xb087('0x74')]?_0x40a3f5[_0x3193c8[_0x49d68a][_0xb087('0x74')]]['metric']:_0x3193c8[_0x49d68a][_0xb087('0x6b')];_0x187df1=_0x3193c8[_0x49d68a][_0xb087('0x76')]?_['replace'](_0x2795e9[_0x3193c8[_0x49d68a]['function']],'%s',_0x187df1):_0x187df1;_0x187df1=_0x3193c8[_0x49d68a][_0xb087('0x80')]?_['replace'](_0x33756c[_0x3193c8[_0x49d68a][_0xb087('0x80')]],'%s',_0x187df1):_0x187df1;if(_0x3193c8[_0x49d68a]['groupBy']){_0x778002[_0xb087('0x6a')](_0x187df1);}_0x3193c8[_0x49d68a][_0xb087('0x79')]&&_0x778002[_0xb087('0x3e')](_0x187df1,_0x3193c8[_0x49d68a]['orderBy']===_0xb087('0x7a')?![]:!![]);_0x778002[_0xb087('0x6b')](_0x187df1,_0x3193c8[_0x49d68a][_0xb087('0x7b')]||_0x187df1);}if(_0x471c54[_0xb087('0x7c')]){_0x471c54[_0xb087('0x7c')]=JSON[_0xb087('0x83')](_0x471c54[_0xb087('0x7c')]);for(var _0x1b6679=0x0;_0x1b6679<_0x471c54[_0xb087('0x7c')][_0xb087('0x3b')];_0x1b6679+=0x1){if(_0x471c54['joins'][_0x1b6679][_0xb087('0x32')]&&_['includes'](_0xee09f5,_0x471c54[_0xb087('0x7c')][_0x1b6679][_0xb087('0x32')])&&_0x471c54[_0xb087('0x7c')][_0x1b6679]['parentKey']&&_0x471c54['joins'][_0x1b6679]['foreignTable']&&_0x471c54[_0xb087('0x7c')][_0x1b6679][_0xb087('0x7e')]){_0x778002[_0x471c54[_0xb087('0x7c')][_0x1b6679][_0xb087('0x32')]](_0x471c54[_0xb087('0x7c')][_0x1b6679][_0xb087('0x7f')],null,util[_0xb087('0x80')]('%s.%s\x20=\x20%s.%s',_0x471c54[_0xb087('0x73')],_0x471c54['joins'][_0x1b6679]['parentKey'],_0x471c54['joins'][_0x1b6679]['foreignTable'],_0x471c54[_0xb087('0x7c')][_0x1b6679][_0xb087('0x7e')]));}}}if(_0x471c54['conditions']){_0x471c54[_0xb087('0x82')]=JSON[_0xb087('0x83')](_0x471c54[_0xb087('0x82')]);_0x778002['where'](_0x572d78(_0x471c54[_0xb087('0x82')][_0xb087('0x6a')]));}_0xc9faba=_0x778002['clone']();_0x778002[_0xb087('0x22')](_0x12c676);_0x778002[_0xb087('0x20')](0x0);logger[_0xb087('0x85')](_0xb087('0x86'),_0x778002['toString']());return dbH[_0xb087('0x88')][_0xb087('0x35')](_0x778002[_0xb087('0x87')](),{'type':dbH[_0xb087('0x88')][_0xb087('0xa2')][_0xb087('0x89')]});}})['then'](function(){return{'sql':_0xc9faba[_0xb087('0x87')]()};})['then'](respondWithResult(_0x2adb5d,null))[_0xb087('0x48')](handleError(_0x2adb5d,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 4972b9c..fb817af 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 _0xf980=['bluebird','request-promise','path','rimraf','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger'];(function(_0x3bc8c2,_0x45e0f7){var _0x471d7a=function(_0x2d3afa){while(--_0x2d3afa){_0x3bc8c2['push'](_0x3bc8c2['shift']());}};_0x471d7a(++_0x45e0f7);}(_0xf980,0xd9));var _0x0f98=function(_0x42a571,_0x57321c){_0x42a571=_0x42a571-0x0;var _0x32afaf=_0xf980[_0x42a571];return _0x32afaf;};'use strict';var _=require(_0x0f98('0x0'));var util=require(_0x0f98('0x1'));var logger=require(_0x0f98('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0f98('0x3'));var rp=require(_0x0f98('0x4'));var fs=require('fs');var path=require(_0x0f98('0x5'));var rimraf=require(_0x0f98('0x6'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x0f98('0x7')]=function(_0x150f5f,_0x220eb4){return _0x150f5f['define'](_0x0f98('0x8'),attributes,{'tableName':_0x0f98('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x971f=['../../config/logger','api','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x15aef2,_0x51e33f){var _0x8603f5=function(_0x14f47c){while(--_0x14f47c){_0x15aef2['push'](_0x15aef2['shift']());}};_0x8603f5(++_0x51e33f);}(_0x971f,0x10a));var _0xf971=function(_0x4b176e,_0x4d771e){_0x4b176e=_0x4b176e-0x0;var _0x5a603b=_0x971f[_0x4b176e];return _0x5a603b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf971('0x0'))(_0xf971('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf971('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf971('0x3'));var config=require(_0xf971('0x4'));var attributes=require(_0xf971('0x5'));module[_0xf971('0x6')]=function(_0x51b9b1,_0x5b5ed7){return _0x51b9b1['define']('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','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 d783d8a..69eae75 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 _0xfe16=['http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe16,0x17e));var _0x6fe1=function(_0x2a9734,_0x3a1363){_0x2a9734=_0x2a9734-0x0;var _0x59d0d7=_0xfe16[_0x2a9734];return _0x59d0d7;};'use strict';var _=require(_0x6fe1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6fe1('0x1'));var rs=require(_0x6fe1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fe1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fe1('0x4'))(_0x6fe1('0x5'));var config=require(_0x6fe1('0x6'));var jayson=require(_0x6fe1('0x7'));var client=jayson[_0x6fe1('0x8')][_0x6fe1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c51d6,_0x32d5f1,_0x5568af){return new BPromise(function(_0x446971,_0x5bdc67){return client[_0x6fe1('0xa')](_0x4c51d6,_0x5568af)[_0x6fe1('0xb')](function(_0x39f6d7){logger[_0x6fe1('0xc')](_0x6fe1('0xd'),_0x32d5f1,_0x6fe1('0xe'));logger[_0x6fe1('0xf')](_0x6fe1('0x10'),_0x32d5f1,_0x6fe1('0xe'),JSON[_0x6fe1('0x11')](_0x39f6d7));if(_0x39f6d7['error']){if(_0x39f6d7[_0x6fe1('0x12')][_0x6fe1('0x13')]===0x1f4){logger[_0x6fe1('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x32d5f1,_0x39f6d7[_0x6fe1('0x12')][_0x6fe1('0x14')]);return _0x5bdc67(_0x39f6d7['error'][_0x6fe1('0x14')]);}logger[_0x6fe1('0x12')](_0x6fe1('0xd'),_0x32d5f1,_0x39f6d7[_0x6fe1('0x12')]['message']);return _0x446971(_0x39f6d7[_0x6fe1('0x12')][_0x6fe1('0x14')]);}else{logger['info'](_0x6fe1('0xd'),_0x32d5f1,_0x6fe1('0xe'));_0x446971(_0x39f6d7[_0x6fe1('0x15')]['message']);}})[_0x6fe1('0x16')](function(_0x525995){logger[_0x6fe1('0x12')](_0x6fe1('0xd'),_0x32d5f1,_0x525995);_0x5bdc67(_0x525995);});});} \ No newline at end of file +var _0xdffe=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdffe,0x138));var _0xedff=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0xdffe[_0x4cc492];return _0x1f36b9;};'use strict';var _=require(_0xedff('0x0'));var util=require(_0xedff('0x1'));var moment=require(_0xedff('0x2'));var BPromise=require('bluebird');var rs=require(_0xedff('0x3'));var fs=require('fs');var Redis=require(_0xedff('0x4'));var db=require(_0xedff('0x5'))['db'];var utils=require(_0xedff('0x6'));var logger=require(_0xedff('0x7'))(_0xedff('0x8'));var config=require(_0xedff('0x9'));var jayson=require(_0xedff('0xa'));var client=jayson[_0xedff('0xb')][_0xedff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x282a98,_0x57fb73,_0x36896f){return new BPromise(function(_0x333e41,_0x287294){return client[_0xedff('0xd')](_0x282a98,_0x36896f)[_0xedff('0xe')](function(_0x5547dc){logger[_0xedff('0xf')](_0xedff('0x10'),_0x57fb73,_0xedff('0x11'));logger[_0xedff('0x12')](_0xedff('0x13'),_0x57fb73,_0xedff('0x11'),JSON[_0xedff('0x14')](_0x5547dc));if(_0x5547dc['error']){if(_0x5547dc[_0xedff('0x15')][_0xedff('0x16')]===0x1f4){logger['error'](_0xedff('0x10'),_0x57fb73,_0x5547dc[_0xedff('0x15')][_0xedff('0x17')]);return _0x287294(_0x5547dc[_0xedff('0x15')][_0xedff('0x17')]);}logger['error'](_0xedff('0x10'),_0x57fb73,_0x5547dc[_0xedff('0x15')][_0xedff('0x17')]);return _0x333e41(_0x5547dc[_0xedff('0x15')]['message']);}else{logger[_0xedff('0xf')](_0xedff('0x10'),_0x57fb73,_0xedff('0x11'));_0x333e41(_0x5547dc[_0xedff('0x18')][_0xedff('0x17')]);}})[_0xedff('0x19')](function(_0x4810c3){logger[_0xedff('0x15')](_0xedff('0x10'),_0x57fb73,_0x4810c3);_0x287294(_0x4810c3);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 0778a4a..a0db42b 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 _0xfa19=['destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','run','/:id/query','put','delete'];(function(_0x45ac0c,_0x2f8a58){var _0x4b4074=function(_0x1ddc53){while(--_0x1ddc53){_0x45ac0c['push'](_0x45ac0c['shift']());}};_0x4b4074(++_0x2f8a58);}(_0xfa19,0x73));var _0x9fa1=function(_0x221743,_0x186de6){_0x221743=_0x221743-0x0;var _0x38caa8=_0xfa19[_0x221743];return _0x38caa8;};'use strict';var multer=require(_0x9fa1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9fa1('0x1'));var express=require(_0x9fa1('0x2'));var router=express[_0x9fa1('0x3')]();var fs_extra=require(_0x9fa1('0x4'));var auth=require(_0x9fa1('0x5'));var interaction=require(_0x9fa1('0x6'));var config=require('../../config/environment');var controller=require(_0x9fa1('0x7'));router[_0x9fa1('0x8')]('/',auth[_0x9fa1('0x9')](),controller[_0x9fa1('0xa')]);router[_0x9fa1('0x8')](_0x9fa1('0xb'),auth[_0x9fa1('0x9')](),controller[_0x9fa1('0xc')]);router[_0x9fa1('0x8')](_0x9fa1('0xd'),auth[_0x9fa1('0x9')](),controller['preview']);router[_0x9fa1('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0x9fa1('0xe')]);router[_0x9fa1('0x8')](_0x9fa1('0xf'),auth[_0x9fa1('0x9')](),controller['query']);router['post']('/',auth[_0x9fa1('0x9')](),controller['create']);router[_0x9fa1('0x10')](_0x9fa1('0xb'),auth[_0x9fa1('0x9')](),controller['update']);router[_0x9fa1('0x11')](_0x9fa1('0xb'),auth[_0x9fa1('0x9')](),controller[_0x9fa1('0x12')]);module['exports']=router; \ No newline at end of file +var _0x345c=['get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x345c,0xc0));var _0xc345=function(_0x43d8e0,_0x367324){_0x43d8e0=_0x43d8e0-0x0;var _0x58e421=_0x345c[_0x43d8e0];return _0x58e421;};'use strict';var multer=require(_0xc345('0x0'));var util=require(_0xc345('0x1'));var path=require('path');var timeout=require(_0xc345('0x2'));var express=require('express');var router=express[_0xc345('0x3')]();var fs_extra=require(_0xc345('0x4'));var auth=require(_0xc345('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc345('0x6'));var controller=require(_0xc345('0x7'));router[_0xc345('0x8')]('/',auth[_0xc345('0x9')](),controller[_0xc345('0xa')]);router[_0xc345('0x8')]('/:id',auth[_0xc345('0x9')](),controller[_0xc345('0xb')]);router[_0xc345('0x8')](_0xc345('0xc'),auth['isAuthenticated'](),controller[_0xc345('0xd')]);router[_0xc345('0x8')](_0xc345('0xe'),auth[_0xc345('0x9')](),controller[_0xc345('0xf')]);router[_0xc345('0x8')](_0xc345('0x10'),auth[_0xc345('0x9')](),controller[_0xc345('0x11')]);router[_0xc345('0x12')]('/',auth[_0xc345('0x9')](),controller[_0xc345('0x13')]);router[_0xc345('0x14')](_0xc345('0x15'),auth['isAuthenticated'](),controller[_0xc345('0x16')]);router[_0xc345('0x17')](_0xc345('0x15'),auth[_0xc345('0x9')](),controller[_0xc345('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 379aeca..1ce9cd5 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 _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x55a787,_0x1466a3){var _0x5d90a0=function(_0x5405fb){while(--_0x5405fb){_0x55a787['push'](_0x55a787['shift']());}};_0x5d90a0(++_0x1466a3);}(_0x5fab,0x177));var _0xb5fa=function(_0xd98def,_0x19ebc7){_0xd98def=_0xd98def-0x0;var _0x55b182=_0x5fab[_0xd98def];return _0x55b182;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x2')]},'parent':{'type':Sequelize[_0xb5fa('0x2')]},'table':{'type':Sequelize[_0xb5fa('0x2')]},'conditions':{'type':Sequelize[_0xb5fa('0x3')]},'joins':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file +var _0xafc4=['sequelize','STRING','TEXT'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0xafc4,0x69));var _0x4afc=function(_0x10a37b,_0x4532ed){_0x10a37b=_0x10a37b-0x0;var _0x298472=_0xafc4[_0x10a37b];return _0x298472;};'use strict';var Sequelize=require(_0x4afc('0x0'));module['exports']={'name':{'type':Sequelize[_0x4afc('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4afc('0x1')]},'table':{'type':Sequelize[_0x4afc('0x1')]},'conditions':{'type':Sequelize[_0x4afc('0x2')]},'joins':{'type':Sequelize[_0x4afc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index d031a33..a73a7d1 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 _0x5fc3=['QueryTypes','right_join','HOUR(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','destroy','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','getFields','ValidationErrorItem','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)'];(function(_0x5b226b,_0x39b2e9){var _0x75cfba=function(_0x4a1686){while(--_0x4a1686){_0x5b226b['push'](_0x5b226b['shift']());}};_0x75cfba(++_0x39b2e9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x5fc3[_0x3ceb54];return _0x26d8a6;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x35fc('0x17')];function respondWithStatusCode(_0x5d462a,_0x397738){_0x397738=_0x397738||0xcc;return function(_0x22055e){if(_0x22055e){return _0x5d462a[_0x35fc('0x18')](_0x397738);}return _0x5d462a[_0x35fc('0x19')](_0x397738)[_0x35fc('0x1a')]();};}function respondWithResult(_0x5cfe94,_0x59507a){_0x59507a=_0x59507a||0xc8;return function(_0x5eac0f){if(_0x5eac0f){return _0x5cfe94['status'](_0x59507a)[_0x35fc('0x1b')](_0x5eac0f);}};}function respondWithFilteredResult(_0x229d56,_0x53b898){return function(_0x154958){if(_0x154958){var _0x227a49=typeof _0x53b898[_0x35fc('0x1c')]==='undefined'&&typeof _0x53b898[_0x35fc('0x1d')]===_0x35fc('0x1e');var _0x553677=_0x154958[_0x35fc('0x1f')];var _0x363e47=_0x227a49?0x0:_0x53b898[_0x35fc('0x1c')];var _0x5f56c6=_0x227a49?_0x154958[_0x35fc('0x1f')]:_0x53b898[_0x35fc('0x1c')]+_0x53b898[_0x35fc('0x1d')];var _0x488234;if(_0x5f56c6>=_0x553677){_0x5f56c6=_0x553677;_0x488234=0xc8;}else{_0x488234=0xce;}_0x229d56[_0x35fc('0x19')](_0x488234);return _0x229d56[_0x35fc('0x20')](_0x35fc('0x21'),_0x363e47+'-'+_0x5f56c6+'/'+_0x553677)[_0x35fc('0x1b')](_0x154958);}return null;};}function patchUpdates(_0x20ffde){return function(_0x21f1a9){try{jsonpatch[_0x35fc('0x22')](_0x21f1a9,_0x20ffde,!![]);}catch(_0x3b05b0){return BPromise[_0x35fc('0x23')](_0x3b05b0);}return _0x21f1a9[_0x35fc('0x24')]();};}function saveUpdates(_0x5bd2b8,_0x323aee){return function(_0xd5399f){if(_0xd5399f){return _0xd5399f[_0x35fc('0x25')](_0x5bd2b8)[_0x35fc('0x26')](function(_0x3b4743){return _0x3b4743;});}return null;};}function removeEntity(_0x55e9e7,_0x33f5e8){return function(_0x4c587a){if(_0x4c587a){return _0x4c587a['destroy']()[_0x35fc('0x26')](function(){var _0x5a93df=_0x4c587a[_0x35fc('0x27')]({'plain':!![]});var _0x51cfec=_0x35fc('0x28');return db['UserProfileResource'][_0x35fc('0x29')]({'where':{'type':_0x51cfec,'resourceId':_0x5a93df['id']}})[_0x35fc('0x26')](function(){return _0x4c587a;});})['then'](function(){_0x55e9e7['status'](0xcc)[_0x35fc('0x1a')]();});}};}function handleEntityNotFound(_0x58edb6,_0x274208){return function(_0x1a5d92){if(!_0x1a5d92){_0x58edb6['sendStatus'](0x194);}return _0x1a5d92;};}function handleError(_0x26b7cb,_0x645eac){_0x645eac=_0x645eac||0x1f4;return function(_0x383837){logger[_0x35fc('0x2a')](_0x383837[_0x35fc('0x2b')]);if(_0x383837[_0x35fc('0x2c')]){delete _0x383837[_0x35fc('0x2c')];}_0x26b7cb[_0x35fc('0x19')](_0x645eac)['send'](_0x383837);};}exports[_0x35fc('0x2d')]=function(_0x220931,_0x22af18){var _0x52acc5={},_0xe79f52={},_0x16f067={'count':0x0,'rows':[]};var _0x3822a8=_[_0x35fc('0x2e')](db[_0x35fc('0x2f')][_0x35fc('0x30')],function(_0x222ddb){return{'name':_0x222ddb[_0x35fc('0x31')],'type':_0x222ddb[_0x35fc('0x32')][_0x35fc('0x33')]};});_0xe79f52['model']=_['map'](_0x3822a8,_0x35fc('0x2c'));_0xe79f52['query']=_[_0x35fc('0x34')](_0x220931[_0x35fc('0x35')]);_0xe79f52[_0x35fc('0x36')]=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],_0xe79f52[_0x35fc('0x35')]);_0x52acc5['attributes']=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x220931[_0x35fc('0x35')][_0x35fc('0x39')]));_0x52acc5[_0x35fc('0x3a')]=_0x52acc5['attributes'][_0x35fc('0x3b')]?_0x52acc5[_0x35fc('0x3a')]:_0xe79f52[_0x35fc('0x38')];if(!_0x220931['query'][_0x35fc('0x3c')]('nolimit')){_0x52acc5[_0x35fc('0x1d')]=qs[_0x35fc('0x1d')](_0x220931[_0x35fc('0x35')][_0x35fc('0x1d')]);_0x52acc5['offset']=qs['offset'](_0x220931['query'][_0x35fc('0x1c')]);}_0x52acc5['order']=qs[_0x35fc('0x3d')](_0x220931['query'][_0x35fc('0x3d')]);_0x52acc5[_0x35fc('0x3e')]=qs[_0x35fc('0x36')](_[_0x35fc('0x3f')](_0x220931[_0x35fc('0x35')],_0xe79f52[_0x35fc('0x36')]),_0x3822a8);if(_0x220931[_0x35fc('0x35')]['filter']){_0x52acc5[_0x35fc('0x3e')]=_[_0x35fc('0x40')](_0x52acc5['where'],{'$or':_[_0x35fc('0x2e')](_0x3822a8,function(_0x1ccc41){if(_0x1ccc41[_0x35fc('0x32')]!==_0x35fc('0x41')){var _0x813866={};_0x813866[_0x1ccc41[_0x35fc('0x2c')]]={'$like':'%'+_0x220931['query'][_0x35fc('0x42')]+'%'};return _0x813866;}})});}_0x52acc5=_[_0x35fc('0x40')]({},_0x52acc5,_0x220931[_0x35fc('0x43')]);var _0x52543b={'where':_0x52acc5[_0x35fc('0x3e')]};return db[_0x35fc('0x2f')]['count'](_0x52543b)[_0x35fc('0x26')](function(_0x280af1){_0x16f067[_0x35fc('0x1f')]=_0x280af1;if(_0x220931[_0x35fc('0x35')][_0x35fc('0x44')]){_0x52acc5[_0x35fc('0x45')]=[{'all':!![]}];}return db[_0x35fc('0x2f')][_0x35fc('0x46')](_0x52acc5);})['then'](function(_0x596e83){_0x16f067[_0x35fc('0x47')]=_0x596e83;return _0x16f067;})[_0x35fc('0x26')](respondWithFilteredResult(_0x22af18,_0x52acc5))['catch'](handleError(_0x22af18,null));};exports['show']=function(_0x4ff202,_0x79677d){var _0x10f98b={'raw':!![],'where':{'id':_0x4ff202[_0x35fc('0x48')]['id']}},_0x4e56ed={};_0x4e56ed[_0x35fc('0x38')]=_[_0x35fc('0x34')](db[_0x35fc('0x2f')]['rawAttributes']);_0x4e56ed['query']=_['keys'](_0x4ff202['query']);_0x4e56ed['filters']=_[_0x35fc('0x37')](_0x4e56ed[_0x35fc('0x38')],_0x4e56ed['query']);_0x10f98b[_0x35fc('0x3a')]=_['intersection'](_0x4e56ed[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x4ff202[_0x35fc('0x35')][_0x35fc('0x39')]));_0x10f98b[_0x35fc('0x3a')]=_0x10f98b['attributes'][_0x35fc('0x3b')]?_0x10f98b[_0x35fc('0x3a')]:_0x4e56ed['model'];if(_0x4ff202[_0x35fc('0x35')][_0x35fc('0x44')]){_0x10f98b[_0x35fc('0x45')]=[{'all':!![]}];}_0x10f98b=_[_0x35fc('0x40')]({},_0x10f98b,_0x4ff202['options']);return db[_0x35fc('0x2f')]['find'](_0x10f98b)['then'](handleEntityNotFound(_0x79677d,null))[_0x35fc('0x26')](respondWithResult(_0x79677d,null))[_0x35fc('0x49')](handleError(_0x79677d,null));};exports[_0x35fc('0x4a')]=function(_0xca8aef,_0xf2ca20){return db[_0x35fc('0x2f')][_0x35fc('0x4a')](_0xca8aef[_0x35fc('0x4b')],{})['then'](function(_0x3e2961){var _0x91d7c0=_0xca8aef[_0x35fc('0x4c')][_0x35fc('0x27')]({'plain':!![]});if(!_0x91d7c0)throw new Error(_0x35fc('0x4d'));if(_0x91d7c0[_0x35fc('0x4e')]===_0x35fc('0x4c')){var _0x347a4a=_0x3e2961[_0x35fc('0x27')]({'plain':!![]});var _0xe6eb6a=_0x35fc('0x4f');return db[_0x35fc('0x50')][_0x35fc('0x51')]({'where':{'name':_0xe6eb6a,'userProfileId':_0x91d7c0[_0x35fc('0x52')]},'raw':!![]})['then'](function(_0x553ed6){if(_0x553ed6&&_0x553ed6[_0x35fc('0x53')]===0x0){return db[_0x35fc('0x54')][_0x35fc('0x4a')]({'name':_0x347a4a[_0x35fc('0x2c')],'resourceId':_0x347a4a['id'],'type':_0x35fc('0x28'),'sectionId':_0x553ed6['id']},{})[_0x35fc('0x26')](function(){return _0x3e2961;});}else{return _0x3e2961;}})['catch'](function(_0x4f024c){logger[_0x35fc('0x2a')](_0x35fc('0x55'),_0x4f024c);throw _0x4f024c;});}return _0x3e2961;})[_0x35fc('0x26')](respondWithResult(_0xf2ca20,0xc9))[_0x35fc('0x49')](handleError(_0xf2ca20,null));};exports['update']=function(_0x467980,_0x13281f){if(_0x467980['body']['id']){delete _0x467980[_0x35fc('0x4b')]['id'];}return db[_0x35fc('0x2f')]['find']({'where':{'id':_0x467980[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x13281f,null))[_0x35fc('0x26')](saveUpdates(_0x467980[_0x35fc('0x4b')],null))['then'](respondWithResult(_0x13281f,null))['catch'](handleError(_0x13281f,null));};exports['destroy']=function(_0x240338,_0x2ea8d6){return db['AnalyticDefaultReport'][_0x35fc('0x51')]({'where':{'id':_0x240338[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x2ea8d6,null))[_0x35fc('0x26')](removeEntity(_0x2ea8d6,null))[_0x35fc('0x49')](handleError(_0x2ea8d6,null));};exports['preview']=function(_0x2d9d45,_0x757aa6){var _0x39d470=0xa;var _0x509e77=[_0x35fc('0x56'),_0x35fc('0x57'),'right_join',_0x35fc('0x58')];var _0x164c7b={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x303927={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23b54f=function(_0xb1c68a){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xb1c68a);};var _0x5353ea=function(_0x4faef4){if(!_0x4faef4||!_0x4faef4['rules'][_0x35fc('0x3b')]){return'';}for(var _0x44250b='(',_0xd470e8=0x0;_0xd470e8<_0x4faef4[_0x35fc('0x65')]['length'];_0xd470e8+=0x1){_0xd470e8>0x0&&(_0x44250b+='\x20'+_0x4faef4[_0x35fc('0x66')]+'\x20');_0x44250b+=_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]?_0x5353ea(_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]):_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x68')]+'\x20'+_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x69')]+(_0x23b54f(_0x4faef4['rules'][_0xd470e8][_0x35fc('0x69')])?'\x20'+_0x4faef4['rules'][_0xd470e8][_0x35fc('0x6a')]:'');}return _0x44250b+')';};var _0x9029e3={'where':{'id':_0x2d9d45['params']['id']}},_0x2ac8e1,_0x2bc76c,_0x4bdde7,_0x465c14,_0x4af592;_0x9029e3=_['merge']({},_0x9029e3,_0x2d9d45[_0x35fc('0x43')]);return db['AnalyticDefaultReport'][_0x35fc('0x51')](_0x9029e3)['then'](function(_0x11717){if(_0x11717){_0x2ac8e1=_0x11717;return _0x11717['getFields']();}return null;})[_0x35fc('0x26')](function(_0x455b84){if(_0x455b84){if(!_0x455b84[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))]['ValidationErrorItem'](_0x35fc('0x6c'),0x193);}_0x2bc76c=_0x455b84;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3aa7fa){if(_0x3aa7fa){_0x4bdde7=_[_0x35fc('0x6e')](_0x3aa7fa,'id');var _0x37764b;var _0x3c1b56=squel[_0x35fc('0x6f')]();_0x3c1b56[_0x35fc('0x70')](_0x2ac8e1[_0x35fc('0x71')]);for(var _0x4464d5=0x0;_0x4464d5<_0x2bc76c['length'];_0x4464d5+=0x1){_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x72')]?_0x4bdde7[_0x2bc76c[_0x4464d5][_0x35fc('0x72')]][_0x35fc('0x73')]:_0x2bc76c[_0x4464d5]['field'];_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x164c7b[_0x2bc76c[_0x4464d5]['function']],'%s',_0x37764b):_0x37764b;_0x37764b=_0x2bc76c[_0x4464d5]['format']?_[_0x35fc('0x75')](_0x303927[_0x2bc76c[_0x4464d5]['format']],'%s',_0x37764b):_0x37764b;if(_0x2bc76c[_0x4464d5][_0x35fc('0x76')]){_0x3c1b56[_0x35fc('0x67')](_0x37764b);}_0x2bc76c[_0x4464d5][_0x35fc('0x77')]&&_0x3c1b56[_0x35fc('0x78')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x77')]===_0x35fc('0x79')?![]:!![]);_0x3c1b56[_0x35fc('0x68')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x7a')]||_0x37764b);}if(_0x2ac8e1[_0x35fc('0x7b')]){_0x2ac8e1[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x2ac8e1[_0x35fc('0x7b')]);for(var _0x29f2b9=0x0;_0x29f2b9<_0x2ac8e1[_0x35fc('0x7b')][_0x35fc('0x3b')];_0x29f2b9+=0x1){if(_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]&&_[_0x35fc('0x62')](_0x509e77,_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')])&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7d')]&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7e')]&&_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]){_0x3c1b56[_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]](_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],null,util[_0x35fc('0x80')](_0x35fc('0x81'),_0x2ac8e1[_0x35fc('0x71')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9]['parentKey'],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]));}}}if(_0x2ac8e1[_0x35fc('0x82')]){_0x2ac8e1[_0x35fc('0x82')]=JSON['parse'](_0x2ac8e1[_0x35fc('0x82')]);_0x3c1b56[_0x35fc('0x3e')](_0x5353ea(_0x2ac8e1[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x4af592=_0x3c1b56[_0x35fc('0x83')]();_0x3c1b56[_0x35fc('0x1d')](_0x39d470);_0x3c1b56[_0x35fc('0x1c')](0x0);logger[_0x35fc('0x84')](_0x35fc('0x85'),_0x3c1b56['toString']());return dbH[_0x35fc('0x86')]['query'](_0x3c1b56[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')]['QueryTypes'][_0x35fc('0x88')]});}})[_0x35fc('0x26')](respondWithResult(_0x757aa6,null))[_0x35fc('0x49')](handleError(_0x757aa6,null));};function runReport(_0x4274d6,_0x4026cc,_0x1a765f){var _0x42f87e=_0x4026cc[_0x35fc('0x2c')];var _0x25ee61=0xa;var _0x5806bf=['join','left_join','right_join',_0x35fc('0x58')];var _0x23cf84={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':'MAX(%s)','MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x15e936={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x319033=function(_0x9fe765){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x9fe765);};var _0x2faff7=function(_0xa2c5f8){if(!_0xa2c5f8||!_0xa2c5f8[_0x35fc('0x65')][_0x35fc('0x3b')]){return'';}for(var _0x221c5b='(',_0x1fcd36=0x0;_0x1fcd36<_0xa2c5f8['rules'][_0x35fc('0x3b')];_0x1fcd36+=0x1){_0x1fcd36>0x0&&(_0x221c5b+='\x20'+_0xa2c5f8['operator']+'\x20');_0x221c5b+=_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]?_0x2faff7(_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]):_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x68')]+'\x20'+_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x69')]+(_0x319033(_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x69')])?'\x20'+_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x6a')]:'');}return _0x221c5b+')';};var _0x5abdf9={'where':{'id':_0x4274d6['id']}},_0x5512f6,_0x487cb5,_0x23b261,_0x4c742c,_0x2fae26;_0x5abdf9=_[_0x35fc('0x40')]({},_0x5abdf9,_0x1a765f);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x5abdf9)['then'](function(_0x28e80d){if(_0x28e80d){_0x5512f6=_0x28e80d;return _0x28e80d[_0x35fc('0x8e')]();}return null;})[_0x35fc('0x26')](function(_0x47c507){if(_0x47c507){if(!_0x47c507[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))][(_0x35fc('0x8f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x487cb5=_0x47c507;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x2edb1b){if(_0x2edb1b){_0x23b261=_[_0x35fc('0x6e')](_0x2edb1b,'id');var _0x3858a9;var _0x4859be=squel[_0x35fc('0x6f')]();_0x4859be[_0x35fc('0x70')](_0x5512f6['table']);for(var _0x5849a0=0x0;_0x5849a0<_0x487cb5[_0x35fc('0x3b')];_0x5849a0+=0x1){_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x72')]?_0x23b261[_0x487cb5[_0x5849a0][_0x35fc('0x72')]]['metric']:_0x487cb5[_0x5849a0]['field'];_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x23cf84[_0x487cb5[_0x5849a0]['function']],'%s',_0x3858a9):_0x3858a9;_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x80')]?_[_0x35fc('0x75')](_0x15e936[_0x487cb5[_0x5849a0][_0x35fc('0x80')]],'%s',_0x3858a9):_0x3858a9;if(_0x487cb5[_0x5849a0]['groupBy']){_0x4859be[_0x35fc('0x67')](_0x3858a9);}_0x487cb5[_0x5849a0][_0x35fc('0x77')]&&_0x4859be[_0x35fc('0x78')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x77')]==='DESC'?![]:!![]);_0x4859be[_0x35fc('0x68')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x7a')]||_0x3858a9);}if(_0x5512f6[_0x35fc('0x7b')]){_0x5512f6['joins']=JSON[_0x35fc('0x7c')](_0x5512f6[_0x35fc('0x7b')]);for(var _0x425f72=0x0;_0x425f72<_0x5512f6['joins'][_0x35fc('0x3b')];_0x425f72+=0x1){if(_0x5512f6[_0x35fc('0x7b')][_0x425f72]['type']&&_[_0x35fc('0x62')](_0x5806bf,_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x32')])&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]){_0x4859be[_0x5512f6['joins'][_0x425f72][_0x35fc('0x32')]](_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],null,util[_0x35fc('0x80')]('%s.%s\x20=\x20%s.%s',_0x5512f6[_0x35fc('0x71')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]));}}}if(_0x5512f6[_0x35fc('0x82')]){_0x5512f6['conditions']=JSON['parse'](_0x5512f6[_0x35fc('0x82')]);_0x4859be[_0x35fc('0x3e')](_0x2faff7(_0x5512f6[_0x35fc('0x82')]['group']));}_0x2fae26=_0x4859be[_0x35fc('0x83')]();_0x4859be[_0x35fc('0x1d')](_0x25ee61);_0x4859be[_0x35fc('0x1c')](0x0);return;}})[_0x35fc('0x26')](function(){if(_0x4026cc['output']==='web'){return null;}var _0x379650=_['merge'](_0x4026cc,{'name':_0x4026cc[_0x35fc('0x90')]||_0x4026cc[_0x35fc('0x2c')]||_0x5512f6['name'],'basename':_0x42f87e,'savename':util['format'](_0x35fc('0x91'),_0x4026cc[_0x35fc('0x2c')]||_0x5512f6[_0x35fc('0x2c')],require('randomstring')[_0x35fc('0x92')](0x4),_0x4026cc[_0x35fc('0x93')]||_0x35fc('0x94')),'reportId':_0x5512f6['id'],'reportType':'default'});return db[_0x35fc('0x95')][_0x35fc('0x4a')](_0x379650,{'raw':!![]});})[_0x35fc('0x26')](function(_0x328e90){if(_0x5512f6['table']===_0x35fc('0x96')){_0x2fae26[_0x35fc('0x3e')](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x97'),_0x4026cc[_0x35fc('0x98')],_0x4026cc[_0x35fc('0x99')]);}else{_0x2fae26['where'](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x9a'),_0x4026cc['startDate'],_0x4026cc[_0x35fc('0x99')]);}if(_0x328e90){logger[_0x35fc('0x9b')]('Run\x20Query:',_0x2fae26[_0x35fc('0x87')]());require(_0x35fc('0x9c'))[_0x35fc('0x9d')](path[_0x35fc('0x56')](__dirname,_0x35fc('0x9e'),_0x328e90['output']),[_0x328e90['id'],_0x2fae26[_0x35fc('0x87')](),path[_0x35fc('0x56')](__dirname,_0x35fc('0x9f'),_0x328e90['savename']),_0x42f87e]);return _0x328e90;}else{var _0x1224cd=squel['select']();_0x1224cd['from']('('+_0x2fae26[_0x35fc('0x87')]()+')',_0x35fc('0xa0'));_0x1224cd[_0x35fc('0x68')](_0x35fc('0xa1'),_0x35fc('0x1f'));_0x2fae26['limit'](_0x4026cc[_0x35fc('0x1d')]||_0x25ee61);_0x2fae26[_0x35fc('0x1c')](_0x4026cc[_0x35fc('0x1c')]||0x0);return dbH['sequelize'][_0x35fc('0x35')](_0x1224cd[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]})['then'](function(_0x1a2d73){if(!_0x1a2d73[_0x35fc('0x3b')]){_0x4c742c=0x0;}else{_0x4c742c=_0x1a2d73[0x0]['count']||0x0;}return dbH['sequelize'][_0x35fc('0x35')](_0x2fae26[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]});})[_0x35fc('0x26')](function(_0x8c80ca){return{'rows':_0x8c80ca||[],'count':_0x4c742c};});}});}exports['run']=function(_0x5dc286,_0x146ce1){return runReport(_0x5dc286[_0x35fc('0x48')],_0x5dc286[_0x35fc('0x35')],_0x5dc286[_0x35fc('0x43')])[_0x35fc('0x26')](respondWithResult(_0x146ce1,null))['catch'](handleError(_0x146ce1,null));};exports['runReport']=runReport;exports[_0x35fc('0x35')]=function(_0x2451f2,_0x3fff79){var _0x1c6ce9=0xa;var _0x4b2079=['join',_0x35fc('0x57'),_0x35fc('0xa3'),_0x35fc('0x58')];var _0xd46d64={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':'MIN(%s)','AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x274337={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':_0x35fc('0xa4'),'ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x19ae76=function(_0x366a3b){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x366a3b);};var _0x345026=function(_0x553f7d){if(!_0x553f7d||!_0x553f7d[_0x35fc('0x65')]['length']){return'';}for(var _0x5aa072='(',_0x3c96ef=0x0;_0x3c96ef<_0x553f7d[_0x35fc('0x65')][_0x35fc('0x3b')];_0x3c96ef+=0x1){_0x3c96ef>0x0&&(_0x5aa072+='\x20'+_0x553f7d['operator']+'\x20');_0x5aa072+=_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]?_0x345026(_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]):_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x68')]+'\x20'+_0x553f7d['rules'][_0x3c96ef]['condition']+(_0x19ae76(_0x553f7d[_0x35fc('0x65')][_0x3c96ef]['condition'])?'\x20'+_0x553f7d['rules'][_0x3c96ef][_0x35fc('0x6a')]:'');}return _0x5aa072+')';};var _0x48b826={'where':{'id':_0x2451f2[_0x35fc('0x48')]['id']}},_0x556f9a,_0x5ae83f,_0x450769,_0x5d461c,_0x355154;_0x48b826=_[_0x35fc('0x40')]({},_0x48b826,_0x2451f2[_0x35fc('0x43')]);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x48b826)['then'](function(_0x522ff2){if(_0x522ff2){_0x556f9a=_0x522ff2;return _0x522ff2[_0x35fc('0x8e')]();}return null;})['then'](function(_0x233c94){if(_0x233c94){if(!_0x233c94[_0x35fc('0x3b')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ae83f=_0x233c94;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x135e18){if(_0x135e18){_0x450769=_[_0x35fc('0x6e')](_0x135e18,'id');var _0x28525f;var _0x9116b1=squel[_0x35fc('0x6f')]();_0x9116b1['from'](_0x556f9a['table']);for(var _0x5cefdb=0x0;_0x5cefdb<_0x5ae83f['length'];_0x5cefdb+=0x1){_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x72')]?_0x450769[_0x5ae83f[_0x5cefdb]['MetricId']][_0x35fc('0x73')]:_0x5ae83f[_0x5cefdb]['field'];_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0xd46d64[_0x5ae83f[_0x5cefdb]['function']],'%s',_0x28525f):_0x28525f;_0x28525f=_0x5ae83f[_0x5cefdb]['format']?_[_0x35fc('0x75')](_0x274337[_0x5ae83f[_0x5cefdb][_0x35fc('0x80')]],'%s',_0x28525f):_0x28525f;if(_0x5ae83f[_0x5cefdb][_0x35fc('0x76')]){_0x9116b1[_0x35fc('0x67')](_0x28525f);}_0x5ae83f[_0x5cefdb][_0x35fc('0x77')]&&_0x9116b1['order'](_0x28525f,_0x5ae83f[_0x5cefdb]['orderBy']===_0x35fc('0x79')?![]:!![]);_0x9116b1['field'](_0x28525f,_0x5ae83f[_0x5cefdb][_0x35fc('0x7a')]||_0x28525f);}if(_0x556f9a['joins']){_0x556f9a[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x556f9a[_0x35fc('0x7b')]);for(var _0x10e30e=0x0;_0x10e30e<_0x556f9a['joins'][_0x35fc('0x3b')];_0x10e30e+=0x1){if(_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')]&&_['includes'](_0x4b2079,_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')])&&_0x556f9a['joins'][_0x10e30e][_0x35fc('0x7d')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]){_0x9116b1[_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x32')]](_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],null,util['format'](_0x35fc('0x81'),_0x556f9a[_0x35fc('0x71')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7d')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]));}}}if(_0x556f9a['conditions']){_0x556f9a['conditions']=JSON['parse'](_0x556f9a['conditions']);_0x9116b1['where'](_0x345026(_0x556f9a[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x355154=_0x9116b1[_0x35fc('0x83')]();_0x9116b1[_0x35fc('0x1d')](_0x1c6ce9);_0x9116b1[_0x35fc('0x1c')](0x0);logger['debug'](_0x35fc('0x85'),_0x9116b1[_0x35fc('0x87')]());return dbH[_0x35fc('0x86')][_0x35fc('0x35')](_0x9116b1[_0x35fc('0x87')](),{'type':dbH['sequelize'][_0x35fc('0xa2')][_0x35fc('0x88')]});}})[_0x35fc('0x26')](function(){return{'sql':_0x355154['toString']()};})[_0x35fc('0x26')](respondWithResult(_0x3fff79,null))[_0x35fc('0x49')](handleError(_0x3fff79,null));}; \ No newline at end of file +var _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x311978,_0x2174e7){var _0x105ba4=function(_0x1e59e1){while(--_0x1e59e1){_0x311978['push'](_0x311978['shift']());}};_0x105ba4(++_0x2174e7);}(_0x1cb9,0x14e));var _0x91cb=function(_0x253c24,_0x3f5825){_0x253c24=_0x253c24-0x0;var _0x15f099=_0x1cb9[_0x253c24];return _0x15f099;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 2d0bfab..71d365f 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 _0xb1cb=['path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','bluebird'];(function(_0x35bdab,_0x28a695){var _0xbe96b0=function(_0x425977){while(--_0x425977){_0x35bdab['push'](_0x35bdab['shift']());}};_0xbe96b0(++_0x28a695);}(_0xb1cb,0xa7));var _0xbb1c=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xb1cb[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xbb1c('0x0'));var util=require(_0xbb1c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbb1c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb1c('0x3'));var rimraf=require(_0xbb1c('0x4'));var config=require('../../config/environment');var attributes=require(_0xbb1c('0x5'));module[_0xbb1c('0x6')]=function(_0x1f49c2,_0x4844a7){return _0x1f49c2[_0xbb1c('0x7')](_0xbb1c('0x8'),attributes,{'tableName':_0xbb1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x446b=['moment','bluebird','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x3cde06,_0x9a1dc4){var _0x399f62=function(_0x583010){while(--_0x583010){_0x3cde06['push'](_0x3cde06['shift']());}};_0x399f62(++_0x9a1dc4);}(_0x446b,0xc3));var _0xb446=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x446b[_0xd7b0a4];return _0x184e9e;};'use strict';var _=require(_0xb446('0x0'));var util=require(_0xb446('0x1'));var logger=require(_0xb446('0x2'))('api');var moment=require(_0xb446('0x3'));var BPromise=require(_0xb446('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb446('0x5'));var attributes=require(_0xb446('0x6'));module[_0xb446('0x7')]=function(_0x2d5416,_0x430b5e){return _0x2d5416[_0xb446('0x8')](_0xb446('0x9'),attributes,{'tableName':_0xb446('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 41f90d9..bb5873f 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 _0x7351=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3073e3,_0xf6dc21){var _0x5ab70b=function(_0x5820ed){while(--_0x5820ed){_0x3073e3['push'](_0x3073e3['shift']());}};_0x5ab70b(++_0xf6dc21);}(_0x7351,0x100));var _0x1735=function(_0xae6725,_0x325d12){_0xae6725=_0xae6725-0x0;var _0x2d5212=_0x7351[_0xae6725];return _0x2d5212;};'use strict';var _=require(_0x1735('0x0'));var util=require(_0x1735('0x1'));var moment=require(_0x1735('0x2'));var BPromise=require(_0x1735('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1735('0x4'));var db=require(_0x1735('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1735('0x6'))(_0x1735('0x7'));var config=require(_0x1735('0x8'));var jayson=require(_0x1735('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xcf49a1,_0x4ea5f1,_0x119e83){return new BPromise(function(_0x217f72,_0x5c21e9){return client[_0x1735('0xa')](_0xcf49a1,_0x119e83)['then'](function(_0x423736){logger[_0x1735('0xb')](_0x1735('0xc'),_0x4ea5f1,_0x1735('0xd'));logger['debug'](_0x1735('0xe'),_0x4ea5f1,_0x1735('0xd'),JSON[_0x1735('0xf')](_0x423736));if(_0x423736[_0x1735('0x10')]){if(_0x423736[_0x1735('0x10')]['code']===0x1f4){logger[_0x1735('0x10')](_0x1735('0xc'),_0x4ea5f1,_0x423736[_0x1735('0x10')][_0x1735('0x11')]);return _0x5c21e9(_0x423736[_0x1735('0x10')][_0x1735('0x11')]);}logger[_0x1735('0x10')](_0x1735('0xc'),_0x4ea5f1,_0x423736[_0x1735('0x10')][_0x1735('0x11')]);return _0x217f72(_0x423736[_0x1735('0x10')][_0x1735('0x11')]);}else{logger[_0x1735('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4ea5f1,_0x1735('0xd'));_0x217f72(_0x423736[_0x1735('0x12')][_0x1735('0x11')]);}})[_0x1735('0x13')](function(_0xe5a137){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4ea5f1,_0xe5a137);_0x5c21e9(_0xe5a137);});});} \ No newline at end of file +var _0x8e96=['error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','stringify'];(function(_0x3f4bc1,_0x15ace5){var _0x46fcf6=function(_0x3a19c1){while(--_0x3a19c1){_0x3f4bc1['push'](_0x3f4bc1['shift']());}};_0x46fcf6(++_0x15ace5);}(_0x8e96,0xc2));var _0x68e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e96[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x68e9('0x0'));var util=require(_0x68e9('0x1'));var moment=require(_0x68e9('0x2'));var BPromise=require('bluebird');var rs=require(_0x68e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68e9('0x4'))['db'];var utils=require(_0x68e9('0x5'));var logger=require('../../config/logger')(_0x68e9('0x6'));var config=require(_0x68e9('0x7'));var jayson=require(_0x68e9('0x8'));var client=jayson[_0x68e9('0x9')][_0x68e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e72b0,_0x271fef,_0x575b78){return new BPromise(function(_0x37a61e,_0x358c5e){return client[_0x68e9('0xb')](_0x3e72b0,_0x575b78)['then'](function(_0x2d6ef5){logger[_0x68e9('0xc')](_0x68e9('0xd'),_0x271fef,'request\x20sent');logger[_0x68e9('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x271fef,'request\x20sent',JSON[_0x68e9('0xf')](_0x2d6ef5));if(_0x2d6ef5[_0x68e9('0x10')]){if(_0x2d6ef5['error'][_0x68e9('0x11')]===0x1f4){logger['error'](_0x68e9('0xd'),_0x271fef,_0x2d6ef5[_0x68e9('0x10')][_0x68e9('0x12')]);return _0x358c5e(_0x2d6ef5[_0x68e9('0x10')]['message']);}logger[_0x68e9('0x10')](_0x68e9('0xd'),_0x271fef,_0x2d6ef5[_0x68e9('0x10')]['message']);return _0x37a61e(_0x2d6ef5[_0x68e9('0x10')]['message']);}else{logger[_0x68e9('0xc')](_0x68e9('0xd'),_0x271fef,'request\x20sent');_0x37a61e(_0x2d6ef5[_0x68e9('0x13')]['message']);}})[_0x68e9('0x14')](function(_0x32210a){logger[_0x68e9('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x271fef,_0x32210a);_0x358c5e(_0x32210a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 7bbef41..5c2c749 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 _0x07e5=['/:id/run','run','/:id/query','create','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview'];(function(_0x4ad46d,_0xcd05ed){var _0x5dc091=function(_0x3e6ebf){while(--_0x3e6ebf){_0x4ad46d['push'](_0x4ad46d['shift']());}};_0x5dc091(++_0xcd05ed);}(_0x07e5,0x133));var _0x507e=function(_0x51107b,_0x1db2ba){_0x51107b=_0x51107b-0x0;var _0x141a58=_0x07e5[_0x51107b];return _0x141a58;};'use strict';var multer=require(_0x507e('0x0'));var util=require(_0x507e('0x1'));var path=require(_0x507e('0x2'));var timeout=require(_0x507e('0x3'));var express=require('express');var router=express[_0x507e('0x4')]();var fs_extra=require(_0x507e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x507e('0x6'));router[_0x507e('0x7')]('/',auth[_0x507e('0x8')](),controller[_0x507e('0x9')]);router[_0x507e('0x7')](_0x507e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x507e('0x7')](_0x507e('0xb'),auth['isAuthenticated'](),controller[_0x507e('0xc')]);router[_0x507e('0x7')](_0x507e('0xd'),auth['isAuthenticated'](),controller[_0x507e('0xe')]);router['get'](_0x507e('0xf'),auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0x507e('0x8')](),controller[_0x507e('0x10')]);router[_0x507e('0x11')](_0x507e('0xa'),auth[_0x507e('0x8')](),controller['update']);router[_0x507e('0x12')](_0x507e('0xa'),auth[_0x507e('0x8')](),controller[_0x507e('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf2b1=['/:id/query','query','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','/:id','show','/:id/preview','get','/:id/run','run'];(function(_0x1e479a,_0x5b42f9){var _0x254006=function(_0x33e275){while(--_0x33e275){_0x1e479a['push'](_0x1e479a['shift']());}};_0x254006(++_0x5b42f9);}(_0xf2b1,0xf8));var _0x1f2b=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0xf2b1[_0x33154d];return _0x3b2f03;};'use strict';var multer=require(_0x1f2b('0x0'));var util=require('util');var path=require(_0x1f2b('0x1'));var timeout=require(_0x1f2b('0x2'));var express=require(_0x1f2b('0x3'));var router=express[_0x1f2b('0x4')]();var fs_extra=require(_0x1f2b('0x5'));var auth=require(_0x1f2b('0x6'));var interaction=require(_0x1f2b('0x7'));var config=require('../../config/environment');var controller=require(_0x1f2b('0x8'));router['get']('/',auth[_0x1f2b('0x9')](),controller['index']);router['get'](_0x1f2b('0xa'),auth['isAuthenticated'](),controller[_0x1f2b('0xb')]);router['get'](_0x1f2b('0xc'),auth['isAuthenticated'](),controller['preview']);router[_0x1f2b('0xd')](_0x1f2b('0xe'),auth[_0x1f2b('0x9')](),controller[_0x1f2b('0xf')]);router[_0x1f2b('0xd')](_0x1f2b('0x10'),auth['isAuthenticated'](),controller[_0x1f2b('0x11')]);router[_0x1f2b('0x12')]('/',auth[_0x1f2b('0x9')](),controller[_0x1f2b('0x13')]);router[_0x1f2b('0x14')](_0x1f2b('0xa'),auth[_0x1f2b('0x9')](),controller[_0x1f2b('0x15')]);router['delete'](_0x1f2b('0xa'),auth[_0x1f2b('0x9')](),controller[_0x1f2b('0x16')]);module[_0x1f2b('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 923f9f8..32b7f95 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 _0x83dd=['INTEGER','sequelize','STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled'];(function(_0x46d58d,_0x131a3e){var _0x2d3ccf=function(_0x49c550){while(--_0x49c550){_0x46d58d['push'](_0x46d58d['shift']());}};_0x2d3ccf(++_0x131a3e);}(_0x83dd,0xb5));var _0xd83d=function(_0x5c46a9,_0x2548c7){_0x5c46a9=_0x5c46a9-0x0;var _0x250852=_0x83dd[_0x5c46a9];return _0x250852;};'use strict';var Sequelize=require(_0xd83d('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0xd83d('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xd83d('0x2')](_0xd83d('0x3'),_0xd83d('0x4'),_0xd83d('0x5')),'allowNull':![],'defaultValue':_0xd83d('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xd83d('0x6')]},'status':{'type':Sequelize[_0xd83d('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0xd83d('0x7'),_0xd83d('0x8')),'allowNull':![],'defaultValue':_0xd83d('0x7')},'reportId':{'type':Sequelize[_0xd83d('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7a86=['STRING','csv','pdf','xlsx','DATE','UNSIGNED','sequelize','exports'];(function(_0x149d2d,_0x529f67){var _0x3499e0=function(_0x5d240c){while(--_0x5d240c){_0x149d2d['push'](_0x149d2d['shift']());}};_0x3499e0(++_0x529f67);}(_0x7a86,0x166));var _0x67a8=function(_0x369987,_0x39d53f){_0x369987=_0x369987-0x0;var _0x6ebe3=_0x7a86[_0x369987];return _0x6ebe3;};'use strict';var Sequelize=require(_0x67a8('0x0'));var moment=require('moment');module[_0x67a8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x67a8('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x67a8('0x3'),_0x67a8('0x4'),_0x67a8('0x5')),'allowNull':![],'defaultValue':_0x67a8('0x3')},'savename':{'type':Sequelize[_0x67a8('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x67a8('0x6')]},'status':{'type':Sequelize[_0x67a8('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM']('manual','scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x67a8('0x7')]},'reportType':{'type':Sequelize[_0x67a8('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e2f892b..53e0a2b 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 _0xe56e=['UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','toLowerCase','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','AnalyticExtractedReport','rawAttributes','fieldName','type','key','map','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','catch','params','merge','find','create','body','user','get','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation'];(function(_0x2cea8b,_0x530338){var _0x2a98cb=function(_0x5593e4){while(--_0x5593e4){_0x2cea8b['push'](_0x2cea8b['shift']());}};_0x2a98cb(++_0x530338);}(_0xe56e,0x13d));var _0xee56=function(_0x520dac,_0x82ab00){_0x520dac=_0x520dac-0x0;var _0x418fc9=_0xe56e[_0x520dac];return _0x418fc9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee56('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee56('0x1'));var rp=require('request-promise');var moment=require(_0xee56('0x2'));var BPromise=require(_0xee56('0x3'));var Mustache=require(_0xee56('0x4'));var util=require(_0xee56('0x5'));var path=require(_0xee56('0x6'));var sox=require(_0xee56('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee56('0x8'));var _=require(_0xee56('0x9'));var squel=require(_0xee56('0xa'));var crypto=require(_0xee56('0xb'));var jsforce=require(_0xee56('0xc'));var deskjs=require(_0xee56('0xd'));var toCsv=require(_0xee56('0xe'));var querystring=require(_0xee56('0xf'));var Papa=require(_0xee56('0x10'));var Redis=require(_0xee56('0x11'));var authService=require(_0xee56('0x12'));var qs=require(_0xee56('0x13'));var as=require(_0xee56('0x14'));var hardwareService=require(_0xee56('0x15'));var logger=require('../../config/logger')(_0xee56('0x16'));var utils=require(_0xee56('0x17'));var config=require(_0xee56('0x18'));var licenseUtil=require(_0xee56('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x359edd,_0x4983ee){_0x4983ee=_0x4983ee||0xcc;return function(_0xdc7a8f){if(_0xdc7a8f){return _0x359edd[_0xee56('0x1a')](_0x4983ee);}return _0x359edd['status'](_0x4983ee)['end']();};}function respondWithResult(_0x2fa0d9,_0x46816c){_0x46816c=_0x46816c||0xc8;return function(_0x5348a6){if(_0x5348a6){return _0x2fa0d9['status'](_0x46816c)[_0xee56('0x1b')](_0x5348a6);}};}function respondWithFilteredResult(_0x14fa34,_0xdac875){return function(_0xdc69){if(_0xdc69){var _0x10d9c6=typeof _0xdac875[_0xee56('0x1c')]===_0xee56('0x1d')&&typeof _0xdac875[_0xee56('0x1e')]===_0xee56('0x1d');var _0x462f7b=_0xdc69[_0xee56('0x1f')];var _0x500fed=_0x10d9c6?0x0:_0xdac875[_0xee56('0x1c')];var _0x20df68=_0x10d9c6?_0xdc69[_0xee56('0x1f')]:_0xdac875[_0xee56('0x1c')]+_0xdac875['limit'];var _0x58b965;if(_0x20df68>=_0x462f7b){_0x20df68=_0x462f7b;_0x58b965=0xc8;}else{_0x58b965=0xce;}_0x14fa34[_0xee56('0x20')](_0x58b965);return _0x14fa34[_0xee56('0x21')](_0xee56('0x22'),_0x500fed+'-'+_0x20df68+'/'+_0x462f7b)['json'](_0xdc69);}return null;};}function patchUpdates(_0x25376d){return function(_0x261240){try{jsonpatch[_0xee56('0x23')](_0x261240,_0x25376d,!![]);}catch(_0x234f5f){return BPromise[_0xee56('0x24')](_0x234f5f);}return _0x261240[_0xee56('0x25')]();};}function saveUpdates(_0x21ff3a,_0x3c179a){return function(_0x4d3fa8){if(_0x4d3fa8){return _0x4d3fa8[_0xee56('0x26')](_0x21ff3a)['then'](function(_0x31ab64){return _0x31ab64;});}return null;};}function removeEntity(_0x51ac99,_0x5cd65c){return function(_0x54f58a){if(_0x54f58a){return _0x54f58a[_0xee56('0x27')]()[_0xee56('0x28')](function(){var _0x2dfb8e=_0x54f58a['get']({'plain':!![]});var _0x24ef2c='ExtractedReports';return db['UserProfileResource'][_0xee56('0x27')]({'where':{'type':_0x24ef2c,'resourceId':_0x2dfb8e['id']}})['then'](function(){return _0x54f58a;});})[_0xee56('0x28')](function(){_0x51ac99[_0xee56('0x20')](0xcc)[_0xee56('0x29')]();});}};}function handleEntityNotFound(_0x3974b3,_0x4edfb8){return function(_0x14d3e7){if(!_0x14d3e7){_0x3974b3[_0xee56('0x1a')](0x194);}return _0x14d3e7;};}function handleError(_0x328429,_0x52ec58){_0x52ec58=_0x52ec58||0x1f4;return function(_0x32a7bd){logger[_0xee56('0x2a')](_0x32a7bd[_0xee56('0x2b')]);if(_0x32a7bd['name']){delete _0x32a7bd[_0xee56('0x2c')];}_0x328429[_0xee56('0x20')](_0x52ec58)[_0xee56('0x2d')](_0x32a7bd);};}exports['index']=function(_0x5eea95,_0x48ce66){var _0x37249d={},_0x29ca7e={},_0x223413={'count':0x0,'rows':[]};var _0x2f6831=_['map'](db[_0xee56('0x2e')][_0xee56('0x2f')],function(_0x2550f4){return{'name':_0x2550f4[_0xee56('0x30')],'type':_0x2550f4[_0xee56('0x31')][_0xee56('0x32')]};});_0x29ca7e['model']=_[_0xee56('0x33')](_0x2f6831,_0xee56('0x2c'));_0x29ca7e['query']=_[_0xee56('0x34')](_0x5eea95[_0xee56('0x35')]);_0x29ca7e[_0xee56('0x36')]=_['intersection'](_0x29ca7e[_0xee56('0x37')],_0x29ca7e[_0xee56('0x35')]);_0x37249d[_0xee56('0x38')]=_[_0xee56('0x39')](_0x29ca7e[_0xee56('0x37')],qs[_0xee56('0x3a')](_0x5eea95['query'][_0xee56('0x3a')]));_0x37249d[_0xee56('0x38')]=_0x37249d[_0xee56('0x38')][_0xee56('0x3b')]?_0x37249d[_0xee56('0x38')]:_0x29ca7e[_0xee56('0x37')];if(!_0x5eea95[_0xee56('0x35')][_0xee56('0x3c')](_0xee56('0x3d'))){_0x37249d[_0xee56('0x1e')]=qs[_0xee56('0x1e')](_0x5eea95[_0xee56('0x35')][_0xee56('0x1e')]);_0x37249d[_0xee56('0x1c')]=qs[_0xee56('0x1c')](_0x5eea95['query'][_0xee56('0x1c')]);}_0x37249d['order']=qs[_0xee56('0x3e')](_0x5eea95[_0xee56('0x35')][_0xee56('0x3e')]);_0x37249d[_0xee56('0x3f')]=qs[_0xee56('0x36')](_['pick'](_0x5eea95[_0xee56('0x35')],_0x29ca7e[_0xee56('0x36')]),_0x2f6831);if(_0x5eea95[_0xee56('0x35')][_0xee56('0x40')]){_0x37249d['where']=_['merge'](_0x37249d[_0xee56('0x3f')],{'$or':_[_0xee56('0x33')](_0x2f6831,function(_0x4f82d9){if(_0x4f82d9[_0xee56('0x31')]!==_0xee56('0x41')){var _0x4fdf65={};_0x4fdf65[_0x4f82d9['name']]={'$like':'%'+_0x5eea95[_0xee56('0x35')][_0xee56('0x40')]+'%'};return _0x4fdf65;}})});}_0x37249d=_['merge']({},_0x37249d,_0x5eea95[_0xee56('0x42')]);var _0x122608={'where':_0x37249d[_0xee56('0x3f')]};return db[_0xee56('0x2e')][_0xee56('0x1f')](_0x122608)[_0xee56('0x28')](function(_0x4e5f5a){_0x223413['count']=_0x4e5f5a;if(_0x5eea95[_0xee56('0x35')][_0xee56('0x43')]){_0x37249d[_0xee56('0x44')]=[{'all':!![]}];}return db[_0xee56('0x2e')][_0xee56('0x45')](_0x37249d);})[_0xee56('0x28')](function(_0x2b85cc){_0x223413['rows']=_0x2b85cc;return _0x223413;})['then'](respondWithFilteredResult(_0x48ce66,_0x37249d))[_0xee56('0x46')](handleError(_0x48ce66,null));};exports['show']=function(_0x1909de,_0x22f361){var _0xd79901={'raw':!![],'where':{'id':_0x1909de[_0xee56('0x47')]['id']}},_0x6bf165={};_0x6bf165['model']=_[_0xee56('0x34')](db[_0xee56('0x2e')][_0xee56('0x2f')]);_0x6bf165['query']=_['keys'](_0x1909de[_0xee56('0x35')]);_0x6bf165[_0xee56('0x36')]=_[_0xee56('0x39')](_0x6bf165[_0xee56('0x37')],_0x6bf165[_0xee56('0x35')]);_0xd79901[_0xee56('0x38')]=_['intersection'](_0x6bf165[_0xee56('0x37')],qs[_0xee56('0x3a')](_0x1909de[_0xee56('0x35')]['fields']));_0xd79901[_0xee56('0x38')]=_0xd79901['attributes']['length']?_0xd79901[_0xee56('0x38')]:_0x6bf165[_0xee56('0x37')];if(_0x1909de[_0xee56('0x35')][_0xee56('0x43')]){_0xd79901[_0xee56('0x44')]=[{'all':!![]}];}_0xd79901=_[_0xee56('0x48')]({},_0xd79901,_0x1909de['options']);return db['AnalyticExtractedReport'][_0xee56('0x49')](_0xd79901)['then'](handleEntityNotFound(_0x22f361,null))[_0xee56('0x28')](respondWithResult(_0x22f361,null))[_0xee56('0x46')](handleError(_0x22f361,null));};exports['create']=function(_0x4170bf,_0x4c2855){return db[_0xee56('0x2e')][_0xee56('0x4a')](_0x4170bf[_0xee56('0x4b')],{})[_0xee56('0x28')](function(_0x2a57cd){var _0x1642dd=_0x4170bf[_0xee56('0x4c')][_0xee56('0x4d')]({'plain':!![]});if(!_0x1642dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1642dd[_0xee56('0x4e')]===_0xee56('0x4c')){var _0x4612f9=_0x2a57cd[_0xee56('0x4d')]({'plain':!![]});var _0x123837=_0xee56('0x4f');return db[_0xee56('0x50')][_0xee56('0x49')]({'where':{'name':_0x123837,'userProfileId':_0x1642dd[_0xee56('0x51')]},'raw':!![]})['then'](function(_0x545215){if(_0x545215&&_0x545215[_0xee56('0x52')]===0x0){return db[_0xee56('0x53')][_0xee56('0x4a')]({'name':_0x4612f9['name'],'resourceId':_0x4612f9['id'],'type':_0x545215[_0xee56('0x2c')],'sectionId':_0x545215['id']},{})[_0xee56('0x28')](function(){return _0x2a57cd;});}else{return _0x2a57cd;}})[_0xee56('0x46')](function(_0x478d32){logger[_0xee56('0x2a')](_0xee56('0x54'),_0x478d32);throw _0x478d32;});}return _0x2a57cd;})[_0xee56('0x28')](respondWithResult(_0x4c2855,0xc9))['catch'](handleError(_0x4c2855,null));};exports[_0xee56('0x26')]=function(_0x247e1d,_0x186981){if(_0x247e1d['body']['id']){delete _0x247e1d[_0xee56('0x4b')]['id'];}return db[_0xee56('0x2e')]['find']({'where':{'id':_0x247e1d[_0xee56('0x47')]['id']}})[_0xee56('0x28')](handleEntityNotFound(_0x186981,null))[_0xee56('0x28')](saveUpdates(_0x247e1d['body'],null))['then'](respondWithResult(_0x186981,null))[_0xee56('0x46')](handleError(_0x186981,null));};exports[_0xee56('0x27')]=function(_0x17f801,_0x1724d7){return db[_0xee56('0x2e')][_0xee56('0x49')]({'where':{'id':_0x17f801[_0xee56('0x47')]['id']}})[_0xee56('0x28')](handleEntityNotFound(_0x1724d7,null))[_0xee56('0x28')](removeEntity(_0x1724d7,null))[_0xee56('0x46')](handleError(_0x1724d7,null));};exports['download']=function(_0x15ee75,_0x4ed42d,_0x3d10cc){return db[_0xee56('0x2e')][_0xee56('0x49')]({'where':{'id':_0x15ee75['params']['id']},'attributes':[_0xee56('0x2c'),_0xee56('0x55'),_0xee56('0x56'),_0xee56('0x57')],'raw':!![]})[_0xee56('0x28')](handleEntityNotFound(_0x4ed42d,null))[_0xee56('0x28')](function(_0x3216ea){if(_0x3216ea){if(!fs[_0xee56('0x58')](path[_0xee56('0x59')](config[_0xee56('0x5a')],_0xee56('0x5b'),_0x3216ea['savename']))){throw new db[(_0xee56('0x5c'))][(_0xee56('0x5d'))](_0xee56('0x5e'));}if(_0x15ee75[_0xee56('0x35')][_0xee56('0x5f')]){return _0x4ed42d['sendStatus'](0xc8);}return _0x4ed42d[_0xee56('0x60')](path[_0xee56('0x59')](config['root'],_0xee56('0x5b'),_0x3216ea[_0xee56('0x56')]),util[_0xee56('0x61')](_0xee56('0x62'),_0x3216ea[_0xee56('0x55')]||_0x3216ea[_0xee56('0x2c')],_0x3216ea[_0xee56('0x57')][_0xee56('0x63')]()));}})[_0xee56('0x46')](handleError(_0x4ed42d,null));}; \ No newline at end of file +var _0xda2c=['findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','output','existsSync','join','root','server/files/reports','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','download','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include'];(function(_0x33c6e3,_0x24ce45){var _0x1119e0=function(_0x139cff){while(--_0x139cff){_0x33c6e3['push'](_0x33c6e3['shift']());}};_0x1119e0(++_0x24ce45);}(_0xda2c,0x132));var _0xcda2=function(_0x550fc8,_0x1c4d76){_0x550fc8=_0x550fc8-0x0;var _0x525fed=_0xda2c[_0x550fc8];return _0x525fed;};'use strict';var emlformat=require(_0xcda2('0x0'));var rimraf=require(_0xcda2('0x1'));var zipdir=require(_0xcda2('0x2'));var jsonpatch=require(_0xcda2('0x3'));var rp=require(_0xcda2('0x4'));var moment=require(_0xcda2('0x5'));var BPromise=require(_0xcda2('0x6'));var Mustache=require('mustache');var util=require(_0xcda2('0x7'));var path=require(_0xcda2('0x8'));var sox=require('sox');var csv=require(_0xcda2('0x9'));var ejs=require(_0xcda2('0xa'));var fs=require('fs');var fs_extra=require(_0xcda2('0xb'));var _=require(_0xcda2('0xc'));var squel=require('squel');var crypto=require(_0xcda2('0xd'));var jsforce=require(_0xcda2('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcda2('0xf'));var Papa=require(_0xcda2('0x10'));var Redis=require(_0xcda2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcda2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcda2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xcda2('0x14'));var config=require(_0xcda2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcda2('0x16'))['db'];function respondWithStatusCode(_0x5d4dfd,_0x15fb9a){_0x15fb9a=_0x15fb9a||0xcc;return function(_0x18db13){if(_0x18db13){return _0x5d4dfd[_0xcda2('0x17')](_0x15fb9a);}return _0x5d4dfd[_0xcda2('0x18')](_0x15fb9a)[_0xcda2('0x19')]();};}function respondWithResult(_0x4d427d,_0x3d0b3f){_0x3d0b3f=_0x3d0b3f||0xc8;return function(_0x51da23){if(_0x51da23){return _0x4d427d['status'](_0x3d0b3f)[_0xcda2('0x1a')](_0x51da23);}};}function respondWithFilteredResult(_0x41e563,_0x6b0238){return function(_0xeb3752){if(_0xeb3752){var _0x5d0386=typeof _0x6b0238[_0xcda2('0x1b')]===_0xcda2('0x1c')&&typeof _0x6b0238['limit']===_0xcda2('0x1c');var _0x3404fe=_0xeb3752[_0xcda2('0x1d')];var _0x611077=_0x5d0386?0x0:_0x6b0238['offset'];var _0x19a5e6=_0x5d0386?_0xeb3752[_0xcda2('0x1d')]:_0x6b0238[_0xcda2('0x1b')]+_0x6b0238[_0xcda2('0x1e')];var _0x4293c6;if(_0x19a5e6>=_0x3404fe){_0x19a5e6=_0x3404fe;_0x4293c6=0xc8;}else{_0x4293c6=0xce;}_0x41e563[_0xcda2('0x18')](_0x4293c6);return _0x41e563[_0xcda2('0x1f')](_0xcda2('0x20'),_0x611077+'-'+_0x19a5e6+'/'+_0x3404fe)['json'](_0xeb3752);}return null;};}function patchUpdates(_0x5d9c8c){return function(_0xff892e){try{jsonpatch['apply'](_0xff892e,_0x5d9c8c,!![]);}catch(_0x21aa77){return BPromise[_0xcda2('0x21')](_0x21aa77);}return _0xff892e[_0xcda2('0x22')]();};}function saveUpdates(_0x12605e,_0x2bba0f){return function(_0x1fc8f6){if(_0x1fc8f6){return _0x1fc8f6[_0xcda2('0x23')](_0x12605e)[_0xcda2('0x24')](function(_0x32ee8c){return _0x32ee8c;});}return null;};}function removeEntity(_0x21cb8f,_0x5f1712){return function(_0x15c79c){if(_0x15c79c){return _0x15c79c[_0xcda2('0x25')]()[_0xcda2('0x24')](function(){var _0x3c87a3=_0x15c79c['get']({'plain':!![]});var _0x5cc9c5='ExtractedReports';return db[_0xcda2('0x26')][_0xcda2('0x25')]({'where':{'type':_0x5cc9c5,'resourceId':_0x3c87a3['id']}})['then'](function(){return _0x15c79c;});})[_0xcda2('0x24')](function(){_0x21cb8f[_0xcda2('0x18')](0xcc)[_0xcda2('0x19')]();});}};}function handleEntityNotFound(_0x21f10a,_0xcc6d0b){return function(_0x44b22f){if(!_0x44b22f){_0x21f10a['sendStatus'](0x194);}return _0x44b22f;};}function handleError(_0x25398e,_0x3cd27b){_0x3cd27b=_0x3cd27b||0x1f4;return function(_0x405e77){logger[_0xcda2('0x27')](_0x405e77[_0xcda2('0x28')]);if(_0x405e77[_0xcda2('0x29')]){delete _0x405e77[_0xcda2('0x29')];}_0x25398e[_0xcda2('0x18')](_0x3cd27b)['send'](_0x405e77);};}exports[_0xcda2('0x2a')]=function(_0x1c143c,_0x22a9b3){var _0x592b93={},_0xe4fc1={},_0x58a479={'count':0x0,'rows':[]};var _0x53cf57=_[_0xcda2('0x2b')](db[_0xcda2('0x2c')][_0xcda2('0x2d')],function(_0x2b0fd1){return{'name':_0x2b0fd1['fieldName'],'type':_0x2b0fd1['type'][_0xcda2('0x2e')]};});_0xe4fc1['model']=_['map'](_0x53cf57,'name');_0xe4fc1[_0xcda2('0x2f')]=_[_0xcda2('0x30')](_0x1c143c['query']);_0xe4fc1[_0xcda2('0x31')]=_[_0xcda2('0x32')](_0xe4fc1[_0xcda2('0x33')],_0xe4fc1[_0xcda2('0x2f')]);_0x592b93['attributes']=_['intersection'](_0xe4fc1[_0xcda2('0x33')],qs[_0xcda2('0x34')](_0x1c143c[_0xcda2('0x2f')]['fields']));_0x592b93[_0xcda2('0x35')]=_0x592b93[_0xcda2('0x35')][_0xcda2('0x36')]?_0x592b93['attributes']:_0xe4fc1[_0xcda2('0x33')];if(!_0x1c143c['query'][_0xcda2('0x37')]('nolimit')){_0x592b93[_0xcda2('0x1e')]=qs[_0xcda2('0x1e')](_0x1c143c[_0xcda2('0x2f')]['limit']);_0x592b93[_0xcda2('0x1b')]=qs[_0xcda2('0x1b')](_0x1c143c['query'][_0xcda2('0x1b')]);}_0x592b93[_0xcda2('0x38')]=qs[_0xcda2('0x39')](_0x1c143c['query'][_0xcda2('0x39')]);_0x592b93[_0xcda2('0x3a')]=qs['filters'](_[_0xcda2('0x3b')](_0x1c143c[_0xcda2('0x2f')],_0xe4fc1[_0xcda2('0x31')]),_0x53cf57);if(_0x1c143c[_0xcda2('0x2f')]['filter']){_0x592b93[_0xcda2('0x3a')]=_['merge'](_0x592b93[_0xcda2('0x3a')],{'$or':_[_0xcda2('0x2b')](_0x53cf57,function(_0x10d97d){if(_0x10d97d['type']!==_0xcda2('0x3c')){var _0x55d911={};_0x55d911[_0x10d97d['name']]={'$like':'%'+_0x1c143c[_0xcda2('0x2f')][_0xcda2('0x3d')]+'%'};return _0x55d911;}})});}_0x592b93=_[_0xcda2('0x3e')]({},_0x592b93,_0x1c143c[_0xcda2('0x3f')]);var _0x22c8a8={'where':_0x592b93[_0xcda2('0x3a')]};return db[_0xcda2('0x2c')][_0xcda2('0x1d')](_0x22c8a8)[_0xcda2('0x24')](function(_0x2fcf1c){_0x58a479[_0xcda2('0x1d')]=_0x2fcf1c;if(_0x1c143c[_0xcda2('0x2f')][_0xcda2('0x40')]){_0x592b93[_0xcda2('0x41')]=[{'all':!![]}];}return db[_0xcda2('0x2c')][_0xcda2('0x42')](_0x592b93);})[_0xcda2('0x24')](function(_0x13523c){_0x58a479[_0xcda2('0x43')]=_0x13523c;return _0x58a479;})[_0xcda2('0x24')](respondWithFilteredResult(_0x22a9b3,_0x592b93))[_0xcda2('0x44')](handleError(_0x22a9b3,null));};exports['show']=function(_0x515daf,_0x38223e){var _0x2a8ee2={'raw':!![],'where':{'id':_0x515daf[_0xcda2('0x45')]['id']}},_0x40f697={};_0x40f697['model']=_[_0xcda2('0x30')](db[_0xcda2('0x2c')]['rawAttributes']);_0x40f697[_0xcda2('0x2f')]=_[_0xcda2('0x30')](_0x515daf['query']);_0x40f697[_0xcda2('0x31')]=_[_0xcda2('0x32')](_0x40f697['model'],_0x40f697[_0xcda2('0x2f')]);_0x2a8ee2[_0xcda2('0x35')]=_[_0xcda2('0x32')](_0x40f697[_0xcda2('0x33')],qs[_0xcda2('0x34')](_0x515daf[_0xcda2('0x2f')][_0xcda2('0x34')]));_0x2a8ee2[_0xcda2('0x35')]=_0x2a8ee2[_0xcda2('0x35')][_0xcda2('0x36')]?_0x2a8ee2['attributes']:_0x40f697[_0xcda2('0x33')];if(_0x515daf[_0xcda2('0x2f')][_0xcda2('0x40')]){_0x2a8ee2['include']=[{'all':!![]}];}_0x2a8ee2=_['merge']({},_0x2a8ee2,_0x515daf[_0xcda2('0x3f')]);return db[_0xcda2('0x2c')][_0xcda2('0x46')](_0x2a8ee2)['then'](handleEntityNotFound(_0x38223e,null))[_0xcda2('0x24')](respondWithResult(_0x38223e,null))['catch'](handleError(_0x38223e,null));};exports['create']=function(_0x962590,_0x3b62ca){return db[_0xcda2('0x2c')][_0xcda2('0x47')](_0x962590[_0xcda2('0x48')],{})[_0xcda2('0x24')](function(_0x48e27d){var _0x55c156=_0x962590[_0xcda2('0x49')][_0xcda2('0x4a')]({'plain':!![]});if(!_0x55c156)throw new Error(_0xcda2('0x4b'));if(_0x55c156[_0xcda2('0x4c')]===_0xcda2('0x49')){var _0x1cde39=_0x48e27d['get']({'plain':!![]});var _0x2311ca='ExtractedReports';return db[_0xcda2('0x4d')][_0xcda2('0x46')]({'where':{'name':_0x2311ca,'userProfileId':_0x55c156['userProfileId']},'raw':!![]})[_0xcda2('0x24')](function(_0xd1f230){if(_0xd1f230&&_0xd1f230[_0xcda2('0x4e')]===0x0){return db[_0xcda2('0x26')][_0xcda2('0x47')]({'name':_0x1cde39[_0xcda2('0x29')],'resourceId':_0x1cde39['id'],'type':_0xd1f230[_0xcda2('0x29')],'sectionId':_0xd1f230['id']},{})[_0xcda2('0x24')](function(){return _0x48e27d;});}else{return _0x48e27d;}})['catch'](function(_0x2f6f9f){logger[_0xcda2('0x27')](_0xcda2('0x4f'),_0x2f6f9f);throw _0x2f6f9f;});}return _0x48e27d;})['then'](respondWithResult(_0x3b62ca,0xc9))[_0xcda2('0x44')](handleError(_0x3b62ca,null));};exports[_0xcda2('0x23')]=function(_0x3b927e,_0x52565f){if(_0x3b927e[_0xcda2('0x48')]['id']){delete _0x3b927e[_0xcda2('0x48')]['id'];}return db[_0xcda2('0x2c')][_0xcda2('0x46')]({'where':{'id':_0x3b927e[_0xcda2('0x45')]['id']}})[_0xcda2('0x24')](handleEntityNotFound(_0x52565f,null))[_0xcda2('0x24')](saveUpdates(_0x3b927e['body'],null))[_0xcda2('0x24')](respondWithResult(_0x52565f,null))[_0xcda2('0x44')](handleError(_0x52565f,null));};exports[_0xcda2('0x25')]=function(_0x2466d2,_0xedc66e){return db[_0xcda2('0x2c')][_0xcda2('0x46')]({'where':{'id':_0x2466d2[_0xcda2('0x45')]['id']}})[_0xcda2('0x24')](handleEntityNotFound(_0xedc66e,null))['then'](removeEntity(_0xedc66e,null))[_0xcda2('0x44')](handleError(_0xedc66e,null));};exports['download']=function(_0x137d96,_0x31fa8a,_0x134ba5){return db[_0xcda2('0x2c')][_0xcda2('0x46')]({'where':{'id':_0x137d96[_0xcda2('0x45')]['id']},'attributes':[_0xcda2('0x29'),_0xcda2('0x50'),'savename',_0xcda2('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x31fa8a,null))[_0xcda2('0x24')](function(_0x350195){if(_0x350195){if(!fs[_0xcda2('0x52')](path[_0xcda2('0x53')](config[_0xcda2('0x54')],_0xcda2('0x55'),_0x350195[_0xcda2('0x56')]))){throw new db['Sequelize'][(_0xcda2('0x57'))](_0xcda2('0x58'));}if(_0x137d96[_0xcda2('0x2f')]['exists']){return _0x31fa8a[_0xcda2('0x17')](0xc8);}return _0x31fa8a[_0xcda2('0x59')](path[_0xcda2('0x53')](config[_0xcda2('0x54')],_0xcda2('0x55'),_0x350195[_0xcda2('0x56')]),util[_0xcda2('0x5a')](_0xcda2('0x5b'),_0x350195[_0xcda2('0x50')]||_0x350195[_0xcda2('0x29')],_0x350195[_0xcda2('0x51')][_0xcda2('0x5c')]()));}})[_0xcda2('0x44')](handleError(_0x31fa8a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d8a4a06..47e1e50 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 _0x8952=['./analyticExtractedReport.attributes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5e7a56,_0x5e9d15){var _0x968c99=function(_0x4e69e){while(--_0x4e69e){_0x5e7a56['push'](_0x5e7a56['shift']());}};_0x968c99(++_0x5e9d15);}(_0x8952,0xe2));var _0x2895=function(_0x1d6647,_0x19121a){_0x1d6647=_0x1d6647-0x0;var _0x5d3cd9=_0x8952[_0x1d6647];return _0x5d3cd9;};'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('path');var rimraf=require(_0x2895('0x7'));var config=require('../../config/environment');var attributes=require(_0x2895('0x8'));module['exports']=function(_0x33fa97,_0x5cdef5){return _0x33fa97['define']('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16cb=['../../config/environment','exports','define','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x43e4b3,_0x1444de){var _0x10c655=function(_0x56c01d){while(--_0x56c01d){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x10c655(++_0x1444de);}(_0x16cb,0xa0));var _0xb16c=function(_0x28d203,_0x1d52e4){_0x28d203=_0x28d203-0x0;var _0x11e53e=_0x16cb[_0x28d203];return _0x11e53e;};'use strict';var _=require(_0xb16c('0x0'));var util=require(_0xb16c('0x1'));var logger=require(_0xb16c('0x2'))('api');var moment=require(_0xb16c('0x3'));var BPromise=require(_0xb16c('0x4'));var rp=require(_0xb16c('0x5'));var fs=require('fs');var path=require(_0xb16c('0x6'));var rimraf=require(_0xb16c('0x7'));var config=require(_0xb16c('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0xb16c('0x9')]=function(_0x1ebac8,_0x4a3255){return _0x1ebac8[_0xb16c('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0xb16c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index e82f460..4c766a0 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 _0xfe73=['../../config/utils','../../config/environment','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x392a7d,_0x1bfe73){var _0x1a9de0=function(_0x507152){while(--_0x507152){_0x392a7d['push'](_0x392a7d['shift']());}};_0x1a9de0(++_0x1bfe73);}(_0xfe73,0x185));var _0x3fe7=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xfe73[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x3fe7('0x0'));var util=require(_0x3fe7('0x1'));var moment=require(_0x3fe7('0x2'));var BPromise=require(_0x3fe7('0x3'));var rs=require(_0x3fe7('0x4'));var fs=require('fs');var Redis=require(_0x3fe7('0x5'));var db=require(_0x3fe7('0x6'))['db'];var utils=require(_0x3fe7('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3fe7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3fe7('0x9')][_0x3fe7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5643fb,_0x1a56f1,_0x5728c3){return new BPromise(function(_0x466c36,_0xccb96b){return client['request'](_0x5643fb,_0x5728c3)[_0x3fe7('0xb')](function(_0xf2182d){logger[_0x3fe7('0xc')](_0x3fe7('0xd'),_0x1a56f1,'request\x20sent');logger[_0x3fe7('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x1a56f1,_0x3fe7('0xf'),JSON[_0x3fe7('0x10')](_0xf2182d));if(_0xf2182d[_0x3fe7('0x11')]){if(_0xf2182d[_0x3fe7('0x11')][_0x3fe7('0x12')]===0x1f4){logger[_0x3fe7('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1a56f1,_0xf2182d['error'][_0x3fe7('0x13')]);return _0xccb96b(_0xf2182d[_0x3fe7('0x11')][_0x3fe7('0x13')]);}logger[_0x3fe7('0x11')](_0x3fe7('0xd'),_0x1a56f1,_0xf2182d[_0x3fe7('0x11')]['message']);return _0x466c36(_0xf2182d[_0x3fe7('0x11')][_0x3fe7('0x13')]);}else{logger[_0x3fe7('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1a56f1,_0x3fe7('0xf'));_0x466c36(_0xf2182d[_0x3fe7('0x14')][_0x3fe7('0x13')]);}})[_0x3fe7('0x15')](function(_0x295355){logger['error'](_0x3fe7('0xd'),_0x1a56f1,_0x295355);_0xccb96b(_0x295355);});});} \ No newline at end of file +var _0xf057=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x1401c5,_0x1c359e){var _0x5aaac1=function(_0x358816){while(--_0x358816){_0x1401c5['push'](_0x1401c5['shift']());}};_0x5aaac1(++_0x1c359e);}(_0xf057,0x16e));var _0x7f05=function(_0x4ea0d2,_0xc7628a){_0x4ea0d2=_0x4ea0d2-0x0;var _0x3c4198=_0xf057[_0x4ea0d2];return _0x3c4198;};'use strict';var _=require(_0x7f05('0x0'));var util=require(_0x7f05('0x1'));var moment=require(_0x7f05('0x2'));var BPromise=require(_0x7f05('0x3'));var rs=require(_0x7f05('0x4'));var fs=require('fs');var Redis=require(_0x7f05('0x5'));var db=require(_0x7f05('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f05('0x7'))(_0x7f05('0x8'));var config=require(_0x7f05('0x9'));var jayson=require(_0x7f05('0xa'));var client=jayson[_0x7f05('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a07dc,_0x474f3f,_0x243e93){return new BPromise(function(_0x420bec,_0xdc6224){return client['request'](_0x1a07dc,_0x243e93)[_0x7f05('0xc')](function(_0x4069ed){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x474f3f,_0x7f05('0xd'));logger[_0x7f05('0xe')](_0x7f05('0xf'),_0x474f3f,'request\x20sent',JSON[_0x7f05('0x10')](_0x4069ed));if(_0x4069ed[_0x7f05('0x11')]){if(_0x4069ed[_0x7f05('0x11')]['code']===0x1f4){logger[_0x7f05('0x11')](_0x7f05('0x12'),_0x474f3f,_0x4069ed[_0x7f05('0x11')][_0x7f05('0x13')]);return _0xdc6224(_0x4069ed['error'][_0x7f05('0x13')]);}logger['error'](_0x7f05('0x12'),_0x474f3f,_0x4069ed[_0x7f05('0x11')][_0x7f05('0x13')]);return _0x420bec(_0x4069ed[_0x7f05('0x11')][_0x7f05('0x13')]);}else{logger[_0x7f05('0x14')](_0x7f05('0x12'),_0x474f3f,_0x7f05('0xd'));_0x420bec(_0x4069ed[_0x7f05('0x15')][_0x7f05('0x13')]);}})[_0x7f05('0x16')](function(_0x34a5ec){logger[_0x7f05('0x11')](_0x7f05('0x12'),_0x474f3f,_0x34a5ec);_0xdc6224(_0x34a5ec);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 40eff92..92b0dda 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 _0xdd3c=['put','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','show','/:id/download','download','post','isAuthenticated'];(function(_0x278280,_0x16f8ad){var _0x49d587=function(_0x4751c8){while(--_0x4751c8){_0x278280['push'](_0x278280['shift']());}};_0x49d587(++_0x16f8ad);}(_0xdd3c,0x1bb));var _0xcdd3=function(_0x273e73,_0x3b07e3){_0x273e73=_0x273e73-0x0;var _0x1d3a2e=_0xdd3c[_0x273e73];return _0x1d3a2e;};'use strict';var multer=require(_0xcdd3('0x0'));var util=require('util');var path=require(_0xcdd3('0x1'));var timeout=require(_0xcdd3('0x2'));var express=require(_0xcdd3('0x3'));var router=express[_0xcdd3('0x4')]();var fs_extra=require(_0xcdd3('0x5'));var auth=require(_0xcdd3('0x6'));var interaction=require(_0xcdd3('0x7'));var config=require(_0xcdd3('0x8'));var controller=require(_0xcdd3('0x9'));router[_0xcdd3('0xa')]('/',auth['isAuthenticated'](),controller[_0xcdd3('0xb')]);router[_0xcdd3('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xcdd3('0xc')]);router[_0xcdd3('0xa')](_0xcdd3('0xd'),auth['isAuthenticated'](),controller[_0xcdd3('0xe')]);router[_0xcdd3('0xf')]('/',auth[_0xcdd3('0x10')](),controller['create']);router[_0xcdd3('0x11')](_0xcdd3('0x12'),auth[_0xcdd3('0x10')](),controller['update']);router['delete'](_0xcdd3('0x12'),auth[_0xcdd3('0x10')](),controller['destroy']);module[_0xcdd3('0x13')]=router; \ No newline at end of file +var _0x190a=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x414e86,_0x26a55b){var _0x22bb4a=function(_0x55a2b8){while(--_0x55a2b8){_0x414e86['push'](_0x414e86['shift']());}};_0x22bb4a(++_0x26a55b);}(_0x190a,0x1cc));var _0xa190=function(_0x22e34e,_0x598a1d){_0x22e34e=_0x22e34e-0x0;var _0x411e59=_0x190a[_0x22e34e];return _0x411e59;};'use strict';var multer=require(_0xa190('0x0'));var util=require(_0xa190('0x1'));var path=require(_0xa190('0x2'));var timeout=require(_0xa190('0x3'));var express=require('express');var router=express[_0xa190('0x4')]();var fs_extra=require(_0xa190('0x5'));var auth=require(_0xa190('0x6'));var interaction=require(_0xa190('0x7'));var config=require(_0xa190('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0xa190('0x9')]('/',auth[_0xa190('0xa')](),controller[_0xa190('0xb')]);router[_0xa190('0x9')](_0xa190('0xc'),auth[_0xa190('0xa')](),controller[_0xa190('0xd')]);router[_0xa190('0x9')](_0xa190('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xa190('0xf')]('/',auth[_0xa190('0xa')](),controller[_0xa190('0x10')]);router[_0xa190('0x11')](_0xa190('0xc'),auth[_0xa190('0xa')](),controller[_0xa190('0x12')]);router[_0xa190('0x13')](_0xa190('0xc'),auth[_0xa190('0xa')](),controller[_0xa190('0x14')]);module[_0xa190('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 0e75e6a..d8727bd 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 _0xefc7=['TEXT','STRING','BOOLEAN','exports'];(function(_0x27edbd,_0x9206ea){var _0x2f88a7=function(_0x15e465){while(--_0x15e465){_0x27edbd['push'](_0x27edbd['shift']());}};_0x2f88a7(++_0x9206ea);}(_0xefc7,0x1db));var _0x7efc=function(_0x3839be,_0x43296c){_0x3839be=_0x3839be-0x0;var _0x435631=_0xefc7[_0x3839be];return _0x435631;};'use strict';var Sequelize=require('sequelize');module[_0x7efc('0x0')]={'field':{'type':Sequelize[_0x7efc('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7efc('0x2')]},'groupBy':{'type':Sequelize[_0x7efc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x7efc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1a9a=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1a9a,0xea));var _0xa1a9=function(_0x4c5a25,_0x308f3d){_0x4c5a25=_0x4c5a25-0x0;var _0x473366=_0x1a9a[_0x4c5a25];return _0x473366;};'use strict';var Sequelize=require(_0xa1a9('0x0'));module['exports']={'field':{'type':Sequelize[_0xa1a9('0x1')]},'alias':{'type':Sequelize[_0xa1a9('0x2')]},'function':{'type':Sequelize[_0xa1a9('0x2')]},'format':{'type':Sequelize[_0xa1a9('0x2')]},'groupBy':{'type':Sequelize[_0xa1a9('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xa1a9('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index a735382..72a79ea 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 _0x7513=['keys','intersection','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','model','map','query','filters','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','then','includeAll','findAll','rows','catch','params'];(function(_0x4d6387,_0x59f34b){var _0x4f9761=function(_0x498b5e){while(--_0x498b5e){_0x4d6387['push'](_0x4d6387['shift']());}};_0x4f9761(++_0x59f34b);}(_0x7513,0x101));var _0x3751=function(_0x24182f,_0x5b066b){_0x24182f=_0x24182f-0x0;var _0x479194=_0x7513[_0x24182f];return _0x479194;};'use strict';var emlformat=require(_0x3751('0x0'));var rimraf=require(_0x3751('0x1'));var zipdir=require(_0x3751('0x2'));var jsonpatch=require(_0x3751('0x3'));var rp=require(_0x3751('0x4'));var moment=require(_0x3751('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3751('0x6'));var util=require('util');var path=require(_0x3751('0x7'));var sox=require('sox');var csv=require(_0x3751('0x8'));var ejs=require(_0x3751('0x9'));var fs=require('fs');var fs_extra=require(_0x3751('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3751('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3751('0xc'));var toCsv=require(_0x3751('0x8'));var querystring=require('querystring');var Papa=require(_0x3751('0xd'));var Redis=require('ioredis');var authService=require(_0x3751('0xe'));var qs=require(_0x3751('0xf'));var as=require(_0x3751('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3751('0x11'))('api');var utils=require(_0x3751('0x12'));var config=require(_0x3751('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3751('0x14'))['db'];function respondWithStatusCode(_0x3f930e,_0x18f8df){_0x18f8df=_0x18f8df||0xcc;return function(_0x6cb632){if(_0x6cb632){return _0x3f930e[_0x3751('0x15')](_0x18f8df);}return _0x3f930e['status'](_0x18f8df)[_0x3751('0x16')]();};}function respondWithResult(_0x2c08ad,_0x1e18d6){_0x1e18d6=_0x1e18d6||0xc8;return function(_0x30f326){if(_0x30f326){return _0x2c08ad[_0x3751('0x17')](_0x1e18d6)[_0x3751('0x18')](_0x30f326);}};}function respondWithFilteredResult(_0x16e0d7,_0x4ecac2){return function(_0x1a0b7d){if(_0x1a0b7d){var _0x294623=typeof _0x4ecac2[_0x3751('0x19')]===_0x3751('0x1a')&&typeof _0x4ecac2[_0x3751('0x1b')]==='undefined';var _0x450482=_0x1a0b7d[_0x3751('0x1c')];var _0x2e14b3=_0x294623?0x0:_0x4ecac2[_0x3751('0x19')];var _0x13d803=_0x294623?_0x1a0b7d[_0x3751('0x1c')]:_0x4ecac2[_0x3751('0x19')]+_0x4ecac2['limit'];var _0x2a1deb;if(_0x13d803>=_0x450482){_0x13d803=_0x450482;_0x2a1deb=0xc8;}else{_0x2a1deb=0xce;}_0x16e0d7[_0x3751('0x17')](_0x2a1deb);return _0x16e0d7[_0x3751('0x1d')](_0x3751('0x1e'),_0x2e14b3+'-'+_0x13d803+'/'+_0x450482)[_0x3751('0x18')](_0x1a0b7d);}return null;};}function patchUpdates(_0xefd3d4){return function(_0x5ccb6f){try{jsonpatch[_0x3751('0x1f')](_0x5ccb6f,_0xefd3d4,!![]);}catch(_0x76e71){return BPromise[_0x3751('0x20')](_0x76e71);}return _0x5ccb6f['save']();};}function saveUpdates(_0x175dc1,_0x463514){return function(_0x465dd0){if(_0x465dd0){return _0x465dd0[_0x3751('0x21')](_0x175dc1)['then'](function(_0x2b964c){return _0x2b964c;});}return null;};}function removeEntity(_0x4411d6,_0x2bec5f){return function(_0x2815a5){if(_0x2815a5){return _0x2815a5[_0x3751('0x22')]()['then'](function(){_0x4411d6['status'](0xcc)[_0x3751('0x16')]();});}};}function handleEntityNotFound(_0x7c54a1,_0x294b29){return function(_0x3225fe){if(!_0x3225fe){_0x7c54a1[_0x3751('0x15')](0x194);}return _0x3225fe;};}function handleError(_0x100451,_0x181b90){_0x181b90=_0x181b90||0x1f4;return function(_0x38d2a9){logger[_0x3751('0x23')](_0x38d2a9[_0x3751('0x24')]);if(_0x38d2a9[_0x3751('0x25')]){delete _0x38d2a9[_0x3751('0x25')];}_0x100451[_0x3751('0x17')](_0x181b90)[_0x3751('0x26')](_0x38d2a9);};}exports[_0x3751('0x27')]=function(_0x39fe17,_0x374238){var _0x37ff8b={},_0x2fe930={},_0x1c1c3d={'count':0x0,'rows':[]};var _0x265674=_['map'](db[_0x3751('0x28')][_0x3751('0x29')],function(_0x5c5909){return{'name':_0x5c5909[_0x3751('0x2a')],'type':_0x5c5909[_0x3751('0x2b')]['key']};});_0x2fe930[_0x3751('0x2c')]=_[_0x3751('0x2d')](_0x265674,_0x3751('0x25'));_0x2fe930[_0x3751('0x2e')]=_['keys'](_0x39fe17[_0x3751('0x2e')]);_0x2fe930[_0x3751('0x2f')]=_['intersection'](_0x2fe930[_0x3751('0x2c')],_0x2fe930[_0x3751('0x2e')]);_0x37ff8b['attributes']=_['intersection'](_0x2fe930[_0x3751('0x2c')],qs[_0x3751('0x30')](_0x39fe17[_0x3751('0x2e')][_0x3751('0x30')]));_0x37ff8b['attributes']=_0x37ff8b['attributes'][_0x3751('0x31')]?_0x37ff8b[_0x3751('0x32')]:_0x2fe930[_0x3751('0x2c')];if(!_0x39fe17[_0x3751('0x2e')][_0x3751('0x33')](_0x3751('0x34'))){_0x37ff8b[_0x3751('0x1b')]=qs[_0x3751('0x1b')](_0x39fe17[_0x3751('0x2e')][_0x3751('0x1b')]);_0x37ff8b[_0x3751('0x19')]=qs[_0x3751('0x19')](_0x39fe17['query'][_0x3751('0x19')]);}_0x37ff8b[_0x3751('0x35')]=qs[_0x3751('0x36')](_0x39fe17[_0x3751('0x2e')][_0x3751('0x36')]);_0x37ff8b['where']=qs[_0x3751('0x2f')](_[_0x3751('0x37')](_0x39fe17[_0x3751('0x2e')],_0x2fe930[_0x3751('0x2f')]),_0x265674);if(_0x39fe17[_0x3751('0x2e')]['filter']){_0x37ff8b[_0x3751('0x38')]=_[_0x3751('0x39')](_0x37ff8b[_0x3751('0x38')],{'$or':_[_0x3751('0x2d')](_0x265674,function(_0x3bb7d1){if(_0x3bb7d1[_0x3751('0x2b')]!==_0x3751('0x3a')){var _0x11e934={};_0x11e934[_0x3bb7d1['name']]={'$like':'%'+_0x39fe17[_0x3751('0x2e')][_0x3751('0x3b')]+'%'};return _0x11e934;}})});}_0x37ff8b=_['merge']({},_0x37ff8b,_0x39fe17[_0x3751('0x3c')]);var _0x4aaa15={'where':_0x37ff8b[_0x3751('0x38')]};return db['AnalyticFieldReport'][_0x3751('0x1c')](_0x4aaa15)[_0x3751('0x3d')](function(_0x5addc4){_0x1c1c3d[_0x3751('0x1c')]=_0x5addc4;if(_0x39fe17[_0x3751('0x2e')][_0x3751('0x3e')]){_0x37ff8b['include']=[{'all':!![]}];}return db[_0x3751('0x28')][_0x3751('0x3f')](_0x37ff8b);})[_0x3751('0x3d')](function(_0x392062){_0x1c1c3d[_0x3751('0x40')]=_0x392062;return _0x1c1c3d;})[_0x3751('0x3d')](respondWithFilteredResult(_0x374238,_0x37ff8b))[_0x3751('0x41')](handleError(_0x374238,null));};exports['show']=function(_0x3e2a26,_0x1544c7){var _0x13854b={'raw':![],'where':{'id':_0x3e2a26[_0x3751('0x42')]['id']}},_0x5247a8={};_0x5247a8[_0x3751('0x2c')]=_[_0x3751('0x43')](db[_0x3751('0x28')][_0x3751('0x29')]);_0x5247a8['query']=_[_0x3751('0x43')](_0x3e2a26['query']);_0x5247a8[_0x3751('0x2f')]=_[_0x3751('0x44')](_0x5247a8[_0x3751('0x2c')],_0x5247a8[_0x3751('0x2e')]);_0x13854b[_0x3751('0x32')]=_[_0x3751('0x44')](_0x5247a8['model'],qs[_0x3751('0x30')](_0x3e2a26[_0x3751('0x2e')][_0x3751('0x30')]));_0x13854b[_0x3751('0x32')]=_0x13854b[_0x3751('0x32')]['length']?_0x13854b[_0x3751('0x32')]:_0x5247a8[_0x3751('0x2c')];if(_0x3e2a26[_0x3751('0x2e')][_0x3751('0x3e')]){_0x13854b['include']=[{'all':!![]}];}_0x13854b=_[_0x3751('0x39')]({},_0x13854b,_0x3e2a26[_0x3751('0x3c')]);return db[_0x3751('0x28')][_0x3751('0x45')](_0x13854b)['then'](handleEntityNotFound(_0x1544c7,null))[_0x3751('0x3d')](respondWithResult(_0x1544c7,null))[_0x3751('0x41')](handleError(_0x1544c7,null));};exports[_0x3751('0x46')]=function(_0x4eb0bd,_0x56370a){return db['AnalyticFieldReport']['create'](_0x4eb0bd[_0x3751('0x47')],{})[_0x3751('0x3d')](respondWithResult(_0x56370a,0xc9))[_0x3751('0x41')](handleError(_0x56370a,null));};exports[_0x3751('0x48')]=function(_0x1ba4bb,_0x570ada){return db[_0x3751('0x28')][_0x3751('0x48')](_0x1ba4bb[_0x3751('0x47')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x570ada,0xc9))[_0x3751('0x41')](handleError(_0x570ada,null));};exports['update']=function(_0x457cf6,_0x599796){if(_0x457cf6[_0x3751('0x47')]['id']){delete _0x457cf6['body']['id'];}return db[_0x3751('0x28')][_0x3751('0x45')]({'where':{'id':_0x457cf6[_0x3751('0x42')]['id']}})[_0x3751('0x3d')](handleEntityNotFound(_0x599796,null))[_0x3751('0x3d')](saveUpdates(_0x457cf6['body'],null))['then'](respondWithResult(_0x599796,null))['catch'](handleError(_0x599796,null));};exports[_0x3751('0x22')]=function(_0x5b0be5,_0x31aa28){return db[_0x3751('0x28')][_0x3751('0x45')]({'where':{'id':_0x5b0be5[_0x3751('0x42')]['id']}})[_0x3751('0x3d')](handleEntityNotFound(_0x31aa28,null))[_0x3751('0x3d')](removeEntity(_0x31aa28,null))[_0x3751('0x41')](handleError(_0x31aa28,null));};exports[_0x3751('0x49')]=function(_0x5575c1,_0x378fba){return db[_0x3751('0x28')]['destroy']({'where':{'id':_0x5575c1[_0x3751('0x2e')][_0x3751('0x4a')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x378fba,0xcc))[_0x3751('0x41')](handleError(_0x378fba,null));};exports[_0x3751('0x4b')]=function(_0x37f714,_0x2ee2a7,_0x5b814d){return db[_0x3751('0x4c')][_0x3751('0x4d')]({'where':{'id':_0x37f714[_0x3751('0x42')]['id']}})[_0x3751('0x3d')](handleEntityNotFound(_0x2ee2a7,null))['then'](function(_0x22b829){if(_0x22b829){return db[_0x3751('0x4e')][_0x3751('0x4f')](function(_0x2da871){return db['AnalyticFieldReport'][_0x3751('0x22')]({'where':{'CustomReportId':_0x37f714[_0x3751('0x42')]['id']},'transaction':_0x2da871})[_0x3751('0x3d')](function(_0x534b25){var _0x1eefbb=_[_0x3751('0x2d')](_0x37f714[_0x3751('0x47')],function(_0x3995ec){delete _0x3995ec['id'];_0x3995ec[_0x3751('0x50')]=_0x37f714[_0x3751('0x42')]['id'];return _0x3995ec;});return db[_0x3751('0x28')][_0x3751('0x48')](_0x1eefbb,{'transaction':_0x2da871});});})[_0x3751('0x3d')](function(){return db[_0x3751('0x28')][_0x3751('0x3f')]({'where':{'CustomReportId':_0x37f714['params']['id']}});});}})[_0x3751('0x3d')](respondWithResult(_0x2ee2a7,null))['catch'](handleError(_0x2ee2a7,null));}; \ No newline at end of file +var _0xb19a=['transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','error','name','send','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','AnalyticFieldReport','rows','params','includeAll','create','body','catch','update','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb19a,0x1d7));var _0xab19=function(_0x3add29,_0x5b87a2){_0x3add29=_0x3add29-0x0;var _0x4aa163=_0xb19a[_0x3add29];return _0x4aa163;};'use strict';var emlformat=require(_0xab19('0x0'));var rimraf=require(_0xab19('0x1'));var zipdir=require(_0xab19('0x2'));var jsonpatch=require(_0xab19('0x3'));var rp=require(_0xab19('0x4'));var moment=require(_0xab19('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xab19('0x6'));var util=require(_0xab19('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xab19('0x8'));var ejs=require(_0xab19('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab19('0xa'));var squel=require('squel');var crypto=require(_0xab19('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xab19('0xc'));var toCsv=require(_0xab19('0x8'));var querystring=require(_0xab19('0xd'));var Papa=require(_0xab19('0xe'));var Redis=require(_0xab19('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab19('0x10'));var hardwareService=require(_0xab19('0x11'));var logger=require(_0xab19('0x12'))(_0xab19('0x13'));var utils=require(_0xab19('0x14'));var config=require(_0xab19('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xab19('0x16'))['db'];function respondWithStatusCode(_0x49bc36,_0x28ea6c){_0x28ea6c=_0x28ea6c||0xcc;return function(_0x3cc8d3){if(_0x3cc8d3){return _0x49bc36[_0xab19('0x17')](_0x28ea6c);}return _0x49bc36['status'](_0x28ea6c)[_0xab19('0x18')]();};}function respondWithResult(_0x4ebbff,_0x3dd2f4){_0x3dd2f4=_0x3dd2f4||0xc8;return function(_0x141453){if(_0x141453){return _0x4ebbff[_0xab19('0x19')](_0x3dd2f4)[_0xab19('0x1a')](_0x141453);}};}function respondWithFilteredResult(_0x3a36b6,_0x6ab818){return function(_0x40ee42){if(_0x40ee42){var _0x442e28=typeof _0x6ab818[_0xab19('0x1b')]===_0xab19('0x1c')&&typeof _0x6ab818[_0xab19('0x1d')]===_0xab19('0x1c');var _0x554123=_0x40ee42[_0xab19('0x1e')];var _0x49dac7=_0x442e28?0x0:_0x6ab818[_0xab19('0x1b')];var _0x590211=_0x442e28?_0x40ee42[_0xab19('0x1e')]:_0x6ab818[_0xab19('0x1b')]+_0x6ab818[_0xab19('0x1d')];var _0x59cc37;if(_0x590211>=_0x554123){_0x590211=_0x554123;_0x59cc37=0xc8;}else{_0x59cc37=0xce;}_0x3a36b6[_0xab19('0x19')](_0x59cc37);return _0x3a36b6[_0xab19('0x1f')](_0xab19('0x20'),_0x49dac7+'-'+_0x590211+'/'+_0x554123)[_0xab19('0x1a')](_0x40ee42);}return null;};}function patchUpdates(_0x1c6e10){return function(_0x581472){try{jsonpatch['apply'](_0x581472,_0x1c6e10,!![]);}catch(_0x3ff617){return BPromise[_0xab19('0x21')](_0x3ff617);}return _0x581472['save']();};}function saveUpdates(_0x57fe40,_0x5ac379){return function(_0x1f3316){if(_0x1f3316){return _0x1f3316['update'](_0x57fe40)['then'](function(_0x68770a){return _0x68770a;});}return null;};}function removeEntity(_0x40c0b2,_0x5ade63){return function(_0x1b5d1e){if(_0x1b5d1e){return _0x1b5d1e[_0xab19('0x22')]()[_0xab19('0x23')](function(){_0x40c0b2[_0xab19('0x19')](0xcc)[_0xab19('0x18')]();});}};}function handleEntityNotFound(_0x1e5dc,_0x74e2ac){return function(_0x3c4874){if(!_0x3c4874){_0x1e5dc[_0xab19('0x17')](0x194);}return _0x3c4874;};}function handleError(_0x5adc3d,_0x248c27){_0x248c27=_0x248c27||0x1f4;return function(_0x278576){logger[_0xab19('0x24')](_0x278576['stack']);if(_0x278576['name']){delete _0x278576[_0xab19('0x25')];}_0x5adc3d[_0xab19('0x19')](_0x248c27)[_0xab19('0x26')](_0x278576);};}exports['index']=function(_0x37ec4c,_0x3bc2f7){var _0x37c218={},_0x5cd8d0={},_0x1b5c86={'count':0x0,'rows':[]};var _0x44dd72=_['map'](db['AnalyticFieldReport'][_0xab19('0x27')],function(_0x597788){return{'name':_0x597788['fieldName'],'type':_0x597788[_0xab19('0x28')][_0xab19('0x29')]};});_0x5cd8d0[_0xab19('0x2a')]=_[_0xab19('0x2b')](_0x44dd72,_0xab19('0x25'));_0x5cd8d0['query']=_[_0xab19('0x2c')](_0x37ec4c['query']);_0x5cd8d0[_0xab19('0x2d')]=_[_0xab19('0x2e')](_0x5cd8d0[_0xab19('0x2a')],_0x5cd8d0[_0xab19('0x2f')]);_0x37c218[_0xab19('0x30')]=_['intersection'](_0x5cd8d0['model'],qs[_0xab19('0x31')](_0x37ec4c['query'][_0xab19('0x31')]));_0x37c218[_0xab19('0x30')]=_0x37c218[_0xab19('0x30')][_0xab19('0x32')]?_0x37c218[_0xab19('0x30')]:_0x5cd8d0[_0xab19('0x2a')];if(!_0x37ec4c['query'][_0xab19('0x33')]('nolimit')){_0x37c218['limit']=qs[_0xab19('0x1d')](_0x37ec4c['query'][_0xab19('0x1d')]);_0x37c218['offset']=qs[_0xab19('0x1b')](_0x37ec4c[_0xab19('0x2f')][_0xab19('0x1b')]);}_0x37c218[_0xab19('0x34')]=qs[_0xab19('0x35')](_0x37ec4c['query'][_0xab19('0x35')]);_0x37c218[_0xab19('0x36')]=qs[_0xab19('0x2d')](_[_0xab19('0x37')](_0x37ec4c['query'],_0x5cd8d0[_0xab19('0x2d')]),_0x44dd72);if(_0x37ec4c['query'][_0xab19('0x38')]){_0x37c218[_0xab19('0x36')]=_[_0xab19('0x39')](_0x37c218[_0xab19('0x36')],{'$or':_[_0xab19('0x2b')](_0x44dd72,function(_0x27e9c9){if(_0x27e9c9[_0xab19('0x28')]!=='VIRTUAL'){var _0x3d8a79={};_0x3d8a79[_0x27e9c9[_0xab19('0x25')]]={'$like':'%'+_0x37ec4c[_0xab19('0x2f')]['filter']+'%'};return _0x3d8a79;}})});}_0x37c218=_[_0xab19('0x39')]({},_0x37c218,_0x37ec4c[_0xab19('0x3a')]);var _0x2cf7e3={'where':_0x37c218[_0xab19('0x36')]};return db['AnalyticFieldReport']['count'](_0x2cf7e3)[_0xab19('0x23')](function(_0xff41f7){_0x1b5c86[_0xab19('0x1e')]=_0xff41f7;if(_0x37ec4c[_0xab19('0x2f')]['includeAll']){_0x37c218[_0xab19('0x3b')]=[{'all':!![]}];}return db[_0xab19('0x3c')]['findAll'](_0x37c218);})[_0xab19('0x23')](function(_0x389d70){_0x1b5c86[_0xab19('0x3d')]=_0x389d70;return _0x1b5c86;})[_0xab19('0x23')](respondWithFilteredResult(_0x3bc2f7,_0x37c218))['catch'](handleError(_0x3bc2f7,null));};exports['show']=function(_0x32009d,_0x359ee6){var _0x375baa={'raw':![],'where':{'id':_0x32009d[_0xab19('0x3e')]['id']}},_0x54e05b={};_0x54e05b[_0xab19('0x2a')]=_['keys'](db[_0xab19('0x3c')][_0xab19('0x27')]);_0x54e05b[_0xab19('0x2f')]=_[_0xab19('0x2c')](_0x32009d[_0xab19('0x2f')]);_0x54e05b[_0xab19('0x2d')]=_[_0xab19('0x2e')](_0x54e05b[_0xab19('0x2a')],_0x54e05b[_0xab19('0x2f')]);_0x375baa[_0xab19('0x30')]=_[_0xab19('0x2e')](_0x54e05b[_0xab19('0x2a')],qs[_0xab19('0x31')](_0x32009d['query'][_0xab19('0x31')]));_0x375baa[_0xab19('0x30')]=_0x375baa['attributes'][_0xab19('0x32')]?_0x375baa['attributes']:_0x54e05b[_0xab19('0x2a')];if(_0x32009d[_0xab19('0x2f')][_0xab19('0x3f')]){_0x375baa[_0xab19('0x3b')]=[{'all':!![]}];}_0x375baa=_[_0xab19('0x39')]({},_0x375baa,_0x32009d['options']);return db['AnalyticFieldReport']['find'](_0x375baa)[_0xab19('0x23')](handleEntityNotFound(_0x359ee6,null))[_0xab19('0x23')](respondWithResult(_0x359ee6,null))['catch'](handleError(_0x359ee6,null));};exports['create']=function(_0x4fa85d,_0x2630a2){return db[_0xab19('0x3c')][_0xab19('0x40')](_0x4fa85d[_0xab19('0x41')],{})[_0xab19('0x23')](respondWithResult(_0x2630a2,0xc9))[_0xab19('0x42')](handleError(_0x2630a2,null));};exports['bulkCreate']=function(_0x45278c,_0x3028b4){return db[_0xab19('0x3c')]['bulkCreate'](_0x45278c[_0xab19('0x41')],{'raw':![],'individualHooks':!![]})[_0xab19('0x23')](respondWithResult(_0x3028b4,0xc9))[_0xab19('0x42')](handleError(_0x3028b4,null));};exports[_0xab19('0x43')]=function(_0x4ad2be,_0x1333a7){if(_0x4ad2be[_0xab19('0x41')]['id']){delete _0x4ad2be[_0xab19('0x41')]['id'];}return db[_0xab19('0x3c')][_0xab19('0x44')]({'where':{'id':_0x4ad2be['params']['id']}})[_0xab19('0x23')](handleEntityNotFound(_0x1333a7,null))[_0xab19('0x23')](saveUpdates(_0x4ad2be[_0xab19('0x41')],null))[_0xab19('0x23')](respondWithResult(_0x1333a7,null))[_0xab19('0x42')](handleError(_0x1333a7,null));};exports[_0xab19('0x22')]=function(_0x4da3a3,_0xdcc69b){return db[_0xab19('0x3c')][_0xab19('0x44')]({'where':{'id':_0x4da3a3[_0xab19('0x3e')]['id']}})[_0xab19('0x23')](handleEntityNotFound(_0xdcc69b,null))[_0xab19('0x23')](removeEntity(_0xdcc69b,null))[_0xab19('0x42')](handleError(_0xdcc69b,null));};exports[_0xab19('0x45')]=function(_0x2d9753,_0x4c5b5e){return db[_0xab19('0x3c')][_0xab19('0x22')]({'where':{'id':_0x2d9753[_0xab19('0x2f')][_0xab19('0x46')]||[]},'raw':![],'individualHooks':!![]})[_0xab19('0x23')](respondWithResult(_0x4c5b5e,0xcc))[_0xab19('0x42')](handleError(_0x4c5b5e,null));};exports[_0xab19('0x47')]=function(_0x3d8b31,_0x19ac15,_0x38909d){return db[_0xab19('0x48')][_0xab19('0x49')]({'where':{'id':_0x3d8b31['params']['id']}})['then'](handleEntityNotFound(_0x19ac15,null))[_0xab19('0x23')](function(_0x2460e8){if(_0x2460e8){return db[_0xab19('0x4a')][_0xab19('0x4b')](function(_0x4bd6ce){return db['AnalyticFieldReport'][_0xab19('0x22')]({'where':{'CustomReportId':_0x3d8b31[_0xab19('0x3e')]['id']},'transaction':_0x4bd6ce})[_0xab19('0x23')](function(_0x168719){var _0x4dcfd9=_[_0xab19('0x2b')](_0x3d8b31[_0xab19('0x41')],function(_0x3ebfa2){delete _0x3ebfa2['id'];_0x3ebfa2['CustomReportId']=_0x3d8b31['params']['id'];return _0x3ebfa2;});return db['AnalyticFieldReport'][_0xab19('0x4c')](_0x4dcfd9,{'transaction':_0x4bd6ce});});})[_0xab19('0x23')](function(){return db[_0xab19('0x3c')][_0xab19('0x4d')]({'where':{'CustomReportId':_0x3d8b31[_0xab19('0x3e')]['id']}});});}})[_0xab19('0x23')](respondWithResult(_0x19ac15,null))[_0xab19('0x42')](handleError(_0x19ac15,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index f877be9..aa33797 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 _0x3df0=['bluebird','request-promise','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','../../config/logger','moment'];(function(_0x44030a,_0x581291){var _0x3139a3=function(_0x55b8bd){while(--_0x55b8bd){_0x44030a['push'](_0x44030a['shift']());}};_0x3139a3(++_0x581291);}(_0x3df0,0x16f));var _0x03df=function(_0x5d89fe,_0x38bd7f){_0x5d89fe=_0x5d89fe-0x0;var _0xcdff77=_0x3df0[_0x5d89fe];return _0xcdff77;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x03df('0x0'))('api');var moment=require(_0x03df('0x1'));var BPromise=require(_0x03df('0x2'));var rp=require(_0x03df('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x03df('0x4'));var attributes=require(_0x03df('0x5'));module[_0x03df('0x6')]=function(_0x44de9c,_0xd1c8e0){return _0x44de9c[_0x03df('0x7')](_0x03df('0x8'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2b4=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x3307e9,_0x553460){var _0x2cf2a9=function(_0x458d8e){while(--_0x458d8e){_0x3307e9['push'](_0x3307e9['shift']());}};_0x2cf2a9(++_0x553460);}(_0xc2b4,0xae));var _0x4c2b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc2b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c2b('0x0'));var util=require('util');var logger=require(_0x4c2b('0x1'))(_0x4c2b('0x2'));var moment=require(_0x4c2b('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c2b('0x4'));var fs=require('fs');var path=require(_0x4c2b('0x5'));var rimraf=require(_0x4c2b('0x6'));var config=require(_0x4c2b('0x7'));var attributes=require(_0x4c2b('0x8'));module[_0x4c2b('0x9')]=function(_0x4d26ba,_0x2b6281){return _0x4d26ba['define'](_0x4c2b('0xa'),attributes,{'tableName':_0x4c2b('0xb'),'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 3793c21..846036d 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 _0xaa83=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x535963,_0x326515){var _0x3975f6=function(_0x2e624f){while(--_0x2e624f){_0x535963['push'](_0x535963['shift']());}};_0x3975f6(++_0x326515);}(_0xaa83,0xf3));var _0x3aa8=function(_0x1b3fb0,_0x49325a){_0x1b3fb0=_0x1b3fb0-0x0;var _0x5eb66e=_0xaa83[_0x1b3fb0];return _0x5eb66e;};'use strict';var _=require(_0x3aa8('0x0'));var util=require(_0x3aa8('0x1'));var moment=require(_0x3aa8('0x2'));var BPromise=require(_0x3aa8('0x3'));var rs=require(_0x3aa8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3aa8('0x5'))['db'];var utils=require(_0x3aa8('0x6'));var logger=require('../../config/logger')(_0x3aa8('0x7'));var config=require(_0x3aa8('0x8'));var jayson=require(_0x3aa8('0x9'));var client=jayson[_0x3aa8('0xa')][_0x3aa8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x113559,_0x2b378b,_0x226ecf){return new BPromise(function(_0x4dc365,_0x583156){return client[_0x3aa8('0xc')](_0x113559,_0x226ecf)[_0x3aa8('0xd')](function(_0x5514bd){logger[_0x3aa8('0xe')](_0x3aa8('0xf'),_0x2b378b,_0x3aa8('0x10'));logger[_0x3aa8('0x11')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x2b378b,_0x3aa8('0x10'),JSON[_0x3aa8('0x12')](_0x5514bd));if(_0x5514bd[_0x3aa8('0x13')]){if(_0x5514bd['error'][_0x3aa8('0x14')]===0x1f4){logger[_0x3aa8('0x13')](_0x3aa8('0xf'),_0x2b378b,_0x5514bd[_0x3aa8('0x13')][_0x3aa8('0x15')]);return _0x583156(_0x5514bd[_0x3aa8('0x13')][_0x3aa8('0x15')]);}logger[_0x3aa8('0x13')](_0x3aa8('0xf'),_0x2b378b,_0x5514bd['error'][_0x3aa8('0x15')]);return _0x4dc365(_0x5514bd[_0x3aa8('0x13')][_0x3aa8('0x15')]);}else{logger[_0x3aa8('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2b378b,_0x3aa8('0x10'));_0x4dc365(_0x5514bd[_0x3aa8('0x16')][_0x3aa8('0x15')]);}})[_0x3aa8('0x17')](function(_0x2d0563){logger[_0x3aa8('0x13')](_0x3aa8('0xf'),_0x2b378b,_0x2d0563);_0x583156(_0x2d0563);});});} \ No newline at end of file +var _0x8033=['AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x3c8073,_0x23a0b6){var _0xc7e0b8=function(_0x451e1e){while(--_0x451e1e){_0x3c8073['push'](_0x3c8073['shift']());}};_0xc7e0b8(++_0x23a0b6);}(_0x8033,0x1ab));var _0x3803=function(_0x2b9972,_0x3a8d75){_0x2b9972=_0x2b9972-0x0;var _0x299e8b=_0x8033[_0x2b9972];return _0x299e8b;};'use strict';var _=require(_0x3803('0x0'));var util=require('util');var moment=require(_0x3803('0x1'));var BPromise=require(_0x3803('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3803('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3803('0x4'));var logger=require(_0x3803('0x5'))(_0x3803('0x6'));var config=require(_0x3803('0x7'));var jayson=require(_0x3803('0x8'));var client=jayson['client'][_0x3803('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x422347,_0x25fc77,_0x100fc1){return new BPromise(function(_0x2986cf,_0x5c878d){return client[_0x3803('0xa')](_0x422347,_0x100fc1)[_0x3803('0xb')](function(_0x262be7){logger[_0x3803('0xc')](_0x3803('0xd'),_0x25fc77,_0x3803('0xe'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x25fc77,_0x3803('0xe'),JSON['stringify'](_0x262be7));if(_0x262be7[_0x3803('0xf')]){if(_0x262be7[_0x3803('0xf')][_0x3803('0x10')]===0x1f4){logger[_0x3803('0xf')](_0x3803('0xd'),_0x25fc77,_0x262be7['error'][_0x3803('0x11')]);return _0x5c878d(_0x262be7['error']['message']);}logger[_0x3803('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x25fc77,_0x262be7[_0x3803('0xf')]['message']);return _0x2986cf(_0x262be7[_0x3803('0xf')][_0x3803('0x11')]);}else{logger[_0x3803('0xc')](_0x3803('0xd'),_0x25fc77,_0x3803('0xe'));_0x2986cf(_0x262be7[_0x3803('0x12')][_0x3803('0x11')]);}})[_0x3803('0x13')](function(_0x257713){logger[_0x3803('0xf')](_0x3803('0xd'),_0x25fc77,_0x257713);_0x5c878d(_0x257713);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index b0e3925..53d960c 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(_0x36ccd0,_0x4d6767){var _0xf50b90=function(_0x363f5d){while(--_0x363f5d){_0x36ccd0['push'](_0x36ccd0['shift']());}};_0xf50b90(++_0x4d6767);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0xa3e7e,_0x4a4d80){var _0x50fbb2=function(_0x3a9cb8){while(--_0x3a9cb8){_0xa3e7e['push'](_0xa3e7e['shift']());}};_0x50fbb2(++_0x4a4d80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 954d809..337b29a 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 _0x93ed=['STRING','name','sequelize','exports'];(function(_0x31906e,_0x3bcb9d){var _0xd7353=function(_0x4cfba4){while(--_0x4cfba4){_0x31906e['push'](_0x31906e['shift']());}};_0xd7353(++_0x3bcb9d);}(_0x93ed,0xfe));var _0xd93e=function(_0x1428a1,_0x342a4c){_0x1428a1=_0x1428a1-0x0;var _0x56cd58=_0x93ed[_0x1428a1];return _0x56cd58;};'use strict';var Sequelize=require(_0xd93e('0x0'));module[_0xd93e('0x1')]={'name':{'type':Sequelize[_0xd93e('0x2')],'allowNull':![],'unique':_0xd93e('0x3')},'table':{'type':Sequelize[_0xd93e('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xd93e('0x2')]}}; \ No newline at end of file +var _0x76d2=['sequelize','exports','STRING','TEXT'];(function(_0x5d8010,_0x7463b){var _0x1099c2=function(_0x5b61ce){while(--_0x5b61ce){_0x5d8010['push'](_0x5d8010['shift']());}};_0x1099c2(++_0x7463b);}(_0x76d2,0xf8));var _0x276d=function(_0x1a68a2,_0x36e662){_0x1a68a2=_0x1a68a2-0x0;var _0x4e8770=_0x76d2[_0x1a68a2];return _0x4e8770;};'use strict';var Sequelize=require(_0x276d('0x0'));module[_0x276d('0x1')]={'name':{'type':Sequelize[_0x276d('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x276d('0x2')]},'metric':{'type':Sequelize[_0x276d('0x3')]},'description':{'type':Sequelize[_0x276d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a91e87b..666fe75 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 _0x7da7=['model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','options','where','AnalyticMetric','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x7da7,0x10d));var _0x77da=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x7da7[_0x38ced4];return _0x547c07;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){var _0x4885ec=_0x270318[_0x77da('0x23')]({'plain':!![]});var _0x2d009f=_0x77da('0x24');return db[_0x77da('0x25')]['destroy']({'where':{'type':_0x2d009f,'resourceId':_0x4885ec['id']}})[_0x77da('0x21')](function(){return _0x270318;});})[_0x77da('0x21')](function(){_0x27b6c7[_0x77da('0x18')](0xcc)[_0x77da('0x26')]();});}};}function handleEntityNotFound(_0x446ae7,_0x5997b6){return function(_0xce24b8){if(!_0xce24b8){_0x446ae7[_0x77da('0x17')](0x194);}return _0xce24b8;};}function handleError(_0x1f2279,_0x2913f7){_0x2913f7=_0x2913f7||0x1f4;return function(_0x496ecd){logger['error'](_0x496ecd['stack']);if(_0x496ecd[_0x77da('0x27')]){delete _0x496ecd[_0x77da('0x27')];}_0x1f2279[_0x77da('0x18')](_0x2913f7)[_0x77da('0x28')](_0x496ecd);};}exports[_0x77da('0x29')]=function(_0x4eeb99,_0x350b4e){var _0x26f5a0={},_0x356bfb={},_0x1d381b={'count':0x0,'rows':[]};var _0x1e7853=_[_0x77da('0x2a')](db['AnalyticMetric'][_0x77da('0x2b')],function(_0x228851){return{'name':_0x228851[_0x77da('0x2c')],'type':_0x228851[_0x77da('0x2d')][_0x77da('0x2e')]};});_0x356bfb[_0x77da('0x2f')]=_[_0x77da('0x2a')](_0x1e7853,_0x77da('0x27'));_0x356bfb['query']=_['keys'](_0x4eeb99[_0x77da('0x30')]);_0x356bfb[_0x77da('0x31')]=_['intersection'](_0x356bfb[_0x77da('0x2f')],_0x356bfb[_0x77da('0x30')]);_0x26f5a0[_0x77da('0x32')]=_[_0x77da('0x33')](_0x356bfb[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x4eeb99[_0x77da('0x30')]['fields']));_0x26f5a0[_0x77da('0x32')]=_0x26f5a0['attributes']['length']?_0x26f5a0['attributes']:_0x356bfb[_0x77da('0x2f')];if(!_0x4eeb99['query'][_0x77da('0x35')](_0x77da('0x36'))){_0x26f5a0[_0x77da('0x1c')]=qs[_0x77da('0x1c')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x1c')]);_0x26f5a0[_0x77da('0x19')]=qs['offset'](_0x4eeb99[_0x77da('0x30')][_0x77da('0x19')]);}_0x26f5a0[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x38')]);_0x26f5a0['where']=qs[_0x77da('0x31')](_[_0x77da('0x39')](_0x4eeb99[_0x77da('0x30')],_0x356bfb['filters']),_0x1e7853);if(_0x4eeb99[_0x77da('0x30')]['filter']){_0x26f5a0['where']=_['merge'](_0x26f5a0['where'],{'$or':_[_0x77da('0x2a')](_0x1e7853,function(_0x1adba5){if(_0x1adba5[_0x77da('0x2d')]!=='VIRTUAL'){var _0x21d337={};_0x21d337[_0x1adba5['name']]={'$like':'%'+_0x4eeb99[_0x77da('0x30')]['filter']+'%'};return _0x21d337;}})});}_0x26f5a0=_[_0x77da('0x3a')]({},_0x26f5a0,_0x4eeb99[_0x77da('0x3b')]);var _0x290667={'where':_0x26f5a0[_0x77da('0x3c')]};return db[_0x77da('0x3d')]['count'](_0x290667)[_0x77da('0x21')](function(_0x1f48bd){_0x1d381b[_0x77da('0x1b')]=_0x1f48bd;if(_0x4eeb99[_0x77da('0x30')][_0x77da('0x3e')]){_0x26f5a0[_0x77da('0x3f')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x77da('0x40')](_0x26f5a0);})[_0x77da('0x21')](function(_0x21de41){_0x1d381b[_0x77da('0x41')]=_0x21de41;return _0x1d381b;})[_0x77da('0x21')](respondWithFilteredResult(_0x350b4e,_0x26f5a0))[_0x77da('0x42')](handleError(_0x350b4e,null));};exports['show']=function(_0x10957b,_0x5abcd9){var _0x1ae806={'raw':!![],'where':{'id':_0x10957b[_0x77da('0x43')]['id']}},_0x373fb2={};_0x373fb2['model']=_[_0x77da('0x44')](db[_0x77da('0x3d')][_0x77da('0x2b')]);_0x373fb2[_0x77da('0x30')]=_[_0x77da('0x44')](_0x10957b[_0x77da('0x30')]);_0x373fb2[_0x77da('0x31')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],_0x373fb2['query']);_0x1ae806[_0x77da('0x32')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x10957b[_0x77da('0x30')][_0x77da('0x34')]));_0x1ae806['attributes']=_0x1ae806['attributes'][_0x77da('0x45')]?_0x1ae806[_0x77da('0x32')]:_0x373fb2[_0x77da('0x2f')];if(_0x10957b[_0x77da('0x30')][_0x77da('0x3e')]){_0x1ae806[_0x77da('0x3f')]=[{'all':!![]}];}_0x1ae806=_['merge']({},_0x1ae806,_0x10957b[_0x77da('0x3b')]);return db[_0x77da('0x3d')][_0x77da('0x46')](_0x1ae806)[_0x77da('0x21')](handleEntityNotFound(_0x5abcd9,null))['then'](respondWithResult(_0x5abcd9,null))[_0x77da('0x42')](handleError(_0x5abcd9,null));};exports['create']=function(_0x518fd5,_0x36263b){return db[_0x77da('0x3d')][_0x77da('0x47')](_0x518fd5[_0x77da('0x48')],{})['then'](function(_0x16bf4b){var _0x1e36ee=_0x518fd5['user'][_0x77da('0x23')]({'plain':!![]});if(!_0x1e36ee)throw new Error(_0x77da('0x49'));if(_0x1e36ee['role']===_0x77da('0x4a')){var _0x3aaf5b=_0x16bf4b[_0x77da('0x23')]({'plain':!![]});var _0xef2496=_0x77da('0x24');return db[_0x77da('0x4b')][_0x77da('0x46')]({'where':{'name':_0xef2496,'userProfileId':_0x1e36ee[_0x77da('0x4c')]},'raw':!![]})[_0x77da('0x21')](function(_0x3a34a8){if(_0x3a34a8&&_0x3a34a8['autoAssociation']===0x0){return db[_0x77da('0x25')]['create']({'name':_0x3aaf5b[_0x77da('0x27')],'resourceId':_0x3aaf5b['id'],'type':_0x3a34a8[_0x77da('0x27')],'sectionId':_0x3a34a8['id']},{})[_0x77da('0x21')](function(){return _0x16bf4b;});}else{return _0x16bf4b;}})[_0x77da('0x42')](function(_0x374179){logger[_0x77da('0x4d')](_0x77da('0x4e'),_0x374179);throw _0x374179;});}return _0x16bf4b;})['then'](respondWithResult(_0x36263b,0xc9))[_0x77da('0x42')](handleError(_0x36263b,null));};exports[_0x77da('0x20')]=function(_0x1a7115,_0x353be9){if(_0x1a7115['body']['id']){delete _0x1a7115[_0x77da('0x48')]['id'];}return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x1a7115['params']['id']}})['then'](handleEntityNotFound(_0x353be9,null))[_0x77da('0x21')](saveUpdates(_0x1a7115[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x353be9,null))[_0x77da('0x42')](handleError(_0x353be9,null));};exports[_0x77da('0x22')]=function(_0x528a32,_0x50437b){return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x528a32['params']['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x50437b,null))[_0x77da('0x21')](removeEntity(_0x50437b,null))[_0x77da('0x42')](handleError(_0x50437b,null));}; \ No newline at end of file +var _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x15a632,_0x2454f2){var _0x3e5e44=function(_0x2c982e){while(--_0x2c982e){_0x15a632['push'](_0x15a632['shift']());}};_0x3e5e44(++_0x2454f2);}(_0x7217,0x19e));var _0x7721=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x7217[_0x3899d1];return _0xeb4a7d;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 772e50e..c605ec2 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 _0x6075=['path','rimraf','../../config/environment','exports','analytics_metrics','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x6075,0x191));var _0x5607=function(_0x28fc5b,_0x50a44c){_0x28fc5b=_0x28fc5b-0x0;var _0x1894c6=_0x6075[_0x28fc5b];return _0x1894c6;};'use strict';var _=require('lodash');var util=require(_0x5607('0x0'));var logger=require(_0x5607('0x1'))(_0x5607('0x2'));var moment=require(_0x5607('0x3'));var BPromise=require(_0x5607('0x4'));var rp=require(_0x5607('0x5'));var fs=require('fs');var path=require(_0x5607('0x6'));var rimraf=require(_0x5607('0x7'));var config=require(_0x5607('0x8'));var attributes=require('./analyticMetric.attributes');module[_0x5607('0x9')]=function(_0xabf691,_0x14b9f4){return _0xabf691['define']('AnalyticMetric',attributes,{'tableName':_0x5607('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x960c=['rimraf','../../config/environment','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x5a804b,_0x3ddfc2){var _0x1a5fea=function(_0x4db7ca){while(--_0x4db7ca){_0x5a804b['push'](_0x5a804b['shift']());}};_0x1a5fea(++_0x3ddfc2);}(_0x960c,0x113));var _0xc960=function(_0x50bff5,_0xba04c2){_0x50bff5=_0x50bff5-0x0;var _0x45a267=_0x960c[_0x50bff5];return _0x45a267;};'use strict';var _=require(_0xc960('0x0'));var util=require('util');var logger=require(_0xc960('0x1'))('api');var moment=require(_0xc960('0x2'));var BPromise=require(_0xc960('0x3'));var rp=require(_0xc960('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc960('0x5'));var config=require(_0xc960('0x6'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x2bb9df,_0x2beb88){return _0x2bb9df[_0xc960('0x7')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 4ee22c6..7123862 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 _0x3cee=['AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x3e1305,_0x4f0c6d){var _0x478ad7=function(_0x316365){while(--_0x316365){_0x3e1305['push'](_0x3e1305['shift']());}};_0x478ad7(++_0x4f0c6d);}(_0x3cee,0x1e8));var _0xe3ce=function(_0x5d7902,_0x322d12){_0x5d7902=_0x5d7902-0x0;var _0x261cda=_0x3cee[_0x5d7902];return _0x261cda;};'use strict';var _=require(_0xe3ce('0x0'));var util=require(_0xe3ce('0x1'));var moment=require(_0xe3ce('0x2'));var BPromise=require('bluebird');var rs=require(_0xe3ce('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe3ce('0x4'));var logger=require(_0xe3ce('0x5'))('rpc');var config=require(_0xe3ce('0x6'));var jayson=require(_0xe3ce('0x7'));var client=jayson['client'][_0xe3ce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29e429,_0x490663,_0x239342){return new BPromise(function(_0x4c2e7d,_0x358078){return client[_0xe3ce('0x9')](_0x29e429,_0x239342)[_0xe3ce('0xa')](function(_0x3be359){logger[_0xe3ce('0xb')](_0xe3ce('0xc'),_0x490663,'request\x20sent');logger[_0xe3ce('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x490663,_0xe3ce('0xe'),JSON[_0xe3ce('0xf')](_0x3be359));if(_0x3be359[_0xe3ce('0x10')]){if(_0x3be359['error']['code']===0x1f4){logger[_0xe3ce('0x10')](_0xe3ce('0xc'),_0x490663,_0x3be359[_0xe3ce('0x10')][_0xe3ce('0x11')]);return _0x358078(_0x3be359[_0xe3ce('0x10')]['message']);}logger[_0xe3ce('0x10')](_0xe3ce('0xc'),_0x490663,_0x3be359[_0xe3ce('0x10')][_0xe3ce('0x11')]);return _0x4c2e7d(_0x3be359['error'][_0xe3ce('0x11')]);}else{logger['info'](_0xe3ce('0xc'),_0x490663,_0xe3ce('0xe'));_0x4c2e7d(_0x3be359[_0xe3ce('0x12')][_0xe3ce('0x11')]);}})[_0xe3ce('0x13')](function(_0x93ea58){logger[_0xe3ce('0x10')](_0xe3ce('0xc'),_0x490663,_0x93ea58);_0x358078(_0x93ea58);});});} \ No newline at end of file +var _0x667a=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0x667a,0xf7));var _0xa667=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x667a[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0xa667('0x0'));var util=require(_0xa667('0x1'));var moment=require(_0xa667('0x2'));var BPromise=require(_0xa667('0x3'));var rs=require(_0xa667('0x4'));var fs=require('fs');var Redis=require(_0xa667('0x5'));var db=require(_0xa667('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa667('0x7'))(_0xa667('0x8'));var config=require(_0xa667('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa667('0xa')][_0xa667('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a78cf,_0x225ae4,_0x419814){return new BPromise(function(_0x6bf714,_0x41df7b){return client['request'](_0x5a78cf,_0x419814)['then'](function(_0x24bff8){logger['info'](_0xa667('0xc'),_0x225ae4,'request\x20sent');logger[_0xa667('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x225ae4,_0xa667('0xe'),JSON[_0xa667('0xf')](_0x24bff8));if(_0x24bff8[_0xa667('0x10')]){if(_0x24bff8[_0xa667('0x10')][_0xa667('0x11')]===0x1f4){logger[_0xa667('0x10')](_0xa667('0xc'),_0x225ae4,_0x24bff8[_0xa667('0x10')][_0xa667('0x12')]);return _0x41df7b(_0x24bff8['error'][_0xa667('0x12')]);}logger[_0xa667('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x225ae4,_0x24bff8[_0xa667('0x10')][_0xa667('0x12')]);return _0x6bf714(_0x24bff8[_0xa667('0x10')]['message']);}else{logger[_0xa667('0x13')](_0xa667('0xc'),_0x225ae4,_0xa667('0xe'));_0x6bf714(_0x24bff8[_0xa667('0x14')][_0xa667('0x12')]);}})['catch'](function(_0x4c5c07){logger[_0xa667('0x10')](_0xa667('0xc'),_0x225ae4,_0x4c5c07);_0x41df7b(_0x4c5c07);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 86b0beb..923fb65 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 _0xbbbd=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbbbd,0x86));var _0xdbbb=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xbbbd[_0x2f45ea];return _0x485a84;};'use strict';var multer=require(_0xdbbb('0x0'));var util=require(_0xdbbb('0x1'));var path=require(_0xdbbb('0x2'));var timeout=require(_0xdbbb('0x3'));var express=require(_0xdbbb('0x4'));var router=express[_0xdbbb('0x5')]();var fs_extra=require(_0xdbbb('0x6'));var auth=require(_0xdbbb('0x7'));var interaction=require(_0xdbbb('0x8'));var config=require(_0xdbbb('0x9'));var controller=require(_0xdbbb('0xa'));router[_0xdbbb('0xb')]('/',auth['isAuthenticated'](),controller[_0xdbbb('0xc')]);router[_0xdbbb('0xb')](_0xdbbb('0xd'),auth[_0xdbbb('0xe')](),controller[_0xdbbb('0xf')]);router[_0xdbbb('0x10')]('/',auth[_0xdbbb('0xe')](),controller[_0xdbbb('0x11')]);router[_0xdbbb('0x12')](_0xdbbb('0xd'),auth['isAuthenticated'](),controller[_0xdbbb('0x13')]);router['delete'](_0xdbbb('0xd'),auth['isAuthenticated'](),controller[_0xdbbb('0x14')]);module[_0xdbbb('0x15')]=router; \ No newline at end of file +var _0x29d4=['put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x4c7717,_0x520a56){var _0x3cd802=function(_0x3f9dfb){while(--_0x3f9dfb){_0x4c7717['push'](_0x4c7717['shift']());}};_0x3cd802(++_0x520a56);}(_0x29d4,0x1a1));var _0x429d=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x29d4[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x429d('0x0'));var util=require('util');var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express[_0x429d('0x4')]();var fs_extra=require(_0x429d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var controller=require(_0x429d('0x8'));router[_0x429d('0x9')]('/',auth[_0x429d('0xa')](),controller[_0x429d('0xb')]);router[_0x429d('0x9')](_0x429d('0xc'),auth['isAuthenticated'](),controller[_0x429d('0xd')]);router['post']('/',auth[_0x429d('0xa')](),controller[_0x429d('0xe')]);router[_0x429d('0xf')]('/:id',auth[_0x429d('0xa')](),controller[_0x429d('0x10')]);router['delete'](_0x429d('0xc'),auth[_0x429d('0xa')](),controller[_0x429d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index cf49db9..645628d 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 _0x7fcd=['TEXT','sequelize'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7fcd,0x1cf));var _0xd7fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7fcd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7fc('0x0'));module['exports']={'tree':{'type':Sequelize[_0xd7fc('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x35a9=['TEXT','exports'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0x35a9,0x73));var _0x935a=function(_0x510f75,_0x17cfc4){_0x510f75=_0x510f75-0x0;var _0x10dde4=_0x35a9[_0x510f75];return _0x10dde4;};'use strict';var Sequelize=require('sequelize');module[_0x935a('0x0')]={'tree':{'type':Sequelize[_0x935a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index a5253b6..7bd7015 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 _0xba43=['body','eml-format','rimraf','zip-dir','request-promise','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','find','create'];(function(_0x4bd59b,_0x33dd08){var _0x40382b=function(_0x303c65){while(--_0x303c65){_0x4bd59b['push'](_0x4bd59b['shift']());}};_0x40382b(++_0x33dd08);}(_0xba43,0x91));var _0x3ba4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xba43[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x3ba4('0x0'));var rimraf=require(_0x3ba4('0x1'));var zipdir=require(_0x3ba4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ba4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3ba4('0x4'));var path=require('path');var sox=require(_0x3ba4('0x5'));var csv=require('to-csv');var ejs=require(_0x3ba4('0x6'));var fs=require('fs');var fs_extra=require(_0x3ba4('0x7'));var _=require(_0x3ba4('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ba4('0x9'));var deskjs=require(_0x3ba4('0xa'));var toCsv=require(_0x3ba4('0xb'));var querystring=require('querystring');var Papa=require(_0x3ba4('0xc'));var Redis=require(_0x3ba4('0xd'));var authService=require(_0x3ba4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3ba4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ba4('0x10'))(_0x3ba4('0x11'));var utils=require(_0x3ba4('0x12'));var config=require(_0x3ba4('0x13'));var licenseUtil=require(_0x3ba4('0x14'));var db=require(_0x3ba4('0x15'))['db'];function respondWithStatusCode(_0x4b02be,_0x1b9a46){_0x1b9a46=_0x1b9a46||0xcc;return function(_0x5b6351){if(_0x5b6351){return _0x4b02be[_0x3ba4('0x16')](_0x1b9a46);}return _0x4b02be[_0x3ba4('0x17')](_0x1b9a46)[_0x3ba4('0x18')]();};}function respondWithResult(_0x352ea0,_0x5d5f85){_0x5d5f85=_0x5d5f85||0xc8;return function(_0x46958f){if(_0x46958f){return _0x352ea0[_0x3ba4('0x17')](_0x5d5f85)[_0x3ba4('0x19')](_0x46958f);}};}function respondWithFilteredResult(_0x1fba1c,_0x2eb98a){return function(_0x537367){if(_0x537367){var _0x5bec86=typeof _0x2eb98a['offset']===_0x3ba4('0x1a')&&typeof _0x2eb98a[_0x3ba4('0x1b')]===_0x3ba4('0x1a');var _0x495be2=_0x537367[_0x3ba4('0x1c')];var _0x58bcdc=_0x5bec86?0x0:_0x2eb98a[_0x3ba4('0x1d')];var _0x3187bb=_0x5bec86?_0x537367[_0x3ba4('0x1c')]:_0x2eb98a['offset']+_0x2eb98a[_0x3ba4('0x1b')];var _0x359496;if(_0x3187bb>=_0x495be2){_0x3187bb=_0x495be2;_0x359496=0xc8;}else{_0x359496=0xce;}_0x1fba1c[_0x3ba4('0x17')](_0x359496);return _0x1fba1c[_0x3ba4('0x1e')](_0x3ba4('0x1f'),_0x58bcdc+'-'+_0x3187bb+'/'+_0x495be2)[_0x3ba4('0x19')](_0x537367);}return null;};}function patchUpdates(_0x521975){return function(_0x355aba){try{jsonpatch['apply'](_0x355aba,_0x521975,!![]);}catch(_0xdd1270){return BPromise[_0x3ba4('0x20')](_0xdd1270);}return _0x355aba[_0x3ba4('0x21')]();};}function saveUpdates(_0x4e7bbf,_0x36bf75){return function(_0x44c6e0){if(_0x44c6e0){return _0x44c6e0[_0x3ba4('0x22')](_0x4e7bbf)[_0x3ba4('0x23')](function(_0x3bb4f0){return _0x3bb4f0;});}return null;};}function removeEntity(_0x117480,_0x2c07a8){return function(_0x59cd85){if(_0x59cd85){return _0x59cd85[_0x3ba4('0x24')]()[_0x3ba4('0x23')](function(){_0x117480[_0x3ba4('0x17')](0xcc)[_0x3ba4('0x18')]();});}};}function handleEntityNotFound(_0x428388,_0x291ed2){return function(_0x208887){if(!_0x208887){_0x428388[_0x3ba4('0x16')](0x194);}return _0x208887;};}function handleError(_0x454f05,_0xd84db6){_0xd84db6=_0xd84db6||0x1f4;return function(_0x5c2a15){logger[_0x3ba4('0x25')](_0x5c2a15['stack']);if(_0x5c2a15[_0x3ba4('0x26')]){delete _0x5c2a15['name'];}_0x454f05[_0x3ba4('0x17')](_0xd84db6)[_0x3ba4('0x27')](_0x5c2a15);};}exports[_0x3ba4('0x28')]=function(_0xee5db6,_0x34fdff){var _0x4dbefa={},_0x16c5af={},_0x5033d8={'count':0x0,'rows':[]};var _0x1ed403=_[_0x3ba4('0x29')](db[_0x3ba4('0x2a')][_0x3ba4('0x2b')],function(_0x48c37f){return{'name':_0x48c37f[_0x3ba4('0x2c')],'type':_0x48c37f[_0x3ba4('0x2d')][_0x3ba4('0x2e')]};});_0x16c5af[_0x3ba4('0x2f')]=_[_0x3ba4('0x29')](_0x1ed403,'name');_0x16c5af['query']=_[_0x3ba4('0x30')](_0xee5db6[_0x3ba4('0x31')]);_0x16c5af[_0x3ba4('0x32')]=_[_0x3ba4('0x33')](_0x16c5af['model'],_0x16c5af[_0x3ba4('0x31')]);_0x4dbefa['attributes']=_[_0x3ba4('0x33')](_0x16c5af['model'],qs['fields'](_0xee5db6[_0x3ba4('0x31')][_0x3ba4('0x34')]));_0x4dbefa[_0x3ba4('0x35')]=_0x4dbefa[_0x3ba4('0x35')][_0x3ba4('0x36')]?_0x4dbefa[_0x3ba4('0x35')]:_0x16c5af[_0x3ba4('0x2f')];if(!_0xee5db6['query'][_0x3ba4('0x37')]('nolimit')){_0x4dbefa[_0x3ba4('0x1b')]=qs[_0x3ba4('0x1b')](_0xee5db6[_0x3ba4('0x31')]['limit']);_0x4dbefa[_0x3ba4('0x1d')]=qs[_0x3ba4('0x1d')](_0xee5db6[_0x3ba4('0x31')]['offset']);}_0x4dbefa[_0x3ba4('0x38')]=qs[_0x3ba4('0x39')](_0xee5db6[_0x3ba4('0x31')]['sort']);_0x4dbefa[_0x3ba4('0x3a')]=qs[_0x3ba4('0x32')](_[_0x3ba4('0x3b')](_0xee5db6[_0x3ba4('0x31')],_0x16c5af['filters']),_0x1ed403);if(_0xee5db6[_0x3ba4('0x31')][_0x3ba4('0x3c')]){_0x4dbefa['where']=_[_0x3ba4('0x3d')](_0x4dbefa['where'],{'$or':_['map'](_0x1ed403,function(_0x34bbfa){if(_0x34bbfa[_0x3ba4('0x2d')]!==_0x3ba4('0x3e')){var _0x1e01c3={};_0x1e01c3[_0x34bbfa[_0x3ba4('0x26')]]={'$like':'%'+_0xee5db6[_0x3ba4('0x31')][_0x3ba4('0x3c')]+'%'};return _0x1e01c3;}})});}_0x4dbefa=_['merge']({},_0x4dbefa,_0xee5db6[_0x3ba4('0x3f')]);var _0x1d783f={'where':_0x4dbefa[_0x3ba4('0x3a')]};return db[_0x3ba4('0x2a')]['count'](_0x1d783f)[_0x3ba4('0x23')](function(_0x26a5b7){_0x5033d8['count']=_0x26a5b7;if(_0xee5db6[_0x3ba4('0x31')][_0x3ba4('0x40')]){_0x4dbefa['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x3ba4('0x41')](_0x4dbefa);})['then'](function(_0x1468e8){_0x5033d8['rows']=_0x1468e8;return _0x5033d8;})[_0x3ba4('0x23')](respondWithFilteredResult(_0x34fdff,_0x4dbefa))[_0x3ba4('0x42')](handleError(_0x34fdff,null));};exports[_0x3ba4('0x43')]=function(_0x35eb51,_0x24466e){var _0x468cee={'raw':!![],'where':{'id':_0x35eb51[_0x3ba4('0x44')]['id']}},_0x315bfa={};_0x315bfa[_0x3ba4('0x2f')]=_[_0x3ba4('0x30')](db[_0x3ba4('0x2a')][_0x3ba4('0x2b')]);_0x315bfa[_0x3ba4('0x31')]=_[_0x3ba4('0x30')](_0x35eb51[_0x3ba4('0x31')]);_0x315bfa[_0x3ba4('0x32')]=_['intersection'](_0x315bfa[_0x3ba4('0x2f')],_0x315bfa[_0x3ba4('0x31')]);_0x468cee['attributes']=_[_0x3ba4('0x33')](_0x315bfa[_0x3ba4('0x2f')],qs[_0x3ba4('0x34')](_0x35eb51[_0x3ba4('0x31')][_0x3ba4('0x34')]));_0x468cee[_0x3ba4('0x35')]=_0x468cee[_0x3ba4('0x35')]['length']?_0x468cee['attributes']:_0x315bfa[_0x3ba4('0x2f')];if(_0x35eb51[_0x3ba4('0x31')][_0x3ba4('0x40')]){_0x468cee['include']=[{'all':!![]}];}_0x468cee=_[_0x3ba4('0x3d')]({},_0x468cee,_0x35eb51[_0x3ba4('0x3f')]);return db[_0x3ba4('0x2a')][_0x3ba4('0x45')](_0x468cee)[_0x3ba4('0x23')](handleEntityNotFound(_0x24466e,null))[_0x3ba4('0x23')](respondWithResult(_0x24466e,null))[_0x3ba4('0x42')](handleError(_0x24466e,null));};exports[_0x3ba4('0x46')]=function(_0x4323f0,_0x39fe2f){return db[_0x3ba4('0x2a')][_0x3ba4('0x46')](_0x4323f0[_0x3ba4('0x47')],{})['then'](respondWithResult(_0x39fe2f,0xc9))[_0x3ba4('0x42')](handleError(_0x39fe2f,null));};exports[_0x3ba4('0x22')]=function(_0xafef8e,_0x54443c){if(_0xafef8e['body']['id']){delete _0xafef8e[_0x3ba4('0x47')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0xafef8e[_0x3ba4('0x44')]['id']}})[_0x3ba4('0x23')](handleEntityNotFound(_0x54443c,null))[_0x3ba4('0x23')](saveUpdates(_0xafef8e[_0x3ba4('0x47')],null))[_0x3ba4('0x23')](respondWithResult(_0x54443c,null))[_0x3ba4('0x42')](handleError(_0x54443c,null));};exports['destroy']=function(_0x2b9c4e,_0x431389){return db[_0x3ba4('0x2a')][_0x3ba4('0x45')]({'where':{'id':_0x2b9c4e[_0x3ba4('0x44')]['id']}})[_0x3ba4('0x23')](handleEntityNotFound(_0x431389,null))['then'](removeEntity(_0x431389,null))[_0x3ba4('0x42')](handleError(_0x431389,null));}; \ No newline at end of file +var _0x033a=['attributes','fields','length','pick','filter','where','VIRTUAL','includeAll','include','rows','catch','show','merge','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x4f73db,_0x546d3d){var _0x35044b=function(_0xa0f424){while(--_0xa0f424){_0x4f73db['push'](_0x4f73db['shift']());}};_0x35044b(++_0x546d3d);}(_0x033a,0xe3));var _0xa033=function(_0x10b48a,_0x1a0a3f){_0x10b48a=_0x10b48a-0x0;var _0x2c4533=_0x033a[_0x10b48a];return _0x2c4533;};'use strict';var emlformat=require(_0xa033('0x0'));var rimraf=require(_0xa033('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa033('0x2'));var rp=require(_0xa033('0x3'));var moment=require(_0xa033('0x4'));var BPromise=require(_0xa033('0x5'));var Mustache=require(_0xa033('0x6'));var util=require('util');var path=require(_0xa033('0x7'));var sox=require('sox');var csv=require(_0xa033('0x8'));var ejs=require(_0xa033('0x9'));var fs=require('fs');var fs_extra=require(_0xa033('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa033('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa033('0x8'));var querystring=require(_0xa033('0xc'));var Papa=require(_0xa033('0xd'));var Redis=require('ioredis');var authService=require(_0xa033('0xe'));var qs=require(_0xa033('0xf'));var as=require(_0xa033('0x10'));var hardwareService=require(_0xa033('0x11'));var logger=require(_0xa033('0x12'))(_0xa033('0x13'));var utils=require(_0xa033('0x14'));var config=require(_0xa033('0x15'));var licenseUtil=require(_0xa033('0x16'));var db=require(_0xa033('0x17'))['db'];function respondWithStatusCode(_0x436c9a,_0x3c951f){_0x3c951f=_0x3c951f||0xcc;return function(_0x3bbfe3){if(_0x3bbfe3){return _0x436c9a[_0xa033('0x18')](_0x3c951f);}return _0x436c9a[_0xa033('0x19')](_0x3c951f)['end']();};}function respondWithResult(_0x5285cc,_0x48c9b1){_0x48c9b1=_0x48c9b1||0xc8;return function(_0x3c3b15){if(_0x3c3b15){return _0x5285cc[_0xa033('0x19')](_0x48c9b1)[_0xa033('0x1a')](_0x3c3b15);}};}function respondWithFilteredResult(_0x48ac1d,_0x5b0269){return function(_0x33fe1c){if(_0x33fe1c){var _0x549cc1=typeof _0x5b0269['offset']===_0xa033('0x1b')&&typeof _0x5b0269['limit']==='undefined';var _0x25c66b=_0x33fe1c[_0xa033('0x1c')];var _0x3328bd=_0x549cc1?0x0:_0x5b0269[_0xa033('0x1d')];var _0x22b52e=_0x549cc1?_0x33fe1c[_0xa033('0x1c')]:_0x5b0269['offset']+_0x5b0269[_0xa033('0x1e')];var _0x1ac4ed;if(_0x22b52e>=_0x25c66b){_0x22b52e=_0x25c66b;_0x1ac4ed=0xc8;}else{_0x1ac4ed=0xce;}_0x48ac1d[_0xa033('0x19')](_0x1ac4ed);return _0x48ac1d[_0xa033('0x1f')](_0xa033('0x20'),_0x3328bd+'-'+_0x22b52e+'/'+_0x25c66b)[_0xa033('0x1a')](_0x33fe1c);}return null;};}function patchUpdates(_0x56a1bd){return function(_0x41ba9e){try{jsonpatch['apply'](_0x41ba9e,_0x56a1bd,!![]);}catch(_0x32d59a){return BPromise[_0xa033('0x21')](_0x32d59a);}return _0x41ba9e[_0xa033('0x22')]();};}function saveUpdates(_0x4dd8de,_0x37ece8){return function(_0x5cdccf){if(_0x5cdccf){return _0x5cdccf[_0xa033('0x23')](_0x4dd8de)[_0xa033('0x24')](function(_0x5b1227){return _0x5b1227;});}return null;};}function removeEntity(_0xb1ea62,_0x26ae31){return function(_0x3070c7){if(_0x3070c7){return _0x3070c7[_0xa033('0x25')]()[_0xa033('0x24')](function(){_0xb1ea62['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a5c88,_0x3ee28a){return function(_0x365d1b){if(!_0x365d1b){_0x4a5c88['sendStatus'](0x194);}return _0x365d1b;};}function handleError(_0x518c02,_0x190d74){_0x190d74=_0x190d74||0x1f4;return function(_0x2a657c){logger['error'](_0x2a657c[_0xa033('0x26')]);if(_0x2a657c[_0xa033('0x27')]){delete _0x2a657c[_0xa033('0x27')];}_0x518c02[_0xa033('0x19')](_0x190d74)[_0xa033('0x28')](_0x2a657c);};}exports[_0xa033('0x29')]=function(_0x3f8317,_0x261d42){var _0x4be845={},_0x2ab2fe={},_0x2803e6={'count':0x0,'rows':[]};var _0x237fa3=_[_0xa033('0x2a')](db[_0xa033('0x2b')][_0xa033('0x2c')],function(_0x4c8713){return{'name':_0x4c8713[_0xa033('0x2d')],'type':_0x4c8713[_0xa033('0x2e')][_0xa033('0x2f')]};});_0x2ab2fe[_0xa033('0x30')]=_['map'](_0x237fa3,_0xa033('0x27'));_0x2ab2fe[_0xa033('0x31')]=_[_0xa033('0x32')](_0x3f8317[_0xa033('0x31')]);_0x2ab2fe[_0xa033('0x33')]=_[_0xa033('0x34')](_0x2ab2fe[_0xa033('0x30')],_0x2ab2fe['query']);_0x4be845[_0xa033('0x35')]=_['intersection'](_0x2ab2fe[_0xa033('0x30')],qs['fields'](_0x3f8317[_0xa033('0x31')][_0xa033('0x36')]));_0x4be845['attributes']=_0x4be845[_0xa033('0x35')][_0xa033('0x37')]?_0x4be845[_0xa033('0x35')]:_0x2ab2fe['model'];if(!_0x3f8317[_0xa033('0x31')]['hasOwnProperty']('nolimit')){_0x4be845[_0xa033('0x1e')]=qs[_0xa033('0x1e')](_0x3f8317[_0xa033('0x31')][_0xa033('0x1e')]);_0x4be845[_0xa033('0x1d')]=qs['offset'](_0x3f8317['query'][_0xa033('0x1d')]);}_0x4be845['order']=qs['sort'](_0x3f8317['query']['sort']);_0x4be845['where']=qs[_0xa033('0x33')](_[_0xa033('0x38')](_0x3f8317[_0xa033('0x31')],_0x2ab2fe[_0xa033('0x33')]),_0x237fa3);if(_0x3f8317[_0xa033('0x31')][_0xa033('0x39')]){_0x4be845[_0xa033('0x3a')]=_['merge'](_0x4be845[_0xa033('0x3a')],{'$or':_[_0xa033('0x2a')](_0x237fa3,function(_0x2e2ae9){if(_0x2e2ae9['type']!==_0xa033('0x3b')){var _0x3ff2a6={};_0x3ff2a6[_0x2e2ae9['name']]={'$like':'%'+_0x3f8317[_0xa033('0x31')][_0xa033('0x39')]+'%'};return _0x3ff2a6;}})});}_0x4be845=_['merge']({},_0x4be845,_0x3f8317['options']);var _0x5994e9={'where':_0x4be845[_0xa033('0x3a')]};return db[_0xa033('0x2b')][_0xa033('0x1c')](_0x5994e9)['then'](function(_0x52089e){_0x2803e6[_0xa033('0x1c')]=_0x52089e;if(_0x3f8317[_0xa033('0x31')][_0xa033('0x3c')]){_0x4be845[_0xa033('0x3d')]=[{'all':!![]}];}return db[_0xa033('0x2b')]['findAll'](_0x4be845);})[_0xa033('0x24')](function(_0x58bc67){_0x2803e6[_0xa033('0x3e')]=_0x58bc67;return _0x2803e6;})[_0xa033('0x24')](respondWithFilteredResult(_0x261d42,_0x4be845))[_0xa033('0x3f')](handleError(_0x261d42,null));};exports[_0xa033('0x40')]=function(_0xada129,_0x46b47c){var _0x49fa60={'raw':!![],'where':{'id':_0xada129['params']['id']}},_0x249364={};_0x249364[_0xa033('0x30')]=_[_0xa033('0x32')](db[_0xa033('0x2b')]['rawAttributes']);_0x249364[_0xa033('0x31')]=_[_0xa033('0x32')](_0xada129[_0xa033('0x31')]);_0x249364[_0xa033('0x33')]=_[_0xa033('0x34')](_0x249364[_0xa033('0x30')],_0x249364[_0xa033('0x31')]);_0x49fa60['attributes']=_[_0xa033('0x34')](_0x249364[_0xa033('0x30')],qs[_0xa033('0x36')](_0xada129['query'][_0xa033('0x36')]));_0x49fa60[_0xa033('0x35')]=_0x49fa60[_0xa033('0x35')][_0xa033('0x37')]?_0x49fa60['attributes']:_0x249364['model'];if(_0xada129['query'][_0xa033('0x3c')]){_0x49fa60[_0xa033('0x3d')]=[{'all':!![]}];}_0x49fa60=_[_0xa033('0x41')]({},_0x49fa60,_0xada129[_0xa033('0x42')]);return db[_0xa033('0x2b')][_0xa033('0x43')](_0x49fa60)[_0xa033('0x24')](handleEntityNotFound(_0x46b47c,null))[_0xa033('0x24')](respondWithResult(_0x46b47c,null))['catch'](handleError(_0x46b47c,null));};exports[_0xa033('0x44')]=function(_0x5bea9a,_0x2fbac4){return db['AnalyticTreeReport'][_0xa033('0x44')](_0x5bea9a[_0xa033('0x45')],{})['then'](respondWithResult(_0x2fbac4,0xc9))['catch'](handleError(_0x2fbac4,null));};exports[_0xa033('0x23')]=function(_0xe1db67,_0x126381){if(_0xe1db67[_0xa033('0x45')]['id']){delete _0xe1db67[_0xa033('0x45')]['id'];}return db[_0xa033('0x2b')][_0xa033('0x43')]({'where':{'id':_0xe1db67['params']['id']}})[_0xa033('0x24')](handleEntityNotFound(_0x126381,null))['then'](saveUpdates(_0xe1db67['body'],null))['then'](respondWithResult(_0x126381,null))[_0xa033('0x3f')](handleError(_0x126381,null));};exports['destroy']=function(_0x2766e9,_0x97beb6){return db['AnalyticTreeReport'][_0xa033('0x43')]({'where':{'id':_0x2766e9['params']['id']}})['then'](handleEntityNotFound(_0x97beb6,null))[_0xa033('0x24')](removeEntity(_0x97beb6,null))[_0xa033('0x3f')](handleError(_0x97beb6,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 88f1e48..d7ac501 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 _0xd1fd=['util','moment','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x51b661,_0x566ef8){var _0x5d1971=function(_0x5cc6b8){while(--_0x5cc6b8){_0x51b661['push'](_0x51b661['shift']());}};_0x5d1971(++_0x566ef8);}(_0xd1fd,0xe3));var _0xdd1f=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xd1fd[_0x470bfb];return _0x2f5d97;};'use strict';var _=require(_0xdd1f('0x0'));var util=require(_0xdd1f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdd1f('0x2'));var BPromise=require(_0xdd1f('0x3'));var rp=require(_0xdd1f('0x4'));var fs=require('fs');var path=require(_0xdd1f('0x5'));var rimraf=require(_0xdd1f('0x6'));var config=require('../../config/environment');var attributes=require(_0xdd1f('0x7'));module[_0xdd1f('0x8')]=function(_0x4059ae,_0x40a35a){return _0x4059ae[_0xdd1f('0x9')](_0xdd1f('0xa'),attributes,{'tableName':_0xdd1f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf25a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','define','analytics_report_trees','lodash'];(function(_0x44ed13,_0x391e24){var _0x785164=function(_0x52b670){while(--_0x52b670){_0x44ed13['push'](_0x44ed13['shift']());}};_0x785164(++_0x391e24);}(_0xf25a,0x18b));var _0xaf25=function(_0xc079ce,_0xb1c4c0){_0xc079ce=_0xc079ce-0x0;var _0x45eaa4=_0xf25a[_0xc079ce];return _0x45eaa4;};'use strict';var _=require(_0xaf25('0x0'));var util=require(_0xaf25('0x1'));var logger=require(_0xaf25('0x2'))(_0xaf25('0x3'));var moment=require(_0xaf25('0x4'));var BPromise=require(_0xaf25('0x5'));var rp=require(_0xaf25('0x6'));var fs=require('fs');var path=require(_0xaf25('0x7'));var rimraf=require(_0xaf25('0x8'));var config=require('../../config/environment');var attributes=require(_0xaf25('0x9'));module['exports']=function(_0x1df5f7,_0x1870a5){return _0x1df5f7[_0xaf25('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0xaf25('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index ac89f8e..a4b2569 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 _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(_0x2fdd6a,_0x512f37){var _0x33945f=function(_0x554881){while(--_0x554881){_0x2fdd6a['push'](_0x2fdd6a['shift']());}};_0x33945f(++_0x512f37);}(_0x1261,0x144));var _0x1126=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0x1261[_0x5fa520];return _0x1bf6c4;};'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 +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(_0x41e32,_0x486e7d){var _0x3d3ec4=function(_0x132908){while(--_0x132908){_0x41e32['push'](_0x41e32['shift']());}};_0x3d3ec4(++_0x486e7d);}(_0x1261,0x144));var _0x1126=function(_0x229e80,_0x414425){_0x229e80=_0x229e80-0x0;var _0x30c4a4=_0x1261[_0x229e80];return _0x30c4a4;};'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 0dcbe92..3511ea5 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 _0xd979=['show','create','update','delete','/:id','destroy','exports','util','path','connect-timeout','fs-extra','../../config/environment','./analyticTreeReport.controller','index','get','isAuthenticated'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xd979,0x1c7));var _0x9d97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd979[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9d97('0x0'));var path=require(_0x9d97('0x1'));var timeout=require(_0x9d97('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9d97('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9d97('0x4'));var controller=require(_0x9d97('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x9d97('0x6')]);router[_0x9d97('0x7')]('/:id',auth[_0x9d97('0x8')](),controller[_0x9d97('0x9')]);router['post']('/',auth[_0x9d97('0x8')](),controller[_0x9d97('0xa')]);router['put']('/:id',auth[_0x9d97('0x8')](),controller[_0x9d97('0xb')]);router[_0x9d97('0xc')](_0x9d97('0xd'),auth[_0x9d97('0x8')](),controller[_0x9d97('0xe')]);module[_0x9d97('0xf')]=router; \ No newline at end of file +var _0x3503=['update','exports','util','express','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x3503,0x1ca));var _0x3350=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x3503[_0x122096];return _0x3d1966;};'use strict';var multer=require('multer');var util=require(_0x3350('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3350('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3350('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x3350('0x3'));var controller=require(_0x3350('0x4'));router['get']('/',auth[_0x3350('0x5')](),controller[_0x3350('0x6')]);router[_0x3350('0x7')](_0x3350('0x8'),auth[_0x3350('0x5')](),controller[_0x3350('0x9')]);router['post']('/',auth[_0x3350('0x5')](),controller['create']);router['put'](_0x3350('0x8'),auth[_0x3350('0x5')](),controller[_0x3350('0xa')]);router['delete'](_0x3350('0x8'),auth[_0x3350('0x5')](),controller['destroy']);module[_0x3350('0xb')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 2f2b642..4725f7c 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 _0xcb18=['STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcb18,0x159));var _0x8cb1=function(_0x53cdd2,_0x22f364){_0x53cdd2=_0x53cdd2-0x0;var _0x2420ea=_0xcb18[_0x53cdd2];return _0x2420ea;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8cb1('0x0')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8cb1('0x0')]}}; \ No newline at end of file +var _0xf3be=['STRING','sequelize','exports'];(function(_0x42fbc3,_0x2dede7){var _0x184909=function(_0xd90fe4){while(--_0xd90fe4){_0x42fbc3['push'](_0x42fbc3['shift']());}};_0x184909(++_0x2dede7);}(_0xf3be,0x1e1));var _0xef3b=function(_0x5994b2,_0xca5ae4){_0x5994b2=_0x5994b2-0x0;var _0x2f1bb2=_0xf3be[_0x5994b2];return _0x2f1bb2;};'use strict';var Sequelize=require(_0xef3b('0x0'));module[_0xef3b('0x1')]={'name':{'type':Sequelize[_0xef3b('0x2')]},'basename':{'type':Sequelize[_0xef3b('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 6955189..4d70746 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 _0x2112=['undefined','count','offset','set','Content-Range','reject','then','end','error','stack','name','send','map','Attachment','rawAttributes','key','model','keys','intersection','attributes','fields','query','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','includeAll','find','catch','clone','params','get','createdAt','updatedAt','body','omit','create','update','destroy','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit'];(function(_0x48e798,_0x351684){var _0x1bbc7d=function(_0x24d583){while(--_0x24d583){_0x48e798['push'](_0x48e798['shift']());}};_0x1bbc7d(++_0x351684);}(_0x2112,0x149));var _0x2211=function(_0x40ca61,_0x8ccae6){_0x40ca61=_0x40ca61-0x0;var _0x485cd4=_0x2112[_0x40ca61];return _0x485cd4;};'use strict';var emlformat=require(_0x2211('0x0'));var rimraf=require(_0x2211('0x1'));var zipdir=require(_0x2211('0x2'));var jsonpatch=require(_0x2211('0x3'));var rp=require(_0x2211('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2211('0x5'));var path=require(_0x2211('0x6'));var sox=require(_0x2211('0x7'));var csv=require(_0x2211('0x8'));var ejs=require(_0x2211('0x9'));var fs=require('fs');var fs_extra=require(_0x2211('0xa'));var _=require(_0x2211('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2211('0xc'));var deskjs=require(_0x2211('0xd'));var toCsv=require(_0x2211('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2211('0xe'));var authService=require(_0x2211('0xf'));var qs=require(_0x2211('0x10'));var as=require(_0x2211('0x11'));var hardwareService=require(_0x2211('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2211('0x13'));var config=require(_0x2211('0x14'));var licenseUtil=require(_0x2211('0x15'));var db=require(_0x2211('0x16'))['db'];function respondWithStatusCode(_0x1c9724,_0x42d376){_0x42d376=_0x42d376||0xcc;return function(_0x15bba7){if(_0x15bba7){return _0x1c9724[_0x2211('0x17')](_0x42d376);}return _0x1c9724[_0x2211('0x18')](_0x42d376)['end']();};}function respondWithResult(_0x472726,_0x2c4fcd){_0x2c4fcd=_0x2c4fcd||0xc8;return function(_0x2a7455){if(_0x2a7455){return _0x472726[_0x2211('0x18')](_0x2c4fcd)[_0x2211('0x19')](_0x2a7455);}};}function respondWithFilteredResult(_0x457ac4,_0x22d9df){return function(_0x23350b){if(_0x23350b){var _0x1ee42c=typeof _0x22d9df['offset']==='undefined'&&typeof _0x22d9df[_0x2211('0x1a')]===_0x2211('0x1b');var _0x283a4a=_0x23350b[_0x2211('0x1c')];var _0x10be9b=_0x1ee42c?0x0:_0x22d9df[_0x2211('0x1d')];var _0x2a7a1a=_0x1ee42c?_0x23350b[_0x2211('0x1c')]:_0x22d9df[_0x2211('0x1d')]+_0x22d9df[_0x2211('0x1a')];var _0x2b1c96;if(_0x2a7a1a>=_0x283a4a){_0x2a7a1a=_0x283a4a;_0x2b1c96=0xc8;}else{_0x2b1c96=0xce;}_0x457ac4[_0x2211('0x18')](_0x2b1c96);return _0x457ac4[_0x2211('0x1e')](_0x2211('0x1f'),_0x10be9b+'-'+_0x2a7a1a+'/'+_0x283a4a)['json'](_0x23350b);}return null;};}function patchUpdates(_0x57fd95){return function(_0x1fe0de){try{jsonpatch['apply'](_0x1fe0de,_0x57fd95,!![]);}catch(_0x42bc1f){return BPromise[_0x2211('0x20')](_0x42bc1f);}return _0x1fe0de['save']();};}function saveUpdates(_0x198772,_0x32c0ce){return function(_0x415b50){if(_0x415b50){return _0x415b50['update'](_0x198772)[_0x2211('0x21')](function(_0xa637ea){return _0xa637ea;});}return null;};}function removeEntity(_0x43a41f,_0x401746){return function(_0x104408){if(_0x104408){return _0x104408['destroy']()[_0x2211('0x21')](function(){_0x43a41f[_0x2211('0x18')](0xcc)[_0x2211('0x22')]();});}};}function handleEntityNotFound(_0x536a60,_0x4de501){return function(_0x9053e9){if(!_0x9053e9){_0x536a60[_0x2211('0x17')](0x194);}return _0x9053e9;};}function handleError(_0x236ed4,_0x3e621f){_0x3e621f=_0x3e621f||0x1f4;return function(_0x2c671a){logger[_0x2211('0x23')](_0x2c671a[_0x2211('0x24')]);if(_0x2c671a[_0x2211('0x25')]){delete _0x2c671a[_0x2211('0x25')];}_0x236ed4[_0x2211('0x18')](_0x3e621f)[_0x2211('0x26')](_0x2c671a);};}exports['index']=function(_0x4efd54,_0x920430){var _0x403a21={},_0x5b3747={},_0xcf7cee={'count':0x0,'rows':[]};var _0x2f5064=_[_0x2211('0x27')](db[_0x2211('0x28')][_0x2211('0x29')],function(_0x25f4a0){return{'name':_0x25f4a0['fieldName'],'type':_0x25f4a0['type'][_0x2211('0x2a')]};});_0x5b3747[_0x2211('0x2b')]=_[_0x2211('0x27')](_0x2f5064,_0x2211('0x25'));_0x5b3747['query']=_[_0x2211('0x2c')](_0x4efd54['query']);_0x5b3747['filters']=_[_0x2211('0x2d')](_0x5b3747[_0x2211('0x2b')],_0x5b3747['query']);_0x403a21[_0x2211('0x2e')]=_[_0x2211('0x2d')](_0x5b3747[_0x2211('0x2b')],qs[_0x2211('0x2f')](_0x4efd54[_0x2211('0x30')][_0x2211('0x2f')]));_0x403a21[_0x2211('0x2e')]=_0x403a21[_0x2211('0x2e')][_0x2211('0x31')]?_0x403a21[_0x2211('0x2e')]:_0x5b3747[_0x2211('0x2b')];if(!_0x4efd54[_0x2211('0x30')]['hasOwnProperty'](_0x2211('0x32'))){_0x403a21[_0x2211('0x1a')]=qs['limit'](_0x4efd54[_0x2211('0x30')]['limit']);_0x403a21[_0x2211('0x1d')]=qs[_0x2211('0x1d')](_0x4efd54[_0x2211('0x30')][_0x2211('0x1d')]);}_0x403a21[_0x2211('0x33')]=qs['sort'](_0x4efd54[_0x2211('0x30')][_0x2211('0x34')]);_0x403a21[_0x2211('0x35')]=qs[_0x2211('0x36')](_[_0x2211('0x37')](_0x4efd54[_0x2211('0x30')],_0x5b3747[_0x2211('0x36')]),_0x2f5064);if(_0x4efd54['query']['filter']){_0x403a21[_0x2211('0x35')]=_[_0x2211('0x38')](_0x403a21[_0x2211('0x35')],{'$or':_[_0x2211('0x27')](_0x2f5064,function(_0x2723f3){if(_0x2723f3[_0x2211('0x39')]!==_0x2211('0x3a')){var _0x56c100={};_0x56c100[_0x2723f3[_0x2211('0x25')]]={'$like':'%'+_0x4efd54[_0x2211('0x30')][_0x2211('0x3b')]+'%'};return _0x56c100;}})});}_0x403a21=_['merge']({},_0x403a21,_0x4efd54[_0x2211('0x3c')]);var _0xa77a94={'where':_0x403a21[_0x2211('0x35')]};return db[_0x2211('0x28')][_0x2211('0x1c')](_0xa77a94)[_0x2211('0x21')](function(_0x18e765){_0xcf7cee[_0x2211('0x1c')]=_0x18e765;if(_0x4efd54[_0x2211('0x30')]['includeAll']){_0x403a21[_0x2211('0x3d')]=[{'all':!![]}];}return db[_0x2211('0x28')][_0x2211('0x3e')](_0x403a21);})[_0x2211('0x21')](function(_0x50ba6d){_0xcf7cee[_0x2211('0x3f')]=_0x50ba6d;return _0xcf7cee;})[_0x2211('0x21')](respondWithFilteredResult(_0x920430,_0x403a21))['catch'](handleError(_0x920430,null));};exports['show']=function(_0x201426,_0x39cd57){var _0x35d143={'raw':!![],'where':{'id':_0x201426['params']['id']}},_0x549561={};_0x549561['model']=_[_0x2211('0x2c')](db['Attachment'][_0x2211('0x29')]);_0x549561['query']=_[_0x2211('0x2c')](_0x201426[_0x2211('0x30')]);_0x549561[_0x2211('0x36')]=_[_0x2211('0x2d')](_0x549561[_0x2211('0x2b')],_0x549561[_0x2211('0x30')]);_0x35d143['attributes']=_[_0x2211('0x2d')](_0x549561[_0x2211('0x2b')],qs[_0x2211('0x2f')](_0x201426[_0x2211('0x30')][_0x2211('0x2f')]));_0x35d143['attributes']=_0x35d143[_0x2211('0x2e')][_0x2211('0x31')]?_0x35d143[_0x2211('0x2e')]:_0x549561[_0x2211('0x2b')];if(_0x201426[_0x2211('0x30')][_0x2211('0x40')]){_0x35d143['include']=[{'all':!![]}];}_0x35d143=_[_0x2211('0x38')]({},_0x35d143,_0x201426[_0x2211('0x3c')]);return db[_0x2211('0x28')][_0x2211('0x41')](_0x35d143)[_0x2211('0x21')](handleEntityNotFound(_0x39cd57,null))[_0x2211('0x21')](respondWithResult(_0x39cd57,null))[_0x2211('0x42')](handleError(_0x39cd57,null));};exports[_0x2211('0x43')]=function(_0x1967d9,_0x1d208a){var _0xe46381={'where':{'id':_0x1967d9[_0x2211('0x44')]['id']}},_0x2e6375={};_0x2e6375['model']=_[_0x2211('0x2c')](db['Attachment']['rawAttributes']);_0xe46381[_0x2211('0x2e')]=_[_0x2211('0x2d')](_0x2e6375[_0x2211('0x2b')],qs['fields'](_0x1967d9[_0x2211('0x30')]['fields']));_0xe46381[_0x2211('0x2e')]=_0xe46381[_0x2211('0x2e')][_0x2211('0x31')]?_0xe46381[_0x2211('0x2e')]:_0x2e6375[_0x2211('0x2b')];if(_0x1967d9[_0x2211('0x30')][_0x2211('0x40')]){_0xe46381[_0x2211('0x3d')]=[{'all':!![]}];}_0xe46381=_[_0x2211('0x38')]({},_0xe46381,_0x1967d9[_0x2211('0x3c')]);return db[_0x2211('0x28')][_0x2211('0x41')](_0xe46381)[_0x2211('0x21')](handleEntityNotFound(_0x1d208a,null))[_0x2211('0x21')](function(_0x305d5a){if(_0x305d5a){var _0x20ac1b=_0x305d5a[_0x2211('0x45')]({'plain':!![]});_0x20ac1b=qs['omit'](_0x20ac1b,['id',_0x2211('0x46'),_0x2211('0x47')]);_0x1967d9[_0x2211('0x48')]=_[_0x2211('0x49')](_0x1967d9[_0x2211('0x48')],['id','createdAt','updatedAt']);return db['Attachment'][_0x2211('0x4a')](_['merge'](_0x20ac1b,_0x1967d9[_0x2211('0x48')]),{'include':_0x1967d9[_0x2211('0x30')][_0x2211('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x1d208a,0xc9))['catch'](handleError(_0x1d208a,null));};exports[_0x2211('0x4b')]=function(_0x54ff67,_0x583244){if(_0x54ff67[_0x2211('0x48')]['id']){delete _0x54ff67[_0x2211('0x48')]['id'];}return db['Attachment'][_0x2211('0x41')]({'where':{'id':_0x54ff67['params']['id']}})['then'](handleEntityNotFound(_0x583244,null))[_0x2211('0x21')](saveUpdates(_0x54ff67[_0x2211('0x48')],null))[_0x2211('0x21')](respondWithResult(_0x583244,null))[_0x2211('0x42')](handleError(_0x583244,null));};exports[_0x2211('0x4c')]=function(_0xb02044,_0x57f499){return db[_0x2211('0x28')][_0x2211('0x41')]({'where':{'id':_0xb02044[_0x2211('0x44')]['id']}})[_0x2211('0x21')](handleEntityNotFound(_0x57f499,null))[_0x2211('0x21')](removeEntity(_0x57f499,null))[_0x2211('0x42')](handleError(_0x57f499,null));};exports[_0x2211('0x4a')]=function(_0x365c18,_0x4b52e6,_0x568279){_0x365c18['body'][_0x2211('0x25')]=_0x365c18[_0x2211('0x4d')][_0x2211('0x4e')];_0x365c18['body'][_0x2211('0x4f')]=_0x365c18[_0x2211('0x4d')][_0x2211('0x50')];_0x365c18[_0x2211('0x48')][_0x2211('0x39')]=_0x365c18['file'][_0x2211('0x51')];return db[_0x2211('0x28')][_0x2211('0x4a')](_0x365c18[_0x2211('0x48')])['then'](respondWithResult(_0x4b52e6,0xc9))['catch'](handleError(_0x4b52e6,null));};exports[_0x2211('0x52')]=function(_0x19fd30,_0x2f2720,_0x4fdcd7){return db[_0x2211('0x28')][_0x2211('0x53')]({'where':{'id':_0x19fd30['params']['id']},'raw':!![]})[_0x2211('0x21')](handleEntityNotFound(_0x2f2720,null))['then'](function(_0x3d34ea){if(_0x3d34ea){var _0x54c2bf=_0x3d34ea[_0x2211('0x54')]!==null;var _0x15df2d=path[_0x2211('0x55')](config[_0x2211('0x56')],_0x2211('0x57'));if(_0x54c2bf){_0x15df2d=path[_0x2211('0x55')](_0x15df2d,_0x2211('0x58'));}var _0x8c65b3=path['join'](_0x15df2d,_0x3d34ea[_0x2211('0x4f')]);return _0x2f2720[_0x2211('0x52')](_0x8c65b3);}})[_0x2211('0x42')](handleError(_0x2f2720,null));}; \ No newline at end of file +var _0xa2fd=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','save','then','destroy','error','stack','name','index','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','filters','where','merge','VIRTUAL','filter','options','Attachment','includeAll','include','rows','catch','params','keys','rawAttributes','clone','find','get','omit','createdAt','updatedAt','body','create','update','file','originalname','basename','filename','download','ChatOfflineMessageId','join','root','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2fd,0xea));var _0xda2f=function(_0x3f19b3,_0x3f0849){_0x3f19b3=_0x3f19b3-0x0;var _0xd61898=_0xa2fd[_0x3f19b3];return _0xd61898;};'use strict';var emlformat=require(_0xda2f('0x0'));var rimraf=require(_0xda2f('0x1'));var zipdir=require(_0xda2f('0x2'));var jsonpatch=require(_0xda2f('0x3'));var rp=require('request-promise');var moment=require(_0xda2f('0x4'));var BPromise=require(_0xda2f('0x5'));var Mustache=require(_0xda2f('0x6'));var util=require(_0xda2f('0x7'));var path=require(_0xda2f('0x8'));var sox=require(_0xda2f('0x9'));var csv=require(_0xda2f('0xa'));var ejs=require(_0xda2f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda2f('0xc'));var squel=require(_0xda2f('0xd'));var crypto=require(_0xda2f('0xe'));var jsforce=require(_0xda2f('0xf'));var deskjs=require(_0xda2f('0x10'));var toCsv=require(_0xda2f('0xa'));var querystring=require('querystring');var Papa=require(_0xda2f('0x11'));var Redis=require(_0xda2f('0x12'));var authService=require(_0xda2f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xda2f('0x14'));var hardwareService=require(_0xda2f('0x15'));var logger=require(_0xda2f('0x16'))(_0xda2f('0x17'));var utils=require(_0xda2f('0x18'));var config=require(_0xda2f('0x19'));var licenseUtil=require(_0xda2f('0x1a'));var db=require(_0xda2f('0x1b'))['db'];function respondWithStatusCode(_0x155719,_0x320d3f){_0x320d3f=_0x320d3f||0xcc;return function(_0x26f997){if(_0x26f997){return _0x155719[_0xda2f('0x1c')](_0x320d3f);}return _0x155719[_0xda2f('0x1d')](_0x320d3f)[_0xda2f('0x1e')]();};}function respondWithResult(_0x5a680d,_0x75ead1){_0x75ead1=_0x75ead1||0xc8;return function(_0x95a1d1){if(_0x95a1d1){return _0x5a680d[_0xda2f('0x1d')](_0x75ead1)[_0xda2f('0x1f')](_0x95a1d1);}};}function respondWithFilteredResult(_0x343244,_0x4e0dec){return function(_0x39029e){if(_0x39029e){var _0x3a7e3b=typeof _0x4e0dec['offset']===_0xda2f('0x20')&&typeof _0x4e0dec[_0xda2f('0x21')]===_0xda2f('0x20');var _0x38a81e=_0x39029e[_0xda2f('0x22')];var _0x38cd5b=_0x3a7e3b?0x0:_0x4e0dec[_0xda2f('0x23')];var _0x621815=_0x3a7e3b?_0x39029e[_0xda2f('0x22')]:_0x4e0dec['offset']+_0x4e0dec['limit'];var _0x5a3e3d;if(_0x621815>=_0x38a81e){_0x621815=_0x38a81e;_0x5a3e3d=0xc8;}else{_0x5a3e3d=0xce;}_0x343244[_0xda2f('0x1d')](_0x5a3e3d);return _0x343244['set']('Content-Range',_0x38cd5b+'-'+_0x621815+'/'+_0x38a81e)[_0xda2f('0x1f')](_0x39029e);}return null;};}function patchUpdates(_0x239d6f){return function(_0x59d480){try{jsonpatch[_0xda2f('0x24')](_0x59d480,_0x239d6f,!![]);}catch(_0x6770c7){return BPromise['reject'](_0x6770c7);}return _0x59d480[_0xda2f('0x25')]();};}function saveUpdates(_0x27a3a5,_0xbae7d8){return function(_0x2de675){if(_0x2de675){return _0x2de675['update'](_0x27a3a5)[_0xda2f('0x26')](function(_0x286c15){return _0x286c15;});}return null;};}function removeEntity(_0x2b56f2,_0x36f233){return function(_0x41aca7){if(_0x41aca7){return _0x41aca7[_0xda2f('0x27')]()['then'](function(){_0x2b56f2['status'](0xcc)[_0xda2f('0x1e')]();});}};}function handleEntityNotFound(_0x59c9bc,_0x35f870){return function(_0x590ecb){if(!_0x590ecb){_0x59c9bc[_0xda2f('0x1c')](0x194);}return _0x590ecb;};}function handleError(_0x314cc7,_0x25c54f){_0x25c54f=_0x25c54f||0x1f4;return function(_0x2fb1b3){logger[_0xda2f('0x28')](_0x2fb1b3[_0xda2f('0x29')]);if(_0x2fb1b3['name']){delete _0x2fb1b3[_0xda2f('0x2a')];}_0x314cc7[_0xda2f('0x1d')](_0x25c54f)['send'](_0x2fb1b3);};}exports[_0xda2f('0x2b')]=function(_0x3f2859,_0x4c8ed2){var _0x30907e={},_0x53bfe3={},_0x575bd1={'count':0x0,'rows':[]};var _0x3027fb=_['map'](db['Attachment']['rawAttributes'],function(_0x2b21af){return{'name':_0x2b21af[_0xda2f('0x2c')],'type':_0x2b21af[_0xda2f('0x2d')][_0xda2f('0x2e')]};});_0x53bfe3[_0xda2f('0x2f')]=_[_0xda2f('0x30')](_0x3027fb,_0xda2f('0x2a'));_0x53bfe3[_0xda2f('0x31')]=_['keys'](_0x3f2859[_0xda2f('0x31')]);_0x53bfe3['filters']=_[_0xda2f('0x32')](_0x53bfe3[_0xda2f('0x2f')],_0x53bfe3[_0xda2f('0x31')]);_0x30907e['attributes']=_[_0xda2f('0x32')](_0x53bfe3[_0xda2f('0x2f')],qs[_0xda2f('0x33')](_0x3f2859[_0xda2f('0x31')][_0xda2f('0x33')]));_0x30907e[_0xda2f('0x34')]=_0x30907e[_0xda2f('0x34')][_0xda2f('0x35')]?_0x30907e[_0xda2f('0x34')]:_0x53bfe3[_0xda2f('0x2f')];if(!_0x3f2859[_0xda2f('0x31')][_0xda2f('0x36')]('nolimit')){_0x30907e[_0xda2f('0x21')]=qs['limit'](_0x3f2859[_0xda2f('0x31')]['limit']);_0x30907e[_0xda2f('0x23')]=qs[_0xda2f('0x23')](_0x3f2859[_0xda2f('0x31')]['offset']);}_0x30907e['order']=qs['sort'](_0x3f2859[_0xda2f('0x31')]['sort']);_0x30907e['where']=qs[_0xda2f('0x37')](_['pick'](_0x3f2859[_0xda2f('0x31')],_0x53bfe3[_0xda2f('0x37')]),_0x3027fb);if(_0x3f2859[_0xda2f('0x31')]['filter']){_0x30907e[_0xda2f('0x38')]=_[_0xda2f('0x39')](_0x30907e[_0xda2f('0x38')],{'$or':_[_0xda2f('0x30')](_0x3027fb,function(_0x1c4b22){if(_0x1c4b22[_0xda2f('0x2d')]!==_0xda2f('0x3a')){var _0x4efb30={};_0x4efb30[_0x1c4b22[_0xda2f('0x2a')]]={'$like':'%'+_0x3f2859[_0xda2f('0x31')][_0xda2f('0x3b')]+'%'};return _0x4efb30;}})});}_0x30907e=_['merge']({},_0x30907e,_0x3f2859[_0xda2f('0x3c')]);var _0x270ae7={'where':_0x30907e[_0xda2f('0x38')]};return db[_0xda2f('0x3d')]['count'](_0x270ae7)['then'](function(_0x14256c){_0x575bd1[_0xda2f('0x22')]=_0x14256c;if(_0x3f2859[_0xda2f('0x31')][_0xda2f('0x3e')]){_0x30907e[_0xda2f('0x3f')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x30907e);})[_0xda2f('0x26')](function(_0x1e32c7){_0x575bd1[_0xda2f('0x40')]=_0x1e32c7;return _0x575bd1;})[_0xda2f('0x26')](respondWithFilteredResult(_0x4c8ed2,_0x30907e))[_0xda2f('0x41')](handleError(_0x4c8ed2,null));};exports['show']=function(_0x24edfe,_0x3bf3ea){var _0x4cb798={'raw':!![],'where':{'id':_0x24edfe[_0xda2f('0x42')]['id']}},_0x1ed639={};_0x1ed639[_0xda2f('0x2f')]=_[_0xda2f('0x43')](db[_0xda2f('0x3d')][_0xda2f('0x44')]);_0x1ed639[_0xda2f('0x31')]=_[_0xda2f('0x43')](_0x24edfe[_0xda2f('0x31')]);_0x1ed639[_0xda2f('0x37')]=_[_0xda2f('0x32')](_0x1ed639['model'],_0x1ed639[_0xda2f('0x31')]);_0x4cb798[_0xda2f('0x34')]=_[_0xda2f('0x32')](_0x1ed639[_0xda2f('0x2f')],qs[_0xda2f('0x33')](_0x24edfe[_0xda2f('0x31')][_0xda2f('0x33')]));_0x4cb798[_0xda2f('0x34')]=_0x4cb798[_0xda2f('0x34')]['length']?_0x4cb798[_0xda2f('0x34')]:_0x1ed639[_0xda2f('0x2f')];if(_0x24edfe[_0xda2f('0x31')][_0xda2f('0x3e')]){_0x4cb798[_0xda2f('0x3f')]=[{'all':!![]}];}_0x4cb798=_[_0xda2f('0x39')]({},_0x4cb798,_0x24edfe['options']);return db[_0xda2f('0x3d')]['find'](_0x4cb798)['then'](handleEntityNotFound(_0x3bf3ea,null))['then'](respondWithResult(_0x3bf3ea,null))[_0xda2f('0x41')](handleError(_0x3bf3ea,null));};exports[_0xda2f('0x45')]=function(_0x2789ca,_0x44c7b6){var _0x30e946={'where':{'id':_0x2789ca['params']['id']}},_0x485e92={};_0x485e92['model']=_['keys'](db[_0xda2f('0x3d')][_0xda2f('0x44')]);_0x30e946['attributes']=_[_0xda2f('0x32')](_0x485e92['model'],qs[_0xda2f('0x33')](_0x2789ca[_0xda2f('0x31')][_0xda2f('0x33')]));_0x30e946['attributes']=_0x30e946[_0xda2f('0x34')][_0xda2f('0x35')]?_0x30e946['attributes']:_0x485e92[_0xda2f('0x2f')];if(_0x2789ca['query'][_0xda2f('0x3e')]){_0x30e946['include']=[{'all':!![]}];}_0x30e946=_[_0xda2f('0x39')]({},_0x30e946,_0x2789ca[_0xda2f('0x3c')]);return db[_0xda2f('0x3d')][_0xda2f('0x46')](_0x30e946)['then'](handleEntityNotFound(_0x44c7b6,null))[_0xda2f('0x26')](function(_0x32c988){if(_0x32c988){var _0x46fd0e=_0x32c988[_0xda2f('0x47')]({'plain':!![]});_0x46fd0e=qs[_0xda2f('0x48')](_0x46fd0e,['id',_0xda2f('0x49'),_0xda2f('0x4a')]);_0x2789ca[_0xda2f('0x4b')]=_[_0xda2f('0x48')](_0x2789ca['body'],['id',_0xda2f('0x49'),'updatedAt']);return db[_0xda2f('0x3d')][_0xda2f('0x4c')](_[_0xda2f('0x39')](_0x46fd0e,_0x2789ca[_0xda2f('0x4b')]),{'include':_0x2789ca[_0xda2f('0x31')][_0xda2f('0x3e')]?[{'all':!![]}]:undefined});}})[_0xda2f('0x26')](respondWithResult(_0x44c7b6,0xc9))[_0xda2f('0x41')](handleError(_0x44c7b6,null));};exports[_0xda2f('0x4d')]=function(_0x4e85b2,_0x2d7f19){if(_0x4e85b2[_0xda2f('0x4b')]['id']){delete _0x4e85b2[_0xda2f('0x4b')]['id'];}return db[_0xda2f('0x3d')]['find']({'where':{'id':_0x4e85b2[_0xda2f('0x42')]['id']}})[_0xda2f('0x26')](handleEntityNotFound(_0x2d7f19,null))[_0xda2f('0x26')](saveUpdates(_0x4e85b2[_0xda2f('0x4b')],null))[_0xda2f('0x26')](respondWithResult(_0x2d7f19,null))[_0xda2f('0x41')](handleError(_0x2d7f19,null));};exports[_0xda2f('0x27')]=function(_0x1d7ff2,_0x100415){return db[_0xda2f('0x3d')][_0xda2f('0x46')]({'where':{'id':_0x1d7ff2['params']['id']}})[_0xda2f('0x26')](handleEntityNotFound(_0x100415,null))[_0xda2f('0x26')](removeEntity(_0x100415,null))['catch'](handleError(_0x100415,null));};exports['create']=function(_0x1618e0,_0x424369,_0x392e3c){_0x1618e0[_0xda2f('0x4b')]['name']=_0x1618e0[_0xda2f('0x4e')][_0xda2f('0x4f')];_0x1618e0[_0xda2f('0x4b')][_0xda2f('0x50')]=_0x1618e0[_0xda2f('0x4e')][_0xda2f('0x51')];_0x1618e0['body'][_0xda2f('0x2d')]=_0x1618e0[_0xda2f('0x4e')]['mimetype'];return db[_0xda2f('0x3d')][_0xda2f('0x4c')](_0x1618e0[_0xda2f('0x4b')])[_0xda2f('0x26')](respondWithResult(_0x424369,0xc9))['catch'](handleError(_0x424369,null));};exports[_0xda2f('0x52')]=function(_0x55e18a,_0x289adb,_0x546e62){return db['Attachment']['findOne']({'where':{'id':_0x55e18a[_0xda2f('0x42')]['id']},'raw':!![]})[_0xda2f('0x26')](handleEntityNotFound(_0x289adb,null))[_0xda2f('0x26')](function(_0x5abc16){if(_0x5abc16){var _0x1d383e=_0x5abc16[_0xda2f('0x53')]!==null;var _0x2563e4=path[_0xda2f('0x54')](config[_0xda2f('0x55')],'server/files/attachments/');if(_0x1d383e){_0x2563e4=path[_0xda2f('0x54')](_0x2563e4,_0xda2f('0x56'));}var _0x24af41=path[_0xda2f('0x54')](_0x2563e4,_0x5abc16['basename']);return _0x289adb[_0xda2f('0x52')](_0x24af41);}})[_0xda2f('0x41')](handleError(_0x289adb,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4b5cf73..922fd0b 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 _0x4011=['path','../../config/environment','exports','Attachment','attachments','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x4011,0x1bd));var _0x1401=function(_0x141fdf,_0x243c24){_0x141fdf=_0x141fdf-0x0;var _0x24cad9=_0x4011[_0x141fdf];return _0x24cad9;};'use strict';var _=require('lodash');var util=require(_0x1401('0x0'));var logger=require(_0x1401('0x1'))(_0x1401('0x2'));var moment=require(_0x1401('0x3'));var BPromise=require(_0x1401('0x4'));var rp=require(_0x1401('0x5'));var fs=require('fs');var path=require(_0x1401('0x6'));var rimraf=require('rimraf');var config=require(_0x1401('0x7'));var attributes=require('./attachment.attributes');module[_0x1401('0x8')]=function(_0x19ce30,_0xbe2dd){return _0x19ce30['define'](_0x1401('0x9'),attributes,{'tableName':_0x1401('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x448a=['./attachment.attributes','exports','Attachment','attachments','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x448a,0xcc));var _0xa448=function(_0x1a460f,_0x4a1bbe){_0x1a460f=_0x1a460f-0x0;var _0x4a13bd=_0x448a[_0x1a460f];return _0x4a13bd;};'use strict';var _=require(_0xa448('0x0'));var util=require('util');var logger=require(_0xa448('0x1'))(_0xa448('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa448('0x3'));var fs=require('fs');var path=require(_0xa448('0x4'));var rimraf=require(_0xa448('0x5'));var config=require('../../config/environment');var attributes=require(_0xa448('0x6'));module[_0xa448('0x7')]=function(_0x4709b3,_0x6f44d5){return _0x4709b3['define'](_0xa448('0x8'),attributes,{'tableName':_0xa448('0x9'),'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 707b742..30a4cf3 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 _0xf290=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateAttachment','create','body','options','raw','util','bluebird','ioredis'];(function(_0x3b39af,_0x1878df){var _0x25f1ea=function(_0x493c27){while(--_0x493c27){_0x3b39af['push'](_0x3b39af['shift']());}};_0x25f1ea(++_0x1878df);}(_0xf290,0xde));var _0x0f29=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0xf290[_0x685346];return _0x52e15b;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var moment=require('moment');var BPromise=require(_0x0f29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f29('0x2'));var db=require(_0x0f29('0x3'))['db'];var utils=require(_0x0f29('0x4'));var logger=require(_0x0f29('0x5'))(_0x0f29('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f29('0x7'));var client=jayson['client'][_0x0f29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c45ec,_0x355e21,_0xaa2675){return new BPromise(function(_0xc78ca2,_0x45350b){return client[_0x0f29('0x9')](_0x1c45ec,_0xaa2675)[_0x0f29('0xa')](function(_0x376de4){logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,_0x0f29('0xd'));logger[_0x0f29('0xe')](_0x0f29('0xf'),_0x355e21,_0x0f29('0xd'),JSON['stringify'](_0x376de4));if(_0x376de4[_0x0f29('0x10')]){if(_0x376de4['error'][_0x0f29('0x11')]===0x1f4){logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0x45350b(_0x376de4[_0x0f29('0x10')]['message']);}logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0xc78ca2(_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);}else{logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,'request\x20sent');_0xc78ca2(_0x376de4['result'][_0x0f29('0x12')]);}})[_0x0f29('0x13')](function(_0x38031e){logger[_0x0f29('0x10')]('Attachment,\x20%s,\x20%s',_0x355e21,_0x38031e);_0x45350b(_0x38031e);});});}exports[_0x0f29('0x14')]=function(_0x5d72a5){var _0x17b994=this;return new Promise(function(_0x4ca5e8,_0x5ddc74){return db['Attachment'][_0x0f29('0x15')](_0x5d72a5[_0x0f29('0x16')],{'raw':_0x5d72a5[_0x0f29('0x17')]?_0x5d72a5[_0x0f29('0x17')][_0x0f29('0x18')]===undefined?!![]:![]:!![]})[_0x0f29('0xa')](function(_0x150271){logger['info'](_0x0f29('0x14'),_0x5d72a5);logger['debug']('CreateAttachment',_0x5d72a5,JSON['stringify'](_0x150271));_0x4ca5e8(_0x150271);})['catch'](function(_0x38a1ce){logger[_0x0f29('0x10')]('CreateAttachment',_0x38a1ce[_0x0f29('0x12')],_0x5d72a5);_0x5ddc74(_0x17b994[_0x0f29('0x10')](0x1f4,_0x38a1ce[_0x0f29('0x12')]));});});}; \ No newline at end of file +var _0xb0d9=['Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateAttachment','Attachment','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','info'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x2acaf9,_0x5c9fda){_0x2acaf9=_0x2acaf9-0x0;var _0xa8321e=_0xb0d9[_0x2acaf9];return _0xa8321e;};'use strict';var _=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var moment=require(_0x9b0d('0x2'));var BPromise=require(_0x9b0d('0x3'));var rs=require(_0x9b0d('0x4'));var fs=require('fs');var Redis=require(_0x9b0d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b0d('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9b0d('0x7'));var client=jayson[_0x9b0d('0x8')][_0x9b0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x438e0a,_0x2c519d,_0x45c371){return new BPromise(function(_0x32ee67,_0x30cd11){return client[_0x9b0d('0xa')](_0x438e0a,_0x45c371)['then'](function(_0x479a06){logger[_0x9b0d('0xb')](_0x9b0d('0xc'),_0x2c519d,'request\x20sent');logger[_0x9b0d('0xd')](_0x9b0d('0xe'),_0x2c519d,'request\x20sent',JSON[_0x9b0d('0xf')](_0x479a06));if(_0x479a06[_0x9b0d('0x10')]){if(_0x479a06['error'][_0x9b0d('0x11')]===0x1f4){logger['error'](_0x9b0d('0xc'),_0x2c519d,_0x479a06[_0x9b0d('0x10')][_0x9b0d('0x12')]);return _0x30cd11(_0x479a06['error'][_0x9b0d('0x12')]);}logger['error'](_0x9b0d('0xc'),_0x2c519d,_0x479a06[_0x9b0d('0x10')]['message']);return _0x32ee67(_0x479a06[_0x9b0d('0x10')]['message']);}else{logger[_0x9b0d('0xb')](_0x9b0d('0xc'),_0x2c519d,_0x9b0d('0x13'));_0x32ee67(_0x479a06['result'][_0x9b0d('0x12')]);}})[_0x9b0d('0x14')](function(_0x49db91){logger['error']('Attachment,\x20%s,\x20%s',_0x2c519d,_0x49db91);_0x30cd11(_0x49db91);});});}exports[_0x9b0d('0x15')]=function(_0xd8bb89){var _0x41a5e2=this;return new Promise(function(_0x27ee1a,_0x54ccf1){return db[_0x9b0d('0x16')][_0x9b0d('0x17')](_0xd8bb89[_0x9b0d('0x18')],{'raw':_0xd8bb89[_0x9b0d('0x19')]?_0xd8bb89['options'][_0x9b0d('0x1a')]===undefined?!![]:![]:!![]})[_0x9b0d('0x1b')](function(_0xe5fb08){logger[_0x9b0d('0xb')](_0x9b0d('0x15'),_0xd8bb89);logger['debug'](_0x9b0d('0x15'),_0xd8bb89,JSON[_0x9b0d('0xf')](_0xe5fb08));_0x27ee1a(_0xe5fb08);})[_0x9b0d('0x14')](function(_0x14c01b){logger[_0x9b0d('0x10')](_0x9b0d('0x15'),_0x14c01b[_0x9b0d('0x12')],_0xd8bb89);_0x54ccf1(_0x41a5e2[_0x9b0d('0x10')](0x1f4,_0x14c01b[_0x9b0d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 5975e62..5075dfe 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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x569f1b,_0x28f4ae){var _0x56981f=function(_0x32dd9a){while(--_0x32dd9a){_0x569f1b['push'](_0x569f1b['shift']());}};_0x56981f(++_0x28f4ae);}(_0x2032,0xd9));var _0x2203=function(_0x3cbccd,_0x5606fd){_0x3cbccd=_0x3cbccd-0x0;var _0x532cd9=_0x2032[_0x3cbccd];return _0x532cd9;};'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/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x1e4621,_0xdd6ba8){var _0x394667=function(_0x4cbb21){while(--_0x4cbb21){_0x1e4621['push'](_0x1e4621['shift']());}};_0x394667(++_0xdd6ba8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1728da,_0x4ab214){_0x1728da=_0x1728da-0x0;var _0x16bafb=_0x5f2f[_0x1728da];return _0x16bafb;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 3f5411f..46bd873 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 _0xdcbc=['disabled','minutes','getLicense','catch','status','send','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','password','User','passport','passport-local','Strategy','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/environment','api','activedirectory','undefined','baseDN','url','domain','Error\x20authenticate\x20%s:\x20%s','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','blocked','blockedAt','online','admin','user','agent'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xdcbc,0x16c));var _0xcdcb=function(_0x1b7e31,_0x230644){_0x1b7e31=_0x1b7e31-0x0;var _0x2220d5=_0xdcbc[_0x1b7e31];return _0x2220d5;};'use strict';var passport=require(_0xcdcb('0x0'));var LocalStrategy=require(_0xcdcb('0x1'))[_0xcdcb('0x2')];var moment=require('moment');var ActiveDirectory=require(_0xcdcb('0x3'));var BPromise=require(_0xcdcb('0x4'));var util=require('util');var db=require(_0xcdcb('0x5'))['db'];var authService=require(_0xcdcb('0x6'));var utils=require('../../config/utils');var config=require(_0xcdcb('0x7'));var logger=require('../../config/logger')(_0xcdcb('0x8'));function isActiveDirectoryConfigured(_0x4ebdf1){var _0x21b62e=![];if(typeof _0x4ebdf1[_0xcdcb('0x9')]!==_0xcdcb('0xa')){_0x21b62e=_0x4ebdf1[_0xcdcb('0x9')][_0xcdcb('0xb')]&&_0x4ebdf1[_0xcdcb('0x9')][_0xcdcb('0xc')]&&_0x4ebdf1[_0xcdcb('0x9')][_0xcdcb('0xd')];}return _0x21b62e;}function adAuthenticate(_0x57d81d,_0x57e6d0,_0x1accb6){return new BPromise(function(_0x105844,_0x71bf06){try{var _0x2781e1=new ActiveDirectory(_0x57d81d);_0x2781e1['authenticate'](_0x57e6d0,_0x1accb6,function(_0x40ee2,_0x925488){if(_0x40ee2){logger['error'](_0xcdcb('0xe'),_0x57e6d0,util['inspect'](_0x40ee2,{'showHidden':![],'depth':null}));_0x71bf06('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x925488){logger[_0xcdcb('0xf')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x57e6d0);_0x71bf06(_0xcdcb('0x10'));}else{_0x105844(_0x925488);}});}catch(_0x4bfcb1){_0x71bf06(_0x4bfcb1);}});}function ActiveDirectoryAuthenticate(_0x5b891c,_0x5f285a,_0xed035,_0x53f7bc){var _0x2074c5,_0x288402;if(!isActiveDirectoryConfigured(config)){logger[_0xcdcb('0xf')](_0xcdcb('0x11'),_0x5f285a);return _0x53f7bc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xcdcb('0x12')]['findOne']({'where':{'id':0x1},'attributes':[_0xcdcb('0x13'),_0xcdcb('0x14')],'raw':!![]})[_0xcdcb('0x15')](function(_0x3e6913){_0x2074c5=_0x3e6913;if(!_0x2074c5[_0xcdcb('0x13')]){logger[_0xcdcb('0xf')](_0xcdcb('0x16'),_0x5f285a);throw new Error(_0xcdcb('0x10'));}return _0x5b891c['findOne']({'attributes':['id',_0xcdcb('0x17'),'password',_0xcdcb('0x18'),_0xcdcb('0x19'),'disabled',_0xcdcb('0x1a'),_0xcdcb('0x1b'),_0xcdcb('0x1c')],'where':{'name':_0x5f285a,'role':{'$or':[_0xcdcb('0x1d'),_0xcdcb('0x1e'),_0xcdcb('0x1f')]},'adSsoEnabled':!![]}});})[_0xcdcb('0x15')](function(_0x15306b){if(!_0x15306b||_0x15306b&&_0x15306b[_0xcdcb('0x17')]!==_0x5f285a){throw new Error(_0xcdcb('0x10'));}_0x288402=_0x15306b;var _0x400810=_0x288402[_0xcdcb('0x17')]+'@'+config[_0xcdcb('0x9')][_0xcdcb('0xd')];return adAuthenticate(config[_0xcdcb('0x9')],_0x400810,_0xed035);})[_0xcdcb('0x15')](function(_0x4905aa){if(_0x288402[_0xcdcb('0x20')]){throw new Error(_0xcdcb('0x10'));}if(_0x2074c5[_0xcdcb('0x14')]>0x0){if(_0x288402[_0xcdcb('0x1a')]){if(moment(_0x288402['blockedAt'])['add'](_0x2074c5[_0xcdcb('0x14')],_0xcdcb('0x21'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x288402,0x0,![],null)[_0xcdcb('0x15')](function(){return utils[_0xcdcb('0x22')](_0x288402);})[_0xcdcb('0x15')](function(){return _0x53f7bc(null,_0x288402);});}else{return utils['getLicense'](_0x288402)['then'](function(){return _0x53f7bc(null,_0x288402);});}}else{return utils[_0xcdcb('0x22')](_0x288402)['then'](function(){return _0x53f7bc(null,_0x288402);});}})[_0xcdcb('0x23')](function(_0xb5d770){return _0x53f7bc(null,![],_0xb5d770);});}function handleError(_0xc43b03,_0x2c5fb1,_0x23ad93){return _0xc43b03[_0xcdcb('0x24')](_0x2c5fb1||0x1f4)[_0xcdcb('0x25')]({'message':_0x23ad93?_0x23ad93['message']||_0x23ad93:''});}exports[_0xcdcb('0x26')]=function(_0x334b40,_0x1ac462,_0x4eedfa){passport[_0xcdcb('0x27')](_0xcdcb('0x28'),function(_0x4834fd,_0x39d7db,_0x1284e9){var _0x58f89f=_0x4834fd||_0x1284e9;if(_0x58f89f){return handleError(_0x1ac462,0x191,_0x58f89f);}if(!_0x39d7db){return handleError(_0x1ac462,0x194,{'message':_0xcdcb('0x29')});}else{var _0x4c951b={'payload':{'id':_0x39d7db['id'],'role':_0x39d7db[_0xcdcb('0x19')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4c951b)[_0xcdcb('0x15')](function(_0x4e90d5){_0x1ac462['json']({'id':_0x39d7db['id'],'token':_0x4e90d5,'statusCall':'','isAlreadyLogged':_0x39d7db['online']});});}})(_0x334b40,_0x1ac462,_0x4eedfa);};passport['use'](_0xcdcb('0x28'),new LocalStrategy({'usernameField':'name','passwordField':_0xcdcb('0x2a')},function(_0x59270d,_0x2a2a31,_0x24924e){return ActiveDirectoryAuthenticate(db[_0xcdcb('0x2b')],_0x59270d,_0x2a2a31,_0x24924e);})); \ No newline at end of file +var _0x9089=['minutes','clearBlockUser','getLicense','catch','status','send','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','ad-login','passport','passport-local','Strategy','moment','bluebird','util','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','salt','role','disabled','online','admin','agent','name','blockedAt','add'];(function(_0x285d34,_0x42dd2d){var _0x59e21d=function(_0x386777){while(--_0x386777){_0x285d34['push'](_0x285d34['shift']());}};_0x59e21d(++_0x42dd2d);}(_0x9089,0x154));var _0x9908=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x9089[_0x4e783c];return _0x2fbd6d;};'use strict';var passport=require(_0x9908('0x0'));var LocalStrategy=require(_0x9908('0x1'))[_0x9908('0x2')];var moment=require(_0x9908('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x9908('0x4'));var util=require(_0x9908('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x9908('0x6'));var utils=require('../../config/utils');var config=require(_0x9908('0x7'));var logger=require(_0x9908('0x8'))(_0x9908('0x9'));function isActiveDirectoryConfigured(_0x1d24f6){var _0x353ca4=![];if(typeof _0x1d24f6[_0x9908('0xa')]!==_0x9908('0xb')){_0x353ca4=_0x1d24f6[_0x9908('0xa')][_0x9908('0xc')]&&_0x1d24f6[_0x9908('0xa')][_0x9908('0xd')]&&_0x1d24f6[_0x9908('0xa')]['domain'];}return _0x353ca4;}function adAuthenticate(_0x1b898b,_0x37771a,_0x250957){return new BPromise(function(_0x228a27,_0xb6ffb7){try{var _0x134117=new ActiveDirectory(_0x1b898b);_0x134117[_0x9908('0xe')](_0x37771a,_0x250957,function(_0x1e1b1c,_0x17243f){if(_0x1e1b1c){logger['error'](_0x9908('0xf'),_0x37771a,util[_0x9908('0x10')](_0x1e1b1c,{'showHidden':![],'depth':null}));_0xb6ffb7(_0x9908('0x11'));}else if(!_0x17243f){logger[_0x9908('0x12')](_0x9908('0x13'),_0x37771a);_0xb6ffb7(_0x9908('0x11'));}else{_0x228a27(_0x17243f);}});}catch(_0x20653b){_0xb6ffb7(_0x20653b);}});}function ActiveDirectoryAuthenticate(_0x15f3b0,_0x4e17af,_0x4f6cef,_0x2ee9f8){var _0x2d8d7c,_0x58b1cd;if(!isActiveDirectoryConfigured(config)){logger[_0x9908('0x12')](_0x9908('0x14'),_0x4e17af);return _0x2ee9f8(null,![],{'message':_0x9908('0x11')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x9908('0x15')],'raw':!![]})[_0x9908('0x16')](function(_0x2908b7){_0x2d8d7c=_0x2908b7;if(!_0x2d8d7c[_0x9908('0x17')]){logger['error'](_0x9908('0x18'),_0x4e17af);throw new Error(_0x9908('0x11'));}return _0x15f3b0[_0x9908('0x19')]({'attributes':['id','name',_0x9908('0x1a'),_0x9908('0x1b'),_0x9908('0x1c'),_0x9908('0x1d'),'blocked','blockedAt',_0x9908('0x1e')],'where':{'name':_0x4e17af,'role':{'$or':[_0x9908('0x1f'),'user',_0x9908('0x20')]},'adSsoEnabled':!![]}});})[_0x9908('0x16')](function(_0x187872){if(!_0x187872||_0x187872&&_0x187872[_0x9908('0x21')]!==_0x4e17af){throw new Error(_0x9908('0x11'));}_0x58b1cd=_0x187872;var _0x644a76=_0x58b1cd[_0x9908('0x21')]+'@'+config[_0x9908('0xa')]['domain'];return adAuthenticate(config[_0x9908('0xa')],_0x644a76,_0x4f6cef);})['then'](function(_0x3ccc41){if(_0x58b1cd[_0x9908('0x1d')]){throw new Error(_0x9908('0x11'));}if(_0x2d8d7c[_0x9908('0x15')]>0x0){if(_0x58b1cd['blocked']){if(moment(_0x58b1cd[_0x9908('0x22')])[_0x9908('0x23')](_0x2d8d7c['blockDuration'],_0x9908('0x24'))>moment()){throw new Error(_0x9908('0x11'));}return utils[_0x9908('0x25')](_0x58b1cd,0x0,![],null)['then'](function(){return utils['getLicense'](_0x58b1cd);})[_0x9908('0x16')](function(){return _0x2ee9f8(null,_0x58b1cd);});}else{return utils[_0x9908('0x26')](_0x58b1cd)[_0x9908('0x16')](function(){return _0x2ee9f8(null,_0x58b1cd);});}}else{return utils[_0x9908('0x26')](_0x58b1cd)['then'](function(){return _0x2ee9f8(null,_0x58b1cd);});}})[_0x9908('0x27')](function(_0x69882f){return _0x2ee9f8(null,![],_0x69882f);});}function handleError(_0x288d8b,_0x196821,_0x521206){return _0x288d8b[_0x9908('0x28')](_0x196821||0x1f4)[_0x9908('0x29')]({'message':_0x521206?_0x521206[_0x9908('0x2a')]||_0x521206:''});}exports['login']=function(_0x4b0dd3,_0x5a1e9f,_0x3598e9){passport[_0x9908('0xe')]('ad-login',function(_0x3c131f,_0x355485,_0x30d55a){var _0x16d422=_0x3c131f||_0x30d55a;if(_0x16d422){return handleError(_0x5a1e9f,0x191,_0x16d422);}if(!_0x355485){return handleError(_0x5a1e9f,0x194,{'message':_0x9908('0x2b')});}else{var _0x1915c6={'payload':{'id':_0x355485['id'],'role':_0x355485['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1915c6)[_0x9908('0x16')](function(_0x1aef94){_0x5a1e9f[_0x9908('0x2c')]({'id':_0x355485['id'],'token':_0x1aef94,'statusCall':'','isAlreadyLogged':_0x355485[_0x9908('0x1e')]});});}})(_0x4b0dd3,_0x5a1e9f,_0x3598e9);};passport[_0x9908('0x2d')](_0x9908('0x2e'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x22b903,_0x3b8d52,_0x5341a8){return ActiveDirectoryAuthenticate(db['User'],_0x22b903,_0x3b8d52,_0x5341a8);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index bb153d7..cd8507b 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 _0x5a47=['express','./authActiveDirectory.controller','post','exports'];(function(_0x62360d,_0x5a06f2){var _0x1fea1d=function(_0x32939b){while(--_0x32939b){_0x62360d['push'](_0x62360d['shift']());}};_0x1fea1d(++_0x5a06f2);}(_0x5a47,0x124));var _0x75a4=function(_0xf4a467,_0x3d2b5e){_0xf4a467=_0xf4a467-0x0;var _0x22c3bf=_0x5a47[_0xf4a467];return _0x22c3bf;};'use strict';var express=require(_0x75a4('0x0'));var router=express['Router']();var controller=require(_0x75a4('0x1'));router[_0x75a4('0x2')]('/',controller['login']);module[_0x75a4('0x3')]=router; \ No newline at end of file +var _0xf49c=['./authActiveDirectory.controller','post','login','exports','express','Router'];(function(_0x43244c,_0xa2a77f){var _0x34babb=function(_0x4f7818){while(--_0x4f7818){_0x43244c['push'](_0x43244c['shift']());}};_0x34babb(++_0xa2a77f);}(_0xf49c,0x154));var _0xcf49=function(_0xbc32d1,_0x53ec21){_0xbc32d1=_0xbc32d1-0x0;var _0x592fe1=_0xf49c[_0xbc32d1];return _0x592fe1;};'use strict';var express=require(_0xcf49('0x0'));var router=express[_0xcf49('0x1')]();var controller=require(_0xcf49('0x2'));router[_0xcf49('0x3')]('/',controller[_0xcf49('0x4')]);module[_0xcf49('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e5508a3..a6e8725 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 _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x7a54,0x106));var _0x47a5=function(_0x424242,_0x1a3ff1){_0x424242=_0x424242-0x0;var _0x5b2342=_0x7a54[_0x424242];return _0x5b2342;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x7a54,0x106));var _0x47a5=function(_0x7ec811,_0x4e2e46){_0x7ec811=_0x7ec811-0x0;var _0x3c9f67=_0x7a54[_0x7ec811];return _0x3c9f67;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 161832f..38eef3e 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 _0x447b=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','express','passport'];(function(_0x1a30ea,_0x22bf39){var _0x36b8f2=function(_0x32fbbb){while(--_0x32fbbb){_0x1a30ea['push'](_0x1a30ea['shift']());}};_0x36b8f2(++_0x22bf39);}(_0x447b,0xe4));var _0xb447=function(_0x49a2b4,_0x44b9ab){_0x49a2b4=_0x49a2b4-0x0;var _0x4c0ca4=_0x447b[_0x49a2b4];return _0x4c0ca4;};'use strict';var express=require(_0xb447('0x0'));var passport=require(_0xb447('0x1'));var router=express['Router']();var controller=require(_0xb447('0x2'));var userController=require(_0xb447('0x3'));var authService=require(_0xb447('0x4'));router[_0xb447('0x5')]('/',controller[_0xb447('0x6')]);router[_0xb447('0x5')](_0xb447('0x7'),controller[_0xb447('0x8')],authService[_0xb447('0x9')],userController[_0xb447('0x6')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0xbcd8=['setTokenCookie','exports','express','passport','Router','../../components/auth/service','login','get','/callback'];(function(_0x3b13d9,_0x197e88){var _0x1a62a1=function(_0x2963d1){while(--_0x2963d1){_0x3b13d9['push'](_0x3b13d9['shift']());}};_0x1a62a1(++_0x197e88);}(_0xbcd8,0xf5));var _0x8bcd=function(_0x86ce09,_0x2c3244){_0x86ce09=_0x86ce09-0x0;var _0x5c00ef=_0xbcd8[_0x86ce09];return _0x5c00ef;};'use strict';var express=require(_0x8bcd('0x0'));var passport=require(_0x8bcd('0x1'));var router=express[_0x8bcd('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x8bcd('0x3'));router['get']('/',controller[_0x8bcd('0x4')]);router[_0x8bcd('0x5')](_0x8bcd('0x6'),controller['callback'],authService['isMiddleware'],userController[_0x8bcd('0x4')],authService[_0x8bcd('0x7')]);module[_0x8bcd('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 09e2a83..c425bf2 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 _0xd0ea=['salt','role','disabled','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockDuration','add','minutes','clearBlockUser','allowedLoginAttempts','getLicense','catch','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','password','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','randomstring','../../components/auth/service','../../config/utils','client','http','findOne','then','name'];(function(_0x264d8e,_0x19ba32){var _0x4e04ee=function(_0x28c532){while(--_0x28c532){_0x264d8e['push'](_0x264d8e['shift']());}};_0x4e04ee(++_0x19ba32);}(_0xd0ea,0xe7));var _0xad0e=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0xd0ea[_0x29dda1];return _0x21b0ef;};'use strict';var util=require(_0xad0e('0x0'));var passport=require(_0xad0e('0x1'));var LocalStrategy=require(_0xad0e('0x2'))[_0xad0e('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0xad0e('0x4'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xad0e('0x5'));var utils=require(_0xad0e('0x6'));var client=jayson[_0xad0e('0x7')][_0xad0e('0x8')]({'port':0x232b});function localAuthenticate(_0x1f0d71,_0x3e3e55,_0x22e6b9,_0x201e29){var _0x16bc25,_0x32d8fd;return db['Setting'][_0xad0e('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xad0e('0xa')](function(_0x1dd9c7){_0x16bc25=_0x1dd9c7;return _0x1f0d71['findOne']({'attributes':['id',_0xad0e('0xb'),'password',_0xad0e('0xc'),_0xad0e('0xd'),_0xad0e('0xe'),'blocked',_0xad0e('0xf'),_0xad0e('0x10')],'where':{'name':_0x3e3e55,'role':{'$or':['admin',_0xad0e('0x11'),_0xad0e('0x12')]}}});})[_0xad0e('0xa')](function(_0xbed350){if(!_0xbed350||_0xbed350&&_0xbed350[_0xad0e('0xb')]!==_0x3e3e55){throw new Error(_0xad0e('0x13'));}else{_0x32d8fd=_0xbed350;return _0x32d8fd;}})['then'](function(){_0x32d8fd['authenticate'](_0x22e6b9,function(_0x9989bb,_0x840f13){var _0x3b8e27=_0x32d8fd[_0xad0e('0x10')]+0x1;if(_0x9989bb){return _0x201e29(_0x9989bb);}else if(!_0x840f13){if(_0x32d8fd[_0xad0e('0xe')]){return _0x201e29(null,![],{'message':_0xad0e('0x13')});}else if(_0x16bc25['allowedLoginAttempts']>0x0){if(_0x32d8fd[_0xad0e('0x14')]){if(_0x16bc25[_0xad0e('0x15')]>0x0){if(moment(_0x32d8fd[_0xad0e('0xf')])[_0xad0e('0x16')](_0x16bc25[_0xad0e('0x15')],_0xad0e('0x17'))>moment()){return _0x201e29(null,![],{'message':_0xad0e('0x13')});}else{return utils[_0xad0e('0x18')](_0x32d8fd,_0x3b8e27,![],null)[_0xad0e('0xa')](function(){return _0x201e29(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x201e29(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3b8e27>=_0x16bc25[_0xad0e('0x19')]){return utils[_0xad0e('0x18')](_0x32d8fd,0x0,!![],moment())[_0xad0e('0xa')](function(){return _0x201e29(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xad0e('0x18')](_0x32d8fd,_0x3b8e27,![],null)[_0xad0e('0xa')](function(){return _0x201e29(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x201e29(null,![],{'message':_0xad0e('0x13')});}}else{if(_0x32d8fd[_0xad0e('0xe')]){return _0x201e29(null,![],{'message':_0xad0e('0x13')});}else if(_0x16bc25[_0xad0e('0x19')]>0x0){if(_0x32d8fd[_0xad0e('0x14')]){if(_0x16bc25['blockDuration']>0x0){if(moment(_0x32d8fd[_0xad0e('0xf')])['add'](_0x16bc25[_0xad0e('0x15')],'minutes')>moment()){return _0x201e29(null,![],{'message':_0xad0e('0x13')});}else{return utils['clearBlockUser'](_0x32d8fd,0x0,![],null)[_0xad0e('0xa')](function(){return utils[_0xad0e('0x1a')](_0x32d8fd);})[_0xad0e('0xa')](function(){return _0x201e29(null,_0x32d8fd);});}}else{return _0x201e29(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xad0e('0x18')](_0x32d8fd,0x0,![],null)[_0xad0e('0xa')](function(){return utils[_0xad0e('0x1a')](_0x32d8fd);})[_0xad0e('0xa')](function(){return _0x201e29(null,_0x32d8fd);})[_0xad0e('0x1b')](function(_0x19b2b3){return _0x201e29(null,![],_0x19b2b3);});}}else{if(_0x32d8fd[_0xad0e('0x14')]){return _0x201e29(null,![],{'message':_0xad0e('0x13')});}else{return utils[_0xad0e('0x1a')](_0x32d8fd)['then'](function(){return _0x201e29(null,_0x32d8fd);});}}}});})[_0xad0e('0x1b')](function(_0x5261db){return _0x201e29(null,![],_0x5261db);});}function sendServiceMail(_0x5710e8){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0xad0e('0xb'),_0xad0e('0x1c')],'include':[{'model':db[_0xad0e('0x1d')],'as':'Smtp','include':[{'model':db[_0xad0e('0x1e')],'as':'CloudProvider'}]}]})[_0xad0e('0xa')](function(_0x2ba2da){if(!_0x2ba2da){throw new Error(_0xad0e('0x1f'));}var _0x49bca7=_0x2ba2da[_0xad0e('0x20')]();var _0x377412={'account':_0x49bca7,'message':_[_0xad0e('0x21')]({'from':util['format'](_0xad0e('0x22'),_0x2ba2da[_0xad0e('0xb')],_0x2ba2da[_0xad0e('0x1c')]||_0x2ba2da['Smtp'][_0xad0e('0x11')])},_0x5710e8)};return client[_0xad0e('0x23')](_0xad0e('0x24'),_0x377412);})[_0xad0e('0xa')](function(_0x1a9db6){if(_0x1a9db6[_0xad0e('0x25')]){throw new Error(util[_0xad0e('0x26')](_0xad0e('0x27'),_0x1a9db6['error'][_0xad0e('0x28')]||JSON[_0xad0e('0x29')](_0x1a9db6[_0xad0e('0x25')])));}return!![];});}function handleError(_0x24ee7c,_0x34b901,_0x42005e){return _0x24ee7c['status'](_0x34b901||0x1f4)[_0xad0e('0x2a')]({'message':_0x42005e?_0x42005e[_0xad0e('0x28')]||_0x42005e:''});}exports[_0xad0e('0x2b')]=function(_0x177dbb,_0x45504b,_0x1d8c61){passport[_0xad0e('0x2c')](_0xad0e('0x2d'),function(_0x4cab4f,_0x291c83,_0x2f0937){var _0x2805be=_0x4cab4f||_0x2f0937;if(_0x2805be){return handleError(_0x45504b,0x191,_0x2805be);}if(!_0x291c83){return handleError(_0x45504b,0x194,{'message':_0xad0e('0x2e')});}else{var _0x4ebe9a={'payload':{'id':_0x291c83['id'],'role':_0x291c83[_0xad0e('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0xad0e('0x2f')](_0x4ebe9a)['then'](function(_0x36166a){_0x45504b[_0xad0e('0x30')]({'id':_0x291c83['id'],'token':_0x36166a,'statusCall':'','isAlreadyLogged':_0x291c83[_0xad0e('0x31')]});});}})(_0x177dbb,_0x45504b,_0x1d8c61);};exports['forgot']=function(_0x449210,_0x32ae33){if(!_0x449210[_0xad0e('0x32')][_0xad0e('0x1c')]){return handleError(_0x32ae33,0x1f4,{'message':_0xad0e('0x33')});}var _0xef2c70=rs[_0xad0e('0x34')]();_0x449210[_0xad0e('0x32')]['email']=_0x449210[_0xad0e('0x32')][_0xad0e('0x1c')][_0xad0e('0x35')]()[_0xad0e('0x36')]();var _0xb91e5e;return db[_0xad0e('0x37')][_0xad0e('0x9')]({'where':{'id':0x1},'attributes':[_0xad0e('0x19'),'blockDuration'],'raw':!![]})[_0xad0e('0xa')](function(_0x588111){_0xb91e5e=_0x588111;return db[_0xad0e('0x38')][_0xad0e('0x39')]({'where':{'email':_0x449210['body']['email']}});})[_0xad0e('0xa')](function(_0x4e66bb){if(!_0x4e66bb){throw new Error(_0xad0e('0x3a'));}if(_0x4e66bb[_0xad0e('0xe')]){throw new Error(_0xad0e('0x3b'));}if(_0x4e66bb['blocked']){if(moment(_0x4e66bb['blockedAt'])[_0xad0e('0x16')](_0xb91e5e[_0xad0e('0x15')],_0xad0e('0x17'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x4e66bb[_0xad0e('0x14')]=![];_0x4e66bb['blockedAt']=null;}}_0x4e66bb[_0xad0e('0x3c')]=_0xef2c70;_0x4e66bb['resetPasswordExpires']=Date[_0xad0e('0x3d')]()+0x36ee80;return _0x4e66bb['save']();})[_0xad0e('0xa')](function(){return sendServiceMail({'to':_0x449210[_0xad0e('0x32')][_0xad0e('0x1c')],'subject':_0xad0e('0x3e'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x449210[_0xad0e('0x3f')][_0xad0e('0x40')]+_0xad0e('0x41')+_0xef2c70+'\x0a\x0a'+_0xad0e('0x42')});})[_0xad0e('0xa')](function(){_0x32ae33[_0xad0e('0x43')](0xc8)[_0xad0e('0x2a')]({'message':'Reset\x20Email\x20sent!'});})[_0xad0e('0x1b')](function(_0x42d322){return handleError(_0x32ae33,0x1f4,_0x42d322);});};exports['reset']=function(_0x184a7b,_0x407b92){return db['User'][_0xad0e('0x39')]({'where':{'resetPasswordToken':_0x184a7b[_0xad0e('0x44')][_0xad0e('0x45')],'resetPasswordExpires':{'$gt':Date[_0xad0e('0x3d')]()}}})[_0xad0e('0xa')](function(_0xcc8e83){if(!_0xcc8e83){throw new Error(_0xad0e('0x46'));}return db[_0xad0e('0x37')]['findOne']({'attributes':['id',_0xad0e('0x47'),'enforcePasswordHistory',_0xad0e('0x48')]})[_0xad0e('0xa')](function(_0x314e9e){if(_0x314e9e[_0xad0e('0x47')])authService[_0xad0e('0x49')](_0x184a7b['body'][_0xad0e('0x4a')]);if(!_0x314e9e[_0xad0e('0x4b')]||!_0xcc8e83[_0xad0e('0x4c')])return _0xcc8e83;authService[_0xad0e('0x4d')](_0x184a7b[_0xad0e('0x32')]['password'],_0xcc8e83['previousPasswords'],_0x314e9e[_0xad0e('0x48')]);return _0xcc8e83;})['then'](function(){_0xcc8e83['password']=_0x184a7b['body'][_0xad0e('0x4a')];_0xcc8e83['resetPasswordToken']=null;_0xcc8e83[_0xad0e('0x4e')]=null;return _0xcc8e83['save']();});})['then'](function(){_0x407b92[_0xad0e('0x43')](0xc8)[_0xad0e('0x2a')]({'message':_0xad0e('0x4f')});})[_0xad0e('0x1b')](function(_0x576c2a){return handleError(_0x407b92,0x1f4,_0x576c2a);});};passport[_0xad0e('0x50')](_0xad0e('0x2d'),new LocalStrategy({'usernameField':_0xad0e('0xb'),'passwordField':'password'},function(_0x4d36bd,_0x3ddd08,_0x2bcc77){return localAuthenticate(db['User'],_0x4d36bd,_0x3ddd08,_0x2bcc77);})); \ No newline at end of file +var _0xb98d=['client','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','agent','blocked','add','blockDuration','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../components/auth/service'];(function(_0x1b64dd,_0x2cf769){var _0xeb464c=function(_0x38272c){while(--_0x38272c){_0x1b64dd['push'](_0x1b64dd['shift']());}};_0xeb464c(++_0x2cf769);}(_0xb98d,0x9c));var _0xdb98=function(_0x29435a,_0x39ff5a){_0x29435a=_0x29435a-0x0;var _0x172422=_0xb98d[_0x29435a];return _0x172422;};'use strict';var util=require(_0xdb98('0x0'));var passport=require(_0xdb98('0x1'));var LocalStrategy=require(_0xdb98('0x2'))[_0xdb98('0x3')];var jayson=require(_0xdb98('0x4'));var _=require('lodash');var rs=require(_0xdb98('0x5'));var moment=require(_0xdb98('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xdb98('0x7'));var utils=require('../../config/utils');var client=jayson[_0xdb98('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x8e5fe6,_0x44c3e9,_0x52cbc0,_0x2958b7){var _0x5d27f3,_0x57b8d5;return db[_0xdb98('0x9')][_0xdb98('0xa')]({'where':{'id':0x1},'attributes':[_0xdb98('0xb'),'blockDuration'],'raw':!![]})[_0xdb98('0xc')](function(_0x31228f){_0x5d27f3=_0x31228f;return _0x8e5fe6[_0xdb98('0xa')]({'attributes':['id',_0xdb98('0xd'),_0xdb98('0xe'),_0xdb98('0xf'),_0xdb98('0x10'),_0xdb98('0x11'),'blocked',_0xdb98('0x12'),_0xdb98('0x13')],'where':{'name':_0x44c3e9,'role':{'$or':[_0xdb98('0x14'),'user',_0xdb98('0x15')]}}});})[_0xdb98('0xc')](function(_0x43c3bb){if(!_0x43c3bb||_0x43c3bb&&_0x43c3bb[_0xdb98('0xd')]!==_0x44c3e9){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x57b8d5=_0x43c3bb;return _0x57b8d5;}})[_0xdb98('0xc')](function(){_0x57b8d5['authenticate'](_0x52cbc0,function(_0x2dd9fa,_0x3e9103){var _0x456f1c=_0x57b8d5['loginAttempts']+0x1;if(_0x2dd9fa){return _0x2958b7(_0x2dd9fa);}else if(!_0x3e9103){if(_0x57b8d5[_0xdb98('0x11')]){return _0x2958b7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5d27f3[_0xdb98('0xb')]>0x0){if(_0x57b8d5[_0xdb98('0x16')]){if(_0x5d27f3['blockDuration']>0x0){if(moment(_0x57b8d5[_0xdb98('0x12')])[_0xdb98('0x17')](_0x5d27f3[_0xdb98('0x18')],_0xdb98('0x19'))>moment()){return _0x2958b7(null,![],{'message':_0xdb98('0x1a')});}else{return utils[_0xdb98('0x1b')](_0x57b8d5,_0x456f1c,![],null)[_0xdb98('0xc')](function(){return _0x2958b7(null,![],{'message':_0xdb98('0x1a')});});}}else{return _0x2958b7(null,![],{'message':_0xdb98('0x1a')});}}else{if(_0x456f1c>=_0x5d27f3[_0xdb98('0xb')]){return utils[_0xdb98('0x1b')](_0x57b8d5,0x0,!![],moment())[_0xdb98('0xc')](function(){return _0x2958b7(null,![],{'message':_0xdb98('0x1a')});});}else{return utils[_0xdb98('0x1b')](_0x57b8d5,_0x456f1c,![],null)['then'](function(){return _0x2958b7(null,![],{'message':_0xdb98('0x1a')});});}}}else{return _0x2958b7(null,![],{'message':_0xdb98('0x1a')});}}else{if(_0x57b8d5[_0xdb98('0x11')]){return _0x2958b7(null,![],{'message':_0xdb98('0x1a')});}else if(_0x5d27f3[_0xdb98('0xb')]>0x0){if(_0x57b8d5[_0xdb98('0x16')]){if(_0x5d27f3[_0xdb98('0x18')]>0x0){if(moment(_0x57b8d5[_0xdb98('0x12')])[_0xdb98('0x17')](_0x5d27f3[_0xdb98('0x18')],_0xdb98('0x19'))>moment()){return _0x2958b7(null,![],{'message':_0xdb98('0x1a')});}else{return utils[_0xdb98('0x1b')](_0x57b8d5,0x0,![],null)[_0xdb98('0xc')](function(){return utils[_0xdb98('0x1c')](_0x57b8d5);})[_0xdb98('0xc')](function(){return _0x2958b7(null,_0x57b8d5);});}}else{return _0x2958b7(null,![],{'message':_0xdb98('0x1a')});}}else{return utils[_0xdb98('0x1b')](_0x57b8d5,0x0,![],null)['then'](function(){return utils[_0xdb98('0x1c')](_0x57b8d5);})[_0xdb98('0xc')](function(){return _0x2958b7(null,_0x57b8d5);})['catch'](function(_0x5b7ad7){return _0x2958b7(null,![],_0x5b7ad7);});}}else{if(_0x57b8d5[_0xdb98('0x16')]){return _0x2958b7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xdb98('0x1c')](_0x57b8d5)['then'](function(){return _0x2958b7(null,_0x57b8d5);});}}}});})[_0xdb98('0x1d')](function(_0x5758b0){return _0x2958b7(null,![],_0x5758b0);});}function sendServiceMail(_0x475ede){return db['MailAccount'][_0xdb98('0x1e')]({'where':{'service':!![]},'attributes':['id',_0xdb98('0xd'),_0xdb98('0x1f')],'include':[{'model':db[_0xdb98('0x20')],'as':_0xdb98('0x21'),'include':[{'model':db[_0xdb98('0x22')],'as':'CloudProvider'}]}]})[_0xdb98('0xc')](function(_0x1a0de0){if(!_0x1a0de0){throw new Error(_0xdb98('0x23'));}var _0x9433d1=_0x1a0de0[_0xdb98('0x24')]();var _0xb5e05f={'account':_0x9433d1,'message':_[_0xdb98('0x25')]({'from':util[_0xdb98('0x26')]('\x22%s\x22\x20<%s>',_0x1a0de0[_0xdb98('0xd')],_0x1a0de0[_0xdb98('0x1f')]||_0x1a0de0[_0xdb98('0x21')][_0xdb98('0x27')])},_0x475ede)};return client[_0xdb98('0x28')](_0xdb98('0x29'),_0xb5e05f);})['then'](function(_0x4f28ed){if(_0x4f28ed[_0xdb98('0x2a')]){throw new Error(util[_0xdb98('0x26')](_0xdb98('0x2b'),_0x4f28ed['error'][_0xdb98('0x2c')]||JSON[_0xdb98('0x2d')](_0x4f28ed[_0xdb98('0x2a')])));}return!![];});}function handleError(_0xfa477f,_0x1e48fe,_0x21abd9){return _0xfa477f[_0xdb98('0x2e')](_0x1e48fe||0x1f4)[_0xdb98('0x2f')]({'message':_0x21abd9?_0x21abd9['message']||_0x21abd9:''});}exports[_0xdb98('0x30')]=function(_0xecd5ed,_0x3c67a7,_0x280fc1){passport[_0xdb98('0x31')](_0xdb98('0x32'),function(_0x29f65d,_0x513b41,_0x30ad27){var _0x284483=_0x29f65d||_0x30ad27;if(_0x284483){return handleError(_0x3c67a7,0x191,_0x284483);}if(!_0x513b41){return handleError(_0x3c67a7,0x194,{'message':_0xdb98('0x33')});}else{var _0x37a907={'payload':{'id':_0x513b41['id'],'role':_0x513b41[_0xdb98('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xdb98('0x34')](_0x37a907)[_0xdb98('0xc')](function(_0x230202){_0x3c67a7[_0xdb98('0x35')]({'id':_0x513b41['id'],'token':_0x230202,'statusCall':'','isAlreadyLogged':_0x513b41[_0xdb98('0x36')]});});}})(_0xecd5ed,_0x3c67a7,_0x280fc1);};exports[_0xdb98('0x37')]=function(_0x5aa023,_0x1b576b){if(!_0x5aa023[_0xdb98('0x38')]['email']){return handleError(_0x1b576b,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x35150c=rs[_0xdb98('0x39')]();_0x5aa023[_0xdb98('0x38')]['email']=_0x5aa023['body']['email'][_0xdb98('0x3a')]()[_0xdb98('0x3b')]();var _0x24081f;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdb98('0xb'),_0xdb98('0x18')],'raw':!![]})[_0xdb98('0xc')](function(_0x4fb249){_0x24081f=_0x4fb249;return db['User']['find']({'where':{'email':_0x5aa023[_0xdb98('0x38')][_0xdb98('0x1f')]}});})[_0xdb98('0xc')](function(_0x563880){if(!_0x563880){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x563880[_0xdb98('0x11')]){throw new Error(_0xdb98('0x3c'));}if(_0x563880[_0xdb98('0x16')]){if(moment(_0x563880['blockedAt'])['add'](_0x24081f[_0xdb98('0x18')],_0xdb98('0x19'))>moment()){throw new Error(_0xdb98('0x3d'));}else{_0x563880[_0xdb98('0x16')]=![];_0x563880[_0xdb98('0x12')]=null;}}_0x563880[_0xdb98('0x3e')]=_0x35150c;_0x563880['resetPasswordExpires']=Date[_0xdb98('0x3f')]()+0x36ee80;return _0x563880[_0xdb98('0x40')]();})[_0xdb98('0xc')](function(){return sendServiceMail({'to':_0x5aa023[_0xdb98('0x38')][_0xdb98('0x1f')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xdb98('0x41')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xdb98('0x42')+_0x5aa023[_0xdb98('0x43')][_0xdb98('0x44')]+'/reset/'+_0x35150c+'\x0a\x0a'+_0xdb98('0x45')});})['then'](function(){_0x1b576b[_0xdb98('0x2e')](0xc8)[_0xdb98('0x2f')]({'message':_0xdb98('0x46')});})[_0xdb98('0x1d')](function(_0x4fca83){return handleError(_0x1b576b,0x1f4,_0x4fca83);});};exports[_0xdb98('0x47')]=function(_0x234640,_0x416265){return db[_0xdb98('0x48')][_0xdb98('0x1e')]({'where':{'resetPasswordToken':_0x234640[_0xdb98('0x49')][_0xdb98('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xdb98('0x3f')]()}}})['then'](function(_0x1be72f){if(!_0x1be72f){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xdb98('0x9')][_0xdb98('0xa')]({'attributes':['id',_0xdb98('0x4b'),_0xdb98('0x4c'),_0xdb98('0x4d')]})[_0xdb98('0xc')](function(_0x2d70ba){if(_0x2d70ba[_0xdb98('0x4b')])authService['validatePasswordPattern'](_0x234640[_0xdb98('0x38')][_0xdb98('0xe')]);if(!_0x2d70ba[_0xdb98('0x4c')]||!_0x1be72f['previousPasswords'])return _0x1be72f;authService[_0xdb98('0x4e')](_0x234640[_0xdb98('0x38')][_0xdb98('0xe')],_0x1be72f[_0xdb98('0x4f')],_0x2d70ba[_0xdb98('0x4d')]);return _0x1be72f;})[_0xdb98('0xc')](function(){_0x1be72f[_0xdb98('0xe')]=_0x234640[_0xdb98('0x38')][_0xdb98('0xe')];_0x1be72f[_0xdb98('0x3e')]=null;_0x1be72f['resetPasswordExpires']=null;return _0x1be72f[_0xdb98('0x40')]();});})[_0xdb98('0xc')](function(){_0x416265[_0xdb98('0x2e')](0xc8)[_0xdb98('0x2f')]({'message':_0xdb98('0x50')});})[_0xdb98('0x1d')](function(_0xe1b8ec){return handleError(_0x416265,0x1f4,_0xe1b8ec);});};passport[_0xdb98('0x51')](_0xdb98('0x32'),new LocalStrategy({'usernameField':_0xdb98('0xd'),'passwordField':_0xdb98('0xe')},function(_0x3f7ec5,_0x26aaba,_0x135f75){return localAuthenticate(db['User'],_0x3f7ec5,_0x26aaba,_0x135f75);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 83737e9..ad388e0 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 _0x83f6=['forgot','/reset/:token','exports','express','Router','./authLocal.controller','post','/forgot'];(function(_0x8c1005,_0x1f3f16){var _0x175354=function(_0xd0e9c4){while(--_0xd0e9c4){_0x8c1005['push'](_0x8c1005['shift']());}};_0x175354(++_0x1f3f16);}(_0x83f6,0x17b));var _0x683f=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0x83f6[_0x870b62];return _0x2dcb39;};'use strict';var express=require(_0x683f('0x0'));var router=express[_0x683f('0x1')]();var controller=require(_0x683f('0x2'));router[_0x683f('0x3')]('/',controller['login']);router[_0x683f('0x3')](_0x683f('0x4'),controller[_0x683f('0x5')]);router[_0x683f('0x3')](_0x683f('0x6'),controller['reset']);module[_0x683f('0x7')]=router; \ No newline at end of file +var _0x32ed=['./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x32ed,0xd0));var _0xd32e=function(_0x81f993,_0x5479bb){_0x81f993=_0x81f993-0x0;var _0x1e9fde=_0x32ed[_0x81f993];return _0x1e9fde;};'use strict';var express=require(_0xd32e('0x0'));var router=express[_0xd32e('0x1')]();var controller=require(_0xd32e('0x2'));router[_0xd32e('0x3')]('/',controller[_0xd32e('0x4')]);router[_0xd32e('0x3')](_0xd32e('0x5'),controller[_0xd32e('0x6')]);router['post'](_0xd32e('0x7'),controller[_0xd32e('0x8')]);module[_0xd32e('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 7a3e80b..221ac3e 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 _0x3a50=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x313df1,_0x5e46df){var _0x20ecb5=function(_0x45a453){while(--_0x45a453){_0x313df1['push'](_0x313df1['shift']());}};_0x20ecb5(++_0x5e46df);}(_0x3a50,0x18f));var _0x03a5=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3a50[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x03a5('0x0'));module[_0x03a5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x03a5('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x03a5('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x03a5('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x338f=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x338f,0x176));var _0xf338=function(_0x3e779c,_0x546ea2){_0x3e779c=_0x3e779c-0x0;var _0x22ab11=_0x338f[_0x3e779c];return _0x22ab11;};'use strict';var Sequelize=require('sequelize');module[_0xf338('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xf338('0x1')]},'description':{'type':Sequelize[_0xf338('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 4ac54ee..0acabfb 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 _0x3c20=['include','findAll','rows','catch','show','params','keys','create','body','Condition','ids','omit','findOne','filter','getConditions','addActions','Action','find','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','map','Automation','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x3c20,0x66));var _0x03c2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3c20[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x03c2('0x0'));var rimraf=require(_0x03c2('0x1'));var zipdir=require(_0x03c2('0x2'));var jsonpatch=require(_0x03c2('0x3'));var rp=require(_0x03c2('0x4'));var moment=require(_0x03c2('0x5'));var BPromise=require(_0x03c2('0x6'));var Mustache=require(_0x03c2('0x7'));var util=require(_0x03c2('0x8'));var path=require('path');var sox=require(_0x03c2('0x9'));var csv=require('to-csv');var ejs=require(_0x03c2('0xa'));var fs=require('fs');var fs_extra=require(_0x03c2('0xb'));var _=require(_0x03c2('0xc'));var squel=require('squel');var crypto=require(_0x03c2('0xd'));var jsforce=require(_0x03c2('0xe'));var deskjs=require(_0x03c2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x03c2('0x10'));var Redis=require(_0x03c2('0x11'));var authService=require(_0x03c2('0x12'));var qs=require(_0x03c2('0x13'));var as=require(_0x03c2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03c2('0x15'))(_0x03c2('0x16'));var utils=require(_0x03c2('0x17'));var config=require(_0x03c2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x03c2('0x19'))['db'];function respondWithStatusCode(_0x36afd5,_0x81c504){_0x81c504=_0x81c504||0xcc;return function(_0x373343){if(_0x373343){return _0x36afd5[_0x03c2('0x1a')](_0x81c504);}return _0x36afd5[_0x03c2('0x1b')](_0x81c504)[_0x03c2('0x1c')]();};}function respondWithResult(_0x42ea50,_0x15d9ef){_0x15d9ef=_0x15d9ef||0xc8;return function(_0x560525){if(_0x560525){return _0x42ea50[_0x03c2('0x1b')](_0x15d9ef)[_0x03c2('0x1d')](_0x560525);}};}function respondWithFilteredResult(_0x13f525,_0x5c4e64){return function(_0x5cd51f){if(_0x5cd51f){var _0x1f600e=typeof _0x5c4e64[_0x03c2('0x1e')]===_0x03c2('0x1f')&&typeof _0x5c4e64[_0x03c2('0x20')]===_0x03c2('0x1f');var _0x3d733c=_0x5cd51f[_0x03c2('0x21')];var _0x3c8568=_0x1f600e?0x0:_0x5c4e64[_0x03c2('0x1e')];var _0xd12cd=_0x1f600e?_0x5cd51f[_0x03c2('0x21')]:_0x5c4e64['offset']+_0x5c4e64[_0x03c2('0x20')];var _0x382bf7;if(_0xd12cd>=_0x3d733c){_0xd12cd=_0x3d733c;_0x382bf7=0xc8;}else{_0x382bf7=0xce;}_0x13f525[_0x03c2('0x1b')](_0x382bf7);return _0x13f525['set'](_0x03c2('0x22'),_0x3c8568+'-'+_0xd12cd+'/'+_0x3d733c)[_0x03c2('0x1d')](_0x5cd51f);}return null;};}function patchUpdates(_0x3e6fb1){return function(_0x383037){try{jsonpatch[_0x03c2('0x23')](_0x383037,_0x3e6fb1,!![]);}catch(_0x47a700){return BPromise[_0x03c2('0x24')](_0x47a700);}return _0x383037['save']();};}function saveUpdates(_0x2ce82b,_0x43274d){return function(_0x102adc){if(_0x102adc){return _0x102adc[_0x03c2('0x25')](_0x2ce82b)[_0x03c2('0x26')](function(_0x347af2){return _0x347af2;});}return null;};}function removeEntity(_0x238e07,_0x590c6b){return function(_0x1a0061){if(_0x1a0061){return _0x1a0061[_0x03c2('0x27')]()[_0x03c2('0x26')](function(){_0x238e07[_0x03c2('0x1b')](0xcc)[_0x03c2('0x1c')]();});}};}function handleEntityNotFound(_0x4b7f18,_0x3b1b69){return function(_0x4532dd){if(!_0x4532dd){_0x4b7f18[_0x03c2('0x1a')](0x194);}return _0x4532dd;};}function handleError(_0x117f72,_0x4fae76){_0x4fae76=_0x4fae76||0x1f4;return function(_0x5ea7be){logger[_0x03c2('0x28')](_0x5ea7be['stack']);if(_0x5ea7be[_0x03c2('0x29')]){delete _0x5ea7be[_0x03c2('0x29')];}_0x117f72['status'](_0x4fae76)['send'](_0x5ea7be);};}exports['index']=function(_0xe5ae38,_0x20d7a3){var _0x20d032={},_0x2d4742={},_0x323711={'count':0x0,'rows':[]};var _0x9387b8=_[_0x03c2('0x2a')](db[_0x03c2('0x2b')][_0x03c2('0x2c')],function(_0x1e7884){return{'name':_0x1e7884['fieldName'],'type':_0x1e7884[_0x03c2('0x2d')][_0x03c2('0x2e')]};});_0x2d4742[_0x03c2('0x2f')]=_[_0x03c2('0x2a')](_0x9387b8,'name');_0x2d4742[_0x03c2('0x30')]=_['keys'](_0xe5ae38[_0x03c2('0x30')]);_0x2d4742[_0x03c2('0x31')]=_[_0x03c2('0x32')](_0x2d4742[_0x03c2('0x2f')],_0x2d4742[_0x03c2('0x30')]);_0x20d032[_0x03c2('0x33')]=_[_0x03c2('0x32')](_0x2d4742[_0x03c2('0x2f')],qs[_0x03c2('0x34')](_0xe5ae38[_0x03c2('0x30')][_0x03c2('0x34')]));_0x20d032[_0x03c2('0x33')]=_0x20d032[_0x03c2('0x33')][_0x03c2('0x35')]?_0x20d032[_0x03c2('0x33')]:_0x2d4742['model'];if(!_0xe5ae38[_0x03c2('0x30')][_0x03c2('0x36')](_0x03c2('0x37'))){_0x20d032[_0x03c2('0x20')]=qs[_0x03c2('0x20')](_0xe5ae38[_0x03c2('0x30')]['limit']);_0x20d032[_0x03c2('0x1e')]=qs[_0x03c2('0x1e')](_0xe5ae38[_0x03c2('0x30')][_0x03c2('0x1e')]);}_0x20d032[_0x03c2('0x38')]=qs[_0x03c2('0x39')](_0xe5ae38['query']['sort']);_0x20d032[_0x03c2('0x3a')]=qs[_0x03c2('0x31')](_[_0x03c2('0x3b')](_0xe5ae38[_0x03c2('0x30')],_0x2d4742[_0x03c2('0x31')]),_0x9387b8);if(_0xe5ae38[_0x03c2('0x30')]['filter']){_0x20d032[_0x03c2('0x3a')]=_['merge'](_0x20d032[_0x03c2('0x3a')],{'$or':_['map'](_0x9387b8,function(_0x5be70a){if(_0x5be70a[_0x03c2('0x2d')]!==_0x03c2('0x3c')){var _0x50a76c={};_0x50a76c[_0x5be70a[_0x03c2('0x29')]]={'$like':'%'+_0xe5ae38[_0x03c2('0x30')]['filter']+'%'};return _0x50a76c;}})});}_0x20d032=_[_0x03c2('0x3d')]({},_0x20d032,_0xe5ae38[_0x03c2('0x3e')]);var _0x188a42={'where':_0x20d032[_0x03c2('0x3a')]};return db[_0x03c2('0x2b')][_0x03c2('0x21')](_0x188a42)[_0x03c2('0x26')](function(_0x560dc0){_0x323711['count']=_0x560dc0;if(_0xe5ae38[_0x03c2('0x30')][_0x03c2('0x3f')]){_0x20d032[_0x03c2('0x40')]=[{'all':!![]}];}return db[_0x03c2('0x2b')][_0x03c2('0x41')](_0x20d032);})['then'](function(_0x54c807){_0x323711[_0x03c2('0x42')]=_0x54c807;return _0x323711;})[_0x03c2('0x26')](respondWithFilteredResult(_0x20d7a3,_0x20d032))[_0x03c2('0x43')](handleError(_0x20d7a3,null));};exports[_0x03c2('0x44')]=function(_0x94cb72,_0x3d8517){var _0x1ec097={'raw':![],'where':{'id':_0x94cb72[_0x03c2('0x45')]['id']}},_0x17252f={};_0x17252f[_0x03c2('0x2f')]=_[_0x03c2('0x46')](db[_0x03c2('0x2b')][_0x03c2('0x2c')]);_0x17252f[_0x03c2('0x30')]=_[_0x03c2('0x46')](_0x94cb72[_0x03c2('0x30')]);_0x17252f[_0x03c2('0x31')]=_['intersection'](_0x17252f['model'],_0x17252f[_0x03c2('0x30')]);_0x1ec097[_0x03c2('0x33')]=_[_0x03c2('0x32')](_0x17252f[_0x03c2('0x2f')],qs[_0x03c2('0x34')](_0x94cb72[_0x03c2('0x30')]['fields']));_0x1ec097['attributes']=_0x1ec097[_0x03c2('0x33')][_0x03c2('0x35')]?_0x1ec097[_0x03c2('0x33')]:_0x17252f[_0x03c2('0x2f')];if(_0x94cb72[_0x03c2('0x30')][_0x03c2('0x3f')]){_0x1ec097[_0x03c2('0x40')]=[{'all':!![]}];}_0x1ec097=_['merge']({},_0x1ec097,_0x94cb72['options']);return db[_0x03c2('0x2b')]['find'](_0x1ec097)[_0x03c2('0x26')](handleEntityNotFound(_0x3d8517,null))[_0x03c2('0x26')](respondWithResult(_0x3d8517,null))[_0x03c2('0x43')](handleError(_0x3d8517,null));};exports[_0x03c2('0x47')]=function(_0x5409a9,_0x18af52){return db['Automation'][_0x03c2('0x47')](_0x5409a9['body'],{})[_0x03c2('0x26')](respondWithResult(_0x18af52,0xc9))['catch'](handleError(_0x18af52,null));};exports[_0x03c2('0x25')]=function(_0x84daba,_0xb4e4c0){if(_0x84daba[_0x03c2('0x48')]['id']){delete _0x84daba[_0x03c2('0x48')]['id'];}return db[_0x03c2('0x2b')]['find']({'where':{'id':_0x84daba['params']['id']}})[_0x03c2('0x26')](handleEntityNotFound(_0xb4e4c0,null))[_0x03c2('0x26')](saveUpdates(_0x84daba[_0x03c2('0x48')],null))['then'](respondWithResult(_0xb4e4c0,null))['catch'](handleError(_0xb4e4c0,null));};exports[_0x03c2('0x27')]=function(_0x361b55,_0x2667a3){return db[_0x03c2('0x2b')]['find']({'where':{'id':_0x361b55[_0x03c2('0x45')]['id']}})[_0x03c2('0x26')](handleEntityNotFound(_0x2667a3,null))['then'](removeEntity(_0x2667a3,null))[_0x03c2('0x43')](handleError(_0x2667a3,null));};exports['addConditions']=function(_0x22644b,_0x5e6ef5,_0x2353c5){return db[_0x03c2('0x49')]['find']({'where':{'id':_0x22644b['params']['id']}})['then'](handleEntityNotFound(_0x5e6ef5,null))[_0x03c2('0x26')](function(_0x3072a9){if(_0x3072a9){return _0x3072a9['addConditions'](_0x22644b[_0x03c2('0x48')][_0x03c2('0x4a')],_[_0x03c2('0x4b')](_0x22644b[_0x03c2('0x48')],['ids','id'])||{});}})['then'](respondWithResult(_0x5e6ef5,null))['catch'](handleError(_0x5e6ef5,null));};exports['getConditions']=function(_0x581688,_0x2a1129,_0x233643){var _0x148279={};var _0x2efadc={};var _0x3df497;var _0x215ab9;return db[_0x03c2('0x2b')][_0x03c2('0x4c')]({'where':{'id':_0x581688[_0x03c2('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a1129,null))[_0x03c2('0x26')](function(_0x5cf33d){if(_0x5cf33d){_0x3df497=_0x5cf33d;_0x2efadc['model']=_['keys'](db[_0x03c2('0x49')]['rawAttributes']);_0x2efadc[_0x03c2('0x30')]=_[_0x03c2('0x46')](_0x581688[_0x03c2('0x30')]);_0x2efadc['filters']=_[_0x03c2('0x32')](_0x2efadc[_0x03c2('0x2f')],_0x2efadc[_0x03c2('0x30')]);_0x148279['attributes']=_[_0x03c2('0x32')](_0x2efadc[_0x03c2('0x2f')],qs['fields'](_0x581688[_0x03c2('0x30')][_0x03c2('0x34')]));_0x148279[_0x03c2('0x33')]=_0x148279[_0x03c2('0x33')][_0x03c2('0x35')]?_0x148279[_0x03c2('0x33')]:_0x2efadc[_0x03c2('0x2f')];_0x148279[_0x03c2('0x38')]=qs[_0x03c2('0x39')](_0x581688[_0x03c2('0x30')][_0x03c2('0x39')]);_0x148279['where']=qs[_0x03c2('0x31')](_['pick'](_0x581688[_0x03c2('0x30')],_0x2efadc['filters']));if(_0x581688['query'][_0x03c2('0x4d')]){_0x148279['where']=_[_0x03c2('0x3d')](_0x148279[_0x03c2('0x3a')],{'$or':_[_0x03c2('0x2a')](_0x148279[_0x03c2('0x33')],function(_0x1c2d35){var _0x1f6667={};_0x1f6667[_0x1c2d35]={'$like':'%'+_0x581688[_0x03c2('0x30')][_0x03c2('0x4d')]+'%'};return _0x1f6667;})});}_0x148279=_[_0x03c2('0x3d')]({},_0x148279,_0x581688[_0x03c2('0x3e')]);return _0x3df497[_0x03c2('0x4e')](_0x148279);}})[_0x03c2('0x26')](function(_0x4d02b5){if(_0x4d02b5){_0x215ab9=_0x4d02b5['length'];if(!_0x581688[_0x03c2('0x30')][_0x03c2('0x36')]('nolimit')){_0x148279[_0x03c2('0x20')]=qs[_0x03c2('0x20')](_0x581688[_0x03c2('0x30')][_0x03c2('0x20')]);_0x148279[_0x03c2('0x1e')]=qs['offset'](_0x581688['query'][_0x03c2('0x1e')]);}return _0x3df497['getConditions'](_0x148279);}})['then'](function(_0x476d5c){if(_0x476d5c){return _0x476d5c?{'count':_0x215ab9,'rows':_0x476d5c}:null;}})['then'](respondWithResult(_0x2a1129,null))['catch'](handleError(_0x2a1129,null));};exports[_0x03c2('0x4f')]=function(_0x4d1f38,_0x4b07ad,_0x31d321){return db[_0x03c2('0x50')][_0x03c2('0x51')]({'where':{'id':_0x4d1f38[_0x03c2('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b07ad,null))[_0x03c2('0x26')](function(_0x233c3c){if(_0x233c3c){return _0x233c3c[_0x03c2('0x4f')](_0x4d1f38['body'][_0x03c2('0x4a')],_[_0x03c2('0x4b')](_0x4d1f38[_0x03c2('0x48')],['ids','id'])||{});}})[_0x03c2('0x26')](respondWithResult(_0x4b07ad,null))[_0x03c2('0x43')](handleError(_0x4b07ad,null));};exports[_0x03c2('0x52')]=function(_0x2a7c4b,_0x535cfd,_0x57bd08){var _0x505dd4={};var _0x59f1d5={};var _0x947826;var _0x3d93bc;return db[_0x03c2('0x2b')][_0x03c2('0x4c')]({'where':{'id':_0x2a7c4b[_0x03c2('0x45')]['id']}})[_0x03c2('0x26')](handleEntityNotFound(_0x535cfd,null))[_0x03c2('0x26')](function(_0x24b112){if(_0x24b112){_0x947826=_0x24b112;_0x59f1d5['model']=_['keys'](db[_0x03c2('0x50')][_0x03c2('0x2c')]);_0x59f1d5[_0x03c2('0x30')]=_[_0x03c2('0x46')](_0x2a7c4b[_0x03c2('0x30')]);_0x59f1d5['filters']=_[_0x03c2('0x32')](_0x59f1d5[_0x03c2('0x2f')],_0x59f1d5[_0x03c2('0x30')]);_0x505dd4[_0x03c2('0x33')]=_[_0x03c2('0x32')](_0x59f1d5[_0x03c2('0x2f')],qs[_0x03c2('0x34')](_0x2a7c4b['query'][_0x03c2('0x34')]));_0x505dd4['attributes']=_0x505dd4[_0x03c2('0x33')]['length']?_0x505dd4['attributes']:_0x59f1d5[_0x03c2('0x2f')];_0x505dd4[_0x03c2('0x38')]=qs[_0x03c2('0x39')](_0x2a7c4b[_0x03c2('0x30')][_0x03c2('0x39')]);_0x505dd4[_0x03c2('0x3a')]=qs[_0x03c2('0x31')](_[_0x03c2('0x3b')](_0x2a7c4b[_0x03c2('0x30')],_0x59f1d5[_0x03c2('0x31')]));if(_0x2a7c4b[_0x03c2('0x30')]['filter']){_0x505dd4['where']=_[_0x03c2('0x3d')](_0x505dd4[_0x03c2('0x3a')],{'$or':_[_0x03c2('0x2a')](_0x505dd4[_0x03c2('0x33')],function(_0x246d62){var _0x3a02bc={};_0x3a02bc[_0x246d62]={'$like':'%'+_0x2a7c4b[_0x03c2('0x30')][_0x03c2('0x4d')]+'%'};return _0x3a02bc;})});}_0x505dd4=_[_0x03c2('0x3d')]({},_0x505dd4,_0x2a7c4b[_0x03c2('0x3e')]);return _0x947826[_0x03c2('0x52')](_0x505dd4);}})['then'](function(_0x208000){if(_0x208000){_0x3d93bc=_0x208000[_0x03c2('0x35')];if(!_0x2a7c4b['query']['hasOwnProperty']('nolimit')){_0x505dd4[_0x03c2('0x20')]=qs[_0x03c2('0x20')](_0x2a7c4b['query'][_0x03c2('0x20')]);_0x505dd4[_0x03c2('0x1e')]=qs[_0x03c2('0x1e')](_0x2a7c4b[_0x03c2('0x30')][_0x03c2('0x1e')]);}return _0x947826[_0x03c2('0x52')](_0x505dd4);}})[_0x03c2('0x26')](function(_0x3c1208){if(_0x3c1208){return _0x3c1208?{'count':_0x3d93bc,'rows':_0x3c1208}:null;}})[_0x03c2('0x26')](respondWithResult(_0x535cfd,null))[_0x03c2('0x43')](handleError(_0x535cfd,null));}; \ No newline at end of file +var _0xf88e=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','end','error','stack','name','status','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','Automation','findAll','rows','catch','show','options','create','body','find','params','addConditions','Condition','omit','ids','getConditions','findOne','addActions','getActions','Action','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','desk.js','to-csv'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xf88e,0x13b));var _0xef88=function(_0x57097c,_0x1d6e52){_0x57097c=_0x57097c-0x0;var _0x1d3061=_0xf88e[_0x57097c];return _0x1d3061;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xef88('0x0'));var zipdir=require(_0xef88('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef88('0x2'));var moment=require(_0xef88('0x3'));var BPromise=require(_0xef88('0x4'));var Mustache=require(_0xef88('0x5'));var util=require(_0xef88('0x6'));var path=require(_0xef88('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xef88('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xef88('0x9'));var jsforce=require(_0xef88('0xa'));var deskjs=require(_0xef88('0xb'));var toCsv=require(_0xef88('0xc'));var querystring=require('querystring');var Papa=require(_0xef88('0xd'));var Redis=require('ioredis');var authService=require(_0xef88('0xe'));var qs=require(_0xef88('0xf'));var as=require(_0xef88('0x10'));var hardwareService=require(_0xef88('0x11'));var logger=require('../../config/logger')(_0xef88('0x12'));var utils=require(_0xef88('0x13'));var config=require(_0xef88('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ba7c5,_0x1d6af2){_0x1d6af2=_0x1d6af2||0xcc;return function(_0xde4bc){if(_0xde4bc){return _0x5ba7c5['sendStatus'](_0x1d6af2);}return _0x5ba7c5['status'](_0x1d6af2)['end']();};}function respondWithResult(_0x157446,_0x49fc0b){_0x49fc0b=_0x49fc0b||0xc8;return function(_0x760a65){if(_0x760a65){return _0x157446['status'](_0x49fc0b)['json'](_0x760a65);}};}function respondWithFilteredResult(_0x454516,_0x32363e){return function(_0x42bac6){if(_0x42bac6){var _0x1c5fe5=typeof _0x32363e[_0xef88('0x15')]===_0xef88('0x16')&&typeof _0x32363e[_0xef88('0x17')]===_0xef88('0x16');var _0x578670=_0x42bac6[_0xef88('0x18')];var _0x5a6fc5=_0x1c5fe5?0x0:_0x32363e[_0xef88('0x15')];var _0xd04e22=_0x1c5fe5?_0x42bac6[_0xef88('0x18')]:_0x32363e[_0xef88('0x15')]+_0x32363e[_0xef88('0x17')];var _0x41e856;if(_0xd04e22>=_0x578670){_0xd04e22=_0x578670;_0x41e856=0xc8;}else{_0x41e856=0xce;}_0x454516['status'](_0x41e856);return _0x454516[_0xef88('0x19')]('Content-Range',_0x5a6fc5+'-'+_0xd04e22+'/'+_0x578670)[_0xef88('0x1a')](_0x42bac6);}return null;};}function patchUpdates(_0x58dd2a){return function(_0x573c02){try{jsonpatch[_0xef88('0x1b')](_0x573c02,_0x58dd2a,!![]);}catch(_0x40df26){return BPromise[_0xef88('0x1c')](_0x40df26);}return _0x573c02[_0xef88('0x1d')]();};}function saveUpdates(_0x127770,_0x3c79db){return function(_0x44614e){if(_0x44614e){return _0x44614e[_0xef88('0x1e')](_0x127770)[_0xef88('0x1f')](function(_0x4af46c){return _0x4af46c;});}return null;};}function removeEntity(_0xa3ddf0,_0x54cb4a){return function(_0x208865){if(_0x208865){return _0x208865[_0xef88('0x20')]()[_0xef88('0x1f')](function(){_0xa3ddf0['status'](0xcc)[_0xef88('0x21')]();});}};}function handleEntityNotFound(_0x355247,_0x48bf89){return function(_0x484098){if(!_0x484098){_0x355247['sendStatus'](0x194);}return _0x484098;};}function handleError(_0x4aba52,_0x23f654){_0x23f654=_0x23f654||0x1f4;return function(_0x484793){logger[_0xef88('0x22')](_0x484793[_0xef88('0x23')]);if(_0x484793[_0xef88('0x24')]){delete _0x484793['name'];}_0x4aba52[_0xef88('0x25')](_0x23f654)[_0xef88('0x26')](_0x484793);};}exports['index']=function(_0x3d3f82,_0x455e90){var _0x1d4d57={},_0x4acf96={},_0x31b8f7={'count':0x0,'rows':[]};var _0x19d1b0=_[_0xef88('0x27')](db['Automation'][_0xef88('0x28')],function(_0x2277bd){return{'name':_0x2277bd[_0xef88('0x29')],'type':_0x2277bd[_0xef88('0x2a')][_0xef88('0x2b')]};});_0x4acf96[_0xef88('0x2c')]=_[_0xef88('0x27')](_0x19d1b0,_0xef88('0x24'));_0x4acf96[_0xef88('0x2d')]=_[_0xef88('0x2e')](_0x3d3f82[_0xef88('0x2d')]);_0x4acf96[_0xef88('0x2f')]=_[_0xef88('0x30')](_0x4acf96[_0xef88('0x2c')],_0x4acf96[_0xef88('0x2d')]);_0x1d4d57[_0xef88('0x31')]=_[_0xef88('0x30')](_0x4acf96[_0xef88('0x2c')],qs[_0xef88('0x32')](_0x3d3f82[_0xef88('0x2d')][_0xef88('0x32')]));_0x1d4d57[_0xef88('0x31')]=_0x1d4d57[_0xef88('0x31')][_0xef88('0x33')]?_0x1d4d57[_0xef88('0x31')]:_0x4acf96[_0xef88('0x2c')];if(!_0x3d3f82['query'][_0xef88('0x34')](_0xef88('0x35'))){_0x1d4d57[_0xef88('0x17')]=qs[_0xef88('0x17')](_0x3d3f82[_0xef88('0x2d')][_0xef88('0x17')]);_0x1d4d57[_0xef88('0x15')]=qs[_0xef88('0x15')](_0x3d3f82[_0xef88('0x2d')][_0xef88('0x15')]);}_0x1d4d57[_0xef88('0x36')]=qs[_0xef88('0x37')](_0x3d3f82[_0xef88('0x2d')][_0xef88('0x37')]);_0x1d4d57[_0xef88('0x38')]=qs['filters'](_[_0xef88('0x39')](_0x3d3f82[_0xef88('0x2d')],_0x4acf96[_0xef88('0x2f')]),_0x19d1b0);if(_0x3d3f82['query'][_0xef88('0x3a')]){_0x1d4d57[_0xef88('0x38')]=_[_0xef88('0x3b')](_0x1d4d57['where'],{'$or':_[_0xef88('0x27')](_0x19d1b0,function(_0xd9f6d5){if(_0xd9f6d5[_0xef88('0x2a')]!==_0xef88('0x3c')){var _0x3cce12={};_0x3cce12[_0xd9f6d5[_0xef88('0x24')]]={'$like':'%'+_0x3d3f82['query'][_0xef88('0x3a')]+'%'};return _0x3cce12;}})});}_0x1d4d57=_[_0xef88('0x3b')]({},_0x1d4d57,_0x3d3f82['options']);var _0x27bc71={'where':_0x1d4d57[_0xef88('0x38')]};return db['Automation']['count'](_0x27bc71)[_0xef88('0x1f')](function(_0x8c96f8){_0x31b8f7['count']=_0x8c96f8;if(_0x3d3f82[_0xef88('0x2d')][_0xef88('0x3d')]){_0x1d4d57[_0xef88('0x3e')]=[{'all':!![]}];}return db[_0xef88('0x3f')][_0xef88('0x40')](_0x1d4d57);})[_0xef88('0x1f')](function(_0x48a0e6){_0x31b8f7[_0xef88('0x41')]=_0x48a0e6;return _0x31b8f7;})['then'](respondWithFilteredResult(_0x455e90,_0x1d4d57))[_0xef88('0x42')](handleError(_0x455e90,null));};exports[_0xef88('0x43')]=function(_0xa3548,_0x626cc6){var _0x41d328={'raw':![],'where':{'id':_0xa3548['params']['id']}},_0x109a80={};_0x109a80['model']=_[_0xef88('0x2e')](db[_0xef88('0x3f')]['rawAttributes']);_0x109a80['query']=_[_0xef88('0x2e')](_0xa3548['query']);_0x109a80[_0xef88('0x2f')]=_[_0xef88('0x30')](_0x109a80[_0xef88('0x2c')],_0x109a80[_0xef88('0x2d')]);_0x41d328[_0xef88('0x31')]=_[_0xef88('0x30')](_0x109a80[_0xef88('0x2c')],qs[_0xef88('0x32')](_0xa3548[_0xef88('0x2d')][_0xef88('0x32')]));_0x41d328['attributes']=_0x41d328[_0xef88('0x31')][_0xef88('0x33')]?_0x41d328[_0xef88('0x31')]:_0x109a80['model'];if(_0xa3548['query'][_0xef88('0x3d')]){_0x41d328[_0xef88('0x3e')]=[{'all':!![]}];}_0x41d328=_[_0xef88('0x3b')]({},_0x41d328,_0xa3548[_0xef88('0x44')]);return db['Automation']['find'](_0x41d328)[_0xef88('0x1f')](handleEntityNotFound(_0x626cc6,null))[_0xef88('0x1f')](respondWithResult(_0x626cc6,null))[_0xef88('0x42')](handleError(_0x626cc6,null));};exports['create']=function(_0x5e77ac,_0x19feb7){return db[_0xef88('0x3f')][_0xef88('0x45')](_0x5e77ac['body'],{})[_0xef88('0x1f')](respondWithResult(_0x19feb7,0xc9))[_0xef88('0x42')](handleError(_0x19feb7,null));};exports[_0xef88('0x1e')]=function(_0xe86b9,_0x47fa09){if(_0xe86b9[_0xef88('0x46')]['id']){delete _0xe86b9[_0xef88('0x46')]['id'];}return db[_0xef88('0x3f')][_0xef88('0x47')]({'where':{'id':_0xe86b9[_0xef88('0x48')]['id']}})[_0xef88('0x1f')](handleEntityNotFound(_0x47fa09,null))[_0xef88('0x1f')](saveUpdates(_0xe86b9[_0xef88('0x46')],null))[_0xef88('0x1f')](respondWithResult(_0x47fa09,null))[_0xef88('0x42')](handleError(_0x47fa09,null));};exports['destroy']=function(_0x3c5656,_0x4a0aa2){return db[_0xef88('0x3f')][_0xef88('0x47')]({'where':{'id':_0x3c5656[_0xef88('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a0aa2,null))['then'](removeEntity(_0x4a0aa2,null))['catch'](handleError(_0x4a0aa2,null));};exports[_0xef88('0x49')]=function(_0x5d87db,_0x658cc6,_0x2a0e4f){return db[_0xef88('0x4a')][_0xef88('0x47')]({'where':{'id':_0x5d87db[_0xef88('0x48')]['id']}})[_0xef88('0x1f')](handleEntityNotFound(_0x658cc6,null))[_0xef88('0x1f')](function(_0x125fec){if(_0x125fec){return _0x125fec[_0xef88('0x49')](_0x5d87db[_0xef88('0x46')]['ids'],_[_0xef88('0x4b')](_0x5d87db[_0xef88('0x46')],[_0xef88('0x4c'),'id'])||{});}})[_0xef88('0x1f')](respondWithResult(_0x658cc6,null))['catch'](handleError(_0x658cc6,null));};exports[_0xef88('0x4d')]=function(_0x450835,_0x393d71,_0x3c06ab){var _0xeed3d2={};var _0x2e9f52={};var _0x2444c0;var _0x425632;return db[_0xef88('0x3f')][_0xef88('0x4e')]({'where':{'id':_0x450835['params']['id']}})[_0xef88('0x1f')](handleEntityNotFound(_0x393d71,null))['then'](function(_0x2873ae){if(_0x2873ae){_0x2444c0=_0x2873ae;_0x2e9f52[_0xef88('0x2c')]=_['keys'](db['Condition'][_0xef88('0x28')]);_0x2e9f52[_0xef88('0x2d')]=_[_0xef88('0x2e')](_0x450835[_0xef88('0x2d')]);_0x2e9f52[_0xef88('0x2f')]=_[_0xef88('0x30')](_0x2e9f52['model'],_0x2e9f52[_0xef88('0x2d')]);_0xeed3d2[_0xef88('0x31')]=_['intersection'](_0x2e9f52[_0xef88('0x2c')],qs[_0xef88('0x32')](_0x450835[_0xef88('0x2d')][_0xef88('0x32')]));_0xeed3d2['attributes']=_0xeed3d2[_0xef88('0x31')][_0xef88('0x33')]?_0xeed3d2['attributes']:_0x2e9f52['model'];_0xeed3d2[_0xef88('0x36')]=qs[_0xef88('0x37')](_0x450835[_0xef88('0x2d')][_0xef88('0x37')]);_0xeed3d2[_0xef88('0x38')]=qs['filters'](_[_0xef88('0x39')](_0x450835[_0xef88('0x2d')],_0x2e9f52['filters']));if(_0x450835[_0xef88('0x2d')][_0xef88('0x3a')]){_0xeed3d2['where']=_[_0xef88('0x3b')](_0xeed3d2[_0xef88('0x38')],{'$or':_[_0xef88('0x27')](_0xeed3d2[_0xef88('0x31')],function(_0xde0a86){var _0x2aa933={};_0x2aa933[_0xde0a86]={'$like':'%'+_0x450835['query'][_0xef88('0x3a')]+'%'};return _0x2aa933;})});}_0xeed3d2=_[_0xef88('0x3b')]({},_0xeed3d2,_0x450835[_0xef88('0x44')]);return _0x2444c0[_0xef88('0x4d')](_0xeed3d2);}})[_0xef88('0x1f')](function(_0x52df6e){if(_0x52df6e){_0x425632=_0x52df6e['length'];if(!_0x450835['query']['hasOwnProperty'](_0xef88('0x35'))){_0xeed3d2[_0xef88('0x17')]=qs[_0xef88('0x17')](_0x450835[_0xef88('0x2d')][_0xef88('0x17')]);_0xeed3d2['offset']=qs[_0xef88('0x15')](_0x450835[_0xef88('0x2d')]['offset']);}return _0x2444c0[_0xef88('0x4d')](_0xeed3d2);}})[_0xef88('0x1f')](function(_0x277b8e){if(_0x277b8e){return _0x277b8e?{'count':_0x425632,'rows':_0x277b8e}:null;}})['then'](respondWithResult(_0x393d71,null))[_0xef88('0x42')](handleError(_0x393d71,null));};exports[_0xef88('0x4f')]=function(_0x4983ec,_0x19e4a9,_0x55e33c){return db['Action'][_0xef88('0x47')]({'where':{'id':_0x4983ec[_0xef88('0x48')]['id']}})[_0xef88('0x1f')](handleEntityNotFound(_0x19e4a9,null))[_0xef88('0x1f')](function(_0x2d5ffb){if(_0x2d5ffb){return _0x2d5ffb[_0xef88('0x4f')](_0x4983ec[_0xef88('0x46')][_0xef88('0x4c')],_['omit'](_0x4983ec[_0xef88('0x46')],[_0xef88('0x4c'),'id'])||{});}})[_0xef88('0x1f')](respondWithResult(_0x19e4a9,null))['catch'](handleError(_0x19e4a9,null));};exports[_0xef88('0x50')]=function(_0x19306e,_0x3cd7b8,_0x177b7c){var _0x1ccdd1={};var _0x1c22dd={};var _0x1a940e;var _0x403701;return db[_0xef88('0x3f')]['findOne']({'where':{'id':_0x19306e['params']['id']}})['then'](handleEntityNotFound(_0x3cd7b8,null))[_0xef88('0x1f')](function(_0xcb86d2){if(_0xcb86d2){_0x1a940e=_0xcb86d2;_0x1c22dd[_0xef88('0x2c')]=_['keys'](db[_0xef88('0x51')][_0xef88('0x28')]);_0x1c22dd[_0xef88('0x2d')]=_['keys'](_0x19306e[_0xef88('0x2d')]);_0x1c22dd[_0xef88('0x2f')]=_[_0xef88('0x30')](_0x1c22dd[_0xef88('0x2c')],_0x1c22dd['query']);_0x1ccdd1['attributes']=_[_0xef88('0x30')](_0x1c22dd[_0xef88('0x2c')],qs[_0xef88('0x32')](_0x19306e[_0xef88('0x2d')]['fields']));_0x1ccdd1[_0xef88('0x31')]=_0x1ccdd1[_0xef88('0x31')][_0xef88('0x33')]?_0x1ccdd1[_0xef88('0x31')]:_0x1c22dd['model'];_0x1ccdd1[_0xef88('0x36')]=qs[_0xef88('0x37')](_0x19306e[_0xef88('0x2d')]['sort']);_0x1ccdd1['where']=qs[_0xef88('0x2f')](_['pick'](_0x19306e[_0xef88('0x2d')],_0x1c22dd['filters']));if(_0x19306e[_0xef88('0x2d')][_0xef88('0x3a')]){_0x1ccdd1[_0xef88('0x38')]=_[_0xef88('0x3b')](_0x1ccdd1['where'],{'$or':_[_0xef88('0x27')](_0x1ccdd1['attributes'],function(_0x3572c2){var _0x3e6a6f={};_0x3e6a6f[_0x3572c2]={'$like':'%'+_0x19306e[_0xef88('0x2d')][_0xef88('0x3a')]+'%'};return _0x3e6a6f;})});}_0x1ccdd1=_[_0xef88('0x3b')]({},_0x1ccdd1,_0x19306e[_0xef88('0x44')]);return _0x1a940e[_0xef88('0x50')](_0x1ccdd1);}})[_0xef88('0x1f')](function(_0x11de88){if(_0x11de88){_0x403701=_0x11de88[_0xef88('0x33')];if(!_0x19306e[_0xef88('0x2d')][_0xef88('0x34')](_0xef88('0x35'))){_0x1ccdd1[_0xef88('0x17')]=qs['limit'](_0x19306e[_0xef88('0x2d')][_0xef88('0x17')]);_0x1ccdd1[_0xef88('0x15')]=qs[_0xef88('0x15')](_0x19306e[_0xef88('0x2d')][_0xef88('0x15')]);}return _0x1a940e[_0xef88('0x50')](_0x1ccdd1);}})[_0xef88('0x1f')](function(_0x3c82ba){if(_0x3c82ba){return _0x3c82ba?{'count':_0x403701,'rows':_0x3c82ba}:null;}})[_0xef88('0x1f')](respondWithResult(_0x3cd7b8,null))['catch'](handleError(_0x3cd7b8,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index fefbfac..68f9e25 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 _0x3394=['lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./automation.attributes','exports','define'];(function(_0x63f0f5,_0x3bcb73){var _0x497e6f=function(_0x3a48d1){while(--_0x3a48d1){_0x63f0f5['push'](_0x63f0f5['shift']());}};_0x497e6f(++_0x3bcb73);}(_0x3394,0x19e));var _0x4339=function(_0x327322,_0x3cb679){_0x327322=_0x327322-0x0;var _0x5a199b=_0x3394[_0x327322];return _0x5a199b;};'use strict';var _=require(_0x4339('0x0'));var util=require(_0x4339('0x1'));var logger=require(_0x4339('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4339('0x3'));var rp=require(_0x4339('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4339('0x5'));var attributes=require(_0x4339('0x6'));module[_0x4339('0x7')]=function(_0x488227,_0x118cca){return _0x488227[_0x4339('0x8')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x163e=['util','../../config/logger','api','bluebird','path','rimraf','./automation.attributes','define','Automation','tools_automations','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x163e,0x8e));var _0xe163=function(_0x1d9d12,_0x2c7d98){_0x1d9d12=_0x1d9d12-0x0;var _0x4f680e=_0x163e[_0x1d9d12];return _0x4f680e;};'use strict';var _=require(_0xe163('0x0'));var util=require(_0xe163('0x1'));var logger=require(_0xe163('0x2'))(_0xe163('0x3'));var moment=require('moment');var BPromise=require(_0xe163('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe163('0x5'));var rimraf=require(_0xe163('0x6'));var config=require('../../config/environment');var attributes=require(_0xe163('0x7'));module['exports']=function(_0x57e607,_0x511e9c){return _0x57e607[_0xe163('0x8')](_0xe163('0x9'),attributes,{'tableName':_0xe163('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 0d6b377..015ac9e 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 _0x2fe5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','message','Automation,\x20%s,\x20%s','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0x2fe5,0x14b));var _0x52fe=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2fe5[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x52fe('0x0'));var util=require(_0x52fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x52fe('0x2'));var fs=require('fs');var Redis=require(_0x52fe('0x3'));var db=require(_0x52fe('0x4'))['db'];var utils=require(_0x52fe('0x5'));var logger=require(_0x52fe('0x6'))('rpc');var config=require(_0x52fe('0x7'));var jayson=require(_0x52fe('0x8'));var client=jayson['client'][_0x52fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x157c5a,_0x2b3f41,_0x31b5dd){return new BPromise(function(_0x408cef,_0x49f7d9){return client[_0x52fe('0xa')](_0x157c5a,_0x31b5dd)[_0x52fe('0xb')](function(_0xe73ece){logger['info']('Automation,\x20%s,\x20%s',_0x2b3f41,_0x52fe('0xc'));logger[_0x52fe('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0x2b3f41,_0x52fe('0xc'),JSON[_0x52fe('0xe')](_0xe73ece));if(_0xe73ece[_0x52fe('0xf')]){if(_0xe73ece[_0x52fe('0xf')]['code']===0x1f4){logger[_0x52fe('0xf')]('Automation,\x20%s,\x20%s',_0x2b3f41,_0xe73ece[_0x52fe('0xf')]['message']);return _0x49f7d9(_0xe73ece[_0x52fe('0xf')][_0x52fe('0x10')]);}logger[_0x52fe('0xf')](_0x52fe('0x11'),_0x2b3f41,_0xe73ece['error'][_0x52fe('0x10')]);return _0x408cef(_0xe73ece[_0x52fe('0xf')][_0x52fe('0x10')]);}else{logger[_0x52fe('0x12')](_0x52fe('0x11'),_0x2b3f41,_0x52fe('0xc'));_0x408cef(_0xe73ece[_0x52fe('0x13')][_0x52fe('0x10')]);}})[_0x52fe('0x14')](function(_0x33ab22){logger['error']('Automation,\x20%s,\x20%s',_0x2b3f41,_0x33ab22);_0x49f7d9(_0x33ab22);});});} \ No newline at end of file +var _0xbe51=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x29a912,_0x15f61e){var _0x254b81=function(_0x5428e9){while(--_0x5428e9){_0x29a912['push'](_0x29a912['shift']());}};_0x254b81(++_0x15f61e);}(_0xbe51,0x1e2));var _0x1be5=function(_0x1d5b3d,_0x5c7145){_0x1d5b3d=_0x1d5b3d-0x0;var _0xc810b9=_0xbe51[_0x1d5b3d];return _0xc810b9;};'use strict';var _=require(_0x1be5('0x0'));var util=require(_0x1be5('0x1'));var moment=require('moment');var BPromise=require(_0x1be5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1be5('0x3'));var db=require(_0x1be5('0x4'))['db'];var utils=require(_0x1be5('0x5'));var logger=require(_0x1be5('0x6'))(_0x1be5('0x7'));var config=require(_0x1be5('0x8'));var jayson=require(_0x1be5('0x9'));var client=jayson[_0x1be5('0xa')][_0x1be5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13fa3e,_0xf4a39f,_0x49e05a){return new BPromise(function(_0x484d9b,_0x1171b0){return client['request'](_0x13fa3e,_0x49e05a)[_0x1be5('0xc')](function(_0x36c7c2){logger['info'](_0x1be5('0xd'),_0xf4a39f,_0x1be5('0xe'));logger[_0x1be5('0xf')](_0x1be5('0x10'),_0xf4a39f,_0x1be5('0xe'),JSON[_0x1be5('0x11')](_0x36c7c2));if(_0x36c7c2[_0x1be5('0x12')]){if(_0x36c7c2['error'][_0x1be5('0x13')]===0x1f4){logger['error'](_0x1be5('0xd'),_0xf4a39f,_0x36c7c2[_0x1be5('0x12')][_0x1be5('0x14')]);return _0x1171b0(_0x36c7c2['error'][_0x1be5('0x14')]);}logger['error'](_0x1be5('0xd'),_0xf4a39f,_0x36c7c2[_0x1be5('0x12')][_0x1be5('0x14')]);return _0x484d9b(_0x36c7c2[_0x1be5('0x12')][_0x1be5('0x14')]);}else{logger[_0x1be5('0x15')](_0x1be5('0xd'),_0xf4a39f,'request\x20sent');_0x484d9b(_0x36c7c2[_0x1be5('0x16')][_0x1be5('0x14')]);}})[_0x1be5('0x17')](function(_0x3ca2b5){logger[_0x1be5('0x12')](_0x1be5('0xd'),_0xf4a39f,_0x3ca2b5);_0x1171b0(_0x3ca2b5);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index a3d253f..9760e34 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 _0x04de=['getActions','post','create','addConditions','/:id/actions','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','/:id','isAuthenticated','show','get','/:id/conditions','getConditions'];(function(_0x376b10,_0x3a5cd0){var _0xb187e8=function(_0x3c75ee){while(--_0x3c75ee){_0x376b10['push'](_0x376b10['shift']());}};_0xb187e8(++_0x3a5cd0);}(_0x04de,0x107));var _0xe04d=function(_0x210ee7,_0x5eb15b){_0x210ee7=_0x210ee7-0x0;var _0x4bd246=_0x04de[_0x210ee7];return _0x4bd246;};'use strict';var multer=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var path=require(_0xe04d('0x2'));var timeout=require(_0xe04d('0x3'));var express=require(_0xe04d('0x4'));var router=express[_0xe04d('0x5')]();var fs_extra=require(_0xe04d('0x6'));var auth=require(_0xe04d('0x7'));var interaction=require(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var controller=require(_0xe04d('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe04d('0xb'),auth[_0xe04d('0xc')](),controller[_0xe04d('0xd')]);router[_0xe04d('0xe')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x10')]);router[_0xe04d('0xe')]('/:id/actions',auth[_0xe04d('0xc')](),controller[_0xe04d('0x11')]);router[_0xe04d('0x12')]('/',auth[_0xe04d('0xc')](),controller[_0xe04d('0x13')]);router[_0xe04d('0x12')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x14')]);router['post'](_0xe04d('0x15'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x16')]);router[_0xe04d('0x17')](_0xe04d('0xb'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x18')]);router[_0xe04d('0x19')](_0xe04d('0xb'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x1a')]);module[_0xe04d('0x1b')]=router; \ No newline at end of file +var _0xef8b=['/:id','show','/:id/actions','isAuthenticated','getActions','post','create','/:id/conditions','addConditions','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0xef8b,0x192));var _0xbef8=function(_0x4b9978,_0x58eb71){_0x4b9978=_0x4b9978-0x0;var _0x42f0e5=_0xef8b[_0x4b9978];return _0x42f0e5;};'use strict';var multer=require('multer');var util=require(_0xbef8('0x0'));var path=require(_0xbef8('0x1'));var timeout=require(_0xbef8('0x2'));var express=require(_0xbef8('0x3'));var router=express[_0xbef8('0x4')]();var fs_extra=require(_0xbef8('0x5'));var auth=require(_0xbef8('0x6'));var interaction=require(_0xbef8('0x7'));var config=require(_0xbef8('0x8'));var controller=require(_0xbef8('0x9'));router[_0xbef8('0xa')]('/',auth['isAuthenticated'](),controller[_0xbef8('0xb')]);router[_0xbef8('0xa')](_0xbef8('0xc'),auth['isAuthenticated'](),controller[_0xbef8('0xd')]);router[_0xbef8('0xa')]('/:id/conditions',auth['isAuthenticated'](),controller['getConditions']);router[_0xbef8('0xa')](_0xbef8('0xe'),auth[_0xbef8('0xf')](),controller[_0xbef8('0x10')]);router[_0xbef8('0x11')]('/',auth[_0xbef8('0xf')](),controller[_0xbef8('0x12')]);router[_0xbef8('0x11')](_0xbef8('0x13'),auth['isAuthenticated'](),controller[_0xbef8('0x14')]);router[_0xbef8('0x11')](_0xbef8('0xe'),auth['isAuthenticated'](),controller['addActions']);router['put'](_0xbef8('0xc'),auth['isAuthenticated'](),controller[_0xbef8('0x15')]);router[_0xbef8('0x16')]('/:id',auth[_0xbef8('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index fd8dd23..28b92ac 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 _0xafcd=['NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','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)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#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)'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xafcd,0x157));var _0xdafc=function(_0x348ea7,_0x591405){_0x348ea7=_0x348ea7-0x0;var _0x5eafdf=_0xafcd[_0x348ea7];return _0x5eafdf;};'use strict';var Sequelize=require(_0xdafc('0x0'));module[_0xdafc('0x1')]={'name':{'type':Sequelize[_0xdafc('0x2')],'unique':_0xdafc('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xdafc('0x4')](_0xdafc('0x5')),'allowNull':![],'defaultValue':_0xdafc('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xdafc('0x6')],'defaultValue':0x0,'comment':_0xdafc('0x7')},'limitCalls':{'type':Sequelize[_0xdafc('0x8')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xdafc('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdafc('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdafc('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xdafc('0xa')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdafc('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xdafc('0x8')](0x3)[_0xdafc('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdafc('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdafc('0x8')](0x5)[_0xdafc('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdafc('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0xdafc('0x8')](0x3)[_0xdafc('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdafc('0xe')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdafc('0xf')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdafc('0x8')](0x3)[_0xdafc('0xa')],'defaultValue':0x3,'comment':_0xdafc('0x10')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdafc('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdafc('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xdafc('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xdafc('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xdafc('0x4')](_0xdafc('0x12'),_0xdafc('0x13'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xdafc('0x6')],'defaultValue':0x0,'comment':_0xdafc('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xdafc('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xdafc('0x8')](0x9)[_0xdafc('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdafc('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdafc('0x8')](0x9)[_0xdafc('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdafc('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdafc('0x8')](0x9)[_0xdafc('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xdafc('0x8')](0x9)[_0xdafc('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdafc('0x8')](0x9)[_0xdafc('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdafc('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdafc('0x8')](0x9)[_0xdafc('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdafc('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdafc('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdafc('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xdafc('0x4')](_0xdafc('0x1a'),_0xdafc('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xdafc('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdafc('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdafc('0x1c')},'dialCutDigit':{'type':Sequelize[_0xdafc('0x8')](0x3)[_0xdafc('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdafc('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdafc('0x8')](0x3)[_0xdafc('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdafc('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdafc('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdafc('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdafc('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdafc('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdafc('0x8')](0x3)[_0xdafc('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdafc('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdafc('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdafc('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0xdafc('0x8')](0x5)[_0xdafc('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdafc('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdafc('0x8')](0x3)[_0xdafc('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdafc('0x8')](0x5)[_0xdafc('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x51f7=['#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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)'];(function(_0x36dc42,_0x1eab95){var _0x3e617a=function(_0x1ce6ed){while(--_0x1ce6ed){_0x36dc42['push'](_0x36dc42['shift']());}};_0x3e617a(++_0x1eab95);}(_0x51f7,0x144));var _0x751f=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0x51f7[_0x3e8270];return _0x1ccde9;};'use strict';var Sequelize=require('sequelize');module[_0x751f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x751f('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x751f('0x2')](_0x751f('0x3')),'allowNull':![],'defaultValue':_0x751f('0x3')},'description':{'type':Sequelize[_0x751f('0x4')]},'active':{'type':Sequelize[_0x751f('0x5')],'defaultValue':0x0,'comment':_0x751f('0x6')},'limitCalls':{'type':Sequelize[_0x751f('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x751f('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x751f('0x7')](0x3)[_0x751f('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x751f('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x751f('0x7')](0x3)[_0x751f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x751f('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x751f('0x7')](0x5)[_0x751f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x751f('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x751f('0x7')](0x3)[_0x751f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x751f('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x751f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x751f('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x751f('0x7')](0x3)[_0x751f('0x8')],'defaultValue':0x3,'comment':_0x751f('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x751f('0x7')](0x5)[_0x751f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x751f('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x751f('0x7')](0x3)[_0x751f('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x751f('0x10')},'dialTimezone':{'type':Sequelize[_0x751f('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x751f('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x751f('0x2')]('always','never','onlyIfOpen'),'defaultValue':_0x751f('0x12')},'dialAMDActive':{'type':Sequelize[_0x751f('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x751f('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x751f('0x7')](0x9)[_0x751f('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x751f('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x751f('0x7')](0x9)[_0x751f('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x751f('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x751f('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x751f('0x7')](0x9)[_0x751f('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x751f('0x7')](0x9)[_0x751f('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x751f('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x751f('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x751f('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x751f('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x751f('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0x751f('0x2')]('DESC','ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x751f('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x751f('0x18')},'dialCutDigit':{'type':Sequelize[_0x751f('0x7')](0x3)[_0x751f('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x751f('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x751f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x751f('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x751f('0x7')](0x5)[_0x751f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x751f('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0x751f('0x7')](0x3)[_0x751f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x751f('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0x751f('0x7')](0x5)[_0x751f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x751f('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x751f('0x7')](0x3)[_0x751f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x751f('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x751f('0x7')](0x5)[_0x751f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x751f('0x7')](0x3)[_0x751f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x751f('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x751f('0x7')](0x5)[_0x751f('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x751f('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x751f('0x7')](0x3)[_0x751f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x751f('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x751f('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x751f('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index d160a1d..424ffce 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 _0x18a9=['intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CmHopper','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','createdAt','field','NOW()','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','cm_hopper','scheduledAt','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','index','Campaign','rawAttributes','type','key','model','map','query','keys','filters'];(function(_0x4f1a1c,_0x58251a){var _0x1abeeb=function(_0x3de157){while(--_0x3de157){_0x4f1a1c['push'](_0x4f1a1c['shift']());}};_0x1abeeb(++_0x58251a);}(_0x18a9,0x17e));var _0x918a=function(_0x365cf4,_0x54cd92){_0x365cf4=_0x365cf4-0x0;var _0x4f5059=_0x18a9[_0x365cf4];return _0x4f5059;};'use strict';var emlformat=require(_0x918a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x918a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x918a('0x2'));var moment=require(_0x918a('0x3'));var BPromise=require(_0x918a('0x4'));var Mustache=require(_0x918a('0x5'));var util=require(_0x918a('0x6'));var path=require(_0x918a('0x7'));var sox=require(_0x918a('0x8'));var csv=require(_0x918a('0x9'));var ejs=require(_0x918a('0xa'));var fs=require('fs');var fs_extra=require(_0x918a('0xb'));var _=require('lodash');var squel=require(_0x918a('0xc'));var crypto=require('crypto');var jsforce=require(_0x918a('0xd'));var deskjs=require(_0x918a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x918a('0xf'));var Papa=require('papaparse');var Redis=require(_0x918a('0x10'));var authService=require(_0x918a('0x11'));var qs=require(_0x918a('0x12'));var as=require(_0x918a('0x13'));var hardwareService=require(_0x918a('0x14'));var logger=require('../../config/logger')(_0x918a('0x15'));var utils=require(_0x918a('0x16'));var config=require(_0x918a('0x17'));var licenseUtil=require(_0x918a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b8a42,_0x3f02af){_0x3f02af=_0x3f02af||0xcc;return function(_0x316b36){if(_0x316b36){return _0x1b8a42['sendStatus'](_0x3f02af);}return _0x1b8a42[_0x918a('0x19')](_0x3f02af)[_0x918a('0x1a')]();};}function respondWithResult(_0xb72115,_0x53f115){_0x53f115=_0x53f115||0xc8;return function(_0x41e8b0){if(_0x41e8b0){return _0xb72115[_0x918a('0x19')](_0x53f115)['json'](_0x41e8b0);}};}function respondWithFilteredResult(_0x543a84,_0x149566){return function(_0xf6ef2b){if(_0xf6ef2b){var _0x3ec709=typeof _0x149566['offset']===_0x918a('0x1b')&&typeof _0x149566[_0x918a('0x1c')]==='undefined';var _0x3912bc=_0xf6ef2b[_0x918a('0x1d')];var _0x3b5f4b=_0x3ec709?0x0:_0x149566['offset'];var _0x124804=_0x3ec709?_0xf6ef2b[_0x918a('0x1d')]:_0x149566['offset']+_0x149566[_0x918a('0x1c')];var _0x4b7458;if(_0x124804>=_0x3912bc){_0x124804=_0x3912bc;_0x4b7458=0xc8;}else{_0x4b7458=0xce;}_0x543a84['status'](_0x4b7458);return _0x543a84['set'](_0x918a('0x1e'),_0x3b5f4b+'-'+_0x124804+'/'+_0x3912bc)[_0x918a('0x1f')](_0xf6ef2b);}return null;};}function patchUpdates(_0x5e2cb0){return function(_0x1cc225){try{jsonpatch[_0x918a('0x20')](_0x1cc225,_0x5e2cb0,!![]);}catch(_0x34f0c2){return BPromise[_0x918a('0x21')](_0x34f0c2);}return _0x1cc225[_0x918a('0x22')]();};}function saveUpdates(_0xa9110d,_0x1c5f9b){return function(_0x18bdac){if(_0x18bdac){return _0x18bdac[_0x918a('0x23')](_0xa9110d)[_0x918a('0x24')](function(_0x3d090c){return _0x3d090c;});}return null;};}function removeEntity(_0x5a4d87,_0x186fb5){return function(_0x4e4399){if(_0x4e4399){return _0x4e4399[_0x918a('0x25')]()[_0x918a('0x24')](function(){var _0x55256a=_0x4e4399[_0x918a('0x26')]({'plain':!![]});var _0x2ac566=_0x918a('0x27');return db[_0x918a('0x28')]['destroy']({'where':{'type':_0x2ac566,'resourceId':_0x55256a['id']}})[_0x918a('0x24')](function(){return _0x4e4399;});})[_0x918a('0x24')](function(){_0x5a4d87['status'](0xcc)[_0x918a('0x1a')]();});}};}function handleEntityNotFound(_0x1604fd,_0x4cd551){return function(_0x2fe4e7){if(!_0x2fe4e7){_0x1604fd[_0x918a('0x29')](0x194);}return _0x2fe4e7;};}function handleError(_0x24e49c,_0x52a57b){_0x52a57b=_0x52a57b||0x1f4;return function(_0x3a2fe2){logger[_0x918a('0x2a')](_0x3a2fe2[_0x918a('0x2b')]);if(_0x3a2fe2['name']){delete _0x3a2fe2[_0x918a('0x2c')];}_0x24e49c['status'](_0x52a57b)[_0x918a('0x2d')](_0x3a2fe2);};}exports[_0x918a('0x2e')]=function(_0x52969e,_0xd21ff3){var _0x3e02c0={},_0x2b9d34={},_0x9d9a98={'count':0x0,'rows':[]};var _0x1c2e2f=_['map'](db[_0x918a('0x2f')][_0x918a('0x30')],function(_0x41aa2f){return{'name':_0x41aa2f['fieldName'],'type':_0x41aa2f[_0x918a('0x31')][_0x918a('0x32')]};});_0x2b9d34[_0x918a('0x33')]=_[_0x918a('0x34')](_0x1c2e2f,_0x918a('0x2c'));_0x2b9d34[_0x918a('0x35')]=_[_0x918a('0x36')](_0x52969e['query']);_0x2b9d34[_0x918a('0x37')]=_[_0x918a('0x38')](_0x2b9d34[_0x918a('0x33')],_0x2b9d34[_0x918a('0x35')]);_0x3e02c0[_0x918a('0x39')]=_[_0x918a('0x38')](_0x2b9d34[_0x918a('0x33')],qs[_0x918a('0x3a')](_0x52969e[_0x918a('0x35')][_0x918a('0x3a')]));_0x3e02c0[_0x918a('0x39')]=_0x3e02c0['attributes'][_0x918a('0x3b')]?_0x3e02c0['attributes']:_0x2b9d34[_0x918a('0x33')];if(!_0x52969e[_0x918a('0x35')][_0x918a('0x3c')](_0x918a('0x3d'))){_0x3e02c0[_0x918a('0x1c')]=qs[_0x918a('0x1c')](_0x52969e['query'][_0x918a('0x1c')]);_0x3e02c0[_0x918a('0x3e')]=qs['offset'](_0x52969e[_0x918a('0x35')][_0x918a('0x3e')]);}_0x3e02c0[_0x918a('0x3f')]=qs[_0x918a('0x40')](_0x52969e[_0x918a('0x35')][_0x918a('0x40')]);_0x3e02c0[_0x918a('0x41')]=qs[_0x918a('0x37')](_['pick'](_0x52969e[_0x918a('0x35')],_0x2b9d34['filters']),_0x1c2e2f);if(_0x52969e[_0x918a('0x35')][_0x918a('0x42')]){_0x3e02c0['where']=_[_0x918a('0x43')](_0x3e02c0[_0x918a('0x41')],{'$or':_[_0x918a('0x34')](_0x1c2e2f,function(_0x138a6c){if(_0x138a6c[_0x918a('0x31')]!==_0x918a('0x44')){var _0x4b3c5a={};_0x4b3c5a[_0x138a6c[_0x918a('0x2c')]]={'$like':'%'+_0x52969e['query'][_0x918a('0x42')]+'%'};return _0x4b3c5a;}})});}_0x3e02c0=_[_0x918a('0x43')]({},_0x3e02c0,_0x52969e[_0x918a('0x45')]);var _0x30e7b3={'where':_0x3e02c0[_0x918a('0x41')]};return db[_0x918a('0x2f')]['count'](_0x30e7b3)[_0x918a('0x24')](function(_0xf91204){_0x9d9a98['count']=_0xf91204;if(_0x52969e[_0x918a('0x35')]['includeAll']){_0x3e02c0[_0x918a('0x46')]=[{'all':!![]}];}return db['Campaign'][_0x918a('0x47')](_0x3e02c0);})[_0x918a('0x24')](function(_0x463fa0){_0x9d9a98[_0x918a('0x48')]=_0x463fa0;return _0x9d9a98;})[_0x918a('0x24')](respondWithFilteredResult(_0xd21ff3,_0x3e02c0))[_0x918a('0x49')](handleError(_0xd21ff3,null));};exports[_0x918a('0x4a')]=function(_0x53913d,_0x53de1c){var _0x58af7e={'raw':![],'where':{'id':_0x53913d[_0x918a('0x4b')]['id']}},_0x1b8298={};_0x1b8298['model']=_[_0x918a('0x36')](db[_0x918a('0x2f')]['rawAttributes']);_0x1b8298[_0x918a('0x35')]=_[_0x918a('0x36')](_0x53913d['query']);_0x1b8298['filters']=_[_0x918a('0x38')](_0x1b8298[_0x918a('0x33')],_0x1b8298['query']);_0x58af7e[_0x918a('0x39')]=_[_0x918a('0x38')](_0x1b8298['model'],qs[_0x918a('0x3a')](_0x53913d[_0x918a('0x35')][_0x918a('0x3a')]));_0x58af7e[_0x918a('0x39')]=_0x58af7e['attributes'][_0x918a('0x3b')]?_0x58af7e[_0x918a('0x39')]:_0x1b8298[_0x918a('0x33')];if(_0x53913d[_0x918a('0x35')][_0x918a('0x4c')]){_0x58af7e['include']=[{'all':!![]}];}_0x58af7e=_[_0x918a('0x43')]({},_0x58af7e,_0x53913d[_0x918a('0x45')]);return db[_0x918a('0x2f')][_0x918a('0x4d')](_0x58af7e)['then'](handleEntityNotFound(_0x53de1c,null))['then'](respondWithResult(_0x53de1c,null))[_0x918a('0x49')](handleError(_0x53de1c,null));};exports[_0x918a('0x4e')]=function(_0xb991d1,_0x248313){return db['Campaign'][_0x918a('0x4e')](_0xb991d1['body'],{})['then'](function(_0x49fde2){var _0x51d3c6=_0xb991d1[_0x918a('0x4f')][_0x918a('0x26')]({'plain':!![]});if(!_0x51d3c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51d3c6[_0x918a('0x50')]===_0x918a('0x4f')){var _0x13f1fa=_0x49fde2['get']({'plain':!![]});var _0x4360cc='IvrCampaigns';return db[_0x918a('0x51')][_0x918a('0x4d')]({'where':{'name':_0x4360cc,'userProfileId':_0x51d3c6[_0x918a('0x52')]},'raw':!![]})[_0x918a('0x24')](function(_0x496c45){if(_0x496c45&&_0x496c45[_0x918a('0x53')]===0x0){return db[_0x918a('0x28')]['create']({'name':_0x13f1fa[_0x918a('0x2c')],'resourceId':_0x13f1fa['id'],'type':_0x496c45[_0x918a('0x2c')],'sectionId':_0x496c45['id']},{})[_0x918a('0x24')](function(){return _0x49fde2;});}else{return _0x49fde2;}})[_0x918a('0x49')](function(_0x19a8cb){logger[_0x918a('0x2a')](_0x918a('0x54'),_0x19a8cb);throw _0x19a8cb;});}return _0x49fde2;})[_0x918a('0x24')](respondWithResult(_0x248313,0xc9))['catch'](handleError(_0x248313,null));};exports['clone']=function(_0x14e64d,_0x298998){var _0x1047e5={'where':{'id':_0x14e64d[_0x918a('0x4b')]['id']}},_0x4cb14e={};_0x4cb14e[_0x918a('0x33')]=_[_0x918a('0x36')](db[_0x918a('0x2f')][_0x918a('0x30')]);_0x1047e5[_0x918a('0x39')]=_[_0x918a('0x38')](_0x4cb14e[_0x918a('0x33')],qs[_0x918a('0x3a')](_0x14e64d['query'][_0x918a('0x3a')]));_0x1047e5['attributes']=_0x1047e5[_0x918a('0x39')][_0x918a('0x3b')]?_0x1047e5[_0x918a('0x39')]:_0x4cb14e[_0x918a('0x33')];if(_0x14e64d[_0x918a('0x35')]['includeAll']){_0x1047e5['include']=[{'all':!![]}];}_0x1047e5=_[_0x918a('0x43')]({},_0x1047e5,_0x14e64d[_0x918a('0x45')]);return db[_0x918a('0x2f')][_0x918a('0x4d')](_0x1047e5)[_0x918a('0x24')](handleEntityNotFound(_0x298998,null))[_0x918a('0x24')](function(_0x9e1378){if(_0x9e1378){var _0x4c36a1=_0x9e1378[_0x918a('0x26')]({'plain':!![]});_0x4c36a1=qs[_0x918a('0x55')](_0x4c36a1,['id','createdAt',_0x918a('0x56')]);_0x14e64d[_0x918a('0x57')]=_['omit'](_0x14e64d[_0x918a('0x57')],['id','createdAt',_0x918a('0x56')]);return db[_0x918a('0x2f')]['create'](_[_0x918a('0x43')](_0x4c36a1,_0x14e64d[_0x918a('0x57')]),{'include':_0x14e64d[_0x918a('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2be04c){var _0x4a8523=_0x14e64d[_0x918a('0x4f')][_0x918a('0x26')]({'plain':!![]});if(!_0x4a8523)throw new Error(_0x918a('0x58'));if(_0x4a8523[_0x918a('0x50')]===_0x918a('0x4f')){var _0x5d0a98=_0x2be04c[_0x918a('0x26')]({'plain':!![]});var _0x3676e0=_0x918a('0x27');return db[_0x918a('0x51')][_0x918a('0x4d')]({'where':{'name':_0x3676e0,'userProfileId':_0x4a8523[_0x918a('0x52')]},'raw':!![]})['then'](function(_0x20ea01){if(_0x20ea01&&_0x20ea01[_0x918a('0x53')]===0x0){return db[_0x918a('0x28')][_0x918a('0x4e')]({'name':_0x5d0a98[_0x918a('0x2c')],'resourceId':_0x5d0a98['id'],'type':_0x20ea01[_0x918a('0x2c')],'sectionId':_0x20ea01['id']},{})[_0x918a('0x24')](function(){return _0x2be04c;});}else{return _0x2be04c;}})[_0x918a('0x49')](function(_0x4a28a0){logger[_0x918a('0x2a')](_0x918a('0x54'),_0x4a28a0);throw _0x4a28a0;});}return _0x2be04c;});}})['then'](respondWithResult(_0x298998,0xc9))[_0x918a('0x49')](handleError(_0x298998,null));};exports['update']=function(_0x50f24f,_0x13c541){if(_0x50f24f[_0x918a('0x57')]['id']){delete _0x50f24f[_0x918a('0x57')]['id'];}return db['Campaign'][_0x918a('0x4d')]({'where':{'id':_0x50f24f[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x13c541,null))[_0x918a('0x24')](saveUpdates(_0x50f24f[_0x918a('0x57')],null))[_0x918a('0x24')](respondWithResult(_0x13c541,null))[_0x918a('0x49')](handleError(_0x13c541,null));};exports[_0x918a('0x25')]=function(_0x316857,_0x2c7b66){return db[_0x918a('0x2f')][_0x918a('0x4d')]({'where':{'id':_0x316857[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x2c7b66,null))[_0x918a('0x24')](removeEntity(_0x2c7b66,null))['catch'](handleError(_0x2c7b66,null));};exports[_0x918a('0x59')]=function(_0xaeb91d,_0x5984cc,_0x3fdd9b){var _0x4a7c9c={'raw':!![],'where':{}};var _0x2871ff={};var _0x50a108={'count':0x0,'rows':[]};return db['Campaign'][_0x918a('0x5a')]({'where':{'id':_0xaeb91d['params']['id']}})['then'](handleEntityNotFound(_0x5984cc,null))['then'](function(_0x53a938){if(_0x53a938){_0x2871ff[_0x918a('0x33')]=_['keys'](db[_0x918a('0x5b')]['rawAttributes']);_0x2871ff[_0x918a('0x35')]=_[_0x918a('0x36')](_0xaeb91d['query']);_0x2871ff[_0x918a('0x37')]=_[_0x918a('0x38')](_0x2871ff['model'],_0x2871ff[_0x918a('0x35')]);_0x4a7c9c[_0x918a('0x39')]=_[_0x918a('0x38')](_0x2871ff['model'],qs[_0x918a('0x3a')](_0xaeb91d['query'][_0x918a('0x3a')]));_0x4a7c9c[_0x918a('0x39')]=_0x4a7c9c['attributes'][_0x918a('0x3b')]?_0x4a7c9c[_0x918a('0x39')]:_0x2871ff[_0x918a('0x33')];if(!_0xaeb91d[_0x918a('0x35')][_0x918a('0x3c')]('nolimit')){_0x4a7c9c[_0x918a('0x1c')]=qs[_0x918a('0x1c')](_0xaeb91d[_0x918a('0x35')][_0x918a('0x1c')]);_0x4a7c9c[_0x918a('0x3e')]=qs[_0x918a('0x3e')](_0xaeb91d[_0x918a('0x35')][_0x918a('0x3e')]);}_0x4a7c9c[_0x918a('0x3f')]=qs['sort'](_0xaeb91d['query'][_0x918a('0x40')]);_0x4a7c9c[_0x918a('0x41')]=qs[_0x918a('0x37')](_[_0x918a('0x5c')](_0xaeb91d[_0x918a('0x35')],_0x2871ff[_0x918a('0x37')]));_0x4a7c9c[_0x918a('0x41')][_0x918a('0x5d')]=_0x53a938['id'];if(_0xaeb91d[_0x918a('0x35')][_0x918a('0x42')]){_0x4a7c9c[_0x918a('0x41')]=_[_0x918a('0x43')](_0x4a7c9c[_0x918a('0x41')],{'$or':_['map'](_0x4a7c9c['attributes'],function(_0x1737d6){var _0x987a4a={};_0x987a4a[_0x1737d6]={'$like':'%'+_0xaeb91d['query'][_0x918a('0x42')]+'%'};return _0x987a4a;})});}_0x4a7c9c=_[_0x918a('0x43')]({},_0x4a7c9c,_0xaeb91d[_0x918a('0x45')]);return db['CmHopper'][_0x918a('0x1d')]({'where':_0x4a7c9c[_0x918a('0x41')]})[_0x918a('0x24')](function(_0x3afd72){_0x50a108[_0x918a('0x1d')]=_0x3afd72;if(_0xaeb91d[_0x918a('0x35')][_0x918a('0x4c')]){_0x4a7c9c[_0x918a('0x46')]=[{'all':!![]}];}return db[_0x918a('0x5b')][_0x918a('0x47')](_0x4a7c9c);})[_0x918a('0x24')](function(_0x53e2c1){_0x50a108['rows']=_0x53e2c1;return _0x50a108;});}})[_0x918a('0x24')](respondWithFilteredResult(_0x5984cc,_0x4a7c9c))[_0x918a('0x49')](handleError(_0x5984cc,null));};exports[_0x918a('0x5e')]=function(_0xcdb8d6,_0x55ffb5,_0x4eafa6){var _0x1639d={'raw':!![],'where':{}};var _0x2698ef={};var _0x323d94={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xcdb8d6['params']['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x55ffb5,null))[_0x918a('0x24')](function(_0x5d0965){if(_0x5d0965){_0x2698ef[_0x918a('0x33')]=_['keys'](db[_0x918a('0x5f')][_0x918a('0x30')]);_0x2698ef['query']=_['keys'](_0xcdb8d6[_0x918a('0x35')]);_0x2698ef['filters']=_['intersection'](_0x2698ef['model'],_0x2698ef[_0x918a('0x35')]);_0x1639d[_0x918a('0x39')]=_[_0x918a('0x38')](_0x2698ef[_0x918a('0x33')],qs[_0x918a('0x3a')](_0xcdb8d6[_0x918a('0x35')][_0x918a('0x3a')]));_0x1639d[_0x918a('0x39')]=_0x1639d[_0x918a('0x39')][_0x918a('0x3b')]?_0x1639d[_0x918a('0x39')]:_0x2698ef[_0x918a('0x33')];if(!_0xcdb8d6['query'][_0x918a('0x3c')](_0x918a('0x3d'))){_0x1639d['limit']=qs['limit'](_0xcdb8d6[_0x918a('0x35')][_0x918a('0x1c')]);_0x1639d['offset']=qs['offset'](_0xcdb8d6[_0x918a('0x35')][_0x918a('0x3e')]);}_0x1639d['order']=qs[_0x918a('0x40')](_0xcdb8d6['query'][_0x918a('0x40')]);_0x1639d[_0x918a('0x41')]=qs[_0x918a('0x37')](_['pick'](_0xcdb8d6[_0x918a('0x35')],_0x2698ef[_0x918a('0x37')]));_0x1639d[_0x918a('0x41')][_0x918a('0x5d')]=_0x5d0965['id'];if(_0xcdb8d6[_0x918a('0x35')][_0x918a('0x42')]){_0x1639d[_0x918a('0x41')]=_['merge'](_0x1639d[_0x918a('0x41')],{'$or':_[_0x918a('0x34')](_0x1639d[_0x918a('0x39')],function(_0xb47646){var _0x5722d0={};_0x5722d0[_0xb47646]={'$like':'%'+_0xcdb8d6[_0x918a('0x35')][_0x918a('0x42')]+'%'};return _0x5722d0;})});}_0x1639d=_[_0x918a('0x43')]({},_0x1639d,_0xcdb8d6['options']);return db[_0x918a('0x5f')]['count']({'where':_0x1639d[_0x918a('0x41')]})[_0x918a('0x24')](function(_0x420a76){_0x323d94[_0x918a('0x1d')]=_0x420a76;if(_0xcdb8d6[_0x918a('0x35')]['includeAll']){_0x1639d[_0x918a('0x46')]=[{'all':!![]}];}return db[_0x918a('0x5f')][_0x918a('0x47')](_0x1639d);})[_0x918a('0x24')](function(_0x495dee){_0x323d94[_0x918a('0x48')]=_0x495dee;return _0x323d94;});}})[_0x918a('0x24')](respondWithFilteredResult(_0x55ffb5,_0x1639d))['catch'](handleError(_0x55ffb5,null));};exports[_0x918a('0x60')]=function(_0x15646f,_0xeebdfc,_0x3be5ba){var _0x17fad2={'raw':!![],'where':{}};var _0x8647b1={};var _0x10c2a7={'count':0x0,'rows':[]};return db['Campaign'][_0x918a('0x5a')]({'where':{'id':_0x15646f[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0xeebdfc,null))['then'](function(_0xf2109){if(_0xf2109){_0x8647b1['model']=_[_0x918a('0x36')](db[_0x918a('0x61')][_0x918a('0x30')]);_0x8647b1[_0x918a('0x35')]=_['keys'](_0x15646f['query']);_0x8647b1[_0x918a('0x37')]=_['intersection'](_0x8647b1[_0x918a('0x33')],_0x8647b1[_0x918a('0x35')]);_0x17fad2[_0x918a('0x39')]=_['intersection'](_0x8647b1[_0x918a('0x33')],qs['fields'](_0x15646f[_0x918a('0x35')]['fields']));_0x17fad2[_0x918a('0x39')]=_0x17fad2['attributes'][_0x918a('0x3b')]?_0x17fad2[_0x918a('0x39')]:_0x8647b1[_0x918a('0x33')];if(!_0x15646f[_0x918a('0x35')][_0x918a('0x3c')](_0x918a('0x3d'))){_0x17fad2[_0x918a('0x1c')]=qs['limit'](_0x15646f[_0x918a('0x35')][_0x918a('0x1c')]);_0x17fad2[_0x918a('0x3e')]=qs[_0x918a('0x3e')](_0x15646f[_0x918a('0x35')][_0x918a('0x3e')]);}_0x17fad2[_0x918a('0x3f')]=qs[_0x918a('0x40')](_0x15646f[_0x918a('0x35')][_0x918a('0x40')]);_0x17fad2[_0x918a('0x41')]=qs[_0x918a('0x37')](_[_0x918a('0x5c')](_0x15646f[_0x918a('0x35')],_0x8647b1[_0x918a('0x37')]));_0x17fad2[_0x918a('0x41')]['CampaignId']=_0xf2109['id'];if(_0x15646f[_0x918a('0x35')][_0x918a('0x42')]){_0x17fad2[_0x918a('0x41')]=_[_0x918a('0x43')](_0x17fad2[_0x918a('0x41')],{'$or':_[_0x918a('0x34')](_0x17fad2['attributes'],function(_0x56480a){var _0x246b5b={};_0x246b5b[_0x56480a]={'$like':'%'+_0x15646f[_0x918a('0x35')][_0x918a('0x42')]+'%'};return _0x246b5b;})});}_0x17fad2=_[_0x918a('0x43')]({},_0x17fad2,_0x15646f[_0x918a('0x45')]);return db[_0x918a('0x61')][_0x918a('0x1d')]({'where':_0x17fad2[_0x918a('0x41')]})[_0x918a('0x24')](function(_0x18e9f8){_0x10c2a7[_0x918a('0x1d')]=_0x18e9f8;if(_0x15646f[_0x918a('0x35')]['includeAll']){_0x17fad2[_0x918a('0x46')]=[{'all':!![]}];}return db[_0x918a('0x61')][_0x918a('0x47')](_0x17fad2);})[_0x918a('0x24')](function(_0x1caa29){_0x10c2a7[_0x918a('0x48')]=_0x1caa29;return _0x10c2a7;});}})[_0x918a('0x24')](respondWithFilteredResult(_0xeebdfc,_0x17fad2))[_0x918a('0x49')](handleError(_0xeebdfc,null));};exports['getHopperBlacks']=function(_0x4ec4ce,_0x46ef36,_0x18cf89){var _0x53c6dd={'raw':!![],'where':{}};var _0x26689b={};var _0x485c0b={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x4ec4ce[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x46ef36,null))[_0x918a('0x24')](function(_0x22b925){if(_0x22b925){_0x26689b[_0x918a('0x33')]=_[_0x918a('0x36')](db[_0x918a('0x62')][_0x918a('0x30')]);_0x26689b['query']=_[_0x918a('0x36')](_0x4ec4ce[_0x918a('0x35')]);_0x26689b[_0x918a('0x37')]=_['intersection'](_0x26689b['model'],_0x26689b['query']);_0x53c6dd['attributes']=_[_0x918a('0x38')](_0x26689b[_0x918a('0x33')],qs['fields'](_0x4ec4ce[_0x918a('0x35')][_0x918a('0x3a')]));_0x53c6dd[_0x918a('0x39')]=_0x53c6dd[_0x918a('0x39')]['length']?_0x53c6dd[_0x918a('0x39')]:_0x26689b[_0x918a('0x33')];if(!_0x4ec4ce[_0x918a('0x35')][_0x918a('0x3c')](_0x918a('0x3d'))){_0x53c6dd['limit']=qs[_0x918a('0x1c')](_0x4ec4ce['query'][_0x918a('0x1c')]);_0x53c6dd[_0x918a('0x3e')]=qs['offset'](_0x4ec4ce[_0x918a('0x35')]['offset']);}_0x53c6dd[_0x918a('0x3f')]=qs[_0x918a('0x40')](_0x4ec4ce['query'][_0x918a('0x40')]);_0x53c6dd[_0x918a('0x41')]=qs[_0x918a('0x37')](_[_0x918a('0x5c')](_0x4ec4ce[_0x918a('0x35')],_0x26689b[_0x918a('0x37')]));_0x53c6dd['where'][_0x918a('0x5d')]=_0x22b925['id'];if(_0x4ec4ce[_0x918a('0x35')][_0x918a('0x42')]){_0x53c6dd[_0x918a('0x41')]=_['merge'](_0x53c6dd[_0x918a('0x41')],{'$or':_['map'](_0x53c6dd[_0x918a('0x39')],function(_0xe1717c){var _0x1a8334={};_0x1a8334[_0xe1717c]={'$like':'%'+_0x4ec4ce['query'][_0x918a('0x42')]+'%'};return _0x1a8334;})});}_0x53c6dd=_[_0x918a('0x43')]({},_0x53c6dd,_0x4ec4ce[_0x918a('0x45')]);return db['CmHopperBlack']['count']({'where':_0x53c6dd['where']})['then'](function(_0x4cad29){_0x485c0b[_0x918a('0x1d')]=_0x4cad29;if(_0x4ec4ce[_0x918a('0x35')][_0x918a('0x4c')]){_0x53c6dd[_0x918a('0x46')]=[{'all':!![]}];}return db[_0x918a('0x62')][_0x918a('0x47')](_0x53c6dd);})[_0x918a('0x24')](function(_0x5a1098){_0x485c0b[_0x918a('0x48')]=_0x5a1098;return _0x485c0b;});}})[_0x918a('0x24')](respondWithFilteredResult(_0x46ef36,_0x53c6dd))['catch'](handleError(_0x46ef36,null));};exports['getLists']=function(_0x3de307,_0x30bcfd,_0x1f5a9c){var _0x15f5d6={};var _0x4cb9aa={};var _0x53f040;var _0x10640d;return db[_0x918a('0x2f')][_0x918a('0x5a')]({'where':{'id':_0x3de307[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x30bcfd,null))[_0x918a('0x24')](function(_0x4669d8){if(_0x4669d8){_0x53f040=_0x4669d8;_0x4cb9aa[_0x918a('0x33')]=_[_0x918a('0x36')](db[_0x918a('0x63')]['rawAttributes']);_0x4cb9aa['query']=_[_0x918a('0x36')](_0x3de307[_0x918a('0x35')]);_0x4cb9aa[_0x918a('0x37')]=_['intersection'](_0x4cb9aa[_0x918a('0x33')],_0x4cb9aa[_0x918a('0x35')]);_0x15f5d6['attributes']=_['intersection'](_0x4cb9aa[_0x918a('0x33')],qs[_0x918a('0x3a')](_0x3de307['query']['fields']));_0x15f5d6[_0x918a('0x39')]=_0x15f5d6[_0x918a('0x39')][_0x918a('0x3b')]?_0x15f5d6[_0x918a('0x39')]:_0x4cb9aa['model'];_0x15f5d6['order']=qs[_0x918a('0x40')](_0x3de307['query'][_0x918a('0x40')]);_0x15f5d6['where']=qs[_0x918a('0x37')](_[_0x918a('0x5c')](_0x3de307[_0x918a('0x35')],_0x4cb9aa[_0x918a('0x37')]));if(_0x3de307['query']['filter']){_0x15f5d6['where']=_['merge'](_0x15f5d6[_0x918a('0x41')],{'$or':_[_0x918a('0x34')](_0x15f5d6[_0x918a('0x39')],function(_0x1d4a3e){var _0x1e9c2f={};_0x1e9c2f[_0x1d4a3e]={'$like':'%'+_0x3de307[_0x918a('0x35')]['filter']+'%'};return _0x1e9c2f;})});}_0x15f5d6=_[_0x918a('0x43')]({},_0x15f5d6,_0x3de307[_0x918a('0x45')]);return _0x53f040[_0x918a('0x64')](_0x15f5d6);}})['then'](function(_0x1d15a8){if(_0x1d15a8){_0x10640d=_0x1d15a8['length'];if(!_0x3de307[_0x918a('0x35')][_0x918a('0x3c')](_0x918a('0x3d'))){_0x15f5d6[_0x918a('0x1c')]=qs['limit'](_0x3de307[_0x918a('0x35')][_0x918a('0x1c')]);_0x15f5d6[_0x918a('0x3e')]=qs[_0x918a('0x3e')](_0x3de307['query'][_0x918a('0x3e')]);}return _0x53f040['getLists'](_0x15f5d6);}})['then'](function(_0x20075c){if(_0x20075c){return _0x20075c?{'count':_0x10640d,'rows':_0x20075c}:null;}})[_0x918a('0x24')](respondWithResult(_0x30bcfd,null))['catch'](handleError(_0x30bcfd,null));};exports[_0x918a('0x65')]=function(_0x3fffed,_0xe31374,_0x3599be){var _0x2c5130,_0x2eab1c;var _0x189d92=[];var _0x2e70ab=moment()[_0x918a('0x66')](_0x918a('0x67'));return db[_0x918a('0x2f')][_0x918a('0x4d')]({'where':{'id':_0x3fffed[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0xe31374,null))['then'](function(_0xe23009){if(_0xe23009){_0x2eab1c=_0xe23009;return _0xe23009[_0x918a('0x65')](_0x3fffed[_0x918a('0x57')][_0x918a('0x68')],_[_0x918a('0x55')](_0x3fffed[_0x918a('0x57')],[_0x918a('0x68'),'id'])||{});}return null;})[_0x918a('0x69')](function(_0x16e805){var _0x50af09;var _0x4ae4b2;_0x2c5130=_0x16e805||[];var _0xd5ec6e=[];if(_0x16e805){for(var _0x581d17=0x0;_0x581d17<_0x16e805[_0x918a('0x3b')];_0x581d17+=0x1){var _0xb5dcb8=_0x16e805[_0x581d17][_0x918a('0x26')]({'plain':!![]});_0x2eab1c['dialCheckDuplicateType']=_0x3fffed[_0x918a('0x57')][_0x918a('0x6a')]?_0x3fffed['body']['dialCheckDuplicateType']:_0x2eab1c['dialCheckDuplicateType'];switch(_0x2eab1c['dialCheckDuplicateType']){case _0x918a('0x6b'):_0x50af09=squel[_0x918a('0x6c')]()[_0x918a('0x6d')]('cm_hopper')[_0x918a('0x6e')]([_0x918a('0x6f'),'scheduledAt',_0x918a('0x70'),'ListId',_0x918a('0x5d'),_0x918a('0x71'),'updatedAt'],squel['select']()[_0x918a('0x72')](_0x918a('0x6f'),_0x918a('0x6f'))[_0x918a('0x72')](_0x918a('0x73'),'scheduledAt')[_0x918a('0x72')]('id',_0x918a('0x70'))[_0x918a('0x72')](_0xb5dcb8[_0x918a('0x74')][_0x918a('0x75')](),_0x918a('0x76'))[_0x918a('0x72')](_0x3fffed[_0x918a('0x4b')]['id'][_0x918a('0x75')](),_0x918a('0x5d'))['field']('\x27'+_0x2e70ab+'\x27',_0x918a('0x71'))[_0x918a('0x72')]('\x27'+_0x2e70ab+'\x27',_0x918a('0x56'))[_0x918a('0x77')](_0x918a('0x78'))[_0x918a('0x41')](_0x918a('0x79'))[_0x918a('0x41')](_0x918a('0x7a'),_0xb5dcb8[_0x918a('0x74')][_0x918a('0x75')]())['where'](_0x918a('0x7b'))[_0x918a('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x918a('0x7c')]()['field'](_0x918a('0x7d'))[_0x918a('0x77')](_0x918a('0x7e'))[_0x918a('0x41')](_0x918a('0x7f'),_0x3fffed[_0x918a('0x4b')]['id'][_0x918a('0x75')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x918a('0x7c')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x918a('0x80'))[_0x918a('0x41')](_0x918a('0x7f'),_0x3fffed[_0x918a('0x4b')]['id'][_0x918a('0x75')]())))[_0x918a('0x75')]();break;case'onlyIfOpen':_0x50af09=squel[_0x918a('0x6c')]()['into']('cm_hopper')[_0x918a('0x6e')]([_0x918a('0x6f'),_0x918a('0x81'),_0x918a('0x70'),_0x918a('0x76'),_0x918a('0x5d'),_0x918a('0x71'),'updatedAt'],squel['select']()[_0x918a('0x72')]('phone',_0x918a('0x6f'))['field']('NOW()',_0x918a('0x81'))['field']('id','ContactId')['field'](_0xb5dcb8[_0x918a('0x74')]['toString'](),_0x918a('0x76'))[_0x918a('0x72')](_0x3fffed['params']['id'][_0x918a('0x75')](),_0x918a('0x5d'))[_0x918a('0x72')]('\x27'+_0x2e70ab+'\x27',_0x918a('0x71'))[_0x918a('0x72')]('\x27'+_0x2e70ab+'\x27','updatedAt')[_0x918a('0x77')](_0x918a('0x78'))[_0x918a('0x41')](_0x918a('0x79'))[_0x918a('0x41')](_0x918a('0x7a'),_0xb5dcb8['CmListId'][_0x918a('0x75')]())[_0x918a('0x41')](_0x918a('0x7b'))[_0x918a('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x918a('0x7c')]()[_0x918a('0x72')](_0x918a('0x82'))[_0x918a('0x77')](_0x918a('0x80'))['where'](_0x918a('0x7f'),_0x3fffed[_0x918a('0x4b')]['id'][_0x918a('0x75')]())))[_0x918a('0x75')]();break;default:_0x50af09=squel['insert']()[_0x918a('0x6d')]('cm_hopper')[_0x918a('0x6e')]([_0x918a('0x6f'),_0x918a('0x81'),_0x918a('0x70'),'ListId','CampaignId',_0x918a('0x71'),'updatedAt'],squel['select']()['field'](_0x918a('0x6f'),'phone')[_0x918a('0x72')](_0x918a('0x73'),_0x918a('0x81'))['field']('id',_0x918a('0x70'))[_0x918a('0x72')](_0xb5dcb8['CmListId'][_0x918a('0x75')](),'ListId')[_0x918a('0x72')](_0x3fffed[_0x918a('0x4b')]['id']['toString'](),_0x918a('0x5d'))['field']('\x27'+_0x2e70ab+'\x27',_0x918a('0x71'))[_0x918a('0x72')]('\x27'+_0x2e70ab+'\x27',_0x918a('0x56'))['from'](_0x918a('0x78'))['where'](_0x918a('0x79'))[_0x918a('0x41')]('ListId\x20=\x20?',_0xb5dcb8[_0x918a('0x74')]['toString']())[_0x918a('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x918a('0x75')]();}_0x4ae4b2=squel[_0x918a('0x6c')]()[_0x918a('0x6d')](_0x918a('0x83'))[_0x918a('0x6e')]([_0x918a('0x84'),_0x918a('0x81'),'phone',_0x918a('0x85'),'createdAt','updatedAt'],squel[_0x918a('0x7c')]()[_0x918a('0x72')](_0x918a('0x86'),'id')['field'](_0x918a('0x73'),_0x918a('0x81'))[_0x918a('0x72')]('ci.item','phone')[_0x918a('0x72')]('ci.OrderBY','OrderBy')['field']('\x27'+_0x2e70ab+'\x27',_0x918a('0x71'))[_0x918a('0x72')]('\x27'+_0x2e70ab+'\x27',_0x918a('0x56'))[_0x918a('0x77')](_0x918a('0x87'),'ci')['join'](_0x918a('0x80'),'h',_0x918a('0x88'))[_0x918a('0x41')](_0x918a('0x89'),_0xb5dcb8[_0x918a('0x74')][_0x918a('0x75')]())['where'](_0x918a('0x8a'),_0x3fffed['params']['id'][_0x918a('0x75')]())[_0x918a('0x41')]('h.createdAt\x20=\x20?',_0x2e70ab))[_0x918a('0x75')]();_0xd5ec6e[_0x918a('0x8b')](db['sequelize']['query'](_0x50af09));_0x189d92[_0x918a('0x8b')](db[_0x918a('0x8c')]['query'](_0x4ae4b2));}return BPromise[_0x918a('0x8d')](_0xd5ec6e);}})[_0x918a('0x24')](function(){return BPromise[_0x918a('0x8d')](_0x189d92);})[_0x918a('0x24')](function(){return _0x2c5130;})[_0x918a('0x24')](respondWithResult(_0xe31374,null))['catch'](handleError(_0xe31374,null));};exports[_0x918a('0x8e')]=function(_0x505efd,_0x1677ea,_0xd7fc11){return db[_0x918a('0x2f')][_0x918a('0x4d')]({'where':{'id':_0x505efd[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x1677ea,null))[_0x918a('0x24')](function(_0x38bf23){if(_0x38bf23){return _0x38bf23[_0x918a('0x8e')](_0x505efd['query'][_0x918a('0x68')]);}})[_0x918a('0x24')](function(_0x159735){if(_0x159735){return db['CmHopper'][_0x918a('0x25')]({'where':{'ListId':_0x505efd['query'][_0x918a('0x68')],'CampaignId':_0x505efd[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](function(){return _0x159735;});}})['then'](respondWithStatusCode(_0x1677ea,null))[_0x918a('0x49')](handleError(_0x1677ea,null));};exports[_0x918a('0x8f')]=function(_0x36f84c,_0x4c1fc9,_0x3d5ec8){var _0x4ea36d={};var _0xcdbc95={};var _0x1973c6;var _0x332ac5;return db[_0x918a('0x2f')][_0x918a('0x5a')]({'where':{'id':_0x36f84c[_0x918a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4c1fc9,null))[_0x918a('0x24')](function(_0x3f8949){if(_0x3f8949){_0x1973c6=_0x3f8949;_0xcdbc95[_0x918a('0x33')]=_[_0x918a('0x36')](db[_0x918a('0x63')][_0x918a('0x30')]);_0xcdbc95[_0x918a('0x35')]=_[_0x918a('0x36')](_0x36f84c[_0x918a('0x35')]);_0xcdbc95[_0x918a('0x37')]=_[_0x918a('0x38')](_0xcdbc95[_0x918a('0x33')],_0xcdbc95[_0x918a('0x35')]);_0x4ea36d[_0x918a('0x39')]=_[_0x918a('0x38')](_0xcdbc95[_0x918a('0x33')],qs[_0x918a('0x3a')](_0x36f84c[_0x918a('0x35')][_0x918a('0x3a')]));_0x4ea36d[_0x918a('0x39')]=_0x4ea36d[_0x918a('0x39')]['length']?_0x4ea36d[_0x918a('0x39')]:_0xcdbc95[_0x918a('0x33')];_0x4ea36d[_0x918a('0x3f')]=qs['sort'](_0x36f84c['query']['sort']);_0x4ea36d['where']=qs[_0x918a('0x37')](_[_0x918a('0x5c')](_0x36f84c[_0x918a('0x35')],_0xcdbc95[_0x918a('0x37')]));if(_0x36f84c[_0x918a('0x35')][_0x918a('0x42')]){_0x4ea36d['where']=_[_0x918a('0x43')](_0x4ea36d[_0x918a('0x41')],{'$or':_[_0x918a('0x34')](_0x4ea36d[_0x918a('0x39')],function(_0x46fdf1){var _0x28458f={};_0x28458f[_0x46fdf1]={'$like':'%'+_0x36f84c[_0x918a('0x35')][_0x918a('0x42')]+'%'};return _0x28458f;})});}_0x4ea36d=_[_0x918a('0x43')]({},_0x4ea36d,_0x36f84c[_0x918a('0x45')]);return _0x1973c6['getBlackLists'](_0x4ea36d);}})[_0x918a('0x24')](function(_0x549bcd){if(_0x549bcd){_0x332ac5=_0x549bcd[_0x918a('0x3b')];if(!_0x36f84c[_0x918a('0x35')][_0x918a('0x3c')](_0x918a('0x3d'))){_0x4ea36d[_0x918a('0x1c')]=qs[_0x918a('0x1c')](_0x36f84c[_0x918a('0x35')][_0x918a('0x1c')]);_0x4ea36d[_0x918a('0x3e')]=qs[_0x918a('0x3e')](_0x36f84c[_0x918a('0x35')][_0x918a('0x3e')]);}return _0x1973c6[_0x918a('0x8f')](_0x4ea36d);}})[_0x918a('0x24')](function(_0xe9e553){if(_0xe9e553){return _0xe9e553?{'count':_0x332ac5,'rows':_0xe9e553}:null;}})[_0x918a('0x24')](respondWithResult(_0x4c1fc9,null))[_0x918a('0x49')](handleError(_0x4c1fc9,null));};exports['addBlackLists']=function(_0x1cd0c4,_0xe8e0e7,_0x5e7624){var _0x58bb2e,_0x8845f1;var _0x142839=[];var _0x451834=moment()['format'](_0x918a('0x67'));return db[_0x918a('0x2f')][_0x918a('0x4d')]({'where':{'id':_0x1cd0c4[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0xe8e0e7,null))[_0x918a('0x24')](function(_0x15a827){if(_0x15a827){_0x8845f1=_0x15a827;return _0x15a827[_0x918a('0x90')](_0x1cd0c4['body'][_0x918a('0x68')],_[_0x918a('0x55')](_0x1cd0c4[_0x918a('0x57')],['ids','id'])||{});}return null;})['spread'](function(_0x559ea7){var _0x912ace;var _0x5b03cd;_0x58bb2e=_0x559ea7||[];var _0x775ab5=[];if(_0x559ea7){for(var _0x589a11=0x0;_0x589a11<_0x559ea7[_0x918a('0x3b')];_0x589a11+=0x1){var _0x4a5711=_0x559ea7[_0x589a11]['get']({'plain':!![]});_0x912ace=squel[_0x918a('0x6c')]()['into']('cm_hopper_black')[_0x918a('0x6e')](['phone','ContactId',_0x918a('0x76'),'CampaignId',_0x918a('0x71'),_0x918a('0x56')],squel['select']()[_0x918a('0x72')](_0x918a('0x6f'),'phone')[_0x918a('0x72')]('id',_0x918a('0x70'))[_0x918a('0x72')](_0x4a5711['CmListId'][_0x918a('0x75')](),'ListId')[_0x918a('0x72')](_0x1cd0c4[_0x918a('0x4b')]['id']['toString'](),_0x918a('0x5d'))['field'](_0x918a('0x73'),'createdAt')[_0x918a('0x72')](_0x918a('0x73'),_0x918a('0x56'))[_0x918a('0x77')](_0x918a('0x78'))['where'](_0x918a('0x79'))[_0x918a('0x41')](_0x918a('0x7a'),_0x4a5711['CmListId']['toString']())[_0x918a('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x918a('0x75')]();_0x775ab5['push'](db['sequelize'][_0x918a('0x35')](_0x912ace));}return BPromise[_0x918a('0x8d')](_0x775ab5);}})['then'](function(){return _0x58bb2e;})[_0x918a('0x24')](respondWithResult(_0xe8e0e7,null))[_0x918a('0x49')](handleError(_0xe8e0e7,null));};exports[_0x918a('0x91')]=function(_0x178e56,_0x386ae1,_0x44552a){return db[_0x918a('0x2f')][_0x918a('0x4d')]({'where':{'id':_0x178e56[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x386ae1,null))[_0x918a('0x24')](function(_0x430e38){if(_0x430e38){return _0x430e38['removeBlackLists'](_0x178e56[_0x918a('0x35')][_0x918a('0x68')]);}})[_0x918a('0x24')](function(_0x213c38){if(_0x213c38){return db[_0x918a('0x62')][_0x918a('0x25')]({'where':{'ListId':_0x178e56[_0x918a('0x35')]['ids'],'CampaignId':_0x178e56[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](function(){return _0x213c38;});}})[_0x918a('0x24')](respondWithStatusCode(_0x386ae1,null))[_0x918a('0x49')](handleError(_0x386ae1,null));}; \ No newline at end of file +var _0xdc15=['role','UserProfileResource','findOne','CmHopper','hasOwnProperty','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','omit','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','NOW()','ContactId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','CmListId','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','ci.OrderBY','OrderBy','join','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','offset','count','Content-Range','apply','save','update','then','destroy','IvrCampaigns','sendStatus','error','stack','name','send','index','Campaign','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','params','rawAttributes','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','clone','createdAt','updatedAt','user'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x12d6c2,_0x409bc8){_0x12d6c2=_0x12d6c2-0x0;var _0x1c9825=_0xdc15[_0x12d6c2];return _0x1c9825;};'use strict';var emlformat=require(_0x5dc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5dc1('0x1'));var jsonpatch=require(_0x5dc1('0x2'));var rp=require(_0x5dc1('0x3'));var moment=require(_0x5dc1('0x4'));var BPromise=require(_0x5dc1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5dc1('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5dc1('0x7'));var _=require(_0x5dc1('0x8'));var squel=require(_0x5dc1('0x9'));var crypto=require(_0x5dc1('0xa'));var jsforce=require(_0x5dc1('0xb'));var deskjs=require(_0x5dc1('0xc'));var toCsv=require(_0x5dc1('0xd'));var querystring=require(_0x5dc1('0xe'));var Papa=require(_0x5dc1('0xf'));var Redis=require(_0x5dc1('0x10'));var authService=require(_0x5dc1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5dc1('0x12'));var logger=require(_0x5dc1('0x13'))('api');var utils=require(_0x5dc1('0x14'));var config=require(_0x5dc1('0x15'));var licenseUtil=require(_0x5dc1('0x16'));var db=require(_0x5dc1('0x17'))['db'];function respondWithStatusCode(_0x13602a,_0x40080a){_0x40080a=_0x40080a||0xcc;return function(_0x284e2a){if(_0x284e2a){return _0x13602a['sendStatus'](_0x40080a);}return _0x13602a[_0x5dc1('0x18')](_0x40080a)[_0x5dc1('0x19')]();};}function respondWithResult(_0x47a2cb,_0x32b126){_0x32b126=_0x32b126||0xc8;return function(_0x359e88){if(_0x359e88){return _0x47a2cb['status'](_0x32b126)[_0x5dc1('0x1a')](_0x359e88);}};}function respondWithFilteredResult(_0x828819,_0xad5fe0){return function(_0x588327){if(_0x588327){var _0x1424ee=typeof _0xad5fe0['offset']==='undefined'&&typeof _0xad5fe0[_0x5dc1('0x1b')]===_0x5dc1('0x1c');var _0x1f2e4a=_0x588327['count'];var _0x427496=_0x1424ee?0x0:_0xad5fe0[_0x5dc1('0x1d')];var _0x7dad16=_0x1424ee?_0x588327[_0x5dc1('0x1e')]:_0xad5fe0[_0x5dc1('0x1d')]+_0xad5fe0[_0x5dc1('0x1b')];var _0x1ba1fe;if(_0x7dad16>=_0x1f2e4a){_0x7dad16=_0x1f2e4a;_0x1ba1fe=0xc8;}else{_0x1ba1fe=0xce;}_0x828819[_0x5dc1('0x18')](_0x1ba1fe);return _0x828819['set'](_0x5dc1('0x1f'),_0x427496+'-'+_0x7dad16+'/'+_0x1f2e4a)[_0x5dc1('0x1a')](_0x588327);}return null;};}function patchUpdates(_0x41ae80){return function(_0x127a1a){try{jsonpatch[_0x5dc1('0x20')](_0x127a1a,_0x41ae80,!![]);}catch(_0x6ecab3){return BPromise['reject'](_0x6ecab3);}return _0x127a1a[_0x5dc1('0x21')]();};}function saveUpdates(_0xd8c4fa,_0x106385){return function(_0x3ae1f3){if(_0x3ae1f3){return _0x3ae1f3[_0x5dc1('0x22')](_0xd8c4fa)[_0x5dc1('0x23')](function(_0x4610a1){return _0x4610a1;});}return null;};}function removeEntity(_0xfa2846,_0x9c16a1){return function(_0x26ee71){if(_0x26ee71){return _0x26ee71[_0x5dc1('0x24')]()[_0x5dc1('0x23')](function(){var _0x2643b9=_0x26ee71['get']({'plain':!![]});var _0x1a21f2=_0x5dc1('0x25');return db['UserProfileResource'][_0x5dc1('0x24')]({'where':{'type':_0x1a21f2,'resourceId':_0x2643b9['id']}})[_0x5dc1('0x23')](function(){return _0x26ee71;});})[_0x5dc1('0x23')](function(){_0xfa2846[_0x5dc1('0x18')](0xcc)[_0x5dc1('0x19')]();});}};}function handleEntityNotFound(_0x191668,_0x1b2063){return function(_0x2a13f9){if(!_0x2a13f9){_0x191668[_0x5dc1('0x26')](0x194);}return _0x2a13f9;};}function handleError(_0x466667,_0x204b53){_0x204b53=_0x204b53||0x1f4;return function(_0xddba38){logger[_0x5dc1('0x27')](_0xddba38[_0x5dc1('0x28')]);if(_0xddba38[_0x5dc1('0x29')]){delete _0xddba38[_0x5dc1('0x29')];}_0x466667[_0x5dc1('0x18')](_0x204b53)[_0x5dc1('0x2a')](_0xddba38);};}exports[_0x5dc1('0x2b')]=function(_0x4eadf1,_0x225bb6){var _0x3ab569={},_0x1331de={},_0x1dfe74={'count':0x0,'rows':[]};var _0x19cb45=_['map'](db[_0x5dc1('0x2c')]['rawAttributes'],function(_0x553c9f){return{'name':_0x553c9f[_0x5dc1('0x2d')],'type':_0x553c9f[_0x5dc1('0x2e')][_0x5dc1('0x2f')]};});_0x1331de[_0x5dc1('0x30')]=_[_0x5dc1('0x31')](_0x19cb45,'name');_0x1331de[_0x5dc1('0x32')]=_[_0x5dc1('0x33')](_0x4eadf1[_0x5dc1('0x32')]);_0x1331de[_0x5dc1('0x34')]=_[_0x5dc1('0x35')](_0x1331de[_0x5dc1('0x30')],_0x1331de['query']);_0x3ab569[_0x5dc1('0x36')]=_[_0x5dc1('0x35')](_0x1331de[_0x5dc1('0x30')],qs[_0x5dc1('0x37')](_0x4eadf1[_0x5dc1('0x32')][_0x5dc1('0x37')]));_0x3ab569[_0x5dc1('0x36')]=_0x3ab569[_0x5dc1('0x36')][_0x5dc1('0x38')]?_0x3ab569[_0x5dc1('0x36')]:_0x1331de[_0x5dc1('0x30')];if(!_0x4eadf1[_0x5dc1('0x32')]['hasOwnProperty'](_0x5dc1('0x39'))){_0x3ab569[_0x5dc1('0x1b')]=qs[_0x5dc1('0x1b')](_0x4eadf1[_0x5dc1('0x32')]['limit']);_0x3ab569[_0x5dc1('0x1d')]=qs[_0x5dc1('0x1d')](_0x4eadf1[_0x5dc1('0x32')][_0x5dc1('0x1d')]);}_0x3ab569[_0x5dc1('0x3a')]=qs[_0x5dc1('0x3b')](_0x4eadf1[_0x5dc1('0x32')][_0x5dc1('0x3b')]);_0x3ab569[_0x5dc1('0x3c')]=qs[_0x5dc1('0x34')](_[_0x5dc1('0x3d')](_0x4eadf1[_0x5dc1('0x32')],_0x1331de[_0x5dc1('0x34')]),_0x19cb45);if(_0x4eadf1[_0x5dc1('0x32')]['filter']){_0x3ab569[_0x5dc1('0x3c')]=_[_0x5dc1('0x3e')](_0x3ab569[_0x5dc1('0x3c')],{'$or':_[_0x5dc1('0x31')](_0x19cb45,function(_0xdf98aa){if(_0xdf98aa[_0x5dc1('0x2e')]!==_0x5dc1('0x3f')){var _0x2b26ff={};_0x2b26ff[_0xdf98aa['name']]={'$like':'%'+_0x4eadf1[_0x5dc1('0x32')][_0x5dc1('0x40')]+'%'};return _0x2b26ff;}})});}_0x3ab569=_[_0x5dc1('0x3e')]({},_0x3ab569,_0x4eadf1[_0x5dc1('0x41')]);var _0x2ac806={'where':_0x3ab569['where']};return db[_0x5dc1('0x2c')][_0x5dc1('0x1e')](_0x2ac806)[_0x5dc1('0x23')](function(_0x26eb34){_0x1dfe74[_0x5dc1('0x1e')]=_0x26eb34;if(_0x4eadf1[_0x5dc1('0x32')][_0x5dc1('0x42')]){_0x3ab569['include']=[{'all':!![]}];}return db[_0x5dc1('0x2c')]['findAll'](_0x3ab569);})[_0x5dc1('0x23')](function(_0x2d446d){_0x1dfe74[_0x5dc1('0x43')]=_0x2d446d;return _0x1dfe74;})[_0x5dc1('0x23')](respondWithFilteredResult(_0x225bb6,_0x3ab569))['catch'](handleError(_0x225bb6,null));};exports['show']=function(_0x22be79,_0x105a3a){var _0x2b80be={'raw':![],'where':{'id':_0x22be79[_0x5dc1('0x44')]['id']}},_0x25e8c3={};_0x25e8c3[_0x5dc1('0x30')]=_['keys'](db[_0x5dc1('0x2c')][_0x5dc1('0x45')]);_0x25e8c3['query']=_[_0x5dc1('0x33')](_0x22be79[_0x5dc1('0x32')]);_0x25e8c3[_0x5dc1('0x34')]=_[_0x5dc1('0x35')](_0x25e8c3['model'],_0x25e8c3[_0x5dc1('0x32')]);_0x2b80be[_0x5dc1('0x36')]=_[_0x5dc1('0x35')](_0x25e8c3[_0x5dc1('0x30')],qs[_0x5dc1('0x37')](_0x22be79[_0x5dc1('0x32')][_0x5dc1('0x37')]));_0x2b80be[_0x5dc1('0x36')]=_0x2b80be['attributes'][_0x5dc1('0x38')]?_0x2b80be[_0x5dc1('0x36')]:_0x25e8c3['model'];if(_0x22be79['query'][_0x5dc1('0x42')]){_0x2b80be[_0x5dc1('0x46')]=[{'all':!![]}];}_0x2b80be=_['merge']({},_0x2b80be,_0x22be79[_0x5dc1('0x41')]);return db['Campaign'][_0x5dc1('0x47')](_0x2b80be)['then'](handleEntityNotFound(_0x105a3a,null))[_0x5dc1('0x23')](respondWithResult(_0x105a3a,null))['catch'](handleError(_0x105a3a,null));};exports[_0x5dc1('0x48')]=function(_0x2f374d,_0x2c1563){return db[_0x5dc1('0x2c')][_0x5dc1('0x48')](_0x2f374d[_0x5dc1('0x49')],{})['then'](function(_0x1aea15){var _0x241c43=_0x2f374d['user'][_0x5dc1('0x4a')]({'plain':!![]});if(!_0x241c43)throw new Error(_0x5dc1('0x4b'));if(_0x241c43['role']==='user'){var _0x137469=_0x1aea15['get']({'plain':!![]});var _0x1babdf=_0x5dc1('0x25');return db[_0x5dc1('0x4c')][_0x5dc1('0x47')]({'where':{'name':_0x1babdf,'userProfileId':_0x241c43[_0x5dc1('0x4d')]},'raw':!![]})[_0x5dc1('0x23')](function(_0x285ca9){if(_0x285ca9&&_0x285ca9[_0x5dc1('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x137469[_0x5dc1('0x29')],'resourceId':_0x137469['id'],'type':_0x285ca9[_0x5dc1('0x29')],'sectionId':_0x285ca9['id']},{})[_0x5dc1('0x23')](function(){return _0x1aea15;});}else{return _0x1aea15;}})['catch'](function(_0x3b2d05){logger['error'](_0x5dc1('0x4f'),_0x3b2d05);throw _0x3b2d05;});}return _0x1aea15;})[_0x5dc1('0x23')](respondWithResult(_0x2c1563,0xc9))[_0x5dc1('0x50')](handleError(_0x2c1563,null));};exports[_0x5dc1('0x51')]=function(_0x5a7331,_0x16475f){var _0x4f4022={'where':{'id':_0x5a7331[_0x5dc1('0x44')]['id']}},_0x430ea9={};_0x430ea9['model']=_[_0x5dc1('0x33')](db[_0x5dc1('0x2c')][_0x5dc1('0x45')]);_0x4f4022['attributes']=_['intersection'](_0x430ea9['model'],qs['fields'](_0x5a7331[_0x5dc1('0x32')][_0x5dc1('0x37')]));_0x4f4022[_0x5dc1('0x36')]=_0x4f4022['attributes'][_0x5dc1('0x38')]?_0x4f4022[_0x5dc1('0x36')]:_0x430ea9['model'];if(_0x5a7331[_0x5dc1('0x32')][_0x5dc1('0x42')]){_0x4f4022[_0x5dc1('0x46')]=[{'all':!![]}];}_0x4f4022=_[_0x5dc1('0x3e')]({},_0x4f4022,_0x5a7331['options']);return db[_0x5dc1('0x2c')][_0x5dc1('0x47')](_0x4f4022)[_0x5dc1('0x23')](handleEntityNotFound(_0x16475f,null))[_0x5dc1('0x23')](function(_0x5a710c){if(_0x5a710c){var _0x57d019=_0x5a710c['get']({'plain':!![]});_0x57d019=qs['omit'](_0x57d019,['id',_0x5dc1('0x52'),_0x5dc1('0x53')]);_0x5a7331['body']=_['omit'](_0x5a7331[_0x5dc1('0x49')],['id','createdAt',_0x5dc1('0x53')]);return db[_0x5dc1('0x2c')]['create'](_[_0x5dc1('0x3e')](_0x57d019,_0x5a7331[_0x5dc1('0x49')]),{'include':_0x5a7331[_0x5dc1('0x32')][_0x5dc1('0x42')]?[{'all':!![]}]:undefined})[_0x5dc1('0x23')](function(_0xa3f909){var _0x67b696=_0x5a7331[_0x5dc1('0x54')][_0x5dc1('0x4a')]({'plain':!![]});if(!_0x67b696)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x67b696[_0x5dc1('0x55')]==='user'){var _0x3b2474=_0xa3f909[_0x5dc1('0x4a')]({'plain':!![]});var _0xd86c3e='IvrCampaigns';return db[_0x5dc1('0x4c')][_0x5dc1('0x47')]({'where':{'name':_0xd86c3e,'userProfileId':_0x67b696[_0x5dc1('0x4d')]},'raw':!![]})[_0x5dc1('0x23')](function(_0x693b8a){if(_0x693b8a&&_0x693b8a[_0x5dc1('0x4e')]===0x0){return db[_0x5dc1('0x56')]['create']({'name':_0x3b2474['name'],'resourceId':_0x3b2474['id'],'type':_0x693b8a[_0x5dc1('0x29')],'sectionId':_0x693b8a['id']},{})[_0x5dc1('0x23')](function(){return _0xa3f909;});}else{return _0xa3f909;}})['catch'](function(_0x28062e){logger[_0x5dc1('0x27')](_0x5dc1('0x4f'),_0x28062e);throw _0x28062e;});}return _0xa3f909;});}})['then'](respondWithResult(_0x16475f,0xc9))[_0x5dc1('0x50')](handleError(_0x16475f,null));};exports[_0x5dc1('0x22')]=function(_0x492582,_0x482c2d){if(_0x492582[_0x5dc1('0x49')]['id']){delete _0x492582['body']['id'];}return db[_0x5dc1('0x2c')]['find']({'where':{'id':_0x492582[_0x5dc1('0x44')]['id']}})[_0x5dc1('0x23')](handleEntityNotFound(_0x482c2d,null))[_0x5dc1('0x23')](saveUpdates(_0x492582[_0x5dc1('0x49')],null))[_0x5dc1('0x23')](respondWithResult(_0x482c2d,null))['catch'](handleError(_0x482c2d,null));};exports[_0x5dc1('0x24')]=function(_0x3a6d52,_0x1dfc6a){return db[_0x5dc1('0x2c')][_0x5dc1('0x47')]({'where':{'id':_0x3a6d52[_0x5dc1('0x44')]['id']}})['then'](handleEntityNotFound(_0x1dfc6a,null))[_0x5dc1('0x23')](removeEntity(_0x1dfc6a,null))[_0x5dc1('0x50')](handleError(_0x1dfc6a,null));};exports['getHoppers']=function(_0x504b5d,_0x3ede01,_0x31d17f){var _0x438a51={'raw':!![],'where':{}};var _0x25c1df={};var _0x358edf={'count':0x0,'rows':[]};return db[_0x5dc1('0x2c')][_0x5dc1('0x57')]({'where':{'id':_0x504b5d['params']['id']}})['then'](handleEntityNotFound(_0x3ede01,null))[_0x5dc1('0x23')](function(_0x2904c1){if(_0x2904c1){_0x25c1df[_0x5dc1('0x30')]=_[_0x5dc1('0x33')](db[_0x5dc1('0x58')][_0x5dc1('0x45')]);_0x25c1df['query']=_[_0x5dc1('0x33')](_0x504b5d[_0x5dc1('0x32')]);_0x25c1df[_0x5dc1('0x34')]=_[_0x5dc1('0x35')](_0x25c1df['model'],_0x25c1df[_0x5dc1('0x32')]);_0x438a51[_0x5dc1('0x36')]=_['intersection'](_0x25c1df[_0x5dc1('0x30')],qs[_0x5dc1('0x37')](_0x504b5d['query'][_0x5dc1('0x37')]));_0x438a51[_0x5dc1('0x36')]=_0x438a51[_0x5dc1('0x36')][_0x5dc1('0x38')]?_0x438a51['attributes']:_0x25c1df['model'];if(!_0x504b5d['query'][_0x5dc1('0x59')](_0x5dc1('0x39'))){_0x438a51[_0x5dc1('0x1b')]=qs[_0x5dc1('0x1b')](_0x504b5d[_0x5dc1('0x32')][_0x5dc1('0x1b')]);_0x438a51[_0x5dc1('0x1d')]=qs[_0x5dc1('0x1d')](_0x504b5d[_0x5dc1('0x32')][_0x5dc1('0x1d')]);}_0x438a51['order']=qs['sort'](_0x504b5d[_0x5dc1('0x32')][_0x5dc1('0x3b')]);_0x438a51[_0x5dc1('0x3c')]=qs[_0x5dc1('0x34')](_['pick'](_0x504b5d[_0x5dc1('0x32')],_0x25c1df[_0x5dc1('0x34')]));_0x438a51[_0x5dc1('0x3c')][_0x5dc1('0x5a')]=_0x2904c1['id'];if(_0x504b5d[_0x5dc1('0x32')][_0x5dc1('0x40')]){_0x438a51[_0x5dc1('0x3c')]=_[_0x5dc1('0x3e')](_0x438a51[_0x5dc1('0x3c')],{'$or':_[_0x5dc1('0x31')](_0x438a51[_0x5dc1('0x36')],function(_0x3d0deb){var _0x455709={};_0x455709[_0x3d0deb]={'$like':'%'+_0x504b5d[_0x5dc1('0x32')][_0x5dc1('0x40')]+'%'};return _0x455709;})});}_0x438a51=_['merge']({},_0x438a51,_0x504b5d[_0x5dc1('0x41')]);return db[_0x5dc1('0x58')]['count']({'where':_0x438a51[_0x5dc1('0x3c')]})[_0x5dc1('0x23')](function(_0x3c8b56){_0x358edf['count']=_0x3c8b56;if(_0x504b5d[_0x5dc1('0x32')]['includeAll']){_0x438a51[_0x5dc1('0x46')]=[{'all':!![]}];}return db['CmHopper'][_0x5dc1('0x5b')](_0x438a51);})[_0x5dc1('0x23')](function(_0x516bc8){_0x358edf[_0x5dc1('0x43')]=_0x516bc8;return _0x358edf;});}})[_0x5dc1('0x23')](respondWithFilteredResult(_0x3ede01,_0x438a51))[_0x5dc1('0x50')](handleError(_0x3ede01,null));};exports[_0x5dc1('0x5c')]=function(_0x32f0ac,_0x23f818,_0x2cf10a){var _0x29cbbf={'raw':!![],'where':{}};var _0x17e5ab={};var _0x59bfd3={'count':0x0,'rows':[]};return db[_0x5dc1('0x2c')][_0x5dc1('0x57')]({'where':{'id':_0x32f0ac['params']['id']}})[_0x5dc1('0x23')](handleEntityNotFound(_0x23f818,null))[_0x5dc1('0x23')](function(_0x47f9f7){if(_0x47f9f7){_0x17e5ab['model']=_[_0x5dc1('0x33')](db[_0x5dc1('0x5d')][_0x5dc1('0x45')]);_0x17e5ab[_0x5dc1('0x32')]=_['keys'](_0x32f0ac[_0x5dc1('0x32')]);_0x17e5ab[_0x5dc1('0x34')]=_[_0x5dc1('0x35')](_0x17e5ab[_0x5dc1('0x30')],_0x17e5ab[_0x5dc1('0x32')]);_0x29cbbf['attributes']=_[_0x5dc1('0x35')](_0x17e5ab[_0x5dc1('0x30')],qs['fields'](_0x32f0ac[_0x5dc1('0x32')][_0x5dc1('0x37')]));_0x29cbbf[_0x5dc1('0x36')]=_0x29cbbf[_0x5dc1('0x36')][_0x5dc1('0x38')]?_0x29cbbf[_0x5dc1('0x36')]:_0x17e5ab['model'];if(!_0x32f0ac[_0x5dc1('0x32')]['hasOwnProperty'](_0x5dc1('0x39'))){_0x29cbbf['limit']=qs[_0x5dc1('0x1b')](_0x32f0ac['query']['limit']);_0x29cbbf[_0x5dc1('0x1d')]=qs[_0x5dc1('0x1d')](_0x32f0ac[_0x5dc1('0x32')][_0x5dc1('0x1d')]);}_0x29cbbf[_0x5dc1('0x3a')]=qs[_0x5dc1('0x3b')](_0x32f0ac[_0x5dc1('0x32')][_0x5dc1('0x3b')]);_0x29cbbf[_0x5dc1('0x3c')]=qs['filters'](_[_0x5dc1('0x3d')](_0x32f0ac[_0x5dc1('0x32')],_0x17e5ab[_0x5dc1('0x34')]));_0x29cbbf[_0x5dc1('0x3c')]['CampaignId']=_0x47f9f7['id'];if(_0x32f0ac[_0x5dc1('0x32')][_0x5dc1('0x40')]){_0x29cbbf[_0x5dc1('0x3c')]=_['merge'](_0x29cbbf[_0x5dc1('0x3c')],{'$or':_[_0x5dc1('0x31')](_0x29cbbf['attributes'],function(_0x445e8b){var _0x420541={};_0x420541[_0x445e8b]={'$like':'%'+_0x32f0ac[_0x5dc1('0x32')][_0x5dc1('0x40')]+'%'};return _0x420541;})});}_0x29cbbf=_['merge']({},_0x29cbbf,_0x32f0ac[_0x5dc1('0x41')]);return db[_0x5dc1('0x5d')][_0x5dc1('0x1e')]({'where':_0x29cbbf['where']})['then'](function(_0x38da53){_0x59bfd3[_0x5dc1('0x1e')]=_0x38da53;if(_0x32f0ac[_0x5dc1('0x32')]['includeAll']){_0x29cbbf['include']=[{'all':!![]}];}return db[_0x5dc1('0x5d')]['findAll'](_0x29cbbf);})['then'](function(_0x513610){_0x59bfd3['rows']=_0x513610;return _0x59bfd3;});}})[_0x5dc1('0x23')](respondWithFilteredResult(_0x23f818,_0x29cbbf))[_0x5dc1('0x50')](handleError(_0x23f818,null));};exports[_0x5dc1('0x5e')]=function(_0x1478cb,_0x269070,_0x1ff230){var _0x1963bc={'raw':!![],'where':{}};var _0x1a5322={};var _0x58fd34={'count':0x0,'rows':[]};return db[_0x5dc1('0x2c')][_0x5dc1('0x57')]({'where':{'id':_0x1478cb['params']['id']}})[_0x5dc1('0x23')](handleEntityNotFound(_0x269070,null))[_0x5dc1('0x23')](function(_0x5ec5ed){if(_0x5ec5ed){_0x1a5322[_0x5dc1('0x30')]=_['keys'](db['CmHopperFinal'][_0x5dc1('0x45')]);_0x1a5322[_0x5dc1('0x32')]=_[_0x5dc1('0x33')](_0x1478cb[_0x5dc1('0x32')]);_0x1a5322[_0x5dc1('0x34')]=_[_0x5dc1('0x35')](_0x1a5322[_0x5dc1('0x30')],_0x1a5322[_0x5dc1('0x32')]);_0x1963bc['attributes']=_[_0x5dc1('0x35')](_0x1a5322[_0x5dc1('0x30')],qs['fields'](_0x1478cb[_0x5dc1('0x32')][_0x5dc1('0x37')]));_0x1963bc['attributes']=_0x1963bc[_0x5dc1('0x36')]['length']?_0x1963bc['attributes']:_0x1a5322[_0x5dc1('0x30')];if(!_0x1478cb[_0x5dc1('0x32')]['hasOwnProperty'](_0x5dc1('0x39'))){_0x1963bc[_0x5dc1('0x1b')]=qs[_0x5dc1('0x1b')](_0x1478cb[_0x5dc1('0x32')]['limit']);_0x1963bc['offset']=qs[_0x5dc1('0x1d')](_0x1478cb[_0x5dc1('0x32')][_0x5dc1('0x1d')]);}_0x1963bc[_0x5dc1('0x3a')]=qs[_0x5dc1('0x3b')](_0x1478cb[_0x5dc1('0x32')][_0x5dc1('0x3b')]);_0x1963bc['where']=qs[_0x5dc1('0x34')](_['pick'](_0x1478cb[_0x5dc1('0x32')],_0x1a5322[_0x5dc1('0x34')]));_0x1963bc[_0x5dc1('0x3c')]['CampaignId']=_0x5ec5ed['id'];if(_0x1478cb[_0x5dc1('0x32')]['filter']){_0x1963bc[_0x5dc1('0x3c')]=_['merge'](_0x1963bc[_0x5dc1('0x3c')],{'$or':_[_0x5dc1('0x31')](_0x1963bc[_0x5dc1('0x36')],function(_0x324e1e){var _0x5f26e8={};_0x5f26e8[_0x324e1e]={'$like':'%'+_0x1478cb[_0x5dc1('0x32')][_0x5dc1('0x40')]+'%'};return _0x5f26e8;})});}_0x1963bc=_[_0x5dc1('0x3e')]({},_0x1963bc,_0x1478cb['options']);return db[_0x5dc1('0x5f')][_0x5dc1('0x1e')]({'where':_0x1963bc[_0x5dc1('0x3c')]})[_0x5dc1('0x23')](function(_0x2fc39e){_0x58fd34['count']=_0x2fc39e;if(_0x1478cb[_0x5dc1('0x32')][_0x5dc1('0x42')]){_0x1963bc[_0x5dc1('0x46')]=[{'all':!![]}];}return db[_0x5dc1('0x5f')][_0x5dc1('0x5b')](_0x1963bc);})['then'](function(_0x5242f2){_0x58fd34['rows']=_0x5242f2;return _0x58fd34;});}})[_0x5dc1('0x23')](respondWithFilteredResult(_0x269070,_0x1963bc))[_0x5dc1('0x50')](handleError(_0x269070,null));};exports[_0x5dc1('0x60')]=function(_0x5c519c,_0x4aa589,_0x3f3c5b){var _0x3b99c8={'raw':!![],'where':{}};var _0x46b6f7={};var _0x3b07ed={'count':0x0,'rows':[]};return db[_0x5dc1('0x2c')][_0x5dc1('0x57')]({'where':{'id':_0x5c519c[_0x5dc1('0x44')]['id']}})[_0x5dc1('0x23')](handleEntityNotFound(_0x4aa589,null))[_0x5dc1('0x23')](function(_0x2c4726){if(_0x2c4726){_0x46b6f7[_0x5dc1('0x30')]=_['keys'](db[_0x5dc1('0x61')][_0x5dc1('0x45')]);_0x46b6f7[_0x5dc1('0x32')]=_['keys'](_0x5c519c[_0x5dc1('0x32')]);_0x46b6f7[_0x5dc1('0x34')]=_[_0x5dc1('0x35')](_0x46b6f7[_0x5dc1('0x30')],_0x46b6f7[_0x5dc1('0x32')]);_0x3b99c8['attributes']=_['intersection'](_0x46b6f7[_0x5dc1('0x30')],qs[_0x5dc1('0x37')](_0x5c519c[_0x5dc1('0x32')][_0x5dc1('0x37')]));_0x3b99c8[_0x5dc1('0x36')]=_0x3b99c8['attributes'][_0x5dc1('0x38')]?_0x3b99c8[_0x5dc1('0x36')]:_0x46b6f7['model'];if(!_0x5c519c['query'][_0x5dc1('0x59')](_0x5dc1('0x39'))){_0x3b99c8['limit']=qs[_0x5dc1('0x1b')](_0x5c519c[_0x5dc1('0x32')][_0x5dc1('0x1b')]);_0x3b99c8[_0x5dc1('0x1d')]=qs[_0x5dc1('0x1d')](_0x5c519c[_0x5dc1('0x32')]['offset']);}_0x3b99c8[_0x5dc1('0x3a')]=qs[_0x5dc1('0x3b')](_0x5c519c['query']['sort']);_0x3b99c8['where']=qs['filters'](_['pick'](_0x5c519c[_0x5dc1('0x32')],_0x46b6f7[_0x5dc1('0x34')]));_0x3b99c8[_0x5dc1('0x3c')][_0x5dc1('0x5a')]=_0x2c4726['id'];if(_0x5c519c['query']['filter']){_0x3b99c8['where']=_[_0x5dc1('0x3e')](_0x3b99c8['where'],{'$or':_[_0x5dc1('0x31')](_0x3b99c8[_0x5dc1('0x36')],function(_0x8a06be){var _0x509984={};_0x509984[_0x8a06be]={'$like':'%'+_0x5c519c[_0x5dc1('0x32')]['filter']+'%'};return _0x509984;})});}_0x3b99c8=_[_0x5dc1('0x3e')]({},_0x3b99c8,_0x5c519c[_0x5dc1('0x41')]);return db[_0x5dc1('0x61')][_0x5dc1('0x1e')]({'where':_0x3b99c8['where']})[_0x5dc1('0x23')](function(_0x213f6b){_0x3b07ed[_0x5dc1('0x1e')]=_0x213f6b;if(_0x5c519c[_0x5dc1('0x32')][_0x5dc1('0x42')]){_0x3b99c8[_0x5dc1('0x46')]=[{'all':!![]}];}return db[_0x5dc1('0x61')]['findAll'](_0x3b99c8);})[_0x5dc1('0x23')](function(_0x52d6cc){_0x3b07ed[_0x5dc1('0x43')]=_0x52d6cc;return _0x3b07ed;});}})[_0x5dc1('0x23')](respondWithFilteredResult(_0x4aa589,_0x3b99c8))[_0x5dc1('0x50')](handleError(_0x4aa589,null));};exports['getLists']=function(_0x39b618,_0x4d4985,_0x3bfa9c){var _0x2c85f6={};var _0x5c77ad={};var _0x2cd4e0;var _0x3ca67a;return db[_0x5dc1('0x2c')]['findOne']({'where':{'id':_0x39b618[_0x5dc1('0x44')]['id']}})[_0x5dc1('0x23')](handleEntityNotFound(_0x4d4985,null))[_0x5dc1('0x23')](function(_0x13e4fe){if(_0x13e4fe){_0x2cd4e0=_0x13e4fe;_0x5c77ad['model']=_[_0x5dc1('0x33')](db[_0x5dc1('0x62')][_0x5dc1('0x45')]);_0x5c77ad['query']=_[_0x5dc1('0x33')](_0x39b618[_0x5dc1('0x32')]);_0x5c77ad[_0x5dc1('0x34')]=_['intersection'](_0x5c77ad[_0x5dc1('0x30')],_0x5c77ad[_0x5dc1('0x32')]);_0x2c85f6['attributes']=_[_0x5dc1('0x35')](_0x5c77ad[_0x5dc1('0x30')],qs[_0x5dc1('0x37')](_0x39b618['query']['fields']));_0x2c85f6[_0x5dc1('0x36')]=_0x2c85f6[_0x5dc1('0x36')][_0x5dc1('0x38')]?_0x2c85f6[_0x5dc1('0x36')]:_0x5c77ad[_0x5dc1('0x30')];_0x2c85f6[_0x5dc1('0x3a')]=qs[_0x5dc1('0x3b')](_0x39b618[_0x5dc1('0x32')][_0x5dc1('0x3b')]);_0x2c85f6['where']=qs[_0x5dc1('0x34')](_[_0x5dc1('0x3d')](_0x39b618['query'],_0x5c77ad[_0x5dc1('0x34')]));if(_0x39b618[_0x5dc1('0x32')][_0x5dc1('0x40')]){_0x2c85f6['where']=_[_0x5dc1('0x3e')](_0x2c85f6[_0x5dc1('0x3c')],{'$or':_[_0x5dc1('0x31')](_0x2c85f6[_0x5dc1('0x36')],function(_0x497261){var _0xf35899={};_0xf35899[_0x497261]={'$like':'%'+_0x39b618[_0x5dc1('0x32')]['filter']+'%'};return _0xf35899;})});}_0x2c85f6=_['merge']({},_0x2c85f6,_0x39b618['options']);return _0x2cd4e0[_0x5dc1('0x63')](_0x2c85f6);}})[_0x5dc1('0x23')](function(_0x49c487){if(_0x49c487){_0x3ca67a=_0x49c487[_0x5dc1('0x38')];if(!_0x39b618[_0x5dc1('0x32')]['hasOwnProperty'](_0x5dc1('0x39'))){_0x2c85f6['limit']=qs[_0x5dc1('0x1b')](_0x39b618[_0x5dc1('0x32')]['limit']);_0x2c85f6['offset']=qs[_0x5dc1('0x1d')](_0x39b618['query'][_0x5dc1('0x1d')]);}return _0x2cd4e0[_0x5dc1('0x63')](_0x2c85f6);}})[_0x5dc1('0x23')](function(_0x418246){if(_0x418246){return _0x418246?{'count':_0x3ca67a,'rows':_0x418246}:null;}})['then'](respondWithResult(_0x4d4985,null))[_0x5dc1('0x50')](handleError(_0x4d4985,null));};exports[_0x5dc1('0x64')]=function(_0x4d8201,_0x53a7fa,_0x10b5f0){var _0x4c7286,_0xcef127;var _0x44b0f8=[];var _0x5a5c46=moment()[_0x5dc1('0x65')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x5dc1('0x2c')][_0x5dc1('0x47')]({'where':{'id':_0x4d8201[_0x5dc1('0x44')]['id']}})['then'](handleEntityNotFound(_0x53a7fa,null))[_0x5dc1('0x23')](function(_0x211e39){if(_0x211e39){_0xcef127=_0x211e39;return _0x211e39['addLists'](_0x4d8201[_0x5dc1('0x49')]['ids'],_[_0x5dc1('0x66')](_0x4d8201[_0x5dc1('0x49')],[_0x5dc1('0x67'),'id'])||{});}return null;})[_0x5dc1('0x68')](function(_0x1b6859){var _0x2a7934;var _0x566943;_0x4c7286=_0x1b6859||[];var _0x4fc1f9=[];if(_0x1b6859){for(var _0x2c0cdc=0x0;_0x2c0cdc<_0x1b6859[_0x5dc1('0x38')];_0x2c0cdc+=0x1){var _0x3a71eb=_0x1b6859[_0x2c0cdc][_0x5dc1('0x4a')]({'plain':!![]});_0xcef127['dialCheckDuplicateType']=_0x4d8201[_0x5dc1('0x49')]['dialCheckDuplicateType']?_0x4d8201[_0x5dc1('0x49')]['dialCheckDuplicateType']:_0xcef127[_0x5dc1('0x69')];switch(_0xcef127[_0x5dc1('0x69')]){case'always':_0x2a7934=squel[_0x5dc1('0x6a')]()[_0x5dc1('0x6b')](_0x5dc1('0x6c'))[_0x5dc1('0x6d')]([_0x5dc1('0x6e'),_0x5dc1('0x6f'),'ContactId',_0x5dc1('0x70'),_0x5dc1('0x5a'),_0x5dc1('0x52'),'updatedAt'],squel['select']()[_0x5dc1('0x71')]('phone','phone')['field'](_0x5dc1('0x72'),_0x5dc1('0x6f'))['field']('id',_0x5dc1('0x73'))[_0x5dc1('0x71')](_0x3a71eb['CmListId'][_0x5dc1('0x74')](),_0x5dc1('0x70'))[_0x5dc1('0x71')](_0x4d8201[_0x5dc1('0x44')]['id'][_0x5dc1('0x74')](),_0x5dc1('0x5a'))['field']('\x27'+_0x5a5c46+'\x27',_0x5dc1('0x52'))['field']('\x27'+_0x5a5c46+'\x27',_0x5dc1('0x53'))[_0x5dc1('0x75')](_0x5dc1('0x76'))[_0x5dc1('0x3c')](_0x5dc1('0x77'))[_0x5dc1('0x3c')](_0x5dc1('0x78'),_0x3a71eb['CmListId'][_0x5dc1('0x74')]())['where'](_0x5dc1('0x79'))[_0x5dc1('0x3c')](_0x5dc1('0x7a'),squel['select']()[_0x5dc1('0x71')](_0x5dc1('0x7b'))[_0x5dc1('0x75')]('cm_hopper_final')['where'](_0x5dc1('0x7c'),_0x4d8201[_0x5dc1('0x44')]['id'][_0x5dc1('0x74')]()))[_0x5dc1('0x3c')](_0x5dc1('0x7a'),squel[_0x5dc1('0x7d')]()[_0x5dc1('0x71')](_0x5dc1('0x7e'))['from']('cm_hopper')[_0x5dc1('0x3c')](_0x5dc1('0x7c'),_0x4d8201[_0x5dc1('0x44')]['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x2a7934=squel[_0x5dc1('0x6a')]()[_0x5dc1('0x6b')](_0x5dc1('0x6c'))['fromQuery']([_0x5dc1('0x6e'),'scheduledAt',_0x5dc1('0x73'),'ListId',_0x5dc1('0x5a'),_0x5dc1('0x52'),_0x5dc1('0x53')],squel[_0x5dc1('0x7d')]()[_0x5dc1('0x71')](_0x5dc1('0x6e'),_0x5dc1('0x6e'))[_0x5dc1('0x71')](_0x5dc1('0x72'),_0x5dc1('0x6f'))[_0x5dc1('0x71')]('id',_0x5dc1('0x73'))[_0x5dc1('0x71')](_0x3a71eb[_0x5dc1('0x7f')]['toString'](),_0x5dc1('0x70'))[_0x5dc1('0x71')](_0x4d8201[_0x5dc1('0x44')]['id'][_0x5dc1('0x74')](),_0x5dc1('0x5a'))[_0x5dc1('0x71')]('\x27'+_0x5a5c46+'\x27','createdAt')[_0x5dc1('0x71')]('\x27'+_0x5a5c46+'\x27',_0x5dc1('0x53'))[_0x5dc1('0x75')]('cm_contacts')[_0x5dc1('0x3c')](_0x5dc1('0x77'))[_0x5dc1('0x3c')]('ListId\x20=\x20?',_0x3a71eb[_0x5dc1('0x7f')][_0x5dc1('0x74')]())['where'](_0x5dc1('0x79'))[_0x5dc1('0x3c')](_0x5dc1('0x7a'),squel['select']()[_0x5dc1('0x71')]('COALESCE(phone,\x27\x27)')[_0x5dc1('0x75')](_0x5dc1('0x6c'))[_0x5dc1('0x3c')](_0x5dc1('0x7c'),_0x4d8201['params']['id'][_0x5dc1('0x74')]())))[_0x5dc1('0x74')]();break;default:_0x2a7934=squel[_0x5dc1('0x6a')]()['into']('cm_hopper')['fromQuery']([_0x5dc1('0x6e'),_0x5dc1('0x6f'),_0x5dc1('0x73'),'ListId',_0x5dc1('0x5a'),_0x5dc1('0x52'),_0x5dc1('0x53')],squel[_0x5dc1('0x7d')]()['field']('phone',_0x5dc1('0x6e'))[_0x5dc1('0x71')](_0x5dc1('0x72'),_0x5dc1('0x6f'))[_0x5dc1('0x71')]('id',_0x5dc1('0x73'))[_0x5dc1('0x71')](_0x3a71eb[_0x5dc1('0x7f')][_0x5dc1('0x74')](),_0x5dc1('0x70'))['field'](_0x4d8201[_0x5dc1('0x44')]['id']['toString'](),_0x5dc1('0x5a'))[_0x5dc1('0x71')]('\x27'+_0x5a5c46+'\x27',_0x5dc1('0x52'))[_0x5dc1('0x71')]('\x27'+_0x5a5c46+'\x27','updatedAt')[_0x5dc1('0x75')](_0x5dc1('0x76'))[_0x5dc1('0x3c')](_0x5dc1('0x77'))[_0x5dc1('0x3c')](_0x5dc1('0x78'),_0x3a71eb[_0x5dc1('0x7f')][_0x5dc1('0x74')]())[_0x5dc1('0x3c')](_0x5dc1('0x79')))[_0x5dc1('0x74')]();}_0x566943=squel[_0x5dc1('0x6a')]()[_0x5dc1('0x6b')](_0x5dc1('0x80'))['fromQuery']([_0x5dc1('0x81'),_0x5dc1('0x6f'),_0x5dc1('0x6e'),'OrderBy',_0x5dc1('0x52'),_0x5dc1('0x53')],squel[_0x5dc1('0x7d')]()[_0x5dc1('0x71')](_0x5dc1('0x82'),'id')[_0x5dc1('0x71')](_0x5dc1('0x72'),_0x5dc1('0x6f'))[_0x5dc1('0x71')](_0x5dc1('0x83'),_0x5dc1('0x6e'))[_0x5dc1('0x71')](_0x5dc1('0x84'),_0x5dc1('0x85'))[_0x5dc1('0x71')]('\x27'+_0x5a5c46+'\x27','createdAt')[_0x5dc1('0x71')]('\x27'+_0x5a5c46+'\x27','updatedAt')[_0x5dc1('0x75')]('cm_contact_has_items','ci')[_0x5dc1('0x86')](_0x5dc1('0x6c'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x5dc1('0x3c')](_0x5dc1('0x87'),_0x3a71eb[_0x5dc1('0x7f')][_0x5dc1('0x74')]())['where']('h.CampaignId=?',_0x4d8201[_0x5dc1('0x44')]['id'][_0x5dc1('0x74')]())[_0x5dc1('0x3c')](_0x5dc1('0x88'),_0x5a5c46))[_0x5dc1('0x74')]();_0x4fc1f9['push'](db[_0x5dc1('0x89')][_0x5dc1('0x32')](_0x2a7934));_0x44b0f8[_0x5dc1('0x8a')](db[_0x5dc1('0x89')][_0x5dc1('0x32')](_0x566943));}return BPromise[_0x5dc1('0x8b')](_0x4fc1f9);}})[_0x5dc1('0x23')](function(){return BPromise[_0x5dc1('0x8b')](_0x44b0f8);})['then'](function(){return _0x4c7286;})[_0x5dc1('0x23')](respondWithResult(_0x53a7fa,null))['catch'](handleError(_0x53a7fa,null));};exports[_0x5dc1('0x8c')]=function(_0x1ddd0c,_0x48acf3,_0x523cd0){return db[_0x5dc1('0x2c')]['find']({'where':{'id':_0x1ddd0c['params']['id']}})[_0x5dc1('0x23')](handleEntityNotFound(_0x48acf3,null))[_0x5dc1('0x23')](function(_0x3823a6){if(_0x3823a6){return _0x3823a6['removeLists'](_0x1ddd0c[_0x5dc1('0x32')]['ids']);}})['then'](function(_0xdbf13f){if(_0xdbf13f){return db[_0x5dc1('0x58')][_0x5dc1('0x24')]({'where':{'ListId':_0x1ddd0c['query'][_0x5dc1('0x67')],'CampaignId':_0x1ddd0c[_0x5dc1('0x44')]['id']}})['then'](function(){return _0xdbf13f;});}})[_0x5dc1('0x23')](respondWithStatusCode(_0x48acf3,null))[_0x5dc1('0x50')](handleError(_0x48acf3,null));};exports['getBlackLists']=function(_0x3fb45b,_0x24df01,_0x4073af){var _0x20b6a2={};var _0x5e8816={};var _0x1901f1;var _0x5d29af;return db[_0x5dc1('0x2c')][_0x5dc1('0x57')]({'where':{'id':_0x3fb45b[_0x5dc1('0x44')]['id']}})[_0x5dc1('0x23')](handleEntityNotFound(_0x24df01,null))[_0x5dc1('0x23')](function(_0x9502ad){if(_0x9502ad){_0x1901f1=_0x9502ad;_0x5e8816[_0x5dc1('0x30')]=_[_0x5dc1('0x33')](db['CmList']['rawAttributes']);_0x5e8816[_0x5dc1('0x32')]=_['keys'](_0x3fb45b['query']);_0x5e8816[_0x5dc1('0x34')]=_[_0x5dc1('0x35')](_0x5e8816[_0x5dc1('0x30')],_0x5e8816[_0x5dc1('0x32')]);_0x20b6a2['attributes']=_[_0x5dc1('0x35')](_0x5e8816[_0x5dc1('0x30')],qs[_0x5dc1('0x37')](_0x3fb45b[_0x5dc1('0x32')][_0x5dc1('0x37')]));_0x20b6a2[_0x5dc1('0x36')]=_0x20b6a2[_0x5dc1('0x36')][_0x5dc1('0x38')]?_0x20b6a2['attributes']:_0x5e8816[_0x5dc1('0x30')];_0x20b6a2[_0x5dc1('0x3a')]=qs['sort'](_0x3fb45b[_0x5dc1('0x32')][_0x5dc1('0x3b')]);_0x20b6a2['where']=qs[_0x5dc1('0x34')](_[_0x5dc1('0x3d')](_0x3fb45b['query'],_0x5e8816[_0x5dc1('0x34')]));if(_0x3fb45b[_0x5dc1('0x32')]['filter']){_0x20b6a2[_0x5dc1('0x3c')]=_[_0x5dc1('0x3e')](_0x20b6a2[_0x5dc1('0x3c')],{'$or':_[_0x5dc1('0x31')](_0x20b6a2[_0x5dc1('0x36')],function(_0x4d0af2){var _0x415e52={};_0x415e52[_0x4d0af2]={'$like':'%'+_0x3fb45b[_0x5dc1('0x32')]['filter']+'%'};return _0x415e52;})});}_0x20b6a2=_['merge']({},_0x20b6a2,_0x3fb45b[_0x5dc1('0x41')]);return _0x1901f1[_0x5dc1('0x8d')](_0x20b6a2);}})[_0x5dc1('0x23')](function(_0x34c020){if(_0x34c020){_0x5d29af=_0x34c020[_0x5dc1('0x38')];if(!_0x3fb45b[_0x5dc1('0x32')][_0x5dc1('0x59')](_0x5dc1('0x39'))){_0x20b6a2['limit']=qs['limit'](_0x3fb45b[_0x5dc1('0x32')]['limit']);_0x20b6a2[_0x5dc1('0x1d')]=qs[_0x5dc1('0x1d')](_0x3fb45b['query'][_0x5dc1('0x1d')]);}return _0x1901f1[_0x5dc1('0x8d')](_0x20b6a2);}})[_0x5dc1('0x23')](function(_0x298624){if(_0x298624){return _0x298624?{'count':_0x5d29af,'rows':_0x298624}:null;}})[_0x5dc1('0x23')](respondWithResult(_0x24df01,null))[_0x5dc1('0x50')](handleError(_0x24df01,null));};exports[_0x5dc1('0x8e')]=function(_0x9c7467,_0x21e15a,_0x59a818){var _0xb739c8,_0x4487ae;var _0x2756ed=[];var _0x3cd97a=moment()[_0x5dc1('0x65')](_0x5dc1('0x8f'));return db[_0x5dc1('0x2c')]['find']({'where':{'id':_0x9c7467[_0x5dc1('0x44')]['id']}})[_0x5dc1('0x23')](handleEntityNotFound(_0x21e15a,null))['then'](function(_0x1beca6){if(_0x1beca6){_0x4487ae=_0x1beca6;return _0x1beca6[_0x5dc1('0x8e')](_0x9c7467['body'][_0x5dc1('0x67')],_['omit'](_0x9c7467['body'],[_0x5dc1('0x67'),'id'])||{});}return null;})[_0x5dc1('0x68')](function(_0x409c0d){var _0x3da113;var _0x182fa9;_0xb739c8=_0x409c0d||[];var _0x541f0c=[];if(_0x409c0d){for(var _0x3f4a0b=0x0;_0x3f4a0b<_0x409c0d[_0x5dc1('0x38')];_0x3f4a0b+=0x1){var _0x47a08f=_0x409c0d[_0x3f4a0b][_0x5dc1('0x4a')]({'plain':!![]});_0x3da113=squel['insert']()[_0x5dc1('0x6b')](_0x5dc1('0x90'))['fromQuery']([_0x5dc1('0x6e'),_0x5dc1('0x73'),_0x5dc1('0x70'),_0x5dc1('0x5a'),'createdAt',_0x5dc1('0x53')],squel[_0x5dc1('0x7d')]()[_0x5dc1('0x71')](_0x5dc1('0x6e'),_0x5dc1('0x6e'))[_0x5dc1('0x71')]('id',_0x5dc1('0x73'))[_0x5dc1('0x71')](_0x47a08f[_0x5dc1('0x7f')][_0x5dc1('0x74')](),_0x5dc1('0x70'))['field'](_0x9c7467[_0x5dc1('0x44')]['id'][_0x5dc1('0x74')](),'CampaignId')[_0x5dc1('0x71')](_0x5dc1('0x72'),_0x5dc1('0x52'))[_0x5dc1('0x71')](_0x5dc1('0x72'),'updatedAt')['from'](_0x5dc1('0x76'))[_0x5dc1('0x3c')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x47a08f[_0x5dc1('0x7f')][_0x5dc1('0x74')]())['where'](_0x5dc1('0x79')))['toString']();_0x541f0c[_0x5dc1('0x8a')](db[_0x5dc1('0x89')][_0x5dc1('0x32')](_0x3da113));}return BPromise['all'](_0x541f0c);}})[_0x5dc1('0x23')](function(){return _0xb739c8;})[_0x5dc1('0x23')](respondWithResult(_0x21e15a,null))['catch'](handleError(_0x21e15a,null));};exports[_0x5dc1('0x91')]=function(_0x13590f,_0x46712,_0x28f701){return db['Campaign'][_0x5dc1('0x47')]({'where':{'id':_0x13590f['params']['id']}})[_0x5dc1('0x23')](handleEntityNotFound(_0x46712,null))['then'](function(_0x5796ea){if(_0x5796ea){return _0x5796ea[_0x5dc1('0x91')](_0x13590f[_0x5dc1('0x32')]['ids']);}})[_0x5dc1('0x23')](function(_0x3f593c){if(_0x3f593c){return db[_0x5dc1('0x61')][_0x5dc1('0x24')]({'where':{'ListId':_0x13590f['query'][_0x5dc1('0x67')],'CampaignId':_0x13590f[_0x5dc1('0x44')]['id']}})[_0x5dc1('0x23')](function(){return _0x3f593c;});}})[_0x5dc1('0x23')](respondWithStatusCode(_0x46712,null))[_0x5dc1('0x50')](handleError(_0x46712,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index ae9ef1d..649f916 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(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_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 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(_0xf04b83,_0x399c28){var _0x3d15eb=function(_0x3b554d){while(--_0x3b554d){_0xf04b83['push'](_0xf04b83['shift']());}};_0x3d15eb(++_0x399c28);}(_0x7a54,0x106));var _0x47a5=function(_0x36f77b,_0x190f97){_0x36f77b=_0x36f77b-0x0;var _0xca87d7=_0x7a54[_0x36f77b];return _0xca87d7;};'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 38e67b0..27dbc6e 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 _0x3299=['Campaign,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetCampaign','findAll','options','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug'];(function(_0x3be7fe,_0x315935){var _0x3b3cfa=function(_0x1134ba){while(--_0x1134ba){_0x3be7fe['push'](_0x3be7fe['shift']());}};_0x3b3cfa(++_0x315935);}(_0x3299,0x1bc));var _0x9329=function(_0x33847b,_0x31e38b){_0x33847b=_0x33847b-0x0;var _0x352058=_0x3299[_0x33847b];return _0x352058;};'use strict';var _=require('lodash');var util=require(_0x9329('0x0'));var moment=require(_0x9329('0x1'));var BPromise=require(_0x9329('0x2'));var rs=require(_0x9329('0x3'));var fs=require('fs');var Redis=require(_0x9329('0x4'));var db=require(_0x9329('0x5'))['db'];var utils=require(_0x9329('0x6'));var logger=require(_0x9329('0x7'))(_0x9329('0x8'));var config=require(_0x9329('0x9'));var jayson=require(_0x9329('0xa'));var client=jayson[_0x9329('0xb')][_0x9329('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14bc45,_0x1fa6c4,_0x218cf3){return new BPromise(function(_0x182d15,_0x531cf1){return client[_0x9329('0xd')](_0x14bc45,_0x218cf3)[_0x9329('0xe')](function(_0x1c1033){logger[_0x9329('0xf')](_0x9329('0x10'),_0x1fa6c4,'request\x20sent');logger[_0x9329('0x11')](_0x9329('0x12'),_0x1fa6c4,'request\x20sent',JSON['stringify'](_0x1c1033));if(_0x1c1033['error']){if(_0x1c1033[_0x9329('0x13')][_0x9329('0x14')]===0x1f4){logger[_0x9329('0x13')](_0x9329('0x10'),_0x1fa6c4,_0x1c1033[_0x9329('0x13')]['message']);return _0x531cf1(_0x1c1033[_0x9329('0x13')][_0x9329('0x15')]);}logger[_0x9329('0x13')]('Campaign,\x20%s,\x20%s',_0x1fa6c4,_0x1c1033[_0x9329('0x13')][_0x9329('0x15')]);return _0x182d15(_0x1c1033['error'][_0x9329('0x15')]);}else{logger[_0x9329('0xf')]('Campaign,\x20%s,\x20%s',_0x1fa6c4,_0x9329('0x16'));_0x182d15(_0x1c1033[_0x9329('0x17')][_0x9329('0x15')]);}})[_0x9329('0x18')](function(_0x4dfbc1){logger[_0x9329('0x13')]('Campaign,\x20%s,\x20%s',_0x1fa6c4,_0x4dfbc1);_0x531cf1(_0x4dfbc1);});});}exports[_0x9329('0x19')]=function(_0x1b5eed){var _0x57718b=this;return new Promise(function(_0x41db73,_0x26a3c2){return db['Campaign'][_0x9329('0x1a')]({'raw':_0x1b5eed['options']?_0x1b5eed[_0x9329('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1b5eed[_0x9329('0x1b')]?_0x1b5eed['options'][_0x9329('0x1c')]||null:null,'attributes':_0x1b5eed[_0x9329('0x1b')]?_0x1b5eed[_0x9329('0x1b')][_0x9329('0x1d')]||null:null,'limit':_0x1b5eed[_0x9329('0x1b')]?_0x1b5eed[_0x9329('0x1b')]['limit']||null:null,'include':_0x1b5eed[_0x9329('0x1b')]?_0x1b5eed[_0x9329('0x1b')][_0x9329('0x1e')]?_[_0x9329('0x1f')](_0x1b5eed[_0x9329('0x1b')]['include'],function(_0x22caa4){return{'model':db[_0x22caa4[_0x9329('0x20')]],'as':_0x22caa4['as'],'attributes':_0x22caa4['attributes'],'include':_0x22caa4[_0x9329('0x1e')]?_[_0x9329('0x1f')](_0x22caa4[_0x9329('0x1e')],function(_0x2da39d){return{'model':db[_0x2da39d['model']],'as':_0x2da39d['as'],'attributes':_0x2da39d['attributes'],'include':_0x2da39d[_0x9329('0x1e')]?_[_0x9329('0x1f')](_0x2da39d[_0x9329('0x1e')],function(_0x4f5fbf){return{'model':db[_0x4f5fbf[_0x9329('0x20')]],'as':_0x4f5fbf['as'],'attributes':_0x4f5fbf['attributes']};}):[]};}):[]};}):[]:[]})[_0x9329('0xe')](function(_0x192d0a){logger[_0x9329('0xf')]('GetCampaign',_0x1b5eed);logger['debug'](_0x9329('0x19'),_0x1b5eed,JSON['stringify'](_0x192d0a));_0x41db73(_0x192d0a);})[_0x9329('0x18')](function(_0x4a5d27){logger[_0x9329('0x13')]('GetCampaign',_0x4a5d27[_0x9329('0x15')],_0x1b5eed);_0x26a3c2(_0x57718b[_0x9329('0x13')](0x1f4,_0x4a5d27['message']));});});}; \ No newline at end of file +var _0x37dc=['ioredis','../../config/utils','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Campaign','findAll','raw','options','limit','include','map','model','attributes','GetCampaign','lodash','util','moment','bluebird'];(function(_0x4dce97,_0x1b9719){var _0x417143=function(_0x1a5472){while(--_0x1a5472){_0x4dce97['push'](_0x4dce97['shift']());}};_0x417143(++_0x1b9719);}(_0x37dc,0x1e9));var _0xc37d=function(_0x4d046c,_0x20b5e1){_0x4d046c=_0x4d046c-0x0;var _0x1e2c79=_0x37dc[_0x4d046c];return _0x1e2c79;};'use strict';var _=require(_0xc37d('0x0'));var util=require(_0xc37d('0x1'));var moment=require(_0xc37d('0x2'));var BPromise=require(_0xc37d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc37d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc37d('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc37d('0x6')][_0xc37d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11fe31,_0x368c3b,_0x1d6e8b){return new BPromise(function(_0x2076b3,_0x79252d){return client[_0xc37d('0x8')](_0x11fe31,_0x1d6e8b)[_0xc37d('0x9')](function(_0x5a0a61){logger[_0xc37d('0xa')](_0xc37d('0xb'),_0x368c3b,'request\x20sent');logger[_0xc37d('0xc')](_0xc37d('0xd'),_0x368c3b,'request\x20sent',JSON[_0xc37d('0xe')](_0x5a0a61));if(_0x5a0a61[_0xc37d('0xf')]){if(_0x5a0a61['error'][_0xc37d('0x10')]===0x1f4){logger[_0xc37d('0xf')](_0xc37d('0xb'),_0x368c3b,_0x5a0a61[_0xc37d('0xf')][_0xc37d('0x11')]);return _0x79252d(_0x5a0a61[_0xc37d('0xf')][_0xc37d('0x11')]);}logger[_0xc37d('0xf')](_0xc37d('0xb'),_0x368c3b,_0x5a0a61[_0xc37d('0xf')][_0xc37d('0x11')]);return _0x2076b3(_0x5a0a61[_0xc37d('0xf')]['message']);}else{logger['info'](_0xc37d('0xb'),_0x368c3b,'request\x20sent');_0x2076b3(_0x5a0a61['result'][_0xc37d('0x11')]);}})[_0xc37d('0x12')](function(_0x5b204f){logger[_0xc37d('0xf')]('Campaign,\x20%s,\x20%s',_0x368c3b,_0x5b204f);_0x79252d(_0x5b204f);});});}exports['GetCampaign']=function(_0xcd23a5){var _0x1816f4=this;return new Promise(function(_0xfefa40,_0x36ee50){return db[_0xc37d('0x13')][_0xc37d('0x14')]({'raw':_0xcd23a5['options']?_0xcd23a5['options'][_0xc37d('0x15')]===undefined?!![]:![]:!![],'where':_0xcd23a5[_0xc37d('0x16')]?_0xcd23a5[_0xc37d('0x16')]['where']||null:null,'attributes':_0xcd23a5[_0xc37d('0x16')]?_0xcd23a5[_0xc37d('0x16')]['attributes']||null:null,'limit':_0xcd23a5[_0xc37d('0x16')]?_0xcd23a5['options'][_0xc37d('0x17')]||null:null,'include':_0xcd23a5[_0xc37d('0x16')]?_0xcd23a5[_0xc37d('0x16')][_0xc37d('0x18')]?_[_0xc37d('0x19')](_0xcd23a5[_0xc37d('0x16')][_0xc37d('0x18')],function(_0x1ab504){return{'model':db[_0x1ab504[_0xc37d('0x1a')]],'as':_0x1ab504['as'],'attributes':_0x1ab504['attributes'],'include':_0x1ab504[_0xc37d('0x18')]?_[_0xc37d('0x19')](_0x1ab504[_0xc37d('0x18')],function(_0x5c1dd7){return{'model':db[_0x5c1dd7[_0xc37d('0x1a')]],'as':_0x5c1dd7['as'],'attributes':_0x5c1dd7['attributes'],'include':_0x5c1dd7['include']?_[_0xc37d('0x19')](_0x5c1dd7[_0xc37d('0x18')],function(_0x459f13){return{'model':db[_0x459f13[_0xc37d('0x1a')]],'as':_0x459f13['as'],'attributes':_0x459f13[_0xc37d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a97ee){logger['info'](_0xc37d('0x1c'),_0xcd23a5);logger['debug'](_0xc37d('0x1c'),_0xcd23a5,JSON[_0xc37d('0xe')](_0x1a97ee));_0xfefa40(_0x1a97ee);})[_0xc37d('0x12')](function(_0x26be2a){logger[_0xc37d('0xf')](_0xc37d('0x1c'),_0x26be2a[_0xc37d('0x11')],_0xcd23a5);_0x36ee50(_0x1816f4[_0xc37d('0xf')](0x1f4,_0x26be2a['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 0a5d519..1a424c0 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 _0xa7cf=['getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addLists','addBlackLists','/:id','update','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id/hoppers','getHoppers'];(function(_0x59fb16,_0x45c22a){var _0x774d8e=function(_0x12400a){while(--_0x12400a){_0x59fb16['push'](_0x59fb16['shift']());}};_0x774d8e(++_0x45c22a);}(_0xa7cf,0xf9));var _0xfa7c=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0xa7cf[_0x12d951];return _0x44de17;};'use strict';var multer=require(_0xfa7c('0x0'));var util=require(_0xfa7c('0x1'));var path=require(_0xfa7c('0x2'));var timeout=require(_0xfa7c('0x3'));var express=require(_0xfa7c('0x4'));var router=express[_0xfa7c('0x5')]();var fs_extra=require(_0xfa7c('0x6'));var auth=require(_0xfa7c('0x7'));var interaction=require(_0xfa7c('0x8'));var config=require('../../config/environment');var controller=require(_0xfa7c('0x9'));router[_0xfa7c('0xa')]('/',auth[_0xfa7c('0xb')](),controller[_0xfa7c('0xc')]);router[_0xfa7c('0xa')]('/:id',auth[_0xfa7c('0xb')](),controller['show']);router[_0xfa7c('0xa')](_0xfa7c('0xd'),auth['isAuthenticated'](),controller[_0xfa7c('0xe')]);router[_0xfa7c('0xa')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xfa7c('0xf')]);router[_0xfa7c('0xa')](_0xfa7c('0x10'),auth[_0xfa7c('0xb')](),controller[_0xfa7c('0x11')]);router[_0xfa7c('0xa')](_0xfa7c('0x12'),auth[_0xfa7c('0xb')](),controller['getHopperBlacks']);router[_0xfa7c('0xa')](_0xfa7c('0x13'),auth[_0xfa7c('0xb')](),controller[_0xfa7c('0x14')]);router['get'](_0xfa7c('0x15'),auth[_0xfa7c('0xb')](),controller[_0xfa7c('0x16')]);router[_0xfa7c('0x17')]('/',auth[_0xfa7c('0xb')](),controller[_0xfa7c('0x18')]);router[_0xfa7c('0x17')](_0xfa7c('0x19'),auth[_0xfa7c('0xb')](),controller['clone']);router['post']('/:id/lists',auth[_0xfa7c('0xb')](),controller[_0xfa7c('0x1a')]);router[_0xfa7c('0x17')](_0xfa7c('0x15'),auth['isAuthenticated'](),controller[_0xfa7c('0x1b')]);router['put'](_0xfa7c('0x1c'),auth[_0xfa7c('0xb')](),controller[_0xfa7c('0x1d')]);router[_0xfa7c('0x1e')](_0xfa7c('0x1c'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xfa7c('0x13'),auth['isAuthenticated'](),controller['removeLists']);router['delete']('/:id/blacklists',auth['isAuthenticated'](),controller[_0xfa7c('0x1f')]);module[_0xfa7c('0x20')]=router; \ No newline at end of file +var _0x3e5c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','post','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','delete','destroy','removeBlackLists','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x24f7ba,_0x3df933){_0x24f7ba=_0x24f7ba-0x0;var _0x13764d=_0x3e5c[_0x24f7ba];return _0x13764d;};'use strict';var multer=require(_0xc3e5('0x0'));var util=require(_0xc3e5('0x1'));var path=require(_0xc3e5('0x2'));var timeout=require(_0xc3e5('0x3'));var express=require('express');var router=express[_0xc3e5('0x4')]();var fs_extra=require(_0xc3e5('0x5'));var auth=require(_0xc3e5('0x6'));var interaction=require(_0xc3e5('0x7'));var config=require(_0xc3e5('0x8'));var controller=require(_0xc3e5('0x9'));router['get']('/',auth[_0xc3e5('0xa')](),controller[_0xc3e5('0xb')]);router[_0xc3e5('0xc')](_0xc3e5('0xd'),auth[_0xc3e5('0xa')](),controller['show']);router[_0xc3e5('0xc')](_0xc3e5('0xe'),auth[_0xc3e5('0xa')](),controller[_0xc3e5('0xf')]);router[_0xc3e5('0xc')](_0xc3e5('0x10'),auth[_0xc3e5('0xa')](),controller['getHopperHistories']);router[_0xc3e5('0xc')](_0xc3e5('0x11'),auth[_0xc3e5('0xa')](),controller[_0xc3e5('0x12')]);router['get'](_0xc3e5('0x13'),auth[_0xc3e5('0xa')](),controller[_0xc3e5('0x14')]);router[_0xc3e5('0xc')](_0xc3e5('0x15'),auth[_0xc3e5('0xa')](),controller['getLists']);router['get']('/:id/blacklists',auth[_0xc3e5('0xa')](),controller['getBlackLists']);router[_0xc3e5('0x16')]('/',auth[_0xc3e5('0xa')](),controller['create']);router[_0xc3e5('0x16')](_0xc3e5('0x17'),auth[_0xc3e5('0xa')](),controller[_0xc3e5('0x18')]);router[_0xc3e5('0x16')]('/:id/lists',auth[_0xc3e5('0xa')](),controller[_0xc3e5('0x19')]);router[_0xc3e5('0x16')](_0xc3e5('0x1a'),auth[_0xc3e5('0xa')](),controller[_0xc3e5('0x1b')]);router['put'](_0xc3e5('0xd'),auth[_0xc3e5('0xa')](),controller['update']);router[_0xc3e5('0x1c')]('/:id',auth[_0xc3e5('0xa')](),controller[_0xc3e5('0x1d')]);router[_0xc3e5('0x1c')](_0xc3e5('0x15'),auth[_0xc3e5('0xa')](),controller['removeLists']);router[_0xc3e5('0x1c')](_0xc3e5('0x1a'),auth[_0xc3e5('0xa')](),controller[_0xc3e5('0x1e')]);module[_0xc3e5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 23ef757..072bc5a 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 _0x5263=['TEXT','medium','STRING','VIRTUAL','getDataValue','key','sequelize'];(function(_0x458c52,_0x5e3fb4){var _0x43f43b=function(_0x5cdfeb){while(--_0x5cdfeb){_0x458c52['push'](_0x458c52['shift']());}};_0x43f43b(++_0x5e3fb4);}(_0x5263,0x141));var _0x3526=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x5263[_0x288f5e];return _0x476cc9;};'use strict';var Sequelize=require(_0x3526('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x3526('0x1')],'length':_0x3526('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x3526('0x3')]},'name':{'type':Sequelize[_0x3526('0x4')],'get':function(){return this[_0x3526('0x5')](_0x3526('0x6'));}}}; \ No newline at end of file +var _0x729e=['TEXT','medium','STRING','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x729e,0x8e));var _0xe729=function(_0x5265c9,_0x486bf8){_0x5265c9=_0x5265c9-0x0;var _0x454496=_0x729e[_0x5265c9];return _0x454496;};'use strict';var Sequelize=require(_0xe729('0x0'));module[_0xe729('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xe729('0x2')],'length':_0xe729('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xe729('0x4')]},'name':{'type':Sequelize[_0xe729('0x5')],'get':function(){return this[_0xe729('0x6')](_0xe729('0x7'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 2968b4a..89697d9 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 _0xbd34=['query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','options','findAll','catch','show','params','intersection','length','includeAll','include','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','CannedAnswers','sendStatus','error','stack','name','send','index','CannedAnswer','rawAttributes','type','key','model','map'];(function(_0x3149ef,_0x12dc71){var _0x535e72=function(_0x2e351d){while(--_0x2e351d){_0x3149ef['push'](_0x3149ef['shift']());}};_0x535e72(++_0x12dc71);}(_0xbd34,0x189));var _0x4bd3=function(_0x423a85,_0x59e206){_0x423a85=_0x423a85-0x0;var _0x5bb0dc=_0xbd34[_0x423a85];return _0x5bb0dc;};'use strict';var emlformat=require(_0x4bd3('0x0'));var rimraf=require(_0x4bd3('0x1'));var zipdir=require(_0x4bd3('0x2'));var jsonpatch=require(_0x4bd3('0x3'));var rp=require(_0x4bd3('0x4'));var moment=require(_0x4bd3('0x5'));var BPromise=require(_0x4bd3('0x6'));var Mustache=require(_0x4bd3('0x7'));var util=require('util');var path=require(_0x4bd3('0x8'));var sox=require(_0x4bd3('0x9'));var csv=require(_0x4bd3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4bd3('0xb'));var squel=require('squel');var crypto=require(_0x4bd3('0xc'));var jsforce=require(_0x4bd3('0xd'));var deskjs=require(_0x4bd3('0xe'));var toCsv=require(_0x4bd3('0xa'));var querystring=require(_0x4bd3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4bd3('0x10'));var qs=require(_0x4bd3('0x11'));var as=require(_0x4bd3('0x12'));var hardwareService=require(_0x4bd3('0x13'));var logger=require(_0x4bd3('0x14'))(_0x4bd3('0x15'));var utils=require(_0x4bd3('0x16'));var config=require(_0x4bd3('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d9d0e,_0x2dac95){_0x2dac95=_0x2dac95||0xcc;return function(_0x128d47){if(_0x128d47){return _0x1d9d0e['sendStatus'](_0x2dac95);}return _0x1d9d0e[_0x4bd3('0x18')](_0x2dac95)[_0x4bd3('0x19')]();};}function respondWithResult(_0x22afd6,_0x3f68c6){_0x3f68c6=_0x3f68c6||0xc8;return function(_0x5dcb9d){if(_0x5dcb9d){return _0x22afd6[_0x4bd3('0x18')](_0x3f68c6)[_0x4bd3('0x1a')](_0x5dcb9d);}};}function respondWithFilteredResult(_0x1f6565,_0x508342){return function(_0x5290db){if(_0x5290db){var _0x22fa57=typeof _0x508342[_0x4bd3('0x1b')]===_0x4bd3('0x1c')&&typeof _0x508342[_0x4bd3('0x1d')]==='undefined';var _0x52af2e=_0x5290db[_0x4bd3('0x1e')];var _0x15515e=_0x22fa57?0x0:_0x508342['offset'];var _0x1447c6=_0x22fa57?_0x5290db['count']:_0x508342[_0x4bd3('0x1b')]+_0x508342[_0x4bd3('0x1d')];var _0x48a395;if(_0x1447c6>=_0x52af2e){_0x1447c6=_0x52af2e;_0x48a395=0xc8;}else{_0x48a395=0xce;}_0x1f6565[_0x4bd3('0x18')](_0x48a395);return _0x1f6565[_0x4bd3('0x1f')](_0x4bd3('0x20'),_0x15515e+'-'+_0x1447c6+'/'+_0x52af2e)[_0x4bd3('0x1a')](_0x5290db);}return null;};}function patchUpdates(_0x29efd2){return function(_0x434d90){try{jsonpatch[_0x4bd3('0x21')](_0x434d90,_0x29efd2,!![]);}catch(_0x354507){return BPromise[_0x4bd3('0x22')](_0x354507);}return _0x434d90['save']();};}function saveUpdates(_0x30027c,_0x2c34c6){return function(_0x5eaccd){if(_0x5eaccd){return _0x5eaccd[_0x4bd3('0x23')](_0x30027c)[_0x4bd3('0x24')](function(_0x3c9909){return _0x3c9909;});}return null;};}function removeEntity(_0x220f65,_0x33ea49){return function(_0x381a57){if(_0x381a57){return _0x381a57[_0x4bd3('0x25')]()[_0x4bd3('0x24')](function(){var _0x50e15f=_0x381a57[_0x4bd3('0x26')]({'plain':!![]});var _0x5e373d=_0x4bd3('0x27');return db['UserProfileResource'][_0x4bd3('0x25')]({'where':{'type':_0x5e373d,'resourceId':_0x50e15f['id']}})['then'](function(){return _0x381a57;});})[_0x4bd3('0x24')](function(){_0x220f65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c2934,_0x5ef90d){return function(_0x59f57a){if(!_0x59f57a){_0x3c2934[_0x4bd3('0x28')](0x194);}return _0x59f57a;};}function handleError(_0x11570c,_0x32e73b){_0x32e73b=_0x32e73b||0x1f4;return function(_0x36a7bc){logger[_0x4bd3('0x29')](_0x36a7bc[_0x4bd3('0x2a')]);if(_0x36a7bc['name']){delete _0x36a7bc[_0x4bd3('0x2b')];}_0x11570c[_0x4bd3('0x18')](_0x32e73b)[_0x4bd3('0x2c')](_0x36a7bc);};}exports[_0x4bd3('0x2d')]=function(_0x538452,_0x4e6f71){var _0x316653={},_0x173f21={},_0x558dce={'count':0x0,'rows':[]};var _0x47e97c=_['map'](db[_0x4bd3('0x2e')][_0x4bd3('0x2f')],function(_0x274982){return{'name':_0x274982['fieldName'],'type':_0x274982[_0x4bd3('0x30')][_0x4bd3('0x31')]};});_0x173f21[_0x4bd3('0x32')]=_[_0x4bd3('0x33')](_0x47e97c,'name');_0x173f21[_0x4bd3('0x34')]=_[_0x4bd3('0x35')](_0x538452[_0x4bd3('0x34')]);_0x173f21['filters']=_['intersection'](_0x173f21[_0x4bd3('0x32')],_0x173f21[_0x4bd3('0x34')]);_0x316653[_0x4bd3('0x36')]=_['intersection'](_0x173f21[_0x4bd3('0x32')],qs[_0x4bd3('0x37')](_0x538452['query'][_0x4bd3('0x37')]));_0x316653[_0x4bd3('0x36')]=_0x316653[_0x4bd3('0x36')]['length']?_0x316653[_0x4bd3('0x36')]:_0x173f21[_0x4bd3('0x32')];if(!_0x538452[_0x4bd3('0x34')][_0x4bd3('0x38')](_0x4bd3('0x39'))){_0x316653[_0x4bd3('0x1d')]=qs[_0x4bd3('0x1d')](_0x538452[_0x4bd3('0x34')][_0x4bd3('0x1d')]);_0x316653['offset']=qs[_0x4bd3('0x1b')](_0x538452['query']['offset']);}_0x316653[_0x4bd3('0x3a')]=qs[_0x4bd3('0x3b')](_0x538452[_0x4bd3('0x34')][_0x4bd3('0x3b')]);_0x316653['where']=qs[_0x4bd3('0x3c')](_[_0x4bd3('0x3d')](_0x538452[_0x4bd3('0x34')],_0x173f21[_0x4bd3('0x3c')]),_0x47e97c);if(_0x538452[_0x4bd3('0x34')]['filter']){_0x316653[_0x4bd3('0x3e')]=_[_0x4bd3('0x3f')](_0x316653[_0x4bd3('0x3e')],{'$or':[{'key':{'$like':'%'+_0x538452['query']['filter']+'%'}},{'value':{'$like':'%'+_0x538452[_0x4bd3('0x34')]['filter']+'%'}}]});}_0x316653=_['merge']({},_0x316653,_0x538452[_0x4bd3('0x40')]);var _0x542639={'where':_0x316653[_0x4bd3('0x3e')]};return db[_0x4bd3('0x2e')][_0x4bd3('0x1e')](_0x542639)[_0x4bd3('0x24')](function(_0x1420d1){_0x558dce[_0x4bd3('0x1e')]=_0x1420d1;if(_0x538452[_0x4bd3('0x34')]['includeAll']){_0x316653['include']=[{'all':!![]}];}return db[_0x4bd3('0x2e')][_0x4bd3('0x41')](_0x316653);})['then'](function(_0x53827f){_0x558dce['rows']=_0x53827f;return _0x558dce;})[_0x4bd3('0x24')](respondWithFilteredResult(_0x4e6f71,_0x316653))[_0x4bd3('0x42')](handleError(_0x4e6f71,null));};exports[_0x4bd3('0x43')]=function(_0x55c020,_0x5c16ed){var _0x11c5d7={'raw':!![],'where':{'id':_0x55c020[_0x4bd3('0x44')]['id']}},_0x371ec5={};_0x371ec5[_0x4bd3('0x32')]=_[_0x4bd3('0x35')](db[_0x4bd3('0x2e')][_0x4bd3('0x2f')]);_0x371ec5[_0x4bd3('0x34')]=_['keys'](_0x55c020['query']);_0x371ec5[_0x4bd3('0x3c')]=_[_0x4bd3('0x45')](_0x371ec5['model'],_0x371ec5['query']);_0x11c5d7[_0x4bd3('0x36')]=_[_0x4bd3('0x45')](_0x371ec5[_0x4bd3('0x32')],qs['fields'](_0x55c020[_0x4bd3('0x34')][_0x4bd3('0x37')]));_0x11c5d7[_0x4bd3('0x36')]=_0x11c5d7[_0x4bd3('0x36')][_0x4bd3('0x46')]?_0x11c5d7[_0x4bd3('0x36')]:_0x371ec5[_0x4bd3('0x32')];if(_0x55c020[_0x4bd3('0x34')][_0x4bd3('0x47')]){_0x11c5d7[_0x4bd3('0x48')]=[{'all':!![]}];}_0x11c5d7=_[_0x4bd3('0x3f')]({},_0x11c5d7,_0x55c020[_0x4bd3('0x40')]);return db[_0x4bd3('0x2e')]['find'](_0x11c5d7)['then'](handleEntityNotFound(_0x5c16ed,null))['then'](respondWithResult(_0x5c16ed,null))[_0x4bd3('0x42')](handleError(_0x5c16ed,null));};exports['update']=function(_0xe4b018,_0xe3d653){if(_0xe4b018['body']['id']){delete _0xe4b018[_0x4bd3('0x49')]['id'];}return db[_0x4bd3('0x2e')][_0x4bd3('0x4a')]({'where':{'id':_0xe4b018[_0x4bd3('0x44')]['id']}})[_0x4bd3('0x24')](handleEntityNotFound(_0xe3d653,null))[_0x4bd3('0x24')](saveUpdates(_0xe4b018['body'],null))[_0x4bd3('0x24')](respondWithResult(_0xe3d653,null))[_0x4bd3('0x42')](handleError(_0xe3d653,null));};exports[_0x4bd3('0x25')]=function(_0x2e6a6a,_0x31cf72){return db[_0x4bd3('0x2e')]['find']({'where':{'id':_0x2e6a6a[_0x4bd3('0x44')]['id']}})['then'](handleEntityNotFound(_0x31cf72,null))[_0x4bd3('0x24')](removeEntity(_0x31cf72,null))[_0x4bd3('0x42')](handleError(_0x31cf72,null));};exports[_0x4bd3('0x4b')]=function(_0x4f6926,_0x535321){var _0xa3f6ae={'key':_0x4f6926[_0x4bd3('0x49')][_0x4bd3('0x31')]};if(_0x4f6926[_0x4bd3('0x49')]['MailAccountId']){_0xa3f6ae[_0x4bd3('0x4c')]=_0x4f6926[_0x4bd3('0x49')][_0x4bd3('0x4c')];}else if(_0x4f6926['body']['SmsAccountId']){_0xa3f6ae[_0x4bd3('0x4d')]=_0x4f6926[_0x4bd3('0x49')][_0x4bd3('0x4d')];}else if(_0x4f6926[_0x4bd3('0x49')][_0x4bd3('0x4e')]){_0xa3f6ae[_0x4bd3('0x4e')]=_0x4f6926[_0x4bd3('0x49')][_0x4bd3('0x4e')];}else if(_0x4f6926['body'][_0x4bd3('0x4f')]){_0xa3f6ae['ChatWebsiteId']=_0x4f6926[_0x4bd3('0x49')][_0x4bd3('0x4f')];}return db[_0x4bd3('0x2e')][_0x4bd3('0x4a')]({'where':_0xa3f6ae})[_0x4bd3('0x24')](function(_0x1a7280){if(_0x1a7280){throw new db[(_0x4bd3('0x50'))][(_0x4bd3('0x51'))](_0x4bd3('0x52'));}return db[_0x4bd3('0x2e')]['create'](_0x4f6926[_0x4bd3('0x49')]);})[_0x4bd3('0x24')](function(_0x2846cf){var _0x9ed4fa=_0x4f6926[_0x4bd3('0x53')][_0x4bd3('0x26')]({'plain':!![]});if(!_0x9ed4fa)throw new Error(_0x4bd3('0x54'));if(_0x9ed4fa['role']===_0x4bd3('0x53')){var _0x4713e5=_0x2846cf['get']({'plain':!![]});return db[_0x4bd3('0x55')][_0x4bd3('0x4a')]({'where':{'name':_0x4bd3('0x27'),'userProfileId':_0x9ed4fa[_0x4bd3('0x56')]},'raw':!![]})[_0x4bd3('0x24')](function(_0x2c89da){if(_0x2c89da&&_0x2c89da['autoAssociation']===0x0){return db[_0x4bd3('0x57')][_0x4bd3('0x4b')]({'name':_0x4713e5[_0x4bd3('0x2b')],'resourceId':_0x4713e5['id'],'type':_0x2c89da['name'],'sectionId':_0x2c89da['id']},{})[_0x4bd3('0x24')](function(){return _0x2846cf;});}else{return _0x2846cf;}})[_0x4bd3('0x42')](function(_0x11cee6){logger[_0x4bd3('0x29')](_0x4bd3('0x58'),_0x11cee6);throw _0x11cee6;});}return _0x2846cf;})[_0x4bd3('0x24')](respondWithResult(_0x535321,0xc9))[_0x4bd3('0x42')](handleError(_0x535321,null));}; \ No newline at end of file +var _0x2425=['rows','catch','show','params','length','options','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','findAll'];(function(_0x2c196a,_0x38f6ba){var _0x4d3aa2=function(_0x101e27){while(--_0x101e27){_0x2c196a['push'](_0x2c196a['shift']());}};_0x4d3aa2(++_0x38f6ba);}(_0x2425,0x6d));var _0x5242=function(_0x13d1e1,_0x22aeff){_0x13d1e1=_0x13d1e1-0x0;var _0xeb442c=_0x2425[_0x13d1e1];return _0xeb442c;};'use strict';var emlformat=require(_0x5242('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5242('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5242('0x2'));var moment=require(_0x5242('0x3'));var BPromise=require(_0x5242('0x4'));var Mustache=require(_0x5242('0x5'));var util=require(_0x5242('0x6'));var path=require(_0x5242('0x7'));var sox=require(_0x5242('0x8'));var csv=require(_0x5242('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5242('0xa'));var squel=require(_0x5242('0xb'));var crypto=require(_0x5242('0xc'));var jsforce=require(_0x5242('0xd'));var deskjs=require(_0x5242('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5242('0xf'));var Redis=require('ioredis');var authService=require(_0x5242('0x10'));var qs=require(_0x5242('0x11'));var as=require(_0x5242('0x12'));var hardwareService=require(_0x5242('0x13'));var logger=require(_0x5242('0x14'))(_0x5242('0x15'));var utils=require(_0x5242('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5242('0x17'));var db=require(_0x5242('0x18'))['db'];function respondWithStatusCode(_0x565b74,_0x3b4aab){_0x3b4aab=_0x3b4aab||0xcc;return function(_0x350ad7){if(_0x350ad7){return _0x565b74[_0x5242('0x19')](_0x3b4aab);}return _0x565b74['status'](_0x3b4aab)[_0x5242('0x1a')]();};}function respondWithResult(_0x38b209,_0x49cb0c){_0x49cb0c=_0x49cb0c||0xc8;return function(_0x351bac){if(_0x351bac){return _0x38b209[_0x5242('0x1b')](_0x49cb0c)['json'](_0x351bac);}};}function respondWithFilteredResult(_0x46bda2,_0x2555b5){return function(_0x2f2098){if(_0x2f2098){var _0xf192e4=typeof _0x2555b5[_0x5242('0x1c')]===_0x5242('0x1d')&&typeof _0x2555b5[_0x5242('0x1e')]==='undefined';var _0x14f2de=_0x2f2098['count'];var _0x9faa8e=_0xf192e4?0x0:_0x2555b5[_0x5242('0x1c')];var _0x220793=_0xf192e4?_0x2f2098[_0x5242('0x1f')]:_0x2555b5[_0x5242('0x1c')]+_0x2555b5['limit'];var _0x1540d8;if(_0x220793>=_0x14f2de){_0x220793=_0x14f2de;_0x1540d8=0xc8;}else{_0x1540d8=0xce;}_0x46bda2[_0x5242('0x1b')](_0x1540d8);return _0x46bda2[_0x5242('0x20')](_0x5242('0x21'),_0x9faa8e+'-'+_0x220793+'/'+_0x14f2de)['json'](_0x2f2098);}return null;};}function patchUpdates(_0xad2d01){return function(_0x2b3f05){try{jsonpatch[_0x5242('0x22')](_0x2b3f05,_0xad2d01,!![]);}catch(_0x12a856){return BPromise[_0x5242('0x23')](_0x12a856);}return _0x2b3f05['save']();};}function saveUpdates(_0x2a2611,_0x286271){return function(_0x2a4183){if(_0x2a4183){return _0x2a4183['update'](_0x2a2611)[_0x5242('0x24')](function(_0x4846b5){return _0x4846b5;});}return null;};}function removeEntity(_0x3bfea2,_0x51d9dd){return function(_0x120664){if(_0x120664){return _0x120664[_0x5242('0x25')]()[_0x5242('0x24')](function(){var _0x2b4ec6=_0x120664[_0x5242('0x26')]({'plain':!![]});var _0x473be6=_0x5242('0x27');return db[_0x5242('0x28')][_0x5242('0x25')]({'where':{'type':_0x473be6,'resourceId':_0x2b4ec6['id']}})[_0x5242('0x24')](function(){return _0x120664;});})[_0x5242('0x24')](function(){_0x3bfea2[_0x5242('0x1b')](0xcc)[_0x5242('0x1a')]();});}};}function handleEntityNotFound(_0xaa9520,_0x5aa8af){return function(_0x5da076){if(!_0x5da076){_0xaa9520[_0x5242('0x19')](0x194);}return _0x5da076;};}function handleError(_0x3dbe90,_0x4271a3){_0x4271a3=_0x4271a3||0x1f4;return function(_0x3b3ba3){logger[_0x5242('0x29')](_0x3b3ba3[_0x5242('0x2a')]);if(_0x3b3ba3[_0x5242('0x2b')]){delete _0x3b3ba3[_0x5242('0x2b')];}_0x3dbe90[_0x5242('0x1b')](_0x4271a3)['send'](_0x3b3ba3);};}exports['index']=function(_0x4fba7a,_0x298284){var _0x22aa39={},_0x13bfca={},_0x200371={'count':0x0,'rows':[]};var _0x4a2aa4=_[_0x5242('0x2c')](db[_0x5242('0x2d')][_0x5242('0x2e')],function(_0x412cb4){return{'name':_0x412cb4[_0x5242('0x2f')],'type':_0x412cb4['type'][_0x5242('0x30')]};});_0x13bfca[_0x5242('0x31')]=_[_0x5242('0x2c')](_0x4a2aa4,'name');_0x13bfca[_0x5242('0x32')]=_[_0x5242('0x33')](_0x4fba7a['query']);_0x13bfca[_0x5242('0x34')]=_[_0x5242('0x35')](_0x13bfca[_0x5242('0x31')],_0x13bfca[_0x5242('0x32')]);_0x22aa39[_0x5242('0x36')]=_[_0x5242('0x35')](_0x13bfca[_0x5242('0x31')],qs[_0x5242('0x37')](_0x4fba7a['query']['fields']));_0x22aa39[_0x5242('0x36')]=_0x22aa39[_0x5242('0x36')]['length']?_0x22aa39[_0x5242('0x36')]:_0x13bfca[_0x5242('0x31')];if(!_0x4fba7a[_0x5242('0x32')]['hasOwnProperty'](_0x5242('0x38'))){_0x22aa39[_0x5242('0x1e')]=qs[_0x5242('0x1e')](_0x4fba7a[_0x5242('0x32')][_0x5242('0x1e')]);_0x22aa39[_0x5242('0x1c')]=qs[_0x5242('0x1c')](_0x4fba7a[_0x5242('0x32')]['offset']);}_0x22aa39[_0x5242('0x39')]=qs['sort'](_0x4fba7a['query'][_0x5242('0x3a')]);_0x22aa39[_0x5242('0x3b')]=qs[_0x5242('0x34')](_['pick'](_0x4fba7a[_0x5242('0x32')],_0x13bfca[_0x5242('0x34')]),_0x4a2aa4);if(_0x4fba7a[_0x5242('0x32')][_0x5242('0x3c')]){_0x22aa39[_0x5242('0x3b')]=_[_0x5242('0x3d')](_0x22aa39['where'],{'$or':[{'key':{'$like':'%'+_0x4fba7a[_0x5242('0x32')][_0x5242('0x3c')]+'%'}},{'value':{'$like':'%'+_0x4fba7a[_0x5242('0x32')]['filter']+'%'}}]});}_0x22aa39=_['merge']({},_0x22aa39,_0x4fba7a['options']);var _0x37a6a3={'where':_0x22aa39['where']};return db[_0x5242('0x2d')][_0x5242('0x1f')](_0x37a6a3)[_0x5242('0x24')](function(_0x5fba5a){_0x200371[_0x5242('0x1f')]=_0x5fba5a;if(_0x4fba7a[_0x5242('0x32')]['includeAll']){_0x22aa39['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x5242('0x3e')](_0x22aa39);})[_0x5242('0x24')](function(_0x2776ce){_0x200371[_0x5242('0x3f')]=_0x2776ce;return _0x200371;})['then'](respondWithFilteredResult(_0x298284,_0x22aa39))[_0x5242('0x40')](handleError(_0x298284,null));};exports[_0x5242('0x41')]=function(_0x278c32,_0x2eafe6){var _0x15621d={'raw':!![],'where':{'id':_0x278c32[_0x5242('0x42')]['id']}},_0x5180c1={};_0x5180c1[_0x5242('0x31')]=_[_0x5242('0x33')](db[_0x5242('0x2d')][_0x5242('0x2e')]);_0x5180c1['query']=_['keys'](_0x278c32[_0x5242('0x32')]);_0x5180c1['filters']=_[_0x5242('0x35')](_0x5180c1[_0x5242('0x31')],_0x5180c1[_0x5242('0x32')]);_0x15621d['attributes']=_[_0x5242('0x35')](_0x5180c1['model'],qs[_0x5242('0x37')](_0x278c32[_0x5242('0x32')][_0x5242('0x37')]));_0x15621d['attributes']=_0x15621d[_0x5242('0x36')][_0x5242('0x43')]?_0x15621d['attributes']:_0x5180c1['model'];if(_0x278c32[_0x5242('0x32')]['includeAll']){_0x15621d['include']=[{'all':!![]}];}_0x15621d=_[_0x5242('0x3d')]({},_0x15621d,_0x278c32[_0x5242('0x44')]);return db[_0x5242('0x2d')][_0x5242('0x45')](_0x15621d)[_0x5242('0x24')](handleEntityNotFound(_0x2eafe6,null))['then'](respondWithResult(_0x2eafe6,null))[_0x5242('0x40')](handleError(_0x2eafe6,null));};exports[_0x5242('0x46')]=function(_0x29c7a0,_0x22b887){if(_0x29c7a0[_0x5242('0x47')]['id']){delete _0x29c7a0['body']['id'];}return db[_0x5242('0x2d')][_0x5242('0x45')]({'where':{'id':_0x29c7a0[_0x5242('0x42')]['id']}})[_0x5242('0x24')](handleEntityNotFound(_0x22b887,null))['then'](saveUpdates(_0x29c7a0[_0x5242('0x47')],null))[_0x5242('0x24')](respondWithResult(_0x22b887,null))['catch'](handleError(_0x22b887,null));};exports[_0x5242('0x25')]=function(_0x5e01ab,_0x3c7ebf){return db[_0x5242('0x2d')]['find']({'where':{'id':_0x5e01ab[_0x5242('0x42')]['id']}})[_0x5242('0x24')](handleEntityNotFound(_0x3c7ebf,null))[_0x5242('0x24')](removeEntity(_0x3c7ebf,null))['catch'](handleError(_0x3c7ebf,null));};exports[_0x5242('0x48')]=function(_0x4a7794,_0x480bb2){var _0x19b08c={'key':_0x4a7794[_0x5242('0x47')][_0x5242('0x30')]};if(_0x4a7794[_0x5242('0x47')][_0x5242('0x49')]){_0x19b08c[_0x5242('0x49')]=_0x4a7794[_0x5242('0x47')][_0x5242('0x49')];}else if(_0x4a7794[_0x5242('0x47')]['SmsAccountId']){_0x19b08c[_0x5242('0x4a')]=_0x4a7794[_0x5242('0x47')]['SmsAccountId'];}else if(_0x4a7794['body'][_0x5242('0x4b')]){_0x19b08c['OpenchannelAccountId']=_0x4a7794['body'][_0x5242('0x4b')];}else if(_0x4a7794[_0x5242('0x47')][_0x5242('0x4c')]){_0x19b08c[_0x5242('0x4c')]=_0x4a7794[_0x5242('0x47')][_0x5242('0x4c')];}return db['CannedAnswer'][_0x5242('0x45')]({'where':_0x19b08c})['then'](function(_0x3e7574){if(_0x3e7574){throw new db[(_0x5242('0x4d'))]['ValidationError'](_0x5242('0x4e'));}return db[_0x5242('0x2d')][_0x5242('0x48')](_0x4a7794['body']);})[_0x5242('0x24')](function(_0x269ed2){var _0x3b499c=_0x4a7794['user'][_0x5242('0x26')]({'plain':!![]});if(!_0x3b499c)throw new Error(_0x5242('0x4f'));if(_0x3b499c[_0x5242('0x50')]===_0x5242('0x51')){var _0x489f02=_0x269ed2[_0x5242('0x26')]({'plain':!![]});return db[_0x5242('0x52')][_0x5242('0x45')]({'where':{'name':'CannedAnswers','userProfileId':_0x3b499c[_0x5242('0x53')]},'raw':!![]})[_0x5242('0x24')](function(_0x7c984d){if(_0x7c984d&&_0x7c984d[_0x5242('0x54')]===0x0){return db[_0x5242('0x28')]['create']({'name':_0x489f02[_0x5242('0x2b')],'resourceId':_0x489f02['id'],'type':_0x7c984d[_0x5242('0x2b')],'sectionId':_0x7c984d['id']},{})[_0x5242('0x24')](function(){return _0x269ed2;});}else{return _0x269ed2;}})[_0x5242('0x40')](function(_0x4a1f92){logger[_0x5242('0x29')](_0x5242('0x55'),_0x4a1f92);throw _0x4a1f92;});}return _0x269ed2;})[_0x5242('0x24')](respondWithResult(_0x480bb2,0xc9))[_0x5242('0x40')](handleError(_0x480bb2,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 50e3934..dc25446 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 _0x0922=['../../config/logger','api','bluebird','request-promise','./cannedAnswer.attributes','exports','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xea55c2,_0x2443b9){var _0x2c372d=function(_0x3a4e1b){while(--_0x3a4e1b){_0xea55c2['push'](_0xea55c2['shift']());}};_0x2c372d(++_0x2443b9);}(_0x0922,0x77));var _0x2092=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0x0922[_0x4ded65];return _0x5864fb;};'use strict';var _=require(_0x2092('0x0'));var util=require(_0x2092('0x1'));var logger=require(_0x2092('0x2'))(_0x2092('0x3'));var moment=require('moment');var BPromise=require(_0x2092('0x4'));var rp=require(_0x2092('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2092('0x6'));module[_0x2092('0x7')]=function(_0x40aebe,_0x14fab7){return _0x40aebe['define'](_0x2092('0x8'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2092('0x9'),'collate':_0x2092('0xa')});}; \ No newline at end of file +var _0x608c=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','tools_canned_answers'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x608c,0x1a1));var _0xc608=function(_0xf2a1b7,_0x1a3fc5){_0xf2a1b7=_0xf2a1b7-0x0;var _0x3aa303=_0x608c[_0xf2a1b7];return _0x3aa303;};'use strict';var _=require(_0xc608('0x0'));var util=require('util');var logger=require(_0xc608('0x1'))(_0xc608('0x2'));var moment=require(_0xc608('0x3'));var BPromise=require(_0xc608('0x4'));var rp=require(_0xc608('0x5'));var fs=require('fs');var path=require(_0xc608('0x6'));var rimraf=require(_0xc608('0x7'));var config=require(_0xc608('0x8'));var attributes=require(_0xc608('0x9'));module[_0xc608('0xa')]=function(_0x3bba49,_0x23b77b){return _0x3bba49['define']('CannedAnswer',attributes,{'tableName':_0xc608('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc608('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 2dacd0e..1ba6f13 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(_0x5e7220,_0x12961d){var _0x1d2dfe=function(_0x551a00){while(--_0x551a00){_0x5e7220['push'](_0x5e7220['shift']());}};_0x1d2dfe(++_0x12961d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x5a8761,_0x2ba7c4){var _0x40ca32=function(_0x46814a){while(--_0x46814a){_0x5a8761['push'](_0x5a8761['shift']());}};_0x40ca32(++_0x2ba7c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 2f25f67..40fd28f 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 _0x40f5=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','show','post','create','update','delete','/:id','exports','multer','util'];(function(_0x3fa2c8,_0x2de01e){var _0x1b0f3e=function(_0xd6cde){while(--_0xd6cde){_0x3fa2c8['push'](_0x3fa2c8['shift']());}};_0x1b0f3e(++_0x2de01e);}(_0x40f5,0x1a0));var _0x540f=function(_0x20c512,_0x36c198){_0x20c512=_0x20c512-0x0;var _0x25236e=_0x40f5[_0x20c512];return _0x25236e;};'use strict';var multer=require(_0x540f('0x0'));var util=require(_0x540f('0x1'));var path=require(_0x540f('0x2'));var timeout=require('connect-timeout');var express=require(_0x540f('0x3'));var router=express[_0x540f('0x4')]();var fs_extra=require(_0x540f('0x5'));var auth=require(_0x540f('0x6'));var interaction=require(_0x540f('0x7'));var config=require('../../config/environment');var controller=require(_0x540f('0x8'));router[_0x540f('0x9')]('/',auth[_0x540f('0xa')](),controller[_0x540f('0xb')]);router[_0x540f('0x9')]('/:id',auth[_0x540f('0xa')](),controller[_0x540f('0xc')]);router[_0x540f('0xd')]('/',auth[_0x540f('0xa')](),controller[_0x540f('0xe')]);router['put']('/:id',auth[_0x540f('0xa')](),controller[_0x540f('0xf')]);router[_0x540f('0x10')](_0x540f('0x11'),auth[_0x540f('0xa')](),controller['destroy']);module[_0x540f('0x12')]=router; \ No newline at end of file +var _0x6d38=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','/:id','show','post','isAuthenticated','update','delete'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x6d38,0x171));var _0x86d3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6d38[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x86d3('0x0'));var util=require(_0x86d3('0x1'));var path=require(_0x86d3('0x2'));var timeout=require(_0x86d3('0x3'));var express=require(_0x86d3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x86d3('0x5'));var interaction=require(_0x86d3('0x6'));var config=require('../../config/environment');var controller=require(_0x86d3('0x7'));router[_0x86d3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x86d3('0x8')](_0x86d3('0x9'),auth['isAuthenticated'](),controller[_0x86d3('0xa')]);router[_0x86d3('0xb')]('/',auth[_0x86d3('0xc')](),controller['create']);router['put']('/:id',auth[_0x86d3('0xc')](),controller[_0x86d3('0xd')]);router[_0x86d3('0xe')](_0x86d3('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x86d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 014df62..8a8983d 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 _0xde9f=['sequelize','exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x596c2e,_0x1f49e0){var _0x10ff6c=function(_0x712f24){while(--_0x712f24){_0x596c2e['push'](_0x596c2e['shift']());}};_0x10ff6c(++_0x1f49e0);}(_0xde9f,0x16d));var _0xfde9=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0xde9f[_0x484cac];return _0x1d6e77;};'use strict';var Sequelize=require(_0xfde9('0x0'));module[_0xfde9('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xfde9('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xfde9('0x3')]},'dst':{'type':Sequelize[_0xfde9('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfde9('0x3')]},'dstchannel':{'type':Sequelize[_0xfde9('0x3')]},'lastapp':{'type':Sequelize[_0xfde9('0x3')]},'lastdata':{'type':Sequelize[_0xfde9('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xfde9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xfde9('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfde9('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xfde9('0x3')]},'peeraccount':{'type':Sequelize[_0xfde9('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xfde9('0x3')]}}; \ No newline at end of file +var _0x1e9f=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','DATE'];(function(_0x4d782e,_0x1db60e){var _0x57ac83=function(_0x34c815){while(--_0x34c815){_0x4d782e['push'](_0x4d782e['shift']());}};_0x57ac83(++_0x1db60e);}(_0x1e9f,0x107));var _0xf1e9=function(_0x2371d0,_0x286b09){_0x2371d0=_0x2371d0-0x0;var _0x5f3a71=_0x1e9f[_0x2371d0];return _0x5f3a71;};'use strict';var Sequelize=require(_0xf1e9('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xf1e9('0x1')],'allowNull':![],'defaultValue':_0xf1e9('0x2')},'clid':{'type':Sequelize[_0xf1e9('0x3')]},'src':{'type':Sequelize[_0xf1e9('0x3')]},'dst':{'type':Sequelize[_0xf1e9('0x3')]},'dcontext':{'type':Sequelize[_0xf1e9('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xf1e9('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xf1e9('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xf1e9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf1e9('0x3')]},'userfield':{'type':Sequelize[_0xf1e9('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xf1e9('0x3')]},'sequence':{'type':Sequelize[_0xf1e9('0x3')]},'peeraccount':{'type':Sequelize[_0xf1e9('0x3')]},'type':{'type':Sequelize[_0xf1e9('0x3')]},'tag':{'type':Sequelize[_0xf1e9('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 9ccb573..8d6fa2c 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 _0x85d0=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','Cdr','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','describe','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x85d0,0x164));var _0x085d=function(_0x4a0223,_0x2d8972){_0x4a0223=_0x4a0223-0x0;var _0x5e3335=_0x85d0[_0x4a0223];return _0x5e3335;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x085d('0x0'));var moment=require(_0x085d('0x1'));var BPromise=require(_0x085d('0x2'));var Mustache=require(_0x085d('0x3'));var util=require(_0x085d('0x4'));var path=require(_0x085d('0x5'));var sox=require('sox');var csv=require(_0x085d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x085d('0x7'));var _=require(_0x085d('0x8'));var squel=require(_0x085d('0x9'));var crypto=require('crypto');var jsforce=require(_0x085d('0xa'));var deskjs=require(_0x085d('0xb'));var toCsv=require(_0x085d('0x6'));var querystring=require(_0x085d('0xc'));var Papa=require(_0x085d('0xd'));var Redis=require(_0x085d('0xe'));var authService=require(_0x085d('0xf'));var qs=require(_0x085d('0x10'));var as=require(_0x085d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x085d('0x12'))(_0x085d('0x13'));var utils=require(_0x085d('0x14'));var config=require(_0x085d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x085d('0x16'))['db'];function respondWithStatusCode(_0x2bd6ae,_0x5c6c27){_0x5c6c27=_0x5c6c27||0xcc;return function(_0x2e0714){if(_0x2e0714){return _0x2bd6ae[_0x085d('0x17')](_0x5c6c27);}return _0x2bd6ae[_0x085d('0x18')](_0x5c6c27)[_0x085d('0x19')]();};}function respondWithResult(_0x5a5252,_0x4b87b9){_0x4b87b9=_0x4b87b9||0xc8;return function(_0x19ce18){if(_0x19ce18){return _0x5a5252['status'](_0x4b87b9)['json'](_0x19ce18);}};}function respondWithFilteredResult(_0x267374,_0x334263){return function(_0x1d041b){if(_0x1d041b){var _0x5f8e18=typeof _0x334263[_0x085d('0x1a')]==='undefined'&&typeof _0x334263[_0x085d('0x1b')]===_0x085d('0x1c');var _0x1efea9=_0x1d041b[_0x085d('0x1d')];var _0x3e566f=_0x5f8e18?0x0:_0x334263[_0x085d('0x1a')];var _0x5c046e=_0x5f8e18?_0x1d041b[_0x085d('0x1d')]:_0x334263[_0x085d('0x1a')]+_0x334263['limit'];var _0xba531c;if(_0x5c046e>=_0x1efea9){_0x5c046e=_0x1efea9;_0xba531c=0xc8;}else{_0xba531c=0xce;}_0x267374[_0x085d('0x18')](_0xba531c);return _0x267374[_0x085d('0x1e')](_0x085d('0x1f'),_0x3e566f+'-'+_0x5c046e+'/'+_0x1efea9)[_0x085d('0x20')](_0x1d041b);}return null;};}function patchUpdates(_0x54eff1){return function(_0xb9d0ad){try{jsonpatch[_0x085d('0x21')](_0xb9d0ad,_0x54eff1,!![]);}catch(_0x39a85e){return BPromise[_0x085d('0x22')](_0x39a85e);}return _0xb9d0ad['save']();};}function saveUpdates(_0x5b3f9c,_0x4cdb11){return function(_0x2b7cdc){if(_0x2b7cdc){return _0x2b7cdc[_0x085d('0x23')](_0x5b3f9c)[_0x085d('0x24')](function(_0x10aa9d){return _0x10aa9d;});}return null;};}function removeEntity(_0x4715d6,_0x17dafb){return function(_0x576d95){if(_0x576d95){return _0x576d95[_0x085d('0x25')]()[_0x085d('0x24')](function(){_0x4715d6[_0x085d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38cddc,_0x290658){return function(_0xbacfbc){if(!_0xbacfbc){_0x38cddc[_0x085d('0x17')](0x194);}return _0xbacfbc;};}function handleError(_0x300295,_0x4b9032){_0x4b9032=_0x4b9032||0x1f4;return function(_0x5e5228){logger['error'](_0x5e5228[_0x085d('0x26')]);if(_0x5e5228[_0x085d('0x27')]){delete _0x5e5228[_0x085d('0x27')];}_0x300295['status'](_0x4b9032)[_0x085d('0x28')](_0x5e5228);};}exports[_0x085d('0x29')]=function(_0x3faf6b,_0x5c7849){var _0x2f670c={},_0x2eae2c={},_0x3f905d={'count':0x0,'rows':[]};var _0x26aa90=_['map'](db[_0x085d('0x2a')][_0x085d('0x2b')],function(_0x494070){return{'name':_0x494070[_0x085d('0x2c')],'type':_0x494070[_0x085d('0x2d')]['key']};});_0x2eae2c[_0x085d('0x2e')]=_[_0x085d('0x2f')](_0x26aa90,_0x085d('0x27'));_0x2eae2c['query']=_[_0x085d('0x30')](_0x3faf6b[_0x085d('0x31')]);_0x2eae2c[_0x085d('0x32')]=_['intersection'](_0x2eae2c[_0x085d('0x2e')],_0x2eae2c['query']);_0x2f670c[_0x085d('0x33')]=_[_0x085d('0x34')](_0x2eae2c[_0x085d('0x2e')],qs[_0x085d('0x35')](_0x3faf6b['query'][_0x085d('0x35')]));_0x2f670c[_0x085d('0x33')]=_0x2f670c[_0x085d('0x33')][_0x085d('0x36')]?_0x2f670c['attributes']:_0x2eae2c['model'];if(!_0x3faf6b[_0x085d('0x31')][_0x085d('0x37')](_0x085d('0x38'))){_0x2f670c[_0x085d('0x1b')]=qs[_0x085d('0x1b')](_0x3faf6b[_0x085d('0x31')][_0x085d('0x1b')]);_0x2f670c[_0x085d('0x1a')]=qs[_0x085d('0x1a')](_0x3faf6b['query'][_0x085d('0x1a')]);}_0x2f670c[_0x085d('0x39')]=qs['sort'](_0x3faf6b[_0x085d('0x31')]['sort']);_0x2f670c[_0x085d('0x3a')]=qs[_0x085d('0x32')](_['pick'](_0x3faf6b[_0x085d('0x31')],_0x2eae2c[_0x085d('0x32')]),_0x26aa90);if(_0x3faf6b[_0x085d('0x31')][_0x085d('0x3b')]){_0x2f670c[_0x085d('0x3a')]=_['merge'](_0x2f670c[_0x085d('0x3a')],{'$or':_['map'](_0x26aa90,function(_0x5d52be){if(_0x5d52be[_0x085d('0x2d')]!==_0x085d('0x3c')){var _0x31ee22={};_0x31ee22[_0x5d52be[_0x085d('0x27')]]={'$like':'%'+_0x3faf6b[_0x085d('0x31')]['filter']+'%'};return _0x31ee22;}})});}_0x2f670c=_[_0x085d('0x3d')]({},_0x2f670c,_0x3faf6b['options']);var _0x3a8646={'where':_0x2f670c[_0x085d('0x3a')]};return db[_0x085d('0x2a')]['count'](_0x3a8646)[_0x085d('0x24')](function(_0x55d81a){_0x3f905d[_0x085d('0x1d')]=_0x55d81a;if(_0x3faf6b[_0x085d('0x31')]['includeAll']){_0x2f670c[_0x085d('0x3e')]=[{'all':!![]}];}return db[_0x085d('0x2a')][_0x085d('0x3f')](_0x2f670c);})['then'](function(_0x56428e){_0x3f905d[_0x085d('0x40')]=_0x56428e;return _0x3f905d;})[_0x085d('0x24')](respondWithFilteredResult(_0x5c7849,_0x2f670c))[_0x085d('0x41')](handleError(_0x5c7849,null));};exports[_0x085d('0x42')]=function(_0x177f7d,_0x367a32){var _0x27e1c7={'raw':!![],'where':{'id':_0x177f7d[_0x085d('0x43')]['id']}},_0x120980={};_0x120980[_0x085d('0x2e')]=_['keys'](db['Cdr'][_0x085d('0x2b')]);_0x120980[_0x085d('0x31')]=_[_0x085d('0x30')](_0x177f7d[_0x085d('0x31')]);_0x120980[_0x085d('0x32')]=_[_0x085d('0x34')](_0x120980[_0x085d('0x2e')],_0x120980[_0x085d('0x31')]);_0x27e1c7[_0x085d('0x33')]=_[_0x085d('0x34')](_0x120980[_0x085d('0x2e')],qs['fields'](_0x177f7d[_0x085d('0x31')][_0x085d('0x35')]));_0x27e1c7[_0x085d('0x33')]=_0x27e1c7[_0x085d('0x33')][_0x085d('0x36')]?_0x27e1c7['attributes']:_0x120980[_0x085d('0x2e')];if(_0x177f7d['query'][_0x085d('0x44')]){_0x27e1c7['include']=[{'all':!![]}];}_0x27e1c7=_['merge']({},_0x27e1c7,_0x177f7d[_0x085d('0x45')]);return db[_0x085d('0x2a')][_0x085d('0x46')](_0x27e1c7)[_0x085d('0x24')](handleEntityNotFound(_0x367a32,null))[_0x085d('0x24')](respondWithResult(_0x367a32,null))['catch'](handleError(_0x367a32,null));};exports['create']=function(_0x547723,_0x580b91){return db['Cdr'][_0x085d('0x47')](_0x547723[_0x085d('0x48')],{})['then'](respondWithResult(_0x580b91,0xc9))[_0x085d('0x41')](handleError(_0x580b91,null));};exports['update']=function(_0x5df4cf,_0x415a4b){if(_0x5df4cf[_0x085d('0x48')]['id']){delete _0x5df4cf[_0x085d('0x48')]['id'];}return db[_0x085d('0x2a')]['find']({'where':{'id':_0x5df4cf[_0x085d('0x43')]['id']}})['then'](handleEntityNotFound(_0x415a4b,null))[_0x085d('0x24')](saveUpdates(_0x5df4cf[_0x085d('0x48')],null))['then'](respondWithResult(_0x415a4b,null))[_0x085d('0x41')](handleError(_0x415a4b,null));};exports[_0x085d('0x25')]=function(_0x298f6f,_0x37b56c){return db['Cdr'][_0x085d('0x46')]({'where':{'id':_0x298f6f['params']['id']}})[_0x085d('0x24')](handleEntityNotFound(_0x37b56c,null))['then'](removeEntity(_0x37b56c,null))['catch'](handleError(_0x37b56c,null));};exports[_0x085d('0x49')]=function(_0x41e3e0,_0x236368){return db[_0x085d('0x2a')][_0x085d('0x49')]()[_0x085d('0x24')](respondWithResult(_0x236368,null))[_0x085d('0x41')](handleError(_0x236368,null));}; \ No newline at end of file +var _0x72b1=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x72b1,0x16e));var _0x172b=function(_0x5df59f,_0x221fa7){_0x5df59f=_0x5df59f-0x0;var _0x17d295=_0x72b1[_0x5df59f];return _0x17d295;};'use strict';var emlformat=require(_0x172b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x172b('0x1'));var jsonpatch=require(_0x172b('0x2'));var rp=require(_0x172b('0x3'));var moment=require(_0x172b('0x4'));var BPromise=require(_0x172b('0x5'));var Mustache=require(_0x172b('0x6'));var util=require(_0x172b('0x7'));var path=require('path');var sox=require(_0x172b('0x8'));var csv=require(_0x172b('0x9'));var ejs=require(_0x172b('0xa'));var fs=require('fs');var fs_extra=require(_0x172b('0xb'));var _=require('lodash');var squel=require(_0x172b('0xc'));var crypto=require('crypto');var jsforce=require(_0x172b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x172b('0x9'));var querystring=require(_0x172b('0xe'));var Papa=require(_0x172b('0xf'));var Redis=require(_0x172b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x172b('0x11'));var as=require(_0x172b('0x12'));var hardwareService=require(_0x172b('0x13'));var logger=require(_0x172b('0x14'))(_0x172b('0x15'));var utils=require(_0x172b('0x16'));var config=require(_0x172b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x172b('0x18'))['db'];function respondWithStatusCode(_0x82727f,_0xdf832e){_0xdf832e=_0xdf832e||0xcc;return function(_0x4970f8){if(_0x4970f8){return _0x82727f[_0x172b('0x19')](_0xdf832e);}return _0x82727f['status'](_0xdf832e)[_0x172b('0x1a')]();};}function respondWithResult(_0x81e11e,_0x5239b9){_0x5239b9=_0x5239b9||0xc8;return function(_0x1b7247){if(_0x1b7247){return _0x81e11e[_0x172b('0x1b')](_0x5239b9)[_0x172b('0x1c')](_0x1b7247);}};}function respondWithFilteredResult(_0xa28463,_0x5b0ab1){return function(_0x5293ef){if(_0x5293ef){var _0x3625bb=typeof _0x5b0ab1[_0x172b('0x1d')]===_0x172b('0x1e')&&typeof _0x5b0ab1[_0x172b('0x1f')]==='undefined';var _0x4f369b=_0x5293ef[_0x172b('0x20')];var _0x3b2701=_0x3625bb?0x0:_0x5b0ab1[_0x172b('0x1d')];var _0xba7825=_0x3625bb?_0x5293ef[_0x172b('0x20')]:_0x5b0ab1['offset']+_0x5b0ab1[_0x172b('0x1f')];var _0x2d24f9;if(_0xba7825>=_0x4f369b){_0xba7825=_0x4f369b;_0x2d24f9=0xc8;}else{_0x2d24f9=0xce;}_0xa28463[_0x172b('0x1b')](_0x2d24f9);return _0xa28463[_0x172b('0x21')](_0x172b('0x22'),_0x3b2701+'-'+_0xba7825+'/'+_0x4f369b)[_0x172b('0x1c')](_0x5293ef);}return null;};}function patchUpdates(_0x296aa6){return function(_0x5c7e17){try{jsonpatch['apply'](_0x5c7e17,_0x296aa6,!![]);}catch(_0x562db9){return BPromise['reject'](_0x562db9);}return _0x5c7e17[_0x172b('0x23')]();};}function saveUpdates(_0x4c8090,_0x721d07){return function(_0x25ee62){if(_0x25ee62){return _0x25ee62[_0x172b('0x24')](_0x4c8090)[_0x172b('0x25')](function(_0x32419a){return _0x32419a;});}return null;};}function removeEntity(_0x24e4ff,_0x507b99){return function(_0x1cefd1){if(_0x1cefd1){return _0x1cefd1[_0x172b('0x26')]()['then'](function(){_0x24e4ff[_0x172b('0x1b')](0xcc)[_0x172b('0x1a')]();});}};}function handleEntityNotFound(_0x3df490,_0x29e1d4){return function(_0x356c83){if(!_0x356c83){_0x3df490[_0x172b('0x19')](0x194);}return _0x356c83;};}function handleError(_0x39bdc5,_0x5ee442){_0x5ee442=_0x5ee442||0x1f4;return function(_0x1deb7e){logger[_0x172b('0x27')](_0x1deb7e['stack']);if(_0x1deb7e[_0x172b('0x28')]){delete _0x1deb7e[_0x172b('0x28')];}_0x39bdc5[_0x172b('0x1b')](_0x5ee442)[_0x172b('0x29')](_0x1deb7e);};}exports[_0x172b('0x2a')]=function(_0x4bea8e,_0x9624f5){var _0x37acc5={},_0x596b4c={},_0x5db251={'count':0x0,'rows':[]};var _0x43728b=_[_0x172b('0x2b')](db[_0x172b('0x2c')][_0x172b('0x2d')],function(_0x367f80){return{'name':_0x367f80[_0x172b('0x2e')],'type':_0x367f80[_0x172b('0x2f')][_0x172b('0x30')]};});_0x596b4c[_0x172b('0x31')]=_[_0x172b('0x2b')](_0x43728b,_0x172b('0x28'));_0x596b4c[_0x172b('0x32')]=_[_0x172b('0x33')](_0x4bea8e[_0x172b('0x32')]);_0x596b4c[_0x172b('0x34')]=_[_0x172b('0x35')](_0x596b4c[_0x172b('0x31')],_0x596b4c[_0x172b('0x32')]);_0x37acc5[_0x172b('0x36')]=_[_0x172b('0x35')](_0x596b4c[_0x172b('0x31')],qs[_0x172b('0x37')](_0x4bea8e[_0x172b('0x32')][_0x172b('0x37')]));_0x37acc5[_0x172b('0x36')]=_0x37acc5['attributes'][_0x172b('0x38')]?_0x37acc5[_0x172b('0x36')]:_0x596b4c[_0x172b('0x31')];if(!_0x4bea8e['query'][_0x172b('0x39')]('nolimit')){_0x37acc5['limit']=qs['limit'](_0x4bea8e[_0x172b('0x32')]['limit']);_0x37acc5['offset']=qs[_0x172b('0x1d')](_0x4bea8e[_0x172b('0x32')][_0x172b('0x1d')]);}_0x37acc5['order']=qs[_0x172b('0x3a')](_0x4bea8e[_0x172b('0x32')][_0x172b('0x3a')]);_0x37acc5[_0x172b('0x3b')]=qs[_0x172b('0x34')](_[_0x172b('0x3c')](_0x4bea8e[_0x172b('0x32')],_0x596b4c[_0x172b('0x34')]),_0x43728b);if(_0x4bea8e[_0x172b('0x32')][_0x172b('0x3d')]){_0x37acc5[_0x172b('0x3b')]=_[_0x172b('0x3e')](_0x37acc5[_0x172b('0x3b')],{'$or':_[_0x172b('0x2b')](_0x43728b,function(_0x51ac71){if(_0x51ac71[_0x172b('0x2f')]!==_0x172b('0x3f')){var _0x2beb2a={};_0x2beb2a[_0x51ac71[_0x172b('0x28')]]={'$like':'%'+_0x4bea8e['query']['filter']+'%'};return _0x2beb2a;}})});}_0x37acc5=_[_0x172b('0x3e')]({},_0x37acc5,_0x4bea8e['options']);var _0x5e8ff6={'where':_0x37acc5['where']};return db[_0x172b('0x2c')][_0x172b('0x20')](_0x5e8ff6)[_0x172b('0x25')](function(_0x54e62d){_0x5db251[_0x172b('0x20')]=_0x54e62d;if(_0x4bea8e[_0x172b('0x32')][_0x172b('0x40')]){_0x37acc5['include']=[{'all':!![]}];}return db[_0x172b('0x2c')]['findAll'](_0x37acc5);})[_0x172b('0x25')](function(_0x4a05da){_0x5db251[_0x172b('0x41')]=_0x4a05da;return _0x5db251;})[_0x172b('0x25')](respondWithFilteredResult(_0x9624f5,_0x37acc5))[_0x172b('0x42')](handleError(_0x9624f5,null));};exports[_0x172b('0x43')]=function(_0x24fba9,_0x5c973c){var _0x177250={'raw':!![],'where':{'id':_0x24fba9[_0x172b('0x44')]['id']}},_0x5e036e={};_0x5e036e[_0x172b('0x31')]=_[_0x172b('0x33')](db[_0x172b('0x2c')]['rawAttributes']);_0x5e036e['query']=_[_0x172b('0x33')](_0x24fba9['query']);_0x5e036e['filters']=_['intersection'](_0x5e036e[_0x172b('0x31')],_0x5e036e[_0x172b('0x32')]);_0x177250[_0x172b('0x36')]=_[_0x172b('0x35')](_0x5e036e['model'],qs[_0x172b('0x37')](_0x24fba9[_0x172b('0x32')][_0x172b('0x37')]));_0x177250[_0x172b('0x36')]=_0x177250[_0x172b('0x36')][_0x172b('0x38')]?_0x177250[_0x172b('0x36')]:_0x5e036e[_0x172b('0x31')];if(_0x24fba9[_0x172b('0x32')][_0x172b('0x40')]){_0x177250[_0x172b('0x45')]=[{'all':!![]}];}_0x177250=_[_0x172b('0x3e')]({},_0x177250,_0x24fba9['options']);return db[_0x172b('0x2c')][_0x172b('0x46')](_0x177250)['then'](handleEntityNotFound(_0x5c973c,null))['then'](respondWithResult(_0x5c973c,null))[_0x172b('0x42')](handleError(_0x5c973c,null));};exports[_0x172b('0x47')]=function(_0x1a14b2,_0x571504){return db[_0x172b('0x2c')]['create'](_0x1a14b2['body'],{})[_0x172b('0x25')](respondWithResult(_0x571504,0xc9))[_0x172b('0x42')](handleError(_0x571504,null));};exports[_0x172b('0x24')]=function(_0x3941d4,_0x24ab0c){if(_0x3941d4[_0x172b('0x48')]['id']){delete _0x3941d4[_0x172b('0x48')]['id'];}return db[_0x172b('0x2c')][_0x172b('0x46')]({'where':{'id':_0x3941d4[_0x172b('0x44')]['id']}})['then'](handleEntityNotFound(_0x24ab0c,null))['then'](saveUpdates(_0x3941d4[_0x172b('0x48')],null))[_0x172b('0x25')](respondWithResult(_0x24ab0c,null))['catch'](handleError(_0x24ab0c,null));};exports['destroy']=function(_0x3db238,_0x41ea2c){return db[_0x172b('0x2c')][_0x172b('0x46')]({'where':{'id':_0x3db238[_0x172b('0x44')]['id']}})[_0x172b('0x25')](handleEntityNotFound(_0x41ea2c,null))['then'](removeEntity(_0x41ea2c,null))[_0x172b('0x42')](handleError(_0x41ea2c,null));};exports['describe']=function(_0x5f22eb,_0x221cd7){return db[_0x172b('0x2c')][_0x172b('0x49')]()['then'](respondWithResult(_0x221cd7,null))[_0x172b('0x42')](handleError(_0x221cd7,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 8468e43..14cc431 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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x4dadeb,_0x4f99b9){var _0x39d793=function(_0x513e3e){while(--_0x513e3e){_0x4dadeb['push'](_0x4dadeb['shift']());}};_0x39d793(++_0x4f99b9);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x103b91,_0x25f9da){var _0x281218=function(_0x51f68a){while(--_0x51f68a){_0x103b91['push'](_0x103b91['shift']());}};_0x281218(++_0x25f9da);}(_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':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 38d0b25..8be9b7b 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 _0xe4c0=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20f33f,_0xc3d779){var _0x3c0f3a=function(_0x563ae2){while(--_0x563ae2){_0x20f33f['push'](_0x20f33f['shift']());}};_0x3c0f3a(++_0xc3d779);}(_0xe4c0,0x195));var _0x0e4c=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0xe4c0[_0x19ef2b];return _0x4df537;};'use strict';var _=require(_0x0e4c('0x0'));var util=require('util');var moment=require(_0x0e4c('0x1'));var BPromise=require(_0x0e4c('0x2'));var rs=require(_0x0e4c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e4c('0x4'))['db'];var utils=require(_0x0e4c('0x5'));var logger=require(_0x0e4c('0x6'))(_0x0e4c('0x7'));var config=require(_0x0e4c('0x8'));var jayson=require(_0x0e4c('0x9'));var client=jayson[_0x0e4c('0xa')][_0x0e4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e465d,_0x56983c,_0x3cb9f0){return new BPromise(function(_0x441ad8,_0x44d2f3){return client[_0x0e4c('0xc')](_0x5e465d,_0x3cb9f0)[_0x0e4c('0xd')](function(_0x197e40){logger[_0x0e4c('0xe')](_0x0e4c('0xf'),_0x56983c,_0x0e4c('0x10'));logger[_0x0e4c('0x11')](_0x0e4c('0x12'),_0x56983c,'request\x20sent',JSON[_0x0e4c('0x13')](_0x197e40));if(_0x197e40[_0x0e4c('0x14')]){if(_0x197e40[_0x0e4c('0x14')][_0x0e4c('0x15')]===0x1f4){logger['error'](_0x0e4c('0xf'),_0x56983c,_0x197e40[_0x0e4c('0x14')][_0x0e4c('0x16')]);return _0x44d2f3(_0x197e40[_0x0e4c('0x14')][_0x0e4c('0x16')]);}logger[_0x0e4c('0x14')](_0x0e4c('0xf'),_0x56983c,_0x197e40[_0x0e4c('0x14')][_0x0e4c('0x16')]);return _0x441ad8(_0x197e40['error'][_0x0e4c('0x16')]);}else{logger[_0x0e4c('0xe')](_0x0e4c('0xf'),_0x56983c,_0x0e4c('0x10'));_0x441ad8(_0x197e40[_0x0e4c('0x17')][_0x0e4c('0x16')]);}})[_0x0e4c('0x18')](function(_0x3a5251){logger[_0x0e4c('0x14')]('Cdr,\x20%s,\x20%s',_0x56983c,_0x3a5251);_0x44d2f3(_0x3a5251);});});} \ No newline at end of file +var _0xe0e2=['request','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x485eb2,_0x309eae){var _0x4ee062=function(_0xc9dfa7){while(--_0xc9dfa7){_0x485eb2['push'](_0x485eb2['shift']());}};_0x4ee062(++_0x309eae);}(_0xe0e2,0x155));var _0x2e0e=function(_0x5e265e,_0x58b246){_0x5e265e=_0x5e265e-0x0;var _0x55a032=_0xe0e2[_0x5e265e];return _0x55a032;};'use strict';var _=require(_0x2e0e('0x0'));var util=require(_0x2e0e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e0e('0x2'));var db=require(_0x2e0e('0x3'))['db'];var utils=require(_0x2e0e('0x4'));var logger=require(_0x2e0e('0x5'))(_0x2e0e('0x6'));var config=require(_0x2e0e('0x7'));var jayson=require(_0x2e0e('0x8'));var client=jayson[_0x2e0e('0x9')][_0x2e0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x70a482,_0x26748f,_0x2e7668){return new BPromise(function(_0x5523d3,_0x23f25e){return client[_0x2e0e('0xb')](_0x70a482,_0x2e7668)['then'](function(_0x13ca24){logger[_0x2e0e('0xc')]('Cdr,\x20%s,\x20%s',_0x26748f,_0x2e0e('0xd'));logger[_0x2e0e('0xe')](_0x2e0e('0xf'),_0x26748f,_0x2e0e('0xd'),JSON[_0x2e0e('0x10')](_0x13ca24));if(_0x13ca24['error']){if(_0x13ca24[_0x2e0e('0x11')][_0x2e0e('0x12')]===0x1f4){logger[_0x2e0e('0x11')](_0x2e0e('0x13'),_0x26748f,_0x13ca24[_0x2e0e('0x11')][_0x2e0e('0x14')]);return _0x23f25e(_0x13ca24[_0x2e0e('0x11')][_0x2e0e('0x14')]);}logger[_0x2e0e('0x11')](_0x2e0e('0x13'),_0x26748f,_0x13ca24[_0x2e0e('0x11')][_0x2e0e('0x14')]);return _0x5523d3(_0x13ca24[_0x2e0e('0x11')][_0x2e0e('0x14')]);}else{logger[_0x2e0e('0xc')]('Cdr,\x20%s,\x20%s',_0x26748f,_0x2e0e('0xd'));_0x5523d3(_0x13ca24[_0x2e0e('0x15')]['message']);}})['catch'](function(_0x164fad){logger[_0x2e0e('0x11')](_0x2e0e('0x13'),_0x26748f,_0x164fad);_0x23f25e(_0x164fad);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d4973fe..ba3a9bc 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(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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(_0x687549,_0x2a09eb){var _0x44e4a0=function(_0xef9ff1){while(--_0xef9ff1){_0x687549['push'](_0x687549['shift']());}};_0x44e4a0(++_0x2a09eb);}(_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 1e9ea1f..a8b8abb 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 _0x758a=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x51c52b,_0x147712){var _0x581ce3=function(_0x2e61a0){while(--_0x2e61a0){_0x51c52b['push'](_0x51c52b['shift']());}};_0x581ce3(++_0x147712);}(_0x758a,0x1d1));var _0xa758=function(_0x4d955c,_0x2e8a78){_0x4d955c=_0x4d955c-0x0;var _0x46e26d=_0x758a[_0x4d955c];return _0x46e26d;};'use strict';var Sequelize=require(_0xa758('0x0'));module[_0xa758('0x1')]={'priority':{'type':Sequelize[_0xa758('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa758('0x3')],'allowNull':![],'defaultValue':_0xa758('0x4')},'appdata':{'type':Sequelize[_0xa758('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x34bc=['*,*,*,*','exports','INTEGER','STRING','noop','TEXT'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x34bc,0x16f));var _0xc34b=function(_0x1dd8ec,_0x4fa79b){_0x1dd8ec=_0x1dd8ec-0x0;var _0x5973a3=_0x34bc[_0x1dd8ec];return _0x5973a3;};'use strict';var Sequelize=require('sequelize');module[_0xc34b('0x0')]={'priority':{'type':Sequelize[_0xc34b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc34b('0x2')],'allowNull':![],'defaultValue':_0xc34b('0x3')},'appdata':{'type':Sequelize[_0xc34b('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc34b('0x2')],'defaultValue':_0xc34b('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 97e3eac..f4063b0 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 _0x9173=['ChatApplication','find','then','update','body','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','error','stack','send','show','params','model','keys','rawAttributes','filters','intersection','query','attributes','fields','length','include','merge','options'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0x9173,0xb4));var _0x3917=function(_0x1af7fd,_0x53876f){_0x1af7fd=_0x1af7fd-0x0;var _0x187916=_0x9173[_0x1af7fd];return _0x187916;};'use strict';var emlformat=require(_0x3917('0x0'));var rimraf=require(_0x3917('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3917('0x2'));var rp=require(_0x3917('0x3'));var moment=require(_0x3917('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3917('0x5'));var util=require('util');var path=require(_0x3917('0x6'));var sox=require(_0x3917('0x7'));var csv=require(_0x3917('0x8'));var ejs=require(_0x3917('0x9'));var fs=require('fs');var fs_extra=require(_0x3917('0xa'));var _=require('lodash');var squel=require(_0x3917('0xb'));var crypto=require(_0x3917('0xc'));var jsforce=require(_0x3917('0xd'));var deskjs=require(_0x3917('0xe'));var toCsv=require(_0x3917('0x8'));var querystring=require(_0x3917('0xf'));var Papa=require('papaparse');var Redis=require(_0x3917('0x10'));var authService=require(_0x3917('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3917('0x12'));var hardwareService=require(_0x3917('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3917('0x14'));var licenseUtil=require(_0x3917('0x15'));var db=require(_0x3917('0x16'))['db'];function respondWithStatusCode(_0x351db3,_0x3b3b40){_0x3b3b40=_0x3b3b40||0xcc;return function(_0xc0902d){if(_0xc0902d){return _0x351db3['sendStatus'](_0x3b3b40);}return _0x351db3[_0x3917('0x17')](_0x3b3b40)[_0x3917('0x18')]();};}function respondWithResult(_0x3268eb,_0x1d19bc){_0x1d19bc=_0x1d19bc||0xc8;return function(_0x4d7f6c){if(_0x4d7f6c){return _0x3268eb[_0x3917('0x17')](_0x1d19bc)[_0x3917('0x19')](_0x4d7f6c);}};}function respondWithFilteredResult(_0x36b162,_0x291147){return function(_0x23821c){if(_0x23821c){var _0x483e45=typeof _0x291147[_0x3917('0x1a')]==='undefined'&&typeof _0x291147['limit']===_0x3917('0x1b');var _0x42b9d4=_0x23821c[_0x3917('0x1c')];var _0x509b2b=_0x483e45?0x0:_0x291147[_0x3917('0x1a')];var _0x504934=_0x483e45?_0x23821c['count']:_0x291147[_0x3917('0x1a')]+_0x291147['limit'];var _0x1f91a5;if(_0x504934>=_0x42b9d4){_0x504934=_0x42b9d4;_0x1f91a5=0xc8;}else{_0x1f91a5=0xce;}_0x36b162[_0x3917('0x17')](_0x1f91a5);return _0x36b162[_0x3917('0x1d')](_0x3917('0x1e'),_0x509b2b+'-'+_0x504934+'/'+_0x42b9d4)[_0x3917('0x19')](_0x23821c);}return null;};}function patchUpdates(_0x2f9f7d){return function(_0x1d4e33){try{jsonpatch[_0x3917('0x1f')](_0x1d4e33,_0x2f9f7d,!![]);}catch(_0x15e00f){return BPromise[_0x3917('0x20')](_0x15e00f);}return _0x1d4e33[_0x3917('0x21')]();};}function saveUpdates(_0x4cc295,_0x1e3d24){return function(_0x1adbe4){if(_0x1adbe4){return _0x1adbe4['update'](_0x4cc295)['then'](function(_0xc3397){return _0xc3397;});}return null;};}function removeEntity(_0x52f027,_0x127ab5){return function(_0x337aba){if(_0x337aba){return _0x337aba[_0x3917('0x22')]()['then'](function(){_0x52f027[_0x3917('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454b17,_0x1bc725){return function(_0x22f3e7){if(!_0x22f3e7){_0x454b17['sendStatus'](0x194);}return _0x22f3e7;};}function handleError(_0x1a79c2,_0x36892d){_0x36892d=_0x36892d||0x1f4;return function(_0x103729){logger[_0x3917('0x23')](_0x103729[_0x3917('0x24')]);if(_0x103729['name']){delete _0x103729['name'];}_0x1a79c2[_0x3917('0x17')](_0x36892d)[_0x3917('0x25')](_0x103729);};}exports[_0x3917('0x26')]=function(_0x29eb9b,_0x12302d){var _0x4060a8={'raw':!![],'where':{'id':_0x29eb9b[_0x3917('0x27')]['id']}},_0x2e80ca={};_0x2e80ca[_0x3917('0x28')]=_[_0x3917('0x29')](db['ChatApplication'][_0x3917('0x2a')]);_0x2e80ca['query']=_[_0x3917('0x29')](_0x29eb9b['query']);_0x2e80ca[_0x3917('0x2b')]=_[_0x3917('0x2c')](_0x2e80ca['model'],_0x2e80ca[_0x3917('0x2d')]);_0x4060a8[_0x3917('0x2e')]=_[_0x3917('0x2c')](_0x2e80ca[_0x3917('0x28')],qs['fields'](_0x29eb9b[_0x3917('0x2d')][_0x3917('0x2f')]));_0x4060a8[_0x3917('0x2e')]=_0x4060a8[_0x3917('0x2e')][_0x3917('0x30')]?_0x4060a8[_0x3917('0x2e')]:_0x2e80ca[_0x3917('0x28')];if(_0x29eb9b[_0x3917('0x2d')]['includeAll']){_0x4060a8[_0x3917('0x31')]=[{'all':!![]}];}_0x4060a8=_[_0x3917('0x32')]({},_0x4060a8,_0x29eb9b[_0x3917('0x33')]);return db[_0x3917('0x34')][_0x3917('0x35')](_0x4060a8)['then'](handleEntityNotFound(_0x12302d,null))[_0x3917('0x36')](respondWithResult(_0x12302d,null))['catch'](handleError(_0x12302d,null));};exports[_0x3917('0x37')]=function(_0x476630,_0x5c96f3){if(_0x476630[_0x3917('0x38')]['id']){delete _0x476630[_0x3917('0x38')]['id'];}return db[_0x3917('0x34')][_0x3917('0x35')]({'where':{'id':_0x476630[_0x3917('0x27')]['id']}})[_0x3917('0x36')](handleEntityNotFound(_0x5c96f3,null))[_0x3917('0x36')](saveUpdates(_0x476630[_0x3917('0x38')],null))[_0x3917('0x36')](respondWithResult(_0x5c96f3,null))[_0x3917('0x39')](handleError(_0x5c96f3,null));};exports[_0x3917('0x22')]=function(_0x404325,_0x48c22f){return db[_0x3917('0x34')][_0x3917('0x35')]({'where':{'id':_0x404325[_0x3917('0x27')]['id']}})[_0x3917('0x36')](handleEntityNotFound(_0x48c22f,null))[_0x3917('0x36')](removeEntity(_0x48c22f,null))['catch'](handleError(_0x48c22f,null));}; \ No newline at end of file +var _0xd66c=['error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','limit','count','status','set','Content-Range','reject','save','update','then','destroy','sendStatus'];(function(_0x545a49,_0xaa20d3){var _0x269f4e=function(_0x4c24ce){while(--_0x4c24ce){_0x545a49['push'](_0x545a49['shift']());}};_0x269f4e(++_0xaa20d3);}(_0xd66c,0x106));var _0xcd66=function(_0x275873,_0x680c17){_0x275873=_0x275873-0x0;var _0x14e0c4=_0xd66c[_0x275873];return _0x14e0c4;};'use strict';var emlformat=require(_0xcd66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd66('0x1'));var jsonpatch=require(_0xcd66('0x2'));var rp=require(_0xcd66('0x3'));var moment=require(_0xcd66('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd66('0x5'));var util=require(_0xcd66('0x6'));var path=require(_0xcd66('0x7'));var sox=require(_0xcd66('0x8'));var csv=require(_0xcd66('0x9'));var ejs=require(_0xcd66('0xa'));var fs=require('fs');var fs_extra=require(_0xcd66('0xb'));var _=require(_0xcd66('0xc'));var squel=require('squel');var crypto=require(_0xcd66('0xd'));var jsforce=require(_0xcd66('0xe'));var deskjs=require(_0xcd66('0xf'));var toCsv=require(_0xcd66('0x9'));var querystring=require(_0xcd66('0x10'));var Papa=require(_0xcd66('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd66('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd66('0x13'));var logger=require(_0xcd66('0x14'))('api');var utils=require(_0xcd66('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcd66('0x16'));var db=require(_0xcd66('0x17'))['db'];function respondWithStatusCode(_0x1cb4a9,_0x3e4e92){_0x3e4e92=_0x3e4e92||0xcc;return function(_0x35479d){if(_0x35479d){return _0x1cb4a9['sendStatus'](_0x3e4e92);}return _0x1cb4a9['status'](_0x3e4e92)[_0xcd66('0x18')]();};}function respondWithResult(_0x5d9bb4,_0x28ae0c){_0x28ae0c=_0x28ae0c||0xc8;return function(_0x588b46){if(_0x588b46){return _0x5d9bb4['status'](_0x28ae0c)[_0xcd66('0x19')](_0x588b46);}};}function respondWithFilteredResult(_0x1fafad,_0x4df4df){return function(_0x3178a7){if(_0x3178a7){var _0x3ed659=typeof _0x4df4df[_0xcd66('0x1a')]==='undefined'&&typeof _0x4df4df[_0xcd66('0x1b')]==='undefined';var _0x1268db=_0x3178a7[_0xcd66('0x1c')];var _0x191f8e=_0x3ed659?0x0:_0x4df4df[_0xcd66('0x1a')];var _0x35d431=_0x3ed659?_0x3178a7[_0xcd66('0x1c')]:_0x4df4df[_0xcd66('0x1a')]+_0x4df4df[_0xcd66('0x1b')];var _0x417907;if(_0x35d431>=_0x1268db){_0x35d431=_0x1268db;_0x417907=0xc8;}else{_0x417907=0xce;}_0x1fafad[_0xcd66('0x1d')](_0x417907);return _0x1fafad[_0xcd66('0x1e')](_0xcd66('0x1f'),_0x191f8e+'-'+_0x35d431+'/'+_0x1268db)[_0xcd66('0x19')](_0x3178a7);}return null;};}function patchUpdates(_0x2d3819){return function(_0x842033){try{jsonpatch['apply'](_0x842033,_0x2d3819,!![]);}catch(_0x3e3bea){return BPromise[_0xcd66('0x20')](_0x3e3bea);}return _0x842033[_0xcd66('0x21')]();};}function saveUpdates(_0x11c75c,_0x1cc184){return function(_0x1f8a04){if(_0x1f8a04){return _0x1f8a04[_0xcd66('0x22')](_0x11c75c)[_0xcd66('0x23')](function(_0x64424a){return _0x64424a;});}return null;};}function removeEntity(_0x35e19e,_0x5ec2d5){return function(_0x2ab69e){if(_0x2ab69e){return _0x2ab69e[_0xcd66('0x24')]()['then'](function(){_0x35e19e[_0xcd66('0x1d')](0xcc)[_0xcd66('0x18')]();});}};}function handleEntityNotFound(_0xb37e77,_0x526e13){return function(_0x141a64){if(!_0x141a64){_0xb37e77[_0xcd66('0x25')](0x194);}return _0x141a64;};}function handleError(_0x3de898,_0x54ac81){_0x54ac81=_0x54ac81||0x1f4;return function(_0x12891d){logger[_0xcd66('0x26')](_0x12891d[_0xcd66('0x27')]);if(_0x12891d[_0xcd66('0x28')]){delete _0x12891d[_0xcd66('0x28')];}_0x3de898[_0xcd66('0x1d')](_0x54ac81)[_0xcd66('0x29')](_0x12891d);};}exports[_0xcd66('0x2a')]=function(_0x51201f,_0xb6d828){var _0x51a7f6={'raw':!![],'where':{'id':_0x51201f[_0xcd66('0x2b')]['id']}},_0x2506d3={};_0x2506d3[_0xcd66('0x2c')]=_[_0xcd66('0x2d')](db[_0xcd66('0x2e')][_0xcd66('0x2f')]);_0x2506d3['query']=_[_0xcd66('0x2d')](_0x51201f[_0xcd66('0x30')]);_0x2506d3[_0xcd66('0x31')]=_[_0xcd66('0x32')](_0x2506d3['model'],_0x2506d3[_0xcd66('0x30')]);_0x51a7f6[_0xcd66('0x33')]=_[_0xcd66('0x32')](_0x2506d3[_0xcd66('0x2c')],qs[_0xcd66('0x34')](_0x51201f['query'][_0xcd66('0x34')]));_0x51a7f6[_0xcd66('0x33')]=_0x51a7f6[_0xcd66('0x33')][_0xcd66('0x35')]?_0x51a7f6['attributes']:_0x2506d3['model'];if(_0x51201f[_0xcd66('0x30')]['includeAll']){_0x51a7f6[_0xcd66('0x36')]=[{'all':!![]}];}_0x51a7f6=_[_0xcd66('0x37')]({},_0x51a7f6,_0x51201f[_0xcd66('0x38')]);return db[_0xcd66('0x2e')][_0xcd66('0x39')](_0x51a7f6)[_0xcd66('0x23')](handleEntityNotFound(_0xb6d828,null))[_0xcd66('0x23')](respondWithResult(_0xb6d828,null))['catch'](handleError(_0xb6d828,null));};exports[_0xcd66('0x22')]=function(_0x366fb2,_0x37f17a){if(_0x366fb2[_0xcd66('0x3a')]['id']){delete _0x366fb2['body']['id'];}return db[_0xcd66('0x2e')][_0xcd66('0x39')]({'where':{'id':_0x366fb2[_0xcd66('0x2b')]['id']}})[_0xcd66('0x23')](handleEntityNotFound(_0x37f17a,null))[_0xcd66('0x23')](saveUpdates(_0x366fb2[_0xcd66('0x3a')],null))[_0xcd66('0x23')](respondWithResult(_0x37f17a,null))[_0xcd66('0x3b')](handleError(_0x37f17a,null));};exports[_0xcd66('0x24')]=function(_0x1f3821,_0x218b7d){return db[_0xcd66('0x2e')][_0xcd66('0x39')]({'where':{'id':_0x1f3821[_0xcd66('0x2b')]['id']}})[_0xcd66('0x23')](handleEntityNotFound(_0x218b7d,null))[_0xcd66('0x23')](removeEntity(_0x218b7d,null))[_0xcd66('0x3b')](handleError(_0x218b7d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 437b7c2..8a7a9b0 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 _0xc7ad=['./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path','../../config/environment'];(function(_0x5124cf,_0x455717){var _0x41c979=function(_0x2d4efc){while(--_0x2d4efc){_0x5124cf['push'](_0x5124cf['shift']());}};_0x41c979(++_0x455717);}(_0xc7ad,0xca));var _0xdc7a=function(_0x162291,_0x92062b){_0x162291=_0x162291-0x0;var _0x3fc840=_0xc7ad[_0x162291];return _0x3fc840;};'use strict';var _=require(_0xdc7a('0x0'));var util=require(_0xdc7a('0x1'));var logger=require(_0xdc7a('0x2'))('api');var moment=require(_0xdc7a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc7a('0x4'));var rimraf=require('rimraf');var config=require(_0xdc7a('0x5'));var attributes=require(_0xdc7a('0x6'));module[_0xdc7a('0x7')]=function(_0x1eb79d,_0x45161c){return _0x1eb79d[_0xdc7a('0x8')](_0xdc7a('0x9'),attributes,{'tableName':_0xdc7a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdc7a('0xb'),'collate':_0xdc7a('0xc')});}; \ No newline at end of file +var _0x6113=['path','rimraf','../../config/environment','./chatApplication.attributes','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x6113,0x1c8));var _0x3611=function(_0x43b290,_0x2aa146){_0x43b290=_0x43b290-0x0;var _0x2f611e=_0x6113[_0x43b290];return _0x2f611e;};'use strict';var _=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var logger=require(_0x3611('0x2'))('api');var moment=require(_0x3611('0x3'));var BPromise=require(_0x3611('0x4'));var rp=require(_0x3611('0x5'));var fs=require('fs');var path=require(_0x3611('0x6'));var rimraf=require(_0x3611('0x7'));var config=require(_0x3611('0x8'));var attributes=require(_0x3611('0x9'));module['exports']=function(_0x377654,_0x18306f){return _0x377654[_0x3611('0xa')]('ChatApplication',attributes,{'tableName':_0x3611('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3611('0xc'),'collate':_0x3611('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 84c0953..3899948 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 _0x4596=['rpc','../../config/environment','jayson/promise','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2a9c81,_0x434c00){var _0xf92bb3=function(_0xe0560a){while(--_0xe0560a){_0x2a9c81['push'](_0x2a9c81['shift']());}};_0xf92bb3(++_0x434c00);}(_0x4596,0xf5));var _0x6459=function(_0x2f2b47,_0x27fd21){_0x2f2b47=_0x2f2b47-0x0;var _0x279bf8=_0x4596[_0x2f2b47];return _0x279bf8;};'use strict';var _=require(_0x6459('0x0'));var util=require(_0x6459('0x1'));var moment=require(_0x6459('0x2'));var BPromise=require(_0x6459('0x3'));var rs=require(_0x6459('0x4'));var fs=require('fs');var Redis=require(_0x6459('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6459('0x6'));var logger=require(_0x6459('0x7'))(_0x6459('0x8'));var config=require(_0x6459('0x9'));var jayson=require(_0x6459('0xa'));var client=jayson['client'][_0x6459('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5173e7,_0x6b7e66,_0x110b5e){return new BPromise(function(_0x4a7404,_0x26bc6a){return client[_0x6459('0xc')](_0x5173e7,_0x110b5e)[_0x6459('0xd')](function(_0x170b96){logger[_0x6459('0xe')](_0x6459('0xf'),_0x6b7e66,_0x6459('0x10'));logger[_0x6459('0x11')](_0x6459('0x12'),_0x6b7e66,_0x6459('0x10'),JSON['stringify'](_0x170b96));if(_0x170b96[_0x6459('0x13')]){if(_0x170b96[_0x6459('0x13')][_0x6459('0x14')]===0x1f4){logger[_0x6459('0x13')](_0x6459('0xf'),_0x6b7e66,_0x170b96[_0x6459('0x13')][_0x6459('0x15')]);return _0x26bc6a(_0x170b96[_0x6459('0x13')][_0x6459('0x15')]);}logger[_0x6459('0x13')](_0x6459('0xf'),_0x6b7e66,_0x170b96[_0x6459('0x13')][_0x6459('0x15')]);return _0x4a7404(_0x170b96['error'][_0x6459('0x15')]);}else{logger[_0x6459('0xe')](_0x6459('0xf'),_0x6b7e66,_0x6459('0x10'));_0x4a7404(_0x170b96['result']['message']);}})[_0x6459('0x16')](function(_0x496d11){logger['error'](_0x6459('0xf'),_0x6b7e66,_0x496d11);_0x26bc6a(_0x496d11);});});} \ No newline at end of file +var _0x790d=['ChatApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x11cb2b,_0x36ff63){var _0x1bc84b=function(_0x575632){while(--_0x575632){_0x11cb2b['push'](_0x11cb2b['shift']());}};_0x1bc84b(++_0x36ff63);}(_0x790d,0x1e4));var _0xd790=function(_0x4f34d8,_0x40f022){_0x4f34d8=_0x4f34d8-0x0;var _0xc97536=_0x790d[_0x4f34d8];return _0xc97536;};'use strict';var _=require(_0xd790('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd790('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd790('0x2'));var logger=require(_0xd790('0x3'))(_0xd790('0x4'));var config=require('../../config/environment');var jayson=require(_0xd790('0x5'));var client=jayson[_0xd790('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19bcd6,_0x4c7971,_0x19a884){return new BPromise(function(_0x379712,_0x1ff052){return client[_0xd790('0x7')](_0x19bcd6,_0x19a884)[_0xd790('0x8')](function(_0x4ab167){logger[_0xd790('0x9')](_0xd790('0xa'),_0x4c7971,'request\x20sent');logger[_0xd790('0xb')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4c7971,_0xd790('0xc'),JSON[_0xd790('0xd')](_0x4ab167));if(_0x4ab167[_0xd790('0xe')]){if(_0x4ab167[_0xd790('0xe')][_0xd790('0xf')]===0x1f4){logger[_0xd790('0xe')](_0xd790('0xa'),_0x4c7971,_0x4ab167['error'][_0xd790('0x10')]);return _0x1ff052(_0x4ab167[_0xd790('0xe')][_0xd790('0x10')]);}logger[_0xd790('0xe')](_0xd790('0xa'),_0x4c7971,_0x4ab167[_0xd790('0xe')][_0xd790('0x10')]);return _0x379712(_0x4ab167[_0xd790('0xe')]['message']);}else{logger[_0xd790('0x9')]('ChatApplication,\x20%s,\x20%s',_0x4c7971,_0xd790('0xc'));_0x379712(_0x4ab167[_0xd790('0x11')]['message']);}})[_0xd790('0x12')](function(_0x257cd9){logger[_0xd790('0xe')]('ChatApplication,\x20%s,\x20%s',_0x4c7971,_0x257cd9);_0x1ff052(_0x257cd9);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 2380a7f..00e7cd8 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 _0x9537=['update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x9537,0x1ce));var _0x7953=function(_0x23525c,_0x17b6ee){_0x23525c=_0x23525c-0x0;var _0x3eaeb9=_0x9537[_0x23525c];return _0x3eaeb9;};'use strict';var multer=require('multer');var util=require(_0x7953('0x0'));var path=require('path');var timeout=require(_0x7953('0x1'));var express=require(_0x7953('0x2'));var router=express[_0x7953('0x3')]();var fs_extra=require(_0x7953('0x4'));var auth=require(_0x7953('0x5'));var interaction=require(_0x7953('0x6'));var config=require(_0x7953('0x7'));var controller=require(_0x7953('0x8'));router[_0x7953('0x9')](_0x7953('0xa'),auth[_0x7953('0xb')](),controller[_0x7953('0xc')]);router[_0x7953('0xd')](_0x7953('0xa'),auth[_0x7953('0xb')](),controller[_0x7953('0xe')]);router['delete'](_0x7953('0xa'),auth[_0x7953('0xb')](),controller[_0x7953('0xf')]);module[_0x7953('0x10')]=router; \ No newline at end of file +var _0x1eff=['get','show','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x1eff,0x177));var _0xf1ef=function(_0x322258,_0xff2234){_0x322258=_0x322258-0x0;var _0x29ef7a=_0x1eff[_0x322258];return _0x29ef7a;};'use strict';var multer=require(_0xf1ef('0x0'));var util=require(_0xf1ef('0x1'));var path=require(_0xf1ef('0x2'));var timeout=require('connect-timeout');var express=require(_0xf1ef('0x3'));var router=express[_0xf1ef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf1ef('0x5'));var interaction=require(_0xf1ef('0x6'));var config=require(_0xf1ef('0x7'));var controller=require(_0xf1ef('0x8'));router[_0xf1ef('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf1ef('0xa')]);router['put'](_0xf1ef('0xb'),auth[_0xf1ef('0xc')](),controller['update']);router[_0xf1ef('0xd')]('/:id',auth[_0xf1ef('0xc')](),controller[_0xf1ef('0xe')]);module[_0xf1ef('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 542dfa0..aecf88c 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 _0xbf25=['BOOLEAN','sequelize','exports','STRING'];(function(_0x230f58,_0x1f8377){var _0x3fdd2c=function(_0x4fb155){while(--_0x4fb155){_0x230f58['push'](_0x230f58['shift']());}};_0x3fdd2c(++_0x1f8377);}(_0xbf25,0x12d));var _0x5bf2=function(_0x10fb80,_0x5936f2){_0x10fb80=_0x10fb80-0x0;var _0x2dc53b=_0xbf25[_0x10fb80];return _0x2dc53b;};'use strict';var Sequelize=require(_0x5bf2('0x0'));module[_0x5bf2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5bf2('0x2')]},'write':{'type':Sequelize[_0x5bf2('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0958=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x0958,0x7c));var _0x8095=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0958[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x8095('0x0'));module[_0x8095('0x1')]={'name':{'type':Sequelize[_0x8095('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x8095('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 9f10206..f162676 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 _0x5b6c=['length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','create','body','update','params','describe','getUnread','toInteger','addMembers','omit','ids','getMembers','findOne','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','$gte','format','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','query','filters','intersection','fields','attributes'];(function(_0x2e9e80,_0x34cf78){var _0x13ccc4=function(_0x3222a5){while(--_0x3222a5){_0x2e9e80['push'](_0x2e9e80['shift']());}};_0x13ccc4(++_0x34cf78);}(_0x5b6c,0x1a6));var _0xc5b6=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x5b6c[_0x344a3f];return _0x264712;};'use strict';var emlformat=require(_0xc5b6('0x0'));var rimraf=require(_0xc5b6('0x1'));var zipdir=require(_0xc5b6('0x2'));var jsonpatch=require(_0xc5b6('0x3'));var rp=require('request-promise');var moment=require(_0xc5b6('0x4'));var BPromise=require(_0xc5b6('0x5'));var Mustache=require(_0xc5b6('0x6'));var util=require(_0xc5b6('0x7'));var path=require(_0xc5b6('0x8'));var sox=require(_0xc5b6('0x9'));var csv=require(_0xc5b6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc5b6('0xb'));var _=require('lodash');var squel=require(_0xc5b6('0xc'));var crypto=require(_0xc5b6('0xd'));var jsforce=require(_0xc5b6('0xe'));var deskjs=require(_0xc5b6('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc5b6('0x10'));var Redis=require(_0xc5b6('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc5b6('0x12'));var hardwareService=require(_0xc5b6('0x13'));var logger=require(_0xc5b6('0x14'))(_0xc5b6('0x15'));var utils=require(_0xc5b6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc5b6('0x17'));var db=require('../../mysqldb')['db'];config[_0xc5b6('0x18')]=_['defaults'](config[_0xc5b6('0x18')],{'host':_0xc5b6('0x19'),'port':0x18eb});var socket=require(_0xc5b6('0x1a'))(new Redis(config[_0xc5b6('0x18')]));require('./chatGroup.socket')[_0xc5b6('0x1b')](socket);function respondWithStatusCode(_0x5c1164,_0x26b013){_0x26b013=_0x26b013||0xcc;return function(_0x42b2ef){if(_0x42b2ef){return _0x5c1164['sendStatus'](_0x26b013);}return _0x5c1164[_0xc5b6('0x1c')](_0x26b013)[_0xc5b6('0x1d')]();};}function respondWithResult(_0xe70f97,_0x4b8066){_0x4b8066=_0x4b8066||0xc8;return function(_0x5793d1){if(_0x5793d1){return _0xe70f97[_0xc5b6('0x1c')](_0x4b8066)['json'](_0x5793d1);}};}function respondWithFilteredResult(_0x3058fe,_0x4382e2){return function(_0x536f25){if(_0x536f25){var _0x116474=typeof _0x4382e2[_0xc5b6('0x1e')]===_0xc5b6('0x1f')&&typeof _0x4382e2[_0xc5b6('0x20')]==='undefined';var _0x45e86a=_0x536f25[_0xc5b6('0x21')];var _0x3a1e8b=_0x116474?0x0:_0x4382e2[_0xc5b6('0x1e')];var _0x5db647=_0x116474?_0x536f25[_0xc5b6('0x21')]:_0x4382e2['offset']+_0x4382e2['limit'];var _0x58445f;if(_0x5db647>=_0x45e86a){_0x5db647=_0x45e86a;_0x58445f=0xc8;}else{_0x58445f=0xce;}_0x3058fe['status'](_0x58445f);return _0x3058fe[_0xc5b6('0x22')](_0xc5b6('0x23'),_0x3a1e8b+'-'+_0x5db647+'/'+_0x45e86a)[_0xc5b6('0x24')](_0x536f25);}return null;};}function patchUpdates(_0x32f178){return function(_0x1fae0f){try{jsonpatch[_0xc5b6('0x25')](_0x1fae0f,_0x32f178,!![]);}catch(_0x181fd3){return BPromise[_0xc5b6('0x26')](_0x181fd3);}return _0x1fae0f[_0xc5b6('0x27')]();};}function saveUpdates(_0xfa2254,_0x567064){return function(_0x2194ef){if(_0x2194ef){return _0x2194ef['update'](_0xfa2254)[_0xc5b6('0x28')](function(_0x11a823){return _0x11a823;});}return null;};}function removeEntity(_0x377a92,_0x4bc731){return function(_0x3f4f0f){if(_0x3f4f0f){return _0x3f4f0f[_0xc5b6('0x29')]()['then'](function(){_0x377a92['status'](0xcc)[_0xc5b6('0x1d')]();});}};}function handleEntityNotFound(_0x503fc1,_0x3ec673){return function(_0x2ad1a7){if(!_0x2ad1a7){_0x503fc1[_0xc5b6('0x2a')](0x194);}return _0x2ad1a7;};}function handleError(_0x5cc3ce,_0x5edb79){_0x5edb79=_0x5edb79||0x1f4;return function(_0x3385b1){logger['error'](_0x3385b1[_0xc5b6('0x2b')]);if(_0x3385b1[_0xc5b6('0x2c')]){delete _0x3385b1['name'];}_0x5cc3ce[_0xc5b6('0x1c')](_0x5edb79)[_0xc5b6('0x2d')](_0x3385b1);};}exports[_0xc5b6('0x2e')]=function(_0x44f038,_0x5a0679){var _0x129721={},_0x20ebe5={},_0x21d1c7={'count':0x0,'rows':[]};var _0x177508=_[_0xc5b6('0x2f')](db[_0xc5b6('0x30')]['rawAttributes'],function(_0x31ec03){return{'name':_0x31ec03[_0xc5b6('0x31')],'type':_0x31ec03[_0xc5b6('0x32')][_0xc5b6('0x33')]};});_0x20ebe5[_0xc5b6('0x34')]=_[_0xc5b6('0x2f')](_0x177508,_0xc5b6('0x2c'));_0x20ebe5[_0xc5b6('0x35')]=_['keys'](_0x44f038[_0xc5b6('0x35')]);_0x20ebe5[_0xc5b6('0x36')]=_[_0xc5b6('0x37')](_0x20ebe5[_0xc5b6('0x34')],_0x20ebe5[_0xc5b6('0x35')]);_0x129721['attributes']=_['intersection'](_0x20ebe5[_0xc5b6('0x34')],qs['fields'](_0x44f038[_0xc5b6('0x35')][_0xc5b6('0x38')]));_0x129721[_0xc5b6('0x39')]=_0x129721[_0xc5b6('0x39')][_0xc5b6('0x3a')]?_0x129721[_0xc5b6('0x39')]:_0x20ebe5[_0xc5b6('0x34')];if(!_0x44f038[_0xc5b6('0x35')][_0xc5b6('0x3b')]('nolimit')){_0x129721[_0xc5b6('0x20')]=qs[_0xc5b6('0x20')](_0x44f038[_0xc5b6('0x35')][_0xc5b6('0x20')]);_0x129721[_0xc5b6('0x1e')]=qs[_0xc5b6('0x1e')](_0x44f038[_0xc5b6('0x35')]['offset']);}_0x129721[_0xc5b6('0x3c')]=qs[_0xc5b6('0x3d')](_0x44f038[_0xc5b6('0x35')]['sort']);_0x129721[_0xc5b6('0x3e')]=qs['filters'](_[_0xc5b6('0x3f')](_0x44f038[_0xc5b6('0x35')],_0x20ebe5[_0xc5b6('0x36')]),_0x177508);if(_0x44f038['query']['filter']){_0x129721[_0xc5b6('0x3e')]=_[_0xc5b6('0x40')](_0x129721[_0xc5b6('0x3e')],{'$or':_[_0xc5b6('0x2f')](_0x177508,function(_0x3e11fe){if(_0x3e11fe[_0xc5b6('0x32')]!==_0xc5b6('0x41')){var _0x1cafa4={};_0x1cafa4[_0x3e11fe[_0xc5b6('0x2c')]]={'$like':'%'+_0x44f038[_0xc5b6('0x35')][_0xc5b6('0x42')]+'%'};return _0x1cafa4;}})});}_0x129721=_[_0xc5b6('0x40')]({},_0x129721,_0x44f038[_0xc5b6('0x43')]);var _0x33f7f1={'where':_0x129721[_0xc5b6('0x3e')]};return db['ChatGroup'][_0xc5b6('0x21')](_0x33f7f1)[_0xc5b6('0x28')](function(_0x3a26cf){_0x21d1c7[_0xc5b6('0x21')]=_0x3a26cf;if(_0x44f038['query'][_0xc5b6('0x44')]){_0x129721[_0xc5b6('0x45')]=[{'all':!![]}];}return db['ChatGroup'][_0xc5b6('0x46')](_0x129721);})[_0xc5b6('0x28')](function(_0x1bd72f){_0x21d1c7[_0xc5b6('0x47')]=_0x1bd72f;return _0x21d1c7;})[_0xc5b6('0x28')](respondWithFilteredResult(_0x5a0679,_0x129721))[_0xc5b6('0x48')](handleError(_0x5a0679,null));};exports['show']=function(_0x3970ed,_0xfb4883){var _0x55e1ce={'raw':!![],'where':{'id':_0x3970ed['params']['id']}},_0x2c7381={};_0x2c7381[_0xc5b6('0x34')]=_[_0xc5b6('0x49')](db[_0xc5b6('0x30')][_0xc5b6('0x4a')]);_0x2c7381['query']=_[_0xc5b6('0x49')](_0x3970ed[_0xc5b6('0x35')]);_0x2c7381[_0xc5b6('0x36')]=_[_0xc5b6('0x37')](_0x2c7381[_0xc5b6('0x34')],_0x2c7381[_0xc5b6('0x35')]);_0x55e1ce[_0xc5b6('0x39')]=_[_0xc5b6('0x37')](_0x2c7381[_0xc5b6('0x34')],qs[_0xc5b6('0x38')](_0x3970ed[_0xc5b6('0x35')]['fields']));_0x55e1ce[_0xc5b6('0x39')]=_0x55e1ce[_0xc5b6('0x39')]['length']?_0x55e1ce[_0xc5b6('0x39')]:_0x2c7381[_0xc5b6('0x34')];if(_0x3970ed[_0xc5b6('0x35')]['includeAll']){_0x55e1ce[_0xc5b6('0x45')]=[{'all':!![]}];}_0x55e1ce=_[_0xc5b6('0x40')]({},_0x55e1ce,_0x3970ed[_0xc5b6('0x43')]);return db[_0xc5b6('0x30')][_0xc5b6('0x4b')](_0x55e1ce)[_0xc5b6('0x28')](handleEntityNotFound(_0xfb4883,null))[_0xc5b6('0x28')](respondWithResult(_0xfb4883,null))[_0xc5b6('0x48')](handleError(_0xfb4883,null));};exports['create']=function(_0x4e8714,_0x4b326f){return db['ChatGroup'][_0xc5b6('0x4c')](_0x4e8714[_0xc5b6('0x4d')],{})['then'](respondWithResult(_0x4b326f,0xc9))[_0xc5b6('0x48')](handleError(_0x4b326f,null));};exports[_0xc5b6('0x4e')]=function(_0x504487,_0x21e2a1){if(_0x504487['body']['id']){delete _0x504487[_0xc5b6('0x4d')]['id'];}return db[_0xc5b6('0x30')][_0xc5b6('0x4b')]({'where':{'id':_0x504487[_0xc5b6('0x4f')]['id']}})[_0xc5b6('0x28')](handleEntityNotFound(_0x21e2a1,null))[_0xc5b6('0x28')](saveUpdates(_0x504487[_0xc5b6('0x4d')],null))[_0xc5b6('0x28')](respondWithResult(_0x21e2a1,null))[_0xc5b6('0x48')](handleError(_0x21e2a1,null));};exports['destroy']=function(_0x64116f,_0x390267){return db['ChatGroup'][_0xc5b6('0x4b')]({'where':{'id':_0x64116f[_0xc5b6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x390267,null))[_0xc5b6('0x28')](removeEntity(_0x390267,null))[_0xc5b6('0x48')](handleError(_0x390267,null));};exports[_0xc5b6('0x50')]=function(_0x52e160,_0x326fab){return db[_0xc5b6('0x30')]['describe']()[_0xc5b6('0x28')](respondWithResult(_0x326fab,null))[_0xc5b6('0x48')](handleError(_0x326fab,null));};exports[_0xc5b6('0x51')]=function(_0x490730,_0xbcb902,_0x50f95b){return db['ChatInternalMessage'][_0xc5b6('0x21')]({'where':{'ChatGroupId':_0x490730[_0xc5b6('0x4f')]['id'],'ToId':_0x490730['user']['id'],'read':![]}})['then'](function(_0x13ac11){return{'id':_[_0xc5b6('0x52')](_0x490730[_0xc5b6('0x4f')]['id']),'count':_0x13ac11};})[_0xc5b6('0x28')](respondWithResult(_0xbcb902,null))[_0xc5b6('0x48')](handleError(_0xbcb902,null));};exports[_0xc5b6('0x53')]=function(_0x841779,_0x57260e,_0x436582){return db[_0xc5b6('0x30')][_0xc5b6('0x4b')]({'where':{'id':_0x841779[_0xc5b6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x57260e,null))['then'](function(_0x35d575){if(_0x35d575){return _0x35d575[_0xc5b6('0x53')](_0x841779['body']['ids'],_[_0xc5b6('0x54')](_0x841779['body'],[_0xc5b6('0x55'),'id'])||{});}})[_0xc5b6('0x28')](respondWithResult(_0x57260e,null))[_0xc5b6('0x48')](handleError(_0x57260e,null));};exports[_0xc5b6('0x56')]=function(_0x5e3e78,_0x53a593,_0x4a7f72){var _0x4e42c0={};var _0x410291={};var _0x1589de;var _0x157942;return db[_0xc5b6('0x30')][_0xc5b6('0x57')]({'where':{'id':_0x5e3e78[_0xc5b6('0x4f')]['id']}})[_0xc5b6('0x28')](handleEntityNotFound(_0x53a593,null))[_0xc5b6('0x28')](function(_0x5e064f){if(_0x5e064f){_0x1589de=_0x5e064f;_0x410291[_0xc5b6('0x34')]=_[_0xc5b6('0x49')](db['User'][_0xc5b6('0x4a')]);_0x410291['query']=_[_0xc5b6('0x49')](_0x5e3e78[_0xc5b6('0x35')]);_0x410291['filters']=_[_0xc5b6('0x37')](_0x410291['model'],_0x410291[_0xc5b6('0x35')]);_0x4e42c0[_0xc5b6('0x39')]=_[_0xc5b6('0x37')](_0x410291['model'],qs['fields'](_0x5e3e78[_0xc5b6('0x35')][_0xc5b6('0x38')]));_0x4e42c0[_0xc5b6('0x39')]=_0x4e42c0[_0xc5b6('0x39')]['length']?_0x4e42c0[_0xc5b6('0x39')]:_0x410291[_0xc5b6('0x34')];_0x4e42c0[_0xc5b6('0x3c')]=qs[_0xc5b6('0x3d')](_0x5e3e78[_0xc5b6('0x35')][_0xc5b6('0x3d')]);_0x4e42c0['where']=qs['filters'](_['pick'](_0x5e3e78[_0xc5b6('0x35')],_0x410291['filters']));if(_0x5e3e78[_0xc5b6('0x35')][_0xc5b6('0x42')]){_0x4e42c0[_0xc5b6('0x3e')]=_[_0xc5b6('0x40')](_0x4e42c0[_0xc5b6('0x3e')],{'$or':_[_0xc5b6('0x2f')](_0x4e42c0[_0xc5b6('0x39')],function(_0x82c86d){var _0x338fdd={};_0x338fdd[_0x82c86d]={'$like':'%'+_0x5e3e78[_0xc5b6('0x35')][_0xc5b6('0x42')]+'%'};return _0x338fdd;})});}_0x4e42c0=_['merge']({},_0x4e42c0,_0x5e3e78[_0xc5b6('0x43')]);return _0x1589de['getMembers'](_0x4e42c0);}})[_0xc5b6('0x28')](function(_0x5e34c8){if(_0x5e34c8){_0x157942=_0x5e34c8[_0xc5b6('0x3a')];if(!_0x5e3e78[_0xc5b6('0x35')][_0xc5b6('0x3b')](_0xc5b6('0x58'))){_0x4e42c0[_0xc5b6('0x20')]=qs[_0xc5b6('0x20')](_0x5e3e78['query']['limit']);_0x4e42c0[_0xc5b6('0x1e')]=qs[_0xc5b6('0x1e')](_0x5e3e78['query']['offset']);}return _0x1589de[_0xc5b6('0x56')](_0x4e42c0);}})['then'](function(_0x3daeda){if(_0x3daeda){return _0x3daeda?{'count':_0x157942,'rows':_0x3daeda}:null;}})[_0xc5b6('0x28')](respondWithResult(_0x53a593,null))[_0xc5b6('0x48')](handleError(_0x53a593,null));};exports[_0xc5b6('0x59')]=function(_0x8e5c0f,_0x59b5c1,_0x255bd4){return db[_0xc5b6('0x30')][_0xc5b6('0x4b')]({'where':{'id':_0x8e5c0f['params']['id']}})['then'](handleEntityNotFound(_0x59b5c1,null))[_0xc5b6('0x28')](function(_0x2d1007){if(_0x2d1007){return _0x2d1007[_0xc5b6('0x59')](_0x8e5c0f[_0xc5b6('0x35')]['ids']);}})[_0xc5b6('0x28')](respondWithStatusCode(_0x59b5c1,null))[_0xc5b6('0x48')](handleError(_0x59b5c1,null));};exports[_0xc5b6('0x5a')]=function(_0x19b665,_0x5f06fc,_0x53dda4){if(_0x19b665[_0xc5b6('0x4d')]['id']){delete _0x19b665['body']['id'];}return db['ChatGroup'][_0xc5b6('0x4b')]({'where':{'id':_0x19b665[_0xc5b6('0x4f')]['id']}})[_0xc5b6('0x28')](handleEntityNotFound(_0x5f06fc,null))[_0xc5b6('0x28')](function(_0xe6f006){if(_0xe6f006){_0x19b665[_0xc5b6('0x4d')][_0xc5b6('0x5b')]=_0xe6f006['id'];return db[_0xc5b6('0x5c')]['create'](_0x19b665[_0xc5b6('0x4d')]);}})[_0xc5b6('0x28')](respondWithResult(_0x5f06fc,null))[_0xc5b6('0x48')](handleError(_0x5f06fc,null));};exports['getMessages']=function(_0x798c3e,_0x5aa850,_0x2c48d2){var _0x57f63b={};var _0x1b9ffd={};var _0x48f1c0;var _0x257f89;return db[_0xc5b6('0x30')][_0xc5b6('0x57')]({'where':{'id':_0x798c3e['params']['id']}})[_0xc5b6('0x28')](handleEntityNotFound(_0x5aa850,null))['then'](function(_0x167a0c){if(_0x167a0c){_0x48f1c0=_0x167a0c;_0x1b9ffd['model']=_[_0xc5b6('0x49')](db[_0xc5b6('0x5c')][_0xc5b6('0x4a')]);_0x1b9ffd[_0xc5b6('0x35')]=_[_0xc5b6('0x49')](_0x798c3e['query']);_0x1b9ffd[_0xc5b6('0x36')]=_[_0xc5b6('0x37')](_0x1b9ffd[_0xc5b6('0x34')],_0x1b9ffd[_0xc5b6('0x35')]);_0x57f63b[_0xc5b6('0x39')]=_[_0xc5b6('0x37')](_0x1b9ffd[_0xc5b6('0x34')],qs[_0xc5b6('0x38')](_0x798c3e[_0xc5b6('0x35')]['fields']));_0x57f63b[_0xc5b6('0x39')]=_0x57f63b[_0xc5b6('0x39')][_0xc5b6('0x3a')]?_0x57f63b['attributes']:_0x1b9ffd[_0xc5b6('0x34')];_0x57f63b[_0xc5b6('0x3c')]=qs[_0xc5b6('0x3d')](_0x798c3e[_0xc5b6('0x35')][_0xc5b6('0x3d')]);_0x57f63b[_0xc5b6('0x3e')]=qs[_0xc5b6('0x36')](_[_0xc5b6('0x3f')](_0x798c3e['query'],_0x1b9ffd[_0xc5b6('0x36')]));if(_0x798c3e[_0xc5b6('0x35')][_0xc5b6('0x42')]){_0x57f63b[_0xc5b6('0x3e')]=_[_0xc5b6('0x40')](_0x57f63b[_0xc5b6('0x3e')],{'$or':_[_0xc5b6('0x2f')](_0x57f63b[_0xc5b6('0x39')],function(_0x19d6dd){var _0x38c4ec={};_0x38c4ec[_0x19d6dd]={'$like':'%'+_0x798c3e['query'][_0xc5b6('0x42')]+'%'};return _0x38c4ec;})});}if(_0x798c3e['query'][_0xc5b6('0x5d')]){var _0x4d6fb6=_0x798c3e[_0xc5b6('0x35')][_0xc5b6('0x5d')]['split'](',');var _0x1ec341={};_0x1ec341[_0x4d6fb6[0x0]]={'$gte':moment(_0x4d6fb6[0x1])[_0xc5b6('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x57f63b[_0xc5b6('0x3e')]=_[_0xc5b6('0x40')](_0x57f63b[_0xc5b6('0x3e')],_0x1ec341);}_0x57f63b=_[_0xc5b6('0x40')]({},_0x57f63b,_0x798c3e[_0xc5b6('0x43')]);return _0x48f1c0[_0xc5b6('0x5f')](_0x57f63b);}})[_0xc5b6('0x28')](function(_0x37528c){if(_0x37528c){_0x257f89=_0x37528c['length'];if(!_0x798c3e[_0xc5b6('0x35')][_0xc5b6('0x3b')](_0xc5b6('0x58'))){_0x57f63b['limit']=qs['limit'](_0x798c3e[_0xc5b6('0x35')][_0xc5b6('0x20')]);_0x57f63b[_0xc5b6('0x1e')]=qs[_0xc5b6('0x1e')](_0x798c3e[_0xc5b6('0x35')]['offset']);}return _0x48f1c0['getMessages'](_0x57f63b);}})[_0xc5b6('0x28')](function(_0x124f6d){if(_0x124f6d){return _0x124f6d?{'count':_0x257f89,'rows':_0x124f6d}:null;}})[_0xc5b6('0x28')](respondWithResult(_0x5aa850,null))[_0xc5b6('0x48')](handleError(_0x5aa850,null));}; \ No newline at end of file +var _0x73fa=['zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','key','model','keys','intersection','fields','attributes','length','query','hasOwnProperty','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','rows','catch','params','includeAll','find','create','body','update','toInteger','addMembers','ids','omit','getMembers','User','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','findOne','format','nolimit','eml-format','rimraf'];(function(_0x34cc56,_0x4afc22){var _0x335961=function(_0x92ccda){while(--_0x92ccda){_0x34cc56['push'](_0x34cc56['shift']());}};_0x335961(++_0x4afc22);}(_0x73fa,0x16a));var _0xa73f=function(_0x5679e5,_0x4e45c9){_0x5679e5=_0x5679e5-0x0;var _0x34a94=_0x73fa[_0x5679e5];return _0x34a94;};'use strict';var emlformat=require(_0xa73f('0x0'));var rimraf=require(_0xa73f('0x1'));var zipdir=require(_0xa73f('0x2'));var jsonpatch=require(_0xa73f('0x3'));var rp=require(_0xa73f('0x4'));var moment=require(_0xa73f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa73f('0x6'));var path=require(_0xa73f('0x7'));var sox=require(_0xa73f('0x8'));var csv=require('to-csv');var ejs=require(_0xa73f('0x9'));var fs=require('fs');var fs_extra=require(_0xa73f('0xa'));var _=require(_0xa73f('0xb'));var squel=require('squel');var crypto=require(_0xa73f('0xc'));var jsforce=require(_0xa73f('0xd'));var deskjs=require(_0xa73f('0xe'));var toCsv=require(_0xa73f('0xf'));var querystring=require(_0xa73f('0x10'));var Papa=require(_0xa73f('0x11'));var Redis=require(_0xa73f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa73f('0x13'));var hardwareService=require(_0xa73f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa73f('0x15'));var config=require(_0xa73f('0x16'));var licenseUtil=require(_0xa73f('0x17'));var db=require('../../mysqldb')['db'];config[_0xa73f('0x18')]=_[_0xa73f('0x19')](config[_0xa73f('0x18')],{'host':_0xa73f('0x1a'),'port':0x18eb});var socket=require(_0xa73f('0x1b'))(new Redis(config['redis']));require(_0xa73f('0x1c'))['register'](socket);function respondWithStatusCode(_0x2469f5,_0x357fdb){_0x357fdb=_0x357fdb||0xcc;return function(_0x1c4857){if(_0x1c4857){return _0x2469f5[_0xa73f('0x1d')](_0x357fdb);}return _0x2469f5[_0xa73f('0x1e')](_0x357fdb)['end']();};}function respondWithResult(_0x5e11f8,_0x4f0509){_0x4f0509=_0x4f0509||0xc8;return function(_0x59282f){if(_0x59282f){return _0x5e11f8[_0xa73f('0x1e')](_0x4f0509)[_0xa73f('0x1f')](_0x59282f);}};}function respondWithFilteredResult(_0x59921e,_0x2d43b0){return function(_0x16e836){if(_0x16e836){var _0x217c3a=typeof _0x2d43b0[_0xa73f('0x20')]===_0xa73f('0x21')&&typeof _0x2d43b0[_0xa73f('0x22')]===_0xa73f('0x21');var _0x328fd4=_0x16e836[_0xa73f('0x23')];var _0x5323d5=_0x217c3a?0x0:_0x2d43b0[_0xa73f('0x20')];var _0x3f6faf=_0x217c3a?_0x16e836[_0xa73f('0x23')]:_0x2d43b0[_0xa73f('0x20')]+_0x2d43b0[_0xa73f('0x22')];var _0x5a7fc7;if(_0x3f6faf>=_0x328fd4){_0x3f6faf=_0x328fd4;_0x5a7fc7=0xc8;}else{_0x5a7fc7=0xce;}_0x59921e[_0xa73f('0x1e')](_0x5a7fc7);return _0x59921e[_0xa73f('0x24')](_0xa73f('0x25'),_0x5323d5+'-'+_0x3f6faf+'/'+_0x328fd4)[_0xa73f('0x1f')](_0x16e836);}return null;};}function patchUpdates(_0x5618d3){return function(_0x356fa0){try{jsonpatch['apply'](_0x356fa0,_0x5618d3,!![]);}catch(_0x213949){return BPromise[_0xa73f('0x26')](_0x213949);}return _0x356fa0['save']();};}function saveUpdates(_0x52d5e0,_0x476950){return function(_0x36eb4a){if(_0x36eb4a){return _0x36eb4a['update'](_0x52d5e0)[_0xa73f('0x27')](function(_0x3b55e9){return _0x3b55e9;});}return null;};}function removeEntity(_0x22c59d,_0x216026){return function(_0x403b7d){if(_0x403b7d){return _0x403b7d[_0xa73f('0x28')]()[_0xa73f('0x27')](function(){_0x22c59d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c12e2,_0x3d5883){return function(_0x53fa3a){if(!_0x53fa3a){_0x2c12e2[_0xa73f('0x1d')](0x194);}return _0x53fa3a;};}function handleError(_0x5b6594,_0x112755){_0x112755=_0x112755||0x1f4;return function(_0x45e7ce){logger[_0xa73f('0x29')](_0x45e7ce[_0xa73f('0x2a')]);if(_0x45e7ce[_0xa73f('0x2b')]){delete _0x45e7ce['name'];}_0x5b6594['status'](_0x112755)[_0xa73f('0x2c')](_0x45e7ce);};}exports['index']=function(_0x2b07fb,_0xa33330){var _0xfb006f={},_0x121b24={},_0x308d53={'count':0x0,'rows':[]};var _0x28e387=_[_0xa73f('0x2d')](db[_0xa73f('0x2e')][_0xa73f('0x2f')],function(_0x2f5ab2){return{'name':_0x2f5ab2[_0xa73f('0x30')],'type':_0x2f5ab2[_0xa73f('0x31')][_0xa73f('0x32')]};});_0x121b24[_0xa73f('0x33')]=_[_0xa73f('0x2d')](_0x28e387,_0xa73f('0x2b'));_0x121b24['query']=_[_0xa73f('0x34')](_0x2b07fb['query']);_0x121b24['filters']=_[_0xa73f('0x35')](_0x121b24[_0xa73f('0x33')],_0x121b24['query']);_0xfb006f['attributes']=_[_0xa73f('0x35')](_0x121b24['model'],qs[_0xa73f('0x36')](_0x2b07fb['query']['fields']));_0xfb006f['attributes']=_0xfb006f[_0xa73f('0x37')][_0xa73f('0x38')]?_0xfb006f[_0xa73f('0x37')]:_0x121b24[_0xa73f('0x33')];if(!_0x2b07fb[_0xa73f('0x39')][_0xa73f('0x3a')]('nolimit')){_0xfb006f[_0xa73f('0x22')]=qs['limit'](_0x2b07fb[_0xa73f('0x39')][_0xa73f('0x22')]);_0xfb006f[_0xa73f('0x20')]=qs[_0xa73f('0x20')](_0x2b07fb[_0xa73f('0x39')]['offset']);}_0xfb006f[_0xa73f('0x3b')]=qs[_0xa73f('0x3c')](_0x2b07fb[_0xa73f('0x39')]['sort']);_0xfb006f['where']=qs[_0xa73f('0x3d')](_[_0xa73f('0x3e')](_0x2b07fb[_0xa73f('0x39')],_0x121b24[_0xa73f('0x3d')]),_0x28e387);if(_0x2b07fb[_0xa73f('0x39')][_0xa73f('0x3f')]){_0xfb006f['where']=_[_0xa73f('0x40')](_0xfb006f[_0xa73f('0x41')],{'$or':_['map'](_0x28e387,function(_0x9ed2f4){if(_0x9ed2f4['type']!==_0xa73f('0x42')){var _0x2c8a96={};_0x2c8a96[_0x9ed2f4['name']]={'$like':'%'+_0x2b07fb[_0xa73f('0x39')][_0xa73f('0x3f')]+'%'};return _0x2c8a96;}})});}_0xfb006f=_[_0xa73f('0x40')]({},_0xfb006f,_0x2b07fb[_0xa73f('0x43')]);var _0x8176ca={'where':_0xfb006f['where']};return db[_0xa73f('0x2e')][_0xa73f('0x23')](_0x8176ca)[_0xa73f('0x27')](function(_0x2e8118){_0x308d53['count']=_0x2e8118;if(_0x2b07fb[_0xa73f('0x39')]['includeAll']){_0xfb006f[_0xa73f('0x44')]=[{'all':!![]}];}return db[_0xa73f('0x2e')]['findAll'](_0xfb006f);})[_0xa73f('0x27')](function(_0x1405e6){_0x308d53[_0xa73f('0x45')]=_0x1405e6;return _0x308d53;})[_0xa73f('0x27')](respondWithFilteredResult(_0xa33330,_0xfb006f))[_0xa73f('0x46')](handleError(_0xa33330,null));};exports['show']=function(_0x2ad112,_0x53a0a2){var _0xb8babe={'raw':!![],'where':{'id':_0x2ad112[_0xa73f('0x47')]['id']}},_0x15e232={};_0x15e232[_0xa73f('0x33')]=_['keys'](db['ChatGroup'][_0xa73f('0x2f')]);_0x15e232[_0xa73f('0x39')]=_[_0xa73f('0x34')](_0x2ad112[_0xa73f('0x39')]);_0x15e232['filters']=_['intersection'](_0x15e232['model'],_0x15e232[_0xa73f('0x39')]);_0xb8babe[_0xa73f('0x37')]=_[_0xa73f('0x35')](_0x15e232['model'],qs[_0xa73f('0x36')](_0x2ad112['query']['fields']));_0xb8babe[_0xa73f('0x37')]=_0xb8babe[_0xa73f('0x37')][_0xa73f('0x38')]?_0xb8babe['attributes']:_0x15e232[_0xa73f('0x33')];if(_0x2ad112[_0xa73f('0x39')][_0xa73f('0x48')]){_0xb8babe['include']=[{'all':!![]}];}_0xb8babe=_[_0xa73f('0x40')]({},_0xb8babe,_0x2ad112[_0xa73f('0x43')]);return db[_0xa73f('0x2e')][_0xa73f('0x49')](_0xb8babe)['then'](handleEntityNotFound(_0x53a0a2,null))[_0xa73f('0x27')](respondWithResult(_0x53a0a2,null))[_0xa73f('0x46')](handleError(_0x53a0a2,null));};exports['create']=function(_0x572748,_0x3c0a42){return db['ChatGroup'][_0xa73f('0x4a')](_0x572748[_0xa73f('0x4b')],{})[_0xa73f('0x27')](respondWithResult(_0x3c0a42,0xc9))[_0xa73f('0x46')](handleError(_0x3c0a42,null));};exports[_0xa73f('0x4c')]=function(_0x38b4e9,_0x4e7d10){if(_0x38b4e9[_0xa73f('0x4b')]['id']){delete _0x38b4e9['body']['id'];}return db[_0xa73f('0x2e')][_0xa73f('0x49')]({'where':{'id':_0x38b4e9[_0xa73f('0x47')]['id']}})[_0xa73f('0x27')](handleEntityNotFound(_0x4e7d10,null))[_0xa73f('0x27')](saveUpdates(_0x38b4e9['body'],null))[_0xa73f('0x27')](respondWithResult(_0x4e7d10,null))[_0xa73f('0x46')](handleError(_0x4e7d10,null));};exports[_0xa73f('0x28')]=function(_0x3319df,_0xefbc38){return db[_0xa73f('0x2e')]['find']({'where':{'id':_0x3319df[_0xa73f('0x47')]['id']}})['then'](handleEntityNotFound(_0xefbc38,null))[_0xa73f('0x27')](removeEntity(_0xefbc38,null))['catch'](handleError(_0xefbc38,null));};exports['describe']=function(_0x197ce3,_0x195562){return db[_0xa73f('0x2e')]['describe']()['then'](respondWithResult(_0x195562,null))['catch'](handleError(_0x195562,null));};exports['getUnread']=function(_0x4c6348,_0xa69cf8,_0x37d6bb){return db['ChatInternalMessage'][_0xa73f('0x23')]({'where':{'ChatGroupId':_0x4c6348['params']['id'],'ToId':_0x4c6348['user']['id'],'read':![]}})[_0xa73f('0x27')](function(_0x1a7591){return{'id':_[_0xa73f('0x4d')](_0x4c6348['params']['id']),'count':_0x1a7591};})['then'](respondWithResult(_0xa69cf8,null))[_0xa73f('0x46')](handleError(_0xa69cf8,null));};exports[_0xa73f('0x4e')]=function(_0x25cbe8,_0x22b4a2,_0x170f0c){return db['ChatGroup']['find']({'where':{'id':_0x25cbe8[_0xa73f('0x47')]['id']}})[_0xa73f('0x27')](handleEntityNotFound(_0x22b4a2,null))[_0xa73f('0x27')](function(_0x5d68b){if(_0x5d68b){return _0x5d68b[_0xa73f('0x4e')](_0x25cbe8[_0xa73f('0x4b')][_0xa73f('0x4f')],_[_0xa73f('0x50')](_0x25cbe8[_0xa73f('0x4b')],['ids','id'])||{});}})['then'](respondWithResult(_0x22b4a2,null))[_0xa73f('0x46')](handleError(_0x22b4a2,null));};exports[_0xa73f('0x51')]=function(_0x342009,_0x1c205e,_0x51321e){var _0x45faef={};var _0x1f87a9={};var _0x1921ea;var _0x9479e1;return db[_0xa73f('0x2e')]['findOne']({'where':{'id':_0x342009[_0xa73f('0x47')]['id']}})[_0xa73f('0x27')](handleEntityNotFound(_0x1c205e,null))[_0xa73f('0x27')](function(_0x4e2d0b){if(_0x4e2d0b){_0x1921ea=_0x4e2d0b;_0x1f87a9[_0xa73f('0x33')]=_['keys'](db[_0xa73f('0x52')]['rawAttributes']);_0x1f87a9[_0xa73f('0x39')]=_[_0xa73f('0x34')](_0x342009['query']);_0x1f87a9['filters']=_[_0xa73f('0x35')](_0x1f87a9[_0xa73f('0x33')],_0x1f87a9[_0xa73f('0x39')]);_0x45faef[_0xa73f('0x37')]=_['intersection'](_0x1f87a9[_0xa73f('0x33')],qs[_0xa73f('0x36')](_0x342009[_0xa73f('0x39')][_0xa73f('0x36')]));_0x45faef['attributes']=_0x45faef[_0xa73f('0x37')][_0xa73f('0x38')]?_0x45faef['attributes']:_0x1f87a9[_0xa73f('0x33')];_0x45faef[_0xa73f('0x3b')]=qs[_0xa73f('0x3c')](_0x342009[_0xa73f('0x39')]['sort']);_0x45faef[_0xa73f('0x41')]=qs[_0xa73f('0x3d')](_[_0xa73f('0x3e')](_0x342009[_0xa73f('0x39')],_0x1f87a9[_0xa73f('0x3d')]));if(_0x342009[_0xa73f('0x39')][_0xa73f('0x3f')]){_0x45faef[_0xa73f('0x41')]=_[_0xa73f('0x40')](_0x45faef[_0xa73f('0x41')],{'$or':_[_0xa73f('0x2d')](_0x45faef['attributes'],function(_0x32a2b3){var _0x5a2374={};_0x5a2374[_0x32a2b3]={'$like':'%'+_0x342009[_0xa73f('0x39')][_0xa73f('0x3f')]+'%'};return _0x5a2374;})});}_0x45faef=_[_0xa73f('0x40')]({},_0x45faef,_0x342009[_0xa73f('0x43')]);return _0x1921ea[_0xa73f('0x51')](_0x45faef);}})['then'](function(_0x1da380){if(_0x1da380){_0x9479e1=_0x1da380[_0xa73f('0x38')];if(!_0x342009[_0xa73f('0x39')][_0xa73f('0x3a')]('nolimit')){_0x45faef[_0xa73f('0x22')]=qs['limit'](_0x342009[_0xa73f('0x39')]['limit']);_0x45faef[_0xa73f('0x20')]=qs['offset'](_0x342009[_0xa73f('0x39')][_0xa73f('0x20')]);}return _0x1921ea[_0xa73f('0x51')](_0x45faef);}})[_0xa73f('0x27')](function(_0xe1f940){if(_0xe1f940){return _0xe1f940?{'count':_0x9479e1,'rows':_0xe1f940}:null;}})[_0xa73f('0x27')](respondWithResult(_0x1c205e,null))[_0xa73f('0x46')](handleError(_0x1c205e,null));};exports[_0xa73f('0x53')]=function(_0xa7211c,_0x53f458,_0x233664){return db[_0xa73f('0x2e')][_0xa73f('0x49')]({'where':{'id':_0xa7211c[_0xa73f('0x47')]['id']}})[_0xa73f('0x27')](handleEntityNotFound(_0x53f458,null))[_0xa73f('0x27')](function(_0x7412c2){if(_0x7412c2){return _0x7412c2[_0xa73f('0x53')](_0xa7211c[_0xa73f('0x39')][_0xa73f('0x4f')]);}})['then'](respondWithStatusCode(_0x53f458,null))[_0xa73f('0x46')](handleError(_0x53f458,null));};exports[_0xa73f('0x54')]=function(_0x54b02,_0x5d71f4,_0xd08095){if(_0x54b02[_0xa73f('0x4b')]['id']){delete _0x54b02[_0xa73f('0x4b')]['id'];}return db[_0xa73f('0x2e')][_0xa73f('0x49')]({'where':{'id':_0x54b02[_0xa73f('0x47')]['id']}})[_0xa73f('0x27')](handleEntityNotFound(_0x5d71f4,null))[_0xa73f('0x27')](function(_0x2b3fa9){if(_0x2b3fa9){_0x54b02['body'][_0xa73f('0x55')]=_0x2b3fa9['id'];return db[_0xa73f('0x56')]['create'](_0x54b02['body']);}})[_0xa73f('0x27')](respondWithResult(_0x5d71f4,null))[_0xa73f('0x46')](handleError(_0x5d71f4,null));};exports[_0xa73f('0x57')]=function(_0x3519dc,_0x36ff3d,_0x41dccb){var _0x32eeb5={};var _0x2e50bc={};var _0x57e828;var _0x43431c;return db[_0xa73f('0x2e')][_0xa73f('0x58')]({'where':{'id':_0x3519dc[_0xa73f('0x47')]['id']}})[_0xa73f('0x27')](handleEntityNotFound(_0x36ff3d,null))['then'](function(_0x198fb6){if(_0x198fb6){_0x57e828=_0x198fb6;_0x2e50bc['model']=_[_0xa73f('0x34')](db['ChatInternalMessage'][_0xa73f('0x2f')]);_0x2e50bc['query']=_[_0xa73f('0x34')](_0x3519dc[_0xa73f('0x39')]);_0x2e50bc[_0xa73f('0x3d')]=_[_0xa73f('0x35')](_0x2e50bc['model'],_0x2e50bc['query']);_0x32eeb5[_0xa73f('0x37')]=_[_0xa73f('0x35')](_0x2e50bc[_0xa73f('0x33')],qs[_0xa73f('0x36')](_0x3519dc['query']['fields']));_0x32eeb5[_0xa73f('0x37')]=_0x32eeb5['attributes'][_0xa73f('0x38')]?_0x32eeb5[_0xa73f('0x37')]:_0x2e50bc[_0xa73f('0x33')];_0x32eeb5['order']=qs[_0xa73f('0x3c')](_0x3519dc[_0xa73f('0x39')][_0xa73f('0x3c')]);_0x32eeb5[_0xa73f('0x41')]=qs[_0xa73f('0x3d')](_[_0xa73f('0x3e')](_0x3519dc['query'],_0x2e50bc[_0xa73f('0x3d')]));if(_0x3519dc['query'][_0xa73f('0x3f')]){_0x32eeb5[_0xa73f('0x41')]=_[_0xa73f('0x40')](_0x32eeb5[_0xa73f('0x41')],{'$or':_[_0xa73f('0x2d')](_0x32eeb5[_0xa73f('0x37')],function(_0x55ac1c){var _0xd38af3={};_0xd38af3[_0x55ac1c]={'$like':'%'+_0x3519dc['query'][_0xa73f('0x3f')]+'%'};return _0xd38af3;})});}if(_0x3519dc[_0xa73f('0x39')]['$gte']){var _0xc047f4=_0x3519dc['query']['$gte']['split'](',');var _0x409dab={};_0x409dab[_0xc047f4[0x0]]={'$gte':moment(_0xc047f4[0x1])[_0xa73f('0x59')]('YYYY-MM-DD\x20HH:mm:ss')};_0x32eeb5[_0xa73f('0x41')]=_[_0xa73f('0x40')](_0x32eeb5[_0xa73f('0x41')],_0x409dab);}_0x32eeb5=_[_0xa73f('0x40')]({},_0x32eeb5,_0x3519dc[_0xa73f('0x43')]);return _0x57e828[_0xa73f('0x57')](_0x32eeb5);}})['then'](function(_0x21d912){if(_0x21d912){_0x43431c=_0x21d912[_0xa73f('0x38')];if(!_0x3519dc['query'][_0xa73f('0x3a')](_0xa73f('0x5a'))){_0x32eeb5[_0xa73f('0x22')]=qs[_0xa73f('0x22')](_0x3519dc[_0xa73f('0x39')]['limit']);_0x32eeb5['offset']=qs[_0xa73f('0x20')](_0x3519dc[_0xa73f('0x39')][_0xa73f('0x20')]);}return _0x57e828[_0xa73f('0x57')](_0x32eeb5);}})[_0xa73f('0x27')](function(_0x35e78a){if(_0x35e78a){return _0x35e78a?{'count':_0x43431c,'rows':_0x35e78a}:null;}})[_0xa73f('0x27')](respondWithResult(_0x36ff3d,null))[_0xa73f('0x46')](handleError(_0x36ff3d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 8087cfe..c343ea9 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 _0xb422=['emit','hasOwnProperty','hook','setMaxListeners','remove'];(function(_0x17ebd1,_0x5bc2e3){var _0x3fe498=function(_0x202150){while(--_0x202150){_0x17ebd1['push'](_0x17ebd1['shift']());}};_0x3fe498(++_0x5bc2e3);}(_0xb422,0x85));var _0x2b42=function(_0x332933,_0x3f58df){_0x332933=_0x332933-0x0;var _0x34fb7b=_0xb422[_0x332933];return _0x34fb7b;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2b42('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2b42('0x1')};function emitEvent(_0x5a42d2){return function(_0x14330f,_0x5df2d3,_0x1b469f){ChatGroupEvents['emit'](_0x5a42d2+':'+_0x14330f['id'],_0x14330f);ChatGroupEvents[_0x2b42('0x2')](_0x5a42d2,_0x14330f);_0x1b469f(null);};}for(var e in events){if(events[_0x2b42('0x3')](e)){var event=events[e];ChatGroup[_0x2b42('0x4')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x677a=['setMaxListeners','save','update','remove','emit','hook','exports','events','ChatGroup'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x677a,0xd6));var _0xa677=function(_0xb09cb9,_0x519db1){_0xb09cb9=_0xb09cb9-0x0;var _0x106249=_0x677a[_0xb09cb9];return _0x106249;};'use strict';var EventEmitter=require(_0xa677('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xa677('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xa677('0x2')](0x0);var events={'afterCreate':_0xa677('0x3'),'afterUpdate':_0xa677('0x4'),'afterDestroy':_0xa677('0x5')};function emitEvent(_0x4a7c34){return function(_0x1ca988,_0x2e46f8,_0x45eebf){ChatGroupEvents[_0xa677('0x6')](_0x4a7c34+':'+_0x1ca988['id'],_0x1ca988);ChatGroupEvents[_0xa677('0x6')](_0x4a7c34,_0x1ca988);_0x45eebf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xa677('0x7')](e,emitEvent(event));}}module[_0xa677('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 368766f..e7134f1 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 _0xea39=['./chatGroup.attributes','exports','define','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xea39,0x1a8));var _0x9ea3=function(_0x4b27dc,_0x3f7afb){_0x4b27dc=_0x4b27dc-0x0;var _0x1a37f2=_0xea39[_0x4b27dc];return _0x1a37f2;};'use strict';var _=require(_0x9ea3('0x0'));var util=require(_0x9ea3('0x1'));var logger=require(_0x9ea3('0x2'))(_0x9ea3('0x3'));var moment=require(_0x9ea3('0x4'));var BPromise=require(_0x9ea3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ea3('0x6'));var rimraf=require(_0x9ea3('0x7'));var config=require('../../config/environment');var attributes=require(_0x9ea3('0x8'));module[_0x9ea3('0x9')]=function(_0x4b7aaf,_0xf5e61a){return _0x4b7aaf[_0x9ea3('0xa')]('ChatGroup',attributes,{'tableName':_0x9ea3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d10=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash'];(function(_0x304408,_0x49ba12){var _0x37ac3e=function(_0x157fd7){while(--_0x157fd7){_0x304408['push'](_0x304408['shift']());}};_0x37ac3e(++_0x49ba12);}(_0x3d10,0x1bf));var _0x03d1=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0x3d10[_0x491faa];return _0x414440;};'use strict';var _=require(_0x03d1('0x0'));var util=require(_0x03d1('0x1'));var logger=require(_0x03d1('0x2'))(_0x03d1('0x3'));var moment=require(_0x03d1('0x4'));var BPromise=require(_0x03d1('0x5'));var rp=require(_0x03d1('0x6'));var fs=require('fs');var path=require(_0x03d1('0x7'));var rimraf=require(_0x03d1('0x8'));var config=require(_0x03d1('0x9'));var attributes=require(_0x03d1('0xa'));module[_0x03d1('0xb')]=function(_0x1b5c98,_0x444904){return _0x1b5c98[_0x03d1('0xc')](_0x03d1('0xd'),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 3d76203..64216b4 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 _0x3f19=['info','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1e2f07,_0x4da21b){var _0x42d8c1=function(_0x466378){while(--_0x466378){_0x1e2f07['push'](_0x1e2f07['shift']());}};_0x42d8c1(++_0x4da21b);}(_0x3f19,0x1f1));var _0x93f1=function(_0x1d6eb4,_0x2a20d7){_0x1d6eb4=_0x1d6eb4-0x0;var _0x1277f0=_0x3f19[_0x1d6eb4];return _0x1277f0;};'use strict';var _=require('lodash');var util=require(_0x93f1('0x0'));var moment=require('moment');var BPromise=require(_0x93f1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93f1('0x2'));var db=require(_0x93f1('0x3'))['db'];var utils=require(_0x93f1('0x4'));var logger=require(_0x93f1('0x5'))(_0x93f1('0x6'));var config=require(_0x93f1('0x7'));var jayson=require(_0x93f1('0x8'));var client=jayson[_0x93f1('0x9')][_0x93f1('0xa')]({'port':0x232a});config[_0x93f1('0xb')]=_[_0x93f1('0xc')](config[_0x93f1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x93f1('0xd'))(new Redis(config['redis']));require(_0x93f1('0xe'))[_0x93f1('0xf')](socket);function respondWithRpcPromise(_0x4052b4,_0x45d171,_0x30fed4){return new BPromise(function(_0x5c8cda,_0x4a6776){return client[_0x93f1('0x10')](_0x4052b4,_0x30fed4)['then'](function(_0x3eb625){logger['info'](_0x93f1('0x11'),_0x45d171,_0x93f1('0x12'));logger['debug'](_0x93f1('0x13'),_0x45d171,_0x93f1('0x12'),JSON['stringify'](_0x3eb625));if(_0x3eb625[_0x93f1('0x14')]){if(_0x3eb625[_0x93f1('0x14')][_0x93f1('0x15')]===0x1f4){logger[_0x93f1('0x14')](_0x93f1('0x11'),_0x45d171,_0x3eb625[_0x93f1('0x14')][_0x93f1('0x16')]);return _0x4a6776(_0x3eb625[_0x93f1('0x14')][_0x93f1('0x16')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x45d171,_0x3eb625[_0x93f1('0x14')][_0x93f1('0x16')]);return _0x5c8cda(_0x3eb625[_0x93f1('0x14')][_0x93f1('0x16')]);}else{logger[_0x93f1('0x17')]('ChatGroup,\x20%s,\x20%s',_0x45d171,_0x93f1('0x12'));_0x5c8cda(_0x3eb625[_0x93f1('0x18')][_0x93f1('0x16')]);}})[_0x93f1('0x19')](function(_0x31f4d9){logger[_0x93f1('0x14')](_0x93f1('0x11'),_0x45d171,_0x31f4d9);_0x4a6776(_0x31f4d9);});});} \ No newline at end of file +var _0xc1f1=['result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc1f1,0x122));var _0x1c1f=function(_0x4c4d9c,_0x5bd0eb){_0x4c4d9c=_0x4c4d9c-0x0;var _0x5063fb=_0xc1f1[_0x4c4d9c];return _0x5063fb;};'use strict';var _=require('lodash');var util=require(_0x1c1f('0x0'));var moment=require(_0x1c1f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1c1f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c1f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c1f('0x4'))('rpc');var config=require(_0x1c1f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1c1f('0x6')][_0x1c1f('0x7')]({'port':0x232a});config[_0x1c1f('0x8')]=_[_0x1c1f('0x9')](config[_0x1c1f('0x8')],{'host':_0x1c1f('0xa'),'port':0x18eb});var socket=require(_0x1c1f('0xb'))(new Redis(config['redis']));require(_0x1c1f('0xc'))['register'](socket);function respondWithRpcPromise(_0x13ae18,_0x38a582,_0x28bd49){return new BPromise(function(_0xa76d01,_0x207407){return client[_0x1c1f('0xd')](_0x13ae18,_0x28bd49)[_0x1c1f('0xe')](function(_0x5b7ed8){logger['info'](_0x1c1f('0xf'),_0x38a582,_0x1c1f('0x10'));logger[_0x1c1f('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x38a582,_0x1c1f('0x10'),JSON[_0x1c1f('0x12')](_0x5b7ed8));if(_0x5b7ed8[_0x1c1f('0x13')]){if(_0x5b7ed8[_0x1c1f('0x13')]['code']===0x1f4){logger['error'](_0x1c1f('0xf'),_0x38a582,_0x5b7ed8[_0x1c1f('0x13')][_0x1c1f('0x14')]);return _0x207407(_0x5b7ed8[_0x1c1f('0x13')][_0x1c1f('0x14')]);}logger[_0x1c1f('0x13')](_0x1c1f('0xf'),_0x38a582,_0x5b7ed8[_0x1c1f('0x13')]['message']);return _0xa76d01(_0x5b7ed8['error'][_0x1c1f('0x14')]);}else{logger[_0x1c1f('0x15')](_0x1c1f('0xf'),_0x38a582,_0x1c1f('0x10'));_0xa76d01(_0x5b7ed8[_0x1c1f('0x16')][_0x1c1f('0x14')]);}})[_0x1c1f('0x17')](function(_0x4653a6){logger['error'](_0x1c1f('0xf'),_0x38a582,_0x4653a6);_0x207407(_0x4653a6);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 63bfc51..de1fa14 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 _0xc5f3=['save','update','emit','removeListener','length','chatGroup:'];(function(_0x15443e,_0x5d70c1){var _0x4b93d7=function(_0x15586b){while(--_0x15586b){_0x15443e['push'](_0x15443e['shift']());}};_0x4b93d7(++_0x5d70c1);}(_0xc5f3,0x162));var _0x3c5f=function(_0x4ba811,_0x4428f2){_0x4ba811=_0x4ba811-0x0;var _0x3b616f=_0xc5f3[_0x4ba811];return _0x3b616f;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x3c5f('0x0'),'remove',_0x3c5f('0x1')];function createListener(_0x56b973,_0x487b0e){return function(_0x2956d9){_0x487b0e[_0x3c5f('0x2')](_0x56b973,_0x2956d9);};}function removeListener(_0x3dac93,_0x273b6e){return function(){ChatGroupEvents[_0x3c5f('0x3')](_0x3dac93,_0x273b6e);};}exports['register']=function(_0x5334b9){for(var _0x3a2a57=0x0,_0x27548c=events[_0x3c5f('0x4')];_0x3a2a57<_0x27548c;_0x3a2a57++){var _0x53181e=events[_0x3a2a57];var _0x11dfa7=createListener(_0x3c5f('0x5')+_0x53181e,_0x5334b9);ChatGroupEvents['on'](_0x53181e,_0x11dfa7);}}; \ No newline at end of file +var _0xbe99=['removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0xbe99,0x9c));var _0x9be9=function(_0x34c3f3,_0x15f139){_0x34c3f3=_0x34c3f3-0x0;var _0x3ca5cb=_0xbe99[_0x34c3f3];return _0x3ca5cb;};'use strict';var ChatGroupEvents=require(_0x9be9('0x0'));var events=[_0x9be9('0x1'),_0x9be9('0x2'),_0x9be9('0x3')];function createListener(_0x780961,_0xc78b7d){return function(_0x52781b){_0xc78b7d['emit'](_0x780961,_0x52781b);};}function removeListener(_0x575d05,_0x2593af){return function(){ChatGroupEvents[_0x9be9('0x4')](_0x575d05,_0x2593af);};}exports[_0x9be9('0x5')]=function(_0x199f73){for(var _0x129a77=0x0,_0x1af207=events[_0x9be9('0x6')];_0x129a77<_0x1af207;_0x129a77++){var _0x127dea=events[_0x129a77];var _0x335e9a=createListener(_0x9be9('0x7')+_0x127dea,_0x199f73);ChatGroupEvents['on'](_0x127dea,_0x335e9a);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 940fb75..ed3eef0 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 _0xdcb7=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','/describe','get','/:id','/:id/unread','getUnread','/:id/messages','getMessages','post','/:id/members','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','connect-timeout'];(function(_0xc140f6,_0x295d7f){var _0x2d4f70=function(_0x173f49){while(--_0x173f49){_0xc140f6['push'](_0xc140f6['shift']());}};_0x2d4f70(++_0x295d7f);}(_0xdcb7,0x10c));var _0x7dcb=function(_0x337c60,_0x52db2a){_0x337c60=_0x337c60-0x0;var _0xea2304=_0xdcb7[_0x337c60];return _0xea2304;};'use strict';var multer=require(_0x7dcb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7dcb('0x1'));var express=require(_0x7dcb('0x2'));var router=express['Router']();var fs_extra=require(_0x7dcb('0x3'));var auth=require(_0x7dcb('0x4'));var interaction=require(_0x7dcb('0x5'));var config=require(_0x7dcb('0x6'));var controller=require(_0x7dcb('0x7'));router['get']('/',auth[_0x7dcb('0x8')](),controller[_0x7dcb('0x9')]);router['get'](_0x7dcb('0xa'),auth[_0x7dcb('0x8')](),controller['describe']);router[_0x7dcb('0xb')](_0x7dcb('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7dcb('0xd'),auth[_0x7dcb('0x8')](),controller[_0x7dcb('0xe')]);router[_0x7dcb('0xb')]('/:id/members',auth[_0x7dcb('0x8')](),controller['getMembers']);router[_0x7dcb('0xb')](_0x7dcb('0xf'),auth[_0x7dcb('0x8')](),controller[_0x7dcb('0x10')]);router[_0x7dcb('0x11')]('/',auth[_0x7dcb('0x8')](),controller['create']);router[_0x7dcb('0x11')](_0x7dcb('0x12'),auth[_0x7dcb('0x8')](),controller[_0x7dcb('0x13')]);router[_0x7dcb('0x11')](_0x7dcb('0xf'),auth['isAuthenticated'](),controller[_0x7dcb('0x14')]);router[_0x7dcb('0x15')](_0x7dcb('0xc'),auth['isAuthenticated'](),controller[_0x7dcb('0x16')]);router[_0x7dcb('0x17')]('/:id',auth[_0x7dcb('0x8')](),controller[_0x7dcb('0x18')]);router[_0x7dcb('0x17')](_0x7dcb('0x12'),auth[_0x7dcb('0x8')](),controller[_0x7dcb('0x19')]);module[_0x7dcb('0x1a')]=router; \ No newline at end of file +var _0x2dc5=['/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','/:id/members','addMembers','put','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x2dc5,0x1a6));var _0x52dc=function(_0x14272f,_0x5c0226){_0x14272f=_0x14272f-0x0;var _0x3a5c64=_0x2dc5[_0x14272f];return _0x3a5c64;};'use strict';var multer=require('multer');var util=require(_0x52dc('0x0'));var path=require(_0x52dc('0x1'));var timeout=require(_0x52dc('0x2'));var express=require(_0x52dc('0x3'));var router=express[_0x52dc('0x4')]();var fs_extra=require(_0x52dc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x52dc('0x6'));var config=require(_0x52dc('0x7'));var controller=require('./chatGroup.controller');router[_0x52dc('0x8')]('/',auth[_0x52dc('0x9')](),controller[_0x52dc('0xa')]);router['get'](_0x52dc('0xb'),auth[_0x52dc('0x9')](),controller[_0x52dc('0xc')]);router[_0x52dc('0x8')](_0x52dc('0xd'),auth['isAuthenticated'](),controller[_0x52dc('0xe')]);router[_0x52dc('0x8')](_0x52dc('0xf'),auth[_0x52dc('0x9')](),controller[_0x52dc('0x10')]);router[_0x52dc('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x52dc('0x11')]);router[_0x52dc('0x8')](_0x52dc('0x12'),auth[_0x52dc('0x9')](),controller[_0x52dc('0x13')]);router['post']('/',auth[_0x52dc('0x9')](),controller['create']);router[_0x52dc('0x14')](_0x52dc('0x15'),auth[_0x52dc('0x9')](),controller[_0x52dc('0x16')]);router['post']('/:id/messages',auth[_0x52dc('0x9')](),controller['addMessage']);router[_0x52dc('0x17')](_0x52dc('0xd'),auth['isAuthenticated'](),controller[_0x52dc('0x18')]);router[_0x52dc('0x19')](_0x52dc('0xd'),auth[_0x52dc('0x9')](),controller[_0x52dc('0x1a')]);router[_0x52dc('0x19')](_0x52dc('0x15'),auth[_0x52dc('0x9')](),controller[_0x52dc('0x1b')]);module[_0x52dc('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 59511dc..a5436fd 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 _0x274a=['BOOLEAN','ENUM','star','TEXT','STRING','DATE','long','out','exports'];(function(_0x57041d,_0x3c34ad){var _0x5c5372=function(_0x248f05){while(--_0x248f05){_0x57041d['push'](_0x57041d['shift']());}};_0x5c5372(++_0x3c34ad);}(_0x274a,0x1ca));var _0xa274=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x274a[_0x264b9b];return _0x4c7a0e;};'use strict';var Sequelize=require('sequelize');module[_0xa274('0x0')]={'closed':{'type':Sequelize[_0xa274('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xa274('0x2')](_0xa274('0x3'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xa274('0x4')]},'pathTranscript':{'type':Sequelize[_0xa274('0x4')]},'mailTranscript':{'type':Sequelize[_0xa274('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa274('0x6')]},'disposition':{'type':Sequelize[_0xa274('0x5')]},'secondDisposition':{'type':Sequelize[_0xa274('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa274('0x5')]},'browserName':{'type':Sequelize[_0xa274('0x5')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xa274('0x5')]},'deviceModel':{'type':Sequelize[_0xa274('0x5')]},'deviceVendor':{'type':Sequelize[_0xa274('0x5')]},'deviceType':{'type':Sequelize[_0xa274('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xa274('0x5')]},'formData':{'type':Sequelize[_0xa274('0x4')](_0xa274('0x7'))},'read1stAt':{'type':Sequelize[_0xa274('0x6')]},'lastMsgAt':{'type':Sequelize[_0xa274('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa274('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa274('0x5')]},'customerPort':{'type':Sequelize[_0xa274('0x5')]},'vidaooSessionId':{'type':Sequelize[_0xa274('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xa274('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x225b=['TEXT','STRING','DATE','out','sequelize','exports','BOOLEAN','star','thumb'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x225b,0x13f));var _0xb225=function(_0x4ed8b0,_0x2301a2){_0x4ed8b0=_0x4ed8b0-0x0;var _0xdf6fc1=_0x225b[_0x4ed8b0];return _0xdf6fc1;};'use strict';var Sequelize=require(_0xb225('0x0'));module[_0xb225('0x1')]={'closed':{'type':Sequelize[_0xb225('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0xb225('0x3'),_0xb225('0x4')),'defaultValue':_0xb225('0x3')},'ratingMessage':{'type':Sequelize[_0xb225('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xb225('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb225('0x7')]},'disposition':{'type':Sequelize[_0xb225('0x6')]},'secondDisposition':{'type':Sequelize[_0xb225('0x6')]},'thirdDisposition':{'type':Sequelize[_0xb225('0x6')]},'note':{'type':Sequelize[_0xb225('0x6')]},'browserName':{'type':Sequelize[_0xb225('0x6')]},'browserVersion':{'type':Sequelize[_0xb225('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xb225('0x6')]},'deviceModel':{'type':Sequelize[_0xb225('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xb225('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xb225('0x6')]},'formData':{'type':Sequelize[_0xb225('0x5')]('long')},'read1stAt':{'type':Sequelize[_0xb225('0x7')]},'lastMsgAt':{'type':Sequelize[_0xb225('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb225('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 740d87e..40904f4 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 _0xbb9f=['sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','pick','options','includeAgent','push','addTags','setTags','spread','color','emit','chatInteractionTags:save','download','toString','server','files','tmp','attachments','CmContact','firstName','lastName','read','Account','Chat','Owner','N.A.','closedAt','browserName','customerIp','customerPort','existsSync','createReadStream','pipe','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../mysqldb','redis','localhost','register','client','http','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','send','render','merge','body','contact','agent','account','map','ChatInteraction','type','key','getOptions','user','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','find','create','describe','createVidaooSession','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','fullname','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','findOne','attachId','join','server/files/attachments/','offline-chat/','mailTranscript','root','server/files/chat/upload/','format','Messages','User','ChatWebsite','ContactId','%s%d','System','customer','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','hasOwnProperty','nolimit','order'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xbb9f,0x1c7));var _0xfbb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb9f[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0xfbb9('0x0'));var zipdir=require(_0xfbb9('0x1'));var rp=require(_0xfbb9('0x2'));var moment=require(_0xfbb9('0x3'));var BPromise=require(_0xfbb9('0x4'));var Mustache=require(_0xfbb9('0x5'));var util=require(_0xfbb9('0x6'));var path=require(_0xfbb9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfbb9('0x8'));var Redis=require(_0xfbb9('0x9'));var interaction=require(_0xfbb9('0xa'));var qs=require('../../components/parsers/qs');var pdf=require(_0xfbb9('0xb'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xfbb9('0xc'))['db'];config[_0xfbb9('0xd')]=_['defaults'](config[_0xfbb9('0xd')],{'host':_0xfbb9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbb9('0xd')]));require('./chatInteraction.socket')[_0xfbb9('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0xfbb9('0x10')][_0xfbb9('0x11')]({'port':0x232b});var client9004=jayson[_0xfbb9('0x10')][_0xfbb9('0x11')]({'port':0x232c});function respondWithRpcPromise(_0xcb9c56,_0x3f6753,_0x251484,_0x3505b2){return new BPromise(function(_0x4d44ef,_0xf3c4bd){var _0x4b65ac=_0x3505b2||client;return _0x4b65ac[_0xfbb9('0x12')](_0xcb9c56,_0x251484)['then'](function(_0x29f3a9){logger['info'](_0xfbb9('0x13'),_0x3f6753,_0xfbb9('0x14'));logger[_0xfbb9('0x15')](_0xfbb9('0x16'),_0x3f6753,_0xfbb9('0x14'),JSON[_0xfbb9('0x17')](_0x29f3a9));if(_0x29f3a9[_0xfbb9('0x18')]){if(_0x29f3a9[_0xfbb9('0x18')][_0xfbb9('0x19')]===0x1f4){logger[_0xfbb9('0x18')](_0xfbb9('0x13'),_0x3f6753,_0x29f3a9['error'][_0xfbb9('0x1a')]);return _0xf3c4bd(_0x29f3a9[_0xfbb9('0x18')]['message']);}logger[_0xfbb9('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x3f6753,_0x29f3a9['error'][_0xfbb9('0x1a')]);return _0x4d44ef(_0x29f3a9[_0xfbb9('0x18')][_0xfbb9('0x1a')]);}else{logger[_0xfbb9('0x1b')](_0xfbb9('0x13'),_0x3f6753,_0xfbb9('0x14'));_0x4d44ef(_0x29f3a9['result'][_0xfbb9('0x1a')]);}})[_0xfbb9('0x1c')](function(_0x15bc33){logger[_0xfbb9('0x18')](_0xfbb9('0x13'),_0x3f6753,_0x15bc33);_0xf3c4bd(_0x15bc33);});});}function respondWithStatusCode(_0x4aec49,_0x13f4df){_0x13f4df=_0x13f4df||0xcc;return function(_0x2ec282){if(_0x2ec282){return _0x4aec49[_0xfbb9('0x1d')](_0x13f4df);}return _0x4aec49[_0xfbb9('0x1e')](_0x13f4df)[_0xfbb9('0x1f')]();};}function respondWithResult(_0x46cc4e,_0x9ac921){_0x9ac921=_0x9ac921||0xc8;return function(_0x3c4b4c){if(_0x3c4b4c){return _0x46cc4e[_0xfbb9('0x1e')](_0x9ac921)[_0xfbb9('0x20')](_0x3c4b4c);}};}function respondWithFilteredResult(_0x48cb8f,_0x47e001){return function(_0x2cd645){if(_0x2cd645){var _0x349742=typeof _0x47e001[_0xfbb9('0x21')]===_0xfbb9('0x22')&&typeof _0x47e001[_0xfbb9('0x23')]===_0xfbb9('0x22');var _0xa9f413=_0x2cd645[_0xfbb9('0x24')];var _0x2862e6=_0x349742?0x0:_0x47e001[_0xfbb9('0x21')];var _0x33afdd=_0x349742?_0x2cd645[_0xfbb9('0x24')]:_0x47e001[_0xfbb9('0x21')]+_0x47e001[_0xfbb9('0x23')];var _0x4fb1a1;if(_0x33afdd>=_0xa9f413){_0x33afdd=_0xa9f413;_0x4fb1a1=0xc8;}else{_0x4fb1a1=0xce;}_0x48cb8f[_0xfbb9('0x1e')](_0x4fb1a1);return _0x48cb8f[_0xfbb9('0x25')](_0xfbb9('0x26'),_0x2862e6+'-'+_0x33afdd+'/'+_0xa9f413)[_0xfbb9('0x20')](_0x2cd645);}return null;};}function saveUpdates(_0x3d99fe){return function(_0x7bfe73){if(_0x7bfe73){return _0x7bfe73[_0xfbb9('0x27')](_0x3d99fe)[_0xfbb9('0x28')](function(_0x2a9ce1){return _0x2a9ce1;});}return null;};}function removeEntity(_0x1183c6){return function(_0x1f9901){if(_0x1f9901){return _0x1f9901[_0xfbb9('0x29')]()[_0xfbb9('0x28')](function(){_0x1183c6[_0xfbb9('0x1e')](0xcc)[_0xfbb9('0x1f')]();});}};}function handleEntityNotFound(_0x30d3cd){return function(_0x3ebb43){if(!_0x3ebb43){_0x30d3cd[_0xfbb9('0x1d')](0x194);}return _0x3ebb43;};}function handleError(_0xf1164e,_0x1ef65b){_0x1ef65b=_0x1ef65b||0x1f4;return function(_0xf49d08){logger[_0xfbb9('0x18')](_0xf49d08[_0xfbb9('0x2a')]);if(_0xf49d08[_0xfbb9('0x2b')]){delete _0xf49d08[_0xfbb9('0x2b')];}_0xf1164e['status'](_0x1ef65b)[_0xfbb9('0x2c')](_0xf49d08);};}function getMustacheRender(_0x486372,_0x3c2da6){return Mustache[_0xfbb9('0x2d')](_0x486372,_[_0xfbb9('0x2e')](_0x3c2da6[_0xfbb9('0x2f')],{'contact':_0x3c2da6[_0xfbb9('0x30')],'message':_0x3c2da6[_0xfbb9('0x1a')],'agent':_0x3c2da6[_0xfbb9('0x31')],'interaction':_0x3c2da6['interaction'],'account':_0x3c2da6[_0xfbb9('0x32')]}))||'';}exports['index']=function(_0x4f2c4b,_0x2188dc){var _0x139689={};var _0x440cd3=_[_0xfbb9('0x33')](db[_0xfbb9('0x34')]['rawAttributes'],function(_0x271a5e){return{'name':_0x271a5e['fieldName'],'type':_0x271a5e[_0xfbb9('0x35')][_0xfbb9('0x36')]};});_0x139689=qs[_0xfbb9('0x37')](_0x440cd3,_0x4f2c4b);return interaction['findAll']('chat',_0x4f2c4b['query'],_0x4f2c4b[_0xfbb9('0x38')],_0x139689,_0x440cd3)[_0xfbb9('0x28')](respondWithFilteredResult(_0x2188dc,_0x139689))[_0xfbb9('0x1c')](handleError(_0x2188dc,null));};exports[_0xfbb9('0x39')]=function(_0x8d9af3,_0x2cd18e){var _0x5b6dc6={'raw':![],'where':{'id':_0x8d9af3[_0xfbb9('0x3a')]['id']}},_0x554e8b={};_0x554e8b[_0xfbb9('0x3b')]=_['keys'](db[_0xfbb9('0x34')][_0xfbb9('0x3c')]);_0x554e8b[_0xfbb9('0x3d')]=_[_0xfbb9('0x3e')](_0x8d9af3['query']);_0x554e8b[_0xfbb9('0x3f')]=_[_0xfbb9('0x40')](_0x554e8b[_0xfbb9('0x3b')],_0x554e8b['query']);_0x5b6dc6[_0xfbb9('0x41')]=_[_0xfbb9('0x40')](_0x554e8b['model'],qs[_0xfbb9('0x42')](_0x8d9af3['query']['fields']));_0x5b6dc6['attributes']=_0x5b6dc6[_0xfbb9('0x41')][_0xfbb9('0x43')]?_0x5b6dc6[_0xfbb9('0x41')]:_0x554e8b['model'];if(_0x8d9af3[_0xfbb9('0x3d')][_0xfbb9('0x44')]){_0x5b6dc6[_0xfbb9('0x45')]=[{'all':!![]}];}_0x5b6dc6=_[_0xfbb9('0x2e')]({},_0x5b6dc6,_0x8d9af3['options']);return db[_0xfbb9('0x34')][_0xfbb9('0x46')](_0x5b6dc6)[_0xfbb9('0x28')](handleEntityNotFound(_0x2cd18e,null))[_0xfbb9('0x28')](respondWithResult(_0x2cd18e,null))['catch'](handleError(_0x2cd18e,null));};exports[_0xfbb9('0x47')]=function(_0x533ae4,_0x377a9b){return db[_0xfbb9('0x34')][_0xfbb9('0x47')](_0x533ae4[_0xfbb9('0x2f')],{})[_0xfbb9('0x28')](respondWithResult(_0x377a9b,0xc9))[_0xfbb9('0x1c')](handleError(_0x377a9b,null));};exports[_0xfbb9('0x27')]=function(_0x5c51e3,_0x880b10){if(_0x5c51e3[_0xfbb9('0x2f')]['id']){delete _0x5c51e3['body']['id'];}return db[_0xfbb9('0x34')][_0xfbb9('0x46')]({'where':{'id':_0x5c51e3['params']['id']}})[_0xfbb9('0x28')](handleEntityNotFound(_0x880b10,null))[_0xfbb9('0x28')](saveUpdates(_0x5c51e3[_0xfbb9('0x2f')],null))['then'](respondWithResult(_0x880b10,null))[_0xfbb9('0x1c')](handleError(_0x880b10,null));};exports[_0xfbb9('0x29')]=function(_0x38d7db,_0x29f113){return db[_0xfbb9('0x34')][_0xfbb9('0x46')]({'where':{'id':_0x38d7db[_0xfbb9('0x3a')]['id']}})[_0xfbb9('0x28')](handleEntityNotFound(_0x29f113,null))['then'](removeEntity(_0x29f113,null))[_0xfbb9('0x1c')](handleError(_0x29f113,null));};exports[_0xfbb9('0x48')]=function(_0x942455,_0x8166d7){return db[_0xfbb9('0x34')][_0xfbb9('0x48')]()[_0xfbb9('0x28')](respondWithResult(_0x8166d7,null))['catch'](handleError(_0x8166d7,null));};exports[_0xfbb9('0x49')]=function(_0x373233,_0x39a177){var _0x776d87=_0x373233[_0xfbb9('0x3a')]['id'];var _0x114811;var _0x12a3ab;var _0x1d843e;return db[_0xfbb9('0x34')]['findOne']({'where':{'id':_0x776d87}})['then'](function(_0x1e5e2c){_0x114811=_0x1e5e2c;return db['ChatWebsite']['findOne']({'where':{'id':_0x1e5e2c[_0xfbb9('0x4a')]},'attributes':['id',_0xfbb9('0x4b'),_0xfbb9('0x4c'),_0xfbb9('0x4d'),'vidaooNote',_0xfbb9('0x4e')],'raw':!![]});})[_0xfbb9('0x28')](function(_0x533d37){if(_0x533d37&&_0x533d37['vidaooApiKey']&&_0x533d37['vidaooEscalation']){_0x12a3ab=_0x533d37;var _0x1de93c={'interaction':{'id':_0x776d87},'agent':{'id':_0x373233[_0xfbb9('0x38')]['id'],'name':_0x373233[_0xfbb9('0x38')][_0xfbb9('0x2b')],'fullname':_0x373233['user'][_0xfbb9('0x4f')],'email':_0x373233['user']['email']},'contact':_0x373233['body'][_0xfbb9('0x30')],'account':_0x373233[_0xfbb9('0x2f')][_0xfbb9('0x32')]};var _0x1f5b71={'rejectUnauthorized':![],'method':'POST','url':_0xfbb9('0x50'),'headers':{'X-APIKEY':_0x533d37['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x373233['user']['email']],'buttons':null,'topic':_0x12a3ab['vidaooTopic'],'note':_[_0xfbb9('0x51')](_0x12a3ab[_0xfbb9('0x52')])?null:getMustacheRender(_0x12a3ab[_0xfbb9('0x52')],_0x1de93c),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x12a3ab[_0xfbb9('0x4e')])){var _0x137c61=getMustacheRender(_0x12a3ab['vidaooMetadata'],_0x1de93c);var _0x499eac=JSON[_0xfbb9('0x53')](_0x137c61);_0x1f5b71[_0xfbb9('0x2f')][_0xfbb9('0x54')]=_0x499eac;}}catch(_0x3142f1){throw new db[(_0xfbb9('0x55'))]['ValidationError'](_0xfbb9('0x56'));}return rp(_0x1f5b71);}else{throw new db[(_0xfbb9('0x55'))][(_0xfbb9('0x57'))](_0xfbb9('0x58'));}})['then'](function(_0x53c925){_0x1d843e=_0x53c925;if(_0x1d843e['id']){var _0x1c6fab={'body':_0x1d843e['join_url'],'ChatWebsiteId':_0x12a3ab['id'],'ChatInteractionId':_0x114811['id'],'direction':_0xfbb9('0x59'),'UserId':_0x373233['user']['id']};return db[_0xfbb9('0x5a')]['create'](_0x1c6fab,{});}else{throw new db['Sequelize'][(_0xfbb9('0x57'))](_0xfbb9('0x5b'));}})[_0xfbb9('0x28')](function(){return _0x114811[_0xfbb9('0x5c')]({'vidaooSessionId':_0x1d843e['id']});})[_0xfbb9('0x28')](respondWithResult(_0x39a177,null))[_0xfbb9('0x1c')](handleError(_0x39a177,null));};exports[_0xfbb9('0x5d')]=function(_0x379c46,_0x104dfb){if(_0x379c46[_0xfbb9('0x2f')]['id']){delete _0x379c46['body']['id'];}return db['ChatInteraction'][_0xfbb9('0x46')]({'where':{'id':_0x379c46[_0xfbb9('0x3a')]['id']},'include':[{'model':db['CmContact'],'as':_0xfbb9('0x5e')}]})[_0xfbb9('0x28')](handleEntityNotFound(_0x104dfb,null))[_0xfbb9('0x28')](saveUpdates(_0x379c46['body'],null))[_0xfbb9('0x28')](respondWithResult(_0x104dfb,null))[_0xfbb9('0x1c')](handleError(_0x104dfb,null));};exports[_0xfbb9('0x5f')]=function(_0x37adea,_0x3e5626){if(_0x37adea[_0xfbb9('0x2f')]['id']){delete _0x37adea[_0xfbb9('0x2f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x37adea[_0xfbb9('0x3a')]['id']}})['then'](function(_0x1b5a48){if(!_0x1b5a48){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xfbb9('0x5f'),0x194,_0xfbb9('0x60'));_0x3e5626[_0xfbb9('0x1d')](0x194);}else{if(_0x1b5a48[_0xfbb9('0x61')]){throw new db[(_0xfbb9('0x55'))][(_0xfbb9('0x57'))](_0xfbb9('0x62'));}}return _0x1b5a48;})[_0xfbb9('0x28')](function(_0x8f4d90){if(_0x8f4d90){return _0x8f4d90[_0xfbb9('0x27')]({'closed':_0x37adea[_0xfbb9('0x2f')]['closed'],'disposition':_0x37adea[_0xfbb9('0x2f')][_0xfbb9('0x63')]})[_0xfbb9('0x28')](function(_0x207f6f){return _0x207f6f;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0xfbb9('0x5f'),_0x37adea[_0xfbb9('0x2f')],client9004);})['then'](respondWithResult(_0x3e5626,null))[_0xfbb9('0x1c')](handleError(_0x3e5626,null));};exports['attachmentUpload']=function(_0x36bcf0,_0xa565de){_0x36bcf0[_0xfbb9('0x2f')][_0xfbb9('0x2b')]=_0x36bcf0[_0xfbb9('0x64')][_0xfbb9('0x65')];_0x36bcf0[_0xfbb9('0x2f')][_0xfbb9('0x66')]=_0x36bcf0[_0xfbb9('0x64')][_0xfbb9('0x67')];_0x36bcf0[_0xfbb9('0x2f')]['type']=_0x36bcf0['file'][_0xfbb9('0x68')];return db[_0xfbb9('0x69')]['create'](_0x36bcf0[_0xfbb9('0x2f')])[_0xfbb9('0x28')](respondWithResult(_0xa565de,0xc9))[_0xfbb9('0x1c')](handleError(_0xa565de,null));};exports[_0xfbb9('0x6a')]=function(_0x102b50,_0x337c64){return db['ChatInteraction']['findOne']({'where':{'id':_0x102b50['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x337c64,null))[_0xfbb9('0x28')](function(_0x139c7d){if(_0x139c7d){if(_0x139c7d[_0xfbb9('0x6b')]){return _0x337c64[_0xfbb9('0x1e')](0x193)[_0xfbb9('0x20')]({'status':0x193,'message':_0xfbb9('0x6c')});}return db[_0xfbb9('0x69')][_0xfbb9('0x6d')]({'where':{'id':_0x102b50[_0xfbb9('0x3d')][_0xfbb9('0x6e')]},'raw':!![]})[_0xfbb9('0x28')](handleEntityNotFound(_0x337c64,null));}})[_0xfbb9('0x28')](function(_0x26ac6c){if(_0x26ac6c){var _0x2e98c4=_0x26ac6c['ChatOfflineMessageId']!==null;var _0x58c861=path[_0xfbb9('0x6f')](config['root'],_0xfbb9('0x70'));if(_0x2e98c4){_0x58c861=path[_0xfbb9('0x6f')](_0x58c861,_0xfbb9('0x71'));}var _0x335d27=path[_0xfbb9('0x6f')](_0x58c861,_0x26ac6c[_0xfbb9('0x66')]);return _0x337c64['download'](_0x335d27);}})[_0xfbb9('0x1c')](handleError(_0x337c64,null));};exports['close']=function(_0x4b8ef1,_0x13c42f){var _0x11baaa=null;var _0x364128=null;var _0x20d69f=null;if(_0x4b8ef1[_0xfbb9('0x2f')]['id']){delete _0x4b8ef1[_0xfbb9('0x2f')]['id'];}if(_0x4b8ef1['body'][_0xfbb9('0x72')]){_0x20d69f=path['join'](config[_0xfbb9('0x73')],_0xfbb9('0x74'),util[_0xfbb9('0x75')]('transcript-%s.txt',Date['now']()));_0x4b8ef1['body']['pathTranscript']=_0x20d69f;}return db['ChatInteraction'][_0xfbb9('0x46')]({'where':{'id':_0x4b8ef1[_0xfbb9('0x3a')]['id']},'include':[{'model':db[_0xfbb9('0x5a')],'as':_0xfbb9('0x76'),'include':[{'model':db[_0xfbb9('0x77')],'as':'User'}]}]})[_0xfbb9('0x28')](handleEntityNotFound(_0x13c42f,null))['then'](saveUpdates(_0x4b8ef1['body'],null))[_0xfbb9('0x28')](function(_0x2dce65){if(_0x2dce65){_0x11baaa=_0x2dce65;return db[_0xfbb9('0x78')][_0xfbb9('0x46')]({'where':{'id':_0x11baaa[_0xfbb9('0x4a')]}});}})[_0xfbb9('0x28')](function(_0x4e539e){if(_0x4e539e){_0x364128=_0x4e539e;return db['CmContact'][_0xfbb9('0x46')]({'where':{'id':_0x11baaa[_0xfbb9('0x79')]}});}})['then'](function(_0x43efba){if(_0x43efba){if(_0x20d69f){var _0xaabb3f=null;for(var _0x483b9d=0x1;_0x483b9d<_0x11baaa['Messages'][_0xfbb9('0x43')];++_0x483b9d){_0xaabb3f=_0x11baaa['Messages'][_0x483b9d];var _0x57d701=_0xaabb3f[_0xfbb9('0x61')]?util[_0xfbb9('0x75')](_0xfbb9('0x7a'),_0x364128['agentAlias'],_0xaabb3f['UserId']):_0xfbb9('0x7b');var _0x47074d=_0x4b8ef1[_0xfbb9('0x2f')][_0xfbb9('0x7c')]||util[_0xfbb9('0x75')]('%s%d','Visitor',_0xaabb3f[_0xfbb9('0x79')]);switch(_0x364128[_0xfbb9('0x7d')]){case _0xfbb9('0x7e'):_0x57d701=_0xaabb3f[_0xfbb9('0x61')]?util['format'](_0xfbb9('0x7a'),_0x364128[_0xfbb9('0x7f')],_0xaabb3f[_0xfbb9('0x61')]):_0xfbb9('0x7b');break;case _0xfbb9('0x80'):_0x57d701=_0xaabb3f[_0xfbb9('0x61')]?_0xaabb3f['User'][_0xfbb9('0x81')]||_0xaabb3f[_0xfbb9('0x77')][_0xfbb9('0x4f')]:_0xfbb9('0x7b');break;case _0xfbb9('0x82'):_0x57d701=_0xaabb3f[_0xfbb9('0x61')]?_0xaabb3f[_0xfbb9('0x77')][_0xfbb9('0x4f')]:_0xfbb9('0x7b');break;default:_0x57d701=_0xaabb3f[_0xfbb9('0x61')]?util['format'](_0xfbb9('0x7a'),_0x364128['agentAlias'],_0xaabb3f['UserId']):_0xfbb9('0x7b');}var _0x12e6b8=util[_0xfbb9('0x75')](_0xfbb9('0x83'),moment(_0xaabb3f[_0xfbb9('0x84')])[_0xfbb9('0x75')](_0xfbb9('0x85')),_0xaabb3f[_0xfbb9('0x86')]==='in'?_0x47074d:_0x57d701,_0xaabb3f[_0xfbb9('0x2f')]);if(!_0xaabb3f[_0xfbb9('0x87')]){fs[_0xfbb9('0x88')](_0x20d69f,_0x12e6b8);}}return db[_0xfbb9('0x89')][_0xfbb9('0x6d')]({'where':{'service':!![]},'include':[{'model':db[_0xfbb9('0x8a')],'as':_0xfbb9('0x8b'),'raw':!![],'include':[{'model':db[_0xfbb9('0x8c')],'as':_0xfbb9('0x8c'),'raw':!![]}]}]});}}})[_0xfbb9('0x28')](function(_0x3b58e3){if(!_0x3b58e3||!_0x3b58e3[_0xfbb9('0x8b')]||!_0x4b8ef1[_0xfbb9('0x2f')])return _0x11baaa;var _0x223d4a=_0x3b58e3[_0xfbb9('0x8d')]();return respondWithRpcPromise(_0xfbb9('0x8e'),_0xfbb9('0x8f'),{'account':_0x223d4a,'message':{'from':util['format'](_0xfbb9('0x90'),_0x3b58e3['name'],_0x3b58e3[_0xfbb9('0x91')]||_0x3b58e3[_0xfbb9('0x8b')][_0xfbb9('0x38')]),'to':_0x4b8ef1[_0xfbb9('0x2f')][_0xfbb9('0x72')],'subject':_0xfbb9('0x92'),'text':util[_0xfbb9('0x75')](_0xfbb9('0x93'),_0x4b8ef1[_0xfbb9('0x2f')]['mailTranscript']),'attachments':[{'path':_0x20d69f}]}})['then'](function(){return _0x11baaa;})['catch'](function(_0x3475d2){logger[_0xfbb9('0x18')](_0x3475d2);});})['then'](respondWithStatusCode(_0x13c42f,0xc8))['catch'](handleError(_0x13c42f,null));};exports[_0xfbb9('0x94')]=function(_0x500578,_0x18cd0e){return db['ChatMessage'][_0xfbb9('0x46')]({'where':{'id':_0x500578[_0xfbb9('0x3a')]['id']}})['then'](handleEntityNotFound(_0x18cd0e,null))[_0xfbb9('0x28')](function(_0x411bd8){if(_0x411bd8){return _0x411bd8[_0xfbb9('0x94')](_0x500578[_0xfbb9('0x2f')][_0xfbb9('0x95')],_[_0xfbb9('0x96')](_0x500578[_0xfbb9('0x2f')],[_0xfbb9('0x95'),'id'])||{});}})[_0xfbb9('0x28')](respondWithResult(_0x18cd0e,null))[_0xfbb9('0x1c')](handleError(_0x18cd0e,null));};exports['getMessages']=function(_0x3efac8,_0x188ce1){var _0x40aada={'raw':![],'where':{}};var _0x362b57={};var _0x680500={'count':0x0,'rows':[]};return db[_0xfbb9('0x34')][_0xfbb9('0x6d')]({'where':{'id':_0x3efac8[_0xfbb9('0x3a')]['id']}})[_0xfbb9('0x28')](handleEntityNotFound(_0x188ce1,null))[_0xfbb9('0x28')](function(_0x4ed886){if(_0x4ed886){_0x362b57[_0xfbb9('0x3b')]=_[_0xfbb9('0x3e')](db['ChatMessage'][_0xfbb9('0x3c')]);_0x362b57['query']=_[_0xfbb9('0x3e')](_0x3efac8['query']);_0x362b57[_0xfbb9('0x3f')]=_[_0xfbb9('0x40')](_0x362b57[_0xfbb9('0x3b')],_0x362b57[_0xfbb9('0x3d')]);_0x40aada[_0xfbb9('0x41')]=_['intersection'](_0x362b57[_0xfbb9('0x3b')],qs[_0xfbb9('0x42')](_0x3efac8['query'][_0xfbb9('0x42')]));_0x40aada[_0xfbb9('0x41')]=_0x40aada[_0xfbb9('0x41')][_0xfbb9('0x43')]?_0x40aada[_0xfbb9('0x41')]:_0x362b57[_0xfbb9('0x3b')];if(!_0x3efac8['query'][_0xfbb9('0x97')](_0xfbb9('0x98'))){_0x40aada[_0xfbb9('0x23')]=qs[_0xfbb9('0x23')](_0x3efac8[_0xfbb9('0x3d')][_0xfbb9('0x23')]);_0x40aada[_0xfbb9('0x21')]=qs[_0xfbb9('0x21')](_0x3efac8[_0xfbb9('0x3d')]['offset']);}_0x40aada[_0xfbb9('0x99')]=qs[_0xfbb9('0x9a')](_0x3efac8[_0xfbb9('0x3d')]['sort']);_0x40aada[_0xfbb9('0x9b')]=qs[_0xfbb9('0x3f')](_['pick'](_0x3efac8[_0xfbb9('0x3d')],_0x362b57[_0xfbb9('0x3f')]));_0x40aada[_0xfbb9('0x9b')][_0xfbb9('0x9c')]=_0x4ed886['id'];if(_0x3efac8[_0xfbb9('0x3d')][_0xfbb9('0x9d')]){_0x40aada[_0xfbb9('0x9b')]=_[_0xfbb9('0x2e')](_0x40aada['where'],{'$or':_['map'](_0x40aada[_0xfbb9('0x41')],function(_0x45a37d){var _0x453c74={};_0x453c74[_0x45a37d]={'$like':'%'+_0x3efac8[_0xfbb9('0x3d')][_0xfbb9('0x9d')]+'%'};return _0x453c74;})});}if(_0x3efac8[_0xfbb9('0x3d')][_0xfbb9('0x9e')]){var _0x3500cd=_0x3efac8[_0xfbb9('0x3d')][_0xfbb9('0x9e')][_0xfbb9('0x9f')](',');var _0x3c3104={};_0x3c3104[_0x3500cd[0x0]]={'$gte':moment(_0x3500cd[0x1])[_0xfbb9('0x75')](_0xfbb9('0xa0'))};_0x40aada[_0xfbb9('0x9b')]=_[_0xfbb9('0x2e')](_0x40aada['where'],_0x3c3104);}_0x40aada=_[_0xfbb9('0x2e')]({},_0x40aada,_0x3efac8['options']);return db[_0xfbb9('0x5a')][_0xfbb9('0x24')]({'where':_0x40aada[_0xfbb9('0x9b')]})[_0xfbb9('0x28')](function(_0x5c411c){_0x680500[_0xfbb9('0x24')]=_0x5c411c;if(_0x3efac8[_0xfbb9('0x3d')][_0xfbb9('0x44')]){_0x40aada['include']=[{'all':!![]}];}return db[_0xfbb9('0x5a')][_0xfbb9('0xa1')](_0x40aada);})['then'](function(_0x708c84){_0x680500[_0xfbb9('0xa2')]=_0x708c84;return _0x680500;});}})[_0xfbb9('0x28')](respondWithFilteredResult(_0x188ce1,_0x40aada))[_0xfbb9('0x1c')](handleError(_0x188ce1,null));};exports[_0xfbb9('0xa3')]=function(_0x1b7a3f,_0x314296){var _0x2a8976={'where':{}},_0x344def={},_0x441631={'count':0x0,'rows':[]};return db[_0xfbb9('0x34')][_0xfbb9('0x6d')]({'where':{'id':_0x1b7a3f[_0xfbb9('0x3a')]['id']}})['then'](handleEntityNotFound(_0x314296,null))[_0xfbb9('0x28')](function(_0x2ffeb7){if(_0x2ffeb7){_0x344def['model']=_['keys'](db[_0xfbb9('0x5a')]['rawAttributes']);_0x344def[_0xfbb9('0x3d')]=_['keys'](_0x1b7a3f['query']);_0x344def[_0xfbb9('0x3f')]=_[_0xfbb9('0x40')](_0x344def[_0xfbb9('0x3b')],_0x344def['query']);_0x2a8976[_0xfbb9('0x41')]=_['intersection'](_0x344def[_0xfbb9('0x3b')],qs[_0xfbb9('0x42')](_0x1b7a3f['query'][_0xfbb9('0x42')]));_0x2a8976[_0xfbb9('0x41')]=_0x2a8976['attributes'][_0xfbb9('0x43')]?_0x2a8976[_0xfbb9('0x41')]:_0x344def[_0xfbb9('0x3b')];if(!_0x1b7a3f[_0xfbb9('0x3d')][_0xfbb9('0x97')](_0xfbb9('0x98'))){_0x2a8976[_0xfbb9('0x23')]=qs['limit'](_0x1b7a3f['query']['limit']);_0x2a8976[_0xfbb9('0x21')]=qs[_0xfbb9('0x21')](_0x1b7a3f[_0xfbb9('0x3d')][_0xfbb9('0x21')]);}_0x2a8976[_0xfbb9('0x99')]=qs[_0xfbb9('0x9a')](_0x1b7a3f[_0xfbb9('0x3d')][_0xfbb9('0x9a')]);_0x2a8976['where']=qs[_0xfbb9('0x3f')](_[_0xfbb9('0xa4')](_0x1b7a3f[_0xfbb9('0x3d')],_0x344def[_0xfbb9('0x3f')]));_0x2a8976[_0xfbb9('0x9b')][_0xfbb9('0x9c')]=_0x2ffeb7['id'];if(_0x1b7a3f[_0xfbb9('0x3d')][_0xfbb9('0x9d')]){_0x2a8976[_0xfbb9('0x9b')]=_[_0xfbb9('0x2e')](_0x2a8976[_0xfbb9('0x9b')],{'$or':_[_0xfbb9('0x33')](_0x2a8976[_0xfbb9('0x41')],function(_0x358c57){var _0x20a755={};_0x20a755[_0x358c57]={'$like':'%'+_0x1b7a3f[_0xfbb9('0x3d')][_0xfbb9('0x9d')]+'%'};return _0x20a755;})});}_0x2a8976[_0xfbb9('0x9b')][_0xfbb9('0x87')]=![];if(_0x1b7a3f[_0xfbb9('0x3d')]['id']){_0x2a8976['where']['id']={'$gt':_0x1b7a3f['query']['id']};}_0x2a8976=_['merge']({},_0x2a8976,_0x1b7a3f[_0xfbb9('0xa5')]);return db[_0xfbb9('0x5a')][_0xfbb9('0x24')]({'where':_0x2a8976[_0xfbb9('0x9b')]})[_0xfbb9('0x28')](function(_0x28ed93){_0x441631[_0xfbb9('0x24')]=_0x28ed93;_0x2a8976[_0xfbb9('0x45')]=[];if(_0x1b7a3f[_0xfbb9('0x3d')][_0xfbb9('0xa6')]){_0x2a8976['include'][_0xfbb9('0xa7')]({'model':db[_0xfbb9('0x77')],'as':'User','attributes':['id',_0xfbb9('0x4f'),_0xfbb9('0x81')]});}if(_0x1b7a3f['query']['includeAll']){_0x2a8976[_0xfbb9('0x45')]=[{'all':!![]}];}return db[_0xfbb9('0x5a')]['findAll'](_0x2a8976);})['then'](function(_0x14f55e){_0x441631[_0xfbb9('0xa2')]=_0x14f55e;return _0x441631;});}})['then'](respondWithFilteredResult(_0x314296,_0x2a8976))[_0xfbb9('0x1c')](handleError(_0x314296,null));};exports[_0xfbb9('0xa8')]=function(_0x4b76d1,_0x540706){return db[_0xfbb9('0x34')][_0xfbb9('0x46')]({'where':{'id':_0x4b76d1[_0xfbb9('0x3a')]['id']}})[_0xfbb9('0x28')](handleEntityNotFound(_0x540706,null))[_0xfbb9('0x28')](function(_0x877837){if(_0x877837){return _0x877837[_0xfbb9('0xa9')](_0x4b76d1[_0xfbb9('0x2f')][_0xfbb9('0x95')],_['omit'](_0x4b76d1[_0xfbb9('0x2f')],[_0xfbb9('0x95'),'id'])||{})[_0xfbb9('0xaa')](function(){return db['Tag'][_0xfbb9('0xa1')]({'attributes':['id',_0xfbb9('0x2b'),_0xfbb9('0xab')],'where':{'id':_0x4b76d1[_0xfbb9('0x2f')][_0xfbb9('0x95')]}});})[_0xfbb9('0x28')](function(_0x1efde0){socket[_0xfbb9('0xac')](_0xfbb9('0xad'),{'id':Number(_0x4b76d1['params']['id']),'tags':_0x1efde0||[]});return{'id':Number(_0x4b76d1[_0xfbb9('0x3a')]['id']),'tags':_0x1efde0||[]};});}})[_0xfbb9('0x28')](respondWithResult(_0x540706,null))[_0xfbb9('0x1c')](handleError(_0x540706,null));};exports['removeTags']=function(_0x469b24,_0x449e5f){return db[_0xfbb9('0x34')]['find']({'where':{'id':_0x469b24[_0xfbb9('0x3a')]['id']}})['then'](handleEntityNotFound(_0x449e5f,null))['then'](function(_0x1e1332){if(_0x1e1332){return _0x1e1332['removeTags'](_0x469b24[_0xfbb9('0x3d')]['ids']);}})[_0xfbb9('0x28')](respondWithStatusCode(_0x449e5f,null))['catch'](handleError(_0x449e5f,null));};exports[_0xfbb9('0xae')]=function(_0x5d09ba,_0xae875b){var _0x21c908=moment()['unix']()[_0xfbb9('0xaf')]();var _0x4ebb17=path[_0xfbb9('0x6f')](config[_0xfbb9('0x73')],_0xfbb9('0xb0'),_0xfbb9('0xb1'),_0xfbb9('0xb2'));var _0x5c7e0a=path[_0xfbb9('0x6f')](config['root'],_0xfbb9('0xb0'),_0xfbb9('0xb1'),_0xfbb9('0xb3'));var _0x5e11e3=path['join'](_0x4ebb17,_0x21c908);var _0x409a4c=util[_0xfbb9('0x75')]('transcript-%d-%s.zip',_0x5d09ba[_0xfbb9('0x3a')]['id'],_0x21c908);var _0x39c35d=path['join'](_0x4ebb17,_0x409a4c);var _0x36deaf=[];_0x36deaf[_0xfbb9('0xa7')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x36deaf[_0xfbb9('0xa7')]({'model':db[_0xfbb9('0xb4')],'as':'Contact','attributes':['id',_0xfbb9('0xb5'),_0xfbb9('0xb6')],'raw':!![]});if(_0x5d09ba[_0xfbb9('0x3d')]['attachments']){_0x36deaf[_0xfbb9('0xa7')]({'model':db[_0xfbb9('0x69')],'as':_0xfbb9('0x69'),'raw':!![]});}var _0x494da5=[{'model':db['ChatMessage'],'as':_0xfbb9('0x76'),'attributes':['id',_0xfbb9('0x2f'),_0xfbb9('0x84'),_0xfbb9('0x86'),'secret',_0xfbb9('0xb7')],'include':_0x36deaf}];_0x494da5[_0xfbb9('0xa7')]({'model':db['ChatWebsite'],'as':_0xfbb9('0xb8'),'attributes':['id',_0xfbb9('0x2b')]});_0x494da5[_0xfbb9('0xa7')]({'model':db[_0xfbb9('0x77')],'as':'Owner','attributes':['id',_0xfbb9('0x4f')]});return db[_0xfbb9('0x34')][_0xfbb9('0x46')]({'where':{'id':_0x5d09ba[_0xfbb9('0x3a')]['id']},'include':_0x494da5})[_0xfbb9('0x28')](handleEntityNotFound(_0xae875b,null))[_0xfbb9('0x28')](function(_0x523051){if(_0x523051){var _0x57141b=_0x523051['get']({'plain':!![]});fs['mkdirSync'](_0x5e11e3);var _0x28fdc2={'channel':_0xfbb9('0xb9'),'account':_0x57141b['Account']['name'],'agent':_0x57141b['Owner']?_0x57141b[_0xfbb9('0xba')]['fullname']:_0xfbb9('0xbb'),'createdAt':moment(_0x57141b['createdAt'])[_0xfbb9('0x75')](_0xfbb9('0xa0'))[_0xfbb9('0xaf')](),'closedAt':_0x57141b[_0xfbb9('0x6b')]?moment(_0x57141b[_0xfbb9('0xbc')])[_0xfbb9('0x75')](_0xfbb9('0xa0'))[_0xfbb9('0xaf')]():'','disposition':_0x57141b[_0xfbb9('0x63')],'chatInfo':{'browser':_0x57141b[_0xfbb9('0xbd')],'os':_0x57141b['osName'],'referer':_0x57141b['referer'],'customerIp':_0x57141b[_0xfbb9('0xbe')],'customerPort':_0x57141b[_0xfbb9('0xbf')]?_0x57141b[_0xfbb9('0xbf')]:'N.A.'},'messages':_(_0x57141b[_0xfbb9('0x76')])['tail']()[_0xfbb9('0x9d')]({'secret':![]})['map'](function(_0x28c870){if(_0x28c870[_0xfbb9('0x69')]){var _0x214696=path[_0xfbb9('0x6f')](_0x5c7e0a,_0x28c870[_0xfbb9('0x69')][_0xfbb9('0x66')]);if(fs[_0xfbb9('0xc0')](_0x214696)){fs[_0xfbb9('0xc1')](_0x214696)[_0xfbb9('0xc2')](fs['createWriteStream'](path['join'](_0x5e11e3,_0x28c870[_0xfbb9('0x69')]['basename'])));}}return{'date':moment(_0x28c870[_0xfbb9('0x84')])[_0xfbb9('0x75')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfbb9('0xaf')](),'sender':_0x28c870['direction']===_0xfbb9('0x59')?_0x28c870['User']?_0x28c870[_0xfbb9('0x77')][_0xfbb9('0x4f')]:_0xfbb9('0x7b'):_0x28c870[_0xfbb9('0x5e')][_0xfbb9('0xb5')]+(_0x28c870[_0xfbb9('0x5e')][_0xfbb9('0xb6')]?'\x20'+_0x28c870[_0xfbb9('0x5e')][_0xfbb9('0xb6')]:''),'body':_0x28c870['Attachment']?_0x28c870[_0xfbb9('0x69')][_0xfbb9('0x66')]:_0x28c870[_0xfbb9('0x2f')],'direction':_0x28c870['direction']===_0xfbb9('0x59')?'A':'C','secret':_0x28c870[_0xfbb9('0x87')],'read':_0x28c870[_0xfbb9('0xb7')],'attachment':_0x28c870[_0xfbb9('0x69')]};})[_0xfbb9('0xc3')]()};return ejs[_0xfbb9('0xc4')](path[_0xfbb9('0x6f')](config['root'],'server',_0xfbb9('0xc5'),_0xfbb9('0xc6')),{'interaction':_0x28fdc2})[_0xfbb9('0x28')](function(_0x811392){var _0x4ae59c=path[_0xfbb9('0x6f')](_0x5e11e3,'transcript-'+_0x57141b['id']+'-'+_0x21c908+_0xfbb9('0xc7'));var _0x399b9a={'path':_0x4ae59c,'channel':'Chat','interactionId':_0x57141b['id']};return pdf[_0xfbb9('0xc8')](_0x811392,_0x399b9a);})['then'](function(){return new Promise(function(_0x4cecde,_0x4a3114){zipdir(_0x5e11e3,{'saveTo':_0x39c35d},function(_0x106737,_0x5dbe3c){if(_0x106737)return _0x4a3114(_0x106737);return _0x4cecde(_0x5dbe3c);});})[_0xfbb9('0x28')](function(){return new BPromise(function(_0x53208e,_0x256f6c){rimraf(_0x5e11e3,function(_0x2dbd34){if(_0x2dbd34)_0x256f6c(_0x2dbd34);return _0x53208e();});});})[_0xfbb9('0x28')](function(){return _0xae875b[_0xfbb9('0xae')](_0x39c35d,_0x409a4c,function(_0x5dd0b2){if(_0x5dd0b2){logger[_0xfbb9('0x18')](_0xfbb9('0xc9'),_0x5dd0b2);}else{fs[_0xfbb9('0xca')](_0x39c35d);}});});});}else{return _0xae875b[_0xfbb9('0x1d')](0xc8);}})['catch'](handleError(_0xae875b,null));}; \ No newline at end of file +var _0x3835=['$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent','push','setTags','Tag','findAll','color','removeTags','unix','files','tmp','server','transcript-%d-%s.zip','firstName','lastName','attachments','createdAt','read','Account','Owner','get','mkdirSync','Chat','N.A.','toString','browserName','osName','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','value','views','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','localhost','redis','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','name','send','render','merge','body','contact','interaction','account','map','ChatInteraction','rawAttributes','fieldName','key','getOptions','query','user','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','POST','email','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','sendStatus','Interaction\x20already\x20assigned','closed','attachmentUpload','file','basename','type','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','UserId','%s%d','agentAlias','System','Visitor','agentIdentifier','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter'];(function(_0x16d82a,_0x2c492c){var _0x1d6dc4=function(_0x55a09a){while(--_0x55a09a){_0x16d82a['push'](_0x16d82a['shift']());}};_0x1d6dc4(++_0x2c492c);}(_0x3835,0xf5));var _0x5383=function(_0x5885e4,_0x23d7b7){_0x5885e4=_0x5885e4-0x0;var _0x154bab=_0x3835[_0x5885e4];return _0x154bab;};'use strict';var rimraf=require(_0x5383('0x0'));var zipdir=require(_0x5383('0x1'));var rp=require(_0x5383('0x2'));var moment=require(_0x5383('0x3'));var BPromise=require(_0x5383('0x4'));var Mustache=require(_0x5383('0x5'));var util=require(_0x5383('0x6'));var path=require(_0x5383('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5383('0x8'));var Redis=require(_0x5383('0x9'));var interaction=require(_0x5383('0xa'));var qs=require(_0x5383('0xb'));var pdf=require(_0x5383('0xc'));var logger=require(_0x5383('0xd'))(_0x5383('0xe'));var config=require('../../config/environment');var db=require(_0x5383('0xf'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5383('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5383('0x11')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x5383('0x12'));var client=jayson['client'][_0x5383('0x13')]({'port':0x232b});var client9004=jayson[_0x5383('0x14')]['http']({'port':0x232c});function respondWithRpcPromise(_0x14804e,_0x1faa3b,_0x5c8155,_0x834f96){return new BPromise(function(_0x50540d,_0x59762d){var _0x591593=_0x834f96||client;return _0x591593[_0x5383('0x15')](_0x14804e,_0x5c8155)[_0x5383('0x16')](function(_0x4b1046){logger[_0x5383('0x17')](_0x5383('0x18'),_0x1faa3b,_0x5383('0x19'));logger[_0x5383('0x1a')](_0x5383('0x1b'),_0x1faa3b,'request\x20sent',JSON[_0x5383('0x1c')](_0x4b1046));if(_0x4b1046['error']){if(_0x4b1046['error']['code']===0x1f4){logger[_0x5383('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x1faa3b,_0x4b1046[_0x5383('0x1d')][_0x5383('0x1e')]);return _0x59762d(_0x4b1046[_0x5383('0x1d')][_0x5383('0x1e')]);}logger[_0x5383('0x1d')](_0x5383('0x18'),_0x1faa3b,_0x4b1046[_0x5383('0x1d')][_0x5383('0x1e')]);return _0x50540d(_0x4b1046['error'][_0x5383('0x1e')]);}else{logger[_0x5383('0x17')](_0x5383('0x18'),_0x1faa3b,'request\x20sent');_0x50540d(_0x4b1046[_0x5383('0x1f')][_0x5383('0x1e')]);}})['catch'](function(_0x43ef03){logger[_0x5383('0x1d')](_0x5383('0x18'),_0x1faa3b,_0x43ef03);_0x59762d(_0x43ef03);});});}function respondWithStatusCode(_0x95f20c,_0x24d156){_0x24d156=_0x24d156||0xcc;return function(_0x32c871){if(_0x32c871){return _0x95f20c['sendStatus'](_0x24d156);}return _0x95f20c['status'](_0x24d156)['end']();};}function respondWithResult(_0x286bd9,_0x1d7fa8){_0x1d7fa8=_0x1d7fa8||0xc8;return function(_0xd525a1){if(_0xd525a1){return _0x286bd9[_0x5383('0x20')](_0x1d7fa8)[_0x5383('0x21')](_0xd525a1);}};}function respondWithFilteredResult(_0x378886,_0x18c23c){return function(_0x459c1c){if(_0x459c1c){var _0x112654=typeof _0x18c23c[_0x5383('0x22')]===_0x5383('0x23')&&typeof _0x18c23c['limit']===_0x5383('0x23');var _0x4dd18e=_0x459c1c[_0x5383('0x24')];var _0xa37113=_0x112654?0x0:_0x18c23c['offset'];var _0x5dd32d=_0x112654?_0x459c1c[_0x5383('0x24')]:_0x18c23c[_0x5383('0x22')]+_0x18c23c[_0x5383('0x25')];var _0x32e17d;if(_0x5dd32d>=_0x4dd18e){_0x5dd32d=_0x4dd18e;_0x32e17d=0xc8;}else{_0x32e17d=0xce;}_0x378886['status'](_0x32e17d);return _0x378886[_0x5383('0x26')](_0x5383('0x27'),_0xa37113+'-'+_0x5dd32d+'/'+_0x4dd18e)[_0x5383('0x21')](_0x459c1c);}return null;};}function saveUpdates(_0x5c5c1f){return function(_0x243727){if(_0x243727){return _0x243727[_0x5383('0x28')](_0x5c5c1f)[_0x5383('0x16')](function(_0x4ea4ec){return _0x4ea4ec;});}return null;};}function removeEntity(_0x4cc9fc){return function(_0x5ea7ef){if(_0x5ea7ef){return _0x5ea7ef[_0x5383('0x29')]()[_0x5383('0x16')](function(){_0x4cc9fc[_0x5383('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7f3a){return function(_0x4ab945){if(!_0x4ab945){_0x4a7f3a['sendStatus'](0x194);}return _0x4ab945;};}function handleError(_0xed6d69,_0x108795){_0x108795=_0x108795||0x1f4;return function(_0x2d9e85){logger[_0x5383('0x1d')](_0x2d9e85['stack']);if(_0x2d9e85[_0x5383('0x2a')]){delete _0x2d9e85[_0x5383('0x2a')];}_0xed6d69[_0x5383('0x20')](_0x108795)[_0x5383('0x2b')](_0x2d9e85);};}function getMustacheRender(_0x3067d0,_0x548d79){return Mustache[_0x5383('0x2c')](_0x3067d0,_[_0x5383('0x2d')](_0x548d79[_0x5383('0x2e')],{'contact':_0x548d79[_0x5383('0x2f')],'message':_0x548d79[_0x5383('0x1e')],'agent':_0x548d79['agent'],'interaction':_0x548d79[_0x5383('0x30')],'account':_0x548d79[_0x5383('0x31')]}))||'';}exports['index']=function(_0x1616cd,_0x366a6f){var _0x64021a={};var _0x4a23e7=_[_0x5383('0x32')](db[_0x5383('0x33')][_0x5383('0x34')],function(_0x507bd5){return{'name':_0x507bd5[_0x5383('0x35')],'type':_0x507bd5['type'][_0x5383('0x36')]};});_0x64021a=qs[_0x5383('0x37')](_0x4a23e7,_0x1616cd);return interaction['findAll']('chat',_0x1616cd[_0x5383('0x38')],_0x1616cd[_0x5383('0x39')],_0x64021a,_0x4a23e7)[_0x5383('0x16')](respondWithFilteredResult(_0x366a6f,_0x64021a))[_0x5383('0x3a')](handleError(_0x366a6f,null));};exports['show']=function(_0x2fae3e,_0x431ed5){var _0x1f483b={'raw':![],'where':{'id':_0x2fae3e[_0x5383('0x3b')]['id']}},_0x27ada7={};_0x27ada7[_0x5383('0x3c')]=_['keys'](db[_0x5383('0x33')][_0x5383('0x34')]);_0x27ada7[_0x5383('0x38')]=_[_0x5383('0x3d')](_0x2fae3e[_0x5383('0x38')]);_0x27ada7[_0x5383('0x3e')]=_[_0x5383('0x3f')](_0x27ada7[_0x5383('0x3c')],_0x27ada7['query']);_0x1f483b[_0x5383('0x40')]=_[_0x5383('0x3f')](_0x27ada7['model'],qs['fields'](_0x2fae3e[_0x5383('0x38')][_0x5383('0x41')]));_0x1f483b[_0x5383('0x40')]=_0x1f483b[_0x5383('0x40')][_0x5383('0x42')]?_0x1f483b[_0x5383('0x40')]:_0x27ada7['model'];if(_0x2fae3e[_0x5383('0x38')][_0x5383('0x43')]){_0x1f483b[_0x5383('0x44')]=[{'all':!![]}];}_0x1f483b=_['merge']({},_0x1f483b,_0x2fae3e[_0x5383('0x45')]);return db[_0x5383('0x33')][_0x5383('0x46')](_0x1f483b)['then'](handleEntityNotFound(_0x431ed5,null))[_0x5383('0x16')](respondWithResult(_0x431ed5,null))[_0x5383('0x3a')](handleError(_0x431ed5,null));};exports[_0x5383('0x47')]=function(_0x2c6897,_0x2c40a7){return db[_0x5383('0x33')][_0x5383('0x47')](_0x2c6897[_0x5383('0x2e')],{})[_0x5383('0x16')](respondWithResult(_0x2c40a7,0xc9))[_0x5383('0x3a')](handleError(_0x2c40a7,null));};exports[_0x5383('0x28')]=function(_0x516167,_0x1c9e7e){if(_0x516167[_0x5383('0x2e')]['id']){delete _0x516167[_0x5383('0x2e')]['id'];}return db[_0x5383('0x33')][_0x5383('0x46')]({'where':{'id':_0x516167[_0x5383('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1c9e7e,null))[_0x5383('0x16')](saveUpdates(_0x516167[_0x5383('0x2e')],null))[_0x5383('0x16')](respondWithResult(_0x1c9e7e,null))[_0x5383('0x3a')](handleError(_0x1c9e7e,null));};exports[_0x5383('0x29')]=function(_0x294332,_0x1e9e11){return db['ChatInteraction'][_0x5383('0x46')]({'where':{'id':_0x294332[_0x5383('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1e9e11,null))[_0x5383('0x16')](removeEntity(_0x1e9e11,null))['catch'](handleError(_0x1e9e11,null));};exports[_0x5383('0x48')]=function(_0x4e8dfd,_0x205cf9){return db[_0x5383('0x33')][_0x5383('0x48')]()[_0x5383('0x16')](respondWithResult(_0x205cf9,null))[_0x5383('0x3a')](handleError(_0x205cf9,null));};exports[_0x5383('0x49')]=function(_0xf43c17,_0x1ba0d7){var _0x3f209a=_0xf43c17[_0x5383('0x3b')]['id'];var _0x42955c;var _0x4fb238;var _0x3b6f01;return db[_0x5383('0x33')][_0x5383('0x4a')]({'where':{'id':_0x3f209a}})['then'](function(_0xe4a00f){_0x42955c=_0xe4a00f;return db[_0x5383('0x4b')]['findOne']({'where':{'id':_0xe4a00f[_0x5383('0x4c')]},'attributes':['id',_0x5383('0x4d'),_0x5383('0x4e'),_0x5383('0x4f'),_0x5383('0x50'),_0x5383('0x51')],'raw':!![]});})['then'](function(_0x147fc4){if(_0x147fc4&&_0x147fc4['vidaooApiKey']&&_0x147fc4[_0x5383('0x4e')]){_0x4fb238=_0x147fc4;var _0x14c4a8={'interaction':{'id':_0x3f209a},'agent':{'id':_0xf43c17['user']['id'],'name':_0xf43c17[_0x5383('0x39')][_0x5383('0x2a')],'fullname':_0xf43c17[_0x5383('0x39')]['fullname'],'email':_0xf43c17[_0x5383('0x39')]['email']},'contact':_0xf43c17[_0x5383('0x2e')][_0x5383('0x2f')],'account':_0xf43c17[_0x5383('0x2e')][_0x5383('0x31')]};var _0x2ad933={'rejectUnauthorized':![],'method':_0x5383('0x52'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x147fc4['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0xf43c17['user'][_0x5383('0x53')]],'buttons':null,'topic':_0x4fb238[_0x5383('0x4f')],'note':_[_0x5383('0x54')](_0x4fb238[_0x5383('0x50')])?null:getMustacheRender(_0x4fb238[_0x5383('0x50')],_0x14c4a8),'metadata':null},'redirect':_0x5383('0x55'),'json':!![]};try{if(!_[_0x5383('0x54')](_0x4fb238[_0x5383('0x51')])){var _0xa96d07=getMustacheRender(_0x4fb238[_0x5383('0x51')],_0x14c4a8);var _0x2ba106=JSON[_0x5383('0x56')](_0xa96d07);_0x2ad933[_0x5383('0x2e')][_0x5383('0x57')]=_0x2ba106;}}catch(_0x5e8212){throw new db[(_0x5383('0x58'))][(_0x5383('0x59'))](_0x5383('0x5a'));}return rp(_0x2ad933);}else{throw new db[(_0x5383('0x58'))][(_0x5383('0x59'))](_0x5383('0x5b'));}})[_0x5383('0x16')](function(_0x366fcd){_0x3b6f01=_0x366fcd;if(_0x3b6f01['id']){var _0x32afc8={'body':_0x3b6f01[_0x5383('0x5c')],'ChatWebsiteId':_0x4fb238['id'],'ChatInteractionId':_0x42955c['id'],'direction':_0x5383('0x5d'),'UserId':_0xf43c17[_0x5383('0x39')]['id']};return db[_0x5383('0x5e')][_0x5383('0x47')](_0x32afc8,{});}else{throw new db['Sequelize'][(_0x5383('0x59'))](_0x5383('0x5f'));}})[_0x5383('0x16')](function(){return _0x42955c[_0x5383('0x60')]({'vidaooSessionId':_0x3b6f01['id']});})[_0x5383('0x16')](respondWithResult(_0x1ba0d7,null))['catch'](handleError(_0x1ba0d7,null));};exports[_0x5383('0x61')]=function(_0x18792e,_0x151996){if(_0x18792e[_0x5383('0x2e')]['id']){delete _0x18792e['body']['id'];}return db[_0x5383('0x33')][_0x5383('0x46')]({'where':{'id':_0x18792e[_0x5383('0x3b')]['id']},'include':[{'model':db[_0x5383('0x62')],'as':_0x5383('0x63')}]})[_0x5383('0x16')](handleEntityNotFound(_0x151996,null))[_0x5383('0x16')](saveUpdates(_0x18792e[_0x5383('0x2e')],null))[_0x5383('0x16')](respondWithResult(_0x151996,null))[_0x5383('0x3a')](handleError(_0x151996,null));};exports['abandon']=function(_0x173493,_0x2973bd){if(_0x173493[_0x5383('0x2e')]['id']){delete _0x173493[_0x5383('0x2e')]['id'];}return db[_0x5383('0x33')][_0x5383('0x46')]({'where':{'id':_0x173493['params']['id']}})['then'](function(_0x4d71eb){if(!_0x4d71eb){logger[_0x5383('0x1d')](_0x5383('0x64'),_0x5383('0x65'),0x194,'entity\x20not\x20found');_0x2973bd[_0x5383('0x66')](0x194);}else{if(_0x4d71eb['UserId']){throw new db['Sequelize'][(_0x5383('0x59'))](_0x5383('0x67'));}}return _0x4d71eb;})[_0x5383('0x16')](function(_0x580a47){if(_0x580a47){return _0x580a47[_0x5383('0x28')]({'closed':_0x173493['body'][_0x5383('0x68')],'disposition':_0x173493[_0x5383('0x2e')]['disposition']})[_0x5383('0x16')](function(_0x4f87c4){return _0x4f87c4;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0x5383('0x65'),_0x173493['body'],client9004);})[_0x5383('0x16')](respondWithResult(_0x2973bd,null))[_0x5383('0x3a')](handleError(_0x2973bd,null));};exports[_0x5383('0x69')]=function(_0x499d79,_0x1fc0fd){_0x499d79[_0x5383('0x2e')][_0x5383('0x2a')]=_0x499d79[_0x5383('0x6a')]['originalname'];_0x499d79[_0x5383('0x2e')][_0x5383('0x6b')]=_0x499d79[_0x5383('0x6a')]['filename'];_0x499d79[_0x5383('0x2e')][_0x5383('0x6c')]=_0x499d79['file'][_0x5383('0x6d')];return db['Attachment'][_0x5383('0x47')](_0x499d79[_0x5383('0x2e')])[_0x5383('0x16')](respondWithResult(_0x1fc0fd,0xc9))[_0x5383('0x3a')](handleError(_0x1fc0fd,null));};exports[_0x5383('0x6e')]=function(_0x14e4fa,_0x59d4cd){return db[_0x5383('0x33')][_0x5383('0x4a')]({'where':{'id':_0x14e4fa[_0x5383('0x3b')]['id']},'raw':!![]})[_0x5383('0x16')](handleEntityNotFound(_0x59d4cd,null))['then'](function(_0x48f5ee){if(_0x48f5ee){if(_0x48f5ee[_0x5383('0x68')]){return _0x59d4cd[_0x5383('0x20')](0x193)[_0x5383('0x21')]({'status':0x193,'message':_0x5383('0x6f')});}return db[_0x5383('0x70')][_0x5383('0x4a')]({'where':{'id':_0x14e4fa['query'][_0x5383('0x71')]},'raw':!![]})[_0x5383('0x16')](handleEntityNotFound(_0x59d4cd,null));}})[_0x5383('0x16')](function(_0x12587c){if(_0x12587c){var _0x5d70f8=_0x12587c[_0x5383('0x72')]!==null;var _0x1ace30=path[_0x5383('0x73')](config[_0x5383('0x74')],'server/files/attachments/');if(_0x5d70f8){_0x1ace30=path[_0x5383('0x73')](_0x1ace30,_0x5383('0x75'));}var _0x208869=path[_0x5383('0x73')](_0x1ace30,_0x12587c[_0x5383('0x6b')]);return _0x59d4cd[_0x5383('0x76')](_0x208869);}})['catch'](handleError(_0x59d4cd,null));};exports[_0x5383('0x77')]=function(_0x42482f,_0x5c2ff8){var _0x1542de=null;var _0x29a886=null;var _0x2a725f=null;if(_0x42482f['body']['id']){delete _0x42482f[_0x5383('0x2e')]['id'];}if(_0x42482f[_0x5383('0x2e')][_0x5383('0x78')]){_0x2a725f=path[_0x5383('0x73')](config['root'],_0x5383('0x79'),util[_0x5383('0x7a')](_0x5383('0x7b'),Date[_0x5383('0x7c')]()));_0x42482f[_0x5383('0x2e')][_0x5383('0x7d')]=_0x2a725f;}return db[_0x5383('0x33')][_0x5383('0x46')]({'where':{'id':_0x42482f[_0x5383('0x3b')]['id']},'include':[{'model':db[_0x5383('0x5e')],'as':_0x5383('0x7e'),'include':[{'model':db[_0x5383('0x7f')],'as':_0x5383('0x7f')}]}]})[_0x5383('0x16')](handleEntityNotFound(_0x5c2ff8,null))[_0x5383('0x16')](saveUpdates(_0x42482f[_0x5383('0x2e')],null))['then'](function(_0x54fd86){if(_0x54fd86){_0x1542de=_0x54fd86;return db[_0x5383('0x4b')][_0x5383('0x46')]({'where':{'id':_0x1542de[_0x5383('0x4c')]}});}})[_0x5383('0x16')](function(_0x4ebafb){if(_0x4ebafb){_0x29a886=_0x4ebafb;return db[_0x5383('0x62')]['find']({'where':{'id':_0x1542de[_0x5383('0x80')]}});}})[_0x5383('0x16')](function(_0x5d8855){if(_0x5d8855){if(_0x2a725f){var _0x4bdf67=null;for(var _0x3a5d22=0x1;_0x3a5d22<_0x1542de[_0x5383('0x7e')][_0x5383('0x42')];++_0x3a5d22){_0x4bdf67=_0x1542de[_0x5383('0x7e')][_0x3a5d22];var _0x57663d=_0x4bdf67[_0x5383('0x81')]?util[_0x5383('0x7a')](_0x5383('0x82'),_0x29a886[_0x5383('0x83')],_0x4bdf67['UserId']):_0x5383('0x84');var _0x292a55=_0x42482f[_0x5383('0x2e')]['customer']||util[_0x5383('0x7a')](_0x5383('0x82'),_0x5383('0x85'),_0x4bdf67['ContactId']);switch(_0x29a886[_0x5383('0x86')]){case'website_alias':_0x57663d=_0x4bdf67['UserId']?util[_0x5383('0x7a')](_0x5383('0x82'),_0x29a886[_0x5383('0x83')],_0x4bdf67['UserId']):'System';break;case _0x5383('0x87'):_0x57663d=_0x4bdf67[_0x5383('0x81')]?_0x4bdf67[_0x5383('0x7f')][_0x5383('0x88')]||_0x4bdf67[_0x5383('0x7f')][_0x5383('0x89')]:_0x5383('0x84');break;case _0x5383('0x8a'):_0x57663d=_0x4bdf67[_0x5383('0x81')]?_0x4bdf67[_0x5383('0x7f')][_0x5383('0x89')]:'System';break;default:_0x57663d=_0x4bdf67['UserId']?util[_0x5383('0x7a')](_0x5383('0x82'),_0x29a886[_0x5383('0x83')],_0x4bdf67['UserId']):_0x5383('0x84');}var _0x5ac3dd=util[_0x5383('0x7a')](_0x5383('0x8b'),moment(_0x4bdf67['createdAt'])[_0x5383('0x7a')](_0x5383('0x8c')),_0x4bdf67[_0x5383('0x8d')]==='in'?_0x292a55:_0x57663d,_0x4bdf67[_0x5383('0x2e')]);if(!_0x4bdf67[_0x5383('0x8e')]){fs[_0x5383('0x8f')](_0x2a725f,_0x5ac3dd);}}return db[_0x5383('0x90')][_0x5383('0x4a')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x5383('0x91'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x5383('0x92'),'raw':!![]}]}]});}}})['then'](function(_0x28c54f){if(!_0x28c54f||!_0x28c54f['Smtp']||!_0x42482f[_0x5383('0x2e')])return _0x1542de;var _0xedb91a=_0x28c54f[_0x5383('0x93')]();return respondWithRpcPromise('SendMail',_0x5383('0x94'),{'account':_0xedb91a,'message':{'from':util['format'](_0x5383('0x95'),_0x28c54f[_0x5383('0x2a')],_0x28c54f['email']||_0x28c54f[_0x5383('0x91')][_0x5383('0x39')]),'to':_0x42482f['body'][_0x5383('0x78')],'subject':_0x5383('0x96'),'text':util[_0x5383('0x7a')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x42482f[_0x5383('0x2e')]['mailTranscript']),'attachments':[{'path':_0x2a725f}]}})[_0x5383('0x16')](function(){return _0x1542de;})[_0x5383('0x3a')](function(_0x2cd7f8){logger['error'](_0x2cd7f8);});})[_0x5383('0x16')](respondWithStatusCode(_0x5c2ff8,0xc8))[_0x5383('0x3a')](handleError(_0x5c2ff8,null));};exports['addMessage']=function(_0x2d1b68,_0x5728f6){return db[_0x5383('0x5e')][_0x5383('0x46')]({'where':{'id':_0x2d1b68[_0x5383('0x3b')]['id']}})[_0x5383('0x16')](handleEntityNotFound(_0x5728f6,null))[_0x5383('0x16')](function(_0x193f7d){if(_0x193f7d){return _0x193f7d[_0x5383('0x97')](_0x2d1b68[_0x5383('0x2e')][_0x5383('0x98')],_[_0x5383('0x99')](_0x2d1b68[_0x5383('0x2e')],['ids','id'])||{});}})[_0x5383('0x16')](respondWithResult(_0x5728f6,null))['catch'](handleError(_0x5728f6,null));};exports[_0x5383('0x9a')]=function(_0x2ea87e,_0x4a9575){var _0x318473={'raw':![],'where':{}};var _0x5ef866={};var _0x2c0558={'count':0x0,'rows':[]};return db[_0x5383('0x33')][_0x5383('0x4a')]({'where':{'id':_0x2ea87e[_0x5383('0x3b')]['id']}})[_0x5383('0x16')](handleEntityNotFound(_0x4a9575,null))[_0x5383('0x16')](function(_0x3a1dd1){if(_0x3a1dd1){_0x5ef866[_0x5383('0x3c')]=_['keys'](db[_0x5383('0x5e')][_0x5383('0x34')]);_0x5ef866['query']=_[_0x5383('0x3d')](_0x2ea87e[_0x5383('0x38')]);_0x5ef866[_0x5383('0x3e')]=_[_0x5383('0x3f')](_0x5ef866[_0x5383('0x3c')],_0x5ef866[_0x5383('0x38')]);_0x318473['attributes']=_[_0x5383('0x3f')](_0x5ef866[_0x5383('0x3c')],qs['fields'](_0x2ea87e[_0x5383('0x38')][_0x5383('0x41')]));_0x318473[_0x5383('0x40')]=_0x318473[_0x5383('0x40')]['length']?_0x318473[_0x5383('0x40')]:_0x5ef866[_0x5383('0x3c')];if(!_0x2ea87e['query'][_0x5383('0x9b')](_0x5383('0x9c'))){_0x318473[_0x5383('0x25')]=qs[_0x5383('0x25')](_0x2ea87e[_0x5383('0x38')][_0x5383('0x25')]);_0x318473[_0x5383('0x22')]=qs[_0x5383('0x22')](_0x2ea87e['query'][_0x5383('0x22')]);}_0x318473[_0x5383('0x9d')]=qs[_0x5383('0x9e')](_0x2ea87e[_0x5383('0x38')][_0x5383('0x9e')]);_0x318473[_0x5383('0x9f')]=qs[_0x5383('0x3e')](_[_0x5383('0xa0')](_0x2ea87e[_0x5383('0x38')],_0x5ef866['filters']));_0x318473[_0x5383('0x9f')][_0x5383('0xa1')]=_0x3a1dd1['id'];if(_0x2ea87e[_0x5383('0x38')][_0x5383('0xa2')]){_0x318473[_0x5383('0x9f')]=_['merge'](_0x318473[_0x5383('0x9f')],{'$or':_['map'](_0x318473[_0x5383('0x40')],function(_0x1580b0){var _0x1babd4={};_0x1babd4[_0x1580b0]={'$like':'%'+_0x2ea87e['query'][_0x5383('0xa2')]+'%'};return _0x1babd4;})});}if(_0x2ea87e[_0x5383('0x38')]['$gte']){var _0x2dc850=_0x2ea87e[_0x5383('0x38')][_0x5383('0xa3')][_0x5383('0xa4')](',');var _0x20d830={};_0x20d830[_0x2dc850[0x0]]={'$gte':moment(_0x2dc850[0x1])['format'](_0x5383('0xa5'))};_0x318473['where']=_['merge'](_0x318473[_0x5383('0x9f')],_0x20d830);}_0x318473=_['merge']({},_0x318473,_0x2ea87e['options']);return db['ChatMessage'][_0x5383('0x24')]({'where':_0x318473[_0x5383('0x9f')]})[_0x5383('0x16')](function(_0xf3c4ac){_0x2c0558['count']=_0xf3c4ac;if(_0x2ea87e[_0x5383('0x38')][_0x5383('0x43')]){_0x318473['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x318473);})[_0x5383('0x16')](function(_0x42b4f6){_0x2c0558[_0x5383('0xa6')]=_0x42b4f6;return _0x2c0558;});}})[_0x5383('0x16')](respondWithFilteredResult(_0x4a9575,_0x318473))['catch'](handleError(_0x4a9575,null));};exports[_0x5383('0xa7')]=function(_0x3c9924,_0x22f377){var _0x285b0e={'where':{}},_0x1acc8f={},_0x5a4b53={'count':0x0,'rows':[]};return db[_0x5383('0x33')][_0x5383('0x4a')]({'where':{'id':_0x3c9924[_0x5383('0x3b')]['id']}})[_0x5383('0x16')](handleEntityNotFound(_0x22f377,null))[_0x5383('0x16')](function(_0x15a60d){if(_0x15a60d){_0x1acc8f[_0x5383('0x3c')]=_[_0x5383('0x3d')](db[_0x5383('0x5e')]['rawAttributes']);_0x1acc8f[_0x5383('0x38')]=_[_0x5383('0x3d')](_0x3c9924[_0x5383('0x38')]);_0x1acc8f['filters']=_[_0x5383('0x3f')](_0x1acc8f['model'],_0x1acc8f[_0x5383('0x38')]);_0x285b0e[_0x5383('0x40')]=_[_0x5383('0x3f')](_0x1acc8f['model'],qs[_0x5383('0x41')](_0x3c9924['query'][_0x5383('0x41')]));_0x285b0e[_0x5383('0x40')]=_0x285b0e[_0x5383('0x40')][_0x5383('0x42')]?_0x285b0e['attributes']:_0x1acc8f[_0x5383('0x3c')];if(!_0x3c9924[_0x5383('0x38')][_0x5383('0x9b')](_0x5383('0x9c'))){_0x285b0e[_0x5383('0x25')]=qs['limit'](_0x3c9924[_0x5383('0x38')][_0x5383('0x25')]);_0x285b0e[_0x5383('0x22')]=qs['offset'](_0x3c9924[_0x5383('0x38')]['offset']);}_0x285b0e[_0x5383('0x9d')]=qs[_0x5383('0x9e')](_0x3c9924[_0x5383('0x38')]['sort']);_0x285b0e[_0x5383('0x9f')]=qs[_0x5383('0x3e')](_[_0x5383('0xa0')](_0x3c9924[_0x5383('0x38')],_0x1acc8f[_0x5383('0x3e')]));_0x285b0e[_0x5383('0x9f')]['ChatInteractionId']=_0x15a60d['id'];if(_0x3c9924['query'][_0x5383('0xa2')]){_0x285b0e[_0x5383('0x9f')]=_[_0x5383('0x2d')](_0x285b0e[_0x5383('0x9f')],{'$or':_[_0x5383('0x32')](_0x285b0e['attributes'],function(_0x2947c4){var _0x495bfa={};_0x495bfa[_0x2947c4]={'$like':'%'+_0x3c9924['query'][_0x5383('0xa2')]+'%'};return _0x495bfa;})});}_0x285b0e['where'][_0x5383('0x8e')]=![];if(_0x3c9924[_0x5383('0x38')]['id']){_0x285b0e[_0x5383('0x9f')]['id']={'$gt':_0x3c9924[_0x5383('0x38')]['id']};}_0x285b0e=_[_0x5383('0x2d')]({},_0x285b0e,_0x3c9924[_0x5383('0x45')]);return db[_0x5383('0x5e')][_0x5383('0x24')]({'where':_0x285b0e[_0x5383('0x9f')]})[_0x5383('0x16')](function(_0x3885b8){_0x5a4b53[_0x5383('0x24')]=_0x3885b8;_0x285b0e[_0x5383('0x44')]=[];if(_0x3c9924[_0x5383('0x38')][_0x5383('0xa8')]){_0x285b0e[_0x5383('0x44')][_0x5383('0xa9')]({'model':db['User'],'as':_0x5383('0x7f'),'attributes':['id',_0x5383('0x89'),_0x5383('0x88')]});}if(_0x3c9924[_0x5383('0x38')][_0x5383('0x43')]){_0x285b0e[_0x5383('0x44')]=[{'all':!![]}];}return db[_0x5383('0x5e')]['findAll'](_0x285b0e);})[_0x5383('0x16')](function(_0x4a36a0){_0x5a4b53['rows']=_0x4a36a0;return _0x5a4b53;});}})[_0x5383('0x16')](respondWithFilteredResult(_0x22f377,_0x285b0e))['catch'](handleError(_0x22f377,null));};exports['addTags']=function(_0x5dd19c,_0x453c7b){return db[_0x5383('0x33')][_0x5383('0x46')]({'where':{'id':_0x5dd19c[_0x5383('0x3b')]['id']}})[_0x5383('0x16')](handleEntityNotFound(_0x453c7b,null))[_0x5383('0x16')](function(_0xc2cdab){if(_0xc2cdab){return _0xc2cdab[_0x5383('0xaa')](_0x5dd19c[_0x5383('0x2e')][_0x5383('0x98')],_[_0x5383('0x99')](_0x5dd19c[_0x5383('0x2e')],['ids','id'])||{})['spread'](function(){return db[_0x5383('0xab')][_0x5383('0xac')]({'attributes':['id','name',_0x5383('0xad')],'where':{'id':_0x5dd19c[_0x5383('0x2e')][_0x5383('0x98')]}});})[_0x5383('0x16')](function(_0x14433f){socket['emit']('chatInteractionTags:save',{'id':Number(_0x5dd19c[_0x5383('0x3b')]['id']),'tags':_0x14433f||[]});return{'id':Number(_0x5dd19c[_0x5383('0x3b')]['id']),'tags':_0x14433f||[]};});}})[_0x5383('0x16')](respondWithResult(_0x453c7b,null))[_0x5383('0x3a')](handleError(_0x453c7b,null));};exports['removeTags']=function(_0x50e308,_0x3e7376){return db['ChatInteraction']['find']({'where':{'id':_0x50e308[_0x5383('0x3b')]['id']}})[_0x5383('0x16')](handleEntityNotFound(_0x3e7376,null))['then'](function(_0x29d4c9){if(_0x29d4c9){return _0x29d4c9[_0x5383('0xae')](_0x50e308['query'][_0x5383('0x98')]);}})[_0x5383('0x16')](respondWithStatusCode(_0x3e7376,null))['catch'](handleError(_0x3e7376,null));};exports['download']=function(_0x450232,_0x12b921){var _0x3a6b48=moment()[_0x5383('0xaf')]()['toString']();var _0x4626dd=path[_0x5383('0x73')](config[_0x5383('0x74')],'server',_0x5383('0xb0'),_0x5383('0xb1'));var _0x3b60a9=path[_0x5383('0x73')](config['root'],_0x5383('0xb2'),_0x5383('0xb0'),'attachments');var _0x4cfdce=path[_0x5383('0x73')](_0x4626dd,_0x3a6b48);var _0x18b8e1=util[_0x5383('0x7a')](_0x5383('0xb3'),_0x450232[_0x5383('0x3b')]['id'],_0x3a6b48);var _0x4d51ca=path[_0x5383('0x73')](_0x4626dd,_0x18b8e1);var _0x398d2f=[];_0x398d2f[_0x5383('0xa9')]({'model':db[_0x5383('0x7f')],'as':_0x5383('0x7f'),'attributes':['id',_0x5383('0x89')],'raw':!![]});_0x398d2f[_0x5383('0xa9')]({'model':db[_0x5383('0x62')],'as':_0x5383('0x63'),'attributes':['id',_0x5383('0xb4'),_0x5383('0xb5')],'raw':!![]});if(_0x450232[_0x5383('0x38')][_0x5383('0xb6')]){_0x398d2f[_0x5383('0xa9')]({'model':db[_0x5383('0x70')],'as':_0x5383('0x70'),'raw':!![]});}var _0x17e311=[{'model':db['ChatMessage'],'as':_0x5383('0x7e'),'attributes':['id',_0x5383('0x2e'),_0x5383('0xb7'),'direction',_0x5383('0x8e'),_0x5383('0xb8')],'include':_0x398d2f}];_0x17e311[_0x5383('0xa9')]({'model':db['ChatWebsite'],'as':_0x5383('0xb9'),'attributes':['id',_0x5383('0x2a')]});_0x17e311[_0x5383('0xa9')]({'model':db[_0x5383('0x7f')],'as':_0x5383('0xba'),'attributes':['id',_0x5383('0x89')]});return db[_0x5383('0x33')][_0x5383('0x46')]({'where':{'id':_0x450232[_0x5383('0x3b')]['id']},'include':_0x17e311})[_0x5383('0x16')](handleEntityNotFound(_0x12b921,null))[_0x5383('0x16')](function(_0x4174da){if(_0x4174da){var _0xb596f5=_0x4174da[_0x5383('0xbb')]({'plain':!![]});fs[_0x5383('0xbc')](_0x4cfdce);var _0x2b714c={'channel':_0x5383('0xbd'),'account':_0xb596f5[_0x5383('0xb9')][_0x5383('0x2a')],'agent':_0xb596f5[_0x5383('0xba')]?_0xb596f5[_0x5383('0xba')]['fullname']:_0x5383('0xbe'),'createdAt':moment(_0xb596f5['createdAt'])[_0x5383('0x7a')](_0x5383('0xa5'))[_0x5383('0xbf')](),'closedAt':_0xb596f5[_0x5383('0x68')]?moment(_0xb596f5['closedAt'])[_0x5383('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0xb596f5['disposition'],'chatInfo':{'browser':_0xb596f5[_0x5383('0xc0')],'os':_0xb596f5[_0x5383('0xc1')],'referer':_0xb596f5['referer'],'customerIp':_0xb596f5[_0x5383('0xc2')],'customerPort':_0xb596f5[_0x5383('0xc3')]?_0xb596f5[_0x5383('0xc3')]:_0x5383('0xbe')},'messages':_(_0xb596f5[_0x5383('0x7e')])['tail']()['filter']({'secret':![]})['map'](function(_0x2e01fc){if(_0x2e01fc[_0x5383('0x70')]){var _0x5b749f=path['join'](_0x3b60a9,_0x2e01fc[_0x5383('0x70')]['basename']);if(fs[_0x5383('0xc4')](_0x5b749f)){fs[_0x5383('0xc5')](_0x5b749f)[_0x5383('0xc6')](fs[_0x5383('0xc7')](path['join'](_0x4cfdce,_0x2e01fc[_0x5383('0x70')][_0x5383('0x6b')])));}}return{'date':moment(_0x2e01fc[_0x5383('0xb7')])[_0x5383('0x7a')](_0x5383('0xa5'))[_0x5383('0xbf')](),'sender':_0x2e01fc[_0x5383('0x8d')]===_0x5383('0x5d')?_0x2e01fc[_0x5383('0x7f')]?_0x2e01fc[_0x5383('0x7f')][_0x5383('0x89')]:'System':_0x2e01fc[_0x5383('0x63')][_0x5383('0xb4')]+(_0x2e01fc[_0x5383('0x63')]['lastName']?'\x20'+_0x2e01fc['Contact']['lastName']:''),'body':_0x2e01fc[_0x5383('0x70')]?_0x2e01fc[_0x5383('0x70')]['basename']:_0x2e01fc['body'],'direction':_0x2e01fc[_0x5383('0x8d')]===_0x5383('0x5d')?'A':'C','secret':_0x2e01fc['secret'],'read':_0x2e01fc[_0x5383('0xb8')],'attachment':_0x2e01fc[_0x5383('0x70')]};})[_0x5383('0xc8')]()};return ejs['renderFile'](path['join'](config[_0x5383('0x74')],'server',_0x5383('0xc9'),'downloadInteraction.ejs'),{'interaction':_0x2b714c})[_0x5383('0x16')](function(_0x2f3ce3){var _0x4c899a=path[_0x5383('0x73')](_0x4cfdce,'transcript-'+_0xb596f5['id']+'-'+_0x3a6b48+'.pdf');var _0x3ce9e9={'path':_0x4c899a,'channel':'Chat','interactionId':_0xb596f5['id']};return pdf['createPdfFromHTML'](_0x2f3ce3,_0x3ce9e9);})[_0x5383('0x16')](function(){return new Promise(function(_0xe7aa19,_0x2703ef){zipdir(_0x4cfdce,{'saveTo':_0x4d51ca},function(_0x1fb9c3,_0x551e14){if(_0x1fb9c3)return _0x2703ef(_0x1fb9c3);return _0xe7aa19(_0x551e14);});})['then'](function(){return new BPromise(function(_0x4a7522,_0x4cc0eb){rimraf(_0x4cfdce,function(_0x46c9a7){if(_0x46c9a7)_0x4cc0eb(_0x46c9a7);return _0x4a7522();});});})[_0x5383('0x16')](function(){return _0x12b921[_0x5383('0x76')](_0x4d51ca,_0x18b8e1,function(_0x5033c7){if(_0x5033c7){logger['error'](_0x5383('0xca'),_0x5033c7);}else{fs[_0x5383('0xcb')](_0x4d51ca);}});});});}else{return _0x12b921[_0x5383('0x66')](0xc8);}})[_0x5383('0x3a')](handleError(_0x12b921,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 1560322..10e28a6 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 _0x5cd4=['then','unreadMessages','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','save','remove','getUsers','setDataValue','Users','findAll'];(function(_0x474653,_0x223a06){var _0x184990=function(_0x43af56){while(--_0x43af56){_0x474653['push'](_0x474653['shift']());}};_0x184990(++_0x223a06);}(_0x5cd4,0xd3));var _0x45cd=function(_0x7107de,_0x1be6e9){_0x7107de=_0x7107de-0x0;var _0x3b0349=_0x5cd4[_0x7107de];return _0x3b0349;};'use strict';var EventEmitter=require(_0x45cd('0x0'));var ChatInteraction=require(_0x45cd('0x1'))['db'][_0x45cd('0x2')];var ChatMessage=require(_0x45cd('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x45cd('0x3')](0x0);var events={'afterCreate':_0x45cd('0x4'),'afterUpdate':'update','afterDestroy':_0x45cd('0x5')};function emitEvent(_0x2f2774){return function(_0x544c57,_0x22f019,_0x4afaf9){_0x544c57[_0x45cd('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4bc763){_0x544c57[_0x45cd('0x7')](_0x45cd('0x8'),_0x4bc763['map'](function(_0x497a5c){return{'id':_0x497a5c['id']};}));return ChatMessage[_0x45cd('0x9')]({'where':{'ChatInteractionId':_0x544c57['id'],'direction':'in','read':![]},'raw':!![]});})[_0x45cd('0xa')](function(_0x2bbd30){_0x544c57[_0x45cd('0x7')](_0x45cd('0xb'),_0x2bbd30[_0x45cd('0xc')]);ChatInteractionEvents['emit'](_0x2f2774+':'+_0x544c57['id'],_0x544c57);ChatInteractionEvents['emit'](_0x2f2774,_0x544c57);_0x4afaf9(null);})[_0x45cd('0xd')](_0x4afaf9(null));};}for(var e in events){if(events[_0x45cd('0xe')](e)){var event=events[e];ChatInteraction[_0x45cd('0xf')](e,emitEvent(event));}}module[_0x45cd('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x09f6=['ChatMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','events','ChatInteraction','../../mysqldb'];(function(_0x515a97,_0x13fb69){var _0x35a3d2=function(_0x1406d0){while(--_0x1406d0){_0x515a97['push'](_0x515a97['shift']());}};_0x35a3d2(++_0x13fb69);}(_0x09f6,0x18d));var _0x609f=function(_0x4c08a2,_0x3c808f){_0x4c08a2=_0x4c08a2-0x0;var _0x1f1fd6=_0x09f6[_0x4c08a2];return _0x1f1fd6;};'use strict';var EventEmitter=require(_0x609f('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x609f('0x1')];var ChatMessage=require(_0x609f('0x2'))['db'][_0x609f('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x609f('0x4')](0x0);var events={'afterCreate':_0x609f('0x5'),'afterUpdate':_0x609f('0x6'),'afterDestroy':_0x609f('0x7')};function emitEvent(_0x47f92b){return function(_0x18f6e3,_0x1bf8e7,_0x2b48da){_0x18f6e3['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x39e20d){_0x18f6e3[_0x609f('0x8')](_0x609f('0x9'),_0x39e20d[_0x609f('0xa')](function(_0x443659){return{'id':_0x443659['id']};}));return ChatMessage[_0x609f('0xb')]({'where':{'ChatInteractionId':_0x18f6e3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x430e68){_0x18f6e3[_0x609f('0x8')]('unreadMessages',_0x430e68[_0x609f('0xc')]);ChatInteractionEvents[_0x609f('0xd')](_0x47f92b+':'+_0x18f6e3['id'],_0x18f6e3);ChatInteractionEvents[_0x609f('0xd')](_0x47f92b,_0x18f6e3);_0x2b48da(null);})[_0x609f('0xe')](_0x2b48da(null));};}for(var e in events){if(events[_0x609f('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e3119c2..bd55ba4 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 _0xc9e2=['ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api','request-promise','rimraf','../../config/environment','exports'];(function(_0x3f3f75,_0x5e215f){var _0x322635=function(_0x1ff524){while(--_0x1ff524){_0x3f3f75['push'](_0x3f3f75['shift']());}};_0x322635(++_0x5e215f);}(_0xc9e2,0xf8));var _0x2c9e=function(_0x45c767,_0x8800d5){_0x45c767=_0x45c767-0x0;var _0x3e1344=_0xc9e2[_0x45c767];return _0x3e1344;};'use strict';var _=require('lodash');var util=require(_0x2c9e('0x0'));var logger=require(_0x2c9e('0x1'))(_0x2c9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2c9e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c9e('0x4'));var config=require(_0x2c9e('0x5'));var attributes=require('./chatInteraction.attributes');module[_0x2c9e('0x6')]=function(_0x14f479,_0x4ecc30){return _0x14f479['define'](_0x2c9e('0x7'),attributes,{'tableName':_0x2c9e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5741e5,_0xcea004,_0x4f9d3f){if(_0x5741e5[_0x2c9e('0x9')](_0x2c9e('0xa'))){_0x5741e5[_0x2c9e('0xb')]=moment()[_0x2c9e('0xc')](_0x2c9e('0xd'));}_0x4f9d3f(null,_0x5741e5);}},'charset':_0x2c9e('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x090a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x49d3da,_0x48a28c){var _0x138d4d=function(_0xe8e665){while(--_0xe8e665){_0x49d3da['push'](_0x49d3da['shift']());}};_0x138d4d(++_0x48a28c);}(_0x090a,0x1c0));var _0xa090=function(_0x21d7bb,_0x1c6872){_0x21d7bb=_0x21d7bb-0x0;var _0xa4bf93=_0x090a[_0x21d7bb];return _0xa4bf93;};'use strict';var _=require(_0xa090('0x0'));var util=require(_0xa090('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa090('0x2'));var BPromise=require(_0xa090('0x3'));var rp=require(_0xa090('0x4'));var fs=require('fs');var path=require(_0xa090('0x5'));var rimraf=require(_0xa090('0x6'));var config=require(_0xa090('0x7'));var attributes=require('./chatInteraction.attributes');module[_0xa090('0x8')]=function(_0x625f32,_0x22403f){return _0x625f32[_0xa090('0x9')](_0xa090('0xa'),attributes,{'tableName':_0xa090('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20a170,_0x2176a7,_0x3a2707){if(_0x20a170[_0xa090('0xc')]('closed')){_0x20a170[_0xa090('0xd')]=moment()[_0xa090('0xe')](_0xa090('0xf'));}_0x3a2707(null,_0x20a170);}},'charset':_0xa090('0x10'),'collate':_0xa090('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index ded7462..2dd531c 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 _0xc474=['./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','raw','options','where','limit','stringify','find','addTags','body','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5a5879,_0xa14804){var _0x4fa85e=function(_0x3a4461){while(--_0x3a4461){_0x5a5879['push'](_0x5a5879['shift']());}};_0x4fa85e(++_0xa14804);}(_0xc474,0x15b));var _0x4c47=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xc474[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require(_0x4c47('0x0'));var moment=require(_0x4c47('0x1'));var BPromise=require(_0x4c47('0x2'));var rs=require(_0x4c47('0x3'));var fs=require('fs');var Redis=require(_0x4c47('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c47('0x5'));var logger=require(_0x4c47('0x6'))(_0x4c47('0x7'));var config=require(_0x4c47('0x8'));var jayson=require(_0x4c47('0x9'));var client=jayson[_0x4c47('0xa')][_0x4c47('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4c47('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4c47('0xd'))['register'](socket);function respondWithRpcPromise(_0x14f03,_0x56351b,_0x415d4e){return new BPromise(function(_0x363105,_0x596d97){return client[_0x4c47('0xe')](_0x14f03,_0x415d4e)[_0x4c47('0xf')](function(_0x412f7f){logger[_0x4c47('0x10')](_0x4c47('0x11'),_0x56351b,_0x4c47('0x12'));logger[_0x4c47('0x13')](_0x4c47('0x14'),_0x56351b,'request\x20sent',JSON['stringify'](_0x412f7f));if(_0x412f7f[_0x4c47('0x15')]){if(_0x412f7f[_0x4c47('0x15')][_0x4c47('0x16')]===0x1f4){logger['error'](_0x4c47('0x11'),_0x56351b,_0x412f7f['error'][_0x4c47('0x17')]);return _0x596d97(_0x412f7f[_0x4c47('0x15')][_0x4c47('0x17')]);}logger[_0x4c47('0x15')](_0x4c47('0x11'),_0x56351b,_0x412f7f[_0x4c47('0x15')][_0x4c47('0x17')]);return _0x363105(_0x412f7f['error'][_0x4c47('0x17')]);}else{logger[_0x4c47('0x10')](_0x4c47('0x11'),_0x56351b,_0x4c47('0x12'));_0x363105(_0x412f7f[_0x4c47('0x18')]['message']);}})[_0x4c47('0x19')](function(_0x4bdec5){logger[_0x4c47('0x15')](_0x4c47('0x11'),_0x56351b,_0x4bdec5);_0x596d97(_0x4bdec5);});});}exports[_0x4c47('0x1a')]=function(_0x2d3578){var _0x17c0f2=this;return new Promise(function(_0x5e1000,_0x4e794b){return db[_0x4c47('0x1b')][_0x4c47('0x1c')](_0x2d3578['body'],{'raw':_0x2d3578['options']?_0x2d3578['options'][_0x4c47('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d3578['options']?_0x2d3578[_0x4c47('0x1e')][_0x4c47('0x1f')]||null:null,'attributes':_0x2d3578[_0x4c47('0x1e')]?_0x2d3578[_0x4c47('0x1e')]['attributes']||null:null,'limit':_0x2d3578[_0x4c47('0x1e')]?_0x2d3578[_0x4c47('0x1e')][_0x4c47('0x20')]||null:null})[_0x4c47('0xf')](function(_0x20a47a){logger[_0x4c47('0x10')](_0x4c47('0x1a'),_0x2d3578);logger[_0x4c47('0x13')]('UpdateChatInteraction',_0x2d3578,JSON[_0x4c47('0x21')](_0x20a47a));_0x5e1000(_0x20a47a);})[_0x4c47('0x19')](function(_0x126733){logger[_0x4c47('0x15')](_0x4c47('0x1a'),_0x126733[_0x4c47('0x17')],_0x2d3578);_0x4e794b(_0x17c0f2[_0x4c47('0x15')](0x1f4,_0x126733[_0x4c47('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x1751a5){return new Promise(function(_0x14c8da,_0x5cc2f8){return db[_0x4c47('0x1b')][_0x4c47('0x22')]({'where':_0x1751a5[_0x4c47('0x1e')]?_0x1751a5[_0x4c47('0x1e')][_0x4c47('0x1f')]||null:null})['then'](function(_0x5e51d8){if(_0x5e51d8){return _0x5e51d8[_0x4c47('0x23')](_0x1751a5[_0x4c47('0x24')]['ids'],_[_0x4c47('0x25')](_0x1751a5[_0x4c47('0x24')],['ids','id'])||{});}})[_0x4c47('0x26')](function(_0x1aa752){logger[_0x4c47('0x10')]('AddTags',_0x1751a5);logger['debug']('AddTags',_0x1751a5,JSON['stringify'](_0x1aa752));_0x14c8da(_0x1aa752);})[_0x4c47('0x19')](function(_0x1c6b9d){logger['error'](_0x4c47('0x27'),_0x1c6b9d[_0x4c47('0x17')],_0x1751a5);_0x5cc2f8(_this[_0x4c47('0x15')](0x1f4,_0x1c6b9d['message']));});});}; \ No newline at end of file +var _0x8256=['debug','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','where','attributes','limit','AddTagsToChatInteraction','find','ids','omit','AddTags','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8256,0x18f));var _0x6825=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8256[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x6825('0x0'));var util=require(_0x6825('0x1'));var moment=require(_0x6825('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6825('0x3'));var db=require(_0x6825('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6825('0x5'))(_0x6825('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6825('0x7')][_0x6825('0x8')]({'port':0x232a});config[_0x6825('0x9')]=_[_0x6825('0xa')](config[_0x6825('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x6825('0xb'))(new Redis(config[_0x6825('0x9')]));require(_0x6825('0xc'))[_0x6825('0xd')](socket);function respondWithRpcPromise(_0x44e9fe,_0x53351c,_0x47f698){return new BPromise(function(_0x12561f,_0x4f40c4){return client[_0x6825('0xe')](_0x44e9fe,_0x47f698)[_0x6825('0xf')](function(_0x134e06){logger[_0x6825('0x10')](_0x6825('0x11'),_0x53351c,_0x6825('0x12'));logger[_0x6825('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x53351c,_0x6825('0x12'),JSON['stringify'](_0x134e06));if(_0x134e06[_0x6825('0x14')]){if(_0x134e06[_0x6825('0x14')][_0x6825('0x15')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x53351c,_0x134e06['error'][_0x6825('0x16')]);return _0x4f40c4(_0x134e06[_0x6825('0x14')][_0x6825('0x16')]);}logger['error'](_0x6825('0x11'),_0x53351c,_0x134e06[_0x6825('0x14')][_0x6825('0x16')]);return _0x12561f(_0x134e06[_0x6825('0x14')][_0x6825('0x16')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x53351c,_0x6825('0x12'));_0x12561f(_0x134e06[_0x6825('0x17')][_0x6825('0x16')]);}})[_0x6825('0x18')](function(_0x442d73){logger[_0x6825('0x14')](_0x6825('0x11'),_0x53351c,_0x442d73);_0x4f40c4(_0x442d73);});});}exports[_0x6825('0x19')]=function(_0x2fe177){var _0x3dc6ea=this;return new Promise(function(_0x3e82f3,_0x1141ca){return db[_0x6825('0x1a')]['update'](_0x2fe177[_0x6825('0x1b')],{'raw':_0x2fe177['options']?_0x2fe177[_0x6825('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fe177[_0x6825('0x1c')]?_0x2fe177['options'][_0x6825('0x1d')]||null:null,'attributes':_0x2fe177[_0x6825('0x1c')]?_0x2fe177[_0x6825('0x1c')][_0x6825('0x1e')]||null:null,'limit':_0x2fe177[_0x6825('0x1c')]?_0x2fe177[_0x6825('0x1c')][_0x6825('0x1f')]||null:null})[_0x6825('0xf')](function(_0x5d94e8){logger[_0x6825('0x10')](_0x6825('0x19'),_0x2fe177);logger[_0x6825('0x13')](_0x6825('0x19'),_0x2fe177,JSON['stringify'](_0x5d94e8));_0x3e82f3(_0x5d94e8);})['catch'](function(_0x13ad94){logger[_0x6825('0x14')](_0x6825('0x19'),_0x13ad94[_0x6825('0x16')],_0x2fe177);_0x1141ca(_0x3dc6ea[_0x6825('0x14')](0x1f4,_0x13ad94['message']));});});};exports[_0x6825('0x20')]=function(_0x29a526){return new Promise(function(_0x2e3abd,_0x43a8f5){return db[_0x6825('0x1a')][_0x6825('0x21')]({'where':_0x29a526[_0x6825('0x1c')]?_0x29a526[_0x6825('0x1c')][_0x6825('0x1d')]||null:null})[_0x6825('0xf')](function(_0x2cef59){if(_0x2cef59){return _0x2cef59['addTags'](_0x29a526['body'][_0x6825('0x22')],_[_0x6825('0x23')](_0x29a526[_0x6825('0x1b')],[_0x6825('0x22'),'id'])||{});}})['spread'](function(_0x453029){logger[_0x6825('0x10')](_0x6825('0x24'),_0x29a526);logger[_0x6825('0x13')](_0x6825('0x24'),_0x29a526,JSON[_0x6825('0x25')](_0x453029));_0x2e3abd(_0x453029);})[_0x6825('0x18')](function(_0x215a30){logger[_0x6825('0x14')](_0x6825('0x24'),_0x215a30[_0x6825('0x16')],_0x29a526);_0x43a8f5(_this[_0x6825('0x14')](0x1f4,_0x215a30['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 9f38d22..1933eb9 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 _0x453a=['save','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x453a,0x8b));var _0xa453=function(_0x57de35,_0x2ef99a){_0x57de35=_0x57de35-0x0;var _0x2a94eb=_0x453a[_0x57de35];return _0x2a94eb;};'use strict';var ChatInteractionEvents=require(_0xa453('0x0'));var events=[_0xa453('0x1'),'remove','update'];function createListener(_0x964877,_0x382b33){return function(_0x3e09ea){_0x382b33[_0xa453('0x2')](_0x964877,_0x3e09ea);};}function removeListener(_0x24d284,_0x1d24a9){return function(){ChatInteractionEvents[_0xa453('0x3')](_0x24d284,_0x1d24a9);};}exports[_0xa453('0x4')]=function(_0x5bf452){for(var _0x394f72=0x0,_0xd21183=events[_0xa453('0x5')];_0x394f72<_0xd21183;_0x394f72++){var _0x4f83de=events[_0x394f72];var _0xa06651=createListener(_0xa453('0x6')+_0x4f83de,_0x5bf452);ChatInteractionEvents['on'](_0x4f83de,_0xa06651);}}; \ No newline at end of file +var _0x3f91=['update','emit','removeListener','register','length','chatInteraction:','remove'];(function(_0x5aa4de,_0x2fe372){var _0x4f8e5f=function(_0x373225){while(--_0x373225){_0x5aa4de['push'](_0x5aa4de['shift']());}};_0x4f8e5f(++_0x2fe372);}(_0x3f91,0x99));var _0x13f9=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3f91[_0x4b055c];return _0x4b62bb;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x13f9('0x0'),_0x13f9('0x1')];function createListener(_0x4078bf,_0x4baca5){return function(_0x2ccd9e){_0x4baca5[_0x13f9('0x2')](_0x4078bf,_0x2ccd9e);};}function removeListener(_0x66b68f,_0x1fa737){return function(){ChatInteractionEvents[_0x13f9('0x3')](_0x66b68f,_0x1fa737);};}exports[_0x13f9('0x4')]=function(_0x5b6ad9){for(var _0x537190=0x0,_0x273cf5=events[_0x13f9('0x5')];_0x537190<_0x273cf5;_0x537190++){var _0x335efe=events[_0x537190];var _0x322e0a=createListener(_0x13f9('0x6')+_0x335efe,_0x5b6ad9);ChatInteractionEvents['on'](_0x335efe,_0x322e0a);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index c28d2e1..897509f 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 _0xb8d6=['chat','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','index','get','isAuthenticated','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','post','/:id/messages','/:id/tags','chatinteraction:addtags','addTags','put','/:id','tracked'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xb8d6,0x70));var _0x6b8d=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xb8d6[_0x484e36];return _0xafc85d;};'use strict';var multer=require('multer');var util=require(_0x6b8d('0x0'));var path=require(_0x6b8d('0x1'));var timeout=require('connect-timeout');var express=require(_0x6b8d('0x2'));var router=express[_0x6b8d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6b8d('0x4'));var interaction=require(_0x6b8d('0x5'));var config=require('../../config/environment');var controller=require(_0x6b8d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6b8d('0x7')]);router[_0x6b8d('0x8')]('/describe',auth[_0x6b8d('0x9')](),controller['describe']);router[_0x6b8d('0x8')]('/:id',auth[_0x6b8d('0xa')](),controller[_0x6b8d('0xb')]);router[_0x6b8d('0x8')](_0x6b8d('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x6b8d('0xd')]);router[_0x6b8d('0x8')]('/:id/messages',auth[_0x6b8d('0x9')](),controller[_0x6b8d('0xe')]);router[_0x6b8d('0x8')](_0x6b8d('0xf'),auth[_0x6b8d('0xa')](),controller[_0x6b8d('0x10')]);router[_0x6b8d('0x8')](_0x6b8d('0x11'),auth[_0x6b8d('0x9')](),controller[_0x6b8d('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6b8d('0x13')]);router['post'](_0x6b8d('0x14'),auth[_0x6b8d('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x6b8d('0x15')]({'destination':function(_0x307292,_0x657d45,_0x517745){_0x517745(null,path[_0x6b8d('0x16')](config[_0x6b8d('0x17')],_0x6b8d('0x18')));},'filename':function(_0x587d21,_0x422f29,_0x181fe4){_0x181fe4(null,util[_0x6b8d('0x19')](_0x6b8d('0x1a'),Date[_0x6b8d('0x1b')](),_0x422f29[_0x6b8d('0x1c')][_0x6b8d('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x6b8d('0x1e'),upload[_0x6b8d('0x1f')]('file'),controller[_0x6b8d('0x20')]);router[_0x6b8d('0x21')](_0x6b8d('0x22'),auth[_0x6b8d('0xa')](),controller['addMessage']);router[_0x6b8d('0x21')](_0x6b8d('0x23'),auth[_0x6b8d('0x9')](),interaction['tracked']('chat',_0x6b8d('0x24')),controller[_0x6b8d('0x25')]);router[_0x6b8d('0x26')](_0x6b8d('0x27'),auth[_0x6b8d('0x9')](),interaction[_0x6b8d('0x28')](_0x6b8d('0x29'),'chatinteraction:update'),controller['update']);router[_0x6b8d('0x26')]('/:id/custom_update',controller[_0x6b8d('0x2a')]);router[_0x6b8d('0x26')](_0x6b8d('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0x6b8d('0x2c')]);router[_0x6b8d('0x26')](_0x6b8d('0x2d'),controller[_0x6b8d('0x2e')]);router[_0x6b8d('0x2f')](_0x6b8d('0x27'),auth[_0x6b8d('0x9')](),interaction[_0x6b8d('0x28')](_0x6b8d('0x29'),'chatinteraction:destroy'),controller[_0x6b8d('0x30')]);router[_0x6b8d('0x2f')]('/:id/tags',auth[_0x6b8d('0x9')](),controller[_0x6b8d('0x31')]);module[_0x6b8d('0x32')]=router; \ No newline at end of file +var _0x05aa=['join','root','server/files/attachments/','format','originalname','replace','/:id/attachment_upload','single','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chat','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','getMessages','getMyMessages','download','post','/:id/vidaoo','diskStorage'];(function(_0x24fded,_0x2b5129){var _0x2b6de2=function(_0x39ece0){while(--_0x39ece0){_0x24fded['push'](_0x24fded['shift']());}};_0x2b6de2(++_0x2b5129);}(_0x05aa,0xbf));var _0xa05a=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x05aa[_0x341e0f];return _0x59555a;};'use strict';var multer=require(_0xa05a('0x0'));var util=require(_0xa05a('0x1'));var path=require(_0xa05a('0x2'));var timeout=require(_0xa05a('0x3'));var express=require(_0xa05a('0x4'));var router=express[_0xa05a('0x5')]();var fs_extra=require(_0xa05a('0x6'));var auth=require(_0xa05a('0x7'));var interaction=require(_0xa05a('0x8'));var config=require(_0xa05a('0x9'));var controller=require(_0xa05a('0xa'));router[_0xa05a('0xb')]('/',auth[_0xa05a('0xc')](),controller[_0xa05a('0xd')]);router['get'](_0xa05a('0xe'),auth[_0xa05a('0xc')](),controller[_0xa05a('0xf')]);router['get'](_0xa05a('0x10'),auth[_0xa05a('0x11')](),controller['show']);router[_0xa05a('0xb')](_0xa05a('0x12'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0xa05a('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xa05a('0x13')]);router[_0xa05a('0xb')]('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller[_0xa05a('0x14')]);router[_0xa05a('0xb')]('/:id/download',auth[_0xa05a('0xc')](),controller[_0xa05a('0x15')]);router[_0xa05a('0x16')]('/',auth[_0xa05a('0xc')](),controller['create']);router[_0xa05a('0x16')](_0xa05a('0x17'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xa05a('0x18')]({'destination':function(_0x3b0bf2,_0x52ff22,_0x2aac9f){_0x2aac9f(null,path[_0xa05a('0x19')](config[_0xa05a('0x1a')],_0xa05a('0x1b')));},'filename':function(_0x97e53e,_0x1b2dd8,_0x19ea8c){_0x19ea8c(null,util[_0xa05a('0x1c')]('%s-%s',Date['now'](),_0x1b2dd8[_0xa05a('0x1d')][_0xa05a('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa05a('0x16')](_0xa05a('0x1f'),upload[_0xa05a('0x20')]('file'),controller[_0xa05a('0x21')]);router[_0xa05a('0x16')](_0xa05a('0x22'),auth[_0xa05a('0x11')](),controller[_0xa05a('0x23')]);router[_0xa05a('0x16')](_0xa05a('0x24'),auth['isAuthenticated'](),interaction[_0xa05a('0x25')]('chat',_0xa05a('0x26')),controller[_0xa05a('0x27')]);router['put'](_0xa05a('0x10'),auth[_0xa05a('0xc')](),interaction['tracked']('chat',_0xa05a('0x28')),controller[_0xa05a('0x29')]);router[_0xa05a('0x2a')](_0xa05a('0x2b'),controller[_0xa05a('0x2c')]);router[_0xa05a('0x2a')](_0xa05a('0x2d'),auth[_0xa05a('0x11')](),controller[_0xa05a('0x2e')]);router[_0xa05a('0x2a')](_0xa05a('0x2f'),controller[_0xa05a('0x30')]);router[_0xa05a('0x31')](_0xa05a('0x10'),auth[_0xa05a('0xc')](),interaction['tracked'](_0xa05a('0x32'),'chatinteraction:destroy'),controller[_0xa05a('0x33')]);router[_0xa05a('0x31')](_0xa05a('0x24'),auth[_0xa05a('0xc')](),controller[_0xa05a('0x34')]);module[_0xa05a('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 70594a7..dbe03e8 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 _0x8669=['TEXT','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x8669,0x99));var _0x9866=function(_0x43e372,_0x1cc703){_0x43e372=_0x43e372-0x0;var _0x29d492=_0x8669[_0x43e372];return _0x29d492;};'use strict';var Sequelize=require(_0x9866('0x0'));module[_0x9866('0x1')]={'body':{'type':Sequelize[_0x9866('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9866('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9866('0x4')]}}; \ No newline at end of file +var _0x5278=['medium','INTEGER','sequelize','exports'];(function(_0x48a1ea,_0x56a536){var _0x348256=function(_0x4f83bc){while(--_0x4f83bc){_0x48a1ea['push'](_0x48a1ea['shift']());}};_0x348256(++_0x56a536);}(_0x5278,0x106));var _0x8527=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x5278[_0x58dc25];return _0x21b0a7;};'use strict';var Sequelize=require(_0x8527('0x0'));module[_0x8527('0x1')]={'body':{'type':Sequelize['TEXT'](_0x8527('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8527('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e797cf4..939d3f8 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 _0xbc18=['Agents','userProfileId','UserProfileResource','agent','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','stack','name','send','index','map','ChatInternalMessage','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xbc18,0x7e));var _0x8bc1=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0xbc18[_0xdeac17];return _0x33aabd;};'use strict';var emlformat=require(_0x8bc1('0x0'));var rimraf=require(_0x8bc1('0x1'));var zipdir=require(_0x8bc1('0x2'));var jsonpatch=require(_0x8bc1('0x3'));var rp=require(_0x8bc1('0x4'));var moment=require(_0x8bc1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8bc1('0x6'));var util=require(_0x8bc1('0x7'));var path=require(_0x8bc1('0x8'));var sox=require(_0x8bc1('0x9'));var csv=require(_0x8bc1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8bc1('0xb'));var _=require(_0x8bc1('0xc'));var squel=require(_0x8bc1('0xd'));var crypto=require(_0x8bc1('0xe'));var jsforce=require(_0x8bc1('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8bc1('0x10'));var Papa=require(_0x8bc1('0x11'));var Redis=require(_0x8bc1('0x12'));var authService=require(_0x8bc1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8bc1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bc1('0x15'))(_0x8bc1('0x16'));var utils=require(_0x8bc1('0x17'));var config=require(_0x8bc1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bc1('0x19'))['db'];config[_0x8bc1('0x1a')]=_[_0x8bc1('0x1b')](config['redis'],{'host':_0x8bc1('0x1c'),'port':0x18eb});var socket=require(_0x8bc1('0x1d'))(new Redis(config[_0x8bc1('0x1a')]));require(_0x8bc1('0x1e'))[_0x8bc1('0x1f')](socket);function respondWithStatusCode(_0x1fad03,_0x1dec5e){_0x1dec5e=_0x1dec5e||0xcc;return function(_0x1c484c){if(_0x1c484c){return _0x1fad03[_0x8bc1('0x20')](_0x1dec5e);}return _0x1fad03[_0x8bc1('0x21')](_0x1dec5e)[_0x8bc1('0x22')]();};}function respondWithResult(_0x268cd3,_0x5f444d){_0x5f444d=_0x5f444d||0xc8;return function(_0x546335){if(_0x546335){return _0x268cd3[_0x8bc1('0x21')](_0x5f444d)['json'](_0x546335);}};}function respondWithFilteredResult(_0x6eaede,_0x52e946){return function(_0x3d769e){if(_0x3d769e){var _0x44822b=typeof _0x52e946[_0x8bc1('0x23')]===_0x8bc1('0x24')&&typeof _0x52e946[_0x8bc1('0x25')]==='undefined';var _0x2b4811=_0x3d769e[_0x8bc1('0x26')];var _0xf6c417=_0x44822b?0x0:_0x52e946[_0x8bc1('0x23')];var _0x34302d=_0x44822b?_0x3d769e['count']:_0x52e946['offset']+_0x52e946[_0x8bc1('0x25')];var _0xb05f29;if(_0x34302d>=_0x2b4811){_0x34302d=_0x2b4811;_0xb05f29=0xc8;}else{_0xb05f29=0xce;}_0x6eaede[_0x8bc1('0x21')](_0xb05f29);return _0x6eaede[_0x8bc1('0x27')](_0x8bc1('0x28'),_0xf6c417+'-'+_0x34302d+'/'+_0x2b4811)[_0x8bc1('0x29')](_0x3d769e);}return null;};}function patchUpdates(_0x2d19ce){return function(_0x500307){try{jsonpatch['apply'](_0x500307,_0x2d19ce,!![]);}catch(_0x2c6fdd){return BPromise[_0x8bc1('0x2a')](_0x2c6fdd);}return _0x500307['save']();};}function saveUpdates(_0x187aa6,_0x19d309){return function(_0x1b13ec){if(_0x1b13ec){return _0x1b13ec[_0x8bc1('0x2b')](_0x187aa6)[_0x8bc1('0x2c')](function(_0x2a6e68){return _0x2a6e68;});}return null;};}function removeEntity(_0x19aaf0,_0x1cf4eb){return function(_0x56ee5c){if(_0x56ee5c){return _0x56ee5c[_0x8bc1('0x2d')]()[_0x8bc1('0x2c')](function(){_0x19aaf0[_0x8bc1('0x21')](0xcc)[_0x8bc1('0x22')]();});}};}function handleEntityNotFound(_0x1e75c9,_0x3f94f3){return function(_0x5e4404){if(!_0x5e4404){_0x1e75c9[_0x8bc1('0x20')](0x194);}return _0x5e4404;};}function handleError(_0x12922b,_0x498931){_0x498931=_0x498931||0x1f4;return function(_0x1e3173){logger['error'](_0x1e3173[_0x8bc1('0x2e')]);if(_0x1e3173['name']){delete _0x1e3173[_0x8bc1('0x2f')];}_0x12922b[_0x8bc1('0x21')](_0x498931)[_0x8bc1('0x30')](_0x1e3173);};}exports[_0x8bc1('0x31')]=function(_0x34be12,_0x16ccd4){var _0x14bf96={},_0x481227={},_0x526d75={'count':0x0,'rows':[]};var _0xa47735=_[_0x8bc1('0x32')](db[_0x8bc1('0x33')]['rawAttributes'],function(_0x32982b){return{'name':_0x32982b[_0x8bc1('0x34')],'type':_0x32982b[_0x8bc1('0x35')][_0x8bc1('0x36')]};});_0x481227[_0x8bc1('0x37')]=_[_0x8bc1('0x32')](_0xa47735,_0x8bc1('0x2f'));_0x481227[_0x8bc1('0x38')]=_[_0x8bc1('0x39')](_0x34be12[_0x8bc1('0x38')]);_0x481227[_0x8bc1('0x3a')]=_['intersection'](_0x481227['model'],_0x481227[_0x8bc1('0x38')]);_0x14bf96[_0x8bc1('0x3b')]=_[_0x8bc1('0x3c')](_0x481227[_0x8bc1('0x37')],qs[_0x8bc1('0x3d')](_0x34be12[_0x8bc1('0x38')][_0x8bc1('0x3d')]));_0x14bf96['attributes']=_0x14bf96[_0x8bc1('0x3b')][_0x8bc1('0x3e')]?_0x14bf96[_0x8bc1('0x3b')]:_0x481227[_0x8bc1('0x37')];if(!_0x34be12[_0x8bc1('0x38')][_0x8bc1('0x3f')](_0x8bc1('0x40'))){_0x14bf96[_0x8bc1('0x25')]=qs['limit'](_0x34be12[_0x8bc1('0x38')][_0x8bc1('0x25')]);_0x14bf96[_0x8bc1('0x23')]=qs['offset'](_0x34be12[_0x8bc1('0x38')][_0x8bc1('0x23')]);}_0x14bf96['order']=qs[_0x8bc1('0x41')](_0x34be12['query'][_0x8bc1('0x41')]);_0x14bf96[_0x8bc1('0x42')]=qs[_0x8bc1('0x3a')](_[_0x8bc1('0x43')](_0x34be12[_0x8bc1('0x38')],_0x481227[_0x8bc1('0x3a')]),_0xa47735);if(_0x34be12[_0x8bc1('0x38')]['filter']){_0x14bf96[_0x8bc1('0x42')]=_[_0x8bc1('0x44')](_0x14bf96[_0x8bc1('0x42')],{'$or':_[_0x8bc1('0x32')](_0xa47735,function(_0x42af36){if(_0x42af36[_0x8bc1('0x35')]!==_0x8bc1('0x45')){var _0x245012={};_0x245012[_0x42af36[_0x8bc1('0x2f')]]={'$like':'%'+_0x34be12['query'][_0x8bc1('0x46')]+'%'};return _0x245012;}})});}_0x14bf96=_['merge']({},_0x14bf96,_0x34be12[_0x8bc1('0x47')]);var _0x8c7c58={'where':_0x14bf96[_0x8bc1('0x42')]};return db[_0x8bc1('0x33')]['count'](_0x8c7c58)[_0x8bc1('0x2c')](function(_0x485793){_0x526d75['count']=_0x485793;if(_0x34be12[_0x8bc1('0x38')][_0x8bc1('0x48')]){_0x14bf96[_0x8bc1('0x49')]=[{'all':!![]}];}return db[_0x8bc1('0x33')][_0x8bc1('0x4a')](_0x14bf96);})[_0x8bc1('0x2c')](function(_0x24b522){_0x526d75[_0x8bc1('0x4b')]=_0x24b522;return _0x526d75;})['then'](respondWithFilteredResult(_0x16ccd4,_0x14bf96))[_0x8bc1('0x4c')](handleError(_0x16ccd4,null));};exports[_0x8bc1('0x4d')]=function(_0x233d7b,_0x393ff8){var _0x28f26e={'raw':!![],'where':{'id':_0x233d7b[_0x8bc1('0x4e')]['id']}},_0x3ef639={};_0x3ef639[_0x8bc1('0x37')]=_[_0x8bc1('0x39')](db[_0x8bc1('0x33')]['rawAttributes']);_0x3ef639['query']=_['keys'](_0x233d7b['query']);_0x3ef639[_0x8bc1('0x3a')]=_[_0x8bc1('0x3c')](_0x3ef639[_0x8bc1('0x37')],_0x3ef639[_0x8bc1('0x38')]);_0x28f26e[_0x8bc1('0x3b')]=_['intersection'](_0x3ef639['model'],qs['fields'](_0x233d7b[_0x8bc1('0x38')][_0x8bc1('0x3d')]));_0x28f26e[_0x8bc1('0x3b')]=_0x28f26e[_0x8bc1('0x3b')][_0x8bc1('0x3e')]?_0x28f26e[_0x8bc1('0x3b')]:_0x3ef639[_0x8bc1('0x37')];if(_0x233d7b[_0x8bc1('0x38')][_0x8bc1('0x48')]){_0x28f26e['include']=[{'all':!![]}];}_0x28f26e=_[_0x8bc1('0x44')]({},_0x28f26e,_0x233d7b[_0x8bc1('0x47')]);return db[_0x8bc1('0x33')][_0x8bc1('0x4f')](_0x28f26e)[_0x8bc1('0x2c')](handleEntityNotFound(_0x393ff8,null))[_0x8bc1('0x2c')](respondWithResult(_0x393ff8,null))['catch'](handleError(_0x393ff8,null));};exports[_0x8bc1('0x50')]=function(_0x5c5622,_0x183790){return db[_0x8bc1('0x33')][_0x8bc1('0x50')](_0x5c5622['body'],{})[_0x8bc1('0x2c')](respondWithResult(_0x183790,0xc9))[_0x8bc1('0x4c')](handleError(_0x183790,null));};exports[_0x8bc1('0x2b')]=function(_0x118fc4,_0x4f676b){if(_0x118fc4[_0x8bc1('0x51')]['id']){delete _0x118fc4[_0x8bc1('0x51')]['id'];}return db['ChatInternalMessage'][_0x8bc1('0x4f')]({'where':{'id':_0x118fc4[_0x8bc1('0x4e')]['id']}})[_0x8bc1('0x2c')](handleEntityNotFound(_0x4f676b,null))[_0x8bc1('0x2c')](saveUpdates(_0x118fc4[_0x8bc1('0x51')],null))[_0x8bc1('0x2c')](respondWithResult(_0x4f676b,null))['catch'](handleError(_0x4f676b,null));};exports[_0x8bc1('0x2d')]=function(_0x4c99e6,_0x5dad7a){return db['ChatInternalMessage'][_0x8bc1('0x4f')]({'where':{'id':_0x4c99e6['params']['id']}})[_0x8bc1('0x2c')](handleEntityNotFound(_0x5dad7a,null))[_0x8bc1('0x2c')](removeEntity(_0x5dad7a,null))[_0x8bc1('0x4c')](handleError(_0x5dad7a,null));};exports[_0x8bc1('0x52')]=function(_0x1eb8f4,_0x514e44){return db[_0x8bc1('0x33')][_0x8bc1('0x52')]()[_0x8bc1('0x2c')](respondWithResult(_0x514e44,null))['catch'](handleError(_0x514e44,null));};function wrapUser(_0x151f8f){return function(_0x2a9efe){var _0x352866=_0x151f8f[_0x8bc1('0x53')]({'plain':!![]});_0x352866[_0x8bc1('0x54')]=[];if(_0x2a9efe){_0x352866[_0x8bc1('0x55')]=_0x2a9efe[_0x8bc1('0x56')];_0x352866[_0x8bc1('0x57')]=_0x2a9efe;}else{_0x352866[_0x8bc1('0x55')]=moment(0x0)[_0x8bc1('0x58')](_0x8bc1('0x59'));_0x352866[_0x8bc1('0x57')]={};}return _0x352866;};}exports[_0x8bc1('0x5a')]=function(_0x224be4,_0x3a07ba,_0xd4975c){var _0x1275d7=[];return db[_0x8bc1('0x5b')]['findAll']({'where':{'role':['agent',_0x8bc1('0x5c'),_0x8bc1('0x5d')]},'attributes':['id',_0x8bc1('0x5e'),'name',_0x8bc1('0x5f'),_0x8bc1('0x60'),_0x8bc1('0x61'),_0x8bc1('0x62'),_0x8bc1('0x63'),_0x8bc1('0x64'),'showWebBar'],'order':qs['sort'](_0x8bc1('0x65')),'include':[{'model':db[_0x8bc1('0x66')],'as':_0x8bc1('0x67'),'attributes':['id',_0x8bc1('0x2f'),_0x8bc1('0x35')],'through':{'attributes':[]}}]})[_0x8bc1('0x2c')](function(_0x2a21df){if(_0x2a21df){var _0x5ab56b=_0x224be4['user']['get']({'plain':!![]});if(!_0x5ab56b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ab56b['role']===_0x8bc1('0x5d')){return db['UserProfileSection'][_0x8bc1('0x4f')]({'where':{'name':_0x8bc1('0x68'),'userProfileId':_0x5ab56b[_0x8bc1('0x69')]},'raw':!![]})[_0x8bc1('0x2c')](function(_0x41b576){if(_0x41b576){if(_0x41b576['autoAssociation']===0x0){return db[_0x8bc1('0x6a')][_0x8bc1('0x4a')]({'where':{'sectionId':_0x41b576['id']},'raw':!![]})[_0x8bc1('0x2c')](function(_0x360517){var _0x4e2ed=[];if(_['isEmpty'](_0x360517)){_0x4e2ed=_[_0x8bc1('0x46')](_0x2a21df,function(_0x2c01da){if(_0x2c01da[_0x8bc1('0x5f')]!==_0x8bc1('0x6b')){return _0x2c01da;}});return _0x4e2ed;}else{for(var _0x17cb21=0x0;_0x17cb21<_0x2a21df[_0x8bc1('0x3e')];_0x17cb21++){var _0x4c07e2=_0x2a21df[_0x17cb21];if(_0x4c07e2['role']===_0x8bc1('0x6b')){var _0x39fc0e=_['find'](_0x360517,function(_0x1ba0d5){return _0x1ba0d5[_0x8bc1('0x6c')]===_0x4c07e2['id'];});if(_0x39fc0e)_0x4e2ed['push'](_0x4c07e2);}else{_0x4e2ed[_0x8bc1('0x6d')](_0x4c07e2);}}return _0x4e2ed;}});}else{return _0x2a21df;}}else{var _0x5143d6=_['filter'](_0x2a21df,function(_0x1bd191){if(_0x1bd191[_0x8bc1('0x5f')]!=='agent'){return _0x1bd191;}});return _0x5143d6;}});}else{return _0x2a21df;}}})[_0x8bc1('0x2c')](function(_0x1bdb98){var _0x7447ef=[];if(_0x1bdb98){_0x1275d7=_0x1bdb98;for(var _0x102396=0x0;_0x102396<_0x1bdb98[_0x8bc1('0x3e')];_0x102396+=0x1){_0x1275d7[_0x102396][_0x8bc1('0x54')]=[];_0x7447ef[_0x8bc1('0x6d')](db[_0x8bc1('0x33')][_0x8bc1('0x4f')]({'where':{'FromId':[_0x224be4[_0x8bc1('0x5d')]['id'],_0x1bdb98[_0x102396]['id']],'ToId':[_0x224be4[_0x8bc1('0x5d')]['id'],_0x1bdb98[_0x102396]['id']],'ChatGroupId':null},'attributes':['id',_0x8bc1('0x56'),_0x8bc1('0x6e'),_0x8bc1('0x6f'),_0x8bc1('0x70'),_0x8bc1('0x51')],'order':qs[_0x8bc1('0x41')](_0x8bc1('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x8bc1('0x2c')](wrapUser(_0x1bdb98[_0x102396])));}return BPromise[_0x8bc1('0x72')](_0x7447ef);}return[];})[_0x8bc1('0x2c')](function(_0x3c555b){return{'rows':_0x3c555b,'count':_0x3c555b[_0x8bc1('0x3e')]};})[_0x8bc1('0x2c')](respondWithResult(_0x3a07ba,null))[_0x8bc1('0x4c')](handleError(_0x3a07ba,null));}; \ No newline at end of file +var _0x625e=['ToId','read','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','ChatInternalMessage','includeAll','findAll','catch','show','params','keys','rawAttributes','length','include','merge','find','create','body','destroy','describe','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','push','messages','user','FromId'];(function(_0x3b4455,_0x3e4395){var _0x34dd09=function(_0x5006d3){while(--_0x5006d3){_0x3b4455['push'](_0x3b4455['shift']());}};_0x34dd09(++_0x3e4395);}(_0x625e,0x1ca));var _0xe625=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x625e[_0x1ad926];return _0x1b81dc;};'use strict';var emlformat=require(_0xe625('0x0'));var rimraf=require(_0xe625('0x1'));var zipdir=require(_0xe625('0x2'));var jsonpatch=require(_0xe625('0x3'));var rp=require(_0xe625('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe625('0x5'));var util=require(_0xe625('0x6'));var path=require(_0xe625('0x7'));var sox=require(_0xe625('0x8'));var csv=require(_0xe625('0x9'));var ejs=require(_0xe625('0xa'));var fs=require('fs');var fs_extra=require(_0xe625('0xb'));var _=require('lodash');var squel=require(_0xe625('0xc'));var crypto=require(_0xe625('0xd'));var jsforce=require(_0xe625('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe625('0x9'));var querystring=require(_0xe625('0xf'));var Papa=require('papaparse');var Redis=require(_0xe625('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe625('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe625('0x12'));var logger=require(_0xe625('0x13'))(_0xe625('0x14'));var utils=require(_0xe625('0x15'));var config=require(_0xe625('0x16'));var licenseUtil=require(_0xe625('0x17'));var db=require(_0xe625('0x18'))['db'];config[_0xe625('0x19')]=_[_0xe625('0x1a')](config[_0xe625('0x19')],{'host':_0xe625('0x1b'),'port':0x18eb});var socket=require(_0xe625('0x1c'))(new Redis(config[_0xe625('0x19')]));require('./chatInternalMessage.socket')[_0xe625('0x1d')](socket);function respondWithStatusCode(_0x17fd14,_0x3b05a8){_0x3b05a8=_0x3b05a8||0xcc;return function(_0x3e3a58){if(_0x3e3a58){return _0x17fd14['sendStatus'](_0x3b05a8);}return _0x17fd14[_0xe625('0x1e')](_0x3b05a8)[_0xe625('0x1f')]();};}function respondWithResult(_0x478076,_0x3683e5){_0x3683e5=_0x3683e5||0xc8;return function(_0x366fe0){if(_0x366fe0){return _0x478076[_0xe625('0x1e')](_0x3683e5)[_0xe625('0x20')](_0x366fe0);}};}function respondWithFilteredResult(_0x440d53,_0x482e88){return function(_0x5a83d7){if(_0x5a83d7){var _0x3957e7=typeof _0x482e88[_0xe625('0x21')]===_0xe625('0x22')&&typeof _0x482e88['limit']==='undefined';var _0x168224=_0x5a83d7['count'];var _0x4f5d23=_0x3957e7?0x0:_0x482e88[_0xe625('0x21')];var _0x41fe5b=_0x3957e7?_0x5a83d7[_0xe625('0x23')]:_0x482e88[_0xe625('0x21')]+_0x482e88[_0xe625('0x24')];var _0x538fb1;if(_0x41fe5b>=_0x168224){_0x41fe5b=_0x168224;_0x538fb1=0xc8;}else{_0x538fb1=0xce;}_0x440d53[_0xe625('0x1e')](_0x538fb1);return _0x440d53[_0xe625('0x25')](_0xe625('0x26'),_0x4f5d23+'-'+_0x41fe5b+'/'+_0x168224)[_0xe625('0x20')](_0x5a83d7);}return null;};}function patchUpdates(_0x4701f5){return function(_0x2f26df){try{jsonpatch[_0xe625('0x27')](_0x2f26df,_0x4701f5,!![]);}catch(_0x42e202){return BPromise['reject'](_0x42e202);}return _0x2f26df[_0xe625('0x28')]();};}function saveUpdates(_0x33ca10,_0x36785c){return function(_0x5c8b22){if(_0x5c8b22){return _0x5c8b22[_0xe625('0x29')](_0x33ca10)[_0xe625('0x2a')](function(_0x57cb91){return _0x57cb91;});}return null;};}function removeEntity(_0x4f6183,_0x21d5d5){return function(_0x59b7a3){if(_0x59b7a3){return _0x59b7a3['destroy']()[_0xe625('0x2a')](function(){_0x4f6183['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e33ad,_0xbe5949){return function(_0x44d6c0){if(!_0x44d6c0){_0x1e33ad[_0xe625('0x2b')](0x194);}return _0x44d6c0;};}function handleError(_0x162d29,_0x3e43f1){_0x3e43f1=_0x3e43f1||0x1f4;return function(_0x1e2de2){logger[_0xe625('0x2c')](_0x1e2de2[_0xe625('0x2d')]);if(_0x1e2de2[_0xe625('0x2e')]){delete _0x1e2de2[_0xe625('0x2e')];}_0x162d29[_0xe625('0x1e')](_0x3e43f1)[_0xe625('0x2f')](_0x1e2de2);};}exports[_0xe625('0x30')]=function(_0x3af6da,_0x4448a2){var _0x3ffacb={},_0x1489c9={},_0x278a4e={'count':0x0,'rows':[]};var _0x50d981=_['map'](db['ChatInternalMessage']['rawAttributes'],function(_0xcb4c5){return{'name':_0xcb4c5['fieldName'],'type':_0xcb4c5[_0xe625('0x31')][_0xe625('0x32')]};});_0x1489c9[_0xe625('0x33')]=_[_0xe625('0x34')](_0x50d981,_0xe625('0x2e'));_0x1489c9[_0xe625('0x35')]=_['keys'](_0x3af6da[_0xe625('0x35')]);_0x1489c9['filters']=_[_0xe625('0x36')](_0x1489c9[_0xe625('0x33')],_0x1489c9[_0xe625('0x35')]);_0x3ffacb[_0xe625('0x37')]=_['intersection'](_0x1489c9['model'],qs[_0xe625('0x38')](_0x3af6da[_0xe625('0x35')]['fields']));_0x3ffacb['attributes']=_0x3ffacb[_0xe625('0x37')]['length']?_0x3ffacb[_0xe625('0x37')]:_0x1489c9[_0xe625('0x33')];if(!_0x3af6da[_0xe625('0x35')][_0xe625('0x39')](_0xe625('0x3a'))){_0x3ffacb[_0xe625('0x24')]=qs['limit'](_0x3af6da[_0xe625('0x35')][_0xe625('0x24')]);_0x3ffacb[_0xe625('0x21')]=qs[_0xe625('0x21')](_0x3af6da[_0xe625('0x35')][_0xe625('0x21')]);}_0x3ffacb['order']=qs[_0xe625('0x3b')](_0x3af6da[_0xe625('0x35')][_0xe625('0x3b')]);_0x3ffacb[_0xe625('0x3c')]=qs[_0xe625('0x3d')](_[_0xe625('0x3e')](_0x3af6da[_0xe625('0x35')],_0x1489c9[_0xe625('0x3d')]),_0x50d981);if(_0x3af6da['query'][_0xe625('0x3f')]){_0x3ffacb[_0xe625('0x3c')]=_['merge'](_0x3ffacb[_0xe625('0x3c')],{'$or':_['map'](_0x50d981,function(_0x528849){if(_0x528849[_0xe625('0x31')]!==_0xe625('0x40')){var _0x20e49e={};_0x20e49e[_0x528849['name']]={'$like':'%'+_0x3af6da['query']['filter']+'%'};return _0x20e49e;}})});}_0x3ffacb=_['merge']({},_0x3ffacb,_0x3af6da[_0xe625('0x41')]);var _0x3d53bc={'where':_0x3ffacb['where']};return db[_0xe625('0x42')][_0xe625('0x23')](_0x3d53bc)[_0xe625('0x2a')](function(_0x2330f1){_0x278a4e[_0xe625('0x23')]=_0x2330f1;if(_0x3af6da[_0xe625('0x35')][_0xe625('0x43')]){_0x3ffacb['include']=[{'all':!![]}];}return db[_0xe625('0x42')][_0xe625('0x44')](_0x3ffacb);})[_0xe625('0x2a')](function(_0x2a5176){_0x278a4e['rows']=_0x2a5176;return _0x278a4e;})['then'](respondWithFilteredResult(_0x4448a2,_0x3ffacb))[_0xe625('0x45')](handleError(_0x4448a2,null));};exports[_0xe625('0x46')]=function(_0x17fe3b,_0x5e2847){var _0x3a7437={'raw':!![],'where':{'id':_0x17fe3b[_0xe625('0x47')]['id']}},_0x1cd86c={};_0x1cd86c[_0xe625('0x33')]=_[_0xe625('0x48')](db['ChatInternalMessage'][_0xe625('0x49')]);_0x1cd86c['query']=_[_0xe625('0x48')](_0x17fe3b[_0xe625('0x35')]);_0x1cd86c[_0xe625('0x3d')]=_[_0xe625('0x36')](_0x1cd86c[_0xe625('0x33')],_0x1cd86c[_0xe625('0x35')]);_0x3a7437['attributes']=_[_0xe625('0x36')](_0x1cd86c[_0xe625('0x33')],qs[_0xe625('0x38')](_0x17fe3b[_0xe625('0x35')][_0xe625('0x38')]));_0x3a7437[_0xe625('0x37')]=_0x3a7437[_0xe625('0x37')][_0xe625('0x4a')]?_0x3a7437[_0xe625('0x37')]:_0x1cd86c[_0xe625('0x33')];if(_0x17fe3b[_0xe625('0x35')][_0xe625('0x43')]){_0x3a7437[_0xe625('0x4b')]=[{'all':!![]}];}_0x3a7437=_[_0xe625('0x4c')]({},_0x3a7437,_0x17fe3b[_0xe625('0x41')]);return db[_0xe625('0x42')][_0xe625('0x4d')](_0x3a7437)[_0xe625('0x2a')](handleEntityNotFound(_0x5e2847,null))[_0xe625('0x2a')](respondWithResult(_0x5e2847,null))[_0xe625('0x45')](handleError(_0x5e2847,null));};exports['create']=function(_0x484b54,_0x4bebff){return db['ChatInternalMessage'][_0xe625('0x4e')](_0x484b54['body'],{})[_0xe625('0x2a')](respondWithResult(_0x4bebff,0xc9))[_0xe625('0x45')](handleError(_0x4bebff,null));};exports[_0xe625('0x29')]=function(_0x19e610,_0x457259){if(_0x19e610[_0xe625('0x4f')]['id']){delete _0x19e610[_0xe625('0x4f')]['id'];}return db['ChatInternalMessage'][_0xe625('0x4d')]({'where':{'id':_0x19e610[_0xe625('0x47')]['id']}})[_0xe625('0x2a')](handleEntityNotFound(_0x457259,null))[_0xe625('0x2a')](saveUpdates(_0x19e610[_0xe625('0x4f')],null))[_0xe625('0x2a')](respondWithResult(_0x457259,null))[_0xe625('0x45')](handleError(_0x457259,null));};exports[_0xe625('0x50')]=function(_0x35049e,_0x54dcd1){return db['ChatInternalMessage'][_0xe625('0x4d')]({'where':{'id':_0x35049e[_0xe625('0x47')]['id']}})['then'](handleEntityNotFound(_0x54dcd1,null))[_0xe625('0x2a')](removeEntity(_0x54dcd1,null))['catch'](handleError(_0x54dcd1,null));};exports[_0xe625('0x51')]=function(_0x5e6417,_0x52c155){return db[_0xe625('0x42')][_0xe625('0x51')]()[_0xe625('0x2a')](respondWithResult(_0x52c155,null))[_0xe625('0x45')](handleError(_0x52c155,null));};function wrapUser(_0x178f4d){return function(_0x44e4ef){var _0x2d5cca=_0x178f4d[_0xe625('0x52')]({'plain':!![]});_0x2d5cca['messages']=[];if(_0x44e4ef){_0x2d5cca[_0xe625('0x53')]=_0x44e4ef[_0xe625('0x54')];_0x2d5cca[_0xe625('0x55')]=_0x44e4ef;}else{_0x2d5cca[_0xe625('0x53')]=moment(0x0)[_0xe625('0x56')](_0xe625('0x57'));_0x2d5cca[_0xe625('0x55')]={};}return _0x2d5cca;};}exports[_0xe625('0x58')]=function(_0x193cf4,_0x586f0e,_0x3d92eb){var _0x195cb8=[];return db[_0xe625('0x59')][_0xe625('0x44')]({'where':{'role':[_0xe625('0x5a'),_0xe625('0x5b'),'user']},'attributes':['id',_0xe625('0x5c'),_0xe625('0x2e'),_0xe625('0x5d'),_0xe625('0x5e'),_0xe625('0x5f'),_0xe625('0x60'),_0xe625('0x61'),'allowmessenger',_0xe625('0x62')],'order':qs[_0xe625('0x3b')](_0xe625('0x63')),'include':[{'model':db[_0xe625('0x64')],'as':_0xe625('0x65'),'attributes':['id',_0xe625('0x2e'),_0xe625('0x31')],'through':{'attributes':[]}}]})[_0xe625('0x2a')](function(_0x41d69c){if(_0x41d69c){var _0x6916cc=_0x193cf4['user'][_0xe625('0x52')]({'plain':!![]});if(!_0x6916cc)throw new Error(_0xe625('0x66'));if(_0x6916cc[_0xe625('0x5d')]==='user'){return db[_0xe625('0x67')][_0xe625('0x4d')]({'where':{'name':_0xe625('0x68'),'userProfileId':_0x6916cc[_0xe625('0x69')]},'raw':!![]})[_0xe625('0x2a')](function(_0x50caeb){if(_0x50caeb){if(_0x50caeb['autoAssociation']===0x0){return db[_0xe625('0x6a')][_0xe625('0x44')]({'where':{'sectionId':_0x50caeb['id']},'raw':!![]})[_0xe625('0x2a')](function(_0x70482e){var _0x5acdb5=[];if(_[_0xe625('0x6b')](_0x70482e)){_0x5acdb5=_[_0xe625('0x3f')](_0x41d69c,function(_0x3cc305){if(_0x3cc305[_0xe625('0x5d')]!=='agent'){return _0x3cc305;}});return _0x5acdb5;}else{for(var _0x327c90=0x0;_0x327c90<_0x41d69c[_0xe625('0x4a')];_0x327c90++){var _0x311894=_0x41d69c[_0x327c90];if(_0x311894['role']===_0xe625('0x5a')){var _0x34da2b=_[_0xe625('0x4d')](_0x70482e,function(_0x41373b){return _0x41373b['resourceId']===_0x311894['id'];});if(_0x34da2b)_0x5acdb5['push'](_0x311894);}else{_0x5acdb5[_0xe625('0x6c')](_0x311894);}}return _0x5acdb5;}});}else{return _0x41d69c;}}else{var _0xf71963=_[_0xe625('0x3f')](_0x41d69c,function(_0x5c84a2){if(_0x5c84a2[_0xe625('0x5d')]!==_0xe625('0x5a')){return _0x5c84a2;}});return _0xf71963;}});}else{return _0x41d69c;}}})[_0xe625('0x2a')](function(_0x31804c){var _0x79aec1=[];if(_0x31804c){_0x195cb8=_0x31804c;for(var _0x336ccc=0x0;_0x336ccc<_0x31804c[_0xe625('0x4a')];_0x336ccc+=0x1){_0x195cb8[_0x336ccc][_0xe625('0x6d')]=[];_0x79aec1[_0xe625('0x6c')](db[_0xe625('0x42')][_0xe625('0x4d')]({'where':{'FromId':[_0x193cf4[_0xe625('0x6e')]['id'],_0x31804c[_0x336ccc]['id']],'ToId':[_0x193cf4[_0xe625('0x6e')]['id'],_0x31804c[_0x336ccc]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xe625('0x6f'),_0xe625('0x70'),_0xe625('0x71'),_0xe625('0x4f')],'order':qs[_0xe625('0x3b')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x31804c[_0x336ccc])));}return BPromise['all'](_0x79aec1);}return[];})[_0xe625('0x2a')](function(_0x10008c){return{'rows':_0x10008c,'count':_0x10008c[_0xe625('0x4a')]};})[_0xe625('0x2a')](respondWithResult(_0x586f0e,null))[_0xe625('0x45')](handleError(_0x586f0e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 4856fa7..47ad791 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 _0xd993=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x4d1667,_0x44ff2e){var _0x6a267f=function(_0x1269a0){while(--_0x1269a0){_0x4d1667['push'](_0x4d1667['shift']());}};_0x6a267f(++_0x44ff2e);}(_0xd993,0x19e));var _0x3d99=function(_0x1cca23,_0x228d03){_0x1cca23=_0x1cca23-0x0;var _0x38b568=_0xd993[_0x1cca23];return _0x38b568;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x3d99('0x0'))['db'][_0x3d99('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3d99('0x2')](0x0);var events={'afterCreate':_0x3d99('0x3'),'afterUpdate':_0x3d99('0x4'),'afterDestroy':_0x3d99('0x5')};function emitEvent(_0x1efa42){return function(_0x4ad11a,_0x104559,_0x5ec2d6){ChatInternalMessageEvents[_0x3d99('0x6')](_0x1efa42+':'+_0x4ad11a['id'],_0x4ad11a);ChatInternalMessageEvents[_0x3d99('0x6')](_0x1efa42,_0x4ad11a);_0x5ec2d6(null);};}for(var e in events){if(events[_0x3d99('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x3d99('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xa849=['events','ChatInternalMessage','setMaxListeners','update','remove','hasOwnProperty','exports'];(function(_0x416cdc,_0x213b87){var _0x1931ce=function(_0x1dc762){while(--_0x1dc762){_0x416cdc['push'](_0x416cdc['shift']());}};_0x1931ce(++_0x213b87);}(_0xa849,0x11f));var _0x9a84=function(_0x4d4c11,_0x4be6bd){_0x4d4c11=_0x4d4c11-0x0;var _0x429a6b=_0xa849[_0x4d4c11];return _0x429a6b;};'use strict';var EventEmitter=require(_0x9a84('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x9a84('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x9a84('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9a84('0x3'),'afterDestroy':_0x9a84('0x4')};function emitEvent(_0x1aa7e3){return function(_0x278daa,_0x51bbbb,_0x154305){ChatInternalMessageEvents['emit'](_0x1aa7e3+':'+_0x278daa['id'],_0x278daa);ChatInternalMessageEvents['emit'](_0x1aa7e3,_0x278daa);_0x154305(null);};}for(var e in events){if(events[_0x9a84('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x9a84('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 44cd292..7633dbb 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 _0x2a8f=['path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x2a8f,0xe9));var _0xf2a8=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0x2a8f[_0x12a554];return _0x244ba0;};'use strict';var _=require(_0xf2a8('0x0'));var util=require('util');var logger=require(_0xf2a8('0x1'))(_0xf2a8('0x2'));var moment=require('moment');var BPromise=require(_0xf2a8('0x3'));var rp=require(_0xf2a8('0x4'));var fs=require('fs');var path=require(_0xf2a8('0x5'));var rimraf=require(_0xf2a8('0x6'));var config=require(_0xf2a8('0x7'));var attributes=require(_0xf2a8('0x8'));module[_0xf2a8('0x9')]=function(_0x571d78,_0xe063ad){return _0x571d78[_0xf2a8('0xa')](_0xf2a8('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf2a8('0xc'),'collate':_0xf2a8('0xd')});}; \ No newline at end of file +var _0xe203=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','path','rimraf','./chatInternalMessage.attributes','define'];(function(_0x2a208d,_0x3aee8a){var _0xcd48af=function(_0x4e7812){while(--_0x4e7812){_0x2a208d['push'](_0x2a208d['shift']());}};_0xcd48af(++_0x3aee8a);}(_0xe203,0x175));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3e20('0x0'))('api');var moment=require(_0x3e20('0x1'));var BPromise=require(_0x3e20('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e20('0x3'));var rimraf=require(_0x3e20('0x4'));var config=require('../../config/environment');var attributes=require(_0x3e20('0x5'));module['exports']=function(_0x139d40,_0x3b5dc9){return _0x139d40[_0x3e20('0x6')](_0x3e20('0x7'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3e20('0x8'),'collate':_0x3e20('0x9')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 642ae23..733c484 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 _0xac21=['localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xac21,0x1af));var _0x1ac2=function(_0x471ce7,_0x23b291){_0x471ce7=_0x471ce7-0x0;var _0x3591ff=_0xac21[_0x471ce7];return _0x3591ff;};'use strict';var _=require('lodash');var util=require(_0x1ac2('0x0'));var moment=require(_0x1ac2('0x1'));var BPromise=require('bluebird');var rs=require(_0x1ac2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ac2('0x3'))['db'];var utils=require(_0x1ac2('0x4'));var logger=require('../../config/logger')(_0x1ac2('0x5'));var config=require('../../config/environment');var jayson=require(_0x1ac2('0x6'));var client=jayson[_0x1ac2('0x7')][_0x1ac2('0x8')]({'port':0x232a});config[_0x1ac2('0x9')]=_[_0x1ac2('0xa')](config[_0x1ac2('0x9')],{'host':_0x1ac2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ac2('0x9')]));require(_0x1ac2('0xc'))[_0x1ac2('0xd')](socket);function respondWithRpcPromise(_0x2ea4e1,_0x2f0079,_0x4a264a){return new BPromise(function(_0x50a79f,_0x469363){return client[_0x1ac2('0xe')](_0x2ea4e1,_0x4a264a)[_0x1ac2('0xf')](function(_0x225c01){logger[_0x1ac2('0x10')](_0x1ac2('0x11'),_0x2f0079,'request\x20sent');logger[_0x1ac2('0x12')](_0x1ac2('0x13'),_0x2f0079,_0x1ac2('0x14'),JSON[_0x1ac2('0x15')](_0x225c01));if(_0x225c01[_0x1ac2('0x16')]){if(_0x225c01[_0x1ac2('0x16')][_0x1ac2('0x17')]===0x1f4){logger[_0x1ac2('0x16')](_0x1ac2('0x11'),_0x2f0079,_0x225c01['error'][_0x1ac2('0x18')]);return _0x469363(_0x225c01[_0x1ac2('0x16')][_0x1ac2('0x18')]);}logger[_0x1ac2('0x16')](_0x1ac2('0x11'),_0x2f0079,_0x225c01[_0x1ac2('0x16')][_0x1ac2('0x18')]);return _0x50a79f(_0x225c01[_0x1ac2('0x16')]['message']);}else{logger[_0x1ac2('0x10')](_0x1ac2('0x11'),_0x2f0079,'request\x20sent');_0x50a79f(_0x225c01[_0x1ac2('0x19')][_0x1ac2('0x18')]);}})['catch'](function(_0x3c0300){logger['error'](_0x1ac2('0x11'),_0x2f0079,_0x3c0300);_0x469363(_0x3c0300);});});} \ No newline at end of file +var _0x07d7=['info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInternalMessage.socket','request'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x07d7,0x141));var _0x707d=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x07d7[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0x707d('0x0'));var util=require('util');var moment=require(_0x707d('0x1'));var BPromise=require('bluebird');var rs=require(_0x707d('0x2'));var fs=require('fs');var Redis=require(_0x707d('0x3'));var db=require(_0x707d('0x4'))['db'];var utils=require(_0x707d('0x5'));var logger=require('../../config/logger')(_0x707d('0x6'));var config=require(_0x707d('0x7'));var jayson=require(_0x707d('0x8'));var client=jayson[_0x707d('0x9')][_0x707d('0xa')]({'port':0x232a});config[_0x707d('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x707d('0xc'))(new Redis(config[_0x707d('0xb')]));require(_0x707d('0xd'))['register'](socket);function respondWithRpcPromise(_0x1fc8d1,_0x14cd43,_0xed4c66){return new BPromise(function(_0x9dbf89,_0x37dd09){return client[_0x707d('0xe')](_0x1fc8d1,_0xed4c66)['then'](function(_0x438464){logger[_0x707d('0xf')](_0x707d('0x10'),_0x14cd43,'request\x20sent');logger['debug'](_0x707d('0x11'),_0x14cd43,_0x707d('0x12'),JSON[_0x707d('0x13')](_0x438464));if(_0x438464[_0x707d('0x14')]){if(_0x438464['error'][_0x707d('0x15')]===0x1f4){logger[_0x707d('0x14')](_0x707d('0x10'),_0x14cd43,_0x438464['error'][_0x707d('0x16')]);return _0x37dd09(_0x438464[_0x707d('0x14')][_0x707d('0x16')]);}logger[_0x707d('0x14')](_0x707d('0x10'),_0x14cd43,_0x438464[_0x707d('0x14')][_0x707d('0x16')]);return _0x9dbf89(_0x438464[_0x707d('0x14')][_0x707d('0x16')]);}else{logger[_0x707d('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x14cd43,_0x707d('0x12'));_0x9dbf89(_0x438464['result'][_0x707d('0x16')]);}})[_0x707d('0x17')](function(_0x194335){logger['error'](_0x707d('0x10'),_0x14cd43,_0x194335);_0x37dd09(_0x194335);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c442b32..b7fcdd9 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 _0x29aa=['remove','update','emit','removeListener','register','length','./chatInternalMessage.events','save'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0x29aa,0x10e));var _0xa29a=function(_0x45d1bb,_0x35d9b4){_0x45d1bb=_0x45d1bb-0x0;var _0x4cdcba=_0x29aa[_0x45d1bb];return _0x4cdcba;};'use strict';var ChatInternalMessageEvents=require(_0xa29a('0x0'));var events=[_0xa29a('0x1'),_0xa29a('0x2'),_0xa29a('0x3')];function createListener(_0xcc3432,_0x1cb410){return function(_0x445902){_0x1cb410[_0xa29a('0x4')](_0xcc3432,_0x445902);};}function removeListener(_0x2dc5a5,_0x5b4053){return function(){ChatInternalMessageEvents[_0xa29a('0x5')](_0x2dc5a5,_0x5b4053);};}exports[_0xa29a('0x6')]=function(_0x5be15f){for(var _0x30a1b2=0x0,_0x48046c=events[_0xa29a('0x7')];_0x30a1b2<_0x48046c;_0x30a1b2++){var _0xf8165a=events[_0x30a1b2];var _0x50ba7c=createListener('chatInternalMessage:'+_0xf8165a,_0x5be15f);ChatInternalMessageEvents['on'](_0xf8165a,_0x50ba7c);}}; \ No newline at end of file +var _0xf185=['register','save','remove','emit','removeListener'];(function(_0x4a3fbb,_0x109a9f){var _0x23a67e=function(_0x2e2607){while(--_0x2e2607){_0x4a3fbb['push'](_0x4a3fbb['shift']());}};_0x23a67e(++_0x109a9f);}(_0xf185,0x164));var _0x5f18=function(_0x1d99f7,_0xebdd62){_0x1d99f7=_0x1d99f7-0x0;var _0x51a743=_0xf185[_0x1d99f7];return _0x51a743;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x5f18('0x0'),_0x5f18('0x1'),'update'];function createListener(_0x5ba06e,_0x387bd6){return function(_0x2daaa9){_0x387bd6[_0x5f18('0x2')](_0x5ba06e,_0x2daaa9);};}function removeListener(_0x4ece8a,_0x18398e){return function(){ChatInternalMessageEvents[_0x5f18('0x3')](_0x4ece8a,_0x18398e);};}exports[_0x5f18('0x4')]=function(_0x4de399){for(var _0x37e8ef=0x0,_0x577627=events['length'];_0x37e8ef<_0x577627;_0x37e8ef++){var _0x5d3129=events[_0x37e8ef];var _0x496c76=createListener('chatInternalMessage:'+_0x5d3129,_0x4de399);ChatInternalMessageEvents['on'](_0x5d3129,_0x496c76);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index d83804c..aa81935 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 _0x299d=['/describe','getUsers','/:id','post','put','delete','destroy','exports','path','connect-timeout','express','Router','./chatInternalMessage.controller','get','isAuthenticated','index'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x299d,0x168));var _0xd299=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x299d[_0x1d9aa0];return _0x226868;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd299('0x0'));var timeout=require(_0xd299('0x1'));var express=require(_0xd299('0x2'));var router=express[_0xd299('0x3')]();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(_0xd299('0x4'));router[_0xd299('0x5')]('/',auth[_0xd299('0x6')](),controller[_0xd299('0x7')]);router[_0xd299('0x5')](_0xd299('0x8'),auth[_0xd299('0x6')](),controller['describe']);router[_0xd299('0x5')]('/users',auth[_0xd299('0x6')](),controller[_0xd299('0x9')]);router[_0xd299('0x5')](_0xd299('0xa'),auth[_0xd299('0x6')](),controller['show']);router[_0xd299('0xb')]('/',auth[_0xd299('0x6')](),controller['create']);router[_0xd299('0xc')](_0xd299('0xa'),controller['update']);router[_0xd299('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xd299('0xe')]);module[_0xd299('0xf')]=router; \ No newline at end of file +var _0xc117=['./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2a0545,_0x3efc5e){var _0x4e7351=function(_0x3ee78a){while(--_0x3ee78a){_0x2a0545['push'](_0x2a0545['shift']());}};_0x4e7351(++_0x3efc5e);}(_0xc117,0x1bf));var _0x7c11=function(_0x57b393,_0x468fb9){_0x57b393=_0x57b393-0x0;var _0x12ebc7=_0xc117[_0x57b393];return _0x12ebc7;};'use strict';var multer=require(_0x7c11('0x0'));var util=require(_0x7c11('0x1'));var path=require(_0x7c11('0x2'));var timeout=require(_0x7c11('0x3'));var express=require(_0x7c11('0x4'));var router=express[_0x7c11('0x5')]();var fs_extra=require(_0x7c11('0x6'));var auth=require(_0x7c11('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7c11('0x8'));var controller=require(_0x7c11('0x9'));router[_0x7c11('0xa')]('/',auth[_0x7c11('0xb')](),controller[_0x7c11('0xc')]);router[_0x7c11('0xa')]('/describe',auth[_0x7c11('0xb')](),controller[_0x7c11('0xd')]);router[_0x7c11('0xa')](_0x7c11('0xe'),auth[_0x7c11('0xb')](),controller[_0x7c11('0xf')]);router[_0x7c11('0xa')](_0x7c11('0x10'),auth[_0x7c11('0xb')](),controller[_0x7c11('0x11')]);router[_0x7c11('0x12')]('/',auth[_0x7c11('0xb')](),controller['create']);router[_0x7c11('0x13')](_0x7c11('0x10'),controller[_0x7c11('0x14')]);router[_0x7c11('0x15')](_0x7c11('0x10'),auth[_0x7c11('0xb')](),controller[_0x7c11('0x16')]);module[_0x7c11('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 55c44da..8b425c0 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 _0xc584=['BOOLEAN','out','DATE','exports','TEXT'];(function(_0x4a5faf,_0x12de1c){var _0x208bb6=function(_0x2b1fd7){while(--_0x2b1fd7){_0x4a5faf['push'](_0x4a5faf['shift']());}};_0x208bb6(++_0x12de1c);}(_0xc584,0xa8));var _0x4c58=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0xc584[_0x1c8cc6];return _0x522936;};'use strict';var Sequelize=require('sequelize');module[_0x4c58('0x0')]={'body':{'type':Sequelize[_0x4c58('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x4c58('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4c58('0x3')),'defaultValue':_0x4c58('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4c58('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4c58('0x1')]}}; \ No newline at end of file +var _0xd070=['medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize','TEXT'];(function(_0x210a5e,_0x1add9f){var _0x4790e0=function(_0x34d181){while(--_0x34d181){_0x210a5e['push'](_0x210a5e['shift']());}};_0x4790e0(++_0x1add9f);}(_0xd070,0x8e));var _0x0d07=function(_0x83970e,_0x5842d8){_0x83970e=_0x83970e-0x0;var _0x2b5ec7=_0xd070[_0x83970e];return _0x2b5ec7;};'use strict';var Sequelize=require(_0x0d07('0x0'));module['exports']={'body':{'type':Sequelize[_0x0d07('0x1')](_0x0d07('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0d07('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0d07('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0d07('0x4')]('in',_0x0d07('0x5')),'defaultValue':_0x0d07('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0d07('0x6')]},'providerName':{'type':Sequelize[_0x0d07('0x7')]},'providerResponse':{'type':Sequelize[_0x0d07('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 173c874..e79018c 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 _0xb306=['params','find','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','manual','interface','SIP/%s','motionChannel','channel','event','acceptmessage','parse','formData','reject','ChatInteraction','role','RejectMessage','Sequelize','fullname','EventManager','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','stack','name','index','map','ChatMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show'];(function(_0x19bd2f,_0xc0fce){var _0x51ed84=function(_0x5d9479){while(--_0x5d9479){_0x19bd2f['push'](_0x19bd2f['shift']());}};_0x51ed84(++_0xc0fce);}(_0xb306,0x132));var _0x6b30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb306[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b30('0x0'));var zipdir=require(_0x6b30('0x1'));var jsonpatch=require(_0x6b30('0x2'));var rp=require(_0x6b30('0x3'));var moment=require(_0x6b30('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6b30('0x5'));var util=require(_0x6b30('0x6'));var path=require(_0x6b30('0x7'));var sox=require(_0x6b30('0x8'));var csv=require('to-csv');var ejs=require(_0x6b30('0x9'));var fs=require('fs');var fs_extra=require(_0x6b30('0xa'));var _=require(_0x6b30('0xb'));var squel=require(_0x6b30('0xc'));var crypto=require(_0x6b30('0xd'));var jsforce=require(_0x6b30('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6b30('0xf'));var querystring=require(_0x6b30('0x10'));var Papa=require(_0x6b30('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6b30('0x12'));var as=require(_0x6b30('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b30('0x14'))(_0x6b30('0x15'));var utils=require('../../config/utils');var config=require(_0x6b30('0x16'));var licenseUtil=require(_0x6b30('0x17'));var db=require('../../mysqldb')['db'];config[_0x6b30('0x18')]=_['defaults'](config[_0x6b30('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b30('0x19'))(new Redis(config[_0x6b30('0x18')]));require(_0x6b30('0x1a'))[_0x6b30('0x1b')](socket);var jayson=require(_0x6b30('0x1c'));var client=jayson[_0x6b30('0x1d')][_0x6b30('0x1e')]({'port':0x232c});var client9002=jayson[_0x6b30('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x476006,_0x5dd1b3,_0x12a48f,_0x59ac4d){return new BPromise(function(_0x1d270d,_0x58f593){var _0x525898=_0x59ac4d||client;return _0x525898[_0x6b30('0x1f')](_0x476006,_0x12a48f)[_0x6b30('0x20')](function(_0x208236){logger[_0x6b30('0x21')]('ChatMessage,\x20%s,\x20%s',_0x5dd1b3,_0x6b30('0x22'));logger[_0x6b30('0x23')](_0x6b30('0x24'),_0x5dd1b3,_0x6b30('0x22'),JSON[_0x6b30('0x25')](_0x208236));if(_0x208236[_0x6b30('0x26')]){if(_0x208236[_0x6b30('0x26')][_0x6b30('0x27')]===0x1f4){logger[_0x6b30('0x26')]('ChatMessage,\x20%s,\x20%s',_0x5dd1b3,_0x208236[_0x6b30('0x26')]['message']);return _0x58f593(_0x208236[_0x6b30('0x26')][_0x6b30('0x28')]);}logger[_0x6b30('0x26')](_0x6b30('0x29'),_0x5dd1b3,_0x208236[_0x6b30('0x26')][_0x6b30('0x28')]);return _0x1d270d(_0x208236[_0x6b30('0x26')][_0x6b30('0x28')]);}else{logger[_0x6b30('0x21')]('ChatMessage,\x20%s,\x20%s',_0x5dd1b3,'request\x20sent');_0x1d270d(_0x208236[_0x6b30('0x2a')][_0x6b30('0x28')]);}})[_0x6b30('0x2b')](function(_0x43f2a4){logger[_0x6b30('0x26')](_0x6b30('0x29'),_0x5dd1b3,_0x43f2a4);_0x58f593(_0x43f2a4);});});}function respondWithStatusCode(_0x259580,_0x57d8c7){_0x57d8c7=_0x57d8c7||0xcc;return function(_0x13e2d6){if(_0x13e2d6){return _0x259580[_0x6b30('0x2c')](_0x57d8c7);}return _0x259580[_0x6b30('0x2d')](_0x57d8c7)[_0x6b30('0x2e')]();};}function respondWithResult(_0x428114,_0x1a49c9){_0x1a49c9=_0x1a49c9||0xc8;return function(_0x324e21){if(_0x324e21){return _0x428114['status'](_0x1a49c9)['json'](_0x324e21);}};}function respondWithFilteredResult(_0x28a523,_0x2c0cc4){return function(_0x403d3a){if(_0x403d3a){var _0x1d5478=typeof _0x2c0cc4[_0x6b30('0x2f')]===_0x6b30('0x30')&&typeof _0x2c0cc4[_0x6b30('0x31')]===_0x6b30('0x30');var _0x5128b5=_0x403d3a[_0x6b30('0x32')];var _0x5aa7c5=_0x1d5478?0x0:_0x2c0cc4[_0x6b30('0x2f')];var _0x13877a=_0x1d5478?_0x403d3a[_0x6b30('0x32')]:_0x2c0cc4[_0x6b30('0x2f')]+_0x2c0cc4['limit'];var _0x7b7631;if(_0x13877a>=_0x5128b5){_0x13877a=_0x5128b5;_0x7b7631=0xc8;}else{_0x7b7631=0xce;}_0x28a523[_0x6b30('0x2d')](_0x7b7631);return _0x28a523[_0x6b30('0x33')](_0x6b30('0x34'),_0x5aa7c5+'-'+_0x13877a+'/'+_0x5128b5)[_0x6b30('0x35')](_0x403d3a);}return null;};}function patchUpdates(_0x4680c4){return function(_0x276d22){try{jsonpatch[_0x6b30('0x36')](_0x276d22,_0x4680c4,!![]);}catch(_0x19fdb3){return BPromise['reject'](_0x19fdb3);}return _0x276d22[_0x6b30('0x37')]();};}function saveUpdates(_0x5e9841,_0x11602e){return function(_0x28581e){if(_0x28581e){return _0x28581e[_0x6b30('0x38')](_0x5e9841)[_0x6b30('0x20')](function(_0x1c0288){return _0x1c0288;});}return null;};}function removeEntity(_0x2181d1,_0x359189){return function(_0x2849de){if(_0x2849de){return _0x2849de[_0x6b30('0x39')]()[_0x6b30('0x20')](function(){_0x2181d1[_0x6b30('0x2d')](0xcc)[_0x6b30('0x2e')]();});}};}function handleEntityNotFound(_0x4866df,_0x5a772c){return function(_0x58db64){if(!_0x58db64){_0x4866df[_0x6b30('0x2c')](0x194);}return _0x58db64;};}function handleError(_0x5d9178,_0x17d877){_0x17d877=_0x17d877||0x1f4;return function(_0xf1a0a0){logger[_0x6b30('0x26')](_0xf1a0a0[_0x6b30('0x3a')]);if(_0xf1a0a0[_0x6b30('0x3b')]){delete _0xf1a0a0['name'];}_0x5d9178[_0x6b30('0x2d')](_0x17d877)['send'](_0xf1a0a0);};}exports[_0x6b30('0x3c')]=function(_0x6944ec,_0x1ba7ab){var _0x462e1a={},_0x4b77d5={},_0x21d1ad={'count':0x0,'rows':[]};var _0x104595=_[_0x6b30('0x3d')](db[_0x6b30('0x3e')][_0x6b30('0x3f')],function(_0x33f521){return{'name':_0x33f521['fieldName'],'type':_0x33f521[_0x6b30('0x40')]['key']};});_0x4b77d5[_0x6b30('0x41')]=_[_0x6b30('0x3d')](_0x104595,_0x6b30('0x3b'));_0x4b77d5[_0x6b30('0x42')]=_[_0x6b30('0x43')](_0x6944ec[_0x6b30('0x42')]);_0x4b77d5[_0x6b30('0x44')]=_[_0x6b30('0x45')](_0x4b77d5[_0x6b30('0x41')],_0x4b77d5[_0x6b30('0x42')]);_0x462e1a[_0x6b30('0x46')]=_['intersection'](_0x4b77d5[_0x6b30('0x41')],qs[_0x6b30('0x47')](_0x6944ec[_0x6b30('0x42')][_0x6b30('0x47')]));_0x462e1a[_0x6b30('0x46')]=_0x462e1a[_0x6b30('0x46')][_0x6b30('0x48')]?_0x462e1a['attributes']:_0x4b77d5['model'];if(!_0x6944ec[_0x6b30('0x42')][_0x6b30('0x49')](_0x6b30('0x4a'))){_0x462e1a['limit']=qs[_0x6b30('0x31')](_0x6944ec[_0x6b30('0x42')][_0x6b30('0x31')]);_0x462e1a[_0x6b30('0x2f')]=qs[_0x6b30('0x2f')](_0x6944ec[_0x6b30('0x42')][_0x6b30('0x2f')]);}_0x462e1a[_0x6b30('0x4b')]=qs[_0x6b30('0x4c')](_0x6944ec['query'][_0x6b30('0x4c')]);_0x462e1a[_0x6b30('0x4d')]=qs[_0x6b30('0x44')](_[_0x6b30('0x4e')](_0x6944ec[_0x6b30('0x42')],_0x4b77d5[_0x6b30('0x44')]),_0x104595);if(_0x6944ec['query'][_0x6b30('0x4f')]){_0x462e1a[_0x6b30('0x4d')]=_['merge'](_0x462e1a[_0x6b30('0x4d')],{'$or':_[_0x6b30('0x3d')](_0x104595,function(_0x36ded7){if(_0x36ded7[_0x6b30('0x40')]!==_0x6b30('0x50')){var _0x4992da={};_0x4992da[_0x36ded7['name']]={'$like':'%'+_0x6944ec[_0x6b30('0x42')][_0x6b30('0x4f')]+'%'};return _0x4992da;}})});}_0x462e1a=_[_0x6b30('0x51')]({},_0x462e1a,_0x6944ec[_0x6b30('0x52')]);var _0x3a6688={'where':_0x462e1a[_0x6b30('0x4d')]};return db[_0x6b30('0x3e')][_0x6b30('0x32')](_0x3a6688)[_0x6b30('0x20')](function(_0x4bf99c){_0x21d1ad[_0x6b30('0x32')]=_0x4bf99c;if(_0x6944ec['query'][_0x6b30('0x53')]){_0x462e1a[_0x6b30('0x54')]=[{'all':!![]}];}return db[_0x6b30('0x3e')][_0x6b30('0x55')](_0x462e1a);})[_0x6b30('0x20')](function(_0x23ab07){_0x21d1ad['rows']=_0x23ab07;return _0x21d1ad;})['then'](respondWithFilteredResult(_0x1ba7ab,_0x462e1a))[_0x6b30('0x2b')](handleError(_0x1ba7ab,null));};exports[_0x6b30('0x56')]=function(_0x74bd2d,_0x47e099){var _0x454b5c={'raw':!![],'where':{'id':_0x74bd2d[_0x6b30('0x57')]['id']}},_0x28c688={};_0x28c688['model']=_['keys'](db[_0x6b30('0x3e')]['rawAttributes']);_0x28c688[_0x6b30('0x42')]=_[_0x6b30('0x43')](_0x74bd2d[_0x6b30('0x42')]);_0x28c688[_0x6b30('0x44')]=_[_0x6b30('0x45')](_0x28c688[_0x6b30('0x41')],_0x28c688['query']);_0x454b5c[_0x6b30('0x46')]=_[_0x6b30('0x45')](_0x28c688['model'],qs[_0x6b30('0x47')](_0x74bd2d['query'][_0x6b30('0x47')]));_0x454b5c[_0x6b30('0x46')]=_0x454b5c[_0x6b30('0x46')][_0x6b30('0x48')]?_0x454b5c[_0x6b30('0x46')]:_0x28c688[_0x6b30('0x41')];if(_0x74bd2d['query'][_0x6b30('0x53')]){_0x454b5c[_0x6b30('0x54')]=[{'all':!![]}];}_0x454b5c=_['merge']({},_0x454b5c,_0x74bd2d[_0x6b30('0x52')]);return db[_0x6b30('0x3e')][_0x6b30('0x58')](_0x454b5c)[_0x6b30('0x20')](handleEntityNotFound(_0x47e099,null))[_0x6b30('0x20')](respondWithResult(_0x47e099,null))[_0x6b30('0x2b')](handleError(_0x47e099,null));};exports[_0x6b30('0x59')]=function(_0xd8828,_0x4ca664){return db['ChatMessage']['create'](_0xd8828[_0x6b30('0x5a')],{})[_0x6b30('0x20')](respondWithResult(_0x4ca664,0xc9))[_0x6b30('0x2b')](handleError(_0x4ca664,null));};exports[_0x6b30('0x38')]=function(_0x4b5664,_0x2f2548){if(_0x4b5664['body']['id']){delete _0x4b5664[_0x6b30('0x5a')]['id'];}return db[_0x6b30('0x3e')][_0x6b30('0x58')]({'where':{'id':_0x4b5664[_0x6b30('0x57')]['id']}})[_0x6b30('0x20')](handleEntityNotFound(_0x2f2548,null))[_0x6b30('0x20')](saveUpdates(_0x4b5664[_0x6b30('0x5a')],null))[_0x6b30('0x20')](respondWithResult(_0x2f2548,null))[_0x6b30('0x2b')](handleError(_0x2f2548,null));};exports[_0x6b30('0x39')]=function(_0x43ce19,_0x100581){return db[_0x6b30('0x3e')][_0x6b30('0x58')]({'where':{'id':_0x43ce19['params']['id']}})['then'](handleEntityNotFound(_0x100581,null))['then'](removeEntity(_0x100581,null))[_0x6b30('0x2b')](handleError(_0x100581,null));};exports['describe']=function(_0x5b379f,_0x299c7d){return db[_0x6b30('0x3e')][_0x6b30('0x5b')]()[_0x6b30('0x20')](respondWithResult(_0x299c7d,null))['catch'](handleError(_0x299c7d,null));};var interaction_log=require('../../config/logger')(_0x6b30('0x5c'));exports[_0x6b30('0x5d')]=function(_0x10791a,_0x1c8101,_0x51b9d9){var _0x4d26bb={'agent':{},'channel':_0x6b30('0x5e')};if(_0x10791a[_0x6b30('0x5a')]['id']){delete _0x10791a[_0x6b30('0x5a')]['id'];}_0x10791a[_0x6b30('0x5a')][_0x6b30('0x5f')]=!![];_0x10791a[_0x6b30('0x5a')]['readAt']=moment()[_0x6b30('0x60')](_0x6b30('0x61'));_0x10791a[_0x6b30('0x5a')][_0x6b30('0x62')]=_0x10791a[_0x6b30('0x5a')]['UserId']||_0x10791a[_0x6b30('0x63')]['id'];_0x4d26bb[_0x6b30('0x64')]['id']=_0x10791a[_0x6b30('0x5a')][_0x6b30('0x62')];return db[_0x6b30('0x3e')][_0x6b30('0x58')]({'where':{'id':_0x10791a[_0x6b30('0x57')]['id'],'UserId':null}})[_0x6b30('0x20')](handleEntityNotFound(_0x1c8101,null))[_0x6b30('0x20')](saveUpdates(_0x10791a[_0x6b30('0x5a')],null))[_0x6b30('0x20')](function(_0x580416){if(_0x580416){_0x4d26bb[_0x6b30('0x28')]=_0x580416[_0x6b30('0x65')]({'plain':!![]});return db['ChatInteraction'][_0x6b30('0x58')]({'where':{'id':_0x580416[_0x6b30('0x66')]}});}return null;})[_0x6b30('0x20')](handleEntityNotFound(_0x1c8101,null))[_0x6b30('0x20')](function(_0x432524){if(_0x432524){return _0x432524[_0x6b30('0x38')]({'UserId':_0x10791a[_0x6b30('0x5a')][_0x6b30('0x62')],'read1stAt':_[_0x6b30('0x67')](_0x432524['read1stAt'])?moment()[_0x6b30('0x60')](_0x6b30('0x61')):undefined});}return null;})[_0x6b30('0x20')](function(_0x18b2e2){if(_0x18b2e2){_0x4d26bb[_0x6b30('0x68')]=_0x18b2e2[_0x6b30('0x65')]({'plain':!![]});interaction_log[_0x6b30('0x21')](_0x6b30('0x69'),_0x10791a[_0x6b30('0x63')]['id'],_0x10791a[_0x6b30('0x63')][_0x6b30('0x3b')],_0x10791a[_0x6b30('0x63')]['role'],_0x4d26bb['interaction']['id'],_0x10791a['body']?JSON[_0x6b30('0x25')](_0x10791a['body']):_0x6b30('0x6a'));return respondWithRpcPromise(_0x6b30('0x6b'),_0x6b30('0x6c'),_0x4d26bb);}return null;})[_0x6b30('0x20')](function(_0x20aae9){var _0x46244f=_0x6b30('0x6d')+_0x20aae9[_0x6b30('0x28')][_0x6b30('0x6e')];return db['sequelize'][_0x6b30('0x42')](_0x46244f,{'type':db['Sequelize'][_0x6b30('0x6f')][_0x6b30('0x70')],'raw':!![]})['then'](function(_0x1de2b7){return _0x1de2b7;});})[_0x6b30('0x20')](function(_0x1c2b4c){if(_0x1c2b4c){_0x4d26bb[_0x6b30('0x28')][_0x6b30('0x71')]=_0x1c2b4c[0x0];if(!_0x10791a['body'][_0x6b30('0x62')])return;return db[_0x6b30('0x72')][_0x6b30('0x58')]({'where':{'id':_0x10791a[_0x6b30('0x5a')][_0x6b30('0x62')],'role':_0x6b30('0x64')},'attributes':['id',_0x6b30('0x3b'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0xb0aa24){if(!_0xb0aa24)return null;_0x4d26bb['message'][_0x6b30('0x64')]=_0xb0aa24;return _0x4d26bb;})[_0x6b30('0x20')](function(_0x3d4547){if(_0x3d4547){if(_0x10791a[_0x6b30('0x5a')][_0x6b30('0x73')]){_0x4d26bb['message'][_0x6b30('0x74')]=util[_0x6b30('0x60')](_0x6b30('0x75'),_0x10791a[_0x6b30('0x63')][_0x6b30('0x3b')]);_0x4d26bb[_0x6b30('0x28')]['channel']=_0x4d26bb['channel'];_0x4d26bb[_0x6b30('0x28')][_0x6b30('0x76')]=_0x4d26bb[_0x6b30('0x77')];_0x4d26bb[_0x6b30('0x28')][_0x6b30('0x78')]=_0x6b30('0x5d');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x6b30('0x79'),'message':_[_0x6b30('0x51')](_0x4d26bb[_0x6b30('0x28')],JSON[_0x6b30('0x7a')](_0x4d26bb['interaction'][_0x6b30('0x7b')]))},client9002)[_0x6b30('0x20')](function(){return _0x4d26bb;});}return _0x4d26bb;}return null;})[_0x6b30('0x20')](respondWithResult(_0x1c8101,null))['catch'](handleError(_0x1c8101,null));};var interaction_log=require(_0x6b30('0x14'))('chat-interactions');exports[_0x6b30('0x7c')]=function(_0x10f4ed,_0x24387a,_0x305062){var _0x4380df={'agent':{},'channel':'chat'};if(_0x10f4ed[_0x6b30('0x5a')]['id']){delete _0x10f4ed[_0x6b30('0x5a')]['id'];}_0x10f4ed[_0x6b30('0x5a')]['UserId']=_0x10f4ed[_0x6b30('0x5a')][_0x6b30('0x62')]||_0x10f4ed[_0x6b30('0x63')]['id'];_0x4380df['agent']['id']=_0x10f4ed[_0x6b30('0x5a')][_0x6b30('0x62')];return db[_0x6b30('0x3e')][_0x6b30('0x58')]({'where':{'id':_0x10f4ed[_0x6b30('0x57')]['id'],'UserId':null}})[_0x6b30('0x20')](handleEntityNotFound(_0x24387a,null))[_0x6b30('0x20')](function(_0x430c28){if(_0x430c28){_0x4380df[_0x6b30('0x28')]=_0x430c28['get']({'plain':!![]});return db[_0x6b30('0x7d')][_0x6b30('0x58')]({'where':{'id':_0x430c28[_0x6b30('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x24387a,null))['then'](function(_0x32a973){if(_0x32a973){_0x4380df['interaction']=_0x32a973[_0x6b30('0x65')]({'plain':!![]});interaction_log[_0x6b30('0x21')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x10f4ed['user']['id'],_0x10f4ed[_0x6b30('0x63')]['name'],_0x10f4ed['user'][_0x6b30('0x7e')],_0x4380df[_0x6b30('0x68')]['id'],_0x10f4ed[_0x6b30('0x5a')]?JSON[_0x6b30('0x25')](_0x10f4ed[_0x6b30('0x5a')]):_0x6b30('0x6a'));return respondWithRpcPromise(_0x6b30('0x7f'),'rejectMessage',_0x4380df);}return null;})[_0x6b30('0x20')](function(_0xc29b89){var _0x112964=_0x6b30('0x6d')+_0xc29b89['message'][_0x6b30('0x6e')];return db['sequelize'][_0x6b30('0x42')](_0x112964,{'type':db[_0x6b30('0x80')]['QueryTypes'][_0x6b30('0x70')],'raw':!![]})[_0x6b30('0x20')](function(_0x5075dc){return _0x5075dc;});})[_0x6b30('0x20')](function(_0xffd2a6){if(_0xffd2a6){_0x4380df[_0x6b30('0x28')][_0x6b30('0x71')]=_0xffd2a6[0x0];if(!_0x10f4ed[_0x6b30('0x5a')][_0x6b30('0x62')])return;return db[_0x6b30('0x72')][_0x6b30('0x58')]({'where':{'id':_0x10f4ed['body'][_0x6b30('0x62')],'role':_0x6b30('0x64')},'attributes':['id',_0x6b30('0x3b'),_0x6b30('0x81'),'email','internal'],'raw':!![]});}return null;})[_0x6b30('0x20')](function(_0x12224e){if(!_0x12224e)return null;_0x4380df['message'][_0x6b30('0x64')]=_0x12224e;return _0x4380df;})['then'](function(_0x26a9c4){if(_0x26a9c4){_0x26a9c4[_0x6b30('0x28')][_0x6b30('0x74')]=util[_0x6b30('0x60')](_0x6b30('0x75'),_0x10f4ed[_0x6b30('0x63')][_0x6b30('0x3b')]);_0x26a9c4[_0x6b30('0x28')][_0x6b30('0x77')]=_0x4380df[_0x6b30('0x77')];_0x26a9c4[_0x6b30('0x28')][_0x6b30('0x76')]=_0x4380df[_0x6b30('0x77')];_0x26a9c4['message'][_0x6b30('0x78')]=_0x6b30('0x7c');respondWithRpcPromise(_0x6b30('0x82'),_0x6b30('0x82'),{'event':'rejectmessage','message':_['merge'](_0x4380df[_0x6b30('0x28')],JSON['parse'](_0x4380df[_0x6b30('0x68')][_0x6b30('0x7b')]))},client9002);return _0x4380df;}return null;})[_0x6b30('0x20')](respondWithResult(_0x24387a,null))['catch'](handleError(_0x24387a,null));}; \ No newline at end of file +var _0x100a=['sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','params','keys','find','create','body','describe','../../config/logger','chat-interactions','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','interaction','user','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','reject','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','QueryTypes','email','internal','motionChannel','rejectmessage','formData','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','info','ChatMessage,\x20%s,\x20%s','request\x20sent','error','code','message','catch','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy'];(function(_0x9d2d2,_0x1c1c2c){var _0x488242=function(_0x5f4e9c){while(--_0x5f4e9c){_0x9d2d2['push'](_0x9d2d2['shift']());}};_0x488242(++_0x1c1c2c);}(_0x100a,0xcf));var _0xa100=function(_0x35b1da,_0x43047f){_0x35b1da=_0x35b1da-0x0;var _0x30c59c=_0x100a[_0x35b1da];return _0x30c59c;};'use strict';var emlformat=require(_0xa100('0x0'));var rimraf=require(_0xa100('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa100('0x2'));var moment=require('moment');var BPromise=require(_0xa100('0x3'));var Mustache=require(_0xa100('0x4'));var util=require(_0xa100('0x5'));var path=require('path');var sox=require(_0xa100('0x6'));var csv=require('to-csv');var ejs=require(_0xa100('0x7'));var fs=require('fs');var fs_extra=require(_0xa100('0x8'));var _=require(_0xa100('0x9'));var squel=require(_0xa100('0xa'));var crypto=require('crypto');var jsforce=require(_0xa100('0xb'));var deskjs=require(_0xa100('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa100('0xd'));var Papa=require(_0xa100('0xe'));var Redis=require(_0xa100('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa100('0x10'));var as=require(_0xa100('0x11'));var hardwareService=require(_0xa100('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa100('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xa100('0x14')](config['redis'],{'host':_0xa100('0x15'),'port':0x18eb});var socket=require(_0xa100('0x16'))(new Redis(config['redis']));require(_0xa100('0x17'))[_0xa100('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa100('0x19')]['http']({'port':0x232c});var client9002=jayson['client'][_0xa100('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x436ba1,_0x533932,_0x3cc9d2,_0x3707f1){return new BPromise(function(_0xef05d5,_0x1d6ce4){var _0x159562=_0x3707f1||client;return _0x159562['request'](_0x436ba1,_0x3cc9d2)['then'](function(_0xee1a56){logger[_0xa100('0x1b')](_0xa100('0x1c'),_0x533932,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x533932,_0xa100('0x1d'),JSON['stringify'](_0xee1a56));if(_0xee1a56['error']){if(_0xee1a56[_0xa100('0x1e')][_0xa100('0x1f')]===0x1f4){logger[_0xa100('0x1e')](_0xa100('0x1c'),_0x533932,_0xee1a56[_0xa100('0x1e')]['message']);return _0x1d6ce4(_0xee1a56['error'][_0xa100('0x20')]);}logger[_0xa100('0x1e')](_0xa100('0x1c'),_0x533932,_0xee1a56[_0xa100('0x1e')]['message']);return _0xef05d5(_0xee1a56[_0xa100('0x1e')][_0xa100('0x20')]);}else{logger['info'](_0xa100('0x1c'),_0x533932,_0xa100('0x1d'));_0xef05d5(_0xee1a56['result'][_0xa100('0x20')]);}})[_0xa100('0x21')](function(_0x599c43){logger['error'](_0xa100('0x1c'),_0x533932,_0x599c43);_0x1d6ce4(_0x599c43);});});}function respondWithStatusCode(_0x5a0e87,_0x30310e){_0x30310e=_0x30310e||0xcc;return function(_0x2cae26){if(_0x2cae26){return _0x5a0e87['sendStatus'](_0x30310e);}return _0x5a0e87['status'](_0x30310e)[_0xa100('0x22')]();};}function respondWithResult(_0x1f04e8,_0x386216){_0x386216=_0x386216||0xc8;return function(_0x28c8bd){if(_0x28c8bd){return _0x1f04e8[_0xa100('0x23')](_0x386216)[_0xa100('0x24')](_0x28c8bd);}};}function respondWithFilteredResult(_0x497d74,_0x4b06fe){return function(_0x599006){if(_0x599006){var _0x5af3bb=typeof _0x4b06fe[_0xa100('0x25')]===_0xa100('0x26')&&typeof _0x4b06fe[_0xa100('0x27')]===_0xa100('0x26');var _0x4ca34d=_0x599006[_0xa100('0x28')];var _0x10d29d=_0x5af3bb?0x0:_0x4b06fe['offset'];var _0x4e6c6a=_0x5af3bb?_0x599006[_0xa100('0x28')]:_0x4b06fe[_0xa100('0x25')]+_0x4b06fe['limit'];var _0x492887;if(_0x4e6c6a>=_0x4ca34d){_0x4e6c6a=_0x4ca34d;_0x492887=0xc8;}else{_0x492887=0xce;}_0x497d74[_0xa100('0x23')](_0x492887);return _0x497d74[_0xa100('0x29')]('Content-Range',_0x10d29d+'-'+_0x4e6c6a+'/'+_0x4ca34d)[_0xa100('0x24')](_0x599006);}return null;};}function patchUpdates(_0x33559c){return function(_0x204b1a){try{jsonpatch[_0xa100('0x2a')](_0x204b1a,_0x33559c,!![]);}catch(_0x1b24c6){return BPromise['reject'](_0x1b24c6);}return _0x204b1a[_0xa100('0x2b')]();};}function saveUpdates(_0x2183fe,_0x2fb2b9){return function(_0x5cf61b){if(_0x5cf61b){return _0x5cf61b[_0xa100('0x2c')](_0x2183fe)[_0xa100('0x2d')](function(_0x20b29d){return _0x20b29d;});}return null;};}function removeEntity(_0x4552a1,_0x25bc7b){return function(_0x260e96){if(_0x260e96){return _0x260e96[_0xa100('0x2e')]()[_0xa100('0x2d')](function(){_0x4552a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1058f4,_0x1e70dc){return function(_0x46a370){if(!_0x46a370){_0x1058f4[_0xa100('0x2f')](0x194);}return _0x46a370;};}function handleError(_0x5303ac,_0x40bd51){_0x40bd51=_0x40bd51||0x1f4;return function(_0x4cda8e){logger[_0xa100('0x1e')](_0x4cda8e[_0xa100('0x30')]);if(_0x4cda8e[_0xa100('0x31')]){delete _0x4cda8e[_0xa100('0x31')];}_0x5303ac[_0xa100('0x23')](_0x40bd51)[_0xa100('0x32')](_0x4cda8e);};}exports[_0xa100('0x33')]=function(_0x10b543,_0x47d043){var _0x5da0f4={},_0x36c586={},_0x770291={'count':0x0,'rows':[]};var _0x3792e7=_[_0xa100('0x34')](db[_0xa100('0x35')][_0xa100('0x36')],function(_0x329a4a){return{'name':_0x329a4a[_0xa100('0x37')],'type':_0x329a4a['type'][_0xa100('0x38')]};});_0x36c586[_0xa100('0x39')]=_[_0xa100('0x34')](_0x3792e7,_0xa100('0x31'));_0x36c586[_0xa100('0x3a')]=_['keys'](_0x10b543['query']);_0x36c586[_0xa100('0x3b')]=_['intersection'](_0x36c586[_0xa100('0x39')],_0x36c586[_0xa100('0x3a')]);_0x5da0f4[_0xa100('0x3c')]=_[_0xa100('0x3d')](_0x36c586[_0xa100('0x39')],qs[_0xa100('0x3e')](_0x10b543[_0xa100('0x3a')][_0xa100('0x3e')]));_0x5da0f4[_0xa100('0x3c')]=_0x5da0f4[_0xa100('0x3c')][_0xa100('0x3f')]?_0x5da0f4[_0xa100('0x3c')]:_0x36c586[_0xa100('0x39')];if(!_0x10b543[_0xa100('0x3a')][_0xa100('0x40')](_0xa100('0x41'))){_0x5da0f4[_0xa100('0x27')]=qs[_0xa100('0x27')](_0x10b543[_0xa100('0x3a')]['limit']);_0x5da0f4[_0xa100('0x25')]=qs[_0xa100('0x25')](_0x10b543['query'][_0xa100('0x25')]);}_0x5da0f4[_0xa100('0x42')]=qs[_0xa100('0x43')](_0x10b543[_0xa100('0x3a')][_0xa100('0x43')]);_0x5da0f4[_0xa100('0x44')]=qs['filters'](_['pick'](_0x10b543['query'],_0x36c586['filters']),_0x3792e7);if(_0x10b543[_0xa100('0x3a')][_0xa100('0x45')]){_0x5da0f4[_0xa100('0x44')]=_[_0xa100('0x46')](_0x5da0f4[_0xa100('0x44')],{'$or':_[_0xa100('0x34')](_0x3792e7,function(_0x103c23){if(_0x103c23[_0xa100('0x47')]!==_0xa100('0x48')){var _0x530c86={};_0x530c86[_0x103c23[_0xa100('0x31')]]={'$like':'%'+_0x10b543[_0xa100('0x3a')][_0xa100('0x45')]+'%'};return _0x530c86;}})});}_0x5da0f4=_[_0xa100('0x46')]({},_0x5da0f4,_0x10b543[_0xa100('0x49')]);var _0x76462={'where':_0x5da0f4[_0xa100('0x44')]};return db['ChatMessage'][_0xa100('0x28')](_0x76462)['then'](function(_0x5a6839){_0x770291[_0xa100('0x28')]=_0x5a6839;if(_0x10b543['query']['includeAll']){_0x5da0f4[_0xa100('0x4a')]=[{'all':!![]}];}return db['ChatMessage'][_0xa100('0x4b')](_0x5da0f4);})[_0xa100('0x2d')](function(_0x159a76){_0x770291['rows']=_0x159a76;return _0x770291;})[_0xa100('0x2d')](respondWithFilteredResult(_0x47d043,_0x5da0f4))[_0xa100('0x21')](handleError(_0x47d043,null));};exports['show']=function(_0x4cb179,_0x1adcbb){var _0x3a4a8b={'raw':!![],'where':{'id':_0x4cb179[_0xa100('0x4c')]['id']}},_0x3adb9e={};_0x3adb9e[_0xa100('0x39')]=_[_0xa100('0x4d')](db[_0xa100('0x35')][_0xa100('0x36')]);_0x3adb9e[_0xa100('0x3a')]=_['keys'](_0x4cb179[_0xa100('0x3a')]);_0x3adb9e[_0xa100('0x3b')]=_['intersection'](_0x3adb9e[_0xa100('0x39')],_0x3adb9e[_0xa100('0x3a')]);_0x3a4a8b[_0xa100('0x3c')]=_['intersection'](_0x3adb9e['model'],qs[_0xa100('0x3e')](_0x4cb179[_0xa100('0x3a')][_0xa100('0x3e')]));_0x3a4a8b['attributes']=_0x3a4a8b[_0xa100('0x3c')]['length']?_0x3a4a8b[_0xa100('0x3c')]:_0x3adb9e[_0xa100('0x39')];if(_0x4cb179[_0xa100('0x3a')]['includeAll']){_0x3a4a8b[_0xa100('0x4a')]=[{'all':!![]}];}_0x3a4a8b=_['merge']({},_0x3a4a8b,_0x4cb179[_0xa100('0x49')]);return db['ChatMessage'][_0xa100('0x4e')](_0x3a4a8b)[_0xa100('0x2d')](handleEntityNotFound(_0x1adcbb,null))['then'](respondWithResult(_0x1adcbb,null))[_0xa100('0x21')](handleError(_0x1adcbb,null));};exports['create']=function(_0x258f13,_0x258803){return db[_0xa100('0x35')][_0xa100('0x4f')](_0x258f13[_0xa100('0x50')],{})[_0xa100('0x2d')](respondWithResult(_0x258803,0xc9))['catch'](handleError(_0x258803,null));};exports[_0xa100('0x2c')]=function(_0x556841,_0x5ed234){if(_0x556841[_0xa100('0x50')]['id']){delete _0x556841['body']['id'];}return db[_0xa100('0x35')][_0xa100('0x4e')]({'where':{'id':_0x556841[_0xa100('0x4c')]['id']}})[_0xa100('0x2d')](handleEntityNotFound(_0x5ed234,null))[_0xa100('0x2d')](saveUpdates(_0x556841[_0xa100('0x50')],null))[_0xa100('0x2d')](respondWithResult(_0x5ed234,null))[_0xa100('0x21')](handleError(_0x5ed234,null));};exports[_0xa100('0x2e')]=function(_0x54cc47,_0x5c21ca){return db[_0xa100('0x35')][_0xa100('0x4e')]({'where':{'id':_0x54cc47[_0xa100('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c21ca,null))[_0xa100('0x2d')](removeEntity(_0x5c21ca,null))[_0xa100('0x21')](handleError(_0x5c21ca,null));};exports['describe']=function(_0x5a6b7c,_0x1a94e4){return db[_0xa100('0x35')][_0xa100('0x51')]()[_0xa100('0x2d')](respondWithResult(_0x1a94e4,null))[_0xa100('0x21')](handleError(_0x1a94e4,null));};var interaction_log=require(_0xa100('0x52'))(_0xa100('0x53'));exports['accept']=function(_0x48f037,_0x5b4ba7,_0x37140a){var _0x5ae45c={'agent':{},'channel':_0xa100('0x54')};if(_0x48f037['body']['id']){delete _0x48f037['body']['id'];}_0x48f037[_0xa100('0x50')]['read']=!![];_0x48f037[_0xa100('0x50')][_0xa100('0x55')]=moment()[_0xa100('0x56')](_0xa100('0x57'));_0x48f037[_0xa100('0x50')][_0xa100('0x58')]=_0x48f037[_0xa100('0x50')][_0xa100('0x58')]||_0x48f037['user']['id'];_0x5ae45c[_0xa100('0x59')]['id']=_0x48f037[_0xa100('0x50')]['UserId'];return db[_0xa100('0x35')][_0xa100('0x4e')]({'where':{'id':_0x48f037[_0xa100('0x4c')]['id'],'UserId':null}})[_0xa100('0x2d')](handleEntityNotFound(_0x5b4ba7,null))[_0xa100('0x2d')](saveUpdates(_0x48f037[_0xa100('0x50')],null))[_0xa100('0x2d')](function(_0x5a3c24){if(_0x5a3c24){_0x5ae45c['message']=_0x5a3c24[_0xa100('0x5a')]({'plain':!![]});return db['ChatInteraction'][_0xa100('0x4e')]({'where':{'id':_0x5a3c24[_0xa100('0x5b')]}});}return null;})[_0xa100('0x2d')](handleEntityNotFound(_0x5b4ba7,null))[_0xa100('0x2d')](function(_0x14da31){if(_0x14da31){return _0x14da31[_0xa100('0x2c')]({'UserId':_0x48f037[_0xa100('0x50')][_0xa100('0x58')],'read1stAt':_[_0xa100('0x5c')](_0x14da31[_0xa100('0x5d')])?moment()['format'](_0xa100('0x57')):undefined});}return null;})[_0xa100('0x2d')](function(_0x56f01d){if(_0x56f01d){_0x5ae45c[_0xa100('0x5e')]=_0x56f01d[_0xa100('0x5a')]({'plain':!![]});interaction_log[_0xa100('0x1b')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48f037['user']['id'],_0x48f037['user'][_0xa100('0x31')],_0x48f037[_0xa100('0x5f')][_0xa100('0x60')],_0x5ae45c[_0xa100('0x5e')]['id'],_0x48f037[_0xa100('0x50')]?JSON[_0xa100('0x61')](_0x48f037[_0xa100('0x50')]):'null');return respondWithRpcPromise('AcceptMessage',_0xa100('0x62'),_0x5ae45c);}return null;})[_0xa100('0x2d')](function(_0x3dadc5){var _0x56c087=_0xa100('0x63')+_0x3dadc5['message']['ContactId'];return db[_0xa100('0x64')]['query'](_0x56c087,{'type':db[_0xa100('0x65')]['QueryTypes'][_0xa100('0x66')],'raw':!![]})['then'](function(_0xb39ca4){return _0xb39ca4;});})[_0xa100('0x2d')](function(_0x2e3206){if(_0x2e3206){_0x5ae45c['message'][_0xa100('0x67')]=_0x2e3206[0x0];if(!_0x48f037['body']['UserId'])return;return db[_0xa100('0x68')][_0xa100('0x4e')]({'where':{'id':_0x48f037['body'][_0xa100('0x58')],'role':'agent'},'attributes':['id',_0xa100('0x31'),_0xa100('0x69'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x438ec5){if(!_0x438ec5)return null;_0x5ae45c[_0xa100('0x20')][_0xa100('0x59')]=_0x438ec5;return _0x5ae45c;})[_0xa100('0x2d')](function(_0x49307f){if(_0x49307f){if(_0x48f037[_0xa100('0x50')][_0xa100('0x6a')]){_0x5ae45c[_0xa100('0x20')][_0xa100('0x6b')]=util[_0xa100('0x56')](_0xa100('0x6c'),_0x48f037[_0xa100('0x5f')]['name']);_0x5ae45c['message'][_0xa100('0x6d')]=_0x5ae45c[_0xa100('0x6d')];_0x5ae45c['message']['motionChannel']=_0x5ae45c[_0xa100('0x6d')];_0x5ae45c['message'][_0xa100('0x6e')]='accept';return respondWithRpcPromise(_0xa100('0x6f'),_0xa100('0x6f'),{'event':_0xa100('0x70'),'message':_[_0xa100('0x46')](_0x5ae45c[_0xa100('0x20')],JSON[_0xa100('0x71')](_0x5ae45c[_0xa100('0x5e')]['formData']))},client9002)[_0xa100('0x2d')](function(){return _0x5ae45c;});}return _0x5ae45c;}return null;})['then'](respondWithResult(_0x5b4ba7,null))[_0xa100('0x21')](handleError(_0x5b4ba7,null));};var interaction_log=require(_0xa100('0x52'))(_0xa100('0x53'));exports[_0xa100('0x72')]=function(_0x49b519,_0x29a510,_0x50b10d){var _0xb3ded1={'agent':{},'channel':_0xa100('0x54')};if(_0x49b519[_0xa100('0x50')]['id']){delete _0x49b519[_0xa100('0x50')]['id'];}_0x49b519[_0xa100('0x50')][_0xa100('0x58')]=_0x49b519['body'][_0xa100('0x58')]||_0x49b519[_0xa100('0x5f')]['id'];_0xb3ded1[_0xa100('0x59')]['id']=_0x49b519[_0xa100('0x50')][_0xa100('0x58')];return db['ChatMessage']['find']({'where':{'id':_0x49b519[_0xa100('0x4c')]['id'],'UserId':null}})[_0xa100('0x2d')](handleEntityNotFound(_0x29a510,null))[_0xa100('0x2d')](function(_0x2b4ffc){if(_0x2b4ffc){_0xb3ded1[_0xa100('0x20')]=_0x2b4ffc['get']({'plain':!![]});return db[_0xa100('0x73')][_0xa100('0x4e')]({'where':{'id':_0x2b4ffc[_0xa100('0x5b')]}});}return null;})[_0xa100('0x2d')](handleEntityNotFound(_0x29a510,null))[_0xa100('0x2d')](function(_0x397626){if(_0x397626){_0xb3ded1[_0xa100('0x5e')]=_0x397626['get']({'plain':!![]});interaction_log[_0xa100('0x1b')](_0xa100('0x74'),_0x49b519['user']['id'],_0x49b519[_0xa100('0x5f')][_0xa100('0x31')],_0x49b519[_0xa100('0x5f')][_0xa100('0x60')],_0xb3ded1['interaction']['id'],_0x49b519['body']?JSON['stringify'](_0x49b519[_0xa100('0x50')]):_0xa100('0x75'));return respondWithRpcPromise(_0xa100('0x76'),_0xa100('0x77'),_0xb3ded1);}return null;})[_0xa100('0x2d')](function(_0x575ee3){var _0x3dae9d=_0xa100('0x63')+_0x575ee3[_0xa100('0x20')][_0xa100('0x78')];return db['sequelize'][_0xa100('0x3a')](_0x3dae9d,{'type':db[_0xa100('0x65')][_0xa100('0x79')]['SELECT'],'raw':!![]})[_0xa100('0x2d')](function(_0x3a26d8){return _0x3a26d8;});})[_0xa100('0x2d')](function(_0x1a36f6){if(_0x1a36f6){_0xb3ded1[_0xa100('0x20')]['contact']=_0x1a36f6[0x0];if(!_0x49b519[_0xa100('0x50')]['UserId'])return;return db['User'][_0xa100('0x4e')]({'where':{'id':_0x49b519[_0xa100('0x50')][_0xa100('0x58')],'role':_0xa100('0x59')},'attributes':['id',_0xa100('0x31'),_0xa100('0x69'),_0xa100('0x7a'),_0xa100('0x7b')],'raw':!![]});}return null;})[_0xa100('0x2d')](function(_0x385955){if(!_0x385955)return null;_0xb3ded1[_0xa100('0x20')]['agent']=_0x385955;return _0xb3ded1;})[_0xa100('0x2d')](function(_0x49e92c){if(_0x49e92c){_0x49e92c[_0xa100('0x20')][_0xa100('0x6b')]=util[_0xa100('0x56')](_0xa100('0x6c'),_0x49b519[_0xa100('0x5f')][_0xa100('0x31')]);_0x49e92c[_0xa100('0x20')][_0xa100('0x6d')]=_0xb3ded1[_0xa100('0x6d')];_0x49e92c[_0xa100('0x20')][_0xa100('0x7c')]=_0xb3ded1[_0xa100('0x6d')];_0x49e92c['message']['event']=_0xa100('0x72');respondWithRpcPromise(_0xa100('0x6f'),_0xa100('0x6f'),{'event':_0xa100('0x7d'),'message':_['merge'](_0xb3ded1[_0xa100('0x20')],JSON[_0xa100('0x71')](_0xb3ded1[_0xa100('0x5e')][_0xa100('0x7e')]))},client9002);return _0xb3ded1;}return null;})['then'](respondWithResult(_0x29a510,null))['catch'](handleError(_0x29a510,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index c4e73a4..2e59bad 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 _0x689b=['save','update','remove','hook','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x39bf45,_0x2d3553){var _0xf3f2b6=function(_0x1c5bb2){while(--_0x1c5bb2){_0x39bf45['push'](_0x39bf45['shift']());}};_0xf3f2b6(++_0x2d3553);}(_0x689b,0x10c));var _0xb689=function(_0x472455,_0xd1931e){_0x472455=_0x472455-0x0;var _0x338b67=_0x689b[_0x472455];return _0x338b67;};'use strict';var EventEmitter=require(_0xb689('0x0'));var ChatMessage=require(_0xb689('0x1'))['db'][_0xb689('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb689('0x3')](0x0);var events={'afterCreate':_0xb689('0x4'),'afterUpdate':_0xb689('0x5'),'afterDestroy':_0xb689('0x6')};function emitEvent(_0x49d31f){return function(_0x394957,_0x4fb7fd,_0x3f1e7c){ChatMessageEvents['emit'](_0x49d31f+':'+_0x394957['id'],_0x394957);ChatMessageEvents['emit'](_0x49d31f,_0x394957);_0x3f1e7c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xb689('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x8315=['ChatMessage','setMaxListeners','save','emit','hook','exports','events','../../mysqldb'];(function(_0x3a07fb,_0x19eb96){var _0x5bef31=function(_0x57b070){while(--_0x57b070){_0x3a07fb['push'](_0x3a07fb['shift']());}};_0x5bef31(++_0x19eb96);}(_0x8315,0x66));var _0x5831=function(_0x402219,_0xa171b5){_0x402219=_0x402219-0x0;var _0x22e5c7=_0x8315[_0x402219];return _0x22e5c7;};'use strict';var EventEmitter=require(_0x5831('0x0'));var ChatMessage=require(_0x5831('0x1'))['db'][_0x5831('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5831('0x3')](0x0);var events={'afterCreate':_0x5831('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x247ac4){return function(_0x274f7d,_0x3ac4f9,_0x1cc189){ChatMessageEvents['emit'](_0x247ac4+':'+_0x274f7d['id'],_0x274f7d);ChatMessageEvents[_0x5831('0x5')](_0x247ac4,_0x274f7d);_0x1cc189(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x5831('0x6')](e,emitEvent(event));}}module[_0x5831('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index d7cc13b..2a17926 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 _0xd2df=['secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x238148,_0x5b1614){var _0x173093=function(_0x4b0708){while(--_0x4b0708){_0x238148['push'](_0x238148['shift']());}};_0x173093(++_0x5b1614);}(_0xd2df,0x1ea));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfd2d('0x0'));var util=require(_0xfd2d('0x1'));var logger=require(_0xfd2d('0x2'))(_0xfd2d('0x3'));var moment=require(_0xfd2d('0x4'));var BPromise=require(_0xfd2d('0x5'));var rp=require(_0xfd2d('0x6'));var fs=require('fs');var path=require(_0xfd2d('0x7'));var rimraf=require('rimraf');var config=require(_0xfd2d('0x8'));var attributes=require(_0xfd2d('0x9'));module[_0xfd2d('0xa')]=function(_0x527e96,_0x2e0208){return _0x527e96[_0xfd2d('0xb')](_0xfd2d('0xc'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xfd2d('0xd'),'fields':['body'],'type':_0xfd2d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x502f3d,_0x5ea753,_0x2fe79c){var _0x33c46e=_0x527e96[_0xfd2d('0xf')];var _0x5f4ee3=_0x502f3d[_0xfd2d('0x10')]({'plain':!![]});if(_0x5f4ee3[_0xfd2d('0x11')]['toLowerCase']()==='in'||_0x5f4ee3[_0xfd2d('0x11')][_0xfd2d('0x12')]()===_0xfd2d('0x13')&&!_0x5f4ee3[_0xfd2d('0x14')]&&!_[_0xfd2d('0x15')](_0x5f4ee3[_0xfd2d('0x16')])){_0x33c46e[_0xfd2d('0x17')][_0xfd2d('0x18')]({'where':{'id':_0x5f4ee3['ChatInteractionId']}})[_0xfd2d('0x19')](function(_0x2b86c0){if(_0x2b86c0){_0x2b86c0[_0xfd2d('0x1a')]({'lastMsgAt':_0x5f4ee3[_0xfd2d('0x1b')],'lastMsgDirection':_0x5f4ee3[_0xfd2d('0x11')]['toLowerCase']()});}})['catch'](function(_0x44cdc3){console['error'](_0x44cdc3);});}_0x2fe79c();}},'charset':_0xfd2d('0x1c'),'collate':_0xfd2d('0x1d')});}; \ No newline at end of file +var _0x6d15=['ChatMessage','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define'];(function(_0x5151f6,_0x175911){var _0x3502bc=function(_0x8449f0){while(--_0x8449f0){_0x5151f6['push'](_0x5151f6['shift']());}};_0x3502bc(++_0x175911);}(_0x6d15,0x1c5));var _0x56d1=function(_0x2c6ae1,_0x317c68){_0x2c6ae1=_0x2c6ae1-0x0;var _0x1cafbf=_0x6d15[_0x2c6ae1];return _0x1cafbf;};'use strict';var _=require(_0x56d1('0x0'));var util=require(_0x56d1('0x1'));var logger=require(_0x56d1('0x2'))('api');var moment=require(_0x56d1('0x3'));var BPromise=require(_0x56d1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56d1('0x5'));var rimraf=require(_0x56d1('0x6'));var config=require(_0x56d1('0x7'));var attributes=require(_0x56d1('0x8'));module[_0x56d1('0x9')]=function(_0x255964,_0x344248){return _0x255964[_0x56d1('0xa')](_0x56d1('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x56d1('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x223bb9,_0xce9764,_0x54964d){var _0x27f78c=_0x255964[_0x56d1('0xd')];var _0x42f43c=_0x223bb9['get']({'plain':!![]});if(_0x42f43c[_0x56d1('0xe')]['toLowerCase']()==='in'||_0x42f43c[_0x56d1('0xe')][_0x56d1('0xf')]()===_0x56d1('0x10')&&!_0x42f43c[_0x56d1('0x11')]&&!_[_0x56d1('0x12')](_0x42f43c[_0x56d1('0x13')])){_0x27f78c[_0x56d1('0x14')]['findOne']({'where':{'id':_0x42f43c[_0x56d1('0x15')]}})[_0x56d1('0x16')](function(_0x4f9358){if(_0x4f9358){_0x4f9358[_0x56d1('0x17')]({'lastMsgAt':_0x42f43c[_0x56d1('0x18')],'lastMsgDirection':_0x42f43c[_0x56d1('0xe')][_0x56d1('0xf')]()});}})[_0x56d1('0x19')](function(_0x566e7d){console[_0x56d1('0x1a')](_0x566e7d);});}_0x54964d();}},'charset':_0x56d1('0x1b'),'collate':_0x56d1('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index d1696e7..b1a5aee 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 _0x5203=['./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','debug','util','moment','randomstring','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost'];(function(_0xa1b6,_0x22e95e){var _0x5e789b=function(_0x533b58){while(--_0x533b58){_0xa1b6['push'](_0xa1b6['shift']());}};_0x5e789b(++_0x22e95e);}(_0x5203,0x12a));var _0x3520=function(_0x70049e,_0x52c59b){_0x70049e=_0x70049e-0x0;var _0x1691b0=_0x5203[_0x70049e];return _0x1691b0;};'use strict';var _=require('lodash');var util=require(_0x3520('0x0'));var moment=require(_0x3520('0x1'));var BPromise=require('bluebird');var rs=require(_0x3520('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3520('0x3'))(_0x3520('0x4'));var config=require(_0x3520('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3520('0x6')]['http']({'port':0x232a});config[_0x3520('0x7')]=_[_0x3520('0x8')](config['redis'],{'host':_0x3520('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3520('0x7')]));require(_0x3520('0xa'))['register'](socket);function respondWithRpcPromise(_0x56015e,_0x313ddd,_0x8e6318){return new BPromise(function(_0x2b425d,_0x352b08){return client[_0x3520('0xb')](_0x56015e,_0x8e6318)[_0x3520('0xc')](function(_0x4f51b9){logger[_0x3520('0xd')](_0x3520('0xe'),_0x313ddd,_0x3520('0xf'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x313ddd,_0x3520('0xf'),JSON[_0x3520('0x10')](_0x4f51b9));if(_0x4f51b9[_0x3520('0x11')]){if(_0x4f51b9[_0x3520('0x11')]['code']===0x1f4){logger[_0x3520('0x11')]('ChatMessage,\x20%s,\x20%s',_0x313ddd,_0x4f51b9['error'][_0x3520('0x12')]);return _0x352b08(_0x4f51b9['error']['message']);}logger[_0x3520('0x11')](_0x3520('0xe'),_0x313ddd,_0x4f51b9[_0x3520('0x11')][_0x3520('0x12')]);return _0x2b425d(_0x4f51b9[_0x3520('0x11')][_0x3520('0x12')]);}else{logger['info'](_0x3520('0xe'),_0x313ddd,_0x3520('0xf'));_0x2b425d(_0x4f51b9[_0x3520('0x13')][_0x3520('0x12')]);}})[_0x3520('0x14')](function(_0x32c534){logger[_0x3520('0x11')](_0x3520('0xe'),_0x313ddd,_0x32c534);_0x352b08(_0x32c534);});});}exports[_0x3520('0x15')]=function(_0x579c42){var _0x53cbfb=this;return new Promise(function(_0x16bfce,_0x120c65){return db[_0x3520('0x16')][_0x3520('0x17')](_0x579c42[_0x3520('0x18')],{'raw':_0x579c42[_0x3520('0x19')]?_0x579c42[_0x3520('0x19')][_0x3520('0x1a')]===undefined?!![]:![]:!![]})[_0x3520('0xc')](function(_0x4aa64c){logger['info']('CreateChatMessage',_0x579c42);logger[_0x3520('0x1b')]('CreateChatMessage',_0x579c42,JSON[_0x3520('0x10')](_0x4aa64c));_0x16bfce(_0x4aa64c);})[_0x3520('0x14')](function(_0x45d2eb){logger['error'](_0x3520('0x15'),_0x45d2eb[_0x3520('0x12')],_0x579c42);_0x120c65(_0x53cbfb[_0x3520('0x11')](0x1f4,_0x45d2eb[_0x3520('0x12')]));});});}; \ No newline at end of file +var _0x976b=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','body','options','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x50eca6,_0x12503d){var _0x590de9=function(_0x2a6a15){while(--_0x2a6a15){_0x50eca6['push'](_0x50eca6['shift']());}};_0x590de9(++_0x12503d);}(_0x976b,0x19f));var _0xb976=function(_0x2d606e,_0x105413){_0x2d606e=_0x2d606e-0x0;var _0x27dee6=_0x976b[_0x2d606e];return _0x27dee6;};'use strict';var _=require('lodash');var util=require(_0xb976('0x0'));var moment=require(_0xb976('0x1'));var BPromise=require(_0xb976('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb976('0x3'));var db=require(_0xb976('0x4'))['db'];var utils=require(_0xb976('0x5'));var logger=require(_0xb976('0x6'))('rpc');var config=require(_0xb976('0x7'));var jayson=require(_0xb976('0x8'));var client=jayson[_0xb976('0x9')][_0xb976('0xa')]({'port':0x232a});config[_0xb976('0xb')]=_['defaults'](config[_0xb976('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb976('0xc'))(new Redis(config[_0xb976('0xb')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5d806d,_0x39ee2d,_0x5c1d95){return new BPromise(function(_0x139a19,_0x1d4fe6){return client['request'](_0x5d806d,_0x5c1d95)['then'](function(_0x26f23c){logger[_0xb976('0xd')](_0xb976('0xe'),_0x39ee2d,_0xb976('0xf'));logger[_0xb976('0x10')](_0xb976('0x11'),_0x39ee2d,_0xb976('0xf'),JSON[_0xb976('0x12')](_0x26f23c));if(_0x26f23c[_0xb976('0x13')]){if(_0x26f23c['error'][_0xb976('0x14')]===0x1f4){logger[_0xb976('0x13')]('ChatMessage,\x20%s,\x20%s',_0x39ee2d,_0x26f23c[_0xb976('0x13')][_0xb976('0x15')]);return _0x1d4fe6(_0x26f23c[_0xb976('0x13')][_0xb976('0x15')]);}logger[_0xb976('0x13')](_0xb976('0xe'),_0x39ee2d,_0x26f23c[_0xb976('0x13')][_0xb976('0x15')]);return _0x139a19(_0x26f23c['error']['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x39ee2d,_0xb976('0xf'));_0x139a19(_0x26f23c[_0xb976('0x16')]['message']);}})[_0xb976('0x17')](function(_0x14067c){logger[_0xb976('0x13')](_0xb976('0xe'),_0x39ee2d,_0x14067c);_0x1d4fe6(_0x14067c);});});}exports[_0xb976('0x18')]=function(_0x266366){var _0x300708=this;return new Promise(function(_0x3fd3df,_0xc7919){return db[_0xb976('0x19')]['create'](_0x266366[_0xb976('0x1a')],{'raw':_0x266366[_0xb976('0x1b')]?_0x266366[_0xb976('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5ac16f){logger['info'](_0xb976('0x18'),_0x266366);logger[_0xb976('0x10')](_0xb976('0x18'),_0x266366,JSON['stringify'](_0x5ac16f));_0x3fd3df(_0x5ac16f);})[_0xb976('0x17')](function(_0x3349bc){logger['error']('CreateChatMessage',_0x3349bc[_0xb976('0x15')],_0x266366);_0xc7919(_0x300708[_0xb976('0x13')](0x1f4,_0x3349bc[_0xb976('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 5349f65..4c4b6ae 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 _0xfb65=['emit','removeListener','register','length','save','remove'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xfb65,0x82));var _0x5fb6=function(_0x211ee1,_0x2eb0a3){_0x211ee1=_0x211ee1-0x0;var _0x3d1c69=_0xfb65[_0x211ee1];return _0x3d1c69;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x5fb6('0x0'),_0x5fb6('0x1'),'update'];function createListener(_0x860687,_0x54af6d){return function(_0x194bac){_0x54af6d[_0x5fb6('0x2')](_0x860687,_0x194bac);};}function removeListener(_0xca6345,_0xb5f7c4){return function(){ChatMessageEvents[_0x5fb6('0x3')](_0xca6345,_0xb5f7c4);};}exports[_0x5fb6('0x4')]=function(_0x4dec8f){for(var _0x50782b=0x0,_0x238914=events[_0x5fb6('0x5')];_0x50782b<_0x238914;_0x50782b++){var _0x1f99b8=events[_0x50782b];var _0x840390=createListener('chatMessage:'+_0x1f99b8,_0x4dec8f);ChatMessageEvents['on'](_0x1f99b8,_0x840390);}}; \ No newline at end of file +var _0xb138=['update','removeListener','length','./chatMessage.events','save','remove'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0xb138,0x1dd));var _0x8b13=function(_0x33f54b,_0x41df7d){_0x33f54b=_0x33f54b-0x0;var _0x191255=_0xb138[_0x33f54b];return _0x191255;};'use strict';var ChatMessageEvents=require(_0x8b13('0x0'));var events=[_0x8b13('0x1'),_0x8b13('0x2'),_0x8b13('0x3')];function createListener(_0xadad70,_0x185752){return function(_0x20c65c){_0x185752['emit'](_0xadad70,_0x20c65c);};}function removeListener(_0x4411a0,_0x241acb){return function(){ChatMessageEvents[_0x8b13('0x4')](_0x4411a0,_0x241acb);};}exports['register']=function(_0xd19a0f){for(var _0x13f7bd=0x0,_0x5d51b1=events[_0x8b13('0x5')];_0x13f7bd<_0x5d51b1;_0x13f7bd++){var _0x33d1a7=events[_0x13f7bd];var _0x22e157=createListener('chatMessage:'+_0x33d1a7,_0xd19a0f);ChatMessageEvents['on'](_0x33d1a7,_0x22e157);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 76f04e1..a3056b9 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 _0xf631=['put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xf631,0x1a7));var _0x1f63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf631[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1f63('0x0'));var util=require(_0x1f63('0x1'));var path=require('path');var timeout=require(_0x1f63('0x2'));var express=require('express');var router=express[_0x1f63('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f63('0x4'));var interaction=require(_0x1f63('0x5'));var config=require(_0x1f63('0x6'));var controller=require('./chatMessage.controller');router[_0x1f63('0x7')]('/',auth[_0x1f63('0x8')](),controller[_0x1f63('0x9')]);router['get'](_0x1f63('0xa'),auth[_0x1f63('0x8')](),controller[_0x1f63('0xb')]);router[_0x1f63('0x7')](_0x1f63('0xc'),auth[_0x1f63('0x8')](),controller[_0x1f63('0xd')]);router[_0x1f63('0xe')]('/',auth[_0x1f63('0x8')](),interaction[_0x1f63('0xf')](_0x1f63('0x10'),_0x1f63('0x11')),controller[_0x1f63('0x12')]);router[_0x1f63('0x13')](_0x1f63('0xc'),controller[_0x1f63('0x14')]);router[_0x1f63('0x13')](_0x1f63('0x15'),auth['isAuthenticated'](),controller[_0x1f63('0x16')]);router[_0x1f63('0x13')](_0x1f63('0x17'),auth[_0x1f63('0x8')](),controller['reject']);router['delete'](_0x1f63('0xc'),auth[_0x1f63('0x8')](),controller[_0x1f63('0x18')]);module[_0x1f63('0x19')]=router; \ No newline at end of file +var _0x0cac=['post','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show'];(function(_0x2c688c,_0x18a5a5){var _0x44b97a=function(_0x37166b){while(--_0x37166b){_0x2c688c['push'](_0x2c688c['shift']());}};_0x44b97a(++_0x18a5a5);}(_0x0cac,0x1aa));var _0xc0ca=function(_0x2d3a8d,_0x18a73e){_0x2d3a8d=_0x2d3a8d-0x0;var _0x25e35e=_0x0cac[_0x2d3a8d];return _0x25e35e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0ca('0x0'));var timeout=require(_0xc0ca('0x1'));var express=require('express');var router=express[_0xc0ca('0x2')]();var fs_extra=require(_0xc0ca('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc0ca('0x4'));var config=require(_0xc0ca('0x5'));var controller=require('./chatMessage.controller');router[_0xc0ca('0x6')]('/',auth[_0xc0ca('0x7')](),controller['index']);router[_0xc0ca('0x6')](_0xc0ca('0x8'),auth[_0xc0ca('0x7')](),controller[_0xc0ca('0x9')]);router[_0xc0ca('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xc0ca('0xa')]);router[_0xc0ca('0xb')]('/',auth[_0xc0ca('0x7')](),interaction['tracked']('chat','chatmessage:create'),controller[_0xc0ca('0xc')]);router[_0xc0ca('0xd')]('/:id',controller[_0xc0ca('0xe')]);router['put'](_0xc0ca('0xf'),auth[_0xc0ca('0x7')](),controller[_0xc0ca('0x10')]);router[_0xc0ca('0xd')](_0xc0ca('0x11'),auth[_0xc0ca('0x7')](),controller[_0xc0ca('0x12')]);router[_0xc0ca('0x13')](_0xc0ca('0x14'),auth[_0xc0ca('0x7')](),controller[_0xc0ca('0x15')]);module[_0xc0ca('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 1fa7aa7..fb3037a 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 _0x5f66=['medium','TEXT','exports'];(function(_0x1528fe,_0x23836f){var _0x3241ee=function(_0x241b06){while(--_0x241b06){_0x1528fe['push'](_0x1528fe['shift']());}};_0x3241ee(++_0x23836f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x3e61cf,_0x4b78d7){var _0x572798=function(_0x33fbdb){while(--_0x33fbdb){_0x3e61cf['push'](_0x3e61cf['shift']());}};_0x572798(++_0x4b78d7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 9523fdb..f757647 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 _0x9957=['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','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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'];(function(_0x47a443,_0x1c1b3f){var _0x2848c0=function(_0x2314d1){while(--_0x2314d1){_0x47a443['push'](_0x47a443['shift']());}};_0x2848c0(++_0x1c1b3f);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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['ChatOfflineMessage']['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['ChatOfflineMessage'][_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['ChatOfflineMessage'][_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('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['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','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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'];(function(_0x46016b,_0x5054b9){var _0x3ebd56=function(_0xeaf898){while(--_0xeaf898){_0x46016b['push'](_0x46016b['shift']());}};_0x3ebd56(++_0x5054b9);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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['ChatOfflineMessage']['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['ChatOfflineMessage'][_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['ChatOfflineMessage'][_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('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index eb991cc..627da7b 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 _0x5ee2=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update'];(function(_0xe14c69,_0x5a8843){var _0x32641e=function(_0x49f343){while(--_0x49f343){_0xe14c69['push'](_0xe14c69['shift']());}};_0x32641e(++_0x5a8843);}(_0x5ee2,0x1b3));var _0x25ee=function(_0x1c81c6,_0x154f45){_0x1c81c6=_0x1c81c6-0x0;var _0x178c1b=_0x5ee2[_0x1c81c6];return _0x178c1b;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x25ee('0x0'))['db'][_0x25ee('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x25ee('0x2')](0x0);var events={'afterCreate':_0x25ee('0x3'),'afterUpdate':_0x25ee('0x4'),'afterDestroy':_0x25ee('0x5')};function emitEvent(_0x4a70da){return function(_0x1df61c,_0x5aeab4,_0x5d6b1c){ChatOfflineMessageEvents[_0x25ee('0x6')](_0x4a70da+':'+_0x1df61c['id'],_0x1df61c);ChatOfflineMessageEvents[_0x25ee('0x6')](_0x4a70da,_0x1df61c);_0x5d6b1c(null);};}for(var e in events){if(events[_0x25ee('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x25ee('0x8')](e,emitEvent(event));}}module[_0x25ee('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x6df4=['ChatOfflineMessage','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2ae590,_0x40ba96){var _0x537b97=function(_0x30cc82){while(--_0x30cc82){_0x2ae590['push'](_0x2ae590['shift']());}};_0x537b97(++_0x40ba96);}(_0x6df4,0xa6));var _0x46df=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0x6df4[_0x2652ef];return _0x2db578;};'use strict';var EventEmitter=require(_0x46df('0x0'));var ChatOfflineMessage=require(_0x46df('0x1'))['db'][_0x46df('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x46df('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x404794){return function(_0x5448e6,_0x4d4355,_0x5671c4){ChatOfflineMessageEvents[_0x46df('0x4')](_0x404794+':'+_0x5448e6['id'],_0x5448e6);ChatOfflineMessageEvents[_0x46df('0x4')](_0x404794,_0x5448e6);_0x5671c4(null);};}for(var e in events){if(events[_0x46df('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x46df('0x6')](e,emitEvent(event));}}module[_0x46df('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 389d851..96ce794 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 _0x99dc=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0x99dc,0x9a));var _0xc99d=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0x99dc[_0x5c6299];return _0x23b564;};'use strict';var attributes=require(_0xc99d('0x0'));module[_0xc99d('0x1')]=function(_0x18202b){return _0x18202b[_0xc99d('0x2')](_0xc99d('0x3'),attributes,{'tableName':_0xc99d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc99d('0x5'),'collate':_0xc99d('0x6')});}; \ No newline at end of file +var _0x1fab=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports'];(function(_0x4051be,_0x4e30dc){var _0x10d8e5=function(_0x1ae1c2){while(--_0x1ae1c2){_0x4051be['push'](_0x4051be['shift']());}};_0x10d8e5(++_0x4e30dc);}(_0x1fab,0x19c));var _0xb1fa=function(_0x420a7f,_0x38f556){_0x420a7f=_0x420a7f-0x0;var _0x42c230=_0x1fab[_0x420a7f];return _0x42c230;};'use strict';var attributes=require(_0xb1fa('0x0'));module[_0xb1fa('0x1')]=function(_0xf1d10e){return _0xf1d10e[_0xb1fa('0x2')](_0xb1fa('0x3'),attributes,{'tableName':_0xb1fa('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb1fa('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index eb42b09..41935d0 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 _0x83b4=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83b4,0x1a7));var _0x483b=function(_0xdd8706,_0x5f1e86){_0xdd8706=_0xdd8706-0x0;var _0x2b2843=_0x83b4[_0xdd8706];return _0x2b2843;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x483b('0x0'));var BPromise=require(_0x483b('0x1'));var rs=require(_0x483b('0x2'));var fs=require('fs');var Redis=require(_0x483b('0x3'));var db=require(_0x483b('0x4'))['db'];var utils=require(_0x483b('0x5'));var logger=require(_0x483b('0x6'))(_0x483b('0x7'));var config=require(_0x483b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x483b('0x9')][_0x483b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1065f8,_0x303de0,_0x440e98){return new BPromise(function(_0x989b7f,_0x155398){return client[_0x483b('0xb')](_0x1065f8,_0x440e98)[_0x483b('0xc')](function(_0x4befb7){logger[_0x483b('0xd')](_0x483b('0xe'),_0x303de0,'request\x20sent');logger['debug'](_0x483b('0xf'),_0x303de0,_0x483b('0x10'),JSON['stringify'](_0x4befb7));if(_0x4befb7[_0x483b('0x11')]){if(_0x4befb7[_0x483b('0x11')]['code']===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x303de0,_0x4befb7[_0x483b('0x11')][_0x483b('0x12')]);return _0x155398(_0x4befb7['error'][_0x483b('0x12')]);}logger['error'](_0x483b('0xe'),_0x303de0,_0x4befb7[_0x483b('0x11')][_0x483b('0x12')]);return _0x989b7f(_0x4befb7[_0x483b('0x11')][_0x483b('0x12')]);}else{logger['info'](_0x483b('0xe'),_0x303de0,_0x483b('0x10'));_0x989b7f(_0x4befb7[_0x483b('0x13')][_0x483b('0x12')]);}})[_0x483b('0x14')](function(_0x20181a){logger[_0x483b('0x11')](_0x483b('0xe'),_0x303de0,_0x20181a);_0x155398(_0x20181a);});});} \ No newline at end of file +var _0x702c=['message','ChatOfflineMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','request\x20sent','debug','stringify','error'];(function(_0x1aa7c5,_0x3b163f){var _0xb32623=function(_0x33268b){while(--_0x33268b){_0x1aa7c5['push'](_0x1aa7c5['shift']());}};_0xb32623(++_0x3b163f);}(_0x702c,0x1e4));var _0xc702=function(_0x1158cb,_0x26085e){_0x1158cb=_0x1158cb-0x0;var _0x139db7=_0x702c[_0x1158cb];return _0x139db7;};'use strict';var _=require(_0xc702('0x0'));var util=require(_0xc702('0x1'));var moment=require(_0xc702('0x2'));var BPromise=require(_0xc702('0x3'));var rs=require(_0xc702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc702('0x5'))['db'];var utils=require(_0xc702('0x6'));var logger=require(_0xc702('0x7'))('rpc');var config=require(_0xc702('0x8'));var jayson=require(_0xc702('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e6471,_0x79f9bb,_0x1ab818){return new BPromise(function(_0x159696,_0x4231e2){return client[_0xc702('0xa')](_0x1e6471,_0x1ab818)['then'](function(_0x47c148){logger[_0xc702('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x79f9bb,_0xc702('0xc'));logger[_0xc702('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x79f9bb,_0xc702('0xc'),JSON[_0xc702('0xe')](_0x47c148));if(_0x47c148[_0xc702('0xf')]){if(_0x47c148[_0xc702('0xf')]['code']===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x79f9bb,_0x47c148[_0xc702('0xf')][_0xc702('0x10')]);return _0x4231e2(_0x47c148[_0xc702('0xf')][_0xc702('0x10')]);}logger[_0xc702('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x79f9bb,_0x47c148[_0xc702('0xf')][_0xc702('0x10')]);return _0x159696(_0x47c148['error'][_0xc702('0x10')]);}else{logger[_0xc702('0xb')](_0xc702('0x11'),_0x79f9bb,_0xc702('0xc'));_0x159696(_0x47c148[_0xc702('0x12')][_0xc702('0x10')]);}})[_0xc702('0x13')](function(_0x3b0d64){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x79f9bb,_0x3b0d64);_0x4231e2(_0x3b0d64);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 6707e96..46495e3 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 _0x7579=['../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/:id','post','create','put','destroy','exports','multer','express','Router','fs-extra'];(function(_0x3d7181,_0x2027f1){var _0x4fdf6c=function(_0x1a5a35){while(--_0x1a5a35){_0x3d7181['push'](_0x3d7181['shift']());}};_0x4fdf6c(++_0x2027f1);}(_0x7579,0x10a));var _0x9757=function(_0x276ec7,_0x3bc9f9){_0x276ec7=_0x276ec7-0x0;var _0xffa130=_0x7579[_0x276ec7];return _0xffa130;};'use strict';var multer=require(_0x9757('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9757('0x1'));var router=express[_0x9757('0x2')]();var fs_extra=require(_0x9757('0x3'));var auth=require(_0x9757('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9757('0x5'));var controller=require(_0x9757('0x6'));router[_0x9757('0x7')]('/',auth[_0x9757('0x8')](),controller['index']);router['get']('/describe',auth[_0x9757('0x8')](),controller['describe']);router['get'](_0x9757('0x9'),auth[_0x9757('0x8')](),controller['show']);router[_0x9757('0xa')]('/',auth[_0x9757('0x8')](),controller[_0x9757('0xb')]);router[_0x9757('0xc')](_0x9757('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9757('0x9'),auth[_0x9757('0x8')](),controller[_0x9757('0xd')]);module[_0x9757('0xe')]=router; \ No newline at end of file +var _0x7edd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','put','delete','multer','connect-timeout','express','Router'];(function(_0x487c5d,_0xb81ceb){var _0x852161=function(_0x48ee08){while(--_0x48ee08){_0x487c5d['push'](_0x487c5d['shift']());}};_0x852161(++_0xb81ceb);}(_0x7edd,0x1cd));var _0xd7ed=function(_0x465809,_0x13c064){_0x465809=_0x465809-0x0;var _0x245139=_0x7edd[_0x465809];return _0x245139;};'use strict';var multer=require(_0xd7ed('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd7ed('0x1'));var express=require(_0xd7ed('0x2'));var router=express[_0xd7ed('0x3')]();var fs_extra=require(_0xd7ed('0x4'));var auth=require(_0xd7ed('0x5'));var interaction=require(_0xd7ed('0x6'));var config=require(_0xd7ed('0x7'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0xd7ed('0x8')](),controller[_0xd7ed('0x9')]);router[_0xd7ed('0xa')](_0xd7ed('0xb'),auth[_0xd7ed('0x8')](),controller['describe']);router[_0xd7ed('0xa')](_0xd7ed('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd7ed('0x8')](),controller['create']);router[_0xd7ed('0xd')](_0xd7ed('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd7ed('0xe')](_0xd7ed('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 7a86cc5..14d46b0 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 _0xcfd1=['INTEGER','sequelize','exports','ENUM','mouseOver'];(function(_0x51db38,_0x1f8778){var _0x21db64=function(_0x3276f5){while(--_0x3276f5){_0x51db38['push'](_0x51db38['shift']());}};_0x21db64(++_0x1f8778);}(_0xcfd1,0x150));var _0x1cfd=function(_0x5ced50,_0x3f8d27){_0x5ced50=_0x5ced50-0x0;var _0x50a749=_0xcfd1[_0x5ced50];return _0x50a749;};'use strict';var Sequelize=require(_0x1cfd('0x0'));module[_0x1cfd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1cfd('0x2')](_0x1cfd('0x3'),'timeout'),'defaultValue':_0x1cfd('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1cfd('0x4')]}}; \ No newline at end of file +var _0x79dc=['ENUM','mouseOver','sequelize','STRING'];(function(_0x3884ef,_0x30dcb7){var _0x535db9=function(_0x393ef3){while(--_0x393ef3){_0x3884ef['push'](_0x3884ef['shift']());}};_0x535db9(++_0x30dcb7);}(_0x79dc,0x14a));var _0xc79d=function(_0x3b0997,_0x167ed6){_0x3b0997=_0x3b0997-0x0;var _0x4663b2=_0x79dc[_0x3b0997];return _0x4663b2;};'use strict';var Sequelize=require(_0xc79d('0x0'));module['exports']={'name':{'type':Sequelize[_0xc79d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc79d('0x2')](_0xc79d('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xc79d('0x1')]},'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 913ee24..1f556f3 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 _0x68f5=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','includeAll','include','merge','options','find','catch','create','ChatProactiveAction','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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'];(function(_0x58fbb0,_0xe497b5){var _0x1783d2=function(_0x5554a8){while(--_0x5554a8){_0x58fbb0['push'](_0x58fbb0['shift']());}};_0x1783d2(++_0xe497b5);}(_0x68f5,0x11a));var _0x568f=function(_0x32904d,_0x28b13c){_0x32904d=_0x32904d-0x0;var _0x252bd9=_0x68f5[_0x32904d];return _0x252bd9;};'use strict';var emlformat=require(_0x568f('0x0'));var rimraf=require(_0x568f('0x1'));var zipdir=require(_0x568f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x568f('0x3'));var moment=require(_0x568f('0x4'));var BPromise=require(_0x568f('0x5'));var Mustache=require(_0x568f('0x6'));var util=require(_0x568f('0x7'));var path=require('path');var sox=require(_0x568f('0x8'));var csv=require(_0x568f('0x9'));var ejs=require(_0x568f('0xa'));var fs=require('fs');var fs_extra=require(_0x568f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x568f('0xc'));var jsforce=require(_0x568f('0xd'));var deskjs=require(_0x568f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x568f('0xf'));var Papa=require('papaparse');var Redis=require(_0x568f('0x10'));var authService=require(_0x568f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x568f('0x12'));var hardwareService=require(_0x568f('0x13'));var logger=require(_0x568f('0x14'))(_0x568f('0x15'));var utils=require(_0x568f('0x16'));var config=require(_0x568f('0x17'));var licenseUtil=require(_0x568f('0x18'));var db=require(_0x568f('0x19'))['db'];function respondWithStatusCode(_0x200172,_0x4acf24){_0x4acf24=_0x4acf24||0xcc;return function(_0x341cde){if(_0x341cde){return _0x200172[_0x568f('0x1a')](_0x4acf24);}return _0x200172[_0x568f('0x1b')](_0x4acf24)[_0x568f('0x1c')]();};}function respondWithResult(_0x55fc40,_0x87b903){_0x87b903=_0x87b903||0xc8;return function(_0x53c270){if(_0x53c270){return _0x55fc40['status'](_0x87b903)[_0x568f('0x1d')](_0x53c270);}};}function respondWithFilteredResult(_0x15a4e5,_0x47316e){return function(_0x25e488){if(_0x25e488){var _0xcd73a2=typeof _0x47316e[_0x568f('0x1e')]===_0x568f('0x1f')&&typeof _0x47316e[_0x568f('0x20')]===_0x568f('0x1f');var _0x3d9645=_0x25e488[_0x568f('0x21')];var _0x49b64e=_0xcd73a2?0x0:_0x47316e[_0x568f('0x1e')];var _0x5cc7e2=_0xcd73a2?_0x25e488[_0x568f('0x21')]:_0x47316e[_0x568f('0x1e')]+_0x47316e[_0x568f('0x20')];var _0x1f4912;if(_0x5cc7e2>=_0x3d9645){_0x5cc7e2=_0x3d9645;_0x1f4912=0xc8;}else{_0x1f4912=0xce;}_0x15a4e5[_0x568f('0x1b')](_0x1f4912);return _0x15a4e5[_0x568f('0x22')](_0x568f('0x23'),_0x49b64e+'-'+_0x5cc7e2+'/'+_0x3d9645)[_0x568f('0x1d')](_0x25e488);}return null;};}function patchUpdates(_0x1a09a9){return function(_0x22c4e0){try{jsonpatch[_0x568f('0x24')](_0x22c4e0,_0x1a09a9,!![]);}catch(_0x2c65c6){return BPromise[_0x568f('0x25')](_0x2c65c6);}return _0x22c4e0[_0x568f('0x26')]();};}function saveUpdates(_0x3eb76d,_0x2afe66){return function(_0x2c61ea){if(_0x2c61ea){return _0x2c61ea[_0x568f('0x27')](_0x3eb76d)[_0x568f('0x28')](function(_0x4a248e){return _0x4a248e;});}return null;};}function removeEntity(_0xa2225a,_0x4590a8){return function(_0x20daca){if(_0x20daca){return _0x20daca[_0x568f('0x29')]()['then'](function(){_0xa2225a['status'](0xcc)[_0x568f('0x1c')]();});}};}function handleEntityNotFound(_0x45826b,_0x67f06c){return function(_0x6bb377){if(!_0x6bb377){_0x45826b['sendStatus'](0x194);}return _0x6bb377;};}function handleError(_0x51d57f,_0x3de8ce){_0x3de8ce=_0x3de8ce||0x1f4;return function(_0x577ca6){logger['error'](_0x577ca6['stack']);if(_0x577ca6[_0x568f('0x2a')]){delete _0x577ca6['name'];}_0x51d57f[_0x568f('0x1b')](_0x3de8ce)['send'](_0x577ca6);};}exports[_0x568f('0x2b')]=function(_0x2ff19b,_0x182a1f){var _0x52acac={'raw':!![],'where':{'id':_0x2ff19b[_0x568f('0x2c')]['id']}},_0x209db2={};_0x209db2['model']=_[_0x568f('0x2d')](db['ChatProactiveAction'][_0x568f('0x2e')]);_0x209db2['query']=_['keys'](_0x2ff19b[_0x568f('0x2f')]);_0x209db2[_0x568f('0x30')]=_[_0x568f('0x31')](_0x209db2[_0x568f('0x32')],_0x209db2[_0x568f('0x2f')]);_0x52acac[_0x568f('0x33')]=_[_0x568f('0x31')](_0x209db2[_0x568f('0x32')],qs['fields'](_0x2ff19b[_0x568f('0x2f')][_0x568f('0x34')]));_0x52acac[_0x568f('0x33')]=_0x52acac[_0x568f('0x33')]['length']?_0x52acac[_0x568f('0x33')]:_0x209db2[_0x568f('0x32')];if(_0x2ff19b[_0x568f('0x2f')][_0x568f('0x35')]){_0x52acac[_0x568f('0x36')]=[{'all':!![]}];}_0x52acac=_[_0x568f('0x37')]({},_0x52acac,_0x2ff19b[_0x568f('0x38')]);return db['ChatProactiveAction'][_0x568f('0x39')](_0x52acac)[_0x568f('0x28')](handleEntityNotFound(_0x182a1f,null))[_0x568f('0x28')](respondWithResult(_0x182a1f,null))[_0x568f('0x3a')](handleError(_0x182a1f,null));};exports[_0x568f('0x3b')]=function(_0x4b6608,_0x57c011){return db[_0x568f('0x3c')][_0x568f('0x3b')](_0x4b6608[_0x568f('0x3d')],{})[_0x568f('0x28')](respondWithResult(_0x57c011,0xc9))[_0x568f('0x3a')](handleError(_0x57c011,null));};exports['update']=function(_0x2f78f3,_0x3ca904){if(_0x2f78f3[_0x568f('0x3d')]['id']){delete _0x2f78f3[_0x568f('0x3d')]['id'];}return db[_0x568f('0x3c')][_0x568f('0x39')]({'where':{'id':_0x2f78f3[_0x568f('0x2c')]['id']}})[_0x568f('0x28')](handleEntityNotFound(_0x3ca904,null))[_0x568f('0x28')](saveUpdates(_0x2f78f3[_0x568f('0x3d')],null))[_0x568f('0x28')](respondWithResult(_0x3ca904,null))[_0x568f('0x3a')](handleError(_0x3ca904,null));};exports[_0x568f('0x29')]=function(_0x3e7212,_0x3a2772){return db['ChatProactiveAction'][_0x568f('0x39')]({'where':{'id':_0x3e7212['params']['id']}})['then'](handleEntityNotFound(_0x3a2772,null))[_0x568f('0x28')](removeEntity(_0x3a2772,null))['catch'](handleError(_0x3a2772,null));}; \ No newline at end of file +var _0x3ca4=['count','status','Content-Range','apply','reject','save','then','destroy','error','send','show','params','keys','query','filters','intersection','fields','attributes','length','model','includeAll','merge','ChatProactiveAction','find','create','body','catch','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','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','end','json','offset','undefined','limit'];(function(_0x3d557a,_0x406f91){var _0x175a49=function(_0x5f45e6){while(--_0x5f45e6){_0x3d557a['push'](_0x3d557a['shift']());}};_0x175a49(++_0x406f91);}(_0x3ca4,0x17d));var _0x43ca=function(_0x3ed016,_0x33d661){_0x3ed016=_0x3ed016-0x0;var _0x682b3b=_0x3ca4[_0x3ed016];return _0x682b3b;};'use strict';var emlformat=require(_0x43ca('0x0'));var rimraf=require(_0x43ca('0x1'));var zipdir=require(_0x43ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x43ca('0x3'));var BPromise=require(_0x43ca('0x4'));var Mustache=require(_0x43ca('0x5'));var util=require(_0x43ca('0x6'));var path=require(_0x43ca('0x7'));var sox=require(_0x43ca('0x8'));var csv=require(_0x43ca('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43ca('0xa'));var _=require(_0x43ca('0xb'));var squel=require(_0x43ca('0xc'));var crypto=require(_0x43ca('0xd'));var jsforce=require(_0x43ca('0xe'));var deskjs=require(_0x43ca('0xf'));var toCsv=require(_0x43ca('0x9'));var querystring=require(_0x43ca('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x43ca('0x11'));var qs=require(_0x43ca('0x12'));var as=require(_0x43ca('0x13'));var hardwareService=require(_0x43ca('0x14'));var logger=require('../../config/logger')(_0x43ca('0x15'));var utils=require(_0x43ca('0x16'));var config=require(_0x43ca('0x17'));var licenseUtil=require(_0x43ca('0x18'));var db=require(_0x43ca('0x19'))['db'];function respondWithStatusCode(_0x246ead,_0x30184f){_0x30184f=_0x30184f||0xcc;return function(_0x2ede07){if(_0x2ede07){return _0x246ead[_0x43ca('0x1a')](_0x30184f);}return _0x246ead['status'](_0x30184f)[_0x43ca('0x1b')]();};}function respondWithResult(_0x13cf26,_0x4b710d){_0x4b710d=_0x4b710d||0xc8;return function(_0x309176){if(_0x309176){return _0x13cf26['status'](_0x4b710d)[_0x43ca('0x1c')](_0x309176);}};}function respondWithFilteredResult(_0x567579,_0xdccc62){return function(_0x1a8bf6){if(_0x1a8bf6){var _0x51a517=typeof _0xdccc62[_0x43ca('0x1d')]===_0x43ca('0x1e')&&typeof _0xdccc62[_0x43ca('0x1f')]==='undefined';var _0x4fb5e4=_0x1a8bf6['count'];var _0x5e50c9=_0x51a517?0x0:_0xdccc62[_0x43ca('0x1d')];var _0x268817=_0x51a517?_0x1a8bf6[_0x43ca('0x20')]:_0xdccc62['offset']+_0xdccc62[_0x43ca('0x1f')];var _0x806f68;if(_0x268817>=_0x4fb5e4){_0x268817=_0x4fb5e4;_0x806f68=0xc8;}else{_0x806f68=0xce;}_0x567579[_0x43ca('0x21')](_0x806f68);return _0x567579['set'](_0x43ca('0x22'),_0x5e50c9+'-'+_0x268817+'/'+_0x4fb5e4)['json'](_0x1a8bf6);}return null;};}function patchUpdates(_0x106d07){return function(_0x9bc5dc){try{jsonpatch[_0x43ca('0x23')](_0x9bc5dc,_0x106d07,!![]);}catch(_0x5ae497){return BPromise[_0x43ca('0x24')](_0x5ae497);}return _0x9bc5dc[_0x43ca('0x25')]();};}function saveUpdates(_0x2af64f,_0x2ad8fa){return function(_0x35d34c){if(_0x35d34c){return _0x35d34c['update'](_0x2af64f)[_0x43ca('0x26')](function(_0x34767e){return _0x34767e;});}return null;};}function removeEntity(_0x557b96,_0x379902){return function(_0x22d6ac){if(_0x22d6ac){return _0x22d6ac[_0x43ca('0x27')]()[_0x43ca('0x26')](function(){_0x557b96[_0x43ca('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2da1ec,_0xc07cde){return function(_0x29f2ee){if(!_0x29f2ee){_0x2da1ec[_0x43ca('0x1a')](0x194);}return _0x29f2ee;};}function handleError(_0x14287e,_0x1de54b){_0x1de54b=_0x1de54b||0x1f4;return function(_0x3b2078){logger[_0x43ca('0x28')](_0x3b2078['stack']);if(_0x3b2078['name']){delete _0x3b2078['name'];}_0x14287e[_0x43ca('0x21')](_0x1de54b)[_0x43ca('0x29')](_0x3b2078);};}exports[_0x43ca('0x2a')]=function(_0x9d09b9,_0x34dc4f){var _0x36884b={'raw':!![],'where':{'id':_0x9d09b9[_0x43ca('0x2b')]['id']}},_0xffad2d={};_0xffad2d['model']=_[_0x43ca('0x2c')](db['ChatProactiveAction']['rawAttributes']);_0xffad2d[_0x43ca('0x2d')]=_[_0x43ca('0x2c')](_0x9d09b9[_0x43ca('0x2d')]);_0xffad2d[_0x43ca('0x2e')]=_[_0x43ca('0x2f')](_0xffad2d['model'],_0xffad2d[_0x43ca('0x2d')]);_0x36884b['attributes']=_[_0x43ca('0x2f')](_0xffad2d['model'],qs[_0x43ca('0x30')](_0x9d09b9[_0x43ca('0x2d')]['fields']));_0x36884b[_0x43ca('0x31')]=_0x36884b[_0x43ca('0x31')][_0x43ca('0x32')]?_0x36884b[_0x43ca('0x31')]:_0xffad2d[_0x43ca('0x33')];if(_0x9d09b9[_0x43ca('0x2d')][_0x43ca('0x34')]){_0x36884b['include']=[{'all':!![]}];}_0x36884b=_[_0x43ca('0x35')]({},_0x36884b,_0x9d09b9['options']);return db[_0x43ca('0x36')][_0x43ca('0x37')](_0x36884b)['then'](handleEntityNotFound(_0x34dc4f,null))[_0x43ca('0x26')](respondWithResult(_0x34dc4f,null))['catch'](handleError(_0x34dc4f,null));};exports['create']=function(_0x10f75c,_0x2f69ba){return db[_0x43ca('0x36')][_0x43ca('0x38')](_0x10f75c[_0x43ca('0x39')],{})[_0x43ca('0x26')](respondWithResult(_0x2f69ba,0xc9))[_0x43ca('0x3a')](handleError(_0x2f69ba,null));};exports['update']=function(_0x43b29b,_0x67b8b0){if(_0x43b29b['body']['id']){delete _0x43b29b[_0x43ca('0x39')]['id'];}return db[_0x43ca('0x36')]['find']({'where':{'id':_0x43b29b[_0x43ca('0x2b')]['id']}})['then'](handleEntityNotFound(_0x67b8b0,null))['then'](saveUpdates(_0x43b29b[_0x43ca('0x39')],null))[_0x43ca('0x26')](respondWithResult(_0x67b8b0,null))[_0x43ca('0x3a')](handleError(_0x67b8b0,null));};exports[_0x43ca('0x27')]=function(_0xa466c9,_0x2205c4){return db[_0x43ca('0x36')][_0x43ca('0x37')]({'where':{'id':_0xa466c9[_0x43ca('0x2b')]['id']}})[_0x43ca('0x26')](handleEntityNotFound(_0x2205c4,null))[_0x43ca('0x26')](removeEntity(_0x2205c4,null))[_0x43ca('0x3a')](handleError(_0x2205c4,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index c06ef71..58a7423 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 _0x013b=['request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','util','api','moment'];(function(_0x53b6aa,_0x175561){var _0x4160f8=function(_0x4fe530){while(--_0x4fe530){_0x53b6aa['push'](_0x53b6aa['shift']());}};_0x4160f8(++_0x175561);}(_0x013b,0x99));var _0xb013=function(_0x2f88bf,_0x761a0e){_0x2f88bf=_0x2f88bf-0x0;var _0x1b451e=_0x013b[_0x2f88bf];return _0x1b451e;};'use strict';var _=require('lodash');var util=require(_0xb013('0x0'));var logger=require('../../config/logger')(_0xb013('0x1'));var moment=require(_0xb013('0x2'));var BPromise=require('bluebird');var rp=require(_0xb013('0x3'));var fs=require('fs');var path=require(_0xb013('0x4'));var rimraf=require(_0xb013('0x5'));var config=require(_0xb013('0x6'));var attributes=require(_0xb013('0x7'));module[_0xb013('0x8')]=function(_0x16fa4c,_0x411d3e){return _0x16fa4c[_0xb013('0x9')](_0xb013('0xa'),attributes,{'tableName':_0xb013('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x148f=['ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0xc4e54f,_0x196fb0){var _0x32ae4a=function(_0x2e9403){while(--_0x2e9403){_0xc4e54f['push'](_0xc4e54f['shift']());}};_0x32ae4a(++_0x196fb0);}(_0x148f,0x188));var _0xf148=function(_0x434a6c,_0x270420){_0x434a6c=_0x434a6c-0x0;var _0x5f433b=_0x148f[_0x434a6c];return _0x5f433b;};'use strict';var _=require(_0xf148('0x0'));var util=require(_0xf148('0x1'));var logger=require(_0xf148('0x2'))(_0xf148('0x3'));var moment=require('moment');var BPromise=require(_0xf148('0x4'));var rp=require(_0xf148('0x5'));var fs=require('fs');var path=require(_0xf148('0x6'));var rimraf=require(_0xf148('0x7'));var config=require(_0xf148('0x8'));var attributes=require(_0xf148('0x9'));module[_0xf148('0xa')]=function(_0x31df1a,_0x48473c){return _0x31df1a['define'](_0xf148('0xb'),attributes,{'tableName':_0xf148('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 6986bcd..1ac5888 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 _0x1169=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x1169,0x1f2));var _0x9116=function(_0x29b956,_0x1d62d7){_0x29b956=_0x29b956-0x0;var _0xbacdb1=_0x1169[_0x29b956];return _0xbacdb1;};'use strict';var _=require(_0x9116('0x0'));var util=require(_0x9116('0x1'));var moment=require(_0x9116('0x2'));var BPromise=require(_0x9116('0x3'));var rs=require(_0x9116('0x4'));var fs=require('fs');var Redis=require(_0x9116('0x5'));var db=require(_0x9116('0x6'))['db'];var utils=require(_0x9116('0x7'));var logger=require(_0x9116('0x8'))(_0x9116('0x9'));var config=require('../../config/environment');var jayson=require(_0x9116('0xa'));var client=jayson[_0x9116('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x497a09,_0x592c9f,_0x34f8f1){return new BPromise(function(_0x3db7b8,_0x291e6e){return client[_0x9116('0xc')](_0x497a09,_0x34f8f1)['then'](function(_0x469f64){logger[_0x9116('0xd')](_0x9116('0xe'),_0x592c9f,_0x9116('0xf'));logger[_0x9116('0x10')](_0x9116('0x11'),_0x592c9f,_0x9116('0xf'),JSON[_0x9116('0x12')](_0x469f64));if(_0x469f64[_0x9116('0x13')]){if(_0x469f64[_0x9116('0x13')][_0x9116('0x14')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x592c9f,_0x469f64[_0x9116('0x13')][_0x9116('0x15')]);return _0x291e6e(_0x469f64[_0x9116('0x13')][_0x9116('0x15')]);}logger[_0x9116('0x13')](_0x9116('0xe'),_0x592c9f,_0x469f64[_0x9116('0x13')][_0x9116('0x15')]);return _0x3db7b8(_0x469f64['error'][_0x9116('0x15')]);}else{logger['info'](_0x9116('0xe'),_0x592c9f,_0x9116('0xf'));_0x3db7b8(_0x469f64[_0x9116('0x16')][_0x9116('0x15')]);}})[_0x9116('0x17')](function(_0x184388){logger[_0x9116('0x13')](_0x9116('0xe'),_0x592c9f,_0x184388);_0x291e6e(_0x184388);});});} \ No newline at end of file +var _0x4297=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x28a898,_0x1b7dde){var _0x54707b=function(_0x3a9fc6){while(--_0x3a9fc6){_0x28a898['push'](_0x28a898['shift']());}};_0x54707b(++_0x1b7dde);}(_0x4297,0x1d7));var _0x7429=function(_0x48d06a,_0x19955c){_0x48d06a=_0x48d06a-0x0;var _0x5db661=_0x4297[_0x48d06a];return _0x5db661;};'use strict';var _=require(_0x7429('0x0'));var util=require(_0x7429('0x1'));var moment=require(_0x7429('0x2'));var BPromise=require(_0x7429('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7429('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7429('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7429('0x6'));var jayson=require(_0x7429('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x182e83,_0xc26979,_0x12dde1){return new BPromise(function(_0x5e15f7,_0x426c28){return client[_0x7429('0x8')](_0x182e83,_0x12dde1)[_0x7429('0x9')](function(_0x407b40){logger[_0x7429('0xa')](_0x7429('0xb'),_0xc26979,_0x7429('0xc'));logger[_0x7429('0xd')](_0x7429('0xe'),_0xc26979,'request\x20sent',JSON[_0x7429('0xf')](_0x407b40));if(_0x407b40['error']){if(_0x407b40[_0x7429('0x10')][_0x7429('0x11')]===0x1f4){logger['error'](_0x7429('0xb'),_0xc26979,_0x407b40[_0x7429('0x10')]['message']);return _0x426c28(_0x407b40[_0x7429('0x10')]['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0xc26979,_0x407b40[_0x7429('0x10')]['message']);return _0x5e15f7(_0x407b40['error']['message']);}else{logger[_0x7429('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0xc26979,_0x7429('0xc'));_0x5e15f7(_0x407b40[_0x7429('0x12')][_0x7429('0x13')]);}})[_0x7429('0x14')](function(_0x5215b1){logger['error'](_0x7429('0xb'),_0xc26979,_0x5215b1);_0x426c28(_0x5215b1);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 907db19..5926a6c 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 _0xdbf5=['post','put','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x3de2b3,_0x5cb745){var _0x4ba243=function(_0x4a84c2){while(--_0x4a84c2){_0x3de2b3['push'](_0x3de2b3['shift']());}};_0x4ba243(++_0x5cb745);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x29c1c1,_0x34e6b4){_0x29c1c1=_0x29c1c1-0x0;var _0x3e72a0=_0xdbf5[_0x29c1c1];return _0x3e72a0;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')](_0x5dbf('0x9'),auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xb')]);router[_0x5dbf('0xc')]('/',auth[_0x5dbf('0xa')](),controller['create']);router[_0x5dbf('0xd')]('/:id',auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xe')]);router[_0x5dbf('0xf')](_0x5dbf('0x9'),auth['isAuthenticated'](),controller[_0x5dbf('0x10')]);module['exports']=router; \ No newline at end of file +var _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x1b4140,_0x4fe250){var _0x53a40a=function(_0x4f0e50){while(--_0x4f0e50){_0x1b4140['push'](_0x1b4140['shift']());}};_0x53a40a(++_0x4fe250);}(_0xeda8,0x104));var _0x8eda=function(_0x84b07f,_0x4572c7){_0x84b07f=_0x84b07f-0x0;var _0x3eacf6=_0xeda8[_0x84b07f];return _0x3eacf6;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('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 8adbc32..b4c47cf 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 _0x0609=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x534e29,_0x44e544){var _0x12a7c8=function(_0xb3e7e9){while(--_0xb3e7e9){_0x534e29['push'](_0x534e29['shift']());}};_0x12a7c8(++_0x44e544);}(_0x0609,0x90));var _0x9060=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x0609[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x9060('0x0'));module[_0x9060('0x1')]={'name':{'type':Sequelize[_0x9060('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9060('0x2')]},'timeout':{'type':Sequelize[_0x9060('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9060('0x4')](_0x9060('0x5'),_0x9060('0x6'),_0x9060('0x7'))}}; \ No newline at end of file +var _0x8e56=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0x8e56,0xa3));var _0x68e5=function(_0x3021b9,_0xdb387c){_0x3021b9=_0x3021b9-0x0;var _0xd6a1c2=_0x8e56[_0x3021b9];return _0xd6a1c2;};'use strict';var Sequelize=require(_0x68e5('0x0'));module[_0x68e5('0x1')]={'name':{'type':Sequelize[_0x68e5('0x2')],'unique':_0x68e5('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x68e5('0x2')]},'timeout':{'type':Sequelize[_0x68e5('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x68e5('0x5')](_0x68e5('0x6'),_0x68e5('0x7'),_0x68e5('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 7cffcb7..e93f403 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 _0xa986=['redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','set','Content-Range','json','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','getOptions','where','count','include','query','ChatQueue','findAll','catch','params','keys','filters','attributes','intersection','fields','length','model','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','limit','order','sort','pick','ChatQueueId','filter','map','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','Team','ids','voicePause','interface','flatMap','Agents','sequelize','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','transaction','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','bluebird','util','squel','api','../../config/environment'];(function(_0x2ebe90,_0x2825d9){var _0x184e90=function(_0x1115a7){while(--_0x1115a7){_0x2ebe90['push'](_0x2ebe90['shift']());}};_0x184e90(++_0x2825d9);}(_0xa986,0x6f));var _0x6a98=function(_0x2bb675,_0x10e35c){_0x2bb675=_0x2bb675-0x0;var _0x606be5=_0xa986[_0x2bb675];return _0x606be5;};'use strict';var BPromise=require(_0x6a98('0x0'));var util=require(_0x6a98('0x1'));var _=require('lodash');var squel=require(_0x6a98('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x6a98('0x3'));var config=require(_0x6a98('0x4'));var db=require('../../mysqldb')['db'];config[_0x6a98('0x5')]=_[_0x6a98('0x6')](config[_0x6a98('0x5')],{'host':_0x6a98('0x7'),'port':0x18eb});var socket=require(_0x6a98('0x8'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);function respondWithStatusCode(_0xb58711,_0x214a79){_0x214a79=_0x214a79||0xcc;return function(_0x21283e){if(_0x21283e){return _0xb58711[_0x6a98('0x9')](_0x214a79);}return _0xb58711[_0x6a98('0xa')](_0x214a79)[_0x6a98('0xb')]();};}function respondWithResult(_0x59cb94,_0x442d70){_0x442d70=_0x442d70||0xc8;return function(_0x2f29a4){if(_0x2f29a4){return _0x59cb94[_0x6a98('0xa')](_0x442d70)['json'](_0x2f29a4);}};}function respondWithFilteredResult(_0xb96254,_0x3f6b7d){return function(_0x40c75f){if(_0x40c75f){var _0x389163=typeof _0x3f6b7d[_0x6a98('0xc')]===_0x6a98('0xd')&&typeof _0x3f6b7d['limit']==='undefined';var _0x3cbe2e=_0x40c75f['count'];var _0x19cdc5=_0x389163?0x0:_0x3f6b7d['offset'];var _0x3eded6=_0x389163?_0x40c75f['count']:_0x3f6b7d[_0x6a98('0xc')]+_0x3f6b7d['limit'];var _0x3c0630;if(_0x3eded6>=_0x3cbe2e){_0x3eded6=_0x3cbe2e;_0x3c0630=0xc8;}else{_0x3c0630=0xce;}_0xb96254[_0x6a98('0xa')](_0x3c0630);return _0xb96254[_0x6a98('0xe')](_0x6a98('0xf'),_0x19cdc5+'-'+_0x3eded6+'/'+_0x3cbe2e)[_0x6a98('0x10')](_0x40c75f);}return null;};}function saveUpdates(_0x598fd6){return function(_0x314211){if(_0x314211){return _0x314211['update'](_0x598fd6)[_0x6a98('0x11')](function(_0x5ae647){return _0x5ae647;});}return null;};}function removeEntity(_0xd375e9){return function(_0xe3c130){if(_0xe3c130){return _0xe3c130[_0x6a98('0x12')]()[_0x6a98('0x11')](function(){var _0x3ac12d=_0xe3c130[_0x6a98('0x13')]({'plain':!![]});var _0x321a5a=_0x6a98('0x14');return db[_0x6a98('0x15')][_0x6a98('0x12')]({'where':{'type':_0x321a5a,'resourceId':_0x3ac12d['id']}})[_0x6a98('0x11')](function(){return _0xe3c130;});})['then'](function(){_0xd375e9['status'](0xcc)[_0x6a98('0xb')]();});}};}function handleEntityNotFound(_0x3dbd05){return function(_0x20312d){if(!_0x20312d){_0x3dbd05[_0x6a98('0x9')](0x194);}return _0x20312d;};}function handleError(_0xc43b1c,_0x2ea573){_0x2ea573=_0x2ea573||0x1f4;return function(_0x1c3804){logger[_0x6a98('0x16')](_0x1c3804[_0x6a98('0x17')]);if(_0x1c3804[_0x6a98('0x18')]){delete _0x1c3804[_0x6a98('0x18')];}_0xc43b1c[_0x6a98('0xa')](_0x2ea573)['send'](_0x1c3804);};}exports[_0x6a98('0x19')]=function(_0x5a714c,_0x68cd46){var _0x53627f={};var _0x298fb0={'count':0x0,'rows':[]};var _0x5472fa=_['map'](db['ChatQueue'][_0x6a98('0x1a')],function(_0x3eb2ce){return{'name':_0x3eb2ce[_0x6a98('0x1b')],'type':_0x3eb2ce[_0x6a98('0x1c')]['key']};});_0x53627f=qs[_0x6a98('0x1d')](_0x5472fa,_0x5a714c);var _0x366048={'where':_0x53627f[_0x6a98('0x1e')]};return db['ChatQueue']['count'](_0x366048)['then'](function(_0x3d85b3){_0x298fb0[_0x6a98('0x1f')]=_0x3d85b3;_0x53627f[_0x6a98('0x20')]=qs[_0x6a98('0x20')](_0x5a714c[_0x6a98('0x21')]);return db[_0x6a98('0x22')][_0x6a98('0x23')](_0x53627f);})[_0x6a98('0x11')](function(_0x88bb1b){_0x298fb0['rows']=_0x88bb1b;return _0x298fb0;})['then'](respondWithFilteredResult(_0x68cd46,_0x53627f))[_0x6a98('0x24')](handleError(_0x68cd46,null));};exports['show']=function(_0x13dbbd,_0x1adb00){var _0x1ddce4={'raw':!![],'where':{'id':_0x13dbbd[_0x6a98('0x25')]['id']}},_0x386f75={};_0x386f75['model']=_[_0x6a98('0x26')](db[_0x6a98('0x22')]['rawAttributes']);_0x386f75[_0x6a98('0x21')]=_[_0x6a98('0x26')](_0x13dbbd[_0x6a98('0x21')]);_0x386f75[_0x6a98('0x27')]=_['intersection'](_0x386f75['model'],_0x386f75[_0x6a98('0x21')]);_0x1ddce4[_0x6a98('0x28')]=_[_0x6a98('0x29')](_0x386f75['model'],qs['fields'](_0x13dbbd[_0x6a98('0x21')][_0x6a98('0x2a')]));_0x1ddce4[_0x6a98('0x28')]=_0x1ddce4[_0x6a98('0x28')][_0x6a98('0x2b')]?_0x1ddce4[_0x6a98('0x28')]:_0x386f75[_0x6a98('0x2c')];if(_0x13dbbd[_0x6a98('0x21')]['includeAll']){_0x1ddce4['include']=[{'all':!![]}];}_0x1ddce4=_[_0x6a98('0x2d')]({},_0x1ddce4,_0x13dbbd[_0x6a98('0x2e')]);return db[_0x6a98('0x22')]['find'](_0x1ddce4)['then'](handleEntityNotFound(_0x1adb00,null))[_0x6a98('0x11')](respondWithResult(_0x1adb00,null))['catch'](handleError(_0x1adb00,null));};exports['create']=function(_0x50f91f,_0xbadb6b){return db[_0x6a98('0x22')][_0x6a98('0x2f')](_0x50f91f[_0x6a98('0x30')],{})[_0x6a98('0x11')](function(_0x178981){var _0x558876=_0x50f91f[_0x6a98('0x31')][_0x6a98('0x13')]({'plain':!![]});if(!_0x558876)throw new Error(_0x6a98('0x32'));if(_0x558876[_0x6a98('0x33')]===_0x6a98('0x31')){var _0x377af9=_0x178981[_0x6a98('0x13')]({'plain':!![]});var _0x4d553e=_0x6a98('0x14');return db[_0x6a98('0x34')][_0x6a98('0x35')]({'where':{'name':_0x4d553e,'userProfileId':_0x558876['userProfileId']},'raw':!![]})[_0x6a98('0x11')](function(_0x2d1859){if(_0x2d1859&&_0x2d1859[_0x6a98('0x36')]===0x0){return db['UserProfileResource'][_0x6a98('0x2f')]({'name':_0x377af9[_0x6a98('0x18')],'resourceId':_0x377af9['id'],'type':_0x2d1859[_0x6a98('0x18')],'sectionId':_0x2d1859['id']},{})['then'](function(){return _0x178981;});}else{return _0x178981;}})[_0x6a98('0x24')](function(_0x4c712f){logger[_0x6a98('0x16')](_0x6a98('0x37'),_0x4c712f);throw _0x4c712f;});}return _0x178981;})[_0x6a98('0x11')](respondWithResult(_0xbadb6b,0xc9))[_0x6a98('0x24')](handleError(_0xbadb6b,null));};exports[_0x6a98('0x38')]=function(_0xe728ee,_0x427790){if(_0xe728ee['body']['id']){delete _0xe728ee[_0x6a98('0x30')]['id'];}return db[_0x6a98('0x22')]['find']({'where':{'id':_0xe728ee[_0x6a98('0x25')]['id']}})[_0x6a98('0x11')](handleEntityNotFound(_0x427790,null))[_0x6a98('0x11')](saveUpdates(_0xe728ee[_0x6a98('0x30')],null))['then'](respondWithResult(_0x427790,null))['catch'](handleError(_0x427790,null));};exports['destroy']=function(_0xae6d9b,_0x2396f8){return db[_0x6a98('0x22')][_0x6a98('0x35')]({'where':{'id':_0xae6d9b[_0x6a98('0x25')]['id']}})[_0x6a98('0x11')](handleEntityNotFound(_0x2396f8,null))[_0x6a98('0x11')](removeEntity(_0x2396f8,null))['catch'](handleError(_0x2396f8,null));};exports['describe']=function(_0xa3c68f,_0x316e1a){return db['ChatQueue']['describe']()[_0x6a98('0x11')](respondWithResult(_0x316e1a,null))[_0x6a98('0x24')](handleError(_0x316e1a,null));};exports[_0x6a98('0x39')]=function(_0x347fcc,_0x1d08a8){var _0x3b108b={'raw':!![],'where':{}},_0x39039d={},_0x1ab3f0;return db[_0x6a98('0x22')][_0x6a98('0x3a')]({'where':{'id':_0x347fcc['params']['id']}})[_0x6a98('0x11')](handleEntityNotFound(_0x1d08a8,null))[_0x6a98('0x11')](function(_0xa05f74){if(_0xa05f74){_0x1ab3f0=_0xa05f74['get']({'plain':!![]});_0x39039d[_0x6a98('0x2c')]=_[_0x6a98('0x26')](db[_0x6a98('0x3b')]['rawAttributes']);_0x39039d['query']=_['keys'](_0x347fcc[_0x6a98('0x21')]);_0x39039d[_0x6a98('0x27')]=_['intersection'](_0x39039d[_0x6a98('0x2c')],_0x39039d[_0x6a98('0x21')]);_0x3b108b['attributes']=_[_0x6a98('0x29')](_0x39039d[_0x6a98('0x2c')],qs[_0x6a98('0x2a')](_0x347fcc['query'][_0x6a98('0x2a')]));_0x3b108b['attributes']=_0x3b108b[_0x6a98('0x28')][_0x6a98('0x2b')]?_0x3b108b[_0x6a98('0x28')]:_0x39039d['model'];if(!_0x347fcc[_0x6a98('0x21')][_0x6a98('0x3c')](_0x6a98('0x3d'))){_0x3b108b['limit']=qs['limit'](_0x347fcc[_0x6a98('0x21')][_0x6a98('0x3e')]);_0x3b108b[_0x6a98('0xc')]=qs[_0x6a98('0xc')](_0x347fcc['query'][_0x6a98('0xc')]);}_0x3b108b[_0x6a98('0x3f')]=qs['sort'](_0x347fcc['query'][_0x6a98('0x40')]);_0x3b108b['where']=qs[_0x6a98('0x27')](_[_0x6a98('0x41')](_0x347fcc[_0x6a98('0x21')],_0x39039d[_0x6a98('0x27')]));_0x3b108b[_0x6a98('0x1e')][_0x6a98('0x42')]=_0xa05f74['id'];if(_0x347fcc[_0x6a98('0x21')][_0x6a98('0x43')]){_0x3b108b['where']=_[_0x6a98('0x2d')](_0x3b108b[_0x6a98('0x1e')],{'$or':_[_0x6a98('0x44')](_0x3b108b[_0x6a98('0x28')],function(_0x59715f){var _0x41c0ba={};_0x41c0ba[_0x59715f]={'$like':'%'+_0x347fcc['query'][_0x6a98('0x43')]+'%'};return _0x41c0ba;})});}_0x3b108b=_['merge']({},_0x3b108b,_0x347fcc[_0x6a98('0x2e')]);return db[_0x6a98('0x3b')][_0x6a98('0x23')](_0x3b108b);}})[_0x6a98('0x11')](function(_0x4c1a2f){if(_0x4c1a2f){return db[_0x6a98('0x45')][_0x6a98('0x46')]({'where':{'id':_[_0x6a98('0x44')](_0x4c1a2f,_0x6a98('0x47')),'role':_0x6a98('0x48')},'attributes':['id',_0x6a98('0x18'),_0x6a98('0x49'),_0x6a98('0x4a'),_0x6a98('0x4b')]});}})['then'](function(_0x125977){if(_0x125977){return{'count':_0x125977[_0x6a98('0x1f')],'rows':_['map'](_0x125977['rows'],function(_0x321c93){return{'membername':_0x321c93['name'],'UserId':_0x321c93['id'],'queue_name':_0x1ab3f0['name'],'ChatQueueId':_0x1ab3f0['id'],'interface':util[_0x6a98('0x4c')]('%s/%s',_0x6a98('0x4d'),_0x321c93[_0x6a98('0x18')]),'penalty':0x0,'paused':_0x321c93[_0x6a98('0x49')],'createdAt':_0x321c93['createdAt'],'updatedAt':_0x321c93[_0x6a98('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1d08a8,_0x3b108b))[_0x6a98('0x24')](handleError(_0x1d08a8,null));};exports[_0x6a98('0x4e')]=function(_0x53853e,_0x3b0b5b){var _0x36524a={};var _0x581206={};var _0x291747;var _0x1cdcc1;return db[_0x6a98('0x22')]['findOne']({'where':{'id':_0x53853e['params']['id']}})[_0x6a98('0x11')](handleEntityNotFound(_0x3b0b5b,null))[_0x6a98('0x11')](function(_0xa8ff64){if(_0xa8ff64){_0x291747=_0xa8ff64;_0x581206[_0x6a98('0x2c')]=_[_0x6a98('0x26')](db[_0x6a98('0x4f')][_0x6a98('0x1a')]);_0x581206[_0x6a98('0x21')]=_[_0x6a98('0x26')](_0x53853e[_0x6a98('0x21')]);_0x581206[_0x6a98('0x27')]=_[_0x6a98('0x29')](_0x581206['model'],_0x581206[_0x6a98('0x21')]);_0x36524a['attributes']=_['intersection'](_0x581206[_0x6a98('0x2c')],qs[_0x6a98('0x2a')](_0x53853e[_0x6a98('0x21')][_0x6a98('0x2a')]));_0x36524a[_0x6a98('0x28')]=_0x36524a['attributes'][_0x6a98('0x2b')]?_0x36524a[_0x6a98('0x28')]:_0x581206[_0x6a98('0x2c')];_0x36524a['order']=qs[_0x6a98('0x40')](_0x53853e[_0x6a98('0x21')][_0x6a98('0x40')]);_0x36524a[_0x6a98('0x1e')]=qs[_0x6a98('0x27')](_['pick'](_0x53853e['query'],_0x581206[_0x6a98('0x27')]));if(_0x53853e[_0x6a98('0x21')][_0x6a98('0x43')]){_0x36524a['where']=_[_0x6a98('0x2d')](_0x36524a[_0x6a98('0x1e')],{'$or':_[_0x6a98('0x44')](_0x36524a[_0x6a98('0x28')],function(_0x3f8e76){var _0x13936b={};_0x13936b[_0x3f8e76]={'$like':'%'+_0x53853e[_0x6a98('0x21')]['filter']+'%'};return _0x13936b;})});}_0x36524a=_[_0x6a98('0x2d')]({},_0x36524a,_0x53853e[_0x6a98('0x2e')]);return _0x291747[_0x6a98('0x4e')](_0x36524a);}})[_0x6a98('0x11')](function(_0x51fc78){if(_0x51fc78){_0x1cdcc1=_0x51fc78[_0x6a98('0x2b')];if(!_0x53853e[_0x6a98('0x21')][_0x6a98('0x3c')](_0x6a98('0x3d'))){_0x36524a[_0x6a98('0x3e')]=qs[_0x6a98('0x3e')](_0x53853e[_0x6a98('0x21')][_0x6a98('0x3e')]);_0x36524a[_0x6a98('0xc')]=qs[_0x6a98('0xc')](_0x53853e[_0x6a98('0x21')][_0x6a98('0xc')]);}return _0x291747[_0x6a98('0x4e')](_0x36524a);}})[_0x6a98('0x11')](function(_0x4c619c){if(_0x4c619c){return _0x4c619c?{'count':_0x1cdcc1,'rows':_0x4c619c}:null;}})['then'](respondWithResult(_0x3b0b5b,null))[_0x6a98('0x24')](handleError(_0x3b0b5b,null));};exports['addTeams']=function(_0x22f375,_0x529c3a){var _0x3ce51c=_0x22f375[_0x6a98('0x30')][_0x6a98('0x50')];return db['Team'][_0x6a98('0x23')]({'where':{'id':_0x3ce51c},'attributes':['id'],'include':[{'model':db[_0x6a98('0x45')],'as':'Agents','attributes':['id',_0x6a98('0x18'),'online',_0x6a98('0x51'),_0x6a98('0x52')],'raw':!![]}]})['then'](function(_0x51c5ce){if(_0x51c5ce){var _0x56aab9=_[_0x6a98('0x53')](_0x51c5ce,function(_0x4ba627){var _0x3b092e=_0x4ba627[_0x6a98('0x13')]({'plain':!![]});return _0x3b092e[_0x6a98('0x54')];});return db[_0x6a98('0x22')][_0x6a98('0x35')]({'where':{'id':_0x22f375['params']['id']}})[_0x6a98('0x11')](function(_0x2375b5){return db[_0x6a98('0x55')]['transaction'](function(_0x3f7ffc){return _0x2375b5[_0x6a98('0x56')](_0x3ce51c,{'transaction':_0x3f7ffc})['then'](function(){return BPromise[_0x6a98('0x57')](_0x56aab9,function(_0x3c943b){return db[_0x6a98('0x3b')][_0x6a98('0x58')]({'where':{'UserId':_0x3c943b['id'],'ChatQueueId':_0x22f375['params']['id']},'transaction':_0x3f7ffc});});})['then'](function(){_0x56aab9[_0x6a98('0x59')](function(_0x37ed1f){socket[_0x6a98('0x5a')](_0x6a98('0x5b'),{'UserId':_0x37ed1f['id'],'ChatQueueId':_0x2375b5['id']});});});});});}})[_0x6a98('0x11')](respondWithStatusCode(_0x529c3a,null))[_0x6a98('0x24')](handleError(_0x529c3a,null));};exports[_0x6a98('0x5c')]=function(_0x30f926,_0x4a5d1f){return db[_0x6a98('0x4f')]['findAll']({'where':{'id':_0x30f926['query'][_0x6a98('0x50')]},'attributes':['id'],'include':[{'model':db[_0x6a98('0x45')],'as':_0x6a98('0x54'),'attributes':['id'],'raw':!![]}]})[_0x6a98('0x11')](handleEntityNotFound(_0x4a5d1f,null))[_0x6a98('0x11')](function(_0x3d0ccf){var _0x35b2d8=_['map'](_0x3d0ccf,'id');var _0x50486d=[];var _0x1f3029=[];var _0x85944f=squel[_0x6a98('0x5d')]();_0x85944f['field'](_0x6a98('0x5e'))[_0x6a98('0x5f')](_0x6a98('0x60'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6a98('0x1e')](_0x6a98('0x61'),_0x30f926[_0x6a98('0x25')]['id']);for(var _0xce52da=0x0;_0xce52da<_0x3d0ccf[_0x6a98('0x2b')];_0xce52da+=0x1){let _0x4c5869=_0x3d0ccf[_0xce52da];for(var _0x4d8e48=0x0;_0x4d8e48<_0x4c5869[_0x6a98('0x54')][_0x6a98('0x2b')];_0x4d8e48+=0x1){let _0x5e4914=_0x4c5869['Agents'][_0x4d8e48];var _0x29d7b9=_0x85944f[_0x6a98('0x62')]();_0x29d7b9[_0x6a98('0x1e')](_0x6a98('0x63'),_0x5e4914['id']);_0x1f3029[_0x6a98('0x64')](db['sequelize'][_0x6a98('0x21')](_0x29d7b9['toString'](),{'type':db[_0x6a98('0x55')][_0x6a98('0x65')][_0x6a98('0x66')]})['then'](function(_0x47e85d){if(_0x47e85d['length']===0x1){return _0x5e4914['id'];}else{var _0x421b35=_[_0x6a98('0x67')](_[_0x6a98('0x44')](_0x47e85d,_0x6a98('0x68')),function(_0xfc9cd1){return _[_0x6a98('0x69')](_0x35b2d8,_0xfc9cd1);});if(_0x421b35){return _0x5e4914['id'];}}}));}}return BPromise['all'](_0x1f3029)[_0x6a98('0x11')](function(_0x69688c){_0x50486d=_(_0x50486d)[_0x6a98('0x6a')](_0x69688c)[_0x6a98('0x6b')]()['value']();return db[_0x6a98('0x22')]['find']({'where':{'id':_0x30f926[_0x6a98('0x25')]['id']}})['then'](function(_0x3d0228){return db['sequelize'][_0x6a98('0x6c')](function(_0x4dacb3){return _0x3d0228['removeTeams'](_0x30f926[_0x6a98('0x21')][_0x6a98('0x50')],{'transaction':_0x4dacb3})[_0x6a98('0x11')](function(){if(!_['isEmpty'](_0x50486d)){return _0x3d0228[_0x6a98('0x6d')](_0x50486d,{'transaction':_0x4dacb3});}})[_0x6a98('0x11')](function(){_0x50486d['forEach'](function(_0x235e57){socket[_0x6a98('0x5a')]('userChatQueue:remove',{'UserId':_0x235e57,'ChatQueueId':_0x3d0228['id']});});});});});});})[_0x6a98('0x11')](respondWithStatusCode(_0x4a5d1f,null))[_0x6a98('0x24')](handleError(_0x4a5d1f,null));};exports[_0x6a98('0x6e')]=function(_0x3826ea,_0x4bdb77){return db[_0x6a98('0x22')][_0x6a98('0x35')]({'where':{'id':_0x3826ea[_0x6a98('0x25')]['id']}})[_0x6a98('0x11')](handleEntityNotFound(_0x4bdb77,null))[_0x6a98('0x11')](function(_0x515110){if(_0x515110){return _0x515110[_0x6a98('0x6e')](_0x3826ea[_0x6a98('0x30')]['ids'],_[_0x6a98('0x6f')](_0x3826ea[_0x6a98('0x30')],[_0x6a98('0x50'),'id'])||{})[_0x6a98('0x70')](function(_0x455fb9){for(var _0x298a2b=0x0;_0x298a2b<_0x3826ea[_0x6a98('0x30')][_0x6a98('0x50')][_0x6a98('0x2b')];_0x298a2b+=0x1){socket[_0x6a98('0x5a')]('userChatQueue:save',{'UserId':Number(_0x3826ea[_0x6a98('0x30')][_0x6a98('0x50')][_0x298a2b]),'ChatQueueId':Number(_0x3826ea[_0x6a98('0x25')]['id'])});}return _0x455fb9;});}})[_0x6a98('0x11')](respondWithResult(_0x4bdb77,null))['catch'](handleError(_0x4bdb77,null));};exports[_0x6a98('0x6d')]=function(_0x332061,_0xac1919){return db['ChatQueue'][_0x6a98('0x35')]({'where':{'id':_0x332061[_0x6a98('0x25')]['id']}})['then'](handleEntityNotFound(_0xac1919,null))[_0x6a98('0x11')](function(_0x8189ad){if(_0x8189ad){return _0x8189ad[_0x6a98('0x6d')](_0x332061[_0x6a98('0x21')][_0x6a98('0x50')])[_0x6a98('0x11')](function(){if(_[_0x6a98('0x71')](_0x332061[_0x6a98('0x21')][_0x6a98('0x50')])){for(var _0x47ad7e=0x0;_0x47ad7e<_0x332061['query'][_0x6a98('0x50')][_0x6a98('0x2b')];_0x47ad7e+=0x1){socket[_0x6a98('0x5a')](_0x6a98('0x72'),{'UserId':Number(_0x332061[_0x6a98('0x21')][_0x6a98('0x50')][_0x47ad7e]),'ChatQueueId':Number(_0x332061[_0x6a98('0x25')]['id'])});}}else{socket[_0x6a98('0x5a')](_0x6a98('0x72'),{'UserId':Number(_0x332061['query'][_0x6a98('0x50')]),'ChatQueueId':Number(_0x332061[_0x6a98('0x25')]['id'])});}});}})[_0x6a98('0x11')](respondWithStatusCode(_0xac1919,null))[_0x6a98('0x24')](handleError(_0xac1919,null));};exports['getAgents']=function(_0x3a743b,_0x3c03be){var _0x5c8807={};var _0x43a44a={};var _0x40b000;var _0x34d52b;return db['ChatQueue']['findOne']({'where':{'id':_0x3a743b[_0x6a98('0x25')]['id']}})['then'](handleEntityNotFound(_0x3c03be,null))[_0x6a98('0x11')](function(_0x543534){if(_0x543534){_0x40b000=_0x543534;_0x43a44a['model']=_['keys'](db[_0x6a98('0x45')][_0x6a98('0x1a')]);_0x43a44a[_0x6a98('0x21')]=_[_0x6a98('0x26')](_0x3a743b['query']);_0x43a44a[_0x6a98('0x27')]=_[_0x6a98('0x29')](_0x43a44a[_0x6a98('0x2c')],_0x43a44a[_0x6a98('0x21')]);_0x5c8807[_0x6a98('0x28')]=_[_0x6a98('0x29')](_0x43a44a[_0x6a98('0x2c')],qs[_0x6a98('0x2a')](_0x3a743b['query'][_0x6a98('0x2a')]));_0x5c8807[_0x6a98('0x28')]=_0x5c8807[_0x6a98('0x28')][_0x6a98('0x2b')]?_0x5c8807[_0x6a98('0x28')]:_0x43a44a[_0x6a98('0x2c')];_0x5c8807[_0x6a98('0x3f')]=qs[_0x6a98('0x40')](_0x3a743b['query']['sort']);_0x5c8807[_0x6a98('0x1e')]=qs[_0x6a98('0x27')](_[_0x6a98('0x41')](_0x3a743b[_0x6a98('0x21')],_0x43a44a[_0x6a98('0x27')]));if(_0x3a743b['query'][_0x6a98('0x43')]){_0x5c8807[_0x6a98('0x1e')]=_[_0x6a98('0x2d')](_0x5c8807['where'],{'$or':_['map'](_0x5c8807[_0x6a98('0x28')],function(_0x2b486c){var _0x27bc6e={};_0x27bc6e[_0x2b486c]={'$like':'%'+_0x3a743b[_0x6a98('0x21')]['filter']+'%'};return _0x27bc6e;})});}_0x5c8807=_['merge']({},_0x5c8807,_0x3a743b[_0x6a98('0x2e')]);return _0x40b000[_0x6a98('0x73')](_0x5c8807);}})['then'](function(_0x560e76){if(_0x560e76){_0x34d52b=_0x560e76['length'];if(!_0x3a743b[_0x6a98('0x21')][_0x6a98('0x3c')](_0x6a98('0x3d'))){_0x5c8807['limit']=qs['limit'](_0x3a743b['query'][_0x6a98('0x3e')]);_0x5c8807['offset']=qs[_0x6a98('0xc')](_0x3a743b[_0x6a98('0x21')][_0x6a98('0xc')]);}return _0x40b000['getAgents'](_0x5c8807);}})[_0x6a98('0x11')](function(_0x41fff8){if(_0x41fff8){return _0x41fff8?{'count':_0x34d52b,'rows':_0x41fff8}:null;}})[_0x6a98('0x11')](respondWithResult(_0x3c03be,null))[_0x6a98('0x24')](handleError(_0x3c03be,null));}; \ No newline at end of file +var _0x1ee6=['every','TeamId','includes','all','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','findOne','bluebird','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','status','offset','undefined','limit','set','Content-Range','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','ChatQueue','count','include','query','findAll','rows','catch','show','params','model','keys','attributes','fields','length','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','filters','intersection','hasOwnProperty','order','sort','pick','filter','merge','options','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','createdAt','%s/%s','updatedAt','getTeams','nolimit','addTeams','ids','Team','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x1ee6,0x86));var _0x61ee=function(_0x4c431e,_0x6b52b2){_0x4c431e=_0x4c431e-0x0;var _0x19259b=_0x1ee6[_0x4c431e];return _0x19259b;};'use strict';var BPromise=require(_0x61ee('0x0'));var util=require('util');var _=require(_0x61ee('0x1'));var squel=require('squel');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x61ee('0x2'))(_0x61ee('0x3'));var config=require(_0x61ee('0x4'));var db=require(_0x61ee('0x5'))['db'];config[_0x61ee('0x6')]=_['defaults'](config[_0x61ee('0x6')],{'host':_0x61ee('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x61ee('0x6')]));require('./chatQueue.socket')[_0x61ee('0x8')](socket);function respondWithStatusCode(_0x1d1986,_0x3dfafb){_0x3dfafb=_0x3dfafb||0xcc;return function(_0x15d5eb){if(_0x15d5eb){return _0x1d1986[_0x61ee('0x9')](_0x3dfafb);}return _0x1d1986[_0x61ee('0xa')](_0x3dfafb)['end']();};}function respondWithResult(_0x2d135c,_0x3a8f89){_0x3a8f89=_0x3a8f89||0xc8;return function(_0x3751b5){if(_0x3751b5){return _0x2d135c[_0x61ee('0xa')](_0x3a8f89)['json'](_0x3751b5);}};}function respondWithFilteredResult(_0x2288c2,_0x3cee6f){return function(_0x2a7599){if(_0x2a7599){var _0x432cb9=typeof _0x3cee6f[_0x61ee('0xb')]===_0x61ee('0xc')&&typeof _0x3cee6f[_0x61ee('0xd')]===_0x61ee('0xc');var _0x5c8925=_0x2a7599['count'];var _0x273467=_0x432cb9?0x0:_0x3cee6f[_0x61ee('0xb')];var _0x29e379=_0x432cb9?_0x2a7599['count']:_0x3cee6f['offset']+_0x3cee6f[_0x61ee('0xd')];var _0x3d04d7;if(_0x29e379>=_0x5c8925){_0x29e379=_0x5c8925;_0x3d04d7=0xc8;}else{_0x3d04d7=0xce;}_0x2288c2[_0x61ee('0xa')](_0x3d04d7);return _0x2288c2[_0x61ee('0xe')](_0x61ee('0xf'),_0x273467+'-'+_0x29e379+'/'+_0x5c8925)['json'](_0x2a7599);}return null;};}function saveUpdates(_0x5e3439){return function(_0x27bd67){if(_0x27bd67){return _0x27bd67[_0x61ee('0x10')](_0x5e3439)[_0x61ee('0x11')](function(_0x1c58e8){return _0x1c58e8;});}return null;};}function removeEntity(_0x1688ad){return function(_0x472eba){if(_0x472eba){return _0x472eba[_0x61ee('0x12')]()[_0x61ee('0x11')](function(){var _0x2580a3=_0x472eba['get']({'plain':!![]});var _0x4c41ce='ChatQueues';return db[_0x61ee('0x13')][_0x61ee('0x12')]({'where':{'type':_0x4c41ce,'resourceId':_0x2580a3['id']}})[_0x61ee('0x11')](function(){return _0x472eba;});})[_0x61ee('0x11')](function(){_0x1688ad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c9cb4){return function(_0xdbc1b7){if(!_0xdbc1b7){_0x5c9cb4[_0x61ee('0x9')](0x194);}return _0xdbc1b7;};}function handleError(_0x547d7c,_0x31059a){_0x31059a=_0x31059a||0x1f4;return function(_0x10c2cb){logger[_0x61ee('0x14')](_0x10c2cb[_0x61ee('0x15')]);if(_0x10c2cb[_0x61ee('0x16')]){delete _0x10c2cb[_0x61ee('0x16')];}_0x547d7c[_0x61ee('0xa')](_0x31059a)[_0x61ee('0x17')](_0x10c2cb);};}exports[_0x61ee('0x18')]=function(_0x5ad203,_0x3aaecb){var _0xcd978a={};var _0x286303={'count':0x0,'rows':[]};var _0x4a165e=_[_0x61ee('0x19')](db['ChatQueue'][_0x61ee('0x1a')],function(_0x1c7bee){return{'name':_0x1c7bee[_0x61ee('0x1b')],'type':_0x1c7bee[_0x61ee('0x1c')][_0x61ee('0x1d')]};});_0xcd978a=qs[_0x61ee('0x1e')](_0x4a165e,_0x5ad203);var _0xd0beb8={'where':_0xcd978a[_0x61ee('0x1f')]};return db[_0x61ee('0x20')][_0x61ee('0x21')](_0xd0beb8)['then'](function(_0x27b904){_0x286303[_0x61ee('0x21')]=_0x27b904;_0xcd978a['include']=qs[_0x61ee('0x22')](_0x5ad203[_0x61ee('0x23')]);return db[_0x61ee('0x20')][_0x61ee('0x24')](_0xcd978a);})[_0x61ee('0x11')](function(_0x14fae8){_0x286303[_0x61ee('0x25')]=_0x14fae8;return _0x286303;})[_0x61ee('0x11')](respondWithFilteredResult(_0x3aaecb,_0xcd978a))[_0x61ee('0x26')](handleError(_0x3aaecb,null));};exports[_0x61ee('0x27')]=function(_0x25d35a,_0x15535f){var _0x1b320c={'raw':!![],'where':{'id':_0x25d35a[_0x61ee('0x28')]['id']}},_0x2cb8e1={};_0x2cb8e1[_0x61ee('0x29')]=_[_0x61ee('0x2a')](db[_0x61ee('0x20')][_0x61ee('0x1a')]);_0x2cb8e1[_0x61ee('0x23')]=_['keys'](_0x25d35a[_0x61ee('0x23')]);_0x2cb8e1['filters']=_['intersection'](_0x2cb8e1['model'],_0x2cb8e1['query']);_0x1b320c[_0x61ee('0x2b')]=_['intersection'](_0x2cb8e1['model'],qs['fields'](_0x25d35a['query'][_0x61ee('0x2c')]));_0x1b320c['attributes']=_0x1b320c[_0x61ee('0x2b')][_0x61ee('0x2d')]?_0x1b320c[_0x61ee('0x2b')]:_0x2cb8e1[_0x61ee('0x29')];if(_0x25d35a[_0x61ee('0x23')][_0x61ee('0x2e')]){_0x1b320c[_0x61ee('0x22')]=[{'all':!![]}];}_0x1b320c=_['merge']({},_0x1b320c,_0x25d35a['options']);return db['ChatQueue'][_0x61ee('0x2f')](_0x1b320c)[_0x61ee('0x11')](handleEntityNotFound(_0x15535f,null))[_0x61ee('0x11')](respondWithResult(_0x15535f,null))['catch'](handleError(_0x15535f,null));};exports[_0x61ee('0x30')]=function(_0x4ca469,_0x7194f4){return db[_0x61ee('0x20')][_0x61ee('0x30')](_0x4ca469[_0x61ee('0x31')],{})[_0x61ee('0x11')](function(_0x254021){var _0x3c201b=_0x4ca469['user'][_0x61ee('0x32')]({'plain':!![]});if(!_0x3c201b)throw new Error(_0x61ee('0x33'));if(_0x3c201b[_0x61ee('0x34')]===_0x61ee('0x35')){var _0x229a88=_0x254021['get']({'plain':!![]});var _0x42d6a6=_0x61ee('0x36');return db[_0x61ee('0x37')][_0x61ee('0x2f')]({'where':{'name':_0x42d6a6,'userProfileId':_0x3c201b[_0x61ee('0x38')]},'raw':!![]})['then'](function(_0xef6835){if(_0xef6835&&_0xef6835[_0x61ee('0x39')]===0x0){return db['UserProfileResource'][_0x61ee('0x30')]({'name':_0x229a88[_0x61ee('0x16')],'resourceId':_0x229a88['id'],'type':_0xef6835['name'],'sectionId':_0xef6835['id']},{})[_0x61ee('0x11')](function(){return _0x254021;});}else{return _0x254021;}})[_0x61ee('0x26')](function(_0x458c16){logger['error'](_0x61ee('0x3a'),_0x458c16);throw _0x458c16;});}return _0x254021;})['then'](respondWithResult(_0x7194f4,0xc9))['catch'](handleError(_0x7194f4,null));};exports[_0x61ee('0x10')]=function(_0x54b2d5,_0x49ed3d){if(_0x54b2d5[_0x61ee('0x31')]['id']){delete _0x54b2d5[_0x61ee('0x31')]['id'];}return db[_0x61ee('0x20')][_0x61ee('0x2f')]({'where':{'id':_0x54b2d5[_0x61ee('0x28')]['id']}})[_0x61ee('0x11')](handleEntityNotFound(_0x49ed3d,null))[_0x61ee('0x11')](saveUpdates(_0x54b2d5[_0x61ee('0x31')],null))['then'](respondWithResult(_0x49ed3d,null))[_0x61ee('0x26')](handleError(_0x49ed3d,null));};exports['destroy']=function(_0x1d95f9,_0x5a9d31){return db[_0x61ee('0x20')][_0x61ee('0x2f')]({'where':{'id':_0x1d95f9[_0x61ee('0x28')]['id']}})['then'](handleEntityNotFound(_0x5a9d31,null))[_0x61ee('0x11')](removeEntity(_0x5a9d31,null))['catch'](handleError(_0x5a9d31,null));};exports[_0x61ee('0x3b')]=function(_0x5b2255,_0x1afab1){return db[_0x61ee('0x20')][_0x61ee('0x3b')]()[_0x61ee('0x11')](respondWithResult(_0x1afab1,null))[_0x61ee('0x26')](handleError(_0x1afab1,null));};exports[_0x61ee('0x3c')]=function(_0x2c555c,_0x546fb2){var _0x5c1792={'raw':!![],'where':{}},_0x4c595b={},_0x37204e;return db[_0x61ee('0x20')]['findOne']({'where':{'id':_0x2c555c['params']['id']}})[_0x61ee('0x11')](handleEntityNotFound(_0x546fb2,null))['then'](function(_0x3987d2){if(_0x3987d2){_0x37204e=_0x3987d2[_0x61ee('0x32')]({'plain':!![]});_0x4c595b[_0x61ee('0x29')]=_['keys'](db['UserChatQueue'][_0x61ee('0x1a')]);_0x4c595b['query']=_['keys'](_0x2c555c['query']);_0x4c595b[_0x61ee('0x3d')]=_[_0x61ee('0x3e')](_0x4c595b['model'],_0x4c595b[_0x61ee('0x23')]);_0x5c1792['attributes']=_[_0x61ee('0x3e')](_0x4c595b[_0x61ee('0x29')],qs['fields'](_0x2c555c['query']['fields']));_0x5c1792[_0x61ee('0x2b')]=_0x5c1792[_0x61ee('0x2b')][_0x61ee('0x2d')]?_0x5c1792[_0x61ee('0x2b')]:_0x4c595b[_0x61ee('0x29')];if(!_0x2c555c['query'][_0x61ee('0x3f')]('nolimit')){_0x5c1792[_0x61ee('0xd')]=qs['limit'](_0x2c555c[_0x61ee('0x23')]['limit']);_0x5c1792[_0x61ee('0xb')]=qs[_0x61ee('0xb')](_0x2c555c[_0x61ee('0x23')]['offset']);}_0x5c1792[_0x61ee('0x40')]=qs[_0x61ee('0x41')](_0x2c555c[_0x61ee('0x23')][_0x61ee('0x41')]);_0x5c1792[_0x61ee('0x1f')]=qs[_0x61ee('0x3d')](_[_0x61ee('0x42')](_0x2c555c[_0x61ee('0x23')],_0x4c595b[_0x61ee('0x3d')]));_0x5c1792[_0x61ee('0x1f')]['ChatQueueId']=_0x3987d2['id'];if(_0x2c555c[_0x61ee('0x23')][_0x61ee('0x43')]){_0x5c1792['where']=_[_0x61ee('0x44')](_0x5c1792[_0x61ee('0x1f')],{'$or':_[_0x61ee('0x19')](_0x5c1792[_0x61ee('0x2b')],function(_0x47f650){var _0x260c09={};_0x260c09[_0x47f650]={'$like':'%'+_0x2c555c[_0x61ee('0x23')][_0x61ee('0x43')]+'%'};return _0x260c09;})});}_0x5c1792=_['merge']({},_0x5c1792,_0x2c555c[_0x61ee('0x45')]);return db[_0x61ee('0x46')][_0x61ee('0x24')](_0x5c1792);}})[_0x61ee('0x11')](function(_0x17c047){if(_0x17c047){return db[_0x61ee('0x47')][_0x61ee('0x48')]({'where':{'id':_[_0x61ee('0x19')](_0x17c047,_0x61ee('0x49')),'role':_0x61ee('0x4a')},'attributes':['id',_0x61ee('0x16'),_0x61ee('0x4b'),'updatedAt',_0x61ee('0x4c')]});}})[_0x61ee('0x11')](function(_0x5e660a){if(_0x5e660a){return{'count':_0x5e660a[_0x61ee('0x21')],'rows':_[_0x61ee('0x19')](_0x5e660a[_0x61ee('0x25')],function(_0x91e104){return{'membername':_0x91e104[_0x61ee('0x16')],'UserId':_0x91e104['id'],'queue_name':_0x37204e[_0x61ee('0x16')],'ChatQueueId':_0x37204e['id'],'interface':util['format'](_0x61ee('0x4d'),'SIP',_0x91e104[_0x61ee('0x16')]),'penalty':0x0,'paused':_0x91e104[_0x61ee('0x4b')],'createdAt':_0x91e104[_0x61ee('0x4c')],'updatedAt':_0x91e104[_0x61ee('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x546fb2,_0x5c1792))[_0x61ee('0x26')](handleError(_0x546fb2,null));};exports[_0x61ee('0x4f')]=function(_0x27eee2,_0x52527a){var _0x14a40f={};var _0x19d211={};var _0x25c919;var _0x6f0ce2;return db[_0x61ee('0x20')]['findOne']({'where':{'id':_0x27eee2[_0x61ee('0x28')]['id']}})['then'](handleEntityNotFound(_0x52527a,null))[_0x61ee('0x11')](function(_0x35d553){if(_0x35d553){_0x25c919=_0x35d553;_0x19d211['model']=_['keys'](db['Team'][_0x61ee('0x1a')]);_0x19d211[_0x61ee('0x23')]=_[_0x61ee('0x2a')](_0x27eee2[_0x61ee('0x23')]);_0x19d211[_0x61ee('0x3d')]=_['intersection'](_0x19d211['model'],_0x19d211[_0x61ee('0x23')]);_0x14a40f['attributes']=_[_0x61ee('0x3e')](_0x19d211[_0x61ee('0x29')],qs[_0x61ee('0x2c')](_0x27eee2[_0x61ee('0x23')][_0x61ee('0x2c')]));_0x14a40f[_0x61ee('0x2b')]=_0x14a40f['attributes'][_0x61ee('0x2d')]?_0x14a40f['attributes']:_0x19d211['model'];_0x14a40f['order']=qs['sort'](_0x27eee2[_0x61ee('0x23')][_0x61ee('0x41')]);_0x14a40f[_0x61ee('0x1f')]=qs['filters'](_[_0x61ee('0x42')](_0x27eee2[_0x61ee('0x23')],_0x19d211[_0x61ee('0x3d')]));if(_0x27eee2[_0x61ee('0x23')][_0x61ee('0x43')]){_0x14a40f['where']=_['merge'](_0x14a40f[_0x61ee('0x1f')],{'$or':_[_0x61ee('0x19')](_0x14a40f['attributes'],function(_0x42e23b){var _0x315a88={};_0x315a88[_0x42e23b]={'$like':'%'+_0x27eee2[_0x61ee('0x23')][_0x61ee('0x43')]+'%'};return _0x315a88;})});}_0x14a40f=_[_0x61ee('0x44')]({},_0x14a40f,_0x27eee2[_0x61ee('0x45')]);return _0x25c919[_0x61ee('0x4f')](_0x14a40f);}})[_0x61ee('0x11')](function(_0x1afb04){if(_0x1afb04){_0x6f0ce2=_0x1afb04[_0x61ee('0x2d')];if(!_0x27eee2[_0x61ee('0x23')][_0x61ee('0x3f')](_0x61ee('0x50'))){_0x14a40f[_0x61ee('0xd')]=qs[_0x61ee('0xd')](_0x27eee2[_0x61ee('0x23')]['limit']);_0x14a40f[_0x61ee('0xb')]=qs['offset'](_0x27eee2[_0x61ee('0x23')][_0x61ee('0xb')]);}return _0x25c919['getTeams'](_0x14a40f);}})[_0x61ee('0x11')](function(_0x2e2766){if(_0x2e2766){return _0x2e2766?{'count':_0x6f0ce2,'rows':_0x2e2766}:null;}})[_0x61ee('0x11')](respondWithResult(_0x52527a,null))['catch'](handleError(_0x52527a,null));};exports[_0x61ee('0x51')]=function(_0x43f166,_0x5663d3){var _0x478378=_0x43f166[_0x61ee('0x31')][_0x61ee('0x52')];return db[_0x61ee('0x53')]['findAll']({'where':{'id':_0x478378},'attributes':['id'],'include':[{'model':db[_0x61ee('0x47')],'as':_0x61ee('0x54'),'attributes':['id','name',_0x61ee('0x55'),_0x61ee('0x56'),'interface'],'raw':!![]}]})[_0x61ee('0x11')](function(_0x31b4d1){if(_0x31b4d1){var _0xac026f=_['flatMap'](_0x31b4d1,function(_0x50a151){var _0x5449f0=_0x50a151[_0x61ee('0x32')]({'plain':!![]});return _0x5449f0[_0x61ee('0x54')];});return db[_0x61ee('0x20')][_0x61ee('0x2f')]({'where':{'id':_0x43f166[_0x61ee('0x28')]['id']}})[_0x61ee('0x11')](function(_0x3363b3){return db[_0x61ee('0x57')][_0x61ee('0x58')](function(_0x541881){return _0x3363b3[_0x61ee('0x51')](_0x478378,{'transaction':_0x541881})[_0x61ee('0x11')](function(){return BPromise[_0x61ee('0x59')](_0xac026f,function(_0x49a2ab){return db[_0x61ee('0x46')][_0x61ee('0x5a')]({'where':{'UserId':_0x49a2ab['id'],'ChatQueueId':_0x43f166[_0x61ee('0x28')]['id']},'transaction':_0x541881});});})[_0x61ee('0x11')](function(){_0xac026f[_0x61ee('0x5b')](function(_0x63ddf3){socket[_0x61ee('0x5c')](_0x61ee('0x5d'),{'UserId':_0x63ddf3['id'],'ChatQueueId':_0x3363b3['id']});});});});});}})[_0x61ee('0x11')](respondWithStatusCode(_0x5663d3,null))[_0x61ee('0x26')](handleError(_0x5663d3,null));};exports[_0x61ee('0x5e')]=function(_0x379100,_0x409e79){return db[_0x61ee('0x53')][_0x61ee('0x24')]({'where':{'id':_0x379100[_0x61ee('0x23')][_0x61ee('0x52')]},'attributes':['id'],'include':[{'model':db[_0x61ee('0x47')],'as':_0x61ee('0x54'),'attributes':['id'],'raw':!![]}]})[_0x61ee('0x11')](handleEntityNotFound(_0x409e79,null))[_0x61ee('0x11')](function(_0x1a7fcd){var _0x73ef63=_[_0x61ee('0x19')](_0x1a7fcd,'id');var _0xf6ece1=[];var _0x34519f=[];var _0xdade1a=squel['select']();_0xdade1a[_0x61ee('0x5f')]('tq.TeamId')[_0x61ee('0x60')](_0x61ee('0x61'),'tq')[_0x61ee('0x62')](_0x61ee('0x63'),'ut',_0x61ee('0x64'))[_0x61ee('0x1f')](_0x61ee('0x65'),_0x379100[_0x61ee('0x28')]['id']);for(var _0x479e5d=0x0;_0x479e5d<_0x1a7fcd[_0x61ee('0x2d')];_0x479e5d+=0x1){let _0x50d59c=_0x1a7fcd[_0x479e5d];for(var _0x201aaf=0x0;_0x201aaf<_0x50d59c['Agents'][_0x61ee('0x2d')];_0x201aaf+=0x1){let _0x3c213d=_0x50d59c[_0x61ee('0x54')][_0x201aaf];var _0x17d1c2=_0xdade1a[_0x61ee('0x66')]();_0x17d1c2[_0x61ee('0x1f')](_0x61ee('0x67'),_0x3c213d['id']);_0x34519f[_0x61ee('0x68')](db[_0x61ee('0x57')][_0x61ee('0x23')](_0x17d1c2[_0x61ee('0x69')](),{'type':db['sequelize'][_0x61ee('0x6a')][_0x61ee('0x6b')]})['then'](function(_0x26ef76){if(_0x26ef76[_0x61ee('0x2d')]===0x1){return _0x3c213d['id'];}else{var _0x3d880f=_[_0x61ee('0x6c')](_[_0x61ee('0x19')](_0x26ef76,_0x61ee('0x6d')),function(_0x5c6bd2){return _[_0x61ee('0x6e')](_0x73ef63,_0x5c6bd2);});if(_0x3d880f){return _0x3c213d['id'];}}}));}}return BPromise[_0x61ee('0x6f')](_0x34519f)['then'](function(_0x392ea9){_0xf6ece1=_(_0xf6ece1)['union'](_0x392ea9)[_0x61ee('0x70')]()['value']();return db['ChatQueue']['find']({'where':{'id':_0x379100[_0x61ee('0x28')]['id']}})['then'](function(_0xb0f051){return db[_0x61ee('0x57')][_0x61ee('0x58')](function(_0x3bcc6e){return _0xb0f051[_0x61ee('0x5e')](_0x379100[_0x61ee('0x23')]['ids'],{'transaction':_0x3bcc6e})[_0x61ee('0x11')](function(){if(!_[_0x61ee('0x71')](_0xf6ece1)){return _0xb0f051[_0x61ee('0x72')](_0xf6ece1,{'transaction':_0x3bcc6e});}})[_0x61ee('0x11')](function(){_0xf6ece1[_0x61ee('0x5b')](function(_0x4f51f0){socket['emit'](_0x61ee('0x73'),{'UserId':_0x4f51f0,'ChatQueueId':_0xb0f051['id']});});});});});});})[_0x61ee('0x11')](respondWithStatusCode(_0x409e79,null))[_0x61ee('0x26')](handleError(_0x409e79,null));};exports[_0x61ee('0x74')]=function(_0x46a0a3,_0x2b2436){return db[_0x61ee('0x20')][_0x61ee('0x2f')]({'where':{'id':_0x46a0a3[_0x61ee('0x28')]['id']}})[_0x61ee('0x11')](handleEntityNotFound(_0x2b2436,null))[_0x61ee('0x11')](function(_0x4876de){if(_0x4876de){return _0x4876de[_0x61ee('0x74')](_0x46a0a3[_0x61ee('0x31')]['ids'],_[_0x61ee('0x75')](_0x46a0a3[_0x61ee('0x31')],['ids','id'])||{})['spread'](function(_0x15fc42){for(var _0x4a3952=0x0;_0x4a3952<_0x46a0a3[_0x61ee('0x31')]['ids'][_0x61ee('0x2d')];_0x4a3952+=0x1){socket['emit'](_0x61ee('0x5d'),{'UserId':Number(_0x46a0a3[_0x61ee('0x31')]['ids'][_0x4a3952]),'ChatQueueId':Number(_0x46a0a3['params']['id'])});}return _0x15fc42;});}})['then'](respondWithResult(_0x2b2436,null))[_0x61ee('0x26')](handleError(_0x2b2436,null));};exports[_0x61ee('0x72')]=function(_0x85f790,_0x368485){return db['ChatQueue']['find']({'where':{'id':_0x85f790['params']['id']}})['then'](handleEntityNotFound(_0x368485,null))['then'](function(_0x4474f6){if(_0x4474f6){return _0x4474f6[_0x61ee('0x72')](_0x85f790[_0x61ee('0x23')][_0x61ee('0x52')])['then'](function(){if(_[_0x61ee('0x76')](_0x85f790[_0x61ee('0x23')][_0x61ee('0x52')])){for(var _0x3e2894=0x0;_0x3e2894<_0x85f790[_0x61ee('0x23')][_0x61ee('0x52')][_0x61ee('0x2d')];_0x3e2894+=0x1){socket[_0x61ee('0x5c')](_0x61ee('0x73'),{'UserId':Number(_0x85f790[_0x61ee('0x23')][_0x61ee('0x52')][_0x3e2894]),'ChatQueueId':Number(_0x85f790[_0x61ee('0x28')]['id'])});}}else{socket[_0x61ee('0x5c')](_0x61ee('0x73'),{'UserId':Number(_0x85f790[_0x61ee('0x23')][_0x61ee('0x52')]),'ChatQueueId':Number(_0x85f790[_0x61ee('0x28')]['id'])});}});}})[_0x61ee('0x11')](respondWithStatusCode(_0x368485,null))[_0x61ee('0x26')](handleError(_0x368485,null));};exports[_0x61ee('0x77')]=function(_0x308186,_0x5dd282){var _0x5cb632={};var _0x406cda={};var _0x55c152;var _0xdc6235;return db[_0x61ee('0x20')][_0x61ee('0x78')]({'where':{'id':_0x308186[_0x61ee('0x28')]['id']}})['then'](handleEntityNotFound(_0x5dd282,null))[_0x61ee('0x11')](function(_0x435831){if(_0x435831){_0x55c152=_0x435831;_0x406cda['model']=_[_0x61ee('0x2a')](db[_0x61ee('0x47')][_0x61ee('0x1a')]);_0x406cda[_0x61ee('0x23')]=_[_0x61ee('0x2a')](_0x308186[_0x61ee('0x23')]);_0x406cda[_0x61ee('0x3d')]=_['intersection'](_0x406cda[_0x61ee('0x29')],_0x406cda[_0x61ee('0x23')]);_0x5cb632[_0x61ee('0x2b')]=_['intersection'](_0x406cda[_0x61ee('0x29')],qs[_0x61ee('0x2c')](_0x308186[_0x61ee('0x23')][_0x61ee('0x2c')]));_0x5cb632[_0x61ee('0x2b')]=_0x5cb632[_0x61ee('0x2b')][_0x61ee('0x2d')]?_0x5cb632[_0x61ee('0x2b')]:_0x406cda[_0x61ee('0x29')];_0x5cb632[_0x61ee('0x40')]=qs[_0x61ee('0x41')](_0x308186['query'][_0x61ee('0x41')]);_0x5cb632['where']=qs[_0x61ee('0x3d')](_[_0x61ee('0x42')](_0x308186[_0x61ee('0x23')],_0x406cda['filters']));if(_0x308186[_0x61ee('0x23')][_0x61ee('0x43')]){_0x5cb632[_0x61ee('0x1f')]=_[_0x61ee('0x44')](_0x5cb632['where'],{'$or':_[_0x61ee('0x19')](_0x5cb632[_0x61ee('0x2b')],function(_0x1beb6a){var _0x4ed78b={};_0x4ed78b[_0x1beb6a]={'$like':'%'+_0x308186[_0x61ee('0x23')][_0x61ee('0x43')]+'%'};return _0x4ed78b;})});}_0x5cb632=_['merge']({},_0x5cb632,_0x308186[_0x61ee('0x45')]);return _0x55c152['getAgents'](_0x5cb632);}})['then'](function(_0x390bef){if(_0x390bef){_0xdc6235=_0x390bef[_0x61ee('0x2d')];if(!_0x308186[_0x61ee('0x23')][_0x61ee('0x3f')]('nolimit')){_0x5cb632['limit']=qs[_0x61ee('0xd')](_0x308186[_0x61ee('0x23')]['limit']);_0x5cb632[_0x61ee('0xb')]=qs[_0x61ee('0xb')](_0x308186[_0x61ee('0x23')]['offset']);}return _0x55c152['getAgents'](_0x5cb632);}})['then'](function(_0x1a5332){if(_0x1a5332){return _0x1a5332?{'count':_0xdc6235,'rows':_0x1a5332}:null;}})[_0x61ee('0x11')](respondWithResult(_0x5dd282,null))[_0x61ee('0x26')](handleError(_0x5dd282,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 75ac84b..dab936d 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 _0x9246=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x5c418a,_0x5392ac){var _0x20f968=function(_0x4891b9){while(--_0x4891b9){_0x5c418a['push'](_0x5c418a['shift']());}};_0x20f968(++_0x5392ac);}(_0x9246,0x18a));var _0x6924=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x9246[_0x476bf4];return _0x788ffe;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x6924('0x0'))['db'][_0x6924('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6924('0x2'),'afterUpdate':_0x6924('0x3'),'afterDestroy':_0x6924('0x4')};function emitEvent(_0x1ecff7){return function(_0x7656fe,_0x47a87d,_0x441d72){ChatQueueEvents[_0x6924('0x5')](_0x1ecff7+':'+_0x7656fe['id'],_0x7656fe);ChatQueueEvents['emit'](_0x1ecff7,_0x7656fe);_0x441d72(null);};}for(var e in events){if(events[_0x6924('0x6')](e)){var event=events[e];ChatQueue[_0x6924('0x7')](e,emitEvent(event));}}module[_0x6924('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x0e9f=['hasOwnProperty','exports','events','../../mysqldb','save','emit'];(function(_0x235d0d,_0x33677b){var _0x4c3380=function(_0x187c61){while(--_0x187c61){_0x235d0d['push'](_0x235d0d['shift']());}};_0x4c3380(++_0x33677b);}(_0x0e9f,0x116));var _0xf0e9=function(_0x1c7aa5,_0x3bf86e){_0x1c7aa5=_0x1c7aa5-0x0;var _0x4a2561=_0x0e9f[_0x1c7aa5];return _0x4a2561;};'use strict';var EventEmitter=require(_0xf0e9('0x0'));var ChatQueue=require(_0xf0e9('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf0e9('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2d2d99){return function(_0x559cad,_0x52a19d,_0x159a42){ChatQueueEvents[_0xf0e9('0x3')](_0x2d2d99+':'+_0x559cad['id'],_0x559cad);ChatQueueEvents['emit'](_0x2d2d99,_0x559cad);_0x159a42(null);};}for(var e in events){if(events[_0xf0e9('0x4')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xf0e9('0x5')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index d74500f..e55f395 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 _0xcd6b=['request-promise','path','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','bluebird'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0xcd6b,0x96));var _0xbcd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbcd6('0x0'));var util=require('util');var logger=require(_0xbcd6('0x1'))(_0xbcd6('0x2'));var moment=require('moment');var BPromise=require(_0xbcd6('0x3'));var rp=require(_0xbcd6('0x4'));var fs=require('fs');var path=require(_0xbcd6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbcd6('0x6'));module[_0xbcd6('0x7')]=function(_0xb21e55,_0x39f36f){return _0xb21e55[_0xbcd6('0x8')](_0xbcd6('0x9'),attributes,{'tableName':_0xbcd6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee3=['chat_queues','../../config/logger','moment','bluebird','request-promise','rimraf','./chatQueue.attributes','ChatQueue'];(function(_0x3092b4,_0x2827ae){var _0x15f01e=function(_0x31a989){while(--_0x31a989){_0x3092b4['push'](_0x3092b4['shift']());}};_0x15f01e(++_0x2827ae);}(_0x7ee3,0x121));var _0x37ee=function(_0x29f98b,_0xb86421){_0x29f98b=_0x29f98b-0x0;var _0x2245ca=_0x7ee3[_0x29f98b];return _0x2245ca;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x37ee('0x0'))('api');var moment=require(_0x37ee('0x1'));var BPromise=require(_0x37ee('0x2'));var rp=require(_0x37ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x37ee('0x4'));var config=require('../../config/environment');var attributes=require(_0x37ee('0x5'));module['exports']=function(_0x2401df,_0x3c4791){return _0x2401df['define'](_0x37ee('0x6'),attributes,{'tableName':_0x37ee('0x7'),'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 35486fb..bc66f62 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 _0x1794=['GetChatQueue','ChatQueue','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowChatQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1794,0x19d));var _0x4179=function(_0x3ff150,_0x228f06){_0x3ff150=_0x3ff150-0x0;var _0xb6ac18=_0x1794[_0x3ff150];return _0xb6ac18;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4179('0x0'));var BPromise=require(_0x4179('0x1'));var rs=require(_0x4179('0x2'));var fs=require('fs');var Redis=require(_0x4179('0x3'));var db=require(_0x4179('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4179('0x5'));var config=require(_0x4179('0x6'));var jayson=require(_0x4179('0x7'));var client=jayson[_0x4179('0x8')][_0x4179('0x9')]({'port':0x232a});config[_0x4179('0xa')]=_[_0x4179('0xb')](config[_0x4179('0xa')],{'host':_0x4179('0xc'),'port':0x18eb});var socket=require(_0x4179('0xd'))(new Redis(config['redis']));require(_0x4179('0xe'))[_0x4179('0xf')](socket);function respondWithRpcPromise(_0xa0bd21,_0x5ed1c6,_0x71c3df){return new BPromise(function(_0x591de5,_0x345270){return client['request'](_0xa0bd21,_0x71c3df)[_0x4179('0x10')](function(_0x5ad5e7){logger[_0x4179('0x11')](_0x4179('0x12'),_0x5ed1c6,_0x4179('0x13'));logger['debug'](_0x4179('0x14'),_0x5ed1c6,'request\x20sent',JSON[_0x4179('0x15')](_0x5ad5e7));if(_0x5ad5e7[_0x4179('0x16')]){if(_0x5ad5e7['error'][_0x4179('0x17')]===0x1f4){logger[_0x4179('0x16')]('ChatQueue,\x20%s,\x20%s',_0x5ed1c6,_0x5ad5e7[_0x4179('0x16')][_0x4179('0x18')]);return _0x345270(_0x5ad5e7[_0x4179('0x16')][_0x4179('0x18')]);}logger[_0x4179('0x16')](_0x4179('0x12'),_0x5ed1c6,_0x5ad5e7[_0x4179('0x16')][_0x4179('0x18')]);return _0x591de5(_0x5ad5e7[_0x4179('0x16')][_0x4179('0x18')]);}else{logger[_0x4179('0x11')](_0x4179('0x12'),_0x5ed1c6,_0x4179('0x13'));_0x591de5(_0x5ad5e7[_0x4179('0x19')]['message']);}})[_0x4179('0x1a')](function(_0x508074){logger[_0x4179('0x16')]('ChatQueue,\x20%s,\x20%s',_0x5ed1c6,_0x508074);_0x345270(_0x508074);});});}exports[_0x4179('0x1b')]=function(_0x2cdea0){var _0x55b04f=this;return new Promise(function(_0x5968ae,_0x3d3264){return db[_0x4179('0x1c')][_0x4179('0x1d')]({'raw':_0x2cdea0[_0x4179('0x1e')]?_0x2cdea0[_0x4179('0x1e')][_0x4179('0x1f')]===undefined?!![]:![]:!![],'where':_0x2cdea0[_0x4179('0x1e')]?_0x2cdea0[_0x4179('0x1e')][_0x4179('0x20')]||null:null,'attributes':_0x2cdea0[_0x4179('0x1e')]?_0x2cdea0[_0x4179('0x1e')]['attributes']||null:null,'limit':_0x2cdea0['options']?_0x2cdea0[_0x4179('0x1e')][_0x4179('0x21')]||null:null,'include':_0x2cdea0[_0x4179('0x1e')]?_0x2cdea0[_0x4179('0x1e')][_0x4179('0x22')]?_[_0x4179('0x23')](_0x2cdea0['options'][_0x4179('0x22')],function(_0x45cb7e){return{'model':db[_0x45cb7e[_0x4179('0x24')]],'as':_0x45cb7e['as'],'attributes':_0x45cb7e[_0x4179('0x25')],'include':_0x45cb7e['include']?_[_0x4179('0x23')](_0x45cb7e[_0x4179('0x22')],function(_0x230f53){return{'model':db[_0x230f53[_0x4179('0x24')]],'as':_0x230f53['as'],'attributes':_0x230f53[_0x4179('0x25')],'include':_0x230f53[_0x4179('0x22')]?_[_0x4179('0x23')](_0x230f53['include'],function(_0x5cbfb2){return{'model':db[_0x5cbfb2[_0x4179('0x24')]],'as':_0x5cbfb2['as'],'attributes':_0x5cbfb2[_0x4179('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38906d){logger['info']('GetChatQueue',_0x2cdea0);logger[_0x4179('0x26')](_0x4179('0x1b'),_0x2cdea0,JSON[_0x4179('0x15')](_0x38906d));_0x5968ae(_0x38906d);})[_0x4179('0x1a')](function(_0x194fd2){logger['error']('GetChatQueue',_0x194fd2[_0x4179('0x18')],_0x2cdea0);_0x3d3264(_0x55b04f['error'](0x1f4,_0x194fd2['message']));});});};exports[_0x4179('0x27')]=function(_0x123b36){var _0x63aa5a=this;return new Promise(function(_0x49bf5d,_0x40cbed){return db[_0x4179('0x1c')]['find']({'raw':_0x123b36[_0x4179('0x1e')]?_0x123b36['options'][_0x4179('0x1f')]===undefined?!![]:![]:!![],'where':_0x123b36[_0x4179('0x1e')]?_0x123b36['options'][_0x4179('0x20')]||null:null,'attributes':_0x123b36[_0x4179('0x1e')]?_0x123b36[_0x4179('0x1e')][_0x4179('0x25')]||null:null,'include':_0x123b36[_0x4179('0x1e')]?_0x123b36[_0x4179('0x1e')][_0x4179('0x22')]?_['map'](_0x123b36['options'][_0x4179('0x22')],function(_0x72d6f5){return{'model':db[_0x72d6f5['model']],'as':_0x72d6f5['as'],'attributes':_0x72d6f5[_0x4179('0x25')],'include':_0x72d6f5[_0x4179('0x22')]?_[_0x4179('0x23')](_0x72d6f5[_0x4179('0x22')],function(_0x27289c){return{'model':db[_0x27289c['model']],'as':_0x27289c['as'],'attributes':_0x27289c[_0x4179('0x25')],'include':_0x27289c[_0x4179('0x22')]?_[_0x4179('0x23')](_0x27289c['include'],function(_0x507a4a){return{'model':db[_0x507a4a[_0x4179('0x24')]],'as':_0x507a4a['as'],'attributes':_0x507a4a[_0x4179('0x25')]};}):[]};}):[]};}):[]:[]})[_0x4179('0x10')](function(_0x394485){logger[_0x4179('0x11')]('ShowChatQueue',_0x123b36);logger['debug'](_0x4179('0x27'),_0x123b36,JSON[_0x4179('0x15')](_0x394485));_0x49bf5d(_0x394485);})[_0x4179('0x1a')](function(_0x37e838){logger['error'](_0x4179('0x27'),_0x37e838['message'],_0x123b36);_0x40cbed(_0x63aa5a[_0x4179('0x16')](0x1f4,_0x37e838['message']));});});}; \ No newline at end of file +var _0xf269=['stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowChatQueue','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf269,0xd2));var _0x9f26=function(_0x2b6485,_0xbb4dc5){_0x2b6485=_0x2b6485-0x0;var _0x5e96bd=_0xf269[_0x2b6485];return _0x5e96bd;};'use strict';var _=require('lodash');var util=require(_0x9f26('0x0'));var moment=require(_0x9f26('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f26('0x2'));var fs=require('fs');var Redis=require(_0x9f26('0x3'));var db=require(_0x9f26('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f26('0x5'))('rpc');var config=require(_0x9f26('0x6'));var jayson=require(_0x9f26('0x7'));var client=jayson[_0x9f26('0x8')][_0x9f26('0x9')]({'port':0x232a});config[_0x9f26('0xa')]=_[_0x9f26('0xb')](config[_0x9f26('0xa')],{'host':_0x9f26('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x9f26('0xd')](socket);function respondWithRpcPromise(_0x5673ff,_0x58e158,_0x4ef282){return new BPromise(function(_0x2c30e2,_0x31ed97){return client[_0x9f26('0xe')](_0x5673ff,_0x4ef282)[_0x9f26('0xf')](function(_0x550c24){logger['info']('ChatQueue,\x20%s,\x20%s',_0x58e158,_0x9f26('0x10'));logger[_0x9f26('0x11')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x58e158,_0x9f26('0x10'),JSON[_0x9f26('0x12')](_0x550c24));if(_0x550c24[_0x9f26('0x13')]){if(_0x550c24[_0x9f26('0x13')][_0x9f26('0x14')]===0x1f4){logger['error'](_0x9f26('0x15'),_0x58e158,_0x550c24[_0x9f26('0x13')][_0x9f26('0x16')]);return _0x31ed97(_0x550c24['error'][_0x9f26('0x16')]);}logger[_0x9f26('0x13')](_0x9f26('0x15'),_0x58e158,_0x550c24[_0x9f26('0x13')][_0x9f26('0x16')]);return _0x2c30e2(_0x550c24['error'][_0x9f26('0x16')]);}else{logger[_0x9f26('0x17')](_0x9f26('0x15'),_0x58e158,_0x9f26('0x10'));_0x2c30e2(_0x550c24[_0x9f26('0x18')][_0x9f26('0x16')]);}})['catch'](function(_0x50aa3d){logger[_0x9f26('0x13')]('ChatQueue,\x20%s,\x20%s',_0x58e158,_0x50aa3d);_0x31ed97(_0x50aa3d);});});}exports[_0x9f26('0x19')]=function(_0x2b3d30){var _0x81d0cc=this;return new Promise(function(_0x2b4b98,_0xa2a523){return db[_0x9f26('0x1a')][_0x9f26('0x1b')]({'raw':_0x2b3d30['options']?_0x2b3d30[_0x9f26('0x1c')][_0x9f26('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b3d30[_0x9f26('0x1c')]?_0x2b3d30[_0x9f26('0x1c')][_0x9f26('0x1e')]||null:null,'attributes':_0x2b3d30[_0x9f26('0x1c')]?_0x2b3d30[_0x9f26('0x1c')][_0x9f26('0x1f')]||null:null,'limit':_0x2b3d30[_0x9f26('0x1c')]?_0x2b3d30[_0x9f26('0x1c')][_0x9f26('0x20')]||null:null,'include':_0x2b3d30[_0x9f26('0x1c')]?_0x2b3d30['options'][_0x9f26('0x21')]?_[_0x9f26('0x22')](_0x2b3d30[_0x9f26('0x1c')][_0x9f26('0x21')],function(_0x300797){return{'model':db[_0x300797[_0x9f26('0x23')]],'as':_0x300797['as'],'attributes':_0x300797['attributes'],'include':_0x300797[_0x9f26('0x21')]?_[_0x9f26('0x22')](_0x300797['include'],function(_0x5f1973){return{'model':db[_0x5f1973[_0x9f26('0x23')]],'as':_0x5f1973['as'],'attributes':_0x5f1973['attributes'],'include':_0x5f1973[_0x9f26('0x21')]?_['map'](_0x5f1973[_0x9f26('0x21')],function(_0x25168b){return{'model':db[_0x25168b[_0x9f26('0x23')]],'as':_0x25168b['as'],'attributes':_0x25168b[_0x9f26('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9f26('0xf')](function(_0x2f086f){logger[_0x9f26('0x17')](_0x9f26('0x19'),_0x2b3d30);logger[_0x9f26('0x11')](_0x9f26('0x19'),_0x2b3d30,JSON[_0x9f26('0x12')](_0x2f086f));_0x2b4b98(_0x2f086f);})[_0x9f26('0x24')](function(_0x2dbdf9){logger[_0x9f26('0x13')](_0x9f26('0x19'),_0x2dbdf9[_0x9f26('0x16')],_0x2b3d30);_0xa2a523(_0x81d0cc[_0x9f26('0x13')](0x1f4,_0x2dbdf9[_0x9f26('0x16')]));});});};exports[_0x9f26('0x25')]=function(_0x282344){var _0x720453=this;return new Promise(function(_0x2aab54,_0x42b778){return db[_0x9f26('0x1a')]['find']({'raw':_0x282344[_0x9f26('0x1c')]?_0x282344[_0x9f26('0x1c')][_0x9f26('0x1d')]===undefined?!![]:![]:!![],'where':_0x282344[_0x9f26('0x1c')]?_0x282344[_0x9f26('0x1c')][_0x9f26('0x1e')]||null:null,'attributes':_0x282344['options']?_0x282344['options']['attributes']||null:null,'include':_0x282344[_0x9f26('0x1c')]?_0x282344[_0x9f26('0x1c')]['include']?_[_0x9f26('0x22')](_0x282344[_0x9f26('0x1c')][_0x9f26('0x21')],function(_0x13ea36){return{'model':db[_0x13ea36[_0x9f26('0x23')]],'as':_0x13ea36['as'],'attributes':_0x13ea36[_0x9f26('0x1f')],'include':_0x13ea36['include']?_[_0x9f26('0x22')](_0x13ea36[_0x9f26('0x21')],function(_0x4bd7b0){return{'model':db[_0x4bd7b0[_0x9f26('0x23')]],'as':_0x4bd7b0['as'],'attributes':_0x4bd7b0['attributes'],'include':_0x4bd7b0[_0x9f26('0x21')]?_[_0x9f26('0x22')](_0x4bd7b0[_0x9f26('0x21')],function(_0x463f3e){return{'model':db[_0x463f3e['model']],'as':_0x463f3e['as'],'attributes':_0x463f3e[_0x9f26('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9f26('0xf')](function(_0x299012){logger['info'](_0x9f26('0x25'),_0x282344);logger[_0x9f26('0x11')](_0x9f26('0x25'),_0x282344,JSON[_0x9f26('0x12')](_0x299012));_0x2aab54(_0x299012);})[_0x9f26('0x24')](function(_0x2994b5){logger['error'](_0x9f26('0x25'),_0x2994b5['message'],_0x282344);_0x42b778(_0x720453[_0x9f26('0x13')](0x1f4,_0x2994b5[_0x9f26('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 151bc17..da38eee 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 _0x5c12=['removeListener','chatQueue:','save','remove','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5c12,0x188));var _0x25c1=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x5c12[_0x221b8c];return _0x3fab9f;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x25c1('0x0'),_0x25c1('0x1'),'update'];function createListener(_0x44bc2e,_0x1991e5){return function(_0x4042fe){_0x1991e5[_0x25c1('0x2')](_0x44bc2e,_0x4042fe);};}function removeListener(_0x2c5df0,_0x21ec20){return function(){ChatQueueEvents[_0x25c1('0x3')](_0x2c5df0,_0x21ec20);};}exports['register']=function(_0x204287){for(var _0x42ac16=0x0,_0x382922=events['length'];_0x42ac16<_0x382922;_0x42ac16++){var _0x5c69b1=events[_0x42ac16];var _0x24981c=createListener(_0x25c1('0x4')+_0x5c69b1,_0x204287);ChatQueueEvents['on'](_0x5c69b1,_0x24981c);}}; \ No newline at end of file +var _0xf3cd=['remove','update','emit','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2595a6,_0x48fc45){_0x2595a6=_0x2595a6-0x0;var _0x460197=_0xf3cd[_0x2595a6];return _0x460197;};'use strict';var ChatQueueEvents=require(_0xdf3c('0x0'));var events=[_0xdf3c('0x1'),_0xdf3c('0x2'),_0xdf3c('0x3')];function createListener(_0x1839ec,_0x433a7f){return function(_0x54db05){_0x433a7f[_0xdf3c('0x4')](_0x1839ec,_0x54db05);};}function removeListener(_0x71b446,_0x9f71cb){return function(){ChatQueueEvents['removeListener'](_0x71b446,_0x9f71cb);};}exports[_0xdf3c('0x5')]=function(_0x17d42a){for(var _0x1313d5=0x0,_0x1f0601=events[_0xdf3c('0x6')];_0x1313d5<_0x1f0601;_0x1313d5++){var _0x28edae=events[_0x1313d5];var _0x52c073=createListener(_0xdf3c('0x7')+_0x28edae,_0x17d42a);ChatQueueEvents['on'](_0x28edae,_0x52c073);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 477ddf6..adba806 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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x30fbf5,_0x487ca){var _0x4babde=function(_0x11fda2){while(--_0x11fda2){_0x30fbf5['push'](_0x30fbf5['shift']());}};_0x4babde(++_0x487ca);}(_0x814b,0x1a2));var _0xb814=function(_0x5cf90e,_0x5df405){_0x5cf90e=_0x5cf90e-0x0;var _0xae958d=_0x814b[_0x5cf90e];return _0xae958d;};'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')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=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(_0x580934,_0x1beb77){var _0x576ce5=function(_0x14a581){while(--_0x14a581){_0x580934['push'](_0x580934['shift']());}};_0x576ce5(++_0x1beb77);}(_0x55ca,0x126));var _0xa55c=function(_0x5c365f,_0x3b40ed){_0x5c365f=_0x5c365f-0x0;var _0x295e1b=_0x55ca[_0x5c365f];return _0x295e1b;};'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 e038191..9676f9e 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 _0x5c91=['sequelize','exports','STRING','DATE','moment'];(function(_0x1fc773,_0x299be7){var _0x2965cf=function(_0x33914d){while(--_0x33914d){_0x1fc773['push'](_0x1fc773['shift']());}};_0x2965cf(++_0x299be7);}(_0x5c91,0x1e9));var _0x15c9=function(_0xc706fd,_0x33ce12){_0xc706fd=_0xc706fd-0x0;var _0x8834e0=_0x5c91[_0xc706fd];return _0x8834e0;};'use strict';var moment=require(_0x15c9('0x0'));var Sequelize=require(_0x15c9('0x1'));module[_0x15c9('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x15c9('0x3')]},'joinAt':{'type':Sequelize[_0x15c9('0x4')]},'leaveAt':{'type':Sequelize[_0x15c9('0x4')]},'acceptAt':{'type':Sequelize[_0x15c9('0x4')]},'exitAt':{'type':Sequelize[_0x15c9('0x4')]},'reason':{'type':Sequelize[_0x15c9('0x3')]}}; \ No newline at end of file +var _0xd97f=['exports','STRING','DATE','moment','sequelize'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xd97f,0x15c));var _0xfd97=function(_0x4a3854,_0xd33209){_0x4a3854=_0x4a3854-0x0;var _0xbb82a3=_0xd97f[_0x4a3854];return _0xbb82a3;};'use strict';var moment=require(_0xfd97('0x0'));var Sequelize=require(_0xfd97('0x1'));module[_0xfd97('0x2')]={'uniqueid':{'type':Sequelize[_0xfd97('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xfd97('0x3')]},'joinAt':{'type':Sequelize[_0xfd97('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfd97('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 0876b54..3aa3c55 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 _0xbedb=['hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','ChatQueueReport','rawAttributes','fieldName','type','keys','query','model','intersection','fields','attributes','length'];(function(_0x8ef0c5,_0x1a3644){var _0x5d8249=function(_0x438ea7){while(--_0x438ea7){_0x8ef0c5['push'](_0x8ef0c5['shift']());}};_0x5d8249(++_0x1a3644);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbbed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbbed('0x1'));var jsonpatch=require(_0xbbed('0x2'));var rp=require(_0xbbed('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbbed('0x4'));var util=require(_0xbbed('0x5'));var path=require(_0xbbed('0x6'));var sox=require(_0xbbed('0x7'));var csv=require(_0xbbed('0x8'));var ejs=require(_0xbbed('0x9'));var fs=require('fs');var fs_extra=require(_0xbbed('0xa'));var _=require(_0xbbed('0xb'));var squel=require(_0xbbed('0xc'));var crypto=require(_0xbbed('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbbed('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbbed('0xf'));var Redis=require(_0xbbed('0x10'));var authService=require(_0xbbed('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbbed('0x12'));var logger=require(_0xbbed('0x13'))(_0xbbed('0x14'));var utils=require(_0xbbed('0x15'));var config=require(_0xbbed('0x16'));var licenseUtil=require(_0xbbed('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4324b5,_0x4ed197){_0x4ed197=_0x4ed197||0xcc;return function(_0x13e24e){if(_0x13e24e){return _0x4324b5[_0xbbed('0x18')](_0x4ed197);}return _0x4324b5[_0xbbed('0x19')](_0x4ed197)[_0xbbed('0x1a')]();};}function respondWithResult(_0xebc428,_0x194cea){_0x194cea=_0x194cea||0xc8;return function(_0x161bef){if(_0x161bef){return _0xebc428[_0xbbed('0x19')](_0x194cea)[_0xbbed('0x1b')](_0x161bef);}};}function respondWithFilteredResult(_0x286048,_0x5eb641){return function(_0x359469){if(_0x359469){var _0x5dfb44=typeof _0x5eb641[_0xbbed('0x1c')]===_0xbbed('0x1d')&&typeof _0x5eb641[_0xbbed('0x1e')]===_0xbbed('0x1d');var _0xe9dc82=_0x359469['count'];var _0x19e9ce=_0x5dfb44?0x0:_0x5eb641[_0xbbed('0x1c')];var _0x44fd74=_0x5dfb44?_0x359469[_0xbbed('0x1f')]:_0x5eb641[_0xbbed('0x1c')]+_0x5eb641[_0xbbed('0x1e')];var _0x31eea9;if(_0x44fd74>=_0xe9dc82){_0x44fd74=_0xe9dc82;_0x31eea9=0xc8;}else{_0x31eea9=0xce;}_0x286048[_0xbbed('0x19')](_0x31eea9);return _0x286048[_0xbbed('0x20')](_0xbbed('0x21'),_0x19e9ce+'-'+_0x44fd74+'/'+_0xe9dc82)[_0xbbed('0x1b')](_0x359469);}return null;};}function patchUpdates(_0xf166a4){return function(_0x8031d3){try{jsonpatch['apply'](_0x8031d3,_0xf166a4,!![]);}catch(_0x2b4ad0){return BPromise[_0xbbed('0x22')](_0x2b4ad0);}return _0x8031d3[_0xbbed('0x23')]();};}function saveUpdates(_0x493773,_0x40ce77){return function(_0xcc9f37){if(_0xcc9f37){return _0xcc9f37[_0xbbed('0x24')](_0x493773)[_0xbbed('0x25')](function(_0x4ebc1e){return _0x4ebc1e;});}return null;};}function removeEntity(_0x13c422,_0x479c81){return function(_0x163893){if(_0x163893){return _0x163893[_0xbbed('0x26')]()['then'](function(){_0x13c422[_0xbbed('0x19')](0xcc)[_0xbbed('0x1a')]();});}};}function handleEntityNotFound(_0x11ebcf,_0xe1993e){return function(_0x3a77c6){if(!_0x3a77c6){_0x11ebcf[_0xbbed('0x18')](0x194);}return _0x3a77c6;};}function handleError(_0x4fba6e,_0x1231ad){_0x1231ad=_0x1231ad||0x1f4;return function(_0x5dd187){logger[_0xbbed('0x27')](_0x5dd187['stack']);if(_0x5dd187[_0xbbed('0x28')]){delete _0x5dd187[_0xbbed('0x28')];}_0x4fba6e[_0xbbed('0x19')](_0x1231ad)[_0xbbed('0x29')](_0x5dd187);};}exports['index']=function(_0x1339b9,_0x45aff2){var _0x381cb8={},_0x446c21={},_0x565a82={'count':0x0,'rows':[]};var _0xb7fb6c=_['map'](db[_0xbbed('0x2a')][_0xbbed('0x2b')],function(_0x4e0137){return{'name':_0x4e0137[_0xbbed('0x2c')],'type':_0x4e0137[_0xbbed('0x2d')]['key']};});_0x446c21['model']=_['map'](_0xb7fb6c,'name');_0x446c21['query']=_[_0xbbed('0x2e')](_0x1339b9[_0xbbed('0x2f')]);_0x446c21['filters']=_['intersection'](_0x446c21[_0xbbed('0x30')],_0x446c21[_0xbbed('0x2f')]);_0x381cb8['attributes']=_[_0xbbed('0x31')](_0x446c21['model'],qs[_0xbbed('0x32')](_0x1339b9[_0xbbed('0x2f')][_0xbbed('0x32')]));_0x381cb8['attributes']=_0x381cb8[_0xbbed('0x33')][_0xbbed('0x34')]?_0x381cb8[_0xbbed('0x33')]:_0x446c21[_0xbbed('0x30')];if(!_0x1339b9[_0xbbed('0x2f')][_0xbbed('0x35')]('nolimit')){_0x381cb8[_0xbbed('0x1e')]=qs['limit'](_0x1339b9['query'][_0xbbed('0x1e')]);_0x381cb8['offset']=qs[_0xbbed('0x1c')](_0x1339b9[_0xbbed('0x2f')][_0xbbed('0x1c')]);}_0x381cb8[_0xbbed('0x36')]=qs['sort'](_0x1339b9[_0xbbed('0x2f')][_0xbbed('0x37')]);_0x381cb8['where']=qs['filters'](_['pick'](_0x1339b9[_0xbbed('0x2f')],_0x446c21[_0xbbed('0x38')]),_0xb7fb6c);if(_0x1339b9[_0xbbed('0x2f')][_0xbbed('0x39')]){_0x381cb8[_0xbbed('0x3a')]=_[_0xbbed('0x3b')](_0x381cb8[_0xbbed('0x3a')],{'$or':_['map'](_0xb7fb6c,function(_0x2e62e8){if(_0x2e62e8[_0xbbed('0x2d')]!==_0xbbed('0x3c')){var _0xc50bb2={};_0xc50bb2[_0x2e62e8[_0xbbed('0x28')]]={'$like':'%'+_0x1339b9['query'][_0xbbed('0x39')]+'%'};return _0xc50bb2;}})});}_0x381cb8=_[_0xbbed('0x3b')]({},_0x381cb8,_0x1339b9['options']);var _0x1278d1={'where':_0x381cb8[_0xbbed('0x3a')]};return db[_0xbbed('0x2a')][_0xbbed('0x1f')](_0x1278d1)[_0xbbed('0x25')](function(_0x45f514){_0x565a82['count']=_0x45f514;if(_0x1339b9['query'][_0xbbed('0x3d')]){_0x381cb8['include']=[{'all':!![]}];}return db[_0xbbed('0x2a')]['findAll'](_0x381cb8);})[_0xbbed('0x25')](function(_0x2d9b79){_0x565a82[_0xbbed('0x3e')]=_0x2d9b79;return _0x565a82;})[_0xbbed('0x25')](respondWithFilteredResult(_0x45aff2,_0x381cb8))[_0xbbed('0x3f')](handleError(_0x45aff2,null));};exports[_0xbbed('0x40')]=function(_0x540903,_0x2caabb){var _0x515bd3={'raw':!![],'where':{'id':_0x540903[_0xbbed('0x41')]['id']}},_0x401344={};_0x401344[_0xbbed('0x30')]=_['keys'](db[_0xbbed('0x2a')]['rawAttributes']);_0x401344['query']=_[_0xbbed('0x2e')](_0x540903['query']);_0x401344['filters']=_[_0xbbed('0x31')](_0x401344[_0xbbed('0x30')],_0x401344[_0xbbed('0x2f')]);_0x515bd3['attributes']=_[_0xbbed('0x31')](_0x401344[_0xbbed('0x30')],qs['fields'](_0x540903[_0xbbed('0x2f')][_0xbbed('0x32')]));_0x515bd3[_0xbbed('0x33')]=_0x515bd3[_0xbbed('0x33')][_0xbbed('0x34')]?_0x515bd3[_0xbbed('0x33')]:_0x401344[_0xbbed('0x30')];if(_0x540903['query'][_0xbbed('0x3d')]){_0x515bd3[_0xbbed('0x42')]=[{'all':!![]}];}_0x515bd3=_[_0xbbed('0x3b')]({},_0x515bd3,_0x540903[_0xbbed('0x43')]);return db[_0xbbed('0x2a')][_0xbbed('0x44')](_0x515bd3)['then'](handleEntityNotFound(_0x2caabb,null))[_0xbbed('0x25')](respondWithResult(_0x2caabb,null))['catch'](handleError(_0x2caabb,null));};exports['create']=function(_0x3d5eeb,_0x42a655){return db['ChatQueueReport'][_0xbbed('0x45')](_0x3d5eeb[_0xbbed('0x46')],{})[_0xbbed('0x25')](respondWithResult(_0x42a655,0xc9))['catch'](handleError(_0x42a655,null));};exports[_0xbbed('0x24')]=function(_0x1f2e0b,_0x50168e){if(_0x1f2e0b[_0xbbed('0x46')]['id']){delete _0x1f2e0b[_0xbbed('0x46')]['id'];}return db[_0xbbed('0x2a')][_0xbbed('0x44')]({'where':{'id':_0x1f2e0b[_0xbbed('0x41')]['id']}})[_0xbbed('0x25')](handleEntityNotFound(_0x50168e,null))[_0xbbed('0x25')](saveUpdates(_0x1f2e0b[_0xbbed('0x46')],null))[_0xbbed('0x25')](respondWithResult(_0x50168e,null))[_0xbbed('0x3f')](handleError(_0x50168e,null));};exports[_0xbbed('0x26')]=function(_0x1bb0d6,_0x63d030){return db[_0xbbed('0x2a')][_0xbbed('0x44')]({'where':{'id':_0x1bb0d6[_0xbbed('0x41')]['id']}})[_0xbbed('0x25')](handleEntityNotFound(_0x63d030,null))[_0xbbed('0x25')](removeEntity(_0x63d030,null))[_0xbbed('0x3f')](handleError(_0x63d030,null));};exports['describe']=function(_0x256188,_0x5aff2e){return db['ChatQueueReport']['describe']()[_0xbbed('0x25')](respondWithResult(_0x5aff2e,null))['catch'](handleError(_0x5aff2e,null));}; \ No newline at end of file +var _0x2178=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x2178,0x1b0));var _0x8217=function(_0x1b00f1,_0x15ffa8){_0x1b00f1=_0x1b00f1-0x0;var _0x5c3dad=_0x2178[_0x1b00f1];return _0x5c3dad;};'use strict';var emlformat=require(_0x8217('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8217('0x1'));var jsonpatch=require(_0x8217('0x2'));var rp=require(_0x8217('0x3'));var moment=require('moment');var BPromise=require(_0x8217('0x4'));var Mustache=require(_0x8217('0x5'));var util=require('util');var path=require(_0x8217('0x6'));var sox=require(_0x8217('0x7'));var csv=require(_0x8217('0x8'));var ejs=require(_0x8217('0x9'));var fs=require('fs');var fs_extra=require(_0x8217('0xa'));var _=require(_0x8217('0xb'));var squel=require(_0x8217('0xc'));var crypto=require(_0x8217('0xd'));var jsforce=require(_0x8217('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8217('0xf'));var Papa=require(_0x8217('0x10'));var Redis=require(_0x8217('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8217('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8217('0x13'))(_0x8217('0x14'));var utils=require(_0x8217('0x15'));var config=require(_0x8217('0x16'));var licenseUtil=require(_0x8217('0x17'));var db=require(_0x8217('0x18'))['db'];function respondWithStatusCode(_0x39757e,_0x560fc0){_0x560fc0=_0x560fc0||0xcc;return function(_0x5b12bb){if(_0x5b12bb){return _0x39757e['sendStatus'](_0x560fc0);}return _0x39757e[_0x8217('0x19')](_0x560fc0)[_0x8217('0x1a')]();};}function respondWithResult(_0x2eab6b,_0x441a19){_0x441a19=_0x441a19||0xc8;return function(_0x5081d3){if(_0x5081d3){return _0x2eab6b[_0x8217('0x19')](_0x441a19)[_0x8217('0x1b')](_0x5081d3);}};}function respondWithFilteredResult(_0x315fdb,_0x47a1ff){return function(_0x15dbf6){if(_0x15dbf6){var _0x3c0247=typeof _0x47a1ff[_0x8217('0x1c')]===_0x8217('0x1d')&&typeof _0x47a1ff[_0x8217('0x1e')]===_0x8217('0x1d');var _0x3ccef1=_0x15dbf6['count'];var _0x407924=_0x3c0247?0x0:_0x47a1ff[_0x8217('0x1c')];var _0x5a46c2=_0x3c0247?_0x15dbf6[_0x8217('0x1f')]:_0x47a1ff[_0x8217('0x1c')]+_0x47a1ff['limit'];var _0x591516;if(_0x5a46c2>=_0x3ccef1){_0x5a46c2=_0x3ccef1;_0x591516=0xc8;}else{_0x591516=0xce;}_0x315fdb['status'](_0x591516);return _0x315fdb[_0x8217('0x20')](_0x8217('0x21'),_0x407924+'-'+_0x5a46c2+'/'+_0x3ccef1)[_0x8217('0x1b')](_0x15dbf6);}return null;};}function patchUpdates(_0xe573c6){return function(_0x585271){try{jsonpatch[_0x8217('0x22')](_0x585271,_0xe573c6,!![]);}catch(_0x29f4d7){return BPromise[_0x8217('0x23')](_0x29f4d7);}return _0x585271[_0x8217('0x24')]();};}function saveUpdates(_0x3215f8,_0x2931d5){return function(_0x564edc){if(_0x564edc){return _0x564edc[_0x8217('0x25')](_0x3215f8)[_0x8217('0x26')](function(_0x4ed481){return _0x4ed481;});}return null;};}function removeEntity(_0x3101bd,_0x2dead6){return function(_0x2c2f00){if(_0x2c2f00){return _0x2c2f00[_0x8217('0x27')]()[_0x8217('0x26')](function(){_0x3101bd[_0x8217('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5087fb,_0x3329d4){return function(_0xbb940e){if(!_0xbb940e){_0x5087fb[_0x8217('0x28')](0x194);}return _0xbb940e;};}function handleError(_0x2660a5,_0x55c66b){_0x55c66b=_0x55c66b||0x1f4;return function(_0x55a324){logger[_0x8217('0x29')](_0x55a324[_0x8217('0x2a')]);if(_0x55a324[_0x8217('0x2b')]){delete _0x55a324[_0x8217('0x2b')];}_0x2660a5['status'](_0x55c66b)[_0x8217('0x2c')](_0x55a324);};}exports['index']=function(_0x2ef2f1,_0xbf2b18){var _0x23fcd5={},_0x15ff1d={},_0x53eca2={'count':0x0,'rows':[]};var _0x12834e=_[_0x8217('0x2d')](db[_0x8217('0x2e')][_0x8217('0x2f')],function(_0x3c798d){return{'name':_0x3c798d[_0x8217('0x30')],'type':_0x3c798d[_0x8217('0x31')]['key']};});_0x15ff1d['model']=_[_0x8217('0x2d')](_0x12834e,_0x8217('0x2b'));_0x15ff1d[_0x8217('0x32')]=_['keys'](_0x2ef2f1[_0x8217('0x32')]);_0x15ff1d[_0x8217('0x33')]=_[_0x8217('0x34')](_0x15ff1d[_0x8217('0x35')],_0x15ff1d[_0x8217('0x32')]);_0x23fcd5[_0x8217('0x36')]=_[_0x8217('0x34')](_0x15ff1d[_0x8217('0x35')],qs[_0x8217('0x37')](_0x2ef2f1[_0x8217('0x32')][_0x8217('0x37')]));_0x23fcd5['attributes']=_0x23fcd5[_0x8217('0x36')][_0x8217('0x38')]?_0x23fcd5[_0x8217('0x36')]:_0x15ff1d[_0x8217('0x35')];if(!_0x2ef2f1[_0x8217('0x32')][_0x8217('0x39')]('nolimit')){_0x23fcd5[_0x8217('0x1e')]=qs[_0x8217('0x1e')](_0x2ef2f1[_0x8217('0x32')][_0x8217('0x1e')]);_0x23fcd5[_0x8217('0x1c')]=qs[_0x8217('0x1c')](_0x2ef2f1[_0x8217('0x32')][_0x8217('0x1c')]);}_0x23fcd5[_0x8217('0x3a')]=qs[_0x8217('0x3b')](_0x2ef2f1[_0x8217('0x32')][_0x8217('0x3b')]);_0x23fcd5['where']=qs[_0x8217('0x33')](_[_0x8217('0x3c')](_0x2ef2f1[_0x8217('0x32')],_0x15ff1d[_0x8217('0x33')]),_0x12834e);if(_0x2ef2f1[_0x8217('0x32')][_0x8217('0x3d')]){_0x23fcd5[_0x8217('0x3e')]=_[_0x8217('0x3f')](_0x23fcd5[_0x8217('0x3e')],{'$or':_['map'](_0x12834e,function(_0x59ed1c){if(_0x59ed1c['type']!==_0x8217('0x40')){var _0x484048={};_0x484048[_0x59ed1c['name']]={'$like':'%'+_0x2ef2f1['query'][_0x8217('0x3d')]+'%'};return _0x484048;}})});}_0x23fcd5=_[_0x8217('0x3f')]({},_0x23fcd5,_0x2ef2f1[_0x8217('0x41')]);var _0x111ed0={'where':_0x23fcd5['where']};return db[_0x8217('0x2e')][_0x8217('0x1f')](_0x111ed0)['then'](function(_0x94814b){_0x53eca2['count']=_0x94814b;if(_0x2ef2f1[_0x8217('0x32')][_0x8217('0x42')]){_0x23fcd5[_0x8217('0x43')]=[{'all':!![]}];}return db[_0x8217('0x2e')][_0x8217('0x44')](_0x23fcd5);})['then'](function(_0x28150f){_0x53eca2['rows']=_0x28150f;return _0x53eca2;})[_0x8217('0x26')](respondWithFilteredResult(_0xbf2b18,_0x23fcd5))[_0x8217('0x45')](handleError(_0xbf2b18,null));};exports[_0x8217('0x46')]=function(_0x184fba,_0x3d581b){var _0x270a96={'raw':!![],'where':{'id':_0x184fba[_0x8217('0x47')]['id']}},_0x2f383b={};_0x2f383b[_0x8217('0x35')]=_[_0x8217('0x48')](db[_0x8217('0x2e')][_0x8217('0x2f')]);_0x2f383b[_0x8217('0x32')]=_[_0x8217('0x48')](_0x184fba[_0x8217('0x32')]);_0x2f383b[_0x8217('0x33')]=_['intersection'](_0x2f383b[_0x8217('0x35')],_0x2f383b[_0x8217('0x32')]);_0x270a96['attributes']=_[_0x8217('0x34')](_0x2f383b[_0x8217('0x35')],qs['fields'](_0x184fba['query'][_0x8217('0x37')]));_0x270a96['attributes']=_0x270a96[_0x8217('0x36')][_0x8217('0x38')]?_0x270a96[_0x8217('0x36')]:_0x2f383b['model'];if(_0x184fba['query']['includeAll']){_0x270a96[_0x8217('0x43')]=[{'all':!![]}];}_0x270a96=_[_0x8217('0x3f')]({},_0x270a96,_0x184fba[_0x8217('0x41')]);return db[_0x8217('0x2e')][_0x8217('0x49')](_0x270a96)[_0x8217('0x26')](handleEntityNotFound(_0x3d581b,null))[_0x8217('0x26')](respondWithResult(_0x3d581b,null))[_0x8217('0x45')](handleError(_0x3d581b,null));};exports['create']=function(_0x4ba392,_0x245dfa){return db[_0x8217('0x2e')][_0x8217('0x4a')](_0x4ba392[_0x8217('0x4b')],{})[_0x8217('0x26')](respondWithResult(_0x245dfa,0xc9))[_0x8217('0x45')](handleError(_0x245dfa,null));};exports['update']=function(_0x21424d,_0x3ae463){if(_0x21424d[_0x8217('0x4b')]['id']){delete _0x21424d['body']['id'];}return db[_0x8217('0x2e')]['find']({'where':{'id':_0x21424d[_0x8217('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ae463,null))[_0x8217('0x26')](saveUpdates(_0x21424d['body'],null))[_0x8217('0x26')](respondWithResult(_0x3ae463,null))[_0x8217('0x45')](handleError(_0x3ae463,null));};exports[_0x8217('0x27')]=function(_0x7291b1,_0x5df18f){return db[_0x8217('0x2e')][_0x8217('0x49')]({'where':{'id':_0x7291b1[_0x8217('0x47')]['id']}})[_0x8217('0x26')](handleEntityNotFound(_0x5df18f,null))[_0x8217('0x26')](removeEntity(_0x5df18f,null))[_0x8217('0x45')](handleError(_0x5df18f,null));};exports[_0x8217('0x4c')]=function(_0x261f08,_0x4ae06e){return db[_0x8217('0x2e')][_0x8217('0x4c')]()[_0x8217('0x26')](respondWithResult(_0x4ae06e,null))[_0x8217('0x45')](handleError(_0x4ae06e,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 420714f..8399118 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x3d73ba,_0x356e23){var _0x47e406=function(_0x90df31){while(--_0x90df31){_0x3d73ba['push'](_0x3d73ba['shift']());}};_0x47e406(++_0x356e23);}(_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'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b86eb,_0xce771b){var _0x5fc55a=function(_0x52a96c){while(--_0x52a96c){_0x2b86eb['push'](_0x2b86eb['shift']());}};_0x5fc55a(++_0xce771b);}(_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 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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 272b465..ac40c0e 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 _0xe3f5=['limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','ChatQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','CreateChatQueueReport','ChatQueueReport','create','options','raw','catch','UpdateChatQueueReport','update','where','attributes'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xe3f5,0x118));var _0x5e3f=function(_0x31b75a,_0x383d5a){_0x31b75a=_0x31b75a-0x0;var _0x3328d2=_0xe3f5[_0x31b75a];return _0x3328d2;};'use strict';var _=require(_0x5e3f('0x0'));var util=require('util');var moment=require(_0x5e3f('0x1'));var BPromise=require(_0x5e3f('0x2'));var rs=require(_0x5e3f('0x3'));var fs=require('fs');var Redis=require(_0x5e3f('0x4'));var db=require(_0x5e3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e3f('0x6'))('rpc');var config=require(_0x5e3f('0x7'));var jayson=require(_0x5e3f('0x8'));var client=jayson['client'][_0x5e3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55d06f,_0x259d81,_0x16b6bb){return new BPromise(function(_0x8fbf08,_0x25e080){return client['request'](_0x55d06f,_0x16b6bb)[_0x5e3f('0xa')](function(_0x1b4bfe){logger['info'](_0x5e3f('0xb'),_0x259d81,'request\x20sent');logger[_0x5e3f('0xc')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x259d81,'request\x20sent',JSON[_0x5e3f('0xd')](_0x1b4bfe));if(_0x1b4bfe[_0x5e3f('0xe')]){if(_0x1b4bfe[_0x5e3f('0xe')][_0x5e3f('0xf')]===0x1f4){logger[_0x5e3f('0xe')](_0x5e3f('0xb'),_0x259d81,_0x1b4bfe[_0x5e3f('0xe')][_0x5e3f('0x10')]);return _0x25e080(_0x1b4bfe['error'][_0x5e3f('0x10')]);}logger[_0x5e3f('0xe')](_0x5e3f('0xb'),_0x259d81,_0x1b4bfe[_0x5e3f('0xe')][_0x5e3f('0x10')]);return _0x8fbf08(_0x1b4bfe[_0x5e3f('0xe')][_0x5e3f('0x10')]);}else{logger[_0x5e3f('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x259d81,_0x5e3f('0x12'));_0x8fbf08(_0x1b4bfe[_0x5e3f('0x13')][_0x5e3f('0x10')]);}})['catch'](function(_0x14f830){logger[_0x5e3f('0xe')](_0x5e3f('0xb'),_0x259d81,_0x14f830);_0x25e080(_0x14f830);});});}exports[_0x5e3f('0x14')]=function(_0x5b84b9){var _0x244c5a=this;return new Promise(function(_0xda0686,_0x1b7fb9){return db[_0x5e3f('0x15')][_0x5e3f('0x16')](_0x5b84b9['body'],{'raw':_0x5b84b9['options']?_0x5b84b9[_0x5e3f('0x17')][_0x5e3f('0x18')]===undefined?!![]:![]:!![]})[_0x5e3f('0xa')](function(_0x3fa250){logger[_0x5e3f('0x11')](_0x5e3f('0x14'),_0x5b84b9);logger[_0x5e3f('0xc')](_0x5e3f('0x14'),_0x5b84b9,JSON['stringify'](_0x3fa250));_0xda0686(_0x3fa250);})[_0x5e3f('0x19')](function(_0x3a95d7){logger[_0x5e3f('0xe')]('CreateChatQueueReport',_0x3a95d7[_0x5e3f('0x10')],_0x5b84b9);_0x1b7fb9(_0x244c5a['error'](0x1f4,_0x3a95d7[_0x5e3f('0x10')]));});});};exports[_0x5e3f('0x1a')]=function(_0x1cbb21){var _0xcd1eda=this;return new Promise(function(_0x8d36c1,_0x2cc5cc){return db[_0x5e3f('0x15')][_0x5e3f('0x1b')](_0x1cbb21['body'],{'raw':_0x1cbb21[_0x5e3f('0x17')]?_0x1cbb21['options'][_0x5e3f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbb21[_0x5e3f('0x17')]?_0x1cbb21[_0x5e3f('0x17')][_0x5e3f('0x1c')]||null:null,'attributes':_0x1cbb21[_0x5e3f('0x17')]?_0x1cbb21[_0x5e3f('0x17')][_0x5e3f('0x1d')]||null:null,'limit':_0x1cbb21['options']?_0x1cbb21[_0x5e3f('0x17')][_0x5e3f('0x1e')]||null:null})[_0x5e3f('0xa')](function(_0x371425){logger['info'](_0x5e3f('0x1a'),_0x1cbb21);logger[_0x5e3f('0xc')](_0x5e3f('0x1a'),_0x1cbb21,JSON[_0x5e3f('0xd')](_0x371425));_0x8d36c1(_0x371425);})[_0x5e3f('0x19')](function(_0x2b73f5){logger[_0x5e3f('0xe')](_0x5e3f('0x1a'),_0x2b73f5[_0x5e3f('0x10')],_0x1cbb21);_0x2cc5cc(_0xcd1eda[_0x5e3f('0xe')](0x1f4,_0x2b73f5[_0x5e3f('0x10')]));});});}; \ No newline at end of file +var _0x91f4=['where','limit','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','info','result','catch','ChatQueueReport','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','update'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x91f4,0x179));var _0x491f=function(_0x127452,_0x3efd0d){_0x127452=_0x127452-0x0;var _0x222eac=_0x91f4[_0x127452];return _0x222eac;};'use strict';var _=require('lodash');var util=require(_0x491f('0x0'));var moment=require(_0x491f('0x1'));var BPromise=require(_0x491f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x491f('0x3'));var db=require(_0x491f('0x4'))['db'];var utils=require(_0x491f('0x5'));var logger=require(_0x491f('0x6'))(_0x491f('0x7'));var config=require(_0x491f('0x8'));var jayson=require(_0x491f('0x9'));var client=jayson[_0x491f('0xa')][_0x491f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e5203,_0x3cac48,_0x259d0f){return new BPromise(function(_0x327d6f,_0x45c4d7){return client[_0x491f('0xc')](_0x1e5203,_0x259d0f)['then'](function(_0x8afa2b){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x3cac48,_0x491f('0xd'));logger[_0x491f('0xe')](_0x491f('0xf'),_0x3cac48,_0x491f('0xd'),JSON[_0x491f('0x10')](_0x8afa2b));if(_0x8afa2b[_0x491f('0x11')]){if(_0x8afa2b[_0x491f('0x11')][_0x491f('0x12')]===0x1f4){logger[_0x491f('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x3cac48,_0x8afa2b['error'][_0x491f('0x13')]);return _0x45c4d7(_0x8afa2b[_0x491f('0x11')][_0x491f('0x13')]);}logger[_0x491f('0x11')](_0x491f('0x14'),_0x3cac48,_0x8afa2b[_0x491f('0x11')]['message']);return _0x327d6f(_0x8afa2b[_0x491f('0x11')][_0x491f('0x13')]);}else{logger[_0x491f('0x15')](_0x491f('0x14'),_0x3cac48,'request\x20sent');_0x327d6f(_0x8afa2b[_0x491f('0x16')][_0x491f('0x13')]);}})[_0x491f('0x17')](function(_0x599b6f){logger[_0x491f('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x3cac48,_0x599b6f);_0x45c4d7(_0x599b6f);});});}exports['CreateChatQueueReport']=function(_0x1a931b){var _0x16f766=this;return new Promise(function(_0xef6689,_0x36f82f){return db[_0x491f('0x18')]['create'](_0x1a931b[_0x491f('0x19')],{'raw':_0x1a931b[_0x491f('0x1a')]?_0x1a931b[_0x491f('0x1a')][_0x491f('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x138645){logger[_0x491f('0x15')](_0x491f('0x1c'),_0x1a931b);logger[_0x491f('0xe')]('CreateChatQueueReport',_0x1a931b,JSON['stringify'](_0x138645));_0xef6689(_0x138645);})[_0x491f('0x17')](function(_0x23a237){logger[_0x491f('0x11')](_0x491f('0x1c'),_0x23a237[_0x491f('0x13')],_0x1a931b);_0x36f82f(_0x16f766[_0x491f('0x11')](0x1f4,_0x23a237[_0x491f('0x13')]));});});};exports[_0x491f('0x1d')]=function(_0x4170b5){var _0x53d88a=this;return new Promise(function(_0xb2dc71,_0x204250){return db[_0x491f('0x18')][_0x491f('0x1e')](_0x4170b5[_0x491f('0x19')],{'raw':_0x4170b5['options']?_0x4170b5[_0x491f('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4170b5['options']?_0x4170b5[_0x491f('0x1a')][_0x491f('0x1f')]||null:null,'attributes':_0x4170b5[_0x491f('0x1a')]?_0x4170b5['options']['attributes']||null:null,'limit':_0x4170b5[_0x491f('0x1a')]?_0x4170b5[_0x491f('0x1a')][_0x491f('0x20')]||null:null})[_0x491f('0x21')](function(_0x48c021){logger['info'](_0x491f('0x1d'),_0x4170b5);logger[_0x491f('0xe')](_0x491f('0x1d'),_0x4170b5,JSON['stringify'](_0x48c021));_0xb2dc71(_0x48c021);})[_0x491f('0x17')](function(_0x831623){logger[_0x491f('0x11')](_0x491f('0x1d'),_0x831623[_0x491f('0x13')],_0x4170b5);_0x204250(_0x53d88a[_0x491f('0x11')](0x1f4,_0x831623[_0x491f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 6682a48..05f18f4 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 _0x6136=['/describe','describe','show','create','put','update','delete','/:id','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x35d8ad,_0x24b5f0){var _0x3fb9e0=function(_0x5bd58f){while(--_0x5bd58f){_0x35d8ad['push'](_0x35d8ad['shift']());}};_0x3fb9e0(++_0x24b5f0);}(_0x6136,0x105));var _0x6613=function(_0x543898,_0x1e504b){_0x543898=_0x543898-0x0;var _0x4ac0ae=_0x6136[_0x543898];return _0x4ac0ae;};'use strict';var multer=require(_0x6613('0x0'));var util=require('util');var path=require(_0x6613('0x1'));var timeout=require(_0x6613('0x2'));var express=require(_0x6613('0x3'));var router=express[_0x6613('0x4')]();var fs_extra=require(_0x6613('0x5'));var auth=require(_0x6613('0x6'));var interaction=require(_0x6613('0x7'));var config=require(_0x6613('0x8'));var controller=require(_0x6613('0x9'));router[_0x6613('0xa')]('/',auth[_0x6613('0xb')](),controller['index']);router['get'](_0x6613('0xc'),auth[_0x6613('0xb')](),controller[_0x6613('0xd')]);router[_0x6613('0xa')]('/:id',auth[_0x6613('0xb')](),controller[_0x6613('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6613('0xf')]);router[_0x6613('0x10')]('/:id',auth[_0x6613('0xb')](),controller[_0x6613('0x11')]);router[_0x6613('0x12')](_0x6613('0x13'),auth['isAuthenticated'](),controller[_0x6613('0x14')]);module['exports']=router; \ No newline at end of file +var _0x13d1=['update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x4dde11,_0x173815){var _0xe6eff3=function(_0x643a1d){while(--_0x643a1d){_0x4dde11['push'](_0x4dde11['shift']());}};_0xe6eff3(++_0x173815);}(_0x13d1,0xe9));var _0x113d=function(_0x135847,_0x1f363a){_0x135847=_0x135847-0x0;var _0x5cc530=_0x13d1[_0x135847];return _0x5cc530;};'use strict';var multer=require(_0x113d('0x0'));var util=require(_0x113d('0x1'));var path=require(_0x113d('0x2'));var timeout=require(_0x113d('0x3'));var express=require(_0x113d('0x4'));var router=express[_0x113d('0x5')]();var fs_extra=require(_0x113d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x113d('0x7'));var config=require(_0x113d('0x8'));var controller=require(_0x113d('0x9'));router[_0x113d('0xa')]('/',auth[_0x113d('0xb')](),controller[_0x113d('0xc')]);router['get'](_0x113d('0xd'),auth[_0x113d('0xb')](),controller[_0x113d('0xe')]);router[_0x113d('0xa')](_0x113d('0xf'),auth[_0x113d('0xb')](),controller[_0x113d('0x10')]);router[_0x113d('0x11')]('/',auth[_0x113d('0xb')](),controller['create']);router[_0x113d('0x12')]('/:id',auth[_0x113d('0xb')](),controller[_0x113d('0x13')]);router['delete'](_0x113d('0xf'),auth[_0x113d('0xb')](),controller['destroy']);module[_0x113d('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 1c6ff41..6d501bb 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x557ba5,_0x55735b){var _0x4c7d96=function(_0x4ed4d8){while(--_0x4ed4d8){_0x557ba5['push'](_0x557ba5['shift']());}};_0x4c7d96(++_0x55735b);}(_0x008c,0x188));var _0xc008=function(_0xf3b3e7,_0x1b2afc){_0xf3b3e7=_0xf3b3e7-0x0;var _0x4a22a2=_0x008c[_0xf3b3e7];return _0x4a22a2;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x52727b,_0x26ce25){var _0x3118f8=function(_0xa5bdcc){while(--_0xa5bdcc){_0x52727b['push'](_0x52727b['shift']());}};_0x3118f8(++_0x26ce25);}(_0xe706,0xa3));var _0x6e70=function(_0x809dbd,_0xf5f241){_0x809dbd=_0x809dbd-0x0;var _0x5497bf=_0xe706[_0x809dbd];return _0x5497bf;};'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 6ca7e92..eb505a0 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 _0x8f01=['where','filters','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','keys','includeAll','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','reject','save','update','then','end','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x8f01,0x147));var _0x18f0=function(_0x19f9e6,_0x4f59a6){_0x19f9e6=_0x19f9e6-0x0;var _0x45c862=_0x8f01[_0x19f9e6];return _0x45c862;};'use strict';var emlformat=require(_0x18f0('0x0'));var rimraf=require(_0x18f0('0x1'));var zipdir=require(_0x18f0('0x2'));var jsonpatch=require(_0x18f0('0x3'));var rp=require(_0x18f0('0x4'));var moment=require('moment');var BPromise=require(_0x18f0('0x5'));var Mustache=require(_0x18f0('0x6'));var util=require(_0x18f0('0x7'));var path=require('path');var sox=require(_0x18f0('0x8'));var csv=require(_0x18f0('0x9'));var ejs=require(_0x18f0('0xa'));var fs=require('fs');var fs_extra=require(_0x18f0('0xb'));var _=require(_0x18f0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x18f0('0xd'));var deskjs=require(_0x18f0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x18f0('0xf'));var Papa=require(_0x18f0('0x10'));var Redis=require(_0x18f0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x18f0('0x12'));var hardwareService=require(_0x18f0('0x13'));var logger=require(_0x18f0('0x14'))(_0x18f0('0x15'));var utils=require(_0x18f0('0x16'));var config=require(_0x18f0('0x17'));var licenseUtil=require(_0x18f0('0x18'));var db=require(_0x18f0('0x19'))['db'];function respondWithStatusCode(_0x246213,_0x2f3188){_0x2f3188=_0x2f3188||0xcc;return function(_0x3edee3){if(_0x3edee3){return _0x246213[_0x18f0('0x1a')](_0x2f3188);}return _0x246213[_0x18f0('0x1b')](_0x2f3188)['end']();};}function respondWithResult(_0x4f0f1f,_0x4a976d){_0x4a976d=_0x4a976d||0xc8;return function(_0x1149af){if(_0x1149af){return _0x4f0f1f['status'](_0x4a976d)[_0x18f0('0x1c')](_0x1149af);}};}function respondWithFilteredResult(_0x2a1e84,_0x3ec71e){return function(_0x3c1a6f){if(_0x3c1a6f){var _0x5b81ec=typeof _0x3ec71e['offset']===_0x18f0('0x1d')&&typeof _0x3ec71e[_0x18f0('0x1e')]==='undefined';var _0x36883d=_0x3c1a6f['count'];var _0x2f36f3=_0x5b81ec?0x0:_0x3ec71e[_0x18f0('0x1f')];var _0x2ce895=_0x5b81ec?_0x3c1a6f[_0x18f0('0x20')]:_0x3ec71e[_0x18f0('0x1f')]+_0x3ec71e[_0x18f0('0x1e')];var _0x43ff81;if(_0x2ce895>=_0x36883d){_0x2ce895=_0x36883d;_0x43ff81=0xc8;}else{_0x43ff81=0xce;}_0x2a1e84[_0x18f0('0x1b')](_0x43ff81);return _0x2a1e84['set'](_0x18f0('0x21'),_0x2f36f3+'-'+_0x2ce895+'/'+_0x36883d)[_0x18f0('0x1c')](_0x3c1a6f);}return null;};}function patchUpdates(_0x29dc9c){return function(_0xd92e3f){try{jsonpatch['apply'](_0xd92e3f,_0x29dc9c,!![]);}catch(_0x5e5303){return BPromise[_0x18f0('0x22')](_0x5e5303);}return _0xd92e3f[_0x18f0('0x23')]();};}function saveUpdates(_0x4d4064,_0x128fa0){return function(_0x4cb7ba){if(_0x4cb7ba){return _0x4cb7ba[_0x18f0('0x24')](_0x4d4064)[_0x18f0('0x25')](function(_0x42fbf0){return _0x42fbf0;});}return null;};}function removeEntity(_0x3f5958,_0x55a6db){return function(_0x320226){if(_0x320226){return _0x320226['destroy']()['then'](function(){_0x3f5958[_0x18f0('0x1b')](0xcc)[_0x18f0('0x26')]();});}};}function handleEntityNotFound(_0x302ead,_0x2cfd8f){return function(_0xdc1c04){if(!_0xdc1c04){_0x302ead[_0x18f0('0x1a')](0x194);}return _0xdc1c04;};}function handleError(_0x4b03c6,_0x1d4575){_0x1d4575=_0x1d4575||0x1f4;return function(_0x36cea8){logger['error'](_0x36cea8['stack']);if(_0x36cea8['name']){delete _0x36cea8[_0x18f0('0x27')];}_0x4b03c6['status'](_0x1d4575)[_0x18f0('0x28')](_0x36cea8);};}exports[_0x18f0('0x29')]=function(_0x29c3b5,_0x36b718){var _0x32d879={},_0x5b6cfc={},_0x53bd7e={'count':0x0,'rows':[]};var _0x35e4d2=_['map'](db[_0x18f0('0x2a')][_0x18f0('0x2b')],function(_0x4a46b9){return{'name':_0x4a46b9[_0x18f0('0x2c')],'type':_0x4a46b9[_0x18f0('0x2d')][_0x18f0('0x2e')]};});_0x5b6cfc[_0x18f0('0x2f')]=_[_0x18f0('0x30')](_0x35e4d2,'name');_0x5b6cfc[_0x18f0('0x31')]=_['keys'](_0x29c3b5[_0x18f0('0x31')]);_0x5b6cfc['filters']=_[_0x18f0('0x32')](_0x5b6cfc[_0x18f0('0x2f')],_0x5b6cfc[_0x18f0('0x31')]);_0x32d879[_0x18f0('0x33')]=_['intersection'](_0x5b6cfc[_0x18f0('0x2f')],qs[_0x18f0('0x34')](_0x29c3b5['query'][_0x18f0('0x34')]));_0x32d879[_0x18f0('0x33')]=_0x32d879[_0x18f0('0x33')][_0x18f0('0x35')]?_0x32d879[_0x18f0('0x33')]:_0x5b6cfc[_0x18f0('0x2f')];if(!_0x29c3b5[_0x18f0('0x31')][_0x18f0('0x36')](_0x18f0('0x37'))){_0x32d879[_0x18f0('0x1e')]=qs[_0x18f0('0x1e')](_0x29c3b5[_0x18f0('0x31')][_0x18f0('0x1e')]);_0x32d879[_0x18f0('0x1f')]=qs[_0x18f0('0x1f')](_0x29c3b5[_0x18f0('0x31')][_0x18f0('0x1f')]);}_0x32d879[_0x18f0('0x38')]=qs[_0x18f0('0x39')](_0x29c3b5['query']['sort']);_0x32d879[_0x18f0('0x3a')]=qs[_0x18f0('0x3b')](_[_0x18f0('0x3c')](_0x29c3b5[_0x18f0('0x31')],_0x5b6cfc[_0x18f0('0x3b')]),_0x35e4d2);if(_0x29c3b5[_0x18f0('0x31')][_0x18f0('0x3d')]){_0x32d879['where']=_[_0x18f0('0x3e')](_0x32d879['where'],{'$or':_[_0x18f0('0x30')](_0x35e4d2,function(_0x5ac32e){if(_0x5ac32e[_0x18f0('0x2d')]!==_0x18f0('0x3f')){var _0x333dc6={};_0x333dc6[_0x5ac32e[_0x18f0('0x27')]]={'$like':'%'+_0x29c3b5[_0x18f0('0x31')][_0x18f0('0x3d')]+'%'};return _0x333dc6;}})});}_0x32d879=_[_0x18f0('0x3e')]({},_0x32d879,_0x29c3b5['options']);var _0x4a3942={'where':_0x32d879[_0x18f0('0x3a')]};return db['ChatTransferReport'][_0x18f0('0x20')](_0x4a3942)[_0x18f0('0x25')](function(_0x40d94f){_0x53bd7e[_0x18f0('0x20')]=_0x40d94f;if(_0x29c3b5[_0x18f0('0x31')]['includeAll']){_0x32d879[_0x18f0('0x40')]=[{'all':!![]}];}return db[_0x18f0('0x2a')]['findAll'](_0x32d879);})[_0x18f0('0x25')](function(_0x200278){_0x53bd7e[_0x18f0('0x41')]=_0x200278;return _0x53bd7e;})[_0x18f0('0x25')](respondWithFilteredResult(_0x36b718,_0x32d879))[_0x18f0('0x42')](handleError(_0x36b718,null));};exports[_0x18f0('0x43')]=function(_0x4d915c,_0x24ef97){var _0x298583={'raw':!![],'where':{'id':_0x4d915c[_0x18f0('0x44')]['id']}},_0x14dbff={};_0x14dbff[_0x18f0('0x2f')]=_[_0x18f0('0x45')](db[_0x18f0('0x2a')][_0x18f0('0x2b')]);_0x14dbff['query']=_[_0x18f0('0x45')](_0x4d915c[_0x18f0('0x31')]);_0x14dbff[_0x18f0('0x3b')]=_[_0x18f0('0x32')](_0x14dbff['model'],_0x14dbff['query']);_0x298583[_0x18f0('0x33')]=_['intersection'](_0x14dbff[_0x18f0('0x2f')],qs[_0x18f0('0x34')](_0x4d915c['query']['fields']));_0x298583[_0x18f0('0x33')]=_0x298583[_0x18f0('0x33')][_0x18f0('0x35')]?_0x298583[_0x18f0('0x33')]:_0x14dbff['model'];if(_0x4d915c[_0x18f0('0x31')][_0x18f0('0x46')]){_0x298583[_0x18f0('0x40')]=[{'all':!![]}];}_0x298583=_[_0x18f0('0x3e')]({},_0x298583,_0x4d915c[_0x18f0('0x47')]);return db[_0x18f0('0x2a')][_0x18f0('0x48')](_0x298583)[_0x18f0('0x25')](handleEntityNotFound(_0x24ef97,null))[_0x18f0('0x25')](respondWithResult(_0x24ef97,null))[_0x18f0('0x42')](handleError(_0x24ef97,null));};exports[_0x18f0('0x49')]=function(_0x49cc40,_0x1e92e7){return db[_0x18f0('0x2a')]['create'](_0x49cc40[_0x18f0('0x4a')],{})[_0x18f0('0x25')](respondWithResult(_0x1e92e7,0xc9))['catch'](handleError(_0x1e92e7,null));};exports[_0x18f0('0x24')]=function(_0x18a6f2,_0x17e21a){if(_0x18a6f2['body']['id']){delete _0x18a6f2[_0x18f0('0x4a')]['id'];}return db[_0x18f0('0x2a')][_0x18f0('0x48')]({'where':{'id':_0x18a6f2[_0x18f0('0x44')]['id']}})[_0x18f0('0x25')](handleEntityNotFound(_0x17e21a,null))[_0x18f0('0x25')](saveUpdates(_0x18a6f2[_0x18f0('0x4a')],null))[_0x18f0('0x25')](respondWithResult(_0x17e21a,null))['catch'](handleError(_0x17e21a,null));};exports[_0x18f0('0x4b')]=function(_0x440eb2,_0x1b2e5e){return db['ChatTransferReport'][_0x18f0('0x48')]({'where':{'id':_0x440eb2['params']['id']}})['then'](handleEntityNotFound(_0x1b2e5e,null))[_0x18f0('0x25')](removeEntity(_0x1b2e5e,null))[_0x18f0('0x42')](handleError(_0x1b2e5e,null));};exports[_0x18f0('0x4c')]=function(_0x2dbb33,_0x2af8fd){return db[_0x18f0('0x2a')][_0x18f0('0x4c')]()['then'](respondWithResult(_0x2af8fd,null))[_0x18f0('0x42')](handleError(_0x2af8fd,null));}; \ No newline at end of file +var _0xc769=['sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','stack','name','map','ChatTransferReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','describe','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3780ba,_0xedcf4e){var _0x43d21a=function(_0x396aa0){while(--_0x396aa0){_0x3780ba['push'](_0x3780ba['shift']());}};_0x43d21a(++_0xedcf4e);}(_0xc769,0x1e5));var _0x9c76=function(_0x3dae12,_0x22eadc){_0x3dae12=_0x3dae12-0x0;var _0x5ca9e0=_0xc769[_0x3dae12];return _0x5ca9e0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9c76('0x0'));var rp=require(_0x9c76('0x1'));var moment=require(_0x9c76('0x2'));var BPromise=require(_0x9c76('0x3'));var Mustache=require(_0x9c76('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9c76('0x5'));var csv=require(_0x9c76('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c76('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9c76('0x8'));var deskjs=require(_0x9c76('0x9'));var toCsv=require(_0x9c76('0x6'));var querystring=require(_0x9c76('0xa'));var Papa=require(_0x9c76('0xb'));var Redis=require(_0x9c76('0xc'));var authService=require(_0x9c76('0xd'));var qs=require(_0x9c76('0xe'));var as=require(_0x9c76('0xf'));var hardwareService=require(_0x9c76('0x10'));var logger=require('../../config/logger')(_0x9c76('0x11'));var utils=require(_0x9c76('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9c76('0x13'))['db'];function respondWithStatusCode(_0x510322,_0x581951){_0x581951=_0x581951||0xcc;return function(_0x384111){if(_0x384111){return _0x510322[_0x9c76('0x14')](_0x581951);}return _0x510322[_0x9c76('0x15')](_0x581951)[_0x9c76('0x16')]();};}function respondWithResult(_0x16f6cf,_0x17b9fe){_0x17b9fe=_0x17b9fe||0xc8;return function(_0x150373){if(_0x150373){return _0x16f6cf['status'](_0x17b9fe)['json'](_0x150373);}};}function respondWithFilteredResult(_0x596e51,_0x518058){return function(_0x12b640){if(_0x12b640){var _0x137e52=typeof _0x518058[_0x9c76('0x17')]===_0x9c76('0x18')&&typeof _0x518058[_0x9c76('0x19')]===_0x9c76('0x18');var _0x4e2891=_0x12b640[_0x9c76('0x1a')];var _0x81417b=_0x137e52?0x0:_0x518058[_0x9c76('0x17')];var _0x3caebf=_0x137e52?_0x12b640[_0x9c76('0x1a')]:_0x518058[_0x9c76('0x17')]+_0x518058['limit'];var _0x3b4573;if(_0x3caebf>=_0x4e2891){_0x3caebf=_0x4e2891;_0x3b4573=0xc8;}else{_0x3b4573=0xce;}_0x596e51[_0x9c76('0x15')](_0x3b4573);return _0x596e51[_0x9c76('0x1b')]('Content-Range',_0x81417b+'-'+_0x3caebf+'/'+_0x4e2891)[_0x9c76('0x1c')](_0x12b640);}return null;};}function patchUpdates(_0x4f9c3b){return function(_0x59260b){try{jsonpatch[_0x9c76('0x1d')](_0x59260b,_0x4f9c3b,!![]);}catch(_0x4fcdf8){return BPromise[_0x9c76('0x1e')](_0x4fcdf8);}return _0x59260b['save']();};}function saveUpdates(_0xd1339f,_0x180fe1){return function(_0xd6ba8d){if(_0xd6ba8d){return _0xd6ba8d[_0x9c76('0x1f')](_0xd1339f)[_0x9c76('0x20')](function(_0x3935f7){return _0x3935f7;});}return null;};}function removeEntity(_0x5bc4e4,_0x26933c){return function(_0x303f2c){if(_0x303f2c){return _0x303f2c[_0x9c76('0x21')]()['then'](function(){_0x5bc4e4[_0x9c76('0x15')](0xcc)[_0x9c76('0x16')]();});}};}function handleEntityNotFound(_0x5c56e4,_0x149419){return function(_0x1c61f4){if(!_0x1c61f4){_0x5c56e4[_0x9c76('0x14')](0x194);}return _0x1c61f4;};}function handleError(_0x249f17,_0x517674){_0x517674=_0x517674||0x1f4;return function(_0x1e52b1){logger[_0x9c76('0x22')](_0x1e52b1[_0x9c76('0x23')]);if(_0x1e52b1[_0x9c76('0x24')]){delete _0x1e52b1[_0x9c76('0x24')];}_0x249f17[_0x9c76('0x15')](_0x517674)['send'](_0x1e52b1);};}exports['index']=function(_0x12289e,_0x248e9f){var _0x949b0d={},_0x39e2e4={},_0x366008={'count':0x0,'rows':[]};var _0x20a809=_[_0x9c76('0x25')](db[_0x9c76('0x26')][_0x9c76('0x27')],function(_0x357a93){return{'name':_0x357a93['fieldName'],'type':_0x357a93[_0x9c76('0x28')][_0x9c76('0x29')]};});_0x39e2e4[_0x9c76('0x2a')]=_['map'](_0x20a809,_0x9c76('0x24'));_0x39e2e4[_0x9c76('0x2b')]=_[_0x9c76('0x2c')](_0x12289e[_0x9c76('0x2b')]);_0x39e2e4['filters']=_[_0x9c76('0x2d')](_0x39e2e4[_0x9c76('0x2a')],_0x39e2e4[_0x9c76('0x2b')]);_0x949b0d['attributes']=_[_0x9c76('0x2d')](_0x39e2e4[_0x9c76('0x2a')],qs['fields'](_0x12289e['query'][_0x9c76('0x2e')]));_0x949b0d[_0x9c76('0x2f')]=_0x949b0d[_0x9c76('0x2f')][_0x9c76('0x30')]?_0x949b0d[_0x9c76('0x2f')]:_0x39e2e4[_0x9c76('0x2a')];if(!_0x12289e[_0x9c76('0x2b')][_0x9c76('0x31')](_0x9c76('0x32'))){_0x949b0d[_0x9c76('0x19')]=qs[_0x9c76('0x19')](_0x12289e[_0x9c76('0x2b')]['limit']);_0x949b0d[_0x9c76('0x17')]=qs[_0x9c76('0x17')](_0x12289e[_0x9c76('0x2b')][_0x9c76('0x17')]);}_0x949b0d[_0x9c76('0x33')]=qs['sort'](_0x12289e['query'][_0x9c76('0x34')]);_0x949b0d['where']=qs[_0x9c76('0x35')](_[_0x9c76('0x36')](_0x12289e[_0x9c76('0x2b')],_0x39e2e4[_0x9c76('0x35')]),_0x20a809);if(_0x12289e['query'][_0x9c76('0x37')]){_0x949b0d[_0x9c76('0x38')]=_[_0x9c76('0x39')](_0x949b0d[_0x9c76('0x38')],{'$or':_[_0x9c76('0x25')](_0x20a809,function(_0x2cd488){if(_0x2cd488[_0x9c76('0x28')]!=='VIRTUAL'){var _0x316793={};_0x316793[_0x2cd488[_0x9c76('0x24')]]={'$like':'%'+_0x12289e[_0x9c76('0x2b')]['filter']+'%'};return _0x316793;}})});}_0x949b0d=_['merge']({},_0x949b0d,_0x12289e['options']);var _0x1da94e={'where':_0x949b0d['where']};return db['ChatTransferReport'][_0x9c76('0x1a')](_0x1da94e)[_0x9c76('0x20')](function(_0x166fa7){_0x366008[_0x9c76('0x1a')]=_0x166fa7;if(_0x12289e[_0x9c76('0x2b')][_0x9c76('0x3a')]){_0x949b0d[_0x9c76('0x3b')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x9c76('0x3c')](_0x949b0d);})[_0x9c76('0x20')](function(_0x15b242){_0x366008[_0x9c76('0x3d')]=_0x15b242;return _0x366008;})[_0x9c76('0x20')](respondWithFilteredResult(_0x248e9f,_0x949b0d))[_0x9c76('0x3e')](handleError(_0x248e9f,null));};exports[_0x9c76('0x3f')]=function(_0x582c2b,_0xd17338){var _0x271012={'raw':!![],'where':{'id':_0x582c2b['params']['id']}},_0x582ffe={};_0x582ffe[_0x9c76('0x2a')]=_[_0x9c76('0x2c')](db[_0x9c76('0x26')][_0x9c76('0x27')]);_0x582ffe[_0x9c76('0x2b')]=_['keys'](_0x582c2b[_0x9c76('0x2b')]);_0x582ffe[_0x9c76('0x35')]=_['intersection'](_0x582ffe[_0x9c76('0x2a')],_0x582ffe[_0x9c76('0x2b')]);_0x271012[_0x9c76('0x2f')]=_['intersection'](_0x582ffe['model'],qs[_0x9c76('0x2e')](_0x582c2b['query'][_0x9c76('0x2e')]));_0x271012[_0x9c76('0x2f')]=_0x271012['attributes'][_0x9c76('0x30')]?_0x271012[_0x9c76('0x2f')]:_0x582ffe[_0x9c76('0x2a')];if(_0x582c2b['query'][_0x9c76('0x3a')]){_0x271012[_0x9c76('0x3b')]=[{'all':!![]}];}_0x271012=_[_0x9c76('0x39')]({},_0x271012,_0x582c2b[_0x9c76('0x40')]);return db['ChatTransferReport'][_0x9c76('0x41')](_0x271012)[_0x9c76('0x20')](handleEntityNotFound(_0xd17338,null))['then'](respondWithResult(_0xd17338,null))[_0x9c76('0x3e')](handleError(_0xd17338,null));};exports[_0x9c76('0x42')]=function(_0xf64b8b,_0x5cb7c0){return db[_0x9c76('0x26')][_0x9c76('0x42')](_0xf64b8b[_0x9c76('0x43')],{})[_0x9c76('0x20')](respondWithResult(_0x5cb7c0,0xc9))[_0x9c76('0x3e')](handleError(_0x5cb7c0,null));};exports[_0x9c76('0x1f')]=function(_0x37e1ad,_0x387050){if(_0x37e1ad['body']['id']){delete _0x37e1ad[_0x9c76('0x43')]['id'];}return db['ChatTransferReport'][_0x9c76('0x41')]({'where':{'id':_0x37e1ad[_0x9c76('0x44')]['id']}})['then'](handleEntityNotFound(_0x387050,null))[_0x9c76('0x20')](saveUpdates(_0x37e1ad['body'],null))['then'](respondWithResult(_0x387050,null))[_0x9c76('0x3e')](handleError(_0x387050,null));};exports[_0x9c76('0x21')]=function(_0x547aef,_0x2c0cd9){return db['ChatTransferReport'][_0x9c76('0x41')]({'where':{'id':_0x547aef[_0x9c76('0x44')]['id']}})[_0x9c76('0x20')](handleEntityNotFound(_0x2c0cd9,null))[_0x9c76('0x20')](removeEntity(_0x2c0cd9,null))[_0x9c76('0x3e')](handleError(_0x2c0cd9,null));};exports['describe']=function(_0x48e722,_0xbba8ab){return db[_0x9c76('0x26')][_0x9c76('0x45')]()[_0x9c76('0x20')](respondWithResult(_0xbba8ab,null))[_0x9c76('0x3e')](handleError(_0xbba8ab,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 51a6d45..d0f9366 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 _0xb9e8=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x2faf2d,_0x272b51){var _0x2bbb8f=function(_0x52228e){while(--_0x52228e){_0x2faf2d['push'](_0x2faf2d['shift']());}};_0x2bbb8f(++_0x272b51);}(_0xb9e8,0x1a1));var _0x8b9e=function(_0x59145a,_0x1f60f1){_0x59145a=_0x59145a-0x0;var _0xf04d7=_0xb9e8[_0x59145a];return _0xf04d7;};'use strict';var _=require(_0x8b9e('0x0'));var util=require(_0x8b9e('0x1'));var logger=require(_0x8b9e('0x2'))(_0x8b9e('0x3'));var moment=require(_0x8b9e('0x4'));var BPromise=require(_0x8b9e('0x5'));var rp=require(_0x8b9e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b9e('0x7'));var config=require(_0x8b9e('0x8'));var attributes=require(_0x8b9e('0x9'));module[_0x8b9e('0xa')]=function(_0x43fbca,_0x3b3530){return _0x43fbca[_0x8b9e('0xb')]('ChatTransferReport',attributes,{'tableName':_0x8b9e('0xc'),'paranoid':![],'indexes':[{'name':_0x8b9e('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xed47=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatTransferReport.attributes','exports'];(function(_0x9f2a85,_0xd791da){var _0x47d8b0=function(_0x301335){while(--_0x301335){_0x9f2a85['push'](_0x9f2a85['shift']());}};_0x47d8b0(++_0xd791da);}(_0xed47,0x1b6));var _0x7ed4=function(_0x4c894b,_0x54fa91){_0x4c894b=_0x4c894b-0x0;var _0x490258=_0xed47[_0x4c894b];return _0x490258;};'use strict';var _=require(_0x7ed4('0x0'));var util=require(_0x7ed4('0x1'));var logger=require('../../config/logger')(_0x7ed4('0x2'));var moment=require(_0x7ed4('0x3'));var BPromise=require(_0x7ed4('0x4'));var rp=require(_0x7ed4('0x5'));var fs=require('fs');var path=require(_0x7ed4('0x6'));var rimraf=require(_0x7ed4('0x7'));var config=require('../../config/environment');var attributes=require(_0x7ed4('0x8'));module[_0x7ed4('0x9')]=function(_0x565f20,_0x3f12ad){return _0x565f20[_0x7ed4('0xa')](_0x7ed4('0xb'),attributes,{'tableName':_0x7ed4('0xc'),'paranoid':![],'indexes':[{'name':_0x7ed4('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 7822b92..927e5cd 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 _0xe191=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util'];(function(_0x57fc31,_0x11fcc6){var _0x4640e6=function(_0x85a791){while(--_0x85a791){_0x57fc31['push'](_0x57fc31['shift']());}};_0x4640e6(++_0x11fcc6);}(_0xe191,0x8e));var _0x1e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe191[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e19('0x0'));var util=require(_0x1e19('0x1'));var moment=require(_0x1e19('0x2'));var BPromise=require(_0x1e19('0x3'));var rs=require(_0x1e19('0x4'));var fs=require('fs');var Redis=require(_0x1e19('0x5'));var db=require(_0x1e19('0x6'))['db'];var utils=require(_0x1e19('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1e19('0x8'));var jayson=require(_0x1e19('0x9'));var client=jayson[_0x1e19('0xa')][_0x1e19('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c9d86,_0x5d1468,_0x1a90b3){return new BPromise(function(_0x4f4647,_0xa9482b){return client['request'](_0x3c9d86,_0x1a90b3)[_0x1e19('0xc')](function(_0xa4636d){logger[_0x1e19('0xd')](_0x1e19('0xe'),_0x5d1468,_0x1e19('0xf'));logger[_0x1e19('0x10')](_0x1e19('0x11'),_0x5d1468,_0x1e19('0xf'),JSON[_0x1e19('0x12')](_0xa4636d));if(_0xa4636d['error']){if(_0xa4636d['error'][_0x1e19('0x13')]===0x1f4){logger[_0x1e19('0x14')](_0x1e19('0xe'),_0x5d1468,_0xa4636d['error'][_0x1e19('0x15')]);return _0xa9482b(_0xa4636d[_0x1e19('0x14')]['message']);}logger[_0x1e19('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x5d1468,_0xa4636d['error'][_0x1e19('0x15')]);return _0x4f4647(_0xa4636d[_0x1e19('0x14')][_0x1e19('0x15')]);}else{logger[_0x1e19('0xd')](_0x1e19('0xe'),_0x5d1468,_0x1e19('0xf'));_0x4f4647(_0xa4636d[_0x1e19('0x16')][_0x1e19('0x15')]);}})[_0x1e19('0x17')](function(_0x186014){logger[_0x1e19('0x14')](_0x1e19('0xe'),_0x5d1468,_0x186014);_0xa9482b(_0x186014);});});} \ No newline at end of file +var _0x2040=['client','http','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatTransferReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xebf085,_0x3ebcdc){var _0x9182ec=function(_0x73093b){while(--_0x73093b){_0xebf085['push'](_0xebf085['shift']());}};_0x9182ec(++_0x3ebcdc);}(_0x2040,0x1da));var _0x0204=function(_0x1803a8,_0x562839){_0x1803a8=_0x1803a8-0x0;var _0x459c06=_0x2040[_0x1803a8];return _0x459c06;};'use strict';var _=require(_0x0204('0x0'));var util=require('util');var moment=require(_0x0204('0x1'));var BPromise=require(_0x0204('0x2'));var rs=require(_0x0204('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0204('0x4'))['db'];var utils=require(_0x0204('0x5'));var logger=require(_0x0204('0x6'))(_0x0204('0x7'));var config=require(_0x0204('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0204('0x9')][_0x0204('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x159da9,_0x39420e,_0xaa84ae){return new BPromise(function(_0xa82eed,_0x4691a9){return client['request'](_0x159da9,_0xaa84ae)[_0x0204('0xb')](function(_0x575e7b){logger[_0x0204('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x39420e,_0x0204('0xd'));logger[_0x0204('0xe')](_0x0204('0xf'),_0x39420e,_0x0204('0xd'),JSON[_0x0204('0x10')](_0x575e7b));if(_0x575e7b[_0x0204('0x11')]){if(_0x575e7b[_0x0204('0x11')][_0x0204('0x12')]===0x1f4){logger[_0x0204('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x39420e,_0x575e7b[_0x0204('0x11')]['message']);return _0x4691a9(_0x575e7b[_0x0204('0x11')][_0x0204('0x13')]);}logger['error'](_0x0204('0x14'),_0x39420e,_0x575e7b[_0x0204('0x11')][_0x0204('0x13')]);return _0xa82eed(_0x575e7b[_0x0204('0x11')][_0x0204('0x13')]);}else{logger[_0x0204('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x39420e,'request\x20sent');_0xa82eed(_0x575e7b[_0x0204('0x15')]['message']);}})[_0x0204('0x16')](function(_0x36c6dd){logger[_0x0204('0x11')](_0x0204('0x14'),_0x39420e,_0x36c6dd);_0x4691a9(_0x36c6dd);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 0553207..3deefae 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 _0x9b8e=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b8e,0x166));var _0xe9b8=function(_0x517171,_0x68eebb){_0x517171=_0x517171-0x0;var _0x5471af=_0x9b8e[_0x517171];return _0x5471af;};'use strict';var multer=require(_0xe9b8('0x0'));var util=require(_0xe9b8('0x1'));var path=require(_0xe9b8('0x2'));var timeout=require('connect-timeout');var express=require(_0xe9b8('0x3'));var router=express[_0xe9b8('0x4')]();var fs_extra=require(_0xe9b8('0x5'));var auth=require(_0xe9b8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe9b8('0x7'));var controller=require('./chatTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe9b8('0x8')]);router[_0xe9b8('0x9')]('/describe',auth[_0xe9b8('0xa')](),controller[_0xe9b8('0xb')]);router[_0xe9b8('0x9')](_0xe9b8('0xc'),auth[_0xe9b8('0xa')](),controller['show']);router[_0xe9b8('0xd')]('/',auth[_0xe9b8('0xa')](),controller[_0xe9b8('0xe')]);router[_0xe9b8('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe9b8('0x10')]);router[_0xe9b8('0x11')]('/:id',auth[_0xe9b8('0xa')](),controller[_0xe9b8('0x12')]);module[_0xe9b8('0x13')]=router; \ No newline at end of file +var _0x2240=['path','connect-timeout','express','Router','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports','util'];(function(_0x15ad3f,_0x1d6280){var _0xfb1d10=function(_0x2730f7){while(--_0x2730f7){_0x15ad3f['push'](_0x15ad3f['shift']());}};_0xfb1d10(++_0x1d6280);}(_0x2240,0x71));var _0x0224=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x2240[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require('multer');var util=require(_0x0224('0x0'));var path=require(_0x0224('0x1'));var timeout=require(_0x0224('0x2'));var express=require(_0x0224('0x3'));var router=express[_0x0224('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0224('0x5'));var config=require('../../config/environment');var controller=require(_0x0224('0x6'));router[_0x0224('0x7')]('/',auth[_0x0224('0x8')](),controller[_0x0224('0x9')]);router[_0x0224('0x7')](_0x0224('0xa'),auth[_0x0224('0x8')](),controller[_0x0224('0xb')]);router[_0x0224('0x7')](_0x0224('0xc'),auth[_0x0224('0x8')](),controller['show']);router[_0x0224('0xd')]('/',auth[_0x0224('0x8')](),controller[_0x0224('0xe')]);router[_0x0224('0xf')](_0x0224('0xc'),auth[_0x0224('0x8')](),controller[_0x0224('0x10')]);router['delete'](_0x0224('0xc'),auth['isAuthenticated'](),controller[_0x0224('0x11')]);module[_0x0224('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index ce962ae..8873af3 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 _0x720c=['email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Feedback','stringify','input','name','getDataValue','onlineForm','parse','TEXT','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','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.','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING'];(function(_0x263106,_0x30a27a){var _0x35dfca=function(_0x58f38d){while(--_0x58f38d){_0x263106['push'](_0x263106['shift']());}};_0x35dfca(++_0x30a27a);}(_0x720c,0x1be));var _0xc720=function(_0x1dcbc6,_0x219d61){_0x1dcbc6=_0x1dcbc6-0x0;var _0x1a0893=_0x720c[_0x1dcbc6];return _0x1a0893;};'use strict';var Sequelize=require(_0xc720('0x0'));var rs=require(_0xc720('0x1'));module[_0xc720('0x2')]={'name':{'type':Sequelize[_0xc720('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xc720('0x3')]},'mapKey':{'type':Sequelize[_0xc720('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xc720('0x4')},'key':{'type':Sequelize[_0xc720('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x5')},'customerAlias':{'type':Sequelize[_0xc720('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xc720('0x3')],'allowNull':![],'defaultValue':_0xc720('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc720('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc720('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xc720('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xc720('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xc720('0x9')](_0xc720('0xa'),_0xc720('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0xc')},'start_chat_button':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0xd')},'offline_chat_button':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0xe')},'header_offline':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xc720('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xc720('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xc720('0x10')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xc720('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x13')},'noteTitle':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x14')},'placeholderMessage':{'type':Sequelize[_0xc720('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xc720('0xe')},'skipMessageButton':{'type':Sequelize[_0xc720('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xc720('0x10')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc720('0x10')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xc720('0x10')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xc720('0x16')},'ratingType':{'type':Sequelize[_0xc720('0x9')]('star','thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xc720('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xc720('0x17')]({'items':[{'type':_0xc720('0x18'),'variable':null,'config':{'placeholder':_0xc720('0x19'),'type':'text','required':!![]},'props':{'title':_0xc720('0x19'),'helpText':''}},{'type':_0xc720('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xc720('0x4'),'type':_0xc720('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xc720('0x1a')](_0xc720('0x1b'))?JSON[_0xc720('0x1c')](this[_0xc720('0x1a')](_0xc720('0x1b'))):{};},'set':function(_0xce74ad){return this['setDataValue'](_0xc720('0x1b'),JSON[_0xc720('0x17')](_0xce74ad));}},'offlineForm':{'type':Sequelize[_0xc720('0x1d')],'defaultValue':function(){return JSON[_0xc720('0x17')]({'items':[{'type':_0xc720('0x18'),'props':{'title':_0xc720('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xc720('0x4'),'type':'email'},'variable':null},{'type':_0xc720('0x1e'),'config':{'placeholder':_0xc720('0x1f')},'props':{'title':_0xc720('0x1f'),'helpText':_0xc720('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xc720('0x1a')](_0xc720('0x21'))?JSON[_0xc720('0x1c')](this[_0xc720('0x1a')](_0xc720('0x21'))):{};},'set':function(_0x258a98){return this[_0xc720('0x22')](_0xc720('0x21'),JSON['stringify'](_0x258a98));}},'token':{'type':Sequelize[_0xc720('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xc720('0x10')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xc720('0x10')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xc720('0x10')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xc720('0x3')]},'forwardOffline':{'type':Sequelize[_0xc720('0x10')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xc720('0x3')]},'waitingTitle':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x23')},'waitingMessage':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xc720('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xc720('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xc720('0x10')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x25')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xc720('0x26')},'sendUnmanaged':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xc720('0x10')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xc720('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xc720('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0xc720('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc720('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x28')},'verticalAlignment':{'type':Sequelize[_0xc720('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x29')},'messagesAlignment':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x2a')},'defaultTitle':{'type':Sequelize[_0xc720('0x3')]},'customerAvatar':{'type':Sequelize[_0xc720('0x1d')]},'showCustomerAvatar':{'type':Sequelize[_0xc720('0x10')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xc720('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xc720('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc720('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc720('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xc720('0x3')],'defaultValue':_0xc720('0x2b')},'systemAvatar':{'type':Sequelize[_0xc720('0x1d')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xc720('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xc720('0x10')],'defaultValue':![],'comment':_0xc720('0x2d'),'set':function(_0x5793ff){if(!_0x5793ff)this[_0xc720('0x22')](_0xc720('0x2e'),null);this[_0xc720('0x22')](_0xc720('0x2f'),_0x5793ff);}},'vidaooEscalation':{'type':Sequelize[_0xc720('0x10')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xc720('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc720('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xc720('0x31');}},'vidaooMetadata':{'type':Sequelize[_0xc720('0x1d')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xc720('0x1d')]}}; \ No newline at end of file +var _0xe11a=['Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue'];(function(_0x495b89,_0x120653){var _0x49bb62=function(_0x36751d){while(--_0x36751d){_0x495b89['push'](_0x495b89['shift']());}};_0x49bb62(++_0x120653);}(_0xe11a,0x143));var _0xae11=function(_0x1ad294,_0x153b93){_0x1ad294=_0x1ad294-0x0;var _0x1e0e55=_0xe11a[_0x1ad294];return _0x1e0e55;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xae11('0x0'));module['exports']={'name':{'type':Sequelize[_0xae11('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x2')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0xae11('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x3')},'customerAlias':{'type':Sequelize[_0xae11('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xae11('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xae11('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xae11('0x1')],'allowNull':![],'defaultValue':_0xae11('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xae11('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xae11('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xae11('0x7')]('rounded',_0xae11('0x8')),'defaultValue':_0xae11('0x9')},'header_online':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0xa')},'start_chat_button':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0xb')},'offline_chat_button':{'type':Sequelize[_0xae11('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0xc')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xae11('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xae11('0xf')]},'closingQuestion':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x12')},'noteTitle':{'type':Sequelize[_0xae11('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x13')},'closingMessage':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xae11('0x15')},'skipMessageButton':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x16')},'conditionAgreement':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x17')},'ratingType':{'type':Sequelize['ENUM'](_0xae11('0x18'),_0xae11('0x19')),'defaultValue':_0xae11('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xae11('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xae11('0x1a')]({'items':[{'type':_0xae11('0x1b'),'variable':null,'config':{'placeholder':_0xae11('0x1c'),'type':_0xae11('0x1d'),'required':!![]},'props':{'title':_0xae11('0x1c'),'helpText':''}},{'type':_0xae11('0x1b'),'props':{'title':_0xae11('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0xae11('0x2'),'type':_0xae11('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xae11('0x1e')](_0xae11('0x1f'))?JSON[_0xae11('0x20')](this[_0xae11('0x1e')](_0xae11('0x1f'))):{};},'set':function(_0x23eb0f){return this[_0xae11('0x21')]('onlineForm',JSON[_0xae11('0x1a')](_0x23eb0f));}},'offlineForm':{'type':Sequelize[_0xae11('0xf')],'defaultValue':function(){return JSON[_0xae11('0x1a')]({'items':[{'type':_0xae11('0x1b'),'props':{'title':_0xae11('0x2'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xae11('0x2')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xae11('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xae11('0x23'))?JSON['parse'](this[_0xae11('0x1e')](_0xae11('0x23'))):{};},'set':function(_0x35d871){return this['setDataValue'](_0xae11('0x23'),JSON[_0xae11('0x1a')](_0x35d871));}},'token':{'type':Sequelize[_0xae11('0x1')],'defaultValue':function(){return rs[_0xae11('0x24')]();}},'autoclose':{'type':Sequelize[_0xae11('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xae11('0x1')]},'forwardOffline':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xae11('0x1')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xae11('0x25')},'waitingMessage':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xae11('0x27')},'offlineMessageBody':{'type':Sequelize[_0xae11('0x1')],'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[_0xae11('0x1')],'defaultValue':_0xae11('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xae11('0x16')},'sendUnmanaged':{'type':Sequelize[_0xae11('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xae11('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xae11('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xae11('0x29');}},'notificationSound':{'type':Sequelize[_0xae11('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xae11('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xae11('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xae11('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x2a')},'verticalAlignment':{'type':Sequelize[_0xae11('0xd')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xae11('0x2b')},'messagesAlignment':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x2c')},'defaultTitle':{'type':Sequelize[_0xae11('0x1')]},'customerAvatar':{'type':Sequelize[_0xae11('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xae11('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xae11('0x1')],'allowNull':![],'defaultValue':_0xae11('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xae11('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xae11('0x1')],'defaultValue':_0xae11('0x2e')},'systemAvatar':{'type':Sequelize[_0xae11('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae11('0xd')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xae11('0x2f'),'set':function(_0x104615){if(!_0x104615)this[_0xae11('0x21')](_0xae11('0x30'),null);this['setDataValue']('mandatoryDisposition',_0x104615);}},'vidaooEscalation':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xae11('0x31')},'vidaooNote':{'type':Sequelize[_0xae11('0x1')],'defaultValue':function(){return _0xae11('0x32');}},'vidaooMetadata':{'type':Sequelize[_0xae11('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xae11('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xae11('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 02a548a..b4bcde7 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 _0xc30f=['threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','Sequelize','no\x20available\x20attributes','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','toPairsIn','mapValues','email','firstName','Chat','MailAccountId','NotifyMailAccount','remove','omit','getInteractions','Contact','fullname','color','tag','getSnippet','../../config/license/util','virtual','License','chatLicenseExceeded','utf8','3.8.1','origin','replace','testWebsiteWithWildcard','remoteAddress','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','ISOLATION_LEVELS','ChatApplication','findAndCountAll','stack','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getProactiveActions','getFields','online','false','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','./helpers/wildcard-expressions','url','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','destroy','get','ChatWebsites','UserProfileResource','name','send','user-agent-parser','setUA','user-agent','getResult','first','x-forwarded-for','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','model','%s\x20%s\x20%s','vendor','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','filter','options','includeAll','include','findAll','rows','show','params','find','create','testWildcardValidity','address','body','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','nolimit','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','systemAvatar','Interval','resolve','timezone','ifTime','notify','from','From\x20is\x20mandatory','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','customerIp','CmContact','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','includes','mapKey','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','ListId','defaults','contact','headers'];(function(_0x1cc9cc,_0x1d7711){var _0x3dce09=function(_0x19a5b4){while(--_0x19a5b4){_0x1cc9cc['push'](_0x1cc9cc['shift']());}};_0x3dce09(++_0x1d7711);}(_0xc30f,0x75));var _0xfc30=function(_0x228d93,_0x5b5a75){_0x228d93=_0x228d93-0x0;var _0x11c8ad=_0xc30f[_0x228d93];return _0x11c8ad;};'use strict';var Mustache=require(_0xfc30('0x0'));var util=require('util');var path=require(_0xfc30('0x1'));var ejs=require(_0xfc30('0x2'));var fs=require('fs');var fs_extra=require(_0xfc30('0x3'));var _=require(_0xfc30('0x4'));var querystring=require('querystring');var htmlToText=require('html-to-text');var Redis=require(_0xfc30('0x5'));var jayson=require('jayson/promise');var qs=require(_0xfc30('0x6'));var logger=require(_0xfc30('0x7'))(_0xfc30('0x8'));var config=require(_0xfc30('0x9'));var APIBadRequestError=require(_0xfc30('0xa'))['APIBadRequestError'];var APINotFoundError=require(_0xfc30('0xa'))[_0xfc30('0xb')];var APIOutOfIntervalError=require(_0xfc30('0xa'))[_0xfc30('0xc')];var APIHandleError=require(_0xfc30('0xa'))[_0xfc30('0xd')];var APIConflictError=require('../../errors/api')['APIConflictError'];var wildcardUtils=require(_0xfc30('0xe'));var URL=require(_0xfc30('0xf'))['URL'];var db=require(_0xfc30('0x10'))['db'];config[_0xfc30('0x11')]=_['defaults'](config['redis'],{'host':_0xfc30('0x12'),'port':0x18eb});var socket=require(_0xfc30('0x13'))(new Redis(config['redis']));require(_0xfc30('0x14'))[_0xfc30('0x15')](socket);var client=jayson[_0xfc30('0x16')][_0xfc30('0x17')]({'port':0x232c});var client9002=jayson[_0xfc30('0x16')]['http']({'port':0x232a});var client9003=jayson[_0xfc30('0x16')]['http']({'port':0x232b});var client9001=jayson[_0xfc30('0x16')][_0xfc30('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x2c598b,_0x228993,_0x109bad,_0x4784b5){return new Promise(function(_0x21b0db,_0x15b049){var _0x48c33f=_0x4784b5||client;return _0x48c33f[_0xfc30('0x18')](_0x2c598b,_0x109bad)[_0xfc30('0x19')](function(_0x4cd29b){logger[_0xfc30('0x1a')](_0xfc30('0x1b'),_0x228993,_0xfc30('0x1c'));logger[_0xfc30('0x1d')](_0xfc30('0x1e'),_0x228993,_0xfc30('0x1c'),JSON[_0xfc30('0x1f')](_0x4cd29b));if(_0x4cd29b['error']){if(_0x4cd29b[_0xfc30('0x20')]['code']===0x1f4){logger['error'](_0xfc30('0x1b'),_0x228993,_0x4cd29b[_0xfc30('0x20')][_0xfc30('0x21')]);return _0x15b049(_0x4cd29b[_0xfc30('0x20')]['message']);}logger['error'](_0xfc30('0x1b'),_0x228993,_0x4cd29b[_0xfc30('0x20')][_0xfc30('0x21')]);return _0x21b0db(_0x4cd29b[_0xfc30('0x20')][_0xfc30('0x21')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x228993,_0xfc30('0x1c'));_0x21b0db(_0x4cd29b[_0xfc30('0x22')]['message']);}})[_0xfc30('0x23')](function(_0x3e0928){logger[_0xfc30('0x20')](_0xfc30('0x1b'),_0x228993,_0x3e0928);_0x15b049(_0x3e0928);});});}function respondWithStatusCode(_0x293057,_0x49a935){_0x49a935=_0x49a935||0xcc;return function(_0x38d3a2){if(_0x38d3a2){return _0x293057[_0xfc30('0x24')](_0x49a935);}return _0x293057['status'](_0x49a935)[_0xfc30('0x25')]();};}function respondWithResult(_0x549e23,_0x1224ca){_0x1224ca=_0x1224ca||0xc8;return function(_0x2da686){if(_0x2da686){return _0x549e23[_0xfc30('0x26')](_0x1224ca)[_0xfc30('0x27')](_0x2da686);}};}function respondWithFilteredResult(_0x17b7df,_0x585952){return function(_0x3cc4f0){if(_0x3cc4f0){var _0xef0105=typeof _0x585952['offset']===_0xfc30('0x28')&&typeof _0x585952[_0xfc30('0x29')]===_0xfc30('0x28');var _0x4d0819=_0x3cc4f0[_0xfc30('0x2a')];var _0x19ea28=_0xef0105?0x0:_0x585952[_0xfc30('0x2b')];var _0x1cce6e=_0xef0105?_0x3cc4f0['count']:_0x585952[_0xfc30('0x2b')]+_0x585952[_0xfc30('0x29')];var _0x5e0763;if(_0x1cce6e>=_0x4d0819){_0x1cce6e=_0x4d0819;_0x5e0763=0xc8;}else{_0x5e0763=0xce;}_0x17b7df[_0xfc30('0x26')](_0x5e0763);return _0x17b7df['set'](_0xfc30('0x2c'),_0x19ea28+'-'+_0x1cce6e+'/'+_0x4d0819)['json'](_0x3cc4f0);}return null;};}function saveUpdates(_0x10a809){return function(_0xedea83){if(_0xedea83){return _0xedea83['update'](_0x10a809)[_0xfc30('0x19')](function(_0x2c566b){return _0x2c566b;});}return null;};}function removeEntity(_0x49a921){return function(_0x1c55a8){if(_0x1c55a8){return _0x1c55a8[_0xfc30('0x2d')]()[_0xfc30('0x19')](function(){var _0x290e42=_0x1c55a8[_0xfc30('0x2e')]({'plain':!![]});var _0x1e1b16=_0xfc30('0x2f');return db[_0xfc30('0x30')][_0xfc30('0x2d')]({'where':{'type':_0x1e1b16,'resourceId':_0x290e42['id']}})[_0xfc30('0x19')](function(){return _0x1c55a8;});})[_0xfc30('0x19')](function(){_0x49a921['status'](0xcc)[_0xfc30('0x25')]();});}};}function handleEntityNotFound(_0x3c1452){return function(_0x1e54b9){if(!_0x1e54b9){_0x3c1452[_0xfc30('0x24')](0x194);}return _0x1e54b9;};}function handleError(_0x45b4d6,_0xb4d412){_0xb4d412=_0xb4d412||0x1f4;return function(_0x2b0bc0){logger[_0xfc30('0x20')](_0x2b0bc0['stack']);if(_0x2b0bc0[_0xfc30('0x31')]){delete _0x2b0bc0[_0xfc30('0x31')];}_0x45b4d6[_0xfc30('0x26')](_0xb4d412)[_0xfc30('0x32')](_0x2b0bc0);};}function createInteractionObject(_0x397e3d,_0x1f180d,_0x575a99,_0x12d7d5){var _0x3e4dc2=require(_0xfc30('0x33'));var _0x3d0a9a=new _0x3e4dc2();var _0x15db7a=_0x3d0a9a[_0xfc30('0x34')](_0x575a99[_0xfc30('0x35')])[_0xfc30('0x36')]();var _0x3bd7df=_0x1f180d['customerIp'];if(_0x575a99['cf-connecting-ip']){_0x3bd7df=_0x575a99['cf-connecting-ip'];}else if(_0x575a99['x-forwarded-for']){_0x3bd7df=_[_0xfc30('0x37')](_0x575a99[_0xfc30('0x38')]['split'](','));}return{'ContactId':_0x12d7d5['id'],'ChatWebsiteId':_0x397e3d,'from':(_0x12d7d5['firstName']||'')+'\x20'+(_0x12d7d5[_0xfc30('0x39')]||''),'customerIp':_0x3bd7df,'customerPort':_0x575a99[_0xfc30('0x3a')]?_0x575a99[_0xfc30('0x3a')]:null,'referer':_0x1f180d[_0xfc30('0x3b')],'browserName':_0x15db7a[_0xfc30('0x3c')][_0xfc30('0x31')]&&_0x15db7a[_0xfc30('0x3c')][_0xfc30('0x3d')]?util[_0xfc30('0x3e')]('%s\x20%s',_0x15db7a[_0xfc30('0x3c')]['name'],_0x15db7a[_0xfc30('0x3c')]['version']):_0xfc30('0x3f'),'browserVersion':_0x15db7a[_0xfc30('0x3c')][_0xfc30('0x3d')]||_0xfc30('0x3f'),'osName':util[_0xfc30('0x3e')](_0xfc30('0x40'),_0x15db7a['os']['name'],_0x15db7a['os'][_0xfc30('0x3d')]),'osVersion':_0x15db7a['os']['version'],'deviceModel':_0x15db7a[_0xfc30('0x41')][_0xfc30('0x42')]&&_0x15db7a[_0xfc30('0x41')]['vendor']?util[_0xfc30('0x3e')](_0xfc30('0x43'),_0x15db7a[_0xfc30('0x41')]['model'],_0x15db7a[_0xfc30('0x41')][_0xfc30('0x44')],_0x15db7a['device'][_0xfc30('0x45')]):null,'deviceVendor':_0x15db7a[_0xfc30('0x41')]['vendor'],'deviceType':_0x15db7a['device']['type'],'formData':JSON[_0xfc30('0x1f')](_0x1f180d)};}exports[_0xfc30('0x46')]=function(_0x21c001,_0x28f175){var _0x254170={'include':[{'model':db[_0xfc30('0x47')],'as':_0xfc30('0x48')}]},_0x45b71b={},_0x38cfd7={'count':0x0,'rows':[]};var _0x50128=_[_0xfc30('0x49')](db[_0xfc30('0x4a')][_0xfc30('0x4b')],function(_0x57b660){return{'name':_0x57b660['fieldName'],'type':_0x57b660['type'][_0xfc30('0x4c')]};});_0x45b71b[_0xfc30('0x42')]=_['map'](_0x50128,'name');_0x45b71b[_0xfc30('0x4d')]=_[_0xfc30('0x4e')](_0x21c001[_0xfc30('0x4d')]);_0x45b71b['filters']=_[_0xfc30('0x4f')](_0x45b71b['model'],_0x45b71b['query']);_0x254170[_0xfc30('0x50')]=_[_0xfc30('0x4f')](_0x45b71b[_0xfc30('0x42')],qs[_0xfc30('0x51')](_0x21c001[_0xfc30('0x4d')][_0xfc30('0x51')]));_0x254170['attributes']=_0x254170[_0xfc30('0x50')][_0xfc30('0x52')]?_0x254170[_0xfc30('0x50')]:_0x45b71b['model'];if(!_0x21c001['query'][_0xfc30('0x53')]('nolimit')){_0x254170[_0xfc30('0x29')]=qs[_0xfc30('0x29')](_0x21c001[_0xfc30('0x4d')]['limit']);_0x254170[_0xfc30('0x2b')]=qs[_0xfc30('0x2b')](_0x21c001[_0xfc30('0x4d')][_0xfc30('0x2b')]);}_0x254170[_0xfc30('0x54')]=qs[_0xfc30('0x55')](_0x21c001[_0xfc30('0x4d')][_0xfc30('0x55')]);_0x254170[_0xfc30('0x56')]=qs['filters'](_[_0xfc30('0x57')](_0x21c001['query'],_0x45b71b[_0xfc30('0x58')]),_0x50128);if(_0x21c001['query']['filter']){_0x254170[_0xfc30('0x56')]=_[_0xfc30('0x59')](_0x254170['where'],{'$or':_[_0xfc30('0x49')](_0x50128,function(_0x35a959){if(_0x35a959[_0xfc30('0x45')]!=='VIRTUAL'){var _0x23c626={};_0x23c626[_0x35a959[_0xfc30('0x31')]]={'$like':'%'+_0x21c001[_0xfc30('0x4d')][_0xfc30('0x5a')]+'%'};return _0x23c626;}})});}_0x254170=_['merge']({},_0x254170,_0x21c001[_0xfc30('0x5b')]);var _0xa4e99c={'where':_0x254170[_0xfc30('0x56')]};return db[_0xfc30('0x4a')]['count'](_0xa4e99c)['then'](function(_0x53c515){_0x38cfd7[_0xfc30('0x2a')]=_0x53c515;if(_0x21c001[_0xfc30('0x4d')][_0xfc30('0x5c')]){_0x254170[_0xfc30('0x5d')]=[{'all':!![]}];}return db[_0xfc30('0x4a')][_0xfc30('0x5e')](_0x254170);})[_0xfc30('0x19')](function(_0x1c4743){_0x38cfd7[_0xfc30('0x5f')]=_0x1c4743;return _0x38cfd7;})[_0xfc30('0x19')](respondWithFilteredResult(_0x28f175,_0x254170))[_0xfc30('0x23')](handleError(_0x28f175,null));};exports[_0xfc30('0x60')]=function(_0x4d5506,_0xaf03a4){var _0x4fe49={'raw':![],'where':{'id':_0x4d5506[_0xfc30('0x61')]['id']},'include':[{'model':db[_0xfc30('0x47')],'as':_0xfc30('0x48')}]},_0x4800d5={};_0x4800d5[_0xfc30('0x42')]=_[_0xfc30('0x4e')](db['ChatWebsite'][_0xfc30('0x4b')]);_0x4800d5[_0xfc30('0x4d')]=_['keys'](_0x4d5506[_0xfc30('0x4d')]);_0x4800d5[_0xfc30('0x58')]=_['intersection'](_0x4800d5['model'],_0x4800d5['query']);_0x4fe49[_0xfc30('0x50')]=_[_0xfc30('0x4f')](_0x4800d5[_0xfc30('0x42')],qs[_0xfc30('0x51')](_0x4d5506['query'][_0xfc30('0x51')]));_0x4fe49['attributes']=_0x4fe49[_0xfc30('0x50')][_0xfc30('0x52')]?_0x4fe49[_0xfc30('0x50')]:_0x4800d5[_0xfc30('0x42')];if(_0x4d5506['query'][_0xfc30('0x5c')]){_0x4fe49[_0xfc30('0x5d')]=[{'all':!![]}];}_0x4fe49=_[_0xfc30('0x59')]({},_0x4fe49,_0x4d5506[_0xfc30('0x5b')]);return db['ChatWebsite'][_0xfc30('0x62')](_0x4fe49)[_0xfc30('0x19')](handleEntityNotFound(_0xaf03a4,null))['then'](respondWithResult(_0xaf03a4,null))[_0xfc30('0x23')](handleError(_0xaf03a4,null));};exports[_0xfc30('0x63')]=function(_0x4ed13d,_0x27315e){if(!wildcardUtils[_0xfc30('0x64')](_0x4ed13d['body'][_0xfc30('0x65')])){return handleError(_0x27315e,null)(new APIBadRequestError('\x22'+_0x4ed13d[_0xfc30('0x66')][_0xfc30('0x65')]+_0xfc30('0x67')));}return db[_0xfc30('0x4a')][_0xfc30('0x63')](_0x4ed13d[_0xfc30('0x66')],{})[_0xfc30('0x19')](function(_0x16d4ab){var _0x481ff6=_0x4ed13d[_0xfc30('0x68')][_0xfc30('0x2e')]({'plain':!![]});if(!_0x481ff6)throw new Error(_0xfc30('0x69'));if(_0x481ff6['role']==='user'){var _0x44da5a=_0x16d4ab[_0xfc30('0x2e')]({'plain':!![]});var _0x95f02a=_0xfc30('0x2f');return db['UserProfileSection']['find']({'where':{'name':_0x95f02a,'userProfileId':_0x481ff6[_0xfc30('0x6a')]},'raw':!![]})['then'](function(_0x1bda7c){if(_0x1bda7c&&_0x1bda7c[_0xfc30('0x6b')]===0x0){return db[_0xfc30('0x30')][_0xfc30('0x63')]({'name':_0x44da5a[_0xfc30('0x31')],'resourceId':_0x44da5a['id'],'type':_0x1bda7c[_0xfc30('0x31')],'sectionId':_0x1bda7c['id']},{})[_0xfc30('0x19')](function(){return _0x16d4ab;});}else{return _0x16d4ab;}})[_0xfc30('0x23')](function(_0x271b80){logger[_0xfc30('0x20')](_0xfc30('0x6c'),_0x271b80);throw _0x271b80;});}return _0x16d4ab;})[_0xfc30('0x19')](respondWithResult(_0x27315e,0xc9))[_0xfc30('0x23')](handleError(_0x27315e,null));};exports[_0xfc30('0x6d')]=function(_0x38001b,_0x1b9b00){if(!wildcardUtils[_0xfc30('0x64')](_0x38001b['body']['address'])){return handleError(_0x1b9b00,null)(new APIBadRequestError('\x22'+_0x38001b[_0xfc30('0x66')][_0xfc30('0x65')]+_0xfc30('0x67')));}if(_0x38001b[_0xfc30('0x66')]['id']){delete _0x38001b[_0xfc30('0x66')]['id'];}return db['ChatWebsite'][_0xfc30('0x62')]({'where':{'id':_0x38001b[_0xfc30('0x61')]['id']},'include':[{'model':db[_0xfc30('0x47')],'as':_0xfc30('0x48')}]})[_0xfc30('0x19')](handleEntityNotFound(_0x1b9b00,null))[_0xfc30('0x19')](saveUpdates(_0x38001b['body'],null))[_0xfc30('0x19')](respondWithResult(_0x1b9b00,null))[_0xfc30('0x23')](handleError(_0x1b9b00,null));};exports[_0xfc30('0x2d')]=function(_0xdcf3cd,_0x4e6ee3){return db[_0xfc30('0x4a')][_0xfc30('0x62')]({'where':{'id':_0xdcf3cd[_0xfc30('0x61')]['id']}})[_0xfc30('0x19')](handleEntityNotFound(_0x4e6ee3,null))[_0xfc30('0x19')](removeEntity(_0x4e6ee3,null))[_0xfc30('0x23')](handleError(_0x4e6ee3,null));};exports[_0xfc30('0x6e')]=function(_0x4690a5,_0x15f243){return db[_0xfc30('0x4a')]['describe']()[_0xfc30('0x19')](respondWithResult(_0x15f243,null))[_0xfc30('0x23')](handleError(_0x15f243,null));};exports[_0xfc30('0x6f')]=function(_0x3c1496,_0x125be3){if(_0x3c1496[_0xfc30('0x66')]['id']){delete _0x3c1496[_0xfc30('0x66')]['id'];}return db[_0xfc30('0x4a')][_0xfc30('0x62')]({'where':{'id':_0x3c1496['params']['id']}})[_0xfc30('0x19')](handleEntityNotFound(_0x125be3,null))[_0xfc30('0x19')](function(_0x4eedc7){if(_0x4eedc7){_0x3c1496['body'][_0xfc30('0x70')]=_0x4eedc7['id'];return db['Disposition'][_0xfc30('0x63')](_0x3c1496[_0xfc30('0x66')]);}})[_0xfc30('0x19')](respondWithResult(_0x125be3,null))[_0xfc30('0x23')](handleError(_0x125be3,null));};exports[_0xfc30('0x71')]=function(_0x58bdae,_0x1ebdc1){var _0x2e45e1={'raw':![],'where':{}};var _0x4fed2a={};var _0x39f168={'count':0x0,'rows':[]};return db[_0xfc30('0x4a')][_0xfc30('0x72')]({'where':{'id':_0x58bdae[_0xfc30('0x61')]['id']}})['then'](handleEntityNotFound(_0x1ebdc1,null))[_0xfc30('0x19')](function(_0x3cefca){if(_0x3cefca){_0x4fed2a[_0xfc30('0x42')]=_[_0xfc30('0x4e')](db['Disposition'][_0xfc30('0x4b')]);_0x4fed2a['query']=_[_0xfc30('0x4e')](_0x58bdae[_0xfc30('0x4d')]);_0x4fed2a[_0xfc30('0x58')]=_[_0xfc30('0x4f')](_0x4fed2a[_0xfc30('0x42')],_0x4fed2a[_0xfc30('0x4d')]);_0x2e45e1[_0xfc30('0x50')]=_[_0xfc30('0x4f')](_0x4fed2a['model'],qs['fields'](_0x58bdae[_0xfc30('0x4d')][_0xfc30('0x51')]));_0x2e45e1[_0xfc30('0x50')]=_0x2e45e1[_0xfc30('0x50')][_0xfc30('0x52')]?_0x2e45e1[_0xfc30('0x50')]:_0x4fed2a[_0xfc30('0x42')];if(!_0x58bdae[_0xfc30('0x4d')][_0xfc30('0x53')](_0xfc30('0x73'))){_0x2e45e1['limit']=qs[_0xfc30('0x29')](_0x58bdae[_0xfc30('0x4d')][_0xfc30('0x29')]);_0x2e45e1[_0xfc30('0x2b')]=qs['offset'](_0x58bdae[_0xfc30('0x4d')][_0xfc30('0x2b')]);}_0x2e45e1['order']=qs[_0xfc30('0x55')](_0x58bdae[_0xfc30('0x4d')][_0xfc30('0x55')]);_0x2e45e1['where']=qs[_0xfc30('0x58')](_[_0xfc30('0x57')](_0x58bdae[_0xfc30('0x4d')],_0x4fed2a[_0xfc30('0x58')]));_0x2e45e1[_0xfc30('0x56')][_0xfc30('0x70')]=_0x3cefca['id'];if(_0x58bdae[_0xfc30('0x4d')][_0xfc30('0x5a')]){_0x2e45e1['where']=_[_0xfc30('0x59')](_0x2e45e1[_0xfc30('0x56')],{'$or':_[_0xfc30('0x49')](_0x2e45e1[_0xfc30('0x50')],function(_0x588b23){var _0x40767a={};_0x40767a[_0x588b23]={'$like':'%'+_0x58bdae['query'][_0xfc30('0x5a')]+'%'};return _0x40767a;})});}_0x2e45e1=_['merge']({},_0x2e45e1,_0x58bdae[_0xfc30('0x5b')]);return db[_0xfc30('0x74')][_0xfc30('0x2a')]({'where':_0x2e45e1['where']})[_0xfc30('0x19')](function(_0x5b631a){_0x39f168[_0xfc30('0x2a')]=_0x5b631a;if(_0x58bdae[_0xfc30('0x4d')]['includeAll']){_0x2e45e1[_0xfc30('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0xfc30('0x5e')](_0x2e45e1);})[_0xfc30('0x19')](function(_0x3d489b){_0x39f168[_0xfc30('0x5f')]=_0x3d489b;return _0x39f168;});}})[_0xfc30('0x19')](respondWithFilteredResult(_0x1ebdc1,_0x2e45e1))[_0xfc30('0x23')](handleError(_0x1ebdc1,null));};exports[_0xfc30('0x75')]=function(_0x574d7a,_0x5803bb){return db[_0xfc30('0x4a')][_0xfc30('0x62')]({'where':{'id':_0x574d7a[_0xfc30('0x61')]['id']}})[_0xfc30('0x19')](handleEntityNotFound(_0x5803bb,null))[_0xfc30('0x19')](function(_0x4ac6e5){if(_0x4ac6e5){return _0x4ac6e5[_0xfc30('0x75')](_0x574d7a[_0xfc30('0x4d')][_0xfc30('0x76')]);}})[_0xfc30('0x19')](respondWithStatusCode(_0x5803bb,null))[_0xfc30('0x23')](handleError(_0x5803bb,null));};exports[_0xfc30('0x77')]=function(_0x36972e,_0x4296b3){if(_0x36972e[_0xfc30('0x66')]['id']){delete _0x36972e[_0xfc30('0x66')]['id'];}return db[_0xfc30('0x4a')][_0xfc30('0x62')]({'where':{'id':_0x36972e[_0xfc30('0x61')]['id']}})[_0xfc30('0x19')](handleEntityNotFound(_0x4296b3,null))[_0xfc30('0x19')](function(_0x13dc0a){if(_0x13dc0a){_0x36972e[_0xfc30('0x66')]['ChatWebsiteId']=_0x13dc0a['id'];return db[_0xfc30('0x78')][_0xfc30('0x63')](_0x36972e['body']);}})[_0xfc30('0x19')](respondWithResult(_0x4296b3,null))[_0xfc30('0x23')](handleError(_0x4296b3,null));};exports[_0xfc30('0x79')]=function(_0x4cb0e0,_0x45faa7){var _0x1724b1={'raw':![],'where':{}};var _0x5439e2={};var _0x11e7df={'count':0x0,'rows':[]};return db[_0xfc30('0x4a')][_0xfc30('0x72')]({'where':{'id':_0x4cb0e0['params']['id']}})['then'](handleEntityNotFound(_0x45faa7,null))['then'](function(_0x25b221){if(_0x25b221){_0x5439e2['model']=_[_0xfc30('0x4e')](db[_0xfc30('0x78')][_0xfc30('0x4b')]);_0x5439e2[_0xfc30('0x4d')]=_[_0xfc30('0x4e')](_0x4cb0e0['query']);_0x5439e2[_0xfc30('0x58')]=_[_0xfc30('0x4f')](_0x5439e2['model'],_0x5439e2[_0xfc30('0x4d')]);_0x1724b1[_0xfc30('0x50')]=_[_0xfc30('0x4f')](_0x5439e2[_0xfc30('0x42')],qs[_0xfc30('0x51')](_0x4cb0e0[_0xfc30('0x4d')][_0xfc30('0x51')]));_0x1724b1[_0xfc30('0x50')]=_0x1724b1[_0xfc30('0x50')][_0xfc30('0x52')]?_0x1724b1[_0xfc30('0x50')]:_0x5439e2[_0xfc30('0x42')];if(!_0x4cb0e0['query'][_0xfc30('0x53')](_0xfc30('0x73'))){_0x1724b1['limit']=qs[_0xfc30('0x29')](_0x4cb0e0['query'][_0xfc30('0x29')]);_0x1724b1['offset']=qs[_0xfc30('0x2b')](_0x4cb0e0['query'][_0xfc30('0x2b')]);}_0x1724b1[_0xfc30('0x54')]=qs[_0xfc30('0x55')](_0x4cb0e0[_0xfc30('0x4d')][_0xfc30('0x55')]);_0x1724b1['where']=qs[_0xfc30('0x58')](_['pick'](_0x4cb0e0[_0xfc30('0x4d')],_0x5439e2['filters']));_0x1724b1[_0xfc30('0x56')]['ChatWebsiteId']=_0x25b221['id'];if(_0x4cb0e0[_0xfc30('0x4d')][_0xfc30('0x5a')]){_0x1724b1[_0xfc30('0x56')]=_[_0xfc30('0x59')](_0x1724b1['where'],{'$or':_[_0xfc30('0x49')](_0x1724b1[_0xfc30('0x50')],function(_0x4c81a8){var _0x165512={};_0x165512[_0x4c81a8]={'$like':'%'+_0x4cb0e0[_0xfc30('0x4d')][_0xfc30('0x5a')]+'%'};return _0x165512;})});}_0x1724b1=_[_0xfc30('0x59')]({},_0x1724b1,_0x4cb0e0['options']);return db['CannedAnswer'][_0xfc30('0x2a')]({'where':_0x1724b1[_0xfc30('0x56')]})[_0xfc30('0x19')](function(_0x5e4330){_0x11e7df[_0xfc30('0x2a')]=_0x5e4330;if(_0x4cb0e0[_0xfc30('0x4d')][_0xfc30('0x5c')]){_0x1724b1[_0xfc30('0x5d')]=[{'all':!![]}];}return db[_0xfc30('0x78')]['findAll'](_0x1724b1);})[_0xfc30('0x19')](function(_0xf03fe4){_0x11e7df[_0xfc30('0x5f')]=_0xf03fe4;return _0x11e7df;});}})[_0xfc30('0x19')](respondWithFilteredResult(_0x45faa7,_0x1724b1))['catch'](handleError(_0x45faa7,null));};exports[_0xfc30('0x7a')]=function(_0x1dcc90,_0x2b8cf5){return db[_0xfc30('0x4a')][_0xfc30('0x62')]({'where':{'id':_0x1dcc90['params']['id']}})['then'](handleEntityNotFound(_0x2b8cf5,null))[_0xfc30('0x19')](function(_0x172fda){if(_0x172fda){return _0x172fda[_0xfc30('0x7a')](_0x1dcc90[_0xfc30('0x4d')]['ids']);}})['then'](respondWithStatusCode(_0x2b8cf5,null))[_0xfc30('0x23')](handleError(_0x2b8cf5,null));};exports[_0xfc30('0x7b')]=function(_0x372769,_0x1a92b9){_0x372769[_0xfc30('0x66')][_0xfc30('0x7c')]=_0x372769[_0xfc30('0x7d')]['filename'];return db['ChatWebsite'][_0xfc30('0x62')]({'where':{'id':_0x372769[_0xfc30('0x61')]['id']}})['then'](handleEntityNotFound(_0x1a92b9,null))['then'](saveUpdates(_0x372769[_0xfc30('0x66')],null))[_0xfc30('0x19')](respondWithResult(_0x1a92b9,null))['catch'](handleError(_0x1a92b9,null));};exports[_0xfc30('0x7e')]=function(_0x2e34aa,_0x4433a4){_0x2e34aa[_0xfc30('0x66')][_0xfc30('0x7f')]=_0x2e34aa[_0xfc30('0x7d')][_0xfc30('0x80')];return db[_0xfc30('0x4a')]['find']({'where':{'id':_0x2e34aa[_0xfc30('0x61')]['id']}})['then'](handleEntityNotFound(_0x4433a4,null))[_0xfc30('0x19')](saveUpdates(_0x2e34aa[_0xfc30('0x66')],null))[_0xfc30('0x19')](respondWithResult(_0x4433a4,null))[_0xfc30('0x23')](handleError(_0x4433a4,null));};exports[_0xfc30('0x81')]=function(_0xe75982,_0x14f47c){_0xe75982[_0xfc30('0x66')]['customerAvatar']=_0xe75982[_0xfc30('0x7d')][_0xfc30('0x80')];return db[_0xfc30('0x4a')]['find']({'where':{'id':_0xe75982[_0xfc30('0x61')]['id']}})[_0xfc30('0x19')](handleEntityNotFound(_0x14f47c,null))[_0xfc30('0x19')](saveUpdates(_0xe75982[_0xfc30('0x66')],null))['then'](respondWithResult(_0x14f47c,null))[_0xfc30('0x23')](handleError(_0x14f47c,null));};exports[_0xfc30('0x82')]=function(_0x3fdc25,_0x357e73){_0x3fdc25[_0xfc30('0x66')]['systemAvatar']=_0x3fdc25['file']['filename'];return db['ChatWebsite'][_0xfc30('0x62')]({'where':{'id':_0x3fdc25[_0xfc30('0x61')]['id']}})['then'](handleEntityNotFound(_0x357e73,null))[_0xfc30('0x19')](saveUpdates(_0x3fdc25['body'],null))[_0xfc30('0x19')](respondWithResult(_0x357e73,null))[_0xfc30('0x23')](handleError(_0x357e73,null));};exports[_0xfc30('0x83')]=function(_0x4e0f36,_0x5c2701){var _0x5b550a=path[_0xfc30('0x84')](config[_0xfc30('0x85')],_0xfc30('0x86'));var _0x85e8ab={'where':{'id':_0x4e0f36[_0xfc30('0x61')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x31f566=![];return require('../../config/license/util')[_0xfc30('0x87')]()[_0xfc30('0x19')](function(_0x58c128){if(_0x58c128){_0x31f566=_0x58c128[_0xfc30('0x88')];}})[_0xfc30('0x19')](function(){return db[_0xfc30('0x4a')][_0xfc30('0x62')](_0x85e8ab);})[_0xfc30('0x19')](handleEntityNotFound(_0x5c2701,null))['then'](function(_0x47cb72){if(_0x47cb72){if(!_[_0xfc30('0x89')](_0x47cb72[_0xfc30('0x7c')])){if(fs[_0xfc30('0x8a')](path[_0xfc30('0x84')](config[_0xfc30('0x85')],'server/files/images/logos/',_0x47cb72[_0xfc30('0x7c')]))&&_0x31f566){_0x5b550a=path['join'](config[_0xfc30('0x85')],_0xfc30('0x8b'),_0x47cb72['sitepic']);}}return _0x5c2701[_0xfc30('0x8c')](_0x5b550a);}})[_0xfc30('0x23')](handleError(_0x5c2701,null));};exports[_0xfc30('0x8d')]=function(_0x432352,_0x2c73cc){var _0x43a5b1=path['join'](config[_0xfc30('0x85')],_0xfc30('0x8e'));var _0x44aa46={'where':{'id':_0x432352[_0xfc30('0x61')]['id']},'attributes':['id',_0xfc30('0x7f')],'raw':!![]};return db[_0xfc30('0x4a')][_0xfc30('0x62')](_0x44aa46)[_0xfc30('0x19')](handleEntityNotFound(_0x2c73cc,null))[_0xfc30('0x19')](function(_0x4dd29d){if(_0x4dd29d){if(!_[_0xfc30('0x89')](_0x4dd29d['agentAvatar'])){if(fs[_0xfc30('0x8a')](path['join'](config['root'],'server/files/images/avatars/',_0x4dd29d[_0xfc30('0x7f')]))){_0x43a5b1=path[_0xfc30('0x84')](config['root'],_0xfc30('0x8f'),_0x4dd29d[_0xfc30('0x7f')]);}}return _0x2c73cc[_0xfc30('0x8c')](_0x43a5b1);}})[_0xfc30('0x23')](handleError(_0x2c73cc,null));};exports[_0xfc30('0x90')]=function(_0x3af42d,_0xe67fa5){var _0x9a063d=path[_0xfc30('0x84')](config[_0xfc30('0x85')],_0xfc30('0x91'));var _0x2f561d={'where':{'id':_0x3af42d[_0xfc30('0x61')]['id']},'attributes':['id',_0xfc30('0x92'),'showCustomerAvatar'],'raw':!![]};return db[_0xfc30('0x4a')][_0xfc30('0x62')](_0x2f561d)['then'](handleEntityNotFound(_0xe67fa5,null))[_0xfc30('0x19')](function(_0x449019){if(_0x449019){if(!_[_0xfc30('0x89')](_0x449019[_0xfc30('0x92')])){if(fs[_0xfc30('0x8a')](path['join'](config[_0xfc30('0x85')],_0xfc30('0x8f'),_0x449019[_0xfc30('0x92')]))&&_0x449019[_0xfc30('0x93')]){_0x9a063d=path[_0xfc30('0x84')](config[_0xfc30('0x85')],_0xfc30('0x8f'),_0x449019[_0xfc30('0x92')]);}}return _0xe67fa5[_0xfc30('0x8c')](_0x9a063d);}})[_0xfc30('0x23')](handleError(_0xe67fa5,null));};exports['getSystemAvatar']=function(_0x11745a,_0x59f133){var _0x4639ff=path[_0xfc30('0x84')](config[_0xfc30('0x85')],'server/files/images/avatars/system_avatar.png');var _0x4d175e={'where':{'id':_0x11745a[_0xfc30('0x61')]['id']},'attributes':['id',_0xfc30('0x94')],'raw':!![]};return db['ChatWebsite'][_0xfc30('0x62')](_0x4d175e)[_0xfc30('0x19')](handleEntityNotFound(_0x59f133,null))[_0xfc30('0x19')](function(_0x4fda34){if(_0x4fda34){if(!_[_0xfc30('0x89')](_0x4fda34['systemAvatar'])){if(fs[_0xfc30('0x8a')](path['join'](config[_0xfc30('0x85')],_0xfc30('0x8f'),_0x4fda34[_0xfc30('0x94')]))){_0x4639ff=path[_0xfc30('0x84')](config[_0xfc30('0x85')],_0xfc30('0x8f'),_0x4fda34['systemAvatar']);}}return _0x59f133['download'](_0x4639ff);}})[_0xfc30('0x23')](handleError(_0x59f133,null));};function checkWebsiteInterval(_0x536002){var _0x512723=_0x536002[_0xfc30('0x95')];if(!_0x512723){return Promise[_0xfc30('0x96')](_0x536002);}var _0x418c79=_0x536002[_0xfc30('0x97')]||undefined;return _0x512723[_0xfc30('0x98')](_0x418c79)['then'](function(_0x220206){if(!_0x220206){throw new APIOutOfIntervalError();}return _0x536002;});}exports[_0xfc30('0x99')]=function(_0x396d3e,_0x5928b8){var _0x71abfb={'body':_0x396d3e['body'],'channel':'chat'};var _0x176430=[];var _0x413415=[];var _0x519f65={};var _0xa0c526=![];if(_0x396d3e[_0xfc30('0x66')]['id']){delete _0x396d3e['body']['id'];}if(_[_0xfc30('0x89')](_0x396d3e[_0xfc30('0x66')][_0xfc30('0x9a')])){throw new APIBadRequestError(_0xfc30('0x9b'));}if(_[_0xfc30('0x89')](_0x396d3e[_0xfc30('0x66')]['mapKey'])){throw new APIBadRequestError(_0xfc30('0x9c'));}if(_[_0xfc30('0x9d')](_0x396d3e[_0xfc30('0x66')][_0xfc30('0x66')])){throw new APIBadRequestError(_0xfc30('0x9e'));}var _0x844552=_0x396d3e[_0xfc30('0x66')][_0xfc30('0x9f')]&&_0x396d3e[_0xfc30('0x66')][_0xfc30('0x3b')];return db[_0xfc30('0xa0')][_0xfc30('0x6e')]()[_0xfc30('0x19')](function(_0x1e88bd){if(!_0x1e88bd){throw new Error(_0xfc30('0xa1'));}_0x176430=Object[_0xfc30('0x4e')](_0x1e88bd)[_0xfc30('0x5a')](function(_0x26212b){return![_0xfc30('0xa2'),_0xfc30('0xa3')]['includes'](_0x26212b);});_0x413415=Object[_0xfc30('0x4e')](_0x1e88bd)[_0xfc30('0x5a')](function(_0x7c57b){return![_0xfc30('0xa2'),'updatedAt',_0xfc30('0xa4'),'ListId']['includes'](_0x7c57b);});if(!_[_0xfc30('0xa5')](_0x413415,_0x396d3e[_0xfc30('0x66')][_0xfc30('0xa6')])){throw new APIBadRequestError(_0xfc30('0xa7')+_0x413415[_0xfc30('0x84')](',\x20'));}_0x519f65[_0x396d3e[_0xfc30('0x66')]['mapKey']]=_0x396d3e[_0xfc30('0x66')][_0xfc30('0x9a')];})[_0xfc30('0x19')](function(){return db[_0xfc30('0x4a')]['find']({'where':{'id':_0x396d3e[_0xfc30('0x61')]['id']},'include':[{'model':db[_0xfc30('0xa8')],'as':_0xfc30('0xa9'),'include':[{'model':db[_0xfc30('0xa0')],'as':_0xfc30('0xaa'),'where':_0x519f65,'limit':0x1,'order':[[_0xfc30('0xa3'),_0xfc30('0xab')]]}]},{'model':db['ChatApplication'],'as':_0xfc30('0xac')},{'model':db['Interval'],'as':_0xfc30('0x95'),'include':[{'model':db[_0xfc30('0x95')],'as':_0xfc30('0xad'),'attributes':['id',_0xfc30('0xae')],'raw':!![]}]}]});})[_0xfc30('0x19')](function(_0x3dbe04){if(!_0x3dbe04){throw new APINotFoundError(util[_0xfc30('0x3e')](_0xfc30('0xaf'),_0x396d3e[_0xfc30('0x61')]['id']));}if(_0x844552){return checkWebsiteInterval(_0x3dbe04);}return _0x3dbe04;})['then'](function(_0x27da3f){_0x71abfb[_0xfc30('0xb0')]=_0x27da3f;_0x71abfb[_0xfc30('0xb1')]=_[_0xfc30('0xb2')](_0x27da3f[_0xfc30('0xac')],[_0xfc30('0xb3')],[_0xfc30('0xb4')]);if(_0x71abfb[_0xfc30('0xb0')][_0xfc30('0xac')]){delete _0x71abfb[_0xfc30('0xb0')][_0xfc30('0xac')];}_0x71abfb[_0xfc30('0xb5')]=_0x27da3f[_0xfc30('0xa9')]||{'id':_0x27da3f[_0xfc30('0xb6')]};if(_0x71abfb['list']&&_0x71abfb[_0xfc30('0xb5')]['Contacts']['length']){return _0x71abfb['list'][_0xfc30('0xaa')][0x0];}var _0x34a352=_[_0xfc30('0xb7')](_0x396d3e[_0xfc30('0x66')],{'firstName':_0x396d3e['body'][_0xfc30('0x9a')],'ListId':_0x27da3f[_0xfc30('0xb6')]});_0x34a352[_0x396d3e[_0xfc30('0x66')]['mapKey']]=_0x396d3e[_0xfc30('0x66')][_0xfc30('0x9a')];return db[_0xfc30('0xa0')][_0xfc30('0x63')](_0x34a352,{'fields':_0x176430,'raw':!![]});})[_0xfc30('0x19')](function(_0x3f828f){_0x71abfb[_0xfc30('0xb8')]=_0x3f828f;var _0x1735d9=createInteractionObject(_0x396d3e[_0xfc30('0x61')]['id'],_0x396d3e[_0xfc30('0x66')],_0x396d3e[_0xfc30('0xb9')],_0x3f828f);var _0x558fac={'ChatWebsiteId':_0x396d3e['params']['id']};if(_0x396d3e[_0xfc30('0x66')][_0xfc30('0xba')]){_0x558fac['threadId']=_0x396d3e[_0xfc30('0x66')][_0xfc30('0xba')];_0x558fac[_0xfc30('0xbb')]=![];return db[_0xfc30('0xbc')]['find']({'where':_0x558fac})[_0xfc30('0x19')](function(_0x59a8f2){if(_0x59a8f2){_0xa0c526=!![];return _0x59a8f2;}else if(!_0x844552&&_0x59a8f2&&_0x59a8f2[_0xfc30('0xbb')]){throw new APIConflictError(_0xfc30('0xbd'));}_0x1735d9[_0xfc30('0xba')]=_0x396d3e[_0xfc30('0x66')][_0xfc30('0xba')];_0x1735d9[_0xfc30('0xbe')]=_0x396d3e[_0xfc30('0x66')][_0xfc30('0xbe')];return db[_0xfc30('0xbc')][_0xfc30('0x63')](_0x1735d9);});}_0x558fac[_0xfc30('0xbf')]=_0x3f828f['id'];if(_0x396d3e[_0xfc30('0x66')][_0xfc30('0xc0')]&&_0x396d3e[_0xfc30('0x66')][_0xfc30('0xc0')]['id']){_0x558fac['id']=_0x396d3e['body'][_0xfc30('0xc0')]['id'];return db['ChatInteraction']['find']({'where':_0x558fac})[_0xfc30('0x19')](function(_0x25a638){var _0x1c313f=_0x396d3e['body']['customerIp']&&_0x396d3e[_0xfc30('0x66')][_0xfc30('0x3b')];if(!_0x1c313f&&_0x25a638&&_0x25a638[_0xfc30('0xbb')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x25a638){_0xa0c526=!![];return _0x25a638;}else{return db['ChatInteraction'][_0xfc30('0x63')](_0x1735d9);}});}return db[_0xfc30('0xbc')][_0xfc30('0x63')](_0x1735d9);})[_0xfc30('0x19')](function(_0x4659d1){if(!_0xa0c526){return _0x4659d1;}var _0x2d56d2={'from':(_0x71abfb['contact']['firstName']||'')+'\x20'+(_0x71abfb['contact']['lastName']||'')};if(_0x396d3e[_0xfc30('0x66')][_0xfc30('0xba')]&&_0x396d3e[_0xfc30('0x66')][_0xfc30('0xc1')]&&_0x396d3e[_0xfc30('0x66')]['threadId']!=_0x396d3e[_0xfc30('0x66')]['messageId']){_0x2d56d2[_0xfc30('0xba')]=_0x396d3e['body'][_0xfc30('0xc1')];}return _0x4659d1[_0xfc30('0x6d')](_0x2d56d2);})[_0xfc30('0x19')](function(_0x2a7952){_0x71abfb['interaction']=_0x2a7952['get']({'plain':!![]});_0x71abfb[_0xfc30('0xc0')][_0xfc30('0xc2')]=!_0xa0c526;if(_0x71abfb[_0xfc30('0xc0')]['created']){if(_0x71abfb[_0xfc30('0xb0')][_0xfc30('0xc3')]){_0x71abfb[_0xfc30('0xb1')][_0xfc30('0xc4')]({'id':0x0,'priority':_0x71abfb[_0xfc30('0xb1')][_0xfc30('0x52')]+0x1,'app':_0xfc30('0xc5'),'appdata':_0xfc30('0xc6'),'interval':_0xfc30('0xc7')});}}return db[_0xfc30('0xc8')][_0xfc30('0x63')]({'body':_0x396d3e[_0xfc30('0x66')][_0xfc30('0x66')],'ChatWebsiteId':_0x396d3e[_0xfc30('0x61')]['id'],'ChatInteractionId':_0x2a7952['id'],'direction':'in','ContactId':_0x71abfb[_0xfc30('0xb8')]['id'],'AttachmentId':_0x396d3e[_0xfc30('0x66')][_0xfc30('0xc9')]});})[_0xfc30('0x19')](function(_0x1db411){_0x71abfb[_0xfc30('0x21')]=_0x1db411;if(!_0x71abfb[_0xfc30('0xc0')][_0xfc30('0xca')]){return;}return db[_0xfc30('0xcb')]['find']({'attributes':['id','name'],'where':{'id':_0x71abfb[_0xfc30('0xc0')][_0xfc30('0xca')]}});})[_0xfc30('0x19')](function(_0x587da5){if(_0x587da5){_0x71abfb['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xfc30('0xcc'),'appdata':_0x587da5[_0xfc30('0x31')]+','+(_0x71abfb['account'][_0xfc30('0xcd')]||0xa),'interval':_0xfc30('0xc7')});_0x71abfb[_0xfc30('0xce')]=!![];}if(!_0x71abfb[_0xfc30('0xc0')][_0xfc30('0xcf')]){return;}return db[_0xfc30('0xd0')]['find']({'attributes':['id','name'],'where':{'id':_0x71abfb[_0xfc30('0xc0')][_0xfc30('0xcf')]}});})[_0xfc30('0x19')](function(_0x96eda9){if(_0x96eda9){_0x71abfb[_0xfc30('0xb1')][_0xfc30('0xd1')]({'id':0x0,'priority':0x1,'app':_0xfc30('0xd2'),'appdata':_0x96eda9[_0xfc30('0x31')]+','+(_0x71abfb[_0xfc30('0xb0')][_0xfc30('0xd3')]||0x12c),'interval':_0xfc30('0xc7')});}return respondWithRpcPromise(_0xfc30('0xd4'),_0xfc30('0xd5'),_0x71abfb);})[_0xfc30('0x19')](function(_0x160c27){respondWithRpcPromise('EventManager',_0xfc30('0xd6'),{'event':_0xfc30('0x99'),'message':_0x160c27},client9002);return _0x160c27;})[_0xfc30('0x19')](respondWithResult(_0x5928b8,null))[_0xfc30('0x23')](APIHandleError(_0x5928b8));};exports[_0xfc30('0xd7')]=function(_0x24a6f7,_0x2b5449){var _0x3038a1,_0xc1c6e7,_0x103296;var _0x307633=[];var _0x16a2d5={};var _0x1268f4=_0x24a6f7[_0xfc30('0xd8')]||[];var _0x240466=[];var _0x143221;return db[_0xfc30('0xa0')][_0xfc30('0x6e')]()[_0xfc30('0x19')](function(_0x508f5f){if(!_0x508f5f){throw new db[(_0xfc30('0xd9'))]['ValidationError'](_0xfc30('0xda'));}_0x307633=_['difference'](_['keys'](_0x508f5f),[_0xfc30('0xa2'),'updatedAt','CompanyId',_0xfc30('0xb6')]);if(_0x24a6f7['body']['id']){delete _0x24a6f7['body']['id'];}if(_[_0xfc30('0x89')](_0x24a6f7[_0xfc30('0x66')][_0xfc30('0x9a')])){throw _0x2b5449[_0xfc30('0x26')](0x1f4)['send'](new db[(_0xfc30('0xd9'))][(_0xfc30('0xdb'))](_0xfc30('0xdc')));}if(_[_0xfc30('0x89')](_0x24a6f7[_0xfc30('0x66')][_0xfc30('0x66')])||_0x24a6f7[_0xfc30('0x66')][_0xfc30('0x66')]===''){throw _0x2b5449[_0xfc30('0x26')](0x1f4)[_0xfc30('0x32')](new db['Sequelize'][(_0xfc30('0xdb'))](_0xfc30('0xdd')));}if(_[_0xfc30('0x89')](_0x24a6f7[_0xfc30('0x66')][_0xfc30('0xde')])){throw _0x2b5449[_0xfc30('0x26')](0x1f4)[_0xfc30('0x32')](new db[(_0xfc30('0xd9'))][(_0xfc30('0xdb'))](_0xfc30('0xdf')+_0x307633));}if(!_[_0xfc30('0xa5')](_0x307633,_0x24a6f7[_0xfc30('0x66')][_0xfc30('0xde')])){throw _0x2b5449[_0xfc30('0x26')](0x1f4)['send'](new db[(_0xfc30('0xd9'))][(_0xfc30('0xdb'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x307633));}_0x16a2d5[_0x24a6f7[_0xfc30('0x66')][_0xfc30('0xde')]]=_0x24a6f7[_0xfc30('0x66')][_0xfc30('0x9a')];})[_0xfc30('0x19')](function(){return db[_0xfc30('0x4a')][_0xfc30('0x62')]({'where':{'id':_0x24a6f7['params']['id']},'include':[{'model':db[_0xfc30('0xa8')],'as':'List'},{'model':db['MailAccount'],'as':_0xfc30('0xe0')}]});})['then'](handleEntityNotFound(_0x2b5449,null))[_0xfc30('0x19')](function(_0x40881b){if(_0x40881b&&_0x40881b['List']){_0xc1c6e7=_0x40881b;var _0x4cca52=_[_0xfc30('0xb7')](_0x24a6f7[_0xfc30('0x66')],{'firstName':_0x24a6f7['body'][_0xfc30('0x9a')],'phone':_0x24a6f7[_0xfc30('0x66')]['from'],'ListId':_0x40881b[_0xfc30('0xb6')]});_0x4cca52[_0x24a6f7[_0xfc30('0x66')][_0xfc30('0xde')]]=_0x24a6f7[_0xfc30('0x66')][_0xfc30('0x9a')];return db[_0xfc30('0xa0')][_0xfc30('0xe1')]({'where':_0x16a2d5,'defaults':_0x4cca52});}})['spread'](function(_0x9b9303){if(_0x9b9303){_0x103296=_0x9b9303;var _0x269cec=fs[_0xfc30('0xe2')](path['join'](config[_0xfc30('0x85')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x92203=ejs[_0xfc30('0xe3')](_0x269cec,{'body':_[_0xfc30('0xe4')](_0x24a6f7['body'][_0xfc30('0x66')]),'bodyTitle':_0xc1c6e7[_0xfc30('0xe5')]});return db[_0xfc30('0xe6')][_0xfc30('0x63')]({'body':_0x92203,'plainBody':htmlToText[_0xfc30('0xe7')](_0x92203),'ContactId':_0x9b9303['id'],'ChatWebsiteId':_0xc1c6e7['id']});}})[_0xfc30('0x19')](function(_0x108916){_0x143221=_0x108916;if(_0x1268f4[_0xfc30('0x52')]){var _0x376d70=_0x1268f4[_0xfc30('0x49')](function(_0x2a41c7){return{'name':_0x2a41c7[_0xfc30('0xe8')],'basename':_0x2a41c7[_0xfc30('0x80')],'type':_0x2a41c7[_0xfc30('0xe9')],'ChatOfflineMessageId':_0x108916['id']};});_0x240466=_0x376d70[_0xfc30('0x49')](_0x42a055=>{var _0x3ef026={'filename':_0x42a055[_0xfc30('0x31')],'path':path[_0xfc30('0x84')](config['root'],_0xfc30('0xea'),_0xfc30('0xd8'),_0xfc30('0xeb'),_0xfc30('0xec'),_0x42a055[_0xfc30('0xed')])};return _0x3ef026;});if(!_0xc1c6e7[_0xfc30('0xee')]){return db[_0xfc30('0xef')][_0xfc30('0xf0')](function(_0x1ad45d){return db[_0xfc30('0xf1')][_0xfc30('0xf2')](_0x376d70,{'transaction':_0x1ad45d});});}}})[_0xfc30('0x19')](function(){if(_0x143221){_0x3038a1=_0x143221;return db['MailAccount'][_0xfc30('0x72')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xfc30('0xf3'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xfc30('0xf4'),'raw':!![]}]}]});}})['then'](function(_0x48f72c){if(_0x48f72c&&_0x48f72c['Smtp']&&_0xc1c6e7['forwardOffline']&&_0xc1c6e7['forwardOfflineAddress']){var _0x43e422=_0x48f72c[_0xfc30('0xf5')]();return respondWithRpcPromise('SendMail',_0xfc30('0xf6'),{'account':_0x43e422,'message':{'from':util[_0xfc30('0x3e')](_0xfc30('0xf7'),_0x48f72c[_0xfc30('0x31')],_0x48f72c['email']||_0x48f72c[_0xfc30('0xf3')][_0xfc30('0x68')]),'to':_0xc1c6e7['forwardOfflineAddress'],'subject':_0xc1c6e7[_0xfc30('0xf8')],'html':_0x3038a1['body'],'attachments':_0x240466}},client9003)[_0xfc30('0x19')](function(){return _0x3038a1;})['catch'](function(_0x39544a){logger[_0xfc30('0x20')](_0x39544a);});}})[_0xfc30('0x19')](function(){if(_0xc1c6e7&&_0xc1c6e7[_0xfc30('0xee')]&&_0xc1c6e7['MailAccountId']){var _0x2a7c37=[];if(_0x1268f4['length']){_0x2a7c37=_0x1268f4[_0xfc30('0x49')](function(_0x54a6d5){return{'name':_0x54a6d5[_0xfc30('0xe8')],'basename':_0x54a6d5['filename'],'type':_0x54a6d5[_0xfc30('0xe9')],'ChatOfflineMessageId':_0x143221['id']};});}var _0x473a01;if(!_['isNil'](_0xc1c6e7['subjectOffline'])){var _0x508b31=_[_0xfc30('0x49')](_0x24a6f7[_0xfc30('0x66')],function(_0x5278fc){return _0x5278fc;});var _0x4b7128=_[_0xfc30('0xf9')](_0x508b31)[0x0];var _0x186dea=_[_0xfc30('0xfa')](_0x4b7128,function(_0xe19826){return _0xe19826;});_0x473a01=_0x186dea[0x1][_0xc1c6e7['subjectOffline']];}var _0x286608={'from':_0x103296[_0xfc30('0xfb')],'firstName':_0x103296[_0xfc30('0xfc')],'lastName':_0x103296[_0xfc30('0x39')],'mapKey':_0xfc30('0xfb'),'message':{'from':_0x103296['email'],'to':_0xc1c6e7[_0xfc30('0xe0')][_0xfc30('0xfb')],'cc':'','subject':_[_0xfc30('0x89')](_0x473a01)?_0xc1c6e7[_0xfc30('0xf8')]:_0x473a01,'messageId':'','sentAt':new Date(),'attach':_0x2a7c37[_0xfc30('0x52')],'attachments':_0x2a7c37,'originChannel':_0xfc30('0xfd'),'ChatWebsiteId':_0xc1c6e7['id'],'ChatOfflineMessageId':_0x3038a1['id'],'originTo':_0xc1c6e7[_0xfc30('0xe0')][_0xfc30('0xfb')]},'body':_0x3038a1[_0xfc30('0x66')]};var _0x46377a={'account':{'id':_0xc1c6e7[_0xfc30('0xfe')]},'body':_0x286608,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xfc30('0xff'),'notifyMail',_0x46377a,client9001)[_0xfc30('0x19')](function(){return _0x3038a1;})[_0xfc30('0x23')](function(_0x2285ab){logger[_0xfc30('0x20')](_0x2285ab);});}return;})[_0xfc30('0x19')](function(){if(_0x3038a1){return _0x3038a1;}})['then'](respondWithResult(_0x2b5449,null))[_0xfc30('0x23')](function(){for(var _0x11bbc3 of _0x1268f4){var _0x3e084b=path[_0xfc30('0x84')](config[_0xfc30('0x85')],_0xfc30('0xea'),_0xfc30('0xd8'),_0xfc30('0xeb'),_0xfc30('0xec'),_0x11bbc3[_0xfc30('0x80')]);fs_extra[_0xfc30('0x100')](_0x3e084b)[_0xfc30('0x23')](function(_0x4da83d){logger[_0xfc30('0x20')]('Could\x20not\x20remove\x20attachment\x20file',_0x3e084b,_0x4da83d);});}});};exports['addInteraction']=function(_0x329863,_0xfe439b){return db[_0xfc30('0xbc')][_0xfc30('0x62')]({'where':{'id':_0x329863[_0xfc30('0x61')]['id']}})['then'](handleEntityNotFound(_0xfe439b,null))['then'](function(_0x4a7570){if(_0x4a7570){return _0x4a7570['addInteraction'](_0x329863['body'][_0xfc30('0x76')],_[_0xfc30('0x101')](_0x329863[_0xfc30('0x66')],[_0xfc30('0x76'),'id'])||{});}})[_0xfc30('0x19')](respondWithResult(_0xfe439b,null))[_0xfc30('0x23')](handleError(_0xfe439b,null));};exports[_0xfc30('0x102')]=function(_0x14e589,_0x63b746){var _0x2c689c={'raw':![],'where':{}};var _0x48f797={};var _0x442966={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xfc30('0x72')]({'where':{'id':_0x14e589[_0xfc30('0x61')]['id']}})['then'](handleEntityNotFound(_0x63b746,null))['then'](function(_0x2d4f56){if(_0x2d4f56){_0x48f797[_0xfc30('0x42')]=_[_0xfc30('0x4e')](db['ChatInteraction'][_0xfc30('0x4b')]);_0x48f797['query']=_[_0xfc30('0x4e')](_0x14e589[_0xfc30('0x4d')]);_0x48f797[_0xfc30('0x58')]=_[_0xfc30('0x4f')](_0x48f797['model'],_0x48f797[_0xfc30('0x4d')]);_0x2c689c[_0xfc30('0x50')]=_[_0xfc30('0x4f')](_0x48f797['model'],qs['fields'](_0x14e589[_0xfc30('0x4d')][_0xfc30('0x51')]));_0x2c689c[_0xfc30('0x50')]=_0x2c689c[_0xfc30('0x50')][_0xfc30('0x52')]?_0x2c689c[_0xfc30('0x50')]:_0x48f797[_0xfc30('0x42')];if(!_0x14e589[_0xfc30('0x4d')]['hasOwnProperty']('nolimit')){_0x2c689c['limit']=qs[_0xfc30('0x29')](_0x14e589[_0xfc30('0x4d')][_0xfc30('0x29')]);_0x2c689c[_0xfc30('0x2b')]=qs['offset'](_0x14e589[_0xfc30('0x4d')][_0xfc30('0x2b')]);}_0x2c689c[_0xfc30('0x54')]=qs[_0xfc30('0x55')](_0x14e589[_0xfc30('0x4d')][_0xfc30('0x55')]);_0x2c689c[_0xfc30('0x56')]=qs[_0xfc30('0x58')](_[_0xfc30('0x57')](_0x14e589[_0xfc30('0x4d')],_0x48f797[_0xfc30('0x58')]));_0x2c689c[_0xfc30('0x56')][_0xfc30('0x70')]=_0x2d4f56['id'];if(_0x14e589[_0xfc30('0x4d')]['filter']){_0x2c689c[_0xfc30('0x56')]=_['merge'](_0x2c689c[_0xfc30('0x56')],{'$or':_[_0xfc30('0x49')](_0x2c689c[_0xfc30('0x50')],function(_0x21b87e){var _0x1c0b20={};_0x1c0b20[_0x21b87e]={'$like':'%'+_0x14e589['query'][_0xfc30('0x5a')]+'%'};return _0x1c0b20;})});}_0x2c689c=_['merge']({},_0x2c689c,_0x14e589[_0xfc30('0x5b')]);return db[_0xfc30('0xbc')][_0xfc30('0x2a')]({'where':_0x2c689c[_0xfc30('0x56')]})['then'](function(_0x1918f7){_0x442966[_0xfc30('0x2a')]=_0x1918f7;if(_0x14e589['query'][_0xfc30('0x5c')]){_0x2c689c[_0xfc30('0x5d')]=[{'model':db['CmContact'],'as':_0xfc30('0x103'),'required':![]},{'model':db[_0xfc30('0xcb')],'as':'Owner','attributes':[_0xfc30('0x31'),_0xfc30('0x104'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xfc30('0x31'),_0xfc30('0x105')],'where':_0x14e589['query'][_0xfc30('0x106')]?{'id':_0x14e589[_0xfc30('0x4d')][_0xfc30('0x106')]}:undefined,'required':_0x14e589['query'][_0xfc30('0x106')]?!![]:![]}];}return db['ChatInteraction'][_0xfc30('0x5e')](_0x2c689c);})[_0xfc30('0x19')](function(_0x5aa9f5){_0x442966[_0xfc30('0x5f')]=_0x5aa9f5;return _0x442966;});}})[_0xfc30('0x19')](respondWithFilteredResult(_0x63b746,_0x2c689c))['catch'](handleError(_0x63b746,null));};exports[_0xfc30('0x107')]=function(_0x4097fc,_0xfe7bc2){var _0x14d5b3=0x0;var _0x56786e=0x0;var _0x20f1d1=![];var _0x3fa802;var _0x5d93d9;return db['ChatWebsite'][_0xfc30('0x62')]({'where':{'id':_0x4097fc[_0xfc30('0x61')]['id']},'include':[{'model':db[_0xfc30('0x95')],'as':'Interval','include':[{'model':db[_0xfc30('0x95')],'as':'Intervals','attributes':['id','interval']}]}]})[_0xfc30('0x19')](handleEntityNotFound(_0xfe7bc2,null))[_0xfc30('0x19')](function(_0x56882a){if(_0x56882a){_0x3fa802=_0x56882a;return _0x56882a['getProactiveActions']({'raw':!![]});}})['then'](function(_0x530108){if(_0x3fa802){if(_0x530108){_0x5d93d9=_0x530108;}}return require(_0xfc30('0x108'))['getLicense']();})[_0xfc30('0x19')](function(_0x198ae7){if(_0x198ae7){_0x56786e=_0x198ae7[_0xfc30('0x109')];_0x20f1d1=_0x198ae7[_0xfc30('0x88')];}})[_0xfc30('0x19')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x5971fd){_0x14d5b3=_0x5971fd;if(_0x56786e&&_0x5971fd>_0x56786e){return db[_0xfc30('0x10a')][_0xfc30('0x72')]({'where':{'id':0x1}})[_0xfc30('0x19')](function(_0x49c078){if(_0x49c078){_0x49c078['increment'](_0xfc30('0x10b'));}});}})['then'](function(){var _0x8701f4=_0x3fa802[_0xfc30('0x95')];var _0x56f61f=_0x3fa802[_0xfc30('0x97')]||undefined;return _0x8701f4?_0x8701f4[_0xfc30('0x98')](_0x56f61f):!![];})[_0xfc30('0x19')](function(_0x4bdef5){var _0xccc47=fs[_0xfc30('0xe2')](path[_0xfc30('0x84')](config['root'],'server/files/chat/iframe.ejs'),_0xfc30('0x10c'));var _0x5ce529=_0xfc30('0x10d');var _0x74e72f=![];try{const _0x4c261d=new URL(_0x3fa802[_0xfc30('0x65')]);_0x3fa802[_0xfc30('0x65')]=_0x4c261d[_0xfc30('0x10e')];}catch(_0x2b8d21){}var _0xde49d0;if(_0x4097fc[_0xfc30('0xb9')][_0xfc30('0x3b')]){_0x4097fc[_0xfc30('0xb9')][_0xfc30('0x3b')]=_0x4097fc['headers'][_0xfc30('0x3b')][_0xfc30('0x10f')](/\/$/,'');_0xde49d0=wildcardUtils[_0xfc30('0x110')](_0x3fa802[_0xfc30('0x65')],_0x4097fc['headers'][_0xfc30('0x3b')]);}else{_0x4097fc[_0xfc30('0xb9')][_0xfc30('0x3b')]=_0x3fa802[_0xfc30('0x65')];_0xde49d0=!![];}var _0x5ef957={'chatVersion':_0x5ce529,'chatWebsiteAddressOrigin':_0xde49d0?_0x4097fc[_0xfc30('0xb9')]['referer']:_0x3fa802[_0xfc30('0x65')],'remote':_0x3fa802['remote'],'query':querystring[_0xfc30('0x1f')](_['merge'](_0x3fa802[_0xfc30('0x2e')]({'plain':!![]}),{'customerIp':_0x4097fc[_0xfc30('0xb9')][_0xfc30('0x38')]||_0x4097fc[_0xfc30('0xb9')]['x-real-ip']||_0x4097fc['connection'][_0xfc30('0x111')]||_0x4097fc['ip'],'referer':_0x4097fc[_0xfc30('0xb9')][_0xfc30('0x3b')],'openedInteractions':_0x14d5b3,'maxInteractions':_0x56786e,'virtual':_0x20f1d1[_0xfc30('0x109')],'online':_0x4bdef5,'custom':_0x20f1d1,'address':_0xde49d0?_0x4097fc[_0xfc30('0xb9')]['referer']:null}))[_0xfc30('0x10f')](/'/g,'\x5c\x27')};_0xfe7bc2[_0xfc30('0x32')](ejs[_0xfc30('0xe3')](Mustache['render'](_0xccc47,_0x5ef957),{'proactiveActions':_0x5d93d9,'alignment':_0x3fa802[_0xfc30('0x112')],'verticalAlignment':_0x3fa802[_0xfc30('0x113')],'div_color':_0x3fa802[_0xfc30('0x105')],'labelText':_0x3fa802[_0xfc30('0x114')],'text_color':_0x3fa802[_0xfc30('0x115')],'text_button_color':_0x3fa802[_0xfc30('0x116')],'button_color':_0x3fa802[_0xfc30('0x117')],'background_color':_0x3fa802['backgroundColor'],'hideWhenOffline':_0x3fa802['hideWhenOffline'],'intervalId':_0x3fa802['IntervalId'],'isDevelopment':_0x74e72f,'chatVersion':_0x5ce529}));})[_0xfc30('0x23')](handleError(_0xfe7bc2,null));};exports['addApplications']=function(_0xd32274,_0x4aa431){var _0x2f0958=_0xd32274[_0xfc30('0x61')]['id'];var _0x493361=_0xd32274[_0xfc30('0x66')];var _0x11caa2=0xc8;var _0x11d220=null;return db[_0xfc30('0xef')][_0xfc30('0xf0')]({'isolationLevel':db[_0xfc30('0xef')]['Transaction'][_0xfc30('0x118')]['READ_COMMITTED']},function(_0x5a0661){return db[_0xfc30('0x4a')][_0xfc30('0x72')]({'where':{'id':_0x2f0958},'transaction':_0x5a0661})[_0xfc30('0x19')](function(_0x59aa06){if(_0x59aa06){return db[_0xfc30('0x119')][_0xfc30('0x2d')]({'where':{'ChatWebsiteId':_0x2f0958},'transaction':_0x5a0661})[_0xfc30('0x19')](function(){var _0x23851b=_['map'](_0x493361,function(_0x3435eb){_0x3435eb[_0xfc30('0x70')]=_0x2f0958;return _0x3435eb;});return db['ChatApplication'][_0xfc30('0xf2')](_0x23851b,{'transaction':_0x5a0661});});}else{_0x11caa2=0x194;_0x11d220=[];}});})[_0xfc30('0x19')](function(){if(_0x11caa2!==0x194){return db[_0xfc30('0x119')][_0xfc30('0x11a')]({'where':{'ChatWebsiteId':_0x2f0958},'order':_0xfc30('0xb3')})[_0xfc30('0x19')](function(_0x5035df){_0x11d220=_0x5035df;});}})[_0xfc30('0x23')](function(_0x21e58b){_0x11caa2=0x1f4;logger[_0xfc30('0x20')](_0x21e58b[_0xfc30('0x11b')]);if(_0x21e58b['name']){delete _0x21e58b[_0xfc30('0x31')];}_0x11d220=_0x21e58b;})[_0xfc30('0x11c')](function(){if(_0x11d220===null){_0x4aa431[_0xfc30('0x24')](_0x11caa2);}else{if(_0x11caa2===0x1f4){_0x4aa431[_0xfc30('0x26')](_0x11caa2)[_0xfc30('0x32')](_0x11d220);}else{_0x4aa431['status'](_0x11caa2)[_0xfc30('0x27')](_0x11d220);}}});};exports['getApplications']=function(_0x3391ef,_0x17800b){var _0x56be3a={};var _0x357c09={};var _0x25348c;var _0x3e1283;return db['ChatWebsite'][_0xfc30('0x72')]({'where':{'id':_0x3391ef[_0xfc30('0x61')]['id']}})[_0xfc30('0x19')](handleEntityNotFound(_0x17800b,null))['then'](function(_0x432169){if(_0x432169){_0x25348c=_0x432169;_0x357c09[_0xfc30('0x42')]=_[_0xfc30('0x4e')](db[_0xfc30('0x119')][_0xfc30('0x4b')]);_0x357c09['query']=_[_0xfc30('0x4e')](_0x3391ef[_0xfc30('0x4d')]);_0x357c09[_0xfc30('0x58')]=_[_0xfc30('0x4f')](_0x357c09['model'],_0x357c09['query']);_0x56be3a[_0xfc30('0x50')]=_['intersection'](_0x357c09[_0xfc30('0x42')],qs[_0xfc30('0x51')](_0x3391ef['query']['fields']));_0x56be3a[_0xfc30('0x50')]=_0x56be3a['attributes'][_0xfc30('0x52')]?_0x56be3a['attributes']:_0x357c09[_0xfc30('0x42')];_0x56be3a['order']=qs[_0xfc30('0x55')](_0x3391ef['query']['sort']);_0x56be3a[_0xfc30('0x56')]=qs['filters'](_[_0xfc30('0x57')](_0x3391ef['query'],_0x357c09[_0xfc30('0x58')]));if(_0x3391ef[_0xfc30('0x4d')][_0xfc30('0x5a')]){_0x56be3a[_0xfc30('0x56')]=_[_0xfc30('0x59')](_0x56be3a['where'],{'$or':_[_0xfc30('0x49')](_0x56be3a['attributes'],function(_0x1e63dd){var _0x7242da={};_0x7242da[_0x1e63dd]={'$like':'%'+_0x3391ef[_0xfc30('0x4d')]['filter']+'%'};return _0x7242da;})});}_0x56be3a=_['merge']({},_0x56be3a,_0x3391ef[_0xfc30('0x5b')]);return _0x25348c[_0xfc30('0x11d')](_0x56be3a);}})[_0xfc30('0x19')](function(_0x3526c9){if(_0x3526c9){_0x3e1283=_0x3526c9['length'];if(!_0x3391ef[_0xfc30('0x4d')]['hasOwnProperty'](_0xfc30('0x73'))){_0x56be3a[_0xfc30('0x29')]=qs['limit'](_0x3391ef[_0xfc30('0x4d')][_0xfc30('0x29')]);_0x56be3a['offset']=qs['offset'](_0x3391ef[_0xfc30('0x4d')][_0xfc30('0x2b')]);}return _0x25348c[_0xfc30('0x11d')](_0x56be3a);}})[_0xfc30('0x19')](function(_0x4cd855){if(_0x4cd855){return _0x4cd855?{'count':_0x3e1283,'rows':_0x4cd855}:null;}})[_0xfc30('0x19')](respondWithResult(_0x17800b,null))[_0xfc30('0x23')](handleError(_0x17800b,null));};exports[_0xfc30('0x11e')]=function(_0x1119e8,_0x2d72b6){return db[_0xfc30('0x11f')][_0xfc30('0x62')]({'where':{'id':_0x1119e8['params']['id']}})[_0xfc30('0x19')](handleEntityNotFound(_0x2d72b6,null))[_0xfc30('0x19')](function(_0x1112a7){if(_0x1112a7){return _0x1112a7[_0xfc30('0x11e')](_0x1119e8['body'][_0xfc30('0x76')],_[_0xfc30('0x101')](_0x1119e8[_0xfc30('0x66')],[_0xfc30('0x76'),'id'])||{});}})[_0xfc30('0x19')](respondWithResult(_0x2d72b6,null))['catch'](handleError(_0x2d72b6,null));};exports['getProactiveActions']=function(_0x5d1286,_0x2fc363){var _0x355022={};var _0x495cae={};var _0x214d9e;var _0x505c63;return db[_0xfc30('0x4a')][_0xfc30('0x72')]({'where':{'id':_0x5d1286['params']['id']}})[_0xfc30('0x19')](handleEntityNotFound(_0x2fc363,null))[_0xfc30('0x19')](function(_0x413e95){if(_0x413e95){_0x214d9e=_0x413e95;_0x495cae[_0xfc30('0x42')]=_[_0xfc30('0x4e')](db[_0xfc30('0x120')][_0xfc30('0x4b')]);_0x495cae[_0xfc30('0x4d')]=_[_0xfc30('0x4e')](_0x5d1286['query']);_0x495cae[_0xfc30('0x58')]=_[_0xfc30('0x4f')](_0x495cae[_0xfc30('0x42')],_0x495cae[_0xfc30('0x4d')]);_0x355022[_0xfc30('0x50')]=_[_0xfc30('0x4f')](_0x495cae[_0xfc30('0x42')],qs[_0xfc30('0x51')](_0x5d1286['query'][_0xfc30('0x51')]));_0x355022[_0xfc30('0x50')]=_0x355022[_0xfc30('0x50')][_0xfc30('0x52')]?_0x355022[_0xfc30('0x50')]:_0x495cae[_0xfc30('0x42')];_0x355022[_0xfc30('0x54')]=qs[_0xfc30('0x55')](_0x5d1286[_0xfc30('0x4d')][_0xfc30('0x55')]);_0x355022[_0xfc30('0x56')]=qs['filters'](_[_0xfc30('0x57')](_0x5d1286['query'],_0x495cae['filters']));if(_0x5d1286['query'][_0xfc30('0x5a')]){_0x355022['where']=_['merge'](_0x355022[_0xfc30('0x56')],{'$or':_[_0xfc30('0x49')](_0x355022['attributes'],function(_0x18efb5){var _0x1d3700={};_0x1d3700[_0x18efb5]={'$like':'%'+_0x5d1286[_0xfc30('0x4d')][_0xfc30('0x5a')]+'%'};return _0x1d3700;})});}_0x355022=_[_0xfc30('0x59')]({},_0x355022,_0x5d1286['options']);return _0x214d9e[_0xfc30('0x121')](_0x355022);}})[_0xfc30('0x19')](function(_0x3f1210){if(_0x3f1210){_0x505c63=_0x3f1210[_0xfc30('0x52')];if(!_0x5d1286[_0xfc30('0x4d')][_0xfc30('0x53')](_0xfc30('0x73'))){_0x355022['limit']=qs[_0xfc30('0x29')](_0x5d1286[_0xfc30('0x4d')]['limit']);_0x355022[_0xfc30('0x2b')]=qs[_0xfc30('0x2b')](_0x5d1286[_0xfc30('0x4d')][_0xfc30('0x2b')]);}return _0x214d9e[_0xfc30('0x121')](_0x355022);}})['then'](function(_0x35b9b6){if(_0x35b9b6){return _0x35b9b6?{'count':_0x505c63,'rows':_0x35b9b6}:null;}})[_0xfc30('0x19')](respondWithResult(_0x2fc363,null))[_0xfc30('0x23')](handleError(_0x2fc363,null));};exports[_0xfc30('0x122')]=function(_0x39e0ff,_0x53a976){var _0x24fff6=_0x39e0ff[_0xfc30('0x4d')][_0xfc30('0x123')]===_0xfc30('0x124')?'offlineForm':'onlineForm';return db[_0xfc30('0x4a')][_0xfc30('0x62')]({'attributes':['id',_0x24fff6],'where':{'id':_0x39e0ff[_0xfc30('0x61')]['id']}})['then'](handleEntityNotFound(_0x53a976,null))[_0xfc30('0x19')](function(_0x8a14b1){if(_0x8a14b1){var _0x14e69e=_0x8a14b1[_0x24fff6];var _0x4fd953=_0x14e69e&&_0x14e69e[_0xfc30('0x125')]?_0x14e69e[_0xfc30('0x125')]:[];_0x53a976[_0xfc30('0x32')]({'fromKey':_['isNil'](_0x14e69e[_0xfc30('0x126')])?undefined:_0x14e69e[_0xfc30('0x126')],'count':_0x4fd953[_0xfc30('0x52')],'rows':_0x4fd953});}})[_0xfc30('0x23')](handleError(_0x53a976,null));};exports[_0xfc30('0x127')]=function(_0x2d18a8,_0x21f301){var _0x1359ba={'raw':![],'where':{}};var _0x2e48b8={};var _0x4c92e9={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x2d18a8[_0xfc30('0x61')]['id']}})[_0xfc30('0x19')](handleEntityNotFound(_0x21f301,null))[_0xfc30('0x19')](function(_0x27ecdb){if(_0x27ecdb){_0x2e48b8['model']=_[_0xfc30('0x4e')](db['ChatOfflineMessage'][_0xfc30('0x4b')]);_0x2e48b8[_0xfc30('0x4d')]=_['keys'](_0x2d18a8[_0xfc30('0x4d')]);_0x2e48b8['filters']=_[_0xfc30('0x4f')](_0x2e48b8[_0xfc30('0x42')],_0x2e48b8['query']);_0x1359ba['attributes']=_[_0xfc30('0x4f')](_0x2e48b8[_0xfc30('0x42')],qs[_0xfc30('0x51')](_0x2d18a8[_0xfc30('0x4d')][_0xfc30('0x51')]));_0x1359ba[_0xfc30('0x50')]=_0x1359ba[_0xfc30('0x50')][_0xfc30('0x52')]?_0x1359ba[_0xfc30('0x50')]:_0x2e48b8[_0xfc30('0x42')];if(!_0x2d18a8[_0xfc30('0x4d')][_0xfc30('0x53')](_0xfc30('0x73'))){_0x1359ba[_0xfc30('0x29')]=qs['limit'](_0x2d18a8[_0xfc30('0x4d')][_0xfc30('0x29')]);_0x1359ba['offset']=qs[_0xfc30('0x2b')](_0x2d18a8[_0xfc30('0x4d')][_0xfc30('0x2b')]);}_0x1359ba[_0xfc30('0x54')]=qs['sort'](_0x2d18a8[_0xfc30('0x4d')][_0xfc30('0x55')]);_0x1359ba[_0xfc30('0x56')]=qs[_0xfc30('0x58')](_[_0xfc30('0x57')](_0x2d18a8[_0xfc30('0x4d')],_0x2e48b8['filters']));_0x1359ba[_0xfc30('0x56')][_0xfc30('0x70')]=_0x27ecdb['id'];if(_0x2d18a8[_0xfc30('0x4d')][_0xfc30('0x5a')]){_0x1359ba[_0xfc30('0x56')]=_[_0xfc30('0x59')](_0x1359ba[_0xfc30('0x56')],{'$or':_[_0xfc30('0x49')](_0x1359ba['attributes'],function(_0x3a695c){var _0x2fa611={};_0x2fa611[_0x3a695c]={'$like':'%'+_0x2d18a8[_0xfc30('0x4d')][_0xfc30('0x5a')]+'%'};return _0x2fa611;})});}_0x1359ba=_[_0xfc30('0x59')]({},_0x1359ba,_0x2d18a8['options']);return db[_0xfc30('0xe6')][_0xfc30('0x2a')]({'where':_0x1359ba[_0xfc30('0x56')]})['then'](function(_0x2bd1e6){_0x4c92e9[_0xfc30('0x2a')]=_0x2bd1e6;if(_0x2d18a8['query'][_0xfc30('0x5c')]){_0x1359ba[_0xfc30('0x5d')]=[{'all':!![]}];}else{_0x1359ba[_0xfc30('0x5d')]=[{'model':db[_0xfc30('0xa0')],'as':_0xfc30('0x103'),'required':![]},{'model':db['Attachment'],'as':_0xfc30('0x128'),'required':![]}];}return db[_0xfc30('0xe6')][_0xfc30('0x5e')](_0x1359ba);})['then'](function(_0x3d1ca4){_0x4c92e9[_0xfc30('0x5f')]=_0x3d1ca4;return _0x4c92e9;});}})[_0xfc30('0x19')](respondWithFilteredResult(_0x21f301,_0x1359ba))[_0xfc30('0x23')](handleError(_0x21f301,null));};exports[_0xfc30('0x129')]=function(_0x25551f,_0x27c2cb){return db[_0xfc30('0x4a')][_0xfc30('0x62')]({'where':{'id':_0x25551f[_0xfc30('0x61')]['id']}})[_0xfc30('0x19')](handleEntityNotFound(_0x27c2cb,null))[_0xfc30('0x19')](function(_0x18662a){if(_0x18662a){return _0x18662a[_0xfc30('0x129')](_0x25551f['body'][_0xfc30('0x76')],_[_0xfc30('0x101')](_0x25551f['body'],[_0xfc30('0x76'),'id'])||{})['spread'](function(_0x5eb9b9){for(var _0x1267b7=0x0;_0x1267b7<_0x25551f[_0xfc30('0x66')]['ids'][_0xfc30('0x52')];_0x1267b7+=0x1){socket[_0xfc30('0x12a')](_0xfc30('0x12b'),{'UserId':Number(_0x25551f[_0xfc30('0x66')][_0xfc30('0x76')][_0x1267b7]),'ChatWebsiteId':Number(_0x25551f[_0xfc30('0x61')]['id'])});}return _0x5eb9b9;});}})[_0xfc30('0x19')](respondWithResult(_0x27c2cb,null))[_0xfc30('0x23')](handleError(_0x27c2cb,null));};exports[_0xfc30('0x12c')]=function(_0x7a2fd1,_0x383db9){return db[_0xfc30('0x4a')][_0xfc30('0x62')]({'where':{'id':_0x7a2fd1[_0xfc30('0x61')]['id']}})['then'](handleEntityNotFound(_0x383db9,null))['then'](function(_0x3b3a3c){if(_0x3b3a3c){return _0x3b3a3c['removeAgents'](_0x7a2fd1[_0xfc30('0x4d')]['ids'])[_0xfc30('0x19')](function(){if(_['isArray'](_0x7a2fd1[_0xfc30('0x4d')]['ids'])){for(var _0x5baa80=0x0;_0x5baa80<_0x7a2fd1[_0xfc30('0x4d')]['ids'][_0xfc30('0x52')];_0x5baa80+=0x1){socket[_0xfc30('0x12a')](_0xfc30('0x12d'),{'UserId':Number(_0x7a2fd1[_0xfc30('0x4d')][_0xfc30('0x76')][_0x5baa80]),'ChatWebsiteId':Number(_0x7a2fd1[_0xfc30('0x61')]['id'])});}}else{socket[_0xfc30('0x12a')](_0xfc30('0x12d'),{'UserId':Number(_0x7a2fd1['query'][_0xfc30('0x76')]),'ChatWebsiteId':Number(_0x7a2fd1[_0xfc30('0x61')]['id'])});}});}})[_0xfc30('0x19')](respondWithStatusCode(_0x383db9,null))[_0xfc30('0x23')](handleError(_0x383db9,null));};exports[_0xfc30('0x12e')]=function(_0x66f37d,_0x5bc155){var _0xdbee4b={};var _0x22c9f7={};var _0x1a6c55;var _0x73a15e;return db['ChatWebsite']['findOne']({'where':{'id':_0x66f37d['params']['id']}})['then'](handleEntityNotFound(_0x5bc155,null))[_0xfc30('0x19')](function(_0x27d6ca){if(_0x27d6ca){_0x1a6c55=_0x27d6ca;_0x22c9f7[_0xfc30('0x42')]=_[_0xfc30('0x4e')](db[_0xfc30('0xcb')][_0xfc30('0x4b')]);_0x22c9f7[_0xfc30('0x4d')]=_[_0xfc30('0x4e')](_0x66f37d[_0xfc30('0x4d')]);_0x22c9f7[_0xfc30('0x58')]=_['intersection'](_0x22c9f7[_0xfc30('0x42')],_0x22c9f7['query']);_0xdbee4b[_0xfc30('0x50')]=_['intersection'](_0x22c9f7['model'],qs[_0xfc30('0x51')](_0x66f37d['query'][_0xfc30('0x51')]));_0xdbee4b[_0xfc30('0x50')]=_0xdbee4b[_0xfc30('0x50')][_0xfc30('0x52')]?_0xdbee4b['attributes']:_0x22c9f7['model'];_0xdbee4b[_0xfc30('0x54')]=qs[_0xfc30('0x55')](_0x66f37d['query'][_0xfc30('0x55')]);_0xdbee4b[_0xfc30('0x56')]=qs[_0xfc30('0x58')](_[_0xfc30('0x57')](_0x66f37d[_0xfc30('0x4d')],_0x22c9f7[_0xfc30('0x58')]));if(_0x66f37d[_0xfc30('0x4d')][_0xfc30('0x5a')]){_0xdbee4b[_0xfc30('0x56')]=_[_0xfc30('0x59')](_0xdbee4b[_0xfc30('0x56')],{'$or':_[_0xfc30('0x49')](_0xdbee4b['attributes'],function(_0x2f4379){var _0x55aeae={};_0x55aeae[_0x2f4379]={'$like':'%'+_0x66f37d['query'][_0xfc30('0x5a')]+'%'};return _0x55aeae;})});}_0xdbee4b=_[_0xfc30('0x59')]({},_0xdbee4b,_0x66f37d[_0xfc30('0x5b')]);return _0x1a6c55[_0xfc30('0x12e')](_0xdbee4b);}})[_0xfc30('0x19')](function(_0x24a208){if(_0x24a208){_0x73a15e=_0x24a208['length'];if(!_0x66f37d[_0xfc30('0x4d')][_0xfc30('0x53')](_0xfc30('0x73'))){_0xdbee4b[_0xfc30('0x29')]=qs[_0xfc30('0x29')](_0x66f37d['query'][_0xfc30('0x29')]);_0xdbee4b[_0xfc30('0x2b')]=qs[_0xfc30('0x2b')](_0x66f37d[_0xfc30('0x4d')][_0xfc30('0x2b')]);}return _0x1a6c55['getAgents'](_0xdbee4b);}})[_0xfc30('0x19')](function(_0x122204){if(_0x122204){return _0x122204?{'count':_0x73a15e,'rows':_0x122204}:null;}})[_0xfc30('0x19')](respondWithResult(_0x5bc155,null))['catch'](handleError(_0x5bc155,null));}; \ No newline at end of file +var _0xf0dc=['request\x20sent','error','code','message','result','catch','status','json','offset','undefined','limit','set','Content-Range','update','ChatWebsites','UserProfileResource','destroy','end','sendStatus','stack','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','stringify','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','keys','find','create','body','address','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','params','describe','ChatWebsiteId','Disposition','findOne','rawAttributes','hasOwnProperty','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','resolve','timezone','ifTime','notify','chat','from','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','referer','No\x20available\x20attributes','updatedAt','includes','createdAt','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmContact','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','interval','account','applications','orderBy','priority','asc','list','List','contact','headers','threadId','ChatInteraction','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','Start','startRouting','offline','files','Sequelize','no\x20available\x20attributes','difference','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','utf8','render','fromString','originalname','mimetype','attachments','offline-chat','basename','sequelize','Attachment','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','email','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','nolimit','Contact','Owner','fullname','Tag','color','tag','getSnippet','getProactiveActions','chatLicenseExceeded','3.8.1','origin','replace','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','textButtonColor','hideWhenOffline','IntervalId','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','mustache','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','handleError','url','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0xf0dc,0x117));var _0xcf0d=function(_0x2fd36d,_0x1fb9d9){_0x2fd36d=_0x2fd36d-0x0;var _0xaab02d=_0xf0dc[_0x2fd36d];return _0xaab02d;};'use strict';var Mustache=require(_0xcf0d('0x0'));var util=require('util');var path=require('path');var ejs=require(_0xcf0d('0x1'));var fs=require('fs');var fs_extra=require(_0xcf0d('0x2'));var _=require(_0xcf0d('0x3'));var querystring=require(_0xcf0d('0x4'));var htmlToText=require(_0xcf0d('0x5'));var Redis=require(_0xcf0d('0x6'));var jayson=require('jayson/promise');var qs=require(_0xcf0d('0x7'));var logger=require('../../config/logger')(_0xcf0d('0x8'));var config=require(_0xcf0d('0x9'));var APIBadRequestError=require(_0xcf0d('0xa'))[_0xcf0d('0xb')];var APINotFoundError=require(_0xcf0d('0xa'))[_0xcf0d('0xc')];var APIOutOfIntervalError=require('../../errors/api')['APIOutOfIntervalError'];var APIHandleError=require('../../errors/api')[_0xcf0d('0xd')];var APIConflictError=require(_0xcf0d('0xa'))['APIConflictError'];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0xcf0d('0xe'))[_0xcf0d('0xf')];var db=require(_0xcf0d('0x10'))['db'];config['redis']=_[_0xcf0d('0x11')](config[_0xcf0d('0x12')],{'host':_0xcf0d('0x13'),'port':0x18eb});var socket=require(_0xcf0d('0x14'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xcf0d('0x15')](socket);var client=jayson[_0xcf0d('0x16')][_0xcf0d('0x17')]({'port':0x232c});var client9002=jayson[_0xcf0d('0x16')][_0xcf0d('0x17')]({'port':0x232a});var client9003=jayson[_0xcf0d('0x16')][_0xcf0d('0x17')]({'port':0x232b});var client9001=jayson['client'][_0xcf0d('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x14ba34,_0x1c8166,_0xcf319b,_0x5def2d){return new Promise(function(_0x371dfb,_0x512301){var _0x4b9b41=_0x5def2d||client;return _0x4b9b41[_0xcf0d('0x18')](_0x14ba34,_0xcf319b)[_0xcf0d('0x19')](function(_0x3b6a6a){logger[_0xcf0d('0x1a')](_0xcf0d('0x1b'),_0x1c8166,_0xcf0d('0x1c'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1c8166,_0xcf0d('0x1c'),JSON['stringify'](_0x3b6a6a));if(_0x3b6a6a[_0xcf0d('0x1d')]){if(_0x3b6a6a[_0xcf0d('0x1d')][_0xcf0d('0x1e')]===0x1f4){logger['error'](_0xcf0d('0x1b'),_0x1c8166,_0x3b6a6a[_0xcf0d('0x1d')][_0xcf0d('0x1f')]);return _0x512301(_0x3b6a6a['error'][_0xcf0d('0x1f')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1c8166,_0x3b6a6a['error'][_0xcf0d('0x1f')]);return _0x371dfb(_0x3b6a6a['error'][_0xcf0d('0x1f')]);}else{logger[_0xcf0d('0x1a')](_0xcf0d('0x1b'),_0x1c8166,_0xcf0d('0x1c'));_0x371dfb(_0x3b6a6a[_0xcf0d('0x20')]['message']);}})[_0xcf0d('0x21')](function(_0x32ef85){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1c8166,_0x32ef85);_0x512301(_0x32ef85);});});}function respondWithStatusCode(_0x3c30a4,_0x143801){_0x143801=_0x143801||0xcc;return function(_0x4d4d41){if(_0x4d4d41){return _0x3c30a4['sendStatus'](_0x143801);}return _0x3c30a4[_0xcf0d('0x22')](_0x143801)['end']();};}function respondWithResult(_0x4fcd39,_0x474e5f){_0x474e5f=_0x474e5f||0xc8;return function(_0x206831){if(_0x206831){return _0x4fcd39[_0xcf0d('0x22')](_0x474e5f)[_0xcf0d('0x23')](_0x206831);}};}function respondWithFilteredResult(_0x3790c4,_0x28f52b){return function(_0x2dc144){if(_0x2dc144){var _0x18871d=typeof _0x28f52b[_0xcf0d('0x24')]===_0xcf0d('0x25')&&typeof _0x28f52b[_0xcf0d('0x26')]===_0xcf0d('0x25');var _0x3a1dbb=_0x2dc144['count'];var _0x5e3cae=_0x18871d?0x0:_0x28f52b[_0xcf0d('0x24')];var _0x494706=_0x18871d?_0x2dc144['count']:_0x28f52b[_0xcf0d('0x24')]+_0x28f52b[_0xcf0d('0x26')];var _0x4d8fa8;if(_0x494706>=_0x3a1dbb){_0x494706=_0x3a1dbb;_0x4d8fa8=0xc8;}else{_0x4d8fa8=0xce;}_0x3790c4['status'](_0x4d8fa8);return _0x3790c4[_0xcf0d('0x27')](_0xcf0d('0x28'),_0x5e3cae+'-'+_0x494706+'/'+_0x3a1dbb)[_0xcf0d('0x23')](_0x2dc144);}return null;};}function saveUpdates(_0x1056fd){return function(_0x4e43ae){if(_0x4e43ae){return _0x4e43ae[_0xcf0d('0x29')](_0x1056fd)[_0xcf0d('0x19')](function(_0x4e4ef6){return _0x4e4ef6;});}return null;};}function removeEntity(_0x563e77){return function(_0x60e0ed){if(_0x60e0ed){return _0x60e0ed['destroy']()['then'](function(){var _0x2a9cc4=_0x60e0ed['get']({'plain':!![]});var _0x543997=_0xcf0d('0x2a');return db[_0xcf0d('0x2b')][_0xcf0d('0x2c')]({'where':{'type':_0x543997,'resourceId':_0x2a9cc4['id']}})[_0xcf0d('0x19')](function(){return _0x60e0ed;});})[_0xcf0d('0x19')](function(){_0x563e77['status'](0xcc)[_0xcf0d('0x2d')]();});}};}function handleEntityNotFound(_0x3469b1){return function(_0x57ccae){if(!_0x57ccae){_0x3469b1[_0xcf0d('0x2e')](0x194);}return _0x57ccae;};}function handleError(_0x2337ea,_0x2df287){_0x2df287=_0x2df287||0x1f4;return function(_0x2dbc27){logger['error'](_0x2dbc27[_0xcf0d('0x2f')]);if(_0x2dbc27['name']){delete _0x2dbc27[_0xcf0d('0x30')];}_0x2337ea[_0xcf0d('0x22')](_0x2df287)[_0xcf0d('0x31')](_0x2dbc27);};}function createInteractionObject(_0x34823d,_0x5e9955,_0x30fbed,_0x6ce1a9){var _0xe92ea8=require(_0xcf0d('0x32'));var _0x59bc3e=new _0xe92ea8();var _0x359b6b=_0x59bc3e[_0xcf0d('0x33')](_0x30fbed[_0xcf0d('0x34')])[_0xcf0d('0x35')]();var _0x415c32=_0x5e9955[_0xcf0d('0x36')];if(_0x30fbed[_0xcf0d('0x37')]){_0x415c32=_0x30fbed[_0xcf0d('0x37')];}else if(_0x30fbed['x-forwarded-for']){_0x415c32=_[_0xcf0d('0x38')](_0x30fbed[_0xcf0d('0x39')][_0xcf0d('0x3a')](','));}return{'ContactId':_0x6ce1a9['id'],'ChatWebsiteId':_0x34823d,'from':(_0x6ce1a9[_0xcf0d('0x3b')]||'')+'\x20'+(_0x6ce1a9[_0xcf0d('0x3c')]||''),'customerIp':_0x415c32,'customerPort':_0x30fbed['x-real-port']?_0x30fbed[_0xcf0d('0x3d')]:null,'referer':_0x5e9955['referer'],'browserName':_0x359b6b[_0xcf0d('0x3e')][_0xcf0d('0x30')]&&_0x359b6b['browser'][_0xcf0d('0x3f')]?util[_0xcf0d('0x40')](_0xcf0d('0x41'),_0x359b6b[_0xcf0d('0x3e')][_0xcf0d('0x30')],_0x359b6b['browser'][_0xcf0d('0x3f')]):_0xcf0d('0x42'),'browserVersion':_0x359b6b[_0xcf0d('0x3e')]['version']||_0xcf0d('0x42'),'osName':util['format']('%s\x20%s',_0x359b6b['os'][_0xcf0d('0x30')],_0x359b6b['os']['version']),'osVersion':_0x359b6b['os'][_0xcf0d('0x3f')],'deviceModel':_0x359b6b[_0xcf0d('0x43')][_0xcf0d('0x44')]&&_0x359b6b[_0xcf0d('0x43')][_0xcf0d('0x45')]?util[_0xcf0d('0x40')](_0xcf0d('0x46'),_0x359b6b[_0xcf0d('0x43')][_0xcf0d('0x44')],_0x359b6b['device'][_0xcf0d('0x45')],_0x359b6b['device'][_0xcf0d('0x47')]):null,'deviceVendor':_0x359b6b['device'][_0xcf0d('0x45')],'deviceType':_0x359b6b[_0xcf0d('0x43')]['type'],'formData':JSON[_0xcf0d('0x48')](_0x5e9955)};}exports[_0xcf0d('0x49')]=function(_0xcdfd8c,_0x1e0f35){var _0x1e9f69={'include':[{'model':db[_0xcf0d('0x4a')],'as':_0xcf0d('0x4b')}]},_0x25dd15={},_0x2a0156={'count':0x0,'rows':[]};var _0x22dd36=_[_0xcf0d('0x4c')](db[_0xcf0d('0x4d')]['rawAttributes'],function(_0xf974cc){return{'name':_0xf974cc[_0xcf0d('0x4e')],'type':_0xf974cc[_0xcf0d('0x47')][_0xcf0d('0x4f')]};});_0x25dd15[_0xcf0d('0x44')]=_['map'](_0x22dd36,_0xcf0d('0x30'));_0x25dd15[_0xcf0d('0x50')]=_['keys'](_0xcdfd8c[_0xcf0d('0x50')]);_0x25dd15[_0xcf0d('0x51')]=_[_0xcf0d('0x52')](_0x25dd15[_0xcf0d('0x44')],_0x25dd15[_0xcf0d('0x50')]);_0x1e9f69[_0xcf0d('0x53')]=_[_0xcf0d('0x52')](_0x25dd15[_0xcf0d('0x44')],qs[_0xcf0d('0x54')](_0xcdfd8c[_0xcf0d('0x50')]['fields']));_0x1e9f69['attributes']=_0x1e9f69['attributes'][_0xcf0d('0x55')]?_0x1e9f69[_0xcf0d('0x53')]:_0x25dd15[_0xcf0d('0x44')];if(!_0xcdfd8c[_0xcf0d('0x50')]['hasOwnProperty']('nolimit')){_0x1e9f69[_0xcf0d('0x26')]=qs[_0xcf0d('0x26')](_0xcdfd8c[_0xcf0d('0x50')][_0xcf0d('0x26')]);_0x1e9f69[_0xcf0d('0x24')]=qs[_0xcf0d('0x24')](_0xcdfd8c[_0xcf0d('0x50')]['offset']);}_0x1e9f69['order']=qs['sort'](_0xcdfd8c[_0xcf0d('0x50')][_0xcf0d('0x56')]);_0x1e9f69[_0xcf0d('0x57')]=qs[_0xcf0d('0x51')](_[_0xcf0d('0x58')](_0xcdfd8c[_0xcf0d('0x50')],_0x25dd15[_0xcf0d('0x51')]),_0x22dd36);if(_0xcdfd8c[_0xcf0d('0x50')][_0xcf0d('0x59')]){_0x1e9f69[_0xcf0d('0x57')]=_[_0xcf0d('0x5a')](_0x1e9f69[_0xcf0d('0x57')],{'$or':_[_0xcf0d('0x4c')](_0x22dd36,function(_0x12ef35){if(_0x12ef35[_0xcf0d('0x47')]!==_0xcf0d('0x5b')){var _0x332193={};_0x332193[_0x12ef35[_0xcf0d('0x30')]]={'$like':'%'+_0xcdfd8c[_0xcf0d('0x50')][_0xcf0d('0x59')]+'%'};return _0x332193;}})});}_0x1e9f69=_[_0xcf0d('0x5a')]({},_0x1e9f69,_0xcdfd8c[_0xcf0d('0x5c')]);var _0x57b808={'where':_0x1e9f69['where']};return db['ChatWebsite'][_0xcf0d('0x5d')](_0x57b808)[_0xcf0d('0x19')](function(_0x1e4c4b){_0x2a0156[_0xcf0d('0x5d')]=_0x1e4c4b;if(_0xcdfd8c[_0xcf0d('0x50')][_0xcf0d('0x5e')]){_0x1e9f69[_0xcf0d('0x5f')]=[{'all':!![]}];}return db['ChatWebsite'][_0xcf0d('0x60')](_0x1e9f69);})[_0xcf0d('0x19')](function(_0x5e3f62){_0x2a0156[_0xcf0d('0x61')]=_0x5e3f62;return _0x2a0156;})[_0xcf0d('0x19')](respondWithFilteredResult(_0x1e0f35,_0x1e9f69))[_0xcf0d('0x21')](handleError(_0x1e0f35,null));};exports[_0xcf0d('0x62')]=function(_0x13e4c8,_0x29df98){var _0x5e8cbb={'raw':![],'where':{'id':_0x13e4c8['params']['id']},'include':[{'model':db[_0xcf0d('0x4a')],'as':_0xcf0d('0x4b')}]},_0x6bf137={};_0x6bf137[_0xcf0d('0x44')]=_[_0xcf0d('0x63')](db['ChatWebsite']['rawAttributes']);_0x6bf137[_0xcf0d('0x50')]=_[_0xcf0d('0x63')](_0x13e4c8[_0xcf0d('0x50')]);_0x6bf137[_0xcf0d('0x51')]=_[_0xcf0d('0x52')](_0x6bf137[_0xcf0d('0x44')],_0x6bf137[_0xcf0d('0x50')]);_0x5e8cbb[_0xcf0d('0x53')]=_['intersection'](_0x6bf137[_0xcf0d('0x44')],qs[_0xcf0d('0x54')](_0x13e4c8[_0xcf0d('0x50')][_0xcf0d('0x54')]));_0x5e8cbb[_0xcf0d('0x53')]=_0x5e8cbb[_0xcf0d('0x53')][_0xcf0d('0x55')]?_0x5e8cbb[_0xcf0d('0x53')]:_0x6bf137[_0xcf0d('0x44')];if(_0x13e4c8['query'][_0xcf0d('0x5e')]){_0x5e8cbb[_0xcf0d('0x5f')]=[{'all':!![]}];}_0x5e8cbb=_[_0xcf0d('0x5a')]({},_0x5e8cbb,_0x13e4c8[_0xcf0d('0x5c')]);return db[_0xcf0d('0x4d')][_0xcf0d('0x64')](_0x5e8cbb)[_0xcf0d('0x19')](handleEntityNotFound(_0x29df98,null))['then'](respondWithResult(_0x29df98,null))[_0xcf0d('0x21')](handleError(_0x29df98,null));};exports[_0xcf0d('0x65')]=function(_0x40333a,_0x2be92f){if(!wildcardUtils['testWildcardValidity'](_0x40333a[_0xcf0d('0x66')][_0xcf0d('0x67')])){return handleError(_0x2be92f,null)(new APIBadRequestError('\x22'+_0x40333a[_0xcf0d('0x66')]['address']+'\x22\x20is\x20not\x20a\x20valid\x20website\x20domain'));}return db[_0xcf0d('0x4d')]['create'](_0x40333a[_0xcf0d('0x66')],{})[_0xcf0d('0x19')](function(_0x16adf3){var _0x20b4b5=_0x40333a[_0xcf0d('0x68')]['get']({'plain':!![]});if(!_0x20b4b5)throw new Error(_0xcf0d('0x69'));if(_0x20b4b5[_0xcf0d('0x6a')]===_0xcf0d('0x68')){var _0x5d7432=_0x16adf3[_0xcf0d('0x6b')]({'plain':!![]});var _0x18686a='ChatWebsites';return db[_0xcf0d('0x6c')][_0xcf0d('0x64')]({'where':{'name':_0x18686a,'userProfileId':_0x20b4b5[_0xcf0d('0x6d')]},'raw':!![]})[_0xcf0d('0x19')](function(_0x4d98f3){if(_0x4d98f3&&_0x4d98f3['autoAssociation']===0x0){return db[_0xcf0d('0x2b')]['create']({'name':_0x5d7432[_0xcf0d('0x30')],'resourceId':_0x5d7432['id'],'type':_0x4d98f3[_0xcf0d('0x30')],'sectionId':_0x4d98f3['id']},{})['then'](function(){return _0x16adf3;});}else{return _0x16adf3;}})[_0xcf0d('0x21')](function(_0x50b5e4){logger[_0xcf0d('0x1d')](_0xcf0d('0x6e'),_0x50b5e4);throw _0x50b5e4;});}return _0x16adf3;})[_0xcf0d('0x19')](respondWithResult(_0x2be92f,0xc9))[_0xcf0d('0x21')](handleError(_0x2be92f,null));};exports['update']=function(_0x25a157,_0x44faaa){if(!wildcardUtils[_0xcf0d('0x6f')](_0x25a157[_0xcf0d('0x66')][_0xcf0d('0x67')])){return handleError(_0x44faaa,null)(new APIBadRequestError('\x22'+_0x25a157[_0xcf0d('0x66')][_0xcf0d('0x67')]+_0xcf0d('0x70')));}if(_0x25a157[_0xcf0d('0x66')]['id']){delete _0x25a157[_0xcf0d('0x66')]['id'];}return db[_0xcf0d('0x4d')][_0xcf0d('0x64')]({'where':{'id':_0x25a157[_0xcf0d('0x71')]['id']},'include':[{'model':db[_0xcf0d('0x4a')],'as':_0xcf0d('0x4b')}]})[_0xcf0d('0x19')](handleEntityNotFound(_0x44faaa,null))[_0xcf0d('0x19')](saveUpdates(_0x25a157[_0xcf0d('0x66')],null))['then'](respondWithResult(_0x44faaa,null))[_0xcf0d('0x21')](handleError(_0x44faaa,null));};exports['destroy']=function(_0x5492be,_0x3277ff){return db['ChatWebsite'][_0xcf0d('0x64')]({'where':{'id':_0x5492be['params']['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x3277ff,null))[_0xcf0d('0x19')](removeEntity(_0x3277ff,null))[_0xcf0d('0x21')](handleError(_0x3277ff,null));};exports[_0xcf0d('0x72')]=function(_0x59b6fe,_0x393c7a){return db[_0xcf0d('0x4d')][_0xcf0d('0x72')]()['then'](respondWithResult(_0x393c7a,null))[_0xcf0d('0x21')](handleError(_0x393c7a,null));};exports['addDisposition']=function(_0xe2ccec,_0x33f28e){if(_0xe2ccec['body']['id']){delete _0xe2ccec[_0xcf0d('0x66')]['id'];}return db[_0xcf0d('0x4d')][_0xcf0d('0x64')]({'where':{'id':_0xe2ccec[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x33f28e,null))['then'](function(_0x123d0e){if(_0x123d0e){_0xe2ccec['body'][_0xcf0d('0x73')]=_0x123d0e['id'];return db[_0xcf0d('0x74')][_0xcf0d('0x65')](_0xe2ccec[_0xcf0d('0x66')]);}})['then'](respondWithResult(_0x33f28e,null))[_0xcf0d('0x21')](handleError(_0x33f28e,null));};exports['getDispositions']=function(_0x2eef5c,_0x4b96c6){var _0x1b491f={'raw':![],'where':{}};var _0x4615d0={};var _0x16e7f6={'count':0x0,'rows':[]};return db[_0xcf0d('0x4d')][_0xcf0d('0x75')]({'where':{'id':_0x2eef5c['params']['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x4b96c6,null))[_0xcf0d('0x19')](function(_0x387f96){if(_0x387f96){_0x4615d0[_0xcf0d('0x44')]=_[_0xcf0d('0x63')](db[_0xcf0d('0x74')][_0xcf0d('0x76')]);_0x4615d0['query']=_[_0xcf0d('0x63')](_0x2eef5c[_0xcf0d('0x50')]);_0x4615d0[_0xcf0d('0x51')]=_[_0xcf0d('0x52')](_0x4615d0['model'],_0x4615d0[_0xcf0d('0x50')]);_0x1b491f['attributes']=_[_0xcf0d('0x52')](_0x4615d0['model'],qs[_0xcf0d('0x54')](_0x2eef5c['query']['fields']));_0x1b491f[_0xcf0d('0x53')]=_0x1b491f['attributes'][_0xcf0d('0x55')]?_0x1b491f[_0xcf0d('0x53')]:_0x4615d0[_0xcf0d('0x44')];if(!_0x2eef5c[_0xcf0d('0x50')][_0xcf0d('0x77')]('nolimit')){_0x1b491f[_0xcf0d('0x26')]=qs[_0xcf0d('0x26')](_0x2eef5c['query']['limit']);_0x1b491f['offset']=qs[_0xcf0d('0x24')](_0x2eef5c['query'][_0xcf0d('0x24')]);}_0x1b491f[_0xcf0d('0x78')]=qs[_0xcf0d('0x56')](_0x2eef5c[_0xcf0d('0x50')][_0xcf0d('0x56')]);_0x1b491f[_0xcf0d('0x57')]=qs['filters'](_[_0xcf0d('0x58')](_0x2eef5c[_0xcf0d('0x50')],_0x4615d0[_0xcf0d('0x51')]));_0x1b491f['where'][_0xcf0d('0x73')]=_0x387f96['id'];if(_0x2eef5c[_0xcf0d('0x50')]['filter']){_0x1b491f['where']=_[_0xcf0d('0x5a')](_0x1b491f[_0xcf0d('0x57')],{'$or':_['map'](_0x1b491f[_0xcf0d('0x53')],function(_0x4c3ada){var _0x405d9e={};_0x405d9e[_0x4c3ada]={'$like':'%'+_0x2eef5c['query']['filter']+'%'};return _0x405d9e;})});}_0x1b491f=_[_0xcf0d('0x5a')]({},_0x1b491f,_0x2eef5c['options']);return db['Disposition'][_0xcf0d('0x5d')]({'where':_0x1b491f[_0xcf0d('0x57')]})[_0xcf0d('0x19')](function(_0x218b98){_0x16e7f6[_0xcf0d('0x5d')]=_0x218b98;if(_0x2eef5c[_0xcf0d('0x50')][_0xcf0d('0x5e')]){_0x1b491f[_0xcf0d('0x5f')]=[{'all':!![]}];}return db[_0xcf0d('0x74')][_0xcf0d('0x60')](_0x1b491f);})[_0xcf0d('0x19')](function(_0x4b96ec){_0x16e7f6[_0xcf0d('0x61')]=_0x4b96ec;return _0x16e7f6;});}})['then'](respondWithFilteredResult(_0x4b96c6,_0x1b491f))[_0xcf0d('0x21')](handleError(_0x4b96c6,null));};exports['removeDispositions']=function(_0x25d30b,_0x35f327){return db['ChatWebsite']['find']({'where':{'id':_0x25d30b['params']['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x35f327,null))[_0xcf0d('0x19')](function(_0x12fb1){if(_0x12fb1){return _0x12fb1[_0xcf0d('0x79')](_0x25d30b[_0xcf0d('0x50')]['ids']);}})[_0xcf0d('0x19')](respondWithStatusCode(_0x35f327,null))[_0xcf0d('0x21')](handleError(_0x35f327,null));};exports[_0xcf0d('0x7a')]=function(_0x476b07,_0xc448dd){if(_0x476b07['body']['id']){delete _0x476b07[_0xcf0d('0x66')]['id'];}return db[_0xcf0d('0x4d')]['find']({'where':{'id':_0x476b07[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0xc448dd,null))['then'](function(_0x54d8ae){if(_0x54d8ae){_0x476b07[_0xcf0d('0x66')]['ChatWebsiteId']=_0x54d8ae['id'];return db[_0xcf0d('0x7b')][_0xcf0d('0x65')](_0x476b07[_0xcf0d('0x66')]);}})['then'](respondWithResult(_0xc448dd,null))[_0xcf0d('0x21')](handleError(_0xc448dd,null));};exports[_0xcf0d('0x7c')]=function(_0x12a688,_0x15edbb){var _0x596db6={'raw':![],'where':{}};var _0x56eab6={};var _0x1a2d6e={'count':0x0,'rows':[]};return db[_0xcf0d('0x4d')]['findOne']({'where':{'id':_0x12a688['params']['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x15edbb,null))['then'](function(_0x41be67){if(_0x41be67){_0x56eab6[_0xcf0d('0x44')]=_[_0xcf0d('0x63')](db[_0xcf0d('0x7b')][_0xcf0d('0x76')]);_0x56eab6[_0xcf0d('0x50')]=_[_0xcf0d('0x63')](_0x12a688[_0xcf0d('0x50')]);_0x56eab6[_0xcf0d('0x51')]=_[_0xcf0d('0x52')](_0x56eab6['model'],_0x56eab6['query']);_0x596db6[_0xcf0d('0x53')]=_[_0xcf0d('0x52')](_0x56eab6[_0xcf0d('0x44')],qs[_0xcf0d('0x54')](_0x12a688['query'][_0xcf0d('0x54')]));_0x596db6[_0xcf0d('0x53')]=_0x596db6[_0xcf0d('0x53')][_0xcf0d('0x55')]?_0x596db6['attributes']:_0x56eab6[_0xcf0d('0x44')];if(!_0x12a688[_0xcf0d('0x50')]['hasOwnProperty']('nolimit')){_0x596db6['limit']=qs[_0xcf0d('0x26')](_0x12a688['query'][_0xcf0d('0x26')]);_0x596db6[_0xcf0d('0x24')]=qs[_0xcf0d('0x24')](_0x12a688[_0xcf0d('0x50')][_0xcf0d('0x24')]);}_0x596db6[_0xcf0d('0x78')]=qs['sort'](_0x12a688[_0xcf0d('0x50')][_0xcf0d('0x56')]);_0x596db6['where']=qs[_0xcf0d('0x51')](_[_0xcf0d('0x58')](_0x12a688[_0xcf0d('0x50')],_0x56eab6['filters']));_0x596db6[_0xcf0d('0x57')]['ChatWebsiteId']=_0x41be67['id'];if(_0x12a688[_0xcf0d('0x50')]['filter']){_0x596db6[_0xcf0d('0x57')]=_[_0xcf0d('0x5a')](_0x596db6[_0xcf0d('0x57')],{'$or':_['map'](_0x596db6[_0xcf0d('0x53')],function(_0x3c74c1){var _0x426642={};_0x426642[_0x3c74c1]={'$like':'%'+_0x12a688[_0xcf0d('0x50')][_0xcf0d('0x59')]+'%'};return _0x426642;})});}_0x596db6=_[_0xcf0d('0x5a')]({},_0x596db6,_0x12a688[_0xcf0d('0x5c')]);return db['CannedAnswer']['count']({'where':_0x596db6[_0xcf0d('0x57')]})[_0xcf0d('0x19')](function(_0x29659c){_0x1a2d6e['count']=_0x29659c;if(_0x12a688[_0xcf0d('0x50')][_0xcf0d('0x5e')]){_0x596db6[_0xcf0d('0x5f')]=[{'all':!![]}];}return db[_0xcf0d('0x7b')]['findAll'](_0x596db6);})[_0xcf0d('0x19')](function(_0x3039a5){_0x1a2d6e['rows']=_0x3039a5;return _0x1a2d6e;});}})[_0xcf0d('0x19')](respondWithFilteredResult(_0x15edbb,_0x596db6))[_0xcf0d('0x21')](handleError(_0x15edbb,null));};exports[_0xcf0d('0x7d')]=function(_0x3a2a02,_0x3474f3){return db[_0xcf0d('0x4d')]['find']({'where':{'id':_0x3a2a02[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x3474f3,null))['then'](function(_0x5cddb9){if(_0x5cddb9){return _0x5cddb9[_0xcf0d('0x7d')](_0x3a2a02['query'][_0xcf0d('0x7e')]);}})[_0xcf0d('0x19')](respondWithStatusCode(_0x3474f3,null))['catch'](handleError(_0x3474f3,null));};exports[_0xcf0d('0x7f')]=function(_0x32f7e3,_0x580e22){_0x32f7e3[_0xcf0d('0x66')][_0xcf0d('0x80')]=_0x32f7e3[_0xcf0d('0x81')][_0xcf0d('0x82')];return db[_0xcf0d('0x4d')][_0xcf0d('0x64')]({'where':{'id':_0x32f7e3[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x580e22,null))['then'](saveUpdates(_0x32f7e3[_0xcf0d('0x66')],null))[_0xcf0d('0x19')](respondWithResult(_0x580e22,null))['catch'](handleError(_0x580e22,null));};exports['addAvatar']=function(_0x55d1ec,_0x19208b){_0x55d1ec[_0xcf0d('0x66')][_0xcf0d('0x83')]=_0x55d1ec[_0xcf0d('0x81')][_0xcf0d('0x82')];return db[_0xcf0d('0x4d')][_0xcf0d('0x64')]({'where':{'id':_0x55d1ec[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x19208b,null))[_0xcf0d('0x19')](saveUpdates(_0x55d1ec[_0xcf0d('0x66')],null))[_0xcf0d('0x19')](respondWithResult(_0x19208b,null))[_0xcf0d('0x21')](handleError(_0x19208b,null));};exports[_0xcf0d('0x84')]=function(_0x5f1ffa,_0x47cb63){_0x5f1ffa[_0xcf0d('0x66')]['customerAvatar']=_0x5f1ffa['file'][_0xcf0d('0x82')];return db[_0xcf0d('0x4d')][_0xcf0d('0x64')]({'where':{'id':_0x5f1ffa[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x47cb63,null))[_0xcf0d('0x19')](saveUpdates(_0x5f1ffa[_0xcf0d('0x66')],null))[_0xcf0d('0x19')](respondWithResult(_0x47cb63,null))['catch'](handleError(_0x47cb63,null));};exports[_0xcf0d('0x85')]=function(_0x3a54fa,_0x17caa6){_0x3a54fa[_0xcf0d('0x66')][_0xcf0d('0x86')]=_0x3a54fa[_0xcf0d('0x81')][_0xcf0d('0x82')];return db['ChatWebsite']['find']({'where':{'id':_0x3a54fa[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x17caa6,null))[_0xcf0d('0x19')](saveUpdates(_0x3a54fa['body'],null))['then'](respondWithResult(_0x17caa6,null))['catch'](handleError(_0x17caa6,null));};exports[_0xcf0d('0x87')]=function(_0xb41887,_0x56a1ec){var _0xcf76a7=path['join'](config[_0xcf0d('0x88')],_0xcf0d('0x89'));var _0x9f5202={'where':{'id':_0xb41887[_0xcf0d('0x71')]['id']},'attributes':['id',_0xcf0d('0x80')],'raw':!![]};var _0x3c9ed0=![];return require(_0xcf0d('0x8a'))[_0xcf0d('0x8b')]()['then'](function(_0xc808a6){if(_0xc808a6){_0x3c9ed0=_0xc808a6[_0xcf0d('0x8c')];}})[_0xcf0d('0x19')](function(){return db[_0xcf0d('0x4d')][_0xcf0d('0x64')](_0x9f5202);})['then'](handleEntityNotFound(_0x56a1ec,null))[_0xcf0d('0x19')](function(_0x360323){if(_0x360323){if(!_[_0xcf0d('0x8d')](_0x360323['sitepic'])){if(fs[_0xcf0d('0x8e')](path[_0xcf0d('0x8f')](config[_0xcf0d('0x88')],_0xcf0d('0x90'),_0x360323[_0xcf0d('0x80')]))&&_0x3c9ed0){_0xcf76a7=path[_0xcf0d('0x8f')](config[_0xcf0d('0x88')],'server/files/images/logos/',_0x360323['sitepic']);}}return _0x56a1ec[_0xcf0d('0x91')](_0xcf76a7);}})[_0xcf0d('0x21')](handleError(_0x56a1ec,null));};exports[_0xcf0d('0x92')]=function(_0x2dcc13,_0x34686a){var _0x49c67b=path[_0xcf0d('0x8f')](config[_0xcf0d('0x88')],_0xcf0d('0x93'));var _0x45ae7a={'where':{'id':_0x2dcc13[_0xcf0d('0x71')]['id']},'attributes':['id',_0xcf0d('0x83')],'raw':!![]};return db['ChatWebsite'][_0xcf0d('0x64')](_0x45ae7a)[_0xcf0d('0x19')](handleEntityNotFound(_0x34686a,null))['then'](function(_0x427ff7){if(_0x427ff7){if(!_[_0xcf0d('0x8d')](_0x427ff7[_0xcf0d('0x83')])){if(fs['existsSync'](path[_0xcf0d('0x8f')](config[_0xcf0d('0x88')],'server/files/images/avatars/',_0x427ff7[_0xcf0d('0x83')]))){_0x49c67b=path[_0xcf0d('0x8f')](config[_0xcf0d('0x88')],_0xcf0d('0x94'),_0x427ff7[_0xcf0d('0x83')]);}}return _0x34686a[_0xcf0d('0x91')](_0x49c67b);}})['catch'](handleError(_0x34686a,null));};exports[_0xcf0d('0x95')]=function(_0x3862f5,_0x5984e6){var _0xa7b831=path[_0xcf0d('0x8f')](config[_0xcf0d('0x88')],_0xcf0d('0x96'));var _0x353d8c={'where':{'id':_0x3862f5['params']['id']},'attributes':['id',_0xcf0d('0x97'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x353d8c)['then'](handleEntityNotFound(_0x5984e6,null))[_0xcf0d('0x19')](function(_0xb109b4){if(_0xb109b4){if(!_['isNil'](_0xb109b4[_0xcf0d('0x97')])){if(fs[_0xcf0d('0x8e')](path[_0xcf0d('0x8f')](config[_0xcf0d('0x88')],_0xcf0d('0x94'),_0xb109b4[_0xcf0d('0x97')]))&&_0xb109b4[_0xcf0d('0x98')]){_0xa7b831=path['join'](config[_0xcf0d('0x88')],_0xcf0d('0x94'),_0xb109b4[_0xcf0d('0x97')]);}}return _0x5984e6[_0xcf0d('0x91')](_0xa7b831);}})['catch'](handleError(_0x5984e6,null));};exports[_0xcf0d('0x99')]=function(_0x504242,_0x4ce3db){var _0x39a555=path[_0xcf0d('0x8f')](config[_0xcf0d('0x88')],_0xcf0d('0x9a'));var _0x13a944={'where':{'id':_0x504242['params']['id']},'attributes':['id',_0xcf0d('0x86')],'raw':!![]};return db[_0xcf0d('0x4d')]['find'](_0x13a944)[_0xcf0d('0x19')](handleEntityNotFound(_0x4ce3db,null))[_0xcf0d('0x19')](function(_0x559dad){if(_0x559dad){if(!_[_0xcf0d('0x8d')](_0x559dad['systemAvatar'])){if(fs[_0xcf0d('0x8e')](path[_0xcf0d('0x8f')](config[_0xcf0d('0x88')],'server/files/images/avatars/',_0x559dad[_0xcf0d('0x86')]))){_0x39a555=path[_0xcf0d('0x8f')](config['root'],_0xcf0d('0x94'),_0x559dad['systemAvatar']);}}return _0x4ce3db[_0xcf0d('0x91')](_0x39a555);}})[_0xcf0d('0x21')](handleError(_0x4ce3db,null));};function checkWebsiteInterval(_0xf889bb){var _0x278a27=_0xf889bb['Interval'];if(!_0x278a27){return Promise[_0xcf0d('0x9b')](_0xf889bb);}var _0x53b9fb=_0xf889bb[_0xcf0d('0x9c')]||undefined;return _0x278a27[_0xcf0d('0x9d')](_0x53b9fb)[_0xcf0d('0x19')](function(_0x4866cf){if(!_0x4866cf){throw new APIOutOfIntervalError();}return _0xf889bb;});}exports[_0xcf0d('0x9e')]=function(_0x176987,_0x1787df){var _0x17e7ce={'body':_0x176987[_0xcf0d('0x66')],'channel':_0xcf0d('0x9f')};var _0x3a1ae0=[];var _0x1ac316=[];var _0x4d3a9f={};var _0x22c0da=![];if(_0x176987[_0xcf0d('0x66')]['id']){delete _0x176987[_0xcf0d('0x66')]['id'];}if(_[_0xcf0d('0x8d')](_0x176987['body'][_0xcf0d('0xa0')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0xcf0d('0x8d')](_0x176987[_0xcf0d('0x66')][_0xcf0d('0xa1')])){throw new APIBadRequestError(_0xcf0d('0xa2'));}if(_[_0xcf0d('0xa3')](_0x176987[_0xcf0d('0x66')][_0xcf0d('0x66')])){throw new APIBadRequestError(_0xcf0d('0xa4'));}var _0xb3f5=_0x176987[_0xcf0d('0x66')][_0xcf0d('0x36')]&&_0x176987[_0xcf0d('0x66')][_0xcf0d('0xa5')];return db['CmContact']['describe']()['then'](function(_0xdfccd1){if(!_0xdfccd1){throw new Error(_0xcf0d('0xa6'));}_0x3a1ae0=Object[_0xcf0d('0x63')](_0xdfccd1)[_0xcf0d('0x59')](function(_0xb548fd){return!['createdAt',_0xcf0d('0xa7')][_0xcf0d('0xa8')](_0xb548fd);});_0x1ac316=Object[_0xcf0d('0x63')](_0xdfccd1)['filter'](function(_0x15d8f6){return![_0xcf0d('0xa9'),_0xcf0d('0xa7'),_0xcf0d('0xaa'),_0xcf0d('0xab')][_0xcf0d('0xa8')](_0x15d8f6);});if(!_[_0xcf0d('0xa8')](_0x1ac316,_0x176987[_0xcf0d('0x66')][_0xcf0d('0xa1')])){throw new APIBadRequestError(_0xcf0d('0xac')+_0x1ac316[_0xcf0d('0x8f')](',\x20'));}_0x4d3a9f[_0x176987[_0xcf0d('0x66')][_0xcf0d('0xa1')]]=_0x176987['body'][_0xcf0d('0xa0')];})[_0xcf0d('0x19')](function(){return db['ChatWebsite'][_0xcf0d('0x64')]({'where':{'id':_0x176987[_0xcf0d('0x71')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xcf0d('0xad')],'as':_0xcf0d('0xae'),'where':_0x4d3a9f,'limit':0x1,'order':[[_0xcf0d('0xa7'),_0xcf0d('0xaf')]]}]},{'model':db[_0xcf0d('0xb0')],'as':_0xcf0d('0xb1')},{'model':db[_0xcf0d('0xb2')],'as':_0xcf0d('0xb2'),'include':[{'model':db['Interval'],'as':_0xcf0d('0xb3'),'attributes':['id',_0xcf0d('0xb4')],'raw':!![]}]}]});})[_0xcf0d('0x19')](function(_0x334650){if(!_0x334650){throw new APINotFoundError(util[_0xcf0d('0x40')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x176987[_0xcf0d('0x71')]['id']));}if(_0xb3f5){return checkWebsiteInterval(_0x334650);}return _0x334650;})['then'](function(_0x5a2ace){_0x17e7ce[_0xcf0d('0xb5')]=_0x5a2ace;_0x17e7ce[_0xcf0d('0xb6')]=_[_0xcf0d('0xb7')](_0x5a2ace[_0xcf0d('0xb1')],[_0xcf0d('0xb8')],[_0xcf0d('0xb9')]);if(_0x17e7ce[_0xcf0d('0xb5')][_0xcf0d('0xb1')]){delete _0x17e7ce[_0xcf0d('0xb5')][_0xcf0d('0xb1')];}_0x17e7ce[_0xcf0d('0xba')]=_0x5a2ace[_0xcf0d('0xbb')]||{'id':_0x5a2ace[_0xcf0d('0xab')]};if(_0x17e7ce['list']&&_0x17e7ce[_0xcf0d('0xba')]['Contacts'][_0xcf0d('0x55')]){return _0x17e7ce[_0xcf0d('0xba')][_0xcf0d('0xae')][0x0];}var _0xcad4=_['defaults'](_0x176987[_0xcf0d('0x66')],{'firstName':_0x176987[_0xcf0d('0x66')][_0xcf0d('0xa0')],'ListId':_0x5a2ace['ListId']});_0xcad4[_0x176987[_0xcf0d('0x66')]['mapKey']]=_0x176987[_0xcf0d('0x66')][_0xcf0d('0xa0')];return db[_0xcf0d('0xad')][_0xcf0d('0x65')](_0xcad4,{'fields':_0x3a1ae0,'raw':!![]});})['then'](function(_0x3673c5){_0x17e7ce[_0xcf0d('0xbc')]=_0x3673c5;var _0x30f42b=createInteractionObject(_0x176987[_0xcf0d('0x71')]['id'],_0x176987[_0xcf0d('0x66')],_0x176987[_0xcf0d('0xbd')],_0x3673c5);var _0x2164fc={'ChatWebsiteId':_0x176987[_0xcf0d('0x71')]['id']};if(_0x176987[_0xcf0d('0x66')][_0xcf0d('0xbe')]){_0x2164fc[_0xcf0d('0xbe')]=_0x176987[_0xcf0d('0x66')][_0xcf0d('0xbe')];_0x2164fc['closed']=![];return db[_0xcf0d('0xbf')][_0xcf0d('0x64')]({'where':_0x2164fc})[_0xcf0d('0x19')](function(_0x11c533){if(_0x11c533){_0x22c0da=!![];return _0x11c533;}else if(!_0xb3f5&&_0x11c533&&_0x11c533[_0xcf0d('0xc0')]){throw new APIConflictError(_0xcf0d('0xc1'));}_0x30f42b[_0xcf0d('0xbe')]=_0x176987[_0xcf0d('0x66')][_0xcf0d('0xbe')];_0x30f42b['externalUrl']=_0x176987[_0xcf0d('0x66')][_0xcf0d('0xc2')];return db['ChatInteraction']['create'](_0x30f42b);});}_0x2164fc[_0xcf0d('0xc3')]=_0x3673c5['id'];if(_0x176987[_0xcf0d('0x66')][_0xcf0d('0xc4')]&&_0x176987[_0xcf0d('0x66')][_0xcf0d('0xc4')]['id']){_0x2164fc['id']=_0x176987[_0xcf0d('0x66')]['interaction']['id'];return db[_0xcf0d('0xbf')][_0xcf0d('0x64')]({'where':_0x2164fc})[_0xcf0d('0x19')](function(_0xb77472){var _0xc42cea=_0x176987[_0xcf0d('0x66')][_0xcf0d('0x36')]&&_0x176987[_0xcf0d('0x66')][_0xcf0d('0xa5')];if(!_0xc42cea&&_0xb77472&&_0xb77472[_0xcf0d('0xc0')]){throw new APIConflictError(_0xcf0d('0xc1'));}else if(_0xb77472){_0x22c0da=!![];return _0xb77472;}else{return db['ChatInteraction'][_0xcf0d('0x65')](_0x30f42b);}});}return db[_0xcf0d('0xbf')]['create'](_0x30f42b);})[_0xcf0d('0x19')](function(_0x2c28a6){if(!_0x22c0da){return _0x2c28a6;}var _0x440d9d={'from':(_0x17e7ce[_0xcf0d('0xbc')][_0xcf0d('0x3b')]||'')+'\x20'+(_0x17e7ce[_0xcf0d('0xbc')]['lastName']||'')};if(_0x176987[_0xcf0d('0x66')][_0xcf0d('0xbe')]&&_0x176987[_0xcf0d('0x66')][_0xcf0d('0xc5')]&&_0x176987[_0xcf0d('0x66')][_0xcf0d('0xbe')]!=_0x176987[_0xcf0d('0x66')]['messageId']){_0x440d9d[_0xcf0d('0xbe')]=_0x176987[_0xcf0d('0x66')]['messageId'];}return _0x2c28a6[_0xcf0d('0x29')](_0x440d9d);})['then'](function(_0x169003){_0x17e7ce['interaction']=_0x169003[_0xcf0d('0x6b')]({'plain':!![]});_0x17e7ce[_0xcf0d('0xc4')]['created']=!_0x22c0da;if(_0x17e7ce[_0xcf0d('0xc4')]['created']){if(_0x17e7ce[_0xcf0d('0xb5')][_0xcf0d('0xc6')]){_0x17e7ce[_0xcf0d('0xb6')][_0xcf0d('0xc7')]({'id':0x0,'priority':_0x17e7ce['applications'][_0xcf0d('0x55')]+0x1,'app':_0xcf0d('0xc8'),'appdata':_0xcf0d('0xc9'),'interval':_0xcf0d('0xca')});}}return db[_0xcf0d('0xcb')][_0xcf0d('0x65')]({'body':_0x176987['body']['body'],'ChatWebsiteId':_0x176987[_0xcf0d('0x71')]['id'],'ChatInteractionId':_0x169003['id'],'direction':'in','ContactId':_0x17e7ce[_0xcf0d('0xbc')]['id'],'AttachmentId':_0x176987[_0xcf0d('0x66')][_0xcf0d('0xcc')]});})[_0xcf0d('0x19')](function(_0x17e243){_0x17e7ce[_0xcf0d('0x1f')]=_0x17e243;if(!_0x17e7ce[_0xcf0d('0xc4')]['UserId']){return;}return db[_0xcf0d('0xcd')]['find']({'attributes':['id',_0xcf0d('0x30')],'where':{'id':_0x17e7ce['interaction']['UserId']}});})[_0xcf0d('0x19')](function(_0x2b7828){if(_0x2b7828){_0x17e7ce[_0xcf0d('0xb6')]['unshift']({'id':0x0,'priority':0x0,'app':_0xcf0d('0xce'),'appdata':_0x2b7828[_0xcf0d('0x30')]+','+(_0x17e7ce[_0xcf0d('0xb5')][_0xcf0d('0xcf')]||0xa),'interval':_0xcf0d('0xca')});_0x17e7ce[_0xcf0d('0xd0')]=!![];}if(!_0x17e7ce[_0xcf0d('0xc4')][_0xcf0d('0xd1')]){return;}return db[_0xcf0d('0xd2')][_0xcf0d('0x64')]({'attributes':['id','name'],'where':{'id':_0x17e7ce[_0xcf0d('0xc4')][_0xcf0d('0xd1')]}});})[_0xcf0d('0x19')](function(_0x11b864){if(_0x11b864){_0x17e7ce[_0xcf0d('0xb6')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x11b864[_0xcf0d('0x30')]+','+(_0x17e7ce[_0xcf0d('0xb5')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcf0d('0xd3'),_0xcf0d('0xd4'),_0x17e7ce);})[_0xcf0d('0x19')](function(_0x4378ee){respondWithRpcPromise('EventManager','EventManager',{'event':_0xcf0d('0x9e'),'message':_0x4378ee},client9002);return _0x4378ee;})[_0xcf0d('0x19')](respondWithResult(_0x1787df,null))['catch'](APIHandleError(_0x1787df));};exports[_0xcf0d('0xd5')]=function(_0x500a6a,_0x5dd8cc){var _0x35f295,_0x3425fe,_0x112520;var _0x11b0f6=[];var _0x5dfd11={};var _0x555fe1=_0x500a6a[_0xcf0d('0xd6')]||[];var _0x109931=[];var _0x5a62b5;return db['CmContact'][_0xcf0d('0x72')]()['then'](function(_0x4104bd){if(!_0x4104bd){throw new db[(_0xcf0d('0xd7'))]['ValidationError'](_0xcf0d('0xd8'));}_0x11b0f6=_[_0xcf0d('0xd9')](_[_0xcf0d('0x63')](_0x4104bd),[_0xcf0d('0xa9'),_0xcf0d('0xa7'),'CompanyId',_0xcf0d('0xab')]);if(_0x500a6a[_0xcf0d('0x66')]['id']){delete _0x500a6a[_0xcf0d('0x66')]['id'];}if(_['isNil'](_0x500a6a['body'][_0xcf0d('0xa0')])){throw _0x5dd8cc['status'](0x1f4)[_0xcf0d('0x31')](new db[(_0xcf0d('0xd7'))][(_0xcf0d('0xda'))]('from\x20is\x20mandatory'));}if(_[_0xcf0d('0x8d')](_0x500a6a[_0xcf0d('0x66')][_0xcf0d('0x66')])||_0x500a6a[_0xcf0d('0x66')][_0xcf0d('0x66')]===''){throw _0x5dd8cc[_0xcf0d('0x22')](0x1f4)['send'](new db['Sequelize'][(_0xcf0d('0xda'))](_0xcf0d('0xdb')));}if(_[_0xcf0d('0x8d')](_0x500a6a[_0xcf0d('0x66')][_0xcf0d('0xdc')])){throw _0x5dd8cc[_0xcf0d('0x22')](0x1f4)[_0xcf0d('0x31')](new db[(_0xcf0d('0xd7'))]['ValidationError'](_0xcf0d('0xdd')+_0x11b0f6));}if(!_[_0xcf0d('0xa8')](_0x11b0f6,_0x500a6a[_0xcf0d('0x66')][_0xcf0d('0xdc')])){throw _0x5dd8cc['status'](0x1f4)[_0xcf0d('0x31')](new db[(_0xcf0d('0xd7'))][(_0xcf0d('0xda'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11b0f6));}_0x5dfd11[_0x500a6a[_0xcf0d('0x66')]['mapKeyOffline']]=_0x500a6a[_0xcf0d('0x66')][_0xcf0d('0xa0')];})[_0xcf0d('0x19')](function(){return db['ChatWebsite'][_0xcf0d('0x64')]({'where':{'id':_0x500a6a[_0xcf0d('0x71')]['id']},'include':[{'model':db[_0xcf0d('0xde')],'as':'List'},{'model':db[_0xcf0d('0xdf')],'as':'MailAccount'}]});})[_0xcf0d('0x19')](handleEntityNotFound(_0x5dd8cc,null))['then'](function(_0x5e495e){if(_0x5e495e&&_0x5e495e[_0xcf0d('0xbb')]){_0x3425fe=_0x5e495e;var _0x507842=_[_0xcf0d('0x11')](_0x500a6a[_0xcf0d('0x66')],{'firstName':_0x500a6a[_0xcf0d('0x66')][_0xcf0d('0xa0')],'phone':_0x500a6a[_0xcf0d('0x66')][_0xcf0d('0xa0')],'ListId':_0x5e495e['ListId']});_0x507842[_0x500a6a['body'][_0xcf0d('0xdc')]]=_0x500a6a[_0xcf0d('0x66')][_0xcf0d('0xa0')];return db[_0xcf0d('0xad')][_0xcf0d('0xe0')]({'where':_0x5dfd11,'defaults':_0x507842});}})[_0xcf0d('0xe1')](function(_0x470f14){if(_0x470f14){_0x112520=_0x470f14;var _0x4f789d=fs[_0xcf0d('0xe2')](path['join'](config[_0xcf0d('0x88')],'server/files/templates/chatOfflineMessage.ejs'),_0xcf0d('0xe3'));var _0x5522f8=ejs[_0xcf0d('0xe4')](_0x4f789d,{'body':_['toPairs'](_0x500a6a[_0xcf0d('0x66')]['body']),'bodyTitle':_0x3425fe['offlineMessageBody']});return db['ChatOfflineMessage'][_0xcf0d('0x65')]({'body':_0x5522f8,'plainBody':htmlToText[_0xcf0d('0xe5')](_0x5522f8),'ContactId':_0x470f14['id'],'ChatWebsiteId':_0x3425fe['id']});}})['then'](function(_0x5e0e27){_0x5a62b5=_0x5e0e27;if(_0x555fe1[_0xcf0d('0x55')]){var _0x3ed7ec=_0x555fe1[_0xcf0d('0x4c')](function(_0x69dca8){return{'name':_0x69dca8[_0xcf0d('0xe6')],'basename':_0x69dca8['filename'],'type':_0x69dca8[_0xcf0d('0xe7')],'ChatOfflineMessageId':_0x5e0e27['id']};});_0x109931=_0x3ed7ec[_0xcf0d('0x4c')](_0x42a4a5=>{var _0x330bb4={'filename':_0x42a4a5['name'],'path':path[_0xcf0d('0x8f')](config[_0xcf0d('0x88')],'server',_0xcf0d('0xd6'),_0xcf0d('0xe8'),_0xcf0d('0xe9'),_0x42a4a5[_0xcf0d('0xea')])};return _0x330bb4;});if(!_0x3425fe['openNewInteraction']){return db[_0xcf0d('0xeb')]['transaction'](function(_0x4c97b3){return db[_0xcf0d('0xec')]['bulkCreate'](_0x3ed7ec,{'transaction':_0x4c97b3});});}}})[_0xcf0d('0x19')](function(){if(_0x5a62b5){_0x35f295=_0x5a62b5;return db[_0xcf0d('0xdf')][_0xcf0d('0x75')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xcf0d('0xed'),'raw':!![]}]}]});}})[_0xcf0d('0x19')](function(_0x3a4511){if(_0x3a4511&&_0x3a4511[_0xcf0d('0xee')]&&_0x3425fe[_0xcf0d('0xef')]&&_0x3425fe[_0xcf0d('0xf0')]){var _0x2d0113=_0x3a4511[_0xcf0d('0xf1')]();return respondWithRpcPromise(_0xcf0d('0xf2'),_0xcf0d('0xf3'),{'account':_0x2d0113,'message':{'from':util[_0xcf0d('0x40')](_0xcf0d('0xf4'),_0x3a4511[_0xcf0d('0x30')],_0x3a4511['email']||_0x3a4511[_0xcf0d('0xee')]['user']),'to':_0x3425fe[_0xcf0d('0xf0')],'subject':_0x3425fe[_0xcf0d('0xf5')],'html':_0x35f295[_0xcf0d('0x66')],'attachments':_0x109931}},client9003)['then'](function(){return _0x35f295;})['catch'](function(_0x1d93e8){logger['error'](_0x1d93e8);});}})[_0xcf0d('0x19')](function(){if(_0x3425fe&&_0x3425fe['openNewInteraction']&&_0x3425fe[_0xcf0d('0xf6')]){var _0x18d98b=[];if(_0x555fe1[_0xcf0d('0x55')]){_0x18d98b=_0x555fe1[_0xcf0d('0x4c')](function(_0x2e2e17){return{'name':_0x2e2e17[_0xcf0d('0xe6')],'basename':_0x2e2e17['filename'],'type':_0x2e2e17[_0xcf0d('0xe7')],'ChatOfflineMessageId':_0x5a62b5['id']};});}var _0x5b111f;if(!_[_0xcf0d('0x8d')](_0x3425fe[_0xcf0d('0xf7')])){var _0xf3de94=_[_0xcf0d('0x4c')](_0x500a6a[_0xcf0d('0x66')],function(_0x284725){return _0x284725;});var _0x509a78=_['toPairsIn'](_0xf3de94)[0x0];var _0x28f1b1=_['mapValues'](_0x509a78,function(_0x400c4a){return _0x400c4a;});_0x5b111f=_0x28f1b1[0x1][_0x3425fe[_0xcf0d('0xf7')]];}var _0x2afb7c={'from':_0x112520[_0xcf0d('0xf8')],'firstName':_0x112520[_0xcf0d('0x3b')],'lastName':_0x112520['lastName'],'mapKey':_0xcf0d('0xf8'),'message':{'from':_0x112520[_0xcf0d('0xf8')],'to':_0x3425fe[_0xcf0d('0xdf')][_0xcf0d('0xf8')],'cc':'','subject':_[_0xcf0d('0x8d')](_0x5b111f)?_0x3425fe[_0xcf0d('0xf5')]:_0x5b111f,'messageId':'','sentAt':new Date(),'attach':_0x18d98b[_0xcf0d('0x55')],'attachments':_0x18d98b,'originChannel':_0xcf0d('0xf9'),'ChatWebsiteId':_0x3425fe['id'],'ChatOfflineMessageId':_0x35f295['id'],'originTo':_0x3425fe[_0xcf0d('0xdf')][_0xcf0d('0xf8')]},'body':_0x35f295[_0xcf0d('0x66')]};var _0x14b3c5={'account':{'id':_0x3425fe['MailAccountId']},'body':_0x2afb7c,'log':_0xcf0d('0xfa')};return respondWithRpcPromise(_0xcf0d('0xfa'),'notifyMail',_0x14b3c5,client9001)[_0xcf0d('0x19')](function(){return _0x35f295;})['catch'](function(_0x5406fb){logger[_0xcf0d('0x1d')](_0x5406fb);});}return;})[_0xcf0d('0x19')](function(){if(_0x35f295){return _0x35f295;}})['then'](respondWithResult(_0x5dd8cc,null))[_0xcf0d('0x21')](function(){for(var _0x2776dd of _0x555fe1){var _0x45fa8a=path[_0xcf0d('0x8f')](config[_0xcf0d('0x88')],'server','files',_0xcf0d('0xe8'),'offline-chat',_0x2776dd[_0xcf0d('0x82')]);fs_extra[_0xcf0d('0xfb')](_0x45fa8a)['catch'](function(_0x226ab2){logger['error'](_0xcf0d('0xfc'),_0x45fa8a,_0x226ab2);});}});};exports[_0xcf0d('0xfd')]=function(_0x12a63c,_0x272606){return db['ChatInteraction']['find']({'where':{'id':_0x12a63c[_0xcf0d('0x71')]['id']}})['then'](handleEntityNotFound(_0x272606,null))['then'](function(_0x1505d8){if(_0x1505d8){return _0x1505d8[_0xcf0d('0xfd')](_0x12a63c[_0xcf0d('0x66')][_0xcf0d('0x7e')],_[_0xcf0d('0xfe')](_0x12a63c[_0xcf0d('0x66')],[_0xcf0d('0x7e'),'id'])||{});}})['then'](respondWithResult(_0x272606,null))[_0xcf0d('0x21')](handleError(_0x272606,null));};exports[_0xcf0d('0xff')]=function(_0x328747,_0x39e08){var _0x18eb0e={'raw':![],'where':{}};var _0x19da7e={};var _0x8385d4={'count':0x0,'rows':[]};return db[_0xcf0d('0x4d')][_0xcf0d('0x75')]({'where':{'id':_0x328747['params']['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x39e08,null))[_0xcf0d('0x19')](function(_0x1a081e){if(_0x1a081e){_0x19da7e[_0xcf0d('0x44')]=_['keys'](db[_0xcf0d('0xbf')][_0xcf0d('0x76')]);_0x19da7e['query']=_[_0xcf0d('0x63')](_0x328747[_0xcf0d('0x50')]);_0x19da7e[_0xcf0d('0x51')]=_['intersection'](_0x19da7e[_0xcf0d('0x44')],_0x19da7e[_0xcf0d('0x50')]);_0x18eb0e['attributes']=_['intersection'](_0x19da7e[_0xcf0d('0x44')],qs[_0xcf0d('0x54')](_0x328747[_0xcf0d('0x50')][_0xcf0d('0x54')]));_0x18eb0e['attributes']=_0x18eb0e[_0xcf0d('0x53')]['length']?_0x18eb0e[_0xcf0d('0x53')]:_0x19da7e['model'];if(!_0x328747[_0xcf0d('0x50')]['hasOwnProperty'](_0xcf0d('0x100'))){_0x18eb0e['limit']=qs[_0xcf0d('0x26')](_0x328747[_0xcf0d('0x50')][_0xcf0d('0x26')]);_0x18eb0e[_0xcf0d('0x24')]=qs['offset'](_0x328747[_0xcf0d('0x50')][_0xcf0d('0x24')]);}_0x18eb0e[_0xcf0d('0x78')]=qs[_0xcf0d('0x56')](_0x328747[_0xcf0d('0x50')][_0xcf0d('0x56')]);_0x18eb0e[_0xcf0d('0x57')]=qs[_0xcf0d('0x51')](_['pick'](_0x328747['query'],_0x19da7e[_0xcf0d('0x51')]));_0x18eb0e['where']['ChatWebsiteId']=_0x1a081e['id'];if(_0x328747[_0xcf0d('0x50')][_0xcf0d('0x59')]){_0x18eb0e['where']=_[_0xcf0d('0x5a')](_0x18eb0e[_0xcf0d('0x57')],{'$or':_[_0xcf0d('0x4c')](_0x18eb0e[_0xcf0d('0x53')],function(_0x127dc5){var _0x21c0d8={};_0x21c0d8[_0x127dc5]={'$like':'%'+_0x328747[_0xcf0d('0x50')]['filter']+'%'};return _0x21c0d8;})});}_0x18eb0e=_['merge']({},_0x18eb0e,_0x328747['options']);return db[_0xcf0d('0xbf')][_0xcf0d('0x5d')]({'where':_0x18eb0e[_0xcf0d('0x57')]})['then'](function(_0x245d8c){_0x8385d4[_0xcf0d('0x5d')]=_0x245d8c;if(_0x328747[_0xcf0d('0x50')][_0xcf0d('0x5e')]){_0x18eb0e[_0xcf0d('0x5f')]=[{'model':db[_0xcf0d('0xad')],'as':_0xcf0d('0x101'),'required':![]},{'model':db[_0xcf0d('0xcd')],'as':_0xcf0d('0x102'),'attributes':[_0xcf0d('0x30'),_0xcf0d('0x103'),'internal'],'required':![]},{'model':db[_0xcf0d('0x104')],'as':'Tags','attributes':['id',_0xcf0d('0x30'),_0xcf0d('0x105')],'where':_0x328747[_0xcf0d('0x50')][_0xcf0d('0x106')]?{'id':_0x328747['query'][_0xcf0d('0x106')]}:undefined,'required':_0x328747[_0xcf0d('0x50')][_0xcf0d('0x106')]?!![]:![]}];}return db['ChatInteraction'][_0xcf0d('0x60')](_0x18eb0e);})[_0xcf0d('0x19')](function(_0x21ad92){_0x8385d4[_0xcf0d('0x61')]=_0x21ad92;return _0x8385d4;});}})[_0xcf0d('0x19')](respondWithFilteredResult(_0x39e08,_0x18eb0e))[_0xcf0d('0x21')](handleError(_0x39e08,null));};exports[_0xcf0d('0x107')]=function(_0x3d1e7d,_0x2c9bdb){var _0x421506=0x0;var _0x5325a2=0x0;var _0x385260=![];var _0x113428;var _0x5dbc94;return db['ChatWebsite']['find']({'where':{'id':_0x3d1e7d[_0xcf0d('0x71')]['id']},'include':[{'model':db[_0xcf0d('0xb2')],'as':'Interval','include':[{'model':db[_0xcf0d('0xb2')],'as':_0xcf0d('0xb3'),'attributes':['id',_0xcf0d('0xb4')]}]}]})[_0xcf0d('0x19')](handleEntityNotFound(_0x2c9bdb,null))['then'](function(_0x4f04f4){if(_0x4f04f4){_0x113428=_0x4f04f4;return _0x4f04f4[_0xcf0d('0x108')]({'raw':!![]});}})[_0xcf0d('0x19')](function(_0x3eb2bc){if(_0x113428){if(_0x3eb2bc){_0x5dbc94=_0x3eb2bc;}}return require('../../config/license/util')['getLicense']();})['then'](function(_0x11371f){if(_0x11371f){_0x5325a2=_0x11371f['virtual'];_0x385260=_0x11371f['custom'];}})[_0xcf0d('0x19')](function(){return db[_0xcf0d('0xbf')][_0xcf0d('0x5d')]({'where':{'closed':![]}});})[_0xcf0d('0x19')](function(_0x1c5851){_0x421506=_0x1c5851;if(_0x5325a2&&_0x1c5851>_0x5325a2){return db['License']['findOne']({'where':{'id':0x1}})['then'](function(_0x1bf0e1){if(_0x1bf0e1){_0x1bf0e1['increment'](_0xcf0d('0x109'));}});}})[_0xcf0d('0x19')](function(){var _0x27b100=_0x113428[_0xcf0d('0xb2')];var _0xe6beff=_0x113428['timezone']||undefined;return _0x27b100?_0x27b100[_0xcf0d('0x9d')](_0xe6beff):!![];})[_0xcf0d('0x19')](function(_0x5b0c7a){var _0x42ccba=fs[_0xcf0d('0xe2')](path[_0xcf0d('0x8f')](config[_0xcf0d('0x88')],'server/files/chat/iframe.ejs'),_0xcf0d('0xe3'));var _0x4d1d3f=_0xcf0d('0x10a');var _0x456623=![];try{const _0x50071e=new URL(_0x113428[_0xcf0d('0x67')]);_0x113428['address']=_0x50071e[_0xcf0d('0x10b')];}catch(_0x254d29){}var _0xf519ad;if(_0x3d1e7d[_0xcf0d('0xbd')]['referer']){_0x3d1e7d[_0xcf0d('0xbd')]['referer']=_0x3d1e7d['headers']['referer'][_0xcf0d('0x10c')](/\/$/,'');_0xf519ad=wildcardUtils[_0xcf0d('0x10d')](_0x113428['address'],_0x3d1e7d[_0xcf0d('0xbd')][_0xcf0d('0xa5')]);}else{_0x3d1e7d[_0xcf0d('0xbd')][_0xcf0d('0xa5')]=_0x113428[_0xcf0d('0x67')];_0xf519ad=!![];}var _0xd2ed65={'chatVersion':_0x4d1d3f,'chatWebsiteAddressOrigin':_0xf519ad?_0x3d1e7d[_0xcf0d('0xbd')][_0xcf0d('0xa5')]:_0x113428[_0xcf0d('0x67')],'remote':_0x113428[_0xcf0d('0x10e')],'query':querystring[_0xcf0d('0x48')](_['merge'](_0x113428[_0xcf0d('0x6b')]({'plain':!![]}),{'customerIp':_0x3d1e7d[_0xcf0d('0xbd')]['x-forwarded-for']||_0x3d1e7d['headers'][_0xcf0d('0x10f')]||_0x3d1e7d[_0xcf0d('0x110')][_0xcf0d('0x111')]||_0x3d1e7d['ip'],'referer':_0x3d1e7d['headers'][_0xcf0d('0xa5')],'openedInteractions':_0x421506,'maxInteractions':_0x5325a2,'virtual':_0x385260['virtual'],'online':_0x5b0c7a,'custom':_0x385260,'address':_0xf519ad?_0x3d1e7d[_0xcf0d('0xbd')][_0xcf0d('0xa5')]:null}))[_0xcf0d('0x10c')](/'/g,'\x5c\x27')};_0x2c9bdb['send'](ejs['render'](Mustache[_0xcf0d('0xe4')](_0x42ccba,_0xd2ed65),{'proactiveActions':_0x5dbc94,'alignment':_0x113428[_0xcf0d('0x112')],'verticalAlignment':_0x113428[_0xcf0d('0x113')],'div_color':_0x113428[_0xcf0d('0x105')],'labelText':_0x113428[_0xcf0d('0x114')],'text_color':_0x113428[_0xcf0d('0x115')],'text_button_color':_0x113428[_0xcf0d('0x116')],'button_color':_0x113428['color_button'],'background_color':_0x113428['backgroundColor'],'hideWhenOffline':_0x113428[_0xcf0d('0x117')],'intervalId':_0x113428[_0xcf0d('0x118')],'isDevelopment':_0x456623,'chatVersion':_0x4d1d3f}));})['catch'](handleError(_0x2c9bdb,null));};exports[_0xcf0d('0x119')]=function(_0x29fd78,_0x10a543){var _0xd89280=_0x29fd78[_0xcf0d('0x71')]['id'];var _0x58b7c7=_0x29fd78[_0xcf0d('0x66')];var _0x576aad=0xc8;var _0x478901=null;return db[_0xcf0d('0xeb')][_0xcf0d('0x11a')]({'isolationLevel':db[_0xcf0d('0xeb')][_0xcf0d('0x11b')][_0xcf0d('0x11c')][_0xcf0d('0x11d')]},function(_0x255e83){return db[_0xcf0d('0x4d')]['findOne']({'where':{'id':_0xd89280},'transaction':_0x255e83})[_0xcf0d('0x19')](function(_0x39b900){if(_0x39b900){return db[_0xcf0d('0xb0')][_0xcf0d('0x2c')]({'where':{'ChatWebsiteId':_0xd89280},'transaction':_0x255e83})[_0xcf0d('0x19')](function(){var _0x2ec86b=_[_0xcf0d('0x4c')](_0x58b7c7,function(_0x45e45d){_0x45e45d[_0xcf0d('0x73')]=_0xd89280;return _0x45e45d;});return db[_0xcf0d('0xb0')][_0xcf0d('0x11e')](_0x2ec86b,{'transaction':_0x255e83});});}else{_0x576aad=0x194;_0x478901=[];}});})[_0xcf0d('0x19')](function(){if(_0x576aad!==0x194){return db[_0xcf0d('0xb0')][_0xcf0d('0x11f')]({'where':{'ChatWebsiteId':_0xd89280},'order':_0xcf0d('0xb8')})[_0xcf0d('0x19')](function(_0x5dfd18){_0x478901=_0x5dfd18;});}})[_0xcf0d('0x21')](function(_0x1bc840){_0x576aad=0x1f4;logger['error'](_0x1bc840[_0xcf0d('0x2f')]);if(_0x1bc840['name']){delete _0x1bc840['name'];}_0x478901=_0x1bc840;})[_0xcf0d('0x120')](function(){if(_0x478901===null){_0x10a543[_0xcf0d('0x2e')](_0x576aad);}else{if(_0x576aad===0x1f4){_0x10a543['status'](_0x576aad)[_0xcf0d('0x31')](_0x478901);}else{_0x10a543['status'](_0x576aad)['json'](_0x478901);}}});};exports[_0xcf0d('0x121')]=function(_0xb79096,_0x5df1e6){var _0x6cf98={};var _0x257d36={};var _0x11bf7a;var _0x31bdc7;return db[_0xcf0d('0x4d')][_0xcf0d('0x75')]({'where':{'id':_0xb79096['params']['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x5df1e6,null))[_0xcf0d('0x19')](function(_0x59a68a){if(_0x59a68a){_0x11bf7a=_0x59a68a;_0x257d36[_0xcf0d('0x44')]=_[_0xcf0d('0x63')](db[_0xcf0d('0xb0')][_0xcf0d('0x76')]);_0x257d36['query']=_['keys'](_0xb79096['query']);_0x257d36[_0xcf0d('0x51')]=_['intersection'](_0x257d36['model'],_0x257d36[_0xcf0d('0x50')]);_0x6cf98[_0xcf0d('0x53')]=_['intersection'](_0x257d36[_0xcf0d('0x44')],qs[_0xcf0d('0x54')](_0xb79096[_0xcf0d('0x50')][_0xcf0d('0x54')]));_0x6cf98[_0xcf0d('0x53')]=_0x6cf98[_0xcf0d('0x53')]['length']?_0x6cf98[_0xcf0d('0x53')]:_0x257d36['model'];_0x6cf98[_0xcf0d('0x78')]=qs['sort'](_0xb79096[_0xcf0d('0x50')][_0xcf0d('0x56')]);_0x6cf98['where']=qs[_0xcf0d('0x51')](_[_0xcf0d('0x58')](_0xb79096[_0xcf0d('0x50')],_0x257d36[_0xcf0d('0x51')]));if(_0xb79096[_0xcf0d('0x50')]['filter']){_0x6cf98['where']=_[_0xcf0d('0x5a')](_0x6cf98[_0xcf0d('0x57')],{'$or':_[_0xcf0d('0x4c')](_0x6cf98[_0xcf0d('0x53')],function(_0x3a5580){var _0x381531={};_0x381531[_0x3a5580]={'$like':'%'+_0xb79096['query'][_0xcf0d('0x59')]+'%'};return _0x381531;})});}_0x6cf98=_['merge']({},_0x6cf98,_0xb79096['options']);return _0x11bf7a['getApplications'](_0x6cf98);}})[_0xcf0d('0x19')](function(_0x5090c4){if(_0x5090c4){_0x31bdc7=_0x5090c4['length'];if(!_0xb79096[_0xcf0d('0x50')][_0xcf0d('0x77')]('nolimit')){_0x6cf98[_0xcf0d('0x26')]=qs[_0xcf0d('0x26')](_0xb79096[_0xcf0d('0x50')][_0xcf0d('0x26')]);_0x6cf98[_0xcf0d('0x24')]=qs[_0xcf0d('0x24')](_0xb79096[_0xcf0d('0x50')][_0xcf0d('0x24')]);}return _0x11bf7a[_0xcf0d('0x121')](_0x6cf98);}})[_0xcf0d('0x19')](function(_0x5ac60){if(_0x5ac60){return _0x5ac60?{'count':_0x31bdc7,'rows':_0x5ac60}:null;}})[_0xcf0d('0x19')](respondWithResult(_0x5df1e6,null))['catch'](handleError(_0x5df1e6,null));};exports[_0xcf0d('0x122')]=function(_0x3e5e00,_0x7fcd3a){return db[_0xcf0d('0x123')]['find']({'where':{'id':_0x3e5e00[_0xcf0d('0x71')]['id']}})['then'](handleEntityNotFound(_0x7fcd3a,null))['then'](function(_0x563d87){if(_0x563d87){return _0x563d87['addProactiveActions'](_0x3e5e00[_0xcf0d('0x66')][_0xcf0d('0x7e')],_[_0xcf0d('0xfe')](_0x3e5e00[_0xcf0d('0x66')],['ids','id'])||{});}})[_0xcf0d('0x19')](respondWithResult(_0x7fcd3a,null))[_0xcf0d('0x21')](handleError(_0x7fcd3a,null));};exports[_0xcf0d('0x108')]=function(_0x1523cb,_0x433c28){var _0x215116={};var _0x502b9b={};var _0x1dfd82;var _0x1f3ae6;return db[_0xcf0d('0x4d')]['findOne']({'where':{'id':_0x1523cb[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x433c28,null))[_0xcf0d('0x19')](function(_0x432bff){if(_0x432bff){_0x1dfd82=_0x432bff;_0x502b9b[_0xcf0d('0x44')]=_['keys'](db[_0xcf0d('0x124')]['rawAttributes']);_0x502b9b['query']=_[_0xcf0d('0x63')](_0x1523cb[_0xcf0d('0x50')]);_0x502b9b[_0xcf0d('0x51')]=_['intersection'](_0x502b9b[_0xcf0d('0x44')],_0x502b9b[_0xcf0d('0x50')]);_0x215116[_0xcf0d('0x53')]=_[_0xcf0d('0x52')](_0x502b9b[_0xcf0d('0x44')],qs[_0xcf0d('0x54')](_0x1523cb['query']['fields']));_0x215116[_0xcf0d('0x53')]=_0x215116['attributes']['length']?_0x215116[_0xcf0d('0x53')]:_0x502b9b[_0xcf0d('0x44')];_0x215116[_0xcf0d('0x78')]=qs[_0xcf0d('0x56')](_0x1523cb[_0xcf0d('0x50')][_0xcf0d('0x56')]);_0x215116[_0xcf0d('0x57')]=qs[_0xcf0d('0x51')](_[_0xcf0d('0x58')](_0x1523cb[_0xcf0d('0x50')],_0x502b9b[_0xcf0d('0x51')]));if(_0x1523cb['query'][_0xcf0d('0x59')]){_0x215116['where']=_[_0xcf0d('0x5a')](_0x215116[_0xcf0d('0x57')],{'$or':_[_0xcf0d('0x4c')](_0x215116[_0xcf0d('0x53')],function(_0x9652b6){var _0x297e90={};_0x297e90[_0x9652b6]={'$like':'%'+_0x1523cb[_0xcf0d('0x50')][_0xcf0d('0x59')]+'%'};return _0x297e90;})});}_0x215116=_['merge']({},_0x215116,_0x1523cb['options']);return _0x1dfd82[_0xcf0d('0x108')](_0x215116);}})[_0xcf0d('0x19')](function(_0x45ea75){if(_0x45ea75){_0x1f3ae6=_0x45ea75[_0xcf0d('0x55')];if(!_0x1523cb[_0xcf0d('0x50')][_0xcf0d('0x77')](_0xcf0d('0x100'))){_0x215116[_0xcf0d('0x26')]=qs[_0xcf0d('0x26')](_0x1523cb['query'][_0xcf0d('0x26')]);_0x215116[_0xcf0d('0x24')]=qs[_0xcf0d('0x24')](_0x1523cb[_0xcf0d('0x50')]['offset']);}return _0x1dfd82[_0xcf0d('0x108')](_0x215116);}})[_0xcf0d('0x19')](function(_0x3c411c){if(_0x3c411c){return _0x3c411c?{'count':_0x1f3ae6,'rows':_0x3c411c}:null;}})['then'](respondWithResult(_0x433c28,null))['catch'](handleError(_0x433c28,null));};exports[_0xcf0d('0x125')]=function(_0x39e3a7,_0x34390d){var _0x2f5395=_0x39e3a7[_0xcf0d('0x50')][_0xcf0d('0x126')]==='false'?_0xcf0d('0x127'):'onlineForm';return db[_0xcf0d('0x4d')][_0xcf0d('0x64')]({'attributes':['id',_0x2f5395],'where':{'id':_0x39e3a7[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x34390d,null))[_0xcf0d('0x19')](function(_0x5200a0){if(_0x5200a0){var _0xd08eca=_0x5200a0[_0x2f5395];var _0xaf0c39=_0xd08eca&&_0xd08eca[_0xcf0d('0x128')]?_0xd08eca['items']:[];_0x34390d[_0xcf0d('0x31')]({'fromKey':_[_0xcf0d('0x8d')](_0xd08eca[_0xcf0d('0x129')])?undefined:_0xd08eca[_0xcf0d('0x129')],'count':_0xaf0c39['length'],'rows':_0xaf0c39});}})['catch'](handleError(_0x34390d,null));};exports[_0xcf0d('0x12a')]=function(_0x3fba0d,_0x34e6e0){var _0x245eb3={'raw':![],'where':{}};var _0x387775={};var _0x42e556={'count':0x0,'rows':[]};return db[_0xcf0d('0x4d')]['findOne']({'where':{'id':_0x3fba0d[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x34e6e0,null))[_0xcf0d('0x19')](function(_0x128c08){if(_0x128c08){_0x387775[_0xcf0d('0x44')]=_['keys'](db[_0xcf0d('0x12b')][_0xcf0d('0x76')]);_0x387775['query']=_[_0xcf0d('0x63')](_0x3fba0d[_0xcf0d('0x50')]);_0x387775[_0xcf0d('0x51')]=_[_0xcf0d('0x52')](_0x387775[_0xcf0d('0x44')],_0x387775[_0xcf0d('0x50')]);_0x245eb3['attributes']=_[_0xcf0d('0x52')](_0x387775[_0xcf0d('0x44')],qs[_0xcf0d('0x54')](_0x3fba0d[_0xcf0d('0x50')][_0xcf0d('0x54')]));_0x245eb3[_0xcf0d('0x53')]=_0x245eb3[_0xcf0d('0x53')]['length']?_0x245eb3['attributes']:_0x387775[_0xcf0d('0x44')];if(!_0x3fba0d[_0xcf0d('0x50')]['hasOwnProperty']('nolimit')){_0x245eb3[_0xcf0d('0x26')]=qs[_0xcf0d('0x26')](_0x3fba0d[_0xcf0d('0x50')][_0xcf0d('0x26')]);_0x245eb3[_0xcf0d('0x24')]=qs[_0xcf0d('0x24')](_0x3fba0d['query'][_0xcf0d('0x24')]);}_0x245eb3[_0xcf0d('0x78')]=qs[_0xcf0d('0x56')](_0x3fba0d[_0xcf0d('0x50')][_0xcf0d('0x56')]);_0x245eb3[_0xcf0d('0x57')]=qs[_0xcf0d('0x51')](_[_0xcf0d('0x58')](_0x3fba0d['query'],_0x387775[_0xcf0d('0x51')]));_0x245eb3['where']['ChatWebsiteId']=_0x128c08['id'];if(_0x3fba0d[_0xcf0d('0x50')][_0xcf0d('0x59')]){_0x245eb3[_0xcf0d('0x57')]=_[_0xcf0d('0x5a')](_0x245eb3[_0xcf0d('0x57')],{'$or':_[_0xcf0d('0x4c')](_0x245eb3['attributes'],function(_0x4a9087){var _0x235247={};_0x235247[_0x4a9087]={'$like':'%'+_0x3fba0d[_0xcf0d('0x50')][_0xcf0d('0x59')]+'%'};return _0x235247;})});}_0x245eb3=_[_0xcf0d('0x5a')]({},_0x245eb3,_0x3fba0d[_0xcf0d('0x5c')]);return db[_0xcf0d('0x12b')][_0xcf0d('0x5d')]({'where':_0x245eb3[_0xcf0d('0x57')]})['then'](function(_0x517969){_0x42e556['count']=_0x517969;if(_0x3fba0d[_0xcf0d('0x50')][_0xcf0d('0x5e')]){_0x245eb3['include']=[{'all':!![]}];}else{_0x245eb3[_0xcf0d('0x5f')]=[{'model':db[_0xcf0d('0xad')],'as':_0xcf0d('0x101'),'required':![]},{'model':db[_0xcf0d('0xec')],'as':_0xcf0d('0x12c'),'required':![]}];}return db[_0xcf0d('0x12b')][_0xcf0d('0x60')](_0x245eb3);})['then'](function(_0x156542){_0x42e556[_0xcf0d('0x61')]=_0x156542;return _0x42e556;});}})['then'](respondWithFilteredResult(_0x34e6e0,_0x245eb3))['catch'](handleError(_0x34e6e0,null));};exports[_0xcf0d('0x12d')]=function(_0x517cfb,_0xcbb68d){return db[_0xcf0d('0x4d')]['find']({'where':{'id':_0x517cfb[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0xcbb68d,null))[_0xcf0d('0x19')](function(_0x40abe1){if(_0x40abe1){return _0x40abe1[_0xcf0d('0x12d')](_0x517cfb[_0xcf0d('0x66')][_0xcf0d('0x7e')],_[_0xcf0d('0xfe')](_0x517cfb[_0xcf0d('0x66')],[_0xcf0d('0x7e'),'id'])||{})[_0xcf0d('0xe1')](function(_0x1d19ec){for(var _0x510292=0x0;_0x510292<_0x517cfb[_0xcf0d('0x66')]['ids'][_0xcf0d('0x55')];_0x510292+=0x1){socket[_0xcf0d('0x12e')](_0xcf0d('0x12f'),{'UserId':Number(_0x517cfb[_0xcf0d('0x66')][_0xcf0d('0x7e')][_0x510292]),'ChatWebsiteId':Number(_0x517cfb['params']['id'])});}return _0x1d19ec;});}})[_0xcf0d('0x19')](respondWithResult(_0xcbb68d,null))['catch'](handleError(_0xcbb68d,null));};exports['removeAgents']=function(_0x3e6eae,_0x47624b){return db[_0xcf0d('0x4d')][_0xcf0d('0x64')]({'where':{'id':_0x3e6eae[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x47624b,null))['then'](function(_0x882df5){if(_0x882df5){return _0x882df5['removeAgents'](_0x3e6eae['query'][_0xcf0d('0x7e')])['then'](function(){if(_[_0xcf0d('0x130')](_0x3e6eae[_0xcf0d('0x50')][_0xcf0d('0x7e')])){for(var _0x4225e9=0x0;_0x4225e9<_0x3e6eae['query']['ids']['length'];_0x4225e9+=0x1){socket[_0xcf0d('0x12e')](_0xcf0d('0x131'),{'UserId':Number(_0x3e6eae[_0xcf0d('0x50')]['ids'][_0x4225e9]),'ChatWebsiteId':Number(_0x3e6eae[_0xcf0d('0x71')]['id'])});}}else{socket[_0xcf0d('0x12e')](_0xcf0d('0x131'),{'UserId':Number(_0x3e6eae['query'][_0xcf0d('0x7e')]),'ChatWebsiteId':Number(_0x3e6eae['params']['id'])});}});}})[_0xcf0d('0x19')](respondWithStatusCode(_0x47624b,null))[_0xcf0d('0x21')](handleError(_0x47624b,null));};exports[_0xcf0d('0x132')]=function(_0x4edb26,_0x1eaecc){var _0x12152e={};var _0x3cbc79={};var _0x4ebd42;var _0x4331ec;return db[_0xcf0d('0x4d')][_0xcf0d('0x75')]({'where':{'id':_0x4edb26[_0xcf0d('0x71')]['id']}})[_0xcf0d('0x19')](handleEntityNotFound(_0x1eaecc,null))[_0xcf0d('0x19')](function(_0x469418){if(_0x469418){_0x4ebd42=_0x469418;_0x3cbc79['model']=_[_0xcf0d('0x63')](db[_0xcf0d('0xcd')]['rawAttributes']);_0x3cbc79[_0xcf0d('0x50')]=_[_0xcf0d('0x63')](_0x4edb26[_0xcf0d('0x50')]);_0x3cbc79[_0xcf0d('0x51')]=_[_0xcf0d('0x52')](_0x3cbc79[_0xcf0d('0x44')],_0x3cbc79[_0xcf0d('0x50')]);_0x12152e[_0xcf0d('0x53')]=_['intersection'](_0x3cbc79['model'],qs[_0xcf0d('0x54')](_0x4edb26[_0xcf0d('0x50')]['fields']));_0x12152e['attributes']=_0x12152e[_0xcf0d('0x53')][_0xcf0d('0x55')]?_0x12152e['attributes']:_0x3cbc79[_0xcf0d('0x44')];_0x12152e['order']=qs[_0xcf0d('0x56')](_0x4edb26[_0xcf0d('0x50')][_0xcf0d('0x56')]);_0x12152e[_0xcf0d('0x57')]=qs[_0xcf0d('0x51')](_['pick'](_0x4edb26[_0xcf0d('0x50')],_0x3cbc79[_0xcf0d('0x51')]));if(_0x4edb26[_0xcf0d('0x50')][_0xcf0d('0x59')]){_0x12152e[_0xcf0d('0x57')]=_[_0xcf0d('0x5a')](_0x12152e[_0xcf0d('0x57')],{'$or':_[_0xcf0d('0x4c')](_0x12152e[_0xcf0d('0x53')],function(_0x281fa2){var _0x14aab8={};_0x14aab8[_0x281fa2]={'$like':'%'+_0x4edb26['query'][_0xcf0d('0x59')]+'%'};return _0x14aab8;})});}_0x12152e=_[_0xcf0d('0x5a')]({},_0x12152e,_0x4edb26[_0xcf0d('0x5c')]);return _0x4ebd42['getAgents'](_0x12152e);}})[_0xcf0d('0x19')](function(_0x296d46){if(_0x296d46){_0x4331ec=_0x296d46['length'];if(!_0x4edb26['query']['hasOwnProperty'](_0xcf0d('0x100'))){_0x12152e[_0xcf0d('0x26')]=qs[_0xcf0d('0x26')](_0x4edb26[_0xcf0d('0x50')][_0xcf0d('0x26')]);_0x12152e[_0xcf0d('0x24')]=qs[_0xcf0d('0x24')](_0x4edb26[_0xcf0d('0x50')][_0xcf0d('0x24')]);}return _0x4ebd42['getAgents'](_0x12152e);}})[_0xcf0d('0x19')](function(_0x346296){if(_0x346296){return _0x346296?{'count':_0x4331ec,'rows':_0x346296}:null;}})['then'](respondWithResult(_0x1eaecc,null))[_0xcf0d('0x21')](handleError(_0x1eaecc,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 9a564fd..45b188c 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 _0x0207=['remove','hasOwnProperty','hook','exports','../../mysqldb','save','update'];(function(_0x52bb1e,_0x47c818){var _0x15d57d=function(_0x551cd3){while(--_0x551cd3){_0x52bb1e['push'](_0x52bb1e['shift']());}};_0x15d57d(++_0x47c818);}(_0x0207,0x162));var _0x7020=function(_0x1848c0,_0xbe5c3){_0x1848c0=_0x1848c0-0x0;var _0x137cb5=_0x0207[_0x1848c0];return _0x137cb5;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x7020('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7020('0x1'),'afterUpdate':_0x7020('0x2'),'afterDestroy':_0x7020('0x3')};function emitEvent(_0x15db09){return function(_0x2e62fd,_0x25174b,_0x1066dd){ChatWebsiteEvents['emit'](_0x15db09+':'+_0x2e62fd['id'],_0x2e62fd);ChatWebsiteEvents['emit'](_0x15db09,_0x2e62fd);_0x1066dd(null);};}for(var e in events){if(events[_0x7020('0x4')](e)){var event=events[e];ChatWebsite[_0x7020('0x5')](e,emitEvent(event));}}module[_0x7020('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x581a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x55a629,_0x212491){var _0x67f2c2=function(_0x521661){while(--_0x521661){_0x55a629['push'](_0x55a629['shift']());}};_0x67f2c2(++_0x212491);}(_0x581a,0x127));var _0xa581=function(_0x31e4b6,_0x57e422){_0x31e4b6=_0x31e4b6-0x0;var _0x4e339b=_0x581a[_0x31e4b6];return _0x4e339b;};'use strict';var EventEmitter=require(_0xa581('0x0'));var ChatWebsite=require(_0xa581('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa581('0x2')](0x0);var events={'afterCreate':_0xa581('0x3'),'afterUpdate':_0xa581('0x4'),'afterDestroy':_0xa581('0x5')};function emitEvent(_0x3f5c21){return function(_0x4e64cc,_0x4e65d7,_0x198faf){ChatWebsiteEvents['emit'](_0x3f5c21+':'+_0x4e64cc['id'],_0x4e64cc);ChatWebsiteEvents[_0xa581('0x6')](_0x3f5c21,_0x4e64cc);_0x198faf(null);};}for(var e in events){if(events[_0xa581('0x7')](e)){var event=events[e];ChatWebsite[_0xa581('0x8')](e,emitEvent(event));}}module[_0xa581('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 5d22bc1..89b4e8b 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 _0xdc1a=['request-promise','rimraf','./chatWebsite.attributes','exports','define','chat_websites','lodash','util','moment','bluebird'];(function(_0x2ac060,_0x24b1c5){var _0x32174a=function(_0x369d12){while(--_0x369d12){_0x2ac060['push'](_0x2ac060['shift']());}};_0x32174a(++_0x24b1c5);}(_0xdc1a,0x1f0));var _0xadc1=function(_0x5c187a,_0x564285){_0x5c187a=_0x5c187a-0x0;var _0x109ed8=_0xdc1a[_0x5c187a];return _0x109ed8;};'use strict';var _=require(_0xadc1('0x0'));var util=require(_0xadc1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xadc1('0x2'));var BPromise=require(_0xadc1('0x3'));var rp=require(_0xadc1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadc1('0x5'));var config=require('../../config/environment');var attributes=require(_0xadc1('0x6'));module[_0xadc1('0x7')]=function(_0x52b0fd,_0x19e897){return _0x52b0fd[_0xadc1('0x8')]('ChatWebsite',attributes,{'tableName':_0xadc1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed95=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x1fc4e2,_0x493c3b){var _0x2ba184=function(_0x58e64f){while(--_0x58e64f){_0x1fc4e2['push'](_0x1fc4e2['shift']());}};_0x2ba184(++_0x493c3b);}(_0xed95,0x1bf));var _0x5ed9=function(_0x30b8f2,_0x5c904f){_0x30b8f2=_0x30b8f2-0x0;var _0xfc4ea2=_0xed95[_0x30b8f2];return _0xfc4ea2;};'use strict';var _=require(_0x5ed9('0x0'));var util=require(_0x5ed9('0x1'));var logger=require(_0x5ed9('0x2'))(_0x5ed9('0x3'));var moment=require(_0x5ed9('0x4'));var BPromise=require(_0x5ed9('0x5'));var rp=require(_0x5ed9('0x6'));var fs=require('fs');var path=require(_0x5ed9('0x7'));var rimraf=require(_0x5ed9('0x8'));var config=require(_0x5ed9('0x9'));var attributes=require('./chatWebsite.attributes');module[_0x5ed9('0xa')]=function(_0x38e6fd,_0x2a2c8e){return _0x38e6fd[_0x5ed9('0xb')](_0x5ed9('0xc'),attributes,{'tableName':_0x5ed9('0xd'),'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 cf347e3..697eb5c 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 _0xe44d=['moment','bluebird','randomstring','../../config/logger','client','http','redis','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','util'];(function(_0x20b577,_0x38f6d1){var _0xf3e247=function(_0x3db409){while(--_0x3db409){_0x20b577['push'](_0x20b577['shift']());}};_0xf3e247(++_0x38f6d1);}(_0xe44d,0xfb));var _0xde44=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xe44d[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var util=require(_0xde44('0x0'));var moment=require(_0xde44('0x1'));var BPromise=require(_0xde44('0x2'));var rs=require(_0xde44('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xde44('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xde44('0x5')][_0xde44('0x6')]({'port':0x232a});config[_0xde44('0x7')]=_['defaults'](config[_0xde44('0x7')],{'host':_0xde44('0x8'),'port':0x18eb});var socket=require(_0xde44('0x9'))(new Redis(config['redis']));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0xc8d5fb,_0x3a88f6,_0x486898){return new BPromise(function(_0x29b0c3,_0x3cf7da){return client[_0xde44('0xa')](_0xc8d5fb,_0x486898)[_0xde44('0xb')](function(_0x408e3c){logger[_0xde44('0xc')]('ChatWebsite,\x20%s,\x20%s',_0x3a88f6,_0xde44('0xd'));logger[_0xde44('0xe')](_0xde44('0xf'),_0x3a88f6,'request\x20sent',JSON['stringify'](_0x408e3c));if(_0x408e3c[_0xde44('0x10')]){if(_0x408e3c[_0xde44('0x10')]['code']===0x1f4){logger[_0xde44('0x10')](_0xde44('0x11'),_0x3a88f6,_0x408e3c[_0xde44('0x10')][_0xde44('0x12')]);return _0x3cf7da(_0x408e3c[_0xde44('0x10')][_0xde44('0x12')]);}logger[_0xde44('0x10')](_0xde44('0x11'),_0x3a88f6,_0x408e3c['error']['message']);return _0x29b0c3(_0x408e3c[_0xde44('0x10')]['message']);}else{logger[_0xde44('0xc')](_0xde44('0x11'),_0x3a88f6,'request\x20sent');_0x29b0c3(_0x408e3c[_0xde44('0x13')]['message']);}})[_0xde44('0x14')](function(_0x222d83){logger['error'](_0xde44('0x11'),_0x3a88f6,_0x222d83);_0x3cf7da(_0x222d83);});});} \ No newline at end of file +var _0x109b=['redis','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http'];(function(_0x3bb144,_0x4a871e){var _0x42887f=function(_0x4ebb13){while(--_0x4ebb13){_0x3bb144['push'](_0x3bb144['shift']());}};_0x42887f(++_0x4a871e);}(_0x109b,0xd8));var _0xb109=function(_0x1c8c62,_0x4331b2){_0x1c8c62=_0x1c8c62-0x0;var _0x6cb6cd=_0x109b[_0x1c8c62];return _0x6cb6cd;};'use strict';var _=require(_0xb109('0x0'));var util=require('util');var moment=require(_0xb109('0x1'));var BPromise=require(_0xb109('0x2'));var rs=require(_0xb109('0x3'));var fs=require('fs');var Redis=require(_0xb109('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb109('0x5'));var logger=require(_0xb109('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb109('0x7')][_0xb109('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb109('0x9')],{'host':_0xb109('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb109('0x9')]));require(_0xb109('0xb'))[_0xb109('0xc')](socket);function respondWithRpcPromise(_0x4f3af4,_0x268bfb,_0x394371){return new BPromise(function(_0x1f58a1,_0x2572c0){return client[_0xb109('0xd')](_0x4f3af4,_0x394371)[_0xb109('0xe')](function(_0x5adbf8){logger[_0xb109('0xf')](_0xb109('0x10'),_0x268bfb,'request\x20sent');logger[_0xb109('0x11')](_0xb109('0x12'),_0x268bfb,_0xb109('0x13'),JSON['stringify'](_0x5adbf8));if(_0x5adbf8[_0xb109('0x14')]){if(_0x5adbf8[_0xb109('0x14')][_0xb109('0x15')]===0x1f4){logger[_0xb109('0x14')](_0xb109('0x10'),_0x268bfb,_0x5adbf8['error'][_0xb109('0x16')]);return _0x2572c0(_0x5adbf8[_0xb109('0x14')]['message']);}logger[_0xb109('0x14')](_0xb109('0x10'),_0x268bfb,_0x5adbf8[_0xb109('0x14')][_0xb109('0x16')]);return _0x1f58a1(_0x5adbf8[_0xb109('0x14')]['message']);}else{logger[_0xb109('0xf')](_0xb109('0x10'),_0x268bfb,'request\x20sent');_0x1f58a1(_0x5adbf8[_0xb109('0x17')][_0xb109('0x16')]);}})[_0xb109('0x18')](function(_0x187029){logger['error'](_0xb109('0x10'),_0x268bfb,_0x187029);_0x2572c0(_0x187029);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e129b99..609a427 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 _0xbc7a=['update','emit','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xbc7a,0xdd));var _0xabc7=function(_0x2e9f8e,_0x3eafc1){_0x2e9f8e=_0x2e9f8e-0x0;var _0x2e7192=_0xbc7a[_0x2e9f8e];return _0x2e7192;};'use strict';var ChatWebsiteEvents=require(_0xabc7('0x0'));var events=[_0xabc7('0x1'),_0xabc7('0x2'),_0xabc7('0x3')];function createListener(_0x3c85d2,_0x3e53be){return function(_0x1d9e72){_0x3e53be[_0xabc7('0x4')](_0x3c85d2,_0x1d9e72);};}function removeListener(_0x168700,_0x5b750f){return function(){ChatWebsiteEvents['removeListener'](_0x168700,_0x5b750f);};}exports['register']=function(_0x3cd907){for(var _0x77f25d=0x0,_0x425321=events[_0xabc7('0x5')];_0x77f25d<_0x425321;_0x77f25d++){var _0x5d1b8b=events[_0x77f25d];var _0x170c23=createListener(_0xabc7('0x6')+_0x5d1b8b,_0x3cd907);ChatWebsiteEvents['on'](_0x5d1b8b,_0x170c23);}}; \ No newline at end of file +var _0xa5d3=['emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x19311a,_0x2d2679){var _0x42617c=function(_0x43227d){while(--_0x43227d){_0x19311a['push'](_0x19311a['shift']());}};_0x42617c(++_0x2d2679);}(_0xa5d3,0xfd));var _0x3a5d=function(_0x1d5cfa,_0x57efb0){_0x1d5cfa=_0x1d5cfa-0x0;var _0x19a273=_0xa5d3[_0x1d5cfa];return _0x19a273;};'use strict';var ChatWebsiteEvents=require(_0x3a5d('0x0'));var events=['save',_0x3a5d('0x1'),_0x3a5d('0x2')];function createListener(_0x4f931b,_0x379007){return function(_0x389566){_0x379007[_0x3a5d('0x3')](_0x4f931b,_0x389566);};}function removeListener(_0x1be207,_0x24df84){return function(){ChatWebsiteEvents[_0x3a5d('0x4')](_0x1be207,_0x24df84);};}exports[_0x3a5d('0x5')]=function(_0x5eab9e){for(var _0x4b4c57=0x0,_0x24b63c=events[_0x3a5d('0x6')];_0x4b4c57<_0x24b63c;_0x4b4c57++){var _0x5851ca=events[_0x4b4c57];var _0x549fa2=createListener(_0x3a5d('0x7')+_0x5851ca,_0x5eab9e);ChatWebsiteEvents['on'](_0x5851ca,_0x549fa2);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index ca076de..913f04f 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4fb=['../../../utils/misc','escapeRegExp','url','URL','replace','localhost','([\x5cw]+)','test'];(function(_0x1528c6,_0x6d8317){var _0x149cb5=function(_0xfea5b3){while(--_0xfea5b3){_0x1528c6['push'](_0x1528c6['shift']());}};_0x149cb5(++_0x6d8317);}(_0xa4fb,0x150));var _0xba4f=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0xa4fb[_0xfb0cfd];return _0x2fd8aa;};var escapeRegExp=require(_0xba4f('0x0'))[_0xba4f('0x1')];var URL=require(_0xba4f('0x2'))[_0xba4f('0x3')];function testWildcardValidity(_0x569bf7){let _0x5d2269=!![];try{new URL(_0x569bf7[_0xba4f('0x4')]('*',_0xba4f('0x5')));}catch(_0x27a519){_0x5d2269=![];}return _0x5d2269&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x569bf7);}function testWebsiteWithWildcard(_0x413f97,_0x3dc285){let _0x379b0f;const _0x18baa8=escapeRegExp(_0x413f97)[_0xba4f('0x4')]('\x5c*',_0xba4f('0x6'));try{new URL(_0x413f97[_0xba4f('0x4')]('\x5c*',_0xba4f('0x5')));_0x379b0f=new RegExp(_0x18baa8)[_0xba4f('0x7')](_0x3dc285);}catch(_0x27f65a){_0x379b0f=![];}return _0x379b0f;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x3a25=['URL','replace','localhost','test','exports','../../../utils/misc','escapeRegExp','url'];(function(_0x48b4a1,_0x3c2bf4){var _0x2df379=function(_0x5962c1){while(--_0x5962c1){_0x48b4a1['push'](_0x48b4a1['shift']());}};_0x2df379(++_0x3c2bf4);}(_0x3a25,0x15d));var _0x53a2=function(_0x381a62,_0x3c0792){_0x381a62=_0x381a62-0x0;var _0x318df3=_0x3a25[_0x381a62];return _0x318df3;};var escapeRegExp=require(_0x53a2('0x0'))[_0x53a2('0x1')];var URL=require(_0x53a2('0x2'))[_0x53a2('0x3')];function testWildcardValidity(_0x23a126){let _0x8efef2=!![];try{new URL(_0x23a126[_0x53a2('0x4')]('*',_0x53a2('0x5')));}catch(_0x3f9730){_0x8efef2=![];}return _0x8efef2&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x53a2('0x6')](_0x23a126);}function testWebsiteWithWildcard(_0x4786e3,_0xe604c1){let _0x2b4011;const _0x346fc7=escapeRegExp(_0x4786e3)[_0x53a2('0x4')]('\x5c*','([\x5cw]+)');try{new URL(_0x4786e3[_0x53a2('0x4')]('\x5c*','localhost'));_0x2b4011=new RegExp(_0x346fc7)[_0x53a2('0x6')](_0xe604c1);}catch(_0x1f4de7){_0x2b4011=![];}return _0x2b4011;}module[_0x53a2('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index e465df3..5de6dd8 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 _0x4777=['/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/users','getAgents','post','create','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','now','addAvatar','addCustomerAvatar'];(function(_0x47c8ef,_0x3395d5){var _0x4dd012=function(_0x2ee9b0){while(--_0x2ee9b0){_0x47c8ef['push'](_0x47c8ef['shift']());}};_0x4dd012(++_0x3395d5);}(_0x4777,0x18f));var _0x7477=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x4777[_0x903228];return _0xcec81d;};'use strict';var multer=require('multer');var util=require(_0x7477('0x0'));var path=require(_0x7477('0x1'));var timeout=require(_0x7477('0x2'));var express=require(_0x7477('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7477('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7477('0x5'));var controller=require(_0x7477('0x6'));router[_0x7477('0x7')]('/',auth[_0x7477('0x8')](),controller['index']);router['get'](_0x7477('0x9'),auth[_0x7477('0x8')](),controller[_0x7477('0xa')]);router[_0x7477('0x7')](_0x7477('0xb'),auth[_0x7477('0x8')](),controller[_0x7477('0xc')]);router['get'](_0x7477('0xd'),auth[_0x7477('0x8')](),controller[_0x7477('0xe')]);router[_0x7477('0x7')](_0x7477('0xf'),auth[_0x7477('0x8')](),controller[_0x7477('0x10')]);router[_0x7477('0x7')]('/:id/logo',controller[_0x7477('0x11')]);router[_0x7477('0x7')](_0x7477('0x12'),controller[_0x7477('0x13')]);router[_0x7477('0x7')](_0x7477('0x14'),controller[_0x7477('0x15')]);router[_0x7477('0x7')]('/:id/system_avatar',controller[_0x7477('0x16')]);router[_0x7477('0x7')](_0x7477('0x17'),auth['isAuthenticated'](),controller[_0x7477('0x18')]);router[_0x7477('0x7')](_0x7477('0x19'),controller[_0x7477('0x1a')]);router[_0x7477('0x7')](_0x7477('0x1b'),auth[_0x7477('0x8')](),controller[_0x7477('0x1c')]);router[_0x7477('0x7')](_0x7477('0x1d'),auth[_0x7477('0x8')](),controller[_0x7477('0x1e')]);router[_0x7477('0x7')](_0x7477('0x1f'),controller['getFields']);router[_0x7477('0x7')]('/:id/offline_messages',auth['isAuthenticated'](),controller['getOfflineMessages']);router['get'](_0x7477('0x20'),auth[_0x7477('0x8')](),controller[_0x7477('0x21')]);router[_0x7477('0x22')]('/',auth[_0x7477('0x8')](),controller[_0x7477('0x23')]);router[_0x7477('0x22')](_0x7477('0xd'),auth[_0x7477('0x8')](),controller['addDisposition']);router[_0x7477('0x22')](_0x7477('0xf'),auth[_0x7477('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x7477('0x24')]({'destination':function(_0x1321ff,_0x3d8e3d,_0x2c43eb){_0x2c43eb(null,path[_0x7477('0x25')](config[_0x7477('0x26')],_0x7477('0x27')));},'filename':function(_0x5ab427,_0x594859,_0x79358d){_0x79358d(null,util[_0x7477('0x28')](_0x7477('0x29'),Date['now'](),_0x594859[_0x7477('0x2a')]));}})});router[_0x7477('0x22')](_0x7477('0x2b'),upload[_0x7477('0x2c')](_0x7477('0x2d')),controller[_0x7477('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5b607e,_0x94817c,_0x53783e){_0x53783e(null,path[_0x7477('0x25')](config[_0x7477('0x26')],_0x7477('0x2f')));},'filename':function(_0x56e815,_0x28f7e7,_0x2fab98){_0x2fab98(null,util['format'](_0x7477('0x29'),Date[_0x7477('0x30')](),_0x28f7e7[_0x7477('0x2a')]));}})});router[_0x7477('0x22')](_0x7477('0x12'),upload[_0x7477('0x2c')](_0x7477('0x2d')),controller[_0x7477('0x31')]);var upload=multer({'storage':multer[_0x7477('0x24')]({'destination':function(_0x47032e,_0x56dcfd,_0x713230){_0x713230(null,path['join'](config['root'],_0x7477('0x2f')));},'filename':function(_0x491d54,_0x715956,_0x42a39){_0x42a39(null,util['format'](_0x7477('0x29'),Date[_0x7477('0x30')](),_0x715956['originalname']));}})});router[_0x7477('0x22')]('/:id/customer_avatar',upload[_0x7477('0x2c')](_0x7477('0x2d')),controller[_0x7477('0x32')]);var upload=multer({'storage':multer[_0x7477('0x24')]({'destination':function(_0x5e355a,_0x415509,_0x2dad9c){_0x2dad9c(null,path[_0x7477('0x25')](config[_0x7477('0x26')],'server/files/images/avatars/'));},'filename':function(_0x3e7959,_0x3a33f3,_0x22ff31){_0x22ff31(null,util[_0x7477('0x28')](_0x7477('0x29'),Date['now'](),_0x3a33f3[_0x7477('0x2a')]));}})});router[_0x7477('0x22')](_0x7477('0x33'),upload[_0x7477('0x2c')](_0x7477('0x2d')),controller[_0x7477('0x34')]);router[_0x7477('0x22')](_0x7477('0x35'),controller[_0x7477('0x36')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x13d777,_0x1cac2b,_0x2c1417){const _0x521f94=path['join'](config['root'],_0x7477('0x37'),_0x7477('0x38'),_0x7477('0x39'));fs_extra[_0x7477('0x3a')](_0x521f94,function(){_0x2c1417(null,_0x521f94);});},'filename':function(_0x4850c6,_0xe476c2,_0x284f66){const _0x140976=_0xe476c2[_0x7477('0x2a')][_0x7477('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3ca7e7=path[_0x7477('0x3c')](_0x140976);const _0x186ecd=Date[_0x7477('0x30')]()+'-'+_0x140976[_0x7477('0x3b')](_0x3ca7e7,'')+_0x3ca7e7;_0x284f66(null,_0x186ecd);}})});router[_0x7477('0x22')](_0x7477('0x3d'),offlineUploadMulter[_0x7477('0x3e')](),controller[_0x7477('0x3f')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x7477('0x40')]);router[_0x7477('0x22')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7477('0x41')]);router['post'](_0x7477('0x1d'),auth[_0x7477('0x8')](),controller[_0x7477('0x42')]);router[_0x7477('0x22')](_0x7477('0x20'),auth[_0x7477('0x8')](),controller[_0x7477('0x43')]);router[_0x7477('0x44')](_0x7477('0xb'),auth[_0x7477('0x8')](),controller[_0x7477('0x45')]);router[_0x7477('0x46')]('/:id',auth[_0x7477('0x8')](),controller[_0x7477('0x47')]);router['delete'](_0x7477('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x7477('0x46')]('/:id/canned_answers',auth[_0x7477('0x8')](),controller[_0x7477('0x48')]);router[_0x7477('0x46')](_0x7477('0x20'),auth['isAuthenticated'](),controller[_0x7477('0x49')]);module[_0x7477('0x4a')]=router; \ No newline at end of file +var _0x70cf=['getCustomerAvatar','getSystemAvatar','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','create','post','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','now','originalname','file','server/files/images/avatars/','single','root','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','delete','removeDispositions','removeAnswers','removeAgents','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar'];(function(_0x8f15dd,_0x1b132c){var _0x6a2868=function(_0x51da5f){while(--_0x51da5f){_0x8f15dd['push'](_0x8f15dd['shift']());}};_0x6a2868(++_0x1b132c);}(_0x70cf,0x13c));var _0xf70c=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x70cf[_0xf2628e];return _0x13863a;};'use strict';var multer=require(_0xf70c('0x0'));var util=require('util');var path=require(_0xf70c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf70c('0x2')]();var fs_extra=require(_0xf70c('0x3'));var auth=require(_0xf70c('0x4'));var interaction=require(_0xf70c('0x5'));var config=require(_0xf70c('0x6'));var controller=require(_0xf70c('0x7'));router[_0xf70c('0x8')]('/',auth[_0xf70c('0x9')](),controller[_0xf70c('0xa')]);router[_0xf70c('0x8')]('/describe',auth[_0xf70c('0x9')](),controller['describe']);router[_0xf70c('0x8')](_0xf70c('0xb'),auth[_0xf70c('0x9')](),controller['show']);router[_0xf70c('0x8')](_0xf70c('0xc'),auth['isAuthenticated'](),controller[_0xf70c('0xd')]);router['get'](_0xf70c('0xe'),auth[_0xf70c('0x9')](),controller[_0xf70c('0xf')]);router[_0xf70c('0x8')]('/:id/logo',controller['getLogo']);router['get'](_0xf70c('0x10'),controller[_0xf70c('0x11')]);router['get'](_0xf70c('0x12'),controller[_0xf70c('0x13')]);router['get']('/:id/system_avatar',controller[_0xf70c('0x14')]);router[_0xf70c('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0xf70c('0x8')](_0xf70c('0x15'),controller[_0xf70c('0x16')]);router['get'](_0xf70c('0x17'),auth[_0xf70c('0x9')](),controller[_0xf70c('0x18')]);router[_0xf70c('0x8')](_0xf70c('0x19'),auth[_0xf70c('0x9')](),controller[_0xf70c('0x1a')]);router[_0xf70c('0x8')](_0xf70c('0x1b'),controller[_0xf70c('0x1c')]);router['get'](_0xf70c('0x1d'),auth[_0xf70c('0x9')](),controller[_0xf70c('0x1e')]);router['get']('/:id/users',auth[_0xf70c('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xf70c('0x1f')]);router[_0xf70c('0x20')](_0xf70c('0xc'),auth['isAuthenticated'](),controller[_0xf70c('0x21')]);router[_0xf70c('0x20')](_0xf70c('0xe'),auth['isAuthenticated'](),controller[_0xf70c('0x22')]);var upload=multer({'storage':multer[_0xf70c('0x23')]({'destination':function(_0x283dde,_0x1ff789,_0x141fd9){_0x141fd9(null,path[_0xf70c('0x24')](config['root'],_0xf70c('0x25')));},'filename':function(_0x3912cf,_0x357f09,_0x4dd63b){_0x4dd63b(null,util[_0xf70c('0x26')](_0xf70c('0x27'),Date[_0xf70c('0x28')](),_0x357f09[_0xf70c('0x29')]));}})});router[_0xf70c('0x20')]('/:id/logo',upload['single'](_0xf70c('0x2a')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1e8874,_0x416174,_0x213057){_0x213057(null,path[_0xf70c('0x24')](config['root'],_0xf70c('0x2b')));},'filename':function(_0x3e4894,_0x5a2112,_0x5ac3f2){_0x5ac3f2(null,util[_0xf70c('0x26')](_0xf70c('0x27'),Date[_0xf70c('0x28')](),_0x5a2112[_0xf70c('0x29')]));}})});router[_0xf70c('0x20')](_0xf70c('0x10'),upload[_0xf70c('0x2c')](_0xf70c('0x2a')),controller['addAvatar']);var upload=multer({'storage':multer[_0xf70c('0x23')]({'destination':function(_0x312d07,_0x7db7c8,_0x538bba){_0x538bba(null,path[_0xf70c('0x24')](config[_0xf70c('0x2d')],_0xf70c('0x2b')));},'filename':function(_0xbe6870,_0x2ab486,_0x5ddd36){_0x5ddd36(null,util[_0xf70c('0x26')](_0xf70c('0x27'),Date[_0xf70c('0x28')](),_0x2ab486[_0xf70c('0x29')]));}})});router[_0xf70c('0x20')]('/:id/customer_avatar',upload['single'](_0xf70c('0x2a')),controller[_0xf70c('0x2e')]);var upload=multer({'storage':multer[_0xf70c('0x23')]({'destination':function(_0x4ef891,_0x1dadcd,_0x13f79c){_0x13f79c(null,path[_0xf70c('0x24')](config['root'],_0xf70c('0x2b')));},'filename':function(_0x5eb0a6,_0x31ba62,_0x457fe2){_0x457fe2(null,util[_0xf70c('0x26')](_0xf70c('0x27'),Date[_0xf70c('0x28')](),_0x31ba62[_0xf70c('0x29')]));}})});router['post']('/:id/system_avatar',upload[_0xf70c('0x2c')]('file'),controller[_0xf70c('0x2f')]);router[_0xf70c('0x20')](_0xf70c('0x30'),controller[_0xf70c('0x31')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x19d10f,_0x270455,_0x555ba7){const _0x1ea3c8=path['join'](config[_0xf70c('0x2d')],_0xf70c('0x32'),_0xf70c('0x33'),'offline-chat');fs_extra['ensureDir'](_0x1ea3c8,function(){_0x555ba7(null,_0x1ea3c8);});},'filename':function(_0x5d614b,_0x473a94,_0x135d5e){const _0x1a943a=_0x473a94[_0xf70c('0x29')][_0xf70c('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x261385=path[_0xf70c('0x35')](_0x1a943a);const _0x33d42c=Date[_0xf70c('0x28')]()+'-'+_0x1a943a[_0xf70c('0x34')](_0x261385,'')+_0x261385;_0x135d5e(null,_0x33d42c);}})});router[_0xf70c('0x20')](_0xf70c('0x36'),offlineUploadMulter[_0xf70c('0x37')](),controller[_0xf70c('0x38')]);router['post'](_0xf70c('0x39'),auth[_0xf70c('0x9')](),controller[_0xf70c('0x3a')]);router[_0xf70c('0x20')]('/:id/applications',auth[_0xf70c('0x9')](),controller[_0xf70c('0x3b')]);router[_0xf70c('0x20')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xf70c('0x3c')]);router[_0xf70c('0x20')](_0xf70c('0x3d'),auth[_0xf70c('0x9')](),controller[_0xf70c('0x3e')]);router['put'](_0xf70c('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf70c('0x3f')](_0xf70c('0xb'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xf70c('0xc'),auth[_0xf70c('0x9')](),controller[_0xf70c('0x40')]);router[_0xf70c('0x3f')](_0xf70c('0xe'),auth['isAuthenticated'](),controller[_0xf70c('0x41')]);router[_0xf70c('0x3f')](_0xf70c('0x3d'),auth[_0xf70c('0x9')](),controller[_0xf70c('0x42')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 5e32e27..fece395 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 _0xb85f=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','exports','beaver-logger/server','express','env','production','get','client-side-logger'];(function(_0x4b420a,_0x37a42f){var _0x5e6392=function(_0x58c14e){while(--_0x58c14e){_0x4b420a['push'](_0x4b420a['shift']());}};_0x5e6392(++_0x37a42f);}(_0xb85f,0x10d));var _0xfb85=function(_0x444b29,_0x127582){_0x444b29=_0x444b29-0x0;var _0x428314=_0xb85f[_0x444b29];return _0x428314;};var beaverLogger=require(_0xfb85('0x0'));var express=require(_0xfb85('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0xfb85('0x2')]===_0xfb85('0x3')||![];function clientSideLogs(_0x25e064,_0x9dda23,_0x1494cd){var _0x5ada75=_0x25e064['app'][_0xfb85('0x4')](_0xfb85('0x5'));if(!_0x5ada75){throw new Error(_0xfb85('0x6'));}return beaverLogger[_0xfb85('0x7')]({'uri':_0xfb85('0x8'),'logger':_0x5ada75,'enableCors':!isProduction})(_0x25e064,_0x9dda23,_0x1494cd);}router[_0xfb85('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0xfb85('0xa')]=router; \ No newline at end of file +var _0x9d5c=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','beaver-logger/server','express','../components/auth/service','../config/environment','env','production'];(function(_0x2a4d07,_0x3664aa){var _0x3d0203=function(_0x2bde31){while(--_0x2bde31){_0x2a4d07['push'](_0x2a4d07['shift']());}};_0x3d0203(++_0x3664aa);}(_0x9d5c,0xa3));var _0xc9d5=function(_0x4b859a,_0x256efb){_0x4b859a=_0x4b859a-0x0;var _0x3c6a00=_0x9d5c[_0x4b859a];return _0x3c6a00;};var beaverLogger=require(_0xc9d5('0x0'));var express=require(_0xc9d5('0x1'));var auth=require(_0xc9d5('0x2'));var config=require(_0xc9d5('0x3'));var router=express['Router']();var isProduction=config[_0xc9d5('0x4')]===_0xc9d5('0x5')||![];function clientSideLogs(_0x42546a,_0x3a511e,_0x419edb){var _0x316b7e=_0x42546a[_0xc9d5('0x6')][_0xc9d5('0x7')](_0xc9d5('0x8'));if(!_0x316b7e){throw new Error(_0xc9d5('0x9'));}return beaverLogger[_0xc9d5('0xa')]({'uri':_0xc9d5('0xb'),'logger':_0x316b7e,'enableCors':!isProduction})(_0x42546a,_0x3a511e,_0x419edb);}router['use'](auth[_0xc9d5('0xc')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 5ffd190..bf93a9e 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 _0x4584=['MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','STRING'];(function(_0x1d53cb,_0x4cf3f1){var _0x1de5fe=function(_0x438bbf){while(--_0x438bbf){_0x1d53cb['push'](_0x1d53cb['shift']());}};_0x1de5fe(++_0x4cf3f1);}(_0x4584,0x18c));var _0x4458=function(_0x335e51,_0x3c63fb){_0x335e51=_0x335e51-0x0;var _0x11637f=_0x4584[_0x335e51];return _0x11637f;};'use strict';var Sequelize=require(_0x4458('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x4458('0x1')](_0x4458('0x2'),_0x4458('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x4458('0x1')](_0x4458('0x4'),_0x4458('0x5'))},'data1':{'type':Sequelize[_0x4458('0x6')],'comment':_0x4458('0x7')},'data2':{'type':Sequelize[_0x4458('0x6')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x4458('0x6')],'comment':_0x4458('0x8')},'data4':{'type':Sequelize[_0x4458('0x6')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x4458('0x9')],'comment':_0x4458('0xa')},'data6':{'type':Sequelize[_0x4458('0x9')],'comment':_0x4458('0xb')},'data7':{'type':Sequelize[_0x4458('0x9')],'comment':_0x4458('0xc')}}; \ No newline at end of file +var _0x4bcf=['MicrosoftAzure\x20=>\x20refresh_token','TEXT','STRING','ENUM','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x97c69,_0x51f100){var _0x2c02a8=function(_0x294f25){while(--_0x294f25){_0x97c69['push'](_0x97c69['shift']());}};_0x2c02a8(++_0x51f100);}(_0x4bcf,0x1a9));var _0xf4bc=function(_0x2e30d8,_0x344b2c){_0x2e30d8=_0x2e30d8-0x0;var _0x347234=_0x4bcf[_0x2e30d8];return _0x347234;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf4bc('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xf4bc('0x1')]('AmazonAWS','Google',_0xf4bc('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xf4bc('0x1')](_0xf4bc('0x3'),'Dynamics365')},'data1':{'type':Sequelize[_0xf4bc('0x0')],'comment':_0xf4bc('0x4')},'data2':{'type':Sequelize[_0xf4bc('0x0')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0xf4bc('0x5')},'data4':{'type':Sequelize[_0xf4bc('0x0')],'comment':_0xf4bc('0x6')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize['TEXT'],'comment':_0xf4bc('0x7')},'data7':{'type':Sequelize[_0xf4bc('0x8')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2b7253c..d250a23 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 _0x4e61=['CloudProvider','count','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','catch','length','merge','data3','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','update','find','oauth2MicrosoftAuthorize','findOne','params','user','get','state','parse','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','emit','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','status','end','offset','undefined','limit','set','Content-Range','json','destroy','then','sendStatus','error','stack','send','padEnd','slice','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','VIRTUAL','filter','options'];(function(_0x441f7a,_0x576321){var _0x4821da=function(_0x5c5b52){while(--_0x5c5b52){_0x441f7a['push'](_0x441f7a['shift']());}};_0x4821da(++_0x576321);}(_0x4e61,0x19e));var _0x14e6=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0x4e61[_0x2bd1ec];return _0x2f7577;};'use strict';var _=require(_0x14e6('0x0'));var Redis=require('ioredis');var qs=require(_0x14e6('0x1'));var encryptor=require(_0x14e6('0x2'));var config=require('../../config/environment');var logger=require(_0x14e6('0x3'))(_0x14e6('0x4'));var db=require(_0x14e6('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_[_0x14e6('0x6')](config[_0x14e6('0x7')],{'host':_0x14e6('0x8'),'port':0x18eb});var socket=require(_0x14e6('0x9'))(new Redis(config[_0x14e6('0x7')]));var redis=new Redis(config[_0x14e6('0x7')]);function respondWithStatusCode(_0xf0bfb9,_0x5d2b78){_0x5d2b78=_0x5d2b78||0xcc;return function(_0x2ad943){if(_0x2ad943){return _0xf0bfb9['sendStatus'](_0x5d2b78);}return _0xf0bfb9[_0x14e6('0xa')](_0x5d2b78)[_0x14e6('0xb')]();};}function respondWithResult(_0x2a6b8d,_0x4eeddb){_0x4eeddb=_0x4eeddb||0xc8;return function(_0x213328){if(_0x213328){return _0x2a6b8d[_0x14e6('0xa')](_0x4eeddb)['json'](_0x213328);}};}function respondWithFilteredResult(_0x300bf9,_0xaed4aa){return function(_0x22a7d3){if(_0x22a7d3){var _0xb62a92=typeof _0xaed4aa[_0x14e6('0xc')]===_0x14e6('0xd')&&typeof _0xaed4aa[_0x14e6('0xe')]===_0x14e6('0xd');var _0x25615f=_0x22a7d3['count'];var _0x406a45=_0xb62a92?0x0:_0xaed4aa[_0x14e6('0xc')];var _0x450f06=_0xb62a92?_0x22a7d3['count']:_0xaed4aa['offset']+_0xaed4aa['limit'];var _0x470138;if(_0x450f06>=_0x25615f){_0x450f06=_0x25615f;_0x470138=0xc8;}else{_0x470138=0xce;}_0x300bf9[_0x14e6('0xa')](_0x470138);return _0x300bf9[_0x14e6('0xf')](_0x14e6('0x10'),_0x406a45+'-'+_0x450f06+'/'+_0x25615f)[_0x14e6('0x11')](_0x22a7d3);}return null;};}function saveUpdates(_0x5931ef){return function(_0x31607b){if(_0x31607b){return _0x31607b['update'](_0x5931ef)['then'](function(_0x2d1d4e){return _0x2d1d4e;});}return null;};}function removeEntity(_0x267f4){return function(_0x510628){if(_0x510628){return _0x510628[_0x14e6('0x12')]()[_0x14e6('0x13')](function(){_0x267f4[_0x14e6('0xa')](0xcc)[_0x14e6('0xb')]();});}};}function handleEntityNotFound(_0x5f26ce){return function(_0xb7d922){if(!_0xb7d922){_0x5f26ce[_0x14e6('0x14')](0x194);}return _0xb7d922;};}function handleError(_0x131f7c,_0x347764){_0x347764=_0x347764||0x1f4;return function(_0x4d4fad){logger[_0x14e6('0x15')](_0x4d4fad[_0x14e6('0x16')]);if(_0x4d4fad['name']){delete _0x4d4fad['name'];}_0x131f7c[_0x14e6('0xa')](_0x347764)[_0x14e6('0x17')](_0x4d4fad);};}function maskClientSecret(_0x359c9a){return _[_0x14e6('0x18')](_0x359c9a[_0x14e6('0x19')](0x0,0x3),0x14,'*');}exports[_0x14e6('0x1a')]=function(_0x3877d8,_0x3041a4){var _0x4ffc91={},_0x3de028={},_0x1a8037={'count':0x0,'rows':[]};var _0x467690=_[_0x14e6('0x1b')](db['CloudProvider'][_0x14e6('0x1c')],function(_0x34464d){return{'name':_0x34464d[_0x14e6('0x1d')],'type':_0x34464d[_0x14e6('0x1e')]['key']};});_0x3de028[_0x14e6('0x1f')]=_[_0x14e6('0x1b')](_0x467690,_0x14e6('0x20'));_0x3de028[_0x14e6('0x21')]=_[_0x14e6('0x22')](_0x3877d8[_0x14e6('0x21')]);_0x3de028[_0x14e6('0x23')]=_[_0x14e6('0x24')](_0x3de028[_0x14e6('0x1f')],_0x3de028[_0x14e6('0x21')]);_0x4ffc91[_0x14e6('0x25')]=_['intersection'](_0x3de028['model'],qs[_0x14e6('0x26')](_0x3877d8[_0x14e6('0x21')]['fields']));_0x4ffc91[_0x14e6('0x25')]=_0x4ffc91['attributes']['length']?_0x4ffc91[_0x14e6('0x25')]:_0x3de028['model'];if(!_0x3877d8['query']['hasOwnProperty']('nolimit')){_0x4ffc91[_0x14e6('0xe')]=qs[_0x14e6('0xe')](_0x3877d8[_0x14e6('0x21')][_0x14e6('0xe')]);_0x4ffc91['offset']=qs['offset'](_0x3877d8[_0x14e6('0x21')][_0x14e6('0xc')]);}_0x4ffc91[_0x14e6('0x27')]=qs[_0x14e6('0x28')](_0x3877d8['query']['sort']);_0x4ffc91[_0x14e6('0x29')]=qs[_0x14e6('0x23')](_[_0x14e6('0x2a')](_0x3877d8['query'],_0x3de028['filters']),_0x467690);if(_0x3877d8[_0x14e6('0x21')]['filter']){_0x4ffc91[_0x14e6('0x29')]=_['merge'](_0x4ffc91[_0x14e6('0x29')],{'$or':_[_0x14e6('0x1b')](_0x467690,function(_0x97ac3c){if(_0x97ac3c[_0x14e6('0x1e')]!==_0x14e6('0x2b')){var _0x41ab81={};_0x41ab81[_0x97ac3c['name']]={'$like':'%'+_0x3877d8[_0x14e6('0x21')][_0x14e6('0x2c')]+'%'};return _0x41ab81;}})});}_0x4ffc91=_['merge']({},_0x4ffc91,_0x3877d8[_0x14e6('0x2d')]);var _0x3e6c19={'where':_0x4ffc91[_0x14e6('0x29')]};return db[_0x14e6('0x2e')][_0x14e6('0x2f')](_0x3e6c19)[_0x14e6('0x13')](function(_0x54e5ac){_0x1a8037['count']=_0x54e5ac;if(_0x3877d8[_0x14e6('0x21')][_0x14e6('0x30')]){_0x4ffc91[_0x14e6('0x31')]=[{'all':!![]}];}return db['CloudProvider'][_0x14e6('0x32')](_0x4ffc91);})[_0x14e6('0x13')](function(_0x5d7c48){_0x1a8037[_0x14e6('0x33')]=_[_0x14e6('0x1b')](_0x5d7c48,function(_0x24a9e7){if(_0x24a9e7[_0x14e6('0x34')]===_0x14e6('0x35')){var _0x36cb69=encryptor[_0x14e6('0x36')](_0x24a9e7['data3']);_0x24a9e7['data3']=maskClientSecret(_0x36cb69);}return _0x24a9e7;});return _0x1a8037;})[_0x14e6('0x13')](respondWithFilteredResult(_0x3041a4,_0x4ffc91))[_0x14e6('0x37')](handleError(_0x3041a4,null));};exports['show']=function(_0x22845c,_0x75b342){var _0xfadc4e={'raw':!![],'where':{'id':_0x22845c['params']['id']}},_0xdf704f={};_0xdf704f[_0x14e6('0x1f')]=_[_0x14e6('0x22')](db[_0x14e6('0x2e')][_0x14e6('0x1c')]);_0xdf704f[_0x14e6('0x21')]=_[_0x14e6('0x22')](_0x22845c[_0x14e6('0x21')]);_0xdf704f['filters']=_['intersection'](_0xdf704f[_0x14e6('0x1f')],_0xdf704f['query']);_0xfadc4e['attributes']=_[_0x14e6('0x24')](_0xdf704f[_0x14e6('0x1f')],qs[_0x14e6('0x26')](_0x22845c[_0x14e6('0x21')][_0x14e6('0x26')]));_0xfadc4e[_0x14e6('0x25')]=_0xfadc4e[_0x14e6('0x25')][_0x14e6('0x38')]?_0xfadc4e[_0x14e6('0x25')]:_0xdf704f[_0x14e6('0x1f')];if(_0x22845c['query'][_0x14e6('0x30')]){_0xfadc4e['include']=[{'all':!![]}];}_0xfadc4e=_[_0x14e6('0x39')]({},_0xfadc4e,_0x22845c['options']);return db[_0x14e6('0x2e')]['find'](_0xfadc4e)['then'](handleEntityNotFound(_0x75b342,null))[_0x14e6('0x13')](function(_0x12054c){if(_0x12054c['service']===_0x14e6('0x35')){var _0x3dc717=encryptor[_0x14e6('0x36')](_0x12054c[_0x14e6('0x3a')]);_0x12054c['data3']=maskClientSecret(_0x3dc717);}return _0x12054c;})['then'](respondWithResult(_0x75b342,null))[_0x14e6('0x37')](handleError(_0x75b342,null));};exports[_0x14e6('0x3b')]=function(_0x21bf8d,_0x873f27){if(!_0x21bf8d[_0x14e6('0x3c')][_0x14e6('0x20')])throw new Error(_0x14e6('0x3d'));if(!_0x21bf8d['body'][_0x14e6('0x34')])throw new Error(_0x14e6('0x3e'));var _0xc11f1c=db[_0x14e6('0x2e')]['rawAttributes'][_0x14e6('0x34')]['values'];if(!_0xc11f1c['includes'](_0x21bf8d[_0x14e6('0x3c')]['service']))throw new Error(_0x14e6('0x3f')+_0xc11f1c[_0x14e6('0x40')](',\x20'));if(_0x21bf8d[_0x14e6('0x3c')]['service']===_0x14e6('0x35')&&_0x21bf8d[_0x14e6('0x3c')][_0x14e6('0x3a')]){_0x21bf8d[_0x14e6('0x3c')]['data3']=encryptor['encryptString'](_0x21bf8d[_0x14e6('0x3c')]['data3']);}return db['CloudProvider'][_0x14e6('0x3b')](_0x21bf8d[_0x14e6('0x3c')],{})['then'](respondWithResult(_0x873f27,0xc9))['catch'](handleError(_0x873f27,null));};exports[_0x14e6('0x41')]=function(_0x3c87b3,_0x307271){if(_0x3c87b3[_0x14e6('0x3c')]['id']){delete _0x3c87b3['body']['id'];}return db[_0x14e6('0x2e')][_0x14e6('0x42')]({'where':{'id':_0x3c87b3['params']['id']}})[_0x14e6('0x13')](handleEntityNotFound(_0x307271,null))[_0x14e6('0x13')](function(_0xba895d){if(_0xba895d['service']===_0x14e6('0x35')&&_0x3c87b3['body']['data3']){_0x3c87b3[_0x14e6('0x3c')][_0x14e6('0x3a')]=encryptor['encryptString'](_0x3c87b3[_0x14e6('0x3c')][_0x14e6('0x3a')]);}return _0xba895d;})[_0x14e6('0x13')](saveUpdates(_0x3c87b3[_0x14e6('0x3c')],null))[_0x14e6('0x13')](respondWithResult(_0x307271,null))[_0x14e6('0x37')](handleError(_0x307271,null));};exports[_0x14e6('0x12')]=function(_0x3c9e0b,_0x112aad){return db[_0x14e6('0x2e')][_0x14e6('0x42')]({'where':{'id':_0x3c9e0b['params']['id']}})[_0x14e6('0x13')](handleEntityNotFound(_0x112aad,null))[_0x14e6('0x13')](removeEntity(_0x112aad,null))['catch'](handleError(_0x112aad,null));};exports[_0x14e6('0x43')]=function(_0x3c10bc,_0xa42148){return db['CloudProvider'][_0x14e6('0x44')]({'where':{'id':_0x3c10bc[_0x14e6('0x45')]['id']},'raw':!![]})[_0x14e6('0x13')](function(_0x3ec93e){if(!_0x3ec93e)return _0xa42148[_0x14e6('0x14')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x3ec93e,_0x3c10bc[_0x14e6('0x46')]['id'])};})[_0x14e6('0x13')](respondWithResult(_0xa42148,null))[_0x14e6('0x37')](handleError(_0xa42148,null));};exports['oauth2MicrosoftCallback']=function(_0x3b0d72,_0x3f7813){var _0x3a7cab=_0x3b0d72[_0x14e6('0x3c')];var _0x238437;var _0x443aa7;if(_0x3a7cab[_0x14e6('0x15')])throw _0x3a7cab;redis[_0x14e6('0x47')](_0x3a7cab[_0x14e6('0x48')])[_0x14e6('0x13')](function(_0x40b81d){if(!_0x40b81d)throw new Error('Invalid\x20state\x20parameter');_0x238437=JSON[_0x14e6('0x49')](_0x40b81d);var _0x3cd8de=Buffer['from'](_0x3a7cab[_0x14e6('0x48')],_0x14e6('0x4a'))[_0x14e6('0x4b')](_0x14e6('0x4c'));_0x443aa7=JSON['parse'](_0x3cd8de);if(!oauth[_0x14e6('0x4d')](_0x3a7cab[_0x14e6('0x4e')],_0x238437[_0x14e6('0x4f')]))throw new Error(_0x14e6('0x50'));redis['del'](_0x3a7cab[_0x14e6('0x48')]);return oauth[_0x14e6('0x51')](_0x3a7cab[_0x14e6('0x52')],_0x238437);})[_0x14e6('0x13')](function(_0x364d82){_0x238437[_0x14e6('0x53')]=_0x364d82[_0x14e6('0x54')];_0x238437[_0x14e6('0x55')]=_0x364d82[_0x14e6('0x56')];return db[_0x14e6('0x2e')][_0x14e6('0x41')]({'data5':_0x238437['data5'],'data6':_0x238437[_0x14e6('0x55')]},{'where':{'id':_0x238437['id']}});})[_0x14e6('0x13')](function(){oauth[_0x14e6('0x57')](_0x238437);socket['emit'](_0x14e6('0x58'),{'id':_0x443aa7['id']});return;})[_0x14e6('0x13')](respondWithStatusCode(_0x3f7813,null))[_0x14e6('0x37')](function(_0xf9c90d){if(_0x443aa7){socket[_0x14e6('0x59')]('microsoftAuthorization:error',{'id':_0x443aa7['id']});}if(!_0x238437){logger[_0x14e6('0x15')]('Invalid\x20authentication\x20state\x20parameter',_0xf9c90d);return _0x3f7813[_0x14e6('0xa')](0x1f4)[_0x14e6('0x17')](_0xf9c90d[_0x14e6('0x5a')]);}logger[_0x14e6('0x15')](_0x14e6('0x5b'),_0x238437['id'],JSON['stringify'](_0xf9c90d));});}; \ No newline at end of file +var _0xc7a3=['model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','CloudProvider','includeAll','include','findAll','rows','service','data3','catch','show','params','merge','decryptString','create','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','body','join','MicrosoftAzure','encryptString','find','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','get','Invalid\x20state\x20parameter','parse','state','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','redis','defaults','localhost','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','error','stack','name','send','padEnd','slice','index','map','rawAttributes','type','key'];(function(_0x121514,_0x6a5148){var _0x307864=function(_0x2c966d){while(--_0x2c966d){_0x121514['push'](_0x121514['shift']());}};_0x307864(++_0x6a5148);}(_0xc7a3,0xf8));var _0x3c7a=function(_0x353ad3,_0x360312){_0x353ad3=_0x353ad3-0x0;var _0xf1f727=_0xc7a3[_0x353ad3];return _0xf1f727;};'use strict';var _=require('lodash');var Redis=require(_0x3c7a('0x0'));var qs=require(_0x3c7a('0x1'));var encryptor=require(_0x3c7a('0x2'));var config=require(_0x3c7a('0x3'));var logger=require('../../config/logger')(_0x3c7a('0x4'));var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0x3c7a('0x5')]=_[_0x3c7a('0x6')](config['redis'],{'host':_0x3c7a('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c7a('0x5')]));var redis=new Redis(config[_0x3c7a('0x5')]);function respondWithStatusCode(_0x128015,_0x4f6827){_0x4f6827=_0x4f6827||0xcc;return function(_0x24aca1){if(_0x24aca1){return _0x128015[_0x3c7a('0x8')](_0x4f6827);}return _0x128015[_0x3c7a('0x9')](_0x4f6827)[_0x3c7a('0xa')]();};}function respondWithResult(_0x497ec3,_0x3794da){_0x3794da=_0x3794da||0xc8;return function(_0x52a817){if(_0x52a817){return _0x497ec3[_0x3c7a('0x9')](_0x3794da)['json'](_0x52a817);}};}function respondWithFilteredResult(_0x50f4d7,_0x265317){return function(_0xcb6ec1){if(_0xcb6ec1){var _0x36efa8=typeof _0x265317[_0x3c7a('0xb')]===_0x3c7a('0xc')&&typeof _0x265317[_0x3c7a('0xd')]==='undefined';var _0x3d2b50=_0xcb6ec1['count'];var _0x1f5d31=_0x36efa8?0x0:_0x265317['offset'];var _0x28fc24=_0x36efa8?_0xcb6ec1[_0x3c7a('0xe')]:_0x265317[_0x3c7a('0xb')]+_0x265317[_0x3c7a('0xd')];var _0x17f09b;if(_0x28fc24>=_0x3d2b50){_0x28fc24=_0x3d2b50;_0x17f09b=0xc8;}else{_0x17f09b=0xce;}_0x50f4d7[_0x3c7a('0x9')](_0x17f09b);return _0x50f4d7[_0x3c7a('0xf')]('Content-Range',_0x1f5d31+'-'+_0x28fc24+'/'+_0x3d2b50)[_0x3c7a('0x10')](_0xcb6ec1);}return null;};}function saveUpdates(_0x23d9f9){return function(_0x2d44dc){if(_0x2d44dc){return _0x2d44dc[_0x3c7a('0x11')](_0x23d9f9)[_0x3c7a('0x12')](function(_0x48a613){return _0x48a613;});}return null;};}function removeEntity(_0x495a31){return function(_0x4821ad){if(_0x4821ad){return _0x4821ad[_0x3c7a('0x13')]()[_0x3c7a('0x12')](function(){_0x495a31[_0x3c7a('0x9')](0xcc)[_0x3c7a('0xa')]();});}};}function handleEntityNotFound(_0x52391d){return function(_0x2396b4){if(!_0x2396b4){_0x52391d[_0x3c7a('0x8')](0x194);}return _0x2396b4;};}function handleError(_0x270585,_0x3ac7b7){_0x3ac7b7=_0x3ac7b7||0x1f4;return function(_0x203d2c){logger[_0x3c7a('0x14')](_0x203d2c[_0x3c7a('0x15')]);if(_0x203d2c[_0x3c7a('0x16')]){delete _0x203d2c['name'];}_0x270585['status'](_0x3ac7b7)[_0x3c7a('0x17')](_0x203d2c);};}function maskClientSecret(_0x568587){return _[_0x3c7a('0x18')](_0x568587[_0x3c7a('0x19')](0x0,0x3),0x14,'*');}exports[_0x3c7a('0x1a')]=function(_0xdd2b9e,_0x36393b){var _0x15acad={},_0x4a05a4={},_0x1c0b77={'count':0x0,'rows':[]};var _0x18c658=_[_0x3c7a('0x1b')](db['CloudProvider'][_0x3c7a('0x1c')],function(_0x555184){return{'name':_0x555184['fieldName'],'type':_0x555184[_0x3c7a('0x1d')][_0x3c7a('0x1e')]};});_0x4a05a4[_0x3c7a('0x1f')]=_['map'](_0x18c658,_0x3c7a('0x16'));_0x4a05a4[_0x3c7a('0x20')]=_['keys'](_0xdd2b9e['query']);_0x4a05a4[_0x3c7a('0x21')]=_['intersection'](_0x4a05a4[_0x3c7a('0x1f')],_0x4a05a4['query']);_0x15acad['attributes']=_[_0x3c7a('0x22')](_0x4a05a4[_0x3c7a('0x1f')],qs['fields'](_0xdd2b9e[_0x3c7a('0x20')][_0x3c7a('0x23')]));_0x15acad[_0x3c7a('0x24')]=_0x15acad[_0x3c7a('0x24')][_0x3c7a('0x25')]?_0x15acad[_0x3c7a('0x24')]:_0x4a05a4['model'];if(!_0xdd2b9e[_0x3c7a('0x20')]['hasOwnProperty'](_0x3c7a('0x26'))){_0x15acad[_0x3c7a('0xd')]=qs[_0x3c7a('0xd')](_0xdd2b9e[_0x3c7a('0x20')]['limit']);_0x15acad[_0x3c7a('0xb')]=qs[_0x3c7a('0xb')](_0xdd2b9e['query'][_0x3c7a('0xb')]);}_0x15acad[_0x3c7a('0x27')]=qs['sort'](_0xdd2b9e[_0x3c7a('0x20')][_0x3c7a('0x28')]);_0x15acad[_0x3c7a('0x29')]=qs[_0x3c7a('0x21')](_[_0x3c7a('0x2a')](_0xdd2b9e[_0x3c7a('0x20')],_0x4a05a4[_0x3c7a('0x21')]),_0x18c658);if(_0xdd2b9e['query'][_0x3c7a('0x2b')]){_0x15acad['where']=_['merge'](_0x15acad['where'],{'$or':_[_0x3c7a('0x1b')](_0x18c658,function(_0x129e1d){if(_0x129e1d[_0x3c7a('0x1d')]!==_0x3c7a('0x2c')){var _0x1f9a19={};_0x1f9a19[_0x129e1d[_0x3c7a('0x16')]]={'$like':'%'+_0xdd2b9e[_0x3c7a('0x20')]['filter']+'%'};return _0x1f9a19;}})});}_0x15acad=_['merge']({},_0x15acad,_0xdd2b9e[_0x3c7a('0x2d')]);var _0x1da7df={'where':_0x15acad['where']};return db[_0x3c7a('0x2e')]['count'](_0x1da7df)[_0x3c7a('0x12')](function(_0x83cfd1){_0x1c0b77[_0x3c7a('0xe')]=_0x83cfd1;if(_0xdd2b9e[_0x3c7a('0x20')][_0x3c7a('0x2f')]){_0x15acad[_0x3c7a('0x30')]=[{'all':!![]}];}return db[_0x3c7a('0x2e')][_0x3c7a('0x31')](_0x15acad);})[_0x3c7a('0x12')](function(_0x11b6a6){_0x1c0b77[_0x3c7a('0x32')]=_[_0x3c7a('0x1b')](_0x11b6a6,function(_0x170fbd){if(_0x170fbd[_0x3c7a('0x33')]==='MicrosoftAzure'){var _0x1bc204=encryptor['decryptString'](_0x170fbd[_0x3c7a('0x34')]);_0x170fbd[_0x3c7a('0x34')]=maskClientSecret(_0x1bc204);}return _0x170fbd;});return _0x1c0b77;})[_0x3c7a('0x12')](respondWithFilteredResult(_0x36393b,_0x15acad))[_0x3c7a('0x35')](handleError(_0x36393b,null));};exports[_0x3c7a('0x36')]=function(_0xbb5242,_0x21d360){var _0x356840={'raw':!![],'where':{'id':_0xbb5242[_0x3c7a('0x37')]['id']}},_0x5304c2={};_0x5304c2[_0x3c7a('0x1f')]=_['keys'](db[_0x3c7a('0x2e')][_0x3c7a('0x1c')]);_0x5304c2[_0x3c7a('0x20')]=_['keys'](_0xbb5242[_0x3c7a('0x20')]);_0x5304c2[_0x3c7a('0x21')]=_[_0x3c7a('0x22')](_0x5304c2[_0x3c7a('0x1f')],_0x5304c2[_0x3c7a('0x20')]);_0x356840[_0x3c7a('0x24')]=_[_0x3c7a('0x22')](_0x5304c2[_0x3c7a('0x1f')],qs[_0x3c7a('0x23')](_0xbb5242[_0x3c7a('0x20')][_0x3c7a('0x23')]));_0x356840['attributes']=_0x356840[_0x3c7a('0x24')][_0x3c7a('0x25')]?_0x356840[_0x3c7a('0x24')]:_0x5304c2['model'];if(_0xbb5242['query']['includeAll']){_0x356840[_0x3c7a('0x30')]=[{'all':!![]}];}_0x356840=_[_0x3c7a('0x38')]({},_0x356840,_0xbb5242[_0x3c7a('0x2d')]);return db[_0x3c7a('0x2e')]['find'](_0x356840)[_0x3c7a('0x12')](handleEntityNotFound(_0x21d360,null))[_0x3c7a('0x12')](function(_0x3be4a0){if(_0x3be4a0[_0x3c7a('0x33')]==='MicrosoftAzure'){var _0x1ca333=encryptor[_0x3c7a('0x39')](_0x3be4a0[_0x3c7a('0x34')]);_0x3be4a0[_0x3c7a('0x34')]=maskClientSecret(_0x1ca333);}return _0x3be4a0;})[_0x3c7a('0x12')](respondWithResult(_0x21d360,null))[_0x3c7a('0x35')](handleError(_0x21d360,null));};exports[_0x3c7a('0x3a')]=function(_0x314f3c,_0x36cf11){if(!_0x314f3c['body'][_0x3c7a('0x16')])throw new Error(_0x3c7a('0x3b'));if(!_0x314f3c['body'][_0x3c7a('0x33')])throw new Error(_0x3c7a('0x3c'));var _0x3772d8=db['CloudProvider'][_0x3c7a('0x1c')][_0x3c7a('0x33')]['values'];if(!_0x3772d8[_0x3c7a('0x3d')](_0x314f3c[_0x3c7a('0x3e')][_0x3c7a('0x33')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x3772d8[_0x3c7a('0x3f')](',\x20'));if(_0x314f3c['body']['service']===_0x3c7a('0x40')&&_0x314f3c[_0x3c7a('0x3e')][_0x3c7a('0x34')]){_0x314f3c['body'][_0x3c7a('0x34')]=encryptor[_0x3c7a('0x41')](_0x314f3c['body']['data3']);}return db[_0x3c7a('0x2e')][_0x3c7a('0x3a')](_0x314f3c[_0x3c7a('0x3e')],{})[_0x3c7a('0x12')](respondWithResult(_0x36cf11,0xc9))['catch'](handleError(_0x36cf11,null));};exports['update']=function(_0x1476d6,_0x4ed85c){if(_0x1476d6[_0x3c7a('0x3e')]['id']){delete _0x1476d6[_0x3c7a('0x3e')]['id'];}return db['CloudProvider'][_0x3c7a('0x42')]({'where':{'id':_0x1476d6[_0x3c7a('0x37')]['id']}})[_0x3c7a('0x12')](handleEntityNotFound(_0x4ed85c,null))[_0x3c7a('0x12')](function(_0x5d0216){if(_0x5d0216[_0x3c7a('0x33')]==='MicrosoftAzure'&&_0x1476d6['body']['data3']){_0x1476d6['body']['data3']=encryptor[_0x3c7a('0x41')](_0x1476d6[_0x3c7a('0x3e')][_0x3c7a('0x34')]);}return _0x5d0216;})[_0x3c7a('0x12')](saveUpdates(_0x1476d6[_0x3c7a('0x3e')],null))[_0x3c7a('0x12')](respondWithResult(_0x4ed85c,null))[_0x3c7a('0x35')](handleError(_0x4ed85c,null));};exports[_0x3c7a('0x13')]=function(_0x37936c,_0x1bde73){return db[_0x3c7a('0x2e')][_0x3c7a('0x42')]({'where':{'id':_0x37936c[_0x3c7a('0x37')]['id']}})[_0x3c7a('0x12')](handleEntityNotFound(_0x1bde73,null))[_0x3c7a('0x12')](removeEntity(_0x1bde73,null))[_0x3c7a('0x35')](handleError(_0x1bde73,null));};exports[_0x3c7a('0x43')]=function(_0xad059f,_0x1650ad){return db[_0x3c7a('0x2e')]['findOne']({'where':{'id':_0xad059f[_0x3c7a('0x37')]['id']},'raw':!![]})[_0x3c7a('0x12')](function(_0x2690f3){if(!_0x2690f3)return _0x1650ad['sendStatus'](0x194);return{'url':oauth[_0x3c7a('0x44')](_0x2690f3,_0xad059f[_0x3c7a('0x45')]['id'])};})[_0x3c7a('0x12')](respondWithResult(_0x1650ad,null))['catch'](handleError(_0x1650ad,null));};exports['oauth2MicrosoftCallback']=function(_0x5211b8,_0x1c28da){var _0x20a1df=_0x5211b8[_0x3c7a('0x3e')];var _0x14868c;var _0x33be90;if(_0x20a1df[_0x3c7a('0x14')])throw _0x20a1df;redis[_0x3c7a('0x46')](_0x20a1df['state'])[_0x3c7a('0x12')](function(_0x5444d4){if(!_0x5444d4)throw new Error(_0x3c7a('0x47'));_0x14868c=JSON[_0x3c7a('0x48')](_0x5444d4);var _0x21b950=Buffer['from'](_0x20a1df[_0x3c7a('0x49')],'base64')[_0x3c7a('0x4a')](_0x3c7a('0x4b'));_0x33be90=JSON[_0x3c7a('0x48')](_0x21b950);if(!oauth[_0x3c7a('0x4c')](_0x20a1df[_0x3c7a('0x4d')],_0x14868c[_0x3c7a('0x4e')]))throw new Error(_0x3c7a('0x4f'));redis[_0x3c7a('0x50')](_0x20a1df[_0x3c7a('0x49')]);return oauth[_0x3c7a('0x51')](_0x20a1df[_0x3c7a('0x52')],_0x14868c);})['then'](function(_0x4a780e){_0x14868c[_0x3c7a('0x53')]=_0x4a780e[_0x3c7a('0x54')];_0x14868c[_0x3c7a('0x55')]=_0x4a780e['refresh_token'];return db['CloudProvider'][_0x3c7a('0x11')]({'data5':_0x14868c[_0x3c7a('0x53')],'data6':_0x14868c['data6']},{'where':{'id':_0x14868c['id']}});})['then'](function(){oauth[_0x3c7a('0x56')](_0x14868c);socket['emit'](_0x3c7a('0x57'),{'id':_0x33be90['id']});return;})[_0x3c7a('0x12')](respondWithStatusCode(_0x1c28da,null))['catch'](function(_0x381024){if(_0x33be90){socket['emit'](_0x3c7a('0x58'),{'id':_0x33be90['id']});}if(!_0x14868c){logger[_0x3c7a('0x14')](_0x3c7a('0x59'),_0x381024);return _0x1c28da[_0x3c7a('0x9')](0x1f4)[_0x3c7a('0x17')](_0x381024[_0x3c7a('0x5a')]);}logger[_0x3c7a('0x14')](_0x3c7a('0x5b'),_0x14868c['id'],JSON[_0x3c7a('0x5c')](_0x381024));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 4816e90..d9b1020 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 _0xaf79=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xaf79,0xe6));var _0x9af7=function(_0x1fe5f6,_0xd1e86b){_0x1fe5f6=_0x1fe5f6-0x0;var _0x501ac6=_0xaf79[_0x1fe5f6];return _0x501ac6;};'use strict';var _=require('lodash');var util=require(_0x9af7('0x0'));var logger=require(_0x9af7('0x1'))(_0x9af7('0x2'));var moment=require('moment');var BPromise=require(_0x9af7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9af7('0x4'));var config=require(_0x9af7('0x5'));var attributes=require(_0x9af7('0x6'));module['exports']=function(_0x4b6a2e,_0x5c7594){return _0x4b6a2e[_0x9af7('0x7')](_0x9af7('0x8'),attributes,{'tableName':_0x9af7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9c4=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','lodash','moment','bluebird','request-promise'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xd9c4,0x104));var _0x4d9c=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0xd9c4[_0x11a55c];return _0x26c390;};'use strict';var _=require(_0x4d9c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4d9c('0x1'));var BPromise=require(_0x4d9c('0x2'));var rp=require(_0x4d9c('0x3'));var fs=require('fs');var path=require(_0x4d9c('0x4'));var rimraf=require(_0x4d9c('0x5'));var config=require(_0x4d9c('0x6'));var attributes=require(_0x4d9c('0x7'));module[_0x4d9c('0x8')]=function(_0x2f76b2,_0x95037c){return _0x2f76b2[_0x4d9c('0x9')]('CloudProvider',attributes,{'tableName':_0x4d9c('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 e97f799..514a89a 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 _0x316e=['oauth2/','data1','stringify','decode','payload','issuer','aud','audience','isAfter','unix','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','data4','decryptString','data3','POST','{TENANT_ID}','data5','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','inspect','error','exports','lodash','crypto','jsonwebtoken','moment','ioredis','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','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','data2','code','id_token','from','toString','hex','redirect_uri','response_mode','form_post','scope','state','nonce','prompt','login','value','oauth2Claims'];(function(_0x15a0c1,_0x285dfe){var _0x348db1=function(_0x3af209){while(--_0x3af209){_0x15a0c1['push'](_0x15a0c1['shift']());}};_0x348db1(++_0x285dfe);}(_0x316e,0x122));var _0xe316=function(_0x125a0f,_0x570263){_0x125a0f=_0x125a0f-0x0;var _0x49b79f=_0x316e[_0x125a0f];return _0x49b79f;};'use strict';var _=require(_0xe316('0x0'));var crypto=require(_0xe316('0x1'));var jwt=require(_0xe316('0x2'));var moment=require(_0xe316('0x3'));var Redis=require(_0xe316('0x4'));var rp=require('request-promise');var util=require(_0xe316('0x5'));var encryptor=require(_0xe316('0x6'));var config=require(_0xe316('0x7'));var logger=require(_0xe316('0x8'))(_0xe316('0x9'));var schedule=require(_0xe316('0xa'));var db=require(_0xe316('0xb'))['db'];config[_0xe316('0xc')]=_[_0xe316('0xd')](config[_0xe316('0xc')],{'host':_0xe316('0xe'),'port':0x18eb});var redis=new Redis(config[_0xe316('0xc')]);var MICROSOFT_AUTH_URL=_0xe316('0xf');var AZURE_AUTH_SCOPES={'Outlook365':[_0xe316('0x10'),_0xe316('0x11'),_0xe316('0x12'),'offline_access',_0xe316('0x13'),_0xe316('0x14'),_0xe316('0x15')],'Dynamics365':['openid',_0xe316('0x16')]};var MICROSOFT_AUTH_ENDPOINT=_0xe316('0x17');var MICROSOFT_TOKEN_ENDPOINT=_0xe316('0x18');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x447531){var _0x5557f8=_[_0xe316('0x19')](AZURE_AUTH_SCOPES[_0x447531[_0xe316('0x1a')]]);if(_0x447531['type']===_0xe316('0x1b'))_0x5557f8[_0xe316('0x1c')](_0x447531[_0xe316('0x1d')]+_0xe316('0x1e'));return _0x5557f8[_0xe316('0x1f')]('\x20');}function getAccessTokenScope(_0x1f7cee){if(_0x1f7cee[_0xe316('0x1a')]===_0xe316('0x20'))return _0xe316('0x13');if(_0x1f7cee['type']==='Dynamics365')return _0x1f7cee['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x26f740,_0x4b002c){var _0x4ac518=MICROSOFT_AUTH_URL[_0xe316('0x21')]('{TENANT_ID}',_0x26f740[_0xe316('0x22')]);var _0x50a5ce=[_0xe316('0x23'),_0xe316('0x24')];var _0x100cd8=Buffer[_0xe316('0x25')](JSON['stringify']({'id':_0x4b002c}))[_0xe316('0x26')]('base64');var _0x41c577=crypto['randomBytes'](0x10)[_0xe316('0x26')](_0xe316('0x27'));var _0x4fe265=getAuthorizationScopes(_0x26f740);var _0x408323=[{'key':'client_id','value':_0x26f740['data1']},{'key':'response_type','value':encodeURIComponent(_0x50a5ce[_0xe316('0x1f')]('\x20'))},{'key':_0xe316('0x28'),'value':_0x26f740['data4']},{'key':_0xe316('0x29'),'value':_0xe316('0x2a')},{'key':_0xe316('0x2b'),'value':encodeURIComponent(_0x4fe265)},{'key':_0xe316('0x2c'),'value':_0x100cd8},{'key':_0xe316('0x2d'),'value':_0x41c577},{'key':_0xe316('0x2e'),'value':_0xe316('0x2f')}];var _0x4afb4d=_0x4ac518+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xe316('0x19')](_0x408323,function(_0x22b8c4){return _0x22b8c4['key']+'='+_0x22b8c4[_0xe316('0x30')];})[_0xe316('0x1f')]('&');_0x26f740[_0xe316('0x31')]={'issuer':_0x4ac518[_0xe316('0x21')](_0xe316('0x32'),''),'audience':_0x26f740[_0xe316('0x33')],'state':_0x100cd8,'nonce':_0x41c577};redis['set'](_0x100cd8,JSON[_0xe316('0x34')](_0x26f740));return _0x4afb4d;}function isValidIdToken(_0x572eec,_0x3540a5){try{var _0x3c92e1=jwt[_0xe316('0x35')](_0x572eec,{'complete':!![]});var _0x188d7e=_0x3c92e1[_0xe316('0x36')];if(_0x188d7e['iss']!==_0x3540a5[_0xe316('0x37')])return![];if(_0x188d7e[_0xe316('0x38')]!==_0x3540a5[_0xe316('0x39')])return![];if(_0x188d7e[_0xe316('0x2d')]!==_0x3540a5['nonce'])return![];if(moment()[_0xe316('0x3a')](moment[_0xe316('0x3b')](_0x188d7e[_0xe316('0x3c')])))return![];return!![];}catch(_0x5a58b2){throw _0x5a58b2;}}function refreshOauth2MicrosoftAccessToken(_0x360006){return Promise[_0xe316('0x3d')]()[_0xe316('0x3e')](function(){if(_0x360006['data3'])return _0x360006;return db[_0xe316('0x3f')][_0xe316('0x40')]({'where':{'id':_0x360006['id']},'raw':!![]});})[_0xe316('0x3e')](function(_0x4389c7){var _0x1beb21={'grant_type':_0xe316('0x41'),'refresh_token':_0x4389c7[_0xe316('0x42')],'scope':getAccessTokenScope(_0x4389c7),'redirect_uri':_0x4389c7[_0xe316('0x43')],'client_id':_0x4389c7[_0xe316('0x33')],'client_secret':encryptor[_0xe316('0x44')](_0x4389c7[_0xe316('0x45')])};var _0x5b6fdc={'method':_0xe316('0x46'),'uri':MICROSOFT_AUTH_URL[_0xe316('0x21')](_0xe316('0x47'),_0x4389c7[_0xe316('0x22')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1beb21,'json':!![]};return rp(_0x5b6fdc);})[_0xe316('0x3e')](function(_0x162238){_0x360006[_0xe316('0x48')]=_0x162238[_0xe316('0x49')];_0x360006[_0xe316('0x42')]=_0x162238[_0xe316('0x41')];return db[_0xe316('0x3f')][_0xe316('0x4a')]({'data5':_0x360006[_0xe316('0x48')],'data6':_0x360006['data6']},{'where':{'id':_0x360006['id']}});})[_0xe316('0x3e')](function(){return _0x360006;})[_0xe316('0x4b')](function(_0x351b0b){logger['error'](_0xe316('0x4c'),_0x360006['id'],_0x351b0b);});}function getOauth2MicrosoftAccessToken(_0x4f8031,_0x574bf6){var _0x5b7b6e={'grant_type':_0xe316('0x4d'),'code':_0x4f8031,'scope':getAccessTokenScope(_0x574bf6),'redirect_uri':_0x574bf6[_0xe316('0x43')],'client_id':_0x574bf6['data1'],'client_secret':encryptor['decryptString'](_0x574bf6[_0xe316('0x45')])};var _0x3bc25a={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xe316('0x21')]('{TENANT_ID}',_0x574bf6['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5b7b6e,'json':!![]};return rp(_0x3bc25a);}function startRefreshInterval(_0x2be29d){var _0x25f734=schedule[_0xe316('0x4e')];if(_0x25f734[_0x2be29d['id']])clearInterval(_0x25f734[_0x2be29d['id']]);_0x25f734[_0x2be29d['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xe316('0x4f')](this,{'id':_0x2be29d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xe316('0x4e')]=_0x25f734;}function startAllRefreshIntervals(){return db[_0xe316('0x3f')][_0xe316('0x50')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xe316('0x3e')](function(_0x534f81){var _0x40942d=_0x534f81['map'](function(_0x244807){return refreshOauth2MicrosoftAccessToken(_0x244807)[_0xe316('0x3e')](function(_0x2f2f5a){startRefreshInterval(_0x2f2f5a);});});return Promise[_0xe316('0x51')](_0x40942d);})[_0xe316('0x4b')](function(_0xd77436){var _0x4fa644=_0xd77436?util[_0xe316('0x52')](_0xd77436,{'showHidden':![],'depth':null}):'';logger[_0xe316('0x53')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x4fa644);});}module[_0xe316('0x54')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xa838=['access_token','catch','error','authorization_code','data1','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','ioredis','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','join','Outlook365','data7','/.default','{TENANT_ID}','data2','from','base64','randomBytes','toString','hex','client_id','redirect_uri','data4','form_post','scope','nonce','prompt','login','key','value','oauth2Claims','replace','oauth2/','stringify','decode','payload','iss','issuer','aud','audience','isAfter','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5'];(function(_0x36a6c9,_0x5f31ce){var _0x15257f=function(_0x14c652){while(--_0x14c652){_0x36a6c9['push'](_0x36a6c9['shift']());}};_0x15257f(++_0x5f31ce);}(_0xa838,0xf5));var _0x8a83=function(_0x31e20a,_0x4dde1e){_0x31e20a=_0x31e20a-0x0;var _0x95f49c=_0xa838[_0x31e20a];return _0x95f49c;};'use strict';var _=require(_0x8a83('0x0'));var crypto=require(_0x8a83('0x1'));var jwt=require(_0x8a83('0x2'));var moment=require('moment');var Redis=require(_0x8a83('0x3'));var rp=require('request-promise');var util=require(_0x8a83('0x4'));var encryptor=require('../../components/encryptor');var config=require(_0x8a83('0x5'));var logger=require(_0x8a83('0x6'))(_0x8a83('0x7'));var schedule=require(_0x8a83('0x8'));var db=require('../../mysqldb')['db'];config[_0x8a83('0x9')]=_[_0x8a83('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x8a83('0x9')]);var MICROSOFT_AUTH_URL=_0x8a83('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0x8a83('0xc'),_0x8a83('0xd'),_0x8a83('0xe'),_0x8a83('0xf'),_0x8a83('0x10'),'https://outlook.office.com/POP.AccessAsUser.All',_0x8a83('0x11')],'Dynamics365':[_0x8a83('0xc'),_0x8a83('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x8a83('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x8a83('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2f6625){var _0x57e66a=_[_0x8a83('0x14')](AZURE_AUTH_SCOPES[_0x2f6625[_0x8a83('0x15')]]);if(_0x2f6625[_0x8a83('0x15')]===_0x8a83('0x16'))_0x57e66a[_0x8a83('0x17')](_0x2f6625['data7']+'/.default');return _0x57e66a[_0x8a83('0x18')]('\x20');}function getAccessTokenScope(_0x50fefa){if(_0x50fefa[_0x8a83('0x15')]===_0x8a83('0x19'))return _0x8a83('0x10');if(_0x50fefa[_0x8a83('0x15')]==='Dynamics365')return _0x50fefa[_0x8a83('0x1a')]+_0x8a83('0x1b');}function generateMicrosoftAuthorizationUrl(_0x1ee0fb,_0x3309e6){var _0x20f798=MICROSOFT_AUTH_URL['replace'](_0x8a83('0x1c'),_0x1ee0fb[_0x8a83('0x1d')]);var _0x1ca16a=['code','id_token'];var _0x420e35=Buffer[_0x8a83('0x1e')](JSON['stringify']({'id':_0x3309e6}))['toString'](_0x8a83('0x1f'));var _0x3f6e0d=crypto[_0x8a83('0x20')](0x10)[_0x8a83('0x21')](_0x8a83('0x22'));var _0x2e85e8=getAuthorizationScopes(_0x1ee0fb);var _0x511563=[{'key':_0x8a83('0x23'),'value':_0x1ee0fb['data1']},{'key':'response_type','value':encodeURIComponent(_0x1ca16a['join']('\x20'))},{'key':_0x8a83('0x24'),'value':_0x1ee0fb[_0x8a83('0x25')]},{'key':'response_mode','value':_0x8a83('0x26')},{'key':_0x8a83('0x27'),'value':encodeURIComponent(_0x2e85e8)},{'key':'state','value':_0x420e35},{'key':_0x8a83('0x28'),'value':_0x3f6e0d},{'key':_0x8a83('0x29'),'value':_0x8a83('0x2a')}];var _0x2b5999=_0x20f798+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x511563,function(_0x24aeb3){return _0x24aeb3[_0x8a83('0x2b')]+'='+_0x24aeb3[_0x8a83('0x2c')];})['join']('&');_0x1ee0fb[_0x8a83('0x2d')]={'issuer':_0x20f798[_0x8a83('0x2e')](_0x8a83('0x2f'),''),'audience':_0x1ee0fb['data1'],'state':_0x420e35,'nonce':_0x3f6e0d};redis['set'](_0x420e35,JSON[_0x8a83('0x30')](_0x1ee0fb));return _0x2b5999;}function isValidIdToken(_0x169ef9,_0x3e1f96){try{var _0x48f2f8=jwt[_0x8a83('0x31')](_0x169ef9,{'complete':!![]});var _0x474c56=_0x48f2f8[_0x8a83('0x32')];if(_0x474c56[_0x8a83('0x33')]!==_0x3e1f96[_0x8a83('0x34')])return![];if(_0x474c56[_0x8a83('0x35')]!==_0x3e1f96[_0x8a83('0x36')])return![];if(_0x474c56[_0x8a83('0x28')]!==_0x3e1f96[_0x8a83('0x28')])return![];if(moment()[_0x8a83('0x37')](moment[_0x8a83('0x38')](_0x474c56['exp'])))return![];return!![];}catch(_0x406c4e){throw _0x406c4e;}}function refreshOauth2MicrosoftAccessToken(_0x3d1557){return Promise[_0x8a83('0x39')]()[_0x8a83('0x3a')](function(){if(_0x3d1557[_0x8a83('0x3b')])return _0x3d1557;return db[_0x8a83('0x3c')][_0x8a83('0x3d')]({'where':{'id':_0x3d1557['id']},'raw':!![]});})[_0x8a83('0x3a')](function(_0x3016b4){var _0x130b79={'grant_type':_0x8a83('0x3e'),'refresh_token':_0x3016b4[_0x8a83('0x3f')],'scope':getAccessTokenScope(_0x3016b4),'redirect_uri':_0x3016b4[_0x8a83('0x25')],'client_id':_0x3016b4['data1'],'client_secret':encryptor[_0x8a83('0x40')](_0x3016b4[_0x8a83('0x3b')])};var _0x4be094={'method':_0x8a83('0x41'),'uri':MICROSOFT_AUTH_URL[_0x8a83('0x2e')]('{TENANT_ID}',_0x3016b4[_0x8a83('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x130b79,'json':!![]};return rp(_0x4be094);})[_0x8a83('0x3a')](function(_0x1fc4dc){_0x3d1557[_0x8a83('0x42')]=_0x1fc4dc[_0x8a83('0x43')];_0x3d1557[_0x8a83('0x3f')]=_0x1fc4dc[_0x8a83('0x3e')];return db[_0x8a83('0x3c')]['update']({'data5':_0x3d1557[_0x8a83('0x42')],'data6':_0x3d1557[_0x8a83('0x3f')]},{'where':{'id':_0x3d1557['id']}});})[_0x8a83('0x3a')](function(){return _0x3d1557;})[_0x8a83('0x44')](function(_0x55df66){logger[_0x8a83('0x45')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x3d1557['id'],_0x55df66);});}function getOauth2MicrosoftAccessToken(_0x9b4098,_0x370d2e){var _0x3ac72c={'grant_type':_0x8a83('0x46'),'code':_0x9b4098,'scope':getAccessTokenScope(_0x370d2e),'redirect_uri':_0x370d2e[_0x8a83('0x25')],'client_id':_0x370d2e[_0x8a83('0x47')],'client_secret':encryptor[_0x8a83('0x40')](_0x370d2e[_0x8a83('0x3b')])};var _0x585a52={'method':_0x8a83('0x41'),'uri':MICROSOFT_AUTH_URL['replace'](_0x8a83('0x1c'),_0x370d2e[_0x8a83('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3ac72c,'json':!![]};return rp(_0x585a52);}function startRefreshInterval(_0x24bc36){var _0x28efe0=schedule[_0x8a83('0x48')];if(_0x28efe0[_0x24bc36['id']])clearInterval(_0x28efe0[_0x24bc36['id']]);_0x28efe0[_0x24bc36['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8a83('0x49')](this,{'id':_0x24bc36['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x8a83('0x48')]=_0x28efe0;}function startAllRefreshIntervals(){return db[_0x8a83('0x3c')][_0x8a83('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x515efd){var _0x547902=_0x515efd[_0x8a83('0x14')](function(_0x6e9d2f){return refreshOauth2MicrosoftAccessToken(_0x6e9d2f)[_0x8a83('0x3a')](function(_0x456591){startRefreshInterval(_0x456591);});});return Promise[_0x8a83('0x4b')](_0x547902);})[_0x8a83('0x44')](function(_0x186646){var _0x5b8c8a=_0x186646?util[_0x8a83('0x4c')](_0x186646,{'showHidden':![],'depth':null}):'';logger[_0x8a83('0x45')](_0x8a83('0x4d'),_0x5b8c8a);});}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 9f27971..ed884fe 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 _0x45d8=['../../config/utils','rpc','../../config/environment','http','request','then','info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x21188a,_0x437f2b){var _0x3fb3fa=function(_0x12f8e4){while(--_0x12f8e4){_0x21188a['push'](_0x21188a['shift']());}};_0x3fb3fa(++_0x437f2b);}(_0x45d8,0x174));var _0x845d=function(_0x7a6aed,_0x335e68){_0x7a6aed=_0x7a6aed-0x0;var _0x9dbabf=_0x45d8[_0x7a6aed];return _0x9dbabf;};'use strict';var _=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var moment=require(_0x845d('0x2'));var BPromise=require(_0x845d('0x3'));var rs=require(_0x845d('0x4'));var fs=require('fs');var Redis=require(_0x845d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x845d('0x6'));var logger=require('../../config/logger')(_0x845d('0x7'));var config=require(_0x845d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x845d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a59a2,_0x33c493,_0x94a7f5){return new BPromise(function(_0x34a0bf,_0xc26c7d){return client[_0x845d('0xa')](_0x4a59a2,_0x94a7f5)[_0x845d('0xb')](function(_0x5a9113){logger[_0x845d('0xc')](_0x845d('0xd'),_0x33c493,'request\x20sent');logger['debug'](_0x845d('0xe'),_0x33c493,_0x845d('0xf'),JSON[_0x845d('0x10')](_0x5a9113));if(_0x5a9113[_0x845d('0x11')]){if(_0x5a9113[_0x845d('0x11')]['code']===0x1f4){logger[_0x845d('0x11')](_0x845d('0xd'),_0x33c493,_0x5a9113[_0x845d('0x11')][_0x845d('0x12')]);return _0xc26c7d(_0x5a9113['error']['message']);}logger[_0x845d('0x11')](_0x845d('0xd'),_0x33c493,_0x5a9113[_0x845d('0x11')]['message']);return _0x34a0bf(_0x5a9113[_0x845d('0x11')]['message']);}else{logger[_0x845d('0xc')]('CloudProvider,\x20%s,\x20%s',_0x33c493,_0x845d('0xf'));_0x34a0bf(_0x5a9113[_0x845d('0x13')][_0x845d('0x12')]);}})[_0x845d('0x14')](function(_0x2a592){logger['error']('CloudProvider,\x20%s,\x20%s',_0x33c493,_0x2a592);_0xc26c7d(_0x2a592);});});} \ No newline at end of file +var _0x9ab8=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0x9ab8,0x81));var _0x89ab=function(_0x18432b,_0x1c3d1e){_0x18432b=_0x18432b-0x0;var _0x2ff4c6=_0x9ab8[_0x18432b];return _0x2ff4c6;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ab('0x4'));var logger=require(_0x89ab('0x5'))('rpc');var config=require(_0x89ab('0x6'));var jayson=require(_0x89ab('0x7'));var client=jayson[_0x89ab('0x8')][_0x89ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29a984,_0x3ecaa0,_0x366c32){return new BPromise(function(_0x5fd99f,_0x42da87){return client[_0x89ab('0xa')](_0x29a984,_0x366c32)[_0x89ab('0xb')](function(_0x36dc63){logger['info']('CloudProvider,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3ecaa0,_0x89ab('0xc'),JSON[_0x89ab('0xd')](_0x36dc63));if(_0x36dc63[_0x89ab('0xe')]){if(_0x36dc63[_0x89ab('0xe')][_0x89ab('0xf')]===0x1f4){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x42da87(_0x36dc63[_0x89ab('0xe')][_0x89ab('0x11')]);}logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x5fd99f(_0x36dc63[_0x89ab('0xe')]['message']);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');_0x5fd99f(_0x36dc63['result']['message']);}})[_0x89ab('0x12')](function(_0x1ce918){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x1ce918);_0x42da87(_0x1ce918);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index db7f719..dbe7a27 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 _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x5576a4,_0x10841d){var _0xc5011e=function(_0x2d3532){while(--_0x2d3532){_0x5576a4['push'](_0x5576a4['shift']());}};_0xc5011e(++_0x10841d);}(_0xdb28,0x106));var _0x8db2=function(_0x24a65c,_0x38a5e8){_0x24a65c=_0x24a65c-0x0;var _0x1807ac=_0xdb28[_0x24a65c];return _0x1807ac;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=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(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0x5f2f,0x73));var _0xf5f2=function(_0x179665,_0x277cf6){_0x179665=_0x179665-0x0;var _0x4291b7=_0x5f2f[_0x179665];return _0x4291b7;};'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 c5bfc07..84f5cef 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 _0xf61e=['STRING','name','sequelize','exports'];(function(_0x526deb,_0x13850c){var _0x150f5f=function(_0x2db91a){while(--_0x2db91a){_0x526deb['push'](_0x526deb['shift']());}};_0x150f5f(++_0x13850c);}(_0xf61e,0x15e));var _0xef61=function(_0x1d37f3,_0x26530d){_0x1d37f3=_0x1d37f3-0x0;var _0x5c72ae=_0xf61e[_0x1d37f3];return _0x5c72ae;};'use strict';var Sequelize=require(_0xef61('0x0'));module[_0xef61('0x1')]={'name':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xef61('0x2')]},'companyId':{'type':Sequelize[_0xef61('0x2')]},'website':{'type':Sequelize[_0xef61('0x2')]},'phone':{'type':Sequelize[_0xef61('0x2')]},'fax':{'type':Sequelize[_0xef61('0x2')]},'type':{'type':Sequelize[_0xef61('0x2')]},'street':{'type':Sequelize[_0xef61('0x2')]},'postalCode':{'type':Sequelize[_0xef61('0x2')]},'city':{'type':Sequelize[_0xef61('0x2')]},'country':{'type':Sequelize[_0xef61('0x2')]},'email':{'type':Sequelize[_0xef61('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xef61('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xef61('0x2')]}}; \ No newline at end of file +var _0x0871=['name','sequelize','exports','STRING'];(function(_0x4ab498,_0x3156f8){var _0x4b1dfa=function(_0x5e6e47){while(--_0x5e6e47){_0x4ab498['push'](_0x4ab498['shift']());}};_0x4b1dfa(++_0x3156f8);}(_0x0871,0xd9));var _0x1087=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x0871[_0x4c440b];return _0x2d48cf;};'use strict';var Sequelize=require(_0x1087('0x0'));module[_0x1087('0x1')]={'name':{'type':Sequelize[_0x1087('0x2')],'unique':_0x1087('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1087('0x2')]},'companyId':{'type':Sequelize[_0x1087('0x2')]},'website':{'type':Sequelize[_0x1087('0x2')]},'phone':{'type':Sequelize[_0x1087('0x2')]},'fax':{'type':Sequelize[_0x1087('0x2')]},'type':{'type':Sequelize[_0x1087('0x2')]},'street':{'type':Sequelize[_0x1087('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1087('0x2')]},'country':{'type':Sequelize[_0x1087('0x2')]},'email':{'type':Sequelize[_0x1087('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x1087('0x2')]},'sPostalCode':{'type':Sequelize[_0x1087('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x1087('0x2')]},'description':{'type':Sequelize[_0x1087('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d830db7..5e221e3 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 _0x2f7c=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','get','Companies','UserProfileResource','destroy','end','error','name','CmCompany','describe','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','options','includeAll','include','rows','catch','params','rawAttributes','intersection','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','ids','omit','getContacts','findOne','pick','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x39db8d,_0x37bc60){var _0x5a6e3d=function(_0x44fdb1){while(--_0x44fdb1){_0x39db8d['push'](_0x39db8d['shift']());}};_0x5a6e3d(++_0x37bc60);}(_0x2f7c,0xf2));var _0xc2f7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2f7c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xc2f7('0x0'));var rimraf=require(_0xc2f7('0x1'));var zipdir=require(_0xc2f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc2f7('0x3'));var BPromise=require(_0xc2f7('0x4'));var Mustache=require(_0xc2f7('0x5'));var util=require('util');var path=require(_0xc2f7('0x6'));var sox=require(_0xc2f7('0x7'));var csv=require(_0xc2f7('0x8'));var ejs=require(_0xc2f7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc2f7('0xa'));var squel=require(_0xc2f7('0xb'));var crypto=require(_0xc2f7('0xc'));var jsforce=require(_0xc2f7('0xd'));var deskjs=require(_0xc2f7('0xe'));var toCsv=require(_0xc2f7('0x8'));var querystring=require(_0xc2f7('0xf'));var Papa=require('papaparse');var Redis=require(_0xc2f7('0x10'));var authService=require(_0xc2f7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc2f7('0x12'));var hardwareService=require(_0xc2f7('0x13'));var logger=require(_0xc2f7('0x14'))(_0xc2f7('0x15'));var utils=require('../../config/utils');var config=require(_0xc2f7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc2f7('0x17'))['db'];function respondWithStatusCode(_0x11fce2,_0x37c1cd){_0x37c1cd=_0x37c1cd||0xcc;return function(_0xaa3046){if(_0xaa3046){return _0x11fce2[_0xc2f7('0x18')](_0x37c1cd);}return _0x11fce2[_0xc2f7('0x19')](_0x37c1cd)['end']();};}function respondWithResult(_0x44240a,_0x582a52){_0x582a52=_0x582a52||0xc8;return function(_0x46007f){if(_0x46007f){return _0x44240a[_0xc2f7('0x19')](_0x582a52)[_0xc2f7('0x1a')](_0x46007f);}};}function respondWithFilteredResult(_0x243d80,_0x5a0fc5){return function(_0x463bad){if(_0x463bad){var _0xafdff5=typeof _0x5a0fc5[_0xc2f7('0x1b')]==='undefined'&&typeof _0x5a0fc5[_0xc2f7('0x1c')]===_0xc2f7('0x1d');var _0x51cd88=_0x463bad[_0xc2f7('0x1e')];var _0x5d87dd=_0xafdff5?0x0:_0x5a0fc5[_0xc2f7('0x1b')];var _0x34af41=_0xafdff5?_0x463bad[_0xc2f7('0x1e')]:_0x5a0fc5[_0xc2f7('0x1b')]+_0x5a0fc5[_0xc2f7('0x1c')];var _0x4c93d1;if(_0x34af41>=_0x51cd88){_0x34af41=_0x51cd88;_0x4c93d1=0xc8;}else{_0x4c93d1=0xce;}_0x243d80[_0xc2f7('0x19')](_0x4c93d1);return _0x243d80['set'](_0xc2f7('0x1f'),_0x5d87dd+'-'+_0x34af41+'/'+_0x51cd88)[_0xc2f7('0x1a')](_0x463bad);}return null;};}function patchUpdates(_0x361170){return function(_0x2d52c0){try{jsonpatch[_0xc2f7('0x20')](_0x2d52c0,_0x361170,!![]);}catch(_0x4f52df){return BPromise[_0xc2f7('0x21')](_0x4f52df);}return _0x2d52c0[_0xc2f7('0x22')]();};}function saveUpdates(_0x2f72eb,_0x2f8649){return function(_0x202e12){if(_0x202e12){return _0x202e12['update'](_0x2f72eb)[_0xc2f7('0x23')](function(_0x5477ef){return _0x5477ef;});}return null;};}function removeEntity(_0x1a3059,_0x39d84d){return function(_0x246908){if(_0x246908){return _0x246908['destroy']()['then'](function(){var _0x752087=_0x246908[_0xc2f7('0x24')]({'plain':!![]});var _0x43a8dc=_0xc2f7('0x25');return db[_0xc2f7('0x26')][_0xc2f7('0x27')]({'where':{'type':_0x43a8dc,'resourceId':_0x752087['id']}})[_0xc2f7('0x23')](function(){return _0x246908;});})[_0xc2f7('0x23')](function(){_0x1a3059[_0xc2f7('0x19')](0xcc)[_0xc2f7('0x28')]();});}};}function handleEntityNotFound(_0x39d0fa,_0x5c73f5){return function(_0x468d9a){if(!_0x468d9a){_0x39d0fa[_0xc2f7('0x18')](0x194);}return _0x468d9a;};}function handleError(_0xab47ec,_0x110e46){_0x110e46=_0x110e46||0x1f4;return function(_0x271505){logger[_0xc2f7('0x29')](_0x271505['stack']);if(_0x271505[_0xc2f7('0x2a')]){delete _0x271505[_0xc2f7('0x2a')];}_0xab47ec[_0xc2f7('0x19')](_0x110e46)['send'](_0x271505);};}exports['index']=function(_0x59a753,_0x38a861){var _0x4e62d7={},_0x2d681e={},_0x4a64cc={'count':0x0,'rows':[]};return db[_0xc2f7('0x2b')][_0xc2f7('0x2c')]()[_0xc2f7('0x23')](function(_0x1f0c68){_0x2d681e[_0xc2f7('0x2d')]=_['keys'](_0x1f0c68);_0x2d681e[_0xc2f7('0x2e')]=_[_0xc2f7('0x2f')](_0x59a753['query']);_0x2d681e['filters']=_['intersection'](_0x2d681e[_0xc2f7('0x2d')],_0x2d681e[_0xc2f7('0x2e')]);_0x4e62d7[_0xc2f7('0x30')]=_['intersection'](_0x2d681e['model'],qs[_0xc2f7('0x31')](_0x59a753['query'][_0xc2f7('0x31')]));_0x4e62d7[_0xc2f7('0x30')]=_0x4e62d7['attributes'][_0xc2f7('0x32')]?_0x4e62d7[_0xc2f7('0x30')]:_0x2d681e['model'];if(!_0x59a753[_0xc2f7('0x2e')][_0xc2f7('0x33')](_0xc2f7('0x34'))){_0x4e62d7[_0xc2f7('0x1c')]=qs[_0xc2f7('0x1c')](_0x59a753[_0xc2f7('0x2e')][_0xc2f7('0x1c')]);_0x4e62d7[_0xc2f7('0x1b')]=qs[_0xc2f7('0x1b')](_0x59a753[_0xc2f7('0x2e')][_0xc2f7('0x1b')]);}_0x4e62d7[_0xc2f7('0x35')]=qs[_0xc2f7('0x36')](_0x59a753[_0xc2f7('0x2e')][_0xc2f7('0x36')]);_0x4e62d7[_0xc2f7('0x37')]=qs[_0xc2f7('0x38')](_['pick'](_0x59a753[_0xc2f7('0x2e')],_0x2d681e[_0xc2f7('0x38')]),_0x1f0c68);if(_0x59a753[_0xc2f7('0x2e')][_0xc2f7('0x39')]){_0x4e62d7['where']=_[_0xc2f7('0x3a')](_0x4e62d7[_0xc2f7('0x37')],{'$or':_[_0xc2f7('0x3b')](_0x4e62d7['attributes'],function(_0x1860c7){var _0x4a6015={};_0x4a6015[_0x1860c7]={'$like':'%'+_0x59a753['query']['filter']+'%'};return _0x4a6015;})});}_0x4e62d7=_[_0xc2f7('0x3a')]({},_0x4e62d7,_0x59a753[_0xc2f7('0x3c')]);var _0xb869b4={'where':_0x4e62d7['where']};return db[_0xc2f7('0x2b')]['count'](_0xb869b4)['then'](function(_0x4abce8){_0x4a64cc[_0xc2f7('0x1e')]=_0x4abce8;if(_0x59a753[_0xc2f7('0x2e')][_0xc2f7('0x3d')]){_0x4e62d7[_0xc2f7('0x3e')]=[{'all':!![]}];}return db[_0xc2f7('0x2b')]['findAll'](_0x4e62d7);})['then'](function(_0x38d731){_0x4a64cc[_0xc2f7('0x3f')]=_0x38d731;return _0x4a64cc;})[_0xc2f7('0x23')](respondWithFilteredResult(_0x38a861,_0x4e62d7))[_0xc2f7('0x40')](handleError(_0x38a861,null));})[_0xc2f7('0x40')](handleError(_0x38a861,null));};exports['show']=function(_0xdaafdd,_0x547f0f){var _0x206699={'raw':![],'where':{'id':_0xdaafdd[_0xc2f7('0x41')]['id']}},_0xd1443={};_0xd1443[_0xc2f7('0x2d')]=_[_0xc2f7('0x2f')](db[_0xc2f7('0x2b')][_0xc2f7('0x42')]);_0xd1443['query']=_[_0xc2f7('0x2f')](_0xdaafdd['query']);_0xd1443['filters']=_[_0xc2f7('0x43')](_0xd1443[_0xc2f7('0x2d')],_0xd1443['query']);_0x206699['attributes']=_['intersection'](_0xd1443['model'],qs['fields'](_0xdaafdd[_0xc2f7('0x2e')][_0xc2f7('0x31')]));_0x206699['attributes']=_0x206699[_0xc2f7('0x30')][_0xc2f7('0x32')]?_0x206699['attributes']:_0xd1443[_0xc2f7('0x2d')];if(_0xdaafdd[_0xc2f7('0x2e')][_0xc2f7('0x3d')]){_0x206699[_0xc2f7('0x3e')]=[{'all':!![]}];}_0x206699=_[_0xc2f7('0x3a')]({},_0x206699,_0xdaafdd[_0xc2f7('0x3c')]);return db[_0xc2f7('0x2b')][_0xc2f7('0x44')](_0x206699)[_0xc2f7('0x23')](handleEntityNotFound(_0x547f0f,null))['then'](respondWithResult(_0x547f0f,null))[_0xc2f7('0x40')](handleError(_0x547f0f,null));};exports[_0xc2f7('0x45')]=function(_0x4405e5,_0x57283c){return db['CmCompany'][_0xc2f7('0x45')](_0x4405e5[_0xc2f7('0x46')],{})[_0xc2f7('0x23')](function(_0x44fa63){var _0x57099b=_0x4405e5['user'][_0xc2f7('0x24')]({'plain':!![]});if(!_0x57099b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57099b['role']===_0xc2f7('0x47')){var _0x519ae3=_0x44fa63[_0xc2f7('0x24')]({'plain':!![]});var _0x7e2c04='Companies';return db[_0xc2f7('0x48')][_0xc2f7('0x44')]({'where':{'name':_0x7e2c04,'userProfileId':_0x57099b[_0xc2f7('0x49')]},'raw':!![]})[_0xc2f7('0x23')](function(_0x195ed0){if(_0x195ed0&&_0x195ed0[_0xc2f7('0x4a')]===0x0){return db['UserProfileResource'][_0xc2f7('0x45')]({'name':_0x519ae3['name'],'resourceId':_0x519ae3['id'],'type':_0x195ed0[_0xc2f7('0x2a')],'sectionId':_0x195ed0['id']},{})['then'](function(){return _0x44fa63;});}else{return _0x44fa63;}})[_0xc2f7('0x40')](function(_0x59a6e6){logger[_0xc2f7('0x29')](_0xc2f7('0x4b'),_0x59a6e6);throw _0x59a6e6;});}return _0x44fa63;})[_0xc2f7('0x23')](respondWithResult(_0x57283c,0xc9))['catch'](handleError(_0x57283c,null));};exports[_0xc2f7('0x4c')]=function(_0x20f595,_0x3ab0c8){if(_0x20f595[_0xc2f7('0x46')]['id']){delete _0x20f595[_0xc2f7('0x46')]['id'];}return db[_0xc2f7('0x2b')][_0xc2f7('0x44')]({'where':{'id':_0x20f595[_0xc2f7('0x41')]['id']}})[_0xc2f7('0x23')](handleEntityNotFound(_0x3ab0c8,null))[_0xc2f7('0x23')](saveUpdates(_0x20f595[_0xc2f7('0x46')],null))['then'](respondWithResult(_0x3ab0c8,null))[_0xc2f7('0x40')](handleError(_0x3ab0c8,null));};exports[_0xc2f7('0x27')]=function(_0x2735c9,_0x4cb09f){return db[_0xc2f7('0x2b')][_0xc2f7('0x44')]({'where':{'id':_0x2735c9[_0xc2f7('0x41')]['id']}})[_0xc2f7('0x23')](handleEntityNotFound(_0x4cb09f,null))[_0xc2f7('0x23')](removeEntity(_0x4cb09f,null))[_0xc2f7('0x40')](handleError(_0x4cb09f,null));};exports['describe']=function(_0x37c293,_0x42b8aa){return db[_0xc2f7('0x2b')]['describe']()['then'](respondWithResult(_0x42b8aa,null))[_0xc2f7('0x40')](handleError(_0x42b8aa,null));};exports[_0xc2f7('0x4d')]=function(_0x4161f3,_0x5d6177,_0x2537c4){return db[_0xc2f7('0x4e')][_0xc2f7('0x44')]({'where':{'id':_0x4161f3[_0xc2f7('0x41')]['id']}})[_0xc2f7('0x23')](handleEntityNotFound(_0x5d6177,null))[_0xc2f7('0x23')](function(_0x228515){if(_0x228515){return _0x228515[_0xc2f7('0x4d')](_0x4161f3[_0xc2f7('0x46')][_0xc2f7('0x4f')],_[_0xc2f7('0x50')](_0x4161f3[_0xc2f7('0x46')],[_0xc2f7('0x4f'),'id'])||{});}})[_0xc2f7('0x23')](respondWithResult(_0x5d6177,null))['catch'](handleError(_0x5d6177,null));};exports[_0xc2f7('0x51')]=function(_0x8ffed4,_0x2e3363,_0x4388cf){var _0x480bf7={};var _0x1e088b={};var _0x2a1caa;var _0x316539;return db[_0xc2f7('0x2b')][_0xc2f7('0x52')]({'where':{'id':_0x8ffed4[_0xc2f7('0x41')]['id']}})[_0xc2f7('0x23')](handleEntityNotFound(_0x2e3363,null))[_0xc2f7('0x23')](function(_0x28601e){if(_0x28601e){_0x2a1caa=_0x28601e;_0x1e088b[_0xc2f7('0x2d')]=_[_0xc2f7('0x2f')](db[_0xc2f7('0x4e')][_0xc2f7('0x42')]);_0x1e088b[_0xc2f7('0x2e')]=_[_0xc2f7('0x2f')](_0x8ffed4[_0xc2f7('0x2e')]);_0x1e088b[_0xc2f7('0x38')]=_[_0xc2f7('0x43')](_0x1e088b[_0xc2f7('0x2d')],_0x1e088b[_0xc2f7('0x2e')]);_0x480bf7[_0xc2f7('0x30')]=_['intersection'](_0x1e088b[_0xc2f7('0x2d')],qs[_0xc2f7('0x31')](_0x8ffed4['query'][_0xc2f7('0x31')]));_0x480bf7[_0xc2f7('0x30')]=_0x480bf7['attributes'][_0xc2f7('0x32')]?_0x480bf7[_0xc2f7('0x30')]:_0x1e088b[_0xc2f7('0x2d')];_0x480bf7['order']=qs[_0xc2f7('0x36')](_0x8ffed4[_0xc2f7('0x2e')][_0xc2f7('0x36')]);_0x480bf7['where']=qs[_0xc2f7('0x38')](_[_0xc2f7('0x53')](_0x8ffed4[_0xc2f7('0x2e')],_0x1e088b['filters']));if(_0x8ffed4[_0xc2f7('0x2e')]['filter']){_0x480bf7['where']=_['merge'](_0x480bf7[_0xc2f7('0x37')],{'$or':_[_0xc2f7('0x3b')](_0x480bf7[_0xc2f7('0x30')],function(_0x1b6af1){var _0x5f4bd1={};_0x5f4bd1[_0x1b6af1]={'$like':'%'+_0x8ffed4[_0xc2f7('0x2e')]['filter']+'%'};return _0x5f4bd1;})});}_0x480bf7=_[_0xc2f7('0x3a')]({},_0x480bf7,_0x8ffed4[_0xc2f7('0x3c')]);return _0x2a1caa[_0xc2f7('0x51')](_0x480bf7);}})['then'](function(_0x4b9b62){if(_0x4b9b62){_0x316539=_0x4b9b62[_0xc2f7('0x32')];if(!_0x8ffed4['query'][_0xc2f7('0x33')](_0xc2f7('0x34'))){_0x480bf7[_0xc2f7('0x1c')]=qs['limit'](_0x8ffed4[_0xc2f7('0x2e')][_0xc2f7('0x1c')]);_0x480bf7[_0xc2f7('0x1b')]=qs[_0xc2f7('0x1b')](_0x8ffed4['query'][_0xc2f7('0x1b')]);}return _0x2a1caa['getContacts'](_0x480bf7);}})[_0xc2f7('0x23')](function(_0x227ef8){if(_0x227ef8){return _0x227ef8?{'count':_0x316539,'rows':_0x227ef8}:null;}})['then'](respondWithResult(_0x2e3363,null))['catch'](handleError(_0x2e3363,null));}; \ No newline at end of file +var _0x473e=['role','UserProfileSection','userProfileId','update','addContacts','ids','omit','getContacts','findOne','order','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','Companies','UserProfileResource','end','error','stack','name','send','describe','keys','intersection','attributes','model','query','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','options','includeAll','include','findAll','rows','show','params','rawAttributes','CmCompany','find','catch','create','body','user'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0x473e,0x1c7));var _0xe473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x473e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe473('0x0'));var rimraf=require(_0xe473('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe473('0x2'));var rp=require(_0xe473('0x3'));var moment=require(_0xe473('0x4'));var BPromise=require(_0xe473('0x5'));var Mustache=require(_0xe473('0x6'));var util=require('util');var path=require(_0xe473('0x7'));var sox=require(_0xe473('0x8'));var csv=require(_0xe473('0x9'));var ejs=require(_0xe473('0xa'));var fs=require('fs');var fs_extra=require(_0xe473('0xb'));var _=require(_0xe473('0xc'));var squel=require(_0xe473('0xd'));var crypto=require('crypto');var jsforce=require(_0xe473('0xe'));var deskjs=require(_0xe473('0xf'));var toCsv=require(_0xe473('0x9'));var querystring=require(_0xe473('0x10'));var Papa=require(_0xe473('0x11'));var Redis=require(_0xe473('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe473('0x13'));var as=require(_0xe473('0x14'));var hardwareService=require(_0xe473('0x15'));var logger=require(_0xe473('0x16'))(_0xe473('0x17'));var utils=require(_0xe473('0x18'));var config=require(_0xe473('0x19'));var licenseUtil=require(_0xe473('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dfa4e,_0x2ea150){_0x2ea150=_0x2ea150||0xcc;return function(_0x3e5b3b){if(_0x3e5b3b){return _0x4dfa4e[_0xe473('0x1b')](_0x2ea150);}return _0x4dfa4e[_0xe473('0x1c')](_0x2ea150)['end']();};}function respondWithResult(_0x19bc68,_0x493a4d){_0x493a4d=_0x493a4d||0xc8;return function(_0x5a4dda){if(_0x5a4dda){return _0x19bc68[_0xe473('0x1c')](_0x493a4d)[_0xe473('0x1d')](_0x5a4dda);}};}function respondWithFilteredResult(_0x590ead,_0x6398){return function(_0x530cd4){if(_0x530cd4){var _0x295eb0=typeof _0x6398[_0xe473('0x1e')]==='undefined'&&typeof _0x6398[_0xe473('0x1f')]===_0xe473('0x20');var _0x40d4b8=_0x530cd4[_0xe473('0x21')];var _0x3cb3ce=_0x295eb0?0x0:_0x6398[_0xe473('0x1e')];var _0x1ca045=_0x295eb0?_0x530cd4['count']:_0x6398['offset']+_0x6398['limit'];var _0x587919;if(_0x1ca045>=_0x40d4b8){_0x1ca045=_0x40d4b8;_0x587919=0xc8;}else{_0x587919=0xce;}_0x590ead[_0xe473('0x1c')](_0x587919);return _0x590ead[_0xe473('0x22')](_0xe473('0x23'),_0x3cb3ce+'-'+_0x1ca045+'/'+_0x40d4b8)[_0xe473('0x1d')](_0x530cd4);}return null;};}function patchUpdates(_0x47d49d){return function(_0x1234da){try{jsonpatch['apply'](_0x1234da,_0x47d49d,!![]);}catch(_0x32425c){return BPromise[_0xe473('0x24')](_0x32425c);}return _0x1234da[_0xe473('0x25')]();};}function saveUpdates(_0x2fd4e7,_0x427925){return function(_0x28f785){if(_0x28f785){return _0x28f785['update'](_0x2fd4e7)[_0xe473('0x26')](function(_0x492e13){return _0x492e13;});}return null;};}function removeEntity(_0x48c6c0,_0x5655b8){return function(_0x167b03){if(_0x167b03){return _0x167b03[_0xe473('0x27')]()[_0xe473('0x26')](function(){var _0x19fede=_0x167b03[_0xe473('0x28')]({'plain':!![]});var _0x4043ad=_0xe473('0x29');return db[_0xe473('0x2a')][_0xe473('0x27')]({'where':{'type':_0x4043ad,'resourceId':_0x19fede['id']}})['then'](function(){return _0x167b03;});})['then'](function(){_0x48c6c0[_0xe473('0x1c')](0xcc)[_0xe473('0x2b')]();});}};}function handleEntityNotFound(_0x58f180,_0x1685b9){return function(_0x3f0b60){if(!_0x3f0b60){_0x58f180[_0xe473('0x1b')](0x194);}return _0x3f0b60;};}function handleError(_0x1ee26a,_0x5f8e41){_0x5f8e41=_0x5f8e41||0x1f4;return function(_0x238fea){logger[_0xe473('0x2c')](_0x238fea[_0xe473('0x2d')]);if(_0x238fea[_0xe473('0x2e')]){delete _0x238fea[_0xe473('0x2e')];}_0x1ee26a['status'](_0x5f8e41)[_0xe473('0x2f')](_0x238fea);};}exports['index']=function(_0x3cbed6,_0x3f1560){var _0x35aff0={},_0x1a3bf9={},_0x385c4d={'count':0x0,'rows':[]};return db['CmCompany'][_0xe473('0x30')]()[_0xe473('0x26')](function(_0x599bbc){_0x1a3bf9['model']=_[_0xe473('0x31')](_0x599bbc);_0x1a3bf9['query']=_['keys'](_0x3cbed6['query']);_0x1a3bf9['filters']=_[_0xe473('0x32')](_0x1a3bf9['model'],_0x1a3bf9['query']);_0x35aff0[_0xe473('0x33')]=_['intersection'](_0x1a3bf9[_0xe473('0x34')],qs['fields'](_0x3cbed6[_0xe473('0x35')][_0xe473('0x36')]));_0x35aff0[_0xe473('0x33')]=_0x35aff0[_0xe473('0x33')][_0xe473('0x37')]?_0x35aff0['attributes']:_0x1a3bf9[_0xe473('0x34')];if(!_0x3cbed6['query'][_0xe473('0x38')](_0xe473('0x39'))){_0x35aff0['limit']=qs[_0xe473('0x1f')](_0x3cbed6[_0xe473('0x35')][_0xe473('0x1f')]);_0x35aff0[_0xe473('0x1e')]=qs[_0xe473('0x1e')](_0x3cbed6['query'][_0xe473('0x1e')]);}_0x35aff0['order']=qs[_0xe473('0x3a')](_0x3cbed6[_0xe473('0x35')][_0xe473('0x3a')]);_0x35aff0[_0xe473('0x3b')]=qs[_0xe473('0x3c')](_[_0xe473('0x3d')](_0x3cbed6[_0xe473('0x35')],_0x1a3bf9['filters']),_0x599bbc);if(_0x3cbed6['query'][_0xe473('0x3e')]){_0x35aff0[_0xe473('0x3b')]=_[_0xe473('0x3f')](_0x35aff0[_0xe473('0x3b')],{'$or':_[_0xe473('0x40')](_0x35aff0[_0xe473('0x33')],function(_0x5c0cee){var _0x424139={};_0x424139[_0x5c0cee]={'$like':'%'+_0x3cbed6[_0xe473('0x35')][_0xe473('0x3e')]+'%'};return _0x424139;})});}_0x35aff0=_[_0xe473('0x3f')]({},_0x35aff0,_0x3cbed6[_0xe473('0x41')]);var _0x1e0010={'where':_0x35aff0['where']};return db['CmCompany']['count'](_0x1e0010)['then'](function(_0x3be10d){_0x385c4d[_0xe473('0x21')]=_0x3be10d;if(_0x3cbed6[_0xe473('0x35')][_0xe473('0x42')]){_0x35aff0[_0xe473('0x43')]=[{'all':!![]}];}return db['CmCompany'][_0xe473('0x44')](_0x35aff0);})[_0xe473('0x26')](function(_0x1faaa3){_0x385c4d[_0xe473('0x45')]=_0x1faaa3;return _0x385c4d;})[_0xe473('0x26')](respondWithFilteredResult(_0x3f1560,_0x35aff0))['catch'](handleError(_0x3f1560,null));})['catch'](handleError(_0x3f1560,null));};exports[_0xe473('0x46')]=function(_0xe3538,_0x3ce342){var _0x1789cd={'raw':![],'where':{'id':_0xe3538[_0xe473('0x47')]['id']}},_0x215694={};_0x215694[_0xe473('0x34')]=_[_0xe473('0x31')](db['CmCompany'][_0xe473('0x48')]);_0x215694[_0xe473('0x35')]=_[_0xe473('0x31')](_0xe3538['query']);_0x215694[_0xe473('0x3c')]=_[_0xe473('0x32')](_0x215694[_0xe473('0x34')],_0x215694[_0xe473('0x35')]);_0x1789cd[_0xe473('0x33')]=_['intersection'](_0x215694['model'],qs[_0xe473('0x36')](_0xe3538['query'][_0xe473('0x36')]));_0x1789cd[_0xe473('0x33')]=_0x1789cd['attributes'][_0xe473('0x37')]?_0x1789cd['attributes']:_0x215694[_0xe473('0x34')];if(_0xe3538[_0xe473('0x35')]['includeAll']){_0x1789cd['include']=[{'all':!![]}];}_0x1789cd=_[_0xe473('0x3f')]({},_0x1789cd,_0xe3538[_0xe473('0x41')]);return db[_0xe473('0x49')][_0xe473('0x4a')](_0x1789cd)[_0xe473('0x26')](handleEntityNotFound(_0x3ce342,null))[_0xe473('0x26')](respondWithResult(_0x3ce342,null))[_0xe473('0x4b')](handleError(_0x3ce342,null));};exports[_0xe473('0x4c')]=function(_0x5d79ed,_0x123e96){return db[_0xe473('0x49')][_0xe473('0x4c')](_0x5d79ed[_0xe473('0x4d')],{})[_0xe473('0x26')](function(_0x477d18){var _0x353205=_0x5d79ed[_0xe473('0x4e')][_0xe473('0x28')]({'plain':!![]});if(!_0x353205)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x353205[_0xe473('0x4f')]==='user'){var _0x1ddc82=_0x477d18[_0xe473('0x28')]({'plain':!![]});var _0x19f6db='Companies';return db[_0xe473('0x50')][_0xe473('0x4a')]({'where':{'name':_0x19f6db,'userProfileId':_0x353205[_0xe473('0x51')]},'raw':!![]})[_0xe473('0x26')](function(_0x302762){if(_0x302762&&_0x302762['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1ddc82[_0xe473('0x2e')],'resourceId':_0x1ddc82['id'],'type':_0x302762[_0xe473('0x2e')],'sectionId':_0x302762['id']},{})['then'](function(){return _0x477d18;});}else{return _0x477d18;}})['catch'](function(_0x5dd385){logger[_0xe473('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dd385);throw _0x5dd385;});}return _0x477d18;})[_0xe473('0x26')](respondWithResult(_0x123e96,0xc9))[_0xe473('0x4b')](handleError(_0x123e96,null));};exports[_0xe473('0x52')]=function(_0x3fff8e,_0x57c8dc){if(_0x3fff8e[_0xe473('0x4d')]['id']){delete _0x3fff8e['body']['id'];}return db[_0xe473('0x49')][_0xe473('0x4a')]({'where':{'id':_0x3fff8e[_0xe473('0x47')]['id']}})['then'](handleEntityNotFound(_0x57c8dc,null))['then'](saveUpdates(_0x3fff8e['body'],null))['then'](respondWithResult(_0x57c8dc,null))[_0xe473('0x4b')](handleError(_0x57c8dc,null));};exports[_0xe473('0x27')]=function(_0x3503c0,_0x1f2dd9){return db[_0xe473('0x49')]['find']({'where':{'id':_0x3503c0[_0xe473('0x47')]['id']}})[_0xe473('0x26')](handleEntityNotFound(_0x1f2dd9,null))['then'](removeEntity(_0x1f2dd9,null))['catch'](handleError(_0x1f2dd9,null));};exports[_0xe473('0x30')]=function(_0x24efa9,_0x2484a8){return db['CmCompany'][_0xe473('0x30')]()[_0xe473('0x26')](respondWithResult(_0x2484a8,null))[_0xe473('0x4b')](handleError(_0x2484a8,null));};exports[_0xe473('0x53')]=function(_0x5d35eb,_0x78aece,_0x5006c7){return db['CmContact'][_0xe473('0x4a')]({'where':{'id':_0x5d35eb['params']['id']}})['then'](handleEntityNotFound(_0x78aece,null))[_0xe473('0x26')](function(_0x30445b){if(_0x30445b){return _0x30445b[_0xe473('0x53')](_0x5d35eb[_0xe473('0x4d')][_0xe473('0x54')],_[_0xe473('0x55')](_0x5d35eb[_0xe473('0x4d')],[_0xe473('0x54'),'id'])||{});}})['then'](respondWithResult(_0x78aece,null))[_0xe473('0x4b')](handleError(_0x78aece,null));};exports[_0xe473('0x56')]=function(_0x5dde99,_0x2efea5,_0x43a2f0){var _0x43a02d={};var _0x131b29={};var _0x55fa5c;var _0x3615f2;return db[_0xe473('0x49')][_0xe473('0x57')]({'where':{'id':_0x5dde99[_0xe473('0x47')]['id']}})[_0xe473('0x26')](handleEntityNotFound(_0x2efea5,null))['then'](function(_0xe5eaee){if(_0xe5eaee){_0x55fa5c=_0xe5eaee;_0x131b29[_0xe473('0x34')]=_['keys'](db['CmContact'][_0xe473('0x48')]);_0x131b29[_0xe473('0x35')]=_[_0xe473('0x31')](_0x5dde99[_0xe473('0x35')]);_0x131b29['filters']=_['intersection'](_0x131b29[_0xe473('0x34')],_0x131b29[_0xe473('0x35')]);_0x43a02d[_0xe473('0x33')]=_['intersection'](_0x131b29['model'],qs[_0xe473('0x36')](_0x5dde99[_0xe473('0x35')]['fields']));_0x43a02d[_0xe473('0x33')]=_0x43a02d[_0xe473('0x33')][_0xe473('0x37')]?_0x43a02d[_0xe473('0x33')]:_0x131b29['model'];_0x43a02d[_0xe473('0x58')]=qs[_0xe473('0x3a')](_0x5dde99['query']['sort']);_0x43a02d['where']=qs[_0xe473('0x3c')](_[_0xe473('0x3d')](_0x5dde99[_0xe473('0x35')],_0x131b29[_0xe473('0x3c')]));if(_0x5dde99[_0xe473('0x35')][_0xe473('0x3e')]){_0x43a02d[_0xe473('0x3b')]=_[_0xe473('0x3f')](_0x43a02d[_0xe473('0x3b')],{'$or':_[_0xe473('0x40')](_0x43a02d[_0xe473('0x33')],function(_0x5acd53){var _0x2a5fcd={};_0x2a5fcd[_0x5acd53]={'$like':'%'+_0x5dde99[_0xe473('0x35')][_0xe473('0x3e')]+'%'};return _0x2a5fcd;})});}_0x43a02d=_[_0xe473('0x3f')]({},_0x43a02d,_0x5dde99[_0xe473('0x41')]);return _0x55fa5c['getContacts'](_0x43a02d);}})[_0xe473('0x26')](function(_0x3b0f81){if(_0x3b0f81){_0x3615f2=_0x3b0f81[_0xe473('0x37')];if(!_0x5dde99['query'][_0xe473('0x38')]('nolimit')){_0x43a02d[_0xe473('0x1f')]=qs['limit'](_0x5dde99[_0xe473('0x35')]['limit']);_0x43a02d[_0xe473('0x1e')]=qs[_0xe473('0x1e')](_0x5dde99[_0xe473('0x35')][_0xe473('0x1e')]);}return _0x55fa5c[_0xe473('0x56')](_0x43a02d);}})[_0xe473('0x26')](function(_0x48fa3f){if(_0x48fa3f){return _0x48fa3f?{'count':_0x3615f2,'rows':_0x48fa3f}:null;}})[_0xe473('0x26')](respondWithResult(_0x2efea5,null))[_0xe473('0x4b')](handleError(_0x2efea5,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index aa1d87e..a6f3b11 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 _0xa22b=['bluebird','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','lodash','../../config/logger','api'];(function(_0x52fbb5,_0x35eafb){var _0x55bcbc=function(_0x4b58cb){while(--_0x4b58cb){_0x52fbb5['push'](_0x52fbb5['shift']());}};_0x55bcbc(++_0x35eafb);}(_0xa22b,0x165));var _0xba22=function(_0xe70ad1,_0x5ba59b){_0xe70ad1=_0xe70ad1-0x0;var _0x58d349=_0xa22b[_0xe70ad1];return _0x58d349;};'use strict';var _=require(_0xba22('0x0'));var util=require('util');var logger=require(_0xba22('0x1'))(_0xba22('0x2'));var moment=require('moment');var BPromise=require(_0xba22('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba22('0x4'));var rimraf=require(_0xba22('0x5'));var config=require('../../config/environment');var attributes=require(_0xba22('0x6'));module[_0xba22('0x7')]=function(_0x333b50,_0x81b0ec){return _0x333b50[_0xba22('0x8')](_0xba22('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74e7=['../../config/environment','./cmCompany.attributes','exports','define','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x21741d,_0x2a0530){var _0x1a41c1=function(_0x581a05){while(--_0x581a05){_0x21741d['push'](_0x21741d['shift']());}};_0x1a41c1(++_0x2a0530);}(_0x74e7,0xa1));var _0x774e=function(_0x25a8c5,_0x227f9d){_0x25a8c5=_0x25a8c5-0x0;var _0x1d698d=_0x74e7[_0x25a8c5];return _0x1d698d;};'use strict';var _=require(_0x774e('0x0'));var util=require(_0x774e('0x1'));var logger=require(_0x774e('0x2'))(_0x774e('0x3'));var moment=require(_0x774e('0x4'));var BPromise=require(_0x774e('0x5'));var rp=require(_0x774e('0x6'));var fs=require('fs');var path=require(_0x774e('0x7'));var rimraf=require('rimraf');var config=require(_0x774e('0x8'));var attributes=require(_0x774e('0x9'));module[_0x774e('0xa')]=function(_0x453443,_0x2a7723){return _0x453443[_0x774e('0xb')]('CmCompany',attributes,{'tableName':_0x774e('0xc'),'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 d4d6e60..9521581 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 _0x2248=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x238743,_0x4449b9){var _0xf62818=function(_0x50fd5a){while(--_0x50fd5a){_0x238743['push'](_0x238743['shift']());}};_0xf62818(++_0x4449b9);}(_0x2248,0x15d));var _0x8224=function(_0x5846fc,_0x20ec41){_0x5846fc=_0x5846fc-0x0;var _0xdcd96b=_0x2248[_0x5846fc];return _0xdcd96b;};'use strict';var _=require(_0x8224('0x0'));var util=require(_0x8224('0x1'));var moment=require(_0x8224('0x2'));var BPromise=require(_0x8224('0x3'));var rs=require(_0x8224('0x4'));var fs=require('fs');var Redis=require(_0x8224('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8224('0x6'));var logger=require('../../config/logger')(_0x8224('0x7'));var config=require('../../config/environment');var jayson=require(_0x8224('0x8'));var client=jayson['client'][_0x8224('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20bda1,_0x22892e,_0x25b96f){return new BPromise(function(_0x1e7da2,_0x3c7a90){return client[_0x8224('0xa')](_0x20bda1,_0x25b96f)[_0x8224('0xb')](function(_0x190ffb){logger[_0x8224('0xc')](_0x8224('0xd'),_0x22892e,_0x8224('0xe'));logger[_0x8224('0xf')](_0x8224('0x10'),_0x22892e,_0x8224('0xe'),JSON[_0x8224('0x11')](_0x190ffb));if(_0x190ffb[_0x8224('0x12')]){if(_0x190ffb[_0x8224('0x12')][_0x8224('0x13')]===0x1f4){logger[_0x8224('0x12')](_0x8224('0xd'),_0x22892e,_0x190ffb[_0x8224('0x12')][_0x8224('0x14')]);return _0x3c7a90(_0x190ffb[_0x8224('0x12')]['message']);}logger[_0x8224('0x12')](_0x8224('0xd'),_0x22892e,_0x190ffb['error']['message']);return _0x1e7da2(_0x190ffb[_0x8224('0x12')][_0x8224('0x14')]);}else{logger[_0x8224('0xc')](_0x8224('0xd'),_0x22892e,_0x8224('0xe'));_0x1e7da2(_0x190ffb[_0x8224('0x15')][_0x8224('0x14')]);}})[_0x8224('0x16')](function(_0x8a9673){logger['error']('CmCompany,\x20%s,\x20%s',_0x22892e,_0x8a9673);_0x3c7a90(_0x8a9673);});});} \ No newline at end of file +var _0xae0b=['CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','CmCompany,\x20%s,\x20%s'];(function(_0x4dd943,_0x5f379e){var _0x4e06ee=function(_0x2c1747){while(--_0x2c1747){_0x4dd943['push'](_0x4dd943['shift']());}};_0x4e06ee(++_0x5f379e);}(_0xae0b,0xc4));var _0xbae0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae0b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbae0('0x0'));var util=require(_0xbae0('0x1'));var moment=require(_0xbae0('0x2'));var BPromise=require('bluebird');var rs=require(_0xbae0('0x3'));var fs=require('fs');var Redis=require(_0xbae0('0x4'));var db=require(_0xbae0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbae0('0x6'));var config=require(_0xbae0('0x7'));var jayson=require(_0xbae0('0x8'));var client=jayson['client'][_0xbae0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ebf2b,_0x1ae949,_0x50087c){return new BPromise(function(_0x3d294e,_0x48b6fe){return client['request'](_0x4ebf2b,_0x50087c)[_0xbae0('0xa')](function(_0x2aef20){logger[_0xbae0('0xb')](_0xbae0('0xc'),_0x1ae949,'request\x20sent');logger['debug'](_0xbae0('0xd'),_0x1ae949,_0xbae0('0xe'),JSON['stringify'](_0x2aef20));if(_0x2aef20[_0xbae0('0xf')]){if(_0x2aef20[_0xbae0('0xf')][_0xbae0('0x10')]===0x1f4){logger[_0xbae0('0xf')](_0xbae0('0xc'),_0x1ae949,_0x2aef20[_0xbae0('0xf')][_0xbae0('0x11')]);return _0x48b6fe(_0x2aef20[_0xbae0('0xf')][_0xbae0('0x11')]);}logger['error'](_0xbae0('0xc'),_0x1ae949,_0x2aef20['error'][_0xbae0('0x11')]);return _0x3d294e(_0x2aef20[_0xbae0('0xf')][_0xbae0('0x11')]);}else{logger[_0xbae0('0xb')]('CmCompany,\x20%s,\x20%s',_0x1ae949,_0xbae0('0xe'));_0x3d294e(_0x2aef20['result'][_0xbae0('0x11')]);}})[_0xbae0('0x12')](function(_0xbc126b){logger[_0xbae0('0xf')](_0xbae0('0xc'),_0x1ae949,_0xbc126b);_0x48b6fe(_0xbc126b);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index a163984..a5c37c3 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 _0xa25d=['../../config/environment','get','/describe','isAuthenticated','describe','show','create','post','addContacts','put','/:id','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x329e45,_0x2a09db){var _0x25c632=function(_0x257b65){while(--_0x257b65){_0x329e45['push'](_0x329e45['shift']());}};_0x25c632(++_0x2a09db);}(_0xa25d,0x1e0));var _0xda25=function(_0x529587,_0x7b9e47){_0x529587=_0x529587-0x0;var _0x4ea039=_0xa25d[_0x529587];return _0x4ea039;};'use strict';var multer=require(_0xda25('0x0'));var util=require(_0xda25('0x1'));var path=require('path');var timeout=require(_0xda25('0x2'));var express=require('express');var router=express[_0xda25('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xda25('0x4'));var interaction=require(_0xda25('0x5'));var config=require(_0xda25('0x6'));var controller=require('./cmCompany.controller');router[_0xda25('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xda25('0x7')](_0xda25('0x8'),auth[_0xda25('0x9')](),controller[_0xda25('0xa')]);router[_0xda25('0x7')]('/:id',auth[_0xda25('0x9')](),controller[_0xda25('0xb')]);router[_0xda25('0x7')]('/:id/contacts',auth[_0xda25('0x9')](),controller['getContacts']);router['post']('/',auth[_0xda25('0x9')](),controller[_0xda25('0xc')]);router[_0xda25('0xd')]('/:id/contacts',auth[_0xda25('0x9')](),controller[_0xda25('0xe')]);router[_0xda25('0xf')](_0xda25('0x10'),auth[_0xda25('0x9')](),controller['update']);router['delete'](_0xda25('0x10'),auth['isAuthenticated'](),controller[_0xda25('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbec2=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','show','getContacts','create','post','addContacts','put','/:id','delete','exports','multer','util'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xbec2,0x166));var _0x2bec=function(_0x12fd41,_0x1e27c1){_0x12fd41=_0x12fd41-0x0;var _0x3f35ca=_0xbec2[_0x12fd41];return _0x3f35ca;};'use strict';var multer=require(_0x2bec('0x0'));var util=require(_0x2bec('0x1'));var path=require(_0x2bec('0x2'));var timeout=require(_0x2bec('0x3'));var express=require(_0x2bec('0x4'));var router=express[_0x2bec('0x5')]();var fs_extra=require(_0x2bec('0x6'));var auth=require(_0x2bec('0x7'));var interaction=require(_0x2bec('0x8'));var config=require(_0x2bec('0x9'));var controller=require(_0x2bec('0xa'));router[_0x2bec('0xb')]('/',auth[_0x2bec('0xc')](),controller[_0x2bec('0xd')]);router[_0x2bec('0xb')](_0x2bec('0xe'),auth['isAuthenticated'](),controller['describe']);router[_0x2bec('0xb')]('/:id',auth[_0x2bec('0xc')](),controller[_0x2bec('0xf')]);router['get']('/:id/contacts',auth[_0x2bec('0xc')](),controller[_0x2bec('0x10')]);router['post']('/',auth[_0x2bec('0xc')](),controller[_0x2bec('0x11')]);router[_0x2bec('0x12')]('/:id/contacts',auth[_0x2bec('0xc')](),controller[_0x2bec('0x13')]);router[_0x2bec('0x14')](_0x2bec('0x15'),auth[_0x2bec('0xc')](),controller['update']);router[_0x2bec('0x16')](_0x2bec('0x15'),auth[_0x2bec('0xc')](),controller['destroy']);module[_0x2bec('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3c4df86..61c7f06 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 _0x580f=['DATE','NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x580f,0x172));var _0xf580=function(_0x3a923c,_0x18c5e0){_0x3a923c=_0x3a923c-0x0;var _0x14096d=_0x580f[_0x3a923c];return _0x14096d;};'use strict';var _=require(_0xf580('0x0'));var Sequelize=require('sequelize');module[_0xf580('0x1')]={'firstName':{'type':Sequelize[_0xf580('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf580('0x2')]},'street':{'type':Sequelize[_0xf580('0x2')]},'postalCode':{'type':Sequelize[_0xf580('0x2')]},'city':{'type':Sequelize[_0xf580('0x2')]},'country':{'type':Sequelize[_0xf580('0x2')]},'dateOfBirth':{'type':Sequelize[_0xf580('0x2')]},'description':{'type':Sequelize[_0xf580('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xf580('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf580('0x2')]},'url':{'type':Sequelize[_0xf580('0x2')]},'facebook':{'type':Sequelize[_0xf580('0x2')]},'fb_data':{'type':Sequelize[_0xf580('0x2')]},'twitter':{'type':Sequelize[_0xf580('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xf580('0x2')]},'viber':{'type':Sequelize[_0xf580('0x2')]},'line':{'type':Sequelize[_0xf580('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xf580('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xf580('0x2')]},'priority':{'type':Sequelize[_0xf580('0x4')](0x2)[_0xf580('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf580('0x6')],'defaultValue':Sequelize[_0xf580('0x7')]},'dialTimezone':{'type':Sequelize[_0xf580('0x2')]},'utcOffset':{'type':Sequelize[_0xf580('0x4')]}}; \ No newline at end of file +var _0xe97f=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x78db5e,_0x3b9804){var _0x250b88=function(_0x20a40f){while(--_0x20a40f){_0x78db5e['push'](_0x78db5e['shift']());}};_0x250b88(++_0x3b9804);}(_0xe97f,0x1de));var _0xfe97=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe97f[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xfe97('0x0'));var Sequelize=require(_0xfe97('0x1'));module[_0xfe97('0x2')]={'firstName':{'type':Sequelize[_0xfe97('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xfe97('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xfe97('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xfe97('0x3')]},'description':{'type':Sequelize[_0xfe97('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfe97('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xfe97('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xfe97('0x3')]},'twitter':{'type':Sequelize[_0xfe97('0x3')]},'skype':{'type':Sequelize[_0xfe97('0x3')]},'teams':{'type':Sequelize[_0xfe97('0x3')]},'viber':{'type':Sequelize[_0xfe97('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xfe97('0x3')]},'telegram':{'type':Sequelize[_0xfe97('0x3')]},'UserId':{'type':Sequelize[_0xfe97('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xfe97('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xfe97('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfe97('0x7')],'defaultValue':Sequelize[_0xfe97('0x8')]},'dialTimezone':{'type':Sequelize[_0xfe97('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 477fd11..6ebed91 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 _0x5194=['keys','startsWith','columnName','displayName','CmCustomField','length','cf_','alias','custom','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','WhatsappMessage','WhatsappQueueReport','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','contact','show','Tag','color','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','pickBy','isEmpty','table','setFields','id\x20=\x20?','toParam','text','phone','findOne','filters','intersection','model','attributes','fields','order','sort','pick','filter','options','getTags','nolimit','setTags','ids','all','OrderBy','item_types','items','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','includeAll','getHopperHistories','rawAttributes','rows','getHopperFinals','include','getJscriptySessions','JscriptySessionReport','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!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','upload','createReadStream','parse','meta','import','User','agent','binding','stringify','start\x20child\x20process\x20correctly!','pid','exit','importUpdates','../../components/import/cm/csvUpdates','message','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','whatsapp','-createdAt','resolve','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','voice','type','source','callerid','starttime','endtime','duration','userDisposition','userThirdDisposition','UserId','DESC','createdAt','findAndCountAll','channel','fullname','startCase','Website','Account','closedAt','note','disposition','secondDisposition','thirdDisposition','key','Owner','Tags','browserName','customerPort','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','flatten','slice','moment','bluebird','lodash','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','undefined','limit','count','offset','json','update','then','destroy','end','sendStatus','stack','name','send','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags'];(function(_0x5d1823,_0x2b8f1a){var _0x582fc9=function(_0x4b4718){while(--_0x4b4718){_0x5d1823['push'](_0x5d1823['shift']());}};_0x582fc9(++_0x2b8f1a);}(_0x5194,0x1cc));var _0x4519=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5194[_0x8c43de];return _0xa6591b;};'use strict';var moment=require(_0x4519('0x0'));var BPromise=require(_0x4519('0x1'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x4519('0x2'));var squel=require('squel');var Papa=require(_0x4519('0x3'));var Redis=require(_0x4519('0x4'));var contacts=require('../../components/contacts');var qs=require(_0x4519('0x5'));var logger=require(_0x4519('0x6'))(_0x4519('0x7'));var config=require(_0x4519('0x8'));var shared=require(_0x4519('0x9'));var db=require('../../mysqldb')['db'];config[_0x4519('0xa')]=_[_0x4519('0xb')](config['redis'],{'host':_0x4519('0xc'),'port':0x18eb});var socket=require(_0x4519('0xd'))(new Redis(config[_0x4519('0xa')]));require(_0x4519('0xe'))[_0x4519('0xf')](socket);function respondWithResult(_0x4c878c,_0x3145cf){_0x3145cf=_0x3145cf||0xc8;return function(_0x35c8f0){if(_0x35c8f0){return _0x4c878c[_0x4519('0x10')](_0x3145cf)['json'](_0x35c8f0);}};}function respondWithFilteredResult(_0x19b196,_0x326105){return function(_0x31aaad){if(_0x31aaad){var _0x21c8ea=typeof _0x326105['offset']===_0x4519('0x11')&&typeof _0x326105[_0x4519('0x12')]==='undefined';var _0x115b5a=_0x31aaad[_0x4519('0x13')];var _0x3630f8=_0x21c8ea?0x0:_0x326105[_0x4519('0x14')];var _0x26c2d7=_0x21c8ea?_0x31aaad[_0x4519('0x13')]:_0x326105['offset']+_0x326105[_0x4519('0x12')];var _0x281ae1;if(_0x26c2d7>=_0x115b5a){_0x26c2d7=_0x115b5a;_0x281ae1=0xc8;}else{_0x281ae1=0xce;}_0x19b196[_0x4519('0x10')](_0x281ae1);return _0x19b196['set']('Content-Range',_0x3630f8+'-'+_0x26c2d7+'/'+_0x115b5a)[_0x4519('0x15')](_0x31aaad);}return null;};}function saveUpdates(_0x56775b){return function(_0xeac163){if(_0xeac163){return _0xeac163[_0x4519('0x16')](_0x56775b)[_0x4519('0x17')](function(_0x262c82){return _0x262c82;});}return null;};}function removeEntity(_0x116fff){return function(_0x3aeb3f){if(_0x3aeb3f){return _0x3aeb3f[_0x4519('0x18')]()[_0x4519('0x17')](function(){_0x116fff[_0x4519('0x10')](0xcc)[_0x4519('0x19')]();});}};}function handleEntityNotFound(_0x31b2f4){return function(_0x24f4eb){if(!_0x24f4eb){_0x31b2f4[_0x4519('0x1a')](0x194);}return _0x24f4eb;};}function handleError(_0x3a9421,_0x28a6f9){_0x28a6f9=_0x28a6f9||0x1f4;return function(_0x142692){logger['error'](_0x142692[_0x4519('0x1b')]);if(_0x142692[_0x4519('0x1c')]){delete _0x142692[_0x4519('0x1c')];}_0x3a9421[_0x4519('0x10')](_0x28a6f9)[_0x4519('0x1d')](_0x142692);};}exports['index']=function(_0x47f3bc,_0x4bb05a){var _0x23bf0a={};return contacts[_0x4519('0x1e')]()['then'](function(_0x2a68a0){_0x23bf0a=qs[_0x4519('0x1f')](_0x2a68a0,_0x47f3bc);return contacts[_0x4519('0x20')](_0x47f3bc[_0x4519('0x21')],_0x47f3bc[_0x4519('0x22')],_0x23bf0a,_0x2a68a0);})[_0x4519('0x17')](respondWithFilteredResult(_0x4bb05a,_0x23bf0a))[_0x4519('0x23')](handleError(_0x4bb05a,null));};exports[_0x4519('0x18')]=function(_0xee3ae8,_0x1c4d12){return db[_0x4519('0x24')][_0x4519('0x25')]({'where':{'id':_0xee3ae8[_0x4519('0x26')]['id']}})[_0x4519('0x17')](handleEntityNotFound(_0x1c4d12,null))[_0x4519('0x17')](removeEntity(_0x1c4d12,null))[_0x4519('0x23')](handleError(_0x1c4d12,null));};exports['describe']=function(_0x3661a0,_0x5b9b23){return db[_0x4519('0x24')][_0x4519('0x1e')]()[_0x4519('0x17')](function(_0x33c0ac){delete _0x33c0ac[_0x4519('0x27')];for(var _0x11db6d=0x0;_0x11db6d0x0){return new Promise(function(_0x272f41){var _0x156ff2=[];for(var _0x456cb7=0x0;_0x456cb7<_0x441043[_0x4519('0x2d')];_0x456cb7++){_0x156ff2[_0x4519('0x5e')](insertAdditionalPhones(_0x441043[_0x456cb7][_0x4519('0x60')],_0x441043[_0x456cb7][_0x4519('0x58')]));}Promise['all'](_0x156ff2)[_0x4519('0x17')](function(){_0x272f41(0x1);});})[_0x4519('0x17')](function(){return{'success':_0xc50234,'failure':_0x29ec5c,'duplicates':_0x2f77d9};});}else{return{'success':_0xc50234,'failure':_0x29ec5c,'duplicates':_0x2f77d9};}}})[_0x4519('0x17')](respondWithResult(_0xc5668c,0xc9))['catch'](handleError(_0xc5668c,null));};exports[_0x4519('0x61')]=function(_0x57e767,_0x25bfd0){var _0x43ea36;return db[_0x4519('0x24')][_0x4519('0x1e')]()[_0x4519('0x17')](function(_0x3fd454){return db['CmContact'][_0x4519('0x25')]({'where':{'id':_0x57e767[_0x4519('0x26')]['id']},'include':[{'model':db[_0x4519('0x62')],'as':'Tags','attributes':['id',_0x4519('0x1c'),_0x4519('0x63')],'required':_0x57e767['query']['tag']?!![]:![]},{'model':db[_0x4519('0x49')],'as':'Phones','where':{'CmContactId':_0x57e767[_0x4519('0x26')]['id']},'required':![],'include':[{'model':db[_0x4519('0x64')],'as':_0x4519('0x65')}]}],'order':[db[_0x4519('0x66')][_0x4519('0x67')](_0x4519('0x68'))],'attributes':_['keys'](_0x3fd454)});})[_0x4519('0x17')](function(_0x3c8c0f){if(!_[_0x4519('0x54')](_0x3c8c0f)){_0x43ea36=_0x3c8c0f[_0x4519('0x38')]({'plain':!![]});var _0x1db6f4={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3c8c0f&&_0x3c8c0f[_0x4519('0x5f')]){if(_0x3c8c0f['ListId']){_0x1db6f4['where'][_0x4519('0x69')][_0x4519('0x5e')]({'ListId':{'$ne':_0x3c8c0f[_0x4519('0x5f')]}});}}return db[_0x4519('0x2c')]['findAll'](_0x1db6f4);}})[_0x4519('0x17')](function(_0x4e5dd5){if(!_[_0x4519('0x54')](_0x4e5dd5)){return _[_0x4519('0x6a')](_0x43ea36,_[_0x4519('0x6b')](_0x4e5dd5,function(_0x396822){return util[_0x4519('0x6c')](_0x4519('0x6d'),_0x396822['id']);}));}})[_0x4519('0x17')](handleEntityNotFound(_0x25bfd0,null))[_0x4519('0x17')](respondWithResult(_0x25bfd0,null))[_0x4519('0x23')](handleError(_0x25bfd0,null));};exports[_0x4519('0x16')]=function(_0x2fecd2,_0x4c8117){var _0x18e691;if(_0x2fecd2[_0x4519('0x36')]['id']){delete _0x2fecd2[_0x4519('0x36')]['id'];}if(!_[_0x4519('0x54')](_0x2fecd2[_0x4519('0x36')][_0x4519('0x55')])){var _0xe453ed=_0x2fecd2[_0x4519('0x36')][_0x4519('0x55')];if(!_[_0x4519('0x54')](shared[_0x4519('0x56')][_0xe453ed]))_0x2fecd2[_0x4519('0x36')]['utcOffset']=shared[_0x4519('0x56')][_0xe453ed][_0x4519('0x57')];}return db[_0x4519('0x24')]['find']({'where':{'id':_0x2fecd2['params']['id']}})[_0x4519('0x17')](handleEntityNotFound(_0x4c8117,null))[_0x4519('0x17')](saveUpdates(_0x2fecd2[_0x4519('0x36')],null))[_0x4519('0x17')](function(_0x3f321f){_0x18e691=_0x3f321f;var _0x1ee28c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3f321f&&_0x3f321f['ListId']){if(_0x3f321f[_0x4519('0x5f')]){_0x1ee28c['where'][_0x4519('0x69')]['push']({'ListId':{'$ne':_0x3f321f[_0x4519('0x5f')]}});}}return db[_0x4519('0x2c')]['findAll'](_0x1ee28c);})['then'](function(_0x7e49c6){if(_0x7e49c6){return _[_0x4519('0x6a')](_[_0x4519('0x6e')](_0x2fecd2[_0x4519('0x36')],function(_0x565389,_0x2eafff){return _[_0x4519('0x29')](_0x2eafff,_0x4519('0x2e'));}),_[_0x4519('0x6b')](_0x7e49c6,function(_0x4dad11){return util['format']('cf_%d',_0x4dad11['id']);}));}})[_0x4519('0x17')](function(_0x856498){if(_0x856498&&!_[_0x4519('0x6f')](_0x856498)){var _0x20a745=squel[_0x4519('0x16')]()[_0x4519('0x70')]('cm_contacts')[_0x4519('0x71')](_0x856498)['where'](_0x4519('0x72'),_0x2fecd2[_0x4519('0x26')]['id'])[_0x4519('0x73')]();return db[_0x4519('0x66')]['query'](_0x20a745[_0x4519('0x74')],{'replacements':_0x20a745['values']});}})[_0x4519('0x17')](function(){if(_0x2fecd2[_0x4519('0x36')][_0x4519('0x75')]&&_0x18e691){return db[_0x4519('0x3b')][_0x4519('0x16')]({'phone':_0x2fecd2[_0x4519('0x36')][_0x4519('0x75')],'OrderBy':0x0},{'where':{'ContactId':_0x18e691['id']}});}})['then'](function(){return _0x18e691;})['then'](respondWithResult(_0x4c8117,null))[_0x4519('0x23')](handleError(_0x4c8117,null));};exports['getTags']=function(_0x1b6833,_0x232fd9){var _0x201cb3={};var _0x5ed3d0={};var _0x54e94c;var _0x18221a;return db[_0x4519('0x24')][_0x4519('0x76')]({'where':{'id':_0x1b6833[_0x4519('0x26')]['id']}})[_0x4519('0x17')](handleEntityNotFound(_0x232fd9,null))[_0x4519('0x17')](function(_0x3ddc95){if(_0x3ddc95){_0x54e94c=_0x3ddc95;_0x5ed3d0['model']=_[_0x4519('0x28')](db[_0x4519('0x62')]['rawAttributes']);_0x5ed3d0['query']=_[_0x4519('0x28')](_0x1b6833[_0x4519('0x21')]);_0x5ed3d0[_0x4519('0x77')]=_[_0x4519('0x78')](_0x5ed3d0[_0x4519('0x79')],_0x5ed3d0[_0x4519('0x21')]);_0x201cb3[_0x4519('0x7a')]=_[_0x4519('0x78')](_0x5ed3d0[_0x4519('0x79')],qs[_0x4519('0x7b')](_0x1b6833['query'][_0x4519('0x7b')]));_0x201cb3[_0x4519('0x7a')]=_0x201cb3[_0x4519('0x7a')][_0x4519('0x2d')]?_0x201cb3[_0x4519('0x7a')]:_0x5ed3d0[_0x4519('0x79')];_0x201cb3[_0x4519('0x7c')]=qs[_0x4519('0x7d')](_0x1b6833['query'][_0x4519('0x7d')]);_0x201cb3[_0x4519('0x5c')]=qs['filters'](_[_0x4519('0x7e')](_0x1b6833[_0x4519('0x21')],_0x5ed3d0[_0x4519('0x77')]));if(_0x1b6833[_0x4519('0x21')][_0x4519('0x7f')]){_0x201cb3['where']=_[_0x4519('0x35')](_0x201cb3[_0x4519('0x5c')],{'$or':_[_0x4519('0x6b')](_0x201cb3[_0x4519('0x7a')],function(_0x3a33dd){var _0x5de309={};_0x5de309[_0x3a33dd]={'$like':'%'+_0x1b6833[_0x4519('0x21')][_0x4519('0x7f')]+'%'};return _0x5de309;})});}_0x201cb3=_[_0x4519('0x35')]({},_0x201cb3,_0x1b6833[_0x4519('0x80')]);return _0x54e94c[_0x4519('0x81')](_0x201cb3);}})[_0x4519('0x17')](function(_0x45b2f8){if(_0x45b2f8){_0x18221a=_0x45b2f8[_0x4519('0x2d')];if(!_0x1b6833[_0x4519('0x21')]['hasOwnProperty'](_0x4519('0x82'))){_0x201cb3[_0x4519('0x12')]=qs[_0x4519('0x12')](_0x1b6833['query']['limit']);_0x201cb3['offset']=qs[_0x4519('0x14')](_0x1b6833[_0x4519('0x21')]['offset']);}return _0x54e94c[_0x4519('0x81')](_0x201cb3);}})['then'](function(_0x41115f){if(_0x41115f){return _0x41115f?{'count':_0x18221a,'rows':_0x41115f}:null;}})['then'](respondWithResult(_0x232fd9,null))[_0x4519('0x23')](handleError(_0x232fd9,null));};exports[_0x4519('0x83')]=function(_0x2a0608,_0xc5fb76){if(_0x2a0608[_0x4519('0x36')]['id']){delete _0x2a0608['body']['id'];}return db['CmContact'][_0x4519('0x76')]({'where':{'id':_0x2a0608[_0x4519('0x26')]['id']}})[_0x4519('0x17')](handleEntityNotFound(_0xc5fb76,null))[_0x4519('0x17')](function(_0x1ad561){if(_0x1ad561){return _0x1ad561[_0x4519('0x83')](_0x2a0608[_0x4519('0x36')][_0x4519('0x84')]||[]);}return null;})[_0x4519('0x17')](respondWithResult(_0xc5fb76,null))[_0x4519('0x23')](handleError(_0xc5fb76,null));};exports['setAdditionalPhones']=function(_0x2eadd6,_0x3fdd71){var _0xfcaf15=[];_0xfcaf15[_0x4519('0x5e')](addAdditionalPhones(_0x2eadd6['body']));Promise[_0x4519('0x85')](_0xfcaf15)[_0x4519('0x17')](function(){_0xfcaf15=[];_0xfcaf15['push'](deleteCmHopperPhones(_0x2eadd6['body']['id']));_0xfcaf15[_0x4519('0x5e')](addCmHopperPhones(_0x2eadd6[_0x4519('0x36')]['id']));Promise['all'](_0xfcaf15)[_0x4519('0x17')](function(){return[0x1];})[_0x4519('0x17')](respondWithResult(_0x3fdd71,null));});};function addAdditionalPhones(_0x5188ee){var _0x713e38;return new Promise(function(_0x6744a9){return db[_0x4519('0x49')][_0x4519('0x18')]({'where':{'CmContactId':_0x5188ee['id']}})[_0x4519('0x17')](function(){db[_0x4519('0x64')][_0x4519('0x20')]({'raw':!![],'attributes':['id',_0x4519('0x86')]})[_0x4519('0x17')](function(_0x119ff4){var _0x2e113e=[];for(var _0x10a0d9=0x0;_0x10a0d9<_0x5188ee['items']['length'];_0x10a0d9++){var _0x5c1e2=_0x5188ee['item_types']?_[_0x4519('0x54')](_0x5188ee['item_types'][_0x10a0d9])?'':_0x5188ee[_0x4519('0x87')][_0x10a0d9]:_0x5188ee[_0x4519('0x88')][_0x10a0d9][_0x4519('0x89')]?_0x5188ee[_0x4519('0x88')][_0x10a0d9][_0x4519('0x89')]:'';var _0x397ba9=_[_0x4519('0x54')](_0x5188ee[_0x4519('0x88')][_0x10a0d9][_0x4519('0x8a')])?'':_0x5188ee['items'][_0x10a0d9][_0x4519('0x8a')];var _0x57bc78=_0x5c1e2+':'+_0x5188ee['items'][_0x10a0d9][_0x4519('0x75')]+'§'+_0x397ba9;if(_[_0x4519('0x54')](_0x713e38))_0x713e38=_0x57bc78;else _0x713e38+=';'+_0x57bc78;var _0x2a6072=null;var _0x20ed42=null;if(_0x5188ee[_0x4519('0x87')]){if(!_['isNil'](_0x5188ee[_0x4519('0x87')][_0x10a0d9])){_0x20ed42=_[_0x4519('0x25')](_0x119ff4,function(_0x1366d9){return _0x1366d9['id']===_0x5188ee[_0x4519('0x87')][_0x10a0d9];});if(!_[_0x4519('0x54')](_0x20ed42)){_0x2a6072=_0x20ed42[_0x4519('0x86')];}}}else{if(!_[_0x4519('0x54')](_0x5188ee[_0x4519('0x88')][_0x10a0d9])){_0x20ed42=_['find'](_0x119ff4,function(_0x11e9d7){return _0x11e9d7['id']===_0x5188ee[_0x4519('0x88')][_0x10a0d9]['ItemTypeId'];});if(!_[_0x4519('0x54')](_0x20ed42)){_0x2a6072=_0x10a0d9;}}}if(_['isNil'](_0x2a6072)){_0x2a6072=0x64;}_0x2e113e[_0x4519('0x5e')](addAdditionalPhone(_0x5188ee['id'],_0x5188ee[_0x4519('0x88')][_0x10a0d9][_0x4519('0x75')],_0x5188ee['item_types']?_[_0x4519('0x54')](_0x5188ee[_0x4519('0x87')][_0x10a0d9])?null:_0x5188ee[_0x4519('0x87')][_0x10a0d9]:_0x5188ee['items'][_0x10a0d9][_0x4519('0x89')]?_0x5188ee[_0x4519('0x88')][_0x10a0d9][_0x4519('0x89')]:null,_0x2a6072,_0x397ba9));}Promise[_0x4519('0x85')](_0x2e113e)[_0x4519('0x17')](function(){db[_0x4519('0x24')]['update']({'AdditionalPhones':_0x713e38},{'where':{'id':_0x5188ee['id']}})[_0x4519('0x17')](function(){_0x6744a9(0x1);});});});});});}function addAdditionalPhone(_0x57b617,_0x575428,_0x452337,_0x4846d4,_0xb051f3){return db[_0x4519('0x49')][_0x4519('0x25')]({'where':{'CmContactId':_0x57b617,'item':_0x575428}})[_0x4519('0x17')](function(_0x51b617){if(_0x51b617)logger[_0x4519('0x31')]('contact\x20phone\x20exists',_0x51b617);else{db['CmContactHasItem']['create']({'CmContactId':_0x57b617,'item':_0x575428,'ItemTypeId':_0x452337,'OrderBy':_0x4846d4,'ItemClass':_0x4519('0x8b'),'description':_0xb051f3});}});}function deleteCmHopperPhones(_0x1d3c56){return new Promise(function(_0x31aeac){return db[_0x4519('0x3b')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d3c56}})[_0x4519('0x17')](function(_0x19b3b1){db[_0x4519('0x8c')]['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0x19b3b1,'id')}}});})[_0x4519('0x17')](function(){_0x31aeac(0x1);});});}function addCmHopperPhones(_0xd2c73f){return new Promise(function(_0x20e1d6){return db[_0x4519('0x3b')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xd2c73f}})[_0x4519('0x17')](function(_0x6c07c0){var _0x2d98a9=[];_[_0x4519('0x6b')](_0x6c07c0,function(_0x233d3d){_0x2d98a9[_0x4519('0x5e')](createCmHopperPhone(_0xd2c73f,_0x233d3d['id']));});Promise['all'](_0x2d98a9)[_0x4519('0x17')](function(){_0x20e1d6(0x1);});});});}function createCmHopperPhone(_0x4edfe1,_0x18177e){return new Promise(function(_0x33ac59){db[_0x4519('0x49')]['findAll']({'raw':!![],'attributes':[_0x4519('0x8d'),_0x4519('0x86')],'where':{'CmContactId':_0x4edfe1,'ItemClass':_0x4519('0x8b')},'include':[{'model':db[_0x4519('0x64')],'attributes':[_0x4519('0x86')],'as':_0x4519('0x65')}],'order':['OrderBy',db['sequelize'][_0x4519('0x67')](_0x4519('0x8e'))]})[_0x4519('0x17')](function(_0x4b630f){var _0x17c094=0x1;var _0x49ac98=_[_0x4519('0x6b')](_0x4b630f,function(_0x42af4f){_0x42af4f[_0x4519('0x8f')]=_0x18177e;_0x42af4f[_0x4519('0x75')]=_0x42af4f['item'];_0x42af4f[_0x4519('0x86')]=_0x17c094;delete _0x42af4f[_0x4519('0x90')];_0x17c094=_0x17c094+0x1;return _0x42af4f;});return db['CmHopperAdditionalPhone'][_0x4519('0x59')](_0x49ac98,{});})[_0x4519('0x17')](function(){_0x33ac59(0x1);});});}function insertAdditionalPhones(_0x53ef31,_0x3f7c1c){return new Promise(function(_0xb84efd){var _0x2361e5=[];for(var _0x26c8df=0x0;_0x26c8df<_0x3f7c1c[_0x4519('0x2d')];_0x26c8df++){var _0x31a588=_0x3f7c1c[_0x26c8df];_0x2361e5[_0x4519('0x5e')](parseContactItemType(_0x31a588));}Promise[_0x4519('0x85')](_0x2361e5)[_0x4519('0x17')](function(){var _0x2248a9={'id':_0x53ef31['id'],'items':_0x3f7c1c};return addAdditionalPhones(_0x2248a9)[_0x4519('0x17')](function(){return addCmHopperPhones(_0x53ef31['id']);});})[_0x4519('0x17')](function(){_0xb84efd(_0x53ef31);});});}function parseContactItemType(_0x4c15b9){return new Promise(function(_0x52d59f){if(_0x4c15b9['hasOwnProperty'](_0x4519('0x89'))){_0x52d59f(_0x4c15b9);}else{return db[_0x4519('0x64')][_0x4519('0x25')]({'where':{'name':_0x4c15b9[_0x4519('0x65')]}})[_0x4519('0x17')](function(_0xb02e6d){if(_[_0x4519('0x54')](_0xb02e6d))_0x4c15b9['ItemTypeId']=null;else _0x4c15b9[_0x4519('0x89')]=_0xb02e6d['id'];_0x52d59f(_0x4c15b9);});}});}exports[_0x4519('0x91')]=function(_0x40627c,_0x5353db){return db[_0x4519('0x49')][_0x4519('0x20')]({'raw':!![],'where':{'CmContactId':_0x40627c[_0x4519('0x26')]['id'],'ItemClass':_0x4519('0x8b')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0x4519('0x86')],[db[_0x4519('0x66')][_0x4519('0x67')](_0x4519('0x8e'))]]})[_0x4519('0x17')](function(_0x23fa18){return _0x23fa18;})[_0x4519('0x17')](respondWithResult(_0x5353db,null))[_0x4519('0x23')](handleError(_0x5353db,null));};exports[_0x4519('0x92')]=function(_0x2d4583,_0x982b45){return db[_0x4519('0x49')][_0x4519('0x20')]({'raw':!![],'where':{'CmContactId':_0x2d4583[_0x4519('0x36')][_0x4519('0x93')]}})[_0x4519('0x17')](function(_0x336626){var _0x79fdff=_[_0x4519('0x6b')](_0x336626,function(_0x3016a8){_0x3016a8[_0x4519('0x94')]=_0x2d4583[_0x4519('0x36')][_0x4519('0x95')];return _0x3016a8;});return db[_0x4519('0x49')][_0x4519('0x59')](_0x79fdff,{});})[_0x4519('0x17')](function(){return addCmHopperPhones(_0x2d4583[_0x4519('0x36')]['toContactId']);})[_0x4519('0x17')](function(){return['ok'];})['then'](respondWithResult(_0x982b45,null))[_0x4519('0x23')](handleError(_0x982b45,null));};exports[_0x4519('0x96')]=function(_0x5aa7a9,_0x539d04){var _0x52a926=[];_0x52a926[_0x4519('0x5e')](createCmHopperPhone(_0x5aa7a9['body']['id'],_0x5aa7a9['body']['hopperId']));Promise[_0x4519('0x85')](_0x52a926)[_0x4519('0x17')](function(){return[0x1];})[_0x4519('0x17')](respondWithResult(_0x539d04,null));};exports[_0x4519('0x97')]=function(_0x133ab8,_0x20344b){var _0x3f50da={'raw':![],'where':{}};var _0x3bb71e={};var _0x552cce={'count':0x0,'rows':[]};return db[_0x4519('0x24')][_0x4519('0x76')]({'where':{'id':_0x133ab8[_0x4519('0x26')]['id']}})['then'](handleEntityNotFound(_0x20344b,null))['then'](function(_0x1cc228){if(_0x1cc228){_0x3bb71e['model']=_['keys'](db['CmHopper']['rawAttributes']);_0x3bb71e[_0x4519('0x21')]=_[_0x4519('0x28')](_0x133ab8['query']);_0x3bb71e['filters']=_[_0x4519('0x78')](_0x3bb71e[_0x4519('0x79')],_0x3bb71e[_0x4519('0x21')]);_0x3f50da[_0x4519('0x7a')]=_[_0x4519('0x78')](_0x3bb71e[_0x4519('0x79')],qs[_0x4519('0x7b')](_0x133ab8[_0x4519('0x21')][_0x4519('0x7b')]));_0x3f50da[_0x4519('0x7a')]=_0x3f50da[_0x4519('0x7a')][_0x4519('0x2d')]?_0x3f50da[_0x4519('0x7a')]:_0x3bb71e[_0x4519('0x79')];if(!_0x133ab8[_0x4519('0x21')]['hasOwnProperty'](_0x4519('0x82'))){_0x3f50da['limit']=qs[_0x4519('0x12')](_0x133ab8['query'][_0x4519('0x12')]);_0x3f50da[_0x4519('0x14')]=qs[_0x4519('0x14')](_0x133ab8['query'][_0x4519('0x14')]);}_0x3f50da[_0x4519('0x7c')]=qs['sort'](_0x133ab8[_0x4519('0x21')][_0x4519('0x7d')]);_0x3f50da[_0x4519('0x5c')]=qs[_0x4519('0x77')](_['pick'](_0x133ab8['query'],_0x3bb71e[_0x4519('0x77')]));_0x3f50da[_0x4519('0x5c')][_0x4519('0x98')]=_0x1cc228['id'];if(_0x133ab8[_0x4519('0x21')][_0x4519('0x7f')]){_0x3f50da[_0x4519('0x5c')]=_[_0x4519('0x35')](_0x3f50da['where'],{'$or':_[_0x4519('0x6b')](_0x3f50da['attributes'],function(_0x5820fa){var _0x276e5b={};_0x276e5b[_0x5820fa]={'$like':'%'+_0x133ab8['query']['filter']+'%'};return _0x276e5b;})});}_0x3f50da=_['merge']({},_0x3f50da,_0x133ab8[_0x4519('0x80')]);return db[_0x4519('0x3b')][_0x4519('0x13')]({'where':_0x3f50da[_0x4519('0x5c')]})[_0x4519('0x17')](function(_0x5d46f7){_0x552cce[_0x4519('0x13')]=_0x5d46f7;if(_0x133ab8[_0x4519('0x21')][_0x4519('0x99')]){_0x3f50da['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3f50da);})[_0x4519('0x17')](function(_0x1b0e2c){_0x552cce['rows']=_0x1b0e2c;return _0x552cce;});}})[_0x4519('0x17')](respondWithFilteredResult(_0x20344b,_0x3f50da))[_0x4519('0x23')](handleError(_0x20344b,null));};exports[_0x4519('0x9a')]=function(_0x17fa12,_0x47daa2){var _0x55ad30={'raw':!![],'where':{}};var _0x15e7c7={};var _0x504c8d={'count':0x0,'rows':[]};return db[_0x4519('0x24')][_0x4519('0x76')]({'where':{'id':_0x17fa12['params']['id']}})[_0x4519('0x17')](handleEntityNotFound(_0x47daa2,null))[_0x4519('0x17')](function(_0x8a2b5c){if(_0x8a2b5c){_0x15e7c7[_0x4519('0x79')]=_[_0x4519('0x28')](db[_0x4519('0x4b')][_0x4519('0x9b')]);_0x15e7c7[_0x4519('0x21')]=_[_0x4519('0x28')](_0x17fa12[_0x4519('0x21')]);_0x15e7c7[_0x4519('0x77')]=_['intersection'](_0x15e7c7[_0x4519('0x79')],_0x15e7c7[_0x4519('0x21')]);_0x55ad30['attributes']=_[_0x4519('0x78')](_0x15e7c7[_0x4519('0x79')],qs[_0x4519('0x7b')](_0x17fa12[_0x4519('0x21')][_0x4519('0x7b')]));_0x55ad30[_0x4519('0x7a')]=_0x55ad30['attributes'][_0x4519('0x2d')]?_0x55ad30[_0x4519('0x7a')]:_0x15e7c7[_0x4519('0x79')];if(!_0x17fa12[_0x4519('0x21')][_0x4519('0x34')](_0x4519('0x82'))){_0x55ad30['limit']=qs['limit'](_0x17fa12[_0x4519('0x21')][_0x4519('0x12')]);_0x55ad30[_0x4519('0x14')]=qs[_0x4519('0x14')](_0x17fa12[_0x4519('0x21')]['offset']);}_0x55ad30['order']=qs[_0x4519('0x7d')](_0x17fa12[_0x4519('0x21')][_0x4519('0x7d')]);_0x55ad30[_0x4519('0x5c')]=qs['filters'](_[_0x4519('0x7e')](_0x17fa12[_0x4519('0x21')],_0x15e7c7[_0x4519('0x77')]));_0x55ad30['where'][_0x4519('0x98')]=_0x8a2b5c['id'];if(_0x17fa12['query']['filter']){_0x55ad30['where']=_[_0x4519('0x35')](_0x55ad30[_0x4519('0x5c')],{'$or':_[_0x4519('0x6b')](_0x55ad30[_0x4519('0x7a')],function(_0x2d24bb){var _0xd434de={};_0xd434de[_0x2d24bb]={'$like':'%'+_0x17fa12['query'][_0x4519('0x7f')]+'%'};return _0xd434de;})});}_0x55ad30=_['merge']({},_0x55ad30,_0x17fa12[_0x4519('0x80')]);return db[_0x4519('0x4b')]['count']({'where':_0x55ad30[_0x4519('0x5c')]})[_0x4519('0x17')](function(_0x4ca642){_0x504c8d[_0x4519('0x13')]=_0x4ca642;if(_0x17fa12['query'][_0x4519('0x99')]){_0x55ad30['include']=[{'all':!![]}];}return db[_0x4519('0x4b')][_0x4519('0x20')](_0x55ad30);})[_0x4519('0x17')](function(_0x54494f){_0x504c8d[_0x4519('0x9c')]=_0x54494f;return _0x504c8d;});}})['then'](respondWithFilteredResult(_0x47daa2,_0x55ad30))[_0x4519('0x23')](handleError(_0x47daa2,null));};exports[_0x4519('0x9d')]=function(_0x439dc7,_0x2cf67c){var _0x21455b={'raw':!![],'where':{}};var _0x1b0140={};var _0x29925b={'count':0x0,'rows':[]};return db['CmContact'][_0x4519('0x76')]({'where':{'id':_0x439dc7[_0x4519('0x26')]['id']}})['then'](handleEntityNotFound(_0x2cf67c,null))[_0x4519('0x17')](function(_0x482b47){if(_0x482b47){_0x1b0140[_0x4519('0x79')]=_['keys'](db[_0x4519('0x4a')]['rawAttributes']);_0x1b0140[_0x4519('0x21')]=_[_0x4519('0x28')](_0x439dc7['query']);_0x1b0140[_0x4519('0x77')]=_['intersection'](_0x1b0140[_0x4519('0x79')],_0x1b0140[_0x4519('0x21')]);_0x21455b[_0x4519('0x7a')]=_[_0x4519('0x78')](_0x1b0140[_0x4519('0x79')],qs['fields'](_0x439dc7[_0x4519('0x21')][_0x4519('0x7b')]));_0x21455b['attributes']=_0x21455b['attributes'][_0x4519('0x2d')]?_0x21455b[_0x4519('0x7a')]:_0x1b0140['model'];if(!_0x439dc7[_0x4519('0x21')][_0x4519('0x34')](_0x4519('0x82'))){_0x21455b[_0x4519('0x12')]=qs[_0x4519('0x12')](_0x439dc7['query'][_0x4519('0x12')]);_0x21455b[_0x4519('0x14')]=qs[_0x4519('0x14')](_0x439dc7['query']['offset']);}_0x21455b[_0x4519('0x7c')]=qs[_0x4519('0x7d')](_0x439dc7[_0x4519('0x21')][_0x4519('0x7d')]);_0x21455b[_0x4519('0x5c')]=qs[_0x4519('0x77')](_[_0x4519('0x7e')](_0x439dc7[_0x4519('0x21')],_0x1b0140['filters']));_0x21455b[_0x4519('0x5c')][_0x4519('0x98')]=_0x482b47['id'];if(_0x439dc7[_0x4519('0x21')][_0x4519('0x7f')]){_0x21455b[_0x4519('0x5c')]=_[_0x4519('0x35')](_0x21455b['where'],{'$or':_[_0x4519('0x6b')](_0x21455b[_0x4519('0x7a')],function(_0x344ea0){var _0x3b0220={};_0x3b0220[_0x344ea0]={'$like':'%'+_0x439dc7[_0x4519('0x21')]['filter']+'%'};return _0x3b0220;})});}_0x21455b=_[_0x4519('0x35')]({},_0x21455b,_0x439dc7[_0x4519('0x80')]);return db[_0x4519('0x4a')][_0x4519('0x13')]({'where':_0x21455b[_0x4519('0x5c')]})[_0x4519('0x17')](function(_0x867de1){_0x29925b[_0x4519('0x13')]=_0x867de1;if(_0x439dc7['query'][_0x4519('0x99')]){_0x21455b[_0x4519('0x9e')]=[{'all':!![]}];}return db[_0x4519('0x4a')][_0x4519('0x20')](_0x21455b);})[_0x4519('0x17')](function(_0x1e37ef){_0x29925b[_0x4519('0x9c')]=_0x1e37ef;return _0x29925b;});}})[_0x4519('0x17')](respondWithFilteredResult(_0x2cf67c,_0x21455b))[_0x4519('0x23')](handleError(_0x2cf67c,null));};exports[_0x4519('0x9f')]=function(_0x5afee5,_0x44749b){var _0x4334f2={'raw':!![],'where':{}};var _0x582809={};var _0x22b507={'count':0x0,'rows':[]};return db[_0x4519('0x24')][_0x4519('0x76')]({'where':{'id':_0x5afee5[_0x4519('0x26')]['id']}})[_0x4519('0x17')](handleEntityNotFound(_0x44749b,null))['then'](function(_0x289786){if(_0x289786){_0x582809[_0x4519('0x79')]=_[_0x4519('0x28')](db[_0x4519('0xa0')][_0x4519('0x9b')]);_0x582809['query']=_[_0x4519('0x28')](_0x5afee5[_0x4519('0x21')]);_0x582809['filters']=_[_0x4519('0x78')](_0x582809[_0x4519('0x79')],_0x582809[_0x4519('0x21')]);_0x4334f2[_0x4519('0x7a')]=_['intersection'](_0x582809[_0x4519('0x79')],qs[_0x4519('0x7b')](_0x5afee5[_0x4519('0x21')][_0x4519('0x7b')]));_0x4334f2[_0x4519('0x7a')]=_0x4334f2[_0x4519('0x7a')][_0x4519('0x2d')]?_0x4334f2['attributes']:_0x582809[_0x4519('0x79')];if(!_0x5afee5[_0x4519('0x21')][_0x4519('0x34')](_0x4519('0x82'))){_0x4334f2[_0x4519('0x12')]=qs[_0x4519('0x12')](_0x5afee5[_0x4519('0x21')][_0x4519('0x12')]);_0x4334f2[_0x4519('0x14')]=qs[_0x4519('0x14')](_0x5afee5['query']['offset']);}_0x4334f2['order']=qs['sort'](_0x5afee5[_0x4519('0x21')]['sort']);_0x4334f2[_0x4519('0x5c')]=qs[_0x4519('0x77')](_[_0x4519('0x7e')](_0x5afee5[_0x4519('0x21')],_0x582809[_0x4519('0x77')]));_0x4334f2[_0x4519('0x5c')][_0x4519('0x98')]=_0x289786['id'];if(_0x5afee5[_0x4519('0x21')]['filter']){_0x4334f2[_0x4519('0x5c')]=_[_0x4519('0x35')](_0x4334f2[_0x4519('0x5c')],{'$or':_[_0x4519('0x6b')](_0x4334f2['attributes'],function(_0x15b763){var _0x765854={};_0x765854[_0x15b763]={'$like':'%'+_0x5afee5[_0x4519('0x21')]['filter']+'%'};return _0x765854;})});}_0x4334f2=_[_0x4519('0x35')]({},_0x4334f2,_0x5afee5[_0x4519('0x80')]);return db[_0x4519('0xa0')]['count']({'where':_0x4334f2[_0x4519('0x5c')]})[_0x4519('0x17')](function(_0x1c0f7c){_0x22b507[_0x4519('0x13')]=_0x1c0f7c;if(_0x5afee5[_0x4519('0x21')][_0x4519('0x99')]){_0x4334f2[_0x4519('0x9e')]=[{'all':!![]}];}return db[_0x4519('0xa0')][_0x4519('0x20')](_0x4334f2);})[_0x4519('0x17')](function(_0x4f5678){_0x22b507[_0x4519('0x9c')]=_0x4f5678;return _0x22b507;});}})['then'](respondWithFilteredResult(_0x44749b,_0x4334f2))['catch'](handleError(_0x44749b,null));};exports[_0x4519('0xa1')]=function(_0x82d554,_0x5e5047){try{if(!_0x82d554[_0x4519('0x36')]['ListId']){throw new Error(_0x4519('0xa2'));}if(!_0x82d554[_0x4519('0x36')][_0x4519('0xa3')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x82d554[_0x4519('0x36')][_0x4519('0xa4')]){throw new Error(_0x4519('0xa5'));}if(!_0x82d554[_0x4519('0x36')][_0x4519('0xa6')]){throw new Error(_0x4519('0xa7'));}var _0x4a424b=_0x82d554['body'][_0x4519('0xa3')][_0x4519('0xa8')](',');var _0x4eafc5=_0x82d554['body']['binding_values'][_0x4519('0xa8')](',');if(!_0x4a424b[_0x4519('0x2d')]||!_0x4eafc5[_0x4519('0x2d')]||_0x4a424b[_0x4519('0x2d')]!==_0x4eafc5[_0x4519('0x2d')]){throw new Error(_0x4519('0xa9'));}_0x82d554[_0x4519('0x36')][_0x4519('0x7b')]=_['zipObject'](_0x4a424b,_0x4eafc5);if(!_0x82d554[_0x4519('0x36')][_0x4519('0x7b')][_0x4519('0x75')]){throw new Error(_0x4519('0xaa'));}if(!_0x82d554[_0x4519('0x36')]['fields'][_0x4519('0xab')]){throw new Error(_0x4519('0xac'));}var _0x4cf3b6=path[_0x4519('0x53')](config[_0x4519('0xad')],_0x4519('0xae'),_0x82d554[_0x4519('0xaf')][_0x4519('0xb0')]);fs[_0x4519('0xb1')](_0x4cf3b6,parseInt('0777',0x8));var _0x82b00b=require(_0x4519('0xb2'))[_0x4519('0xb3')](path[_0x4519('0x53')](__dirname,'../../components/import/cm/csv'),[_0x4cf3b6,_0x82d554['body'][_0x4519('0xa3')],_0x82d554[_0x4519('0x36')][_0x4519('0xa4')],_0x82d554[_0x4519('0x36')]['ListId'],_0x82d554[_0x4519('0x36')]['CompanyId'],_0x82d554['body']['duplicates'],_0x82d554[_0x4519('0x36')][_0x4519('0xa6')]]);return _0x5e5047[_0x4519('0x10')](0xc8)[_0x4519('0x15')]({'message':'File\x20uploaded\x20correctly!','pid':_0x82b00b['pid']});}catch(_0x10d45e){return _0x5e5047['status'](0x1f4)[_0x4519('0x1d')](_0x10d45e);}};exports[_0x4519('0xb4')]=function(_0x5e71c7,_0x176016){var _0x7ceb02=fs[_0x4519('0xb5')](_0x5e71c7[_0x4519('0xaf')]['path']);Papa[_0x4519('0xb6')](_0x7ceb02,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x39a2ea){return _0x176016[_0x4519('0x10')](0xc8)[_0x4519('0x15')]({'file':_0x5e71c7[_0x4519('0xaf')],'fields':_0x39a2ea[_0x4519('0xb7')][_0x4519('0x7b')]});}});};exports[_0x4519('0xb8')]=function(_0xf791d6,_0x195fe9){return db[_0x4519('0xb9')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x4519('0xba')}})[_0x4519('0x17')](function(_0x93edc0){var _0x4b102e=![];if(!_0xf791d6[_0x4519('0x36')][_0x4519('0x5f')]){throw new Error(_0x4519('0xa2'));}if(!_0xf791d6[_0x4519('0x36')][_0x4519('0xbb')][_0x4519('0x75')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xf791d6[_0x4519('0x36')]['binding']['firstName']){throw new Error(_0x4519('0xac'));}if(!_0xf791d6[_0x4519('0x36')][_0x4519('0xa6')]){throw new Error(_0x4519('0xa7'));}var _0x3ea9be=require(_0x4519('0xb2'))[_0x4519('0xb3')](path[_0x4519('0x53')](__dirname,'../../components/import/cm/csv2'),[_0xf791d6[_0x4519('0x26')]['id'],JSON[_0x4519('0xbc')](_0xf791d6['body']),JSON[_0x4519('0xbc')](_0x93edc0)]);_0x3ea9be['on']('message',function(){_0x4b102e=!![];return _0x195fe9['status'](0xc8)[_0x4519('0x15')]({'message':_0x4519('0xbd'),'pid':_0x3ea9be[_0x4519('0xbe')]});});_0x3ea9be['on'](_0x4519('0xbf'),function(_0x29f020){if(_0x29f020&&!_0x4b102e){return _0x195fe9['status'](0x1f4)[_0x4519('0x15')]({'message':'error\x20child\x20process','pid':_0x3ea9be[_0x4519('0xbe')]});}});})['catch'](handleError(_0x195fe9,null));};exports[_0x4519('0xc0')]=function(_0x1d3c2e,_0x58178b){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x4519('0x17')](function(_0x553069){var _0x22d8c3=![];if(!_0x1d3c2e['body']['ListId']){throw new Error(_0x4519('0xa2'));}if(!_0x1d3c2e[_0x4519('0x36')]['binding'][_0x4519('0x75')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1d3c2e[_0x4519('0x36')][_0x4519('0xbb')][_0x4519('0xab')]){throw new Error(_0x4519('0xac'));}if(!_0x1d3c2e[_0x4519('0x36')][_0x4519('0xa6')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x4c1fac=require(_0x4519('0xb2'))[_0x4519('0xb3')](path[_0x4519('0x53')](__dirname,_0x4519('0xc1')),[_0x1d3c2e['params']['id'],JSON['stringify'](_0x1d3c2e[_0x4519('0x36')]),JSON['stringify'](_0x553069)]);_0x4c1fac['on'](_0x4519('0xc2'),function(){_0x22d8c3=!![];return _0x58178b['status'](0xc8)[_0x4519('0x15')]({'message':_0x4519('0xbd'),'pid':_0x4c1fac[_0x4519('0xbe')]});});_0x4c1fac['on'](_0x4519('0xbf'),function(_0x1b7d45){if(_0x1b7d45&&!_0x22d8c3){return _0x58178b[_0x4519('0x10')](0x1f4)[_0x4519('0x15')]({'message':_0x4519('0xc3'),'pid':_0x4c1fac['pid']});}});})[_0x4519('0x23')](handleError(_0x58178b,null));};exports[_0x4519('0xc4')]=function(_0x5176b8,_0xc4eb45){var _0x4f7996=[_0x4519('0xc5'),_0x4519('0xc6'),_0x4519('0xc7'),_0x4519('0xc8'),'fax',_0x4519('0xc9'),'voice'];var _0x3aa0fa={'offset':0x0,'order':qs[_0x4519('0x7d')](_0x4519('0xca'))},_0x5d6cfb={'count':0x0,'rows':[]};Promise[_0x4519('0xcb')]()[_0x4519('0x17')](function(){if(_0x5176b8[_0x4519('0x21')]['channel']){if(!_[_0x4519('0xcc')](_0x4f7996,_0x5176b8[_0x4519('0x21')]['channel']['toLowerCase']())){throw new Error(_0x4519('0xcd'));}_0x4f7996=[_0x5176b8['query']['channel'][_0x4519('0xce')]()];}if(_0x5176b8[_0x4519('0x21')][_0x4519('0xcf')]){try{var _0x245d08=JSON[_0x4519('0xb6')](_0x5176b8['query'][_0x4519('0xcf')]);if(!moment(_0x245d08[_0x4519('0x37')])[_0x4519('0xd0')]()){throw new Error(_0x4519('0xd1'));}if(!moment(_0x245d08['to'])[_0x4519('0xd0')]()){throw new Error(_0x4519('0xd2'));}}catch(_0x45dc83){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x5176b8['query'][_0x4519('0x34')]('nolimit')){_0x3aa0fa[_0x4519('0x12')]=qs[_0x4519('0x12')](_0x5176b8[_0x4519('0x21')]['limit']||0xa);_0x3aa0fa[_0x4519('0x14')]=qs[_0x4519('0x14')](_0x5176b8[_0x4519('0x21')][_0x4519('0x14')]);}var _0x2bf04c=_0x4f7996[_0x4519('0x6b')](function(_0x2a8bab){if(_0x2a8bab===_0x4519('0xd3')){var _0x35321b={'attributes':['id','uniqueid',_0x4519('0xd4'),_0x4519('0xd5'),'destination',_0x4519('0xd6'),_0x4519('0xd7'),_0x4519('0xd8'),_0x4519('0xd9'),'note','createdAt',_0x4519('0xda'),'userSecondDisposition',_0x4519('0xdb'),_0x4519('0xdc')],'where':{'ContactId':_0x5176b8[_0x4519('0x26')]['id']},'include':[{'model':db[_0x4519('0xb9')],'as':'User','attributes':['id',_0x4519('0x1c'),'fullname',_0x4519('0x2f')]}],'order':[['createdAt',_0x4519('0xdd')]]};if(_0x5176b8['query']['range']){_0x35321b['where'][_0x4519('0xde')]={'$gte':_0x245d08['from'],'$lte':_0x245d08['to']};}return db[_0x4519('0x4d')][_0x4519('0xdf')](_0x35321b)[_0x4519('0x17')](function(_0x4efaf4){_0x5d6cfb[_0x4519('0x13')]+=_0x4efaf4[_0x4519('0x13')];return _[_0x4519('0x6b')](_0x4efaf4[_0x4519('0x9c')],function(_0xb166af){var _0x54bcb7=_0xb166af['get']({'plain':!![]});_0x54bcb7[_0x4519('0xe0')]=_0x2a8bab;if(_0x54bcb7[_0x4519('0xb9')]){_0x54bcb7['User']={'id':_0x54bcb7[_0x4519('0xb9')]['id'],'name':_0x54bcb7[_0x4519('0xb9')][_0x4519('0x1c')],'fullname':_0x54bcb7[_0x4519('0xb9')][_0x4519('0xe1')],'alias':_0x54bcb7[_0x4519('0xb9')][_0x4519('0x2f')]};}return _0x54bcb7;});});}else{var _0x4ad7c8=_[_0x4519('0xe2')](_0x2a8bab)+(_0x2a8bab===_0x4519('0xc6')?_0x4519('0xe3'):_0x4519('0xe4'));var _0xac5687={'attributes':['id','closed',_0x4519('0xe5'),_0x4519('0xde'),_0x4519('0xe6'),_0x4519('0xe7'),_0x4519('0xe8'),_0x4519('0xe9'),_0x4519('0xdc'),_0x4ad7c8+'Id'],'where':{'ContactId':_0x5176b8[_0x4519('0x26')]['id']},'include':[{'model':db[_0x4ad7c8],'as':_0x4519('0xe4'),'attributes':['id',_0x4519('0x1c'),_0x4519('0xea')]},{'model':db[_0x4519('0xb9')],'as':_0x4519('0xeb'),'attributes':['id',_0x4519('0x1c'),_0x4519('0xe1')]},{'model':db[_0x4519('0x62')],'as':_0x4519('0xec'),'attributes':['id','name',_0x4519('0x63')],'through':{'attributes':[]}}],'order':[[_0x4519('0xde'),_0x4519('0xdd')]]};if(_0x5176b8[_0x4519('0x21')]['range']){_0xac5687[_0x4519('0x5c')][_0x4519('0xde')]={'$gte':_0x245d08['from'],'$lte':_0x245d08['to']};}switch(_0x2a8bab){case _0x4519('0xc6'):_0xac5687['attributes'][_0x4519('0x5e')](_0x4519('0xed'),'customerIp',_0x4519('0xee'),'deviceModel',_0x4519('0xef'),_0x4519('0xf0'),'ratingType',_0x4519('0xf1'),_0x4519('0xf2'));break;case _0x4519('0xc5'):_0xac5687[_0x4519('0x7a')]['push'](_0x4519('0xf3'),_0x4519('0xf4'));break;case _0x4519('0xc8'):_0xac5687['attributes'][_0x4519('0x5e')](_0x4519('0xf5'),_0x4519('0xf6'));break;}return db[_['startCase'](_0x2a8bab)+_0x4519('0xf7')]['findAndCountAll'](_0xac5687)[_0x4519('0x17')](function(_0x393a06){_0x5d6cfb['count']+=_0x393a06['count'];return _[_0x4519('0x6b')](_0x393a06[_0x4519('0x9c')],function(_0x3add8c){var _0x18b68c=_0x3add8c[_0x4519('0x38')]({'plain':!![]});_0x18b68c[_0x4519('0xe0')]=_0x2a8bab;if(_0x18b68c[_0x4519('0xeb')]){_0x18b68c[_0x4519('0xeb')]={'id':_0x18b68c['Owner']['id'],'name':_0x18b68c[_0x4519('0xeb')][_0x4519('0x1c')],'fullname':_0x18b68c['Owner'][_0x4519('0xe1')]};}return _0x18b68c;});});}});return Promise['all'](_0x2bf04c);})['then'](function(_0x94abab){return _(_0x94abab)[_0x4519('0xf8')]()['sortBy'](_0x4519('0xde'))['reverse']()['value']();})[_0x4519('0x17')](function(_0x366068){_0x5d6cfb[_0x4519('0x9c')]=_0x3aa0fa['limit']?_0x366068[_0x4519('0xf9')](_0x3aa0fa['offset'],_0x3aa0fa[_0x4519('0x14')]+_0x3aa0fa[_0x4519('0x12')]):_0x366068;return _0x5d6cfb;})[_0x4519('0x17')](respondWithFilteredResult(_0xc4eb45,_0x3aa0fa))['catch'](handleError(_0xc4eb45,null));}; \ No newline at end of file +var _0xb9d5=['squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','then','sendStatus','error','stack','name','send','index','describe','getOptions','findAll','query','user','catch','destroy','CmContact','find','params','tags','keys','length','cf_','columnName','displayName','CmCustomField','alias','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','CmHopperBlack','create','ChatInteraction','update','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','push','ListId','findOrCreate','spread','contact','all','show','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','map','format','cf_%d','omit','startsWith','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','values','phone','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','nolimit','getTags','setTags','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','OrderBy','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','ItemType.OrderBy','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','filter','include','getHopperHistories','includeAll','rows','getHopperFinals','getJscriptySessions','options','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','binding_keys','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','path','meta','import','agent','binding','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','User','getJourney','mail','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','parse','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','note','userSecondDisposition','userThirdDisposition','UserId','fullname','createdAt','DESC','startCase','chat','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','osName','ratingMessage','ratingType','ratingValue','subject','substatus','openchannel','threadId','Interaction','flatten','sortBy','reverse','value','moment','bluebird','lodash'];(function(_0x402b96,_0x3f3f83){var _0x55ddc6=function(_0x4196c9){while(--_0x4196c9){_0x402b96['push'](_0x402b96['shift']());}};_0x55ddc6(++_0x3f3f83);}(_0xb9d5,0x100));var _0x5b9d=function(_0x46e6cc,_0x5723e6){_0x46e6cc=_0x46e6cc-0x0;var _0x25eb7a=_0xb9d5[_0x46e6cc];return _0x25eb7a;};'use strict';var moment=require(_0x5b9d('0x0'));var BPromise=require(_0x5b9d('0x1'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x5b9d('0x2'));var squel=require(_0x5b9d('0x3'));var Papa=require(_0x5b9d('0x4'));var Redis=require(_0x5b9d('0x5'));var contacts=require(_0x5b9d('0x6'));var qs=require(_0x5b9d('0x7'));var logger=require(_0x5b9d('0x8'))(_0x5b9d('0x9'));var config=require(_0x5b9d('0xa'));var shared=require(_0x5b9d('0xb'));var db=require(_0x5b9d('0xc'))['db'];config['redis']=_[_0x5b9d('0xd')](config['redis'],{'host':_0x5b9d('0xe'),'port':0x18eb});var socket=require(_0x5b9d('0xf'))(new Redis(config['redis']));require(_0x5b9d('0x10'))[_0x5b9d('0x11')](socket);function respondWithResult(_0x16c4b3,_0x21280a){_0x21280a=_0x21280a||0xc8;return function(_0x2828f8){if(_0x2828f8){return _0x16c4b3[_0x5b9d('0x12')](_0x21280a)[_0x5b9d('0x13')](_0x2828f8);}};}function respondWithFilteredResult(_0x4cbe7b,_0x896326){return function(_0x1d4c4c){if(_0x1d4c4c){var _0x3e9a0f=typeof _0x896326[_0x5b9d('0x14')]==='undefined'&&typeof _0x896326['limit']===_0x5b9d('0x15');var _0x2096ef=_0x1d4c4c[_0x5b9d('0x16')];var _0x75d052=_0x3e9a0f?0x0:_0x896326[_0x5b9d('0x14')];var _0x37ecea=_0x3e9a0f?_0x1d4c4c[_0x5b9d('0x16')]:_0x896326[_0x5b9d('0x14')]+_0x896326[_0x5b9d('0x17')];var _0x525a33;if(_0x37ecea>=_0x2096ef){_0x37ecea=_0x2096ef;_0x525a33=0xc8;}else{_0x525a33=0xce;}_0x4cbe7b['status'](_0x525a33);return _0x4cbe7b[_0x5b9d('0x18')](_0x5b9d('0x19'),_0x75d052+'-'+_0x37ecea+'/'+_0x2096ef)[_0x5b9d('0x13')](_0x1d4c4c);}return null;};}function saveUpdates(_0x1d8483){return function(_0x350630){if(_0x350630){return _0x350630['update'](_0x1d8483)[_0x5b9d('0x1a')](function(_0x33d265){return _0x33d265;});}return null;};}function removeEntity(_0x5bdbb3){return function(_0x464a9f){if(_0x464a9f){return _0x464a9f['destroy']()['then'](function(){_0x5bdbb3[_0x5b9d('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x237a95){return function(_0x2e8092){if(!_0x2e8092){_0x237a95[_0x5b9d('0x1b')](0x194);}return _0x2e8092;};}function handleError(_0x8b4e8b,_0x455356){_0x455356=_0x455356||0x1f4;return function(_0x2e349b){logger[_0x5b9d('0x1c')](_0x2e349b[_0x5b9d('0x1d')]);if(_0x2e349b[_0x5b9d('0x1e')]){delete _0x2e349b[_0x5b9d('0x1e')];}_0x8b4e8b[_0x5b9d('0x12')](_0x455356)[_0x5b9d('0x1f')](_0x2e349b);};}exports[_0x5b9d('0x20')]=function(_0x2afd3d,_0x11192f){var _0x54e58f={};return contacts[_0x5b9d('0x21')]()['then'](function(_0x177861){_0x54e58f=qs[_0x5b9d('0x22')](_0x177861,_0x2afd3d);return contacts[_0x5b9d('0x23')](_0x2afd3d[_0x5b9d('0x24')],_0x2afd3d[_0x5b9d('0x25')],_0x54e58f,_0x177861);})[_0x5b9d('0x1a')](respondWithFilteredResult(_0x11192f,_0x54e58f))[_0x5b9d('0x26')](handleError(_0x11192f,null));};exports[_0x5b9d('0x27')]=function(_0x12242e,_0x3c8c97){return db[_0x5b9d('0x28')][_0x5b9d('0x29')]({'where':{'id':_0x12242e[_0x5b9d('0x2a')]['id']}})[_0x5b9d('0x1a')](handleEntityNotFound(_0x3c8c97,null))[_0x5b9d('0x1a')](removeEntity(_0x3c8c97,null))['catch'](handleError(_0x3c8c97,null));};exports[_0x5b9d('0x21')]=function(_0x3e23be,_0xb47503){return db['CmContact'][_0x5b9d('0x21')]()[_0x5b9d('0x1a')](function(_0x51303c){delete _0x51303c[_0x5b9d('0x2b')];for(var _0x1caeb0=0x0;_0x1caeb00x0){return new Promise(function(_0x3a117f){var _0x20f2de=[];for(var _0x5aef71=0x0;_0x5aef71<_0xf7fce[_0x5b9d('0x2d')];_0x5aef71++){_0x20f2de[_0x5b9d('0x61')](insertAdditionalPhones(_0xf7fce[_0x5aef71][_0x5b9d('0x65')],_0xf7fce[_0x5aef71][_0x5b9d('0x5e')]));}Promise[_0x5b9d('0x66')](_0x20f2de)[_0x5b9d('0x1a')](function(){_0x3a117f(0x1);});})[_0x5b9d('0x1a')](function(){return{'success':_0xad8892,'failure':_0x38e900,'duplicates':_0x55ca90};});}else{return{'success':_0xad8892,'failure':_0x38e900,'duplicates':_0x55ca90};}}})[_0x5b9d('0x1a')](respondWithResult(_0x139dc2,0xc9))[_0x5b9d('0x26')](handleError(_0x139dc2,null));};exports[_0x5b9d('0x67')]=function(_0x2da10d,_0x2e42dd){var _0x548c16;return db[_0x5b9d('0x28')][_0x5b9d('0x21')]()[_0x5b9d('0x1a')](function(_0x4b83d3){return db[_0x5b9d('0x28')][_0x5b9d('0x29')]({'where':{'id':_0x2da10d[_0x5b9d('0x2a')]['id']},'include':[{'model':db[_0x5b9d('0x68')],'as':_0x5b9d('0x69'),'attributes':['id',_0x5b9d('0x1e'),_0x5b9d('0x6a')],'required':_0x2da10d[_0x5b9d('0x24')][_0x5b9d('0x6b')]?!![]:![]},{'model':db[_0x5b9d('0x4e')],'as':_0x5b9d('0x6c'),'where':{'CmContactId':_0x2da10d['params']['id']},'required':![],'include':[{'model':db[_0x5b9d('0x6d')],'as':_0x5b9d('0x6e')}]}],'order':[db[_0x5b9d('0x6f')][_0x5b9d('0x70')](_0x5b9d('0x71'))],'attributes':_[_0x5b9d('0x2c')](_0x4b83d3)});})['then'](function(_0x20f2d9){if(!_[_0x5b9d('0x5a')](_0x20f2d9)){_0x548c16=_0x20f2d9[_0x5b9d('0x3b')]({'plain':!![]});var _0x9274f5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x20f2d9&&_0x20f2d9[_0x5b9d('0x62')]){if(_0x20f2d9['ListId']){_0x9274f5[_0x5b9d('0x60')][_0x5b9d('0x72')][_0x5b9d('0x61')]({'ListId':{'$ne':_0x20f2d9[_0x5b9d('0x62')]}});}}return db[_0x5b9d('0x31')][_0x5b9d('0x23')](_0x9274f5);}})[_0x5b9d('0x1a')](function(_0x1bc4c8){if(!_[_0x5b9d('0x5a')](_0x1bc4c8)){return _['omit'](_0x548c16,_[_0x5b9d('0x73')](_0x1bc4c8,function(_0x20f110){return util[_0x5b9d('0x74')](_0x5b9d('0x75'),_0x20f110['id']);}));}})['then'](handleEntityNotFound(_0x2e42dd,null))[_0x5b9d('0x1a')](respondWithResult(_0x2e42dd,null))[_0x5b9d('0x26')](handleError(_0x2e42dd,null));};exports['update']=function(_0x3f9c5c,_0x47deb0){var _0x27a506;if(_0x3f9c5c[_0x5b9d('0x3a')]['id']){delete _0x3f9c5c['body']['id'];}if(!_[_0x5b9d('0x5a')](_0x3f9c5c['body'][_0x5b9d('0x5b')])){var _0x275809=_0x3f9c5c[_0x5b9d('0x3a')][_0x5b9d('0x5b')];if(!_[_0x5b9d('0x5a')](shared['timezones'][_0x275809]))_0x3f9c5c[_0x5b9d('0x3a')][_0x5b9d('0x5d')]=shared[_0x5b9d('0x5c')][_0x275809][_0x5b9d('0x5d')];}return db[_0x5b9d('0x28')][_0x5b9d('0x29')]({'where':{'id':_0x3f9c5c[_0x5b9d('0x2a')]['id']}})['then'](handleEntityNotFound(_0x47deb0,null))['then'](saveUpdates(_0x3f9c5c[_0x5b9d('0x3a')],null))['then'](function(_0xc91c06){_0x27a506=_0xc91c06;var _0x372fd7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xc91c06&&_0xc91c06[_0x5b9d('0x62')]){if(_0xc91c06['ListId']){_0x372fd7[_0x5b9d('0x60')][_0x5b9d('0x72')]['push']({'ListId':{'$ne':_0xc91c06[_0x5b9d('0x62')]}});}}return db[_0x5b9d('0x31')][_0x5b9d('0x23')](_0x372fd7);})[_0x5b9d('0x1a')](function(_0x321976){if(_0x321976){return _[_0x5b9d('0x76')](_['pickBy'](_0x3f9c5c[_0x5b9d('0x3a')],function(_0x1d13dd,_0x577a2f){return _[_0x5b9d('0x77')](_0x577a2f,'cf_');}),_['map'](_0x321976,function(_0x555c80){return util['format'](_0x5b9d('0x75'),_0x555c80['id']);}));}})[_0x5b9d('0x1a')](function(_0x229521){if(_0x229521&&!_['isEmpty'](_0x229521)){var _0x37928d=squel[_0x5b9d('0x44')]()[_0x5b9d('0x78')](_0x5b9d('0x79'))[_0x5b9d('0x7a')](_0x229521)[_0x5b9d('0x60')](_0x5b9d('0x7b'),_0x3f9c5c[_0x5b9d('0x2a')]['id'])[_0x5b9d('0x7c')]();return db[_0x5b9d('0x6f')]['query'](_0x37928d[_0x5b9d('0x7d')],{'replacements':_0x37928d[_0x5b9d('0x7e')]});}})['then'](function(){if(_0x3f9c5c[_0x5b9d('0x3a')]['phone']&&_0x27a506){return db[_0x5b9d('0x40')][_0x5b9d('0x44')]({'phone':_0x3f9c5c[_0x5b9d('0x3a')][_0x5b9d('0x7f')],'OrderBy':0x0},{'where':{'ContactId':_0x27a506['id']}});}})[_0x5b9d('0x1a')](function(){return _0x27a506;})[_0x5b9d('0x1a')](respondWithResult(_0x47deb0,null))[_0x5b9d('0x26')](handleError(_0x47deb0,null));};exports['getTags']=function(_0x342123,_0x4a07fe){var _0x42d39c={};var _0x1fdf6f={};var _0x48ded4;var _0x4a0629;return db[_0x5b9d('0x28')][_0x5b9d('0x80')]({'where':{'id':_0x342123['params']['id']}})[_0x5b9d('0x1a')](handleEntityNotFound(_0x4a07fe,null))['then'](function(_0x47aed1){if(_0x47aed1){_0x48ded4=_0x47aed1;_0x1fdf6f[_0x5b9d('0x81')]=_[_0x5b9d('0x2c')](db['Tag'][_0x5b9d('0x82')]);_0x1fdf6f[_0x5b9d('0x24')]=_['keys'](_0x342123['query']);_0x1fdf6f[_0x5b9d('0x83')]=_[_0x5b9d('0x84')](_0x1fdf6f[_0x5b9d('0x81')],_0x1fdf6f[_0x5b9d('0x24')]);_0x42d39c[_0x5b9d('0x85')]=_['intersection'](_0x1fdf6f[_0x5b9d('0x81')],qs[_0x5b9d('0x86')](_0x342123[_0x5b9d('0x24')]['fields']));_0x42d39c[_0x5b9d('0x85')]=_0x42d39c[_0x5b9d('0x85')][_0x5b9d('0x2d')]?_0x42d39c[_0x5b9d('0x85')]:_0x1fdf6f[_0x5b9d('0x81')];_0x42d39c[_0x5b9d('0x87')]=qs[_0x5b9d('0x88')](_0x342123['query']['sort']);_0x42d39c[_0x5b9d('0x60')]=qs[_0x5b9d('0x83')](_[_0x5b9d('0x89')](_0x342123[_0x5b9d('0x24')],_0x1fdf6f[_0x5b9d('0x83')]));if(_0x342123['query']['filter']){_0x42d39c[_0x5b9d('0x60')]=_[_0x5b9d('0x39')](_0x42d39c[_0x5b9d('0x60')],{'$or':_[_0x5b9d('0x73')](_0x42d39c[_0x5b9d('0x85')],function(_0x4ea6d8){var _0x48c1ce={};_0x48c1ce[_0x4ea6d8]={'$like':'%'+_0x342123['query']['filter']+'%'};return _0x48c1ce;})});}_0x42d39c=_[_0x5b9d('0x39')]({},_0x42d39c,_0x342123['options']);return _0x48ded4['getTags'](_0x42d39c);}})['then'](function(_0x28e690){if(_0x28e690){_0x4a0629=_0x28e690[_0x5b9d('0x2d')];if(!_0x342123[_0x5b9d('0x24')][_0x5b9d('0x38')](_0x5b9d('0x8a'))){_0x42d39c[_0x5b9d('0x17')]=qs['limit'](_0x342123[_0x5b9d('0x24')]['limit']);_0x42d39c[_0x5b9d('0x14')]=qs['offset'](_0x342123['query'][_0x5b9d('0x14')]);}return _0x48ded4[_0x5b9d('0x8b')](_0x42d39c);}})[_0x5b9d('0x1a')](function(_0x3f51a8){if(_0x3f51a8){return _0x3f51a8?{'count':_0x4a0629,'rows':_0x3f51a8}:null;}})[_0x5b9d('0x1a')](respondWithResult(_0x4a07fe,null))[_0x5b9d('0x26')](handleError(_0x4a07fe,null));};exports[_0x5b9d('0x8c')]=function(_0x55dddc,_0x42d8d9){if(_0x55dddc[_0x5b9d('0x3a')]['id']){delete _0x55dddc[_0x5b9d('0x3a')]['id'];}return db['CmContact']['findOne']({'where':{'id':_0x55dddc[_0x5b9d('0x2a')]['id']}})[_0x5b9d('0x1a')](handleEntityNotFound(_0x42d8d9,null))[_0x5b9d('0x1a')](function(_0x3fa03f){if(_0x3fa03f){return _0x3fa03f[_0x5b9d('0x8c')](_0x55dddc['body'][_0x5b9d('0x8d')]||[]);}return null;})[_0x5b9d('0x1a')](respondWithResult(_0x42d8d9,null))[_0x5b9d('0x26')](handleError(_0x42d8d9,null));};exports[_0x5b9d('0x8e')]=function(_0x4ef13d,_0x1b2d42){var _0x2b7717=[];_0x2b7717[_0x5b9d('0x61')](addAdditionalPhones(_0x4ef13d['body']));Promise[_0x5b9d('0x66')](_0x2b7717)['then'](function(){_0x2b7717=[];_0x2b7717[_0x5b9d('0x61')](deleteCmHopperPhones(_0x4ef13d[_0x5b9d('0x3a')]['id']));_0x2b7717[_0x5b9d('0x61')](addCmHopperPhones(_0x4ef13d['body']['id']));Promise[_0x5b9d('0x66')](_0x2b7717)[_0x5b9d('0x1a')](function(){return[0x1];})[_0x5b9d('0x1a')](respondWithResult(_0x1b2d42,null));});};function addAdditionalPhones(_0x12cf53){var _0x507a51;return new Promise(function(_0x31ab2b){return db[_0x5b9d('0x4e')][_0x5b9d('0x27')]({'where':{'CmContactId':_0x12cf53['id']}})[_0x5b9d('0x1a')](function(){db[_0x5b9d('0x6d')][_0x5b9d('0x23')]({'raw':!![],'attributes':['id','OrderBy']})[_0x5b9d('0x1a')](function(_0x3abbfe){var _0x22c8d2=[];for(var _0x4372c1=0x0;_0x4372c1<_0x12cf53[_0x5b9d('0x8f')]['length'];_0x4372c1++){var _0x252f3b=_0x12cf53[_0x5b9d('0x90')]?_[_0x5b9d('0x5a')](_0x12cf53[_0x5b9d('0x90')][_0x4372c1])?'':_0x12cf53[_0x5b9d('0x90')][_0x4372c1]:_0x12cf53[_0x5b9d('0x8f')][_0x4372c1][_0x5b9d('0x91')]?_0x12cf53[_0x5b9d('0x8f')][_0x4372c1][_0x5b9d('0x91')]:'';var _0x20c175=_[_0x5b9d('0x5a')](_0x12cf53[_0x5b9d('0x8f')][_0x4372c1][_0x5b9d('0x92')])?'':_0x12cf53[_0x5b9d('0x8f')][_0x4372c1][_0x5b9d('0x92')];var _0x2c8c19=_0x252f3b+':'+_0x12cf53[_0x5b9d('0x8f')][_0x4372c1][_0x5b9d('0x7f')]+'§'+_0x20c175;if(_['isNil'](_0x507a51))_0x507a51=_0x2c8c19;else _0x507a51+=';'+_0x2c8c19;var _0xb4515d=null;var _0x10db9e=null;if(_0x12cf53[_0x5b9d('0x90')]){if(!_['isNil'](_0x12cf53[_0x5b9d('0x90')][_0x4372c1])){_0x10db9e=_[_0x5b9d('0x29')](_0x3abbfe,function(_0x6680eb){return _0x6680eb['id']===_0x12cf53[_0x5b9d('0x90')][_0x4372c1];});if(!_['isNil'](_0x10db9e)){_0xb4515d=_0x10db9e[_0x5b9d('0x93')];}}}else{if(!_['isNil'](_0x12cf53[_0x5b9d('0x8f')][_0x4372c1])){_0x10db9e=_[_0x5b9d('0x29')](_0x3abbfe,function(_0x169d1f){return _0x169d1f['id']===_0x12cf53[_0x5b9d('0x8f')][_0x4372c1][_0x5b9d('0x91')];});if(!_[_0x5b9d('0x5a')](_0x10db9e)){_0xb4515d=_0x4372c1;}}}if(_[_0x5b9d('0x5a')](_0xb4515d)){_0xb4515d=0x64;}_0x22c8d2[_0x5b9d('0x61')](addAdditionalPhone(_0x12cf53['id'],_0x12cf53[_0x5b9d('0x8f')][_0x4372c1][_0x5b9d('0x7f')],_0x12cf53[_0x5b9d('0x90')]?_[_0x5b9d('0x5a')](_0x12cf53[_0x5b9d('0x90')][_0x4372c1])?null:_0x12cf53[_0x5b9d('0x90')][_0x4372c1]:_0x12cf53[_0x5b9d('0x8f')][_0x4372c1]['ItemTypeId']?_0x12cf53[_0x5b9d('0x8f')][_0x4372c1]['ItemTypeId']:null,_0xb4515d,_0x20c175));}Promise[_0x5b9d('0x66')](_0x22c8d2)[_0x5b9d('0x1a')](function(){db[_0x5b9d('0x28')][_0x5b9d('0x44')]({'AdditionalPhones':_0x507a51},{'where':{'id':_0x12cf53['id']}})[_0x5b9d('0x1a')](function(){_0x31ab2b(0x1);});});});});});}function addAdditionalPhone(_0x4967b8,_0x54db99,_0x323924,_0x140294,_0x4443eb){return db[_0x5b9d('0x4e')][_0x5b9d('0x29')]({'where':{'CmContactId':_0x4967b8,'item':_0x54db99}})[_0x5b9d('0x1a')](function(_0x12ffb4){if(_0x12ffb4)logger[_0x5b9d('0x35')]('contact\x20phone\x20exists',_0x12ffb4);else{db[_0x5b9d('0x4e')][_0x5b9d('0x42')]({'CmContactId':_0x4967b8,'item':_0x54db99,'ItemTypeId':_0x323924,'OrderBy':_0x140294,'ItemClass':_0x5b9d('0x94'),'description':_0x4443eb});}});}function deleteCmHopperPhones(_0x170b52){return new Promise(function(_0x7ba025){return db[_0x5b9d('0x40')][_0x5b9d('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x170b52}})[_0x5b9d('0x1a')](function(_0x503b3b){db[_0x5b9d('0x95')][_0x5b9d('0x27')]({'where':{'CmHopperId':{'$in':_[_0x5b9d('0x73')](_0x503b3b,'id')}}});})[_0x5b9d('0x1a')](function(){_0x7ba025(0x1);});});}function addCmHopperPhones(_0x13ee6b){return new Promise(function(_0x1816e7){return db['CmHopper'][_0x5b9d('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x13ee6b}})[_0x5b9d('0x1a')](function(_0x55b630){var _0x56db56=[];_[_0x5b9d('0x73')](_0x55b630,function(_0x3e28cb){_0x56db56[_0x5b9d('0x61')](createCmHopperPhone(_0x13ee6b,_0x3e28cb['id']));});Promise[_0x5b9d('0x66')](_0x56db56)['then'](function(){_0x1816e7(0x1);});});});}function createCmHopperPhone(_0x168d9c,_0x224ec3){return new Promise(function(_0x5c5f27){db[_0x5b9d('0x4e')][_0x5b9d('0x23')]({'raw':!![],'attributes':[_0x5b9d('0x96'),_0x5b9d('0x93')],'where':{'CmContactId':_0x168d9c,'ItemClass':'PHONE'},'include':[{'model':db[_0x5b9d('0x6d')],'attributes':[_0x5b9d('0x93')],'as':_0x5b9d('0x6e')}],'order':[_0x5b9d('0x93'),db[_0x5b9d('0x6f')]['literal'](_0x5b9d('0x97'))]})[_0x5b9d('0x1a')](function(_0x42d627){var _0x23c59e=0x1;var _0x1dbfc0=_['map'](_0x42d627,function(_0x4f3058){_0x4f3058['CmHopperId']=_0x224ec3;_0x4f3058[_0x5b9d('0x7f')]=_0x4f3058[_0x5b9d('0x96')];_0x4f3058[_0x5b9d('0x93')]=_0x23c59e;delete _0x4f3058[_0x5b9d('0x98')];_0x23c59e=_0x23c59e+0x1;return _0x4f3058;});return db['CmHopperAdditionalPhone'][_0x5b9d('0x99')](_0x1dbfc0,{});})[_0x5b9d('0x1a')](function(){_0x5c5f27(0x1);});});}function insertAdditionalPhones(_0xb3efde,_0x358546){return new Promise(function(_0x476f92){var _0x304f8f=[];for(var _0x460b56=0x0;_0x460b56<_0x358546[_0x5b9d('0x2d')];_0x460b56++){var _0x7fec24=_0x358546[_0x460b56];_0x304f8f['push'](parseContactItemType(_0x7fec24));}Promise[_0x5b9d('0x66')](_0x304f8f)[_0x5b9d('0x1a')](function(){var _0x5bf3aa={'id':_0xb3efde['id'],'items':_0x358546};return addAdditionalPhones(_0x5bf3aa)[_0x5b9d('0x1a')](function(){return addCmHopperPhones(_0xb3efde['id']);});})[_0x5b9d('0x1a')](function(){_0x476f92(_0xb3efde);});});}function parseContactItemType(_0x54ca1c){return new Promise(function(_0x29c0c2){if(_0x54ca1c[_0x5b9d('0x38')]('ItemTypeId')){_0x29c0c2(_0x54ca1c);}else{return db[_0x5b9d('0x6d')][_0x5b9d('0x29')]({'where':{'name':_0x54ca1c[_0x5b9d('0x6e')]}})[_0x5b9d('0x1a')](function(_0x172f66){if(_[_0x5b9d('0x5a')](_0x172f66))_0x54ca1c[_0x5b9d('0x91')]=null;else _0x54ca1c[_0x5b9d('0x91')]=_0x172f66['id'];_0x29c0c2(_0x54ca1c);});}});}exports[_0x5b9d('0x9a')]=function(_0x24ecff,_0x54b788){return db[_0x5b9d('0x4e')]['findAll']({'raw':!![],'where':{'CmContactId':_0x24ecff['params']['id'],'ItemClass':_0x5b9d('0x94')},'include':[{'model':db[_0x5b9d('0x6d')],'as':'ItemType'}],'order':[[_0x5b9d('0x93')],[db['sequelize'][_0x5b9d('0x70')](_0x5b9d('0x97'))]]})['then'](function(_0x2a3429){return _0x2a3429;})['then'](respondWithResult(_0x54b788,null))[_0x5b9d('0x26')](handleError(_0x54b788,null));};exports[_0x5b9d('0x9b')]=function(_0x83984b,_0x959bc9){return db[_0x5b9d('0x4e')][_0x5b9d('0x23')]({'raw':!![],'where':{'CmContactId':_0x83984b[_0x5b9d('0x3a')][_0x5b9d('0x9c')]}})['then'](function(_0x2ad0dd){var _0x236442=_['map'](_0x2ad0dd,function(_0x960d98){_0x960d98[_0x5b9d('0x9d')]=_0x83984b[_0x5b9d('0x3a')][_0x5b9d('0x9e')];return _0x960d98;});return db[_0x5b9d('0x4e')][_0x5b9d('0x99')](_0x236442,{});})['then'](function(){return addCmHopperPhones(_0x83984b[_0x5b9d('0x3a')][_0x5b9d('0x9e')]);})[_0x5b9d('0x1a')](function(){return['ok'];})[_0x5b9d('0x1a')](respondWithResult(_0x959bc9,null))['catch'](handleError(_0x959bc9,null));};exports[_0x5b9d('0x9f')]=function(_0x964aa6,_0x47b556){var _0x2ead2e=[];_0x2ead2e[_0x5b9d('0x61')](createCmHopperPhone(_0x964aa6[_0x5b9d('0x3a')]['id'],_0x964aa6[_0x5b9d('0x3a')]['hopperId']));Promise[_0x5b9d('0x66')](_0x2ead2e)[_0x5b9d('0x1a')](function(){return[0x1];})[_0x5b9d('0x1a')](respondWithResult(_0x47b556,null));};exports[_0x5b9d('0xa0')]=function(_0x59a90f,_0x7408c2){var _0x168edd={'raw':![],'where':{}};var _0x51f484={};var _0x664199={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x59a90f[_0x5b9d('0x2a')]['id']}})[_0x5b9d('0x1a')](handleEntityNotFound(_0x7408c2,null))[_0x5b9d('0x1a')](function(_0x2691cf){if(_0x2691cf){_0x51f484[_0x5b9d('0x81')]=_['keys'](db[_0x5b9d('0x40')][_0x5b9d('0x82')]);_0x51f484[_0x5b9d('0x24')]=_[_0x5b9d('0x2c')](_0x59a90f['query']);_0x51f484[_0x5b9d('0x83')]=_[_0x5b9d('0x84')](_0x51f484[_0x5b9d('0x81')],_0x51f484[_0x5b9d('0x24')]);_0x168edd[_0x5b9d('0x85')]=_[_0x5b9d('0x84')](_0x51f484['model'],qs[_0x5b9d('0x86')](_0x59a90f[_0x5b9d('0x24')][_0x5b9d('0x86')]));_0x168edd[_0x5b9d('0x85')]=_0x168edd['attributes'][_0x5b9d('0x2d')]?_0x168edd['attributes']:_0x51f484[_0x5b9d('0x81')];if(!_0x59a90f[_0x5b9d('0x24')][_0x5b9d('0x38')](_0x5b9d('0x8a'))){_0x168edd['limit']=qs[_0x5b9d('0x17')](_0x59a90f[_0x5b9d('0x24')][_0x5b9d('0x17')]);_0x168edd[_0x5b9d('0x14')]=qs[_0x5b9d('0x14')](_0x59a90f['query'][_0x5b9d('0x14')]);}_0x168edd[_0x5b9d('0x87')]=qs['sort'](_0x59a90f[_0x5b9d('0x24')][_0x5b9d('0x88')]);_0x168edd[_0x5b9d('0x60')]=qs[_0x5b9d('0x83')](_['pick'](_0x59a90f[_0x5b9d('0x24')],_0x51f484[_0x5b9d('0x83')]));_0x168edd[_0x5b9d('0x60')][_0x5b9d('0xa1')]=_0x2691cf['id'];if(_0x59a90f[_0x5b9d('0x24')][_0x5b9d('0xa2')]){_0x168edd['where']=_[_0x5b9d('0x39')](_0x168edd['where'],{'$or':_[_0x5b9d('0x73')](_0x168edd['attributes'],function(_0x21134d){var _0x184376={};_0x184376[_0x21134d]={'$like':'%'+_0x59a90f[_0x5b9d('0x24')][_0x5b9d('0xa2')]+'%'};return _0x184376;})});}_0x168edd=_[_0x5b9d('0x39')]({},_0x168edd,_0x59a90f['options']);return db[_0x5b9d('0x40')][_0x5b9d('0x16')]({'where':_0x168edd[_0x5b9d('0x60')]})[_0x5b9d('0x1a')](function(_0x2074ad){_0x664199[_0x5b9d('0x16')]=_0x2074ad;if(_0x59a90f['query']['includeAll']){_0x168edd[_0x5b9d('0xa3')]=[{'all':!![]}];}return db[_0x5b9d('0x40')][_0x5b9d('0x23')](_0x168edd);})[_0x5b9d('0x1a')](function(_0x47e738){_0x664199['rows']=_0x47e738;return _0x664199;});}})[_0x5b9d('0x1a')](respondWithFilteredResult(_0x7408c2,_0x168edd))['catch'](handleError(_0x7408c2,null));};exports[_0x5b9d('0xa4')]=function(_0x5488d1,_0x2a53d0){var _0x1212cc={'raw':!![],'where':{}};var _0x1d8162={};var _0x149ee9={'count':0x0,'rows':[]};return db[_0x5b9d('0x28')][_0x5b9d('0x80')]({'where':{'id':_0x5488d1[_0x5b9d('0x2a')]['id']}})[_0x5b9d('0x1a')](handleEntityNotFound(_0x2a53d0,null))[_0x5b9d('0x1a')](function(_0x4bd425){if(_0x4bd425){_0x1d8162[_0x5b9d('0x81')]=_[_0x5b9d('0x2c')](db[_0x5b9d('0x50')][_0x5b9d('0x82')]);_0x1d8162[_0x5b9d('0x24')]=_[_0x5b9d('0x2c')](_0x5488d1[_0x5b9d('0x24')]);_0x1d8162['filters']=_[_0x5b9d('0x84')](_0x1d8162[_0x5b9d('0x81')],_0x1d8162[_0x5b9d('0x24')]);_0x1212cc[_0x5b9d('0x85')]=_[_0x5b9d('0x84')](_0x1d8162[_0x5b9d('0x81')],qs[_0x5b9d('0x86')](_0x5488d1[_0x5b9d('0x24')][_0x5b9d('0x86')]));_0x1212cc['attributes']=_0x1212cc['attributes'][_0x5b9d('0x2d')]?_0x1212cc[_0x5b9d('0x85')]:_0x1d8162[_0x5b9d('0x81')];if(!_0x5488d1['query'][_0x5b9d('0x38')](_0x5b9d('0x8a'))){_0x1212cc[_0x5b9d('0x17')]=qs[_0x5b9d('0x17')](_0x5488d1[_0x5b9d('0x24')]['limit']);_0x1212cc[_0x5b9d('0x14')]=qs[_0x5b9d('0x14')](_0x5488d1[_0x5b9d('0x24')][_0x5b9d('0x14')]);}_0x1212cc[_0x5b9d('0x87')]=qs[_0x5b9d('0x88')](_0x5488d1[_0x5b9d('0x24')][_0x5b9d('0x88')]);_0x1212cc[_0x5b9d('0x60')]=qs[_0x5b9d('0x83')](_['pick'](_0x5488d1[_0x5b9d('0x24')],_0x1d8162[_0x5b9d('0x83')]));_0x1212cc['where'][_0x5b9d('0xa1')]=_0x4bd425['id'];if(_0x5488d1['query'][_0x5b9d('0xa2')]){_0x1212cc[_0x5b9d('0x60')]=_['merge'](_0x1212cc[_0x5b9d('0x60')],{'$or':_[_0x5b9d('0x73')](_0x1212cc[_0x5b9d('0x85')],function(_0x3914b8){var _0x3e8749={};_0x3e8749[_0x3914b8]={'$like':'%'+_0x5488d1[_0x5b9d('0x24')][_0x5b9d('0xa2')]+'%'};return _0x3e8749;})});}_0x1212cc=_[_0x5b9d('0x39')]({},_0x1212cc,_0x5488d1['options']);return db['CmHopperHistory']['count']({'where':_0x1212cc[_0x5b9d('0x60')]})[_0x5b9d('0x1a')](function(_0x477833){_0x149ee9[_0x5b9d('0x16')]=_0x477833;if(_0x5488d1[_0x5b9d('0x24')][_0x5b9d('0xa5')]){_0x1212cc['include']=[{'all':!![]}];}return db[_0x5b9d('0x50')][_0x5b9d('0x23')](_0x1212cc);})[_0x5b9d('0x1a')](function(_0x326043){_0x149ee9[_0x5b9d('0xa6')]=_0x326043;return _0x149ee9;});}})[_0x5b9d('0x1a')](respondWithFilteredResult(_0x2a53d0,_0x1212cc))[_0x5b9d('0x26')](handleError(_0x2a53d0,null));};exports[_0x5b9d('0xa7')]=function(_0xd8abb3,_0x211d90){var _0x132394={'raw':!![],'where':{}};var _0x814acf={};var _0x5078c5={'count':0x0,'rows':[]};return db[_0x5b9d('0x28')]['findOne']({'where':{'id':_0xd8abb3[_0x5b9d('0x2a')]['id']}})['then'](handleEntityNotFound(_0x211d90,null))['then'](function(_0x3716c7){if(_0x3716c7){_0x814acf[_0x5b9d('0x81')]=_['keys'](db[_0x5b9d('0x4f')][_0x5b9d('0x82')]);_0x814acf[_0x5b9d('0x24')]=_['keys'](_0xd8abb3[_0x5b9d('0x24')]);_0x814acf[_0x5b9d('0x83')]=_[_0x5b9d('0x84')](_0x814acf[_0x5b9d('0x81')],_0x814acf[_0x5b9d('0x24')]);_0x132394[_0x5b9d('0x85')]=_[_0x5b9d('0x84')](_0x814acf['model'],qs[_0x5b9d('0x86')](_0xd8abb3['query'][_0x5b9d('0x86')]));_0x132394[_0x5b9d('0x85')]=_0x132394['attributes'][_0x5b9d('0x2d')]?_0x132394[_0x5b9d('0x85')]:_0x814acf[_0x5b9d('0x81')];if(!_0xd8abb3['query'][_0x5b9d('0x38')](_0x5b9d('0x8a'))){_0x132394[_0x5b9d('0x17')]=qs[_0x5b9d('0x17')](_0xd8abb3['query']['limit']);_0x132394[_0x5b9d('0x14')]=qs['offset'](_0xd8abb3['query'][_0x5b9d('0x14')]);}_0x132394['order']=qs[_0x5b9d('0x88')](_0xd8abb3[_0x5b9d('0x24')]['sort']);_0x132394['where']=qs[_0x5b9d('0x83')](_[_0x5b9d('0x89')](_0xd8abb3[_0x5b9d('0x24')],_0x814acf[_0x5b9d('0x83')]));_0x132394[_0x5b9d('0x60')][_0x5b9d('0xa1')]=_0x3716c7['id'];if(_0xd8abb3[_0x5b9d('0x24')][_0x5b9d('0xa2')]){_0x132394[_0x5b9d('0x60')]=_[_0x5b9d('0x39')](_0x132394[_0x5b9d('0x60')],{'$or':_[_0x5b9d('0x73')](_0x132394[_0x5b9d('0x85')],function(_0x54f9bd){var _0x111751={};_0x111751[_0x54f9bd]={'$like':'%'+_0xd8abb3[_0x5b9d('0x24')][_0x5b9d('0xa2')]+'%'};return _0x111751;})});}_0x132394=_[_0x5b9d('0x39')]({},_0x132394,_0xd8abb3['options']);return db[_0x5b9d('0x4f')][_0x5b9d('0x16')]({'where':_0x132394[_0x5b9d('0x60')]})['then'](function(_0x25e49e){_0x5078c5[_0x5b9d('0x16')]=_0x25e49e;if(_0xd8abb3['query'][_0x5b9d('0xa5')]){_0x132394[_0x5b9d('0xa3')]=[{'all':!![]}];}return db[_0x5b9d('0x4f')][_0x5b9d('0x23')](_0x132394);})[_0x5b9d('0x1a')](function(_0x2944b1){_0x5078c5[_0x5b9d('0xa6')]=_0x2944b1;return _0x5078c5;});}})['then'](respondWithFilteredResult(_0x211d90,_0x132394))[_0x5b9d('0x26')](handleError(_0x211d90,null));};exports[_0x5b9d('0xa8')]=function(_0x22b0c8,_0x3d4db7){var _0x26e004={'raw':!![],'where':{}};var _0x19ae1e={};var _0x25bae3={'count':0x0,'rows':[]};return db[_0x5b9d('0x28')]['findOne']({'where':{'id':_0x22b0c8['params']['id']}})[_0x5b9d('0x1a')](handleEntityNotFound(_0x3d4db7,null))[_0x5b9d('0x1a')](function(_0x623527){if(_0x623527){_0x19ae1e[_0x5b9d('0x81')]=_[_0x5b9d('0x2c')](db[_0x5b9d('0x57')][_0x5b9d('0x82')]);_0x19ae1e[_0x5b9d('0x24')]=_[_0x5b9d('0x2c')](_0x22b0c8['query']);_0x19ae1e[_0x5b9d('0x83')]=_[_0x5b9d('0x84')](_0x19ae1e['model'],_0x19ae1e[_0x5b9d('0x24')]);_0x26e004[_0x5b9d('0x85')]=_[_0x5b9d('0x84')](_0x19ae1e[_0x5b9d('0x81')],qs[_0x5b9d('0x86')](_0x22b0c8['query']['fields']));_0x26e004['attributes']=_0x26e004[_0x5b9d('0x85')][_0x5b9d('0x2d')]?_0x26e004['attributes']:_0x19ae1e['model'];if(!_0x22b0c8[_0x5b9d('0x24')]['hasOwnProperty']('nolimit')){_0x26e004[_0x5b9d('0x17')]=qs['limit'](_0x22b0c8[_0x5b9d('0x24')][_0x5b9d('0x17')]);_0x26e004[_0x5b9d('0x14')]=qs['offset'](_0x22b0c8[_0x5b9d('0x24')][_0x5b9d('0x14')]);}_0x26e004[_0x5b9d('0x87')]=qs['sort'](_0x22b0c8[_0x5b9d('0x24')][_0x5b9d('0x88')]);_0x26e004['where']=qs['filters'](_[_0x5b9d('0x89')](_0x22b0c8[_0x5b9d('0x24')],_0x19ae1e['filters']));_0x26e004[_0x5b9d('0x60')][_0x5b9d('0xa1')]=_0x623527['id'];if(_0x22b0c8[_0x5b9d('0x24')]['filter']){_0x26e004[_0x5b9d('0x60')]=_[_0x5b9d('0x39')](_0x26e004[_0x5b9d('0x60')],{'$or':_[_0x5b9d('0x73')](_0x26e004[_0x5b9d('0x85')],function(_0x3e9ecb){var _0x5da312={};_0x5da312[_0x3e9ecb]={'$like':'%'+_0x22b0c8[_0x5b9d('0x24')]['filter']+'%'};return _0x5da312;})});}_0x26e004=_['merge']({},_0x26e004,_0x22b0c8[_0x5b9d('0xa9')]);return db[_0x5b9d('0x57')]['count']({'where':_0x26e004[_0x5b9d('0x60')]})[_0x5b9d('0x1a')](function(_0xfb606b){_0x25bae3[_0x5b9d('0x16')]=_0xfb606b;if(_0x22b0c8['query'][_0x5b9d('0xa5')]){_0x26e004['include']=[{'all':!![]}];}return db[_0x5b9d('0x57')][_0x5b9d('0x23')](_0x26e004);})['then'](function(_0xfe39a3){_0x25bae3[_0x5b9d('0xa6')]=_0xfe39a3;return _0x25bae3;});}})[_0x5b9d('0x1a')](respondWithFilteredResult(_0x3d4db7,_0x26e004))[_0x5b9d('0x26')](handleError(_0x3d4db7,null));};exports[_0x5b9d('0xaa')]=function(_0x539899,_0x481505){try{if(!_0x539899[_0x5b9d('0x3a')][_0x5b9d('0x62')]){throw new Error(_0x5b9d('0xab'));}if(!_0x539899[_0x5b9d('0x3a')]['binding_keys']){throw new Error(_0x5b9d('0xac'));}if(!_0x539899[_0x5b9d('0x3a')]['binding_values']){throw new Error(_0x5b9d('0xad'));}if(!_0x539899[_0x5b9d('0x3a')][_0x5b9d('0xae')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x4f3d47=_0x539899[_0x5b9d('0x3a')][_0x5b9d('0xaf')][_0x5b9d('0xb0')](',');var _0xd0375=_0x539899['body'][_0x5b9d('0xb1')]['split'](',');if(!_0x4f3d47[_0x5b9d('0x2d')]||!_0xd0375['length']||_0x4f3d47[_0x5b9d('0x2d')]!==_0xd0375[_0x5b9d('0x2d')]){throw new Error(_0x5b9d('0xb2'));}_0x539899[_0x5b9d('0x3a')]['fields']=_[_0x5b9d('0xb3')](_0x4f3d47,_0xd0375);if(!_0x539899[_0x5b9d('0x3a')][_0x5b9d('0x86')][_0x5b9d('0x7f')]){throw new Error(_0x5b9d('0xb4'));}if(!_0x539899[_0x5b9d('0x3a')][_0x5b9d('0x86')][_0x5b9d('0xb5')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x5d31e0=path[_0x5b9d('0x3d')](config['root'],'server/files/tmp',_0x539899[_0x5b9d('0xb6')][_0x5b9d('0xb7')]);fs[_0x5b9d('0xb8')](_0x5d31e0,parseInt(_0x5b9d('0xb9'),0x8));var _0x1cee3e=require(_0x5b9d('0xba'))[_0x5b9d('0xbb')](path[_0x5b9d('0x3d')](__dirname,_0x5b9d('0xbc')),[_0x5d31e0,_0x539899[_0x5b9d('0x3a')][_0x5b9d('0xaf')],_0x539899['body'][_0x5b9d('0xb1')],_0x539899[_0x5b9d('0x3a')][_0x5b9d('0x62')],_0x539899[_0x5b9d('0x3a')][_0x5b9d('0xbd')],_0x539899[_0x5b9d('0x3a')][_0x5b9d('0x5f')],_0x539899[_0x5b9d('0x3a')][_0x5b9d('0xae')]]);return _0x481505['status'](0xc8)['json']({'message':_0x5b9d('0xbe'),'pid':_0x1cee3e['pid']});}catch(_0x4664ea){return _0x481505[_0x5b9d('0x12')](0x1f4)['send'](_0x4664ea);}};exports[_0x5b9d('0xbf')]=function(_0x2d3f89,_0x29cf2d){var _0x3a1d9e=fs['createReadStream'](_0x2d3f89[_0x5b9d('0xb6')][_0x5b9d('0xc0')]);Papa['parse'](_0x3a1d9e,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2c2410){return _0x29cf2d['status'](0xc8)[_0x5b9d('0x13')]({'file':_0x2d3f89[_0x5b9d('0xb6')],'fields':_0x2c2410[_0x5b9d('0xc1')]['fields']});}});};exports[_0x5b9d('0xc2')]=function(_0x54f031,_0x376b32){return db['User'][_0x5b9d('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0x5b9d('0xc3')}})[_0x5b9d('0x1a')](function(_0x5d21ed){var _0x5bc9cd=![];if(!_0x54f031[_0x5b9d('0x3a')][_0x5b9d('0x62')]){throw new Error(_0x5b9d('0xab'));}if(!_0x54f031[_0x5b9d('0x3a')][_0x5b9d('0xc4')][_0x5b9d('0x7f')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x54f031['body'][_0x5b9d('0xc4')][_0x5b9d('0xb5')]){throw new Error(_0x5b9d('0xc5'));}if(!_0x54f031[_0x5b9d('0x3a')][_0x5b9d('0xae')]){throw new Error(_0x5b9d('0xc6'));}var _0x5c8618=require(_0x5b9d('0xba'))['fork'](path[_0x5b9d('0x3d')](__dirname,_0x5b9d('0xc7')),[_0x54f031[_0x5b9d('0x2a')]['id'],JSON[_0x5b9d('0xc8')](_0x54f031[_0x5b9d('0x3a')]),JSON[_0x5b9d('0xc8')](_0x5d21ed)]);_0x5c8618['on'](_0x5b9d('0xc9'),function(){_0x5bc9cd=!![];return _0x376b32[_0x5b9d('0x12')](0xc8)[_0x5b9d('0x13')]({'message':_0x5b9d('0xca'),'pid':_0x5c8618[_0x5b9d('0xcb')]});});_0x5c8618['on'](_0x5b9d('0xcc'),function(_0x352e64){if(_0x352e64&&!_0x5bc9cd){return _0x376b32['status'](0x1f4)[_0x5b9d('0x13')]({'message':_0x5b9d('0xcd'),'pid':_0x5c8618[_0x5b9d('0xcb')]});}});})[_0x5b9d('0x26')](handleError(_0x376b32,null));};exports[_0x5b9d('0xce')]=function(_0x1e7813,_0x22f353){return db[_0x5b9d('0xcf')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x5b9d('0xc3')}})['then'](function(_0x5182fe){var _0x58db3b=![];if(!_0x1e7813['body'][_0x5b9d('0x62')]){throw new Error('No\x20ListId\x20specified');}if(!_0x1e7813[_0x5b9d('0x3a')][_0x5b9d('0xc4')][_0x5b9d('0x7f')]){throw new Error(_0x5b9d('0xb4'));}if(!_0x1e7813[_0x5b9d('0x3a')][_0x5b9d('0xc4')][_0x5b9d('0xb5')]){throw new Error(_0x5b9d('0xc5'));}if(!_0x1e7813[_0x5b9d('0x3a')]['socket_timestamp']){throw new Error(_0x5b9d('0xc6'));}var _0x4e92f0=require('child_process')['fork'](path[_0x5b9d('0x3d')](__dirname,'../../components/import/cm/csvUpdates'),[_0x1e7813[_0x5b9d('0x2a')]['id'],JSON[_0x5b9d('0xc8')](_0x1e7813['body']),JSON[_0x5b9d('0xc8')](_0x5182fe)]);_0x4e92f0['on'](_0x5b9d('0xc9'),function(){_0x58db3b=!![];return _0x22f353[_0x5b9d('0x12')](0xc8)[_0x5b9d('0x13')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x4e92f0[_0x5b9d('0xcb')]});});_0x4e92f0['on']('exit',function(_0x4034a1){if(_0x4034a1&&!_0x58db3b){return _0x22f353[_0x5b9d('0x12')](0x1f4)[_0x5b9d('0x13')]({'message':_0x5b9d('0xcd'),'pid':_0x4e92f0[_0x5b9d('0xcb')]});}});})[_0x5b9d('0x26')](handleError(_0x22f353,null));};exports[_0x5b9d('0xd0')]=function(_0x55729d,_0x498916){var _0x40c4da=[_0x5b9d('0xd1'),'chat','sms','openchannel','fax',_0x5b9d('0xd2'),_0x5b9d('0xd3')];var _0x6e8f26={'offset':0x0,'order':qs[_0x5b9d('0x88')](_0x5b9d('0xd4'))},_0x5429dc={'count':0x0,'rows':[]};Promise['resolve']()[_0x5b9d('0x1a')](function(){if(_0x55729d[_0x5b9d('0x24')][_0x5b9d('0xd5')]){if(!_[_0x5b9d('0xd6')](_0x40c4da,_0x55729d[_0x5b9d('0x24')][_0x5b9d('0xd5')][_0x5b9d('0xd7')]())){throw new Error(_0x5b9d('0xd8'));}_0x40c4da=[_0x55729d[_0x5b9d('0x24')][_0x5b9d('0xd5')][_0x5b9d('0xd7')]()];}if(_0x55729d[_0x5b9d('0x24')][_0x5b9d('0xd9')]){try{var _0x519a82=JSON[_0x5b9d('0xda')](_0x55729d[_0x5b9d('0x24')][_0x5b9d('0xd9')]);if(!moment(_0x519a82[_0x5b9d('0x3f')])['isValid']()){throw new Error(_0x5b9d('0xdb'));}if(!moment(_0x519a82['to'])[_0x5b9d('0xdc')]()){throw new Error(_0x5b9d('0xdd'));}}catch(_0x4f0972){throw new Error(_0x5b9d('0xde'));}}if(!_0x55729d['query'][_0x5b9d('0x38')](_0x5b9d('0x8a'))){_0x6e8f26[_0x5b9d('0x17')]=qs['limit'](_0x55729d[_0x5b9d('0x24')]['limit']||0xa);_0x6e8f26[_0x5b9d('0x14')]=qs['offset'](_0x55729d[_0x5b9d('0x24')][_0x5b9d('0x14')]);}var _0x248f72=_0x40c4da[_0x5b9d('0x73')](function(_0x216e87){if(_0x216e87===_0x5b9d('0xd3')){var _0x2ed6c0={'attributes':['id','uniqueid','type',_0x5b9d('0xdf'),_0x5b9d('0xe0'),_0x5b9d('0xe1'),_0x5b9d('0xe2'),'endtime','duration',_0x5b9d('0xe3'),'createdAt','userDisposition',_0x5b9d('0xe4'),_0x5b9d('0xe5'),_0x5b9d('0xe6')],'where':{'ContactId':_0x55729d['params']['id']},'include':[{'model':db['User'],'as':_0x5b9d('0xcf'),'attributes':['id',_0x5b9d('0x1e'),_0x5b9d('0xe7'),'alias']}],'order':[[_0x5b9d('0xe8'),_0x5b9d('0xe9')]]};if(_0x55729d['query'][_0x5b9d('0xd9')]){_0x2ed6c0[_0x5b9d('0x60')][_0x5b9d('0xe8')]={'$gte':_0x519a82['from'],'$lte':_0x519a82['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x2ed6c0)['then'](function(_0x47b154){_0x5429dc['count']+=_0x47b154[_0x5b9d('0x16')];return _['map'](_0x47b154['rows'],function(_0x5d316d){var _0x2a232e=_0x5d316d[_0x5b9d('0x3b')]({'plain':!![]});_0x2a232e[_0x5b9d('0xd5')]=_0x216e87;if(_0x2a232e[_0x5b9d('0xcf')]){_0x2a232e[_0x5b9d('0xcf')]={'id':_0x2a232e[_0x5b9d('0xcf')]['id'],'name':_0x2a232e[_0x5b9d('0xcf')][_0x5b9d('0x1e')],'fullname':_0x2a232e[_0x5b9d('0xcf')][_0x5b9d('0xe7')],'alias':_0x2a232e['User']['alias']};}return _0x2a232e;});});}else{var _0x2c4e50=_[_0x5b9d('0xea')](_0x216e87)+(_0x216e87===_0x5b9d('0xeb')?_0x5b9d('0xec'):'Account');var _0x20ff03={'attributes':['id',_0x5b9d('0xed'),_0x5b9d('0xee'),_0x5b9d('0xe8'),_0x5b9d('0xe3'),_0x5b9d('0xef'),_0x5b9d('0xf0'),_0x5b9d('0xf1'),_0x5b9d('0xe6'),_0x2c4e50+'Id'],'where':{'ContactId':_0x55729d[_0x5b9d('0x2a')]['id']},'include':[{'model':db[_0x2c4e50],'as':'Account','attributes':['id','name',_0x5b9d('0xf2')]},{'model':db['User'],'as':_0x5b9d('0xf3'),'attributes':['id','name',_0x5b9d('0xe7')]},{'model':db[_0x5b9d('0x68')],'as':_0x5b9d('0x69'),'attributes':['id',_0x5b9d('0x1e'),_0x5b9d('0x6a')],'through':{'attributes':[]}}],'order':[[_0x5b9d('0xe8'),_0x5b9d('0xe9')]]};if(_0x55729d['query'][_0x5b9d('0xd9')]){_0x20ff03[_0x5b9d('0x60')][_0x5b9d('0xe8')]={'$gte':_0x519a82['from'],'$lte':_0x519a82['to']};}switch(_0x216e87){case _0x5b9d('0xeb'):_0x20ff03[_0x5b9d('0x85')]['push'](_0x5b9d('0xf4'),_0x5b9d('0xf5'),'customerPort','deviceModel',_0x5b9d('0xf6'),_0x5b9d('0xf7'),_0x5b9d('0xf8'),_0x5b9d('0xf9'),'referer');break;case'mail':_0x20ff03[_0x5b9d('0x85')][_0x5b9d('0x61')](_0x5b9d('0xfa'),_0x5b9d('0xfb'));break;case _0x5b9d('0xfc'):_0x20ff03[_0x5b9d('0x85')][_0x5b9d('0x61')]('externalUrl',_0x5b9d('0xfd'));break;}return db[_[_0x5b9d('0xea')](_0x216e87)+_0x5b9d('0xfe')]['findAndCountAll'](_0x20ff03)[_0x5b9d('0x1a')](function(_0x5e19f2){_0x5429dc[_0x5b9d('0x16')]+=_0x5e19f2['count'];return _[_0x5b9d('0x73')](_0x5e19f2[_0x5b9d('0xa6')],function(_0x303a18){var _0x2ec2ab=_0x303a18['get']({'plain':!![]});_0x2ec2ab[_0x5b9d('0xd5')]=_0x216e87;if(_0x2ec2ab[_0x5b9d('0xf3')]){_0x2ec2ab['Owner']={'id':_0x2ec2ab[_0x5b9d('0xf3')]['id'],'name':_0x2ec2ab[_0x5b9d('0xf3')][_0x5b9d('0x1e')],'fullname':_0x2ec2ab[_0x5b9d('0xf3')]['fullname']};}return _0x2ec2ab;});});}});return Promise[_0x5b9d('0x66')](_0x248f72);})[_0x5b9d('0x1a')](function(_0x4d1637){return _(_0x4d1637)[_0x5b9d('0xff')]()[_0x5b9d('0x100')](_0x5b9d('0xe8'))[_0x5b9d('0x101')]()[_0x5b9d('0x102')]();})[_0x5b9d('0x1a')](function(_0xe8b247){_0x5429dc['rows']=_0x6e8f26[_0x5b9d('0x17')]?_0xe8b247['slice'](_0x6e8f26['offset'],_0x6e8f26[_0x5b9d('0x14')]+_0x6e8f26[_0x5b9d('0x17')]):_0xe8b247;return _0x5429dc;})['then'](respondWithFilteredResult(_0x498916,_0x6e8f26))[_0x5b9d('0x26')](handleError(_0x498916,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 0a8b5f5..4b2132c 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 _0x7bd8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','CmContact'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7bd8,0x127));var _0x87bd=function(_0x83f1f,_0x42d753){_0x83f1f=_0x83f1f-0x0;var _0x37234e=_0x7bd8[_0x83f1f];return _0x37234e;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db'][_0x87bd('0x0')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x87bd('0x1')](0x0);var events={'afterCreate':_0x87bd('0x2'),'afterUpdate':_0x87bd('0x3'),'afterDestroy':_0x87bd('0x4')};function emitEvent(_0x4a1713){return function(_0x59d8ec,_0x224860,_0x3accb3){CmContactEvents[_0x87bd('0x5')](_0x4a1713+':'+_0x59d8ec['id'],_0x59d8ec);CmContactEvents['emit'](_0x4a1713,_0x59d8ec);_0x3accb3(null);};}for(var e in events){if(events[_0x87bd('0x6')](e)){var event=events[e];CmContact[_0x87bd('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x5845=['events','../../mysqldb','CmContact','setMaxListeners','remove','emit','hasOwnProperty','exports'];(function(_0xbd4278,_0x3209fd){var _0x8b0d36=function(_0x5a2db7){while(--_0x5a2db7){_0xbd4278['push'](_0xbd4278['shift']());}};_0x8b0d36(++_0x3209fd);}(_0x5845,0x80));var _0x5584=function(_0x2b963b,_0x55f37e){_0x2b963b=_0x2b963b-0x0;var _0x525a7e=_0x5845[_0x2b963b];return _0x525a7e;};'use strict';var EventEmitter=require(_0x5584('0x0'));var CmContact=require(_0x5584('0x1'))['db'][_0x5584('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x5584('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5584('0x4')};function emitEvent(_0x557e4a){return function(_0x1f37e8,_0x491345,_0x3eb0dc){CmContactEvents['emit'](_0x557e4a+':'+_0x1f37e8['id'],_0x1f37e8);CmContactEvents[_0x5584('0x5')](_0x557e4a,_0x1f37e8);_0x3eb0dc(null);};}for(var e in events){if(events[_0x5584('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x5584('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index c09533e..9e1791c 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 _0x64d1=['utcOffset','format','ret','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','priority','callbackUniqueid','catch','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','afterCreate','Campaign','add','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','create','findAll','outbound','dialCheckDuplicateType','CmList','always','onlyIfOpen','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Lists','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','api','bluebird','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','timezones'];(function(_0x3b6a06,_0x5bae73){var _0x56dbba=function(_0x463ab6){while(--_0x463ab6){_0x3b6a06['push'](_0x3b6a06['shift']());}};_0x56dbba(++_0x5bae73);}(_0x64d1,0x153));var _0x164d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x64d1[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x164d('0x0'));var logger=require('../../config/logger')(_0x164d('0x1'));var moment=require('moment');var BPromise=require(_0x164d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x164d('0x3'));var rimraf=require(_0x164d('0x4'));var config=require('../../config/environment');var shared=require(_0x164d('0x5'));var attributes=require(_0x164d('0x6'));module[_0x164d('0x7')]=function(_0x18e2b4,_0xd98574){return _0x18e2b4['define'](_0x164d('0x8'),attributes,{'tableName':_0x164d('0x9'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x164d('0xa')]},{'name':_0x164d('0xb'),'fields':[_0x164d('0xc'),_0x164d('0xd'),_0x164d('0xa'),_0x164d('0xe'),_0x164d('0xf'),_0x164d('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x164d('0x11'),'collate':_0x164d('0x12'),'hooks':{'afterCreate':function(_0x3e1ac0,_0x3cce1d,_0x33a144){var _0xf6a1f6=_0x18e2b4[_0x164d('0x13')];var _0x23d7bb=_0x3e1ac0[_0x164d('0x14')]({'plain':!![]});function _0xf11426(){return function(_0x4e35fe){logger[_0x164d('0x15')](_0x164d('0x16'),'afterCreate',util[_0x164d('0x17')](_0x4e35fe,{'showHidden':![],'depth':null}));};}function _0x344835(_0x1f05f,_0x4c983a){var _0x4c974a=_0x4c983a[_0x164d('0x18')]?_0x4c983a[_0x164d('0x18')]:moment()['format'](_0x164d('0x19'));return new BPromise(function(_0x45a92a,_0x596f54){if(_[_0x164d('0x1a')](_0x4c983a[_0x164d('0x1b')])){_0x45a92a({'ret':_0x4c974a});}else{_0xf6a1f6[_0x164d('0x1c')]['findOne']({'where':{'id':_0x1f05f['id']}})[_0x164d('0x1d')](function(_0x2402c7){if(!_[_0x164d('0x1a')](_0x2402c7)){var _0x7848bf=_0x2402c7[_0x164d('0x1b')];if(!_[_0x164d('0x1a')](_0x7848bf)){var _0x9cb9d2=shared[_0x164d('0x1e')];var _0x171825=_0x9cb9d2[_0x7848bf];var _0x3eb6a3=_0x9cb9d2[_0x4c983a[_0x164d('0x1b')]];if(!_[_0x164d('0x1a')](_0x171825)&&!_[_0x164d('0x1a')](_0x3eb6a3)){var _0x5f3ab6=_0x171825[_0x164d('0x1f')]-_0x3eb6a3['utcOffset'];_0x4c974a=_0x4c983a['scheduledat']?_0x4c983a['scheduledat']:moment();var _0x5d9fc6=moment(_0x4c974a)['add'](_0x5f3ab6,'minutes');_0x45a92a({'ret':_0x5d9fc6[_0x164d('0x20')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x45a92a({'ret':_0x4c974a});}else _0x45a92a({'ret':_0x4c974a});}else{_0x45a92a({'ret':_0x4c974a});}});}});return 0xa;}var _0x30fac7=function(_0x3702df){return new BPromise(function(_0x3b0c7d,_0x158b5f){_0x344835(_0x3702df,_0x23d7bb)['then'](function(_0x3602e2){_0x23d7bb[_0x164d('0x18')]=_0x3602e2[_0x164d('0x21')];_0xf6a1f6['CmHopper'][_0x164d('0x22')]({'where':{'phone':_0x23d7bb[_0x164d('0xa')],'VoiceQueueId':_0x3702df['id']}})[_0x164d('0x1d')](function(_0x407c62){if(!_[_0x164d('0x1a')](_0x407c62)){throw new Error(_0x164d('0x23')+_0x23d7bb['phone']+_0x164d('0x24')+_0x3702df['id']);}return _0xf6a1f6['CmHopper']['create']({'phone':_0x23d7bb[_0x164d('0xa')],'ContactId':_0x23d7bb['id'],'ListId':_0x23d7bb['ListId'],'priority':_0x23d7bb[_0x164d('0x25')]?_0x23d7bb[_0x164d('0x25')]:0x2,'scheduledat':_0x23d7bb[_0x164d('0x18')]?_0x23d7bb['scheduledat']:moment()[_0x164d('0x20')](_0x164d('0x19')),'callback':_0x23d7bb[_0x164d('0x26')]?!![]:![],'callbackuniqueid':_0x23d7bb[_0x164d('0x26')]?_0x23d7bb['callbackUniqueid']:undefined,'callbackat':_0x23d7bb[_0x164d('0x26')]?moment()[_0x164d('0x20')](_0x164d('0x19')):undefined,'VoiceQueueId':_0x3702df['id']});})[_0x164d('0x27')](function(_0x35fb16){_0x158b5f(_0x35fb16);});});});};var _0x2b1009=function(_0x5f5be2){return new BPromise(function(_0xbf25e5,_0x5eba6d){_0x344835(_0x5f5be2,_0x23d7bb)['then'](function(_0x57cdaf){_0x23d7bb[_0x164d('0x18')]=_0x57cdaf[_0x164d('0x21')];_0xf6a1f6[_0x164d('0x28')][_0x164d('0x22')]({'where':{'phone':_0x23d7bb[_0x164d('0xa')],'VoiceQueueId':_0x5f5be2['id']}})['then'](function(_0x2c273d){if(!_[_0x164d('0x1a')](_0x2c273d)){throw new Error(_0x164d('0x23')+_0x23d7bb[_0x164d('0xa')]+_0x164d('0x29')+_0x5f5be2['id']);}return _0xf6a1f6['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x23d7bb[_0x164d('0xa')],'VoiceQueueId':_0x5f5be2['id']}});})['then'](function(_0x32ceff){if(!_[_0x164d('0x1a')](_0x32ceff)){throw new Error(_0x164d('0x2a')+_0x23d7bb[_0x164d('0xa')]+_0x164d('0x2b')+_0x5f5be2['id']);}return _0xf6a1f6[_0x164d('0x28')]['create']({'phone':_0x23d7bb[_0x164d('0xa')],'ContactId':_0x23d7bb['id'],'ListId':_0x23d7bb[_0x164d('0x2c')],'priority':_0x23d7bb[_0x164d('0x25')]?_0x23d7bb[_0x164d('0x25')]:0x2,'scheduledat':_0x23d7bb['scheduledat']?_0x23d7bb[_0x164d('0x18')]:moment()['format'](_0x164d('0x19')),'callback':_0x23d7bb[_0x164d('0x26')]?!![]:![],'callbackuniqueid':_0x23d7bb[_0x164d('0x26')]?_0x23d7bb[_0x164d('0x26')]:undefined,'callbackat':_0x23d7bb[_0x164d('0x26')]?moment()[_0x164d('0x20')](_0x164d('0x19')):undefined,'VoiceQueueId':_0x5f5be2['id']});})[_0x164d('0x27')](function(_0x2481be){_0x5eba6d(_0x2481be);});});});};function _0x25be8a(){return function(_0x2293cf){logger[_0x164d('0x15')]('cmContact',_0x164d('0x2d'),util[_0x164d('0x17')](_0x2293cf,{'showHidden':![],'depth':null}));};}function _0x528338(_0x12fbae,_0x52af53){var _0x475d29=_0x52af53['scheduledat']?_0x52af53[_0x164d('0x18')]:moment()['format'](_0x164d('0x19'));return new BPromise(function(_0x32ce56,_0x35ab02){if(_[_0x164d('0x1a')](_0x52af53[_0x164d('0x1b')])){_0x32ce56({'ret':_0x475d29});}else{_0xf6a1f6[_0x164d('0x2e')]['findOne']({'where':{'id':_0x12fbae['id']}})[_0x164d('0x1d')](function(_0x10be68){if(!_[_0x164d('0x1a')](_0x10be68)){var _0x180664=_0x10be68['dialTimezone'];if(!_[_0x164d('0x1a')](_0x180664)){var _0x599388=shared[_0x164d('0x1e')];var _0x4c7e21=_0x599388[_0x180664];var _0x4180b4=_0x599388[_0x52af53[_0x164d('0x1b')]];if(!_[_0x164d('0x1a')](_0x4c7e21)&&!_[_0x164d('0x1a')](_0x4180b4)){var _0x2fa9df=_0x4c7e21[_0x164d('0x1f')]-_0x4180b4[_0x164d('0x1f')];_0x475d29=_0x52af53[_0x164d('0x18')]?_0x52af53[_0x164d('0x18')]:moment();var _0x568502=moment(_0x475d29)[_0x164d('0x2f')](_0x2fa9df,_0x164d('0x30'));_0x32ce56({'ret':_0x568502['format'](_0x164d('0x19'))});}else _0x32ce56({'ret':_0x475d29});}else _0x32ce56({'ret':_0x475d29});}else{_0x32ce56({'ret':_0x475d29});}});}});return 0xa;}var _0x34b7b2=function(_0x13c6ca){return new BPromise(function(_0x42c62d,_0x221ced){_0x528338(_0x13c6ca,_0x23d7bb)['then'](function(_0x3df70b){_0x23d7bb['scheduledat']=_0x3df70b[_0x164d('0x21')];_0xf6a1f6[_0x164d('0x28')]['findOne']({'where':{'phone':_0x23d7bb[_0x164d('0xa')],'CampaignId':_0x13c6ca['id']}})[_0x164d('0x1d')](function(_0x5f7e2c){if(!_['isNil'](_0x5f7e2c)){throw new Error('cmContact,\x20afterCreate\x20'+_0x23d7bb['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x13c6ca['id']);}return _0xf6a1f6['CmHopper']['create']({'phone':_0x23d7bb[_0x164d('0xa')],'ContactId':_0x23d7bb['id'],'ListId':_0x23d7bb[_0x164d('0x2c')],'priority':_0x23d7bb[_0x164d('0x25')]?_0x23d7bb[_0x164d('0x25')]:0x2,'scheduledat':_0x23d7bb[_0x164d('0x18')]?_0x23d7bb[_0x164d('0x18')]:moment()[_0x164d('0x20')](_0x164d('0x19')),'callback':_0x23d7bb[_0x164d('0x26')]?!![]:![],'callbackuniqueid':_0x23d7bb['callbackUniqueid']?_0x23d7bb[_0x164d('0x26')]:undefined,'callbackat':_0x23d7bb[_0x164d('0x26')]?moment()[_0x164d('0x20')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x13c6ca['id']});})[_0x164d('0x27')](function(_0x129fdf){_0x221ced(_0x129fdf);});});});};var _0x155a8c=function(_0x19b3c3){return new BPromise(function(_0x34e569,_0x36156c){_0x528338(_0x19b3c3,_0x23d7bb)['then'](function(_0x3b4bbe){_0x23d7bb[_0x164d('0x18')]=_0x3b4bbe[_0x164d('0x21')];_0xf6a1f6[_0x164d('0x28')][_0x164d('0x22')]({'where':{'phone':_0x23d7bb[_0x164d('0xa')],'CampaignId':_0x19b3c3['id']}})[_0x164d('0x1d')](function(_0x3b133a){if(!_['isNil'](_0x3b133a)){throw new Error('cmContact,\x20afterCreate\x20'+_0x23d7bb[_0x164d('0xa')]+_0x164d('0x31')+_0x19b3c3['id']);}return _0xf6a1f6['CmHopperFinal'][_0x164d('0x22')]({'where':{'calleridnum':_0x23d7bb[_0x164d('0xa')],'CampaignId':_0x19b3c3['id']}});})[_0x164d('0x1d')](function(_0x199039){if(!_['isNil'](_0x199039)){throw new Error(_0x164d('0x2a')+_0x23d7bb[_0x164d('0xa')]+_0x164d('0x32')+_0x19b3c3['id']);}return _0xf6a1f6[_0x164d('0x28')][_0x164d('0x33')]({'phone':_0x23d7bb[_0x164d('0xa')],'ContactId':_0x23d7bb['id'],'ListId':_0x23d7bb[_0x164d('0x2c')],'priority':_0x23d7bb['priority']?_0x23d7bb[_0x164d('0x25')]:0x2,'scheduledat':_0x23d7bb[_0x164d('0x18')]?_0x23d7bb['scheduledat']:moment()[_0x164d('0x20')](_0x164d('0x19')),'callback':_0x23d7bb['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x23d7bb[_0x164d('0x26')]?_0x23d7bb[_0x164d('0x26')]:undefined,'callbackat':_0x23d7bb[_0x164d('0x26')]?moment()[_0x164d('0x20')](_0x164d('0x19')):undefined,'CampaignId':_0x19b3c3['id']});})['catch'](function(_0x5a8b4d){_0x36156c(_0x5a8b4d);});});});};if(_0x23d7bb['ListId']){_0xf6a1f6['VoiceQueue'][_0x164d('0x34')]({'where':{'type':_0x164d('0x35')},'attributes':['id',_0x164d('0x36'),_0x164d('0x1b')],'include':[{'model':_0xf6a1f6[_0x164d('0x37')],'as':'Lists','where':{'id':_0x23d7bb[_0x164d('0x2c')]}}]})[_0x164d('0x1d')](function(_0x1bf962){if(_0x1bf962){var _0x493b3f=[];for(var _0x4c3adb=0x0,_0x4f9ae4;_0x4c3adb<_0x1bf962['length'];_0x4c3adb+=0x1){_0x4f9ae4=_0x1bf962[_0x4c3adb][_0x164d('0x14')]({'plain':!![]});switch(_0x4f9ae4[_0x164d('0x36')]){case _0x164d('0x38'):_0x2b1009(_0x4f9ae4)[_0x164d('0x27')](_0xf11426());break;case _0x164d('0x39'):_0x30fac7(_0x4f9ae4)['catch'](_0xf11426());break;default:_0x528338(_0x4f9ae4,_0x23d7bb)[_0x164d('0x1d')](function(_0x23d8fd){_0x23d7bb[_0x164d('0x18')]=_0x23d8fd['ret'];_0xf6a1f6['CmHopper']['create']({'phone':_0x23d7bb[_0x164d('0xa')],'ContactId':_0x23d7bb['id'],'ListId':_0x23d7bb['ListId'],'scheduledat':_0x23d7bb['scheduledat']?_0x23d7bb[_0x164d('0x18')]:moment()[_0x164d('0x20')](_0x164d('0x19')),'priority':_0x23d7bb[_0x164d('0x25')]?_0x23d7bb[_0x164d('0x25')]:0x2,'callback':_0x23d7bb[_0x164d('0x26')]?!![]:![],'callbackuniqueid':_0x23d7bb['callbackUniqueid']?_0x23d7bb[_0x164d('0x26')]:undefined,'callbackat':_0x23d7bb[_0x164d('0x26')]?moment()[_0x164d('0x20')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4f9ae4['id']})[_0x164d('0x27')](_0xf11426());});}}}})[_0x164d('0x1d')](function(){return _0xf6a1f6['VoiceQueue'][_0x164d('0x34')]({'where':{'type':_0x164d('0x35')},'attributes':['id'],'include':[{'model':_0xf6a1f6[_0x164d('0x37')],'as':_0x164d('0x3a'),'where':{'id':_0x23d7bb['ListId']}}]})[_0x164d('0x1d')](function(_0x4eeeb5){if(_0x4eeeb5){var _0x3f7e1f=[];for(var _0x1ffe18=0x0,_0x26fc8e;_0x1ffe18<_0x4eeeb5[_0x164d('0x3b')];_0x1ffe18+=0x1){_0x26fc8e=_0x4eeeb5[_0x1ffe18][_0x164d('0x14')]({'plain':!![]});_0xf6a1f6[_0x164d('0x3c')][_0x164d('0x33')]({'phone':_0x23d7bb[_0x164d('0xa')],'ContactId':_0x23d7bb['id'],'ListId':_0x23d7bb[_0x164d('0x2c')],'VoiceQueueId':_0x26fc8e['id']})[_0x164d('0x27')](function(_0x421d39){logger[_0x164d('0x15')](_0x164d('0x3d'),_0x164d('0x2d'),_0x421d39[_0x164d('0x3e')]);});}}});})[_0x164d('0x1d')](function(){return _0xf6a1f6['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType',_0x164d('0x1b')],'include':[{'model':_0xf6a1f6[_0x164d('0x37')],'as':_0x164d('0x3f'),'where':{'id':_0x23d7bb['ListId']}}]})[_0x164d('0x1d')](function(_0x55d0c5){if(_0x55d0c5){var _0x6d03c1=[];for(var _0x4657ad=0x0,_0x389f3c;_0x4657ad<_0x55d0c5[_0x164d('0x3b')];_0x4657ad+=0x1){_0x389f3c=_0x55d0c5[_0x4657ad][_0x164d('0x14')]({'plain':!![]});switch(_0x389f3c[_0x164d('0x36')]){case'always':_0x155a8c(_0x389f3c)['catch'](_0x25be8a());break;case'onlyIfOpen':_0x34b7b2(_0x389f3c)[_0x164d('0x27')](_0x25be8a());break;default:_0xf6a1f6[_0x164d('0x28')][_0x164d('0x33')]({'phone':_0x23d7bb[_0x164d('0xa')],'ContactId':_0x23d7bb['id'],'ListId':_0x23d7bb['ListId'],'scheduledat':_0x23d7bb[_0x164d('0x18')]?_0x23d7bb[_0x164d('0x18')]:moment()[_0x164d('0x20')](_0x164d('0x19')),'priority':_0x23d7bb['priority']?_0x23d7bb[_0x164d('0x25')]:0x2,'callback':_0x23d7bb['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x23d7bb[_0x164d('0x26')]?_0x23d7bb['callbackUniqueid']:undefined,'callbackat':_0x23d7bb[_0x164d('0x26')]?moment()[_0x164d('0x20')](_0x164d('0x19')):undefined,'CampaignId':_0x389f3c['id']})[_0x164d('0x27')](_0x25be8a());}}}});})[_0x164d('0x1d')](function(){return _0xf6a1f6[_0x164d('0x2e')]['findAll']({'attributes':['id'],'include':[{'model':_0xf6a1f6['CmList'],'as':'BlackLists','where':{'id':_0x23d7bb[_0x164d('0x2c')]}}]})['then'](function(_0x1f7e6e){if(_0x1f7e6e){var _0x452bdd=[];for(var _0x1bb1af=0x0,_0x30faa9;_0x1bb1af<_0x1f7e6e[_0x164d('0x3b')];_0x1bb1af+=0x1){_0x30faa9=_0x1f7e6e[_0x1bb1af][_0x164d('0x14')]({'plain':!![]});_0xf6a1f6[_0x164d('0x3c')][_0x164d('0x33')]({'phone':_0x23d7bb['phone'],'ContactId':_0x23d7bb['id'],'ListId':_0x23d7bb[_0x164d('0x2c')],'CampaignId':_0x30faa9['id']})[_0x164d('0x27')](function(_0x4a3e7d){logger['error'](_0x164d('0x3d'),'afterCreate',_0x4a3e7d[_0x164d('0x3e')]);});}}});})['then'](function(){_0x33a144();})[_0x164d('0x27')](function(_0x5f1cc8){logger[_0x164d('0x15')](_0x164d('0x3d'),_0x164d('0x2d'),_0x5f1cc8[_0x164d('0x3e')]);_0x33a144(_0x5f1cc8);});}else{_0x33a144(new Error(_0x164d('0x40')));}},'afterDestroy':function(_0x1ad683,_0x4ff81e,_0x4810f3){var _0x1e863c=_0x18e2b4['models'];var _0x16e43a=_0x1ad683[_0x164d('0x14')]({'plain':!![]});return _0x1e863c[_0x164d('0x28')][_0x164d('0x34')]({'raw':!![],'where':{'ListId':_0x16e43a[_0x164d('0x2c')],'ContactId':_0x16e43a['id']}})[_0x164d('0x1d')](function(_0x277192){if(!_[_0x164d('0x41')](_0x277192)){var _0x8d7d92=[];for(var _0x3d1602=0x0;_0x3d1602<_0x277192[_0x164d('0x3b')];_0x3d1602+=0x1){var _0x29f0bb=_0x1e863c[_0x164d('0x28')][_0x164d('0x42')]({'where':{'ListId':_0x277192[_0x3d1602]['ListId'],'ContactId':_0x277192[_0x3d1602][_0x164d('0x43')],'VoiceQueueId':_0x277192[_0x3d1602][_0x164d('0x44')],'CampaignId':_0x277192[_0x3d1602]['CampaignId']}});_0x8d7d92[_0x164d('0x45')](_0x29f0bb);}return BPromise[_0x164d('0x46')](_0x8d7d92);}})[_0x164d('0x1d')](function(_0x1a91a8){logger[_0x164d('0x47')](_0x164d('0x48'),util[_0x164d('0x17')](_0x1a91a8,{'showHidden':![],'depth':null}));_0x4810f3();})[_0x164d('0x27')](function(_0x567420){logger[_0x164d('0x15')](_0x164d('0x49'),util[_0x164d('0x17')](_0x567420,{'showHidden':![],'depth':null}));_0x4810f3(_0x567420);});}}});}; \ No newline at end of file +var _0xc46c=['VoiceQueue','timezones','utcOffset','add','minutes','then','ret','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','cmContact','Campaign','\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','findAll','outbound','CmList','Lists','length','dialCheckDuplicateType','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','always','message','List\x20not\x20found','destroy','ContactId','VoiceQueueId','CampaignId','push','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','api','moment','bluebird','path','rimraf','./cmContact.attributes','exports','cm_contacts','phone','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone'];(function(_0x477ad4,_0x1dd9b5){var _0x533db7=function(_0x2f2dff){while(--_0x2f2dff){_0x477ad4['push'](_0x477ad4['shift']());}};_0x533db7(++_0x1dd9b5);}(_0xc46c,0x73));var _0xcc46=function(_0x5c811c,_0x313b25){_0x5c811c=_0x5c811c-0x0;var _0x5df3af=_0xc46c[_0x5c811c];return _0x5df3af;};'use strict';var _=require(_0xcc46('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcc46('0x1'));var moment=require(_0xcc46('0x2'));var BPromise=require(_0xcc46('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc46('0x4'));var rimraf=require(_0xcc46('0x5'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require(_0xcc46('0x6'));module[_0xcc46('0x7')]=function(_0x30b322,_0x3abdf3){return _0x30b322['define']('CmContact',attributes,{'tableName':_0xcc46('0x8'),'paranoid':!![],'indexes':[{'name':_0xcc46('0x9'),'fields':[_0xcc46('0x9')]},{'name':'fti_cm_contacts','fields':[_0xcc46('0xa'),_0xcc46('0xb'),_0xcc46('0x9'),_0xcc46('0xc'),_0xcc46('0xd'),'email'],'type':_0xcc46('0xe')}],'timestamps':!![],'charset':_0xcc46('0xf'),'collate':_0xcc46('0x10'),'hooks':{'afterCreate':function(_0x7999fb,_0x4861f5,_0xf5dec5){var _0x4cfa12=_0x30b322[_0xcc46('0x11')];var _0x326f4e=_0x7999fb[_0xcc46('0x12')]({'plain':!![]});function _0x70d159(){return function(_0x1d9bd0){logger[_0xcc46('0x13')]('cmContact',_0xcc46('0x14'),util[_0xcc46('0x15')](_0x1d9bd0,{'showHidden':![],'depth':null}));};}function _0x1a50e5(_0x162e97,_0x2d34bc){var _0x23a86f=_0x2d34bc[_0xcc46('0x16')]?_0x2d34bc[_0xcc46('0x16')]:moment()[_0xcc46('0x17')](_0xcc46('0x18'));return new BPromise(function(_0x3cb5a9,_0x3cf59d){if(_[_0xcc46('0x19')](_0x2d34bc[_0xcc46('0x1a')])){_0x3cb5a9({'ret':_0x23a86f});}else{_0x4cfa12[_0xcc46('0x1b')]['findOne']({'where':{'id':_0x162e97['id']}})['then'](function(_0x37d5e5){if(!_[_0xcc46('0x19')](_0x37d5e5)){var _0xe91a3d=_0x37d5e5[_0xcc46('0x1a')];if(!_[_0xcc46('0x19')](_0xe91a3d)){var _0xc36834=shared[_0xcc46('0x1c')];var _0x3b8245=_0xc36834[_0xe91a3d];var _0x48abe7=_0xc36834[_0x2d34bc[_0xcc46('0x1a')]];if(!_['isNil'](_0x3b8245)&&!_['isNil'](_0x48abe7)){var _0x472eb6=_0x3b8245['utcOffset']-_0x48abe7[_0xcc46('0x1d')];_0x23a86f=_0x2d34bc[_0xcc46('0x16')]?_0x2d34bc['scheduledat']:moment();var _0x2e91b6=moment(_0x23a86f)[_0xcc46('0x1e')](_0x472eb6,_0xcc46('0x1f'));_0x3cb5a9({'ret':_0x2e91b6['format'](_0xcc46('0x18'))});}else _0x3cb5a9({'ret':_0x23a86f});}else _0x3cb5a9({'ret':_0x23a86f});}else{_0x3cb5a9({'ret':_0x23a86f});}});}});return 0xa;}var _0x18770d=function(_0x45af8b){return new BPromise(function(_0x423b1f,_0x1dde77){_0x1a50e5(_0x45af8b,_0x326f4e)[_0xcc46('0x20')](function(_0x35b799){_0x326f4e[_0xcc46('0x16')]=_0x35b799[_0xcc46('0x21')];_0x4cfa12[_0xcc46('0x22')][_0xcc46('0x23')]({'where':{'phone':_0x326f4e[_0xcc46('0x9')],'VoiceQueueId':_0x45af8b['id']}})[_0xcc46('0x20')](function(_0x510a54){if(!_[_0xcc46('0x19')](_0x510a54)){throw new Error(_0xcc46('0x24')+_0x326f4e[_0xcc46('0x9')]+_0xcc46('0x25')+_0x45af8b['id']);}return _0x4cfa12[_0xcc46('0x22')][_0xcc46('0x26')]({'phone':_0x326f4e[_0xcc46('0x9')],'ContactId':_0x326f4e['id'],'ListId':_0x326f4e[_0xcc46('0x27')],'priority':_0x326f4e[_0xcc46('0x28')]?_0x326f4e[_0xcc46('0x28')]:0x2,'scheduledat':_0x326f4e[_0xcc46('0x16')]?_0x326f4e[_0xcc46('0x16')]:moment()[_0xcc46('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x326f4e[_0xcc46('0x29')]?!![]:![],'callbackuniqueid':_0x326f4e[_0xcc46('0x29')]?_0x326f4e[_0xcc46('0x29')]:undefined,'callbackat':_0x326f4e[_0xcc46('0x29')]?moment()[_0xcc46('0x17')](_0xcc46('0x18')):undefined,'VoiceQueueId':_0x45af8b['id']});})[_0xcc46('0x2a')](function(_0x518838){_0x1dde77(_0x518838);});});});};var _0x1c255a=function(_0x5628c5){return new BPromise(function(_0x13d691,_0x3a2da4){_0x1a50e5(_0x5628c5,_0x326f4e)['then'](function(_0x3cb285){_0x326f4e['scheduledat']=_0x3cb285[_0xcc46('0x21')];_0x4cfa12['CmHopper']['findOne']({'where':{'phone':_0x326f4e[_0xcc46('0x9')],'VoiceQueueId':_0x5628c5['id']}})[_0xcc46('0x20')](function(_0x5cb291){if(!_[_0xcc46('0x19')](_0x5cb291)){throw new Error('cmContact,\x20afterCreate\x20'+_0x326f4e['phone']+_0xcc46('0x2b')+_0x5628c5['id']);}return _0x4cfa12[_0xcc46('0x2c')][_0xcc46('0x23')]({'where':{'calleridnum':_0x326f4e[_0xcc46('0x9')],'VoiceQueueId':_0x5628c5['id']}});})[_0xcc46('0x20')](function(_0x2361ed){if(!_['isNil'](_0x2361ed)){throw new Error(_0xcc46('0x2d')+_0x326f4e[_0xcc46('0x9')]+_0xcc46('0x2e')+_0x5628c5['id']);}return _0x4cfa12[_0xcc46('0x22')][_0xcc46('0x26')]({'phone':_0x326f4e['phone'],'ContactId':_0x326f4e['id'],'ListId':_0x326f4e[_0xcc46('0x27')],'priority':_0x326f4e[_0xcc46('0x28')]?_0x326f4e[_0xcc46('0x28')]:0x2,'scheduledat':_0x326f4e[_0xcc46('0x16')]?_0x326f4e[_0xcc46('0x16')]:moment()['format'](_0xcc46('0x18')),'callback':_0x326f4e[_0xcc46('0x29')]?!![]:![],'callbackuniqueid':_0x326f4e[_0xcc46('0x29')]?_0x326f4e[_0xcc46('0x29')]:undefined,'callbackat':_0x326f4e[_0xcc46('0x29')]?moment()[_0xcc46('0x17')](_0xcc46('0x18')):undefined,'VoiceQueueId':_0x5628c5['id']});})[_0xcc46('0x2a')](function(_0x221aa5){_0x3a2da4(_0x221aa5);});});});};function _0x239c89(){return function(_0x17ffff){logger[_0xcc46('0x13')](_0xcc46('0x2f'),_0xcc46('0x14'),util[_0xcc46('0x15')](_0x17ffff,{'showHidden':![],'depth':null}));};}function _0x266314(_0x438589,_0x5ad4ab){var _0x7e8929=_0x5ad4ab['scheduledat']?_0x5ad4ab[_0xcc46('0x16')]:moment()[_0xcc46('0x17')](_0xcc46('0x18'));return new BPromise(function(_0x5e468e,_0x54e653){if(_['isNil'](_0x5ad4ab[_0xcc46('0x1a')])){_0x5e468e({'ret':_0x7e8929});}else{_0x4cfa12[_0xcc46('0x30')][_0xcc46('0x23')]({'where':{'id':_0x438589['id']}})[_0xcc46('0x20')](function(_0x1cd0b3){if(!_['isNil'](_0x1cd0b3)){var _0x489286=_0x1cd0b3['dialTimezone'];if(!_[_0xcc46('0x19')](_0x489286)){var _0x591b96=shared[_0xcc46('0x1c')];var _0x3dd4d7=_0x591b96[_0x489286];var _0x541c9d=_0x591b96[_0x5ad4ab[_0xcc46('0x1a')]];if(!_[_0xcc46('0x19')](_0x3dd4d7)&&!_[_0xcc46('0x19')](_0x541c9d)){var _0x2b71a6=_0x3dd4d7['utcOffset']-_0x541c9d[_0xcc46('0x1d')];_0x7e8929=_0x5ad4ab[_0xcc46('0x16')]?_0x5ad4ab['scheduledat']:moment();var _0x2e9612=moment(_0x7e8929)[_0xcc46('0x1e')](_0x2b71a6,_0xcc46('0x1f'));_0x5e468e({'ret':_0x2e9612[_0xcc46('0x17')](_0xcc46('0x18'))});}else _0x5e468e({'ret':_0x7e8929});}else _0x5e468e({'ret':_0x7e8929});}else{_0x5e468e({'ret':_0x7e8929});}});}});return 0xa;}var _0x14e47f=function(_0x3f0c92){return new BPromise(function(_0x3934ee,_0x1bbb27){_0x266314(_0x3f0c92,_0x326f4e)['then'](function(_0x502022){_0x326f4e[_0xcc46('0x16')]=_0x502022[_0xcc46('0x21')];_0x4cfa12[_0xcc46('0x22')][_0xcc46('0x23')]({'where':{'phone':_0x326f4e[_0xcc46('0x9')],'CampaignId':_0x3f0c92['id']}})[_0xcc46('0x20')](function(_0x1d5c00){if(!_[_0xcc46('0x19')](_0x1d5c00)){throw new Error(_0xcc46('0x24')+_0x326f4e[_0xcc46('0x9')]+_0xcc46('0x31')+_0x3f0c92['id']);}return _0x4cfa12[_0xcc46('0x22')][_0xcc46('0x26')]({'phone':_0x326f4e[_0xcc46('0x9')],'ContactId':_0x326f4e['id'],'ListId':_0x326f4e[_0xcc46('0x27')],'priority':_0x326f4e[_0xcc46('0x28')]?_0x326f4e[_0xcc46('0x28')]:0x2,'scheduledat':_0x326f4e[_0xcc46('0x16')]?_0x326f4e['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x326f4e[_0xcc46('0x29')]?!![]:![],'callbackuniqueid':_0x326f4e['callbackUniqueid']?_0x326f4e['callbackUniqueid']:undefined,'callbackat':_0x326f4e[_0xcc46('0x29')]?moment()[_0xcc46('0x17')](_0xcc46('0x18')):undefined,'CampaignId':_0x3f0c92['id']});})[_0xcc46('0x2a')](function(_0x38c87c){_0x1bbb27(_0x38c87c);});});});};var _0xfa79d3=function(_0xd682de){return new BPromise(function(_0x3fb3c6,_0x57be21){_0x266314(_0xd682de,_0x326f4e)[_0xcc46('0x20')](function(_0x3cba4b){_0x326f4e[_0xcc46('0x16')]=_0x3cba4b[_0xcc46('0x21')];_0x4cfa12[_0xcc46('0x22')][_0xcc46('0x23')]({'where':{'phone':_0x326f4e[_0xcc46('0x9')],'CampaignId':_0xd682de['id']}})[_0xcc46('0x20')](function(_0x529ae0){if(!_[_0xcc46('0x19')](_0x529ae0)){throw new Error(_0xcc46('0x24')+_0x326f4e[_0xcc46('0x9')]+_0xcc46('0x32')+_0xd682de['id']);}return _0x4cfa12[_0xcc46('0x2c')]['findOne']({'where':{'calleridnum':_0x326f4e['phone'],'CampaignId':_0xd682de['id']}});})[_0xcc46('0x20')](function(_0x3905c3){if(!_[_0xcc46('0x19')](_0x3905c3)){throw new Error(_0xcc46('0x2d')+_0x326f4e['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0xd682de['id']);}return _0x4cfa12[_0xcc46('0x22')]['create']({'phone':_0x326f4e[_0xcc46('0x9')],'ContactId':_0x326f4e['id'],'ListId':_0x326f4e['ListId'],'priority':_0x326f4e['priority']?_0x326f4e[_0xcc46('0x28')]:0x2,'scheduledat':_0x326f4e['scheduledat']?_0x326f4e[_0xcc46('0x16')]:moment()[_0xcc46('0x17')](_0xcc46('0x18')),'callback':_0x326f4e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x326f4e['callbackUniqueid']?_0x326f4e['callbackUniqueid']:undefined,'callbackat':_0x326f4e[_0xcc46('0x29')]?moment()[_0xcc46('0x17')](_0xcc46('0x18')):undefined,'CampaignId':_0xd682de['id']});})[_0xcc46('0x2a')](function(_0xd68ce7){_0x57be21(_0xd68ce7);});});});};if(_0x326f4e['ListId']){_0x4cfa12['VoiceQueue'][_0xcc46('0x33')]({'where':{'type':_0xcc46('0x34')},'attributes':['id','dialCheckDuplicateType',_0xcc46('0x1a')],'include':[{'model':_0x4cfa12[_0xcc46('0x35')],'as':_0xcc46('0x36'),'where':{'id':_0x326f4e[_0xcc46('0x27')]}}]})[_0xcc46('0x20')](function(_0x1068a4){if(_0x1068a4){var _0x129b14=[];for(var _0x59ff00=0x0,_0x57f7a1;_0x59ff00<_0x1068a4[_0xcc46('0x37')];_0x59ff00+=0x1){_0x57f7a1=_0x1068a4[_0x59ff00][_0xcc46('0x12')]({'plain':!![]});switch(_0x57f7a1[_0xcc46('0x38')]){case'always':_0x1c255a(_0x57f7a1)[_0xcc46('0x2a')](_0x70d159());break;case _0xcc46('0x39'):_0x18770d(_0x57f7a1)[_0xcc46('0x2a')](_0x70d159());break;default:_0x266314(_0x57f7a1,_0x326f4e)['then'](function(_0x5713f7){_0x326f4e[_0xcc46('0x16')]=_0x5713f7['ret'];_0x4cfa12[_0xcc46('0x22')][_0xcc46('0x26')]({'phone':_0x326f4e['phone'],'ContactId':_0x326f4e['id'],'ListId':_0x326f4e[_0xcc46('0x27')],'scheduledat':_0x326f4e['scheduledat']?_0x326f4e[_0xcc46('0x16')]:moment()[_0xcc46('0x17')](_0xcc46('0x18')),'priority':_0x326f4e[_0xcc46('0x28')]?_0x326f4e[_0xcc46('0x28')]:0x2,'callback':_0x326f4e[_0xcc46('0x29')]?!![]:![],'callbackuniqueid':_0x326f4e[_0xcc46('0x29')]?_0x326f4e[_0xcc46('0x29')]:undefined,'callbackat':_0x326f4e[_0xcc46('0x29')]?moment()[_0xcc46('0x17')](_0xcc46('0x18')):undefined,'VoiceQueueId':_0x57f7a1['id']})['catch'](_0x70d159());});}}}})[_0xcc46('0x20')](function(){return _0x4cfa12[_0xcc46('0x1b')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x4cfa12[_0xcc46('0x35')],'as':_0xcc46('0x3a'),'where':{'id':_0x326f4e[_0xcc46('0x27')]}}]})[_0xcc46('0x20')](function(_0x5e82ff){if(_0x5e82ff){var _0x2acca1=[];for(var _0x4c4b30=0x0,_0x11e65e;_0x4c4b30<_0x5e82ff[_0xcc46('0x37')];_0x4c4b30+=0x1){_0x11e65e=_0x5e82ff[_0x4c4b30]['get']({'plain':!![]});_0x4cfa12[_0xcc46('0x3b')]['create']({'phone':_0x326f4e[_0xcc46('0x9')],'ContactId':_0x326f4e['id'],'ListId':_0x326f4e[_0xcc46('0x27')],'VoiceQueueId':_0x11e65e['id']})[_0xcc46('0x2a')](function(_0x3eaf82){logger[_0xcc46('0x13')](_0xcc46('0x3c'),_0xcc46('0x14'),_0x3eaf82['message']);});}}});})['then'](function(){return _0x4cfa12[_0xcc46('0x30')][_0xcc46('0x33')]({'attributes':['id','dialCheckDuplicateType',_0xcc46('0x1a')],'include':[{'model':_0x4cfa12[_0xcc46('0x35')],'as':_0xcc46('0x36'),'where':{'id':_0x326f4e['ListId']}}]})[_0xcc46('0x20')](function(_0x3b4d94){if(_0x3b4d94){var _0x46e2b3=[];for(var _0x54dbcd=0x0,_0x3f9e33;_0x54dbcd<_0x3b4d94[_0xcc46('0x37')];_0x54dbcd+=0x1){_0x3f9e33=_0x3b4d94[_0x54dbcd][_0xcc46('0x12')]({'plain':!![]});switch(_0x3f9e33['dialCheckDuplicateType']){case _0xcc46('0x3d'):_0xfa79d3(_0x3f9e33)['catch'](_0x239c89());break;case _0xcc46('0x39'):_0x14e47f(_0x3f9e33)[_0xcc46('0x2a')](_0x239c89());break;default:_0x4cfa12[_0xcc46('0x22')][_0xcc46('0x26')]({'phone':_0x326f4e['phone'],'ContactId':_0x326f4e['id'],'ListId':_0x326f4e[_0xcc46('0x27')],'scheduledat':_0x326f4e[_0xcc46('0x16')]?_0x326f4e[_0xcc46('0x16')]:moment()[_0xcc46('0x17')](_0xcc46('0x18')),'priority':_0x326f4e['priority']?_0x326f4e[_0xcc46('0x28')]:0x2,'callback':_0x326f4e[_0xcc46('0x29')]?!![]:![],'callbackuniqueid':_0x326f4e[_0xcc46('0x29')]?_0x326f4e[_0xcc46('0x29')]:undefined,'callbackat':_0x326f4e[_0xcc46('0x29')]?moment()[_0xcc46('0x17')](_0xcc46('0x18')):undefined,'CampaignId':_0x3f9e33['id']})[_0xcc46('0x2a')](_0x239c89());}}}});})[_0xcc46('0x20')](function(){return _0x4cfa12[_0xcc46('0x30')][_0xcc46('0x33')]({'attributes':['id'],'include':[{'model':_0x4cfa12[_0xcc46('0x35')],'as':_0xcc46('0x3a'),'where':{'id':_0x326f4e[_0xcc46('0x27')]}}]})[_0xcc46('0x20')](function(_0x3bcf43){if(_0x3bcf43){var _0x1c989c=[];for(var _0xfcff89=0x0,_0x20b5d8;_0xfcff89<_0x3bcf43[_0xcc46('0x37')];_0xfcff89+=0x1){_0x20b5d8=_0x3bcf43[_0xfcff89][_0xcc46('0x12')]({'plain':!![]});_0x4cfa12[_0xcc46('0x3b')]['create']({'phone':_0x326f4e[_0xcc46('0x9')],'ContactId':_0x326f4e['id'],'ListId':_0x326f4e[_0xcc46('0x27')],'CampaignId':_0x20b5d8['id']})['catch'](function(_0x306cc4){logger['error']('cmContact,\x20%s,\x20%s',_0xcc46('0x14'),_0x306cc4['message']);});}}});})[_0xcc46('0x20')](function(){_0xf5dec5();})[_0xcc46('0x2a')](function(_0x4e4987){logger['error'](_0xcc46('0x3c'),_0xcc46('0x14'),_0x4e4987[_0xcc46('0x3e')]);_0xf5dec5(_0x4e4987);});}else{_0xf5dec5(new Error(_0xcc46('0x3f')));}},'afterDestroy':function(_0x46f291,_0x3a0173,_0x29523a){var _0x61a34f=_0x30b322[_0xcc46('0x11')];var _0x7f7d28=_0x46f291['get']({'plain':!![]});return _0x61a34f[_0xcc46('0x22')]['findAll']({'raw':!![],'where':{'ListId':_0x7f7d28['ListId'],'ContactId':_0x7f7d28['id']}})[_0xcc46('0x20')](function(_0x2ac75d){if(!_['isEmpty'](_0x2ac75d)){var _0x24f6bd=[];for(var _0x94c890=0x0;_0x94c890<_0x2ac75d[_0xcc46('0x37')];_0x94c890+=0x1){var _0x10c69d=_0x61a34f[_0xcc46('0x22')][_0xcc46('0x40')]({'where':{'ListId':_0x2ac75d[_0x94c890][_0xcc46('0x27')],'ContactId':_0x2ac75d[_0x94c890][_0xcc46('0x41')],'VoiceQueueId':_0x2ac75d[_0x94c890][_0xcc46('0x42')],'CampaignId':_0x2ac75d[_0x94c890][_0xcc46('0x43')]}});_0x24f6bd[_0xcc46('0x44')](_0x10c69d);}return BPromise['all'](_0x24f6bd);}})['then'](function(_0x4ab00f){logger['info'](_0xcc46('0x45'),util[_0xcc46('0x15')](_0x4ab00f,{'showHidden':![],'depth':null}));_0x29523a();})[_0xcc46('0x2a')](function(_0x247e71){logger[_0xcc46('0x13')](_0xcc46('0x46'),util[_0xcc46('0x15')](_0x247e71,{'showHidden':![],'depth':null}));_0x29523a(_0x247e71);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index dc901ed..a4ea859 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(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x39b2a4,_0x4aca1b){var _0x4d57cd=function(_0x280124){while(--_0x280124){_0x39b2a4['push'](_0x39b2a4['shift']());}};_0x4d57cd(++_0x4aca1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 ef78a91..ddd8253 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 _0xb0b9=['STRING','INTEGER','PHONE','sequelize'];(function(_0x6d6e8f,_0x1db6d3){var _0x5cca22=function(_0x3791b6){while(--_0x3791b6){_0x6d6e8f['push'](_0x6d6e8f['shift']());}};_0x5cca22(++_0x1db6d3);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x51fa0b,_0x35878b){_0x51fa0b=_0x51fa0b-0x0;var _0x4a9ca4=_0xb0b9[_0x51fa0b];return _0x4a9ca4;};'use strict';var Sequelize=require(_0x9b0b('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x9b0b('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x9b0b('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x9b0b('0x1')],'defaultValue':_0x9b0b('0x3')},'OrderBy':{'type':Sequelize[_0x9b0b('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x9b0b('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x330c=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0xda0317,_0x56a57c){var _0x3b5d28=function(_0x1ecfab){while(--_0x1ecfab){_0xda0317['push'](_0xda0317['shift']());}};_0x3b5d28(++_0x56a57c);}(_0x330c,0x186));var _0xc330=function(_0x1d5dc4,_0x24006d){_0x1d5dc4=_0x1d5dc4-0x0;var _0x354de7=_0x330c[_0x1d5dc4];return _0x354de7;};'use strict';var Sequelize=require(_0xc330('0x0'));module[_0xc330('0x1')]={'CmContactId':{'type':Sequelize[_0xc330('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xc330('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc330('0x3')],'defaultValue':_0xc330('0x4')},'OrderBy':{'type':Sequelize[_0xc330('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xc330('0x3')],'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 df649d0..af80177 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 _0x6c9d=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','merge','create','user','get','role','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','CmContactHasItem','rawAttributes','fieldName'];(function(_0x12cc7b,_0x240ec1){var _0xd07668=function(_0x48b3b4){while(--_0x48b3b4){_0x12cc7b['push'](_0x12cc7b['shift']());}};_0xd07668(++_0x240ec1);}(_0x6c9d,0x75));var _0xd6c9=function(_0x4a55e0,_0x160a3c){_0x4a55e0=_0x4a55e0-0x0;var _0x2d06ff=_0x6c9d[_0x4a55e0];return _0x2d06ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6c9('0x0'));var zipdir=require(_0xd6c9('0x1'));var jsonpatch=require(_0xd6c9('0x2'));var rp=require('request-promise');var moment=require(_0xd6c9('0x3'));var BPromise=require(_0xd6c9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd6c9('0x5'));var sox=require(_0xd6c9('0x6'));var csv=require(_0xd6c9('0x7'));var ejs=require(_0xd6c9('0x8'));var fs=require('fs');var fs_extra=require(_0xd6c9('0x9'));var _=require(_0xd6c9('0xa'));var squel=require('squel');var crypto=require(_0xd6c9('0xb'));var jsforce=require(_0xd6c9('0xc'));var deskjs=require(_0xd6c9('0xd'));var toCsv=require(_0xd6c9('0x7'));var querystring=require(_0xd6c9('0xe'));var Papa=require(_0xd6c9('0xf'));var Redis=require(_0xd6c9('0x10'));var authService=require(_0xd6c9('0x11'));var qs=require(_0xd6c9('0x12'));var as=require(_0xd6c9('0x13'));var hardwareService=require(_0xd6c9('0x14'));var logger=require(_0xd6c9('0x15'))('api');var utils=require(_0xd6c9('0x16'));var config=require(_0xd6c9('0x17'));var licenseUtil=require(_0xd6c9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d6307,_0x2872de){_0x2872de=_0x2872de||0xcc;return function(_0x49f1e2){if(_0x49f1e2){return _0x2d6307[_0xd6c9('0x19')](_0x2872de);}return _0x2d6307[_0xd6c9('0x1a')](_0x2872de)[_0xd6c9('0x1b')]();};}function respondWithResult(_0x547cf3,_0x63b0dc){_0x63b0dc=_0x63b0dc||0xc8;return function(_0x3a4086){if(_0x3a4086){return _0x547cf3[_0xd6c9('0x1a')](_0x63b0dc)['json'](_0x3a4086);}};}function respondWithFilteredResult(_0x5b229e,_0x189227){return function(_0x5af60c){if(_0x5af60c){var _0x5a5486=typeof _0x189227[_0xd6c9('0x1c')]===_0xd6c9('0x1d')&&typeof _0x189227[_0xd6c9('0x1e')]===_0xd6c9('0x1d');var _0x16648d=_0x5af60c[_0xd6c9('0x1f')];var _0x4d6df9=_0x5a5486?0x0:_0x189227[_0xd6c9('0x1c')];var _0x308490=_0x5a5486?_0x5af60c[_0xd6c9('0x1f')]:_0x189227[_0xd6c9('0x1c')]+_0x189227[_0xd6c9('0x1e')];var _0x4c6db5;if(_0x308490>=_0x16648d){_0x308490=_0x16648d;_0x4c6db5=0xc8;}else{_0x4c6db5=0xce;}_0x5b229e['status'](_0x4c6db5);return _0x5b229e[_0xd6c9('0x20')](_0xd6c9('0x21'),_0x4d6df9+'-'+_0x308490+'/'+_0x16648d)[_0xd6c9('0x22')](_0x5af60c);}return null;};}function patchUpdates(_0x4c2594){return function(_0x1dd274){try{jsonpatch[_0xd6c9('0x23')](_0x1dd274,_0x4c2594,!![]);}catch(_0x5dce28){return BPromise[_0xd6c9('0x24')](_0x5dce28);}return _0x1dd274[_0xd6c9('0x25')]();};}function saveUpdates(_0x17a253,_0x2eb5f0){return function(_0x577c73){if(_0x577c73){return _0x577c73[_0xd6c9('0x26')](_0x17a253)[_0xd6c9('0x27')](function(_0xb46d70){return _0xb46d70;});}return null;};}function removeEntity(_0x214446,_0x4dd130){return function(_0x2a9dda){if(_0x2a9dda){return _0x2a9dda[_0xd6c9('0x28')]()[_0xd6c9('0x27')](function(){var _0x498e23=_0x2a9dda['get']({'plain':!![]});var _0x3ce4f6='CmContactHasItems';return db['UserProfileResource'][_0xd6c9('0x28')]({'where':{'type':_0x3ce4f6,'resourceId':_0x498e23['id']}})[_0xd6c9('0x27')](function(){return _0x2a9dda;});})[_0xd6c9('0x27')](function(){_0x214446[_0xd6c9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x497949,_0x293391){return function(_0x352bb6){if(!_0x352bb6){_0x497949[_0xd6c9('0x19')](0x194);}return _0x352bb6;};}function handleError(_0x2fdb80,_0x42545c){_0x42545c=_0x42545c||0x1f4;return function(_0x24f815){logger['error'](_0x24f815['stack']);if(_0x24f815[_0xd6c9('0x29')]){delete _0x24f815['name'];}_0x2fdb80[_0xd6c9('0x1a')](_0x42545c)[_0xd6c9('0x2a')](_0x24f815);};}exports['index']=function(_0x2cd22c,_0x4cde3a){var _0x23c8d3={},_0x57010b={},_0x2e73d3={'count':0x0,'rows':[]};var _0x25a678=_[_0xd6c9('0x2b')](db[_0xd6c9('0x2c')][_0xd6c9('0x2d')],function(_0x427579){return{'name':_0x427579[_0xd6c9('0x2e')],'type':_0x427579['type']['key']};});_0x57010b[_0xd6c9('0x2f')]=_[_0xd6c9('0x2b')](_0x25a678,_0xd6c9('0x29'));_0x57010b[_0xd6c9('0x30')]=_[_0xd6c9('0x31')](_0x2cd22c['query']);_0x57010b[_0xd6c9('0x32')]=_[_0xd6c9('0x33')](_0x57010b[_0xd6c9('0x2f')],_0x57010b[_0xd6c9('0x30')]);_0x23c8d3[_0xd6c9('0x34')]=_['intersection'](_0x57010b[_0xd6c9('0x2f')],qs[_0xd6c9('0x35')](_0x2cd22c[_0xd6c9('0x30')][_0xd6c9('0x35')]));_0x23c8d3[_0xd6c9('0x34')]=_0x23c8d3[_0xd6c9('0x34')][_0xd6c9('0x36')]?_0x23c8d3[_0xd6c9('0x34')]:_0x57010b[_0xd6c9('0x2f')];if(!_0x2cd22c['query'][_0xd6c9('0x37')]('nolimit')){_0x23c8d3[_0xd6c9('0x1e')]=qs[_0xd6c9('0x1e')](_0x2cd22c[_0xd6c9('0x30')][_0xd6c9('0x1e')]);_0x23c8d3[_0xd6c9('0x1c')]=qs[_0xd6c9('0x1c')](_0x2cd22c['query'][_0xd6c9('0x1c')]);}_0x23c8d3[_0xd6c9('0x38')]=qs[_0xd6c9('0x39')](_0x2cd22c[_0xd6c9('0x30')][_0xd6c9('0x39')]);_0x23c8d3[_0xd6c9('0x3a')]=qs['filters'](_[_0xd6c9('0x3b')](_0x2cd22c[_0xd6c9('0x30')],_0x57010b[_0xd6c9('0x32')]),_0x25a678);if(_0x2cd22c['query']['filter']){_0x23c8d3[_0xd6c9('0x3a')]=_['merge'](_0x23c8d3['where'],{'$or':_[_0xd6c9('0x2b')](_0x25a678,function(_0xbcfc24){if(_0xbcfc24[_0xd6c9('0x3c')]!==_0xd6c9('0x3d')){var _0x1808a9={};_0x1808a9[_0xbcfc24['name']]={'$like':'%'+_0x2cd22c['query'][_0xd6c9('0x3e')]+'%'};return _0x1808a9;}})});}_0x23c8d3=_['merge']({},_0x23c8d3,_0x2cd22c[_0xd6c9('0x3f')]);var _0x2d5a66={'where':_0x23c8d3[_0xd6c9('0x3a')]};return db[_0xd6c9('0x2c')][_0xd6c9('0x1f')](_0x2d5a66)[_0xd6c9('0x27')](function(_0x27d43a){_0x2e73d3['count']=_0x27d43a;if(_0x2cd22c[_0xd6c9('0x30')][_0xd6c9('0x40')]){_0x23c8d3[_0xd6c9('0x41')]=[{'all':!![]}];}return db[_0xd6c9('0x2c')][_0xd6c9('0x42')](_0x23c8d3);})[_0xd6c9('0x27')](function(_0x548cf8){_0x2e73d3[_0xd6c9('0x43')]=_0x548cf8;return _0x2e73d3;})[_0xd6c9('0x27')](respondWithFilteredResult(_0x4cde3a,_0x23c8d3))[_0xd6c9('0x44')](handleError(_0x4cde3a,null));};exports['show']=function(_0x284475,_0x3739fe){var _0x4ddd55={'raw':!![],'where':{'id':_0x284475[_0xd6c9('0x45')]['id']}},_0x1575cd={};_0x1575cd[_0xd6c9('0x2f')]=_[_0xd6c9('0x31')](db[_0xd6c9('0x2c')][_0xd6c9('0x2d')]);_0x1575cd['query']=_[_0xd6c9('0x31')](_0x284475[_0xd6c9('0x30')]);_0x1575cd['filters']=_[_0xd6c9('0x33')](_0x1575cd[_0xd6c9('0x2f')],_0x1575cd[_0xd6c9('0x30')]);_0x4ddd55[_0xd6c9('0x34')]=_['intersection'](_0x1575cd[_0xd6c9('0x2f')],qs[_0xd6c9('0x35')](_0x284475[_0xd6c9('0x30')][_0xd6c9('0x35')]));_0x4ddd55[_0xd6c9('0x34')]=_0x4ddd55[_0xd6c9('0x34')]['length']?_0x4ddd55['attributes']:_0x1575cd[_0xd6c9('0x2f')];if(_0x284475[_0xd6c9('0x30')][_0xd6c9('0x40')]){_0x4ddd55[_0xd6c9('0x41')]=[{'all':!![]}];}_0x4ddd55=_[_0xd6c9('0x46')]({},_0x4ddd55,_0x284475['options']);return db['CmContactHasItem']['find'](_0x4ddd55)[_0xd6c9('0x27')](handleEntityNotFound(_0x3739fe,null))[_0xd6c9('0x27')](respondWithResult(_0x3739fe,null))['catch'](handleError(_0x3739fe,null));};exports[_0xd6c9('0x47')]=function(_0x182c5d,_0x70614f){return db[_0xd6c9('0x2c')][_0xd6c9('0x47')](_0x182c5d['body'],{})['then'](function(_0x2ddfcc){var _0x553de4=_0x182c5d[_0xd6c9('0x48')][_0xd6c9('0x49')]({'plain':!![]});if(!_0x553de4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x553de4[_0xd6c9('0x4a')]==='user'){var _0x589963=_0x2ddfcc[_0xd6c9('0x49')]({'plain':!![]});var _0x2cfa29='CmContactHasItems';return db[_0xd6c9('0x4b')][_0xd6c9('0x4c')]({'where':{'name':_0x2cfa29,'userProfileId':_0x553de4['userProfileId']},'raw':!![]})[_0xd6c9('0x27')](function(_0x4eab42){if(_0x4eab42&&_0x4eab42[_0xd6c9('0x4d')]===0x0){return db[_0xd6c9('0x4e')][_0xd6c9('0x47')]({'name':_0x589963['name'],'resourceId':_0x589963['id'],'type':_0x4eab42['name'],'sectionId':_0x4eab42['id']},{})[_0xd6c9('0x27')](function(){return _0x2ddfcc;});}else{return _0x2ddfcc;}})[_0xd6c9('0x44')](function(_0x4e9dad){logger[_0xd6c9('0x4f')](_0xd6c9('0x50'),_0x4e9dad);throw _0x4e9dad;});}return _0x2ddfcc;})[_0xd6c9('0x27')](respondWithResult(_0x70614f,0xc9))[_0xd6c9('0x44')](handleError(_0x70614f,null));};exports[_0xd6c9('0x26')]=function(_0x2307c1,_0x3d068c){if(_0x2307c1['body']['id']){delete _0x2307c1[_0xd6c9('0x51')]['id'];}return db['CmContactHasItem'][_0xd6c9('0x4c')]({'where':{'id':_0x2307c1[_0xd6c9('0x45')]['id']}})[_0xd6c9('0x27')](handleEntityNotFound(_0x3d068c,null))[_0xd6c9('0x27')](saveUpdates(_0x2307c1[_0xd6c9('0x51')],null))['then'](respondWithResult(_0x3d068c,null))[_0xd6c9('0x44')](handleError(_0x3d068c,null));};exports['destroy']=function(_0x5a36fc,_0x332214){return db[_0xd6c9('0x2c')]['find']({'where':{'id':_0x5a36fc[_0xd6c9('0x45')]['id']}})[_0xd6c9('0x27')](handleEntityNotFound(_0x332214,null))[_0xd6c9('0x27')](removeEntity(_0x332214,null))['catch'](handleError(_0x332214,null));}; \ No newline at end of file +var _0x76dd=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','set','apply','reject','save','update','destroy','then','get','CmContactHasItems','UserProfileResource','error','stack','name','send','map','CmContactHasItem','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','catch','show','params','include','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x59081b,_0xe320ba){var _0x2f6058=function(_0xc81cd7){while(--_0xc81cd7){_0x59081b['push'](_0x59081b['shift']());}};_0x2f6058(++_0xe320ba);}(_0x76dd,0xa6));var _0xd76d=function(_0x1e622a,_0x24c882){_0x1e622a=_0x1e622a-0x0;var _0x21b178=_0x76dd[_0x1e622a];return _0x21b178;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd76d('0x0'));var zipdir=require(_0xd76d('0x1'));var jsonpatch=require(_0xd76d('0x2'));var rp=require(_0xd76d('0x3'));var moment=require(_0xd76d('0x4'));var BPromise=require(_0xd76d('0x5'));var Mustache=require(_0xd76d('0x6'));var util=require('util');var path=require(_0xd76d('0x7'));var sox=require(_0xd76d('0x8'));var csv=require(_0xd76d('0x9'));var ejs=require(_0xd76d('0xa'));var fs=require('fs');var fs_extra=require(_0xd76d('0xb'));var _=require(_0xd76d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd76d('0xd'));var deskjs=require(_0xd76d('0xe'));var toCsv=require(_0xd76d('0x9'));var querystring=require(_0xd76d('0xf'));var Papa=require(_0xd76d('0x10'));var Redis=require(_0xd76d('0x11'));var authService=require(_0xd76d('0x12'));var qs=require(_0xd76d('0x13'));var as=require(_0xd76d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd76d('0x15'))('api');var utils=require(_0xd76d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd76d('0x17'));var db=require(_0xd76d('0x18'))['db'];function respondWithStatusCode(_0x7e914e,_0x3f418b){_0x3f418b=_0x3f418b||0xcc;return function(_0x5243e3){if(_0x5243e3){return _0x7e914e[_0xd76d('0x19')](_0x3f418b);}return _0x7e914e[_0xd76d('0x1a')](_0x3f418b)[_0xd76d('0x1b')]();};}function respondWithResult(_0x3edf49,_0x5dfa29){_0x5dfa29=_0x5dfa29||0xc8;return function(_0x37aab2){if(_0x37aab2){return _0x3edf49[_0xd76d('0x1a')](_0x5dfa29)['json'](_0x37aab2);}};}function respondWithFilteredResult(_0xcbc6e9,_0x498e64){return function(_0x4d225b){if(_0x4d225b){var _0x30d51b=typeof _0x498e64['offset']===_0xd76d('0x1c')&&typeof _0x498e64[_0xd76d('0x1d')]===_0xd76d('0x1c');var _0x10d01f=_0x4d225b['count'];var _0xef56ea=_0x30d51b?0x0:_0x498e64['offset'];var _0x2e0e51=_0x30d51b?_0x4d225b['count']:_0x498e64['offset']+_0x498e64['limit'];var _0xc51588;if(_0x2e0e51>=_0x10d01f){_0x2e0e51=_0x10d01f;_0xc51588=0xc8;}else{_0xc51588=0xce;}_0xcbc6e9[_0xd76d('0x1a')](_0xc51588);return _0xcbc6e9[_0xd76d('0x1e')]('Content-Range',_0xef56ea+'-'+_0x2e0e51+'/'+_0x10d01f)['json'](_0x4d225b);}return null;};}function patchUpdates(_0x4f9e84){return function(_0x175071){try{jsonpatch[_0xd76d('0x1f')](_0x175071,_0x4f9e84,!![]);}catch(_0x5371e3){return BPromise[_0xd76d('0x20')](_0x5371e3);}return _0x175071[_0xd76d('0x21')]();};}function saveUpdates(_0x3582bd,_0x5d03b8){return function(_0x40ade0){if(_0x40ade0){return _0x40ade0[_0xd76d('0x22')](_0x3582bd)['then'](function(_0x56f7b8){return _0x56f7b8;});}return null;};}function removeEntity(_0x3a97d5,_0x125fef){return function(_0x58841c){if(_0x58841c){return _0x58841c[_0xd76d('0x23')]()[_0xd76d('0x24')](function(){var _0x404060=_0x58841c[_0xd76d('0x25')]({'plain':!![]});var _0x2078c3=_0xd76d('0x26');return db[_0xd76d('0x27')][_0xd76d('0x23')]({'where':{'type':_0x2078c3,'resourceId':_0x404060['id']}})[_0xd76d('0x24')](function(){return _0x58841c;});})[_0xd76d('0x24')](function(){_0x3a97d5[_0xd76d('0x1a')](0xcc)[_0xd76d('0x1b')]();});}};}function handleEntityNotFound(_0x417f5f,_0x5348a7){return function(_0x3adfe6){if(!_0x3adfe6){_0x417f5f[_0xd76d('0x19')](0x194);}return _0x3adfe6;};}function handleError(_0xd24c95,_0x2647bb){_0x2647bb=_0x2647bb||0x1f4;return function(_0x1c46e2){logger[_0xd76d('0x28')](_0x1c46e2[_0xd76d('0x29')]);if(_0x1c46e2[_0xd76d('0x2a')]){delete _0x1c46e2[_0xd76d('0x2a')];}_0xd24c95[_0xd76d('0x1a')](_0x2647bb)[_0xd76d('0x2b')](_0x1c46e2);};}exports['index']=function(_0x20a0c9,_0x40a723){var _0x2ce36d={},_0x5562f5={},_0x1488cd={'count':0x0,'rows':[]};var _0x3a5c87=_[_0xd76d('0x2c')](db[_0xd76d('0x2d')][_0xd76d('0x2e')],function(_0x4a9785){return{'name':_0x4a9785['fieldName'],'type':_0x4a9785[_0xd76d('0x2f')]['key']};});_0x5562f5[_0xd76d('0x30')]=_[_0xd76d('0x2c')](_0x3a5c87,_0xd76d('0x2a'));_0x5562f5[_0xd76d('0x31')]=_[_0xd76d('0x32')](_0x20a0c9[_0xd76d('0x31')]);_0x5562f5[_0xd76d('0x33')]=_[_0xd76d('0x34')](_0x5562f5[_0xd76d('0x30')],_0x5562f5['query']);_0x2ce36d['attributes']=_[_0xd76d('0x34')](_0x5562f5[_0xd76d('0x30')],qs['fields'](_0x20a0c9[_0xd76d('0x31')][_0xd76d('0x35')]));_0x2ce36d[_0xd76d('0x36')]=_0x2ce36d[_0xd76d('0x36')][_0xd76d('0x37')]?_0x2ce36d['attributes']:_0x5562f5[_0xd76d('0x30')];if(!_0x20a0c9[_0xd76d('0x31')][_0xd76d('0x38')](_0xd76d('0x39'))){_0x2ce36d[_0xd76d('0x1d')]=qs[_0xd76d('0x1d')](_0x20a0c9[_0xd76d('0x31')][_0xd76d('0x1d')]);_0x2ce36d[_0xd76d('0x3a')]=qs['offset'](_0x20a0c9['query'][_0xd76d('0x3a')]);}_0x2ce36d[_0xd76d('0x3b')]=qs[_0xd76d('0x3c')](_0x20a0c9[_0xd76d('0x31')][_0xd76d('0x3c')]);_0x2ce36d[_0xd76d('0x3d')]=qs[_0xd76d('0x33')](_[_0xd76d('0x3e')](_0x20a0c9[_0xd76d('0x31')],_0x5562f5[_0xd76d('0x33')]),_0x3a5c87);if(_0x20a0c9[_0xd76d('0x31')][_0xd76d('0x3f')]){_0x2ce36d['where']=_['merge'](_0x2ce36d[_0xd76d('0x3d')],{'$or':_[_0xd76d('0x2c')](_0x3a5c87,function(_0x138cbe){if(_0x138cbe[_0xd76d('0x2f')]!==_0xd76d('0x40')){var _0x569c69={};_0x569c69[_0x138cbe[_0xd76d('0x2a')]]={'$like':'%'+_0x20a0c9[_0xd76d('0x31')][_0xd76d('0x3f')]+'%'};return _0x569c69;}})});}_0x2ce36d=_['merge']({},_0x2ce36d,_0x20a0c9[_0xd76d('0x41')]);var _0x37aaeb={'where':_0x2ce36d[_0xd76d('0x3d')]};return db[_0xd76d('0x2d')][_0xd76d('0x42')](_0x37aaeb)[_0xd76d('0x24')](function(_0x700497){_0x1488cd[_0xd76d('0x42')]=_0x700497;if(_0x20a0c9['query'][_0xd76d('0x43')]){_0x2ce36d['include']=[{'all':!![]}];}return db[_0xd76d('0x2d')]['findAll'](_0x2ce36d);})['then'](function(_0x5f48d4){_0x1488cd['rows']=_0x5f48d4;return _0x1488cd;})['then'](respondWithFilteredResult(_0x40a723,_0x2ce36d))[_0xd76d('0x44')](handleError(_0x40a723,null));};exports[_0xd76d('0x45')]=function(_0x5da329,_0x6ae77a){var _0x274bc8={'raw':!![],'where':{'id':_0x5da329[_0xd76d('0x46')]['id']}},_0x369aee={};_0x369aee[_0xd76d('0x30')]=_[_0xd76d('0x32')](db[_0xd76d('0x2d')][_0xd76d('0x2e')]);_0x369aee[_0xd76d('0x31')]=_[_0xd76d('0x32')](_0x5da329[_0xd76d('0x31')]);_0x369aee['filters']=_[_0xd76d('0x34')](_0x369aee[_0xd76d('0x30')],_0x369aee[_0xd76d('0x31')]);_0x274bc8[_0xd76d('0x36')]=_[_0xd76d('0x34')](_0x369aee[_0xd76d('0x30')],qs['fields'](_0x5da329[_0xd76d('0x31')][_0xd76d('0x35')]));_0x274bc8['attributes']=_0x274bc8['attributes']['length']?_0x274bc8[_0xd76d('0x36')]:_0x369aee['model'];if(_0x5da329[_0xd76d('0x31')][_0xd76d('0x43')]){_0x274bc8[_0xd76d('0x47')]=[{'all':!![]}];}_0x274bc8=_[_0xd76d('0x48')]({},_0x274bc8,_0x5da329[_0xd76d('0x41')]);return db[_0xd76d('0x2d')][_0xd76d('0x49')](_0x274bc8)[_0xd76d('0x24')](handleEntityNotFound(_0x6ae77a,null))[_0xd76d('0x24')](respondWithResult(_0x6ae77a,null))[_0xd76d('0x44')](handleError(_0x6ae77a,null));};exports['create']=function(_0x5e35e0,_0x22c7db){return db[_0xd76d('0x2d')][_0xd76d('0x4a')](_0x5e35e0['body'],{})[_0xd76d('0x24')](function(_0x543d5e){var _0x263ce6=_0x5e35e0[_0xd76d('0x4b')][_0xd76d('0x25')]({'plain':!![]});if(!_0x263ce6)throw new Error(_0xd76d('0x4c'));if(_0x263ce6[_0xd76d('0x4d')]===_0xd76d('0x4b')){var _0x395a2f=_0x543d5e[_0xd76d('0x25')]({'plain':!![]});var _0x5f0b9c='CmContactHasItems';return db[_0xd76d('0x4e')][_0xd76d('0x49')]({'where':{'name':_0x5f0b9c,'userProfileId':_0x263ce6[_0xd76d('0x4f')]},'raw':!![]})[_0xd76d('0x24')](function(_0x33ea16){if(_0x33ea16&&_0x33ea16[_0xd76d('0x50')]===0x0){return db[_0xd76d('0x27')][_0xd76d('0x4a')]({'name':_0x395a2f['name'],'resourceId':_0x395a2f['id'],'type':_0x33ea16[_0xd76d('0x2a')],'sectionId':_0x33ea16['id']},{})[_0xd76d('0x24')](function(){return _0x543d5e;});}else{return _0x543d5e;}})[_0xd76d('0x44')](function(_0x4f477f){logger['error'](_0xd76d('0x51'),_0x4f477f);throw _0x4f477f;});}return _0x543d5e;})[_0xd76d('0x24')](respondWithResult(_0x22c7db,0xc9))[_0xd76d('0x44')](handleError(_0x22c7db,null));};exports['update']=function(_0xa17144,_0x3c1eb8){if(_0xa17144[_0xd76d('0x52')]['id']){delete _0xa17144[_0xd76d('0x52')]['id'];}return db[_0xd76d('0x2d')][_0xd76d('0x49')]({'where':{'id':_0xa17144['params']['id']}})[_0xd76d('0x24')](handleEntityNotFound(_0x3c1eb8,null))[_0xd76d('0x24')](saveUpdates(_0xa17144[_0xd76d('0x52')],null))[_0xd76d('0x24')](respondWithResult(_0x3c1eb8,null))[_0xd76d('0x44')](handleError(_0x3c1eb8,null));};exports[_0xd76d('0x23')]=function(_0x38969f,_0x3ffc46){return db['CmContactHasItem']['find']({'where':{'id':_0x38969f[_0xd76d('0x46')]['id']}})[_0xd76d('0x24')](handleEntityNotFound(_0x3ffc46,null))[_0xd76d('0x24')](removeEntity(_0x3ffc46,null))['catch'](handleError(_0x3ffc46,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 4118212..72b0169 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 _0x11d3=['CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x11d3,0x1f0));var _0x311d=function(_0x39622b,_0x1241c2){_0x39622b=_0x39622b-0x0;var _0x2b6a97=_0x11d3[_0x39622b];return _0x2b6a97;};'use strict';var _=require(_0x311d('0x0'));var util=require(_0x311d('0x1'));var logger=require(_0x311d('0x2'))(_0x311d('0x3'));var moment=require(_0x311d('0x4'));var BPromise=require('bluebird');var rp=require(_0x311d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x311d('0x6'));var config=require(_0x311d('0x7'));var attributes=require(_0x311d('0x8'));module[_0x311d('0x9')]=function(_0x18afc1,_0x1a198d){return _0x18afc1[_0x311d('0xa')](_0x311d('0xb'),attributes,{'tableName':_0x311d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a00=['../../config/environment','./cmContactHasItem.attributes','define','cm_contact_has_items','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9a00,0x1c6));var _0x09a0=function(_0x54b131,_0x2f9ed6){_0x54b131=_0x54b131-0x0;var _0x21c04e=_0x9a00[_0x54b131];return _0x21c04e;};'use strict';var _=require(_0x09a0('0x0'));var util=require('util');var logger=require(_0x09a0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x09a0('0x2'));var rp=require(_0x09a0('0x3'));var fs=require('fs');var path=require(_0x09a0('0x4'));var rimraf=require('rimraf');var config=require(_0x09a0('0x5'));var attributes=require(_0x09a0('0x6'));module['exports']=function(_0x151653,_0x337d27){return _0x151653[_0x09a0('0x7')]('CmContactHasItem',attributes,{'tableName':_0x09a0('0x8'),'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 885c1e0..b092735 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 _0x759e=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error','code','CmContactHasItem,\x20%s,\x20%s','message','info','result'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x759e,0x1e1));var _0xe759=function(_0x53b14b,_0x35fbf7){_0x53b14b=_0x53b14b-0x0;var _0x43e84e=_0x759e[_0x53b14b];return _0x43e84e;};'use strict';var _=require(_0xe759('0x0'));var util=require(_0xe759('0x1'));var moment=require(_0xe759('0x2'));var BPromise=require('bluebird');var rs=require(_0xe759('0x3'));var fs=require('fs');var Redis=require(_0xe759('0x4'));var db=require(_0xe759('0x5'))['db'];var utils=require(_0xe759('0x6'));var logger=require(_0xe759('0x7'))(_0xe759('0x8'));var config=require(_0xe759('0x9'));var jayson=require(_0xe759('0xa'));var client=jayson[_0xe759('0xb')][_0xe759('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f1f27,_0x4591f2,_0x3d7f93){return new BPromise(function(_0x594141,_0x238151){return client[_0xe759('0xd')](_0x3f1f27,_0x3d7f93)[_0xe759('0xe')](function(_0x524944){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x4591f2,'request\x20sent');logger[_0xe759('0xf')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x4591f2,_0xe759('0x10'),JSON['stringify'](_0x524944));if(_0x524944[_0xe759('0x11')]){if(_0x524944[_0xe759('0x11')][_0xe759('0x12')]===0x1f4){logger[_0xe759('0x11')](_0xe759('0x13'),_0x4591f2,_0x524944[_0xe759('0x11')]['message']);return _0x238151(_0x524944['error'][_0xe759('0x14')]);}logger['error'](_0xe759('0x13'),_0x4591f2,_0x524944['error'][_0xe759('0x14')]);return _0x594141(_0x524944['error'][_0xe759('0x14')]);}else{logger[_0xe759('0x15')](_0xe759('0x13'),_0x4591f2,_0xe759('0x10'));_0x594141(_0x524944[_0xe759('0x16')]['message']);}})[_0xe759('0x17')](function(_0x459125){logger[_0xe759('0x11')](_0xe759('0x13'),_0x4591f2,_0x459125);_0x238151(_0x459125);});});} \ No newline at end of file +var _0x99ad=['rpc','../../config/environment','jayson/promise','http','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0x99ad,0x169));var _0xd99a=function(_0x4bf733,_0x29119c){_0x4bf733=_0x4bf733-0x0;var _0x54c9b8=_0x99ad[_0x4bf733];return _0x54c9b8;};'use strict';var _=require(_0xd99a('0x0'));var util=require(_0xd99a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd99a('0x2'));var fs=require('fs');var Redis=require(_0xd99a('0x3'));var db=require(_0xd99a('0x4'))['db'];var utils=require(_0xd99a('0x5'));var logger=require(_0xd99a('0x6'))(_0xd99a('0x7'));var config=require(_0xd99a('0x8'));var jayson=require(_0xd99a('0x9'));var client=jayson['client'][_0xd99a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x239099,_0xb99009,_0x290f4b){return new BPromise(function(_0x5d1230,_0x3cfadc){return client[_0xd99a('0xb')](_0x239099,_0x290f4b)[_0xd99a('0xc')](function(_0x1150f8){logger['info'](_0xd99a('0xd'),_0xb99009,_0xd99a('0xe'));logger[_0xd99a('0xf')](_0xd99a('0x10'),_0xb99009,_0xd99a('0xe'),JSON[_0xd99a('0x11')](_0x1150f8));if(_0x1150f8['error']){if(_0x1150f8[_0xd99a('0x12')][_0xd99a('0x13')]===0x1f4){logger[_0xd99a('0x12')](_0xd99a('0xd'),_0xb99009,_0x1150f8['error'][_0xd99a('0x14')]);return _0x3cfadc(_0x1150f8[_0xd99a('0x12')][_0xd99a('0x14')]);}logger['error'](_0xd99a('0xd'),_0xb99009,_0x1150f8[_0xd99a('0x12')][_0xd99a('0x14')]);return _0x5d1230(_0x1150f8[_0xd99a('0x12')][_0xd99a('0x14')]);}else{logger[_0xd99a('0x15')]('CmContactHasItem,\x20%s,\x20%s',_0xb99009,_0xd99a('0xe'));_0x5d1230(_0x1150f8['result']['message']);}})[_0xd99a('0x16')](function(_0xb53f83){logger[_0xd99a('0x12')](_0xd99a('0xd'),_0xb99009,_0xb53f83);_0x3cfadc(_0xb53f83);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index b3c1a20..97a8196 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 _0xc99f=['get','isAuthenticated','index','/:id','show','put','update','destroy','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x7d2691,_0x4f4058){var _0x2ae662=function(_0x4d4075){while(--_0x4d4075){_0x7d2691['push'](_0x7d2691['shift']());}};_0x2ae662(++_0x4f4058);}(_0xc99f,0x19c));var _0xfc99=function(_0x274d4b,_0x128681){_0x274d4b=_0x274d4b-0x0;var _0x1a1f03=_0xc99f[_0x274d4b];return _0x1a1f03;};'use strict';var multer=require('multer');var util=require(_0xfc99('0x0'));var path=require('path');var timeout=require(_0xfc99('0x1'));var express=require('express');var router=express[_0xfc99('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfc99('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0xfc99('0x4')]('/',auth[_0xfc99('0x5')](),controller[_0xfc99('0x6')]);router[_0xfc99('0x4')](_0xfc99('0x7'),auth[_0xfc99('0x5')](),controller[_0xfc99('0x8')]);router['post']('/',auth[_0xfc99('0x5')](),controller['create']);router[_0xfc99('0x9')](_0xfc99('0x7'),auth[_0xfc99('0x5')](),controller[_0xfc99('0xa')]);router['delete']('/:id',auth[_0xfc99('0x5')](),controller[_0xfc99('0xb')]);module[_0xfc99('0xc')]=router; \ No newline at end of file +var _0x90db=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','multer','util','path'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0x90db,0x179));var _0xb90d=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x90db[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0xb90d('0x0'));var util=require(_0xb90d('0x1'));var path=require(_0xb90d('0x2'));var timeout=require(_0xb90d('0x3'));var express=require(_0xb90d('0x4'));var router=express[_0xb90d('0x5')]();var fs_extra=require(_0xb90d('0x6'));var auth=require(_0xb90d('0x7'));var interaction=require(_0xb90d('0x8'));var config=require('../../config/environment');var controller=require(_0xb90d('0x9'));router[_0xb90d('0xa')]('/',auth[_0xb90d('0xb')](),controller[_0xb90d('0xc')]);router[_0xb90d('0xa')](_0xb90d('0xd'),auth['isAuthenticated'](),controller[_0xb90d('0xe')]);router[_0xb90d('0xf')]('/',auth[_0xb90d('0xb')](),controller['create']);router[_0xb90d('0x10')](_0xb90d('0xd'),auth[_0xb90d('0xb')](),controller[_0xb90d('0x11')]);router['delete'](_0xb90d('0xd'),auth[_0xb90d('0xb')](),controller[_0xb90d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 82f63e0..326b60b 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 _0x71a8=['sequelize','lodash','exports','getDataValue','name','STRING','TEXT','long','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice'];(function(_0x342483,_0x52d735){var _0x111dce=function(_0xa2e763){while(--_0xa2e763){_0x342483['push'](_0x342483['shift']());}};_0x111dce(++_0x52d735);}(_0x71a8,0x7e));var _0x871a=function(_0x3e3873,_0xf2c1d){_0x3e3873=_0x3e3873-0x0;var _0x1ebf7e=_0x71a8[_0x3e3873];return _0x1ebf7e;};'use strict';var Sequelize=require(_0x871a('0x0'));var _=require(_0x871a('0x1'));module[_0x871a('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x594d21){return this['getDataValue']('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3a6b32){this['setDataValue']('alias',_0x3a6b32?_0x3a6b32:this[_0x871a('0x3')](_0x871a('0x4')));}},'type':{'type':Sequelize[_0x871a('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x871a('0x6')](_0x871a('0x7')),'get':function(){if(this['getDataValue'](_0x871a('0x8'))===_0x871a('0x9')){return JSON[_0x871a('0xa')](this[_0x871a('0x3')](_0x871a('0xb')));}else{return this[_0x871a('0x3')](_0x871a('0xb'));}},'set':function(_0xeeff3f){if(Array[_0x871a('0xc')](_0xeeff3f)){this[_0x871a('0xd')](_0x871a('0xb'),JSON[_0x871a('0xe')](_0xeeff3f));}else{this[_0x871a('0xd')]('values',_0xeeff3f);}}},'required':{'type':Sequelize[_0x871a('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x871a('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x871a('0x10')](_0x871a('0x11'))}}; \ No newline at end of file +var _0xfba9=['alias','STRING','setDataValue','getDataValue','name','long','type','select','parse','values','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL'];(function(_0x1e1082,_0x264907){var _0x10a267=function(_0x4055ff){while(--_0x4055ff){_0x1e1082['push'](_0x1e1082['shift']());}};_0x10a267(++_0x264907);}(_0xfba9,0xfd));var _0x9fba=function(_0x95cf3f,_0x25e260){_0x95cf3f=_0x95cf3f-0x0;var _0x305d5f=_0xfba9[_0x95cf3f];return _0x305d5f;};'use strict';var Sequelize=require('sequelize');var _=require(_0x9fba('0x0'));module[_0x9fba('0x1')]={'name':{'type':Sequelize[_0x9fba('0x2')],'get':function(_0x4a6baf){return this['getDataValue'](_0x9fba('0x3'));}},'alias':{'type':Sequelize[_0x9fba('0x4')],'allowNull':![],'set':function(_0x3c9648){this[_0x9fba('0x5')](_0x9fba('0x3'),_0x3c9648?_0x3c9648:this[_0x9fba('0x6')](_0x9fba('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x9fba('0x8')),'get':function(){if(this[_0x9fba('0x6')](_0x9fba('0x9'))===_0x9fba('0xa')){return JSON[_0x9fba('0xb')](this['getDataValue'](_0x9fba('0xc')));}else{return this['getDataValue'](_0x9fba('0xc'));}},'set':function(_0x450782){if(Array['isArray'](_0x450782)){this[_0x9fba('0x5')](_0x9fba('0xc'),JSON['stringify'](_0x450782));}else{this[_0x9fba('0x5')](_0x9fba('0xc'),_0x450782);}}},'required':{'type':Sequelize[_0x9fba('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x9fba('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x9fba('0xe')](_0x9fba('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 7cdc694..177a935 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 _0x39bb=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','find','body','sequelize','create','Sequelize','text','number','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse'];(function(_0x11acf6,_0x864458){var _0x4cdacc=function(_0x41f990){while(--_0x41f990){_0x11acf6['push'](_0x11acf6['shift']());}};_0x4cdacc(++_0x864458);}(_0x39bb,0x1e3));var _0xb39b=function(_0x43a84a,_0x6c500e){_0x43a84a=_0x43a84a-0x0;var _0x2ed43a=_0x39bb[_0x43a84a];return _0x2ed43a;};'use strict';var emlformat=require(_0xb39b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb39b('0x1'));var jsonpatch=require(_0xb39b('0x2'));var rp=require('request-promise');var moment=require(_0xb39b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb39b('0x4'));var util=require(_0xb39b('0x5'));var path=require(_0xb39b('0x6'));var sox=require(_0xb39b('0x7'));var csv=require(_0xb39b('0x8'));var ejs=require(_0xb39b('0x9'));var fs=require('fs');var fs_extra=require(_0xb39b('0xa'));var _=require('lodash');var squel=require(_0xb39b('0xb'));var crypto=require(_0xb39b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb39b('0xd'));var toCsv=require(_0xb39b('0x8'));var querystring=require('querystring');var Papa=require(_0xb39b('0xe'));var Redis=require('ioredis');var authService=require(_0xb39b('0xf'));var qs=require(_0xb39b('0x10'));var as=require(_0xb39b('0x11'));var hardwareService=require(_0xb39b('0x12'));var logger=require(_0xb39b('0x13'))(_0xb39b('0x14'));var utils=require(_0xb39b('0x15'));var config=require(_0xb39b('0x16'));var licenseUtil=require(_0xb39b('0x17'));var db=require(_0xb39b('0x18'))['db'];function respondWithStatusCode(_0x2bcc96,_0x166e49){_0x166e49=_0x166e49||0xcc;return function(_0x42a0a4){if(_0x42a0a4){return _0x2bcc96[_0xb39b('0x19')](_0x166e49);}return _0x2bcc96[_0xb39b('0x1a')](_0x166e49)['end']();};}function respondWithResult(_0x20c8ab,_0x45e70a){_0x45e70a=_0x45e70a||0xc8;return function(_0x59f845){if(_0x59f845){return _0x20c8ab[_0xb39b('0x1a')](_0x45e70a)[_0xb39b('0x1b')](_0x59f845);}};}function respondWithFilteredResult(_0x45538,_0xca0436){return function(_0x2f8d82){if(_0x2f8d82){var _0x4153ef=typeof _0xca0436[_0xb39b('0x1c')]==='undefined'&&typeof _0xca0436['limit']===_0xb39b('0x1d');var _0x4127ea=_0x2f8d82[_0xb39b('0x1e')];var _0x1924f9=_0x4153ef?0x0:_0xca0436[_0xb39b('0x1c')];var _0x1914d6=_0x4153ef?_0x2f8d82['count']:_0xca0436['offset']+_0xca0436[_0xb39b('0x1f')];var _0x506932;if(_0x1914d6>=_0x4127ea){_0x1914d6=_0x4127ea;_0x506932=0xc8;}else{_0x506932=0xce;}_0x45538[_0xb39b('0x1a')](_0x506932);return _0x45538[_0xb39b('0x20')](_0xb39b('0x21'),_0x1924f9+'-'+_0x1914d6+'/'+_0x4127ea)[_0xb39b('0x1b')](_0x2f8d82);}return null;};}function patchUpdates(_0x5ccaa1){return function(_0x2d0ec4){try{jsonpatch[_0xb39b('0x22')](_0x2d0ec4,_0x5ccaa1,!![]);}catch(_0x8134e6){return BPromise[_0xb39b('0x23')](_0x8134e6);}return _0x2d0ec4[_0xb39b('0x24')]();};}function saveUpdates(_0x3c2cd3,_0x57d407){return function(_0x5b6acd){if(_0x5b6acd){return _0x5b6acd[_0xb39b('0x25')](_0x3c2cd3)[_0xb39b('0x26')](function(_0x557092){return _0x557092;});}return null;};}function removeEntity(_0x4ee541,_0x5116f2){return function(_0x2894bd){if(_0x2894bd){return _0x2894bd['destroy']()[_0xb39b('0x26')](function(){_0x4ee541['status'](0xcc)[_0xb39b('0x27')]();});}};}function handleEntityNotFound(_0x18cea3,_0x13263b){return function(_0x43d99e){if(!_0x43d99e){_0x18cea3[_0xb39b('0x19')](0x194);}return _0x43d99e;};}function handleError(_0x396c7b,_0x546084){_0x546084=_0x546084||0x1f4;return function(_0x94168f){logger['error'](_0x94168f['stack']);if(_0x94168f[_0xb39b('0x28')]){delete _0x94168f['name'];}_0x396c7b['status'](_0x546084)[_0xb39b('0x29')](_0x94168f);};}exports[_0xb39b('0x2a')]=function(_0x5c357c,_0x56bfcf){var _0x18389d={},_0x314f7a={},_0x4e37cf={'count':0x0,'rows':[]};var _0x10e216=_[_0xb39b('0x2b')](db[_0xb39b('0x2c')][_0xb39b('0x2d')],function(_0x2023c1){return{'name':_0x2023c1['fieldName'],'type':_0x2023c1[_0xb39b('0x2e')][_0xb39b('0x2f')]};});_0x314f7a[_0xb39b('0x30')]=_[_0xb39b('0x31')](_[_0xb39b('0x2b')](_0x10e216,'name'),['name']);_0x314f7a[_0xb39b('0x32')]=_[_0xb39b('0x33')](_0x5c357c['query']);_0x314f7a[_0xb39b('0x34')]=_[_0xb39b('0x35')](_0x314f7a[_0xb39b('0x30')],_0x314f7a[_0xb39b('0x32')]);_0x18389d[_0xb39b('0x36')]=_[_0xb39b('0x35')](_0x314f7a[_0xb39b('0x30')],qs[_0xb39b('0x37')](_0x5c357c[_0xb39b('0x32')][_0xb39b('0x37')]));_0x18389d[_0xb39b('0x36')]=_0x18389d[_0xb39b('0x36')][_0xb39b('0x38')]?_0x18389d[_0xb39b('0x36')]:_0x314f7a['model'];if(!_0x5c357c['query']['hasOwnProperty'](_0xb39b('0x39'))){_0x18389d[_0xb39b('0x1f')]=qs[_0xb39b('0x1f')](_0x5c357c['query'][_0xb39b('0x1f')]);_0x18389d[_0xb39b('0x1c')]=qs[_0xb39b('0x1c')](_0x5c357c[_0xb39b('0x32')]['offset']);}_0x18389d[_0xb39b('0x3a')]=qs[_0xb39b('0x3b')](_0x5c357c[_0xb39b('0x32')][_0xb39b('0x3b')]);_0x18389d[_0xb39b('0x3c')]=qs[_0xb39b('0x34')](_[_0xb39b('0x3d')](_0x5c357c['query'],_0x314f7a[_0xb39b('0x34')]),_0x10e216);if(_0x5c357c[_0xb39b('0x32')][_0xb39b('0x3e')]){_0x18389d[_0xb39b('0x3c')]=_[_0xb39b('0x3f')](_0x18389d['where'],{'$or':_[_0xb39b('0x2b')](_0x10e216,function(_0x4541dd){if(_0x4541dd[_0xb39b('0x2e')]!=='VIRTUAL'){var _0x45d096={};_0x45d096[_0x4541dd[_0xb39b('0x28')]]={'$like':'%'+_0x5c357c[_0xb39b('0x32')][_0xb39b('0x3e')]+'%'};return _0x45d096;}})});}_0x18389d=_[_0xb39b('0x3f')]({},_0x18389d,_0x5c357c['options']);var _0x57f31c={'where':_0x18389d['where']};return db[_0xb39b('0x2c')][_0xb39b('0x1e')](_0x57f31c)[_0xb39b('0x26')](function(_0x22fbdf){_0x4e37cf[_0xb39b('0x1e')]=_0x22fbdf;if(_0x5c357c[_0xb39b('0x32')]['includeAll']){_0x18389d[_0xb39b('0x40')]=[{'all':!![]}];}return db[_0xb39b('0x2c')][_0xb39b('0x41')](_0x18389d);})[_0xb39b('0x26')](function(_0x2d00d0){_0x4e37cf[_0xb39b('0x42')]=_0x2d00d0;return _0x4e37cf;})[_0xb39b('0x26')](respondWithFilteredResult(_0x56bfcf,_0x18389d))[_0xb39b('0x43')](handleError(_0x56bfcf,null));};exports[_0xb39b('0x44')]=function(_0x4594a9,_0x57692c){var _0x3e58dc={'raw':!![],'where':{'id':_0x4594a9[_0xb39b('0x45')]['id']}},_0x1bf3c3={};_0x1bf3c3[_0xb39b('0x30')]=_[_0xb39b('0x33')](db['CmCustomField'][_0xb39b('0x2d')]);_0x1bf3c3[_0xb39b('0x32')]=_[_0xb39b('0x33')](_0x4594a9[_0xb39b('0x32')]);_0x1bf3c3['filters']=_[_0xb39b('0x35')](_0x1bf3c3[_0xb39b('0x30')],_0x1bf3c3[_0xb39b('0x32')]);_0x3e58dc['attributes']=_['intersection'](_0x1bf3c3[_0xb39b('0x30')],qs[_0xb39b('0x37')](_0x4594a9['query'][_0xb39b('0x37')]));_0x3e58dc[_0xb39b('0x36')]=_0x3e58dc[_0xb39b('0x36')][_0xb39b('0x38')]?_0x3e58dc['attributes']:_0x1bf3c3[_0xb39b('0x30')];if(_0x4594a9[_0xb39b('0x32')]['includeAll']){_0x3e58dc[_0xb39b('0x40')]=[{'all':!![]}];}_0x3e58dc=_[_0xb39b('0x3f')]({},_0x3e58dc,_0x4594a9['options']);return db[_0xb39b('0x2c')]['find'](_0x3e58dc)['then'](handleEntityNotFound(_0x57692c,null))['then'](respondWithResult(_0x57692c,null))[_0xb39b('0x43')](handleError(_0x57692c,null));};exports[_0xb39b('0x25')]=function(_0x5558b0,_0x1d9139){if(_0x5558b0['body']['id']){delete _0x5558b0['body']['id'];}return db[_0xb39b('0x2c')][_0xb39b('0x46')]({'where':{'id':_0x5558b0[_0xb39b('0x45')]['id']}})[_0xb39b('0x26')](handleEntityNotFound(_0x1d9139,null))[_0xb39b('0x26')](saveUpdates(_0x5558b0[_0xb39b('0x47')],null))[_0xb39b('0x26')](respondWithResult(_0x1d9139,null))[_0xb39b('0x43')](handleError(_0x1d9139,null));};exports['destroy']=function(_0x354a79,_0x28b16c){return db[_0xb39b('0x2c')][_0xb39b('0x46')]({'where':{'id':_0x354a79[_0xb39b('0x45')]['id']}})['then'](handleEntityNotFound(_0x28b16c,null))[_0xb39b('0x26')](removeEntity(_0x28b16c,null))[_0xb39b('0x43')](handleError(_0x28b16c,null));};exports['create']=function(_0x3b8b2f,_0xecf7f3){var _0x2fdd35;return db[_0xb39b('0x48')]['transaction'](function(_0x170f97){return db[_0xb39b('0x2c')][_0xb39b('0x49')](_0x3b8b2f[_0xb39b('0x47')],{'transaction':_0x170f97})['then'](function(_0x91dd85){_0x2fdd35=_0x91dd85;var _0x5c2422={'type':db[_0xb39b('0x4a')]['TEXT'],'transaction':_0x170f97};switch(_0x3b8b2f[_0xb39b('0x47')][_0xb39b('0x2e')]){case _0xb39b('0x4b'):_0x5c2422[_0xb39b('0x2e')]=db[_0xb39b('0x4a')]['TEXT'];break;case _0xb39b('0x4c'):_0x5c2422[_0xb39b('0x2e')]=db['Sequelize']['INTEGER'];break;case _0xb39b('0x4d'):_0x5c2422[_0xb39b('0x2e')]=db[_0xb39b('0x4a')]['BOOLEAN'];_0x5c2422[_0xb39b('0x4e')]=![];break;default:}return db['sequelize'][_0xb39b('0x4f')][_0xb39b('0x50')](_0xb39b('0x51'),util[_0xb39b('0x52')]('cf_%d',_0x2fdd35['id']),_0x5c2422);})[_0xb39b('0x26')](function(){return _0x2fdd35;});})[_0xb39b('0x26')](respondWithResult(_0xecf7f3,0xc9))[_0xb39b('0x43')](handleError(_0xecf7f3,null));}; \ No newline at end of file +var _0x2a53=['length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','body','find','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','defaultValue','queryInterface','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields'];(function(_0x791c7b,_0x49bbb6){var _0x110508=function(_0x3d156e){while(--_0x3d156e){_0x791c7b['push'](_0x791c7b['shift']());}};_0x110508(++_0x49bbb6);}(_0x2a53,0x1de));var _0x32a5=function(_0x460fd7,_0x2012db){_0x460fd7=_0x460fd7-0x0;var _0x44d1c2=_0x2a53[_0x460fd7];return _0x44d1c2;};'use strict';var emlformat=require(_0x32a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32a5('0x1'));var jsonpatch=require(_0x32a5('0x2'));var rp=require('request-promise');var moment=require(_0x32a5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x32a5('0x4'));var util=require(_0x32a5('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x32a5('0x6'));var fs=require('fs');var fs_extra=require(_0x32a5('0x7'));var _=require(_0x32a5('0x8'));var squel=require(_0x32a5('0x9'));var crypto=require(_0x32a5('0xa'));var jsforce=require(_0x32a5('0xb'));var deskjs=require(_0x32a5('0xc'));var toCsv=require(_0x32a5('0xd'));var querystring=require('querystring');var Papa=require(_0x32a5('0xe'));var Redis=require('ioredis');var authService=require(_0x32a5('0xf'));var qs=require(_0x32a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32a5('0x11'));var logger=require(_0x32a5('0x12'))(_0x32a5('0x13'));var utils=require(_0x32a5('0x14'));var config=require(_0x32a5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x32a5('0x16'))['db'];function respondWithStatusCode(_0x5f8be6,_0x2a931e){_0x2a931e=_0x2a931e||0xcc;return function(_0x5b8843){if(_0x5b8843){return _0x5f8be6['sendStatus'](_0x2a931e);}return _0x5f8be6[_0x32a5('0x17')](_0x2a931e)[_0x32a5('0x18')]();};}function respondWithResult(_0x52b371,_0x4f929c){_0x4f929c=_0x4f929c||0xc8;return function(_0x388ce6){if(_0x388ce6){return _0x52b371['status'](_0x4f929c)[_0x32a5('0x19')](_0x388ce6);}};}function respondWithFilteredResult(_0x33201a,_0x1a6d7d){return function(_0x43bdec){if(_0x43bdec){var _0x42686b=typeof _0x1a6d7d[_0x32a5('0x1a')]==='undefined'&&typeof _0x1a6d7d['limit']===_0x32a5('0x1b');var _0x198654=_0x43bdec[_0x32a5('0x1c')];var _0x1ca977=_0x42686b?0x0:_0x1a6d7d[_0x32a5('0x1a')];var _0x14c34e=_0x42686b?_0x43bdec['count']:_0x1a6d7d[_0x32a5('0x1a')]+_0x1a6d7d[_0x32a5('0x1d')];var _0x400c91;if(_0x14c34e>=_0x198654){_0x14c34e=_0x198654;_0x400c91=0xc8;}else{_0x400c91=0xce;}_0x33201a[_0x32a5('0x17')](_0x400c91);return _0x33201a[_0x32a5('0x1e')](_0x32a5('0x1f'),_0x1ca977+'-'+_0x14c34e+'/'+_0x198654)[_0x32a5('0x19')](_0x43bdec);}return null;};}function patchUpdates(_0x2d3e30){return function(_0x1565b3){try{jsonpatch['apply'](_0x1565b3,_0x2d3e30,!![]);}catch(_0x448f0d){return BPromise[_0x32a5('0x20')](_0x448f0d);}return _0x1565b3[_0x32a5('0x21')]();};}function saveUpdates(_0x176afc,_0x106f1e){return function(_0x541425){if(_0x541425){return _0x541425[_0x32a5('0x22')](_0x176afc)[_0x32a5('0x23')](function(_0x18be4c){return _0x18be4c;});}return null;};}function removeEntity(_0xd1f66c,_0x408959){return function(_0x326b57){if(_0x326b57){return _0x326b57[_0x32a5('0x24')]()[_0x32a5('0x23')](function(){_0xd1f66c[_0x32a5('0x17')](0xcc)[_0x32a5('0x18')]();});}};}function handleEntityNotFound(_0x39538d,_0x3053ba){return function(_0x18c0f8){if(!_0x18c0f8){_0x39538d[_0x32a5('0x25')](0x194);}return _0x18c0f8;};}function handleError(_0x314ab9,_0x4c3049){_0x4c3049=_0x4c3049||0x1f4;return function(_0x472b2b){logger[_0x32a5('0x26')](_0x472b2b[_0x32a5('0x27')]);if(_0x472b2b[_0x32a5('0x28')]){delete _0x472b2b[_0x32a5('0x28')];}_0x314ab9[_0x32a5('0x17')](_0x4c3049)[_0x32a5('0x29')](_0x472b2b);};}exports[_0x32a5('0x2a')]=function(_0x306e48,_0x47fbef){var _0x55bfa6={},_0xec5b6={},_0x329071={'count':0x0,'rows':[]};var _0x33a196=_[_0x32a5('0x2b')](db[_0x32a5('0x2c')][_0x32a5('0x2d')],function(_0x2b6eb6){return{'name':_0x2b6eb6[_0x32a5('0x2e')],'type':_0x2b6eb6[_0x32a5('0x2f')][_0x32a5('0x30')]};});_0xec5b6[_0x32a5('0x31')]=_[_0x32a5('0x32')](_[_0x32a5('0x2b')](_0x33a196,_0x32a5('0x28')),[_0x32a5('0x28')]);_0xec5b6[_0x32a5('0x33')]=_['keys'](_0x306e48[_0x32a5('0x33')]);_0xec5b6[_0x32a5('0x34')]=_[_0x32a5('0x35')](_0xec5b6[_0x32a5('0x31')],_0xec5b6[_0x32a5('0x33')]);_0x55bfa6[_0x32a5('0x36')]=_[_0x32a5('0x35')](_0xec5b6[_0x32a5('0x31')],qs['fields'](_0x306e48[_0x32a5('0x33')][_0x32a5('0x37')]));_0x55bfa6[_0x32a5('0x36')]=_0x55bfa6[_0x32a5('0x36')][_0x32a5('0x38')]?_0x55bfa6[_0x32a5('0x36')]:_0xec5b6[_0x32a5('0x31')];if(!_0x306e48['query'][_0x32a5('0x39')]('nolimit')){_0x55bfa6[_0x32a5('0x1d')]=qs['limit'](_0x306e48['query'][_0x32a5('0x1d')]);_0x55bfa6['offset']=qs[_0x32a5('0x1a')](_0x306e48[_0x32a5('0x33')]['offset']);}_0x55bfa6[_0x32a5('0x3a')]=qs[_0x32a5('0x3b')](_0x306e48[_0x32a5('0x33')][_0x32a5('0x3b')]);_0x55bfa6['where']=qs['filters'](_[_0x32a5('0x3c')](_0x306e48[_0x32a5('0x33')],_0xec5b6['filters']),_0x33a196);if(_0x306e48[_0x32a5('0x33')][_0x32a5('0x3d')]){_0x55bfa6[_0x32a5('0x3e')]=_[_0x32a5('0x3f')](_0x55bfa6[_0x32a5('0x3e')],{'$or':_[_0x32a5('0x2b')](_0x33a196,function(_0x48979f){if(_0x48979f[_0x32a5('0x2f')]!=='VIRTUAL'){var _0x3177c7={};_0x3177c7[_0x48979f['name']]={'$like':'%'+_0x306e48[_0x32a5('0x33')][_0x32a5('0x3d')]+'%'};return _0x3177c7;}})});}_0x55bfa6=_[_0x32a5('0x3f')]({},_0x55bfa6,_0x306e48[_0x32a5('0x40')]);var _0x2f3e60={'where':_0x55bfa6[_0x32a5('0x3e')]};return db['CmCustomField'][_0x32a5('0x1c')](_0x2f3e60)[_0x32a5('0x23')](function(_0x32bffb){_0x329071[_0x32a5('0x1c')]=_0x32bffb;if(_0x306e48[_0x32a5('0x33')][_0x32a5('0x41')]){_0x55bfa6[_0x32a5('0x42')]=[{'all':!![]}];}return db[_0x32a5('0x2c')][_0x32a5('0x43')](_0x55bfa6);})[_0x32a5('0x23')](function(_0x44d553){_0x329071[_0x32a5('0x44')]=_0x44d553;return _0x329071;})[_0x32a5('0x23')](respondWithFilteredResult(_0x47fbef,_0x55bfa6))['catch'](handleError(_0x47fbef,null));};exports[_0x32a5('0x45')]=function(_0x48f7bc,_0x136b8e){var _0x39c99e={'raw':!![],'where':{'id':_0x48f7bc[_0x32a5('0x46')]['id']}},_0x4e6013={};_0x4e6013[_0x32a5('0x31')]=_[_0x32a5('0x47')](db[_0x32a5('0x2c')][_0x32a5('0x2d')]);_0x4e6013[_0x32a5('0x33')]=_['keys'](_0x48f7bc[_0x32a5('0x33')]);_0x4e6013[_0x32a5('0x34')]=_[_0x32a5('0x35')](_0x4e6013[_0x32a5('0x31')],_0x4e6013[_0x32a5('0x33')]);_0x39c99e[_0x32a5('0x36')]=_[_0x32a5('0x35')](_0x4e6013[_0x32a5('0x31')],qs[_0x32a5('0x37')](_0x48f7bc[_0x32a5('0x33')][_0x32a5('0x37')]));_0x39c99e['attributes']=_0x39c99e[_0x32a5('0x36')][_0x32a5('0x38')]?_0x39c99e['attributes']:_0x4e6013[_0x32a5('0x31')];if(_0x48f7bc[_0x32a5('0x33')]['includeAll']){_0x39c99e[_0x32a5('0x42')]=[{'all':!![]}];}_0x39c99e=_[_0x32a5('0x3f')]({},_0x39c99e,_0x48f7bc[_0x32a5('0x40')]);return db['CmCustomField']['find'](_0x39c99e)[_0x32a5('0x23')](handleEntityNotFound(_0x136b8e,null))['then'](respondWithResult(_0x136b8e,null))[_0x32a5('0x48')](handleError(_0x136b8e,null));};exports['update']=function(_0x18c200,_0x54063d){if(_0x18c200[_0x32a5('0x49')]['id']){delete _0x18c200[_0x32a5('0x49')]['id'];}return db[_0x32a5('0x2c')][_0x32a5('0x4a')]({'where':{'id':_0x18c200['params']['id']}})[_0x32a5('0x23')](handleEntityNotFound(_0x54063d,null))[_0x32a5('0x23')](saveUpdates(_0x18c200[_0x32a5('0x49')],null))[_0x32a5('0x23')](respondWithResult(_0x54063d,null))[_0x32a5('0x48')](handleError(_0x54063d,null));};exports['destroy']=function(_0x2aaa3a,_0x57c0ec){return db[_0x32a5('0x2c')][_0x32a5('0x4a')]({'where':{'id':_0x2aaa3a[_0x32a5('0x46')]['id']}})[_0x32a5('0x23')](handleEntityNotFound(_0x57c0ec,null))['then'](removeEntity(_0x57c0ec,null))[_0x32a5('0x48')](handleError(_0x57c0ec,null));};exports[_0x32a5('0x4b')]=function(_0x5f088d,_0x90070f){var _0xbdd1b1;return db[_0x32a5('0x4c')][_0x32a5('0x4d')](function(_0x1c702a){return db['CmCustomField'][_0x32a5('0x4b')](_0x5f088d[_0x32a5('0x49')],{'transaction':_0x1c702a})[_0x32a5('0x23')](function(_0x24bfa6){_0xbdd1b1=_0x24bfa6;var _0x339eb0={'type':db[_0x32a5('0x4e')]['TEXT'],'transaction':_0x1c702a};switch(_0x5f088d[_0x32a5('0x49')][_0x32a5('0x2f')]){case _0x32a5('0x4f'):_0x339eb0[_0x32a5('0x2f')]=db[_0x32a5('0x4e')][_0x32a5('0x50')];break;case _0x32a5('0x51'):_0x339eb0['type']=db[_0x32a5('0x4e')][_0x32a5('0x52')];break;case _0x32a5('0x53'):_0x339eb0[_0x32a5('0x2f')]=db[_0x32a5('0x4e')]['BOOLEAN'];_0x339eb0[_0x32a5('0x54')]=![];break;default:}return db[_0x32a5('0x4c')][_0x32a5('0x55')]['addColumn'](_0x32a5('0x56'),util[_0x32a5('0x57')](_0x32a5('0x58'),_0xbdd1b1['id']),_0x339eb0);})[_0x32a5('0x23')](function(){return _0xbdd1b1;});})[_0x32a5('0x23')](respondWithResult(_0x90070f,0xc9))[_0x32a5('0x48')](handleError(_0x90070f,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 6a4b19f..b23ffd1 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 _0x8801=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment'];(function(_0x1b2893,_0x4e11c7){var _0x529c63=function(_0x1cf98a){while(--_0x1cf98a){_0x1b2893['push'](_0x1b2893['shift']());}};_0x529c63(++_0x4e11c7);}(_0x8801,0x96));var _0x1880=function(_0x16627e,_0x559d93){_0x16627e=_0x16627e-0x0;var _0x4e52db=_0x8801[_0x16627e];return _0x4e52db;};'use strict';var _=require(_0x1880('0x0'));var util=require(_0x1880('0x1'));var logger=require(_0x1880('0x2'))('api');var moment=require(_0x1880('0x3'));var BPromise=require(_0x1880('0x4'));var rp=require(_0x1880('0x5'));var fs=require('fs');var path=require(_0x1880('0x6'));var rimraf=require(_0x1880('0x7'));var config=require(_0x1880('0x8'));var attributes=require(_0x1880('0x9'));module[_0x1880('0xa')]=function(_0x5abb33,_0x3ee106){return _0x5abb33[_0x1880('0xb')](_0x1880('0xc'),attributes,{'tableName':_0x1880('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8226=['util','api','bluebird','request-promise','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash'];(function(_0x22dacf,_0x1fd2b0){var _0x536bbe=function(_0x1506fd){while(--_0x1506fd){_0x22dacf['push'](_0x22dacf['shift']());}};_0x536bbe(++_0x1fd2b0);}(_0x8226,0x121));var _0x6822=function(_0x230747,_0x26a388){_0x230747=_0x230747-0x0;var _0xfe319b=_0x8226[_0x230747];return _0xfe319b;};'use strict';var _=require(_0x6822('0x0'));var util=require(_0x6822('0x1'));var logger=require('../../config/logger')(_0x6822('0x2'));var moment=require('moment');var BPromise=require(_0x6822('0x3'));var rp=require(_0x6822('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6822('0x5'));var attributes=require('./cmCustomField.attributes');module[_0x6822('0x6')]=function(_0x2fa519,_0x313638){return _0x2fa519[_0x6822('0x7')](_0x6822('0x8'),attributes,{'tableName':_0x6822('0x9'),'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 41fdfb0..edb0111 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 _0x4067=['lodash','randomstring','../../mysqldb','../../config/utils','jayson/promise','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x4067,0xd0));var _0x7406=function(_0x300e03,_0x35bf0a){_0x300e03=_0x300e03-0x0;var _0xf4711b=_0x4067[_0x300e03];return _0xf4711b;};'use strict';var _=require(_0x7406('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7406('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7406('0x2'))['db'];var utils=require(_0x7406('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7406('0x4'));var client=jayson['client'][_0x7406('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x157903,_0x3f9913,_0x33c21d){return new BPromise(function(_0x18caf2,_0xf2ca45){return client[_0x7406('0x6')](_0x157903,_0x33c21d)['then'](function(_0xdf28e3){logger['info'](_0x7406('0x7'),_0x3f9913,_0x7406('0x8'));logger[_0x7406('0x9')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x3f9913,_0x7406('0x8'),JSON[_0x7406('0xa')](_0xdf28e3));if(_0xdf28e3[_0x7406('0xb')]){if(_0xdf28e3[_0x7406('0xb')][_0x7406('0xc')]===0x1f4){logger[_0x7406('0xb')](_0x7406('0x7'),_0x3f9913,_0xdf28e3[_0x7406('0xb')][_0x7406('0xd')]);return _0xf2ca45(_0xdf28e3[_0x7406('0xb')][_0x7406('0xd')]);}logger['error'](_0x7406('0x7'),_0x3f9913,_0xdf28e3['error']['message']);return _0x18caf2(_0xdf28e3[_0x7406('0xb')][_0x7406('0xd')]);}else{logger[_0x7406('0xe')](_0x7406('0x7'),_0x3f9913,_0x7406('0x8'));_0x18caf2(_0xdf28e3[_0x7406('0xf')][_0x7406('0xd')]);}})['catch'](function(_0x55c710){logger[_0x7406('0xb')](_0x7406('0x7'),_0x3f9913,_0x55c710);_0xf2ca45(_0x55c710);});});} \ No newline at end of file +var _0xf06f=['request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xf06f,0x1cb));var _0xff06=function(_0x254703,_0x5397c3){_0x254703=_0x254703-0x0;var _0x1f1ea4=_0xf06f[_0x254703];return _0x1f1ea4;};'use strict';var _=require(_0xff06('0x0'));var util=require(_0xff06('0x1'));var moment=require(_0xff06('0x2'));var BPromise=require(_0xff06('0x3'));var rs=require(_0xff06('0x4'));var fs=require('fs');var Redis=require(_0xff06('0x5'));var db=require(_0xff06('0x6'))['db'];var utils=require(_0xff06('0x7'));var logger=require(_0xff06('0x8'))(_0xff06('0x9'));var config=require('../../config/environment');var jayson=require(_0xff06('0xa'));var client=jayson[_0xff06('0xb')][_0xff06('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2621b0,_0xa4ddcc,_0xfecd1b){return new BPromise(function(_0x5037c5,_0x1587a7){return client[_0xff06('0xd')](_0x2621b0,_0xfecd1b)[_0xff06('0xe')](function(_0x34f5fd){logger['info'](_0xff06('0xf'),_0xa4ddcc,_0xff06('0x10'));logger[_0xff06('0x11')](_0xff06('0x12'),_0xa4ddcc,'request\x20sent',JSON[_0xff06('0x13')](_0x34f5fd));if(_0x34f5fd['error']){if(_0x34f5fd[_0xff06('0x14')]['code']===0x1f4){logger[_0xff06('0x14')]('CmCustomField,\x20%s,\x20%s',_0xa4ddcc,_0x34f5fd[_0xff06('0x14')][_0xff06('0x15')]);return _0x1587a7(_0x34f5fd[_0xff06('0x14')][_0xff06('0x15')]);}logger[_0xff06('0x14')](_0xff06('0xf'),_0xa4ddcc,_0x34f5fd[_0xff06('0x14')][_0xff06('0x15')]);return _0x5037c5(_0x34f5fd[_0xff06('0x14')]['message']);}else{logger[_0xff06('0x16')](_0xff06('0xf'),_0xa4ddcc,'request\x20sent');_0x5037c5(_0x34f5fd[_0xff06('0x17')][_0xff06('0x15')]);}})[_0xff06('0x18')](function(_0x411ff9){logger[_0xff06('0x14')](_0xff06('0xf'),_0xa4ddcc,_0x411ff9);_0x1587a7(_0x411ff9);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 6a55521..3e19a4c 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 _0x6b8f=['update','delete','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','index','/:id','isAuthenticated','put'];(function(_0xd3d75b,_0x23da46){var _0x1a6fe3=function(_0x5a61d2){while(--_0x5a61d2){_0xd3d75b['push'](_0xd3d75b['shift']());}};_0x1a6fe3(++_0x23da46);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x4ca13b,_0x155784){_0x4ca13b=_0x4ca13b-0x0;var _0x38e76a=_0x6b8f[_0x4ca13b];return _0x38e76a;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf6b8('0x2'));var auth=require(_0xf6b8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b8('0x4'));var controller=require(_0xf6b8('0x5'));router[_0xf6b8('0x6')]('/',auth['isAuthenticated'](),controller[_0xf6b8('0x7')]);router[_0xf6b8('0x6')](_0xf6b8('0x8'),auth[_0xf6b8('0x9')](),controller['show']);router['post']('/',auth[_0xf6b8('0x9')](),controller['create']);router[_0xf6b8('0xa')](_0xf6b8('0x8'),auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xb')]);router[_0xf6b8('0xc')](_0xf6b8('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa13d=['update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','create','put'];(function(_0x7feb61,_0x16ed35){var _0x5ef8ae=function(_0x1f4a3f){while(--_0x1f4a3f){_0x7feb61['push'](_0x7feb61['shift']());}};_0x5ef8ae(++_0x16ed35);}(_0xa13d,0x154));var _0xda13=function(_0x94e0d9,_0x386478){_0x94e0d9=_0x94e0d9-0x0;var _0x4805f8=_0xa13d[_0x94e0d9];return _0x4805f8;};'use strict';var multer=require(_0xda13('0x0'));var util=require('util');var path=require(_0xda13('0x1'));var timeout=require(_0xda13('0x2'));var express=require('express');var router=express[_0xda13('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xda13('0x4'));var interaction=require(_0xda13('0x5'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0xda13('0x6')]('/',auth[_0xda13('0x7')](),controller['index']);router[_0xda13('0x6')](_0xda13('0x8'),auth[_0xda13('0x7')](),controller['show']);router[_0xda13('0x9')]('/',auth[_0xda13('0x7')](),controller[_0xda13('0xa')]);router[_0xda13('0xb')](_0xda13('0x8'),auth[_0xda13('0x7')](),controller[_0xda13('0xc')]);router[_0xda13('0xd')](_0xda13('0x8'),auth[_0xda13('0x7')](),controller[_0xda13('0xe')]);module[_0xda13('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 0171b07..28710b6 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 _0x50ab=['DATE','INTEGER','BOOLEAN','contactListQueue','moment','exports','STRING'];(function(_0x463e64,_0x2dda3e){var _0x15e7ce=function(_0x109e84){while(--_0x109e84){_0x463e64['push'](_0x463e64['shift']());}};_0x15e7ce(++_0x2dda3e);}(_0x50ab,0x1cb));var _0xb50a=function(_0x1d0c7a,_0x39d7a8){_0x1d0c7a=_0x1d0c7a-0x0;var _0x3edec4=_0x50ab[_0x1d0c7a];return _0x3edec4;};'use strict';var moment=require(_0xb50a('0x0'));var Sequelize=require('sequelize');module[_0xb50a('0x1')]={'phone':{'type':Sequelize[_0xb50a('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb50a('0x3')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xb50a('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb50a('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb50a('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb50a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb50a('0x3')]},'priority':{'type':Sequelize[_0xb50a('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb50a('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb50a('0x4')],'unique':_0xb50a('0x6')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xb50a('0x6')},'UserId':{'type':Sequelize[_0xb50a('0x4')]},'VoiceQueueId':{'type':Sequelize[_0xb50a('0x4')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xb50a('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xb50a('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb50a('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb50a('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xb50a('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb50a('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xb50a('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xbe3a=['exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize'];(function(_0x397c9c,_0x3c9bd4){var _0x3da2e9=function(_0xebef09){while(--_0xebef09){_0x397c9c['push'](_0x397c9c['shift']());}};_0x3da2e9(++_0x3c9bd4);}(_0xbe3a,0xe8));var _0xabe3=function(_0x1989dd,_0x2241f6){_0x1989dd=_0x1989dd-0x0;var _0x4f32f6=_0xbe3a[_0x1989dd];return _0x4f32f6;};'use strict';var moment=require(_0xabe3('0x0'));var Sequelize=require(_0xabe3('0x1'));module[_0xabe3('0x2')]={'phone':{'type':Sequelize[_0xabe3('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xabe3('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xabe3('0x5')],'defaultValue':moment()['format'](_0xabe3('0x6'))},'countbusyretry':{'type':Sequelize[_0xabe3('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xabe3('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xabe3('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xabe3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xabe3('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xabe3('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xabe3('0x7')],'unique':_0xabe3('0x8')},'ListId':{'type':Sequelize[_0xabe3('0x7')],'unique':_0xabe3('0x8')},'UserId':{'type':Sequelize[_0xabe3('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xabe3('0x7')],'unique':_0xabe3('0x8')},'CampaignId':{'type':Sequelize[_0xabe3('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xabe3('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xabe3('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xabe3('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xabe3('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xabe3('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xabe3('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xabe3('0x5')],'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 d9f7912..fc431a2 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 _0x7dfd=['ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','getPreviewRecall','keys','recallme','LOCK','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','update','then','sendStatus','error','name','send','index','map','CmHopper','rawAttributes','fieldName','key','query','intersection','model','filters','concat','$and','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','fields','length','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','calleridnum','campaigntype','queue','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','dialOrderByScheduledAt','DESC'];(function(_0x29b3c7,_0x238e37){var _0x4c979b=function(_0x37ace1){while(--_0x37ace1){_0x29b3c7['push'](_0x29b3c7['shift']());}};_0x4c979b(++_0x238e37);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xd7df('0x0'));var _=require(_0xd7df('0x1'));var qs=require(_0xd7df('0x2'));var logger=require(_0xd7df('0x3'))(_0xd7df('0x4'));var shared=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];function respondWithResult(_0x38eee7,_0x3ef231){_0x3ef231=_0x3ef231||0xc8;return function(_0x3d8c5a){if(_0x3d8c5a){return _0x38eee7[_0xd7df('0x7')](_0x3ef231)[_0xd7df('0x8')](_0x3d8c5a);}};}function respondWithFilteredResult(_0x36cf0f,_0x39ce98){return function(_0x354ea7){if(_0x354ea7){var _0x16e50=typeof _0x39ce98[_0xd7df('0x9')]==='undefined'&&typeof _0x39ce98[_0xd7df('0xa')]===_0xd7df('0xb');var _0x14ba9c=_0x354ea7[_0xd7df('0xc')];var _0x5e59c3=_0x16e50?0x0:_0x39ce98[_0xd7df('0x9')];var _0x532c14=_0x16e50?_0x354ea7[_0xd7df('0xc')]:_0x39ce98['offset']+_0x39ce98[_0xd7df('0xa')];var _0x82f1c0;if(_0x532c14>=_0x14ba9c){_0x532c14=_0x14ba9c;_0x82f1c0=0xc8;}else{_0x82f1c0=0xce;}_0x36cf0f[_0xd7df('0x7')](_0x82f1c0);return _0x36cf0f[_0xd7df('0xd')](_0xd7df('0xe'),_0x5e59c3+'-'+_0x532c14+'/'+_0x14ba9c)[_0xd7df('0x8')](_0x354ea7);}return null;};}function saveUpdates(_0x2e8187,_0x3da618){return function(_0x7ba3c){if(_0x7ba3c){return _0x7ba3c[_0xd7df('0xf')](_0x2e8187)[_0xd7df('0x10')](function(_0x4723b7){return _0x4723b7;});}return null;};}function handleEntityNotFound(_0xe1595f,_0x196632){return function(_0x3b2559){if(!_0x3b2559){_0xe1595f[_0xd7df('0x11')](0x194);}return _0x3b2559;};}function handleError(_0x31f557,_0x57b8be){_0x57b8be=_0x57b8be||0x1f4;return function(_0x4c5cf){logger[_0xd7df('0x12')](_0x4c5cf['stack']);if(_0x4c5cf[_0xd7df('0x13')]){delete _0x4c5cf[_0xd7df('0x13')];}_0x31f557['status'](_0x57b8be)[_0xd7df('0x14')](_0x4c5cf);};}exports[_0xd7df('0x15')]=function(_0x35e0a,_0x5210e5){var _0x40167d={},_0x471621={},_0x3cea3={'count':0x0,'rows':[]};var _0x5ba653=_[_0xd7df('0x16')](db[_0xd7df('0x17')][_0xd7df('0x18')],function(_0x5acb0a){return{'name':_0x5acb0a[_0xd7df('0x19')],'type':_0x5acb0a['type'][_0xd7df('0x1a')]};});_0x471621['model']=_[_0xd7df('0x16')](_0x5ba653,_0xd7df('0x13'));_0x471621[_0xd7df('0x1b')]=_['keys'](_0x35e0a[_0xd7df('0x1b')]);_0x471621['filters']=_[_0xd7df('0x1c')](_0x471621[_0xd7df('0x1d')],_0x471621[_0xd7df('0x1b')]);_0x471621[_0xd7df('0x1e')]=_[_0xd7df('0x1f')](_0x471621[_0xd7df('0x1e')],[_0xd7df('0x20'),'$or','$gt',_0xd7df('0x21'),_0xd7df('0x22'),_0xd7df('0x23'),_0xd7df('0x24'),_0xd7df('0x25'),_0xd7df('0x26'),_0xd7df('0x27'),_0xd7df('0x28'),_0xd7df('0x29'),'$notIn',_0xd7df('0x2a'),_0xd7df('0x2b'),_0xd7df('0x2c'),_0xd7df('0x2d'),_0xd7df('0x2a'),_0xd7df('0x2e'),_0xd7df('0x2f'),_0xd7df('0x30'),'$any']);_0x40167d['attributes']=_['intersection'](_0x471621['model'],qs['fields'](_0x35e0a[_0xd7df('0x1b')]['fields']));_0x40167d[_0xd7df('0x31')]=_0x40167d[_0xd7df('0x31')]['length']?_0x40167d[_0xd7df('0x31')]:_0x471621[_0xd7df('0x1d')];if(!_0x35e0a['query'][_0xd7df('0x32')](_0xd7df('0x33'))){_0x40167d[_0xd7df('0xa')]=qs[_0xd7df('0xa')](_0x35e0a[_0xd7df('0x1b')][_0xd7df('0xa')]);_0x40167d['offset']=qs[_0xd7df('0x9')](_0x35e0a[_0xd7df('0x1b')][_0xd7df('0x9')]);}_0x40167d[_0xd7df('0x34')]=qs[_0xd7df('0x35')](_0x35e0a[_0xd7df('0x1b')][_0xd7df('0x35')]);_0x40167d[_0xd7df('0x36')]=qs[_0xd7df('0x1e')](_[_0xd7df('0x37')](_0x35e0a[_0xd7df('0x1b')],_0x471621['filters']),_0x5ba653);if(_0x35e0a['query'][_0xd7df('0x38')]){_0x40167d['where']=_[_0xd7df('0x39')](_0x40167d[_0xd7df('0x36')],{'$or':_[_0xd7df('0x16')](_0x5ba653,function(_0x1417eb){if(_0x1417eb['type']!=='VIRTUAL'){var _0x57481a={};_0x57481a[_0x1417eb[_0xd7df('0x13')]]={'$like':'%'+_0x35e0a[_0xd7df('0x1b')]['filter']+'%'};return _0x57481a;}})});}_0x40167d=_[_0xd7df('0x39')]({},_0x40167d,_0x35e0a[_0xd7df('0x3a')]);var _0x4bda0e={'where':_0x40167d[_0xd7df('0x36')]};return db['CmHopper'][_0xd7df('0xc')](_0x4bda0e)[_0xd7df('0x10')](function(_0x5f0a6d){_0x3cea3[_0xd7df('0xc')]=_0x5f0a6d;if(_0x35e0a['query'][_0xd7df('0x3b')]){_0x40167d[_0xd7df('0x3c')]=[{'all':!![]}];}return db[_0xd7df('0x17')]['findAll'](_0x40167d);})[_0xd7df('0x10')](function(_0x2a7252){_0x3cea3[_0xd7df('0x3d')]=_0x2a7252;return _0x3cea3;})[_0xd7df('0x10')](respondWithFilteredResult(_0x5210e5,_0x40167d))['catch'](handleError(_0x5210e5,null));};exports[_0xd7df('0x3e')]=function(_0x230857,_0x2314e6){var _0x4f6286={'raw':!![],'where':{'id':_0x230857[_0xd7df('0x3f')]['id']}},_0x49177a={};_0x49177a[_0xd7df('0x1d')]=_['keys'](db[_0xd7df('0x17')][_0xd7df('0x18')]);_0x49177a['query']=_['keys'](_0x230857[_0xd7df('0x1b')]);_0x49177a[_0xd7df('0x1e')]=_[_0xd7df('0x1c')](_0x49177a['model'],_0x49177a['query']);_0x4f6286[_0xd7df('0x31')]=_['intersection'](_0x49177a[_0xd7df('0x1d')],qs['fields'](_0x230857['query'][_0xd7df('0x40')]));_0x4f6286['attributes']=_0x4f6286[_0xd7df('0x31')][_0xd7df('0x41')]?_0x4f6286[_0xd7df('0x31')]:_0x49177a[_0xd7df('0x1d')];if(_0x230857[_0xd7df('0x1b')][_0xd7df('0x3b')]){_0x4f6286[_0xd7df('0x3c')]=[{'all':!![]}];}_0x4f6286=_[_0xd7df('0x39')]({},_0x4f6286,_0x230857[_0xd7df('0x3a')]);return db['CmHopper'][_0xd7df('0x42')](_0x4f6286)['then'](handleEntityNotFound(_0x2314e6,null))[_0xd7df('0x10')](respondWithResult(_0x2314e6,null))[_0xd7df('0x43')](handleError(_0x2314e6,null));};exports[_0xd7df('0x44')]=function(_0xdcf9b3,_0x29d2d9){return db[_0xd7df('0x17')][_0xd7df('0x44')](_0xdcf9b3[_0xd7df('0x45')],{})[_0xd7df('0x10')](respondWithResult(_0x29d2d9,0xc9))['catch'](handleError(_0x29d2d9,null));};exports[_0xd7df('0xf')]=function(_0x563f90,_0x49085b){if(_0x563f90['body']['id']){delete _0x563f90[_0xd7df('0x45')]['id'];}return db[_0xd7df('0x17')][_0xd7df('0x42')]({'where':{'id':_0x563f90['params']['id']}})['then'](handleEntityNotFound(_0x49085b,null))[_0xd7df('0x10')](saveUpdates(_0x563f90['body'],null))[_0xd7df('0x10')](respondWithResult(_0x49085b,null))[_0xd7df('0x43')](handleError(_0x49085b,null));};exports[_0xd7df('0x46')]=function(_0x1506c4,_0x1838aa){return db[_0xd7df('0x17')][_0xd7df('0x46')]()[_0xd7df('0x10')](respondWithResult(_0x1838aa,null))[_0xd7df('0x43')](handleError(_0x1838aa,null));};exports[_0xd7df('0x47')]=function(_0x1fd63a,_0x3a7c84){var _0x54222c;var _0x1f2f99=_0x1fd63a[_0xd7df('0x3f')]['id'];return db[_0xd7df('0x17')][_0xd7df('0x42')]({'where':{'id':_0x1fd63a[_0xd7df('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3a7c84,null))[_0xd7df('0x10')](function(_0x32b147){if(_0x32b147){return _0x32b147[_0xd7df('0x47')]()['then'](function(_0x19f610){return _0x19f610;});}})['then'](function(_0x201b2f){_0x54222c=_0x201b2f;if(_0x201b2f){if(_0x201b2f[_0xd7df('0x48')]||_0x201b2f[_0xd7df('0x49')]){return db[_0x201b2f[_0xd7df('0x48')]?_0xd7df('0x4a'):'Campaign']['find']({'where':{'id':_0x201b2f['VoiceQueueId']?_0x201b2f[_0xd7df('0x48')]:_0x201b2f['CampaignId']},'attributes':['id',_0xd7df('0x13')],'raw':!![]});}}})[_0xd7df('0x10')](function(_0x32cdfa){var _0xdf3046={};if(_0x32cdfa){_[_0xd7df('0x39')](_0xdf3046,_[_0xd7df('0x4b')](_0x54222c[_0xd7df('0x4c')],[_0xd7df('0x4d'),_0xd7df('0x4e'),'id']));_0xdf3046[_0xd7df('0x4f')]=0x15;_0xdf3046[_0xd7df('0x50')]=_0xd7df('0x51');_0xdf3046[_0xd7df('0x52')]=_0x32cdfa[_0xd7df('0x13')];_0xdf3046[_0xd7df('0x53')]=_0x1fd63a[_0xd7df('0x54')]['name'];_0xdf3046[_0xd7df('0x55')]=_0x1fd63a[_0xd7df('0x54')]['id'];_0xdf3046['deleted']=!![];_0xdf3046['deletedat']=moment()[_0xd7df('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0xdf3046[_0xd7df('0x57')]=_0x54222c['phone'];_0xdf3046[_0xd7df('0x58')]=_0x54222c[_0xd7df('0x48')]?_0xd7df('0x59'):'ivr';return db['CmContact']['find']({'where':{'id':_0xdf3046[_0xd7df('0x5a')]},'attributes':[_0xd7df('0x5b'),_0xd7df('0x5c')]})[_0xd7df('0x10')](function(_0x41249b){if(!_[_0xd7df('0x5d')](_0x3a7c84)&&!_['isNil'](_0x41249b[_0xd7df('0x5b')])){_0xdf3046[_0xd7df('0x5e')]=_0x41249b[_0xd7df('0x5b')];if(!_[_0xd7df('0x5d')](_0x41249b[_0xd7df('0x5c')])){_0xdf3046[_0xd7df('0x5e')]+='\x20'+_0x41249b[_0xd7df('0x5c')];}}})[_0xd7df('0x5f')](function(){return db[_0xd7df('0x60')][_0xd7df('0x44')](_0xdf3046);});}})[_0xd7df('0x10')](function(_0x398e43){return db[_0xd7df('0x61')][_0xd7df('0x47')]({'where':{'CmHopperId':_0x1f2f99}});})[_0xd7df('0x10')](function(){return _0x3a7c84[_0xd7df('0x7')](0xcc)[_0xd7df('0x62')]();})[_0xd7df('0x43')](handleError(_0x3a7c84,null));};exports[_0xd7df('0x63')]=function(_0x1e6277,_0x146e2a){var _0x393a3a=[];return db[_0xd7df('0x64')][_0xd7df('0x46')]()[_0xd7df('0x10')](function(_0x3912d6){_0x393a3a=_['keys'](_0x3912d6);return _0x1e6277['user'][_0xd7df('0x65')]({'where':{'type':_0xd7df('0x66'),'dialActive':!![],'dialMethod':_0xd7df('0x67')},'attributes':['id','dialOrderByScheduledAt',_0xd7df('0x68')],'raw':!![]});})[_0xd7df('0x10')](function(_0x1e87aa){if(_0x1e87aa&&_0x1e87aa[_0xd7df('0x41')]){return db['sequelize'][_0xd7df('0x69')](function(_0x20ad50){var _0xb06a56={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd7df('0x56')](_0xd7df('0x6a'))},'VoiceQueueId':{'$in':_[_0xd7df('0x16')](_0x1e87aa,'id')},'$or':[{'UserId':null},{'UserId':_0x1e6277[_0xd7df('0x54')]['id']}]};var _0x2fdad0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1e87aa)['filter']([_0xd7df('0x68'),0x0])[_0xd7df('0x16')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x1e6277['user']['id']}]};var _0x481fa5={'$or':[_0xb06a56,_0x2fdad0]};var _0x264c5b=[];if(_0x1e6277[_0xd7df('0x45')][_0xd7df('0x6b')]&&_0x1e6277[_0xd7df('0x45')]['direction']===_0xd7df('0x6c')){if(!_[_0xd7df('0x6d')](_0x1e6277[_0xd7df('0x45')][_0xd7df('0x6e')])){_0x481fa5['id']={'$in':_0x1e6277[_0xd7df('0x45')][_0xd7df('0x6e')]};}_0x264c5b=[[_0xd7df('0x6f'),'ASC'],['scheduledAt',_0x1e87aa[0x0][_0xd7df('0x70')]==='ASC'?_0xd7df('0x71'):_0xd7df('0x72')],db[_0xd7df('0x73')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xd7df('0x71')]];}else{if(!_[_0xd7df('0x6d')](_0x1e6277['body'][_0xd7df('0x6e')])){_0x481fa5['id']={'$notIn':_0x1e6277[_0xd7df('0x45')]['hopperIds']};}_0x264c5b=[[_0xd7df('0x6f'),_0xd7df('0x71')],['scheduledAt',_0x1e87aa[0x0][_0xd7df('0x70')]],db[_0xd7df('0x73')][_0xd7df('0x74')](_0xd7df('0x75')),['id',_0xd7df('0x72')]];}return db[_0xd7df('0x17')][_0xd7df('0x76')]({'attributes':['id',_0xd7df('0x77'),_0xd7df('0x78'),'recallme'],'where':_0x481fa5,'order':_0x264c5b,'transaction':_0x20ad50,'lock':_0x20ad50['LOCK'][_0xd7df('0x79')],'include':[{'model':db[_0xd7df('0x64')],'as':_0xd7df('0x7a'),'attributes':_0x393a3a,'include':[{'model':db[_0xd7df('0x7b')],'as':_0xd7df('0x7c'),'attributes':['id',_0xd7df('0x13')]}]},{'model':db[_0xd7df('0x7d')],'as':_0xd7df('0x7e'),'attributes':['id',_0xd7df('0x13')]},{'model':db['VoiceQueue'],'as':_0xd7df('0x7f'),'attributes':['id',_0xd7df('0x13'),'dialActive']}]})[_0xd7df('0x10')](function(_0x726d1b){if(_0x726d1b){return _0x726d1b[_0xd7df('0xf')]({'UserId':_0x1e6277[_0xd7df('0x54')]['id']},{'transaction':_0x20ad50});}});});}})['then'](handleEntityNotFound(_0x146e2a,null))['then'](respondWithResult(_0x146e2a,null))['catch'](handleError(_0x146e2a,null));};exports[_0xd7df('0x80')]=function(_0x57040f,_0x6992f1,_0x2b1b30){var _0x2c7354=[];var _0xf05d82=_0x57040f[_0xd7df('0x3f')]['id'];var _0x16d782=_0x57040f['user']['id'];return db[_0xd7df('0x64')][_0xd7df('0x46')]()[_0xd7df('0x10')](function(_0x5d8c37){_0x2c7354=_[_0xd7df('0x81')](_0x5d8c37);return db[_0xd7df('0x73')]['transaction'](function(_0x280694){const _0x33f8fb={'id':_0xf05d82};return db[_0xd7df('0x17')][_0xd7df('0x76')]({'attributes':['id',_0xd7df('0x77'),_0xd7df('0x82')],'where':_0x33f8fb,'transaction':_0x280694,'lock':_0x280694[_0xd7df('0x83')]['UPDATE'],'include':[{'model':db[_0xd7df('0x64')],'as':_0xd7df('0x7a'),'attributes':_0x2c7354,'include':[{'model':db[_0xd7df('0x7b')],'as':_0xd7df('0x7c'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xd7df('0x7e'),'attributes':['id',_0xd7df('0x13')]},{'model':db[_0xd7df('0x4a')],'as':_0xd7df('0x7f'),'attributes':['id',_0xd7df('0x13'),'dialActive']}]})[_0xd7df('0x10')](function(_0x4f739b){if(_0x4f739b){return _0x4f739b['update']({'UserId':_0x16d782},{'transaction':_0x280694});}});});})[_0xd7df('0x10')](handleEntityNotFound(_0x6992f1,null))[_0xd7df('0x10')](respondWithResult(_0x6992f1,null))[_0xd7df('0x43')](handleError(_0x6992f1,null));};exports[_0xd7df('0x84')]=function(_0x30c401,_0x3ece24){return _0x30c401['user']['getVoiceQueues']({'where':{'type':_0xd7df('0x66'),'dialActive':!![],'dialMethod':_0xd7df('0x67')},'attributes':['id'],'raw':!![]})[_0xd7df('0x10')](function(_0x175a36){if(_0x175a36&&_0x175a36['length']){return db[_0xd7df('0x17')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd7df('0x56')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xd7df('0x16')](_0x175a36,'id')},'$or':[{'UserId':null},{'UserId':_0x30c401[_0xd7df('0x54')]['id']}]}});}return 0x0;})[_0xd7df('0x10')](function(_0x223a64){if(!_[_0xd7df('0x5d')](_0x223a64)&&_[_0xd7df('0x85')](_0x223a64)){return _0x3ece24['status'](0xc8)[_0xd7df('0x8')]({'contacts':_0x223a64});}else{logger['error'](_0xd7df('0x86'),_0xd7df('0x84'),0x194,_0xd7df('0x87'));_0x3ece24[_0xd7df('0x11')](0x194);}})['catch'](handleError(_0x3ece24,null));};exports[_0xd7df('0x88')]=function(_0x89e217,_0x31c191){var _0x307310=shared[_0xd7df('0x89')];var _0x30aff7=[];_[_0xd7df('0x16')](_0x307310,function(_0x3052f7){_0x30aff7[_0xd7df('0x8a')]({'id':_0x3052f7[_0xd7df('0x13')],'name':_0x3052f7[_0xd7df('0x13')],'utcOffset':_0x3052f7[_0xd7df('0x8b')]});});return _0x31c191['status'](0xc8)[_0xd7df('0x8')]({'tz':_0x30aff7});};exports[_0xd7df('0x8c')]=function(_0x36a83b,_0x50c701){var _0x56eeb9=shared[_0xd7df('0x89')];var _0x3657cb={};if(!_[_0xd7df('0x5d')](_0x56eeb9[_0x36a83b[_0xd7df('0x45')]['id']]))_0x3657cb=_0x56eeb9[_0x36a83b[_0xd7df('0x45')]['id']];return _0x50c701[_0xd7df('0x7')](0xc8)[_0xd7df('0x8')](_0x3657cb);}; \ No newline at end of file +var _0x9c5a=['UserId','user','deleted','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','DESC','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','getPreviewRecall','getOpenContacts','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','push','moment','lodash','../../config/logger','api','../../config/environment','../../mysqldb','json','undefined','limit','count','offset','status','set','Content-Range','update','sendStatus','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','model','keys','query','filters','intersection','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$in','$like','$notLike','$notILike','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','length','find','create','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','omit','updatedAt','statedesc','campaign','membername'];(function(_0x21a0e1,_0xfc49bf){var _0x23cf15=function(_0xc1d643){while(--_0xc1d643){_0x21a0e1['push'](_0x21a0e1['shift']());}};_0x23cf15(++_0xfc49bf);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x261964,_0x1afe7d){_0x261964=_0x261964-0x0;var _0x53ccd5=_0x9c5a[_0x261964];return _0x53ccd5;};'use strict';var moment=require(_0xa9c5('0x0'));var _=require(_0xa9c5('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xa9c5('0x2'))(_0xa9c5('0x3'));var shared=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];function respondWithResult(_0x4f5552,_0x2acfaf){_0x2acfaf=_0x2acfaf||0xc8;return function(_0x3051b1){if(_0x3051b1){return _0x4f5552['status'](_0x2acfaf)[_0xa9c5('0x6')](_0x3051b1);}};}function respondWithFilteredResult(_0x4d9c7a,_0x394d84){return function(_0x3df556){if(_0x3df556){var _0x4cb597=typeof _0x394d84['offset']===_0xa9c5('0x7')&&typeof _0x394d84[_0xa9c5('0x8')]==='undefined';var _0x2e2b3e=_0x3df556[_0xa9c5('0x9')];var _0x51c14c=_0x4cb597?0x0:_0x394d84[_0xa9c5('0xa')];var _0x40a79d=_0x4cb597?_0x3df556['count']:_0x394d84['offset']+_0x394d84[_0xa9c5('0x8')];var _0x11421c;if(_0x40a79d>=_0x2e2b3e){_0x40a79d=_0x2e2b3e;_0x11421c=0xc8;}else{_0x11421c=0xce;}_0x4d9c7a[_0xa9c5('0xb')](_0x11421c);return _0x4d9c7a[_0xa9c5('0xc')](_0xa9c5('0xd'),_0x51c14c+'-'+_0x40a79d+'/'+_0x2e2b3e)[_0xa9c5('0x6')](_0x3df556);}return null;};}function saveUpdates(_0x51c8d,_0x42d5cf){return function(_0x3c5ac7){if(_0x3c5ac7){return _0x3c5ac7[_0xa9c5('0xe')](_0x51c8d)['then'](function(_0x390ca2){return _0x390ca2;});}return null;};}function handleEntityNotFound(_0x1276d2,_0x7df76d){return function(_0x3806c4){if(!_0x3806c4){_0x1276d2[_0xa9c5('0xf')](0x194);}return _0x3806c4;};}function handleError(_0x1dad66,_0x251099){_0x251099=_0x251099||0x1f4;return function(_0x40b001){logger[_0xa9c5('0x10')](_0x40b001[_0xa9c5('0x11')]);if(_0x40b001['name']){delete _0x40b001[_0xa9c5('0x12')];}_0x1dad66[_0xa9c5('0xb')](_0x251099)[_0xa9c5('0x13')](_0x40b001);};}exports['index']=function(_0x2cda1b,_0x1142d9){var _0x2b9ac5={},_0x3b8cf7={},_0x452a9b={'count':0x0,'rows':[]};var _0x349f27=_[_0xa9c5('0x14')](db[_0xa9c5('0x15')][_0xa9c5('0x16')],function(_0x36c486){return{'name':_0x36c486[_0xa9c5('0x17')],'type':_0x36c486[_0xa9c5('0x18')]['key']};});_0x3b8cf7[_0xa9c5('0x19')]=_[_0xa9c5('0x14')](_0x349f27,'name');_0x3b8cf7['query']=_[_0xa9c5('0x1a')](_0x2cda1b[_0xa9c5('0x1b')]);_0x3b8cf7[_0xa9c5('0x1c')]=_[_0xa9c5('0x1d')](_0x3b8cf7[_0xa9c5('0x19')],_0x3b8cf7[_0xa9c5('0x1b')]);_0x3b8cf7['filters']=_['concat'](_0x3b8cf7[_0xa9c5('0x1c')],[_0xa9c5('0x1e'),'$or',_0xa9c5('0x1f'),_0xa9c5('0x20'),_0xa9c5('0x21'),_0xa9c5('0x22'),_0xa9c5('0x23'),_0xa9c5('0x24'),_0xa9c5('0x25'),'$between','$notBetween',_0xa9c5('0x26'),'$notIn',_0xa9c5('0x27'),_0xa9c5('0x28'),'$iLike',_0xa9c5('0x29'),_0xa9c5('0x27'),'$overlap',_0xa9c5('0x2a'),_0xa9c5('0x2b'),_0xa9c5('0x2c')]);_0x2b9ac5[_0xa9c5('0x2d')]=_[_0xa9c5('0x1d')](_0x3b8cf7['model'],qs[_0xa9c5('0x2e')](_0x2cda1b['query'][_0xa9c5('0x2e')]));_0x2b9ac5[_0xa9c5('0x2d')]=_0x2b9ac5[_0xa9c5('0x2d')]['length']?_0x2b9ac5[_0xa9c5('0x2d')]:_0x3b8cf7[_0xa9c5('0x19')];if(!_0x2cda1b['query'][_0xa9c5('0x2f')](_0xa9c5('0x30'))){_0x2b9ac5[_0xa9c5('0x8')]=qs[_0xa9c5('0x8')](_0x2cda1b[_0xa9c5('0x1b')][_0xa9c5('0x8')]);_0x2b9ac5[_0xa9c5('0xa')]=qs['offset'](_0x2cda1b[_0xa9c5('0x1b')][_0xa9c5('0xa')]);}_0x2b9ac5[_0xa9c5('0x31')]=qs[_0xa9c5('0x32')](_0x2cda1b[_0xa9c5('0x1b')][_0xa9c5('0x32')]);_0x2b9ac5[_0xa9c5('0x33')]=qs[_0xa9c5('0x1c')](_['pick'](_0x2cda1b['query'],_0x3b8cf7[_0xa9c5('0x1c')]),_0x349f27);if(_0x2cda1b[_0xa9c5('0x1b')][_0xa9c5('0x34')]){_0x2b9ac5[_0xa9c5('0x33')]=_[_0xa9c5('0x35')](_0x2b9ac5[_0xa9c5('0x33')],{'$or':_['map'](_0x349f27,function(_0x598920){if(_0x598920['type']!==_0xa9c5('0x36')){var _0x27d614={};_0x27d614[_0x598920['name']]={'$like':'%'+_0x2cda1b[_0xa9c5('0x1b')]['filter']+'%'};return _0x27d614;}})});}_0x2b9ac5=_[_0xa9c5('0x35')]({},_0x2b9ac5,_0x2cda1b[_0xa9c5('0x37')]);var _0x2567be={'where':_0x2b9ac5[_0xa9c5('0x33')]};return db['CmHopper'][_0xa9c5('0x9')](_0x2567be)[_0xa9c5('0x38')](function(_0x191153){_0x452a9b[_0xa9c5('0x9')]=_0x191153;if(_0x2cda1b[_0xa9c5('0x1b')][_0xa9c5('0x39')]){_0x2b9ac5[_0xa9c5('0x3a')]=[{'all':!![]}];}return db[_0xa9c5('0x15')]['findAll'](_0x2b9ac5);})[_0xa9c5('0x38')](function(_0x46e5d2){_0x452a9b[_0xa9c5('0x3b')]=_0x46e5d2;return _0x452a9b;})[_0xa9c5('0x38')](respondWithFilteredResult(_0x1142d9,_0x2b9ac5))[_0xa9c5('0x3c')](handleError(_0x1142d9,null));};exports[_0xa9c5('0x3d')]=function(_0x493b20,_0x307736){var _0x5b7a0a={'raw':!![],'where':{'id':_0x493b20['params']['id']}},_0x2fa3e3={};_0x2fa3e3[_0xa9c5('0x19')]=_[_0xa9c5('0x1a')](db[_0xa9c5('0x15')]['rawAttributes']);_0x2fa3e3[_0xa9c5('0x1b')]=_[_0xa9c5('0x1a')](_0x493b20[_0xa9c5('0x1b')]);_0x2fa3e3[_0xa9c5('0x1c')]=_['intersection'](_0x2fa3e3[_0xa9c5('0x19')],_0x2fa3e3[_0xa9c5('0x1b')]);_0x5b7a0a[_0xa9c5('0x2d')]=_[_0xa9c5('0x1d')](_0x2fa3e3[_0xa9c5('0x19')],qs['fields'](_0x493b20[_0xa9c5('0x1b')]['fields']));_0x5b7a0a[_0xa9c5('0x2d')]=_0x5b7a0a[_0xa9c5('0x2d')][_0xa9c5('0x3e')]?_0x5b7a0a[_0xa9c5('0x2d')]:_0x2fa3e3[_0xa9c5('0x19')];if(_0x493b20[_0xa9c5('0x1b')][_0xa9c5('0x39')]){_0x5b7a0a[_0xa9c5('0x3a')]=[{'all':!![]}];}_0x5b7a0a=_[_0xa9c5('0x35')]({},_0x5b7a0a,_0x493b20[_0xa9c5('0x37')]);return db['CmHopper'][_0xa9c5('0x3f')](_0x5b7a0a)[_0xa9c5('0x38')](handleEntityNotFound(_0x307736,null))[_0xa9c5('0x38')](respondWithResult(_0x307736,null))[_0xa9c5('0x3c')](handleError(_0x307736,null));};exports[_0xa9c5('0x40')]=function(_0x3794d2,_0x583ec9){return db[_0xa9c5('0x15')][_0xa9c5('0x40')](_0x3794d2['body'],{})['then'](respondWithResult(_0x583ec9,0xc9))['catch'](handleError(_0x583ec9,null));};exports['update']=function(_0x4e97bf,_0x160020){if(_0x4e97bf[_0xa9c5('0x41')]['id']){delete _0x4e97bf[_0xa9c5('0x41')]['id'];}return db[_0xa9c5('0x15')][_0xa9c5('0x3f')]({'where':{'id':_0x4e97bf[_0xa9c5('0x42')]['id']}})[_0xa9c5('0x38')](handleEntityNotFound(_0x160020,null))[_0xa9c5('0x38')](saveUpdates(_0x4e97bf[_0xa9c5('0x41')],null))[_0xa9c5('0x38')](respondWithResult(_0x160020,null))[_0xa9c5('0x3c')](handleError(_0x160020,null));};exports[_0xa9c5('0x43')]=function(_0x1c2ccf,_0x4bf8b4){return db[_0xa9c5('0x15')]['describe']()[_0xa9c5('0x38')](respondWithResult(_0x4bf8b4,null))[_0xa9c5('0x3c')](handleError(_0x4bf8b4,null));};exports['destroy']=function(_0x5cbd33,_0xf00970){var _0x32e64a;var _0xeb0720=_0x5cbd33['params']['id'];return db['CmHopper'][_0xa9c5('0x3f')]({'where':{'id':_0x5cbd33[_0xa9c5('0x42')]['id']}})['then'](handleEntityNotFound(_0xf00970,null))[_0xa9c5('0x38')](function(_0x2c095f){if(_0x2c095f){return _0x2c095f[_0xa9c5('0x44')]()[_0xa9c5('0x38')](function(_0x34020f){return _0x34020f;});}})[_0xa9c5('0x38')](function(_0x4b6fc9){_0x32e64a=_0x4b6fc9;if(_0x4b6fc9){if(_0x4b6fc9['VoiceQueueId']||_0x4b6fc9['CampaignId']){return db[_0x4b6fc9[_0xa9c5('0x45')]?_0xa9c5('0x46'):_0xa9c5('0x47')][_0xa9c5('0x3f')]({'where':{'id':_0x4b6fc9[_0xa9c5('0x45')]?_0x4b6fc9[_0xa9c5('0x45')]:_0x4b6fc9['CampaignId']},'attributes':['id',_0xa9c5('0x12')],'raw':!![]});}}})[_0xa9c5('0x38')](function(_0x433a58){var _0x2bdc77={};if(_0x433a58){_[_0xa9c5('0x35')](_0x2bdc77,_[_0xa9c5('0x48')](_0x32e64a['dataValues'],['createdAt',_0xa9c5('0x49'),'id']));_0x2bdc77['state']=0x15;_0x2bdc77[_0xa9c5('0x4a')]='deleted';_0x2bdc77[_0xa9c5('0x4b')]=_0x433a58[_0xa9c5('0x12')];_0x2bdc77[_0xa9c5('0x4c')]=_0x5cbd33['user'][_0xa9c5('0x12')];_0x2bdc77[_0xa9c5('0x4d')]=_0x5cbd33[_0xa9c5('0x4e')]['id'];_0x2bdc77[_0xa9c5('0x4f')]=!![];_0x2bdc77['deletedat']=moment()['format'](_0xa9c5('0x50'));_0x2bdc77[_0xa9c5('0x51')]=_0x32e64a[_0xa9c5('0x52')];_0x2bdc77['campaigntype']=_0x32e64a[_0xa9c5('0x45')]?_0xa9c5('0x53'):_0xa9c5('0x54');return db[_0xa9c5('0x55')][_0xa9c5('0x3f')]({'where':{'id':_0x2bdc77[_0xa9c5('0x56')]},'attributes':[_0xa9c5('0x57'),_0xa9c5('0x58')]})['then'](function(_0x41f528){if(!_['isNil'](_0xf00970)&&!_[_0xa9c5('0x59')](_0x41f528[_0xa9c5('0x57')])){_0x2bdc77[_0xa9c5('0x5a')]=_0x41f528['firstName'];if(!_[_0xa9c5('0x59')](_0x41f528[_0xa9c5('0x58')])){_0x2bdc77['calleridname']+='\x20'+_0x41f528[_0xa9c5('0x58')];}}})[_0xa9c5('0x5b')](function(){return db[_0xa9c5('0x5c')][_0xa9c5('0x40')](_0x2bdc77);});}})['then'](function(_0x3505d3){return db[_0xa9c5('0x5d')][_0xa9c5('0x44')]({'where':{'CmHopperId':_0xeb0720}});})[_0xa9c5('0x38')](function(){return _0xf00970['status'](0xcc)['end']();})[_0xa9c5('0x3c')](handleError(_0xf00970,null));};exports[_0xa9c5('0x5e')]=function(_0x67c1f8,_0x1b676e){var _0x279a26=[];return db[_0xa9c5('0x55')]['describe']()[_0xa9c5('0x38')](function(_0x1e787e){_0x279a26=_[_0xa9c5('0x1a')](_0x1e787e);return _0x67c1f8[_0xa9c5('0x4e')][_0xa9c5('0x5f')]({'where':{'type':_0xa9c5('0x60'),'dialActive':!![],'dialMethod':_0xa9c5('0x61')},'attributes':['id',_0xa9c5('0x62'),_0xa9c5('0x63')],'raw':!![]});})[_0xa9c5('0x38')](function(_0x50d438){if(_0x50d438&&_0x50d438['length']){return db[_0xa9c5('0x64')][_0xa9c5('0x65')](function(_0x3322cc){var _0x47afaa={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa9c5('0x50'))},'VoiceQueueId':{'$in':_['map'](_0x50d438,'id')},'$or':[{'UserId':null},{'UserId':_0x67c1f8[_0xa9c5('0x4e')]['id']}]};var _0x28c0df={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x50d438)[_0xa9c5('0x34')]([_0xa9c5('0x63'),0x0])[_0xa9c5('0x14')]('id')[_0xa9c5('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x67c1f8[_0xa9c5('0x4e')]['id']}]};var _0x3890b4={'$or':[_0x47afaa,_0x28c0df]};var _0x2f323e=[];if(_0x67c1f8[_0xa9c5('0x41')][_0xa9c5('0x67')]&&_0x67c1f8[_0xa9c5('0x41')]['direction']===_0xa9c5('0x68')){if(!_[_0xa9c5('0x69')](_0x67c1f8[_0xa9c5('0x41')][_0xa9c5('0x6a')])){_0x3890b4['id']={'$in':_0x67c1f8[_0xa9c5('0x41')][_0xa9c5('0x6a')]};}_0x2f323e=[[_0xa9c5('0x6b'),'ASC'],['scheduledAt',_0x50d438[0x0][_0xa9c5('0x62')]==='ASC'?_0xa9c5('0x6c'):_0xa9c5('0x6d')],db['sequelize'][_0xa9c5('0x6e')](_0xa9c5('0x6f')),['id','DESC']];}else{if(!_['isEmpty'](_0x67c1f8[_0xa9c5('0x41')][_0xa9c5('0x6a')])){_0x3890b4['id']={'$notIn':_0x67c1f8[_0xa9c5('0x41')]['hopperIds']};}_0x2f323e=[['priority',_0xa9c5('0x6c')],[_0xa9c5('0x70'),_0x50d438[0x0]['dialOrderByScheduledAt']],db[_0xa9c5('0x64')][_0xa9c5('0x6e')](_0xa9c5('0x71')),['id',_0xa9c5('0x6d')]];}return db[_0xa9c5('0x15')][_0xa9c5('0x72')]({'attributes':['id','scheduledat',_0xa9c5('0x52'),_0xa9c5('0x73')],'where':_0x3890b4,'order':_0x2f323e,'transaction':_0x3322cc,'lock':_0x3322cc[_0xa9c5('0x74')][_0xa9c5('0x75')],'include':[{'model':db['CmContact'],'as':_0xa9c5('0x76'),'attributes':_0x279a26,'include':[{'model':db[_0xa9c5('0x77')],'as':'Company','attributes':['id',_0xa9c5('0x12')]}]},{'model':db[_0xa9c5('0x78')],'as':_0xa9c5('0x79'),'attributes':['id','name']},{'model':db[_0xa9c5('0x46')],'as':_0xa9c5('0x7a'),'attributes':['id',_0xa9c5('0x12'),_0xa9c5('0x7b')]}]})[_0xa9c5('0x38')](function(_0x4db621){if(_0x4db621){return _0x4db621[_0xa9c5('0xe')]({'UserId':_0x67c1f8['user']['id']},{'transaction':_0x3322cc});}});});}})[_0xa9c5('0x38')](handleEntityNotFound(_0x1b676e,null))[_0xa9c5('0x38')](respondWithResult(_0x1b676e,null))[_0xa9c5('0x3c')](handleError(_0x1b676e,null));};exports[_0xa9c5('0x7c')]=function(_0x427817,_0x42b1d7,_0x39fae1){var _0x390d0b=[];var _0x3f6114=_0x427817[_0xa9c5('0x42')]['id'];var _0x2f350e=_0x427817['user']['id'];return db[_0xa9c5('0x55')][_0xa9c5('0x43')]()['then'](function(_0x2a0a94){_0x390d0b=_[_0xa9c5('0x1a')](_0x2a0a94);return db[_0xa9c5('0x64')]['transaction'](function(_0x27bcc0){const _0x282f84={'id':_0x3f6114};return db[_0xa9c5('0x15')][_0xa9c5('0x72')]({'attributes':['id','scheduledat',_0xa9c5('0x73')],'where':_0x282f84,'transaction':_0x27bcc0,'lock':_0x27bcc0[_0xa9c5('0x74')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x390d0b,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xa9c5('0x12')]},{'model':db[_0xa9c5('0x46')],'as':_0xa9c5('0x7a'),'attributes':['id',_0xa9c5('0x12'),_0xa9c5('0x7b')]}]})['then'](function(_0x4d7772){if(_0x4d7772){return _0x4d7772['update']({'UserId':_0x2f350e},{'transaction':_0x27bcc0});}});});})['then'](handleEntityNotFound(_0x42b1d7,null))[_0xa9c5('0x38')](respondWithResult(_0x42b1d7,null))[_0xa9c5('0x3c')](handleError(_0x42b1d7,null));};exports[_0xa9c5('0x7d')]=function(_0x2eda17,_0x5253e8){return _0x2eda17['user'][_0xa9c5('0x5f')]({'where':{'type':_0xa9c5('0x60'),'dialActive':!![],'dialMethod':_0xa9c5('0x61')},'attributes':['id'],'raw':!![]})[_0xa9c5('0x38')](function(_0x1d89ec){if(_0x1d89ec&&_0x1d89ec['length']){return db[_0xa9c5('0x15')][_0xa9c5('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa9c5('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xa9c5('0x14')](_0x1d89ec,'id')},'$or':[{'UserId':null},{'UserId':_0x2eda17[_0xa9c5('0x4e')]['id']}]}});}return 0x0;})[_0xa9c5('0x38')](function(_0x3dfef2){if(!_['isNil'](_0x3dfef2)&&_[_0xa9c5('0x7f')](_0x3dfef2)){return _0x5253e8[_0xa9c5('0xb')](0xc8)['json']({'contacts':_0x3dfef2});}else{logger['error'](_0xa9c5('0x80'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x5253e8[_0xa9c5('0xf')](0x194);}})[_0xa9c5('0x3c')](handleError(_0x5253e8,null));};exports[_0xa9c5('0x81')]=function(_0x2f9757,_0x22661f){var _0x5bc433=shared[_0xa9c5('0x82')];var _0x4c04f7=[];_[_0xa9c5('0x14')](_0x5bc433,function(_0x2ff914){_0x4c04f7[_0xa9c5('0x83')]({'id':_0x2ff914[_0xa9c5('0x12')],'name':_0x2ff914['name'],'utcOffset':_0x2ff914['utcOffset']});});return _0x22661f[_0xa9c5('0xb')](0xc8)['json']({'tz':_0x4c04f7});};exports['getTimezone']=function(_0x38e2f,_0x370bbb){var _0x4cdf88=shared['timezones'];var _0x4335ff={};if(!_[_0xa9c5('0x59')](_0x4cdf88[_0x38e2f[_0xa9c5('0x41')]['id']]))_0x4335ff=_0x4cdf88[_0x38e2f[_0xa9c5('0x41')]['id']];return _0x370bbb['status'](0xc8)['json'](_0x4335ff);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index d366bd9..048a3ab 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 _0xacf4=['define','CmHopper','cm_hopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports'];(function(_0x8966d9,_0xe6df61){var _0x324ca9=function(_0x2bbc63){while(--_0x2bbc63){_0x8966d9['push'](_0x8966d9['shift']());}};_0x324ca9(++_0xe6df61);}(_0xacf4,0xe7));var _0x4acf=function(_0x20f784,_0x219af1){_0x20f784=_0x20f784-0x0;var _0x4c12e3=_0xacf4[_0x20f784];return _0x4c12e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[{'name':_0x4acf('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x4acf('0xd')]},{'name':'priority','fields':[_0x4acf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone'];(function(_0x410a6a,_0x22833e){var _0x58ed39=function(_0x9201db){while(--_0x9201db){_0x410a6a['push'](_0x410a6a['shift']());}};_0x58ed39(++_0x22833e);}(_0xeff8,0x186));var _0x8eff=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xeff8[_0x432682];return _0x463d05;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x8eff('0xb'),'fields':[_0x8eff('0xb')]},{'name':_0x8eff('0xc'),'fields':[_0x8eff('0xc')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8af0f53..9bfa8a9 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 _0xdaec=['rpc','GetCmHopper','CmHopper','options','where','attributes','include','map','model','debug','stringify','error','message','find','raw','then','ShowCmHopper','CreateCmHopper','create','body','catch','UpdateCmHopper','limit','info','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys','User','name','voicePause','length','UserId','update','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','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','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','NOW()','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger'];(function(_0x4bec9a,_0x48e506){var _0x3e7358=function(_0x1aa241){while(--_0x1aa241){_0x4bec9a['push'](_0x4bec9a['shift']());}};_0x3e7358(++_0x48e506);}(_0xdaec,0x14e));var _0xcdae=function(_0x34edc6,_0x4a0b01){_0x34edc6=_0x34edc6-0x0;var _0x5788b1=_0xdaec[_0x34edc6];return _0x5788b1;};'use strict';var _=require(_0xcdae('0x0'));var util=require(_0xcdae('0x1'));var moment=require(_0xcdae('0x2'));var BPromise=require(_0xcdae('0x3'));var db=require(_0xcdae('0x4'))['db'];var logger=require(_0xcdae('0x5'))(_0xcdae('0x6'));exports[_0xcdae('0x7')]=function(_0x4d3763){var _0x527bde=this;return new Promise(function(_0x3a897a,_0x2977b5){return db[_0xcdae('0x8')]['findAll']({'raw':_0x4d3763[_0xcdae('0x9')]?_0x4d3763[_0xcdae('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x4d3763[_0xcdae('0x9')]?_0x4d3763['options'][_0xcdae('0xa')]||null:null,'attributes':_0x4d3763[_0xcdae('0x9')]?_0x4d3763['options'][_0xcdae('0xb')]||null:null,'limit':_0x4d3763[_0xcdae('0x9')]?_0x4d3763[_0xcdae('0x9')]['limit']||null:null,'include':_0x4d3763[_0xcdae('0x9')]?_0x4d3763['options'][_0xcdae('0xc')]?_[_0xcdae('0xd')](_0x4d3763[_0xcdae('0x9')]['include'],function(_0x2db9b8){return{'model':db[_0x2db9b8[_0xcdae('0xe')]],'as':_0x2db9b8['as'],'attributes':_0x2db9b8['attributes'],'include':_0x2db9b8['include']?_[_0xcdae('0xd')](_0x2db9b8['include'],function(_0x1c5661){return{'model':db[_0x1c5661[_0xcdae('0xe')]],'as':_0x1c5661['as'],'attributes':_0x1c5661[_0xcdae('0xb')],'include':_0x1c5661[_0xcdae('0xc')]?_[_0xcdae('0xd')](_0x1c5661['include'],function(_0x30ecdb){return{'model':db[_0x30ecdb['model']],'as':_0x30ecdb['as'],'attributes':_0x30ecdb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd1a94d){logger['info'](_0xcdae('0x7'),_0x4d3763);logger[_0xcdae('0xf')](_0xcdae('0x7'),_0x4d3763,JSON[_0xcdae('0x10')](_0xd1a94d));_0x3a897a(_0xd1a94d);})['catch'](function(_0x36d629){logger[_0xcdae('0x11')](_0xcdae('0x7'),_0x36d629[_0xcdae('0x12')],_0x4d3763);_0x2977b5(_0x527bde[_0xcdae('0x11')](0x1f4,_0x36d629[_0xcdae('0x12')]));});});};exports['ShowCmHopper']=function(_0x4ba440){var _0x5d6e88=this;return new Promise(function(_0x5082c1,_0x76ccec){return db[_0xcdae('0x8')][_0xcdae('0x13')]({'raw':_0x4ba440[_0xcdae('0x9')]?_0x4ba440[_0xcdae('0x9')][_0xcdae('0x14')]===undefined?!![]:![]:!![],'where':_0x4ba440['options']?_0x4ba440[_0xcdae('0x9')]['where']||null:null,'attributes':_0x4ba440['options']?_0x4ba440['options']['attributes']||null:null,'include':_0x4ba440[_0xcdae('0x9')]?_0x4ba440[_0xcdae('0x9')][_0xcdae('0xc')]?_[_0xcdae('0xd')](_0x4ba440[_0xcdae('0x9')][_0xcdae('0xc')],function(_0x4ddf9f){return{'model':db[_0x4ddf9f[_0xcdae('0xe')]],'as':_0x4ddf9f['as'],'attributes':_0x4ddf9f[_0xcdae('0xb')],'include':_0x4ddf9f[_0xcdae('0xc')]?_[_0xcdae('0xd')](_0x4ddf9f[_0xcdae('0xc')],function(_0x3547be){return{'model':db[_0x3547be['model']],'as':_0x3547be['as'],'attributes':_0x3547be[_0xcdae('0xb')],'include':_0x3547be[_0xcdae('0xc')]?_[_0xcdae('0xd')](_0x3547be[_0xcdae('0xc')],function(_0x520ab9){return{'model':db[_0x520ab9['model']],'as':_0x520ab9['as'],'attributes':_0x520ab9[_0xcdae('0xb')]};}):[]};}):[]};}):[]:[]})[_0xcdae('0x15')](function(_0x3535f8){logger['info'](_0xcdae('0x16'),_0x4ba440);logger[_0xcdae('0xf')](_0xcdae('0x16'),_0x4ba440,JSON['stringify'](_0x3535f8));_0x5082c1(_0x3535f8);})['catch'](function(_0x486ebe){logger[_0xcdae('0x11')](_0xcdae('0x16'),_0x486ebe['message'],_0x4ba440);_0x76ccec(_0x5d6e88[_0xcdae('0x11')](0x1f4,_0x486ebe[_0xcdae('0x12')]));});});};exports[_0xcdae('0x17')]=function(_0x31e120){var _0x4c0026=this;return new Promise(function(_0x179837,_0x2cc283){return db[_0xcdae('0x8')][_0xcdae('0x18')](_0x31e120[_0xcdae('0x19')],{'raw':_0x31e120[_0xcdae('0x9')]?_0x31e120[_0xcdae('0x9')]['raw']===undefined?!![]:![]:!![]})[_0xcdae('0x15')](function(_0x3fa4ca){logger['info'](_0xcdae('0x17'),_0x31e120);logger[_0xcdae('0xf')](_0xcdae('0x17'),_0x31e120,JSON[_0xcdae('0x10')](_0x3fa4ca));_0x179837(_0x3fa4ca);})[_0xcdae('0x1a')](function(_0x42ad7b){logger[_0xcdae('0x11')](_0xcdae('0x17'),_0x42ad7b[_0xcdae('0x12')],_0x31e120);_0x2cc283(_0x4c0026['error'](0x1f4,_0x42ad7b['message']));});});};exports[_0xcdae('0x1b')]=function(_0xd07025){var _0x1ce436=this;return new Promise(function(_0x1acd2f,_0x4d363a){return db['CmHopper']['update'](_0xd07025['body'],{'raw':_0xd07025[_0xcdae('0x9')]?_0xd07025[_0xcdae('0x9')][_0xcdae('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd07025[_0xcdae('0x9')]?_0xd07025[_0xcdae('0x9')][_0xcdae('0xa')]||null:null,'attributes':_0xd07025[_0xcdae('0x9')]?_0xd07025[_0xcdae('0x9')]['attributes']||null:null,'limit':_0xd07025[_0xcdae('0x9')]?_0xd07025[_0xcdae('0x9')][_0xcdae('0x1c')]||null:null})['then'](function(_0x33ff3b){logger['info'](_0xcdae('0x1b'),_0xd07025);logger[_0xcdae('0x1d')](_0xcdae('0x1e'),JSON[_0xcdae('0x10')](_0xd07025[_0xcdae('0x9')][_0xcdae('0xa')]),_0xd07025[_0xcdae('0x19')][_0xcdae('0x1f')]);logger[_0xcdae('0xf')](_0xcdae('0x1b'),_0xd07025,JSON['stringify'](_0x33ff3b));_0x1acd2f(_0x33ff3b);})[_0xcdae('0x1a')](function(_0x33cb43){logger[_0xcdae('0x11')](_0xcdae('0x1b'),_0x33cb43[_0xcdae('0x12')],_0xd07025);_0x4d363a(_0x1ce436[_0xcdae('0x11')](0x1f4,_0x33cb43[_0xcdae('0x12')]));});});};exports[_0xcdae('0x20')]=function(_0x5eb301){var _0x14fe3e=this;return new Promise(function(_0x2321de,_0xf8428d){return db[_0xcdae('0x8')][_0xcdae('0x21')]({'where':_0x5eb301[_0xcdae('0x9')]?_0x5eb301[_0xcdae('0x9')][_0xcdae('0xa')]||null:null})['then'](function(_0x36de7f){logger['info']('DestroyCmHopper',_0x5eb301);logger[_0xcdae('0xf')](_0xcdae('0x20'),_0x5eb301,JSON[_0xcdae('0x10')](_0x36de7f));_0x2321de(_0x36de7f);})['catch'](function(_0x264125){logger[_0xcdae('0x11')](_0xcdae('0x20'),_0x264125[_0xcdae('0x12')],_0x5eb301);_0xf8428d(_0x14fe3e[_0xcdae('0x11')](0x1f4,_0x264125[_0xcdae('0x12')]));});});};exports[_0xcdae('0x22')]=function(_0x3ff525){var _0x203ac7=this;return new Promise(function(_0xf6cee4,_0x242c7f){return db[_0xcdae('0x23')][_0xcdae('0x24')]()[_0xcdae('0x15')](function(_0x2ee7a4){return db[_0xcdae('0x25')][_0xcdae('0x26')](function(_0x3d1996){return db[_0xcdae('0x8')][_0xcdae('0x27')]({'where':_0x3ff525[_0xcdae('0x9')]?_0x3ff525['options'][_0xcdae('0xa')]||null:null,'attributes':_0x3ff525[_0xcdae('0x9')]?_0x3ff525[_0xcdae('0x9')][_0xcdae('0xb')]||null:null,'limit':_0x3ff525[_0xcdae('0x9')]?_0x3ff525[_0xcdae('0x9')][_0xcdae('0x1c')]||null:null,'order':_0x3ff525['options']?_0x3ff525['options'][_0xcdae('0x28')]||null:null,'transaction':_0x3d1996,'lock':_0x3d1996[_0xcdae('0x29')][_0xcdae('0x2a')],'include':[{'model':db['CmContact'],'as':_0xcdae('0x2b'),'attributes':_[_0xcdae('0x2c')](_0x2ee7a4)},{'model':db[_0xcdae('0x2d')],'as':'Agent','attributes':['id',_0xcdae('0x2e'),_0xcdae('0x2f')]}]})[_0xcdae('0x15')](function(_0x168a5c){var _0x126d97=[];var _0x50f1d0=[];for(var _0x134c6b=0x0;_0x134c6b<_0x168a5c[_0xcdae('0x30')];_0x134c6b+=0x1){var _0x47a424=_0x168a5c[_0x134c6b][_0xcdae('0x31')];if(_0x47a424===null){_0x126d97['push'](_0x168a5c[_0x134c6b][_0xcdae('0x32')](_0x3ff525[_0xcdae('0x19')],{'transaction':_0x3d1996}));}else if(!_0x50f1d0[_0xcdae('0x33')](_0x47a424)){_0x50f1d0[_0xcdae('0x34')](_0x47a424);_0x126d97[_0xcdae('0x34')](_0x168a5c[_0x134c6b]['update'](_0x3ff525[_0xcdae('0x19')],{'transaction':_0x3d1996}));}}return BPromise[_0xcdae('0x35')](_0x126d97);});})['then'](function(_0x442636){logger[_0xcdae('0x1d')](_0xcdae('0x22'),_0x3ff525);if(_0x442636['length']>0x0){logger['info'](_0xcdae('0x36'),_0x442636[0x0]['dataValues']['id'],_0x442636[0x0][_0xcdae('0x37')][_0xcdae('0x38')],_0x442636[0x0]['dataValues']['active']);}logger[_0xcdae('0xf')](_0xcdae('0x22'),_0x3ff525,JSON[_0xcdae('0x10')](_0x442636));_0xf6cee4(_0x442636);})[_0xcdae('0x1a')](function(_0x5e0f8e){logger[_0xcdae('0x11')](_0xcdae('0x22'),_0x5e0f8e[_0xcdae('0x12')],_0x3ff525);_0x242c7f(_0x203ac7['error'](0x1f4,_0x5e0f8e[_0xcdae('0x12')]));});});});};exports[_0xcdae('0x39')]=function(_0x357476){var _0x320ac5=this;return new Promise(function(_0x52c46a,_0x4507a7){return db[_0xcdae('0x25')][_0xcdae('0x26')](function(_0x2b0150){return db[_0xcdae('0x3a')]['create'](_0x357476[_0xcdae('0x19')],{'raw':_0x357476['options']?_0x357476[_0xcdae('0x9')][_0xcdae('0x14')]===undefined?!![]:![]:!![],'transaction':_0x2b0150})[_0xcdae('0x15')](function(){logger[_0xcdae('0x1d')](_0xcdae('0x3b'),JSON[_0xcdae('0x10')](_0x357476['options']['where']),_0x357476[_0xcdae('0x9')][_0xcdae('0xa')][_0xcdae('0x1f')]);return db[_0xcdae('0x8')][_0xcdae('0x21')]({'where':_0x357476[_0xcdae('0x9')]?_0x357476[_0xcdae('0x9')][_0xcdae('0xa')]||null:null,'transaction':_0x2b0150});});})[_0xcdae('0x15')](function(_0x24d182){logger[_0xcdae('0x1d')](_0xcdae('0x39'),_0x357476);logger[_0xcdae('0xf')](_0xcdae('0x39'),_0x357476,JSON['stringify'](_0x24d182));_0x52c46a(_0x24d182);})[_0xcdae('0x1a')](function(_0x19e9d6){logger['error'](_0xcdae('0x39'),_0x19e9d6[_0xcdae('0x12')],_0x357476);_0x4507a7(_0x320ac5['error'](0x1f4,_0x19e9d6[_0xcdae('0x12')]));});});};exports[_0xcdae('0x3c')]=function(_0x1c0d0b){var _0x2673d3=this;return new Promise(function(_0x5ab738,_0x36a42a){return db[_0xcdae('0x8')][_0xcdae('0x27')]({'raw':_0x1c0d0b[_0xcdae('0x9')]?_0x1c0d0b[_0xcdae('0x9')][_0xcdae('0x14')]===undefined?!![]:![]:!![],'where':_0x1c0d0b[_0xcdae('0x9')]?_0x1c0d0b[_0xcdae('0x9')][_0xcdae('0xa')]||null:null,'attributes':[[db[_0xcdae('0x25')]['fn'](_0xcdae('0x3d'),db[_0xcdae('0x25')]['fn']('IF',db[_0xcdae('0x25')]['literal'](_0xcdae('0x3e')+util[_0xcdae('0x3f')](_0xcdae('0x40'),moment()[_0xcdae('0x3f')](_0xcdae('0x41')))+_0xcdae('0x42')))),_0xcdae('0x43')]]})[_0xcdae('0x15')](function(_0x1ad3b8){logger['info'](_0xcdae('0x3c'),_0x1c0d0b);logger[_0xcdae('0xf')](_0xcdae('0x3c'),_0x1c0d0b,JSON[_0xcdae('0x10')](_0x1ad3b8));_0x5ab738(_0x1ad3b8);})[_0xcdae('0x1a')](function(_0x48b618){logger['error'](_0xcdae('0x3c'),_0x48b618[_0xcdae('0x12')],_0x1c0d0b);_0x36a42a(_0x2673d3[_0xcdae('0x11')](0x1f4,_0x48b618[_0xcdae('0x12')]));});});};exports[_0xcdae('0x44')]=function(_0x57c234){var _0x1cf54b=this;return new Promise(function(_0x46b91e,_0x33ab5c){return db[_0xcdae('0x23')][_0xcdae('0x24')]()['then'](function(){return db['sequelize'][_0xcdae('0x26')](function(_0x5e15b4){return db['CmHopper'][_0xcdae('0x27')]({'where':_0x57c234[_0xcdae('0x9')]?_0x57c234['options'][_0xcdae('0xa')]||null:null,'attributes':_0x57c234['options']?_0x57c234[_0xcdae('0x9')][_0xcdae('0xb')]||null:null,'limit':0x1,'order':_0x57c234[_0xcdae('0x9')]?_0x57c234[_0xcdae('0x9')]['order']||null:null,'group':db[_0xcdae('0x8')][_0xcdae('0x31')],'transaction':_0x5e15b4,'lock':_0x5e15b4[_0xcdae('0x29')][_0xcdae('0x2a')],'include':_0x57c234['options']?_0x57c234[_0xcdae('0x9')][_0xcdae('0xc')]?_[_0xcdae('0xd')](_0x57c234['options']['include'],function(_0x363a65){return{'model':db[_0x363a65[_0xcdae('0xe')]],'as':_0x363a65['as'],'attributes':_0x363a65[_0xcdae('0xb')],'include':_0x363a65['include']?_[_0xcdae('0xd')](_0x363a65[_0xcdae('0xc')],function(_0x384116){return{'model':db[_0x384116['model']],'as':_0x384116['as'],'attributes':_0x384116['attributes'],'include':_0x384116[_0xcdae('0xc')]?_[_0xcdae('0xd')](_0x384116[_0xcdae('0xc')],function(_0x12c607){return{'model':db[_0x12c607[_0xcdae('0xe')]],'as':_0x12c607['as'],'attributes':_0x12c607[_0xcdae('0xb')]};}):[]};}):[]};}):[]:[]})[_0xcdae('0x15')](function(_0x225f36){var _0x121bc8=[];for(var _0x23e4bc=0x0;_0x23e4bc<_0x225f36['length'];_0x23e4bc+=0x1){_0x121bc8[_0xcdae('0x34')](_0x225f36[_0x23e4bc][_0xcdae('0x32')](_0x57c234['body'],{'transaction':_0x5e15b4}));}return BPromise['all'](_0x121bc8);});})[_0xcdae('0x15')](function(_0x232f8c){logger['info'](_0xcdae('0x44'),_0x57c234);logger[_0xcdae('0xf')]('GetContactRecallMe',_0x57c234,JSON[_0xcdae('0x10')](_0x232f8c));_0x46b91e(_0x232f8c);})[_0xcdae('0x1a')](function(_0x5dbce4){logger['error']('GetContactRecallMe',_0x5dbce4[_0xcdae('0x12')],_0x57c234);_0x33ab5c(_0x1cf54b[_0xcdae('0x11')](0x1f4,_0x5dbce4[_0xcdae('0x12')]));});});});};exports[_0xcdae('0x45')]=function(_0x3f047c){var _0x41a6ed=this;return new Promise(function(_0xb47bd0,_0x133d70){db[_0xcdae('0x23')]['describe']()[_0xcdae('0x15')](function(_0x1a3697){return db[_0xcdae('0x8')][_0xcdae('0x27')]({'raw':_0x3f047c[_0xcdae('0x9')]?_0x3f047c['options'][_0xcdae('0x14')]===undefined?!![]:![]:!![],'where':_0x3f047c[_0xcdae('0x9')]?_0x3f047c[_0xcdae('0x9')][_0xcdae('0xa')]||null:null,'attributes':_0x3f047c[_0xcdae('0x9')]?_0x3f047c['options'][_0xcdae('0xb')]||null:null,'limit':_0x3f047c[_0xcdae('0x9')]?_0x3f047c[_0xcdae('0x9')][_0xcdae('0x1c')]||null:null,'include':_0x3f047c[_0xcdae('0x9')]?_0x3f047c[_0xcdae('0x9')]['include']?_['map'](_0x3f047c[_0xcdae('0x9')]['include'],function(_0x588ddf){return{'model':db[_0x588ddf[_0xcdae('0xe')]],'as':_0x588ddf['as'],'attributes':_0x588ddf['as']===_0xcdae('0x2b')?_[_0xcdae('0x2c')](_0x1a3697):_0x588ddf[_0xcdae('0xb')],'include':_0x588ddf[_0xcdae('0xc')]?_['map'](_0x588ddf['include'],function(_0x5e673c){return{'model':db[_0x5e673c[_0xcdae('0xe')]],'as':_0x5e673c['as'],'attributes':_0x5e673c[_0xcdae('0xb')],'include':_0x5e673c[_0xcdae('0xc')]?_[_0xcdae('0xd')](_0x5e673c[_0xcdae('0xc')],function(_0x43849c){return{'model':db[_0x43849c[_0xcdae('0xe')]],'as':_0x43849c['as'],'attributes':_0x43849c[_0xcdae('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x913b9b){logger[_0xcdae('0x1d')](_0xcdae('0x7'),_0x3f047c);logger['debug']('GetCmHopper',_0x3f047c,JSON['stringify'](_0x913b9b));_0xb47bd0(_0x913b9b);})[_0xcdae('0x1a')](function(_0x5b308b){logger[_0xcdae('0x11')](_0xcdae('0x7'),_0x5b308b[_0xcdae('0x12')],_0x3f047c);_0x133d70(_0x41a6ed[_0xcdae('0x11')](0x1f4,_0x5b308b['message']));});});});};exports[_0xcdae('0x46')]=function(_0x5152a8){var _0x50abb1=this;return new Promise(function(_0x22ef4b,_0x3c87c2){return db[_0xcdae('0x23')][_0xcdae('0x47')]({'raw':!![],'where':{'phone':_0x5152a8[_0xcdae('0x9')][_0xcdae('0xa')][_0xcdae('0x48')]},'attributes':['id',_0xcdae('0x49')],'order':[['id',_0xcdae('0x4a')]]})['then'](function(_0x264ac7){logger[_0xcdae('0x1d')](_0xcdae('0x4b'),_0x5152a8);logger[_0xcdae('0xf')](_0xcdae('0x4b'),_0x5152a8,JSON[_0xcdae('0x10')](_0x264ac7));_0x22ef4b(_0x264ac7);})[_0xcdae('0x1a')](function(_0x119c98){logger[_0xcdae('0x11')](_0xcdae('0x4b'),_0x119c98[_0xcdae('0x12')],_0x5152a8);_0x3c87c2(_0x50abb1[_0xcdae('0x11')](0x1f4,_0x119c98['message']));});});};exports[_0xcdae('0x4c')]=function(_0x29ae5a){var _0x524614=this;return new Promise(function(_0x251bf9,_0x3c337d){return db['sequelize'][_0xcdae('0x26')](function(_0x5a7642){var _0x36f652=_0x29ae5a['options']&&_0x29ae5a[_0xcdae('0x9')][_0xcdae('0xa')]?_0x29ae5a[_0xcdae('0x9')][_0xcdae('0xa')]:{};return db[_0xcdae('0x8')][_0xcdae('0x32')](_0x29ae5a[_0xcdae('0x19')],{'where':_0x36f652,'transaction':_0x5a7642})[_0xcdae('0x15')](function(_0x40f4ed){logger[_0xcdae('0x1d')](_0xcdae('0x4c'),_0x29ae5a);logger[_0xcdae('0xf')](_0xcdae('0x4c'),_0x29ae5a,JSON['stringify'](_0x40f4ed));_0x251bf9(_0x40f4ed);})[_0xcdae('0x1a')](function(_0x117c0e){logger[_0xcdae('0x11')](_0xcdae('0x4c'),_0x117c0e[_0xcdae('0x12')],_0x29ae5a);_0x3c337d(_0x524614[_0xcdae('0x11')](0x1f4,_0x117c0e[_0xcdae('0x12')]));});});});};exports[_0xcdae('0x4d')]=function(_0x551513){var _0x2d05ee=this;var _0x3f071f=_0x551513[_0xcdae('0x19')][_0xcdae('0xa')][_0xcdae('0x4e')];var _0x5e23e0=_0x551513[_0xcdae('0x19')][_0xcdae('0xa')][_0xcdae('0x4f')];var _0x305b17=_0x551513[_0xcdae('0x19')][_0xcdae('0xa')][_0xcdae('0x50')];return new Promise(function(_0x178850,_0x301f50){return db[_0xcdae('0x8')]['findAll']({'where':{'voiceQueueId':{'$in':_0x3f071f},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xcdae('0x51')](_0xcdae('0x52')+_0x5e23e0+'\x20MINUTE'),'$gt':db[_0xcdae('0x25')][_0xcdae('0x51')](_0xcdae('0x53'))}},'UserId':{'$in':_0x305b17}},'include':[{'model':db[_0xcdae('0x23')],'as':_0xcdae('0x2b')},{'model':db[_0xcdae('0x2d')],'as':'Agent','attributes':['id',_0xcdae('0x2e'),_0xcdae('0x2f')]},{'model':db['CmList'],'as':_0xcdae('0x54')}]})['then'](function(_0x146ca2){if(_0x146ca2['length']>0x0){return db[_0xcdae('0x25')][_0xcdae('0x26')](function(_0x65d991){return db[_0xcdae('0x8')]['update']({'recallmeNotifiedDate':db['sequelize'][_0xcdae('0x51')](_0xcdae('0x53'))},{'where':{'id':{'$in':_[_0xcdae('0xd')](_0x146ca2,'id')}},'transaction':_0x65d991})[_0xcdae('0x15')](function(){_0x178850(_0x146ca2);})[_0xcdae('0x1a')](function(_0x3153a0){logger[_0xcdae('0x11')](_0xcdae('0x4d'),_0x3153a0[_0xcdae('0x12')],_0x551513);_0x301f50(_0x2d05ee[_0xcdae('0x11')](0x1f4,_0x3153a0['message']));});})['catch'](function(_0x39cc57){logger['error'](_0xcdae('0x4d'),_0x39cc57['message'],_0x551513);_0x301f50(_0x2d05ee[_0xcdae('0x11')](0x1f4,_0x39cc57['message']));});}else{_0x178850(_0x146ca2);}});});}; \ No newline at end of file +var _0x47a2=['describe','GetContactRecallMe','GetCmHopperPreview','CmContact','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','\x20MINUTE','NOW()','CmList','lodash','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','limit','include','attributes','model','then','info','debug','error','message','find','where','map','ShowCmHopper','catch','CreateCmHopper','create','body','stringify','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','sequelize','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','CmHopperFinal','raw','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled'];(function(_0x3c6dce,_0x5424dd){var _0x1450e9=function(_0xd51b5c){while(--_0xd51b5c){_0x3c6dce['push'](_0x3c6dce['shift']());}};_0x1450e9(++_0x5424dd);}(_0x47a2,0x64));var _0x247a=function(_0x2ed573,_0x20210b){_0x2ed573=_0x2ed573-0x0;var _0x1e6c67=_0x47a2[_0x2ed573];return _0x1e6c67;};'use strict';var _=require(_0x247a('0x0'));var util=require(_0x247a('0x1'));var moment=require(_0x247a('0x2'));var BPromise=require(_0x247a('0x3'));var db=require(_0x247a('0x4'))['db'];var logger=require('../../config/logger')(_0x247a('0x5'));exports[_0x247a('0x6')]=function(_0x4edc45){var _0x1d67a4=this;return new Promise(function(_0x23ab3e,_0x34da89){return db[_0x247a('0x7')][_0x247a('0x8')]({'raw':_0x4edc45[_0x247a('0x9')]?_0x4edc45[_0x247a('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x4edc45[_0x247a('0x9')]?_0x4edc45[_0x247a('0x9')]['where']||null:null,'attributes':_0x4edc45[_0x247a('0x9')]?_0x4edc45[_0x247a('0x9')]['attributes']||null:null,'limit':_0x4edc45[_0x247a('0x9')]?_0x4edc45['options'][_0x247a('0xa')]||null:null,'include':_0x4edc45[_0x247a('0x9')]?_0x4edc45[_0x247a('0x9')][_0x247a('0xb')]?_['map'](_0x4edc45[_0x247a('0x9')][_0x247a('0xb')],function(_0x22ee6a){return{'model':db[_0x22ee6a['model']],'as':_0x22ee6a['as'],'attributes':_0x22ee6a[_0x247a('0xc')],'include':_0x22ee6a['include']?_['map'](_0x22ee6a[_0x247a('0xb')],function(_0x582fb8){return{'model':db[_0x582fb8['model']],'as':_0x582fb8['as'],'attributes':_0x582fb8[_0x247a('0xc')],'include':_0x582fb8[_0x247a('0xb')]?_['map'](_0x582fb8[_0x247a('0xb')],function(_0x4ea486){return{'model':db[_0x4ea486[_0x247a('0xd')]],'as':_0x4ea486['as'],'attributes':_0x4ea486[_0x247a('0xc')]};}):[]};}):[]};}):[]:[]})[_0x247a('0xe')](function(_0x5cb97e){logger[_0x247a('0xf')](_0x247a('0x6'),_0x4edc45);logger[_0x247a('0x10')]('GetCmHopper',_0x4edc45,JSON['stringify'](_0x5cb97e));_0x23ab3e(_0x5cb97e);})['catch'](function(_0x53c11c){logger[_0x247a('0x11')](_0x247a('0x6'),_0x53c11c[_0x247a('0x12')],_0x4edc45);_0x34da89(_0x1d67a4[_0x247a('0x11')](0x1f4,_0x53c11c['message']));});});};exports['ShowCmHopper']=function(_0x5598fb){var _0x11b585=this;return new Promise(function(_0x44c8cf,_0x30eb63){return db[_0x247a('0x7')][_0x247a('0x13')]({'raw':_0x5598fb[_0x247a('0x9')]?_0x5598fb[_0x247a('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x5598fb[_0x247a('0x9')]?_0x5598fb[_0x247a('0x9')][_0x247a('0x14')]||null:null,'attributes':_0x5598fb[_0x247a('0x9')]?_0x5598fb[_0x247a('0x9')][_0x247a('0xc')]||null:null,'include':_0x5598fb[_0x247a('0x9')]?_0x5598fb[_0x247a('0x9')][_0x247a('0xb')]?_['map'](_0x5598fb[_0x247a('0x9')][_0x247a('0xb')],function(_0x361fc9){return{'model':db[_0x361fc9[_0x247a('0xd')]],'as':_0x361fc9['as'],'attributes':_0x361fc9[_0x247a('0xc')],'include':_0x361fc9['include']?_[_0x247a('0x15')](_0x361fc9[_0x247a('0xb')],function(_0x1ff623){return{'model':db[_0x1ff623[_0x247a('0xd')]],'as':_0x1ff623['as'],'attributes':_0x1ff623['attributes'],'include':_0x1ff623[_0x247a('0xb')]?_['map'](_0x1ff623[_0x247a('0xb')],function(_0x473a3){return{'model':db[_0x473a3[_0x247a('0xd')]],'as':_0x473a3['as'],'attributes':_0x473a3[_0x247a('0xc')]};}):[]};}):[]};}):[]:[]})[_0x247a('0xe')](function(_0x147c67){logger[_0x247a('0xf')](_0x247a('0x16'),_0x5598fb);logger[_0x247a('0x10')](_0x247a('0x16'),_0x5598fb,JSON['stringify'](_0x147c67));_0x44c8cf(_0x147c67);})[_0x247a('0x17')](function(_0x1e400e){logger[_0x247a('0x11')](_0x247a('0x16'),_0x1e400e[_0x247a('0x12')],_0x5598fb);_0x30eb63(_0x11b585['error'](0x1f4,_0x1e400e['message']));});});};exports[_0x247a('0x18')]=function(_0x1b539b){var _0x1e7e38=this;return new Promise(function(_0x2af426,_0x41842f){return db[_0x247a('0x7')][_0x247a('0x19')](_0x1b539b[_0x247a('0x1a')],{'raw':_0x1b539b['options']?_0x1b539b[_0x247a('0x9')]['raw']===undefined?!![]:![]:!![]})[_0x247a('0xe')](function(_0x3d248a){logger['info']('CreateCmHopper',_0x1b539b);logger[_0x247a('0x10')](_0x247a('0x18'),_0x1b539b,JSON[_0x247a('0x1b')](_0x3d248a));_0x2af426(_0x3d248a);})['catch'](function(_0x4ab7ac){logger[_0x247a('0x11')](_0x247a('0x18'),_0x4ab7ac[_0x247a('0x12')],_0x1b539b);_0x41842f(_0x1e7e38[_0x247a('0x11')](0x1f4,_0x4ab7ac['message']));});});};exports[_0x247a('0x1c')]=function(_0x4ef1a3){var _0x46bff3=this;return new Promise(function(_0x55bf74,_0x4951d9){return db['CmHopper'][_0x247a('0x1d')](_0x4ef1a3[_0x247a('0x1a')],{'raw':_0x4ef1a3['options']?_0x4ef1a3[_0x247a('0x9')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ef1a3[_0x247a('0x9')]?_0x4ef1a3[_0x247a('0x9')][_0x247a('0x14')]||null:null,'attributes':_0x4ef1a3[_0x247a('0x9')]?_0x4ef1a3[_0x247a('0x9')]['attributes']||null:null,'limit':_0x4ef1a3[_0x247a('0x9')]?_0x4ef1a3['options'][_0x247a('0xa')]||null:null})[_0x247a('0xe')](function(_0x49d454){logger['info'](_0x247a('0x1c'),_0x4ef1a3);logger[_0x247a('0xf')](_0x247a('0x1e'),JSON[_0x247a('0x1b')](_0x4ef1a3['options'][_0x247a('0x14')]),_0x4ef1a3[_0x247a('0x1a')][_0x247a('0x1f')]);logger[_0x247a('0x10')](_0x247a('0x1c'),_0x4ef1a3,JSON[_0x247a('0x1b')](_0x49d454));_0x55bf74(_0x49d454);})['catch'](function(_0x33a47a){logger[_0x247a('0x11')](_0x247a('0x1c'),_0x33a47a[_0x247a('0x12')],_0x4ef1a3);_0x4951d9(_0x46bff3[_0x247a('0x11')](0x1f4,_0x33a47a[_0x247a('0x12')]));});});};exports[_0x247a('0x20')]=function(_0x2637e5){var _0x37fc27=this;return new Promise(function(_0x402765,_0x2a88df){return db['CmHopper'][_0x247a('0x21')]({'where':_0x2637e5['options']?_0x2637e5[_0x247a('0x9')][_0x247a('0x14')]||null:null})[_0x247a('0xe')](function(_0x1da494){logger[_0x247a('0xf')](_0x247a('0x20'),_0x2637e5);logger[_0x247a('0x10')](_0x247a('0x20'),_0x2637e5,JSON[_0x247a('0x1b')](_0x1da494));_0x402765(_0x1da494);})['catch'](function(_0x156ee6){logger[_0x247a('0x11')]('DestroyCmHopper',_0x156ee6[_0x247a('0x12')],_0x2637e5);_0x2a88df(_0x37fc27['error'](0x1f4,_0x156ee6[_0x247a('0x12')]));});});};exports['GetContactDialer']=function(_0x3c0c6a){var _0x4bd0b4=this;return new Promise(function(_0x5a77d7,_0x180c77){return db['CmContact']['describe']()['then'](function(_0x3d6817){return db[_0x247a('0x22')]['transaction'](function(_0x17f00e){return db[_0x247a('0x7')][_0x247a('0x8')]({'where':_0x3c0c6a[_0x247a('0x9')]?_0x3c0c6a['options'][_0x247a('0x14')]||null:null,'attributes':_0x3c0c6a['options']?_0x3c0c6a['options']['attributes']||null:null,'limit':_0x3c0c6a[_0x247a('0x9')]?_0x3c0c6a['options'][_0x247a('0xa')]||null:null,'order':_0x3c0c6a[_0x247a('0x9')]?_0x3c0c6a[_0x247a('0x9')][_0x247a('0x23')]||null:null,'transaction':_0x17f00e,'lock':_0x17f00e[_0x247a('0x24')][_0x247a('0x25')],'include':[{'model':db['CmContact'],'as':_0x247a('0x26'),'attributes':_[_0x247a('0x27')](_0x3d6817)},{'model':db[_0x247a('0x28')],'as':_0x247a('0x29'),'attributes':['id',_0x247a('0x2a'),_0x247a('0x2b')]}]})[_0x247a('0xe')](function(_0x336540){var _0x10483c=[];var _0x46dbaf=[];for(var _0x5e9912=0x0;_0x5e9912<_0x336540[_0x247a('0x2c')];_0x5e9912+=0x1){var _0x4b3ab2=_0x336540[_0x5e9912][_0x247a('0x2d')];if(_0x4b3ab2===null){_0x10483c[_0x247a('0x2e')](_0x336540[_0x5e9912]['update'](_0x3c0c6a['body'],{'transaction':_0x17f00e}));}else if(!_0x46dbaf['includes'](_0x4b3ab2)){_0x46dbaf['push'](_0x4b3ab2);_0x10483c[_0x247a('0x2e')](_0x336540[_0x5e9912][_0x247a('0x1d')](_0x3c0c6a[_0x247a('0x1a')],{'transaction':_0x17f00e}));}}return BPromise[_0x247a('0x2f')](_0x10483c);});})[_0x247a('0xe')](function(_0x5df277){logger[_0x247a('0xf')](_0x247a('0x30'),_0x3c0c6a);if(_0x5df277[_0x247a('0x2c')]>0x0){logger['info'](_0x247a('0x31'),_0x5df277[0x0][_0x247a('0x32')]['id'],_0x5df277[0x0][_0x247a('0x32')][_0x247a('0x33')],_0x5df277[0x0][_0x247a('0x32')][_0x247a('0x1f')]);}logger[_0x247a('0x10')]('GetContactDialer',_0x3c0c6a,JSON[_0x247a('0x1b')](_0x5df277));_0x5a77d7(_0x5df277);})[_0x247a('0x17')](function(_0x3bc8ed){logger[_0x247a('0x11')]('GetContactDialer',_0x3bc8ed[_0x247a('0x12')],_0x3c0c6a);_0x180c77(_0x4bd0b4[_0x247a('0x11')](0x1f4,_0x3bc8ed[_0x247a('0x12')]));});});});};exports[_0x247a('0x34')]=function(_0x2253fb){var _0x259c00=this;return new Promise(function(_0x1cb616,_0x2497b5){return db[_0x247a('0x22')][_0x247a('0x35')](function(_0x55ec0c){return db[_0x247a('0x36')][_0x247a('0x19')](_0x2253fb[_0x247a('0x1a')],{'raw':_0x2253fb[_0x247a('0x9')]?_0x2253fb[_0x247a('0x9')][_0x247a('0x37')]===undefined?!![]:![]:!![],'transaction':_0x55ec0c})[_0x247a('0xe')](function(){logger[_0x247a('0xf')](_0x247a('0x38'),JSON['stringify'](_0x2253fb[_0x247a('0x9')][_0x247a('0x14')]),_0x2253fb[_0x247a('0x9')]['where']['active']);return db[_0x247a('0x7')][_0x247a('0x21')]({'where':_0x2253fb[_0x247a('0x9')]?_0x2253fb['options'][_0x247a('0x14')]||null:null,'transaction':_0x55ec0c});});})[_0x247a('0xe')](function(_0x23e1a6){logger[_0x247a('0xf')](_0x247a('0x34'),_0x2253fb);logger[_0x247a('0x10')](_0x247a('0x34'),_0x2253fb,JSON[_0x247a('0x1b')](_0x23e1a6));_0x1cb616(_0x23e1a6);})[_0x247a('0x17')](function(_0x1cc461){logger['error'](_0x247a('0x34'),_0x1cc461[_0x247a('0x12')],_0x2253fb);_0x2497b5(_0x259c00['error'](0x1f4,_0x1cc461[_0x247a('0x12')]));});});};exports[_0x247a('0x39')]=function(_0x3f6a03){var _0x4c9683=this;return new Promise(function(_0x36f68d,_0x597a9a){return db['CmHopper'][_0x247a('0x8')]({'raw':_0x3f6a03[_0x247a('0x9')]?_0x3f6a03['options']['raw']===undefined?!![]:![]:!![],'where':_0x3f6a03[_0x247a('0x9')]?_0x3f6a03[_0x247a('0x9')][_0x247a('0x14')]||null:null,'attributes':[[db[_0x247a('0x22')]['fn'](_0x247a('0x3a'),db[_0x247a('0x22')]['fn']('IF',db[_0x247a('0x22')][_0x247a('0x3b')](_0x247a('0x3c')+util['format'](_0x247a('0x3d'),moment()[_0x247a('0x3e')](_0x247a('0x3f')))+_0x247a('0x40')))),_0x247a('0x41')]]})[_0x247a('0xe')](function(_0x342f99){logger[_0x247a('0xf')](_0x247a('0x39'),_0x3f6a03);logger[_0x247a('0x10')](_0x247a('0x39'),_0x3f6a03,JSON[_0x247a('0x1b')](_0x342f99));_0x36f68d(_0x342f99);})[_0x247a('0x17')](function(_0x558463){logger[_0x247a('0x11')](_0x247a('0x39'),_0x558463[_0x247a('0x12')],_0x3f6a03);_0x597a9a(_0x4c9683[_0x247a('0x11')](0x1f4,_0x558463['message']));});});};exports['GetContactRecallMe']=function(_0x12d22c){var _0x44b4a1=this;return new Promise(function(_0x489af7,_0x710d29){return db['CmContact'][_0x247a('0x42')]()[_0x247a('0xe')](function(){return db[_0x247a('0x22')][_0x247a('0x35')](function(_0x4470a5){return db['CmHopper']['findAll']({'where':_0x12d22c[_0x247a('0x9')]?_0x12d22c[_0x247a('0x9')][_0x247a('0x14')]||null:null,'attributes':_0x12d22c[_0x247a('0x9')]?_0x12d22c['options']['attributes']||null:null,'limit':0x1,'order':_0x12d22c['options']?_0x12d22c[_0x247a('0x9')][_0x247a('0x23')]||null:null,'group':db[_0x247a('0x7')][_0x247a('0x2d')],'transaction':_0x4470a5,'lock':_0x4470a5['LOCK'][_0x247a('0x25')],'include':_0x12d22c[_0x247a('0x9')]?_0x12d22c[_0x247a('0x9')]['include']?_[_0x247a('0x15')](_0x12d22c[_0x247a('0x9')][_0x247a('0xb')],function(_0xea5075){return{'model':db[_0xea5075['model']],'as':_0xea5075['as'],'attributes':_0xea5075[_0x247a('0xc')],'include':_0xea5075[_0x247a('0xb')]?_['map'](_0xea5075[_0x247a('0xb')],function(_0x57866b){return{'model':db[_0x57866b['model']],'as':_0x57866b['as'],'attributes':_0x57866b[_0x247a('0xc')],'include':_0x57866b['include']?_[_0x247a('0x15')](_0x57866b[_0x247a('0xb')],function(_0x31b803){return{'model':db[_0x31b803[_0x247a('0xd')]],'as':_0x31b803['as'],'attributes':_0x31b803[_0x247a('0xc')]};}):[]};}):[]};}):[]:[]})[_0x247a('0xe')](function(_0x2dfc6e){var _0x3697c4=[];for(var _0x2651bf=0x0;_0x2651bf<_0x2dfc6e[_0x247a('0x2c')];_0x2651bf+=0x1){_0x3697c4[_0x247a('0x2e')](_0x2dfc6e[_0x2651bf][_0x247a('0x1d')](_0x12d22c[_0x247a('0x1a')],{'transaction':_0x4470a5}));}return BPromise[_0x247a('0x2f')](_0x3697c4);});})['then'](function(_0x426d91){logger[_0x247a('0xf')](_0x247a('0x43'),_0x12d22c);logger[_0x247a('0x10')](_0x247a('0x43'),_0x12d22c,JSON[_0x247a('0x1b')](_0x426d91));_0x489af7(_0x426d91);})['catch'](function(_0x1ce2d9){logger[_0x247a('0x11')]('GetContactRecallMe',_0x1ce2d9[_0x247a('0x12')],_0x12d22c);_0x710d29(_0x44b4a1[_0x247a('0x11')](0x1f4,_0x1ce2d9[_0x247a('0x12')]));});});});};exports[_0x247a('0x44')]=function(_0x247eef){var _0x2abf7d=this;return new Promise(function(_0x3d57a0,_0x2ee4ce){db[_0x247a('0x45')]['describe']()['then'](function(_0x1bcc0c){return db[_0x247a('0x7')][_0x247a('0x8')]({'raw':_0x247eef['options']?_0x247eef[_0x247a('0x9')][_0x247a('0x37')]===undefined?!![]:![]:!![],'where':_0x247eef[_0x247a('0x9')]?_0x247eef[_0x247a('0x9')][_0x247a('0x14')]||null:null,'attributes':_0x247eef[_0x247a('0x9')]?_0x247eef[_0x247a('0x9')][_0x247a('0xc')]||null:null,'limit':_0x247eef['options']?_0x247eef[_0x247a('0x9')][_0x247a('0xa')]||null:null,'include':_0x247eef[_0x247a('0x9')]?_0x247eef[_0x247a('0x9')][_0x247a('0xb')]?_[_0x247a('0x15')](_0x247eef[_0x247a('0x9')][_0x247a('0xb')],function(_0x2eb353){return{'model':db[_0x2eb353['model']],'as':_0x2eb353['as'],'attributes':_0x2eb353['as']===_0x247a('0x26')?_[_0x247a('0x27')](_0x1bcc0c):_0x2eb353[_0x247a('0xc')],'include':_0x2eb353['include']?_[_0x247a('0x15')](_0x2eb353[_0x247a('0xb')],function(_0x562bb1){return{'model':db[_0x562bb1[_0x247a('0xd')]],'as':_0x562bb1['as'],'attributes':_0x562bb1[_0x247a('0xc')],'include':_0x562bb1[_0x247a('0xb')]?_[_0x247a('0x15')](_0x562bb1[_0x247a('0xb')],function(_0x4e840f){return{'model':db[_0x4e840f['model']],'as':_0x4e840f['as'],'attributes':_0x4e840f['attributes']};}):[]};}):[]};}):[]:[]})[_0x247a('0xe')](function(_0x15b943){logger[_0x247a('0xf')](_0x247a('0x6'),_0x247eef);logger[_0x247a('0x10')](_0x247a('0x6'),_0x247eef,JSON[_0x247a('0x1b')](_0x15b943));_0x3d57a0(_0x15b943);})['catch'](function(_0x4452d5){logger[_0x247a('0x11')](_0x247a('0x6'),_0x4452d5['message'],_0x247eef);_0x2ee4ce(_0x2abf7d[_0x247a('0x11')](0x1f4,_0x4452d5['message']));});});});};exports[_0x247a('0x46')]=function(_0x316740){var _0x533681=this;return new Promise(function(_0x3f467a,_0x36a341){return db[_0x247a('0x45')][_0x247a('0x47')]({'raw':!![],'where':{'phone':_0x316740['options'][_0x247a('0x14')][_0x247a('0x48')]},'attributes':['id',_0x247a('0x49')],'order':[['id',_0x247a('0x4a')]]})[_0x247a('0xe')](function(_0x42cd85){logger[_0x247a('0xf')](_0x247a('0x4b'),_0x316740);logger[_0x247a('0x10')]('getContactByPhone',_0x316740,JSON[_0x247a('0x1b')](_0x42cd85));_0x3f467a(_0x42cd85);})[_0x247a('0x17')](function(_0x254aaf){logger['error'](_0x247a('0x4b'),_0x254aaf[_0x247a('0x12')],_0x316740);_0x36a341(_0x533681[_0x247a('0x11')](0x1f4,_0x254aaf[_0x247a('0x12')]));});});};exports[_0x247a('0x4c')]=function(_0x1c0ecc){var _0x5f4599=this;return new Promise(function(_0x5281cf,_0x3a5a01){return db['sequelize']['transaction'](function(_0x4d82c4){var _0x32b1f7=_0x1c0ecc[_0x247a('0x9')]&&_0x1c0ecc[_0x247a('0x9')][_0x247a('0x14')]?_0x1c0ecc[_0x247a('0x9')][_0x247a('0x14')]:{};return db[_0x247a('0x7')]['update'](_0x1c0ecc[_0x247a('0x1a')],{'where':_0x32b1f7,'transaction':_0x4d82c4})[_0x247a('0xe')](function(_0x4f9e54){logger['info'](_0x247a('0x4c'),_0x1c0ecc);logger['debug']('ResetActiveCalls',_0x1c0ecc,JSON[_0x247a('0x1b')](_0x4f9e54));_0x5281cf(_0x4f9e54);})[_0x247a('0x17')](function(_0x165457){logger[_0x247a('0x11')]('ResetActiveCalls',_0x165457[_0x247a('0x12')],_0x1c0ecc);_0x3a5a01(_0x5f4599[_0x247a('0x11')](0x1f4,_0x165457[_0x247a('0x12')]));});});});};exports[_0x247a('0x4d')]=function(_0x2bf376){var _0x17e36f=this;var _0x32c314=_0x2bf376[_0x247a('0x1a')][_0x247a('0x14')][_0x247a('0x4e')];var _0x4841a5=_0x2bf376[_0x247a('0x1a')][_0x247a('0x14')][_0x247a('0x4f')];var _0x1ba225=_0x2bf376[_0x247a('0x1a')][_0x247a('0x14')]['availableAgentsIds'];return new Promise(function(_0x3cd01c,_0x5f2fb8){return db['CmHopper'][_0x247a('0x8')]({'where':{'voiceQueueId':{'$in':_0x32c314},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x247a('0x22')][_0x247a('0x3b')]('NOW()\x20+\x20INTERVAL\x20'+_0x4841a5+_0x247a('0x50')),'$gt':db[_0x247a('0x22')]['literal'](_0x247a('0x51'))}},'UserId':{'$in':_0x1ba225}},'include':[{'model':db[_0x247a('0x45')],'as':_0x247a('0x26')},{'model':db[_0x247a('0x28')],'as':_0x247a('0x29'),'attributes':['id',_0x247a('0x2a'),_0x247a('0x2b')]},{'model':db[_0x247a('0x52')],'as':'List'}]})[_0x247a('0xe')](function(_0x323f1a){if(_0x323f1a[_0x247a('0x2c')]>0x0){return db[_0x247a('0x22')]['transaction'](function(_0x3f1cdc){return db[_0x247a('0x7')][_0x247a('0x1d')]({'recallmeNotifiedDate':db['sequelize'][_0x247a('0x3b')](_0x247a('0x51'))},{'where':{'id':{'$in':_['map'](_0x323f1a,'id')}},'transaction':_0x3f1cdc})[_0x247a('0xe')](function(){_0x3cd01c(_0x323f1a);})['catch'](function(_0x377273){logger[_0x247a('0x11')](_0x247a('0x4d'),_0x377273['message'],_0x2bf376);_0x5f2fb8(_0x17e36f[_0x247a('0x11')](0x1f4,_0x377273[_0x247a('0x12')]));});})[_0x247a('0x17')](function(_0x2eca69){logger[_0x247a('0x11')](_0x247a('0x4d'),_0x2eca69[_0x247a('0x12')],_0x2bf376);_0x5f2fb8(_0x17e36f[_0x247a('0x11')](0x1f4,_0x2eca69['message']));});}else{_0x3cd01c(_0x323f1a);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 3c99880..c5b2f26 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 _0xa7d3=['/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','/timezones','getTimezones'];(function(_0x31e0a2,_0x1b51ab){var _0x19d493=function(_0x55d390){while(--_0x55d390){_0x31e0a2['push'](_0x31e0a2['shift']());}};_0x19d493(++_0x1b51ab);}(_0xa7d3,0x6c));var _0x3a7d=function(_0x2152a5,_0x507007){_0x2152a5=_0x2152a5-0x0;var _0x266683=_0xa7d3[_0x2152a5];return _0x266683;};'use strict';var express=require(_0x3a7d('0x0'));var router=express[_0x3a7d('0x1')]();var auth=require(_0x3a7d('0x2'));var controller=require(_0x3a7d('0x3'));router['get']('/',auth[_0x3a7d('0x4')](),controller[_0x3a7d('0x5')]);router[_0x3a7d('0x6')](_0x3a7d('0x7'),auth[_0x3a7d('0x4')](),controller[_0x3a7d('0x8')]);router[_0x3a7d('0x6')](_0x3a7d('0x9'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x3a7d('0x6')](_0x3a7d('0xa'),auth[_0x3a7d('0x4')](),controller[_0x3a7d('0xb')]);router[_0x3a7d('0x6')](_0x3a7d('0xc'),auth['isAuthenticated'](),controller[_0x3a7d('0xd')]);router[_0x3a7d('0x6')](_0x3a7d('0xe'),auth['isAuthenticated'](),controller[_0x3a7d('0xf')]);router[_0x3a7d('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3a7d('0x10')](_0x3a7d('0x11'),auth['isAuthenticated'](),controller[_0x3a7d('0x12')]);router[_0x3a7d('0x10')](_0x3a7d('0x13'),auth['isAuthenticated'](),controller[_0x3a7d('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3a7d('0x15')](_0x3a7d('0xc'),auth['isAuthenticated'](),controller[_0x3a7d('0x16')]);module[_0x3a7d('0x17')]=router; \ No newline at end of file +var _0x8d08=['/preview','getPreview','/timezone','getTimezone','update','delete','destroy','exports','express','Router','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create'];(function(_0x503355,_0x50bc8b){var _0xb5623d=function(_0x354040){while(--_0x354040){_0x503355['push'](_0x503355['shift']());}};_0xb5623d(++_0x50bc8b);}(_0x8d08,0x1e3));var _0x88d0=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x8d08[_0x38a7ac];return _0x53061a;};'use strict';var express=require(_0x88d0('0x0'));var router=express[_0x88d0('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x88d0('0x2'));router[_0x88d0('0x3')]('/',auth['isAuthenticated'](),controller[_0x88d0('0x4')]);router[_0x88d0('0x3')](_0x88d0('0x5'),auth[_0x88d0('0x6')](),controller[_0x88d0('0x7')]);router[_0x88d0('0x3')](_0x88d0('0x8'),auth[_0x88d0('0x6')](),controller[_0x88d0('0x9')]);router['get']('/timezones',auth[_0x88d0('0x6')](),controller[_0x88d0('0xa')]);router[_0x88d0('0x3')](_0x88d0('0xb'),auth['isAuthenticated'](),controller[_0x88d0('0xc')]);router[_0x88d0('0x3')](_0x88d0('0xd'),auth[_0x88d0('0x6')](),controller[_0x88d0('0xe')]);router[_0x88d0('0xf')]('/',auth[_0x88d0('0x6')](),controller[_0x88d0('0x10')]);router[_0x88d0('0xf')](_0x88d0('0x11'),auth[_0x88d0('0x6')](),controller[_0x88d0('0x12')]);router[_0x88d0('0xf')](_0x88d0('0x13'),auth[_0x88d0('0x6')](),controller[_0x88d0('0x14')]);router['put'](_0x88d0('0xb'),auth['isAuthenticated'](),controller[_0x88d0('0x15')]);router[_0x88d0('0x16')](_0x88d0('0xb'),auth[_0x88d0('0x6')](),controller[_0x88d0('0x17')]);module[_0x88d0('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index f8ee1ba..b230095 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 _0x9777=['STRING','INTEGER','DATE','moment','sequelize'];(function(_0x48bc64,_0x180f42){var _0x567dff=function(_0x4adc62){while(--_0x4adc62){_0x48bc64['push'](_0x48bc64['shift']());}};_0x567dff(++_0x180f42);}(_0x9777,0x152));var _0x7977=function(_0x51a288,_0xe9c0b5){_0x51a288=_0x51a288-0x0;var _0x10fecd=_0x9777[_0x51a288];return _0x10fecd;};'use strict';var moment=require(_0x7977('0x0'));var Sequelize=require(_0x7977('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x7977('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x7977('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x7977('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x7977('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7977('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7977('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x7977('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7977('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7977('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7977('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x370a=['INTEGER','STRING','format','sequelize'];(function(_0x1ed5fb,_0x251e39){var _0x43677b=function(_0x40f7c0){while(--_0x40f7c0){_0x1ed5fb['push'](_0x1ed5fb['shift']());}};_0x43677b(++_0x251e39);}(_0x370a,0x14b));var _0xa370=function(_0x5a2f41,_0x3962a9){_0x5a2f41=_0x5a2f41-0x0;var _0x533cb8=_0x370a[_0x5a2f41];return _0x533cb8;};'use strict';var moment=require('moment');var Sequelize=require(_0xa370('0x0'));module['exports']={'CmHopperId':{'type':Sequelize[_0xa370('0x1')]},'phone':{'type':Sequelize[_0xa370('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xa370('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa370('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa370('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa370('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa370('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa370('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa370('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa370('0x1')],'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 8ecc7e6..eeae4b5 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 _0xa094=['filter','merge','CmHopperAdditionalPhone','includeAll','findAll','rows','show','params','keys','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','autoAssociation','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','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick'];(function(_0x581ce1,_0x48799e){var _0x404586=function(_0x3a366f){while(--_0x3a366f){_0x581ce1['push'](_0x581ce1['shift']());}};_0x404586(++_0x48799e);}(_0xa094,0xba));var _0x4a09=function(_0x14176e,_0x455e99){_0x14176e=_0x14176e-0x0;var _0x151a2f=_0xa094[_0x14176e];return _0x151a2f;};'use strict';var emlformat=require(_0x4a09('0x0'));var rimraf=require(_0x4a09('0x1'));var zipdir=require(_0x4a09('0x2'));var jsonpatch=require(_0x4a09('0x3'));var rp=require('request-promise');var moment=require(_0x4a09('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4a09('0x5'));var util=require(_0x4a09('0x6'));var path=require(_0x4a09('0x7'));var sox=require(_0x4a09('0x8'));var csv=require(_0x4a09('0x9'));var ejs=require(_0x4a09('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a09('0xb'));var squel=require(_0x4a09('0xc'));var crypto=require(_0x4a09('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4a09('0xe'));var toCsv=require(_0x4a09('0x9'));var querystring=require(_0x4a09('0xf'));var Papa=require(_0x4a09('0x10'));var Redis=require(_0x4a09('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4a09('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a09('0x13'));var logger=require(_0x4a09('0x14'))(_0x4a09('0x15'));var utils=require(_0x4a09('0x16'));var config=require(_0x4a09('0x17'));var licenseUtil=require(_0x4a09('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1785ce,_0x2af100){_0x2af100=_0x2af100||0xcc;return function(_0x525b12){if(_0x525b12){return _0x1785ce['sendStatus'](_0x2af100);}return _0x1785ce[_0x4a09('0x19')](_0x2af100)[_0x4a09('0x1a')]();};}function respondWithResult(_0x1e68a1,_0x1b1f5e){_0x1b1f5e=_0x1b1f5e||0xc8;return function(_0x32a3bd){if(_0x32a3bd){return _0x1e68a1[_0x4a09('0x19')](_0x1b1f5e)[_0x4a09('0x1b')](_0x32a3bd);}};}function respondWithFilteredResult(_0x4b9047,_0x415828){return function(_0x2a645f){if(_0x2a645f){var _0x599847=typeof _0x415828[_0x4a09('0x1c')]===_0x4a09('0x1d')&&typeof _0x415828[_0x4a09('0x1e')]===_0x4a09('0x1d');var _0x43814b=_0x2a645f[_0x4a09('0x1f')];var _0x2a95f8=_0x599847?0x0:_0x415828[_0x4a09('0x1c')];var _0x3092c8=_0x599847?_0x2a645f[_0x4a09('0x1f')]:_0x415828[_0x4a09('0x1c')]+_0x415828[_0x4a09('0x1e')];var _0xe36e88;if(_0x3092c8>=_0x43814b){_0x3092c8=_0x43814b;_0xe36e88=0xc8;}else{_0xe36e88=0xce;}_0x4b9047[_0x4a09('0x19')](_0xe36e88);return _0x4b9047[_0x4a09('0x20')](_0x4a09('0x21'),_0x2a95f8+'-'+_0x3092c8+'/'+_0x43814b)[_0x4a09('0x1b')](_0x2a645f);}return null;};}function patchUpdates(_0x23f7dc){return function(_0x2bcf73){try{jsonpatch['apply'](_0x2bcf73,_0x23f7dc,!![]);}catch(_0x4c4c80){return BPromise[_0x4a09('0x22')](_0x4c4c80);}return _0x2bcf73['save']();};}function saveUpdates(_0x3a09f2,_0x1c51e3){return function(_0x507f3e){if(_0x507f3e){return _0x507f3e[_0x4a09('0x23')](_0x3a09f2)[_0x4a09('0x24')](function(_0x326c44){return _0x326c44;});}return null;};}function removeEntity(_0x63d968,_0x449b48){return function(_0x418616){if(_0x418616){return _0x418616[_0x4a09('0x25')]()[_0x4a09('0x24')](function(){var _0x3b55aa=_0x418616[_0x4a09('0x26')]({'plain':!![]});var _0xd93db4='CmHopperAdditionalPhones';return db[_0x4a09('0x27')][_0x4a09('0x25')]({'where':{'type':_0xd93db4,'resourceId':_0x3b55aa['id']}})[_0x4a09('0x24')](function(){return _0x418616;});})[_0x4a09('0x24')](function(){_0x63d968[_0x4a09('0x19')](0xcc)[_0x4a09('0x1a')]();});}};}function handleEntityNotFound(_0x464584,_0x19b644){return function(_0x2cc0b1){if(!_0x2cc0b1){_0x464584[_0x4a09('0x28')](0x194);}return _0x2cc0b1;};}function handleError(_0x35da89,_0x484603){_0x484603=_0x484603||0x1f4;return function(_0x4b0080){logger[_0x4a09('0x29')](_0x4b0080['stack']);if(_0x4b0080['name']){delete _0x4b0080[_0x4a09('0x2a')];}_0x35da89[_0x4a09('0x19')](_0x484603)[_0x4a09('0x2b')](_0x4b0080);};}exports[_0x4a09('0x2c')]=function(_0xce68c8,_0x5426e2){var _0x54cf8d={},_0x4bc096={},_0x127895={'count':0x0,'rows':[]};var _0x2aa124=_[_0x4a09('0x2d')](db['CmHopperAdditionalPhone'][_0x4a09('0x2e')],function(_0x39d91c){return{'name':_0x39d91c['fieldName'],'type':_0x39d91c[_0x4a09('0x2f')][_0x4a09('0x30')]};});_0x4bc096['model']=_[_0x4a09('0x2d')](_0x2aa124,_0x4a09('0x2a'));_0x4bc096[_0x4a09('0x31')]=_['keys'](_0xce68c8[_0x4a09('0x31')]);_0x4bc096[_0x4a09('0x32')]=_[_0x4a09('0x33')](_0x4bc096[_0x4a09('0x34')],_0x4bc096[_0x4a09('0x31')]);_0x54cf8d[_0x4a09('0x35')]=_['intersection'](_0x4bc096[_0x4a09('0x34')],qs[_0x4a09('0x36')](_0xce68c8[_0x4a09('0x31')][_0x4a09('0x36')]));_0x54cf8d['attributes']=_0x54cf8d['attributes'][_0x4a09('0x37')]?_0x54cf8d[_0x4a09('0x35')]:_0x4bc096[_0x4a09('0x34')];if(!_0xce68c8[_0x4a09('0x31')][_0x4a09('0x38')]('nolimit')){_0x54cf8d[_0x4a09('0x1e')]=qs[_0x4a09('0x1e')](_0xce68c8[_0x4a09('0x31')][_0x4a09('0x1e')]);_0x54cf8d[_0x4a09('0x1c')]=qs[_0x4a09('0x1c')](_0xce68c8['query'][_0x4a09('0x1c')]);}_0x54cf8d['order']=qs[_0x4a09('0x39')](_0xce68c8[_0x4a09('0x31')][_0x4a09('0x39')]);_0x54cf8d[_0x4a09('0x3a')]=qs[_0x4a09('0x32')](_[_0x4a09('0x3b')](_0xce68c8['query'],_0x4bc096[_0x4a09('0x32')]),_0x2aa124);if(_0xce68c8[_0x4a09('0x31')][_0x4a09('0x3c')]){_0x54cf8d['where']=_[_0x4a09('0x3d')](_0x54cf8d[_0x4a09('0x3a')],{'$or':_[_0x4a09('0x2d')](_0x2aa124,function(_0x22c560){if(_0x22c560[_0x4a09('0x2f')]!=='VIRTUAL'){var _0x27f873={};_0x27f873[_0x22c560[_0x4a09('0x2a')]]={'$like':'%'+_0xce68c8[_0x4a09('0x31')]['filter']+'%'};return _0x27f873;}})});}_0x54cf8d=_[_0x4a09('0x3d')]({},_0x54cf8d,_0xce68c8['options']);var _0x311bb6={'where':_0x54cf8d[_0x4a09('0x3a')]};return db[_0x4a09('0x3e')][_0x4a09('0x1f')](_0x311bb6)['then'](function(_0x49aaa2){_0x127895[_0x4a09('0x1f')]=_0x49aaa2;if(_0xce68c8[_0x4a09('0x31')][_0x4a09('0x3f')]){_0x54cf8d['include']=[{'all':!![]}];}return db[_0x4a09('0x3e')][_0x4a09('0x40')](_0x54cf8d);})[_0x4a09('0x24')](function(_0x29eeb3){_0x127895[_0x4a09('0x41')]=_0x29eeb3;return _0x127895;})[_0x4a09('0x24')](respondWithFilteredResult(_0x5426e2,_0x54cf8d))['catch'](handleError(_0x5426e2,null));};exports[_0x4a09('0x42')]=function(_0x2f48d7,_0x1934f3){var _0xd9a1a4={'raw':!![],'where':{'id':_0x2f48d7[_0x4a09('0x43')]['id']}},_0x424544={};_0x424544[_0x4a09('0x34')]=_[_0x4a09('0x44')](db[_0x4a09('0x3e')]['rawAttributes']);_0x424544[_0x4a09('0x31')]=_[_0x4a09('0x44')](_0x2f48d7[_0x4a09('0x31')]);_0x424544[_0x4a09('0x32')]=_[_0x4a09('0x33')](_0x424544[_0x4a09('0x34')],_0x424544['query']);_0xd9a1a4[_0x4a09('0x35')]=_[_0x4a09('0x33')](_0x424544[_0x4a09('0x34')],qs[_0x4a09('0x36')](_0x2f48d7['query'][_0x4a09('0x36')]));_0xd9a1a4[_0x4a09('0x35')]=_0xd9a1a4[_0x4a09('0x35')][_0x4a09('0x37')]?_0xd9a1a4[_0x4a09('0x35')]:_0x424544[_0x4a09('0x34')];if(_0x2f48d7['query'][_0x4a09('0x3f')]){_0xd9a1a4[_0x4a09('0x45')]=[{'all':!![]}];}_0xd9a1a4=_[_0x4a09('0x3d')]({},_0xd9a1a4,_0x2f48d7[_0x4a09('0x46')]);return db[_0x4a09('0x3e')][_0x4a09('0x47')](_0xd9a1a4)[_0x4a09('0x24')](handleEntityNotFound(_0x1934f3,null))[_0x4a09('0x24')](respondWithResult(_0x1934f3,null))[_0x4a09('0x48')](handleError(_0x1934f3,null));};exports[_0x4a09('0x49')]=function(_0x472af5,_0x502334){return db[_0x4a09('0x3e')]['create'](_0x472af5[_0x4a09('0x4a')],{})['then'](function(_0x80b4c8){var _0x2f3c3=_0x472af5[_0x4a09('0x4b')][_0x4a09('0x26')]({'plain':!![]});if(!_0x2f3c3)throw new Error(_0x4a09('0x4c'));if(_0x2f3c3[_0x4a09('0x4d')]==='user'){var _0x6f856e=_0x80b4c8[_0x4a09('0x26')]({'plain':!![]});var _0x5e5197=_0x4a09('0x4e');return db[_0x4a09('0x4f')][_0x4a09('0x47')]({'where':{'name':_0x5e5197,'userProfileId':_0x2f3c3['userProfileId']},'raw':!![]})[_0x4a09('0x24')](function(_0x128797){if(_0x128797&&_0x128797[_0x4a09('0x50')]===0x0){return db['UserProfileResource'][_0x4a09('0x49')]({'name':_0x6f856e['name'],'resourceId':_0x6f856e['id'],'type':_0x128797['name'],'sectionId':_0x128797['id']},{})['then'](function(){return _0x80b4c8;});}else{return _0x80b4c8;}})['catch'](function(_0x471859){logger[_0x4a09('0x29')](_0x4a09('0x51'),_0x471859);throw _0x471859;});}return _0x80b4c8;})[_0x4a09('0x24')](respondWithResult(_0x502334,0xc9))['catch'](handleError(_0x502334,null));};exports[_0x4a09('0x23')]=function(_0x4452ff,_0x281687){if(_0x4452ff[_0x4a09('0x4a')]['id']){delete _0x4452ff['body']['id'];}return db['CmHopperAdditionalPhone'][_0x4a09('0x47')]({'where':{'id':_0x4452ff['params']['id']}})[_0x4a09('0x24')](handleEntityNotFound(_0x281687,null))[_0x4a09('0x24')](saveUpdates(_0x4452ff[_0x4a09('0x4a')],null))[_0x4a09('0x24')](respondWithResult(_0x281687,null))[_0x4a09('0x48')](handleError(_0x281687,null));};exports[_0x4a09('0x25')]=function(_0x13443d,_0x44f295){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x13443d[_0x4a09('0x43')]['id']}})['then'](handleEntityNotFound(_0x44f295,null))[_0x4a09('0x24')](removeEntity(_0x44f295,null))[_0x4a09('0x48')](handleError(_0x44f295,null));}; \ No newline at end of file +var _0x0a31=['end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4ba2d2,_0x9f2ef){var _0x179cc9=function(_0x89e18f){while(--_0x89e18f){_0x4ba2d2['push'](_0x4ba2d2['shift']());}};_0x179cc9(++_0x9f2ef);}(_0x0a31,0x1d9));var _0x10a3=function(_0xe8d77c,_0x37fa17){_0xe8d77c=_0xe8d77c-0x0;var _0x1065e3=_0x0a31[_0xe8d77c];return _0x1065e3;};'use strict';var emlformat=require(_0x10a3('0x0'));var rimraf=require(_0x10a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10a3('0x2'));var rp=require(_0x10a3('0x3'));var moment=require(_0x10a3('0x4'));var BPromise=require(_0x10a3('0x5'));var Mustache=require(_0x10a3('0x6'));var util=require('util');var path=require(_0x10a3('0x7'));var sox=require(_0x10a3('0x8'));var csv=require(_0x10a3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x10a3('0xa'));var crypto=require(_0x10a3('0xb'));var jsforce=require(_0x10a3('0xc'));var deskjs=require(_0x10a3('0xd'));var toCsv=require(_0x10a3('0x9'));var querystring=require(_0x10a3('0xe'));var Papa=require(_0x10a3('0xf'));var Redis=require(_0x10a3('0x10'));var authService=require(_0x10a3('0x11'));var qs=require(_0x10a3('0x12'));var as=require(_0x10a3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x10a3('0x14'))('api');var utils=require(_0x10a3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x10a3('0x16'));var db=require(_0x10a3('0x17'))['db'];function respondWithStatusCode(_0x424786,_0x1aca66){_0x1aca66=_0x1aca66||0xcc;return function(_0x41ba37){if(_0x41ba37){return _0x424786[_0x10a3('0x18')](_0x1aca66);}return _0x424786['status'](_0x1aca66)[_0x10a3('0x19')]();};}function respondWithResult(_0x47843c,_0x50927a){_0x50927a=_0x50927a||0xc8;return function(_0x556d43){if(_0x556d43){return _0x47843c[_0x10a3('0x1a')](_0x50927a)[_0x10a3('0x1b')](_0x556d43);}};}function respondWithFilteredResult(_0x3e6f2a,_0x16bdc9){return function(_0x87b2d5){if(_0x87b2d5){var _0x4c9a59=typeof _0x16bdc9[_0x10a3('0x1c')]==='undefined'&&typeof _0x16bdc9[_0x10a3('0x1d')]===_0x10a3('0x1e');var _0x3db771=_0x87b2d5[_0x10a3('0x1f')];var _0x28d939=_0x4c9a59?0x0:_0x16bdc9['offset'];var _0x1c75e5=_0x4c9a59?_0x87b2d5[_0x10a3('0x1f')]:_0x16bdc9[_0x10a3('0x1c')]+_0x16bdc9[_0x10a3('0x1d')];var _0x12f9c8;if(_0x1c75e5>=_0x3db771){_0x1c75e5=_0x3db771;_0x12f9c8=0xc8;}else{_0x12f9c8=0xce;}_0x3e6f2a[_0x10a3('0x1a')](_0x12f9c8);return _0x3e6f2a[_0x10a3('0x20')](_0x10a3('0x21'),_0x28d939+'-'+_0x1c75e5+'/'+_0x3db771)['json'](_0x87b2d5);}return null;};}function patchUpdates(_0x494786){return function(_0x38d07e){try{jsonpatch['apply'](_0x38d07e,_0x494786,!![]);}catch(_0x470628){return BPromise[_0x10a3('0x22')](_0x470628);}return _0x38d07e[_0x10a3('0x23')]();};}function saveUpdates(_0xbd7d4e,_0x213764){return function(_0xc45ee1){if(_0xc45ee1){return _0xc45ee1[_0x10a3('0x24')](_0xbd7d4e)[_0x10a3('0x25')](function(_0x1646a7){return _0x1646a7;});}return null;};}function removeEntity(_0x165ff9,_0x5ca6b2){return function(_0x57331c){if(_0x57331c){return _0x57331c[_0x10a3('0x26')]()[_0x10a3('0x25')](function(){var _0x441b26=_0x57331c['get']({'plain':!![]});var _0x225432=_0x10a3('0x27');return db[_0x10a3('0x28')][_0x10a3('0x26')]({'where':{'type':_0x225432,'resourceId':_0x441b26['id']}})[_0x10a3('0x25')](function(){return _0x57331c;});})['then'](function(){_0x165ff9['status'](0xcc)[_0x10a3('0x19')]();});}};}function handleEntityNotFound(_0x3f99bd,_0x554884){return function(_0x162231){if(!_0x162231){_0x3f99bd[_0x10a3('0x18')](0x194);}return _0x162231;};}function handleError(_0x43de85,_0x503b2f){_0x503b2f=_0x503b2f||0x1f4;return function(_0x1f7e37){logger[_0x10a3('0x29')](_0x1f7e37[_0x10a3('0x2a')]);if(_0x1f7e37[_0x10a3('0x2b')]){delete _0x1f7e37[_0x10a3('0x2b')];}_0x43de85[_0x10a3('0x1a')](_0x503b2f)[_0x10a3('0x2c')](_0x1f7e37);};}exports[_0x10a3('0x2d')]=function(_0x429278,_0x31e99b){var _0x532e9c={},_0x25ed1f={},_0x4bffea={'count':0x0,'rows':[]};var _0x341108=_['map'](db[_0x10a3('0x2e')][_0x10a3('0x2f')],function(_0x203cce){return{'name':_0x203cce[_0x10a3('0x30')],'type':_0x203cce[_0x10a3('0x31')][_0x10a3('0x32')]};});_0x25ed1f[_0x10a3('0x33')]=_[_0x10a3('0x34')](_0x341108,_0x10a3('0x2b'));_0x25ed1f['query']=_[_0x10a3('0x35')](_0x429278[_0x10a3('0x36')]);_0x25ed1f['filters']=_[_0x10a3('0x37')](_0x25ed1f[_0x10a3('0x33')],_0x25ed1f[_0x10a3('0x36')]);_0x532e9c[_0x10a3('0x38')]=_[_0x10a3('0x37')](_0x25ed1f[_0x10a3('0x33')],qs[_0x10a3('0x39')](_0x429278[_0x10a3('0x36')][_0x10a3('0x39')]));_0x532e9c[_0x10a3('0x38')]=_0x532e9c[_0x10a3('0x38')][_0x10a3('0x3a')]?_0x532e9c[_0x10a3('0x38')]:_0x25ed1f[_0x10a3('0x33')];if(!_0x429278[_0x10a3('0x36')]['hasOwnProperty']('nolimit')){_0x532e9c[_0x10a3('0x1d')]=qs[_0x10a3('0x1d')](_0x429278[_0x10a3('0x36')][_0x10a3('0x1d')]);_0x532e9c[_0x10a3('0x1c')]=qs[_0x10a3('0x1c')](_0x429278[_0x10a3('0x36')]['offset']);}_0x532e9c[_0x10a3('0x3b')]=qs[_0x10a3('0x3c')](_0x429278['query'][_0x10a3('0x3c')]);_0x532e9c[_0x10a3('0x3d')]=qs[_0x10a3('0x3e')](_[_0x10a3('0x3f')](_0x429278[_0x10a3('0x36')],_0x25ed1f[_0x10a3('0x3e')]),_0x341108);if(_0x429278['query'][_0x10a3('0x40')]){_0x532e9c['where']=_['merge'](_0x532e9c[_0x10a3('0x3d')],{'$or':_[_0x10a3('0x34')](_0x341108,function(_0x301b89){if(_0x301b89[_0x10a3('0x31')]!==_0x10a3('0x41')){var _0x203414={};_0x203414[_0x301b89[_0x10a3('0x2b')]]={'$like':'%'+_0x429278[_0x10a3('0x36')][_0x10a3('0x40')]+'%'};return _0x203414;}})});}_0x532e9c=_[_0x10a3('0x42')]({},_0x532e9c,_0x429278[_0x10a3('0x43')]);var _0x2a4eb4={'where':_0x532e9c[_0x10a3('0x3d')]};return db['CmHopperAdditionalPhone'][_0x10a3('0x1f')](_0x2a4eb4)[_0x10a3('0x25')](function(_0x3f3ecf){_0x4bffea[_0x10a3('0x1f')]=_0x3f3ecf;if(_0x429278[_0x10a3('0x36')][_0x10a3('0x44')]){_0x532e9c['include']=[{'all':!![]}];}return db[_0x10a3('0x2e')][_0x10a3('0x45')](_0x532e9c);})['then'](function(_0x344720){_0x4bffea[_0x10a3('0x46')]=_0x344720;return _0x4bffea;})[_0x10a3('0x25')](respondWithFilteredResult(_0x31e99b,_0x532e9c))[_0x10a3('0x47')](handleError(_0x31e99b,null));};exports['show']=function(_0x3e0d59,_0x1b0144){var _0x579736={'raw':!![],'where':{'id':_0x3e0d59['params']['id']}},_0x332388={};_0x332388[_0x10a3('0x33')]=_[_0x10a3('0x35')](db['CmHopperAdditionalPhone'][_0x10a3('0x2f')]);_0x332388[_0x10a3('0x36')]=_[_0x10a3('0x35')](_0x3e0d59[_0x10a3('0x36')]);_0x332388[_0x10a3('0x3e')]=_[_0x10a3('0x37')](_0x332388[_0x10a3('0x33')],_0x332388[_0x10a3('0x36')]);_0x579736[_0x10a3('0x38')]=_[_0x10a3('0x37')](_0x332388[_0x10a3('0x33')],qs['fields'](_0x3e0d59[_0x10a3('0x36')][_0x10a3('0x39')]));_0x579736[_0x10a3('0x38')]=_0x579736[_0x10a3('0x38')]['length']?_0x579736[_0x10a3('0x38')]:_0x332388[_0x10a3('0x33')];if(_0x3e0d59[_0x10a3('0x36')][_0x10a3('0x44')]){_0x579736[_0x10a3('0x48')]=[{'all':!![]}];}_0x579736=_[_0x10a3('0x42')]({},_0x579736,_0x3e0d59[_0x10a3('0x43')]);return db[_0x10a3('0x2e')][_0x10a3('0x49')](_0x579736)[_0x10a3('0x25')](handleEntityNotFound(_0x1b0144,null))[_0x10a3('0x25')](respondWithResult(_0x1b0144,null))[_0x10a3('0x47')](handleError(_0x1b0144,null));};exports[_0x10a3('0x4a')]=function(_0x311f94,_0x2eadaa){return db[_0x10a3('0x2e')]['create'](_0x311f94[_0x10a3('0x4b')],{})[_0x10a3('0x25')](function(_0x3230cc){var _0x5979e3=_0x311f94[_0x10a3('0x4c')][_0x10a3('0x4d')]({'plain':!![]});if(!_0x5979e3)throw new Error(_0x10a3('0x4e'));if(_0x5979e3[_0x10a3('0x4f')]===_0x10a3('0x4c')){var _0x335bbb=_0x3230cc['get']({'plain':!![]});var _0x251945=_0x10a3('0x27');return db[_0x10a3('0x50')]['find']({'where':{'name':_0x251945,'userProfileId':_0x5979e3[_0x10a3('0x51')]},'raw':!![]})[_0x10a3('0x25')](function(_0x130147){if(_0x130147&&_0x130147[_0x10a3('0x52')]===0x0){return db[_0x10a3('0x28')][_0x10a3('0x4a')]({'name':_0x335bbb[_0x10a3('0x2b')],'resourceId':_0x335bbb['id'],'type':_0x130147['name'],'sectionId':_0x130147['id']},{})['then'](function(){return _0x3230cc;});}else{return _0x3230cc;}})[_0x10a3('0x47')](function(_0x2c8140){logger[_0x10a3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c8140);throw _0x2c8140;});}return _0x3230cc;})['then'](respondWithResult(_0x2eadaa,0xc9))[_0x10a3('0x47')](handleError(_0x2eadaa,null));};exports[_0x10a3('0x24')]=function(_0x257112,_0xd6cc76){if(_0x257112[_0x10a3('0x4b')]['id']){delete _0x257112[_0x10a3('0x4b')]['id'];}return db[_0x10a3('0x2e')][_0x10a3('0x49')]({'where':{'id':_0x257112['params']['id']}})['then'](handleEntityNotFound(_0xd6cc76,null))[_0x10a3('0x25')](saveUpdates(_0x257112[_0x10a3('0x4b')],null))[_0x10a3('0x25')](respondWithResult(_0xd6cc76,null))[_0x10a3('0x47')](handleError(_0xd6cc76,null));};exports[_0x10a3('0x26')]=function(_0x439018,_0x5dd6e0){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x439018['params']['id']}})[_0x10a3('0x25')](handleEntityNotFound(_0x5dd6e0,null))[_0x10a3('0x25')](removeEntity(_0x5dd6e0,null))[_0x10a3('0x47')](handleError(_0x5dd6e0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 0a4ca4a..f4aad02 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 _0x4aae=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash'];(function(_0x2dd615,_0x18099c){var _0x5255a4=function(_0x3f4c54){while(--_0x3f4c54){_0x2dd615['push'](_0x2dd615['shift']());}};_0x5255a4(++_0x18099c);}(_0x4aae,0x18b));var _0xe4aa=function(_0x4543d8,_0x212a77){_0x4543d8=_0x4543d8-0x0;var _0x5ca5a8=_0x4aae[_0x4543d8];return _0x5ca5a8;};'use strict';var _=require(_0xe4aa('0x0'));var util=require(_0xe4aa('0x1'));var logger=require(_0xe4aa('0x2'))('api');var moment=require(_0xe4aa('0x3'));var BPromise=require(_0xe4aa('0x4'));var rp=require(_0xe4aa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4aa('0x6'));var config=require(_0xe4aa('0x7'));var attributes=require(_0xe4aa('0x8'));module['exports']=function(_0x1f93d5,_0x157c9f){return _0x1f93d5['define'](_0xe4aa('0x9'),attributes,{'tableName':_0xe4aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec38=['CmHopperAdditionalPhone','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x12f55d,_0x4b986b){var _0x4167b8=function(_0x2d8b9f){while(--_0x2d8b9f){_0x12f55d['push'](_0x12f55d['shift']());}};_0x4167b8(++_0x4b986b);}(_0xec38,0xb1));var _0x8ec3=function(_0x294e64,_0x22460a){_0x294e64=_0x294e64-0x0;var _0x42b05b=_0xec38[_0x294e64];return _0x42b05b;};'use strict';var _=require(_0x8ec3('0x0'));var util=require(_0x8ec3('0x1'));var logger=require(_0x8ec3('0x2'))(_0x8ec3('0x3'));var moment=require('moment');var BPromise=require(_0x8ec3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ec3('0x5'));var rimraf=require(_0x8ec3('0x6'));var config=require(_0x8ec3('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x8ec3('0x8')]=function(_0x41ddef,_0x55e8f3){return _0x41ddef[_0x8ec3('0x9')](_0x8ec3('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','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 8eae52d..2371bad 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 _0x965e=['countagentrejectretry','entity','dialGlobalMaxRetry','ASC','waitTime','isNil','scheduledat','minutes','add','phone','countnosuchnumberretry','createdAt','transaction','activateAdditionalPhone','update','field','IncrementPreviewCounters','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x2ebc4a,_0x390266){var _0x2ad424=function(_0x541df7){while(--_0x541df7){_0x2ebc4a['push'](_0x2ebc4a['shift']());}};_0x2ad424(++_0x390266);}(_0x965e,0x199));var _0xe965=function(_0x233e09,_0x3c965b){_0x233e09=_0x233e09-0x0;var _0x33baba=_0x965e[_0x233e09];return _0x33baba;};'use strict';var _=require(_0xe965('0x0'));var util=require('util');var moment=require(_0xe965('0x1'));var BPromise=require(_0xe965('0x2'));var rs=require(_0xe965('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe965('0x4'))['db'];var utils=require(_0xe965('0x5'));var logger=require(_0xe965('0x6'))(_0xe965('0x7'));var config=require(_0xe965('0x8'));var jayson=require(_0xe965('0x9'));var client=jayson['client'][_0xe965('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x468d5b,_0x49d723,_0x375e7e){return new BPromise(function(_0x20a841,_0x5b9836){return client['request'](_0x468d5b,_0x375e7e)[_0xe965('0xb')](function(_0x28332c){logger[_0xe965('0xc')](_0xe965('0xd'),_0x49d723,_0xe965('0xe'));logger[_0xe965('0xf')](_0xe965('0x10'),_0x49d723,_0xe965('0xe'),JSON[_0xe965('0x11')](_0x28332c));if(_0x28332c[_0xe965('0x12')]){if(_0x28332c[_0xe965('0x12')][_0xe965('0x13')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x49d723,_0x28332c[_0xe965('0x12')][_0xe965('0x14')]);return _0x5b9836(_0x28332c['error'][_0xe965('0x14')]);}logger[_0xe965('0x12')](_0xe965('0xd'),_0x49d723,_0x28332c[_0xe965('0x12')][_0xe965('0x14')]);return _0x20a841(_0x28332c[_0xe965('0x12')][_0xe965('0x14')]);}else{logger[_0xe965('0xc')](_0xe965('0xd'),_0x49d723,_0xe965('0xe'));_0x20a841(_0x28332c[_0xe965('0x15')][_0xe965('0x14')]);}})[_0xe965('0x16')](function(_0x49ae32){logger[_0xe965('0x12')](_0xe965('0xd'),_0x49d723,_0x49ae32);_0x5b9836(_0x49ae32);});});}exports[_0xe965('0x17')]=function(_0x28e4a3){var _0x42992c=this;return new Promise(function(_0x4a8fad,_0x3ebd3c){return db[_0xe965('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x28e4a3[_0xe965('0x19')][_0xe965('0x1a')],'ListId':_0x28e4a3['body'][_0xe965('0x1b')],'VoiceQueueId':_0x28e4a3[_0xe965('0x19')]['VoiceQueueId']===undefined?null:_0x28e4a3[_0xe965('0x19')][_0xe965('0x1c')],'CampaignId':_0x28e4a3[_0xe965('0x19')][_0xe965('0x1d')]===undefined?null:_0x28e4a3['body'][_0xe965('0x1d')]}})['then'](function(_0x4fa489){if(_0x4fa489!=null){return db[_0xe965('0x1e')][_0xe965('0x1f')]({'raw':!![],'where':{'CmHopperId':_0x4fa489['id'],'OrderBy':{'$gt':_0x4fa489[_0xe965('0x20')]}},'order':[[_0xe965('0x20'),'ASC']]})[_0xe965('0xb')](function(_0x5bf7b8){var _0x207222=0x0;if(_0x5bf7b8){if(_0x5bf7b8[_0xe965('0x21')]+_0x5bf7b8[_0xe965('0x22')]+_0x5bf7b8[_0xe965('0x23')]+_0x5bf7b8['countnosuchnumberretry']+_0x5bf7b8[_0xe965('0x24')]+_0x5bf7b8[_0xe965('0x25')]+_0x5bf7b8[_0xe965('0x26')]+_0x5bf7b8[_0xe965('0x27')]<_0x28e4a3[_0xe965('0x28')]['dialGlobalMaxRetry'])_0x207222=0x1;_0x4a8fad({'additional':_0x207222});}else{return db[_0xe965('0x1e')][_0xe965('0x1f')]({'raw':!![],'where':{'CmHopperId':_0x4fa489['id']},'order':[[_0xe965('0x20'),'ASC']]})[_0xe965('0xb')](function(_0x271e62){var _0x3d32e0=0x0;if(_0x271e62){if(_0x271e62[_0xe965('0x21')]+_0x271e62['countcongestionretry']+_0x271e62[_0xe965('0x23')]+_0x271e62['countnosuchnumberretry']+_0x271e62[_0xe965('0x24')]+_0x271e62[_0xe965('0x25')]+_0x271e62[_0xe965('0x26')]+_0x271e62[_0xe965('0x27')]<_0x28e4a3['entity'][_0xe965('0x29')])_0x3d32e0=0x1;_0x4a8fad({'additional':_0x3d32e0});}else{_0x4a8fad({'additional':0x0});}})[_0xe965('0x16')](function(_0x4ab59c){logger[_0xe965('0x12')](_0xe965('0x17'),_0x4ab59c['message']);_0x3ebd3c(_0x42992c[_0xe965('0x12')](0x1f4,_0x4ab59c[_0xe965('0x14')]));});}})['catch'](function(_0xfc793c){logger[_0xe965('0x12')](_0xe965('0x17'),_0xfc793c[_0xe965('0x14')]);_0x3ebd3c(_0x42992c[_0xe965('0x12')](0x1f4,_0xfc793c[_0xe965('0x14')]));});}else _0x4a8fad({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x4cd26b){var _0x12cec5=this;return new Promise(function(_0x2da84f,_0x19fc54){return db[_0xe965('0x18')][_0xe965('0x1f')]({'raw':!![],'where':{'ContactId':_0x4cd26b[_0xe965('0x19')]['ContactId'],'ListId':_0x4cd26b['body'][_0xe965('0x1b')],'VoiceQueueId':_0x4cd26b[_0xe965('0x19')][_0xe965('0x1c')]===undefined?null:_0x4cd26b[_0xe965('0x19')][_0xe965('0x1c')],'CampaignId':_0x4cd26b[_0xe965('0x19')][_0xe965('0x1d')]===undefined?null:_0x4cd26b[_0xe965('0x19')][_0xe965('0x1d')]}})[_0xe965('0xb')](function(_0x43477b){if(_0x43477b!=null){return db[_0xe965('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x43477b['id'],'OrderBy':{'$gte':_0x43477b[_0xe965('0x20')]}},'order':[[_0xe965('0x20'),_0xe965('0x2a')]]})['then'](function(_0x5a5762){if(_0x5a5762)return activateAdditionalPhone(_0x43477b,_0x4cd26b['body'],_0x5a5762,_0x4cd26b['duration'],_0x4cd26b[_0xe965('0x2b')])[_0xe965('0xb')](function(_0x455d4c){_0x2da84f(_0x455d4c);});else{return db[_0xe965('0x1e')][_0xe965('0x1f')]({'raw':!![],'where':{'CmHopperId':_0x43477b['id']},'order':[[_0xe965('0x20'),_0xe965('0x2a')]]})['then'](function(_0xbb7438){if(_0xbb7438)return activateAdditionalPhone(_0x43477b,_0x4cd26b[_0xe965('0x19')],_0xbb7438,_0x4cd26b['duration'],_0x4cd26b[_0xe965('0x2b')])[_0xe965('0xb')](function(_0x5d2521){_0x2da84f(_0x5d2521);});else{_0x2da84f({'id':_0x43477b['id'],'phone':''});}})[_0xe965('0x16')](function(_0x139e8b){logger['error']('VerifyAdditionalPhones',_0x139e8b[_0xe965('0x14')]);_0x19fc54(_0x12cec5[_0xe965('0x12')](0x1f4,_0x139e8b[_0xe965('0x14')]));});}})[_0xe965('0x16')](function(_0x2c1cd4){logger[_0xe965('0x12')]('VerifyAdditionalPhones',_0x2c1cd4[_0xe965('0x14')]);_0x19fc54(_0x12cec5[_0xe965('0x12')](0x1f4,_0x2c1cd4[_0xe965('0x14')]));});}else _0x2da84f(0x1);});});};function activateAdditionalPhone(_0x1ee00a,_0x521a32,_0x1ed8a6,_0x37c616,_0x48c8c7){return new Promise(function(_0x8630e,_0x3a6323){var _0x137889;if(_[_0xe965('0x2c')](_0x1ed8a6[_0xe965('0x2d')])){_0x1ed8a6[_0xe965('0x2d')]=moment();}if(moment()>moment(_0x1ed8a6[_0xe965('0x2d')])){_0x137889=moment()['add'](_0x48c8c7||0x3,_0xe965('0x2e'));}else{if(_0x1ed8a6['OrderBy']==0x0){_0x137889=moment(_0x1ed8a6[_0xe965('0x2d')]);}else{_0x137889=moment()[_0xe965('0x2f')](_0x48c8c7||0x3,'minutes');}}if(_[_0xe965('0x2c')](_0x137889)){_0x137889=moment()[_0xe965('0x2f')](_0x48c8c7||0x3,_0xe965('0x2e'));}var _0x1932ee={'phone':_0x1ee00a[_0xe965('0x30')],'active':0x0,'OrderBy':_['isNil'](_0x1ee00a[_0xe965('0x20')])?0x0:_0x1ee00a[_0xe965('0x20')],'scheduledat':moment()['add'](_0x37c616||0x1,'minutes'),'countbusyretry':_0x521a32['countbusyretry'],'countcongestionretry':_0x521a32['countcongestionretry'],'countnoanswerretry':_0x521a32[_0xe965('0x23')],'countnosuchnumberretry':_0x521a32[_0xe965('0x31')],'countdropretry':_0x521a32[_0xe965('0x24')],'countabandonedretry':_0x521a32['countabandonedretry'],'countmachineretry':_0x521a32['countmachineretry'],'countagentrejectretry':_0x521a32[_0xe965('0x27')],'createdAt':_0x521a32[_0xe965('0x32')],'updatedAt':_0x521a32['updatedAt']};var _0x17600e={'CmHopperId':_0x1ee00a['id'],'phone':_0x1ed8a6[_0xe965('0x30')],'active':0x0,'OrderBy':_[_0xe965('0x2c')](_0x1ed8a6[_0xe965('0x20')])?0x0:_0x1ed8a6['OrderBy'],'scheduledat':_0x137889,'countbusyretry':_0x1ed8a6[_0xe965('0x21')],'countcongestionretry':_0x1ed8a6['countcongestionretry'],'countnoanswerretry':_0x1ed8a6[_0xe965('0x23')],'countnosuchnumberretry':_0x1ed8a6[_0xe965('0x31')],'countdropretry':_0x1ed8a6['countdropretry'],'countabandonedretry':_0x1ed8a6[_0xe965('0x25')],'countmachineretry':_0x1ed8a6['countmachineretry'],'countagentrejectretry':_0x1ed8a6[_0xe965('0x27')],'createdAt':_0x1ed8a6['createdAt'],'updatedAt':_0x1ed8a6['updatedAt']};return db['sequelize'][_0xe965('0x33')](function(_0x5e8aff){return db[_0xe965('0x1e')]['update'](_0x1932ee,{'where':{'id':_0x1ed8a6['id']}},{'transaction':_0x5e8aff})['then'](function(){return db[_0xe965('0x18')]['update'](_0x17600e,{'where':{'id':_0x1ee00a['id']}},{'transaction':_0x5e8aff});});})[_0xe965('0xb')](function(_0x37cc4c){_0x8630e({'id':_0x1ee00a['id'],'phone':_0x1ed8a6[_0xe965('0x30')]});})['catch'](function(_0x105ae2){logger[_0xe965('0x12')](_0xe965('0x34'),_0x105ae2[_0xe965('0x14')]);_0x3a6323({'error':_0x105ae2[_0xe965('0x14')]});});});}exports['IncrementPreviewCounters']=function(_0x20b70c){var _0x51e99f=this;return new Promise(function(_0x265368,_0x5c7938){return db[_0xe965('0x18')][_0xe965('0x35')](_0x20b70c[_0xe965('0x19')][_0xe965('0x36')],{'where':{'id':_0x20b70c[_0xe965('0x19')]['id']}})['then'](function(_0x23e002){_0x265368(_0x23e002);})[_0xe965('0x16')](function(_0x5d5e7b){logger[_0xe965('0x12')](_0xe965('0x37'),_0x5d5e7b[_0xe965('0x14')]);_0x5c7938(_0x51e99f[_0xe965('0x12')](0x1f4,_0x5d5e7b[_0xe965('0x14')]));});});}; \ No newline at end of file +var _0xcad8=['debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CmHopper','findOne','body','ContactId','ListId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countbusyretry','entity','VerifyAdditionalPhones','SwapAdditionalPhones','VoiceQueueId','duration','waitTime','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','transaction','update','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent'];(function(_0x482ec5,_0x22869b){var _0x90d223=function(_0x5a462a){while(--_0x5a462a){_0x482ec5['push'](_0x482ec5['shift']());}};_0x90d223(++_0x22869b);}(_0xcad8,0x10e));var _0x8cad=function(_0x447260,_0x5d2baa){_0x447260=_0x447260-0x0;var _0xfd1cc4=_0xcad8[_0x447260];return _0xfd1cc4;};'use strict';var _=require(_0x8cad('0x0'));var util=require(_0x8cad('0x1'));var moment=require(_0x8cad('0x2'));var BPromise=require(_0x8cad('0x3'));var rs=require(_0x8cad('0x4'));var fs=require('fs');var Redis=require(_0x8cad('0x5'));var db=require(_0x8cad('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8cad('0x7'))(_0x8cad('0x8'));var config=require('../../config/environment');var jayson=require(_0x8cad('0x9'));var client=jayson[_0x8cad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9cedc8,_0x4e3a6c,_0x1a6920){return new BPromise(function(_0x463d3e,_0x15cff5){return client[_0x8cad('0xb')](_0x9cedc8,_0x1a6920)[_0x8cad('0xc')](function(_0x1d530a){logger['info'](_0x8cad('0xd'),_0x4e3a6c,_0x8cad('0xe'));logger[_0x8cad('0xf')](_0x8cad('0x10'),_0x4e3a6c,'request\x20sent',JSON[_0x8cad('0x11')](_0x1d530a));if(_0x1d530a[_0x8cad('0x12')]){if(_0x1d530a[_0x8cad('0x12')]['code']===0x1f4){logger['error'](_0x8cad('0xd'),_0x4e3a6c,_0x1d530a[_0x8cad('0x12')]['message']);return _0x15cff5(_0x1d530a['error']['message']);}logger[_0x8cad('0x12')](_0x8cad('0xd'),_0x4e3a6c,_0x1d530a['error'][_0x8cad('0x13')]);return _0x463d3e(_0x1d530a[_0x8cad('0x12')][_0x8cad('0x13')]);}else{logger[_0x8cad('0x14')](_0x8cad('0xd'),_0x4e3a6c,_0x8cad('0xe'));_0x463d3e(_0x1d530a['result'][_0x8cad('0x13')]);}})[_0x8cad('0x15')](function(_0x452ee7){logger[_0x8cad('0x12')](_0x8cad('0xd'),_0x4e3a6c,_0x452ee7);_0x15cff5(_0x452ee7);});});}exports['VerifyAdditionalPhones']=function(_0x1c0b53){var _0x259fa6=this;return new Promise(function(_0x3f1fdd,_0x568cdc){return db[_0x8cad('0x16')][_0x8cad('0x17')]({'raw':!![],'where':{'ContactId':_0x1c0b53[_0x8cad('0x18')][_0x8cad('0x19')],'ListId':_0x1c0b53['body'][_0x8cad('0x1a')],'VoiceQueueId':_0x1c0b53[_0x8cad('0x18')]['VoiceQueueId']===undefined?null:_0x1c0b53[_0x8cad('0x18')]['VoiceQueueId'],'CampaignId':_0x1c0b53[_0x8cad('0x18')]['CampaignId']===undefined?null:_0x1c0b53[_0x8cad('0x18')][_0x8cad('0x1b')]}})[_0x8cad('0xc')](function(_0x3b551c){if(_0x3b551c!=null){return db[_0x8cad('0x1c')][_0x8cad('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3b551c['id'],'OrderBy':{'$gt':_0x3b551c[_0x8cad('0x1d')]}},'order':[[_0x8cad('0x1d'),_0x8cad('0x1e')]]})[_0x8cad('0xc')](function(_0x53482f){var _0x16b2e0=0x0;if(_0x53482f){if(_0x53482f['countbusyretry']+_0x53482f[_0x8cad('0x1f')]+_0x53482f[_0x8cad('0x20')]+_0x53482f[_0x8cad('0x21')]+_0x53482f[_0x8cad('0x22')]+_0x53482f[_0x8cad('0x23')]+_0x53482f[_0x8cad('0x24')]+_0x53482f[_0x8cad('0x25')]<_0x1c0b53['entity'][_0x8cad('0x26')])_0x16b2e0=0x1;_0x3f1fdd({'additional':_0x16b2e0});}else{return db[_0x8cad('0x1c')][_0x8cad('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3b551c['id']},'order':[[_0x8cad('0x1d'),_0x8cad('0x1e')]]})['then'](function(_0x227a1b){var _0x45aedc=0x0;if(_0x227a1b){if(_0x227a1b[_0x8cad('0x27')]+_0x227a1b[_0x8cad('0x1f')]+_0x227a1b['countnoanswerretry']+_0x227a1b[_0x8cad('0x21')]+_0x227a1b[_0x8cad('0x22')]+_0x227a1b[_0x8cad('0x23')]+_0x227a1b[_0x8cad('0x24')]+_0x227a1b['countagentrejectretry']<_0x1c0b53[_0x8cad('0x28')]['dialGlobalMaxRetry'])_0x45aedc=0x1;_0x3f1fdd({'additional':_0x45aedc});}else{_0x3f1fdd({'additional':0x0});}})[_0x8cad('0x15')](function(_0xca5c1d){logger[_0x8cad('0x12')](_0x8cad('0x29'),_0xca5c1d[_0x8cad('0x13')]);_0x568cdc(_0x259fa6[_0x8cad('0x12')](0x1f4,_0xca5c1d[_0x8cad('0x13')]));});}})[_0x8cad('0x15')](function(_0x390524){logger[_0x8cad('0x12')](_0x8cad('0x29'),_0x390524[_0x8cad('0x13')]);_0x568cdc(_0x259fa6[_0x8cad('0x12')](0x1f4,_0x390524[_0x8cad('0x13')]));});}else _0x3f1fdd({'additional':0x0});});});};exports[_0x8cad('0x2a')]=function(_0xa128d8){var _0x5f1f30=this;return new Promise(function(_0x57e34f,_0xd6cbcd){return db[_0x8cad('0x16')][_0x8cad('0x17')]({'raw':!![],'where':{'ContactId':_0xa128d8[_0x8cad('0x18')][_0x8cad('0x19')],'ListId':_0xa128d8[_0x8cad('0x18')][_0x8cad('0x1a')],'VoiceQueueId':_0xa128d8[_0x8cad('0x18')][_0x8cad('0x2b')]===undefined?null:_0xa128d8['body'][_0x8cad('0x2b')],'CampaignId':_0xa128d8['body']['CampaignId']===undefined?null:_0xa128d8['body'][_0x8cad('0x1b')]}})[_0x8cad('0xc')](function(_0x30d402){if(_0x30d402!=null){return db[_0x8cad('0x1c')][_0x8cad('0x17')]({'raw':!![],'where':{'CmHopperId':_0x30d402['id'],'OrderBy':{'$gte':_0x30d402[_0x8cad('0x1d')]}},'order':[[_0x8cad('0x1d'),'ASC']]})[_0x8cad('0xc')](function(_0xe7dc04){if(_0xe7dc04)return activateAdditionalPhone(_0x30d402,_0xa128d8[_0x8cad('0x18')],_0xe7dc04,_0xa128d8[_0x8cad('0x2c')],_0xa128d8[_0x8cad('0x2d')])['then'](function(_0x48d663){_0x57e34f(_0x48d663);});else{return db[_0x8cad('0x1c')][_0x8cad('0x17')]({'raw':!![],'where':{'CmHopperId':_0x30d402['id']},'order':[[_0x8cad('0x1d'),_0x8cad('0x1e')]]})[_0x8cad('0xc')](function(_0x3d236e){if(_0x3d236e)return activateAdditionalPhone(_0x30d402,_0xa128d8[_0x8cad('0x18')],_0x3d236e,_0xa128d8[_0x8cad('0x2c')],_0xa128d8[_0x8cad('0x2d')])[_0x8cad('0xc')](function(_0x137d28){_0x57e34f(_0x137d28);});else{_0x57e34f({'id':_0x30d402['id'],'phone':''});}})['catch'](function(_0x333ad2){logger['error'](_0x8cad('0x29'),_0x333ad2['message']);_0xd6cbcd(_0x5f1f30[_0x8cad('0x12')](0x1f4,_0x333ad2[_0x8cad('0x13')]));});}})['catch'](function(_0x3dd108){logger[_0x8cad('0x12')](_0x8cad('0x29'),_0x3dd108[_0x8cad('0x13')]);_0xd6cbcd(_0x5f1f30['error'](0x1f4,_0x3dd108[_0x8cad('0x13')]));});}else _0x57e34f(0x1);});});};function activateAdditionalPhone(_0x428229,_0x32b4e1,_0x376137,_0x3c308a,_0x2d179a){return new Promise(function(_0x35c435,_0xeda574){var _0x470b65;if(_[_0x8cad('0x2e')](_0x376137[_0x8cad('0x2f')])){_0x376137[_0x8cad('0x2f')]=moment();}if(moment()>moment(_0x376137[_0x8cad('0x2f')])){_0x470b65=moment()['add'](_0x2d179a||0x3,_0x8cad('0x30'));}else{if(_0x376137[_0x8cad('0x1d')]==0x0){_0x470b65=moment(_0x376137[_0x8cad('0x2f')]);}else{_0x470b65=moment()[_0x8cad('0x31')](_0x2d179a||0x3,_0x8cad('0x30'));}}if(_['isNil'](_0x470b65)){_0x470b65=moment()[_0x8cad('0x31')](_0x2d179a||0x3,_0x8cad('0x30'));}var _0x50a928={'phone':_0x428229[_0x8cad('0x32')],'active':0x0,'OrderBy':_[_0x8cad('0x2e')](_0x428229[_0x8cad('0x1d')])?0x0:_0x428229[_0x8cad('0x1d')],'scheduledat':moment()['add'](_0x3c308a||0x1,'minutes'),'countbusyretry':_0x32b4e1['countbusyretry'],'countcongestionretry':_0x32b4e1[_0x8cad('0x1f')],'countnoanswerretry':_0x32b4e1[_0x8cad('0x20')],'countnosuchnumberretry':_0x32b4e1[_0x8cad('0x21')],'countdropretry':_0x32b4e1[_0x8cad('0x22')],'countabandonedretry':_0x32b4e1['countabandonedretry'],'countmachineretry':_0x32b4e1[_0x8cad('0x24')],'countagentrejectretry':_0x32b4e1[_0x8cad('0x25')],'createdAt':_0x32b4e1[_0x8cad('0x33')],'updatedAt':_0x32b4e1[_0x8cad('0x34')]};var _0x4b86f6={'CmHopperId':_0x428229['id'],'phone':_0x376137[_0x8cad('0x32')],'active':0x0,'OrderBy':_[_0x8cad('0x2e')](_0x376137['OrderBy'])?0x0:_0x376137['OrderBy'],'scheduledat':_0x470b65,'countbusyretry':_0x376137[_0x8cad('0x27')],'countcongestionretry':_0x376137[_0x8cad('0x1f')],'countnoanswerretry':_0x376137['countnoanswerretry'],'countnosuchnumberretry':_0x376137[_0x8cad('0x21')],'countdropretry':_0x376137['countdropretry'],'countabandonedretry':_0x376137['countabandonedretry'],'countmachineretry':_0x376137[_0x8cad('0x24')],'countagentrejectretry':_0x376137[_0x8cad('0x25')],'createdAt':_0x376137[_0x8cad('0x33')],'updatedAt':_0x376137[_0x8cad('0x34')]};return db['sequelize'][_0x8cad('0x35')](function(_0x1c5db0){return db[_0x8cad('0x1c')]['update'](_0x50a928,{'where':{'id':_0x376137['id']}},{'transaction':_0x1c5db0})[_0x8cad('0xc')](function(){return db[_0x8cad('0x16')][_0x8cad('0x36')](_0x4b86f6,{'where':{'id':_0x428229['id']}},{'transaction':_0x1c5db0});});})[_0x8cad('0xc')](function(_0x187461){_0x35c435({'id':_0x428229['id'],'phone':_0x376137[_0x8cad('0x32')]});})[_0x8cad('0x15')](function(_0x2262ef){logger[_0x8cad('0x12')]('activateAdditionalPhone',_0x2262ef[_0x8cad('0x13')]);_0xeda574({'error':_0x2262ef[_0x8cad('0x13')]});});});}exports['IncrementPreviewCounters']=function(_0x5e14f4){var _0x236cc6=this;return new Promise(function(_0x4e1cf8,_0x838fcb){return db[_0x8cad('0x16')][_0x8cad('0x36')](_0x5e14f4[_0x8cad('0x18')][_0x8cad('0x37')],{'where':{'id':_0x5e14f4[_0x8cad('0x18')]['id']}})[_0x8cad('0xc')](function(_0x1b86c0){_0x4e1cf8(_0x1b86c0);})[_0x8cad('0x15')](function(_0x4b4482){logger[_0x8cad('0x12')](_0x8cad('0x38'),_0x4b4482[_0x8cad('0x13')]);_0x838fcb(_0x236cc6[_0x8cad('0x12')](0x1f4,_0x4b4482[_0x8cad('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index b39f1bb..d93911d 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 _0xe152=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','create','update'];(function(_0x5503e2,_0x426323){var _0x27b7e5=function(_0x593a03){while(--_0x593a03){_0x5503e2['push'](_0x5503e2['shift']());}};_0x27b7e5(++_0x426323);}(_0xe152,0x158));var _0x2e15=function(_0x36db17,_0x2d0a60){_0x36db17=_0x36db17-0x0;var _0x5ddf47=_0xe152[_0x36db17];return _0x5ddf47;};'use strict';var multer=require(_0x2e15('0x0'));var util=require('util');var path=require(_0x2e15('0x1'));var timeout=require(_0x2e15('0x2'));var express=require(_0x2e15('0x3'));var router=express[_0x2e15('0x4')]();var fs_extra=require(_0x2e15('0x5'));var auth=require(_0x2e15('0x6'));var interaction=require(_0x2e15('0x7'));var config=require(_0x2e15('0x8'));var controller=require(_0x2e15('0x9'));router[_0x2e15('0xa')]('/',auth[_0x2e15('0xb')](),controller[_0x2e15('0xc')]);router[_0x2e15('0xa')](_0x2e15('0xd'),auth[_0x2e15('0xb')](),controller['show']);router[_0x2e15('0xe')]('/',auth[_0x2e15('0xb')](),controller[_0x2e15('0xf')]);router['put']('/:id',auth[_0x2e15('0xb')](),controller[_0x2e15('0x10')]);router[_0x2e15('0x11')](_0x2e15('0xd'),auth[_0x2e15('0xb')](),controller[_0x2e15('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7588=['index','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated'];(function(_0x4b0b92,_0x574e70){var _0x4c58ba=function(_0x173b17){while(--_0x173b17){_0x4b0b92['push'](_0x4b0b92['shift']());}};_0x4c58ba(++_0x574e70);}(_0x7588,0x158));var _0x8758=function(_0x3a615f,_0x60586e){_0x3a615f=_0x3a615f-0x0;var _0x308b3c=_0x7588[_0x3a615f];return _0x308b3c;};'use strict';var multer=require(_0x8758('0x0'));var util=require(_0x8758('0x1'));var path=require(_0x8758('0x2'));var timeout=require(_0x8758('0x3'));var express=require(_0x8758('0x4'));var router=express[_0x8758('0x5')]();var fs_extra=require(_0x8758('0x6'));var auth=require(_0x8758('0x7'));var interaction=require(_0x8758('0x8'));var config=require(_0x8758('0x9'));var controller=require(_0x8758('0xa'));router[_0x8758('0xb')]('/',auth[_0x8758('0xc')](),controller[_0x8758('0xd')]);router[_0x8758('0xb')](_0x8758('0xe'),auth[_0x8758('0xc')](),controller[_0x8758('0xf')]);router[_0x8758('0x10')]('/',auth[_0x8758('0xc')](),controller['create']);router[_0x8758('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8758('0x12')]);router[_0x8758('0x13')](_0x8758('0xe'),auth[_0x8758('0xc')](),controller[_0x8758('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d3b5f67..a7e1634 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 _0xf385=['STRING','INTEGER','contactListQueue','moment'];(function(_0x55f742,_0x25a1f4){var _0x6f3e56=function(_0x4867fa){while(--_0x4867fa){_0x55f742['push'](_0x55f742['shift']());}};_0x6f3e56(++_0x25a1f4);}(_0xf385,0xab));var _0x5f38=function(_0x57ee1d,_0x54111b){_0x57ee1d=_0x57ee1d-0x0;var _0x12a933=_0xf385[_0x57ee1d];return _0x12a933;};'use strict';var moment=require(_0x5f38('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x5f38('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5f38('0x2')],'unique':_0x5f38('0x3')},'ListId':{'type':Sequelize[_0x5f38('0x2')],'unique':_0x5f38('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x4b66=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4b66,0x1dc));var _0x64b6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4b66[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0x64b6('0x0'));var Sequelize=require(_0x64b6('0x1'));module[_0x64b6('0x2')]={'phone':{'type':Sequelize[_0x64b6('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x64b6('0x4')],'unique':_0x64b6('0x5')},'ListId':{'type':Sequelize[_0x64b6('0x4')],'unique':_0x64b6('0x5')},'VoiceQueueId':{'type':Sequelize[_0x64b6('0x4')],'unique':_0x64b6('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index ec1cc50..3906bb5 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 _0xdbed=['zip-dir','fast-json-patch','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','CmHopperBlack','includeAll','include','findAll','rows','catch','params','find','body','destroy','eml-format','rimraf'];(function(_0x51fbd7,_0x1ed2eb){var _0x8dd910=function(_0x3bf290){while(--_0x3bf290){_0x51fbd7['push'](_0x51fbd7['shift']());}};_0x8dd910(++_0x1ed2eb);}(_0xdbed,0xca));var _0xddbe=function(_0x485485,_0x3dc9b6){_0x485485=_0x485485-0x0;var _0x4f15ed=_0xdbed[_0x485485];return _0x4f15ed;};'use strict';var emlformat=require(_0xddbe('0x0'));var rimraf=require(_0xddbe('0x1'));var zipdir=require(_0xddbe('0x2'));var jsonpatch=require(_0xddbe('0x3'));var rp=require('request-promise');var moment=require(_0xddbe('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xddbe('0x5'));var ejs=require(_0xddbe('0x6'));var fs=require('fs');var fs_extra=require(_0xddbe('0x7'));var _=require(_0xddbe('0x8'));var squel=require(_0xddbe('0x9'));var crypto=require(_0xddbe('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xddbe('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xddbe('0xc'));var Redis=require(_0xddbe('0xd'));var authService=require(_0xddbe('0xe'));var qs=require(_0xddbe('0xf'));var as=require(_0xddbe('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xddbe('0x11'));var config=require(_0xddbe('0x12'));var licenseUtil=require(_0xddbe('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13b4ef,_0x422964){_0x422964=_0x422964||0xcc;return function(_0x8ab39b){if(_0x8ab39b){return _0x13b4ef[_0xddbe('0x14')](_0x422964);}return _0x13b4ef[_0xddbe('0x15')](_0x422964)[_0xddbe('0x16')]();};}function respondWithResult(_0x17314c,_0x1b77c3){_0x1b77c3=_0x1b77c3||0xc8;return function(_0x2eaa66){if(_0x2eaa66){return _0x17314c[_0xddbe('0x15')](_0x1b77c3)[_0xddbe('0x17')](_0x2eaa66);}};}function respondWithFilteredResult(_0x507b72,_0x38ba04){return function(_0x1abeea){if(_0x1abeea){var _0xb2d0ee=typeof _0x38ba04[_0xddbe('0x18')]===_0xddbe('0x19')&&typeof _0x38ba04[_0xddbe('0x1a')]==='undefined';var _0x557a1b=_0x1abeea[_0xddbe('0x1b')];var _0x449bc1=_0xb2d0ee?0x0:_0x38ba04[_0xddbe('0x18')];var _0x4a2f37=_0xb2d0ee?_0x1abeea[_0xddbe('0x1b')]:_0x38ba04['offset']+_0x38ba04[_0xddbe('0x1a')];var _0x449c29;if(_0x4a2f37>=_0x557a1b){_0x4a2f37=_0x557a1b;_0x449c29=0xc8;}else{_0x449c29=0xce;}_0x507b72['status'](_0x449c29);return _0x507b72[_0xddbe('0x1c')]('Content-Range',_0x449bc1+'-'+_0x4a2f37+'/'+_0x557a1b)['json'](_0x1abeea);}return null;};}function patchUpdates(_0x12d36b){return function(_0x1c5ce0){try{jsonpatch[_0xddbe('0x1d')](_0x1c5ce0,_0x12d36b,!![]);}catch(_0x5bb269){return BPromise[_0xddbe('0x1e')](_0x5bb269);}return _0x1c5ce0['save']();};}function saveUpdates(_0x43ac7d,_0x3a8f51){return function(_0x21b2d5){if(_0x21b2d5){return _0x21b2d5[_0xddbe('0x1f')](_0x43ac7d)[_0xddbe('0x20')](function(_0x501a59){return _0x501a59;});}return null;};}function removeEntity(_0x452397,_0x2db05a){return function(_0x324d5b){if(_0x324d5b){return _0x324d5b['destroy']()['then'](function(){_0x452397[_0xddbe('0x15')](0xcc)[_0xddbe('0x16')]();});}};}function handleEntityNotFound(_0x3759b6,_0x35d0db){return function(_0x46f2aa){if(!_0x46f2aa){_0x3759b6[_0xddbe('0x14')](0x194);}return _0x46f2aa;};}function handleError(_0x5cc9bd,_0x5aa8e7){_0x5aa8e7=_0x5aa8e7||0x1f4;return function(_0x4d7b8c){logger[_0xddbe('0x21')](_0x4d7b8c[_0xddbe('0x22')]);if(_0x4d7b8c[_0xddbe('0x23')]){delete _0x4d7b8c[_0xddbe('0x23')];}_0x5cc9bd[_0xddbe('0x15')](_0x5aa8e7)['send'](_0x4d7b8c);};}exports[_0xddbe('0x24')]=function(_0x4e5d8a,_0x5f17fd){var _0x2114aa={},_0x375dfa={},_0x5a7228={'count':0x0,'rows':[]};var _0x169562=_[_0xddbe('0x25')](db['CmHopperBlack'][_0xddbe('0x26')],function(_0x1c80f8){return{'name':_0x1c80f8[_0xddbe('0x27')],'type':_0x1c80f8[_0xddbe('0x28')][_0xddbe('0x29')]};});_0x375dfa['model']=_[_0xddbe('0x25')](_0x169562,_0xddbe('0x23'));_0x375dfa[_0xddbe('0x2a')]=_[_0xddbe('0x2b')](_0x4e5d8a['query']);_0x375dfa[_0xddbe('0x2c')]=_[_0xddbe('0x2d')](_0x375dfa['model'],_0x375dfa[_0xddbe('0x2a')]);_0x2114aa['attributes']=_[_0xddbe('0x2d')](_0x375dfa[_0xddbe('0x2e')],qs[_0xddbe('0x2f')](_0x4e5d8a[_0xddbe('0x2a')]['fields']));_0x2114aa[_0xddbe('0x30')]=_0x2114aa[_0xddbe('0x30')][_0xddbe('0x31')]?_0x2114aa['attributes']:_0x375dfa[_0xddbe('0x2e')];if(!_0x4e5d8a[_0xddbe('0x2a')][_0xddbe('0x32')](_0xddbe('0x33'))){_0x2114aa[_0xddbe('0x1a')]=qs['limit'](_0x4e5d8a[_0xddbe('0x2a')][_0xddbe('0x1a')]);_0x2114aa[_0xddbe('0x18')]=qs[_0xddbe('0x18')](_0x4e5d8a['query'][_0xddbe('0x18')]);}_0x2114aa['order']=qs[_0xddbe('0x34')](_0x4e5d8a['query'][_0xddbe('0x34')]);_0x2114aa[_0xddbe('0x35')]=qs['filters'](_['pick'](_0x4e5d8a['query'],_0x375dfa[_0xddbe('0x2c')]),_0x169562);if(_0x4e5d8a[_0xddbe('0x2a')]['filter']){_0x2114aa['where']=_[_0xddbe('0x36')](_0x2114aa[_0xddbe('0x35')],{'$or':_[_0xddbe('0x25')](_0x169562,function(_0x318ef8){if(_0x318ef8['type']!==_0xddbe('0x37')){var _0x36b8a9={};_0x36b8a9[_0x318ef8[_0xddbe('0x23')]]={'$like':'%'+_0x4e5d8a[_0xddbe('0x2a')][_0xddbe('0x38')]+'%'};return _0x36b8a9;}})});}_0x2114aa=_[_0xddbe('0x36')]({},_0x2114aa,_0x4e5d8a[_0xddbe('0x39')]);var _0x2dae58={'where':_0x2114aa['where']};return db[_0xddbe('0x3a')][_0xddbe('0x1b')](_0x2dae58)[_0xddbe('0x20')](function(_0x182c4e){_0x5a7228[_0xddbe('0x1b')]=_0x182c4e;if(_0x4e5d8a['query'][_0xddbe('0x3b')]){_0x2114aa[_0xddbe('0x3c')]=[{'all':!![]}];}return db[_0xddbe('0x3a')][_0xddbe('0x3d')](_0x2114aa);})[_0xddbe('0x20')](function(_0x5d3e8e){_0x5a7228[_0xddbe('0x3e')]=_0x5d3e8e;return _0x5a7228;})[_0xddbe('0x20')](respondWithFilteredResult(_0x5f17fd,_0x2114aa))[_0xddbe('0x3f')](handleError(_0x5f17fd,null));};exports['show']=function(_0x488dd4,_0x398a14){var _0x456935={'raw':!![],'where':{'id':_0x488dd4[_0xddbe('0x40')]['id']}},_0x15319e={};_0x15319e[_0xddbe('0x2e')]=_['keys'](db[_0xddbe('0x3a')][_0xddbe('0x26')]);_0x15319e['query']=_[_0xddbe('0x2b')](_0x488dd4[_0xddbe('0x2a')]);_0x15319e['filters']=_['intersection'](_0x15319e[_0xddbe('0x2e')],_0x15319e['query']);_0x456935[_0xddbe('0x30')]=_[_0xddbe('0x2d')](_0x15319e[_0xddbe('0x2e')],qs[_0xddbe('0x2f')](_0x488dd4[_0xddbe('0x2a')][_0xddbe('0x2f')]));_0x456935[_0xddbe('0x30')]=_0x456935[_0xddbe('0x30')][_0xddbe('0x31')]?_0x456935[_0xddbe('0x30')]:_0x15319e[_0xddbe('0x2e')];if(_0x488dd4[_0xddbe('0x2a')][_0xddbe('0x3b')]){_0x456935['include']=[{'all':!![]}];}_0x456935=_[_0xddbe('0x36')]({},_0x456935,_0x488dd4[_0xddbe('0x39')]);return db[_0xddbe('0x3a')][_0xddbe('0x41')](_0x456935)[_0xddbe('0x20')](handleEntityNotFound(_0x398a14,null))['then'](respondWithResult(_0x398a14,null))[_0xddbe('0x3f')](handleError(_0x398a14,null));};exports[_0xddbe('0x1f')]=function(_0x42de54,_0x28519e){if(_0x42de54[_0xddbe('0x42')]['id']){delete _0x42de54[_0xddbe('0x42')]['id'];}return db[_0xddbe('0x3a')][_0xddbe('0x41')]({'where':{'id':_0x42de54[_0xddbe('0x40')]['id']}})['then'](handleEntityNotFound(_0x28519e,null))[_0xddbe('0x20')](saveUpdates(_0x42de54[_0xddbe('0x42')],null))[_0xddbe('0x20')](respondWithResult(_0x28519e,null))[_0xddbe('0x3f')](handleError(_0x28519e,null));};exports[_0xddbe('0x43')]=function(_0xfbc2f,_0x2f3ecf){return db[_0xddbe('0x3a')][_0xddbe('0x41')]({'where':{'id':_0xfbc2f[_0xddbe('0x40')]['id']}})[_0xddbe('0x20')](handleEntityNotFound(_0x2f3ecf,null))['then'](removeEntity(_0x2f3ecf,null))['catch'](handleError(_0x2f3ecf,null));};exports['describe']=function(_0x48447d,_0x28ad23){return db['CmHopperBlack']['describe']()[_0xddbe('0x20')](respondWithResult(_0x28ad23,null))['catch'](handleError(_0x28ad23,null));}; \ No newline at end of file +var _0xa6a4=['find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','show','params','catch','update','body'];(function(_0x18a8fe,_0x1c6bb6){var _0x31004a=function(_0x2ba069){while(--_0x2ba069){_0x18a8fe['push'](_0x18a8fe['shift']());}};_0x31004a(++_0x1c6bb6);}(_0xa6a4,0x9e));var _0x4a6a=function(_0x3d5149,_0x192ff2){_0x3d5149=_0x3d5149-0x0;var _0x125c44=_0xa6a4[_0x3d5149];return _0x125c44;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a6a('0x0'));var zipdir=require(_0x4a6a('0x1'));var jsonpatch=require(_0x4a6a('0x2'));var rp=require(_0x4a6a('0x3'));var moment=require(_0x4a6a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4a6a('0x5'));var path=require(_0x4a6a('0x6'));var sox=require(_0x4a6a('0x7'));var csv=require('to-csv');var ejs=require(_0x4a6a('0x8'));var fs=require('fs');var fs_extra=require(_0x4a6a('0x9'));var _=require(_0x4a6a('0xa'));var squel=require(_0x4a6a('0xb'));var crypto=require(_0x4a6a('0xc'));var jsforce=require(_0x4a6a('0xd'));var deskjs=require(_0x4a6a('0xe'));var toCsv=require(_0x4a6a('0xf'));var querystring=require(_0x4a6a('0x10'));var Papa=require(_0x4a6a('0x11'));var Redis=require(_0x4a6a('0x12'));var authService=require(_0x4a6a('0x13'));var qs=require(_0x4a6a('0x14'));var as=require(_0x4a6a('0x15'));var hardwareService=require(_0x4a6a('0x16'));var logger=require(_0x4a6a('0x17'))(_0x4a6a('0x18'));var utils=require(_0x4a6a('0x19'));var config=require(_0x4a6a('0x1a'));var licenseUtil=require(_0x4a6a('0x1b'));var db=require(_0x4a6a('0x1c'))['db'];function respondWithStatusCode(_0x2c8a97,_0x1b4aae){_0x1b4aae=_0x1b4aae||0xcc;return function(_0x1a353c){if(_0x1a353c){return _0x2c8a97[_0x4a6a('0x1d')](_0x1b4aae);}return _0x2c8a97[_0x4a6a('0x1e')](_0x1b4aae)['end']();};}function respondWithResult(_0x1c27a1,_0x4ec2f9){_0x4ec2f9=_0x4ec2f9||0xc8;return function(_0x62b73b){if(_0x62b73b){return _0x1c27a1['status'](_0x4ec2f9)[_0x4a6a('0x1f')](_0x62b73b);}};}function respondWithFilteredResult(_0x101cad,_0x23bd9d){return function(_0x26967d){if(_0x26967d){var _0x4b3103=typeof _0x23bd9d[_0x4a6a('0x20')]===_0x4a6a('0x21')&&typeof _0x23bd9d[_0x4a6a('0x22')]==='undefined';var _0x161d4d=_0x26967d[_0x4a6a('0x23')];var _0x14624a=_0x4b3103?0x0:_0x23bd9d[_0x4a6a('0x20')];var _0x258b10=_0x4b3103?_0x26967d[_0x4a6a('0x23')]:_0x23bd9d[_0x4a6a('0x20')]+_0x23bd9d[_0x4a6a('0x22')];var _0x292075;if(_0x258b10>=_0x161d4d){_0x258b10=_0x161d4d;_0x292075=0xc8;}else{_0x292075=0xce;}_0x101cad['status'](_0x292075);return _0x101cad[_0x4a6a('0x24')](_0x4a6a('0x25'),_0x14624a+'-'+_0x258b10+'/'+_0x161d4d)[_0x4a6a('0x1f')](_0x26967d);}return null;};}function patchUpdates(_0x7d1d0b){return function(_0x2b7175){try{jsonpatch[_0x4a6a('0x26')](_0x2b7175,_0x7d1d0b,!![]);}catch(_0x4f2497){return BPromise[_0x4a6a('0x27')](_0x4f2497);}return _0x2b7175['save']();};}function saveUpdates(_0x48f31d,_0x40cff4){return function(_0xd0343a){if(_0xd0343a){return _0xd0343a['update'](_0x48f31d)[_0x4a6a('0x28')](function(_0x3b7053){return _0x3b7053;});}return null;};}function removeEntity(_0x1799ec,_0x1f1ae7){return function(_0x2e591a){if(_0x2e591a){return _0x2e591a[_0x4a6a('0x29')]()[_0x4a6a('0x28')](function(){_0x1799ec[_0x4a6a('0x1e')](0xcc)[_0x4a6a('0x2a')]();});}};}function handleEntityNotFound(_0x14f28e,_0xe2a077){return function(_0x586297){if(!_0x586297){_0x14f28e[_0x4a6a('0x1d')](0x194);}return _0x586297;};}function handleError(_0x5b709c,_0x33a570){_0x33a570=_0x33a570||0x1f4;return function(_0x38fbac){logger['error'](_0x38fbac[_0x4a6a('0x2b')]);if(_0x38fbac[_0x4a6a('0x2c')]){delete _0x38fbac['name'];}_0x5b709c[_0x4a6a('0x1e')](_0x33a570)['send'](_0x38fbac);};}exports[_0x4a6a('0x2d')]=function(_0x278122,_0x34ecf9){var _0x5bfd70={},_0x4b358d={},_0x24d6bc={'count':0x0,'rows':[]};var _0x27c2fb=_[_0x4a6a('0x2e')](db[_0x4a6a('0x2f')][_0x4a6a('0x30')],function(_0x5c2980){return{'name':_0x5c2980[_0x4a6a('0x31')],'type':_0x5c2980['type']['key']};});_0x4b358d[_0x4a6a('0x32')]=_[_0x4a6a('0x2e')](_0x27c2fb,_0x4a6a('0x2c'));_0x4b358d[_0x4a6a('0x33')]=_[_0x4a6a('0x34')](_0x278122['query']);_0x4b358d[_0x4a6a('0x35')]=_[_0x4a6a('0x36')](_0x4b358d[_0x4a6a('0x32')],_0x4b358d['query']);_0x5bfd70[_0x4a6a('0x37')]=_[_0x4a6a('0x36')](_0x4b358d[_0x4a6a('0x32')],qs[_0x4a6a('0x38')](_0x278122['query'][_0x4a6a('0x38')]));_0x5bfd70[_0x4a6a('0x37')]=_0x5bfd70[_0x4a6a('0x37')][_0x4a6a('0x39')]?_0x5bfd70[_0x4a6a('0x37')]:_0x4b358d['model'];if(!_0x278122[_0x4a6a('0x33')][_0x4a6a('0x3a')](_0x4a6a('0x3b'))){_0x5bfd70[_0x4a6a('0x22')]=qs[_0x4a6a('0x22')](_0x278122['query']['limit']);_0x5bfd70[_0x4a6a('0x20')]=qs['offset'](_0x278122[_0x4a6a('0x33')]['offset']);}_0x5bfd70['order']=qs[_0x4a6a('0x3c')](_0x278122['query'][_0x4a6a('0x3c')]);_0x5bfd70[_0x4a6a('0x3d')]=qs[_0x4a6a('0x35')](_[_0x4a6a('0x3e')](_0x278122[_0x4a6a('0x33')],_0x4b358d[_0x4a6a('0x35')]),_0x27c2fb);if(_0x278122[_0x4a6a('0x33')]['filter']){_0x5bfd70['where']=_[_0x4a6a('0x3f')](_0x5bfd70[_0x4a6a('0x3d')],{'$or':_['map'](_0x27c2fb,function(_0x2f6207){if(_0x2f6207[_0x4a6a('0x40')]!=='VIRTUAL'){var _0x44fba7={};_0x44fba7[_0x2f6207['name']]={'$like':'%'+_0x278122['query'][_0x4a6a('0x41')]+'%'};return _0x44fba7;}})});}_0x5bfd70=_[_0x4a6a('0x3f')]({},_0x5bfd70,_0x278122[_0x4a6a('0x42')]);var _0x410ae4={'where':_0x5bfd70['where']};return db[_0x4a6a('0x2f')][_0x4a6a('0x23')](_0x410ae4)[_0x4a6a('0x28')](function(_0x54bcc0){_0x24d6bc[_0x4a6a('0x23')]=_0x54bcc0;if(_0x278122[_0x4a6a('0x33')][_0x4a6a('0x43')]){_0x5bfd70[_0x4a6a('0x44')]=[{'all':!![]}];}return db[_0x4a6a('0x2f')][_0x4a6a('0x45')](_0x5bfd70);})[_0x4a6a('0x28')](function(_0x487b8d){_0x24d6bc[_0x4a6a('0x46')]=_0x487b8d;return _0x24d6bc;})[_0x4a6a('0x28')](respondWithFilteredResult(_0x34ecf9,_0x5bfd70))['catch'](handleError(_0x34ecf9,null));};exports[_0x4a6a('0x47')]=function(_0x55cbcf,_0xf9e281){var _0x46673c={'raw':!![],'where':{'id':_0x55cbcf[_0x4a6a('0x48')]['id']}},_0x5ce76b={};_0x5ce76b[_0x4a6a('0x32')]=_[_0x4a6a('0x34')](db['CmHopperBlack']['rawAttributes']);_0x5ce76b[_0x4a6a('0x33')]=_[_0x4a6a('0x34')](_0x55cbcf[_0x4a6a('0x33')]);_0x5ce76b[_0x4a6a('0x35')]=_[_0x4a6a('0x36')](_0x5ce76b[_0x4a6a('0x32')],_0x5ce76b[_0x4a6a('0x33')]);_0x46673c[_0x4a6a('0x37')]=_[_0x4a6a('0x36')](_0x5ce76b['model'],qs['fields'](_0x55cbcf[_0x4a6a('0x33')]['fields']));_0x46673c['attributes']=_0x46673c[_0x4a6a('0x37')][_0x4a6a('0x39')]?_0x46673c[_0x4a6a('0x37')]:_0x5ce76b['model'];if(_0x55cbcf[_0x4a6a('0x33')][_0x4a6a('0x43')]){_0x46673c[_0x4a6a('0x44')]=[{'all':!![]}];}_0x46673c=_[_0x4a6a('0x3f')]({},_0x46673c,_0x55cbcf[_0x4a6a('0x42')]);return db['CmHopperBlack']['find'](_0x46673c)[_0x4a6a('0x28')](handleEntityNotFound(_0xf9e281,null))[_0x4a6a('0x28')](respondWithResult(_0xf9e281,null))[_0x4a6a('0x49')](handleError(_0xf9e281,null));};exports[_0x4a6a('0x4a')]=function(_0xe570d4,_0x480646){if(_0xe570d4[_0x4a6a('0x4b')]['id']){delete _0xe570d4[_0x4a6a('0x4b')]['id'];}return db[_0x4a6a('0x2f')][_0x4a6a('0x4c')]({'where':{'id':_0xe570d4[_0x4a6a('0x48')]['id']}})[_0x4a6a('0x28')](handleEntityNotFound(_0x480646,null))['then'](saveUpdates(_0xe570d4[_0x4a6a('0x4b')],null))['then'](respondWithResult(_0x480646,null))[_0x4a6a('0x49')](handleError(_0x480646,null));};exports[_0x4a6a('0x29')]=function(_0x458de7,_0x336054){return db[_0x4a6a('0x2f')][_0x4a6a('0x4c')]({'where':{'id':_0x458de7[_0x4a6a('0x48')]['id']}})[_0x4a6a('0x28')](handleEntityNotFound(_0x336054,null))[_0x4a6a('0x28')](removeEntity(_0x336054,null))[_0x4a6a('0x49')](handleError(_0x336054,null));};exports[_0x4a6a('0x4d')]=function(_0x5012da,_0x5ee30a){return db[_0x4a6a('0x2f')]['describe']()[_0x4a6a('0x28')](respondWithResult(_0x5ee30a,null))[_0x4a6a('0x49')](handleError(_0x5ee30a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index d32a194..25d00ae 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 _0x77ab=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','moment'];(function(_0x1796ca,_0x116132){var _0xd267e8=function(_0x4687b7){while(--_0x4687b7){_0x1796ca['push'](_0x1796ca['shift']());}};_0xd267e8(++_0x116132);}(_0x77ab,0x19f));var _0xb77a=function(_0x4cc391,_0xea2582){_0x4cc391=_0x4cc391-0x0;var _0x7e2cd5=_0x77ab[_0x4cc391];return _0x7e2cd5;};'use strict';var _=require(_0xb77a('0x0'));var util=require(_0xb77a('0x1'));var logger=require(_0xb77a('0x2'))(_0xb77a('0x3'));var moment=require(_0xb77a('0x4'));var BPromise=require(_0xb77a('0x5'));var rp=require(_0xb77a('0x6'));var fs=require('fs');var path=require(_0xb77a('0x7'));var rimraf=require(_0xb77a('0x8'));var config=require(_0xb77a('0x9'));var attributes=require(_0xb77a('0xa'));module[_0xb77a('0xb')]=function(_0x12d2c7,_0x48a3b9){return _0x12d2c7[_0xb77a('0xc')]('CmHopperBlack',attributes,{'tableName':_0xb77a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x940a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','cm_hopper_black','lodash','../../config/logger'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0x940a,0x76));var _0xa940=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0x940a[_0x42c118];return _0x112ebd;};'use strict';var _=require(_0xa940('0x0'));var util=require('util');var logger=require(_0xa940('0x1'))(_0xa940('0x2'));var moment=require(_0xa940('0x3'));var BPromise=require(_0xa940('0x4'));var rp=require(_0xa940('0x5'));var fs=require('fs');var path=require(_0xa940('0x6'));var rimraf=require(_0xa940('0x7'));var config=require(_0xa940('0x8'));var attributes=require(_0xa940('0x9'));module['exports']=function(_0x339cc0,_0x79c95b){return _0x339cc0[_0xa940('0xa')]('CmHopperBlack',attributes,{'tableName':_0xa940('0xb'),'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 cec66f5..5489642 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 _0xcbd2=['then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','debug','UpdateCmHopperBlack','body','DestroyCmHopperBlack','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x13b405,_0x430d9d){var _0x4aed46=function(_0x29b9f5){while(--_0x29b9f5){_0x13b405['push'](_0x13b405['shift']());}};_0x4aed46(++_0x430d9d);}(_0xcbd2,0xd3));var _0x2cbd=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0xcbd2[_0x367361];return _0x195d2d;};'use strict';var _=require('lodash');var util=require(_0x2cbd('0x0'));var moment=require('moment');var BPromise=require(_0x2cbd('0x1'));var rs=require(_0x2cbd('0x2'));var fs=require('fs');var Redis=require(_0x2cbd('0x3'));var db=require(_0x2cbd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cbd('0x5'))(_0x2cbd('0x6'));var config=require(_0x2cbd('0x7'));var jayson=require(_0x2cbd('0x8'));var client=jayson[_0x2cbd('0x9')][_0x2cbd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56d2fe,_0x3601dd,_0x208879){return new BPromise(function(_0x23030a,_0x38eeaf){return client['request'](_0x56d2fe,_0x208879)[_0x2cbd('0xb')](function(_0x34f3a3){logger[_0x2cbd('0xc')](_0x2cbd('0xd'),_0x3601dd,_0x2cbd('0xe'));logger['debug'](_0x2cbd('0xf'),_0x3601dd,_0x2cbd('0xe'),JSON[_0x2cbd('0x10')](_0x34f3a3));if(_0x34f3a3['error']){if(_0x34f3a3[_0x2cbd('0x11')][_0x2cbd('0x12')]===0x1f4){logger['error'](_0x2cbd('0xd'),_0x3601dd,_0x34f3a3[_0x2cbd('0x11')][_0x2cbd('0x13')]);return _0x38eeaf(_0x34f3a3['error'][_0x2cbd('0x13')]);}logger[_0x2cbd('0x11')](_0x2cbd('0xd'),_0x3601dd,_0x34f3a3[_0x2cbd('0x11')][_0x2cbd('0x13')]);return _0x23030a(_0x34f3a3[_0x2cbd('0x11')]['message']);}else{logger[_0x2cbd('0xc')](_0x2cbd('0xd'),_0x3601dd,_0x2cbd('0xe'));_0x23030a(_0x34f3a3[_0x2cbd('0x14')]['message']);}})[_0x2cbd('0x15')](function(_0x40fe09){logger['error'](_0x2cbd('0xd'),_0x3601dd,_0x40fe09);_0x38eeaf(_0x40fe09);});});}exports[_0x2cbd('0x16')]=function(_0x515dfe){var _0x229592=this;return new Promise(function(_0x204dda,_0xb27407){return db[_0x2cbd('0x17')][_0x2cbd('0x18')]({'raw':_0x515dfe[_0x2cbd('0x19')]?_0x515dfe[_0x2cbd('0x19')][_0x2cbd('0x1a')]===undefined?!![]:![]:!![],'where':_0x515dfe['options']?_0x515dfe[_0x2cbd('0x19')][_0x2cbd('0x1b')]||null:null,'attributes':_0x515dfe[_0x2cbd('0x19')]?_0x515dfe[_0x2cbd('0x19')][_0x2cbd('0x1c')]||null:null,'limit':_0x515dfe[_0x2cbd('0x19')]?_0x515dfe[_0x2cbd('0x19')][_0x2cbd('0x1d')]||null:null,'include':_0x515dfe[_0x2cbd('0x19')]?_0x515dfe[_0x2cbd('0x19')][_0x2cbd('0x1e')]?_[_0x2cbd('0x1f')](_0x515dfe[_0x2cbd('0x19')]['include'],function(_0x33cb95){return{'model':db[_0x33cb95[_0x2cbd('0x20')]],'as':_0x33cb95['as'],'attributes':_0x33cb95[_0x2cbd('0x1c')],'include':_0x33cb95[_0x2cbd('0x1e')]?_['map'](_0x33cb95[_0x2cbd('0x1e')],function(_0x141071){return{'model':db[_0x141071[_0x2cbd('0x20')]],'as':_0x141071['as'],'attributes':_0x141071[_0x2cbd('0x1c')],'include':_0x141071['include']?_[_0x2cbd('0x1f')](_0x141071[_0x2cbd('0x1e')],function(_0x5b6a55){return{'model':db[_0x5b6a55[_0x2cbd('0x20')]],'as':_0x5b6a55['as'],'attributes':_0x5b6a55['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c6023){logger[_0x2cbd('0xc')](_0x2cbd('0x16'),_0x515dfe);logger[_0x2cbd('0x21')]('GetCmHopperBlack',_0x515dfe,JSON[_0x2cbd('0x10')](_0x5c6023));_0x204dda(_0x5c6023);})[_0x2cbd('0x15')](function(_0x4d2282){logger[_0x2cbd('0x11')](_0x2cbd('0x16'),_0x4d2282[_0x2cbd('0x13')],_0x515dfe);_0xb27407(_0x229592[_0x2cbd('0x11')](0x1f4,_0x4d2282[_0x2cbd('0x13')]));});});};exports[_0x2cbd('0x22')]=function(_0x28f20c){var _0xdfeef1=this;return new Promise(function(_0x2d32a7,_0x5145a6){return db[_0x2cbd('0x17')]['update'](_0x28f20c[_0x2cbd('0x23')],{'raw':_0x28f20c['options']?_0x28f20c[_0x2cbd('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28f20c['options']?_0x28f20c['options'][_0x2cbd('0x1b')]||null:null,'attributes':_0x28f20c[_0x2cbd('0x19')]?_0x28f20c[_0x2cbd('0x19')][_0x2cbd('0x1c')]||null:null,'limit':_0x28f20c['options']?_0x28f20c[_0x2cbd('0x19')]['limit']||null:null})[_0x2cbd('0xb')](function(_0x3b8bfe){logger['info'](_0x2cbd('0x22'),_0x28f20c);logger[_0x2cbd('0x21')](_0x2cbd('0x22'),_0x28f20c,JSON[_0x2cbd('0x10')](_0x3b8bfe));_0x2d32a7(_0x3b8bfe);})[_0x2cbd('0x15')](function(_0x42aed2){logger[_0x2cbd('0x11')](_0x2cbd('0x22'),_0x42aed2[_0x2cbd('0x13')],_0x28f20c);_0x5145a6(_0xdfeef1['error'](0x1f4,_0x42aed2[_0x2cbd('0x13')]));});});};exports[_0x2cbd('0x24')]=function(_0x49fbf3){var _0x3f4904=this;return new Promise(function(_0x2024f5,_0x4984d4){return db['CmHopperBlack']['destroy']({'where':_0x49fbf3[_0x2cbd('0x19')]?_0x49fbf3[_0x2cbd('0x19')][_0x2cbd('0x1b')]||null:null})['then'](function(_0x3ffab1){logger[_0x2cbd('0xc')](_0x2cbd('0x24'),_0x49fbf3);logger['debug']('DestroyCmHopperBlack',_0x49fbf3,JSON['stringify'](_0x3ffab1));_0x2024f5(_0x3ffab1);})['catch'](function(_0x1dce55){logger['error'](_0x2cbd('0x24'),_0x1dce55[_0x2cbd('0x13')],_0x49fbf3);_0x4984d4(_0x3f4904[_0x2cbd('0x11')](0x1f4,_0x1dce55[_0x2cbd('0x13')]));});});}; \ No newline at end of file +var _0x43c3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetCmHopperBlack','options','raw','where','attributes','limit','include','model','map','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','CmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x43c3,0xef));var _0x343c=function(_0x370564,_0x5b0dee){_0x370564=_0x370564-0x0;var _0x41f773=_0x43c3[_0x370564];return _0x41f773;};'use strict';var _=require(_0x343c('0x0'));var util=require(_0x343c('0x1'));var moment=require(_0x343c('0x2'));var BPromise=require(_0x343c('0x3'));var rs=require(_0x343c('0x4'));var fs=require('fs');var Redis=require(_0x343c('0x5'));var db=require(_0x343c('0x6'))['db'];var utils=require(_0x343c('0x7'));var logger=require(_0x343c('0x8'))(_0x343c('0x9'));var config=require(_0x343c('0xa'));var jayson=require(_0x343c('0xb'));var client=jayson[_0x343c('0xc')][_0x343c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x363d7f,_0x116fac,_0x2c5fa3){return new BPromise(function(_0x53b652,_0xe5e186){return client[_0x343c('0xe')](_0x363d7f,_0x2c5fa3)[_0x343c('0xf')](function(_0x103d3b){logger['info'](_0x343c('0x10'),_0x116fac,'request\x20sent');logger[_0x343c('0x11')](_0x343c('0x12'),_0x116fac,_0x343c('0x13'),JSON[_0x343c('0x14')](_0x103d3b));if(_0x103d3b[_0x343c('0x15')]){if(_0x103d3b[_0x343c('0x15')][_0x343c('0x16')]===0x1f4){logger[_0x343c('0x15')](_0x343c('0x10'),_0x116fac,_0x103d3b[_0x343c('0x15')]['message']);return _0xe5e186(_0x103d3b[_0x343c('0x15')]['message']);}logger[_0x343c('0x15')]('CmHopperBlack,\x20%s,\x20%s',_0x116fac,_0x103d3b[_0x343c('0x15')][_0x343c('0x17')]);return _0x53b652(_0x103d3b[_0x343c('0x15')][_0x343c('0x17')]);}else{logger[_0x343c('0x18')](_0x343c('0x10'),_0x116fac,_0x343c('0x13'));_0x53b652(_0x103d3b[_0x343c('0x19')][_0x343c('0x17')]);}})[_0x343c('0x1a')](function(_0x487e66){logger[_0x343c('0x15')](_0x343c('0x10'),_0x116fac,_0x487e66);_0xe5e186(_0x487e66);});});}exports[_0x343c('0x1b')]=function(_0x3a0b2c){var _0x4d8599=this;return new Promise(function(_0xf1e87,_0x11b28d){return db['CmHopperBlack']['findAll']({'raw':_0x3a0b2c[_0x343c('0x1c')]?_0x3a0b2c['options'][_0x343c('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a0b2c[_0x343c('0x1c')]?_0x3a0b2c[_0x343c('0x1c')][_0x343c('0x1e')]||null:null,'attributes':_0x3a0b2c[_0x343c('0x1c')]?_0x3a0b2c['options'][_0x343c('0x1f')]||null:null,'limit':_0x3a0b2c[_0x343c('0x1c')]?_0x3a0b2c[_0x343c('0x1c')][_0x343c('0x20')]||null:null,'include':_0x3a0b2c[_0x343c('0x1c')]?_0x3a0b2c[_0x343c('0x1c')][_0x343c('0x21')]?_['map'](_0x3a0b2c['options'][_0x343c('0x21')],function(_0x2ed3cc){return{'model':db[_0x2ed3cc[_0x343c('0x22')]],'as':_0x2ed3cc['as'],'attributes':_0x2ed3cc[_0x343c('0x1f')],'include':_0x2ed3cc[_0x343c('0x21')]?_[_0x343c('0x23')](_0x2ed3cc[_0x343c('0x21')],function(_0x53a34b){return{'model':db[_0x53a34b[_0x343c('0x22')]],'as':_0x53a34b['as'],'attributes':_0x53a34b[_0x343c('0x1f')],'include':_0x53a34b[_0x343c('0x21')]?_[_0x343c('0x23')](_0x53a34b[_0x343c('0x21')],function(_0x4a2a80){return{'model':db[_0x4a2a80[_0x343c('0x22')]],'as':_0x4a2a80['as'],'attributes':_0x4a2a80[_0x343c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x343c('0xf')](function(_0xc3c12b){logger[_0x343c('0x18')](_0x343c('0x1b'),_0x3a0b2c);logger[_0x343c('0x11')](_0x343c('0x1b'),_0x3a0b2c,JSON[_0x343c('0x14')](_0xc3c12b));_0xf1e87(_0xc3c12b);})[_0x343c('0x1a')](function(_0xf44188){logger[_0x343c('0x15')](_0x343c('0x1b'),_0xf44188[_0x343c('0x17')],_0x3a0b2c);_0x11b28d(_0x4d8599['error'](0x1f4,_0xf44188[_0x343c('0x17')]));});});};exports[_0x343c('0x24')]=function(_0x260568){var _0x318a45=this;return new Promise(function(_0xb1a098,_0x36b681){return db['CmHopperBlack'][_0x343c('0x25')](_0x260568[_0x343c('0x26')],{'raw':_0x260568[_0x343c('0x1c')]?_0x260568[_0x343c('0x1c')][_0x343c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x260568['options']?_0x260568[_0x343c('0x1c')][_0x343c('0x1e')]||null:null,'attributes':_0x260568[_0x343c('0x1c')]?_0x260568[_0x343c('0x1c')]['attributes']||null:null,'limit':_0x260568[_0x343c('0x1c')]?_0x260568[_0x343c('0x1c')][_0x343c('0x20')]||null:null})[_0x343c('0xf')](function(_0x57c57b){logger[_0x343c('0x18')](_0x343c('0x24'),_0x260568);logger[_0x343c('0x11')](_0x343c('0x24'),_0x260568,JSON['stringify'](_0x57c57b));_0xb1a098(_0x57c57b);})[_0x343c('0x1a')](function(_0x4ab683){logger[_0x343c('0x15')](_0x343c('0x24'),_0x4ab683[_0x343c('0x17')],_0x260568);_0x36b681(_0x318a45[_0x343c('0x15')](0x1f4,_0x4ab683[_0x343c('0x17')]));});});};exports[_0x343c('0x27')]=function(_0x1c6d6c){var _0x2d2cc4=this;return new Promise(function(_0x3e51c5,_0x4793d7){return db[_0x343c('0x28')]['destroy']({'where':_0x1c6d6c[_0x343c('0x1c')]?_0x1c6d6c[_0x343c('0x1c')][_0x343c('0x1e')]||null:null})[_0x343c('0xf')](function(_0x84c510){logger['info']('DestroyCmHopperBlack',_0x1c6d6c);logger[_0x343c('0x11')](_0x343c('0x27'),_0x1c6d6c,JSON[_0x343c('0x14')](_0x84c510));_0x3e51c5(_0x84c510);})[_0x343c('0x1a')](function(_0x34df8b){logger[_0x343c('0x15')](_0x343c('0x27'),_0x34df8b['message'],_0x1c6d6c);_0x4793d7(_0x2d2cc4[_0x343c('0x15')](0x1f4,_0x34df8b[_0x343c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index b7d8cf4..c3eab9d 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 _0x1883=['../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2f47f1,_0x17f6a7){var _0x1e2329=function(_0x8f5900){while(--_0x8f5900){_0x2f47f1['push'](_0x2f47f1['shift']());}};_0x1e2329(++_0x17f6a7);}(_0x1883,0xab));var _0x3188=function(_0x27d233,_0x18ffad){_0x27d233=_0x27d233-0x0;var _0x5963be=_0x1883[_0x27d233];return _0x5963be;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['describe']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['put'](_0x3188('0xf'),auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')]('/:id',auth[_0x3188('0xc')](),controller[_0x3188('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4137=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4137,0xf8));var _0x7413=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4137[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/:id',auth[_0x7413('0xe')](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 3b5e8f1..1f96196 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 _0xcc7b=['INTEGER','STRING','DATE','endtime','followuptime','BOOLEAN','moment','exports'];(function(_0x39336c,_0x5ef836){var _0x36aba1=function(_0x5a0209){while(--_0x5a0209){_0x39336c['push'](_0x39336c['shift']());}};_0x36aba1(++_0x5ef836);}(_0xcc7b,0x15e));var _0xbcc7=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xcc7b[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xbcc7('0x0'));module[_0xbcc7('0x1')]={'state':{'type':Sequelize[_0xbcc7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbcc7('0x3')]},'scheduledat':{'type':Sequelize[_0xbcc7('0x4')]},'countbusyretry':{'type':Sequelize[_0xbcc7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbcc7('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbcc7('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbcc7('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xbcc7('0x3')]},'originatecalleridname':{'type':Sequelize[_0xbcc7('0x3')]},'calleridnum':{'type':Sequelize[_0xbcc7('0x3')]},'calleridname':{'type':Sequelize[_0xbcc7('0x3')]},'starttime':{'type':Sequelize[_0xbcc7('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xbcc7('0x4')]},'droptime':{'type':Sequelize[_0xbcc7('0x4')]},'endtime':{'type':Sequelize[_0xbcc7('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbcc7('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbcc7('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbcc7('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbcc7('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xbcc7('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xbcc7('0x3')]},'disposition':{'type':Sequelize[_0xbcc7('0x3')]},'secondDisposition':{'type':Sequelize[_0xbcc7('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4a2a20){var _0x3dffc8=this['getDataValue'](_0xbcc7('0x5'));if(_0x3dffc8&&_0x4a2a20){this['setDataValue'](_0xbcc7('0x6'),moment(_0x4a2a20)['diff'](moment(_0x3dffc8),'seconds'));}}},'amd':{'type':Sequelize[_0xbcc7('0x7')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbcc7('0x7')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xbcc7('0x7')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xbcc7('0x7')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbcc7('0x4')]},'callback':{'type':Sequelize[_0xbcc7('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbcc7('0x4')]},'recallme':{'type':Sequelize[_0xbcc7('0x7')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xbcc7('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xbcc7('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbcc7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbcc7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfa50=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','BOOLEAN','sequelize','exports'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xfa50,0x1d7));var _0x0fa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa50[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0fa5('0x0'));var moment=require('moment');module[_0x0fa5('0x1')]={'state':{'type':Sequelize[_0x0fa5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0fa5('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x0fa5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0fa5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0fa5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0fa5('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0fa5('0x3')]},'originatecalleridname':{'type':Sequelize[_0x0fa5('0x3')]},'calleridnum':{'type':Sequelize[_0x0fa5('0x3')]},'calleridname':{'type':Sequelize[_0x0fa5('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0fa5('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x0fa5('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0fa5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0fa5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0fa5('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0fa5('0x3')]},'membername':{'type':Sequelize[_0x0fa5('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0fa5('0x3')]},'secondDisposition':{'type':Sequelize[_0x0fa5('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0fa5('0x3')]},'dispositionat':{'type':Sequelize[_0x0fa5('0x4')],'set':function(_0x10b230){var _0x47700f=this[_0x0fa5('0x5')](_0x0fa5('0x6'));if(_0x47700f&&_0x10b230){this[_0x0fa5('0x7')](_0x0fa5('0x8'),moment(_0x10b230)['diff'](moment(_0x47700f),_0x0fa5('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0fa5('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0fa5('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0fa5('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0fa5('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0fa5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x0fa5('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0fa5('0x4')]},'recallme':{'type':Sequelize[_0x0fa5('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x0fa5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0fa5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0fa5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0fa5('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 50f7cb7..743d158 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 _0xbd51=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','then','includeAll','include','rows','show','params','keys','length','catch','describe','body','uniqueid','find','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x208,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt'];(function(_0x1454bc,_0x59d1b7){var _0x42e132=function(_0x98acf6){while(--_0x98acf6){_0x1454bc['push'](_0x1454bc['shift']());}};_0x42e132(++_0x59d1b7);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x2af764,_0x18618b){_0x2af764=_0x2af764-0x0;var _0x969fe=_0xbd51[_0x2af764];return _0x969fe;};'use strict';var emlformat=require(_0x1bd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bd5('0x1'));var jsonpatch=require(_0x1bd5('0x2'));var rp=require(_0x1bd5('0x3'));var moment=require(_0x1bd5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1bd5('0x5'));var csv=require(_0x1bd5('0x6'));var ejs=require(_0x1bd5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1bd5('0x8'));var squel=require(_0x1bd5('0x9'));var crypto=require(_0x1bd5('0xa'));var jsforce=require(_0x1bd5('0xb'));var deskjs=require(_0x1bd5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1bd5('0xd'));var Papa=require('papaparse');var Redis=require(_0x1bd5('0xe'));var authService=require(_0x1bd5('0xf'));var qs=require(_0x1bd5('0x10'));var as=require(_0x1bd5('0x11'));var hardwareService=require(_0x1bd5('0x12'));var logger=require(_0x1bd5('0x13'))('api');var utils=require(_0x1bd5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1bd5('0x15'));var db=require(_0x1bd5('0x16'))['db'];function respondWithStatusCode(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xcc;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0x17')](_0x14606b);}return _0x37e8e1[_0x1bd5('0x18')](_0x14606b)['end']();};}function respondWithResult(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0xc8;return function(_0x6d2c40){if(_0x6d2c40){return _0x5650b5[_0x1bd5('0x18')](_0x8b2390)[_0x1bd5('0x19')](_0x6d2c40);}};}function respondWithFilteredResult(_0x48d048,_0x5072c2){return function(_0xa63190){if(_0xa63190){var _0xc7277e=typeof _0x5072c2[_0x1bd5('0x1a')]===_0x1bd5('0x1b')&&typeof _0x5072c2[_0x1bd5('0x1c')]===_0x1bd5('0x1b');var _0x13cf34=_0xa63190[_0x1bd5('0x1d')];var _0x4670b5=_0xc7277e?0x0:_0x5072c2['offset'];var _0x53ad5e=_0xc7277e?_0xa63190[_0x1bd5('0x1d')]:_0x5072c2[_0x1bd5('0x1a')]+_0x5072c2[_0x1bd5('0x1c')];var _0xb95d4e;if(_0x53ad5e>=_0x13cf34){_0x53ad5e=_0x13cf34;_0xb95d4e=0xc8;}else{_0xb95d4e=0xce;}_0x48d048[_0x1bd5('0x18')](_0xb95d4e);return _0x48d048[_0x1bd5('0x1e')](_0x1bd5('0x1f'),_0x4670b5+'-'+_0x53ad5e+'/'+_0x13cf34)[_0x1bd5('0x19')](_0xa63190);}return null;};}function patchUpdates(_0x456051){return function(_0xb1ac1e){try{jsonpatch[_0x1bd5('0x20')](_0xb1ac1e,_0x456051,!![]);}catch(_0x2447c4){return BPromise[_0x1bd5('0x21')](_0x2447c4);}return _0xb1ac1e[_0x1bd5('0x22')]();};}function saveUpdates(_0x253d79,_0x46c580){return function(_0x1f13e7){if(_0x1f13e7){return _0x1f13e7[_0x1bd5('0x23')](_0x253d79)['then'](function(_0x42c43d){return _0x42c43d;});}return null;};}function removeEntity(_0x50c663,_0x18fd18){return function(_0x1e534e){if(_0x1e534e){return _0x1e534e[_0x1bd5('0x24')]()['then'](function(){_0x50c663[_0x1bd5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed551,_0x30676d){return function(_0x3dba4f){if(!_0x3dba4f){_0x2ed551[_0x1bd5('0x17')](0x194);}return _0x3dba4f;};}function handleError(_0x47c84b,_0x202ed3){_0x202ed3=_0x202ed3||0x1f4;return function(_0x69bb17){logger[_0x1bd5('0x25')](_0x69bb17[_0x1bd5('0x26')]);if(_0x69bb17['name']){delete _0x69bb17[_0x1bd5('0x27')];}_0x47c84b[_0x1bd5('0x18')](_0x202ed3)[_0x1bd5('0x28')](_0x69bb17);};}exports[_0x1bd5('0x29')]=function(_0xe54b9f,_0xc73670){var _0x4e72b2={},_0x289097={},_0x472b22={'count':0x0,'rows':[]};var _0x8d53ba=_['map'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')],function(_0x345181){return{'name':_0x345181[_0x1bd5('0x2c')],'type':_0x345181[_0x1bd5('0x2d')][_0x1bd5('0x2e')]};});_0x289097['model']=_['map'](_0x8d53ba,_0x1bd5('0x27'));_0x289097[_0x1bd5('0x2f')]=_['keys'](_0xe54b9f[_0x1bd5('0x2f')]);_0x289097[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],_0x289097['query']);_0x4e72b2[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x289097[_0x1bd5('0x32')],qs[_0x1bd5('0x34')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x4e72b2[_0x1bd5('0x33')]=_0x4e72b2[_0x1bd5('0x33')]['length']?_0x4e72b2[_0x1bd5('0x33')]:_0x289097[_0x1bd5('0x32')];if(!_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x35')](_0x1bd5('0x36'))){_0x4e72b2[_0x1bd5('0x1c')]=qs[_0x1bd5('0x1c')](_0xe54b9f['query'][_0x1bd5('0x1c')]);_0x4e72b2[_0x1bd5('0x1a')]=qs[_0x1bd5('0x1a')](_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x1a')]);}_0x4e72b2[_0x1bd5('0x37')]=qs[_0x1bd5('0x38')](_0xe54b9f['query']['sort']);_0x4e72b2[_0x1bd5('0x39')]=qs[_0x1bd5('0x30')](_[_0x1bd5('0x3a')](_0xe54b9f['query'],_0x289097[_0x1bd5('0x30')]),_0x8d53ba);if(_0xe54b9f['query'][_0x1bd5('0x3b')]){_0x4e72b2[_0x1bd5('0x39')]=_[_0x1bd5('0x3c')](_0x4e72b2[_0x1bd5('0x39')],{'$or':_[_0x1bd5('0x3d')](_0x8d53ba,function(_0x2470ec){if(_0x2470ec[_0x1bd5('0x2d')]!==_0x1bd5('0x3e')){var _0x4bbefc={};_0x4bbefc[_0x2470ec[_0x1bd5('0x27')]]={'$like':'%'+_0xe54b9f[_0x1bd5('0x2f')]['filter']+'%'};return _0x4bbefc;}})});}_0x4e72b2=_[_0x1bd5('0x3c')]({},_0x4e72b2,_0xe54b9f[_0x1bd5('0x3f')]);var _0x20b25c={'where':_0x4e72b2['where']};return db[_0x1bd5('0x2a')][_0x1bd5('0x1d')](_0x20b25c)[_0x1bd5('0x40')](function(_0x4074f1){_0x472b22['count']=_0x4074f1;if(_0xe54b9f[_0x1bd5('0x2f')][_0x1bd5('0x41')]){_0x4e72b2[_0x1bd5('0x42')]=[{'all':!![]}];}return db[_0x1bd5('0x2a')]['findAll'](_0x4e72b2);})['then'](function(_0x40eeff){_0x472b22[_0x1bd5('0x43')]=_0x40eeff;return _0x472b22;})[_0x1bd5('0x40')](respondWithFilteredResult(_0xc73670,_0x4e72b2))['catch'](handleError(_0xc73670,null));};exports[_0x1bd5('0x44')]=function(_0x3b1092,_0x574d95){var _0x1eacac={'raw':!![],'where':{'id':_0x3b1092[_0x1bd5('0x45')]['id']}},_0x5761b8={};_0x5761b8[_0x1bd5('0x32')]=_['keys'](db[_0x1bd5('0x2a')][_0x1bd5('0x2b')]);_0x5761b8[_0x1bd5('0x2f')]=_[_0x1bd5('0x46')](_0x3b1092[_0x1bd5('0x2f')]);_0x5761b8[_0x1bd5('0x30')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],_0x5761b8[_0x1bd5('0x2f')]);_0x1eacac[_0x1bd5('0x33')]=_[_0x1bd5('0x31')](_0x5761b8[_0x1bd5('0x32')],qs['fields'](_0x3b1092[_0x1bd5('0x2f')][_0x1bd5('0x34')]));_0x1eacac[_0x1bd5('0x33')]=_0x1eacac['attributes'][_0x1bd5('0x47')]?_0x1eacac[_0x1bd5('0x33')]:_0x5761b8['model'];if(_0x3b1092[_0x1bd5('0x2f')]['includeAll']){_0x1eacac[_0x1bd5('0x42')]=[{'all':!![]}];}_0x1eacac=_['merge']({},_0x1eacac,_0x3b1092[_0x1bd5('0x3f')]);return db[_0x1bd5('0x2a')]['find'](_0x1eacac)[_0x1bd5('0x40')](handleEntityNotFound(_0x574d95,null))['then'](respondWithResult(_0x574d95,null))[_0x1bd5('0x48')](handleError(_0x574d95,null));};exports[_0x1bd5('0x49')]=function(_0x1a29f3,_0xe71454){return db[_0x1bd5('0x2a')][_0x1bd5('0x49')]()[_0x1bd5('0x40')](respondWithResult(_0xe71454,null))[_0x1bd5('0x48')](handleError(_0xe71454,null));};exports['update']=function(_0x13985e,_0x227a68){if(_0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')]){delete _0x13985e[_0x1bd5('0x4a')][_0x1bd5('0x4b')];}return db['CmHopperFinal'][_0x1bd5('0x4c')]({'where':{'uniqueid':_0x13985e[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x227a68,null))[_0x1bd5('0x40')](saveUpdates(_0x13985e[_0x1bd5('0x4a')],null))[_0x1bd5('0x40')](respondWithResult(_0x227a68,null))[_0x1bd5('0x48')](handleError(_0x227a68,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x587c46,_0x126221,_0x2d713b){return db[_0x1bd5('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x587c46[_0x1bd5('0x45')]['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x51')))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x52')))),_0x1bd5('0x53')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x1bd5('0x54')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x55')))),_0x1bd5('0x56')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),_0x1bd5('0x58')],[db['sequelize']['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),'reCallContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x126221,null))['then'](respondWithResult(_0x126221,null))['catch'](handleError(_0x126221,null));};exports[_0x1bd5('0x5c')]=function(_0xec9fac,_0x1790af,_0x54a8c4){return db['CmHopperFinal'][_0x1bd5('0x5d')]({'raw':![],'where':{'CampaignId':_0xec9fac['params']['id']},'attributes':[[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')]['literal'](_0x1bd5('0x50')))),'noSuchContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db['sequelize']['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db['sequelize'][_0x1bd5('0x4f')](_0x1bd5('0x5e')))),'congestionContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x55')))),'dropContacts'],[db[_0x1bd5('0x4d')]['fn']('COUNT',db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x57')))),'abandonedContacts'],[db['sequelize']['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x59')))),_0x1bd5('0x5f')],[db[_0x1bd5('0x4d')]['fn'](_0x1bd5('0x4e'),db[_0x1bd5('0x4d')]['fn']('IF',db[_0x1bd5('0x4d')][_0x1bd5('0x4f')](_0x1bd5('0x5a')))),_0x1bd5('0x5b')]]})[_0x1bd5('0x40')](handleEntityNotFound(_0x1790af,null))[_0x1bd5('0x40')](respondWithResult(_0x1790af,null))[_0x1bd5('0x48')](handleError(_0x1790af,null));};exports[_0x1bd5('0x60')]=function(_0x195176,_0x393a8f,_0x1ffbab){return db[_0x1bd5('0x61')][_0x1bd5('0x4c')]({'where':{'id':_0x195176[_0x1bd5('0x45')]['id']}})[_0x1bd5('0x40')](handleEntityNotFound(_0x393a8f,null))['then'](function(_0x3bd058){var _0x1d6223;if(_0x3bd058){_0x1d6223=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),'scheduledAt',_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x69'),_0x1bd5('0x6a'),'updatedAt'],squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),'ContactId')['field'](_0x1bd5('0x71'),'ListId')[_0x1bd5('0x6c')](_0x1bd5('0x72'),'VoiceQueueId')[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')](_0x1bd5('0x6e'),_0x1bd5('0x73'))['from'](_0x1bd5('0x74'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x195176[_0x1bd5('0x4a')][_0x1bd5('0x77')][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()['field'](_0x1bd5('0x66'))[_0x1bd5('0x7a')](_0x1bd5('0x64'))[_0x1bd5('0x39')](_0x1bd5('0x75'),_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')['from']('cm_hopper_final')[_0x1bd5('0x39')]('VoiceQueueId\x20=\x20?',_0x195176[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')](_0x1bd5('0x7c')))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db['sequelize'][_0x1bd5('0x2f')](_0x1d6223);}return[];})['then'](respondWithResult(_0x393a8f,null))[_0x1bd5('0x48')](handleError(_0x393a8f,null));};exports[_0x1bd5('0x7e')]=function(_0x7d097,_0x50f2ac,_0x5db61c){return db[_0x1bd5('0x7f')]['find']({'where':{'id':_0x7d097[_0x1bd5('0x45')]['id']}})['then'](handleEntityNotFound(_0x50f2ac,null))[_0x1bd5('0x40')](function(_0x16f996){var _0x248d66;if(_0x16f996){_0x248d66=squel[_0x1bd5('0x62')]()[_0x1bd5('0x63')](_0x1bd5('0x64'))[_0x1bd5('0x65')]([_0x1bd5('0x66'),_0x1bd5('0x6f'),_0x1bd5('0x67'),_0x1bd5('0x68'),_0x1bd5('0x80'),_0x1bd5('0x6a'),_0x1bd5('0x73')],squel['select']()[_0x1bd5('0x6c')](_0x1bd5('0x6d'),_0x1bd5('0x66'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6f'))['field'](_0x1bd5('0x70'),_0x1bd5('0x67'))[_0x1bd5('0x6c')]('ANY_VALUE(ListId)',_0x1bd5('0x68'))[_0x1bd5('0x6c')](_0x1bd5('0x81'),_0x1bd5('0x80'))['field'](_0x1bd5('0x6e'),_0x1bd5('0x6a'))[_0x1bd5('0x6c')]('NOW()',_0x1bd5('0x73'))[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id']['toString']())['where'](_0x1bd5('0x76'),_0x7d097['body']['state'][_0x1bd5('0x78')]())['where'](_0x1bd5('0x79'))[_0x1bd5('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1bd5('0x6b')]()[_0x1bd5('0x6c')](_0x1bd5('0x66'))['from'](_0x1bd5('0x64'))['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]()))[_0x1bd5('0x39')](_0x1bd5('0x7b'),squel['select']()[_0x1bd5('0x6c')]('calleridnum')[_0x1bd5('0x7a')]('cm_hopper_final')['where'](_0x1bd5('0x82'),_0x7d097[_0x1bd5('0x45')]['id'][_0x1bd5('0x78')]())[_0x1bd5('0x39')]('state\x20=\x204'))[_0x1bd5('0x7d')](_0x1bd5('0x67')))[_0x1bd5('0x78')]();return db[_0x1bd5('0x4d')][_0x1bd5('0x2f')](_0x248d66);}return[];})[_0x1bd5('0x40')](respondWithResult(_0x50f2ac,null))[_0x1bd5('0x48')](handleError(_0x50f2ac,null));};exports[_0x1bd5('0x83')]=function(_0x22e1f4,_0x347d06,_0x3cf023){return db[_0x1bd5('0x84')][_0x1bd5('0x85')]({'where':{'VoiceQueueId':_0x22e1f4[_0x1bd5('0x4a')]['VoiceQueueId'],'CampaignId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x80')],'ContactId':_0x22e1f4[_0x1bd5('0x4a')][_0x1bd5('0x67')]}})[_0x1bd5('0x40')](handleEntityNotFound(_0x347d06,null))[_0x1bd5('0x40')](function(_0x28f567){if(_0x28f567){return _0x28f567;}return null;})[_0x1bd5('0x40')](respondWithResult(_0x347d06,null))[_0x1bd5('0x48')](handleError(_0x347d06,null));}; \ No newline at end of file +var _0x1261=['attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','describe','catch','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','cm_hopper','fromQuery','phone','scheduledAt','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','into','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','CmHopperFinal','model','map','name','keys','query','intersection'];(function(_0x483781,_0x100c20){var _0xf01ee4=function(_0x2af740){while(--_0x2af740){_0x483781['push'](_0x483781['shift']());}};_0xf01ee4(++_0x100c20);}(_0x1261,0x144));var _0x1126=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x1261[_0x166d93];return _0xba708;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['CmHopperFinal'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':!![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['CmHopperFinal']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')]()['then'](respondWithResult(_0x5111d3,null))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports[_0x1126('0x24')]=function(_0x518e0a,_0x3e4eeb){if(_0x518e0a[_0x1126('0x44')][_0x1126('0x45')]){delete _0x518e0a['body'][_0x1126('0x45')];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'uniqueid':_0x518e0a[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x3e4eeb,null))[_0x1126('0x25')](saveUpdates(_0x518e0a[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0x3e4eeb,null))['catch'](handleError(_0x3e4eeb,null));};exports[_0x1126('0x46')]=function(_0x5a2287,_0x40168e,_0x2ad118){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x5a2287[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4a')))),_0x1126('0x4b')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x4e')))),_0x1126('0x4f')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1126('0x50')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1126('0x51')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),_0x1126('0x53')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x40168e,null))[_0x1126('0x25')](respondWithResult(_0x40168e,null))[_0x1126('0x43')](handleError(_0x40168e,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xcc1a95,_0x315386,_0x5e0ea1){return db[_0x1126('0x29')]['findAll']({'raw':![],'where':{'CampaignId':_0xcc1a95[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x1126('0x4b')],[db['sequelize']['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x56')))),_0x1126('0x57')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x4e')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x58')))),'dropContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x59')))),_0x1126('0x51')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x315386,null))[_0x1126('0x25')](respondWithResult(_0x315386,null))[_0x1126('0x43')](handleError(_0x315386,null));};exports[_0x1126('0x5a')]=function(_0x247f12,_0xd20fbe,_0x3d5e15){return db[_0x1126('0x5b')][_0x1126('0x41')]({'where':{'id':_0x247f12[_0x1126('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd20fbe,null))[_0x1126('0x25')](function(_0x274343){var _0x2b61ae;if(_0x274343){_0x2b61ae=squel['insert']()['into'](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),'ContactId','ListId','VoiceQueueId',_0x1126('0x60'),_0x1126('0x61')],squel[_0x1126('0x62')]()[_0x1126('0x63')]('ANY_VALUE(calleridnum)',_0x1126('0x5e'))['field'](_0x1126('0x64'),_0x1126('0x5f'))[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),'ListId')[_0x1126('0x63')]('ANY_VALUE(VoiceQueueId)',_0x1126('0x68'))[_0x1126('0x63')]('NOW()',_0x1126('0x60'))[_0x1126('0x63')]('NOW()',_0x1126('0x61'))[_0x1126('0x69')]('cm_hopper_final')['where'](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())['where']('state\x20=\x20?',_0x247f12['body'][_0x1126('0x6c')]['toString']())['where'](_0x1126('0x6d'))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()['field'](_0x1126('0x5e'))[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12['params']['id'][_0x1126('0x6b')]()))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')](_0x1126('0x71')))[_0x1126('0x72')](_0x1126('0x66')))[_0x1126('0x6b')]();return db[_0x1126('0x47')][_0x1126('0x2e')](_0x2b61ae);}return[];})['then'](respondWithResult(_0xd20fbe,null))[_0x1126('0x43')](handleError(_0xd20fbe,null));};exports[_0x1126('0x73')]=function(_0x33cccf,_0x1483f4,_0x3be5bf){return db['Campaign'][_0x1126('0x41')]({'where':{'id':_0x33cccf['params']['id']}})['then'](handleEntityNotFound(_0x1483f4,null))[_0x1126('0x25')](function(_0x2b1884){var _0x55f366;if(_0x2b1884){_0x55f366=squel['insert']()[_0x1126('0x74')](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),_0x1126('0x66'),_0x1126('0x75'),_0x1126('0x76'),_0x1126('0x60'),'updatedAt'],squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x77'),_0x1126('0x5e'))[_0x1126('0x63')](_0x1126('0x64'),'scheduledAt')[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),_0x1126('0x75'))[_0x1126('0x63')](_0x1126('0x78'),_0x1126('0x76'))[_0x1126('0x63')]('NOW()','createdAt')[_0x1126('0x63')]('NOW()',_0x1126('0x61'))['from'](_0x1126('0x70'))['where'](_0x1126('0x79'),_0x33cccf['params']['id']['toString']())['where'](_0x1126('0x7a'),_0x33cccf[_0x1126('0x44')]['state']['toString']())[_0x1126('0x37')](_0x1126('0x6d'))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x1126('0x63')]('phone')[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id']['toString']()))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')]('state\x20=\x204'))[_0x1126('0x72')]('ContactId'))[_0x1126('0x6b')]();return db['sequelize'][_0x1126('0x2e')](_0x55f366);}return[];})[_0x1126('0x25')](respondWithResult(_0x1483f4,null))[_0x1126('0x43')](handleError(_0x1483f4,null));};exports[_0x1126('0x7b')]=function(_0x59c04b,_0x429183,_0x834360){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x59c04b[_0x1126('0x44')][_0x1126('0x68')],'CampaignId':_0x59c04b[_0x1126('0x44')]['CampaignId'],'ContactId':_0x59c04b[_0x1126('0x44')]['ContactId']}})[_0x1126('0x25')](handleEntityNotFound(_0x429183,null))[_0x1126('0x25')](function(_0x4d6bb2){if(_0x4d6bb2){return _0x4d6bb2;}return null;})[_0x1126('0x25')](respondWithResult(_0x429183,null))[_0x1126('0x43')](handleError(_0x429183,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index f37b8ff..abe494b 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 _0x0859=['exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','api','moment','request-promise','path','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0859,0x68));var _0x9085=function(_0x1803c1,_0x5cce9e){_0x1803c1=_0x1803c1-0x0;var _0x5af456=_0x0859[_0x1803c1];return _0x5af456;};'use strict';var _=require(_0x9085('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9085('0x1'));var moment=require(_0x9085('0x2'));var BPromise=require('bluebird');var rp=require(_0x9085('0x3'));var fs=require('fs');var path=require(_0x9085('0x4'));var rimraf=require('rimraf');var config=require(_0x9085('0x5'));var attributes=require('./cmHopperFinal.attributes');module[_0x9085('0x6')]=function(_0x102821,_0x274e6d){return _0x102821[_0x9085('0x7')](_0x9085('0x8'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x9085('0x9')]},{'name':_0x9085('0xa'),'fields':[_0x9085('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xea17=['util','api','moment','bluebird','request-promise','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x1f324d,_0x2f02b0){var _0x16f21d=function(_0x31f3ca){while(--_0x31f3ca){_0x1f324d['push'](_0x1f324d['shift']());}};_0x16f21d(++_0x2f02b0);}(_0xea17,0x137));var _0x7ea1=function(_0x1cc634,_0x8b5fa0){_0x1cc634=_0x1cc634-0x0;var _0x58c2d6=_0xea17[_0x1cc634];return _0x58c2d6;};'use strict';var _=require(_0x7ea1('0x0'));var util=require(_0x7ea1('0x1'));var logger=require('../../config/logger')(_0x7ea1('0x2'));var moment=require(_0x7ea1('0x3'));var BPromise=require(_0x7ea1('0x4'));var rp=require(_0x7ea1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7ea1('0x6'));var attributes=require(_0x7ea1('0x7'));module[_0x7ea1('0x8')]=function(_0x4d60a9,_0x573bd5){return _0x4d60a9[_0x7ea1('0x9')]('CmHopperFinal',attributes,{'tableName':_0x7ea1('0xa'),'paranoid':![],'indexes':[{'name':_0x7ea1('0xb'),'fields':['calleridnum']},{'name':'uniqueid','fields':[_0x7ea1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 6ea12f9..eb01bf2 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(_0x19e84c,_0x2fea10){var _0x1bd91a=function(_0x5de63e){while(--_0x5de63e){_0x19e84c['push'](_0x19e84c['shift']());}};_0x1bd91a(++_0x2fea10);}(_0x7a54,0x106));var _0x47a5=function(_0x849c3d,_0x514df8){_0x849c3d=_0x849c3d-0x0;var _0x39e80b=_0x7a54[_0x849c3d];return _0x39e80b;};'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 _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(_0xd0fd2e,_0xb2004f){var _0x2698d4=function(_0x20ca3b){while(--_0x20ca3b){_0xd0fd2e['push'](_0xd0fd2e['shift']());}};_0x2698d4(++_0xb2004f);}(_0x7a54,0x106));var _0x47a5=function(_0x10d6e5,_0x436e59){_0x10d6e5=_0x10d6e5-0x0;var _0x1cf492=_0x7a54[_0x10d6e5];return _0x1cf492;};'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 diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 0537179..9f4cc05 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 _0xb90a=['util','connect-timeout','../../config/environment','./cmHopperFinal.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer'];(function(_0x450beb,_0x30d4d0){var _0x160f0c=function(_0xb78cc7){while(--_0xb78cc7){_0x450beb['push'](_0x450beb['shift']());}};_0x160f0c(++_0x30d4d0);}(_0xb90a,0x12a));var _0xab90=function(_0x3db9e0,_0x1068ee){_0x3db9e0=_0x3db9e0-0x0;var _0x528569=_0xb90a[_0x3db9e0];return _0x528569;};'use strict';var multer=require(_0xab90('0x0'));var util=require(_0xab90('0x1'));var path=require('path');var timeout=require(_0xab90('0x2'));var express=require('express');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(_0xab90('0x3'));var controller=require(_0xab90('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xab90('0x5')]);router[_0xab90('0x6')](_0xab90('0x7'),auth['isAuthenticated'](),controller[_0xab90('0x8')]);router[_0xab90('0x6')](_0xab90('0x9'),auth[_0xab90('0xa')](),controller[_0xab90('0xb')]);router[_0xab90('0x6')](_0xab90('0xc'),auth[_0xab90('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xab90('0x6')](_0xab90('0xd'),auth[_0xab90('0xa')](),controller[_0xab90('0xe')]);router[_0xab90('0xf')]('/voice/queue/moveContacts/:id',auth[_0xab90('0xa')](),controller[_0xab90('0x10')]);router[_0xab90('0xf')](_0xab90('0x11'),auth[_0xab90('0xa')](),controller[_0xab90('0x12')]);router[_0xab90('0xf')](_0xab90('0x13'),auth[_0xab90('0xa')](),controller[_0xab90('0x14')]);router[_0xab90('0x15')](_0xab90('0x9'),auth[_0xab90('0xa')](),controller['update']);module[_0xab90('0x16')]=router; \ No newline at end of file +var _0x045b=['update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper'];(function(_0x363ef1,_0x221c4d){var _0xbb8185=function(_0x7de93d){while(--_0x7de93d){_0x363ef1['push'](_0x363ef1['shift']());}};_0xbb8185(++_0x221c4d);}(_0x045b,0x1ab));var _0xb045=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x045b[_0x1147ab];return _0x55cb5a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb045('0x0'));var timeout=require(_0xb045('0x1'));var express=require(_0xb045('0x2'));var router=express[_0xb045('0x3')]();var fs_extra=require(_0xb045('0x4'));var auth=require(_0xb045('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb045('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xb045('0x7')]('/',auth[_0xb045('0x8')](),controller[_0xb045('0x9')]);router[_0xb045('0x7')](_0xb045('0xa'),auth[_0xb045('0x8')](),controller[_0xb045('0xb')]);router[_0xb045('0x7')](_0xb045('0xc'),auth[_0xb045('0x8')](),controller[_0xb045('0xd')]);router[_0xb045('0x7')](_0xb045('0xe'),auth[_0xb045('0x8')](),controller[_0xb045('0xf')]);router['get']('/campaign/countAttributes/:id',auth[_0xb045('0x8')](),controller[_0xb045('0x10')]);router[_0xb045('0x11')](_0xb045('0x12'),auth[_0xb045('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xb045('0x11')](_0xb045('0x13'),auth[_0xb045('0x8')](),controller[_0xb045('0x14')]);router[_0xb045('0x11')](_0xb045('0x15'),auth[_0xb045('0x8')](),controller[_0xb045('0x16')]);router['put']('/:id',auth[_0xb045('0x8')](),controller[_0xb045('0x17')]);module[_0xb045('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 8d65ceb..d682a5f 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 _0xd2d9=['STRING','INTEGER','DATE','BOOLEAN','sequelize'];(function(_0x46f282,_0x300c8b){var _0x5d4ae6=function(_0x4e7cc7){while(--_0x4e7cc7){_0x46f282['push'](_0x46f282['shift']());}};_0x5d4ae6(++_0x300c8b);}(_0xd2d9,0x16c));var _0x9d2d=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0xd2d9[_0x4687df];return _0x32eaef;};'use strict';var Sequelize=require(_0x9d2d('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x9d2d('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x9d2d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9d2d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9d2d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9d2d('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9d2d('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x9d2d('0x1')]},'originatecalleridname':{'type':Sequelize[_0x9d2d('0x1')]},'calleridnum':{'type':Sequelize[_0x9d2d('0x1')]},'calleridname':{'type':Sequelize[_0x9d2d('0x1')]},'starttime':{'type':Sequelize[_0x9d2d('0x3')]},'responsetime':{'type':Sequelize[_0x9d2d('0x3')]},'answertime':{'type':Sequelize[_0x9d2d('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x9d2d('0x3')]},'ringtime':{'type':Sequelize[_0x9d2d('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9d2d('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9d2d('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9d2d('0x1')]},'campaign':{'type':Sequelize[_0x9d2d('0x1')]},'campaigntype':{'type':Sequelize[_0x9d2d('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x9d2d('0x1')]},'amd':{'type':Sequelize[_0x9d2d('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x9d2d('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9d2d('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9d2d('0x3')]},'recallme':{'type':Sequelize[_0x9d2d('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x9d2d('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x9d2d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9d2d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9d2d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9d2d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9d2d('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9d2d('0x1')]}}; \ No newline at end of file +var _0x8b92=['DATE','STRING','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x134781,_0x52a1fd){var _0x5965dc=function(_0x58a80a){while(--_0x58a80a){_0x134781['push'](_0x134781['shift']());}};_0x5965dc(++_0x52a1fd);}(_0x8b92,0x1a1));var _0x28b9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8b92[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x28b9('0x0'));module[_0x28b9('0x1')]={'state':{'type':Sequelize[_0x28b9('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x28b9('0x3')]},'countbusyretry':{'type':Sequelize[_0x28b9('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x28b9('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x28b9('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x28b9('0x4')]},'originatecalleridname':{'type':Sequelize[_0x28b9('0x4')]},'calleridnum':{'type':Sequelize[_0x28b9('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x28b9('0x3')]},'responsetime':{'type':Sequelize[_0x28b9('0x3')]},'answertime':{'type':Sequelize[_0x28b9('0x3')]},'droptime':{'type':Sequelize[_0x28b9('0x3')]},'endtime':{'type':Sequelize[_0x28b9('0x3')]},'ringtime':{'type':Sequelize[_0x28b9('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x28b9('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x28b9('0x4')]},'campaign':{'type':Sequelize[_0x28b9('0x4')]},'campaigntype':{'type':Sequelize[_0x28b9('0x4')]},'membername':{'type':Sequelize[_0x28b9('0x4')]},'reason':{'type':Sequelize[_0x28b9('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x28b9('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x28b9('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x28b9('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x28b9('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x28b9('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x28b9('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x28b9('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x28b9('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 96a7b0a..c704158 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 _0x865f=['util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','then','findAll','rows','show','params','includeAll','include','merge','find','catch','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x507b80,_0x1d915f){var _0x29b4d2=function(_0x12df17){while(--_0x12df17){_0x507b80['push'](_0x507b80['shift']());}};_0x29b4d2(++_0x1d915f);}(_0x865f,0x17b));var _0xf865=function(_0x1ef65d,_0x44d1bc){_0x1ef65d=_0x1ef65d-0x0;var _0x638ab=_0x865f[_0x1ef65d];return _0x638ab;};'use strict';var emlformat=require(_0xf865('0x0'));var rimraf=require(_0xf865('0x1'));var zipdir=require(_0xf865('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf865('0x3'));var BPromise=require(_0xf865('0x4'));var Mustache=require(_0xf865('0x5'));var util=require(_0xf865('0x6'));var path=require(_0xf865('0x7'));var sox=require(_0xf865('0x8'));var csv=require(_0xf865('0x9'));var ejs=require(_0xf865('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf865('0xb'));var squel=require('squel');var crypto=require(_0xf865('0xc'));var jsforce=require(_0xf865('0xd'));var deskjs=require(_0xf865('0xe'));var toCsv=require(_0xf865('0x9'));var querystring=require('querystring');var Papa=require(_0xf865('0xf'));var Redis=require(_0xf865('0x10'));var authService=require(_0xf865('0x11'));var qs=require(_0xf865('0x12'));var as=require(_0xf865('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf865('0x14'))(_0xf865('0x15'));var utils=require('../../config/utils');var config=require(_0xf865('0x16'));var licenseUtil=require(_0xf865('0x17'));var db=require(_0xf865('0x18'))['db'];function respondWithStatusCode(_0x4d5cf9,_0x5cac57){_0x5cac57=_0x5cac57||0xcc;return function(_0x5499ba){if(_0x5499ba){return _0x4d5cf9[_0xf865('0x19')](_0x5cac57);}return _0x4d5cf9['status'](_0x5cac57)[_0xf865('0x1a')]();};}function respondWithResult(_0x275387,_0x5e0284){_0x5e0284=_0x5e0284||0xc8;return function(_0x164f0f){if(_0x164f0f){return _0x275387[_0xf865('0x1b')](_0x5e0284)[_0xf865('0x1c')](_0x164f0f);}};}function respondWithFilteredResult(_0x14d538,_0x120c85){return function(_0x3a5be6){if(_0x3a5be6){var _0x1a4520=typeof _0x120c85[_0xf865('0x1d')]===_0xf865('0x1e')&&typeof _0x120c85[_0xf865('0x1f')]===_0xf865('0x1e');var _0xa48953=_0x3a5be6[_0xf865('0x20')];var _0x5dcc=_0x1a4520?0x0:_0x120c85[_0xf865('0x1d')];var _0x3e14e7=_0x1a4520?_0x3a5be6[_0xf865('0x20')]:_0x120c85[_0xf865('0x1d')]+_0x120c85['limit'];var _0x4301ac;if(_0x3e14e7>=_0xa48953){_0x3e14e7=_0xa48953;_0x4301ac=0xc8;}else{_0x4301ac=0xce;}_0x14d538[_0xf865('0x1b')](_0x4301ac);return _0x14d538[_0xf865('0x21')]('Content-Range',_0x5dcc+'-'+_0x3e14e7+'/'+_0xa48953)['json'](_0x3a5be6);}return null;};}function patchUpdates(_0x2de08e){return function(_0x30d20e){try{jsonpatch[_0xf865('0x22')](_0x30d20e,_0x2de08e,!![]);}catch(_0x9af5d3){return BPromise[_0xf865('0x23')](_0x9af5d3);}return _0x30d20e[_0xf865('0x24')]();};}function saveUpdates(_0x1ed445,_0x42c23c){return function(_0x5eaf0a){if(_0x5eaf0a){return _0x5eaf0a[_0xf865('0x25')](_0x1ed445)['then'](function(_0x4dc3f2){return _0x4dc3f2;});}return null;};}function removeEntity(_0xdb91d9,_0x13a166){return function(_0x507f9a){if(_0x507f9a){return _0x507f9a[_0xf865('0x26')]()['then'](function(){_0xdb91d9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44e48a,_0x2e3275){return function(_0x381b19){if(!_0x381b19){_0x44e48a[_0xf865('0x19')](0x194);}return _0x381b19;};}function handleError(_0x3424f0,_0x598ab1){_0x598ab1=_0x598ab1||0x1f4;return function(_0x2fcf5a){logger['error'](_0x2fcf5a[_0xf865('0x27')]);if(_0x2fcf5a[_0xf865('0x28')]){delete _0x2fcf5a['name'];}_0x3424f0[_0xf865('0x1b')](_0x598ab1)['send'](_0x2fcf5a);};}exports['index']=function(_0xd877c6,_0x370049){var _0x1e83cf={},_0x414107={},_0xc6dc75={'count':0x0,'rows':[]};var _0x4e9ad4=_[_0xf865('0x29')](db[_0xf865('0x2a')][_0xf865('0x2b')],function(_0xada745){return{'name':_0xada745[_0xf865('0x2c')],'type':_0xada745['type'][_0xf865('0x2d')]};});_0x414107[_0xf865('0x2e')]=_['map'](_0x4e9ad4,'name');_0x414107[_0xf865('0x2f')]=_[_0xf865('0x30')](_0xd877c6[_0xf865('0x2f')]);_0x414107[_0xf865('0x31')]=_['intersection'](_0x414107['model'],_0x414107['query']);_0x1e83cf['attributes']=_[_0xf865('0x32')](_0x414107['model'],qs[_0xf865('0x33')](_0xd877c6['query']['fields']));_0x1e83cf[_0xf865('0x34')]=_0x1e83cf[_0xf865('0x34')][_0xf865('0x35')]?_0x1e83cf['attributes']:_0x414107[_0xf865('0x2e')];if(!_0xd877c6[_0xf865('0x2f')][_0xf865('0x36')](_0xf865('0x37'))){_0x1e83cf[_0xf865('0x1f')]=qs[_0xf865('0x1f')](_0xd877c6['query'][_0xf865('0x1f')]);_0x1e83cf['offset']=qs[_0xf865('0x1d')](_0xd877c6[_0xf865('0x2f')][_0xf865('0x1d')]);}_0x1e83cf[_0xf865('0x38')]=qs[_0xf865('0x39')](_0xd877c6['query'][_0xf865('0x39')]);_0x1e83cf[_0xf865('0x3a')]=qs[_0xf865('0x31')](_[_0xf865('0x3b')](_0xd877c6['query'],_0x414107[_0xf865('0x31')]),_0x4e9ad4);if(_0xd877c6[_0xf865('0x2f')]['filter']){_0x1e83cf[_0xf865('0x3a')]=_['merge'](_0x1e83cf[_0xf865('0x3a')],{'$or':_['map'](_0x4e9ad4,function(_0x1e0dfd){if(_0x1e0dfd['type']!==_0xf865('0x3c')){var _0x54d12b={};_0x54d12b[_0x1e0dfd['name']]={'$like':'%'+_0xd877c6['query'][_0xf865('0x3d')]+'%'};return _0x54d12b;}})});}_0x1e83cf=_['merge']({},_0x1e83cf,_0xd877c6[_0xf865('0x3e')]);var _0x15eb12={'where':_0x1e83cf[_0xf865('0x3a')]};return db[_0xf865('0x2a')][_0xf865('0x20')](_0x15eb12)[_0xf865('0x3f')](function(_0x4a2d03){_0xc6dc75[_0xf865('0x20')]=_0x4a2d03;if(_0xd877c6['query']['includeAll']){_0x1e83cf['include']=[{'all':!![]}];}return db[_0xf865('0x2a')][_0xf865('0x40')](_0x1e83cf);})[_0xf865('0x3f')](function(_0xd321a8){_0xc6dc75[_0xf865('0x41')]=_0xd321a8;return _0xc6dc75;})[_0xf865('0x3f')](respondWithFilteredResult(_0x370049,_0x1e83cf))['catch'](handleError(_0x370049,null));};exports[_0xf865('0x42')]=function(_0x41732e,_0x2fff43){var _0xcd3ac6={'raw':!![],'where':{'id':_0x41732e[_0xf865('0x43')]['id']}},_0x33975b={};_0x33975b[_0xf865('0x2e')]=_[_0xf865('0x30')](db['CmHopperHistory'][_0xf865('0x2b')]);_0x33975b['query']=_['keys'](_0x41732e['query']);_0x33975b[_0xf865('0x31')]=_[_0xf865('0x32')](_0x33975b[_0xf865('0x2e')],_0x33975b['query']);_0xcd3ac6[_0xf865('0x34')]=_['intersection'](_0x33975b[_0xf865('0x2e')],qs[_0xf865('0x33')](_0x41732e[_0xf865('0x2f')][_0xf865('0x33')]));_0xcd3ac6[_0xf865('0x34')]=_0xcd3ac6[_0xf865('0x34')][_0xf865('0x35')]?_0xcd3ac6[_0xf865('0x34')]:_0x33975b[_0xf865('0x2e')];if(_0x41732e[_0xf865('0x2f')][_0xf865('0x44')]){_0xcd3ac6[_0xf865('0x45')]=[{'all':!![]}];}_0xcd3ac6=_[_0xf865('0x46')]({},_0xcd3ac6,_0x41732e['options']);return db[_0xf865('0x2a')][_0xf865('0x47')](_0xcd3ac6)[_0xf865('0x3f')](handleEntityNotFound(_0x2fff43,null))[_0xf865('0x3f')](respondWithResult(_0x2fff43,null))[_0xf865('0x48')](handleError(_0x2fff43,null));};exports['create']=function(_0x22f8c0,_0x583da0){return db[_0xf865('0x2a')][_0xf865('0x49')](_0x22f8c0[_0xf865('0x4a')],{})[_0xf865('0x3f')](respondWithResult(_0x583da0,0xc9))['catch'](handleError(_0x583da0,null));};exports[_0xf865('0x4b')]=function(_0x193eec,_0x55a031){return db[_0xf865('0x2a')][_0xf865('0x4b')]()[_0xf865('0x3f')](respondWithResult(_0x55a031,null))['catch'](handleError(_0x55a031,null));};exports[_0xf865('0x25')]=function(_0xddd814,_0x13abcb){if(_0xddd814[_0xf865('0x4a')][_0xf865('0x4c')]){delete _0xddd814[_0xf865('0x4a')]['uniqueid'];}return db[_0xf865('0x2a')][_0xf865('0x47')]({'where':{'uniqueid':_0xddd814[_0xf865('0x43')]['id']}})[_0xf865('0x3f')](handleEntityNotFound(_0x13abcb,null))['then'](saveUpdates(_0xddd814[_0xf865('0x4a')],null))[_0xf865('0x3f')](respondWithResult(_0x13abcb,null))['catch'](handleError(_0x13abcb,null));}; \ No newline at end of file +var _0x82e2=['set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','CmHopperHistory','includeAll','include','findAll','catch','show','params','keys','create','body','describe','uniqueid','find','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count'];(function(_0x44666f,_0x4607da){var _0x12f4b6=function(_0x252785){while(--_0x252785){_0x44666f['push'](_0x44666f['shift']());}};_0x12f4b6(++_0x4607da);}(_0x82e2,0x78));var _0x282e=function(_0x4fc4e7,_0x16bfc4){_0x4fc4e7=_0x4fc4e7-0x0;var _0x297133=_0x82e2[_0x4fc4e7];return _0x297133;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x282e('0x0'));var zipdir=require(_0x282e('0x1'));var jsonpatch=require(_0x282e('0x2'));var rp=require(_0x282e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x282e('0x4'));var util=require('util');var path=require(_0x282e('0x5'));var sox=require(_0x282e('0x6'));var csv=require(_0x282e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x282e('0x8'));var _=require(_0x282e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x282e('0xa'));var toCsv=require(_0x282e('0x7'));var querystring=require('querystring');var Papa=require(_0x282e('0xb'));var Redis=require(_0x282e('0xc'));var authService=require(_0x282e('0xd'));var qs=require(_0x282e('0xe'));var as=require(_0x282e('0xf'));var hardwareService=require(_0x282e('0x10'));var logger=require('../../config/logger')(_0x282e('0x11'));var utils=require(_0x282e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x282e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4268dc,_0x59483d){_0x59483d=_0x59483d||0xcc;return function(_0x46ec52){if(_0x46ec52){return _0x4268dc[_0x282e('0x14')](_0x59483d);}return _0x4268dc['status'](_0x59483d)['end']();};}function respondWithResult(_0x2feda4,_0x2ac536){_0x2ac536=_0x2ac536||0xc8;return function(_0x16aa15){if(_0x16aa15){return _0x2feda4[_0x282e('0x15')](_0x2ac536)[_0x282e('0x16')](_0x16aa15);}};}function respondWithFilteredResult(_0x1b2579,_0x16e3f9){return function(_0x4fb9d3){if(_0x4fb9d3){var _0x4c4160=typeof _0x16e3f9[_0x282e('0x17')]===_0x282e('0x18')&&typeof _0x16e3f9['limit']===_0x282e('0x18');var _0x54bd68=_0x4fb9d3['count'];var _0x5bc33d=_0x4c4160?0x0:_0x16e3f9[_0x282e('0x17')];var _0x53d1f5=_0x4c4160?_0x4fb9d3[_0x282e('0x19')]:_0x16e3f9[_0x282e('0x17')]+_0x16e3f9['limit'];var _0x4a81be;if(_0x53d1f5>=_0x54bd68){_0x53d1f5=_0x54bd68;_0x4a81be=0xc8;}else{_0x4a81be=0xce;}_0x1b2579[_0x282e('0x15')](_0x4a81be);return _0x1b2579[_0x282e('0x1a')](_0x282e('0x1b'),_0x5bc33d+'-'+_0x53d1f5+'/'+_0x54bd68)[_0x282e('0x16')](_0x4fb9d3);}return null;};}function patchUpdates(_0x3d3269){return function(_0x23bd38){try{jsonpatch[_0x282e('0x1c')](_0x23bd38,_0x3d3269,!![]);}catch(_0x34464c){return BPromise[_0x282e('0x1d')](_0x34464c);}return _0x23bd38[_0x282e('0x1e')]();};}function saveUpdates(_0x409fcd,_0x544def){return function(_0x1afe83){if(_0x1afe83){return _0x1afe83[_0x282e('0x1f')](_0x409fcd)[_0x282e('0x20')](function(_0xad1f41){return _0xad1f41;});}return null;};}function removeEntity(_0x4d6dec,_0x20a64e){return function(_0x162a54){if(_0x162a54){return _0x162a54['destroy']()[_0x282e('0x20')](function(){_0x4d6dec[_0x282e('0x15')](0xcc)[_0x282e('0x21')]();});}};}function handleEntityNotFound(_0x1aa48d,_0x29f267){return function(_0x11af72){if(!_0x11af72){_0x1aa48d[_0x282e('0x14')](0x194);}return _0x11af72;};}function handleError(_0x456009,_0x995d04){_0x995d04=_0x995d04||0x1f4;return function(_0xd50f15){logger[_0x282e('0x22')](_0xd50f15[_0x282e('0x23')]);if(_0xd50f15[_0x282e('0x24')]){delete _0xd50f15['name'];}_0x456009[_0x282e('0x15')](_0x995d04)[_0x282e('0x25')](_0xd50f15);};}exports[_0x282e('0x26')]=function(_0x250438,_0x4c8e58){var _0x581d41={},_0x22bb84={},_0x3e2acc={'count':0x0,'rows':[]};var _0x93b7d7=_[_0x282e('0x27')](db['CmHopperHistory'][_0x282e('0x28')],function(_0x600efd){return{'name':_0x600efd[_0x282e('0x29')],'type':_0x600efd[_0x282e('0x2a')][_0x282e('0x2b')]};});_0x22bb84[_0x282e('0x2c')]=_[_0x282e('0x27')](_0x93b7d7,'name');_0x22bb84[_0x282e('0x2d')]=_['keys'](_0x250438[_0x282e('0x2d')]);_0x22bb84[_0x282e('0x2e')]=_[_0x282e('0x2f')](_0x22bb84[_0x282e('0x2c')],_0x22bb84[_0x282e('0x2d')]);_0x581d41[_0x282e('0x30')]=_[_0x282e('0x2f')](_0x22bb84[_0x282e('0x2c')],qs['fields'](_0x250438[_0x282e('0x2d')]['fields']));_0x581d41[_0x282e('0x30')]=_0x581d41['attributes']['length']?_0x581d41[_0x282e('0x30')]:_0x22bb84['model'];if(!_0x250438[_0x282e('0x2d')][_0x282e('0x31')](_0x282e('0x32'))){_0x581d41[_0x282e('0x33')]=qs['limit'](_0x250438[_0x282e('0x2d')][_0x282e('0x33')]);_0x581d41[_0x282e('0x17')]=qs['offset'](_0x250438['query'][_0x282e('0x17')]);}_0x581d41[_0x282e('0x34')]=qs[_0x282e('0x35')](_0x250438[_0x282e('0x2d')][_0x282e('0x35')]);_0x581d41[_0x282e('0x36')]=qs['filters'](_[_0x282e('0x37')](_0x250438['query'],_0x22bb84[_0x282e('0x2e')]),_0x93b7d7);if(_0x250438[_0x282e('0x2d')][_0x282e('0x38')]){_0x581d41['where']=_['merge'](_0x581d41[_0x282e('0x36')],{'$or':_[_0x282e('0x27')](_0x93b7d7,function(_0x4f456e){if(_0x4f456e[_0x282e('0x2a')]!==_0x282e('0x39')){var _0x5d1166={};_0x5d1166[_0x4f456e['name']]={'$like':'%'+_0x250438[_0x282e('0x2d')]['filter']+'%'};return _0x5d1166;}})});}_0x581d41=_[_0x282e('0x3a')]({},_0x581d41,_0x250438[_0x282e('0x3b')]);var _0x13b00a={'where':_0x581d41[_0x282e('0x36')]};return db[_0x282e('0x3c')][_0x282e('0x19')](_0x13b00a)[_0x282e('0x20')](function(_0x2ac438){_0x3e2acc[_0x282e('0x19')]=_0x2ac438;if(_0x250438[_0x282e('0x2d')][_0x282e('0x3d')]){_0x581d41[_0x282e('0x3e')]=[{'all':!![]}];}return db[_0x282e('0x3c')][_0x282e('0x3f')](_0x581d41);})['then'](function(_0x320b97){_0x3e2acc['rows']=_0x320b97;return _0x3e2acc;})['then'](respondWithFilteredResult(_0x4c8e58,_0x581d41))[_0x282e('0x40')](handleError(_0x4c8e58,null));};exports[_0x282e('0x41')]=function(_0x4843a3,_0x38ff87){var _0x295125={'raw':!![],'where':{'id':_0x4843a3[_0x282e('0x42')]['id']}},_0x3d927f={};_0x3d927f[_0x282e('0x2c')]=_[_0x282e('0x43')](db[_0x282e('0x3c')][_0x282e('0x28')]);_0x3d927f[_0x282e('0x2d')]=_['keys'](_0x4843a3[_0x282e('0x2d')]);_0x3d927f[_0x282e('0x2e')]=_[_0x282e('0x2f')](_0x3d927f[_0x282e('0x2c')],_0x3d927f[_0x282e('0x2d')]);_0x295125['attributes']=_[_0x282e('0x2f')](_0x3d927f[_0x282e('0x2c')],qs['fields'](_0x4843a3[_0x282e('0x2d')]['fields']));_0x295125[_0x282e('0x30')]=_0x295125[_0x282e('0x30')]['length']?_0x295125[_0x282e('0x30')]:_0x3d927f[_0x282e('0x2c')];if(_0x4843a3[_0x282e('0x2d')][_0x282e('0x3d')]){_0x295125[_0x282e('0x3e')]=[{'all':!![]}];}_0x295125=_[_0x282e('0x3a')]({},_0x295125,_0x4843a3[_0x282e('0x3b')]);return db[_0x282e('0x3c')]['find'](_0x295125)['then'](handleEntityNotFound(_0x38ff87,null))[_0x282e('0x20')](respondWithResult(_0x38ff87,null))[_0x282e('0x40')](handleError(_0x38ff87,null));};exports[_0x282e('0x44')]=function(_0x3ab2b7,_0x44f13d){return db[_0x282e('0x3c')][_0x282e('0x44')](_0x3ab2b7[_0x282e('0x45')],{})[_0x282e('0x20')](respondWithResult(_0x44f13d,0xc9))[_0x282e('0x40')](handleError(_0x44f13d,null));};exports[_0x282e('0x46')]=function(_0x411140,_0x501524){return db[_0x282e('0x3c')][_0x282e('0x46')]()[_0x282e('0x20')](respondWithResult(_0x501524,null))[_0x282e('0x40')](handleError(_0x501524,null));};exports['update']=function(_0x3ca93e,_0x1b3fe3){if(_0x3ca93e['body'][_0x282e('0x47')]){delete _0x3ca93e[_0x282e('0x45')][_0x282e('0x47')];}return db[_0x282e('0x3c')][_0x282e('0x48')]({'where':{'uniqueid':_0x3ca93e[_0x282e('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b3fe3,null))[_0x282e('0x20')](saveUpdates(_0x3ca93e[_0x282e('0x45')],null))[_0x282e('0x20')](respondWithResult(_0x1b3fe3,null))[_0x282e('0x40')](handleError(_0x1b3fe3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index ed5dbf3..6a1dfa2 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 _0xedf1=['request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','moment','bluebird'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0xedf1,0xb2));var _0x1edf=function(_0x557fa5,_0x3b954b){_0x557fa5=_0x557fa5-0x0;var _0x4c003c=_0xedf1[_0x557fa5];return _0x4c003c;};'use strict';var _=require(_0x1edf('0x0'));var util=require(_0x1edf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1edf('0x2'));var BPromise=require(_0x1edf('0x3'));var rp=require(_0x1edf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1edf('0x5'));var config=require(_0x1edf('0x6'));var attributes=require(_0x1edf('0x7'));module['exports']=function(_0x52238d,_0x1b84af){return _0x52238d[_0x1edf('0x8')](_0x1edf('0x9'),attributes,{'tableName':_0x1edf('0xa'),'paranoid':![],'indexes':[{'name':_0x1edf('0xb'),'fields':[_0x1edf('0xb')]},{'name':_0x1edf('0xc'),'fields':[_0x1edf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x457b=['./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x300d13,_0x412659){var _0x39541d=function(_0x4dd523){while(--_0x4dd523){_0x300d13['push'](_0x300d13['shift']());}};_0x39541d(++_0x412659);}(_0x457b,0xca));var _0xb457=function(_0xe850e8,_0x3f0e95){_0xe850e8=_0xe850e8-0x0;var _0x2532ac=_0x457b[_0xe850e8];return _0x2532ac;};'use strict';var _=require(_0xb457('0x0'));var util=require(_0xb457('0x1'));var logger=require('../../config/logger')(_0xb457('0x2'));var moment=require(_0xb457('0x3'));var BPromise=require(_0xb457('0x4'));var rp=require(_0xb457('0x5'));var fs=require('fs');var path=require(_0xb457('0x6'));var rimraf=require('rimraf');var config=require(_0xb457('0x7'));var attributes=require(_0xb457('0x8'));module[_0xb457('0x9')]=function(_0x3823c7,_0x3cefc3){return _0x3823c7['define'](_0xb457('0xa'),attributes,{'tableName':_0xb457('0xb'),'paranoid':![],'indexes':[{'name':_0xb457('0xc'),'fields':['endtime']},{'name':'uniqueid','fields':[_0xb457('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index da12bd4..a1b757c 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 _0xca7b=['bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','findAll','where','sequelize','COUNT','col','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','moment'];(function(_0x353879,_0x31e2d4){var _0x45949f=function(_0x3367a0){while(--_0x3367a0){_0x353879['push'](_0x353879['shift']());}};_0x45949f(++_0x31e2d4);}(_0xca7b,0x14e));var _0xbca7=function(_0x29717d,_0x1260c8){_0x29717d=_0x29717d-0x0;var _0x45b150=_0xca7b[_0x29717d];return _0x45b150;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbca7('0x0'));var BPromise=require(_0xbca7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbca7('0x2'));var db=require(_0xbca7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbca7('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbca7('0x5'));var client=jayson['client'][_0xbca7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x53e0e6,_0x1dc1a8,_0x140a73){return new BPromise(function(_0x438f99,_0x2ae5d4){return client[_0xbca7('0x7')](_0x53e0e6,_0x140a73)[_0xbca7('0x8')](function(_0x491b64){logger[_0xbca7('0x9')](_0xbca7('0xa'),_0x1dc1a8,_0xbca7('0xb'));logger[_0xbca7('0xc')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x1dc1a8,_0xbca7('0xb'),JSON[_0xbca7('0xd')](_0x491b64));if(_0x491b64['error']){if(_0x491b64[_0xbca7('0xe')][_0xbca7('0xf')]===0x1f4){logger[_0xbca7('0xe')](_0xbca7('0xa'),_0x1dc1a8,_0x491b64[_0xbca7('0xe')][_0xbca7('0x10')]);return _0x2ae5d4(_0x491b64[_0xbca7('0xe')]['message']);}logger[_0xbca7('0xe')](_0xbca7('0xa'),_0x1dc1a8,_0x491b64['error'][_0xbca7('0x10')]);return _0x438f99(_0x491b64[_0xbca7('0xe')]['message']);}else{logger[_0xbca7('0x9')]('CmHopperHistory,\x20%s,\x20%s',_0x1dc1a8,_0xbca7('0xb'));_0x438f99(_0x491b64[_0xbca7('0x11')]['message']);}})[_0xbca7('0x12')](function(_0x40d273){logger[_0xbca7('0xe')](_0xbca7('0xa'),_0x1dc1a8,_0x40d273);_0x2ae5d4(_0x40d273);});});}exports[_0xbca7('0x13')]=function(_0x454cdd){var _0x9541e6=this;return new Promise(function(_0x30f973,_0x45d256){return db[_0xbca7('0x14')][_0xbca7('0x15')](_0x454cdd[_0xbca7('0x16')],{'raw':_0x454cdd[_0xbca7('0x17')]?_0x454cdd[_0xbca7('0x17')][_0xbca7('0x18')]===undefined?!![]:![]:!![]})[_0xbca7('0x8')](function(_0x26ee70){logger['info'](_0xbca7('0x13'),_0x454cdd);logger[_0xbca7('0xc')](_0xbca7('0x13'),_0x454cdd,JSON[_0xbca7('0xd')](_0x26ee70));_0x30f973(_0x26ee70);})[_0xbca7('0x12')](function(_0x37eca2){logger[_0xbca7('0xe')](_0xbca7('0x13'),_0x37eca2[_0xbca7('0x10')],_0x454cdd);_0x45d256(_0x9541e6['error'](0x1f4,_0x37eca2[_0xbca7('0x10')]));});});};exports['AvgHandleTime']=function(_0x4650d2){var _0x2f2833=this;return new Promise(function(_0x27e78d,_0x409380){return db['CmHopperHistory'][_0xbca7('0x19')]({'raw':_0x4650d2[_0xbca7('0x17')]?_0x4650d2[_0xbca7('0x17')][_0xbca7('0x18')]===undefined?!![]:![]:!![],'where':_0x4650d2[_0xbca7('0x17')]?_0x4650d2[_0xbca7('0x17')][_0xbca7('0x1a')]||null:null,'attributes':[[db[_0xbca7('0x1b')]['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')][_0xbca7('0x1d')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xbca7('0x1e')],[db[_0xbca7('0x1b')]['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')][_0xbca7('0x1f')](_0xbca7('0x20')))),_0xbca7('0x21')],[db['sequelize']['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')]['literal'](_0xbca7('0x22')))),_0xbca7('0x23')],[db[_0xbca7('0x1b')]['fn'](_0xbca7('0x24'),db[_0xbca7('0x1b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xbca7('0x25')],[db['sequelize']['fn'](_0xbca7('0x24'),db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')][_0xbca7('0x1f')](_0xbca7('0x26')))),'predictiveIntervalAvgTalktime']]})[_0xbca7('0x8')](function(_0x47928d){logger[_0xbca7('0x9')]('AvgHandleTime',_0x4650d2);logger[_0xbca7('0xc')](_0xbca7('0x27'),_0x4650d2,JSON[_0xbca7('0xd')](_0x47928d));_0x27e78d(_0x47928d);})[_0xbca7('0x12')](function(_0x54cedb){logger[_0xbca7('0xe')](_0xbca7('0x27'),_0x54cedb[_0xbca7('0x10')],_0x4650d2);_0x409380(_0x2f2833[_0xbca7('0xe')](0x1f4,_0x54cedb['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4dcf38){var _0x68e863=this;return new Promise(function(_0x158028,_0x215edf){return db[_0xbca7('0x14')][_0xbca7('0x19')]({'raw':_0x4dcf38[_0xbca7('0x17')]?_0x4dcf38[_0xbca7('0x17')][_0xbca7('0x18')]===undefined?!![]:![]:!![],'where':_0x4dcf38[_0xbca7('0x17')]?_0x4dcf38['options']['where']||null:null,'attributes':[['campaign','name'],[db[_0xbca7('0x1b')]['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')][_0xbca7('0x1f')]('`state`\x20=\x200,\x201,\x20null'))),_0xbca7('0x28')],[db[_0xbca7('0x1b')]['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')]['literal'](_0xbca7('0x29')))),'outboundNoAnswerCallsDay'],[db[_0xbca7('0x1b')]['fn']('COUNT',db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')]['literal'](_0xbca7('0x2a')))),_0xbca7('0x2b')],[db[_0xbca7('0x1b')]['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db['sequelize'][_0xbca7('0x1f')](_0xbca7('0x2c')))),_0xbca7('0x2d')],[db[_0xbca7('0x1b')]['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db['sequelize']['literal'](_0xbca7('0x2e')))),_0xbca7('0x2f')],[db[_0xbca7('0x1b')]['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')][_0xbca7('0x1f')](_0xbca7('0x30')))),_0xbca7('0x31')],[db[_0xbca7('0x1b')]['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')][_0xbca7('0x1f')](_0xbca7('0x32')))),_0xbca7('0x33')],[db[_0xbca7('0x1b')]['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')][_0xbca7('0x1f')](_0xbca7('0x34')))),_0xbca7('0x35')],[db['sequelize']['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')][_0xbca7('0x1f')](_0xbca7('0x36')))),_0xbca7('0x37')],[db[_0xbca7('0x1b')]['fn']('COUNT',db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')][_0xbca7('0x1f')](_0xbca7('0x38')))),_0xbca7('0x39')],[db['sequelize']['fn']('COUNT',db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')][_0xbca7('0x1f')](_0xbca7('0x3a')))),_0xbca7('0x3b')],[db[_0xbca7('0x1b')]['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')]['literal'](_0xbca7('0x3c')))),_0xbca7('0x3d')],[db['sequelize']['fn'](_0xbca7('0x1c'),db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')][_0xbca7('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),_0xbca7('0x3b')],[db[_0xbca7('0x1b')]['fn']('COUNT',db[_0xbca7('0x1b')]['fn']('IF',db[_0xbca7('0x1b')][_0xbca7('0x1f')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0xbca7('0x3e')]})[_0xbca7('0x8')](function(_0x2d29a0){logger[_0xbca7('0x9')](_0xbca7('0x3f'),_0x4dcf38);logger[_0xbca7('0xc')](_0xbca7('0x3f'),_0x4dcf38,JSON[_0xbca7('0xd')](_0x2d29a0));_0x158028(_0x2d29a0);})[_0xbca7('0x12')](function(_0x5f0ab0){logger['error'](_0xbca7('0x3f'),_0x5f0ab0[_0xbca7('0x10')],_0x4dcf38);_0x215edf(_0x68e863[_0xbca7('0xe')](0x1f4,_0x5f0ab0[_0xbca7('0x10')]));});});};exports[_0xbca7('0x40')]=function(_0x2e120e){var _0x3aa813=this;return new Promise(function(_0xf81929,_0x320e14){return db[_0xbca7('0x14')]['findAll']({'raw':_0x2e120e[_0xbca7('0x17')]?_0x2e120e[_0xbca7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2e120e[_0xbca7('0x17')]?_0x2e120e[_0xbca7('0x17')][_0xbca7('0x1a')]||null:null,'attributes':[['campaign','name'],[db[_0xbca7('0x1b')]['fn']('COUNT',db[_0xbca7('0x1b')]['col']('id')),_0xbca7('0x41')],[db[_0xbca7('0x1b')]['fn'](_0xbca7('0x1c'),db['sequelize']['fn']('IF',db[_0xbca7('0x1b')][_0xbca7('0x1f')](_0xbca7('0x2a')))),_0xbca7('0x42')]],'group':[_0xbca7('0x3e')]})[_0xbca7('0x8')](function(_0x3a7089){logger['info'](_0xbca7('0x40'),_0x2e120e);logger['debug'](_0xbca7('0x40'),_0x2e120e,JSON['stringify'](_0x3a7089));_0xf81929(_0x3a7089);})[_0xbca7('0x12')](function(_0x34d80a){logger[_0xbca7('0xe')](_0xbca7('0x40'),_0x34d80a[_0xbca7('0x10')],_0x2e120e);_0x320e14(_0x3aa813[_0xbca7('0xe')](0x1f4,_0x34d80a[_0xbca7('0x10')]));});});}; \ No newline at end of file +var _0x95c5=['options','raw','stringify','AvgHandleTime','where','sequelize','COUNT','col','literal','`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','catch','campaign','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','findAll','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','body'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x95c5,0x153));var _0x595c=function(_0x29771f,_0x1189ae){_0x29771f=_0x29771f-0x0;var _0x279baf=_0x95c5[_0x29771f];return _0x279baf;};'use strict';var _=require(_0x595c('0x0'));var util=require(_0x595c('0x1'));var moment=require('moment');var BPromise=require(_0x595c('0x2'));var rs=require(_0x595c('0x3'));var fs=require('fs');var Redis=require(_0x595c('0x4'));var db=require(_0x595c('0x5'))['db'];var utils=require(_0x595c('0x6'));var logger=require(_0x595c('0x7'))(_0x595c('0x8'));var config=require(_0x595c('0x9'));var jayson=require(_0x595c('0xa'));var client=jayson[_0x595c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49a115,_0xc9f937,_0xfcaf47){return new BPromise(function(_0x218eca,_0x3b55ad){return client[_0x595c('0xc')](_0x49a115,_0xfcaf47)[_0x595c('0xd')](function(_0x1250e7){logger[_0x595c('0xe')](_0x595c('0xf'),_0xc9f937,'request\x20sent');logger[_0x595c('0x10')](_0x595c('0x11'),_0xc9f937,_0x595c('0x12'),JSON['stringify'](_0x1250e7));if(_0x1250e7[_0x595c('0x13')]){if(_0x1250e7[_0x595c('0x13')][_0x595c('0x14')]===0x1f4){logger[_0x595c('0x13')](_0x595c('0xf'),_0xc9f937,_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);return _0x3b55ad(_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);}logger[_0x595c('0x13')](_0x595c('0xf'),_0xc9f937,_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);return _0x218eca(_0x1250e7[_0x595c('0x13')]['message']);}else{logger[_0x595c('0xe')](_0x595c('0xf'),_0xc9f937,_0x595c('0x12'));_0x218eca(_0x1250e7[_0x595c('0x16')]['message']);}})['catch'](function(_0x3a2a04){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xc9f937,_0x3a2a04);_0x3b55ad(_0x3a2a04);});});}exports[_0x595c('0x17')]=function(_0xe45721){var _0xe7cf1e=this;return new Promise(function(_0x4f9936,_0x66c9fb){return db[_0x595c('0x18')]['create'](_0xe45721[_0x595c('0x19')],{'raw':_0xe45721[_0x595c('0x1a')]?_0xe45721[_0x595c('0x1a')][_0x595c('0x1b')]===undefined?!![]:![]:!![]})[_0x595c('0xd')](function(_0x3195b8){logger[_0x595c('0xe')](_0x595c('0x17'),_0xe45721);logger[_0x595c('0x10')]('CreateCmHopperHistory',_0xe45721,JSON[_0x595c('0x1c')](_0x3195b8));_0x4f9936(_0x3195b8);})['catch'](function(_0x378eaf){logger[_0x595c('0x13')](_0x595c('0x17'),_0x378eaf[_0x595c('0x15')],_0xe45721);_0x66c9fb(_0xe7cf1e[_0x595c('0x13')](0x1f4,_0x378eaf[_0x595c('0x15')]));});});};exports[_0x595c('0x1d')]=function(_0x1eb0ff){var _0x53ed36=this;return new Promise(function(_0x458cb6,_0x58178e){return db[_0x595c('0x18')]['findAll']({'raw':_0x1eb0ff[_0x595c('0x1a')]?_0x1eb0ff[_0x595c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1eb0ff[_0x595c('0x1a')]?_0x1eb0ff[_0x595c('0x1a')][_0x595c('0x1e')]||null:null,'attributes':[[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')][_0x595c('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x595c('0x1f')]['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x23')))),_0x595c('0x24')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x595c('0x25')))),_0x595c('0x26')],[db[_0x595c('0x1f')]['fn']('AVG',db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x27')))),_0x595c('0x28')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x29'),db['sequelize']['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x2a')))),'predictiveIntervalAvgTalktime']]})[_0x595c('0xd')](function(_0x432ea4){logger['info']('AvgHandleTime',_0x1eb0ff);logger[_0x595c('0x10')](_0x595c('0x1d'),_0x1eb0ff,JSON[_0x595c('0x1c')](_0x432ea4));_0x458cb6(_0x432ea4);})[_0x595c('0x2b')](function(_0x34bc34){logger[_0x595c('0x13')]('AvgHandleTime',_0x34bc34[_0x595c('0x15')],_0x1eb0ff);_0x58178e(_0x53ed36[_0x595c('0x13')](0x1f4,_0x34bc34['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x36af22){var _0x32dae5=this;return new Promise(function(_0x10571c,_0x2be239){return db[_0x595c('0x18')]['findAll']({'raw':_0x36af22[_0x595c('0x1a')]?_0x36af22[_0x595c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x36af22[_0x595c('0x1a')]?_0x36af22['options'][_0x595c('0x1e')]||null:null,'attributes':[[_0x595c('0x2c'),'name'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')]('`state`\x20=\x200,\x201,\x20null'))),_0x595c('0x2d')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x595c('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x2f')))),_0x595c('0x30')],[db['sequelize']['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x31')))),_0x595c('0x32')],[db['sequelize']['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')](_0x595c('0x33')))),_0x595c('0x34')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x595c('0x35')))),_0x595c('0x36')],[db[_0x595c('0x1f')]['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x595c('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db['sequelize']['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x38')))),'outboundUnknownCallsDay'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db['sequelize']['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x595c('0x39')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')](_0x595c('0x3a')))),_0x595c('0x3b')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x3c')))),_0x595c('0x3d')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x3e')))),_0x595c('0x3f')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x40')))),_0x595c('0x3d')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x41')))),_0x595c('0x42')]],'group':[_0x595c('0x2c')]})['then'](function(_0x35a292){logger[_0x595c('0xe')]('GetVoiceQueueHopperHistory',_0x36af22);logger[_0x595c('0x10')]('GetVoiceQueueHopperHistory',_0x36af22,JSON['stringify'](_0x35a292));_0x10571c(_0x35a292);})[_0x595c('0x2b')](function(_0x1d1b03){logger[_0x595c('0x13')](_0x595c('0x43'),_0x1d1b03[_0x595c('0x15')],_0x36af22);_0x2be239(_0x32dae5[_0x595c('0x13')](0x1f4,_0x1d1b03['message']));});});};exports[_0x595c('0x44')]=function(_0x23597a){var _0x92d2dd=this;return new Promise(function(_0x554960,_0x2b8243){return db['CmHopperHistory'][_0x595c('0x45')]({'raw':_0x23597a[_0x595c('0x1a')]?_0x23597a[_0x595c('0x1a')][_0x595c('0x1b')]===undefined?!![]:![]:!![],'where':_0x23597a[_0x595c('0x1a')]?_0x23597a[_0x595c('0x1a')]['where']||null:null,'attributes':[[_0x595c('0x2c'),_0x595c('0x46')],[db['sequelize']['fn'](_0x595c('0x20'),db[_0x595c('0x1f')][_0x595c('0x21')]('id')),_0x595c('0x47')],[db['sequelize']['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x2f')))),_0x595c('0x48')]],'group':[_0x595c('0x2c')]})[_0x595c('0xd')](function(_0x569f8b){logger[_0x595c('0xe')](_0x595c('0x44'),_0x23597a);logger['debug'](_0x595c('0x44'),_0x23597a,JSON['stringify'](_0x569f8b));_0x554960(_0x569f8b);})[_0x595c('0x2b')](function(_0x5272d4){logger[_0x595c('0x13')](_0x595c('0x44'),_0x5272d4['message'],_0x23597a);_0x2b8243(_0x92d2dd[_0x595c('0x13')](0x1f4,_0x5272d4[_0x595c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 7886eb9..330919d 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 _0xf6ce=['fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','isAuthenticated','describe','/:id','post','put','update','exports','multer','util','connect-timeout','Router'];(function(_0x500157,_0x256708){var _0x574598=function(_0x2a9f46){while(--_0x2a9f46){_0x500157['push'](_0x500157['shift']());}};_0x574598(++_0x256708);}(_0xf6ce,0x176));var _0xef6c=function(_0x31ce5f,_0x21296e){_0x31ce5f=_0x31ce5f-0x0;var _0x2779a8=_0xf6ce[_0x31ce5f];return _0x2779a8;};'use strict';var multer=require(_0xef6c('0x0'));var util=require(_0xef6c('0x1'));var path=require('path');var timeout=require(_0xef6c('0x2'));var express=require('express');var router=express[_0xef6c('0x3')]();var fs_extra=require(_0xef6c('0x4'));var auth=require(_0xef6c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xef6c('0x6'));var controller=require(_0xef6c('0x7'));router[_0xef6c('0x8')]('/',auth['isAuthenticated'](),controller[_0xef6c('0x9')]);router[_0xef6c('0x8')](_0xef6c('0xa'),auth[_0xef6c('0xb')](),controller[_0xef6c('0xc')]);router[_0xef6c('0x8')](_0xef6c('0xd'),auth[_0xef6c('0xb')](),controller['show']);router[_0xef6c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xef6c('0xf')](_0xef6c('0xd'),auth[_0xef6c('0xb')](),controller[_0xef6c('0x10')]);module[_0xef6c('0x11')]=router; \ No newline at end of file +var _0xf56a=['post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x1b3a14,_0x56fc93){var _0xc2542f=function(_0x2e9913){while(--_0x2e9913){_0x1b3a14['push'](_0x1b3a14['shift']());}};_0xc2542f(++_0x56fc93);}(_0xf56a,0x130));var _0xaf56=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xf56a[_0x18b5e8];return _0x25baed;};'use strict';var multer=require(_0xaf56('0x0'));var util=require(_0xaf56('0x1'));var path=require(_0xaf56('0x2'));var timeout=require(_0xaf56('0x3'));var express=require(_0xaf56('0x4'));var router=express[_0xaf56('0x5')]();var fs_extra=require(_0xaf56('0x6'));var auth=require(_0xaf56('0x7'));var interaction=require(_0xaf56('0x8'));var config=require(_0xaf56('0x9'));var controller=require(_0xaf56('0xa'));router['get']('/',auth[_0xaf56('0xb')](),controller[_0xaf56('0xc')]);router[_0xaf56('0xd')](_0xaf56('0xe'),auth['isAuthenticated'](),controller[_0xaf56('0xf')]);router[_0xaf56('0xd')](_0xaf56('0x10'),auth[_0xaf56('0xb')](),controller[_0xaf56('0x11')]);router[_0xaf56('0x12')]('/',auth[_0xaf56('0xb')](),controller[_0xaf56('0x13')]);router[_0xaf56('0x14')](_0xaf56('0x10'),auth[_0xaf56('0xb')](),controller[_0xaf56('0x15')]);module[_0xaf56('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 3cd31ad..a0b792a 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 _0xeb5d=['exports','STRING','name'];(function(_0x549791,_0x418474){var _0x51c6c9=function(_0x5aba47){while(--_0x5aba47){_0x549791['push'](_0x549791['shift']());}};_0x51c6c9(++_0x418474);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xeb5d[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module[_0xdeb5('0x0')]={'name':{'type':Sequelize[_0xdeb5('0x1')],'unique':_0xdeb5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdeb5('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe0c3=['sequelize','STRING','name'];(function(_0x4d096e,_0x5561ab){var _0x2f9e1d=function(_0x225d2e){while(--_0x225d2e){_0x4d096e['push'](_0x4d096e['shift']());}};_0x2f9e1d(++_0x5561ab);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3e0c('0x0'));module['exports']={'name':{'type':Sequelize[_0x3e0c('0x1')],'unique':_0x3e0c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3e0c('0x1')]},'dialPrefix':{'type':Sequelize[_0x3e0c('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 881b919..2bfe335 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 _0x03d6=['filters','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','intersection','fields','find','body','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','ListId','Disposition','findOne','removeDispositions','ids','addContacts','CmContact','tags','isArray','each','omit','success','push','dataValues','errors','message','status','getContacts','CustomFields','concat','format','cf_%d','pick','raw','ContactItemType','OrderBy','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','ItemTypeId\x20=\x20?','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','download','addCustomField','transaction','addCustomFields','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','userCmList:remove','emit','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./cmList.socket','sendStatus','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Lists','UserProfileResource','error','name','send','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x03d6,0x1aa));var _0x603d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x03d6[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x603d('0x0'));var rimraf=require(_0x603d('0x1'));var zipdir=require(_0x603d('0x2'));var jsonpatch=require(_0x603d('0x3'));var rp=require(_0x603d('0x4'));var moment=require(_0x603d('0x5'));var BPromise=require(_0x603d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x603d('0x7'));var sox=require(_0x603d('0x8'));var csv=require(_0x603d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x603d('0xa'));var squel=require(_0x603d('0xb'));var crypto=require(_0x603d('0xc'));var jsforce=require(_0x603d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x603d('0x9'));var querystring=require(_0x603d('0xe'));var Papa=require('papaparse');var Redis=require(_0x603d('0xf'));var authService=require(_0x603d('0x10'));var qs=require(_0x603d('0x11'));var as=require(_0x603d('0x12'));var hardwareService=require(_0x603d('0x13'));var logger=require('../../config/logger')(_0x603d('0x14'));var utils=require(_0x603d('0x15'));var config=require(_0x603d('0x16'));var licenseUtil=require(_0x603d('0x17'));var db=require(_0x603d('0x18'))['db'];var csv_results;config['redis']=_[_0x603d('0x19')](config['redis'],{'host':_0x603d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x603d('0x1b')]));require(_0x603d('0x1c'))['register'](socket);function respondWithStatusCode(_0x46090c,_0x354228){_0x354228=_0x354228||0xcc;return function(_0x3ddce4){if(_0x3ddce4){return _0x46090c[_0x603d('0x1d')](_0x354228);}return _0x46090c['status'](_0x354228)['end']();};}function respondWithResult(_0x3625c0,_0x5c1b1b){_0x5c1b1b=_0x5c1b1b||0xc8;return function(_0x431c7d){if(_0x431c7d){return _0x3625c0['status'](_0x5c1b1b)[_0x603d('0x1e')](_0x431c7d);}};}function respondWithFilteredResult(_0x26a845,_0xbd9609){return function(_0x54dc0d){if(_0x54dc0d){var _0x122852=typeof _0xbd9609[_0x603d('0x1f')]===_0x603d('0x20')&&typeof _0xbd9609[_0x603d('0x21')]==='undefined';var _0x1646d4=_0x54dc0d[_0x603d('0x22')];var _0x45b0f6=_0x122852?0x0:_0xbd9609[_0x603d('0x1f')];var _0x5c349e=_0x122852?_0x54dc0d['count']:_0xbd9609[_0x603d('0x1f')]+_0xbd9609[_0x603d('0x21')];var _0x2bd25f;if(_0x5c349e>=_0x1646d4){_0x5c349e=_0x1646d4;_0x2bd25f=0xc8;}else{_0x2bd25f=0xce;}_0x26a845['status'](_0x2bd25f);return _0x26a845[_0x603d('0x23')](_0x603d('0x24'),_0x45b0f6+'-'+_0x5c349e+'/'+_0x1646d4)[_0x603d('0x1e')](_0x54dc0d);}return null;};}function patchUpdates(_0x58fa7c){return function(_0x3873c1){try{jsonpatch['apply'](_0x3873c1,_0x58fa7c,!![]);}catch(_0x2bda83){return BPromise[_0x603d('0x25')](_0x2bda83);}return _0x3873c1[_0x603d('0x26')]();};}function saveUpdates(_0x9f57bd,_0x3e6ce9){return function(_0x4c9c5e){if(_0x4c9c5e){return _0x4c9c5e[_0x603d('0x27')](_0x9f57bd)[_0x603d('0x28')](function(_0x5b5746){return _0x5b5746;});}return null;};}function removeEntity(_0x520a81,_0x39efe9){return function(_0x34e9cc){if(_0x34e9cc){return _0x34e9cc['destroy']()[_0x603d('0x28')](function(){var _0x903f78=_0x34e9cc[_0x603d('0x29')]({'plain':!![]});var _0x5d3b1b=_0x603d('0x2a');return db[_0x603d('0x2b')]['destroy']({'where':{'type':_0x5d3b1b,'resourceId':_0x903f78['id']}})[_0x603d('0x28')](function(){return _0x34e9cc;});})[_0x603d('0x28')](function(){_0x520a81['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1ba8,_0x5741c9){return function(_0x465508){if(!_0x465508){_0x5f1ba8[_0x603d('0x1d')](0x194);}return _0x465508;};}function handleError(_0xf6b552,_0x375027){_0x375027=_0x375027||0x1f4;return function(_0x78e55f){logger[_0x603d('0x2c')](_0x78e55f['stack']);if(_0x78e55f[_0x603d('0x2d')]){delete _0x78e55f[_0x603d('0x2d')];}_0xf6b552['status'](_0x375027)[_0x603d('0x2e')](_0x78e55f);};}exports['index']=function(_0x616e80,_0x5361b2){var _0x25a814={},_0x3460ee={},_0x4f8736={'count':0x0,'rows':[]};var _0x22101b=_[_0x603d('0x2f')](db[_0x603d('0x30')][_0x603d('0x31')],function(_0x1541e5){return{'name':_0x1541e5[_0x603d('0x32')],'type':_0x1541e5[_0x603d('0x33')][_0x603d('0x34')]};});_0x3460ee[_0x603d('0x35')]=_[_0x603d('0x2f')](_0x22101b,_0x603d('0x2d'));_0x3460ee[_0x603d('0x36')]=_[_0x603d('0x37')](_0x616e80[_0x603d('0x36')]);_0x3460ee['filters']=_['intersection'](_0x3460ee[_0x603d('0x35')],_0x3460ee[_0x603d('0x36')]);_0x25a814[_0x603d('0x38')]=_['intersection'](_0x3460ee[_0x603d('0x35')],qs['fields'](_0x616e80[_0x603d('0x36')]['fields']));_0x25a814['attributes']=_0x25a814[_0x603d('0x38')][_0x603d('0x39')]?_0x25a814['attributes']:_0x3460ee[_0x603d('0x35')];if(!_0x616e80[_0x603d('0x36')][_0x603d('0x3a')](_0x603d('0x3b'))){_0x25a814['limit']=qs['limit'](_0x616e80['query'][_0x603d('0x21')]);_0x25a814[_0x603d('0x1f')]=qs['offset'](_0x616e80['query'][_0x603d('0x1f')]);}_0x25a814[_0x603d('0x3c')]=qs[_0x603d('0x3d')](_0x616e80['query'][_0x603d('0x3d')]);_0x25a814[_0x603d('0x3e')]=qs[_0x603d('0x3f')](_['pick'](_0x616e80[_0x603d('0x36')],_0x3460ee[_0x603d('0x3f')]),_0x22101b);if(_0x616e80['query']['filter']){_0x25a814[_0x603d('0x3e')]=_[_0x603d('0x40')](_0x25a814['where'],{'$or':_[_0x603d('0x2f')](_0x22101b,function(_0x3aa0d1){if(_0x3aa0d1[_0x603d('0x33')]!==_0x603d('0x41')){var _0x2abe67={};_0x2abe67[_0x3aa0d1[_0x603d('0x2d')]]={'$like':'%'+_0x616e80['query'][_0x603d('0x42')]+'%'};return _0x2abe67;}})});}_0x25a814=_[_0x603d('0x40')]({},_0x25a814,_0x616e80[_0x603d('0x43')]);var _0x463596={'where':_0x25a814[_0x603d('0x3e')]};return db[_0x603d('0x30')][_0x603d('0x22')](_0x463596)[_0x603d('0x28')](function(_0x17ad8e){_0x4f8736[_0x603d('0x22')]=_0x17ad8e;if(_0x616e80[_0x603d('0x36')][_0x603d('0x44')]){_0x25a814['include']=[{'all':!![]}];}return db['CmList'][_0x603d('0x45')](_0x25a814);})[_0x603d('0x28')](function(_0x3ea2b9){_0x4f8736['rows']=_0x3ea2b9;return _0x4f8736;})[_0x603d('0x28')](respondWithFilteredResult(_0x5361b2,_0x25a814))[_0x603d('0x46')](handleError(_0x5361b2,null));};exports[_0x603d('0x47')]=function(_0x231e89,_0x56081f){var _0x2feda7={'raw':![],'where':{'id':_0x231e89[_0x603d('0x48')]['id']}},_0x16c788={};_0x16c788[_0x603d('0x35')]=_[_0x603d('0x37')](db[_0x603d('0x30')][_0x603d('0x31')]);_0x16c788[_0x603d('0x36')]=_['keys'](_0x231e89['query']);_0x16c788['filters']=_['intersection'](_0x16c788['model'],_0x16c788[_0x603d('0x36')]);_0x2feda7[_0x603d('0x38')]=_[_0x603d('0x49')](_0x16c788[_0x603d('0x35')],qs[_0x603d('0x4a')](_0x231e89[_0x603d('0x36')][_0x603d('0x4a')]));_0x2feda7[_0x603d('0x38')]=_0x2feda7[_0x603d('0x38')][_0x603d('0x39')]?_0x2feda7[_0x603d('0x38')]:_0x16c788[_0x603d('0x35')];if(_0x231e89['query'][_0x603d('0x44')]){_0x2feda7['include']=[{'all':!![]}];}_0x2feda7=_[_0x603d('0x40')]({},_0x2feda7,_0x231e89[_0x603d('0x43')]);return db[_0x603d('0x30')][_0x603d('0x4b')](_0x2feda7)['then'](handleEntityNotFound(_0x56081f,null))['then'](respondWithResult(_0x56081f,null))[_0x603d('0x46')](handleError(_0x56081f,null));};exports['create']=function(_0x6c6825,_0xad666c){return db['CmList']['create'](_0x6c6825[_0x603d('0x4c')],{})[_0x603d('0x28')](function(_0x4beff7){var _0xd39670=_0x6c6825[_0x603d('0x4d')][_0x603d('0x29')]({'plain':!![]});if(!_0xd39670)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd39670['role']===_0x603d('0x4d')){var _0x1cfd90=_0x4beff7[_0x603d('0x29')]({'plain':!![]});var _0x511d88=_0x603d('0x2a');return db[_0x603d('0x4e')][_0x603d('0x4b')]({'where':{'name':_0x511d88,'userProfileId':_0xd39670[_0x603d('0x4f')]},'raw':!![]})[_0x603d('0x28')](function(_0x4b126b){if(_0x4b126b&&_0x4b126b['autoAssociation']===0x0){return db[_0x603d('0x2b')][_0x603d('0x50')]({'name':_0x1cfd90[_0x603d('0x2d')],'resourceId':_0x1cfd90['id'],'type':_0x4b126b['name'],'sectionId':_0x4b126b['id']},{})[_0x603d('0x28')](function(){return _0x4beff7;});}else{return _0x4beff7;}})['catch'](function(_0x3d0ec3){logger[_0x603d('0x2c')](_0x603d('0x51'),_0x3d0ec3);throw _0x3d0ec3;});}return _0x4beff7;})[_0x603d('0x28')](respondWithResult(_0xad666c,0xc9))['catch'](handleError(_0xad666c,null));};exports[_0x603d('0x27')]=function(_0x265bcf,_0x377c32){if(_0x265bcf['body']['id']){delete _0x265bcf['body']['id'];}return db[_0x603d('0x30')][_0x603d('0x4b')]({'where':{'id':_0x265bcf[_0x603d('0x48')]['id']}})[_0x603d('0x28')](handleEntityNotFound(_0x377c32,null))[_0x603d('0x28')](saveUpdates(_0x265bcf['body'],null))[_0x603d('0x28')](respondWithResult(_0x377c32,null))[_0x603d('0x46')](handleError(_0x377c32,null));};exports[_0x603d('0x52')]=function(_0x467ce4,_0x49bc93){return db[_0x603d('0x30')][_0x603d('0x4b')]({'where':{'id':_0x467ce4['params']['id']}})[_0x603d('0x28')](handleEntityNotFound(_0x49bc93,null))[_0x603d('0x28')](removeEntity(_0x49bc93,null))[_0x603d('0x46')](handleError(_0x49bc93,null));};exports[_0x603d('0x53')]=function(_0x5d45,_0x269523){return db[_0x603d('0x30')][_0x603d('0x53')]()['then'](respondWithResult(_0x269523,null))[_0x603d('0x46')](handleError(_0x269523,null));};exports[_0x603d('0x54')]=function(_0x3efe40,_0x9c7801,_0x381958){if(_0x3efe40[_0x603d('0x4c')]['id']){delete _0x3efe40[_0x603d('0x4c')]['id'];}return db[_0x603d('0x30')][_0x603d('0x4b')]({'where':{'id':_0x3efe40[_0x603d('0x48')]['id']}})[_0x603d('0x28')](handleEntityNotFound(_0x9c7801,null))[_0x603d('0x28')](function(_0x1dfbd8){if(_0x1dfbd8){_0x3efe40[_0x603d('0x4c')][_0x603d('0x55')]=_0x1dfbd8['id'];return db[_0x603d('0x56')][_0x603d('0x50')](_0x3efe40['body']);}})[_0x603d('0x28')](respondWithResult(_0x9c7801,null))[_0x603d('0x46')](handleError(_0x9c7801,null));};exports['getDispositions']=function(_0x2a8da8,_0x9aa17a,_0x30ec3d){var _0x496402={'raw':![],'where':{}};var _0x194c93={};var _0x580b37={'count':0x0,'rows':[]};return db[_0x603d('0x30')][_0x603d('0x57')]({'where':{'id':_0x2a8da8[_0x603d('0x48')]['id']}})['then'](handleEntityNotFound(_0x9aa17a,null))[_0x603d('0x28')](function(_0x1be6b8){if(_0x1be6b8){_0x194c93['model']=_[_0x603d('0x37')](db[_0x603d('0x56')][_0x603d('0x31')]);_0x194c93['query']=_['keys'](_0x2a8da8[_0x603d('0x36')]);_0x194c93[_0x603d('0x3f')]=_[_0x603d('0x49')](_0x194c93['model'],_0x194c93[_0x603d('0x36')]);_0x496402['attributes']=_[_0x603d('0x49')](_0x194c93[_0x603d('0x35')],qs[_0x603d('0x4a')](_0x2a8da8[_0x603d('0x36')]['fields']));_0x496402[_0x603d('0x38')]=_0x496402[_0x603d('0x38')][_0x603d('0x39')]?_0x496402['attributes']:_0x194c93[_0x603d('0x35')];if(!_0x2a8da8[_0x603d('0x36')]['hasOwnProperty'](_0x603d('0x3b'))){_0x496402['limit']=qs[_0x603d('0x21')](_0x2a8da8[_0x603d('0x36')][_0x603d('0x21')]);_0x496402[_0x603d('0x1f')]=qs[_0x603d('0x1f')](_0x2a8da8[_0x603d('0x36')][_0x603d('0x1f')]);}_0x496402[_0x603d('0x3c')]=qs[_0x603d('0x3d')](_0x2a8da8[_0x603d('0x36')][_0x603d('0x3d')]);_0x496402[_0x603d('0x3e')]=qs[_0x603d('0x3f')](_['pick'](_0x2a8da8[_0x603d('0x36')],_0x194c93['filters']));_0x496402[_0x603d('0x3e')][_0x603d('0x55')]=_0x1be6b8['id'];if(_0x2a8da8[_0x603d('0x36')][_0x603d('0x42')]){_0x496402[_0x603d('0x3e')]=_[_0x603d('0x40')](_0x496402['where'],{'$or':_[_0x603d('0x2f')](_0x496402[_0x603d('0x38')],function(_0x442000){var _0x3ce5ee={};_0x3ce5ee[_0x442000]={'$like':'%'+_0x2a8da8[_0x603d('0x36')][_0x603d('0x42')]+'%'};return _0x3ce5ee;})});}_0x496402=_[_0x603d('0x40')]({},_0x496402,_0x2a8da8[_0x603d('0x43')]);return db['Disposition'][_0x603d('0x22')]({'where':_0x496402[_0x603d('0x3e')]})[_0x603d('0x28')](function(_0x402b32){_0x580b37[_0x603d('0x22')]=_0x402b32;if(_0x2a8da8[_0x603d('0x36')][_0x603d('0x44')]){_0x496402['include']=[{'all':!![]}];}return db[_0x603d('0x56')][_0x603d('0x45')](_0x496402);})['then'](function(_0x590529){_0x580b37['rows']=_0x590529;return _0x580b37;});}})[_0x603d('0x28')](respondWithFilteredResult(_0x9aa17a,_0x496402))['catch'](handleError(_0x9aa17a,null));};exports[_0x603d('0x58')]=function(_0x49b63a,_0x47db39,_0x449e37){return db[_0x603d('0x30')][_0x603d('0x4b')]({'where':{'id':_0x49b63a[_0x603d('0x48')]['id']}})['then'](handleEntityNotFound(_0x47db39,null))['then'](function(_0x4dcdb9){if(_0x4dcdb9){return _0x4dcdb9[_0x603d('0x58')](_0x49b63a[_0x603d('0x36')][_0x603d('0x59')]);}})[_0x603d('0x28')](respondWithStatusCode(_0x47db39,null))[_0x603d('0x46')](handleError(_0x47db39,null));};exports[_0x603d('0x5a')]=function(_0x49d703,_0x3d368c,_0x4b4aec){return db[_0x603d('0x30')][_0x603d('0x4b')]({'where':{'id':_0x49d703[_0x603d('0x48')]['id']}})[_0x603d('0x28')](handleEntityNotFound(_0x3d368c,null))['then'](function(_0xd239ba){if(_0xd239ba){var _0x4fdb20=[];var _0x422fca={'success':[],'errors':[]};return db[_0x603d('0x5b')][_0x603d('0x53')]()[_0x603d('0x28')](function(_0x419aa8){if(_0x49d703['body'][_0x603d('0x5c')]&&_[_0x603d('0x5d')](_0x49d703['body'][_0x603d('0x5c')])){if(_0x49d703[_0x603d('0x4c')][_0x603d('0x5c')][_0x603d('0x39')]){_0x49d703[_0x603d('0x4c')][_0x603d('0x5c')]=_0x49d703[_0x603d('0x4c')][_0x603d('0x5c')]['join'](';')+';';}else{_0x49d703['body'][_0x603d('0x5c')]=null;}}else{_0x49d703[_0x603d('0x4c')][_0x603d('0x5c')]=null;}if(_0x49d703[_0x603d('0x4c')]&&_[_0x603d('0x5d')](_0x49d703['body'])){for(var _0x149e15=0x0;_0x149e15<_0x49d703[_0x603d('0x4c')]['length'];_0x149e15+=0x1){_0x49d703[_0x603d('0x4c')][_0x149e15]['ListId']=_0x49d703[_0x603d('0x48')]['id'];_0x4fdb20['push'](_0x49d703['body'][_0x149e15]);}return BPromise[_0x603d('0x5e')](_0x4fdb20,function(_0x3b2d9d){return db['CmContact'][_0x603d('0x50')](_[_0x603d('0x5f')](_0x3b2d9d,[_0x603d('0x59'),'id'])||{},{'fields':_[_0x603d('0x37')](_0x419aa8),'raw':!![]})['then'](function(_0x20d1f5){_0x422fca[_0x603d('0x60')][_0x603d('0x61')](_0x20d1f5[_0x603d('0x62')]);})[_0x603d('0x46')](function(_0x573599){_0x422fca[_0x603d('0x63')][_0x603d('0x61')]({'data':_0x3b2d9d,'error':_0x573599[_0x603d('0x64')]});});})['then'](function(_0x4f1f23){return _0x422fca;})[_0x603d('0x46')](function(_0x23a168){return _0x23a168;});}else{_0x3d368c[_0x603d('0x65')](0x190)[_0x603d('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x603d('0x28')](respondWithResult(_0x3d368c,null))[_0x603d('0x46')](handleError(_0x3d368c,null));};exports[_0x603d('0x66')]=function(_0x280dd6,_0x482597,_0x44b6ff){var _0x4522c8;return db[_0x603d('0x30')][_0x603d('0x4b')]({'where':{'id':_0x280dd6[_0x603d('0x48')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x603d('0x67')}]})[_0x603d('0x28')](handleEntityNotFound(_0x482597,null))['then'](function(_0x33c18f){if(_0x33c18f){_0x4522c8=_0x33c18f;return db[_0x603d('0x5b')]['rawAttributes'];}})[_0x603d('0x28')](function(_0x41292c){if(_0x41292c){var _0x27c438={};var _0x1a028f={};_0x1a028f[_0x603d('0x35')]=_[_0x603d('0x68')](_[_0x603d('0x37')](_0x41292c),_[_0x603d('0x2f')](_0x4522c8[_0x603d('0x67')],function(_0x19bec3){return util[_0x603d('0x69')](_0x603d('0x6a'),_0x19bec3['id']);}));_0x1a028f[_0x603d('0x36')]=_[_0x603d('0x37')](_0x280dd6[_0x603d('0x36')]);_0x1a028f[_0x603d('0x3f')]=_[_0x603d('0x49')](_0x1a028f['model'],_0x1a028f[_0x603d('0x36')]);_0x27c438[_0x603d('0x38')]=_[_0x603d('0x49')](_0x1a028f[_0x603d('0x35')],qs['fields'](_0x280dd6[_0x603d('0x36')][_0x603d('0x4a')]));_0x27c438['attributes']=_0x27c438[_0x603d('0x38')]['length']?_0x27c438[_0x603d('0x38')]:_0x1a028f[_0x603d('0x35')];if(!_0x280dd6[_0x603d('0x36')]['hasOwnProperty']('nolimit')){_0x27c438[_0x603d('0x21')]=qs[_0x603d('0x21')](_0x280dd6[_0x603d('0x36')][_0x603d('0x21')]);_0x27c438[_0x603d('0x1f')]=qs[_0x603d('0x1f')](_0x280dd6['query'][_0x603d('0x1f')]);}_0x27c438[_0x603d('0x3c')]=qs[_0x603d('0x3d')](_0x280dd6[_0x603d('0x36')][_0x603d('0x3d')]);_0x27c438[_0x603d('0x3e')]=qs[_0x603d('0x3f')](_[_0x603d('0x6b')](_0x280dd6[_0x603d('0x36')],_0x1a028f[_0x603d('0x3f')]));_0x27c438[_0x603d('0x6c')]=!![];if(_0x280dd6[_0x603d('0x36')][_0x603d('0x42')]){_0x27c438[_0x603d('0x3e')]=_[_0x603d('0x40')](_0x27c438[_0x603d('0x3e')],{'$or':_['map'](_0x27c438[_0x603d('0x38')],function(_0x599b65){var _0x2571fb={};_0x2571fb[_0x599b65]={'$like':'%'+_0x280dd6[_0x603d('0x36')][_0x603d('0x42')]+'%'};return _0x2571fb;})});}_0x27c438=_['merge']({},_0x27c438,_0x280dd6[_0x603d('0x43')]);return _0x4522c8[_0x603d('0x66')](_0x27c438);}})[_0x603d('0x28')](respondWithResult(_0x482597,null))[_0x603d('0x46')](handleError(_0x482597,null));};exports['getContactsCsv']=function(_0x396e79,_0x21e049,_0xca9d53){var _0x58fdf2;var _0x1fb7de;var _0x551d12;var _0x4fac46=_0x396e79['params']['id'];csv_results=[];return db[_0x603d('0x6d')][_0x603d('0x45')]({'attributes':['id','name'],'raw':!![],'order':[_0x603d('0x6e')]})['then'](function(_0x2f1a34){_0x58fdf2=_0x2f1a34;var _0xea67d6=_[_0x603d('0x37')](db[_0x603d('0x5b')][_0x603d('0x31')]);return db[_0x603d('0x6f')][_0x603d('0x45')]({'raw':!![],'attributes':['id',_0x603d('0x70')]})['then'](function(_0x3f2306){_0x1fb7de=_0x3f2306;var _0x2ae9b6=squel[_0x603d('0x71')]()[_0x603d('0x4a')](_0xea67d6)[_0x603d('0x72')](_0x603d('0x73'),'c')[_0x603d('0x3e')](_0x603d('0x74'),_0x4fac46)[_0x603d('0x3e')](_0x603d('0x75'))[_0x603d('0x76')]();for(var _0x4483d0=0x0;_0x4483d0<_0x1fb7de['length'];_0x4483d0++){_0x2ae9b6[_0x603d('0x77')]('c.cf_'+_0x1fb7de[_0x4483d0]['id'],_0x603d('0x78')+_0x1fb7de[_0x4483d0][_0x603d('0x70')]);}for(var _0x4483d0=0x0;_0x4483d0<_0x58fdf2[_0x603d('0x39')];_0x4483d0++){_0x2ae9b6['field'](squel['select']()['field']('item')[_0x603d('0x72')]('cm_contact_has_items')[_0x603d('0x3e')]('ItemTypeId\x20=\x20?',_0x58fdf2[_0x4483d0]['id'])['where'](_0x603d('0x79')),_0x603d('0x7a')+_0x58fdf2[_0x4483d0][_0x603d('0x2d')]);_0x2ae9b6[_0x603d('0x77')](squel[_0x603d('0x71')]()['field'](_0x603d('0x7b'))[_0x603d('0x72')](_0x603d('0x7c'))[_0x603d('0x3e')](_0x603d('0x7d'),_0x58fdf2[_0x4483d0]['id'])['where'](_0x603d('0x79')),'description_additionalPhone_'+_0x58fdf2[_0x4483d0]['name']);}var _0x562dbf=[];_0x562dbf[_0x603d('0x61')](_0x2ae9b6[_0x603d('0x7e')]());BPromise['each'](_0x562dbf,handleQuery)[_0x603d('0x28')](function(_0x58e5eb){handleQuery(_0x2ae9b6[_0x603d('0x7e')]());var _0x455a6e=csv_results[0x0];if(!_[_0x603d('0x7f')](_0x455a6e)){var _0x4d305b=toCsv(_0x455a6e);var _0x21e80c=Date[_0x603d('0x80')]();fs[_0x603d('0x81')](util[_0x603d('0x69')](_0x603d('0x82'),_0x4fac46,_0x21e80c),_0x4d305b);_0x21e049['setHeader'](_0x603d('0x83'),_0x603d('0x84')+util[_0x603d('0x69')](_0x603d('0x85'),_0x4fac46,_0x21e80c));_0x21e049[_0x603d('0x86')](_0x603d('0x87'),'text/csv');return _0x21e049[_0x603d('0x88')](util['format'](_0x603d('0x82'),_0x4fac46,_0x21e80c));}else{return _0x21e049[_0x603d('0x1d')](0xcc);}});});});};exports[_0x603d('0x89')]=function(_0x1753df,_0x2ab4b8,_0x196913){var _0x1f9cab;delete _0x1753df[_0x603d('0x4c')]['id'];return db[_0x603d('0x30')][_0x603d('0x57')]({'where':{'id':_0x1753df['params']['id']}})[_0x603d('0x28')](handleEntityNotFound(_0x2ab4b8,null))[_0x603d('0x28')](function(_0x4c4ebb){if(_0x4c4ebb){return db['sequelize'][_0x603d('0x8a')](function(_0x77ebbe){return db[_0x603d('0x6f')][_0x603d('0x50')](_0x1753df[_0x603d('0x4c')],{'transaction':_0x77ebbe})[_0x603d('0x28')](function(_0x124ab4){_0x1f9cab=_0x124ab4;return _0x4c4ebb[_0x603d('0x8b')](_0x124ab4,{'transaction':_0x77ebbe});})[_0x603d('0x28')](function(){var _0x1c9aa5={'type':db[_0x603d('0x8c')]['TEXT'],'transaction':_0x77ebbe};switch(_0x1753df['body'][_0x603d('0x33')]){case _0x603d('0x8d'):_0x1c9aa5[_0x603d('0x33')]=db['Sequelize'][_0x603d('0x8e')];break;case'number':_0x1c9aa5[_0x603d('0x33')]=db['Sequelize'][_0x603d('0x8f')];break;case _0x603d('0x90'):_0x1c9aa5['type']=db[_0x603d('0x8c')][_0x603d('0x91')];_0x1c9aa5[_0x603d('0x92')]=![];break;default:}return db[_0x603d('0x93')][_0x603d('0x94')][_0x603d('0x95')](_0x603d('0x73'),util['format'](_0x603d('0x96'),_0x1f9cab['id']),_0x1c9aa5);})[_0x603d('0x28')](function(){return _0x1f9cab;});});}})['then'](respondWithResult(_0x2ab4b8,null))[_0x603d('0x46')](handleError(_0x2ab4b8,null));};exports[_0x603d('0x97')]=function(_0x2da998,_0x7ea469,_0x184c55){var _0x346ef4={};var _0x1aa1fb={};var _0x5a84c6;var _0x16fa4c;return db['CmList'][_0x603d('0x57')]({'where':{'id':_0x2da998[_0x603d('0x48')]['id']}})[_0x603d('0x28')](handleEntityNotFound(_0x7ea469,null))[_0x603d('0x28')](function(_0x3d3bd8){if(_0x3d3bd8){_0x5a84c6=_0x3d3bd8;_0x1aa1fb[_0x603d('0x35')]=_[_0x603d('0x37')](db[_0x603d('0x6f')][_0x603d('0x31')]);_0x1aa1fb[_0x603d('0x36')]=_[_0x603d('0x37')](_0x2da998['query']);_0x1aa1fb['filters']=_[_0x603d('0x49')](_0x1aa1fb[_0x603d('0x35')],_0x1aa1fb[_0x603d('0x36')]);_0x346ef4[_0x603d('0x38')]=_[_0x603d('0x49')](_0x1aa1fb[_0x603d('0x35')],qs['fields'](_0x2da998[_0x603d('0x36')][_0x603d('0x4a')]));_0x346ef4['attributes']=_0x346ef4[_0x603d('0x38')]['length']?_0x346ef4['attributes']:_0x1aa1fb['model'];_0x346ef4[_0x603d('0x3c')]=qs[_0x603d('0x3d')](_0x2da998[_0x603d('0x36')][_0x603d('0x3d')]);_0x346ef4[_0x603d('0x3e')]=qs[_0x603d('0x3f')](_[_0x603d('0x6b')](_0x2da998['query'],_0x1aa1fb['filters']));_0x346ef4[_0x603d('0x3e')]=_[_0x603d('0x40')](_0x346ef4[_0x603d('0x3e')],{'$or':[{'ListId':_0x3d3bd8['id']},{'ListId':null}]});if(_0x2da998['query'][_0x603d('0x42')]){_0x346ef4['where']=_[_0x603d('0x40')](_0x346ef4[_0x603d('0x3e')],{'$or':_['map'](_0x346ef4[_0x603d('0x38')],function(_0x544799){var _0x4b554a={};_0x4b554a[_0x544799]={'$like':'%'+_0x2da998[_0x603d('0x36')][_0x603d('0x42')]+'%'};return _0x4b554a;})});}_0x346ef4=_[_0x603d('0x40')]({},_0x346ef4,_0x2da998['options']);return db[_0x603d('0x6f')][_0x603d('0x98')](_0x346ef4);}})[_0x603d('0x28')](respondWithResult(_0x7ea469,null))[_0x603d('0x46')](handleError(_0x7ea469,null));};exports[_0x603d('0x99')]=function(_0x295f4c,_0x5a36ac){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})[_0x603d('0x28')](handleEntityNotFound(_0x5a36ac,null))['then'](function(_0x6306d2){return _0x6306d2;})[_0x603d('0x28')](respondWithResult(_0x5a36ac,null))['catch'](handleError(_0x5a36ac,null));};exports[_0x603d('0x9a')]=function(_0x2bcbe8,_0x3240bf,_0xae28db){return db['CmList'][_0x603d('0x4b')]({'where':{'id':_0x2bcbe8[_0x603d('0x48')]['id']}})[_0x603d('0x28')](handleEntityNotFound(_0x3240bf,null))[_0x603d('0x28')](function(_0xfa2c28){if(_0xfa2c28){return _0xfa2c28[_0x603d('0x9a')](_0x2bcbe8[_0x603d('0x4c')][_0x603d('0x59')],_[_0x603d('0x5f')](_0x2bcbe8[_0x603d('0x4c')],[_0x603d('0x59'),'id'])||{})[_0x603d('0x9b')](function(_0x5ad0ec){for(var _0x1ddeee=0x0;_0x1ddeee<_0x2bcbe8['body'][_0x603d('0x59')]['length'];_0x1ddeee+=0x1){socket['emit'](_0x603d('0x9c'),{'UserId':Number(_0x2bcbe8['body']['ids'][_0x1ddeee]),'CmListId':Number(_0x2bcbe8[_0x603d('0x48')]['id'])});}return _0x5ad0ec;});}})['then'](respondWithResult(_0x3240bf,null))[_0x603d('0x46')](handleError(_0x3240bf,null));};exports[_0x603d('0x9d')]=function(_0x86f8d8,_0x31a2ff,_0x174482){return db[_0x603d('0x30')]['find']({'where':{'id':_0x86f8d8[_0x603d('0x48')]['id']}})['then'](handleEntityNotFound(_0x31a2ff,null))[_0x603d('0x28')](function(_0x457a28){if(_0x457a28){return _0x457a28[_0x603d('0x9d')](_0x86f8d8[_0x603d('0x36')][_0x603d('0x59')])[_0x603d('0x28')](function(){if(_[_0x603d('0x5d')](_0x86f8d8['query'][_0x603d('0x59')])){for(var _0x2ec0da=0x0;_0x2ec0da<_0x86f8d8[_0x603d('0x36')]['ids'][_0x603d('0x39')];_0x2ec0da+=0x1){socket['emit'](_0x603d('0x9e'),{'UserId':Number(_0x86f8d8[_0x603d('0x36')]['ids'][_0x2ec0da]),'CmListId':Number(_0x86f8d8[_0x603d('0x48')]['id'])});}}else{socket[_0x603d('0x9f')](_0x603d('0x9e'),{'UserId':Number(_0x86f8d8[_0x603d('0x36')][_0x603d('0x59')]),'CmListId':Number(_0x86f8d8[_0x603d('0x48')]['id'])});}});}})[_0x603d('0x28')](respondWithStatusCode(_0x31a2ff,null))[_0x603d('0x46')](handleError(_0x31a2ff,null));};exports[_0x603d('0xa0')]=function(_0x2b9ff2,_0x3cff22,_0x24c643){var _0x85e5c1={};var _0x2d6d49={};var _0x412d1e;var _0x431d98;return db[_0x603d('0x30')][_0x603d('0x57')]({'where':{'id':_0x2b9ff2[_0x603d('0x48')]['id']}})[_0x603d('0x28')](handleEntityNotFound(_0x3cff22,null))['then'](function(_0x205807){if(_0x205807){_0x412d1e=_0x205807;_0x2d6d49[_0x603d('0x35')]=_[_0x603d('0x37')](db[_0x603d('0xa1')][_0x603d('0x31')]);_0x2d6d49['query']=_[_0x603d('0x37')](_0x2b9ff2[_0x603d('0x36')]);_0x2d6d49[_0x603d('0x3f')]=_[_0x603d('0x49')](_0x2d6d49[_0x603d('0x35')],_0x2d6d49[_0x603d('0x36')]);_0x85e5c1['attributes']=_[_0x603d('0x49')](_0x2d6d49['model'],qs['fields'](_0x2b9ff2[_0x603d('0x36')]['fields']));_0x85e5c1[_0x603d('0x38')]=_0x85e5c1['attributes'][_0x603d('0x39')]?_0x85e5c1[_0x603d('0x38')]:_0x2d6d49[_0x603d('0x35')];_0x85e5c1[_0x603d('0x3c')]=qs[_0x603d('0x3d')](_0x2b9ff2[_0x603d('0x36')]['sort']);_0x85e5c1['where']=qs[_0x603d('0x3f')](_['pick'](_0x2b9ff2[_0x603d('0x36')],_0x2d6d49['filters']));if(_0x2b9ff2['query'][_0x603d('0x42')]){_0x85e5c1[_0x603d('0x3e')]=_[_0x603d('0x40')](_0x85e5c1[_0x603d('0x3e')],{'$or':_[_0x603d('0x2f')](_0x85e5c1[_0x603d('0x38')],function(_0x5f5077){var _0x1d4799={};_0x1d4799[_0x5f5077]={'$like':'%'+_0x2b9ff2['query'][_0x603d('0x42')]+'%'};return _0x1d4799;})});}_0x85e5c1=_['merge']({},_0x85e5c1,_0x2b9ff2['options']);return _0x412d1e['getAgents'](_0x85e5c1);}})[_0x603d('0x28')](function(_0x5b4aff){if(_0x5b4aff){_0x431d98=_0x5b4aff['length'];if(!_0x2b9ff2['query'][_0x603d('0x3a')](_0x603d('0x3b'))){_0x85e5c1[_0x603d('0x21')]=qs[_0x603d('0x21')](_0x2b9ff2[_0x603d('0x36')][_0x603d('0x21')]);_0x85e5c1[_0x603d('0x1f')]=qs['offset'](_0x2b9ff2['query'][_0x603d('0x1f')]);}return _0x412d1e[_0x603d('0xa0')](_0x85e5c1);}})[_0x603d('0x28')](function(_0x31e159){if(_0x31e159){return _0x31e159?{'count':_0x431d98,'rows':_0x31e159}:null;}})[_0x603d('0x28')](respondWithResult(_0x3cff22,null))[_0x603d('0x46')](handleError(_0x3cff22,null));};function handleQuery(_0x72250e){logger[_0x603d('0xa2')](_0x72250e);return db[_0x603d('0x93')][_0x603d('0x36')](_0x72250e)[_0x603d('0x9b')](function(_0x2e2796){csv_results[_0x603d('0x61')](_0x2e2796);})[_0x603d('0x46')](function(_0x14ce70){logger[_0x603d('0x2c')](_0x14ce70[_0x603d('0x64')]);});} \ No newline at end of file +var _0xbd12=['field','c.cf_','item','cm_contact_has_items','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','findOne','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','message','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','sendStatus','index','CmList','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','Disposition','pick','removeDispositions','ids','addContacts','isArray','tags','join','push','each','CmContact','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','ContactItemType','OrderBy','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null'];(function(_0x20ab6d,_0x11bdee){var _0x116161=function(_0x5cd76b){while(--_0x5cd76b){_0x20ab6d['push'](_0x20ab6d['shift']());}};_0x116161(++_0x11bdee);}(_0xbd12,0x16c));var _0x2bd1=function(_0x468ed2,_0x5854fe){_0x468ed2=_0x468ed2-0x0;var _0x41cad5=_0xbd12[_0x468ed2];return _0x41cad5;};'use strict';var emlformat=require(_0x2bd1('0x0'));var rimraf=require(_0x2bd1('0x1'));var zipdir=require(_0x2bd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2bd1('0x3'));var BPromise=require(_0x2bd1('0x4'));var Mustache=require(_0x2bd1('0x5'));var util=require(_0x2bd1('0x6'));var path=require(_0x2bd1('0x7'));var sox=require(_0x2bd1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2bd1('0x9'));var _=require(_0x2bd1('0xa'));var squel=require(_0x2bd1('0xb'));var crypto=require(_0x2bd1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2bd1('0xd'));var toCsv=require(_0x2bd1('0xe'));var querystring=require('querystring');var Papa=require(_0x2bd1('0xf'));var Redis=require(_0x2bd1('0x10'));var authService=require(_0x2bd1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2bd1('0x12'));var hardwareService=require(_0x2bd1('0x13'));var logger=require('../../config/logger')(_0x2bd1('0x14'));var utils=require('../../config/utils');var config=require(_0x2bd1('0x15'));var licenseUtil=require(_0x2bd1('0x16'));var db=require(_0x2bd1('0x17'))['db'];var csv_results;config[_0x2bd1('0x18')]=_[_0x2bd1('0x19')](config[_0x2bd1('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x2bd1('0x1a'))(new Redis(config[_0x2bd1('0x18')]));require(_0x2bd1('0x1b'))['register'](socket);function respondWithStatusCode(_0x20a26c,_0x2312ce){_0x2312ce=_0x2312ce||0xcc;return function(_0x25ff02){if(_0x25ff02){return _0x20a26c['sendStatus'](_0x2312ce);}return _0x20a26c[_0x2bd1('0x1c')](_0x2312ce)['end']();};}function respondWithResult(_0x4666a3,_0x30c4c0){_0x30c4c0=_0x30c4c0||0xc8;return function(_0x42e490){if(_0x42e490){return _0x4666a3[_0x2bd1('0x1c')](_0x30c4c0)[_0x2bd1('0x1d')](_0x42e490);}};}function respondWithFilteredResult(_0x3ca791,_0x167a09){return function(_0x5e2ffb){if(_0x5e2ffb){var _0x12dc0d=typeof _0x167a09[_0x2bd1('0x1e')]===_0x2bd1('0x1f')&&typeof _0x167a09['limit']===_0x2bd1('0x1f');var _0x22b975=_0x5e2ffb[_0x2bd1('0x20')];var _0x369339=_0x12dc0d?0x0:_0x167a09[_0x2bd1('0x1e')];var _0x351d50=_0x12dc0d?_0x5e2ffb[_0x2bd1('0x20')]:_0x167a09['offset']+_0x167a09[_0x2bd1('0x21')];var _0x34efc1;if(_0x351d50>=_0x22b975){_0x351d50=_0x22b975;_0x34efc1=0xc8;}else{_0x34efc1=0xce;}_0x3ca791[_0x2bd1('0x1c')](_0x34efc1);return _0x3ca791[_0x2bd1('0x22')]('Content-Range',_0x369339+'-'+_0x351d50+'/'+_0x22b975)[_0x2bd1('0x1d')](_0x5e2ffb);}return null;};}function patchUpdates(_0x4e302b){return function(_0x19fce4){try{jsonpatch[_0x2bd1('0x23')](_0x19fce4,_0x4e302b,!![]);}catch(_0x4c5401){return BPromise[_0x2bd1('0x24')](_0x4c5401);}return _0x19fce4[_0x2bd1('0x25')]();};}function saveUpdates(_0x406ebc,_0x38b12b){return function(_0x55ae4b){if(_0x55ae4b){return _0x55ae4b[_0x2bd1('0x26')](_0x406ebc)[_0x2bd1('0x27')](function(_0x3b3913){return _0x3b3913;});}return null;};}function removeEntity(_0x37307a,_0x33ab40){return function(_0x5687f4){if(_0x5687f4){return _0x5687f4[_0x2bd1('0x28')]()['then'](function(){var _0x4261f0=_0x5687f4[_0x2bd1('0x29')]({'plain':!![]});var _0x488e64=_0x2bd1('0x2a');return db[_0x2bd1('0x2b')][_0x2bd1('0x28')]({'where':{'type':_0x488e64,'resourceId':_0x4261f0['id']}})['then'](function(){return _0x5687f4;});})[_0x2bd1('0x27')](function(){_0x37307a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9c16,_0x8fd32a){return function(_0x2e406d){if(!_0x2e406d){_0x4a9c16[_0x2bd1('0x2c')](0x194);}return _0x2e406d;};}function handleError(_0x549f8b,_0x2ca4a7){_0x2ca4a7=_0x2ca4a7||0x1f4;return function(_0x3ca52a){logger['error'](_0x3ca52a['stack']);if(_0x3ca52a['name']){delete _0x3ca52a['name'];}_0x549f8b[_0x2bd1('0x1c')](_0x2ca4a7)['send'](_0x3ca52a);};}exports[_0x2bd1('0x2d')]=function(_0x577a75,_0x4dd9ad){var _0x527c72={},_0x5a8390={},_0x359423={'count':0x0,'rows':[]};var _0x2cf21d=_['map'](db[_0x2bd1('0x2e')][_0x2bd1('0x2f')],function(_0x54197){return{'name':_0x54197[_0x2bd1('0x30')],'type':_0x54197[_0x2bd1('0x31')][_0x2bd1('0x32')]};});_0x5a8390[_0x2bd1('0x33')]=_[_0x2bd1('0x34')](_0x2cf21d,_0x2bd1('0x35'));_0x5a8390['query']=_[_0x2bd1('0x36')](_0x577a75[_0x2bd1('0x37')]);_0x5a8390[_0x2bd1('0x38')]=_[_0x2bd1('0x39')](_0x5a8390[_0x2bd1('0x33')],_0x5a8390['query']);_0x527c72['attributes']=_[_0x2bd1('0x39')](_0x5a8390[_0x2bd1('0x33')],qs[_0x2bd1('0x3a')](_0x577a75[_0x2bd1('0x37')][_0x2bd1('0x3a')]));_0x527c72[_0x2bd1('0x3b')]=_0x527c72[_0x2bd1('0x3b')][_0x2bd1('0x3c')]?_0x527c72[_0x2bd1('0x3b')]:_0x5a8390[_0x2bd1('0x33')];if(!_0x577a75[_0x2bd1('0x37')][_0x2bd1('0x3d')](_0x2bd1('0x3e'))){_0x527c72[_0x2bd1('0x21')]=qs[_0x2bd1('0x21')](_0x577a75[_0x2bd1('0x37')][_0x2bd1('0x21')]);_0x527c72[_0x2bd1('0x1e')]=qs[_0x2bd1('0x1e')](_0x577a75[_0x2bd1('0x37')]['offset']);}_0x527c72[_0x2bd1('0x3f')]=qs['sort'](_0x577a75[_0x2bd1('0x37')][_0x2bd1('0x40')]);_0x527c72['where']=qs[_0x2bd1('0x38')](_['pick'](_0x577a75[_0x2bd1('0x37')],_0x5a8390['filters']),_0x2cf21d);if(_0x577a75[_0x2bd1('0x37')]['filter']){_0x527c72[_0x2bd1('0x41')]=_[_0x2bd1('0x42')](_0x527c72[_0x2bd1('0x41')],{'$or':_[_0x2bd1('0x34')](_0x2cf21d,function(_0x7e0939){if(_0x7e0939['type']!==_0x2bd1('0x43')){var _0x277f83={};_0x277f83[_0x7e0939['name']]={'$like':'%'+_0x577a75[_0x2bd1('0x37')][_0x2bd1('0x44')]+'%'};return _0x277f83;}})});}_0x527c72=_['merge']({},_0x527c72,_0x577a75[_0x2bd1('0x45')]);var _0x4b56e6={'where':_0x527c72[_0x2bd1('0x41')]};return db[_0x2bd1('0x2e')]['count'](_0x4b56e6)[_0x2bd1('0x27')](function(_0x1e5523){_0x359423[_0x2bd1('0x20')]=_0x1e5523;if(_0x577a75['query'][_0x2bd1('0x46')]){_0x527c72[_0x2bd1('0x47')]=[{'all':!![]}];}return db[_0x2bd1('0x2e')][_0x2bd1('0x48')](_0x527c72);})[_0x2bd1('0x27')](function(_0x4c14a7){_0x359423[_0x2bd1('0x49')]=_0x4c14a7;return _0x359423;})[_0x2bd1('0x27')](respondWithFilteredResult(_0x4dd9ad,_0x527c72))[_0x2bd1('0x4a')](handleError(_0x4dd9ad,null));};exports['show']=function(_0x12e668,_0x55621e){var _0x1a0fec={'raw':![],'where':{'id':_0x12e668[_0x2bd1('0x4b')]['id']}},_0x63e31f={};_0x63e31f[_0x2bd1('0x33')]=_[_0x2bd1('0x36')](db['CmList']['rawAttributes']);_0x63e31f[_0x2bd1('0x37')]=_['keys'](_0x12e668[_0x2bd1('0x37')]);_0x63e31f[_0x2bd1('0x38')]=_[_0x2bd1('0x39')](_0x63e31f['model'],_0x63e31f[_0x2bd1('0x37')]);_0x1a0fec[_0x2bd1('0x3b')]=_[_0x2bd1('0x39')](_0x63e31f[_0x2bd1('0x33')],qs[_0x2bd1('0x3a')](_0x12e668[_0x2bd1('0x37')][_0x2bd1('0x3a')]));_0x1a0fec['attributes']=_0x1a0fec['attributes']['length']?_0x1a0fec[_0x2bd1('0x3b')]:_0x63e31f['model'];if(_0x12e668['query'][_0x2bd1('0x46')]){_0x1a0fec[_0x2bd1('0x47')]=[{'all':!![]}];}_0x1a0fec=_[_0x2bd1('0x42')]({},_0x1a0fec,_0x12e668[_0x2bd1('0x45')]);return db[_0x2bd1('0x2e')]['find'](_0x1a0fec)['then'](handleEntityNotFound(_0x55621e,null))[_0x2bd1('0x27')](respondWithResult(_0x55621e,null))[_0x2bd1('0x4a')](handleError(_0x55621e,null));};exports[_0x2bd1('0x4c')]=function(_0x22d023,_0x2c692e){return db[_0x2bd1('0x2e')]['create'](_0x22d023[_0x2bd1('0x4d')],{})[_0x2bd1('0x27')](function(_0x2a2e45){var _0x188a6b=_0x22d023[_0x2bd1('0x4e')][_0x2bd1('0x29')]({'plain':!![]});if(!_0x188a6b)throw new Error(_0x2bd1('0x4f'));if(_0x188a6b[_0x2bd1('0x50')]===_0x2bd1('0x4e')){var _0x520130=_0x2a2e45['get']({'plain':!![]});var _0x323891='Lists';return db[_0x2bd1('0x51')][_0x2bd1('0x52')]({'where':{'name':_0x323891,'userProfileId':_0x188a6b[_0x2bd1('0x53')]},'raw':!![]})[_0x2bd1('0x27')](function(_0x5e6747){if(_0x5e6747&&_0x5e6747['autoAssociation']===0x0){return db['UserProfileResource'][_0x2bd1('0x4c')]({'name':_0x520130[_0x2bd1('0x35')],'resourceId':_0x520130['id'],'type':_0x5e6747[_0x2bd1('0x35')],'sectionId':_0x5e6747['id']},{})[_0x2bd1('0x27')](function(){return _0x2a2e45;});}else{return _0x2a2e45;}})['catch'](function(_0x3c961c){logger[_0x2bd1('0x54')](_0x2bd1('0x55'),_0x3c961c);throw _0x3c961c;});}return _0x2a2e45;})[_0x2bd1('0x27')](respondWithResult(_0x2c692e,0xc9))[_0x2bd1('0x4a')](handleError(_0x2c692e,null));};exports[_0x2bd1('0x26')]=function(_0xbd8a19,_0x44c93a){if(_0xbd8a19[_0x2bd1('0x4d')]['id']){delete _0xbd8a19[_0x2bd1('0x4d')]['id'];}return db[_0x2bd1('0x2e')][_0x2bd1('0x52')]({'where':{'id':_0xbd8a19[_0x2bd1('0x4b')]['id']}})[_0x2bd1('0x27')](handleEntityNotFound(_0x44c93a,null))[_0x2bd1('0x27')](saveUpdates(_0xbd8a19['body'],null))[_0x2bd1('0x27')](respondWithResult(_0x44c93a,null))[_0x2bd1('0x4a')](handleError(_0x44c93a,null));};exports['destroy']=function(_0x526c3e,_0x56b165){return db['CmList'][_0x2bd1('0x52')]({'where':{'id':_0x526c3e['params']['id']}})['then'](handleEntityNotFound(_0x56b165,null))[_0x2bd1('0x27')](removeEntity(_0x56b165,null))[_0x2bd1('0x4a')](handleError(_0x56b165,null));};exports[_0x2bd1('0x56')]=function(_0x5322e4,_0x4c5567){return db[_0x2bd1('0x2e')]['describe']()[_0x2bd1('0x27')](respondWithResult(_0x4c5567,null))[_0x2bd1('0x4a')](handleError(_0x4c5567,null));};exports[_0x2bd1('0x57')]=function(_0x3dfdb8,_0x11fdb9,_0x246948){if(_0x3dfdb8[_0x2bd1('0x4d')]['id']){delete _0x3dfdb8[_0x2bd1('0x4d')]['id'];}return db[_0x2bd1('0x2e')][_0x2bd1('0x52')]({'where':{'id':_0x3dfdb8[_0x2bd1('0x4b')]['id']}})[_0x2bd1('0x27')](handleEntityNotFound(_0x11fdb9,null))[_0x2bd1('0x27')](function(_0x1af2e5){if(_0x1af2e5){_0x3dfdb8[_0x2bd1('0x4d')][_0x2bd1('0x58')]=_0x1af2e5['id'];return db['Disposition'][_0x2bd1('0x4c')](_0x3dfdb8[_0x2bd1('0x4d')]);}})[_0x2bd1('0x27')](respondWithResult(_0x11fdb9,null))[_0x2bd1('0x4a')](handleError(_0x11fdb9,null));};exports[_0x2bd1('0x59')]=function(_0x5f2174,_0x288bfa,_0x154310){var _0x4d0cd6={'raw':![],'where':{}};var _0x3f546f={};var _0x54d501={'count':0x0,'rows':[]};return db[_0x2bd1('0x2e')]['findOne']({'where':{'id':_0x5f2174[_0x2bd1('0x4b')]['id']}})[_0x2bd1('0x27')](handleEntityNotFound(_0x288bfa,null))['then'](function(_0x2edb53){if(_0x2edb53){_0x3f546f[_0x2bd1('0x33')]=_[_0x2bd1('0x36')](db[_0x2bd1('0x5a')][_0x2bd1('0x2f')]);_0x3f546f[_0x2bd1('0x37')]=_[_0x2bd1('0x36')](_0x5f2174[_0x2bd1('0x37')]);_0x3f546f[_0x2bd1('0x38')]=_[_0x2bd1('0x39')](_0x3f546f[_0x2bd1('0x33')],_0x3f546f[_0x2bd1('0x37')]);_0x4d0cd6[_0x2bd1('0x3b')]=_['intersection'](_0x3f546f['model'],qs[_0x2bd1('0x3a')](_0x5f2174[_0x2bd1('0x37')][_0x2bd1('0x3a')]));_0x4d0cd6[_0x2bd1('0x3b')]=_0x4d0cd6[_0x2bd1('0x3b')]['length']?_0x4d0cd6['attributes']:_0x3f546f[_0x2bd1('0x33')];if(!_0x5f2174[_0x2bd1('0x37')][_0x2bd1('0x3d')](_0x2bd1('0x3e'))){_0x4d0cd6[_0x2bd1('0x21')]=qs[_0x2bd1('0x21')](_0x5f2174[_0x2bd1('0x37')][_0x2bd1('0x21')]);_0x4d0cd6['offset']=qs[_0x2bd1('0x1e')](_0x5f2174[_0x2bd1('0x37')][_0x2bd1('0x1e')]);}_0x4d0cd6['order']=qs[_0x2bd1('0x40')](_0x5f2174['query'][_0x2bd1('0x40')]);_0x4d0cd6[_0x2bd1('0x41')]=qs[_0x2bd1('0x38')](_[_0x2bd1('0x5b')](_0x5f2174['query'],_0x3f546f['filters']));_0x4d0cd6[_0x2bd1('0x41')][_0x2bd1('0x58')]=_0x2edb53['id'];if(_0x5f2174['query'][_0x2bd1('0x44')]){_0x4d0cd6[_0x2bd1('0x41')]=_[_0x2bd1('0x42')](_0x4d0cd6[_0x2bd1('0x41')],{'$or':_[_0x2bd1('0x34')](_0x4d0cd6['attributes'],function(_0x3a153c){var _0xf425={};_0xf425[_0x3a153c]={'$like':'%'+_0x5f2174[_0x2bd1('0x37')][_0x2bd1('0x44')]+'%'};return _0xf425;})});}_0x4d0cd6=_['merge']({},_0x4d0cd6,_0x5f2174[_0x2bd1('0x45')]);return db['Disposition'][_0x2bd1('0x20')]({'where':_0x4d0cd6[_0x2bd1('0x41')]})[_0x2bd1('0x27')](function(_0x27c0e9){_0x54d501['count']=_0x27c0e9;if(_0x5f2174[_0x2bd1('0x37')][_0x2bd1('0x46')]){_0x4d0cd6['include']=[{'all':!![]}];}return db[_0x2bd1('0x5a')][_0x2bd1('0x48')](_0x4d0cd6);})[_0x2bd1('0x27')](function(_0x4b4dc4){_0x54d501[_0x2bd1('0x49')]=_0x4b4dc4;return _0x54d501;});}})['then'](respondWithFilteredResult(_0x288bfa,_0x4d0cd6))['catch'](handleError(_0x288bfa,null));};exports[_0x2bd1('0x5c')]=function(_0x575b69,_0x357ed3,_0xfea281){return db[_0x2bd1('0x2e')][_0x2bd1('0x52')]({'where':{'id':_0x575b69[_0x2bd1('0x4b')]['id']}})[_0x2bd1('0x27')](handleEntityNotFound(_0x357ed3,null))[_0x2bd1('0x27')](function(_0x3e50ae){if(_0x3e50ae){return _0x3e50ae[_0x2bd1('0x5c')](_0x575b69[_0x2bd1('0x37')][_0x2bd1('0x5d')]);}})[_0x2bd1('0x27')](respondWithStatusCode(_0x357ed3,null))[_0x2bd1('0x4a')](handleError(_0x357ed3,null));};exports[_0x2bd1('0x5e')]=function(_0x4d781b,_0x2b71a1,_0x5bab74){return db[_0x2bd1('0x2e')][_0x2bd1('0x52')]({'where':{'id':_0x4d781b[_0x2bd1('0x4b')]['id']}})[_0x2bd1('0x27')](handleEntityNotFound(_0x2b71a1,null))[_0x2bd1('0x27')](function(_0x446ccf){if(_0x446ccf){var _0x1c0ce8=[];var _0x4c0c2b={'success':[],'errors':[]};return db['CmContact']['describe']()['then'](function(_0x21b49e){if(_0x4d781b[_0x2bd1('0x4d')]['tags']&&_[_0x2bd1('0x5f')](_0x4d781b[_0x2bd1('0x4d')][_0x2bd1('0x60')])){if(_0x4d781b[_0x2bd1('0x4d')][_0x2bd1('0x60')]['length']){_0x4d781b[_0x2bd1('0x4d')]['tags']=_0x4d781b[_0x2bd1('0x4d')][_0x2bd1('0x60')][_0x2bd1('0x61')](';')+';';}else{_0x4d781b['body']['tags']=null;}}else{_0x4d781b[_0x2bd1('0x4d')][_0x2bd1('0x60')]=null;}if(_0x4d781b[_0x2bd1('0x4d')]&&_[_0x2bd1('0x5f')](_0x4d781b[_0x2bd1('0x4d')])){for(var _0x34877d=0x0;_0x34877d<_0x4d781b['body'][_0x2bd1('0x3c')];_0x34877d+=0x1){_0x4d781b[_0x2bd1('0x4d')][_0x34877d]['ListId']=_0x4d781b[_0x2bd1('0x4b')]['id'];_0x1c0ce8[_0x2bd1('0x62')](_0x4d781b['body'][_0x34877d]);}return BPromise[_0x2bd1('0x63')](_0x1c0ce8,function(_0x47ed44){return db[_0x2bd1('0x64')][_0x2bd1('0x4c')](_['omit'](_0x47ed44,[_0x2bd1('0x5d'),'id'])||{},{'fields':_[_0x2bd1('0x36')](_0x21b49e),'raw':!![]})[_0x2bd1('0x27')](function(_0x14d115){_0x4c0c2b[_0x2bd1('0x65')][_0x2bd1('0x62')](_0x14d115[_0x2bd1('0x66')]);})[_0x2bd1('0x4a')](function(_0x17c360){_0x4c0c2b[_0x2bd1('0x67')]['push']({'data':_0x47ed44,'error':_0x17c360['message']});});})[_0x2bd1('0x27')](function(_0x179573){return _0x4c0c2b;})[_0x2bd1('0x4a')](function(_0x1a7a5e){return _0x1a7a5e;});}else{_0x2b71a1[_0x2bd1('0x1c')](0x190)['json']({'message':_0x2bd1('0x68')});}});}})[_0x2bd1('0x27')](respondWithResult(_0x2b71a1,null))['catch'](handleError(_0x2b71a1,null));};exports[_0x2bd1('0x69')]=function(_0x21a8d3,_0xf0af4f,_0x38f2e4){var _0x25de5f;return db['CmList'][_0x2bd1('0x52')]({'where':{'id':_0x21a8d3[_0x2bd1('0x4b')]['id']},'include':[{'model':db[_0x2bd1('0x6a')],'as':_0x2bd1('0x6b')}]})[_0x2bd1('0x27')](handleEntityNotFound(_0xf0af4f,null))[_0x2bd1('0x27')](function(_0x27eb56){if(_0x27eb56){_0x25de5f=_0x27eb56;return db[_0x2bd1('0x64')][_0x2bd1('0x2f')];}})[_0x2bd1('0x27')](function(_0x78e93a){if(_0x78e93a){var _0xe9eb9c={};var _0x42292e={};_0x42292e[_0x2bd1('0x33')]=_[_0x2bd1('0x6c')](_[_0x2bd1('0x36')](_0x78e93a),_['map'](_0x25de5f['CustomFields'],function(_0x506e8e){return util[_0x2bd1('0x6d')](_0x2bd1('0x6e'),_0x506e8e['id']);}));_0x42292e[_0x2bd1('0x37')]=_[_0x2bd1('0x36')](_0x21a8d3[_0x2bd1('0x37')]);_0x42292e[_0x2bd1('0x38')]=_[_0x2bd1('0x39')](_0x42292e['model'],_0x42292e['query']);_0xe9eb9c[_0x2bd1('0x3b')]=_['intersection'](_0x42292e[_0x2bd1('0x33')],qs[_0x2bd1('0x3a')](_0x21a8d3[_0x2bd1('0x37')][_0x2bd1('0x3a')]));_0xe9eb9c[_0x2bd1('0x3b')]=_0xe9eb9c[_0x2bd1('0x3b')][_0x2bd1('0x3c')]?_0xe9eb9c[_0x2bd1('0x3b')]:_0x42292e[_0x2bd1('0x33')];if(!_0x21a8d3['query'][_0x2bd1('0x3d')]('nolimit')){_0xe9eb9c[_0x2bd1('0x21')]=qs[_0x2bd1('0x21')](_0x21a8d3[_0x2bd1('0x37')][_0x2bd1('0x21')]);_0xe9eb9c[_0x2bd1('0x1e')]=qs[_0x2bd1('0x1e')](_0x21a8d3[_0x2bd1('0x37')][_0x2bd1('0x1e')]);}_0xe9eb9c[_0x2bd1('0x3f')]=qs[_0x2bd1('0x40')](_0x21a8d3[_0x2bd1('0x37')][_0x2bd1('0x40')]);_0xe9eb9c['where']=qs[_0x2bd1('0x38')](_[_0x2bd1('0x5b')](_0x21a8d3[_0x2bd1('0x37')],_0x42292e[_0x2bd1('0x38')]));_0xe9eb9c[_0x2bd1('0x6f')]=!![];if(_0x21a8d3[_0x2bd1('0x37')][_0x2bd1('0x44')]){_0xe9eb9c[_0x2bd1('0x41')]=_[_0x2bd1('0x42')](_0xe9eb9c[_0x2bd1('0x41')],{'$or':_[_0x2bd1('0x34')](_0xe9eb9c[_0x2bd1('0x3b')],function(_0x568fbe){var _0x767e56={};_0x767e56[_0x568fbe]={'$like':'%'+_0x21a8d3[_0x2bd1('0x37')]['filter']+'%'};return _0x767e56;})});}_0xe9eb9c=_[_0x2bd1('0x42')]({},_0xe9eb9c,_0x21a8d3[_0x2bd1('0x45')]);return _0x25de5f[_0x2bd1('0x69')](_0xe9eb9c);}})[_0x2bd1('0x27')](respondWithResult(_0xf0af4f,null))[_0x2bd1('0x4a')](handleError(_0xf0af4f,null));};exports['getContactsCsv']=function(_0x2e9f7e,_0x1b41a8,_0x4eb6ce){var _0x4e980f;var _0x122730;var _0x24f177;var _0x48a47b=_0x2e9f7e[_0x2bd1('0x4b')]['id'];csv_results=[];return db[_0x2bd1('0x70')][_0x2bd1('0x48')]({'attributes':['id',_0x2bd1('0x35')],'raw':!![],'order':[_0x2bd1('0x71')]})['then'](function(_0x4a04d2){_0x4e980f=_0x4a04d2;var _0xe6c03e=_['keys'](db[_0x2bd1('0x64')][_0x2bd1('0x2f')]);return db[_0x2bd1('0x6a')][_0x2bd1('0x48')]({'raw':!![],'attributes':['id',_0x2bd1('0x72')]})[_0x2bd1('0x27')](function(_0x240912){_0x122730=_0x240912;var _0x57b45a=squel[_0x2bd1('0x73')]()[_0x2bd1('0x3a')](_0xe6c03e)[_0x2bd1('0x74')]('cm_contacts','c')[_0x2bd1('0x41')](_0x2bd1('0x75'),_0x48a47b)[_0x2bd1('0x41')](_0x2bd1('0x76'))['distinct']();for(var _0xb00894=0x0;_0xb00894<_0x122730['length'];_0xb00894++){_0x57b45a[_0x2bd1('0x77')](_0x2bd1('0x78')+_0x122730[_0xb00894]['id'],'customField_'+_0x122730[_0xb00894][_0x2bd1('0x72')]);}for(var _0xb00894=0x0;_0xb00894<_0x4e980f[_0x2bd1('0x3c')];_0xb00894++){_0x57b45a[_0x2bd1('0x77')](squel['select']()[_0x2bd1('0x77')](_0x2bd1('0x79'))[_0x2bd1('0x74')](_0x2bd1('0x7a'))[_0x2bd1('0x41')]('ItemTypeId\x20=\x20?',_0x4e980f[_0xb00894]['id'])[_0x2bd1('0x41')]('CmContactId\x20=\x20c.id'),'additionalPhone_'+_0x4e980f[_0xb00894][_0x2bd1('0x35')]);_0x57b45a[_0x2bd1('0x77')](squel[_0x2bd1('0x73')]()[_0x2bd1('0x77')](_0x2bd1('0x7b'))[_0x2bd1('0x74')](_0x2bd1('0x7a'))[_0x2bd1('0x41')]('ItemTypeId\x20=\x20?',_0x4e980f[_0xb00894]['id'])['where'](_0x2bd1('0x7c')),_0x2bd1('0x7d')+_0x4e980f[_0xb00894][_0x2bd1('0x35')]);}var _0xa89cdd=[];_0xa89cdd[_0x2bd1('0x62')](_0x57b45a[_0x2bd1('0x7e')]());BPromise[_0x2bd1('0x63')](_0xa89cdd,handleQuery)[_0x2bd1('0x27')](function(_0x46a880){handleQuery(_0x57b45a[_0x2bd1('0x7e')]());var _0x10bb9a=csv_results[0x0];if(!_['isEmpty'](_0x10bb9a)){var _0x3c768e=toCsv(_0x10bb9a);var _0x5e9f8d=Date[_0x2bd1('0x7f')]();fs['writeFileSync'](util['format'](_0x2bd1('0x80'),_0x48a47b,_0x5e9f8d),_0x3c768e);_0x1b41a8[_0x2bd1('0x81')](_0x2bd1('0x82'),'attachment;\x20filename='+util['format'](_0x2bd1('0x83'),_0x48a47b,_0x5e9f8d));_0x1b41a8[_0x2bd1('0x81')](_0x2bd1('0x84'),_0x2bd1('0x85'));return _0x1b41a8[_0x2bd1('0x86')](util[_0x2bd1('0x6d')]('/tmp/list_%d_%s.csv',_0x48a47b,_0x5e9f8d));}else{return _0x1b41a8['sendStatus'](0xcc);}});});});};exports[_0x2bd1('0x87')]=function(_0x564e68,_0x4e4557,_0x3e02a4){var _0x240774;delete _0x564e68[_0x2bd1('0x4d')]['id'];return db['CmList'][_0x2bd1('0x88')]({'where':{'id':_0x564e68[_0x2bd1('0x4b')]['id']}})[_0x2bd1('0x27')](handleEntityNotFound(_0x4e4557,null))[_0x2bd1('0x27')](function(_0x1eb752){if(_0x1eb752){return db['sequelize'][_0x2bd1('0x89')](function(_0x277606){return db[_0x2bd1('0x6a')]['create'](_0x564e68['body'],{'transaction':_0x277606})['then'](function(_0x26ef47){_0x240774=_0x26ef47;return _0x1eb752[_0x2bd1('0x8a')](_0x26ef47,{'transaction':_0x277606});})[_0x2bd1('0x27')](function(){var _0x5e81dd={'type':db[_0x2bd1('0x8b')]['TEXT'],'transaction':_0x277606};switch(_0x564e68[_0x2bd1('0x4d')][_0x2bd1('0x31')]){case'text':_0x5e81dd[_0x2bd1('0x31')]=db[_0x2bd1('0x8b')][_0x2bd1('0x8c')];break;case _0x2bd1('0x8d'):_0x5e81dd[_0x2bd1('0x31')]=db['Sequelize'][_0x2bd1('0x8e')];break;case _0x2bd1('0x8f'):_0x5e81dd[_0x2bd1('0x31')]=db[_0x2bd1('0x8b')][_0x2bd1('0x90')];_0x5e81dd[_0x2bd1('0x91')]=![];break;default:}return db[_0x2bd1('0x92')][_0x2bd1('0x93')][_0x2bd1('0x94')](_0x2bd1('0x95'),util[_0x2bd1('0x6d')]('cf_%s',_0x240774['id']),_0x5e81dd);})[_0x2bd1('0x27')](function(){return _0x240774;});});}})[_0x2bd1('0x27')](respondWithResult(_0x4e4557,null))[_0x2bd1('0x4a')](handleError(_0x4e4557,null));};exports[_0x2bd1('0x96')]=function(_0x462a71,_0x67a1fa,_0x57dee1){var _0x449aa3={};var _0x33f6a6={};var _0x4cd3d7;var _0x41ec98;return db[_0x2bd1('0x2e')]['findOne']({'where':{'id':_0x462a71[_0x2bd1('0x4b')]['id']}})[_0x2bd1('0x27')](handleEntityNotFound(_0x67a1fa,null))[_0x2bd1('0x27')](function(_0x12455f){if(_0x12455f){_0x4cd3d7=_0x12455f;_0x33f6a6[_0x2bd1('0x33')]=_[_0x2bd1('0x36')](db[_0x2bd1('0x6a')][_0x2bd1('0x2f')]);_0x33f6a6[_0x2bd1('0x37')]=_[_0x2bd1('0x36')](_0x462a71['query']);_0x33f6a6[_0x2bd1('0x38')]=_[_0x2bd1('0x39')](_0x33f6a6[_0x2bd1('0x33')],_0x33f6a6['query']);_0x449aa3[_0x2bd1('0x3b')]=_['intersection'](_0x33f6a6[_0x2bd1('0x33')],qs['fields'](_0x462a71[_0x2bd1('0x37')]['fields']));_0x449aa3[_0x2bd1('0x3b')]=_0x449aa3[_0x2bd1('0x3b')][_0x2bd1('0x3c')]?_0x449aa3[_0x2bd1('0x3b')]:_0x33f6a6['model'];_0x449aa3[_0x2bd1('0x3f')]=qs['sort'](_0x462a71['query'][_0x2bd1('0x40')]);_0x449aa3['where']=qs[_0x2bd1('0x38')](_['pick'](_0x462a71['query'],_0x33f6a6[_0x2bd1('0x38')]));_0x449aa3[_0x2bd1('0x41')]=_[_0x2bd1('0x42')](_0x449aa3['where'],{'$or':[{'ListId':_0x12455f['id']},{'ListId':null}]});if(_0x462a71[_0x2bd1('0x37')]['filter']){_0x449aa3['where']=_[_0x2bd1('0x42')](_0x449aa3[_0x2bd1('0x41')],{'$or':_[_0x2bd1('0x34')](_0x449aa3[_0x2bd1('0x3b')],function(_0x4f5867){var _0x300116={};_0x300116[_0x4f5867]={'$like':'%'+_0x462a71[_0x2bd1('0x37')]['filter']+'%'};return _0x300116;})});}_0x449aa3=_[_0x2bd1('0x42')]({},_0x449aa3,_0x462a71[_0x2bd1('0x45')]);return db['CmCustomField'][_0x2bd1('0x97')](_0x449aa3);}})[_0x2bd1('0x27')](respondWithResult(_0x67a1fa,null))[_0x2bd1('0x4a')](handleError(_0x67a1fa,null));};exports['getGlobalCustomFields']=function(_0x5cea14,_0x258755){return db[_0x2bd1('0x6a')][_0x2bd1('0x97')]({'where':{'ListId':null}})[_0x2bd1('0x27')](handleEntityNotFound(_0x258755,null))[_0x2bd1('0x27')](function(_0x2a7bf4){return _0x2a7bf4;})[_0x2bd1('0x27')](respondWithResult(_0x258755,null))[_0x2bd1('0x4a')](handleError(_0x258755,null));};exports['addAgents']=function(_0x40c8fe,_0x11c8d4,_0x3dd2da){return db['CmList'][_0x2bd1('0x52')]({'where':{'id':_0x40c8fe[_0x2bd1('0x4b')]['id']}})[_0x2bd1('0x27')](handleEntityNotFound(_0x11c8d4,null))[_0x2bd1('0x27')](function(_0xc53375){if(_0xc53375){return _0xc53375[_0x2bd1('0x98')](_0x40c8fe[_0x2bd1('0x4d')][_0x2bd1('0x5d')],_['omit'](_0x40c8fe[_0x2bd1('0x4d')],['ids','id'])||{})[_0x2bd1('0x99')](function(_0x466c49){for(var _0x395a2c=0x0;_0x395a2c<_0x40c8fe[_0x2bd1('0x4d')]['ids'][_0x2bd1('0x3c')];_0x395a2c+=0x1){socket[_0x2bd1('0x9a')](_0x2bd1('0x9b'),{'UserId':Number(_0x40c8fe['body']['ids'][_0x395a2c]),'CmListId':Number(_0x40c8fe[_0x2bd1('0x4b')]['id'])});}return _0x466c49;});}})[_0x2bd1('0x27')](respondWithResult(_0x11c8d4,null))['catch'](handleError(_0x11c8d4,null));};exports[_0x2bd1('0x9c')]=function(_0x244c72,_0x4c0c32,_0x27c2f1){return db[_0x2bd1('0x2e')][_0x2bd1('0x52')]({'where':{'id':_0x244c72[_0x2bd1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4c0c32,null))[_0x2bd1('0x27')](function(_0x47f221){if(_0x47f221){return _0x47f221['removeAgents'](_0x244c72[_0x2bd1('0x37')]['ids'])[_0x2bd1('0x27')](function(){if(_['isArray'](_0x244c72[_0x2bd1('0x37')][_0x2bd1('0x5d')])){for(var _0x4623a8=0x0;_0x4623a8<_0x244c72[_0x2bd1('0x37')]['ids'][_0x2bd1('0x3c')];_0x4623a8+=0x1){socket[_0x2bd1('0x9a')]('userCmList:remove',{'UserId':Number(_0x244c72['query']['ids'][_0x4623a8]),'CmListId':Number(_0x244c72[_0x2bd1('0x4b')]['id'])});}}else{socket[_0x2bd1('0x9a')](_0x2bd1('0x9d'),{'UserId':Number(_0x244c72[_0x2bd1('0x37')]['ids']),'CmListId':Number(_0x244c72[_0x2bd1('0x4b')]['id'])});}});}})[_0x2bd1('0x27')](respondWithStatusCode(_0x4c0c32,null))[_0x2bd1('0x4a')](handleError(_0x4c0c32,null));};exports[_0x2bd1('0x9e')]=function(_0x2f5ca5,_0x3e388f,_0x5e0894){var _0x50c362={};var _0x24ec75={};var _0x539fcd;var _0x1aee66;return db['CmList'][_0x2bd1('0x88')]({'where':{'id':_0x2f5ca5['params']['id']}})['then'](handleEntityNotFound(_0x3e388f,null))[_0x2bd1('0x27')](function(_0x2494c6){if(_0x2494c6){_0x539fcd=_0x2494c6;_0x24ec75['model']=_[_0x2bd1('0x36')](db['User']['rawAttributes']);_0x24ec75['query']=_[_0x2bd1('0x36')](_0x2f5ca5[_0x2bd1('0x37')]);_0x24ec75['filters']=_[_0x2bd1('0x39')](_0x24ec75[_0x2bd1('0x33')],_0x24ec75[_0x2bd1('0x37')]);_0x50c362[_0x2bd1('0x3b')]=_[_0x2bd1('0x39')](_0x24ec75[_0x2bd1('0x33')],qs[_0x2bd1('0x3a')](_0x2f5ca5['query'][_0x2bd1('0x3a')]));_0x50c362[_0x2bd1('0x3b')]=_0x50c362[_0x2bd1('0x3b')][_0x2bd1('0x3c')]?_0x50c362[_0x2bd1('0x3b')]:_0x24ec75['model'];_0x50c362['order']=qs['sort'](_0x2f5ca5['query'][_0x2bd1('0x40')]);_0x50c362[_0x2bd1('0x41')]=qs[_0x2bd1('0x38')](_[_0x2bd1('0x5b')](_0x2f5ca5[_0x2bd1('0x37')],_0x24ec75[_0x2bd1('0x38')]));if(_0x2f5ca5[_0x2bd1('0x37')][_0x2bd1('0x44')]){_0x50c362[_0x2bd1('0x41')]=_[_0x2bd1('0x42')](_0x50c362['where'],{'$or':_[_0x2bd1('0x34')](_0x50c362[_0x2bd1('0x3b')],function(_0x30990a){var _0x49ee13={};_0x49ee13[_0x30990a]={'$like':'%'+_0x2f5ca5[_0x2bd1('0x37')]['filter']+'%'};return _0x49ee13;})});}_0x50c362=_['merge']({},_0x50c362,_0x2f5ca5[_0x2bd1('0x45')]);return _0x539fcd[_0x2bd1('0x9e')](_0x50c362);}})['then'](function(_0x59bc59){if(_0x59bc59){_0x1aee66=_0x59bc59[_0x2bd1('0x3c')];if(!_0x2f5ca5[_0x2bd1('0x37')][_0x2bd1('0x3d')](_0x2bd1('0x3e'))){_0x50c362['limit']=qs[_0x2bd1('0x21')](_0x2f5ca5[_0x2bd1('0x37')]['limit']);_0x50c362[_0x2bd1('0x1e')]=qs['offset'](_0x2f5ca5[_0x2bd1('0x37')][_0x2bd1('0x1e')]);}return _0x539fcd[_0x2bd1('0x9e')](_0x50c362);}})[_0x2bd1('0x27')](function(_0x12d647){if(_0x12d647){return _0x12d647?{'count':_0x1aee66,'rows':_0x12d647}:null;}})[_0x2bd1('0x27')](respondWithResult(_0x3e388f,null))[_0x2bd1('0x4a')](handleError(_0x3e388f,null));};function handleQuery(_0x56cd9f){logger[_0x2bd1('0x9f')](_0x56cd9f);return db[_0x2bd1('0x92')][_0x2bd1('0x37')](_0x56cd9f)['spread'](function(_0x464c55){csv_results[_0x2bd1('0x62')](_0x464c55);})[_0x2bd1('0x4a')](function(_0x3d451a){logger[_0x2bd1('0x54')](_0x3d451a[_0x2bd1('0xa0')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b79d9da..c4dc58c 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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x1ece77,_0x1291e2){var _0x5973b3=function(_0x2d3a99){while(--_0x2d3a99){_0x1ece77['push'](_0x1ece77['shift']());}};_0x5973b3(++_0x1291e2);}(_0x814b,0x1a2));var _0xb814=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x814b[_0x34d346];return _0x122d76;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3e74,0x175));var _0x43e7=function(_0x80ce2f,_0x25139a){_0x80ce2f=_0x80ce2f-0x0;var _0x183948=_0x3e74[_0x80ce2f];return _0x183948;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 557f4c6..2201dc8 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 _0x668b=['cm_lists','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./cmList.attributes','define','CmList'];(function(_0x1b1261,_0x38ea96){var _0x58a2bd=function(_0x5cfe2c){while(--_0x5cfe2c){_0x1b1261['push'](_0x1b1261['shift']());}};_0x58a2bd(++_0x38ea96);}(_0x668b,0x140));var _0xb668=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x668b[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','api','bluebird'];(function(_0x1464f0,_0x81b00){var _0x5b0348=function(_0x3adb73){while(--_0x3adb73){_0x1464f0['push'](_0x1464f0['shift']());}};_0x5b0348(++_0x81b00);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1b7031,_0x42e4c5){_0x1b7031=_0x1b7031-0x0;var _0x102f2e=_0x9bde[_0x1b7031];return _0x102f2e;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'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 07c79f7..210de52 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 _0x0c5a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmList,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x24ecdd,_0x5cad30){var _0x11c5bc=function(_0x56138b){while(--_0x56138b){_0x24ecdd['push'](_0x24ecdd['shift']());}};_0x11c5bc(++_0x5cad30);}(_0x0c5a,0x19a));var _0xa0c5=function(_0x4bf5cd,_0xddf2f2){_0x4bf5cd=_0x4bf5cd-0x0;var _0x2f9e5a=_0x0c5a[_0x4bf5cd];return _0x2f9e5a;};'use strict';var _=require(_0xa0c5('0x0'));var util=require(_0xa0c5('0x1'));var moment=require(_0xa0c5('0x2'));var BPromise=require(_0xa0c5('0x3'));var rs=require(_0xa0c5('0x4'));var fs=require('fs');var Redis=require(_0xa0c5('0x5'));var db=require(_0xa0c5('0x6'))['db'];var utils=require(_0xa0c5('0x7'));var logger=require(_0xa0c5('0x8'))(_0xa0c5('0x9'));var config=require(_0xa0c5('0xa'));var jayson=require(_0xa0c5('0xb'));var client=jayson[_0xa0c5('0xc')][_0xa0c5('0xd')]({'port':0x232a});config['redis']=_[_0xa0c5('0xe')](config[_0xa0c5('0xf')],{'host':_0xa0c5('0x10'),'port':0x18eb});var socket=require(_0xa0c5('0x11'))(new Redis(config[_0xa0c5('0xf')]));require(_0xa0c5('0x12'))[_0xa0c5('0x13')](socket);function respondWithRpcPromise(_0x22820e,_0xa49304,_0x22bab1){return new BPromise(function(_0x360c27,_0x59c9e2){return client[_0xa0c5('0x14')](_0x22820e,_0x22bab1)[_0xa0c5('0x15')](function(_0x2a4073){logger[_0xa0c5('0x16')]('CmList,\x20%s,\x20%s',_0xa49304,_0xa0c5('0x17'));logger['debug'](_0xa0c5('0x18'),_0xa49304,_0xa0c5('0x17'),JSON[_0xa0c5('0x19')](_0x2a4073));if(_0x2a4073['error']){if(_0x2a4073[_0xa0c5('0x1a')][_0xa0c5('0x1b')]===0x1f4){logger[_0xa0c5('0x1a')]('CmList,\x20%s,\x20%s',_0xa49304,_0x2a4073[_0xa0c5('0x1a')][_0xa0c5('0x1c')]);return _0x59c9e2(_0x2a4073[_0xa0c5('0x1a')][_0xa0c5('0x1c')]);}logger[_0xa0c5('0x1a')](_0xa0c5('0x1d'),_0xa49304,_0x2a4073[_0xa0c5('0x1a')]['message']);return _0x360c27(_0x2a4073['error'][_0xa0c5('0x1c')]);}else{logger['info'](_0xa0c5('0x1d'),_0xa49304,_0xa0c5('0x17'));_0x360c27(_0x2a4073[_0xa0c5('0x1e')][_0xa0c5('0x1c')]);}})[_0xa0c5('0x1f')](function(_0x4fc264){logger[_0xa0c5('0x1a')](_0xa0c5('0x1d'),_0xa49304,_0x4fc264);_0x59c9e2(_0x4fc264);});});} \ No newline at end of file +var _0x39a2=['request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','info'];(function(_0x458e47,_0x388db5){var _0x21775f=function(_0x58dd49){while(--_0x58dd49){_0x458e47['push'](_0x458e47['shift']());}};_0x21775f(++_0x388db5);}(_0x39a2,0x1a2));var _0x239a=function(_0x4dbdda,_0x11f07c){_0x4dbdda=_0x4dbdda-0x0;var _0x1acbf1=_0x39a2[_0x4dbdda];return _0x1acbf1;};'use strict';var _=require(_0x239a('0x0'));var util=require(_0x239a('0x1'));var moment=require(_0x239a('0x2'));var BPromise=require(_0x239a('0x3'));var rs=require(_0x239a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x239a('0x5'))['db'];var utils=require(_0x239a('0x6'));var logger=require(_0x239a('0x7'))(_0x239a('0x8'));var config=require(_0x239a('0x9'));var jayson=require(_0x239a('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x239a('0xb')]=_['defaults'](config[_0x239a('0xb')],{'host':_0x239a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x239a('0xb')]));require(_0x239a('0xd'))[_0x239a('0xe')](socket);function respondWithRpcPromise(_0x3b6a4e,_0xc5c088,_0x4418b7){return new BPromise(function(_0x23f9c4,_0x18bf90){return client[_0x239a('0xf')](_0x3b6a4e,_0x4418b7)[_0x239a('0x10')](function(_0x1dd729){logger['info']('CmList,\x20%s,\x20%s',_0xc5c088,'request\x20sent');logger['debug'](_0x239a('0x11'),_0xc5c088,'request\x20sent',JSON[_0x239a('0x12')](_0x1dd729));if(_0x1dd729[_0x239a('0x13')]){if(_0x1dd729['error'][_0x239a('0x14')]===0x1f4){logger['error'](_0x239a('0x15'),_0xc5c088,_0x1dd729[_0x239a('0x13')][_0x239a('0x16')]);return _0x18bf90(_0x1dd729['error']['message']);}logger[_0x239a('0x13')](_0x239a('0x15'),_0xc5c088,_0x1dd729[_0x239a('0x13')][_0x239a('0x16')]);return _0x23f9c4(_0x1dd729['error'][_0x239a('0x16')]);}else{logger[_0x239a('0x17')]('CmList,\x20%s,\x20%s',_0xc5c088,_0x239a('0x18'));_0x23f9c4(_0x1dd729['result'][_0x239a('0x16')]);}})[_0x239a('0x19')](function(_0x389f1e){logger[_0x239a('0x13')](_0x239a('0x15'),_0xc5c088,_0x389f1e);_0x18bf90(_0x389f1e);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 3fca663..cb9df3a 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 _0xdaec=['register','length','cmList:','save','remove','update','emit'];(function(_0x1340f2,_0x56588b){var _0x1b4be5=function(_0x7183a3){while(--_0x7183a3){_0x1340f2['push'](_0x1340f2['shift']());}};_0x1b4be5(++_0x56588b);}(_0xdaec,0x1a0));var _0xcdae=function(_0x42c7ed,_0x25d73d){_0x42c7ed=_0x42c7ed-0x0;var _0x478d3b=_0xdaec[_0x42c7ed];return _0x478d3b;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xcdae('0x0'),_0xcdae('0x1'),_0xcdae('0x2')];function createListener(_0x19ff89,_0x566abe){return function(_0x3b8f20){_0x566abe[_0xcdae('0x3')](_0x19ff89,_0x3b8f20);};}function removeListener(_0x16232e,_0xf25170){return function(){CmListEvents['removeListener'](_0x16232e,_0xf25170);};}exports[_0xcdae('0x4')]=function(_0x1bc2d7){for(var _0x56eb94=0x0,_0x3b29d5=events[_0xcdae('0x5')];_0x56eb94<_0x3b29d5;_0x56eb94++){var _0x22f5ab=events[_0x56eb94];var _0x1e42b6=createListener(_0xcdae('0x6')+_0x22f5ab,_0x1bc2d7);CmListEvents['on'](_0x22f5ab,_0x1e42b6);}}; \ No newline at end of file +var _0xb668=['update','emit','register','length','cmList:','./cmList.events'];(function(_0x1ea6eb,_0x33d3d4){var _0x127200=function(_0x5ef9b8){while(--_0x5ef9b8){_0x1ea6eb['push'](_0x1ea6eb['shift']());}};_0x127200(++_0x33d3d4);}(_0xb668,0x15b));var _0x8b66=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb668[_0x2c91e9];return _0x13f0ff;};'use strict';var CmListEvents=require(_0x8b66('0x0'));var events=['save','remove',_0x8b66('0x1')];function createListener(_0x22fa49,_0x46765c){return function(_0x467ced){_0x46765c[_0x8b66('0x2')](_0x22fa49,_0x467ced);};}function removeListener(_0x46ee45,_0x2fe89e){return function(){CmListEvents['removeListener'](_0x46ee45,_0x2fe89e);};}exports[_0x8b66('0x3')]=function(_0x4558cb){for(var _0x3c349c=0x0,_0x64a35c=events[_0x8b66('0x4')];_0x3c349c<_0x64a35c;_0x3c349c++){var _0x160f81=events[_0x3c349c];var _0x17d2ea=createListener(_0x8b66('0x5')+_0x160f81,_0x4558cb);CmListEvents['on'](_0x160f81,_0x17d2ea);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index fe362ec..49bff80 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 _0xe16b=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','/global_fields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getCustomFields','/:id/users','getAgents','create','post','addDisposition','addContacts','addCustomField','addAgents','put','delete','destroy','removeDispositions','removeAgents'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0xe16b,0x155));var _0xbe16=function(_0x52568e,_0x1698a4){_0x52568e=_0x52568e-0x0;var _0x5c64d7=_0xe16b[_0x52568e];return _0x5c64d7;};'use strict';var multer=require('multer');var util=require(_0xbe16('0x0'));var path=require(_0xbe16('0x1'));var timeout=require(_0xbe16('0x2'));var express=require(_0xbe16('0x3'));var router=express[_0xbe16('0x4')]();var fs_extra=require(_0xbe16('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbe16('0x6'));var config=require(_0xbe16('0x7'));var controller=require(_0xbe16('0x8'));router[_0xbe16('0x9')]('/',auth[_0xbe16('0xa')](),controller['index']);router[_0xbe16('0x9')](_0xbe16('0xb'),auth[_0xbe16('0xa')](),controller['describe']);router[_0xbe16('0x9')](_0xbe16('0xc'),auth[_0xbe16('0xa')](),controller['getGlobalCustomFields']);router[_0xbe16('0x9')](_0xbe16('0xd'),auth['isAuthenticated'](),controller[_0xbe16('0xe')]);router['get'](_0xbe16('0xf'),auth[_0xbe16('0xa')](),controller[_0xbe16('0x10')]);router[_0xbe16('0x9')](_0xbe16('0x11'),auth[_0xbe16('0xa')](),controller[_0xbe16('0x12')]);router['get']('/:id/contacts/csv',auth[_0xbe16('0xa')](),controller['getContactsCsv']);router[_0xbe16('0x9')]('/:id/fields',auth[_0xbe16('0xa')](),controller[_0xbe16('0x13')]);router[_0xbe16('0x9')](_0xbe16('0x14'),auth[_0xbe16('0xa')](),controller[_0xbe16('0x15')]);router['post']('/',auth[_0xbe16('0xa')](),controller[_0xbe16('0x16')]);router[_0xbe16('0x17')](_0xbe16('0xf'),auth['isAuthenticated'](),controller[_0xbe16('0x18')]);router[_0xbe16('0x17')](_0xbe16('0x11'),auth[_0xbe16('0xa')](),controller[_0xbe16('0x19')]);router[_0xbe16('0x17')]('/:id/fields',auth['isAuthenticated'](),controller[_0xbe16('0x1a')]);router['post'](_0xbe16('0x14'),auth[_0xbe16('0xa')](),controller[_0xbe16('0x1b')]);router[_0xbe16('0x1c')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xbe16('0x1d')]('/:id',auth[_0xbe16('0xa')](),controller[_0xbe16('0x1e')]);router['delete'](_0xbe16('0xf'),auth['isAuthenticated'](),controller[_0xbe16('0x1f')]);router[_0xbe16('0x1d')](_0xbe16('0x14'),auth[_0xbe16('0xa')](),controller[_0xbe16('0x20')]);module[_0xbe16('0x21')]=router; \ No newline at end of file +var _0xda3c=['/:id/contacts','addContacts','addCustomField','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition'];(function(_0x5b47d9,_0x1327ce){var _0x4151f0=function(_0x24bda2){while(--_0x24bda2){_0x5b47d9['push'](_0x5b47d9['shift']());}};_0x4151f0(++_0x1327ce);}(_0xda3c,0x1b9));var _0xcda3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xda3c[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xcda3('0x0'));var util=require(_0xcda3('0x1'));var path=require(_0xcda3('0x2'));var timeout=require(_0xcda3('0x3'));var express=require(_0xcda3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcda3('0x5'));var interaction=require(_0xcda3('0x6'));var config=require(_0xcda3('0x7'));var controller=require(_0xcda3('0x8'));router[_0xcda3('0x9')]('/',auth[_0xcda3('0xa')](),controller[_0xcda3('0xb')]);router['get'](_0xcda3('0xc'),auth[_0xcda3('0xa')](),controller[_0xcda3('0xd')]);router[_0xcda3('0x9')](_0xcda3('0xe'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router[_0xcda3('0x9')](_0xcda3('0xf'),auth['isAuthenticated'](),controller[_0xcda3('0x10')]);router[_0xcda3('0x9')](_0xcda3('0x11'),auth[_0xcda3('0xa')](),controller[_0xcda3('0x12')]);router['get']('/:id/contacts',auth[_0xcda3('0xa')](),controller['getContacts']);router[_0xcda3('0x9')](_0xcda3('0x13'),auth[_0xcda3('0xa')](),controller[_0xcda3('0x14')]);router[_0xcda3('0x9')](_0xcda3('0x15'),auth[_0xcda3('0xa')](),controller[_0xcda3('0x16')]);router[_0xcda3('0x9')]('/:id/users',auth[_0xcda3('0xa')](),controller[_0xcda3('0x17')]);router[_0xcda3('0x18')]('/',auth[_0xcda3('0xa')](),controller[_0xcda3('0x19')]);router[_0xcda3('0x18')](_0xcda3('0x11'),auth[_0xcda3('0xa')](),controller[_0xcda3('0x1a')]);router[_0xcda3('0x18')](_0xcda3('0x1b'),auth['isAuthenticated'](),controller[_0xcda3('0x1c')]);router[_0xcda3('0x18')](_0xcda3('0x15'),auth[_0xcda3('0xa')](),controller[_0xcda3('0x1d')]);router[_0xcda3('0x18')](_0xcda3('0x1e'),auth[_0xcda3('0xa')](),controller[_0xcda3('0x1f')]);router[_0xcda3('0x20')]('/:id',auth[_0xcda3('0xa')](),controller[_0xcda3('0x21')]);router[_0xcda3('0x22')]('/:id',auth[_0xcda3('0xa')](),controller[_0xcda3('0x23')]);router[_0xcda3('0x22')](_0xcda3('0x11'),auth[_0xcda3('0xa')](),controller[_0xcda3('0x24')]);router[_0xcda3('0x22')](_0xcda3('0x1e'),auth['isAuthenticated'](),controller[_0xcda3('0x25')]);module[_0xcda3('0x26')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index d95f88b..44d2ec3 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 _0x7ebc=['exports','VIRTUAL','field','STRING','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7ebc,0xf4));var _0xc7eb=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x7ebc[_0x30bd4d];return _0x306915;};'use strict';var Sequelize=require(_0xc7eb('0x0'));module[_0xc7eb('0x1')]={'name':{'type':Sequelize[_0xc7eb('0x2')],'get':function(_0x36b859){return this['getDataValue'](_0xc7eb('0x3'));}},'field':{'type':Sequelize[_0xc7eb('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xc7eb('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xc7eb('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x1713=['getDataValue','field','STRING','sequelize','VIRTUAL'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x1713,0xc1));var _0x3171=function(_0x507b25,_0x311ef5){_0x507b25=_0x507b25-0x0;var _0x252fa9=_0x1713[_0x507b25];return _0x252fa9;};'use strict';var Sequelize=require(_0x3171('0x0'));module['exports']={'name':{'type':Sequelize[_0x3171('0x1')],'get':function(_0x2f38f5){return this[_0x3171('0x2')](_0x3171('0x3'));}},'field':{'type':Sequelize[_0x3171('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x3171('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x3171('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 2043eb8..31667cb 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 _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','update','body','Condition','find','catch','params'];(function(_0x1d4233,_0x5d1db4){var _0x9f1176=function(_0x34375d){while(--_0x34375d){_0x1d4233['push'](_0x1d4233['shift']());}};_0x9f1176(++_0x5d1db4);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','update','body','Condition','find','catch','params'];(function(_0x263f38,_0x51289f){var _0x77723=function(_0x201b16){while(--_0x201b16){_0x263f38['push'](_0x263f38['shift']());}};_0x77723(++_0x51289f);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index eaa18ba..b1a000d 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 _0xf93e=['bluebird','request-promise','path','rimraf','exports','define','tools_conditions','lodash','util','../../config/logger','api','moment'];(function(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0xf93e,0x133));var _0xef93=function(_0x363435,_0x5d27b2){_0x363435=_0x363435-0x0;var _0x3e4e89=_0xf93e[_0x363435];return _0x3e4e89;};'use strict';var _=require(_0xef93('0x0'));var util=require(_0xef93('0x1'));var logger=require(_0xef93('0x2'))(_0xef93('0x3'));var moment=require(_0xef93('0x4'));var BPromise=require(_0xef93('0x5'));var rp=require(_0xef93('0x6'));var fs=require('fs');var path=require(_0xef93('0x7'));var rimraf=require(_0xef93('0x8'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0xef93('0x9')]=function(_0x35472b,_0xe8c3c2){return _0x35472b[_0xef93('0xa')]('Condition',attributes,{'tableName':_0xef93('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefee=['tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','Condition'];(function(_0xffa65c,_0x3aa2f3){var _0x2157ad=function(_0x2f348d){while(--_0x2f348d){_0xffa65c['push'](_0xffa65c['shift']());}};_0x2157ad(++_0x3aa2f3);}(_0xefee,0x181));var _0xeefe=function(_0x5b2f3d,_0x1e2ba3){_0x5b2f3d=_0x5b2f3d-0x0;var _0x5a1b24=_0xefee[_0x5b2f3d];return _0x5a1b24;};'use strict';var _=require(_0xeefe('0x0'));var util=require(_0xeefe('0x1'));var logger=require(_0xeefe('0x2'))(_0xeefe('0x3'));var moment=require(_0xeefe('0x4'));var BPromise=require(_0xeefe('0x5'));var rp=require(_0xeefe('0x6'));var fs=require('fs');var path=require(_0xeefe('0x7'));var rimraf=require(_0xeefe('0x8'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module['exports']=function(_0x3a2374,_0x2f2a45){return _0x3a2374[_0xeefe('0x9')](_0xeefe('0xa'),attributes,{'tableName':_0xeefe('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 5a010dd..3a08ab5 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 _0x4168=['rpc','../../config/environment','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x527230,_0xdc83e8){var _0x2f6870=function(_0x30126b){while(--_0x30126b){_0x527230['push'](_0x527230['shift']());}};_0x2f6870(++_0xdc83e8);}(_0x4168,0x185));var _0x8416=function(_0xdeda17,_0x3ef130){_0xdeda17=_0xdeda17-0x0;var _0x1531dc=_0x4168[_0xdeda17];return _0x1531dc;};'use strict';var _=require(_0x8416('0x0'));var util=require(_0x8416('0x1'));var moment=require(_0x8416('0x2'));var BPromise=require(_0x8416('0x3'));var rs=require(_0x8416('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8416('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8416('0x6'))(_0x8416('0x7'));var config=require(_0x8416('0x8'));var jayson=require(_0x8416('0x9'));var client=jayson[_0x8416('0xa')][_0x8416('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x158423,_0x439ad4,_0x434ff0){return new BPromise(function(_0x5dbd87,_0x3ff5a6){return client[_0x8416('0xc')](_0x158423,_0x434ff0)['then'](function(_0x57eb36){logger[_0x8416('0xd')](_0x8416('0xe'),_0x439ad4,_0x8416('0xf'));logger[_0x8416('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x439ad4,'request\x20sent',JSON[_0x8416('0x11')](_0x57eb36));if(_0x57eb36['error']){if(_0x57eb36[_0x8416('0x12')]['code']===0x1f4){logger[_0x8416('0x12')](_0x8416('0xe'),_0x439ad4,_0x57eb36[_0x8416('0x12')][_0x8416('0x13')]);return _0x3ff5a6(_0x57eb36[_0x8416('0x12')][_0x8416('0x13')]);}logger[_0x8416('0x12')](_0x8416('0xe'),_0x439ad4,_0x57eb36[_0x8416('0x12')][_0x8416('0x13')]);return _0x5dbd87(_0x57eb36['error']['message']);}else{logger[_0x8416('0xd')](_0x8416('0xe'),_0x439ad4,_0x8416('0xf'));_0x5dbd87(_0x57eb36[_0x8416('0x14')][_0x8416('0x13')]);}})[_0x8416('0x15')](function(_0x4e1a42){logger[_0x8416('0x12')](_0x8416('0xe'),_0x439ad4,_0x4e1a42);_0x3ff5a6(_0x4e1a42);});});} \ No newline at end of file +var _0xf38c=['then','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf38c,0xb1));var _0xcf38=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf38c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xcf38('0x0'));var util=require(_0xcf38('0x1'));var moment=require(_0xcf38('0x2'));var BPromise=require(_0xcf38('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf38('0x4'));var db=require(_0xcf38('0x5'))['db'];var utils=require(_0xcf38('0x6'));var logger=require('../../config/logger')(_0xcf38('0x7'));var config=require('../../config/environment');var jayson=require(_0xcf38('0x8'));var client=jayson[_0xcf38('0x9')][_0xcf38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x280709,_0x9aa25a,_0x571835){return new BPromise(function(_0x5d81c7,_0x1a7b23){return client[_0xcf38('0xb')](_0x280709,_0x571835)[_0xcf38('0xc')](function(_0x30583d){logger['info'](_0xcf38('0xd'),_0x9aa25a,_0xcf38('0xe'));logger['debug'](_0xcf38('0xf'),_0x9aa25a,_0xcf38('0xe'),JSON[_0xcf38('0x10')](_0x30583d));if(_0x30583d['error']){if(_0x30583d[_0xcf38('0x11')]['code']===0x1f4){logger[_0xcf38('0x11')](_0xcf38('0xd'),_0x9aa25a,_0x30583d[_0xcf38('0x11')][_0xcf38('0x12')]);return _0x1a7b23(_0x30583d[_0xcf38('0x11')][_0xcf38('0x12')]);}logger[_0xcf38('0x11')](_0xcf38('0xd'),_0x9aa25a,_0x30583d[_0xcf38('0x11')][_0xcf38('0x12')]);return _0x5d81c7(_0x30583d['error'][_0xcf38('0x12')]);}else{logger[_0xcf38('0x13')](_0xcf38('0xd'),_0x9aa25a,_0xcf38('0xe'));_0x5d81c7(_0x30583d[_0xcf38('0x14')]['message']);}})['catch'](function(_0x309365){logger['error'](_0xcf38('0xd'),_0x9aa25a,_0x309365);_0x1a7b23(_0x309365);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index c88f705..f9dd12d 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 _0x8681=['delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update'];(function(_0xa720af,_0x28b50f){var _0x32c277=function(_0x4ddf96){while(--_0x4ddf96){_0xa720af['push'](_0xa720af['shift']());}};_0x32c277(++_0x28b50f);}(_0x8681,0x144));var _0x1868=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0x8681[_0x1d9163];return _0xb42197;};'use strict';var multer=require(_0x1868('0x0'));var util=require(_0x1868('0x1'));var path=require(_0x1868('0x2'));var timeout=require(_0x1868('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1868('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1868('0x5'));var config=require(_0x1868('0x6'));var controller=require(_0x1868('0x7'));router[_0x1868('0x8')](_0x1868('0x9'),auth[_0x1868('0xa')](),controller[_0x1868('0xb')]);router[_0x1868('0xc')]('/:id',auth[_0x1868('0xa')](),controller[_0x1868('0xd')]);module['exports']=router; \ No newline at end of file +var _0x76e4=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','update','delete','/:id','destroy','exports'];(function(_0x283e7e,_0x513284){var _0x50b0c6=function(_0x409b0e){while(--_0x409b0e){_0x283e7e['push'](_0x283e7e['shift']());}};_0x50b0c6(++_0x513284);}(_0x76e4,0x12c));var _0x476e=function(_0x19b679,_0x2ff39f){_0x19b679=_0x19b679-0x0;var _0x172591=_0x76e4[_0x19b679];return _0x172591;};'use strict';var multer=require(_0x476e('0x0'));var util=require('util');var path=require(_0x476e('0x1'));var timeout=require(_0x476e('0x2'));var express=require(_0x476e('0x3'));var router=express[_0x476e('0x4')]();var fs_extra=require(_0x476e('0x5'));var auth=require(_0x476e('0x6'));var interaction=require(_0x476e('0x7'));var config=require(_0x476e('0x8'));var controller=require(_0x476e('0x9'));router['put']('/:id',auth['isAuthenticated'](),controller[_0x476e('0xa')]);router[_0x476e('0xb')](_0x476e('0xc'),auth['isAuthenticated'](),controller[_0x476e('0xd')]);module[_0x476e('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 3034be3..88d1292 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 _0x23ca=['INTEGER','sequelize','STRING'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x23ca,0x130));var _0xa23c=function(_0x2ab5fa,_0x2d9aed){_0x2ab5fa=_0x2ab5fa-0x0;var _0x43d5e4=_0x23ca[_0x2ab5fa];return _0x43d5e4;};'use strict';var Sequelize=require(_0xa23c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa23c('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xa23c('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa23c('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x7cec=['STRING','INTEGER','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7cec,0x170));var _0xc7ce=function(_0x137b27,_0x3664ea){_0x137b27=_0x137b27-0x0;var _0x135eec=_0x7cec[_0x137b27];return _0x135eec;};'use strict';var Sequelize=require('sequelize');module[_0xc7ce('0x0')]={'name':{'type':Sequelize[_0xc7ce('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xc7ce('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xc7ce('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index e85103b..b5233b6 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 _0xd7d1=['autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','end','error','stack','name','index','map','ContactItemType','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','userProfileId'];(function(_0x1d8c4b,_0x1e4ed4){var _0x3e2819=function(_0x496603){while(--_0x496603){_0x1d8c4b['push'](_0x1d8c4b['shift']());}};_0x3e2819(++_0x1e4ed4);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1f6762,_0x36679c){_0x1f6762=_0x1f6762-0x0;var _0x3b41f4=_0xd7d1[_0x1f6762];return _0x3b41f4;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b83f,_0x5ae1c9){_0x5ae1c9=_0x5ae1c9||0xcc;return function(_0x577e07){if(_0x577e07){return _0x11b83f[_0x1d7d('0x1c')](_0x5ae1c9);}return _0x11b83f[_0x1d7d('0x1d')](_0x5ae1c9)['end']();};}function respondWithResult(_0x55dba7,_0x1d3822){_0x1d3822=_0x1d3822||0xc8;return function(_0x334e78){if(_0x334e78){return _0x55dba7[_0x1d7d('0x1d')](_0x1d3822)[_0x1d7d('0x1e')](_0x334e78);}};}function respondWithFilteredResult(_0xeb05b3,_0x53423f){return function(_0x28adf3){if(_0x28adf3){var _0x1de6cc=typeof _0x53423f['offset']===_0x1d7d('0x1f')&&typeof _0x53423f[_0x1d7d('0x20')]===_0x1d7d('0x1f');var _0x47826a=_0x28adf3[_0x1d7d('0x21')];var _0x4db4f2=_0x1de6cc?0x0:_0x53423f[_0x1d7d('0x22')];var _0x191024=_0x1de6cc?_0x28adf3['count']:_0x53423f['offset']+_0x53423f[_0x1d7d('0x20')];var _0x1a5101;if(_0x191024>=_0x47826a){_0x191024=_0x47826a;_0x1a5101=0xc8;}else{_0x1a5101=0xce;}_0xeb05b3[_0x1d7d('0x1d')](_0x1a5101);return _0xeb05b3[_0x1d7d('0x23')](_0x1d7d('0x24'),_0x4db4f2+'-'+_0x191024+'/'+_0x47826a)[_0x1d7d('0x1e')](_0x28adf3);}return null;};}function patchUpdates(_0x54d401){return function(_0x225f85){try{jsonpatch[_0x1d7d('0x25')](_0x225f85,_0x54d401,!![]);}catch(_0x3a93d0){return BPromise['reject'](_0x3a93d0);}return _0x225f85[_0x1d7d('0x26')]();};}function saveUpdates(_0x12c54b,_0x4a1cdc){return function(_0x5950bd){if(_0x5950bd){return _0x5950bd[_0x1d7d('0x27')](_0x12c54b)[_0x1d7d('0x28')](function(_0x3d631f){return _0x3d631f;});}return null;};}function removeEntity(_0x5097b8,_0x377653){return function(_0x106376){if(_0x106376){return _0x106376[_0x1d7d('0x29')]()[_0x1d7d('0x28')](function(){var _0x4fa346=_0x106376[_0x1d7d('0x2a')]({'plain':!![]});var _0x151198='ContactItemTypes';return db['UserProfileResource'][_0x1d7d('0x29')]({'where':{'type':_0x151198,'resourceId':_0x4fa346['id']}})['then'](function(){return _0x106376;});})[_0x1d7d('0x28')](function(){_0x5097b8[_0x1d7d('0x1d')](0xcc)[_0x1d7d('0x2b')]();});}};}function handleEntityNotFound(_0x22c40d,_0x465938){return function(_0x59f827){if(!_0x59f827){_0x22c40d[_0x1d7d('0x1c')](0x194);}return _0x59f827;};}function handleError(_0x98c1ad,_0x352d5a){_0x352d5a=_0x352d5a||0x1f4;return function(_0x58672c){logger[_0x1d7d('0x2c')](_0x58672c[_0x1d7d('0x2d')]);if(_0x58672c[_0x1d7d('0x2e')]){delete _0x58672c['name'];}_0x98c1ad['status'](_0x352d5a)['send'](_0x58672c);};}exports[_0x1d7d('0x2f')]=function(_0x329f56,_0x559f19){var _0x1ebcbc={},_0x3e4136={},_0x16a81d={'count':0x0,'rows':[]};var _0x3336ab=_[_0x1d7d('0x30')](db[_0x1d7d('0x31')][_0x1d7d('0x32')],function(_0x803dc9){return{'name':_0x803dc9[_0x1d7d('0x33')],'type':_0x803dc9[_0x1d7d('0x34')]['key']};});_0x3e4136['model']=_[_0x1d7d('0x30')](_0x3336ab,_0x1d7d('0x2e'));_0x3e4136[_0x1d7d('0x35')]=_[_0x1d7d('0x36')](_0x329f56[_0x1d7d('0x35')]);_0x3e4136[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],_0x3e4136[_0x1d7d('0x35')]);_0x1ebcbc['attributes']=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x329f56[_0x1d7d('0x35')]['fields']));_0x1ebcbc['attributes']=_0x1ebcbc[_0x1d7d('0x3b')][_0x1d7d('0x3c')]?_0x1ebcbc['attributes']:_0x3e4136[_0x1d7d('0x39')];if(!_0x329f56[_0x1d7d('0x35')]['hasOwnProperty']('nolimit')){_0x1ebcbc[_0x1d7d('0x20')]=qs[_0x1d7d('0x20')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x20')]);_0x1ebcbc[_0x1d7d('0x22')]=qs[_0x1d7d('0x22')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x22')]);}_0x1ebcbc[_0x1d7d('0x3d')]=qs[_0x1d7d('0x3e')](_0x329f56['query']['sort']);_0x1ebcbc['where']=qs['filters'](_[_0x1d7d('0x3f')](_0x329f56['query'],_0x3e4136[_0x1d7d('0x37')]),_0x3336ab);if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x40')]){_0x1ebcbc['where']=_[_0x1d7d('0x41')](_0x1ebcbc[_0x1d7d('0x42')],{'$or':_[_0x1d7d('0x30')](_0x3336ab,function(_0x5b7e01){if(_0x5b7e01[_0x1d7d('0x34')]!==_0x1d7d('0x43')){var _0xfb9845={};_0xfb9845[_0x5b7e01[_0x1d7d('0x2e')]]={'$like':'%'+_0x329f56['query'][_0x1d7d('0x40')]+'%'};return _0xfb9845;}})});}_0x1ebcbc=_[_0x1d7d('0x41')]({},_0x1ebcbc,_0x329f56[_0x1d7d('0x44')]);var _0x456d51={'where':_0x1ebcbc['where']};return db[_0x1d7d('0x31')]['count'](_0x456d51)[_0x1d7d('0x28')](function(_0x31b850){_0x16a81d[_0x1d7d('0x21')]=_0x31b850;if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x45')]){_0x1ebcbc['include']=[{'all':!![]}];}return db['ContactItemType'][_0x1d7d('0x46')](_0x1ebcbc);})[_0x1d7d('0x28')](function(_0x1637fc){_0x16a81d['rows']=_0x1637fc;return _0x16a81d;})['then'](respondWithFilteredResult(_0x559f19,_0x1ebcbc))[_0x1d7d('0x47')](handleError(_0x559f19,null));};exports['show']=function(_0x86e7bc,_0x379e75){var _0x1d1064={'raw':!![],'where':{'id':_0x86e7bc[_0x1d7d('0x48')]['id']}},_0x21394c={};_0x21394c[_0x1d7d('0x39')]=_[_0x1d7d('0x36')](db['ContactItemType'][_0x1d7d('0x32')]);_0x21394c[_0x1d7d('0x35')]=_['keys'](_0x86e7bc[_0x1d7d('0x35')]);_0x21394c[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],_0x21394c[_0x1d7d('0x35')]);_0x1d1064[_0x1d7d('0x3b')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x86e7bc[_0x1d7d('0x35')][_0x1d7d('0x3a')]));_0x1d1064[_0x1d7d('0x3b')]=_0x1d1064['attributes'][_0x1d7d('0x3c')]?_0x1d1064['attributes']:_0x21394c[_0x1d7d('0x39')];if(_0x86e7bc['query'][_0x1d7d('0x45')]){_0x1d1064[_0x1d7d('0x49')]=[{'all':!![]}];}_0x1d1064=_[_0x1d7d('0x41')]({},_0x1d1064,_0x86e7bc[_0x1d7d('0x44')]);return db['ContactItemType'][_0x1d7d('0x4a')](_0x1d1064)['then'](handleEntityNotFound(_0x379e75,null))['then'](respondWithResult(_0x379e75,null))[_0x1d7d('0x47')](handleError(_0x379e75,null));};exports['create']=function(_0x57e416,_0x3727be){return db[_0x1d7d('0x31')]['create'](_0x57e416[_0x1d7d('0x4b')],{})[_0x1d7d('0x28')](function(_0x527711){var _0x1f3a63=_0x57e416[_0x1d7d('0x4c')][_0x1d7d('0x2a')]({'plain':!![]});if(!_0x1f3a63)throw new Error(_0x1d7d('0x4d'));if(_0x1f3a63['role']==='user'){var _0x3f73eb=_0x527711[_0x1d7d('0x2a')]({'plain':!![]});var _0x35ff5d=_0x1d7d('0x4e');return db[_0x1d7d('0x4f')]['find']({'where':{'name':_0x35ff5d,'userProfileId':_0x1f3a63[_0x1d7d('0x50')]},'raw':!![]})[_0x1d7d('0x28')](function(_0x344b66){if(_0x344b66&&_0x344b66[_0x1d7d('0x51')]===0x0){return db[_0x1d7d('0x52')][_0x1d7d('0x53')]({'name':_0x3f73eb[_0x1d7d('0x2e')],'resourceId':_0x3f73eb['id'],'type':_0x344b66[_0x1d7d('0x2e')],'sectionId':_0x344b66['id']},{})[_0x1d7d('0x28')](function(){return _0x527711;});}else{return _0x527711;}})['catch'](function(_0x3e7c4c){logger[_0x1d7d('0x2c')](_0x1d7d('0x54'),_0x3e7c4c);throw _0x3e7c4c;});}return _0x527711;})['then'](respondWithResult(_0x3727be,0xc9))['catch'](handleError(_0x3727be,null));};exports[_0x1d7d('0x27')]=function(_0x2d4cc3,_0x3f5434){if(_0x2d4cc3['body']['id']){delete _0x2d4cc3[_0x1d7d('0x4b')]['id'];}return db[_0x1d7d('0x31')]['find']({'where':{'id':_0x2d4cc3[_0x1d7d('0x48')]['id']}})[_0x1d7d('0x28')](handleEntityNotFound(_0x3f5434,null))[_0x1d7d('0x28')](saveUpdates(_0x2d4cc3[_0x1d7d('0x4b')],null))['then'](respondWithResult(_0x3f5434,null))[_0x1d7d('0x47')](handleError(_0x3f5434,null));};exports[_0x1d7d('0x29')]=function(_0x4ba6ec,_0x4d4c34){return db[_0x1d7d('0x31')][_0x1d7d('0x4a')]({'where':{'id':_0x4ba6ec['params']['id']}})['then'](handleEntityNotFound(_0x4d4c34,null))[_0x1d7d('0x28')](db[_0x1d7d('0x55')][_0x1d7d('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4ba6ec[_0x1d7d('0x48')]['id']}}))['then'](removeEntity(_0x4d4c34,null))[_0x1d7d('0x47')](handleError(_0x4d4c34,null));}; \ No newline at end of file +var _0x4213=['model','map','query','keys','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','filters','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','destroy','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','reject','save','update','then','get','UserProfileResource','error','name','send','ContactItemType','fieldName','type','key'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x4213,0x77));var _0x3421=function(_0x2ae0cf,_0x3de0ee){_0x2ae0cf=_0x2ae0cf-0x0;var _0x2e5fe9=_0x4213[_0x2ae0cf];return _0x2e5fe9;};'use strict';var emlformat=require(_0x3421('0x0'));var rimraf=require(_0x3421('0x1'));var zipdir=require(_0x3421('0x2'));var jsonpatch=require(_0x3421('0x3'));var rp=require(_0x3421('0x4'));var moment=require(_0x3421('0x5'));var BPromise=require(_0x3421('0x6'));var Mustache=require('mustache');var util=require(_0x3421('0x7'));var path=require('path');var sox=require(_0x3421('0x8'));var csv=require(_0x3421('0x9'));var ejs=require(_0x3421('0xa'));var fs=require('fs');var fs_extra=require(_0x3421('0xb'));var _=require('lodash');var squel=require(_0x3421('0xc'));var crypto=require(_0x3421('0xd'));var jsforce=require(_0x3421('0xe'));var deskjs=require(_0x3421('0xf'));var toCsv=require(_0x3421('0x9'));var querystring=require('querystring');var Papa=require(_0x3421('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3421('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3421('0x12'));var logger=require(_0x3421('0x13'))(_0x3421('0x14'));var utils=require(_0x3421('0x15'));var config=require(_0x3421('0x16'));var licenseUtil=require(_0x3421('0x17'));var db=require(_0x3421('0x18'))['db'];function respondWithStatusCode(_0x59eaf1,_0x26d459){_0x26d459=_0x26d459||0xcc;return function(_0x3e2ecd){if(_0x3e2ecd){return _0x59eaf1[_0x3421('0x19')](_0x26d459);}return _0x59eaf1[_0x3421('0x1a')](_0x26d459)[_0x3421('0x1b')]();};}function respondWithResult(_0x3f4672,_0x25ffd4){_0x25ffd4=_0x25ffd4||0xc8;return function(_0x59ea4a){if(_0x59ea4a){return _0x3f4672[_0x3421('0x1a')](_0x25ffd4)['json'](_0x59ea4a);}};}function respondWithFilteredResult(_0x372d21,_0x5257ad){return function(_0x59ae45){if(_0x59ae45){var _0x1e33ab=typeof _0x5257ad['offset']===_0x3421('0x1c')&&typeof _0x5257ad[_0x3421('0x1d')]==='undefined';var _0x3584d6=_0x59ae45[_0x3421('0x1e')];var _0x130d3c=_0x1e33ab?0x0:_0x5257ad[_0x3421('0x1f')];var _0x18acc1=_0x1e33ab?_0x59ae45[_0x3421('0x1e')]:_0x5257ad[_0x3421('0x1f')]+_0x5257ad[_0x3421('0x1d')];var _0x197b83;if(_0x18acc1>=_0x3584d6){_0x18acc1=_0x3584d6;_0x197b83=0xc8;}else{_0x197b83=0xce;}_0x372d21[_0x3421('0x1a')](_0x197b83);return _0x372d21[_0x3421('0x20')]('Content-Range',_0x130d3c+'-'+_0x18acc1+'/'+_0x3584d6)[_0x3421('0x21')](_0x59ae45);}return null;};}function patchUpdates(_0x4b59a5){return function(_0x5820f6){try{jsonpatch['apply'](_0x5820f6,_0x4b59a5,!![]);}catch(_0x33155b){return BPromise[_0x3421('0x22')](_0x33155b);}return _0x5820f6[_0x3421('0x23')]();};}function saveUpdates(_0x256cc5,_0x132e8e){return function(_0x39bed4){if(_0x39bed4){return _0x39bed4[_0x3421('0x24')](_0x256cc5)[_0x3421('0x25')](function(_0xb9af5f){return _0xb9af5f;});}return null;};}function removeEntity(_0x34389e,_0x48fb3d){return function(_0x57a4af){if(_0x57a4af){return _0x57a4af['destroy']()[_0x3421('0x25')](function(){var _0x958899=_0x57a4af[_0x3421('0x26')]({'plain':!![]});var _0x5bc28a='ContactItemTypes';return db[_0x3421('0x27')]['destroy']({'where':{'type':_0x5bc28a,'resourceId':_0x958899['id']}})[_0x3421('0x25')](function(){return _0x57a4af;});})['then'](function(){_0x34389e[_0x3421('0x1a')](0xcc)[_0x3421('0x1b')]();});}};}function handleEntityNotFound(_0x36d75f,_0x2e6a75){return function(_0x186885){if(!_0x186885){_0x36d75f['sendStatus'](0x194);}return _0x186885;};}function handleError(_0x332017,_0x52fd41){_0x52fd41=_0x52fd41||0x1f4;return function(_0x5efe73){logger[_0x3421('0x28')](_0x5efe73['stack']);if(_0x5efe73['name']){delete _0x5efe73[_0x3421('0x29')];}_0x332017['status'](_0x52fd41)[_0x3421('0x2a')](_0x5efe73);};}exports['index']=function(_0xc7f9fb,_0xbe9f09){var _0x48d828={},_0x3f7c0b={},_0x3bc7c1={'count':0x0,'rows':[]};var _0x420349=_['map'](db[_0x3421('0x2b')]['rawAttributes'],function(_0x2b5af4){return{'name':_0x2b5af4[_0x3421('0x2c')],'type':_0x2b5af4[_0x3421('0x2d')][_0x3421('0x2e')]};});_0x3f7c0b[_0x3421('0x2f')]=_[_0x3421('0x30')](_0x420349,_0x3421('0x29'));_0x3f7c0b[_0x3421('0x31')]=_[_0x3421('0x32')](_0xc7f9fb[_0x3421('0x31')]);_0x3f7c0b['filters']=_['intersection'](_0x3f7c0b[_0x3421('0x2f')],_0x3f7c0b[_0x3421('0x31')]);_0x48d828['attributes']=_[_0x3421('0x33')](_0x3f7c0b[_0x3421('0x2f')],qs[_0x3421('0x34')](_0xc7f9fb[_0x3421('0x31')][_0x3421('0x34')]));_0x48d828['attributes']=_0x48d828[_0x3421('0x35')][_0x3421('0x36')]?_0x48d828[_0x3421('0x35')]:_0x3f7c0b['model'];if(!_0xc7f9fb[_0x3421('0x31')]['hasOwnProperty'](_0x3421('0x37'))){_0x48d828[_0x3421('0x1d')]=qs[_0x3421('0x1d')](_0xc7f9fb[_0x3421('0x31')][_0x3421('0x1d')]);_0x48d828[_0x3421('0x1f')]=qs[_0x3421('0x1f')](_0xc7f9fb['query']['offset']);}_0x48d828['order']=qs[_0x3421('0x38')](_0xc7f9fb['query']['sort']);_0x48d828[_0x3421('0x39')]=qs['filters'](_[_0x3421('0x3a')](_0xc7f9fb[_0x3421('0x31')],_0x3f7c0b['filters']),_0x420349);if(_0xc7f9fb[_0x3421('0x31')][_0x3421('0x3b')]){_0x48d828[_0x3421('0x39')]=_[_0x3421('0x3c')](_0x48d828['where'],{'$or':_[_0x3421('0x30')](_0x420349,function(_0x2745c9){if(_0x2745c9[_0x3421('0x2d')]!==_0x3421('0x3d')){var _0x25de09={};_0x25de09[_0x2745c9['name']]={'$like':'%'+_0xc7f9fb[_0x3421('0x31')][_0x3421('0x3b')]+'%'};return _0x25de09;}})});}_0x48d828=_['merge']({},_0x48d828,_0xc7f9fb[_0x3421('0x3e')]);var _0x5daa14={'where':_0x48d828['where']};return db['ContactItemType'][_0x3421('0x1e')](_0x5daa14)[_0x3421('0x25')](function(_0x41bdb7){_0x3bc7c1[_0x3421('0x1e')]=_0x41bdb7;if(_0xc7f9fb[_0x3421('0x31')][_0x3421('0x3f')]){_0x48d828[_0x3421('0x40')]=[{'all':!![]}];}return db[_0x3421('0x2b')][_0x3421('0x41')](_0x48d828);})[_0x3421('0x25')](function(_0x3b9d15){_0x3bc7c1[_0x3421('0x42')]=_0x3b9d15;return _0x3bc7c1;})[_0x3421('0x25')](respondWithFilteredResult(_0xbe9f09,_0x48d828))[_0x3421('0x43')](handleError(_0xbe9f09,null));};exports['show']=function(_0x3076eb,_0x2e7c59){var _0x139d55={'raw':!![],'where':{'id':_0x3076eb['params']['id']}},_0x4466be={};_0x4466be[_0x3421('0x2f')]=_['keys'](db[_0x3421('0x2b')][_0x3421('0x44')]);_0x4466be[_0x3421('0x31')]=_[_0x3421('0x32')](_0x3076eb[_0x3421('0x31')]);_0x4466be[_0x3421('0x45')]=_[_0x3421('0x33')](_0x4466be[_0x3421('0x2f')],_0x4466be[_0x3421('0x31')]);_0x139d55[_0x3421('0x35')]=_[_0x3421('0x33')](_0x4466be[_0x3421('0x2f')],qs[_0x3421('0x34')](_0x3076eb['query'][_0x3421('0x34')]));_0x139d55['attributes']=_0x139d55[_0x3421('0x35')][_0x3421('0x36')]?_0x139d55[_0x3421('0x35')]:_0x4466be[_0x3421('0x2f')];if(_0x3076eb[_0x3421('0x31')][_0x3421('0x3f')]){_0x139d55[_0x3421('0x40')]=[{'all':!![]}];}_0x139d55=_[_0x3421('0x3c')]({},_0x139d55,_0x3076eb[_0x3421('0x3e')]);return db[_0x3421('0x2b')]['find'](_0x139d55)[_0x3421('0x25')](handleEntityNotFound(_0x2e7c59,null))[_0x3421('0x25')](respondWithResult(_0x2e7c59,null))[_0x3421('0x43')](handleError(_0x2e7c59,null));};exports['create']=function(_0x566f95,_0x43a94f){return db[_0x3421('0x2b')][_0x3421('0x46')](_0x566f95['body'],{})[_0x3421('0x25')](function(_0x18eba6){var _0x213e27=_0x566f95[_0x3421('0x47')]['get']({'plain':!![]});if(!_0x213e27)throw new Error(_0x3421('0x48'));if(_0x213e27[_0x3421('0x49')]===_0x3421('0x47')){var _0x51a21f=_0x18eba6['get']({'plain':!![]});var _0x5a2004=_0x3421('0x4a');return db[_0x3421('0x4b')]['find']({'where':{'name':_0x5a2004,'userProfileId':_0x213e27['userProfileId']},'raw':!![]})[_0x3421('0x25')](function(_0x42934d){if(_0x42934d&&_0x42934d[_0x3421('0x4c')]===0x0){return db[_0x3421('0x27')][_0x3421('0x46')]({'name':_0x51a21f['name'],'resourceId':_0x51a21f['id'],'type':_0x42934d[_0x3421('0x29')],'sectionId':_0x42934d['id']},{})[_0x3421('0x25')](function(){return _0x18eba6;});}else{return _0x18eba6;}})[_0x3421('0x43')](function(_0x2f9ce1){logger['error'](_0x3421('0x4d'),_0x2f9ce1);throw _0x2f9ce1;});}return _0x18eba6;})[_0x3421('0x25')](respondWithResult(_0x43a94f,0xc9))[_0x3421('0x43')](handleError(_0x43a94f,null));};exports['update']=function(_0x5f97d5,_0x5c73ae){if(_0x5f97d5['body']['id']){delete _0x5f97d5[_0x3421('0x4e')]['id'];}return db['ContactItemType'][_0x3421('0x4f')]({'where':{'id':_0x5f97d5[_0x3421('0x50')]['id']}})[_0x3421('0x25')](handleEntityNotFound(_0x5c73ae,null))['then'](saveUpdates(_0x5f97d5[_0x3421('0x4e')],null))[_0x3421('0x25')](respondWithResult(_0x5c73ae,null))[_0x3421('0x43')](handleError(_0x5c73ae,null));};exports[_0x3421('0x51')]=function(_0x1c73b9,_0x4738e7){return db[_0x3421('0x2b')][_0x3421('0x4f')]({'where':{'id':_0x1c73b9[_0x3421('0x50')]['id']}})['then'](handleEntityNotFound(_0x4738e7,null))[_0x3421('0x25')](db[_0x3421('0x52')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1c73b9[_0x3421('0x50')]['id']}}))[_0x3421('0x25')](removeEntity(_0x4738e7,null))[_0x3421('0x43')](handleError(_0x4738e7,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index f6e10ec..64a7bbb 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 _0x10f2=['bluebird','./contactItemType.attributes','define','ContactItemType','lodash','util','../../config/logger','api','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x10f2,0xc1));var _0x210f=function(_0x3bd5e8,_0x41086b){_0x3bd5e8=_0x3bd5e8-0x0;var _0x4b9db9=_0x10f2[_0x3bd5e8];return _0x4b9db9;};'use strict';var _=require(_0x210f('0x0'));var util=require(_0x210f('0x1'));var logger=require(_0x210f('0x2'))(_0x210f('0x3'));var moment=require(_0x210f('0x4'));var BPromise=require(_0x210f('0x5'));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(_0x210f('0x6'));module['exports']=function(_0x4c89f2,_0x51fcd0){return _0x4c89f2[_0x210f('0x7')](_0x210f('0x8'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfa4=['./contactItemType.attributes','exports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xb25a86,_0xbf1a5){var _0x1c64bd=function(_0x1a3597){while(--_0x1a3597){_0xb25a86['push'](_0xb25a86['shift']());}};_0x1c64bd(++_0xbf1a5);}(_0xcfa4,0x162));var _0x4cfa=function(_0x208f71,_0x37c6a0){_0x208f71=_0x208f71-0x0;var _0x35a951=_0xcfa4[_0x208f71];return _0x35a951;};'use strict';var _=require(_0x4cfa('0x0'));var util=require(_0x4cfa('0x1'));var logger=require(_0x4cfa('0x2'))('api');var moment=require(_0x4cfa('0x3'));var BPromise=require(_0x4cfa('0x4'));var rp=require(_0x4cfa('0x5'));var fs=require('fs');var path=require(_0x4cfa('0x6'));var rimraf=require(_0x4cfa('0x7'));var config=require(_0x4cfa('0x8'));var attributes=require(_0x4cfa('0x9'));module[_0x4cfa('0xa')]=function(_0x3820d8,_0x5721e5){return _0x3820d8['define']('ContactItemType',attributes,{'tableName':'tools_contact_item_types','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 75d42a4..ae79af6 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 _0x29da=['info','request\x20sent','stringify','error','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1b08d4,_0x8a710c){var _0x9aef3e=function(_0x4da607){while(--_0x4da607){_0x1b08d4['push'](_0x1b08d4['shift']());}};_0x9aef3e(++_0x8a710c);}(_0x29da,0xf8));var _0xa29d=function(_0x2e1e1d,_0xc94d35){_0x2e1e1d=_0x2e1e1d-0x0;var _0x1fefb6=_0x29da[_0x2e1e1d];return _0x1fefb6;};'use strict';var _=require(_0xa29d('0x0'));var util=require(_0xa29d('0x1'));var moment=require('moment');var BPromise=require(_0xa29d('0x2'));var rs=require(_0xa29d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa29d('0x4'))['db'];var utils=require(_0xa29d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa29d('0x6'));var jayson=require(_0xa29d('0x7'));var client=jayson[_0xa29d('0x8')][_0xa29d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1461d5,_0x592367,_0x43e47a){return new BPromise(function(_0x26502a,_0x2bfe02){return client[_0xa29d('0xa')](_0x1461d5,_0x43e47a)[_0xa29d('0xb')](function(_0xf9d714){logger[_0xa29d('0xc')]('ContactItemType,\x20%s,\x20%s',_0x592367,_0xa29d('0xd'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x592367,'request\x20sent',JSON[_0xa29d('0xe')](_0xf9d714));if(_0xf9d714['error']){if(_0xf9d714[_0xa29d('0xf')]['code']===0x1f4){logger[_0xa29d('0xf')](_0xa29d('0x10'),_0x592367,_0xf9d714[_0xa29d('0xf')][_0xa29d('0x11')]);return _0x2bfe02(_0xf9d714[_0xa29d('0xf')][_0xa29d('0x11')]);}logger[_0xa29d('0xf')](_0xa29d('0x10'),_0x592367,_0xf9d714[_0xa29d('0xf')][_0xa29d('0x11')]);return _0x26502a(_0xf9d714[_0xa29d('0xf')][_0xa29d('0x11')]);}else{logger[_0xa29d('0xc')](_0xa29d('0x10'),_0x592367,_0xa29d('0xd'));_0x26502a(_0xf9d714[_0xa29d('0x12')][_0xa29d('0x11')]);}})[_0xa29d('0x13')](function(_0x239aab){logger[_0xa29d('0xf')]('ContactItemType,\x20%s,\x20%s',_0x592367,_0x239aab);_0x2bfe02(_0x239aab);});});} \ No newline at end of file +var _0x7b85=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment'];(function(_0xc4cdd0,_0x79755){var _0x300b3b=function(_0x310c71){while(--_0x310c71){_0xc4cdd0['push'](_0xc4cdd0['shift']());}};_0x300b3b(++_0x79755);}(_0x7b85,0x1b2));var _0x57b8=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x7b85[_0x313c96];return _0x522f53;};'use strict';var _=require(_0x57b8('0x0'));var util=require(_0x57b8('0x1'));var moment=require(_0x57b8('0x2'));var BPromise=require(_0x57b8('0x3'));var rs=require(_0x57b8('0x4'));var fs=require('fs');var Redis=require(_0x57b8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x57b8('0x6'));var logger=require(_0x57b8('0x7'))('rpc');var config=require(_0x57b8('0x8'));var jayson=require(_0x57b8('0x9'));var client=jayson[_0x57b8('0xa')][_0x57b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bd462,_0x44509f,_0x2c834d){return new BPromise(function(_0x24628b,_0x3b7830){return client[_0x57b8('0xc')](_0x4bd462,_0x2c834d)[_0x57b8('0xd')](function(_0x2bd07a){logger[_0x57b8('0xe')](_0x57b8('0xf'),_0x44509f,_0x57b8('0x10'));logger[_0x57b8('0x11')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x44509f,_0x57b8('0x10'),JSON[_0x57b8('0x12')](_0x2bd07a));if(_0x2bd07a[_0x57b8('0x13')]){if(_0x2bd07a['error'][_0x57b8('0x14')]===0x1f4){logger[_0x57b8('0x13')](_0x57b8('0xf'),_0x44509f,_0x2bd07a[_0x57b8('0x13')]['message']);return _0x3b7830(_0x2bd07a[_0x57b8('0x13')][_0x57b8('0x15')]);}logger[_0x57b8('0x13')](_0x57b8('0xf'),_0x44509f,_0x2bd07a[_0x57b8('0x13')]['message']);return _0x24628b(_0x2bd07a[_0x57b8('0x13')][_0x57b8('0x15')]);}else{logger[_0x57b8('0xe')](_0x57b8('0xf'),_0x44509f,_0x57b8('0x10'));_0x24628b(_0x2bd07a['result'][_0x57b8('0x15')]);}})[_0x57b8('0x16')](function(_0x501c02){logger[_0x57b8('0x13')](_0x57b8('0xf'),_0x44509f,_0x501c02);_0x3b7830(_0x501c02);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index b4e6792..89801a8 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 _0x1d75=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x11dc4e,_0x2016e4){var _0xcc6792=function(_0x5f5cfe){while(--_0x5f5cfe){_0x11dc4e['push'](_0x11dc4e['shift']());}};_0xcc6792(++_0x2016e4);}(_0x1d75,0x118));var _0x51d7=function(_0x4ba379,_0x5da19d){_0x4ba379=_0x4ba379-0x0;var _0x1a1ff8=_0x1d75[_0x4ba379];return _0x1a1ff8;};'use strict';var multer=require(_0x51d7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x51d7('0x1'));var express=require(_0x51d7('0x2'));var router=express['Router']();var fs_extra=require(_0x51d7('0x3'));var auth=require(_0x51d7('0x4'));var interaction=require(_0x51d7('0x5'));var config=require(_0x51d7('0x6'));var controller=require(_0x51d7('0x7'));router[_0x51d7('0x8')]('/',auth[_0x51d7('0x9')](),controller[_0x51d7('0xa')]);router[_0x51d7('0x8')](_0x51d7('0xb'),auth[_0x51d7('0x9')](),controller[_0x51d7('0xc')]);router[_0x51d7('0xd')]('/',auth[_0x51d7('0x9')](),controller[_0x51d7('0xe')]);router[_0x51d7('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x51d7('0x10')]);router[_0x51d7('0x11')](_0x51d7('0xb'),auth[_0x51d7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xef40=['connect-timeout','express','fs-extra','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','delete','exports','multer'];(function(_0x2fbbe0,_0x28a368){var _0x18d7c5=function(_0x464feb){while(--_0x464feb){_0x2fbbe0['push'](_0x2fbbe0['shift']());}};_0x18d7c5(++_0x28a368);}(_0xef40,0x8b));var _0x0ef4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xef40[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x0ef4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0ef4('0x1'));var express=require(_0x0ef4('0x2'));var router=express['Router']();var fs_extra=require(_0x0ef4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0ef4('0x4'));var config=require('../../config/environment');var controller=require(_0x0ef4('0x5'));router[_0x0ef4('0x6')]('/',auth[_0x0ef4('0x7')](),controller[_0x0ef4('0x8')]);router[_0x0ef4('0x6')](_0x0ef4('0x9'),auth['isAuthenticated'](),controller[_0x0ef4('0xa')]);router[_0x0ef4('0xb')]('/',auth[_0x0ef4('0x7')](),controller['create']);router['put'](_0x0ef4('0x9'),auth[_0x0ef4('0x7')](),controller['update']);router[_0x0ef4('0xc')](_0x0ef4('0x9'),auth[_0x0ef4('0x7')](),controller['destroy']);module[_0x0ef4('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c20ec42..6708666 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 _0x0713=['STRING','name'];(function(_0x497ce5,_0x37ff88){var _0x5234f5=function(_0x4f2854){while(--_0x4f2854){_0x497ce5['push'](_0x497ce5['shift']());}};_0x5234f5(++_0x37ff88);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x53dc4d,_0x15d6a3){var _0x381ec8=function(_0x1700fa){while(--_0x1700fa){_0x53dc4d['push'](_0x53dc4d['shift']());}};_0x381ec8(++_0x15d6a3);}(_0xb10b,0x12a));var _0xbb10=function(_0x20f288,_0x42b564){_0x20f288=_0x20f288-0x0;var _0x800caf=_0xb10b[_0x20f288];return _0x800caf;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index f81ce21..9256f3e 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 _0x84bb=['redis','defaults','localhost','./dashboard.socket','register','status','offset','undefined','limit','count','set','json','apply','save','update','destroy','then','get','CustomDashboards','sendStatus','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','rows','catch','show','params','keys','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x5f47a7,_0xb765cf){var _0x1a167c=function(_0x2b3029){while(--_0x2b3029){_0x5f47a7['push'](_0x5f47a7['shift']());}};_0x1a167c(++_0xb765cf);}(_0x84bb,0x161));var _0xb84b=function(_0x4c6b93,_0x19880d){_0x4c6b93=_0x4c6b93-0x0;var _0x119770=_0x84bb[_0x4c6b93];return _0x119770;};'use strict';var emlformat=require(_0xb84b('0x0'));var rimraf=require(_0xb84b('0x1'));var zipdir=require(_0xb84b('0x2'));var jsonpatch=require(_0xb84b('0x3'));var rp=require(_0xb84b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb84b('0x5'));var path=require(_0xb84b('0x6'));var sox=require('sox');var csv=require(_0xb84b('0x7'));var ejs=require(_0xb84b('0x8'));var fs=require('fs');var fs_extra=require(_0xb84b('0x9'));var _=require(_0xb84b('0xa'));var squel=require(_0xb84b('0xb'));var crypto=require('crypto');var jsforce=require(_0xb84b('0xc'));var deskjs=require(_0xb84b('0xd'));var toCsv=require(_0xb84b('0x7'));var querystring=require(_0xb84b('0xe'));var Papa=require(_0xb84b('0xf'));var Redis=require('ioredis');var authService=require(_0xb84b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb84b('0x11'));var logger=require('../../config/logger')(_0xb84b('0x12'));var utils=require(_0xb84b('0x13'));var config=require(_0xb84b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb84b('0x15'))['db'];config[_0xb84b('0x16')]=_[_0xb84b('0x17')](config['redis'],{'host':_0xb84b('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb84b('0x16')]));require(_0xb84b('0x19'))[_0xb84b('0x1a')](socket);function respondWithStatusCode(_0x1082f6,_0x7bd182){_0x7bd182=_0x7bd182||0xcc;return function(_0x106030){if(_0x106030){return _0x1082f6['sendStatus'](_0x7bd182);}return _0x1082f6[_0xb84b('0x1b')](_0x7bd182)['end']();};}function respondWithResult(_0x5090b6,_0x413c84){_0x413c84=_0x413c84||0xc8;return function(_0xb72894){if(_0xb72894){return _0x5090b6['status'](_0x413c84)['json'](_0xb72894);}};}function respondWithFilteredResult(_0x2e5e14,_0x42d3bc){return function(_0x206bbb){if(_0x206bbb){var _0x5a7b21=typeof _0x42d3bc[_0xb84b('0x1c')]===_0xb84b('0x1d')&&typeof _0x42d3bc[_0xb84b('0x1e')]===_0xb84b('0x1d');var _0x1a75a4=_0x206bbb['count'];var _0x52a81b=_0x5a7b21?0x0:_0x42d3bc[_0xb84b('0x1c')];var _0x267ef6=_0x5a7b21?_0x206bbb[_0xb84b('0x1f')]:_0x42d3bc[_0xb84b('0x1c')]+_0x42d3bc[_0xb84b('0x1e')];var _0x8280d3;if(_0x267ef6>=_0x1a75a4){_0x267ef6=_0x1a75a4;_0x8280d3=0xc8;}else{_0x8280d3=0xce;}_0x2e5e14[_0xb84b('0x1b')](_0x8280d3);return _0x2e5e14[_0xb84b('0x20')]('Content-Range',_0x52a81b+'-'+_0x267ef6+'/'+_0x1a75a4)[_0xb84b('0x21')](_0x206bbb);}return null;};}function patchUpdates(_0x27d29a){return function(_0x2e31e5){try{jsonpatch[_0xb84b('0x22')](_0x2e31e5,_0x27d29a,!![]);}catch(_0x30bc7a){return BPromise['reject'](_0x30bc7a);}return _0x2e31e5[_0xb84b('0x23')]();};}function saveUpdates(_0x4b69c6,_0x1e72ee){return function(_0x4cb4a6){if(_0x4cb4a6){return _0x4cb4a6[_0xb84b('0x24')](_0x4b69c6)['then'](function(_0xec6e16){return _0xec6e16;});}return null;};}function removeEntity(_0x191a87,_0x2c47b1){return function(_0x8501){if(_0x8501){return _0x8501[_0xb84b('0x25')]()[_0xb84b('0x26')](function(){var _0xb5b447=_0x8501[_0xb84b('0x27')]({'plain':!![]});var _0xddef30=_0xb84b('0x28');return db['UserProfileResource'][_0xb84b('0x25')]({'where':{'type':_0xddef30,'resourceId':_0xb5b447['id']}})[_0xb84b('0x26')](function(){return _0x8501;});})[_0xb84b('0x26')](function(){_0x191a87[_0xb84b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a9a9,_0x4bafba){return function(_0x1da857){if(!_0x1da857){_0x32a9a9[_0xb84b('0x29')](0x194);}return _0x1da857;};}function handleError(_0x5cf62d,_0x17cda9){_0x17cda9=_0x17cda9||0x1f4;return function(_0x4382f8){logger[_0xb84b('0x2a')](_0x4382f8[_0xb84b('0x2b')]);if(_0x4382f8[_0xb84b('0x2c')]){delete _0x4382f8[_0xb84b('0x2c')];}_0x5cf62d['status'](_0x17cda9)[_0xb84b('0x2d')](_0x4382f8);};}exports[_0xb84b('0x2e')]=function(_0x88b8db,_0x534e18){var _0x40e39f={},_0x1031bb={},_0x22b61a={'count':0x0,'rows':[]};var _0x55a22b=_[_0xb84b('0x2f')](db[_0xb84b('0x30')][_0xb84b('0x31')],function(_0x399586){return{'name':_0x399586[_0xb84b('0x32')],'type':_0x399586[_0xb84b('0x33')][_0xb84b('0x34')]};});_0x1031bb[_0xb84b('0x35')]=_[_0xb84b('0x2f')](_0x55a22b,_0xb84b('0x2c'));_0x1031bb[_0xb84b('0x36')]=_['keys'](_0x88b8db[_0xb84b('0x36')]);_0x1031bb[_0xb84b('0x37')]=_[_0xb84b('0x38')](_0x1031bb[_0xb84b('0x35')],_0x1031bb[_0xb84b('0x36')]);_0x40e39f[_0xb84b('0x39')]=_[_0xb84b('0x38')](_0x1031bb[_0xb84b('0x35')],qs[_0xb84b('0x3a')](_0x88b8db[_0xb84b('0x36')]['fields']));_0x40e39f[_0xb84b('0x39')]=_0x40e39f[_0xb84b('0x39')]['length']?_0x40e39f[_0xb84b('0x39')]:_0x1031bb[_0xb84b('0x35')];if(!_0x88b8db[_0xb84b('0x36')][_0xb84b('0x3b')](_0xb84b('0x3c'))){_0x40e39f[_0xb84b('0x1e')]=qs[_0xb84b('0x1e')](_0x88b8db[_0xb84b('0x36')][_0xb84b('0x1e')]);_0x40e39f[_0xb84b('0x1c')]=qs[_0xb84b('0x1c')](_0x88b8db[_0xb84b('0x36')][_0xb84b('0x1c')]);}_0x40e39f['order']=qs[_0xb84b('0x3d')](_0x88b8db[_0xb84b('0x36')][_0xb84b('0x3d')]);_0x40e39f['where']=qs[_0xb84b('0x37')](_[_0xb84b('0x3e')](_0x88b8db['query'],_0x1031bb[_0xb84b('0x37')]),_0x55a22b);if(_0x88b8db[_0xb84b('0x36')][_0xb84b('0x3f')]){_0x40e39f['where']=_[_0xb84b('0x40')](_0x40e39f['where'],{'$or':_[_0xb84b('0x2f')](_0x55a22b,function(_0x3cb627){if(_0x3cb627[_0xb84b('0x33')]!==_0xb84b('0x41')){var _0x42250a={};_0x42250a[_0x3cb627['name']]={'$like':'%'+_0x88b8db[_0xb84b('0x36')][_0xb84b('0x3f')]+'%'};return _0x42250a;}})});}_0x40e39f=_[_0xb84b('0x40')]({},_0x40e39f,_0x88b8db[_0xb84b('0x42')]);var _0x514cf0={'where':_0x40e39f[_0xb84b('0x43')]};return db[_0xb84b('0x30')]['count'](_0x514cf0)[_0xb84b('0x26')](function(_0x587223){_0x22b61a[_0xb84b('0x1f')]=_0x587223;if(_0x88b8db[_0xb84b('0x36')][_0xb84b('0x44')]){_0x40e39f[_0xb84b('0x45')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x40e39f);})[_0xb84b('0x26')](function(_0x5500c3){_0x22b61a[_0xb84b('0x46')]=_0x5500c3;return _0x22b61a;})[_0xb84b('0x26')](respondWithFilteredResult(_0x534e18,_0x40e39f))[_0xb84b('0x47')](handleError(_0x534e18,null));};exports[_0xb84b('0x48')]=function(_0x3bc65a,_0x2559c7){var _0x5d17eb={'raw':![],'where':{'id':_0x3bc65a[_0xb84b('0x49')]['id']}},_0x105e9a={};_0x105e9a[_0xb84b('0x35')]=_[_0xb84b('0x4a')](db['Dashboard']['rawAttributes']);_0x105e9a[_0xb84b('0x36')]=_['keys'](_0x3bc65a[_0xb84b('0x36')]);_0x105e9a[_0xb84b('0x37')]=_[_0xb84b('0x38')](_0x105e9a[_0xb84b('0x35')],_0x105e9a[_0xb84b('0x36')]);_0x5d17eb[_0xb84b('0x39')]=_['intersection'](_0x105e9a['model'],qs['fields'](_0x3bc65a[_0xb84b('0x36')][_0xb84b('0x3a')]));_0x5d17eb[_0xb84b('0x39')]=_0x5d17eb[_0xb84b('0x39')][_0xb84b('0x4b')]?_0x5d17eb[_0xb84b('0x39')]:_0x105e9a['model'];if(_0x3bc65a[_0xb84b('0x36')][_0xb84b('0x44')]){_0x5d17eb['include']=[{'all':!![]}];}_0x5d17eb=_['merge']({},_0x5d17eb,_0x3bc65a[_0xb84b('0x42')]);return db[_0xb84b('0x30')][_0xb84b('0x4c')](_0x5d17eb)[_0xb84b('0x26')](handleEntityNotFound(_0x2559c7,null))[_0xb84b('0x26')](respondWithResult(_0x2559c7,null))[_0xb84b('0x47')](handleError(_0x2559c7,null));};exports[_0xb84b('0x4d')]=function(_0x4b65d5,_0x56b3b9){return db['Dashboard'][_0xb84b('0x4d')](_0x4b65d5['body'],{})[_0xb84b('0x26')](function(_0x5605cd){var _0xc1c6ef=_0x4b65d5['user']['get']({'plain':!![]});if(!_0xc1c6ef)throw new Error(_0xb84b('0x4e'));if(_0xc1c6ef[_0xb84b('0x4f')]===_0xb84b('0x50')){var _0x5ad7cb=_0x5605cd[_0xb84b('0x27')]({'plain':!![]});var _0x578388=_0xb84b('0x28');return db['UserProfileSection'][_0xb84b('0x4c')]({'where':{'name':_0x578388,'userProfileId':_0xc1c6ef[_0xb84b('0x51')]},'raw':!![]})[_0xb84b('0x26')](function(_0x17b256){if(_0x17b256&&_0x17b256[_0xb84b('0x52')]===0x0){return db['UserProfileResource'][_0xb84b('0x4d')]({'name':_0x5ad7cb[_0xb84b('0x2c')],'resourceId':_0x5ad7cb['id'],'type':_0x17b256[_0xb84b('0x2c')],'sectionId':_0x17b256['id']},{})[_0xb84b('0x26')](function(){return _0x5605cd;});}else{return _0x5605cd;}})[_0xb84b('0x47')](function(_0x1128b5){logger[_0xb84b('0x2a')](_0xb84b('0x53'),_0x1128b5);throw _0x1128b5;});}return _0x5605cd;})[_0xb84b('0x26')](respondWithResult(_0x56b3b9,0xc9))[_0xb84b('0x47')](handleError(_0x56b3b9,null));};exports[_0xb84b('0x54')]=function(_0x193150,_0x4a0280){var _0x5da318={'where':{'id':_0x193150[_0xb84b('0x49')]['id']}},_0x44d22f={};_0x44d22f[_0xb84b('0x35')]=_[_0xb84b('0x4a')](db[_0xb84b('0x30')]['rawAttributes']);_0x5da318[_0xb84b('0x39')]=_[_0xb84b('0x38')](_0x44d22f[_0xb84b('0x35')],qs[_0xb84b('0x3a')](_0x193150[_0xb84b('0x36')][_0xb84b('0x3a')]));_0x5da318['attributes']=_0x5da318[_0xb84b('0x39')][_0xb84b('0x4b')]?_0x5da318[_0xb84b('0x39')]:_0x44d22f[_0xb84b('0x35')];if(_0x193150[_0xb84b('0x36')][_0xb84b('0x44')]){_0x5da318[_0xb84b('0x45')]=[{'all':!![]}];}_0x5da318=_[_0xb84b('0x40')]({},_0x5da318,_0x193150[_0xb84b('0x42')]);return db[_0xb84b('0x30')][_0xb84b('0x4c')](_0x5da318)[_0xb84b('0x26')](handleEntityNotFound(_0x4a0280,null))[_0xb84b('0x26')](function(_0x3227fd){if(_0x3227fd){var _0x1889f5=_0x3227fd[_0xb84b('0x27')]({'plain':!![]});_0x1889f5=qs[_0xb84b('0x55')](_0x1889f5,['id',_0xb84b('0x56'),_0xb84b('0x57')]);_0x193150[_0xb84b('0x58')]=_[_0xb84b('0x55')](_0x193150[_0xb84b('0x58')],['id','createdAt',_0xb84b('0x57')]);return db[_0xb84b('0x30')][_0xb84b('0x4d')](_[_0xb84b('0x40')](_0x1889f5,_0x193150[_0xb84b('0x58')]),{'include':_0x193150[_0xb84b('0x36')][_0xb84b('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x37c0da){var _0x27b085=_0x193150[_0xb84b('0x50')]['get']({'plain':!![]});if(!_0x27b085)throw new Error(_0xb84b('0x4e'));if(_0x27b085[_0xb84b('0x4f')]===_0xb84b('0x50')){var _0x442369=_0x37c0da[_0xb84b('0x27')]({'plain':!![]});var _0x3f60b3=_0xb84b('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x3f60b3,'userProfileId':_0x27b085[_0xb84b('0x51')]},'raw':!![]})['then'](function(_0x5aea9f){if(_0x5aea9f&&_0x5aea9f[_0xb84b('0x52')]===0x0){return db['UserProfileResource'][_0xb84b('0x4d')]({'name':_0x442369[_0xb84b('0x2c')],'resourceId':_0x442369['id'],'type':_0x5aea9f['name'],'sectionId':_0x5aea9f['id']},{})[_0xb84b('0x26')](function(){return _0x37c0da;});}else{return _0x37c0da;}})[_0xb84b('0x47')](function(_0x532487){logger[_0xb84b('0x2a')](_0xb84b('0x53'),_0x532487);throw _0x532487;});}return _0x37c0da;});}})[_0xb84b('0x26')](respondWithResult(_0x4a0280,0xc9))[_0xb84b('0x47')](handleError(_0x4a0280,null));};exports[_0xb84b('0x24')]=function(_0x4ace4f,_0x546119){if(_0x4ace4f[_0xb84b('0x58')]['id']){delete _0x4ace4f[_0xb84b('0x58')]['id'];}return db['Dashboard'][_0xb84b('0x4c')]({'where':{'id':_0x4ace4f[_0xb84b('0x49')]['id']}})['then'](handleEntityNotFound(_0x546119,null))[_0xb84b('0x26')](saveUpdates(_0x4ace4f[_0xb84b('0x58')],null))['then'](respondWithResult(_0x546119,null))[_0xb84b('0x47')](handleError(_0x546119,null));};exports[_0xb84b('0x25')]=function(_0x4d70e6,_0x321afe){return db['Dashboard'][_0xb84b('0x4c')]({'where':{'id':_0x4d70e6[_0xb84b('0x49')]['id']}})[_0xb84b('0x26')](handleEntityNotFound(_0x321afe,null))[_0xb84b('0x26')](removeEntity(_0x321afe,null))[_0xb84b('0x47')](handleError(_0x321afe,null));};function widgetAttributes(_0x3da963){try{switch(_0x3da963[_0xb84b('0x33')]){case'iframe':return[{'name':_0xb84b('0x59'),'value':_0x3da963['attrUrl']||(_0x3da963['attrs']&&_0x3da963[_0xb84b('0x5a')][0x0]?_0x3da963[_0xb84b('0x5a')][0x0][_0xb84b('0x5b')]:undefined)||_0xb84b('0x5c')}];case _0xb84b('0x5d'):return[{'name':'attrPath','value':_0x3da963['attrPath']||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963['attrs'][0x0]?_0x3da963[_0xb84b('0x5a')][0x0][_0xb84b('0x5b')]:undefined)||''}];case _0xb84b('0x5e'):return[{'name':_0xb84b('0x5f'),'value':_0x3da963[_0xb84b('0x5f')]||(_0x3da963['attrs']&&_0x3da963[_0xb84b('0x5a')][0x0]?_0x3da963['attrs'][0x0]['value']:undefined)||_0xb84b('0x60')},{'name':_0xb84b('0x61'),'value':_0x3da963[_0xb84b('0x61')]||(_0x3da963['attrs']&&_0x3da963[_0xb84b('0x5a')][0x1]?_0x3da963['attrs'][0x1][_0xb84b('0x5b')]:undefined)||_0xb84b('0x62')},{'name':_0xb84b('0x63'),'value':_0x3da963[_0xb84b('0x63')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963['attrs'][0x2]?_0x3da963[_0xb84b('0x5a')][0x2][_0xb84b('0x5b')]:undefined)||0xc}];case _0xb84b('0x64'):return[{'name':_0xb84b('0x65'),'value':_0x3da963['attrMetric']||(_0x3da963['attrs']&&_0x3da963['attrs'][0x0]?_0x3da963['attrs'][0x0][_0xb84b('0x5b')]:undefined)||_0xb84b('0x66')},{'name':_0xb84b('0x67'),'value':_0x3da963['attrVoiceQueues']||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0x1]?_0x3da963[_0xb84b('0x5a')][0x1][_0xb84b('0x5b')]:undefined)||[]},{'name':_0xb84b('0x63'),'value':_0x3da963[_0xb84b('0x63')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963['attrs'][0x2]?_0x3da963['attrs'][0x2][_0xb84b('0x5b')]:undefined)||0x14},{'name':_0xb84b('0x68'),'value':_0x3da963['attrChannel']||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0x3]?_0x3da963['attrs'][0x3][_0xb84b('0x5b')]:undefined)||_0xb84b('0x69')},{'name':'attrEmailAccounts','value':_0x3da963[_0xb84b('0x6a')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963['attrs'][0x4]?_0x3da963['attrs'][0x4][_0xb84b('0x5b')]:undefined)||''},{'name':_0xb84b('0x6b'),'value':_0x3da963[_0xb84b('0x6b')]||(_0x3da963['attrs']&&_0x3da963[_0xb84b('0x5a')][0x5]?_0x3da963['attrs'][0x5][_0xb84b('0x5b')]:undefined)||''},{'name':_0xb84b('0x6c'),'value':_0x3da963[_0xb84b('0x6c')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0x6]?_0x3da963[_0xb84b('0x5a')][0x6][_0xb84b('0x5b')]:undefined)||''},{'name':_0xb84b('0x6d'),'value':_0x3da963[_0xb84b('0x6d')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963['attrs'][0x7]?_0x3da963[_0xb84b('0x5a')][0x7]['value']:undefined)||''},{'name':_0xb84b('0x6e'),'value':_0x3da963[_0xb84b('0x6e')]||(_0x3da963['attrs']&&_0x3da963[_0xb84b('0x5a')][0x8]?_0x3da963[_0xb84b('0x5a')][0x8][_0xb84b('0x5b')]:undefined)||''},{'name':_0xb84b('0x6f'),'value':_0x3da963[_0xb84b('0x6f')]||(_0x3da963['attrs']&&_0x3da963[_0xb84b('0x5a')][0x9]?_0x3da963[_0xb84b('0x5a')][0x9][_0xb84b('0x5b')]:undefined)||''}];case'multibar-chart':case _0xb84b('0x70'):return[{'name':'attrSerie1','value':_0x3da963['attrSerie1']||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0x0]?_0x3da963[_0xb84b('0x5a')][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x3da963[_0xb84b('0x71')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0x1]?_0x3da963['attrs'][0x1][_0xb84b('0x5b')]:undefined)||null},{'name':_0xb84b('0x72'),'value':_0x3da963[_0xb84b('0x72')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0x2]?_0x3da963['attrs'][0x2]['value']:undefined)||null},{'name':_0xb84b('0x67'),'value':_0x3da963[_0xb84b('0x67')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0x3]?_0x3da963['attrs'][0x3][_0xb84b('0x5b')]:undefined)||[]},{'name':'attrChannel','value':_0x3da963[_0xb84b('0x68')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0x4]?_0x3da963[_0xb84b('0x5a')][0x4]['value']:undefined)||_0xb84b('0x69')},{'name':_0xb84b('0x6a'),'value':_0x3da963['attrEmailAccounts']||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0x5]?_0x3da963['attrs'][0x5][_0xb84b('0x5b')]:undefined)||''},{'name':_0xb84b('0x6b'),'value':_0x3da963['attrFaxAccounts']||(_0x3da963['attrs']&&_0x3da963[_0xb84b('0x5a')][0x6]?_0x3da963[_0xb84b('0x5a')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x3da963['attrSmsAccounts']||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963['attrs'][0x7]?_0x3da963['attrs'][0x7][_0xb84b('0x5b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3da963[_0xb84b('0x6d')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0x8]?_0x3da963['attrs'][0x8][_0xb84b('0x5b')]:undefined)||''},{'name':_0xb84b('0x6e'),'value':_0x3da963['attrWhatsappAccounts']||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0x9]?_0x3da963[_0xb84b('0x5a')][0x9][_0xb84b('0x5b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3da963['attrChatWebsites']||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0xa]?_0x3da963[_0xb84b('0x5a')][0xa][_0xb84b('0x5b')]:undefined)||''}];case _0xb84b('0x73'):return[{'name':_0xb84b('0x74'),'type':_0x3da963[_0xb84b('0x75')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963['attrs'][0x0]?_0x3da963['attrs'][0x0][_0xb84b('0x33')]:undefined)||null,'value':_0x3da963[_0xb84b('0x74')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963['attrs'][0x0]?_0x3da963[_0xb84b('0x5a')][0x0]['value']:undefined)||null},{'name':_0xb84b('0x76'),'value':_0x3da963[_0xb84b('0x76')]||(_0x3da963[_0xb84b('0x5a')]&&_0x3da963[_0xb84b('0x5a')][0x1]?_0x3da963[_0xb84b('0x5a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3a4d5e){logger[_0xb84b('0x2a')]('widgetAttributes:\x20%s',JSON[_0xb84b('0x77')](_0x3a4d5e));return[];}}exports[_0xb84b('0x78')]=function(_0x323695,_0x47c39f,_0x520ade){if(_0x323695[_0xb84b('0x58')]['id']){delete _0x323695[_0xb84b('0x58')]['id'];}return db[_0xb84b('0x30')][_0xb84b('0x4c')]({'where':{'id':_0x323695[_0xb84b('0x49')]['id']}})[_0xb84b('0x26')](handleEntityNotFound(_0x47c39f,null))['then'](function(_0x4079a0){if(_0x4079a0){_0x323695['body'][_0xb84b('0x79')]=_0x4079a0['id'];_0x323695[_0xb84b('0x58')][_0xb84b('0x5a')]=widgetAttributes(_0x323695[_0xb84b('0x58')]);return db[_0xb84b('0x7a')][_0xb84b('0x4d')](_0x323695[_0xb84b('0x58')]);}})[_0xb84b('0x26')](respondWithResult(_0x47c39f,null))['catch'](handleError(_0x47c39f,null));};exports[_0xb84b('0x7b')]=function(_0x5dadd7,_0x3cf7dc,_0x2ab47b){var _0x709cf2={};var _0x457976={};var _0x49457c;var _0x2cff40;return db['Dashboard']['findOne']({'where':{'id':_0x5dadd7[_0xb84b('0x49')]['id']}})[_0xb84b('0x26')](handleEntityNotFound(_0x3cf7dc,null))[_0xb84b('0x26')](function(_0x5b740d){if(_0x5b740d){_0x49457c=_0x5b740d;_0x457976[_0xb84b('0x35')]=_[_0xb84b('0x4a')](db[_0xb84b('0x7a')][_0xb84b('0x31')]);_0x457976[_0xb84b('0x36')]=_[_0xb84b('0x4a')](_0x5dadd7['query']);_0x457976['filters']=_['intersection'](_0x457976['model'],_0x457976[_0xb84b('0x36')]);_0x709cf2[_0xb84b('0x39')]=_[_0xb84b('0x38')](_0x457976[_0xb84b('0x35')],qs[_0xb84b('0x3a')](_0x5dadd7['query'][_0xb84b('0x3a')]));_0x709cf2[_0xb84b('0x39')]=_0x709cf2[_0xb84b('0x39')]['length']?_0x709cf2[_0xb84b('0x39')]:_0x457976[_0xb84b('0x35')];_0x709cf2[_0xb84b('0x7c')]=qs[_0xb84b('0x3d')](_0x5dadd7[_0xb84b('0x36')][_0xb84b('0x3d')]);_0x709cf2[_0xb84b('0x43')]=qs[_0xb84b('0x37')](_['pick'](_0x5dadd7[_0xb84b('0x36')],_0x457976[_0xb84b('0x37')]));if(_0x5dadd7[_0xb84b('0x36')][_0xb84b('0x3f')]){_0x709cf2[_0xb84b('0x43')]=_[_0xb84b('0x40')](_0x709cf2[_0xb84b('0x43')],{'$or':_[_0xb84b('0x2f')](_0x709cf2[_0xb84b('0x39')],function(_0x415000){var _0x41802b={};_0x41802b[_0x415000]={'$like':'%'+_0x5dadd7[_0xb84b('0x36')]['filter']+'%'};return _0x41802b;})});}_0x709cf2=_[_0xb84b('0x40')]({},_0x709cf2,_0x5dadd7[_0xb84b('0x42')]);return _0x49457c[_0xb84b('0x7b')](_0x709cf2);}})[_0xb84b('0x26')](function(_0x42fc1a){if(_0x42fc1a){_0x2cff40=_0x42fc1a[_0xb84b('0x4b')];if(!_0x5dadd7['query'][_0xb84b('0x3b')](_0xb84b('0x3c'))){_0x709cf2[_0xb84b('0x1e')]=qs[_0xb84b('0x1e')](_0x5dadd7['query'][_0xb84b('0x1e')]);_0x709cf2[_0xb84b('0x1c')]=qs['offset'](_0x5dadd7[_0xb84b('0x36')][_0xb84b('0x1c')]);}return _0x49457c[_0xb84b('0x7b')](_0x709cf2);}})[_0xb84b('0x26')](function(_0x1acfef){if(_0x1acfef){return _0x1acfef?{'count':_0x2cff40,'rows':_0x1acfef}:null;}})[_0xb84b('0x26')](respondWithResult(_0x3cf7dc,null))['catch'](handleError(_0x3cf7dc,null));}; \ No newline at end of file +var _0x4486=['find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','addItem','DashboardId','DashboardItem','getItems','order','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','CustomDashboards','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Dashboard','includeAll','include','findAll','rows','catch','show','params'];(function(_0x395b5c,_0x493e2d){var _0xc6466e=function(_0x550048){while(--_0x550048){_0x395b5c['push'](_0x395b5c['shift']());}};_0xc6466e(++_0x493e2d);}(_0x4486,0x1af));var _0x6448=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0x4486[_0x513047];return _0x15b779;};'use strict';var emlformat=require(_0x6448('0x0'));var rimraf=require(_0x6448('0x1'));var zipdir=require(_0x6448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6448('0x3'));var moment=require(_0x6448('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6448('0x5'));var util=require('util');var path=require(_0x6448('0x6'));var sox=require(_0x6448('0x7'));var csv=require(_0x6448('0x8'));var ejs=require(_0x6448('0x9'));var fs=require('fs');var fs_extra=require(_0x6448('0xa'));var _=require('lodash');var squel=require(_0x6448('0xb'));var crypto=require(_0x6448('0xc'));var jsforce=require(_0x6448('0xd'));var deskjs=require(_0x6448('0xe'));var toCsv=require(_0x6448('0x8'));var querystring=require(_0x6448('0xf'));var Papa=require(_0x6448('0x10'));var Redis=require(_0x6448('0x11'));var authService=require(_0x6448('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6448('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6448('0x14'))(_0x6448('0x15'));var utils=require('../../config/utils');var config=require(_0x6448('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6448('0x17'))['db'];config[_0x6448('0x18')]=_[_0x6448('0x19')](config[_0x6448('0x18')],{'host':_0x6448('0x1a'),'port':0x18eb});var socket=require(_0x6448('0x1b'))(new Redis(config[_0x6448('0x18')]));require(_0x6448('0x1c'))['register'](socket);function respondWithStatusCode(_0x5d1617,_0x3c4429){_0x3c4429=_0x3c4429||0xcc;return function(_0x360c29){if(_0x360c29){return _0x5d1617[_0x6448('0x1d')](_0x3c4429);}return _0x5d1617[_0x6448('0x1e')](_0x3c4429)[_0x6448('0x1f')]();};}function respondWithResult(_0x495678,_0x483248){_0x483248=_0x483248||0xc8;return function(_0x752b05){if(_0x752b05){return _0x495678[_0x6448('0x1e')](_0x483248)[_0x6448('0x20')](_0x752b05);}};}function respondWithFilteredResult(_0x50c1e6,_0x2bf3c6){return function(_0x2cd245){if(_0x2cd245){var _0x3091d3=typeof _0x2bf3c6[_0x6448('0x21')]===_0x6448('0x22')&&typeof _0x2bf3c6[_0x6448('0x23')]==='undefined';var _0x3636c6=_0x2cd245[_0x6448('0x24')];var _0x465c76=_0x3091d3?0x0:_0x2bf3c6[_0x6448('0x21')];var _0x2d57ef=_0x3091d3?_0x2cd245[_0x6448('0x24')]:_0x2bf3c6[_0x6448('0x21')]+_0x2bf3c6['limit'];var _0x306618;if(_0x2d57ef>=_0x3636c6){_0x2d57ef=_0x3636c6;_0x306618=0xc8;}else{_0x306618=0xce;}_0x50c1e6[_0x6448('0x1e')](_0x306618);return _0x50c1e6[_0x6448('0x25')](_0x6448('0x26'),_0x465c76+'-'+_0x2d57ef+'/'+_0x3636c6)[_0x6448('0x20')](_0x2cd245);}return null;};}function patchUpdates(_0x49ca5a){return function(_0x372778){try{jsonpatch[_0x6448('0x27')](_0x372778,_0x49ca5a,!![]);}catch(_0x12eace){return BPromise['reject'](_0x12eace);}return _0x372778[_0x6448('0x28')]();};}function saveUpdates(_0xc00102,_0x357027){return function(_0x2ea937){if(_0x2ea937){return _0x2ea937[_0x6448('0x29')](_0xc00102)['then'](function(_0x47adb0){return _0x47adb0;});}return null;};}function removeEntity(_0x501627,_0x2740b1){return function(_0x223a2e){if(_0x223a2e){return _0x223a2e[_0x6448('0x2a')]()[_0x6448('0x2b')](function(){var _0x4ef319=_0x223a2e[_0x6448('0x2c')]({'plain':!![]});var _0xc06805=_0x6448('0x2d');return db[_0x6448('0x2e')]['destroy']({'where':{'type':_0xc06805,'resourceId':_0x4ef319['id']}})[_0x6448('0x2b')](function(){return _0x223a2e;});})[_0x6448('0x2b')](function(){_0x501627[_0x6448('0x1e')](0xcc)[_0x6448('0x1f')]();});}};}function handleEntityNotFound(_0x156e25,_0x43ee9b){return function(_0x433acb){if(!_0x433acb){_0x156e25[_0x6448('0x1d')](0x194);}return _0x433acb;};}function handleError(_0x44a0d4,_0x171c0b){_0x171c0b=_0x171c0b||0x1f4;return function(_0x4e2a73){logger[_0x6448('0x2f')](_0x4e2a73[_0x6448('0x30')]);if(_0x4e2a73[_0x6448('0x31')]){delete _0x4e2a73[_0x6448('0x31')];}_0x44a0d4[_0x6448('0x1e')](_0x171c0b)[_0x6448('0x32')](_0x4e2a73);};}exports['index']=function(_0x37626d,_0x2b9015){var _0x45d4e5={},_0x1e8418={},_0x1f9c1d={'count':0x0,'rows':[]};var _0xafe006=_[_0x6448('0x33')](db['Dashboard'][_0x6448('0x34')],function(_0x2b91b2){return{'name':_0x2b91b2[_0x6448('0x35')],'type':_0x2b91b2[_0x6448('0x36')][_0x6448('0x37')]};});_0x1e8418[_0x6448('0x38')]=_[_0x6448('0x33')](_0xafe006,_0x6448('0x31'));_0x1e8418[_0x6448('0x39')]=_[_0x6448('0x3a')](_0x37626d[_0x6448('0x39')]);_0x1e8418[_0x6448('0x3b')]=_[_0x6448('0x3c')](_0x1e8418[_0x6448('0x38')],_0x1e8418['query']);_0x45d4e5[_0x6448('0x3d')]=_[_0x6448('0x3c')](_0x1e8418[_0x6448('0x38')],qs['fields'](_0x37626d[_0x6448('0x39')][_0x6448('0x3e')]));_0x45d4e5[_0x6448('0x3d')]=_0x45d4e5[_0x6448('0x3d')][_0x6448('0x3f')]?_0x45d4e5[_0x6448('0x3d')]:_0x1e8418[_0x6448('0x38')];if(!_0x37626d['query'][_0x6448('0x40')](_0x6448('0x41'))){_0x45d4e5[_0x6448('0x23')]=qs[_0x6448('0x23')](_0x37626d[_0x6448('0x39')][_0x6448('0x23')]);_0x45d4e5[_0x6448('0x21')]=qs[_0x6448('0x21')](_0x37626d[_0x6448('0x39')][_0x6448('0x21')]);}_0x45d4e5['order']=qs[_0x6448('0x42')](_0x37626d[_0x6448('0x39')][_0x6448('0x42')]);_0x45d4e5[_0x6448('0x43')]=qs['filters'](_[_0x6448('0x44')](_0x37626d['query'],_0x1e8418[_0x6448('0x3b')]),_0xafe006);if(_0x37626d['query'][_0x6448('0x45')]){_0x45d4e5[_0x6448('0x43')]=_[_0x6448('0x46')](_0x45d4e5[_0x6448('0x43')],{'$or':_[_0x6448('0x33')](_0xafe006,function(_0x1b72a2){if(_0x1b72a2[_0x6448('0x36')]!==_0x6448('0x47')){var _0x533f76={};_0x533f76[_0x1b72a2[_0x6448('0x31')]]={'$like':'%'+_0x37626d['query'][_0x6448('0x45')]+'%'};return _0x533f76;}})});}_0x45d4e5=_[_0x6448('0x46')]({},_0x45d4e5,_0x37626d[_0x6448('0x48')]);var _0x511c8e={'where':_0x45d4e5[_0x6448('0x43')]};return db[_0x6448('0x49')]['count'](_0x511c8e)[_0x6448('0x2b')](function(_0x5d31e9){_0x1f9c1d[_0x6448('0x24')]=_0x5d31e9;if(_0x37626d[_0x6448('0x39')][_0x6448('0x4a')]){_0x45d4e5[_0x6448('0x4b')]=[{'all':!![]}];}return db[_0x6448('0x49')][_0x6448('0x4c')](_0x45d4e5);})[_0x6448('0x2b')](function(_0x32de42){_0x1f9c1d[_0x6448('0x4d')]=_0x32de42;return _0x1f9c1d;})[_0x6448('0x2b')](respondWithFilteredResult(_0x2b9015,_0x45d4e5))[_0x6448('0x4e')](handleError(_0x2b9015,null));};exports[_0x6448('0x4f')]=function(_0x1377e3,_0x4035e4){var _0x52051d={'raw':![],'where':{'id':_0x1377e3[_0x6448('0x50')]['id']}},_0x28d9f5={};_0x28d9f5[_0x6448('0x38')]=_[_0x6448('0x3a')](db[_0x6448('0x49')][_0x6448('0x34')]);_0x28d9f5[_0x6448('0x39')]=_[_0x6448('0x3a')](_0x1377e3['query']);_0x28d9f5[_0x6448('0x3b')]=_[_0x6448('0x3c')](_0x28d9f5[_0x6448('0x38')],_0x28d9f5['query']);_0x52051d[_0x6448('0x3d')]=_[_0x6448('0x3c')](_0x28d9f5['model'],qs['fields'](_0x1377e3[_0x6448('0x39')][_0x6448('0x3e')]));_0x52051d[_0x6448('0x3d')]=_0x52051d[_0x6448('0x3d')]['length']?_0x52051d[_0x6448('0x3d')]:_0x28d9f5[_0x6448('0x38')];if(_0x1377e3[_0x6448('0x39')][_0x6448('0x4a')]){_0x52051d['include']=[{'all':!![]}];}_0x52051d=_[_0x6448('0x46')]({},_0x52051d,_0x1377e3[_0x6448('0x48')]);return db[_0x6448('0x49')][_0x6448('0x51')](_0x52051d)[_0x6448('0x2b')](handleEntityNotFound(_0x4035e4,null))[_0x6448('0x2b')](respondWithResult(_0x4035e4,null))[_0x6448('0x4e')](handleError(_0x4035e4,null));};exports[_0x6448('0x52')]=function(_0x33e3cc,_0x51740e){return db['Dashboard'][_0x6448('0x52')](_0x33e3cc['body'],{})[_0x6448('0x2b')](function(_0xf79568){var _0x1accce=_0x33e3cc[_0x6448('0x53')][_0x6448('0x2c')]({'plain':!![]});if(!_0x1accce)throw new Error(_0x6448('0x54'));if(_0x1accce[_0x6448('0x55')]===_0x6448('0x53')){var _0x4193f9=_0xf79568['get']({'plain':!![]});var _0x7eae99=_0x6448('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x7eae99,'userProfileId':_0x1accce[_0x6448('0x56')]},'raw':!![]})[_0x6448('0x2b')](function(_0x2fe39c){if(_0x2fe39c&&_0x2fe39c[_0x6448('0x57')]===0x0){return db[_0x6448('0x2e')][_0x6448('0x52')]({'name':_0x4193f9[_0x6448('0x31')],'resourceId':_0x4193f9['id'],'type':_0x2fe39c[_0x6448('0x31')],'sectionId':_0x2fe39c['id']},{})['then'](function(){return _0xf79568;});}else{return _0xf79568;}})['catch'](function(_0x38779d){logger[_0x6448('0x2f')](_0x6448('0x58'),_0x38779d);throw _0x38779d;});}return _0xf79568;})[_0x6448('0x2b')](respondWithResult(_0x51740e,0xc9))[_0x6448('0x4e')](handleError(_0x51740e,null));};exports[_0x6448('0x59')]=function(_0x50a25a,_0x4dc475){var _0x30ac1e={'where':{'id':_0x50a25a['params']['id']}},_0x26dd80={};_0x26dd80['model']=_[_0x6448('0x3a')](db[_0x6448('0x49')][_0x6448('0x34')]);_0x30ac1e['attributes']=_[_0x6448('0x3c')](_0x26dd80['model'],qs[_0x6448('0x3e')](_0x50a25a[_0x6448('0x39')]['fields']));_0x30ac1e[_0x6448('0x3d')]=_0x30ac1e['attributes'][_0x6448('0x3f')]?_0x30ac1e[_0x6448('0x3d')]:_0x26dd80[_0x6448('0x38')];if(_0x50a25a[_0x6448('0x39')][_0x6448('0x4a')]){_0x30ac1e[_0x6448('0x4b')]=[{'all':!![]}];}_0x30ac1e=_[_0x6448('0x46')]({},_0x30ac1e,_0x50a25a[_0x6448('0x48')]);return db['Dashboard'][_0x6448('0x51')](_0x30ac1e)[_0x6448('0x2b')](handleEntityNotFound(_0x4dc475,null))['then'](function(_0x1a0e19){if(_0x1a0e19){var _0x43a9ee=_0x1a0e19[_0x6448('0x2c')]({'plain':!![]});_0x43a9ee=qs[_0x6448('0x5a')](_0x43a9ee,['id','createdAt',_0x6448('0x5b')]);_0x50a25a[_0x6448('0x5c')]=_[_0x6448('0x5a')](_0x50a25a[_0x6448('0x5c')],['id',_0x6448('0x5d'),'updatedAt']);return db[_0x6448('0x49')][_0x6448('0x52')](_[_0x6448('0x46')](_0x43a9ee,_0x50a25a[_0x6448('0x5c')]),{'include':_0x50a25a[_0x6448('0x39')][_0x6448('0x4a')]?[{'all':!![]}]:undefined})[_0x6448('0x2b')](function(_0x192daf){var _0x345004=_0x50a25a[_0x6448('0x53')][_0x6448('0x2c')]({'plain':!![]});if(!_0x345004)throw new Error(_0x6448('0x54'));if(_0x345004[_0x6448('0x55')]===_0x6448('0x53')){var _0xdaa7e1=_0x192daf[_0x6448('0x2c')]({'plain':!![]});var _0x57e45b='CustomDashboards';return db['UserProfileSection'][_0x6448('0x51')]({'where':{'name':_0x57e45b,'userProfileId':_0x345004[_0x6448('0x56')]},'raw':!![]})['then'](function(_0x214d4e){if(_0x214d4e&&_0x214d4e[_0x6448('0x57')]===0x0){return db[_0x6448('0x2e')][_0x6448('0x52')]({'name':_0xdaa7e1[_0x6448('0x31')],'resourceId':_0xdaa7e1['id'],'type':_0x214d4e[_0x6448('0x31')],'sectionId':_0x214d4e['id']},{})[_0x6448('0x2b')](function(){return _0x192daf;});}else{return _0x192daf;}})[_0x6448('0x4e')](function(_0x2b8f3e){logger[_0x6448('0x2f')](_0x6448('0x58'),_0x2b8f3e);throw _0x2b8f3e;});}return _0x192daf;});}})[_0x6448('0x2b')](respondWithResult(_0x4dc475,0xc9))['catch'](handleError(_0x4dc475,null));};exports[_0x6448('0x29')]=function(_0x3fa888,_0x4cafa2){if(_0x3fa888['body']['id']){delete _0x3fa888['body']['id'];}return db[_0x6448('0x49')][_0x6448('0x51')]({'where':{'id':_0x3fa888[_0x6448('0x50')]['id']}})[_0x6448('0x2b')](handleEntityNotFound(_0x4cafa2,null))[_0x6448('0x2b')](saveUpdates(_0x3fa888[_0x6448('0x5c')],null))[_0x6448('0x2b')](respondWithResult(_0x4cafa2,null))['catch'](handleError(_0x4cafa2,null));};exports[_0x6448('0x2a')]=function(_0x4a5d4a,_0x4f0638){return db['Dashboard'][_0x6448('0x51')]({'where':{'id':_0x4a5d4a[_0x6448('0x50')]['id']}})[_0x6448('0x2b')](handleEntityNotFound(_0x4f0638,null))[_0x6448('0x2b')](removeEntity(_0x4f0638,null))[_0x6448('0x4e')](handleError(_0x4f0638,null));};function widgetAttributes(_0x217376){try{switch(_0x217376[_0x6448('0x36')]){case _0x6448('0x5e'):return[{'name':_0x6448('0x5f'),'value':_0x217376[_0x6448('0x5f')]||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x0]?_0x217376[_0x6448('0x60')][0x0][_0x6448('0x61')]:undefined)||'https://'}];case _0x6448('0x62'):return[{'name':_0x6448('0x63'),'value':_0x217376[_0x6448('0x63')]||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x0]?_0x217376[_0x6448('0x60')][0x0][_0x6448('0x61')]:undefined)||''}];case _0x6448('0x64'):return[{'name':'attrHourFormat','value':_0x217376[_0x6448('0x65')]||(_0x217376['attrs']&&_0x217376['attrs'][0x0]?_0x217376['attrs'][0x0][_0x6448('0x61')]:undefined)||'HH:mm:ss'},{'name':_0x6448('0x66'),'value':_0x217376['attrTimezone']||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x1]?_0x217376[_0x6448('0x60')][0x1][_0x6448('0x61')]:undefined)||_0x6448('0x67')},{'name':'attrFontSize','value':_0x217376[_0x6448('0x68')]||(_0x217376[_0x6448('0x60')]&&_0x217376['attrs'][0x2]?_0x217376[_0x6448('0x60')][0x2][_0x6448('0x61')]:undefined)||0xc}];case _0x6448('0x69'):return[{'name':_0x6448('0x6a'),'value':_0x217376['attrMetric']||(_0x217376['attrs']&&_0x217376[_0x6448('0x60')][0x0]?_0x217376[_0x6448('0x60')][0x0][_0x6448('0x61')]:undefined)||_0x6448('0x6b')},{'name':_0x6448('0x6c'),'value':_0x217376['attrVoiceQueues']||(_0x217376[_0x6448('0x60')]&&_0x217376['attrs'][0x1]?_0x217376[_0x6448('0x60')][0x1][_0x6448('0x61')]:undefined)||[]},{'name':_0x6448('0x68'),'value':_0x217376[_0x6448('0x68')]||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x2]?_0x217376[_0x6448('0x60')][0x2][_0x6448('0x61')]:undefined)||0x14},{'name':_0x6448('0x6d'),'value':_0x217376[_0x6448('0x6d')]||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x3]?_0x217376[_0x6448('0x60')][0x3][_0x6448('0x61')]:undefined)||_0x6448('0x6e')},{'name':_0x6448('0x6f'),'value':_0x217376['attrEmailAccounts']||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x4]?_0x217376[_0x6448('0x60')][0x4][_0x6448('0x61')]:undefined)||''},{'name':_0x6448('0x70'),'value':_0x217376['attrFaxAccounts']||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x5]?_0x217376[_0x6448('0x60')][0x5][_0x6448('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x217376[_0x6448('0x71')]||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x6]?_0x217376[_0x6448('0x60')][0x6]['value']:undefined)||''},{'name':_0x6448('0x72'),'value':_0x217376['attrOpenchannelAccounts']||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x7]?_0x217376[_0x6448('0x60')][0x7][_0x6448('0x61')]:undefined)||''},{'name':_0x6448('0x73'),'value':_0x217376[_0x6448('0x73')]||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x8]?_0x217376[_0x6448('0x60')][0x8]['value']:undefined)||''},{'name':_0x6448('0x74'),'value':_0x217376[_0x6448('0x74')]||(_0x217376['attrs']&&_0x217376['attrs'][0x9]?_0x217376[_0x6448('0x60')][0x9]['value']:undefined)||''}];case _0x6448('0x75'):case _0x6448('0x76'):return[{'name':_0x6448('0x77'),'value':_0x217376[_0x6448('0x77')]||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x0]?_0x217376['attrs'][0x0]['value']:undefined)||_0x6448('0x6b')},{'name':_0x6448('0x78'),'value':_0x217376['attrSerie2']||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x1]?_0x217376[_0x6448('0x60')][0x1][_0x6448('0x61')]:undefined)||null},{'name':_0x6448('0x79'),'value':_0x217376[_0x6448('0x79')]||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x2]?_0x217376['attrs'][0x2][_0x6448('0x61')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x217376[_0x6448('0x6c')]||(_0x217376['attrs']&&_0x217376[_0x6448('0x60')][0x3]?_0x217376[_0x6448('0x60')][0x3][_0x6448('0x61')]:undefined)||[]},{'name':'attrChannel','value':_0x217376[_0x6448('0x6d')]||(_0x217376['attrs']&&_0x217376[_0x6448('0x60')][0x4]?_0x217376[_0x6448('0x60')][0x4][_0x6448('0x61')]:undefined)||_0x6448('0x6e')},{'name':'attrEmailAccounts','value':_0x217376[_0x6448('0x6f')]||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x5]?_0x217376['attrs'][0x5][_0x6448('0x61')]:undefined)||''},{'name':_0x6448('0x70'),'value':_0x217376[_0x6448('0x70')]||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x6]?_0x217376[_0x6448('0x60')][0x6][_0x6448('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x217376['attrSmsAccounts']||(_0x217376[_0x6448('0x60')]&&_0x217376['attrs'][0x7]?_0x217376[_0x6448('0x60')][0x7][_0x6448('0x61')]:undefined)||''},{'name':_0x6448('0x72'),'value':_0x217376[_0x6448('0x72')]||(_0x217376[_0x6448('0x60')]&&_0x217376['attrs'][0x8]?_0x217376['attrs'][0x8][_0x6448('0x61')]:undefined)||''},{'name':_0x6448('0x73'),'value':_0x217376['attrWhatsappAccounts']||(_0x217376[_0x6448('0x60')]&&_0x217376[_0x6448('0x60')][0x9]?_0x217376['attrs'][0x9][_0x6448('0x61')]:undefined)||''},{'name':_0x6448('0x74'),'value':_0x217376[_0x6448('0x74')]||(_0x217376['attrs']&&_0x217376[_0x6448('0x60')][0xa]?_0x217376[_0x6448('0x60')][0xa][_0x6448('0x61')]:undefined)||''}];case'web-report':return[{'name':_0x6448('0x7a'),'type':_0x217376['reportType']||(_0x217376['attrs']&&_0x217376[_0x6448('0x60')][0x0]?_0x217376['attrs'][0x0][_0x6448('0x36')]:undefined)||null,'value':_0x217376[_0x6448('0x7a')]||(_0x217376[_0x6448('0x60')]&&_0x217376['attrs'][0x0]?_0x217376[_0x6448('0x60')][0x0][_0x6448('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0x217376['attrRefresh']||(_0x217376['attrs']&&_0x217376['attrs'][0x1]?_0x217376[_0x6448('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1214f5){logger['error']('widgetAttributes:\x20%s',JSON['stringify'](_0x1214f5));return[];}}exports[_0x6448('0x7b')]=function(_0x30aeab,_0x2f69c4,_0x3983f7){if(_0x30aeab[_0x6448('0x5c')]['id']){delete _0x30aeab[_0x6448('0x5c')]['id'];}return db['Dashboard'][_0x6448('0x51')]({'where':{'id':_0x30aeab[_0x6448('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f69c4,null))['then'](function(_0x81a0eb){if(_0x81a0eb){_0x30aeab[_0x6448('0x5c')][_0x6448('0x7c')]=_0x81a0eb['id'];_0x30aeab[_0x6448('0x5c')][_0x6448('0x60')]=widgetAttributes(_0x30aeab[_0x6448('0x5c')]);return db[_0x6448('0x7d')]['create'](_0x30aeab[_0x6448('0x5c')]);}})['then'](respondWithResult(_0x2f69c4,null))['catch'](handleError(_0x2f69c4,null));};exports[_0x6448('0x7e')]=function(_0x2e172c,_0x4be652,_0x56a178){var _0x69a431={};var _0x9344a5={};var _0x536e37;var _0x23a9ce;return db[_0x6448('0x49')]['findOne']({'where':{'id':_0x2e172c[_0x6448('0x50')]['id']}})[_0x6448('0x2b')](handleEntityNotFound(_0x4be652,null))[_0x6448('0x2b')](function(_0x3b676e){if(_0x3b676e){_0x536e37=_0x3b676e;_0x9344a5[_0x6448('0x38')]=_[_0x6448('0x3a')](db[_0x6448('0x7d')][_0x6448('0x34')]);_0x9344a5['query']=_[_0x6448('0x3a')](_0x2e172c[_0x6448('0x39')]);_0x9344a5['filters']=_[_0x6448('0x3c')](_0x9344a5[_0x6448('0x38')],_0x9344a5[_0x6448('0x39')]);_0x69a431['attributes']=_[_0x6448('0x3c')](_0x9344a5[_0x6448('0x38')],qs[_0x6448('0x3e')](_0x2e172c[_0x6448('0x39')][_0x6448('0x3e')]));_0x69a431[_0x6448('0x3d')]=_0x69a431[_0x6448('0x3d')][_0x6448('0x3f')]?_0x69a431[_0x6448('0x3d')]:_0x9344a5['model'];_0x69a431[_0x6448('0x7f')]=qs[_0x6448('0x42')](_0x2e172c[_0x6448('0x39')][_0x6448('0x42')]);_0x69a431['where']=qs[_0x6448('0x3b')](_['pick'](_0x2e172c['query'],_0x9344a5[_0x6448('0x3b')]));if(_0x2e172c[_0x6448('0x39')]['filter']){_0x69a431[_0x6448('0x43')]=_[_0x6448('0x46')](_0x69a431[_0x6448('0x43')],{'$or':_[_0x6448('0x33')](_0x69a431['attributes'],function(_0x4cb8ca){var _0x58504b={};_0x58504b[_0x4cb8ca]={'$like':'%'+_0x2e172c[_0x6448('0x39')][_0x6448('0x45')]+'%'};return _0x58504b;})});}_0x69a431=_[_0x6448('0x46')]({},_0x69a431,_0x2e172c[_0x6448('0x48')]);return _0x536e37[_0x6448('0x7e')](_0x69a431);}})[_0x6448('0x2b')](function(_0x1541ac){if(_0x1541ac){_0x23a9ce=_0x1541ac[_0x6448('0x3f')];if(!_0x2e172c[_0x6448('0x39')][_0x6448('0x40')](_0x6448('0x41'))){_0x69a431['limit']=qs[_0x6448('0x23')](_0x2e172c[_0x6448('0x39')][_0x6448('0x23')]);_0x69a431[_0x6448('0x21')]=qs['offset'](_0x2e172c[_0x6448('0x39')]['offset']);}return _0x536e37[_0x6448('0x7e')](_0x69a431);}})[_0x6448('0x2b')](function(_0x220caf){if(_0x220caf){return _0x220caf?{'count':_0x23a9ce,'rows':_0x220caf}:null;}})[_0x6448('0x2b')](respondWithResult(_0x4be652,null))[_0x6448('0x4e')](handleError(_0x4be652,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 95f9419..aee0aa1 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 _0xd08c=['hasOwnProperty','hook','exports','Dashboard','save','remove'];(function(_0x4dff8a,_0x390f72){var _0x26c892=function(_0x213e0d){while(--_0x213e0d){_0x4dff8a['push'](_0x4dff8a['shift']());}};_0x26c892(++_0x390f72);}(_0xd08c,0x13b));var _0xcd08=function(_0x86ed6b,_0x1012fb){_0x86ed6b=_0x86ed6b-0x0;var _0x67b2bf=_0xd08c[_0x86ed6b];return _0x67b2bf;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0xcd08('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcd08('0x1'),'afterUpdate':'update','afterDestroy':_0xcd08('0x2')};function emitEvent(_0x19d03b){return function(_0x279c06,_0x97758d,_0x38dc98){DashboardEvents['emit'](_0x19d03b+':'+_0x279c06['id'],_0x279c06);DashboardEvents['emit'](_0x19d03b,_0x279c06);_0x38dc98(null);};}for(var e in events){if(events[_0xcd08('0x3')](e)){var event=events[e];Dashboard[_0xcd08('0x4')](e,emitEvent(event));}}module[_0xcd08('0x5')]=DashboardEvents; \ No newline at end of file +var _0x9689=['emit','hasOwnProperty','../../mysqldb','setMaxListeners','save','update'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x9689,0xd4));var _0x9968=function(_0x8cb9fd,_0x58ad38){_0x8cb9fd=_0x8cb9fd-0x0;var _0xd3210e=_0x9689[_0x8cb9fd];return _0xd3210e;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x9968('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9968('0x1')](0x0);var events={'afterCreate':_0x9968('0x2'),'afterUpdate':_0x9968('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1b9532){return function(_0x394ae0,_0x2cdf23,_0x218c36){DashboardEvents['emit'](_0x1b9532+':'+_0x394ae0['id'],_0x394ae0);DashboardEvents[_0x9968('0x4')](_0x1b9532,_0x394ae0);_0x218c36(null);};}for(var e in events){if(events[_0x9968('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 17f20ec..7c2e17d 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 _0xc662=['Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1d18c2,_0x3413e3){var _0x40cecd=function(_0x2eeacf){while(--_0x2eeacf){_0x1d18c2['push'](_0x1d18c2['shift']());}};_0x40cecd(++_0x3413e3);}(_0xc662,0xc6));var _0x2c66=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xc662[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x2c66('0x0'));var util=require(_0x2c66('0x1'));var logger=require(_0x2c66('0x2'))(_0x2c66('0x3'));var moment=require(_0x2c66('0x4'));var BPromise=require(_0x2c66('0x5'));var rp=require(_0x2c66('0x6'));var fs=require('fs');var path=require(_0x2c66('0x7'));var rimraf=require(_0x2c66('0x8'));var config=require(_0x2c66('0x9'));var attributes=require('./dashboard.attributes');module[_0x2c66('0xa')]=function(_0xa7b235,_0x52ed35){return _0xa7b235[_0x2c66('0xb')](_0x2c66('0xc'),attributes,{'tableName':_0x2c66('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f27=['define','Dashboard','dashboards','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x5a98b8,_0x3caca1){var _0x2a758f=function(_0x1958df){while(--_0x1958df){_0x5a98b8['push'](_0x5a98b8['shift']());}};_0x2a758f(++_0x3caca1);}(_0x0f27,0x78));var _0x70f2=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0x0f27[_0x35a140];return _0x30ab82;};'use strict';var _=require('lodash');var util=require(_0x70f2('0x0'));var logger=require(_0x70f2('0x1'))(_0x70f2('0x2'));var moment=require('moment');var BPromise=require(_0x70f2('0x3'));var rp=require(_0x70f2('0x4'));var fs=require('fs');var path=require(_0x70f2('0x5'));var rimraf=require(_0x70f2('0x6'));var config=require(_0x70f2('0x7'));var attributes=require(_0x70f2('0x8'));module[_0x70f2('0x9')]=function(_0x2c4329,_0x366bc1){return _0x2c4329[_0x70f2('0xa')](_0x70f2('0xb'),attributes,{'tableName':_0x70f2('0xc'),'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 25e2ed7..bb430e5 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 _0x910d=['stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x5b26be,_0x24893b){var _0x4c02c9=function(_0x17dac2){while(--_0x17dac2){_0x5b26be['push'](_0x5b26be['shift']());}};_0x4c02c9(++_0x24893b);}(_0x910d,0x11e));var _0xd910=function(_0x1a9e78,_0x426c88){_0x1a9e78=_0x1a9e78-0x0;var _0x25cd28=_0x910d[_0x1a9e78];return _0x25cd28;};'use strict';var _=require(_0xd910('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd910('0x1'));var rs=require(_0xd910('0x2'));var fs=require('fs');var Redis=require(_0xd910('0x3'));var db=require(_0xd910('0x4'))['db'];var utils=require(_0xd910('0x5'));var logger=require(_0xd910('0x6'))(_0xd910('0x7'));var config=require(_0xd910('0x8'));var jayson=require(_0xd910('0x9'));var client=jayson[_0xd910('0xa')][_0xd910('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd910('0xc')],{'host':_0xd910('0xd'),'port':0x18eb});var socket=require(_0xd910('0xe'))(new Redis(config['redis']));require('./dashboard.socket')[_0xd910('0xf')](socket);function respondWithRpcPromise(_0x1965b1,_0x4f20e9,_0x457e5c){return new BPromise(function(_0x2be54a,_0xfe438b){return client[_0xd910('0x10')](_0x1965b1,_0x457e5c)['then'](function(_0xe399c2){logger[_0xd910('0x11')](_0xd910('0x12'),_0x4f20e9,_0xd910('0x13'));logger[_0xd910('0x14')](_0xd910('0x15'),_0x4f20e9,_0xd910('0x13'),JSON[_0xd910('0x16')](_0xe399c2));if(_0xe399c2[_0xd910('0x17')]){if(_0xe399c2[_0xd910('0x17')][_0xd910('0x18')]===0x1f4){logger[_0xd910('0x17')]('Dashboard,\x20%s,\x20%s',_0x4f20e9,_0xe399c2[_0xd910('0x17')][_0xd910('0x19')]);return _0xfe438b(_0xe399c2[_0xd910('0x17')][_0xd910('0x19')]);}logger[_0xd910('0x17')]('Dashboard,\x20%s,\x20%s',_0x4f20e9,_0xe399c2[_0xd910('0x17')][_0xd910('0x19')]);return _0x2be54a(_0xe399c2[_0xd910('0x17')][_0xd910('0x19')]);}else{logger[_0xd910('0x11')](_0xd910('0x12'),_0x4f20e9,'request\x20sent');_0x2be54a(_0xe399c2[_0xd910('0x1a')][_0xd910('0x19')]);}})[_0xd910('0x1b')](function(_0x29c6b5){logger[_0xd910('0x17')](_0xd910('0x12'),_0x4f20e9,_0x29c6b5);_0xfe438b(_0x29c6b5);});});} \ No newline at end of file +var _0x2eea=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboard.socket','then','info','Dashboard,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x50f74f,_0xa92d63){var _0x39072a=function(_0x223268){while(--_0x223268){_0x50f74f['push'](_0x50f74f['shift']());}};_0x39072a(++_0xa92d63);}(_0x2eea,0xa9));var _0xa2ee=function(_0x45dd84,_0x16683d){_0x45dd84=_0x45dd84-0x0;var _0x15d1ac=_0x2eea[_0x45dd84];return _0x15d1ac;};'use strict';var _=require(_0xa2ee('0x0'));var util=require('util');var moment=require(_0xa2ee('0x1'));var BPromise=require(_0xa2ee('0x2'));var rs=require(_0xa2ee('0x3'));var fs=require('fs');var Redis=require(_0xa2ee('0x4'));var db=require(_0xa2ee('0x5'))['db'];var utils=require(_0xa2ee('0x6'));var logger=require(_0xa2ee('0x7'))('rpc');var config=require(_0xa2ee('0x8'));var jayson=require(_0xa2ee('0x9'));var client=jayson[_0xa2ee('0xa')][_0xa2ee('0xb')]({'port':0x232a});config[_0xa2ee('0xc')]=_['defaults'](config[_0xa2ee('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2ee('0xd'))(new Redis(config[_0xa2ee('0xc')]));require(_0xa2ee('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f9ecc,_0x4f2344,_0x382ed7){return new BPromise(function(_0xb6d894,_0x49eb9d){return client['request'](_0x3f9ecc,_0x382ed7)[_0xa2ee('0xf')](function(_0x4141fa){logger[_0xa2ee('0x10')](_0xa2ee('0x11'),_0x4f2344,'request\x20sent');logger[_0xa2ee('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x4f2344,'request\x20sent',JSON[_0xa2ee('0x13')](_0x4141fa));if(_0x4141fa[_0xa2ee('0x14')]){if(_0x4141fa[_0xa2ee('0x14')][_0xa2ee('0x15')]===0x1f4){logger['error'](_0xa2ee('0x11'),_0x4f2344,_0x4141fa['error'][_0xa2ee('0x16')]);return _0x49eb9d(_0x4141fa[_0xa2ee('0x14')]['message']);}logger['error'](_0xa2ee('0x11'),_0x4f2344,_0x4141fa[_0xa2ee('0x14')][_0xa2ee('0x16')]);return _0xb6d894(_0x4141fa['error'][_0xa2ee('0x16')]);}else{logger['info'](_0xa2ee('0x11'),_0x4f2344,'request\x20sent');_0xb6d894(_0x4141fa[_0xa2ee('0x17')][_0xa2ee('0x16')]);}})[_0xa2ee('0x18')](function(_0x3c77ac){logger['error'](_0xa2ee('0x11'),_0x4f2344,_0x3c77ac);_0x49eb9d(_0x3c77ac);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index caed712..3b933b6 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 _0xfc8d=['./dashboard.events','save','remove','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc8d,0x138));var _0xdfc8=function(_0x4040d5,_0x482d13){_0x4040d5=_0x4040d5-0x0;var _0x230d7a=_0xfc8d[_0x4040d5];return _0x230d7a;};'use strict';var DashboardEvents=require(_0xdfc8('0x0'));var events=[_0xdfc8('0x1'),_0xdfc8('0x2'),'update'];function createListener(_0x534b37,_0x340051){return function(_0x310b39){_0x340051[_0xdfc8('0x3')](_0x534b37,_0x310b39);};}function removeListener(_0x2a48c7,_0x3e1709){return function(){DashboardEvents[_0xdfc8('0x4')](_0x2a48c7,_0x3e1709);};}exports[_0xdfc8('0x5')]=function(_0x4ba47c){for(var _0x1f3a5f=0x0,_0x1d3475=events['length'];_0x1f3a5f<_0x1d3475;_0x1f3a5f++){var _0x36dc46=events[_0x1f3a5f];var _0x52afe8=createListener('dashboard:'+_0x36dc46,_0x4ba47c);DashboardEvents['on'](_0x36dc46,_0x52afe8);}}; \ No newline at end of file +var _0xaf5a=['save','remove','update','removeListener','length','dashboard:','./dashboard.events'];(function(_0x3b222c,_0x3128f2){var _0x4ccae0=function(_0x5328d9){while(--_0x5328d9){_0x3b222c['push'](_0x3b222c['shift']());}};_0x4ccae0(++_0x3128f2);}(_0xaf5a,0x13a));var _0xaaf5=function(_0x5e1854,_0x48fb60){_0x5e1854=_0x5e1854-0x0;var _0x50eaee=_0xaf5a[_0x5e1854];return _0x50eaee;};'use strict';var DashboardEvents=require(_0xaaf5('0x0'));var events=[_0xaaf5('0x1'),_0xaaf5('0x2'),_0xaaf5('0x3')];function createListener(_0x177041,_0x255bb8){return function(_0x45e094){_0x255bb8['emit'](_0x177041,_0x45e094);};}function removeListener(_0x120731,_0x362a7c){return function(){DashboardEvents[_0xaaf5('0x4')](_0x120731,_0x362a7c);};}exports['register']=function(_0xc70175){for(var _0x47239b=0x0,_0x5cf28c=events[_0xaaf5('0x5')];_0x47239b<_0x5cf28c;_0x47239b++){var _0x5c5716=events[_0x47239b];var _0xdcb333=createListener(_0xaaf5('0x6')+_0x5c5716,_0xc70175);DashboardEvents['on'](_0x5c5716,_0xdcb333);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index dbe5a3b..30b174c 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 _0x9be0=['get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller'];(function(_0x455ed1,_0x22bcd6){var _0x4e6145=function(_0x561519){while(--_0x561519){_0x455ed1['push'](_0x455ed1['shift']());}};_0x4e6145(++_0x22bcd6);}(_0x9be0,0x1f0));var _0x09be=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9be0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x09be('0x0'));var path=require('path');var timeout=require(_0x09be('0x1'));var express=require('express');var router=express[_0x09be('0x2')]();var fs_extra=require(_0x09be('0x3'));var auth=require(_0x09be('0x4'));var interaction=require(_0x09be('0x5'));var config=require(_0x09be('0x6'));var controller=require(_0x09be('0x7'));router[_0x09be('0x8')]('/',auth[_0x09be('0x9')](),controller[_0x09be('0xa')]);router[_0x09be('0x8')](_0x09be('0xb'),auth[_0x09be('0x9')](),controller[_0x09be('0xc')]);router[_0x09be('0x8')](_0x09be('0xd'),auth[_0x09be('0x9')](),controller[_0x09be('0xe')]);router[_0x09be('0xf')]('/',auth[_0x09be('0x9')](),controller[_0x09be('0x10')]);router[_0x09be('0xf')](_0x09be('0x11'),auth['isAuthenticated'](),controller[_0x09be('0x12')]);router[_0x09be('0xf')](_0x09be('0xd'),auth[_0x09be('0x9')](),controller[_0x09be('0x13')]);router[_0x09be('0x14')]('/:id',auth[_0x09be('0x9')](),controller[_0x09be('0x15')]);router[_0x09be('0x16')](_0x09be('0xb'),auth[_0x09be('0x9')](),controller['destroy']);module[_0x09be('0x17')]=router; \ No newline at end of file +var _0x92a2=['post','create','/:id/clone','clone','addItem','update','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','show','/:id/items','getItems'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x92a2,0x134));var _0x292a=function(_0x435208,_0x4e39fb){_0x435208=_0x435208-0x0;var _0xe8e149=_0x92a2[_0x435208];return _0xe8e149;};'use strict';var multer=require(_0x292a('0x0'));var util=require('util');var path=require(_0x292a('0x1'));var timeout=require(_0x292a('0x2'));var express=require(_0x292a('0x3'));var router=express[_0x292a('0x4')]();var fs_extra=require(_0x292a('0x5'));var auth=require(_0x292a('0x6'));var interaction=require(_0x292a('0x7'));var config=require('../../config/environment');var controller=require(_0x292a('0x8'));router[_0x292a('0x9')]('/',auth[_0x292a('0xa')](),controller['index']);router[_0x292a('0x9')]('/:id',auth[_0x292a('0xa')](),controller[_0x292a('0xb')]);router[_0x292a('0x9')](_0x292a('0xc'),auth[_0x292a('0xa')](),controller[_0x292a('0xd')]);router[_0x292a('0xe')]('/',auth[_0x292a('0xa')](),controller[_0x292a('0xf')]);router[_0x292a('0xe')](_0x292a('0x10'),auth[_0x292a('0xa')](),controller[_0x292a('0x11')]);router[_0x292a('0xe')]('/:id/items',auth[_0x292a('0xa')](),controller[_0x292a('0x12')]);router['put']('/:id',auth[_0x292a('0xa')](),controller[_0x292a('0x13')]);router['delete'](_0x292a('0x14'),auth[_0x292a('0xa')](),controller[_0x292a('0x15')]);module[_0x292a('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 6432042..0694c32 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 _0x0295=['#ffffff','sequelize','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','STRING'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x0295,0x1f0));var _0x5029=function(_0x1c7377,_0x8a8698){_0x1c7377=_0x1c7377-0x0;var _0x5d03e3=_0x0295[_0x1c7377];return _0x5d03e3;};'use strict';var Sequelize=require(_0x5029('0x0'));var squel=require('squel');var _=require('lodash');module[_0x5029('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5029('0x2')](_0x5029('0x3')),'get':function(){try{return JSON[_0x5029('0x4')](this[_0x5029('0x5')](_0x5029('0x6')));}catch(_0x69a497){return[];}},'set':function(_0x200217){try{this[_0x5029('0x7')](_0x5029('0x6'),JSON['stringify'](_0x200217));}catch(_0x54978f){this['setDataValue'](_0x5029('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5029('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5029('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':_0x5029('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5029('0x9')]},'titleFontSize':{'type':Sequelize[_0x5029('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0x6f47=['#ffffff','squel','lodash','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x565052,_0x1c7477){var _0xba1f55=function(_0x443a43){while(--_0x443a43){_0x565052['push'](_0x565052['shift']());}};_0xba1f55(++_0x1c7477);}(_0x6f47,0xc7));var _0x76f4=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x6f47[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));module['exports']={'title':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x76f4('0x3')]('long'),'get':function(){try{return JSON[_0x76f4('0x4')](this[_0x76f4('0x5')](_0x76f4('0x6')));}catch(_0x2523ba){return[];}},'set':function(_0x5754ca){try{this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')](_0x5754ca));}catch(_0x497f99){this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':_0x76f4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x76f4('0x2')]},'titleFontSize':{'type':Sequelize[_0x76f4('0x9')],'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 345aade..9229ede 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 _0xd916=['attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','fields','length','includeAll','options','catch','find','type','iframe','attrUrl','attrs','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','voice','web-report'];(function(_0x48cdc1,_0x3a8edd){var _0x3e4eca=function(_0x313489){while(--_0x313489){_0x48cdc1['push'](_0x48cdc1['shift']());}};_0x3e4eca(++_0x3a8edd);}(_0xd916,0x18a));var _0x6d91=function(_0x19b5c0,_0x18ca6d){_0x19b5c0=_0x19b5c0-0x0;var _0x2fb804=_0xd916[_0x19b5c0];return _0x2fb804;};'use strict';var emlformat=require(_0x6d91('0x0'));var rimraf=require(_0x6d91('0x1'));var zipdir=require(_0x6d91('0x2'));var jsonpatch=require(_0x6d91('0x3'));var rp=require(_0x6d91('0x4'));var moment=require('moment');var BPromise=require(_0x6d91('0x5'));var Mustache=require(_0x6d91('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6d91('0x7'));var csv=require(_0x6d91('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d91('0x9'));var _=require(_0x6d91('0xa'));var squel=require(_0x6d91('0xb'));var crypto=require(_0x6d91('0xc'));var jsforce=require(_0x6d91('0xd'));var deskjs=require(_0x6d91('0xe'));var toCsv=require(_0x6d91('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d91('0xf'));var as=require(_0x6d91('0x10'));var hardwareService=require(_0x6d91('0x11'));var logger=require(_0x6d91('0x12'))(_0x6d91('0x13'));var utils=require('../../config/utils');var config=require(_0x6d91('0x14'));var licenseUtil=require(_0x6d91('0x15'));var db=require(_0x6d91('0x16'))['db'];config[_0x6d91('0x17')]=_[_0x6d91('0x18')](config[_0x6d91('0x17')],{'host':_0x6d91('0x19'),'port':0x18eb});var socket=require(_0x6d91('0x1a'))(new Redis(config[_0x6d91('0x17')]));require(_0x6d91('0x1b'))[_0x6d91('0x1c')](socket);function respondWithStatusCode(_0x460ffb,_0x293e25){_0x293e25=_0x293e25||0xcc;return function(_0x1cdbeb){if(_0x1cdbeb){return _0x460ffb[_0x6d91('0x1d')](_0x293e25);}return _0x460ffb['status'](_0x293e25)[_0x6d91('0x1e')]();};}function respondWithResult(_0x33fbbe,_0x25debb){_0x25debb=_0x25debb||0xc8;return function(_0x2143ac){if(_0x2143ac){return _0x33fbbe[_0x6d91('0x1f')](_0x25debb)[_0x6d91('0x20')](_0x2143ac);}};}function respondWithFilteredResult(_0x51738a,_0x1311ed){return function(_0x4c81fe){if(_0x4c81fe){var _0x4dd339=typeof _0x1311ed[_0x6d91('0x21')]==='undefined'&&typeof _0x1311ed[_0x6d91('0x22')]==='undefined';var _0x539c29=_0x4c81fe[_0x6d91('0x23')];var _0x2a0ce7=_0x4dd339?0x0:_0x1311ed[_0x6d91('0x21')];var _0x4b5980=_0x4dd339?_0x4c81fe[_0x6d91('0x23')]:_0x1311ed[_0x6d91('0x21')]+_0x1311ed[_0x6d91('0x22')];var _0x95c65d;if(_0x4b5980>=_0x539c29){_0x4b5980=_0x539c29;_0x95c65d=0xc8;}else{_0x95c65d=0xce;}_0x51738a[_0x6d91('0x1f')](_0x95c65d);return _0x51738a[_0x6d91('0x24')](_0x6d91('0x25'),_0x2a0ce7+'-'+_0x4b5980+'/'+_0x539c29)[_0x6d91('0x20')](_0x4c81fe);}return null;};}function patchUpdates(_0x468142){return function(_0x3e67bd){try{jsonpatch[_0x6d91('0x26')](_0x3e67bd,_0x468142,!![]);}catch(_0x91ab12){return BPromise['reject'](_0x91ab12);}return _0x3e67bd[_0x6d91('0x27')]();};}function saveUpdates(_0xad1a51,_0x34ed05){return function(_0x4898d0){if(_0x4898d0){return _0x4898d0[_0x6d91('0x28')](_0xad1a51)[_0x6d91('0x29')](function(_0x5a8c2a){return _0x5a8c2a;});}return null;};}function removeEntity(_0x41fa64,_0x72505e){return function(_0x3ed163){if(_0x3ed163){return _0x3ed163[_0x6d91('0x2a')]()['then'](function(){_0x41fa64[_0x6d91('0x1f')](0xcc)[_0x6d91('0x1e')]();});}};}function handleEntityNotFound(_0x1689f9,_0x52db14){return function(_0x34479e){if(!_0x34479e){_0x1689f9[_0x6d91('0x1d')](0x194);}return _0x34479e;};}function handleError(_0x385237,_0xb0c85f){_0xb0c85f=_0xb0c85f||0x1f4;return function(_0x5c99fc){logger[_0x6d91('0x2b')](_0x5c99fc[_0x6d91('0x2c')]);if(_0x5c99fc[_0x6d91('0x2d')]){delete _0x5c99fc['name'];}_0x385237[_0x6d91('0x1f')](_0xb0c85f)[_0x6d91('0x2e')](_0x5c99fc);};}exports['show']=function(_0x15ea4d,_0x54b0bc){var _0x52b88d={'raw':![],'where':{'id':_0x15ea4d[_0x6d91('0x2f')]['id']}},_0x5a48fe={};_0x5a48fe[_0x6d91('0x30')]=_[_0x6d91('0x31')](db[_0x6d91('0x32')][_0x6d91('0x33')]);_0x5a48fe[_0x6d91('0x34')]=_[_0x6d91('0x31')](_0x15ea4d[_0x6d91('0x34')]);_0x5a48fe[_0x6d91('0x35')]=_['intersection'](_0x5a48fe[_0x6d91('0x30')],_0x5a48fe[_0x6d91('0x34')]);_0x52b88d[_0x6d91('0x36')]=_['intersection'](_0x5a48fe[_0x6d91('0x30')],qs['fields'](_0x15ea4d[_0x6d91('0x34')][_0x6d91('0x37')]));_0x52b88d[_0x6d91('0x36')]=_0x52b88d[_0x6d91('0x36')][_0x6d91('0x38')]?_0x52b88d[_0x6d91('0x36')]:_0x5a48fe[_0x6d91('0x30')];if(_0x15ea4d['query'][_0x6d91('0x39')]){_0x52b88d['include']=[{'all':!![]}];}_0x52b88d=_['merge']({},_0x52b88d,_0x15ea4d[_0x6d91('0x3a')]);return db['DashboardItem']['find'](_0x52b88d)['then'](handleEntityNotFound(_0x54b0bc,null))['then'](respondWithResult(_0x54b0bc,null))[_0x6d91('0x3b')](handleError(_0x54b0bc,null));};exports[_0x6d91('0x2a')]=function(_0x3cd4be,_0x4ffac2){return db[_0x6d91('0x32')][_0x6d91('0x3c')]({'where':{'id':_0x3cd4be[_0x6d91('0x2f')]['id']}})[_0x6d91('0x29')](handleEntityNotFound(_0x4ffac2,null))['then'](removeEntity(_0x4ffac2,null))[_0x6d91('0x3b')](handleError(_0x4ffac2,null));};function widgetAttributes(_0x54448b){try{switch(_0x54448b[_0x6d91('0x3d')]){case _0x6d91('0x3e'):return[{'name':_0x6d91('0x3f'),'value':_0x54448b[_0x6d91('0x3f')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b['attrs'][0x0]?_0x54448b[_0x6d91('0x40')][0x0]['value']:undefined)||'https://'}];case _0x6d91('0x41'):return[{'name':'attrPath','value':_0x54448b[_0x6d91('0x42')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b['attrs'][0x0]?_0x54448b[_0x6d91('0x40')][0x0]['value']:undefined)||''}];case _0x6d91('0x43'):return[{'name':_0x6d91('0x44'),'value':_0x54448b['attrHourFormat']||(_0x54448b[_0x6d91('0x40')]&&_0x54448b['attrs'][0x0]?_0x54448b[_0x6d91('0x40')][0x0][_0x6d91('0x45')]:undefined)||_0x6d91('0x46')},{'name':_0x6d91('0x47'),'value':_0x54448b[_0x6d91('0x47')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b['attrs'][0x1]?_0x54448b[_0x6d91('0x40')][0x1][_0x6d91('0x45')]:undefined)||_0x6d91('0x48')},{'name':_0x6d91('0x49'),'value':_0x54448b['attrFontSize']||(_0x54448b['attrs']&&_0x54448b['attrs'][0x2]?_0x54448b['attrs'][0x2]['value']:undefined)||0xc}];case _0x6d91('0x4a'):return[{'name':'attrMetric','value':_0x54448b['attrMetric']||(_0x54448b[_0x6d91('0x40')]&&_0x54448b[_0x6d91('0x40')][0x0]?_0x54448b[_0x6d91('0x40')][0x0][_0x6d91('0x45')]:undefined)||_0x6d91('0x4b')},{'name':'attrVoiceQueues','value':_0x54448b['attrVoiceQueues']||(_0x54448b['attrs']&&_0x54448b[_0x6d91('0x40')][0x1]?_0x54448b[_0x6d91('0x40')][0x1][_0x6d91('0x45')]:undefined)||[]},{'name':'attrFontSize','value':_0x54448b[_0x6d91('0x49')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b['attrs'][0x2]?_0x54448b['attrs'][0x2][_0x6d91('0x45')]:undefined)||0x14},{'name':_0x6d91('0x4c'),'value':_0x54448b[_0x6d91('0x4c')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b[_0x6d91('0x40')][0x3]?_0x54448b[_0x6d91('0x40')][0x3][_0x6d91('0x45')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x54448b[_0x6d91('0x4d')]||(_0x54448b['attrs']&&_0x54448b[_0x6d91('0x40')][0x4]?_0x54448b['attrs'][0x4][_0x6d91('0x45')]:undefined)||''},{'name':_0x6d91('0x4e'),'value':_0x54448b[_0x6d91('0x4e')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b['attrs'][0x5]?_0x54448b[_0x6d91('0x40')][0x5][_0x6d91('0x45')]:undefined)||''},{'name':_0x6d91('0x4f'),'value':_0x54448b[_0x6d91('0x4f')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b[_0x6d91('0x40')][0x6]?_0x54448b[_0x6d91('0x40')][0x6][_0x6d91('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x54448b[_0x6d91('0x50')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b[_0x6d91('0x40')][0x7]?_0x54448b['attrs'][0x7][_0x6d91('0x45')]:undefined)||''},{'name':_0x6d91('0x51'),'value':_0x54448b[_0x6d91('0x51')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b['attrs'][0x8]?_0x54448b[_0x6d91('0x40')][0x8][_0x6d91('0x45')]:undefined)||''},{'name':_0x6d91('0x52'),'value':_0x54448b[_0x6d91('0x52')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b['attrs'][0x9]?_0x54448b[_0x6d91('0x40')][0x9][_0x6d91('0x45')]:undefined)||''}];case _0x6d91('0x53'):case _0x6d91('0x54'):return[{'name':_0x6d91('0x55'),'value':_0x54448b[_0x6d91('0x55')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b[_0x6d91('0x40')][0x0]?_0x54448b[_0x6d91('0x40')][0x0]['value']:undefined)||_0x6d91('0x4b')},{'name':_0x6d91('0x56'),'value':_0x54448b[_0x6d91('0x56')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b[_0x6d91('0x40')][0x1]?_0x54448b[_0x6d91('0x40')][0x1][_0x6d91('0x45')]:undefined)||null},{'name':_0x6d91('0x57'),'value':_0x54448b[_0x6d91('0x57')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b[_0x6d91('0x40')][0x2]?_0x54448b[_0x6d91('0x40')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x54448b[_0x6d91('0x58')]||(_0x54448b['attrs']&&_0x54448b[_0x6d91('0x40')][0x3]?_0x54448b[_0x6d91('0x40')][0x3][_0x6d91('0x45')]:undefined)||[]},{'name':_0x6d91('0x4c'),'value':_0x54448b[_0x6d91('0x4c')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b[_0x6d91('0x40')][0x4]?_0x54448b[_0x6d91('0x40')][0x4][_0x6d91('0x45')]:undefined)||_0x6d91('0x59')},{'name':'attrEmailAccounts','value':_0x54448b[_0x6d91('0x4d')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b[_0x6d91('0x40')][0x5]?_0x54448b[_0x6d91('0x40')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x54448b[_0x6d91('0x4e')]||(_0x54448b['attrs']&&_0x54448b[_0x6d91('0x40')][0x6]?_0x54448b[_0x6d91('0x40')][0x6][_0x6d91('0x45')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x54448b[_0x6d91('0x4f')]||(_0x54448b['attrs']&&_0x54448b[_0x6d91('0x40')][0x7]?_0x54448b[_0x6d91('0x40')][0x7][_0x6d91('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x54448b[_0x6d91('0x50')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b[_0x6d91('0x40')][0x8]?_0x54448b[_0x6d91('0x40')][0x8][_0x6d91('0x45')]:undefined)||''},{'name':_0x6d91('0x51'),'value':_0x54448b['attrWhatsappAccounts']||(_0x54448b[_0x6d91('0x40')]&&_0x54448b[_0x6d91('0x40')][0x9]?_0x54448b['attrs'][0x9][_0x6d91('0x45')]:undefined)||''},{'name':_0x6d91('0x52'),'value':_0x54448b[_0x6d91('0x52')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b['attrs'][0xa]?_0x54448b[_0x6d91('0x40')][0xa][_0x6d91('0x45')]:undefined)||''}];case _0x6d91('0x5a'):return[{'name':_0x6d91('0x5b'),'type':_0x54448b['reportType']||(_0x54448b[_0x6d91('0x40')]&&_0x54448b['attrs'][0x0]?_0x54448b[_0x6d91('0x40')][0x0][_0x6d91('0x3d')]:undefined)||null,'value':_0x54448b[_0x6d91('0x5b')]||(_0x54448b[_0x6d91('0x40')]&&_0x54448b['attrs'][0x0]?_0x54448b[_0x6d91('0x40')][0x0][_0x6d91('0x45')]:undefined)||null},{'name':'attrRefresh','value':_0x54448b[_0x6d91('0x5c')]||(_0x54448b['attrs']&&_0x54448b[_0x6d91('0x40')][0x1]?_0x54448b[_0x6d91('0x40')][0x1][_0x6d91('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x4c77ec){logger['error'](_0x6d91('0x5d'),JSON[_0x6d91('0x5e')](_0x4c77ec));return[];}}exports[_0x6d91('0x5f')]=function(_0x27a2c5,_0xa741f0){if(_0x27a2c5[_0x6d91('0x60')]){_0x27a2c5[_0x6d91('0x60')][_0x6d91('0x40')]=widgetAttributes(_0x27a2c5[_0x6d91('0x60')]);}return db[_0x6d91('0x32')][_0x6d91('0x5f')](_0x27a2c5['body'],{})[_0x6d91('0x29')](respondWithResult(_0xa741f0,0xc9))[_0x6d91('0x3b')](handleError(_0xa741f0,null));};exports[_0x6d91('0x28')]=function(_0xf8df64,_0x718642){if(_0xf8df64['body']['id']){delete _0xf8df64[_0x6d91('0x60')]['id'];}_0xf8df64[_0x6d91('0x60')][_0x6d91('0x40')]=widgetAttributes(_0xf8df64[_0x6d91('0x60')]);return db[_0x6d91('0x32')][_0x6d91('0x3c')]({'where':{'id':_0xf8df64['params']['id']}})[_0x6d91('0x29')](handleEntityNotFound(_0x718642,null))['then'](saveUpdates(_0xf8df64['body'],null))[_0x6d91('0x29')](respondWithResult(_0x718642,null))[_0x6d91('0x3b')](handleError(_0x718642,null));}; \ No newline at end of file +var _0x0e4b=['attrUrl','attrs','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','value','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrReport','reportType','type','stringify','create','body','eml-format','rimraf','zip-dir','request-promise','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','register','status','end','json','undefined','limit','count','offset','set','update','then','sendStatus','error','stack','name','show','params','model','keys','DashboardItem','query','filters','attributes','fields','length','includeAll','merge','find','catch','destroy','iframe'];(function(_0x55351e,_0x2edf11){var _0x3d6967=function(_0x4c3050){while(--_0x4c3050){_0x55351e['push'](_0x55351e['shift']());}};_0x3d6967(++_0x2edf11);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x193347,_0x4242e5){_0x193347=_0x193347-0x0;var _0x231a57=_0x0e4b[_0x193347];return _0x231a57;};'use strict';var emlformat=require(_0xb0e4('0x0'));var rimraf=require(_0xb0e4('0x1'));var zipdir=require(_0xb0e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0e4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb0e4('0x4'));var sox=require(_0xb0e4('0x5'));var csv=require('to-csv');var ejs=require(_0xb0e4('0x6'));var fs=require('fs');var fs_extra=require(_0xb0e4('0x7'));var _=require(_0xb0e4('0x8'));var squel=require(_0xb0e4('0x9'));var crypto=require(_0xb0e4('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb0e4('0xb'));var querystring=require(_0xb0e4('0xc'));var Papa=require(_0xb0e4('0xd'));var Redis=require(_0xb0e4('0xe'));var authService=require(_0xb0e4('0xf'));var qs=require(_0xb0e4('0x10'));var as=require(_0xb0e4('0x11'));var hardwareService=require(_0xb0e4('0x12'));var logger=require(_0xb0e4('0x13'))(_0xb0e4('0x14'));var utils=require(_0xb0e4('0x15'));var config=require(_0xb0e4('0x16'));var licenseUtil=require(_0xb0e4('0x17'));var db=require(_0xb0e4('0x18'))['db'];config[_0xb0e4('0x19')]=_['defaults'](config[_0xb0e4('0x19')],{'host':_0xb0e4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0e4('0x19')]));require(_0xb0e4('0x1b'))[_0xb0e4('0x1c')](socket);function respondWithStatusCode(_0x460180,_0x1e1ca5){_0x1e1ca5=_0x1e1ca5||0xcc;return function(_0x57ba9d){if(_0x57ba9d){return _0x460180['sendStatus'](_0x1e1ca5);}return _0x460180[_0xb0e4('0x1d')](_0x1e1ca5)[_0xb0e4('0x1e')]();};}function respondWithResult(_0x5b219a,_0x152ceb){_0x152ceb=_0x152ceb||0xc8;return function(_0x376d1f){if(_0x376d1f){return _0x5b219a[_0xb0e4('0x1d')](_0x152ceb)[_0xb0e4('0x1f')](_0x376d1f);}};}function respondWithFilteredResult(_0x74c379,_0x3355c6){return function(_0x570886){if(_0x570886){var _0x491a29=typeof _0x3355c6['offset']===_0xb0e4('0x20')&&typeof _0x3355c6[_0xb0e4('0x21')]===_0xb0e4('0x20');var _0x690682=_0x570886[_0xb0e4('0x22')];var _0x2f3809=_0x491a29?0x0:_0x3355c6['offset'];var _0x436667=_0x491a29?_0x570886[_0xb0e4('0x22')]:_0x3355c6[_0xb0e4('0x23')]+_0x3355c6[_0xb0e4('0x21')];var _0x4bbb10;if(_0x436667>=_0x690682){_0x436667=_0x690682;_0x4bbb10=0xc8;}else{_0x4bbb10=0xce;}_0x74c379[_0xb0e4('0x1d')](_0x4bbb10);return _0x74c379[_0xb0e4('0x24')]('Content-Range',_0x2f3809+'-'+_0x436667+'/'+_0x690682)[_0xb0e4('0x1f')](_0x570886);}return null;};}function patchUpdates(_0x2774be){return function(_0xe6a9cf){try{jsonpatch['apply'](_0xe6a9cf,_0x2774be,!![]);}catch(_0x1a6810){return BPromise['reject'](_0x1a6810);}return _0xe6a9cf['save']();};}function saveUpdates(_0x21276c,_0x39db8d){return function(_0x139c84){if(_0x139c84){return _0x139c84[_0xb0e4('0x25')](_0x21276c)[_0xb0e4('0x26')](function(_0x248aa5){return _0x248aa5;});}return null;};}function removeEntity(_0x6665e,_0x50fe9e){return function(_0x28ed88){if(_0x28ed88){return _0x28ed88['destroy']()[_0xb0e4('0x26')](function(){_0x6665e[_0xb0e4('0x1d')](0xcc)[_0xb0e4('0x1e')]();});}};}function handleEntityNotFound(_0xfef785,_0x4fc624){return function(_0x1ed356){if(!_0x1ed356){_0xfef785[_0xb0e4('0x27')](0x194);}return _0x1ed356;};}function handleError(_0x15d402,_0x451008){_0x451008=_0x451008||0x1f4;return function(_0x447f41){logger[_0xb0e4('0x28')](_0x447f41[_0xb0e4('0x29')]);if(_0x447f41[_0xb0e4('0x2a')]){delete _0x447f41['name'];}_0x15d402[_0xb0e4('0x1d')](_0x451008)['send'](_0x447f41);};}exports[_0xb0e4('0x2b')]=function(_0x3a08f6,_0x50cef9){var _0x2c97aa={'raw':![],'where':{'id':_0x3a08f6[_0xb0e4('0x2c')]['id']}},_0xaa76d9={};_0xaa76d9[_0xb0e4('0x2d')]=_[_0xb0e4('0x2e')](db[_0xb0e4('0x2f')]['rawAttributes']);_0xaa76d9[_0xb0e4('0x30')]=_['keys'](_0x3a08f6['query']);_0xaa76d9[_0xb0e4('0x31')]=_['intersection'](_0xaa76d9[_0xb0e4('0x2d')],_0xaa76d9['query']);_0x2c97aa[_0xb0e4('0x32')]=_['intersection'](_0xaa76d9[_0xb0e4('0x2d')],qs[_0xb0e4('0x33')](_0x3a08f6[_0xb0e4('0x30')]['fields']));_0x2c97aa[_0xb0e4('0x32')]=_0x2c97aa['attributes'][_0xb0e4('0x34')]?_0x2c97aa[_0xb0e4('0x32')]:_0xaa76d9[_0xb0e4('0x2d')];if(_0x3a08f6[_0xb0e4('0x30')][_0xb0e4('0x35')]){_0x2c97aa['include']=[{'all':!![]}];}_0x2c97aa=_[_0xb0e4('0x36')]({},_0x2c97aa,_0x3a08f6['options']);return db[_0xb0e4('0x2f')][_0xb0e4('0x37')](_0x2c97aa)[_0xb0e4('0x26')](handleEntityNotFound(_0x50cef9,null))['then'](respondWithResult(_0x50cef9,null))[_0xb0e4('0x38')](handleError(_0x50cef9,null));};exports[_0xb0e4('0x39')]=function(_0x4708ce,_0x739afb){return db['DashboardItem']['find']({'where':{'id':_0x4708ce['params']['id']}})['then'](handleEntityNotFound(_0x739afb,null))[_0xb0e4('0x26')](removeEntity(_0x739afb,null))['catch'](handleError(_0x739afb,null));};function widgetAttributes(_0x3beb07){try{switch(_0x3beb07['type']){case _0xb0e4('0x3a'):return[{'name':'attrUrl','value':_0x3beb07[_0xb0e4('0x3b')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x0]?_0x3beb07[_0xb0e4('0x3c')][0x0]['value']:undefined)||_0xb0e4('0x3d')}];case _0xb0e4('0x3e'):return[{'name':'attrPath','value':_0x3beb07[_0xb0e4('0x3f')]||(_0x3beb07['attrs']&&_0x3beb07[_0xb0e4('0x3c')][0x0]?_0x3beb07[_0xb0e4('0x3c')][0x0]['value']:undefined)||''}];case _0xb0e4('0x40'):return[{'name':'attrHourFormat','value':_0x3beb07['attrHourFormat']||(_0x3beb07['attrs']&&_0x3beb07[_0xb0e4('0x3c')][0x0]?_0x3beb07[_0xb0e4('0x3c')][0x0]['value']:undefined)||_0xb0e4('0x41')},{'name':'attrTimezone','value':_0x3beb07[_0xb0e4('0x42')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x1]?_0x3beb07[_0xb0e4('0x3c')][0x1]['value']:undefined)||_0xb0e4('0x43')},{'name':_0xb0e4('0x44'),'value':_0x3beb07[_0xb0e4('0x44')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x2]?_0x3beb07[_0xb0e4('0x3c')][0x2][_0xb0e4('0x45')]:undefined)||0xc}];case _0xb0e4('0x46'):return[{'name':_0xb0e4('0x47'),'value':_0x3beb07[_0xb0e4('0x47')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x0]?_0x3beb07[_0xb0e4('0x3c')][0x0][_0xb0e4('0x45')]:undefined)||_0xb0e4('0x48')},{'name':_0xb0e4('0x49'),'value':_0x3beb07['attrVoiceQueues']||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x1]?_0x3beb07[_0xb0e4('0x3c')][0x1][_0xb0e4('0x45')]:undefined)||[]},{'name':'attrFontSize','value':_0x3beb07[_0xb0e4('0x44')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07['attrs'][0x2]?_0x3beb07[_0xb0e4('0x3c')][0x2][_0xb0e4('0x45')]:undefined)||0x14},{'name':_0xb0e4('0x4a'),'value':_0x3beb07[_0xb0e4('0x4a')]||(_0x3beb07['attrs']&&_0x3beb07[_0xb0e4('0x3c')][0x3]?_0x3beb07[_0xb0e4('0x3c')][0x3][_0xb0e4('0x45')]:undefined)||_0xb0e4('0x4b')},{'name':_0xb0e4('0x4c'),'value':_0x3beb07[_0xb0e4('0x4c')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x4]?_0x3beb07[_0xb0e4('0x3c')][0x4][_0xb0e4('0x45')]:undefined)||''},{'name':_0xb0e4('0x4d'),'value':_0x3beb07['attrFaxAccounts']||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x5]?_0x3beb07['attrs'][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x3beb07[_0xb0e4('0x4e')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07['attrs'][0x6]?_0x3beb07['attrs'][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3beb07['attrOpenchannelAccounts']||(_0x3beb07['attrs']&&_0x3beb07[_0xb0e4('0x3c')][0x7]?_0x3beb07['attrs'][0x7][_0xb0e4('0x45')]:undefined)||''},{'name':_0xb0e4('0x4f'),'value':_0x3beb07[_0xb0e4('0x4f')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07['attrs'][0x8]?_0x3beb07[_0xb0e4('0x3c')][0x8][_0xb0e4('0x45')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3beb07[_0xb0e4('0x50')]||(_0x3beb07['attrs']&&_0x3beb07[_0xb0e4('0x3c')][0x9]?_0x3beb07[_0xb0e4('0x3c')][0x9][_0xb0e4('0x45')]:undefined)||''}];case _0xb0e4('0x51'):case'pie-chart':return[{'name':_0xb0e4('0x52'),'value':_0x3beb07[_0xb0e4('0x52')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x0]?_0x3beb07['attrs'][0x0][_0xb0e4('0x45')]:undefined)||_0xb0e4('0x48')},{'name':_0xb0e4('0x53'),'value':_0x3beb07['attrSerie2']||(_0x3beb07['attrs']&&_0x3beb07['attrs'][0x1]?_0x3beb07['attrs'][0x1]['value']:undefined)||null},{'name':_0xb0e4('0x54'),'value':_0x3beb07['attrSerie3']||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x2]?_0x3beb07[_0xb0e4('0x3c')][0x2][_0xb0e4('0x45')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3beb07[_0xb0e4('0x49')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07['attrs'][0x3]?_0x3beb07[_0xb0e4('0x3c')][0x3]['value']:undefined)||[]},{'name':_0xb0e4('0x4a'),'value':_0x3beb07[_0xb0e4('0x4a')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07['attrs'][0x4]?_0x3beb07[_0xb0e4('0x3c')][0x4][_0xb0e4('0x45')]:undefined)||'voice'},{'name':_0xb0e4('0x4c'),'value':_0x3beb07[_0xb0e4('0x4c')]||(_0x3beb07['attrs']&&_0x3beb07['attrs'][0x5]?_0x3beb07[_0xb0e4('0x3c')][0x5][_0xb0e4('0x45')]:undefined)||''},{'name':_0xb0e4('0x4d'),'value':_0x3beb07['attrFaxAccounts']||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x6]?_0x3beb07['attrs'][0x6][_0xb0e4('0x45')]:undefined)||''},{'name':_0xb0e4('0x4e'),'value':_0x3beb07['attrSmsAccounts']||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x7]?_0x3beb07[_0xb0e4('0x3c')][0x7]['value']:undefined)||''},{'name':_0xb0e4('0x55'),'value':_0x3beb07[_0xb0e4('0x55')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x8]?_0x3beb07['attrs'][0x8][_0xb0e4('0x45')]:undefined)||''},{'name':_0xb0e4('0x4f'),'value':_0x3beb07[_0xb0e4('0x4f')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x9]?_0x3beb07[_0xb0e4('0x3c')][0x9][_0xb0e4('0x45')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3beb07['attrChatWebsites']||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0xa]?_0x3beb07[_0xb0e4('0x3c')][0xa][_0xb0e4('0x45')]:undefined)||''}];case _0xb0e4('0x56'):return[{'name':_0xb0e4('0x57'),'type':_0x3beb07[_0xb0e4('0x58')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x0]?_0x3beb07[_0xb0e4('0x3c')][0x0][_0xb0e4('0x59')]:undefined)||null,'value':_0x3beb07[_0xb0e4('0x57')]||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x0]?_0x3beb07[_0xb0e4('0x3c')][0x0][_0xb0e4('0x45')]:undefined)||null},{'name':'attrRefresh','value':_0x3beb07['attrRefresh']||(_0x3beb07[_0xb0e4('0x3c')]&&_0x3beb07[_0xb0e4('0x3c')][0x1]?_0x3beb07[_0xb0e4('0x3c')][0x1][_0xb0e4('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x2b7f33){logger['error']('widgetAttributes:\x20%s',JSON[_0xb0e4('0x5a')](_0x2b7f33));return[];}}exports[_0xb0e4('0x5b')]=function(_0xa05a06,_0x54f614){if(_0xa05a06[_0xb0e4('0x5c')]){_0xa05a06[_0xb0e4('0x5c')]['attrs']=widgetAttributes(_0xa05a06['body']);}return db[_0xb0e4('0x2f')]['create'](_0xa05a06[_0xb0e4('0x5c')],{})[_0xb0e4('0x26')](respondWithResult(_0x54f614,0xc9))[_0xb0e4('0x38')](handleError(_0x54f614,null));};exports[_0xb0e4('0x25')]=function(_0x1bd223,_0x27e561){if(_0x1bd223[_0xb0e4('0x5c')]['id']){delete _0x1bd223[_0xb0e4('0x5c')]['id'];}_0x1bd223[_0xb0e4('0x5c')][_0xb0e4('0x3c')]=widgetAttributes(_0x1bd223[_0xb0e4('0x5c')]);return db['DashboardItem'][_0xb0e4('0x37')]({'where':{'id':_0x1bd223[_0xb0e4('0x2c')]['id']}})[_0xb0e4('0x26')](handleEntityNotFound(_0x27e561,null))[_0xb0e4('0x26')](saveUpdates(_0x1bd223[_0xb0e4('0x5c')],null))[_0xb0e4('0x26')](respondWithResult(_0x27e561,null))[_0xb0e4('0x38')](handleError(_0x27e561,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 39b2625..9728ead 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 _0x77cb=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','remove'];(function(_0x1eb027,_0x2ded9a){var _0x3572cb=function(_0xf0a844){while(--_0xf0a844){_0x1eb027['push'](_0x1eb027['shift']());}};_0x3572cb(++_0x2ded9a);}(_0x77cb,0x1e1));var _0xb77c=function(_0x332a18,_0x41e562){_0x332a18=_0x332a18-0x0;var _0xcb1bbc=_0x77cb[_0x332a18];return _0xcb1bbc;};'use strict';var EventEmitter=require(_0xb77c('0x0'));var DashboardItem=require(_0xb77c('0x1'))['db'][_0xb77c('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb77c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb77c('0x4')};function emitEvent(_0x24ae55){return function(_0x5533c8,_0x236c21,_0x5ced87){DashboardItemEvents[_0xb77c('0x5')](_0x24ae55+':'+_0x5533c8['id'],_0x5533c8);DashboardItemEvents[_0xb77c('0x5')](_0x24ae55,_0x5533c8);_0x5ced87(null);};}for(var e in events){if(events[_0xb77c('0x6')](e)){var event=events[e];DashboardItem[_0xb77c('0x7')](e,emitEvent(event));}}module[_0xb77c('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xe52b=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x7600df,_0x31daf2){var _0x1b85d9=function(_0x17866e){while(--_0x17866e){_0x7600df['push'](_0x7600df['shift']());}};_0x1b85d9(++_0x31daf2);}(_0xe52b,0xc2));var _0xbe52=function(_0x44e4b7,_0x55ebac){_0x44e4b7=_0x44e4b7-0x0;var _0x56cdea=_0xe52b[_0x44e4b7];return _0x56cdea;};'use strict';var EventEmitter=require(_0xbe52('0x0'));var DashboardItem=require(_0xbe52('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xbe52('0x2')](0x0);var events={'afterCreate':_0xbe52('0x3'),'afterUpdate':_0xbe52('0x4'),'afterDestroy':_0xbe52('0x5')};function emitEvent(_0x1b8f67){return function(_0x50dd35,_0x4b3de4,_0x35582f){DashboardItemEvents[_0xbe52('0x6')](_0x1b8f67+':'+_0x50dd35['id'],_0x50dd35);DashboardItemEvents[_0xbe52('0x6')](_0x1b8f67,_0x50dd35);_0x35582f(null);};}for(var e in events){if(events[_0xbe52('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 6e6f095..1dd0cdf 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 _0x1433=['dashboard_items','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x32d1ae,_0x575e52){var _0x49cf0b=function(_0x7dc05c){while(--_0x7dc05c){_0x32d1ae['push'](_0x32d1ae['shift']());}};_0x49cf0b(++_0x575e52);}(_0x1433,0x121));var _0x3143=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1433[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x3143('0x0'));var util=require(_0x3143('0x1'));var logger=require('../../config/logger')(_0x3143('0x2'));var moment=require(_0x3143('0x3'));var BPromise=require(_0x3143('0x4'));var rp=require(_0x3143('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3143('0x6'));var attributes=require(_0x3143('0x7'));module[_0x3143('0x8')]=function(_0x216e7a,_0xe029e4){return _0x216e7a[_0x3143('0x9')](_0x3143('0xa'),attributes,{'tableName':_0x3143('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd18=['exports','define','DashboardItem','dashboard_items','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcd18,0xb4));var _0x8cd1=function(_0x3717f1,_0x113e7b){_0x3717f1=_0x3717f1-0x0;var _0x4f24df=_0xcd18[_0x3717f1];return _0x4f24df;};'use strict';var _=require(_0x8cd1('0x0'));var util=require(_0x8cd1('0x1'));var logger=require('../../config/logger')(_0x8cd1('0x2'));var moment=require(_0x8cd1('0x3'));var BPromise=require('bluebird');var rp=require(_0x8cd1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8cd1('0x5'));var config=require(_0x8cd1('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x8cd1('0x7')]=function(_0x2b6649,_0x2d35e4){return _0x2b6649[_0x8cd1('0x8')](_0x8cd1('0x9'),attributes,{'tableName':_0x8cd1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 7cc76d5..687f16c 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 _0x0266=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger'];(function(_0x1884dd,_0x1bbe84){var _0x41cb84=function(_0x3ebde3){while(--_0x3ebde3){_0x1884dd['push'](_0x1884dd['shift']());}};_0x41cb84(++_0x1bbe84);}(_0x0266,0x132));var _0x6026=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x0266[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x6026('0x0'));var util=require(_0x6026('0x1'));var moment=require(_0x6026('0x2'));var BPromise=require(_0x6026('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6026('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6026('0x5'))(_0x6026('0x6'));var config=require(_0x6026('0x7'));var jayson=require(_0x6026('0x8'));var client=jayson[_0x6026('0x9')][_0x6026('0xa')]({'port':0x232a});config[_0x6026('0xb')]=_[_0x6026('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6026('0xd'))(new Redis(config[_0x6026('0xb')]));require('./dashboardItem.socket')[_0x6026('0xe')](socket);function respondWithRpcPromise(_0x13260d,_0x5bf310,_0x6eef78){return new BPromise(function(_0x4907b6,_0x505d14){return client[_0x6026('0xf')](_0x13260d,_0x6eef78)[_0x6026('0x10')](function(_0x394ba1){logger['info']('DashboardItem,\x20%s,\x20%s',_0x5bf310,'request\x20sent');logger[_0x6026('0x11')](_0x6026('0x12'),_0x5bf310,_0x6026('0x13'),JSON['stringify'](_0x394ba1));if(_0x394ba1['error']){if(_0x394ba1[_0x6026('0x14')][_0x6026('0x15')]===0x1f4){logger[_0x6026('0x14')](_0x6026('0x16'),_0x5bf310,_0x394ba1['error'][_0x6026('0x17')]);return _0x505d14(_0x394ba1['error'][_0x6026('0x17')]);}logger['error'](_0x6026('0x16'),_0x5bf310,_0x394ba1[_0x6026('0x14')][_0x6026('0x17')]);return _0x4907b6(_0x394ba1['error'][_0x6026('0x17')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x5bf310,_0x6026('0x13'));_0x4907b6(_0x394ba1[_0x6026('0x18')][_0x6026('0x17')]);}})[_0x6026('0x19')](function(_0x4a778e){logger[_0x6026('0x14')]('DashboardItem,\x20%s,\x20%s',_0x5bf310,_0x4a778e);_0x505d14(_0x4a778e);});});} \ No newline at end of file +var _0x2116=['util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0xfb90b4,_0xaaaf8f){var _0x76c890=function(_0x57cc81){while(--_0x57cc81){_0xfb90b4['push'](_0xfb90b4['shift']());}};_0x76c890(++_0xaaaf8f);}(_0x2116,0x7c));var _0x6211=function(_0x3619d9,_0x31b2f9){_0x3619d9=_0x3619d9-0x0;var _0x209b1e=_0x2116[_0x3619d9];return _0x209b1e;};'use strict';var _=require(_0x6211('0x0'));var util=require(_0x6211('0x1'));var moment=require(_0x6211('0x2'));var BPromise=require(_0x6211('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6211('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6211('0x5'))(_0x6211('0x6'));var config=require(_0x6211('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6211('0x8')][_0x6211('0x9')]({'port':0x232a});config[_0x6211('0xa')]=_[_0x6211('0xb')](config[_0x6211('0xa')],{'host':_0x6211('0xc'),'port':0x18eb});var socket=require(_0x6211('0xd'))(new Redis(config[_0x6211('0xa')]));require(_0x6211('0xe'))['register'](socket);function respondWithRpcPromise(_0x4ee4b2,_0x248aee,_0x57a122){return new BPromise(function(_0x4473ad,_0x51e33f){return client['request'](_0x4ee4b2,_0x57a122)['then'](function(_0x3fa71c){logger[_0x6211('0xf')](_0x6211('0x10'),_0x248aee,_0x6211('0x11'));logger[_0x6211('0x12')](_0x6211('0x13'),_0x248aee,'request\x20sent',JSON[_0x6211('0x14')](_0x3fa71c));if(_0x3fa71c['error']){if(_0x3fa71c[_0x6211('0x15')][_0x6211('0x16')]===0x1f4){logger[_0x6211('0x15')](_0x6211('0x10'),_0x248aee,_0x3fa71c[_0x6211('0x15')][_0x6211('0x17')]);return _0x51e33f(_0x3fa71c['error']['message']);}logger['error'](_0x6211('0x10'),_0x248aee,_0x3fa71c[_0x6211('0x15')]['message']);return _0x4473ad(_0x3fa71c[_0x6211('0x15')][_0x6211('0x17')]);}else{logger[_0x6211('0xf')]('DashboardItem,\x20%s,\x20%s',_0x248aee,_0x6211('0x11'));_0x4473ad(_0x3fa71c[_0x6211('0x18')]['message']);}})['catch'](function(_0x305ff7){logger[_0x6211('0x15')](_0x6211('0x10'),_0x248aee,_0x305ff7);_0x51e33f(_0x305ff7);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index d6c968f..17cd16c 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 _0xa589=['length','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0xaaf1cc,_0x4f137d){var _0x1d0b4a=function(_0xa88a77){while(--_0xa88a77){_0xaaf1cc['push'](_0xaaf1cc['shift']());}};_0x1d0b4a(++_0x4f137d);}(_0xa589,0xc1));var _0x9a58=function(_0x392412,_0x20fd5c){_0x392412=_0x392412-0x0;var _0x1b417c=_0xa589[_0x392412];return _0x1b417c;};'use strict';var DashboardItemEvents=require(_0x9a58('0x0'));var events=[_0x9a58('0x1'),_0x9a58('0x2'),_0x9a58('0x3')];function createListener(_0xc63e17,_0x45445){return function(_0x17a38b){_0x45445[_0x9a58('0x4')](_0xc63e17,_0x17a38b);};}function removeListener(_0x2851de,_0x3aac44){return function(){DashboardItemEvents[_0x9a58('0x5')](_0x2851de,_0x3aac44);};}exports[_0x9a58('0x6')]=function(_0x3212b0){for(var _0x3aa19a=0x0,_0x40e130=events[_0x9a58('0x7')];_0x3aa19a<_0x40e130;_0x3aa19a++){var _0x88ff5b=events[_0x3aa19a];var _0x51b50a=createListener('dashboardItem:'+_0x88ff5b,_0x3212b0);DashboardItemEvents['on'](_0x88ff5b,_0x51b50a);}}; \ No newline at end of file +var _0xc26f=['remove','emit','removeListener','save'];(function(_0xd9f5b8,_0x1f48bd){var _0x2a42dc=function(_0x343d38){while(--_0x343d38){_0xd9f5b8['push'](_0xd9f5b8['shift']());}};_0x2a42dc(++_0x1f48bd);}(_0xc26f,0x11b));var _0xfc26=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xc26f[_0x1589dd];return _0x1bddd1;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xfc26('0x0'),_0xfc26('0x1'),'update'];function createListener(_0x5401aa,_0x291347){return function(_0x4f17d6){_0x291347[_0xfc26('0x2')](_0x5401aa,_0x4f17d6);};}function removeListener(_0x5e362b,_0x5d7e4c){return function(){DashboardItemEvents[_0xfc26('0x3')](_0x5e362b,_0x5d7e4c);};}exports['register']=function(_0x3a15b5){for(var _0x397e7f=0x0,_0x1b39c3=events['length'];_0x397e7f<_0x1b39c3;_0x397e7f++){var _0x4a2673=events[_0x397e7f];var _0x46546a=createListener('dashboardItem:'+_0x4a2673,_0x3a15b5);DashboardItemEvents['on'](_0x4a2673,_0x46546a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 6d3d0e1..fdf6b16 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 _0x1c5f=['isAuthenticated','show','post','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x2ce372,_0x2bccba){var _0x18dec7=function(_0x335592){while(--_0x335592){_0x2ce372['push'](_0x2ce372['shift']());}};_0x18dec7(++_0x2bccba);}(_0x1c5f,0x85));var _0xf1c5=function(_0x26226e,_0x3f78e9){_0x26226e=_0x26226e-0x0;var _0x3539c8=_0x1c5f[_0x26226e];return _0x3539c8;};'use strict';var multer=require(_0xf1c5('0x0'));var util=require(_0xf1c5('0x1'));var path=require(_0xf1c5('0x2'));var timeout=require('connect-timeout');var express=require(_0xf1c5('0x3'));var router=express['Router']();var fs_extra=require(_0xf1c5('0x4'));var auth=require(_0xf1c5('0x5'));var interaction=require(_0xf1c5('0x6'));var config=require(_0xf1c5('0x7'));var controller=require(_0xf1c5('0x8'));router[_0xf1c5('0x9')](_0xf1c5('0xa'),auth[_0xf1c5('0xb')](),controller[_0xf1c5('0xc')]);router[_0xf1c5('0xd')]('/',auth[_0xf1c5('0xb')](),controller['create']);router[_0xf1c5('0xe')](_0xf1c5('0xa'),auth[_0xf1c5('0xb')](),controller[_0xf1c5('0xf')]);router[_0xf1c5('0x10')](_0xf1c5('0xa'),auth[_0xf1c5('0xb')](),controller[_0xf1c5('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5cc9=['../../config/environment','/:id','isAuthenticated','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x33a495,_0x39c38d){var _0x163511=function(_0xabb98e){while(--_0xabb98e){_0x33a495['push'](_0x33a495['shift']());}};_0x163511(++_0x39c38d);}(_0x5cc9,0x167));var _0x95cc=function(_0x24a759,_0x4e4b27){_0x24a759=_0x24a759-0x0;var _0x42d0fc=_0x5cc9[_0x24a759];return _0x42d0fc;};'use strict';var multer=require(_0x95cc('0x0'));var util=require('util');var path=require(_0x95cc('0x1'));var timeout=require(_0x95cc('0x2'));var express=require(_0x95cc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x95cc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x95cc('0x5'));var controller=require('./dashboardItem.controller');router['get'](_0x95cc('0x6'),auth[_0x95cc('0x7')](),controller[_0x95cc('0x8')]);router[_0x95cc('0x9')]('/',auth[_0x95cc('0x7')](),controller[_0x95cc('0xa')]);router['put'](_0x95cc('0x6'),auth[_0x95cc('0x7')](),controller[_0x95cc('0xb')]);router[_0x95cc('0xc')](_0x95cc('0x6'),auth[_0x95cc('0x7')](),controller['destroy']);module[_0x95cc('0xd')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 0765b9e..880406d 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 _0xfb45=['ENUM','first','second','third','sequelize','exports','STRING'];(function(_0x370013,_0x147d1e){var _0x2458df=function(_0x268c40){while(--_0x268c40){_0x370013['push'](_0x370013['shift']());}};_0x2458df(++_0x147d1e);}(_0xfb45,0x185));var _0x5fb4=function(_0xb13d69,_0x5941ed){_0xb13d69=_0xb13d69-0x0;var _0x2d9a47=_0xfb45[_0xb13d69];return _0x2d9a47;};'use strict';var Sequelize=require(_0x5fb4('0x0'));module[_0x5fb4('0x1')]={'name':{'type':Sequelize[_0x5fb4('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x5fb4('0x3')](_0x5fb4('0x4'),_0x5fb4('0x5'),_0x5fb4('0x6')),'allowNull':![],'defaultValue':_0x5fb4('0x4')},'description':{'type':Sequelize[_0x5fb4('0x2')]}}; \ No newline at end of file +var _0x8a76=['first','third','exports','STRING'];(function(_0x40cc07,_0x2b8452){var _0x4a3c35=function(_0x3fcd1d){while(--_0x3fcd1d){_0x40cc07['push'](_0x40cc07['shift']());}};_0x4a3c35(++_0x2b8452);}(_0x8a76,0x132));var _0x68a7=function(_0x3ba7c5,_0x2caaca){_0x3ba7c5=_0x3ba7c5-0x0;var _0x14c9e6=_0x8a76[_0x3ba7c5];return _0x14c9e6;};'use strict';var Sequelize=require('sequelize');module[_0x68a7('0x0')]={'name':{'type':Sequelize[_0x68a7('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x68a7('0x2'),'second',_0x68a7('0x3')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x68a7('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 245a98e..4214014 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 _0x5046=['VIRTUAL','merge','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','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','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','end','error','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter'];(function(_0x2a3bd9,_0x27d71e){var _0x526111=function(_0x44f1dd){while(--_0x44f1dd){_0x2a3bd9['push'](_0x2a3bd9['shift']());}};_0x526111(++_0x27d71e);}(_0x5046,0x6d));var _0x6504=function(_0x320a39,_0x496e39){_0x320a39=_0x320a39-0x0;var _0x3a64ac=_0x5046[_0x320a39];return _0x3a64ac;};'use strict';var emlformat=require(_0x6504('0x0'));var rimraf=require(_0x6504('0x1'));var zipdir=require(_0x6504('0x2'));var jsonpatch=require(_0x6504('0x3'));var rp=require(_0x6504('0x4'));var moment=require(_0x6504('0x5'));var BPromise=require(_0x6504('0x6'));var Mustache=require(_0x6504('0x7'));var util=require(_0x6504('0x8'));var path=require(_0x6504('0x9'));var sox=require('sox');var csv=require(_0x6504('0xa'));var ejs=require(_0x6504('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6504('0xc'));var crypto=require('crypto');var jsforce=require(_0x6504('0xd'));var deskjs=require(_0x6504('0xe'));var toCsv=require(_0x6504('0xa'));var querystring=require(_0x6504('0xf'));var Papa=require(_0x6504('0x10'));var Redis=require(_0x6504('0x11'));var authService=require(_0x6504('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6504('0x13'));var hardwareService=require(_0x6504('0x14'));var logger=require(_0x6504('0x15'))(_0x6504('0x16'));var utils=require(_0x6504('0x17'));var config=require(_0x6504('0x18'));var licenseUtil=require(_0x6504('0x19'));var db=require(_0x6504('0x1a'))['db'];function respondWithStatusCode(_0x4bbaf1,_0x533f48){_0x533f48=_0x533f48||0xcc;return function(_0x1185c0){if(_0x1185c0){return _0x4bbaf1[_0x6504('0x1b')](_0x533f48);}return _0x4bbaf1[_0x6504('0x1c')](_0x533f48)['end']();};}function respondWithResult(_0x20575d,_0x1e20c4){_0x1e20c4=_0x1e20c4||0xc8;return function(_0x2b199e){if(_0x2b199e){return _0x20575d[_0x6504('0x1c')](_0x1e20c4)[_0x6504('0x1d')](_0x2b199e);}};}function respondWithFilteredResult(_0x6b9e02,_0x5b1e2d){return function(_0x3d3134){if(_0x3d3134){var _0x3eda6f=typeof _0x5b1e2d[_0x6504('0x1e')]===_0x6504('0x1f')&&typeof _0x5b1e2d[_0x6504('0x20')]===_0x6504('0x1f');var _0x40ecbc=_0x3d3134['count'];var _0x9dd17f=_0x3eda6f?0x0:_0x5b1e2d['offset'];var _0xbf3318=_0x3eda6f?_0x3d3134['count']:_0x5b1e2d[_0x6504('0x1e')]+_0x5b1e2d[_0x6504('0x20')];var _0x5bdbfb;if(_0xbf3318>=_0x40ecbc){_0xbf3318=_0x40ecbc;_0x5bdbfb=0xc8;}else{_0x5bdbfb=0xce;}_0x6b9e02[_0x6504('0x1c')](_0x5bdbfb);return _0x6b9e02[_0x6504('0x21')](_0x6504('0x22'),_0x9dd17f+'-'+_0xbf3318+'/'+_0x40ecbc)[_0x6504('0x1d')](_0x3d3134);}return null;};}function patchUpdates(_0x365738){return function(_0xcbec8a){try{jsonpatch[_0x6504('0x23')](_0xcbec8a,_0x365738,!![]);}catch(_0x545732){return BPromise[_0x6504('0x24')](_0x545732);}return _0xcbec8a[_0x6504('0x25')]();};}function saveUpdates(_0x25edad,_0x3c4418){return function(_0x21cd26){if(_0x21cd26){return _0x21cd26[_0x6504('0x26')](_0x25edad)[_0x6504('0x27')](function(_0x233682){return _0x233682;});}return null;};}function removeEntity(_0x1f870c,_0x57f0b7){return function(_0xbe2346){if(_0xbe2346){return _0xbe2346[_0x6504('0x28')]()[_0x6504('0x27')](function(){var _0x3ca6bc=_0xbe2346[_0x6504('0x29')]({'plain':!![]});var _0x3f8b5c=_0x6504('0x2a');return db[_0x6504('0x2b')][_0x6504('0x28')]({'where':{'type':_0x3f8b5c,'resourceId':_0x3ca6bc['id']}})[_0x6504('0x27')](function(){return _0xbe2346;});})[_0x6504('0x27')](function(){_0x1f870c['status'](0xcc)[_0x6504('0x2c')]();});}};}function handleEntityNotFound(_0x32ae15,_0x3088f2){return function(_0x31849d){if(!_0x31849d){_0x32ae15[_0x6504('0x1b')](0x194);}return _0x31849d;};}function handleError(_0x2e84fe,_0x76636d){_0x76636d=_0x76636d||0x1f4;return function(_0x29f0d1){logger[_0x6504('0x2d')](_0x29f0d1[_0x6504('0x2e')]);if(_0x29f0d1[_0x6504('0x2f')]){delete _0x29f0d1[_0x6504('0x2f')];}_0x2e84fe['status'](_0x76636d)[_0x6504('0x30')](_0x29f0d1);};}exports[_0x6504('0x31')]=function(_0x25d8b2,_0x47985a){var _0x1e1274={},_0xc1a200={},_0x57fc43={'count':0x0,'rows':[]};var _0x206cda=_[_0x6504('0x32')](db[_0x6504('0x33')][_0x6504('0x34')],function(_0x4ab2ce){return{'name':_0x4ab2ce['fieldName'],'type':_0x4ab2ce[_0x6504('0x35')][_0x6504('0x36')]};});_0xc1a200[_0x6504('0x37')]=_[_0x6504('0x32')](_0x206cda,_0x6504('0x2f'));_0xc1a200[_0x6504('0x38')]=_[_0x6504('0x39')](_0x25d8b2['query']);_0xc1a200['filters']=_[_0x6504('0x3a')](_0xc1a200[_0x6504('0x37')],_0xc1a200[_0x6504('0x38')]);_0x1e1274['attributes']=_[_0x6504('0x3a')](_0xc1a200[_0x6504('0x37')],qs[_0x6504('0x3b')](_0x25d8b2[_0x6504('0x38')][_0x6504('0x3b')]));_0x1e1274[_0x6504('0x3c')]=_0x1e1274[_0x6504('0x3c')][_0x6504('0x3d')]?_0x1e1274[_0x6504('0x3c')]:_0xc1a200[_0x6504('0x37')];if(!_0x25d8b2['query'][_0x6504('0x3e')](_0x6504('0x3f'))){_0x1e1274['limit']=qs[_0x6504('0x20')](_0x25d8b2[_0x6504('0x38')]['limit']);_0x1e1274[_0x6504('0x1e')]=qs['offset'](_0x25d8b2['query'][_0x6504('0x1e')]);}_0x1e1274[_0x6504('0x40')]=qs['sort'](_0x25d8b2['query']['sort']);_0x1e1274[_0x6504('0x41')]=qs[_0x6504('0x42')](_[_0x6504('0x43')](_0x25d8b2[_0x6504('0x38')],_0xc1a200[_0x6504('0x42')]),_0x206cda);if(_0x25d8b2[_0x6504('0x38')][_0x6504('0x44')]){_0x1e1274[_0x6504('0x41')]=_['merge'](_0x1e1274[_0x6504('0x41')],{'$or':_['map'](_0x206cda,function(_0xf7c64e){if(_0xf7c64e[_0x6504('0x35')]!==_0x6504('0x45')){var _0x41ef46={};_0x41ef46[_0xf7c64e[_0x6504('0x2f')]]={'$like':'%'+_0x25d8b2[_0x6504('0x38')]['filter']+'%'};return _0x41ef46;}})});}_0x1e1274=_[_0x6504('0x46')]({},_0x1e1274,_0x25d8b2[_0x6504('0x47')]);var _0x24ab2c={'where':_0x1e1274['where']};return db[_0x6504('0x33')]['count'](_0x24ab2c)['then'](function(_0x50cdb6){_0x57fc43[_0x6504('0x48')]=_0x50cdb6;if(_0x25d8b2['query']['includeAll']){_0x1e1274[_0x6504('0x49')]=[{'all':!![]}];}return db[_0x6504('0x33')][_0x6504('0x4a')](_0x1e1274);})[_0x6504('0x27')](function(_0x2690a5){_0x57fc43[_0x6504('0x4b')]=_0x2690a5;return _0x57fc43;})[_0x6504('0x27')](respondWithFilteredResult(_0x47985a,_0x1e1274))[_0x6504('0x4c')](handleError(_0x47985a,null));};exports[_0x6504('0x4d')]=function(_0xacd4d0,_0xd0e582){var _0x5e0fec={'raw':!![],'where':{'id':_0xacd4d0[_0x6504('0x4e')]['id']}},_0xa770a6={};_0xa770a6[_0x6504('0x37')]=_['keys'](db['Disposition']['rawAttributes']);_0xa770a6['query']=_['keys'](_0xacd4d0['query']);_0xa770a6[_0x6504('0x42')]=_['intersection'](_0xa770a6[_0x6504('0x37')],_0xa770a6[_0x6504('0x38')]);_0x5e0fec[_0x6504('0x3c')]=_[_0x6504('0x3a')](_0xa770a6['model'],qs[_0x6504('0x3b')](_0xacd4d0[_0x6504('0x38')][_0x6504('0x3b')]));_0x5e0fec[_0x6504('0x3c')]=_0x5e0fec[_0x6504('0x3c')]['length']?_0x5e0fec[_0x6504('0x3c')]:_0xa770a6['model'];if(_0xacd4d0['query'][_0x6504('0x4f')]){_0x5e0fec['include']=[{'all':!![]}];}_0x5e0fec=_['merge']({},_0x5e0fec,_0xacd4d0[_0x6504('0x47')]);return db[_0x6504('0x33')][_0x6504('0x50')](_0x5e0fec)[_0x6504('0x27')](handleEntityNotFound(_0xd0e582,null))[_0x6504('0x27')](respondWithResult(_0xd0e582,null))[_0x6504('0x4c')](handleError(_0xd0e582,null));};exports[_0x6504('0x51')]=function(_0x4d592d,_0x439972){return db[_0x6504('0x33')][_0x6504('0x51')](_0x4d592d[_0x6504('0x52')],{})['then'](function(_0x2d2186){var _0x395c81=_0x4d592d[_0x6504('0x53')]['get']({'plain':!![]});if(!_0x395c81)throw new Error(_0x6504('0x54'));if(_0x395c81[_0x6504('0x55')]==='user'){var _0x527b2c=_0x2d2186[_0x6504('0x29')]({'plain':!![]});var _0x44c4cd=_0x6504('0x2a');return db['UserProfileSection'][_0x6504('0x50')]({'where':{'name':_0x44c4cd,'userProfileId':_0x395c81[_0x6504('0x56')]},'raw':!![]})[_0x6504('0x27')](function(_0xa34b15){if(_0xa34b15&&_0xa34b15[_0x6504('0x57')]===0x0){return db[_0x6504('0x2b')][_0x6504('0x51')]({'name':_0x527b2c['name'],'resourceId':_0x527b2c['id'],'type':_0xa34b15['name'],'sectionId':_0xa34b15['id']},{})[_0x6504('0x27')](function(){return _0x2d2186;});}else{return _0x2d2186;}})[_0x6504('0x4c')](function(_0xb714a5){logger[_0x6504('0x2d')](_0x6504('0x58'),_0xb714a5);throw _0xb714a5;});}return _0x2d2186;})[_0x6504('0x27')](respondWithResult(_0x439972,0xc9))['catch'](handleError(_0x439972,null));};exports['update']=function(_0x11243c,_0x556379){if(_0x11243c[_0x6504('0x52')]['id']){delete _0x11243c['body']['id'];}return db[_0x6504('0x33')]['find']({'where':{'id':_0x11243c[_0x6504('0x4e')]['id']}})['then'](handleEntityNotFound(_0x556379,null))[_0x6504('0x27')](saveUpdates(_0x11243c[_0x6504('0x52')],null))['then'](respondWithResult(_0x556379,null))[_0x6504('0x4c')](handleError(_0x556379,null));};exports['destroy']=function(_0x12ae5f,_0x4a24bf){return db[_0x6504('0x33')][_0x6504('0x50')]({'where':{'id':_0x12ae5f[_0x6504('0x4e')]['id']}})[_0x6504('0x27')](handleEntityNotFound(_0x4a24bf,null))[_0x6504('0x27')](removeEntity(_0x4a24bf,null))[_0x6504('0x4c')](handleError(_0x4a24bf,null));}; \ No newline at end of file +var _0xd1e4=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','Dispositions','UserProfileResource','destroy','stack','name','index','map','Disposition','rawAttributes','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x396938,_0x5e8c17){var _0x58a71d=function(_0x1cfe8a){while(--_0x1cfe8a){_0x396938['push'](_0x396938['shift']());}};_0x58a71d(++_0x5e8c17);}(_0xd1e4,0x8d));var _0x4d1e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xd1e4[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0x4d1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4d1e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4d1e('0x2'));var moment=require(_0x4d1e('0x3'));var BPromise=require(_0x4d1e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d1e('0x5'));var sox=require(_0x4d1e('0x6'));var csv=require('to-csv');var ejs=require(_0x4d1e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d1e('0x8'));var squel=require(_0x4d1e('0x9'));var crypto=require(_0x4d1e('0xa'));var jsforce=require(_0x4d1e('0xb'));var deskjs=require(_0x4d1e('0xc'));var toCsv=require(_0x4d1e('0xd'));var querystring=require(_0x4d1e('0xe'));var Papa=require(_0x4d1e('0xf'));var Redis=require(_0x4d1e('0x10'));var authService=require(_0x4d1e('0x11'));var qs=require(_0x4d1e('0x12'));var as=require(_0x4d1e('0x13'));var hardwareService=require(_0x4d1e('0x14'));var logger=require(_0x4d1e('0x15'))(_0x4d1e('0x16'));var utils=require(_0x4d1e('0x17'));var config=require(_0x4d1e('0x18'));var licenseUtil=require(_0x4d1e('0x19'));var db=require(_0x4d1e('0x1a'))['db'];function respondWithStatusCode(_0x1d2118,_0x40bbc7){_0x40bbc7=_0x40bbc7||0xcc;return function(_0x4c6986){if(_0x4c6986){return _0x1d2118[_0x4d1e('0x1b')](_0x40bbc7);}return _0x1d2118['status'](_0x40bbc7)[_0x4d1e('0x1c')]();};}function respondWithResult(_0x149c27,_0x145131){_0x145131=_0x145131||0xc8;return function(_0x299604){if(_0x299604){return _0x149c27[_0x4d1e('0x1d')](_0x145131)[_0x4d1e('0x1e')](_0x299604);}};}function respondWithFilteredResult(_0x3b110f,_0x505621){return function(_0x4bffda){if(_0x4bffda){var _0x3f5fb6=typeof _0x505621[_0x4d1e('0x1f')]===_0x4d1e('0x20')&&typeof _0x505621[_0x4d1e('0x21')]==='undefined';var _0x3b0d03=_0x4bffda['count'];var _0x321e87=_0x3f5fb6?0x0:_0x505621['offset'];var _0x139e9b=_0x3f5fb6?_0x4bffda[_0x4d1e('0x22')]:_0x505621['offset']+_0x505621[_0x4d1e('0x21')];var _0x956f3d;if(_0x139e9b>=_0x3b0d03){_0x139e9b=_0x3b0d03;_0x956f3d=0xc8;}else{_0x956f3d=0xce;}_0x3b110f[_0x4d1e('0x1d')](_0x956f3d);return _0x3b110f[_0x4d1e('0x23')](_0x4d1e('0x24'),_0x321e87+'-'+_0x139e9b+'/'+_0x3b0d03)[_0x4d1e('0x1e')](_0x4bffda);}return null;};}function patchUpdates(_0x5528d8){return function(_0x100379){try{jsonpatch[_0x4d1e('0x25')](_0x100379,_0x5528d8,!![]);}catch(_0x608f28){return BPromise[_0x4d1e('0x26')](_0x608f28);}return _0x100379[_0x4d1e('0x27')]();};}function saveUpdates(_0x574bf2,_0x639a93){return function(_0x5e4189){if(_0x5e4189){return _0x5e4189['update'](_0x574bf2)[_0x4d1e('0x28')](function(_0x23fb5d){return _0x23fb5d;});}return null;};}function removeEntity(_0x5c46c6,_0x2b2076){return function(_0x538967){if(_0x538967){return _0x538967['destroy']()[_0x4d1e('0x28')](function(){var _0x488211=_0x538967[_0x4d1e('0x29')]({'plain':!![]});var _0x1affbe=_0x4d1e('0x2a');return db[_0x4d1e('0x2b')][_0x4d1e('0x2c')]({'where':{'type':_0x1affbe,'resourceId':_0x488211['id']}})[_0x4d1e('0x28')](function(){return _0x538967;});})[_0x4d1e('0x28')](function(){_0x5c46c6['status'](0xcc)[_0x4d1e('0x1c')]();});}};}function handleEntityNotFound(_0xf87894,_0x5ebc94){return function(_0x43580f){if(!_0x43580f){_0xf87894[_0x4d1e('0x1b')](0x194);}return _0x43580f;};}function handleError(_0x1c5978,_0x34ea98){_0x34ea98=_0x34ea98||0x1f4;return function(_0x4a83f1){logger['error'](_0x4a83f1[_0x4d1e('0x2d')]);if(_0x4a83f1[_0x4d1e('0x2e')]){delete _0x4a83f1['name'];}_0x1c5978[_0x4d1e('0x1d')](_0x34ea98)['send'](_0x4a83f1);};}exports[_0x4d1e('0x2f')]=function(_0xa66d77,_0x1c2044){var _0x53ec1e={},_0x21a032={},_0x4879a1={'count':0x0,'rows':[]};var _0x4994f8=_[_0x4d1e('0x30')](db[_0x4d1e('0x31')][_0x4d1e('0x32')],function(_0x51a1d3){return{'name':_0x51a1d3['fieldName'],'type':_0x51a1d3[_0x4d1e('0x33')][_0x4d1e('0x34')]};});_0x21a032['model']=_[_0x4d1e('0x30')](_0x4994f8,_0x4d1e('0x2e'));_0x21a032[_0x4d1e('0x35')]=_[_0x4d1e('0x36')](_0xa66d77[_0x4d1e('0x35')]);_0x21a032['filters']=_['intersection'](_0x21a032[_0x4d1e('0x37')],_0x21a032[_0x4d1e('0x35')]);_0x53ec1e[_0x4d1e('0x38')]=_['intersection'](_0x21a032['model'],qs['fields'](_0xa66d77[_0x4d1e('0x35')][_0x4d1e('0x39')]));_0x53ec1e[_0x4d1e('0x38')]=_0x53ec1e['attributes'][_0x4d1e('0x3a')]?_0x53ec1e[_0x4d1e('0x38')]:_0x21a032[_0x4d1e('0x37')];if(!_0xa66d77[_0x4d1e('0x35')][_0x4d1e('0x3b')](_0x4d1e('0x3c'))){_0x53ec1e[_0x4d1e('0x21')]=qs['limit'](_0xa66d77[_0x4d1e('0x35')]['limit']);_0x53ec1e['offset']=qs[_0x4d1e('0x1f')](_0xa66d77[_0x4d1e('0x35')][_0x4d1e('0x1f')]);}_0x53ec1e['order']=qs[_0x4d1e('0x3d')](_0xa66d77[_0x4d1e('0x35')][_0x4d1e('0x3d')]);_0x53ec1e[_0x4d1e('0x3e')]=qs['filters'](_[_0x4d1e('0x3f')](_0xa66d77[_0x4d1e('0x35')],_0x21a032[_0x4d1e('0x40')]),_0x4994f8);if(_0xa66d77[_0x4d1e('0x35')]['filter']){_0x53ec1e[_0x4d1e('0x3e')]=_[_0x4d1e('0x41')](_0x53ec1e[_0x4d1e('0x3e')],{'$or':_[_0x4d1e('0x30')](_0x4994f8,function(_0x3bce17){if(_0x3bce17['type']!==_0x4d1e('0x42')){var _0x441b78={};_0x441b78[_0x3bce17[_0x4d1e('0x2e')]]={'$like':'%'+_0xa66d77[_0x4d1e('0x35')]['filter']+'%'};return _0x441b78;}})});}_0x53ec1e=_[_0x4d1e('0x41')]({},_0x53ec1e,_0xa66d77[_0x4d1e('0x43')]);var _0x1891d9={'where':_0x53ec1e['where']};return db[_0x4d1e('0x31')][_0x4d1e('0x22')](_0x1891d9)[_0x4d1e('0x28')](function(_0x4d76c6){_0x4879a1['count']=_0x4d76c6;if(_0xa66d77[_0x4d1e('0x35')][_0x4d1e('0x44')]){_0x53ec1e[_0x4d1e('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x4d1e('0x46')](_0x53ec1e);})[_0x4d1e('0x28')](function(_0x5a986b){_0x4879a1[_0x4d1e('0x47')]=_0x5a986b;return _0x4879a1;})['then'](respondWithFilteredResult(_0x1c2044,_0x53ec1e))[_0x4d1e('0x48')](handleError(_0x1c2044,null));};exports['show']=function(_0x3ce532,_0x5c2d3f){var _0x1d5044={'raw':!![],'where':{'id':_0x3ce532[_0x4d1e('0x49')]['id']}},_0xa81e13={};_0xa81e13[_0x4d1e('0x37')]=_['keys'](db[_0x4d1e('0x31')]['rawAttributes']);_0xa81e13[_0x4d1e('0x35')]=_[_0x4d1e('0x36')](_0x3ce532[_0x4d1e('0x35')]);_0xa81e13[_0x4d1e('0x40')]=_[_0x4d1e('0x4a')](_0xa81e13[_0x4d1e('0x37')],_0xa81e13['query']);_0x1d5044[_0x4d1e('0x38')]=_['intersection'](_0xa81e13[_0x4d1e('0x37')],qs[_0x4d1e('0x39')](_0x3ce532['query'][_0x4d1e('0x39')]));_0x1d5044['attributes']=_0x1d5044[_0x4d1e('0x38')]['length']?_0x1d5044[_0x4d1e('0x38')]:_0xa81e13[_0x4d1e('0x37')];if(_0x3ce532[_0x4d1e('0x35')][_0x4d1e('0x44')]){_0x1d5044[_0x4d1e('0x45')]=[{'all':!![]}];}_0x1d5044=_['merge']({},_0x1d5044,_0x3ce532[_0x4d1e('0x43')]);return db[_0x4d1e('0x31')][_0x4d1e('0x4b')](_0x1d5044)[_0x4d1e('0x28')](handleEntityNotFound(_0x5c2d3f,null))[_0x4d1e('0x28')](respondWithResult(_0x5c2d3f,null))['catch'](handleError(_0x5c2d3f,null));};exports[_0x4d1e('0x4c')]=function(_0x3425e3,_0x163422){return db[_0x4d1e('0x31')]['create'](_0x3425e3['body'],{})[_0x4d1e('0x28')](function(_0x512d37){var _0x515907=_0x3425e3[_0x4d1e('0x4d')][_0x4d1e('0x29')]({'plain':!![]});if(!_0x515907)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x515907[_0x4d1e('0x4e')]===_0x4d1e('0x4d')){var _0x44a256=_0x512d37[_0x4d1e('0x29')]({'plain':!![]});var _0x198f85='Dispositions';return db[_0x4d1e('0x4f')][_0x4d1e('0x4b')]({'where':{'name':_0x198f85,'userProfileId':_0x515907[_0x4d1e('0x50')]},'raw':!![]})[_0x4d1e('0x28')](function(_0x2ae41c){if(_0x2ae41c&&_0x2ae41c[_0x4d1e('0x51')]===0x0){return db[_0x4d1e('0x2b')][_0x4d1e('0x4c')]({'name':_0x44a256[_0x4d1e('0x2e')],'resourceId':_0x44a256['id'],'type':_0x2ae41c[_0x4d1e('0x2e')],'sectionId':_0x2ae41c['id']},{})[_0x4d1e('0x28')](function(){return _0x512d37;});}else{return _0x512d37;}})[_0x4d1e('0x48')](function(_0x56a130){logger[_0x4d1e('0x52')](_0x4d1e('0x53'),_0x56a130);throw _0x56a130;});}return _0x512d37;})[_0x4d1e('0x28')](respondWithResult(_0x163422,0xc9))[_0x4d1e('0x48')](handleError(_0x163422,null));};exports[_0x4d1e('0x54')]=function(_0x33a211,_0x3b25b4){if(_0x33a211[_0x4d1e('0x55')]['id']){delete _0x33a211[_0x4d1e('0x55')]['id'];}return db[_0x4d1e('0x31')][_0x4d1e('0x4b')]({'where':{'id':_0x33a211[_0x4d1e('0x49')]['id']}})[_0x4d1e('0x28')](handleEntityNotFound(_0x3b25b4,null))['then'](saveUpdates(_0x33a211['body'],null))[_0x4d1e('0x28')](respondWithResult(_0x3b25b4,null))[_0x4d1e('0x48')](handleError(_0x3b25b4,null));};exports[_0x4d1e('0x2c')]=function(_0x5e1f38,_0x1fef5c){return db['Disposition']['find']({'where':{'id':_0x5e1f38[_0x4d1e('0x49')]['id']}})[_0x4d1e('0x28')](handleEntityNotFound(_0x1fef5c,null))[_0x4d1e('0x28')](removeEntity(_0x1fef5c,null))['catch'](handleError(_0x1fef5c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 0447a06..a2e1e93 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 _0x1b6f=['SmsAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId'];(function(_0x878f13,_0x25408d){var _0x56f673=function(_0x379e4d){while(--_0x379e4d){_0x878f13['push'](_0x878f13['shift']());}};_0x56f673(++_0x25408d);}(_0x1b6f,0x175));var _0xf1b6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x1b6f[_0x5f0089];return _0x193892;};'use strict';var _=require(_0xf1b6('0x0'));var util=require(_0xf1b6('0x1'));var logger=require(_0xf1b6('0x2'))(_0xf1b6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf1b6('0x4'));var fs=require('fs');var path=require(_0xf1b6('0x5'));var rimraf=require(_0xf1b6('0x6'));var config=require('../../config/environment');var attributes=require(_0xf1b6('0x7'));module[_0xf1b6('0x8')]=function(_0x5bf513,_0x1d61d7){return _0x5bf513[_0xf1b6('0x9')](_0xf1b6('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xf1b6('0xb'),'fields':[_0xf1b6('0xc'),_0xf1b6('0xd')]},{'unique':!![],'name':_0xf1b6('0xe'),'fields':['name',_0xf1b6('0xf')]},{'unique':!![],'name':_0xf1b6('0x10'),'fields':[_0xf1b6('0xc'),_0xf1b6('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0xf1b6('0xc'),_0xf1b6('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0xf1b6('0xc'),'FaxAccountId']},{'unique':!![],'name':_0xf1b6('0x13'),'fields':[_0xf1b6('0xc'),_0xf1b6('0x14')]},{'unique':!![],'name':_0xf1b6('0x15'),'fields':[_0xf1b6('0xc'),_0xf1b6('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f3d=['MailAccountId','name_sms','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail'];(function(_0x3bab18,_0x53d735){var _0x12585f=function(_0x6cb5c4){while(--_0x6cb5c4){_0x3bab18['push'](_0x3bab18['shift']());}};_0x12585f(++_0x53d735);}(_0x0f3d,0x160));var _0xd0f3=function(_0x7f906a,_0x4ab64e){_0x7f906a=_0x7f906a-0x0;var _0x581d41=_0x0f3d[_0x7f906a];return _0x581d41;};'use strict';var _=require('lodash');var util=require(_0xd0f3('0x0'));var logger=require(_0xd0f3('0x1'))(_0xd0f3('0x2'));var moment=require('moment');var BPromise=require(_0xd0f3('0x3'));var rp=require(_0xd0f3('0x4'));var fs=require('fs');var path=require(_0xd0f3('0x5'));var rimraf=require(_0xd0f3('0x6'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xd0f3('0x7')]=function(_0x1ebd4d,_0x4315b7){return _0x1ebd4d['define'](_0xd0f3('0x8'),attributes,{'tableName':_0xd0f3('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xd0f3('0xa'),'fields':[_0xd0f3('0xb'),_0xd0f3('0xc')]},{'unique':!![],'name':_0xd0f3('0xd'),'fields':[_0xd0f3('0xb'),_0xd0f3('0xe')]},{'unique':!![],'name':_0xd0f3('0xf'),'fields':[_0xd0f3('0xb'),_0xd0f3('0x10')]},{'unique':!![],'name':_0xd0f3('0x11'),'fields':[_0xd0f3('0xb'),'SmsAccountId']},{'unique':!![],'name':_0xd0f3('0x12'),'fields':[_0xd0f3('0xb'),'FaxAccountId']},{'unique':!![],'name':_0xd0f3('0x13'),'fields':[_0xd0f3('0xb'),_0xd0f3('0x14')]},{'unique':!![],'name':_0xd0f3('0x15'),'fields':[_0xd0f3('0xb'),_0xd0f3('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index c00494c..3e64025 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(_0x1fb14c,_0x36a8e8){var _0x3706bf=function(_0x1d0d92){while(--_0x1d0d92){_0x1fb14c['push'](_0x1fb14c['shift']());}};_0x3706bf(++_0x36a8e8);}(_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','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(_0x37cc1d,_0x30dfb5){var _0x535676=function(_0x59a3e8){while(--_0x59a3e8){_0x37cc1d['push'](_0x37cc1d['shift']());}};_0x535676(++_0x30dfb5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 f1c2582..95e1cd0 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 _0xe17e=['destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','put','update','delete'];(function(_0x22f6f9,_0x177201){var _0x3957a0=function(_0x16e074){while(--_0x16e074){_0x22f6f9['push'](_0x22f6f9['shift']());}};_0x3957a0(++_0x177201);}(_0xe17e,0x122));var _0xee17=function(_0x51f85b,_0x11fa9f){_0x51f85b=_0x51f85b-0x0;var _0x2f698f=_0xe17e[_0x51f85b];return _0x2f698f;};'use strict';var multer=require('multer');var util=require(_0xee17('0x0'));var path=require(_0xee17('0x1'));var timeout=require(_0xee17('0x2'));var express=require('express');var router=express[_0xee17('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xee17('0x4'));var interaction=require(_0xee17('0x5'));var config=require(_0xee17('0x6'));var controller=require(_0xee17('0x7'));router[_0xee17('0x8')]('/',auth[_0xee17('0x9')](),controller[_0xee17('0xa')]);router[_0xee17('0x8')](_0xee17('0xb'),auth[_0xee17('0x9')](),controller[_0xee17('0xc')]);router['post']('/',auth[_0xee17('0x9')](),controller['create']);router[_0xee17('0xd')](_0xee17('0xb'),auth[_0xee17('0x9')](),controller[_0xee17('0xe')]);router[_0xee17('0xf')](_0xee17('0xb'),auth[_0xee17('0x9')](),controller[_0xee17('0x10')]);module[_0xee17('0x11')]=router; \ No newline at end of file +var _0x718e=['create','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post'];(function(_0x38f147,_0xef37ac){var _0x2206da=function(_0x395c48){while(--_0x395c48){_0x38f147['push'](_0x38f147['shift']());}};_0x2206da(++_0xef37ac);}(_0x718e,0x124));var _0xe718=function(_0x20049b,_0x369c8b){_0x20049b=_0x20049b-0x0;var _0x35cc83=_0x718e[_0x20049b];return _0x35cc83;};'use strict';var multer=require(_0xe718('0x0'));var util=require(_0xe718('0x1'));var path=require('path');var timeout=require(_0xe718('0x2'));var express=require(_0xe718('0x3'));var router=express[_0xe718('0x4')]();var fs_extra=require(_0xe718('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe718('0x6'));var config=require(_0xe718('0x7'));var controller=require(_0xe718('0x8'));router[_0xe718('0x9')]('/',auth[_0xe718('0xa')](),controller[_0xe718('0xb')]);router[_0xe718('0x9')](_0xe718('0xc'),auth[_0xe718('0xa')](),controller['show']);router[_0xe718('0xd')]('/',auth[_0xe718('0xa')](),controller[_0xe718('0xe')]);router['put'](_0xe718('0xc'),auth[_0xe718('0xa')](),controller['update']);router[_0xe718('0xf')]('/:id',auth[_0xe718('0xa')](),controller['destroy']);module[_0xe718('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index acae93d..21cf4d3 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 _0x3914=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','9600','14400','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3914,0xeb));var _0x4391=function(_0x7a112,_0x2eb4a0){_0x7a112=_0x7a112-0x0;var _0x136dc5=_0x3914[_0x7a112];return _0x136dc5;};'use strict';var Sequelize=require(_0x4391('0x0'));module[_0x4391('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4391('0x2')]},'ecm':{'type':Sequelize[_0x4391('0x3')]('yes','no'),'defaultValue':_0x4391('0x4')},'headerinfo':{'type':Sequelize[_0x4391('0x2')],'defaultValue':_0x4391('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x4391('0x6')},'minrate':{'type':Sequelize[_0x4391('0x3')]('2400',_0x4391('0x7'),'7200',_0x4391('0x8'),'12000',_0x4391('0x9')),'defaultValue':_0x4391('0x7')},'maxrate':{'type':Sequelize['ENUM']('2400',_0x4391('0x7'),_0x4391('0xa'),_0x4391('0x8'),'12000',_0x4391('0x9')),'defaultValue':_0x4391('0x9')},'modem':{'type':Sequelize[_0x4391('0x2')],'defaultValue':_0x4391('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4391('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4391('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4391('0x3')](_0x4391('0xd'),_0x4391('0xe'),_0x4391('0xf'),_0x4391('0x10')),'defaultValue':_0x4391('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4391('0x11')],'defaultValue':function(){return _0x4391('0x12');}},'notificationSound':{'type':Sequelize[_0x4391('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4391('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4391('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4391('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4391('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4391('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4391('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x4391('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x4391('0x13')],'defaultValue':![],'comment':_0x4391('0x15'),'set':function(_0x19924d){if(!_0x19924d)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x4391('0x16')]('mandatoryDisposition',_0x19924d);}}}; \ No newline at end of file +var _0x5075=['xCALLY\x20Motion\x20Fax','localstationid','4800','7200','12000','14400','9600','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes'];(function(_0x581040,_0x49fb8b){var _0x5be8ab=function(_0x2cd35b){while(--_0x2cd35b){_0x581040['push'](_0x581040['shift']());}};_0x5be8ab(++_0x49fb8b);}(_0x5075,0x73));var _0x5507=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x5075[_0x14fad0];return _0x5c665f;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5507('0x2')]},'ecm':{'type':Sequelize[_0x5507('0x3')](_0x5507('0x4'),'no'),'defaultValue':_0x5507('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x5507('0x5')},'localstationid':{'type':Sequelize[_0x5507('0x2')],'unique':_0x5507('0x6')},'minrate':{'type':Sequelize['ENUM']('2400',_0x5507('0x7'),_0x5507('0x8'),'9600',_0x5507('0x9'),_0x5507('0xa')),'defaultValue':_0x5507('0x7')},'maxrate':{'type':Sequelize['ENUM']('2400',_0x5507('0x7'),_0x5507('0x8'),_0x5507('0xb'),_0x5507('0x9'),'14400'),'defaultValue':_0x5507('0xa')},'modem':{'type':Sequelize[_0x5507('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x5507('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5507('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5507('0x3')](_0x5507('0xc'),_0x5507('0xd'),_0x5507('0xe'),_0x5507('0xf')),'defaultValue':_0x5507('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5507('0x10')],'defaultValue':function(){return _0x5507('0x11');}},'notificationSound':{'type':Sequelize[_0x5507('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5507('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5507('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5507('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5507('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5507('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5507('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5507('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0x5507('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x5507('0x12')],'defaultValue':![],'comment':_0x5507('0x15'),'set':function(_0x2f0c7d){if(!_0x2f0c7d)this[_0x5507('0x16')](_0x5507('0x17'),null);this[_0x5507('0x16')]('mandatoryDisposition',_0x2f0c7d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 8b441ed..a1e7a43 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 _0x6893=['localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','FaxAccounts','stack','name','send','index','Pause','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','pick','where','merge','filter','options','includeAll','include','FaxAccount','rows','catch','show','params','find','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','update','mandatoryDispositionPause','describe','addDisposition','Disposition','findOne','hasOwnProperty','FaxAccountId','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','nolimit','CmContact','Contact','User','fullname','internal','Tag','color','tag','FaxInteraction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','localstationid','app','system','description','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','findById','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','path','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x3b4688,_0x3994b1){var _0x8ff6c=function(_0x1ef090){while(--_0x1ef090){_0x3b4688['push'](_0x3b4688['shift']());}};_0x8ff6c(++_0x3994b1);}(_0x6893,0xb6));var _0x3689=function(_0xbd201,_0x2d26d0){_0xbd201=_0xbd201-0x0;var _0x103c69=_0x6893[_0xbd201];return _0x103c69;};'use strict';var emlformat=require(_0x3689('0x0'));var rimraf=require(_0x3689('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3689('0x2'));var rp=require('request-promise');var moment=require(_0x3689('0x3'));var BPromise=require(_0x3689('0x4'));var Mustache=require(_0x3689('0x5'));var util=require(_0x3689('0x6'));var path=require('path');var sox=require(_0x3689('0x7'));var csv=require(_0x3689('0x8'));var ejs=require(_0x3689('0x9'));var fs=require('fs');var fs_extra=require(_0x3689('0xa'));var _=require(_0x3689('0xb'));var squel=require(_0x3689('0xc'));var crypto=require(_0x3689('0xd'));var jsforce=require(_0x3689('0xe'));var deskjs=require(_0x3689('0xf'));var toCsv=require(_0x3689('0x8'));var querystring=require('querystring');var Papa=require(_0x3689('0x10'));var Redis=require(_0x3689('0x11'));var authService=require(_0x3689('0x12'));var qs=require(_0x3689('0x13'));var as=require(_0x3689('0x14'));var hardwareService=require(_0x3689('0x15'));var logger=require(_0x3689('0x16'))(_0x3689('0x17'));var utils=require(_0x3689('0x18'));var config=require(_0x3689('0x19'));var licenseUtil=require(_0x3689('0x1a'));var db=require(_0x3689('0x1b'))['db'];config[_0x3689('0x1c')]=_[_0x3689('0x1d')](config[_0x3689('0x1c')],{'host':_0x3689('0x1e'),'port':0x18eb});var socket=require(_0x3689('0x1f'))(new Redis(config[_0x3689('0x1c')]));require(_0x3689('0x20'))[_0x3689('0x21')](socket);var jayson=require(_0x3689('0x22'));var client=jayson[_0x3689('0x23')][_0x3689('0x24')]({'port':0x232c});var client9002=jayson[_0x3689('0x23')][_0x3689('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x2b2b2e,_0x28f095,_0x1768c8,_0x523d12){return new BPromise(function(_0x525b78,_0x4d5790){var _0x4820b7=_0x523d12||client;return _0x4820b7[_0x3689('0x25')](_0x2b2b2e,_0x1768c8)[_0x3689('0x26')](function(_0x45a992){logger[_0x3689('0x27')](_0x3689('0x28'),_0x28f095,_0x3689('0x29'));logger[_0x3689('0x2a')](_0x3689('0x2b'),_0x28f095,'request\x20sent',JSON[_0x3689('0x2c')](_0x45a992));if(_0x45a992[_0x3689('0x2d')]){if(_0x45a992['error'][_0x3689('0x2e')]===0x1f4){logger[_0x3689('0x2d')]('FaxAccount,\x20%s,\x20%s',_0x28f095,_0x45a992[_0x3689('0x2d')][_0x3689('0x2f')]);return _0x4d5790(_0x45a992[_0x3689('0x2d')][_0x3689('0x2f')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x28f095,_0x45a992[_0x3689('0x2d')][_0x3689('0x2f')]);return _0x525b78(_0x45a992[_0x3689('0x2d')][_0x3689('0x2f')]);}else{logger[_0x3689('0x27')]('FaxAccount,\x20%s,\x20%s',_0x28f095,_0x3689('0x29'));_0x525b78(_0x45a992[_0x3689('0x30')][_0x3689('0x2f')]);}})['catch'](function(_0x3df4ad){logger[_0x3689('0x2d')](_0x3689('0x28'),_0x28f095,_0x3df4ad);_0x4d5790(_0x3df4ad);});});}function respondWithStatusCode(_0x2833dd,_0x567dfc){_0x567dfc=_0x567dfc||0xcc;return function(_0x3625d3){if(_0x3625d3){return _0x2833dd[_0x3689('0x31')](_0x567dfc);}return _0x2833dd[_0x3689('0x32')](_0x567dfc)[_0x3689('0x33')]();};}function respondWithResult(_0x5c53f1,_0xf9bdf5){_0xf9bdf5=_0xf9bdf5||0xc8;return function(_0x1a602f){if(_0x1a602f){return _0x5c53f1['status'](_0xf9bdf5)[_0x3689('0x34')](_0x1a602f);}};}function respondWithFilteredResult(_0xf8bd06,_0x435005){return function(_0x47a228){if(_0x47a228){var _0x470c89=typeof _0x435005[_0x3689('0x35')]===_0x3689('0x36')&&typeof _0x435005[_0x3689('0x37')]==='undefined';var _0x57274d=_0x47a228[_0x3689('0x38')];var _0x376919=_0x470c89?0x0:_0x435005['offset'];var _0x18963d=_0x470c89?_0x47a228[_0x3689('0x38')]:_0x435005[_0x3689('0x35')]+_0x435005[_0x3689('0x37')];var _0x1fca17;if(_0x18963d>=_0x57274d){_0x18963d=_0x57274d;_0x1fca17=0xc8;}else{_0x1fca17=0xce;}_0xf8bd06[_0x3689('0x32')](_0x1fca17);return _0xf8bd06[_0x3689('0x39')](_0x3689('0x3a'),_0x376919+'-'+_0x18963d+'/'+_0x57274d)[_0x3689('0x34')](_0x47a228);}return null;};}function patchUpdates(_0x41a9e4){return function(_0x5631ef){try{jsonpatch[_0x3689('0x3b')](_0x5631ef,_0x41a9e4,!![]);}catch(_0x2799da){return BPromise[_0x3689('0x3c')](_0x2799da);}return _0x5631ef[_0x3689('0x3d')]();};}function saveUpdates(_0x1155a8,_0x195e1f){return function(_0x2e5323){if(_0x2e5323){return _0x2e5323['update'](_0x1155a8)['then'](function(_0xce3326){return _0xce3326;});}return null;};}function removeEntity(_0x1e1012,_0x41cb8a){return function(_0x5e617b){if(_0x5e617b){return _0x5e617b[_0x3689('0x3e')]()[_0x3689('0x26')](function(){var _0x46128a=_0x5e617b[_0x3689('0x3f')]({'plain':!![]});var _0x120d22=_0x3689('0x40');return db['UserProfileResource']['destroy']({'where':{'type':_0x120d22,'resourceId':_0x46128a['id']}})[_0x3689('0x26')](function(){return _0x5e617b;});})[_0x3689('0x26')](function(){_0x1e1012[_0x3689('0x32')](0xcc)[_0x3689('0x33')]();});}};}function handleEntityNotFound(_0xf1cad4,_0x16a863){return function(_0x23323d){if(!_0x23323d){_0xf1cad4[_0x3689('0x31')](0x194);}return _0x23323d;};}function handleError(_0x179f2f,_0x1f9ee3){_0x1f9ee3=_0x1f9ee3||0x1f4;return function(_0x5e42ba){logger[_0x3689('0x2d')](_0x5e42ba[_0x3689('0x41')]);if(_0x5e42ba[_0x3689('0x42')]){delete _0x5e42ba[_0x3689('0x42')];}_0x179f2f[_0x3689('0x32')](_0x1f9ee3)[_0x3689('0x43')](_0x5e42ba);};}exports[_0x3689('0x44')]=function(_0x43473e,_0x52d06b){var _0x2addec={'include':[{'model':db[_0x3689('0x45')],'as':'mandatoryDispositionPause'}]},_0x2a7653={},_0x1e5519={'count':0x0,'rows':[]};var _0x40d4ec=_[_0x3689('0x46')](db['FaxAccount'][_0x3689('0x47')],function(_0x3c434e){return{'name':_0x3c434e[_0x3689('0x48')],'type':_0x3c434e[_0x3689('0x49')][_0x3689('0x4a')]};});_0x2a7653[_0x3689('0x4b')]=_[_0x3689('0x46')](_0x40d4ec,_0x3689('0x42'));_0x2a7653['query']=_[_0x3689('0x4c')](_0x43473e[_0x3689('0x4d')]);_0x2a7653[_0x3689('0x4e')]=_[_0x3689('0x4f')](_0x2a7653[_0x3689('0x4b')],_0x2a7653[_0x3689('0x4d')]);_0x2addec['attributes']=_[_0x3689('0x4f')](_0x2a7653[_0x3689('0x4b')],qs['fields'](_0x43473e[_0x3689('0x4d')][_0x3689('0x50')]));_0x2addec[_0x3689('0x51')]=_0x2addec[_0x3689('0x51')][_0x3689('0x52')]?_0x2addec[_0x3689('0x51')]:_0x2a7653[_0x3689('0x4b')];if(!_0x43473e[_0x3689('0x4d')]['hasOwnProperty']('nolimit')){_0x2addec[_0x3689('0x37')]=qs[_0x3689('0x37')](_0x43473e[_0x3689('0x4d')]['limit']);_0x2addec[_0x3689('0x35')]=qs[_0x3689('0x35')](_0x43473e[_0x3689('0x4d')][_0x3689('0x35')]);}_0x2addec[_0x3689('0x53')]=qs[_0x3689('0x54')](_0x43473e[_0x3689('0x4d')][_0x3689('0x54')]);_0x2addec['where']=qs['filters'](_[_0x3689('0x55')](_0x43473e['query'],_0x2a7653[_0x3689('0x4e')]),_0x40d4ec);if(_0x43473e[_0x3689('0x4d')]['filter']){_0x2addec[_0x3689('0x56')]=_[_0x3689('0x57')](_0x2addec[_0x3689('0x56')],{'$or':_[_0x3689('0x46')](_0x40d4ec,function(_0x4d2f6c){if(_0x4d2f6c['type']!=='VIRTUAL'){var _0x552f26={};_0x552f26[_0x4d2f6c[_0x3689('0x42')]]={'$like':'%'+_0x43473e[_0x3689('0x4d')][_0x3689('0x58')]+'%'};return _0x552f26;}})});}_0x2addec=_[_0x3689('0x57')]({},_0x2addec,_0x43473e[_0x3689('0x59')]);var _0xdb21dd={'where':_0x2addec[_0x3689('0x56')]};return db['FaxAccount'][_0x3689('0x38')](_0xdb21dd)[_0x3689('0x26')](function(_0x39c3a8){_0x1e5519[_0x3689('0x38')]=_0x39c3a8;if(_0x43473e[_0x3689('0x4d')][_0x3689('0x5a')]){_0x2addec[_0x3689('0x5b')]=[{'all':!![]}];}return db[_0x3689('0x5c')]['findAll'](_0x2addec);})[_0x3689('0x26')](function(_0x17dc58){_0x1e5519[_0x3689('0x5d')]=_0x17dc58;return _0x1e5519;})['then'](respondWithFilteredResult(_0x52d06b,_0x2addec))[_0x3689('0x5e')](handleError(_0x52d06b,null));};exports[_0x3689('0x5f')]=function(_0x23a7e0,_0x240842){var _0x1081f6={'raw':![],'where':{'id':_0x23a7e0[_0x3689('0x60')]['id']},'include':[{'model':db[_0x3689('0x45')],'as':'mandatoryDispositionPause'}]},_0xf2f078={};_0xf2f078['model']=_[_0x3689('0x4c')](db[_0x3689('0x5c')][_0x3689('0x47')]);_0xf2f078[_0x3689('0x4d')]=_[_0x3689('0x4c')](_0x23a7e0['query']);_0xf2f078[_0x3689('0x4e')]=_[_0x3689('0x4f')](_0xf2f078[_0x3689('0x4b')],_0xf2f078[_0x3689('0x4d')]);_0x1081f6['attributes']=_[_0x3689('0x4f')](_0xf2f078[_0x3689('0x4b')],qs[_0x3689('0x50')](_0x23a7e0['query']['fields']));_0x1081f6['attributes']=_0x1081f6[_0x3689('0x51')]['length']?_0x1081f6[_0x3689('0x51')]:_0xf2f078[_0x3689('0x4b')];if(_0x23a7e0[_0x3689('0x4d')][_0x3689('0x5a')]){_0x1081f6[_0x3689('0x5b')]=[{'all':!![]}];}_0x1081f6=_[_0x3689('0x57')]({},_0x1081f6,_0x23a7e0[_0x3689('0x59')]);return db[_0x3689('0x5c')][_0x3689('0x61')](_0x1081f6)[_0x3689('0x26')](handleEntityNotFound(_0x240842,null))[_0x3689('0x26')](respondWithResult(_0x240842,null))[_0x3689('0x5e')](handleError(_0x240842,null));};exports['create']=function(_0x502b5f,_0x25d34b){return db[_0x3689('0x5c')]['create'](_0x502b5f[_0x3689('0x62')],{})[_0x3689('0x26')](function(_0xef1e76){var _0x37c68e=_0x502b5f[_0x3689('0x63')]['get']({'plain':!![]});if(!_0x37c68e)throw new Error(_0x3689('0x64'));if(_0x37c68e[_0x3689('0x65')]===_0x3689('0x63')){var _0x3089ad=_0xef1e76[_0x3689('0x3f')]({'plain':!![]});var _0x503e67='FaxAccounts';return db[_0x3689('0x66')][_0x3689('0x61')]({'where':{'name':_0x503e67,'userProfileId':_0x37c68e[_0x3689('0x67')]},'raw':!![]})[_0x3689('0x26')](function(_0x2cc4ec){if(_0x2cc4ec&&_0x2cc4ec[_0x3689('0x68')]===0x0){return db[_0x3689('0x69')][_0x3689('0x6a')]({'name':_0x3089ad[_0x3689('0x42')],'resourceId':_0x3089ad['id'],'type':_0x2cc4ec[_0x3689('0x42')],'sectionId':_0x2cc4ec['id']},{})[_0x3689('0x26')](function(){return _0xef1e76;});}else{return _0xef1e76;}})[_0x3689('0x5e')](function(_0x32f81e){logger['error'](_0x3689('0x6b'),_0x32f81e);throw _0x32f81e;});}return _0xef1e76;})[_0x3689('0x26')](respondWithResult(_0x25d34b,0xc9))[_0x3689('0x5e')](handleError(_0x25d34b,null));};exports[_0x3689('0x6c')]=function(_0x386b1e,_0x30a303){if(_0x386b1e['body']['id']){delete _0x386b1e[_0x3689('0x62')]['id'];}return db[_0x3689('0x5c')][_0x3689('0x61')]({'where':{'id':_0x386b1e[_0x3689('0x60')]['id']},'include':[{'model':db[_0x3689('0x45')],'as':_0x3689('0x6d')}]})[_0x3689('0x26')](handleEntityNotFound(_0x30a303,null))[_0x3689('0x26')](saveUpdates(_0x386b1e[_0x3689('0x62')],null))[_0x3689('0x26')](respondWithResult(_0x30a303,null))[_0x3689('0x5e')](handleError(_0x30a303,null));};exports['destroy']=function(_0x17d6ea,_0x20a6f4){return db[_0x3689('0x5c')][_0x3689('0x61')]({'where':{'id':_0x17d6ea['params']['id']}})['then'](handleEntityNotFound(_0x20a6f4,null))[_0x3689('0x26')](removeEntity(_0x20a6f4,null))[_0x3689('0x5e')](handleError(_0x20a6f4,null));};exports[_0x3689('0x6e')]=function(_0x5e493c,_0x2975b3){return db[_0x3689('0x5c')][_0x3689('0x6e')]()[_0x3689('0x26')](respondWithResult(_0x2975b3,null))[_0x3689('0x5e')](handleError(_0x2975b3,null));};exports[_0x3689('0x6f')]=function(_0x34461a,_0x3cceec,_0x3afa5d){if(_0x34461a[_0x3689('0x62')]['id']){delete _0x34461a[_0x3689('0x62')]['id'];}return db[_0x3689('0x5c')][_0x3689('0x61')]({'where':{'id':_0x34461a[_0x3689('0x60')]['id']}})[_0x3689('0x26')](handleEntityNotFound(_0x3cceec,null))['then'](function(_0x31fa99){if(_0x31fa99){_0x34461a[_0x3689('0x62')]['FaxAccountId']=_0x31fa99['id'];return db[_0x3689('0x70')][_0x3689('0x6a')](_0x34461a['body']);}})[_0x3689('0x26')](respondWithResult(_0x3cceec,null))[_0x3689('0x5e')](handleError(_0x3cceec,null));};exports['getDispositions']=function(_0x42a8a,_0x326547,_0xe7d165){var _0x5c9de1={'raw':![],'where':{}};var _0x17a20d={};var _0x266367={'count':0x0,'rows':[]};return db[_0x3689('0x5c')][_0x3689('0x71')]({'where':{'id':_0x42a8a['params']['id']}})[_0x3689('0x26')](handleEntityNotFound(_0x326547,null))[_0x3689('0x26')](function(_0x3a32c8){if(_0x3a32c8){_0x17a20d[_0x3689('0x4b')]=_[_0x3689('0x4c')](db[_0x3689('0x70')]['rawAttributes']);_0x17a20d[_0x3689('0x4d')]=_[_0x3689('0x4c')](_0x42a8a['query']);_0x17a20d[_0x3689('0x4e')]=_[_0x3689('0x4f')](_0x17a20d[_0x3689('0x4b')],_0x17a20d[_0x3689('0x4d')]);_0x5c9de1['attributes']=_[_0x3689('0x4f')](_0x17a20d[_0x3689('0x4b')],qs[_0x3689('0x50')](_0x42a8a['query'][_0x3689('0x50')]));_0x5c9de1[_0x3689('0x51')]=_0x5c9de1[_0x3689('0x51')]['length']?_0x5c9de1[_0x3689('0x51')]:_0x17a20d['model'];if(!_0x42a8a[_0x3689('0x4d')][_0x3689('0x72')]('nolimit')){_0x5c9de1[_0x3689('0x37')]=qs[_0x3689('0x37')](_0x42a8a[_0x3689('0x4d')][_0x3689('0x37')]);_0x5c9de1[_0x3689('0x35')]=qs[_0x3689('0x35')](_0x42a8a[_0x3689('0x4d')][_0x3689('0x35')]);}_0x5c9de1['order']=qs[_0x3689('0x54')](_0x42a8a[_0x3689('0x4d')][_0x3689('0x54')]);_0x5c9de1['where']=qs['filters'](_[_0x3689('0x55')](_0x42a8a['query'],_0x17a20d['filters']));_0x5c9de1[_0x3689('0x56')][_0x3689('0x73')]=_0x3a32c8['id'];if(_0x42a8a[_0x3689('0x4d')]['filter']){_0x5c9de1['where']=_['merge'](_0x5c9de1[_0x3689('0x56')],{'$or':_[_0x3689('0x46')](_0x5c9de1[_0x3689('0x51')],function(_0x4f7efb){var _0x253798={};_0x253798[_0x4f7efb]={'$like':'%'+_0x42a8a['query']['filter']+'%'};return _0x253798;})});}_0x5c9de1=_['merge']({},_0x5c9de1,_0x42a8a[_0x3689('0x59')]);return db[_0x3689('0x70')][_0x3689('0x38')]({'where':_0x5c9de1[_0x3689('0x56')]})['then'](function(_0x115723){_0x266367[_0x3689('0x38')]=_0x115723;if(_0x42a8a[_0x3689('0x4d')][_0x3689('0x5a')]){_0x5c9de1[_0x3689('0x5b')]=[{'all':!![]}];}return db[_0x3689('0x70')][_0x3689('0x74')](_0x5c9de1);})['then'](function(_0x9a39f3){_0x266367['rows']=_0x9a39f3;return _0x266367;});}})['then'](respondWithFilteredResult(_0x326547,_0x5c9de1))[_0x3689('0x5e')](handleError(_0x326547,null));};exports[_0x3689('0x75')]=function(_0x535169,_0x2ecbdd,_0x9d9bb){return db[_0x3689('0x5c')]['find']({'where':{'id':_0x535169[_0x3689('0x60')]['id']}})[_0x3689('0x26')](handleEntityNotFound(_0x2ecbdd,null))[_0x3689('0x26')](function(_0x2fc439){if(_0x2fc439){return _0x2fc439[_0x3689('0x75')](_0x535169[_0x3689('0x4d')][_0x3689('0x76')]);}})[_0x3689('0x26')](respondWithStatusCode(_0x2ecbdd,null))[_0x3689('0x5e')](handleError(_0x2ecbdd,null));};exports['addAnswer']=function(_0x122c4f,_0x549eee,_0x23d6af){if(_0x122c4f[_0x3689('0x62')]['id']){delete _0x122c4f[_0x3689('0x62')]['id'];}return db[_0x3689('0x5c')][_0x3689('0x61')]({'where':{'id':_0x122c4f[_0x3689('0x60')]['id']}})['then'](handleEntityNotFound(_0x549eee,null))[_0x3689('0x26')](function(_0x314f05){if(_0x314f05){_0x122c4f[_0x3689('0x62')][_0x3689('0x73')]=_0x314f05['id'];return db[_0x3689('0x77')][_0x3689('0x6a')](_0x122c4f['body']);}})[_0x3689('0x26')](respondWithResult(_0x549eee,null))['catch'](handleError(_0x549eee,null));};exports[_0x3689('0x78')]=function(_0x28601f,_0x12d332,_0x488132){var _0x408170={'raw':![],'where':{}};var _0x5e4bdd={};var _0x8d9de7={'count':0x0,'rows':[]};return db[_0x3689('0x5c')][_0x3689('0x71')]({'where':{'id':_0x28601f['params']['id']}})[_0x3689('0x26')](handleEntityNotFound(_0x12d332,null))[_0x3689('0x26')](function(_0x3a3ba6){if(_0x3a3ba6){_0x5e4bdd[_0x3689('0x4b')]=_['keys'](db[_0x3689('0x77')][_0x3689('0x47')]);_0x5e4bdd[_0x3689('0x4d')]=_[_0x3689('0x4c')](_0x28601f[_0x3689('0x4d')]);_0x5e4bdd[_0x3689('0x4e')]=_[_0x3689('0x4f')](_0x5e4bdd[_0x3689('0x4b')],_0x5e4bdd[_0x3689('0x4d')]);_0x408170['attributes']=_['intersection'](_0x5e4bdd[_0x3689('0x4b')],qs['fields'](_0x28601f[_0x3689('0x4d')][_0x3689('0x50')]));_0x408170[_0x3689('0x51')]=_0x408170['attributes'][_0x3689('0x52')]?_0x408170[_0x3689('0x51')]:_0x5e4bdd['model'];if(!_0x28601f[_0x3689('0x4d')]['hasOwnProperty']('nolimit')){_0x408170[_0x3689('0x37')]=qs[_0x3689('0x37')](_0x28601f[_0x3689('0x4d')]['limit']);_0x408170[_0x3689('0x35')]=qs[_0x3689('0x35')](_0x28601f['query'][_0x3689('0x35')]);}_0x408170[_0x3689('0x53')]=qs[_0x3689('0x54')](_0x28601f[_0x3689('0x4d')][_0x3689('0x54')]);_0x408170[_0x3689('0x56')]=qs[_0x3689('0x4e')](_['pick'](_0x28601f[_0x3689('0x4d')],_0x5e4bdd[_0x3689('0x4e')]));_0x408170[_0x3689('0x56')]['FaxAccountId']=_0x3a3ba6['id'];if(_0x28601f[_0x3689('0x4d')]['filter']){_0x408170['where']=_[_0x3689('0x57')](_0x408170['where'],{'$or':_['map'](_0x408170['attributes'],function(_0x1d1b8a){var _0x5869a7={};_0x5869a7[_0x1d1b8a]={'$like':'%'+_0x28601f[_0x3689('0x4d')][_0x3689('0x58')]+'%'};return _0x5869a7;})});}_0x408170=_[_0x3689('0x57')]({},_0x408170,_0x28601f[_0x3689('0x59')]);return db[_0x3689('0x77')]['count']({'where':_0x408170[_0x3689('0x56')]})[_0x3689('0x26')](function(_0xbcedad){_0x8d9de7[_0x3689('0x38')]=_0xbcedad;if(_0x28601f[_0x3689('0x4d')][_0x3689('0x5a')]){_0x408170[_0x3689('0x5b')]=[{'all':!![]}];}return db[_0x3689('0x77')][_0x3689('0x74')](_0x408170);})[_0x3689('0x26')](function(_0x4e279f){_0x8d9de7[_0x3689('0x5d')]=_0x4e279f;return _0x8d9de7;});}})[_0x3689('0x26')](respondWithFilteredResult(_0x12d332,_0x408170))['catch'](handleError(_0x12d332,null));};exports[_0x3689('0x79')]=function(_0xf3c187,_0xbed047,_0x1c357d){return db[_0x3689('0x5c')][_0x3689('0x61')]({'where':{'id':_0xf3c187['params']['id']}})[_0x3689('0x26')](handleEntityNotFound(_0xbed047,null))[_0x3689('0x26')](function(_0xc8ad0c){if(_0xc8ad0c){return _0xc8ad0c[_0x3689('0x79')](_0xf3c187[_0x3689('0x4d')]['ids']);}})[_0x3689('0x26')](respondWithStatusCode(_0xbed047,null))['catch'](handleError(_0xbed047,null));};exports[_0x3689('0x7a')]=function(_0x390065,_0x4a7934,_0x4e01ad){return db['FaxInteraction']['find']({'where':{'id':_0x390065[_0x3689('0x60')]['id']}})[_0x3689('0x26')](handleEntityNotFound(_0x4a7934,null))[_0x3689('0x26')](function(_0x12ded1){if(_0x12ded1){return _0x12ded1['addInteraction'](_0x390065[_0x3689('0x62')]['ids'],_[_0x3689('0x7b')](_0x390065['body'],[_0x3689('0x76'),'id'])||{});}})['then'](respondWithResult(_0x4a7934,null))[_0x3689('0x5e')](handleError(_0x4a7934,null));};exports[_0x3689('0x7c')]=function(_0x511393,_0x1b7072,_0xb8af21){var _0x48821e={'raw':![],'where':{}};var _0x47fb99={};var _0x5c69c1={'count':0x0,'rows':[]};return db[_0x3689('0x5c')][_0x3689('0x71')]({'where':{'id':_0x511393[_0x3689('0x60')]['id']}})[_0x3689('0x26')](handleEntityNotFound(_0x1b7072,null))[_0x3689('0x26')](function(_0x1617de){if(_0x1617de){_0x47fb99[_0x3689('0x4b')]=_[_0x3689('0x4c')](db['FaxInteraction'][_0x3689('0x47')]);_0x47fb99[_0x3689('0x4d')]=_[_0x3689('0x4c')](_0x511393['query']);_0x47fb99[_0x3689('0x4e')]=_[_0x3689('0x4f')](_0x47fb99[_0x3689('0x4b')],_0x47fb99[_0x3689('0x4d')]);_0x48821e[_0x3689('0x51')]=_[_0x3689('0x4f')](_0x47fb99[_0x3689('0x4b')],qs[_0x3689('0x50')](_0x511393[_0x3689('0x4d')]['fields']));_0x48821e[_0x3689('0x51')]=_0x48821e[_0x3689('0x51')]['length']?_0x48821e[_0x3689('0x51')]:_0x47fb99[_0x3689('0x4b')];if(!_0x511393['query'][_0x3689('0x72')](_0x3689('0x7d'))){_0x48821e[_0x3689('0x37')]=qs['limit'](_0x511393['query'][_0x3689('0x37')]);_0x48821e[_0x3689('0x35')]=qs[_0x3689('0x35')](_0x511393[_0x3689('0x4d')][_0x3689('0x35')]);}_0x48821e[_0x3689('0x53')]=qs[_0x3689('0x54')](_0x511393[_0x3689('0x4d')][_0x3689('0x54')]);_0x48821e['where']=qs[_0x3689('0x4e')](_[_0x3689('0x55')](_0x511393[_0x3689('0x4d')],_0x47fb99[_0x3689('0x4e')]));_0x48821e[_0x3689('0x56')][_0x3689('0x73')]=_0x1617de['id'];if(_0x511393[_0x3689('0x4d')][_0x3689('0x58')]){_0x48821e[_0x3689('0x56')]=_[_0x3689('0x57')](_0x48821e[_0x3689('0x56')],{'$or':_[_0x3689('0x46')](_0x48821e[_0x3689('0x51')],function(_0x30c078){var _0x210525={};_0x210525[_0x30c078]={'$like':'%'+_0x511393[_0x3689('0x4d')][_0x3689('0x58')]+'%'};return _0x210525;})});}_0x48821e=_[_0x3689('0x57')]({},_0x48821e,_0x511393[_0x3689('0x59')]);return db['FaxInteraction'][_0x3689('0x38')]({'where':_0x48821e['where']})[_0x3689('0x26')](function(_0x599663){_0x5c69c1[_0x3689('0x38')]=_0x599663;if(_0x511393[_0x3689('0x4d')][_0x3689('0x5a')]){_0x48821e[_0x3689('0x5b')]=[{'model':db[_0x3689('0x7e')],'as':_0x3689('0x7f'),'required':![]},{'model':db[_0x3689('0x80')],'as':'Owner','attributes':[_0x3689('0x42'),_0x3689('0x81'),_0x3689('0x82')],'required':![]},{'model':db[_0x3689('0x83')],'as':'Tags','attributes':['id',_0x3689('0x42'),_0x3689('0x84')],'where':_0x511393['query'][_0x3689('0x85')]?{'id':_0x511393['query']['tag']}:undefined,'required':_0x511393[_0x3689('0x4d')][_0x3689('0x85')]?!![]:![]}];}return db[_0x3689('0x86')][_0x3689('0x74')](_0x48821e);})[_0x3689('0x26')](function(_0x3e48a4){_0x5c69c1[_0x3689('0x5d')]=_0x3e48a4;return _0x5c69c1;});}})['then'](respondWithFilteredResult(_0x1b7072,_0x48821e))[_0x3689('0x5e')](handleError(_0x1b7072,null));};exports['addApplications']=function(_0x409673,_0x316ed0){var _0x255a50=_0x409673[_0x3689('0x60')]['id'];var _0x2654ff=_0x409673[_0x3689('0x62')];var _0x52bfe6=0xc8;var _0x267937=null;return db[_0x3689('0x87')]['transaction']({'isolationLevel':db[_0x3689('0x87')][_0x3689('0x88')][_0x3689('0x89')][_0x3689('0x8a')]},function(_0x4fc8cc){return db[_0x3689('0x5c')][_0x3689('0x71')]({'where':{'id':_0x255a50},'transaction':_0x4fc8cc})[_0x3689('0x26')](function(_0x515391){if(_0x515391){return db['FaxApplication'][_0x3689('0x3e')]({'where':{'FaxAccountId':_0x255a50},'transaction':_0x4fc8cc})[_0x3689('0x26')](function(){var _0x2c36a6=_[_0x3689('0x46')](_0x2654ff,function(_0xea2640){_0xea2640[_0x3689('0x73')]=_0x255a50;return _0xea2640;});return db[_0x3689('0x8b')][_0x3689('0x8c')](_0x2c36a6,{'transaction':_0x4fc8cc});});}else{_0x52bfe6=0x194;_0x267937=[];}});})['then'](function(){if(_0x52bfe6!==0x194){return db[_0x3689('0x8b')][_0x3689('0x8d')]({'where':{'FaxAccountId':_0x255a50},'order':_0x3689('0x8e')})[_0x3689('0x26')](function(_0x34abe3){_0x267937=_0x34abe3;});}})[_0x3689('0x5e')](function(_0x59e53d){_0x52bfe6=0x1f4;logger[_0x3689('0x2d')](_0x59e53d[_0x3689('0x41')]);if(_0x59e53d['name']){delete _0x59e53d[_0x3689('0x42')];}_0x267937=_0x59e53d;})[_0x3689('0x8f')](function(){if(_0x267937===null){_0x316ed0[_0x3689('0x31')](_0x52bfe6);}else{if(_0x52bfe6===0x1f4){_0x316ed0['status'](_0x52bfe6)[_0x3689('0x43')](_0x267937);}else{_0x316ed0['status'](_0x52bfe6)[_0x3689('0x34')](_0x267937);}}});};exports[_0x3689('0x90')]=function(_0xd29adc,_0x56826b,_0x37e6c5){var _0x5e9018={};var _0x542b90={};var _0x1c7619;var _0x586e1c;return db['FaxAccount'][_0x3689('0x71')]({'where':{'id':_0xd29adc[_0x3689('0x60')]['id']}})[_0x3689('0x26')](handleEntityNotFound(_0x56826b,null))[_0x3689('0x26')](function(_0x2e7919){if(_0x2e7919){_0x1c7619=_0x2e7919;_0x542b90[_0x3689('0x4b')]=_[_0x3689('0x4c')](db[_0x3689('0x8b')][_0x3689('0x47')]);_0x542b90[_0x3689('0x4d')]=_[_0x3689('0x4c')](_0xd29adc[_0x3689('0x4d')]);_0x542b90[_0x3689('0x4e')]=_[_0x3689('0x4f')](_0x542b90[_0x3689('0x4b')],_0x542b90[_0x3689('0x4d')]);_0x5e9018[_0x3689('0x51')]=_[_0x3689('0x4f')](_0x542b90['model'],qs[_0x3689('0x50')](_0xd29adc[_0x3689('0x4d')][_0x3689('0x50')]));_0x5e9018['attributes']=_0x5e9018[_0x3689('0x51')][_0x3689('0x52')]?_0x5e9018[_0x3689('0x51')]:_0x542b90[_0x3689('0x4b')];_0x5e9018[_0x3689('0x53')]=qs['sort'](_0xd29adc[_0x3689('0x4d')][_0x3689('0x54')]);_0x5e9018['where']=qs[_0x3689('0x4e')](_[_0x3689('0x55')](_0xd29adc[_0x3689('0x4d')],_0x542b90['filters']));if(_0xd29adc[_0x3689('0x4d')][_0x3689('0x58')]){_0x5e9018['where']=_[_0x3689('0x57')](_0x5e9018[_0x3689('0x56')],{'$or':_[_0x3689('0x46')](_0x5e9018['attributes'],function(_0x1d7852){var _0x5a92fb={};_0x5a92fb[_0x1d7852]={'$like':'%'+_0xd29adc[_0x3689('0x4d')]['filter']+'%'};return _0x5a92fb;})});}_0x5e9018=_[_0x3689('0x57')]({},_0x5e9018,_0xd29adc[_0x3689('0x59')]);return _0x1c7619[_0x3689('0x90')](_0x5e9018);}})[_0x3689('0x26')](function(_0x365c0d){if(_0x365c0d){_0x586e1c=_0x365c0d['length'];if(!_0xd29adc[_0x3689('0x4d')]['hasOwnProperty'](_0x3689('0x7d'))){_0x5e9018[_0x3689('0x37')]=qs['limit'](_0xd29adc[_0x3689('0x4d')]['limit']);_0x5e9018[_0x3689('0x35')]=qs[_0x3689('0x35')](_0xd29adc[_0x3689('0x4d')][_0x3689('0x35')]);}return _0x1c7619[_0x3689('0x90')](_0x5e9018);}})[_0x3689('0x26')](function(_0x339958){if(_0x339958){return _0x339958?{'count':_0x586e1c,'rows':_0x339958}:null;}})[_0x3689('0x26')](respondWithResult(_0x56826b,null))[_0x3689('0x5e')](handleError(_0x56826b,null));};function Extension(_0x234ff,_0x3ff224,_0x219574,_0x38a9f7){this[_0x3689('0x91')]=_0x3689('0x92');this['exten']=_0x234ff[_0x3689('0x93')];this[_0x3689('0x94')]=_0x38a9f7;this[_0x3689('0x49')]=_0x3689('0x95');this[_0x3689('0x96')]='Fax\x20Extension';this[_0x3689('0x73')]=_0x234ff['id'];this[_0x3689('0x8e')]=_0x3ff224;this[_0x3689('0x97')]=_0x219574;}function createExtensionsReciveFax(_0x37e729){var _0x7ac106=0x1;var _0x3dd76e=[];_0x3dd76e[_0x3689('0x98')](new Extension(_0x37e729,_0x7ac106,'',_0x3689('0x99')));_0x7ac106+=0x1;_0x3dd76e[_0x3689('0x98')](new Extension(_0x37e729,_0x7ac106,_0x3689('0x9a'),'Set'));_0x7ac106+=0x1;for(var _0x479f8f in _0x37e729){if(_0x37e729[_0x3689('0x72')](_0x479f8f)&&(_0x479f8f===_0x3689('0x9b')||_0x479f8f==='localstationid'||_0x479f8f===_0x3689('0x9c')||_0x479f8f===_0x3689('0x9d')||_0x479f8f===_0x3689('0x9e')||_0x479f8f==='maxrate'||_0x479f8f===_0x3689('0x9f')||_0x479f8f===_0x3689('0xa0')||_0x479f8f===_0x3689('0xa1'))){_0x3dd76e[_0x3689('0x98')](new Extension(_0x37e729,_0x7ac106,'FAXOPT('+_0x479f8f+')='+_0x37e729[_0x479f8f],_0x3689('0xa2')));_0x7ac106+=0x1;}}_0x3dd76e[_0x3689('0x98')](new Extension(_0x37e729,_0x7ac106,'6',_0x3689('0xa3')));_0x7ac106+=0x1;_0x3dd76e['push'](new Extension(_0x37e729,_0x7ac106,_0x3689('0xa4'),_0x3689('0xa5')));_0x7ac106=0x0;return _0x3dd76e;}exports[_0x3689('0xa6')]=function(_0x4e6812,_0x4f34a2,_0x336072){var _0x367ab6;return db[_0x3689('0x87')][_0x3689('0xa7')](function(_0x3465e1){return db[_0x3689('0x5c')][_0x3689('0x6a')](_0x4e6812[_0x3689('0x62')],{'transaction':_0x3465e1})[_0x3689('0x26')](function(_0x4573f8){_0x367ab6=_0x4573f8[_0x3689('0x3f')]({'plain':!![]});return db[_0x3689('0xa8')]['bulkCreate'](createExtensionsReciveFax(_0x367ab6),{'transaction':_0x3465e1});});})['then'](function(){return _0x367ab6;})['then'](respondWithResult(_0x4f34a2,null))['catch'](handleError(_0x4f34a2,null));};exports[_0x3689('0xa9')]=function(_0x4a45ee,_0x2e9948,_0x535d99){var _0x39e561;return db[_0x3689('0x87')][_0x3689('0xa7')](function(_0x41d2c4){return db[_0x3689('0x5c')][_0x3689('0x6c')](_0x4a45ee['body'],{'where':{'id':_0x4a45ee[_0x3689('0x62')]['id']},'transaction':_0x41d2c4})[_0x3689('0x26')](function(_0x185af2){return db[_0x3689('0xa8')][_0x3689('0x3e')]({'where':{'FaxAccountId':_0x4a45ee[_0x3689('0x62')]['id']},'transaction':_0x41d2c4})[_0x3689('0x26')](function(_0x2953cb){return db[_0x3689('0xa8')][_0x3689('0x8c')](createExtensionsReciveFax(_[_0x3689('0x7b')](_0x4a45ee[_0x3689('0x62')],[_0x3689('0xaa'),'key',_0x3689('0xab'),_0x3689('0xac'),'TrunkId','ListId'])),{'transaction':_0x41d2c4});});});})['then'](function(){return db[_0x3689('0x5c')][_0x3689('0xad')](_0x4a45ee[_0x3689('0x62')]['id']);})['then'](respondWithResult(_0x2e9948,null))[_0x3689('0x5e')](handleError(_0x2e9948,null));};exports['getMessages']=function(_0x269b8d,_0x2634a3,_0x30a1df){var _0x2fb209={'raw':!![],'where':{}};var _0x1136b5={};var _0x2ab401={'count':0x0,'rows':[]};return db[_0x3689('0x5c')]['findOne']({'where':{'id':_0x269b8d[_0x3689('0x60')]['id']}})[_0x3689('0x26')](handleEntityNotFound(_0x2634a3,null))[_0x3689('0x26')](function(_0x4dfd8d){if(_0x4dfd8d){_0x1136b5[_0x3689('0x4b')]=_['keys'](db['FaxMessage'][_0x3689('0x47')]);_0x1136b5[_0x3689('0x4d')]=_['keys'](_0x269b8d[_0x3689('0x4d')]);_0x1136b5[_0x3689('0x4e')]=_['intersection'](_0x1136b5[_0x3689('0x4b')],_0x1136b5[_0x3689('0x4d')]);_0x2fb209[_0x3689('0x51')]=_['intersection'](_0x1136b5[_0x3689('0x4b')],qs[_0x3689('0x50')](_0x269b8d[_0x3689('0x4d')][_0x3689('0x50')]));_0x2fb209[_0x3689('0x51')]=_0x2fb209[_0x3689('0x51')]['length']?_0x2fb209[_0x3689('0x51')]:_0x1136b5[_0x3689('0x4b')];if(!_0x269b8d[_0x3689('0x4d')]['hasOwnProperty'](_0x3689('0x7d'))){_0x2fb209[_0x3689('0x37')]=qs[_0x3689('0x37')](_0x269b8d[_0x3689('0x4d')][_0x3689('0x37')]);_0x2fb209[_0x3689('0x35')]=qs[_0x3689('0x35')](_0x269b8d['query'][_0x3689('0x35')]);}_0x2fb209[_0x3689('0x53')]=qs['sort'](_0x269b8d[_0x3689('0x4d')][_0x3689('0x54')]);_0x2fb209[_0x3689('0x56')]=qs['filters'](_[_0x3689('0x55')](_0x269b8d['query'],_0x1136b5[_0x3689('0x4e')]));_0x2fb209[_0x3689('0x56')][_0x3689('0x73')]=_0x4dfd8d['id'];if(_0x269b8d[_0x3689('0x4d')][_0x3689('0x58')]){_0x2fb209[_0x3689('0x56')]=_[_0x3689('0x57')](_0x2fb209[_0x3689('0x56')],{'$or':_[_0x3689('0x46')](_0x2fb209[_0x3689('0x51')],function(_0x167093){var _0x273e47={};_0x273e47[_0x167093]={'$like':'%'+_0x269b8d[_0x3689('0x4d')][_0x3689('0x58')]+'%'};return _0x273e47;})});}if(_0x269b8d[_0x3689('0x4d')][_0x3689('0xae')]){var _0x171bf2=_0x269b8d[_0x3689('0x4d')][_0x3689('0xae')][_0x3689('0xaf')](',');var _0x2417bd={};_0x2417bd[_0x171bf2[0x0]]={'$gte':moment(_0x171bf2[0x1])[_0x3689('0xb0')](_0x3689('0xb1'))};_0x2fb209['where']=_[_0x3689('0x57')](_0x2fb209['where'],_0x2417bd);}_0x2fb209=_[_0x3689('0x57')]({},_0x2fb209,_0x269b8d['options']);return db[_0x3689('0xb2')]['count']({'where':_0x2fb209[_0x3689('0x56')]})[_0x3689('0x26')](function(_0x30d1da){_0x2ab401[_0x3689('0x38')]=_0x30d1da;if(_0x269b8d[_0x3689('0x4d')]['includeAll']){_0x2fb209[_0x3689('0x5b')]=[{'all':!![]}];}return db[_0x3689('0xb2')][_0x3689('0x74')](_0x2fb209);})[_0x3689('0x26')](function(_0x3dda82){_0x2ab401[_0x3689('0x5d')]=_0x3dda82;return _0x2ab401;});}})[_0x3689('0x26')](respondWithFilteredResult(_0x2634a3,_0x2fb209))[_0x3689('0x5e')](handleError(_0x2634a3,null));};exports[_0x3689('0x43')]=function(_0xada84c,_0x102dc4,_0x48e4d3){var _0x596789,_0x3b66be={},_0x51f0e4;if(_0xada84c[_0x3689('0x62')]['to']){_0x51f0e4=_0xada84c[_0x3689('0x62')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0xada84c[_0x3689('0x60')]['id']},'include':[{'model':db[_0x3689('0xb3')],'as':_0x3689('0xb4'),'include':[{'model':db[_0x3689('0x7e')],'as':_0x3689('0xb5'),'where':{'fax':_0x51f0e4},'limit':0x1,'order':[[_0x3689('0xac'),_0x3689('0xb6')]]}]}]})[_0x3689('0x26')](handleEntityNotFound(_0x102dc4,null))[_0x3689('0x26')](function(_0x43c1c7){_0x596789=_0x43c1c7;if(_0xada84c[_0x3689('0x62')]['attachments']&&_0xada84c[_0x3689('0x62')]['attachments'][_0x3689('0x52')]){for(var _0x1ed546=0x0;_0x1ed546<_0xada84c[_0x3689('0x62')]['attachments'][_0x3689('0x52')];_0x1ed546+=0x1){_0xada84c[_0x3689('0x62')][_0x3689('0xb7')][_0x1ed546]={'filename':_0xada84c[_0x3689('0x62')]['attachments'][_0x1ed546][_0x3689('0x42')],'id':_0xada84c[_0x3689('0x62')]['attachments'][_0x1ed546]['id'],'path':path[_0x3689('0xb8')](config[_0x3689('0xb9')],_0x3689('0xba'),_0xada84c[_0x3689('0x62')]['attachments'][_0x1ed546][_0x3689('0xbb')])};}}return respondWithRpcPromise('CheckAfterSend',_0x3689('0xbc'),{'FaxAccountId':_['isNil'](_0xada84c[_0x3689('0x60')]['id'])?undefined:_0xada84c[_0x3689('0x60')]['id'],'path':_['isNil'](_0xada84c[_0x3689('0x62')][_0x3689('0xb7')][0x0][_0x3689('0xbd')])?undefined:_0xada84c[_0x3689('0x62')][_0x3689('0xb7')][0x0][_0x3689('0xbd')],'fax':_[_0x3689('0xbe')](_0xada84c[_0x3689('0x62')]['to'][0x0])?undefined:_0xada84c[_0x3689('0x62')]['to'][0x0]},client9002);})['then'](function(){if(_0x596789){if(_[_0x3689('0xbe')](_0xada84c[_0x3689('0x62')]['from'])){_0xada84c[_0x3689('0x62')][_0x3689('0xbf')]=util['format'](_0x3689('0xc0'),_0x596789[_0x3689('0x42')],_0x596789[_0x3689('0xc1')]);}if(_0x596789[_0x3689('0xb4')]){if(_0x596789[_0x3689('0xb4')][_0x3689('0xb5')][_0x3689('0x52')]){return _0x596789[_0x3689('0xb4')][_0x3689('0xb5')][0x0];}else{return db['CmContact'][_0x3689('0x6a')](_[_0x3689('0x1d')](_0xada84c[_0x3689('0x62')],{'firstName':_0xada84c['body']['to'][0x0],'phone':_0xada84c[_0x3689('0x62')]['to'][0x0],'fax':_0xada84c[_0x3689('0x62')]['to'][0x0],'ListId':_0x596789[_0x3689('0xc2')]}));}}else{throw new Error(_0x3689('0xc3'));}}else{throw new Error(_0x3689('0xc4'));}})[_0x3689('0x26')](function(_0x1310e0){if(_0x1310e0){return db['FaxInteraction'][_0x3689('0x61')]({'where':{'ContactId':_0x1310e0['id'],'closed':![],'FaxAccountId':_0x596789['id']}})[_0x3689('0x26')](function(_0x26a8a5){if(_0x26a8a5){return[_0x26a8a5,![]];}return db[_0x3689('0x86')]['create']({'UserId':_0xada84c[_0x3689('0x63')]['id'],'ContactId':_0x1310e0['id'],'FaxAccountId':_0x596789['id'],'fax':_0xada84c[_0x3689('0x62')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x3689('0x57')](_0xada84c[_0x3689('0x62')],{'read':![],'body':_0xada84c[_0x3689('0x62')][_0x3689('0xb7')][0x0][_0x3689('0xc5')],'FaxAccountId':_0x596789['id'],'UserId':_0xada84c[_0x3689('0x63')]['id'],'ContactId':_0x1310e0['id'],'AttachmentId':_0xada84c[_0x3689('0x62')][_0x3689('0xb7')][0x0]['id']})]},{'include':[{'model':db[_0x3689('0xb2')],'as':_0x3689('0xc6')}]})[_0x3689('0x26')](function(_0x3dc78c){return[_0x3dc78c,!![]];});});}else{throw new Error(_0x3689('0xc7'));}})[_0x3689('0xc8')](function(_0x5a3586,_0x5a8975){if(_0x5a8975){return _0x5a3586;}return db[_0x3689('0xb2')][_0x3689('0x6a')]({'direction':'out','read':![],'body':_0xada84c[_0x3689('0x62')][_0x3689('0xb7')][0x0][_0x3689('0xc5')],'FaxAccountId':_0x596789['id'],'FaxInteractionId':_0x5a3586['id'],'UserId':_0xada84c[_0x3689('0x63')]['id'],'ContactId':_0x5a3586[_0x3689('0xc9')],'AttachmentId':_0xada84c[_0x3689('0x62')][_0x3689('0xb7')][0x0]['id']})[_0x3689('0x26')](function(_0x5d3939){_0x5a3586[_0x3689('0xca')]['Messages']=[];_0x5a3586[_0x3689('0xca')][_0x3689('0xc6')]['push'](_0x5d3939['dataValues']);return _0x5a3586;});})[_0x3689('0x26')](function(_0x3df86b){respondWithRpcPromise(_0x3689('0xcb'),_0x3689('0xcb'),{'FaxAccountId':_[_0x3689('0xbe')](_0xada84c[_0x3689('0x60')]['id'])?undefined:_0xada84c['params']['id'],'path':_['isNil'](_0xada84c[_0x3689('0x62')][_0x3689('0xb7')][0x0][_0x3689('0xbd')])?undefined:_0xada84c[_0x3689('0x62')][_0x3689('0xb7')][0x0][_0x3689('0xbd')],'fax':_[_0x3689('0xbe')](_0xada84c[_0x3689('0x62')]['to'][0x0])?undefined:_0xada84c[_0x3689('0x62')]['to'][0x0],'AttachmentId':_0xada84c[_0x3689('0x62')][_0x3689('0xb7')][0x0]['id']},client9002)[_0x3689('0x26')](function(_0x5e7402){logger[_0x3689('0x27')]('SendFaxRpc,\x20%s',_0x5e7402);})[_0x3689('0x5e')](function(_0x2a819c){logger[_0x3689('0x27')](_0x3689('0xcc'),_0x2a819c);});return _0x3df86b;})[_0x3689('0x26')](respondWithResult(_0x102dc4,null))[_0x3689('0x5e')](handleError(_0x102dc4,null));};exports[_0x3689('0xcd')]=function(_0x478180,_0x4a6157,_0x49056e){return db[_0x3689('0x5c')][_0x3689('0x61')]({'where':{'id':_0x478180[_0x3689('0x60')]['id']}})[_0x3689('0x26')](handleEntityNotFound(_0x4a6157,null))[_0x3689('0x26')](function(_0x1904d2){if(_0x1904d2){return _0x1904d2[_0x3689('0xcd')](_0x478180[_0x3689('0x62')]['ids'],_[_0x3689('0x7b')](_0x478180[_0x3689('0x62')],[_0x3689('0x76'),'id'])||{})[_0x3689('0xc8')](function(_0xf88108){for(var _0x3039a9=0x0;_0x3039a9<_0x478180['body'][_0x3689('0x76')][_0x3689('0x52')];_0x3039a9+=0x1){socket[_0x3689('0xce')](_0x3689('0xcf'),{'UserId':Number(_0x478180['body'][_0x3689('0x76')][_0x3039a9]),'FaxAccountId':Number(_0x478180[_0x3689('0x60')]['id'])});}return _0xf88108;});}})[_0x3689('0x26')](respondWithResult(_0x4a6157,null))[_0x3689('0x5e')](handleError(_0x4a6157,null));};exports[_0x3689('0xd0')]=function(_0xa307d1,_0x3a010b,_0x20bb61){return db['FaxAccount'][_0x3689('0x61')]({'where':{'id':_0xa307d1[_0x3689('0x60')]['id']}})['then'](handleEntityNotFound(_0x3a010b,null))['then'](function(_0x5a26df){if(_0x5a26df){return _0x5a26df[_0x3689('0xd0')](_0xa307d1[_0x3689('0x4d')]['ids'])[_0x3689('0x26')](function(){if(_[_0x3689('0xd1')](_0xa307d1[_0x3689('0x4d')][_0x3689('0x76')])){for(var _0x2b0098=0x0;_0x2b0098<_0xa307d1[_0x3689('0x4d')][_0x3689('0x76')][_0x3689('0x52')];_0x2b0098+=0x1){socket[_0x3689('0xce')]('userFaxAccount:remove',{'UserId':Number(_0xa307d1['query'][_0x3689('0x76')][_0x2b0098]),'FaxAccountId':Number(_0xa307d1['params']['id'])});}}else{socket[_0x3689('0xce')](_0x3689('0xd2'),{'UserId':Number(_0xa307d1[_0x3689('0x4d')][_0x3689('0x76')]),'FaxAccountId':Number(_0xa307d1['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3a010b,null))[_0x3689('0x5e')](handleError(_0x3a010b,null));};exports[_0x3689('0xd3')]=function(_0x5b2f4b,_0x18ce15,_0x17239c){var _0x79d504={};var _0x574472={};var _0x8e6786;var _0x14f5b7;return db['FaxAccount']['findOne']({'where':{'id':_0x5b2f4b[_0x3689('0x60')]['id']}})[_0x3689('0x26')](handleEntityNotFound(_0x18ce15,null))['then'](function(_0x18fefa){if(_0x18fefa){_0x8e6786=_0x18fefa;_0x574472[_0x3689('0x4b')]=_[_0x3689('0x4c')](db[_0x3689('0x80')][_0x3689('0x47')]);_0x574472[_0x3689('0x4d')]=_[_0x3689('0x4c')](_0x5b2f4b[_0x3689('0x4d')]);_0x574472['filters']=_[_0x3689('0x4f')](_0x574472['model'],_0x574472[_0x3689('0x4d')]);_0x79d504[_0x3689('0x51')]=_[_0x3689('0x4f')](_0x574472['model'],qs[_0x3689('0x50')](_0x5b2f4b[_0x3689('0x4d')][_0x3689('0x50')]));_0x79d504['attributes']=_0x79d504[_0x3689('0x51')][_0x3689('0x52')]?_0x79d504[_0x3689('0x51')]:_0x574472['model'];_0x79d504[_0x3689('0x53')]=qs['sort'](_0x5b2f4b[_0x3689('0x4d')]['sort']);_0x79d504['where']=qs[_0x3689('0x4e')](_[_0x3689('0x55')](_0x5b2f4b[_0x3689('0x4d')],_0x574472['filters']));if(_0x5b2f4b['query'][_0x3689('0x58')]){_0x79d504[_0x3689('0x56')]=_[_0x3689('0x57')](_0x79d504[_0x3689('0x56')],{'$or':_[_0x3689('0x46')](_0x79d504[_0x3689('0x51')],function(_0x28a074){var _0x3ac802={};_0x3ac802[_0x28a074]={'$like':'%'+_0x5b2f4b[_0x3689('0x4d')][_0x3689('0x58')]+'%'};return _0x3ac802;})});}_0x79d504=_[_0x3689('0x57')]({},_0x79d504,_0x5b2f4b['options']);return _0x8e6786['getAgents'](_0x79d504);}})['then'](function(_0x4e1688){if(_0x4e1688){_0x14f5b7=_0x4e1688[_0x3689('0x52')];if(!_0x5b2f4b[_0x3689('0x4d')][_0x3689('0x72')]('nolimit')){_0x79d504[_0x3689('0x37')]=qs[_0x3689('0x37')](_0x5b2f4b[_0x3689('0x4d')]['limit']);_0x79d504[_0x3689('0x35')]=qs[_0x3689('0x35')](_0x5b2f4b[_0x3689('0x4d')]['offset']);}return _0x8e6786[_0x3689('0xd3')](_0x79d504);}})[_0x3689('0x26')](function(_0x21b269){if(_0x21b269){return _0x21b269?{'count':_0x14f5b7,'rows':_0x21b269}:null;}})['then'](respondWithResult(_0x18ce15,null))[_0x3689('0x5e')](handleError(_0x18ce15,null));}; \ No newline at end of file +var _0x6a50=['save','destroy','get','name','send','index','mandatoryDispositionPause','map','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','show','params','Pause','FaxAccount','rawAttributes','includeAll','create','body','user','role','FaxAccounts','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','options','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','hasOwnProperty','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','stack','finally','getApplications','context','system','description','Fax\x20Extension','priority','push','Answer','Set','ecm','gateway','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','update','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject'];(function(_0x1dbe31,_0x54c4ca){var _0x3ec4b1=function(_0x5c2aeb){while(--_0x5c2aeb){_0x1dbe31['push'](_0x1dbe31['shift']());}};_0x3ec4b1(++_0x54c4ca);}(_0x6a50,0x8a));var _0x06a5=function(_0x1edf18,_0x9b8bcf){_0x1edf18=_0x1edf18-0x0;var _0x4bb998=_0x6a50[_0x1edf18];return _0x4bb998;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06a5('0x0'));var zipdir=require(_0x06a5('0x1'));var jsonpatch=require(_0x06a5('0x2'));var rp=require(_0x06a5('0x3'));var moment=require(_0x06a5('0x4'));var BPromise=require(_0x06a5('0x5'));var Mustache=require(_0x06a5('0x6'));var util=require(_0x06a5('0x7'));var path=require(_0x06a5('0x8'));var sox=require('sox');var csv=require(_0x06a5('0x9'));var ejs=require(_0x06a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06a5('0xb'));var squel=require('squel');var crypto=require(_0x06a5('0xc'));var jsforce=require(_0x06a5('0xd'));var deskjs=require(_0x06a5('0xe'));var toCsv=require(_0x06a5('0x9'));var querystring=require(_0x06a5('0xf'));var Papa=require(_0x06a5('0x10'));var Redis=require(_0x06a5('0x11'));var authService=require(_0x06a5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x06a5('0x13'));var hardwareService=require(_0x06a5('0x14'));var logger=require(_0x06a5('0x15'))(_0x06a5('0x16'));var utils=require(_0x06a5('0x17'));var config=require(_0x06a5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x06a5('0x19'))['db'];config[_0x06a5('0x1a')]=_[_0x06a5('0x1b')](config[_0x06a5('0x1a')],{'host':_0x06a5('0x1c'),'port':0x18eb});var socket=require(_0x06a5('0x1d'))(new Redis(config[_0x06a5('0x1a')]));require(_0x06a5('0x1e'))[_0x06a5('0x1f')](socket);var jayson=require(_0x06a5('0x20'));var client=jayson[_0x06a5('0x21')][_0x06a5('0x22')]({'port':0x232c});var client9002=jayson[_0x06a5('0x21')][_0x06a5('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4730a4,_0x340198,_0x54892a,_0x3c88ab){return new BPromise(function(_0x1624a0,_0x52eb23){var _0xd47f22=_0x3c88ab||client;return _0xd47f22['request'](_0x4730a4,_0x54892a)[_0x06a5('0x23')](function(_0x4f320d){logger['info'](_0x06a5('0x24'),_0x340198,_0x06a5('0x25'));logger[_0x06a5('0x26')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x340198,_0x06a5('0x25'),JSON[_0x06a5('0x27')](_0x4f320d));if(_0x4f320d[_0x06a5('0x28')]){if(_0x4f320d[_0x06a5('0x28')][_0x06a5('0x29')]===0x1f4){logger[_0x06a5('0x28')]('FaxAccount,\x20%s,\x20%s',_0x340198,_0x4f320d[_0x06a5('0x28')][_0x06a5('0x2a')]);return _0x52eb23(_0x4f320d[_0x06a5('0x28')]['message']);}logger[_0x06a5('0x28')](_0x06a5('0x24'),_0x340198,_0x4f320d['error']['message']);return _0x1624a0(_0x4f320d[_0x06a5('0x28')][_0x06a5('0x2a')]);}else{logger[_0x06a5('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x340198,_0x06a5('0x25'));_0x1624a0(_0x4f320d[_0x06a5('0x2c')][_0x06a5('0x2a')]);}})[_0x06a5('0x2d')](function(_0xa24284){logger[_0x06a5('0x28')](_0x06a5('0x24'),_0x340198,_0xa24284);_0x52eb23(_0xa24284);});});}function respondWithStatusCode(_0x1f9695,_0x1531b2){_0x1531b2=_0x1531b2||0xcc;return function(_0x50f7d5){if(_0x50f7d5){return _0x1f9695[_0x06a5('0x2e')](_0x1531b2);}return _0x1f9695[_0x06a5('0x2f')](_0x1531b2)['end']();};}function respondWithResult(_0x489d4d,_0x21353f){_0x21353f=_0x21353f||0xc8;return function(_0x54f061){if(_0x54f061){return _0x489d4d[_0x06a5('0x2f')](_0x21353f)['json'](_0x54f061);}};}function respondWithFilteredResult(_0x3d4b93,_0x875c35){return function(_0x57bb33){if(_0x57bb33){var _0xc22b4b=typeof _0x875c35[_0x06a5('0x30')]===_0x06a5('0x31')&&typeof _0x875c35[_0x06a5('0x32')]===_0x06a5('0x31');var _0x5955c7=_0x57bb33[_0x06a5('0x33')];var _0x3c7ece=_0xc22b4b?0x0:_0x875c35[_0x06a5('0x30')];var _0x4bdebb=_0xc22b4b?_0x57bb33[_0x06a5('0x33')]:_0x875c35['offset']+_0x875c35[_0x06a5('0x32')];var _0x50b316;if(_0x4bdebb>=_0x5955c7){_0x4bdebb=_0x5955c7;_0x50b316=0xc8;}else{_0x50b316=0xce;}_0x3d4b93[_0x06a5('0x2f')](_0x50b316);return _0x3d4b93[_0x06a5('0x34')]('Content-Range',_0x3c7ece+'-'+_0x4bdebb+'/'+_0x5955c7)[_0x06a5('0x35')](_0x57bb33);}return null;};}function patchUpdates(_0x1f2895){return function(_0x5926f2){try{jsonpatch[_0x06a5('0x36')](_0x5926f2,_0x1f2895,!![]);}catch(_0x4698ef){return BPromise[_0x06a5('0x37')](_0x4698ef);}return _0x5926f2[_0x06a5('0x38')]();};}function saveUpdates(_0x40f5c4,_0x3dc250){return function(_0x5eec21){if(_0x5eec21){return _0x5eec21['update'](_0x40f5c4)['then'](function(_0x3a6da9){return _0x3a6da9;});}return null;};}function removeEntity(_0x449dce,_0x2c8ca4){return function(_0x50fa05){if(_0x50fa05){return _0x50fa05[_0x06a5('0x39')]()[_0x06a5('0x23')](function(){var _0x38bf77=_0x50fa05[_0x06a5('0x3a')]({'plain':!![]});var _0x36dc71='FaxAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x36dc71,'resourceId':_0x38bf77['id']}})['then'](function(){return _0x50fa05;});})[_0x06a5('0x23')](function(){_0x449dce[_0x06a5('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8c5f,_0x3e8d8b){return function(_0x5de0b8){if(!_0x5de0b8){_0x3f8c5f[_0x06a5('0x2e')](0x194);}return _0x5de0b8;};}function handleError(_0x3e30d4,_0x6e12a4){_0x6e12a4=_0x6e12a4||0x1f4;return function(_0x1ff695){logger[_0x06a5('0x28')](_0x1ff695['stack']);if(_0x1ff695[_0x06a5('0x3b')]){delete _0x1ff695[_0x06a5('0x3b')];}_0x3e30d4[_0x06a5('0x2f')](_0x6e12a4)[_0x06a5('0x3c')](_0x1ff695);};}exports[_0x06a5('0x3d')]=function(_0x578fbb,_0x322672){var _0x14187b={'include':[{'model':db['Pause'],'as':_0x06a5('0x3e')}]},_0xc4eea1={},_0xd682bf={'count':0x0,'rows':[]};var _0x278684=_[_0x06a5('0x3f')](db['FaxAccount']['rawAttributes'],function(_0x544bf3){return{'name':_0x544bf3[_0x06a5('0x40')],'type':_0x544bf3[_0x06a5('0x41')][_0x06a5('0x42')]};});_0xc4eea1['model']=_['map'](_0x278684,_0x06a5('0x3b'));_0xc4eea1['query']=_[_0x06a5('0x43')](_0x578fbb[_0x06a5('0x44')]);_0xc4eea1[_0x06a5('0x45')]=_[_0x06a5('0x46')](_0xc4eea1[_0x06a5('0x47')],_0xc4eea1['query']);_0x14187b['attributes']=_['intersection'](_0xc4eea1[_0x06a5('0x47')],qs[_0x06a5('0x48')](_0x578fbb[_0x06a5('0x44')][_0x06a5('0x48')]));_0x14187b[_0x06a5('0x49')]=_0x14187b['attributes'][_0x06a5('0x4a')]?_0x14187b[_0x06a5('0x49')]:_0xc4eea1[_0x06a5('0x47')];if(!_0x578fbb[_0x06a5('0x44')]['hasOwnProperty'](_0x06a5('0x4b'))){_0x14187b[_0x06a5('0x32')]=qs['limit'](_0x578fbb[_0x06a5('0x44')]['limit']);_0x14187b[_0x06a5('0x30')]=qs[_0x06a5('0x30')](_0x578fbb[_0x06a5('0x44')][_0x06a5('0x30')]);}_0x14187b[_0x06a5('0x4c')]=qs[_0x06a5('0x4d')](_0x578fbb[_0x06a5('0x44')]['sort']);_0x14187b[_0x06a5('0x4e')]=qs[_0x06a5('0x45')](_[_0x06a5('0x4f')](_0x578fbb[_0x06a5('0x44')],_0xc4eea1[_0x06a5('0x45')]),_0x278684);if(_0x578fbb[_0x06a5('0x44')][_0x06a5('0x50')]){_0x14187b[_0x06a5('0x4e')]=_[_0x06a5('0x51')](_0x14187b['where'],{'$or':_[_0x06a5('0x3f')](_0x278684,function(_0x4cbeba){if(_0x4cbeba[_0x06a5('0x41')]!=='VIRTUAL'){var _0x5289d7={};_0x5289d7[_0x4cbeba['name']]={'$like':'%'+_0x578fbb[_0x06a5('0x44')][_0x06a5('0x50')]+'%'};return _0x5289d7;}})});}_0x14187b=_[_0x06a5('0x51')]({},_0x14187b,_0x578fbb['options']);var _0x54d4b7={'where':_0x14187b[_0x06a5('0x4e')]};return db['FaxAccount'][_0x06a5('0x33')](_0x54d4b7)[_0x06a5('0x23')](function(_0x5891d6){_0xd682bf[_0x06a5('0x33')]=_0x5891d6;if(_0x578fbb[_0x06a5('0x44')]['includeAll']){_0x14187b[_0x06a5('0x52')]=[{'all':!![]}];}return db['FaxAccount'][_0x06a5('0x53')](_0x14187b);})['then'](function(_0x668422){_0xd682bf[_0x06a5('0x54')]=_0x668422;return _0xd682bf;})[_0x06a5('0x23')](respondWithFilteredResult(_0x322672,_0x14187b))[_0x06a5('0x2d')](handleError(_0x322672,null));};exports[_0x06a5('0x55')]=function(_0x47a374,_0x4233c0){var _0x24023c={'raw':![],'where':{'id':_0x47a374[_0x06a5('0x56')]['id']},'include':[{'model':db[_0x06a5('0x57')],'as':_0x06a5('0x3e')}]},_0x50ee5b={};_0x50ee5b[_0x06a5('0x47')]=_['keys'](db[_0x06a5('0x58')][_0x06a5('0x59')]);_0x50ee5b[_0x06a5('0x44')]=_['keys'](_0x47a374['query']);_0x50ee5b[_0x06a5('0x45')]=_[_0x06a5('0x46')](_0x50ee5b[_0x06a5('0x47')],_0x50ee5b[_0x06a5('0x44')]);_0x24023c[_0x06a5('0x49')]=_[_0x06a5('0x46')](_0x50ee5b[_0x06a5('0x47')],qs['fields'](_0x47a374[_0x06a5('0x44')][_0x06a5('0x48')]));_0x24023c[_0x06a5('0x49')]=_0x24023c['attributes'][_0x06a5('0x4a')]?_0x24023c[_0x06a5('0x49')]:_0x50ee5b[_0x06a5('0x47')];if(_0x47a374['query'][_0x06a5('0x5a')]){_0x24023c[_0x06a5('0x52')]=[{'all':!![]}];}_0x24023c=_['merge']({},_0x24023c,_0x47a374['options']);return db['FaxAccount']['find'](_0x24023c)[_0x06a5('0x23')](handleEntityNotFound(_0x4233c0,null))[_0x06a5('0x23')](respondWithResult(_0x4233c0,null))[_0x06a5('0x2d')](handleError(_0x4233c0,null));};exports['create']=function(_0x256184,_0x5dc664){return db['FaxAccount'][_0x06a5('0x5b')](_0x256184[_0x06a5('0x5c')],{})[_0x06a5('0x23')](function(_0x4a7e07){var _0x362810=_0x256184[_0x06a5('0x5d')][_0x06a5('0x3a')]({'plain':!![]});if(!_0x362810)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x362810[_0x06a5('0x5e')]===_0x06a5('0x5d')){var _0x5277d6=_0x4a7e07['get']({'plain':!![]});var _0x3eacd6=_0x06a5('0x5f');return db[_0x06a5('0x60')][_0x06a5('0x61')]({'where':{'name':_0x3eacd6,'userProfileId':_0x362810['userProfileId']},'raw':!![]})['then'](function(_0x5202c3){if(_0x5202c3&&_0x5202c3[_0x06a5('0x62')]===0x0){return db['UserProfileResource'][_0x06a5('0x5b')]({'name':_0x5277d6['name'],'resourceId':_0x5277d6['id'],'type':_0x5202c3[_0x06a5('0x3b')],'sectionId':_0x5202c3['id']},{})['then'](function(){return _0x4a7e07;});}else{return _0x4a7e07;}})[_0x06a5('0x2d')](function(_0x8eb03f){logger[_0x06a5('0x28')](_0x06a5('0x63'),_0x8eb03f);throw _0x8eb03f;});}return _0x4a7e07;})[_0x06a5('0x23')](respondWithResult(_0x5dc664,0xc9))[_0x06a5('0x2d')](handleError(_0x5dc664,null));};exports['update']=function(_0x1e9785,_0x2570a1){if(_0x1e9785[_0x06a5('0x5c')]['id']){delete _0x1e9785[_0x06a5('0x5c')]['id'];}return db[_0x06a5('0x58')][_0x06a5('0x61')]({'where':{'id':_0x1e9785['params']['id']},'include':[{'model':db[_0x06a5('0x57')],'as':_0x06a5('0x3e')}]})[_0x06a5('0x23')](handleEntityNotFound(_0x2570a1,null))[_0x06a5('0x23')](saveUpdates(_0x1e9785[_0x06a5('0x5c')],null))[_0x06a5('0x23')](respondWithResult(_0x2570a1,null))[_0x06a5('0x2d')](handleError(_0x2570a1,null));};exports[_0x06a5('0x39')]=function(_0x5b5b13,_0x3888e6){return db['FaxAccount'][_0x06a5('0x61')]({'where':{'id':_0x5b5b13[_0x06a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x3888e6,null))['then'](removeEntity(_0x3888e6,null))[_0x06a5('0x2d')](handleError(_0x3888e6,null));};exports[_0x06a5('0x64')]=function(_0x56bbfa,_0x9b4d1c){return db[_0x06a5('0x58')][_0x06a5('0x64')]()[_0x06a5('0x23')](respondWithResult(_0x9b4d1c,null))[_0x06a5('0x2d')](handleError(_0x9b4d1c,null));};exports[_0x06a5('0x65')]=function(_0x558963,_0x15c82d,_0x2ec4c6){if(_0x558963['body']['id']){delete _0x558963[_0x06a5('0x5c')]['id'];}return db[_0x06a5('0x58')]['find']({'where':{'id':_0x558963[_0x06a5('0x56')]['id']}})[_0x06a5('0x23')](handleEntityNotFound(_0x15c82d,null))[_0x06a5('0x23')](function(_0xd6423c){if(_0xd6423c){_0x558963[_0x06a5('0x5c')][_0x06a5('0x66')]=_0xd6423c['id'];return db[_0x06a5('0x67')]['create'](_0x558963[_0x06a5('0x5c')]);}})[_0x06a5('0x23')](respondWithResult(_0x15c82d,null))[_0x06a5('0x2d')](handleError(_0x15c82d,null));};exports['getDispositions']=function(_0x59b9e2,_0x29b24c,_0xc13507){var _0x47f5be={'raw':![],'where':{}};var _0x3a4d36={};var _0x14168e={'count':0x0,'rows':[]};return db[_0x06a5('0x58')][_0x06a5('0x68')]({'where':{'id':_0x59b9e2[_0x06a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x29b24c,null))[_0x06a5('0x23')](function(_0x49de6f){if(_0x49de6f){_0x3a4d36[_0x06a5('0x47')]=_[_0x06a5('0x43')](db['Disposition'][_0x06a5('0x59')]);_0x3a4d36['query']=_[_0x06a5('0x43')](_0x59b9e2[_0x06a5('0x44')]);_0x3a4d36[_0x06a5('0x45')]=_[_0x06a5('0x46')](_0x3a4d36[_0x06a5('0x47')],_0x3a4d36[_0x06a5('0x44')]);_0x47f5be[_0x06a5('0x49')]=_[_0x06a5('0x46')](_0x3a4d36['model'],qs['fields'](_0x59b9e2[_0x06a5('0x44')][_0x06a5('0x48')]));_0x47f5be[_0x06a5('0x49')]=_0x47f5be[_0x06a5('0x49')][_0x06a5('0x4a')]?_0x47f5be['attributes']:_0x3a4d36[_0x06a5('0x47')];if(!_0x59b9e2['query']['hasOwnProperty'](_0x06a5('0x4b'))){_0x47f5be[_0x06a5('0x32')]=qs['limit'](_0x59b9e2[_0x06a5('0x44')][_0x06a5('0x32')]);_0x47f5be[_0x06a5('0x30')]=qs['offset'](_0x59b9e2[_0x06a5('0x44')][_0x06a5('0x30')]);}_0x47f5be[_0x06a5('0x4c')]=qs[_0x06a5('0x4d')](_0x59b9e2['query']['sort']);_0x47f5be[_0x06a5('0x4e')]=qs['filters'](_[_0x06a5('0x4f')](_0x59b9e2['query'],_0x3a4d36[_0x06a5('0x45')]));_0x47f5be[_0x06a5('0x4e')][_0x06a5('0x66')]=_0x49de6f['id'];if(_0x59b9e2['query'][_0x06a5('0x50')]){_0x47f5be['where']=_['merge'](_0x47f5be[_0x06a5('0x4e')],{'$or':_[_0x06a5('0x3f')](_0x47f5be[_0x06a5('0x49')],function(_0x2cbb0d){var _0x572606={};_0x572606[_0x2cbb0d]={'$like':'%'+_0x59b9e2[_0x06a5('0x44')][_0x06a5('0x50')]+'%'};return _0x572606;})});}_0x47f5be=_[_0x06a5('0x51')]({},_0x47f5be,_0x59b9e2[_0x06a5('0x69')]);return db[_0x06a5('0x67')][_0x06a5('0x33')]({'where':_0x47f5be[_0x06a5('0x4e')]})[_0x06a5('0x23')](function(_0x3f73ce){_0x14168e['count']=_0x3f73ce;if(_0x59b9e2[_0x06a5('0x44')][_0x06a5('0x5a')]){_0x47f5be[_0x06a5('0x52')]=[{'all':!![]}];}return db[_0x06a5('0x67')][_0x06a5('0x53')](_0x47f5be);})['then'](function(_0xc72e66){_0x14168e[_0x06a5('0x54')]=_0xc72e66;return _0x14168e;});}})[_0x06a5('0x23')](respondWithFilteredResult(_0x29b24c,_0x47f5be))[_0x06a5('0x2d')](handleError(_0x29b24c,null));};exports[_0x06a5('0x6a')]=function(_0x1a74db,_0x3bb8b5,_0x2c641a){return db[_0x06a5('0x58')][_0x06a5('0x61')]({'where':{'id':_0x1a74db['params']['id']}})[_0x06a5('0x23')](handleEntityNotFound(_0x3bb8b5,null))['then'](function(_0xa392be){if(_0xa392be){return _0xa392be[_0x06a5('0x6a')](_0x1a74db['query'][_0x06a5('0x6b')]);}})[_0x06a5('0x23')](respondWithStatusCode(_0x3bb8b5,null))[_0x06a5('0x2d')](handleError(_0x3bb8b5,null));};exports[_0x06a5('0x6c')]=function(_0x275786,_0x2267b6,_0x40c38b){if(_0x275786[_0x06a5('0x5c')]['id']){delete _0x275786[_0x06a5('0x5c')]['id'];}return db['FaxAccount'][_0x06a5('0x61')]({'where':{'id':_0x275786[_0x06a5('0x56')]['id']}})[_0x06a5('0x23')](handleEntityNotFound(_0x2267b6,null))['then'](function(_0x592fc5){if(_0x592fc5){_0x275786[_0x06a5('0x5c')]['FaxAccountId']=_0x592fc5['id'];return db['CannedAnswer'][_0x06a5('0x5b')](_0x275786[_0x06a5('0x5c')]);}})[_0x06a5('0x23')](respondWithResult(_0x2267b6,null))[_0x06a5('0x2d')](handleError(_0x2267b6,null));};exports[_0x06a5('0x6d')]=function(_0x39c10a,_0x6add39,_0x20e543){var _0x2315b9={'raw':![],'where':{}};var _0x4b35b2={};var _0x3d47be={'count':0x0,'rows':[]};return db[_0x06a5('0x58')][_0x06a5('0x68')]({'where':{'id':_0x39c10a[_0x06a5('0x56')]['id']}})[_0x06a5('0x23')](handleEntityNotFound(_0x6add39,null))['then'](function(_0x5880ea){if(_0x5880ea){_0x4b35b2[_0x06a5('0x47')]=_['keys'](db[_0x06a5('0x6e')][_0x06a5('0x59')]);_0x4b35b2[_0x06a5('0x44')]=_[_0x06a5('0x43')](_0x39c10a[_0x06a5('0x44')]);_0x4b35b2[_0x06a5('0x45')]=_[_0x06a5('0x46')](_0x4b35b2['model'],_0x4b35b2[_0x06a5('0x44')]);_0x2315b9[_0x06a5('0x49')]=_[_0x06a5('0x46')](_0x4b35b2[_0x06a5('0x47')],qs[_0x06a5('0x48')](_0x39c10a[_0x06a5('0x44')][_0x06a5('0x48')]));_0x2315b9[_0x06a5('0x49')]=_0x2315b9[_0x06a5('0x49')][_0x06a5('0x4a')]?_0x2315b9['attributes']:_0x4b35b2['model'];if(!_0x39c10a[_0x06a5('0x44')][_0x06a5('0x6f')](_0x06a5('0x4b'))){_0x2315b9[_0x06a5('0x32')]=qs[_0x06a5('0x32')](_0x39c10a['query']['limit']);_0x2315b9[_0x06a5('0x30')]=qs[_0x06a5('0x30')](_0x39c10a[_0x06a5('0x44')]['offset']);}_0x2315b9['order']=qs[_0x06a5('0x4d')](_0x39c10a['query'][_0x06a5('0x4d')]);_0x2315b9[_0x06a5('0x4e')]=qs[_0x06a5('0x45')](_[_0x06a5('0x4f')](_0x39c10a[_0x06a5('0x44')],_0x4b35b2[_0x06a5('0x45')]));_0x2315b9[_0x06a5('0x4e')][_0x06a5('0x66')]=_0x5880ea['id'];if(_0x39c10a[_0x06a5('0x44')][_0x06a5('0x50')]){_0x2315b9[_0x06a5('0x4e')]=_[_0x06a5('0x51')](_0x2315b9[_0x06a5('0x4e')],{'$or':_[_0x06a5('0x3f')](_0x2315b9[_0x06a5('0x49')],function(_0x14d659){var _0x1598c9={};_0x1598c9[_0x14d659]={'$like':'%'+_0x39c10a[_0x06a5('0x44')][_0x06a5('0x50')]+'%'};return _0x1598c9;})});}_0x2315b9=_['merge']({},_0x2315b9,_0x39c10a[_0x06a5('0x69')]);return db[_0x06a5('0x6e')][_0x06a5('0x33')]({'where':_0x2315b9[_0x06a5('0x4e')]})[_0x06a5('0x23')](function(_0x7f6607){_0x3d47be['count']=_0x7f6607;if(_0x39c10a['query'][_0x06a5('0x5a')]){_0x2315b9[_0x06a5('0x52')]=[{'all':!![]}];}return db[_0x06a5('0x6e')][_0x06a5('0x53')](_0x2315b9);})['then'](function(_0x1a4684){_0x3d47be[_0x06a5('0x54')]=_0x1a4684;return _0x3d47be;});}})[_0x06a5('0x23')](respondWithFilteredResult(_0x6add39,_0x2315b9))[_0x06a5('0x2d')](handleError(_0x6add39,null));};exports['removeAnswers']=function(_0x452d40,_0x41b267,_0x34e023){return db[_0x06a5('0x58')][_0x06a5('0x61')]({'where':{'id':_0x452d40[_0x06a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x41b267,null))['then'](function(_0xe1c9fb){if(_0xe1c9fb){return _0xe1c9fb[_0x06a5('0x70')](_0x452d40[_0x06a5('0x44')][_0x06a5('0x6b')]);}})[_0x06a5('0x23')](respondWithStatusCode(_0x41b267,null))[_0x06a5('0x2d')](handleError(_0x41b267,null));};exports['addInteraction']=function(_0x45c0ac,_0x50aaaf,_0x354137){return db['FaxInteraction'][_0x06a5('0x61')]({'where':{'id':_0x45c0ac[_0x06a5('0x56')]['id']}})[_0x06a5('0x23')](handleEntityNotFound(_0x50aaaf,null))[_0x06a5('0x23')](function(_0x122061){if(_0x122061){return _0x122061[_0x06a5('0x71')](_0x45c0ac[_0x06a5('0x5c')]['ids'],_[_0x06a5('0x72')](_0x45c0ac['body'],[_0x06a5('0x6b'),'id'])||{});}})[_0x06a5('0x23')](respondWithResult(_0x50aaaf,null))[_0x06a5('0x2d')](handleError(_0x50aaaf,null));};exports[_0x06a5('0x73')]=function(_0x338249,_0x2a7487,_0x1eda4f){var _0x1b33a6={'raw':![],'where':{}};var _0x18603b={};var _0x12c347={'count':0x0,'rows':[]};return db['FaxAccount'][_0x06a5('0x68')]({'where':{'id':_0x338249[_0x06a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x2a7487,null))[_0x06a5('0x23')](function(_0xe15727){if(_0xe15727){_0x18603b[_0x06a5('0x47')]=_['keys'](db[_0x06a5('0x74')]['rawAttributes']);_0x18603b['query']=_[_0x06a5('0x43')](_0x338249[_0x06a5('0x44')]);_0x18603b[_0x06a5('0x45')]=_[_0x06a5('0x46')](_0x18603b[_0x06a5('0x47')],_0x18603b[_0x06a5('0x44')]);_0x1b33a6[_0x06a5('0x49')]=_[_0x06a5('0x46')](_0x18603b[_0x06a5('0x47')],qs['fields'](_0x338249[_0x06a5('0x44')][_0x06a5('0x48')]));_0x1b33a6[_0x06a5('0x49')]=_0x1b33a6[_0x06a5('0x49')][_0x06a5('0x4a')]?_0x1b33a6[_0x06a5('0x49')]:_0x18603b['model'];if(!_0x338249[_0x06a5('0x44')][_0x06a5('0x6f')]('nolimit')){_0x1b33a6[_0x06a5('0x32')]=qs['limit'](_0x338249[_0x06a5('0x44')][_0x06a5('0x32')]);_0x1b33a6[_0x06a5('0x30')]=qs[_0x06a5('0x30')](_0x338249['query']['offset']);}_0x1b33a6[_0x06a5('0x4c')]=qs[_0x06a5('0x4d')](_0x338249['query'][_0x06a5('0x4d')]);_0x1b33a6[_0x06a5('0x4e')]=qs['filters'](_[_0x06a5('0x4f')](_0x338249[_0x06a5('0x44')],_0x18603b[_0x06a5('0x45')]));_0x1b33a6[_0x06a5('0x4e')][_0x06a5('0x66')]=_0xe15727['id'];if(_0x338249[_0x06a5('0x44')][_0x06a5('0x50')]){_0x1b33a6['where']=_[_0x06a5('0x51')](_0x1b33a6[_0x06a5('0x4e')],{'$or':_[_0x06a5('0x3f')](_0x1b33a6[_0x06a5('0x49')],function(_0x4aaaee){var _0x50a120={};_0x50a120[_0x4aaaee]={'$like':'%'+_0x338249[_0x06a5('0x44')][_0x06a5('0x50')]+'%'};return _0x50a120;})});}_0x1b33a6=_[_0x06a5('0x51')]({},_0x1b33a6,_0x338249[_0x06a5('0x69')]);return db['FaxInteraction'][_0x06a5('0x33')]({'where':_0x1b33a6[_0x06a5('0x4e')]})[_0x06a5('0x23')](function(_0x1d830c){_0x12c347[_0x06a5('0x33')]=_0x1d830c;if(_0x338249[_0x06a5('0x44')][_0x06a5('0x5a')]){_0x1b33a6[_0x06a5('0x52')]=[{'model':db[_0x06a5('0x75')],'as':_0x06a5('0x76'),'required':![]},{'model':db[_0x06a5('0x77')],'as':_0x06a5('0x78'),'attributes':[_0x06a5('0x3b'),_0x06a5('0x79'),_0x06a5('0x7a')],'required':![]},{'model':db[_0x06a5('0x7b')],'as':_0x06a5('0x7c'),'attributes':['id','name','color'],'where':_0x338249[_0x06a5('0x44')][_0x06a5('0x7d')]?{'id':_0x338249[_0x06a5('0x44')][_0x06a5('0x7d')]}:undefined,'required':_0x338249[_0x06a5('0x44')][_0x06a5('0x7d')]?!![]:![]}];}return db[_0x06a5('0x74')][_0x06a5('0x53')](_0x1b33a6);})[_0x06a5('0x23')](function(_0x12785f){_0x12c347[_0x06a5('0x54')]=_0x12785f;return _0x12c347;});}})[_0x06a5('0x23')](respondWithFilteredResult(_0x2a7487,_0x1b33a6))[_0x06a5('0x2d')](handleError(_0x2a7487,null));};exports[_0x06a5('0x7e')]=function(_0x1392fd,_0x105523){var _0x15f6bb=_0x1392fd[_0x06a5('0x56')]['id'];var _0x16eb62=_0x1392fd['body'];var _0x523839=0xc8;var _0x3fbd12=null;return db['sequelize'][_0x06a5('0x7f')]({'isolationLevel':db[_0x06a5('0x80')][_0x06a5('0x81')][_0x06a5('0x82')][_0x06a5('0x83')]},function(_0x3e1100){return db[_0x06a5('0x58')][_0x06a5('0x68')]({'where':{'id':_0x15f6bb},'transaction':_0x3e1100})[_0x06a5('0x23')](function(_0x46b036){if(_0x46b036){return db[_0x06a5('0x84')][_0x06a5('0x39')]({'where':{'FaxAccountId':_0x15f6bb},'transaction':_0x3e1100})[_0x06a5('0x23')](function(){var _0xe3e3be=_[_0x06a5('0x3f')](_0x16eb62,function(_0x1a2331){_0x1a2331[_0x06a5('0x66')]=_0x15f6bb;return _0x1a2331;});return db['FaxApplication'][_0x06a5('0x85')](_0xe3e3be,{'transaction':_0x3e1100});});}else{_0x523839=0x194;_0x3fbd12=[];}});})[_0x06a5('0x23')](function(){if(_0x523839!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x15f6bb},'order':'priority'})[_0x06a5('0x23')](function(_0x3cf60f){_0x3fbd12=_0x3cf60f;});}})[_0x06a5('0x2d')](function(_0xaf002e){_0x523839=0x1f4;logger[_0x06a5('0x28')](_0xaf002e[_0x06a5('0x86')]);if(_0xaf002e[_0x06a5('0x3b')]){delete _0xaf002e[_0x06a5('0x3b')];}_0x3fbd12=_0xaf002e;})[_0x06a5('0x87')](function(){if(_0x3fbd12===null){_0x105523[_0x06a5('0x2e')](_0x523839);}else{if(_0x523839===0x1f4){_0x105523['status'](_0x523839)['send'](_0x3fbd12);}else{_0x105523[_0x06a5('0x2f')](_0x523839)['json'](_0x3fbd12);}}});};exports[_0x06a5('0x88')]=function(_0x2f119c,_0x431f3d,_0x206c79){var _0x2f2164={};var _0x51116d={};var _0x341525;var _0x3b4370;return db['FaxAccount'][_0x06a5('0x68')]({'where':{'id':_0x2f119c[_0x06a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x431f3d,null))[_0x06a5('0x23')](function(_0x12a29a){if(_0x12a29a){_0x341525=_0x12a29a;_0x51116d[_0x06a5('0x47')]=_[_0x06a5('0x43')](db[_0x06a5('0x84')]['rawAttributes']);_0x51116d['query']=_['keys'](_0x2f119c['query']);_0x51116d['filters']=_[_0x06a5('0x46')](_0x51116d[_0x06a5('0x47')],_0x51116d[_0x06a5('0x44')]);_0x2f2164[_0x06a5('0x49')]=_[_0x06a5('0x46')](_0x51116d[_0x06a5('0x47')],qs[_0x06a5('0x48')](_0x2f119c['query']['fields']));_0x2f2164[_0x06a5('0x49')]=_0x2f2164[_0x06a5('0x49')][_0x06a5('0x4a')]?_0x2f2164[_0x06a5('0x49')]:_0x51116d[_0x06a5('0x47')];_0x2f2164['order']=qs[_0x06a5('0x4d')](_0x2f119c[_0x06a5('0x44')][_0x06a5('0x4d')]);_0x2f2164[_0x06a5('0x4e')]=qs['filters'](_[_0x06a5('0x4f')](_0x2f119c[_0x06a5('0x44')],_0x51116d[_0x06a5('0x45')]));if(_0x2f119c[_0x06a5('0x44')]['filter']){_0x2f2164['where']=_[_0x06a5('0x51')](_0x2f2164['where'],{'$or':_['map'](_0x2f2164['attributes'],function(_0x3a7bf6){var _0x1afe0a={};_0x1afe0a[_0x3a7bf6]={'$like':'%'+_0x2f119c['query']['filter']+'%'};return _0x1afe0a;})});}_0x2f2164=_[_0x06a5('0x51')]({},_0x2f2164,_0x2f119c[_0x06a5('0x69')]);return _0x341525[_0x06a5('0x88')](_0x2f2164);}})[_0x06a5('0x23')](function(_0x46d945){if(_0x46d945){_0x3b4370=_0x46d945['length'];if(!_0x2f119c[_0x06a5('0x44')][_0x06a5('0x6f')](_0x06a5('0x4b'))){_0x2f2164[_0x06a5('0x32')]=qs[_0x06a5('0x32')](_0x2f119c[_0x06a5('0x44')][_0x06a5('0x32')]);_0x2f2164[_0x06a5('0x30')]=qs['offset'](_0x2f119c[_0x06a5('0x44')]['offset']);}return _0x341525[_0x06a5('0x88')](_0x2f2164);}})[_0x06a5('0x23')](function(_0x3ce4bf){if(_0x3ce4bf){return _0x3ce4bf?{'count':_0x3b4370,'rows':_0x3ce4bf}:null;}})[_0x06a5('0x23')](respondWithResult(_0x431f3d,null))[_0x06a5('0x2d')](handleError(_0x431f3d,null));};function Extension(_0x225fdb,_0x33b603,_0x3c51ca,_0x49a7b8){this[_0x06a5('0x89')]='from-voip-provider';this['exten']=_0x225fdb['localstationid'];this['app']=_0x49a7b8;this[_0x06a5('0x41')]=_0x06a5('0x8a');this[_0x06a5('0x8b')]=_0x06a5('0x8c');this['FaxAccountId']=_0x225fdb['id'];this[_0x06a5('0x8d')]=_0x33b603;this['appdata']=_0x3c51ca;}function createExtensionsReciveFax(_0x4a4783){var _0x4c1609=0x1;var _0x1a8ebf=[];_0x1a8ebf[_0x06a5('0x8e')](new Extension(_0x4a4783,_0x4c1609,'',_0x06a5('0x8f')));_0x4c1609+=0x1;_0x1a8ebf['push'](new Extension(_0x4a4783,_0x4c1609,'CDR(type)=inbound-fax',_0x06a5('0x90')));_0x4c1609+=0x1;for(var _0x1aacaf in _0x4a4783){if(_0x4a4783[_0x06a5('0x6f')](_0x1aacaf)&&(_0x1aacaf===_0x06a5('0x91')||_0x1aacaf==='localstationid'||_0x1aacaf===_0x06a5('0x92')||_0x1aacaf==='faxdetect'||_0x1aacaf==='headerinfo'||_0x1aacaf==='maxrate'||_0x1aacaf===_0x06a5('0x93')||_0x1aacaf===_0x06a5('0x94')||_0x1aacaf===_0x06a5('0x95'))){_0x1a8ebf['push'](new Extension(_0x4a4783,_0x4c1609,_0x06a5('0x96')+_0x1aacaf+')='+_0x4a4783[_0x1aacaf],_0x06a5('0x90')));_0x4c1609+=0x1;}}_0x1a8ebf[_0x06a5('0x8e')](new Extension(_0x4a4783,_0x4c1609,'6',_0x06a5('0x97')));_0x4c1609+=0x1;_0x1a8ebf[_0x06a5('0x8e')](new Extension(_0x4a4783,_0x4c1609,'/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',_0x06a5('0x98')));_0x4c1609=0x0;return _0x1a8ebf;}exports[_0x06a5('0x99')]=function(_0x420bfa,_0xea9834,_0x31fbf2){var _0x5a6eaa;return db[_0x06a5('0x80')]['transaction'](function(_0x4e7d72){return db[_0x06a5('0x58')]['create'](_0x420bfa['body'],{'transaction':_0x4e7d72})[_0x06a5('0x23')](function(_0x4090e8){_0x5a6eaa=_0x4090e8['get']({'plain':!![]});return db[_0x06a5('0x9a')][_0x06a5('0x85')](createExtensionsReciveFax(_0x5a6eaa),{'transaction':_0x4e7d72});});})[_0x06a5('0x23')](function(){return _0x5a6eaa;})[_0x06a5('0x23')](respondWithResult(_0xea9834,null))[_0x06a5('0x2d')](handleError(_0xea9834,null));};exports[_0x06a5('0x9b')]=function(_0x1c8afa,_0x158336,_0x267c4b){var _0x23730d;return db[_0x06a5('0x80')][_0x06a5('0x7f')](function(_0x3f1111){return db[_0x06a5('0x58')][_0x06a5('0x9c')](_0x1c8afa[_0x06a5('0x5c')],{'where':{'id':_0x1c8afa['body']['id']},'transaction':_0x3f1111})['then'](function(_0x1400ee){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x1c8afa['body']['id']},'transaction':_0x3f1111})['then'](function(_0x5ae819){return db[_0x06a5('0x9a')][_0x06a5('0x85')](createExtensionsReciveFax(_[_0x06a5('0x72')](_0x1c8afa[_0x06a5('0x5c')],[_0x06a5('0x9d'),'key',_0x06a5('0x9e'),_0x06a5('0x9f'),'TrunkId',_0x06a5('0xa0')])),{'transaction':_0x3f1111});});});})['then'](function(){return db[_0x06a5('0x58')][_0x06a5('0xa1')](_0x1c8afa[_0x06a5('0x5c')]['id']);})[_0x06a5('0x23')](respondWithResult(_0x158336,null))['catch'](handleError(_0x158336,null));};exports[_0x06a5('0xa2')]=function(_0x3f2cb5,_0x1b1597,_0x3d4124){var _0x5d694e={'raw':!![],'where':{}};var _0x281a6f={};var _0x15afa0={'count':0x0,'rows':[]};return db['FaxAccount'][_0x06a5('0x68')]({'where':{'id':_0x3f2cb5['params']['id']}})[_0x06a5('0x23')](handleEntityNotFound(_0x1b1597,null))['then'](function(_0x1267d8){if(_0x1267d8){_0x281a6f['model']=_[_0x06a5('0x43')](db[_0x06a5('0xa3')][_0x06a5('0x59')]);_0x281a6f[_0x06a5('0x44')]=_[_0x06a5('0x43')](_0x3f2cb5[_0x06a5('0x44')]);_0x281a6f[_0x06a5('0x45')]=_[_0x06a5('0x46')](_0x281a6f['model'],_0x281a6f[_0x06a5('0x44')]);_0x5d694e[_0x06a5('0x49')]=_['intersection'](_0x281a6f[_0x06a5('0x47')],qs[_0x06a5('0x48')](_0x3f2cb5[_0x06a5('0x44')][_0x06a5('0x48')]));_0x5d694e['attributes']=_0x5d694e[_0x06a5('0x49')]['length']?_0x5d694e[_0x06a5('0x49')]:_0x281a6f[_0x06a5('0x47')];if(!_0x3f2cb5[_0x06a5('0x44')][_0x06a5('0x6f')]('nolimit')){_0x5d694e[_0x06a5('0x32')]=qs[_0x06a5('0x32')](_0x3f2cb5[_0x06a5('0x44')][_0x06a5('0x32')]);_0x5d694e[_0x06a5('0x30')]=qs['offset'](_0x3f2cb5['query'][_0x06a5('0x30')]);}_0x5d694e[_0x06a5('0x4c')]=qs[_0x06a5('0x4d')](_0x3f2cb5[_0x06a5('0x44')][_0x06a5('0x4d')]);_0x5d694e[_0x06a5('0x4e')]=qs[_0x06a5('0x45')](_['pick'](_0x3f2cb5[_0x06a5('0x44')],_0x281a6f[_0x06a5('0x45')]));_0x5d694e[_0x06a5('0x4e')][_0x06a5('0x66')]=_0x1267d8['id'];if(_0x3f2cb5['query']['filter']){_0x5d694e[_0x06a5('0x4e')]=_[_0x06a5('0x51')](_0x5d694e[_0x06a5('0x4e')],{'$or':_['map'](_0x5d694e[_0x06a5('0x49')],function(_0x1d09f1){var _0x56dda7={};_0x56dda7[_0x1d09f1]={'$like':'%'+_0x3f2cb5[_0x06a5('0x44')][_0x06a5('0x50')]+'%'};return _0x56dda7;})});}if(_0x3f2cb5[_0x06a5('0x44')][_0x06a5('0xa4')]){var _0x5a65e4=_0x3f2cb5[_0x06a5('0x44')]['$gte'][_0x06a5('0xa5')](',');var _0x32ceee={};_0x32ceee[_0x5a65e4[0x0]]={'$gte':moment(_0x5a65e4[0x1])['format'](_0x06a5('0xa6'))};_0x5d694e[_0x06a5('0x4e')]=_[_0x06a5('0x51')](_0x5d694e[_0x06a5('0x4e')],_0x32ceee);}_0x5d694e=_[_0x06a5('0x51')]({},_0x5d694e,_0x3f2cb5[_0x06a5('0x69')]);return db['FaxMessage'][_0x06a5('0x33')]({'where':_0x5d694e[_0x06a5('0x4e')]})[_0x06a5('0x23')](function(_0x5822a2){_0x15afa0[_0x06a5('0x33')]=_0x5822a2;if(_0x3f2cb5['query']['includeAll']){_0x5d694e[_0x06a5('0x52')]=[{'all':!![]}];}return db[_0x06a5('0xa3')]['findAll'](_0x5d694e);})[_0x06a5('0x23')](function(_0xc0897d){_0x15afa0[_0x06a5('0x54')]=_0xc0897d;return _0x15afa0;});}})[_0x06a5('0x23')](respondWithFilteredResult(_0x1b1597,_0x5d694e))[_0x06a5('0x2d')](handleError(_0x1b1597,null));};exports[_0x06a5('0x3c')]=function(_0x15d89d,_0xe7fd03,_0x4fd92a){var _0x46d542,_0x463032={},_0x354c72;if(_0x15d89d['body']['to']){_0x354c72=_0x15d89d[_0x06a5('0x5c')]['to'][0x0];}return db['FaxAccount'][_0x06a5('0x61')]({'where':{'id':_0x15d89d[_0x06a5('0x56')]['id']},'include':[{'model':db[_0x06a5('0xa7')],'as':_0x06a5('0xa8'),'include':[{'model':db[_0x06a5('0x75')],'as':'Contacts','where':{'fax':_0x354c72},'limit':0x1,'order':[['updatedAt',_0x06a5('0xa9')]]}]}]})[_0x06a5('0x23')](handleEntityNotFound(_0xe7fd03,null))[_0x06a5('0x23')](function(_0x2a1e69){_0x46d542=_0x2a1e69;if(_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xaa')]&&_0x15d89d['body']['attachments']['length']){for(var _0x46a527=0x0;_0x46a527<_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xaa')]['length'];_0x46a527+=0x1){_0x15d89d['body'][_0x06a5('0xaa')][_0x46a527]={'filename':_0x15d89d[_0x06a5('0x5c')]['attachments'][_0x46a527][_0x06a5('0x3b')],'id':_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xaa')][_0x46a527]['id'],'path':path['join'](config[_0x06a5('0xab')],_0x06a5('0xac'),_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xaa')][_0x46a527][_0x06a5('0xad')])};}}return respondWithRpcPromise(_0x06a5('0xae'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x15d89d[_0x06a5('0x56')]['id'])?undefined:_0x15d89d[_0x06a5('0x56')]['id'],'path':_[_0x06a5('0xaf')](_0x15d89d['body'][_0x06a5('0xaa')][0x0][_0x06a5('0x8')])?undefined:_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xaa')][0x0][_0x06a5('0x8')],'fax':_[_0x06a5('0xaf')](_0x15d89d[_0x06a5('0x5c')]['to'][0x0])?undefined:_0x15d89d[_0x06a5('0x5c')]['to'][0x0]},client9002);})[_0x06a5('0x23')](function(){if(_0x46d542){if(_[_0x06a5('0xaf')](_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xb0')])){_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xb0')]=util['format'](_0x06a5('0xb1'),_0x46d542['name'],_0x46d542['fax']);}if(_0x46d542[_0x06a5('0xa8')]){if(_0x46d542[_0x06a5('0xa8')][_0x06a5('0xb2')][_0x06a5('0x4a')]){return _0x46d542['List'][_0x06a5('0xb2')][0x0];}else{return db[_0x06a5('0x75')][_0x06a5('0x5b')](_[_0x06a5('0x1b')](_0x15d89d['body'],{'firstName':_0x15d89d[_0x06a5('0x5c')]['to'][0x0],'phone':_0x15d89d[_0x06a5('0x5c')]['to'][0x0],'fax':_0x15d89d[_0x06a5('0x5c')]['to'][0x0],'ListId':_0x46d542[_0x06a5('0xa0')]}));}}else{throw new Error(_0x06a5('0xb3'));}}else{throw new Error(_0x06a5('0xb4'));}})[_0x06a5('0x23')](function(_0x3184fe){if(_0x3184fe){return db[_0x06a5('0x74')][_0x06a5('0x61')]({'where':{'ContactId':_0x3184fe['id'],'closed':![],'FaxAccountId':_0x46d542['id']}})[_0x06a5('0x23')](function(_0x2a5f1f){if(_0x2a5f1f){return[_0x2a5f1f,![]];}return db[_0x06a5('0x74')]['create']({'UserId':_0x15d89d['user']['id'],'ContactId':_0x3184fe['id'],'FaxAccountId':_0x46d542['id'],'fax':_0x15d89d[_0x06a5('0x5c')]['to'][0x0],'firstMsgDirection':_0x06a5('0xb5'),'Messages':[_[_0x06a5('0x51')](_0x15d89d[_0x06a5('0x5c')],{'read':![],'body':_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xaa')][0x0]['filename'],'FaxAccountId':_0x46d542['id'],'UserId':_0x15d89d['user']['id'],'ContactId':_0x3184fe['id'],'AttachmentId':_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x06a5('0xa3')],'as':_0x06a5('0xb6')}]})['then'](function(_0x5297c3){return[_0x5297c3,!![]];});});}else{throw new Error(_0x06a5('0xb7'));}})[_0x06a5('0xb8')](function(_0x1559bb,_0x1ff08f){if(_0x1ff08f){return _0x1559bb;}return db['FaxMessage']['create']({'direction':_0x06a5('0xb5'),'read':![],'body':_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xaa')][0x0][_0x06a5('0xb9')],'FaxAccountId':_0x46d542['id'],'FaxInteractionId':_0x1559bb['id'],'UserId':_0x15d89d[_0x06a5('0x5d')]['id'],'ContactId':_0x1559bb['ContactId'],'AttachmentId':_0x15d89d['body'][_0x06a5('0xaa')][0x0]['id']})['then'](function(_0x4d33a3){_0x1559bb['dataValues'][_0x06a5('0xb6')]=[];_0x1559bb['dataValues'][_0x06a5('0xb6')][_0x06a5('0x8e')](_0x4d33a3['dataValues']);return _0x1559bb;});})['then'](function(_0x48e15b){respondWithRpcPromise(_0x06a5('0xba'),_0x06a5('0xba'),{'FaxAccountId':_[_0x06a5('0xaf')](_0x15d89d[_0x06a5('0x56')]['id'])?undefined:_0x15d89d['params']['id'],'path':_[_0x06a5('0xaf')](_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xaa')][0x0][_0x06a5('0x8')])?undefined:_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xaa')][0x0][_0x06a5('0x8')],'fax':_[_0x06a5('0xaf')](_0x15d89d[_0x06a5('0x5c')]['to'][0x0])?undefined:_0x15d89d['body']['to'][0x0],'AttachmentId':_0x15d89d[_0x06a5('0x5c')][_0x06a5('0xaa')][0x0]['id']},client9002)[_0x06a5('0x23')](function(_0x129d42){logger[_0x06a5('0x2b')](_0x06a5('0xbb'),_0x129d42);})[_0x06a5('0x2d')](function(_0x264f67){logger[_0x06a5('0x2b')]('SendFaxRpc,\x20%s',_0x264f67);});return _0x48e15b;})['then'](respondWithResult(_0xe7fd03,null))[_0x06a5('0x2d')](handleError(_0xe7fd03,null));};exports[_0x06a5('0xbc')]=function(_0x267693,_0xae521c,_0x79329a){return db[_0x06a5('0x58')][_0x06a5('0x61')]({'where':{'id':_0x267693[_0x06a5('0x56')]['id']}})[_0x06a5('0x23')](handleEntityNotFound(_0xae521c,null))[_0x06a5('0x23')](function(_0x5605df){if(_0x5605df){return _0x5605df['addAgents'](_0x267693['body']['ids'],_[_0x06a5('0x72')](_0x267693['body'],[_0x06a5('0x6b'),'id'])||{})[_0x06a5('0xb8')](function(_0x2e2615){for(var _0x187fdb=0x0;_0x187fdb<_0x267693[_0x06a5('0x5c')][_0x06a5('0x6b')][_0x06a5('0x4a')];_0x187fdb+=0x1){socket[_0x06a5('0xbd')]('userFaxAccount:save',{'UserId':Number(_0x267693['body']['ids'][_0x187fdb]),'FaxAccountId':Number(_0x267693[_0x06a5('0x56')]['id'])});}return _0x2e2615;});}})['then'](respondWithResult(_0xae521c,null))[_0x06a5('0x2d')](handleError(_0xae521c,null));};exports[_0x06a5('0xbe')]=function(_0x240b70,_0x5457b8,_0x4dee45){return db['FaxAccount'][_0x06a5('0x61')]({'where':{'id':_0x240b70[_0x06a5('0x56')]['id']}})[_0x06a5('0x23')](handleEntityNotFound(_0x5457b8,null))[_0x06a5('0x23')](function(_0x57e9e8){if(_0x57e9e8){return _0x57e9e8['removeAgents'](_0x240b70[_0x06a5('0x44')][_0x06a5('0x6b')])['then'](function(){if(_[_0x06a5('0xbf')](_0x240b70['query'][_0x06a5('0x6b')])){for(var _0x29eba0=0x0;_0x29eba0<_0x240b70['query']['ids'][_0x06a5('0x4a')];_0x29eba0+=0x1){socket[_0x06a5('0xbd')](_0x06a5('0xc0'),{'UserId':Number(_0x240b70[_0x06a5('0x44')][_0x06a5('0x6b')][_0x29eba0]),'FaxAccountId':Number(_0x240b70[_0x06a5('0x56')]['id'])});}}else{socket[_0x06a5('0xbd')](_0x06a5('0xc0'),{'UserId':Number(_0x240b70[_0x06a5('0x44')][_0x06a5('0x6b')]),'FaxAccountId':Number(_0x240b70[_0x06a5('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x5457b8,null))[_0x06a5('0x2d')](handleError(_0x5457b8,null));};exports[_0x06a5('0xc1')]=function(_0x5075f2,_0x2d00d1,_0x2a7570){var _0x137c72={};var _0x32126a={};var _0x52082f;var _0x490bd2;return db[_0x06a5('0x58')]['findOne']({'where':{'id':_0x5075f2[_0x06a5('0x56')]['id']}})[_0x06a5('0x23')](handleEntityNotFound(_0x2d00d1,null))[_0x06a5('0x23')](function(_0x2305ee){if(_0x2305ee){_0x52082f=_0x2305ee;_0x32126a['model']=_[_0x06a5('0x43')](db[_0x06a5('0x77')]['rawAttributes']);_0x32126a['query']=_[_0x06a5('0x43')](_0x5075f2[_0x06a5('0x44')]);_0x32126a[_0x06a5('0x45')]=_[_0x06a5('0x46')](_0x32126a[_0x06a5('0x47')],_0x32126a[_0x06a5('0x44')]);_0x137c72['attributes']=_['intersection'](_0x32126a[_0x06a5('0x47')],qs[_0x06a5('0x48')](_0x5075f2[_0x06a5('0x44')][_0x06a5('0x48')]));_0x137c72['attributes']=_0x137c72['attributes'][_0x06a5('0x4a')]?_0x137c72[_0x06a5('0x49')]:_0x32126a[_0x06a5('0x47')];_0x137c72[_0x06a5('0x4c')]=qs[_0x06a5('0x4d')](_0x5075f2[_0x06a5('0x44')][_0x06a5('0x4d')]);_0x137c72[_0x06a5('0x4e')]=qs[_0x06a5('0x45')](_[_0x06a5('0x4f')](_0x5075f2['query'],_0x32126a[_0x06a5('0x45')]));if(_0x5075f2[_0x06a5('0x44')]['filter']){_0x137c72['where']=_[_0x06a5('0x51')](_0x137c72['where'],{'$or':_[_0x06a5('0x3f')](_0x137c72[_0x06a5('0x49')],function(_0x804c16){var _0x40fcf3={};_0x40fcf3[_0x804c16]={'$like':'%'+_0x5075f2['query']['filter']+'%'};return _0x40fcf3;})});}_0x137c72=_[_0x06a5('0x51')]({},_0x137c72,_0x5075f2[_0x06a5('0x69')]);return _0x52082f[_0x06a5('0xc1')](_0x137c72);}})['then'](function(_0x337d18){if(_0x337d18){_0x490bd2=_0x337d18[_0x06a5('0x4a')];if(!_0x5075f2['query'][_0x06a5('0x6f')](_0x06a5('0x4b'))){_0x137c72[_0x06a5('0x32')]=qs[_0x06a5('0x32')](_0x5075f2[_0x06a5('0x44')][_0x06a5('0x32')]);_0x137c72[_0x06a5('0x30')]=qs[_0x06a5('0x30')](_0x5075f2[_0x06a5('0x44')]['offset']);}return _0x52082f['getAgents'](_0x137c72);}})['then'](function(_0x267335){if(_0x267335){return _0x267335?{'count':_0x490bd2,'rows':_0x267335}:null;}})[_0x06a5('0x23')](respondWithResult(_0x2d00d1,null))['catch'](handleError(_0x2d00d1,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index d339e4d..da0c167 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 _0x8da8=['update','emit','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x44247a,_0x4b5e6e){var _0x508d36=function(_0x32fc39){while(--_0x32fc39){_0x44247a['push'](_0x44247a['shift']());}};_0x508d36(++_0x4b5e6e);}(_0x8da8,0x187));var _0x88da=function(_0xd1428f,_0x3e332f){_0xd1428f=_0xd1428f-0x0;var _0x4566a9=_0x8da8[_0xd1428f];return _0x4566a9;};'use strict';var EventEmitter=require(_0x88da('0x0'));var FaxAccount=require(_0x88da('0x1'))['db'][_0x88da('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x88da('0x3')](0x0);var events={'afterCreate':_0x88da('0x4'),'afterUpdate':_0x88da('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1e0e68){return function(_0x105998,_0x3f5e32,_0x2bac72){FaxAccountEvents[_0x88da('0x6')](_0x1e0e68+':'+_0x105998['id'],_0x105998);FaxAccountEvents[_0x88da('0x6')](_0x1e0e68,_0x105998);_0x2bac72(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x88da('0x7')](e,emitEvent(event));}}module[_0x88da('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xcff4=['hook','exports','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0xa9df4,_0x4361fc){var _0x46dc77=function(_0x244c76){while(--_0x244c76){_0xa9df4['push'](_0xa9df4['shift']());}};_0x46dc77(++_0x4361fc);}(_0xcff4,0x8a));var _0x4cff=function(_0x2bbde2,_0x232b3e){_0x2bbde2=_0x2bbde2-0x0;var _0x4e05a7=_0xcff4[_0x2bbde2];return _0x4e05a7;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x4cff('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4cff('0x1'),'afterUpdate':_0x4cff('0x2'),'afterDestroy':_0x4cff('0x3')};function emitEvent(_0x3ce3e6){return function(_0x50f3f6,_0x263280,_0x1bb54b){FaxAccountEvents['emit'](_0x3ce3e6+':'+_0x50f3f6['id'],_0x50f3f6);FaxAccountEvents[_0x4cff('0x4')](_0x3ce3e6,_0x50f3f6);_0x1bb54b(null);};}for(var e in events){if(events[_0x4cff('0x5')](e)){var event=events[e];FaxAccount[_0x4cff('0x6')](e,emitEvent(event));}}module[_0x4cff('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index a575707..beedb6e 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 _0x4b40=['define','FaxAccount','fax_accounts','lodash','util','api','moment','request-promise','path','rimraf','exports'];(function(_0x125233,_0x522bf1){var _0x42d385=function(_0x5544d5){while(--_0x5544d5){_0x125233['push'](_0x125233['shift']());}};_0x42d385(++_0x522bf1);}(_0x4b40,0x1bb));var _0x04b4=function(_0x48fb82,_0x2a0c0c){_0x48fb82=_0x48fb82-0x0;var _0x4bca6f=_0x4b40[_0x48fb82];return _0x4bca6f;};'use strict';var _=require(_0x04b4('0x0'));var util=require(_0x04b4('0x1'));var logger=require('../../config/logger')(_0x04b4('0x2'));var moment=require(_0x04b4('0x3'));var BPromise=require('bluebird');var rp=require(_0x04b4('0x4'));var fs=require('fs');var path=require(_0x04b4('0x5'));var rimraf=require(_0x04b4('0x6'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x04b4('0x7')]=function(_0x2f3158,_0x28be1a){return _0x2f3158[_0x04b4('0x8')](_0x04b4('0x9'),attributes,{'tableName':_0x04b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bc3=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','lodash'];(function(_0x4fe979,_0x5d5a5c){var _0xea3284=function(_0x1a0cf4){while(--_0x1a0cf4){_0x4fe979['push'](_0x4fe979['shift']());}};_0xea3284(++_0x5d5a5c);}(_0x1bc3,0xbf));var _0x31bc=function(_0x1a740e,_0x572ea2){_0x1a740e=_0x1a740e-0x0;var _0x32d8eb=_0x1bc3[_0x1a740e];return _0x32d8eb;};'use strict';var _=require(_0x31bc('0x0'));var util=require(_0x31bc('0x1'));var logger=require('../../config/logger')(_0x31bc('0x2'));var moment=require(_0x31bc('0x3'));var BPromise=require(_0x31bc('0x4'));var rp=require(_0x31bc('0x5'));var fs=require('fs');var path=require(_0x31bc('0x6'));var rimraf=require(_0x31bc('0x7'));var config=require(_0x31bc('0x8'));var attributes=require(_0x31bc('0x9'));module['exports']=function(_0x3fbfde,_0x32062a){return _0x3fbfde[_0x31bc('0xa')](_0x31bc('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 7ec56fb..51b2ed3 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 _0xc16d=['findAll','options','raw','where','limit','map','include','model','attributes','stringify','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','DESC','FaxApplication','get','applications','Applications','list','priority','asc','length','defaults','FaxInteraction','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','create','ContactId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','FaxAccount'];(function(_0x2648f3,_0x38a797){var _0x9ef187=function(_0x2a4eaf){while(--_0x2a4eaf){_0x2648f3['push'](_0x2648f3['shift']());}};_0x9ef187(++_0x38a797);}(_0xc16d,0x1b3));var _0xdc16=function(_0x2ce874,_0x2bd2c9){_0x2ce874=_0x2ce874-0x0;var _0x407f5b=_0xc16d[_0x2ce874];return _0x407f5b;};'use strict';var _=require(_0xdc16('0x0'));var util=require(_0xdc16('0x1'));var moment=require(_0xdc16('0x2'));var BPromise=require(_0xdc16('0x3'));var rs=require(_0xdc16('0x4'));var fs=require('fs');var Redis=require(_0xdc16('0x5'));var db=require(_0xdc16('0x6'))['db'];var utils=require(_0xdc16('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xdc16('0x8'));var jayson=require(_0xdc16('0x9'));var client=jayson[_0xdc16('0xa')][_0xdc16('0xb')]({'port':0x232c});config[_0xdc16('0xc')]=_['defaults'](config[_0xdc16('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc16('0xd'))(new Redis(config[_0xdc16('0xc')]));require(_0xdc16('0xe'))[_0xdc16('0xf')](socket);function respondWithRpcPromise(_0x223ab,_0x522d90,_0x157d69){return new BPromise(function(_0x4e278d,_0x4d7db2){return client[_0xdc16('0x10')](_0x223ab,_0x157d69)[_0xdc16('0x11')](function(_0x552fe8){logger[_0xdc16('0x12')](_0xdc16('0x13'),_0x522d90,_0xdc16('0x14'));logger[_0xdc16('0x15')](_0xdc16('0x16'),_0x522d90,_0xdc16('0x14'),JSON['stringify'](_0x552fe8));if(_0x552fe8[_0xdc16('0x17')]){if(_0x552fe8[_0xdc16('0x17')][_0xdc16('0x18')]===0x1f4){logger[_0xdc16('0x17')]('FaxAccount,\x20%s,\x20%s',_0x522d90,_0x552fe8[_0xdc16('0x17')][_0xdc16('0x19')]);return _0x4d7db2(_0x552fe8['error'][_0xdc16('0x19')]);}logger[_0xdc16('0x17')]('FaxAccount,\x20%s,\x20%s',_0x522d90,_0x552fe8[_0xdc16('0x17')][_0xdc16('0x19')]);return _0x4e278d(_0x552fe8[_0xdc16('0x17')][_0xdc16('0x19')]);}else{logger[_0xdc16('0x12')](_0xdc16('0x13'),_0x522d90,_0xdc16('0x14'));_0x4e278d(_0x552fe8[_0xdc16('0x1a')]['message']);}})[_0xdc16('0x1b')](function(_0x522b43){logger[_0xdc16('0x17')](_0xdc16('0x13'),_0x522d90,_0x522b43);_0x4d7db2(_0x522b43);});});}exports[_0xdc16('0x1c')]=function(_0xeabd66){var _0x109947=this;return new Promise(function(_0x352176,_0x4acc3d){return db[_0xdc16('0x1d')][_0xdc16('0x1e')]({'raw':_0xeabd66[_0xdc16('0x1f')]?_0xeabd66[_0xdc16('0x1f')][_0xdc16('0x20')]===undefined?!![]:![]:!![],'where':_0xeabd66[_0xdc16('0x1f')]?_0xeabd66[_0xdc16('0x1f')][_0xdc16('0x21')]||null:null,'attributes':_0xeabd66[_0xdc16('0x1f')]?_0xeabd66[_0xdc16('0x1f')]['attributes']||null:null,'limit':_0xeabd66[_0xdc16('0x1f')]?_0xeabd66[_0xdc16('0x1f')][_0xdc16('0x22')]||null:null,'include':_0xeabd66[_0xdc16('0x1f')]?_0xeabd66[_0xdc16('0x1f')]['include']?_[_0xdc16('0x23')](_0xeabd66[_0xdc16('0x1f')][_0xdc16('0x24')],function(_0x527dde){return{'model':db[_0x527dde[_0xdc16('0x25')]],'as':_0x527dde['as'],'attributes':_0x527dde[_0xdc16('0x26')],'include':_0x527dde[_0xdc16('0x24')]?_[_0xdc16('0x23')](_0x527dde[_0xdc16('0x24')],function(_0x284d05){return{'model':db[_0x284d05['model']],'as':_0x284d05['as'],'attributes':_0x284d05['attributes'],'include':_0x284d05[_0xdc16('0x24')]?_['map'](_0x284d05[_0xdc16('0x24')],function(_0xca3145){return{'model':db[_0xca3145[_0xdc16('0x25')]],'as':_0xca3145['as'],'attributes':_0xca3145['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc16('0x11')](function(_0xa62650){logger[_0xdc16('0x12')](_0xdc16('0x1c'),_0xeabd66);logger[_0xdc16('0x15')](_0xdc16('0x1c'),_0xeabd66,JSON[_0xdc16('0x27')](_0xa62650));_0x352176(_0xa62650);})[_0xdc16('0x1b')](function(_0x4c16a3){logger[_0xdc16('0x17')](_0xdc16('0x1c'),_0x4c16a3['message'],_0xeabd66);_0x4acc3d(_0x109947[_0xdc16('0x17')](0x1f4,_0x4c16a3[_0xdc16('0x19')]));});});};exports[_0xdc16('0x28')]=function(_0x5dcee8,_0x5982d9,_0x3c414f){var _0x52a708=this;return new Promise(function(_0x484b60,_0x25e9e1){var _0x59324c={'body':_0x5dcee8[_0xdc16('0x29')],'channel':_0xdc16('0x2a')};var _0x49234e=[];var _0x399dfb=[];var _0x8822ad={};return db[_0xdc16('0x2b')]['describe']()['then'](function(_0x4a870f){if(!_0x4a870f){throw new db[(_0xdc16('0x2c'))][(_0xdc16('0x2d'))](_0xdc16('0x2e'));}_0x49234e=_[_0xdc16('0x2f')](_[_0xdc16('0x30')](_0x4a870f),[_0xdc16('0x31'),_0xdc16('0x32')]);_0x399dfb=_[_0xdc16('0x2f')](_['keys'](_0x4a870f),[_0xdc16('0x31'),'updatedAt',_0xdc16('0x33'),_0xdc16('0x34')]);if(_0x5dcee8[_0xdc16('0x29')]['id']){delete _0x5dcee8[_0xdc16('0x29')]['id'];}if(_[_0xdc16('0x35')](_0x5dcee8[_0xdc16('0x29')][_0xdc16('0x36')])){throw new db[(_0xdc16('0x2c'))][(_0xdc16('0x2d'))](_0xdc16('0x37'));}if(_[_0xdc16('0x35')](_0x5dcee8['body']['body'])||_0x5dcee8[_0xdc16('0x29')]['body']===''){throw new db[(_0xdc16('0x2c'))][(_0xdc16('0x2d'))](_0xdc16('0x38'));}if(_[_0xdc16('0x35')](_0x5dcee8[_0xdc16('0x29')][_0xdc16('0x39')])){throw new db['Sequelize'][(_0xdc16('0x2d'))](_0xdc16('0x3a')+_0x399dfb);}if(!_[_0xdc16('0x3b')](_0x399dfb,_0x5dcee8['body']['mapKey'])){throw new db[(_0xdc16('0x2c'))][(_0xdc16('0x2d'))](_0xdc16('0x3c')+_0x399dfb);}_0x8822ad[_0x5dcee8['body'][_0xdc16('0x39')]]=_0x5dcee8['body'][_0xdc16('0x36')];})['then'](function(){return db[_0xdc16('0x1d')][_0xdc16('0x3d')]({'where':{'id':_0x5dcee8[_0xdc16('0x3e')]['id']},'include':[{'model':db['CmList'],'as':_0xdc16('0x3f'),'include':[{'model':db[_0xdc16('0x2b')],'as':_0xdc16('0x40'),'where':_0x8822ad,'limit':0x1,'order':[['updatedAt',_0xdc16('0x41')]]}]},{'model':db[_0xdc16('0x42')],'as':'Applications'}]});})['then'](function(_0x185795){if(_0x185795&&_0x185795['List']){var _0x1bce26=_0x185795[_0xdc16('0x43')]({'plain':!![]});_0x59324c[_0xdc16('0x3e')]=_0x1bce26;_0x59324c[_0xdc16('0x44')]=_0x1bce26[_0xdc16('0x45')];_0x59324c[_0xdc16('0x46')]=_0x1bce26[_0xdc16('0x3f')];_0x59324c['applications']=_['orderBy'](_0x59324c['applications'],[_0xdc16('0x47')],[_0xdc16('0x48')]);if(_0x59324c[_0xdc16('0x3e')][_0xdc16('0x45')]){delete _0x59324c[_0xdc16('0x3e')][_0xdc16('0x45')];}if(_0x59324c['account']['List']&&_0x59324c[_0xdc16('0x3e')][_0xdc16('0x3f')][_0xdc16('0x40')][_0xdc16('0x49')]){return _0x59324c[_0xdc16('0x3e')]['List'][_0xdc16('0x40')][0x0];}var _0x55c0e7=_[_0xdc16('0x4a')](_0x5dcee8[_0xdc16('0x29')],{'firstName':_0x5dcee8[_0xdc16('0x29')]['from'],'ListId':_0x1bce26[_0xdc16('0x34')]});_0x55c0e7[_0x5dcee8['body'][_0xdc16('0x39')]]=_0x5dcee8['body']['from'];return db[_0xdc16('0x2b')]['create'](_0x55c0e7,{'fields':_0x49234e,'raw':!![]});}})['then'](function(_0x3acefe){_0x59324c['contact']=_0x3acefe;if(_0x3acefe){var _0x34fd16={'ContactId':_0x3acefe['id'],'FaxAccountId':_0x5dcee8['account']['id'],'fax':_0x3acefe[_0xdc16('0x2a')]};return db[_0xdc16('0x4b')][_0xdc16('0x3d')]({'where':{'ContactId':_0x3acefe['id'],'closed':![],'FaxAccountId':_0x5dcee8['account']['id']}})['then'](function(_0x480232){if(_0x480232){return[_0x480232,![]];}return db['FaxInteraction']['create'](_0x34fd16)[_0xdc16('0x11')](function(_0xc78819){return[_0xc78819,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xdc16('0x4c')](function(_0x3cc2db,_0xd4adb1){var _0x5008fd=_0x3cc2db['get']({'plain':!![]});if(_0xd4adb1){if(_0x59324c['account'][_0xdc16('0x4d')]){_0x59324c[_0xdc16('0x44')][_0xdc16('0x4e')]({'id':0x0,'priority':_0x59324c[_0xdc16('0x44')]['length']+0x1,'app':_0xdc16('0x4f'),'appdata':_0xdc16('0x50'),'interval':_0xdc16('0x51')});}_0x5008fd['created']=!![];}else{_0x5008fd[_0xdc16('0x52')]=![];}_0x59324c[_0xdc16('0x53')]=_0x5008fd;return db['FaxMessage'][_0xdc16('0x54')]({'body':_0x5dcee8[_0xdc16('0x29')][_0xdc16('0x29')],'FaxAccountId':_0x5dcee8['account']['id'],'FaxInteractionId':_0x3cc2db['id'],'direction':'in','ContactId':_0x3cc2db[_0xdc16('0x55')],'AttachmentId':_0x5dcee8[_0xdc16('0x29')]['AttachmentId']});})[_0xdc16('0x11')](function(_0x26755e){_0x59324c['message']=_0x26755e;if(!_0x59324c[_0xdc16('0x53')]['UserId'])return;return db[_0xdc16('0x56')][_0xdc16('0x3d')]({'attributes':['id',_0xdc16('0x57')],'where':{'id':_0x59324c[_0xdc16('0x53')]['UserId']}});})[_0xdc16('0x11')](function(_0x5b3ea7){if(_0x5b3ea7){_0x59324c[_0xdc16('0x44')][_0xdc16('0x58')]({'id':0x0,'priority':0x0,'app':_0xdc16('0x59'),'appdata':_0x5b3ea7[_0xdc16('0x57')]+','+(_0x59324c['account'][_0xdc16('0x5a')]||0xa),'interval':_0xdc16('0x51')});}if(!_0x59324c[_0xdc16('0x53')][_0xdc16('0x5b')])return;return db['FaxQueue']['find']({'attributes':['id',_0xdc16('0x57')],'where':{'id':_0x59324c[_0xdc16('0x53')][_0xdc16('0x5b')]}});})[_0xdc16('0x11')](function(_0x35354c){if(_0x35354c){_0x59324c[_0xdc16('0x44')][_0xdc16('0x58')]({'id':0x0,'priority':0x1,'app':_0xdc16('0x5c'),'appdata':_0x35354c['name']+','+(_0x59324c['account']['waitForTheAssignedQueue']||0x12c),'interval':_0xdc16('0x51')});}return respondWithRpcPromise('Start','startRouting',_0x59324c);})[_0xdc16('0x11')](function(_0x128805){_0x484b60(_0x128805);})[_0xdc16('0x1b')](function(_0x5621eb){_0x25e9e1(_0x52a708[_0xdc16('0x17')](0x1f4,_0x5621eb[_0xdc16('0x19')]));});});}; \ No newline at end of file +var _0x8671=['User','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','redis','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxAccount','findAll','options','raw','include','map','model','attributes','GetFaxAccount','NotifyFaxAccount','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','CmContact','Contacts','DESC','List','get','applications','list','orderBy','asc','Applications','length','FaxInteraction','create','Contact\x20not\x20found','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x8671,0x169));var _0x1867=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x8671[_0x411add];return _0x238242;};'use strict';var _=require(_0x1867('0x0'));var util=require('util');var moment=require(_0x1867('0x1'));var BPromise=require('bluebird');var rs=require(_0x1867('0x2'));var fs=require('fs');var Redis=require(_0x1867('0x3'));var db=require(_0x1867('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1867('0x5'))(_0x1867('0x6'));var config=require(_0x1867('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1867('0x8')][_0x1867('0x9')]({'port':0x232c});config['redis']=_[_0x1867('0xa')](config['redis'],{'host':_0x1867('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1867('0xc')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x492d0c,_0x487848,_0x504b54){return new BPromise(function(_0x1cf23e,_0x226e73){return client[_0x1867('0xd')](_0x492d0c,_0x504b54)[_0x1867('0xe')](function(_0x549cf5){logger[_0x1867('0xf')](_0x1867('0x10'),_0x487848,_0x1867('0x11'));logger[_0x1867('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x487848,_0x1867('0x11'),JSON[_0x1867('0x13')](_0x549cf5));if(_0x549cf5[_0x1867('0x14')]){if(_0x549cf5[_0x1867('0x14')][_0x1867('0x15')]===0x1f4){logger[_0x1867('0x14')](_0x1867('0x10'),_0x487848,_0x549cf5[_0x1867('0x14')][_0x1867('0x16')]);return _0x226e73(_0x549cf5[_0x1867('0x14')][_0x1867('0x16')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x487848,_0x549cf5[_0x1867('0x14')][_0x1867('0x16')]);return _0x1cf23e(_0x549cf5[_0x1867('0x14')]['message']);}else{logger[_0x1867('0xf')](_0x1867('0x10'),_0x487848,_0x1867('0x11'));_0x1cf23e(_0x549cf5[_0x1867('0x17')][_0x1867('0x16')]);}})[_0x1867('0x18')](function(_0xbd467e){logger[_0x1867('0x14')](_0x1867('0x10'),_0x487848,_0xbd467e);_0x226e73(_0xbd467e);});});}exports['GetFaxAccount']=function(_0x4638d3){var _0x2354f8=this;return new Promise(function(_0x5130e8,_0x104925){return db[_0x1867('0x19')][_0x1867('0x1a')]({'raw':_0x4638d3[_0x1867('0x1b')]?_0x4638d3['options'][_0x1867('0x1c')]===undefined?!![]:![]:!![],'where':_0x4638d3[_0x1867('0x1b')]?_0x4638d3['options']['where']||null:null,'attributes':_0x4638d3[_0x1867('0x1b')]?_0x4638d3['options']['attributes']||null:null,'limit':_0x4638d3[_0x1867('0x1b')]?_0x4638d3[_0x1867('0x1b')]['limit']||null:null,'include':_0x4638d3[_0x1867('0x1b')]?_0x4638d3[_0x1867('0x1b')][_0x1867('0x1d')]?_[_0x1867('0x1e')](_0x4638d3[_0x1867('0x1b')][_0x1867('0x1d')],function(_0x296786){return{'model':db[_0x296786[_0x1867('0x1f')]],'as':_0x296786['as'],'attributes':_0x296786[_0x1867('0x20')],'include':_0x296786[_0x1867('0x1d')]?_[_0x1867('0x1e')](_0x296786[_0x1867('0x1d')],function(_0x3910ad){return{'model':db[_0x3910ad[_0x1867('0x1f')]],'as':_0x3910ad['as'],'attributes':_0x3910ad['attributes'],'include':_0x3910ad['include']?_['map'](_0x3910ad[_0x1867('0x1d')],function(_0x4084e0){return{'model':db[_0x4084e0['model']],'as':_0x4084e0['as'],'attributes':_0x4084e0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x30cf90){logger['info'](_0x1867('0x21'),_0x4638d3);logger[_0x1867('0x12')]('GetFaxAccount',_0x4638d3,JSON[_0x1867('0x13')](_0x30cf90));_0x5130e8(_0x30cf90);})[_0x1867('0x18')](function(_0x57ef1e){logger['error'](_0x1867('0x21'),_0x57ef1e[_0x1867('0x16')],_0x4638d3);_0x104925(_0x2354f8[_0x1867('0x14')](0x1f4,_0x57ef1e['message']));});});};exports[_0x1867('0x22')]=function(_0x8e2fbe,_0x35d86c,_0x132721){var _0x3ed2b4=this;return new Promise(function(_0x63c442,_0x5d16ea){var _0x1f5a0a={'body':_0x8e2fbe['body'],'channel':_0x1867('0x23')};var _0x20a7af=[];var _0x2f619a=[];var _0x47d817={};return db['CmContact'][_0x1867('0x24')]()['then'](function(_0x29c54b){if(!_0x29c54b){throw new db[(_0x1867('0x25'))][(_0x1867('0x26'))](_0x1867('0x27'));}_0x20a7af=_[_0x1867('0x28')](_['keys'](_0x29c54b),['createdAt','updatedAt']);_0x2f619a=_[_0x1867('0x28')](_['keys'](_0x29c54b),[_0x1867('0x29'),_0x1867('0x2a'),_0x1867('0x2b'),_0x1867('0x2c')]);if(_0x8e2fbe[_0x1867('0x2d')]['id']){delete _0x8e2fbe[_0x1867('0x2d')]['id'];}if(_[_0x1867('0x2e')](_0x8e2fbe[_0x1867('0x2d')][_0x1867('0x2f')])){throw new db['Sequelize'][(_0x1867('0x26'))](_0x1867('0x30'));}if(_['isNil'](_0x8e2fbe['body'][_0x1867('0x2d')])||_0x8e2fbe['body']['body']===''){throw new db[(_0x1867('0x25'))][(_0x1867('0x26'))](_0x1867('0x31'));}if(_['isNil'](_0x8e2fbe[_0x1867('0x2d')][_0x1867('0x32')])){throw new db[(_0x1867('0x25'))][(_0x1867('0x26'))](_0x1867('0x33')+_0x2f619a);}if(!_['includes'](_0x2f619a,_0x8e2fbe['body']['mapKey'])){throw new db[(_0x1867('0x25'))][(_0x1867('0x26'))](_0x1867('0x34')+_0x2f619a);}_0x47d817[_0x8e2fbe[_0x1867('0x2d')]['mapKey']]=_0x8e2fbe[_0x1867('0x2d')][_0x1867('0x2f')];})[_0x1867('0xe')](function(){return db[_0x1867('0x19')][_0x1867('0x35')]({'where':{'id':_0x8e2fbe[_0x1867('0x36')]['id']},'include':[{'model':db[_0x1867('0x37')],'as':'List','include':[{'model':db[_0x1867('0x38')],'as':_0x1867('0x39'),'where':_0x47d817,'limit':0x1,'order':[[_0x1867('0x2a'),_0x1867('0x3a')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x1867('0xe')](function(_0x3ae84d){if(_0x3ae84d&&_0x3ae84d[_0x1867('0x3b')]){var _0x3c6c6f=_0x3ae84d[_0x1867('0x3c')]({'plain':!![]});_0x1f5a0a[_0x1867('0x36')]=_0x3c6c6f;_0x1f5a0a[_0x1867('0x3d')]=_0x3c6c6f['Applications'];_0x1f5a0a[_0x1867('0x3e')]=_0x3c6c6f['List'];_0x1f5a0a[_0x1867('0x3d')]=_[_0x1867('0x3f')](_0x1f5a0a[_0x1867('0x3d')],['priority'],[_0x1867('0x40')]);if(_0x1f5a0a[_0x1867('0x36')][_0x1867('0x41')]){delete _0x1f5a0a[_0x1867('0x36')][_0x1867('0x41')];}if(_0x1f5a0a[_0x1867('0x36')][_0x1867('0x3b')]&&_0x1f5a0a[_0x1867('0x36')]['List'][_0x1867('0x39')][_0x1867('0x42')]){return _0x1f5a0a[_0x1867('0x36')]['List'][_0x1867('0x39')][0x0];}var _0x42d5b1=_['defaults'](_0x8e2fbe[_0x1867('0x2d')],{'firstName':_0x8e2fbe[_0x1867('0x2d')]['from'],'ListId':_0x3c6c6f[_0x1867('0x2c')]});_0x42d5b1[_0x8e2fbe[_0x1867('0x2d')][_0x1867('0x32')]]=_0x8e2fbe['body'][_0x1867('0x2f')];return db['CmContact']['create'](_0x42d5b1,{'fields':_0x20a7af,'raw':!![]});}})[_0x1867('0xe')](function(_0x413779){_0x1f5a0a['contact']=_0x413779;if(_0x413779){var _0x50fb18={'ContactId':_0x413779['id'],'FaxAccountId':_0x8e2fbe[_0x1867('0x36')]['id'],'fax':_0x413779[_0x1867('0x23')]};return db[_0x1867('0x43')][_0x1867('0x35')]({'where':{'ContactId':_0x413779['id'],'closed':![],'FaxAccountId':_0x8e2fbe['account']['id']}})[_0x1867('0xe')](function(_0x46c988){if(_0x46c988){return[_0x46c988,![]];}return db[_0x1867('0x43')][_0x1867('0x44')](_0x50fb18)[_0x1867('0xe')](function(_0x3b9143){return[_0x3b9143,!![]];});});}else{throw new Error(_0x1867('0x45'));}})['spread'](function(_0x48571d,_0x1a73b0){var _0x121654=_0x48571d[_0x1867('0x3c')]({'plain':!![]});if(_0x1a73b0){if(_0x1f5a0a[_0x1867('0x36')]['autoclose']){_0x1f5a0a[_0x1867('0x3d')][_0x1867('0x46')]({'id':0x0,'priority':_0x1f5a0a['applications']['length']+0x1,'app':_0x1867('0x47'),'appdata':_0x1867('0x48'),'interval':_0x1867('0x49')});}_0x121654['created']=!![];}else{_0x121654[_0x1867('0x4a')]=![];}_0x1f5a0a[_0x1867('0x4b')]=_0x121654;return db[_0x1867('0x4c')]['create']({'body':_0x8e2fbe[_0x1867('0x2d')][_0x1867('0x2d')],'FaxAccountId':_0x8e2fbe[_0x1867('0x36')]['id'],'FaxInteractionId':_0x48571d['id'],'direction':'in','ContactId':_0x48571d['ContactId'],'AttachmentId':_0x8e2fbe['body'][_0x1867('0x4d')]});})[_0x1867('0xe')](function(_0x35bf27){_0x1f5a0a[_0x1867('0x16')]=_0x35bf27;if(!_0x1f5a0a[_0x1867('0x4b')][_0x1867('0x4e')])return;return db[_0x1867('0x4f')][_0x1867('0x35')]({'attributes':['id',_0x1867('0x50')],'where':{'id':_0x1f5a0a[_0x1867('0x4b')][_0x1867('0x4e')]}});})['then'](function(_0x54c4fb){if(_0x54c4fb){_0x1f5a0a[_0x1867('0x3d')][_0x1867('0x51')]({'id':0x0,'priority':0x0,'app':_0x1867('0x52'),'appdata':_0x54c4fb[_0x1867('0x50')]+','+(_0x1f5a0a[_0x1867('0x36')][_0x1867('0x53')]||0xa),'interval':_0x1867('0x49')});}if(!_0x1f5a0a[_0x1867('0x4b')][_0x1867('0x54')])return;return db[_0x1867('0x55')][_0x1867('0x35')]({'attributes':['id',_0x1867('0x50')],'where':{'id':_0x1f5a0a[_0x1867('0x4b')][_0x1867('0x54')]}});})[_0x1867('0xe')](function(_0x449d0d){if(_0x449d0d){_0x1f5a0a[_0x1867('0x3d')][_0x1867('0x51')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x449d0d[_0x1867('0x50')]+','+(_0x1f5a0a[_0x1867('0x36')]['waitForTheAssignedQueue']||0x12c),'interval':_0x1867('0x49')});}return respondWithRpcPromise(_0x1867('0x56'),_0x1867('0x57'),_0x1f5a0a);})[_0x1867('0xe')](function(_0x370691){_0x63c442(_0x370691);})['catch'](function(_0x1f00ba){_0x5d16ea(_0x3ed2b4[_0x1867('0x14')](0x1f4,_0x1f00ba['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e27991b..ca17f97 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 _0x5072=['removeListener','register','faxAccount:','./faxAccount.events','save','remove','update','emit'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x5072,0xf3));var _0x2507=function(_0x3308f4,_0x131eb5){_0x3308f4=_0x3308f4-0x0;var _0x4837e6=_0x5072[_0x3308f4];return _0x4837e6;};'use strict';var FaxAccountEvents=require(_0x2507('0x0'));var events=[_0x2507('0x1'),_0x2507('0x2'),_0x2507('0x3')];function createListener(_0xced3f5,_0x50dac5){return function(_0x4595d6){_0x50dac5[_0x2507('0x4')](_0xced3f5,_0x4595d6);};}function removeListener(_0x2b5108,_0x4aff62){return function(){FaxAccountEvents[_0x2507('0x5')](_0x2b5108,_0x4aff62);};}exports[_0x2507('0x6')]=function(_0x13de1c){for(var _0x4a5cd8=0x0,_0x51caf3=events['length'];_0x4a5cd8<_0x51caf3;_0x4a5cd8++){var _0x5569d6=events[_0x4a5cd8];var _0x415ad1=createListener(_0x2507('0x7')+_0x5569d6,_0x13de1c);FaxAccountEvents['on'](_0x5569d6,_0x415ad1);}}; \ No newline at end of file +var _0xd976=['save','remove','emit','removeListener','faxAccount:'];(function(_0x18e52b,_0x1fae35){var _0x3d3062=function(_0x133b14){while(--_0x133b14){_0x18e52b['push'](_0x18e52b['shift']());}};_0x3d3062(++_0x1fae35);}(_0xd976,0x127));var _0x6d97=function(_0x5f4220,_0x1e767e){_0x5f4220=_0x5f4220-0x0;var _0x2834c1=_0xd976[_0x5f4220];return _0x2834c1;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x6d97('0x0'),_0x6d97('0x1'),'update'];function createListener(_0x125ffc,_0xb7e2dc){return function(_0x33f9fc){_0xb7e2dc[_0x6d97('0x2')](_0x125ffc,_0x33f9fc);};}function removeListener(_0x3a8ea2,_0x5acee6){return function(){FaxAccountEvents[_0x6d97('0x3')](_0x3a8ea2,_0x5acee6);};}exports['register']=function(_0x54e64a){for(var _0x2fcf6d=0x0,_0x218891=events['length'];_0x2fcf6d<_0x218891;_0x2fcf6d++){var _0x4f9717=events[_0x2fcf6d];var _0x52957e=createListener(_0x6d97('0x4')+_0x4f9717,_0x54e64a);FaxAccountEvents['on'](_0x4f9717,_0x52957e);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6664d6c..e276339 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 _0x8690=['fs-extra','../../components/auth/service','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','create','post','/:id/dispositions','/:id/interactions','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','util','path'];(function(_0x56cf29,_0x1acb97){var _0x510f78=function(_0x5e80e0){while(--_0x5e80e0){_0x56cf29['push'](_0x56cf29['shift']());}};_0x510f78(++_0x1acb97);}(_0x8690,0xbc));var _0x0869=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x8690[_0x695b76];return _0x1dc21f;};'use strict';var multer=require('multer');var util=require(_0x0869('0x0'));var path=require(_0x0869('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0869('0x2'));var auth=require(_0x0869('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0869('0x4'));router[_0x0869('0x5')]('/',auth[_0x0869('0x6')](),controller[_0x0869('0x7')]);router[_0x0869('0x5')](_0x0869('0x8'),auth[_0x0869('0x6')](),controller[_0x0869('0x9')]);router['get'](_0x0869('0xa'),auth[_0x0869('0x6')](),controller['show']);router[_0x0869('0x5')]('/:id/dispositions',auth[_0x0869('0x6')](),controller[_0x0869('0xb')]);router[_0x0869('0x5')](_0x0869('0xc'),auth['isAuthenticated'](),controller[_0x0869('0xd')]);router[_0x0869('0x5')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x0869('0xe')]);router['get'](_0x0869('0xf'),auth[_0x0869('0x6')](),controller[_0x0869('0x10')]);router['get'](_0x0869('0x11'),auth[_0x0869('0x6')](),controller[_0x0869('0x12')]);router[_0x0869('0x5')](_0x0869('0x13'),auth[_0x0869('0x6')](),controller[_0x0869('0x14')]);router['post']('/',auth[_0x0869('0x6')](),controller[_0x0869('0x15')]);router[_0x0869('0x16')](_0x0869('0x17'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x0869('0xc'),auth[_0x0869('0x6')](),controller['addAnswer']);router[_0x0869('0x16')](_0x0869('0x18'),auth['isAuthenticated'](),controller[_0x0869('0x19')]);router[_0x0869('0x16')]('/:id/applications',auth[_0x0869('0x6')](),controller[_0x0869('0x1a')]);router[_0x0869('0x16')](_0x0869('0x1b'),auth['isAuthenticated'](),controller[_0x0869('0x1c')]);router[_0x0869('0x16')](_0x0869('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0869('0x16')](_0x0869('0x1e'),auth[_0x0869('0x6')](),controller['send']);router[_0x0869('0x16')]('/:id/users',auth[_0x0869('0x6')](),controller[_0x0869('0x1f')]);router[_0x0869('0x20')]('/:id',auth[_0x0869('0x6')](),controller[_0x0869('0x21')]);router['delete']('/:id',auth[_0x0869('0x6')](),controller['destroy']);router[_0x0869('0x22')](_0x0869('0x17'),auth[_0x0869('0x6')](),controller[_0x0869('0x23')]);router[_0x0869('0x22')](_0x0869('0xc'),auth[_0x0869('0x6')](),controller[_0x0869('0x24')]);router[_0x0869('0x22')](_0x0869('0x13'),auth[_0x0869('0x6')](),controller['removeAgents']);module[_0x0869('0x25')]=router; \ No newline at end of file +var _0x05fc=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','get','describe','/:id','show','/:id/dispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path'];(function(_0x12e26f,_0x1ab941){var _0x47d67c=function(_0x4a5b0b){while(--_0x4a5b0b){_0x12e26f['push'](_0x12e26f['shift']());}};_0x47d67c(++_0x1ab941);}(_0x05fc,0x19f));var _0xc05f=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x05fc[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0xc05f('0x0'));var util=require(_0xc05f('0x1'));var path=require(_0xc05f('0x2'));var timeout=require(_0xc05f('0x3'));var express=require('express');var router=express[_0xc05f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc05f('0x5'));var interaction=require(_0xc05f('0x6'));var config=require(_0xc05f('0x7'));var controller=require(_0xc05f('0x8'));router['get']('/',auth[_0xc05f('0x9')](),controller['index']);router[_0xc05f('0xa')]('/describe',auth[_0xc05f('0x9')](),controller[_0xc05f('0xb')]);router[_0xc05f('0xa')](_0xc05f('0xc'),auth['isAuthenticated'](),controller[_0xc05f('0xd')]);router[_0xc05f('0xa')](_0xc05f('0xe'),auth[_0xc05f('0x9')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xc05f('0x9')](),controller[_0xc05f('0xf')]);router[_0xc05f('0xa')](_0xc05f('0x10'),auth[_0xc05f('0x9')](),controller[_0xc05f('0x11')]);router[_0xc05f('0xa')](_0xc05f('0x12'),auth['isAuthenticated'](),controller[_0xc05f('0x13')]);router[_0xc05f('0xa')](_0xc05f('0x14'),auth[_0xc05f('0x9')](),controller[_0xc05f('0x15')]);router[_0xc05f('0xa')](_0xc05f('0x16'),auth[_0xc05f('0x9')](),controller[_0xc05f('0x17')]);router[_0xc05f('0x18')]('/',auth[_0xc05f('0x9')](),controller[_0xc05f('0x19')]);router[_0xc05f('0x18')](_0xc05f('0xe'),auth[_0xc05f('0x9')](),controller[_0xc05f('0x1a')]);router[_0xc05f('0x18')](_0xc05f('0x1b'),auth[_0xc05f('0x9')](),controller[_0xc05f('0x1c')]);router[_0xc05f('0x18')](_0xc05f('0x10'),auth[_0xc05f('0x9')](),controller[_0xc05f('0x1d')]);router[_0xc05f('0x18')](_0xc05f('0x12'),auth[_0xc05f('0x9')](),controller[_0xc05f('0x1e')]);router[_0xc05f('0x18')](_0xc05f('0x1f'),auth['isAuthenticated'](),controller['addAccountApplications']);router[_0xc05f('0x18')]('/updateaccountapplications',auth[_0xc05f('0x9')](),controller['updateAccountApplications']);router[_0xc05f('0x18')]('/:id/send',auth[_0xc05f('0x9')](),controller['send']);router[_0xc05f('0x18')](_0xc05f('0x16'),auth['isAuthenticated'](),controller[_0xc05f('0x20')]);router[_0xc05f('0x21')](_0xc05f('0xc'),auth[_0xc05f('0x9')](),controller['update']);router[_0xc05f('0x22')](_0xc05f('0xc'),auth[_0xc05f('0x9')](),controller[_0xc05f('0x23')]);router[_0xc05f('0x22')](_0xc05f('0xe'),auth[_0xc05f('0x9')](),controller['removeDispositions']);router[_0xc05f('0x22')](_0xc05f('0x1b'),auth[_0xc05f('0x9')](),controller['removeAnswers']);router[_0xc05f('0x22')](_0xc05f('0x16'),auth['isAuthenticated'](),controller[_0xc05f('0x24')]);module[_0xc05f('0x25')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 8e06bf4..5ac5dca 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 _0x1f22=['exports','INTEGER','STRING','noop','TEXT'];(function(_0xcecc7d,_0x2f2899){var _0x5883ba=function(_0x4f618d){while(--_0x4f618d){_0xcecc7d['push'](_0xcecc7d['shift']());}};_0x5883ba(++_0x2f2899);}(_0x1f22,0x113));var _0x21f2=function(_0xd02af1,_0x31b6f8){_0xd02af1=_0xd02af1-0x0;var _0x12f101=_0x1f22[_0xd02af1];return _0x12f101;};'use strict';var Sequelize=require('sequelize');module[_0x21f2('0x0')]={'priority':{'type':Sequelize[_0x21f2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x21f2('0x2')],'allowNull':![],'defaultValue':_0x21f2('0x3')},'appdata':{'type':Sequelize[_0x21f2('0x4')]()},'description':{'type':Sequelize[_0x21f2('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2fd0=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x123cc3,_0x361fd8){var _0x134ee0=function(_0xdccd6d){while(--_0xdccd6d){_0x123cc3['push'](_0x123cc3['shift']());}};_0x134ee0(++_0x361fd8);}(_0x2fd0,0x1e1));var _0x02fd=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0x2fd0[_0x51b1a5];return _0x15c738;};'use strict';var Sequelize=require(_0x02fd('0x0'));module[_0x02fd('0x1')]={'priority':{'type':Sequelize[_0x02fd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x02fd('0x3')],'allowNull':![],'defaultValue':_0x02fd('0x4')},'appdata':{'type':Sequelize[_0x02fd('0x5')]()},'description':{'type':Sequelize[_0x02fd('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 76ae532..19bb9ea 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 _0x1086=['keys','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','name','map','FaxApplication','rawAttributes','fieldName','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0x358bca,_0x676719){var _0x58a0a2=function(_0x50ba30){while(--_0x50ba30){_0x358bca['push'](_0x358bca['shift']());}};_0x58a0a2(++_0x676719);}(_0x1086,0x1b0));var _0x6108=function(_0x391c12,_0x31943d){_0x391c12=_0x391c12-0x0;var _0x238675=_0x1086[_0x391c12];return _0x238675;};'use strict';var emlformat=require(_0x6108('0x0'));var rimraf=require(_0x6108('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6108('0x2'));var rp=require(_0x6108('0x3'));var moment=require(_0x6108('0x4'));var BPromise=require(_0x6108('0x5'));var Mustache=require(_0x6108('0x6'));var util=require(_0x6108('0x7'));var path=require(_0x6108('0x8'));var sox=require(_0x6108('0x9'));var csv=require(_0x6108('0xa'));var ejs=require(_0x6108('0xb'));var fs=require('fs');var fs_extra=require(_0x6108('0xc'));var _=require('lodash');var squel=require(_0x6108('0xd'));var crypto=require(_0x6108('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6108('0xf'));var toCsv=require(_0x6108('0xa'));var querystring=require(_0x6108('0x10'));var Papa=require(_0x6108('0x11'));var Redis=require(_0x6108('0x12'));var authService=require(_0x6108('0x13'));var qs=require(_0x6108('0x14'));var as=require(_0x6108('0x15'));var hardwareService=require(_0x6108('0x16'));var logger=require(_0x6108('0x17'))(_0x6108('0x18'));var utils=require(_0x6108('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3885e4,_0x39d035){_0x39d035=_0x39d035||0xcc;return function(_0x12d416){if(_0x12d416){return _0x3885e4[_0x6108('0x1a')](_0x39d035);}return _0x3885e4[_0x6108('0x1b')](_0x39d035)[_0x6108('0x1c')]();};}function respondWithResult(_0x397b5d,_0x2ca513){_0x2ca513=_0x2ca513||0xc8;return function(_0x4e5f82){if(_0x4e5f82){return _0x397b5d[_0x6108('0x1b')](_0x2ca513)[_0x6108('0x1d')](_0x4e5f82);}};}function respondWithFilteredResult(_0x20466c,_0x9c3691){return function(_0x36f1b3){if(_0x36f1b3){var _0x40cd08=typeof _0x9c3691[_0x6108('0x1e')]===_0x6108('0x1f')&&typeof _0x9c3691[_0x6108('0x20')]===_0x6108('0x1f');var _0x2f69d4=_0x36f1b3[_0x6108('0x21')];var _0x2cfbbd=_0x40cd08?0x0:_0x9c3691['offset'];var _0x11c997=_0x40cd08?_0x36f1b3['count']:_0x9c3691[_0x6108('0x1e')]+_0x9c3691[_0x6108('0x20')];var _0x1a7c22;if(_0x11c997>=_0x2f69d4){_0x11c997=_0x2f69d4;_0x1a7c22=0xc8;}else{_0x1a7c22=0xce;}_0x20466c[_0x6108('0x1b')](_0x1a7c22);return _0x20466c[_0x6108('0x22')]('Content-Range',_0x2cfbbd+'-'+_0x11c997+'/'+_0x2f69d4)[_0x6108('0x1d')](_0x36f1b3);}return null;};}function patchUpdates(_0x3ed746){return function(_0x39a717){try{jsonpatch[_0x6108('0x23')](_0x39a717,_0x3ed746,!![]);}catch(_0x2aaa15){return BPromise['reject'](_0x2aaa15);}return _0x39a717[_0x6108('0x24')]();};}function saveUpdates(_0x2fe61c,_0x290d3c){return function(_0x828b13){if(_0x828b13){return _0x828b13['update'](_0x2fe61c)[_0x6108('0x25')](function(_0x48fa8e){return _0x48fa8e;});}return null;};}function removeEntity(_0x19030e,_0x1b325c){return function(_0x3b958a){if(_0x3b958a){return _0x3b958a[_0x6108('0x26')]()[_0x6108('0x25')](function(){_0x19030e[_0x6108('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21e184,_0x170b97){return function(_0x4fac8e){if(!_0x4fac8e){_0x21e184['sendStatus'](0x194);}return _0x4fac8e;};}function handleError(_0x33a9e1,_0x1697de){_0x1697de=_0x1697de||0x1f4;return function(_0x13f28e){logger[_0x6108('0x27')](_0x13f28e['stack']);if(_0x13f28e[_0x6108('0x28')]){delete _0x13f28e['name'];}_0x33a9e1[_0x6108('0x1b')](_0x1697de)['send'](_0x13f28e);};}exports['index']=function(_0x3c8567,_0x446fb3){var _0x4d507a={},_0x437e5c={},_0x590a2b={'count':0x0,'rows':[]};var _0x1f607c=_[_0x6108('0x29')](db[_0x6108('0x2a')][_0x6108('0x2b')],function(_0x196316){return{'name':_0x196316[_0x6108('0x2c')],'type':_0x196316['type']['key']};});_0x437e5c['model']=_['map'](_0x1f607c,_0x6108('0x28'));_0x437e5c[_0x6108('0x2d')]=_['keys'](_0x3c8567[_0x6108('0x2d')]);_0x437e5c[_0x6108('0x2e')]=_[_0x6108('0x2f')](_0x437e5c['model'],_0x437e5c[_0x6108('0x2d')]);_0x4d507a[_0x6108('0x30')]=_[_0x6108('0x2f')](_0x437e5c[_0x6108('0x31')],qs[_0x6108('0x32')](_0x3c8567[_0x6108('0x2d')][_0x6108('0x32')]));_0x4d507a[_0x6108('0x30')]=_0x4d507a[_0x6108('0x30')][_0x6108('0x33')]?_0x4d507a[_0x6108('0x30')]:_0x437e5c[_0x6108('0x31')];if(!_0x3c8567[_0x6108('0x2d')][_0x6108('0x34')](_0x6108('0x35'))){_0x4d507a[_0x6108('0x20')]=qs['limit'](_0x3c8567[_0x6108('0x2d')]['limit']);_0x4d507a['offset']=qs['offset'](_0x3c8567[_0x6108('0x2d')][_0x6108('0x1e')]);}_0x4d507a['order']=qs[_0x6108('0x36')](_0x3c8567[_0x6108('0x2d')][_0x6108('0x36')]);_0x4d507a['where']=qs['filters'](_['pick'](_0x3c8567[_0x6108('0x2d')],_0x437e5c[_0x6108('0x2e')]),_0x1f607c);if(_0x3c8567[_0x6108('0x2d')]['filter']){_0x4d507a[_0x6108('0x37')]=_[_0x6108('0x38')](_0x4d507a[_0x6108('0x37')],{'$or':_[_0x6108('0x29')](_0x1f607c,function(_0x29b473){if(_0x29b473[_0x6108('0x39')]!==_0x6108('0x3a')){var _0xbe9bdc={};_0xbe9bdc[_0x29b473[_0x6108('0x28')]]={'$like':'%'+_0x3c8567[_0x6108('0x2d')]['filter']+'%'};return _0xbe9bdc;}})});}_0x4d507a=_[_0x6108('0x38')]({},_0x4d507a,_0x3c8567[_0x6108('0x3b')]);var _0x563077={'where':_0x4d507a[_0x6108('0x37')]};return db[_0x6108('0x2a')]['count'](_0x563077)[_0x6108('0x25')](function(_0x55db21){_0x590a2b[_0x6108('0x21')]=_0x55db21;if(_0x3c8567[_0x6108('0x2d')][_0x6108('0x3c')]){_0x4d507a[_0x6108('0x3d')]=[{'all':!![]}];}return db[_0x6108('0x2a')]['findAll'](_0x4d507a);})[_0x6108('0x25')](function(_0x259b8c){_0x590a2b[_0x6108('0x3e')]=_0x259b8c;return _0x590a2b;})[_0x6108('0x25')](respondWithFilteredResult(_0x446fb3,_0x4d507a))[_0x6108('0x3f')](handleError(_0x446fb3,null));};exports[_0x6108('0x40')]=function(_0x48147b,_0x39a4ca){var _0x2e834d={'raw':!![],'where':{'id':_0x48147b['params']['id']}},_0xfaf219={};_0xfaf219[_0x6108('0x31')]=_[_0x6108('0x41')](db[_0x6108('0x2a')][_0x6108('0x2b')]);_0xfaf219['query']=_[_0x6108('0x41')](_0x48147b[_0x6108('0x2d')]);_0xfaf219[_0x6108('0x2e')]=_[_0x6108('0x2f')](_0xfaf219[_0x6108('0x31')],_0xfaf219['query']);_0x2e834d['attributes']=_[_0x6108('0x2f')](_0xfaf219[_0x6108('0x31')],qs[_0x6108('0x32')](_0x48147b[_0x6108('0x2d')][_0x6108('0x32')]));_0x2e834d['attributes']=_0x2e834d[_0x6108('0x30')][_0x6108('0x33')]?_0x2e834d[_0x6108('0x30')]:_0xfaf219['model'];if(_0x48147b[_0x6108('0x2d')][_0x6108('0x3c')]){_0x2e834d[_0x6108('0x3d')]=[{'all':!![]}];}_0x2e834d=_[_0x6108('0x38')]({},_0x2e834d,_0x48147b['options']);return db[_0x6108('0x2a')][_0x6108('0x42')](_0x2e834d)['then'](handleEntityNotFound(_0x39a4ca,null))[_0x6108('0x25')](respondWithResult(_0x39a4ca,null))[_0x6108('0x3f')](handleError(_0x39a4ca,null));};exports[_0x6108('0x43')]=function(_0x1f442f,_0x4cac64){return db[_0x6108('0x2a')][_0x6108('0x43')](_0x1f442f[_0x6108('0x44')],{})[_0x6108('0x25')](respondWithResult(_0x4cac64,0xc9))[_0x6108('0x3f')](handleError(_0x4cac64,null));};exports[_0x6108('0x45')]=function(_0x33357b,_0x8d8109){if(_0x33357b[_0x6108('0x44')]['id']){delete _0x33357b[_0x6108('0x44')]['id'];}return db[_0x6108('0x2a')][_0x6108('0x42')]({'where':{'id':_0x33357b[_0x6108('0x46')]['id']}})[_0x6108('0x25')](handleEntityNotFound(_0x8d8109,null))[_0x6108('0x25')](saveUpdates(_0x33357b[_0x6108('0x44')],null))[_0x6108('0x25')](respondWithResult(_0x8d8109,null))[_0x6108('0x3f')](handleError(_0x8d8109,null));};exports[_0x6108('0x26')]=function(_0x4cf9e1,_0x4bf372){return db['FaxApplication'][_0x6108('0x42')]({'where':{'id':_0x4cf9e1[_0x6108('0x46')]['id']}})[_0x6108('0x25')](handleEntityNotFound(_0x4bf372,null))['then'](removeEntity(_0x4bf372,null))[_0x6108('0x3f')](handleError(_0x4bf372,null));}; \ No newline at end of file +var _0x435d=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body'];(function(_0x16d3f8,_0x3f5dd3){var _0x49a172=function(_0x2f730d){while(--_0x2f730d){_0x16d3f8['push'](_0x16d3f8['shift']());}};_0x49a172(++_0x3f5dd3);}(_0x435d,0xdb));var _0xd435=function(_0x45397a,_0x3dc281){_0x45397a=_0x45397a-0x0;var _0x5ae1a6=_0x435d[_0x45397a];return _0x5ae1a6;};'use strict';var emlformat=require(_0xd435('0x0'));var rimraf=require(_0xd435('0x1'));var zipdir=require(_0xd435('0x2'));var jsonpatch=require(_0xd435('0x3'));var rp=require('request-promise');var moment=require(_0xd435('0x4'));var BPromise=require(_0xd435('0x5'));var Mustache=require('mustache');var util=require(_0xd435('0x6'));var path=require('path');var sox=require(_0xd435('0x7'));var csv=require(_0xd435('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd435('0x9'));var _=require(_0xd435('0xa'));var squel=require(_0xd435('0xb'));var crypto=require('crypto');var jsforce=require(_0xd435('0xc'));var deskjs=require(_0xd435('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd435('0xe'));var Papa=require(_0xd435('0xf'));var Redis=require(_0xd435('0x10'));var authService=require(_0xd435('0x11'));var qs=require(_0xd435('0x12'));var as=require(_0xd435('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd435('0x14'))(_0xd435('0x15'));var utils=require(_0xd435('0x16'));var config=require(_0xd435('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c0705,_0x44dff0){_0x44dff0=_0x44dff0||0xcc;return function(_0x37d686){if(_0x37d686){return _0x2c0705['sendStatus'](_0x44dff0);}return _0x2c0705['status'](_0x44dff0)[_0xd435('0x18')]();};}function respondWithResult(_0x41c1f5,_0x2becd9){_0x2becd9=_0x2becd9||0xc8;return function(_0x4de01f){if(_0x4de01f){return _0x41c1f5[_0xd435('0x19')](_0x2becd9)['json'](_0x4de01f);}};}function respondWithFilteredResult(_0x5140d8,_0x35aa5f){return function(_0x38874a){if(_0x38874a){var _0x24b924=typeof _0x35aa5f['offset']===_0xd435('0x1a')&&typeof _0x35aa5f[_0xd435('0x1b')]===_0xd435('0x1a');var _0x4cb2c1=_0x38874a[_0xd435('0x1c')];var _0x213b7b=_0x24b924?0x0:_0x35aa5f[_0xd435('0x1d')];var _0x5cb1b5=_0x24b924?_0x38874a[_0xd435('0x1c')]:_0x35aa5f[_0xd435('0x1d')]+_0x35aa5f[_0xd435('0x1b')];var _0x2b2a76;if(_0x5cb1b5>=_0x4cb2c1){_0x5cb1b5=_0x4cb2c1;_0x2b2a76=0xc8;}else{_0x2b2a76=0xce;}_0x5140d8[_0xd435('0x19')](_0x2b2a76);return _0x5140d8[_0xd435('0x1e')](_0xd435('0x1f'),_0x213b7b+'-'+_0x5cb1b5+'/'+_0x4cb2c1)[_0xd435('0x20')](_0x38874a);}return null;};}function patchUpdates(_0x1460bb){return function(_0x303800){try{jsonpatch[_0xd435('0x21')](_0x303800,_0x1460bb,!![]);}catch(_0x1a9ddd){return BPromise['reject'](_0x1a9ddd);}return _0x303800[_0xd435('0x22')]();};}function saveUpdates(_0x4bbef1,_0x4dd9ce){return function(_0x2223da){if(_0x2223da){return _0x2223da[_0xd435('0x23')](_0x4bbef1)[_0xd435('0x24')](function(_0x441f58){return _0x441f58;});}return null;};}function removeEntity(_0x335fef,_0x2ab954){return function(_0x3feb00){if(_0x3feb00){return _0x3feb00[_0xd435('0x25')]()[_0xd435('0x24')](function(){_0x335fef[_0xd435('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x506ba7,_0x22c241){return function(_0x1151e9){if(!_0x1151e9){_0x506ba7[_0xd435('0x26')](0x194);}return _0x1151e9;};}function handleError(_0x32abf4,_0x3cb5eb){_0x3cb5eb=_0x3cb5eb||0x1f4;return function(_0x1eb842){logger[_0xd435('0x27')](_0x1eb842[_0xd435('0x28')]);if(_0x1eb842[_0xd435('0x29')]){delete _0x1eb842[_0xd435('0x29')];}_0x32abf4[_0xd435('0x19')](_0x3cb5eb)[_0xd435('0x2a')](_0x1eb842);};}exports[_0xd435('0x2b')]=function(_0x48d363,_0x2c6d47){var _0x25ce81={},_0x5a4bd6={},_0xf1374e={'count':0x0,'rows':[]};var _0x21faf=_[_0xd435('0x2c')](db[_0xd435('0x2d')][_0xd435('0x2e')],function(_0x45be49){return{'name':_0x45be49[_0xd435('0x2f')],'type':_0x45be49['type']['key']};});_0x5a4bd6[_0xd435('0x30')]=_[_0xd435('0x2c')](_0x21faf,_0xd435('0x29'));_0x5a4bd6[_0xd435('0x31')]=_[_0xd435('0x32')](_0x48d363[_0xd435('0x31')]);_0x5a4bd6[_0xd435('0x33')]=_['intersection'](_0x5a4bd6[_0xd435('0x30')],_0x5a4bd6[_0xd435('0x31')]);_0x25ce81[_0xd435('0x34')]=_[_0xd435('0x35')](_0x5a4bd6[_0xd435('0x30')],qs[_0xd435('0x36')](_0x48d363[_0xd435('0x31')][_0xd435('0x36')]));_0x25ce81[_0xd435('0x34')]=_0x25ce81[_0xd435('0x34')]['length']?_0x25ce81[_0xd435('0x34')]:_0x5a4bd6[_0xd435('0x30')];if(!_0x48d363['query'][_0xd435('0x37')]('nolimit')){_0x25ce81['limit']=qs[_0xd435('0x1b')](_0x48d363[_0xd435('0x31')][_0xd435('0x1b')]);_0x25ce81['offset']=qs[_0xd435('0x1d')](_0x48d363['query'][_0xd435('0x1d')]);}_0x25ce81[_0xd435('0x38')]=qs['sort'](_0x48d363[_0xd435('0x31')]['sort']);_0x25ce81[_0xd435('0x39')]=qs[_0xd435('0x33')](_[_0xd435('0x3a')](_0x48d363[_0xd435('0x31')],_0x5a4bd6['filters']),_0x21faf);if(_0x48d363[_0xd435('0x31')][_0xd435('0x3b')]){_0x25ce81['where']=_[_0xd435('0x3c')](_0x25ce81[_0xd435('0x39')],{'$or':_[_0xd435('0x2c')](_0x21faf,function(_0xcfa2ad){if(_0xcfa2ad[_0xd435('0x3d')]!==_0xd435('0x3e')){var _0x3d4119={};_0x3d4119[_0xcfa2ad['name']]={'$like':'%'+_0x48d363[_0xd435('0x31')]['filter']+'%'};return _0x3d4119;}})});}_0x25ce81=_[_0xd435('0x3c')]({},_0x25ce81,_0x48d363[_0xd435('0x3f')]);var _0x58e106={'where':_0x25ce81[_0xd435('0x39')]};return db[_0xd435('0x2d')][_0xd435('0x1c')](_0x58e106)[_0xd435('0x24')](function(_0x4eab80){_0xf1374e[_0xd435('0x1c')]=_0x4eab80;if(_0x48d363[_0xd435('0x31')][_0xd435('0x40')]){_0x25ce81[_0xd435('0x41')]=[{'all':!![]}];}return db[_0xd435('0x2d')][_0xd435('0x42')](_0x25ce81);})[_0xd435('0x24')](function(_0x29e371){_0xf1374e[_0xd435('0x43')]=_0x29e371;return _0xf1374e;})[_0xd435('0x24')](respondWithFilteredResult(_0x2c6d47,_0x25ce81))[_0xd435('0x44')](handleError(_0x2c6d47,null));};exports[_0xd435('0x45')]=function(_0x19ac1c,_0x5cf7a7){var _0x3d6cb1={'raw':!![],'where':{'id':_0x19ac1c[_0xd435('0x46')]['id']}},_0x19a366={};_0x19a366[_0xd435('0x30')]=_[_0xd435('0x32')](db['FaxApplication'][_0xd435('0x2e')]);_0x19a366['query']=_[_0xd435('0x32')](_0x19ac1c[_0xd435('0x31')]);_0x19a366['filters']=_['intersection'](_0x19a366[_0xd435('0x30')],_0x19a366['query']);_0x3d6cb1[_0xd435('0x34')]=_[_0xd435('0x35')](_0x19a366[_0xd435('0x30')],qs[_0xd435('0x36')](_0x19ac1c['query']['fields']));_0x3d6cb1[_0xd435('0x34')]=_0x3d6cb1[_0xd435('0x34')]['length']?_0x3d6cb1[_0xd435('0x34')]:_0x19a366[_0xd435('0x30')];if(_0x19ac1c[_0xd435('0x31')]['includeAll']){_0x3d6cb1[_0xd435('0x41')]=[{'all':!![]}];}_0x3d6cb1=_[_0xd435('0x3c')]({},_0x3d6cb1,_0x19ac1c[_0xd435('0x3f')]);return db['FaxApplication'][_0xd435('0x47')](_0x3d6cb1)['then'](handleEntityNotFound(_0x5cf7a7,null))[_0xd435('0x24')](respondWithResult(_0x5cf7a7,null))['catch'](handleError(_0x5cf7a7,null));};exports['create']=function(_0x5b3df5,_0x650f81){return db[_0xd435('0x2d')]['create'](_0x5b3df5[_0xd435('0x48')],{})[_0xd435('0x24')](respondWithResult(_0x650f81,0xc9))[_0xd435('0x44')](handleError(_0x650f81,null));};exports[_0xd435('0x23')]=function(_0x33b8bd,_0x2fa5f4){if(_0x33b8bd['body']['id']){delete _0x33b8bd[_0xd435('0x48')]['id'];}return db[_0xd435('0x2d')][_0xd435('0x47')]({'where':{'id':_0x33b8bd[_0xd435('0x46')]['id']}})[_0xd435('0x24')](handleEntityNotFound(_0x2fa5f4,null))['then'](saveUpdates(_0x33b8bd[_0xd435('0x48')],null))[_0xd435('0x24')](respondWithResult(_0x2fa5f4,null))[_0xd435('0x44')](handleError(_0x2fa5f4,null));};exports[_0xd435('0x25')]=function(_0x4462d1,_0x8fd504){return db['FaxApplication'][_0xd435('0x47')]({'where':{'id':_0x4462d1[_0xd435('0x46')]['id']}})[_0xd435('0x24')](handleEntityNotFound(_0x8fd504,null))[_0xd435('0x24')](removeEntity(_0x8fd504,null))[_0xd435('0x44')](handleError(_0x8fd504,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 6cc6e70..954d2be 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 _0x0f8f=['exports','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x8cb470,_0x2b9757){var _0x2ca139=function(_0x5251be){while(--_0x5251be){_0x8cb470['push'](_0x8cb470['shift']());}};_0x2ca139(++_0x2b9757);}(_0x0f8f,0x7c));var _0xf0f8=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x0f8f[_0x1cbcf1];return _0x3a06f0;};'use strict';var _=require(_0xf0f8('0x0'));var util=require(_0xf0f8('0x1'));var logger=require(_0xf0f8('0x2'))(_0xf0f8('0x3'));var moment=require(_0xf0f8('0x4'));var BPromise=require(_0xf0f8('0x5'));var rp=require(_0xf0f8('0x6'));var fs=require('fs');var path=require(_0xf0f8('0x7'));var rimraf=require(_0xf0f8('0x8'));var config=require(_0xf0f8('0x9'));var attributes=require(_0xf0f8('0xa'));module[_0xf0f8('0xb')]=function(_0x1eeea8,_0x30e060){return _0x1eeea8['define'](_0xf0f8('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf0f8('0xd'),'collate':_0xf0f8('0xe')});}; \ No newline at end of file +var _0x5a7e=['exports','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x2674fa,_0x4af567){var _0xb41751=function(_0x247206){while(--_0x247206){_0x2674fa['push'](_0x2674fa['shift']());}};_0xb41751(++_0x4af567);}(_0x5a7e,0x1be));var _0xe5a7=function(_0x24d22e,_0x35b820){_0x24d22e=_0x24d22e-0x0;var _0x39a2c0=_0x5a7e[_0x24d22e];return _0x39a2c0;};'use strict';var _=require('lodash');var util=require(_0xe5a7('0x0'));var logger=require(_0xe5a7('0x1'))(_0xe5a7('0x2'));var moment=require(_0xe5a7('0x3'));var BPromise=require(_0xe5a7('0x4'));var rp=require(_0xe5a7('0x5'));var fs=require('fs');var path=require(_0xe5a7('0x6'));var rimraf=require(_0xe5a7('0x7'));var config=require(_0xe5a7('0x8'));var attributes=require(_0xe5a7('0x9'));module[_0xe5a7('0xa')]=function(_0x5b3871,_0x1ae013){return _0x5b3871['define']('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe5a7('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f778735..fa899df 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 _0xe35c=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication','body','options','raw','where','attributes','limit','then','UpdateFaxApplication','lodash','util','moment','bluebird'];(function(_0x2a6153,_0x1ac255){var _0x3ca986=function(_0x415818){while(--_0x415818){_0x2a6153['push'](_0x2a6153['shift']());}};_0x3ca986(++_0x1ac255);}(_0xe35c,0x146));var _0xce35=function(_0x17a249,_0x4f941c){_0x17a249=_0x17a249-0x0;var _0x19e05f=_0xe35c[_0x17a249];return _0x19e05f;};'use strict';var _=require(_0xce35('0x0'));var util=require(_0xce35('0x1'));var moment=require(_0xce35('0x2'));var BPromise=require(_0xce35('0x3'));var rs=require(_0xce35('0x4'));var fs=require('fs');var Redis=require(_0xce35('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce35('0x6'))('rpc');var config=require(_0xce35('0x7'));var jayson=require(_0xce35('0x8'));var client=jayson[_0xce35('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x270b81,_0x2df0d0,_0x2b4a82){return new BPromise(function(_0x74ae5e,_0x55e7f0){return client[_0xce35('0xa')](_0x270b81,_0x2b4a82)['then'](function(_0x549f60){logger[_0xce35('0xb')]('FaxApplication,\x20%s,\x20%s',_0x2df0d0,'request\x20sent');logger[_0xce35('0xc')](_0xce35('0xd'),_0x2df0d0,_0xce35('0xe'),JSON[_0xce35('0xf')](_0x549f60));if(_0x549f60[_0xce35('0x10')]){if(_0x549f60['error']['code']===0x1f4){logger[_0xce35('0x10')](_0xce35('0x11'),_0x2df0d0,_0x549f60[_0xce35('0x10')][_0xce35('0x12')]);return _0x55e7f0(_0x549f60[_0xce35('0x10')]['message']);}logger['error'](_0xce35('0x11'),_0x2df0d0,_0x549f60[_0xce35('0x10')]['message']);return _0x74ae5e(_0x549f60[_0xce35('0x10')][_0xce35('0x12')]);}else{logger[_0xce35('0xb')](_0xce35('0x11'),_0x2df0d0,_0xce35('0xe'));_0x74ae5e(_0x549f60[_0xce35('0x13')][_0xce35('0x12')]);}})[_0xce35('0x14')](function(_0x4388fd){logger[_0xce35('0x10')](_0xce35('0x11'),_0x2df0d0,_0x4388fd);_0x55e7f0(_0x4388fd);});});}exports['UpdateFaxApplication']=function(_0x8d7f28){var _0x9681d6=this;return new Promise(function(_0x3efb22,_0x3ee426){return db[_0xce35('0x15')]['update'](_0x8d7f28[_0xce35('0x16')],{'raw':_0x8d7f28[_0xce35('0x17')]?_0x8d7f28[_0xce35('0x17')][_0xce35('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8d7f28[_0xce35('0x17')]?_0x8d7f28[_0xce35('0x17')][_0xce35('0x19')]||null:null,'attributes':_0x8d7f28[_0xce35('0x17')]?_0x8d7f28['options'][_0xce35('0x1a')]||null:null,'limit':_0x8d7f28[_0xce35('0x17')]?_0x8d7f28[_0xce35('0x17')][_0xce35('0x1b')]||null:null})[_0xce35('0x1c')](function(_0x2f049e){logger[_0xce35('0xb')](_0xce35('0x1d'),_0x8d7f28);logger[_0xce35('0xc')](_0xce35('0x1d'),_0x8d7f28,JSON['stringify'](_0x2f049e));_0x3efb22(_0x2f049e);})[_0xce35('0x14')](function(_0x3d3b5c){logger[_0xce35('0x10')]('UpdateFaxApplication',_0x3d3b5c[_0xce35('0x12')],_0x8d7f28);_0x3ee426(_0x9681d6[_0xce35('0x10')](0x1f4,_0x3d3b5c['message']));});});}; \ No newline at end of file +var _0x4c35=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c35,0x9a));var _0x54c3=function(_0x102881,_0x58d723){_0x102881=_0x102881-0x0;var _0x5c63d0=_0x4c35[_0x102881];return _0x5c63d0;};'use strict';var _=require('lodash');var util=require(_0x54c3('0x0'));var moment=require(_0x54c3('0x1'));var BPromise=require(_0x54c3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54c3('0x3'));var db=require(_0x54c3('0x4'))['db'];var utils=require(_0x54c3('0x5'));var logger=require(_0x54c3('0x6'))(_0x54c3('0x7'));var config=require(_0x54c3('0x8'));var jayson=require(_0x54c3('0x9'));var client=jayson['client'][_0x54c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55a189,_0x6ce565,_0x435d50){return new BPromise(function(_0x70fd3e,_0x12e271){return client[_0x54c3('0xb')](_0x55a189,_0x435d50)[_0x54c3('0xc')](function(_0x2b0dbe){logger[_0x54c3('0xd')](_0x54c3('0xe'),_0x6ce565,'request\x20sent');logger[_0x54c3('0xf')](_0x54c3('0x10'),_0x6ce565,_0x54c3('0x11'),JSON[_0x54c3('0x12')](_0x2b0dbe));if(_0x2b0dbe[_0x54c3('0x13')]){if(_0x2b0dbe[_0x54c3('0x13')][_0x54c3('0x14')]===0x1f4){logger[_0x54c3('0x13')]('FaxApplication,\x20%s,\x20%s',_0x6ce565,_0x2b0dbe[_0x54c3('0x13')][_0x54c3('0x15')]);return _0x12e271(_0x2b0dbe[_0x54c3('0x13')]['message']);}logger[_0x54c3('0x13')](_0x54c3('0xe'),_0x6ce565,_0x2b0dbe['error']['message']);return _0x70fd3e(_0x2b0dbe['error'][_0x54c3('0x15')]);}else{logger[_0x54c3('0xd')](_0x54c3('0xe'),_0x6ce565,'request\x20sent');_0x70fd3e(_0x2b0dbe['result'][_0x54c3('0x15')]);}})[_0x54c3('0x16')](function(_0xbe87ea){logger['error'](_0x54c3('0xe'),_0x6ce565,_0xbe87ea);_0x12e271(_0xbe87ea);});});}exports[_0x54c3('0x17')]=function(_0x2039a1){var _0x4344a2=this;return new Promise(function(_0x53081b,_0x529dcc){return db['FaxApplication'][_0x54c3('0x18')](_0x2039a1[_0x54c3('0x19')],{'raw':_0x2039a1[_0x54c3('0x1a')]?_0x2039a1[_0x54c3('0x1a')][_0x54c3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2039a1[_0x54c3('0x1a')]?_0x2039a1[_0x54c3('0x1a')][_0x54c3('0x1c')]||null:null,'attributes':_0x2039a1[_0x54c3('0x1a')]?_0x2039a1[_0x54c3('0x1a')][_0x54c3('0x1d')]||null:null,'limit':_0x2039a1[_0x54c3('0x1a')]?_0x2039a1[_0x54c3('0x1a')][_0x54c3('0x1e')]||null:null})[_0x54c3('0xc')](function(_0x4cf23e){logger[_0x54c3('0xd')]('UpdateFaxApplication',_0x2039a1);logger['debug']('UpdateFaxApplication',_0x2039a1,JSON[_0x54c3('0x12')](_0x4cf23e));_0x53081b(_0x4cf23e);})[_0x54c3('0x16')](function(_0x500a5d){logger[_0x54c3('0x13')]('UpdateFaxApplication',_0x500a5d[_0x54c3('0x15')],_0x2039a1);_0x529dcc(_0x4344a2[_0x54c3('0x13')](0x1f4,_0x500a5d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 8c94666..4aaf6c6 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 _0x34b7=['express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','path','connect-timeout'];(function(_0x115e61,_0x3ff173){var _0x15ba77=function(_0x35e491){while(--_0x35e491){_0x115e61['push'](_0x115e61['shift']());}};_0x15ba77(++_0x3ff173);}(_0x34b7,0x196));var _0x734b=function(_0x552b03,_0x48e023){_0x552b03=_0x552b03-0x0;var _0x14ab19=_0x34b7[_0x552b03];return _0x14ab19;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xd')]);router[_0x734b('0xe')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0xf')]);module[_0x734b('0x10')]=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x5702d1,_0x8e1bea){var _0x5c844b=function(_0x5a117a){while(--_0x5a117a){_0x5702d1['push'](_0x5702d1['shift']());}};_0x5c844b(++_0x8e1bea);}(_0x2032,0xd9));var _0x2203=function(_0x23cf42,_0x228606){_0x23cf42=_0x23cf42-0x0;var _0x4c1ad7=_0x2032[_0x23cf42];return _0x4c1ad7;};'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/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 7e0ed2f..2b7a83b 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 _0x8aad=['ENUM','out','sequelize','exports','DATE','STRING'];(function(_0x2f2d70,_0x31a920){var _0x597948=function(_0x5248ad){while(--_0x5248ad){_0x2f2d70['push'](_0x2f2d70['shift']());}};_0x597948(++_0x31a920);}(_0x8aad,0x146));var _0xd8aa=function(_0x10a4f6,_0x588619){_0x10a4f6=_0x10a4f6-0x0;var _0x7e6890=_0x8aad[_0x10a4f6];return _0x7e6890;};'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 +var _0x25e7=['STRING','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x3588c4,_0x1f96be){var _0x52d843=function(_0x3c0bfc){while(--_0x3c0bfc){_0x3588c4['push'](_0x3588c4['shift']());}};_0x52d843(++_0x1f96be);}(_0x25e7,0x1d6));var _0x725e=function(_0x23c651,_0x143982){_0x23c651=_0x23c651-0x0;var _0xbe7bdb=_0x25e7[_0x23c651];return _0xbe7bdb;};'use strict';var Sequelize=require(_0x725e('0x0'));module[_0x725e('0x1')]={'closed':{'type':Sequelize[_0x725e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x725e('0x3')]},'disposition':{'type':Sequelize[_0x725e('0x4')]},'secondDisposition':{'type':Sequelize[_0x725e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x725e('0x4')]},'note':{'type':Sequelize[_0x725e('0x4')]},'read1stAt':{'type':Sequelize[_0x725e('0x3')]},'fax':{'type':Sequelize[_0x725e('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x725e('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x725e('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 9071f8e..6289578 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 _0x987e=['tmp','attachments','push','Attachment','Messages','createdAt','get','mkdirSync','existsSync','createReadStream','basename','resolve','log','rimraf','zip-dir','moment','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','error','stack','name','send','index','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','query','user','catch','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','then','create','body','params','describe','FaxMessage','addMessage','ids','findOne','length','hasOwnProperty','nolimit','order','sort','where','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','omit','Tag','color','faxInteractionTags:save','removeTags','download','toString','join','root','server','files'];(function(_0x4c9316,_0x5c7f6f){var _0x146aad=function(_0x4fa179){while(--_0x4fa179){_0x4c9316['push'](_0x4c9316['shift']());}};_0x146aad(++_0x5c7f6f);}(_0x987e,0x1f2));var _0xe987=function(_0x27c23b,_0x20ee2c){_0x27c23b=_0x27c23b-0x0;var _0x195172=_0x987e[_0x27c23b];return _0x195172;};'use strict';var rimraf=require(_0xe987('0x0'));var zipdir=require(_0xe987('0x1'));var moment=require(_0xe987('0x2'));var BPromise=require('bluebird');var util=require(_0xe987('0x3'));var path=require(_0xe987('0x4'));var fs=require('fs');var _=require(_0xe987('0x5'));var Redis=require('ioredis');var interaction=require(_0xe987('0x6'));var qs=require(_0xe987('0x7'));var logger=require(_0xe987('0x8'))(_0xe987('0x9'));var config=require(_0xe987('0xa'));var db=require(_0xe987('0xb'))['db'];config[_0xe987('0xc')]=_[_0xe987('0xd')](config[_0xe987('0xc')],{'host':_0xe987('0xe'),'port':0x18eb});var socket=require(_0xe987('0xf'))(new Redis(config['redis']));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x30940e,_0x1e4dc7){_0x1e4dc7=_0x1e4dc7||0xcc;return function(_0xe1224a){if(_0xe1224a){return _0x30940e[_0xe987('0x10')](_0x1e4dc7);}return _0x30940e[_0xe987('0x11')](_0x1e4dc7)[_0xe987('0x12')]();};}function respondWithResult(_0x2cb861,_0x173bd6){_0x173bd6=_0x173bd6||0xc8;return function(_0xa7595b){if(_0xa7595b){return _0x2cb861['status'](_0x173bd6)[_0xe987('0x13')](_0xa7595b);}};}function respondWithFilteredResult(_0x4943d3,_0x4f5780){return function(_0x9927bd){if(_0x9927bd){var _0x5761ac=typeof _0x4f5780[_0xe987('0x14')]===_0xe987('0x15')&&typeof _0x4f5780[_0xe987('0x16')]==='undefined';var _0x2593b7=_0x9927bd[_0xe987('0x17')];var _0x58411a=_0x5761ac?0x0:_0x4f5780[_0xe987('0x14')];var _0x21314b=_0x5761ac?_0x9927bd[_0xe987('0x17')]:_0x4f5780[_0xe987('0x14')]+_0x4f5780['limit'];var _0x31820d;if(_0x21314b>=_0x2593b7){_0x21314b=_0x2593b7;_0x31820d=0xc8;}else{_0x31820d=0xce;}_0x4943d3[_0xe987('0x11')](_0x31820d);return _0x4943d3[_0xe987('0x18')](_0xe987('0x19'),_0x58411a+'-'+_0x21314b+'/'+_0x2593b7)[_0xe987('0x13')](_0x9927bd);}return null;};}function saveUpdates(_0x431847){return function(_0x4280f4){if(_0x4280f4){return _0x4280f4[_0xe987('0x1a')](_0x431847)['then'](function(_0x1584bd){return _0x1584bd;});}return null;};}function removeEntity(_0x2d2a9b){return function(_0x2d6170){if(_0x2d6170){return _0x2d6170['destroy']()['then'](function(){_0x2d2a9b[_0xe987('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e6444){return function(_0x452bee){if(!_0x452bee){_0x2e6444[_0xe987('0x10')](0x194);}return _0x452bee;};}function handleError(_0x1b9fd0,_0x1d3888){_0x1d3888=_0x1d3888||0x1f4;return function(_0x406e07){logger[_0xe987('0x1b')](_0x406e07[_0xe987('0x1c')]);if(_0x406e07[_0xe987('0x1d')]){delete _0x406e07[_0xe987('0x1d')];}_0x1b9fd0[_0xe987('0x11')](_0x1d3888)[_0xe987('0x1e')](_0x406e07);};}exports[_0xe987('0x1f')]=function(_0x191002,_0x3865e0){var _0x3464d5={};var _0x404df9=_['map'](db[_0xe987('0x20')][_0xe987('0x21')],function(_0x2cf988){return{'name':_0x2cf988['fieldName'],'type':_0x2cf988[_0xe987('0x22')][_0xe987('0x23')]};});_0x3464d5=qs[_0xe987('0x24')](_0x404df9,_0x191002);return interaction[_0xe987('0x25')](_0xe987('0x26'),_0x191002[_0xe987('0x27')],_0x191002[_0xe987('0x28')],_0x3464d5,_0x404df9)['then'](respondWithFilteredResult(_0x3865e0,_0x3464d5))[_0xe987('0x29')](handleError(_0x3865e0,null));};exports['show']=function(_0x5cea5a,_0x3c9f03){var _0x2271c9={'raw':![],'where':{'id':_0x5cea5a['params']['id']}},_0x2a3853={};_0x2a3853[_0xe987('0x2a')]=_[_0xe987('0x2b')](db['FaxInteraction'][_0xe987('0x21')]);_0x2a3853['query']=_[_0xe987('0x2b')](_0x5cea5a[_0xe987('0x27')]);_0x2a3853[_0xe987('0x2c')]=_[_0xe987('0x2d')](_0x2a3853[_0xe987('0x2a')],_0x2a3853[_0xe987('0x27')]);_0x2271c9[_0xe987('0x2e')]=_['intersection'](_0x2a3853[_0xe987('0x2a')],qs[_0xe987('0x2f')](_0x5cea5a[_0xe987('0x27')][_0xe987('0x2f')]));_0x2271c9[_0xe987('0x2e')]=_0x2271c9[_0xe987('0x2e')]['length']?_0x2271c9[_0xe987('0x2e')]:_0x2a3853[_0xe987('0x2a')];if(_0x5cea5a[_0xe987('0x27')][_0xe987('0x30')]){_0x2271c9[_0xe987('0x31')]=[{'all':!![]}];}_0x2271c9=_[_0xe987('0x32')]({},_0x2271c9,_0x5cea5a[_0xe987('0x33')]);return db[_0xe987('0x20')][_0xe987('0x34')](_0x2271c9)['then'](handleEntityNotFound(_0x3c9f03,null))[_0xe987('0x35')](respondWithResult(_0x3c9f03,null))['catch'](handleError(_0x3c9f03,null));};exports['create']=function(_0x165406,_0x225484){return db[_0xe987('0x20')][_0xe987('0x36')](_0x165406['body'],{})['then'](respondWithResult(_0x225484,0xc9))[_0xe987('0x29')](handleError(_0x225484,null));};exports['update']=function(_0x551414,_0x249ecb){if(_0x551414[_0xe987('0x37')]['id']){delete _0x551414[_0xe987('0x37')]['id'];}return db[_0xe987('0x20')][_0xe987('0x34')]({'where':{'id':_0x551414['params']['id']}})[_0xe987('0x35')](handleEntityNotFound(_0x249ecb,null))[_0xe987('0x35')](saveUpdates(_0x551414[_0xe987('0x37')],null))[_0xe987('0x35')](respondWithResult(_0x249ecb,null))[_0xe987('0x29')](handleError(_0x249ecb,null));};exports['destroy']=function(_0xa8c2d,_0x125cf6){return db[_0xe987('0x20')][_0xe987('0x34')]({'where':{'id':_0xa8c2d[_0xe987('0x38')]['id']}})[_0xe987('0x35')](handleEntityNotFound(_0x125cf6,null))[_0xe987('0x35')](removeEntity(_0x125cf6,null))[_0xe987('0x29')](handleError(_0x125cf6,null));};exports[_0xe987('0x39')]=function(_0x36c96f,_0x244f59){return db[_0xe987('0x20')][_0xe987('0x39')]()[_0xe987('0x35')](respondWithResult(_0x244f59,null))[_0xe987('0x29')](handleError(_0x244f59,null));};exports['addMessage']=function(_0x4fc3d8,_0x4f3aec){return db[_0xe987('0x3a')][_0xe987('0x34')]({'where':{'id':_0x4fc3d8[_0xe987('0x38')]['id']}})[_0xe987('0x35')](handleEntityNotFound(_0x4f3aec,null))['then'](function(_0x5b05b8){if(_0x5b05b8){return _0x5b05b8[_0xe987('0x3b')](_0x4fc3d8[_0xe987('0x37')][_0xe987('0x3c')],_['omit'](_0x4fc3d8[_0xe987('0x37')],[_0xe987('0x3c'),'id'])||{});}})[_0xe987('0x35')](respondWithResult(_0x4f3aec,null))['catch'](handleError(_0x4f3aec,null));};exports['getMessages']=function(_0x11d89a,_0x7e603c){var _0x40f93c={'raw':![],'where':{}};var _0x5dd0a4={};var _0x5029b9={'count':0x0,'rows':[]};return db[_0xe987('0x20')][_0xe987('0x3d')]({'where':{'id':_0x11d89a['params']['id']}})[_0xe987('0x35')](handleEntityNotFound(_0x7e603c,null))[_0xe987('0x35')](function(_0x2224ba){if(_0x2224ba){_0x5dd0a4['model']=_[_0xe987('0x2b')](db[_0xe987('0x3a')]['rawAttributes']);_0x5dd0a4[_0xe987('0x27')]=_['keys'](_0x11d89a['query']);_0x5dd0a4[_0xe987('0x2c')]=_[_0xe987('0x2d')](_0x5dd0a4[_0xe987('0x2a')],_0x5dd0a4[_0xe987('0x27')]);_0x40f93c[_0xe987('0x2e')]=_[_0xe987('0x2d')](_0x5dd0a4[_0xe987('0x2a')],qs['fields'](_0x11d89a[_0xe987('0x27')]['fields']));_0x40f93c[_0xe987('0x2e')]=_0x40f93c[_0xe987('0x2e')][_0xe987('0x3e')]?_0x40f93c[_0xe987('0x2e')]:_0x5dd0a4['model'];if(!_0x11d89a[_0xe987('0x27')][_0xe987('0x3f')](_0xe987('0x40'))){_0x40f93c[_0xe987('0x16')]=qs[_0xe987('0x16')](_0x11d89a[_0xe987('0x27')][_0xe987('0x16')]);_0x40f93c[_0xe987('0x14')]=qs[_0xe987('0x14')](_0x11d89a[_0xe987('0x27')][_0xe987('0x14')]);}_0x40f93c[_0xe987('0x41')]=qs[_0xe987('0x42')](_0x11d89a[_0xe987('0x27')]['sort']);_0x40f93c[_0xe987('0x43')]=qs['filters'](_['pick'](_0x11d89a[_0xe987('0x27')],_0x5dd0a4[_0xe987('0x2c')]));_0x40f93c[_0xe987('0x43')]['FaxInteractionId']=_0x2224ba['id'];if(_0x11d89a[_0xe987('0x27')][_0xe987('0x44')]){_0x40f93c['where']=_[_0xe987('0x32')](_0x40f93c[_0xe987('0x43')],{'$or':_[_0xe987('0x45')](_0x40f93c[_0xe987('0x2e')],function(_0x30b325){var _0x2e8dd3={};_0x2e8dd3[_0x30b325]={'$like':'%'+_0x11d89a['query'][_0xe987('0x44')]+'%'};return _0x2e8dd3;})});}if(_0x11d89a[_0xe987('0x27')][_0xe987('0x46')]){var _0x223af6=_0x11d89a[_0xe987('0x27')][_0xe987('0x46')]['split'](',');var _0x5ecbef={};_0x5ecbef[_0x223af6[0x0]]={'$gte':moment(_0x223af6[0x1])[_0xe987('0x47')](_0xe987('0x48'))};_0x40f93c[_0xe987('0x43')]=_[_0xe987('0x32')](_0x40f93c[_0xe987('0x43')],_0x5ecbef);}_0x40f93c=_[_0xe987('0x32')]({},_0x40f93c,_0x11d89a[_0xe987('0x33')]);return db[_0xe987('0x3a')]['count']({'where':_0x40f93c[_0xe987('0x43')]})[_0xe987('0x35')](function(_0x4513de){_0x5029b9['count']=_0x4513de;if(_0x11d89a[_0xe987('0x27')][_0xe987('0x30')]){_0x40f93c['include']=[{'all':!![]}];}return db[_0xe987('0x3a')][_0xe987('0x25')](_0x40f93c);})[_0xe987('0x35')](function(_0x3297d9){_0x5029b9['rows']=_0x3297d9;return _0x5029b9;});}})[_0xe987('0x35')](respondWithFilteredResult(_0x7e603c,_0x40f93c))[_0xe987('0x29')](handleError(_0x7e603c,null));};exports['addTags']=function(_0x22e541,_0xca3925){return db['FaxInteraction'][_0xe987('0x34')]({'where':{'id':_0x22e541[_0xe987('0x38')]['id']}})[_0xe987('0x35')](handleEntityNotFound(_0xca3925,null))['then'](function(_0x3466cf){if(_0x3466cf){return _0x3466cf['setTags'](_0x22e541[_0xe987('0x37')][_0xe987('0x3c')],_[_0xe987('0x49')](_0x22e541[_0xe987('0x37')],[_0xe987('0x3c'),'id'])||{})['spread'](function(){return db[_0xe987('0x4a')]['findAll']({'attributes':['id',_0xe987('0x1d'),_0xe987('0x4b')],'where':{'id':_0x22e541[_0xe987('0x37')][_0xe987('0x3c')]}});})['then'](function(_0x1a97d2){socket['emit'](_0xe987('0x4c'),{'id':Number(_0x22e541[_0xe987('0x38')]['id']),'tags':_0x1a97d2||[]});return{'id':Number(_0x22e541['params']['id']),'tags':_0x1a97d2||[]};});}})[_0xe987('0x35')](respondWithResult(_0xca3925,null))[_0xe987('0x29')](handleError(_0xca3925,null));};exports[_0xe987('0x4d')]=function(_0x570120,_0x37336d){return db[_0xe987('0x20')][_0xe987('0x34')]({'where':{'id':_0x570120[_0xe987('0x38')]['id']}})['then'](handleEntityNotFound(_0x37336d,null))[_0xe987('0x35')](function(_0x520e76){if(_0x520e76){return _0x520e76[_0xe987('0x4d')](_0x570120[_0xe987('0x27')][_0xe987('0x3c')]);}})[_0xe987('0x35')](respondWithStatusCode(_0x37336d,null))['catch'](handleError(_0x37336d,null));};exports[_0xe987('0x4e')]=function(_0x2d6643,_0x2e1f97){var _0x5152a9=moment()['unix']()[_0xe987('0x4f')]();var _0x2158ae=path[_0xe987('0x50')](config[_0xe987('0x51')],_0xe987('0x52'),_0xe987('0x53'),_0xe987('0x54'));var _0x39c415=path[_0xe987('0x50')](config[_0xe987('0x51')],_0xe987('0x52'),_0xe987('0x53'),_0xe987('0x55'));var _0x1e8850=path[_0xe987('0x50')](_0x2158ae,_0x5152a9);var _0x1109d9=util['format']('transcript-%d-%s.zip',_0x2d6643['params']['id'],_0x5152a9);var _0x356380=path[_0xe987('0x50')](_0x2158ae,_0x1109d9);var _0xc3f430=[];_0xc3f430[_0xe987('0x56')]({'model':db[_0xe987('0x57')],'as':_0xe987('0x57'),'raw':!![]});var _0x29fa2c=[{'model':db['FaxMessage'],'as':_0xe987('0x58'),'attributes':['id',_0xe987('0x37'),_0xe987('0x59')],'include':_0xc3f430}];return db[_0xe987('0x20')][_0xe987('0x34')]({'where':{'id':_0x2d6643[_0xe987('0x38')]['id']},'include':_0x29fa2c})[_0xe987('0x35')](handleEntityNotFound(_0x2e1f97,null))['then'](function(_0x1ebd6a){if(_0x1ebd6a&&_0x1ebd6a['Messages']){var _0x2843ff=_0x1ebd6a[_0xe987('0x5a')]({'plain':!![]});fs[_0xe987('0x5b')](_0x1e8850);for(var _0x4a19fd=0x0;_0x4a19fd<_0x2843ff[_0xe987('0x58')][_0xe987('0x3e')];_0x4a19fd++){var _0x1a555d=_0x2843ff['Messages'][_0x4a19fd][_0xe987('0x57')];if(_0x1a555d){var _0x258659=path[_0xe987('0x50')](_0x39c415,_0x1a555d['basename']);if(fs[_0xe987('0x5c')](_0x258659)){fs[_0xe987('0x5d')](_0x258659)['pipe'](fs['createWriteStream'](path[_0xe987('0x50')](_0x1e8850,_0x1a555d[_0xe987('0x5e')])));}}}return BPromise[_0xe987('0x5f')]()['then'](function(){return new BPromise(function(_0x2eafef,_0x5c8d85){zipdir(_0x1e8850,{'saveTo':_0x356380},function(_0x123867,_0x1b60cc){if(_0x123867)return _0x5c8d85(_0x123867);return _0x2eafef(_0x1b60cc);});})[_0xe987('0x35')](function(){return new BPromise(function(_0x15477c,_0x3af50b){rimraf(_0x1e8850,function(_0x5d931c){if(_0x5d931c)_0x3af50b(_0x5d931c);return _0x15477c();});});})[_0xe987('0x35')](function(){return _0x2e1f97[_0xe987('0x4e')](_0x356380,_0x1109d9,function(_0x560ed9){if(_0x560ed9){console[_0xe987('0x60')]('err',_0x560ed9);}else{fs['unlinkSync'](_0x356380);}});});});}else{return _0x2e1f97[_0xe987('0x10')](0xc8);}})[_0xe987('0x29')](handleError(_0x2e1f97,null));}; \ No newline at end of file +var _0x9f8d=['map','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','user','catch','params','model','keys','intersection','attributes','length','includeAll','include','merge','find','create','body','destroy','describe','addMessage','FaxMessage','ids','getMessages','findOne','filters','fields','nolimit','limit','order','sort','where','FaxInteractionId','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','options','setTags','omit','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','basename','existsSync','createReadStream','pipe','createWriteStream','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','undefined','count','set','Content-Range','update','then','end','sendStatus','error','stack','name','index'];(function(_0x5533b1,_0x7f4a9a){var _0x1009f3=function(_0x41d1ad){while(--_0x41d1ad){_0x5533b1['push'](_0x5533b1['shift']());}};_0x1009f3(++_0x7f4a9a);}(_0x9f8d,0xb0));var _0xd9f8=function(_0x14a9e1,_0x2a0a09){_0x14a9e1=_0x14a9e1-0x0;var _0x16a1b1=_0x9f8d[_0x14a9e1];return _0x16a1b1;};'use strict';var rimraf=require(_0xd9f8('0x0'));var zipdir=require(_0xd9f8('0x1'));var moment=require(_0xd9f8('0x2'));var BPromise=require(_0xd9f8('0x3'));var util=require(_0xd9f8('0x4'));var path=require(_0xd9f8('0x5'));var fs=require('fs');var _=require(_0xd9f8('0x6'));var Redis=require(_0xd9f8('0x7'));var interaction=require(_0xd9f8('0x8'));var qs=require(_0xd9f8('0x9'));var logger=require(_0xd9f8('0xa'))(_0xd9f8('0xb'));var config=require(_0xd9f8('0xc'));var db=require(_0xd9f8('0xd'))['db'];config[_0xd9f8('0xe')]=_[_0xd9f8('0xf')](config[_0xd9f8('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xd9f8('0x10'))(new Redis(config['redis']));require(_0xd9f8('0x11'))[_0xd9f8('0x12')](socket);function respondWithStatusCode(_0x322b9,_0x2c96e5){_0x2c96e5=_0x2c96e5||0xcc;return function(_0x6f90c5){if(_0x6f90c5){return _0x322b9['sendStatus'](_0x2c96e5);}return _0x322b9[_0xd9f8('0x13')](_0x2c96e5)['end']();};}function respondWithResult(_0x1efd10,_0x3b4c81){_0x3b4c81=_0x3b4c81||0xc8;return function(_0x55a3fe){if(_0x55a3fe){return _0x1efd10['status'](_0x3b4c81)[_0xd9f8('0x14')](_0x55a3fe);}};}function respondWithFilteredResult(_0x1a555e,_0x514f24){return function(_0x22c5c3){if(_0x22c5c3){var _0xc91a33=typeof _0x514f24[_0xd9f8('0x15')]==='undefined'&&typeof _0x514f24['limit']===_0xd9f8('0x16');var _0x16d094=_0x22c5c3[_0xd9f8('0x17')];var _0x549eae=_0xc91a33?0x0:_0x514f24['offset'];var _0x103ad2=_0xc91a33?_0x22c5c3[_0xd9f8('0x17')]:_0x514f24['offset']+_0x514f24['limit'];var _0x41773b;if(_0x103ad2>=_0x16d094){_0x103ad2=_0x16d094;_0x41773b=0xc8;}else{_0x41773b=0xce;}_0x1a555e[_0xd9f8('0x13')](_0x41773b);return _0x1a555e[_0xd9f8('0x18')](_0xd9f8('0x19'),_0x549eae+'-'+_0x103ad2+'/'+_0x16d094)[_0xd9f8('0x14')](_0x22c5c3);}return null;};}function saveUpdates(_0x2ac64a){return function(_0x284a3a){if(_0x284a3a){return _0x284a3a[_0xd9f8('0x1a')](_0x2ac64a)['then'](function(_0x33d27e){return _0x33d27e;});}return null;};}function removeEntity(_0x3f3d20){return function(_0xbedfb3){if(_0xbedfb3){return _0xbedfb3['destroy']()[_0xd9f8('0x1b')](function(){_0x3f3d20['status'](0xcc)[_0xd9f8('0x1c')]();});}};}function handleEntityNotFound(_0x52f756){return function(_0x78e7e9){if(!_0x78e7e9){_0x52f756[_0xd9f8('0x1d')](0x194);}return _0x78e7e9;};}function handleError(_0x2e7858,_0xa89b11){_0xa89b11=_0xa89b11||0x1f4;return function(_0x39eefb){logger[_0xd9f8('0x1e')](_0x39eefb[_0xd9f8('0x1f')]);if(_0x39eefb['name']){delete _0x39eefb[_0xd9f8('0x20')];}_0x2e7858['status'](_0xa89b11)['send'](_0x39eefb);};}exports[_0xd9f8('0x21')]=function(_0x18195c,_0x6df611){var _0x24f9ff={};var _0xdf2ed5=_[_0xd9f8('0x22')](db[_0xd9f8('0x23')][_0xd9f8('0x24')],function(_0x41e4a2){return{'name':_0x41e4a2[_0xd9f8('0x25')],'type':_0x41e4a2['type'][_0xd9f8('0x26')]};});_0x24f9ff=qs[_0xd9f8('0x27')](_0xdf2ed5,_0x18195c);return interaction[_0xd9f8('0x28')]('fax',_0x18195c[_0xd9f8('0x29')],_0x18195c[_0xd9f8('0x2a')],_0x24f9ff,_0xdf2ed5)[_0xd9f8('0x1b')](respondWithFilteredResult(_0x6df611,_0x24f9ff))[_0xd9f8('0x2b')](handleError(_0x6df611,null));};exports['show']=function(_0x4a668b,_0x4793d2){var _0x4d9a49={'raw':![],'where':{'id':_0x4a668b[_0xd9f8('0x2c')]['id']}},_0x379d68={};_0x379d68[_0xd9f8('0x2d')]=_[_0xd9f8('0x2e')](db[_0xd9f8('0x23')][_0xd9f8('0x24')]);_0x379d68[_0xd9f8('0x29')]=_[_0xd9f8('0x2e')](_0x4a668b[_0xd9f8('0x29')]);_0x379d68['filters']=_[_0xd9f8('0x2f')](_0x379d68[_0xd9f8('0x2d')],_0x379d68[_0xd9f8('0x29')]);_0x4d9a49[_0xd9f8('0x30')]=_[_0xd9f8('0x2f')](_0x379d68[_0xd9f8('0x2d')],qs['fields'](_0x4a668b[_0xd9f8('0x29')]['fields']));_0x4d9a49[_0xd9f8('0x30')]=_0x4d9a49['attributes'][_0xd9f8('0x31')]?_0x4d9a49[_0xd9f8('0x30')]:_0x379d68[_0xd9f8('0x2d')];if(_0x4a668b[_0xd9f8('0x29')][_0xd9f8('0x32')]){_0x4d9a49[_0xd9f8('0x33')]=[{'all':!![]}];}_0x4d9a49=_[_0xd9f8('0x34')]({},_0x4d9a49,_0x4a668b['options']);return db[_0xd9f8('0x23')][_0xd9f8('0x35')](_0x4d9a49)[_0xd9f8('0x1b')](handleEntityNotFound(_0x4793d2,null))[_0xd9f8('0x1b')](respondWithResult(_0x4793d2,null))[_0xd9f8('0x2b')](handleError(_0x4793d2,null));};exports['create']=function(_0x1a0f94,_0x1cf2d2){return db['FaxInteraction'][_0xd9f8('0x36')](_0x1a0f94[_0xd9f8('0x37')],{})[_0xd9f8('0x1b')](respondWithResult(_0x1cf2d2,0xc9))[_0xd9f8('0x2b')](handleError(_0x1cf2d2,null));};exports[_0xd9f8('0x1a')]=function(_0xa51713,_0x49c3ff){if(_0xa51713[_0xd9f8('0x37')]['id']){delete _0xa51713[_0xd9f8('0x37')]['id'];}return db[_0xd9f8('0x23')][_0xd9f8('0x35')]({'where':{'id':_0xa51713[_0xd9f8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x49c3ff,null))[_0xd9f8('0x1b')](saveUpdates(_0xa51713[_0xd9f8('0x37')],null))[_0xd9f8('0x1b')](respondWithResult(_0x49c3ff,null))[_0xd9f8('0x2b')](handleError(_0x49c3ff,null));};exports[_0xd9f8('0x38')]=function(_0x5c8787,_0x2207ff){return db[_0xd9f8('0x23')][_0xd9f8('0x35')]({'where':{'id':_0x5c8787[_0xd9f8('0x2c')]['id']}})[_0xd9f8('0x1b')](handleEntityNotFound(_0x2207ff,null))[_0xd9f8('0x1b')](removeEntity(_0x2207ff,null))['catch'](handleError(_0x2207ff,null));};exports[_0xd9f8('0x39')]=function(_0x1f2c17,_0x44d914){return db[_0xd9f8('0x23')][_0xd9f8('0x39')]()[_0xd9f8('0x1b')](respondWithResult(_0x44d914,null))[_0xd9f8('0x2b')](handleError(_0x44d914,null));};exports[_0xd9f8('0x3a')]=function(_0x47ddb4,_0x1fec16){return db[_0xd9f8('0x3b')]['find']({'where':{'id':_0x47ddb4['params']['id']}})[_0xd9f8('0x1b')](handleEntityNotFound(_0x1fec16,null))[_0xd9f8('0x1b')](function(_0x5863c8){if(_0x5863c8){return _0x5863c8[_0xd9f8('0x3a')](_0x47ddb4[_0xd9f8('0x37')][_0xd9f8('0x3c')],_['omit'](_0x47ddb4[_0xd9f8('0x37')],[_0xd9f8('0x3c'),'id'])||{});}})[_0xd9f8('0x1b')](respondWithResult(_0x1fec16,null))['catch'](handleError(_0x1fec16,null));};exports[_0xd9f8('0x3d')]=function(_0x35635c,_0x339b24){var _0x29bf0a={'raw':![],'where':{}};var _0x40f140={};var _0x193fb6={'count':0x0,'rows':[]};return db[_0xd9f8('0x23')][_0xd9f8('0x3e')]({'where':{'id':_0x35635c[_0xd9f8('0x2c')]['id']}})[_0xd9f8('0x1b')](handleEntityNotFound(_0x339b24,null))[_0xd9f8('0x1b')](function(_0x476555){if(_0x476555){_0x40f140[_0xd9f8('0x2d')]=_[_0xd9f8('0x2e')](db['FaxMessage'][_0xd9f8('0x24')]);_0x40f140[_0xd9f8('0x29')]=_[_0xd9f8('0x2e')](_0x35635c['query']);_0x40f140[_0xd9f8('0x3f')]=_[_0xd9f8('0x2f')](_0x40f140[_0xd9f8('0x2d')],_0x40f140[_0xd9f8('0x29')]);_0x29bf0a[_0xd9f8('0x30')]=_[_0xd9f8('0x2f')](_0x40f140[_0xd9f8('0x2d')],qs[_0xd9f8('0x40')](_0x35635c[_0xd9f8('0x29')][_0xd9f8('0x40')]));_0x29bf0a[_0xd9f8('0x30')]=_0x29bf0a[_0xd9f8('0x30')][_0xd9f8('0x31')]?_0x29bf0a[_0xd9f8('0x30')]:_0x40f140[_0xd9f8('0x2d')];if(!_0x35635c[_0xd9f8('0x29')]['hasOwnProperty'](_0xd9f8('0x41'))){_0x29bf0a[_0xd9f8('0x42')]=qs['limit'](_0x35635c['query']['limit']);_0x29bf0a[_0xd9f8('0x15')]=qs['offset'](_0x35635c[_0xd9f8('0x29')][_0xd9f8('0x15')]);}_0x29bf0a[_0xd9f8('0x43')]=qs[_0xd9f8('0x44')](_0x35635c[_0xd9f8('0x29')]['sort']);_0x29bf0a[_0xd9f8('0x45')]=qs[_0xd9f8('0x3f')](_['pick'](_0x35635c[_0xd9f8('0x29')],_0x40f140[_0xd9f8('0x3f')]));_0x29bf0a['where'][_0xd9f8('0x46')]=_0x476555['id'];if(_0x35635c['query'][_0xd9f8('0x47')]){_0x29bf0a['where']=_[_0xd9f8('0x34')](_0x29bf0a['where'],{'$or':_[_0xd9f8('0x22')](_0x29bf0a[_0xd9f8('0x30')],function(_0x312012){var _0x364d73={};_0x364d73[_0x312012]={'$like':'%'+_0x35635c[_0xd9f8('0x29')][_0xd9f8('0x47')]+'%'};return _0x364d73;})});}if(_0x35635c[_0xd9f8('0x29')]['$gte']){var _0x5b722c=_0x35635c[_0xd9f8('0x29')]['$gte'][_0xd9f8('0x48')](',');var _0x29490b={};_0x29490b[_0x5b722c[0x0]]={'$gte':moment(_0x5b722c[0x1])[_0xd9f8('0x49')](_0xd9f8('0x4a'))};_0x29bf0a[_0xd9f8('0x45')]=_[_0xd9f8('0x34')](_0x29bf0a[_0xd9f8('0x45')],_0x29490b);}_0x29bf0a=_[_0xd9f8('0x34')]({},_0x29bf0a,_0x35635c[_0xd9f8('0x4b')]);return db['FaxMessage'][_0xd9f8('0x17')]({'where':_0x29bf0a[_0xd9f8('0x45')]})[_0xd9f8('0x1b')](function(_0xad4b01){_0x193fb6['count']=_0xad4b01;if(_0x35635c[_0xd9f8('0x29')][_0xd9f8('0x32')]){_0x29bf0a['include']=[{'all':!![]}];}return db[_0xd9f8('0x3b')][_0xd9f8('0x28')](_0x29bf0a);})[_0xd9f8('0x1b')](function(_0x289c49){_0x193fb6['rows']=_0x289c49;return _0x193fb6;});}})[_0xd9f8('0x1b')](respondWithFilteredResult(_0x339b24,_0x29bf0a))['catch'](handleError(_0x339b24,null));};exports['addTags']=function(_0x52e219,_0x424a0b){return db['FaxInteraction'][_0xd9f8('0x35')]({'where':{'id':_0x52e219['params']['id']}})[_0xd9f8('0x1b')](handleEntityNotFound(_0x424a0b,null))[_0xd9f8('0x1b')](function(_0x5e5a1a){if(_0x5e5a1a){return _0x5e5a1a[_0xd9f8('0x4c')](_0x52e219[_0xd9f8('0x37')]['ids'],_[_0xd9f8('0x4d')](_0x52e219[_0xd9f8('0x37')],[_0xd9f8('0x3c'),'id'])||{})[_0xd9f8('0x4e')](function(){return db[_0xd9f8('0x4f')][_0xd9f8('0x28')]({'attributes':['id',_0xd9f8('0x20'),_0xd9f8('0x50')],'where':{'id':_0x52e219[_0xd9f8('0x37')][_0xd9f8('0x3c')]}});})['then'](function(_0x1b6bfc){socket[_0xd9f8('0x51')](_0xd9f8('0x52'),{'id':Number(_0x52e219[_0xd9f8('0x2c')]['id']),'tags':_0x1b6bfc||[]});return{'id':Number(_0x52e219[_0xd9f8('0x2c')]['id']),'tags':_0x1b6bfc||[]};});}})[_0xd9f8('0x1b')](respondWithResult(_0x424a0b,null))[_0xd9f8('0x2b')](handleError(_0x424a0b,null));};exports[_0xd9f8('0x53')]=function(_0x2d60bd,_0x4c5a47){return db['FaxInteraction'][_0xd9f8('0x35')]({'where':{'id':_0x2d60bd[_0xd9f8('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4c5a47,null))[_0xd9f8('0x1b')](function(_0xf83c89){if(_0xf83c89){return _0xf83c89['removeTags'](_0x2d60bd[_0xd9f8('0x29')][_0xd9f8('0x3c')]);}})[_0xd9f8('0x1b')](respondWithStatusCode(_0x4c5a47,null))[_0xd9f8('0x2b')](handleError(_0x4c5a47,null));};exports[_0xd9f8('0x54')]=function(_0x1466cc,_0x1bc82f){var _0x13362a=moment()[_0xd9f8('0x55')]()[_0xd9f8('0x56')]();var _0x202a99=path['join'](config[_0xd9f8('0x57')],_0xd9f8('0x58'),_0xd9f8('0x59'),_0xd9f8('0x5a'));var _0x344ad9=path[_0xd9f8('0x5b')](config[_0xd9f8('0x57')],_0xd9f8('0x58'),_0xd9f8('0x59'),_0xd9f8('0x5c'));var _0x5c271c=path[_0xd9f8('0x5b')](_0x202a99,_0x13362a);var _0x5e1558=util[_0xd9f8('0x49')](_0xd9f8('0x5d'),_0x1466cc[_0xd9f8('0x2c')]['id'],_0x13362a);var _0x108634=path[_0xd9f8('0x5b')](_0x202a99,_0x5e1558);var _0x37c947=[];_0x37c947[_0xd9f8('0x5e')]({'model':db['Attachment'],'as':_0xd9f8('0x5f'),'raw':!![]});var _0x3764c1=[{'model':db[_0xd9f8('0x3b')],'as':_0xd9f8('0x60'),'attributes':['id',_0xd9f8('0x37'),_0xd9f8('0x61')],'include':_0x37c947}];return db[_0xd9f8('0x23')]['find']({'where':{'id':_0x1466cc[_0xd9f8('0x2c')]['id']},'include':_0x3764c1})['then'](handleEntityNotFound(_0x1bc82f,null))[_0xd9f8('0x1b')](function(_0xdb0da){if(_0xdb0da&&_0xdb0da[_0xd9f8('0x60')]){var _0x401151=_0xdb0da[_0xd9f8('0x62')]({'plain':!![]});fs['mkdirSync'](_0x5c271c);for(var _0x48b7b4=0x0;_0x48b7b4<_0x401151[_0xd9f8('0x60')][_0xd9f8('0x31')];_0x48b7b4++){var _0x20cfd6=_0x401151[_0xd9f8('0x60')][_0x48b7b4]['Attachment'];if(_0x20cfd6){var _0x580a5f=path['join'](_0x344ad9,_0x20cfd6[_0xd9f8('0x63')]);if(fs[_0xd9f8('0x64')](_0x580a5f)){fs[_0xd9f8('0x65')](_0x580a5f)[_0xd9f8('0x66')](fs[_0xd9f8('0x67')](path['join'](_0x5c271c,_0x20cfd6[_0xd9f8('0x63')])));}}}return BPromise['resolve']()[_0xd9f8('0x1b')](function(){return new BPromise(function(_0x843e2b,_0xdff684){zipdir(_0x5c271c,{'saveTo':_0x108634},function(_0x34857a,_0x7c4ec){if(_0x34857a)return _0xdff684(_0x34857a);return _0x843e2b(_0x7c4ec);});})[_0xd9f8('0x1b')](function(){return new BPromise(function(_0x334f3d,_0x23aef2){rimraf(_0x5c271c,function(_0x2a2941){if(_0x2a2941)_0x23aef2(_0x2a2941);return _0x334f3d();});});})['then'](function(){return _0x1bc82f[_0xd9f8('0x54')](_0x108634,_0x5e1558,function(_0x4093e6){if(_0x4093e6){console['log']('err',_0x4093e6);}else{fs[_0xd9f8('0x68')](_0x108634);}});});});}else{return _0x1bc82f['sendStatus'](0xc8);}})[_0xd9f8('0x2b')](handleError(_0x1bc82f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 661b94e..b893fe4 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 _0x7b7e=['exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0x7b7e,0x190));var _0xe7b7=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x7b7e[_0x648163];return _0x199d4d;};'use strict';var EventEmitter=require(_0xe7b7('0x0'));var FaxInteraction=require(_0xe7b7('0x1'))['db'][_0xe7b7('0x2')];var FaxMessage=require(_0xe7b7('0x1'))['db'][_0xe7b7('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe7b7('0x4')](0x0);var events={'afterCreate':_0xe7b7('0x5'),'afterUpdate':_0xe7b7('0x6'),'afterDestroy':_0xe7b7('0x7')};function emitEvent(_0x4719ed){return function(_0x1750c7,_0x5c7dea,_0x105a47){_0x1750c7[_0xe7b7('0x8')]({'attributes':['id'],'raw':!![]})[_0xe7b7('0x9')](function(_0x5b2e21){_0x1750c7[_0xe7b7('0xa')](_0xe7b7('0xb'),_0x5b2e21[_0xe7b7('0xc')](function(_0x12e568){return{'id':_0x12e568['id']};}));return FaxMessage[_0xe7b7('0xd')]({'where':{'FaxInteractionId':_0x1750c7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe7b7('0x9')](function(_0x552480){_0x1750c7['setDataValue'](_0xe7b7('0xe'),_0x552480[_0xe7b7('0xf')]);FaxInteractionEvents[_0xe7b7('0x10')](_0x4719ed+':'+_0x1750c7['id'],_0x1750c7);FaxInteractionEvents[_0xe7b7('0x10')](_0x4719ed,_0x1750c7);_0x105a47(null);})[_0xe7b7('0x11')](_0x105a47(null));};}for(var e in events){if(events[_0xe7b7('0x12')](e)){var event=events[e];FaxInteraction[_0xe7b7('0x13')](e,emitEvent(event));}}module[_0xe7b7('0x14')]=FaxInteractionEvents; \ No newline at end of file +var _0x6a6a=['exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x2f167e,_0x38473d){var _0x30ba5f=function(_0x348744){while(--_0x348744){_0x2f167e['push'](_0x2f167e['shift']());}};_0x30ba5f(++_0x38473d);}(_0x6a6a,0x73));var _0xa6a6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6a6a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xa6a6('0x0'));var FaxInteraction=require(_0xa6a6('0x1'))['db'][_0xa6a6('0x2')];var FaxMessage=require(_0xa6a6('0x1'))['db'][_0xa6a6('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xa6a6('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6a6('0x5'),'afterDestroy':_0xa6a6('0x6')};function emitEvent(_0x25f616){return function(_0x566d38,_0x1618e3,_0x4fe90c){_0x566d38[_0xa6a6('0x7')]({'attributes':['id'],'raw':!![]})[_0xa6a6('0x8')](function(_0x7bf6d2){_0x566d38['setDataValue'](_0xa6a6('0x9'),_0x7bf6d2['map'](function(_0x430b0d){return{'id':_0x430b0d['id']};}));return FaxMessage[_0xa6a6('0xa')]({'where':{'FaxInteractionId':_0x566d38['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa6a6('0x8')](function(_0x558d4e){_0x566d38[_0xa6a6('0xb')](_0xa6a6('0xc'),_0x558d4e[_0xa6a6('0xd')]);FaxInteractionEvents[_0xa6a6('0xe')](_0x25f616+':'+_0x566d38['id'],_0x566d38);FaxInteractionEvents['emit'](_0x25f616,_0x566d38);_0x4fe90c(null);})[_0xa6a6('0xf')](_0x4fe90c(null));};}for(var e in events){if(events[_0xa6a6('0x10')](e)){var event=events[e];FaxInteraction[_0xa6a6('0x11')](e,emitEvent(event));}}module[_0xa6a6('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 0fcde82..723dc53 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 _0x14d8=['bluebird','path','exports','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x19a08b,_0x15b96e){var _0x17b856=function(_0x2c1199){while(--_0x2c1199){_0x19a08b['push'](_0x19a08b['shift']());}};_0x17b856(++_0x15b96e);}(_0x14d8,0x87));var _0x814d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x14d8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var logger=require(_0x814d('0x2'))(_0x814d('0x3'));var moment=require(_0x814d('0x4'));var BPromise=require(_0x814d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x814d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0x814d('0x7')]=function(_0x1ce727,_0x105932){return _0x1ce727['define'](_0x814d('0x8'),attributes,{'tableName':_0x814d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ac802,_0xa745c8,_0x3c176e){if(_0x2ac802[_0x814d('0xa')](_0x814d('0xb'))){_0x2ac802['closedAt']=moment()[_0x814d('0xc')](_0x814d('0xd'));}_0x3c176e(null,_0x2ac802);}}});}; \ No newline at end of file +var _0xae9b=['rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise'];(function(_0x2c87dc,_0x139292){var _0x2b78ec=function(_0x1bb48a){while(--_0x1bb48a){_0x2c87dc['push'](_0x2c87dc['shift']());}};_0x2b78ec(++_0x139292);}(_0xae9b,0x17b));var _0xbae9=function(_0x3b1350,_0x32b880){_0x3b1350=_0x3b1350-0x0;var _0x33d4ec=_0xae9b[_0x3b1350];return _0x33d4ec;};'use strict';var _=require(_0xbae9('0x0'));var util=require(_0xbae9('0x1'));var logger=require('../../config/logger')(_0xbae9('0x2'));var moment=require('moment');var BPromise=require(_0xbae9('0x3'));var rp=require(_0xbae9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbae9('0x5'));var config=require(_0xbae9('0x6'));var attributes=require(_0xbae9('0x7'));module[_0xbae9('0x8')]=function(_0x50777a,_0x20a167){return _0x50777a['define'](_0xbae9('0x9'),attributes,{'tableName':_0xbae9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x472d5f,_0x238270,_0x3390b7){if(_0x472d5f[_0xbae9('0xb')](_0xbae9('0xc'))){_0x472d5f[_0xbae9('0xd')]=moment()[_0xbae9('0xe')](_0xbae9('0xf'));}_0x3390b7(null,_0x472d5f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index a84575c..9a9cb80 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 _0x3785=['stringify','error','code','message','request\x20sent','result','catch','UpdateFaxInteraction','FaxInteraction','options','where','attributes','limit','debug','AddTagsToFaxInteraction','find','addTags','body','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3785,0xbd));var _0x5378=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x3785[_0x2d61b2];return _0x12df89;};'use strict';var _=require(_0x5378('0x0'));var util=require('util');var moment=require(_0x5378('0x1'));var BPromise=require(_0x5378('0x2'));var rs=require(_0x5378('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5378('0x4'))['db'];var utils=require(_0x5378('0x5'));var logger=require(_0x5378('0x6'))(_0x5378('0x7'));var config=require(_0x5378('0x8'));var jayson=require(_0x5378('0x9'));var client=jayson[_0x5378('0xa')][_0x5378('0xb')]({'port':0x232a});config[_0x5378('0xc')]=_[_0x5378('0xd')](config[_0x5378('0xc')],{'host':_0x5378('0xe'),'port':0x18eb});var socket=require(_0x5378('0xf'))(new Redis(config['redis']));require(_0x5378('0x10'))[_0x5378('0x11')](socket);function respondWithRpcPromise(_0x38c6a2,_0x23513a,_0x376fcb){return new BPromise(function(_0x329330,_0x27c6d9){return client['request'](_0x38c6a2,_0x376fcb)[_0x5378('0x12')](function(_0x49c0aa){logger[_0x5378('0x13')](_0x5378('0x14'),_0x23513a,'request\x20sent');logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x23513a,'request\x20sent',JSON[_0x5378('0x15')](_0x49c0aa));if(_0x49c0aa[_0x5378('0x16')]){if(_0x49c0aa[_0x5378('0x16')][_0x5378('0x17')]===0x1f4){logger[_0x5378('0x16')](_0x5378('0x14'),_0x23513a,_0x49c0aa['error'][_0x5378('0x18')]);return _0x27c6d9(_0x49c0aa[_0x5378('0x16')][_0x5378('0x18')]);}logger[_0x5378('0x16')](_0x5378('0x14'),_0x23513a,_0x49c0aa['error'][_0x5378('0x18')]);return _0x329330(_0x49c0aa[_0x5378('0x16')]['message']);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x23513a,_0x5378('0x19'));_0x329330(_0x49c0aa[_0x5378('0x1a')][_0x5378('0x18')]);}})[_0x5378('0x1b')](function(_0x1bddff){logger[_0x5378('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x23513a,_0x1bddff);_0x27c6d9(_0x1bddff);});});}exports[_0x5378('0x1c')]=function(_0x1c734d){var _0x4b5a97=this;return new Promise(function(_0x2fb3b8,_0x5530c1){return db[_0x5378('0x1d')]['update'](_0x1c734d['body'],{'raw':_0x1c734d[_0x5378('0x1e')]?_0x1c734d[_0x5378('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c734d[_0x5378('0x1e')]?_0x1c734d[_0x5378('0x1e')][_0x5378('0x1f')]||null:null,'attributes':_0x1c734d[_0x5378('0x1e')]?_0x1c734d[_0x5378('0x1e')][_0x5378('0x20')]||null:null,'limit':_0x1c734d[_0x5378('0x1e')]?_0x1c734d[_0x5378('0x1e')][_0x5378('0x21')]||null:null})['then'](function(_0x3898fb){logger[_0x5378('0x13')](_0x5378('0x1c'),_0x1c734d);logger[_0x5378('0x22')](_0x5378('0x1c'),_0x1c734d,JSON[_0x5378('0x15')](_0x3898fb));_0x2fb3b8(_0x3898fb);})[_0x5378('0x1b')](function(_0x87a587){logger[_0x5378('0x16')](_0x5378('0x1c'),_0x87a587[_0x5378('0x18')],_0x1c734d);_0x5530c1(_0x4b5a97[_0x5378('0x16')](0x1f4,_0x87a587['message']));});});};exports[_0x5378('0x23')]=function(_0x503113){return new Promise(function(_0x1e4b36,_0x1af175){return db[_0x5378('0x1d')][_0x5378('0x24')]({'where':_0x503113['options']?_0x503113[_0x5378('0x1e')][_0x5378('0x1f')]||null:null})[_0x5378('0x12')](function(_0x5ab318){if(_0x5ab318){return _0x5ab318[_0x5378('0x25')](_0x503113[_0x5378('0x26')][_0x5378('0x27')],_['omit'](_0x503113[_0x5378('0x26')],[_0x5378('0x27'),'id'])||{});}})[_0x5378('0x28')](function(_0x3bc0d7){logger['info']('AddTags',_0x503113);logger[_0x5378('0x22')](_0x5378('0x29'),_0x503113,JSON[_0x5378('0x15')](_0x3bc0d7));_0x1e4b36(_0x3bc0d7);})['catch'](function(_0x255e9a){logger[_0x5378('0x16')]('AddTags',_0x255e9a['message'],_0x503113);_0x1af175(_this[_0x5378('0x16')](0x1f4,_0x255e9a['message']));});});}; \ No newline at end of file +var _0xa4a1=['UpdateFaxInteraction','update','body','options','raw','where','attributes','limit','debug','stringify','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x17df94,_0x6f7037){var _0x2ecd50=function(_0x336147){while(--_0x336147){_0x17df94['push'](_0x17df94['shift']());}};_0x2ecd50(++_0x6f7037);}(_0xa4a1,0x161));var _0x1a4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4a1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1a4a('0x0'));var util=require(_0x1a4a('0x1'));var moment=require('moment');var BPromise=require(_0x1a4a('0x2'));var rs=require(_0x1a4a('0x3'));var fs=require('fs');var Redis=require(_0x1a4a('0x4'));var db=require(_0x1a4a('0x5'))['db'];var utils=require(_0x1a4a('0x6'));var logger=require('../../config/logger')(_0x1a4a('0x7'));var config=require(_0x1a4a('0x8'));var jayson=require(_0x1a4a('0x9'));var client=jayson['client'][_0x1a4a('0xa')]({'port':0x232a});config[_0x1a4a('0xb')]=_[_0x1a4a('0xc')](config[_0x1a4a('0xb')],{'host':_0x1a4a('0xd'),'port':0x18eb});var socket=require(_0x1a4a('0xe'))(new Redis(config[_0x1a4a('0xb')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x49329b,_0x8203dc,_0x4d4794){return new BPromise(function(_0x34b862,_0x14b0f2){return client[_0x1a4a('0xf')](_0x49329b,_0x4d4794)[_0x1a4a('0x10')](function(_0x149a17){logger[_0x1a4a('0x11')](_0x1a4a('0x12'),_0x8203dc,_0x1a4a('0x13'));logger['debug'](_0x1a4a('0x14'),_0x8203dc,_0x1a4a('0x13'),JSON['stringify'](_0x149a17));if(_0x149a17[_0x1a4a('0x15')]){if(_0x149a17['error']['code']===0x1f4){logger[_0x1a4a('0x15')](_0x1a4a('0x12'),_0x8203dc,_0x149a17[_0x1a4a('0x15')][_0x1a4a('0x16')]);return _0x14b0f2(_0x149a17[_0x1a4a('0x15')]['message']);}logger['error'](_0x1a4a('0x12'),_0x8203dc,_0x149a17[_0x1a4a('0x15')][_0x1a4a('0x16')]);return _0x34b862(_0x149a17[_0x1a4a('0x15')]['message']);}else{logger[_0x1a4a('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x8203dc,_0x1a4a('0x13'));_0x34b862(_0x149a17[_0x1a4a('0x17')][_0x1a4a('0x16')]);}})[_0x1a4a('0x18')](function(_0x4d3c61){logger['error'](_0x1a4a('0x12'),_0x8203dc,_0x4d3c61);_0x14b0f2(_0x4d3c61);});});}exports[_0x1a4a('0x19')]=function(_0x454acb){var _0x1489d9=this;return new Promise(function(_0x2c1c5d,_0x193a50){return db['FaxInteraction'][_0x1a4a('0x1a')](_0x454acb[_0x1a4a('0x1b')],{'raw':_0x454acb['options']?_0x454acb[_0x1a4a('0x1c')][_0x1a4a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x454acb[_0x1a4a('0x1c')]?_0x454acb[_0x1a4a('0x1c')][_0x1a4a('0x1e')]||null:null,'attributes':_0x454acb[_0x1a4a('0x1c')]?_0x454acb[_0x1a4a('0x1c')][_0x1a4a('0x1f')]||null:null,'limit':_0x454acb['options']?_0x454acb[_0x1a4a('0x1c')][_0x1a4a('0x20')]||null:null})[_0x1a4a('0x10')](function(_0xd25060){logger[_0x1a4a('0x11')](_0x1a4a('0x19'),_0x454acb);logger[_0x1a4a('0x21')](_0x1a4a('0x19'),_0x454acb,JSON[_0x1a4a('0x22')](_0xd25060));_0x2c1c5d(_0xd25060);})['catch'](function(_0x41418a){logger[_0x1a4a('0x15')]('UpdateFaxInteraction',_0x41418a['message'],_0x454acb);_0x193a50(_0x1489d9[_0x1a4a('0x15')](0x1f4,_0x41418a[_0x1a4a('0x16')]));});});};exports[_0x1a4a('0x23')]=function(_0x2b6f88){return new Promise(function(_0x446f41,_0x52f240){return db[_0x1a4a('0x24')]['find']({'where':_0x2b6f88[_0x1a4a('0x1c')]?_0x2b6f88[_0x1a4a('0x1c')][_0x1a4a('0x1e')]||null:null})[_0x1a4a('0x10')](function(_0x5ebcff){if(_0x5ebcff){return _0x5ebcff[_0x1a4a('0x25')](_0x2b6f88[_0x1a4a('0x1b')][_0x1a4a('0x26')],_[_0x1a4a('0x27')](_0x2b6f88[_0x1a4a('0x1b')],[_0x1a4a('0x26'),'id'])||{});}})[_0x1a4a('0x28')](function(_0x4badd6){logger[_0x1a4a('0x11')](_0x1a4a('0x29'),_0x2b6f88);logger[_0x1a4a('0x21')]('AddTags',_0x2b6f88,JSON['stringify'](_0x4badd6));_0x446f41(_0x4badd6);})[_0x1a4a('0x18')](function(_0x4ee3dd){logger[_0x1a4a('0x15')](_0x1a4a('0x29'),_0x4ee3dd[_0x1a4a('0x16')],_0x2b6f88);_0x52f240(_this[_0x1a4a('0x15')](0x1f4,_0x4ee3dd['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 8e61712..9793521 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 _0xdb47=['./faxInteraction.events','save','register','faxInteraction:'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0xdb47,0x94));var _0x7db4=function(_0x490074,_0x45d1d8){_0x490074=_0x490074-0x0;var _0x169b2f=_0xdb47[_0x490074];return _0x169b2f;};'use strict';var FaxInteractionEvents=require(_0x7db4('0x0'));var events=[_0x7db4('0x1'),'remove','update'];function createListener(_0x203b04,_0x1ef9f3){return function(_0x4cc33){_0x1ef9f3['emit'](_0x203b04,_0x4cc33);};}function removeListener(_0x352a8c,_0x449dc8){return function(){FaxInteractionEvents['removeListener'](_0x352a8c,_0x449dc8);};}exports[_0x7db4('0x2')]=function(_0x26f654){for(var _0x42983f=0x0,_0x49e851=events['length'];_0x42983f<_0x49e851;_0x42983f++){var _0x5a23d3=events[_0x42983f];var _0x567f12=createListener(_0x7db4('0x3')+_0x5a23d3,_0x26f654);FaxInteractionEvents['on'](_0x5a23d3,_0x567f12);}}; \ No newline at end of file +var _0x1189=['emit','register','length','faxInteraction:','./faxInteraction.events','save','update'];(function(_0x27a7d4,_0x36e783){var _0x386c54=function(_0x3fbd60){while(--_0x3fbd60){_0x27a7d4['push'](_0x27a7d4['shift']());}};_0x386c54(++_0x36e783);}(_0x1189,0x1cb));var _0x9118=function(_0x294f4d,_0x374007){_0x294f4d=_0x294f4d-0x0;var _0x21f1be=_0x1189[_0x294f4d];return _0x21f1be;};'use strict';var FaxInteractionEvents=require(_0x9118('0x0'));var events=[_0x9118('0x1'),'remove',_0x9118('0x2')];function createListener(_0x917e5,_0x3e4029){return function(_0x311faa){_0x3e4029[_0x9118('0x3')](_0x917e5,_0x311faa);};}function removeListener(_0x1c73d1,_0x252a74){return function(){FaxInteractionEvents['removeListener'](_0x1c73d1,_0x252a74);};}exports[_0x9118('0x4')]=function(_0x283302){for(var _0xb0c98b=0x0,_0x7aa21e=events[_0x9118('0x5')];_0xb0c98b<_0x7aa21e;_0xb0c98b++){var _0x517478=events[_0xb0c98b];var _0x5289ee=createListener(_0x9118('0x6')+_0x517478,_0x283302);FaxInteractionEvents['on'](_0x517478,_0x5289ee);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 33f3fe6..65fdfc1 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 _0x52b4=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','show','getMessages','post','/:id/messages','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','/:id','destroy','removeTags','exports','multer','util','path'];(function(_0x34f7bb,_0x547eb3){var _0x2efee3=function(_0x1fc766){while(--_0x1fc766){_0x34f7bb['push'](_0x34f7bb['shift']());}};_0x2efee3(++_0x547eb3);}(_0x52b4,0xdd));var _0x452b=function(_0x323cae,_0x50929d){_0x323cae=_0x323cae-0x0;var _0x40c4c1=_0x52b4[_0x323cae];return _0x40c4c1;};'use strict';var multer=require(_0x452b('0x0'));var util=require(_0x452b('0x1'));var path=require(_0x452b('0x2'));var timeout=require(_0x452b('0x3'));var express=require(_0x452b('0x4'));var router=express[_0x452b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x452b('0x6'));var config=require(_0x452b('0x7'));var controller=require(_0x452b('0x8'));router[_0x452b('0x9')]('/',auth[_0x452b('0xa')](),controller['index']);router[_0x452b('0x9')]('/describe',auth[_0x452b('0xa')](),controller[_0x452b('0xb')]);router[_0x452b('0x9')]('/:id',auth[_0x452b('0xa')](),controller[_0x452b('0xc')]);router[_0x452b('0x9')]('/:id/messages',auth[_0x452b('0xa')](),controller[_0x452b('0xd')]);router['get']('/:id/download',auth[_0x452b('0xa')](),controller['download']);router['post']('/',auth[_0x452b('0xa')](),controller['create']);router[_0x452b('0xe')](_0x452b('0xf'),auth[_0x452b('0xa')](),controller['addMessage']);router[_0x452b('0xe')](_0x452b('0x10'),auth[_0x452b('0xa')](),interaction[_0x452b('0x11')](_0x452b('0x12'),_0x452b('0x13')),controller[_0x452b('0x14')]);router[_0x452b('0x15')]('/:id',auth[_0x452b('0xa')](),interaction['tracked']('fax',_0x452b('0x16')),controller['update']);router[_0x452b('0x17')](_0x452b('0x18'),auth[_0x452b('0xa')](),interaction['tracked'](_0x452b('0x12'),'faxinteraction:destroy'),controller[_0x452b('0x19')]);router[_0x452b('0x17')]('/:id/tags',auth['isAuthenticated'](),controller[_0x452b('0x1a')]);module[_0x452b('0x1b')]=router; \ No newline at end of file +var _0xed92=['getMessages','download','post','/:id/messages','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x4a2d3b,_0x4f5237){var _0x2d79d4=function(_0x564426){while(--_0x564426){_0x4a2d3b['push'](_0x4a2d3b['shift']());}};_0x2d79d4(++_0x4f5237);}(_0xed92,0x166));var _0x2ed9=function(_0x3fb053,_0x3179ae){_0x3fb053=_0x3fb053-0x0;var _0x4e06e1=_0xed92[_0x3fb053];return _0x4e06e1;};'use strict';var multer=require('multer');var util=require(_0x2ed9('0x0'));var path=require(_0x2ed9('0x1'));var timeout=require(_0x2ed9('0x2'));var express=require(_0x2ed9('0x3'));var router=express[_0x2ed9('0x4')]();var fs_extra=require(_0x2ed9('0x5'));var auth=require(_0x2ed9('0x6'));var interaction=require(_0x2ed9('0x7'));var config=require(_0x2ed9('0x8'));var controller=require(_0x2ed9('0x9'));router[_0x2ed9('0xa')]('/',auth[_0x2ed9('0xb')](),controller['index']);router[_0x2ed9('0xa')](_0x2ed9('0xc'),auth[_0x2ed9('0xb')](),controller[_0x2ed9('0xd')]);router[_0x2ed9('0xa')](_0x2ed9('0xe'),auth[_0x2ed9('0xb')](),controller[_0x2ed9('0xf')]);router['get']('/:id/messages',auth[_0x2ed9('0xb')](),controller[_0x2ed9('0x10')]);router[_0x2ed9('0xa')]('/:id/download',auth[_0x2ed9('0xb')](),controller[_0x2ed9('0x11')]);router[_0x2ed9('0x12')]('/',auth[_0x2ed9('0xb')](),controller['create']);router[_0x2ed9('0x12')](_0x2ed9('0x13'),auth[_0x2ed9('0xb')](),controller[_0x2ed9('0x14')]);router['post'](_0x2ed9('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x2ed9('0x16'),_0x2ed9('0x17')),controller[_0x2ed9('0x18')]);router[_0x2ed9('0x19')](_0x2ed9('0xe'),auth[_0x2ed9('0xb')](),interaction[_0x2ed9('0x1a')]('fax',_0x2ed9('0x1b')),controller[_0x2ed9('0x1c')]);router[_0x2ed9('0x1d')]('/:id',auth[_0x2ed9('0xb')](),interaction[_0x2ed9('0x1a')](_0x2ed9('0x16'),_0x2ed9('0x1e')),controller[_0x2ed9('0x1f')]);router[_0x2ed9('0x1d')](_0x2ed9('0x15'),auth[_0x2ed9('0xb')](),controller[_0x2ed9('0x20')]);module[_0x2ed9('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 115dd65..1694623 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 _0x5ff3=['TEXT','exports','medium','ENUM','out'];(function(_0x4c2395,_0x4d3378){var _0x1ea522=function(_0x596366){while(--_0x596366){_0x4c2395['push'](_0x4c2395['shift']());}};_0x1ea522(++_0x4d3378);}(_0x5ff3,0x17d));var _0x35ff=function(_0x3768d8,_0xd04d27){_0x3768d8=_0x3768d8-0x0;var _0x332800=_0x5ff3[_0x3768d8];return _0x332800;};'use strict';var Sequelize=require('sequelize');module[_0x35ff('0x0')]={'body':{'type':Sequelize['TEXT'](_0x35ff('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x35ff('0x2')]('in',_0x35ff('0x3')),'defaultValue':_0x35ff('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x35ff('0x4')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x2750=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x51da75,_0x17ddec){var _0x40b076=function(_0x4de974){while(--_0x4de974){_0x51da75['push'](_0x51da75['shift']());}};_0x40b076(++_0x17ddec);}(_0x2750,0x13b));var _0x0275=function(_0x425de6,_0x4a46b0){_0x425de6=_0x425de6-0x0;var _0x193091=_0x2750[_0x425de6];return _0x193091;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'body':{'type':Sequelize[_0x0275('0x1')](_0x0275('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0275('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0275('0x4')]('in',_0x0275('0x5')),'defaultValue':_0x0275('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0275('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x0275('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 483798f..d839361 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 _0x3abf=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','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','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','FaxMessage','catch','show','params','fields','includeAll','include','options','find','body','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','interface','motionChannel','channel','event','EventManager','acceptmessage','reject','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SIP/%s','rejectmessage','create','CmContact','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','root','attachments','join','basename','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra'];(function(_0x499be0,_0xfb24d1){var _0x10fd53=function(_0x3e7cfa){while(--_0x3e7cfa){_0x499be0['push'](_0x499be0['shift']());}};_0x10fd53(++_0xfb24d1);}(_0x3abf,0x110));var _0xf3ab=function(_0x465aac,_0x25f884){_0x465aac=_0x465aac-0x0;var _0xbaa3c9=_0x3abf[_0x465aac];return _0xbaa3c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf3ab('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf3ab('0x1'));var rp=require('request-promise');var moment=require(_0xf3ab('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf3ab('0x3'));var util=require(_0xf3ab('0x4'));var path=require('path');var sox=require(_0xf3ab('0x5'));var csv=require('to-csv');var ejs=require(_0xf3ab('0x6'));var fs=require('fs');var fs_extra=require(_0xf3ab('0x7'));var _=require('lodash');var squel=require(_0xf3ab('0x8'));var crypto=require(_0xf3ab('0x9'));var jsforce=require(_0xf3ab('0xa'));var deskjs=require(_0xf3ab('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf3ab('0xc'));var Papa=require('papaparse');var Redis=require(_0xf3ab('0xd'));var authService=require(_0xf3ab('0xe'));var qs=require(_0xf3ab('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3ab('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xf3ab('0x11'));var licenseUtil=require(_0xf3ab('0x12'));var db=require(_0xf3ab('0x13'))['db'];config[_0xf3ab('0x14')]=_['defaults'](config[_0xf3ab('0x14')],{'host':_0xf3ab('0x15'),'port':0x18eb});var socket=require(_0xf3ab('0x16'))(new Redis(config[_0xf3ab('0x14')]));require(_0xf3ab('0x17'))[_0xf3ab('0x18')](socket);var jayson=require(_0xf3ab('0x19'));var client=jayson[_0xf3ab('0x1a')][_0xf3ab('0x1b')]({'port':0x232c});var client9002=jayson[_0xf3ab('0x1a')][_0xf3ab('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x17c8a9,_0x5707c6,_0x111fed,_0x1e4df2){return new BPromise(function(_0x6f238,_0x3b2de7){var _0x2035c4=_0x1e4df2||client;return _0x2035c4[_0xf3ab('0x1c')](_0x17c8a9,_0x111fed)[_0xf3ab('0x1d')](function(_0x221363){logger[_0xf3ab('0x1e')](_0xf3ab('0x1f'),_0x5707c6,_0xf3ab('0x20'));logger[_0xf3ab('0x21')](_0xf3ab('0x22'),_0x5707c6,_0xf3ab('0x20'),JSON[_0xf3ab('0x23')](_0x221363));if(_0x221363[_0xf3ab('0x24')]){if(_0x221363[_0xf3ab('0x24')][_0xf3ab('0x25')]===0x1f4){logger[_0xf3ab('0x24')](_0xf3ab('0x1f'),_0x5707c6,_0x221363[_0xf3ab('0x24')][_0xf3ab('0x26')]);return _0x3b2de7(_0x221363[_0xf3ab('0x24')][_0xf3ab('0x26')]);}logger[_0xf3ab('0x24')](_0xf3ab('0x1f'),_0x5707c6,_0x221363[_0xf3ab('0x24')][_0xf3ab('0x26')]);return _0x6f238(_0x221363[_0xf3ab('0x24')][_0xf3ab('0x26')]);}else{logger[_0xf3ab('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x5707c6,_0xf3ab('0x20'));_0x6f238(_0x221363[_0xf3ab('0x27')]['message']);}})['catch'](function(_0x5ebb7e){logger['error']('FaxMessage,\x20%s,\x20%s',_0x5707c6,_0x5ebb7e);_0x3b2de7(_0x5ebb7e);});});}function respondWithStatusCode(_0xa8f3f4,_0x380d60){_0x380d60=_0x380d60||0xcc;return function(_0x565810){if(_0x565810){return _0xa8f3f4['sendStatus'](_0x380d60);}return _0xa8f3f4[_0xf3ab('0x28')](_0x380d60)['end']();};}function respondWithResult(_0x4c64f3,_0x1cdca5){_0x1cdca5=_0x1cdca5||0xc8;return function(_0x18a247){if(_0x18a247){return _0x4c64f3[_0xf3ab('0x28')](_0x1cdca5)[_0xf3ab('0x29')](_0x18a247);}};}function respondWithFilteredResult(_0xa17d89,_0x55b3fd){return function(_0x549cec){if(_0x549cec){var _0x5838ba=typeof _0x55b3fd[_0xf3ab('0x2a')]===_0xf3ab('0x2b')&&typeof _0x55b3fd[_0xf3ab('0x2c')]===_0xf3ab('0x2b');var _0x3bc552=_0x549cec['count'];var _0x13a1c9=_0x5838ba?0x0:_0x55b3fd['offset'];var _0x2a6a3f=_0x5838ba?_0x549cec[_0xf3ab('0x2d')]:_0x55b3fd[_0xf3ab('0x2a')]+_0x55b3fd[_0xf3ab('0x2c')];var _0x1e6e97;if(_0x2a6a3f>=_0x3bc552){_0x2a6a3f=_0x3bc552;_0x1e6e97=0xc8;}else{_0x1e6e97=0xce;}_0xa17d89[_0xf3ab('0x28')](_0x1e6e97);return _0xa17d89[_0xf3ab('0x2e')]('Content-Range',_0x13a1c9+'-'+_0x2a6a3f+'/'+_0x3bc552)['json'](_0x549cec);}return null;};}function patchUpdates(_0x3e9c25){return function(_0x1db265){try{jsonpatch[_0xf3ab('0x2f')](_0x1db265,_0x3e9c25,!![]);}catch(_0x3c08c4){return BPromise['reject'](_0x3c08c4);}return _0x1db265[_0xf3ab('0x30')]();};}function saveUpdates(_0xa37d17,_0x161697){return function(_0x59d830){if(_0x59d830){return _0x59d830[_0xf3ab('0x31')](_0xa37d17)['then'](function(_0x166022){return _0x166022;});}return null;};}function removeEntity(_0x2df60e,_0xb881c7){return function(_0x4d4ccb){if(_0x4d4ccb){return _0x4d4ccb[_0xf3ab('0x32')]()[_0xf3ab('0x1d')](function(){_0x2df60e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15efe1,_0x557685){return function(_0x2bb041){if(!_0x2bb041){_0x15efe1[_0xf3ab('0x33')](0x194);}return _0x2bb041;};}function handleError(_0xbdb2a1,_0x16b0bd){_0x16b0bd=_0x16b0bd||0x1f4;return function(_0x56b073){logger[_0xf3ab('0x24')](_0x56b073[_0xf3ab('0x34')]);if(_0x56b073[_0xf3ab('0x35')]){delete _0x56b073[_0xf3ab('0x35')];}_0xbdb2a1[_0xf3ab('0x28')](_0x16b0bd)[_0xf3ab('0x36')](_0x56b073);};}exports[_0xf3ab('0x37')]=function(_0x34b581,_0x342c67){var _0xf036d8={},_0xe3c6c6={},_0x23f042={'count':0x0,'rows':[]};var _0x4aad5d=_['map'](db['FaxMessage'][_0xf3ab('0x38')],function(_0x47dc85){return{'name':_0x47dc85[_0xf3ab('0x39')],'type':_0x47dc85[_0xf3ab('0x3a')]['key']};});_0xe3c6c6[_0xf3ab('0x3b')]=_['map'](_0x4aad5d,_0xf3ab('0x35'));_0xe3c6c6[_0xf3ab('0x3c')]=_[_0xf3ab('0x3d')](_0x34b581[_0xf3ab('0x3c')]);_0xe3c6c6[_0xf3ab('0x3e')]=_['intersection'](_0xe3c6c6[_0xf3ab('0x3b')],_0xe3c6c6['query']);_0xf036d8[_0xf3ab('0x3f')]=_[_0xf3ab('0x40')](_0xe3c6c6['model'],qs['fields'](_0x34b581[_0xf3ab('0x3c')]['fields']));_0xf036d8[_0xf3ab('0x3f')]=_0xf036d8['attributes'][_0xf3ab('0x41')]?_0xf036d8[_0xf3ab('0x3f')]:_0xe3c6c6[_0xf3ab('0x3b')];if(!_0x34b581[_0xf3ab('0x3c')][_0xf3ab('0x42')](_0xf3ab('0x43'))){_0xf036d8['limit']=qs[_0xf3ab('0x2c')](_0x34b581['query']['limit']);_0xf036d8['offset']=qs[_0xf3ab('0x2a')](_0x34b581[_0xf3ab('0x3c')]['offset']);}_0xf036d8[_0xf3ab('0x44')]=qs['sort'](_0x34b581['query'][_0xf3ab('0x45')]);_0xf036d8['where']=qs[_0xf3ab('0x3e')](_[_0xf3ab('0x46')](_0x34b581[_0xf3ab('0x3c')],_0xe3c6c6[_0xf3ab('0x3e')]),_0x4aad5d);if(_0x34b581[_0xf3ab('0x3c')][_0xf3ab('0x47')]){_0xf036d8[_0xf3ab('0x48')]=_[_0xf3ab('0x49')](_0xf036d8['where'],{'$or':_[_0xf3ab('0x4a')](_0x4aad5d,function(_0x146a72){if(_0x146a72[_0xf3ab('0x3a')]!=='VIRTUAL'){var _0x5dd279={};_0x5dd279[_0x146a72['name']]={'$like':'%'+_0x34b581[_0xf3ab('0x3c')][_0xf3ab('0x47')]+'%'};return _0x5dd279;}})});}_0xf036d8=_['merge']({},_0xf036d8,_0x34b581['options']);var _0x39a53c={'where':_0xf036d8[_0xf3ab('0x48')]};return db['FaxMessage']['count'](_0x39a53c)[_0xf3ab('0x1d')](function(_0x8747f3){_0x23f042[_0xf3ab('0x2d')]=_0x8747f3;if(_0x34b581['query']['includeAll']){_0xf036d8['include']=[{'all':!![]}];}return db[_0xf3ab('0x4b')]['findAll'](_0xf036d8);})[_0xf3ab('0x1d')](function(_0x2d6d49){_0x23f042['rows']=_0x2d6d49;return _0x23f042;})['then'](respondWithFilteredResult(_0x342c67,_0xf036d8))[_0xf3ab('0x4c')](handleError(_0x342c67,null));};exports[_0xf3ab('0x4d')]=function(_0x400123,_0x1e82f5){var _0x422d8f={'raw':!![],'where':{'id':_0x400123[_0xf3ab('0x4e')]['id']}},_0xfdf832={};_0xfdf832[_0xf3ab('0x3b')]=_[_0xf3ab('0x3d')](db['FaxMessage']['rawAttributes']);_0xfdf832['query']=_[_0xf3ab('0x3d')](_0x400123[_0xf3ab('0x3c')]);_0xfdf832[_0xf3ab('0x3e')]=_[_0xf3ab('0x40')](_0xfdf832[_0xf3ab('0x3b')],_0xfdf832[_0xf3ab('0x3c')]);_0x422d8f[_0xf3ab('0x3f')]=_[_0xf3ab('0x40')](_0xfdf832[_0xf3ab('0x3b')],qs[_0xf3ab('0x4f')](_0x400123[_0xf3ab('0x3c')][_0xf3ab('0x4f')]));_0x422d8f[_0xf3ab('0x3f')]=_0x422d8f[_0xf3ab('0x3f')][_0xf3ab('0x41')]?_0x422d8f['attributes']:_0xfdf832['model'];if(_0x400123[_0xf3ab('0x3c')][_0xf3ab('0x50')]){_0x422d8f[_0xf3ab('0x51')]=[{'all':!![]}];}_0x422d8f=_[_0xf3ab('0x49')]({},_0x422d8f,_0x400123[_0xf3ab('0x52')]);return db[_0xf3ab('0x4b')][_0xf3ab('0x53')](_0x422d8f)[_0xf3ab('0x1d')](handleEntityNotFound(_0x1e82f5,null))[_0xf3ab('0x1d')](respondWithResult(_0x1e82f5,null))[_0xf3ab('0x4c')](handleError(_0x1e82f5,null));};exports[_0xf3ab('0x31')]=function(_0x53d188,_0x4178e9){if(_0x53d188[_0xf3ab('0x54')]['id']){delete _0x53d188[_0xf3ab('0x54')]['id'];}return db[_0xf3ab('0x4b')][_0xf3ab('0x53')]({'where':{'id':_0x53d188[_0xf3ab('0x4e')]['id']}})[_0xf3ab('0x1d')](handleEntityNotFound(_0x4178e9,null))[_0xf3ab('0x1d')](saveUpdates(_0x53d188[_0xf3ab('0x54')],null))[_0xf3ab('0x1d')](respondWithResult(_0x4178e9,null))[_0xf3ab('0x4c')](handleError(_0x4178e9,null));};exports[_0xf3ab('0x32')]=function(_0x1ce6dc,_0x6b90df){return db['FaxMessage'][_0xf3ab('0x53')]({'where':{'id':_0x1ce6dc[_0xf3ab('0x4e')]['id']}})[_0xf3ab('0x1d')](handleEntityNotFound(_0x6b90df,null))[_0xf3ab('0x1d')](removeEntity(_0x6b90df,null))['catch'](handleError(_0x6b90df,null));};exports['describe']=function(_0x20dc7a,_0x3131cb){return db[_0xf3ab('0x4b')][_0xf3ab('0x55')]()[_0xf3ab('0x1d')](respondWithResult(_0x3131cb,null))[_0xf3ab('0x4c')](handleError(_0x3131cb,null));};var interaction_log=require('../../config/logger')(_0xf3ab('0x56'));exports[_0xf3ab('0x57')]=function(_0x576b6b,_0x3c1dab,_0x19c4fc){var _0x23899a={'agent':{},'channel':'fax'};if(_0x576b6b[_0xf3ab('0x54')]['id']){delete _0x576b6b[_0xf3ab('0x54')]['id'];}_0x576b6b[_0xf3ab('0x54')][_0xf3ab('0x58')]=!![];_0x576b6b['body'][_0xf3ab('0x59')]=moment()[_0xf3ab('0x5a')](_0xf3ab('0x5b'));_0x576b6b[_0xf3ab('0x54')][_0xf3ab('0x5c')]=_0x576b6b[_0xf3ab('0x54')][_0xf3ab('0x5c')]||_0x576b6b['user']['id'];_0x23899a['agent']['id']=_0x576b6b[_0xf3ab('0x54')]['UserId'];return db[_0xf3ab('0x4b')]['find']({'where':{'id':_0x576b6b['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c1dab,null))['then'](saveUpdates(_0x576b6b[_0xf3ab('0x54')],null))['then'](function(_0x21290c){if(_0x21290c){_0x23899a[_0xf3ab('0x26')]=_0x21290c[_0xf3ab('0x5d')]({'plain':!![]});return db[_0xf3ab('0x5e')][_0xf3ab('0x53')]({'where':{'id':_0x21290c[_0xf3ab('0x5f')]}});}return null;})[_0xf3ab('0x1d')](handleEntityNotFound(_0x3c1dab,null))['then'](function(_0x75a4b){if(_0x75a4b){return _0x75a4b['update']({'UserId':_0x576b6b[_0xf3ab('0x54')][_0xf3ab('0x5c')],'read1stAt':_[_0xf3ab('0x60')](_0x75a4b[_0xf3ab('0x61')])?moment()[_0xf3ab('0x5a')](_0xf3ab('0x5b')):undefined});}return null;})[_0xf3ab('0x1d')](function(_0xd71d85){if(_0xd71d85){_0x23899a['interaction']=_0xd71d85[_0xf3ab('0x5d')]({'plain':!![]});interaction_log[_0xf3ab('0x1e')](_0xf3ab('0x62'),_0x576b6b[_0xf3ab('0x63')]['id'],_0x576b6b[_0xf3ab('0x63')][_0xf3ab('0x35')],_0x576b6b[_0xf3ab('0x63')][_0xf3ab('0x64')],_0x23899a[_0xf3ab('0x65')]['id'],_0x576b6b['body']?JSON[_0xf3ab('0x23')](_0x576b6b['body']):_0xf3ab('0x66'));return respondWithRpcPromise(_0xf3ab('0x67'),_0xf3ab('0x68'),_0x23899a);}return null;})[_0xf3ab('0x1d')](function(_0x2c7e29){var _0x50cb63='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2c7e29[_0xf3ab('0x26')][_0xf3ab('0x69')];return db['sequelize'][_0xf3ab('0x3c')](_0x50cb63,{'type':db[_0xf3ab('0x6a')][_0xf3ab('0x6b')][_0xf3ab('0x6c')],'raw':!![]})['then'](function(_0x245c73){return _0x245c73;});})['then'](function(_0x51504a){if(_0x51504a){_0x23899a[_0xf3ab('0x26')][_0xf3ab('0x6d')]=_0x51504a[0x0];if(!_0x576b6b[_0xf3ab('0x54')]['UserId'])return;return db[_0xf3ab('0x6e')][_0xf3ab('0x53')]({'where':{'id':_0x576b6b[_0xf3ab('0x54')]['UserId'],'role':_0xf3ab('0x6f')},'attributes':['id',_0xf3ab('0x35'),_0xf3ab('0x70'),_0xf3ab('0x71'),'internal'],'raw':!![]});}return null;})[_0xf3ab('0x1d')](function(_0x284bd8){if(!_0x284bd8)return null;_0x23899a[_0xf3ab('0x26')]['agent']=_0x284bd8;return _0x23899a;})[_0xf3ab('0x1d')](function(_0x3ff60b){if(_0x3ff60b){if(_0x576b6b[_0xf3ab('0x54')]['manual']){_0x23899a[_0xf3ab('0x26')][_0xf3ab('0x72')]=util[_0xf3ab('0x5a')]('SIP/%s',_0x576b6b[_0xf3ab('0x63')][_0xf3ab('0x35')]);_0x23899a[_0xf3ab('0x26')]['channel']=_0x23899a['channel'];_0x23899a['message'][_0xf3ab('0x73')]=_0x23899a[_0xf3ab('0x74')];_0x23899a[_0xf3ab('0x26')][_0xf3ab('0x75')]=_0xf3ab('0x57');return respondWithRpcPromise('EventManager',_0xf3ab('0x76'),{'event':_0xf3ab('0x77'),'message':_0x23899a[_0xf3ab('0x26')]},client9002)['then'](function(){return _0x23899a;});}return _0x23899a;}return null;})['then'](respondWithResult(_0x3c1dab,null))[_0xf3ab('0x4c')](handleError(_0x3c1dab,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xf3ab('0x78')]=function(_0x52f4d2,_0x4e3c12,_0x21c74f){var _0x20ff97={'agent':{},'channel':_0xf3ab('0x79')};if(_0x52f4d2[_0xf3ab('0x54')]['id']){delete _0x52f4d2[_0xf3ab('0x54')]['id'];}_0x52f4d2[_0xf3ab('0x54')][_0xf3ab('0x5c')]=_0x52f4d2[_0xf3ab('0x54')][_0xf3ab('0x5c')]||_0x52f4d2['user']['id'];_0x20ff97[_0xf3ab('0x6f')]['id']=_0x52f4d2['body'][_0xf3ab('0x5c')];return db[_0xf3ab('0x4b')][_0xf3ab('0x53')]({'where':{'id':_0x52f4d2['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4e3c12,null))[_0xf3ab('0x1d')](function(_0x2d23f0){if(_0x2d23f0){_0x20ff97[_0xf3ab('0x26')]=_0x2d23f0['get']({'plain':!![]});return db[_0xf3ab('0x5e')][_0xf3ab('0x53')]({'where':{'id':_0x2d23f0[_0xf3ab('0x5f')]}});}return null;})[_0xf3ab('0x1d')](handleEntityNotFound(_0x4e3c12,null))['then'](function(_0x2d0d2d){if(_0x2d0d2d){_0x20ff97[_0xf3ab('0x65')]=_0x2d0d2d[_0xf3ab('0x5d')]({'plain':!![]});interaction_log[_0xf3ab('0x1e')](_0xf3ab('0x7a'),_0x52f4d2[_0xf3ab('0x63')]['id'],_0x52f4d2[_0xf3ab('0x63')][_0xf3ab('0x35')],_0x52f4d2[_0xf3ab('0x63')][_0xf3ab('0x64')],_0x20ff97[_0xf3ab('0x65')]['id'],_0x52f4d2[_0xf3ab('0x54')]?JSON[_0xf3ab('0x23')](_0x52f4d2[_0xf3ab('0x54')]):_0xf3ab('0x66'));return respondWithRpcPromise('RejectMessage',_0xf3ab('0x7b'),_0x20ff97);}return null;})['then'](function(_0x528b51){var _0x587dae=_0xf3ab('0x7c')+_0x528b51[_0xf3ab('0x26')][_0xf3ab('0x69')];return db[_0xf3ab('0x7d')][_0xf3ab('0x3c')](_0x587dae,{'type':db[_0xf3ab('0x6a')][_0xf3ab('0x6b')][_0xf3ab('0x6c')],'raw':!![]})[_0xf3ab('0x1d')](function(_0xe5c6df){return _0xe5c6df;});})[_0xf3ab('0x1d')](function(_0x2614e7){if(_0x2614e7){_0x20ff97[_0xf3ab('0x26')][_0xf3ab('0x6d')]=_0x2614e7[0x0];if(!_0x52f4d2[_0xf3ab('0x54')][_0xf3ab('0x5c')])return;return db[_0xf3ab('0x6e')][_0xf3ab('0x53')]({'where':{'id':_0x52f4d2[_0xf3ab('0x54')]['UserId'],'role':_0xf3ab('0x6f')},'attributes':['id','name','fullname',_0xf3ab('0x71'),'internal'],'raw':!![]});}return null;})[_0xf3ab('0x1d')](function(_0x4ae123){if(!_0x4ae123)return null;_0x20ff97['message'][_0xf3ab('0x6f')]=_0x4ae123;return _0x20ff97;})[_0xf3ab('0x1d')](function(_0xb36e0c){if(_0xb36e0c){_0xb36e0c['message']['interface']=util[_0xf3ab('0x5a')](_0xf3ab('0x7e'),_0x52f4d2[_0xf3ab('0x63')][_0xf3ab('0x35')]);_0xb36e0c[_0xf3ab('0x26')][_0xf3ab('0x74')]=_0x20ff97['channel'];_0xb36e0c['message']['motionChannel']=_0x20ff97[_0xf3ab('0x74')];_0xb36e0c[_0xf3ab('0x26')][_0xf3ab('0x75')]=_0xf3ab('0x78');respondWithRpcPromise('EventManager','EventManager',{'event':_0xf3ab('0x7f'),'message':_0xb36e0c[_0xf3ab('0x26')]},client9002);return _0x20ff97;}return null;})[_0xf3ab('0x1d')](respondWithResult(_0x4e3c12,null))[_0xf3ab('0x4c')](handleError(_0x4e3c12,null));};exports[_0xf3ab('0x80')]=function(_0x4207f1,_0x5a7a02){var _0x479000;return db[_0xf3ab('0x4b')][_0xf3ab('0x80')](_0x4207f1[_0xf3ab('0x54')],{})['then'](function(_0x39ccf){_0x479000=_0x39ccf;return db[_0xf3ab('0x81')]['findOne']({'where':{'id':_0x479000['ContactId']}});})[_0xf3ab('0x1d')](function(_0x4ea730){if(_[_0xf3ab('0x60')](_0x4ea730)){return;}else{_0x479000[_0xf3ab('0x79')]=_0x4ea730[_0xf3ab('0x79')];return db[_0xf3ab('0x82')]['findOne']({'where':{'id':_0x479000[_0xf3ab('0x83')]}});}})['then'](function(_0x10599c){return respondWithRpcPromise(_0xf3ab('0x84'),_0xf3ab('0x84'),{'FaxAccountId':_[_0xf3ab('0x60')](_0x4207f1[_0xf3ab('0x54')])?undefined:_0x4207f1[_0xf3ab('0x54')][_0xf3ab('0x85')],'path':_[_0xf3ab('0x60')](_0x10599c)?undefined:util[_0xf3ab('0x5a')](_0xf3ab('0x86'),_0x10599c['basename']),'fax':_[_0xf3ab('0x60')](_0x479000[_0xf3ab('0x79')])?undefined:_0x479000[_0xf3ab('0x79')],'AttachmentId':_0x479000['AttachmentId']},client9002);})[_0xf3ab('0x1d')](respondWithResult(_0x5a7a02,0xc9))['catch'](handleError(_0x5a7a02,null));};exports[_0xf3ab('0x87')]=function(_0x4aa262,_0x1bfc3c){var _0x57bced=path['join'](config[_0xf3ab('0x88')],'server','files',_0xf3ab('0x89'));return db[_0xf3ab('0x4b')]['find']({'where':{'id':_0x4aa262[_0xf3ab('0x4e')]['id']},'include':[{'model':db['Attachment'],'as':_0xf3ab('0x82')}]})[_0xf3ab('0x1d')](handleEntityNotFound(_0x1bfc3c,null))[_0xf3ab('0x1d')](function(_0x1e5fc9){if(_0x1e5fc9){return _0x1bfc3c[_0xf3ab('0x87')](path[_0xf3ab('0x8a')](_0x57bced,_0x1e5fc9[_0xf3ab('0x82')][_0xf3ab('0x8b')]));}})[_0xf3ab('0x4c')](handleError(_0x1bfc3c,null));}; \ No newline at end of file +var _0x22a3=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','type','merge','options','FaxMessage','includeAll','findAll','rows','show','find','body','params','describe','accept','fax','read','readAt','format','UserId','user','agent','FaxInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','info','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','reject','FaxInteraction','role','rejectMessage','interface','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','server','files','attachments','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','request','then','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','save','update','destroy','name','send','map','rawAttributes','fieldName','key','model','query'];(function(_0x16282b,_0x1bb197){var _0x32b460=function(_0x383742){while(--_0x383742){_0x16282b['push'](_0x16282b['shift']());}};_0x32b460(++_0x1bb197);}(_0x22a3,0x1ee));var _0x322a=function(_0x26dd9a,_0x28a8e1){_0x26dd9a=_0x26dd9a-0x0;var _0x32c5f8=_0x22a3[_0x26dd9a];return _0x32c5f8;};'use strict';var emlformat=require(_0x322a('0x0'));var rimraf=require(_0x322a('0x1'));var zipdir=require(_0x322a('0x2'));var jsonpatch=require(_0x322a('0x3'));var rp=require(_0x322a('0x4'));var moment=require(_0x322a('0x5'));var BPromise=require(_0x322a('0x6'));var Mustache=require('mustache');var util=require(_0x322a('0x7'));var path=require(_0x322a('0x8'));var sox=require('sox');var csv=require(_0x322a('0x9'));var ejs=require(_0x322a('0xa'));var fs=require('fs');var fs_extra=require(_0x322a('0xb'));var _=require(_0x322a('0xc'));var squel=require(_0x322a('0xd'));var crypto=require(_0x322a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x322a('0xf'));var toCsv=require(_0x322a('0x9'));var querystring=require('querystring');var Papa=require(_0x322a('0x10'));var Redis=require(_0x322a('0x11'));var authService=require(_0x322a('0x12'));var qs=require(_0x322a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x322a('0x14'))(_0x322a('0x15'));var utils=require('../../config/utils');var config=require(_0x322a('0x16'));var licenseUtil=require(_0x322a('0x17'));var db=require(_0x322a('0x18'))['db'];config[_0x322a('0x19')]=_[_0x322a('0x1a')](config[_0x322a('0x19')],{'host':_0x322a('0x1b'),'port':0x18eb});var socket=require(_0x322a('0x1c'))(new Redis(config[_0x322a('0x19')]));require(_0x322a('0x1d'))[_0x322a('0x1e')](socket);var jayson=require(_0x322a('0x1f'));var client=jayson['client'][_0x322a('0x20')]({'port':0x232c});var client9002=jayson[_0x322a('0x21')][_0x322a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x7fc9a3,_0x5088a8,_0x37a6b6,_0x5a96a9){return new BPromise(function(_0x238862,_0x1ee925){var _0x1b3420=_0x5a96a9||client;return _0x1b3420[_0x322a('0x22')](_0x7fc9a3,_0x37a6b6)[_0x322a('0x23')](function(_0x4f1dd6){logger['info'](_0x322a('0x24'),_0x5088a8,'request\x20sent');logger[_0x322a('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5088a8,_0x322a('0x26'),JSON[_0x322a('0x27')](_0x4f1dd6));if(_0x4f1dd6[_0x322a('0x28')]){if(_0x4f1dd6[_0x322a('0x28')]['code']===0x1f4){logger[_0x322a('0x28')](_0x322a('0x24'),_0x5088a8,_0x4f1dd6[_0x322a('0x28')][_0x322a('0x29')]);return _0x1ee925(_0x4f1dd6[_0x322a('0x28')][_0x322a('0x29')]);}logger[_0x322a('0x28')](_0x322a('0x24'),_0x5088a8,_0x4f1dd6[_0x322a('0x28')][_0x322a('0x29')]);return _0x238862(_0x4f1dd6[_0x322a('0x28')][_0x322a('0x29')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x5088a8,_0x322a('0x26'));_0x238862(_0x4f1dd6[_0x322a('0x2a')]['message']);}})[_0x322a('0x2b')](function(_0x3f0f7d){logger[_0x322a('0x28')](_0x322a('0x24'),_0x5088a8,_0x3f0f7d);_0x1ee925(_0x3f0f7d);});});}function respondWithStatusCode(_0x2da199,_0x2801e0){_0x2801e0=_0x2801e0||0xcc;return function(_0x516132){if(_0x516132){return _0x2da199[_0x322a('0x2c')](_0x2801e0);}return _0x2da199['status'](_0x2801e0)[_0x322a('0x2d')]();};}function respondWithResult(_0x47ffcb,_0x4ff223){_0x4ff223=_0x4ff223||0xc8;return function(_0x3a8da8){if(_0x3a8da8){return _0x47ffcb['status'](_0x4ff223)[_0x322a('0x2e')](_0x3a8da8);}};}function respondWithFilteredResult(_0x2a2829,_0x213c4e){return function(_0x3e8a5c){if(_0x3e8a5c){var _0x13fa7e=typeof _0x213c4e['offset']===_0x322a('0x2f')&&typeof _0x213c4e['limit']==='undefined';var _0x4d774f=_0x3e8a5c[_0x322a('0x30')];var _0x195f9a=_0x13fa7e?0x0:_0x213c4e[_0x322a('0x31')];var _0x1791c4=_0x13fa7e?_0x3e8a5c[_0x322a('0x30')]:_0x213c4e[_0x322a('0x31')]+_0x213c4e[_0x322a('0x32')];var _0x186be9;if(_0x1791c4>=_0x4d774f){_0x1791c4=_0x4d774f;_0x186be9=0xc8;}else{_0x186be9=0xce;}_0x2a2829[_0x322a('0x33')](_0x186be9);return _0x2a2829[_0x322a('0x34')](_0x322a('0x35'),_0x195f9a+'-'+_0x1791c4+'/'+_0x4d774f)[_0x322a('0x2e')](_0x3e8a5c);}return null;};}function patchUpdates(_0x2e7392){return function(_0x3a491){try{jsonpatch[_0x322a('0x36')](_0x3a491,_0x2e7392,!![]);}catch(_0x3a6123){return BPromise['reject'](_0x3a6123);}return _0x3a491[_0x322a('0x37')]();};}function saveUpdates(_0x2405b1,_0x390cc2){return function(_0x2c0ee3){if(_0x2c0ee3){return _0x2c0ee3[_0x322a('0x38')](_0x2405b1)['then'](function(_0x2e73e4){return _0x2e73e4;});}return null;};}function removeEntity(_0x5eaed6,_0xc552f3){return function(_0x5efba4){if(_0x5efba4){return _0x5efba4[_0x322a('0x39')]()[_0x322a('0x23')](function(){_0x5eaed6[_0x322a('0x33')](0xcc)[_0x322a('0x2d')]();});}};}function handleEntityNotFound(_0xa760ac,_0x3b5a47){return function(_0x3e3b4e){if(!_0x3e3b4e){_0xa760ac['sendStatus'](0x194);}return _0x3e3b4e;};}function handleError(_0x533334,_0x48e0d7){_0x48e0d7=_0x48e0d7||0x1f4;return function(_0xc312db){logger['error'](_0xc312db['stack']);if(_0xc312db[_0x322a('0x3a')]){delete _0xc312db[_0x322a('0x3a')];}_0x533334[_0x322a('0x33')](_0x48e0d7)[_0x322a('0x3b')](_0xc312db);};}exports['index']=function(_0x26e7e2,_0x4335af){var _0x17489b={},_0x54d70a={},_0x2e79ef={'count':0x0,'rows':[]};var _0x7095f8=_[_0x322a('0x3c')](db['FaxMessage'][_0x322a('0x3d')],function(_0x358405){return{'name':_0x358405[_0x322a('0x3e')],'type':_0x358405['type'][_0x322a('0x3f')]};});_0x54d70a[_0x322a('0x40')]=_[_0x322a('0x3c')](_0x7095f8,_0x322a('0x3a'));_0x54d70a[_0x322a('0x41')]=_[_0x322a('0x42')](_0x26e7e2[_0x322a('0x41')]);_0x54d70a[_0x322a('0x43')]=_[_0x322a('0x44')](_0x54d70a[_0x322a('0x40')],_0x54d70a[_0x322a('0x41')]);_0x17489b[_0x322a('0x45')]=_[_0x322a('0x44')](_0x54d70a[_0x322a('0x40')],qs[_0x322a('0x46')](_0x26e7e2['query'][_0x322a('0x46')]));_0x17489b[_0x322a('0x45')]=_0x17489b['attributes']['length']?_0x17489b[_0x322a('0x45')]:_0x54d70a['model'];if(!_0x26e7e2[_0x322a('0x41')][_0x322a('0x47')](_0x322a('0x48'))){_0x17489b[_0x322a('0x32')]=qs[_0x322a('0x32')](_0x26e7e2[_0x322a('0x41')][_0x322a('0x32')]);_0x17489b[_0x322a('0x31')]=qs[_0x322a('0x31')](_0x26e7e2[_0x322a('0x41')]['offset']);}_0x17489b['order']=qs[_0x322a('0x49')](_0x26e7e2[_0x322a('0x41')][_0x322a('0x49')]);_0x17489b[_0x322a('0x4a')]=qs[_0x322a('0x43')](_['pick'](_0x26e7e2[_0x322a('0x41')],_0x54d70a[_0x322a('0x43')]),_0x7095f8);if(_0x26e7e2['query'][_0x322a('0x4b')]){_0x17489b['where']=_['merge'](_0x17489b[_0x322a('0x4a')],{'$or':_[_0x322a('0x3c')](_0x7095f8,function(_0x506514){if(_0x506514[_0x322a('0x4c')]!=='VIRTUAL'){var _0x3c9088={};_0x3c9088[_0x506514[_0x322a('0x3a')]]={'$like':'%'+_0x26e7e2[_0x322a('0x41')]['filter']+'%'};return _0x3c9088;}})});}_0x17489b=_[_0x322a('0x4d')]({},_0x17489b,_0x26e7e2[_0x322a('0x4e')]);var _0x2aeb88={'where':_0x17489b[_0x322a('0x4a')]};return db[_0x322a('0x4f')][_0x322a('0x30')](_0x2aeb88)['then'](function(_0x234010){_0x2e79ef['count']=_0x234010;if(_0x26e7e2[_0x322a('0x41')][_0x322a('0x50')]){_0x17489b['include']=[{'all':!![]}];}return db['FaxMessage'][_0x322a('0x51')](_0x17489b);})[_0x322a('0x23')](function(_0x532099){_0x2e79ef[_0x322a('0x52')]=_0x532099;return _0x2e79ef;})[_0x322a('0x23')](respondWithFilteredResult(_0x4335af,_0x17489b))[_0x322a('0x2b')](handleError(_0x4335af,null));};exports[_0x322a('0x53')]=function(_0x1df42c,_0x54fc52){var _0x35267d={'raw':!![],'where':{'id':_0x1df42c['params']['id']}},_0x4443d4={};_0x4443d4[_0x322a('0x40')]=_[_0x322a('0x42')](db['FaxMessage']['rawAttributes']);_0x4443d4[_0x322a('0x41')]=_['keys'](_0x1df42c[_0x322a('0x41')]);_0x4443d4[_0x322a('0x43')]=_[_0x322a('0x44')](_0x4443d4[_0x322a('0x40')],_0x4443d4['query']);_0x35267d['attributes']=_[_0x322a('0x44')](_0x4443d4[_0x322a('0x40')],qs[_0x322a('0x46')](_0x1df42c['query'][_0x322a('0x46')]));_0x35267d[_0x322a('0x45')]=_0x35267d[_0x322a('0x45')]['length']?_0x35267d['attributes']:_0x4443d4['model'];if(_0x1df42c[_0x322a('0x41')][_0x322a('0x50')]){_0x35267d['include']=[{'all':!![]}];}_0x35267d=_[_0x322a('0x4d')]({},_0x35267d,_0x1df42c['options']);return db[_0x322a('0x4f')][_0x322a('0x54')](_0x35267d)[_0x322a('0x23')](handleEntityNotFound(_0x54fc52,null))['then'](respondWithResult(_0x54fc52,null))[_0x322a('0x2b')](handleError(_0x54fc52,null));};exports[_0x322a('0x38')]=function(_0x1252fe,_0x187ce9){if(_0x1252fe['body']['id']){delete _0x1252fe[_0x322a('0x55')]['id'];}return db[_0x322a('0x4f')][_0x322a('0x54')]({'where':{'id':_0x1252fe['params']['id']}})[_0x322a('0x23')](handleEntityNotFound(_0x187ce9,null))['then'](saveUpdates(_0x1252fe[_0x322a('0x55')],null))[_0x322a('0x23')](respondWithResult(_0x187ce9,null))[_0x322a('0x2b')](handleError(_0x187ce9,null));};exports[_0x322a('0x39')]=function(_0x105fec,_0x15fd3b){return db['FaxMessage'][_0x322a('0x54')]({'where':{'id':_0x105fec[_0x322a('0x56')]['id']}})['then'](handleEntityNotFound(_0x15fd3b,null))[_0x322a('0x23')](removeEntity(_0x15fd3b,null))[_0x322a('0x2b')](handleError(_0x15fd3b,null));};exports[_0x322a('0x57')]=function(_0x2c2849,_0x4368bb){return db[_0x322a('0x4f')][_0x322a('0x57')]()[_0x322a('0x23')](respondWithResult(_0x4368bb,null))[_0x322a('0x2b')](handleError(_0x4368bb,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x322a('0x58')]=function(_0x31a28f,_0x320d1b,_0x5c2e07){var _0x4adfe3={'agent':{},'channel':_0x322a('0x59')};if(_0x31a28f[_0x322a('0x55')]['id']){delete _0x31a28f[_0x322a('0x55')]['id'];}_0x31a28f['body'][_0x322a('0x5a')]=!![];_0x31a28f['body'][_0x322a('0x5b')]=moment()[_0x322a('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x31a28f[_0x322a('0x55')][_0x322a('0x5d')]=_0x31a28f[_0x322a('0x55')][_0x322a('0x5d')]||_0x31a28f[_0x322a('0x5e')]['id'];_0x4adfe3[_0x322a('0x5f')]['id']=_0x31a28f['body'][_0x322a('0x5d')];return db['FaxMessage'][_0x322a('0x54')]({'where':{'id':_0x31a28f['params']['id'],'UserId':null}})[_0x322a('0x23')](handleEntityNotFound(_0x320d1b,null))[_0x322a('0x23')](saveUpdates(_0x31a28f[_0x322a('0x55')],null))['then'](function(_0x527a6d){if(_0x527a6d){_0x4adfe3[_0x322a('0x29')]=_0x527a6d['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x527a6d[_0x322a('0x60')]}});}return null;})[_0x322a('0x23')](handleEntityNotFound(_0x320d1b,null))[_0x322a('0x23')](function(_0x263344){if(_0x263344){return _0x263344[_0x322a('0x38')]({'UserId':_0x31a28f[_0x322a('0x55')][_0x322a('0x5d')],'read1stAt':_[_0x322a('0x61')](_0x263344['read1stAt'])?moment()[_0x322a('0x5c')](_0x322a('0x62')):undefined});}return null;})[_0x322a('0x23')](function(_0x32142f){if(_0x32142f){_0x4adfe3[_0x322a('0x63')]=_0x32142f['get']({'plain':!![]});interaction_log[_0x322a('0x64')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x31a28f[_0x322a('0x5e')]['id'],_0x31a28f[_0x322a('0x5e')][_0x322a('0x3a')],_0x31a28f[_0x322a('0x5e')]['role'],_0x4adfe3[_0x322a('0x63')]['id'],_0x31a28f['body']?JSON[_0x322a('0x27')](_0x31a28f[_0x322a('0x55')]):_0x322a('0x65'));return respondWithRpcPromise(_0x322a('0x66'),_0x322a('0x67'),_0x4adfe3);}return null;})[_0x322a('0x23')](function(_0x4c0c4e){var _0x41e8ae=_0x322a('0x68')+_0x4c0c4e['message'][_0x322a('0x69')];return db[_0x322a('0x6a')][_0x322a('0x41')](_0x41e8ae,{'type':db[_0x322a('0x6b')][_0x322a('0x6c')][_0x322a('0x6d')],'raw':!![]})[_0x322a('0x23')](function(_0x35fc32){return _0x35fc32;});})['then'](function(_0x2b8105){if(_0x2b8105){_0x4adfe3[_0x322a('0x29')][_0x322a('0x6e')]=_0x2b8105[0x0];if(!_0x31a28f[_0x322a('0x55')][_0x322a('0x5d')])return;return db[_0x322a('0x6f')][_0x322a('0x54')]({'where':{'id':_0x31a28f[_0x322a('0x55')][_0x322a('0x5d')],'role':_0x322a('0x5f')},'attributes':['id',_0x322a('0x3a'),_0x322a('0x70'),_0x322a('0x71'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3fb2f0){if(!_0x3fb2f0)return null;_0x4adfe3[_0x322a('0x29')][_0x322a('0x5f')]=_0x3fb2f0;return _0x4adfe3;})[_0x322a('0x23')](function(_0xbea0d6){if(_0xbea0d6){if(_0x31a28f['body']['manual']){_0x4adfe3[_0x322a('0x29')]['interface']=util[_0x322a('0x5c')](_0x322a('0x72'),_0x31a28f['user'][_0x322a('0x3a')]);_0x4adfe3[_0x322a('0x29')][_0x322a('0x73')]=_0x4adfe3[_0x322a('0x73')];_0x4adfe3[_0x322a('0x29')][_0x322a('0x74')]=_0x4adfe3['channel'];_0x4adfe3[_0x322a('0x29')][_0x322a('0x75')]=_0x322a('0x58');return respondWithRpcPromise(_0x322a('0x76'),_0x322a('0x76'),{'event':_0x322a('0x77'),'message':_0x4adfe3[_0x322a('0x29')]},client9002)[_0x322a('0x23')](function(){return _0x4adfe3;});}return _0x4adfe3;}return null;})['then'](respondWithResult(_0x320d1b,null))[_0x322a('0x2b')](handleError(_0x320d1b,null));};var interaction_log=require('../../config/logger')(_0x322a('0x78'));exports[_0x322a('0x79')]=function(_0x5db56e,_0x51f546,_0x41a879){var _0x5e8f29={'agent':{},'channel':_0x322a('0x59')};if(_0x5db56e[_0x322a('0x55')]['id']){delete _0x5db56e['body']['id'];}_0x5db56e['body'][_0x322a('0x5d')]=_0x5db56e[_0x322a('0x55')][_0x322a('0x5d')]||_0x5db56e['user']['id'];_0x5e8f29[_0x322a('0x5f')]['id']=_0x5db56e[_0x322a('0x55')][_0x322a('0x5d')];return db[_0x322a('0x4f')][_0x322a('0x54')]({'where':{'id':_0x5db56e[_0x322a('0x56')]['id'],'UserId':null}})[_0x322a('0x23')](handleEntityNotFound(_0x51f546,null))[_0x322a('0x23')](function(_0x254dd8){if(_0x254dd8){_0x5e8f29[_0x322a('0x29')]=_0x254dd8['get']({'plain':!![]});return db[_0x322a('0x7a')][_0x322a('0x54')]({'where':{'id':_0x254dd8[_0x322a('0x60')]}});}return null;})[_0x322a('0x23')](handleEntityNotFound(_0x51f546,null))[_0x322a('0x23')](function(_0x482403){if(_0x482403){_0x5e8f29[_0x322a('0x63')]=_0x482403['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5db56e['user']['id'],_0x5db56e[_0x322a('0x5e')][_0x322a('0x3a')],_0x5db56e[_0x322a('0x5e')][_0x322a('0x7b')],_0x5e8f29[_0x322a('0x63')]['id'],_0x5db56e[_0x322a('0x55')]?JSON['stringify'](_0x5db56e['body']):_0x322a('0x65'));return respondWithRpcPromise('RejectMessage',_0x322a('0x7c'),_0x5e8f29);}return null;})[_0x322a('0x23')](function(_0xb99c5a){var _0x1efad5=_0x322a('0x68')+_0xb99c5a[_0x322a('0x29')][_0x322a('0x69')];return db[_0x322a('0x6a')][_0x322a('0x41')](_0x1efad5,{'type':db[_0x322a('0x6b')][_0x322a('0x6c')][_0x322a('0x6d')],'raw':!![]})[_0x322a('0x23')](function(_0x1e6538){return _0x1e6538;});})[_0x322a('0x23')](function(_0x1c50f8){if(_0x1c50f8){_0x5e8f29['message'][_0x322a('0x6e')]=_0x1c50f8[0x0];if(!_0x5db56e[_0x322a('0x55')][_0x322a('0x5d')])return;return db[_0x322a('0x6f')]['find']({'where':{'id':_0x5db56e[_0x322a('0x55')]['UserId'],'role':'agent'},'attributes':['id',_0x322a('0x3a'),_0x322a('0x70'),_0x322a('0x71'),'internal'],'raw':!![]});}return null;})[_0x322a('0x23')](function(_0x25e2e7){if(!_0x25e2e7)return null;_0x5e8f29[_0x322a('0x29')][_0x322a('0x5f')]=_0x25e2e7;return _0x5e8f29;})[_0x322a('0x23')](function(_0x43f74d){if(_0x43f74d){_0x43f74d[_0x322a('0x29')][_0x322a('0x7d')]=util['format'](_0x322a('0x72'),_0x5db56e['user'][_0x322a('0x3a')]);_0x43f74d[_0x322a('0x29')]['channel']=_0x5e8f29[_0x322a('0x73')];_0x43f74d[_0x322a('0x29')][_0x322a('0x74')]=_0x5e8f29['channel'];_0x43f74d[_0x322a('0x29')][_0x322a('0x75')]=_0x322a('0x79');respondWithRpcPromise('EventManager',_0x322a('0x76'),{'event':'rejectmessage','message':_0x43f74d[_0x322a('0x29')]},client9002);return _0x5e8f29;}return null;})[_0x322a('0x23')](respondWithResult(_0x51f546,null))[_0x322a('0x2b')](handleError(_0x51f546,null));};exports[_0x322a('0x7e')]=function(_0x5bd46c,_0x4e3c92){var _0x2a8831;return db[_0x322a('0x4f')][_0x322a('0x7e')](_0x5bd46c[_0x322a('0x55')],{})[_0x322a('0x23')](function(_0x1f256e){_0x2a8831=_0x1f256e;return db[_0x322a('0x7f')][_0x322a('0x80')]({'where':{'id':_0x2a8831['ContactId']}});})['then'](function(_0x253726){if(_['isNil'](_0x253726)){return;}else{_0x2a8831[_0x322a('0x59')]=_0x253726[_0x322a('0x59')];return db[_0x322a('0x81')][_0x322a('0x80')]({'where':{'id':_0x2a8831[_0x322a('0x82')]}});}})[_0x322a('0x23')](function(_0x4680f6){return respondWithRpcPromise(_0x322a('0x83'),_0x322a('0x83'),{'FaxAccountId':_[_0x322a('0x61')](_0x5bd46c[_0x322a('0x55')])?undefined:_0x5bd46c[_0x322a('0x55')][_0x322a('0x84')],'path':_['isNil'](_0x4680f6)?undefined:util['format'](_0x322a('0x85'),_0x4680f6['basename']),'fax':_[_0x322a('0x61')](_0x2a8831[_0x322a('0x59')])?undefined:_0x2a8831[_0x322a('0x59')],'AttachmentId':_0x2a8831[_0x322a('0x82')]},client9002);})[_0x322a('0x23')](respondWithResult(_0x4e3c92,0xc9))[_0x322a('0x2b')](handleError(_0x4e3c92,null));};exports[_0x322a('0x86')]=function(_0x482874,_0x5c3f8f){var _0x512605=path[_0x322a('0x87')](config['root'],_0x322a('0x88'),_0x322a('0x89'),_0x322a('0x8a'));return db['FaxMessage'][_0x322a('0x54')]({'where':{'id':_0x482874[_0x322a('0x56')]['id']},'include':[{'model':db[_0x322a('0x81')],'as':_0x322a('0x81')}]})[_0x322a('0x23')](handleEntityNotFound(_0x5c3f8f,null))['then'](function(_0x948274){if(_0x948274){return _0x5c3f8f[_0x322a('0x86')](path[_0x322a('0x87')](_0x512605,_0x948274[_0x322a('0x81')][_0x322a('0x8b')]));}})['catch'](handleError(_0x5c3f8f,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 0cc0b13..708428b 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 _0xd101=['hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove','emit'];(function(_0x3b63f5,_0x47791d){var _0x4fc0ef=function(_0x44303c){while(--_0x44303c){_0x3b63f5['push'](_0x3b63f5['shift']());}};_0x4fc0ef(++_0x47791d);}(_0xd101,0xc1));var _0x1d10=function(_0x3f58c1,_0x17cdca){_0x3f58c1=_0x3f58c1-0x0;var _0x59cbed=_0xd101[_0x3f58c1];return _0x59cbed;};'use strict';var EventEmitter=require(_0x1d10('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x1d10('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1d10('0x2')](0x0);var events={'afterCreate':_0x1d10('0x3'),'afterUpdate':_0x1d10('0x4'),'afterDestroy':_0x1d10('0x5')};function emitEvent(_0x25b425){return function(_0x12c320,_0x1e83e0,_0x5c5c42){FaxMessageEvents[_0x1d10('0x6')](_0x25b425+':'+_0x12c320['id'],_0x12c320);FaxMessageEvents[_0x1d10('0x6')](_0x25b425,_0x12c320);_0x5c5c42(null);};}for(var e in events){if(events[_0x1d10('0x7')](e)){var event=events[e];FaxMessage[_0x1d10('0x8')](e,emitEvent(event));}}module[_0x1d10('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x1488=['events','FaxMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x40da26,_0x23369c){var _0x2a49a7=function(_0x3faa99){while(--_0x3faa99){_0x40da26['push'](_0x40da26['shift']());}};_0x2a49a7(++_0x23369c);}(_0x1488,0x88));var _0x8148=function(_0x412c8f,_0x11ec94){_0x412c8f=_0x412c8f-0x0;var _0x27c005=_0x1488[_0x412c8f];return _0x27c005;};'use strict';var EventEmitter=require(_0x8148('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x8148('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8148('0x2')](0x0);var events={'afterCreate':_0x8148('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2fdd7e){return function(_0x5b1a48,_0x32d78,_0x74ecbc){FaxMessageEvents[_0x8148('0x4')](_0x2fdd7e+':'+_0x5b1a48['id'],_0x5b1a48);FaxMessageEvents[_0x8148('0x4')](_0x2fdd7e,_0x5b1a48);_0x74ecbc(null);};}for(var e in events){if(events[_0x8148('0x5')](e)){var event=events[e];FaxMessage[_0x8148('0x6')](e,emitEvent(event));}}module[_0x8148('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 01411fa..596e360 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 _0x179b=['FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','FaxMessage','fax_messages','fti_fax_messages','body'];(function(_0x263452,_0x513079){var _0x2796c2=function(_0x5d1e13){while(--_0x5d1e13){_0x263452['push'](_0x263452['shift']());}};_0x2796c2(++_0x513079);}(_0x179b,0x1f0));var _0xb179=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x179b[_0x1ed116];return _0x574066;};'use strict';var _=require(_0xb179('0x0'));var util=require(_0xb179('0x1'));var logger=require('../../config/logger')(_0xb179('0x2'));var moment=require(_0xb179('0x3'));var BPromise=require(_0xb179('0x4'));var rp=require(_0xb179('0x5'));var fs=require('fs');var path=require(_0xb179('0x6'));var rimraf=require(_0xb179('0x7'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0xb179('0x8')]=function(_0x30cc0d,_0x4a5d76){return _0x30cc0d[_0xb179('0x9')](_0xb179('0xa'),attributes,{'tableName':_0xb179('0xb'),'paranoid':![],'indexes':[{'name':_0xb179('0xc'),'fields':[_0xb179('0xd')],'type':_0xb179('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x58ed8f,_0x35732b,_0x1a4589){var _0x25ab38=_0x30cc0d[_0xb179('0xf')];var _0x56b07b=_0x58ed8f['get']({'plain':!![]});if(_0x56b07b[_0xb179('0x10')]['toLowerCase']()==='in'||_0x56b07b[_0xb179('0x10')][_0xb179('0x11')]()===_0xb179('0x12')&&!_0x56b07b['secret']&&!_[_0xb179('0x13')](_0x56b07b[_0xb179('0x14')])){_0x25ab38[_0xb179('0x15')][_0xb179('0x16')]({'where':{'id':_0x56b07b[_0xb179('0x17')]}})[_0xb179('0x18')](function(_0x557b29){if(_0x557b29){_0x557b29['update']({'lastMsgAt':_0x56b07b[_0xb179('0x19')],'lastMsgDirection':_0x56b07b[_0xb179('0x10')][_0xb179('0x11')]()});}})[_0xb179('0x1a')](function(_0x3c31e2){console[_0xb179('0x1b')](_0x3c31e2);});}_0x1a4589();}},'charset':_0xb179('0x1c'),'collate':_0xb179('0x1d')});}; \ No newline at end of file +var _0x72e1=['models','get','direction','toLowerCase','out','isNil','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body'];(function(_0x48f811,_0x243b18){var _0x1438fe=function(_0x57f4b5){while(--_0x57f4b5){_0x48f811['push'](_0x48f811['shift']());}};_0x1438fe(++_0x243b18);}(_0x72e1,0xd9));var _0x172e=function(_0x39c79,_0x527daf){_0x39c79=_0x39c79-0x0;var _0x43113c=_0x72e1[_0x39c79];return _0x43113c;};'use strict';var _=require(_0x172e('0x0'));var util=require(_0x172e('0x1'));var logger=require(_0x172e('0x2'))(_0x172e('0x3'));var moment=require(_0x172e('0x4'));var BPromise=require(_0x172e('0x5'));var rp=require(_0x172e('0x6'));var fs=require('fs');var path=require(_0x172e('0x7'));var rimraf=require(_0x172e('0x8'));var config=require('../../config/environment');var attributes=require(_0x172e('0x9'));module[_0x172e('0xa')]=function(_0x1b6d83,_0x5c1346){return _0x1b6d83['define'](_0x172e('0xb'),attributes,{'tableName':_0x172e('0xc'),'paranoid':![],'indexes':[{'name':_0x172e('0xd'),'fields':[_0x172e('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1756d7,_0x4539b9,_0xdbe229){var _0x5d4c7c=_0x1b6d83[_0x172e('0xf')];var _0x1f116e=_0x1756d7[_0x172e('0x10')]({'plain':!![]});if(_0x1f116e['direction']['toLowerCase']()==='in'||_0x1f116e[_0x172e('0x11')][_0x172e('0x12')]()===_0x172e('0x13')&&!_0x1f116e['secret']&&!_[_0x172e('0x14')](_0x1f116e['UserId'])){_0x5d4c7c['FaxInteraction'][_0x172e('0x15')]({'where':{'id':_0x1f116e['FaxInteractionId']}})[_0x172e('0x16')](function(_0x1a1a00){if(_0x1a1a00){_0x1a1a00[_0x172e('0x17')]({'lastMsgAt':_0x1f116e[_0x172e('0x18')],'lastMsgDirection':_0x1f116e[_0x172e('0x11')][_0x172e('0x12')]()});}})[_0x172e('0x19')](function(_0x2719a5){console[_0x172e('0x1a')](_0x2719a5);});}_0xdbe229();}},'charset':_0x172e('0x1b'),'collate':_0x172e('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index b9d5150..e2c9d65 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0x1c9d2e,_0x3caac7){var _0x6f70c7=function(_0xbf9b5c){while(--_0xbf9b5c){_0x1c9d2e['push'](_0x1c9d2e['shift']());}};_0x6f70c7(++_0x3caac7);}(_0x9f62,0x154));var _0x29f6=function(_0x110305,_0x7ffb67){_0x110305=_0x110305-0x0;var _0x276b5c=_0x9f62[_0x110305];return _0x276b5c;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file +var _0xda55=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','update','where','limit','debug','UpdateFaxMessage','lodash','util'];(function(_0x19b064,_0x543ada){var _0x4732c8=function(_0x25eac9){while(--_0x25eac9){_0x19b064['push'](_0x19b064['shift']());}};_0x4732c8(++_0x543ada);}(_0xda55,0x6d));var _0x5da5=function(_0x3de742,_0x2a2512){_0x3de742=_0x3de742-0x0;var _0x11242e=_0xda55[_0x3de742];return _0x11242e;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});config[_0x5da5('0x9')]=_[_0x5da5('0xa')](config[_0x5da5('0x9')],{'host':_0x5da5('0xb'),'port':0x18eb});var socket=require(_0x5da5('0xc'))(new Redis(config[_0x5da5('0x9')]));require(_0x5da5('0xd'))[_0x5da5('0xe')](socket);function respondWithRpcPromise(_0x5c056f,_0x3ed24c,_0x1f98a7){return new BPromise(function(_0x2731a3,_0x26fbe3){return client[_0x5da5('0xf')](_0x5c056f,_0x1f98a7)[_0x5da5('0x10')](function(_0x33313e){logger['info'](_0x5da5('0x11'),_0x3ed24c,_0x5da5('0x12'));logger['debug'](_0x5da5('0x13'),_0x3ed24c,_0x5da5('0x12'),JSON[_0x5da5('0x14')](_0x33313e));if(_0x33313e[_0x5da5('0x15')]){if(_0x33313e[_0x5da5('0x15')][_0x5da5('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3ed24c,_0x33313e['error'][_0x5da5('0x17')]);return _0x26fbe3(_0x33313e[_0x5da5('0x15')][_0x5da5('0x17')]);}logger[_0x5da5('0x15')](_0x5da5('0x11'),_0x3ed24c,_0x33313e[_0x5da5('0x15')][_0x5da5('0x17')]);return _0x2731a3(_0x33313e['error'][_0x5da5('0x17')]);}else{logger[_0x5da5('0x18')](_0x5da5('0x11'),_0x3ed24c,_0x5da5('0x12'));_0x2731a3(_0x33313e[_0x5da5('0x19')][_0x5da5('0x17')]);}})['catch'](function(_0x1920e2){logger[_0x5da5('0x15')](_0x5da5('0x11'),_0x3ed24c,_0x1920e2);_0x26fbe3(_0x1920e2);});});}exports[_0x5da5('0x1a')]=function(_0xf023af){var _0x513a34=this;return new Promise(function(_0x4393d7,_0x3372fc){return db[_0x5da5('0x1b')]['create'](_0xf023af[_0x5da5('0x1c')],{'raw':_0xf023af[_0x5da5('0x1d')]?_0xf023af[_0x5da5('0x1d')][_0x5da5('0x1e')]===undefined?!![]:![]:!![]})[_0x5da5('0x10')](function(_0x436960){logger['info'](_0x5da5('0x1a'),_0xf023af);logger['debug'](_0x5da5('0x1a'),_0xf023af,JSON[_0x5da5('0x14')](_0x436960));_0x4393d7(_0x436960);})[_0x5da5('0x1f')](function(_0x5d983c){logger[_0x5da5('0x15')](_0x5da5('0x1a'),_0x5d983c[_0x5da5('0x17')],_0xf023af);_0x3372fc(_0x513a34[_0x5da5('0x15')](0x1f4,_0x5d983c['message']));});});};exports['UpdateFaxMessage']=function(_0x50aadc){var _0x3526cf=this;return new Promise(function(_0x56d509,_0x4e8890){return db[_0x5da5('0x1b')][_0x5da5('0x20')](_0x50aadc['body'],{'raw':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')][_0x5da5('0x21')]||null:null,'attributes':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')]['attributes']||null:null,'limit':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')][_0x5da5('0x22')]||null:null})[_0x5da5('0x10')](function(_0x55e2bf){logger['info']('UpdateFaxMessage',_0x50aadc);logger[_0x5da5('0x23')](_0x5da5('0x24'),_0x50aadc,JSON[_0x5da5('0x14')](_0x55e2bf));_0x56d509(_0x55e2bf);})[_0x5da5('0x1f')](function(_0x51b712){logger['error'](_0x5da5('0x24'),_0x51b712['message'],_0x50aadc);_0x4e8890(_0x3526cf['error'](0x1f4,_0x51b712[_0x5da5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 0d252c8..0f91bdd 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 _0x3824=['register','length','faxMessage:','./faxMessage.events','remove','update','removeListener'];(function(_0x3fa59c,_0x2302f9){var _0x239a2c=function(_0x410d0f){while(--_0x410d0f){_0x3fa59c['push'](_0x3fa59c['shift']());}};_0x239a2c(++_0x2302f9);}(_0x3824,0x65));var _0x4382=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x3824[_0x5a6644];return _0x3a2a5d;};'use strict';var FaxMessageEvents=require(_0x4382('0x0'));var events=['save',_0x4382('0x1'),_0x4382('0x2')];function createListener(_0x384497,_0x55f6a2){return function(_0x5e3ee3){_0x55f6a2['emit'](_0x384497,_0x5e3ee3);};}function removeListener(_0x3d9e3c,_0x573d25){return function(){FaxMessageEvents[_0x4382('0x3')](_0x3d9e3c,_0x573d25);};}exports[_0x4382('0x4')]=function(_0x5bb0e1){for(var _0x88ca87=0x0,_0x25abcc=events[_0x4382('0x5')];_0x88ca87<_0x25abcc;_0x88ca87++){var _0x3e3e3c=events[_0x88ca87];var _0x170b47=createListener(_0x4382('0x6')+_0x3e3e3c,_0x5bb0e1);FaxMessageEvents['on'](_0x3e3e3c,_0x170b47);}}; \ No newline at end of file +var _0x99d5=['./faxMessage.events','update','emit','removeListener','faxMessage:'];(function(_0x26fbe0,_0x401cb9){var _0x5ce614=function(_0x2b2db6){while(--_0x2b2db6){_0x26fbe0['push'](_0x26fbe0['shift']());}};_0x5ce614(++_0x401cb9);}(_0x99d5,0xaf));var _0x599d=function(_0x1aa6c6,_0x41b92f){_0x1aa6c6=_0x1aa6c6-0x0;var _0xeaecd=_0x99d5[_0x1aa6c6];return _0xeaecd;};'use strict';var FaxMessageEvents=require(_0x599d('0x0'));var events=['save','remove',_0x599d('0x1')];function createListener(_0x4521af,_0x572334){return function(_0x4a5675){_0x572334[_0x599d('0x2')](_0x4521af,_0x4a5675);};}function removeListener(_0x1a533a,_0x5533d8){return function(){FaxMessageEvents[_0x599d('0x3')](_0x1a533a,_0x5533d8);};}exports['register']=function(_0x3cf978){for(var _0x5dbb06=0x0,_0x144194=events['length'];_0x5dbb06<_0x144194;_0x5dbb06++){var _0x164b3f=events[_0x5dbb06];var _0x33fc4e=createListener(_0x599d('0x4')+_0x164b3f,_0x3cf978);FaxMessageEvents['on'](_0x164b3f,_0x33fc4e);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f86a299..6b1bb49 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 _0x0102=['show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','update','accept','/:id/reject','reject','exports','util','path','connect-timeout','express','./faxMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x0102,0x186));var _0x2010=function(_0x4b3f93,_0x2ff713){_0x4b3f93=_0x4b3f93-0x0;var _0x1153ad=_0x0102[_0x4b3f93];return _0x1153ad;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('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('../../config/environment');var controller=require(_0x2010('0x4'));router[_0x2010('0x5')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['get'](_0x2010('0x8'),auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x5')]('/:id',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);router[_0x2010('0x5')](_0x2010('0xb'),auth[_0x2010('0x6')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth[_0x2010('0x6')](),interaction[_0x2010('0xe')](_0x2010('0xf'),_0x2010('0x10')),controller[_0x2010('0x11')]);router[_0x2010('0x12')](_0x2010('0x13'),auth[_0x2010('0x6')](),controller[_0x2010('0x14')]);router['put']('/:id/accept',auth[_0x2010('0x6')](),controller[_0x2010('0x15')]);router[_0x2010('0x12')](_0x2010('0x16'),auth[_0x2010('0x6')](),controller[_0x2010('0x17')]);router['delete'](_0x2010('0x13'),auth[_0x2010('0x6')](),controller['destroy']);module[_0x2010('0x18')]=router; \ No newline at end of file +var _0x6f0d=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','show','/:id/download','post','tracked','fax','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','exports'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x436a17,_0x2a5b43){_0x436a17=_0x436a17-0x0;var _0x31fc7a=_0x6f0d[_0x436a17];return _0x31fc7a;};'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('0xa')](_0xd6f0('0xe'),auth[_0xd6f0('0x9')](),controller['download']);router[_0xd6f0('0xf')]('/',auth[_0xd6f0('0x9')](),interaction[_0xd6f0('0x10')](_0xd6f0('0x11'),'faxmessage:create'),controller[_0xd6f0('0x12')]);router[_0xd6f0('0x13')](_0xd6f0('0x14'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x15')]);router[_0xd6f0('0x13')](_0xd6f0('0x16'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x17')]);router['put'](_0xd6f0('0x18'),auth[_0xd6f0('0x9')](),controller['reject']);router[_0xd6f0('0x19')]('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x1a')]);module[_0xd6f0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index c2f0523..8295c53 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 _0xd3ef=['ENUM','beepall','INTEGER','sequelize','STRING','name'];(function(_0x1e0b23,_0x534b27){var _0x2c6972=function(_0x22f5d6){while(--_0x22f5d6){_0x1e0b23['push'](_0x1e0b23['shift']());}};_0x2c6972(++_0x534b27);}(_0xd3ef,0x69));var _0xfd3e=function(_0x2e9afc,_0x434e1b){_0x2e9afc=_0x2e9afc-0x0;var _0x2b6f3d=_0xd3ef[_0x2e9afc];return _0x2b6f3d;};'use strict';var Sequelize=require(_0xfd3e('0x0'));module['exports']={'name':{'type':Sequelize[_0xfd3e('0x1')],'unique':_0xfd3e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfd3e('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfd3e('0x3')]('rrmemory',_0xfd3e('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xfd3e('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcbe2=['name','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0xeb9fb9,_0x1f34b8){var _0xc96789=function(_0x17620f){while(--_0x17620f){_0xeb9fb9['push'](_0xeb9fb9['shift']());}};_0xc96789(++_0x1f34b8);}(_0xcbe2,0x148));var _0x2cbe=function(_0x553e99,_0x26db47){_0x553e99=_0x553e99-0x0;var _0x3f519c=_0xcbe2[_0x553e99];return _0x3f519c;};'use strict';var Sequelize=require(_0x2cbe('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2cbe('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2cbe('0x2')]},'timeout':{'type':Sequelize[_0x2cbe('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2cbe('0x4')]('rrmemory',_0x2cbe('0x5'),_0x2cbe('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2cbe('0x3')],'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 da5b063..fb53b10 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 _0x524e=['userFaxQueue:remove','addAgents','omit','isArray','getAgents','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','destroy','then','FaxQueues','name','send','map','FaxQueue','rawAttributes','key','getOptions','where','include','query','findAll','catch','params','model','keys','filters','intersection','fields','attributes','length','includeAll','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','update','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','merge','UserFaxQueue','findAndCountAll','updatedAt','createdAt','rows','SIP','faxPause','Team','getTeams','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','userFaxQueue:save','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','emit'];(function(_0x28bdf9,_0x2c1783){var _0x2dc752=function(_0x454133){while(--_0x454133){_0x28bdf9['push'](_0x28bdf9['shift']());}};_0x2dc752(++_0x2c1783);}(_0x524e,0x15e));var _0xe524=function(_0x1ac9d0,_0x580123){_0x1ac9d0=_0x1ac9d0-0x0;var _0x4f1a2c=_0x524e[_0x1ac9d0];return _0x4f1a2c;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xe524('0x0'));var squel=require(_0xe524('0x1'));var Redis=require(_0xe524('0x2'));var qs=require(_0xe524('0x3'));var logger=require(_0xe524('0x4'))(_0xe524('0x5'));var config=require(_0xe524('0x6'));var db=require(_0xe524('0x7'))['db'];config[_0xe524('0x8')]=_[_0xe524('0x9')](config['redis'],{'host':_0xe524('0xa'),'port':0x18eb});var socket=require(_0xe524('0xb'))(new Redis(config[_0xe524('0x8')]));require('./faxQueue.socket')[_0xe524('0xc')](socket);function respondWithStatusCode(_0x3e4cda,_0x24114d){_0x24114d=_0x24114d||0xcc;return function(_0x1f36e5){if(_0x1f36e5){return _0x3e4cda[_0xe524('0xd')](_0x24114d);}return _0x3e4cda[_0xe524('0xe')](_0x24114d)[_0xe524('0xf')]();};}function respondWithResult(_0xb3eb9f,_0x1b75bd){_0x1b75bd=_0x1b75bd||0xc8;return function(_0x1641ec){if(_0x1641ec){return _0xb3eb9f[_0xe524('0xe')](_0x1b75bd)[_0xe524('0x10')](_0x1641ec);}};}function respondWithFilteredResult(_0x1184df,_0x2f0e86){return function(_0x1bdcee){if(_0x1bdcee){var _0x26cc77=typeof _0x2f0e86['offset']==='undefined'&&typeof _0x2f0e86[_0xe524('0x11')]===_0xe524('0x12');var _0x11adbc=_0x1bdcee[_0xe524('0x13')];var _0x20a852=_0x26cc77?0x0:_0x2f0e86['offset'];var _0x12ff75=_0x26cc77?_0x1bdcee['count']:_0x2f0e86[_0xe524('0x14')]+_0x2f0e86[_0xe524('0x11')];var _0x48165e;if(_0x12ff75>=_0x11adbc){_0x12ff75=_0x11adbc;_0x48165e=0xc8;}else{_0x48165e=0xce;}_0x1184df[_0xe524('0xe')](_0x48165e);return _0x1184df['set'](_0xe524('0x15'),_0x20a852+'-'+_0x12ff75+'/'+_0x11adbc)['json'](_0x1bdcee);}return null;};}function saveUpdates(_0x29a031){return function(_0x5f17fe){if(_0x5f17fe){return _0x5f17fe['update'](_0x29a031)['then'](function(_0x3a4027){return _0x3a4027;});}return null;};}function removeEntity(_0x4f1dfb){return function(_0x11b2a1){if(_0x11b2a1){return _0x11b2a1[_0xe524('0x16')]()[_0xe524('0x17')](function(){var _0x209d0b=_0x11b2a1['get']({'plain':!![]});var _0x1fd93a=_0xe524('0x18');return db['UserProfileResource'][_0xe524('0x16')]({'where':{'type':_0x1fd93a,'resourceId':_0x209d0b['id']}})[_0xe524('0x17')](function(){return _0x11b2a1;});})[_0xe524('0x17')](function(){_0x4f1dfb[_0xe524('0xe')](0xcc)[_0xe524('0xf')]();});}};}function handleEntityNotFound(_0x1cab6c){return function(_0xbf059b){if(!_0xbf059b){_0x1cab6c[_0xe524('0xd')](0x194);}return _0xbf059b;};}function handleError(_0x7dfe97,_0x5c4d21){_0x5c4d21=_0x5c4d21||0x1f4;return function(_0x7d1f92){logger['error'](_0x7d1f92['stack']);if(_0x7d1f92[_0xe524('0x19')]){delete _0x7d1f92[_0xe524('0x19')];}_0x7dfe97[_0xe524('0xe')](_0x5c4d21)[_0xe524('0x1a')](_0x7d1f92);};}exports['index']=function(_0x158f07,_0x4a03bc){var _0x17e245={};var _0xcf5db={'count':0x0,'rows':[]};var _0xd62772=_[_0xe524('0x1b')](db[_0xe524('0x1c')][_0xe524('0x1d')],function(_0x2141db){return{'name':_0x2141db['fieldName'],'type':_0x2141db['type'][_0xe524('0x1e')]};});_0x17e245=qs[_0xe524('0x1f')](_0xd62772,_0x158f07);var _0x476572={'where':_0x17e245[_0xe524('0x20')]};return db[_0xe524('0x1c')]['count'](_0x476572)['then'](function(_0x4b1ff){_0xcf5db[_0xe524('0x13')]=_0x4b1ff;_0x17e245[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x158f07[_0xe524('0x22')]);return db['FaxQueue'][_0xe524('0x23')](_0x17e245);})[_0xe524('0x17')](function(_0x4a4e15){_0xcf5db['rows']=_0x4a4e15;return _0xcf5db;})[_0xe524('0x17')](respondWithFilteredResult(_0x4a03bc,_0x17e245))[_0xe524('0x24')](handleError(_0x4a03bc,null));};exports['show']=function(_0x31d4a7,_0x535354){var _0x3fec06={'raw':!![],'where':{'id':_0x31d4a7[_0xe524('0x25')]['id']}},_0x54af2a={};_0x54af2a[_0xe524('0x26')]=_[_0xe524('0x27')](db['FaxQueue'][_0xe524('0x1d')]);_0x54af2a['query']=_[_0xe524('0x27')](_0x31d4a7[_0xe524('0x22')]);_0x54af2a[_0xe524('0x28')]=_['intersection'](_0x54af2a[_0xe524('0x26')],_0x54af2a[_0xe524('0x22')]);_0x3fec06['attributes']=_[_0xe524('0x29')](_0x54af2a[_0xe524('0x26')],qs[_0xe524('0x2a')](_0x31d4a7[_0xe524('0x22')]['fields']));_0x3fec06[_0xe524('0x2b')]=_0x3fec06[_0xe524('0x2b')][_0xe524('0x2c')]?_0x3fec06[_0xe524('0x2b')]:_0x54af2a[_0xe524('0x26')];if(_0x31d4a7[_0xe524('0x22')][_0xe524('0x2d')]){_0x3fec06[_0xe524('0x21')]=[{'all':!![]}];}_0x3fec06=_['merge']({},_0x3fec06,_0x31d4a7[_0xe524('0x2e')]);return db['FaxQueue'][_0xe524('0x2f')](_0x3fec06)[_0xe524('0x17')](handleEntityNotFound(_0x535354,null))['then'](respondWithResult(_0x535354,null))[_0xe524('0x24')](handleError(_0x535354,null));};exports['create']=function(_0x1c3aae,_0x41af26){return db[_0xe524('0x1c')][_0xe524('0x30')](_0x1c3aae[_0xe524('0x31')],{})[_0xe524('0x17')](function(_0x3a0d20){var _0x13762c=_0x1c3aae['user'][_0xe524('0x32')]({'plain':!![]});if(!_0x13762c)throw new Error(_0xe524('0x33'));if(_0x13762c[_0xe524('0x34')]===_0xe524('0x35')){var _0xbd4ae3=_0x3a0d20[_0xe524('0x32')]({'plain':!![]});var _0x1d9648=_0xe524('0x18');return db['UserProfileSection'][_0xe524('0x2f')]({'where':{'name':_0x1d9648,'userProfileId':_0x13762c[_0xe524('0x36')]},'raw':!![]})[_0xe524('0x17')](function(_0x59781b){if(_0x59781b&&_0x59781b[_0xe524('0x37')]===0x0){return db['UserProfileResource'][_0xe524('0x30')]({'name':_0xbd4ae3[_0xe524('0x19')],'resourceId':_0xbd4ae3['id'],'type':_0x59781b[_0xe524('0x19')],'sectionId':_0x59781b['id']},{})[_0xe524('0x17')](function(){return _0x3a0d20;});}else{return _0x3a0d20;}})[_0xe524('0x24')](function(_0x4746cd){logger[_0xe524('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4746cd);throw _0x4746cd;});}return _0x3a0d20;})[_0xe524('0x17')](respondWithResult(_0x41af26,0xc9))[_0xe524('0x24')](handleError(_0x41af26,null));};exports[_0xe524('0x39')]=function(_0x376505,_0x438962){if(_0x376505[_0xe524('0x31')]['id']){delete _0x376505['body']['id'];}return db[_0xe524('0x1c')][_0xe524('0x2f')]({'where':{'id':_0x376505[_0xe524('0x25')]['id']}})['then'](handleEntityNotFound(_0x438962,null))[_0xe524('0x17')](saveUpdates(_0x376505['body'],null))['then'](respondWithResult(_0x438962,null))[_0xe524('0x24')](handleError(_0x438962,null));};exports[_0xe524('0x16')]=function(_0x4da26f,_0x1e4e9f){return db[_0xe524('0x1c')][_0xe524('0x2f')]({'where':{'id':_0x4da26f[_0xe524('0x25')]['id']}})['then'](handleEntityNotFound(_0x1e4e9f,null))['then'](removeEntity(_0x1e4e9f,null))[_0xe524('0x24')](handleError(_0x1e4e9f,null));};exports[_0xe524('0x3a')]=function(_0x53c204,_0x30d278){return db['FaxQueue'][_0xe524('0x3a')]()[_0xe524('0x17')](respondWithResult(_0x30d278,null))[_0xe524('0x24')](handleError(_0x30d278,null));};exports[_0xe524('0x3b')]=function(_0xbde17b,_0x36f90a){var _0x305503={'raw':!![],'where':{}},_0x22fb42={},_0x1642a7;return db[_0xe524('0x1c')][_0xe524('0x3c')]({'where':{'id':_0xbde17b[_0xe524('0x25')]['id']}})[_0xe524('0x17')](handleEntityNotFound(_0x36f90a,null))[_0xe524('0x17')](function(_0x37d44d){if(_0x37d44d){_0x1642a7=_0x37d44d['get']({'plain':!![]});_0x22fb42[_0xe524('0x26')]=_['keys'](db['UserFaxQueue'][_0xe524('0x1d')]);_0x22fb42['query']=_[_0xe524('0x27')](_0xbde17b[_0xe524('0x22')]);_0x22fb42['filters']=_[_0xe524('0x29')](_0x22fb42['model'],_0x22fb42['query']);_0x305503[_0xe524('0x2b')]=_[_0xe524('0x29')](_0x22fb42[_0xe524('0x26')],qs['fields'](_0xbde17b['query']['fields']));_0x305503['attributes']=_0x305503['attributes']['length']?_0x305503[_0xe524('0x2b')]:_0x22fb42[_0xe524('0x26')];if(!_0xbde17b['query'][_0xe524('0x3d')](_0xe524('0x3e'))){_0x305503[_0xe524('0x11')]=qs[_0xe524('0x11')](_0xbde17b[_0xe524('0x22')]['limit']);_0x305503[_0xe524('0x14')]=qs[_0xe524('0x14')](_0xbde17b[_0xe524('0x22')]['offset']);}_0x305503[_0xe524('0x3f')]=qs['sort'](_0xbde17b[_0xe524('0x22')][_0xe524('0x40')]);_0x305503[_0xe524('0x20')]=qs[_0xe524('0x28')](_[_0xe524('0x41')](_0xbde17b[_0xe524('0x22')],_0x22fb42[_0xe524('0x28')]));_0x305503[_0xe524('0x20')][_0xe524('0x42')]=_0x37d44d['id'];if(_0xbde17b[_0xe524('0x22')][_0xe524('0x43')]){_0x305503[_0xe524('0x20')]=_['merge'](_0x305503['where'],{'$or':_['map'](_0x305503[_0xe524('0x2b')],function(_0x469f67){var _0xe7de83={};_0xe7de83[_0x469f67]={'$like':'%'+_0xbde17b[_0xe524('0x22')][_0xe524('0x43')]+'%'};return _0xe7de83;})});}_0x305503=_[_0xe524('0x44')]({},_0x305503,_0xbde17b[_0xe524('0x2e')]);return db[_0xe524('0x45')][_0xe524('0x23')](_0x305503);}})[_0xe524('0x17')](function(_0x3cc1ab){if(_0x3cc1ab){return db['User'][_0xe524('0x46')]({'where':{'id':_[_0xe524('0x1b')](_0x3cc1ab,'UserId'),'role':'agent'},'attributes':['id','name','faxPause',_0xe524('0x47'),_0xe524('0x48')]});}})[_0xe524('0x17')](function(_0x8a2c00){if(_0x8a2c00){return{'count':_0x8a2c00['count'],'rows':_[_0xe524('0x1b')](_0x8a2c00[_0xe524('0x49')],function(_0xefe0e0){return{'membername':_0xefe0e0[_0xe524('0x19')],'UserId':_0xefe0e0['id'],'queue_name':_0x1642a7['name'],'FaxQueueId':_0x1642a7['id'],'interface':util['format']('%s/%s',_0xe524('0x4a'),_0xefe0e0['name']),'penalty':0x0,'paused':_0xefe0e0[_0xe524('0x4b')],'createdAt':_0xefe0e0[_0xe524('0x48')],'updatedAt':_0xefe0e0[_0xe524('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe524('0x17')](respondWithFilteredResult(_0x36f90a,_0x305503))[_0xe524('0x24')](handleError(_0x36f90a,null));};exports['getTeams']=function(_0x5d0507,_0x29a519){var _0x415476={};var _0x3b0c8f={};var _0x8e6e1f;var _0x214c66;return db[_0xe524('0x1c')]['findOne']({'where':{'id':_0x5d0507[_0xe524('0x25')]['id']}})[_0xe524('0x17')](handleEntityNotFound(_0x29a519,null))[_0xe524('0x17')](function(_0x5d3b9c){if(_0x5d3b9c){_0x8e6e1f=_0x5d3b9c;_0x3b0c8f[_0xe524('0x26')]=_[_0xe524('0x27')](db[_0xe524('0x4c')]['rawAttributes']);_0x3b0c8f['query']=_[_0xe524('0x27')](_0x5d0507[_0xe524('0x22')]);_0x3b0c8f[_0xe524('0x28')]=_[_0xe524('0x29')](_0x3b0c8f[_0xe524('0x26')],_0x3b0c8f['query']);_0x415476[_0xe524('0x2b')]=_[_0xe524('0x29')](_0x3b0c8f[_0xe524('0x26')],qs[_0xe524('0x2a')](_0x5d0507[_0xe524('0x22')][_0xe524('0x2a')]));_0x415476[_0xe524('0x2b')]=_0x415476[_0xe524('0x2b')][_0xe524('0x2c')]?_0x415476[_0xe524('0x2b')]:_0x3b0c8f[_0xe524('0x26')];_0x415476['order']=qs[_0xe524('0x40')](_0x5d0507[_0xe524('0x22')][_0xe524('0x40')]);_0x415476[_0xe524('0x20')]=qs[_0xe524('0x28')](_['pick'](_0x5d0507[_0xe524('0x22')],_0x3b0c8f[_0xe524('0x28')]));if(_0x5d0507[_0xe524('0x22')][_0xe524('0x43')]){_0x415476[_0xe524('0x20')]=_[_0xe524('0x44')](_0x415476[_0xe524('0x20')],{'$or':_['map'](_0x415476[_0xe524('0x2b')],function(_0x245501){var _0x35ca22={};_0x35ca22[_0x245501]={'$like':'%'+_0x5d0507[_0xe524('0x22')]['filter']+'%'};return _0x35ca22;})});}_0x415476=_[_0xe524('0x44')]({},_0x415476,_0x5d0507['options']);return _0x8e6e1f[_0xe524('0x4d')](_0x415476);}})[_0xe524('0x17')](function(_0x52e84e){if(_0x52e84e){_0x214c66=_0x52e84e['length'];if(!_0x5d0507[_0xe524('0x22')][_0xe524('0x3d')](_0xe524('0x3e'))){_0x415476[_0xe524('0x11')]=qs[_0xe524('0x11')](_0x5d0507['query'][_0xe524('0x11')]);_0x415476[_0xe524('0x14')]=qs[_0xe524('0x14')](_0x5d0507[_0xe524('0x22')][_0xe524('0x14')]);}return _0x8e6e1f['getTeams'](_0x415476);}})[_0xe524('0x17')](function(_0x629baa){if(_0x629baa){return _0x629baa?{'count':_0x214c66,'rows':_0x629baa}:null;}})[_0xe524('0x17')](respondWithResult(_0x29a519,null))[_0xe524('0x24')](handleError(_0x29a519,null));};exports[_0xe524('0x4e')]=function(_0x1bde09,_0x54a1e1){var _0x42b95d=_0x1bde09[_0xe524('0x31')][_0xe524('0x4f')];return db['Team'][_0xe524('0x23')]({'where':{'id':_0x42b95d},'attributes':['id'],'include':[{'model':db[_0xe524('0x50')],'as':'Agents','attributes':['id',_0xe524('0x19'),_0xe524('0x51'),_0xe524('0x52'),_0xe524('0x53')],'raw':!![]}]})[_0xe524('0x17')](function(_0xf6934){if(_0xf6934){var _0x52e1bd=_[_0xe524('0x54')](_0xf6934,function(_0x3fd61e){var _0x410bd3=_0x3fd61e[_0xe524('0x32')]({'plain':!![]});return _0x410bd3[_0xe524('0x55')];});return db[_0xe524('0x1c')][_0xe524('0x2f')]({'where':{'id':_0x1bde09[_0xe524('0x25')]['id']}})[_0xe524('0x17')](function(_0x16893f){return db[_0xe524('0x56')][_0xe524('0x57')](function(_0x3c82e7){return _0x16893f[_0xe524('0x4e')](_0x42b95d,{'transaction':_0x3c82e7})[_0xe524('0x17')](function(){return BPromise['each'](_0x52e1bd,function(_0x933c2a){return db[_0xe524('0x45')][_0xe524('0x58')]({'where':{'UserId':_0x933c2a['id'],'FaxQueueId':_0x1bde09['params']['id']},'transaction':_0x3c82e7});});})[_0xe524('0x17')](function(){_0x52e1bd[_0xe524('0x59')](function(_0x5c29aa){socket['emit'](_0xe524('0x5a'),{'UserId':_0x5c29aa['id'],'FaxQueueId':_0x16893f['id']});});});});});}})['then'](respondWithStatusCode(_0x54a1e1,null))[_0xe524('0x24')](handleError(_0x54a1e1,null));};exports['removeTeams']=function(_0x22b3fd,_0x1ed60b){return db[_0xe524('0x4c')][_0xe524('0x23')]({'where':{'id':_0x22b3fd['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe524('0x50')],'as':_0xe524('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1ed60b,null))[_0xe524('0x17')](function(_0x449842){var _0x1f3ed1=_['map'](_0x449842,'id');var _0x19b063=[];var _0x140a4e=[];var _0x3f9d65=squel[_0xe524('0x5b')]();_0x3f9d65[_0xe524('0x5c')](_0xe524('0x5d'))['from']('team_has_fax_queues','tq')[_0xe524('0x5e')]('user_has_teams','ut',_0xe524('0x5f'))[_0xe524('0x20')](_0xe524('0x60'),_0x22b3fd['params']['id']);for(var _0x216a77=0x0;_0x216a77<_0x449842['length'];_0x216a77+=0x1){let _0x1681c5=_0x449842[_0x216a77];for(var _0x41e693=0x0;_0x41e693<_0x1681c5[_0xe524('0x55')][_0xe524('0x2c')];_0x41e693+=0x1){let _0x382ecc=_0x1681c5[_0xe524('0x55')][_0x41e693];var _0x50f5e3=_0x3f9d65[_0xe524('0x61')]();_0x50f5e3[_0xe524('0x20')](_0xe524('0x62'),_0x382ecc['id']);_0x140a4e['push'](db[_0xe524('0x56')][_0xe524('0x22')](_0x50f5e3['toString'](),{'type':db[_0xe524('0x56')][_0xe524('0x63')][_0xe524('0x64')]})[_0xe524('0x17')](function(_0x58d29e){if(_0x58d29e[_0xe524('0x2c')]===0x1){return _0x382ecc['id'];}else{var _0x20779a=_[_0xe524('0x65')](_['map'](_0x58d29e,_0xe524('0x66')),function(_0x494333){return _[_0xe524('0x67')](_0x1f3ed1,_0x494333);});if(_0x20779a){return _0x382ecc['id'];}}}));}}return BPromise[_0xe524('0x68')](_0x140a4e)[_0xe524('0x17')](function(_0x4d0ce5){_0x19b063=_(_0x19b063)[_0xe524('0x69')](_0x4d0ce5)[_0xe524('0x6a')]()[_0xe524('0x6b')]();return db['FaxQueue']['find']({'where':{'id':_0x22b3fd[_0xe524('0x25')]['id']}})['then'](function(_0x903e24){return db['sequelize'][_0xe524('0x57')](function(_0x246c62){return _0x903e24['removeTeams'](_0x22b3fd[_0xe524('0x22')][_0xe524('0x4f')],{'transaction':_0x246c62})['then'](function(){if(!_['isEmpty'](_0x19b063)){return _0x903e24[_0xe524('0x6c')](_0x19b063,{'transaction':_0x246c62});}})[_0xe524('0x17')](function(){_0x19b063[_0xe524('0x59')](function(_0x5b6313){socket[_0xe524('0x6d')](_0xe524('0x6e'),{'UserId':_0x5b6313,'FaxQueueId':_0x903e24['id']});});});});});});})[_0xe524('0x17')](respondWithStatusCode(_0x1ed60b,null))[_0xe524('0x24')](handleError(_0x1ed60b,null));};exports[_0xe524('0x6f')]=function(_0x1b2277,_0x57501c){return db[_0xe524('0x1c')][_0xe524('0x2f')]({'where':{'id':_0x1b2277['params']['id']}})['then'](handleEntityNotFound(_0x57501c,null))[_0xe524('0x17')](function(_0x1fb002){if(_0x1fb002){return _0x1fb002[_0xe524('0x6f')](_0x1b2277[_0xe524('0x31')]['ids'],_[_0xe524('0x70')](_0x1b2277[_0xe524('0x31')],['ids','id'])||{})['spread'](function(_0x475f24){for(var _0x269e79=0x0;_0x269e79<_0x1b2277[_0xe524('0x31')][_0xe524('0x4f')][_0xe524('0x2c')];_0x269e79+=0x1){socket[_0xe524('0x6d')]('userFaxQueue:save',{'UserId':Number(_0x1b2277['body'][_0xe524('0x4f')][_0x269e79]),'FaxQueueId':Number(_0x1b2277[_0xe524('0x25')]['id'])});}return _0x475f24;});}})['then'](respondWithResult(_0x57501c,null))['catch'](handleError(_0x57501c,null));};exports[_0xe524('0x6c')]=function(_0x187872,_0x30fa81){return db[_0xe524('0x1c')][_0xe524('0x2f')]({'where':{'id':_0x187872[_0xe524('0x25')]['id']}})['then'](handleEntityNotFound(_0x30fa81,null))['then'](function(_0x3e8668){if(_0x3e8668){return _0x3e8668[_0xe524('0x6c')](_0x187872[_0xe524('0x22')][_0xe524('0x4f')])[_0xe524('0x17')](function(){if(_[_0xe524('0x71')](_0x187872[_0xe524('0x22')][_0xe524('0x4f')])){for(var _0x507a9d=0x0;_0x507a9d<_0x187872[_0xe524('0x22')][_0xe524('0x4f')][_0xe524('0x2c')];_0x507a9d+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x187872[_0xe524('0x22')][_0xe524('0x4f')][_0x507a9d]),'FaxQueueId':Number(_0x187872[_0xe524('0x25')]['id'])});}}else{socket[_0xe524('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x187872[_0xe524('0x22')][_0xe524('0x4f')]),'FaxQueueId':Number(_0x187872[_0xe524('0x25')]['id'])});}});}})[_0xe524('0x17')](respondWithStatusCode(_0x30fa81,null))[_0xe524('0x24')](handleError(_0x30fa81,null));};exports['getAgents']=function(_0x2fa9c7,_0x5d8c54){var _0x4217ff={};var _0x37f754={};var _0x4a86bf;var _0x412e2f;return db[_0xe524('0x1c')]['findOne']({'where':{'id':_0x2fa9c7[_0xe524('0x25')]['id']}})['then'](handleEntityNotFound(_0x5d8c54,null))[_0xe524('0x17')](function(_0xf2058c){if(_0xf2058c){_0x4a86bf=_0xf2058c;_0x37f754[_0xe524('0x26')]=_[_0xe524('0x27')](db[_0xe524('0x50')][_0xe524('0x1d')]);_0x37f754[_0xe524('0x22')]=_[_0xe524('0x27')](_0x2fa9c7['query']);_0x37f754[_0xe524('0x28')]=_['intersection'](_0x37f754['model'],_0x37f754[_0xe524('0x22')]);_0x4217ff['attributes']=_[_0xe524('0x29')](_0x37f754[_0xe524('0x26')],qs[_0xe524('0x2a')](_0x2fa9c7[_0xe524('0x22')][_0xe524('0x2a')]));_0x4217ff[_0xe524('0x2b')]=_0x4217ff['attributes']['length']?_0x4217ff[_0xe524('0x2b')]:_0x37f754[_0xe524('0x26')];_0x4217ff[_0xe524('0x3f')]=qs[_0xe524('0x40')](_0x2fa9c7[_0xe524('0x22')][_0xe524('0x40')]);_0x4217ff[_0xe524('0x20')]=qs[_0xe524('0x28')](_[_0xe524('0x41')](_0x2fa9c7[_0xe524('0x22')],_0x37f754['filters']));if(_0x2fa9c7[_0xe524('0x22')][_0xe524('0x43')]){_0x4217ff[_0xe524('0x20')]=_[_0xe524('0x44')](_0x4217ff[_0xe524('0x20')],{'$or':_[_0xe524('0x1b')](_0x4217ff['attributes'],function(_0x1cc750){var _0x43f3bf={};_0x43f3bf[_0x1cc750]={'$like':'%'+_0x2fa9c7[_0xe524('0x22')][_0xe524('0x43')]+'%'};return _0x43f3bf;})});}_0x4217ff=_[_0xe524('0x44')]({},_0x4217ff,_0x2fa9c7[_0xe524('0x2e')]);return _0x4a86bf[_0xe524('0x72')](_0x4217ff);}})[_0xe524('0x17')](function(_0x599bd9){if(_0x599bd9){_0x412e2f=_0x599bd9['length'];if(!_0x2fa9c7['query'][_0xe524('0x3d')](_0xe524('0x3e'))){_0x4217ff['limit']=qs[_0xe524('0x11')](_0x2fa9c7[_0xe524('0x22')]['limit']);_0x4217ff[_0xe524('0x14')]=qs[_0xe524('0x14')](_0x2fa9c7['query'][_0xe524('0x14')]);}return _0x4a86bf[_0xe524('0x72')](_0x4217ff);}})[_0xe524('0x17')](function(_0x542182){if(_0x542182){return _0x542182?{'count':_0x412e2f,'rows':_0x542182}:null;}})[_0xe524('0x17')](respondWithResult(_0x5d8c54,null))[_0xe524('0x24')](handleError(_0x5d8c54,null));}; \ No newline at end of file +var _0xc21e=['findAll','rows','catch','show','params','model','keys','intersection','attributes','fields','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxQueues','find','autoAssociation','error','body','getMembers','UserFaxQueue','hasOwnProperty','nolimit','order','sort','filters','pick','FaxQueueId','filter','where','merge','options','User','map','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','rawAttributes','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','findOne','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','update','then','destroy','get','stack','name','send','index','FaxQueue','fieldName','type','key','getOptions','count','include','query'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xc21e,0x1ca));var _0xec21=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc21e[_0x4a9fb1];return _0x348672;};'use strict';var BPromise=require('bluebird');var util=require(_0xec21('0x0'));var _=require(_0xec21('0x1'));var squel=require(_0xec21('0x2'));var Redis=require(_0xec21('0x3'));var qs=require(_0xec21('0x4'));var logger=require(_0xec21('0x5'))('api');var config=require(_0xec21('0x6'));var db=require(_0xec21('0x7'))['db'];config[_0xec21('0x8')]=_[_0xec21('0x9')](config[_0xec21('0x8')],{'host':_0xec21('0xa'),'port':0x18eb});var socket=require(_0xec21('0xb'))(new Redis(config[_0xec21('0x8')]));require('./faxQueue.socket')[_0xec21('0xc')](socket);function respondWithStatusCode(_0x3d74a2,_0x42090f){_0x42090f=_0x42090f||0xcc;return function(_0xfbab77){if(_0xfbab77){return _0x3d74a2[_0xec21('0xd')](_0x42090f);}return _0x3d74a2['status'](_0x42090f)[_0xec21('0xe')]();};}function respondWithResult(_0x1d5e4b,_0x25a1bc){_0x25a1bc=_0x25a1bc||0xc8;return function(_0x4d13f0){if(_0x4d13f0){return _0x1d5e4b['status'](_0x25a1bc)[_0xec21('0xf')](_0x4d13f0);}};}function respondWithFilteredResult(_0x276437,_0x53772e){return function(_0x791642){if(_0x791642){var _0x2efc12=typeof _0x53772e[_0xec21('0x10')]===_0xec21('0x11')&&typeof _0x53772e[_0xec21('0x12')]==='undefined';var _0x179b89=_0x791642['count'];var _0x3ea83f=_0x2efc12?0x0:_0x53772e[_0xec21('0x10')];var _0x34e6af=_0x2efc12?_0x791642['count']:_0x53772e[_0xec21('0x10')]+_0x53772e[_0xec21('0x12')];var _0x3838c3;if(_0x34e6af>=_0x179b89){_0x34e6af=_0x179b89;_0x3838c3=0xc8;}else{_0x3838c3=0xce;}_0x276437[_0xec21('0x13')](_0x3838c3);return _0x276437[_0xec21('0x14')](_0xec21('0x15'),_0x3ea83f+'-'+_0x34e6af+'/'+_0x179b89)[_0xec21('0xf')](_0x791642);}return null;};}function saveUpdates(_0x350a53){return function(_0x4fdb21){if(_0x4fdb21){return _0x4fdb21[_0xec21('0x16')](_0x350a53)[_0xec21('0x17')](function(_0x2fcbcc){return _0x2fcbcc;});}return null;};}function removeEntity(_0x121624){return function(_0x3ab226){if(_0x3ab226){return _0x3ab226[_0xec21('0x18')]()[_0xec21('0x17')](function(){var _0x2aff55=_0x3ab226[_0xec21('0x19')]({'plain':!![]});var _0x350443='FaxQueues';return db['UserProfileResource'][_0xec21('0x18')]({'where':{'type':_0x350443,'resourceId':_0x2aff55['id']}})[_0xec21('0x17')](function(){return _0x3ab226;});})['then'](function(){_0x121624['status'](0xcc)[_0xec21('0xe')]();});}};}function handleEntityNotFound(_0xa3d694){return function(_0x2235bd){if(!_0x2235bd){_0xa3d694['sendStatus'](0x194);}return _0x2235bd;};}function handleError(_0x17d1ac,_0x1f86d2){_0x1f86d2=_0x1f86d2||0x1f4;return function(_0x139309){logger['error'](_0x139309[_0xec21('0x1a')]);if(_0x139309[_0xec21('0x1b')]){delete _0x139309[_0xec21('0x1b')];}_0x17d1ac[_0xec21('0x13')](_0x1f86d2)[_0xec21('0x1c')](_0x139309);};}exports[_0xec21('0x1d')]=function(_0x5692b0,_0x3563dc){var _0x26cdae={};var _0x4cd699={'count':0x0,'rows':[]};var _0x19b556=_['map'](db[_0xec21('0x1e')]['rawAttributes'],function(_0x4ef840){return{'name':_0x4ef840[_0xec21('0x1f')],'type':_0x4ef840[_0xec21('0x20')][_0xec21('0x21')]};});_0x26cdae=qs[_0xec21('0x22')](_0x19b556,_0x5692b0);var _0x2f95a2={'where':_0x26cdae['where']};return db[_0xec21('0x1e')]['count'](_0x2f95a2)[_0xec21('0x17')](function(_0x233bf9){_0x4cd699[_0xec21('0x23')]=_0x233bf9;_0x26cdae[_0xec21('0x24')]=qs['include'](_0x5692b0[_0xec21('0x25')]);return db[_0xec21('0x1e')][_0xec21('0x26')](_0x26cdae);})[_0xec21('0x17')](function(_0xa0dea2){_0x4cd699[_0xec21('0x27')]=_0xa0dea2;return _0x4cd699;})[_0xec21('0x17')](respondWithFilteredResult(_0x3563dc,_0x26cdae))[_0xec21('0x28')](handleError(_0x3563dc,null));};exports[_0xec21('0x29')]=function(_0x1bfc3c,_0x43a2de){var _0x57e004={'raw':!![],'where':{'id':_0x1bfc3c[_0xec21('0x2a')]['id']}},_0x31f861={};_0x31f861[_0xec21('0x2b')]=_[_0xec21('0x2c')](db[_0xec21('0x1e')]['rawAttributes']);_0x31f861[_0xec21('0x25')]=_['keys'](_0x1bfc3c['query']);_0x31f861['filters']=_[_0xec21('0x2d')](_0x31f861[_0xec21('0x2b')],_0x31f861[_0xec21('0x25')]);_0x57e004[_0xec21('0x2e')]=_[_0xec21('0x2d')](_0x31f861[_0xec21('0x2b')],qs[_0xec21('0x2f')](_0x1bfc3c[_0xec21('0x25')][_0xec21('0x2f')]));_0x57e004[_0xec21('0x2e')]=_0x57e004[_0xec21('0x2e')][_0xec21('0x30')]?_0x57e004['attributes']:_0x31f861[_0xec21('0x2b')];if(_0x1bfc3c[_0xec21('0x25')]['includeAll']){_0x57e004[_0xec21('0x24')]=[{'all':!![]}];}_0x57e004=_['merge']({},_0x57e004,_0x1bfc3c['options']);return db[_0xec21('0x1e')]['find'](_0x57e004)[_0xec21('0x17')](handleEntityNotFound(_0x43a2de,null))['then'](respondWithResult(_0x43a2de,null))[_0xec21('0x28')](handleError(_0x43a2de,null));};exports[_0xec21('0x31')]=function(_0x54b3a6,_0x1ff330){return db[_0xec21('0x1e')][_0xec21('0x31')](_0x54b3a6['body'],{})[_0xec21('0x17')](function(_0x32f4f5){var _0xcce304=_0x54b3a6['user'][_0xec21('0x19')]({'plain':!![]});if(!_0xcce304)throw new Error(_0xec21('0x32'));if(_0xcce304[_0xec21('0x33')]===_0xec21('0x34')){var _0x14cd36=_0x32f4f5['get']({'plain':!![]});var _0x28558f=_0xec21('0x35');return db['UserProfileSection'][_0xec21('0x36')]({'where':{'name':_0x28558f,'userProfileId':_0xcce304['userProfileId']},'raw':!![]})[_0xec21('0x17')](function(_0x18e20d){if(_0x18e20d&&_0x18e20d[_0xec21('0x37')]===0x0){return db['UserProfileResource'][_0xec21('0x31')]({'name':_0x14cd36[_0xec21('0x1b')],'resourceId':_0x14cd36['id'],'type':_0x18e20d[_0xec21('0x1b')],'sectionId':_0x18e20d['id']},{})[_0xec21('0x17')](function(){return _0x32f4f5;});}else{return _0x32f4f5;}})['catch'](function(_0x575e99){logger[_0xec21('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x575e99);throw _0x575e99;});}return _0x32f4f5;})[_0xec21('0x17')](respondWithResult(_0x1ff330,0xc9))['catch'](handleError(_0x1ff330,null));};exports[_0xec21('0x16')]=function(_0x52e024,_0x46d4f4){if(_0x52e024[_0xec21('0x39')]['id']){delete _0x52e024['body']['id'];}return db[_0xec21('0x1e')][_0xec21('0x36')]({'where':{'id':_0x52e024['params']['id']}})[_0xec21('0x17')](handleEntityNotFound(_0x46d4f4,null))[_0xec21('0x17')](saveUpdates(_0x52e024[_0xec21('0x39')],null))[_0xec21('0x17')](respondWithResult(_0x46d4f4,null))[_0xec21('0x28')](handleError(_0x46d4f4,null));};exports[_0xec21('0x18')]=function(_0x3e3835,_0x2ef798){return db[_0xec21('0x1e')]['find']({'where':{'id':_0x3e3835['params']['id']}})[_0xec21('0x17')](handleEntityNotFound(_0x2ef798,null))[_0xec21('0x17')](removeEntity(_0x2ef798,null))[_0xec21('0x28')](handleError(_0x2ef798,null));};exports['describe']=function(_0x31553a,_0x3ded8d){return db[_0xec21('0x1e')]['describe']()['then'](respondWithResult(_0x3ded8d,null))['catch'](handleError(_0x3ded8d,null));};exports[_0xec21('0x3a')]=function(_0x1b518a,_0x276e70){var _0x414a60={'raw':!![],'where':{}},_0x42cc6e={},_0x2d7b08;return db[_0xec21('0x1e')]['findOne']({'where':{'id':_0x1b518a[_0xec21('0x2a')]['id']}})[_0xec21('0x17')](handleEntityNotFound(_0x276e70,null))[_0xec21('0x17')](function(_0x14a346){if(_0x14a346){_0x2d7b08=_0x14a346[_0xec21('0x19')]({'plain':!![]});_0x42cc6e[_0xec21('0x2b')]=_[_0xec21('0x2c')](db[_0xec21('0x3b')]['rawAttributes']);_0x42cc6e[_0xec21('0x25')]=_[_0xec21('0x2c')](_0x1b518a[_0xec21('0x25')]);_0x42cc6e['filters']=_['intersection'](_0x42cc6e['model'],_0x42cc6e[_0xec21('0x25')]);_0x414a60[_0xec21('0x2e')]=_['intersection'](_0x42cc6e[_0xec21('0x2b')],qs[_0xec21('0x2f')](_0x1b518a[_0xec21('0x25')]['fields']));_0x414a60[_0xec21('0x2e')]=_0x414a60['attributes'][_0xec21('0x30')]?_0x414a60['attributes']:_0x42cc6e[_0xec21('0x2b')];if(!_0x1b518a[_0xec21('0x25')][_0xec21('0x3c')](_0xec21('0x3d'))){_0x414a60[_0xec21('0x12')]=qs['limit'](_0x1b518a[_0xec21('0x25')]['limit']);_0x414a60[_0xec21('0x10')]=qs['offset'](_0x1b518a[_0xec21('0x25')][_0xec21('0x10')]);}_0x414a60[_0xec21('0x3e')]=qs[_0xec21('0x3f')](_0x1b518a[_0xec21('0x25')][_0xec21('0x3f')]);_0x414a60['where']=qs[_0xec21('0x40')](_[_0xec21('0x41')](_0x1b518a[_0xec21('0x25')],_0x42cc6e[_0xec21('0x40')]));_0x414a60['where'][_0xec21('0x42')]=_0x14a346['id'];if(_0x1b518a[_0xec21('0x25')][_0xec21('0x43')]){_0x414a60['where']=_['merge'](_0x414a60[_0xec21('0x44')],{'$or':_['map'](_0x414a60[_0xec21('0x2e')],function(_0x74ce7c){var _0x50a471={};_0x50a471[_0x74ce7c]={'$like':'%'+_0x1b518a['query'][_0xec21('0x43')]+'%'};return _0x50a471;})});}_0x414a60=_[_0xec21('0x45')]({},_0x414a60,_0x1b518a[_0xec21('0x46')]);return db[_0xec21('0x3b')][_0xec21('0x26')](_0x414a60);}})[_0xec21('0x17')](function(_0x2a96f6){if(_0x2a96f6){return db[_0xec21('0x47')]['findAndCountAll']({'where':{'id':_[_0xec21('0x48')](_0x2a96f6,'UserId'),'role':_0xec21('0x49')},'attributes':['id','name',_0xec21('0x4a'),_0xec21('0x4b'),_0xec21('0x4c')]});}})[_0xec21('0x17')](function(_0xe89b76){if(_0xe89b76){return{'count':_0xe89b76['count'],'rows':_['map'](_0xe89b76['rows'],function(_0x2ed8f6){return{'membername':_0x2ed8f6['name'],'UserId':_0x2ed8f6['id'],'queue_name':_0x2d7b08[_0xec21('0x1b')],'FaxQueueId':_0x2d7b08['id'],'interface':util[_0xec21('0x4d')](_0xec21('0x4e'),_0xec21('0x4f'),_0x2ed8f6[_0xec21('0x1b')]),'penalty':0x0,'paused':_0x2ed8f6[_0xec21('0x4a')],'createdAt':_0x2ed8f6[_0xec21('0x4c')],'updatedAt':_0x2ed8f6[_0xec21('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xec21('0x17')](respondWithFilteredResult(_0x276e70,_0x414a60))['catch'](handleError(_0x276e70,null));};exports[_0xec21('0x50')]=function(_0x58e955,_0x12e005){var _0x235ab4={};var _0x35cd07={};var _0x53729e;var _0x56406a;return db[_0xec21('0x1e')]['findOne']({'where':{'id':_0x58e955['params']['id']}})[_0xec21('0x17')](handleEntityNotFound(_0x12e005,null))[_0xec21('0x17')](function(_0x3280c7){if(_0x3280c7){_0x53729e=_0x3280c7;_0x35cd07['model']=_[_0xec21('0x2c')](db[_0xec21('0x51')][_0xec21('0x52')]);_0x35cd07[_0xec21('0x25')]=_[_0xec21('0x2c')](_0x58e955[_0xec21('0x25')]);_0x35cd07['filters']=_[_0xec21('0x2d')](_0x35cd07[_0xec21('0x2b')],_0x35cd07[_0xec21('0x25')]);_0x235ab4[_0xec21('0x2e')]=_['intersection'](_0x35cd07['model'],qs['fields'](_0x58e955[_0xec21('0x25')][_0xec21('0x2f')]));_0x235ab4[_0xec21('0x2e')]=_0x235ab4[_0xec21('0x2e')][_0xec21('0x30')]?_0x235ab4[_0xec21('0x2e')]:_0x35cd07[_0xec21('0x2b')];_0x235ab4[_0xec21('0x3e')]=qs[_0xec21('0x3f')](_0x58e955[_0xec21('0x25')][_0xec21('0x3f')]);_0x235ab4[_0xec21('0x44')]=qs[_0xec21('0x40')](_[_0xec21('0x41')](_0x58e955[_0xec21('0x25')],_0x35cd07['filters']));if(_0x58e955[_0xec21('0x25')][_0xec21('0x43')]){_0x235ab4[_0xec21('0x44')]=_[_0xec21('0x45')](_0x235ab4['where'],{'$or':_['map'](_0x235ab4[_0xec21('0x2e')],function(_0x3ee7ca){var _0xd9050={};_0xd9050[_0x3ee7ca]={'$like':'%'+_0x58e955[_0xec21('0x25')]['filter']+'%'};return _0xd9050;})});}_0x235ab4=_[_0xec21('0x45')]({},_0x235ab4,_0x58e955['options']);return _0x53729e[_0xec21('0x50')](_0x235ab4);}})['then'](function(_0x42bc2f){if(_0x42bc2f){_0x56406a=_0x42bc2f[_0xec21('0x30')];if(!_0x58e955[_0xec21('0x25')]['hasOwnProperty']('nolimit')){_0x235ab4[_0xec21('0x12')]=qs[_0xec21('0x12')](_0x58e955['query']['limit']);_0x235ab4[_0xec21('0x10')]=qs[_0xec21('0x10')](_0x58e955['query']['offset']);}return _0x53729e[_0xec21('0x50')](_0x235ab4);}})[_0xec21('0x17')](function(_0x54d435){if(_0x54d435){return _0x54d435?{'count':_0x56406a,'rows':_0x54d435}:null;}})[_0xec21('0x17')](respondWithResult(_0x12e005,null))['catch'](handleError(_0x12e005,null));};exports['addTeams']=function(_0x422c46,_0x18d4a7){var _0x576fca=_0x422c46[_0xec21('0x39')][_0xec21('0x53')];return db['Team'][_0xec21('0x26')]({'where':{'id':_0x576fca},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xec21('0x1b'),_0xec21('0x54'),_0xec21('0x55'),_0xec21('0x56')],'raw':!![]}]})[_0xec21('0x17')](function(_0x3d15eb){if(_0x3d15eb){var _0x3e6468=_[_0xec21('0x57')](_0x3d15eb,function(_0x3d7827){var _0x4aab85=_0x3d7827[_0xec21('0x19')]({'plain':!![]});return _0x4aab85[_0xec21('0x58')];});return db['FaxQueue']['find']({'where':{'id':_0x422c46[_0xec21('0x2a')]['id']}})[_0xec21('0x17')](function(_0xa9469d){return db[_0xec21('0x59')][_0xec21('0x5a')](function(_0x348f92){return _0xa9469d['addTeams'](_0x576fca,{'transaction':_0x348f92})[_0xec21('0x17')](function(){return BPromise[_0xec21('0x5b')](_0x3e6468,function(_0x2d61ce){return db[_0xec21('0x3b')][_0xec21('0x5c')]({'where':{'UserId':_0x2d61ce['id'],'FaxQueueId':_0x422c46[_0xec21('0x2a')]['id']},'transaction':_0x348f92});});})[_0xec21('0x17')](function(){_0x3e6468[_0xec21('0x5d')](function(_0x1d0e63){socket[_0xec21('0x5e')](_0xec21('0x5f'),{'UserId':_0x1d0e63['id'],'FaxQueueId':_0xa9469d['id']});});});});});}})[_0xec21('0x17')](respondWithStatusCode(_0x18d4a7,null))[_0xec21('0x28')](handleError(_0x18d4a7,null));};exports[_0xec21('0x60')]=function(_0x531823,_0x318255){return db['Team'][_0xec21('0x26')]({'where':{'id':_0x531823[_0xec21('0x25')][_0xec21('0x53')]},'attributes':['id'],'include':[{'model':db[_0xec21('0x47')],'as':_0xec21('0x58'),'attributes':['id'],'raw':!![]}]})[_0xec21('0x17')](handleEntityNotFound(_0x318255,null))[_0xec21('0x17')](function(_0x90381d){var _0x378bd7=_['map'](_0x90381d,'id');var _0x44077f=[];var _0x2280e5=[];var _0x5def11=squel[_0xec21('0x61')]();_0x5def11[_0xec21('0x62')](_0xec21('0x63'))[_0xec21('0x64')](_0xec21('0x65'),'tq')[_0xec21('0x66')](_0xec21('0x67'),'ut',_0xec21('0x68'))[_0xec21('0x44')](_0xec21('0x69'),_0x531823[_0xec21('0x2a')]['id']);for(var _0x171e89=0x0;_0x171e89<_0x90381d[_0xec21('0x30')];_0x171e89+=0x1){let _0x20df64=_0x90381d[_0x171e89];for(var _0x2130a9=0x0;_0x2130a9<_0x20df64['Agents'][_0xec21('0x30')];_0x2130a9+=0x1){let _0x20c4f4=_0x20df64[_0xec21('0x58')][_0x2130a9];var _0x28cb5a=_0x5def11[_0xec21('0x6a')]();_0x28cb5a[_0xec21('0x44')](_0xec21('0x6b'),_0x20c4f4['id']);_0x2280e5['push'](db[_0xec21('0x59')][_0xec21('0x25')](_0x28cb5a[_0xec21('0x6c')](),{'type':db[_0xec21('0x59')]['QueryTypes'][_0xec21('0x6d')]})['then'](function(_0x2db996){if(_0x2db996['length']===0x1){return _0x20c4f4['id'];}else{var _0x131da5=_['every'](_['map'](_0x2db996,_0xec21('0x6e')),function(_0x43453b){return _[_0xec21('0x6f')](_0x378bd7,_0x43453b);});if(_0x131da5){return _0x20c4f4['id'];}}}));}}return BPromise[_0xec21('0x70')](_0x2280e5)[_0xec21('0x17')](function(_0x708e7f){_0x44077f=_(_0x44077f)['union'](_0x708e7f)[_0xec21('0x71')]()[_0xec21('0x72')]();return db['FaxQueue']['find']({'where':{'id':_0x531823[_0xec21('0x2a')]['id']}})[_0xec21('0x17')](function(_0x383e70){return db['sequelize'][_0xec21('0x5a')](function(_0x2ddc2a){return _0x383e70['removeTeams'](_0x531823[_0xec21('0x25')][_0xec21('0x53')],{'transaction':_0x2ddc2a})[_0xec21('0x17')](function(){if(!_[_0xec21('0x73')](_0x44077f)){return _0x383e70['removeAgents'](_0x44077f,{'transaction':_0x2ddc2a});}})[_0xec21('0x17')](function(){_0x44077f[_0xec21('0x5d')](function(_0xb3f47b){socket[_0xec21('0x5e')](_0xec21('0x74'),{'UserId':_0xb3f47b,'FaxQueueId':_0x383e70['id']});});});});});});})['then'](respondWithStatusCode(_0x318255,null))['catch'](handleError(_0x318255,null));};exports[_0xec21('0x75')]=function(_0x4d812a,_0x43deb1){return db[_0xec21('0x1e')][_0xec21('0x36')]({'where':{'id':_0x4d812a[_0xec21('0x2a')]['id']}})[_0xec21('0x17')](handleEntityNotFound(_0x43deb1,null))[_0xec21('0x17')](function(_0x3679d4){if(_0x3679d4){return _0x3679d4[_0xec21('0x75')](_0x4d812a[_0xec21('0x39')]['ids'],_[_0xec21('0x76')](_0x4d812a[_0xec21('0x39')],[_0xec21('0x53'),'id'])||{})[_0xec21('0x77')](function(_0x21ab0f){for(var _0x2ed2c7=0x0;_0x2ed2c7<_0x4d812a[_0xec21('0x39')]['ids']['length'];_0x2ed2c7+=0x1){socket[_0xec21('0x5e')](_0xec21('0x5f'),{'UserId':Number(_0x4d812a[_0xec21('0x39')][_0xec21('0x53')][_0x2ed2c7]),'FaxQueueId':Number(_0x4d812a['params']['id'])});}return _0x21ab0f;});}})[_0xec21('0x17')](respondWithResult(_0x43deb1,null))[_0xec21('0x28')](handleError(_0x43deb1,null));};exports[_0xec21('0x78')]=function(_0x31a4d3,_0x35e508){return db[_0xec21('0x1e')][_0xec21('0x36')]({'where':{'id':_0x31a4d3[_0xec21('0x2a')]['id']}})['then'](handleEntityNotFound(_0x35e508,null))[_0xec21('0x17')](function(_0x331b8b){if(_0x331b8b){return _0x331b8b[_0xec21('0x78')](_0x31a4d3[_0xec21('0x25')][_0xec21('0x53')])[_0xec21('0x17')](function(){if(_[_0xec21('0x79')](_0x31a4d3[_0xec21('0x25')][_0xec21('0x53')])){for(var _0x1b8346=0x0;_0x1b8346<_0x31a4d3[_0xec21('0x25')][_0xec21('0x53')]['length'];_0x1b8346+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x31a4d3[_0xec21('0x25')][_0xec21('0x53')][_0x1b8346]),'FaxQueueId':Number(_0x31a4d3['params']['id'])});}}else{socket[_0xec21('0x5e')](_0xec21('0x74'),{'UserId':Number(_0x31a4d3[_0xec21('0x25')]['ids']),'FaxQueueId':Number(_0x31a4d3[_0xec21('0x2a')]['id'])});}});}})[_0xec21('0x17')](respondWithStatusCode(_0x35e508,null))[_0xec21('0x28')](handleError(_0x35e508,null));};exports[_0xec21('0x7a')]=function(_0x3cd3f1,_0x36e590){var _0x397a2f={};var _0x293f91={};var _0x4c4eb5;var _0x5baef4;return db[_0xec21('0x1e')][_0xec21('0x7b')]({'where':{'id':_0x3cd3f1[_0xec21('0x2a')]['id']}})['then'](handleEntityNotFound(_0x36e590,null))[_0xec21('0x17')](function(_0x491840){if(_0x491840){_0x4c4eb5=_0x491840;_0x293f91[_0xec21('0x2b')]=_[_0xec21('0x2c')](db[_0xec21('0x47')][_0xec21('0x52')]);_0x293f91[_0xec21('0x25')]=_[_0xec21('0x2c')](_0x3cd3f1['query']);_0x293f91[_0xec21('0x40')]=_[_0xec21('0x2d')](_0x293f91[_0xec21('0x2b')],_0x293f91[_0xec21('0x25')]);_0x397a2f['attributes']=_[_0xec21('0x2d')](_0x293f91[_0xec21('0x2b')],qs['fields'](_0x3cd3f1[_0xec21('0x25')][_0xec21('0x2f')]));_0x397a2f['attributes']=_0x397a2f[_0xec21('0x2e')][_0xec21('0x30')]?_0x397a2f[_0xec21('0x2e')]:_0x293f91[_0xec21('0x2b')];_0x397a2f[_0xec21('0x3e')]=qs['sort'](_0x3cd3f1[_0xec21('0x25')][_0xec21('0x3f')]);_0x397a2f['where']=qs[_0xec21('0x40')](_['pick'](_0x3cd3f1[_0xec21('0x25')],_0x293f91['filters']));if(_0x3cd3f1[_0xec21('0x25')]['filter']){_0x397a2f[_0xec21('0x44')]=_['merge'](_0x397a2f['where'],{'$or':_[_0xec21('0x48')](_0x397a2f['attributes'],function(_0x57da4a){var _0x541058={};_0x541058[_0x57da4a]={'$like':'%'+_0x3cd3f1[_0xec21('0x25')]['filter']+'%'};return _0x541058;})});}_0x397a2f=_[_0xec21('0x45')]({},_0x397a2f,_0x3cd3f1[_0xec21('0x46')]);return _0x4c4eb5[_0xec21('0x7a')](_0x397a2f);}})[_0xec21('0x17')](function(_0x5df3e9){if(_0x5df3e9){_0x5baef4=_0x5df3e9[_0xec21('0x30')];if(!_0x3cd3f1['query']['hasOwnProperty']('nolimit')){_0x397a2f['limit']=qs['limit'](_0x3cd3f1[_0xec21('0x25')][_0xec21('0x12')]);_0x397a2f['offset']=qs[_0xec21('0x10')](_0x3cd3f1[_0xec21('0x25')][_0xec21('0x10')]);}return _0x4c4eb5[_0xec21('0x7a')](_0x397a2f);}})['then'](function(_0x17d05a){if(_0x17d05a){return _0x17d05a?{'count':_0x5baef4,'rows':_0x17d05a}:null;}})['then'](respondWithResult(_0x36e590,null))['catch'](handleError(_0x36e590,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 6289496..2fccc2a 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 _0xc9e2=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','update','emit'];(function(_0x2d184e,_0x48c401){var _0x780c98=function(_0x185e46){while(--_0x185e46){_0x2d184e['push'](_0x2d184e['shift']());}};_0x780c98(++_0x48c401);}(_0xc9e2,0x19a));var _0x2c9e=function(_0x209eb8,_0x5b26ce){_0x209eb8=_0x209eb8-0x0;var _0x239624=_0xc9e2[_0x209eb8];return _0x239624;};'use strict';var EventEmitter=require(_0x2c9e('0x0'));var FaxQueue=require(_0x2c9e('0x1'))['db'][_0x2c9e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2c9e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2c9e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5ee37b){return function(_0xea0f84,_0x4dc8d1,_0x52aba7){FaxQueueEvents[_0x2c9e('0x5')](_0x5ee37b+':'+_0xea0f84['id'],_0xea0f84);FaxQueueEvents[_0x2c9e('0x5')](_0x5ee37b,_0xea0f84);_0x52aba7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x2c9e('0x6')](e,emitEvent(event));}}module[_0x2c9e('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xbccf=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x310c20,_0x13a55a){var _0x3bb63b=function(_0x3ff0da){while(--_0x3ff0da){_0x310c20['push'](_0x310c20['shift']());}};_0x3bb63b(++_0x13a55a);}(_0xbccf,0x65));var _0xfbcc=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0xbccf[_0x54c9dd];return _0x855156;};'use strict';var EventEmitter=require(_0xfbcc('0x0'));var FaxQueue=require(_0xfbcc('0x1'))['db'][_0xfbcc('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xfbcc('0x3')](0x0);var events={'afterCreate':_0xfbcc('0x4'),'afterUpdate':_0xfbcc('0x5'),'afterDestroy':_0xfbcc('0x6')};function emitEvent(_0x14fd81){return function(_0x2ea054,_0x2bade0,_0x463ac5){FaxQueueEvents[_0xfbcc('0x7')](_0x14fd81+':'+_0x2ea054['id'],_0x2ea054);FaxQueueEvents[_0xfbcc('0x7')](_0x14fd81,_0x2ea054);_0x463ac5(null);};}for(var e in events){if(events[_0xfbcc('0x8')](e)){var event=events[e];FaxQueue[_0xfbcc('0x9')](e,emitEvent(event));}}module[_0xfbcc('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 9ac36ba..02cfe7e 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 _0xead9=['rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14206a,_0x266258){var _0x304578=function(_0x1a21af){while(--_0x1a21af){_0x14206a['push'](_0x14206a['shift']());}};_0x304578(++_0x266258);}(_0xead9,0x1a6));var _0x9ead=function(_0x18b189,_0x21e3ec){_0x18b189=_0x18b189-0x0;var _0x3536d1=_0xead9[_0x18b189];return _0x3536d1;};'use strict';var _=require('lodash');var util=require(_0x9ead('0x0'));var logger=require(_0x9ead('0x1'))(_0x9ead('0x2'));var moment=require(_0x9ead('0x3'));var BPromise=require(_0x9ead('0x4'));var rp=require(_0x9ead('0x5'));var fs=require('fs');var path=require(_0x9ead('0x6'));var rimraf=require(_0x9ead('0x7'));var config=require(_0x9ead('0x8'));var attributes=require(_0x9ead('0x9'));module[_0x9ead('0xa')]=function(_0x1fa803,_0x552407){return _0x1fa803[_0x9ead('0xb')]('FaxQueue',attributes,{'tableName':_0x9ead('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf322=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3c5943,_0x3aa4fe){var _0xb5439f=function(_0x457d14){while(--_0x457d14){_0x3c5943['push'](_0x3c5943['shift']());}};_0xb5439f(++_0x3aa4fe);}(_0xf322,0x10c));var _0x2f32=function(_0x1fcf28,_0x4cc9ec){_0x1fcf28=_0x1fcf28-0x0;var _0x26771f=_0xf322[_0x1fcf28];return _0x26771f;};'use strict';var _=require(_0x2f32('0x0'));var util=require('util');var logger=require(_0x2f32('0x1'))(_0x2f32('0x2'));var moment=require(_0x2f32('0x3'));var BPromise=require(_0x2f32('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f32('0x5'));var rimraf=require(_0x2f32('0x6'));var config=require(_0x2f32('0x7'));var attributes=require(_0x2f32('0x8'));module[_0x2f32('0x9')]=function(_0x4c740e,_0x2c7e40){return _0x4c740e[_0x2f32('0xa')](_0x2f32('0xb'),attributes,{'tableName':_0x2f32('0xc'),'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 2ae2c69..1fbf3b0 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 _0x8791=['error','code','message','FaxQueue,\x20%s,\x20%s','result','catch','GetFaxQueue','findAll','options','raw','include','map','model','attributes','then','ShowFaxQueue','FaxQueue','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x40bc8b,_0xe55594){var _0x4c04d3=function(_0x193cf5){while(--_0x193cf5){_0x40bc8b['push'](_0x40bc8b['shift']());}};_0x4c04d3(++_0xe55594);}(_0x8791,0x1e1));var _0x1879=function(_0x254311,_0x31a764){_0x254311=_0x254311-0x0;var _0x3a2771=_0x8791[_0x254311];return _0x3a2771;};'use strict';var _=require('lodash');var util=require(_0x1879('0x0'));var moment=require(_0x1879('0x1'));var BPromise=require(_0x1879('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1879('0x3'));var db=require(_0x1879('0x4'))['db'];var utils=require(_0x1879('0x5'));var logger=require(_0x1879('0x6'))(_0x1879('0x7'));var config=require('../../config/environment');var jayson=require(_0x1879('0x8'));var client=jayson[_0x1879('0x9')][_0x1879('0xa')]({'port':0x232a});config[_0x1879('0xb')]=_[_0x1879('0xc')](config[_0x1879('0xb')],{'host':_0x1879('0xd'),'port':0x18eb});var socket=require(_0x1879('0xe'))(new Redis(config['redis']));require(_0x1879('0xf'))[_0x1879('0x10')](socket);function respondWithRpcPromise(_0x19da1a,_0x1ca697,_0x2a5a08){return new BPromise(function(_0x12b3bc,_0x28cd86){return client[_0x1879('0x11')](_0x19da1a,_0x2a5a08)['then'](function(_0x2a92e7){logger[_0x1879('0x12')]('FaxQueue,\x20%s,\x20%s',_0x1ca697,_0x1879('0x13'));logger[_0x1879('0x14')](_0x1879('0x15'),_0x1ca697,_0x1879('0x13'),JSON[_0x1879('0x16')](_0x2a92e7));if(_0x2a92e7['error']){if(_0x2a92e7[_0x1879('0x17')][_0x1879('0x18')]===0x1f4){logger[_0x1879('0x17')]('FaxQueue,\x20%s,\x20%s',_0x1ca697,_0x2a92e7[_0x1879('0x17')]['message']);return _0x28cd86(_0x2a92e7[_0x1879('0x17')][_0x1879('0x19')]);}logger[_0x1879('0x17')](_0x1879('0x1a'),_0x1ca697,_0x2a92e7[_0x1879('0x17')][_0x1879('0x19')]);return _0x12b3bc(_0x2a92e7[_0x1879('0x17')][_0x1879('0x19')]);}else{logger[_0x1879('0x12')]('FaxQueue,\x20%s,\x20%s',_0x1ca697,_0x1879('0x13'));_0x12b3bc(_0x2a92e7[_0x1879('0x1b')][_0x1879('0x19')]);}})[_0x1879('0x1c')](function(_0x4f95a9){logger[_0x1879('0x17')]('FaxQueue,\x20%s,\x20%s',_0x1ca697,_0x4f95a9);_0x28cd86(_0x4f95a9);});});}exports[_0x1879('0x1d')]=function(_0x3d69ae){var _0x2fe816=this;return new Promise(function(_0x4d815d,_0x3e358f){return db['FaxQueue'][_0x1879('0x1e')]({'raw':_0x3d69ae['options']?_0x3d69ae[_0x1879('0x1f')][_0x1879('0x20')]===undefined?!![]:![]:!![],'where':_0x3d69ae[_0x1879('0x1f')]?_0x3d69ae['options']['where']||null:null,'attributes':_0x3d69ae[_0x1879('0x1f')]?_0x3d69ae[_0x1879('0x1f')]['attributes']||null:null,'limit':_0x3d69ae[_0x1879('0x1f')]?_0x3d69ae['options']['limit']||null:null,'include':_0x3d69ae['options']?_0x3d69ae['options'][_0x1879('0x21')]?_[_0x1879('0x22')](_0x3d69ae['options'][_0x1879('0x21')],function(_0x3253cb){return{'model':db[_0x3253cb[_0x1879('0x23')]],'as':_0x3253cb['as'],'attributes':_0x3253cb[_0x1879('0x24')],'include':_0x3253cb[_0x1879('0x21')]?_[_0x1879('0x22')](_0x3253cb['include'],function(_0x7da7fa){return{'model':db[_0x7da7fa['model']],'as':_0x7da7fa['as'],'attributes':_0x7da7fa['attributes'],'include':_0x7da7fa[_0x1879('0x21')]?_[_0x1879('0x22')](_0x7da7fa[_0x1879('0x21')],function(_0xaaa7a5){return{'model':db[_0xaaa7a5[_0x1879('0x23')]],'as':_0xaaa7a5['as'],'attributes':_0xaaa7a5[_0x1879('0x24')]};}):[]};}):[]};}):[]:[]})[_0x1879('0x25')](function(_0x3d2029){logger[_0x1879('0x12')]('GetFaxQueue',_0x3d69ae);logger[_0x1879('0x14')](_0x1879('0x1d'),_0x3d69ae,JSON[_0x1879('0x16')](_0x3d2029));_0x4d815d(_0x3d2029);})[_0x1879('0x1c')](function(_0x3af0c3){logger[_0x1879('0x17')](_0x1879('0x1d'),_0x3af0c3[_0x1879('0x19')],_0x3d69ae);_0x3e358f(_0x2fe816[_0x1879('0x17')](0x1f4,_0x3af0c3['message']));});});};exports[_0x1879('0x26')]=function(_0xfff8b){var _0x734e91=this;return new Promise(function(_0x4be913,_0x4a269a){return db[_0x1879('0x27')][_0x1879('0x28')]({'raw':_0xfff8b[_0x1879('0x1f')]?_0xfff8b[_0x1879('0x1f')][_0x1879('0x20')]===undefined?!![]:![]:!![],'where':_0xfff8b[_0x1879('0x1f')]?_0xfff8b[_0x1879('0x1f')][_0x1879('0x29')]||null:null,'attributes':_0xfff8b['options']?_0xfff8b[_0x1879('0x1f')][_0x1879('0x24')]||null:null,'include':_0xfff8b[_0x1879('0x1f')]?_0xfff8b[_0x1879('0x1f')]['include']?_[_0x1879('0x22')](_0xfff8b[_0x1879('0x1f')][_0x1879('0x21')],function(_0x400003){return{'model':db[_0x400003[_0x1879('0x23')]],'as':_0x400003['as'],'attributes':_0x400003[_0x1879('0x24')],'include':_0x400003[_0x1879('0x21')]?_[_0x1879('0x22')](_0x400003[_0x1879('0x21')],function(_0x1436fa){return{'model':db[_0x1436fa[_0x1879('0x23')]],'as':_0x1436fa['as'],'attributes':_0x1436fa[_0x1879('0x24')],'include':_0x1436fa[_0x1879('0x21')]?_[_0x1879('0x22')](_0x1436fa[_0x1879('0x21')],function(_0x2d4d36){return{'model':db[_0x2d4d36[_0x1879('0x23')]],'as':_0x2d4d36['as'],'attributes':_0x2d4d36['attributes']};}):[]};}):[]};}):[]:[]})[_0x1879('0x25')](function(_0x1d06f9){logger[_0x1879('0x12')](_0x1879('0x26'),_0xfff8b);logger['debug'](_0x1879('0x26'),_0xfff8b,JSON[_0x1879('0x16')](_0x1d06f9));_0x4be913(_0x1d06f9);})[_0x1879('0x1c')](function(_0x4fb23e){logger['error'](_0x1879('0x26'),_0x4fb23e['message'],_0xfff8b);_0x4a269a(_0x734e91[_0x1879('0x17')](0x1f4,_0x4fb23e[_0x1879('0x19')]));});});}; \ No newline at end of file +var _0xb186=['result','catch','GetFaxQueue','FaxQueue','findAll','raw','options','where','attributes','map','include','model','ShowFaxQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x41b986,_0x5a1dc2){var _0x5ede09=function(_0x2b91ff){while(--_0x2b91ff){_0x41b986['push'](_0x41b986['shift']());}};_0x5ede09(++_0x5a1dc2);}(_0xb186,0x14d));var _0x6b18=function(_0x5a93f0,_0x172b1b){_0x5a93f0=_0x5a93f0-0x0;var _0x53844d=_0xb186[_0x5a93f0];return _0x53844d;};'use strict';var _=require(_0x6b18('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6b18('0x1'));var rs=require(_0x6b18('0x2'));var fs=require('fs');var Redis=require(_0x6b18('0x3'));var db=require(_0x6b18('0x4'))['db'];var utils=require(_0x6b18('0x5'));var logger=require(_0x6b18('0x6'))(_0x6b18('0x7'));var config=require(_0x6b18('0x8'));var jayson=require(_0x6b18('0x9'));var client=jayson[_0x6b18('0xa')][_0x6b18('0xb')]({'port':0x232a});config['redis']=_[_0x6b18('0xc')](config['redis'],{'host':_0x6b18('0xd'),'port':0x18eb});var socket=require(_0x6b18('0xe'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x6b18('0xf')](socket);function respondWithRpcPromise(_0x56dfb2,_0x52e93b,_0xbce3b4){return new BPromise(function(_0x4ce044,_0x26945c){return client[_0x6b18('0x10')](_0x56dfb2,_0xbce3b4)[_0x6b18('0x11')](function(_0x485781){logger[_0x6b18('0x12')](_0x6b18('0x13'),_0x52e93b,_0x6b18('0x14'));logger[_0x6b18('0x15')](_0x6b18('0x16'),_0x52e93b,_0x6b18('0x14'),JSON[_0x6b18('0x17')](_0x485781));if(_0x485781[_0x6b18('0x18')]){if(_0x485781[_0x6b18('0x18')][_0x6b18('0x19')]===0x1f4){logger[_0x6b18('0x18')](_0x6b18('0x13'),_0x52e93b,_0x485781[_0x6b18('0x18')][_0x6b18('0x1a')]);return _0x26945c(_0x485781[_0x6b18('0x18')][_0x6b18('0x1a')]);}logger[_0x6b18('0x18')](_0x6b18('0x13'),_0x52e93b,_0x485781[_0x6b18('0x18')][_0x6b18('0x1a')]);return _0x4ce044(_0x485781[_0x6b18('0x18')][_0x6b18('0x1a')]);}else{logger[_0x6b18('0x12')]('FaxQueue,\x20%s,\x20%s',_0x52e93b,_0x6b18('0x14'));_0x4ce044(_0x485781[_0x6b18('0x1b')][_0x6b18('0x1a')]);}})[_0x6b18('0x1c')](function(_0x41e336){logger[_0x6b18('0x18')](_0x6b18('0x13'),_0x52e93b,_0x41e336);_0x26945c(_0x41e336);});});}exports[_0x6b18('0x1d')]=function(_0x202026){var _0x122a9d=this;return new Promise(function(_0x11d61d,_0x3edb88){return db[_0x6b18('0x1e')][_0x6b18('0x1f')]({'raw':_0x202026['options']?_0x202026['options'][_0x6b18('0x20')]===undefined?!![]:![]:!![],'where':_0x202026[_0x6b18('0x21')]?_0x202026[_0x6b18('0x21')][_0x6b18('0x22')]||null:null,'attributes':_0x202026[_0x6b18('0x21')]?_0x202026[_0x6b18('0x21')][_0x6b18('0x23')]||null:null,'limit':_0x202026[_0x6b18('0x21')]?_0x202026[_0x6b18('0x21')]['limit']||null:null,'include':_0x202026[_0x6b18('0x21')]?_0x202026['options']['include']?_[_0x6b18('0x24')](_0x202026[_0x6b18('0x21')][_0x6b18('0x25')],function(_0x46d049){return{'model':db[_0x46d049['model']],'as':_0x46d049['as'],'attributes':_0x46d049[_0x6b18('0x23')],'include':_0x46d049[_0x6b18('0x25')]?_[_0x6b18('0x24')](_0x46d049[_0x6b18('0x25')],function(_0x5c5b69){return{'model':db[_0x5c5b69[_0x6b18('0x26')]],'as':_0x5c5b69['as'],'attributes':_0x5c5b69['attributes'],'include':_0x5c5b69[_0x6b18('0x25')]?_['map'](_0x5c5b69[_0x6b18('0x25')],function(_0x505c18){return{'model':db[_0x505c18['model']],'as':_0x505c18['as'],'attributes':_0x505c18[_0x6b18('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6b18('0x11')](function(_0x5f0bf3){logger[_0x6b18('0x12')]('GetFaxQueue',_0x202026);logger[_0x6b18('0x15')]('GetFaxQueue',_0x202026,JSON[_0x6b18('0x17')](_0x5f0bf3));_0x11d61d(_0x5f0bf3);})[_0x6b18('0x1c')](function(_0x154833){logger['error'](_0x6b18('0x1d'),_0x154833[_0x6b18('0x1a')],_0x202026);_0x3edb88(_0x122a9d[_0x6b18('0x18')](0x1f4,_0x154833[_0x6b18('0x1a')]));});});};exports[_0x6b18('0x27')]=function(_0x1684fd){var _0x3746ba=this;return new Promise(function(_0x6f780a,_0x19d447){return db[_0x6b18('0x1e')]['find']({'raw':_0x1684fd[_0x6b18('0x21')]?_0x1684fd[_0x6b18('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x1684fd[_0x6b18('0x21')]?_0x1684fd[_0x6b18('0x21')]['where']||null:null,'attributes':_0x1684fd[_0x6b18('0x21')]?_0x1684fd['options'][_0x6b18('0x23')]||null:null,'include':_0x1684fd[_0x6b18('0x21')]?_0x1684fd[_0x6b18('0x21')][_0x6b18('0x25')]?_[_0x6b18('0x24')](_0x1684fd['options'][_0x6b18('0x25')],function(_0x40ff59){return{'model':db[_0x40ff59[_0x6b18('0x26')]],'as':_0x40ff59['as'],'attributes':_0x40ff59[_0x6b18('0x23')],'include':_0x40ff59['include']?_['map'](_0x40ff59['include'],function(_0x47c243){return{'model':db[_0x47c243['model']],'as':_0x47c243['as'],'attributes':_0x47c243[_0x6b18('0x23')],'include':_0x47c243[_0x6b18('0x25')]?_['map'](_0x47c243[_0x6b18('0x25')],function(_0x3304fb){return{'model':db[_0x3304fb[_0x6b18('0x26')]],'as':_0x3304fb['as'],'attributes':_0x3304fb[_0x6b18('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6b18('0x11')](function(_0x28463a){logger[_0x6b18('0x12')](_0x6b18('0x27'),_0x1684fd);logger[_0x6b18('0x15')](_0x6b18('0x27'),_0x1684fd,JSON['stringify'](_0x28463a));_0x6f780a(_0x28463a);})[_0x6b18('0x1c')](function(_0x1edb20){logger[_0x6b18('0x18')](_0x6b18('0x27'),_0x1edb20[_0x6b18('0x1a')],_0x1684fd);_0x19d447(_0x3746ba['error'](0x1f4,_0x1edb20['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 83e29b3..3418f97 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 _0x38db=['register','length','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x14c8a9,_0x3033ad){var _0x1f74b9=function(_0xb9b783){while(--_0xb9b783){_0x14c8a9['push'](_0x14c8a9['shift']());}};_0x1f74b9(++_0x3033ad);}(_0x38db,0x18a));var _0xb38d=function(_0x452552,_0x9428f9){_0x452552=_0x452552-0x0;var _0x13b606=_0x38db[_0x452552];return _0x13b606;};'use strict';var FaxQueueEvents=require(_0xb38d('0x0'));var events=[_0xb38d('0x1'),_0xb38d('0x2'),_0xb38d('0x3')];function createListener(_0x1885b8,_0x2f2e96){return function(_0x4ee52d){_0x2f2e96[_0xb38d('0x4')](_0x1885b8,_0x4ee52d);};}function removeListener(_0x381e52,_0xb13683){return function(){FaxQueueEvents[_0xb38d('0x5')](_0x381e52,_0xb13683);};}exports[_0xb38d('0x6')]=function(_0x436792){for(var _0x3d5042=0x0,_0x58fbdc=events[_0xb38d('0x7')];_0x3d5042<_0x58fbdc;_0x3d5042++){var _0x5ed0d8=events[_0x3d5042];var _0x14947b=createListener('faxQueue:'+_0x5ed0d8,_0x436792);FaxQueueEvents['on'](_0x5ed0d8,_0x14947b);}}; \ No newline at end of file +var _0x0a9e=['remove','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x465ecf,_0x1eafdf){var _0x40accf=function(_0x3dd422){while(--_0x3dd422){_0x465ecf['push'](_0x465ecf['shift']());}};_0x40accf(++_0x1eafdf);}(_0x0a9e,0x1c5));var _0xe0a9=function(_0x5d651a,_0x3f5587){_0x5d651a=_0x5d651a-0x0;var _0x1917d4=_0x0a9e[_0x5d651a];return _0x1917d4;};'use strict';var FaxQueueEvents=require(_0xe0a9('0x0'));var events=[_0xe0a9('0x1'),_0xe0a9('0x2'),'update'];function createListener(_0x26f259,_0x37cd2c){return function(_0xa8d2d1){_0x37cd2c['emit'](_0x26f259,_0xa8d2d1);};}function removeListener(_0x106a6a,_0x53af0a){return function(){FaxQueueEvents[_0xe0a9('0x3')](_0x106a6a,_0x53af0a);};}exports[_0xe0a9('0x4')]=function(_0x498120){for(var _0x5ea7a8=0x0,_0x1270f8=events[_0xe0a9('0x5')];_0x5ea7a8<_0x1270f8;_0x5ea7a8++){var _0x24b018=events[_0x5ea7a8];var _0x4242e4=createListener(_0xe0a9('0x6')+_0x24b018,_0x498120);FaxQueueEvents['on'](_0x24b018,_0x4242e4);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 9d94995..97618c3 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 _0x6931=['post','create','addAgents','removeTeams','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x178c6f,_0x1de7fe){var _0x6e3770=function(_0x322fb1){while(--_0x322fb1){_0x178c6f['push'](_0x178c6f['shift']());}};_0x6e3770(++_0x1de7fe);}(_0x6931,0x1a9));var _0x1693=function(_0xbbca29,_0x38c765){_0xbbca29=_0xbbca29-0x0;var _0x887f72=_0x6931[_0xbbca29];return _0x887f72;};'use strict';var multer=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var path=require(_0x1693('0x2'));var timeout=require(_0x1693('0x3'));var express=require(_0x1693('0x4'));var router=express[_0x1693('0x5')]();var fs_extra=require(_0x1693('0x6'));var auth=require(_0x1693('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1693('0x8'));var controller=require(_0x1693('0x9'));router[_0x1693('0xa')]('/',auth[_0x1693('0xb')](),controller[_0x1693('0xc')]);router['get'](_0x1693('0xd'),auth[_0x1693('0xb')](),controller[_0x1693('0xe')]);router['get'](_0x1693('0xf'),auth[_0x1693('0xb')](),controller[_0x1693('0x10')]);router[_0x1693('0xa')](_0x1693('0x11'),auth[_0x1693('0xb')](),controller[_0x1693('0x12')]);router[_0x1693('0xa')](_0x1693('0x13'),auth[_0x1693('0xb')](),controller[_0x1693('0x14')]);router['get'](_0x1693('0x15'),auth[_0x1693('0xb')](),controller[_0x1693('0x16')]);router[_0x1693('0x17')]('/',auth[_0x1693('0xb')](),controller[_0x1693('0x18')]);router[_0x1693('0x17')]('/:id/teams',auth[_0x1693('0xb')](),controller['addTeams']);router[_0x1693('0x17')]('/:id/users',auth[_0x1693('0xb')](),controller[_0x1693('0x19')]);router['put']('/:id',auth[_0x1693('0xb')](),controller['update']);router['delete']('/:id',auth[_0x1693('0xb')](),controller['destroy']);router['delete'](_0x1693('0x13'),auth[_0x1693('0xb')](),controller[_0x1693('0x1a')]);router[_0x1693('0x1b')](_0x1693('0x15'),auth[_0x1693('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x430c=['post','create','/:id/teams','/:id/users','addAgents','put','destroy','delete','removeAgents','multer','connect-timeout','express','Router','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getAgents'];(function(_0x15de11,_0x3cd20d){var _0x4f1c07=function(_0xf74624){while(--_0xf74624){_0x15de11['push'](_0x15de11['shift']());}};_0x4f1c07(++_0x3cd20d);}(_0x430c,0x1a1));var _0xc430=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0x430c[_0x33dcf7];return _0x542d4e;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('0x3')]();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(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0x5')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0xd')]);router[_0xc430('0x5')]('/:id/teams',auth[_0xc430('0x8')](),controller['getTeams']);router[_0xc430('0x5')]('/:id/users',auth[_0xc430('0x8')](),controller[_0xc430('0xe')]);router[_0xc430('0xf')]('/',auth[_0xc430('0x8')](),controller[_0xc430('0x10')]);router[_0xc430('0xf')](_0xc430('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0xc430('0xf')](_0xc430('0x12'),auth[_0xc430('0x8')](),controller[_0xc430('0x13')]);router[_0xc430('0x14')]('/:id',auth[_0xc430('0x8')](),controller['update']);router['delete'](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0x15')]);router['delete']('/:id/teams',auth[_0xc430('0x8')](),controller['removeTeams']);router[_0xc430('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xc430('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index bc9e1cd..d800c0e 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 _0xe889=['STRING','DATE','moment','sequelize'];(function(_0x2a863f,_0x3e7a74){var _0x525dac=function(_0x476b9f){while(--_0x476b9f){_0x2a863f['push'](_0x2a863f['shift']());}};_0x525dac(++_0x3e7a74);}(_0xe889,0xd6));var _0x9e88=function(_0x555740,_0x4f2067){_0x555740=_0x555740-0x0;var _0x201490=_0xe889[_0x555740];return _0x201490;};'use strict';var moment=require(_0x9e88('0x0'));var Sequelize=require(_0x9e88('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9e88('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9e88('0x2')]},'joinAt':{'type':Sequelize[_0x9e88('0x3')]},'leaveAt':{'type':Sequelize[_0x9e88('0x3')]},'acceptAt':{'type':Sequelize[_0x9e88('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbef8=['exports','DATE','moment','sequelize'];(function(_0x517ff2,_0x1f4ae7){var _0xb46dd6=function(_0x6f9f5d){while(--_0x6f9f5d){_0x517ff2['push'](_0x517ff2['shift']());}};_0xb46dd6(++_0x1f4ae7);}(_0xbef8,0x1ea));var _0x8bef=function(_0x4b6c93,_0x2baa13){_0x4b6c93=_0x4b6c93-0x0;var _0x21e4dd=_0xbef8[_0x4b6c93];return _0x21e4dd;};'use strict';var moment=require(_0x8bef('0x0'));var Sequelize=require(_0x8bef('0x1'));module[_0x8bef('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8bef('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8bef('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index ac253b1..d75fef8 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 _0x028d=['nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','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','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x33aad0,_0x26f6ab){var _0x35512a=function(_0x477db5){while(--_0x477db5){_0x33aad0['push'](_0x33aad0['shift']());}};_0x35512a(++_0x26f6ab);}(_0x028d,0xff));var _0xd028=function(_0x11278a,_0x97706c){_0x11278a=_0x11278a-0x0;var _0x11d9af=_0x028d[_0x11278a];return _0x11d9af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd028('0x0'));var zipdir=require(_0xd028('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd028('0x2'));var moment=require(_0xd028('0x3'));var BPromise=require(_0xd028('0x4'));var Mustache=require(_0xd028('0x5'));var util=require(_0xd028('0x6'));var path=require(_0xd028('0x7'));var sox=require('sox');var csv=require(_0xd028('0x8'));var ejs=require(_0xd028('0x9'));var fs=require('fs');var fs_extra=require(_0xd028('0xa'));var _=require(_0xd028('0xb'));var squel=require(_0xd028('0xc'));var crypto=require(_0xd028('0xd'));var jsforce=require(_0xd028('0xe'));var deskjs=require(_0xd028('0xf'));var toCsv=require(_0xd028('0x8'));var querystring=require(_0xd028('0x10'));var Papa=require(_0xd028('0x11'));var Redis=require(_0xd028('0x12'));var authService=require(_0xd028('0x13'));var qs=require(_0xd028('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd028('0x15'));var logger=require(_0xd028('0x16'))(_0xd028('0x17'));var utils=require(_0xd028('0x18'));var config=require(_0xd028('0x19'));var licenseUtil=require(_0xd028('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34b5fa,_0x144696){_0x144696=_0x144696||0xcc;return function(_0x4817a4){if(_0x4817a4){return _0x34b5fa[_0xd028('0x1b')](_0x144696);}return _0x34b5fa[_0xd028('0x1c')](_0x144696)[_0xd028('0x1d')]();};}function respondWithResult(_0x17b112,_0x1667bf){_0x1667bf=_0x1667bf||0xc8;return function(_0x5ec067){if(_0x5ec067){return _0x17b112[_0xd028('0x1c')](_0x1667bf)[_0xd028('0x1e')](_0x5ec067);}};}function respondWithFilteredResult(_0x3937b4,_0x3bac54){return function(_0x12450d){if(_0x12450d){var _0x463d38=typeof _0x3bac54['offset']===_0xd028('0x1f')&&typeof _0x3bac54['limit']===_0xd028('0x1f');var _0x2f4af6=_0x12450d[_0xd028('0x20')];var _0x4df54f=_0x463d38?0x0:_0x3bac54[_0xd028('0x21')];var _0x5a47a6=_0x463d38?_0x12450d[_0xd028('0x20')]:_0x3bac54['offset']+_0x3bac54[_0xd028('0x22')];var _0x415d6c;if(_0x5a47a6>=_0x2f4af6){_0x5a47a6=_0x2f4af6;_0x415d6c=0xc8;}else{_0x415d6c=0xce;}_0x3937b4[_0xd028('0x1c')](_0x415d6c);return _0x3937b4['set'](_0xd028('0x23'),_0x4df54f+'-'+_0x5a47a6+'/'+_0x2f4af6)[_0xd028('0x1e')](_0x12450d);}return null;};}function patchUpdates(_0x1a2767){return function(_0x1648a7){try{jsonpatch[_0xd028('0x24')](_0x1648a7,_0x1a2767,!![]);}catch(_0x4830a4){return BPromise[_0xd028('0x25')](_0x4830a4);}return _0x1648a7[_0xd028('0x26')]();};}function saveUpdates(_0x8a964d,_0x75657f){return function(_0x3203f9){if(_0x3203f9){return _0x3203f9[_0xd028('0x27')](_0x8a964d)[_0xd028('0x28')](function(_0x54beee){return _0x54beee;});}return null;};}function removeEntity(_0x115fef,_0x10d629){return function(_0x13e5f4){if(_0x13e5f4){return _0x13e5f4[_0xd028('0x29')]()['then'](function(){_0x115fef[_0xd028('0x1c')](0xcc)[_0xd028('0x1d')]();});}};}function handleEntityNotFound(_0x26eb4e,_0x3249ea){return function(_0x5b9f3d){if(!_0x5b9f3d){_0x26eb4e[_0xd028('0x1b')](0x194);}return _0x5b9f3d;};}function handleError(_0x128c63,_0x115004){_0x115004=_0x115004||0x1f4;return function(_0x3481be){logger[_0xd028('0x2a')](_0x3481be[_0xd028('0x2b')]);if(_0x3481be[_0xd028('0x2c')]){delete _0x3481be[_0xd028('0x2c')];}_0x128c63[_0xd028('0x1c')](_0x115004)[_0xd028('0x2d')](_0x3481be);};}exports[_0xd028('0x2e')]=function(_0x3112e8,_0x112578){var _0x17594f={},_0x23d9dd={},_0x3b46bb={'count':0x0,'rows':[]};var _0x5d6f95=_['map'](db[_0xd028('0x2f')][_0xd028('0x30')],function(_0x2caf5d){return{'name':_0x2caf5d[_0xd028('0x31')],'type':_0x2caf5d[_0xd028('0x32')][_0xd028('0x33')]};});_0x23d9dd['model']=_['map'](_0x5d6f95,_0xd028('0x2c'));_0x23d9dd[_0xd028('0x34')]=_[_0xd028('0x35')](_0x3112e8[_0xd028('0x34')]);_0x23d9dd[_0xd028('0x36')]=_[_0xd028('0x37')](_0x23d9dd[_0xd028('0x38')],_0x23d9dd['query']);_0x17594f['attributes']=_[_0xd028('0x37')](_0x23d9dd[_0xd028('0x38')],qs['fields'](_0x3112e8['query'][_0xd028('0x39')]));_0x17594f[_0xd028('0x3a')]=_0x17594f[_0xd028('0x3a')][_0xd028('0x3b')]?_0x17594f[_0xd028('0x3a')]:_0x23d9dd[_0xd028('0x38')];if(!_0x3112e8[_0xd028('0x34')][_0xd028('0x3c')](_0xd028('0x3d'))){_0x17594f[_0xd028('0x22')]=qs[_0xd028('0x22')](_0x3112e8['query']['limit']);_0x17594f['offset']=qs['offset'](_0x3112e8['query'][_0xd028('0x21')]);}_0x17594f['order']=qs['sort'](_0x3112e8['query'][_0xd028('0x3e')]);_0x17594f['where']=qs[_0xd028('0x36')](_['pick'](_0x3112e8['query'],_0x23d9dd[_0xd028('0x36')]),_0x5d6f95);if(_0x3112e8[_0xd028('0x34')]['filter']){_0x17594f[_0xd028('0x3f')]=_['merge'](_0x17594f['where'],{'$or':_['map'](_0x5d6f95,function(_0x5941ed){if(_0x5941ed['type']!==_0xd028('0x40')){var _0x24ba63={};_0x24ba63[_0x5941ed['name']]={'$like':'%'+_0x3112e8[_0xd028('0x34')][_0xd028('0x41')]+'%'};return _0x24ba63;}})});}_0x17594f=_[_0xd028('0x42')]({},_0x17594f,_0x3112e8[_0xd028('0x43')]);var _0xc79c76={'where':_0x17594f[_0xd028('0x3f')]};return db['FaxQueueReport'][_0xd028('0x20')](_0xc79c76)[_0xd028('0x28')](function(_0x2d5fab){_0x3b46bb['count']=_0x2d5fab;if(_0x3112e8[_0xd028('0x34')][_0xd028('0x44')]){_0x17594f[_0xd028('0x45')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xd028('0x46')](_0x17594f);})['then'](function(_0x26e51c){_0x3b46bb[_0xd028('0x47')]=_0x26e51c;return _0x3b46bb;})[_0xd028('0x28')](respondWithFilteredResult(_0x112578,_0x17594f))[_0xd028('0x48')](handleError(_0x112578,null));};exports[_0xd028('0x49')]=function(_0x3f86ed,_0x1de847){var _0x42a3fc={'raw':!![],'where':{'id':_0x3f86ed['params']['id']}},_0x3065f2={};_0x3065f2[_0xd028('0x38')]=_[_0xd028('0x35')](db[_0xd028('0x2f')][_0xd028('0x30')]);_0x3065f2['query']=_[_0xd028('0x35')](_0x3f86ed[_0xd028('0x34')]);_0x3065f2[_0xd028('0x36')]=_['intersection'](_0x3065f2[_0xd028('0x38')],_0x3065f2[_0xd028('0x34')]);_0x42a3fc['attributes']=_[_0xd028('0x37')](_0x3065f2[_0xd028('0x38')],qs[_0xd028('0x39')](_0x3f86ed[_0xd028('0x34')][_0xd028('0x39')]));_0x42a3fc[_0xd028('0x3a')]=_0x42a3fc[_0xd028('0x3a')][_0xd028('0x3b')]?_0x42a3fc[_0xd028('0x3a')]:_0x3065f2[_0xd028('0x38')];if(_0x3f86ed['query'][_0xd028('0x44')]){_0x42a3fc[_0xd028('0x45')]=[{'all':!![]}];}_0x42a3fc=_[_0xd028('0x42')]({},_0x42a3fc,_0x3f86ed[_0xd028('0x43')]);return db[_0xd028('0x2f')][_0xd028('0x4a')](_0x42a3fc)['then'](handleEntityNotFound(_0x1de847,null))[_0xd028('0x28')](respondWithResult(_0x1de847,null))[_0xd028('0x48')](handleError(_0x1de847,null));};exports[_0xd028('0x4b')]=function(_0xf0bd53,_0x30d7b6){return db['FaxQueueReport']['create'](_0xf0bd53['body'],{})['then'](respondWithResult(_0x30d7b6,0xc9))[_0xd028('0x48')](handleError(_0x30d7b6,null));};exports[_0xd028('0x27')]=function(_0x2ca45d,_0x3db4b8){if(_0x2ca45d[_0xd028('0x4c')]['id']){delete _0x2ca45d[_0xd028('0x4c')]['id'];}return db[_0xd028('0x2f')][_0xd028('0x4a')]({'where':{'id':_0x2ca45d[_0xd028('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3db4b8,null))[_0xd028('0x28')](saveUpdates(_0x2ca45d[_0xd028('0x4c')],null))[_0xd028('0x28')](respondWithResult(_0x3db4b8,null))[_0xd028('0x48')](handleError(_0x3db4b8,null));};exports[_0xd028('0x29')]=function(_0x13b619,_0x4a2c39){return db['FaxQueueReport'][_0xd028('0x4a')]({'where':{'id':_0x13b619[_0xd028('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4a2c39,null))[_0xd028('0x28')](removeEntity(_0x4a2c39,null))[_0xd028('0x48')](handleError(_0x4a2c39,null));};exports[_0xd028('0x4e')]=function(_0x1d337d,_0x29d5d2){return db[_0xd028('0x2f')][_0xd028('0x4e')]()[_0xd028('0x28')](respondWithResult(_0x29d5d2,null))[_0xd028('0x48')](handleError(_0x29d5d2,null));}; \ No newline at end of file +var _0xca66=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','name','send','FaxQueueReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','merge','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra'];(function(_0x1995a2,_0x7d41f4){var _0x43c7ca=function(_0x4aee15){while(--_0x4aee15){_0x1995a2['push'](_0x1995a2['shift']());}};_0x43c7ca(++_0x7d41f4);}(_0xca66,0x8b));var _0x6ca6=function(_0x46da65,_0x3b621d){_0x46da65=_0x46da65-0x0;var _0x98e0ad=_0xca66[_0x46da65];return _0x98e0ad;};'use strict';var emlformat=require(_0x6ca6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ca6('0x1'));var rp=require(_0x6ca6('0x2'));var moment=require(_0x6ca6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ca6('0x4'));var util=require('util');var path=require(_0x6ca6('0x5'));var sox=require('sox');var csv=require(_0x6ca6('0x6'));var ejs=require(_0x6ca6('0x7'));var fs=require('fs');var fs_extra=require(_0x6ca6('0x8'));var _=require(_0x6ca6('0x9'));var squel=require(_0x6ca6('0xa'));var crypto=require(_0x6ca6('0xb'));var jsforce=require(_0x6ca6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca6('0x6'));var querystring=require(_0x6ca6('0xd'));var Papa=require(_0x6ca6('0xe'));var Redis=require(_0x6ca6('0xf'));var authService=require(_0x6ca6('0x10'));var qs=require(_0x6ca6('0x11'));var as=require(_0x6ca6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca6('0x13'))(_0x6ca6('0x14'));var utils=require(_0x6ca6('0x15'));var config=require(_0x6ca6('0x16'));var licenseUtil=require(_0x6ca6('0x17'));var db=require(_0x6ca6('0x18'))['db'];function respondWithStatusCode(_0x4c05e9,_0x152e63){_0x152e63=_0x152e63||0xcc;return function(_0x38de67){if(_0x38de67){return _0x4c05e9['sendStatus'](_0x152e63);}return _0x4c05e9[_0x6ca6('0x19')](_0x152e63)[_0x6ca6('0x1a')]();};}function respondWithResult(_0x3f417f,_0x3570f1){_0x3570f1=_0x3570f1||0xc8;return function(_0xc774c){if(_0xc774c){return _0x3f417f[_0x6ca6('0x19')](_0x3570f1)['json'](_0xc774c);}};}function respondWithFilteredResult(_0x52c59a,_0x5785b1){return function(_0x36ff3e){if(_0x36ff3e){var _0x19e94f=typeof _0x5785b1[_0x6ca6('0x1b')]===_0x6ca6('0x1c')&&typeof _0x5785b1[_0x6ca6('0x1d')]===_0x6ca6('0x1c');var _0x25dc6c=_0x36ff3e['count'];var _0x2391ce=_0x19e94f?0x0:_0x5785b1[_0x6ca6('0x1b')];var _0xc97f0=_0x19e94f?_0x36ff3e[_0x6ca6('0x1e')]:_0x5785b1[_0x6ca6('0x1b')]+_0x5785b1[_0x6ca6('0x1d')];var _0x16a3d7;if(_0xc97f0>=_0x25dc6c){_0xc97f0=_0x25dc6c;_0x16a3d7=0xc8;}else{_0x16a3d7=0xce;}_0x52c59a[_0x6ca6('0x19')](_0x16a3d7);return _0x52c59a[_0x6ca6('0x1f')](_0x6ca6('0x20'),_0x2391ce+'-'+_0xc97f0+'/'+_0x25dc6c)[_0x6ca6('0x21')](_0x36ff3e);}return null;};}function patchUpdates(_0x4c3be9){return function(_0x28a982){try{jsonpatch[_0x6ca6('0x22')](_0x28a982,_0x4c3be9,!![]);}catch(_0x38cad4){return BPromise[_0x6ca6('0x23')](_0x38cad4);}return _0x28a982[_0x6ca6('0x24')]();};}function saveUpdates(_0x438694,_0x593f15){return function(_0xfb962d){if(_0xfb962d){return _0xfb962d[_0x6ca6('0x25')](_0x438694)['then'](function(_0x4927c1){return _0x4927c1;});}return null;};}function removeEntity(_0xfbf496,_0x216701){return function(_0xfe0760){if(_0xfe0760){return _0xfe0760[_0x6ca6('0x26')]()[_0x6ca6('0x27')](function(){_0xfbf496['status'](0xcc)[_0x6ca6('0x1a')]();});}};}function handleEntityNotFound(_0x1d6caa,_0x1c43ee){return function(_0x2d8c64){if(!_0x2d8c64){_0x1d6caa[_0x6ca6('0x28')](0x194);}return _0x2d8c64;};}function handleError(_0x29f37e,_0x3c32ae){_0x3c32ae=_0x3c32ae||0x1f4;return function(_0x2a1e2d){logger['error'](_0x2a1e2d['stack']);if(_0x2a1e2d[_0x6ca6('0x29')]){delete _0x2a1e2d[_0x6ca6('0x29')];}_0x29f37e[_0x6ca6('0x19')](_0x3c32ae)[_0x6ca6('0x2a')](_0x2a1e2d);};}exports['index']=function(_0x5ea6f7,_0x306583){var _0x47cf48={},_0x4ab84c={},_0x141e78={'count':0x0,'rows':[]};var _0xefd407=_['map'](db[_0x6ca6('0x2b')][_0x6ca6('0x2c')],function(_0xac50e8){return{'name':_0xac50e8[_0x6ca6('0x2d')],'type':_0xac50e8['type'][_0x6ca6('0x2e')]};});_0x4ab84c[_0x6ca6('0x2f')]=_[_0x6ca6('0x30')](_0xefd407,_0x6ca6('0x29'));_0x4ab84c['query']=_[_0x6ca6('0x31')](_0x5ea6f7[_0x6ca6('0x32')]);_0x4ab84c[_0x6ca6('0x33')]=_[_0x6ca6('0x34')](_0x4ab84c['model'],_0x4ab84c['query']);_0x47cf48['attributes']=_['intersection'](_0x4ab84c['model'],qs[_0x6ca6('0x35')](_0x5ea6f7[_0x6ca6('0x32')][_0x6ca6('0x35')]));_0x47cf48['attributes']=_0x47cf48[_0x6ca6('0x36')][_0x6ca6('0x37')]?_0x47cf48[_0x6ca6('0x36')]:_0x4ab84c[_0x6ca6('0x2f')];if(!_0x5ea6f7['query'][_0x6ca6('0x38')](_0x6ca6('0x39'))){_0x47cf48[_0x6ca6('0x1d')]=qs[_0x6ca6('0x1d')](_0x5ea6f7['query'][_0x6ca6('0x1d')]);_0x47cf48['offset']=qs[_0x6ca6('0x1b')](_0x5ea6f7['query']['offset']);}_0x47cf48[_0x6ca6('0x3a')]=qs[_0x6ca6('0x3b')](_0x5ea6f7[_0x6ca6('0x32')][_0x6ca6('0x3b')]);_0x47cf48['where']=qs['filters'](_[_0x6ca6('0x3c')](_0x5ea6f7[_0x6ca6('0x32')],_0x4ab84c['filters']),_0xefd407);if(_0x5ea6f7[_0x6ca6('0x32')]['filter']){_0x47cf48[_0x6ca6('0x3d')]=_['merge'](_0x47cf48[_0x6ca6('0x3d')],{'$or':_[_0x6ca6('0x30')](_0xefd407,function(_0x254733){if(_0x254733[_0x6ca6('0x3e')]!==_0x6ca6('0x3f')){var _0x3ca258={};_0x3ca258[_0x254733[_0x6ca6('0x29')]]={'$like':'%'+_0x5ea6f7[_0x6ca6('0x32')]['filter']+'%'};return _0x3ca258;}})});}_0x47cf48=_[_0x6ca6('0x40')]({},_0x47cf48,_0x5ea6f7['options']);var _0x57186c={'where':_0x47cf48[_0x6ca6('0x3d')]};return db[_0x6ca6('0x2b')]['count'](_0x57186c)[_0x6ca6('0x27')](function(_0x500ed4){_0x141e78[_0x6ca6('0x1e')]=_0x500ed4;if(_0x5ea6f7[_0x6ca6('0x32')][_0x6ca6('0x41')]){_0x47cf48[_0x6ca6('0x42')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x47cf48);})[_0x6ca6('0x27')](function(_0x3813d6){_0x141e78[_0x6ca6('0x43')]=_0x3813d6;return _0x141e78;})[_0x6ca6('0x27')](respondWithFilteredResult(_0x306583,_0x47cf48))[_0x6ca6('0x44')](handleError(_0x306583,null));};exports['show']=function(_0x76db8d,_0x2ffdfc){var _0x5bed6e={'raw':!![],'where':{'id':_0x76db8d[_0x6ca6('0x45')]['id']}},_0x317b5e={};_0x317b5e[_0x6ca6('0x2f')]=_[_0x6ca6('0x31')](db[_0x6ca6('0x2b')][_0x6ca6('0x2c')]);_0x317b5e[_0x6ca6('0x32')]=_[_0x6ca6('0x31')](_0x76db8d[_0x6ca6('0x32')]);_0x317b5e['filters']=_[_0x6ca6('0x34')](_0x317b5e[_0x6ca6('0x2f')],_0x317b5e[_0x6ca6('0x32')]);_0x5bed6e[_0x6ca6('0x36')]=_[_0x6ca6('0x34')](_0x317b5e[_0x6ca6('0x2f')],qs[_0x6ca6('0x35')](_0x76db8d[_0x6ca6('0x32')]['fields']));_0x5bed6e['attributes']=_0x5bed6e[_0x6ca6('0x36')][_0x6ca6('0x37')]?_0x5bed6e[_0x6ca6('0x36')]:_0x317b5e[_0x6ca6('0x2f')];if(_0x76db8d[_0x6ca6('0x32')][_0x6ca6('0x41')]){_0x5bed6e[_0x6ca6('0x42')]=[{'all':!![]}];}_0x5bed6e=_['merge']({},_0x5bed6e,_0x76db8d['options']);return db[_0x6ca6('0x2b')][_0x6ca6('0x46')](_0x5bed6e)['then'](handleEntityNotFound(_0x2ffdfc,null))[_0x6ca6('0x27')](respondWithResult(_0x2ffdfc,null))[_0x6ca6('0x44')](handleError(_0x2ffdfc,null));};exports[_0x6ca6('0x47')]=function(_0x34a388,_0xc1928f){return db[_0x6ca6('0x2b')][_0x6ca6('0x47')](_0x34a388['body'],{})[_0x6ca6('0x27')](respondWithResult(_0xc1928f,0xc9))[_0x6ca6('0x44')](handleError(_0xc1928f,null));};exports[_0x6ca6('0x25')]=function(_0x4fde51,_0x408df3){if(_0x4fde51['body']['id']){delete _0x4fde51[_0x6ca6('0x48')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x4fde51['params']['id']}})[_0x6ca6('0x27')](handleEntityNotFound(_0x408df3,null))[_0x6ca6('0x27')](saveUpdates(_0x4fde51[_0x6ca6('0x48')],null))['then'](respondWithResult(_0x408df3,null))[_0x6ca6('0x44')](handleError(_0x408df3,null));};exports['destroy']=function(_0x1f552d,_0x1010a6){return db[_0x6ca6('0x2b')][_0x6ca6('0x46')]({'where':{'id':_0x1f552d[_0x6ca6('0x45')]['id']}})[_0x6ca6('0x27')](handleEntityNotFound(_0x1010a6,null))[_0x6ca6('0x27')](removeEntity(_0x1010a6,null))[_0x6ca6('0x44')](handleError(_0x1010a6,null));};exports[_0x6ca6('0x49')]=function(_0x2e4cc5,_0x321f41){return db['FaxQueueReport'][_0x6ca6('0x49')]()[_0x6ca6('0x27')](respondWithResult(_0x321f41,null))[_0x6ca6('0x44')](handleError(_0x321f41,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c6d5aa1..7d94c65 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x435548,_0x424769){var _0x404fdb=function(_0x3224fc){while(--_0x3224fc){_0x435548['push'](_0x435548['shift']());}};_0x404fdb(++_0x424769);}(_0x326f,0xd1));var _0xf326=function(_0x987874,_0x2cd758){_0x987874=_0x987874-0x0;var _0x4efd91=_0x326f[_0x987874];return _0x4efd91;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x5a1c1d,_0x94e035){var _0x28078f=function(_0x46a760){while(--_0x46a760){_0x5a1c1d['push'](_0x5a1c1d['shift']());}};_0x28078f(++_0x94e035);}(_0x7a54,0x106));var _0x47a5=function(_0x1cff97,_0x187bcf){_0x1cff97=_0x1cff97-0x0;var _0x5b170e=_0x7a54[_0x1cff97];return _0x5b170e;};'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 diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 078fad6..c963ab0 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 _0x0f3d=['where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','CreateFaxQueueReport','FaxQueueReport','create','raw','stringify','UpdateFaxQueueReport','update','options'];(function(_0x14ab74,_0xb6751d){var _0x170852=function(_0x3dbf5a){while(--_0x3dbf5a){_0x14ab74['push'](_0x14ab74['shift']());}};_0x170852(++_0xb6751d);}(_0x0f3d,0x94));var _0xd0f3=function(_0x56bc44,_0x4b9e7c){_0x56bc44=_0x56bc44-0x0;var _0x592a81=_0x0f3d[_0x56bc44];return _0x592a81;};'use strict';var _=require(_0xd0f3('0x0'));var util=require('util');var moment=require(_0xd0f3('0x1'));var BPromise=require(_0xd0f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0f3('0x3'));var db=require(_0xd0f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0f3('0x5'))(_0xd0f3('0x6'));var config=require('../../config/environment');var jayson=require(_0xd0f3('0x7'));var client=jayson[_0xd0f3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f2e12,_0x4caa55,_0x4d6e92){return new BPromise(function(_0x5a4f12,_0xb33c33){return client[_0xd0f3('0x9')](_0x5f2e12,_0x4d6e92)[_0xd0f3('0xa')](function(_0x59eac0){logger[_0xd0f3('0xb')](_0xd0f3('0xc'),_0x4caa55,_0xd0f3('0xd'));logger[_0xd0f3('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x4caa55,_0xd0f3('0xd'),JSON['stringify'](_0x59eac0));if(_0x59eac0['error']){if(_0x59eac0[_0xd0f3('0xf')][_0xd0f3('0x10')]===0x1f4){logger[_0xd0f3('0xf')](_0xd0f3('0xc'),_0x4caa55,_0x59eac0[_0xd0f3('0xf')][_0xd0f3('0x11')]);return _0xb33c33(_0x59eac0[_0xd0f3('0xf')]['message']);}logger[_0xd0f3('0xf')](_0xd0f3('0xc'),_0x4caa55,_0x59eac0[_0xd0f3('0xf')][_0xd0f3('0x11')]);return _0x5a4f12(_0x59eac0['error'][_0xd0f3('0x11')]);}else{logger[_0xd0f3('0xb')](_0xd0f3('0xc'),_0x4caa55,'request\x20sent');_0x5a4f12(_0x59eac0['result'][_0xd0f3('0x11')]);}})['catch'](function(_0x133616){logger[_0xd0f3('0xf')](_0xd0f3('0xc'),_0x4caa55,_0x133616);_0xb33c33(_0x133616);});});}exports[_0xd0f3('0x12')]=function(_0x9c05ad){var _0x3cad95=this;return new Promise(function(_0x4abbf9,_0x4f88e1){return db[_0xd0f3('0x13')][_0xd0f3('0x14')](_0x9c05ad['body'],{'raw':_0x9c05ad['options']?_0x9c05ad['options'][_0xd0f3('0x15')]===undefined?!![]:![]:!![]})[_0xd0f3('0xa')](function(_0x178d6d){logger[_0xd0f3('0xb')](_0xd0f3('0x12'),_0x9c05ad);logger[_0xd0f3('0xe')](_0xd0f3('0x12'),_0x9c05ad,JSON[_0xd0f3('0x16')](_0x178d6d));_0x4abbf9(_0x178d6d);})['catch'](function(_0xf99699){logger['error'](_0xd0f3('0x12'),_0xf99699[_0xd0f3('0x11')],_0x9c05ad);_0x4f88e1(_0x3cad95['error'](0x1f4,_0xf99699[_0xd0f3('0x11')]));});});};exports[_0xd0f3('0x17')]=function(_0x1b5298){var _0xb56825=this;return new Promise(function(_0x18931e,_0xfb0aed){return db[_0xd0f3('0x13')][_0xd0f3('0x18')](_0x1b5298['body'],{'raw':_0x1b5298[_0xd0f3('0x19')]?_0x1b5298[_0xd0f3('0x19')][_0xd0f3('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b5298['options']?_0x1b5298[_0xd0f3('0x19')][_0xd0f3('0x1a')]||null:null,'attributes':_0x1b5298['options']?_0x1b5298[_0xd0f3('0x19')][_0xd0f3('0x1b')]||null:null,'limit':_0x1b5298[_0xd0f3('0x19')]?_0x1b5298[_0xd0f3('0x19')][_0xd0f3('0x1c')]||null:null})[_0xd0f3('0xa')](function(_0x514251){logger[_0xd0f3('0xb')](_0xd0f3('0x17'),_0x1b5298);logger[_0xd0f3('0xe')](_0xd0f3('0x17'),_0x1b5298,JSON[_0xd0f3('0x16')](_0x514251));_0x18931e(_0x514251);})['catch'](function(_0x36b514){logger[_0xd0f3('0xf')](_0xd0f3('0x17'),_0x36b514['message'],_0x1b5298);_0xfb0aed(_0xb56825[_0xd0f3('0xf')](0x1f4,_0x36b514[_0xd0f3('0x11')]));});});}; \ No newline at end of file +var _0x0d17=['raw','attributes','limit','UpdateFaxQueueReport','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','FaxQueueReport,\x20%s,\x20%s','message','info','catch','CreateFaxQueueReport','options','stringify','update','body'];(function(_0x6211d0,_0x159eaa){var _0x217ada=function(_0x5493e2){while(--_0x5493e2){_0x6211d0['push'](_0x6211d0['shift']());}};_0x217ada(++_0x159eaa);}(_0x0d17,0x19a));var _0x70d1=function(_0x1e7ba5,_0x2431d5){_0x1e7ba5=_0x1e7ba5-0x0;var _0x3150f5=_0x0d17[_0x1e7ba5];return _0x3150f5;};'use strict';var _=require(_0x70d1('0x0'));var util=require(_0x70d1('0x1'));var moment=require('moment');var BPromise=require(_0x70d1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70d1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x70d1('0x4'));var logger=require(_0x70d1('0x5'))(_0x70d1('0x6'));var config=require(_0x70d1('0x7'));var jayson=require(_0x70d1('0x8'));var client=jayson[_0x70d1('0x9')][_0x70d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7fe769,_0xf8e558,_0x364159){return new BPromise(function(_0x1d120e,_0x52d5e2){return client['request'](_0x7fe769,_0x364159)[_0x70d1('0xb')](function(_0x30074e){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0xf8e558,_0x70d1('0xc'));logger[_0x70d1('0xd')](_0x70d1('0xe'),_0xf8e558,_0x70d1('0xc'),JSON['stringify'](_0x30074e));if(_0x30074e[_0x70d1('0xf')]){if(_0x30074e[_0x70d1('0xf')]['code']===0x1f4){logger[_0x70d1('0xf')](_0x70d1('0x10'),_0xf8e558,_0x30074e[_0x70d1('0xf')][_0x70d1('0x11')]);return _0x52d5e2(_0x30074e[_0x70d1('0xf')][_0x70d1('0x11')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0xf8e558,_0x30074e[_0x70d1('0xf')][_0x70d1('0x11')]);return _0x1d120e(_0x30074e[_0x70d1('0xf')]['message']);}else{logger[_0x70d1('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0xf8e558,_0x70d1('0xc'));_0x1d120e(_0x30074e['result']['message']);}})[_0x70d1('0x13')](function(_0x459f48){logger[_0x70d1('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0xf8e558,_0x459f48);_0x52d5e2(_0x459f48);});});}exports[_0x70d1('0x14')]=function(_0x1536d4){var _0xec9f4e=this;return new Promise(function(_0x36ac89,_0x57bd11){return db['FaxQueueReport']['create'](_0x1536d4['body'],{'raw':_0x1536d4[_0x70d1('0x15')]?_0x1536d4[_0x70d1('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x119e7f){logger[_0x70d1('0x12')]('CreateFaxQueueReport',_0x1536d4);logger['debug'](_0x70d1('0x14'),_0x1536d4,JSON[_0x70d1('0x16')](_0x119e7f));_0x36ac89(_0x119e7f);})[_0x70d1('0x13')](function(_0x5790a5){logger[_0x70d1('0xf')]('CreateFaxQueueReport',_0x5790a5['message'],_0x1536d4);_0x57bd11(_0xec9f4e[_0x70d1('0xf')](0x1f4,_0x5790a5[_0x70d1('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x343e13){var _0x11bec6=this;return new Promise(function(_0x1d9690,_0x300f80){return db['FaxQueueReport'][_0x70d1('0x17')](_0x343e13[_0x70d1('0x18')],{'raw':_0x343e13[_0x70d1('0x15')]?_0x343e13[_0x70d1('0x15')][_0x70d1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x343e13[_0x70d1('0x15')]?_0x343e13['options']['where']||null:null,'attributes':_0x343e13[_0x70d1('0x15')]?_0x343e13['options'][_0x70d1('0x1a')]||null:null,'limit':_0x343e13[_0x70d1('0x15')]?_0x343e13[_0x70d1('0x15')][_0x70d1('0x1b')]||null:null})[_0x70d1('0xb')](function(_0x39395a){logger[_0x70d1('0x12')](_0x70d1('0x1c'),_0x343e13);logger[_0x70d1('0xd')]('UpdateFaxQueueReport',_0x343e13,JSON['stringify'](_0x39395a));_0x1d9690(_0x39395a);})[_0x70d1('0x13')](function(_0x2d46fe){logger[_0x70d1('0xf')]('UpdateFaxQueueReport',_0x2d46fe[_0x70d1('0x11')],_0x343e13);_0x300f80(_0x11bec6[_0x70d1('0xf')](0x1f4,_0x2d46fe[_0x70d1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 86d7842..e2ba58d 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 _0x0e55=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','update','delete','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x15e3dc,_0x2d2180){var _0x5b82b8=function(_0x5d58e3){while(--_0x5d58e3){_0x15e3dc['push'](_0x15e3dc['shift']());}};_0x5b82b8(++_0x2d2180);}(_0x0e55,0x121));var _0x50e5=function(_0x575157,_0x16bd1e){_0x575157=_0x575157-0x0;var _0x9b3b5d=_0x0e55[_0x575157];return _0x9b3b5d;};'use strict';var multer=require('multer');var util=require(_0x50e5('0x0'));var path=require(_0x50e5('0x1'));var timeout=require(_0x50e5('0x2'));var express=require(_0x50e5('0x3'));var router=express['Router']();var fs_extra=require(_0x50e5('0x4'));var auth=require(_0x50e5('0x5'));var interaction=require(_0x50e5('0x6'));var config=require(_0x50e5('0x7'));var controller=require(_0x50e5('0x8'));router[_0x50e5('0x9')]('/',auth['isAuthenticated'](),controller[_0x50e5('0xa')]);router[_0x50e5('0x9')](_0x50e5('0xb'),auth['isAuthenticated'](),controller[_0x50e5('0xc')]);router[_0x50e5('0x9')](_0x50e5('0xd'),auth[_0x50e5('0xe')](),controller[_0x50e5('0xf')]);router[_0x50e5('0x10')]('/',auth[_0x50e5('0xe')](),controller[_0x50e5('0x11')]);router['put']('/:id',auth[_0x50e5('0xe')](),controller[_0x50e5('0x12')]);router[_0x50e5('0x13')](_0x50e5('0xd'),auth[_0x50e5('0xe')](),controller['destroy']);module[_0x50e5('0x14')]=router; \ No newline at end of file +var _0xc6d0=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','delete','destroy','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc6d0,0x1db));var _0x0c6d=function(_0xe4da34,_0xc9c5d3){_0xe4da34=_0xe4da34-0x0;var _0x22d3f0=_0xc6d0[_0xe4da34];return _0x22d3f0;};'use strict';var multer=require(_0x0c6d('0x0'));var util=require(_0x0c6d('0x1'));var path=require('path');var timeout=require(_0x0c6d('0x2'));var express=require(_0x0c6d('0x3'));var router=express[_0x0c6d('0x4')]();var fs_extra=require(_0x0c6d('0x5'));var auth=require(_0x0c6d('0x6'));var interaction=require(_0x0c6d('0x7'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x0c6d('0x8')]('/',auth[_0x0c6d('0x9')](),controller[_0x0c6d('0xa')]);router[_0x0c6d('0x8')](_0x0c6d('0xb'),auth[_0x0c6d('0x9')](),controller[_0x0c6d('0xc')]);router['get'](_0x0c6d('0xd'),auth[_0x0c6d('0x9')](),controller[_0x0c6d('0xe')]);router['post']('/',auth[_0x0c6d('0x9')](),controller[_0x0c6d('0xf')]);router['put'](_0x0c6d('0xd'),auth[_0x0c6d('0x9')](),controller['update']);router[_0x0c6d('0x10')](_0x0c6d('0xd'),auth[_0x0c6d('0x9')](),controller[_0x0c6d('0x11')]);module[_0x0c6d('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c33cc7f..0722772 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x12e118,_0xc67f2a){var _0x34da7a=function(_0xb7fbd1){while(--_0xb7fbd1){_0x12e118['push'](_0x12e118['shift']());}};_0x34da7a(++_0xc67f2a);}(_0xedd9,0xfc));var _0x9edd=function(_0x2b372c,_0x1ecdfe){_0x2b372c=_0x2b372c-0x0;var _0x519cef=_0xedd9[_0x2b372c];return _0x519cef;};'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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x53210a,_0x4a49f1){var _0x82411c=function(_0x2208ef){while(--_0x2208ef){_0x53210a['push'](_0x53210a['shift']());}};_0x82411c(++_0x4a49f1);}(_0x34e8,0x12c));var _0x834e=function(_0x4ab03b,_0x28f822){_0x4ab03b=_0x4ab03b-0x0;var _0x4827b0=_0x34e8[_0x4ab03b];return _0x4827b0;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 14f5302..c5a8f22 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 _0x81b3=['then','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','FaxTransferReport','includeAll','include','findAll','show','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update'];(function(_0x4a6699,_0x115a0a){var _0x436bfc=function(_0xa3b96e){while(--_0xa3b96e){_0x4a6699['push'](_0x4a6699['shift']());}};_0x436bfc(++_0x115a0a);}(_0x81b3,0x1ad));var _0x381b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x81b3[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x381b('0x0'));var rimraf=require(_0x381b('0x1'));var zipdir=require(_0x381b('0x2'));var jsonpatch=require(_0x381b('0x3'));var rp=require(_0x381b('0x4'));var moment=require('moment');var BPromise=require(_0x381b('0x5'));var Mustache=require(_0x381b('0x6'));var util=require('util');var path=require(_0x381b('0x7'));var sox=require(_0x381b('0x8'));var csv=require(_0x381b('0x9'));var ejs=require(_0x381b('0xa'));var fs=require('fs');var fs_extra=require(_0x381b('0xb'));var _=require('lodash');var squel=require(_0x381b('0xc'));var crypto=require(_0x381b('0xd'));var jsforce=require(_0x381b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x381b('0x9'));var querystring=require(_0x381b('0xf'));var Papa=require(_0x381b('0x10'));var Redis=require('ioredis');var authService=require(_0x381b('0x11'));var qs=require(_0x381b('0x12'));var as=require(_0x381b('0x13'));var hardwareService=require(_0x381b('0x14'));var logger=require(_0x381b('0x15'))(_0x381b('0x16'));var utils=require(_0x381b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x381b('0x18'));var db=require(_0x381b('0x19'))['db'];function respondWithStatusCode(_0x317755,_0x552e83){_0x552e83=_0x552e83||0xcc;return function(_0x20b0a0){if(_0x20b0a0){return _0x317755['sendStatus'](_0x552e83);}return _0x317755[_0x381b('0x1a')](_0x552e83)[_0x381b('0x1b')]();};}function respondWithResult(_0x3995ac,_0x8d1a85){_0x8d1a85=_0x8d1a85||0xc8;return function(_0x316399){if(_0x316399){return _0x3995ac[_0x381b('0x1a')](_0x8d1a85)['json'](_0x316399);}};}function respondWithFilteredResult(_0x2e7c2b,_0xaaa61){return function(_0x1807ea){if(_0x1807ea){var _0x4abf20=typeof _0xaaa61[_0x381b('0x1c')]===_0x381b('0x1d')&&typeof _0xaaa61[_0x381b('0x1e')]===_0x381b('0x1d');var _0x1c588f=_0x1807ea[_0x381b('0x1f')];var _0x36bf5b=_0x4abf20?0x0:_0xaaa61[_0x381b('0x1c')];var _0x28691d=_0x4abf20?_0x1807ea[_0x381b('0x1f')]:_0xaaa61[_0x381b('0x1c')]+_0xaaa61[_0x381b('0x1e')];var _0x3bbe81;if(_0x28691d>=_0x1c588f){_0x28691d=_0x1c588f;_0x3bbe81=0xc8;}else{_0x3bbe81=0xce;}_0x2e7c2b['status'](_0x3bbe81);return _0x2e7c2b[_0x381b('0x20')](_0x381b('0x21'),_0x36bf5b+'-'+_0x28691d+'/'+_0x1c588f)[_0x381b('0x22')](_0x1807ea);}return null;};}function patchUpdates(_0x390a55){return function(_0x1f6b02){try{jsonpatch[_0x381b('0x23')](_0x1f6b02,_0x390a55,!![]);}catch(_0x1a4110){return BPromise[_0x381b('0x24')](_0x1a4110);}return _0x1f6b02[_0x381b('0x25')]();};}function saveUpdates(_0x527355,_0x1b96e4){return function(_0x4f483d){if(_0x4f483d){return _0x4f483d[_0x381b('0x26')](_0x527355)[_0x381b('0x27')](function(_0x4955be){return _0x4955be;});}return null;};}function removeEntity(_0x20b649,_0x10a3cb){return function(_0x113a4f){if(_0x113a4f){return _0x113a4f[_0x381b('0x28')]()[_0x381b('0x27')](function(){_0x20b649[_0x381b('0x1a')](0xcc)[_0x381b('0x1b')]();});}};}function handleEntityNotFound(_0x481201,_0x2b7afc){return function(_0x451732){if(!_0x451732){_0x481201[_0x381b('0x29')](0x194);}return _0x451732;};}function handleError(_0x2f1d22,_0x4589e0){_0x4589e0=_0x4589e0||0x1f4;return function(_0x10a471){logger['error'](_0x10a471[_0x381b('0x2a')]);if(_0x10a471[_0x381b('0x2b')]){delete _0x10a471['name'];}_0x2f1d22[_0x381b('0x1a')](_0x4589e0)[_0x381b('0x2c')](_0x10a471);};}exports['index']=function(_0x18b4de,_0x26ca28){var _0x26fd7d={},_0x35bfde={},_0x4ca855={'count':0x0,'rows':[]};var _0x3da525=_[_0x381b('0x2d')](db['FaxTransferReport'][_0x381b('0x2e')],function(_0x2f2617){return{'name':_0x2f2617[_0x381b('0x2f')],'type':_0x2f2617[_0x381b('0x30')][_0x381b('0x31')]};});_0x35bfde['model']=_[_0x381b('0x2d')](_0x3da525,_0x381b('0x2b'));_0x35bfde[_0x381b('0x32')]=_[_0x381b('0x33')](_0x18b4de[_0x381b('0x32')]);_0x35bfde[_0x381b('0x34')]=_[_0x381b('0x35')](_0x35bfde[_0x381b('0x36')],_0x35bfde[_0x381b('0x32')]);_0x26fd7d[_0x381b('0x37')]=_[_0x381b('0x35')](_0x35bfde[_0x381b('0x36')],qs[_0x381b('0x38')](_0x18b4de[_0x381b('0x32')][_0x381b('0x38')]));_0x26fd7d[_0x381b('0x37')]=_0x26fd7d['attributes'][_0x381b('0x39')]?_0x26fd7d[_0x381b('0x37')]:_0x35bfde['model'];if(!_0x18b4de['query'][_0x381b('0x3a')]('nolimit')){_0x26fd7d[_0x381b('0x1e')]=qs['limit'](_0x18b4de[_0x381b('0x32')][_0x381b('0x1e')]);_0x26fd7d['offset']=qs[_0x381b('0x1c')](_0x18b4de[_0x381b('0x32')][_0x381b('0x1c')]);}_0x26fd7d[_0x381b('0x3b')]=qs[_0x381b('0x3c')](_0x18b4de[_0x381b('0x32')][_0x381b('0x3c')]);_0x26fd7d[_0x381b('0x3d')]=qs[_0x381b('0x34')](_[_0x381b('0x3e')](_0x18b4de['query'],_0x35bfde['filters']),_0x3da525);if(_0x18b4de[_0x381b('0x32')][_0x381b('0x3f')]){_0x26fd7d[_0x381b('0x3d')]=_['merge'](_0x26fd7d[_0x381b('0x3d')],{'$or':_[_0x381b('0x2d')](_0x3da525,function(_0x52955d){if(_0x52955d[_0x381b('0x30')]!==_0x381b('0x40')){var _0x3b7163={};_0x3b7163[_0x52955d[_0x381b('0x2b')]]={'$like':'%'+_0x18b4de[_0x381b('0x32')]['filter']+'%'};return _0x3b7163;}})});}_0x26fd7d=_[_0x381b('0x41')]({},_0x26fd7d,_0x18b4de[_0x381b('0x42')]);var _0x565930={'where':_0x26fd7d['where']};return db[_0x381b('0x43')][_0x381b('0x1f')](_0x565930)[_0x381b('0x27')](function(_0x35f092){_0x4ca855[_0x381b('0x1f')]=_0x35f092;if(_0x18b4de[_0x381b('0x32')][_0x381b('0x44')]){_0x26fd7d[_0x381b('0x45')]=[{'all':!![]}];}return db[_0x381b('0x43')][_0x381b('0x46')](_0x26fd7d);})[_0x381b('0x27')](function(_0x5e0456){_0x4ca855['rows']=_0x5e0456;return _0x4ca855;})[_0x381b('0x27')](respondWithFilteredResult(_0x26ca28,_0x26fd7d))['catch'](handleError(_0x26ca28,null));};exports[_0x381b('0x47')]=function(_0xf6103a,_0x35d6ef){var _0x46626a={'raw':!![],'where':{'id':_0xf6103a['params']['id']}},_0x25fc7d={};_0x25fc7d['model']=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x25fc7d[_0x381b('0x32')]=_[_0x381b('0x33')](_0xf6103a[_0x381b('0x32')]);_0x25fc7d[_0x381b('0x34')]=_[_0x381b('0x35')](_0x25fc7d[_0x381b('0x36')],_0x25fc7d[_0x381b('0x32')]);_0x46626a[_0x381b('0x37')]=_[_0x381b('0x35')](_0x25fc7d[_0x381b('0x36')],qs[_0x381b('0x38')](_0xf6103a['query']['fields']));_0x46626a[_0x381b('0x37')]=_0x46626a[_0x381b('0x37')]['length']?_0x46626a[_0x381b('0x37')]:_0x25fc7d['model'];if(_0xf6103a[_0x381b('0x32')][_0x381b('0x44')]){_0x46626a[_0x381b('0x45')]=[{'all':!![]}];}_0x46626a=_[_0x381b('0x41')]({},_0x46626a,_0xf6103a['options']);return db['FaxTransferReport'][_0x381b('0x48')](_0x46626a)[_0x381b('0x27')](handleEntityNotFound(_0x35d6ef,null))[_0x381b('0x27')](respondWithResult(_0x35d6ef,null))[_0x381b('0x49')](handleError(_0x35d6ef,null));};exports[_0x381b('0x4a')]=function(_0x21e3e6,_0x4bbfd1){return db[_0x381b('0x43')]['create'](_0x21e3e6['body'],{})[_0x381b('0x27')](respondWithResult(_0x4bbfd1,0xc9))[_0x381b('0x49')](handleError(_0x4bbfd1,null));};exports[_0x381b('0x26')]=function(_0x1435f1,_0x33567c){if(_0x1435f1[_0x381b('0x4b')]['id']){delete _0x1435f1['body']['id'];}return db[_0x381b('0x43')][_0x381b('0x48')]({'where':{'id':_0x1435f1['params']['id']}})[_0x381b('0x27')](handleEntityNotFound(_0x33567c,null))[_0x381b('0x27')](saveUpdates(_0x1435f1[_0x381b('0x4b')],null))['then'](respondWithResult(_0x33567c,null))[_0x381b('0x49')](handleError(_0x33567c,null));};exports[_0x381b('0x28')]=function(_0x5e9bdb,_0x5afff0){return db['FaxTransferReport'][_0x381b('0x48')]({'where':{'id':_0x5e9bdb[_0x381b('0x4c')]['id']}})[_0x381b('0x27')](handleEntityNotFound(_0x5afff0,null))[_0x381b('0x27')](removeEntity(_0x5afff0,null))[_0x381b('0x49')](handleError(_0x5afff0,null));};exports[_0x381b('0x4d')]=function(_0x3753e5,_0x18134a){return db['FaxTransferReport'][_0x381b('0x4d')]()['then'](respondWithResult(_0x18134a,null))[_0x381b('0x49')](handleError(_0x18134a,null));}; \ No newline at end of file +var _0x5439=['find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','FaxTransferReport','type','key','model','keys','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','intersection','fields','length'];(function(_0x3527f4,_0x1563bc){var _0x547be9=function(_0x47a35a){while(--_0x47a35a){_0x3527f4['push'](_0x3527f4['shift']());}};_0x547be9(++_0x1563bc);}(_0x5439,0x135));var _0x9543=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5439[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x9543('0x0'));var rimraf=require(_0x9543('0x1'));var zipdir=require(_0x9543('0x2'));var jsonpatch=require(_0x9543('0x3'));var rp=require(_0x9543('0x4'));var moment=require(_0x9543('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9543('0x6'));var path=require(_0x9543('0x7'));var sox=require(_0x9543('0x8'));var csv=require(_0x9543('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9543('0xa'));var _=require('lodash');var squel=require(_0x9543('0xb'));var crypto=require(_0x9543('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9543('0xd'));var toCsv=require(_0x9543('0x9'));var querystring=require(_0x9543('0xe'));var Papa=require(_0x9543('0xf'));var Redis=require(_0x9543('0x10'));var authService=require(_0x9543('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9543('0x12'));var hardwareService=require(_0x9543('0x13'));var logger=require(_0x9543('0x14'))('api');var utils=require(_0x9543('0x15'));var config=require(_0x9543('0x16'));var licenseUtil=require(_0x9543('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x598c58,_0x476b4a){_0x476b4a=_0x476b4a||0xcc;return function(_0x5d051e){if(_0x5d051e){return _0x598c58[_0x9543('0x18')](_0x476b4a);}return _0x598c58[_0x9543('0x19')](_0x476b4a)[_0x9543('0x1a')]();};}function respondWithResult(_0x4893fb,_0x5c3415){_0x5c3415=_0x5c3415||0xc8;return function(_0x360974){if(_0x360974){return _0x4893fb[_0x9543('0x19')](_0x5c3415)[_0x9543('0x1b')](_0x360974);}};}function respondWithFilteredResult(_0x3f4420,_0x3ade9d){return function(_0x3d4d32){if(_0x3d4d32){var _0x4adba3=typeof _0x3ade9d['offset']===_0x9543('0x1c')&&typeof _0x3ade9d[_0x9543('0x1d')]==='undefined';var _0x40f5ad=_0x3d4d32[_0x9543('0x1e')];var _0xae699b=_0x4adba3?0x0:_0x3ade9d[_0x9543('0x1f')];var _0x3903ce=_0x4adba3?_0x3d4d32[_0x9543('0x1e')]:_0x3ade9d['offset']+_0x3ade9d[_0x9543('0x1d')];var _0x3b3b4a;if(_0x3903ce>=_0x40f5ad){_0x3903ce=_0x40f5ad;_0x3b3b4a=0xc8;}else{_0x3b3b4a=0xce;}_0x3f4420[_0x9543('0x19')](_0x3b3b4a);return _0x3f4420[_0x9543('0x20')](_0x9543('0x21'),_0xae699b+'-'+_0x3903ce+'/'+_0x40f5ad)['json'](_0x3d4d32);}return null;};}function patchUpdates(_0x273752){return function(_0x47aee7){try{jsonpatch[_0x9543('0x22')](_0x47aee7,_0x273752,!![]);}catch(_0x52d0ad){return BPromise[_0x9543('0x23')](_0x52d0ad);}return _0x47aee7[_0x9543('0x24')]();};}function saveUpdates(_0x677638,_0x18b2fb){return function(_0x2916b5){if(_0x2916b5){return _0x2916b5['update'](_0x677638)[_0x9543('0x25')](function(_0x24cec9){return _0x24cec9;});}return null;};}function removeEntity(_0x2b35dd,_0x514adb){return function(_0x77ad31){if(_0x77ad31){return _0x77ad31[_0x9543('0x26')]()[_0x9543('0x25')](function(){_0x2b35dd[_0x9543('0x19')](0xcc)[_0x9543('0x1a')]();});}};}function handleEntityNotFound(_0x234b00,_0x13b45f){return function(_0x3af015){if(!_0x3af015){_0x234b00[_0x9543('0x18')](0x194);}return _0x3af015;};}function handleError(_0x199728,_0x2f3a56){_0x2f3a56=_0x2f3a56||0x1f4;return function(_0x48f6d3){logger[_0x9543('0x27')](_0x48f6d3[_0x9543('0x28')]);if(_0x48f6d3[_0x9543('0x29')]){delete _0x48f6d3['name'];}_0x199728[_0x9543('0x19')](_0x2f3a56)[_0x9543('0x2a')](_0x48f6d3);};}exports['index']=function(_0x17e98c,_0x2b813d){var _0x495c8b={},_0x1bd68c={},_0xc76c17={'count':0x0,'rows':[]};var _0x7cf3bb=_[_0x9543('0x2b')](db[_0x9543('0x2c')]['rawAttributes'],function(_0x36786d){return{'name':_0x36786d['fieldName'],'type':_0x36786d[_0x9543('0x2d')][_0x9543('0x2e')]};});_0x1bd68c[_0x9543('0x2f')]=_['map'](_0x7cf3bb,_0x9543('0x29'));_0x1bd68c['query']=_[_0x9543('0x30')](_0x17e98c[_0x9543('0x31')]);_0x1bd68c['filters']=_['intersection'](_0x1bd68c[_0x9543('0x2f')],_0x1bd68c[_0x9543('0x31')]);_0x495c8b[_0x9543('0x32')]=_['intersection'](_0x1bd68c[_0x9543('0x2f')],qs['fields'](_0x17e98c[_0x9543('0x31')]['fields']));_0x495c8b[_0x9543('0x32')]=_0x495c8b[_0x9543('0x32')]['length']?_0x495c8b[_0x9543('0x32')]:_0x1bd68c[_0x9543('0x2f')];if(!_0x17e98c['query'][_0x9543('0x33')](_0x9543('0x34'))){_0x495c8b[_0x9543('0x1d')]=qs['limit'](_0x17e98c[_0x9543('0x31')][_0x9543('0x1d')]);_0x495c8b[_0x9543('0x1f')]=qs[_0x9543('0x1f')](_0x17e98c[_0x9543('0x31')]['offset']);}_0x495c8b[_0x9543('0x35')]=qs[_0x9543('0x36')](_0x17e98c[_0x9543('0x31')][_0x9543('0x36')]);_0x495c8b[_0x9543('0x37')]=qs['filters'](_[_0x9543('0x38')](_0x17e98c[_0x9543('0x31')],_0x1bd68c[_0x9543('0x39')]),_0x7cf3bb);if(_0x17e98c[_0x9543('0x31')][_0x9543('0x3a')]){_0x495c8b[_0x9543('0x37')]=_[_0x9543('0x3b')](_0x495c8b[_0x9543('0x37')],{'$or':_[_0x9543('0x2b')](_0x7cf3bb,function(_0x34ff16){if(_0x34ff16[_0x9543('0x2d')]!=='VIRTUAL'){var _0x158fe3={};_0x158fe3[_0x34ff16['name']]={'$like':'%'+_0x17e98c['query']['filter']+'%'};return _0x158fe3;}})});}_0x495c8b=_[_0x9543('0x3b')]({},_0x495c8b,_0x17e98c[_0x9543('0x3c')]);var _0x4273c6={'where':_0x495c8b['where']};return db['FaxTransferReport'][_0x9543('0x1e')](_0x4273c6)[_0x9543('0x25')](function(_0x23dd4f){_0xc76c17[_0x9543('0x1e')]=_0x23dd4f;if(_0x17e98c[_0x9543('0x31')][_0x9543('0x3d')]){_0x495c8b[_0x9543('0x3e')]=[{'all':!![]}];}return db[_0x9543('0x2c')][_0x9543('0x3f')](_0x495c8b);})[_0x9543('0x25')](function(_0x13ef06){_0xc76c17[_0x9543('0x40')]=_0x13ef06;return _0xc76c17;})[_0x9543('0x25')](respondWithFilteredResult(_0x2b813d,_0x495c8b))[_0x9543('0x41')](handleError(_0x2b813d,null));};exports[_0x9543('0x42')]=function(_0x1f3f16,_0x136246){var _0x4cafcd={'raw':!![],'where':{'id':_0x1f3f16['params']['id']}},_0x436de4={};_0x436de4['model']=_[_0x9543('0x30')](db[_0x9543('0x2c')][_0x9543('0x43')]);_0x436de4[_0x9543('0x31')]=_[_0x9543('0x30')](_0x1f3f16[_0x9543('0x31')]);_0x436de4['filters']=_[_0x9543('0x44')](_0x436de4['model'],_0x436de4['query']);_0x4cafcd[_0x9543('0x32')]=_[_0x9543('0x44')](_0x436de4[_0x9543('0x2f')],qs[_0x9543('0x45')](_0x1f3f16[_0x9543('0x31')][_0x9543('0x45')]));_0x4cafcd[_0x9543('0x32')]=_0x4cafcd[_0x9543('0x32')][_0x9543('0x46')]?_0x4cafcd[_0x9543('0x32')]:_0x436de4[_0x9543('0x2f')];if(_0x1f3f16[_0x9543('0x31')][_0x9543('0x3d')]){_0x4cafcd['include']=[{'all':!![]}];}_0x4cafcd=_[_0x9543('0x3b')]({},_0x4cafcd,_0x1f3f16['options']);return db[_0x9543('0x2c')][_0x9543('0x47')](_0x4cafcd)[_0x9543('0x25')](handleEntityNotFound(_0x136246,null))[_0x9543('0x25')](respondWithResult(_0x136246,null))[_0x9543('0x41')](handleError(_0x136246,null));};exports[_0x9543('0x48')]=function(_0x49b485,_0x3fcc6f){return db['FaxTransferReport'][_0x9543('0x48')](_0x49b485[_0x9543('0x49')],{})[_0x9543('0x25')](respondWithResult(_0x3fcc6f,0xc9))[_0x9543('0x41')](handleError(_0x3fcc6f,null));};exports[_0x9543('0x4a')]=function(_0x48a88f,_0x2a3e4a){if(_0x48a88f['body']['id']){delete _0x48a88f[_0x9543('0x49')]['id'];}return db[_0x9543('0x2c')][_0x9543('0x47')]({'where':{'id':_0x48a88f['params']['id']}})[_0x9543('0x25')](handleEntityNotFound(_0x2a3e4a,null))[_0x9543('0x25')](saveUpdates(_0x48a88f['body'],null))[_0x9543('0x25')](respondWithResult(_0x2a3e4a,null))[_0x9543('0x41')](handleError(_0x2a3e4a,null));};exports['destroy']=function(_0x466f67,_0x5544da){return db[_0x9543('0x2c')]['find']({'where':{'id':_0x466f67['params']['id']}})[_0x9543('0x25')](handleEntityNotFound(_0x5544da,null))['then'](removeEntity(_0x5544da,null))['catch'](handleError(_0x5544da,null));};exports[_0x9543('0x4b')]=function(_0x1bc6bc,_0x2a2a56){return db[_0x9543('0x2c')][_0x9543('0x4b')]()[_0x9543('0x25')](respondWithResult(_0x2a2a56,null))[_0x9543('0x41')](handleError(_0x2a2a56,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 5ffeb3e..9464692 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 _0xf8ea=['FaxTransferReport','report_fax_transfer','uniqueid','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x2cdb41,_0x398473){var _0x624994=function(_0x15ae00){while(--_0x15ae00){_0x2cdb41['push'](_0x2cdb41['shift']());}};_0x624994(++_0x398473);}(_0xf8ea,0x1bf));var _0xaf8e=function(_0x486acc,_0x2c8e31){_0x486acc=_0x486acc-0x0;var _0x56ea0a=_0xf8ea[_0x486acc];return _0x56ea0a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaf8e('0x0'))(_0xaf8e('0x1'));var moment=require(_0xaf8e('0x2'));var BPromise=require('bluebird');var rp=require(_0xaf8e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf8e('0x4'));var config=require(_0xaf8e('0x5'));var attributes=require(_0xaf8e('0x6'));module[_0xaf8e('0x7')]=function(_0x2cfaf8,_0xaf59ef){return _0x2cfaf8[_0xaf8e('0x8')](_0xaf8e('0x9'),attributes,{'tableName':_0xaf8e('0xa'),'paranoid':![],'indexes':[{'name':_0xaf8e('0xb'),'fields':[_0xaf8e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b7e=['bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','util','api','moment'];(function(_0x5e61e2,_0x2ac666){var _0x3eeb76=function(_0x51ebc5){while(--_0x51ebc5){_0x5e61e2['push'](_0x5e61e2['shift']());}};_0x3eeb76(++_0x2ac666);}(_0x2b7e,0xe1));var _0xe2b7=function(_0x528cc6,_0x41899f){_0x528cc6=_0x528cc6-0x0;var _0x55fea0=_0x2b7e[_0x528cc6];return _0x55fea0;};'use strict';var _=require('lodash');var util=require(_0xe2b7('0x0'));var logger=require('../../config/logger')(_0xe2b7('0x1'));var moment=require(_0xe2b7('0x2'));var BPromise=require(_0xe2b7('0x3'));var rp=require(_0xe2b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2b7('0x5'));var config=require(_0xe2b7('0x6'));var attributes=require(_0xe2b7('0x7'));module['exports']=function(_0x44a710,_0x45068f){return _0x44a710[_0xe2b7('0x8')](_0xe2b7('0x9'),attributes,{'tableName':_0xe2b7('0xa'),'paranoid':![],'indexes':[{'name':_0xe2b7('0xb'),'fields':[_0xe2b7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 6e018c1..5d49c28 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 _0x0c70=['util','moment','bluebird','randomstring','../../config/utils','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0c70,0x1b8));var _0x00c7=function(_0x540041,_0x388ca0){_0x540041=_0x540041-0x0;var _0x5a4898=_0x0c70[_0x540041];return _0x5a4898;};'use strict';var _=require(_0x00c7('0x0'));var util=require(_0x00c7('0x1'));var moment=require(_0x00c7('0x2'));var BPromise=require(_0x00c7('0x3'));var rs=require(_0x00c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x00c7('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x00c7('0x6'));var client=jayson[_0x00c7('0x7')][_0x00c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x365d5,_0x2a29a7,_0x6c88cc){return new BPromise(function(_0x3939cb,_0xa26f05){return client[_0x00c7('0x9')](_0x365d5,_0x6c88cc)[_0x00c7('0xa')](function(_0x1c5d3a){logger[_0x00c7('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x2a29a7,_0x00c7('0xc'));logger[_0x00c7('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2a29a7,_0x00c7('0xc'),JSON[_0x00c7('0xe')](_0x1c5d3a));if(_0x1c5d3a[_0x00c7('0xf')]){if(_0x1c5d3a['error'][_0x00c7('0x10')]===0x1f4){logger[_0x00c7('0xf')](_0x00c7('0x11'),_0x2a29a7,_0x1c5d3a[_0x00c7('0xf')]['message']);return _0xa26f05(_0x1c5d3a[_0x00c7('0xf')]['message']);}logger[_0x00c7('0xf')](_0x00c7('0x11'),_0x2a29a7,_0x1c5d3a[_0x00c7('0xf')][_0x00c7('0x12')]);return _0x3939cb(_0x1c5d3a[_0x00c7('0xf')]['message']);}else{logger[_0x00c7('0xb')](_0x00c7('0x11'),_0x2a29a7,_0x00c7('0xc'));_0x3939cb(_0x1c5d3a[_0x00c7('0x13')][_0x00c7('0x12')]);}})[_0x00c7('0x14')](function(_0x61539){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x2a29a7,_0x61539);_0xa26f05(_0x61539);});});} \ No newline at end of file +var _0x7fb2=['client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','FaxTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7fb2,0xbd));var _0x27fb=function(_0x502b60,_0xaf2c6){_0x502b60=_0x502b60-0x0;var _0x5aeb6e=_0x7fb2[_0x502b60];return _0x5aeb6e;};'use strict';var _=require(_0x27fb('0x0'));var util=require(_0x27fb('0x1'));var moment=require(_0x27fb('0x2'));var BPromise=require('bluebird');var rs=require(_0x27fb('0x3'));var fs=require('fs');var Redis=require(_0x27fb('0x4'));var db=require(_0x27fb('0x5'))['db'];var utils=require(_0x27fb('0x6'));var logger=require(_0x27fb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x27fb('0x8'));var client=jayson[_0x27fb('0x9')][_0x27fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26b55e,_0x45817d,_0x3f0282){return new BPromise(function(_0x27e104,_0x1ea235){return client[_0x27fb('0xb')](_0x26b55e,_0x3f0282)[_0x27fb('0xc')](function(_0x734172){logger[_0x27fb('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x45817d,_0x27fb('0xe'));logger[_0x27fb('0xf')](_0x27fb('0x10'),_0x45817d,_0x27fb('0xe'),JSON['stringify'](_0x734172));if(_0x734172[_0x27fb('0x11')]){if(_0x734172['error'][_0x27fb('0x12')]===0x1f4){logger[_0x27fb('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x45817d,_0x734172[_0x27fb('0x11')][_0x27fb('0x13')]);return _0x1ea235(_0x734172['error'][_0x27fb('0x13')]);}logger[_0x27fb('0x11')](_0x27fb('0x14'),_0x45817d,_0x734172[_0x27fb('0x11')][_0x27fb('0x13')]);return _0x27e104(_0x734172[_0x27fb('0x11')][_0x27fb('0x13')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x45817d,_0x27fb('0xe'));_0x27e104(_0x734172['result'][_0x27fb('0x13')]);}})[_0x27fb('0x15')](function(_0x53aa02){logger[_0x27fb('0x11')](_0x27fb('0x14'),_0x45817d,_0x53aa02);_0x1ea235(_0x53aa02);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 4039e71..255316f 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 _0x9e35=['../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x233992,_0x410a43){var _0x19cb73=function(_0x28bd0e){while(--_0x28bd0e){_0x233992['push'](_0x233992['shift']());}};_0x19cb73(++_0x410a43);}(_0x9e35,0x187));var _0x59e3=function(_0x4c94ef,_0x5e3d0b){_0x4c94ef=_0x4c94ef-0x0;var _0x430eaf=_0x9e35[_0x4c94ef];return _0x430eaf;};'use strict';var multer=require(_0x59e3('0x0'));var util=require(_0x59e3('0x1'));var path=require(_0x59e3('0x2'));var timeout=require(_0x59e3('0x3'));var express=require(_0x59e3('0x4'));var router=express[_0x59e3('0x5')]();var fs_extra=require(_0x59e3('0x6'));var auth=require(_0x59e3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x59e3('0x8'));var controller=require(_0x59e3('0x9'));router[_0x59e3('0xa')]('/',auth[_0x59e3('0xb')](),controller[_0x59e3('0xc')]);router[_0x59e3('0xa')](_0x59e3('0xd'),auth[_0x59e3('0xb')](),controller[_0x59e3('0xe')]);router[_0x59e3('0xa')](_0x59e3('0xf'),auth[_0x59e3('0xb')](),controller['show']);router[_0x59e3('0x10')]('/',auth[_0x59e3('0xb')](),controller[_0x59e3('0x11')]);router[_0x59e3('0x12')](_0x59e3('0xf'),auth[_0x59e3('0xb')](),controller['update']);router[_0x59e3('0x13')](_0x59e3('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x59e3('0x14')]=router; \ No newline at end of file +var _0x3782=['/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','describe','show'];(function(_0x32cfed,_0x278ecd){var _0x5735e9=function(_0x20af72){while(--_0x20af72){_0x32cfed['push'](_0x32cfed['shift']());}};_0x5735e9(++_0x278ecd);}(_0x3782,0xa6));var _0x2378=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3782[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x2378('0x0'));var util=require(_0x2378('0x1'));var path=require('path');var timeout=require(_0x2378('0x2'));var express=require(_0x2378('0x3'));var router=express[_0x2378('0x4')]();var fs_extra=require(_0x2378('0x5'));var auth=require(_0x2378('0x6'));var interaction=require(_0x2378('0x7'));var config=require(_0x2378('0x8'));var controller=require(_0x2378('0x9'));router[_0x2378('0xa')]('/',auth[_0x2378('0xb')](),controller['index']);router[_0x2378('0xa')]('/describe',auth[_0x2378('0xb')](),controller[_0x2378('0xc')]);router[_0x2378('0xa')]('/:id',auth[_0x2378('0xb')](),controller[_0x2378('0xd')]);router['post']('/',auth[_0x2378('0xb')](),controller['create']);router['put'](_0x2378('0xe'),auth[_0x2378('0xb')](),controller[_0x2378('0xf')]);router['delete']('/:id',auth[_0x2378('0xb')](),controller[_0x2378('0x10')]);module[_0x2378('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index e6065ae..5aa2b13 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 _0xc81e=['get','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','/:id','update','delete','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x45d640,_0x1456c3){var _0x21d588=function(_0x323e36){while(--_0x323e36){_0x45d640['push'](_0x45d640['shift']());}};_0x21d588(++_0x1456c3);}(_0xc81e,0x109));var _0xec81=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0xc81e[_0x413b4d];return _0x8b810a;};'use strict';var multer=require(_0xec81('0x0'));var util=require(_0xec81('0x1'));var path=require(_0xec81('0x2'));var timeout=require('connect-timeout');var express=require(_0xec81('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xec81('0x4'));var config=require(_0xec81('0x5'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0xec81('0x6')](),controller[_0xec81('0x7')]);router[_0xec81('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xec81('0x9')]);router[_0xec81('0x8')](_0xec81('0xa'),auth[_0xec81('0x6')](),controller[_0xec81('0xb')]);router[_0xec81('0x8')]('/:id/fields',auth[_0xec81('0x6')](),controller[_0xec81('0xc')]);router['post']('/',auth[_0xec81('0x6')](),controller[_0xec81('0xd')]);router[_0xec81('0xe')](_0xec81('0xa'),auth[_0xec81('0x6')](),controller[_0xec81('0xf')]);router[_0xec81('0x10')](_0xec81('0x11'),auth[_0xec81('0x6')](),controller[_0xec81('0x12')]);router[_0xec81('0x13')](_0xec81('0x11'),auth[_0xec81('0x6')](),controller['destroy']);module[_0xec81('0x14')]=router; \ No newline at end of file +var _0x042c=['put','/:id','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','show','get','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x042c,0xb4));var _0xc042=function(_0x12bfa1,_0x46d5af){_0x12bfa1=_0x12bfa1-0x0;var _0x6a446f=_0x042c[_0x12bfa1];return _0x6a446f;};'use strict';var multer=require(_0xc042('0x0'));var util=require('util');var path=require(_0xc042('0x1'));var timeout=require('connect-timeout');var express=require(_0xc042('0x2'));var router=express[_0xc042('0x3')]();var fs_extra=require(_0xc042('0x4'));var auth=require(_0xc042('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc042('0x6'));var controller=require(_0xc042('0x7'));router['get']('/',auth[_0xc042('0x8')](),controller[_0xc042('0x9')]);router['get']('/:id',auth[_0xc042('0x8')](),controller[_0xc042('0xa')]);router[_0xc042('0xb')]('/:id/configurations',auth[_0xc042('0x8')](),controller[_0xc042('0xc')]);router[_0xc042('0xb')](_0xc042('0xd'),auth[_0xc042('0x8')](),controller[_0xc042('0xe')]);router[_0xc042('0xf')]('/',auth[_0xc042('0x8')](),controller['create']);router['post'](_0xc042('0x10'),auth['isAuthenticated'](),controller[_0xc042('0x11')]);router[_0xc042('0x12')](_0xc042('0x13'),auth['isAuthenticated'](),controller[_0xc042('0x14')]);router['delete'](_0xc042('0x13'),auth[_0xc042('0x8')](),controller['destroy']);module[_0xc042('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 191393c..49c6dea 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 _0x93e3=['basic','integrationTab','exports','STRING','ENUM'];(function(_0x1428a7,_0x17f607){var _0xcabdf2=function(_0x2d9c05){while(--_0x2d9c05){_0x1428a7['push'](_0x1428a7['shift']());}};_0xcabdf2(++_0x17f607);}(_0x93e3,0x9d));var _0x393e=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x93e3[_0x19dd7a];return _0x3feb6a;};'use strict';var Sequelize=require('sequelize');module[_0x393e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x393e('0x1')]},'username':{'type':Sequelize[_0x393e('0x1')]},'remoteUri':{'type':Sequelize[_0x393e('0x1')]},'authType':{'type':Sequelize[_0x393e('0x2')](_0x393e('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x393e('0x1')]},'consumerKey':{'type':Sequelize[_0x393e('0x1')]},'consumerSecret':{'type':Sequelize[_0x393e('0x1')]},'token':{'type':Sequelize[_0x393e('0x1')]},'tokenSecret':{'type':Sequelize[_0x393e('0x1')]},'serverUrl':{'type':Sequelize[_0x393e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x393e('0x2')](_0x393e('0x4'),'newTab'),'defaultValue':_0x393e('0x4')}}; \ No newline at end of file +var _0xdf3a=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0xdf3a,0x16e));var _0xadf3=function(_0x1416ad,_0xf0f164){_0x1416ad=_0x1416ad-0x0;var _0x50af24=_0xdf3a[_0x1416ad];return _0x50af24;};'use strict';var Sequelize=require(_0xadf3('0x0'));module[_0xadf3('0x1')]={'name':{'type':Sequelize[_0xadf3('0x2')]},'description':{'type':Sequelize[_0xadf3('0x2')]},'username':{'type':Sequelize[_0xadf3('0x2')]},'remoteUri':{'type':Sequelize[_0xadf3('0x2')]},'authType':{'type':Sequelize[_0xadf3('0x3')](_0xadf3('0x4')),'defaultValue':_0xadf3('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xadf3('0x2')]},'consumerSecret':{'type':Sequelize[_0xadf3('0x2')]},'token':{'type':Sequelize[_0xadf3('0x2')]},'tokenSecret':{'type':Sequelize[_0xadf3('0x2')]},'serverUrl':{'type':Sequelize[_0xadf3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xadf3('0x3')](_0xadf3('0x5'),_0xadf3('0x6')),'defaultValue':_0xadf3('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 0b44f63..5367483 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 _0x7890=['DeskField','getFields','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','headers','Authorization','Basic\x20%s','username','toString','base64','concat','active','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','getConfigurations','findOne','keys','DeskConfiguration','order','getSubjects','channel','type','getDescriptions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7890,0x1c6));var _0x0789=function(_0x2d284,_0x4a7ffc){_0x2d284=_0x2d284-0x0;var _0x35c8f6=_0x7890[_0x2d284];return _0x35c8f6;};'use strict';var emlformat=require(_0x0789('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0789('0x1'));var jsonpatch=require(_0x0789('0x2'));var rp=require(_0x0789('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0789('0x4'));var path=require(_0x0789('0x5'));var sox=require(_0x0789('0x6'));var csv=require(_0x0789('0x7'));var ejs=require(_0x0789('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0789('0x9'));var squel=require(_0x0789('0xa'));var crypto=require(_0x0789('0xb'));var jsforce=require(_0x0789('0xc'));var deskjs=require(_0x0789('0xd'));var toCsv=require(_0x0789('0x7'));var querystring=require(_0x0789('0xe'));var Papa=require(_0x0789('0xf'));var Redis=require('ioredis');var authService=require(_0x0789('0x10'));var qs=require(_0x0789('0x11'));var as=require(_0x0789('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0789('0x13'));var utils=require(_0x0789('0x14'));var config=require(_0x0789('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0789('0x16'))['db'];var integrations=require(_0x0789('0x17'));function respondWithStatusCode(_0x16c5c5,_0x3e77ad){_0x3e77ad=_0x3e77ad||0xcc;return function(_0xadf6d4){if(_0xadf6d4){return _0x16c5c5[_0x0789('0x18')](_0x3e77ad);}return _0x16c5c5[_0x0789('0x19')](_0x3e77ad)[_0x0789('0x1a')]();};}function respondWithResult(_0x3c3b3b,_0x117f01){_0x117f01=_0x117f01||0xc8;return function(_0x3ed559){if(_0x3ed559){return _0x3c3b3b[_0x0789('0x19')](_0x117f01)[_0x0789('0x1b')](_0x3ed559);}};}function respondWithFilteredResult(_0x1bcdf1,_0x5c271e){return function(_0x51bd0a){if(_0x51bd0a){var _0x36bc9=typeof _0x5c271e[_0x0789('0x1c')]==='undefined'&&typeof _0x5c271e[_0x0789('0x1d')]===_0x0789('0x1e');var _0x54d15a=_0x51bd0a[_0x0789('0x1f')];var _0x4d0efe=_0x36bc9?0x0:_0x5c271e['offset'];var _0x3a0dc3=_0x36bc9?_0x51bd0a[_0x0789('0x1f')]:_0x5c271e[_0x0789('0x1c')]+_0x5c271e['limit'];var _0x4d6a6a;if(_0x3a0dc3>=_0x54d15a){_0x3a0dc3=_0x54d15a;_0x4d6a6a=0xc8;}else{_0x4d6a6a=0xce;}_0x1bcdf1[_0x0789('0x19')](_0x4d6a6a);return _0x1bcdf1['set'](_0x0789('0x20'),_0x4d0efe+'-'+_0x3a0dc3+'/'+_0x54d15a)[_0x0789('0x1b')](_0x51bd0a);}return null;};}function patchUpdates(_0x35396d){return function(_0x35ee68){try{jsonpatch[_0x0789('0x21')](_0x35ee68,_0x35396d,!![]);}catch(_0x3956d5){return BPromise[_0x0789('0x22')](_0x3956d5);}return _0x35ee68[_0x0789('0x23')]();};}function saveUpdates(_0x1f5a6b,_0x3081b7){return function(_0x3d8e5d){if(_0x3d8e5d){return _0x3d8e5d[_0x0789('0x24')](_0x1f5a6b)['then'](function(_0x457320){return _0x457320;});}return null;};}function removeEntity(_0x4914c9,_0x2a8302){return function(_0x256f43){if(_0x256f43){return _0x256f43['destroy']()[_0x0789('0x25')](function(){_0x4914c9[_0x0789('0x19')](0xcc)[_0x0789('0x1a')]();});}};}function handleEntityNotFound(_0x2da3a4,_0x222153){return function(_0x2b81f5){if(!_0x2b81f5){_0x2da3a4[_0x0789('0x18')](0x194);}return _0x2b81f5;};}function handleError(_0x23d1e2,_0x590e5b){_0x590e5b=_0x590e5b||0x1f4;return function(_0x307a35){logger['error'](_0x307a35[_0x0789('0x26')]);if(_0x307a35[_0x0789('0x27')]){delete _0x307a35[_0x0789('0x27')];}_0x23d1e2[_0x0789('0x19')](_0x590e5b)[_0x0789('0x28')](_0x307a35);};}exports[_0x0789('0x29')]=function(_0x3a9ee,_0x4ae70f){var _0x513a87={},_0x246d45={},_0x407b29={'count':0x0,'rows':[]};var _0x34a1a3=_[_0x0789('0x2a')](db[_0x0789('0x2b')][_0x0789('0x2c')],function(_0x2a9d3d){return{'name':_0x2a9d3d[_0x0789('0x2d')],'type':_0x2a9d3d['type']['key']};});_0x246d45[_0x0789('0x2e')]=_[_0x0789('0x2a')](_0x34a1a3,_0x0789('0x27'));_0x246d45['query']=_['keys'](_0x3a9ee[_0x0789('0x2f')]);_0x246d45[_0x0789('0x30')]=_[_0x0789('0x31')](_0x246d45['model'],_0x246d45['query']);_0x513a87[_0x0789('0x32')]=_[_0x0789('0x31')](_0x246d45[_0x0789('0x2e')],qs[_0x0789('0x33')](_0x3a9ee[_0x0789('0x2f')][_0x0789('0x33')]));_0x513a87[_0x0789('0x32')]=_0x513a87[_0x0789('0x32')][_0x0789('0x34')]?_0x513a87[_0x0789('0x32')]:_0x246d45[_0x0789('0x2e')];if(!_0x3a9ee[_0x0789('0x2f')][_0x0789('0x35')](_0x0789('0x36'))){_0x513a87['limit']=qs[_0x0789('0x1d')](_0x3a9ee[_0x0789('0x2f')]['limit']);_0x513a87[_0x0789('0x1c')]=qs[_0x0789('0x1c')](_0x3a9ee['query'][_0x0789('0x1c')]);}_0x513a87['order']=qs[_0x0789('0x37')](_0x3a9ee[_0x0789('0x2f')]['sort']);_0x513a87[_0x0789('0x38')]=qs['filters'](_[_0x0789('0x39')](_0x3a9ee[_0x0789('0x2f')],_0x246d45[_0x0789('0x30')]),_0x34a1a3);if(_0x3a9ee[_0x0789('0x2f')][_0x0789('0x3a')]){_0x513a87[_0x0789('0x38')]=_[_0x0789('0x3b')](_0x513a87[_0x0789('0x38')],{'$or':_[_0x0789('0x2a')](_0x34a1a3,function(_0x40199b){if(_0x40199b['type']!==_0x0789('0x3c')){var _0x47cb7e={};_0x47cb7e[_0x40199b['name']]={'$like':'%'+_0x3a9ee[_0x0789('0x2f')][_0x0789('0x3a')]+'%'};return _0x47cb7e;}})});}_0x513a87=_[_0x0789('0x3b')]({},_0x513a87,_0x3a9ee[_0x0789('0x3d')]);var _0x4d1e91={'where':_0x513a87[_0x0789('0x38')]};return db[_0x0789('0x2b')][_0x0789('0x1f')](_0x4d1e91)['then'](function(_0x25963b){_0x407b29['count']=_0x25963b;if(_0x3a9ee[_0x0789('0x2f')][_0x0789('0x3e')]){_0x513a87[_0x0789('0x3f')]=[{'all':!![]}];}return db['DeskAccount'][_0x0789('0x40')](_0x513a87);})[_0x0789('0x25')](function(_0x2c55b4){_0x407b29[_0x0789('0x41')]=_0x2c55b4;return _0x407b29;})[_0x0789('0x25')](respondWithFilteredResult(_0x4ae70f,_0x513a87))['catch'](handleError(_0x4ae70f,null));};exports[_0x0789('0x42')]=function(_0x2efe9d,_0x498c8e){var _0x2022d6={'raw':![],'where':{'id':_0x2efe9d['params']['id']}},_0x2d426a={};_0x2d426a[_0x0789('0x2e')]=_['keys'](db[_0x0789('0x2b')]['rawAttributes']);_0x2d426a[_0x0789('0x2f')]=_['keys'](_0x2efe9d['query']);_0x2d426a[_0x0789('0x30')]=_[_0x0789('0x31')](_0x2d426a['model'],_0x2d426a[_0x0789('0x2f')]);_0x2022d6['attributes']=_['intersection'](_0x2d426a[_0x0789('0x2e')],qs['fields'](_0x2efe9d['query']['fields']));_0x2022d6[_0x0789('0x32')]=_0x2022d6[_0x0789('0x32')]['length']?_0x2022d6[_0x0789('0x32')]:_0x2d426a[_0x0789('0x2e')];if(_0x2efe9d['query'][_0x0789('0x3e')]){_0x2022d6['include']=[{'all':!![]}];}_0x2022d6=_[_0x0789('0x3b')]({},_0x2022d6,_0x2efe9d[_0x0789('0x3d')]);return db[_0x0789('0x2b')][_0x0789('0x43')](_0x2022d6)[_0x0789('0x25')](handleEntityNotFound(_0x498c8e,null))[_0x0789('0x25')](respondWithResult(_0x498c8e,null))[_0x0789('0x44')](handleError(_0x498c8e,null));};exports[_0x0789('0x45')]=function(_0x5e5ab3,_0xaee82b){return db[_0x0789('0x2b')][_0x0789('0x45')](_0x5e5ab3['body'],{})[_0x0789('0x25')](respondWithResult(_0xaee82b,0xc9))[_0x0789('0x44')](handleError(_0xaee82b,null));};exports[_0x0789('0x24')]=function(_0x5d5c92,_0x4f8974){if(_0x5d5c92[_0x0789('0x46')]['id']){delete _0x5d5c92['body']['id'];}return db[_0x0789('0x2b')][_0x0789('0x43')]({'where':{'id':_0x5d5c92['params']['id']}})['then'](handleEntityNotFound(_0x4f8974,null))['then'](saveUpdates(_0x5d5c92[_0x0789('0x46')],null))[_0x0789('0x25')](respondWithResult(_0x4f8974,null))[_0x0789('0x44')](handleError(_0x4f8974,null));};exports['destroy']=function(_0x360649,_0x32d2ba){return db['DeskAccount']['find']({'where':{'id':_0x360649[_0x0789('0x47')]['id']}})[_0x0789('0x25')](handleEntityNotFound(_0x32d2ba,null))[_0x0789('0x25')](removeEntity(_0x32d2ba,null))[_0x0789('0x44')](handleError(_0x32d2ba,null));};exports[_0x0789('0x48')]=function(_0x46d09d,_0x492066,_0x27be19){var _0x3ad7cd={};var _0x27046c={};var _0x8333e2;var _0xebd473;return db[_0x0789('0x2b')][_0x0789('0x49')]({'where':{'id':_0x46d09d[_0x0789('0x47')]['id']}})['then'](handleEntityNotFound(_0x492066,null))['then'](function(_0x3b8dfa){if(_0x3b8dfa){_0x8333e2=_0x3b8dfa;_0x27046c['model']=_[_0x0789('0x4a')](db[_0x0789('0x4b')][_0x0789('0x2c')]);_0x27046c['query']=_['keys'](_0x46d09d[_0x0789('0x2f')]);_0x27046c['filters']=_['intersection'](_0x27046c['model'],_0x27046c[_0x0789('0x2f')]);_0x3ad7cd[_0x0789('0x32')]=_[_0x0789('0x31')](_0x27046c['model'],qs[_0x0789('0x33')](_0x46d09d[_0x0789('0x2f')][_0x0789('0x33')]));_0x3ad7cd['attributes']=_0x3ad7cd['attributes']['length']?_0x3ad7cd[_0x0789('0x32')]:_0x27046c[_0x0789('0x2e')];_0x3ad7cd[_0x0789('0x4c')]=qs['sort'](_0x46d09d[_0x0789('0x2f')][_0x0789('0x37')]);_0x3ad7cd[_0x0789('0x38')]=qs[_0x0789('0x30')](_['pick'](_0x46d09d[_0x0789('0x2f')],_0x27046c['filters']));if(_0x46d09d['query']['filter']){_0x3ad7cd[_0x0789('0x38')]=_[_0x0789('0x3b')](_0x3ad7cd[_0x0789('0x38')],{'$or':_[_0x0789('0x2a')](_0x3ad7cd[_0x0789('0x32')],function(_0x54aad2){var _0x1f77dd={};_0x1f77dd[_0x54aad2]={'$like':'%'+_0x46d09d[_0x0789('0x2f')][_0x0789('0x3a')]+'%'};return _0x1f77dd;})});}_0x3ad7cd=_['merge']({},_0x3ad7cd,_0x46d09d[_0x0789('0x3d')]);return _0x8333e2[_0x0789('0x48')](_0x3ad7cd);}})['then'](function(_0x24ad20){if(_0x24ad20){_0xebd473=_0x24ad20[_0x0789('0x34')];if(!_0x46d09d[_0x0789('0x2f')][_0x0789('0x35')](_0x0789('0x36'))){_0x3ad7cd['limit']=qs[_0x0789('0x1d')](_0x46d09d[_0x0789('0x2f')][_0x0789('0x1d')]);_0x3ad7cd[_0x0789('0x1c')]=qs['offset'](_0x46d09d[_0x0789('0x2f')]['offset']);}return _0x8333e2['getConfigurations'](_0x3ad7cd);}})[_0x0789('0x25')](function(_0x12db2b){if(_0x12db2b){return _0x12db2b?{'count':_0xebd473,'rows':_0x12db2b}:null;}})[_0x0789('0x25')](respondWithResult(_0x492066,null))[_0x0789('0x44')](handleError(_0x492066,null));};exports['addConfiguration']=function(_0x180e95,_0x2a666e,_0x3074ee){if(_0x180e95[_0x0789('0x46')]['id']){delete _0x180e95['body']['id'];}return db[_0x0789('0x2b')][_0x0789('0x49')]({'where':{'id':_0x180e95[_0x0789('0x47')]['id']}})[_0x0789('0x25')](handleEntityNotFound(_0x2a666e,null))[_0x0789('0x25')](function(_0x3dfc41){if(_0x3dfc41){_0x180e95[_0x0789('0x46')]['AccountId']=_0x3dfc41['id'];_0x180e95[_0x0789('0x46')]['Subjects']=integrations[_0x0789('0x4d')](_0x180e95['body'][_0x0789('0x4e')],_0x180e95[_0x0789('0x46')][_0x0789('0x4f')]);_0x180e95[_0x0789('0x46')]['Descriptions']=integrations[_0x0789('0x50')](_0x180e95['body'][_0x0789('0x4e')],_0x180e95[_0x0789('0x46')][_0x0789('0x4f')]);return db[_0x0789('0x4b')][_0x0789('0x45')](_0x180e95['body'],{'include':[{'model':db[_0x0789('0x51')],'as':'Subjects'},{'model':db[_0x0789('0x51')],'as':'Descriptions'}]});}return null;})[_0x0789('0x25')](respondWithResult(_0x2a666e,null))[_0x0789('0x44')](handleError(_0x2a666e,null));};exports[_0x0789('0x52')]=function(_0x3c2ae4,_0x403cce,_0x31e972){var _0x1b8824=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xed34ff='';return db[_0x0789('0x2b')][_0x0789('0x49')]({'where':{'id':_0x3c2ae4[_0x0789('0x47')]['id']},'attributes':['id',_0x0789('0x53'),'authType','username',_0x0789('0x54'),_0x0789('0x55'),_0x0789('0x56'),_0x0789('0x57'),_0x0789('0x58')]})['then'](handleEntityNotFound(_0x403cce,null))['then'](function(_0x4bc5dd){if(_0x4bc5dd){_0xed34ff=_0x4bc5dd[_0x0789('0x53')];var _0x118e53=_0xed34ff['slice'](-0x1);if(_0x118e53==='/'){_0xed34ff=_0xed34ff[_0x0789('0x59')](0x0,_0xed34ff[_0x0789('0x5a')](_0x118e53));}var _0x12020b={'method':_0x0789('0x5b'),'uri':util[_0x0789('0x5c')](_0x0789('0x5d'),_0xed34ff),'headers':{'Content-Type':_0x0789('0x5e'),'Accept':_0x0789('0x5e')},'json':!![]};if(_0x4bc5dd[_0x0789('0x5f')]==='basic'){_0x12020b[_0x0789('0x60')][_0x0789('0x61')]=util['format'](_0x0789('0x62'),new Buffer(util[_0x0789('0x5c')]('%s:%s',_0x4bc5dd[_0x0789('0x63')],_0x4bc5dd['password']))[_0x0789('0x64')](_0x0789('0x65')));}return rp(_0x12020b)['then'](function(_0x35807d){return _0x1b8824[_0x0789('0x66')](_['map'](_0x35807d['_embedded']['entries'],function(_0x5c96c1){return{'id':_0x5c96c1['name'],'name':_0x5c96c1[_0x0789('0x27')],'type':_0x5c96c1[_0x0789('0x4f')],'active':_0x5c96c1[_0x0789('0x67')],'label':_0x5c96c1['label'],'custom':!![]};}));});}})[_0x0789('0x25')](function(_0x4aebbc){return{'count':_0x4aebbc[_0x0789('0x34')],'rows':_0x4aebbc};})[_0x0789('0x25')](respondWithResult(_0x403cce,null))['catch'](function(_0x3c3fbe){var _0x1195c6=_0x3c2ae4[_0x0789('0x2f')][_0x0789('0x68')]?0x1f4:_0x3c3fbe[_0x0789('0x69')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x0789('0x52'),_0x1195c6,JSON['stringify'](_0x3c3fbe));delete _0x3c3fbe[_0x0789('0x27')];if(_0x1195c6===0x191){_0x1195c6=0x190;}_0x403cce['status'](_0x1195c6)['send'](_0x3c2ae4[_0x0789('0x2f')][_0x0789('0x68')]?{'message':_0x0789('0x6a'),'statusCode':_0x3c3fbe[_0x0789('0x69')]}:_0x3c3fbe);});}; \ No newline at end of file +var _0x486d=['path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../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','json','undefined','limit','count','offset','set','apply','reject','update','destroy','then','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','keys','options','create','body','find','getConfigurations','findOne','DeskConfiguration','length','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','DeskField','Subjects','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','slice','substring','lastIndexOf','GET','format','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','mustache','util'];(function(_0x3aa616,_0x463b69){var _0x15eb62=function(_0x5be47e){while(--_0x5be47e){_0x3aa616['push'](_0x3aa616['shift']());}};_0x15eb62(++_0x463b69);}(_0x486d,0x1bb));var _0xd486=function(_0x4b3bb0,_0x4f5a5b){_0x4b3bb0=_0x4b3bb0-0x0;var _0x34a6c9=_0x486d[_0x4b3bb0];return _0x34a6c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd486('0x0'));var zipdir=require(_0xd486('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd486('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd486('0x3'));var util=require(_0xd486('0x4'));var path=require(_0xd486('0x5'));var sox=require('sox');var csv=require(_0xd486('0x6'));var ejs=require(_0xd486('0x7'));var fs=require('fs');var fs_extra=require(_0xd486('0x8'));var _=require(_0xd486('0x9'));var squel=require('squel');var crypto=require(_0xd486('0xa'));var jsforce=require(_0xd486('0xb'));var deskjs=require(_0xd486('0xc'));var toCsv=require(_0xd486('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd486('0xd'));var as=require(_0xd486('0xe'));var hardwareService=require(_0xd486('0xf'));var logger=require(_0xd486('0x10'))(_0xd486('0x11'));var utils=require(_0xd486('0x12'));var config=require(_0xd486('0x13'));var licenseUtil=require(_0xd486('0x14'));var db=require(_0xd486('0x15'))['db'];var integrations=require(_0xd486('0x16'));function respondWithStatusCode(_0x2381a8,_0x103107){_0x103107=_0x103107||0xcc;return function(_0x2b358b){if(_0x2b358b){return _0x2381a8[_0xd486('0x17')](_0x103107);}return _0x2381a8[_0xd486('0x18')](_0x103107)[_0xd486('0x19')]();};}function respondWithResult(_0x31faa1,_0x40f660){_0x40f660=_0x40f660||0xc8;return function(_0x1b23e8){if(_0x1b23e8){return _0x31faa1['status'](_0x40f660)[_0xd486('0x1a')](_0x1b23e8);}};}function respondWithFilteredResult(_0x456148,_0x289fd7){return function(_0x2e1d73){if(_0x2e1d73){var _0x106db4=typeof _0x289fd7['offset']===_0xd486('0x1b')&&typeof _0x289fd7[_0xd486('0x1c')]===_0xd486('0x1b');var _0x607d7a=_0x2e1d73[_0xd486('0x1d')];var _0x2c9fd0=_0x106db4?0x0:_0x289fd7['offset'];var _0x5a636f=_0x106db4?_0x2e1d73[_0xd486('0x1d')]:_0x289fd7[_0xd486('0x1e')]+_0x289fd7['limit'];var _0x565a65;if(_0x5a636f>=_0x607d7a){_0x5a636f=_0x607d7a;_0x565a65=0xc8;}else{_0x565a65=0xce;}_0x456148[_0xd486('0x18')](_0x565a65);return _0x456148[_0xd486('0x1f')]('Content-Range',_0x2c9fd0+'-'+_0x5a636f+'/'+_0x607d7a)[_0xd486('0x1a')](_0x2e1d73);}return null;};}function patchUpdates(_0x19392e){return function(_0x33b8d8){try{jsonpatch[_0xd486('0x20')](_0x33b8d8,_0x19392e,!![]);}catch(_0x569bf1){return BPromise[_0xd486('0x21')](_0x569bf1);}return _0x33b8d8['save']();};}function saveUpdates(_0x25dad9,_0x5d3401){return function(_0x2e9a8f){if(_0x2e9a8f){return _0x2e9a8f[_0xd486('0x22')](_0x25dad9)['then'](function(_0x1e5c4f){return _0x1e5c4f;});}return null;};}function removeEntity(_0x3caea2,_0x58d417){return function(_0x2c400d){if(_0x2c400d){return _0x2c400d[_0xd486('0x23')]()[_0xd486('0x24')](function(){_0x3caea2[_0xd486('0x18')](0xcc)[_0xd486('0x19')]();});}};}function handleEntityNotFound(_0x16d5a2,_0x208f3b){return function(_0x3df271){if(!_0x3df271){_0x16d5a2[_0xd486('0x17')](0x194);}return _0x3df271;};}function handleError(_0x34e19,_0x4533fa){_0x4533fa=_0x4533fa||0x1f4;return function(_0x3edc72){logger[_0xd486('0x25')](_0x3edc72[_0xd486('0x26')]);if(_0x3edc72['name']){delete _0x3edc72[_0xd486('0x27')];}_0x34e19[_0xd486('0x18')](_0x4533fa)[_0xd486('0x28')](_0x3edc72);};}exports['index']=function(_0x1459a1,_0x453e3f){var _0x6551fb={},_0x483e93={},_0x101b23={'count':0x0,'rows':[]};var _0x38c45d=_[_0xd486('0x29')](db[_0xd486('0x2a')][_0xd486('0x2b')],function(_0x1198bc){return{'name':_0x1198bc[_0xd486('0x2c')],'type':_0x1198bc[_0xd486('0x2d')][_0xd486('0x2e')]};});_0x483e93[_0xd486('0x2f')]=_[_0xd486('0x29')](_0x38c45d,_0xd486('0x27'));_0x483e93[_0xd486('0x30')]=_['keys'](_0x1459a1[_0xd486('0x30')]);_0x483e93['filters']=_[_0xd486('0x31')](_0x483e93[_0xd486('0x2f')],_0x483e93['query']);_0x6551fb[_0xd486('0x32')]=_[_0xd486('0x31')](_0x483e93['model'],qs[_0xd486('0x33')](_0x1459a1[_0xd486('0x30')][_0xd486('0x33')]));_0x6551fb[_0xd486('0x32')]=_0x6551fb[_0xd486('0x32')]['length']?_0x6551fb[_0xd486('0x32')]:_0x483e93[_0xd486('0x2f')];if(!_0x1459a1['query'][_0xd486('0x34')](_0xd486('0x35'))){_0x6551fb['limit']=qs['limit'](_0x1459a1[_0xd486('0x30')]['limit']);_0x6551fb[_0xd486('0x1e')]=qs['offset'](_0x1459a1[_0xd486('0x30')]['offset']);}_0x6551fb[_0xd486('0x36')]=qs[_0xd486('0x37')](_0x1459a1[_0xd486('0x30')][_0xd486('0x37')]);_0x6551fb[_0xd486('0x38')]=qs[_0xd486('0x39')](_[_0xd486('0x3a')](_0x1459a1[_0xd486('0x30')],_0x483e93[_0xd486('0x39')]),_0x38c45d);if(_0x1459a1['query']['filter']){_0x6551fb[_0xd486('0x38')]=_['merge'](_0x6551fb[_0xd486('0x38')],{'$or':_[_0xd486('0x29')](_0x38c45d,function(_0x4706ed){if(_0x4706ed[_0xd486('0x2d')]!==_0xd486('0x3b')){var _0x2f1b53={};_0x2f1b53[_0x4706ed[_0xd486('0x27')]]={'$like':'%'+_0x1459a1['query'][_0xd486('0x3c')]+'%'};return _0x2f1b53;}})});}_0x6551fb=_[_0xd486('0x3d')]({},_0x6551fb,_0x1459a1['options']);var _0x32ff53={'where':_0x6551fb[_0xd486('0x38')]};return db['DeskAccount'][_0xd486('0x1d')](_0x32ff53)['then'](function(_0x2949e8){_0x101b23[_0xd486('0x1d')]=_0x2949e8;if(_0x1459a1[_0xd486('0x30')][_0xd486('0x3e')]){_0x6551fb[_0xd486('0x3f')]=[{'all':!![]}];}return db['DeskAccount'][_0xd486('0x40')](_0x6551fb);})[_0xd486('0x24')](function(_0x15be59){_0x101b23['rows']=_0x15be59;return _0x101b23;})[_0xd486('0x24')](respondWithFilteredResult(_0x453e3f,_0x6551fb))[_0xd486('0x41')](handleError(_0x453e3f,null));};exports[_0xd486('0x42')]=function(_0x113a11,_0x5a3db1){var _0x5d52de={'raw':![],'where':{'id':_0x113a11[_0xd486('0x43')]['id']}},_0x2b6301={};_0x2b6301[_0xd486('0x2f')]=_[_0xd486('0x44')](db[_0xd486('0x2a')]['rawAttributes']);_0x2b6301[_0xd486('0x30')]=_['keys'](_0x113a11[_0xd486('0x30')]);_0x2b6301['filters']=_[_0xd486('0x31')](_0x2b6301[_0xd486('0x2f')],_0x2b6301['query']);_0x5d52de['attributes']=_['intersection'](_0x2b6301[_0xd486('0x2f')],qs[_0xd486('0x33')](_0x113a11[_0xd486('0x30')][_0xd486('0x33')]));_0x5d52de['attributes']=_0x5d52de[_0xd486('0x32')]['length']?_0x5d52de[_0xd486('0x32')]:_0x2b6301[_0xd486('0x2f')];if(_0x113a11[_0xd486('0x30')][_0xd486('0x3e')]){_0x5d52de[_0xd486('0x3f')]=[{'all':!![]}];}_0x5d52de=_[_0xd486('0x3d')]({},_0x5d52de,_0x113a11[_0xd486('0x45')]);return db[_0xd486('0x2a')]['find'](_0x5d52de)[_0xd486('0x24')](handleEntityNotFound(_0x5a3db1,null))[_0xd486('0x24')](respondWithResult(_0x5a3db1,null))[_0xd486('0x41')](handleError(_0x5a3db1,null));};exports[_0xd486('0x46')]=function(_0x3d5a02,_0x2baf2e){return db[_0xd486('0x2a')][_0xd486('0x46')](_0x3d5a02['body'],{})['then'](respondWithResult(_0x2baf2e,0xc9))[_0xd486('0x41')](handleError(_0x2baf2e,null));};exports[_0xd486('0x22')]=function(_0x534c15,_0x368f08){if(_0x534c15[_0xd486('0x47')]['id']){delete _0x534c15[_0xd486('0x47')]['id'];}return db[_0xd486('0x2a')]['find']({'where':{'id':_0x534c15[_0xd486('0x43')]['id']}})[_0xd486('0x24')](handleEntityNotFound(_0x368f08,null))[_0xd486('0x24')](saveUpdates(_0x534c15['body'],null))[_0xd486('0x24')](respondWithResult(_0x368f08,null))[_0xd486('0x41')](handleError(_0x368f08,null));};exports[_0xd486('0x23')]=function(_0x498393,_0x5286ef){return db['DeskAccount'][_0xd486('0x48')]({'where':{'id':_0x498393['params']['id']}})[_0xd486('0x24')](handleEntityNotFound(_0x5286ef,null))[_0xd486('0x24')](removeEntity(_0x5286ef,null))[_0xd486('0x41')](handleError(_0x5286ef,null));};exports[_0xd486('0x49')]=function(_0x5678a7,_0x182c5e,_0x128341){var _0x1d4fea={};var _0x2f5eba={};var _0x254c9f;var _0x393307;return db[_0xd486('0x2a')][_0xd486('0x4a')]({'where':{'id':_0x5678a7[_0xd486('0x43')]['id']}})['then'](handleEntityNotFound(_0x182c5e,null))[_0xd486('0x24')](function(_0x417db3){if(_0x417db3){_0x254c9f=_0x417db3;_0x2f5eba['model']=_[_0xd486('0x44')](db[_0xd486('0x4b')][_0xd486('0x2b')]);_0x2f5eba[_0xd486('0x30')]=_[_0xd486('0x44')](_0x5678a7['query']);_0x2f5eba[_0xd486('0x39')]=_[_0xd486('0x31')](_0x2f5eba['model'],_0x2f5eba[_0xd486('0x30')]);_0x1d4fea[_0xd486('0x32')]=_[_0xd486('0x31')](_0x2f5eba[_0xd486('0x2f')],qs[_0xd486('0x33')](_0x5678a7[_0xd486('0x30')][_0xd486('0x33')]));_0x1d4fea['attributes']=_0x1d4fea[_0xd486('0x32')][_0xd486('0x4c')]?_0x1d4fea[_0xd486('0x32')]:_0x2f5eba['model'];_0x1d4fea[_0xd486('0x36')]=qs[_0xd486('0x37')](_0x5678a7[_0xd486('0x30')][_0xd486('0x37')]);_0x1d4fea[_0xd486('0x38')]=qs['filters'](_[_0xd486('0x3a')](_0x5678a7[_0xd486('0x30')],_0x2f5eba[_0xd486('0x39')]));if(_0x5678a7['query'][_0xd486('0x3c')]){_0x1d4fea[_0xd486('0x38')]=_['merge'](_0x1d4fea[_0xd486('0x38')],{'$or':_['map'](_0x1d4fea['attributes'],function(_0x112b99){var _0x5e8ec3={};_0x5e8ec3[_0x112b99]={'$like':'%'+_0x5678a7[_0xd486('0x30')][_0xd486('0x3c')]+'%'};return _0x5e8ec3;})});}_0x1d4fea=_[_0xd486('0x3d')]({},_0x1d4fea,_0x5678a7['options']);return _0x254c9f[_0xd486('0x49')](_0x1d4fea);}})[_0xd486('0x24')](function(_0x263343){if(_0x263343){_0x393307=_0x263343['length'];if(!_0x5678a7[_0xd486('0x30')][_0xd486('0x34')](_0xd486('0x35'))){_0x1d4fea['limit']=qs[_0xd486('0x1c')](_0x5678a7[_0xd486('0x30')][_0xd486('0x1c')]);_0x1d4fea['offset']=qs[_0xd486('0x1e')](_0x5678a7['query'][_0xd486('0x1e')]);}return _0x254c9f[_0xd486('0x49')](_0x1d4fea);}})[_0xd486('0x24')](function(_0x5a75b5){if(_0x5a75b5){return _0x5a75b5?{'count':_0x393307,'rows':_0x5a75b5}:null;}})[_0xd486('0x24')](respondWithResult(_0x182c5e,null))[_0xd486('0x41')](handleError(_0x182c5e,null));};exports[_0xd486('0x4d')]=function(_0x1e80d1,_0x3109e4,_0xa14991){if(_0x1e80d1[_0xd486('0x47')]['id']){delete _0x1e80d1[_0xd486('0x47')]['id'];}return db[_0xd486('0x2a')][_0xd486('0x4a')]({'where':{'id':_0x1e80d1[_0xd486('0x43')]['id']}})[_0xd486('0x24')](handleEntityNotFound(_0x3109e4,null))['then'](function(_0x57f2b2){if(_0x57f2b2){_0x1e80d1['body'][_0xd486('0x4e')]=_0x57f2b2['id'];_0x1e80d1[_0xd486('0x47')]['Subjects']=integrations[_0xd486('0x4f')](_0x1e80d1['body']['channel'],_0x1e80d1[_0xd486('0x47')]['type']);_0x1e80d1[_0xd486('0x47')][_0xd486('0x50')]=integrations[_0xd486('0x51')](_0x1e80d1[_0xd486('0x47')][_0xd486('0x52')],_0x1e80d1[_0xd486('0x47')][_0xd486('0x2d')]);return db[_0xd486('0x4b')][_0xd486('0x46')](_0x1e80d1[_0xd486('0x47')],{'include':[{'model':db[_0xd486('0x53')],'as':_0xd486('0x54')},{'model':db[_0xd486('0x53')],'as':_0xd486('0x50')}]});}return null;})['then'](respondWithResult(_0x3109e4,null))[_0xd486('0x41')](handleError(_0x3109e4,null));};exports[_0xd486('0x55')]=function(_0x587131,_0x5a6b7c,_0x6cff5f){var _0x4e29f4=[{'name':_0xd486('0x56'),'label':_0xd486('0x56'),'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 _0x433916='';return db[_0xd486('0x2a')]['findOne']({'where':{'id':_0x587131['params']['id']},'attributes':['id',_0xd486('0x57'),_0xd486('0x58'),_0xd486('0x59'),_0xd486('0x5a'),_0xd486('0x5b'),_0xd486('0x5c'),'token','tokenSecret']})[_0xd486('0x24')](handleEntityNotFound(_0x5a6b7c,null))[_0xd486('0x24')](function(_0x2a3c7a){if(_0x2a3c7a){_0x433916=_0x2a3c7a[_0xd486('0x57')];var _0x3f0f95=_0x433916[_0xd486('0x5d')](-0x1);if(_0x3f0f95==='/'){_0x433916=_0x433916[_0xd486('0x5e')](0x0,_0x433916[_0xd486('0x5f')](_0x3f0f95));}var _0x9a19c0={'method':_0xd486('0x60'),'uri':util[_0xd486('0x61')]('%s/custom_fields',_0x433916),'headers':{'Content-Type':_0xd486('0x62'),'Accept':_0xd486('0x62')},'json':!![]};if(_0x2a3c7a[_0xd486('0x58')]==='basic'){_0x9a19c0[_0xd486('0x63')][_0xd486('0x64')]=util[_0xd486('0x61')](_0xd486('0x65'),new Buffer(util['format'](_0xd486('0x66'),_0x2a3c7a[_0xd486('0x59')],_0x2a3c7a['password']))[_0xd486('0x67')](_0xd486('0x68')));}return rp(_0x9a19c0)[_0xd486('0x24')](function(_0x120366){return _0x4e29f4[_0xd486('0x69')](_['map'](_0x120366[_0xd486('0x6a')]['entries'],function(_0x57b6b1){return{'id':_0x57b6b1['name'],'name':_0x57b6b1[_0xd486('0x27')],'type':_0x57b6b1['type'],'active':_0x57b6b1['active'],'label':_0x57b6b1[_0xd486('0x6b')],'custom':!![]};}));});}})['then'](function(_0x9e4ba8){return{'count':_0x9e4ba8[_0xd486('0x4c')],'rows':_0x9e4ba8};})[_0xd486('0x24')](respondWithResult(_0x5a6b7c,null))[_0xd486('0x41')](function(_0x5799f7){var _0x2c4259=_0x587131[_0xd486('0x30')][_0xd486('0x6c')]?0x1f4:_0x5799f7['statusCode']||0x1f4;logger[_0xd486('0x25')](_0xd486('0x6d'),'getFields',_0x2c4259,JSON[_0xd486('0x6e')](_0x5799f7));delete _0x5799f7[_0xd486('0x27')];if(_0x2c4259===0x191){_0x2c4259=0x190;}_0x5a6b7c[_0xd486('0x18')](_0x2c4259)[_0xd486('0x28')](_0x587131[_0xd486('0x30')][_0xd486('0x6c')]?{'message':_0xd486('0x6f'),'statusCode':_0x5799f7['statusCode']}:_0x5799f7);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 42b31ac..4c5b6fd 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 _0x6b81=['DeskAccount','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x6b81,0x135));var _0x16b8=function(_0x253201,_0x55488a){_0x253201=_0x253201-0x0;var _0x4a479a=_0x6b81[_0x253201];return _0x4a479a;};'use strict';var _=require(_0x16b8('0x0'));var util=require(_0x16b8('0x1'));var logger=require(_0x16b8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x16b8('0x3'));var rp=require(_0x16b8('0x4'));var fs=require('fs');var path=require(_0x16b8('0x5'));var rimraf=require(_0x16b8('0x6'));var config=require(_0x16b8('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x16b8('0x8'));module['exports']=function(_0x361b4f,_0x57b143){return _0x361b4f[_0x16b8('0x9')](_0x16b8('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9eb2=['bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','define','int_desk_accounts','lodash','api','moment'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x9eb2,0x101));var _0x29eb=function(_0xe2f541,_0x52dfd1){_0xe2f541=_0xe2f541-0x0;var _0x4ae7b0=_0x9eb2[_0xe2f541];return _0x4ae7b0;};'use strict';var _=require(_0x29eb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x29eb('0x1'));var moment=require(_0x29eb('0x2'));var BPromise=require(_0x29eb('0x3'));var rp=require(_0x29eb('0x4'));var fs=require('fs');var path=require(_0x29eb('0x5'));var rimraf=require('rimraf');var config=require(_0x29eb('0x6'));var attributes=require(_0x29eb('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xa6a12a,_0x348918){return _0xa6a12a[_0x29eb('0x8')]('DeskAccount',attributes,{'tableName':_0x29eb('0x9'),'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 3bf4585..887d63f 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 _0xebb5=['limit','include','model','attributes','map','debug','ShowDeskAccount','find','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetDeskAccount','DeskAccount','options','raw','where'];(function(_0x51f182,_0x3deed0){var _0xf2a7dd=function(_0x5d2f71){while(--_0x5d2f71){_0x51f182['push'](_0x51f182['shift']());}};_0xf2a7dd(++_0x3deed0);}(_0xebb5,0x15c));var _0x5ebb=function(_0x3ee5dd,_0x278f86){_0x3ee5dd=_0x3ee5dd-0x0;var _0x40b967=_0xebb5[_0x3ee5dd];return _0x40b967;};'use strict';var _=require('lodash');var util=require(_0x5ebb('0x0'));var moment=require(_0x5ebb('0x1'));var BPromise=require(_0x5ebb('0x2'));var rs=require(_0x5ebb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ebb('0x4'));var config=require(_0x5ebb('0x5'));var jayson=require(_0x5ebb('0x6'));var client=jayson[_0x5ebb('0x7')][_0x5ebb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24353f,_0x16f89d,_0x3ca6ad){return new BPromise(function(_0x108ef5,_0x53e3d3){return client[_0x5ebb('0x9')](_0x24353f,_0x3ca6ad)[_0x5ebb('0xa')](function(_0x1a43a0){logger[_0x5ebb('0xb')](_0x5ebb('0xc'),_0x16f89d,'request\x20sent');logger['debug'](_0x5ebb('0xd'),_0x16f89d,'request\x20sent',JSON[_0x5ebb('0xe')](_0x1a43a0));if(_0x1a43a0[_0x5ebb('0xf')]){if(_0x1a43a0['error'][_0x5ebb('0x10')]===0x1f4){logger[_0x5ebb('0xf')](_0x5ebb('0xc'),_0x16f89d,_0x1a43a0['error'][_0x5ebb('0x11')]);return _0x53e3d3(_0x1a43a0[_0x5ebb('0xf')][_0x5ebb('0x11')]);}logger['error'](_0x5ebb('0xc'),_0x16f89d,_0x1a43a0['error']['message']);return _0x108ef5(_0x1a43a0['error']['message']);}else{logger[_0x5ebb('0xb')](_0x5ebb('0xc'),_0x16f89d,_0x5ebb('0x12'));_0x108ef5(_0x1a43a0[_0x5ebb('0x13')]['message']);}})[_0x5ebb('0x14')](function(_0x21a3e8){logger[_0x5ebb('0xf')](_0x5ebb('0xc'),_0x16f89d,_0x21a3e8);_0x53e3d3(_0x21a3e8);});});}exports[_0x5ebb('0x15')]=function(_0x32812d){var _0x17e68d=this;return new Promise(function(_0x2d448b,_0x621724){return db[_0x5ebb('0x16')]['findAll']({'raw':_0x32812d[_0x5ebb('0x17')]?_0x32812d[_0x5ebb('0x17')][_0x5ebb('0x18')]===undefined?!![]:![]:!![],'where':_0x32812d[_0x5ebb('0x17')]?_0x32812d['options'][_0x5ebb('0x19')]||null:null,'attributes':_0x32812d[_0x5ebb('0x17')]?_0x32812d[_0x5ebb('0x17')]['attributes']||null:null,'limit':_0x32812d[_0x5ebb('0x17')]?_0x32812d[_0x5ebb('0x17')][_0x5ebb('0x1a')]||null:null,'include':_0x32812d[_0x5ebb('0x17')]?_0x32812d[_0x5ebb('0x17')][_0x5ebb('0x1b')]?_['map'](_0x32812d[_0x5ebb('0x17')][_0x5ebb('0x1b')],function(_0x169b75){return{'model':db[_0x169b75[_0x5ebb('0x1c')]],'as':_0x169b75['as'],'attributes':_0x169b75[_0x5ebb('0x1d')],'include':_0x169b75['include']?_[_0x5ebb('0x1e')](_0x169b75[_0x5ebb('0x1b')],function(_0x114d9b){return{'model':db[_0x114d9b[_0x5ebb('0x1c')]],'as':_0x114d9b['as'],'attributes':_0x114d9b[_0x5ebb('0x1d')],'include':_0x114d9b[_0x5ebb('0x1b')]?_[_0x5ebb('0x1e')](_0x114d9b['include'],function(_0x301c50){return{'model':db[_0x301c50[_0x5ebb('0x1c')]],'as':_0x301c50['as'],'attributes':_0x301c50['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ebb('0xa')](function(_0x4b0cb0){logger['info']('GetDeskAccount',_0x32812d);logger[_0x5ebb('0x1f')](_0x5ebb('0x15'),_0x32812d,JSON[_0x5ebb('0xe')](_0x4b0cb0));_0x2d448b(_0x4b0cb0);})[_0x5ebb('0x14')](function(_0x1ea21e){logger[_0x5ebb('0xf')](_0x5ebb('0x15'),_0x1ea21e['message'],_0x32812d);_0x621724(_0x17e68d[_0x5ebb('0xf')](0x1f4,_0x1ea21e[_0x5ebb('0x11')]));});});};exports[_0x5ebb('0x20')]=function(_0x5a7f05){var _0x5a474c=this;return new Promise(function(_0x48e460,_0x9dcef){return db['DeskAccount'][_0x5ebb('0x21')]({'raw':_0x5a7f05['options']?_0x5a7f05[_0x5ebb('0x17')][_0x5ebb('0x18')]===undefined?!![]:![]:!![],'where':_0x5a7f05[_0x5ebb('0x17')]?_0x5a7f05[_0x5ebb('0x17')][_0x5ebb('0x19')]||null:null,'attributes':_0x5a7f05[_0x5ebb('0x17')]?_0x5a7f05[_0x5ebb('0x17')][_0x5ebb('0x1d')]||null:null,'include':_0x5a7f05[_0x5ebb('0x17')]?_0x5a7f05[_0x5ebb('0x17')][_0x5ebb('0x1b')]?_[_0x5ebb('0x1e')](_0x5a7f05[_0x5ebb('0x17')][_0x5ebb('0x1b')],function(_0x1ae69b){return{'model':db[_0x1ae69b['model']],'as':_0x1ae69b['as'],'attributes':_0x1ae69b[_0x5ebb('0x1d')],'include':_0x1ae69b['include']?_['map'](_0x1ae69b[_0x5ebb('0x1b')],function(_0x18cd95){return{'model':db[_0x18cd95['model']],'as':_0x18cd95['as'],'attributes':_0x18cd95['attributes'],'include':_0x18cd95[_0x5ebb('0x1b')]?_['map'](_0x18cd95[_0x5ebb('0x1b')],function(_0x165321){return{'model':db[_0x165321['model']],'as':_0x165321['as'],'attributes':_0x165321[_0x5ebb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5ebb('0xa')](function(_0x5465db){logger[_0x5ebb('0xb')](_0x5ebb('0x20'),_0x5a7f05);logger['debug'](_0x5ebb('0x20'),_0x5a7f05,JSON[_0x5ebb('0xe')](_0x5465db));_0x48e460(_0x5465db);})['catch'](function(_0x1c75b5){logger[_0x5ebb('0xf')](_0x5ebb('0x20'),_0x1c75b5[_0x5ebb('0x11')],_0x5a7f05);_0x9dcef(_0x5a474c[_0x5ebb('0xf')](0x1f4,_0x1c75b5[_0x5ebb('0x11')]));});});}; \ No newline at end of file +var _0x30ab=['attributes','model','debug','ShowDeskAccount','DeskAccount','find','lodash','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','findAll','options','raw','where','limit','include','map'];(function(_0x13a459,_0x1156eb){var _0x2ba7de=function(_0x6fb7c6){while(--_0x6fb7c6){_0x13a459['push'](_0x13a459['shift']());}};_0x2ba7de(++_0x1156eb);}(_0x30ab,0x82));var _0xb30a=function(_0x100956,_0x38d683){_0x100956=_0x100956-0x0;var _0x539b02=_0x30ab[_0x100956];return _0x539b02;};'use strict';var _=require(_0xb30a('0x0'));var util=require('util');var moment=require(_0xb30a('0x1'));var BPromise=require('bluebird');var rs=require(_0xb30a('0x2'));var fs=require('fs');var Redis=require(_0xb30a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb30a('0x4'))(_0xb30a('0x5'));var config=require('../../config/environment');var jayson=require(_0xb30a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b237e,_0x58e8b1,_0x57d431){return new BPromise(function(_0x2d7db2,_0x27b3ac){return client['request'](_0x2b237e,_0x57d431)['then'](function(_0x3ab186){logger[_0xb30a('0x7')](_0xb30a('0x8'),_0x58e8b1,_0xb30a('0x9'));logger['debug'](_0xb30a('0xa'),_0x58e8b1,'request\x20sent',JSON[_0xb30a('0xb')](_0x3ab186));if(_0x3ab186[_0xb30a('0xc')]){if(_0x3ab186[_0xb30a('0xc')][_0xb30a('0xd')]===0x1f4){logger[_0xb30a('0xc')](_0xb30a('0x8'),_0x58e8b1,_0x3ab186['error']['message']);return _0x27b3ac(_0x3ab186[_0xb30a('0xc')][_0xb30a('0xe')]);}logger[_0xb30a('0xc')](_0xb30a('0x8'),_0x58e8b1,_0x3ab186['error'][_0xb30a('0xe')]);return _0x2d7db2(_0x3ab186[_0xb30a('0xc')][_0xb30a('0xe')]);}else{logger[_0xb30a('0x7')](_0xb30a('0x8'),_0x58e8b1,'request\x20sent');_0x2d7db2(_0x3ab186[_0xb30a('0xf')][_0xb30a('0xe')]);}})[_0xb30a('0x10')](function(_0x32a530){logger['error']('DeskAccount,\x20%s,\x20%s',_0x58e8b1,_0x32a530);_0x27b3ac(_0x32a530);});});}exports[_0xb30a('0x11')]=function(_0xb3d400){var _0x371d10=this;return new Promise(function(_0x53cfe0,_0x29ca4d){return db['DeskAccount'][_0xb30a('0x12')]({'raw':_0xb3d400[_0xb30a('0x13')]?_0xb3d400['options'][_0xb30a('0x14')]===undefined?!![]:![]:!![],'where':_0xb3d400[_0xb30a('0x13')]?_0xb3d400[_0xb30a('0x13')][_0xb30a('0x15')]||null:null,'attributes':_0xb3d400[_0xb30a('0x13')]?_0xb3d400[_0xb30a('0x13')]['attributes']||null:null,'limit':_0xb3d400[_0xb30a('0x13')]?_0xb3d400[_0xb30a('0x13')][_0xb30a('0x16')]||null:null,'include':_0xb3d400[_0xb30a('0x13')]?_0xb3d400[_0xb30a('0x13')][_0xb30a('0x17')]?_[_0xb30a('0x18')](_0xb3d400[_0xb30a('0x13')]['include'],function(_0x5a28fc){return{'model':db[_0x5a28fc['model']],'as':_0x5a28fc['as'],'attributes':_0x5a28fc[_0xb30a('0x19')],'include':_0x5a28fc[_0xb30a('0x17')]?_[_0xb30a('0x18')](_0x5a28fc['include'],function(_0x3b1431){return{'model':db[_0x3b1431[_0xb30a('0x1a')]],'as':_0x3b1431['as'],'attributes':_0x3b1431['attributes'],'include':_0x3b1431[_0xb30a('0x17')]?_[_0xb30a('0x18')](_0x3b1431['include'],function(_0x4c21ea){return{'model':db[_0x4c21ea[_0xb30a('0x1a')]],'as':_0x4c21ea['as'],'attributes':_0x4c21ea[_0xb30a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x224d83){logger['info'](_0xb30a('0x11'),_0xb3d400);logger[_0xb30a('0x1b')](_0xb30a('0x11'),_0xb3d400,JSON['stringify'](_0x224d83));_0x53cfe0(_0x224d83);})[_0xb30a('0x10')](function(_0x2a9de6){logger[_0xb30a('0xc')](_0xb30a('0x11'),_0x2a9de6[_0xb30a('0xe')],_0xb3d400);_0x29ca4d(_0x371d10['error'](0x1f4,_0x2a9de6[_0xb30a('0xe')]));});});};exports[_0xb30a('0x1c')]=function(_0x11ec18){var _0x3fa864=this;return new Promise(function(_0x5f2c8d,_0x59f6bd){return db[_0xb30a('0x1d')][_0xb30a('0x1e')]({'raw':_0x11ec18[_0xb30a('0x13')]?_0x11ec18[_0xb30a('0x13')][_0xb30a('0x14')]===undefined?!![]:![]:!![],'where':_0x11ec18[_0xb30a('0x13')]?_0x11ec18[_0xb30a('0x13')][_0xb30a('0x15')]||null:null,'attributes':_0x11ec18[_0xb30a('0x13')]?_0x11ec18['options'][_0xb30a('0x19')]||null:null,'include':_0x11ec18[_0xb30a('0x13')]?_0x11ec18[_0xb30a('0x13')][_0xb30a('0x17')]?_[_0xb30a('0x18')](_0x11ec18[_0xb30a('0x13')][_0xb30a('0x17')],function(_0x45c7ec){return{'model':db[_0x45c7ec['model']],'as':_0x45c7ec['as'],'attributes':_0x45c7ec[_0xb30a('0x19')],'include':_0x45c7ec[_0xb30a('0x17')]?_[_0xb30a('0x18')](_0x45c7ec['include'],function(_0x267341){return{'model':db[_0x267341[_0xb30a('0x1a')]],'as':_0x267341['as'],'attributes':_0x267341[_0xb30a('0x19')],'include':_0x267341[_0xb30a('0x17')]?_[_0xb30a('0x18')](_0x267341[_0xb30a('0x17')],function(_0x275013){return{'model':db[_0x275013['model']],'as':_0x275013['as'],'attributes':_0x275013[_0xb30a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x161dc2){logger['info'](_0xb30a('0x1c'),_0x11ec18);logger[_0xb30a('0x1b')](_0xb30a('0x1c'),_0x11ec18,JSON[_0xb30a('0xb')](_0x161dc2));_0x5f2c8d(_0x161dc2);})[_0xb30a('0x10')](function(_0x1cd887){logger[_0xb30a('0xc')](_0xb30a('0x1c'),_0x1cd887[_0xb30a('0xe')],_0x11ec18);_0x59f6bd(_0x3fa864[_0xb30a('0xc')](0x1f4,_0x1cd887[_0xb30a('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f02dceb..63a1589 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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x244c19,_0x51c8f7){var _0x29c4cc=function(_0x9ce3d1){while(--_0x9ce3d1){_0x244c19['push'](_0x244c19['shift']());}};_0x29c4cc(++_0x51c8f7);}(_0x34e8,0x12c));var _0x834e=function(_0xed929c,_0x45955f){_0xed929c=_0xed929c-0x0;var _0xf3d3c0=_0x34e8[_0xed929c];return _0xf3d3c0;};'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('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=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(_0x397338,_0x22cb6a){var _0x2948c3=function(_0x547427){while(--_0x547427){_0x397338['push'](_0x397338['shift']());}};_0x2948c3(++_0x22cb6a);}(_0x008c,0x188));var _0xc008=function(_0x5906b6,_0x541824){_0x5906b6=_0x5906b6-0x0;var _0x2733da=_0x008c[_0x5906b6];return _0x2733da;};'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 edd89ae..8f14e92 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 _0x4c4b=['exports','STRING','sequelize'];(function(_0x40d394,_0x27f0de){var _0x4f285d=function(_0x2c6c7e){while(--_0x2c6c7e){_0x40d394['push'](_0x40d394['shift']());}};_0x4f285d(++_0x27f0de);}(_0x4c4b,0x1b8));var _0xb4c4=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0x4c4b[_0x24b477];return _0x4041a6;};'use strict';var Sequelize=require(_0xb4c4('0x0'));module[_0xb4c4('0x1')]={'name':{'type':Sequelize[_0xb4c4('0x2')]},'description':{'type':Sequelize[_0xb4c4('0x2')]}}; \ No newline at end of file +var _0x377f=['exports','STRING','sequelize'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x377f,0xf5));var _0xf377=function(_0x504678,_0x3b8a96){_0x504678=_0x504678-0x0;var _0x289bf8=_0x377f[_0x504678];return _0x289bf8;};'use strict';var Sequelize=require(_0xf377('0x0'));module[_0xf377('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf377('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4f2ebd3..aaf7ec9 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 _0x1499=['query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','body','getFields','DeskField','hasOwnProperty','getSubjects','findOne','order','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','DeskConfiguration','fieldName','type','key','model'];(function(_0x5a8832,_0x9e1cf){var _0x3b0668=function(_0x4735c1){while(--_0x4735c1){_0x5a8832['push'](_0x5a8832['shift']());}};_0x3b0668(++_0x9e1cf);}(_0x1499,0x184));var _0x9149=function(_0x1754d4,_0x54ceb6){_0x1754d4=_0x1754d4-0x0;var _0x364d7a=_0x1499[_0x1754d4];return _0x364d7a;};'use strict';var emlformat=require(_0x9149('0x0'));var rimraf=require(_0x9149('0x1'));var zipdir=require(_0x9149('0x2'));var jsonpatch=require(_0x9149('0x3'));var rp=require(_0x9149('0x4'));var moment=require(_0x9149('0x5'));var BPromise=require(_0x9149('0x6'));var Mustache=require(_0x9149('0x7'));var util=require(_0x9149('0x8'));var path=require(_0x9149('0x9'));var sox=require(_0x9149('0xa'));var csv=require(_0x9149('0xb'));var ejs=require(_0x9149('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9149('0xd'));var squel=require(_0x9149('0xe'));var crypto=require(_0x9149('0xf'));var jsforce=require(_0x9149('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9149('0x11'));var Papa=require(_0x9149('0x12'));var Redis=require(_0x9149('0x13'));var authService=require(_0x9149('0x14'));var qs=require(_0x9149('0x15'));var as=require(_0x9149('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9149('0x17'))(_0x9149('0x18'));var utils=require(_0x9149('0x19'));var config=require(_0x9149('0x1a'));var licenseUtil=require(_0x9149('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e7bc1,_0x2f907b){_0x2f907b=_0x2f907b||0xcc;return function(_0x4f9203){if(_0x4f9203){return _0x2e7bc1['sendStatus'](_0x2f907b);}return _0x2e7bc1[_0x9149('0x1c')](_0x2f907b)[_0x9149('0x1d')]();};}function respondWithResult(_0x372726,_0x2fcbf5){_0x2fcbf5=_0x2fcbf5||0xc8;return function(_0x2d8336){if(_0x2d8336){return _0x372726['status'](_0x2fcbf5)[_0x9149('0x1e')](_0x2d8336);}};}function respondWithFilteredResult(_0x5803ec,_0x311a82){return function(_0x1fb9f2){if(_0x1fb9f2){var _0x1b3838=typeof _0x311a82[_0x9149('0x1f')]===_0x9149('0x20')&&typeof _0x311a82['limit']===_0x9149('0x20');var _0x510b5e=_0x1fb9f2[_0x9149('0x21')];var _0x437a6f=_0x1b3838?0x0:_0x311a82[_0x9149('0x1f')];var _0x55247f=_0x1b3838?_0x1fb9f2[_0x9149('0x21')]:_0x311a82['offset']+_0x311a82[_0x9149('0x22')];var _0x251d64;if(_0x55247f>=_0x510b5e){_0x55247f=_0x510b5e;_0x251d64=0xc8;}else{_0x251d64=0xce;}_0x5803ec['status'](_0x251d64);return _0x5803ec[_0x9149('0x23')](_0x9149('0x24'),_0x437a6f+'-'+_0x55247f+'/'+_0x510b5e)['json'](_0x1fb9f2);}return null;};}function patchUpdates(_0x262572){return function(_0x5d78ca){try{jsonpatch[_0x9149('0x25')](_0x5d78ca,_0x262572,!![]);}catch(_0xe69705){return BPromise[_0x9149('0x26')](_0xe69705);}return _0x5d78ca[_0x9149('0x27')]();};}function saveUpdates(_0x394947,_0x1c08cb){return function(_0x4ab6c4){if(_0x4ab6c4){return _0x4ab6c4[_0x9149('0x28')](_0x394947)['then'](function(_0x2adc92){return _0x2adc92;});}return null;};}function removeEntity(_0x9b2dd1,_0x3f31a3){return function(_0x42337c){if(_0x42337c){return _0x42337c[_0x9149('0x29')]()[_0x9149('0x2a')](function(){_0x9b2dd1['status'](0xcc)[_0x9149('0x1d')]();});}};}function handleEntityNotFound(_0x2ca5eb,_0x3f7e5d){return function(_0x55b6f4){if(!_0x55b6f4){_0x2ca5eb['sendStatus'](0x194);}return _0x55b6f4;};}function handleError(_0x5eaf5f,_0x2a5d61){_0x2a5d61=_0x2a5d61||0x1f4;return function(_0x502fb8){logger[_0x9149('0x2b')](_0x502fb8['stack']);if(_0x502fb8[_0x9149('0x2c')]){delete _0x502fb8[_0x9149('0x2c')];}_0x5eaf5f[_0x9149('0x1c')](_0x2a5d61)[_0x9149('0x2d')](_0x502fb8);};}exports[_0x9149('0x2e')]=function(_0x2f22,_0x4cda2f){var _0x86ab4c={},_0x82b446={},_0x3707bb={'count':0x0,'rows':[]};var _0x5b4c2a=_['map'](db[_0x9149('0x2f')]['rawAttributes'],function(_0x470ec5){return{'name':_0x470ec5[_0x9149('0x30')],'type':_0x470ec5[_0x9149('0x31')][_0x9149('0x32')]};});_0x82b446[_0x9149('0x33')]=_['map'](_0x5b4c2a,_0x9149('0x2c'));_0x82b446[_0x9149('0x34')]=_[_0x9149('0x35')](_0x2f22[_0x9149('0x34')]);_0x82b446[_0x9149('0x36')]=_[_0x9149('0x37')](_0x82b446['model'],_0x82b446[_0x9149('0x34')]);_0x86ab4c[_0x9149('0x38')]=_[_0x9149('0x37')](_0x82b446['model'],qs[_0x9149('0x39')](_0x2f22[_0x9149('0x34')][_0x9149('0x39')]));_0x86ab4c[_0x9149('0x38')]=_0x86ab4c['attributes'][_0x9149('0x3a')]?_0x86ab4c[_0x9149('0x38')]:_0x82b446[_0x9149('0x33')];if(!_0x2f22['query']['hasOwnProperty'](_0x9149('0x3b'))){_0x86ab4c[_0x9149('0x22')]=qs[_0x9149('0x22')](_0x2f22[_0x9149('0x34')][_0x9149('0x22')]);_0x86ab4c[_0x9149('0x1f')]=qs[_0x9149('0x1f')](_0x2f22[_0x9149('0x34')]['offset']);}_0x86ab4c['order']=qs['sort'](_0x2f22[_0x9149('0x34')][_0x9149('0x3c')]);_0x86ab4c[_0x9149('0x3d')]=qs[_0x9149('0x36')](_[_0x9149('0x3e')](_0x2f22[_0x9149('0x34')],_0x82b446[_0x9149('0x36')]),_0x5b4c2a);if(_0x2f22[_0x9149('0x34')][_0x9149('0x3f')]){_0x86ab4c['where']=_[_0x9149('0x40')](_0x86ab4c[_0x9149('0x3d')],{'$or':_[_0x9149('0x41')](_0x5b4c2a,function(_0x4f44ee){if(_0x4f44ee[_0x9149('0x31')]!==_0x9149('0x42')){var _0x21f670={};_0x21f670[_0x4f44ee[_0x9149('0x2c')]]={'$like':'%'+_0x2f22[_0x9149('0x34')][_0x9149('0x3f')]+'%'};return _0x21f670;}})});}_0x86ab4c=_[_0x9149('0x40')]({},_0x86ab4c,_0x2f22[_0x9149('0x43')]);var _0xf2ad0={'where':_0x86ab4c[_0x9149('0x3d')]};return db[_0x9149('0x2f')][_0x9149('0x21')](_0xf2ad0)[_0x9149('0x2a')](function(_0x3de485){_0x3707bb['count']=_0x3de485;if(_0x2f22[_0x9149('0x34')]['includeAll']){_0x86ab4c[_0x9149('0x44')]=[{'all':!![]}];}return db[_0x9149('0x2f')][_0x9149('0x45')](_0x86ab4c);})['then'](function(_0x3e4cc5){_0x3707bb[_0x9149('0x46')]=_0x3e4cc5;return _0x3707bb;})[_0x9149('0x2a')](respondWithFilteredResult(_0x4cda2f,_0x86ab4c))[_0x9149('0x47')](handleError(_0x4cda2f,null));};exports[_0x9149('0x48')]=function(_0x47a663,_0x74f2c4){var _0x401e5b={'raw':![],'where':{'id':_0x47a663[_0x9149('0x49')]['id']}},_0x1985dc={};_0x1985dc[_0x9149('0x33')]=_['keys'](db['DeskConfiguration'][_0x9149('0x4a')]);_0x1985dc['query']=_[_0x9149('0x35')](_0x47a663[_0x9149('0x34')]);_0x1985dc[_0x9149('0x36')]=_[_0x9149('0x37')](_0x1985dc[_0x9149('0x33')],_0x1985dc[_0x9149('0x34')]);_0x401e5b[_0x9149('0x38')]=_[_0x9149('0x37')](_0x1985dc[_0x9149('0x33')],qs[_0x9149('0x39')](_0x47a663[_0x9149('0x34')][_0x9149('0x39')]));_0x401e5b[_0x9149('0x38')]=_0x401e5b[_0x9149('0x38')][_0x9149('0x3a')]?_0x401e5b[_0x9149('0x38')]:_0x1985dc[_0x9149('0x33')];if(_0x47a663[_0x9149('0x34')][_0x9149('0x4b')]){_0x401e5b[_0x9149('0x44')]=[{'all':!![]}];}_0x401e5b=_[_0x9149('0x40')]({},_0x401e5b,_0x47a663[_0x9149('0x43')]);return db[_0x9149('0x2f')][_0x9149('0x4c')](_0x401e5b)[_0x9149('0x2a')](handleEntityNotFound(_0x74f2c4,null))[_0x9149('0x2a')](respondWithResult(_0x74f2c4,null))['catch'](handleError(_0x74f2c4,null));};exports['create']=function(_0x49e03e,_0x3472bf){return db[_0x9149('0x2f')]['create'](_0x49e03e[_0x9149('0x4d')],{})[_0x9149('0x2a')](respondWithResult(_0x3472bf,0xc9))[_0x9149('0x47')](handleError(_0x3472bf,null));};exports[_0x9149('0x28')]=function(_0x1797e3,_0x2d9a2b){if(_0x1797e3['body']['id']){delete _0x1797e3[_0x9149('0x4d')]['id'];}return db['DeskConfiguration'][_0x9149('0x4c')]({'where':{'id':_0x1797e3['params']['id']}})[_0x9149('0x2a')](handleEntityNotFound(_0x2d9a2b,null))[_0x9149('0x2a')](saveUpdates(_0x1797e3[_0x9149('0x4d')],null))[_0x9149('0x2a')](respondWithResult(_0x2d9a2b,null))['catch'](handleError(_0x2d9a2b,null));};exports[_0x9149('0x29')]=function(_0x2cad30,_0x1549a8){return db[_0x9149('0x2f')]['find']({'where':{'id':_0x2cad30[_0x9149('0x49')]['id']}})['then'](handleEntityNotFound(_0x1549a8,null))[_0x9149('0x2a')](removeEntity(_0x1549a8,null))[_0x9149('0x47')](handleError(_0x1549a8,null));};exports[_0x9149('0x4e')]=function(_0x588108,_0x7f33f6,_0x3e0ce7){var _0x5b0d1a={};var _0x2e3407={};var _0x214331;var _0x109178;return db[_0x9149('0x2f')]['findOne']({'where':{'id':_0x588108['params']['id']}})[_0x9149('0x2a')](handleEntityNotFound(_0x7f33f6,null))[_0x9149('0x2a')](function(_0x179b3e){if(_0x179b3e){_0x214331=_0x179b3e;_0x2e3407[_0x9149('0x33')]=_[_0x9149('0x35')](db[_0x9149('0x4f')]['rawAttributes']);_0x2e3407[_0x9149('0x34')]=_[_0x9149('0x35')](_0x588108[_0x9149('0x34')]);_0x2e3407[_0x9149('0x36')]=_[_0x9149('0x37')](_0x2e3407[_0x9149('0x33')],_0x2e3407['query']);_0x5b0d1a[_0x9149('0x38')]=_['intersection'](_0x2e3407['model'],qs[_0x9149('0x39')](_0x588108[_0x9149('0x34')][_0x9149('0x39')]));_0x5b0d1a[_0x9149('0x38')]=_0x5b0d1a[_0x9149('0x38')][_0x9149('0x3a')]?_0x5b0d1a[_0x9149('0x38')]:_0x2e3407[_0x9149('0x33')];_0x5b0d1a['order']=qs[_0x9149('0x3c')](_0x588108[_0x9149('0x34')][_0x9149('0x3c')]);_0x5b0d1a[_0x9149('0x3d')]=qs[_0x9149('0x36')](_[_0x9149('0x3e')](_0x588108[_0x9149('0x34')],_0x2e3407[_0x9149('0x36')]));if(_0x588108[_0x9149('0x34')]['filter']){_0x5b0d1a[_0x9149('0x3d')]=_[_0x9149('0x40')](_0x5b0d1a['where'],{'$or':_[_0x9149('0x41')](_0x5b0d1a['attributes'],function(_0x35d0f7){var _0x385ee5={};_0x385ee5[_0x35d0f7]={'$like':'%'+_0x588108[_0x9149('0x34')][_0x9149('0x3f')]+'%'};return _0x385ee5;})});}_0x5b0d1a=_[_0x9149('0x40')]({},_0x5b0d1a,_0x588108['options']);return _0x214331[_0x9149('0x4e')](_0x5b0d1a);}})[_0x9149('0x2a')](function(_0x6dbe10){if(_0x6dbe10){_0x109178=_0x6dbe10[_0x9149('0x3a')];if(!_0x588108[_0x9149('0x34')][_0x9149('0x50')]('nolimit')){_0x5b0d1a[_0x9149('0x22')]=qs[_0x9149('0x22')](_0x588108[_0x9149('0x34')]['limit']);_0x5b0d1a[_0x9149('0x1f')]=qs['offset'](_0x588108[_0x9149('0x34')][_0x9149('0x1f')]);}return _0x214331['getFields'](_0x5b0d1a);}})[_0x9149('0x2a')](function(_0x15bfc9){if(_0x15bfc9){return _0x15bfc9?{'count':_0x109178,'rows':_0x15bfc9}:null;}})[_0x9149('0x2a')](respondWithResult(_0x7f33f6,null))['catch'](handleError(_0x7f33f6,null));};exports[_0x9149('0x51')]=function(_0x1134c3,_0x58034c,_0x4a8627){var _0x5d04b7={};var _0x44285a={};var _0x518a54;var _0x53ccc9;return db[_0x9149('0x2f')][_0x9149('0x52')]({'where':{'id':_0x1134c3[_0x9149('0x49')]['id']}})['then'](handleEntityNotFound(_0x58034c,null))['then'](function(_0x34272f){if(_0x34272f){_0x518a54=_0x34272f;_0x44285a[_0x9149('0x33')]=_['keys'](db[_0x9149('0x4f')]['rawAttributes']);_0x44285a['query']=_[_0x9149('0x35')](_0x1134c3[_0x9149('0x34')]);_0x44285a[_0x9149('0x36')]=_[_0x9149('0x37')](_0x44285a['model'],_0x44285a[_0x9149('0x34')]);_0x5d04b7[_0x9149('0x38')]=_['intersection'](_0x44285a[_0x9149('0x33')],qs[_0x9149('0x39')](_0x1134c3[_0x9149('0x34')][_0x9149('0x39')]));_0x5d04b7[_0x9149('0x38')]=_0x5d04b7[_0x9149('0x38')]['length']?_0x5d04b7['attributes']:_0x44285a[_0x9149('0x33')];_0x5d04b7[_0x9149('0x53')]=qs[_0x9149('0x3c')](_0x1134c3[_0x9149('0x34')][_0x9149('0x3c')]);_0x5d04b7[_0x9149('0x3d')]=qs[_0x9149('0x36')](_[_0x9149('0x3e')](_0x1134c3[_0x9149('0x34')],_0x44285a[_0x9149('0x36')]));if(_0x1134c3[_0x9149('0x34')][_0x9149('0x3f')]){_0x5d04b7[_0x9149('0x3d')]=_[_0x9149('0x40')](_0x5d04b7[_0x9149('0x3d')],{'$or':_[_0x9149('0x41')](_0x5d04b7[_0x9149('0x38')],function(_0x4b5946){var _0x1bf5d0={};_0x1bf5d0[_0x4b5946]={'$like':'%'+_0x1134c3['query'][_0x9149('0x3f')]+'%'};return _0x1bf5d0;})});}_0x5d04b7=_[_0x9149('0x40')]({},_0x5d04b7,_0x1134c3['options']);return _0x518a54['getSubjects'](_0x5d04b7);}})['then'](function(_0x50cadb){if(_0x50cadb){_0x53ccc9=_0x50cadb[_0x9149('0x3a')];if(!_0x1134c3[_0x9149('0x34')][_0x9149('0x50')](_0x9149('0x3b'))){_0x5d04b7[_0x9149('0x22')]=qs[_0x9149('0x22')](_0x1134c3[_0x9149('0x34')]['limit']);_0x5d04b7[_0x9149('0x1f')]=qs[_0x9149('0x1f')](_0x1134c3['query'][_0x9149('0x1f')]);}return _0x518a54[_0x9149('0x51')](_0x5d04b7);}})[_0x9149('0x2a')](function(_0x5e0868){if(_0x5e0868){return _0x5e0868?{'count':_0x53ccc9,'rows':_0x5e0868}:null;}})[_0x9149('0x2a')](respondWithResult(_0x58034c,null))[_0x9149('0x47')](handleError(_0x58034c,null));};exports[_0x9149('0x54')]=function(_0x3e5a8a,_0x230a5e,_0x12bb48){var _0x62d363={};var _0x462a6d={};var _0x2e0095;var _0x224be3;return db[_0x9149('0x2f')]['findOne']({'where':{'id':_0x3e5a8a[_0x9149('0x49')]['id']}})['then'](handleEntityNotFound(_0x230a5e,null))['then'](function(_0x3af5a9){if(_0x3af5a9){_0x2e0095=_0x3af5a9;_0x462a6d[_0x9149('0x33')]=_[_0x9149('0x35')](db[_0x9149('0x4f')][_0x9149('0x4a')]);_0x462a6d[_0x9149('0x34')]=_[_0x9149('0x35')](_0x3e5a8a[_0x9149('0x34')]);_0x462a6d[_0x9149('0x36')]=_[_0x9149('0x37')](_0x462a6d[_0x9149('0x33')],_0x462a6d[_0x9149('0x34')]);_0x62d363['attributes']=_[_0x9149('0x37')](_0x462a6d[_0x9149('0x33')],qs['fields'](_0x3e5a8a[_0x9149('0x34')]['fields']));_0x62d363['attributes']=_0x62d363[_0x9149('0x38')][_0x9149('0x3a')]?_0x62d363[_0x9149('0x38')]:_0x462a6d['model'];_0x62d363[_0x9149('0x53')]=qs[_0x9149('0x3c')](_0x3e5a8a[_0x9149('0x34')][_0x9149('0x3c')]);_0x62d363[_0x9149('0x3d')]=qs['filters'](_[_0x9149('0x3e')](_0x3e5a8a[_0x9149('0x34')],_0x462a6d['filters']));if(_0x3e5a8a[_0x9149('0x34')]['filter']){_0x62d363[_0x9149('0x3d')]=_[_0x9149('0x40')](_0x62d363[_0x9149('0x3d')],{'$or':_[_0x9149('0x41')](_0x62d363[_0x9149('0x38')],function(_0x4ac15c){var _0x59af77={};_0x59af77[_0x4ac15c]={'$like':'%'+_0x3e5a8a[_0x9149('0x34')][_0x9149('0x3f')]+'%'};return _0x59af77;})});}_0x62d363=_[_0x9149('0x40')]({},_0x62d363,_0x3e5a8a[_0x9149('0x43')]);return _0x2e0095['getDescriptions'](_0x62d363);}})[_0x9149('0x2a')](function(_0x23b8e9){if(_0x23b8e9){_0x224be3=_0x23b8e9['length'];if(!_0x3e5a8a[_0x9149('0x34')][_0x9149('0x50')](_0x9149('0x3b'))){_0x62d363[_0x9149('0x22')]=qs[_0x9149('0x22')](_0x3e5a8a[_0x9149('0x34')]['limit']);_0x62d363[_0x9149('0x1f')]=qs[_0x9149('0x1f')](_0x3e5a8a[_0x9149('0x34')]['offset']);}return _0x2e0095['getDescriptions'](_0x62d363);}})[_0x9149('0x2a')](function(_0x402b75){if(_0x402b75){return _0x402b75?{'count':_0x224be3,'rows':_0x402b75}:null;}})[_0x9149('0x2a')](respondWithResult(_0x230a5e,null))[_0x9149('0x47')](handleError(_0x230a5e,null));};exports[_0x9149('0x55')]=function(_0x8553de,_0x398ecc,_0x5bb20c){var _0x22766a={};var _0xb6476c={};var _0x1a45b1;var _0x488209;return db[_0x9149('0x2f')]['findOne']({'where':{'id':_0x8553de[_0x9149('0x49')]['id']}})[_0x9149('0x2a')](handleEntityNotFound(_0x398ecc,null))[_0x9149('0x2a')](function(_0x2f9074){if(_0x2f9074){_0x1a45b1=_0x2f9074;_0xb6476c[_0x9149('0x33')]=_[_0x9149('0x35')](db['Tag'][_0x9149('0x4a')]);_0xb6476c[_0x9149('0x34')]=_[_0x9149('0x35')](_0x8553de['query']);_0xb6476c[_0x9149('0x36')]=_[_0x9149('0x37')](_0xb6476c[_0x9149('0x33')],_0xb6476c[_0x9149('0x34')]);_0x22766a[_0x9149('0x38')]=_[_0x9149('0x37')](_0xb6476c['model'],qs[_0x9149('0x39')](_0x8553de[_0x9149('0x34')][_0x9149('0x39')]));_0x22766a[_0x9149('0x38')]=_0x22766a[_0x9149('0x38')][_0x9149('0x3a')]?_0x22766a[_0x9149('0x38')]:_0xb6476c[_0x9149('0x33')];_0x22766a[_0x9149('0x53')]=qs[_0x9149('0x3c')](_0x8553de[_0x9149('0x34')][_0x9149('0x3c')]);_0x22766a[_0x9149('0x3d')]=qs[_0x9149('0x36')](_['pick'](_0x8553de[_0x9149('0x34')],_0xb6476c[_0x9149('0x36')]));if(_0x8553de[_0x9149('0x34')]['filter']){_0x22766a[_0x9149('0x3d')]=_[_0x9149('0x40')](_0x22766a[_0x9149('0x3d')],{'$or':_[_0x9149('0x41')](_0x22766a['attributes'],function(_0x307770){var _0x42e5fa={};_0x42e5fa[_0x307770]={'$like':'%'+_0x8553de[_0x9149('0x34')][_0x9149('0x3f')]+'%'};return _0x42e5fa;})});}_0x22766a=_[_0x9149('0x40')]({},_0x22766a,_0x8553de[_0x9149('0x43')]);return _0x1a45b1[_0x9149('0x55')](_0x22766a);}})['then'](function(_0x4a24ce){if(_0x4a24ce){_0x488209=_0x4a24ce[_0x9149('0x3a')];if(!_0x8553de[_0x9149('0x34')][_0x9149('0x50')](_0x9149('0x3b'))){_0x22766a[_0x9149('0x22')]=qs[_0x9149('0x22')](_0x8553de[_0x9149('0x34')][_0x9149('0x22')]);_0x22766a['offset']=qs[_0x9149('0x1f')](_0x8553de['query'][_0x9149('0x1f')]);}return _0x1a45b1[_0x9149('0x55')](_0x22766a);}})[_0x9149('0x2a')](function(_0x31434c){if(_0x31434c){return _0x31434c?{'count':_0x488209,'rows':_0x31434c}:null;}})[_0x9149('0x2a')](respondWithResult(_0x398ecc,null))[_0x9149('0x47')](handleError(_0x398ecc,null));};exports[_0x9149('0x56')]=function(_0x3a93b1,_0x953c62,_0x53b551){if(_0x3a93b1[_0x9149('0x4d')]['id']){delete _0x3a93b1[_0x9149('0x4d')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x3a93b1['params']['id']}})[_0x9149('0x2a')](handleEntityNotFound(_0x953c62,null))[_0x9149('0x2a')](function(_0xc09371){if(_0xc09371){return _0xc09371[_0x9149('0x56')](_0x3a93b1[_0x9149('0x4d')][_0x9149('0x57')]||[]);}return null;})[_0x9149('0x2a')](respondWithResult(_0x953c62,null))[_0x9149('0x47')](handleError(_0x953c62,null));}; \ No newline at end of file +var _0x0e86=['undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','length','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','intersection','options','find','catch','create','body','update','getFields','findOne','order','getSubjects','DeskField','getDescriptions','hasOwnProperty','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset'];(function(_0x25e4f0,_0x4b5c5f){var _0x28762a=function(_0x2b7eae){while(--_0x2b7eae){_0x25e4f0['push'](_0x25e4f0['shift']());}};_0x28762a(++_0x4b5c5f);}(_0x0e86,0x128));var _0x60e8=function(_0xf48efb,_0x307c7f){_0xf48efb=_0xf48efb-0x0;var _0x179636=_0x0e86[_0xf48efb];return _0x179636;};'use strict';var emlformat=require(_0x60e8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x60e8('0x1'));var rp=require(_0x60e8('0x2'));var moment=require(_0x60e8('0x3'));var BPromise=require(_0x60e8('0x4'));var Mustache=require(_0x60e8('0x5'));var util=require('util');var path=require(_0x60e8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x60e8('0x7'));var fs=require('fs');var fs_extra=require(_0x60e8('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x60e8('0x9'));var deskjs=require(_0x60e8('0xa'));var toCsv=require(_0x60e8('0xb'));var querystring=require(_0x60e8('0xc'));var Papa=require(_0x60e8('0xd'));var Redis=require(_0x60e8('0xe'));var authService=require(_0x60e8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60e8('0x10'));var logger=require(_0x60e8('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x60e8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x60e8('0x13'))['db'];function respondWithStatusCode(_0x2da05d,_0x2fac82){_0x2fac82=_0x2fac82||0xcc;return function(_0x52bf2b){if(_0x52bf2b){return _0x2da05d['sendStatus'](_0x2fac82);}return _0x2da05d[_0x60e8('0x14')](_0x2fac82)[_0x60e8('0x15')]();};}function respondWithResult(_0x3d50f7,_0x2e1f84){_0x2e1f84=_0x2e1f84||0xc8;return function(_0x31f578){if(_0x31f578){return _0x3d50f7['status'](_0x2e1f84)[_0x60e8('0x16')](_0x31f578);}};}function respondWithFilteredResult(_0x477e20,_0x235b24){return function(_0x36e6fa){if(_0x36e6fa){var _0x4691b5=typeof _0x235b24[_0x60e8('0x17')]===_0x60e8('0x18')&&typeof _0x235b24[_0x60e8('0x19')]===_0x60e8('0x18');var _0x4c1d93=_0x36e6fa[_0x60e8('0x1a')];var _0x543261=_0x4691b5?0x0:_0x235b24[_0x60e8('0x17')];var _0x11e093=_0x4691b5?_0x36e6fa[_0x60e8('0x1a')]:_0x235b24['offset']+_0x235b24[_0x60e8('0x19')];var _0x46e5dd;if(_0x11e093>=_0x4c1d93){_0x11e093=_0x4c1d93;_0x46e5dd=0xc8;}else{_0x46e5dd=0xce;}_0x477e20[_0x60e8('0x14')](_0x46e5dd);return _0x477e20[_0x60e8('0x1b')](_0x60e8('0x1c'),_0x543261+'-'+_0x11e093+'/'+_0x4c1d93)[_0x60e8('0x16')](_0x36e6fa);}return null;};}function patchUpdates(_0x141d94){return function(_0x53bdfd){try{jsonpatch[_0x60e8('0x1d')](_0x53bdfd,_0x141d94,!![]);}catch(_0x5bc50f){return BPromise['reject'](_0x5bc50f);}return _0x53bdfd[_0x60e8('0x1e')]();};}function saveUpdates(_0x2b9def,_0x5827c3){return function(_0x377dbf){if(_0x377dbf){return _0x377dbf['update'](_0x2b9def)[_0x60e8('0x1f')](function(_0x47ec74){return _0x47ec74;});}return null;};}function removeEntity(_0x35dbbe,_0x7e9af4){return function(_0x56adbf){if(_0x56adbf){return _0x56adbf[_0x60e8('0x20')]()[_0x60e8('0x1f')](function(){_0x35dbbe[_0x60e8('0x14')](0xcc)[_0x60e8('0x15')]();});}};}function handleEntityNotFound(_0x44099b,_0x27c5bb){return function(_0x57151c){if(!_0x57151c){_0x44099b[_0x60e8('0x21')](0x194);}return _0x57151c;};}function handleError(_0x241e94,_0x1f9b50){_0x1f9b50=_0x1f9b50||0x1f4;return function(_0x5320f5){logger['error'](_0x5320f5[_0x60e8('0x22')]);if(_0x5320f5[_0x60e8('0x23')]){delete _0x5320f5['name'];}_0x241e94[_0x60e8('0x14')](_0x1f9b50)[_0x60e8('0x24')](_0x5320f5);};}exports['index']=function(_0x2fc055,_0x56f4a1){var _0x25ba14={},_0x209652={},_0x30a83c={'count':0x0,'rows':[]};var _0xa5250b=_[_0x60e8('0x25')](db[_0x60e8('0x26')][_0x60e8('0x27')],function(_0x31c2f6){return{'name':_0x31c2f6[_0x60e8('0x28')],'type':_0x31c2f6['type'][_0x60e8('0x29')]};});_0x209652[_0x60e8('0x2a')]=_[_0x60e8('0x25')](_0xa5250b,_0x60e8('0x23'));_0x209652['query']=_[_0x60e8('0x2b')](_0x2fc055[_0x60e8('0x2c')]);_0x209652[_0x60e8('0x2d')]=_['intersection'](_0x209652[_0x60e8('0x2a')],_0x209652[_0x60e8('0x2c')]);_0x25ba14[_0x60e8('0x2e')]=_['intersection'](_0x209652[_0x60e8('0x2a')],qs[_0x60e8('0x2f')](_0x2fc055[_0x60e8('0x2c')][_0x60e8('0x2f')]));_0x25ba14[_0x60e8('0x2e')]=_0x25ba14[_0x60e8('0x2e')][_0x60e8('0x30')]?_0x25ba14['attributes']:_0x209652[_0x60e8('0x2a')];if(!_0x2fc055[_0x60e8('0x2c')]['hasOwnProperty'](_0x60e8('0x31'))){_0x25ba14[_0x60e8('0x19')]=qs['limit'](_0x2fc055[_0x60e8('0x2c')][_0x60e8('0x19')]);_0x25ba14[_0x60e8('0x17')]=qs[_0x60e8('0x17')](_0x2fc055[_0x60e8('0x2c')][_0x60e8('0x17')]);}_0x25ba14['order']=qs[_0x60e8('0x32')](_0x2fc055[_0x60e8('0x2c')][_0x60e8('0x32')]);_0x25ba14['where']=qs[_0x60e8('0x2d')](_[_0x60e8('0x33')](_0x2fc055[_0x60e8('0x2c')],_0x209652[_0x60e8('0x2d')]),_0xa5250b);if(_0x2fc055[_0x60e8('0x2c')][_0x60e8('0x34')]){_0x25ba14['where']=_['merge'](_0x25ba14[_0x60e8('0x35')],{'$or':_[_0x60e8('0x25')](_0xa5250b,function(_0x1e3730){if(_0x1e3730[_0x60e8('0x36')]!==_0x60e8('0x37')){var _0x2da23c={};_0x2da23c[_0x1e3730[_0x60e8('0x23')]]={'$like':'%'+_0x2fc055[_0x60e8('0x2c')][_0x60e8('0x34')]+'%'};return _0x2da23c;}})});}_0x25ba14=_[_0x60e8('0x38')]({},_0x25ba14,_0x2fc055['options']);var _0x320f50={'where':_0x25ba14['where']};return db[_0x60e8('0x26')]['count'](_0x320f50)[_0x60e8('0x1f')](function(_0x109a39){_0x30a83c[_0x60e8('0x1a')]=_0x109a39;if(_0x2fc055[_0x60e8('0x2c')][_0x60e8('0x39')]){_0x25ba14[_0x60e8('0x3a')]=[{'all':!![]}];}return db[_0x60e8('0x26')][_0x60e8('0x3b')](_0x25ba14);})[_0x60e8('0x1f')](function(_0x1a4db9){_0x30a83c[_0x60e8('0x3c')]=_0x1a4db9;return _0x30a83c;})[_0x60e8('0x1f')](respondWithFilteredResult(_0x56f4a1,_0x25ba14))['catch'](handleError(_0x56f4a1,null));};exports[_0x60e8('0x3d')]=function(_0x47768d,_0x5f0e64){var _0x4d940={'raw':![],'where':{'id':_0x47768d[_0x60e8('0x3e')]['id']}},_0x5566c3={};_0x5566c3['model']=_[_0x60e8('0x2b')](db['DeskConfiguration'][_0x60e8('0x27')]);_0x5566c3['query']=_[_0x60e8('0x2b')](_0x47768d[_0x60e8('0x2c')]);_0x5566c3['filters']=_[_0x60e8('0x3f')](_0x5566c3[_0x60e8('0x2a')],_0x5566c3['query']);_0x4d940[_0x60e8('0x2e')]=_[_0x60e8('0x3f')](_0x5566c3[_0x60e8('0x2a')],qs[_0x60e8('0x2f')](_0x47768d[_0x60e8('0x2c')][_0x60e8('0x2f')]));_0x4d940[_0x60e8('0x2e')]=_0x4d940[_0x60e8('0x2e')][_0x60e8('0x30')]?_0x4d940[_0x60e8('0x2e')]:_0x5566c3[_0x60e8('0x2a')];if(_0x47768d[_0x60e8('0x2c')][_0x60e8('0x39')]){_0x4d940[_0x60e8('0x3a')]=[{'all':!![]}];}_0x4d940=_[_0x60e8('0x38')]({},_0x4d940,_0x47768d[_0x60e8('0x40')]);return db[_0x60e8('0x26')][_0x60e8('0x41')](_0x4d940)[_0x60e8('0x1f')](handleEntityNotFound(_0x5f0e64,null))[_0x60e8('0x1f')](respondWithResult(_0x5f0e64,null))[_0x60e8('0x42')](handleError(_0x5f0e64,null));};exports[_0x60e8('0x43')]=function(_0x1d9929,_0x3b70f4){return db[_0x60e8('0x26')][_0x60e8('0x43')](_0x1d9929[_0x60e8('0x44')],{})['then'](respondWithResult(_0x3b70f4,0xc9))[_0x60e8('0x42')](handleError(_0x3b70f4,null));};exports[_0x60e8('0x45')]=function(_0x4f8b03,_0x390b7b){if(_0x4f8b03['body']['id']){delete _0x4f8b03['body']['id'];}return db[_0x60e8('0x26')][_0x60e8('0x41')]({'where':{'id':_0x4f8b03['params']['id']}})[_0x60e8('0x1f')](handleEntityNotFound(_0x390b7b,null))[_0x60e8('0x1f')](saveUpdates(_0x4f8b03[_0x60e8('0x44')],null))[_0x60e8('0x1f')](respondWithResult(_0x390b7b,null))[_0x60e8('0x42')](handleError(_0x390b7b,null));};exports['destroy']=function(_0x3e5c6a,_0xcd429a){return db[_0x60e8('0x26')][_0x60e8('0x41')]({'where':{'id':_0x3e5c6a[_0x60e8('0x3e')]['id']}})['then'](handleEntityNotFound(_0xcd429a,null))[_0x60e8('0x1f')](removeEntity(_0xcd429a,null))[_0x60e8('0x42')](handleError(_0xcd429a,null));};exports[_0x60e8('0x46')]=function(_0x4151e9,_0x5394b2,_0x2051d6){var _0x4d1bfa={};var _0x190f81={};var _0x55ca69;var _0x276df9;return db[_0x60e8('0x26')][_0x60e8('0x47')]({'where':{'id':_0x4151e9[_0x60e8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5394b2,null))['then'](function(_0x458a6e){if(_0x458a6e){_0x55ca69=_0x458a6e;_0x190f81['model']=_['keys'](db['DeskField'][_0x60e8('0x27')]);_0x190f81['query']=_[_0x60e8('0x2b')](_0x4151e9[_0x60e8('0x2c')]);_0x190f81[_0x60e8('0x2d')]=_[_0x60e8('0x3f')](_0x190f81['model'],_0x190f81[_0x60e8('0x2c')]);_0x4d1bfa[_0x60e8('0x2e')]=_[_0x60e8('0x3f')](_0x190f81['model'],qs[_0x60e8('0x2f')](_0x4151e9[_0x60e8('0x2c')]['fields']));_0x4d1bfa[_0x60e8('0x2e')]=_0x4d1bfa['attributes'][_0x60e8('0x30')]?_0x4d1bfa['attributes']:_0x190f81[_0x60e8('0x2a')];_0x4d1bfa[_0x60e8('0x48')]=qs[_0x60e8('0x32')](_0x4151e9[_0x60e8('0x2c')][_0x60e8('0x32')]);_0x4d1bfa['where']=qs['filters'](_[_0x60e8('0x33')](_0x4151e9[_0x60e8('0x2c')],_0x190f81[_0x60e8('0x2d')]));if(_0x4151e9[_0x60e8('0x2c')][_0x60e8('0x34')]){_0x4d1bfa['where']=_[_0x60e8('0x38')](_0x4d1bfa[_0x60e8('0x35')],{'$or':_[_0x60e8('0x25')](_0x4d1bfa[_0x60e8('0x2e')],function(_0xbcec82){var _0x267334={};_0x267334[_0xbcec82]={'$like':'%'+_0x4151e9[_0x60e8('0x2c')]['filter']+'%'};return _0x267334;})});}_0x4d1bfa=_[_0x60e8('0x38')]({},_0x4d1bfa,_0x4151e9[_0x60e8('0x40')]);return _0x55ca69['getFields'](_0x4d1bfa);}})[_0x60e8('0x1f')](function(_0x3b255a){if(_0x3b255a){_0x276df9=_0x3b255a[_0x60e8('0x30')];if(!_0x4151e9[_0x60e8('0x2c')]['hasOwnProperty'](_0x60e8('0x31'))){_0x4d1bfa[_0x60e8('0x19')]=qs[_0x60e8('0x19')](_0x4151e9[_0x60e8('0x2c')][_0x60e8('0x19')]);_0x4d1bfa[_0x60e8('0x17')]=qs[_0x60e8('0x17')](_0x4151e9[_0x60e8('0x2c')]['offset']);}return _0x55ca69['getFields'](_0x4d1bfa);}})[_0x60e8('0x1f')](function(_0x47b806){if(_0x47b806){return _0x47b806?{'count':_0x276df9,'rows':_0x47b806}:null;}})[_0x60e8('0x1f')](respondWithResult(_0x5394b2,null))[_0x60e8('0x42')](handleError(_0x5394b2,null));};exports[_0x60e8('0x49')]=function(_0x5034f6,_0x347b60,_0xafb90c){var _0x1aafe1={};var _0x36cc2c={};var _0x291030;var _0x149530;return db[_0x60e8('0x26')][_0x60e8('0x47')]({'where':{'id':_0x5034f6[_0x60e8('0x3e')]['id']}})[_0x60e8('0x1f')](handleEntityNotFound(_0x347b60,null))[_0x60e8('0x1f')](function(_0x71b78d){if(_0x71b78d){_0x291030=_0x71b78d;_0x36cc2c[_0x60e8('0x2a')]=_[_0x60e8('0x2b')](db[_0x60e8('0x4a')]['rawAttributes']);_0x36cc2c[_0x60e8('0x2c')]=_[_0x60e8('0x2b')](_0x5034f6['query']);_0x36cc2c['filters']=_[_0x60e8('0x3f')](_0x36cc2c[_0x60e8('0x2a')],_0x36cc2c[_0x60e8('0x2c')]);_0x1aafe1[_0x60e8('0x2e')]=_['intersection'](_0x36cc2c['model'],qs[_0x60e8('0x2f')](_0x5034f6['query'][_0x60e8('0x2f')]));_0x1aafe1[_0x60e8('0x2e')]=_0x1aafe1[_0x60e8('0x2e')][_0x60e8('0x30')]?_0x1aafe1[_0x60e8('0x2e')]:_0x36cc2c[_0x60e8('0x2a')];_0x1aafe1['order']=qs[_0x60e8('0x32')](_0x5034f6['query'][_0x60e8('0x32')]);_0x1aafe1['where']=qs[_0x60e8('0x2d')](_[_0x60e8('0x33')](_0x5034f6[_0x60e8('0x2c')],_0x36cc2c[_0x60e8('0x2d')]));if(_0x5034f6[_0x60e8('0x2c')][_0x60e8('0x34')]){_0x1aafe1['where']=_[_0x60e8('0x38')](_0x1aafe1[_0x60e8('0x35')],{'$or':_['map'](_0x1aafe1[_0x60e8('0x2e')],function(_0x559f54){var _0x4c7c3f={};_0x4c7c3f[_0x559f54]={'$like':'%'+_0x5034f6['query'][_0x60e8('0x34')]+'%'};return _0x4c7c3f;})});}_0x1aafe1=_['merge']({},_0x1aafe1,_0x5034f6[_0x60e8('0x40')]);return _0x291030[_0x60e8('0x49')](_0x1aafe1);}})['then'](function(_0x4b748a){if(_0x4b748a){_0x149530=_0x4b748a[_0x60e8('0x30')];if(!_0x5034f6[_0x60e8('0x2c')]['hasOwnProperty'](_0x60e8('0x31'))){_0x1aafe1[_0x60e8('0x19')]=qs[_0x60e8('0x19')](_0x5034f6['query']['limit']);_0x1aafe1[_0x60e8('0x17')]=qs[_0x60e8('0x17')](_0x5034f6[_0x60e8('0x2c')][_0x60e8('0x17')]);}return _0x291030[_0x60e8('0x49')](_0x1aafe1);}})[_0x60e8('0x1f')](function(_0x4d7169){if(_0x4d7169){return _0x4d7169?{'count':_0x149530,'rows':_0x4d7169}:null;}})[_0x60e8('0x1f')](respondWithResult(_0x347b60,null))[_0x60e8('0x42')](handleError(_0x347b60,null));};exports[_0x60e8('0x4b')]=function(_0x54a4c6,_0x2dbf43,_0x366e3c){var _0x171f5c={};var _0x2b750f={};var _0x120fb6;var _0x3d19a8;return db['DeskConfiguration'][_0x60e8('0x47')]({'where':{'id':_0x54a4c6[_0x60e8('0x3e')]['id']}})[_0x60e8('0x1f')](handleEntityNotFound(_0x2dbf43,null))['then'](function(_0x5a775b){if(_0x5a775b){_0x120fb6=_0x5a775b;_0x2b750f[_0x60e8('0x2a')]=_[_0x60e8('0x2b')](db['DeskField'][_0x60e8('0x27')]);_0x2b750f[_0x60e8('0x2c')]=_[_0x60e8('0x2b')](_0x54a4c6[_0x60e8('0x2c')]);_0x2b750f['filters']=_[_0x60e8('0x3f')](_0x2b750f[_0x60e8('0x2a')],_0x2b750f[_0x60e8('0x2c')]);_0x171f5c[_0x60e8('0x2e')]=_[_0x60e8('0x3f')](_0x2b750f['model'],qs['fields'](_0x54a4c6['query'][_0x60e8('0x2f')]));_0x171f5c['attributes']=_0x171f5c[_0x60e8('0x2e')]['length']?_0x171f5c['attributes']:_0x2b750f[_0x60e8('0x2a')];_0x171f5c['order']=qs[_0x60e8('0x32')](_0x54a4c6[_0x60e8('0x2c')][_0x60e8('0x32')]);_0x171f5c[_0x60e8('0x35')]=qs[_0x60e8('0x2d')](_[_0x60e8('0x33')](_0x54a4c6[_0x60e8('0x2c')],_0x2b750f['filters']));if(_0x54a4c6[_0x60e8('0x2c')]['filter']){_0x171f5c[_0x60e8('0x35')]=_[_0x60e8('0x38')](_0x171f5c[_0x60e8('0x35')],{'$or':_[_0x60e8('0x25')](_0x171f5c[_0x60e8('0x2e')],function(_0xd8db0e){var _0x3535c9={};_0x3535c9[_0xd8db0e]={'$like':'%'+_0x54a4c6[_0x60e8('0x2c')][_0x60e8('0x34')]+'%'};return _0x3535c9;})});}_0x171f5c=_['merge']({},_0x171f5c,_0x54a4c6[_0x60e8('0x40')]);return _0x120fb6[_0x60e8('0x4b')](_0x171f5c);}})[_0x60e8('0x1f')](function(_0x502b49){if(_0x502b49){_0x3d19a8=_0x502b49['length'];if(!_0x54a4c6[_0x60e8('0x2c')][_0x60e8('0x4c')](_0x60e8('0x31'))){_0x171f5c['limit']=qs[_0x60e8('0x19')](_0x54a4c6['query'][_0x60e8('0x19')]);_0x171f5c[_0x60e8('0x17')]=qs[_0x60e8('0x17')](_0x54a4c6[_0x60e8('0x2c')][_0x60e8('0x17')]);}return _0x120fb6[_0x60e8('0x4b')](_0x171f5c);}})['then'](function(_0x2b9e35){if(_0x2b9e35){return _0x2b9e35?{'count':_0x3d19a8,'rows':_0x2b9e35}:null;}})[_0x60e8('0x1f')](respondWithResult(_0x2dbf43,null))['catch'](handleError(_0x2dbf43,null));};exports[_0x60e8('0x4d')]=function(_0x449fc7,_0x217e41,_0x16d361){var _0x443748={};var _0x1dcc4f={};var _0x50887b;var _0x2a3496;return db[_0x60e8('0x26')][_0x60e8('0x47')]({'where':{'id':_0x449fc7['params']['id']}})['then'](handleEntityNotFound(_0x217e41,null))['then'](function(_0x2bc460){if(_0x2bc460){_0x50887b=_0x2bc460;_0x1dcc4f[_0x60e8('0x2a')]=_[_0x60e8('0x2b')](db['Tag'][_0x60e8('0x27')]);_0x1dcc4f[_0x60e8('0x2c')]=_[_0x60e8('0x2b')](_0x449fc7['query']);_0x1dcc4f[_0x60e8('0x2d')]=_[_0x60e8('0x3f')](_0x1dcc4f[_0x60e8('0x2a')],_0x1dcc4f['query']);_0x443748[_0x60e8('0x2e')]=_[_0x60e8('0x3f')](_0x1dcc4f[_0x60e8('0x2a')],qs[_0x60e8('0x2f')](_0x449fc7[_0x60e8('0x2c')][_0x60e8('0x2f')]));_0x443748[_0x60e8('0x2e')]=_0x443748[_0x60e8('0x2e')][_0x60e8('0x30')]?_0x443748[_0x60e8('0x2e')]:_0x1dcc4f['model'];_0x443748[_0x60e8('0x48')]=qs['sort'](_0x449fc7[_0x60e8('0x2c')]['sort']);_0x443748[_0x60e8('0x35')]=qs[_0x60e8('0x2d')](_[_0x60e8('0x33')](_0x449fc7['query'],_0x1dcc4f[_0x60e8('0x2d')]));if(_0x449fc7[_0x60e8('0x2c')][_0x60e8('0x34')]){_0x443748['where']=_[_0x60e8('0x38')](_0x443748[_0x60e8('0x35')],{'$or':_[_0x60e8('0x25')](_0x443748['attributes'],function(_0xdb7d8){var _0x49b8b0={};_0x49b8b0[_0xdb7d8]={'$like':'%'+_0x449fc7[_0x60e8('0x2c')][_0x60e8('0x34')]+'%'};return _0x49b8b0;})});}_0x443748=_['merge']({},_0x443748,_0x449fc7[_0x60e8('0x40')]);return _0x50887b[_0x60e8('0x4d')](_0x443748);}})[_0x60e8('0x1f')](function(_0x2564c7){if(_0x2564c7){_0x2a3496=_0x2564c7['length'];if(!_0x449fc7[_0x60e8('0x2c')][_0x60e8('0x4c')](_0x60e8('0x31'))){_0x443748[_0x60e8('0x19')]=qs[_0x60e8('0x19')](_0x449fc7[_0x60e8('0x2c')][_0x60e8('0x19')]);_0x443748[_0x60e8('0x17')]=qs[_0x60e8('0x17')](_0x449fc7['query']['offset']);}return _0x50887b[_0x60e8('0x4d')](_0x443748);}})[_0x60e8('0x1f')](function(_0x122642){if(_0x122642){return _0x122642?{'count':_0x2a3496,'rows':_0x122642}:null;}})['then'](respondWithResult(_0x217e41,null))['catch'](handleError(_0x217e41,null));};exports[_0x60e8('0x4e')]=function(_0x16d40b,_0x5ec90d,_0x365ab6){if(_0x16d40b[_0x60e8('0x44')]['id']){delete _0x16d40b[_0x60e8('0x44')]['id'];}return db[_0x60e8('0x26')][_0x60e8('0x47')]({'where':{'id':_0x16d40b[_0x60e8('0x3e')]['id']}})[_0x60e8('0x1f')](handleEntityNotFound(_0x5ec90d,null))['then'](function(_0x4e1e33){if(_0x4e1e33){return _0x4e1e33[_0x60e8('0x4e')](_0x16d40b['body'][_0x60e8('0x4f')]||[]);}return null;})[_0x60e8('0x1f')](respondWithResult(_0x5ec90d,null))[_0x60e8('0x42')](handleError(_0x5ec90d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ea5f7da..1a63065 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 _0x3bea=['DeskConfiguration','lodash','../../config/logger','bluebird','request-promise','rimraf','./intDeskConfiguration.attributes','exports','define'];(function(_0x4fd415,_0x5178cc){var _0x21da43=function(_0x27b6c0){while(--_0x27b6c0){_0x4fd415['push'](_0x4fd415['shift']());}};_0x21da43(++_0x5178cc);}(_0x3bea,0x10f));var _0xa3be=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x3bea[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0xa3be('0x0'));var util=require('util');var logger=require(_0xa3be('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa3be('0x2'));var rp=require(_0xa3be('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3be('0x4'));var config=require('../../config/environment');var attributes=require(_0xa3be('0x5'));module[_0xa3be('0x6')]=function(_0x5cbccd,_0x5677c4){return _0x5cbccd[_0xa3be('0x7')](_0xa3be('0x8'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7735=['exports','define','int_desk_configurations','util','api','moment','request-promise','path','rimraf','./intDeskConfiguration.attributes'];(function(_0x231700,_0x12a6cc){var _0x1233a4=function(_0x604517){while(--_0x604517){_0x231700['push'](_0x231700['shift']());}};_0x1233a4(++_0x12a6cc);}(_0x7735,0x1b1));var _0x5773=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7735[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x5773('0x0'));var logger=require('../../config/logger')(_0x5773('0x1'));var moment=require(_0x5773('0x2'));var BPromise=require('bluebird');var rp=require(_0x5773('0x3'));var fs=require('fs');var path=require(_0x5773('0x4'));var rimraf=require(_0x5773('0x5'));var config=require('../../config/environment');var attributes=require(_0x5773('0x6'));module[_0x5773('0x7')]=function(_0x5a41b8,_0x1a7d44){return _0x5a41b8[_0x5773('0x8')]('DeskConfiguration',attributes,{'tableName':_0x5773('0x9'),'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 eef0d88..5cf6c53 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 _0x761c=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x761c,0x18a));var _0xc761=function(_0xb5a7e3,_0x103333){_0xb5a7e3=_0xb5a7e3-0x0;var _0x2b5520=_0x761c[_0xb5a7e3];return _0x2b5520;};'use strict';var _=require(_0xc761('0x0'));var util=require('util');var moment=require(_0xc761('0x1'));var BPromise=require(_0xc761('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc761('0x3'));var db=require(_0xc761('0x4'))['db'];var utils=require(_0xc761('0x5'));var logger=require('../../config/logger')(_0xc761('0x6'));var config=require('../../config/environment');var jayson=require(_0xc761('0x7'));var client=jayson[_0xc761('0x8')][_0xc761('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xafa0bd,_0x2f4f2e,_0x444747){return new BPromise(function(_0x46e882,_0x507772){return client[_0xc761('0xa')](_0xafa0bd,_0x444747)[_0xc761('0xb')](function(_0x175c1c){logger[_0xc761('0xc')](_0xc761('0xd'),_0x2f4f2e,_0xc761('0xe'));logger[_0xc761('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2f4f2e,'request\x20sent',JSON[_0xc761('0x10')](_0x175c1c));if(_0x175c1c[_0xc761('0x11')]){if(_0x175c1c['error']['code']===0x1f4){logger[_0xc761('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x2f4f2e,_0x175c1c[_0xc761('0x11')]['message']);return _0x507772(_0x175c1c[_0xc761('0x11')]['message']);}logger[_0xc761('0x11')](_0xc761('0xd'),_0x2f4f2e,_0x175c1c[_0xc761('0x11')][_0xc761('0x12')]);return _0x46e882(_0x175c1c[_0xc761('0x11')][_0xc761('0x12')]);}else{logger[_0xc761('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x2f4f2e,'request\x20sent');_0x46e882(_0x175c1c[_0xc761('0x13')][_0xc761('0x12')]);}})[_0xc761('0x14')](function(_0x597085){logger[_0xc761('0x11')](_0xc761('0xd'),_0x2f4f2e,_0x597085);_0x507772(_0x597085);});});} \ No newline at end of file +var _0x543b=['http','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xef9edb,_0x406d7b){var _0x3583e3=function(_0x438197){while(--_0x438197){_0xef9edb['push'](_0xef9edb['shift']());}};_0x3583e3(++_0x406d7b);}(_0x543b,0x18d));var _0xb543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x543b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb543('0x0'));var util=require(_0xb543('0x1'));var moment=require(_0xb543('0x2'));var BPromise=require('bluebird');var rs=require(_0xb543('0x3'));var fs=require('fs');var Redis=require(_0xb543('0x4'));var db=require(_0xb543('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb543('0x6'))(_0xb543('0x7'));var config=require(_0xb543('0x8'));var jayson=require(_0xb543('0x9'));var client=jayson[_0xb543('0xa')][_0xb543('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x208c95,_0x338142,_0x21bb48){return new BPromise(function(_0x307a74,_0x2a2c1f){return client[_0xb543('0xc')](_0x208c95,_0x21bb48)['then'](function(_0xa94776){logger['info'](_0xb543('0xd'),_0x338142,_0xb543('0xe'));logger[_0xb543('0xf')](_0xb543('0x10'),_0x338142,_0xb543('0xe'),JSON[_0xb543('0x11')](_0xa94776));if(_0xa94776['error']){if(_0xa94776[_0xb543('0x12')][_0xb543('0x13')]===0x1f4){logger[_0xb543('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x338142,_0xa94776[_0xb543('0x12')][_0xb543('0x14')]);return _0x2a2c1f(_0xa94776[_0xb543('0x12')]['message']);}logger['error'](_0xb543('0xd'),_0x338142,_0xa94776[_0xb543('0x12')][_0xb543('0x14')]);return _0x307a74(_0xa94776[_0xb543('0x12')]['message']);}else{logger[_0xb543('0x15')](_0xb543('0xd'),_0x338142,_0xb543('0xe'));_0x307a74(_0xa94776[_0xb543('0x16')]['message']);}})[_0xb543('0x17')](function(_0x5230df){logger[_0xb543('0x12')](_0xb543('0xd'),_0x338142,_0x5230df);_0x2a2c1f(_0x5230df);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 98e68be..f3da2d7 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 _0x0966=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','/:id','post','create','update','destroy','exports','multer','util','connect-timeout'];(function(_0x38534b,_0x42fbb6){var _0x22218d=function(_0x4101b5){while(--_0x4101b5){_0x38534b['push'](_0x38534b['shift']());}};_0x22218d(++_0x42fbb6);}(_0x0966,0x9d));var _0x6096=function(_0x1a85ae,_0x5c928b){_0x1a85ae=_0x1a85ae-0x0;var _0x54a46f=_0x0966[_0x1a85ae];return _0x54a46f;};'use strict';var multer=require(_0x6096('0x0'));var util=require(_0x6096('0x1'));var path=require('path');var timeout=require(_0x6096('0x2'));var express=require('express');var router=express[_0x6096('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6096('0x4'));var interaction=require(_0x6096('0x5'));var config=require(_0x6096('0x6'));var controller=require(_0x6096('0x7'));router['get']('/',auth[_0x6096('0x8')](),controller['index']);router[_0x6096('0x9')](_0x6096('0xa'),auth[_0x6096('0x8')](),controller['show']);router[_0x6096('0xb')]('/',auth['isAuthenticated'](),controller[_0x6096('0xc')]);router['put']('/:id',auth[_0x6096('0x8')](),controller[_0x6096('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6096('0xe')]);module[_0x6096('0xf')]=router; \ No newline at end of file +var _0xac76=['multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x5cec95,_0x1a4983){var _0x49407a=function(_0x108355){while(--_0x108355){_0x5cec95['push'](_0x5cec95['shift']());}};_0x49407a(++_0x1a4983);}(_0xac76,0x10e));var _0x6ac7=function(_0x4a13db,_0x912364){_0x4a13db=_0x4a13db-0x0;var _0x3bdc9e=_0xac76[_0x4a13db];return _0x3bdc9e;};'use strict';var multer=require(_0x6ac7('0x0'));var util=require('util');var path=require(_0x6ac7('0x1'));var timeout=require('connect-timeout');var express=require(_0x6ac7('0x2'));var router=express[_0x6ac7('0x3')]();var fs_extra=require(_0x6ac7('0x4'));var auth=require(_0x6ac7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x6ac7('0x6')]('/',auth[_0x6ac7('0x7')](),controller[_0x6ac7('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6ac7('0x9')]);router[_0x6ac7('0xa')]('/',auth[_0x6ac7('0x7')](),controller[_0x6ac7('0xb')]);router[_0x6ac7('0xc')](_0x6ac7('0xd'),auth['isAuthenticated'](),controller[_0x6ac7('0xe')]);router[_0x6ac7('0xf')](_0x6ac7('0xd'),auth[_0x6ac7('0x7')](),controller[_0x6ac7('0x10')]);module[_0x6ac7('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index bd445d6..6c08101 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 _0xfc99=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfc99,0x18d));var _0x9fc9=function(_0x2c7ac7,_0x1853ea){_0x2c7ac7=_0x2c7ac7-0x0;var _0x156218=_0xfc99[_0x2c7ac7];return _0x156218;};'use strict';var Sequelize=require(_0x9fc9('0x0'));module['exports']={'type':{'type':Sequelize[_0x9fc9('0x1')](_0x9fc9('0x2'),_0x9fc9('0x3'),_0x9fc9('0x4'),_0x9fc9('0x5'),'picklist'),'defaultValue':_0x9fc9('0x2')},'content':{'type':Sequelize[_0x9fc9('0x6')]},'key':{'type':Sequelize[_0x9fc9('0x6')]},'keyType':{'type':Sequelize[_0x9fc9('0x1')](_0x9fc9('0x2'),_0x9fc9('0x3'),_0x9fc9('0x4'))},'keyContent':{'type':Sequelize[_0x9fc9('0x6')]},'idField':{'type':Sequelize[_0x9fc9('0x6')]},'nameField':{'type':Sequelize[_0x9fc9('0x6')]},'customField':{'type':Sequelize[_0x9fc9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0d61=['BOOLEAN','sequelize','ENUM','string','customVariable','STRING','variable'];(function(_0x33c01c,_0x490587){var _0x4a8b9c=function(_0x231b86){while(--_0x231b86){_0x33c01c['push'](_0x33c01c['shift']());}};_0x4a8b9c(++_0x490587);}(_0x0d61,0x127));var _0x10d6=function(_0x34b6e6,_0x4f7c7c){_0x34b6e6=_0x34b6e6-0x0;var _0x48db75=_0x0d61[_0x34b6e6];return _0x48db75;};'use strict';var Sequelize=require(_0x10d6('0x0'));module['exports']={'type':{'type':Sequelize[_0x10d6('0x1')](_0x10d6('0x2'),'variable',_0x10d6('0x3'),'keyValue','picklist'),'defaultValue':_0x10d6('0x2')},'content':{'type':Sequelize[_0x10d6('0x4')]},'key':{'type':Sequelize[_0x10d6('0x4')]},'keyType':{'type':Sequelize[_0x10d6('0x1')]('string',_0x10d6('0x5'),_0x10d6('0x3'))},'keyContent':{'type':Sequelize[_0x10d6('0x4')]},'idField':{'type':Sequelize[_0x10d6('0x4')]},'nameField':{'type':Sequelize[_0x10d6('0x4')]},'customField':{'type':Sequelize[_0x10d6('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x10d6('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index c935e77..084354a 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 _0xc677=['order','sort','where','VIRTUAL','merge','options','DeskField','includeAll','include','catch','show','params','filters','intersection','find','create','update','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','then','end','name','send','index','map','rawAttributes','type','key','query','keys','model','attributes','fields','hasOwnProperty','nolimit'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xc677,0x16c));var _0x7c67=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc677[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c67('0x0'));var zipdir=require(_0x7c67('0x1'));var jsonpatch=require(_0x7c67('0x2'));var rp=require(_0x7c67('0x3'));var moment=require(_0x7c67('0x4'));var BPromise=require(_0x7c67('0x5'));var Mustache=require(_0x7c67('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7c67('0x7'));var fs=require('fs');var fs_extra=require(_0x7c67('0x8'));var _=require('lodash');var squel=require(_0x7c67('0x9'));var crypto=require('crypto');var jsforce=require(_0x7c67('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7c67('0xb'));var querystring=require(_0x7c67('0xc'));var Papa=require(_0x7c67('0xd'));var Redis=require(_0x7c67('0xe'));var authService=require(_0x7c67('0xf'));var qs=require(_0x7c67('0x10'));var as=require(_0x7c67('0x11'));var hardwareService=require(_0x7c67('0x12'));var logger=require(_0x7c67('0x13'))(_0x7c67('0x14'));var utils=require(_0x7c67('0x15'));var config=require(_0x7c67('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c67('0x17'))['db'];function respondWithStatusCode(_0x449661,_0x26fa55){_0x26fa55=_0x26fa55||0xcc;return function(_0x52f65b){if(_0x52f65b){return _0x449661[_0x7c67('0x18')](_0x26fa55);}return _0x449661['status'](_0x26fa55)['end']();};}function respondWithResult(_0x31355e,_0x2935eb){_0x2935eb=_0x2935eb||0xc8;return function(_0x3bf387){if(_0x3bf387){return _0x31355e[_0x7c67('0x19')](_0x2935eb)[_0x7c67('0x1a')](_0x3bf387);}};}function respondWithFilteredResult(_0x3c21c9,_0xd9743c){return function(_0x3a01ad){if(_0x3a01ad){var _0x336bb3=typeof _0xd9743c[_0x7c67('0x1b')]==='undefined'&&typeof _0xd9743c[_0x7c67('0x1c')]===_0x7c67('0x1d');var _0x2a4936=_0x3a01ad[_0x7c67('0x1e')];var _0x35d227=_0x336bb3?0x0:_0xd9743c[_0x7c67('0x1b')];var _0x197de0=_0x336bb3?_0x3a01ad[_0x7c67('0x1e')]:_0xd9743c[_0x7c67('0x1b')]+_0xd9743c[_0x7c67('0x1c')];var _0x30ed2c;if(_0x197de0>=_0x2a4936){_0x197de0=_0x2a4936;_0x30ed2c=0xc8;}else{_0x30ed2c=0xce;}_0x3c21c9[_0x7c67('0x19')](_0x30ed2c);return _0x3c21c9[_0x7c67('0x1f')](_0x7c67('0x20'),_0x35d227+'-'+_0x197de0+'/'+_0x2a4936)[_0x7c67('0x1a')](_0x3a01ad);}return null;};}function patchUpdates(_0x271f4e){return function(_0x307bd0){try{jsonpatch['apply'](_0x307bd0,_0x271f4e,!![]);}catch(_0x17d523){return BPromise['reject'](_0x17d523);}return _0x307bd0[_0x7c67('0x21')]();};}function saveUpdates(_0x1a05aa,_0x2af1fd){return function(_0x3f19ce){if(_0x3f19ce){return _0x3f19ce['update'](_0x1a05aa)['then'](function(_0x35b9c8){return _0x35b9c8;});}return null;};}function removeEntity(_0x11170e,_0x42a3d3){return function(_0x5ebfaf){if(_0x5ebfaf){return _0x5ebfaf['destroy']()[_0x7c67('0x22')](function(){_0x11170e[_0x7c67('0x19')](0xcc)[_0x7c67('0x23')]();});}};}function handleEntityNotFound(_0x670d50,_0xe1863a){return function(_0xf09e83){if(!_0xf09e83){_0x670d50['sendStatus'](0x194);}return _0xf09e83;};}function handleError(_0x250848,_0x11dd8d){_0x11dd8d=_0x11dd8d||0x1f4;return function(_0x52bc2b){logger['error'](_0x52bc2b['stack']);if(_0x52bc2b['name']){delete _0x52bc2b[_0x7c67('0x24')];}_0x250848['status'](_0x11dd8d)[_0x7c67('0x25')](_0x52bc2b);};}exports[_0x7c67('0x26')]=function(_0x2d67d5,_0x42ed09){var _0x2d03ef={},_0x51b48f={},_0x20e77c={'count':0x0,'rows':[]};var _0x42926d=_[_0x7c67('0x27')](db['DeskField'][_0x7c67('0x28')],function(_0x207846){return{'name':_0x207846['fieldName'],'type':_0x207846[_0x7c67('0x29')][_0x7c67('0x2a')]};});_0x51b48f['model']=_['map'](_0x42926d,_0x7c67('0x24'));_0x51b48f[_0x7c67('0x2b')]=_[_0x7c67('0x2c')](_0x2d67d5[_0x7c67('0x2b')]);_0x51b48f['filters']=_['intersection'](_0x51b48f[_0x7c67('0x2d')],_0x51b48f[_0x7c67('0x2b')]);_0x2d03ef[_0x7c67('0x2e')]=_['intersection'](_0x51b48f[_0x7c67('0x2d')],qs[_0x7c67('0x2f')](_0x2d67d5['query'][_0x7c67('0x2f')]));_0x2d03ef[_0x7c67('0x2e')]=_0x2d03ef[_0x7c67('0x2e')]['length']?_0x2d03ef[_0x7c67('0x2e')]:_0x51b48f[_0x7c67('0x2d')];if(!_0x2d67d5[_0x7c67('0x2b')][_0x7c67('0x30')](_0x7c67('0x31'))){_0x2d03ef[_0x7c67('0x1c')]=qs[_0x7c67('0x1c')](_0x2d67d5[_0x7c67('0x2b')][_0x7c67('0x1c')]);_0x2d03ef['offset']=qs[_0x7c67('0x1b')](_0x2d67d5['query'][_0x7c67('0x1b')]);}_0x2d03ef[_0x7c67('0x32')]=qs['sort'](_0x2d67d5[_0x7c67('0x2b')][_0x7c67('0x33')]);_0x2d03ef[_0x7c67('0x34')]=qs['filters'](_['pick'](_0x2d67d5[_0x7c67('0x2b')],_0x51b48f['filters']),_0x42926d);if(_0x2d67d5[_0x7c67('0x2b')]['filter']){_0x2d03ef[_0x7c67('0x34')]=_['merge'](_0x2d03ef[_0x7c67('0x34')],{'$or':_[_0x7c67('0x27')](_0x42926d,function(_0x30543d){if(_0x30543d['type']!==_0x7c67('0x35')){var _0x378006={};_0x378006[_0x30543d['name']]={'$like':'%'+_0x2d67d5[_0x7c67('0x2b')]['filter']+'%'};return _0x378006;}})});}_0x2d03ef=_[_0x7c67('0x36')]({},_0x2d03ef,_0x2d67d5[_0x7c67('0x37')]);var _0x2f7f28={'where':_0x2d03ef['where']};return db[_0x7c67('0x38')][_0x7c67('0x1e')](_0x2f7f28)['then'](function(_0x45245b){_0x20e77c['count']=_0x45245b;if(_0x2d67d5[_0x7c67('0x2b')][_0x7c67('0x39')]){_0x2d03ef[_0x7c67('0x3a')]=[{'all':!![]}];}return db[_0x7c67('0x38')]['findAll'](_0x2d03ef);})[_0x7c67('0x22')](function(_0x36d344){_0x20e77c['rows']=_0x36d344;return _0x20e77c;})[_0x7c67('0x22')](respondWithFilteredResult(_0x42ed09,_0x2d03ef))[_0x7c67('0x3b')](handleError(_0x42ed09,null));};exports[_0x7c67('0x3c')]=function(_0x3ee63c,_0x3aaa82){var _0x2695c8={'raw':!![],'where':{'id':_0x3ee63c[_0x7c67('0x3d')]['id']}},_0x45da99={};_0x45da99[_0x7c67('0x2d')]=_[_0x7c67('0x2c')](db[_0x7c67('0x38')][_0x7c67('0x28')]);_0x45da99[_0x7c67('0x2b')]=_['keys'](_0x3ee63c[_0x7c67('0x2b')]);_0x45da99[_0x7c67('0x3e')]=_[_0x7c67('0x3f')](_0x45da99[_0x7c67('0x2d')],_0x45da99['query']);_0x2695c8[_0x7c67('0x2e')]=_[_0x7c67('0x3f')](_0x45da99['model'],qs[_0x7c67('0x2f')](_0x3ee63c[_0x7c67('0x2b')][_0x7c67('0x2f')]));_0x2695c8[_0x7c67('0x2e')]=_0x2695c8[_0x7c67('0x2e')]['length']?_0x2695c8['attributes']:_0x45da99['model'];if(_0x3ee63c[_0x7c67('0x2b')][_0x7c67('0x39')]){_0x2695c8[_0x7c67('0x3a')]=[{'all':!![]}];}_0x2695c8=_[_0x7c67('0x36')]({},_0x2695c8,_0x3ee63c['options']);return db[_0x7c67('0x38')][_0x7c67('0x40')](_0x2695c8)[_0x7c67('0x22')](handleEntityNotFound(_0x3aaa82,null))[_0x7c67('0x22')](respondWithResult(_0x3aaa82,null))['catch'](handleError(_0x3aaa82,null));};exports[_0x7c67('0x41')]=function(_0x3840b5,_0x20428e){return db[_0x7c67('0x38')][_0x7c67('0x41')](_0x3840b5['body'],{})[_0x7c67('0x22')](respondWithResult(_0x20428e,0xc9))[_0x7c67('0x3b')](handleError(_0x20428e,null));};exports[_0x7c67('0x42')]=function(_0x1e07bf,_0x26e374){if(_0x1e07bf[_0x7c67('0x43')]['id']){delete _0x1e07bf[_0x7c67('0x43')]['id'];}return db[_0x7c67('0x38')]['find']({'where':{'id':_0x1e07bf[_0x7c67('0x3d')]['id']}})[_0x7c67('0x22')](handleEntityNotFound(_0x26e374,null))[_0x7c67('0x22')](saveUpdates(_0x1e07bf['body'],null))[_0x7c67('0x22')](respondWithResult(_0x26e374,null))[_0x7c67('0x3b')](handleError(_0x26e374,null));};exports[_0x7c67('0x44')]=function(_0x1b766d,_0x156c5a){return db[_0x7c67('0x38')]['find']({'where':{'id':_0x1b766d['params']['id']}})[_0x7c67('0x22')](handleEntityNotFound(_0x156c5a,null))['then'](removeEntity(_0x156c5a,null))[_0x7c67('0x3b')](handleError(_0x156c5a,null));}; \ No newline at end of file +var _0x8f53=['eml-format','rimraf','zip-dir','moment','bluebird','sox','to-csv','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','DeskField','findAll','rows','catch','show','params','intersection','includeAll','include','find','create','update','body'];(function(_0x1f54cf,_0x3feadc){var _0x17ff25=function(_0x14f328){while(--_0x14f328){_0x1f54cf['push'](_0x1f54cf['shift']());}};_0x17ff25(++_0x3feadc);}(_0x8f53,0x128));var _0x38f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f53[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x38f5('0x0'));var rimraf=require(_0x38f5('0x1'));var zipdir=require(_0x38f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x38f5('0x3'));var BPromise=require(_0x38f5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x38f5('0x5'));var csv=require(_0x38f5('0x6'));var ejs=require(_0x38f5('0x7'));var fs=require('fs');var fs_extra=require(_0x38f5('0x8'));var _=require(_0x38f5('0x9'));var squel=require(_0x38f5('0xa'));var crypto=require(_0x38f5('0xb'));var jsforce=require(_0x38f5('0xc'));var deskjs=require(_0x38f5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x38f5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x38f5('0xf'));var qs=require(_0x38f5('0x10'));var as=require(_0x38f5('0x11'));var hardwareService=require(_0x38f5('0x12'));var logger=require(_0x38f5('0x13'))(_0x38f5('0x14'));var utils=require('../../config/utils');var config=require(_0x38f5('0x15'));var licenseUtil=require(_0x38f5('0x16'));var db=require(_0x38f5('0x17'))['db'];function respondWithStatusCode(_0x4b9404,_0x1e9878){_0x1e9878=_0x1e9878||0xcc;return function(_0x21abed){if(_0x21abed){return _0x4b9404[_0x38f5('0x18')](_0x1e9878);}return _0x4b9404[_0x38f5('0x19')](_0x1e9878)['end']();};}function respondWithResult(_0x1b400f,_0x473006){_0x473006=_0x473006||0xc8;return function(_0x5d18d0){if(_0x5d18d0){return _0x1b400f[_0x38f5('0x19')](_0x473006)['json'](_0x5d18d0);}};}function respondWithFilteredResult(_0x5d1396,_0x549c28){return function(_0x53facd){if(_0x53facd){var _0x13fd23=typeof _0x549c28[_0x38f5('0x1a')]===_0x38f5('0x1b')&&typeof _0x549c28[_0x38f5('0x1c')]===_0x38f5('0x1b');var _0x6e2b67=_0x53facd[_0x38f5('0x1d')];var _0xf707f=_0x13fd23?0x0:_0x549c28[_0x38f5('0x1a')];var _0x5a6447=_0x13fd23?_0x53facd[_0x38f5('0x1d')]:_0x549c28['offset']+_0x549c28[_0x38f5('0x1c')];var _0x5dc1df;if(_0x5a6447>=_0x6e2b67){_0x5a6447=_0x6e2b67;_0x5dc1df=0xc8;}else{_0x5dc1df=0xce;}_0x5d1396[_0x38f5('0x19')](_0x5dc1df);return _0x5d1396[_0x38f5('0x1e')](_0x38f5('0x1f'),_0xf707f+'-'+_0x5a6447+'/'+_0x6e2b67)[_0x38f5('0x20')](_0x53facd);}return null;};}function patchUpdates(_0x4c29cd){return function(_0x187273){try{jsonpatch[_0x38f5('0x21')](_0x187273,_0x4c29cd,!![]);}catch(_0x1d70b0){return BPromise['reject'](_0x1d70b0);}return _0x187273['save']();};}function saveUpdates(_0x18d6af,_0x7b0a3d){return function(_0x1df39d){if(_0x1df39d){return _0x1df39d['update'](_0x18d6af)[_0x38f5('0x22')](function(_0x2e3e98){return _0x2e3e98;});}return null;};}function removeEntity(_0x29811b,_0x5f08a3){return function(_0x5c5b01){if(_0x5c5b01){return _0x5c5b01[_0x38f5('0x23')]()[_0x38f5('0x22')](function(){_0x29811b[_0x38f5('0x19')](0xcc)[_0x38f5('0x24')]();});}};}function handleEntityNotFound(_0x455168,_0x512cb3){return function(_0x1cf902){if(!_0x1cf902){_0x455168[_0x38f5('0x18')](0x194);}return _0x1cf902;};}function handleError(_0x189898,_0x91952f){_0x91952f=_0x91952f||0x1f4;return function(_0x1b611d){logger['error'](_0x1b611d[_0x38f5('0x25')]);if(_0x1b611d[_0x38f5('0x26')]){delete _0x1b611d[_0x38f5('0x26')];}_0x189898[_0x38f5('0x19')](_0x91952f)[_0x38f5('0x27')](_0x1b611d);};}exports[_0x38f5('0x28')]=function(_0xc96ef7,_0x647652){var _0xfc5e5={},_0x813058={},_0x4399a1={'count':0x0,'rows':[]};var _0xa5934c=_[_0x38f5('0x29')](db['DeskField'][_0x38f5('0x2a')],function(_0x341e30){return{'name':_0x341e30[_0x38f5('0x2b')],'type':_0x341e30['type'][_0x38f5('0x2c')]};});_0x813058[_0x38f5('0x2d')]=_[_0x38f5('0x29')](_0xa5934c,_0x38f5('0x26'));_0x813058[_0x38f5('0x2e')]=_[_0x38f5('0x2f')](_0xc96ef7[_0x38f5('0x2e')]);_0x813058[_0x38f5('0x30')]=_['intersection'](_0x813058[_0x38f5('0x2d')],_0x813058[_0x38f5('0x2e')]);_0xfc5e5[_0x38f5('0x31')]=_['intersection'](_0x813058[_0x38f5('0x2d')],qs[_0x38f5('0x32')](_0xc96ef7['query'][_0x38f5('0x32')]));_0xfc5e5[_0x38f5('0x31')]=_0xfc5e5[_0x38f5('0x31')][_0x38f5('0x33')]?_0xfc5e5[_0x38f5('0x31')]:_0x813058[_0x38f5('0x2d')];if(!_0xc96ef7[_0x38f5('0x2e')][_0x38f5('0x34')](_0x38f5('0x35'))){_0xfc5e5['limit']=qs['limit'](_0xc96ef7[_0x38f5('0x2e')][_0x38f5('0x1c')]);_0xfc5e5[_0x38f5('0x1a')]=qs[_0x38f5('0x1a')](_0xc96ef7['query']['offset']);}_0xfc5e5['order']=qs[_0x38f5('0x36')](_0xc96ef7['query']['sort']);_0xfc5e5[_0x38f5('0x37')]=qs[_0x38f5('0x30')](_[_0x38f5('0x38')](_0xc96ef7['query'],_0x813058[_0x38f5('0x30')]),_0xa5934c);if(_0xc96ef7[_0x38f5('0x2e')][_0x38f5('0x39')]){_0xfc5e5[_0x38f5('0x37')]=_[_0x38f5('0x3a')](_0xfc5e5['where'],{'$or':_['map'](_0xa5934c,function(_0xbcf1f4){if(_0xbcf1f4[_0x38f5('0x3b')]!=='VIRTUAL'){var _0x204824={};_0x204824[_0xbcf1f4[_0x38f5('0x26')]]={'$like':'%'+_0xc96ef7[_0x38f5('0x2e')][_0x38f5('0x39')]+'%'};return _0x204824;}})});}_0xfc5e5=_[_0x38f5('0x3a')]({},_0xfc5e5,_0xc96ef7[_0x38f5('0x3c')]);var _0x4e4913={'where':_0xfc5e5['where']};return db[_0x38f5('0x3d')][_0x38f5('0x1d')](_0x4e4913)[_0x38f5('0x22')](function(_0x4c389c){_0x4399a1[_0x38f5('0x1d')]=_0x4c389c;if(_0xc96ef7[_0x38f5('0x2e')]['includeAll']){_0xfc5e5['include']=[{'all':!![]}];}return db[_0x38f5('0x3d')][_0x38f5('0x3e')](_0xfc5e5);})[_0x38f5('0x22')](function(_0xedc34e){_0x4399a1[_0x38f5('0x3f')]=_0xedc34e;return _0x4399a1;})[_0x38f5('0x22')](respondWithFilteredResult(_0x647652,_0xfc5e5))[_0x38f5('0x40')](handleError(_0x647652,null));};exports[_0x38f5('0x41')]=function(_0x22a918,_0x26d21f){var _0x7051bf={'raw':!![],'where':{'id':_0x22a918[_0x38f5('0x42')]['id']}},_0x40a94c={};_0x40a94c[_0x38f5('0x2d')]=_[_0x38f5('0x2f')](db[_0x38f5('0x3d')]['rawAttributes']);_0x40a94c[_0x38f5('0x2e')]=_[_0x38f5('0x2f')](_0x22a918[_0x38f5('0x2e')]);_0x40a94c[_0x38f5('0x30')]=_[_0x38f5('0x43')](_0x40a94c[_0x38f5('0x2d')],_0x40a94c[_0x38f5('0x2e')]);_0x7051bf[_0x38f5('0x31')]=_[_0x38f5('0x43')](_0x40a94c[_0x38f5('0x2d')],qs[_0x38f5('0x32')](_0x22a918['query'][_0x38f5('0x32')]));_0x7051bf[_0x38f5('0x31')]=_0x7051bf[_0x38f5('0x31')][_0x38f5('0x33')]?_0x7051bf[_0x38f5('0x31')]:_0x40a94c[_0x38f5('0x2d')];if(_0x22a918[_0x38f5('0x2e')][_0x38f5('0x44')]){_0x7051bf[_0x38f5('0x45')]=[{'all':!![]}];}_0x7051bf=_[_0x38f5('0x3a')]({},_0x7051bf,_0x22a918[_0x38f5('0x3c')]);return db['DeskField'][_0x38f5('0x46')](_0x7051bf)[_0x38f5('0x22')](handleEntityNotFound(_0x26d21f,null))[_0x38f5('0x22')](respondWithResult(_0x26d21f,null))[_0x38f5('0x40')](handleError(_0x26d21f,null));};exports[_0x38f5('0x47')]=function(_0x599e1a,_0x588285){return db[_0x38f5('0x3d')]['create'](_0x599e1a['body'],{})[_0x38f5('0x22')](respondWithResult(_0x588285,0xc9))[_0x38f5('0x40')](handleError(_0x588285,null));};exports[_0x38f5('0x48')]=function(_0x3dd7a6,_0x1a5b1b){if(_0x3dd7a6[_0x38f5('0x49')]['id']){delete _0x3dd7a6[_0x38f5('0x49')]['id'];}return db[_0x38f5('0x3d')]['find']({'where':{'id':_0x3dd7a6['params']['id']}})[_0x38f5('0x22')](handleEntityNotFound(_0x1a5b1b,null))[_0x38f5('0x22')](saveUpdates(_0x3dd7a6[_0x38f5('0x49')],null))['then'](respondWithResult(_0x1a5b1b,null))['catch'](handleError(_0x1a5b1b,null));};exports[_0x38f5('0x23')]=function(_0x6c6ae7,_0x2ab880){return db[_0x38f5('0x3d')]['find']({'where':{'id':_0x6c6ae7[_0x38f5('0x42')]['id']}})[_0x38f5('0x22')](handleEntityNotFound(_0x2ab880,null))[_0x38f5('0x22')](removeEntity(_0x2ab880,null))[_0x38f5('0x40')](handleError(_0x2ab880,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 3c9e154..e47ac08 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 _0x883c=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','int_desk_fields','desk_unique_index','idField'];(function(_0x1af25d,_0x50345a){var _0x503848=function(_0x514be1){while(--_0x514be1){_0x1af25d['push'](_0x1af25d['shift']());}};_0x503848(++_0x50345a);}(_0x883c,0x1b3));var _0xc883=function(_0x4afb23,_0x40b8fb){_0x4afb23=_0x4afb23-0x0;var _0x4a833d=_0x883c[_0x4afb23];return _0x4a833d;};'use strict';var _=require(_0xc883('0x0'));var util=require(_0xc883('0x1'));var logger=require(_0xc883('0x2'))(_0xc883('0x3'));var moment=require(_0xc883('0x4'));var BPromise=require(_0xc883('0x5'));var rp=require(_0xc883('0x6'));var fs=require('fs');var path=require(_0xc883('0x7'));var rimraf=require(_0xc883('0x8'));var config=require(_0xc883('0x9'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x12dee9,_0x903998){return _0x12dee9['define']('DeskField',attributes,{'tableName':_0xc883('0xa'),'paranoid':![],'indexes':[{'name':_0xc883('0xb'),'fields':[_0xc883('0xc'),_0xc883('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x99c6=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','idField','FieldId','../../config/logger','api','moment'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x99c6,0x185));var _0x699c=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x99c6[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x699c('0x0'))(_0x699c('0x1'));var moment=require(_0x699c('0x2'));var BPromise=require(_0x699c('0x3'));var rp=require(_0x699c('0x4'));var fs=require('fs');var path=require(_0x699c('0x5'));var rimraf=require(_0x699c('0x6'));var config=require(_0x699c('0x7'));var attributes=require(_0x699c('0x8'));module[_0x699c('0x9')]=function(_0x292c40,_0x176f4e){return _0x292c40[_0x699c('0xa')]('DeskField',attributes,{'tableName':_0x699c('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x699c('0xc'),_0x699c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index cbcb466..caac42b 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 _0x7414=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x7414,0xc9));var _0x4741=function(_0x402084,_0x4e91d6){_0x402084=_0x402084-0x0;var _0x254817=_0x7414[_0x402084];return _0x254817;};'use strict';var _=require('lodash');var util=require(_0x4741('0x0'));var moment=require(_0x4741('0x1'));var BPromise=require(_0x4741('0x2'));var rs=require(_0x4741('0x3'));var fs=require('fs');var Redis=require(_0x4741('0x4'));var db=require(_0x4741('0x5'))['db'];var utils=require(_0x4741('0x6'));var logger=require(_0x4741('0x7'))(_0x4741('0x8'));var config=require('../../config/environment');var jayson=require(_0x4741('0x9'));var client=jayson[_0x4741('0xa')][_0x4741('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf0dc52,_0x3050c2,_0x507a0e){return new BPromise(function(_0x2d7d04,_0x329479){return client[_0x4741('0xc')](_0xf0dc52,_0x507a0e)[_0x4741('0xd')](function(_0x2f00fa){logger[_0x4741('0xe')](_0x4741('0xf'),_0x3050c2,_0x4741('0x10'));logger['debug'](_0x4741('0x11'),_0x3050c2,_0x4741('0x10'),JSON['stringify'](_0x2f00fa));if(_0x2f00fa[_0x4741('0x12')]){if(_0x2f00fa[_0x4741('0x12')][_0x4741('0x13')]===0x1f4){logger[_0x4741('0x12')](_0x4741('0xf'),_0x3050c2,_0x2f00fa[_0x4741('0x12')][_0x4741('0x14')]);return _0x329479(_0x2f00fa[_0x4741('0x12')]['message']);}logger[_0x4741('0x12')]('DeskField,\x20%s,\x20%s',_0x3050c2,_0x2f00fa['error'][_0x4741('0x14')]);return _0x2d7d04(_0x2f00fa['error']['message']);}else{logger[_0x4741('0xe')](_0x4741('0xf'),_0x3050c2,_0x4741('0x10'));_0x2d7d04(_0x2f00fa[_0x4741('0x15')][_0x4741('0x14')]);}})[_0x4741('0x16')](function(_0x55719f){logger['error'](_0x4741('0xf'),_0x3050c2,_0x55719f);_0x329479(_0x55719f);});});} \ No newline at end of file +var _0x547c=['message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x9595cf,_0x5226bf){var _0x4215fe=function(_0x52124b){while(--_0x52124b){_0x9595cf['push'](_0x9595cf['shift']());}};_0x4215fe(++_0x5226bf);}(_0x547c,0x122));var _0xc547=function(_0x211103,_0x5b97f3){_0x211103=_0x211103-0x0;var _0x1201a4=_0x547c[_0x211103];return _0x1201a4;};'use strict';var _=require(_0xc547('0x0'));var util=require(_0xc547('0x1'));var moment=require('moment');var BPromise=require(_0xc547('0x2'));var rs=require(_0xc547('0x3'));var fs=require('fs');var Redis=require(_0xc547('0x4'));var db=require(_0xc547('0x5'))['db'];var utils=require(_0xc547('0x6'));var logger=require(_0xc547('0x7'))('rpc');var config=require(_0xc547('0x8'));var jayson=require(_0xc547('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50c4d4,_0x9e3eec,_0x130458){return new BPromise(function(_0x51c380,_0x447497){return client[_0xc547('0xa')](_0x50c4d4,_0x130458)[_0xc547('0xb')](function(_0xd98c68){logger[_0xc547('0xc')](_0xc547('0xd'),_0x9e3eec,'request\x20sent');logger[_0xc547('0xe')](_0xc547('0xf'),_0x9e3eec,'request\x20sent',JSON[_0xc547('0x10')](_0xd98c68));if(_0xd98c68[_0xc547('0x11')]){if(_0xd98c68[_0xc547('0x11')]['code']===0x1f4){logger[_0xc547('0x11')]('DeskField,\x20%s,\x20%s',_0x9e3eec,_0xd98c68[_0xc547('0x11')][_0xc547('0x12')]);return _0x447497(_0xd98c68['error']['message']);}logger[_0xc547('0x11')](_0xc547('0xd'),_0x9e3eec,_0xd98c68[_0xc547('0x11')][_0xc547('0x12')]);return _0x51c380(_0xd98c68[_0xc547('0x11')][_0xc547('0x12')]);}else{logger['info'](_0xc547('0xd'),_0x9e3eec,_0xc547('0x13'));_0x51c380(_0xd98c68[_0xc547('0x14')][_0xc547('0x12')]);}})[_0xc547('0x15')](function(_0x5a0309){logger[_0xc547('0x11')](_0xc547('0xd'),_0x9e3eec,_0x5a0309);_0x447497(_0x5a0309);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index bf4af15..9d5ef55 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 _0x9960=['delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update'];(function(_0x5cceda,_0x36bb40){var _0x121aa4=function(_0x39e5be){while(--_0x39e5be){_0x5cceda['push'](_0x5cceda['shift']());}};_0x121aa4(++_0x36bb40);}(_0x9960,0xda));var _0x0996=function(_0x16b352,_0x272086){_0x16b352=_0x16b352-0x0;var _0x58b676=_0x9960[_0x16b352];return _0x58b676;};'use strict';var multer=require(_0x0996('0x0'));var util=require(_0x0996('0x1'));var path=require(_0x0996('0x2'));var timeout=require(_0x0996('0x3'));var express=require(_0x0996('0x4'));var router=express['Router']();var fs_extra=require(_0x0996('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0996('0x6'));var config=require(_0x0996('0x7'));var controller=require(_0x0996('0x8'));router[_0x0996('0x9')]('/',auth[_0x0996('0xa')](),controller[_0x0996('0xb')]);router[_0x0996('0x9')](_0x0996('0xc'),auth[_0x0996('0xa')](),controller[_0x0996('0xd')]);router['get'](_0x0996('0xe'),auth['isAuthenticated'](),controller[_0x0996('0xf')]);router[_0x0996('0x9')](_0x0996('0x10'),auth[_0x0996('0xa')](),controller['getFields']);router[_0x0996('0x11')]('/',auth[_0x0996('0xa')](),controller[_0x0996('0x12')]);router[_0x0996('0x11')](_0x0996('0xe'),auth['isAuthenticated'](),controller[_0x0996('0x13')]);router[_0x0996('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0996('0x15')]);router[_0x0996('0x16')]('/:id',auth[_0x0996('0xa')](),controller['destroy']);module[_0x0996('0x17')]=router; \ No newline at end of file +var _0x8eda=['addConfiguration','/:id','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','create','post','/:id/configurations'];(function(_0x219840,_0x236d8c){var _0x21f1bc=function(_0x1f8f82){while(--_0x1f8f82){_0x219840['push'](_0x219840['shift']());}};_0x21f1bc(++_0x236d8c);}(_0x8eda,0x82));var _0xa8ed=function(_0x5320b9,_0x4101f1){_0x5320b9=_0x5320b9-0x0;var _0x5a7a30=_0x8eda[_0x5320b9];return _0x5a7a30;};'use strict';var multer=require(_0xa8ed('0x0'));var util=require(_0xa8ed('0x1'));var path=require(_0xa8ed('0x2'));var timeout=require(_0xa8ed('0x3'));var express=require(_0xa8ed('0x4'));var router=express['Router']();var fs_extra=require(_0xa8ed('0x5'));var auth=require(_0xa8ed('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa8ed('0x7'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0xa8ed('0x8')](),controller[_0xa8ed('0x9')]);router[_0xa8ed('0xa')]('/:id',auth[_0xa8ed('0x8')](),controller[_0xa8ed('0xb')]);router['get']('/:id/configurations',auth[_0xa8ed('0x8')](),controller['getConfigurations']);router[_0xa8ed('0xa')](_0xa8ed('0xc'),auth[_0xa8ed('0x8')](),controller[_0xa8ed('0xd')]);router['post']('/',auth[_0xa8ed('0x8')](),controller[_0xa8ed('0xe')]);router[_0xa8ed('0xf')](_0xa8ed('0x10'),auth[_0xa8ed('0x8')](),controller[_0xa8ed('0x11')]);router['put'](_0xa8ed('0x12'),auth[_0xa8ed('0x8')](),controller[_0xa8ed('0x13')]);router['delete'](_0xa8ed('0x12'),auth[_0xa8ed('0x8')](),controller['destroy']);module[_0xa8ed('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 602c1eb..8990109 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 _0x4006=['STRING','exports'];(function(_0x518e84,_0x1f9c75){var _0x344317=function(_0x538c93){while(--_0x538c93){_0x518e84['push'](_0x518e84['shift']());}};_0x344317(++_0x1f9c75);}(_0x4006,0x1c7));var _0x6400=function(_0x17c7ba,_0x277e7e){_0x17c7ba=_0x17c7ba-0x0;var _0x2b1115=_0x4006[_0x17c7ba];return _0x2b1115;};'use strict';var Sequelize=require('sequelize');module[_0x6400('0x0')]={'name':{'type':Sequelize[_0x6400('0x1')]},'username':{'type':Sequelize[_0x6400('0x1')]},'password':{'type':Sequelize[_0x6400('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6400('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6400('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x12e9=['STRING','BOOLEAN'];(function(_0x4e4d5c,_0x25dd3a){var _0x56854a=function(_0x221d35){while(--_0x221d35){_0x4e4d5c['push'](_0x4e4d5c['shift']());}};_0x56854a(++_0x25dd3a);}(_0x12e9,0x66));var _0x912e=function(_0x1d2706,_0x4d29a5){_0x1d2706=_0x1d2706-0x0;var _0x4faabf=_0x12e9[_0x1d2706];return _0x4faabf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x912e('0x0')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x912e('0x0')]},'remoteUri':{'type':Sequelize[_0x912e('0x0')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x912e('0x0')]},'clientSecret':{'type':Sequelize[_0x912e('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x912e('0x0')]},'modernAuthentication':{'type':Sequelize[_0x912e('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index ff1b5da..b97ac2a 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 _0xc64f=['customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','https://login.microsoftonline.com/','clientId','GET','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','Content-Range','update','then','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','count','findAll','catch','show','params','fields','include','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','format','getFields','ticketType','incident','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname'];(function(_0x4095a2,_0x2b6e8c){var _0x1fb1a5=function(_0x52ff3c){while(--_0x52ff3c){_0x4095a2['push'](_0x4095a2['shift']());}};_0x1fb1a5(++_0x2b6e8c);}(_0xc64f,0x11e));var _0xfc64=function(_0x5607f3,_0x5e2ceb){_0x5607f3=_0x5607f3-0x0;var _0x5d5f04=_0xc64f[_0x5607f3];return _0x5d5f04;};'use strict';var rp=require('request-promise');var util=require(_0xfc64('0x0'));var _=require(_0xfc64('0x1'));var qs=require(_0xfc64('0x2'));var logger=require(_0xfc64('0x3'))(_0xfc64('0x4'));var db=require(_0xfc64('0x5'))['db'];var integrations=require(_0xfc64('0x6'));function respondWithResult(_0x51fbae,_0x3ac5a2){_0x3ac5a2=_0x3ac5a2||0xc8;return function(_0x2313dc){if(_0x2313dc){return _0x51fbae[_0xfc64('0x7')](_0x3ac5a2)[_0xfc64('0x8')](_0x2313dc);}};}function respondWithFilteredResult(_0x3589a8,_0x1675c2){return function(_0x57ab35){if(_0x57ab35){var _0xf0f96c=typeof _0x1675c2[_0xfc64('0x9')]==='undefined'&&typeof _0x1675c2['limit']===_0xfc64('0xa');var _0x475437=_0x57ab35['count'];var _0x202cac=_0xf0f96c?0x0:_0x1675c2[_0xfc64('0x9')];var _0xeab9c7=_0xf0f96c?_0x57ab35['count']:_0x1675c2[_0xfc64('0x9')]+_0x1675c2[_0xfc64('0xb')];var _0xfbc531;if(_0xeab9c7>=_0x475437){_0xeab9c7=_0x475437;_0xfbc531=0xc8;}else{_0xfbc531=0xce;}_0x3589a8[_0xfc64('0x7')](_0xfbc531);return _0x3589a8['set'](_0xfc64('0xc'),_0x202cac+'-'+_0xeab9c7+'/'+_0x475437)[_0xfc64('0x8')](_0x57ab35);}return null;};}function saveUpdates(_0x18cca7){return function(_0x46373a){if(_0x46373a){return _0x46373a[_0xfc64('0xd')](_0x18cca7)['then'](function(_0x2079be){return _0x2079be;});}return null;};}function removeEntity(_0x306fd6){return function(_0x5db626){if(_0x5db626){return _0x5db626['destroy']()[_0xfc64('0xe')](function(){_0x306fd6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e1865){return function(_0x20ccff){if(!_0x20ccff){_0x2e1865['sendStatus'](0x194);}return _0x20ccff;};}function handleError(_0x1b0f46,_0x4f992c){_0x4f992c=_0x4f992c||0x1f4;return function(_0x4df909){logger[_0xfc64('0xf')](_0x4df909[_0xfc64('0x10')]);if(_0x4df909[_0xfc64('0x11')]){delete _0x4df909[_0xfc64('0x11')];}_0x1b0f46[_0xfc64('0x7')](_0x4f992c)[_0xfc64('0x12')](_0x4df909);};}exports[_0xfc64('0x13')]=function(_0x14f825,_0x5b3f1e){var _0x2f2bbb={},_0x58ba3f={},_0x456ad5={'count':0x0,'rows':[]};var _0x132703=_[_0xfc64('0x14')](db[_0xfc64('0x15')][_0xfc64('0x16')],function(_0x33d073){return{'name':_0x33d073[_0xfc64('0x17')],'type':_0x33d073[_0xfc64('0x18')][_0xfc64('0x19')]};});_0x58ba3f[_0xfc64('0x1a')]=_[_0xfc64('0x14')](_0x132703,_0xfc64('0x11'));_0x58ba3f['query']=_[_0xfc64('0x1b')](_0x14f825[_0xfc64('0x1c')]);_0x58ba3f[_0xfc64('0x1d')]=_[_0xfc64('0x1e')](_0x58ba3f[_0xfc64('0x1a')],_0x58ba3f['query']);_0x2f2bbb['attributes']=_[_0xfc64('0x1e')](_0x58ba3f[_0xfc64('0x1a')],qs['fields'](_0x14f825[_0xfc64('0x1c')]['fields']));_0x2f2bbb['attributes']=_0x2f2bbb[_0xfc64('0x1f')][_0xfc64('0x20')]?_0x2f2bbb[_0xfc64('0x1f')]:_0x58ba3f['model'];if(!_0x14f825['query'][_0xfc64('0x21')](_0xfc64('0x22'))){_0x2f2bbb[_0xfc64('0xb')]=qs[_0xfc64('0xb')](_0x14f825[_0xfc64('0x1c')]['limit']);_0x2f2bbb[_0xfc64('0x9')]=qs[_0xfc64('0x9')](_0x14f825[_0xfc64('0x1c')][_0xfc64('0x9')]);}_0x2f2bbb[_0xfc64('0x23')]=qs[_0xfc64('0x24')](_0x14f825['query']['sort']);_0x2f2bbb[_0xfc64('0x25')]=qs['filters'](_['pick'](_0x14f825[_0xfc64('0x1c')],_0x58ba3f[_0xfc64('0x1d')]),_0x132703);if(_0x14f825[_0xfc64('0x1c')]['filter']){_0x2f2bbb['where']=_['merge'](_0x2f2bbb['where'],{'$or':_['map'](_0x132703,function(_0x5cab5e){if(_0x5cab5e[_0xfc64('0x18')]!==_0xfc64('0x26')){var _0x3449b2={};_0x3449b2[_0x5cab5e[_0xfc64('0x11')]]={'$like':'%'+_0x14f825[_0xfc64('0x1c')][_0xfc64('0x27')]+'%'};return _0x3449b2;}})});}_0x2f2bbb=_[_0xfc64('0x28')]({},_0x2f2bbb,_0x14f825[_0xfc64('0x29')]);var _0x2900c9={'where':_0x2f2bbb[_0xfc64('0x25')]};return db['Dynamics365Account'][_0xfc64('0x2a')](_0x2900c9)['then'](function(_0x40d79c){_0x456ad5[_0xfc64('0x2a')]=_0x40d79c;if(_0x14f825[_0xfc64('0x1c')]['includeAll']){_0x2f2bbb['include']=[{'all':!![]}];}return db[_0xfc64('0x15')][_0xfc64('0x2b')](_0x2f2bbb);})[_0xfc64('0xe')](function(_0x55bf25){_0x456ad5['rows']=_0x55bf25;return _0x456ad5;})[_0xfc64('0xe')](respondWithFilteredResult(_0x5b3f1e,_0x2f2bbb))[_0xfc64('0x2c')](handleError(_0x5b3f1e,null));};exports[_0xfc64('0x2d')]=function(_0x3e149d,_0x3975f6){var _0x18f989={'raw':![],'where':{'id':_0x3e149d[_0xfc64('0x2e')]['id']}},_0x56efac={};_0x56efac[_0xfc64('0x1a')]=_[_0xfc64('0x1b')](db['Dynamics365Account'][_0xfc64('0x16')]);_0x56efac['query']=_[_0xfc64('0x1b')](_0x3e149d[_0xfc64('0x1c')]);_0x56efac['filters']=_['intersection'](_0x56efac[_0xfc64('0x1a')],_0x56efac['query']);_0x18f989['attributes']=_['intersection'](_0x56efac[_0xfc64('0x1a')],qs[_0xfc64('0x2f')](_0x3e149d[_0xfc64('0x1c')][_0xfc64('0x2f')]));_0x18f989[_0xfc64('0x1f')]=_0x18f989['attributes'][_0xfc64('0x20')]?_0x18f989[_0xfc64('0x1f')]:_0x56efac['model'];if(_0x3e149d[_0xfc64('0x1c')]['includeAll']){_0x18f989[_0xfc64('0x30')]=[{'all':!![]}];}_0x18f989=_[_0xfc64('0x28')]({},_0x18f989,_0x3e149d[_0xfc64('0x29')]);return db[_0xfc64('0x15')][_0xfc64('0x31')](_0x18f989)['then'](handleEntityNotFound(_0x3975f6,null))[_0xfc64('0xe')](respondWithResult(_0x3975f6,null))[_0xfc64('0x2c')](handleError(_0x3975f6,null));};exports[_0xfc64('0x32')]=function(_0xbb4d15,_0x208ffe){return db['Dynamics365Account'][_0xfc64('0x32')](_0xbb4d15[_0xfc64('0x33')],{})[_0xfc64('0xe')](respondWithResult(_0x208ffe,0xc9))[_0xfc64('0x2c')](handleError(_0x208ffe,null));};exports[_0xfc64('0xd')]=function(_0x373377,_0x9fc9e8){if(_0x373377[_0xfc64('0x33')]['id']){delete _0x373377[_0xfc64('0x33')]['id'];}return db[_0xfc64('0x15')][_0xfc64('0x31')]({'where':{'id':_0x373377['params']['id']}})[_0xfc64('0xe')](handleEntityNotFound(_0x9fc9e8,null))['then'](saveUpdates(_0x373377[_0xfc64('0x33')],null))[_0xfc64('0xe')](respondWithResult(_0x9fc9e8,null))[_0xfc64('0x2c')](handleError(_0x9fc9e8,null));};exports[_0xfc64('0x34')]=function(_0x5cfb85,_0x5d95f4){return db[_0xfc64('0x15')]['find']({'where':{'id':_0x5cfb85['params']['id']}})['then'](handleEntityNotFound(_0x5d95f4,null))[_0xfc64('0xe')](removeEntity(_0x5d95f4,null))['catch'](handleError(_0x5d95f4,null));};exports[_0xfc64('0x35')]=function(_0x21e03a,_0x54b3ab){var _0x241433={};var _0x1e5df2={};var _0x32b0f7;var _0x5ef4ea;return db[_0xfc64('0x15')][_0xfc64('0x36')]({'where':{'id':_0x21e03a['params']['id']}})['then'](handleEntityNotFound(_0x54b3ab,null))[_0xfc64('0xe')](function(_0x517deb){if(_0x517deb){_0x32b0f7=_0x517deb;_0x1e5df2['model']=_[_0xfc64('0x1b')](db[_0xfc64('0x37')]['rawAttributes']);_0x1e5df2[_0xfc64('0x1c')]=_['keys'](_0x21e03a[_0xfc64('0x1c')]);_0x1e5df2[_0xfc64('0x1d')]=_[_0xfc64('0x1e')](_0x1e5df2[_0xfc64('0x1a')],_0x1e5df2[_0xfc64('0x1c')]);_0x241433[_0xfc64('0x1f')]=_['intersection'](_0x1e5df2[_0xfc64('0x1a')],qs[_0xfc64('0x2f')](_0x21e03a['query'][_0xfc64('0x2f')]));_0x241433[_0xfc64('0x1f')]=_0x241433[_0xfc64('0x1f')][_0xfc64('0x20')]?_0x241433[_0xfc64('0x1f')]:_0x1e5df2[_0xfc64('0x1a')];_0x241433['order']=qs[_0xfc64('0x24')](_0x21e03a[_0xfc64('0x1c')][_0xfc64('0x24')]);_0x241433['where']=qs['filters'](_['pick'](_0x21e03a[_0xfc64('0x1c')],_0x1e5df2[_0xfc64('0x1d')]));if(_0x21e03a[_0xfc64('0x1c')][_0xfc64('0x27')]){_0x241433[_0xfc64('0x25')]=_['merge'](_0x241433[_0xfc64('0x25')],{'$or':_[_0xfc64('0x14')](_0x241433[_0xfc64('0x1f')],function(_0x1327b0){var _0x4c737f={};_0x4c737f[_0x1327b0]={'$like':'%'+_0x21e03a[_0xfc64('0x1c')][_0xfc64('0x27')]+'%'};return _0x4c737f;})});}_0x241433=_[_0xfc64('0x28')]({},_0x241433,_0x21e03a['options']);return _0x32b0f7[_0xfc64('0x35')](_0x241433);}})[_0xfc64('0xe')](function(_0x10d422){if(_0x10d422){_0x5ef4ea=_0x10d422[_0xfc64('0x20')];if(!_0x21e03a[_0xfc64('0x1c')]['hasOwnProperty'](_0xfc64('0x22'))){_0x241433[_0xfc64('0xb')]=qs[_0xfc64('0xb')](_0x21e03a[_0xfc64('0x1c')]['limit']);_0x241433['offset']=qs[_0xfc64('0x9')](_0x21e03a['query']['offset']);}return _0x32b0f7[_0xfc64('0x35')](_0x241433);}})[_0xfc64('0xe')](function(_0x2079b6){if(_0x2079b6){return _0x2079b6?{'count':_0x5ef4ea,'rows':_0x2079b6}:null;}})[_0xfc64('0xe')](respondWithResult(_0x54b3ab,null))[_0xfc64('0x2c')](handleError(_0x54b3ab,null));};exports['addConfiguration']=function(_0x1c8d67,_0x47bbd6){if(_0x1c8d67[_0xfc64('0x33')]['id']){delete _0x1c8d67[_0xfc64('0x33')]['id'];}return db[_0xfc64('0x15')]['findOne']({'where':{'id':_0x1c8d67[_0xfc64('0x2e')]['id']}})[_0xfc64('0xe')](handleEntityNotFound(_0x47bbd6,null))['then'](function(_0x49c48){if(_0x49c48){_0x1c8d67[_0xfc64('0x33')][_0xfc64('0x38')]=_0x49c48['id'];_0x1c8d67[_0xfc64('0x33')][_0xfc64('0x39')]=integrations[_0xfc64('0x3a')](_0x1c8d67[_0xfc64('0x33')][_0xfc64('0x3b')],_0x1c8d67[_0xfc64('0x33')][_0xfc64('0x18')]);_0x1c8d67[_0xfc64('0x33')][_0xfc64('0x3c')]=integrations[_0xfc64('0x3d')](_0x1c8d67[_0xfc64('0x33')][_0xfc64('0x3b')],_0x1c8d67[_0xfc64('0x33')][_0xfc64('0x18')]);return db[_0xfc64('0x37')][_0xfc64('0x32')](_0x1c8d67[_0xfc64('0x33')],{'include':[{'model':db[_0xfc64('0x3e')],'as':_0xfc64('0x39')},{'model':db[_0xfc64('0x3e')],'as':_0xfc64('0x3c')}]});}return null;})[_0xfc64('0xe')](respondWithResult(_0x47bbd6,null))[_0xfc64('0x2c')](handleError(_0x47bbd6,null));};function sanitizeRemoteUri(_0xd403a9){var _0x4df6d2=_0xd403a9['slice'](-0x1);if(_0x4df6d2==='/')return _0xd403a9[_0xfc64('0x3f')](0x0,_0xd403a9[_0xfc64('0x40')](_0x4df6d2));return _0xd403a9;}function getWebApiUrl(_0x5cd30e){return util[_0xfc64('0x41')]('%s/api/data/v9.0/',_0x5cd30e);}exports[_0xfc64('0x42')]=function(_0x3cb091,_0x43a7b8){var _0x158a6d=_0x3cb091['query'][_0xfc64('0x43')];var _0x5bf1d7=_0x158a6d===_0xfc64('0x44')?'Incident':'PhoneCall';var _0x314cc4='';var _0x37fa79='';var _0x6c8370='';var _0x1685f2='';var _0x320afb='';var _0xae1189='';var _0x44d8e5='';var _0x561c11='';var _0x3f5b19=[_0xfc64('0x45'),_0xfc64('0x46'),_0xfc64('0x47'),_0xfc64('0x48'),_0xfc64('0x49'),_0xfc64('0x4a'),_0xfc64('0x4b'),_0xfc64('0x4c'),'directioncode','phonecall_activity_parties'];var _0x3469b2=[_0xfc64('0x4d'),_0xfc64('0x4e'),_0xfc64('0x4f'),_0xfc64('0x50'),_0xfc64('0x51'),'contactidyominame',_0xfc64('0x52'),_0xfc64('0x53'),_0xfc64('0x54'),_0xfc64('0x55'),_0xfc64('0x56'),_0xfc64('0x57'),_0xfc64('0x58'),_0xfc64('0x59'),'createdonbehalfbyyominame',_0xfc64('0x5a'),_0xfc64('0x5b'),_0xfc64('0x5c'),_0xfc64('0x5d'),_0xfc64('0x5e'),_0xfc64('0x5f'),_0xfc64('0x60'),_0xfc64('0x61'),'exchangerate',_0xfc64('0x62'),'followupby',_0xfc64('0x63'),_0xfc64('0x64'),_0xfc64('0x65'),_0xfc64('0x66'),'masteridname',_0xfc64('0x67'),'modifiedbyexternalpartyyominame',_0xfc64('0x68'),_0xfc64('0x69'),'modifiedon','modifiedonbehalfbyname',_0xfc64('0x6a'),_0xfc64('0x6b'),_0xfc64('0x6c'),_0xfc64('0x6d'),_0xfc64('0x6e'),_0xfc64('0x6f'),_0xfc64('0x70'),_0xfc64('0x71'),_0xfc64('0x72'),_0xfc64('0x73'),_0xfc64('0x74'),_0xfc64('0x75'),_0xfc64('0x76'),'productidname','productserialnumber','resolveby','resolvebykpiidname',_0xfc64('0x77'),_0xfc64('0x78'),_0xfc64('0x79'),_0xfc64('0x7a'),_0xfc64('0x7b'),_0xfc64('0x7c'),'socialprofileidname','statecode',_0xfc64('0x7d'),'subjectidname',_0xfc64('0x7e'),_0xfc64('0x7f'),_0xfc64('0x80'),_0xfc64('0x81'),_0xfc64('0x82'),_0xfc64('0x83')];var _0x5b224d=_0x3f5b19['concat'](_0x3469b2);return db[_0xfc64('0x15')][_0xfc64('0x36')]({'where':{'id':_0x3cb091[_0xfc64('0x2e')]['id']},'attributes':['id',_0xfc64('0x84'),_0xfc64('0x85'),_0xfc64('0x86'),_0xfc64('0x87'),'clientId',_0xfc64('0x88'),_0xfc64('0x89')],'include':[{'model':db[_0xfc64('0x8a')],'as':_0xfc64('0x8a'),'attributes':['id','data5',_0xfc64('0x8b')]}]})[_0xfc64('0xe')](handleEntityNotFound(_0x43a7b8,null))[_0xfc64('0xe')](function(_0x27cde2){if(_0x27cde2){if(_0x27cde2[_0xfc64('0x89')]){_0x27cde2[_0xfc64('0x8c')]=_0x27cde2[_0xfc64('0x8a')][_0xfc64('0x8d')];_0x561c11=sanitizeRemoteUri(_0x27cde2[_0xfc64('0x8a')][_0xfc64('0x8b')]);_0x44d8e5=getWebApiUrl(_0x561c11);return _0x27cde2;}_0x561c11=sanitizeRemoteUri(_0x27cde2[_0xfc64('0x86')]);_0x44d8e5=getWebApiUrl(_0x561c11);var _0x2cc1fb={'method':'POST','uri':_0xfc64('0x8e')+_0x27cde2[_0xfc64('0x87')]+'/oauth2/token','form':{'client_id':_0x27cde2[_0xfc64('0x8f')],'resource':_0x561c11,'username':_0x27cde2['username'],'password':_0x27cde2[_0xfc64('0x85')],'grant_type':_0xfc64('0x85'),'client_secret':_0x27cde2[_0xfc64('0x88')]},'json':!![]};return rp(_0x2cc1fb);}})[_0xfc64('0xe')](function(_0x193e03){_0xae1189=_0x193e03[_0xfc64('0x8c')];var _0xfc99d6={'method':_0xfc64('0x90'),'uri':encodeURI(_0x44d8e5+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x5bf1d7+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xae1189,'If-None-Match':null,'OData-Version':_0xfc64('0x91')},'json':!![]};return rp(_0xfc99d6);})[_0xfc64('0xe')](function(_0xc76e1){var _0x58f659=_0xc76e1[_0xfc64('0x92')][0x0];var _0x4e5464=_0x58f659[_0xfc64('0x93')];var _0x50e2d7={'method':_0xfc64('0x90'),'uri':_0x44d8e5+_0xfc64('0x94')+_0x4e5464+_0xfc64('0x95'),'headers':{'Authorization':'Bearer\x20'+_0xae1189,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x50e2d7);})[_0xfc64('0xe')](function(_0x4b00ac){_0x314cc4=_0x4b00ac;_0x37fa79=_0x314cc4[_0xfc64('0x96')];_0x37fa79=_[_0xfc64('0x97')](_0x37fa79,function(_0x1f4f78){return!_0x5b224d['includes'](_0x1f4f78[_0xfc64('0x98')]);});var _0x315239=[];var _0x19a368=[];_0x37fa79[_0xfc64('0x99')](function(_0x5d6956){if(_0x5d6956[_0xfc64('0x9a')]){var _0x4553b6=_0x5d6956[_0xfc64('0x9a')][_0xfc64('0x3f')](_0x5d6956[_0xfc64('0x9a')]['lastIndexOf']('.')+0x1);if(_0x4553b6===_0xfc64('0x9b')){_0x315239['push'](getSelectList(_0x44d8e5,_0x158a6d,_0x19a368,_0x314cc4['MetadataId'],_0x5d6956['MetadataId'],_0xae1189));}}});return Promise[_0xfc64('0x9c')](_0x315239);})[_0xfc64('0xe')](function(_0x159757){_0x6c8370=_0x159757[0x0];var _0x479ce5=[];var _0x51b95d=[];_0x37fa79[_0xfc64('0x99')](function(_0x5dc5eb){if(!_[_0xfc64('0x9d')](_0x5dc5eb[_0xfc64('0x9a')])){var _0x152e14=_0x5dc5eb[_0xfc64('0x9a')][_0xfc64('0x3f')](_0x5dc5eb[_0xfc64('0x9a')][_0xfc64('0x40')]('.')+0x1);if(_0x152e14===_0xfc64('0x9e')){_0x479ce5[_0xfc64('0x9f')](getBooleanList(_0x44d8e5,_0x158a6d,_0x51b95d,_0x314cc4[_0xfc64('0x93')],_0x5dc5eb[_0xfc64('0x93')],_0xae1189));}}});return Promise[_0xfc64('0x9c')](_0x479ce5);})['then'](function(_0x18f2f3){_0x1685f2=_0x18f2f3[0x0];var _0x4673a9=[];var _0xc78496=[];_0x37fa79[_0xfc64('0x99')](function(_0x49a75d){if(_0x49a75d['@odata.type']){var _0x77a2d1=_0x49a75d[_0xfc64('0x9a')][_0xfc64('0x3f')](_0x49a75d['@odata.type'][_0xfc64('0x40')]('.')+0x1);if(_0x77a2d1==='StringAttributeMetadata'||_0x77a2d1===_0xfc64('0xa0')||_0x77a2d1===_0xfc64('0xa1')||_0x77a2d1===_0xfc64('0xa2')||_0x77a2d1===_0xfc64('0xa3')||_0x77a2d1===_0xfc64('0xa4')||_0x77a2d1===_0xfc64('0xa5')||_0x77a2d1===_0xfc64('0xa6')||_0x77a2d1===_0xfc64('0xa7')||_0x77a2d1===_0xfc64('0xa8')){_0x4673a9[_0xfc64('0x9f')](getInputList(_0x44d8e5,_0x158a6d,_0x77a2d1,_0xc78496,_0x314cc4[_0xfc64('0x93')],_0x49a75d['MetadataId'],_0xae1189));}}});return Promise[_0xfc64('0x9c')](_0x4673a9);})[_0xfc64('0xe')](function(_0x34668a){_0x320afb=_0x34668a[0x0];var _0x1612cb=_0x6c8370[_0xfc64('0xa9')](_0x1685f2)[_0xfc64('0xa9')](_0x320afb);var _0x46a2d1={'count':_0x1612cb[_0xfc64('0x20')],'rows':_0x1612cb};return _0x46a2d1;})[_0xfc64('0xe')](respondWithResult(_0x43a7b8,null))['catch'](function(_0x165e93){var _0x547547=_0x3cb091[_0xfc64('0x1c')][_0xfc64('0xaa')]?0x1f4:_0x165e93[_0xfc64('0xab')]||0x1f4;logger['error'](_0x165e93[_0xfc64('0x10')]);delete _0x165e93[_0xfc64('0x11')];if(_0x547547===0x191){_0x547547=0x190;}_0x43a7b8[_0xfc64('0x7')](_0x547547)['send'](_0x3cb091[_0xfc64('0x1c')][_0xfc64('0xaa')]?{'message':_0xfc64('0xac'),'statusCode':_0x165e93[_0xfc64('0xab')]}:_0x165e93);});};function getSelectList(_0x3effe3,_0x218b9f,_0x577c07,_0x13f546,_0x313ba4,_0x950c94){var _0x5acfb0={'method':_0xfc64('0x90'),'uri':_0x3effe3+'EntityDefinitions('+_0x13f546+_0xfc64('0xad')+_0x313ba4+_0xfc64('0xae')+_0xfc64('0xaf'),'headers':{'Authorization':_0xfc64('0xb0')+_0x950c94,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5acfb0)['then'](function(_0x2d0dae){var _0x387c0b=[];var _0x4b920e=_0x2d0dae[_0xfc64('0xb1')][_0xfc64('0xb2')];_0x4b920e[_0xfc64('0x99')](function(_0xadb804){_0x387c0b['push']({'name':_0xadb804[_0xfc64('0xb3')]['UserLocalizedLabel'][_0xfc64('0xb3')],'value':String(_0xadb804[_0xfc64('0xb4')])});});var _0xef945b={'id':_0x218b9f+'_'+_0x2d0dae[_0xfc64('0x98')],'name':_0x2d0dae[_0xfc64('0xb5')][_0xfc64('0xb6')][_0xfc64('0xb3')],'custom':![],'options':_0x387c0b};_0x577c07[_0xfc64('0x9f')](_0xef945b);return _0x577c07;});}function getBooleanList(_0x47e590,_0x20225b,_0x2d0da1,_0x196c68,_0x48aaf2,_0x3b6f57){var _0x52ba8f={'method':'GET','uri':_0x47e590+'EntityDefinitions('+_0x196c68+_0xfc64('0xad')+_0x48aaf2+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xfc64('0xb0')+_0x3b6f57,'If-None-Match':null,'OData-Version':_0xfc64('0x91')},'json':!![]};return rp(_0x52ba8f)[_0xfc64('0xe')](function(_0x141ead){var _0xc8c970=[];_0xc8c970[_0xfc64('0x9f')]({'name':_0x141ead[_0xfc64('0xb1')][_0xfc64('0xb7')]['Label'][_0xfc64('0xb6')][_0xfc64('0xb3')],'value':_0xfc64('0xb8')},{'name':_0x141ead[_0xfc64('0xb1')]['FalseOption'][_0xfc64('0xb3')][_0xfc64('0xb6')]['Label'],'value':_0xfc64('0xb9')});var _0x8637ca={'id':_0x20225b+'_'+_0x141ead[_0xfc64('0x98')],'name':_0x141ead[_0xfc64('0xb5')][_0xfc64('0xb6')]['Label'],'custom':![],'options':_0xc8c970};_0x2d0da1[_0xfc64('0x9f')](_0x8637ca);return _0x2d0da1;});}function getInputList(_0x391344,_0x23c707,_0x4b434a,_0x4e5b48,_0x3d4fa6,_0x17c13c,_0x188535){var _0xc690a6={'method':_0xfc64('0x90'),'uri':_0x391344+_0xfc64('0x94')+_0x3d4fa6+_0xfc64('0xad')+_0x17c13c+_0xfc64('0xba')+_0x4b434a+_0xfc64('0xbb'),'headers':{'Authorization':_0xfc64('0xb0')+_0x188535,'If-None-Match':null,'OData-Version':_0xfc64('0x91')},'json':!![]};return rp(_0xc690a6)['then'](function(_0x37d248){var _0x548431={'id':_0x23c707+'_'+_0x37d248[_0xfc64('0x98')],'name':_0x37d248[_0xfc64('0xb5')][_0xfc64('0xb6')]?_0x37d248['DisplayName'][_0xfc64('0xb6')][_0xfc64('0xb3')]:_0x37d248[_0xfc64('0x98')],'custom':![],'options':[]};_0x4e5b48[_0xfc64('0x9f')](_0x548431);return _0x4e5b48;});} \ No newline at end of file +var _0xf4d2=['POST','/oauth2/token','clientId','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','forEach','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','limit','count','set','Content-Range','update','then','sendStatus','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','model','query','keys','intersection','fields','attributes','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','rawAttributes','length','find','body','params','destroy','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','create','Dynamics365Field','substring','lastIndexOf','getFields','ticketType','incident','Incident','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','sentimentvalue','socialprofileidname','statecode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','concat','findOne','username','password','remoteUri','tenantId','modernAuthentication','CloudProvider','data5','data7'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0xf4d2,0x1a3));var _0x2f4d=function(_0x51851d,_0x53b527){_0x51851d=_0x51851d-0x0;var _0x3aafd1=_0xf4d2[_0x51851d];return _0x3aafd1;};'use strict';var rp=require(_0x2f4d('0x0'));var util=require(_0x2f4d('0x1'));var _=require(_0x2f4d('0x2'));var qs=require(_0x2f4d('0x3'));var logger=require(_0x2f4d('0x4'))(_0x2f4d('0x5'));var db=require(_0x2f4d('0x6'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x3ddb16,_0x4d9dfb){_0x4d9dfb=_0x4d9dfb||0xc8;return function(_0x10e728){if(_0x10e728){return _0x3ddb16[_0x2f4d('0x7')](_0x4d9dfb)[_0x2f4d('0x8')](_0x10e728);}};}function respondWithFilteredResult(_0x70aaf8,_0x5513d3){return function(_0x117f8e){if(_0x117f8e){var _0xe1a84e=typeof _0x5513d3[_0x2f4d('0x9')]==='undefined'&&typeof _0x5513d3[_0x2f4d('0xa')]==='undefined';var _0x435209=_0x117f8e['count'];var _0x1e1f9e=_0xe1a84e?0x0:_0x5513d3['offset'];var _0x2f49e6=_0xe1a84e?_0x117f8e[_0x2f4d('0xb')]:_0x5513d3[_0x2f4d('0x9')]+_0x5513d3[_0x2f4d('0xa')];var _0x5d8fba;if(_0x2f49e6>=_0x435209){_0x2f49e6=_0x435209;_0x5d8fba=0xc8;}else{_0x5d8fba=0xce;}_0x70aaf8[_0x2f4d('0x7')](_0x5d8fba);return _0x70aaf8[_0x2f4d('0xc')](_0x2f4d('0xd'),_0x1e1f9e+'-'+_0x2f49e6+'/'+_0x435209)[_0x2f4d('0x8')](_0x117f8e);}return null;};}function saveUpdates(_0x140846){return function(_0xeb619){if(_0xeb619){return _0xeb619[_0x2f4d('0xe')](_0x140846)[_0x2f4d('0xf')](function(_0xe003cc){return _0xe003cc;});}return null;};}function removeEntity(_0x227a07){return function(_0x38939e){if(_0x38939e){return _0x38939e['destroy']()[_0x2f4d('0xf')](function(){_0x227a07['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ecf8a){return function(_0x115594){if(!_0x115594){_0x3ecf8a[_0x2f4d('0x10')](0x194);}return _0x115594;};}function handleError(_0x4557da,_0x5aa3bc){_0x5aa3bc=_0x5aa3bc||0x1f4;return function(_0x41c577){logger['error'](_0x41c577[_0x2f4d('0x11')]);if(_0x41c577[_0x2f4d('0x12')]){delete _0x41c577[_0x2f4d('0x12')];}_0x4557da['status'](_0x5aa3bc)[_0x2f4d('0x13')](_0x41c577);};}exports[_0x2f4d('0x14')]=function(_0x36abaa,_0x16b26d){var _0x130d03={},_0x288e41={},_0x271e32={'count':0x0,'rows':[]};var _0x20bd8c=_[_0x2f4d('0x15')](db[_0x2f4d('0x16')]['rawAttributes'],function(_0x2c5398){return{'name':_0x2c5398[_0x2f4d('0x17')],'type':_0x2c5398[_0x2f4d('0x18')][_0x2f4d('0x19')]};});_0x288e41[_0x2f4d('0x1a')]=_[_0x2f4d('0x15')](_0x20bd8c,_0x2f4d('0x12'));_0x288e41[_0x2f4d('0x1b')]=_[_0x2f4d('0x1c')](_0x36abaa[_0x2f4d('0x1b')]);_0x288e41['filters']=_[_0x2f4d('0x1d')](_0x288e41['model'],_0x288e41[_0x2f4d('0x1b')]);_0x130d03['attributes']=_['intersection'](_0x288e41[_0x2f4d('0x1a')],qs[_0x2f4d('0x1e')](_0x36abaa[_0x2f4d('0x1b')]['fields']));_0x130d03[_0x2f4d('0x1f')]=_0x130d03[_0x2f4d('0x1f')]['length']?_0x130d03[_0x2f4d('0x1f')]:_0x288e41[_0x2f4d('0x1a')];if(!_0x36abaa['query']['hasOwnProperty']('nolimit')){_0x130d03[_0x2f4d('0xa')]=qs[_0x2f4d('0xa')](_0x36abaa[_0x2f4d('0x1b')][_0x2f4d('0xa')]);_0x130d03[_0x2f4d('0x9')]=qs[_0x2f4d('0x9')](_0x36abaa[_0x2f4d('0x1b')][_0x2f4d('0x9')]);}_0x130d03[_0x2f4d('0x20')]=qs['sort'](_0x36abaa[_0x2f4d('0x1b')][_0x2f4d('0x21')]);_0x130d03[_0x2f4d('0x22')]=qs[_0x2f4d('0x23')](_[_0x2f4d('0x24')](_0x36abaa[_0x2f4d('0x1b')],_0x288e41[_0x2f4d('0x23')]),_0x20bd8c);if(_0x36abaa[_0x2f4d('0x1b')][_0x2f4d('0x25')]){_0x130d03[_0x2f4d('0x22')]=_['merge'](_0x130d03['where'],{'$or':_['map'](_0x20bd8c,function(_0x27999c){if(_0x27999c[_0x2f4d('0x18')]!==_0x2f4d('0x26')){var _0x52927c={};_0x52927c[_0x27999c[_0x2f4d('0x12')]]={'$like':'%'+_0x36abaa[_0x2f4d('0x1b')][_0x2f4d('0x25')]+'%'};return _0x52927c;}})});}_0x130d03=_[_0x2f4d('0x27')]({},_0x130d03,_0x36abaa[_0x2f4d('0x28')]);var _0x3c90a9={'where':_0x130d03[_0x2f4d('0x22')]};return db['Dynamics365Account']['count'](_0x3c90a9)['then'](function(_0x54ef69){_0x271e32[_0x2f4d('0xb')]=_0x54ef69;if(_0x36abaa[_0x2f4d('0x1b')][_0x2f4d('0x29')]){_0x130d03[_0x2f4d('0x2a')]=[{'all':!![]}];}return db[_0x2f4d('0x16')]['findAll'](_0x130d03);})[_0x2f4d('0xf')](function(_0x3e9958){_0x271e32[_0x2f4d('0x2b')]=_0x3e9958;return _0x271e32;})[_0x2f4d('0xf')](respondWithFilteredResult(_0x16b26d,_0x130d03))[_0x2f4d('0x2c')](handleError(_0x16b26d,null));};exports[_0x2f4d('0x2d')]=function(_0x4029e7,_0x5af3dd){var _0x19e958={'raw':![],'where':{'id':_0x4029e7['params']['id']}},_0x1d4600={};_0x1d4600[_0x2f4d('0x1a')]=_[_0x2f4d('0x1c')](db[_0x2f4d('0x16')][_0x2f4d('0x2e')]);_0x1d4600[_0x2f4d('0x1b')]=_[_0x2f4d('0x1c')](_0x4029e7[_0x2f4d('0x1b')]);_0x1d4600['filters']=_[_0x2f4d('0x1d')](_0x1d4600[_0x2f4d('0x1a')],_0x1d4600['query']);_0x19e958[_0x2f4d('0x1f')]=_[_0x2f4d('0x1d')](_0x1d4600[_0x2f4d('0x1a')],qs[_0x2f4d('0x1e')](_0x4029e7['query'][_0x2f4d('0x1e')]));_0x19e958[_0x2f4d('0x1f')]=_0x19e958[_0x2f4d('0x1f')][_0x2f4d('0x2f')]?_0x19e958['attributes']:_0x1d4600['model'];if(_0x4029e7[_0x2f4d('0x1b')][_0x2f4d('0x29')]){_0x19e958[_0x2f4d('0x2a')]=[{'all':!![]}];}_0x19e958=_[_0x2f4d('0x27')]({},_0x19e958,_0x4029e7[_0x2f4d('0x28')]);return db[_0x2f4d('0x16')][_0x2f4d('0x30')](_0x19e958)[_0x2f4d('0xf')](handleEntityNotFound(_0x5af3dd,null))[_0x2f4d('0xf')](respondWithResult(_0x5af3dd,null))['catch'](handleError(_0x5af3dd,null));};exports['create']=function(_0x1928ce,_0x24864b){return db[_0x2f4d('0x16')]['create'](_0x1928ce[_0x2f4d('0x31')],{})[_0x2f4d('0xf')](respondWithResult(_0x24864b,0xc9))['catch'](handleError(_0x24864b,null));};exports[_0x2f4d('0xe')]=function(_0x3ca13e,_0xe8c623){if(_0x3ca13e['body']['id']){delete _0x3ca13e[_0x2f4d('0x31')]['id'];}return db[_0x2f4d('0x16')][_0x2f4d('0x30')]({'where':{'id':_0x3ca13e[_0x2f4d('0x32')]['id']}})[_0x2f4d('0xf')](handleEntityNotFound(_0xe8c623,null))[_0x2f4d('0xf')](saveUpdates(_0x3ca13e[_0x2f4d('0x31')],null))['then'](respondWithResult(_0xe8c623,null))[_0x2f4d('0x2c')](handleError(_0xe8c623,null));};exports[_0x2f4d('0x33')]=function(_0xcc8b5,_0x5e1125){return db[_0x2f4d('0x16')][_0x2f4d('0x30')]({'where':{'id':_0xcc8b5['params']['id']}})[_0x2f4d('0xf')](handleEntityNotFound(_0x5e1125,null))[_0x2f4d('0xf')](removeEntity(_0x5e1125,null))[_0x2f4d('0x2c')](handleError(_0x5e1125,null));};exports[_0x2f4d('0x34')]=function(_0x5b5011,_0x3517ee){var _0x1798b3={};var _0x484ec5={};var _0x584375;var _0x258abe;return db[_0x2f4d('0x16')]['findOne']({'where':{'id':_0x5b5011['params']['id']}})[_0x2f4d('0xf')](handleEntityNotFound(_0x3517ee,null))[_0x2f4d('0xf')](function(_0x5c3034){if(_0x5c3034){_0x584375=_0x5c3034;_0x484ec5['model']=_[_0x2f4d('0x1c')](db['Dynamics365Configuration'][_0x2f4d('0x2e')]);_0x484ec5[_0x2f4d('0x1b')]=_[_0x2f4d('0x1c')](_0x5b5011[_0x2f4d('0x1b')]);_0x484ec5['filters']=_[_0x2f4d('0x1d')](_0x484ec5[_0x2f4d('0x1a')],_0x484ec5['query']);_0x1798b3[_0x2f4d('0x1f')]=_[_0x2f4d('0x1d')](_0x484ec5[_0x2f4d('0x1a')],qs[_0x2f4d('0x1e')](_0x5b5011[_0x2f4d('0x1b')][_0x2f4d('0x1e')]));_0x1798b3[_0x2f4d('0x1f')]=_0x1798b3[_0x2f4d('0x1f')][_0x2f4d('0x2f')]?_0x1798b3[_0x2f4d('0x1f')]:_0x484ec5[_0x2f4d('0x1a')];_0x1798b3[_0x2f4d('0x20')]=qs[_0x2f4d('0x21')](_0x5b5011['query']['sort']);_0x1798b3[_0x2f4d('0x22')]=qs[_0x2f4d('0x23')](_[_0x2f4d('0x24')](_0x5b5011[_0x2f4d('0x1b')],_0x484ec5[_0x2f4d('0x23')]));if(_0x5b5011[_0x2f4d('0x1b')][_0x2f4d('0x25')]){_0x1798b3[_0x2f4d('0x22')]=_[_0x2f4d('0x27')](_0x1798b3[_0x2f4d('0x22')],{'$or':_[_0x2f4d('0x15')](_0x1798b3['attributes'],function(_0x591838){var _0x146d40={};_0x146d40[_0x591838]={'$like':'%'+_0x5b5011[_0x2f4d('0x1b')][_0x2f4d('0x25')]+'%'};return _0x146d40;})});}_0x1798b3=_[_0x2f4d('0x27')]({},_0x1798b3,_0x5b5011[_0x2f4d('0x28')]);return _0x584375[_0x2f4d('0x34')](_0x1798b3);}})[_0x2f4d('0xf')](function(_0x111fb5){if(_0x111fb5){_0x258abe=_0x111fb5[_0x2f4d('0x2f')];if(!_0x5b5011[_0x2f4d('0x1b')]['hasOwnProperty']('nolimit')){_0x1798b3[_0x2f4d('0xa')]=qs[_0x2f4d('0xa')](_0x5b5011[_0x2f4d('0x1b')][_0x2f4d('0xa')]);_0x1798b3[_0x2f4d('0x9')]=qs[_0x2f4d('0x9')](_0x5b5011['query'][_0x2f4d('0x9')]);}return _0x584375[_0x2f4d('0x34')](_0x1798b3);}})['then'](function(_0x5efde4){if(_0x5efde4){return _0x5efde4?{'count':_0x258abe,'rows':_0x5efde4}:null;}})[_0x2f4d('0xf')](respondWithResult(_0x3517ee,null))[_0x2f4d('0x2c')](handleError(_0x3517ee,null));};exports[_0x2f4d('0x35')]=function(_0x41f10d,_0x295753){if(_0x41f10d['body']['id']){delete _0x41f10d[_0x2f4d('0x31')]['id'];}return db[_0x2f4d('0x16')]['findOne']({'where':{'id':_0x41f10d[_0x2f4d('0x32')]['id']}})[_0x2f4d('0xf')](handleEntityNotFound(_0x295753,null))[_0x2f4d('0xf')](function(_0x3700f9){if(_0x3700f9){_0x41f10d['body'][_0x2f4d('0x36')]=_0x3700f9['id'];_0x41f10d['body'][_0x2f4d('0x37')]=integrations[_0x2f4d('0x38')](_0x41f10d['body'][_0x2f4d('0x39')],_0x41f10d[_0x2f4d('0x31')]['type']);_0x41f10d[_0x2f4d('0x31')][_0x2f4d('0x3a')]=integrations[_0x2f4d('0x3b')](_0x41f10d['body'][_0x2f4d('0x39')],_0x41f10d[_0x2f4d('0x31')]['type']);return db[_0x2f4d('0x3c')][_0x2f4d('0x3d')](_0x41f10d[_0x2f4d('0x31')],{'include':[{'model':db[_0x2f4d('0x3e')],'as':'Subjects'},{'model':db[_0x2f4d('0x3e')],'as':_0x2f4d('0x3a')}]});}return null;})[_0x2f4d('0xf')](respondWithResult(_0x295753,null))[_0x2f4d('0x2c')](handleError(_0x295753,null));};function sanitizeRemoteUri(_0x3e7e2a){var _0x4b5a86=_0x3e7e2a['slice'](-0x1);if(_0x4b5a86==='/')return _0x3e7e2a[_0x2f4d('0x3f')](0x0,_0x3e7e2a[_0x2f4d('0x40')](_0x4b5a86));return _0x3e7e2a;}function getWebApiUrl(_0x84d8ce){return util['format']('%s/api/data/v9.0/',_0x84d8ce);}exports[_0x2f4d('0x41')]=function(_0x4e4dbe,_0x5a3340){var _0x4c370d=_0x4e4dbe[_0x2f4d('0x1b')][_0x2f4d('0x42')];var _0x3c759b=_0x4c370d===_0x2f4d('0x43')?_0x2f4d('0x44'):'PhoneCall';var _0x56e0db='';var _0x1d674a='';var _0x351be2='';var _0x5cc58d='';var _0x909e81='';var _0x54a5d2='';var _0x230548='';var _0x621e6c='';var _0x5f50bc=[_0x2f4d('0x45'),_0x2f4d('0x46'),_0x2f4d('0x47'),_0x2f4d('0x48'),_0x2f4d('0x49'),_0x2f4d('0x4a'),'phonenumber',_0x2f4d('0x4b'),_0x2f4d('0x4c'),_0x2f4d('0x4d')];var _0x338674=[_0x2f4d('0x4e'),_0x2f4d('0x4f'),_0x2f4d('0x50'),'billedserviceunits',_0x2f4d('0x51'),_0x2f4d('0x52'),'contractdetailidname','contractidname','createdbyexternalpartyname',_0x2f4d('0x53'),'createdbyname',_0x2f4d('0x54'),_0x2f4d('0x55'),'createdonbehalfbyname',_0x2f4d('0x56'),_0x2f4d('0x57'),_0x2f4d('0x58'),_0x2f4d('0x59'),_0x2f4d('0x5a'),_0x2f4d('0x5b'),_0x2f4d('0x5c'),_0x2f4d('0x5d'),_0x2f4d('0x5e'),_0x2f4d('0x5f'),_0x2f4d('0x60'),_0x2f4d('0x61'),_0x2f4d('0x62'),_0x2f4d('0x63'),_0x2f4d('0x64'),_0x2f4d('0x65'),_0x2f4d('0x66'),_0x2f4d('0x67'),'modifiedbyexternalpartyyominame',_0x2f4d('0x68'),_0x2f4d('0x69'),_0x2f4d('0x6a'),_0x2f4d('0x6b'),_0x2f4d('0x6c'),_0x2f4d('0x6d'),_0x2f4d('0x6e'),'numberofchildincidents',_0x2f4d('0x6f'),'overriddencreatedon',_0x2f4d('0x70'),'owneridtype',_0x2f4d('0x71'),_0x2f4d('0x72'),_0x2f4d('0x73'),_0x2f4d('0x74'),'prioritycodename',_0x2f4d('0x75'),_0x2f4d('0x76'),_0x2f4d('0x77'),_0x2f4d('0x78'),'responseby',_0x2f4d('0x79'),'responsiblecontactidyominame',_0x2f4d('0x7a'),'slainvokedidname','slaname',_0x2f4d('0x7b'),_0x2f4d('0x7c'),'statuscode','subjectidname',_0x2f4d('0x7d'),_0x2f4d('0x7e'),_0x2f4d('0x7f'),_0x2f4d('0x80'),'utcconversiontimezonecode','versionnumber'];var _0xe8a2a3=_0x5f50bc[_0x2f4d('0x81')](_0x338674);return db['Dynamics365Account'][_0x2f4d('0x82')]({'where':{'id':_0x4e4dbe[_0x2f4d('0x32')]['id']},'attributes':['id',_0x2f4d('0x83'),_0x2f4d('0x84'),_0x2f4d('0x85'),_0x2f4d('0x86'),'clientId','clientSecret',_0x2f4d('0x87')],'include':[{'model':db['CloudProvider'],'as':_0x2f4d('0x88'),'attributes':['id',_0x2f4d('0x89'),_0x2f4d('0x8a')]}]})[_0x2f4d('0xf')](handleEntityNotFound(_0x5a3340,null))[_0x2f4d('0xf')](function(_0x1b5fe9){if(_0x1b5fe9){if(_0x1b5fe9[_0x2f4d('0x87')]){_0x1b5fe9['access_token']=_0x1b5fe9[_0x2f4d('0x88')]['data5'];_0x621e6c=sanitizeRemoteUri(_0x1b5fe9['CloudProvider']['data7']);_0x230548=getWebApiUrl(_0x621e6c);return _0x1b5fe9;}_0x621e6c=sanitizeRemoteUri(_0x1b5fe9[_0x2f4d('0x85')]);_0x230548=getWebApiUrl(_0x621e6c);var _0x39a667={'method':_0x2f4d('0x8b'),'uri':'https://login.microsoftonline.com/'+_0x1b5fe9[_0x2f4d('0x86')]+_0x2f4d('0x8c'),'form':{'client_id':_0x1b5fe9[_0x2f4d('0x8d')],'resource':_0x621e6c,'username':_0x1b5fe9['username'],'password':_0x1b5fe9[_0x2f4d('0x84')],'grant_type':_0x2f4d('0x84'),'client_secret':_0x1b5fe9[_0x2f4d('0x8e')]},'json':!![]};return rp(_0x39a667);}})[_0x2f4d('0xf')](function(_0x573c83){_0x54a5d2=_0x573c83[_0x2f4d('0x8f')];var _0x1490f0={'method':_0x2f4d('0x90'),'uri':encodeURI(_0x230548+_0x2f4d('0x91')+_0x3c759b+'\x27'),'headers':{'Authorization':_0x2f4d('0x92')+_0x54a5d2,'If-None-Match':null,'OData-Version':_0x2f4d('0x93')},'json':!![]};return rp(_0x1490f0);})['then'](function(_0x46f227){var _0x5d531b=_0x46f227[_0x2f4d('0x94')][0x0];var _0x4a7c40=_0x5d531b[_0x2f4d('0x95')];var _0x5a2bee={'method':_0x2f4d('0x90'),'uri':_0x230548+_0x2f4d('0x96')+_0x4a7c40+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x2f4d('0x92')+_0x54a5d2,'If-None-Match':null,'OData-Version':_0x2f4d('0x93')},'json':!![]};return rp(_0x5a2bee);})['then'](function(_0x5c6286){_0x56e0db=_0x5c6286;_0x1d674a=_0x56e0db[_0x2f4d('0x97')];_0x1d674a=_['remove'](_0x1d674a,function(_0x22d437){return!_0xe8a2a3[_0x2f4d('0x98')](_0x22d437[_0x2f4d('0x99')]);});var _0x4fd60e=[];var _0x418e99=[];_0x1d674a['forEach'](function(_0x32e8c5){if(_0x32e8c5[_0x2f4d('0x9a')]){var _0x212f94=_0x32e8c5[_0x2f4d('0x9a')][_0x2f4d('0x3f')](_0x32e8c5[_0x2f4d('0x9a')][_0x2f4d('0x40')]('.')+0x1);if(_0x212f94===_0x2f4d('0x9b')){_0x4fd60e[_0x2f4d('0x9c')](getSelectList(_0x230548,_0x4c370d,_0x418e99,_0x56e0db[_0x2f4d('0x95')],_0x32e8c5[_0x2f4d('0x95')],_0x54a5d2));}}});return Promise[_0x2f4d('0x9d')](_0x4fd60e);})['then'](function(_0x40a34e){_0x351be2=_0x40a34e[0x0];var _0x1f8a7f=[];var _0x530d65=[];_0x1d674a[_0x2f4d('0x9e')](function(_0x377341){if(!_['isNil'](_0x377341[_0x2f4d('0x9a')])){var _0x85c36d=_0x377341[_0x2f4d('0x9a')]['substring'](_0x377341[_0x2f4d('0x9a')]['lastIndexOf']('.')+0x1);if(_0x85c36d===_0x2f4d('0x9f')){_0x1f8a7f['push'](getBooleanList(_0x230548,_0x4c370d,_0x530d65,_0x56e0db[_0x2f4d('0x95')],_0x377341[_0x2f4d('0x95')],_0x54a5d2));}}});return Promise[_0x2f4d('0x9d')](_0x1f8a7f);})[_0x2f4d('0xf')](function(_0x273a83){_0x5cc58d=_0x273a83[0x0];var _0x2ac006=[];var _0x41a90e=[];_0x1d674a[_0x2f4d('0x9e')](function(_0x38bbb4){if(_0x38bbb4[_0x2f4d('0x9a')]){var _0x49dec0=_0x38bbb4[_0x2f4d('0x9a')]['substring'](_0x38bbb4['@odata.type'][_0x2f4d('0x40')]('.')+0x1);if(_0x49dec0===_0x2f4d('0xa0')||_0x49dec0===_0x2f4d('0xa1')||_0x49dec0===_0x2f4d('0xa2')||_0x49dec0===_0x2f4d('0xa3')||_0x49dec0===_0x2f4d('0xa4')||_0x49dec0===_0x2f4d('0xa5')||_0x49dec0===_0x2f4d('0xa6')||_0x49dec0===_0x2f4d('0xa7')||_0x49dec0==='StateAttributeMetadata'||_0x49dec0===_0x2f4d('0xa8')){_0x2ac006['push'](getInputList(_0x230548,_0x4c370d,_0x49dec0,_0x41a90e,_0x56e0db[_0x2f4d('0x95')],_0x38bbb4[_0x2f4d('0x95')],_0x54a5d2));}}});return Promise['all'](_0x2ac006);})[_0x2f4d('0xf')](function(_0x2118b8){_0x909e81=_0x2118b8[0x0];var _0x516618=_0x351be2[_0x2f4d('0x81')](_0x5cc58d)[_0x2f4d('0x81')](_0x909e81);var _0x5d0947={'count':_0x516618[_0x2f4d('0x2f')],'rows':_0x516618};return _0x5d0947;})[_0x2f4d('0xf')](respondWithResult(_0x5a3340,null))[_0x2f4d('0x2c')](function(_0xc56dab){var _0x53869c=_0x4e4dbe[_0x2f4d('0x1b')][_0x2f4d('0xa9')]?0x1f4:_0xc56dab['statusCode']||0x1f4;logger['error'](_0xc56dab[_0x2f4d('0x11')]);delete _0xc56dab[_0x2f4d('0x12')];if(_0x53869c===0x191){_0x53869c=0x190;}_0x5a3340[_0x2f4d('0x7')](_0x53869c)[_0x2f4d('0x13')](_0x4e4dbe[_0x2f4d('0x1b')]['test']?{'message':_0x2f4d('0xaa'),'statusCode':_0xc56dab[_0x2f4d('0xab')]}:_0xc56dab);});};function getSelectList(_0x672731,_0x65b53e,_0x5c1171,_0x1d6442,_0x112357,_0x322738){var _0x1b3b07={'method':_0x2f4d('0x90'),'uri':_0x672731+_0x2f4d('0x96')+_0x1d6442+_0x2f4d('0xac')+_0x112357+_0x2f4d('0xad')+_0x2f4d('0xae'),'headers':{'Authorization':_0x2f4d('0x92')+_0x322738,'If-None-Match':null,'OData-Version':_0x2f4d('0x93')},'json':!![]};return rp(_0x1b3b07)['then'](function(_0x23431e){var _0x1bb94a=[];var _0x295ebd=_0x23431e[_0x2f4d('0xaf')]['Options'];_0x295ebd[_0x2f4d('0x9e')](function(_0x56b13f){_0x1bb94a[_0x2f4d('0x9c')]({'name':_0x56b13f[_0x2f4d('0xb0')][_0x2f4d('0xb1')][_0x2f4d('0xb0')],'value':String(_0x56b13f[_0x2f4d('0xb2')])});});var _0x3fb3c1={'id':_0x65b53e+'_'+_0x23431e[_0x2f4d('0x99')],'name':_0x23431e['DisplayName'][_0x2f4d('0xb1')][_0x2f4d('0xb0')],'custom':![],'options':_0x1bb94a};_0x5c1171[_0x2f4d('0x9c')](_0x3fb3c1);return _0x5c1171;});}function getBooleanList(_0x2e4d10,_0x17fb25,_0x1c9a22,_0x4403ab,_0x55cf1b,_0x126011){var _0x4d8fab={'method':_0x2f4d('0x90'),'uri':_0x2e4d10+_0x2f4d('0x96')+_0x4403ab+_0x2f4d('0xac')+_0x55cf1b+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x2f4d('0x92')+_0x126011,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4d8fab)[_0x2f4d('0xf')](function(_0x50bef5){var _0x2bf0af=[];_0x2bf0af[_0x2f4d('0x9c')]({'name':_0x50bef5[_0x2f4d('0xaf')][_0x2f4d('0xb3')]['Label'][_0x2f4d('0xb1')][_0x2f4d('0xb0')],'value':_0x2f4d('0xb4')},{'name':_0x50bef5[_0x2f4d('0xaf')][_0x2f4d('0xb5')]['Label'][_0x2f4d('0xb1')][_0x2f4d('0xb0')],'value':_0x2f4d('0xb6')});var _0xe31f05={'id':_0x17fb25+'_'+_0x50bef5[_0x2f4d('0x99')],'name':_0x50bef5['DisplayName'][_0x2f4d('0xb1')][_0x2f4d('0xb0')],'custom':![],'options':_0x2bf0af};_0x1c9a22[_0x2f4d('0x9c')](_0xe31f05);return _0x1c9a22;});}function getInputList(_0xf70fd2,_0x5f2704,_0xcc68ce,_0x17704c,_0x3ff5b3,_0x59d255,_0x3171c4){var _0x46ea87={'method':_0x2f4d('0x90'),'uri':_0xf70fd2+_0x2f4d('0x96')+_0x3ff5b3+_0x2f4d('0xac')+_0x59d255+_0x2f4d('0xb7')+_0xcc68ce+_0x2f4d('0xb8'),'headers':{'Authorization':_0x2f4d('0x92')+_0x3171c4,'If-None-Match':null,'OData-Version':_0x2f4d('0x93')},'json':!![]};return rp(_0x46ea87)[_0x2f4d('0xf')](function(_0x35521d){var _0x529fa7={'id':_0x5f2704+'_'+_0x35521d[_0x2f4d('0x99')],'name':_0x35521d[_0x2f4d('0xb9')][_0x2f4d('0xb1')]?_0x35521d['DisplayName']['UserLocalizedLabel']['Label']:_0x35521d[_0x2f4d('0x99')],'custom':![],'options':[]};_0x17704c[_0x2f4d('0x9c')](_0x529fa7);return _0x17704c;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 81c405f..0a1c6f6 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 _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x43def4,_0x49c62e){var _0x5d866b=function(_0x896e25){while(--_0x896e25){_0x43def4['push'](_0x43def4['shift']());}};_0x5d866b(++_0x49c62e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xcb91[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x17021f,_0x5b34e5){var _0x13eedc=function(_0x4c12f8){while(--_0x4c12f8){_0x17021f['push'](_0x17021f['shift']());}};_0x13eedc(++_0x5b34e5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index c270cf5..9ba65a8 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 _0x8017=['GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','limit','map','include','model','catch','ShowDynamics365Account','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x4ed507,_0x5a4c79){var _0x285d74=function(_0x5f1084){while(--_0x5f1084){_0x4ed507['push'](_0x4ed507['shift']());}};_0x285d74(++_0x5a4c79);}(_0x8017,0x99));var _0x7801=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0x8017[_0x1bd323];return _0x13097b;};'use strict';var _=require('lodash');var util=require(_0x7801('0x0'));var moment=require(_0x7801('0x1'));var BPromise=require(_0x7801('0x2'));var rs=require(_0x7801('0x3'));var fs=require('fs');var Redis=require(_0x7801('0x4'));var db=require(_0x7801('0x5'))['db'];var utils=require(_0x7801('0x6'));var logger=require('../../config/logger')(_0x7801('0x7'));var config=require(_0x7801('0x8'));var jayson=require(_0x7801('0x9'));var client=jayson[_0x7801('0xa')][_0x7801('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36552c,_0x29e707,_0x3495ae){return new BPromise(function(_0x7c32b3,_0x3654e2){return client[_0x7801('0xc')](_0x36552c,_0x3495ae)[_0x7801('0xd')](function(_0x3c57ce){logger[_0x7801('0xe')](_0x7801('0xf'),_0x29e707,_0x7801('0x10'));logger[_0x7801('0x11')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x29e707,_0x7801('0x10'),JSON[_0x7801('0x12')](_0x3c57ce));if(_0x3c57ce[_0x7801('0x13')]){if(_0x3c57ce['error']['code']===0x1f4){logger['error'](_0x7801('0xf'),_0x29e707,_0x3c57ce[_0x7801('0x13')]['message']);return _0x3654e2(_0x3c57ce[_0x7801('0x13')][_0x7801('0x14')]);}logger[_0x7801('0x13')](_0x7801('0xf'),_0x29e707,_0x3c57ce['error'][_0x7801('0x14')]);return _0x7c32b3(_0x3c57ce[_0x7801('0x13')][_0x7801('0x14')]);}else{logger[_0x7801('0xe')](_0x7801('0xf'),_0x29e707,_0x7801('0x10'));_0x7c32b3(_0x3c57ce[_0x7801('0x15')][_0x7801('0x14')]);}})['catch'](function(_0x2707a3){logger['error'](_0x7801('0xf'),_0x29e707,_0x2707a3);_0x3654e2(_0x2707a3);});});}exports[_0x7801('0x16')]=function(_0x53366a){var _0x51bf00=this;return new Promise(function(_0x13750b,_0x578799){return db[_0x7801('0x17')][_0x7801('0x18')]({'raw':_0x53366a[_0x7801('0x19')]?_0x53366a[_0x7801('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x53366a[_0x7801('0x19')]?_0x53366a[_0x7801('0x19')][_0x7801('0x1a')]||null:null,'attributes':_0x53366a['options']?_0x53366a[_0x7801('0x19')][_0x7801('0x1b')]||null:null,'limit':_0x53366a['options']?_0x53366a[_0x7801('0x19')][_0x7801('0x1c')]||null:null,'include':_0x53366a[_0x7801('0x19')]?_0x53366a[_0x7801('0x19')]['include']?_[_0x7801('0x1d')](_0x53366a[_0x7801('0x19')][_0x7801('0x1e')],function(_0x6e8b6f){return{'model':db[_0x6e8b6f['model']],'as':_0x6e8b6f['as'],'attributes':_0x6e8b6f[_0x7801('0x1b')],'include':_0x6e8b6f['include']?_[_0x7801('0x1d')](_0x6e8b6f[_0x7801('0x1e')],function(_0x11866d){return{'model':db[_0x11866d[_0x7801('0x1f')]],'as':_0x11866d['as'],'attributes':_0x11866d['attributes'],'include':_0x11866d[_0x7801('0x1e')]?_[_0x7801('0x1d')](_0x11866d['include'],function(_0x4fdf7e){return{'model':db[_0x4fdf7e[_0x7801('0x1f')]],'as':_0x4fdf7e['as'],'attributes':_0x4fdf7e[_0x7801('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7801('0xd')](function(_0x40908e){logger['info'](_0x7801('0x16'),_0x53366a);logger['debug']('GetDynamics365Account',_0x53366a,JSON[_0x7801('0x12')](_0x40908e));_0x13750b(_0x40908e);})[_0x7801('0x20')](function(_0x560e71){logger[_0x7801('0x13')](_0x7801('0x16'),_0x560e71[_0x7801('0x14')],_0x53366a);_0x578799(_0x51bf00[_0x7801('0x13')](0x1f4,_0x560e71[_0x7801('0x14')]));});});};exports[_0x7801('0x21')]=function(_0x35e156){var _0x3ab1c8=this;return new Promise(function(_0x33cb88,_0x521060){return db[_0x7801('0x17')]['find']({'raw':_0x35e156[_0x7801('0x19')]?_0x35e156[_0x7801('0x19')][_0x7801('0x22')]===undefined?!![]:![]:!![],'where':_0x35e156[_0x7801('0x19')]?_0x35e156[_0x7801('0x19')][_0x7801('0x1a')]||null:null,'attributes':_0x35e156[_0x7801('0x19')]?_0x35e156[_0x7801('0x19')]['attributes']||null:null,'include':_0x35e156[_0x7801('0x19')]?_0x35e156['options'][_0x7801('0x1e')]?_[_0x7801('0x1d')](_0x35e156[_0x7801('0x19')][_0x7801('0x1e')],function(_0x1545e5){return{'model':db[_0x1545e5[_0x7801('0x1f')]],'as':_0x1545e5['as'],'attributes':_0x1545e5[_0x7801('0x1b')],'include':_0x1545e5[_0x7801('0x1e')]?_[_0x7801('0x1d')](_0x1545e5[_0x7801('0x1e')],function(_0x13254f){return{'model':db[_0x13254f[_0x7801('0x1f')]],'as':_0x13254f['as'],'attributes':_0x13254f[_0x7801('0x1b')],'include':_0x13254f[_0x7801('0x1e')]?_['map'](_0x13254f[_0x7801('0x1e')],function(_0x4a2aa2){return{'model':db[_0x4a2aa2[_0x7801('0x1f')]],'as':_0x4a2aa2['as'],'attributes':_0x4a2aa2[_0x7801('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f9b2d){logger[_0x7801('0xe')](_0x7801('0x21'),_0x35e156);logger[_0x7801('0x11')](_0x7801('0x21'),_0x35e156,JSON[_0x7801('0x12')](_0x3f9b2d));_0x33cb88(_0x3f9b2d);})['catch'](function(_0x2b162d){logger[_0x7801('0x13')](_0x7801('0x21'),_0x2b162d[_0x7801('0x14')],_0x35e156);_0x521060(_0x3ab1c8[_0x7801('0x13')](0x1f4,_0x2b162d['message']));});});}; \ No newline at end of file +var _0xe9dc=['rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','stringify','error','code','message','result','catch','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','info','debug','GetDynamics365Account','ShowDynamics365Account','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c9b93,_0x5e45ef){var _0xf6eb8e=function(_0x4a1c41){while(--_0x4a1c41){_0x1c9b93['push'](_0x1c9b93['shift']());}};_0xf6eb8e(++_0x5e45ef);}(_0xe9dc,0x1d6));var _0xce9d=function(_0x5b77f2,_0x1c3dc9){_0x5b77f2=_0x5b77f2-0x0;var _0x1180fd=_0xe9dc[_0x5b77f2];return _0x1180fd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xce9d('0x0'));var BPromise=require('bluebird');var rs=require(_0xce9d('0x1'));var fs=require('fs');var Redis=require(_0xce9d('0x2'));var db=require(_0xce9d('0x3'))['db'];var utils=require(_0xce9d('0x4'));var logger=require(_0xce9d('0x5'))(_0xce9d('0x6'));var config=require(_0xce9d('0x7'));var jayson=require(_0xce9d('0x8'));var client=jayson[_0xce9d('0x9')][_0xce9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c3e34,_0x1ab2fd,_0x513827){return new BPromise(function(_0x5cb4ed,_0x454b9f){return client[_0xce9d('0xb')](_0x2c3e34,_0x513827)[_0xce9d('0xc')](function(_0x5a6dbb){logger['info'](_0xce9d('0xd'),_0x1ab2fd,'request\x20sent');logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1ab2fd,'request\x20sent',JSON[_0xce9d('0xe')](_0x5a6dbb));if(_0x5a6dbb[_0xce9d('0xf')]){if(_0x5a6dbb['error'][_0xce9d('0x10')]===0x1f4){logger['error'](_0xce9d('0xd'),_0x1ab2fd,_0x5a6dbb[_0xce9d('0xf')][_0xce9d('0x11')]);return _0x454b9f(_0x5a6dbb['error'][_0xce9d('0x11')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1ab2fd,_0x5a6dbb['error'][_0xce9d('0x11')]);return _0x5cb4ed(_0x5a6dbb['error'][_0xce9d('0x11')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x1ab2fd,'request\x20sent');_0x5cb4ed(_0x5a6dbb[_0xce9d('0x12')][_0xce9d('0x11')]);}})[_0xce9d('0x13')](function(_0x55dcb8){logger[_0xce9d('0xf')](_0xce9d('0xd'),_0x1ab2fd,_0x55dcb8);_0x454b9f(_0x55dcb8);});});}exports['GetDynamics365Account']=function(_0x3b0c8d){var _0xa11b26=this;return new Promise(function(_0x3b49d4,_0x140318){return db[_0xce9d('0x14')][_0xce9d('0x15')]({'raw':_0x3b0c8d[_0xce9d('0x16')]?_0x3b0c8d['options'][_0xce9d('0x17')]===undefined?!![]:![]:!![],'where':_0x3b0c8d['options']?_0x3b0c8d[_0xce9d('0x16')][_0xce9d('0x18')]||null:null,'attributes':_0x3b0c8d[_0xce9d('0x16')]?_0x3b0c8d['options'][_0xce9d('0x19')]||null:null,'limit':_0x3b0c8d['options']?_0x3b0c8d[_0xce9d('0x16')]['limit']||null:null,'include':_0x3b0c8d[_0xce9d('0x16')]?_0x3b0c8d[_0xce9d('0x16')][_0xce9d('0x1a')]?_[_0xce9d('0x1b')](_0x3b0c8d[_0xce9d('0x16')][_0xce9d('0x1a')],function(_0xce1166){return{'model':db[_0xce1166[_0xce9d('0x1c')]],'as':_0xce1166['as'],'attributes':_0xce1166[_0xce9d('0x19')],'include':_0xce1166[_0xce9d('0x1a')]?_['map'](_0xce1166['include'],function(_0x3e2388){return{'model':db[_0x3e2388[_0xce9d('0x1c')]],'as':_0x3e2388['as'],'attributes':_0x3e2388[_0xce9d('0x19')],'include':_0x3e2388[_0xce9d('0x1a')]?_[_0xce9d('0x1b')](_0x3e2388[_0xce9d('0x1a')],function(_0x599688){return{'model':db[_0x599688[_0xce9d('0x1c')]],'as':_0x599688['as'],'attributes':_0x599688[_0xce9d('0x19')]};}):[]};}):[]};}):[]:[]})[_0xce9d('0xc')](function(_0x5dc08a){logger[_0xce9d('0x1d')]('GetDynamics365Account',_0x3b0c8d);logger[_0xce9d('0x1e')](_0xce9d('0x1f'),_0x3b0c8d,JSON['stringify'](_0x5dc08a));_0x3b49d4(_0x5dc08a);})[_0xce9d('0x13')](function(_0x23f601){logger[_0xce9d('0xf')]('GetDynamics365Account',_0x23f601[_0xce9d('0x11')],_0x3b0c8d);_0x140318(_0xa11b26[_0xce9d('0xf')](0x1f4,_0x23f601[_0xce9d('0x11')]));});});};exports[_0xce9d('0x20')]=function(_0x31dfd8){var _0x313ff3=this;return new Promise(function(_0x11f59c,_0x53577c){return db[_0xce9d('0x14')][_0xce9d('0x21')]({'raw':_0x31dfd8[_0xce9d('0x16')]?_0x31dfd8['options'][_0xce9d('0x17')]===undefined?!![]:![]:!![],'where':_0x31dfd8[_0xce9d('0x16')]?_0x31dfd8[_0xce9d('0x16')][_0xce9d('0x18')]||null:null,'attributes':_0x31dfd8[_0xce9d('0x16')]?_0x31dfd8['options'][_0xce9d('0x19')]||null:null,'include':_0x31dfd8[_0xce9d('0x16')]?_0x31dfd8['options'][_0xce9d('0x1a')]?_['map'](_0x31dfd8[_0xce9d('0x16')][_0xce9d('0x1a')],function(_0x4b4f97){return{'model':db[_0x4b4f97[_0xce9d('0x1c')]],'as':_0x4b4f97['as'],'attributes':_0x4b4f97[_0xce9d('0x19')],'include':_0x4b4f97[_0xce9d('0x1a')]?_[_0xce9d('0x1b')](_0x4b4f97['include'],function(_0x28a2d4){return{'model':db[_0x28a2d4['model']],'as':_0x28a2d4['as'],'attributes':_0x28a2d4[_0xce9d('0x19')],'include':_0x28a2d4[_0xce9d('0x1a')]?_[_0xce9d('0x1b')](_0x28a2d4[_0xce9d('0x1a')],function(_0x5930b8){return{'model':db[_0x5930b8['model']],'as':_0x5930b8['as'],'attributes':_0x5930b8[_0xce9d('0x19')]};}):[]};}):[]};}):[]:[]})[_0xce9d('0xc')](function(_0x3812a0){logger[_0xce9d('0x1d')](_0xce9d('0x20'),_0x31dfd8);logger['debug']('ShowDynamics365Account',_0x31dfd8,JSON[_0xce9d('0xe')](_0x3812a0));_0x11f59c(_0x3812a0);})['catch'](function(_0x21db4a){logger[_0xce9d('0xf')](_0xce9d('0x20'),_0x21db4a[_0xce9d('0x11')],_0x31dfd8);_0x53577c(_0x313ff3['error'](0x1f4,_0x21db4a[_0xce9d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 965bc9c..3f9f657 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 _0x761c=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x21e102,_0x49c6e4){var _0x9356bb=function(_0x2435c8){while(--_0x2435c8){_0x21e102['push'](_0x21e102['shift']());}};_0x9356bb(++_0x49c6e4);}(_0x761c,0x18a));var _0xc761=function(_0x5149b2,_0x2f1b52){_0x5149b2=_0x5149b2-0x0;var _0x6f2a85=_0x761c[_0x5149b2];return _0x6f2a85;};'use strict';var multer=require(_0xc761('0x0'));var util=require('util');var path=require(_0xc761('0x1'));var timeout=require(_0xc761('0x2'));var express=require('express');var router=express[_0xc761('0x3')]();var fs_extra=require(_0xc761('0x4'));var auth=require(_0xc761('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc761('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xc761('0x7')]('/',auth[_0xc761('0x8')](),controller[_0xc761('0x9')]);router[_0xc761('0x7')](_0xc761('0xa'),auth[_0xc761('0x8')](),controller[_0xc761('0xb')]);router['get'](_0xc761('0xc'),auth[_0xc761('0x8')](),controller[_0xc761('0xd')]);router[_0xc761('0x7')](_0xc761('0xe'),auth[_0xc761('0x8')](),controller[_0xc761('0xf')]);router['get']('/:id/descriptions',auth[_0xc761('0x8')](),controller[_0xc761('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc761('0x11')]);router['put'](_0xc761('0xa'),auth['isAuthenticated'](),controller[_0xc761('0x12')]);router['delete'](_0xc761('0xa'),auth[_0xc761('0x8')](),controller[_0xc761('0x13')]);module[_0xc761('0x14')]=router; \ No newline at end of file +var _0x2f61=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0xc85fbd,_0x21d671){var _0x64f2d9=function(_0x4eb22d){while(--_0x4eb22d){_0xc85fbd['push'](_0xc85fbd['shift']());}};_0x64f2d9(++_0x21d671);}(_0x2f61,0x15c));var _0x12f6=function(_0x396737,_0x1baadb){_0x396737=_0x396737-0x0;var _0x109d41=_0x2f61[_0x396737];return _0x109d41;};'use strict';var multer=require(_0x12f6('0x0'));var util=require(_0x12f6('0x1'));var path=require('path');var timeout=require(_0x12f6('0x2'));var express=require(_0x12f6('0x3'));var router=express[_0x12f6('0x4')]();var fs_extra=require(_0x12f6('0x5'));var auth=require(_0x12f6('0x6'));var interaction=require(_0x12f6('0x7'));var config=require(_0x12f6('0x8'));var controller=require(_0x12f6('0x9'));router[_0x12f6('0xa')]('/',auth[_0x12f6('0xb')](),controller[_0x12f6('0xc')]);router[_0x12f6('0xa')](_0x12f6('0xd'),auth[_0x12f6('0xb')](),controller[_0x12f6('0xe')]);router[_0x12f6('0xa')](_0x12f6('0xf'),auth[_0x12f6('0xb')](),controller[_0x12f6('0x10')]);router['get'](_0x12f6('0x11'),auth[_0x12f6('0xb')](),controller[_0x12f6('0x12')]);router['get']('/:id/descriptions',auth[_0x12f6('0xb')](),controller[_0x12f6('0x13')]);router[_0x12f6('0x14')]('/',auth['isAuthenticated'](),controller[_0x12f6('0x15')]);router[_0x12f6('0x16')](_0x12f6('0xd'),auth[_0x12f6('0xb')](),controller[_0x12f6('0x17')]);router[_0x12f6('0x18')](_0x12f6('0xd'),auth[_0x12f6('0xb')](),controller[_0x12f6('0x19')]);module[_0x12f6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 0f959fa..bc298b9 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 _0x271c=['BOOLEAN','sequelize','exports','STRING','ENUM','incident','contact','nothing'];(function(_0x415a31,_0x425d49){var _0x19a1bf=function(_0xdad08e){while(--_0xdad08e){_0x415a31['push'](_0x415a31['shift']());}};_0x19a1bf(++_0x425d49);}(_0x271c,0xe1));var _0xc271=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x271c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc271('0x0'));module[_0xc271('0x1')]={'name':{'type':Sequelize[_0xc271('0x2')]},'description':{'type':Sequelize[_0xc271('0x2')]},'ticketType':{'type':Sequelize[_0xc271('0x3')](_0xc271('0x4'),'phonecall'),'defaultValue':_0xc271('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0xc271('0x5'),_0xc271('0x6')),'defaultValue':_0xc271('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xc271('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xc271('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe7ea=['BOOLEAN','sequelize','STRING','ENUM','phonecall','incident','contact','nothing'];(function(_0xff410d,_0x4cdc44){var _0x2c9bb1=function(_0x380c60){while(--_0x380c60){_0xff410d['push'](_0xff410d['shift']());}};_0x2c9bb1(++_0x4cdc44);}(_0xe7ea,0x149));var _0xae7e=function(_0x45967a,_0x474c44){_0x45967a=_0x45967a-0x0;var _0xf97e90=_0xe7ea[_0x45967a];return _0xf97e90;};'use strict';var Sequelize=require(_0xae7e('0x0'));module['exports']={'name':{'type':Sequelize[_0xae7e('0x1')]},'description':{'type':Sequelize[_0xae7e('0x1')]},'ticketType':{'type':Sequelize[_0xae7e('0x2')]('incident',_0xae7e('0x3')),'defaultValue':_0xae7e('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0xae7e('0x5'),_0xae7e('0x6')),'defaultValue':_0xae7e('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xae7e('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xae7e('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 74d725d..2479b4d 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 _0x7669=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','update','destroy','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x317497,_0x2d6cf7){var _0x3445b0=function(_0x22fe4d){while(--_0x22fe4d){_0x317497['push'](_0x317497['shift']());}};_0x3445b0(++_0x2d6cf7);}(_0x7669,0x113));var _0x9766=function(_0x45f0c1,_0x37bd6e){_0x45f0c1=_0x45f0c1-0x0;var _0x188bba=_0x7669[_0x45f0c1];return _0x188bba;};'use strict';var emlformat=require(_0x9766('0x0'));var rimraf=require(_0x9766('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9766('0x2'));var rp=require(_0x9766('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9766('0x4'));var util=require(_0x9766('0x5'));var path=require('path');var sox=require(_0x9766('0x6'));var csv=require('to-csv');var ejs=require(_0x9766('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9766('0x8'));var squel=require(_0x9766('0x9'));var crypto=require(_0x9766('0xa'));var jsforce=require(_0x9766('0xb'));var deskjs=require(_0x9766('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9766('0xd'));var Papa=require(_0x9766('0xe'));var Redis=require(_0x9766('0xf'));var authService=require(_0x9766('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9766('0x11'));var hardwareService=require(_0x9766('0x12'));var logger=require(_0x9766('0x13'))(_0x9766('0x14'));var utils=require(_0x9766('0x15'));var config=require(_0x9766('0x16'));var licenseUtil=require(_0x9766('0x17'));var db=require(_0x9766('0x18'))['db'];function respondWithStatusCode(_0xab698e,_0x58ab13){_0x58ab13=_0x58ab13||0xcc;return function(_0x167a93){if(_0x167a93){return _0xab698e[_0x9766('0x19')](_0x58ab13);}return _0xab698e['status'](_0x58ab13)[_0x9766('0x1a')]();};}function respondWithResult(_0x189329,_0x400821){_0x400821=_0x400821||0xc8;return function(_0x53dc43){if(_0x53dc43){return _0x189329[_0x9766('0x1b')](_0x400821)[_0x9766('0x1c')](_0x53dc43);}};}function respondWithFilteredResult(_0x382bf4,_0x142c17){return function(_0xa8d6ef){if(_0xa8d6ef){var _0x355299=typeof _0x142c17[_0x9766('0x1d')]===_0x9766('0x1e')&&typeof _0x142c17[_0x9766('0x1f')]===_0x9766('0x1e');var _0x2fe73e=_0xa8d6ef[_0x9766('0x20')];var _0xfbb65f=_0x355299?0x0:_0x142c17['offset'];var _0x4be6ec=_0x355299?_0xa8d6ef[_0x9766('0x20')]:_0x142c17[_0x9766('0x1d')]+_0x142c17['limit'];var _0x4e8da4;if(_0x4be6ec>=_0x2fe73e){_0x4be6ec=_0x2fe73e;_0x4e8da4=0xc8;}else{_0x4e8da4=0xce;}_0x382bf4[_0x9766('0x1b')](_0x4e8da4);return _0x382bf4[_0x9766('0x21')](_0x9766('0x22'),_0xfbb65f+'-'+_0x4be6ec+'/'+_0x2fe73e)[_0x9766('0x1c')](_0xa8d6ef);}return null;};}function patchUpdates(_0x6b5683){return function(_0x427531){try{jsonpatch[_0x9766('0x23')](_0x427531,_0x6b5683,!![]);}catch(_0x5b2f38){return BPromise[_0x9766('0x24')](_0x5b2f38);}return _0x427531[_0x9766('0x25')]();};}function saveUpdates(_0x41ed08,_0x2b484f){return function(_0x56f77a){if(_0x56f77a){return _0x56f77a['update'](_0x41ed08)[_0x9766('0x26')](function(_0x4f89dc){return _0x4f89dc;});}return null;};}function removeEntity(_0x3e68db,_0x48c99e){return function(_0xebf5ac){if(_0xebf5ac){return _0xebf5ac['destroy']()[_0x9766('0x26')](function(){_0x3e68db[_0x9766('0x1b')](0xcc)[_0x9766('0x1a')]();});}};}function handleEntityNotFound(_0x410ab6,_0x320f50){return function(_0xdc233b){if(!_0xdc233b){_0x410ab6[_0x9766('0x19')](0x194);}return _0xdc233b;};}function handleError(_0x3f50fa,_0xb903d4){_0xb903d4=_0xb903d4||0x1f4;return function(_0x4001c4){logger[_0x9766('0x27')](_0x4001c4[_0x9766('0x28')]);if(_0x4001c4[_0x9766('0x29')]){delete _0x4001c4[_0x9766('0x29')];}_0x3f50fa[_0x9766('0x1b')](_0xb903d4)['send'](_0x4001c4);};}exports[_0x9766('0x2a')]=function(_0x30a2fd,_0xb772a){var _0x36d582={},_0x59e0ce={},_0x3a42a5={'count':0x0,'rows':[]};var _0x174f8a=_[_0x9766('0x2b')](db['Dynamics365Configuration'][_0x9766('0x2c')],function(_0x261970){return{'name':_0x261970[_0x9766('0x2d')],'type':_0x261970['type'][_0x9766('0x2e')]};});_0x59e0ce[_0x9766('0x2f')]=_[_0x9766('0x2b')](_0x174f8a,_0x9766('0x29'));_0x59e0ce[_0x9766('0x30')]=_[_0x9766('0x31')](_0x30a2fd[_0x9766('0x30')]);_0x59e0ce[_0x9766('0x32')]=_[_0x9766('0x33')](_0x59e0ce[_0x9766('0x2f')],_0x59e0ce[_0x9766('0x30')]);_0x36d582[_0x9766('0x34')]=_['intersection'](_0x59e0ce[_0x9766('0x2f')],qs[_0x9766('0x35')](_0x30a2fd[_0x9766('0x30')][_0x9766('0x35')]));_0x36d582['attributes']=_0x36d582[_0x9766('0x34')]['length']?_0x36d582[_0x9766('0x34')]:_0x59e0ce[_0x9766('0x2f')];if(!_0x30a2fd[_0x9766('0x30')][_0x9766('0x36')](_0x9766('0x37'))){_0x36d582[_0x9766('0x1f')]=qs[_0x9766('0x1f')](_0x30a2fd[_0x9766('0x30')][_0x9766('0x1f')]);_0x36d582[_0x9766('0x1d')]=qs[_0x9766('0x1d')](_0x30a2fd['query'][_0x9766('0x1d')]);}_0x36d582[_0x9766('0x38')]=qs[_0x9766('0x39')](_0x30a2fd['query'][_0x9766('0x39')]);_0x36d582[_0x9766('0x3a')]=qs[_0x9766('0x32')](_[_0x9766('0x3b')](_0x30a2fd['query'],_0x59e0ce[_0x9766('0x32')]),_0x174f8a);if(_0x30a2fd[_0x9766('0x30')][_0x9766('0x3c')]){_0x36d582[_0x9766('0x3a')]=_['merge'](_0x36d582[_0x9766('0x3a')],{'$or':_[_0x9766('0x2b')](_0x174f8a,function(_0x2dca37){if(_0x2dca37['type']!=='VIRTUAL'){var _0x3ad0ed={};_0x3ad0ed[_0x2dca37[_0x9766('0x29')]]={'$like':'%'+_0x30a2fd['query']['filter']+'%'};return _0x3ad0ed;}})});}_0x36d582=_['merge']({},_0x36d582,_0x30a2fd[_0x9766('0x3d')]);var _0x5846af={'where':_0x36d582[_0x9766('0x3a')]};return db[_0x9766('0x3e')]['count'](_0x5846af)[_0x9766('0x26')](function(_0x2ef95b){_0x3a42a5[_0x9766('0x20')]=_0x2ef95b;if(_0x30a2fd[_0x9766('0x30')][_0x9766('0x3f')]){_0x36d582[_0x9766('0x40')]=[{'all':!![]}];}return db[_0x9766('0x3e')][_0x9766('0x41')](_0x36d582);})[_0x9766('0x26')](function(_0x42e3ff){_0x3a42a5[_0x9766('0x42')]=_0x42e3ff;return _0x3a42a5;})[_0x9766('0x26')](respondWithFilteredResult(_0xb772a,_0x36d582))[_0x9766('0x43')](handleError(_0xb772a,null));};exports[_0x9766('0x44')]=function(_0x31aeeb,_0x59fcf0){var _0x14321d={'raw':![],'where':{'id':_0x31aeeb[_0x9766('0x45')]['id']}},_0x202ffc={};_0x202ffc['model']=_[_0x9766('0x31')](db['Dynamics365Configuration'][_0x9766('0x2c')]);_0x202ffc['query']=_[_0x9766('0x31')](_0x31aeeb[_0x9766('0x30')]);_0x202ffc['filters']=_[_0x9766('0x33')](_0x202ffc[_0x9766('0x2f')],_0x202ffc[_0x9766('0x30')]);_0x14321d[_0x9766('0x34')]=_[_0x9766('0x33')](_0x202ffc[_0x9766('0x2f')],qs[_0x9766('0x35')](_0x31aeeb['query'][_0x9766('0x35')]));_0x14321d[_0x9766('0x34')]=_0x14321d[_0x9766('0x34')][_0x9766('0x46')]?_0x14321d['attributes']:_0x202ffc[_0x9766('0x2f')];if(_0x31aeeb['query'][_0x9766('0x3f')]){_0x14321d[_0x9766('0x40')]=[{'all':!![]}];}_0x14321d=_[_0x9766('0x47')]({},_0x14321d,_0x31aeeb['options']);return db[_0x9766('0x3e')][_0x9766('0x48')](_0x14321d)[_0x9766('0x26')](handleEntityNotFound(_0x59fcf0,null))[_0x9766('0x26')](respondWithResult(_0x59fcf0,null))[_0x9766('0x43')](handleError(_0x59fcf0,null));};exports[_0x9766('0x49')]=function(_0x41737f,_0x2cf508){return db[_0x9766('0x3e')][_0x9766('0x49')](_0x41737f[_0x9766('0x4a')],{})[_0x9766('0x26')](respondWithResult(_0x2cf508,0xc9))[_0x9766('0x43')](handleError(_0x2cf508,null));};exports[_0x9766('0x4b')]=function(_0x18e99d,_0x1361d8){if(_0x18e99d['body']['id']){delete _0x18e99d[_0x9766('0x4a')]['id'];}return db[_0x9766('0x3e')][_0x9766('0x48')]({'where':{'id':_0x18e99d[_0x9766('0x45')]['id']}})[_0x9766('0x26')](handleEntityNotFound(_0x1361d8,null))['then'](saveUpdates(_0x18e99d['body'],null))[_0x9766('0x26')](respondWithResult(_0x1361d8,null))[_0x9766('0x43')](handleError(_0x1361d8,null));};exports[_0x9766('0x4c')]=function(_0x3884e7,_0x1c0981){return db[_0x9766('0x3e')][_0x9766('0x48')]({'where':{'id':_0x3884e7[_0x9766('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c0981,null))[_0x9766('0x26')](removeEntity(_0x1c0981,null))['catch'](handleError(_0x1c0981,null));};exports[_0x9766('0x4d')]=function(_0x4e35de,_0x7a860c,_0x28040a){var _0x30fe34={};var _0x1828a8={};var _0x494791;var _0x1e1bb0;return db[_0x9766('0x3e')][_0x9766('0x4e')]({'where':{'id':_0x4e35de['params']['id']}})[_0x9766('0x26')](handleEntityNotFound(_0x7a860c,null))['then'](function(_0x26455a){if(_0x26455a){_0x494791=_0x26455a;_0x1828a8[_0x9766('0x2f')]=_['keys'](db[_0x9766('0x4f')][_0x9766('0x2c')]);_0x1828a8[_0x9766('0x30')]=_['keys'](_0x4e35de[_0x9766('0x30')]);_0x1828a8['filters']=_[_0x9766('0x33')](_0x1828a8[_0x9766('0x2f')],_0x1828a8[_0x9766('0x30')]);_0x30fe34[_0x9766('0x34')]=_[_0x9766('0x33')](_0x1828a8[_0x9766('0x2f')],qs[_0x9766('0x35')](_0x4e35de['query'][_0x9766('0x35')]));_0x30fe34[_0x9766('0x34')]=_0x30fe34[_0x9766('0x34')][_0x9766('0x46')]?_0x30fe34[_0x9766('0x34')]:_0x1828a8['model'];_0x30fe34['order']=qs[_0x9766('0x39')](_0x4e35de['query'][_0x9766('0x39')]);_0x30fe34[_0x9766('0x3a')]=qs[_0x9766('0x32')](_[_0x9766('0x3b')](_0x4e35de['query'],_0x1828a8['filters']));if(_0x4e35de['query'][_0x9766('0x3c')]){_0x30fe34[_0x9766('0x3a')]=_['merge'](_0x30fe34[_0x9766('0x3a')],{'$or':_['map'](_0x30fe34['attributes'],function(_0x2c85c1){var _0x2c1a28={};_0x2c1a28[_0x2c85c1]={'$like':'%'+_0x4e35de[_0x9766('0x30')][_0x9766('0x3c')]+'%'};return _0x2c1a28;})});}_0x30fe34=_[_0x9766('0x47')]({},_0x30fe34,_0x4e35de[_0x9766('0x3d')]);return _0x494791['getFields'](_0x30fe34);}})[_0x9766('0x26')](function(_0x1474b9){if(_0x1474b9){_0x1e1bb0=_0x1474b9[_0x9766('0x46')];if(!_0x4e35de[_0x9766('0x30')][_0x9766('0x36')](_0x9766('0x37'))){_0x30fe34['limit']=qs[_0x9766('0x1f')](_0x4e35de[_0x9766('0x30')]['limit']);_0x30fe34[_0x9766('0x1d')]=qs['offset'](_0x4e35de[_0x9766('0x30')]['offset']);}return _0x494791[_0x9766('0x4d')](_0x30fe34);}})[_0x9766('0x26')](function(_0x2042db){if(_0x2042db){return _0x2042db?{'count':_0x1e1bb0,'rows':_0x2042db}:null;}})[_0x9766('0x26')](respondWithResult(_0x7a860c,null))[_0x9766('0x43')](handleError(_0x7a860c,null));};exports[_0x9766('0x50')]=function(_0x33f866,_0x152682,_0x61eae2){var _0x523ffb={};var _0x448233={};var _0x350727;var _0x465096;return db['Dynamics365Configuration'][_0x9766('0x4e')]({'where':{'id':_0x33f866['params']['id']}})['then'](handleEntityNotFound(_0x152682,null))[_0x9766('0x26')](function(_0x2b01dc){if(_0x2b01dc){_0x350727=_0x2b01dc;_0x448233[_0x9766('0x2f')]=_[_0x9766('0x31')](db[_0x9766('0x4f')][_0x9766('0x2c')]);_0x448233[_0x9766('0x30')]=_[_0x9766('0x31')](_0x33f866[_0x9766('0x30')]);_0x448233[_0x9766('0x32')]=_[_0x9766('0x33')](_0x448233['model'],_0x448233[_0x9766('0x30')]);_0x523ffb[_0x9766('0x34')]=_[_0x9766('0x33')](_0x448233['model'],qs[_0x9766('0x35')](_0x33f866['query'][_0x9766('0x35')]));_0x523ffb[_0x9766('0x34')]=_0x523ffb['attributes']['length']?_0x523ffb[_0x9766('0x34')]:_0x448233[_0x9766('0x2f')];_0x523ffb[_0x9766('0x38')]=qs[_0x9766('0x39')](_0x33f866[_0x9766('0x30')][_0x9766('0x39')]);_0x523ffb[_0x9766('0x3a')]=qs[_0x9766('0x32')](_[_0x9766('0x3b')](_0x33f866[_0x9766('0x30')],_0x448233[_0x9766('0x32')]));if(_0x33f866[_0x9766('0x30')][_0x9766('0x3c')]){_0x523ffb['where']=_[_0x9766('0x47')](_0x523ffb[_0x9766('0x3a')],{'$or':_['map'](_0x523ffb[_0x9766('0x34')],function(_0x1bf66f){var _0x34c688={};_0x34c688[_0x1bf66f]={'$like':'%'+_0x33f866[_0x9766('0x30')][_0x9766('0x3c')]+'%'};return _0x34c688;})});}_0x523ffb=_[_0x9766('0x47')]({},_0x523ffb,_0x33f866[_0x9766('0x3d')]);return _0x350727[_0x9766('0x50')](_0x523ffb);}})[_0x9766('0x26')](function(_0x21a6f8){if(_0x21a6f8){_0x465096=_0x21a6f8[_0x9766('0x46')];if(!_0x33f866[_0x9766('0x30')][_0x9766('0x36')](_0x9766('0x37'))){_0x523ffb[_0x9766('0x1f')]=qs[_0x9766('0x1f')](_0x33f866[_0x9766('0x30')]['limit']);_0x523ffb['offset']=qs['offset'](_0x33f866[_0x9766('0x30')][_0x9766('0x1d')]);}return _0x350727[_0x9766('0x50')](_0x523ffb);}})[_0x9766('0x26')](function(_0x15d87f){if(_0x15d87f){return _0x15d87f?{'count':_0x465096,'rows':_0x15d87f}:null;}})[_0x9766('0x26')](respondWithResult(_0x152682,null))[_0x9766('0x43')](handleError(_0x152682,null));};exports[_0x9766('0x51')]=function(_0x462823,_0x5b8efa,_0x34a4b7){var _0x1dd51d={};var _0x58dfdd={};var _0x4b9d52;var _0x2a3713;return db[_0x9766('0x3e')][_0x9766('0x4e')]({'where':{'id':_0x462823['params']['id']}})[_0x9766('0x26')](handleEntityNotFound(_0x5b8efa,null))[_0x9766('0x26')](function(_0x478092){if(_0x478092){_0x4b9d52=_0x478092;_0x58dfdd[_0x9766('0x2f')]=_[_0x9766('0x31')](db[_0x9766('0x4f')][_0x9766('0x2c')]);_0x58dfdd[_0x9766('0x30')]=_['keys'](_0x462823[_0x9766('0x30')]);_0x58dfdd['filters']=_[_0x9766('0x33')](_0x58dfdd[_0x9766('0x2f')],_0x58dfdd['query']);_0x1dd51d['attributes']=_[_0x9766('0x33')](_0x58dfdd[_0x9766('0x2f')],qs['fields'](_0x462823[_0x9766('0x30')]['fields']));_0x1dd51d[_0x9766('0x34')]=_0x1dd51d[_0x9766('0x34')][_0x9766('0x46')]?_0x1dd51d[_0x9766('0x34')]:_0x58dfdd[_0x9766('0x2f')];_0x1dd51d[_0x9766('0x38')]=qs[_0x9766('0x39')](_0x462823['query'][_0x9766('0x39')]);_0x1dd51d[_0x9766('0x3a')]=qs[_0x9766('0x32')](_[_0x9766('0x3b')](_0x462823['query'],_0x58dfdd['filters']));if(_0x462823[_0x9766('0x30')][_0x9766('0x3c')]){_0x1dd51d[_0x9766('0x3a')]=_[_0x9766('0x47')](_0x1dd51d[_0x9766('0x3a')],{'$or':_['map'](_0x1dd51d['attributes'],function(_0x35cab7){var _0x4701d1={};_0x4701d1[_0x35cab7]={'$like':'%'+_0x462823[_0x9766('0x30')][_0x9766('0x3c')]+'%'};return _0x4701d1;})});}_0x1dd51d=_[_0x9766('0x47')]({},_0x1dd51d,_0x462823[_0x9766('0x3d')]);return _0x4b9d52['getDescriptions'](_0x1dd51d);}})['then'](function(_0x44205){if(_0x44205){_0x2a3713=_0x44205['length'];if(!_0x462823[_0x9766('0x30')][_0x9766('0x36')](_0x9766('0x37'))){_0x1dd51d[_0x9766('0x1f')]=qs[_0x9766('0x1f')](_0x462823['query'][_0x9766('0x1f')]);_0x1dd51d[_0x9766('0x1d')]=qs['offset'](_0x462823['query'][_0x9766('0x1d')]);}return _0x4b9d52['getDescriptions'](_0x1dd51d);}})[_0x9766('0x26')](function(_0x4a047c){if(_0x4a047c){return _0x4a047c?{'count':_0x2a3713,'rows':_0x4a047c}:null;}})['then'](respondWithResult(_0x5b8efa,null))[_0x9766('0x43')](handleError(_0x5b8efa,null));}; \ No newline at end of file +var _0xdb1e=['undefined','limit','count','json','reject','update','destroy','then','end','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','filter','where','merge','VIRTUAL','options','include','Dynamics365Configuration','findAll','rows','show','length','includeAll','find','catch','create','body','params','findOne','Dynamics365Field','order','sort','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','sendStatus','status','offset'];(function(_0x1f8242,_0x1fe834){var _0x2de218=function(_0x3e4477){while(--_0x3e4477){_0x1f8242['push'](_0x1f8242['shift']());}};_0x2de218(++_0x1fe834);}(_0xdb1e,0x1be));var _0xedb1=function(_0x39ce42,_0x433108){_0x39ce42=_0x39ce42-0x0;var _0x350573=_0xdb1e[_0x39ce42];return _0x350573;};'use strict';var emlformat=require(_0xedb1('0x0'));var rimraf=require(_0xedb1('0x1'));var zipdir=require(_0xedb1('0x2'));var jsonpatch=require(_0xedb1('0x3'));var rp=require(_0xedb1('0x4'));var moment=require(_0xedb1('0x5'));var BPromise=require(_0xedb1('0x6'));var Mustache=require('mustache');var util=require(_0xedb1('0x7'));var path=require(_0xedb1('0x8'));var sox=require('sox');var csv=require(_0xedb1('0x9'));var ejs=require(_0xedb1('0xa'));var fs=require('fs');var fs_extra=require(_0xedb1('0xb'));var _=require(_0xedb1('0xc'));var squel=require(_0xedb1('0xd'));var crypto=require(_0xedb1('0xe'));var jsforce=require(_0xedb1('0xf'));var deskjs=require(_0xedb1('0x10'));var toCsv=require(_0xedb1('0x9'));var querystring=require(_0xedb1('0x11'));var Papa=require(_0xedb1('0x12'));var Redis=require(_0xedb1('0x13'));var authService=require(_0xedb1('0x14'));var qs=require(_0xedb1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedb1('0x16'));var utils=require(_0xedb1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xedb1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x212348,_0x28a0fe){_0x28a0fe=_0x28a0fe||0xcc;return function(_0x219db7){if(_0x219db7){return _0x212348[_0xedb1('0x19')](_0x28a0fe);}return _0x212348[_0xedb1('0x1a')](_0x28a0fe)['end']();};}function respondWithResult(_0x1ff1f6,_0x1ed252){_0x1ed252=_0x1ed252||0xc8;return function(_0x1151db){if(_0x1151db){return _0x1ff1f6['status'](_0x1ed252)['json'](_0x1151db);}};}function respondWithFilteredResult(_0x36d758,_0x319103){return function(_0x2330e5){if(_0x2330e5){var _0x13c5a8=typeof _0x319103[_0xedb1('0x1b')]===_0xedb1('0x1c')&&typeof _0x319103[_0xedb1('0x1d')]==='undefined';var _0x397279=_0x2330e5[_0xedb1('0x1e')];var _0x3fa532=_0x13c5a8?0x0:_0x319103[_0xedb1('0x1b')];var _0x40ea3e=_0x13c5a8?_0x2330e5[_0xedb1('0x1e')]:_0x319103['offset']+_0x319103[_0xedb1('0x1d')];var _0x59f97e;if(_0x40ea3e>=_0x397279){_0x40ea3e=_0x397279;_0x59f97e=0xc8;}else{_0x59f97e=0xce;}_0x36d758[_0xedb1('0x1a')](_0x59f97e);return _0x36d758['set']('Content-Range',_0x3fa532+'-'+_0x40ea3e+'/'+_0x397279)[_0xedb1('0x1f')](_0x2330e5);}return null;};}function patchUpdates(_0x779a8c){return function(_0x20e3c6){try{jsonpatch['apply'](_0x20e3c6,_0x779a8c,!![]);}catch(_0x1932d3){return BPromise[_0xedb1('0x20')](_0x1932d3);}return _0x20e3c6['save']();};}function saveUpdates(_0x466b0d,_0x427cd3){return function(_0x4de66c){if(_0x4de66c){return _0x4de66c[_0xedb1('0x21')](_0x466b0d)['then'](function(_0x23f794){return _0x23f794;});}return null;};}function removeEntity(_0x3c62dd,_0xdac63a){return function(_0x25416a){if(_0x25416a){return _0x25416a[_0xedb1('0x22')]()[_0xedb1('0x23')](function(){_0x3c62dd[_0xedb1('0x1a')](0xcc)[_0xedb1('0x24')]();});}};}function handleEntityNotFound(_0x3f16df,_0xc70ce4){return function(_0x11d40e){if(!_0x11d40e){_0x3f16df[_0xedb1('0x19')](0x194);}return _0x11d40e;};}function handleError(_0x3d88a3,_0x4793ce){_0x4793ce=_0x4793ce||0x1f4;return function(_0x52bb49){logger[_0xedb1('0x25')](_0x52bb49[_0xedb1('0x26')]);if(_0x52bb49['name']){delete _0x52bb49[_0xedb1('0x27')];}_0x3d88a3[_0xedb1('0x1a')](_0x4793ce)[_0xedb1('0x28')](_0x52bb49);};}exports['index']=function(_0x49a5f4,_0x2136bd){var _0xe7844b={},_0x534d8b={},_0x433c63={'count':0x0,'rows':[]};var _0x14afdc=_[_0xedb1('0x29')](db['Dynamics365Configuration'][_0xedb1('0x2a')],function(_0x555cac){return{'name':_0x555cac['fieldName'],'type':_0x555cac[_0xedb1('0x2b')][_0xedb1('0x2c')]};});_0x534d8b[_0xedb1('0x2d')]=_[_0xedb1('0x29')](_0x14afdc,'name');_0x534d8b[_0xedb1('0x2e')]=_[_0xedb1('0x2f')](_0x49a5f4[_0xedb1('0x2e')]);_0x534d8b[_0xedb1('0x30')]=_[_0xedb1('0x31')](_0x534d8b['model'],_0x534d8b[_0xedb1('0x2e')]);_0xe7844b['attributes']=_[_0xedb1('0x31')](_0x534d8b[_0xedb1('0x2d')],qs['fields'](_0x49a5f4[_0xedb1('0x2e')][_0xedb1('0x32')]));_0xe7844b[_0xedb1('0x33')]=_0xe7844b['attributes']['length']?_0xe7844b[_0xedb1('0x33')]:_0x534d8b[_0xedb1('0x2d')];if(!_0x49a5f4['query'][_0xedb1('0x34')](_0xedb1('0x35'))){_0xe7844b[_0xedb1('0x1d')]=qs[_0xedb1('0x1d')](_0x49a5f4[_0xedb1('0x2e')][_0xedb1('0x1d')]);_0xe7844b[_0xedb1('0x1b')]=qs['offset'](_0x49a5f4[_0xedb1('0x2e')][_0xedb1('0x1b')]);}_0xe7844b['order']=qs['sort'](_0x49a5f4['query']['sort']);_0xe7844b['where']=qs[_0xedb1('0x30')](_['pick'](_0x49a5f4[_0xedb1('0x2e')],_0x534d8b[_0xedb1('0x30')]),_0x14afdc);if(_0x49a5f4['query'][_0xedb1('0x36')]){_0xe7844b[_0xedb1('0x37')]=_[_0xedb1('0x38')](_0xe7844b['where'],{'$or':_[_0xedb1('0x29')](_0x14afdc,function(_0x1ff211){if(_0x1ff211[_0xedb1('0x2b')]!==_0xedb1('0x39')){var _0x1e7e2b={};_0x1e7e2b[_0x1ff211[_0xedb1('0x27')]]={'$like':'%'+_0x49a5f4['query']['filter']+'%'};return _0x1e7e2b;}})});}_0xe7844b=_[_0xedb1('0x38')]({},_0xe7844b,_0x49a5f4[_0xedb1('0x3a')]);var _0x257d0d={'where':_0xe7844b[_0xedb1('0x37')]};return db['Dynamics365Configuration']['count'](_0x257d0d)[_0xedb1('0x23')](function(_0x1d15da){_0x433c63[_0xedb1('0x1e')]=_0x1d15da;if(_0x49a5f4['query']['includeAll']){_0xe7844b[_0xedb1('0x3b')]=[{'all':!![]}];}return db[_0xedb1('0x3c')][_0xedb1('0x3d')](_0xe7844b);})[_0xedb1('0x23')](function(_0x5830cf){_0x433c63[_0xedb1('0x3e')]=_0x5830cf;return _0x433c63;})[_0xedb1('0x23')](respondWithFilteredResult(_0x2136bd,_0xe7844b))['catch'](handleError(_0x2136bd,null));};exports[_0xedb1('0x3f')]=function(_0x5c36b8,_0x3449b3){var _0x2947fd={'raw':![],'where':{'id':_0x5c36b8['params']['id']}},_0x4748b4={};_0x4748b4['model']=_[_0xedb1('0x2f')](db[_0xedb1('0x3c')]['rawAttributes']);_0x4748b4[_0xedb1('0x2e')]=_[_0xedb1('0x2f')](_0x5c36b8['query']);_0x4748b4[_0xedb1('0x30')]=_[_0xedb1('0x31')](_0x4748b4[_0xedb1('0x2d')],_0x4748b4[_0xedb1('0x2e')]);_0x2947fd[_0xedb1('0x33')]=_[_0xedb1('0x31')](_0x4748b4['model'],qs[_0xedb1('0x32')](_0x5c36b8[_0xedb1('0x2e')][_0xedb1('0x32')]));_0x2947fd[_0xedb1('0x33')]=_0x2947fd[_0xedb1('0x33')][_0xedb1('0x40')]?_0x2947fd[_0xedb1('0x33')]:_0x4748b4['model'];if(_0x5c36b8[_0xedb1('0x2e')][_0xedb1('0x41')]){_0x2947fd['include']=[{'all':!![]}];}_0x2947fd=_[_0xedb1('0x38')]({},_0x2947fd,_0x5c36b8[_0xedb1('0x3a')]);return db['Dynamics365Configuration'][_0xedb1('0x42')](_0x2947fd)['then'](handleEntityNotFound(_0x3449b3,null))['then'](respondWithResult(_0x3449b3,null))[_0xedb1('0x43')](handleError(_0x3449b3,null));};exports[_0xedb1('0x44')]=function(_0x25d9a7,_0x1a5f73){return db[_0xedb1('0x3c')][_0xedb1('0x44')](_0x25d9a7['body'],{})[_0xedb1('0x23')](respondWithResult(_0x1a5f73,0xc9))[_0xedb1('0x43')](handleError(_0x1a5f73,null));};exports[_0xedb1('0x21')]=function(_0x34ac9a,_0x143907){if(_0x34ac9a[_0xedb1('0x45')]['id']){delete _0x34ac9a['body']['id'];}return db[_0xedb1('0x3c')]['find']({'where':{'id':_0x34ac9a['params']['id']}})[_0xedb1('0x23')](handleEntityNotFound(_0x143907,null))['then'](saveUpdates(_0x34ac9a[_0xedb1('0x45')],null))[_0xedb1('0x23')](respondWithResult(_0x143907,null))[_0xedb1('0x43')](handleError(_0x143907,null));};exports[_0xedb1('0x22')]=function(_0x541f12,_0x4ce865){return db[_0xedb1('0x3c')][_0xedb1('0x42')]({'where':{'id':_0x541f12[_0xedb1('0x46')]['id']}})[_0xedb1('0x23')](handleEntityNotFound(_0x4ce865,null))[_0xedb1('0x23')](removeEntity(_0x4ce865,null))[_0xedb1('0x43')](handleError(_0x4ce865,null));};exports['getFields']=function(_0x538d80,_0x2db7b1,_0x1c21cd){var _0x8b882a={};var _0x55900b={};var _0x49606f;var _0x481531;return db[_0xedb1('0x3c')][_0xedb1('0x47')]({'where':{'id':_0x538d80[_0xedb1('0x46')]['id']}})[_0xedb1('0x23')](handleEntityNotFound(_0x2db7b1,null))[_0xedb1('0x23')](function(_0x2b8fe0){if(_0x2b8fe0){_0x49606f=_0x2b8fe0;_0x55900b[_0xedb1('0x2d')]=_['keys'](db[_0xedb1('0x48')]['rawAttributes']);_0x55900b[_0xedb1('0x2e')]=_[_0xedb1('0x2f')](_0x538d80[_0xedb1('0x2e')]);_0x55900b[_0xedb1('0x30')]=_['intersection'](_0x55900b[_0xedb1('0x2d')],_0x55900b[_0xedb1('0x2e')]);_0x8b882a[_0xedb1('0x33')]=_[_0xedb1('0x31')](_0x55900b['model'],qs['fields'](_0x538d80['query'][_0xedb1('0x32')]));_0x8b882a[_0xedb1('0x33')]=_0x8b882a[_0xedb1('0x33')][_0xedb1('0x40')]?_0x8b882a[_0xedb1('0x33')]:_0x55900b[_0xedb1('0x2d')];_0x8b882a[_0xedb1('0x49')]=qs[_0xedb1('0x4a')](_0x538d80[_0xedb1('0x2e')][_0xedb1('0x4a')]);_0x8b882a[_0xedb1('0x37')]=qs[_0xedb1('0x30')](_[_0xedb1('0x4b')](_0x538d80[_0xedb1('0x2e')],_0x55900b['filters']));if(_0x538d80[_0xedb1('0x2e')]['filter']){_0x8b882a[_0xedb1('0x37')]=_[_0xedb1('0x38')](_0x8b882a['where'],{'$or':_[_0xedb1('0x29')](_0x8b882a[_0xedb1('0x33')],function(_0x921737){var _0x4c7210={};_0x4c7210[_0x921737]={'$like':'%'+_0x538d80[_0xedb1('0x2e')][_0xedb1('0x36')]+'%'};return _0x4c7210;})});}_0x8b882a=_[_0xedb1('0x38')]({},_0x8b882a,_0x538d80[_0xedb1('0x3a')]);return _0x49606f['getFields'](_0x8b882a);}})[_0xedb1('0x23')](function(_0x293f87){if(_0x293f87){_0x481531=_0x293f87[_0xedb1('0x40')];if(!_0x538d80[_0xedb1('0x2e')][_0xedb1('0x34')]('nolimit')){_0x8b882a[_0xedb1('0x1d')]=qs['limit'](_0x538d80['query'][_0xedb1('0x1d')]);_0x8b882a[_0xedb1('0x1b')]=qs[_0xedb1('0x1b')](_0x538d80['query'][_0xedb1('0x1b')]);}return _0x49606f[_0xedb1('0x4c')](_0x8b882a);}})[_0xedb1('0x23')](function(_0x5b7708){if(_0x5b7708){return _0x5b7708?{'count':_0x481531,'rows':_0x5b7708}:null;}})['then'](respondWithResult(_0x2db7b1,null))[_0xedb1('0x43')](handleError(_0x2db7b1,null));};exports[_0xedb1('0x4d')]=function(_0x30f9e7,_0x29e94b,_0x574aae){var _0x28b23c={};var _0x5e0032={};var _0x45f18d;var _0x3c8c05;return db[_0xedb1('0x3c')]['findOne']({'where':{'id':_0x30f9e7['params']['id']}})[_0xedb1('0x23')](handleEntityNotFound(_0x29e94b,null))[_0xedb1('0x23')](function(_0x48911e){if(_0x48911e){_0x45f18d=_0x48911e;_0x5e0032['model']=_['keys'](db['Dynamics365Field'][_0xedb1('0x2a')]);_0x5e0032[_0xedb1('0x2e')]=_[_0xedb1('0x2f')](_0x30f9e7['query']);_0x5e0032[_0xedb1('0x30')]=_[_0xedb1('0x31')](_0x5e0032['model'],_0x5e0032['query']);_0x28b23c['attributes']=_[_0xedb1('0x31')](_0x5e0032['model'],qs[_0xedb1('0x32')](_0x30f9e7[_0xedb1('0x2e')]['fields']));_0x28b23c[_0xedb1('0x33')]=_0x28b23c[_0xedb1('0x33')]['length']?_0x28b23c[_0xedb1('0x33')]:_0x5e0032['model'];_0x28b23c[_0xedb1('0x49')]=qs[_0xedb1('0x4a')](_0x30f9e7['query'][_0xedb1('0x4a')]);_0x28b23c[_0xedb1('0x37')]=qs['filters'](_[_0xedb1('0x4b')](_0x30f9e7[_0xedb1('0x2e')],_0x5e0032[_0xedb1('0x30')]));if(_0x30f9e7[_0xedb1('0x2e')][_0xedb1('0x36')]){_0x28b23c['where']=_[_0xedb1('0x38')](_0x28b23c[_0xedb1('0x37')],{'$or':_[_0xedb1('0x29')](_0x28b23c[_0xedb1('0x33')],function(_0x2b02c4){var _0x23f7eb={};_0x23f7eb[_0x2b02c4]={'$like':'%'+_0x30f9e7[_0xedb1('0x2e')][_0xedb1('0x36')]+'%'};return _0x23f7eb;})});}_0x28b23c=_[_0xedb1('0x38')]({},_0x28b23c,_0x30f9e7[_0xedb1('0x3a')]);return _0x45f18d[_0xedb1('0x4d')](_0x28b23c);}})[_0xedb1('0x23')](function(_0x2b2bae){if(_0x2b2bae){_0x3c8c05=_0x2b2bae[_0xedb1('0x40')];if(!_0x30f9e7['query'][_0xedb1('0x34')](_0xedb1('0x35'))){_0x28b23c['limit']=qs[_0xedb1('0x1d')](_0x30f9e7[_0xedb1('0x2e')][_0xedb1('0x1d')]);_0x28b23c[_0xedb1('0x1b')]=qs['offset'](_0x30f9e7['query']['offset']);}return _0x45f18d['getSubjects'](_0x28b23c);}})[_0xedb1('0x23')](function(_0x364e56){if(_0x364e56){return _0x364e56?{'count':_0x3c8c05,'rows':_0x364e56}:null;}})[_0xedb1('0x23')](respondWithResult(_0x29e94b,null))[_0xedb1('0x43')](handleError(_0x29e94b,null));};exports[_0xedb1('0x4e')]=function(_0x1937df,_0x40b965,_0x42a435){var _0x16e865={};var _0x222a6e={};var _0x53e101;var _0x465edc;return db['Dynamics365Configuration'][_0xedb1('0x47')]({'where':{'id':_0x1937df[_0xedb1('0x46')]['id']}})[_0xedb1('0x23')](handleEntityNotFound(_0x40b965,null))[_0xedb1('0x23')](function(_0x3e536b){if(_0x3e536b){_0x53e101=_0x3e536b;_0x222a6e[_0xedb1('0x2d')]=_[_0xedb1('0x2f')](db['Dynamics365Field'][_0xedb1('0x2a')]);_0x222a6e[_0xedb1('0x2e')]=_['keys'](_0x1937df[_0xedb1('0x2e')]);_0x222a6e[_0xedb1('0x30')]=_[_0xedb1('0x31')](_0x222a6e[_0xedb1('0x2d')],_0x222a6e['query']);_0x16e865[_0xedb1('0x33')]=_[_0xedb1('0x31')](_0x222a6e[_0xedb1('0x2d')],qs[_0xedb1('0x32')](_0x1937df['query'][_0xedb1('0x32')]));_0x16e865[_0xedb1('0x33')]=_0x16e865[_0xedb1('0x33')]['length']?_0x16e865[_0xedb1('0x33')]:_0x222a6e['model'];_0x16e865[_0xedb1('0x49')]=qs['sort'](_0x1937df[_0xedb1('0x2e')][_0xedb1('0x4a')]);_0x16e865[_0xedb1('0x37')]=qs[_0xedb1('0x30')](_[_0xedb1('0x4b')](_0x1937df[_0xedb1('0x2e')],_0x222a6e[_0xedb1('0x30')]));if(_0x1937df[_0xedb1('0x2e')][_0xedb1('0x36')]){_0x16e865['where']=_[_0xedb1('0x38')](_0x16e865['where'],{'$or':_[_0xedb1('0x29')](_0x16e865[_0xedb1('0x33')],function(_0x5b0b4f){var _0x181854={};_0x181854[_0x5b0b4f]={'$like':'%'+_0x1937df[_0xedb1('0x2e')][_0xedb1('0x36')]+'%'};return _0x181854;})});}_0x16e865=_[_0xedb1('0x38')]({},_0x16e865,_0x1937df[_0xedb1('0x3a')]);return _0x53e101[_0xedb1('0x4e')](_0x16e865);}})['then'](function(_0x2b06dd){if(_0x2b06dd){_0x465edc=_0x2b06dd[_0xedb1('0x40')];if(!_0x1937df['query'][_0xedb1('0x34')](_0xedb1('0x35'))){_0x16e865[_0xedb1('0x1d')]=qs[_0xedb1('0x1d')](_0x1937df[_0xedb1('0x2e')][_0xedb1('0x1d')]);_0x16e865['offset']=qs[_0xedb1('0x1b')](_0x1937df[_0xedb1('0x2e')]['offset']);}return _0x53e101[_0xedb1('0x4e')](_0x16e865);}})['then'](function(_0x46c609){if(_0x46c609){return _0x46c609?{'count':_0x465edc,'rows':_0x46c609}:null;}})['then'](respondWithResult(_0x40b965,null))['catch'](handleError(_0x40b965,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index c9ee258..7f3352d 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 _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x1e67b6,_0x14395a){var _0x18fdb2=function(_0x3be46a){while(--_0x3be46a){_0x1e67b6['push'](_0x1e67b6['shift']());}};_0x18fdb2(++_0x14395a);}(_0xb821,0xa7));var _0x1b82=function(_0x39f058,_0x1912ef){_0x39f058=_0x39f058-0x0;var _0x743df=_0xb821[_0x39f058];return _0x743df;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x29c2bd,_0x4479e6){var _0x397d05=function(_0x5cc2b6){while(--_0x5cc2b6){_0x29c2bd['push'](_0x29c2bd['shift']());}};_0x397d05(++_0x4479e6);}(_0xa41a,0x6b));var _0xaa41=function(_0x3ac50e,_0x238789){_0x3ac50e=_0x3ac50e-0x0;var _0xdd222f=_0xa41a[_0x3ac50e];return _0xdd222f;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index c1d74dc..8bfb626 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 _0x7e7d=['bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x5903ff,_0x53e86a){var _0x5d704b=function(_0x1de582){while(--_0x1de582){_0x5903ff['push'](_0x5903ff['shift']());}};_0x5d704b(++_0x53e86a);}(_0x7e7d,0x96));var _0xd7e7=function(_0x24fad4,_0x507744){_0x24fad4=_0x24fad4-0x0;var _0x296f9d=_0x7e7d[_0x24fad4];return _0x296f9d;};'use strict';var _=require(_0xd7e7('0x0'));var util=require(_0xd7e7('0x1'));var moment=require('moment');var BPromise=require(_0xd7e7('0x2'));var rs=require(_0xd7e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd7e7('0x4'))(_0xd7e7('0x5'));var config=require('../../config/environment');var jayson=require(_0xd7e7('0x6'));var client=jayson[_0xd7e7('0x7')][_0xd7e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa6835e,_0x14e485,_0xcc77a9){return new BPromise(function(_0x1e587a,_0x4e2705){return client[_0xd7e7('0x9')](_0xa6835e,_0xcc77a9)['then'](function(_0x33672d){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x14e485,_0xd7e7('0xa'));logger[_0xd7e7('0xb')](_0xd7e7('0xc'),_0x14e485,_0xd7e7('0xa'),JSON[_0xd7e7('0xd')](_0x33672d));if(_0x33672d[_0xd7e7('0xe')]){if(_0x33672d['error']['code']===0x1f4){logger[_0xd7e7('0xe')](_0xd7e7('0xf'),_0x14e485,_0x33672d[_0xd7e7('0xe')]['message']);return _0x4e2705(_0x33672d[_0xd7e7('0xe')]['message']);}logger['error'](_0xd7e7('0xf'),_0x14e485,_0x33672d[_0xd7e7('0xe')][_0xd7e7('0x10')]);return _0x1e587a(_0x33672d[_0xd7e7('0xe')][_0xd7e7('0x10')]);}else{logger['info'](_0xd7e7('0xf'),_0x14e485,'request\x20sent');_0x1e587a(_0x33672d[_0xd7e7('0x11')]['message']);}})[_0xd7e7('0x12')](function(_0x2fd66a){logger[_0xd7e7('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x14e485,_0x2fd66a);_0x4e2705(_0x2fd66a);});});} \ No newline at end of file +var _0xce99=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x5b4ade,_0x524f42){var _0x2806a8=function(_0x2bc037){while(--_0x2bc037){_0x5b4ade['push'](_0x5b4ade['shift']());}};_0x2806a8(++_0x524f42);}(_0xce99,0x1be));var _0x9ce9=function(_0x5b835c,_0x5cd7c7){_0x5b835c=_0x5b835c-0x0;var _0x3f9995=_0xce99[_0x5b835c];return _0x3f9995;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ce9('0x0'));var BPromise=require(_0x9ce9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ce9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ce9('0x3'));var logger=require(_0x9ce9('0x4'))(_0x9ce9('0x5'));var config=require(_0x9ce9('0x6'));var jayson=require(_0x9ce9('0x7'));var client=jayson[_0x9ce9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327e80,_0x2ce69e,_0x4a02d8){return new BPromise(function(_0x2fe1e0,_0x32ab0c){return client[_0x9ce9('0x9')](_0x327e80,_0x4a02d8)[_0x9ce9('0xa')](function(_0x53e701){logger[_0x9ce9('0xb')](_0x9ce9('0xc'),_0x2ce69e,_0x9ce9('0xd'));logger[_0x9ce9('0xe')](_0x9ce9('0xf'),_0x2ce69e,'request\x20sent',JSON[_0x9ce9('0x10')](_0x53e701));if(_0x53e701[_0x9ce9('0x11')]){if(_0x53e701[_0x9ce9('0x11')][_0x9ce9('0x12')]===0x1f4){logger[_0x9ce9('0x11')](_0x9ce9('0xc'),_0x2ce69e,_0x53e701[_0x9ce9('0x11')]['message']);return _0x32ab0c(_0x53e701[_0x9ce9('0x11')][_0x9ce9('0x13')]);}logger['error'](_0x9ce9('0xc'),_0x2ce69e,_0x53e701[_0x9ce9('0x11')][_0x9ce9('0x13')]);return _0x2fe1e0(_0x53e701[_0x9ce9('0x11')][_0x9ce9('0x13')]);}else{logger[_0x9ce9('0xb')](_0x9ce9('0xc'),_0x2ce69e,_0x9ce9('0xd'));_0x2fe1e0(_0x53e701[_0x9ce9('0x14')][_0x9ce9('0x13')]);}})[_0x9ce9('0x15')](function(_0x13caf7){logger[_0x9ce9('0x11')](_0x9ce9('0xc'),_0x2ce69e,_0x13caf7);_0x32ab0c(_0x13caf7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 583529c..3474268 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 _0x125a=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','post','isAuthenticated','create','delete','destroy'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x125a,0x122));var _0xa125=function(_0x50c7d6,_0x43aaed){_0x50c7d6=_0x50c7d6-0x0;var _0x4e1b11=_0x125a[_0x50c7d6];return _0x4e1b11;};'use strict';var multer=require(_0xa125('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa125('0x1'));var express=require(_0xa125('0x2'));var router=express[_0xa125('0x3')]();var fs_extra=require(_0xa125('0x4'));var auth=require(_0xa125('0x5'));var interaction=require(_0xa125('0x6'));var config=require(_0xa125('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xa125('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa125('0x8')](_0xa125('0x9'),auth['isAuthenticated'](),controller[_0xa125('0xa')]);router[_0xa125('0xb')]('/',auth[_0xa125('0xc')](),controller[_0xa125('0xd')]);router['put']('/:id',auth[_0xa125('0xc')](),controller['update']);router[_0xa125('0xe')]('/:id',auth[_0xa125('0xc')](),controller[_0xa125('0xf')]);module[_0xa125('0x10')]=router; \ No newline at end of file +var _0x4c31=['connect-timeout','Router','fs-extra','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','multer','util','path'];(function(_0x44411b,_0x84537b){var _0x54adf5=function(_0x23682c){while(--_0x23682c){_0x44411b['push'](_0x44411b['shift']());}};_0x54adf5(++_0x84537b);}(_0x4c31,0xda));var _0x14c3=function(_0x2152c5,_0x59472f){_0x2152c5=_0x2152c5-0x0;var _0x3c0ae9=_0x4c31[_0x2152c5];return _0x3c0ae9;};'use strict';var multer=require(_0x14c3('0x0'));var util=require(_0x14c3('0x1'));var path=require(_0x14c3('0x2'));var timeout=require(_0x14c3('0x3'));var express=require('express');var router=express[_0x14c3('0x4')]();var fs_extra=require(_0x14c3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x14c3('0x6'));router[_0x14c3('0x7')]('/',auth['isAuthenticated'](),controller[_0x14c3('0x8')]);router[_0x14c3('0x7')](_0x14c3('0x9'),auth[_0x14c3('0xa')](),controller[_0x14c3('0xb')]);router[_0x14c3('0xc')]('/',auth['isAuthenticated'](),controller[_0x14c3('0xd')]);router[_0x14c3('0xe')]('/:id',auth[_0x14c3('0xa')](),controller[_0x14c3('0xf')]);router[_0x14c3('0x10')](_0x14c3('0x9'),auth[_0x14c3('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 7980d2a..df8190c 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 _0xd7b3=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','string'];(function(_0x9dc67,_0x4fbf0d){var _0x1ca816=function(_0x54e2f4){while(--_0x54e2f4){_0x9dc67['push'](_0x9dc67['shift']());}};_0x1ca816(++_0x4fbf0d);}(_0xd7b3,0x1d1));var _0x3d7b=function(_0x28ef4e,_0x202aa3){_0x28ef4e=_0x28ef4e-0x0;var _0x1aa097=_0xd7b3[_0x28ef4e];return _0x1aa097;};'use strict';var Sequelize=require(_0x3d7b('0x0'));module[_0x3d7b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3d7b('0x2'),_0x3d7b('0x3'),_0x3d7b('0x4'),_0x3d7b('0x5'),_0x3d7b('0x6')),'defaultValue':_0x3d7b('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3d7b('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x3d7b('0x2'),_0x3d7b('0x3'),_0x3d7b('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3d7b('0x7')]},'nameField':{'type':Sequelize[_0x3d7b('0x7')]},'customField':{'type':Sequelize[_0x3d7b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3d7b('0x7')]}}; \ No newline at end of file +var _0xe10a=['keyValue','STRING','BOOLEAN','sequelize','exports','string','variable'];(function(_0x124800,_0x243aa2){var _0x234a17=function(_0x233a31){while(--_0x233a31){_0x124800['push'](_0x124800['shift']());}};_0x234a17(++_0x243aa2);}(_0xe10a,0x1ed));var _0xae10=function(_0x22d763,_0x460782){_0x22d763=_0x22d763-0x0;var _0x54b7ae=_0xe10a[_0x22d763];return _0x54b7ae;};'use strict';var Sequelize=require(_0xae10('0x0'));module[_0xae10('0x1')]={'type':{'type':Sequelize['ENUM'](_0xae10('0x2'),_0xae10('0x3'),'customVariable',_0xae10('0x4'),'picklist'),'defaultValue':_0xae10('0x2')},'content':{'type':Sequelize[_0xae10('0x5')]},'key':{'type':Sequelize[_0xae10('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xae10('0x2'),_0xae10('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xae10('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xae10('0x5')]},'customField':{'type':Sequelize[_0xae10('0x6')],'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 c31c5ef..ef9883d 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 _0x76bc=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','error','name','index','Dynamics365Field','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis'];(function(_0x46f868,_0x51a8c9){var _0xec84dc=function(_0x311603){while(--_0x311603){_0x46f868['push'](_0x46f868['shift']());}};_0xec84dc(++_0x51a8c9);}(_0x76bc,0x165));var _0xc76b=function(_0x3d34da,_0x3abcc1){_0x3d34da=_0x3d34da-0x0;var _0xcf6af8=_0x76bc[_0x3d34da];return _0xcf6af8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc76b('0x0'));var zipdir=require(_0xc76b('0x1'));var jsonpatch=require(_0xc76b('0x2'));var rp=require(_0xc76b('0x3'));var moment=require(_0xc76b('0x4'));var BPromise=require(_0xc76b('0x5'));var Mustache=require(_0xc76b('0x6'));var util=require('util');var path=require(_0xc76b('0x7'));var sox=require(_0xc76b('0x8'));var csv=require(_0xc76b('0x9'));var ejs=require(_0xc76b('0xa'));var fs=require('fs');var fs_extra=require(_0xc76b('0xb'));var _=require(_0xc76b('0xc'));var squel=require(_0xc76b('0xd'));var crypto=require('crypto');var jsforce=require(_0xc76b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc76b('0x9'));var querystring=require(_0xc76b('0xf'));var Papa=require(_0xc76b('0x10'));var Redis=require(_0xc76b('0x11'));var authService=require(_0xc76b('0x12'));var qs=require(_0xc76b('0x13'));var as=require(_0xc76b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc76b('0x15'));var utils=require(_0xc76b('0x16'));var config=require(_0xc76b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc76b('0x18'))['db'];function respondWithStatusCode(_0x54f4e9,_0x36818d){_0x36818d=_0x36818d||0xcc;return function(_0x275b9c){if(_0x275b9c){return _0x54f4e9[_0xc76b('0x19')](_0x36818d);}return _0x54f4e9[_0xc76b('0x1a')](_0x36818d)[_0xc76b('0x1b')]();};}function respondWithResult(_0x23546a,_0x2758e8){_0x2758e8=_0x2758e8||0xc8;return function(_0x23d87b){if(_0x23d87b){return _0x23546a[_0xc76b('0x1a')](_0x2758e8)[_0xc76b('0x1c')](_0x23d87b);}};}function respondWithFilteredResult(_0x13d5d7,_0x183a9d){return function(_0xae5a3b){if(_0xae5a3b){var _0x408b66=typeof _0x183a9d[_0xc76b('0x1d')]===_0xc76b('0x1e')&&typeof _0x183a9d[_0xc76b('0x1f')]===_0xc76b('0x1e');var _0x46d8b5=_0xae5a3b[_0xc76b('0x20')];var _0x46d96f=_0x408b66?0x0:_0x183a9d[_0xc76b('0x1d')];var _0x3f454a=_0x408b66?_0xae5a3b[_0xc76b('0x20')]:_0x183a9d[_0xc76b('0x1d')]+_0x183a9d[_0xc76b('0x1f')];var _0x4b0a36;if(_0x3f454a>=_0x46d8b5){_0x3f454a=_0x46d8b5;_0x4b0a36=0xc8;}else{_0x4b0a36=0xce;}_0x13d5d7[_0xc76b('0x1a')](_0x4b0a36);return _0x13d5d7[_0xc76b('0x21')](_0xc76b('0x22'),_0x46d96f+'-'+_0x3f454a+'/'+_0x46d8b5)[_0xc76b('0x1c')](_0xae5a3b);}return null;};}function patchUpdates(_0x27b1c3){return function(_0x3ea2fa){try{jsonpatch[_0xc76b('0x23')](_0x3ea2fa,_0x27b1c3,!![]);}catch(_0x5cd6ef){return BPromise['reject'](_0x5cd6ef);}return _0x3ea2fa['save']();};}function saveUpdates(_0x4584dc,_0x207954){return function(_0x4b3adb){if(_0x4b3adb){return _0x4b3adb['update'](_0x4584dc)[_0xc76b('0x24')](function(_0x4d3fba){return _0x4d3fba;});}return null;};}function removeEntity(_0x12e494,_0xa64c0f){return function(_0x857579){if(_0x857579){return _0x857579[_0xc76b('0x25')]()[_0xc76b('0x24')](function(){_0x12e494['status'](0xcc)[_0xc76b('0x1b')]();});}};}function handleEntityNotFound(_0xd9feca,_0x40a8cd){return function(_0x6ecbfd){if(!_0x6ecbfd){_0xd9feca[_0xc76b('0x19')](0x194);}return _0x6ecbfd;};}function handleError(_0x18e136,_0x436f9c){_0x436f9c=_0x436f9c||0x1f4;return function(_0x1b99f2){logger[_0xc76b('0x26')](_0x1b99f2['stack']);if(_0x1b99f2[_0xc76b('0x27')]){delete _0x1b99f2['name'];}_0x18e136[_0xc76b('0x1a')](_0x436f9c)['send'](_0x1b99f2);};}exports[_0xc76b('0x28')]=function(_0x10e90c,_0x28f32a){var _0x4c6ca8={},_0x1b2f4a={},_0x48ad8a={'count':0x0,'rows':[]};var _0xa67b24=_['map'](db[_0xc76b('0x29')][_0xc76b('0x2a')],function(_0x8c0c34){return{'name':_0x8c0c34[_0xc76b('0x2b')],'type':_0x8c0c34[_0xc76b('0x2c')]['key']};});_0x1b2f4a['model']=_[_0xc76b('0x2d')](_0xa67b24,_0xc76b('0x27'));_0x1b2f4a[_0xc76b('0x2e')]=_[_0xc76b('0x2f')](_0x10e90c['query']);_0x1b2f4a[_0xc76b('0x30')]=_[_0xc76b('0x31')](_0x1b2f4a[_0xc76b('0x32')],_0x1b2f4a[_0xc76b('0x2e')]);_0x4c6ca8[_0xc76b('0x33')]=_[_0xc76b('0x31')](_0x1b2f4a[_0xc76b('0x32')],qs[_0xc76b('0x34')](_0x10e90c[_0xc76b('0x2e')]['fields']));_0x4c6ca8[_0xc76b('0x33')]=_0x4c6ca8['attributes'][_0xc76b('0x35')]?_0x4c6ca8['attributes']:_0x1b2f4a['model'];if(!_0x10e90c[_0xc76b('0x2e')][_0xc76b('0x36')](_0xc76b('0x37'))){_0x4c6ca8[_0xc76b('0x1f')]=qs[_0xc76b('0x1f')](_0x10e90c[_0xc76b('0x2e')][_0xc76b('0x1f')]);_0x4c6ca8[_0xc76b('0x1d')]=qs[_0xc76b('0x1d')](_0x10e90c[_0xc76b('0x2e')][_0xc76b('0x1d')]);}_0x4c6ca8[_0xc76b('0x38')]=qs[_0xc76b('0x39')](_0x10e90c[_0xc76b('0x2e')][_0xc76b('0x39')]);_0x4c6ca8['where']=qs[_0xc76b('0x30')](_[_0xc76b('0x3a')](_0x10e90c[_0xc76b('0x2e')],_0x1b2f4a[_0xc76b('0x30')]),_0xa67b24);if(_0x10e90c[_0xc76b('0x2e')][_0xc76b('0x3b')]){_0x4c6ca8[_0xc76b('0x3c')]=_[_0xc76b('0x3d')](_0x4c6ca8[_0xc76b('0x3c')],{'$or':_[_0xc76b('0x2d')](_0xa67b24,function(_0x3e8a4a){if(_0x3e8a4a[_0xc76b('0x2c')]!==_0xc76b('0x3e')){var _0x1dedc9={};_0x1dedc9[_0x3e8a4a[_0xc76b('0x27')]]={'$like':'%'+_0x10e90c[_0xc76b('0x2e')][_0xc76b('0x3b')]+'%'};return _0x1dedc9;}})});}_0x4c6ca8=_[_0xc76b('0x3d')]({},_0x4c6ca8,_0x10e90c[_0xc76b('0x3f')]);var _0xefd2f0={'where':_0x4c6ca8[_0xc76b('0x3c')]};return db['Dynamics365Field'][_0xc76b('0x20')](_0xefd2f0)['then'](function(_0x4dd459){_0x48ad8a[_0xc76b('0x20')]=_0x4dd459;if(_0x10e90c[_0xc76b('0x2e')][_0xc76b('0x40')]){_0x4c6ca8[_0xc76b('0x41')]=[{'all':!![]}];}return db[_0xc76b('0x29')][_0xc76b('0x42')](_0x4c6ca8);})[_0xc76b('0x24')](function(_0x51fdc2){_0x48ad8a[_0xc76b('0x43')]=_0x51fdc2;return _0x48ad8a;})[_0xc76b('0x24')](respondWithFilteredResult(_0x28f32a,_0x4c6ca8))['catch'](handleError(_0x28f32a,null));};exports[_0xc76b('0x44')]=function(_0x6030a8,_0x37c0a5){var _0x4466fe={'raw':!![],'where':{'id':_0x6030a8[_0xc76b('0x45')]['id']}},_0x5a7220={};_0x5a7220[_0xc76b('0x32')]=_[_0xc76b('0x2f')](db[_0xc76b('0x29')]['rawAttributes']);_0x5a7220[_0xc76b('0x2e')]=_['keys'](_0x6030a8['query']);_0x5a7220['filters']=_[_0xc76b('0x31')](_0x5a7220[_0xc76b('0x32')],_0x5a7220[_0xc76b('0x2e')]);_0x4466fe[_0xc76b('0x33')]=_[_0xc76b('0x31')](_0x5a7220[_0xc76b('0x32')],qs[_0xc76b('0x34')](_0x6030a8[_0xc76b('0x2e')][_0xc76b('0x34')]));_0x4466fe[_0xc76b('0x33')]=_0x4466fe[_0xc76b('0x33')][_0xc76b('0x35')]?_0x4466fe[_0xc76b('0x33')]:_0x5a7220[_0xc76b('0x32')];if(_0x6030a8[_0xc76b('0x2e')][_0xc76b('0x40')]){_0x4466fe[_0xc76b('0x41')]=[{'all':!![]}];}_0x4466fe=_['merge']({},_0x4466fe,_0x6030a8[_0xc76b('0x3f')]);return db['Dynamics365Field'][_0xc76b('0x46')](_0x4466fe)[_0xc76b('0x24')](handleEntityNotFound(_0x37c0a5,null))[_0xc76b('0x24')](respondWithResult(_0x37c0a5,null))[_0xc76b('0x47')](handleError(_0x37c0a5,null));};exports[_0xc76b('0x48')]=function(_0x118f58,_0x5e1230){return db[_0xc76b('0x29')][_0xc76b('0x48')](_0x118f58[_0xc76b('0x49')],{})['then'](respondWithResult(_0x5e1230,0xc9))[_0xc76b('0x47')](handleError(_0x5e1230,null));};exports[_0xc76b('0x4a')]=function(_0x351765,_0xfc7b04){if(_0x351765[_0xc76b('0x49')]['id']){delete _0x351765[_0xc76b('0x49')]['id'];}return db[_0xc76b('0x29')][_0xc76b('0x46')]({'where':{'id':_0x351765['params']['id']}})[_0xc76b('0x24')](handleEntityNotFound(_0xfc7b04,null))[_0xc76b('0x24')](saveUpdates(_0x351765[_0xc76b('0x49')],null))[_0xc76b('0x24')](respondWithResult(_0xfc7b04,null))['catch'](handleError(_0xfc7b04,null));};exports[_0xc76b('0x25')]=function(_0x285afa,_0x15bf40){return db['Dynamics365Field']['find']({'where':{'id':_0x285afa['params']['id']}})['then'](handleEntityNotFound(_0x15bf40,null))[_0xc76b('0x24')](removeEntity(_0x15bf40,null))['catch'](handleError(_0x15bf40,null));}; \ No newline at end of file +var _0x0454=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','error','name','send','index','Dynamics365Field','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1c7dee,_0x73eb94){var _0x5382a1=function(_0x1530d4){while(--_0x1530d4){_0x1c7dee['push'](_0x1c7dee['shift']());}};_0x5382a1(++_0x73eb94);}(_0x0454,0x80));var _0x4045=function(_0x27ee4c,_0x100efe){_0x27ee4c=_0x27ee4c-0x0;var _0x24b62d=_0x0454[_0x27ee4c];return _0x24b62d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4045('0x0'));var zipdir=require(_0x4045('0x1'));var jsonpatch=require(_0x4045('0x2'));var rp=require(_0x4045('0x3'));var moment=require('moment');var BPromise=require(_0x4045('0x4'));var Mustache=require(_0x4045('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4045('0x6'));var csv=require(_0x4045('0x7'));var ejs=require(_0x4045('0x8'));var fs=require('fs');var fs_extra=require(_0x4045('0x9'));var _=require('lodash');var squel=require(_0x4045('0xa'));var crypto=require(_0x4045('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4045('0x7'));var querystring=require(_0x4045('0xc'));var Papa=require(_0x4045('0xd'));var Redis=require(_0x4045('0xe'));var authService=require(_0x4045('0xf'));var qs=require(_0x4045('0x10'));var as=require(_0x4045('0x11'));var hardwareService=require(_0x4045('0x12'));var logger=require(_0x4045('0x13'))('api');var utils=require(_0x4045('0x14'));var config=require(_0x4045('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4045('0x16'))['db'];function respondWithStatusCode(_0x2225f5,_0x1a892b){_0x1a892b=_0x1a892b||0xcc;return function(_0x5fbf6c){if(_0x5fbf6c){return _0x2225f5[_0x4045('0x17')](_0x1a892b);}return _0x2225f5['status'](_0x1a892b)[_0x4045('0x18')]();};}function respondWithResult(_0x123d77,_0x179599){_0x179599=_0x179599||0xc8;return function(_0x310365){if(_0x310365){return _0x123d77[_0x4045('0x19')](_0x179599)[_0x4045('0x1a')](_0x310365);}};}function respondWithFilteredResult(_0x2d6eff,_0x1ae0e5){return function(_0x3de434){if(_0x3de434){var _0x3b6ad9=typeof _0x1ae0e5[_0x4045('0x1b')]===_0x4045('0x1c')&&typeof _0x1ae0e5[_0x4045('0x1d')]===_0x4045('0x1c');var _0x43dd5a=_0x3de434[_0x4045('0x1e')];var _0x3aac40=_0x3b6ad9?0x0:_0x1ae0e5[_0x4045('0x1b')];var _0x471f56=_0x3b6ad9?_0x3de434[_0x4045('0x1e')]:_0x1ae0e5['offset']+_0x1ae0e5['limit'];var _0x5e6268;if(_0x471f56>=_0x43dd5a){_0x471f56=_0x43dd5a;_0x5e6268=0xc8;}else{_0x5e6268=0xce;}_0x2d6eff['status'](_0x5e6268);return _0x2d6eff[_0x4045('0x1f')](_0x4045('0x20'),_0x3aac40+'-'+_0x471f56+'/'+_0x43dd5a)[_0x4045('0x1a')](_0x3de434);}return null;};}function patchUpdates(_0x462288){return function(_0x1dd085){try{jsonpatch['apply'](_0x1dd085,_0x462288,!![]);}catch(_0x4b9cee){return BPromise[_0x4045('0x21')](_0x4b9cee);}return _0x1dd085[_0x4045('0x22')]();};}function saveUpdates(_0x3c38d5,_0x304b74){return function(_0x5829f2){if(_0x5829f2){return _0x5829f2['update'](_0x3c38d5)['then'](function(_0x400d36){return _0x400d36;});}return null;};}function removeEntity(_0x104b6a,_0x5c93e2){return function(_0x3aec18){if(_0x3aec18){return _0x3aec18[_0x4045('0x23')]()[_0x4045('0x24')](function(){_0x104b6a[_0x4045('0x19')](0xcc)[_0x4045('0x18')]();});}};}function handleEntityNotFound(_0x1a9905,_0xdae1e2){return function(_0x1c298c){if(!_0x1c298c){_0x1a9905[_0x4045('0x17')](0x194);}return _0x1c298c;};}function handleError(_0x1e3068,_0x856606){_0x856606=_0x856606||0x1f4;return function(_0x5bf4f6){logger[_0x4045('0x25')](_0x5bf4f6['stack']);if(_0x5bf4f6['name']){delete _0x5bf4f6[_0x4045('0x26')];}_0x1e3068[_0x4045('0x19')](_0x856606)[_0x4045('0x27')](_0x5bf4f6);};}exports[_0x4045('0x28')]=function(_0x1d9759,_0x1c1bd9){var _0x1987e7={},_0x5e4a6c={},_0x492f8d={'count':0x0,'rows':[]};var _0x95f25d=_['map'](db[_0x4045('0x29')][_0x4045('0x2a')],function(_0x46b99a){return{'name':_0x46b99a['fieldName'],'type':_0x46b99a[_0x4045('0x2b')][_0x4045('0x2c')]};});_0x5e4a6c[_0x4045('0x2d')]=_[_0x4045('0x2e')](_0x95f25d,_0x4045('0x26'));_0x5e4a6c[_0x4045('0x2f')]=_[_0x4045('0x30')](_0x1d9759['query']);_0x5e4a6c[_0x4045('0x31')]=_['intersection'](_0x5e4a6c['model'],_0x5e4a6c[_0x4045('0x2f')]);_0x1987e7[_0x4045('0x32')]=_[_0x4045('0x33')](_0x5e4a6c[_0x4045('0x2d')],qs[_0x4045('0x34')](_0x1d9759[_0x4045('0x2f')][_0x4045('0x34')]));_0x1987e7['attributes']=_0x1987e7[_0x4045('0x32')][_0x4045('0x35')]?_0x1987e7['attributes']:_0x5e4a6c['model'];if(!_0x1d9759[_0x4045('0x2f')][_0x4045('0x36')](_0x4045('0x37'))){_0x1987e7[_0x4045('0x1d')]=qs[_0x4045('0x1d')](_0x1d9759['query'][_0x4045('0x1d')]);_0x1987e7[_0x4045('0x1b')]=qs[_0x4045('0x1b')](_0x1d9759[_0x4045('0x2f')]['offset']);}_0x1987e7[_0x4045('0x38')]=qs['sort'](_0x1d9759[_0x4045('0x2f')]['sort']);_0x1987e7['where']=qs['filters'](_[_0x4045('0x39')](_0x1d9759[_0x4045('0x2f')],_0x5e4a6c[_0x4045('0x31')]),_0x95f25d);if(_0x1d9759[_0x4045('0x2f')][_0x4045('0x3a')]){_0x1987e7[_0x4045('0x3b')]=_[_0x4045('0x3c')](_0x1987e7[_0x4045('0x3b')],{'$or':_[_0x4045('0x2e')](_0x95f25d,function(_0x82b14){if(_0x82b14[_0x4045('0x2b')]!==_0x4045('0x3d')){var _0x1e7bc0={};_0x1e7bc0[_0x82b14[_0x4045('0x26')]]={'$like':'%'+_0x1d9759[_0x4045('0x2f')][_0x4045('0x3a')]+'%'};return _0x1e7bc0;}})});}_0x1987e7=_[_0x4045('0x3c')]({},_0x1987e7,_0x1d9759[_0x4045('0x3e')]);var _0x3d0e19={'where':_0x1987e7[_0x4045('0x3b')]};return db[_0x4045('0x29')][_0x4045('0x1e')](_0x3d0e19)['then'](function(_0x73e313){_0x492f8d[_0x4045('0x1e')]=_0x73e313;if(_0x1d9759['query'][_0x4045('0x3f')]){_0x1987e7[_0x4045('0x40')]=[{'all':!![]}];}return db[_0x4045('0x29')]['findAll'](_0x1987e7);})[_0x4045('0x24')](function(_0x4708de){_0x492f8d['rows']=_0x4708de;return _0x492f8d;})[_0x4045('0x24')](respondWithFilteredResult(_0x1c1bd9,_0x1987e7))[_0x4045('0x41')](handleError(_0x1c1bd9,null));};exports[_0x4045('0x42')]=function(_0x1184f5,_0x2890a5){var _0x57577f={'raw':!![],'where':{'id':_0x1184f5[_0x4045('0x43')]['id']}},_0x12cb83={};_0x12cb83[_0x4045('0x2d')]=_['keys'](db[_0x4045('0x29')]['rawAttributes']);_0x12cb83[_0x4045('0x2f')]=_['keys'](_0x1184f5['query']);_0x12cb83['filters']=_[_0x4045('0x33')](_0x12cb83[_0x4045('0x2d')],_0x12cb83[_0x4045('0x2f')]);_0x57577f[_0x4045('0x32')]=_[_0x4045('0x33')](_0x12cb83[_0x4045('0x2d')],qs[_0x4045('0x34')](_0x1184f5[_0x4045('0x2f')]['fields']));_0x57577f[_0x4045('0x32')]=_0x57577f[_0x4045('0x32')][_0x4045('0x35')]?_0x57577f[_0x4045('0x32')]:_0x12cb83[_0x4045('0x2d')];if(_0x1184f5['query']['includeAll']){_0x57577f[_0x4045('0x40')]=[{'all':!![]}];}_0x57577f=_[_0x4045('0x3c')]({},_0x57577f,_0x1184f5[_0x4045('0x3e')]);return db[_0x4045('0x29')][_0x4045('0x44')](_0x57577f)[_0x4045('0x24')](handleEntityNotFound(_0x2890a5,null))['then'](respondWithResult(_0x2890a5,null))[_0x4045('0x41')](handleError(_0x2890a5,null));};exports[_0x4045('0x45')]=function(_0x55acab,_0x5c21da){return db[_0x4045('0x29')][_0x4045('0x45')](_0x55acab[_0x4045('0x46')],{})[_0x4045('0x24')](respondWithResult(_0x5c21da,0xc9))[_0x4045('0x41')](handleError(_0x5c21da,null));};exports[_0x4045('0x47')]=function(_0x470c98,_0x4db3e7){if(_0x470c98[_0x4045('0x46')]['id']){delete _0x470c98['body']['id'];}return db[_0x4045('0x29')][_0x4045('0x44')]({'where':{'id':_0x470c98[_0x4045('0x43')]['id']}})[_0x4045('0x24')](handleEntityNotFound(_0x4db3e7,null))[_0x4045('0x24')](saveUpdates(_0x470c98[_0x4045('0x46')],null))[_0x4045('0x24')](respondWithResult(_0x4db3e7,null))[_0x4045('0x41')](handleError(_0x4db3e7,null));};exports[_0x4045('0x23')]=function(_0x1407c3,_0x16f2d1){return db[_0x4045('0x29')][_0x4045('0x44')]({'where':{'id':_0x1407c3['params']['id']}})[_0x4045('0x24')](handleEntityNotFound(_0x16f2d1,null))[_0x4045('0x24')](removeEntity(_0x16f2d1,null))[_0x4045('0x41')](handleError(_0x16f2d1,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 1b948cc..f4c7be1 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 _0x694c=['moment','bluebird','request-promise','../../config/environment','define','Dynamics365Field','int_dynamics365_fields','idField','lodash','../../config/logger','api'];(function(_0xf04b83,_0x399c28){var _0x3d15eb=function(_0x3b554d){while(--_0x3b554d){_0xf04b83['push'](_0xf04b83['shift']());}};_0x3d15eb(++_0x399c28);}(_0x694c,0x1ec));var _0xc694=function(_0x576b09,_0x5d51c0){_0x576b09=_0x576b09-0x0;var _0x404ad6=_0x694c[_0x576b09];return _0x404ad6;};'use strict';var _=require(_0xc694('0x0'));var util=require('util');var logger=require(_0xc694('0x1'))(_0xc694('0x2'));var moment=require(_0xc694('0x3'));var BPromise=require(_0xc694('0x4'));var rp=require(_0xc694('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc694('0x6'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x32ad6a,_0x247d73){return _0x32ad6a[_0xc694('0x7')](_0xc694('0x8'),attributes,{'tableName':_0xc694('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xc694('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad96=['../../config/logger','api','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','idField','FieldId','lodash','util'];(function(_0x290694,_0x281935){var _0x5a0f2e=function(_0x58d7d4){while(--_0x58d7d4){_0x290694['push'](_0x290694['shift']());}};_0x5a0f2e(++_0x281935);}(_0xad96,0xec));var _0x6ad9=function(_0x5beb3b,_0x493142){_0x5beb3b=_0x5beb3b-0x0;var _0x44aa86=_0xad96[_0x5beb3b];return _0x44aa86;};'use strict';var _=require(_0x6ad9('0x0'));var util=require(_0x6ad9('0x1'));var logger=require(_0x6ad9('0x2'))(_0x6ad9('0x3'));var moment=require('moment');var BPromise=require(_0x6ad9('0x4'));var rp=require(_0x6ad9('0x5'));var fs=require('fs');var path=require(_0x6ad9('0x6'));var rimraf=require(_0x6ad9('0x7'));var config=require('../../config/environment');var attributes=require(_0x6ad9('0x8'));module[_0x6ad9('0x9')]=function(_0x19aa8a,_0x564067){return _0x19aa8a[_0x6ad9('0xa')](_0x6ad9('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x6ad9('0xc'),_0x6ad9('0xd')],'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 29367c7..76316fe 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 _0x2ca4=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2ca4,0x146));var _0x42ca=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x2ca4[_0x1ae491];return _0x4958a5;};'use strict';var _=require(_0x42ca('0x0'));var util=require(_0x42ca('0x1'));var moment=require(_0x42ca('0x2'));var BPromise=require(_0x42ca('0x3'));var rs=require(_0x42ca('0x4'));var fs=require('fs');var Redis=require(_0x42ca('0x5'));var db=require(_0x42ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x42ca('0x7'))(_0x42ca('0x8'));var config=require(_0x42ca('0x9'));var jayson=require(_0x42ca('0xa'));var client=jayson[_0x42ca('0xb')][_0x42ca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c5266,_0xd60bc7,_0x344205){return new BPromise(function(_0x41d3c6,_0x23bed7){return client[_0x42ca('0xd')](_0x5c5266,_0x344205)[_0x42ca('0xe')](function(_0x4f1ed3){logger[_0x42ca('0xf')](_0x42ca('0x10'),_0xd60bc7,_0x42ca('0x11'));logger[_0x42ca('0x12')](_0x42ca('0x13'),_0xd60bc7,_0x42ca('0x11'),JSON['stringify'](_0x4f1ed3));if(_0x4f1ed3[_0x42ca('0x14')]){if(_0x4f1ed3[_0x42ca('0x14')][_0x42ca('0x15')]===0x1f4){logger[_0x42ca('0x14')](_0x42ca('0x10'),_0xd60bc7,_0x4f1ed3[_0x42ca('0x14')]['message']);return _0x23bed7(_0x4f1ed3[_0x42ca('0x14')][_0x42ca('0x16')]);}logger[_0x42ca('0x14')](_0x42ca('0x10'),_0xd60bc7,_0x4f1ed3[_0x42ca('0x14')][_0x42ca('0x16')]);return _0x41d3c6(_0x4f1ed3[_0x42ca('0x14')][_0x42ca('0x16')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0xd60bc7,_0x42ca('0x11'));_0x41d3c6(_0x4f1ed3[_0x42ca('0x17')]['message']);}})[_0x42ca('0x18')](function(_0x2f2d22){logger['error'](_0x42ca('0x10'),_0xd60bc7,_0x2f2d22);_0x23bed7(_0x2f2d22);});});} \ No newline at end of file +var _0xc485=['info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1b9edd,_0x66b166){var _0x4907c4=function(_0x538091){while(--_0x538091){_0x1b9edd['push'](_0x1b9edd['shift']());}};_0x4907c4(++_0x66b166);}(_0xc485,0x1ba));var _0x5c48=function(_0x492b1c,_0x58840e){_0x492b1c=_0x492b1c-0x0;var _0xfd2d4c=_0xc485[_0x492b1c];return _0xfd2d4c;};'use strict';var _=require('lodash');var util=require(_0x5c48('0x0'));var moment=require(_0x5c48('0x1'));var BPromise=require('bluebird');var rs=require(_0x5c48('0x2'));var fs=require('fs');var Redis=require(_0x5c48('0x3'));var db=require(_0x5c48('0x4'))['db'];var utils=require(_0x5c48('0x5'));var logger=require(_0x5c48('0x6'))(_0x5c48('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5c48('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x60c8d7,_0x2f6e6b,_0x2146dd){return new BPromise(function(_0x431cbf,_0x1c62f7){return client[_0x5c48('0x9')](_0x60c8d7,_0x2146dd)[_0x5c48('0xa')](function(_0x254b56){logger['info'](_0x5c48('0xb'),_0x2f6e6b,'request\x20sent');logger['debug'](_0x5c48('0xc'),_0x2f6e6b,_0x5c48('0xd'),JSON[_0x5c48('0xe')](_0x254b56));if(_0x254b56[_0x5c48('0xf')]){if(_0x254b56['error'][_0x5c48('0x10')]===0x1f4){logger[_0x5c48('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x2f6e6b,_0x254b56[_0x5c48('0xf')][_0x5c48('0x11')]);return _0x1c62f7(_0x254b56[_0x5c48('0xf')][_0x5c48('0x11')]);}logger['error'](_0x5c48('0xb'),_0x2f6e6b,_0x254b56[_0x5c48('0xf')][_0x5c48('0x11')]);return _0x431cbf(_0x254b56[_0x5c48('0xf')][_0x5c48('0x11')]);}else{logger[_0x5c48('0x12')](_0x5c48('0xb'),_0x2f6e6b,'request\x20sent');_0x431cbf(_0x254b56[_0x5c48('0x13')][_0x5c48('0x11')]);}})['catch'](function(_0x36630f){logger[_0x5c48('0xf')](_0x5c48('0xb'),_0x2f6e6b,_0x36630f);_0x1c62f7(_0x36630f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index dcc9ad9..0d30487 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 _0xaad2=['multer','path','Router','fs-extra','../../components/interaction/service','isAuthenticated','get','/:id','show','/:id/configurations','post','create','put','update','delete','exports'];(function(_0x110f00,_0x541993){var _0x58c40e=function(_0x4e6307){while(--_0x4e6307){_0x110f00['push'](_0x110f00['shift']());}};_0x58c40e(++_0x541993);}(_0xaad2,0x70));var _0x2aad=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0xaad2[_0x4551f6];return _0x581dc2;};'use strict';var multer=require(_0x2aad('0x0'));var util=require('util');var path=require(_0x2aad('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2aad('0x2')]();var fs_extra=require(_0x2aad('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2aad('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x2aad('0x5')](),controller['index']);router[_0x2aad('0x6')](_0x2aad('0x7'),auth[_0x2aad('0x5')](),controller[_0x2aad('0x8')]);router[_0x2aad('0x6')](_0x2aad('0x9'),auth[_0x2aad('0x5')](),controller['getConfigurations']);router[_0x2aad('0x6')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x2aad('0xa')]('/',auth[_0x2aad('0x5')](),controller[_0x2aad('0xb')]);router[_0x2aad('0xa')](_0x2aad('0x9'),auth[_0x2aad('0x5')](),controller['addConfiguration']);router[_0x2aad('0xc')](_0x2aad('0x7'),auth[_0x2aad('0x5')](),controller[_0x2aad('0xd')]);router[_0x2aad('0xe')](_0x2aad('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x2aad('0xf')]=router; \ No newline at end of file +var _0x44b9=['/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0xaac1b5,_0x36328e){var _0x2d73bf=function(_0x5d62f6){while(--_0x5d62f6){_0xaac1b5['push'](_0xaac1b5['shift']());}};_0x2d73bf(++_0x36328e);}(_0x44b9,0x161));var _0x944b=function(_0x5d4168,_0x108dea){_0x5d4168=_0x5d4168-0x0;var _0x764e36=_0x44b9[_0x5d4168];return _0x764e36;};'use strict';var multer=require(_0x944b('0x0'));var util=require(_0x944b('0x1'));var path=require(_0x944b('0x2'));var timeout=require(_0x944b('0x3'));var express=require('express');var router=express[_0x944b('0x4')]();var fs_extra=require(_0x944b('0x5'));var auth=require(_0x944b('0x6'));var interaction=require(_0x944b('0x7'));var config=require('../../config/environment');var controller=require(_0x944b('0x8'));router[_0x944b('0x9')]('/',auth[_0x944b('0xa')](),controller['index']);router['get'](_0x944b('0xb'),auth[_0x944b('0xa')](),controller[_0x944b('0xc')]);router[_0x944b('0x9')](_0x944b('0xd'),auth[_0x944b('0xa')](),controller[_0x944b('0xe')]);router['get'](_0x944b('0xf'),auth['isAuthenticated'](),controller[_0x944b('0x10')]);router[_0x944b('0x11')]('/',auth['isAuthenticated'](),controller[_0x944b('0x12')]);router[_0x944b('0x11')](_0x944b('0xd'),auth[_0x944b('0xa')](),controller[_0x944b('0x13')]);router[_0x944b('0x14')](_0x944b('0xb'),auth['isAuthenticated'](),controller[_0x944b('0x15')]);router[_0x944b('0x16')]('/:id',auth[_0x944b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e48416e..f172443 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 _0x3266=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3518ab,_0x2c52de){var _0x33eba8=function(_0x105df7){while(--_0x105df7){_0x3518ab['push'](_0x3518ab['shift']());}};_0x33eba8(++_0x2c52de);}(_0x3266,0x6a));var _0x6326=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0x3266[_0x119705];return _0x2affc2;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'name':{'type':Sequelize[_0x6326('0x2')]},'description':{'type':Sequelize[_0x6326('0x2')]},'username':{'type':Sequelize[_0x6326('0x2')],'unique':_0x6326('0x3')},'apiKey':{'type':Sequelize[_0x6326('0x2')]},'remoteUri':{'type':Sequelize[_0x6326('0x2')],'unique':_0x6326('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x583c=['exports','STRING','username','sequelize'];(function(_0x5976e0,_0x2eb80f){var _0x42af1d=function(_0x76705){while(--_0x76705){_0x5976e0['push'](_0x5976e0['shift']());}};_0x42af1d(++_0x2eb80f);}(_0x583c,0x12b));var _0xc583=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x583c[_0x189305];return _0xea3406;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'apiKey':{'type':Sequelize[_0xc583('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc583('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index b2f746c..7c268a4 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 _0x6e6c=['Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','getConfigurations','FreshdeskConfiguration','sort','addConfiguration','AccountId','channel','Descriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set'];(function(_0x39c2ad,_0x4ba3e8){var _0x5a24ea=function(_0x6051ce){while(--_0x6051ce){_0x39c2ad['push'](_0x39c2ad['shift']());}};_0x5a24ea(++_0x4ba3e8);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xc6e6('0x0'));var rimraf=require(_0xc6e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e6('0x2'));var rp=require(_0xc6e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6e6('0x4'));var util=require('util');var path=require(_0xc6e6('0x5'));var sox=require('sox');var csv=require(_0xc6e6('0x6'));var ejs=require(_0xc6e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e6('0x8'));var squel=require(_0xc6e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc6e6('0xa'));var deskjs=require(_0xc6e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6e6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require(_0xc6e6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6e6('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3a30ce,_0x314d0f){_0x314d0f=_0x314d0f||0xcc;return function(_0x33aea0){if(_0x33aea0){return _0x3a30ce[_0xc6e6('0x17')](_0x314d0f);}return _0x3a30ce['status'](_0x314d0f)[_0xc6e6('0x18')]();};}function respondWithResult(_0x2bfe7d,_0x13be73){_0x13be73=_0x13be73||0xc8;return function(_0x1b6ca9){if(_0x1b6ca9){return _0x2bfe7d[_0xc6e6('0x19')](_0x13be73)['json'](_0x1b6ca9);}};}function respondWithFilteredResult(_0x413cf8,_0x178b34){return function(_0x569474){if(_0x569474){var _0x2f11b0=typeof _0x178b34[_0xc6e6('0x1a')]===_0xc6e6('0x1b')&&typeof _0x178b34['limit']==='undefined';var _0x5867bf=_0x569474[_0xc6e6('0x1c')];var _0x554262=_0x2f11b0?0x0:_0x178b34[_0xc6e6('0x1a')];var _0x2069e4=_0x2f11b0?_0x569474[_0xc6e6('0x1c')]:_0x178b34[_0xc6e6('0x1a')]+_0x178b34[_0xc6e6('0x1d')];var _0x3a0d83;if(_0x2069e4>=_0x5867bf){_0x2069e4=_0x5867bf;_0x3a0d83=0xc8;}else{_0x3a0d83=0xce;}_0x413cf8[_0xc6e6('0x19')](_0x3a0d83);return _0x413cf8[_0xc6e6('0x1e')](_0xc6e6('0x1f'),_0x554262+'-'+_0x2069e4+'/'+_0x5867bf)[_0xc6e6('0x20')](_0x569474);}return null;};}function patchUpdates(_0x4a36b6){return function(_0x428401){try{jsonpatch['apply'](_0x428401,_0x4a36b6,!![]);}catch(_0x1c34cc){return BPromise[_0xc6e6('0x21')](_0x1c34cc);}return _0x428401[_0xc6e6('0x22')]();};}function saveUpdates(_0x2f69f1,_0x4f1d68){return function(_0x35253d){if(_0x35253d){return _0x35253d[_0xc6e6('0x23')](_0x2f69f1)[_0xc6e6('0x24')](function(_0x36ebfa){return _0x36ebfa;});}return null;};}function removeEntity(_0x107561,_0x4c35ae){return function(_0x41fe96){if(_0x41fe96){return _0x41fe96['destroy']()[_0xc6e6('0x24')](function(){_0x107561[_0xc6e6('0x19')](0xcc)[_0xc6e6('0x18')]();});}};}function handleEntityNotFound(_0x64e1dc,_0x53a1bf){return function(_0x3ff8a4){if(!_0x3ff8a4){_0x64e1dc['sendStatus'](0x194);}return _0x3ff8a4;};}function handleError(_0x28577b,_0x534745){_0x534745=_0x534745||0x1f4;return function(_0x267c6a){logger[_0xc6e6('0x25')](_0x267c6a[_0xc6e6('0x26')]);if(_0x267c6a[_0xc6e6('0x27')]){delete _0x267c6a[_0xc6e6('0x27')];}_0x28577b['status'](_0x534745)[_0xc6e6('0x28')](_0x267c6a);};}exports[_0xc6e6('0x29')]=function(_0x166313,_0x1af05c){var _0x4d1284={},_0x34ae96={},_0x50b735={'count':0x0,'rows':[]};var _0x29411c=_[_0xc6e6('0x2a')](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')],function(_0xd3b63){return{'name':_0xd3b63[_0xc6e6('0x2d')],'type':_0xd3b63[_0xc6e6('0x2e')][_0xc6e6('0x2f')]};});_0x34ae96[_0xc6e6('0x30')]=_[_0xc6e6('0x2a')](_0x29411c,_0xc6e6('0x27'));_0x34ae96[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x166313[_0xc6e6('0x31')]);_0x34ae96[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x34ae96[_0xc6e6('0x30')],_0x34ae96['query']);_0x4d1284[_0xc6e6('0x35')]=_[_0xc6e6('0x34')](_0x34ae96['model'],qs['fields'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x4d1284[_0xc6e6('0x35')]=_0x4d1284[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x4d1284[_0xc6e6('0x35')]:_0x34ae96['model'];if(!_0x166313[_0xc6e6('0x31')][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x4d1284['limit']=qs['limit'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x1d')]);_0x4d1284[_0xc6e6('0x1a')]=qs[_0xc6e6('0x1a')](_0x166313['query']['offset']);}_0x4d1284[_0xc6e6('0x3a')]=qs['sort'](_0x166313[_0xc6e6('0x31')]['sort']);_0x4d1284[_0xc6e6('0x3b')]=qs[_0xc6e6('0x33')](_[_0xc6e6('0x3c')](_0x166313[_0xc6e6('0x31')],_0x34ae96['filters']),_0x29411c);if(_0x166313['query'][_0xc6e6('0x3d')]){_0x4d1284[_0xc6e6('0x3b')]=_[_0xc6e6('0x3e')](_0x4d1284[_0xc6e6('0x3b')],{'$or':_['map'](_0x29411c,function(_0x4cbdcf){if(_0x4cbdcf[_0xc6e6('0x2e')]!==_0xc6e6('0x3f')){var _0x3a9104={};_0x3a9104[_0x4cbdcf[_0xc6e6('0x27')]]={'$like':'%'+_0x166313['query'][_0xc6e6('0x3d')]+'%'};return _0x3a9104;}})});}_0x4d1284=_[_0xc6e6('0x3e')]({},_0x4d1284,_0x166313['options']);var _0x500b7e={'where':_0x4d1284[_0xc6e6('0x3b')]};return db['FreshdeskAccount'][_0xc6e6('0x1c')](_0x500b7e)[_0xc6e6('0x24')](function(_0x53d313){_0x50b735[_0xc6e6('0x1c')]=_0x53d313;if(_0x166313['query'][_0xc6e6('0x40')]){_0x4d1284['include']=[{'all':!![]}];}return db[_0xc6e6('0x2b')][_0xc6e6('0x41')](_0x4d1284);})[_0xc6e6('0x24')](function(_0x2f7af9){_0x50b735[_0xc6e6('0x42')]=_0x2f7af9;return _0x50b735;})[_0xc6e6('0x24')](respondWithFilteredResult(_0x1af05c,_0x4d1284))[_0xc6e6('0x43')](handleError(_0x1af05c,null));};exports[_0xc6e6('0x44')]=function(_0x5ecf6c,_0x5722db){var _0x3e3da6={'raw':![],'where':{'id':_0x5ecf6c[_0xc6e6('0x45')]['id']}},_0x2b494f={};_0x2b494f[_0xc6e6('0x30')]=_['keys'](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')]);_0x2b494f[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x5ecf6c['query']);_0x2b494f[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x2b494f[_0xc6e6('0x30')],_0x2b494f[_0xc6e6('0x31')]);_0x3e3da6[_0xc6e6('0x35')]=_['intersection'](_0x2b494f[_0xc6e6('0x30')],qs['fields'](_0x5ecf6c[_0xc6e6('0x31')]['fields']));_0x3e3da6[_0xc6e6('0x35')]=_0x3e3da6[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x3e3da6[_0xc6e6('0x35')]:_0x2b494f[_0xc6e6('0x30')];if(_0x5ecf6c[_0xc6e6('0x31')][_0xc6e6('0x40')]){_0x3e3da6[_0xc6e6('0x46')]=[{'all':!![]}];}_0x3e3da6=_['merge']({},_0x3e3da6,_0x5ecf6c[_0xc6e6('0x47')]);return db[_0xc6e6('0x2b')][_0xc6e6('0x48')](_0x3e3da6)['then'](handleEntityNotFound(_0x5722db,null))[_0xc6e6('0x24')](respondWithResult(_0x5722db,null))[_0xc6e6('0x43')](handleError(_0x5722db,null));};exports[_0xc6e6('0x49')]=function(_0x42ed90,_0x7ba471){return db[_0xc6e6('0x2b')][_0xc6e6('0x49')](_0x42ed90[_0xc6e6('0x4a')],{})[_0xc6e6('0x24')](respondWithResult(_0x7ba471,0xc9))[_0xc6e6('0x43')](handleError(_0x7ba471,null));};exports[_0xc6e6('0x23')]=function(_0x470167,_0x3e0117){if(_0x470167[_0xc6e6('0x4a')]['id']){delete _0x470167['body']['id'];}return db[_0xc6e6('0x2b')]['find']({'where':{'id':_0x470167[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x3e0117,null))['then'](saveUpdates(_0x470167['body'],null))['then'](respondWithResult(_0x3e0117,null))['catch'](handleError(_0x3e0117,null));};exports['destroy']=function(_0x3edc16,_0x40bbe9){return db[_0xc6e6('0x2b')][_0xc6e6('0x48')]({'where':{'id':_0x3edc16[_0xc6e6('0x45')]['id']}})['then'](handleEntityNotFound(_0x40bbe9,null))['then'](removeEntity(_0x40bbe9,null))[_0xc6e6('0x43')](handleError(_0x40bbe9,null));};exports[_0xc6e6('0x4b')]=function(_0x1aa872,_0x48ba2e,_0x577840){var _0x120a00={};var _0x467e9b={};var _0x286dc1;var _0x286dcf;return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x1aa872[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x48ba2e,null))[_0xc6e6('0x24')](function(_0x5113e3){if(_0x5113e3){_0x286dc1=_0x5113e3;_0x467e9b[_0xc6e6('0x30')]=_[_0xc6e6('0x32')](db[_0xc6e6('0x4c')][_0xc6e6('0x2c')]);_0x467e9b[_0xc6e6('0x31')]=_['keys'](_0x1aa872[_0xc6e6('0x31')]);_0x467e9b[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x467e9b[_0xc6e6('0x30')],_0x467e9b[_0xc6e6('0x31')]);_0x120a00['attributes']=_['intersection'](_0x467e9b['model'],qs[_0xc6e6('0x36')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x120a00[_0xc6e6('0x35')]=_0x120a00[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x120a00['attributes']:_0x467e9b[_0xc6e6('0x30')];_0x120a00['order']=qs[_0xc6e6('0x4d')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x4d')]);_0x120a00['where']=qs[_0xc6e6('0x33')](_['pick'](_0x1aa872[_0xc6e6('0x31')],_0x467e9b['filters']));if(_0x1aa872['query'][_0xc6e6('0x3d')]){_0x120a00['where']=_['merge'](_0x120a00[_0xc6e6('0x3b')],{'$or':_[_0xc6e6('0x2a')](_0x120a00[_0xc6e6('0x35')],function(_0x20c4cf){var _0x414bc4={};_0x414bc4[_0x20c4cf]={'$like':'%'+_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x3d')]+'%'};return _0x414bc4;})});}_0x120a00=_[_0xc6e6('0x3e')]({},_0x120a00,_0x1aa872['options']);return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x35b43f){if(_0x35b43f){_0x286dcf=_0x35b43f[_0xc6e6('0x37')];if(!_0x1aa872['query'][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x120a00[_0xc6e6('0x1d')]=qs['limit'](_0x1aa872['query'][_0xc6e6('0x1d')]);_0x120a00['offset']=qs['offset'](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x1a')]);}return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x269f63){if(_0x269f63){return _0x269f63?{'count':_0x286dcf,'rows':_0x269f63}:null;}})[_0xc6e6('0x24')](respondWithResult(_0x48ba2e,null))[_0xc6e6('0x43')](handleError(_0x48ba2e,null));};exports[_0xc6e6('0x4e')]=function(_0x8bfc70,_0x1956be,_0x15404a){if(_0x8bfc70['body']['id']){delete _0x8bfc70['body']['id'];}return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x8bfc70['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x1956be,null))[_0xc6e6('0x24')](function(_0x27c5f0){if(_0x27c5f0){_0x8bfc70['body'][_0xc6e6('0x4f')]=_0x27c5f0['id'];_0x8bfc70[_0xc6e6('0x4a')]['Subjects']=integrations['getSubjects'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x51')]=integrations['getDescriptions'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);return db[_0xc6e6('0x4c')]['create'](_0x8bfc70[_0xc6e6('0x4a')],{'include':[{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x53')},{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x51')}]});}return null;})[_0xc6e6('0x24')](respondWithResult(_0x1956be,null))['catch'](handleError(_0x1956be,null));};exports[_0xc6e6('0x54')]=function(_0x4c4985,_0x46c3df,_0x5c2cfc){var _0x55cec5='';return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x4c4985[_0xc6e6('0x45')]['id']},'attributes':['id',_0xc6e6('0x55'),_0xc6e6('0x56')]})[_0xc6e6('0x24')](handleEntityNotFound(_0x46c3df,null))[_0xc6e6('0x24')](function(_0x5a9ba5){if(_0x5a9ba5){_0x55cec5=_0x5a9ba5[_0xc6e6('0x55')];var _0x5c09b0=_0x55cec5['slice'](-0x1);if(_0x5c09b0==='/'){_0x55cec5=_0x55cec5[_0xc6e6('0x57')](0x0,_0x55cec5[_0xc6e6('0x58')](_0x5c09b0));}return rp({'method':_0xc6e6('0x59'),'uri':util['format'](_0xc6e6('0x5a'),_0x55cec5,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0xc6e6('0x5b'),new Buffer(util['format'](_0xc6e6('0x5c'),_0x5a9ba5[_0xc6e6('0x56')]))[_0xc6e6('0x5d')](_0xc6e6('0x5e')))},'json':!![]});}})['then'](function(_0x2d0d4d){if(_0x2d0d4d){var _0x9306c=[_0xc6e6('0x5f'),_0xc6e6('0x60'),_0xc6e6('0x61'),'description',_0xc6e6('0x19'),_0xc6e6('0x62'),_0xc6e6('0x63'),_0xc6e6('0x64'),'ticket_type','group',_0xc6e6('0x65')];_[_0xc6e6('0x66')](_0x2d0d4d,function(_0x42159c){return _0x9306c[_0xc6e6('0x67')](_0x42159c[_0xc6e6('0x27')])||!_0x42159c[_0xc6e6('0x68')]&&_0x42159c[_0xc6e6('0x2e')]!==_0xc6e6('0x69')&&_0x42159c[_0xc6e6('0x2e')]!=='custom_dropdown';});return{'count':_0x2d0d4d['length'],'rows':_[_0xc6e6('0x2a')](_0x2d0d4d,function(_0x5c9b92){return{'id':_0x5c9b92[_0xc6e6('0x27')],'name':_0x5c9b92[_0xc6e6('0x6a')],'custom':!_0x5c9b92[_0xc6e6('0x68')],'options':_0x5c9b92['choices']?_['map'](_0x5c9b92[_0xc6e6('0x6b')],function(_0x58b236){return{'name':_[_0xc6e6('0x6c')](_0x58b236),'value':_0x58b236};}):[]};})};}})['then'](respondWithResult(_0x46c3df,null))[_0xc6e6('0x43')](function(_0x3403b7){var _0x5d867e=_0x4c4985[_0xc6e6('0x31')][_0xc6e6('0x6d')]?0x1f4:_0x3403b7[_0xc6e6('0x6e')]||0x1f4;logger['error'](_0xc6e6('0x6f'),_0xc6e6('0x54'),_0x5d867e,JSON[_0xc6e6('0x70')](_0x3403b7));delete _0x3403b7['name'];if(_0x5d867e===0x191){_0x5d867e=0x190;}_0x46c3df[_0xc6e6('0x19')](_0x5d867e)[_0xc6e6('0x28')](_0x4c4985['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x3403b7[_0xc6e6('0x6e')]}:_0x3403b7);});}; \ No newline at end of file +var _0x09dd=['remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','offset','count','limit','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','FreshdeskAccount','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','rawAttributes','length','include','options','find','create','body','params','getConfigurations','findOne','AccountId','Subjects','Descriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','requester','description','priority','group','source','company'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x09dd,0x81));var _0xd09d=function(_0x4e4154,_0x1ffe63){_0x4e4154=_0x4e4154-0x0;var _0x53a194=_0x09dd[_0x4e4154];return _0x53a194;};'use strict';var emlformat=require(_0xd09d('0x0'));var rimraf=require(_0xd09d('0x1'));var zipdir=require(_0xd09d('0x2'));var jsonpatch=require(_0xd09d('0x3'));var rp=require(_0xd09d('0x4'));var moment=require(_0xd09d('0x5'));var BPromise=require(_0xd09d('0x6'));var Mustache=require(_0xd09d('0x7'));var util=require(_0xd09d('0x8'));var path=require(_0xd09d('0x9'));var sox=require(_0xd09d('0xa'));var csv=require(_0xd09d('0xb'));var ejs=require(_0xd09d('0xc'));var fs=require('fs');var fs_extra=require(_0xd09d('0xd'));var _=require('lodash');var squel=require(_0xd09d('0xe'));var crypto=require(_0xd09d('0xf'));var jsforce=require(_0xd09d('0x10'));var deskjs=require(_0xd09d('0x11'));var toCsv=require(_0xd09d('0xb'));var querystring=require(_0xd09d('0x12'));var Papa=require(_0xd09d('0x13'));var Redis=require('ioredis');var authService=require(_0xd09d('0x14'));var qs=require(_0xd09d('0x15'));var as=require(_0xd09d('0x16'));var hardwareService=require(_0xd09d('0x17'));var logger=require(_0xd09d('0x18'))('api');var utils=require(_0xd09d('0x19'));var config=require(_0xd09d('0x1a'));var licenseUtil=require(_0xd09d('0x1b'));var db=require(_0xd09d('0x1c'))['db'];var integrations=require(_0xd09d('0x1d'));function respondWithStatusCode(_0x8b8fa7,_0x270b54){_0x270b54=_0x270b54||0xcc;return function(_0x5cd5c8){if(_0x5cd5c8){return _0x8b8fa7[_0xd09d('0x1e')](_0x270b54);}return _0x8b8fa7['status'](_0x270b54)['end']();};}function respondWithResult(_0x532b76,_0x24aae0){_0x24aae0=_0x24aae0||0xc8;return function(_0x2a3342){if(_0x2a3342){return _0x532b76[_0xd09d('0x1f')](_0x24aae0)[_0xd09d('0x20')](_0x2a3342);}};}function respondWithFilteredResult(_0x1486c6,_0x48e9db){return function(_0x435cff){if(_0x435cff){var _0x39bc63=typeof _0x48e9db['offset']===_0xd09d('0x21')&&typeof _0x48e9db['limit']===_0xd09d('0x21');var _0x1a22f4=_0x435cff['count'];var _0x26cc6e=_0x39bc63?0x0:_0x48e9db[_0xd09d('0x22')];var _0x23bea4=_0x39bc63?_0x435cff[_0xd09d('0x23')]:_0x48e9db['offset']+_0x48e9db[_0xd09d('0x24')];var _0x5a26b1;if(_0x23bea4>=_0x1a22f4){_0x23bea4=_0x1a22f4;_0x5a26b1=0xc8;}else{_0x5a26b1=0xce;}_0x1486c6[_0xd09d('0x1f')](_0x5a26b1);return _0x1486c6[_0xd09d('0x25')]('Content-Range',_0x26cc6e+'-'+_0x23bea4+'/'+_0x1a22f4)['json'](_0x435cff);}return null;};}function patchUpdates(_0x549b19){return function(_0x223a73){try{jsonpatch[_0xd09d('0x26')](_0x223a73,_0x549b19,!![]);}catch(_0x5e7f4f){return BPromise[_0xd09d('0x27')](_0x5e7f4f);}return _0x223a73['save']();};}function saveUpdates(_0x545488,_0x4b9e21){return function(_0x26159d){if(_0x26159d){return _0x26159d[_0xd09d('0x28')](_0x545488)['then'](function(_0x4fdbb0){return _0x4fdbb0;});}return null;};}function removeEntity(_0x447245,_0x2e9bbe){return function(_0x1170bf){if(_0x1170bf){return _0x1170bf[_0xd09d('0x29')]()[_0xd09d('0x2a')](function(){_0x447245[_0xd09d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a0d56,_0x498995){return function(_0x1f7d0d){if(!_0x1f7d0d){_0x9a0d56[_0xd09d('0x1e')](0x194);}return _0x1f7d0d;};}function handleError(_0x16bc15,_0x411a15){_0x411a15=_0x411a15||0x1f4;return function(_0xbae01c){logger[_0xd09d('0x2b')](_0xbae01c[_0xd09d('0x2c')]);if(_0xbae01c[_0xd09d('0x2d')]){delete _0xbae01c[_0xd09d('0x2d')];}_0x16bc15[_0xd09d('0x1f')](_0x411a15)[_0xd09d('0x2e')](_0xbae01c);};}exports[_0xd09d('0x2f')]=function(_0x5a0dfd,_0x2628cc){var _0x314d88={},_0x1ff591={},_0x35cdc8={'count':0x0,'rows':[]};var _0xe42b0b=_[_0xd09d('0x30')](db[_0xd09d('0x31')]['rawAttributes'],function(_0x124c41){return{'name':_0x124c41[_0xd09d('0x32')],'type':_0x124c41['type']['key']};});_0x1ff591[_0xd09d('0x33')]=_[_0xd09d('0x30')](_0xe42b0b,_0xd09d('0x2d'));_0x1ff591[_0xd09d('0x34')]=_[_0xd09d('0x35')](_0x5a0dfd[_0xd09d('0x34')]);_0x1ff591[_0xd09d('0x36')]=_['intersection'](_0x1ff591['model'],_0x1ff591[_0xd09d('0x34')]);_0x314d88[_0xd09d('0x37')]=_[_0xd09d('0x38')](_0x1ff591[_0xd09d('0x33')],qs[_0xd09d('0x39')](_0x5a0dfd['query']['fields']));_0x314d88['attributes']=_0x314d88[_0xd09d('0x37')]['length']?_0x314d88['attributes']:_0x1ff591[_0xd09d('0x33')];if(!_0x5a0dfd[_0xd09d('0x34')][_0xd09d('0x3a')](_0xd09d('0x3b'))){_0x314d88[_0xd09d('0x24')]=qs[_0xd09d('0x24')](_0x5a0dfd['query'][_0xd09d('0x24')]);_0x314d88[_0xd09d('0x22')]=qs[_0xd09d('0x22')](_0x5a0dfd[_0xd09d('0x34')]['offset']);}_0x314d88[_0xd09d('0x3c')]=qs[_0xd09d('0x3d')](_0x5a0dfd[_0xd09d('0x34')][_0xd09d('0x3d')]);_0x314d88[_0xd09d('0x3e')]=qs[_0xd09d('0x36')](_[_0xd09d('0x3f')](_0x5a0dfd['query'],_0x1ff591[_0xd09d('0x36')]),_0xe42b0b);if(_0x5a0dfd[_0xd09d('0x34')][_0xd09d('0x40')]){_0x314d88[_0xd09d('0x3e')]=_[_0xd09d('0x41')](_0x314d88['where'],{'$or':_['map'](_0xe42b0b,function(_0x17eb3d){if(_0x17eb3d[_0xd09d('0x42')]!==_0xd09d('0x43')){var _0x1757f6={};_0x1757f6[_0x17eb3d[_0xd09d('0x2d')]]={'$like':'%'+_0x5a0dfd['query']['filter']+'%'};return _0x1757f6;}})});}_0x314d88=_[_0xd09d('0x41')]({},_0x314d88,_0x5a0dfd['options']);var _0x6ce455={'where':_0x314d88['where']};return db[_0xd09d('0x31')]['count'](_0x6ce455)['then'](function(_0x434b35){_0x35cdc8[_0xd09d('0x23')]=_0x434b35;if(_0x5a0dfd[_0xd09d('0x34')][_0xd09d('0x44')]){_0x314d88['include']=[{'all':!![]}];}return db[_0xd09d('0x31')][_0xd09d('0x45')](_0x314d88);})[_0xd09d('0x2a')](function(_0x3f7769){_0x35cdc8[_0xd09d('0x46')]=_0x3f7769;return _0x35cdc8;})[_0xd09d('0x2a')](respondWithFilteredResult(_0x2628cc,_0x314d88))[_0xd09d('0x47')](handleError(_0x2628cc,null));};exports[_0xd09d('0x48')]=function(_0x4531c3,_0x1290f3){var _0x26ecd2={'raw':![],'where':{'id':_0x4531c3['params']['id']}},_0x52b5bb={};_0x52b5bb[_0xd09d('0x33')]=_[_0xd09d('0x35')](db['FreshdeskAccount'][_0xd09d('0x49')]);_0x52b5bb['query']=_[_0xd09d('0x35')](_0x4531c3[_0xd09d('0x34')]);_0x52b5bb[_0xd09d('0x36')]=_['intersection'](_0x52b5bb[_0xd09d('0x33')],_0x52b5bb[_0xd09d('0x34')]);_0x26ecd2[_0xd09d('0x37')]=_[_0xd09d('0x38')](_0x52b5bb[_0xd09d('0x33')],qs['fields'](_0x4531c3[_0xd09d('0x34')][_0xd09d('0x39')]));_0x26ecd2[_0xd09d('0x37')]=_0x26ecd2['attributes'][_0xd09d('0x4a')]?_0x26ecd2[_0xd09d('0x37')]:_0x52b5bb[_0xd09d('0x33')];if(_0x4531c3[_0xd09d('0x34')][_0xd09d('0x44')]){_0x26ecd2[_0xd09d('0x4b')]=[{'all':!![]}];}_0x26ecd2=_[_0xd09d('0x41')]({},_0x26ecd2,_0x4531c3[_0xd09d('0x4c')]);return db[_0xd09d('0x31')][_0xd09d('0x4d')](_0x26ecd2)['then'](handleEntityNotFound(_0x1290f3,null))[_0xd09d('0x2a')](respondWithResult(_0x1290f3,null))[_0xd09d('0x47')](handleError(_0x1290f3,null));};exports[_0xd09d('0x4e')]=function(_0x4bc001,_0x574aba){return db[_0xd09d('0x31')]['create'](_0x4bc001[_0xd09d('0x4f')],{})[_0xd09d('0x2a')](respondWithResult(_0x574aba,0xc9))[_0xd09d('0x47')](handleError(_0x574aba,null));};exports[_0xd09d('0x28')]=function(_0x191d9b,_0x33cf7d){if(_0x191d9b[_0xd09d('0x4f')]['id']){delete _0x191d9b[_0xd09d('0x4f')]['id'];}return db[_0xd09d('0x31')]['find']({'where':{'id':_0x191d9b[_0xd09d('0x50')]['id']}})[_0xd09d('0x2a')](handleEntityNotFound(_0x33cf7d,null))[_0xd09d('0x2a')](saveUpdates(_0x191d9b['body'],null))['then'](respondWithResult(_0x33cf7d,null))['catch'](handleError(_0x33cf7d,null));};exports[_0xd09d('0x29')]=function(_0x33e041,_0x268665){return db[_0xd09d('0x31')]['find']({'where':{'id':_0x33e041['params']['id']}})[_0xd09d('0x2a')](handleEntityNotFound(_0x268665,null))[_0xd09d('0x2a')](removeEntity(_0x268665,null))[_0xd09d('0x47')](handleError(_0x268665,null));};exports[_0xd09d('0x51')]=function(_0x120780,_0x65a5d8,_0x4f98e3){var _0x3bd178={};var _0x34e009={};var _0x585b10;var _0x22fe23;return db[_0xd09d('0x31')][_0xd09d('0x52')]({'where':{'id':_0x120780[_0xd09d('0x50')]['id']}})['then'](handleEntityNotFound(_0x65a5d8,null))[_0xd09d('0x2a')](function(_0x423885){if(_0x423885){_0x585b10=_0x423885;_0x34e009[_0xd09d('0x33')]=_[_0xd09d('0x35')](db['FreshdeskConfiguration'][_0xd09d('0x49')]);_0x34e009[_0xd09d('0x34')]=_['keys'](_0x120780[_0xd09d('0x34')]);_0x34e009[_0xd09d('0x36')]=_[_0xd09d('0x38')](_0x34e009[_0xd09d('0x33')],_0x34e009['query']);_0x3bd178[_0xd09d('0x37')]=_['intersection'](_0x34e009[_0xd09d('0x33')],qs['fields'](_0x120780['query']['fields']));_0x3bd178['attributes']=_0x3bd178[_0xd09d('0x37')]['length']?_0x3bd178['attributes']:_0x34e009[_0xd09d('0x33')];_0x3bd178['order']=qs['sort'](_0x120780[_0xd09d('0x34')][_0xd09d('0x3d')]);_0x3bd178[_0xd09d('0x3e')]=qs[_0xd09d('0x36')](_[_0xd09d('0x3f')](_0x120780[_0xd09d('0x34')],_0x34e009[_0xd09d('0x36')]));if(_0x120780[_0xd09d('0x34')][_0xd09d('0x40')]){_0x3bd178['where']=_[_0xd09d('0x41')](_0x3bd178['where'],{'$or':_['map'](_0x3bd178[_0xd09d('0x37')],function(_0x4c6516){var _0x5a883d={};_0x5a883d[_0x4c6516]={'$like':'%'+_0x120780[_0xd09d('0x34')][_0xd09d('0x40')]+'%'};return _0x5a883d;})});}_0x3bd178=_[_0xd09d('0x41')]({},_0x3bd178,_0x120780[_0xd09d('0x4c')]);return _0x585b10[_0xd09d('0x51')](_0x3bd178);}})[_0xd09d('0x2a')](function(_0x3e81ba){if(_0x3e81ba){_0x22fe23=_0x3e81ba[_0xd09d('0x4a')];if(!_0x120780[_0xd09d('0x34')]['hasOwnProperty'](_0xd09d('0x3b'))){_0x3bd178[_0xd09d('0x24')]=qs[_0xd09d('0x24')](_0x120780[_0xd09d('0x34')][_0xd09d('0x24')]);_0x3bd178['offset']=qs[_0xd09d('0x22')](_0x120780[_0xd09d('0x34')]['offset']);}return _0x585b10['getConfigurations'](_0x3bd178);}})[_0xd09d('0x2a')](function(_0x22ab33){if(_0x22ab33){return _0x22ab33?{'count':_0x22fe23,'rows':_0x22ab33}:null;}})[_0xd09d('0x2a')](respondWithResult(_0x65a5d8,null))['catch'](handleError(_0x65a5d8,null));};exports['addConfiguration']=function(_0x496beb,_0x53a8a,_0x1130c0){if(_0x496beb[_0xd09d('0x4f')]['id']){delete _0x496beb[_0xd09d('0x4f')]['id'];}return db['FreshdeskAccount'][_0xd09d('0x52')]({'where':{'id':_0x496beb['params']['id']}})['then'](handleEntityNotFound(_0x53a8a,null))['then'](function(_0x11ad2d){if(_0x11ad2d){_0x496beb['body'][_0xd09d('0x53')]=_0x11ad2d['id'];_0x496beb['body'][_0xd09d('0x54')]=integrations['getSubjects'](_0x496beb[_0xd09d('0x4f')]['channel'],_0x496beb['body'][_0xd09d('0x42')]);_0x496beb[_0xd09d('0x4f')][_0xd09d('0x55')]=integrations['getDescriptions'](_0x496beb[_0xd09d('0x4f')][_0xd09d('0x56')],_0x496beb['body'][_0xd09d('0x42')]);return db[_0xd09d('0x57')][_0xd09d('0x4e')](_0x496beb[_0xd09d('0x4f')],{'include':[{'model':db[_0xd09d('0x58')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0xd09d('0x55')}]});}return null;})[_0xd09d('0x2a')](respondWithResult(_0x53a8a,null))[_0xd09d('0x47')](handleError(_0x53a8a,null));};exports[_0xd09d('0x59')]=function(_0x5a0185,_0x36e1be,_0x14cee4){var _0x1186d7='';return db['FreshdeskAccount'][_0xd09d('0x52')]({'where':{'id':_0x5a0185[_0xd09d('0x50')]['id']},'attributes':['id',_0xd09d('0x5a'),_0xd09d('0x5b')]})['then'](handleEntityNotFound(_0x36e1be,null))[_0xd09d('0x2a')](function(_0x142553){if(_0x142553){_0x1186d7=_0x142553[_0xd09d('0x5a')];var _0xd6b220=_0x1186d7['slice'](-0x1);if(_0xd6b220==='/'){_0x1186d7=_0x1186d7['substring'](0x0,_0x1186d7['lastIndexOf'](_0xd6b220));}return rp({'method':_0xd09d('0x5c'),'uri':util['format'](_0xd09d('0x5d'),_0x1186d7,_0xd09d('0x5e')),'headers':{'Authorization':util[_0xd09d('0x5f')](_0xd09d('0x60'),new Buffer(util[_0xd09d('0x5f')](_0xd09d('0x61'),_0x142553['apiKey']))[_0xd09d('0x62')]('base64'))},'json':!![]});}})['then'](function(_0x4013af){if(_0x4013af){var _0x40c152=[_0xd09d('0x63'),'subject','agent',_0xd09d('0x64'),_0xd09d('0x1f'),_0xd09d('0x65'),_0xd09d('0x66'),_0xd09d('0x67'),'ticket_type',_0xd09d('0x66'),_0xd09d('0x68')];_[_0xd09d('0x69')](_0x4013af,function(_0x5665b3){return _0x40c152[_0xd09d('0x6a')](_0x5665b3['name'])||!_0x5665b3[_0xd09d('0x6b')]&&_0x5665b3[_0xd09d('0x42')]!==_0xd09d('0x6c')&&_0x5665b3['type']!==_0xd09d('0x6d');});return{'count':_0x4013af[_0xd09d('0x4a')],'rows':_['map'](_0x4013af,function(_0x33ab96){return{'id':_0x33ab96[_0xd09d('0x2d')],'name':_0x33ab96[_0xd09d('0x6e')],'custom':!_0x33ab96[_0xd09d('0x6b')],'options':_0x33ab96[_0xd09d('0x6f')]?_[_0xd09d('0x30')](_0x33ab96['choices'],function(_0x5e8f04){return{'name':_[_0xd09d('0x70')](_0x5e8f04),'value':_0x5e8f04};}):[]};})};}})[_0xd09d('0x2a')](respondWithResult(_0x36e1be,null))[_0xd09d('0x47')](function(_0x4ad01d){var _0x24a26b=_0x5a0185['query']['test']?0x1f4:_0x4ad01d['statusCode']||0x1f4;logger['error'](_0xd09d('0x71'),_0xd09d('0x59'),_0x24a26b,JSON['stringify'](_0x4ad01d));delete _0x4ad01d['name'];if(_0x24a26b===0x191){_0x24a26b=0x190;}_0x36e1be['status'](_0x24a26b)[_0xd09d('0x2e')](_0x5a0185[_0xd09d('0x34')][_0xd09d('0x72')]?{'message':_0xd09d('0x73'),'statusCode':_0x4ad01d[_0xd09d('0x74')]}:_0x4ad01d);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 8eabef6..8f3d206 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 _0xf207=['../../config/environment','./intFreshdeskAccount.attributes','define','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5c6a78,_0x5c0503){var _0x236c5e=function(_0x44ef45){while(--_0x44ef45){_0x5c6a78['push'](_0x5c6a78['shift']());}};_0x236c5e(++_0x5c0503);}(_0xf207,0x17f));var _0x7f20=function(_0x3333bb,_0x1df222){_0x3333bb=_0x3333bb-0x0;var _0x273d39=_0xf207[_0x3333bb];return _0x273d39;};'use strict';var _=require(_0x7f20('0x0'));var util=require('util');var logger=require(_0x7f20('0x1'))(_0x7f20('0x2'));var moment=require('moment');var BPromise=require(_0x7f20('0x3'));var rp=require(_0x7f20('0x4'));var fs=require('fs');var path=require(_0x7f20('0x5'));var rimraf=require(_0x7f20('0x6'));var config=require(_0x7f20('0x7'));var attributes=require(_0x7f20('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5c8789,_0x10b3ca){return _0x5c8789[_0x7f20('0x9')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f8b=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x279388,_0x6775fe){var _0x30b8df=function(_0x1cb544){while(--_0x1cb544){_0x279388['push'](_0x279388['shift']());}};_0x30b8df(++_0x6775fe);}(_0x7f8b,0x19a));var _0xb7f8=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x7f8b[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xb7f8('0x0'));var util=require(_0xb7f8('0x1'));var logger=require(_0xb7f8('0x2'))('api');var moment=require(_0xb7f8('0x3'));var BPromise=require(_0xb7f8('0x4'));var rp=require(_0xb7f8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7f8('0x6'));var config=require(_0xb7f8('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xb7f8('0x8')]=function(_0x5435b7,_0x1d67c8){return _0x5435b7[_0xb7f8('0x9')](_0xb7f8('0xa'),attributes,{'tableName':_0xb7f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 68e95ec..b451627 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 _0xe35a=['model','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetFreshdeskAccount','findAll','options','raw','limit','map','include','attributes','FreshdeskAccount','where'];(function(_0x1d839f,_0x43264b){var _0x1b3914=function(_0x192bbd){while(--_0x192bbd){_0x1d839f['push'](_0x1d839f['shift']());}};_0x1b3914(++_0x43264b);}(_0xe35a,0x1a6));var _0xae35=function(_0x55dee9,_0x3a5fc6){_0x55dee9=_0x55dee9-0x0;var _0x22c839=_0xe35a[_0x55dee9];return _0x22c839;};'use strict';var _=require(_0xae35('0x0'));var util=require(_0xae35('0x1'));var moment=require(_0xae35('0x2'));var BPromise=require(_0xae35('0x3'));var rs=require(_0xae35('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae35('0x5'))['db'];var utils=require(_0xae35('0x6'));var logger=require(_0xae35('0x7'))(_0xae35('0x8'));var config=require('../../config/environment');var jayson=require(_0xae35('0x9'));var client=jayson[_0xae35('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1927a4,_0x29f9b6,_0x4fc4d2){return new BPromise(function(_0x2b4a3d,_0x161f1c){return client[_0xae35('0xb')](_0x1927a4,_0x4fc4d2)[_0xae35('0xc')](function(_0x43593a){logger['info'](_0xae35('0xd'),_0x29f9b6,_0xae35('0xe'));logger[_0xae35('0xf')](_0xae35('0x10'),_0x29f9b6,_0xae35('0xe'),JSON[_0xae35('0x11')](_0x43593a));if(_0x43593a[_0xae35('0x12')]){if(_0x43593a['error'][_0xae35('0x13')]===0x1f4){logger[_0xae35('0x12')](_0xae35('0xd'),_0x29f9b6,_0x43593a[_0xae35('0x12')][_0xae35('0x14')]);return _0x161f1c(_0x43593a['error'][_0xae35('0x14')]);}logger[_0xae35('0x12')](_0xae35('0xd'),_0x29f9b6,_0x43593a['error'][_0xae35('0x14')]);return _0x2b4a3d(_0x43593a[_0xae35('0x12')][_0xae35('0x14')]);}else{logger[_0xae35('0x15')]('FreshdeskAccount,\x20%s,\x20%s',_0x29f9b6,_0xae35('0xe'));_0x2b4a3d(_0x43593a['result'][_0xae35('0x14')]);}})[_0xae35('0x16')](function(_0x33b544){logger[_0xae35('0x12')](_0xae35('0xd'),_0x29f9b6,_0x33b544);_0x161f1c(_0x33b544);});});}exports[_0xae35('0x17')]=function(_0x353777){var _0x19736d=this;return new Promise(function(_0x297794,_0x5ccc4b){return db['FreshdeskAccount'][_0xae35('0x18')]({'raw':_0x353777[_0xae35('0x19')]?_0x353777[_0xae35('0x19')][_0xae35('0x1a')]===undefined?!![]:![]:!![],'where':_0x353777[_0xae35('0x19')]?_0x353777['options']['where']||null:null,'attributes':_0x353777[_0xae35('0x19')]?_0x353777[_0xae35('0x19')]['attributes']||null:null,'limit':_0x353777[_0xae35('0x19')]?_0x353777[_0xae35('0x19')][_0xae35('0x1b')]||null:null,'include':_0x353777[_0xae35('0x19')]?_0x353777[_0xae35('0x19')]['include']?_[_0xae35('0x1c')](_0x353777['options'][_0xae35('0x1d')],function(_0x13c454){return{'model':db[_0x13c454['model']],'as':_0x13c454['as'],'attributes':_0x13c454[_0xae35('0x1e')],'include':_0x13c454[_0xae35('0x1d')]?_[_0xae35('0x1c')](_0x13c454[_0xae35('0x1d')],function(_0x2485bd){return{'model':db[_0x2485bd['model']],'as':_0x2485bd['as'],'attributes':_0x2485bd[_0xae35('0x1e')],'include':_0x2485bd[_0xae35('0x1d')]?_['map'](_0x2485bd[_0xae35('0x1d')],function(_0x4dfa49){return{'model':db[_0x4dfa49['model']],'as':_0x4dfa49['as'],'attributes':_0x4dfa49[_0xae35('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23ca53){logger[_0xae35('0x15')]('GetFreshdeskAccount',_0x353777);logger[_0xae35('0xf')](_0xae35('0x17'),_0x353777,JSON[_0xae35('0x11')](_0x23ca53));_0x297794(_0x23ca53);})['catch'](function(_0x46c994){logger[_0xae35('0x12')](_0xae35('0x17'),_0x46c994[_0xae35('0x14')],_0x353777);_0x5ccc4b(_0x19736d[_0xae35('0x12')](0x1f4,_0x46c994['message']));});});};exports['ShowFreshdeskAccount']=function(_0x3aae78){var _0x591a90=this;return new Promise(function(_0x560235,_0x1e53e9){return db[_0xae35('0x1f')]['find']({'raw':_0x3aae78[_0xae35('0x19')]?_0x3aae78[_0xae35('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3aae78[_0xae35('0x19')]?_0x3aae78[_0xae35('0x19')][_0xae35('0x20')]||null:null,'attributes':_0x3aae78[_0xae35('0x19')]?_0x3aae78['options'][_0xae35('0x1e')]||null:null,'include':_0x3aae78[_0xae35('0x19')]?_0x3aae78['options'][_0xae35('0x1d')]?_[_0xae35('0x1c')](_0x3aae78['options'][_0xae35('0x1d')],function(_0x4b2ce8){return{'model':db[_0x4b2ce8['model']],'as':_0x4b2ce8['as'],'attributes':_0x4b2ce8[_0xae35('0x1e')],'include':_0x4b2ce8[_0xae35('0x1d')]?_[_0xae35('0x1c')](_0x4b2ce8[_0xae35('0x1d')],function(_0x1030ac){return{'model':db[_0x1030ac[_0xae35('0x21')]],'as':_0x1030ac['as'],'attributes':_0x1030ac[_0xae35('0x1e')],'include':_0x1030ac[_0xae35('0x1d')]?_[_0xae35('0x1c')](_0x1030ac[_0xae35('0x1d')],function(_0x3af659){return{'model':db[_0x3af659[_0xae35('0x21')]],'as':_0x3af659['as'],'attributes':_0x3af659[_0xae35('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xae35('0xc')](function(_0x9df830){logger['info'](_0xae35('0x22'),_0x3aae78);logger[_0xae35('0xf')]('ShowFreshdeskAccount',_0x3aae78,JSON[_0xae35('0x11')](_0x9df830));_0x560235(_0x9df830);})[_0xae35('0x16')](function(_0x4dcc2b){logger[_0xae35('0x12')]('ShowFreshdeskAccount',_0x4dcc2b[_0xae35('0x14')],_0x3aae78);_0x1e53e9(_0x591a90[_0xae35('0x12')](0x1f4,_0x4dcc2b[_0xae35('0x14')]));});});}; \ No newline at end of file +var _0xfa4b=['findAll','options','where','limit','include','map','model','attributes','then','debug','find','raw','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','info','result','GetFreshdeskAccount','FreshdeskAccount'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xfa4b,0x175));var _0xbfa4=function(_0x4eab88,_0xcc1ff8){_0x4eab88=_0x4eab88-0x0;var _0x2042e3=_0xfa4b[_0x4eab88];return _0x2042e3;};'use strict';var _=require(_0xbfa4('0x0'));var util=require(_0xbfa4('0x1'));var moment=require(_0xbfa4('0x2'));var BPromise=require(_0xbfa4('0x3'));var rs=require(_0xbfa4('0x4'));var fs=require('fs');var Redis=require(_0xbfa4('0x5'));var db=require(_0xbfa4('0x6'))['db'];var utils=require(_0xbfa4('0x7'));var logger=require('../../config/logger')(_0xbfa4('0x8'));var config=require('../../config/environment');var jayson=require(_0xbfa4('0x9'));var client=jayson['client'][_0xbfa4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21c828,_0x3488eb,_0x1696bb){return new BPromise(function(_0x64eeb7,_0x5c7502){return client[_0xbfa4('0xb')](_0x21c828,_0x1696bb)['then'](function(_0x5224cb){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x3488eb,_0xbfa4('0xc'));logger['debug'](_0xbfa4('0xd'),_0x3488eb,_0xbfa4('0xc'),JSON[_0xbfa4('0xe')](_0x5224cb));if(_0x5224cb['error']){if(_0x5224cb[_0xbfa4('0xf')][_0xbfa4('0x10')]===0x1f4){logger['error'](_0xbfa4('0x11'),_0x3488eb,_0x5224cb['error'][_0xbfa4('0x12')]);return _0x5c7502(_0x5224cb[_0xbfa4('0xf')]['message']);}logger[_0xbfa4('0xf')](_0xbfa4('0x11'),_0x3488eb,_0x5224cb[_0xbfa4('0xf')][_0xbfa4('0x12')]);return _0x64eeb7(_0x5224cb[_0xbfa4('0xf')][_0xbfa4('0x12')]);}else{logger[_0xbfa4('0x13')](_0xbfa4('0x11'),_0x3488eb,_0xbfa4('0xc'));_0x64eeb7(_0x5224cb[_0xbfa4('0x14')][_0xbfa4('0x12')]);}})['catch'](function(_0x4e0a24){logger[_0xbfa4('0xf')](_0xbfa4('0x11'),_0x3488eb,_0x4e0a24);_0x5c7502(_0x4e0a24);});});}exports[_0xbfa4('0x15')]=function(_0x44b3dd){var _0x376446=this;return new Promise(function(_0x3fd0b3,_0x406f1b){return db[_0xbfa4('0x16')][_0xbfa4('0x17')]({'raw':_0x44b3dd[_0xbfa4('0x18')]?_0x44b3dd[_0xbfa4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x44b3dd[_0xbfa4('0x18')]?_0x44b3dd[_0xbfa4('0x18')][_0xbfa4('0x19')]||null:null,'attributes':_0x44b3dd[_0xbfa4('0x18')]?_0x44b3dd[_0xbfa4('0x18')]['attributes']||null:null,'limit':_0x44b3dd['options']?_0x44b3dd[_0xbfa4('0x18')][_0xbfa4('0x1a')]||null:null,'include':_0x44b3dd[_0xbfa4('0x18')]?_0x44b3dd['options'][_0xbfa4('0x1b')]?_[_0xbfa4('0x1c')](_0x44b3dd[_0xbfa4('0x18')][_0xbfa4('0x1b')],function(_0x345617){return{'model':db[_0x345617[_0xbfa4('0x1d')]],'as':_0x345617['as'],'attributes':_0x345617[_0xbfa4('0x1e')],'include':_0x345617[_0xbfa4('0x1b')]?_[_0xbfa4('0x1c')](_0x345617[_0xbfa4('0x1b')],function(_0x4beaba){return{'model':db[_0x4beaba[_0xbfa4('0x1d')]],'as':_0x4beaba['as'],'attributes':_0x4beaba[_0xbfa4('0x1e')],'include':_0x4beaba[_0xbfa4('0x1b')]?_['map'](_0x4beaba[_0xbfa4('0x1b')],function(_0x34ef7b){return{'model':db[_0x34ef7b[_0xbfa4('0x1d')]],'as':_0x34ef7b['as'],'attributes':_0x34ef7b['attributes']};}):[]};}):[]};}):[]:[]})[_0xbfa4('0x1f')](function(_0x2dfbe8){logger[_0xbfa4('0x13')](_0xbfa4('0x15'),_0x44b3dd);logger[_0xbfa4('0x20')](_0xbfa4('0x15'),_0x44b3dd,JSON['stringify'](_0x2dfbe8));_0x3fd0b3(_0x2dfbe8);})['catch'](function(_0x12517c){logger[_0xbfa4('0xf')]('GetFreshdeskAccount',_0x12517c[_0xbfa4('0x12')],_0x44b3dd);_0x406f1b(_0x376446[_0xbfa4('0xf')](0x1f4,_0x12517c[_0xbfa4('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x42b6c6){var _0x44d0e1=this;return new Promise(function(_0x5ab3eb,_0x2bb571){return db[_0xbfa4('0x16')][_0xbfa4('0x21')]({'raw':_0x42b6c6[_0xbfa4('0x18')]?_0x42b6c6[_0xbfa4('0x18')][_0xbfa4('0x22')]===undefined?!![]:![]:!![],'where':_0x42b6c6[_0xbfa4('0x18')]?_0x42b6c6[_0xbfa4('0x18')][_0xbfa4('0x19')]||null:null,'attributes':_0x42b6c6[_0xbfa4('0x18')]?_0x42b6c6[_0xbfa4('0x18')][_0xbfa4('0x1e')]||null:null,'include':_0x42b6c6[_0xbfa4('0x18')]?_0x42b6c6[_0xbfa4('0x18')][_0xbfa4('0x1b')]?_['map'](_0x42b6c6[_0xbfa4('0x18')][_0xbfa4('0x1b')],function(_0x315e94){return{'model':db[_0x315e94[_0xbfa4('0x1d')]],'as':_0x315e94['as'],'attributes':_0x315e94[_0xbfa4('0x1e')],'include':_0x315e94[_0xbfa4('0x1b')]?_['map'](_0x315e94['include'],function(_0x1b7df4){return{'model':db[_0x1b7df4[_0xbfa4('0x1d')]],'as':_0x1b7df4['as'],'attributes':_0x1b7df4[_0xbfa4('0x1e')],'include':_0x1b7df4[_0xbfa4('0x1b')]?_[_0xbfa4('0x1c')](_0x1b7df4['include'],function(_0x15ac26){return{'model':db[_0x15ac26[_0xbfa4('0x1d')]],'as':_0x15ac26['as'],'attributes':_0x15ac26[_0xbfa4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbfa4('0x1f')](function(_0x58c308){logger['info'](_0xbfa4('0x23'),_0x42b6c6);logger[_0xbfa4('0x20')]('ShowFreshdeskAccount',_0x42b6c6,JSON[_0xbfa4('0xe')](_0x58c308));_0x5ab3eb(_0x58c308);})['catch'](function(_0x4a8d44){logger[_0xbfa4('0xf')](_0xbfa4('0x23'),_0x4a8d44['message'],_0x42b6c6);_0x2bb571(_0x44d0e1[_0xbfa4('0xf')](0x1f4,_0x4a8d44[_0xbfa4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index a109657..86ced00 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 _0x80b3=['post','setTags','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x80b3,0x1a7));var _0x380b=function(_0x4f8337,_0x45e66f){_0x4f8337=_0x4f8337-0x0;var _0x3b31fa=_0x80b3[_0x4f8337];return _0x3b31fa;};'use strict';var multer=require(_0x380b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x380b('0x1'));var express=require(_0x380b('0x2'));var router=express[_0x380b('0x3')]();var fs_extra=require(_0x380b('0x4'));var auth=require(_0x380b('0x5'));var interaction=require(_0x380b('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x380b('0x7')]('/',auth[_0x380b('0x8')](),controller['index']);router[_0x380b('0x7')](_0x380b('0x9'),auth[_0x380b('0x8')](),controller['show']);router[_0x380b('0x7')](_0x380b('0xa'),auth[_0x380b('0x8')](),controller[_0x380b('0xb')]);router[_0x380b('0x7')](_0x380b('0xc'),auth[_0x380b('0x8')](),controller[_0x380b('0xd')]);router[_0x380b('0x7')]('/:id/descriptions',auth[_0x380b('0x8')](),controller['getDescriptions']);router['get'](_0x380b('0xe'),auth[_0x380b('0x8')](),controller[_0x380b('0xf')]);router['post']('/',auth[_0x380b('0x8')](),controller[_0x380b('0x10')]);router[_0x380b('0x11')](_0x380b('0xe'),auth[_0x380b('0x8')](),controller[_0x380b('0x12')]);router[_0x380b('0x13')](_0x380b('0x9'),auth[_0x380b('0x8')](),controller[_0x380b('0x14')]);router['delete'](_0x380b('0x9'),auth[_0x380b('0x8')](),controller['destroy']);module[_0x380b('0x15')]=router; \ No newline at end of file +var _0xd292=['create','setTags','put','update','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post'];(function(_0x3d06c3,_0x5b05e2){var _0x2a9303=function(_0x37f6a1){while(--_0x37f6a1){_0x3d06c3['push'](_0x3d06c3['shift']());}};_0x2a9303(++_0x5b05e2);}(_0xd292,0x163));var _0x2d29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd292[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x2d29('0x0'));var path=require(_0x2d29('0x1'));var timeout=require(_0x2d29('0x2'));var express=require('express');var router=express[_0x2d29('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2d29('0x4'));var interaction=require(_0x2d29('0x5'));var config=require(_0x2d29('0x6'));var controller=require(_0x2d29('0x7'));router['get']('/',auth[_0x2d29('0x8')](),controller[_0x2d29('0x9')]);router[_0x2d29('0xa')](_0x2d29('0xb'),auth[_0x2d29('0x8')](),controller[_0x2d29('0xc')]);router[_0x2d29('0xa')]('/:id/fields',auth[_0x2d29('0x8')](),controller['getFields']);router[_0x2d29('0xa')](_0x2d29('0xd'),auth[_0x2d29('0x8')](),controller[_0x2d29('0xe')]);router[_0x2d29('0xa')](_0x2d29('0xf'),auth[_0x2d29('0x8')](),controller[_0x2d29('0x10')]);router[_0x2d29('0xa')](_0x2d29('0x11'),auth['isAuthenticated'](),controller[_0x2d29('0x12')]);router[_0x2d29('0x13')]('/',auth[_0x2d29('0x8')](),controller[_0x2d29('0x14')]);router[_0x2d29('0x13')](_0x2d29('0x11'),auth[_0x2d29('0x8')](),controller[_0x2d29('0x15')]);router[_0x2d29('0x16')](_0x2d29('0xb'),auth[_0x2d29('0x8')](),controller[_0x2d29('0x17')]);router['delete'](_0x2d29('0xb'),auth[_0x2d29('0x8')](),controller['destroy']);module[_0x2d29('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index c7636fe..c73ba62 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 _0x906d=['STRING','sequelize','exports'];(function(_0x3e8bc8,_0x591f14){var _0x51d9c5=function(_0x22ea7f){while(--_0x22ea7f){_0x3e8bc8['push'](_0x3e8bc8['shift']());}};_0x51d9c5(++_0x591f14);}(_0x906d,0x10f));var _0xd906=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x906d[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xd906('0x0'));module[_0xd906('0x1')]={'name':{'type':Sequelize[_0xd906('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1e2c=['STRING','sequelize','exports'];(function(_0x3a9feb,_0x2cd279){var _0x3a7f55=function(_0x707bac){while(--_0x707bac){_0x3a9feb['push'](_0x3a9feb['shift']());}};_0x3a7f55(++_0x2cd279);}(_0x1e2c,0x1f3));var _0xc1e2=function(_0x51f027,_0x4d2dab){_0x51f027=_0x51f027-0x0;var _0x22e6f2=_0x1e2c[_0x51f027];return _0x22e6f2;};'use strict';var Sequelize=require(_0xc1e2('0x0'));module[_0xc1e2('0x1')]={'name':{'type':Sequelize[_0xc1e2('0x2')]},'description':{'type':Sequelize[_0xc1e2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b39643c..5df04cb 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 _0x685a=['fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','json','reject','save','update','then','end','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','getFields','FreshdeskField','filter','getSubjects','getDescriptions','findOne','Tag','getTags','setTags','ids','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs'];(function(_0x20c4e0,_0x3b60b2){var _0x3ee6b8=function(_0x454aaa){while(--_0x454aaa){_0x20c4e0['push'](_0x20c4e0['shift']());}};_0x3ee6b8(++_0x3b60b2);}(_0x685a,0x193));var _0xa685=function(_0x2cb996,_0x1144a8){_0x2cb996=_0x2cb996-0x0;var _0x5e7188=_0x685a[_0x2cb996];return _0x5e7188;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa685('0x0'));var jsonpatch=require(_0xa685('0x1'));var rp=require(_0xa685('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa685('0x3'));var util=require('util');var path=require(_0xa685('0x4'));var sox=require(_0xa685('0x5'));var csv=require('to-csv');var ejs=require(_0xa685('0x6'));var fs=require('fs');var fs_extra=require(_0xa685('0x7'));var _=require(_0xa685('0x8'));var squel=require(_0xa685('0x9'));var crypto=require('crypto');var jsforce=require(_0xa685('0xa'));var deskjs=require(_0xa685('0xb'));var toCsv=require(_0xa685('0xc'));var querystring=require(_0xa685('0xd'));var Papa=require(_0xa685('0xe'));var Redis=require(_0xa685('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa685('0x10'));var hardwareService=require(_0xa685('0x11'));var logger=require(_0xa685('0x12'))(_0xa685('0x13'));var utils=require(_0xa685('0x14'));var config=require(_0xa685('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa685('0x16'))['db'];function respondWithStatusCode(_0x2dc0e4,_0x3826dc){_0x3826dc=_0x3826dc||0xcc;return function(_0x5310f0){if(_0x5310f0){return _0x2dc0e4[_0xa685('0x17')](_0x3826dc);}return _0x2dc0e4[_0xa685('0x18')](_0x3826dc)['end']();};}function respondWithResult(_0x5d4c2d,_0x2ddea6){_0x2ddea6=_0x2ddea6||0xc8;return function(_0x477231){if(_0x477231){return _0x5d4c2d[_0xa685('0x18')](_0x2ddea6)['json'](_0x477231);}};}function respondWithFilteredResult(_0x2842cd,_0x1812e1){return function(_0x3cfda3){if(_0x3cfda3){var _0x27184b=typeof _0x1812e1['offset']===_0xa685('0x19')&&typeof _0x1812e1[_0xa685('0x1a')]===_0xa685('0x19');var _0x4ae204=_0x3cfda3[_0xa685('0x1b')];var _0x5f545d=_0x27184b?0x0:_0x1812e1[_0xa685('0x1c')];var _0x5b5c45=_0x27184b?_0x3cfda3[_0xa685('0x1b')]:_0x1812e1['offset']+_0x1812e1[_0xa685('0x1a')];var _0x391428;if(_0x5b5c45>=_0x4ae204){_0x5b5c45=_0x4ae204;_0x391428=0xc8;}else{_0x391428=0xce;}_0x2842cd[_0xa685('0x18')](_0x391428);return _0x2842cd[_0xa685('0x1d')]('Content-Range',_0x5f545d+'-'+_0x5b5c45+'/'+_0x4ae204)[_0xa685('0x1e')](_0x3cfda3);}return null;};}function patchUpdates(_0x1364d9){return function(_0x2145f6){try{jsonpatch['apply'](_0x2145f6,_0x1364d9,!![]);}catch(_0x362b92){return BPromise[_0xa685('0x1f')](_0x362b92);}return _0x2145f6[_0xa685('0x20')]();};}function saveUpdates(_0x617766,_0x149e53){return function(_0x1ef68e){if(_0x1ef68e){return _0x1ef68e[_0xa685('0x21')](_0x617766)[_0xa685('0x22')](function(_0x23afbe){return _0x23afbe;});}return null;};}function removeEntity(_0xd5439e,_0x451ee0){return function(_0x159965){if(_0x159965){return _0x159965['destroy']()['then'](function(){_0xd5439e['status'](0xcc)[_0xa685('0x23')]();});}};}function handleEntityNotFound(_0x2a83dd,_0x1719b2){return function(_0x568dab){if(!_0x568dab){_0x2a83dd[_0xa685('0x17')](0x194);}return _0x568dab;};}function handleError(_0x2aaa1e,_0xccabbe){_0xccabbe=_0xccabbe||0x1f4;return function(_0x2ab548){logger['error'](_0x2ab548[_0xa685('0x24')]);if(_0x2ab548['name']){delete _0x2ab548[_0xa685('0x25')];}_0x2aaa1e[_0xa685('0x18')](_0xccabbe)[_0xa685('0x26')](_0x2ab548);};}exports[_0xa685('0x27')]=function(_0x368386,_0x1e1953){var _0x3dbe78={},_0x39d734={},_0x2fda8b={'count':0x0,'rows':[]};var _0x49a16b=_[_0xa685('0x28')](db[_0xa685('0x29')][_0xa685('0x2a')],function(_0x10e8ac){return{'name':_0x10e8ac['fieldName'],'type':_0x10e8ac['type'][_0xa685('0x2b')]};});_0x39d734['model']=_['map'](_0x49a16b,_0xa685('0x25'));_0x39d734[_0xa685('0x2c')]=_['keys'](_0x368386[_0xa685('0x2c')]);_0x39d734[_0xa685('0x2d')]=_[_0xa685('0x2e')](_0x39d734[_0xa685('0x2f')],_0x39d734[_0xa685('0x2c')]);_0x3dbe78['attributes']=_[_0xa685('0x2e')](_0x39d734['model'],qs[_0xa685('0x30')](_0x368386[_0xa685('0x2c')][_0xa685('0x30')]));_0x3dbe78[_0xa685('0x31')]=_0x3dbe78['attributes'][_0xa685('0x32')]?_0x3dbe78[_0xa685('0x31')]:_0x39d734[_0xa685('0x2f')];if(!_0x368386[_0xa685('0x2c')][_0xa685('0x33')](_0xa685('0x34'))){_0x3dbe78['limit']=qs['limit'](_0x368386[_0xa685('0x2c')][_0xa685('0x1a')]);_0x3dbe78[_0xa685('0x1c')]=qs[_0xa685('0x1c')](_0x368386[_0xa685('0x2c')][_0xa685('0x1c')]);}_0x3dbe78[_0xa685('0x35')]=qs[_0xa685('0x36')](_0x368386[_0xa685('0x2c')][_0xa685('0x36')]);_0x3dbe78['where']=qs[_0xa685('0x2d')](_[_0xa685('0x37')](_0x368386['query'],_0x39d734[_0xa685('0x2d')]),_0x49a16b);if(_0x368386[_0xa685('0x2c')]['filter']){_0x3dbe78[_0xa685('0x38')]=_[_0xa685('0x39')](_0x3dbe78[_0xa685('0x38')],{'$or':_[_0xa685('0x28')](_0x49a16b,function(_0x3665a1){if(_0x3665a1[_0xa685('0x3a')]!==_0xa685('0x3b')){var _0x1d2237={};_0x1d2237[_0x3665a1['name']]={'$like':'%'+_0x368386['query']['filter']+'%'};return _0x1d2237;}})});}_0x3dbe78=_['merge']({},_0x3dbe78,_0x368386[_0xa685('0x3c')]);var _0x281803={'where':_0x3dbe78[_0xa685('0x38')]};return db[_0xa685('0x29')][_0xa685('0x1b')](_0x281803)[_0xa685('0x22')](function(_0x2376fd){_0x2fda8b[_0xa685('0x1b')]=_0x2376fd;if(_0x368386[_0xa685('0x2c')][_0xa685('0x3d')]){_0x3dbe78['include']=[{'all':!![]}];}return db[_0xa685('0x29')][_0xa685('0x3e')](_0x3dbe78);})[_0xa685('0x22')](function(_0x581f48){_0x2fda8b[_0xa685('0x3f')]=_0x581f48;return _0x2fda8b;})[_0xa685('0x22')](respondWithFilteredResult(_0x1e1953,_0x3dbe78))[_0xa685('0x40')](handleError(_0x1e1953,null));};exports[_0xa685('0x41')]=function(_0x1ffd7a,_0x3925a3){var _0x246178={'raw':![],'where':{'id':_0x1ffd7a[_0xa685('0x42')]['id']}},_0x3fdc14={};_0x3fdc14[_0xa685('0x2f')]=_[_0xa685('0x43')](db[_0xa685('0x29')][_0xa685('0x2a')]);_0x3fdc14[_0xa685('0x2c')]=_[_0xa685('0x43')](_0x1ffd7a[_0xa685('0x2c')]);_0x3fdc14[_0xa685('0x2d')]=_[_0xa685('0x2e')](_0x3fdc14[_0xa685('0x2f')],_0x3fdc14[_0xa685('0x2c')]);_0x246178[_0xa685('0x31')]=_['intersection'](_0x3fdc14['model'],qs[_0xa685('0x30')](_0x1ffd7a[_0xa685('0x2c')][_0xa685('0x30')]));_0x246178[_0xa685('0x31')]=_0x246178['attributes'][_0xa685('0x32')]?_0x246178[_0xa685('0x31')]:_0x3fdc14[_0xa685('0x2f')];if(_0x1ffd7a[_0xa685('0x2c')][_0xa685('0x3d')]){_0x246178[_0xa685('0x44')]=[{'all':!![]}];}_0x246178=_[_0xa685('0x39')]({},_0x246178,_0x1ffd7a[_0xa685('0x3c')]);return db[_0xa685('0x29')][_0xa685('0x45')](_0x246178)['then'](handleEntityNotFound(_0x3925a3,null))[_0xa685('0x22')](respondWithResult(_0x3925a3,null))[_0xa685('0x40')](handleError(_0x3925a3,null));};exports[_0xa685('0x46')]=function(_0x19cb43,_0x88dd51){return db['FreshdeskConfiguration'][_0xa685('0x46')](_0x19cb43[_0xa685('0x47')],{})[_0xa685('0x22')](respondWithResult(_0x88dd51,0xc9))['catch'](handleError(_0x88dd51,null));};exports['update']=function(_0x1e151d,_0x35151a){if(_0x1e151d['body']['id']){delete _0x1e151d[_0xa685('0x47')]['id'];}return db[_0xa685('0x29')]['find']({'where':{'id':_0x1e151d[_0xa685('0x42')]['id']}})[_0xa685('0x22')](handleEntityNotFound(_0x35151a,null))[_0xa685('0x22')](saveUpdates(_0x1e151d[_0xa685('0x47')],null))[_0xa685('0x22')](respondWithResult(_0x35151a,null))[_0xa685('0x40')](handleError(_0x35151a,null));};exports['destroy']=function(_0x3c74f0,_0x134fca){return db[_0xa685('0x29')][_0xa685('0x45')]({'where':{'id':_0x3c74f0[_0xa685('0x42')]['id']}})[_0xa685('0x22')](handleEntityNotFound(_0x134fca,null))[_0xa685('0x22')](removeEntity(_0x134fca,null))[_0xa685('0x40')](handleError(_0x134fca,null));};exports[_0xa685('0x48')]=function(_0x6143d3,_0x587e28,_0x2f3015){var _0x58c5e3={};var _0x37d9b5={};var _0x3fcc8c;var _0x2a6091;return db[_0xa685('0x29')]['findOne']({'where':{'id':_0x6143d3[_0xa685('0x42')]['id']}})['then'](handleEntityNotFound(_0x587e28,null))[_0xa685('0x22')](function(_0x433f24){if(_0x433f24){_0x3fcc8c=_0x433f24;_0x37d9b5[_0xa685('0x2f')]=_['keys'](db[_0xa685('0x49')][_0xa685('0x2a')]);_0x37d9b5[_0xa685('0x2c')]=_[_0xa685('0x43')](_0x6143d3['query']);_0x37d9b5[_0xa685('0x2d')]=_[_0xa685('0x2e')](_0x37d9b5[_0xa685('0x2f')],_0x37d9b5['query']);_0x58c5e3['attributes']=_[_0xa685('0x2e')](_0x37d9b5[_0xa685('0x2f')],qs['fields'](_0x6143d3[_0xa685('0x2c')][_0xa685('0x30')]));_0x58c5e3[_0xa685('0x31')]=_0x58c5e3['attributes'][_0xa685('0x32')]?_0x58c5e3[_0xa685('0x31')]:_0x37d9b5[_0xa685('0x2f')];_0x58c5e3[_0xa685('0x35')]=qs[_0xa685('0x36')](_0x6143d3[_0xa685('0x2c')][_0xa685('0x36')]);_0x58c5e3[_0xa685('0x38')]=qs['filters'](_[_0xa685('0x37')](_0x6143d3['query'],_0x37d9b5[_0xa685('0x2d')]));if(_0x6143d3['query'][_0xa685('0x4a')]){_0x58c5e3[_0xa685('0x38')]=_[_0xa685('0x39')](_0x58c5e3[_0xa685('0x38')],{'$or':_['map'](_0x58c5e3['attributes'],function(_0x4ca083){var _0x47e111={};_0x47e111[_0x4ca083]={'$like':'%'+_0x6143d3[_0xa685('0x2c')][_0xa685('0x4a')]+'%'};return _0x47e111;})});}_0x58c5e3=_[_0xa685('0x39')]({},_0x58c5e3,_0x6143d3[_0xa685('0x3c')]);return _0x3fcc8c['getFields'](_0x58c5e3);}})[_0xa685('0x22')](function(_0x1fc52a){if(_0x1fc52a){_0x2a6091=_0x1fc52a[_0xa685('0x32')];if(!_0x6143d3[_0xa685('0x2c')][_0xa685('0x33')]('nolimit')){_0x58c5e3['limit']=qs[_0xa685('0x1a')](_0x6143d3[_0xa685('0x2c')][_0xa685('0x1a')]);_0x58c5e3[_0xa685('0x1c')]=qs[_0xa685('0x1c')](_0x6143d3[_0xa685('0x2c')]['offset']);}return _0x3fcc8c[_0xa685('0x48')](_0x58c5e3);}})[_0xa685('0x22')](function(_0x5479d2){if(_0x5479d2){return _0x5479d2?{'count':_0x2a6091,'rows':_0x5479d2}:null;}})[_0xa685('0x22')](respondWithResult(_0x587e28,null))[_0xa685('0x40')](handleError(_0x587e28,null));};exports['getSubjects']=function(_0x4ff321,_0x51f08e,_0x4cfad6){var _0x2fa2af={};var _0xe510ec={};var _0x2c35fb;var _0x123c41;return db[_0xa685('0x29')]['findOne']({'where':{'id':_0x4ff321[_0xa685('0x42')]['id']}})[_0xa685('0x22')](handleEntityNotFound(_0x51f08e,null))['then'](function(_0x2297a3){if(_0x2297a3){_0x2c35fb=_0x2297a3;_0xe510ec[_0xa685('0x2f')]=_[_0xa685('0x43')](db[_0xa685('0x49')][_0xa685('0x2a')]);_0xe510ec[_0xa685('0x2c')]=_['keys'](_0x4ff321[_0xa685('0x2c')]);_0xe510ec[_0xa685('0x2d')]=_[_0xa685('0x2e')](_0xe510ec[_0xa685('0x2f')],_0xe510ec[_0xa685('0x2c')]);_0x2fa2af[_0xa685('0x31')]=_[_0xa685('0x2e')](_0xe510ec[_0xa685('0x2f')],qs[_0xa685('0x30')](_0x4ff321[_0xa685('0x2c')][_0xa685('0x30')]));_0x2fa2af[_0xa685('0x31')]=_0x2fa2af[_0xa685('0x31')][_0xa685('0x32')]?_0x2fa2af[_0xa685('0x31')]:_0xe510ec[_0xa685('0x2f')];_0x2fa2af['order']=qs['sort'](_0x4ff321[_0xa685('0x2c')][_0xa685('0x36')]);_0x2fa2af[_0xa685('0x38')]=qs[_0xa685('0x2d')](_[_0xa685('0x37')](_0x4ff321[_0xa685('0x2c')],_0xe510ec[_0xa685('0x2d')]));if(_0x4ff321[_0xa685('0x2c')][_0xa685('0x4a')]){_0x2fa2af[_0xa685('0x38')]=_[_0xa685('0x39')](_0x2fa2af['where'],{'$or':_[_0xa685('0x28')](_0x2fa2af[_0xa685('0x31')],function(_0x348817){var _0x635434={};_0x635434[_0x348817]={'$like':'%'+_0x4ff321[_0xa685('0x2c')][_0xa685('0x4a')]+'%'};return _0x635434;})});}_0x2fa2af=_['merge']({},_0x2fa2af,_0x4ff321[_0xa685('0x3c')]);return _0x2c35fb[_0xa685('0x4b')](_0x2fa2af);}})[_0xa685('0x22')](function(_0x1aaf87){if(_0x1aaf87){_0x123c41=_0x1aaf87[_0xa685('0x32')];if(!_0x4ff321[_0xa685('0x2c')][_0xa685('0x33')](_0xa685('0x34'))){_0x2fa2af[_0xa685('0x1a')]=qs[_0xa685('0x1a')](_0x4ff321['query'][_0xa685('0x1a')]);_0x2fa2af[_0xa685('0x1c')]=qs[_0xa685('0x1c')](_0x4ff321[_0xa685('0x2c')][_0xa685('0x1c')]);}return _0x2c35fb[_0xa685('0x4b')](_0x2fa2af);}})['then'](function(_0x1793f7){if(_0x1793f7){return _0x1793f7?{'count':_0x123c41,'rows':_0x1793f7}:null;}})[_0xa685('0x22')](respondWithResult(_0x51f08e,null))['catch'](handleError(_0x51f08e,null));};exports[_0xa685('0x4c')]=function(_0x42c0e9,_0x560664,_0x2e7880){var _0x126588={};var _0x8c9cef={};var _0x5dabb7;var _0xf01c29;return db[_0xa685('0x29')][_0xa685('0x4d')]({'where':{'id':_0x42c0e9[_0xa685('0x42')]['id']}})['then'](handleEntityNotFound(_0x560664,null))[_0xa685('0x22')](function(_0x1cbd39){if(_0x1cbd39){_0x5dabb7=_0x1cbd39;_0x8c9cef['model']=_['keys'](db[_0xa685('0x49')][_0xa685('0x2a')]);_0x8c9cef[_0xa685('0x2c')]=_['keys'](_0x42c0e9[_0xa685('0x2c')]);_0x8c9cef[_0xa685('0x2d')]=_['intersection'](_0x8c9cef[_0xa685('0x2f')],_0x8c9cef[_0xa685('0x2c')]);_0x126588[_0xa685('0x31')]=_['intersection'](_0x8c9cef['model'],qs[_0xa685('0x30')](_0x42c0e9['query'][_0xa685('0x30')]));_0x126588[_0xa685('0x31')]=_0x126588[_0xa685('0x31')][_0xa685('0x32')]?_0x126588[_0xa685('0x31')]:_0x8c9cef[_0xa685('0x2f')];_0x126588[_0xa685('0x35')]=qs['sort'](_0x42c0e9[_0xa685('0x2c')][_0xa685('0x36')]);_0x126588['where']=qs[_0xa685('0x2d')](_[_0xa685('0x37')](_0x42c0e9['query'],_0x8c9cef[_0xa685('0x2d')]));if(_0x42c0e9['query']['filter']){_0x126588['where']=_[_0xa685('0x39')](_0x126588[_0xa685('0x38')],{'$or':_[_0xa685('0x28')](_0x126588[_0xa685('0x31')],function(_0x565099){var _0x1dfc81={};_0x1dfc81[_0x565099]={'$like':'%'+_0x42c0e9[_0xa685('0x2c')][_0xa685('0x4a')]+'%'};return _0x1dfc81;})});}_0x126588=_[_0xa685('0x39')]({},_0x126588,_0x42c0e9[_0xa685('0x3c')]);return _0x5dabb7[_0xa685('0x4c')](_0x126588);}})['then'](function(_0x5ab933){if(_0x5ab933){_0xf01c29=_0x5ab933['length'];if(!_0x42c0e9['query'][_0xa685('0x33')](_0xa685('0x34'))){_0x126588[_0xa685('0x1a')]=qs[_0xa685('0x1a')](_0x42c0e9[_0xa685('0x2c')][_0xa685('0x1a')]);_0x126588[_0xa685('0x1c')]=qs[_0xa685('0x1c')](_0x42c0e9[_0xa685('0x2c')][_0xa685('0x1c')]);}return _0x5dabb7['getDescriptions'](_0x126588);}})[_0xa685('0x22')](function(_0x4399f5){if(_0x4399f5){return _0x4399f5?{'count':_0xf01c29,'rows':_0x4399f5}:null;}})[_0xa685('0x22')](respondWithResult(_0x560664,null))[_0xa685('0x40')](handleError(_0x560664,null));};exports['getTags']=function(_0x13737c,_0x12ea59,_0x91e71){var _0x4002ae={};var _0x4e61b8={};var _0x439237;var _0x516b56;return db[_0xa685('0x29')][_0xa685('0x4d')]({'where':{'id':_0x13737c[_0xa685('0x42')]['id']}})[_0xa685('0x22')](handleEntityNotFound(_0x12ea59,null))['then'](function(_0x2506e6){if(_0x2506e6){_0x439237=_0x2506e6;_0x4e61b8['model']=_['keys'](db[_0xa685('0x4e')][_0xa685('0x2a')]);_0x4e61b8[_0xa685('0x2c')]=_[_0xa685('0x43')](_0x13737c[_0xa685('0x2c')]);_0x4e61b8[_0xa685('0x2d')]=_['intersection'](_0x4e61b8[_0xa685('0x2f')],_0x4e61b8[_0xa685('0x2c')]);_0x4002ae[_0xa685('0x31')]=_['intersection'](_0x4e61b8['model'],qs[_0xa685('0x30')](_0x13737c[_0xa685('0x2c')][_0xa685('0x30')]));_0x4002ae[_0xa685('0x31')]=_0x4002ae[_0xa685('0x31')][_0xa685('0x32')]?_0x4002ae['attributes']:_0x4e61b8[_0xa685('0x2f')];_0x4002ae[_0xa685('0x35')]=qs[_0xa685('0x36')](_0x13737c[_0xa685('0x2c')][_0xa685('0x36')]);_0x4002ae['where']=qs[_0xa685('0x2d')](_[_0xa685('0x37')](_0x13737c[_0xa685('0x2c')],_0x4e61b8[_0xa685('0x2d')]));if(_0x13737c[_0xa685('0x2c')][_0xa685('0x4a')]){_0x4002ae[_0xa685('0x38')]=_['merge'](_0x4002ae[_0xa685('0x38')],{'$or':_['map'](_0x4002ae[_0xa685('0x31')],function(_0x21add9){var _0x273151={};_0x273151[_0x21add9]={'$like':'%'+_0x13737c[_0xa685('0x2c')][_0xa685('0x4a')]+'%'};return _0x273151;})});}_0x4002ae=_[_0xa685('0x39')]({},_0x4002ae,_0x13737c[_0xa685('0x3c')]);return _0x439237[_0xa685('0x4f')](_0x4002ae);}})[_0xa685('0x22')](function(_0x283931){if(_0x283931){_0x516b56=_0x283931[_0xa685('0x32')];if(!_0x13737c[_0xa685('0x2c')][_0xa685('0x33')](_0xa685('0x34'))){_0x4002ae[_0xa685('0x1a')]=qs[_0xa685('0x1a')](_0x13737c[_0xa685('0x2c')][_0xa685('0x1a')]);_0x4002ae[_0xa685('0x1c')]=qs[_0xa685('0x1c')](_0x13737c[_0xa685('0x2c')][_0xa685('0x1c')]);}return _0x439237[_0xa685('0x4f')](_0x4002ae);}})['then'](function(_0x4777c4){if(_0x4777c4){return _0x4777c4?{'count':_0x516b56,'rows':_0x4777c4}:null;}})[_0xa685('0x22')](respondWithResult(_0x12ea59,null))[_0xa685('0x40')](handleError(_0x12ea59,null));};exports['setTags']=function(_0x289b4a,_0x351ce1,_0x4be8fc){if(_0x289b4a['body']['id']){delete _0x289b4a[_0xa685('0x47')]['id'];}return db[_0xa685('0x29')][_0xa685('0x4d')]({'where':{'id':_0x289b4a[_0xa685('0x42')]['id']}})[_0xa685('0x22')](handleEntityNotFound(_0x351ce1,null))['then'](function(_0xc477f3){if(_0xc477f3){return _0xc477f3[_0xa685('0x50')](_0x289b4a[_0xa685('0x47')][_0xa685('0x51')]||[]);}return null;})['then'](respondWithResult(_0x351ce1,null))[_0xa685('0x40')](handleError(_0x351ce1,null));}; \ No newline at end of file +var _0x9dda=['Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','FreshdeskConfiguration','findAll','catch','params','keys','includeAll','options','create','body','find','findOne','FreshdeskField','getFields','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x2f3bb,_0x41a7cd){var _0x4b012b=function(_0xc63b92){while(--_0xc63b92){_0x2f3bb['push'](_0x2f3bb['shift']());}};_0x4b012b(++_0x41a7cd);}(_0x9dda,0x184));var _0xa9dd=function(_0x15aae8,_0x19c24c){_0x15aae8=_0x15aae8-0x0;var _0x4a87ee=_0x9dda[_0x15aae8];return _0x4a87ee;};'use strict';var emlformat=require(_0xa9dd('0x0'));var rimraf=require(_0xa9dd('0x1'));var zipdir=require(_0xa9dd('0x2'));var jsonpatch=require(_0xa9dd('0x3'));var rp=require(_0xa9dd('0x4'));var moment=require(_0xa9dd('0x5'));var BPromise=require(_0xa9dd('0x6'));var Mustache=require(_0xa9dd('0x7'));var util=require(_0xa9dd('0x8'));var path=require(_0xa9dd('0x9'));var sox=require(_0xa9dd('0xa'));var csv=require('to-csv');var ejs=require(_0xa9dd('0xb'));var fs=require('fs');var fs_extra=require(_0xa9dd('0xc'));var _=require('lodash');var squel=require(_0xa9dd('0xd'));var crypto=require(_0xa9dd('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa9dd('0xf'));var querystring=require(_0xa9dd('0x10'));var Papa=require(_0xa9dd('0x11'));var Redis=require(_0xa9dd('0x12'));var authService=require(_0xa9dd('0x13'));var qs=require(_0xa9dd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9dd('0x15'));var logger=require(_0xa9dd('0x16'))(_0xa9dd('0x17'));var utils=require(_0xa9dd('0x18'));var config=require(_0xa9dd('0x19'));var licenseUtil=require(_0xa9dd('0x1a'));var db=require(_0xa9dd('0x1b'))['db'];function respondWithStatusCode(_0x4e10bf,_0x218dec){_0x218dec=_0x218dec||0xcc;return function(_0x428bb0){if(_0x428bb0){return _0x4e10bf[_0xa9dd('0x1c')](_0x218dec);}return _0x4e10bf['status'](_0x218dec)[_0xa9dd('0x1d')]();};}function respondWithResult(_0x327844,_0x5ed29e){_0x5ed29e=_0x5ed29e||0xc8;return function(_0x116489){if(_0x116489){return _0x327844[_0xa9dd('0x1e')](_0x5ed29e)[_0xa9dd('0x1f')](_0x116489);}};}function respondWithFilteredResult(_0x2d74de,_0x5c740f){return function(_0x5bec59){if(_0x5bec59){var _0x38d004=typeof _0x5c740f[_0xa9dd('0x20')]===_0xa9dd('0x21')&&typeof _0x5c740f[_0xa9dd('0x22')]===_0xa9dd('0x21');var _0x292a52=_0x5bec59[_0xa9dd('0x23')];var _0x496497=_0x38d004?0x0:_0x5c740f['offset'];var _0x412fe1=_0x38d004?_0x5bec59[_0xa9dd('0x23')]:_0x5c740f[_0xa9dd('0x20')]+_0x5c740f['limit'];var _0x3cd386;if(_0x412fe1>=_0x292a52){_0x412fe1=_0x292a52;_0x3cd386=0xc8;}else{_0x3cd386=0xce;}_0x2d74de[_0xa9dd('0x1e')](_0x3cd386);return _0x2d74de[_0xa9dd('0x24')](_0xa9dd('0x25'),_0x496497+'-'+_0x412fe1+'/'+_0x292a52)[_0xa9dd('0x1f')](_0x5bec59);}return null;};}function patchUpdates(_0x368248){return function(_0x3543df){try{jsonpatch[_0xa9dd('0x26')](_0x3543df,_0x368248,!![]);}catch(_0x478052){return BPromise[_0xa9dd('0x27')](_0x478052);}return _0x3543df['save']();};}function saveUpdates(_0x2747dc,_0x3df755){return function(_0x12087d){if(_0x12087d){return _0x12087d[_0xa9dd('0x28')](_0x2747dc)[_0xa9dd('0x29')](function(_0x1e4fc8){return _0x1e4fc8;});}return null;};}function removeEntity(_0xed7f4c,_0x5ddd65){return function(_0x38156c){if(_0x38156c){return _0x38156c[_0xa9dd('0x2a')]()['then'](function(){_0xed7f4c[_0xa9dd('0x1e')](0xcc)[_0xa9dd('0x1d')]();});}};}function handleEntityNotFound(_0x1329f4,_0x4e8593){return function(_0x484930){if(!_0x484930){_0x1329f4['sendStatus'](0x194);}return _0x484930;};}function handleError(_0x31a3a8,_0x276c0d){_0x276c0d=_0x276c0d||0x1f4;return function(_0x5e2568){logger[_0xa9dd('0x2b')](_0x5e2568[_0xa9dd('0x2c')]);if(_0x5e2568[_0xa9dd('0x2d')]){delete _0x5e2568['name'];}_0x31a3a8[_0xa9dd('0x1e')](_0x276c0d)[_0xa9dd('0x2e')](_0x5e2568);};}exports['index']=function(_0x1f41d0,_0x3c371d){var _0x475543={},_0x3f30dc={},_0x5e2aca={'count':0x0,'rows':[]};var _0x190007=_[_0xa9dd('0x2f')](db['FreshdeskConfiguration'][_0xa9dd('0x30')],function(_0x17c962){return{'name':_0x17c962[_0xa9dd('0x31')],'type':_0x17c962[_0xa9dd('0x32')][_0xa9dd('0x33')]};});_0x3f30dc['model']=_[_0xa9dd('0x2f')](_0x190007,_0xa9dd('0x2d'));_0x3f30dc[_0xa9dd('0x34')]=_['keys'](_0x1f41d0[_0xa9dd('0x34')]);_0x3f30dc[_0xa9dd('0x35')]=_[_0xa9dd('0x36')](_0x3f30dc[_0xa9dd('0x37')],_0x3f30dc[_0xa9dd('0x34')]);_0x475543[_0xa9dd('0x38')]=_['intersection'](_0x3f30dc[_0xa9dd('0x37')],qs[_0xa9dd('0x39')](_0x1f41d0[_0xa9dd('0x34')][_0xa9dd('0x39')]));_0x475543[_0xa9dd('0x38')]=_0x475543[_0xa9dd('0x38')][_0xa9dd('0x3a')]?_0x475543[_0xa9dd('0x38')]:_0x3f30dc[_0xa9dd('0x37')];if(!_0x1f41d0['query'][_0xa9dd('0x3b')](_0xa9dd('0x3c'))){_0x475543[_0xa9dd('0x22')]=qs['limit'](_0x1f41d0[_0xa9dd('0x34')][_0xa9dd('0x22')]);_0x475543[_0xa9dd('0x20')]=qs[_0xa9dd('0x20')](_0x1f41d0[_0xa9dd('0x34')][_0xa9dd('0x20')]);}_0x475543[_0xa9dd('0x3d')]=qs[_0xa9dd('0x3e')](_0x1f41d0[_0xa9dd('0x34')][_0xa9dd('0x3e')]);_0x475543[_0xa9dd('0x3f')]=qs[_0xa9dd('0x35')](_[_0xa9dd('0x40')](_0x1f41d0[_0xa9dd('0x34')],_0x3f30dc[_0xa9dd('0x35')]),_0x190007);if(_0x1f41d0[_0xa9dd('0x34')]['filter']){_0x475543['where']=_[_0xa9dd('0x41')](_0x475543['where'],{'$or':_['map'](_0x190007,function(_0x8b9721){if(_0x8b9721[_0xa9dd('0x32')]!=='VIRTUAL'){var _0xf3c308={};_0xf3c308[_0x8b9721[_0xa9dd('0x2d')]]={'$like':'%'+_0x1f41d0[_0xa9dd('0x34')][_0xa9dd('0x42')]+'%'};return _0xf3c308;}})});}_0x475543=_[_0xa9dd('0x41')]({},_0x475543,_0x1f41d0['options']);var _0x2ecca5={'where':_0x475543[_0xa9dd('0x3f')]};return db[_0xa9dd('0x43')][_0xa9dd('0x23')](_0x2ecca5)[_0xa9dd('0x29')](function(_0x3e3bcf){_0x5e2aca['count']=_0x3e3bcf;if(_0x1f41d0['query']['includeAll']){_0x475543['include']=[{'all':!![]}];}return db[_0xa9dd('0x43')][_0xa9dd('0x44')](_0x475543);})[_0xa9dd('0x29')](function(_0x205fa7){_0x5e2aca['rows']=_0x205fa7;return _0x5e2aca;})['then'](respondWithFilteredResult(_0x3c371d,_0x475543))[_0xa9dd('0x45')](handleError(_0x3c371d,null));};exports['show']=function(_0x35efbc,_0x55d441){var _0x3e62e5={'raw':![],'where':{'id':_0x35efbc[_0xa9dd('0x46')]['id']}},_0x27f206={};_0x27f206[_0xa9dd('0x37')]=_[_0xa9dd('0x47')](db['FreshdeskConfiguration'][_0xa9dd('0x30')]);_0x27f206[_0xa9dd('0x34')]=_[_0xa9dd('0x47')](_0x35efbc['query']);_0x27f206['filters']=_[_0xa9dd('0x36')](_0x27f206[_0xa9dd('0x37')],_0x27f206[_0xa9dd('0x34')]);_0x3e62e5[_0xa9dd('0x38')]=_[_0xa9dd('0x36')](_0x27f206[_0xa9dd('0x37')],qs['fields'](_0x35efbc[_0xa9dd('0x34')][_0xa9dd('0x39')]));_0x3e62e5[_0xa9dd('0x38')]=_0x3e62e5[_0xa9dd('0x38')][_0xa9dd('0x3a')]?_0x3e62e5[_0xa9dd('0x38')]:_0x27f206[_0xa9dd('0x37')];if(_0x35efbc[_0xa9dd('0x34')][_0xa9dd('0x48')]){_0x3e62e5['include']=[{'all':!![]}];}_0x3e62e5=_[_0xa9dd('0x41')]({},_0x3e62e5,_0x35efbc[_0xa9dd('0x49')]);return db[_0xa9dd('0x43')]['find'](_0x3e62e5)['then'](handleEntityNotFound(_0x55d441,null))['then'](respondWithResult(_0x55d441,null))[_0xa9dd('0x45')](handleError(_0x55d441,null));};exports[_0xa9dd('0x4a')]=function(_0x5571e5,_0x4f89b1){return db[_0xa9dd('0x43')][_0xa9dd('0x4a')](_0x5571e5['body'],{})['then'](respondWithResult(_0x4f89b1,0xc9))['catch'](handleError(_0x4f89b1,null));};exports['update']=function(_0x10722b,_0x171976){if(_0x10722b[_0xa9dd('0x4b')]['id']){delete _0x10722b[_0xa9dd('0x4b')]['id'];}return db[_0xa9dd('0x43')]['find']({'where':{'id':_0x10722b['params']['id']}})[_0xa9dd('0x29')](handleEntityNotFound(_0x171976,null))[_0xa9dd('0x29')](saveUpdates(_0x10722b[_0xa9dd('0x4b')],null))[_0xa9dd('0x29')](respondWithResult(_0x171976,null))['catch'](handleError(_0x171976,null));};exports['destroy']=function(_0x567d69,_0x1e6c48){return db['FreshdeskConfiguration'][_0xa9dd('0x4c')]({'where':{'id':_0x567d69[_0xa9dd('0x46')]['id']}})[_0xa9dd('0x29')](handleEntityNotFound(_0x1e6c48,null))['then'](removeEntity(_0x1e6c48,null))[_0xa9dd('0x45')](handleError(_0x1e6c48,null));};exports['getFields']=function(_0x32c471,_0x4f8426,_0x2825be){var _0x282cc7={};var _0x47e44e={};var _0x538436;var _0x239947;return db[_0xa9dd('0x43')][_0xa9dd('0x4d')]({'where':{'id':_0x32c471[_0xa9dd('0x46')]['id']}})[_0xa9dd('0x29')](handleEntityNotFound(_0x4f8426,null))[_0xa9dd('0x29')](function(_0x3e1754){if(_0x3e1754){_0x538436=_0x3e1754;_0x47e44e[_0xa9dd('0x37')]=_[_0xa9dd('0x47')](db[_0xa9dd('0x4e')][_0xa9dd('0x30')]);_0x47e44e[_0xa9dd('0x34')]=_[_0xa9dd('0x47')](_0x32c471[_0xa9dd('0x34')]);_0x47e44e['filters']=_[_0xa9dd('0x36')](_0x47e44e[_0xa9dd('0x37')],_0x47e44e[_0xa9dd('0x34')]);_0x282cc7[_0xa9dd('0x38')]=_['intersection'](_0x47e44e[_0xa9dd('0x37')],qs[_0xa9dd('0x39')](_0x32c471[_0xa9dd('0x34')][_0xa9dd('0x39')]));_0x282cc7[_0xa9dd('0x38')]=_0x282cc7['attributes']['length']?_0x282cc7[_0xa9dd('0x38')]:_0x47e44e[_0xa9dd('0x37')];_0x282cc7[_0xa9dd('0x3d')]=qs[_0xa9dd('0x3e')](_0x32c471['query'][_0xa9dd('0x3e')]);_0x282cc7[_0xa9dd('0x3f')]=qs[_0xa9dd('0x35')](_[_0xa9dd('0x40')](_0x32c471[_0xa9dd('0x34')],_0x47e44e[_0xa9dd('0x35')]));if(_0x32c471[_0xa9dd('0x34')][_0xa9dd('0x42')]){_0x282cc7[_0xa9dd('0x3f')]=_[_0xa9dd('0x41')](_0x282cc7[_0xa9dd('0x3f')],{'$or':_['map'](_0x282cc7[_0xa9dd('0x38')],function(_0x5e05a5){var _0x37ee71={};_0x37ee71[_0x5e05a5]={'$like':'%'+_0x32c471[_0xa9dd('0x34')][_0xa9dd('0x42')]+'%'};return _0x37ee71;})});}_0x282cc7=_[_0xa9dd('0x41')]({},_0x282cc7,_0x32c471[_0xa9dd('0x49')]);return _0x538436[_0xa9dd('0x4f')](_0x282cc7);}})[_0xa9dd('0x29')](function(_0x55a669){if(_0x55a669){_0x239947=_0x55a669[_0xa9dd('0x3a')];if(!_0x32c471[_0xa9dd('0x34')][_0xa9dd('0x3b')](_0xa9dd('0x3c'))){_0x282cc7[_0xa9dd('0x22')]=qs['limit'](_0x32c471[_0xa9dd('0x34')][_0xa9dd('0x22')]);_0x282cc7[_0xa9dd('0x20')]=qs['offset'](_0x32c471[_0xa9dd('0x34')][_0xa9dd('0x20')]);}return _0x538436[_0xa9dd('0x4f')](_0x282cc7);}})[_0xa9dd('0x29')](function(_0x2ee80e){if(_0x2ee80e){return _0x2ee80e?{'count':_0x239947,'rows':_0x2ee80e}:null;}})[_0xa9dd('0x29')](respondWithResult(_0x4f8426,null))['catch'](handleError(_0x4f8426,null));};exports[_0xa9dd('0x50')]=function(_0x26fb0b,_0x394d6e,_0x455abe){var _0x98e7ff={};var _0x2b2d9c={};var _0x4af9c2;var _0x5912b8;return db[_0xa9dd('0x43')][_0xa9dd('0x4d')]({'where':{'id':_0x26fb0b[_0xa9dd('0x46')]['id']}})[_0xa9dd('0x29')](handleEntityNotFound(_0x394d6e,null))[_0xa9dd('0x29')](function(_0x5046ac){if(_0x5046ac){_0x4af9c2=_0x5046ac;_0x2b2d9c[_0xa9dd('0x37')]=_[_0xa9dd('0x47')](db[_0xa9dd('0x4e')][_0xa9dd('0x30')]);_0x2b2d9c['query']=_[_0xa9dd('0x47')](_0x26fb0b['query']);_0x2b2d9c[_0xa9dd('0x35')]=_['intersection'](_0x2b2d9c['model'],_0x2b2d9c[_0xa9dd('0x34')]);_0x98e7ff[_0xa9dd('0x38')]=_[_0xa9dd('0x36')](_0x2b2d9c[_0xa9dd('0x37')],qs[_0xa9dd('0x39')](_0x26fb0b[_0xa9dd('0x34')][_0xa9dd('0x39')]));_0x98e7ff[_0xa9dd('0x38')]=_0x98e7ff['attributes']['length']?_0x98e7ff['attributes']:_0x2b2d9c[_0xa9dd('0x37')];_0x98e7ff['order']=qs[_0xa9dd('0x3e')](_0x26fb0b[_0xa9dd('0x34')]['sort']);_0x98e7ff[_0xa9dd('0x3f')]=qs[_0xa9dd('0x35')](_[_0xa9dd('0x40')](_0x26fb0b[_0xa9dd('0x34')],_0x2b2d9c['filters']));if(_0x26fb0b[_0xa9dd('0x34')][_0xa9dd('0x42')]){_0x98e7ff[_0xa9dd('0x3f')]=_[_0xa9dd('0x41')](_0x98e7ff[_0xa9dd('0x3f')],{'$or':_['map'](_0x98e7ff[_0xa9dd('0x38')],function(_0x16dd14){var _0x49c7f3={};_0x49c7f3[_0x16dd14]={'$like':'%'+_0x26fb0b[_0xa9dd('0x34')]['filter']+'%'};return _0x49c7f3;})});}_0x98e7ff=_[_0xa9dd('0x41')]({},_0x98e7ff,_0x26fb0b[_0xa9dd('0x49')]);return _0x4af9c2[_0xa9dd('0x50')](_0x98e7ff);}})[_0xa9dd('0x29')](function(_0x54bead){if(_0x54bead){_0x5912b8=_0x54bead['length'];if(!_0x26fb0b[_0xa9dd('0x34')][_0xa9dd('0x3b')](_0xa9dd('0x3c'))){_0x98e7ff[_0xa9dd('0x22')]=qs[_0xa9dd('0x22')](_0x26fb0b[_0xa9dd('0x34')][_0xa9dd('0x22')]);_0x98e7ff[_0xa9dd('0x20')]=qs[_0xa9dd('0x20')](_0x26fb0b[_0xa9dd('0x34')][_0xa9dd('0x20')]);}return _0x4af9c2['getSubjects'](_0x98e7ff);}})['then'](function(_0x4ebb0f){if(_0x4ebb0f){return _0x4ebb0f?{'count':_0x5912b8,'rows':_0x4ebb0f}:null;}})[_0xa9dd('0x29')](respondWithResult(_0x394d6e,null))['catch'](handleError(_0x394d6e,null));};exports[_0xa9dd('0x51')]=function(_0x9cb385,_0x59f76c,_0x3099e9){var _0xc7d8cc={};var _0x37a188={};var _0x2e653f;var _0x29fbae;return db[_0xa9dd('0x43')][_0xa9dd('0x4d')]({'where':{'id':_0x9cb385[_0xa9dd('0x46')]['id']}})[_0xa9dd('0x29')](handleEntityNotFound(_0x59f76c,null))[_0xa9dd('0x29')](function(_0x24e3b0){if(_0x24e3b0){_0x2e653f=_0x24e3b0;_0x37a188['model']=_[_0xa9dd('0x47')](db[_0xa9dd('0x4e')][_0xa9dd('0x30')]);_0x37a188[_0xa9dd('0x34')]=_[_0xa9dd('0x47')](_0x9cb385[_0xa9dd('0x34')]);_0x37a188[_0xa9dd('0x35')]=_[_0xa9dd('0x36')](_0x37a188[_0xa9dd('0x37')],_0x37a188[_0xa9dd('0x34')]);_0xc7d8cc['attributes']=_[_0xa9dd('0x36')](_0x37a188[_0xa9dd('0x37')],qs[_0xa9dd('0x39')](_0x9cb385[_0xa9dd('0x34')][_0xa9dd('0x39')]));_0xc7d8cc[_0xa9dd('0x38')]=_0xc7d8cc[_0xa9dd('0x38')][_0xa9dd('0x3a')]?_0xc7d8cc[_0xa9dd('0x38')]:_0x37a188['model'];_0xc7d8cc[_0xa9dd('0x3d')]=qs['sort'](_0x9cb385['query'][_0xa9dd('0x3e')]);_0xc7d8cc[_0xa9dd('0x3f')]=qs['filters'](_[_0xa9dd('0x40')](_0x9cb385['query'],_0x37a188['filters']));if(_0x9cb385[_0xa9dd('0x34')][_0xa9dd('0x42')]){_0xc7d8cc[_0xa9dd('0x3f')]=_['merge'](_0xc7d8cc[_0xa9dd('0x3f')],{'$or':_[_0xa9dd('0x2f')](_0xc7d8cc[_0xa9dd('0x38')],function(_0x3a0342){var _0x1cabbe={};_0x1cabbe[_0x3a0342]={'$like':'%'+_0x9cb385['query'][_0xa9dd('0x42')]+'%'};return _0x1cabbe;})});}_0xc7d8cc=_[_0xa9dd('0x41')]({},_0xc7d8cc,_0x9cb385[_0xa9dd('0x49')]);return _0x2e653f[_0xa9dd('0x51')](_0xc7d8cc);}})[_0xa9dd('0x29')](function(_0x344979){if(_0x344979){_0x29fbae=_0x344979['length'];if(!_0x9cb385[_0xa9dd('0x34')][_0xa9dd('0x3b')](_0xa9dd('0x3c'))){_0xc7d8cc[_0xa9dd('0x22')]=qs['limit'](_0x9cb385['query']['limit']);_0xc7d8cc[_0xa9dd('0x20')]=qs['offset'](_0x9cb385[_0xa9dd('0x34')][_0xa9dd('0x20')]);}return _0x2e653f['getDescriptions'](_0xc7d8cc);}})['then'](function(_0x45ad11){if(_0x45ad11){return _0x45ad11?{'count':_0x29fbae,'rows':_0x45ad11}:null;}})[_0xa9dd('0x29')](respondWithResult(_0x59f76c,null))['catch'](handleError(_0x59f76c,null));};exports[_0xa9dd('0x52')]=function(_0x1d1003,_0x29e2cf,_0x2c5ad8){var _0x1f4949={};var _0x3a00e7={};var _0xffd080;var _0x2105d7;return db[_0xa9dd('0x43')][_0xa9dd('0x4d')]({'where':{'id':_0x1d1003[_0xa9dd('0x46')]['id']}})[_0xa9dd('0x29')](handleEntityNotFound(_0x29e2cf,null))[_0xa9dd('0x29')](function(_0x326365){if(_0x326365){_0xffd080=_0x326365;_0x3a00e7[_0xa9dd('0x37')]=_[_0xa9dd('0x47')](db['Tag'][_0xa9dd('0x30')]);_0x3a00e7[_0xa9dd('0x34')]=_[_0xa9dd('0x47')](_0x1d1003['query']);_0x3a00e7[_0xa9dd('0x35')]=_[_0xa9dd('0x36')](_0x3a00e7[_0xa9dd('0x37')],_0x3a00e7[_0xa9dd('0x34')]);_0x1f4949[_0xa9dd('0x38')]=_[_0xa9dd('0x36')](_0x3a00e7[_0xa9dd('0x37')],qs[_0xa9dd('0x39')](_0x1d1003[_0xa9dd('0x34')][_0xa9dd('0x39')]));_0x1f4949[_0xa9dd('0x38')]=_0x1f4949[_0xa9dd('0x38')][_0xa9dd('0x3a')]?_0x1f4949[_0xa9dd('0x38')]:_0x3a00e7[_0xa9dd('0x37')];_0x1f4949[_0xa9dd('0x3d')]=qs[_0xa9dd('0x3e')](_0x1d1003[_0xa9dd('0x34')][_0xa9dd('0x3e')]);_0x1f4949['where']=qs['filters'](_['pick'](_0x1d1003['query'],_0x3a00e7['filters']));if(_0x1d1003['query']['filter']){_0x1f4949['where']=_[_0xa9dd('0x41')](_0x1f4949[_0xa9dd('0x3f')],{'$or':_[_0xa9dd('0x2f')](_0x1f4949[_0xa9dd('0x38')],function(_0x21d677){var _0x52e4de={};_0x52e4de[_0x21d677]={'$like':'%'+_0x1d1003['query'][_0xa9dd('0x42')]+'%'};return _0x52e4de;})});}_0x1f4949=_[_0xa9dd('0x41')]({},_0x1f4949,_0x1d1003[_0xa9dd('0x49')]);return _0xffd080[_0xa9dd('0x52')](_0x1f4949);}})[_0xa9dd('0x29')](function(_0x319daf){if(_0x319daf){_0x2105d7=_0x319daf['length'];if(!_0x1d1003['query'][_0xa9dd('0x3b')]('nolimit')){_0x1f4949[_0xa9dd('0x22')]=qs[_0xa9dd('0x22')](_0x1d1003['query'][_0xa9dd('0x22')]);_0x1f4949['offset']=qs['offset'](_0x1d1003[_0xa9dd('0x34')][_0xa9dd('0x20')]);}return _0xffd080[_0xa9dd('0x52')](_0x1f4949);}})[_0xa9dd('0x29')](function(_0x24c92b){if(_0x24c92b){return _0x24c92b?{'count':_0x2105d7,'rows':_0x24c92b}:null;}})['then'](respondWithResult(_0x29e2cf,null))[_0xa9dd('0x45')](handleError(_0x29e2cf,null));};exports['setTags']=function(_0x54d47d,_0x1f321d,_0x4f88d1){if(_0x54d47d[_0xa9dd('0x4b')]['id']){delete _0x54d47d['body']['id'];}return db[_0xa9dd('0x43')][_0xa9dd('0x4d')]({'where':{'id':_0x54d47d[_0xa9dd('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f321d,null))[_0xa9dd('0x29')](function(_0x44e3b7){if(_0x44e3b7){return _0x44e3b7[_0xa9dd('0x53')](_0x54d47d[_0xa9dd('0x4b')][_0xa9dd('0x54')]||[]);}return null;})['then'](respondWithResult(_0x1f321d,null))[_0xa9dd('0x45')](handleError(_0x1f321d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 411d2be..0cafdac 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 _0x7d97=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x50dbaf,_0x580f67){var _0x4be454=function(_0x7346a0){while(--_0x7346a0){_0x50dbaf['push'](_0x50dbaf['shift']());}};_0x4be454(++_0x580f67);}(_0x7d97,0xff));var _0x77d9=function(_0x5b84a3,_0x38a508){_0x5b84a3=_0x5b84a3-0x0;var _0x18cf32=_0x7d97[_0x5b84a3];return _0x18cf32;};'use strict';var _=require(_0x77d9('0x0'));var util=require(_0x77d9('0x1'));var logger=require(_0x77d9('0x2'))(_0x77d9('0x3'));var moment=require(_0x77d9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x77d9('0x5'));var rimraf=require('rimraf');var config=require(_0x77d9('0x6'));var attributes=require(_0x77d9('0x7'));module[_0x77d9('0x8')]=function(_0xeb971b,_0x4d6098){return _0xeb971b['define'](_0x77d9('0x9'),attributes,{'tableName':_0x77d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93f7=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash'];(function(_0x584e05,_0x2ef50b){var _0x50e355=function(_0x51f032){while(--_0x51f032){_0x584e05['push'](_0x584e05['shift']());}};_0x50e355(++_0x2ef50b);}(_0x93f7,0x1a3));var _0x793f=function(_0x2b350c,_0x3427b5){_0x2b350c=_0x2b350c-0x0;var _0xbb04c2=_0x93f7[_0x2b350c];return _0xbb04c2;};'use strict';var _=require(_0x793f('0x0'));var util=require(_0x793f('0x1'));var logger=require(_0x793f('0x2'))(_0x793f('0x3'));var moment=require('moment');var BPromise=require(_0x793f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x793f('0x5'));var rimraf=require(_0x793f('0x6'));var config=require(_0x793f('0x7'));var attributes=require(_0x793f('0x8'));module[_0x793f('0x9')]=function(_0x316f18,_0x512d8d){return _0x316f18[_0x793f('0xa')](_0x793f('0xb'),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 a47bc8a..f3adc83 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 _0xedaa=['info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x597ab3,_0x264381){var _0x243015=function(_0x16f8f1){while(--_0x16f8f1){_0x597ab3['push'](_0x597ab3['shift']());}};_0x243015(++_0x264381);}(_0xedaa,0x18f));var _0xaeda=function(_0x17403a,_0x99f091){_0x17403a=_0x17403a-0x0;var _0x34f328=_0xedaa[_0x17403a];return _0x34f328;};'use strict';var _=require(_0xaeda('0x0'));var util=require(_0xaeda('0x1'));var moment=require(_0xaeda('0x2'));var BPromise=require(_0xaeda('0x3'));var rs=require(_0xaeda('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaeda('0x5'))['db'];var utils=require(_0xaeda('0x6'));var logger=require(_0xaeda('0x7'))(_0xaeda('0x8'));var config=require(_0xaeda('0x9'));var jayson=require(_0xaeda('0xa'));var client=jayson[_0xaeda('0xb')][_0xaeda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48a1e0,_0xdd13a2,_0x33f57c){return new BPromise(function(_0x2e5012,_0x184385){return client[_0xaeda('0xd')](_0x48a1e0,_0x33f57c)[_0xaeda('0xe')](function(_0x316fc9){logger[_0xaeda('0xf')](_0xaeda('0x10'),_0xdd13a2,_0xaeda('0x11'));logger[_0xaeda('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0xdd13a2,'request\x20sent',JSON[_0xaeda('0x13')](_0x316fc9));if(_0x316fc9[_0xaeda('0x14')]){if(_0x316fc9[_0xaeda('0x14')]['code']===0x1f4){logger['error'](_0xaeda('0x10'),_0xdd13a2,_0x316fc9[_0xaeda('0x14')][_0xaeda('0x15')]);return _0x184385(_0x316fc9['error'][_0xaeda('0x15')]);}logger['error'](_0xaeda('0x10'),_0xdd13a2,_0x316fc9['error']['message']);return _0x2e5012(_0x316fc9[_0xaeda('0x14')]['message']);}else{logger[_0xaeda('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xdd13a2,_0xaeda('0x11'));_0x2e5012(_0x316fc9[_0xaeda('0x16')][_0xaeda('0x15')]);}})['catch'](function(_0x510fe1){logger['error'](_0xaeda('0x10'),_0xdd13a2,_0x510fe1);_0x184385(_0x510fe1);});});} \ No newline at end of file +var _0x52dd=['util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x52dd,0xa0));var _0xd52d=function(_0x2f16e5,_0x2e75e0){_0x2f16e5=_0x2f16e5-0x0;var _0x5d082a=_0x52dd[_0x2f16e5];return _0x5d082a;};'use strict';var _=require(_0xd52d('0x0'));var util=require(_0xd52d('0x1'));var moment=require('moment');var BPromise=require(_0xd52d('0x2'));var rs=require(_0xd52d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd52d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd52d('0x5'));var config=require(_0xd52d('0x6'));var jayson=require(_0xd52d('0x7'));var client=jayson[_0xd52d('0x8')][_0xd52d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x76b64,_0x5e6c91,_0x2ded4c){return new BPromise(function(_0x5e47b9,_0x328449){return client[_0xd52d('0xa')](_0x76b64,_0x2ded4c)[_0xd52d('0xb')](function(_0x33e90d){logger[_0xd52d('0xc')](_0xd52d('0xd'),_0x5e6c91,_0xd52d('0xe'));logger[_0xd52d('0xf')](_0xd52d('0x10'),_0x5e6c91,_0xd52d('0xe'),JSON[_0xd52d('0x11')](_0x33e90d));if(_0x33e90d[_0xd52d('0x12')]){if(_0x33e90d[_0xd52d('0x12')][_0xd52d('0x13')]===0x1f4){logger[_0xd52d('0x12')](_0xd52d('0xd'),_0x5e6c91,_0x33e90d['error']['message']);return _0x328449(_0x33e90d['error'][_0xd52d('0x14')]);}logger[_0xd52d('0x12')](_0xd52d('0xd'),_0x5e6c91,_0x33e90d['error']['message']);return _0x5e47b9(_0x33e90d[_0xd52d('0x12')][_0xd52d('0x14')]);}else{logger[_0xd52d('0xc')](_0xd52d('0xd'),_0x5e6c91,_0xd52d('0xe'));_0x5e47b9(_0x33e90d[_0xd52d('0x15')]['message']);}})[_0xd52d('0x16')](function(_0x4f4bc1){logger[_0xd52d('0x12')](_0xd52d('0xd'),_0x5e6c91,_0x4f4bc1);_0x328449(_0x4f4bc1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 97c2d0b..e28620e 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 _0xe001=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x2856a0,_0x4c1227){var _0x54b2e6=function(_0x1b74f3){while(--_0x1b74f3){_0x2856a0['push'](_0x2856a0['shift']());}};_0x54b2e6(++_0x4c1227);}(_0xe001,0x1b0));var _0x1e00=function(_0x144dba,_0xb5c8e1){_0x144dba=_0x144dba-0x0;var _0x45d653=_0xe001[_0x144dba];return _0x45d653;};'use strict';var multer=require(_0x1e00('0x0'));var util=require(_0x1e00('0x1'));var path=require('path');var timeout=require(_0x1e00('0x2'));var express=require(_0x1e00('0x3'));var router=express['Router']();var fs_extra=require(_0x1e00('0x4'));var auth=require(_0x1e00('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1e00('0x6'));router[_0x1e00('0x7')]('/',auth[_0x1e00('0x8')](),controller[_0x1e00('0x9')]);router['get'](_0x1e00('0xa'),auth[_0x1e00('0x8')](),controller[_0x1e00('0xb')]);router[_0x1e00('0xc')]('/',auth[_0x1e00('0x8')](),controller[_0x1e00('0xd')]);router[_0x1e00('0xe')](_0x1e00('0xa'),auth['isAuthenticated'](),controller[_0x1e00('0xf')]);router['delete']('/:id',auth[_0x1e00('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x437d=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x191a82,_0x2c75b4){var _0xf6c8f9=function(_0x486ec7){while(--_0x486ec7){_0x191a82['push'](_0x191a82['shift']());}};_0xf6c8f9(++_0x2c75b4);}(_0x437d,0xc2));var _0xd437=function(_0x221fb0,_0x454b7b){_0x221fb0=_0x221fb0-0x0;var _0x24b8a1=_0x437d[_0x221fb0];return _0x24b8a1;};'use strict';var multer=require(_0xd437('0x0'));var util=require(_0xd437('0x1'));var path=require(_0xd437('0x2'));var timeout=require(_0xd437('0x3'));var express=require(_0xd437('0x4'));var router=express[_0xd437('0x5')]();var fs_extra=require(_0xd437('0x6'));var auth=require(_0xd437('0x7'));var interaction=require(_0xd437('0x8'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xd437('0x9')]('/',auth[_0xd437('0xa')](),controller[_0xd437('0xb')]);router['get'](_0xd437('0xc'),auth[_0xd437('0xa')](),controller[_0xd437('0xd')]);router[_0xd437('0xe')]('/',auth[_0xd437('0xa')](),controller[_0xd437('0xf')]);router[_0xd437('0x10')](_0xd437('0xc'),auth[_0xd437('0xa')](),controller['update']);router[_0xd437('0x11')](_0xd437('0xc'),auth[_0xd437('0xa')](),controller[_0xd437('0x12')]);module[_0xd437('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 2bd146c..daf8422 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 _0x8f6c=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x1d9dda,_0x34f418){var _0x1e6abd=function(_0xad04af){while(--_0xad04af){_0x1d9dda['push'](_0x1d9dda['shift']());}};_0x1e6abd(++_0x34f418);}(_0x8f6c,0x7e));var _0xc8f6=function(_0x3276aa,_0x48d9ce){_0x3276aa=_0x3276aa-0x0;var _0x270793=_0x8f6c[_0x3276aa];return _0x270793;};'use strict';var Sequelize=require(_0xc8f6('0x0'));module[_0xc8f6('0x1')]={'type':{'type':Sequelize[_0xc8f6('0x2')](_0xc8f6('0x3'),_0xc8f6('0x4'),_0xc8f6('0x5'),_0xc8f6('0x6'),_0xc8f6('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc8f6('0x8')]},'key':{'type':Sequelize[_0xc8f6('0x8')]},'keyType':{'type':Sequelize[_0xc8f6('0x2')](_0xc8f6('0x3'),_0xc8f6('0x4'),_0xc8f6('0x5'))},'keyContent':{'type':Sequelize[_0xc8f6('0x8')]},'idField':{'type':Sequelize[_0xc8f6('0x8')]},'nameField':{'type':Sequelize[_0xc8f6('0x8')]},'customField':{'type':Sequelize[_0xc8f6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe7c4=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x5302b5,_0x2e5504){var _0x32c55d=function(_0x254342){while(--_0x254342){_0x5302b5['push'](_0x5302b5['shift']());}};_0x32c55d(++_0x2e5504);}(_0xe7c4,0x12a));var _0x4e7c=function(_0x56279e,_0x2dc748){_0x56279e=_0x56279e-0x0;var _0x2af1f5=_0xe7c4[_0x56279e];return _0x2af1f5;};'use strict';var Sequelize=require(_0x4e7c('0x0'));module[_0x4e7c('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4e7c('0x2'),_0x4e7c('0x3'),_0x4e7c('0x4'),_0x4e7c('0x5'),'picklist'),'defaultValue':_0x4e7c('0x2')},'content':{'type':Sequelize[_0x4e7c('0x6')]},'key':{'type':Sequelize[_0x4e7c('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4e7c('0x2'),_0x4e7c('0x3'),_0x4e7c('0x4'))},'keyContent':{'type':Sequelize[_0x4e7c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4e7c('0x6')]},'customField':{'type':Sequelize[_0x4e7c('0x7')],'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 52da8ed..dd97922 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 _0xac4a=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskField','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x149083,_0x4047b6){var _0x4dc74e=function(_0x1211f9){while(--_0x1211f9){_0x149083['push'](_0x149083['shift']());}};_0x4dc74e(++_0x4047b6);}(_0xac4a,0x13f));var _0xaac4=function(_0x35cbfc,_0x6a8fc2){_0x35cbfc=_0x35cbfc-0x0;var _0x5e51d9=_0xac4a[_0x35cbfc];return _0x5e51d9;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={},_0x16b33c={},_0xda10b6={'count':0x0,'rows':[]};var _0xb76ccc=_[_0xaac4('0x29')](db[_0xaac4('0x2a')]['rawAttributes'],function(_0xcf6c1){return{'name':_0xcf6c1['fieldName'],'type':_0xcf6c1[_0xaac4('0x2b')][_0xaac4('0x2c')]};});_0x16b33c[_0xaac4('0x2d')]=_[_0xaac4('0x29')](_0xb76ccc,'name');_0x16b33c['query']=_['keys'](_0x386c9b[_0xaac4('0x2e')]);_0x16b33c[_0xaac4('0x2f')]=_[_0xaac4('0x30')](_0x16b33c[_0xaac4('0x2d')],_0x16b33c[_0xaac4('0x2e')]);_0x316445[_0xaac4('0x31')]=_[_0xaac4('0x30')](_0x16b33c[_0xaac4('0x2d')],qs[_0xaac4('0x32')](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x32')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x33')]?_0x316445[_0xaac4('0x31')]:_0x16b33c['model'];if(!_0x386c9b['query'][_0xaac4('0x34')](_0xaac4('0x35'))){_0x316445[_0xaac4('0x1a')]=qs['limit'](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x1a')]);_0x316445[_0xaac4('0x18')]=qs[_0xaac4('0x18')](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x18')]);}_0x316445[_0xaac4('0x36')]=qs['sort'](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x37')]);_0x316445[_0xaac4('0x38')]=qs['filters'](_[_0xaac4('0x39')](_0x386c9b['query'],_0x16b33c['filters']),_0xb76ccc);if(_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x3a')]){_0x316445[_0xaac4('0x38')]=_['merge'](_0x316445['where'],{'$or':_[_0xaac4('0x29')](_0xb76ccc,function(_0x33cc4){if(_0x33cc4[_0xaac4('0x2b')]!==_0xaac4('0x3b')){var _0x2b65b1={};_0x2b65b1[_0x33cc4[_0xaac4('0x26')]]={'$like':'%'+_0x386c9b['query']['filter']+'%'};return _0x2b65b1;}})});}_0x316445=_[_0xaac4('0x3c')]({},_0x316445,_0x386c9b[_0xaac4('0x3d')]);var _0x5371b4={'where':_0x316445[_0xaac4('0x38')]};return db[_0xaac4('0x2a')][_0xaac4('0x1b')](_0x5371b4)['then'](function(_0x74a1c){_0xda10b6[_0xaac4('0x1b')]=_0x74a1c;if(_0x386c9b[_0xaac4('0x2e')]['includeAll']){_0x316445[_0xaac4('0x3e')]=[{'all':!![]}];}return db[_0xaac4('0x2a')][_0xaac4('0x3f')](_0x316445);})[_0xaac4('0x23')](function(_0x51e59d){_0xda10b6[_0xaac4('0x40')]=_0x51e59d;return _0xda10b6;})['then'](respondWithFilteredResult(_0x4d0f5f,_0x316445))['catch'](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x41')]=function(_0x31e240,_0x27df36){var _0x40c007={'raw':!![],'where':{'id':_0x31e240[_0xaac4('0x42')]['id']}},_0x43bc12={};_0x43bc12[_0xaac4('0x2d')]=_[_0xaac4('0x43')](db['FreshdeskField'][_0xaac4('0x44')]);_0x43bc12[_0xaac4('0x2e')]=_[_0xaac4('0x43')](_0x31e240[_0xaac4('0x2e')]);_0x43bc12['filters']=_[_0xaac4('0x30')](_0x43bc12[_0xaac4('0x2d')],_0x43bc12[_0xaac4('0x2e')]);_0x40c007['attributes']=_[_0xaac4('0x30')](_0x43bc12[_0xaac4('0x2d')],qs[_0xaac4('0x32')](_0x31e240[_0xaac4('0x2e')]['fields']));_0x40c007[_0xaac4('0x31')]=_0x40c007[_0xaac4('0x31')][_0xaac4('0x33')]?_0x40c007['attributes']:_0x43bc12[_0xaac4('0x2d')];if(_0x31e240[_0xaac4('0x2e')][_0xaac4('0x45')]){_0x40c007[_0xaac4('0x3e')]=[{'all':!![]}];}_0x40c007=_[_0xaac4('0x3c')]({},_0x40c007,_0x31e240[_0xaac4('0x3d')]);return db[_0xaac4('0x2a')][_0xaac4('0x46')](_0x40c007)[_0xaac4('0x23')](handleEntityNotFound(_0x27df36,null))['then'](respondWithResult(_0x27df36,null))[_0xaac4('0x47')](handleError(_0x27df36,null));};exports[_0xaac4('0x48')]=function(_0x27425a,_0x360420){return db[_0xaac4('0x2a')]['create'](_0x27425a['body'],{})[_0xaac4('0x23')](respondWithResult(_0x360420,0xc9))[_0xaac4('0x47')](handleError(_0x360420,null));};exports[_0xaac4('0x21')]=function(_0x16c7f4,_0x5f33ea){if(_0x16c7f4[_0xaac4('0x49')]['id']){delete _0x16c7f4['body']['id'];}return db[_0xaac4('0x2a')][_0xaac4('0x46')]({'where':{'id':_0x16c7f4['params']['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x5f33ea,null))[_0xaac4('0x23')](saveUpdates(_0x16c7f4[_0xaac4('0x49')],null))['then'](respondWithResult(_0x5f33ea,null))['catch'](handleError(_0x5f33ea,null));};exports[_0xaac4('0x22')]=function(_0x2c1751,_0x22dda7){return db[_0xaac4('0x2a')][_0xaac4('0x46')]({'where':{'id':_0x2c1751[_0xaac4('0x42')]['id']}})['then'](handleEntityNotFound(_0x22dda7,null))[_0xaac4('0x23')](removeEntity(_0x22dda7,null))[_0xaac4('0x47')](handleError(_0x22dda7,null));}; \ No newline at end of file +var _0xd547=['offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','error','send','index','map','FreshdeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','json'];(function(_0x25606e,_0xe56303){var _0x4785e5=function(_0x3aa173){while(--_0x3aa173){_0x25606e['push'](_0x25606e['shift']());}};_0x4785e5(++_0xe56303);}(_0xd547,0x1c1));var _0x7d54=function(_0x4e30c0,_0x534a76){_0x4e30c0=_0x4e30c0-0x0;var _0x5db594=_0xd547[_0x4e30c0];return _0x5db594;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7d54('0x0'));var jsonpatch=require(_0x7d54('0x1'));var rp=require(_0x7d54('0x2'));var moment=require(_0x7d54('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7d54('0x4'));var path=require('path');var sox=require(_0x7d54('0x5'));var csv=require('to-csv');var ejs=require(_0x7d54('0x6'));var fs=require('fs');var fs_extra=require(_0x7d54('0x7'));var _=require(_0x7d54('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d54('0x9'));var toCsv=require(_0x7d54('0xa'));var querystring=require('querystring');var Papa=require(_0x7d54('0xb'));var Redis=require('ioredis');var authService=require(_0x7d54('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x7d54('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d54('0xe'))(_0x7d54('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7d54('0x10'))['db'];function respondWithStatusCode(_0x3e8072,_0x428430){_0x428430=_0x428430||0xcc;return function(_0x4be6c5){if(_0x4be6c5){return _0x3e8072[_0x7d54('0x11')](_0x428430);}return _0x3e8072['status'](_0x428430)[_0x7d54('0x12')]();};}function respondWithResult(_0x5e46ee,_0x11c94a){_0x11c94a=_0x11c94a||0xc8;return function(_0x43718a){if(_0x43718a){return _0x5e46ee['status'](_0x11c94a)[_0x7d54('0x13')](_0x43718a);}};}function respondWithFilteredResult(_0x208b3c,_0x25b69c){return function(_0x5a6bec){if(_0x5a6bec){var _0x2b1b0f=typeof _0x25b69c[_0x7d54('0x14')]===_0x7d54('0x15')&&typeof _0x25b69c[_0x7d54('0x16')]===_0x7d54('0x15');var _0x22f27c=_0x5a6bec['count'];var _0x81971b=_0x2b1b0f?0x0:_0x25b69c[_0x7d54('0x14')];var _0x57e789=_0x2b1b0f?_0x5a6bec[_0x7d54('0x17')]:_0x25b69c['offset']+_0x25b69c['limit'];var _0x46a719;if(_0x57e789>=_0x22f27c){_0x57e789=_0x22f27c;_0x46a719=0xc8;}else{_0x46a719=0xce;}_0x208b3c[_0x7d54('0x18')](_0x46a719);return _0x208b3c[_0x7d54('0x19')](_0x7d54('0x1a'),_0x81971b+'-'+_0x57e789+'/'+_0x22f27c)['json'](_0x5a6bec);}return null;};}function patchUpdates(_0x23ea55){return function(_0x2b0770){try{jsonpatch['apply'](_0x2b0770,_0x23ea55,!![]);}catch(_0x22718f){return BPromise[_0x7d54('0x1b')](_0x22718f);}return _0x2b0770[_0x7d54('0x1c')]();};}function saveUpdates(_0x6cc88b,_0x715a4e){return function(_0x4fe2cb){if(_0x4fe2cb){return _0x4fe2cb[_0x7d54('0x1d')](_0x6cc88b)['then'](function(_0x589f93){return _0x589f93;});}return null;};}function removeEntity(_0x5e0c4b,_0x2967b0){return function(_0x299f6e){if(_0x299f6e){return _0x299f6e['destroy']()[_0x7d54('0x1e')](function(){_0x5e0c4b[_0x7d54('0x18')](0xcc)[_0x7d54('0x12')]();});}};}function handleEntityNotFound(_0x19520a,_0x3b611f){return function(_0x6d0375){if(!_0x6d0375){_0x19520a[_0x7d54('0x11')](0x194);}return _0x6d0375;};}function handleError(_0x372f14,_0x509b8f){_0x509b8f=_0x509b8f||0x1f4;return function(_0x2818b6){logger[_0x7d54('0x1f')](_0x2818b6['stack']);if(_0x2818b6['name']){delete _0x2818b6['name'];}_0x372f14['status'](_0x509b8f)[_0x7d54('0x20')](_0x2818b6);};}exports[_0x7d54('0x21')]=function(_0x57e2ce,_0x32df83){var _0x252017={},_0x4a8488={},_0x472032={'count':0x0,'rows':[]};var _0x425a47=_[_0x7d54('0x22')](db[_0x7d54('0x23')][_0x7d54('0x24')],function(_0x2f1052){return{'name':_0x2f1052[_0x7d54('0x25')],'type':_0x2f1052[_0x7d54('0x26')]['key']};});_0x4a8488[_0x7d54('0x27')]=_['map'](_0x425a47,'name');_0x4a8488[_0x7d54('0x28')]=_[_0x7d54('0x29')](_0x57e2ce['query']);_0x4a8488[_0x7d54('0x2a')]=_[_0x7d54('0x2b')](_0x4a8488[_0x7d54('0x27')],_0x4a8488[_0x7d54('0x28')]);_0x252017[_0x7d54('0x2c')]=_[_0x7d54('0x2b')](_0x4a8488[_0x7d54('0x27')],qs['fields'](_0x57e2ce[_0x7d54('0x28')][_0x7d54('0x2d')]));_0x252017['attributes']=_0x252017[_0x7d54('0x2c')][_0x7d54('0x2e')]?_0x252017[_0x7d54('0x2c')]:_0x4a8488['model'];if(!_0x57e2ce[_0x7d54('0x28')][_0x7d54('0x2f')](_0x7d54('0x30'))){_0x252017[_0x7d54('0x16')]=qs[_0x7d54('0x16')](_0x57e2ce['query'][_0x7d54('0x16')]);_0x252017[_0x7d54('0x14')]=qs['offset'](_0x57e2ce[_0x7d54('0x28')][_0x7d54('0x14')]);}_0x252017[_0x7d54('0x31')]=qs[_0x7d54('0x32')](_0x57e2ce[_0x7d54('0x28')][_0x7d54('0x32')]);_0x252017[_0x7d54('0x33')]=qs[_0x7d54('0x2a')](_[_0x7d54('0x34')](_0x57e2ce[_0x7d54('0x28')],_0x4a8488[_0x7d54('0x2a')]),_0x425a47);if(_0x57e2ce[_0x7d54('0x28')]['filter']){_0x252017['where']=_[_0x7d54('0x35')](_0x252017[_0x7d54('0x33')],{'$or':_[_0x7d54('0x22')](_0x425a47,function(_0x624b65){if(_0x624b65['type']!=='VIRTUAL'){var _0x114531={};_0x114531[_0x624b65['name']]={'$like':'%'+_0x57e2ce[_0x7d54('0x28')][_0x7d54('0x36')]+'%'};return _0x114531;}})});}_0x252017=_['merge']({},_0x252017,_0x57e2ce['options']);var _0x20c2ed={'where':_0x252017[_0x7d54('0x33')]};return db['FreshdeskField'][_0x7d54('0x17')](_0x20c2ed)[_0x7d54('0x1e')](function(_0x5adae8){_0x472032['count']=_0x5adae8;if(_0x57e2ce[_0x7d54('0x28')][_0x7d54('0x37')]){_0x252017[_0x7d54('0x38')]=[{'all':!![]}];}return db[_0x7d54('0x23')][_0x7d54('0x39')](_0x252017);})[_0x7d54('0x1e')](function(_0x17f951){_0x472032[_0x7d54('0x3a')]=_0x17f951;return _0x472032;})[_0x7d54('0x1e')](respondWithFilteredResult(_0x32df83,_0x252017))[_0x7d54('0x3b')](handleError(_0x32df83,null));};exports[_0x7d54('0x3c')]=function(_0x543096,_0x536946){var _0x395b0d={'raw':!![],'where':{'id':_0x543096[_0x7d54('0x3d')]['id']}},_0xd8cefd={};_0xd8cefd[_0x7d54('0x27')]=_[_0x7d54('0x29')](db[_0x7d54('0x23')][_0x7d54('0x24')]);_0xd8cefd['query']=_[_0x7d54('0x29')](_0x543096['query']);_0xd8cefd['filters']=_[_0x7d54('0x2b')](_0xd8cefd[_0x7d54('0x27')],_0xd8cefd[_0x7d54('0x28')]);_0x395b0d[_0x7d54('0x2c')]=_[_0x7d54('0x2b')](_0xd8cefd['model'],qs[_0x7d54('0x2d')](_0x543096[_0x7d54('0x28')]['fields']));_0x395b0d[_0x7d54('0x2c')]=_0x395b0d[_0x7d54('0x2c')][_0x7d54('0x2e')]?_0x395b0d[_0x7d54('0x2c')]:_0xd8cefd[_0x7d54('0x27')];if(_0x543096[_0x7d54('0x28')]['includeAll']){_0x395b0d[_0x7d54('0x38')]=[{'all':!![]}];}_0x395b0d=_[_0x7d54('0x35')]({},_0x395b0d,_0x543096[_0x7d54('0x3e')]);return db[_0x7d54('0x23')][_0x7d54('0x3f')](_0x395b0d)[_0x7d54('0x1e')](handleEntityNotFound(_0x536946,null))[_0x7d54('0x1e')](respondWithResult(_0x536946,null))['catch'](handleError(_0x536946,null));};exports[_0x7d54('0x40')]=function(_0x2ea2d0,_0x2cf5f0){return db[_0x7d54('0x23')][_0x7d54('0x40')](_0x2ea2d0['body'],{})[_0x7d54('0x1e')](respondWithResult(_0x2cf5f0,0xc9))['catch'](handleError(_0x2cf5f0,null));};exports[_0x7d54('0x1d')]=function(_0x560b42,_0x5b6449){if(_0x560b42[_0x7d54('0x41')]['id']){delete _0x560b42['body']['id'];}return db['FreshdeskField'][_0x7d54('0x3f')]({'where':{'id':_0x560b42[_0x7d54('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5b6449,null))[_0x7d54('0x1e')](saveUpdates(_0x560b42[_0x7d54('0x41')],null))[_0x7d54('0x1e')](respondWithResult(_0x5b6449,null))['catch'](handleError(_0x5b6449,null));};exports[_0x7d54('0x42')]=function(_0x57bb14,_0x16e23f){return db[_0x7d54('0x23')][_0x7d54('0x3f')]({'where':{'id':_0x57bb14[_0x7d54('0x3d')]['id']}})['then'](handleEntityNotFound(_0x16e23f,null))['then'](removeEntity(_0x16e23f,null))[_0x7d54('0x3b')](handleError(_0x16e23f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f585465..5c5dad4 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 _0x5136=['request-promise','path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x141f24,_0x3b318c){var _0x257fd2=function(_0x3e3a56){while(--_0x3e3a56){_0x141f24['push'](_0x141f24['shift']());}};_0x257fd2(++_0x3b318c);}(_0x5136,0x73));var _0x6513=function(_0x27fd43,_0x43db99){_0x27fd43=_0x27fd43-0x0;var _0xd43c29=_0x5136[_0x27fd43];return _0xd43c29;};'use strict';var _=require(_0x6513('0x0'));var util=require(_0x6513('0x1'));var logger=require(_0x6513('0x2'))('api');var moment=require(_0x6513('0x3'));var BPromise=require(_0x6513('0x4'));var rp=require(_0x6513('0x5'));var fs=require('fs');var path=require(_0x6513('0x6'));var rimraf=require(_0x6513('0x7'));var config=require('../../config/environment');var attributes=require(_0x6513('0x8'));module[_0x6513('0x9')]=function(_0x554ed4,_0x7b268c){return _0x554ed4[_0x6513('0xa')](_0x6513('0xb'),attributes,{'tableName':_0x6513('0xc'),'paranoid':![],'indexes':[{'name':_0x6513('0xd'),'fields':['idField',_0x6513('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a66=['bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','util','../../config/logger','api'];(function(_0x215b43,_0x4939c5){var _0x1f6b4d=function(_0x171aea){while(--_0x171aea){_0x215b43['push'](_0x215b43['shift']());}};_0x1f6b4d(++_0x4939c5);}(_0x5a66,0x169));var _0x65a6=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x5a66[_0x42f009];return _0x22a1e0;};'use strict';var _=require('lodash');var util=require(_0x65a6('0x0'));var logger=require(_0x65a6('0x1'))(_0x65a6('0x2'));var moment=require('moment');var BPromise=require(_0x65a6('0x3'));var rp=require(_0x65a6('0x4'));var fs=require('fs');var path=require(_0x65a6('0x5'));var rimraf=require(_0x65a6('0x6'));var config=require('../../config/environment');var attributes=require(_0x65a6('0x7'));module['exports']=function(_0x3c53d2,_0x317d25){return _0x3c53d2[_0x65a6('0x8')](_0x65a6('0x9'),attributes,{'tableName':_0x65a6('0xa'),'paranoid':![],'indexes':[{'name':_0x65a6('0xb'),'fields':['idField',_0x65a6('0xc')],'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 7076af0..22f5ac3 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 _0xcccb=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','request\x20sent','code','FreshdeskField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcccb,0x1e7));var _0xbccc=function(_0x1993e2,_0x5dd7ad){_0x1993e2=_0x1993e2-0x0;var _0x2f7e8f=_0xcccb[_0x1993e2];return _0x2f7e8f;};'use strict';var _=require(_0xbccc('0x0'));var util=require('util');var moment=require(_0xbccc('0x1'));var BPromise=require(_0xbccc('0x2'));var rs=require(_0xbccc('0x3'));var fs=require('fs');var Redis=require(_0xbccc('0x4'));var db=require(_0xbccc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbccc('0x6'));var config=require(_0xbccc('0x7'));var jayson=require(_0xbccc('0x8'));var client=jayson[_0xbccc('0x9')][_0xbccc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ca885,_0x27bbd6,_0x4384be){return new BPromise(function(_0x37f814,_0x1b28fe){return client['request'](_0x1ca885,_0x4384be)[_0xbccc('0xb')](function(_0x212ccf){logger[_0xbccc('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x27bbd6,'request\x20sent');logger[_0xbccc('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x27bbd6,_0xbccc('0xe'),JSON['stringify'](_0x212ccf));if(_0x212ccf['error']){if(_0x212ccf['error'][_0xbccc('0xf')]===0x1f4){logger['error'](_0xbccc('0x10'),_0x27bbd6,_0x212ccf['error']['message']);return _0x1b28fe(_0x212ccf[_0xbccc('0x11')][_0xbccc('0x12')]);}logger[_0xbccc('0x11')](_0xbccc('0x10'),_0x27bbd6,_0x212ccf['error']['message']);return _0x37f814(_0x212ccf['error'][_0xbccc('0x12')]);}else{logger[_0xbccc('0xc')](_0xbccc('0x10'),_0x27bbd6,_0xbccc('0xe'));_0x37f814(_0x212ccf[_0xbccc('0x13')][_0xbccc('0x12')]);}})[_0xbccc('0x14')](function(_0x1a1c11){logger['error'](_0xbccc('0x10'),_0x27bbd6,_0x1a1c11);_0x1b28fe(_0x1a1c11);});});} \ No newline at end of file +var _0x9c95=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird'];(function(_0x36d9d1,_0x1dbe1d){var _0xa7e07a=function(_0x13d5a2){while(--_0x13d5a2){_0x36d9d1['push'](_0x36d9d1['shift']());}};_0xa7e07a(++_0x1dbe1d);}(_0x9c95,0xda));var _0x59c9=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x9c95[_0x4b7895];return _0x264180;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x59c9('0x0'));var BPromise=require(_0x59c9('0x1'));var rs=require(_0x59c9('0x2'));var fs=require('fs');var Redis=require(_0x59c9('0x3'));var db=require(_0x59c9('0x4'))['db'];var utils=require(_0x59c9('0x5'));var logger=require(_0x59c9('0x6'))('rpc');var config=require(_0x59c9('0x7'));var jayson=require(_0x59c9('0x8'));var client=jayson[_0x59c9('0x9')][_0x59c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x216c46,_0x344d1b,_0x52a611){return new BPromise(function(_0x5508b0,_0x1287d0){return client[_0x59c9('0xb')](_0x216c46,_0x52a611)['then'](function(_0x5056fb){logger[_0x59c9('0xc')](_0x59c9('0xd'),_0x344d1b,_0x59c9('0xe'));logger[_0x59c9('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x344d1b,_0x59c9('0xe'),JSON[_0x59c9('0x10')](_0x5056fb));if(_0x5056fb[_0x59c9('0x11')]){if(_0x5056fb[_0x59c9('0x11')][_0x59c9('0x12')]===0x1f4){logger[_0x59c9('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x344d1b,_0x5056fb[_0x59c9('0x11')]['message']);return _0x1287d0(_0x5056fb[_0x59c9('0x11')][_0x59c9('0x13')]);}logger[_0x59c9('0x11')](_0x59c9('0xd'),_0x344d1b,_0x5056fb['error'][_0x59c9('0x13')]);return _0x5508b0(_0x5056fb[_0x59c9('0x11')][_0x59c9('0x13')]);}else{logger[_0x59c9('0xc')](_0x59c9('0xd'),_0x344d1b,_0x59c9('0xe'));_0x5508b0(_0x5056fb[_0x59c9('0x14')][_0x59c9('0x13')]);}})[_0x59c9('0x15')](function(_0x304e48){logger[_0x59c9('0x11')](_0x59c9('0xd'),_0x344d1b,_0x304e48);_0x1287d0(_0x304e48);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 399dab0..126c1d3 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 _0x9348=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x9348,0x10d));var _0x8934=function(_0x215f9e,_0x438b14){_0x215f9e=_0x215f9e-0x0;var _0x217ce4=_0x9348[_0x215f9e];return _0x217ce4;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x8934('0xd'),auth['isAuthenticated'](),controller[_0x8934('0xe')]);router[_0x8934('0xf')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);router[_0x8934('0xf')](_0x8934('0x11'),auth[_0x8934('0xa')](),controller[_0x8934('0x12')]);router['put'](_0x8934('0x13'),auth[_0x8934('0xa')](),controller[_0x8934('0x14')]);router[_0x8934('0x15')](_0x8934('0x13'),auth[_0x8934('0xa')](),controller['destroy']);module[_0x8934('0x16')]=router; \ No newline at end of file +var _0x087b=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2bbeeb,_0x5f2d6b){var _0x3d359e=function(_0x15be69){while(--_0x15be69){_0x2bbeeb['push'](_0x2bbeeb['shift']());}};_0x3d359e(++_0x5f2d6b);}(_0x087b,0x11a));var _0xb087=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x087b[_0x1cc8fe];return _0x230054;};'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/fields',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x10')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x10')](_0xb087('0xd'),auth['isAuthenticated'](),controller[_0xb087('0x12')]);router[_0xb087('0x13')](_0xb087('0xb'),auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x15')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);module[_0xb087('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 66aca22..492e509 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(_0x4df90c,_0x439adb){var _0x1d3c78=function(_0x4da472){while(--_0x4da472){_0x4df90c['push'](_0x4df90c['shift']());}};_0x1d3c78(++_0x439adb);}(_0xffd6,0x97));var _0x6ffd=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0xffd6[_0x52e363];return _0x3fc2b5;};'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 _0x056b=['username','remoteUri','exports','STRING'];(function(_0x104a72,_0x47bc0b){var _0xc4ff3c=function(_0x4d2bfe){while(--_0x4d2bfe){_0x104a72['push'](_0x104a72['shift']());}};_0xc4ff3c(++_0x47bc0b);}(_0x056b,0xb6));var _0xb056=function(_0xd343,_0x47ddff){_0xd343=_0xd343-0x0;var _0x4886fa=_0x056b[_0xd343];return _0x4886fa;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'name':{'type':Sequelize[_0xb056('0x1')]},'description':{'type':Sequelize[_0xb056('0x1')]},'username':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x2')},'apiKey':{'type':Sequelize[_0xb056('0x1')]},'remoteUri':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x3')},'serverUrl':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index f4741cd..5b12fd5 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 _0x9bd0=['undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','getConfigurations','FreshsalesConfiguration','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','Subjects','getFields','findOne','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s%s','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','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/environment','sendStatus','status','offset'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x9bd0,0x11a));var _0x09bd=function(_0x47e633,_0x3f7b15){_0x47e633=_0x47e633-0x0;var _0x36d0ff=_0x9bd0[_0x47e633];return _0x36d0ff;};'use strict';var emlformat=require(_0x09bd('0x0'));var rimraf=require(_0x09bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09bd('0x2'));var rp=require(_0x09bd('0x3'));var moment=require('moment');var BPromise=require(_0x09bd('0x4'));var Mustache=require(_0x09bd('0x5'));var util=require(_0x09bd('0x6'));var path=require(_0x09bd('0x7'));var sox=require(_0x09bd('0x8'));var csv=require(_0x09bd('0x9'));var ejs=require(_0x09bd('0xa'));var fs=require('fs');var fs_extra=require(_0x09bd('0xb'));var _=require(_0x09bd('0xc'));var squel=require(_0x09bd('0xd'));var crypto=require(_0x09bd('0xe'));var jsforce=require(_0x09bd('0xf'));var deskjs=require(_0x09bd('0x10'));var toCsv=require(_0x09bd('0x9'));var querystring=require('querystring');var Papa=require(_0x09bd('0x11'));var Redis=require(_0x09bd('0x12'));var authService=require(_0x09bd('0x13'));var qs=require(_0x09bd('0x14'));var as=require(_0x09bd('0x15'));var hardwareService=require(_0x09bd('0x16'));var logger=require(_0x09bd('0x17'))(_0x09bd('0x18'));var utils=require(_0x09bd('0x19'));var config=require(_0x09bd('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x41ac1c,_0x44b24d){_0x44b24d=_0x44b24d||0xcc;return function(_0xff0d59){if(_0xff0d59){return _0x41ac1c[_0x09bd('0x1b')](_0x44b24d);}return _0x41ac1c[_0x09bd('0x1c')](_0x44b24d)['end']();};}function respondWithResult(_0x5da7ad,_0x3511fc){_0x3511fc=_0x3511fc||0xc8;return function(_0x230d72){if(_0x230d72){return _0x5da7ad[_0x09bd('0x1c')](_0x3511fc)['json'](_0x230d72);}};}function respondWithFilteredResult(_0x11150c,_0x3f8f1b){return function(_0x38ffac){if(_0x38ffac){var _0x30ceb9=typeof _0x3f8f1b[_0x09bd('0x1d')]===_0x09bd('0x1e')&&typeof _0x3f8f1b[_0x09bd('0x1f')]===_0x09bd('0x1e');var _0xd1a06f=_0x38ffac[_0x09bd('0x20')];var _0x2b1897=_0x30ceb9?0x0:_0x3f8f1b[_0x09bd('0x1d')];var _0xa5e9e5=_0x30ceb9?_0x38ffac['count']:_0x3f8f1b[_0x09bd('0x1d')]+_0x3f8f1b[_0x09bd('0x1f')];var _0x4b72f0;if(_0xa5e9e5>=_0xd1a06f){_0xa5e9e5=_0xd1a06f;_0x4b72f0=0xc8;}else{_0x4b72f0=0xce;}_0x11150c['status'](_0x4b72f0);return _0x11150c[_0x09bd('0x21')](_0x09bd('0x22'),_0x2b1897+'-'+_0xa5e9e5+'/'+_0xd1a06f)[_0x09bd('0x23')](_0x38ffac);}return null;};}function patchUpdates(_0x11a058){return function(_0x38cc33){try{jsonpatch['apply'](_0x38cc33,_0x11a058,!![]);}catch(_0x142f2b){return BPromise[_0x09bd('0x24')](_0x142f2b);}return _0x38cc33[_0x09bd('0x25')]();};}function saveUpdates(_0x337b92,_0x17384b){return function(_0x1966aa){if(_0x1966aa){return _0x1966aa[_0x09bd('0x26')](_0x337b92)[_0x09bd('0x27')](function(_0x1944c7){return _0x1944c7;});}return null;};}function removeEntity(_0x40916a,_0x2f378e){return function(_0x2e5ec1){if(_0x2e5ec1){return _0x2e5ec1[_0x09bd('0x28')]()[_0x09bd('0x27')](function(){_0x40916a[_0x09bd('0x1c')](0xcc)[_0x09bd('0x29')]();});}};}function handleEntityNotFound(_0x302cee,_0x4c0f91){return function(_0x4db0f9){if(!_0x4db0f9){_0x302cee[_0x09bd('0x1b')](0x194);}return _0x4db0f9;};}function handleError(_0x12036f,_0x4b9873){_0x4b9873=_0x4b9873||0x1f4;return function(_0x26530a){logger[_0x09bd('0x2a')](_0x26530a[_0x09bd('0x2b')]);if(_0x26530a[_0x09bd('0x2c')]){delete _0x26530a[_0x09bd('0x2c')];}_0x12036f['status'](_0x4b9873)[_0x09bd('0x2d')](_0x26530a);};}exports['index']=function(_0x31d439,_0x17f50c){var _0x4f474a={},_0x274427={},_0x226323={'count':0x0,'rows':[]};var _0x6e3faa=_['map'](db[_0x09bd('0x2e')][_0x09bd('0x2f')],function(_0x2693fc){return{'name':_0x2693fc[_0x09bd('0x30')],'type':_0x2693fc[_0x09bd('0x31')][_0x09bd('0x32')]};});_0x274427[_0x09bd('0x33')]=_[_0x09bd('0x34')](_0x6e3faa,_0x09bd('0x2c'));_0x274427[_0x09bd('0x35')]=_['keys'](_0x31d439[_0x09bd('0x35')]);_0x274427[_0x09bd('0x36')]=_['intersection'](_0x274427[_0x09bd('0x33')],_0x274427['query']);_0x4f474a['attributes']=_[_0x09bd('0x37')](_0x274427[_0x09bd('0x33')],qs[_0x09bd('0x38')](_0x31d439[_0x09bd('0x35')][_0x09bd('0x38')]));_0x4f474a[_0x09bd('0x39')]=_0x4f474a[_0x09bd('0x39')]['length']?_0x4f474a[_0x09bd('0x39')]:_0x274427['model'];if(!_0x31d439[_0x09bd('0x35')][_0x09bd('0x3a')](_0x09bd('0x3b'))){_0x4f474a['limit']=qs[_0x09bd('0x1f')](_0x31d439[_0x09bd('0x35')][_0x09bd('0x1f')]);_0x4f474a[_0x09bd('0x1d')]=qs[_0x09bd('0x1d')](_0x31d439[_0x09bd('0x35')][_0x09bd('0x1d')]);}_0x4f474a['order']=qs[_0x09bd('0x3c')](_0x31d439[_0x09bd('0x35')][_0x09bd('0x3c')]);_0x4f474a['where']=qs[_0x09bd('0x36')](_[_0x09bd('0x3d')](_0x31d439[_0x09bd('0x35')],_0x274427['filters']),_0x6e3faa);if(_0x31d439[_0x09bd('0x35')][_0x09bd('0x3e')]){_0x4f474a[_0x09bd('0x3f')]=_[_0x09bd('0x40')](_0x4f474a[_0x09bd('0x3f')],{'$or':_[_0x09bd('0x34')](_0x6e3faa,function(_0x5284e7){if(_0x5284e7['type']!=='VIRTUAL'){var _0x963377={};_0x963377[_0x5284e7[_0x09bd('0x2c')]]={'$like':'%'+_0x31d439[_0x09bd('0x35')]['filter']+'%'};return _0x963377;}})});}_0x4f474a=_[_0x09bd('0x40')]({},_0x4f474a,_0x31d439[_0x09bd('0x41')]);var _0x39b323={'where':_0x4f474a[_0x09bd('0x3f')]};return db[_0x09bd('0x2e')][_0x09bd('0x20')](_0x39b323)[_0x09bd('0x27')](function(_0x320d03){_0x226323['count']=_0x320d03;if(_0x31d439[_0x09bd('0x35')][_0x09bd('0x42')]){_0x4f474a[_0x09bd('0x43')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x09bd('0x44')](_0x4f474a);})[_0x09bd('0x27')](function(_0xaaa43b){_0x226323[_0x09bd('0x45')]=_0xaaa43b;return _0x226323;})['then'](respondWithFilteredResult(_0x17f50c,_0x4f474a))[_0x09bd('0x46')](handleError(_0x17f50c,null));};exports[_0x09bd('0x47')]=function(_0x354966,_0xa598e){var _0x127d16={'raw':![],'where':{'id':_0x354966[_0x09bd('0x48')]['id']}},_0x54de53={};_0x54de53[_0x09bd('0x33')]=_[_0x09bd('0x49')](db['FreshsalesAccount']['rawAttributes']);_0x54de53[_0x09bd('0x35')]=_[_0x09bd('0x49')](_0x354966['query']);_0x54de53[_0x09bd('0x36')]=_[_0x09bd('0x37')](_0x54de53[_0x09bd('0x33')],_0x54de53[_0x09bd('0x35')]);_0x127d16[_0x09bd('0x39')]=_[_0x09bd('0x37')](_0x54de53['model'],qs[_0x09bd('0x38')](_0x354966[_0x09bd('0x35')]['fields']));_0x127d16[_0x09bd('0x39')]=_0x127d16[_0x09bd('0x39')][_0x09bd('0x4a')]?_0x127d16[_0x09bd('0x39')]:_0x54de53[_0x09bd('0x33')];if(_0x354966['query']['includeAll']){_0x127d16[_0x09bd('0x43')]=[{'all':!![]}];}_0x127d16=_['merge']({},_0x127d16,_0x354966[_0x09bd('0x41')]);return db[_0x09bd('0x2e')][_0x09bd('0x4b')](_0x127d16)['then'](handleEntityNotFound(_0xa598e,null))[_0x09bd('0x27')](respondWithResult(_0xa598e,null))[_0x09bd('0x46')](handleError(_0xa598e,null));};exports[_0x09bd('0x4c')]=function(_0x1a32e4,_0x2a127c){return db[_0x09bd('0x2e')][_0x09bd('0x4c')](_0x1a32e4['body'],{})[_0x09bd('0x27')](respondWithResult(_0x2a127c,0xc9))[_0x09bd('0x46')](handleError(_0x2a127c,null));};exports[_0x09bd('0x26')]=function(_0x5cba17,_0x4bc6b1){if(_0x5cba17[_0x09bd('0x4d')]['id']){delete _0x5cba17[_0x09bd('0x4d')]['id'];}return db['FreshsalesAccount'][_0x09bd('0x4b')]({'where':{'id':_0x5cba17[_0x09bd('0x48')]['id']}})['then'](handleEntityNotFound(_0x4bc6b1,null))['then'](saveUpdates(_0x5cba17[_0x09bd('0x4d')],null))[_0x09bd('0x27')](respondWithResult(_0x4bc6b1,null))[_0x09bd('0x46')](handleError(_0x4bc6b1,null));};exports[_0x09bd('0x28')]=function(_0x5601cf,_0x374896){return db[_0x09bd('0x2e')][_0x09bd('0x4b')]({'where':{'id':_0x5601cf[_0x09bd('0x48')]['id']}})[_0x09bd('0x27')](handleEntityNotFound(_0x374896,null))[_0x09bd('0x27')](removeEntity(_0x374896,null))[_0x09bd('0x46')](handleError(_0x374896,null));};exports[_0x09bd('0x4e')]=function(_0x33905f,_0x10f46c,_0x306c05){var _0xc36dcf={};var _0x152c63={};var _0x290766;var _0x5dcde2;return db[_0x09bd('0x2e')]['findOne']({'where':{'id':_0x33905f[_0x09bd('0x48')]['id']}})['then'](handleEntityNotFound(_0x10f46c,null))[_0x09bd('0x27')](function(_0x2f983d){if(_0x2f983d){_0x290766=_0x2f983d;_0x152c63['model']=_[_0x09bd('0x49')](db[_0x09bd('0x4f')]['rawAttributes']);_0x152c63['query']=_[_0x09bd('0x49')](_0x33905f[_0x09bd('0x35')]);_0x152c63[_0x09bd('0x36')]=_[_0x09bd('0x37')](_0x152c63[_0x09bd('0x33')],_0x152c63[_0x09bd('0x35')]);_0xc36dcf[_0x09bd('0x39')]=_['intersection'](_0x152c63[_0x09bd('0x33')],qs[_0x09bd('0x38')](_0x33905f[_0x09bd('0x35')][_0x09bd('0x38')]));_0xc36dcf['attributes']=_0xc36dcf[_0x09bd('0x39')][_0x09bd('0x4a')]?_0xc36dcf[_0x09bd('0x39')]:_0x152c63['model'];_0xc36dcf['order']=qs[_0x09bd('0x3c')](_0x33905f[_0x09bd('0x35')][_0x09bd('0x3c')]);_0xc36dcf[_0x09bd('0x3f')]=qs['filters'](_[_0x09bd('0x3d')](_0x33905f[_0x09bd('0x35')],_0x152c63['filters']));if(_0x33905f['query'][_0x09bd('0x3e')]){_0xc36dcf[_0x09bd('0x3f')]=_[_0x09bd('0x40')](_0xc36dcf[_0x09bd('0x3f')],{'$or':_[_0x09bd('0x34')](_0xc36dcf[_0x09bd('0x39')],function(_0x173753){var _0x204227={};_0x204227[_0x173753]={'$like':'%'+_0x33905f[_0x09bd('0x35')][_0x09bd('0x3e')]+'%'};return _0x204227;})});}_0xc36dcf=_[_0x09bd('0x40')]({},_0xc36dcf,_0x33905f[_0x09bd('0x41')]);return _0x290766['getConfigurations'](_0xc36dcf);}})[_0x09bd('0x27')](function(_0x8a59f6){if(_0x8a59f6){_0x5dcde2=_0x8a59f6['length'];if(!_0x33905f[_0x09bd('0x35')][_0x09bd('0x3a')](_0x09bd('0x3b'))){_0xc36dcf[_0x09bd('0x1f')]=qs[_0x09bd('0x1f')](_0x33905f[_0x09bd('0x35')][_0x09bd('0x1f')]);_0xc36dcf[_0x09bd('0x1d')]=qs[_0x09bd('0x1d')](_0x33905f[_0x09bd('0x35')]['offset']);}return _0x290766[_0x09bd('0x4e')](_0xc36dcf);}})[_0x09bd('0x27')](function(_0x27b9fe){if(_0x27b9fe){return _0x27b9fe?{'count':_0x5dcde2,'rows':_0x27b9fe}:null;}})[_0x09bd('0x27')](respondWithResult(_0x10f46c,null))[_0x09bd('0x46')](handleError(_0x10f46c,null));};exports[_0x09bd('0x50')]=function(_0xcbddf4,_0x125f08,_0x5ac9fb){if(_0xcbddf4[_0x09bd('0x4d')]['id']){delete _0xcbddf4[_0x09bd('0x4d')]['id'];}return db[_0x09bd('0x2e')]['findOne']({'where':{'id':_0xcbddf4[_0x09bd('0x48')]['id']}})[_0x09bd('0x27')](handleEntityNotFound(_0x125f08,null))[_0x09bd('0x27')](function(_0x35514a){if(_0x35514a){_0xcbddf4['body']['AccountId']=_0x35514a['id'];_0xcbddf4[_0x09bd('0x4d')]['Subjects']=integrations[_0x09bd('0x51')](_0xcbddf4[_0x09bd('0x4d')]['channel'],_0xcbddf4[_0x09bd('0x4d')]['type']);_0xcbddf4[_0x09bd('0x4d')][_0x09bd('0x52')]=integrations[_0x09bd('0x53')](_0xcbddf4[_0x09bd('0x4d')][_0x09bd('0x54')],_0xcbddf4[_0x09bd('0x4d')][_0x09bd('0x31')]);return db[_0x09bd('0x4f')][_0x09bd('0x4c')](_0xcbddf4[_0x09bd('0x4d')],{'include':[{'model':db[_0x09bd('0x55')],'as':_0x09bd('0x56')},{'model':db[_0x09bd('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x125f08,null))[_0x09bd('0x46')](handleError(_0x125f08,null));};exports[_0x09bd('0x57')]=function(_0x59e336,_0x22635b,_0x43ff6b){var _0x4525f5='';var _0x54ac20='';return db[_0x09bd('0x2e')][_0x09bd('0x58')]({'where':{'id':_0x59e336[_0x09bd('0x48')]['id']},'attributes':['id',_0x09bd('0x59'),_0x09bd('0x5a'),_0x09bd('0x5b')]})[_0x09bd('0x27')](handleEntityNotFound(_0x22635b,null))[_0x09bd('0x27')](function(_0x1ab6b1){if(_0x1ab6b1){_0x54ac20=_0x1ab6b1[_0x09bd('0x59')];_0x4525f5=_0x1ab6b1[_0x09bd('0x5a')];var _0x33187a=_0x1ab6b1['remoteUri'][_0x09bd('0x5c')](-0x1);if(_0x33187a==='/'){_0x4525f5=_0x4525f5[_0x09bd('0x5d')](0x0,_0x4525f5[_0x09bd('0x5e')](_0x33187a));}return rp({'method':'GET','uri':util[_0x09bd('0x5f')](_0x09bd('0x60'),_0x4525f5,'/api/selector/owners'),'headers':{'Authorization':_0x09bd('0x61')+_0x1ab6b1[_0x09bd('0x5b')]},'json':!![]});}})[_0x09bd('0x27')](function(_0x42a1b1){if(_0x42a1b1){var _0x421242=_0x42a1b1[_0x09bd('0x62')];var _0x3ff460=![];var _0x51cb88=null;for(_0x51cb88=0x0;_0x51cb88<_0x421242[_0x09bd('0x4a')];_0x51cb88++){if(_0x421242[_0x51cb88]['email']===_0x54ac20){_0x3ff460=!![];}}if(_0x3ff460){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x09bd('0x63')});}}})['then'](respondWithResult(_0x22635b,null))[_0x09bd('0x46')](function(_0x43d37c){var _0x25ce9a=_0x59e336[_0x09bd('0x35')][_0x09bd('0x64')]?0x1f4:_0x43d37c[_0x09bd('0x65')]||0x1f4;logger[_0x09bd('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0x09bd('0x57'),_0x25ce9a,JSON[_0x09bd('0x66')](_0x43d37c));delete _0x43d37c[_0x09bd('0x2c')];if(_0x25ce9a===0x191){_0x25ce9a=0x190;}_0x22635b[_0x09bd('0x1c')](_0x25ce9a)['send'](_0x59e336[_0x09bd('0x35')][_0x09bd('0x64')]?{'message':_0x09bd('0x67'),'statusCode':_0x43d37c[_0x09bd('0x65')]}:_0x43d37c);});}; \ No newline at end of file +var _0xe429=['findOne','FreshsalesConfiguration','pick','getConfigurations','addConfiguration','Subjects','channel','type','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','slice','substring','GET','format','%s%s','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','params','intersection','create','body','catch','find'];(function(_0x150305,_0x18d939){var _0x114516=function(_0xdf025c){while(--_0xdf025c){_0x150305['push'](_0x150305['shift']());}};_0x114516(++_0x18d939);}(_0xe429,0x7b));var _0x9e42=function(_0x538b04,_0x12a991){_0x538b04=_0x538b04-0x0;var _0x517be3=_0xe429[_0x538b04];return _0x517be3;};'use strict';var emlformat=require(_0x9e42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e42('0x1'));var jsonpatch=require(_0x9e42('0x2'));var rp=require(_0x9e42('0x3'));var moment=require('moment');var BPromise=require(_0x9e42('0x4'));var Mustache=require('mustache');var util=require(_0x9e42('0x5'));var path=require('path');var sox=require(_0x9e42('0x6'));var csv=require('to-csv');var ejs=require(_0x9e42('0x7'));var fs=require('fs');var fs_extra=require(_0x9e42('0x8'));var _=require(_0x9e42('0x9'));var squel=require(_0x9e42('0xa'));var crypto=require('crypto');var jsforce=require(_0x9e42('0xb'));var deskjs=require(_0x9e42('0xc'));var toCsv=require(_0x9e42('0xd'));var querystring=require(_0x9e42('0xe'));var Papa=require(_0x9e42('0xf'));var Redis=require(_0x9e42('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9e42('0x11'));var as=require(_0x9e42('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e42('0x13'))(_0x9e42('0x14'));var utils=require('../../config/utils');var config=require(_0x9e42('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x9e42('0x16'));function respondWithStatusCode(_0x15d9c0,_0x3248a4){_0x3248a4=_0x3248a4||0xcc;return function(_0x5e41e4){if(_0x5e41e4){return _0x15d9c0['sendStatus'](_0x3248a4);}return _0x15d9c0[_0x9e42('0x17')](_0x3248a4)['end']();};}function respondWithResult(_0x4d8c6f,_0xfe67db){_0xfe67db=_0xfe67db||0xc8;return function(_0x51f5a6){if(_0x51f5a6){return _0x4d8c6f['status'](_0xfe67db)[_0x9e42('0x18')](_0x51f5a6);}};}function respondWithFilteredResult(_0x1e793e,_0x2e2c7e){return function(_0x5b0cd5){if(_0x5b0cd5){var _0x33156c=typeof _0x2e2c7e[_0x9e42('0x19')]==='undefined'&&typeof _0x2e2c7e[_0x9e42('0x1a')]===_0x9e42('0x1b');var _0x40f836=_0x5b0cd5[_0x9e42('0x1c')];var _0x207525=_0x33156c?0x0:_0x2e2c7e[_0x9e42('0x19')];var _0x7179d7=_0x33156c?_0x5b0cd5[_0x9e42('0x1c')]:_0x2e2c7e['offset']+_0x2e2c7e[_0x9e42('0x1a')];var _0x216ec1;if(_0x7179d7>=_0x40f836){_0x7179d7=_0x40f836;_0x216ec1=0xc8;}else{_0x216ec1=0xce;}_0x1e793e[_0x9e42('0x17')](_0x216ec1);return _0x1e793e[_0x9e42('0x1d')](_0x9e42('0x1e'),_0x207525+'-'+_0x7179d7+'/'+_0x40f836)['json'](_0x5b0cd5);}return null;};}function patchUpdates(_0x101ec6){return function(_0x136e03){try{jsonpatch[_0x9e42('0x1f')](_0x136e03,_0x101ec6,!![]);}catch(_0x359a7a){return BPromise['reject'](_0x359a7a);}return _0x136e03[_0x9e42('0x20')]();};}function saveUpdates(_0x523b92,_0x1f22db){return function(_0x29cf11){if(_0x29cf11){return _0x29cf11['update'](_0x523b92)[_0x9e42('0x21')](function(_0xd40ca9){return _0xd40ca9;});}return null;};}function removeEntity(_0x28ba01,_0x7edec1){return function(_0x4d3dda){if(_0x4d3dda){return _0x4d3dda[_0x9e42('0x22')]()[_0x9e42('0x21')](function(){_0x28ba01[_0x9e42('0x17')](0xcc)[_0x9e42('0x23')]();});}};}function handleEntityNotFound(_0x407902,_0x4c2102){return function(_0x5407cd){if(!_0x5407cd){_0x407902[_0x9e42('0x24')](0x194);}return _0x5407cd;};}function handleError(_0x430ff8,_0x43099c){_0x43099c=_0x43099c||0x1f4;return function(_0x17a939){logger[_0x9e42('0x25')](_0x17a939[_0x9e42('0x26')]);if(_0x17a939['name']){delete _0x17a939[_0x9e42('0x27')];}_0x430ff8['status'](_0x43099c)[_0x9e42('0x28')](_0x17a939);};}exports[_0x9e42('0x29')]=function(_0x3a4ee9,_0x5b2a93){var _0x463cf7={},_0x268079={},_0x265207={'count':0x0,'rows':[]};var _0x31a124=_[_0x9e42('0x2a')](db[_0x9e42('0x2b')][_0x9e42('0x2c')],function(_0x2b1c49){return{'name':_0x2b1c49[_0x9e42('0x2d')],'type':_0x2b1c49['type']['key']};});_0x268079[_0x9e42('0x2e')]=_[_0x9e42('0x2a')](_0x31a124,'name');_0x268079[_0x9e42('0x2f')]=_[_0x9e42('0x30')](_0x3a4ee9[_0x9e42('0x2f')]);_0x268079[_0x9e42('0x31')]=_['intersection'](_0x268079['model'],_0x268079['query']);_0x463cf7[_0x9e42('0x32')]=_['intersection'](_0x268079[_0x9e42('0x2e')],qs[_0x9e42('0x33')](_0x3a4ee9[_0x9e42('0x2f')]['fields']));_0x463cf7[_0x9e42('0x32')]=_0x463cf7[_0x9e42('0x32')][_0x9e42('0x34')]?_0x463cf7[_0x9e42('0x32')]:_0x268079[_0x9e42('0x2e')];if(!_0x3a4ee9[_0x9e42('0x2f')][_0x9e42('0x35')](_0x9e42('0x36'))){_0x463cf7['limit']=qs[_0x9e42('0x1a')](_0x3a4ee9['query'][_0x9e42('0x1a')]);_0x463cf7['offset']=qs[_0x9e42('0x19')](_0x3a4ee9[_0x9e42('0x2f')]['offset']);}_0x463cf7[_0x9e42('0x37')]=qs[_0x9e42('0x38')](_0x3a4ee9[_0x9e42('0x2f')]['sort']);_0x463cf7[_0x9e42('0x39')]=qs[_0x9e42('0x31')](_['pick'](_0x3a4ee9['query'],_0x268079[_0x9e42('0x31')]),_0x31a124);if(_0x3a4ee9[_0x9e42('0x2f')][_0x9e42('0x3a')]){_0x463cf7[_0x9e42('0x39')]=_['merge'](_0x463cf7[_0x9e42('0x39')],{'$or':_[_0x9e42('0x2a')](_0x31a124,function(_0x5d9656){if(_0x5d9656['type']!==_0x9e42('0x3b')){var _0xa640d6={};_0xa640d6[_0x5d9656[_0x9e42('0x27')]]={'$like':'%'+_0x3a4ee9['query']['filter']+'%'};return _0xa640d6;}})});}_0x463cf7=_[_0x9e42('0x3c')]({},_0x463cf7,_0x3a4ee9[_0x9e42('0x3d')]);var _0x26eb2a={'where':_0x463cf7[_0x9e42('0x39')]};return db[_0x9e42('0x2b')][_0x9e42('0x1c')](_0x26eb2a)['then'](function(_0x5bbf3e){_0x265207[_0x9e42('0x1c')]=_0x5bbf3e;if(_0x3a4ee9['query'][_0x9e42('0x3e')]){_0x463cf7[_0x9e42('0x3f')]=[{'all':!![]}];}return db[_0x9e42('0x2b')]['findAll'](_0x463cf7);})['then'](function(_0x3c5fa6){_0x265207[_0x9e42('0x40')]=_0x3c5fa6;return _0x265207;})[_0x9e42('0x21')](respondWithFilteredResult(_0x5b2a93,_0x463cf7))['catch'](handleError(_0x5b2a93,null));};exports['show']=function(_0x2842ac,_0x50c075){var _0x58dbae={'raw':![],'where':{'id':_0x2842ac[_0x9e42('0x41')]['id']}},_0x1b7f73={};_0x1b7f73[_0x9e42('0x2e')]=_[_0x9e42('0x30')](db['FreshsalesAccount'][_0x9e42('0x2c')]);_0x1b7f73[_0x9e42('0x2f')]=_[_0x9e42('0x30')](_0x2842ac[_0x9e42('0x2f')]);_0x1b7f73[_0x9e42('0x31')]=_[_0x9e42('0x42')](_0x1b7f73['model'],_0x1b7f73[_0x9e42('0x2f')]);_0x58dbae[_0x9e42('0x32')]=_[_0x9e42('0x42')](_0x1b7f73[_0x9e42('0x2e')],qs[_0x9e42('0x33')](_0x2842ac['query'][_0x9e42('0x33')]));_0x58dbae[_0x9e42('0x32')]=_0x58dbae['attributes'][_0x9e42('0x34')]?_0x58dbae[_0x9e42('0x32')]:_0x1b7f73[_0x9e42('0x2e')];if(_0x2842ac[_0x9e42('0x2f')]['includeAll']){_0x58dbae['include']=[{'all':!![]}];}_0x58dbae=_[_0x9e42('0x3c')]({},_0x58dbae,_0x2842ac[_0x9e42('0x3d')]);return db[_0x9e42('0x2b')]['find'](_0x58dbae)['then'](handleEntityNotFound(_0x50c075,null))[_0x9e42('0x21')](respondWithResult(_0x50c075,null))['catch'](handleError(_0x50c075,null));};exports[_0x9e42('0x43')]=function(_0x539fe7,_0x4c4f7b){return db['FreshsalesAccount']['create'](_0x539fe7[_0x9e42('0x44')],{})['then'](respondWithResult(_0x4c4f7b,0xc9))[_0x9e42('0x45')](handleError(_0x4c4f7b,null));};exports['update']=function(_0x175820,_0x1a4264){if(_0x175820['body']['id']){delete _0x175820['body']['id'];}return db[_0x9e42('0x2b')]['find']({'where':{'id':_0x175820['params']['id']}})[_0x9e42('0x21')](handleEntityNotFound(_0x1a4264,null))[_0x9e42('0x21')](saveUpdates(_0x175820['body'],null))[_0x9e42('0x21')](respondWithResult(_0x1a4264,null))[_0x9e42('0x45')](handleError(_0x1a4264,null));};exports['destroy']=function(_0x1d29ac,_0x163291){return db[_0x9e42('0x2b')][_0x9e42('0x46')]({'where':{'id':_0x1d29ac[_0x9e42('0x41')]['id']}})['then'](handleEntityNotFound(_0x163291,null))[_0x9e42('0x21')](removeEntity(_0x163291,null))['catch'](handleError(_0x163291,null));};exports['getConfigurations']=function(_0x58e436,_0x3cc3bc,_0x46c038){var _0x19eb8f={};var _0x45617d={};var _0x2c07c4;var _0x4b0fbb;return db[_0x9e42('0x2b')][_0x9e42('0x47')]({'where':{'id':_0x58e436['params']['id']}})[_0x9e42('0x21')](handleEntityNotFound(_0x3cc3bc,null))[_0x9e42('0x21')](function(_0x27bbb2){if(_0x27bbb2){_0x2c07c4=_0x27bbb2;_0x45617d['model']=_['keys'](db[_0x9e42('0x48')][_0x9e42('0x2c')]);_0x45617d[_0x9e42('0x2f')]=_['keys'](_0x58e436['query']);_0x45617d[_0x9e42('0x31')]=_[_0x9e42('0x42')](_0x45617d[_0x9e42('0x2e')],_0x45617d['query']);_0x19eb8f[_0x9e42('0x32')]=_['intersection'](_0x45617d[_0x9e42('0x2e')],qs['fields'](_0x58e436[_0x9e42('0x2f')][_0x9e42('0x33')]));_0x19eb8f['attributes']=_0x19eb8f[_0x9e42('0x32')][_0x9e42('0x34')]?_0x19eb8f['attributes']:_0x45617d[_0x9e42('0x2e')];_0x19eb8f[_0x9e42('0x37')]=qs[_0x9e42('0x38')](_0x58e436[_0x9e42('0x2f')]['sort']);_0x19eb8f['where']=qs[_0x9e42('0x31')](_[_0x9e42('0x49')](_0x58e436['query'],_0x45617d[_0x9e42('0x31')]));if(_0x58e436[_0x9e42('0x2f')][_0x9e42('0x3a')]){_0x19eb8f['where']=_['merge'](_0x19eb8f[_0x9e42('0x39')],{'$or':_[_0x9e42('0x2a')](_0x19eb8f['attributes'],function(_0x474f6d){var _0xad91ce={};_0xad91ce[_0x474f6d]={'$like':'%'+_0x58e436[_0x9e42('0x2f')]['filter']+'%'};return _0xad91ce;})});}_0x19eb8f=_['merge']({},_0x19eb8f,_0x58e436[_0x9e42('0x3d')]);return _0x2c07c4[_0x9e42('0x4a')](_0x19eb8f);}})[_0x9e42('0x21')](function(_0x439090){if(_0x439090){_0x4b0fbb=_0x439090[_0x9e42('0x34')];if(!_0x58e436['query'][_0x9e42('0x35')](_0x9e42('0x36'))){_0x19eb8f['limit']=qs[_0x9e42('0x1a')](_0x58e436['query'][_0x9e42('0x1a')]);_0x19eb8f[_0x9e42('0x19')]=qs['offset'](_0x58e436[_0x9e42('0x2f')][_0x9e42('0x19')]);}return _0x2c07c4[_0x9e42('0x4a')](_0x19eb8f);}})['then'](function(_0x435e0d){if(_0x435e0d){return _0x435e0d?{'count':_0x4b0fbb,'rows':_0x435e0d}:null;}})[_0x9e42('0x21')](respondWithResult(_0x3cc3bc,null))[_0x9e42('0x45')](handleError(_0x3cc3bc,null));};exports[_0x9e42('0x4b')]=function(_0x9520f1,_0x14548b,_0x481646){if(_0x9520f1['body']['id']){delete _0x9520f1['body']['id'];}return db[_0x9e42('0x2b')][_0x9e42('0x47')]({'where':{'id':_0x9520f1[_0x9e42('0x41')]['id']}})['then'](handleEntityNotFound(_0x14548b,null))['then'](function(_0x1370be){if(_0x1370be){_0x9520f1['body']['AccountId']=_0x1370be['id'];_0x9520f1[_0x9e42('0x44')][_0x9e42('0x4c')]=integrations['getSubjects'](_0x9520f1['body'][_0x9e42('0x4d')],_0x9520f1[_0x9e42('0x44')][_0x9e42('0x4e')]);_0x9520f1[_0x9e42('0x44')]['Descriptions']=integrations[_0x9e42('0x4f')](_0x9520f1[_0x9e42('0x44')]['channel'],_0x9520f1[_0x9e42('0x44')][_0x9e42('0x4e')]);return db[_0x9e42('0x48')][_0x9e42('0x43')](_0x9520f1['body'],{'include':[{'model':db[_0x9e42('0x50')],'as':_0x9e42('0x4c')},{'model':db[_0x9e42('0x50')],'as':_0x9e42('0x51')}]});}return null;})[_0x9e42('0x21')](respondWithResult(_0x14548b,null))[_0x9e42('0x45')](handleError(_0x14548b,null));};exports[_0x9e42('0x52')]=function(_0x4cf233,_0x416724,_0x143b7d){var _0x2e0989='';var _0x4f8d20='';return db['FreshsalesAccount'][_0x9e42('0x47')]({'where':{'id':_0x4cf233[_0x9e42('0x41')]['id']},'attributes':['id',_0x9e42('0x53'),'remoteUri','apiKey']})[_0x9e42('0x21')](handleEntityNotFound(_0x416724,null))['then'](function(_0x5c0c14){if(_0x5c0c14){_0x4f8d20=_0x5c0c14[_0x9e42('0x53')];_0x2e0989=_0x5c0c14[_0x9e42('0x54')];var _0x190db6=_0x5c0c14[_0x9e42('0x54')][_0x9e42('0x55')](-0x1);if(_0x190db6==='/'){_0x2e0989=_0x2e0989[_0x9e42('0x56')](0x0,_0x2e0989['lastIndexOf'](_0x190db6));}return rp({'method':_0x9e42('0x57'),'uri':util[_0x9e42('0x58')](_0x9e42('0x59'),_0x2e0989,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x5c0c14['apiKey']},'json':!![]});}})[_0x9e42('0x21')](function(_0x2167f5){if(_0x2167f5){var _0x4c222c=_0x2167f5['users'];var _0x28a41e=![];var _0x497ec7=null;for(_0x497ec7=0x0;_0x497ec7<_0x4c222c['length'];_0x497ec7++){if(_0x4c222c[_0x497ec7][_0x9e42('0x5a')]===_0x4f8d20){_0x28a41e=!![];}}if(_0x28a41e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9e42('0x5b')});}}})[_0x9e42('0x21')](respondWithResult(_0x416724,null))[_0x9e42('0x45')](function(_0x243724){var _0x1ddd3d=_0x4cf233[_0x9e42('0x2f')][_0x9e42('0x5c')]?0x1f4:_0x243724[_0x9e42('0x5d')]||0x1f4;logger[_0x9e42('0x25')](_0x9e42('0x5e'),_0x9e42('0x52'),_0x1ddd3d,JSON[_0x9e42('0x5f')](_0x243724));delete _0x243724[_0x9e42('0x27')];if(_0x1ddd3d===0x191){_0x1ddd3d=0x190;}_0x416724[_0x9e42('0x17')](_0x1ddd3d)[_0x9e42('0x28')](_0x4cf233[_0x9e42('0x2f')]['test']?{'message':_0x9e42('0x60'),'statusCode':_0x243724[_0x9e42('0x5d')]}:_0x243724);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index b87492b..e134aa1 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 _0xf2e3=['int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount'];(function(_0x886b20,_0x272561){var _0x42c280=function(_0x4176d1){while(--_0x4176d1){_0x886b20['push'](_0x886b20['shift']());}};_0x42c280(++_0x272561);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xf2e3[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x3f2e('0xa')]=function(_0xdd6b3e,_0x3c0864){return _0xdd6b3e[_0x3f2e('0xb')](_0x3f2e('0xc'),attributes,{'tableName':_0x3f2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd0=['path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xdafc1b,_0x2e33a2){var _0x31de5b=function(_0x9b2f1e){while(--_0x9b2f1e){_0xdafc1b['push'](_0xdafc1b['shift']());}};_0x31de5b(++_0x2e33a2);}(_0x7bd0,0x111));var _0x07bd=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x7bd0[_0x4bed75];return _0x2dd8e8;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var logger=require(_0x07bd('0x2'))(_0x07bd('0x3'));var moment=require(_0x07bd('0x4'));var BPromise=require(_0x07bd('0x5'));var rp=require(_0x07bd('0x6'));var fs=require('fs');var path=require(_0x07bd('0x7'));var rimraf=require('rimraf');var config=require(_0x07bd('0x8'));var attributes=require(_0x07bd('0x9'));var integrations=require(_0x07bd('0xa'));module[_0x07bd('0xb')]=function(_0x3e8349,_0x422a22){return _0x3e8349[_0x07bd('0xc')]('FreshsalesAccount',attributes,{'tableName':_0x07bd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 336ffc8..82fe3ec 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 _0x5f2f=['map','include','model','attributes','then','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','limit'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2afc4c,_0x9e22c7){_0x2afc4c=_0x2afc4c-0x0;var _0x28ab34=_0x5f2f[_0x2afc4c];return _0x28ab34;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetFreshsalesAccount',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetFreshsalesAccount',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowFreshsalesAccount',_0x153924);logger[_0xf5f2('0xf')]('ShowFreshsalesAccount',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowFreshsalesAccount',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0x160f=['../../config/environment','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowFreshsalesAccount','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')]({'raw':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')][_0xf160('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b8185[_0xf160('0x19')]?_0x4b8185['options'][_0xf160('0x1b')]||null:null,'attributes':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')]['attributes']||null:null,'limit':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')][_0xf160('0x1c')]||null:null,'include':_0x4b8185[_0xf160('0x19')]?_0x4b8185[_0xf160('0x19')][_0xf160('0x1d')]?_[_0xf160('0x1e')](_0x4b8185['options'][_0xf160('0x1d')],function(_0x28bf27){return{'model':db[_0x28bf27[_0xf160('0x1f')]],'as':_0x28bf27['as'],'attributes':_0x28bf27[_0xf160('0x20')],'include':_0x28bf27['include']?_[_0xf160('0x1e')](_0x28bf27[_0xf160('0x1d')],function(_0x4a8003){return{'model':db[_0x4a8003['model']],'as':_0x4a8003['as'],'attributes':_0x4a8003[_0xf160('0x20')],'include':_0x4a8003[_0xf160('0x1d')]?_[_0xf160('0x1e')](_0x4a8003['include'],function(_0xcfa9bd){return{'model':db[_0xcfa9bd[_0xf160('0x1f')]],'as':_0xcfa9bd['as'],'attributes':_0xcfa9bd[_0xf160('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf160('0xc')](function(_0x135e0f){logger[_0xf160('0xd')]('GetFreshsalesAccount',_0x4b8185);logger['debug']('GetFreshsalesAccount',_0x4b8185,JSON[_0xf160('0x11')](_0x135e0f));_0x1cf6ba(_0x135e0f);})[_0xf160('0x15')](function(_0xcaab39){logger[_0xf160('0x12')](_0xf160('0x16'),_0xcaab39['message'],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0xcaab39[_0xf160('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x4ce478){var _0x22c2e3=this;return new Promise(function(_0x3a35b3,_0x5497f6){return db[_0xf160('0x17')][_0xf160('0x21')]({'raw':_0x4ce478['options']?_0x4ce478['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ce478['options']?_0x4ce478[_0xf160('0x19')][_0xf160('0x1b')]||null:null,'attributes':_0x4ce478[_0xf160('0x19')]?_0x4ce478[_0xf160('0x19')][_0xf160('0x20')]||null:null,'include':_0x4ce478[_0xf160('0x19')]?_0x4ce478['options']['include']?_['map'](_0x4ce478[_0xf160('0x19')]['include'],function(_0x5c65d2){return{'model':db[_0x5c65d2[_0xf160('0x1f')]],'as':_0x5c65d2['as'],'attributes':_0x5c65d2[_0xf160('0x20')],'include':_0x5c65d2['include']?_[_0xf160('0x1e')](_0x5c65d2[_0xf160('0x1d')],function(_0x272efe){return{'model':db[_0x272efe[_0xf160('0x1f')]],'as':_0x272efe['as'],'attributes':_0x272efe[_0xf160('0x20')],'include':_0x272efe['include']?_[_0xf160('0x1e')](_0x272efe[_0xf160('0x1d')],function(_0x15070a){return{'model':db[_0x15070a['model']],'as':_0x15070a['as'],'attributes':_0x15070a[_0xf160('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf160('0xc')](function(_0x1e4bd6){logger[_0xf160('0xd')](_0xf160('0x22'),_0x4ce478);logger[_0xf160('0x23')]('ShowFreshsalesAccount',_0x4ce478,JSON['stringify'](_0x1e4bd6));_0x3a35b3(_0x1e4bd6);})[_0xf160('0x15')](function(_0x21c248){logger[_0xf160('0x12')](_0xf160('0x22'),_0x21c248[_0xf160('0x14')],_0x4ce478);_0x5497f6(_0x22c2e3[_0xf160('0x12')](0x1f4,_0x21c248[_0xf160('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 97d375b..410aa6a 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 _0xd5f6=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','delete','destroy'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0xd5f6,0xcf));var _0x6d5f=function(_0x1eae48,_0x565378){_0x1eae48=_0x1eae48-0x0;var _0x15c30c=_0xd5f6[_0x1eae48];return _0x15c30c;};'use strict';var multer=require(_0x6d5f('0x0'));var util=require(_0x6d5f('0x1'));var path=require(_0x6d5f('0x2'));var timeout=require(_0x6d5f('0x3'));var express=require('express');var router=express[_0x6d5f('0x4')]();var fs_extra=require(_0x6d5f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6d5f('0x6'));var config=require('../../config/environment');var controller=require(_0x6d5f('0x7'));router['get']('/',auth[_0x6d5f('0x8')](),controller[_0x6d5f('0x9')]);router[_0x6d5f('0xa')](_0x6d5f('0xb'),auth[_0x6d5f('0x8')](),controller[_0x6d5f('0xc')]);router[_0x6d5f('0xa')](_0x6d5f('0xd'),auth['isAuthenticated'](),controller[_0x6d5f('0xe')]);router[_0x6d5f('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x6d5f('0xf')]);router[_0x6d5f('0xa')](_0x6d5f('0x10'),auth[_0x6d5f('0x8')](),controller[_0x6d5f('0x11')]);router[_0x6d5f('0x12')]('/',auth[_0x6d5f('0x8')](),controller[_0x6d5f('0x13')]);router[_0x6d5f('0x14')](_0x6d5f('0xb'),auth[_0x6d5f('0x8')](),controller['update']);router[_0x6d5f('0x15')](_0x6d5f('0xb'),auth[_0x6d5f('0x8')](),controller[_0x6d5f('0x16')]);module['exports']=router; \ No newline at end of file +var _0xfe2f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','/:id','update','destroy','multer','path','connect-timeout'];(function(_0x47102e,_0x36bd71){var _0x2bb72e=function(_0x11a506){while(--_0x11a506){_0x47102e['push'](_0x47102e['shift']());}};_0x2bb72e(++_0x36bd71);}(_0xfe2f,0x11d));var _0xffe2=function(_0x490694,_0x154e8d){_0x490694=_0x490694-0x0;var _0x421ccd=_0xfe2f[_0x490694];return _0x421ccd;};'use strict';var multer=require(_0xffe2('0x0'));var util=require('util');var path=require(_0xffe2('0x1'));var timeout=require(_0xffe2('0x2'));var express=require(_0xffe2('0x3'));var router=express[_0xffe2('0x4')]();var fs_extra=require(_0xffe2('0x5'));var auth=require(_0xffe2('0x6'));var interaction=require(_0xffe2('0x7'));var config=require(_0xffe2('0x8'));var controller=require(_0xffe2('0x9'));router[_0xffe2('0xa')]('/',auth[_0xffe2('0xb')](),controller[_0xffe2('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xffe2('0xd')]);router['get'](_0xffe2('0xe'),auth[_0xffe2('0xb')](),controller[_0xffe2('0xf')]);router[_0xffe2('0xa')](_0xffe2('0x10'),auth[_0xffe2('0xb')](),controller[_0xffe2('0x11')]);router[_0xffe2('0xa')](_0xffe2('0x12'),auth[_0xffe2('0xb')](),controller['getFields']);router[_0xffe2('0x13')]('/',auth[_0xffe2('0xb')](),controller[_0xffe2('0x14')]);router['put'](_0xffe2('0x15'),auth['isAuthenticated'](),controller[_0xffe2('0x16')]);router['delete']('/:id',auth[_0xffe2('0xb')](),controller[_0xffe2('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index b0300b5..6a379bc 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 _0xda8e=['STRING','exports'];(function(_0x2be1ab,_0x2fe1fc){var _0x4c616d=function(_0x16dfc8){while(--_0x16dfc8){_0x2be1ab['push'](_0x2be1ab['shift']());}};_0x4c616d(++_0x2fe1fc);}(_0xda8e,0xc5));var _0xeda8=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0xda8e[_0x3f5dca];return _0x5b833a;};'use strict';var Sequelize=require('sequelize');module[_0xeda8('0x0')]={'name':{'type':Sequelize[_0xeda8('0x1')]},'description':{'type':Sequelize[_0xeda8('0x1')]}}; \ No newline at end of file +var _0x9df3=['STRING','sequelize','exports'];(function(_0x106f64,_0x1fe8a2){var _0x386f61=function(_0x51bc61){while(--_0x51bc61){_0x106f64['push'](_0x106f64['shift']());}};_0x386f61(++_0x1fe8a2);}(_0x9df3,0x73));var _0x39df=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x9df3[_0x50007c];return _0x5c1ec7;};'use strict';var Sequelize=require(_0x39df('0x0'));module[_0x39df('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x39df('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 0e39ca2..33f7228 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 _0x164e=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FreshsalesConfiguration','includeAll','include','show','rawAttributes','options','catch','create','body','find','params','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache'];(function(_0x373756,_0x123262){var _0x420ba3=function(_0x2e3a24){while(--_0x2e3a24){_0x373756['push'](_0x373756['shift']());}};_0x420ba3(++_0x123262);}(_0x164e,0x136));var _0xe164=function(_0x5afb77,_0xdad1e1){_0x5afb77=_0x5afb77-0x0;var _0x477268=_0x164e[_0x5afb77];return _0x477268;};'use strict';var emlformat=require(_0xe164('0x0'));var rimraf=require(_0xe164('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe164('0x2'));var rp=require(_0xe164('0x3'));var moment=require(_0xe164('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe164('0x5'));var util=require(_0xe164('0x6'));var path=require(_0xe164('0x7'));var sox=require(_0xe164('0x8'));var csv=require(_0xe164('0x9'));var ejs=require(_0xe164('0xa'));var fs=require('fs');var fs_extra=require(_0xe164('0xb'));var _=require(_0xe164('0xc'));var squel=require(_0xe164('0xd'));var crypto=require(_0xe164('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe164('0xf'));var toCsv=require(_0xe164('0x9'));var querystring=require('querystring');var Papa=require(_0xe164('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe164('0x11'));var as=require(_0xe164('0x12'));var hardwareService=require(_0xe164('0x13'));var logger=require('../../config/logger')(_0xe164('0x14'));var utils=require(_0xe164('0x15'));var config=require(_0xe164('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10dd67,_0xe81a29){_0xe81a29=_0xe81a29||0xcc;return function(_0x4110d6){if(_0x4110d6){return _0x10dd67[_0xe164('0x17')](_0xe81a29);}return _0x10dd67[_0xe164('0x18')](_0xe81a29)[_0xe164('0x19')]();};}function respondWithResult(_0x4dfcd3,_0x3f5ad6){_0x3f5ad6=_0x3f5ad6||0xc8;return function(_0x2a910a){if(_0x2a910a){return _0x4dfcd3['status'](_0x3f5ad6)[_0xe164('0x1a')](_0x2a910a);}};}function respondWithFilteredResult(_0x1087cb,_0x5a1014){return function(_0x47a547){if(_0x47a547){var _0x1a9bb3=typeof _0x5a1014['offset']===_0xe164('0x1b')&&typeof _0x5a1014['limit']===_0xe164('0x1b');var _0xd59489=_0x47a547[_0xe164('0x1c')];var _0x5f5db6=_0x1a9bb3?0x0:_0x5a1014[_0xe164('0x1d')];var _0x16001f=_0x1a9bb3?_0x47a547[_0xe164('0x1c')]:_0x5a1014[_0xe164('0x1d')]+_0x5a1014[_0xe164('0x1e')];var _0x2e4e2e;if(_0x16001f>=_0xd59489){_0x16001f=_0xd59489;_0x2e4e2e=0xc8;}else{_0x2e4e2e=0xce;}_0x1087cb[_0xe164('0x18')](_0x2e4e2e);return _0x1087cb[_0xe164('0x1f')](_0xe164('0x20'),_0x5f5db6+'-'+_0x16001f+'/'+_0xd59489)[_0xe164('0x1a')](_0x47a547);}return null;};}function patchUpdates(_0x185172){return function(_0x36941f){try{jsonpatch[_0xe164('0x21')](_0x36941f,_0x185172,!![]);}catch(_0x45977a){return BPromise[_0xe164('0x22')](_0x45977a);}return _0x36941f[_0xe164('0x23')]();};}function saveUpdates(_0x3e9a49,_0x14070d){return function(_0x3097fe){if(_0x3097fe){return _0x3097fe[_0xe164('0x24')](_0x3e9a49)[_0xe164('0x25')](function(_0x33bca4){return _0x33bca4;});}return null;};}function removeEntity(_0x1c9825,_0x57ca02){return function(_0x41829a){if(_0x41829a){return _0x41829a[_0xe164('0x26')]()['then'](function(){_0x1c9825[_0xe164('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d11e2,_0x4c4f1b){return function(_0x33a995){if(!_0x33a995){_0x4d11e2[_0xe164('0x17')](0x194);}return _0x33a995;};}function handleError(_0x4ccd7a,_0x1860fe){_0x1860fe=_0x1860fe||0x1f4;return function(_0x528e97){logger[_0xe164('0x27')](_0x528e97[_0xe164('0x28')]);if(_0x528e97[_0xe164('0x29')]){delete _0x528e97['name'];}_0x4ccd7a[_0xe164('0x18')](_0x1860fe)['send'](_0x528e97);};}exports[_0xe164('0x2a')]=function(_0x41614c,_0x584ff1){var _0x134a89={},_0x49fa16={},_0x58b40a={'count':0x0,'rows':[]};var _0x1a82f9=_['map'](db['FreshsalesConfiguration']['rawAttributes'],function(_0x41fe11){return{'name':_0x41fe11['fieldName'],'type':_0x41fe11[_0xe164('0x2b')][_0xe164('0x2c')]};});_0x49fa16['model']=_[_0xe164('0x2d')](_0x1a82f9,_0xe164('0x29'));_0x49fa16[_0xe164('0x2e')]=_[_0xe164('0x2f')](_0x41614c['query']);_0x49fa16[_0xe164('0x30')]=_[_0xe164('0x31')](_0x49fa16[_0xe164('0x32')],_0x49fa16[_0xe164('0x2e')]);_0x134a89[_0xe164('0x33')]=_['intersection'](_0x49fa16[_0xe164('0x32')],qs[_0xe164('0x34')](_0x41614c[_0xe164('0x2e')][_0xe164('0x34')]));_0x134a89[_0xe164('0x33')]=_0x134a89[_0xe164('0x33')][_0xe164('0x35')]?_0x134a89[_0xe164('0x33')]:_0x49fa16['model'];if(!_0x41614c[_0xe164('0x2e')][_0xe164('0x36')](_0xe164('0x37'))){_0x134a89[_0xe164('0x1e')]=qs[_0xe164('0x1e')](_0x41614c[_0xe164('0x2e')][_0xe164('0x1e')]);_0x134a89[_0xe164('0x1d')]=qs[_0xe164('0x1d')](_0x41614c[_0xe164('0x2e')][_0xe164('0x1d')]);}_0x134a89[_0xe164('0x38')]=qs[_0xe164('0x39')](_0x41614c[_0xe164('0x2e')][_0xe164('0x39')]);_0x134a89[_0xe164('0x3a')]=qs[_0xe164('0x30')](_[_0xe164('0x3b')](_0x41614c[_0xe164('0x2e')],_0x49fa16[_0xe164('0x30')]),_0x1a82f9);if(_0x41614c[_0xe164('0x2e')][_0xe164('0x3c')]){_0x134a89['where']=_[_0xe164('0x3d')](_0x134a89[_0xe164('0x3a')],{'$or':_[_0xe164('0x2d')](_0x1a82f9,function(_0x2a502c){if(_0x2a502c[_0xe164('0x2b')]!==_0xe164('0x3e')){var _0x5bd2b3={};_0x5bd2b3[_0x2a502c['name']]={'$like':'%'+_0x41614c['query'][_0xe164('0x3c')]+'%'};return _0x5bd2b3;}})});}_0x134a89=_[_0xe164('0x3d')]({},_0x134a89,_0x41614c['options']);var _0x1284f0={'where':_0x134a89[_0xe164('0x3a')]};return db[_0xe164('0x3f')][_0xe164('0x1c')](_0x1284f0)[_0xe164('0x25')](function(_0x28e776){_0x58b40a['count']=_0x28e776;if(_0x41614c[_0xe164('0x2e')][_0xe164('0x40')]){_0x134a89[_0xe164('0x41')]=[{'all':!![]}];}return db[_0xe164('0x3f')]['findAll'](_0x134a89);})[_0xe164('0x25')](function(_0x2676c0){_0x58b40a['rows']=_0x2676c0;return _0x58b40a;})[_0xe164('0x25')](respondWithFilteredResult(_0x584ff1,_0x134a89))['catch'](handleError(_0x584ff1,null));};exports[_0xe164('0x42')]=function(_0x7ed8f3,_0xf89e6){var _0x4210c3={'raw':![],'where':{'id':_0x7ed8f3['params']['id']}},_0x1d8bb7={};_0x1d8bb7[_0xe164('0x32')]=_[_0xe164('0x2f')](db[_0xe164('0x3f')][_0xe164('0x43')]);_0x1d8bb7[_0xe164('0x2e')]=_[_0xe164('0x2f')](_0x7ed8f3[_0xe164('0x2e')]);_0x1d8bb7[_0xe164('0x30')]=_[_0xe164('0x31')](_0x1d8bb7[_0xe164('0x32')],_0x1d8bb7[_0xe164('0x2e')]);_0x4210c3[_0xe164('0x33')]=_[_0xe164('0x31')](_0x1d8bb7[_0xe164('0x32')],qs[_0xe164('0x34')](_0x7ed8f3['query']['fields']));_0x4210c3[_0xe164('0x33')]=_0x4210c3[_0xe164('0x33')]['length']?_0x4210c3['attributes']:_0x1d8bb7[_0xe164('0x32')];if(_0x7ed8f3[_0xe164('0x2e')]['includeAll']){_0x4210c3[_0xe164('0x41')]=[{'all':!![]}];}_0x4210c3=_['merge']({},_0x4210c3,_0x7ed8f3[_0xe164('0x44')]);return db[_0xe164('0x3f')]['find'](_0x4210c3)[_0xe164('0x25')](handleEntityNotFound(_0xf89e6,null))[_0xe164('0x25')](respondWithResult(_0xf89e6,null))[_0xe164('0x45')](handleError(_0xf89e6,null));};exports['create']=function(_0x39b56f,_0x56f3be){return db[_0xe164('0x3f')][_0xe164('0x46')](_0x39b56f[_0xe164('0x47')],{})[_0xe164('0x25')](respondWithResult(_0x56f3be,0xc9))[_0xe164('0x45')](handleError(_0x56f3be,null));};exports['update']=function(_0x139475,_0x537577){if(_0x139475[_0xe164('0x47')]['id']){delete _0x139475['body']['id'];}return db[_0xe164('0x3f')][_0xe164('0x48')]({'where':{'id':_0x139475['params']['id']}})[_0xe164('0x25')](handleEntityNotFound(_0x537577,null))[_0xe164('0x25')](saveUpdates(_0x139475[_0xe164('0x47')],null))[_0xe164('0x25')](respondWithResult(_0x537577,null))['catch'](handleError(_0x537577,null));};exports[_0xe164('0x26')]=function(_0x53a8fd,_0x3c93c9){return db[_0xe164('0x3f')][_0xe164('0x48')]({'where':{'id':_0x53a8fd[_0xe164('0x49')]['id']}})[_0xe164('0x25')](handleEntityNotFound(_0x3c93c9,null))['then'](removeEntity(_0x3c93c9,null))[_0xe164('0x45')](handleError(_0x3c93c9,null));};exports[_0xe164('0x4a')]=function(_0x306bc8,_0x2a9b9b,_0x174e81){var _0x141173={};var _0x4b4354={};var _0x5e72aa;var _0x3f74e3;return db[_0xe164('0x3f')][_0xe164('0x4b')]({'where':{'id':_0x306bc8[_0xe164('0x49')]['id']}})[_0xe164('0x25')](handleEntityNotFound(_0x2a9b9b,null))[_0xe164('0x25')](function(_0x136380){if(_0x136380){_0x5e72aa=_0x136380;_0x4b4354[_0xe164('0x32')]=_[_0xe164('0x2f')](db[_0xe164('0x4c')][_0xe164('0x43')]);_0x4b4354[_0xe164('0x2e')]=_[_0xe164('0x2f')](_0x306bc8[_0xe164('0x2e')]);_0x4b4354[_0xe164('0x30')]=_['intersection'](_0x4b4354['model'],_0x4b4354[_0xe164('0x2e')]);_0x141173[_0xe164('0x33')]=_[_0xe164('0x31')](_0x4b4354['model'],qs['fields'](_0x306bc8['query'][_0xe164('0x34')]));_0x141173['attributes']=_0x141173['attributes'][_0xe164('0x35')]?_0x141173[_0xe164('0x33')]:_0x4b4354[_0xe164('0x32')];_0x141173[_0xe164('0x38')]=qs[_0xe164('0x39')](_0x306bc8[_0xe164('0x2e')][_0xe164('0x39')]);_0x141173['where']=qs[_0xe164('0x30')](_[_0xe164('0x3b')](_0x306bc8[_0xe164('0x2e')],_0x4b4354[_0xe164('0x30')]));if(_0x306bc8['query']['filter']){_0x141173['where']=_[_0xe164('0x3d')](_0x141173[_0xe164('0x3a')],{'$or':_['map'](_0x141173[_0xe164('0x33')],function(_0x322c2d){var _0x2f7bff={};_0x2f7bff[_0x322c2d]={'$like':'%'+_0x306bc8[_0xe164('0x2e')][_0xe164('0x3c')]+'%'};return _0x2f7bff;})});}_0x141173=_[_0xe164('0x3d')]({},_0x141173,_0x306bc8[_0xe164('0x44')]);return _0x5e72aa[_0xe164('0x4a')](_0x141173);}})[_0xe164('0x25')](function(_0x15d325){if(_0x15d325){_0x3f74e3=_0x15d325[_0xe164('0x35')];if(!_0x306bc8[_0xe164('0x2e')][_0xe164('0x36')](_0xe164('0x37'))){_0x141173[_0xe164('0x1e')]=qs[_0xe164('0x1e')](_0x306bc8[_0xe164('0x2e')][_0xe164('0x1e')]);_0x141173[_0xe164('0x1d')]=qs[_0xe164('0x1d')](_0x306bc8['query'][_0xe164('0x1d')]);}return _0x5e72aa[_0xe164('0x4a')](_0x141173);}})[_0xe164('0x25')](function(_0x319a21){if(_0x319a21){return _0x319a21?{'count':_0x3f74e3,'rows':_0x319a21}:null;}})['then'](respondWithResult(_0x2a9b9b,null))[_0xe164('0x45')](handleError(_0x2a9b9b,null));};exports[_0xe164('0x4d')]=function(_0x4fdabc,_0x5ee886,_0x1a12c7){var _0x2d111d={};var _0xc5b2bb={};var _0x4507d7;var _0x3fe243;return db[_0xe164('0x3f')][_0xe164('0x4b')]({'where':{'id':_0x4fdabc[_0xe164('0x49')]['id']}})[_0xe164('0x25')](handleEntityNotFound(_0x5ee886,null))['then'](function(_0x236254){if(_0x236254){_0x4507d7=_0x236254;_0xc5b2bb['model']=_['keys'](db[_0xe164('0x4c')]['rawAttributes']);_0xc5b2bb['query']=_[_0xe164('0x2f')](_0x4fdabc[_0xe164('0x2e')]);_0xc5b2bb[_0xe164('0x30')]=_[_0xe164('0x31')](_0xc5b2bb[_0xe164('0x32')],_0xc5b2bb[_0xe164('0x2e')]);_0x2d111d[_0xe164('0x33')]=_[_0xe164('0x31')](_0xc5b2bb[_0xe164('0x32')],qs['fields'](_0x4fdabc[_0xe164('0x2e')][_0xe164('0x34')]));_0x2d111d['attributes']=_0x2d111d['attributes'][_0xe164('0x35')]?_0x2d111d['attributes']:_0xc5b2bb[_0xe164('0x32')];_0x2d111d[_0xe164('0x38')]=qs['sort'](_0x4fdabc['query'][_0xe164('0x39')]);_0x2d111d['where']=qs[_0xe164('0x30')](_[_0xe164('0x3b')](_0x4fdabc[_0xe164('0x2e')],_0xc5b2bb[_0xe164('0x30')]));if(_0x4fdabc[_0xe164('0x2e')][_0xe164('0x3c')]){_0x2d111d['where']=_['merge'](_0x2d111d[_0xe164('0x3a')],{'$or':_[_0xe164('0x2d')](_0x2d111d[_0xe164('0x33')],function(_0x194ae3){var _0x2b08c7={};_0x2b08c7[_0x194ae3]={'$like':'%'+_0x4fdabc['query'][_0xe164('0x3c')]+'%'};return _0x2b08c7;})});}_0x2d111d=_[_0xe164('0x3d')]({},_0x2d111d,_0x4fdabc[_0xe164('0x44')]);return _0x4507d7[_0xe164('0x4d')](_0x2d111d);}})[_0xe164('0x25')](function(_0x17d359){if(_0x17d359){_0x3fe243=_0x17d359['length'];if(!_0x4fdabc[_0xe164('0x2e')][_0xe164('0x36')](_0xe164('0x37'))){_0x2d111d[_0xe164('0x1e')]=qs[_0xe164('0x1e')](_0x4fdabc['query'][_0xe164('0x1e')]);_0x2d111d[_0xe164('0x1d')]=qs['offset'](_0x4fdabc[_0xe164('0x2e')][_0xe164('0x1d')]);}return _0x4507d7['getDescriptions'](_0x2d111d);}})['then'](function(_0x3a9f0b){if(_0x3a9f0b){return _0x3a9f0b?{'count':_0x3fe243,'rows':_0x3a9f0b}:null;}})['then'](respondWithResult(_0x5ee886,null))[_0xe164('0x45')](handleError(_0x5ee886,null));};exports['getFields']=function(_0x3dd355,_0x558810,_0x5a458d){var _0x459e85={};var _0x24e3d2={};var _0x389ab9;var _0x5a344d;return db[_0xe164('0x3f')][_0xe164('0x4b')]({'where':{'id':_0x3dd355[_0xe164('0x49')]['id']}})[_0xe164('0x25')](handleEntityNotFound(_0x558810,null))['then'](function(_0x3982cc){if(_0x3982cc){_0x389ab9=_0x3982cc;_0x24e3d2['model']=_[_0xe164('0x2f')](db[_0xe164('0x4c')][_0xe164('0x43')]);_0x24e3d2[_0xe164('0x2e')]=_['keys'](_0x3dd355['query']);_0x24e3d2[_0xe164('0x30')]=_['intersection'](_0x24e3d2[_0xe164('0x32')],_0x24e3d2['query']);_0x459e85[_0xe164('0x33')]=_['intersection'](_0x24e3d2[_0xe164('0x32')],qs[_0xe164('0x34')](_0x3dd355[_0xe164('0x2e')][_0xe164('0x34')]));_0x459e85[_0xe164('0x33')]=_0x459e85['attributes']['length']?_0x459e85[_0xe164('0x33')]:_0x24e3d2[_0xe164('0x32')];_0x459e85['order']=qs[_0xe164('0x39')](_0x3dd355[_0xe164('0x2e')][_0xe164('0x39')]);_0x459e85[_0xe164('0x3a')]=qs[_0xe164('0x30')](_['pick'](_0x3dd355[_0xe164('0x2e')],_0x24e3d2[_0xe164('0x30')]));if(_0x3dd355[_0xe164('0x2e')][_0xe164('0x3c')]){_0x459e85[_0xe164('0x3a')]=_[_0xe164('0x3d')](_0x459e85[_0xe164('0x3a')],{'$or':_[_0xe164('0x2d')](_0x459e85['attributes'],function(_0x520065){var _0x5263ce={};_0x5263ce[_0x520065]={'$like':'%'+_0x3dd355[_0xe164('0x2e')][_0xe164('0x3c')]+'%'};return _0x5263ce;})});}_0x459e85=_['merge']({},_0x459e85,_0x3dd355['options']);return _0x389ab9[_0xe164('0x4e')](_0x459e85);}})[_0xe164('0x25')](function(_0x2f9134){if(_0x2f9134){_0x5a344d=_0x2f9134[_0xe164('0x35')];if(!_0x3dd355['query'][_0xe164('0x36')]('nolimit')){_0x459e85['limit']=qs[_0xe164('0x1e')](_0x3dd355[_0xe164('0x2e')]['limit']);_0x459e85['offset']=qs[_0xe164('0x1d')](_0x3dd355['query'][_0xe164('0x1d')]);}return _0x389ab9[_0xe164('0x4e')](_0x459e85);}})[_0xe164('0x25')](function(_0x594ea5){if(_0x594ea5){return _0x594ea5?{'count':_0x5a344d,'rows':_0x594ea5}:null;}})[_0xe164('0x25')](respondWithResult(_0x558810,null))['catch'](handleError(_0x558810,null));}; \ No newline at end of file +var _0xf6b4=['order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesConfiguration','findAll','catch','show','params','length','includeAll','find','create','body','update','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit'];(function(_0x43a4a9,_0x3e19b2){var _0xb8174a=function(_0x386a55){while(--_0x386a55){_0x43a4a9['push'](_0x43a4a9['shift']());}};_0xb8174a(++_0x3e19b2);}(_0xf6b4,0xb4));var _0x4f6b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf6b4[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x4f6b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f6b('0x1'));var rp=require(_0x4f6b('0x2'));var moment=require(_0x4f6b('0x3'));var BPromise=require(_0x4f6b('0x4'));var Mustache=require(_0x4f6b('0x5'));var util=require(_0x4f6b('0x6'));var path=require(_0x4f6b('0x7'));var sox=require(_0x4f6b('0x8'));var csv=require(_0x4f6b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f6b('0xa'));var _=require('lodash');var squel=require(_0x4f6b('0xb'));var crypto=require(_0x4f6b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4f6b('0x9'));var querystring=require(_0x4f6b('0xd'));var Papa=require(_0x4f6b('0xe'));var Redis=require(_0x4f6b('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4f6b('0x10'));var hardwareService=require(_0x4f6b('0x11'));var logger=require(_0x4f6b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4f6b('0x13'));var licenseUtil=require(_0x4f6b('0x14'));var db=require(_0x4f6b('0x15'))['db'];function respondWithStatusCode(_0x54f961,_0x2362b6){_0x2362b6=_0x2362b6||0xcc;return function(_0x2a1dc4){if(_0x2a1dc4){return _0x54f961[_0x4f6b('0x16')](_0x2362b6);}return _0x54f961[_0x4f6b('0x17')](_0x2362b6)[_0x4f6b('0x18')]();};}function respondWithResult(_0x39e6d8,_0x5ee5aa){_0x5ee5aa=_0x5ee5aa||0xc8;return function(_0x5efbe9){if(_0x5efbe9){return _0x39e6d8['status'](_0x5ee5aa)[_0x4f6b('0x19')](_0x5efbe9);}};}function respondWithFilteredResult(_0x1829ac,_0x428727){return function(_0x124f71){if(_0x124f71){var _0x43e48e=typeof _0x428727[_0x4f6b('0x1a')]===_0x4f6b('0x1b')&&typeof _0x428727['limit']===_0x4f6b('0x1b');var _0x2eb6e2=_0x124f71[_0x4f6b('0x1c')];var _0x1acafe=_0x43e48e?0x0:_0x428727[_0x4f6b('0x1a')];var _0x426a50=_0x43e48e?_0x124f71['count']:_0x428727['offset']+_0x428727['limit'];var _0x335616;if(_0x426a50>=_0x2eb6e2){_0x426a50=_0x2eb6e2;_0x335616=0xc8;}else{_0x335616=0xce;}_0x1829ac[_0x4f6b('0x17')](_0x335616);return _0x1829ac[_0x4f6b('0x1d')](_0x4f6b('0x1e'),_0x1acafe+'-'+_0x426a50+'/'+_0x2eb6e2)['json'](_0x124f71);}return null;};}function patchUpdates(_0x47b63e){return function(_0x349b13){try{jsonpatch['apply'](_0x349b13,_0x47b63e,!![]);}catch(_0x4aa780){return BPromise[_0x4f6b('0x1f')](_0x4aa780);}return _0x349b13[_0x4f6b('0x20')]();};}function saveUpdates(_0x1bdb6e,_0x43293b){return function(_0x4488d7){if(_0x4488d7){return _0x4488d7['update'](_0x1bdb6e)[_0x4f6b('0x21')](function(_0x5ee6a2){return _0x5ee6a2;});}return null;};}function removeEntity(_0x41b76d,_0x2a0cad){return function(_0x5c45c5){if(_0x5c45c5){return _0x5c45c5[_0x4f6b('0x22')]()[_0x4f6b('0x21')](function(){_0x41b76d['status'](0xcc)[_0x4f6b('0x18')]();});}};}function handleEntityNotFound(_0x33df9e,_0x4466c2){return function(_0x481d7e){if(!_0x481d7e){_0x33df9e[_0x4f6b('0x16')](0x194);}return _0x481d7e;};}function handleError(_0x4235e5,_0x442faa){_0x442faa=_0x442faa||0x1f4;return function(_0x278309){logger[_0x4f6b('0x23')](_0x278309[_0x4f6b('0x24')]);if(_0x278309[_0x4f6b('0x25')]){delete _0x278309['name'];}_0x4235e5[_0x4f6b('0x17')](_0x442faa)[_0x4f6b('0x26')](_0x278309);};}exports[_0x4f6b('0x27')]=function(_0x5098c,_0x2faf13){var _0x283097={},_0x38a28e={},_0xdeb784={'count':0x0,'rows':[]};var _0x58d487=_[_0x4f6b('0x28')](db['FreshsalesConfiguration'][_0x4f6b('0x29')],function(_0x560361){return{'name':_0x560361['fieldName'],'type':_0x560361[_0x4f6b('0x2a')][_0x4f6b('0x2b')]};});_0x38a28e[_0x4f6b('0x2c')]=_[_0x4f6b('0x28')](_0x58d487,'name');_0x38a28e[_0x4f6b('0x2d')]=_[_0x4f6b('0x2e')](_0x5098c[_0x4f6b('0x2d')]);_0x38a28e[_0x4f6b('0x2f')]=_[_0x4f6b('0x30')](_0x38a28e[_0x4f6b('0x2c')],_0x38a28e[_0x4f6b('0x2d')]);_0x283097[_0x4f6b('0x31')]=_['intersection'](_0x38a28e[_0x4f6b('0x2c')],qs[_0x4f6b('0x32')](_0x5098c[_0x4f6b('0x2d')]['fields']));_0x283097[_0x4f6b('0x31')]=_0x283097[_0x4f6b('0x31')]['length']?_0x283097[_0x4f6b('0x31')]:_0x38a28e[_0x4f6b('0x2c')];if(!_0x5098c[_0x4f6b('0x2d')][_0x4f6b('0x33')](_0x4f6b('0x34'))){_0x283097['limit']=qs[_0x4f6b('0x35')](_0x5098c[_0x4f6b('0x2d')][_0x4f6b('0x35')]);_0x283097[_0x4f6b('0x1a')]=qs['offset'](_0x5098c[_0x4f6b('0x2d')][_0x4f6b('0x1a')]);}_0x283097[_0x4f6b('0x36')]=qs[_0x4f6b('0x37')](_0x5098c['query'][_0x4f6b('0x37')]);_0x283097[_0x4f6b('0x38')]=qs[_0x4f6b('0x2f')](_[_0x4f6b('0x39')](_0x5098c[_0x4f6b('0x2d')],_0x38a28e[_0x4f6b('0x2f')]),_0x58d487);if(_0x5098c[_0x4f6b('0x2d')][_0x4f6b('0x3a')]){_0x283097[_0x4f6b('0x38')]=_[_0x4f6b('0x3b')](_0x283097[_0x4f6b('0x38')],{'$or':_[_0x4f6b('0x28')](_0x58d487,function(_0x2f3ec8){if(_0x2f3ec8['type']!==_0x4f6b('0x3c')){var _0x54e767={};_0x54e767[_0x2f3ec8[_0x4f6b('0x25')]]={'$like':'%'+_0x5098c[_0x4f6b('0x2d')][_0x4f6b('0x3a')]+'%'};return _0x54e767;}})});}_0x283097=_[_0x4f6b('0x3b')]({},_0x283097,_0x5098c[_0x4f6b('0x3d')]);var _0x43b0d0={'where':_0x283097[_0x4f6b('0x38')]};return db['FreshsalesConfiguration'][_0x4f6b('0x1c')](_0x43b0d0)[_0x4f6b('0x21')](function(_0x4bb780){_0xdeb784[_0x4f6b('0x1c')]=_0x4bb780;if(_0x5098c['query']['includeAll']){_0x283097['include']=[{'all':!![]}];}return db[_0x4f6b('0x3e')][_0x4f6b('0x3f')](_0x283097);})[_0x4f6b('0x21')](function(_0x1f00cc){_0xdeb784['rows']=_0x1f00cc;return _0xdeb784;})['then'](respondWithFilteredResult(_0x2faf13,_0x283097))[_0x4f6b('0x40')](handleError(_0x2faf13,null));};exports[_0x4f6b('0x41')]=function(_0x1b279c,_0x52d7ee){var _0x12a307={'raw':![],'where':{'id':_0x1b279c[_0x4f6b('0x42')]['id']}},_0x475edb={};_0x475edb[_0x4f6b('0x2c')]=_[_0x4f6b('0x2e')](db['FreshsalesConfiguration'][_0x4f6b('0x29')]);_0x475edb[_0x4f6b('0x2d')]=_[_0x4f6b('0x2e')](_0x1b279c['query']);_0x475edb[_0x4f6b('0x2f')]=_[_0x4f6b('0x30')](_0x475edb[_0x4f6b('0x2c')],_0x475edb['query']);_0x12a307['attributes']=_[_0x4f6b('0x30')](_0x475edb[_0x4f6b('0x2c')],qs[_0x4f6b('0x32')](_0x1b279c[_0x4f6b('0x2d')][_0x4f6b('0x32')]));_0x12a307[_0x4f6b('0x31')]=_0x12a307[_0x4f6b('0x31')][_0x4f6b('0x43')]?_0x12a307['attributes']:_0x475edb[_0x4f6b('0x2c')];if(_0x1b279c[_0x4f6b('0x2d')][_0x4f6b('0x44')]){_0x12a307['include']=[{'all':!![]}];}_0x12a307=_['merge']({},_0x12a307,_0x1b279c[_0x4f6b('0x3d')]);return db['FreshsalesConfiguration'][_0x4f6b('0x45')](_0x12a307)[_0x4f6b('0x21')](handleEntityNotFound(_0x52d7ee,null))[_0x4f6b('0x21')](respondWithResult(_0x52d7ee,null))[_0x4f6b('0x40')](handleError(_0x52d7ee,null));};exports['create']=function(_0x54111a,_0x3d75d6){return db['FreshsalesConfiguration'][_0x4f6b('0x46')](_0x54111a[_0x4f6b('0x47')],{})[_0x4f6b('0x21')](respondWithResult(_0x3d75d6,0xc9))['catch'](handleError(_0x3d75d6,null));};exports[_0x4f6b('0x48')]=function(_0x38c693,_0x2e2989){if(_0x38c693[_0x4f6b('0x47')]['id']){delete _0x38c693[_0x4f6b('0x47')]['id'];}return db[_0x4f6b('0x3e')][_0x4f6b('0x45')]({'where':{'id':_0x38c693['params']['id']}})[_0x4f6b('0x21')](handleEntityNotFound(_0x2e2989,null))['then'](saveUpdates(_0x38c693[_0x4f6b('0x47')],null))['then'](respondWithResult(_0x2e2989,null))['catch'](handleError(_0x2e2989,null));};exports[_0x4f6b('0x22')]=function(_0x1143ce,_0xfc0ba3){return db['FreshsalesConfiguration'][_0x4f6b('0x45')]({'where':{'id':_0x1143ce[_0x4f6b('0x42')]['id']}})['then'](handleEntityNotFound(_0xfc0ba3,null))[_0x4f6b('0x21')](removeEntity(_0xfc0ba3,null))[_0x4f6b('0x40')](handleError(_0xfc0ba3,null));};exports[_0x4f6b('0x49')]=function(_0x34c994,_0x23709d,_0x39c83d){var _0x23d10d={};var _0x2b5ce6={};var _0x27b538;var _0x472eee;return db[_0x4f6b('0x3e')]['findOne']({'where':{'id':_0x34c994['params']['id']}})['then'](handleEntityNotFound(_0x23709d,null))[_0x4f6b('0x21')](function(_0x10c6f9){if(_0x10c6f9){_0x27b538=_0x10c6f9;_0x2b5ce6[_0x4f6b('0x2c')]=_['keys'](db[_0x4f6b('0x4a')]['rawAttributes']);_0x2b5ce6['query']=_[_0x4f6b('0x2e')](_0x34c994[_0x4f6b('0x2d')]);_0x2b5ce6[_0x4f6b('0x2f')]=_[_0x4f6b('0x30')](_0x2b5ce6['model'],_0x2b5ce6[_0x4f6b('0x2d')]);_0x23d10d[_0x4f6b('0x31')]=_['intersection'](_0x2b5ce6['model'],qs[_0x4f6b('0x32')](_0x34c994['query']['fields']));_0x23d10d[_0x4f6b('0x31')]=_0x23d10d['attributes'][_0x4f6b('0x43')]?_0x23d10d[_0x4f6b('0x31')]:_0x2b5ce6[_0x4f6b('0x2c')];_0x23d10d['order']=qs['sort'](_0x34c994[_0x4f6b('0x2d')][_0x4f6b('0x37')]);_0x23d10d[_0x4f6b('0x38')]=qs[_0x4f6b('0x2f')](_['pick'](_0x34c994[_0x4f6b('0x2d')],_0x2b5ce6['filters']));if(_0x34c994['query'][_0x4f6b('0x3a')]){_0x23d10d[_0x4f6b('0x38')]=_['merge'](_0x23d10d[_0x4f6b('0x38')],{'$or':_[_0x4f6b('0x28')](_0x23d10d[_0x4f6b('0x31')],function(_0x3cd888){var _0x325102={};_0x325102[_0x3cd888]={'$like':'%'+_0x34c994[_0x4f6b('0x2d')][_0x4f6b('0x3a')]+'%'};return _0x325102;})});}_0x23d10d=_[_0x4f6b('0x3b')]({},_0x23d10d,_0x34c994[_0x4f6b('0x3d')]);return _0x27b538['getSubjects'](_0x23d10d);}})[_0x4f6b('0x21')](function(_0x2a0f60){if(_0x2a0f60){_0x472eee=_0x2a0f60[_0x4f6b('0x43')];if(!_0x34c994['query'][_0x4f6b('0x33')](_0x4f6b('0x34'))){_0x23d10d[_0x4f6b('0x35')]=qs[_0x4f6b('0x35')](_0x34c994[_0x4f6b('0x2d')][_0x4f6b('0x35')]);_0x23d10d[_0x4f6b('0x1a')]=qs[_0x4f6b('0x1a')](_0x34c994[_0x4f6b('0x2d')][_0x4f6b('0x1a')]);}return _0x27b538['getSubjects'](_0x23d10d);}})['then'](function(_0x6a045){if(_0x6a045){return _0x6a045?{'count':_0x472eee,'rows':_0x6a045}:null;}})[_0x4f6b('0x21')](respondWithResult(_0x23709d,null))[_0x4f6b('0x40')](handleError(_0x23709d,null));};exports[_0x4f6b('0x4b')]=function(_0x43d216,_0x5ecdaf,_0x233c30){var _0x52127d={};var _0x50c3af={};var _0x55b79a;var _0x100649;return db['FreshsalesConfiguration'][_0x4f6b('0x4c')]({'where':{'id':_0x43d216[_0x4f6b('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ecdaf,null))[_0x4f6b('0x21')](function(_0x39ec46){if(_0x39ec46){_0x55b79a=_0x39ec46;_0x50c3af[_0x4f6b('0x2c')]=_[_0x4f6b('0x2e')](db[_0x4f6b('0x4a')][_0x4f6b('0x29')]);_0x50c3af[_0x4f6b('0x2d')]=_['keys'](_0x43d216[_0x4f6b('0x2d')]);_0x50c3af['filters']=_[_0x4f6b('0x30')](_0x50c3af[_0x4f6b('0x2c')],_0x50c3af['query']);_0x52127d['attributes']=_['intersection'](_0x50c3af[_0x4f6b('0x2c')],qs[_0x4f6b('0x32')](_0x43d216[_0x4f6b('0x2d')][_0x4f6b('0x32')]));_0x52127d['attributes']=_0x52127d[_0x4f6b('0x31')][_0x4f6b('0x43')]?_0x52127d[_0x4f6b('0x31')]:_0x50c3af[_0x4f6b('0x2c')];_0x52127d[_0x4f6b('0x36')]=qs['sort'](_0x43d216['query']['sort']);_0x52127d[_0x4f6b('0x38')]=qs['filters'](_[_0x4f6b('0x39')](_0x43d216[_0x4f6b('0x2d')],_0x50c3af[_0x4f6b('0x2f')]));if(_0x43d216['query'][_0x4f6b('0x3a')]){_0x52127d[_0x4f6b('0x38')]=_[_0x4f6b('0x3b')](_0x52127d[_0x4f6b('0x38')],{'$or':_[_0x4f6b('0x28')](_0x52127d[_0x4f6b('0x31')],function(_0x5879ce){var _0x80bc6e={};_0x80bc6e[_0x5879ce]={'$like':'%'+_0x43d216['query'][_0x4f6b('0x3a')]+'%'};return _0x80bc6e;})});}_0x52127d=_[_0x4f6b('0x3b')]({},_0x52127d,_0x43d216[_0x4f6b('0x3d')]);return _0x55b79a[_0x4f6b('0x4b')](_0x52127d);}})[_0x4f6b('0x21')](function(_0x4d177a){if(_0x4d177a){_0x100649=_0x4d177a[_0x4f6b('0x43')];if(!_0x43d216[_0x4f6b('0x2d')][_0x4f6b('0x33')](_0x4f6b('0x34'))){_0x52127d[_0x4f6b('0x35')]=qs[_0x4f6b('0x35')](_0x43d216[_0x4f6b('0x2d')][_0x4f6b('0x35')]);_0x52127d[_0x4f6b('0x1a')]=qs[_0x4f6b('0x1a')](_0x43d216[_0x4f6b('0x2d')]['offset']);}return _0x55b79a[_0x4f6b('0x4b')](_0x52127d);}})[_0x4f6b('0x21')](function(_0x3f42d5){if(_0x3f42d5){return _0x3f42d5?{'count':_0x100649,'rows':_0x3f42d5}:null;}})[_0x4f6b('0x21')](respondWithResult(_0x5ecdaf,null))['catch'](handleError(_0x5ecdaf,null));};exports[_0x4f6b('0x4d')]=function(_0x35bdac,_0x480555,_0x1c2aab){var _0x15c448={};var _0x2bd7f5={};var _0x3af7b2;var _0x9d3d1b;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x35bdac[_0x4f6b('0x42')]['id']}})[_0x4f6b('0x21')](handleEntityNotFound(_0x480555,null))[_0x4f6b('0x21')](function(_0x39a06f){if(_0x39a06f){_0x3af7b2=_0x39a06f;_0x2bd7f5[_0x4f6b('0x2c')]=_[_0x4f6b('0x2e')](db[_0x4f6b('0x4a')][_0x4f6b('0x29')]);_0x2bd7f5[_0x4f6b('0x2d')]=_['keys'](_0x35bdac[_0x4f6b('0x2d')]);_0x2bd7f5[_0x4f6b('0x2f')]=_[_0x4f6b('0x30')](_0x2bd7f5[_0x4f6b('0x2c')],_0x2bd7f5['query']);_0x15c448[_0x4f6b('0x31')]=_['intersection'](_0x2bd7f5[_0x4f6b('0x2c')],qs[_0x4f6b('0x32')](_0x35bdac[_0x4f6b('0x2d')][_0x4f6b('0x32')]));_0x15c448['attributes']=_0x15c448[_0x4f6b('0x31')][_0x4f6b('0x43')]?_0x15c448[_0x4f6b('0x31')]:_0x2bd7f5[_0x4f6b('0x2c')];_0x15c448['order']=qs['sort'](_0x35bdac[_0x4f6b('0x2d')][_0x4f6b('0x37')]);_0x15c448[_0x4f6b('0x38')]=qs['filters'](_[_0x4f6b('0x39')](_0x35bdac['query'],_0x2bd7f5[_0x4f6b('0x2f')]));if(_0x35bdac[_0x4f6b('0x2d')][_0x4f6b('0x3a')]){_0x15c448['where']=_[_0x4f6b('0x3b')](_0x15c448['where'],{'$or':_['map'](_0x15c448[_0x4f6b('0x31')],function(_0x3d557b){var _0x5298a4={};_0x5298a4[_0x3d557b]={'$like':'%'+_0x35bdac[_0x4f6b('0x2d')][_0x4f6b('0x3a')]+'%'};return _0x5298a4;})});}_0x15c448=_[_0x4f6b('0x3b')]({},_0x15c448,_0x35bdac[_0x4f6b('0x3d')]);return _0x3af7b2[_0x4f6b('0x4d')](_0x15c448);}})[_0x4f6b('0x21')](function(_0x30a7e8){if(_0x30a7e8){_0x9d3d1b=_0x30a7e8[_0x4f6b('0x43')];if(!_0x35bdac['query'][_0x4f6b('0x33')](_0x4f6b('0x34'))){_0x15c448[_0x4f6b('0x35')]=qs[_0x4f6b('0x35')](_0x35bdac['query']['limit']);_0x15c448['offset']=qs[_0x4f6b('0x1a')](_0x35bdac[_0x4f6b('0x2d')][_0x4f6b('0x1a')]);}return _0x3af7b2[_0x4f6b('0x4d')](_0x15c448);}})[_0x4f6b('0x21')](function(_0x589a75){if(_0x589a75){return _0x589a75?{'count':_0x9d3d1b,'rows':_0x589a75}:null;}})[_0x4f6b('0x21')](respondWithResult(_0x480555,null))[_0x4f6b('0x40')](handleError(_0x480555,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index af80319..338b9f8 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 _0x944b=['moment','bluebird','request-promise','path','rimraf','define','util','../../config/logger','api'];(function(_0x2facc8,_0x28502c){var _0x582bfd=function(_0x179e4f){while(--_0x179e4f){_0x2facc8['push'](_0x2facc8['shift']());}};_0x582bfd(++_0x28502c);}(_0x944b,0x1e3));var _0xb944=function(_0x98f660,_0x4ac2b4){_0x98f660=_0x98f660-0x0;var _0x4e5825=_0x944b[_0x98f660];return _0x4e5825;};'use strict';var _=require('lodash');var util=require(_0xb944('0x0'));var logger=require(_0xb944('0x1'))(_0xb944('0x2'));var moment=require(_0xb944('0x3'));var BPromise=require(_0xb944('0x4'));var rp=require(_0xb944('0x5'));var fs=require('fs');var path=require(_0xb944('0x6'));var rimraf=require(_0xb944('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x549811,_0x2e9f08){return _0x549811[_0xb944('0x8')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76f6=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x2577d9,_0x8f2f28){var _0x36fe58=function(_0xbba849){while(--_0xbba849){_0x2577d9['push'](_0x2577d9['shift']());}};_0x36fe58(++_0x8f2f28);}(_0x76f6,0xc3));var _0x676f=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x76f6[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x676f('0x0'));var util=require(_0x676f('0x1'));var logger=require(_0x676f('0x2'))(_0x676f('0x3'));var moment=require(_0x676f('0x4'));var BPromise=require(_0x676f('0x5'));var rp=require(_0x676f('0x6'));var fs=require('fs');var path=require(_0x676f('0x7'));var rimraf=require(_0x676f('0x8'));var config=require(_0x676f('0x9'));var attributes=require(_0x676f('0xa'));module['exports']=function(_0x3c9978,_0x3bb935){return _0x3c9978[_0x676f('0xb')](_0x676f('0xc'),attributes,{'tableName':_0x676f('0xd'),'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 356a73a..93fa626 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 _0x9e95=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x205109,_0x1945c9){var _0x273e9f=function(_0x4dcda0){while(--_0x4dcda0){_0x205109['push'](_0x205109['shift']());}};_0x273e9f(++_0x1945c9);}(_0x9e95,0x118));var _0x59e9=function(_0x23f265,_0x5d6971){_0x23f265=_0x23f265-0x0;var _0x29cdbf=_0x9e95[_0x23f265];return _0x29cdbf;};'use strict';var _=require(_0x59e9('0x0'));var util=require(_0x59e9('0x1'));var moment=require(_0x59e9('0x2'));var BPromise=require(_0x59e9('0x3'));var rs=require(_0x59e9('0x4'));var fs=require('fs');var Redis=require(_0x59e9('0x5'));var db=require(_0x59e9('0x6'))['db'];var utils=require(_0x59e9('0x7'));var logger=require(_0x59e9('0x8'))(_0x59e9('0x9'));var config=require(_0x59e9('0xa'));var jayson=require(_0x59e9('0xb'));var client=jayson[_0x59e9('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45d3b5,_0x602dbb,_0x3a2ade){return new BPromise(function(_0x1a22f7,_0x23cb57){return client[_0x59e9('0xd')](_0x45d3b5,_0x3a2ade)[_0x59e9('0xe')](function(_0x21e053){logger[_0x59e9('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x602dbb,_0x59e9('0x10'));logger[_0x59e9('0x11')](_0x59e9('0x12'),_0x602dbb,_0x59e9('0x10'),JSON[_0x59e9('0x13')](_0x21e053));if(_0x21e053[_0x59e9('0x14')]){if(_0x21e053[_0x59e9('0x14')][_0x59e9('0x15')]===0x1f4){logger[_0x59e9('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x602dbb,_0x21e053[_0x59e9('0x14')]['message']);return _0x23cb57(_0x21e053[_0x59e9('0x14')]['message']);}logger['error'](_0x59e9('0x16'),_0x602dbb,_0x21e053[_0x59e9('0x14')]['message']);return _0x1a22f7(_0x21e053[_0x59e9('0x14')][_0x59e9('0x17')]);}else{logger[_0x59e9('0xf')](_0x59e9('0x16'),_0x602dbb,_0x59e9('0x10'));_0x1a22f7(_0x21e053[_0x59e9('0x18')][_0x59e9('0x17')]);}})[_0x59e9('0x19')](function(_0x2a7afa){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x602dbb,_0x2a7afa);_0x23cb57(_0x2a7afa);});});} \ No newline at end of file +var _0xd990=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x23758a,_0xdc2fdc){var _0x4db60a=function(_0x47c5a8){while(--_0x47c5a8){_0x23758a['push'](_0x23758a['shift']());}};_0x4db60a(++_0xdc2fdc);}(_0xd990,0x19e));var _0x0d99=function(_0x15c8c2,_0x4f8147){_0x15c8c2=_0x15c8c2-0x0;var _0x28ce1c=_0xd990[_0x15c8c2];return _0x28ce1c;};'use strict';var _=require(_0x0d99('0x0'));var util=require(_0x0d99('0x1'));var moment=require(_0x0d99('0x2'));var BPromise=require(_0x0d99('0x3'));var rs=require(_0x0d99('0x4'));var fs=require('fs');var Redis=require(_0x0d99('0x5'));var db=require(_0x0d99('0x6'))['db'];var utils=require(_0x0d99('0x7'));var logger=require(_0x0d99('0x8'))('rpc');var config=require(_0x0d99('0x9'));var jayson=require(_0x0d99('0xa'));var client=jayson['client'][_0x0d99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d4b63,_0x68aeb,_0x5ad93b){return new BPromise(function(_0x1490f6,_0x482635){return client[_0x0d99('0xc')](_0x5d4b63,_0x5ad93b)[_0x0d99('0xd')](function(_0x37d526){logger[_0x0d99('0xe')](_0x0d99('0xf'),_0x68aeb,_0x0d99('0x10'));logger[_0x0d99('0x11')](_0x0d99('0x12'),_0x68aeb,'request\x20sent',JSON[_0x0d99('0x13')](_0x37d526));if(_0x37d526[_0x0d99('0x14')]){if(_0x37d526[_0x0d99('0x14')]['code']===0x1f4){logger['error'](_0x0d99('0xf'),_0x68aeb,_0x37d526[_0x0d99('0x14')][_0x0d99('0x15')]);return _0x482635(_0x37d526[_0x0d99('0x14')][_0x0d99('0x15')]);}logger[_0x0d99('0x14')](_0x0d99('0xf'),_0x68aeb,_0x37d526['error'][_0x0d99('0x15')]);return _0x1490f6(_0x37d526[_0x0d99('0x14')]['message']);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x68aeb,_0x0d99('0x10'));_0x1490f6(_0x37d526[_0x0d99('0x16')]['message']);}})['catch'](function(_0x5ea89b){logger['error'](_0x0d99('0xf'),_0x68aeb,_0x5ea89b);_0x482635(_0x5ea89b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index d53eac8..ac48bf7 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 _0xa900=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5e9ae7,_0x219221){var _0x2f8969=function(_0x45751a){while(--_0x45751a){_0x5e9ae7['push'](_0x5e9ae7['shift']());}};_0x2f8969(++_0x219221);}(_0xa900,0x101));var _0x0a90=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0xa900[_0x5b64a1];return _0x4b6f55;};'use strict';var multer=require(_0x0a90('0x0'));var util=require(_0x0a90('0x1'));var path=require(_0x0a90('0x2'));var timeout=require(_0x0a90('0x3'));var express=require(_0x0a90('0x4'));var router=express[_0x0a90('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0a90('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0a90('0x7'));router[_0x0a90('0x8')]('/',auth[_0x0a90('0x9')](),controller[_0x0a90('0xa')]);router['get'](_0x0a90('0xb'),auth[_0x0a90('0x9')](),controller[_0x0a90('0xc')]);router['post']('/',auth[_0x0a90('0x9')](),controller[_0x0a90('0xd')]);router[_0x0a90('0xe')]('/:id',auth[_0x0a90('0x9')](),controller['update']);router[_0x0a90('0xf')](_0x0a90('0xb'),auth['isAuthenticated'](),controller[_0x0a90('0x10')]);module[_0x0a90('0x11')]=router; \ No newline at end of file +var _0xf675=['./intFreshsalesField.controller','get','isAuthenticated','index','/:id','create','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf675,0x199));var _0x5f67=function(_0x5600ba,_0xe51f7c){_0x5600ba=_0x5600ba-0x0;var _0x2db0f1=_0xf675[_0x5600ba];return _0x2db0f1;};'use strict';var multer=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var path=require(_0x5f67('0x2'));var timeout=require('connect-timeout');var express=require(_0x5f67('0x3'));var router=express['Router']();var fs_extra=require(_0x5f67('0x4'));var auth=require(_0x5f67('0x5'));var interaction=require(_0x5f67('0x6'));var config=require('../../config/environment');var controller=require(_0x5f67('0x7'));router[_0x5f67('0x8')]('/',auth[_0x5f67('0x9')](),controller[_0x5f67('0xa')]);router['get'](_0x5f67('0xb'),auth[_0x5f67('0x9')](),controller['show']);router['post']('/',auth[_0x5f67('0x9')](),controller[_0x5f67('0xc')]);router['put']('/:id',auth[_0x5f67('0x9')](),controller[_0x5f67('0xd')]);router[_0x5f67('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5f67('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 092110b..692f988 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 _0xf263=['keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x372130,_0x53e6b4){var _0x5c4c47=function(_0x16239a){while(--_0x16239a){_0x372130['push'](_0x372130['shift']());}};_0x5c4c47(++_0x53e6b4);}(_0xf263,0x1f3));var _0x3f26=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0xf263[_0x333fed];return _0x12cac2;};'use strict';var Sequelize=require(_0x3f26('0x0'));module['exports']={'type':{'type':Sequelize[_0x3f26('0x1')](_0x3f26('0x2'),_0x3f26('0x3'),_0x3f26('0x4'),_0x3f26('0x5'),'picklist'),'defaultValue':_0x3f26('0x2')},'content':{'type':Sequelize[_0x3f26('0x6')]},'key':{'type':Sequelize[_0x3f26('0x6')]},'keyType':{'type':Sequelize[_0x3f26('0x1')](_0x3f26('0x2'),_0x3f26('0x3'),_0x3f26('0x4'))},'keyContent':{'type':Sequelize[_0x3f26('0x6')]},'idField':{'type':Sequelize[_0x3f26('0x6')]},'nameField':{'type':Sequelize[_0x3f26('0x6')]},'customField':{'type':Sequelize[_0x3f26('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9005=['variable','customVariable','STRING','BOOLEAN','exports','string'];(function(_0x45b5b5,_0x13aa27){var _0x1c96d5=function(_0x25737b){while(--_0x25737b){_0x45b5b5['push'](_0x45b5b5['shift']());}};_0x1c96d5(++_0x13aa27);}(_0x9005,0x64));var _0x5900=function(_0xe9d09,_0x3e6778){_0xe9d09=_0xe9d09-0x0;var _0x2c05c1=_0x9005[_0xe9d09];return _0x2c05c1;};'use strict';var Sequelize=require('sequelize');module[_0x5900('0x0')]={'type':{'type':Sequelize['ENUM'](_0x5900('0x1'),_0x5900('0x2'),_0x5900('0x3'),'keyValue','picklist'),'defaultValue':_0x5900('0x1')},'content':{'type':Sequelize[_0x5900('0x4')]},'key':{'type':Sequelize[_0x5900('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x5900('0x1'),_0x5900('0x2'),_0x5900('0x3'))},'keyContent':{'type':Sequelize[_0x5900('0x4')]},'idField':{'type':Sequelize[_0x5900('0x4')]},'nameField':{'type':Sequelize[_0x5900('0x4')]},'customField':{'type':Sequelize[_0x5900('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index a53d5df..5f65ec2 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 _0xea11=['papaparse','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','end','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','catch','create','body','update','find','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','crypto','to-csv','querystring'];(function(_0x248085,_0x21e571){var _0x3d14a0=function(_0xde1c2f){while(--_0xde1c2f){_0x248085['push'](_0x248085['shift']());}};_0x3d14a0(++_0x21e571);}(_0xea11,0x7f));var _0x1ea1=function(_0xac3f8e,_0x43eef0){_0xac3f8e=_0xac3f8e-0x0;var _0x3902a3=_0xea11[_0xac3f8e];return _0x3902a3;};'use strict';var emlformat=require(_0x1ea1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ea1('0x1'));var jsonpatch=require(_0x1ea1('0x2'));var rp=require('request-promise');var moment=require(_0x1ea1('0x3'));var BPromise=require(_0x1ea1('0x4'));var Mustache=require(_0x1ea1('0x5'));var util=require(_0x1ea1('0x6'));var path=require(_0x1ea1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1ea1('0x8'));var fs=require('fs');var fs_extra=require(_0x1ea1('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1ea1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1ea1('0xb'));var querystring=require(_0x1ea1('0xc'));var Papa=require(_0x1ea1('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1ea1('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1ea1('0xf'));var utils=require('../../config/utils');var config=require(_0x1ea1('0x10'));var licenseUtil=require(_0x1ea1('0x11'));var db=require(_0x1ea1('0x12'))['db'];function respondWithStatusCode(_0x44695e,_0xe6da59){_0xe6da59=_0xe6da59||0xcc;return function(_0x4ffcff){if(_0x4ffcff){return _0x44695e[_0x1ea1('0x13')](_0xe6da59);}return _0x44695e[_0x1ea1('0x14')](_0xe6da59)['end']();};}function respondWithResult(_0x3e69a9,_0x3c3ff0){_0x3c3ff0=_0x3c3ff0||0xc8;return function(_0x2afc4e){if(_0x2afc4e){return _0x3e69a9[_0x1ea1('0x14')](_0x3c3ff0)[_0x1ea1('0x15')](_0x2afc4e);}};}function respondWithFilteredResult(_0x35b44c,_0x2fc851){return function(_0xab73ae){if(_0xab73ae){var _0x2e6b42=typeof _0x2fc851['offset']==='undefined'&&typeof _0x2fc851[_0x1ea1('0x16')]===_0x1ea1('0x17');var _0x39ee7b=_0xab73ae[_0x1ea1('0x18')];var _0x478bc0=_0x2e6b42?0x0:_0x2fc851[_0x1ea1('0x19')];var _0x292f0a=_0x2e6b42?_0xab73ae[_0x1ea1('0x18')]:_0x2fc851['offset']+_0x2fc851[_0x1ea1('0x16')];var _0x2594b0;if(_0x292f0a>=_0x39ee7b){_0x292f0a=_0x39ee7b;_0x2594b0=0xc8;}else{_0x2594b0=0xce;}_0x35b44c[_0x1ea1('0x14')](_0x2594b0);return _0x35b44c[_0x1ea1('0x1a')](_0x1ea1('0x1b'),_0x478bc0+'-'+_0x292f0a+'/'+_0x39ee7b)[_0x1ea1('0x15')](_0xab73ae);}return null;};}function patchUpdates(_0x582abe){return function(_0x3c115c){try{jsonpatch[_0x1ea1('0x1c')](_0x3c115c,_0x582abe,!![]);}catch(_0x53ee51){return BPromise[_0x1ea1('0x1d')](_0x53ee51);}return _0x3c115c[_0x1ea1('0x1e')]();};}function saveUpdates(_0x1c8589,_0x207ada){return function(_0x42355a){if(_0x42355a){return _0x42355a['update'](_0x1c8589)[_0x1ea1('0x1f')](function(_0x107ff1){return _0x107ff1;});}return null;};}function removeEntity(_0x11f4ee,_0x28c896){return function(_0x2d2cd9){if(_0x2d2cd9){return _0x2d2cd9['destroy']()[_0x1ea1('0x1f')](function(){_0x11f4ee[_0x1ea1('0x14')](0xcc)[_0x1ea1('0x20')]();});}};}function handleEntityNotFound(_0x2fb872,_0x5384eb){return function(_0x2fb6a3){if(!_0x2fb6a3){_0x2fb872[_0x1ea1('0x13')](0x194);}return _0x2fb6a3;};}function handleError(_0x157b55,_0x1ea1bb){_0x1ea1bb=_0x1ea1bb||0x1f4;return function(_0x142e02){logger['error'](_0x142e02[_0x1ea1('0x21')]);if(_0x142e02[_0x1ea1('0x22')]){delete _0x142e02[_0x1ea1('0x22')];}_0x157b55[_0x1ea1('0x14')](_0x1ea1bb)[_0x1ea1('0x23')](_0x142e02);};}exports[_0x1ea1('0x24')]=function(_0x25e2b5,_0x1f8919){var _0x300041={},_0x586ba9={},_0x2d9ba1={'count':0x0,'rows':[]};var _0x506ba5=_[_0x1ea1('0x25')](db[_0x1ea1('0x26')][_0x1ea1('0x27')],function(_0x34a120){return{'name':_0x34a120[_0x1ea1('0x28')],'type':_0x34a120[_0x1ea1('0x29')]['key']};});_0x586ba9['model']=_[_0x1ea1('0x25')](_0x506ba5,_0x1ea1('0x22'));_0x586ba9[_0x1ea1('0x2a')]=_['keys'](_0x25e2b5[_0x1ea1('0x2a')]);_0x586ba9[_0x1ea1('0x2b')]=_[_0x1ea1('0x2c')](_0x586ba9[_0x1ea1('0x2d')],_0x586ba9[_0x1ea1('0x2a')]);_0x300041[_0x1ea1('0x2e')]=_[_0x1ea1('0x2c')](_0x586ba9[_0x1ea1('0x2d')],qs[_0x1ea1('0x2f')](_0x25e2b5['query'][_0x1ea1('0x2f')]));_0x300041[_0x1ea1('0x2e')]=_0x300041[_0x1ea1('0x2e')][_0x1ea1('0x30')]?_0x300041[_0x1ea1('0x2e')]:_0x586ba9[_0x1ea1('0x2d')];if(!_0x25e2b5[_0x1ea1('0x2a')]['hasOwnProperty']('nolimit')){_0x300041[_0x1ea1('0x16')]=qs['limit'](_0x25e2b5[_0x1ea1('0x2a')][_0x1ea1('0x16')]);_0x300041[_0x1ea1('0x19')]=qs[_0x1ea1('0x19')](_0x25e2b5[_0x1ea1('0x2a')][_0x1ea1('0x19')]);}_0x300041[_0x1ea1('0x31')]=qs[_0x1ea1('0x32')](_0x25e2b5[_0x1ea1('0x2a')][_0x1ea1('0x32')]);_0x300041['where']=qs[_0x1ea1('0x2b')](_[_0x1ea1('0x33')](_0x25e2b5[_0x1ea1('0x2a')],_0x586ba9[_0x1ea1('0x2b')]),_0x506ba5);if(_0x25e2b5[_0x1ea1('0x2a')][_0x1ea1('0x34')]){_0x300041['where']=_[_0x1ea1('0x35')](_0x300041[_0x1ea1('0x36')],{'$or':_[_0x1ea1('0x25')](_0x506ba5,function(_0x33ac7d){if(_0x33ac7d[_0x1ea1('0x29')]!==_0x1ea1('0x37')){var _0x124170={};_0x124170[_0x33ac7d[_0x1ea1('0x22')]]={'$like':'%'+_0x25e2b5[_0x1ea1('0x2a')]['filter']+'%'};return _0x124170;}})});}_0x300041=_[_0x1ea1('0x35')]({},_0x300041,_0x25e2b5[_0x1ea1('0x38')]);var _0x374512={'where':_0x300041[_0x1ea1('0x36')]};return db[_0x1ea1('0x26')][_0x1ea1('0x18')](_0x374512)[_0x1ea1('0x1f')](function(_0x370171){_0x2d9ba1[_0x1ea1('0x18')]=_0x370171;if(_0x25e2b5['query'][_0x1ea1('0x39')]){_0x300041['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x1ea1('0x3a')](_0x300041);})['then'](function(_0x135be2){_0x2d9ba1[_0x1ea1('0x3b')]=_0x135be2;return _0x2d9ba1;})[_0x1ea1('0x1f')](respondWithFilteredResult(_0x1f8919,_0x300041))['catch'](handleError(_0x1f8919,null));};exports[_0x1ea1('0x3c')]=function(_0x1c7ba1,_0x4ad187){var _0x3123ff={'raw':!![],'where':{'id':_0x1c7ba1[_0x1ea1('0x3d')]['id']}},_0xbc30a3={};_0xbc30a3['model']=_[_0x1ea1('0x3e')](db[_0x1ea1('0x26')][_0x1ea1('0x27')]);_0xbc30a3[_0x1ea1('0x2a')]=_[_0x1ea1('0x3e')](_0x1c7ba1['query']);_0xbc30a3[_0x1ea1('0x2b')]=_[_0x1ea1('0x2c')](_0xbc30a3['model'],_0xbc30a3['query']);_0x3123ff[_0x1ea1('0x2e')]=_[_0x1ea1('0x2c')](_0xbc30a3[_0x1ea1('0x2d')],qs[_0x1ea1('0x2f')](_0x1c7ba1['query']['fields']));_0x3123ff[_0x1ea1('0x2e')]=_0x3123ff[_0x1ea1('0x2e')]['length']?_0x3123ff[_0x1ea1('0x2e')]:_0xbc30a3[_0x1ea1('0x2d')];if(_0x1c7ba1[_0x1ea1('0x2a')]['includeAll']){_0x3123ff[_0x1ea1('0x3f')]=[{'all':!![]}];}_0x3123ff=_['merge']({},_0x3123ff,_0x1c7ba1[_0x1ea1('0x38')]);return db['FreshsalesField']['find'](_0x3123ff)[_0x1ea1('0x1f')](handleEntityNotFound(_0x4ad187,null))[_0x1ea1('0x1f')](respondWithResult(_0x4ad187,null))[_0x1ea1('0x40')](handleError(_0x4ad187,null));};exports[_0x1ea1('0x41')]=function(_0x55523c,_0x3c27f0){return db[_0x1ea1('0x26')][_0x1ea1('0x41')](_0x55523c[_0x1ea1('0x42')],{})[_0x1ea1('0x1f')](respondWithResult(_0x3c27f0,0xc9))[_0x1ea1('0x40')](handleError(_0x3c27f0,null));};exports[_0x1ea1('0x43')]=function(_0x5bb147,_0x2b4b59){if(_0x5bb147[_0x1ea1('0x42')]['id']){delete _0x5bb147['body']['id'];}return db[_0x1ea1('0x26')][_0x1ea1('0x44')]({'where':{'id':_0x5bb147['params']['id']}})['then'](handleEntityNotFound(_0x2b4b59,null))['then'](saveUpdates(_0x5bb147['body'],null))['then'](respondWithResult(_0x2b4b59,null))[_0x1ea1('0x40')](handleError(_0x2b4b59,null));};exports[_0x1ea1('0x45')]=function(_0xb26ce2,_0x334395){return db['FreshsalesField'][_0x1ea1('0x44')]({'where':{'id':_0xb26ce2[_0x1ea1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x334395,null))['then'](removeEntity(_0x334395,null))['catch'](handleError(_0x334395,null));}; \ No newline at end of file +var _0x0594=['mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','end','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0594,0x167));var _0x4059=function(_0xb008a6,_0x4c108c){_0xb008a6=_0xb008a6-0x0;var _0xb5f2ce=_0x0594[_0xb008a6];return _0xb5f2ce;};'use strict';var emlformat=require(_0x4059('0x0'));var rimraf=require(_0x4059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4059('0x2'));var rp=require(_0x4059('0x3'));var moment=require(_0x4059('0x4'));var BPromise=require(_0x4059('0x5'));var Mustache=require(_0x4059('0x6'));var util=require(_0x4059('0x7'));var path=require('path');var sox=require(_0x4059('0x8'));var csv=require(_0x4059('0x9'));var ejs=require(_0x4059('0xa'));var fs=require('fs');var fs_extra=require(_0x4059('0xb'));var _=require('lodash');var squel=require(_0x4059('0xc'));var crypto=require(_0x4059('0xd'));var jsforce=require(_0x4059('0xe'));var deskjs=require(_0x4059('0xf'));var toCsv=require(_0x4059('0x9'));var querystring=require(_0x4059('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4059('0x11'));var qs=require(_0x4059('0x12'));var as=require(_0x4059('0x13'));var hardwareService=require(_0x4059('0x14'));var logger=require(_0x4059('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4059('0x16'));var db=require(_0x4059('0x17'))['db'];function respondWithStatusCode(_0xcbdf93,_0xe0e66b){_0xe0e66b=_0xe0e66b||0xcc;return function(_0x456f07){if(_0x456f07){return _0xcbdf93['sendStatus'](_0xe0e66b);}return _0xcbdf93[_0x4059('0x18')](_0xe0e66b)['end']();};}function respondWithResult(_0x20fd86,_0x22d91c){_0x22d91c=_0x22d91c||0xc8;return function(_0x566f62){if(_0x566f62){return _0x20fd86[_0x4059('0x18')](_0x22d91c)[_0x4059('0x19')](_0x566f62);}};}function respondWithFilteredResult(_0x41fc92,_0x560278){return function(_0x349071){if(_0x349071){var _0x1f48ad=typeof _0x560278[_0x4059('0x1a')]===_0x4059('0x1b')&&typeof _0x560278[_0x4059('0x1c')]===_0x4059('0x1b');var _0x4ace7f=_0x349071[_0x4059('0x1d')];var _0x49af3c=_0x1f48ad?0x0:_0x560278[_0x4059('0x1a')];var _0x271d75=_0x1f48ad?_0x349071[_0x4059('0x1d')]:_0x560278[_0x4059('0x1a')]+_0x560278['limit'];var _0x2ca86a;if(_0x271d75>=_0x4ace7f){_0x271d75=_0x4ace7f;_0x2ca86a=0xc8;}else{_0x2ca86a=0xce;}_0x41fc92['status'](_0x2ca86a);return _0x41fc92['set'](_0x4059('0x1e'),_0x49af3c+'-'+_0x271d75+'/'+_0x4ace7f)[_0x4059('0x19')](_0x349071);}return null;};}function patchUpdates(_0x15fd0f){return function(_0x299e91){try{jsonpatch[_0x4059('0x1f')](_0x299e91,_0x15fd0f,!![]);}catch(_0x27d14e){return BPromise['reject'](_0x27d14e);}return _0x299e91[_0x4059('0x20')]();};}function saveUpdates(_0x4a727d,_0x171f22){return function(_0x349f6b){if(_0x349f6b){return _0x349f6b[_0x4059('0x21')](_0x4a727d)['then'](function(_0x138d77){return _0x138d77;});}return null;};}function removeEntity(_0x3ac583,_0x5d6d97){return function(_0x28980c){if(_0x28980c){return _0x28980c[_0x4059('0x22')]()['then'](function(){_0x3ac583[_0x4059('0x18')](0xcc)[_0x4059('0x23')]();});}};}function handleEntityNotFound(_0x5435b6,_0x3b3d6b){return function(_0x233b40){if(!_0x233b40){_0x5435b6[_0x4059('0x24')](0x194);}return _0x233b40;};}function handleError(_0x34b6ce,_0x5e8bd5){_0x5e8bd5=_0x5e8bd5||0x1f4;return function(_0x1216c7){logger[_0x4059('0x25')](_0x1216c7[_0x4059('0x26')]);if(_0x1216c7[_0x4059('0x27')]){delete _0x1216c7[_0x4059('0x27')];}_0x34b6ce['status'](_0x5e8bd5)[_0x4059('0x28')](_0x1216c7);};}exports[_0x4059('0x29')]=function(_0x352f7d,_0xa6f325){var _0x5bbd75={},_0x106527={},_0x12ee1c={'count':0x0,'rows':[]};var _0x4ea076=_[_0x4059('0x2a')](db[_0x4059('0x2b')][_0x4059('0x2c')],function(_0x34e512){return{'name':_0x34e512['fieldName'],'type':_0x34e512['type']['key']};});_0x106527['model']=_[_0x4059('0x2a')](_0x4ea076,_0x4059('0x27'));_0x106527[_0x4059('0x2d')]=_[_0x4059('0x2e')](_0x352f7d[_0x4059('0x2d')]);_0x106527[_0x4059('0x2f')]=_[_0x4059('0x30')](_0x106527[_0x4059('0x31')],_0x106527['query']);_0x5bbd75[_0x4059('0x32')]=_[_0x4059('0x30')](_0x106527['model'],qs[_0x4059('0x33')](_0x352f7d[_0x4059('0x2d')][_0x4059('0x33')]));_0x5bbd75['attributes']=_0x5bbd75[_0x4059('0x32')][_0x4059('0x34')]?_0x5bbd75[_0x4059('0x32')]:_0x106527[_0x4059('0x31')];if(!_0x352f7d[_0x4059('0x2d')][_0x4059('0x35')](_0x4059('0x36'))){_0x5bbd75[_0x4059('0x1c')]=qs[_0x4059('0x1c')](_0x352f7d['query']['limit']);_0x5bbd75[_0x4059('0x1a')]=qs[_0x4059('0x1a')](_0x352f7d[_0x4059('0x2d')][_0x4059('0x1a')]);}_0x5bbd75[_0x4059('0x37')]=qs[_0x4059('0x38')](_0x352f7d[_0x4059('0x2d')]['sort']);_0x5bbd75[_0x4059('0x39')]=qs[_0x4059('0x2f')](_['pick'](_0x352f7d[_0x4059('0x2d')],_0x106527[_0x4059('0x2f')]),_0x4ea076);if(_0x352f7d[_0x4059('0x2d')]['filter']){_0x5bbd75[_0x4059('0x39')]=_[_0x4059('0x3a')](_0x5bbd75['where'],{'$or':_[_0x4059('0x2a')](_0x4ea076,function(_0x2491c1){if(_0x2491c1['type']!==_0x4059('0x3b')){var _0x5e3d3f={};_0x5e3d3f[_0x2491c1[_0x4059('0x27')]]={'$like':'%'+_0x352f7d['query'][_0x4059('0x3c')]+'%'};return _0x5e3d3f;}})});}_0x5bbd75=_['merge']({},_0x5bbd75,_0x352f7d['options']);var _0x221c45={'where':_0x5bbd75[_0x4059('0x39')]};return db['FreshsalesField']['count'](_0x221c45)[_0x4059('0x3d')](function(_0x57db2d){_0x12ee1c['count']=_0x57db2d;if(_0x352f7d[_0x4059('0x2d')][_0x4059('0x3e')]){_0x5bbd75[_0x4059('0x3f')]=[{'all':!![]}];}return db[_0x4059('0x2b')][_0x4059('0x40')](_0x5bbd75);})[_0x4059('0x3d')](function(_0x2d0d1b){_0x12ee1c[_0x4059('0x41')]=_0x2d0d1b;return _0x12ee1c;})[_0x4059('0x3d')](respondWithFilteredResult(_0xa6f325,_0x5bbd75))[_0x4059('0x42')](handleError(_0xa6f325,null));};exports[_0x4059('0x43')]=function(_0x102ff5,_0x337a4c){var _0x1b1601={'raw':!![],'where':{'id':_0x102ff5[_0x4059('0x44')]['id']}},_0x483808={};_0x483808['model']=_['keys'](db[_0x4059('0x2b')][_0x4059('0x2c')]);_0x483808[_0x4059('0x2d')]=_[_0x4059('0x2e')](_0x102ff5[_0x4059('0x2d')]);_0x483808[_0x4059('0x2f')]=_[_0x4059('0x30')](_0x483808['model'],_0x483808[_0x4059('0x2d')]);_0x1b1601[_0x4059('0x32')]=_[_0x4059('0x30')](_0x483808[_0x4059('0x31')],qs[_0x4059('0x33')](_0x102ff5[_0x4059('0x2d')]['fields']));_0x1b1601[_0x4059('0x32')]=_0x1b1601['attributes']['length']?_0x1b1601['attributes']:_0x483808[_0x4059('0x31')];if(_0x102ff5[_0x4059('0x2d')][_0x4059('0x3e')]){_0x1b1601[_0x4059('0x3f')]=[{'all':!![]}];}_0x1b1601=_[_0x4059('0x3a')]({},_0x1b1601,_0x102ff5[_0x4059('0x45')]);return db[_0x4059('0x2b')][_0x4059('0x46')](_0x1b1601)[_0x4059('0x3d')](handleEntityNotFound(_0x337a4c,null))[_0x4059('0x3d')](respondWithResult(_0x337a4c,null))['catch'](handleError(_0x337a4c,null));};exports[_0x4059('0x47')]=function(_0x4fd83f,_0xa98f72){return db['FreshsalesField'][_0x4059('0x47')](_0x4fd83f[_0x4059('0x48')],{})['then'](respondWithResult(_0xa98f72,0xc9))['catch'](handleError(_0xa98f72,null));};exports[_0x4059('0x21')]=function(_0x520a4a,_0x1b9869){if(_0x520a4a[_0x4059('0x48')]['id']){delete _0x520a4a['body']['id'];}return db[_0x4059('0x2b')][_0x4059('0x46')]({'where':{'id':_0x520a4a[_0x4059('0x44')]['id']}})[_0x4059('0x3d')](handleEntityNotFound(_0x1b9869,null))[_0x4059('0x3d')](saveUpdates(_0x520a4a[_0x4059('0x48')],null))['then'](respondWithResult(_0x1b9869,null))['catch'](handleError(_0x1b9869,null));};exports[_0x4059('0x22')]=function(_0x1c28cf,_0x442f5b){return db[_0x4059('0x2b')][_0x4059('0x46')]({'where':{'id':_0x1c28cf[_0x4059('0x44')]['id']}})[_0x4059('0x3d')](handleEntityNotFound(_0x442f5b,null))[_0x4059('0x3d')](removeEntity(_0x442f5b,null))[_0x4059('0x42')](handleError(_0x442f5b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 84eaf4f..b7e5a9d 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 _0xf970=['rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5cc316,_0x36ae66){var _0x298441=function(_0x5d9e3e){while(--_0x5d9e3e){_0x5cc316['push'](_0x5cc316['shift']());}};_0x298441(++_0x36ae66);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0f97('0x0'));var util=require('util');var logger=require(_0x0f97('0x1'))(_0x0f97('0x2'));var moment=require(_0x0f97('0x3'));var BPromise=require(_0x0f97('0x4'));var rp=require(_0x0f97('0x5'));var fs=require('fs');var path=require(_0x0f97('0x6'));var rimraf=require(_0x0f97('0x7'));var config=require('../../config/environment');var attributes=require(_0x0f97('0x8'));module[_0x0f97('0x9')]=function(_0x290200,_0xac501){return _0x290200[_0x0f97('0xa')](_0x0f97('0xb'),attributes,{'tableName':_0x0f97('0xc'),'paranoid':![],'indexes':[{'name':_0x0f97('0xd'),'fields':[_0x0f97('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6d7=['FieldId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0x119d25,_0x588c8){var _0x39cf30=function(_0x31c68c){while(--_0x31c68c){_0x119d25['push'](_0x119d25['shift']());}};_0x39cf30(++_0x588c8);}(_0xc6d7,0x71));var _0x7c6d=function(_0x4b7ae3,_0x5dc0c9){_0x4b7ae3=_0x4b7ae3-0x0;var _0x46d4b0=_0xc6d7[_0x4b7ae3];return _0x46d4b0;};'use strict';var _=require(_0x7c6d('0x0'));var util=require(_0x7c6d('0x1'));var logger=require(_0x7c6d('0x2'))(_0x7c6d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7c6d('0x4'));var fs=require('fs');var path=require(_0x7c6d('0x5'));var rimraf=require(_0x7c6d('0x6'));var config=require(_0x7c6d('0x7'));var attributes=require(_0x7c6d('0x8'));module[_0x7c6d('0x9')]=function(_0x679fc1,_0x4120c1){return _0x679fc1[_0x7c6d('0xa')](_0x7c6d('0xb'),attributes,{'tableName':_0x7c6d('0xc'),'paranoid':![],'indexes':[{'name':_0x7c6d('0xd'),'fields':[_0x7c6d('0xe'),_0x7c6d('0xf')],'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 a7745d4..d0bae20 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 _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x44a23f,_0x54e291){var _0x4599fc=function(_0x28b36d){while(--_0x28b36d){_0x44a23f['push'](_0x44a23f['shift']());}};_0x4599fc(++_0x54e291);}(_0x1623,0xab));var _0x3162=function(_0x5cab35,_0x534f74){_0x5cab35=_0x5cab35-0x0;var _0x97a2ff=_0x1623[_0x5cab35];return _0x97a2ff;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file +var _0xbd51=['FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3c8c7b,_0x3416ac){_0x3c8c7b=_0x3c8c7b-0x0;var _0x3450a7=_0xbd51[_0x3c8c7b];return _0x3450a7;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){return client['request'](_0x29abea,_0x19077c)[_0x1bd5('0x8')](function(_0x5c8e0d){logger[_0x1bd5('0x9')](_0x1bd5('0xa'),_0x30a385,_0x1bd5('0xb'));logger[_0x1bd5('0xc')](_0x1bd5('0xd'),_0x30a385,_0x1bd5('0xb'),JSON['stringify'](_0x5c8e0d));if(_0x5c8e0d[_0x1bd5('0xe')]){if(_0x5c8e0d['error'][_0x1bd5('0xf')]===0x1f4){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0xd8418f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0x27d58f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x1bd5('0xb'));_0x27d58f(_0x5c8e0d[_0x1bd5('0x11')][_0x1bd5('0x10')]);}})[_0x1bd5('0x12')](function(_0x43ea3e){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x43ea3e);_0xd8418f(_0x43ea3e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 399bb98..83cc180 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x401d97,_0x543e10){var _0x57e803=function(_0x1210c1){while(--_0x1210c1){_0x401d97['push'](_0x401d97['shift']());}};_0x57e803(++_0x543e10);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 +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(_0x5e84c4,_0x519ac6){var _0x54c839=function(_0x544e81){while(--_0x544e81){_0x5e84c4['push'](_0x5e84c4['shift']());}};_0x54c839(++_0x519ac6);}(_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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 8cbd219..62e2c81 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 _0x8fcd=['integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x23c549,_0x2e12c5){_0x23c549=_0x23c549-0x0;var _0x35e1b7=_0x8fcd[_0x23c549];return _0x35e1b7;};'use strict';var Sequelize=require(_0xd8fc('0x0'));module[_0xd8fc('0x1')]={'name':{'type':Sequelize[_0xd8fc('0x2')]},'description':{'type':Sequelize[_0xd8fc('0x2')]},'username':{'type':Sequelize[_0xd8fc('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xd8fc('0x2')]},'clientId':{'type':Sequelize[_0xd8fc('0x2')]},'clientSecret':{'type':Sequelize[_0xd8fc('0x2')]},'securityToken':{'type':Sequelize[_0xd8fc('0x2')]},'serverUrl':{'type':Sequelize[_0xd8fc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd8fc('0x3')]('integrationTab','newTab'),'defaultValue':_0xd8fc('0x4')}}; \ No newline at end of file +var _0xd052=['newTab','STRING','ENUM','integrationTab'];(function(_0x1f0425,_0x19d7cc){var _0x195f80=function(_0xcfa4dd){while(--_0xcfa4dd){_0x1f0425['push'](_0x1f0425['shift']());}};_0x195f80(++_0x19d7cc);}(_0xd052,0x69));var _0x2d05=function(_0x497908,_0x48f14c){_0x497908=_0x497908-0x0;var _0x165382=_0xd052[_0x497908];return _0x165382;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2d05('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2d05('0x0')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2d05('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x2d05('0x0')]},'securityToken':{'type':Sequelize[_0x2d05('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2d05('0x1')](_0x2d05('0x2'),_0x2d05('0x3')),'defaultValue':_0x2d05('0x2')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index f8b645b..8a43622 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 _0x3ca2=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','slice','substring','lastIndexOf','Connection','concat','isNil','ticketType','sobject','describe','OwnerId','IsRecurrence','Subject','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','True','true','false','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end'];(function(_0x2e60be,_0x3f4e9c){var _0x52e6b5=function(_0x32a620){while(--_0x32a620){_0x2e60be['push'](_0x2e60be['shift']());}};_0x52e6b5(++_0x3f4e9c);}(_0x3ca2,0x152));var _0x23ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23ca('0x0'));var zipdir=require(_0x23ca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x23ca('0x2'));var util=require(_0x23ca('0x3'));var path=require(_0x23ca('0x4'));var sox=require(_0x23ca('0x5'));var csv=require(_0x23ca('0x6'));var ejs=require(_0x23ca('0x7'));var fs=require('fs');var fs_extra=require(_0x23ca('0x8'));var _=require('lodash');var squel=require(_0x23ca('0x9'));var crypto=require(_0x23ca('0xa'));var jsforce=require(_0x23ca('0xb'));var deskjs=require(_0x23ca('0xc'));var toCsv=require(_0x23ca('0x6'));var querystring=require(_0x23ca('0xd'));var Papa=require(_0x23ca('0xe'));var Redis=require(_0x23ca('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x23ca('0x10'));var as=require(_0x23ca('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x23ca('0x12'));var utils=require('../../config/utils');var config=require(_0x23ca('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x23ca('0x14'))['db'];var integrations=require(_0x23ca('0x15'));function respondWithStatusCode(_0xbf09d5,_0x33aa3b){_0x33aa3b=_0x33aa3b||0xcc;return function(_0x2a8e5f){if(_0x2a8e5f){return _0xbf09d5[_0x23ca('0x16')](_0x33aa3b);}return _0xbf09d5[_0x23ca('0x17')](_0x33aa3b)[_0x23ca('0x18')]();};}function respondWithResult(_0x32ce72,_0x390be4){_0x390be4=_0x390be4||0xc8;return function(_0x4e7335){if(_0x4e7335){return _0x32ce72[_0x23ca('0x17')](_0x390be4)['json'](_0x4e7335);}};}function respondWithFilteredResult(_0x29c3e6,_0x455d55){return function(_0x2aa69c){if(_0x2aa69c){var _0x4979ff=typeof _0x455d55[_0x23ca('0x19')]===_0x23ca('0x1a')&&typeof _0x455d55[_0x23ca('0x1b')]===_0x23ca('0x1a');var _0x23ab79=_0x2aa69c[_0x23ca('0x1c')];var _0x37e72a=_0x4979ff?0x0:_0x455d55[_0x23ca('0x19')];var _0xae7bc4=_0x4979ff?_0x2aa69c[_0x23ca('0x1c')]:_0x455d55[_0x23ca('0x19')]+_0x455d55['limit'];var _0x24726e;if(_0xae7bc4>=_0x23ab79){_0xae7bc4=_0x23ab79;_0x24726e=0xc8;}else{_0x24726e=0xce;}_0x29c3e6['status'](_0x24726e);return _0x29c3e6[_0x23ca('0x1d')](_0x23ca('0x1e'),_0x37e72a+'-'+_0xae7bc4+'/'+_0x23ab79)[_0x23ca('0x1f')](_0x2aa69c);}return null;};}function patchUpdates(_0x38e313){return function(_0x13d358){try{jsonpatch[_0x23ca('0x20')](_0x13d358,_0x38e313,!![]);}catch(_0x207215){return BPromise[_0x23ca('0x21')](_0x207215);}return _0x13d358[_0x23ca('0x22')]();};}function saveUpdates(_0x314ca0,_0x11edeb){return function(_0x27ba32){if(_0x27ba32){return _0x27ba32[_0x23ca('0x23')](_0x314ca0)['then'](function(_0x3cef1e){return _0x3cef1e;});}return null;};}function removeEntity(_0x5bdcf2,_0x4b723d){return function(_0x86747e){if(_0x86747e){return _0x86747e[_0x23ca('0x24')]()[_0x23ca('0x25')](function(){_0x5bdcf2[_0x23ca('0x17')](0xcc)[_0x23ca('0x18')]();});}};}function handleEntityNotFound(_0x548978,_0x8ae111){return function(_0x55aba9){if(!_0x55aba9){_0x548978['sendStatus'](0x194);}return _0x55aba9;};}function handleError(_0x41c09e,_0x15a98f){_0x15a98f=_0x15a98f||0x1f4;return function(_0x2e5444){logger[_0x23ca('0x26')](_0x2e5444[_0x23ca('0x27')]);if(_0x2e5444[_0x23ca('0x28')]){delete _0x2e5444[_0x23ca('0x28')];}_0x41c09e['status'](_0x15a98f)['send'](_0x2e5444);};}exports['index']=function(_0x3d4c22,_0x391161){var _0x5ba6c6={},_0x43d644={},_0x170311={'count':0x0,'rows':[]};var _0x1a57c2=_[_0x23ca('0x29')](db[_0x23ca('0x2a')][_0x23ca('0x2b')],function(_0x1ee9cd){return{'name':_0x1ee9cd[_0x23ca('0x2c')],'type':_0x1ee9cd[_0x23ca('0x2d')][_0x23ca('0x2e')]};});_0x43d644[_0x23ca('0x2f')]=_['map'](_0x1a57c2,_0x23ca('0x28'));_0x43d644[_0x23ca('0x30')]=_[_0x23ca('0x31')](_0x3d4c22[_0x23ca('0x30')]);_0x43d644['filters']=_[_0x23ca('0x32')](_0x43d644[_0x23ca('0x2f')],_0x43d644[_0x23ca('0x30')]);_0x5ba6c6[_0x23ca('0x33')]=_[_0x23ca('0x32')](_0x43d644[_0x23ca('0x2f')],qs['fields'](_0x3d4c22['query'][_0x23ca('0x34')]));_0x5ba6c6['attributes']=_0x5ba6c6[_0x23ca('0x33')][_0x23ca('0x35')]?_0x5ba6c6[_0x23ca('0x33')]:_0x43d644[_0x23ca('0x2f')];if(!_0x3d4c22[_0x23ca('0x30')][_0x23ca('0x36')]('nolimit')){_0x5ba6c6[_0x23ca('0x1b')]=qs[_0x23ca('0x1b')](_0x3d4c22['query'][_0x23ca('0x1b')]);_0x5ba6c6[_0x23ca('0x19')]=qs[_0x23ca('0x19')](_0x3d4c22[_0x23ca('0x30')]['offset']);}_0x5ba6c6[_0x23ca('0x37')]=qs[_0x23ca('0x38')](_0x3d4c22[_0x23ca('0x30')][_0x23ca('0x38')]);_0x5ba6c6[_0x23ca('0x39')]=qs[_0x23ca('0x3a')](_['pick'](_0x3d4c22[_0x23ca('0x30')],_0x43d644[_0x23ca('0x3a')]),_0x1a57c2);if(_0x3d4c22[_0x23ca('0x30')][_0x23ca('0x3b')]){_0x5ba6c6[_0x23ca('0x39')]=_[_0x23ca('0x3c')](_0x5ba6c6['where'],{'$or':_[_0x23ca('0x29')](_0x1a57c2,function(_0x590766){if(_0x590766[_0x23ca('0x2d')]!==_0x23ca('0x3d')){var _0x74873b={};_0x74873b[_0x590766[_0x23ca('0x28')]]={'$like':'%'+_0x3d4c22[_0x23ca('0x30')][_0x23ca('0x3b')]+'%'};return _0x74873b;}})});}_0x5ba6c6=_[_0x23ca('0x3c')]({},_0x5ba6c6,_0x3d4c22[_0x23ca('0x3e')]);var _0x21bd10={'where':_0x5ba6c6[_0x23ca('0x39')]};return db[_0x23ca('0x2a')][_0x23ca('0x1c')](_0x21bd10)['then'](function(_0x2b4e4b){_0x170311['count']=_0x2b4e4b;if(_0x3d4c22[_0x23ca('0x30')][_0x23ca('0x3f')]){_0x5ba6c6['include']=[{'all':!![]}];}return db[_0x23ca('0x2a')][_0x23ca('0x40')](_0x5ba6c6);})[_0x23ca('0x25')](function(_0x422eb0){_0x170311[_0x23ca('0x41')]=_0x422eb0;return _0x170311;})[_0x23ca('0x25')](respondWithFilteredResult(_0x391161,_0x5ba6c6))[_0x23ca('0x42')](handleError(_0x391161,null));};exports[_0x23ca('0x43')]=function(_0x104748,_0x4dc60e){var _0x82e9a2={'raw':![],'where':{'id':_0x104748[_0x23ca('0x44')]['id']}},_0x16b995={};_0x16b995[_0x23ca('0x2f')]=_[_0x23ca('0x31')](db[_0x23ca('0x2a')]['rawAttributes']);_0x16b995[_0x23ca('0x30')]=_[_0x23ca('0x31')](_0x104748['query']);_0x16b995['filters']=_['intersection'](_0x16b995['model'],_0x16b995['query']);_0x82e9a2[_0x23ca('0x33')]=_[_0x23ca('0x32')](_0x16b995[_0x23ca('0x2f')],qs['fields'](_0x104748[_0x23ca('0x30')][_0x23ca('0x34')]));_0x82e9a2['attributes']=_0x82e9a2[_0x23ca('0x33')]['length']?_0x82e9a2[_0x23ca('0x33')]:_0x16b995['model'];if(_0x104748[_0x23ca('0x30')][_0x23ca('0x3f')]){_0x82e9a2['include']=[{'all':!![]}];}_0x82e9a2=_[_0x23ca('0x3c')]({},_0x82e9a2,_0x104748[_0x23ca('0x3e')]);return db[_0x23ca('0x2a')][_0x23ca('0x45')](_0x82e9a2)[_0x23ca('0x25')](handleEntityNotFound(_0x4dc60e,null))['then'](respondWithResult(_0x4dc60e,null))[_0x23ca('0x42')](handleError(_0x4dc60e,null));};exports[_0x23ca('0x46')]=function(_0x2e0f0f,_0x30dcf9){return db['SalesforceAccount'][_0x23ca('0x46')](_0x2e0f0f['body'],{})['then'](respondWithResult(_0x30dcf9,0xc9))['catch'](handleError(_0x30dcf9,null));};exports[_0x23ca('0x23')]=function(_0x3de37b,_0x511ac1){if(_0x3de37b['body']['id']){delete _0x3de37b[_0x23ca('0x47')]['id'];}return db[_0x23ca('0x2a')][_0x23ca('0x45')]({'where':{'id':_0x3de37b[_0x23ca('0x44')]['id']}})[_0x23ca('0x25')](handleEntityNotFound(_0x511ac1,null))[_0x23ca('0x25')](saveUpdates(_0x3de37b['body'],null))[_0x23ca('0x25')](respondWithResult(_0x511ac1,null))['catch'](handleError(_0x511ac1,null));};exports[_0x23ca('0x24')]=function(_0x5a4708,_0x1c6f4a){return db[_0x23ca('0x2a')][_0x23ca('0x45')]({'where':{'id':_0x5a4708[_0x23ca('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c6f4a,null))[_0x23ca('0x25')](removeEntity(_0x1c6f4a,null))[_0x23ca('0x42')](handleError(_0x1c6f4a,null));};exports[_0x23ca('0x48')]=function(_0x2310d6,_0x20b9d9,_0x1897d8){var _0x1046ad={};var _0x4011ea={};var _0x208bd5;var _0xfb317;return db[_0x23ca('0x2a')][_0x23ca('0x49')]({'where':{'id':_0x2310d6[_0x23ca('0x44')]['id']}})[_0x23ca('0x25')](handleEntityNotFound(_0x20b9d9,null))[_0x23ca('0x25')](function(_0x538264){if(_0x538264){_0x208bd5=_0x538264;_0x4011ea[_0x23ca('0x2f')]=_[_0x23ca('0x31')](db['SalesforceConfiguration'][_0x23ca('0x2b')]);_0x4011ea[_0x23ca('0x30')]=_[_0x23ca('0x31')](_0x2310d6['query']);_0x4011ea['filters']=_['intersection'](_0x4011ea[_0x23ca('0x2f')],_0x4011ea['query']);_0x1046ad['attributes']=_[_0x23ca('0x32')](_0x4011ea['model'],qs[_0x23ca('0x34')](_0x2310d6[_0x23ca('0x30')][_0x23ca('0x34')]));_0x1046ad[_0x23ca('0x33')]=_0x1046ad['attributes'][_0x23ca('0x35')]?_0x1046ad[_0x23ca('0x33')]:_0x4011ea['model'];_0x1046ad[_0x23ca('0x37')]=qs[_0x23ca('0x38')](_0x2310d6[_0x23ca('0x30')][_0x23ca('0x38')]);_0x1046ad[_0x23ca('0x39')]=qs[_0x23ca('0x3a')](_[_0x23ca('0x4a')](_0x2310d6[_0x23ca('0x30')],_0x4011ea[_0x23ca('0x3a')]));if(_0x2310d6[_0x23ca('0x30')][_0x23ca('0x3b')]){_0x1046ad[_0x23ca('0x39')]=_[_0x23ca('0x3c')](_0x1046ad['where'],{'$or':_[_0x23ca('0x29')](_0x1046ad[_0x23ca('0x33')],function(_0x4ead76){var _0x12a798={};_0x12a798[_0x4ead76]={'$like':'%'+_0x2310d6['query']['filter']+'%'};return _0x12a798;})});}_0x1046ad=_[_0x23ca('0x3c')]({},_0x1046ad,_0x2310d6[_0x23ca('0x3e')]);return _0x208bd5[_0x23ca('0x48')](_0x1046ad);}})[_0x23ca('0x25')](function(_0x47267f){if(_0x47267f){_0xfb317=_0x47267f['length'];if(!_0x2310d6['query'][_0x23ca('0x36')]('nolimit')){_0x1046ad[_0x23ca('0x1b')]=qs[_0x23ca('0x1b')](_0x2310d6[_0x23ca('0x30')][_0x23ca('0x1b')]);_0x1046ad[_0x23ca('0x19')]=qs['offset'](_0x2310d6[_0x23ca('0x30')][_0x23ca('0x19')]);}return _0x208bd5[_0x23ca('0x48')](_0x1046ad);}})['then'](function(_0xd27429){if(_0xd27429){return _0xd27429?{'count':_0xfb317,'rows':_0xd27429}:null;}})[_0x23ca('0x25')](respondWithResult(_0x20b9d9,null))['catch'](handleError(_0x20b9d9,null));};exports[_0x23ca('0x4b')]=function(_0x42feb2,_0x493ffb,_0x344a9a){if(_0x42feb2[_0x23ca('0x47')]['id']){delete _0x42feb2[_0x23ca('0x47')]['id'];}return db[_0x23ca('0x2a')][_0x23ca('0x49')]({'where':{'id':_0x42feb2[_0x23ca('0x44')]['id']}})[_0x23ca('0x25')](handleEntityNotFound(_0x493ffb,null))[_0x23ca('0x25')](function(_0x1ebd53){if(_0x1ebd53){_0x42feb2[_0x23ca('0x47')]['AccountId']=_0x1ebd53['id'];_0x42feb2['body'][_0x23ca('0x4c')]=integrations[_0x23ca('0x4d')](_0x42feb2[_0x23ca('0x47')][_0x23ca('0x4e')],_0x42feb2['body'][_0x23ca('0x2d')]);_0x42feb2[_0x23ca('0x47')][_0x23ca('0x4f')]=integrations[_0x23ca('0x50')](_0x42feb2[_0x23ca('0x47')][_0x23ca('0x4e')],_0x42feb2[_0x23ca('0x47')][_0x23ca('0x2d')]);return db['SalesforceConfiguration']['create'](_0x42feb2['body'],{'include':[{'model':db[_0x23ca('0x51')],'as':_0x23ca('0x4c')},{'model':db[_0x23ca('0x51')],'as':_0x23ca('0x4f')}]});}return null;})[_0x23ca('0x25')](respondWithResult(_0x493ffb,null))[_0x23ca('0x42')](handleError(_0x493ffb,null));};exports[_0x23ca('0x52')]=function(_0x573f76,_0x1c5242,_0x36d205){var _0x17fb81;var _0x53be13='';var _0x36e6a4='Task';return db[_0x23ca('0x2a')][_0x23ca('0x49')]({'where':{'id':_0x573f76['params']['id']},'attributes':['id',_0x23ca('0x53'),_0x23ca('0x54'),_0x23ca('0x55'),_0x23ca('0x56'),_0x23ca('0x57'),'securityToken']})['then'](handleEntityNotFound(_0x1c5242,null))[_0x23ca('0x25')](function(_0xa6ecc1){if(_0xa6ecc1){_0x53be13=_0xa6ecc1[_0x23ca('0x53')];var _0x153932=_0x53be13[_0x23ca('0x58')](-0x1);if(_0x153932==='/'){_0x53be13=_0x53be13[_0x23ca('0x59')](0x0,_0x53be13[_0x23ca('0x5a')](_0x153932));}_0x17fb81=new jsforce[(_0x23ca('0x5b'))]({'oauth2':{'loginUrl':_0x53be13,'clientId':_0xa6ecc1[_0x23ca('0x54')],'clientSecret':_0xa6ecc1[_0x23ca('0x55')]}});return _0x17fb81['login'](_0xa6ecc1[_0x23ca('0x56')],_0xa6ecc1[_0x23ca('0x57')][_0x23ca('0x5c')](_0xa6ecc1['securityToken']));}})['then'](function(_0x42d3e5){if(_0x42d3e5){if(!_[_0x23ca('0x5d')](_0x573f76['query'][_0x23ca('0x5e')])){_0x36e6a4=_0x573f76[_0x23ca('0x30')]['ticketType'];}return _0x17fb81[_0x23ca('0x5f')](_0x36e6a4)[_0x23ca('0x60')]();}})['then'](function(_0x3c618b){var _0x4f6a2b=[_0x23ca('0x61'),'ActivityDate','IsReminderSet',_0x23ca('0x62'),_0x23ca('0x63'),'Description'];var _0x51a7e2=[_0x23ca('0x64'),_0x23ca('0x65'),_0x23ca('0x66'),_0x23ca('0x67'),_0x23ca('0x68'),_0x23ca('0x69'),_0x23ca('0x6a')];if(_0x3c618b){_[_0x23ca('0x6b')](_0x3c618b[_0x23ca('0x34')],function(_0x232403){return _0x4f6a2b[_0x23ca('0x6c')](_0x232403[_0x23ca('0x28')])||!_0x51a7e2['includes'](_0x232403[_0x23ca('0x2d')]);});return{'count':_0x3c618b['fields']['length'],'rows':_[_0x23ca('0x29')](_0x3c618b['fields'],function(_0x21b230){return{'id':_0x21b230[_0x23ca('0x28')],'name':_0x21b230[_0x23ca('0x6d')],'custom':_0x21b230['custom'],'options':_0x21b230[_0x23ca('0x6e')][_0x23ca('0x35')]>0x0?_[_0x23ca('0x29')](_0x21b230[_0x23ca('0x6e')],function(_0x53d2a1){return{'name':_0x53d2a1[_0x23ca('0x6d')],'value':_0x53d2a1[_0x23ca('0x6f')]};}):_0x21b230[_0x23ca('0x2d')]=='boolean'?[{'name':_0x23ca('0x70'),'value':_0x23ca('0x71')},{'name':'False','value':_0x23ca('0x72')}]:[]};})};}})['then'](respondWithResult(_0x1c5242,null))[_0x23ca('0x42')](function(_0x2eff3d){var _0x2aca2e=_0x573f76[_0x23ca('0x30')][_0x23ca('0x73')]?0x1f4:_0x2eff3d['statusCode']||0x1f4;logger[_0x23ca('0x26')](_0x23ca('0x74'),'getFields',_0x2aca2e,JSON[_0x23ca('0x75')](_0x2eff3d));delete _0x2eff3d[_0x23ca('0x28')];if(_0x2aca2e===0x191){_0x2aca2e=0x190;}_0x1c5242[_0x23ca('0x17')](_0x2aca2e)[_0x23ca('0x76')](_0x573f76[_0x23ca('0x30')][_0x23ca('0x73')]?{'message':_0x23ca('0x77'),'statusCode':_0x2eff3d[_0x23ca('0x78')]}:_0x2eff3d);});}; \ No newline at end of file +var _0xa001=['filters','intersection','attributes','fields','length','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','SalesforceAccount','findAll','rows','catch','params','rawAttributes','include','create','body','find','getConfigurations','findOne','SalesforceConfiguration','order','pick','addConfiguration','AccountId','Subjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','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','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','fieldName','type','key','model','map','query','keys'];(function(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0xa001,0x1d1));var _0x1a00=function(_0x2b11b3,_0x251ce3){_0x2b11b3=_0x2b11b3-0x0;var _0x298bf1=_0xa001[_0x2b11b3];return _0x298bf1;};'use strict';var emlformat=require(_0x1a00('0x0'));var rimraf=require(_0x1a00('0x1'));var zipdir=require(_0x1a00('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a00('0x3'));var moment=require(_0x1a00('0x4'));var BPromise=require(_0x1a00('0x5'));var Mustache=require(_0x1a00('0x6'));var util=require(_0x1a00('0x7'));var path=require(_0x1a00('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a00('0x9'));var _=require(_0x1a00('0xa'));var squel=require(_0x1a00('0xb'));var crypto=require(_0x1a00('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a00('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1a00('0xe'));var Papa=require(_0x1a00('0xf'));var Redis=require(_0x1a00('0x10'));var authService=require(_0x1a00('0x11'));var qs=require(_0x1a00('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a00('0x13'));var logger=require(_0x1a00('0x14'))(_0x1a00('0x15'));var utils=require(_0x1a00('0x16'));var config=require(_0x1a00('0x17'));var licenseUtil=require(_0x1a00('0x18'));var db=require(_0x1a00('0x19'))['db'];var integrations=require(_0x1a00('0x1a'));function respondWithStatusCode(_0x4b2c59,_0xef213c){_0xef213c=_0xef213c||0xcc;return function(_0x518574){if(_0x518574){return _0x4b2c59[_0x1a00('0x1b')](_0xef213c);}return _0x4b2c59['status'](_0xef213c)['end']();};}function respondWithResult(_0x440c2f,_0x59da9c){_0x59da9c=_0x59da9c||0xc8;return function(_0x2c4c88){if(_0x2c4c88){return _0x440c2f[_0x1a00('0x1c')](_0x59da9c)[_0x1a00('0x1d')](_0x2c4c88);}};}function respondWithFilteredResult(_0x5977dc,_0x20ea3b){return function(_0x3aaacb){if(_0x3aaacb){var _0x3f3dd4=typeof _0x20ea3b[_0x1a00('0x1e')]===_0x1a00('0x1f')&&typeof _0x20ea3b[_0x1a00('0x20')]==='undefined';var _0xc0d56b=_0x3aaacb[_0x1a00('0x21')];var _0xd4b8a0=_0x3f3dd4?0x0:_0x20ea3b[_0x1a00('0x1e')];var _0xbc4947=_0x3f3dd4?_0x3aaacb[_0x1a00('0x21')]:_0x20ea3b[_0x1a00('0x1e')]+_0x20ea3b['limit'];var _0x3749d6;if(_0xbc4947>=_0xc0d56b){_0xbc4947=_0xc0d56b;_0x3749d6=0xc8;}else{_0x3749d6=0xce;}_0x5977dc[_0x1a00('0x1c')](_0x3749d6);return _0x5977dc[_0x1a00('0x22')]('Content-Range',_0xd4b8a0+'-'+_0xbc4947+'/'+_0xc0d56b)['json'](_0x3aaacb);}return null;};}function patchUpdates(_0x5cf35b){return function(_0x109e9c){try{jsonpatch[_0x1a00('0x23')](_0x109e9c,_0x5cf35b,!![]);}catch(_0x3cf3a6){return BPromise['reject'](_0x3cf3a6);}return _0x109e9c[_0x1a00('0x24')]();};}function saveUpdates(_0x1b18d5,_0x431cf8){return function(_0x5afbcc){if(_0x5afbcc){return _0x5afbcc[_0x1a00('0x25')](_0x1b18d5)[_0x1a00('0x26')](function(_0x3ca1b5){return _0x3ca1b5;});}return null;};}function removeEntity(_0x4e9cbd,_0x41dcc7){return function(_0x3fc0bf){if(_0x3fc0bf){return _0x3fc0bf[_0x1a00('0x27')]()['then'](function(){_0x4e9cbd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24ae38,_0x17dea9){return function(_0x1b19eb){if(!_0x1b19eb){_0x24ae38['sendStatus'](0x194);}return _0x1b19eb;};}function handleError(_0x2878e3,_0x855435){_0x855435=_0x855435||0x1f4;return function(_0x1532b5){logger[_0x1a00('0x28')](_0x1532b5['stack']);if(_0x1532b5['name']){delete _0x1532b5[_0x1a00('0x29')];}_0x2878e3[_0x1a00('0x1c')](_0x855435)[_0x1a00('0x2a')](_0x1532b5);};}exports[_0x1a00('0x2b')]=function(_0x4f9473,_0x31238d){var _0x188f2d={},_0x18ef5b={},_0x423a9d={'count':0x0,'rows':[]};var _0x451286=_['map'](db['SalesforceAccount']['rawAttributes'],function(_0x37eab7){return{'name':_0x37eab7[_0x1a00('0x2c')],'type':_0x37eab7[_0x1a00('0x2d')][_0x1a00('0x2e')]};});_0x18ef5b[_0x1a00('0x2f')]=_[_0x1a00('0x30')](_0x451286,_0x1a00('0x29'));_0x18ef5b[_0x1a00('0x31')]=_[_0x1a00('0x32')](_0x4f9473['query']);_0x18ef5b[_0x1a00('0x33')]=_[_0x1a00('0x34')](_0x18ef5b[_0x1a00('0x2f')],_0x18ef5b[_0x1a00('0x31')]);_0x188f2d[_0x1a00('0x35')]=_[_0x1a00('0x34')](_0x18ef5b[_0x1a00('0x2f')],qs[_0x1a00('0x36')](_0x4f9473[_0x1a00('0x31')][_0x1a00('0x36')]));_0x188f2d[_0x1a00('0x35')]=_0x188f2d['attributes'][_0x1a00('0x37')]?_0x188f2d[_0x1a00('0x35')]:_0x18ef5b['model'];if(!_0x4f9473[_0x1a00('0x31')]['hasOwnProperty'](_0x1a00('0x38'))){_0x188f2d[_0x1a00('0x20')]=qs[_0x1a00('0x20')](_0x4f9473[_0x1a00('0x31')][_0x1a00('0x20')]);_0x188f2d[_0x1a00('0x1e')]=qs[_0x1a00('0x1e')](_0x4f9473[_0x1a00('0x31')][_0x1a00('0x1e')]);}_0x188f2d['order']=qs[_0x1a00('0x39')](_0x4f9473[_0x1a00('0x31')][_0x1a00('0x39')]);_0x188f2d['where']=qs[_0x1a00('0x33')](_['pick'](_0x4f9473[_0x1a00('0x31')],_0x18ef5b[_0x1a00('0x33')]),_0x451286);if(_0x4f9473[_0x1a00('0x31')]['filter']){_0x188f2d[_0x1a00('0x3a')]=_['merge'](_0x188f2d[_0x1a00('0x3a')],{'$or':_[_0x1a00('0x30')](_0x451286,function(_0x34466f){if(_0x34466f[_0x1a00('0x2d')]!==_0x1a00('0x3b')){var _0x20c62b={};_0x20c62b[_0x34466f[_0x1a00('0x29')]]={'$like':'%'+_0x4f9473['query'][_0x1a00('0x3c')]+'%'};return _0x20c62b;}})});}_0x188f2d=_[_0x1a00('0x3d')]({},_0x188f2d,_0x4f9473[_0x1a00('0x3e')]);var _0x435499={'where':_0x188f2d['where']};return db['SalesforceAccount'][_0x1a00('0x21')](_0x435499)['then'](function(_0x2b96c1){_0x423a9d['count']=_0x2b96c1;if(_0x4f9473['query'][_0x1a00('0x3f')]){_0x188f2d['include']=[{'all':!![]}];}return db[_0x1a00('0x40')][_0x1a00('0x41')](_0x188f2d);})[_0x1a00('0x26')](function(_0x5513d5){_0x423a9d[_0x1a00('0x42')]=_0x5513d5;return _0x423a9d;})[_0x1a00('0x26')](respondWithFilteredResult(_0x31238d,_0x188f2d))[_0x1a00('0x43')](handleError(_0x31238d,null));};exports['show']=function(_0xae1c2f,_0x14b154){var _0x150349={'raw':![],'where':{'id':_0xae1c2f[_0x1a00('0x44')]['id']}},_0x32f60e={};_0x32f60e[_0x1a00('0x2f')]=_[_0x1a00('0x32')](db['SalesforceAccount'][_0x1a00('0x45')]);_0x32f60e[_0x1a00('0x31')]=_[_0x1a00('0x32')](_0xae1c2f[_0x1a00('0x31')]);_0x32f60e['filters']=_[_0x1a00('0x34')](_0x32f60e[_0x1a00('0x2f')],_0x32f60e[_0x1a00('0x31')]);_0x150349['attributes']=_[_0x1a00('0x34')](_0x32f60e['model'],qs[_0x1a00('0x36')](_0xae1c2f['query']['fields']));_0x150349[_0x1a00('0x35')]=_0x150349[_0x1a00('0x35')][_0x1a00('0x37')]?_0x150349['attributes']:_0x32f60e[_0x1a00('0x2f')];if(_0xae1c2f[_0x1a00('0x31')][_0x1a00('0x3f')]){_0x150349[_0x1a00('0x46')]=[{'all':!![]}];}_0x150349=_[_0x1a00('0x3d')]({},_0x150349,_0xae1c2f['options']);return db[_0x1a00('0x40')]['find'](_0x150349)[_0x1a00('0x26')](handleEntityNotFound(_0x14b154,null))[_0x1a00('0x26')](respondWithResult(_0x14b154,null))[_0x1a00('0x43')](handleError(_0x14b154,null));};exports[_0x1a00('0x47')]=function(_0x325853,_0x5ddc61){return db['SalesforceAccount'][_0x1a00('0x47')](_0x325853[_0x1a00('0x48')],{})[_0x1a00('0x26')](respondWithResult(_0x5ddc61,0xc9))[_0x1a00('0x43')](handleError(_0x5ddc61,null));};exports[_0x1a00('0x25')]=function(_0x308a4f,_0x29549e){if(_0x308a4f['body']['id']){delete _0x308a4f[_0x1a00('0x48')]['id'];}return db[_0x1a00('0x40')]['find']({'where':{'id':_0x308a4f[_0x1a00('0x44')]['id']}})[_0x1a00('0x26')](handleEntityNotFound(_0x29549e,null))[_0x1a00('0x26')](saveUpdates(_0x308a4f['body'],null))[_0x1a00('0x26')](respondWithResult(_0x29549e,null))[_0x1a00('0x43')](handleError(_0x29549e,null));};exports[_0x1a00('0x27')]=function(_0x7a1620,_0x2e9158){return db['SalesforceAccount'][_0x1a00('0x49')]({'where':{'id':_0x7a1620[_0x1a00('0x44')]['id']}})[_0x1a00('0x26')](handleEntityNotFound(_0x2e9158,null))[_0x1a00('0x26')](removeEntity(_0x2e9158,null))[_0x1a00('0x43')](handleError(_0x2e9158,null));};exports[_0x1a00('0x4a')]=function(_0x4ec64b,_0xb42332,_0x429508){var _0x3b8312={};var _0x284285={};var _0x57680e;var _0x4afa23;return db[_0x1a00('0x40')][_0x1a00('0x4b')]({'where':{'id':_0x4ec64b[_0x1a00('0x44')]['id']}})[_0x1a00('0x26')](handleEntityNotFound(_0xb42332,null))['then'](function(_0x16a085){if(_0x16a085){_0x57680e=_0x16a085;_0x284285[_0x1a00('0x2f')]=_['keys'](db[_0x1a00('0x4c')]['rawAttributes']);_0x284285[_0x1a00('0x31')]=_[_0x1a00('0x32')](_0x4ec64b[_0x1a00('0x31')]);_0x284285[_0x1a00('0x33')]=_[_0x1a00('0x34')](_0x284285['model'],_0x284285[_0x1a00('0x31')]);_0x3b8312[_0x1a00('0x35')]=_[_0x1a00('0x34')](_0x284285['model'],qs[_0x1a00('0x36')](_0x4ec64b['query'][_0x1a00('0x36')]));_0x3b8312[_0x1a00('0x35')]=_0x3b8312['attributes']['length']?_0x3b8312['attributes']:_0x284285[_0x1a00('0x2f')];_0x3b8312[_0x1a00('0x4d')]=qs['sort'](_0x4ec64b[_0x1a00('0x31')][_0x1a00('0x39')]);_0x3b8312[_0x1a00('0x3a')]=qs[_0x1a00('0x33')](_[_0x1a00('0x4e')](_0x4ec64b[_0x1a00('0x31')],_0x284285[_0x1a00('0x33')]));if(_0x4ec64b[_0x1a00('0x31')][_0x1a00('0x3c')]){_0x3b8312[_0x1a00('0x3a')]=_[_0x1a00('0x3d')](_0x3b8312[_0x1a00('0x3a')],{'$or':_[_0x1a00('0x30')](_0x3b8312['attributes'],function(_0x2be21c){var _0x5213e8={};_0x5213e8[_0x2be21c]={'$like':'%'+_0x4ec64b[_0x1a00('0x31')][_0x1a00('0x3c')]+'%'};return _0x5213e8;})});}_0x3b8312=_[_0x1a00('0x3d')]({},_0x3b8312,_0x4ec64b[_0x1a00('0x3e')]);return _0x57680e[_0x1a00('0x4a')](_0x3b8312);}})[_0x1a00('0x26')](function(_0x37d7f1){if(_0x37d7f1){_0x4afa23=_0x37d7f1[_0x1a00('0x37')];if(!_0x4ec64b[_0x1a00('0x31')]['hasOwnProperty'](_0x1a00('0x38'))){_0x3b8312[_0x1a00('0x20')]=qs[_0x1a00('0x20')](_0x4ec64b[_0x1a00('0x31')][_0x1a00('0x20')]);_0x3b8312[_0x1a00('0x1e')]=qs[_0x1a00('0x1e')](_0x4ec64b[_0x1a00('0x31')][_0x1a00('0x1e')]);}return _0x57680e['getConfigurations'](_0x3b8312);}})['then'](function(_0x3bddb3){if(_0x3bddb3){return _0x3bddb3?{'count':_0x4afa23,'rows':_0x3bddb3}:null;}})['then'](respondWithResult(_0xb42332,null))[_0x1a00('0x43')](handleError(_0xb42332,null));};exports[_0x1a00('0x4f')]=function(_0x28f32f,_0x356f5a,_0x477531){if(_0x28f32f[_0x1a00('0x48')]['id']){delete _0x28f32f[_0x1a00('0x48')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x28f32f['params']['id']}})[_0x1a00('0x26')](handleEntityNotFound(_0x356f5a,null))[_0x1a00('0x26')](function(_0x495b0d){if(_0x495b0d){_0x28f32f['body'][_0x1a00('0x50')]=_0x495b0d['id'];_0x28f32f[_0x1a00('0x48')][_0x1a00('0x51')]=integrations['getSubjects'](_0x28f32f[_0x1a00('0x48')][_0x1a00('0x52')],_0x28f32f[_0x1a00('0x48')][_0x1a00('0x2d')]);_0x28f32f['body']['Descriptions']=integrations[_0x1a00('0x53')](_0x28f32f['body'][_0x1a00('0x52')],_0x28f32f[_0x1a00('0x48')]['type']);return db[_0x1a00('0x4c')][_0x1a00('0x47')](_0x28f32f[_0x1a00('0x48')],{'include':[{'model':db[_0x1a00('0x54')],'as':'Subjects'},{'model':db[_0x1a00('0x54')],'as':_0x1a00('0x55')}]});}return null;})[_0x1a00('0x26')](respondWithResult(_0x356f5a,null))[_0x1a00('0x43')](handleError(_0x356f5a,null));};exports[_0x1a00('0x56')]=function(_0x5db366,_0x209e27,_0x2e1b20){var _0x4c209c;var _0x1d863d='';var _0x366813=_0x1a00('0x57');return db[_0x1a00('0x40')][_0x1a00('0x4b')]({'where':{'id':_0x5db366[_0x1a00('0x44')]['id']},'attributes':['id',_0x1a00('0x58'),_0x1a00('0x59'),_0x1a00('0x5a'),_0x1a00('0x5b'),_0x1a00('0x5c'),_0x1a00('0x5d')]})[_0x1a00('0x26')](handleEntityNotFound(_0x209e27,null))[_0x1a00('0x26')](function(_0x1586d8){if(_0x1586d8){_0x1d863d=_0x1586d8[_0x1a00('0x58')];var _0x38e04c=_0x1d863d[_0x1a00('0x5e')](-0x1);if(_0x38e04c==='/'){_0x1d863d=_0x1d863d['substring'](0x0,_0x1d863d[_0x1a00('0x5f')](_0x38e04c));}_0x4c209c=new jsforce[(_0x1a00('0x60'))]({'oauth2':{'loginUrl':_0x1d863d,'clientId':_0x1586d8[_0x1a00('0x59')],'clientSecret':_0x1586d8[_0x1a00('0x5a')]}});return _0x4c209c[_0x1a00('0x61')](_0x1586d8[_0x1a00('0x5b')],_0x1586d8['password'][_0x1a00('0x62')](_0x1586d8['securityToken']));}})[_0x1a00('0x26')](function(_0x35053f){if(_0x35053f){if(!_[_0x1a00('0x63')](_0x5db366[_0x1a00('0x31')][_0x1a00('0x64')])){_0x366813=_0x5db366[_0x1a00('0x31')][_0x1a00('0x64')];}return _0x4c209c[_0x1a00('0x65')](_0x366813)[_0x1a00('0x66')]();}})[_0x1a00('0x26')](function(_0x53c821){var _0x20a507=[_0x1a00('0x67'),_0x1a00('0x68'),_0x1a00('0x69'),_0x1a00('0x6a'),_0x1a00('0x6b'),'Description'];var _0x2bda42=[_0x1a00('0x6c'),_0x1a00('0x6d'),_0x1a00('0x6e'),_0x1a00('0x6f'),_0x1a00('0x70'),'textarea',_0x1a00('0x71')];if(_0x53c821){_[_0x1a00('0x72')](_0x53c821[_0x1a00('0x36')],function(_0x456c84){return _0x20a507['includes'](_0x456c84[_0x1a00('0x29')])||!_0x2bda42[_0x1a00('0x73')](_0x456c84['type']);});return{'count':_0x53c821['fields'][_0x1a00('0x37')],'rows':_['map'](_0x53c821[_0x1a00('0x36')],function(_0x44241e){return{'id':_0x44241e[_0x1a00('0x29')],'name':_0x44241e[_0x1a00('0x74')],'custom':_0x44241e[_0x1a00('0x75')],'options':_0x44241e[_0x1a00('0x76')][_0x1a00('0x37')]>0x0?_[_0x1a00('0x30')](_0x44241e[_0x1a00('0x76')],function(_0x411527){return{'name':_0x411527[_0x1a00('0x74')],'value':_0x411527[_0x1a00('0x77')]};}):_0x44241e['type']==_0x1a00('0x6f')?[{'name':_0x1a00('0x78'),'value':_0x1a00('0x79')},{'name':_0x1a00('0x7a'),'value':_0x1a00('0x7b')}]:[]};})};}})[_0x1a00('0x26')](respondWithResult(_0x209e27,null))[_0x1a00('0x43')](function(_0x40099a){var _0x1998fa=_0x5db366[_0x1a00('0x31')][_0x1a00('0x7c')]?0x1f4:_0x40099a[_0x1a00('0x7d')]||0x1f4;logger[_0x1a00('0x28')](_0x1a00('0x7e'),_0x1a00('0x56'),_0x1998fa,JSON[_0x1a00('0x7f')](_0x40099a));delete _0x40099a['name'];if(_0x1998fa===0x191){_0x1998fa=0x190;}_0x209e27['status'](_0x1998fa)[_0x1a00('0x2a')](_0x5db366[_0x1a00('0x31')][_0x1a00('0x7c')]?{'message':_0x1a00('0x80'),'statusCode':_0x40099a[_0x1a00('0x7d')]}:_0x40099a);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 80fac35..7a657a3 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 _0x82a2=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','int_salesforce_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x56a2d1,_0x18d80b){var _0x304a31=function(_0x7c9aef){while(--_0x7c9aef){_0x56a2d1['push'](_0x56a2d1['shift']());}};_0x304a31(++_0x18d80b);}(_0x82a2,0x17a));var _0x282a=function(_0x355717,_0x580e89){_0x355717=_0x355717-0x0;var _0x497c35=_0x82a2[_0x355717];return _0x497c35;};'use strict';var _=require(_0x282a('0x0'));var util=require('util');var logger=require(_0x282a('0x1'))(_0x282a('0x2'));var moment=require(_0x282a('0x3'));var BPromise=require(_0x282a('0x4'));var rp=require(_0x282a('0x5'));var fs=require('fs');var path=require(_0x282a('0x6'));var rimraf=require(_0x282a('0x7'));var config=require(_0x282a('0x8'));var attributes=require(_0x282a('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x282a('0xa')]=function(_0x4bf75f,_0x7bc1b5){return _0x4bf75f['define']('SalesforceAccount',attributes,{'tableName':_0x282a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17bd=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x174fc1,_0x384973){var _0x41b79a=function(_0xc99c32){while(--_0xc99c32){_0x174fc1['push'](_0x174fc1['shift']());}};_0x41b79a(++_0x384973);}(_0x17bd,0xfb));var _0xd17b=function(_0x3a9537,_0x5b4246){_0x3a9537=_0x3a9537-0x0;var _0x690e3c=_0x17bd[_0x3a9537];return _0x690e3c;};'use strict';var _=require(_0xd17b('0x0'));var util=require(_0xd17b('0x1'));var logger=require(_0xd17b('0x2'))('api');var moment=require(_0xd17b('0x3'));var BPromise=require(_0xd17b('0x4'));var rp=require(_0xd17b('0x5'));var fs=require('fs');var path=require(_0xd17b('0x6'));var rimraf=require(_0xd17b('0x7'));var config=require(_0xd17b('0x8'));var attributes=require(_0xd17b('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xd17b('0xa')]=function(_0x219a19,_0x347c89){return _0x219a19[_0xd17b('0xb')](_0xd17b('0xc'),attributes,{'tableName':_0xd17b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 780439e..d0b1412 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 _0x4bcf=['options','raw','where','limit','include','model','map','attributes','GetSalesforceAccount','ShowSalesforceAccount','find','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','SalesforceAccount'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0x4bcf,0x177));var _0xf4bc=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0x4bcf[_0x1b95a1];return _0x57aef1;};'use strict';var _=require(_0xf4bc('0x0'));var util=require(_0xf4bc('0x1'));var moment=require('moment');var BPromise=require(_0xf4bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4bc('0x3'));var db=require(_0xf4bc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf4bc('0x5'));var jayson=require(_0xf4bc('0x6'));var client=jayson[_0xf4bc('0x7')][_0xf4bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f871f,_0x144b88,_0x5669c2){return new BPromise(function(_0x3e2159,_0xd1c2f0){return client[_0xf4bc('0x9')](_0x2f871f,_0x5669c2)[_0xf4bc('0xa')](function(_0x174884){logger['info'](_0xf4bc('0xb'),_0x144b88,_0xf4bc('0xc'));logger[_0xf4bc('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x144b88,_0xf4bc('0xc'),JSON[_0xf4bc('0xe')](_0x174884));if(_0x174884['error']){if(_0x174884['error'][_0xf4bc('0xf')]===0x1f4){logger[_0xf4bc('0x10')](_0xf4bc('0xb'),_0x144b88,_0x174884['error']['message']);return _0xd1c2f0(_0x174884['error'][_0xf4bc('0x11')]);}logger[_0xf4bc('0x10')](_0xf4bc('0xb'),_0x144b88,_0x174884['error']['message']);return _0x3e2159(_0x174884[_0xf4bc('0x10')]['message']);}else{logger[_0xf4bc('0x12')](_0xf4bc('0xb'),_0x144b88,_0xf4bc('0xc'));_0x3e2159(_0x174884[_0xf4bc('0x13')][_0xf4bc('0x11')]);}})['catch'](function(_0x562ed5){logger[_0xf4bc('0x10')](_0xf4bc('0xb'),_0x144b88,_0x562ed5);_0xd1c2f0(_0x562ed5);});});}exports['GetSalesforceAccount']=function(_0x7b2e6a){var _0x5a44ab=this;return new Promise(function(_0x3b8eb1,_0x339209){return db[_0xf4bc('0x14')]['findAll']({'raw':_0x7b2e6a[_0xf4bc('0x15')]?_0x7b2e6a['options'][_0xf4bc('0x16')]===undefined?!![]:![]:!![],'where':_0x7b2e6a[_0xf4bc('0x15')]?_0x7b2e6a[_0xf4bc('0x15')][_0xf4bc('0x17')]||null:null,'attributes':_0x7b2e6a['options']?_0x7b2e6a[_0xf4bc('0x15')]['attributes']||null:null,'limit':_0x7b2e6a['options']?_0x7b2e6a['options'][_0xf4bc('0x18')]||null:null,'include':_0x7b2e6a[_0xf4bc('0x15')]?_0x7b2e6a[_0xf4bc('0x15')][_0xf4bc('0x19')]?_['map'](_0x7b2e6a[_0xf4bc('0x15')][_0xf4bc('0x19')],function(_0x5c13cd){return{'model':db[_0x5c13cd[_0xf4bc('0x1a')]],'as':_0x5c13cd['as'],'attributes':_0x5c13cd['attributes'],'include':_0x5c13cd[_0xf4bc('0x19')]?_[_0xf4bc('0x1b')](_0x5c13cd['include'],function(_0x31b409){return{'model':db[_0x31b409[_0xf4bc('0x1a')]],'as':_0x31b409['as'],'attributes':_0x31b409[_0xf4bc('0x1c')],'include':_0x31b409[_0xf4bc('0x19')]?_[_0xf4bc('0x1b')](_0x31b409['include'],function(_0x22e9b2){return{'model':db[_0x22e9b2[_0xf4bc('0x1a')]],'as':_0x22e9b2['as'],'attributes':_0x22e9b2[_0xf4bc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf4bc('0xa')](function(_0x1fcd40){logger['info'](_0xf4bc('0x1d'),_0x7b2e6a);logger[_0xf4bc('0xd')]('GetSalesforceAccount',_0x7b2e6a,JSON['stringify'](_0x1fcd40));_0x3b8eb1(_0x1fcd40);})['catch'](function(_0x25eff6){logger[_0xf4bc('0x10')](_0xf4bc('0x1d'),_0x25eff6[_0xf4bc('0x11')],_0x7b2e6a);_0x339209(_0x5a44ab[_0xf4bc('0x10')](0x1f4,_0x25eff6[_0xf4bc('0x11')]));});});};exports[_0xf4bc('0x1e')]=function(_0x16c5d9){var _0x516b97=this;return new Promise(function(_0xa688c6,_0x335129){return db['SalesforceAccount'][_0xf4bc('0x1f')]({'raw':_0x16c5d9[_0xf4bc('0x15')]?_0x16c5d9[_0xf4bc('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x16c5d9[_0xf4bc('0x15')]?_0x16c5d9[_0xf4bc('0x15')][_0xf4bc('0x17')]||null:null,'attributes':_0x16c5d9[_0xf4bc('0x15')]?_0x16c5d9[_0xf4bc('0x15')][_0xf4bc('0x1c')]||null:null,'include':_0x16c5d9[_0xf4bc('0x15')]?_0x16c5d9[_0xf4bc('0x15')]['include']?_['map'](_0x16c5d9[_0xf4bc('0x15')]['include'],function(_0x295326){return{'model':db[_0x295326[_0xf4bc('0x1a')]],'as':_0x295326['as'],'attributes':_0x295326[_0xf4bc('0x1c')],'include':_0x295326[_0xf4bc('0x19')]?_[_0xf4bc('0x1b')](_0x295326[_0xf4bc('0x19')],function(_0x525ceb){return{'model':db[_0x525ceb[_0xf4bc('0x1a')]],'as':_0x525ceb['as'],'attributes':_0x525ceb[_0xf4bc('0x1c')],'include':_0x525ceb[_0xf4bc('0x19')]?_[_0xf4bc('0x1b')](_0x525ceb[_0xf4bc('0x19')],function(_0x1cc581){return{'model':db[_0x1cc581[_0xf4bc('0x1a')]],'as':_0x1cc581['as'],'attributes':_0x1cc581[_0xf4bc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf4bc('0xa')](function(_0x481fcd){logger[_0xf4bc('0x12')]('ShowSalesforceAccount',_0x16c5d9);logger['debug'](_0xf4bc('0x1e'),_0x16c5d9,JSON[_0xf4bc('0xe')](_0x481fcd));_0xa688c6(_0x481fcd);})[_0xf4bc('0x20')](function(_0x29e27e){logger[_0xf4bc('0x10')](_0xf4bc('0x1e'),_0x29e27e[_0xf4bc('0x11')],_0x16c5d9);_0x335129(_0x516b97['error'](0x1f4,_0x29e27e[_0xf4bc('0x11')]));});});}; \ No newline at end of file +var _0xf30c=['client','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SalesforceAccount','findAll','options','raw','attributes','include','map','model','GetSalesforceAccount','ShowSalesforceAccount','find','then','info','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xf6e75d,_0xc70967){var _0x27514d=function(_0xc2c6dd){while(--_0xc2c6dd){_0xf6e75d['push'](_0xf6e75d['shift']());}};_0x27514d(++_0xc70967);}(_0xf30c,0x1e1));var _0xcf30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf30c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcf30('0x0'));var moment=require(_0xcf30('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf30('0x2'));var db=require(_0xcf30('0x3'))['db'];var utils=require(_0xcf30('0x4'));var logger=require(_0xcf30('0x5'))(_0xcf30('0x6'));var config=require(_0xcf30('0x7'));var jayson=require(_0xcf30('0x8'));var client=jayson[_0xcf30('0x9')][_0xcf30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14f64c,_0x294f83,_0xbb7df4){return new BPromise(function(_0x2e97f8,_0x51445a){return client[_0xcf30('0xb')](_0x14f64c,_0xbb7df4)['then'](function(_0x12b6a0){logger['info'](_0xcf30('0xc'),_0x294f83,_0xcf30('0xd'));logger[_0xcf30('0xe')](_0xcf30('0xf'),_0x294f83,_0xcf30('0xd'),JSON[_0xcf30('0x10')](_0x12b6a0));if(_0x12b6a0[_0xcf30('0x11')]){if(_0x12b6a0['error'][_0xcf30('0x12')]===0x1f4){logger[_0xcf30('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x294f83,_0x12b6a0[_0xcf30('0x11')][_0xcf30('0x13')]);return _0x51445a(_0x12b6a0[_0xcf30('0x11')]['message']);}logger[_0xcf30('0x11')](_0xcf30('0xc'),_0x294f83,_0x12b6a0[_0xcf30('0x11')][_0xcf30('0x13')]);return _0x2e97f8(_0x12b6a0['error'][_0xcf30('0x13')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x294f83,_0xcf30('0xd'));_0x2e97f8(_0x12b6a0[_0xcf30('0x14')]['message']);}})[_0xcf30('0x15')](function(_0x551239){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x294f83,_0x551239);_0x51445a(_0x551239);});});}exports['GetSalesforceAccount']=function(_0x2d96cb){var _0x3da8dc=this;return new Promise(function(_0x4f97e6,_0x2848d7){return db[_0xcf30('0x16')][_0xcf30('0x17')]({'raw':_0x2d96cb[_0xcf30('0x18')]?_0x2d96cb[_0xcf30('0x18')][_0xcf30('0x19')]===undefined?!![]:![]:!![],'where':_0x2d96cb[_0xcf30('0x18')]?_0x2d96cb[_0xcf30('0x18')]['where']||null:null,'attributes':_0x2d96cb[_0xcf30('0x18')]?_0x2d96cb[_0xcf30('0x18')][_0xcf30('0x1a')]||null:null,'limit':_0x2d96cb[_0xcf30('0x18')]?_0x2d96cb[_0xcf30('0x18')]['limit']||null:null,'include':_0x2d96cb[_0xcf30('0x18')]?_0x2d96cb[_0xcf30('0x18')][_0xcf30('0x1b')]?_[_0xcf30('0x1c')](_0x2d96cb[_0xcf30('0x18')][_0xcf30('0x1b')],function(_0xb4e1dd){return{'model':db[_0xb4e1dd['model']],'as':_0xb4e1dd['as'],'attributes':_0xb4e1dd[_0xcf30('0x1a')],'include':_0xb4e1dd[_0xcf30('0x1b')]?_[_0xcf30('0x1c')](_0xb4e1dd[_0xcf30('0x1b')],function(_0xac2191){return{'model':db[_0xac2191[_0xcf30('0x1d')]],'as':_0xac2191['as'],'attributes':_0xac2191['attributes'],'include':_0xac2191[_0xcf30('0x1b')]?_[_0xcf30('0x1c')](_0xac2191['include'],function(_0x51a927){return{'model':db[_0x51a927[_0xcf30('0x1d')]],'as':_0x51a927['as'],'attributes':_0x51a927[_0xcf30('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33bfaa){logger['info'](_0xcf30('0x1e'),_0x2d96cb);logger[_0xcf30('0xe')]('GetSalesforceAccount',_0x2d96cb,JSON[_0xcf30('0x10')](_0x33bfaa));_0x4f97e6(_0x33bfaa);})['catch'](function(_0x199dc1){logger['error'](_0xcf30('0x1e'),_0x199dc1[_0xcf30('0x13')],_0x2d96cb);_0x2848d7(_0x3da8dc['error'](0x1f4,_0x199dc1[_0xcf30('0x13')]));});});};exports[_0xcf30('0x1f')]=function(_0x320501){var _0x6897f=this;return new Promise(function(_0x38a424,_0x579c29){return db[_0xcf30('0x16')][_0xcf30('0x20')]({'raw':_0x320501['options']?_0x320501[_0xcf30('0x18')][_0xcf30('0x19')]===undefined?!![]:![]:!![],'where':_0x320501[_0xcf30('0x18')]?_0x320501[_0xcf30('0x18')]['where']||null:null,'attributes':_0x320501[_0xcf30('0x18')]?_0x320501[_0xcf30('0x18')]['attributes']||null:null,'include':_0x320501[_0xcf30('0x18')]?_0x320501[_0xcf30('0x18')][_0xcf30('0x1b')]?_[_0xcf30('0x1c')](_0x320501[_0xcf30('0x18')][_0xcf30('0x1b')],function(_0x2e881d){return{'model':db[_0x2e881d[_0xcf30('0x1d')]],'as':_0x2e881d['as'],'attributes':_0x2e881d[_0xcf30('0x1a')],'include':_0x2e881d[_0xcf30('0x1b')]?_[_0xcf30('0x1c')](_0x2e881d[_0xcf30('0x1b')],function(_0x332995){return{'model':db[_0x332995[_0xcf30('0x1d')]],'as':_0x332995['as'],'attributes':_0x332995[_0xcf30('0x1a')],'include':_0x332995[_0xcf30('0x1b')]?_[_0xcf30('0x1c')](_0x332995[_0xcf30('0x1b')],function(_0x1ab36a){return{'model':db[_0x1ab36a[_0xcf30('0x1d')]],'as':_0x1ab36a['as'],'attributes':_0x1ab36a[_0xcf30('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcf30('0x21')](function(_0x387648){logger[_0xcf30('0x22')](_0xcf30('0x1f'),_0x320501);logger[_0xcf30('0xe')]('ShowSalesforceAccount',_0x320501,JSON[_0xcf30('0x10')](_0x387648));_0x38a424(_0x387648);})[_0xcf30('0x15')](function(_0x11c95a){logger[_0xcf30('0x11')](_0xcf30('0x1f'),_0x11c95a[_0xcf30('0x13')],_0x320501);_0x579c29(_0x6897f[_0xcf30('0x11')](0x1f4,_0x11c95a[_0xcf30('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6b16370..ba38ab9 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(_0x5f0dda,_0x534db9){var _0x587384=function(_0x513209){while(--_0x513209){_0x5f0dda['push'](_0x5f0dda['shift']());}};_0x587384(++_0x534db9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x2e6a97,_0x4ef907){var _0x10e89d=function(_0x2f5d8a){while(--_0x2f5d8a){_0x2e6a97['push'](_0x2e6a97['shift']());}};_0x10e89d(++_0x4ef907);}(_0x2ef3,0xba));var _0x32ef=function(_0x3717b9,_0x4e0697){_0x3717b9=_0x3717b9-0x0;var _0x4b76e4=_0x2ef3[_0x3717b9];return _0x4b76e4;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 0d330c7..7a27c90 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 _0x905b=['nothing','contact','account','sequelize','exports','STRING','Case','Task','ENUM','contact_lead','lead','account_contact_lead'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x905b,0x87));var _0xb905=function(_0x440476,_0x35b041){_0x440476=_0x440476-0x0;var _0x346dff=_0x905b[_0x440476];return _0x346dff;};'use strict';var Sequelize=require(_0xb905('0x0'));module[_0xb905('0x1')]={'name':{'type':Sequelize[_0xb905('0x2')]},'description':{'type':Sequelize[_0xb905('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0xb905('0x3')),'defaultValue':_0xb905('0x4')},'moduleSearch':{'type':Sequelize[_0xb905('0x5')](_0xb905('0x6'),'contact',_0xb905('0x7'),_0xb905('0x8'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0xb905('0x9'),_0xb905('0xa'),_0xb905('0x7'),_0xb905('0xb')),'defaultValue':_0xb905('0x7')},'leadId':{'type':Sequelize[_0xb905('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xb905('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xb905('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdbfe=['STRING','ENUM','Task','contact_lead','contact','account_contact_lead','account','lead'];(function(_0x1ebeea,_0x2f54f4){var _0x576465=function(_0x47fc77){while(--_0x47fc77){_0x1ebeea['push'](_0x1ebeea['shift']());}};_0x576465(++_0x2f54f4);}(_0xdbfe,0x1b0));var _0xedbf=function(_0x38097f,_0x21e04d){_0x38097f=_0x38097f-0x0;var _0x5cb7dc=_0xdbfe[_0x38097f];return _0x5cb7dc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xedbf('0x0')]},'description':{'type':Sequelize[_0xedbf('0x0')]},'ticketType':{'type':Sequelize[_0xedbf('0x1')](_0xedbf('0x2'),'Case'),'defaultValue':_0xedbf('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0xedbf('0x3'),_0xedbf('0x4'),'lead',_0xedbf('0x5'),_0xedbf('0x6')),'defaultValue':_0xedbf('0x3')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0xedbf('0x4'),_0xedbf('0x7'),_0xedbf('0x6')),'defaultValue':_0xedbf('0x7')},'leadId':{'type':Sequelize[_0xedbf('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0xedbf('0x0')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xedbf('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 72934fa..8ab77e2 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 _0x090a=['sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','create','update','body','getFields','findOne','SalesforceField','options','getSubjects','hasOwnProperty','getDescriptions','rimraf','zip-dir','moment','bluebird','mustache','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x090a,0xf3));var _0xa090=function(_0x1c2ffa,_0xf54977){_0x1c2ffa=_0x1c2ffa-0x0;var _0x5c05a5=_0x090a[_0x1c2ffa];return _0x5c05a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa090('0x0'));var zipdir=require(_0xa090('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa090('0x2'));var BPromise=require(_0xa090('0x3'));var Mustache=require(_0xa090('0x4'));var util=require('util');var path=require(_0xa090('0x5'));var sox=require(_0xa090('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa090('0x7'));var _=require(_0xa090('0x8'));var squel=require(_0xa090('0x9'));var crypto=require(_0xa090('0xa'));var jsforce=require(_0xa090('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa090('0xc'));var querystring=require(_0xa090('0xd'));var Papa=require(_0xa090('0xe'));var Redis=require(_0xa090('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa090('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa090('0x11'));var logger=require(_0xa090('0x12'))(_0xa090('0x13'));var utils=require(_0xa090('0x14'));var config=require(_0xa090('0x15'));var licenseUtil=require(_0xa090('0x16'));var db=require(_0xa090('0x17'))['db'];function respondWithStatusCode(_0x3badbb,_0x583c01){_0x583c01=_0x583c01||0xcc;return function(_0x587b02){if(_0x587b02){return _0x3badbb[_0xa090('0x18')](_0x583c01);}return _0x3badbb[_0xa090('0x19')](_0x583c01)[_0xa090('0x1a')]();};}function respondWithResult(_0x35798e,_0x37ad8d){_0x37ad8d=_0x37ad8d||0xc8;return function(_0x31d268){if(_0x31d268){return _0x35798e[_0xa090('0x19')](_0x37ad8d)[_0xa090('0x1b')](_0x31d268);}};}function respondWithFilteredResult(_0xeaab9e,_0x54eb2b){return function(_0xc5fdf2){if(_0xc5fdf2){var _0x248d18=typeof _0x54eb2b[_0xa090('0x1c')]===_0xa090('0x1d')&&typeof _0x54eb2b[_0xa090('0x1e')]===_0xa090('0x1d');var _0x3ca9e8=_0xc5fdf2[_0xa090('0x1f')];var _0xb6a589=_0x248d18?0x0:_0x54eb2b[_0xa090('0x1c')];var _0x1ffb5b=_0x248d18?_0xc5fdf2[_0xa090('0x1f')]:_0x54eb2b[_0xa090('0x1c')]+_0x54eb2b['limit'];var _0x2f22ec;if(_0x1ffb5b>=_0x3ca9e8){_0x1ffb5b=_0x3ca9e8;_0x2f22ec=0xc8;}else{_0x2f22ec=0xce;}_0xeaab9e[_0xa090('0x19')](_0x2f22ec);return _0xeaab9e[_0xa090('0x20')](_0xa090('0x21'),_0xb6a589+'-'+_0x1ffb5b+'/'+_0x3ca9e8)[_0xa090('0x1b')](_0xc5fdf2);}return null;};}function patchUpdates(_0x5c883d){return function(_0x514c41){try{jsonpatch[_0xa090('0x22')](_0x514c41,_0x5c883d,!![]);}catch(_0x3cceb5){return BPromise[_0xa090('0x23')](_0x3cceb5);}return _0x514c41[_0xa090('0x24')]();};}function saveUpdates(_0x4529b2,_0x51acba){return function(_0x5bbb4e){if(_0x5bbb4e){return _0x5bbb4e['update'](_0x4529b2)[_0xa090('0x25')](function(_0x28bc77){return _0x28bc77;});}return null;};}function removeEntity(_0x3b96b3,_0x1d9c63){return function(_0x5f0278){if(_0x5f0278){return _0x5f0278[_0xa090('0x26')]()[_0xa090('0x25')](function(){_0x3b96b3[_0xa090('0x19')](0xcc)[_0xa090('0x1a')]();});}};}function handleEntityNotFound(_0x3687f4,_0x12d8f7){return function(_0x10c020){if(!_0x10c020){_0x3687f4[_0xa090('0x18')](0x194);}return _0x10c020;};}function handleError(_0x597b7a,_0x1e4680){_0x1e4680=_0x1e4680||0x1f4;return function(_0x128a5b){logger[_0xa090('0x27')](_0x128a5b[_0xa090('0x28')]);if(_0x128a5b[_0xa090('0x29')]){delete _0x128a5b['name'];}_0x597b7a[_0xa090('0x19')](_0x1e4680)[_0xa090('0x2a')](_0x128a5b);};}exports[_0xa090('0x2b')]=function(_0x58e4a6,_0xbd9c5c){var _0x567381={},_0x5255ca={},_0x552ead={'count':0x0,'rows':[]};var _0x3c659e=_[_0xa090('0x2c')](db[_0xa090('0x2d')][_0xa090('0x2e')],function(_0x4210a2){return{'name':_0x4210a2[_0xa090('0x2f')],'type':_0x4210a2[_0xa090('0x30')]['key']};});_0x5255ca['model']=_[_0xa090('0x2c')](_0x3c659e,_0xa090('0x29'));_0x5255ca[_0xa090('0x31')]=_[_0xa090('0x32')](_0x58e4a6[_0xa090('0x31')]);_0x5255ca[_0xa090('0x33')]=_['intersection'](_0x5255ca[_0xa090('0x34')],_0x5255ca[_0xa090('0x31')]);_0x567381[_0xa090('0x35')]=_[_0xa090('0x36')](_0x5255ca['model'],qs['fields'](_0x58e4a6['query'][_0xa090('0x37')]));_0x567381[_0xa090('0x35')]=_0x567381['attributes']['length']?_0x567381[_0xa090('0x35')]:_0x5255ca['model'];if(!_0x58e4a6[_0xa090('0x31')]['hasOwnProperty'](_0xa090('0x38'))){_0x567381['limit']=qs[_0xa090('0x1e')](_0x58e4a6[_0xa090('0x31')][_0xa090('0x1e')]);_0x567381[_0xa090('0x1c')]=qs['offset'](_0x58e4a6[_0xa090('0x31')][_0xa090('0x1c')]);}_0x567381[_0xa090('0x39')]=qs[_0xa090('0x3a')](_0x58e4a6['query'][_0xa090('0x3a')]);_0x567381[_0xa090('0x3b')]=qs[_0xa090('0x33')](_[_0xa090('0x3c')](_0x58e4a6[_0xa090('0x31')],_0x5255ca['filters']),_0x3c659e);if(_0x58e4a6['query'][_0xa090('0x3d')]){_0x567381[_0xa090('0x3b')]=_[_0xa090('0x3e')](_0x567381[_0xa090('0x3b')],{'$or':_[_0xa090('0x2c')](_0x3c659e,function(_0x438d8e){if(_0x438d8e[_0xa090('0x30')]!==_0xa090('0x3f')){var _0x47a587={};_0x47a587[_0x438d8e[_0xa090('0x29')]]={'$like':'%'+_0x58e4a6['query'][_0xa090('0x3d')]+'%'};return _0x47a587;}})});}_0x567381=_[_0xa090('0x3e')]({},_0x567381,_0x58e4a6['options']);var _0x3d5a93={'where':_0x567381['where']};return db[_0xa090('0x2d')][_0xa090('0x1f')](_0x3d5a93)['then'](function(_0x372944){_0x552ead[_0xa090('0x1f')]=_0x372944;if(_0x58e4a6[_0xa090('0x31')][_0xa090('0x40')]){_0x567381[_0xa090('0x41')]=[{'all':!![]}];}return db[_0xa090('0x2d')][_0xa090('0x42')](_0x567381);})['then'](function(_0x12ec14){_0x552ead[_0xa090('0x43')]=_0x12ec14;return _0x552ead;})[_0xa090('0x25')](respondWithFilteredResult(_0xbd9c5c,_0x567381))[_0xa090('0x44')](handleError(_0xbd9c5c,null));};exports[_0xa090('0x45')]=function(_0x2e923e,_0xbe9aa4){var _0x22bd8b={'raw':![],'where':{'id':_0x2e923e[_0xa090('0x46')]['id']}},_0x550e93={};_0x550e93['model']=_[_0xa090('0x32')](db[_0xa090('0x2d')]['rawAttributes']);_0x550e93[_0xa090('0x31')]=_[_0xa090('0x32')](_0x2e923e['query']);_0x550e93[_0xa090('0x33')]=_[_0xa090('0x36')](_0x550e93[_0xa090('0x34')],_0x550e93[_0xa090('0x31')]);_0x22bd8b[_0xa090('0x35')]=_['intersection'](_0x550e93[_0xa090('0x34')],qs['fields'](_0x2e923e[_0xa090('0x31')][_0xa090('0x37')]));_0x22bd8b[_0xa090('0x35')]=_0x22bd8b[_0xa090('0x35')][_0xa090('0x47')]?_0x22bd8b[_0xa090('0x35')]:_0x550e93[_0xa090('0x34')];if(_0x2e923e['query'][_0xa090('0x40')]){_0x22bd8b['include']=[{'all':!![]}];}_0x22bd8b=_[_0xa090('0x3e')]({},_0x22bd8b,_0x2e923e['options']);return db[_0xa090('0x2d')][_0xa090('0x48')](_0x22bd8b)[_0xa090('0x25')](handleEntityNotFound(_0xbe9aa4,null))[_0xa090('0x25')](respondWithResult(_0xbe9aa4,null))[_0xa090('0x44')](handleError(_0xbe9aa4,null));};exports[_0xa090('0x49')]=function(_0x1c9207,_0x48321c){return db[_0xa090('0x2d')][_0xa090('0x49')](_0x1c9207['body'],{})[_0xa090('0x25')](respondWithResult(_0x48321c,0xc9))['catch'](handleError(_0x48321c,null));};exports[_0xa090('0x4a')]=function(_0x272f49,_0x128482){if(_0x272f49[_0xa090('0x4b')]['id']){delete _0x272f49[_0xa090('0x4b')]['id'];}return db[_0xa090('0x2d')][_0xa090('0x48')]({'where':{'id':_0x272f49[_0xa090('0x46')]['id']}})['then'](handleEntityNotFound(_0x128482,null))['then'](saveUpdates(_0x272f49[_0xa090('0x4b')],null))[_0xa090('0x25')](respondWithResult(_0x128482,null))[_0xa090('0x44')](handleError(_0x128482,null));};exports['destroy']=function(_0x128d69,_0x57103b){return db[_0xa090('0x2d')][_0xa090('0x48')]({'where':{'id':_0x128d69[_0xa090('0x46')]['id']}})['then'](handleEntityNotFound(_0x57103b,null))[_0xa090('0x25')](removeEntity(_0x57103b,null))[_0xa090('0x44')](handleError(_0x57103b,null));};exports[_0xa090('0x4c')]=function(_0x5c17a5,_0x37c9e9,_0x32e7e8){var _0x15eb0b={};var _0x4b1b3a={};var _0x11dc93;var _0x40c8c1;return db[_0xa090('0x2d')][_0xa090('0x4d')]({'where':{'id':_0x5c17a5[_0xa090('0x46')]['id']}})['then'](handleEntityNotFound(_0x37c9e9,null))[_0xa090('0x25')](function(_0x4058d3){if(_0x4058d3){_0x11dc93=_0x4058d3;_0x4b1b3a['model']=_['keys'](db[_0xa090('0x4e')][_0xa090('0x2e')]);_0x4b1b3a[_0xa090('0x31')]=_['keys'](_0x5c17a5['query']);_0x4b1b3a['filters']=_[_0xa090('0x36')](_0x4b1b3a[_0xa090('0x34')],_0x4b1b3a['query']);_0x15eb0b[_0xa090('0x35')]=_[_0xa090('0x36')](_0x4b1b3a['model'],qs[_0xa090('0x37')](_0x5c17a5[_0xa090('0x31')]['fields']));_0x15eb0b[_0xa090('0x35')]=_0x15eb0b[_0xa090('0x35')][_0xa090('0x47')]?_0x15eb0b[_0xa090('0x35')]:_0x4b1b3a['model'];_0x15eb0b[_0xa090('0x39')]=qs[_0xa090('0x3a')](_0x5c17a5['query']['sort']);_0x15eb0b['where']=qs['filters'](_[_0xa090('0x3c')](_0x5c17a5[_0xa090('0x31')],_0x4b1b3a[_0xa090('0x33')]));if(_0x5c17a5[_0xa090('0x31')]['filter']){_0x15eb0b[_0xa090('0x3b')]=_[_0xa090('0x3e')](_0x15eb0b[_0xa090('0x3b')],{'$or':_[_0xa090('0x2c')](_0x15eb0b[_0xa090('0x35')],function(_0x22c889){var _0x266047={};_0x266047[_0x22c889]={'$like':'%'+_0x5c17a5[_0xa090('0x31')][_0xa090('0x3d')]+'%'};return _0x266047;})});}_0x15eb0b=_[_0xa090('0x3e')]({},_0x15eb0b,_0x5c17a5[_0xa090('0x4f')]);return _0x11dc93['getFields'](_0x15eb0b);}})['then'](function(_0x38db19){if(_0x38db19){_0x40c8c1=_0x38db19[_0xa090('0x47')];if(!_0x5c17a5[_0xa090('0x31')]['hasOwnProperty'](_0xa090('0x38'))){_0x15eb0b[_0xa090('0x1e')]=qs[_0xa090('0x1e')](_0x5c17a5[_0xa090('0x31')][_0xa090('0x1e')]);_0x15eb0b[_0xa090('0x1c')]=qs[_0xa090('0x1c')](_0x5c17a5[_0xa090('0x31')]['offset']);}return _0x11dc93[_0xa090('0x4c')](_0x15eb0b);}})[_0xa090('0x25')](function(_0x5563b5){if(_0x5563b5){return _0x5563b5?{'count':_0x40c8c1,'rows':_0x5563b5}:null;}})[_0xa090('0x25')](respondWithResult(_0x37c9e9,null))[_0xa090('0x44')](handleError(_0x37c9e9,null));};exports[_0xa090('0x50')]=function(_0x1f67bb,_0x125396,_0x355d0a){var _0x1de8d6={};var _0x4fa07f={};var _0x39eb61;var _0x99222f;return db[_0xa090('0x2d')][_0xa090('0x4d')]({'where':{'id':_0x1f67bb[_0xa090('0x46')]['id']}})[_0xa090('0x25')](handleEntityNotFound(_0x125396,null))[_0xa090('0x25')](function(_0x72f71d){if(_0x72f71d){_0x39eb61=_0x72f71d;_0x4fa07f['model']=_[_0xa090('0x32')](db[_0xa090('0x4e')]['rawAttributes']);_0x4fa07f['query']=_[_0xa090('0x32')](_0x1f67bb[_0xa090('0x31')]);_0x4fa07f[_0xa090('0x33')]=_['intersection'](_0x4fa07f[_0xa090('0x34')],_0x4fa07f['query']);_0x1de8d6[_0xa090('0x35')]=_[_0xa090('0x36')](_0x4fa07f[_0xa090('0x34')],qs[_0xa090('0x37')](_0x1f67bb['query'][_0xa090('0x37')]));_0x1de8d6[_0xa090('0x35')]=_0x1de8d6[_0xa090('0x35')][_0xa090('0x47')]?_0x1de8d6['attributes']:_0x4fa07f['model'];_0x1de8d6['order']=qs[_0xa090('0x3a')](_0x1f67bb[_0xa090('0x31')][_0xa090('0x3a')]);_0x1de8d6[_0xa090('0x3b')]=qs['filters'](_[_0xa090('0x3c')](_0x1f67bb[_0xa090('0x31')],_0x4fa07f[_0xa090('0x33')]));if(_0x1f67bb['query']['filter']){_0x1de8d6[_0xa090('0x3b')]=_[_0xa090('0x3e')](_0x1de8d6[_0xa090('0x3b')],{'$or':_[_0xa090('0x2c')](_0x1de8d6[_0xa090('0x35')],function(_0x532650){var _0x385480={};_0x385480[_0x532650]={'$like':'%'+_0x1f67bb[_0xa090('0x31')]['filter']+'%'};return _0x385480;})});}_0x1de8d6=_['merge']({},_0x1de8d6,_0x1f67bb[_0xa090('0x4f')]);return _0x39eb61[_0xa090('0x50')](_0x1de8d6);}})[_0xa090('0x25')](function(_0x3d4b9b){if(_0x3d4b9b){_0x99222f=_0x3d4b9b[_0xa090('0x47')];if(!_0x1f67bb[_0xa090('0x31')][_0xa090('0x51')](_0xa090('0x38'))){_0x1de8d6[_0xa090('0x1e')]=qs[_0xa090('0x1e')](_0x1f67bb[_0xa090('0x31')]['limit']);_0x1de8d6[_0xa090('0x1c')]=qs[_0xa090('0x1c')](_0x1f67bb[_0xa090('0x31')][_0xa090('0x1c')]);}return _0x39eb61['getSubjects'](_0x1de8d6);}})[_0xa090('0x25')](function(_0xa20a4d){if(_0xa20a4d){return _0xa20a4d?{'count':_0x99222f,'rows':_0xa20a4d}:null;}})[_0xa090('0x25')](respondWithResult(_0x125396,null))[_0xa090('0x44')](handleError(_0x125396,null));};exports['getDescriptions']=function(_0x268711,_0x1132e2,_0x18eb6a){var _0x65bfcb={};var _0x44884d={};var _0x4a4454;var _0x450672;return db[_0xa090('0x2d')][_0xa090('0x4d')]({'where':{'id':_0x268711[_0xa090('0x46')]['id']}})[_0xa090('0x25')](handleEntityNotFound(_0x1132e2,null))[_0xa090('0x25')](function(_0x44b61e){if(_0x44b61e){_0x4a4454=_0x44b61e;_0x44884d[_0xa090('0x34')]=_[_0xa090('0x32')](db[_0xa090('0x4e')][_0xa090('0x2e')]);_0x44884d[_0xa090('0x31')]=_[_0xa090('0x32')](_0x268711[_0xa090('0x31')]);_0x44884d[_0xa090('0x33')]=_[_0xa090('0x36')](_0x44884d[_0xa090('0x34')],_0x44884d[_0xa090('0x31')]);_0x65bfcb[_0xa090('0x35')]=_[_0xa090('0x36')](_0x44884d[_0xa090('0x34')],qs[_0xa090('0x37')](_0x268711['query']['fields']));_0x65bfcb[_0xa090('0x35')]=_0x65bfcb['attributes'][_0xa090('0x47')]?_0x65bfcb[_0xa090('0x35')]:_0x44884d['model'];_0x65bfcb[_0xa090('0x39')]=qs['sort'](_0x268711[_0xa090('0x31')][_0xa090('0x3a')]);_0x65bfcb[_0xa090('0x3b')]=qs[_0xa090('0x33')](_[_0xa090('0x3c')](_0x268711[_0xa090('0x31')],_0x44884d[_0xa090('0x33')]));if(_0x268711[_0xa090('0x31')][_0xa090('0x3d')]){_0x65bfcb[_0xa090('0x3b')]=_[_0xa090('0x3e')](_0x65bfcb[_0xa090('0x3b')],{'$or':_[_0xa090('0x2c')](_0x65bfcb[_0xa090('0x35')],function(_0x33414f){var _0x345444={};_0x345444[_0x33414f]={'$like':'%'+_0x268711[_0xa090('0x31')][_0xa090('0x3d')]+'%'};return _0x345444;})});}_0x65bfcb=_[_0xa090('0x3e')]({},_0x65bfcb,_0x268711[_0xa090('0x4f')]);return _0x4a4454[_0xa090('0x52')](_0x65bfcb);}})[_0xa090('0x25')](function(_0x2b224d){if(_0x2b224d){_0x450672=_0x2b224d[_0xa090('0x47')];if(!_0x268711['query'][_0xa090('0x51')](_0xa090('0x38'))){_0x65bfcb[_0xa090('0x1e')]=qs[_0xa090('0x1e')](_0x268711[_0xa090('0x31')][_0xa090('0x1e')]);_0x65bfcb['offset']=qs['offset'](_0x268711[_0xa090('0x31')][_0xa090('0x1c')]);}return _0x4a4454['getDescriptions'](_0x65bfcb);}})['then'](function(_0x1b8467){if(_0x1b8467){return _0x1b8467?{'count':_0x450672,'rows':_0x1b8467}:null;}})['then'](respondWithResult(_0x1132e2,null))[_0xa090('0x44')](handleError(_0x1132e2,null));}; \ No newline at end of file +var _0x536e=['create','body','getFields','findOne','SalesforceField','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','filters','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','findAll','catch','params','keys','includeAll','include','options','find'];(function(_0x2c41d2,_0x1a075a){var _0x1272c7=function(_0x153385){while(--_0x153385){_0x2c41d2['push'](_0x2c41d2['shift']());}};_0x1272c7(++_0x1a075a);}(_0x536e,0x155));var _0xe536=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x536e[_0x246148];return _0x453d94;};'use strict';var emlformat=require(_0xe536('0x0'));var rimraf=require(_0xe536('0x1'));var zipdir=require(_0xe536('0x2'));var jsonpatch=require(_0xe536('0x3'));var rp=require(_0xe536('0x4'));var moment=require(_0xe536('0x5'));var BPromise=require(_0xe536('0x6'));var Mustache=require(_0xe536('0x7'));var util=require(_0xe536('0x8'));var path=require(_0xe536('0x9'));var sox=require(_0xe536('0xa'));var csv=require(_0xe536('0xb'));var ejs=require(_0xe536('0xc'));var fs=require('fs');var fs_extra=require(_0xe536('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe536('0xe'));var jsforce=require(_0xe536('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe536('0xb'));var querystring=require(_0xe536('0x10'));var Papa=require(_0xe536('0x11'));var Redis=require(_0xe536('0x12'));var authService=require(_0xe536('0x13'));var qs=require(_0xe536('0x14'));var as=require(_0xe536('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe536('0x16'));var utils=require(_0xe536('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe536('0x18'));var db=require(_0xe536('0x19'))['db'];function respondWithStatusCode(_0x2d3a64,_0x97e923){_0x97e923=_0x97e923||0xcc;return function(_0x3377aa){if(_0x3377aa){return _0x2d3a64[_0xe536('0x1a')](_0x97e923);}return _0x2d3a64['status'](_0x97e923)[_0xe536('0x1b')]();};}function respondWithResult(_0x43eec7,_0x1fdc02){_0x1fdc02=_0x1fdc02||0xc8;return function(_0x32e841){if(_0x32e841){return _0x43eec7[_0xe536('0x1c')](_0x1fdc02)['json'](_0x32e841);}};}function respondWithFilteredResult(_0x410583,_0x3ec7e2){return function(_0xbca3d0){if(_0xbca3d0){var _0x4aa62c=typeof _0x3ec7e2[_0xe536('0x1d')]===_0xe536('0x1e')&&typeof _0x3ec7e2[_0xe536('0x1f')]===_0xe536('0x1e');var _0x4cf519=_0xbca3d0['count'];var _0x14640b=_0x4aa62c?0x0:_0x3ec7e2[_0xe536('0x1d')];var _0x33fac3=_0x4aa62c?_0xbca3d0[_0xe536('0x20')]:_0x3ec7e2['offset']+_0x3ec7e2['limit'];var _0x19897f;if(_0x33fac3>=_0x4cf519){_0x33fac3=_0x4cf519;_0x19897f=0xc8;}else{_0x19897f=0xce;}_0x410583[_0xe536('0x1c')](_0x19897f);return _0x410583[_0xe536('0x21')](_0xe536('0x22'),_0x14640b+'-'+_0x33fac3+'/'+_0x4cf519)[_0xe536('0x23')](_0xbca3d0);}return null;};}function patchUpdates(_0x91335c){return function(_0x3c3e82){try{jsonpatch[_0xe536('0x24')](_0x3c3e82,_0x91335c,!![]);}catch(_0x40c892){return BPromise[_0xe536('0x25')](_0x40c892);}return _0x3c3e82[_0xe536('0x26')]();};}function saveUpdates(_0x514bf3,_0x53f355){return function(_0x6ff7e2){if(_0x6ff7e2){return _0x6ff7e2[_0xe536('0x27')](_0x514bf3)[_0xe536('0x28')](function(_0x489f24){return _0x489f24;});}return null;};}function removeEntity(_0x3e069e,_0x9a41f8){return function(_0x2e8fd1){if(_0x2e8fd1){return _0x2e8fd1[_0xe536('0x29')]()[_0xe536('0x28')](function(){_0x3e069e[_0xe536('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39c49e,_0x48adcc){return function(_0x1d5875){if(!_0x1d5875){_0x39c49e[_0xe536('0x1a')](0x194);}return _0x1d5875;};}function handleError(_0x3b1b58,_0x158d76){_0x158d76=_0x158d76||0x1f4;return function(_0x4e2881){logger[_0xe536('0x2a')](_0x4e2881[_0xe536('0x2b')]);if(_0x4e2881['name']){delete _0x4e2881[_0xe536('0x2c')];}_0x3b1b58[_0xe536('0x1c')](_0x158d76)['send'](_0x4e2881);};}exports[_0xe536('0x2d')]=function(_0xb7dee,_0x23d8c8){var _0x2a2a3f={},_0x3671a6={},_0x5a8cb4={'count':0x0,'rows':[]};var _0x316bab=_[_0xe536('0x2e')](db[_0xe536('0x2f')][_0xe536('0x30')],function(_0x1f7512){return{'name':_0x1f7512[_0xe536('0x31')],'type':_0x1f7512[_0xe536('0x32')][_0xe536('0x33')]};});_0x3671a6['model']=_[_0xe536('0x2e')](_0x316bab,_0xe536('0x2c'));_0x3671a6['query']=_['keys'](_0xb7dee['query']);_0x3671a6[_0xe536('0x34')]=_['intersection'](_0x3671a6[_0xe536('0x35')],_0x3671a6[_0xe536('0x36')]);_0x2a2a3f[_0xe536('0x37')]=_[_0xe536('0x38')](_0x3671a6[_0xe536('0x35')],qs[_0xe536('0x39')](_0xb7dee[_0xe536('0x36')]['fields']));_0x2a2a3f[_0xe536('0x37')]=_0x2a2a3f[_0xe536('0x37')][_0xe536('0x3a')]?_0x2a2a3f['attributes']:_0x3671a6['model'];if(!_0xb7dee[_0xe536('0x36')]['hasOwnProperty'](_0xe536('0x3b'))){_0x2a2a3f[_0xe536('0x1f')]=qs['limit'](_0xb7dee['query'][_0xe536('0x1f')]);_0x2a2a3f['offset']=qs[_0xe536('0x1d')](_0xb7dee['query'][_0xe536('0x1d')]);}_0x2a2a3f[_0xe536('0x3c')]=qs[_0xe536('0x3d')](_0xb7dee[_0xe536('0x36')]['sort']);_0x2a2a3f[_0xe536('0x3e')]=qs[_0xe536('0x34')](_['pick'](_0xb7dee['query'],_0x3671a6[_0xe536('0x34')]),_0x316bab);if(_0xb7dee[_0xe536('0x36')][_0xe536('0x3f')]){_0x2a2a3f[_0xe536('0x3e')]=_[_0xe536('0x40')](_0x2a2a3f[_0xe536('0x3e')],{'$or':_[_0xe536('0x2e')](_0x316bab,function(_0x2c5579){if(_0x2c5579[_0xe536('0x32')]!==_0xe536('0x41')){var _0x5b4a4f={};_0x5b4a4f[_0x2c5579[_0xe536('0x2c')]]={'$like':'%'+_0xb7dee[_0xe536('0x36')][_0xe536('0x3f')]+'%'};return _0x5b4a4f;}})});}_0x2a2a3f=_['merge']({},_0x2a2a3f,_0xb7dee['options']);var _0x1329d4={'where':_0x2a2a3f[_0xe536('0x3e')]};return db[_0xe536('0x2f')][_0xe536('0x20')](_0x1329d4)[_0xe536('0x28')](function(_0x49887e){_0x5a8cb4['count']=_0x49887e;if(_0xb7dee[_0xe536('0x36')]['includeAll']){_0x2a2a3f['include']=[{'all':!![]}];}return db[_0xe536('0x2f')][_0xe536('0x42')](_0x2a2a3f);})[_0xe536('0x28')](function(_0x1cac36){_0x5a8cb4['rows']=_0x1cac36;return _0x5a8cb4;})[_0xe536('0x28')](respondWithFilteredResult(_0x23d8c8,_0x2a2a3f))[_0xe536('0x43')](handleError(_0x23d8c8,null));};exports['show']=function(_0x106404,_0x276a92){var _0x5ddaf9={'raw':![],'where':{'id':_0x106404[_0xe536('0x44')]['id']}},_0x287994={};_0x287994[_0xe536('0x35')]=_[_0xe536('0x45')](db[_0xe536('0x2f')]['rawAttributes']);_0x287994['query']=_[_0xe536('0x45')](_0x106404[_0xe536('0x36')]);_0x287994['filters']=_[_0xe536('0x38')](_0x287994[_0xe536('0x35')],_0x287994['query']);_0x5ddaf9[_0xe536('0x37')]=_['intersection'](_0x287994[_0xe536('0x35')],qs[_0xe536('0x39')](_0x106404[_0xe536('0x36')][_0xe536('0x39')]));_0x5ddaf9['attributes']=_0x5ddaf9[_0xe536('0x37')][_0xe536('0x3a')]?_0x5ddaf9[_0xe536('0x37')]:_0x287994[_0xe536('0x35')];if(_0x106404['query'][_0xe536('0x46')]){_0x5ddaf9[_0xe536('0x47')]=[{'all':!![]}];}_0x5ddaf9=_['merge']({},_0x5ddaf9,_0x106404[_0xe536('0x48')]);return db['SalesforceConfiguration'][_0xe536('0x49')](_0x5ddaf9)[_0xe536('0x28')](handleEntityNotFound(_0x276a92,null))[_0xe536('0x28')](respondWithResult(_0x276a92,null))[_0xe536('0x43')](handleError(_0x276a92,null));};exports[_0xe536('0x4a')]=function(_0x31e1d2,_0x5c9af3){return db[_0xe536('0x2f')][_0xe536('0x4a')](_0x31e1d2[_0xe536('0x4b')],{})[_0xe536('0x28')](respondWithResult(_0x5c9af3,0xc9))[_0xe536('0x43')](handleError(_0x5c9af3,null));};exports[_0xe536('0x27')]=function(_0x4f0b36,_0xf51b62){if(_0x4f0b36['body']['id']){delete _0x4f0b36[_0xe536('0x4b')]['id'];}return db['SalesforceConfiguration'][_0xe536('0x49')]({'where':{'id':_0x4f0b36['params']['id']}})[_0xe536('0x28')](handleEntityNotFound(_0xf51b62,null))['then'](saveUpdates(_0x4f0b36[_0xe536('0x4b')],null))[_0xe536('0x28')](respondWithResult(_0xf51b62,null))[_0xe536('0x43')](handleError(_0xf51b62,null));};exports[_0xe536('0x29')]=function(_0x329617,_0x4bd643){return db[_0xe536('0x2f')]['find']({'where':{'id':_0x329617['params']['id']}})[_0xe536('0x28')](handleEntityNotFound(_0x4bd643,null))[_0xe536('0x28')](removeEntity(_0x4bd643,null))[_0xe536('0x43')](handleError(_0x4bd643,null));};exports[_0xe536('0x4c')]=function(_0x830968,_0x2f544b,_0x57fe78){var _0x53386e={};var _0x41c065={};var _0x528821;var _0x42f67a;return db[_0xe536('0x2f')][_0xe536('0x4d')]({'where':{'id':_0x830968[_0xe536('0x44')]['id']}})[_0xe536('0x28')](handleEntityNotFound(_0x2f544b,null))['then'](function(_0x11c8e0){if(_0x11c8e0){_0x528821=_0x11c8e0;_0x41c065[_0xe536('0x35')]=_[_0xe536('0x45')](db[_0xe536('0x4e')][_0xe536('0x30')]);_0x41c065[_0xe536('0x36')]=_['keys'](_0x830968[_0xe536('0x36')]);_0x41c065[_0xe536('0x34')]=_['intersection'](_0x41c065[_0xe536('0x35')],_0x41c065[_0xe536('0x36')]);_0x53386e[_0xe536('0x37')]=_['intersection'](_0x41c065[_0xe536('0x35')],qs['fields'](_0x830968['query'][_0xe536('0x39')]));_0x53386e[_0xe536('0x37')]=_0x53386e[_0xe536('0x37')][_0xe536('0x3a')]?_0x53386e[_0xe536('0x37')]:_0x41c065['model'];_0x53386e[_0xe536('0x3c')]=qs[_0xe536('0x3d')](_0x830968['query'][_0xe536('0x3d')]);_0x53386e['where']=qs['filters'](_[_0xe536('0x4f')](_0x830968['query'],_0x41c065[_0xe536('0x34')]));if(_0x830968[_0xe536('0x36')][_0xe536('0x3f')]){_0x53386e['where']=_[_0xe536('0x40')](_0x53386e[_0xe536('0x3e')],{'$or':_[_0xe536('0x2e')](_0x53386e[_0xe536('0x37')],function(_0x18a4c0){var _0x548d3b={};_0x548d3b[_0x18a4c0]={'$like':'%'+_0x830968['query'][_0xe536('0x3f')]+'%'};return _0x548d3b;})});}_0x53386e=_['merge']({},_0x53386e,_0x830968[_0xe536('0x48')]);return _0x528821[_0xe536('0x4c')](_0x53386e);}})[_0xe536('0x28')](function(_0x1b7651){if(_0x1b7651){_0x42f67a=_0x1b7651[_0xe536('0x3a')];if(!_0x830968[_0xe536('0x36')][_0xe536('0x50')](_0xe536('0x3b'))){_0x53386e[_0xe536('0x1f')]=qs['limit'](_0x830968[_0xe536('0x36')][_0xe536('0x1f')]);_0x53386e[_0xe536('0x1d')]=qs[_0xe536('0x1d')](_0x830968['query'][_0xe536('0x1d')]);}return _0x528821[_0xe536('0x4c')](_0x53386e);}})[_0xe536('0x28')](function(_0x239d36){if(_0x239d36){return _0x239d36?{'count':_0x42f67a,'rows':_0x239d36}:null;}})[_0xe536('0x28')](respondWithResult(_0x2f544b,null))[_0xe536('0x43')](handleError(_0x2f544b,null));};exports[_0xe536('0x51')]=function(_0x5e6714,_0x11e3a9,_0x3201cc){var _0x1d1780={};var _0x33079f={};var _0x57bc54;var _0x4fc800;return db[_0xe536('0x2f')][_0xe536('0x4d')]({'where':{'id':_0x5e6714[_0xe536('0x44')]['id']}})[_0xe536('0x28')](handleEntityNotFound(_0x11e3a9,null))[_0xe536('0x28')](function(_0x1e807f){if(_0x1e807f){_0x57bc54=_0x1e807f;_0x33079f[_0xe536('0x35')]=_[_0xe536('0x45')](db[_0xe536('0x4e')][_0xe536('0x30')]);_0x33079f['query']=_[_0xe536('0x45')](_0x5e6714[_0xe536('0x36')]);_0x33079f[_0xe536('0x34')]=_[_0xe536('0x38')](_0x33079f[_0xe536('0x35')],_0x33079f['query']);_0x1d1780[_0xe536('0x37')]=_[_0xe536('0x38')](_0x33079f['model'],qs[_0xe536('0x39')](_0x5e6714['query']['fields']));_0x1d1780[_0xe536('0x37')]=_0x1d1780['attributes'][_0xe536('0x3a')]?_0x1d1780[_0xe536('0x37')]:_0x33079f[_0xe536('0x35')];_0x1d1780['order']=qs['sort'](_0x5e6714[_0xe536('0x36')][_0xe536('0x3d')]);_0x1d1780['where']=qs[_0xe536('0x34')](_[_0xe536('0x4f')](_0x5e6714[_0xe536('0x36')],_0x33079f[_0xe536('0x34')]));if(_0x5e6714[_0xe536('0x36')][_0xe536('0x3f')]){_0x1d1780[_0xe536('0x3e')]=_['merge'](_0x1d1780[_0xe536('0x3e')],{'$or':_[_0xe536('0x2e')](_0x1d1780[_0xe536('0x37')],function(_0x2b465b){var _0x4acd47={};_0x4acd47[_0x2b465b]={'$like':'%'+_0x5e6714[_0xe536('0x36')][_0xe536('0x3f')]+'%'};return _0x4acd47;})});}_0x1d1780=_['merge']({},_0x1d1780,_0x5e6714[_0xe536('0x48')]);return _0x57bc54[_0xe536('0x51')](_0x1d1780);}})[_0xe536('0x28')](function(_0x5ad8fa){if(_0x5ad8fa){_0x4fc800=_0x5ad8fa[_0xe536('0x3a')];if(!_0x5e6714[_0xe536('0x36')][_0xe536('0x50')](_0xe536('0x3b'))){_0x1d1780[_0xe536('0x1f')]=qs[_0xe536('0x1f')](_0x5e6714[_0xe536('0x36')][_0xe536('0x1f')]);_0x1d1780[_0xe536('0x1d')]=qs[_0xe536('0x1d')](_0x5e6714[_0xe536('0x36')][_0xe536('0x1d')]);}return _0x57bc54[_0xe536('0x51')](_0x1d1780);}})[_0xe536('0x28')](function(_0x2f5bb1){if(_0x2f5bb1){return _0x2f5bb1?{'count':_0x4fc800,'rows':_0x2f5bb1}:null;}})[_0xe536('0x28')](respondWithResult(_0x11e3a9,null))[_0xe536('0x43')](handleError(_0x11e3a9,null));};exports[_0xe536('0x52')]=function(_0x5983ca,_0xcd581d,_0x4fb765){var _0x3c729c={};var _0x360370={};var _0x4f53b8;var _0x2f440b;return db['SalesforceConfiguration'][_0xe536('0x4d')]({'where':{'id':_0x5983ca['params']['id']}})[_0xe536('0x28')](handleEntityNotFound(_0xcd581d,null))[_0xe536('0x28')](function(_0x27fbcf){if(_0x27fbcf){_0x4f53b8=_0x27fbcf;_0x360370[_0xe536('0x35')]=_[_0xe536('0x45')](db[_0xe536('0x4e')][_0xe536('0x30')]);_0x360370[_0xe536('0x36')]=_['keys'](_0x5983ca['query']);_0x360370['filters']=_['intersection'](_0x360370[_0xe536('0x35')],_0x360370[_0xe536('0x36')]);_0x3c729c[_0xe536('0x37')]=_[_0xe536('0x38')](_0x360370['model'],qs[_0xe536('0x39')](_0x5983ca[_0xe536('0x36')][_0xe536('0x39')]));_0x3c729c[_0xe536('0x37')]=_0x3c729c['attributes']['length']?_0x3c729c[_0xe536('0x37')]:_0x360370['model'];_0x3c729c[_0xe536('0x3c')]=qs[_0xe536('0x3d')](_0x5983ca[_0xe536('0x36')][_0xe536('0x3d')]);_0x3c729c['where']=qs[_0xe536('0x34')](_[_0xe536('0x4f')](_0x5983ca[_0xe536('0x36')],_0x360370['filters']));if(_0x5983ca['query'][_0xe536('0x3f')]){_0x3c729c['where']=_['merge'](_0x3c729c[_0xe536('0x3e')],{'$or':_['map'](_0x3c729c[_0xe536('0x37')],function(_0x3460cb){var _0x24bac8={};_0x24bac8[_0x3460cb]={'$like':'%'+_0x5983ca[_0xe536('0x36')][_0xe536('0x3f')]+'%'};return _0x24bac8;})});}_0x3c729c=_[_0xe536('0x40')]({},_0x3c729c,_0x5983ca['options']);return _0x4f53b8[_0xe536('0x52')](_0x3c729c);}})[_0xe536('0x28')](function(_0x2fc231){if(_0x2fc231){_0x2f440b=_0x2fc231[_0xe536('0x3a')];if(!_0x5983ca[_0xe536('0x36')][_0xe536('0x50')](_0xe536('0x3b'))){_0x3c729c[_0xe536('0x1f')]=qs[_0xe536('0x1f')](_0x5983ca[_0xe536('0x36')][_0xe536('0x1f')]);_0x3c729c[_0xe536('0x1d')]=qs[_0xe536('0x1d')](_0x5983ca[_0xe536('0x36')]['offset']);}return _0x4f53b8[_0xe536('0x52')](_0x3c729c);}})[_0xe536('0x28')](function(_0x505de2){if(_0x505de2){return _0x505de2?{'count':_0x2f440b,'rows':_0x505de2}:null;}})[_0xe536('0x28')](respondWithResult(_0xcd581d,null))[_0xe536('0x43')](handleError(_0xcd581d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2a536d7..1c57a12 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 _0x4452=['lodash','util','api','moment','request-promise','rimraf','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations'];(function(_0x141e4b,_0x465028){var _0x597e9f=function(_0x566b73){while(--_0x566b73){_0x141e4b['push'](_0x141e4b['shift']());}};_0x597e9f(++_0x465028);}(_0x4452,0x172));var _0x2445=function(_0x719487,_0x55818c){_0x719487=_0x719487-0x0;var _0x372c53=_0x4452[_0x719487];return _0x372c53;};'use strict';var _=require(_0x2445('0x0'));var util=require(_0x2445('0x1'));var logger=require('../../config/logger')(_0x2445('0x2'));var moment=require(_0x2445('0x3'));var BPromise=require('bluebird');var rp=require(_0x2445('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2445('0x5'));var config=require('../../config/environment');var attributes=require(_0x2445('0x6'));module['exports']=function(_0x243540,_0x151b41){return _0x243540[_0x2445('0x7')](_0x2445('0x8'),attributes,{'tableName':_0x2445('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b8b=['SalesforceConfiguration','int_salesforce_configurations','util','api','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x6660e2,_0xfe6ec4){var _0x969384=function(_0x467def){while(--_0x467def){_0x6660e2['push'](_0x6660e2['shift']());}};_0x969384(++_0xfe6ec4);}(_0x7b8b,0xd4));var _0xb7b8=function(_0x51ed62,_0x574379){_0x51ed62=_0x51ed62-0x0;var _0x34aee3=_0x7b8b[_0x51ed62];return _0x34aee3;};'use strict';var _=require('lodash');var util=require(_0xb7b8('0x0'));var logger=require('../../config/logger')(_0xb7b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb7b8('0x2'));var fs=require('fs');var path=require(_0xb7b8('0x3'));var rimraf=require('rimraf');var config=require(_0xb7b8('0x4'));var attributes=require(_0xb7b8('0x5'));module[_0xb7b8('0x6')]=function(_0x2dcf63,_0x4d8103){return _0x2dcf63[_0xb7b8('0x7')](_0xb7b8('0x8'),attributes,{'tableName':_0xb7b8('0x9'),'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 ad49bdd..aabeccb 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 _0x6b82=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','debug'];(function(_0x534912,_0x4c124e){var _0x4ba826=function(_0x270aee){while(--_0x270aee){_0x534912['push'](_0x534912['shift']());}};_0x4ba826(++_0x4c124e);}(_0x6b82,0x161));var _0x26b8=function(_0x488814,_0x3fec59){_0x488814=_0x488814-0x0;var _0x58138b=_0x6b82[_0x488814];return _0x58138b;};'use strict';var _=require(_0x26b8('0x0'));var util=require(_0x26b8('0x1'));var moment=require('moment');var BPromise=require(_0x26b8('0x2'));var rs=require(_0x26b8('0x3'));var fs=require('fs');var Redis=require(_0x26b8('0x4'));var db=require(_0x26b8('0x5'))['db'];var utils=require(_0x26b8('0x6'));var logger=require(_0x26b8('0x7'))(_0x26b8('0x8'));var config=require(_0x26b8('0x9'));var jayson=require(_0x26b8('0xa'));var client=jayson['client'][_0x26b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39a97d,_0x4dd1d4,_0x992072){return new BPromise(function(_0x56ad15,_0x21fd3a){return client[_0x26b8('0xc')](_0x39a97d,_0x992072)['then'](function(_0x41a910){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x4dd1d4,_0x26b8('0xd'));logger[_0x26b8('0xe')](_0x26b8('0xf'),_0x4dd1d4,_0x26b8('0xd'),JSON[_0x26b8('0x10')](_0x41a910));if(_0x41a910['error']){if(_0x41a910[_0x26b8('0x11')][_0x26b8('0x12')]===0x1f4){logger[_0x26b8('0x11')](_0x26b8('0x13'),_0x4dd1d4,_0x41a910[_0x26b8('0x11')][_0x26b8('0x14')]);return _0x21fd3a(_0x41a910[_0x26b8('0x11')][_0x26b8('0x14')]);}logger[_0x26b8('0x11')](_0x26b8('0x13'),_0x4dd1d4,_0x41a910[_0x26b8('0x11')][_0x26b8('0x14')]);return _0x56ad15(_0x41a910[_0x26b8('0x11')][_0x26b8('0x14')]);}else{logger[_0x26b8('0x15')](_0x26b8('0x13'),_0x4dd1d4,_0x26b8('0xd'));_0x56ad15(_0x41a910['result'][_0x26b8('0x14')]);}})[_0x26b8('0x16')](function(_0x3b5260){logger[_0x26b8('0x11')](_0x26b8('0x13'),_0x4dd1d4,_0x3b5260);_0x21fd3a(_0x3b5260);});});} \ No newline at end of file +var _0x2b4a=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','randomstring','ioredis'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x2b4a,0xc4));var _0xa2b4=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x2b4a[_0x155c64];return _0x1f154a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa2b4('0x0'));var BPromise=require(_0xa2b4('0x1'));var rs=require(_0xa2b4('0x2'));var fs=require('fs');var Redis=require(_0xa2b4('0x3'));var db=require(_0xa2b4('0x4'))['db'];var utils=require(_0xa2b4('0x5'));var logger=require(_0xa2b4('0x6'))(_0xa2b4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa2b4('0x8')][_0xa2b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3332c4,_0x368279,_0x2e87f6){return new BPromise(function(_0x3a338f,_0x46986f){return client[_0xa2b4('0xa')](_0x3332c4,_0x2e87f6)[_0xa2b4('0xb')](function(_0x167280){logger[_0xa2b4('0xc')](_0xa2b4('0xd'),_0x368279,_0xa2b4('0xe'));logger[_0xa2b4('0xf')](_0xa2b4('0x10'),_0x368279,'request\x20sent',JSON[_0xa2b4('0x11')](_0x167280));if(_0x167280['error']){if(_0x167280[_0xa2b4('0x12')]['code']===0x1f4){logger[_0xa2b4('0x12')](_0xa2b4('0xd'),_0x368279,_0x167280[_0xa2b4('0x12')]['message']);return _0x46986f(_0x167280[_0xa2b4('0x12')][_0xa2b4('0x13')]);}logger[_0xa2b4('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x368279,_0x167280[_0xa2b4('0x12')][_0xa2b4('0x13')]);return _0x3a338f(_0x167280[_0xa2b4('0x12')][_0xa2b4('0x13')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x368279,_0xa2b4('0xe'));_0x3a338f(_0x167280['result'][_0xa2b4('0x13')]);}})['catch'](function(_0x1aae28){logger[_0xa2b4('0x12')](_0xa2b4('0xd'),_0x368279,_0x1aae28);_0x46986f(_0x1aae28);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index dfb347f..1f12d56 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 _0xfff3=['Router','fs-extra','../../components/interaction/service','./intSalesforceField.controller','isAuthenticated','index','get','show','post','create','put','update','delete','/:id','destroy','util','path'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0xfff3,0x152));var _0x3fff=function(_0x416055,_0x45a9af){_0x416055=_0x416055-0x0;var _0x5d6f29=_0xfff3[_0x416055];return _0x5d6f29;};'use strict';var multer=require('multer');var util=require(_0x3fff('0x0'));var path=require(_0x3fff('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3fff('0x2')]();var fs_extra=require(_0x3fff('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3fff('0x4'));var config=require('../../config/environment');var controller=require(_0x3fff('0x5'));router['get']('/',auth[_0x3fff('0x6')](),controller[_0x3fff('0x7')]);router[_0x3fff('0x8')]('/:id',auth[_0x3fff('0x6')](),controller[_0x3fff('0x9')]);router[_0x3fff('0xa')]('/',auth[_0x3fff('0x6')](),controller[_0x3fff('0xb')]);router[_0x3fff('0xc')]('/:id',auth[_0x3fff('0x6')](),controller[_0x3fff('0xd')]);router[_0x3fff('0xe')](_0x3fff('0xf'),auth[_0x3fff('0x6')](),controller[_0x3fff('0x10')]);module['exports']=router; \ No newline at end of file +var _0xcd27=['delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','show','post','create','/:id','update'];(function(_0x3843f6,_0x184013){var _0x1591b9=function(_0x21bb6a){while(--_0x21bb6a){_0x3843f6['push'](_0x3843f6['shift']());}};_0x1591b9(++_0x184013);}(_0xcd27,0x1c5));var _0x7cd2=function(_0x1b5355,_0x312fc3){_0x1b5355=_0x1b5355-0x0;var _0xfcf1de=_0xcd27[_0x1b5355];return _0xfcf1de;};'use strict';var multer=require(_0x7cd2('0x0'));var util=require('util');var path=require(_0x7cd2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7cd2('0x2'));var auth=require(_0x7cd2('0x3'));var interaction=require(_0x7cd2('0x4'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x7cd2('0x5')](),controller[_0x7cd2('0x6')]);router['get']('/:id',auth[_0x7cd2('0x5')](),controller[_0x7cd2('0x7')]);router[_0x7cd2('0x8')]('/',auth[_0x7cd2('0x5')](),controller[_0x7cd2('0x9')]);router['put'](_0x7cd2('0xa'),auth['isAuthenticated'](),controller[_0x7cd2('0xb')]);router[_0x7cd2('0xc')](_0x7cd2('0xa'),auth[_0x7cd2('0x5')](),controller[_0x7cd2('0xd')]);module[_0x7cd2('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index d68f293..a6bbc1e 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 _0xc59d=['variable','exports','ENUM','customVariable','picklist','string','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc59d,0x9b));var _0xdc59=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc59d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xdc59('0x0')]={'type':{'type':Sequelize[_0xdc59('0x1')]('string','variable',_0xdc59('0x2'),'keyValue',_0xdc59('0x3')),'defaultValue':_0xdc59('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdc59('0x5')]},'keyType':{'type':Sequelize[_0xdc59('0x1')]('string',_0xdc59('0x6'),_0xdc59('0x2'))},'keyContent':{'type':Sequelize[_0xdc59('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xdc59('0x5')]}}; \ No newline at end of file +var _0x5e23=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x36dea2,_0xf8eac0){var _0x3214c2=function(_0x440d59){while(--_0x440d59){_0x36dea2['push'](_0x36dea2['shift']());}};_0x3214c2(++_0xf8eac0);}(_0x5e23,0x11d));var _0x35e2=function(_0x38d299,_0x27effb){_0x38d299=_0x38d299-0x0;var _0x34eefb=_0x5e23[_0x38d299];return _0x34eefb;};'use strict';var Sequelize=require(_0x35e2('0x0'));module[_0x35e2('0x1')]={'type':{'type':Sequelize[_0x35e2('0x2')](_0x35e2('0x3'),_0x35e2('0x4'),_0x35e2('0x5'),_0x35e2('0x6'),_0x35e2('0x7')),'defaultValue':_0x35e2('0x3')},'content':{'type':Sequelize[_0x35e2('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x35e2('0x2')]('string',_0x35e2('0x4'),_0x35e2('0x5'))},'keyContent':{'type':Sequelize[_0x35e2('0x8')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x35e2('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 847a921..f368b7c 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 _0x36d4=['status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','keys','options','find','catch','create','body','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus'];(function(_0x592104,_0x52ea9f){var _0x259f67=function(_0x3a10a0){while(--_0x3a10a0){_0x592104['push'](_0x592104['shift']());}};_0x259f67(++_0x52ea9f);}(_0x36d4,0xc1));var _0x436d=function(_0x103466,_0x190bb5){_0x103466=_0x103466-0x0;var _0x416ba8=_0x36d4[_0x103466];return _0x416ba8;};'use strict';var emlformat=require(_0x436d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x436d('0x1'));var rp=require('request-promise');var moment=require(_0x436d('0x2'));var BPromise=require(_0x436d('0x3'));var Mustache=require(_0x436d('0x4'));var util=require('util');var path=require(_0x436d('0x5'));var sox=require(_0x436d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x436d('0x7'));var _=require(_0x436d('0x8'));var squel=require('squel');var crypto=require(_0x436d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x436d('0xa'));var querystring=require(_0x436d('0xb'));var Papa=require(_0x436d('0xc'));var Redis=require(_0x436d('0xd'));var authService=require(_0x436d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x436d('0xf'));var hardwareService=require(_0x436d('0x10'));var logger=require('../../config/logger')(_0x436d('0x11'));var utils=require(_0x436d('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18cea1,_0x5ce81f){_0x5ce81f=_0x5ce81f||0xcc;return function(_0x2b7bf1){if(_0x2b7bf1){return _0x18cea1[_0x436d('0x13')](_0x5ce81f);}return _0x18cea1[_0x436d('0x14')](_0x5ce81f)[_0x436d('0x15')]();};}function respondWithResult(_0x1a6f93,_0x5a7a60){_0x5a7a60=_0x5a7a60||0xc8;return function(_0x1511db){if(_0x1511db){return _0x1a6f93['status'](_0x5a7a60)[_0x436d('0x16')](_0x1511db);}};}function respondWithFilteredResult(_0x17e649,_0x2e7807){return function(_0x2e1f90){if(_0x2e1f90){var _0x1ae5ba=typeof _0x2e7807[_0x436d('0x17')]==='undefined'&&typeof _0x2e7807[_0x436d('0x18')]===_0x436d('0x19');var _0x5f19b0=_0x2e1f90[_0x436d('0x1a')];var _0x2c891d=_0x1ae5ba?0x0:_0x2e7807[_0x436d('0x17')];var _0x8bd18=_0x1ae5ba?_0x2e1f90[_0x436d('0x1a')]:_0x2e7807[_0x436d('0x17')]+_0x2e7807['limit'];var _0x25a754;if(_0x8bd18>=_0x5f19b0){_0x8bd18=_0x5f19b0;_0x25a754=0xc8;}else{_0x25a754=0xce;}_0x17e649[_0x436d('0x14')](_0x25a754);return _0x17e649[_0x436d('0x1b')](_0x436d('0x1c'),_0x2c891d+'-'+_0x8bd18+'/'+_0x5f19b0)['json'](_0x2e1f90);}return null;};}function patchUpdates(_0x5b4ccc){return function(_0xd530d6){try{jsonpatch[_0x436d('0x1d')](_0xd530d6,_0x5b4ccc,!![]);}catch(_0x41bc73){return BPromise[_0x436d('0x1e')](_0x41bc73);}return _0xd530d6[_0x436d('0x1f')]();};}function saveUpdates(_0x14d77f,_0x3b34d3){return function(_0x29bd0f){if(_0x29bd0f){return _0x29bd0f[_0x436d('0x20')](_0x14d77f)[_0x436d('0x21')](function(_0x30f31a){return _0x30f31a;});}return null;};}function removeEntity(_0x2dc5ed,_0x1f197c){return function(_0x205879){if(_0x205879){return _0x205879[_0x436d('0x22')]()[_0x436d('0x21')](function(){_0x2dc5ed[_0x436d('0x14')](0xcc)[_0x436d('0x15')]();});}};}function handleEntityNotFound(_0xa5eeea,_0x536eb2){return function(_0x398a70){if(!_0x398a70){_0xa5eeea[_0x436d('0x13')](0x194);}return _0x398a70;};}function handleError(_0x49811e,_0x1c90d4){_0x1c90d4=_0x1c90d4||0x1f4;return function(_0x1081e1){logger[_0x436d('0x23')](_0x1081e1['stack']);if(_0x1081e1[_0x436d('0x24')]){delete _0x1081e1['name'];}_0x49811e['status'](_0x1c90d4)[_0x436d('0x25')](_0x1081e1);};}exports[_0x436d('0x26')]=function(_0x56344b,_0x2effb5){var _0x4c407e={},_0x2eec37={},_0x5336c9={'count':0x0,'rows':[]};var _0x5cf2ac=_[_0x436d('0x27')](db[_0x436d('0x28')][_0x436d('0x29')],function(_0x3796ce){return{'name':_0x3796ce[_0x436d('0x2a')],'type':_0x3796ce[_0x436d('0x2b')][_0x436d('0x2c')]};});_0x2eec37[_0x436d('0x2d')]=_[_0x436d('0x27')](_0x5cf2ac,_0x436d('0x24'));_0x2eec37[_0x436d('0x2e')]=_['keys'](_0x56344b[_0x436d('0x2e')]);_0x2eec37[_0x436d('0x2f')]=_[_0x436d('0x30')](_0x2eec37['model'],_0x2eec37['query']);_0x4c407e[_0x436d('0x31')]=_[_0x436d('0x30')](_0x2eec37['model'],qs['fields'](_0x56344b[_0x436d('0x2e')][_0x436d('0x32')]));_0x4c407e[_0x436d('0x31')]=_0x4c407e[_0x436d('0x31')][_0x436d('0x33')]?_0x4c407e['attributes']:_0x2eec37[_0x436d('0x2d')];if(!_0x56344b[_0x436d('0x2e')]['hasOwnProperty'](_0x436d('0x34'))){_0x4c407e[_0x436d('0x18')]=qs[_0x436d('0x18')](_0x56344b[_0x436d('0x2e')][_0x436d('0x18')]);_0x4c407e[_0x436d('0x17')]=qs['offset'](_0x56344b['query'][_0x436d('0x17')]);}_0x4c407e[_0x436d('0x35')]=qs['sort'](_0x56344b[_0x436d('0x2e')][_0x436d('0x36')]);_0x4c407e[_0x436d('0x37')]=qs[_0x436d('0x2f')](_[_0x436d('0x38')](_0x56344b[_0x436d('0x2e')],_0x2eec37[_0x436d('0x2f')]),_0x5cf2ac);if(_0x56344b['query'][_0x436d('0x39')]){_0x4c407e[_0x436d('0x37')]=_['merge'](_0x4c407e[_0x436d('0x37')],{'$or':_[_0x436d('0x27')](_0x5cf2ac,function(_0x44ffb9){if(_0x44ffb9[_0x436d('0x2b')]!==_0x436d('0x3a')){var _0x436c17={};_0x436c17[_0x44ffb9[_0x436d('0x24')]]={'$like':'%'+_0x56344b['query']['filter']+'%'};return _0x436c17;}})});}_0x4c407e=_[_0x436d('0x3b')]({},_0x4c407e,_0x56344b['options']);var _0x4e3396={'where':_0x4c407e[_0x436d('0x37')]};return db[_0x436d('0x28')]['count'](_0x4e3396)[_0x436d('0x21')](function(_0x56bc4e){_0x5336c9[_0x436d('0x1a')]=_0x56bc4e;if(_0x56344b[_0x436d('0x2e')][_0x436d('0x3c')]){_0x4c407e[_0x436d('0x3d')]=[{'all':!![]}];}return db[_0x436d('0x28')][_0x436d('0x3e')](_0x4c407e);})[_0x436d('0x21')](function(_0x423607){_0x5336c9[_0x436d('0x3f')]=_0x423607;return _0x5336c9;})[_0x436d('0x21')](respondWithFilteredResult(_0x2effb5,_0x4c407e))['catch'](handleError(_0x2effb5,null));};exports['show']=function(_0x16f26b,_0x35ab2f){var _0x34418b={'raw':!![],'where':{'id':_0x16f26b[_0x436d('0x40')]['id']}},_0x72e900={};_0x72e900[_0x436d('0x2d')]=_[_0x436d('0x41')](db[_0x436d('0x28')][_0x436d('0x29')]);_0x72e900['query']=_['keys'](_0x16f26b[_0x436d('0x2e')]);_0x72e900[_0x436d('0x2f')]=_[_0x436d('0x30')](_0x72e900['model'],_0x72e900[_0x436d('0x2e')]);_0x34418b[_0x436d('0x31')]=_[_0x436d('0x30')](_0x72e900['model'],qs['fields'](_0x16f26b['query'][_0x436d('0x32')]));_0x34418b['attributes']=_0x34418b[_0x436d('0x31')][_0x436d('0x33')]?_0x34418b[_0x436d('0x31')]:_0x72e900[_0x436d('0x2d')];if(_0x16f26b[_0x436d('0x2e')][_0x436d('0x3c')]){_0x34418b[_0x436d('0x3d')]=[{'all':!![]}];}_0x34418b=_[_0x436d('0x3b')]({},_0x34418b,_0x16f26b[_0x436d('0x42')]);return db[_0x436d('0x28')][_0x436d('0x43')](_0x34418b)[_0x436d('0x21')](handleEntityNotFound(_0x35ab2f,null))[_0x436d('0x21')](respondWithResult(_0x35ab2f,null))[_0x436d('0x44')](handleError(_0x35ab2f,null));};exports[_0x436d('0x45')]=function(_0x5f29b2,_0x71f42f){return db[_0x436d('0x28')][_0x436d('0x45')](_0x5f29b2[_0x436d('0x46')],{})[_0x436d('0x21')](respondWithResult(_0x71f42f,0xc9))[_0x436d('0x44')](handleError(_0x71f42f,null));};exports[_0x436d('0x20')]=function(_0x183ab5,_0x57d16f){if(_0x183ab5['body']['id']){delete _0x183ab5['body']['id'];}return db['SalesforceField'][_0x436d('0x43')]({'where':{'id':_0x183ab5[_0x436d('0x40')]['id']}})[_0x436d('0x21')](handleEntityNotFound(_0x57d16f,null))[_0x436d('0x21')](saveUpdates(_0x183ab5[_0x436d('0x46')],null))['then'](respondWithResult(_0x57d16f,null))[_0x436d('0x44')](handleError(_0x57d16f,null));};exports[_0x436d('0x22')]=function(_0x4a0b4c,_0xa1f64a){return db['SalesforceField'][_0x436d('0x43')]({'where':{'id':_0x4a0b4c[_0x436d('0x40')]['id']}})['then'](handleEntityNotFound(_0xa1f64a,null))['then'](removeEntity(_0xa1f64a,null))[_0x436d('0x44')](handleError(_0xa1f64a,null));}; \ No newline at end of file +var _0xf5ee=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','keys','filters','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x3979e6,_0xffbb97){var _0x36e7b2=function(_0x695e51){while(--_0x695e51){_0x3979e6['push'](_0x3979e6['shift']());}};_0x36e7b2(++_0xffbb97);}(_0xf5ee,0x1b3));var _0xef5e=function(_0x1a3e94,_0x361202){_0x1a3e94=_0x1a3e94-0x0;var _0x4547bb=_0xf5ee[_0x1a3e94];return _0x4547bb;};'use strict';var emlformat=require(_0xef5e('0x0'));var rimraf=require(_0xef5e('0x1'));var zipdir=require(_0xef5e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef5e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xef5e('0x4'));var util=require('util');var path=require(_0xef5e('0x5'));var sox=require(_0xef5e('0x6'));var csv=require(_0xef5e('0x7'));var ejs=require(_0xef5e('0x8'));var fs=require('fs');var fs_extra=require(_0xef5e('0x9'));var _=require(_0xef5e('0xa'));var squel=require('squel');var crypto=require(_0xef5e('0xb'));var jsforce=require(_0xef5e('0xc'));var deskjs=require(_0xef5e('0xd'));var toCsv=require(_0xef5e('0x7'));var querystring=require(_0xef5e('0xe'));var Papa=require(_0xef5e('0xf'));var Redis=require('ioredis');var authService=require(_0xef5e('0x10'));var qs=require(_0xef5e('0x11'));var as=require(_0xef5e('0x12'));var hardwareService=require(_0xef5e('0x13'));var logger=require('../../config/logger')(_0xef5e('0x14'));var utils=require(_0xef5e('0x15'));var config=require(_0xef5e('0x16'));var licenseUtil=require(_0xef5e('0x17'));var db=require(_0xef5e('0x18'))['db'];function respondWithStatusCode(_0x1eaa33,_0x2cb704){_0x2cb704=_0x2cb704||0xcc;return function(_0x24112c){if(_0x24112c){return _0x1eaa33[_0xef5e('0x19')](_0x2cb704);}return _0x1eaa33[_0xef5e('0x1a')](_0x2cb704)[_0xef5e('0x1b')]();};}function respondWithResult(_0x4afb93,_0x3b1749){_0x3b1749=_0x3b1749||0xc8;return function(_0x2d9768){if(_0x2d9768){return _0x4afb93[_0xef5e('0x1a')](_0x3b1749)[_0xef5e('0x1c')](_0x2d9768);}};}function respondWithFilteredResult(_0x5632be,_0x44472f){return function(_0x1bc076){if(_0x1bc076){var _0x22132f=typeof _0x44472f[_0xef5e('0x1d')]===_0xef5e('0x1e')&&typeof _0x44472f['limit']===_0xef5e('0x1e');var _0x4f7bf9=_0x1bc076[_0xef5e('0x1f')];var _0x4e0108=_0x22132f?0x0:_0x44472f['offset'];var _0x54b51c=_0x22132f?_0x1bc076[_0xef5e('0x1f')]:_0x44472f['offset']+_0x44472f[_0xef5e('0x20')];var _0xdfa897;if(_0x54b51c>=_0x4f7bf9){_0x54b51c=_0x4f7bf9;_0xdfa897=0xc8;}else{_0xdfa897=0xce;}_0x5632be['status'](_0xdfa897);return _0x5632be[_0xef5e('0x21')](_0xef5e('0x22'),_0x4e0108+'-'+_0x54b51c+'/'+_0x4f7bf9)['json'](_0x1bc076);}return null;};}function patchUpdates(_0x59789f){return function(_0x27fab0){try{jsonpatch[_0xef5e('0x23')](_0x27fab0,_0x59789f,!![]);}catch(_0xee1330){return BPromise[_0xef5e('0x24')](_0xee1330);}return _0x27fab0['save']();};}function saveUpdates(_0x2f6c21,_0x2d9a7b){return function(_0x34dd39){if(_0x34dd39){return _0x34dd39[_0xef5e('0x25')](_0x2f6c21)[_0xef5e('0x26')](function(_0x5af738){return _0x5af738;});}return null;};}function removeEntity(_0x5e11f0,_0x1c09fe){return function(_0x37af88){if(_0x37af88){return _0x37af88[_0xef5e('0x27')]()[_0xef5e('0x26')](function(){_0x5e11f0[_0xef5e('0x1a')](0xcc)[_0xef5e('0x1b')]();});}};}function handleEntityNotFound(_0x52bb35,_0x6792bb){return function(_0x2d411e){if(!_0x2d411e){_0x52bb35[_0xef5e('0x19')](0x194);}return _0x2d411e;};}function handleError(_0x4ad867,_0x5535d9){_0x5535d9=_0x5535d9||0x1f4;return function(_0x37629){logger[_0xef5e('0x28')](_0x37629['stack']);if(_0x37629[_0xef5e('0x29')]){delete _0x37629[_0xef5e('0x29')];}_0x4ad867['status'](_0x5535d9)[_0xef5e('0x2a')](_0x37629);};}exports[_0xef5e('0x2b')]=function(_0x247fc5,_0x94de34){var _0x553607={},_0x37a589={},_0x39313c={'count':0x0,'rows':[]};var _0x8e4625=_[_0xef5e('0x2c')](db[_0xef5e('0x2d')][_0xef5e('0x2e')],function(_0x2175fe){return{'name':_0x2175fe[_0xef5e('0x2f')],'type':_0x2175fe[_0xef5e('0x30')][_0xef5e('0x31')]};});_0x37a589[_0xef5e('0x32')]=_[_0xef5e('0x2c')](_0x8e4625,_0xef5e('0x29'));_0x37a589[_0xef5e('0x33')]=_['keys'](_0x247fc5[_0xef5e('0x33')]);_0x37a589['filters']=_[_0xef5e('0x34')](_0x37a589['model'],_0x37a589[_0xef5e('0x33')]);_0x553607[_0xef5e('0x35')]=_[_0xef5e('0x34')](_0x37a589[_0xef5e('0x32')],qs[_0xef5e('0x36')](_0x247fc5[_0xef5e('0x33')][_0xef5e('0x36')]));_0x553607[_0xef5e('0x35')]=_0x553607[_0xef5e('0x35')][_0xef5e('0x37')]?_0x553607['attributes']:_0x37a589[_0xef5e('0x32')];if(!_0x247fc5[_0xef5e('0x33')]['hasOwnProperty'](_0xef5e('0x38'))){_0x553607[_0xef5e('0x20')]=qs[_0xef5e('0x20')](_0x247fc5['query'][_0xef5e('0x20')]);_0x553607[_0xef5e('0x1d')]=qs[_0xef5e('0x1d')](_0x247fc5[_0xef5e('0x33')][_0xef5e('0x1d')]);}_0x553607[_0xef5e('0x39')]=qs[_0xef5e('0x3a')](_0x247fc5[_0xef5e('0x33')][_0xef5e('0x3a')]);_0x553607['where']=qs['filters'](_[_0xef5e('0x3b')](_0x247fc5[_0xef5e('0x33')],_0x37a589['filters']),_0x8e4625);if(_0x247fc5[_0xef5e('0x33')][_0xef5e('0x3c')]){_0x553607[_0xef5e('0x3d')]=_[_0xef5e('0x3e')](_0x553607['where'],{'$or':_['map'](_0x8e4625,function(_0x2b73a9){if(_0x2b73a9[_0xef5e('0x30')]!=='VIRTUAL'){var _0x1984c3={};_0x1984c3[_0x2b73a9['name']]={'$like':'%'+_0x247fc5['query'][_0xef5e('0x3c')]+'%'};return _0x1984c3;}})});}_0x553607=_[_0xef5e('0x3e')]({},_0x553607,_0x247fc5[_0xef5e('0x3f')]);var _0x3ab145={'where':_0x553607[_0xef5e('0x3d')]};return db[_0xef5e('0x2d')][_0xef5e('0x1f')](_0x3ab145)[_0xef5e('0x26')](function(_0x180b78){_0x39313c[_0xef5e('0x1f')]=_0x180b78;if(_0x247fc5[_0xef5e('0x33')][_0xef5e('0x40')]){_0x553607[_0xef5e('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0xef5e('0x42')](_0x553607);})[_0xef5e('0x26')](function(_0x535fb6){_0x39313c['rows']=_0x535fb6;return _0x39313c;})[_0xef5e('0x26')](respondWithFilteredResult(_0x94de34,_0x553607))[_0xef5e('0x43')](handleError(_0x94de34,null));};exports[_0xef5e('0x44')]=function(_0x2a2a89,_0x5280be){var _0x367816={'raw':!![],'where':{'id':_0x2a2a89['params']['id']}},_0x32cf7c={};_0x32cf7c[_0xef5e('0x32')]=_[_0xef5e('0x45')](db[_0xef5e('0x2d')]['rawAttributes']);_0x32cf7c[_0xef5e('0x33')]=_[_0xef5e('0x45')](_0x2a2a89[_0xef5e('0x33')]);_0x32cf7c[_0xef5e('0x46')]=_['intersection'](_0x32cf7c['model'],_0x32cf7c[_0xef5e('0x33')]);_0x367816[_0xef5e('0x35')]=_['intersection'](_0x32cf7c[_0xef5e('0x32')],qs[_0xef5e('0x36')](_0x2a2a89[_0xef5e('0x33')][_0xef5e('0x36')]));_0x367816['attributes']=_0x367816['attributes'][_0xef5e('0x37')]?_0x367816[_0xef5e('0x35')]:_0x32cf7c['model'];if(_0x2a2a89['query'][_0xef5e('0x40')]){_0x367816[_0xef5e('0x41')]=[{'all':!![]}];}_0x367816=_[_0xef5e('0x3e')]({},_0x367816,_0x2a2a89[_0xef5e('0x3f')]);return db[_0xef5e('0x2d')][_0xef5e('0x47')](_0x367816)[_0xef5e('0x26')](handleEntityNotFound(_0x5280be,null))[_0xef5e('0x26')](respondWithResult(_0x5280be,null))[_0xef5e('0x43')](handleError(_0x5280be,null));};exports['create']=function(_0x1d6754,_0x22bb7c){return db[_0xef5e('0x2d')][_0xef5e('0x48')](_0x1d6754[_0xef5e('0x49')],{})[_0xef5e('0x26')](respondWithResult(_0x22bb7c,0xc9))[_0xef5e('0x43')](handleError(_0x22bb7c,null));};exports[_0xef5e('0x25')]=function(_0x2d1891,_0x41e605){if(_0x2d1891[_0xef5e('0x49')]['id']){delete _0x2d1891[_0xef5e('0x49')]['id'];}return db[_0xef5e('0x2d')][_0xef5e('0x47')]({'where':{'id':_0x2d1891[_0xef5e('0x4a')]['id']}})[_0xef5e('0x26')](handleEntityNotFound(_0x41e605,null))[_0xef5e('0x26')](saveUpdates(_0x2d1891[_0xef5e('0x49')],null))[_0xef5e('0x26')](respondWithResult(_0x41e605,null))[_0xef5e('0x43')](handleError(_0x41e605,null));};exports['destroy']=function(_0x26e466,_0x2b77dd){return db['SalesforceField'][_0xef5e('0x47')]({'where':{'id':_0x26e466[_0xef5e('0x4a')]['id']}})[_0xef5e('0x26')](handleEntityNotFound(_0x2b77dd,null))[_0xef5e('0x26')](removeEntity(_0x2b77dd,null))[_0xef5e('0x43')](handleError(_0x2b77dd,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7a95611..87b9044 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 _0xc085=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0xc085,0x1a3));var _0x5c08=function(_0x734685,_0x321b40){_0x734685=_0x734685-0x0;var _0x59eb29=_0xc085[_0x734685];return _0x59eb29;};'use strict';var _=require(_0x5c08('0x0'));var util=require('util');var logger=require(_0x5c08('0x1'))(_0x5c08('0x2'));var moment=require(_0x5c08('0x3'));var BPromise=require(_0x5c08('0x4'));var rp=require(_0x5c08('0x5'));var fs=require('fs');var path=require(_0x5c08('0x6'));var rimraf=require(_0x5c08('0x7'));var config=require(_0x5c08('0x8'));var attributes=require(_0x5c08('0x9'));module['exports']=function(_0x3a4162,_0x4a1294){return _0x3a4162['define']('SalesforceField',attributes,{'tableName':_0x5c08('0xa'),'paranoid':![],'indexes':[{'name':_0x5c08('0xb'),'fields':[_0x5c08('0xc'),_0x5c08('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde70=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x7f37da,_0x30a906){var _0x474378=function(_0x5f0b57){while(--_0x5f0b57){_0x7f37da['push'](_0x7f37da['shift']());}};_0x474378(++_0x30a906);}(_0xde70,0xad));var _0x0de7=function(_0x12d013,_0x286e4c){_0x12d013=_0x12d013-0x0;var _0x54220c=_0xde70[_0x12d013];return _0x54220c;};'use strict';var _=require(_0x0de7('0x0'));var util=require(_0x0de7('0x1'));var logger=require(_0x0de7('0x2'))('api');var moment=require(_0x0de7('0x3'));var BPromise=require(_0x0de7('0x4'));var rp=require(_0x0de7('0x5'));var fs=require('fs');var path=require(_0x0de7('0x6'));var rimraf=require(_0x0de7('0x7'));var config=require(_0x0de7('0x8'));var attributes=require(_0x0de7('0x9'));module[_0x0de7('0xa')]=function(_0x416614,_0x1abba8){return _0x416614[_0x0de7('0xb')](_0x0de7('0xc'),attributes,{'tableName':_0x0de7('0xd'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x0de7('0xe'),_0x0de7('0xf')],'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 0e0c3ba..3fe3727 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 _0x14b5=['error','message','SalesforceField,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x15059a,_0x30fbe7){var _0x2e9a84=function(_0x692840){while(--_0x692840){_0x15059a['push'](_0x15059a['shift']());}};_0x2e9a84(++_0x30fbe7);}(_0x14b5,0x15b));var _0x514b=function(_0x2017e4,_0x36b3c4){_0x2017e4=_0x2017e4-0x0;var _0x408beb=_0x14b5[_0x2017e4];return _0x408beb;};'use strict';var _=require(_0x514b('0x0'));var util=require('util');var moment=require(_0x514b('0x1'));var BPromise=require(_0x514b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x514b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x514b('0x4'));var config=require(_0x514b('0x5'));var jayson=require(_0x514b('0x6'));var client=jayson[_0x514b('0x7')][_0x514b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1839ad,_0x550acc,_0x3f17f3){return new BPromise(function(_0x351dad,_0x26aa4f){return client[_0x514b('0x9')](_0x1839ad,_0x3f17f3)['then'](function(_0x453a28){logger[_0x514b('0xa')]('SalesforceField,\x20%s,\x20%s',_0x550acc,'request\x20sent');logger[_0x514b('0xb')](_0x514b('0xc'),_0x550acc,_0x514b('0xd'),JSON['stringify'](_0x453a28));if(_0x453a28[_0x514b('0xe')]){if(_0x453a28['error']['code']===0x1f4){logger[_0x514b('0xe')]('SalesforceField,\x20%s,\x20%s',_0x550acc,_0x453a28[_0x514b('0xe')]['message']);return _0x26aa4f(_0x453a28[_0x514b('0xe')][_0x514b('0xf')]);}logger[_0x514b('0xe')](_0x514b('0x10'),_0x550acc,_0x453a28['error'][_0x514b('0xf')]);return _0x351dad(_0x453a28[_0x514b('0xe')][_0x514b('0xf')]);}else{logger[_0x514b('0xa')](_0x514b('0x10'),_0x550acc,_0x514b('0xd'));_0x351dad(_0x453a28[_0x514b('0x11')][_0x514b('0xf')]);}})[_0x514b('0x12')](function(_0x5f32b1){logger[_0x514b('0xe')](_0x514b('0x10'),_0x550acc,_0x5f32b1);_0x26aa4f(_0x5f32b1);});});} \ No newline at end of file +var _0x9d65=['rpc','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','randomstring','ioredis','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9d65,0x1ec));var _0x59d6=function(_0x2d024b,_0x187c75){_0x2d024b=_0x2d024b-0x0;var _0x53411c=_0x9d65[_0x2d024b];return _0x53411c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x59d6('0x0'));var BPromise=require('bluebird');var rs=require(_0x59d6('0x1'));var fs=require('fs');var Redis=require(_0x59d6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x59d6('0x3'));var logger=require('../../config/logger')(_0x59d6('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x86e586,_0xb13c5,_0x18fbc3){return new BPromise(function(_0x7f4970,_0x37d6ec){return client[_0x59d6('0x5')](_0x86e586,_0x18fbc3)[_0x59d6('0x6')](function(_0x8218e4){logger[_0x59d6('0x7')](_0x59d6('0x8'),_0xb13c5,_0x59d6('0x9'));logger[_0x59d6('0xa')](_0x59d6('0xb'),_0xb13c5,_0x59d6('0x9'),JSON[_0x59d6('0xc')](_0x8218e4));if(_0x8218e4[_0x59d6('0xd')]){if(_0x8218e4[_0x59d6('0xd')][_0x59d6('0xe')]===0x1f4){logger[_0x59d6('0xd')](_0x59d6('0x8'),_0xb13c5,_0x8218e4[_0x59d6('0xd')][_0x59d6('0xf')]);return _0x37d6ec(_0x8218e4['error'][_0x59d6('0xf')]);}logger[_0x59d6('0xd')](_0x59d6('0x8'),_0xb13c5,_0x8218e4['error'][_0x59d6('0xf')]);return _0x7f4970(_0x8218e4[_0x59d6('0xd')][_0x59d6('0xf')]);}else{logger[_0x59d6('0x7')](_0x59d6('0x8'),_0xb13c5,_0x59d6('0x9'));_0x7f4970(_0x8218e4['result']['message']);}})['catch'](function(_0x7b90b6){logger[_0x59d6('0xd')](_0x59d6('0x8'),_0xb13c5,_0x7b90b6);_0x37d6ec(_0x7b90b6);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index bd07206..1c77698 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 _0xeb1e=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','post','addConfiguration','put','update','delete'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xeb1e,0x115));var _0xeeb1=function(_0xe0372e,_0x32ae8b){_0xe0372e=_0xe0372e-0x0;var _0x3c56ab=_0xeb1e[_0xe0372e];return _0x3c56ab;};'use strict';var multer=require(_0xeeb1('0x0'));var util=require(_0xeeb1('0x1'));var path=require(_0xeeb1('0x2'));var timeout=require(_0xeeb1('0x3'));var express=require('express');var router=express[_0xeeb1('0x4')]();var fs_extra=require(_0xeeb1('0x5'));var auth=require(_0xeeb1('0x6'));var interaction=require(_0xeeb1('0x7'));var config=require(_0xeeb1('0x8'));var controller=require(_0xeeb1('0x9'));router[_0xeeb1('0xa')]('/',auth['isAuthenticated'](),controller[_0xeeb1('0xb')]);router['get'](_0xeeb1('0xc'),auth[_0xeeb1('0xd')](),controller[_0xeeb1('0xe')]);router[_0xeeb1('0xa')](_0xeeb1('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xeeb1('0x10'),auth[_0xeeb1('0xd')](),controller['getFields']);router['post']('/',auth[_0xeeb1('0xd')](),controller['create']);router[_0xeeb1('0x11')](_0xeeb1('0xf'),auth['isAuthenticated'](),controller[_0xeeb1('0x12')]);router[_0xeeb1('0x13')]('/:id',auth[_0xeeb1('0xd')](),controller[_0xeeb1('0x14')]);router[_0xeeb1('0x15')](_0xeeb1('0xc'),auth['isAuthenticated'](),controller[_0xeeb1('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1b66=['/:id/configurations','addConfiguration','put','/:id','update','delete','express','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','show','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x1b66,0xba));var _0x61b6=function(_0x1bbace,_0x397f64){_0x1bbace=_0x1bbace-0x0;var _0x11383c=_0x1b66[_0x1bbace];return _0x11383c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x61b6('0x0'));var router=express['Router']();var fs_extra=require(_0x61b6('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x61b6('0x2'));var config=require(_0x61b6('0x3'));var controller=require(_0x61b6('0x4'));router[_0x61b6('0x5')]('/',auth['isAuthenticated'](),controller[_0x61b6('0x6')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x61b6('0x7')]);router[_0x61b6('0x5')]('/:id/configurations',auth[_0x61b6('0x8')](),controller[_0x61b6('0x9')]);router[_0x61b6('0x5')](_0x61b6('0xa'),auth[_0x61b6('0x8')](),controller[_0x61b6('0xb')]);router[_0x61b6('0xc')]('/',auth[_0x61b6('0x8')](),controller[_0x61b6('0xd')]);router[_0x61b6('0xc')](_0x61b6('0xe'),auth['isAuthenticated'](),controller[_0x61b6('0xf')]);router[_0x61b6('0x10')](_0x61b6('0x11'),auth[_0x61b6('0x8')](),controller[_0x61b6('0x12')]);router[_0x61b6('0x13')](_0x61b6('0x11'),auth[_0x61b6('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b5cfcdc..1b32268 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 _0xc725=['username','remoteUri','sequelize','exports','STRING'];(function(_0x54eb90,_0x41c420){var _0x2a5d32=function(_0x4c579f){while(--_0x4c579f){_0x54eb90['push'](_0x54eb90['shift']());}};_0x2a5d32(++_0x41c420);}(_0xc725,0x89));var _0x5c72=function(_0xd436c4,_0x298c0b){_0xd436c4=_0xd436c4-0x0;var _0x506952=_0xc725[_0xd436c4];return _0x506952;};'use strict';var Sequelize=require(_0x5c72('0x0'));module[_0x5c72('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5c72('0x2')]},'username':{'type':Sequelize[_0x5c72('0x2')],'unique':_0x5c72('0x3')},'password':{'type':Sequelize[_0x5c72('0x2')]},'email':{'type':Sequelize[_0x5c72('0x2')]},'remoteUri':{'type':Sequelize[_0x5c72('0x2')],'unique':_0x5c72('0x4')},'serverUrl':{'type':Sequelize[_0x5c72('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc682=['username','remoteUri','sequelize','exports','STRING'];(function(_0x1c838c,_0x566c05){var _0x3d256d=function(_0x438e62){while(--_0x438e62){_0x1c838c['push'](_0x1c838c['shift']());}};_0x3d256d(++_0x566c05);}(_0xc682,0xbb));var _0x2c68=function(_0x397d50,_0x57fe53){_0x397d50=_0x397d50-0x0;var _0x4051dc=_0xc682[_0x397d50];return _0x4051dc;};'use strict';var Sequelize=require(_0x2c68('0x0'));module[_0x2c68('0x1')]={'name':{'type':Sequelize[_0x2c68('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2c68('0x2')],'unique':_0x2c68('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x2c68('0x2')]},'remoteUri':{'type':Sequelize[_0x2c68('0x2')],'unique':_0x2c68('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 143aaab..86e0ba5 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 _0xe202=['test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','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','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','reject','save','update','then','error','stack','name','index','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','map','type','options','ServicenowAccount','includeAll','findAll','rows','catch','show','keys','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','severity','parent','watch_list','upon_reject','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','closed_at','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','time_worked','opened_at','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','description','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','reopen_count','escalation','upon_approval','correlation_id','location','category','username','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20'];(function(_0x4b6bee,_0x23f984){var _0x167259=function(_0x419bfc){while(--_0x419bfc){_0x4b6bee['push'](_0x4b6bee['shift']());}};_0x167259(++_0x23f984);}(_0xe202,0xc1));var _0x2e20=function(_0x4ba94e,_0x4a5240){_0x4ba94e=_0x4ba94e-0x0;var _0x476f40=_0xe202[_0x4ba94e];return _0x476f40;};'use strict';var emlformat=require(_0x2e20('0x0'));var rimraf=require(_0x2e20('0x1'));var zipdir=require(_0x2e20('0x2'));var jsonpatch=require(_0x2e20('0x3'));var rp=require(_0x2e20('0x4'));var moment=require(_0x2e20('0x5'));var BPromise=require(_0x2e20('0x6'));var Mustache=require(_0x2e20('0x7'));var util=require(_0x2e20('0x8'));var path=require(_0x2e20('0x9'));var sox=require(_0x2e20('0xa'));var csv=require(_0x2e20('0xb'));var ejs=require(_0x2e20('0xc'));var fs=require('fs');var fs_extra=require(_0x2e20('0xd'));var _=require(_0x2e20('0xe'));var squel=require('squel');var crypto=require(_0x2e20('0xf'));var jsforce=require(_0x2e20('0x10'));var deskjs=require(_0x2e20('0x11'));var toCsv=require(_0x2e20('0xb'));var querystring=require('querystring');var Papa=require(_0x2e20('0x12'));var Redis=require(_0x2e20('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2e20('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e20('0x15'))(_0x2e20('0x16'));var utils=require(_0x2e20('0x17'));var config=require(_0x2e20('0x18'));var licenseUtil=require(_0x2e20('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x118a61,_0x389889){_0x389889=_0x389889||0xcc;return function(_0x2560d7){if(_0x2560d7){return _0x118a61[_0x2e20('0x1a')](_0x389889);}return _0x118a61[_0x2e20('0x1b')](_0x389889)[_0x2e20('0x1c')]();};}function respondWithResult(_0x253bbd,_0x5b9dc1){_0x5b9dc1=_0x5b9dc1||0xc8;return function(_0xe69647){if(_0xe69647){return _0x253bbd[_0x2e20('0x1b')](_0x5b9dc1)[_0x2e20('0x1d')](_0xe69647);}};}function respondWithFilteredResult(_0x1d8831,_0x308c27){return function(_0x19eb05){if(_0x19eb05){var _0x319b36=typeof _0x308c27[_0x2e20('0x1e')]==='undefined'&&typeof _0x308c27[_0x2e20('0x1f')]===_0x2e20('0x20');var _0x1ee1d1=_0x19eb05['count'];var _0x41bf39=_0x319b36?0x0:_0x308c27[_0x2e20('0x1e')];var _0x25b29e=_0x319b36?_0x19eb05[_0x2e20('0x21')]:_0x308c27[_0x2e20('0x1e')]+_0x308c27[_0x2e20('0x1f')];var _0x326247;if(_0x25b29e>=_0x1ee1d1){_0x25b29e=_0x1ee1d1;_0x326247=0xc8;}else{_0x326247=0xce;}_0x1d8831[_0x2e20('0x1b')](_0x326247);return _0x1d8831['set']('Content-Range',_0x41bf39+'-'+_0x25b29e+'/'+_0x1ee1d1)[_0x2e20('0x1d')](_0x19eb05);}return null;};}function patchUpdates(_0x3c6d84){return function(_0x5cc253){try{jsonpatch['apply'](_0x5cc253,_0x3c6d84,!![]);}catch(_0x409899){return BPromise[_0x2e20('0x22')](_0x409899);}return _0x5cc253[_0x2e20('0x23')]();};}function saveUpdates(_0x16c5e6,_0x1125fe){return function(_0x4a8a86){if(_0x4a8a86){return _0x4a8a86[_0x2e20('0x24')](_0x16c5e6)[_0x2e20('0x25')](function(_0x5515c3){return _0x5515c3;});}return null;};}function removeEntity(_0x281f76,_0x1b4f54){return function(_0x5891e8){if(_0x5891e8){return _0x5891e8['destroy']()[_0x2e20('0x25')](function(){_0x281f76[_0x2e20('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x201cbe,_0x476880){return function(_0x1c2384){if(!_0x1c2384){_0x201cbe['sendStatus'](0x194);}return _0x1c2384;};}function handleError(_0x2b7e26,_0x19d0ac){_0x19d0ac=_0x19d0ac||0x1f4;return function(_0x18bcd0){logger[_0x2e20('0x26')](_0x18bcd0[_0x2e20('0x27')]);if(_0x18bcd0[_0x2e20('0x28')]){delete _0x18bcd0['name'];}_0x2b7e26[_0x2e20('0x1b')](_0x19d0ac)['send'](_0x18bcd0);};}exports[_0x2e20('0x29')]=function(_0xe5492b,_0x3dbda5){var _0x4d00a8={},_0x3b06ad={},_0xc337={'count':0x0,'rows':[]};var _0x59eae7=_['map'](db['ServicenowAccount'][_0x2e20('0x2a')],function(_0x1269e){return{'name':_0x1269e[_0x2e20('0x2b')],'type':_0x1269e['type'][_0x2e20('0x2c')]};});_0x3b06ad[_0x2e20('0x2d')]=_['map'](_0x59eae7,_0x2e20('0x28'));_0x3b06ad['query']=_['keys'](_0xe5492b[_0x2e20('0x2e')]);_0x3b06ad[_0x2e20('0x2f')]=_['intersection'](_0x3b06ad[_0x2e20('0x2d')],_0x3b06ad[_0x2e20('0x2e')]);_0x4d00a8['attributes']=_[_0x2e20('0x30')](_0x3b06ad[_0x2e20('0x2d')],qs[_0x2e20('0x31')](_0xe5492b[_0x2e20('0x2e')][_0x2e20('0x31')]));_0x4d00a8[_0x2e20('0x32')]=_0x4d00a8[_0x2e20('0x32')][_0x2e20('0x33')]?_0x4d00a8[_0x2e20('0x32')]:_0x3b06ad[_0x2e20('0x2d')];if(!_0xe5492b[_0x2e20('0x2e')]['hasOwnProperty'](_0x2e20('0x34'))){_0x4d00a8[_0x2e20('0x1f')]=qs[_0x2e20('0x1f')](_0xe5492b[_0x2e20('0x2e')][_0x2e20('0x1f')]);_0x4d00a8[_0x2e20('0x1e')]=qs[_0x2e20('0x1e')](_0xe5492b[_0x2e20('0x2e')][_0x2e20('0x1e')]);}_0x4d00a8[_0x2e20('0x35')]=qs['sort'](_0xe5492b[_0x2e20('0x2e')][_0x2e20('0x36')]);_0x4d00a8['where']=qs[_0x2e20('0x2f')](_[_0x2e20('0x37')](_0xe5492b[_0x2e20('0x2e')],_0x3b06ad['filters']),_0x59eae7);if(_0xe5492b[_0x2e20('0x2e')]['filter']){_0x4d00a8[_0x2e20('0x38')]=_[_0x2e20('0x39')](_0x4d00a8[_0x2e20('0x38')],{'$or':_[_0x2e20('0x3a')](_0x59eae7,function(_0x21468d){if(_0x21468d[_0x2e20('0x3b')]!=='VIRTUAL'){var _0x1aa892={};_0x1aa892[_0x21468d[_0x2e20('0x28')]]={'$like':'%'+_0xe5492b[_0x2e20('0x2e')]['filter']+'%'};return _0x1aa892;}})});}_0x4d00a8=_[_0x2e20('0x39')]({},_0x4d00a8,_0xe5492b[_0x2e20('0x3c')]);var _0x406a48={'where':_0x4d00a8[_0x2e20('0x38')]};return db[_0x2e20('0x3d')][_0x2e20('0x21')](_0x406a48)['then'](function(_0x3a157f){_0xc337[_0x2e20('0x21')]=_0x3a157f;if(_0xe5492b[_0x2e20('0x2e')][_0x2e20('0x3e')]){_0x4d00a8['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0x2e20('0x3f')](_0x4d00a8);})[_0x2e20('0x25')](function(_0x548d26){_0xc337[_0x2e20('0x40')]=_0x548d26;return _0xc337;})[_0x2e20('0x25')](respondWithFilteredResult(_0x3dbda5,_0x4d00a8))[_0x2e20('0x41')](handleError(_0x3dbda5,null));};exports[_0x2e20('0x42')]=function(_0x128631,_0x209424){var _0xfa42b1={'raw':![],'where':{'id':_0x128631['params']['id']}},_0x4bb7a7={};_0x4bb7a7['model']=_[_0x2e20('0x43')](db[_0x2e20('0x3d')][_0x2e20('0x2a')]);_0x4bb7a7[_0x2e20('0x2e')]=_[_0x2e20('0x43')](_0x128631['query']);_0x4bb7a7['filters']=_[_0x2e20('0x30')](_0x4bb7a7[_0x2e20('0x2d')],_0x4bb7a7[_0x2e20('0x2e')]);_0xfa42b1[_0x2e20('0x32')]=_['intersection'](_0x4bb7a7[_0x2e20('0x2d')],qs[_0x2e20('0x31')](_0x128631[_0x2e20('0x2e')][_0x2e20('0x31')]));_0xfa42b1[_0x2e20('0x32')]=_0xfa42b1[_0x2e20('0x32')]['length']?_0xfa42b1[_0x2e20('0x32')]:_0x4bb7a7[_0x2e20('0x2d')];if(_0x128631['query'][_0x2e20('0x3e')]){_0xfa42b1['include']=[{'all':!![]}];}_0xfa42b1=_[_0x2e20('0x39')]({},_0xfa42b1,_0x128631[_0x2e20('0x3c')]);return db[_0x2e20('0x3d')][_0x2e20('0x44')](_0xfa42b1)[_0x2e20('0x25')](handleEntityNotFound(_0x209424,null))[_0x2e20('0x25')](respondWithResult(_0x209424,null))[_0x2e20('0x41')](handleError(_0x209424,null));};exports[_0x2e20('0x45')]=function(_0xaa9c14,_0x46ee06){return db[_0x2e20('0x3d')][_0x2e20('0x45')](_0xaa9c14[_0x2e20('0x46')],{})[_0x2e20('0x25')](respondWithResult(_0x46ee06,0xc9))[_0x2e20('0x41')](handleError(_0x46ee06,null));};exports[_0x2e20('0x24')]=function(_0x1795bf,_0x33e0e6){if(_0x1795bf[_0x2e20('0x46')]['id']){delete _0x1795bf[_0x2e20('0x46')]['id'];}return db[_0x2e20('0x3d')][_0x2e20('0x44')]({'where':{'id':_0x1795bf[_0x2e20('0x47')]['id']}})[_0x2e20('0x25')](handleEntityNotFound(_0x33e0e6,null))[_0x2e20('0x25')](saveUpdates(_0x1795bf[_0x2e20('0x46')],null))[_0x2e20('0x25')](respondWithResult(_0x33e0e6,null))[_0x2e20('0x41')](handleError(_0x33e0e6,null));};exports['destroy']=function(_0x23240f,_0x271533){return db[_0x2e20('0x3d')]['find']({'where':{'id':_0x23240f[_0x2e20('0x47')]['id']}})['then'](handleEntityNotFound(_0x271533,null))['then'](removeEntity(_0x271533,null))[_0x2e20('0x41')](handleError(_0x271533,null));};exports[_0x2e20('0x48')]=function(_0x148c8e,_0x1819e8,_0x437f99){var _0x362634={};var _0x52f50f={};var _0xdf5547;var _0x26d6d9;return db[_0x2e20('0x3d')][_0x2e20('0x49')]({'where':{'id':_0x148c8e[_0x2e20('0x47')]['id']}})['then'](handleEntityNotFound(_0x1819e8,null))['then'](function(_0x3b1e7f){if(_0x3b1e7f){_0xdf5547=_0x3b1e7f;_0x52f50f[_0x2e20('0x2d')]=_['keys'](db[_0x2e20('0x4a')][_0x2e20('0x2a')]);_0x52f50f[_0x2e20('0x2e')]=_[_0x2e20('0x43')](_0x148c8e[_0x2e20('0x2e')]);_0x52f50f[_0x2e20('0x2f')]=_[_0x2e20('0x30')](_0x52f50f[_0x2e20('0x2d')],_0x52f50f[_0x2e20('0x2e')]);_0x362634[_0x2e20('0x32')]=_[_0x2e20('0x30')](_0x52f50f[_0x2e20('0x2d')],qs['fields'](_0x148c8e[_0x2e20('0x2e')][_0x2e20('0x31')]));_0x362634[_0x2e20('0x32')]=_0x362634['attributes']['length']?_0x362634[_0x2e20('0x32')]:_0x52f50f[_0x2e20('0x2d')];_0x362634[_0x2e20('0x35')]=qs[_0x2e20('0x36')](_0x148c8e[_0x2e20('0x2e')]['sort']);_0x362634[_0x2e20('0x38')]=qs[_0x2e20('0x2f')](_['pick'](_0x148c8e[_0x2e20('0x2e')],_0x52f50f[_0x2e20('0x2f')]));if(_0x148c8e[_0x2e20('0x2e')][_0x2e20('0x4b')]){_0x362634[_0x2e20('0x38')]=_[_0x2e20('0x39')](_0x362634[_0x2e20('0x38')],{'$or':_[_0x2e20('0x3a')](_0x362634[_0x2e20('0x32')],function(_0x4975d9){var _0x33f73d={};_0x33f73d[_0x4975d9]={'$like':'%'+_0x148c8e[_0x2e20('0x2e')][_0x2e20('0x4b')]+'%'};return _0x33f73d;})});}_0x362634=_[_0x2e20('0x39')]({},_0x362634,_0x148c8e['options']);return _0xdf5547[_0x2e20('0x48')](_0x362634);}})[_0x2e20('0x25')](function(_0x5d420a){if(_0x5d420a){_0x26d6d9=_0x5d420a[_0x2e20('0x33')];if(!_0x148c8e['query'][_0x2e20('0x4c')](_0x2e20('0x34'))){_0x362634[_0x2e20('0x1f')]=qs['limit'](_0x148c8e[_0x2e20('0x2e')]['limit']);_0x362634[_0x2e20('0x1e')]=qs[_0x2e20('0x1e')](_0x148c8e['query']['offset']);}return _0xdf5547[_0x2e20('0x48')](_0x362634);}})['then'](function(_0x217fda){if(_0x217fda){return _0x217fda?{'count':_0x26d6d9,'rows':_0x217fda}:null;}})[_0x2e20('0x25')](respondWithResult(_0x1819e8,null))['catch'](handleError(_0x1819e8,null));};exports[_0x2e20('0x4d')]=function(_0x26b580,_0x72e06,_0x5056a4){if(_0x26b580[_0x2e20('0x46')]['id']){delete _0x26b580[_0x2e20('0x46')]['id'];}return db[_0x2e20('0x3d')][_0x2e20('0x49')]({'where':{'id':_0x26b580['params']['id']}})[_0x2e20('0x25')](handleEntityNotFound(_0x72e06,null))[_0x2e20('0x25')](function(_0x1fe355){if(_0x1fe355){_0x26b580[_0x2e20('0x46')][_0x2e20('0x4e')]=_0x1fe355['id'];_0x26b580[_0x2e20('0x46')][_0x2e20('0x4f')]=integrations[_0x2e20('0x50')](_0x26b580[_0x2e20('0x46')][_0x2e20('0x51')],_0x26b580[_0x2e20('0x46')]['type']);_0x26b580[_0x2e20('0x46')]['Descriptions']=integrations['getDescriptions'](_0x26b580[_0x2e20('0x46')][_0x2e20('0x51')],_0x26b580['body'][_0x2e20('0x3b')]);return db[_0x2e20('0x4a')][_0x2e20('0x45')](_0x26b580['body'],{'include':[{'model':db[_0x2e20('0x52')],'as':'Subjects'},{'model':db[_0x2e20('0x52')],'as':_0x2e20('0x53')}]});}return null;})[_0x2e20('0x25')](respondWithResult(_0x72e06,null))[_0x2e20('0x41')](handleError(_0x72e06,null));};exports[_0x2e20('0x54')]=function(_0x5d348d,_0x3f15bf,_0x4f695a){var _0x4b5edc=[_0x2e20('0x55'),_0x2e20('0x56'),_0x2e20('0x57'),_0x2e20('0x58'),_0x2e20('0x59'),'notify',_0x2e20('0x5a'),_0x2e20('0x5b'),'category'];var _0x13d2d1=[_0x2e20('0x5c'),_0x2e20('0x55'),'caused_by',_0x2e20('0x5d'),_0x2e20('0x5e'),'sys_updated_on',_0x2e20('0x5f'),'hold_reason','approval_history',_0x2e20('0x60'),_0x2e20('0x61'),_0x2e20('0x62'),_0x2e20('0x63'),_0x2e20('0x64'),_0x2e20('0x65'),'sys_domain',_0x2e20('0x66'),_0x2e20('0x67'),_0x2e20('0x57'),_0x2e20('0x35'),'calendar_stc',_0x2e20('0x68'),'cmdb_ci',_0x2e20('0x69'),_0x2e20('0x6a'),_0x2e20('0x6b'),_0x2e20('0x6c'),_0x2e20('0x6d'),'priority',_0x2e20('0x6e'),'rfc',_0x2e20('0x6f'),'expected_start',_0x2e20('0x70'),'business_duration',_0x2e20('0x71'),'work_end',_0x2e20('0x72'),_0x2e20('0x73'),_0x2e20('0x74'),_0x2e20('0x75'),_0x2e20('0x58'),_0x2e20('0x76'),_0x2e20('0x77'),_0x2e20('0x59'),_0x2e20('0x78'),_0x2e20('0x79'),_0x2e20('0x7a'),'assignment_group',_0x2e20('0x7b'),'additional_assignee_list',_0x2e20('0x7c'),'calendar_duration','notify',_0x2e20('0x7d'),_0x2e20('0x7e'),_0x2e20('0x7f'),'follow_up',_0x2e20('0x80'),_0x2e20('0x81'),_0x2e20('0x82'),_0x2e20('0x83'),'incident_state',_0x2e20('0x84'),'problem_id',_0x2e20('0x85'),_0x2e20('0x86'),_0x2e20('0x87'),_0x2e20('0x88'),'severity',_0x2e20('0x89'),'sla_due',_0x2e20('0x8a'),_0x2e20('0x8b'),_0x2e20('0x8c'),'sys_mod_count',_0x2e20('0x8d'),'sys_tags',_0x2e20('0x8e'),_0x2e20('0x8f'),_0x2e20('0x90'),_0x2e20('0x91'),_0x2e20('0x92')];var _0x4e03b2='';var _0x4500e5='';var _0x413499=[];var _0x38ee56='';var _0x1097a8='';var _0x4870b5=[];var _0x374379='';var _0x25166f='';var _0x3b831c={};var _0x4cfbbd='';return db[_0x2e20('0x3d')][_0x2e20('0x49')]({'where':{'id':_0x5d348d[_0x2e20('0x47')]['id']},'attributes':['id',_0x2e20('0x93'),_0x2e20('0x94'),_0x2e20('0x95'),_0x2e20('0x96'),_0x2e20('0x97')]})[_0x2e20('0x25')](handleEntityNotFound(_0x3f15bf,null))['then'](function(_0x4f61f1){if(_0x4f61f1){_0x4cfbbd=_0x4f61f1['remoteUri'];var _0x219c62=_0x4cfbbd[_0x2e20('0x98')](-0x1);if(_0x219c62==='/'){_0x4cfbbd=_0x4cfbbd[_0x2e20('0x99')](0x0,_0x4cfbbd['lastIndexOf'](_0x219c62));}_0x25166f=util[_0x2e20('0x9a')](_0x2e20('0x9b'),_0x4cfbbd);_0x374379=util[_0x2e20('0x9a')](_0x2e20('0x9c'),_0x4cfbbd);_0x3b831c={'user':_0x4f61f1[_0x2e20('0x93')],'pass':_0x4f61f1[_0x2e20('0x94')]};var _0x2af370={'method':'GET','uri':_0x25166f+_0x2e20('0x9d'),'auth':_0x3b831c,'json':!![]};return rp(_0x2af370);}})['then'](function(_0x21dc46){if(_0x21dc46['result']['length']>0x0){_0x4e03b2=_0x21dc46[_0x2e20('0x9e')];}console['log'](_0x2e20('0x9f'),_0x4e03b2);_0x4870b5=[];_0x4500e5=Object[_0x2e20('0xa0')]([],_0x4e03b2);_[_0x2e20('0xa1')](_0x4500e5,function(_0x244454){return!_0x4b5edc[_0x2e20('0xa2')](_0x244454[_0x2e20('0x28')]);});_0x4500e5[_0x2e20('0xa3')](function(_0x5dee12){var _0x5d5166=createFieldObject(_0x374379,_0x3b831c,_0x5dee12[_0x2e20('0xa4')],_0x5dee12['name'],_0x5dee12[_0x2e20('0xa5')],![]);_0x4870b5[_0x2e20('0xa6')](_0x5d5166);});return Promise[_0x2e20('0xa7')](_0x4870b5);})[_0x2e20('0x25')](function(_0x18574a){_0x413499=_0x18574a;_0x38ee56=Object[_0x2e20('0xa0')]([],_0x4e03b2);console[_0x2e20('0xa8')](_0x2e20('0xa9'),_0x4e03b2);_[_0x2e20('0xa1')](_0x38ee56,function(_0x2bc256){return _0x13d2d1[_0x2e20('0xa2')](_0x2bc256[_0x2e20('0x28')]);});console[_0x2e20('0xa8')](_0x2e20('0xaa'),_0x38ee56);_0x4870b5=[];_0x38ee56[_0x2e20('0xa3')](function(_0x15d466){var _0x297888=createFieldObject(_0x374379,_0x3b831c,_0x15d466[_0x2e20('0xa4')],_0x15d466[_0x2e20('0x28')],_0x15d466[_0x2e20('0xa5')],!![]);_0x4870b5['push'](_0x297888);});return Promise[_0x2e20('0xa7')](_0x4870b5);})[_0x2e20('0x25')](function(_0x27167d){_0x1097a8=_0x27167d;var _0x3b724d=_0x413499[_0x2e20('0xab')](_0x1097a8);return{'count':_0x3b724d[_0x2e20('0x33')],'rows':_0x3b724d};})[_0x2e20('0x25')](respondWithResult(_0x3f15bf,null))[_0x2e20('0x41')](function(_0x3f7176){console[_0x2e20('0xa8')](_0x2e20('0xac')+_0x3f7176);var _0x506cbf=_0x5d348d['query'][_0x2e20('0xad')]?0x1f4:_0x3f7176[_0x2e20('0xae')]||0x1f4;logger['error'](_0x3f7176['stack']);delete _0x3f7176['name'];if(_0x506cbf===0x191){_0x506cbf=0x190;}_0x3f15bf[_0x2e20('0x1b')](_0x506cbf)['send'](_0x5d348d['query'][_0x2e20('0xad')]?{'message':_0x2e20('0xaf'),'statusCode':_0x3f7176['statusCode']}:_0x3f7176);});};function createFieldObject(_0x38143d,_0x260564,_0x396a44,_0x12ece5,_0x41554e,_0x42300e){return new Promise(function(_0x254b28,_0x34ebe2){var _0x16efd9={'id':_0x12ece5,'name':_0x41554e,'custom':_0x42300e};if(_0x396a44===_0x2e20('0xb0')){_0x16efd9['options']=[{'name':_0x2e20('0xb1'),'value':_0x2e20('0xb2')},{'name':_0x2e20('0xb3'),'value':_0x2e20('0xb4')}];_0x254b28(_0x16efd9);}else{var _0x4f8e89={'method':_0x2e20('0xb5'),'uri':_0x38143d+_0x2e20('0xb6')+_0x12ece5,'auth':_0x260564,'json':!![]};return rp(_0x4f8e89)[_0x2e20('0x25')](function(_0x264cc5){var _0x60ce15=[];if(_0x264cc5['result'][_0x2e20('0x33')]>0x0){_0x264cc5['result']['forEach'](function(_0x853eef){if(_0x853eef['inactive']==='false'){var _0x5aab3c={'name':_0x853eef[_0x2e20('0xa5')],'value':_0x853eef['value']};_0x60ce15[_0x2e20('0xa6')](_0x5aab3c);}});}_0x16efd9[_0x2e20('0x3c')]=_0x60ce15;if(_0x16efd9['options']['length']>0x0){_0x254b28(_0x16efd9);}else{if(_0x42300e==![]){_0x254b28();}else{_0x254b28(_0x16efd9);}}});}});} \ No newline at end of file +var _0xfda8=['ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','caller_id','approval_set','short_description','close_code','correlation_display','delivery_task','work_start','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','urgency','problem_id','company','reassignment_count','assigned_to','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','username','GET','incident?sysparm_display_value=all','result','log','assign','forEach','internalType','label','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','stack','Wrong\x20credentials','boolean','true','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ServicenowAccount','rawAttributes','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions'];(function(_0x15d766,_0x4c6081){var _0x3c484f=function(_0x5ae598){while(--_0x5ae598){_0x15d766['push'](_0x15d766['shift']());}};_0x3c484f(++_0x4c6081);}(_0xfda8,0x1d4));var _0x8fda=function(_0x1d0978,_0x4681d5){_0x1d0978=_0x1d0978-0x0;var _0xe394bd=_0xfda8[_0x1d0978];return _0xe394bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8fda('0x0'));var zipdir=require(_0x8fda('0x1'));var jsonpatch=require(_0x8fda('0x2'));var rp=require('request-promise');var moment=require(_0x8fda('0x3'));var BPromise=require(_0x8fda('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8fda('0x5'));var sox=require('sox');var csv=require(_0x8fda('0x6'));var ejs=require(_0x8fda('0x7'));var fs=require('fs');var fs_extra=require(_0x8fda('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8fda('0x9'));var jsforce=require(_0x8fda('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8fda('0x6'));var querystring=require(_0x8fda('0xb'));var Papa=require(_0x8fda('0xc'));var Redis=require(_0x8fda('0xd'));var authService=require(_0x8fda('0xe'));var qs=require(_0x8fda('0xf'));var as=require(_0x8fda('0x10'));var hardwareService=require(_0x8fda('0x11'));var logger=require(_0x8fda('0x12'))(_0x8fda('0x13'));var utils=require('../../config/utils');var config=require(_0x8fda('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8fda('0x15'))['db'];var integrations=require(_0x8fda('0x16'));function respondWithStatusCode(_0x227989,_0x458f15){_0x458f15=_0x458f15||0xcc;return function(_0x1e0d9f){if(_0x1e0d9f){return _0x227989[_0x8fda('0x17')](_0x458f15);}return _0x227989[_0x8fda('0x18')](_0x458f15)[_0x8fda('0x19')]();};}function respondWithResult(_0x1c1743,_0x3c17df){_0x3c17df=_0x3c17df||0xc8;return function(_0x22e36d){if(_0x22e36d){return _0x1c1743[_0x8fda('0x18')](_0x3c17df)[_0x8fda('0x1a')](_0x22e36d);}};}function respondWithFilteredResult(_0x576980,_0x575369){return function(_0x2f5d59){if(_0x2f5d59){var _0x37632a=typeof _0x575369[_0x8fda('0x1b')]===_0x8fda('0x1c')&&typeof _0x575369['limit']===_0x8fda('0x1c');var _0x5d733c=_0x2f5d59[_0x8fda('0x1d')];var _0x548359=_0x37632a?0x0:_0x575369[_0x8fda('0x1b')];var _0x488b06=_0x37632a?_0x2f5d59['count']:_0x575369[_0x8fda('0x1b')]+_0x575369[_0x8fda('0x1e')];var _0x4744b1;if(_0x488b06>=_0x5d733c){_0x488b06=_0x5d733c;_0x4744b1=0xc8;}else{_0x4744b1=0xce;}_0x576980[_0x8fda('0x18')](_0x4744b1);return _0x576980[_0x8fda('0x1f')](_0x8fda('0x20'),_0x548359+'-'+_0x488b06+'/'+_0x5d733c)['json'](_0x2f5d59);}return null;};}function patchUpdates(_0x59c67a){return function(_0x206504){try{jsonpatch[_0x8fda('0x21')](_0x206504,_0x59c67a,!![]);}catch(_0xacfb98){return BPromise[_0x8fda('0x22')](_0xacfb98);}return _0x206504[_0x8fda('0x23')]();};}function saveUpdates(_0xaddd04,_0x3ca895){return function(_0x23589e){if(_0x23589e){return _0x23589e[_0x8fda('0x24')](_0xaddd04)[_0x8fda('0x25')](function(_0x38fe86){return _0x38fe86;});}return null;};}function removeEntity(_0x21b5b8,_0x51402b){return function(_0xe1c166){if(_0xe1c166){return _0xe1c166[_0x8fda('0x26')]()[_0x8fda('0x25')](function(){_0x21b5b8[_0x8fda('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19f083,_0x183a36){return function(_0x3ac886){if(!_0x3ac886){_0x19f083[_0x8fda('0x17')](0x194);}return _0x3ac886;};}function handleError(_0x4ff4c8,_0x16722a){_0x16722a=_0x16722a||0x1f4;return function(_0x2ad17f){logger[_0x8fda('0x27')](_0x2ad17f['stack']);if(_0x2ad17f[_0x8fda('0x28')]){delete _0x2ad17f[_0x8fda('0x28')];}_0x4ff4c8['status'](_0x16722a)[_0x8fda('0x29')](_0x2ad17f);};}exports[_0x8fda('0x2a')]=function(_0x5c5fdf,_0x494878){var _0x583b1b={},_0x599c28={},_0xc1f2bb={'count':0x0,'rows':[]};var _0x3cdb29=_[_0x8fda('0x2b')](db[_0x8fda('0x2c')][_0x8fda('0x2d')],function(_0x280596){return{'name':_0x280596['fieldName'],'type':_0x280596['type'][_0x8fda('0x2e')]};});_0x599c28[_0x8fda('0x2f')]=_[_0x8fda('0x2b')](_0x3cdb29,_0x8fda('0x28'));_0x599c28[_0x8fda('0x30')]=_['keys'](_0x5c5fdf[_0x8fda('0x30')]);_0x599c28[_0x8fda('0x31')]=_['intersection'](_0x599c28[_0x8fda('0x2f')],_0x599c28[_0x8fda('0x30')]);_0x583b1b[_0x8fda('0x32')]=_[_0x8fda('0x33')](_0x599c28[_0x8fda('0x2f')],qs[_0x8fda('0x34')](_0x5c5fdf[_0x8fda('0x30')][_0x8fda('0x34')]));_0x583b1b[_0x8fda('0x32')]=_0x583b1b['attributes']['length']?_0x583b1b[_0x8fda('0x32')]:_0x599c28[_0x8fda('0x2f')];if(!_0x5c5fdf[_0x8fda('0x30')][_0x8fda('0x35')](_0x8fda('0x36'))){_0x583b1b[_0x8fda('0x1e')]=qs[_0x8fda('0x1e')](_0x5c5fdf[_0x8fda('0x30')][_0x8fda('0x1e')]);_0x583b1b[_0x8fda('0x1b')]=qs[_0x8fda('0x1b')](_0x5c5fdf['query'][_0x8fda('0x1b')]);}_0x583b1b['order']=qs[_0x8fda('0x37')](_0x5c5fdf[_0x8fda('0x30')][_0x8fda('0x37')]);_0x583b1b[_0x8fda('0x38')]=qs[_0x8fda('0x31')](_[_0x8fda('0x39')](_0x5c5fdf[_0x8fda('0x30')],_0x599c28[_0x8fda('0x31')]),_0x3cdb29);if(_0x5c5fdf['query']['filter']){_0x583b1b[_0x8fda('0x38')]=_[_0x8fda('0x3a')](_0x583b1b[_0x8fda('0x38')],{'$or':_[_0x8fda('0x2b')](_0x3cdb29,function(_0x52e109){if(_0x52e109[_0x8fda('0x3b')]!==_0x8fda('0x3c')){var _0x12b5c6={};_0x12b5c6[_0x52e109[_0x8fda('0x28')]]={'$like':'%'+_0x5c5fdf[_0x8fda('0x30')][_0x8fda('0x3d')]+'%'};return _0x12b5c6;}})});}_0x583b1b=_[_0x8fda('0x3a')]({},_0x583b1b,_0x5c5fdf[_0x8fda('0x3e')]);var _0x1a5020={'where':_0x583b1b['where']};return db[_0x8fda('0x2c')]['count'](_0x1a5020)['then'](function(_0x2dbd55){_0xc1f2bb['count']=_0x2dbd55;if(_0x5c5fdf[_0x8fda('0x30')][_0x8fda('0x3f')]){_0x583b1b[_0x8fda('0x40')]=[{'all':!![]}];}return db[_0x8fda('0x2c')][_0x8fda('0x41')](_0x583b1b);})[_0x8fda('0x25')](function(_0x57bf66){_0xc1f2bb[_0x8fda('0x42')]=_0x57bf66;return _0xc1f2bb;})[_0x8fda('0x25')](respondWithFilteredResult(_0x494878,_0x583b1b))[_0x8fda('0x43')](handleError(_0x494878,null));};exports['show']=function(_0x5cc9d6,_0x4a8140){var _0x5bd203={'raw':![],'where':{'id':_0x5cc9d6[_0x8fda('0x44')]['id']}},_0x1d94ad={};_0x1d94ad[_0x8fda('0x2f')]=_[_0x8fda('0x45')](db['ServicenowAccount'][_0x8fda('0x2d')]);_0x1d94ad[_0x8fda('0x30')]=_[_0x8fda('0x45')](_0x5cc9d6['query']);_0x1d94ad[_0x8fda('0x31')]=_[_0x8fda('0x33')](_0x1d94ad[_0x8fda('0x2f')],_0x1d94ad[_0x8fda('0x30')]);_0x5bd203['attributes']=_[_0x8fda('0x33')](_0x1d94ad[_0x8fda('0x2f')],qs[_0x8fda('0x34')](_0x5cc9d6[_0x8fda('0x30')][_0x8fda('0x34')]));_0x5bd203[_0x8fda('0x32')]=_0x5bd203['attributes'][_0x8fda('0x46')]?_0x5bd203[_0x8fda('0x32')]:_0x1d94ad[_0x8fda('0x2f')];if(_0x5cc9d6[_0x8fda('0x30')][_0x8fda('0x3f')]){_0x5bd203[_0x8fda('0x40')]=[{'all':!![]}];}_0x5bd203=_[_0x8fda('0x3a')]({},_0x5bd203,_0x5cc9d6['options']);return db[_0x8fda('0x2c')][_0x8fda('0x47')](_0x5bd203)[_0x8fda('0x25')](handleEntityNotFound(_0x4a8140,null))[_0x8fda('0x25')](respondWithResult(_0x4a8140,null))[_0x8fda('0x43')](handleError(_0x4a8140,null));};exports['create']=function(_0x134727,_0x43ad2c){return db[_0x8fda('0x2c')][_0x8fda('0x48')](_0x134727[_0x8fda('0x49')],{})[_0x8fda('0x25')](respondWithResult(_0x43ad2c,0xc9))[_0x8fda('0x43')](handleError(_0x43ad2c,null));};exports['update']=function(_0xc9a854,_0x3fe706){if(_0xc9a854['body']['id']){delete _0xc9a854[_0x8fda('0x49')]['id'];}return db[_0x8fda('0x2c')][_0x8fda('0x47')]({'where':{'id':_0xc9a854[_0x8fda('0x44')]['id']}})['then'](handleEntityNotFound(_0x3fe706,null))[_0x8fda('0x25')](saveUpdates(_0xc9a854[_0x8fda('0x49')],null))[_0x8fda('0x25')](respondWithResult(_0x3fe706,null))[_0x8fda('0x43')](handleError(_0x3fe706,null));};exports[_0x8fda('0x26')]=function(_0x4dd299,_0x46e73d){return db[_0x8fda('0x2c')][_0x8fda('0x47')]({'where':{'id':_0x4dd299[_0x8fda('0x44')]['id']}})['then'](handleEntityNotFound(_0x46e73d,null))['then'](removeEntity(_0x46e73d,null))[_0x8fda('0x43')](handleError(_0x46e73d,null));};exports[_0x8fda('0x4a')]=function(_0x20ffc2,_0x448832,_0xc94b27){var _0x1c1f6e={};var _0x23fcdf={};var _0x33cb16;var _0x3df82d;return db[_0x8fda('0x2c')][_0x8fda('0x4b')]({'where':{'id':_0x20ffc2[_0x8fda('0x44')]['id']}})[_0x8fda('0x25')](handleEntityNotFound(_0x448832,null))[_0x8fda('0x25')](function(_0x40d83a){if(_0x40d83a){_0x33cb16=_0x40d83a;_0x23fcdf[_0x8fda('0x2f')]=_[_0x8fda('0x45')](db[_0x8fda('0x4c')][_0x8fda('0x2d')]);_0x23fcdf['query']=_[_0x8fda('0x45')](_0x20ffc2['query']);_0x23fcdf[_0x8fda('0x31')]=_['intersection'](_0x23fcdf[_0x8fda('0x2f')],_0x23fcdf[_0x8fda('0x30')]);_0x1c1f6e[_0x8fda('0x32')]=_[_0x8fda('0x33')](_0x23fcdf[_0x8fda('0x2f')],qs[_0x8fda('0x34')](_0x20ffc2[_0x8fda('0x30')]['fields']));_0x1c1f6e[_0x8fda('0x32')]=_0x1c1f6e[_0x8fda('0x32')][_0x8fda('0x46')]?_0x1c1f6e[_0x8fda('0x32')]:_0x23fcdf['model'];_0x1c1f6e[_0x8fda('0x4d')]=qs[_0x8fda('0x37')](_0x20ffc2['query']['sort']);_0x1c1f6e[_0x8fda('0x38')]=qs[_0x8fda('0x31')](_[_0x8fda('0x39')](_0x20ffc2[_0x8fda('0x30')],_0x23fcdf[_0x8fda('0x31')]));if(_0x20ffc2[_0x8fda('0x30')][_0x8fda('0x3d')]){_0x1c1f6e[_0x8fda('0x38')]=_[_0x8fda('0x3a')](_0x1c1f6e[_0x8fda('0x38')],{'$or':_[_0x8fda('0x2b')](_0x1c1f6e['attributes'],function(_0x496d72){var _0x5f16f3={};_0x5f16f3[_0x496d72]={'$like':'%'+_0x20ffc2[_0x8fda('0x30')][_0x8fda('0x3d')]+'%'};return _0x5f16f3;})});}_0x1c1f6e=_['merge']({},_0x1c1f6e,_0x20ffc2[_0x8fda('0x3e')]);return _0x33cb16[_0x8fda('0x4a')](_0x1c1f6e);}})['then'](function(_0x4c5330){if(_0x4c5330){_0x3df82d=_0x4c5330['length'];if(!_0x20ffc2[_0x8fda('0x30')][_0x8fda('0x35')](_0x8fda('0x36'))){_0x1c1f6e[_0x8fda('0x1e')]=qs[_0x8fda('0x1e')](_0x20ffc2[_0x8fda('0x30')][_0x8fda('0x1e')]);_0x1c1f6e['offset']=qs[_0x8fda('0x1b')](_0x20ffc2[_0x8fda('0x30')][_0x8fda('0x1b')]);}return _0x33cb16[_0x8fda('0x4a')](_0x1c1f6e);}})[_0x8fda('0x25')](function(_0x3f842c){if(_0x3f842c){return _0x3f842c?{'count':_0x3df82d,'rows':_0x3f842c}:null;}})[_0x8fda('0x25')](respondWithResult(_0x448832,null))[_0x8fda('0x43')](handleError(_0x448832,null));};exports[_0x8fda('0x4e')]=function(_0x54d018,_0xe00425,_0x1d5bd7){if(_0x54d018['body']['id']){delete _0x54d018['body']['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x54d018[_0x8fda('0x44')]['id']}})[_0x8fda('0x25')](handleEntityNotFound(_0xe00425,null))['then'](function(_0x11ab7a){if(_0x11ab7a){_0x54d018[_0x8fda('0x49')]['AccountId']=_0x11ab7a['id'];_0x54d018[_0x8fda('0x49')][_0x8fda('0x4f')]=integrations[_0x8fda('0x50')](_0x54d018[_0x8fda('0x49')][_0x8fda('0x51')],_0x54d018[_0x8fda('0x49')][_0x8fda('0x3b')]);_0x54d018['body'][_0x8fda('0x52')]=integrations[_0x8fda('0x53')](_0x54d018[_0x8fda('0x49')][_0x8fda('0x51')],_0x54d018['body'][_0x8fda('0x3b')]);return db[_0x8fda('0x4c')]['create'](_0x54d018[_0x8fda('0x49')],{'include':[{'model':db[_0x8fda('0x54')],'as':'Subjects'},{'model':db[_0x8fda('0x54')],'as':'Descriptions'}]});}return null;})[_0x8fda('0x25')](respondWithResult(_0xe00425,null))[_0x8fda('0x43')](handleError(_0xe00425,null));};exports[_0x8fda('0x55')]=function(_0x112632,_0x204a93,_0xc34b5f){var _0x1711fa=[_0x8fda('0x56'),_0x8fda('0x57'),_0x8fda('0x58'),_0x8fda('0x59'),'close_code',_0x8fda('0x5a'),_0x8fda('0x5b'),_0x8fda('0x5c'),_0x8fda('0x5d')];var _0x50f004=[_0x8fda('0x5e'),_0x8fda('0x56'),_0x8fda('0x5f'),_0x8fda('0x60'),_0x8fda('0x61'),_0x8fda('0x62'),_0x8fda('0x63'),_0x8fda('0x57'),_0x8fda('0x64'),_0x8fda('0x65'),'resolved_by',_0x8fda('0x66'),_0x8fda('0x67'),_0x8fda('0x68'),_0x8fda('0x69'),_0x8fda('0x6a'),_0x8fda('0x6b'),_0x8fda('0x6c'),_0x8fda('0x58'),_0x8fda('0x4d'),'calendar_stc',_0x8fda('0x6d'),_0x8fda('0x6e'),_0x8fda('0x6f'),_0x8fda('0x70'),_0x8fda('0x71'),'work_notes_list','business_service',_0x8fda('0x72'),_0x8fda('0x73'),_0x8fda('0x74'),_0x8fda('0x75'),_0x8fda('0x76'),_0x8fda('0x77'),_0x8fda('0x78'),'group_list',_0x8fda('0x79'),_0x8fda('0x7a'),'resolved_at',_0x8fda('0x7b'),_0x8fda('0x7c'),_0x8fda('0x59'),'work_notes',_0x8fda('0x7d'),_0x8fda('0x7e'),_0x8fda('0x7f'),_0x8fda('0x80'),_0x8fda('0x81'),'assignment_group','business_stc',_0x8fda('0x82'),'description',_0x8fda('0x83'),'notify',_0x8fda('0x84'),_0x8fda('0x85'),_0x8fda('0x86'),_0x8fda('0x87'),_0x8fda('0x88'),'sys_id','contact_type','reopened_by',_0x8fda('0x5b'),_0x8fda('0x89'),_0x8fda('0x8a'),_0x8fda('0x8b'),_0x8fda('0x8c'),'activity_due',_0x8fda('0x8d'),_0x8fda('0x5c'),'comments',_0x8fda('0x8e'),_0x8fda('0x8f'),_0x8fda('0x90'),'due_date',_0x8fda('0x91'),_0x8fda('0x92'),_0x8fda('0x93'),_0x8fda('0x94'),_0x8fda('0x95'),'correlation_id',_0x8fda('0x96'),'category'];var _0x8b555a='';var _0x44f3c1='';var _0x40c86c=[];var _0x46f08e='';var _0x2958ca='';var _0x3d273e=[];var _0x16aae2='';var _0xbfba4c='';var _0x4eca43={};var _0x482850='';return db[_0x8fda('0x2c')][_0x8fda('0x4b')]({'where':{'id':_0x112632[_0x8fda('0x44')]['id']},'attributes':['id','username',_0x8fda('0x97'),_0x8fda('0x98'),_0x8fda('0x99'),'serverUrl']})['then'](handleEntityNotFound(_0x204a93,null))[_0x8fda('0x25')](function(_0x542b34){if(_0x542b34){_0x482850=_0x542b34[_0x8fda('0x99')];var _0x4e39d1=_0x482850[_0x8fda('0x9a')](-0x1);if(_0x4e39d1==='/'){_0x482850=_0x482850[_0x8fda('0x9b')](0x0,_0x482850[_0x8fda('0x9c')](_0x4e39d1));}_0xbfba4c=util[_0x8fda('0x9d')](_0x8fda('0x9e'),_0x482850);_0x16aae2=util[_0x8fda('0x9d')]('%s/api/now/table/',_0x482850);_0x4eca43={'user':_0x542b34[_0x8fda('0x9f')],'pass':_0x542b34[_0x8fda('0x97')]};var _0x279a5d={'method':_0x8fda('0xa0'),'uri':_0xbfba4c+_0x8fda('0xa1'),'auth':_0x4eca43,'json':!![]};return rp(_0x279a5d);}})[_0x8fda('0x25')](function(_0x5618c7){if(_0x5618c7[_0x8fda('0xa2')][_0x8fda('0x46')]>0x0){_0x8b555a=_0x5618c7['result'];}console[_0x8fda('0xa3')]('incident\x20table\x20objects',_0x8b555a);_0x3d273e=[];_0x44f3c1=Object[_0x8fda('0xa4')]([],_0x8b555a);_['remove'](_0x44f3c1,function(_0x5cb858){return!_0x1711fa['includes'](_0x5cb858[_0x8fda('0x28')]);});_0x44f3c1[_0x8fda('0xa5')](function(_0x1243d0){var _0x48285e=createFieldObject(_0x16aae2,_0x4eca43,_0x1243d0[_0x8fda('0xa6')],_0x1243d0[_0x8fda('0x28')],_0x1243d0[_0x8fda('0xa7')],![]);_0x3d273e[_0x8fda('0xa8')](_0x48285e);});return Promise[_0x8fda('0xa9')](_0x3d273e);})[_0x8fda('0x25')](function(_0x1473cd){_0x40c86c=_0x1473cd;_0x46f08e=Object[_0x8fda('0xa4')]([],_0x8b555a);console['log'](_0x8fda('0xaa'),_0x8b555a);_[_0x8fda('0xab')](_0x46f08e,function(_0xe20367){return _0x50f004['includes'](_0xe20367[_0x8fda('0x28')]);});console['log'](_0x8fda('0xac'),_0x46f08e);_0x3d273e=[];_0x46f08e[_0x8fda('0xa5')](function(_0x192c43){var _0x2cd9f7=createFieldObject(_0x16aae2,_0x4eca43,_0x192c43[_0x8fda('0xa6')],_0x192c43[_0x8fda('0x28')],_0x192c43[_0x8fda('0xa7')],!![]);_0x3d273e['push'](_0x2cd9f7);});return Promise[_0x8fda('0xa9')](_0x3d273e);})['then'](function(_0x2780ba){_0x2958ca=_0x2780ba;var _0x1adf76=_0x40c86c[_0x8fda('0xad')](_0x2958ca);return{'count':_0x1adf76[_0x8fda('0x46')],'rows':_0x1adf76};})[_0x8fda('0x25')](respondWithResult(_0x204a93,null))['catch'](function(_0xa04ac0){console[_0x8fda('0xa3')](_0x8fda('0xae')+_0xa04ac0);var _0x1bfc20=_0x112632[_0x8fda('0x30')][_0x8fda('0xaf')]?0x1f4:_0xa04ac0['statusCode']||0x1f4;logger[_0x8fda('0x27')](_0xa04ac0[_0x8fda('0xb0')]);delete _0xa04ac0[_0x8fda('0x28')];if(_0x1bfc20===0x191){_0x1bfc20=0x190;}_0x204a93[_0x8fda('0x18')](_0x1bfc20)[_0x8fda('0x29')](_0x112632[_0x8fda('0x30')][_0x8fda('0xaf')]?{'message':_0x8fda('0xb1'),'statusCode':_0xa04ac0['statusCode']}:_0xa04ac0);});};function createFieldObject(_0x246ebc,_0x209cfa,_0x1caead,_0x2e0fce,_0x17f360,_0x5f57f9){return new Promise(function(_0x53d12c,_0x239797){var _0x1e790b={'id':_0x2e0fce,'name':_0x17f360,'custom':_0x5f57f9};if(_0x1caead===_0x8fda('0xb2')){_0x1e790b[_0x8fda('0x3e')]=[{'name':'True','value':_0x8fda('0xb3')},{'name':'False','value':'false'}];_0x53d12c(_0x1e790b);}else{var _0xa6bbd8={'method':_0x8fda('0xa0'),'uri':_0x246ebc+_0x8fda('0xb4')+_0x2e0fce,'auth':_0x209cfa,'json':!![]};return rp(_0xa6bbd8)[_0x8fda('0x25')](function(_0x101ede){var _0x1595ec=[];if(_0x101ede['result'][_0x8fda('0x46')]>0x0){_0x101ede[_0x8fda('0xa2')]['forEach'](function(_0x9bff19){if(_0x9bff19[_0x8fda('0xb5')]===_0x8fda('0xb6')){var _0x1a7034={'name':_0x9bff19[_0x8fda('0xa7')],'value':_0x9bff19[_0x8fda('0xb7')]};_0x1595ec['push'](_0x1a7034);}});}_0x1e790b[_0x8fda('0x3e')]=_0x1595ec;if(_0x1e790b[_0x8fda('0x3e')][_0x8fda('0x46')]>0x0){_0x53d12c(_0x1e790b);}else{if(_0x5f57f9==![]){_0x53d12c();}else{_0x53d12c(_0x1e790b);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index ec3ccdf..4509484 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xf494,0x1c6));var _0x4f49=function(_0x587fda,_0x4a532d){_0x587fda=_0x587fda-0x0;var _0x4e3ee1=_0xf494[_0x587fda];return _0x4e3ee1;};'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'));var integrations=require(_0x4f49('0xa'));module[_0x4f49('0xb')]=function(_0x413530,_0x42b0e8){return _0x413530['define']('ServicenowAccount',attributes,{'tableName':_0x4f49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));var integrations=require(_0xac4a('0x8'));module[_0xac4a('0x9')]=function(_0x96be2b,_0x15cd34){return _0x96be2b[_0xac4a('0xa')](_0xac4a('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 534276f..16a53a8 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 _0xc0fd=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x297a2f,_0x861f2){var _0x15f59f=function(_0x55a2b4){while(--_0x55a2b4){_0x297a2f['push'](_0x297a2f['shift']());}};_0x15f59f(++_0x861f2);}(_0xc0fd,0x111));var _0xdc0f=function(_0x432953,_0x1b5232){_0x432953=_0x432953-0x0;var _0x38b376=_0xc0fd[_0x432953];return _0x38b376;};'use strict';var _=require(_0xdc0f('0x0'));var util=require(_0xdc0f('0x1'));var moment=require(_0xdc0f('0x2'));var BPromise=require(_0xdc0f('0x3'));var rs=require(_0xdc0f('0x4'));var fs=require('fs');var Redis=require(_0xdc0f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc0f('0x6'));var logger=require(_0xdc0f('0x7'))(_0xdc0f('0x8'));var config=require(_0xdc0f('0x9'));var jayson=require(_0xdc0f('0xa'));var client=jayson[_0xdc0f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19fc90,_0x1ce5f9,_0x4768f0){return new BPromise(function(_0xf8f09c,_0xaadcda){return client['request'](_0x19fc90,_0x4768f0)[_0xdc0f('0xc')](function(_0x52d952){logger[_0xdc0f('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1ce5f9,_0xdc0f('0xe'));logger[_0xdc0f('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1ce5f9,_0xdc0f('0xe'),JSON[_0xdc0f('0x10')](_0x52d952));if(_0x52d952[_0xdc0f('0x11')]){if(_0x52d952[_0xdc0f('0x11')][_0xdc0f('0x12')]===0x1f4){logger[_0xdc0f('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1ce5f9,_0x52d952[_0xdc0f('0x11')][_0xdc0f('0x13')]);return _0xaadcda(_0x52d952[_0xdc0f('0x11')]['message']);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x1ce5f9,_0x52d952[_0xdc0f('0x11')][_0xdc0f('0x13')]);return _0xf8f09c(_0x52d952[_0xdc0f('0x11')][_0xdc0f('0x13')]);}else{logger['info'](_0xdc0f('0x14'),_0x1ce5f9,_0xdc0f('0xe'));_0xf8f09c(_0x52d952['result'][_0xdc0f('0x13')]);}})[_0xdc0f('0x15')](function(_0x216ae4){logger[_0xdc0f('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1ce5f9,_0x216ae4);_0xaadcda(_0x216ae4);});});}exports[_0xdc0f('0x16')]=function(_0x44e633){var _0x442add=this;return new Promise(function(_0x25bf33,_0x355602){return db[_0xdc0f('0x17')][_0xdc0f('0x18')]({'raw':_0x44e633[_0xdc0f('0x19')]?_0x44e633[_0xdc0f('0x19')][_0xdc0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x44e633[_0xdc0f('0x19')]?_0x44e633[_0xdc0f('0x19')][_0xdc0f('0x1b')]||null:null,'attributes':_0x44e633[_0xdc0f('0x19')]?_0x44e633[_0xdc0f('0x19')][_0xdc0f('0x1c')]||null:null,'limit':_0x44e633[_0xdc0f('0x19')]?_0x44e633[_0xdc0f('0x19')][_0xdc0f('0x1d')]||null:null,'include':_0x44e633['options']?_0x44e633['options'][_0xdc0f('0x1e')]?_['map'](_0x44e633[_0xdc0f('0x19')][_0xdc0f('0x1e')],function(_0xff7098){return{'model':db[_0xff7098['model']],'as':_0xff7098['as'],'attributes':_0xff7098[_0xdc0f('0x1c')],'include':_0xff7098[_0xdc0f('0x1e')]?_[_0xdc0f('0x1f')](_0xff7098[_0xdc0f('0x1e')],function(_0x461749){return{'model':db[_0x461749[_0xdc0f('0x20')]],'as':_0x461749['as'],'attributes':_0x461749[_0xdc0f('0x1c')],'include':_0x461749[_0xdc0f('0x1e')]?_[_0xdc0f('0x1f')](_0x461749[_0xdc0f('0x1e')],function(_0x10f028){return{'model':db[_0x10f028[_0xdc0f('0x20')]],'as':_0x10f028['as'],'attributes':_0x10f028[_0xdc0f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdc0f('0xc')](function(_0x4d6284){logger[_0xdc0f('0xd')](_0xdc0f('0x16'),_0x44e633);logger[_0xdc0f('0xf')](_0xdc0f('0x16'),_0x44e633,JSON[_0xdc0f('0x10')](_0x4d6284));_0x25bf33(_0x4d6284);})[_0xdc0f('0x15')](function(_0x3baf10){logger[_0xdc0f('0x11')](_0xdc0f('0x16'),_0x3baf10[_0xdc0f('0x13')],_0x44e633);_0x355602(_0x442add[_0xdc0f('0x11')](0x1f4,_0x3baf10[_0xdc0f('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x1bd186){var _0x498e5d=this;return new Promise(function(_0x51b5cf,_0x56083b){return db[_0xdc0f('0x17')][_0xdc0f('0x21')]({'raw':_0x1bd186[_0xdc0f('0x19')]?_0x1bd186[_0xdc0f('0x19')][_0xdc0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x1bd186[_0xdc0f('0x19')]?_0x1bd186['options']['where']||null:null,'attributes':_0x1bd186[_0xdc0f('0x19')]?_0x1bd186[_0xdc0f('0x19')][_0xdc0f('0x1c')]||null:null,'include':_0x1bd186[_0xdc0f('0x19')]?_0x1bd186[_0xdc0f('0x19')][_0xdc0f('0x1e')]?_[_0xdc0f('0x1f')](_0x1bd186[_0xdc0f('0x19')][_0xdc0f('0x1e')],function(_0x523655){return{'model':db[_0x523655['model']],'as':_0x523655['as'],'attributes':_0x523655[_0xdc0f('0x1c')],'include':_0x523655[_0xdc0f('0x1e')]?_[_0xdc0f('0x1f')](_0x523655['include'],function(_0x4351e1){return{'model':db[_0x4351e1[_0xdc0f('0x20')]],'as':_0x4351e1['as'],'attributes':_0x4351e1['attributes'],'include':_0x4351e1[_0xdc0f('0x1e')]?_[_0xdc0f('0x1f')](_0x4351e1['include'],function(_0x5c9b12){return{'model':db[_0x5c9b12[_0xdc0f('0x20')]],'as':_0x5c9b12['as'],'attributes':_0x5c9b12['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc0f('0xc')](function(_0xbffea6){logger[_0xdc0f('0xd')]('ShowServicenowAccount',_0x1bd186);logger[_0xdc0f('0xf')](_0xdc0f('0x22'),_0x1bd186,JSON[_0xdc0f('0x10')](_0xbffea6));_0x51b5cf(_0xbffea6);})[_0xdc0f('0x15')](function(_0x4ea098){logger['error'](_0xdc0f('0x22'),_0x4ea098['message'],_0x1bd186);_0x56083b(_0x498e5d[_0xdc0f('0x11')](0x1f4,_0x4ea098[_0xdc0f('0x13')]));});});}; \ No newline at end of file +var _0x1e59=['request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','attributes','limit','map','model','include','then','GetServicenowAccount','ShowServicenowAccount','find','raw','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s'];(function(_0x1bf90a,_0x5e7ee2){var _0x333b7d=function(_0x43fe75){while(--_0x43fe75){_0x1bf90a['push'](_0x1bf90a['shift']());}};_0x333b7d(++_0x5e7ee2);}(_0x1e59,0x121));var _0x91e5=function(_0x1fb466,_0x6dc5d3){_0x1fb466=_0x1fb466-0x0;var _0x774a5c=_0x1e59[_0x1fb466];return _0x774a5c;};'use strict';var _=require(_0x91e5('0x0'));var util=require(_0x91e5('0x1'));var moment=require(_0x91e5('0x2'));var BPromise=require('bluebird');var rs=require(_0x91e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91e5('0x4'))['db'];var utils=require(_0x91e5('0x5'));var logger=require(_0x91e5('0x6'))(_0x91e5('0x7'));var config=require(_0x91e5('0x8'));var jayson=require(_0x91e5('0x9'));var client=jayson[_0x91e5('0xa')][_0x91e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x543697,_0x17afca,_0x45519a){return new BPromise(function(_0x43e15f,_0x480629){return client[_0x91e5('0xc')](_0x543697,_0x45519a)['then'](function(_0x5bae7c){logger[_0x91e5('0xd')](_0x91e5('0xe'),_0x17afca,_0x91e5('0xf'));logger[_0x91e5('0x10')](_0x91e5('0x11'),_0x17afca,_0x91e5('0xf'),JSON[_0x91e5('0x12')](_0x5bae7c));if(_0x5bae7c['error']){if(_0x5bae7c[_0x91e5('0x13')][_0x91e5('0x14')]===0x1f4){logger[_0x91e5('0x13')](_0x91e5('0xe'),_0x17afca,_0x5bae7c['error'][_0x91e5('0x15')]);return _0x480629(_0x5bae7c[_0x91e5('0x13')][_0x91e5('0x15')]);}logger[_0x91e5('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x17afca,_0x5bae7c[_0x91e5('0x13')][_0x91e5('0x15')]);return _0x43e15f(_0x5bae7c['error'][_0x91e5('0x15')]);}else{logger['info'](_0x91e5('0xe'),_0x17afca,'request\x20sent');_0x43e15f(_0x5bae7c[_0x91e5('0x16')][_0x91e5('0x15')]);}})[_0x91e5('0x17')](function(_0x3382fe){logger[_0x91e5('0x13')](_0x91e5('0xe'),_0x17afca,_0x3382fe);_0x480629(_0x3382fe);});});}exports['GetServicenowAccount']=function(_0x1e43cf){var _0x2d5723=this;return new Promise(function(_0x4f224b,_0x3fffd8){return db[_0x91e5('0x18')][_0x91e5('0x19')]({'raw':_0x1e43cf[_0x91e5('0x1a')]?_0x1e43cf[_0x91e5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1e43cf[_0x91e5('0x1a')]?_0x1e43cf[_0x91e5('0x1a')]['where']||null:null,'attributes':_0x1e43cf['options']?_0x1e43cf[_0x91e5('0x1a')][_0x91e5('0x1b')]||null:null,'limit':_0x1e43cf[_0x91e5('0x1a')]?_0x1e43cf[_0x91e5('0x1a')][_0x91e5('0x1c')]||null:null,'include':_0x1e43cf['options']?_0x1e43cf[_0x91e5('0x1a')]['include']?_[_0x91e5('0x1d')](_0x1e43cf[_0x91e5('0x1a')]['include'],function(_0x137d66){return{'model':db[_0x137d66['model']],'as':_0x137d66['as'],'attributes':_0x137d66[_0x91e5('0x1b')],'include':_0x137d66['include']?_['map'](_0x137d66['include'],function(_0x3ac907){return{'model':db[_0x3ac907[_0x91e5('0x1e')]],'as':_0x3ac907['as'],'attributes':_0x3ac907['attributes'],'include':_0x3ac907['include']?_[_0x91e5('0x1d')](_0x3ac907[_0x91e5('0x1f')],function(_0x36acd2){return{'model':db[_0x36acd2[_0x91e5('0x1e')]],'as':_0x36acd2['as'],'attributes':_0x36acd2[_0x91e5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x91e5('0x20')](function(_0x52c9aa){logger[_0x91e5('0xd')](_0x91e5('0x21'),_0x1e43cf);logger[_0x91e5('0x10')](_0x91e5('0x21'),_0x1e43cf,JSON['stringify'](_0x52c9aa));_0x4f224b(_0x52c9aa);})['catch'](function(_0x4a418f){logger[_0x91e5('0x13')](_0x91e5('0x21'),_0x4a418f['message'],_0x1e43cf);_0x3fffd8(_0x2d5723['error'](0x1f4,_0x4a418f[_0x91e5('0x15')]));});});};exports[_0x91e5('0x22')]=function(_0x56aa89){var _0x2880f4=this;return new Promise(function(_0x3452f0,_0x5eadf6){return db[_0x91e5('0x18')][_0x91e5('0x23')]({'raw':_0x56aa89['options']?_0x56aa89['options'][_0x91e5('0x24')]===undefined?!![]:![]:!![],'where':_0x56aa89[_0x91e5('0x1a')]?_0x56aa89[_0x91e5('0x1a')][_0x91e5('0x25')]||null:null,'attributes':_0x56aa89[_0x91e5('0x1a')]?_0x56aa89[_0x91e5('0x1a')][_0x91e5('0x1b')]||null:null,'include':_0x56aa89[_0x91e5('0x1a')]?_0x56aa89[_0x91e5('0x1a')][_0x91e5('0x1f')]?_[_0x91e5('0x1d')](_0x56aa89[_0x91e5('0x1a')][_0x91e5('0x1f')],function(_0x5f3139){return{'model':db[_0x5f3139['model']],'as':_0x5f3139['as'],'attributes':_0x5f3139['attributes'],'include':_0x5f3139[_0x91e5('0x1f')]?_[_0x91e5('0x1d')](_0x5f3139[_0x91e5('0x1f')],function(_0x2bb351){return{'model':db[_0x2bb351['model']],'as':_0x2bb351['as'],'attributes':_0x2bb351[_0x91e5('0x1b')],'include':_0x2bb351['include']?_['map'](_0x2bb351[_0x91e5('0x1f')],function(_0x5b854){return{'model':db[_0x5b854[_0x91e5('0x1e')]],'as':_0x5b854['as'],'attributes':_0x5b854[_0x91e5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x91e5('0x20')](function(_0x4fe652){logger[_0x91e5('0xd')](_0x91e5('0x22'),_0x56aa89);logger['debug'](_0x91e5('0x22'),_0x56aa89,JSON[_0x91e5('0x12')](_0x4fe652));_0x3452f0(_0x4fe652);})[_0x91e5('0x17')](function(_0x59a7d7){logger[_0x91e5('0x13')](_0x91e5('0x22'),_0x59a7d7[_0x91e5('0x15')],_0x56aa89);_0x5eadf6(_0x2880f4[_0x91e5('0x13')](0x1f4,_0x59a7d7[_0x91e5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 48f8758..1dc5c85 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 _0xd393=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','exports'];(function(_0xca6092,_0x227611){var _0x5c43be=function(_0x1ce3a1){while(--_0x1ce3a1){_0xca6092['push'](_0xca6092['shift']());}};_0x5c43be(++_0x227611);}(_0xd393,0x165));var _0x3d39=function(_0x3ee615,_0xf071fd){_0x3ee615=_0x3ee615-0x0;var _0x4795ea=_0xd393[_0x3ee615];return _0x4795ea;};'use strict';var multer=require(_0x3d39('0x0'));var util=require(_0x3d39('0x1'));var path=require(_0x3d39('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d39('0x3'));var router=express[_0x3d39('0x4')]();var fs_extra=require(_0x3d39('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3d39('0x6'));var config=require(_0x3d39('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0x3d39('0x8')]('/',auth['isAuthenticated'](),controller[_0x3d39('0x9')]);router[_0x3d39('0x8')](_0x3d39('0xa'),auth[_0x3d39('0xb')](),controller['show']);router[_0x3d39('0x8')](_0x3d39('0xc'),auth['isAuthenticated'](),controller[_0x3d39('0xd')]);router[_0x3d39('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x3d39('0xe')]);router[_0x3d39('0x8')](_0x3d39('0xf'),auth['isAuthenticated'](),controller[_0x3d39('0x10')]);router[_0x3d39('0x11')]('/',auth[_0x3d39('0xb')](),controller['create']);router[_0x3d39('0x12')](_0x3d39('0xa'),auth[_0x3d39('0xb')](),controller[_0x3d39('0x13')]);router['delete']('/:id',auth[_0x3d39('0xb')](),controller['destroy']);module[_0x3d39('0x14')]=router; \ No newline at end of file +var _0x396a=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x396a,0x104));var _0xa396=function(_0x2843f1,_0x433cd8){_0x2843f1=_0x2843f1-0x0;var _0x3efff0=_0x396a[_0x2843f1];return _0x3efff0;};'use strict';var multer=require(_0xa396('0x0'));var util=require(_0xa396('0x1'));var path=require(_0xa396('0x2'));var timeout=require(_0xa396('0x3'));var express=require(_0xa396('0x4'));var router=express['Router']();var fs_extra=require(_0xa396('0x5'));var auth=require(_0xa396('0x6'));var interaction=require(_0xa396('0x7'));var config=require('../../config/environment');var controller=require(_0xa396('0x8'));router[_0xa396('0x9')]('/',auth[_0xa396('0xa')](),controller[_0xa396('0xb')]);router[_0xa396('0x9')]('/:id',auth[_0xa396('0xa')](),controller[_0xa396('0xc')]);router[_0xa396('0x9')](_0xa396('0xd'),auth['isAuthenticated'](),controller[_0xa396('0xe')]);router[_0xa396('0x9')](_0xa396('0xf'),auth['isAuthenticated'](),controller[_0xa396('0x10')]);router[_0xa396('0x9')](_0xa396('0x11'),auth[_0xa396('0xa')](),controller[_0xa396('0x12')]);router[_0xa396('0x13')]('/',auth[_0xa396('0xa')](),controller[_0xa396('0x14')]);router['put']('/:id',auth[_0xa396('0xa')](),controller[_0xa396('0x15')]);router['delete'](_0xa396('0x16'),auth[_0xa396('0xa')](),controller[_0xa396('0x17')]);module[_0xa396('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 8246675..56d4419 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 _0x1344=['exports','STRING'];(function(_0x5aa6ae,_0x14c1e2){var _0x3d91d1=function(_0x1044eb){while(--_0x1044eb){_0x5aa6ae['push'](_0x5aa6ae['shift']());}};_0x3d91d1(++_0x14c1e2);}(_0x1344,0x1cc));var _0x4134=function(_0x226212,_0x3471a3){_0x226212=_0x226212-0x0;var _0x37e7bf=_0x1344[_0x226212];return _0x37e7bf;};'use strict';var Sequelize=require('sequelize');module[_0x4134('0x0')]={'name':{'type':Sequelize[_0x4134('0x1')]},'description':{'type':Sequelize[_0x4134('0x1')]}}; \ No newline at end of file +var _0x8464=['sequelize','exports','STRING'];(function(_0x1f7120,_0x53456a){var _0x512142=function(_0xae9761){while(--_0xae9761){_0x1f7120['push'](_0x1f7120['shift']());}};_0x512142(++_0x53456a);}(_0x8464,0xcc));var _0x4846=function(_0x5b7070,_0x2ef3e9){_0x5b7070=_0x5b7070-0x0;var _0x582712=_0x8464[_0x5b7070];return _0x582712;};'use strict';var Sequelize=require(_0x4846('0x0'));module[_0x4846('0x1')]={'name':{'type':Sequelize[_0x4846('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 7107859..afda83e 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 _0x9f3e=['update','then','destroy','error','stack','name','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','find','create','body','params','getFields','ServicenowField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x9f3e,0x16f));var _0xe9f3=function(_0x154f1c,_0x557cdb){_0x154f1c=_0x154f1c-0x0;var _0x1c7091=_0x9f3e[_0x154f1c];return _0x1c7091;};'use strict';var emlformat=require(_0xe9f3('0x0'));var rimraf=require(_0xe9f3('0x1'));var zipdir=require(_0xe9f3('0x2'));var jsonpatch=require(_0xe9f3('0x3'));var rp=require('request-promise');var moment=require(_0xe9f3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe9f3('0x5'));var util=require(_0xe9f3('0x6'));var path=require(_0xe9f3('0x7'));var sox=require(_0xe9f3('0x8'));var csv=require('to-csv');var ejs=require(_0xe9f3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f3('0xa'));var squel=require(_0xe9f3('0xb'));var crypto=require(_0xe9f3('0xc'));var jsforce=require(_0xe9f3('0xd'));var deskjs=require(_0xe9f3('0xe'));var toCsv=require(_0xe9f3('0xf'));var querystring=require(_0xe9f3('0x10'));var Papa=require(_0xe9f3('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe9f3('0x12'));var as=require(_0xe9f3('0x13'));var hardwareService=require(_0xe9f3('0x14'));var logger=require(_0xe9f3('0x15'))(_0xe9f3('0x16'));var utils=require(_0xe9f3('0x17'));var config=require(_0xe9f3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f3('0x19'))['db'];function respondWithStatusCode(_0x375158,_0x4d4e53){_0x4d4e53=_0x4d4e53||0xcc;return function(_0x104e5b){if(_0x104e5b){return _0x375158[_0xe9f3('0x1a')](_0x4d4e53);}return _0x375158[_0xe9f3('0x1b')](_0x4d4e53)['end']();};}function respondWithResult(_0x4649a3,_0x166196){_0x166196=_0x166196||0xc8;return function(_0x36922e){if(_0x36922e){return _0x4649a3[_0xe9f3('0x1b')](_0x166196)[_0xe9f3('0x1c')](_0x36922e);}};}function respondWithFilteredResult(_0x566461,_0x3606ac){return function(_0x32f7a4){if(_0x32f7a4){var _0x2437ef=typeof _0x3606ac[_0xe9f3('0x1d')]===_0xe9f3('0x1e')&&typeof _0x3606ac[_0xe9f3('0x1f')]===_0xe9f3('0x1e');var _0x44aabe=_0x32f7a4[_0xe9f3('0x20')];var _0x35a181=_0x2437ef?0x0:_0x3606ac['offset'];var _0x195374=_0x2437ef?_0x32f7a4['count']:_0x3606ac[_0xe9f3('0x1d')]+_0x3606ac['limit'];var _0x1d1e8a;if(_0x195374>=_0x44aabe){_0x195374=_0x44aabe;_0x1d1e8a=0xc8;}else{_0x1d1e8a=0xce;}_0x566461[_0xe9f3('0x1b')](_0x1d1e8a);return _0x566461[_0xe9f3('0x21')](_0xe9f3('0x22'),_0x35a181+'-'+_0x195374+'/'+_0x44aabe)[_0xe9f3('0x1c')](_0x32f7a4);}return null;};}function patchUpdates(_0x47fe74){return function(_0x5b517e){try{jsonpatch[_0xe9f3('0x23')](_0x5b517e,_0x47fe74,!![]);}catch(_0x468974){return BPromise[_0xe9f3('0x24')](_0x468974);}return _0x5b517e[_0xe9f3('0x25')]();};}function saveUpdates(_0x60d737,_0x15c705){return function(_0x5e17b9){if(_0x5e17b9){return _0x5e17b9[_0xe9f3('0x26')](_0x60d737)[_0xe9f3('0x27')](function(_0x188eb3){return _0x188eb3;});}return null;};}function removeEntity(_0x3c0e85,_0x3b9a9d){return function(_0x5055f1){if(_0x5055f1){return _0x5055f1[_0xe9f3('0x28')]()[_0xe9f3('0x27')](function(){_0x3c0e85[_0xe9f3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x276b63,_0x4b7c22){return function(_0x2667d3){if(!_0x2667d3){_0x276b63['sendStatus'](0x194);}return _0x2667d3;};}function handleError(_0x3cb7c2,_0x2853c1){_0x2853c1=_0x2853c1||0x1f4;return function(_0x5f3b0e){logger[_0xe9f3('0x29')](_0x5f3b0e[_0xe9f3('0x2a')]);if(_0x5f3b0e[_0xe9f3('0x2b')]){delete _0x5f3b0e[_0xe9f3('0x2b')];}_0x3cb7c2[_0xe9f3('0x1b')](_0x2853c1)['send'](_0x5f3b0e);};}exports['index']=function(_0x57e7dc,_0x2949fb){var _0x2d222f={},_0xfec403={},_0x4605a1={'count':0x0,'rows':[]};var _0x41d801=_[_0xe9f3('0x2c')](db[_0xe9f3('0x2d')][_0xe9f3('0x2e')],function(_0x4df9fb){return{'name':_0x4df9fb[_0xe9f3('0x2f')],'type':_0x4df9fb[_0xe9f3('0x30')]['key']};});_0xfec403[_0xe9f3('0x31')]=_[_0xe9f3('0x2c')](_0x41d801,_0xe9f3('0x2b'));_0xfec403[_0xe9f3('0x32')]=_[_0xe9f3('0x33')](_0x57e7dc[_0xe9f3('0x32')]);_0xfec403[_0xe9f3('0x34')]=_[_0xe9f3('0x35')](_0xfec403[_0xe9f3('0x31')],_0xfec403[_0xe9f3('0x32')]);_0x2d222f[_0xe9f3('0x36')]=_[_0xe9f3('0x35')](_0xfec403[_0xe9f3('0x31')],qs['fields'](_0x57e7dc[_0xe9f3('0x32')][_0xe9f3('0x37')]));_0x2d222f[_0xe9f3('0x36')]=_0x2d222f[_0xe9f3('0x36')][_0xe9f3('0x38')]?_0x2d222f[_0xe9f3('0x36')]:_0xfec403[_0xe9f3('0x31')];if(!_0x57e7dc[_0xe9f3('0x32')][_0xe9f3('0x39')](_0xe9f3('0x3a'))){_0x2d222f['limit']=qs[_0xe9f3('0x1f')](_0x57e7dc['query'][_0xe9f3('0x1f')]);_0x2d222f[_0xe9f3('0x1d')]=qs[_0xe9f3('0x1d')](_0x57e7dc[_0xe9f3('0x32')][_0xe9f3('0x1d')]);}_0x2d222f[_0xe9f3('0x3b')]=qs[_0xe9f3('0x3c')](_0x57e7dc[_0xe9f3('0x32')][_0xe9f3('0x3c')]);_0x2d222f['where']=qs[_0xe9f3('0x34')](_[_0xe9f3('0x3d')](_0x57e7dc[_0xe9f3('0x32')],_0xfec403[_0xe9f3('0x34')]),_0x41d801);if(_0x57e7dc[_0xe9f3('0x32')]['filter']){_0x2d222f[_0xe9f3('0x3e')]=_['merge'](_0x2d222f[_0xe9f3('0x3e')],{'$or':_[_0xe9f3('0x2c')](_0x41d801,function(_0x50c62d){if(_0x50c62d[_0xe9f3('0x30')]!==_0xe9f3('0x3f')){var _0x2bd91a={};_0x2bd91a[_0x50c62d[_0xe9f3('0x2b')]]={'$like':'%'+_0x57e7dc[_0xe9f3('0x32')][_0xe9f3('0x40')]+'%'};return _0x2bd91a;}})});}_0x2d222f=_[_0xe9f3('0x41')]({},_0x2d222f,_0x57e7dc[_0xe9f3('0x42')]);var _0x24b992={'where':_0x2d222f[_0xe9f3('0x3e')]};return db[_0xe9f3('0x2d')][_0xe9f3('0x20')](_0x24b992)[_0xe9f3('0x27')](function(_0x3ca5b2){_0x4605a1[_0xe9f3('0x20')]=_0x3ca5b2;if(_0x57e7dc[_0xe9f3('0x32')][_0xe9f3('0x43')]){_0x2d222f[_0xe9f3('0x44')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x2d222f);})['then'](function(_0xc38ac8){_0x4605a1[_0xe9f3('0x45')]=_0xc38ac8;return _0x4605a1;})['then'](respondWithFilteredResult(_0x2949fb,_0x2d222f))[_0xe9f3('0x46')](handleError(_0x2949fb,null));};exports[_0xe9f3('0x47')]=function(_0x284214,_0xaa07bf){var _0x713022={'raw':![],'where':{'id':_0x284214['params']['id']}},_0x17743d={};_0x17743d[_0xe9f3('0x31')]=_[_0xe9f3('0x33')](db[_0xe9f3('0x2d')][_0xe9f3('0x2e')]);_0x17743d[_0xe9f3('0x32')]=_[_0xe9f3('0x33')](_0x284214[_0xe9f3('0x32')]);_0x17743d[_0xe9f3('0x34')]=_['intersection'](_0x17743d[_0xe9f3('0x31')],_0x17743d['query']);_0x713022[_0xe9f3('0x36')]=_[_0xe9f3('0x35')](_0x17743d[_0xe9f3('0x31')],qs[_0xe9f3('0x37')](_0x284214[_0xe9f3('0x32')]['fields']));_0x713022[_0xe9f3('0x36')]=_0x713022[_0xe9f3('0x36')][_0xe9f3('0x38')]?_0x713022[_0xe9f3('0x36')]:_0x17743d['model'];if(_0x284214[_0xe9f3('0x32')][_0xe9f3('0x43')]){_0x713022[_0xe9f3('0x44')]=[{'all':!![]}];}_0x713022=_[_0xe9f3('0x41')]({},_0x713022,_0x284214['options']);return db[_0xe9f3('0x2d')][_0xe9f3('0x48')](_0x713022)['then'](handleEntityNotFound(_0xaa07bf,null))[_0xe9f3('0x27')](respondWithResult(_0xaa07bf,null))[_0xe9f3('0x46')](handleError(_0xaa07bf,null));};exports[_0xe9f3('0x49')]=function(_0x21f25e,_0x30ece0){return db['ServicenowConfiguration']['create'](_0x21f25e[_0xe9f3('0x4a')],{})[_0xe9f3('0x27')](respondWithResult(_0x30ece0,0xc9))[_0xe9f3('0x46')](handleError(_0x30ece0,null));};exports[_0xe9f3('0x26')]=function(_0x312f71,_0x1670c1){if(_0x312f71[_0xe9f3('0x4a')]['id']){delete _0x312f71[_0xe9f3('0x4a')]['id'];}return db[_0xe9f3('0x2d')]['find']({'where':{'id':_0x312f71[_0xe9f3('0x4b')]['id']}})[_0xe9f3('0x27')](handleEntityNotFound(_0x1670c1,null))['then'](saveUpdates(_0x312f71[_0xe9f3('0x4a')],null))['then'](respondWithResult(_0x1670c1,null))['catch'](handleError(_0x1670c1,null));};exports['destroy']=function(_0x74c88f,_0xc58e8d){return db['ServicenowConfiguration'][_0xe9f3('0x48')]({'where':{'id':_0x74c88f['params']['id']}})['then'](handleEntityNotFound(_0xc58e8d,null))[_0xe9f3('0x27')](removeEntity(_0xc58e8d,null))[_0xe9f3('0x46')](handleError(_0xc58e8d,null));};exports[_0xe9f3('0x4c')]=function(_0x3aae96,_0x5c5cdf,_0x18744a){var _0x458faf={};var _0x41671a={};var _0x17330e;var _0x9edcd8;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x3aae96[_0xe9f3('0x4b')]['id']}})[_0xe9f3('0x27')](handleEntityNotFound(_0x5c5cdf,null))[_0xe9f3('0x27')](function(_0x59eab7){if(_0x59eab7){_0x17330e=_0x59eab7;_0x41671a[_0xe9f3('0x31')]=_[_0xe9f3('0x33')](db[_0xe9f3('0x4d')]['rawAttributes']);_0x41671a['query']=_[_0xe9f3('0x33')](_0x3aae96[_0xe9f3('0x32')]);_0x41671a[_0xe9f3('0x34')]=_[_0xe9f3('0x35')](_0x41671a['model'],_0x41671a[_0xe9f3('0x32')]);_0x458faf[_0xe9f3('0x36')]=_[_0xe9f3('0x35')](_0x41671a[_0xe9f3('0x31')],qs[_0xe9f3('0x37')](_0x3aae96[_0xe9f3('0x32')]['fields']));_0x458faf[_0xe9f3('0x36')]=_0x458faf[_0xe9f3('0x36')]['length']?_0x458faf[_0xe9f3('0x36')]:_0x41671a[_0xe9f3('0x31')];_0x458faf[_0xe9f3('0x3b')]=qs[_0xe9f3('0x3c')](_0x3aae96['query'][_0xe9f3('0x3c')]);_0x458faf[_0xe9f3('0x3e')]=qs[_0xe9f3('0x34')](_['pick'](_0x3aae96[_0xe9f3('0x32')],_0x41671a[_0xe9f3('0x34')]));if(_0x3aae96[_0xe9f3('0x32')][_0xe9f3('0x40')]){_0x458faf[_0xe9f3('0x3e')]=_[_0xe9f3('0x41')](_0x458faf[_0xe9f3('0x3e')],{'$or':_[_0xe9f3('0x2c')](_0x458faf[_0xe9f3('0x36')],function(_0x13dbf9){var _0x3d3394={};_0x3d3394[_0x13dbf9]={'$like':'%'+_0x3aae96[_0xe9f3('0x32')]['filter']+'%'};return _0x3d3394;})});}_0x458faf=_[_0xe9f3('0x41')]({},_0x458faf,_0x3aae96[_0xe9f3('0x42')]);return _0x17330e['getFields'](_0x458faf);}})[_0xe9f3('0x27')](function(_0x54e85d){if(_0x54e85d){_0x9edcd8=_0x54e85d['length'];if(!_0x3aae96[_0xe9f3('0x32')][_0xe9f3('0x39')](_0xe9f3('0x3a'))){_0x458faf['limit']=qs[_0xe9f3('0x1f')](_0x3aae96[_0xe9f3('0x32')][_0xe9f3('0x1f')]);_0x458faf[_0xe9f3('0x1d')]=qs[_0xe9f3('0x1d')](_0x3aae96[_0xe9f3('0x32')][_0xe9f3('0x1d')]);}return _0x17330e[_0xe9f3('0x4c')](_0x458faf);}})[_0xe9f3('0x27')](function(_0x71ff1b){if(_0x71ff1b){return _0x71ff1b?{'count':_0x9edcd8,'rows':_0x71ff1b}:null;}})[_0xe9f3('0x27')](respondWithResult(_0x5c5cdf,null))['catch'](handleError(_0x5c5cdf,null));};exports[_0xe9f3('0x4e')]=function(_0x4277ed,_0x5b0c4c,_0x314127){var _0x392126={};var _0x4dbbbf={};var _0x33a63a;var _0x441edc;return db[_0xe9f3('0x2d')][_0xe9f3('0x4f')]({'where':{'id':_0x4277ed[_0xe9f3('0x4b')]['id']}})[_0xe9f3('0x27')](handleEntityNotFound(_0x5b0c4c,null))[_0xe9f3('0x27')](function(_0x15ad70){if(_0x15ad70){_0x33a63a=_0x15ad70;_0x4dbbbf[_0xe9f3('0x31')]=_['keys'](db['ServicenowField'][_0xe9f3('0x2e')]);_0x4dbbbf[_0xe9f3('0x32')]=_['keys'](_0x4277ed[_0xe9f3('0x32')]);_0x4dbbbf[_0xe9f3('0x34')]=_[_0xe9f3('0x35')](_0x4dbbbf[_0xe9f3('0x31')],_0x4dbbbf[_0xe9f3('0x32')]);_0x392126['attributes']=_['intersection'](_0x4dbbbf[_0xe9f3('0x31')],qs[_0xe9f3('0x37')](_0x4277ed[_0xe9f3('0x32')][_0xe9f3('0x37')]));_0x392126[_0xe9f3('0x36')]=_0x392126[_0xe9f3('0x36')][_0xe9f3('0x38')]?_0x392126[_0xe9f3('0x36')]:_0x4dbbbf[_0xe9f3('0x31')];_0x392126['order']=qs['sort'](_0x4277ed[_0xe9f3('0x32')][_0xe9f3('0x3c')]);_0x392126[_0xe9f3('0x3e')]=qs[_0xe9f3('0x34')](_['pick'](_0x4277ed[_0xe9f3('0x32')],_0x4dbbbf[_0xe9f3('0x34')]));if(_0x4277ed[_0xe9f3('0x32')][_0xe9f3('0x40')]){_0x392126[_0xe9f3('0x3e')]=_['merge'](_0x392126[_0xe9f3('0x3e')],{'$or':_['map'](_0x392126['attributes'],function(_0x3684c7){var _0xca875a={};_0xca875a[_0x3684c7]={'$like':'%'+_0x4277ed['query']['filter']+'%'};return _0xca875a;})});}_0x392126=_[_0xe9f3('0x41')]({},_0x392126,_0x4277ed[_0xe9f3('0x42')]);return _0x33a63a[_0xe9f3('0x4e')](_0x392126);}})[_0xe9f3('0x27')](function(_0x14420b){if(_0x14420b){_0x441edc=_0x14420b['length'];if(!_0x4277ed[_0xe9f3('0x32')][_0xe9f3('0x39')](_0xe9f3('0x3a'))){_0x392126[_0xe9f3('0x1f')]=qs['limit'](_0x4277ed[_0xe9f3('0x32')]['limit']);_0x392126[_0xe9f3('0x1d')]=qs[_0xe9f3('0x1d')](_0x4277ed[_0xe9f3('0x32')][_0xe9f3('0x1d')]);}return _0x33a63a[_0xe9f3('0x4e')](_0x392126);}})['then'](function(_0x22c321){if(_0x22c321){return _0x22c321?{'count':_0x441edc,'rows':_0x22c321}:null;}})['then'](respondWithResult(_0x5b0c4c,null))[_0xe9f3('0x46')](handleError(_0x5b0c4c,null));};exports[_0xe9f3('0x50')]=function(_0x41c246,_0x44d3d1,_0xd52d03){var _0x20f650={};var _0x345d5f={};var _0x518edc;var _0x17c836;return db[_0xe9f3('0x2d')]['findOne']({'where':{'id':_0x41c246[_0xe9f3('0x4b')]['id']}})[_0xe9f3('0x27')](handleEntityNotFound(_0x44d3d1,null))['then'](function(_0x4fc86a){if(_0x4fc86a){_0x518edc=_0x4fc86a;_0x345d5f[_0xe9f3('0x31')]=_[_0xe9f3('0x33')](db['ServicenowField'][_0xe9f3('0x2e')]);_0x345d5f[_0xe9f3('0x32')]=_[_0xe9f3('0x33')](_0x41c246[_0xe9f3('0x32')]);_0x345d5f['filters']=_[_0xe9f3('0x35')](_0x345d5f[_0xe9f3('0x31')],_0x345d5f[_0xe9f3('0x32')]);_0x20f650[_0xe9f3('0x36')]=_['intersection'](_0x345d5f[_0xe9f3('0x31')],qs[_0xe9f3('0x37')](_0x41c246[_0xe9f3('0x32')][_0xe9f3('0x37')]));_0x20f650[_0xe9f3('0x36')]=_0x20f650[_0xe9f3('0x36')][_0xe9f3('0x38')]?_0x20f650[_0xe9f3('0x36')]:_0x345d5f[_0xe9f3('0x31')];_0x20f650[_0xe9f3('0x3b')]=qs[_0xe9f3('0x3c')](_0x41c246[_0xe9f3('0x32')]['sort']);_0x20f650['where']=qs[_0xe9f3('0x34')](_[_0xe9f3('0x3d')](_0x41c246[_0xe9f3('0x32')],_0x345d5f['filters']));if(_0x41c246[_0xe9f3('0x32')][_0xe9f3('0x40')]){_0x20f650[_0xe9f3('0x3e')]=_[_0xe9f3('0x41')](_0x20f650[_0xe9f3('0x3e')],{'$or':_[_0xe9f3('0x2c')](_0x20f650[_0xe9f3('0x36')],function(_0x15eddc){var _0x5e435b={};_0x5e435b[_0x15eddc]={'$like':'%'+_0x41c246[_0xe9f3('0x32')][_0xe9f3('0x40')]+'%'};return _0x5e435b;})});}_0x20f650=_[_0xe9f3('0x41')]({},_0x20f650,_0x41c246['options']);return _0x518edc['getDescriptions'](_0x20f650);}})[_0xe9f3('0x27')](function(_0x1fb547){if(_0x1fb547){_0x17c836=_0x1fb547['length'];if(!_0x41c246[_0xe9f3('0x32')][_0xe9f3('0x39')](_0xe9f3('0x3a'))){_0x20f650['limit']=qs[_0xe9f3('0x1f')](_0x41c246[_0xe9f3('0x32')]['limit']);_0x20f650[_0xe9f3('0x1d')]=qs[_0xe9f3('0x1d')](_0x41c246[_0xe9f3('0x32')][_0xe9f3('0x1d')]);}return _0x518edc['getDescriptions'](_0x20f650);}})[_0xe9f3('0x27')](function(_0x3246fb){if(_0x3246fb){return _0x3246fb?{'count':_0x17c836,'rows':_0x3246fb}:null;}})[_0xe9f3('0x27')](respondWithResult(_0x44d3d1,null))['catch'](handleError(_0x44d3d1,null));}; \ No newline at end of file +var _0x2168=['find','catch','create','body','update','findOne','ServicenowField','rawAttributes','sort','nolimit','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','VIRTUAL','filter','merge','options','include','rows','show','params','keys','includeAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2168,0x155));var _0x8216=function(_0x1b536b,_0x34813b){_0x1b536b=_0x1b536b-0x0;var _0x2ad193=_0x2168[_0x1b536b];return _0x2ad193;};'use strict';var emlformat=require(_0x8216('0x0'));var rimraf=require(_0x8216('0x1'));var zipdir=require(_0x8216('0x2'));var jsonpatch=require(_0x8216('0x3'));var rp=require(_0x8216('0x4'));var moment=require(_0x8216('0x5'));var BPromise=require(_0x8216('0x6'));var Mustache=require(_0x8216('0x7'));var util=require(_0x8216('0x8'));var path=require(_0x8216('0x9'));var sox=require('sox');var csv=require(_0x8216('0xa'));var ejs=require(_0x8216('0xb'));var fs=require('fs');var fs_extra=require(_0x8216('0xc'));var _=require(_0x8216('0xd'));var squel=require(_0x8216('0xe'));var crypto=require(_0x8216('0xf'));var jsforce=require(_0x8216('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8216('0x11'));var Papa=require(_0x8216('0x12'));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(_0x8216('0x13'));var logger=require(_0x8216('0x14'))('api');var utils=require(_0x8216('0x15'));var config=require(_0x8216('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8216('0x17'))['db'];function respondWithStatusCode(_0x2ea71c,_0x198d6f){_0x198d6f=_0x198d6f||0xcc;return function(_0x246108){if(_0x246108){return _0x2ea71c[_0x8216('0x18')](_0x198d6f);}return _0x2ea71c[_0x8216('0x19')](_0x198d6f)[_0x8216('0x1a')]();};}function respondWithResult(_0x5cd5df,_0x25c889){_0x25c889=_0x25c889||0xc8;return function(_0x7bcda4){if(_0x7bcda4){return _0x5cd5df[_0x8216('0x19')](_0x25c889)['json'](_0x7bcda4);}};}function respondWithFilteredResult(_0x42637f,_0x3af01f){return function(_0x337e8f){if(_0x337e8f){var _0x22c649=typeof _0x3af01f[_0x8216('0x1b')]===_0x8216('0x1c')&&typeof _0x3af01f[_0x8216('0x1d')]===_0x8216('0x1c');var _0x199e48=_0x337e8f[_0x8216('0x1e')];var _0x370ef4=_0x22c649?0x0:_0x3af01f['offset'];var _0x2f91bf=_0x22c649?_0x337e8f[_0x8216('0x1e')]:_0x3af01f[_0x8216('0x1b')]+_0x3af01f['limit'];var _0x22de0a;if(_0x2f91bf>=_0x199e48){_0x2f91bf=_0x199e48;_0x22de0a=0xc8;}else{_0x22de0a=0xce;}_0x42637f[_0x8216('0x19')](_0x22de0a);return _0x42637f[_0x8216('0x1f')](_0x8216('0x20'),_0x370ef4+'-'+_0x2f91bf+'/'+_0x199e48)[_0x8216('0x21')](_0x337e8f);}return null;};}function patchUpdates(_0x26c19d){return function(_0x467bd4){try{jsonpatch[_0x8216('0x22')](_0x467bd4,_0x26c19d,!![]);}catch(_0x1af603){return BPromise[_0x8216('0x23')](_0x1af603);}return _0x467bd4[_0x8216('0x24')]();};}function saveUpdates(_0x47d8e3,_0x2dd86f){return function(_0x1a6449){if(_0x1a6449){return _0x1a6449['update'](_0x47d8e3)[_0x8216('0x25')](function(_0x3aea61){return _0x3aea61;});}return null;};}function removeEntity(_0x255b73,_0x145f99){return function(_0x114b6a){if(_0x114b6a){return _0x114b6a[_0x8216('0x26')]()['then'](function(){_0x255b73[_0x8216('0x19')](0xcc)[_0x8216('0x1a')]();});}};}function handleEntityNotFound(_0xf6c962,_0x30efcb){return function(_0x562a6c){if(!_0x562a6c){_0xf6c962[_0x8216('0x18')](0x194);}return _0x562a6c;};}function handleError(_0x5c0026,_0x59f404){_0x59f404=_0x59f404||0x1f4;return function(_0x15c632){logger[_0x8216('0x27')](_0x15c632[_0x8216('0x28')]);if(_0x15c632[_0x8216('0x29')]){delete _0x15c632['name'];}_0x5c0026['status'](_0x59f404)[_0x8216('0x2a')](_0x15c632);};}exports[_0x8216('0x2b')]=function(_0x2ed2b8,_0x521a36){var _0x26573f={},_0x2f3565={},_0x1e6554={'count':0x0,'rows':[]};var _0x1d9423=_[_0x8216('0x2c')](db[_0x8216('0x2d')]['rawAttributes'],function(_0x31d9cf){return{'name':_0x31d9cf['fieldName'],'type':_0x31d9cf[_0x8216('0x2e')][_0x8216('0x2f')]};});_0x2f3565[_0x8216('0x30')]=_[_0x8216('0x2c')](_0x1d9423,_0x8216('0x29'));_0x2f3565[_0x8216('0x31')]=_['keys'](_0x2ed2b8['query']);_0x2f3565[_0x8216('0x32')]=_[_0x8216('0x33')](_0x2f3565['model'],_0x2f3565[_0x8216('0x31')]);_0x26573f[_0x8216('0x34')]=_[_0x8216('0x33')](_0x2f3565['model'],qs[_0x8216('0x35')](_0x2ed2b8['query']['fields']));_0x26573f['attributes']=_0x26573f[_0x8216('0x34')][_0x8216('0x36')]?_0x26573f['attributes']:_0x2f3565['model'];if(!_0x2ed2b8[_0x8216('0x31')][_0x8216('0x37')]('nolimit')){_0x26573f[_0x8216('0x1d')]=qs[_0x8216('0x1d')](_0x2ed2b8[_0x8216('0x31')][_0x8216('0x1d')]);_0x26573f[_0x8216('0x1b')]=qs[_0x8216('0x1b')](_0x2ed2b8[_0x8216('0x31')]['offset']);}_0x26573f[_0x8216('0x38')]=qs['sort'](_0x2ed2b8[_0x8216('0x31')]['sort']);_0x26573f[_0x8216('0x39')]=qs[_0x8216('0x32')](_[_0x8216('0x3a')](_0x2ed2b8[_0x8216('0x31')],_0x2f3565[_0x8216('0x32')]),_0x1d9423);if(_0x2ed2b8[_0x8216('0x31')]['filter']){_0x26573f[_0x8216('0x39')]=_['merge'](_0x26573f[_0x8216('0x39')],{'$or':_[_0x8216('0x2c')](_0x1d9423,function(_0x21b270){if(_0x21b270['type']!==_0x8216('0x3b')){var _0x26a29a={};_0x26a29a[_0x21b270[_0x8216('0x29')]]={'$like':'%'+_0x2ed2b8['query'][_0x8216('0x3c')]+'%'};return _0x26a29a;}})});}_0x26573f=_[_0x8216('0x3d')]({},_0x26573f,_0x2ed2b8[_0x8216('0x3e')]);var _0x29409b={'where':_0x26573f[_0x8216('0x39')]};return db['ServicenowConfiguration'][_0x8216('0x1e')](_0x29409b)[_0x8216('0x25')](function(_0x5cda2c){_0x1e6554[_0x8216('0x1e')]=_0x5cda2c;if(_0x2ed2b8[_0x8216('0x31')]['includeAll']){_0x26573f[_0x8216('0x3f')]=[{'all':!![]}];}return db[_0x8216('0x2d')]['findAll'](_0x26573f);})[_0x8216('0x25')](function(_0x31d596){_0x1e6554[_0x8216('0x40')]=_0x31d596;return _0x1e6554;})[_0x8216('0x25')](respondWithFilteredResult(_0x521a36,_0x26573f))['catch'](handleError(_0x521a36,null));};exports[_0x8216('0x41')]=function(_0x51287a,_0x2b8fb0){var _0x3a31d3={'raw':![],'where':{'id':_0x51287a[_0x8216('0x42')]['id']}},_0x567c16={};_0x567c16[_0x8216('0x30')]=_['keys'](db[_0x8216('0x2d')]['rawAttributes']);_0x567c16[_0x8216('0x31')]=_[_0x8216('0x43')](_0x51287a[_0x8216('0x31')]);_0x567c16['filters']=_['intersection'](_0x567c16[_0x8216('0x30')],_0x567c16[_0x8216('0x31')]);_0x3a31d3['attributes']=_[_0x8216('0x33')](_0x567c16[_0x8216('0x30')],qs[_0x8216('0x35')](_0x51287a[_0x8216('0x31')][_0x8216('0x35')]));_0x3a31d3[_0x8216('0x34')]=_0x3a31d3[_0x8216('0x34')][_0x8216('0x36')]?_0x3a31d3[_0x8216('0x34')]:_0x567c16[_0x8216('0x30')];if(_0x51287a[_0x8216('0x31')][_0x8216('0x44')]){_0x3a31d3['include']=[{'all':!![]}];}_0x3a31d3=_['merge']({},_0x3a31d3,_0x51287a['options']);return db[_0x8216('0x2d')][_0x8216('0x45')](_0x3a31d3)[_0x8216('0x25')](handleEntityNotFound(_0x2b8fb0,null))[_0x8216('0x25')](respondWithResult(_0x2b8fb0,null))[_0x8216('0x46')](handleError(_0x2b8fb0,null));};exports[_0x8216('0x47')]=function(_0x49fab7,_0x1caebc){return db[_0x8216('0x2d')][_0x8216('0x47')](_0x49fab7[_0x8216('0x48')],{})[_0x8216('0x25')](respondWithResult(_0x1caebc,0xc9))['catch'](handleError(_0x1caebc,null));};exports[_0x8216('0x49')]=function(_0xbc5902,_0x416d3a){if(_0xbc5902[_0x8216('0x48')]['id']){delete _0xbc5902[_0x8216('0x48')]['id'];}return db[_0x8216('0x2d')][_0x8216('0x45')]({'where':{'id':_0xbc5902[_0x8216('0x42')]['id']}})[_0x8216('0x25')](handleEntityNotFound(_0x416d3a,null))[_0x8216('0x25')](saveUpdates(_0xbc5902[_0x8216('0x48')],null))[_0x8216('0x25')](respondWithResult(_0x416d3a,null))[_0x8216('0x46')](handleError(_0x416d3a,null));};exports[_0x8216('0x26')]=function(_0x467d7f,_0x44ac7f){return db[_0x8216('0x2d')][_0x8216('0x45')]({'where':{'id':_0x467d7f['params']['id']}})['then'](handleEntityNotFound(_0x44ac7f,null))['then'](removeEntity(_0x44ac7f,null))[_0x8216('0x46')](handleError(_0x44ac7f,null));};exports['getFields']=function(_0x373039,_0x1d944b,_0x2decb8){var _0x27a1d6={};var _0x55a848={};var _0x592dc8;var _0x1b3a04;return db[_0x8216('0x2d')][_0x8216('0x4a')]({'where':{'id':_0x373039[_0x8216('0x42')]['id']}})['then'](handleEntityNotFound(_0x1d944b,null))[_0x8216('0x25')](function(_0x47d2aa){if(_0x47d2aa){_0x592dc8=_0x47d2aa;_0x55a848[_0x8216('0x30')]=_[_0x8216('0x43')](db[_0x8216('0x4b')][_0x8216('0x4c')]);_0x55a848['query']=_[_0x8216('0x43')](_0x373039['query']);_0x55a848[_0x8216('0x32')]=_[_0x8216('0x33')](_0x55a848['model'],_0x55a848['query']);_0x27a1d6[_0x8216('0x34')]=_['intersection'](_0x55a848['model'],qs[_0x8216('0x35')](_0x373039[_0x8216('0x31')][_0x8216('0x35')]));_0x27a1d6[_0x8216('0x34')]=_0x27a1d6['attributes'][_0x8216('0x36')]?_0x27a1d6[_0x8216('0x34')]:_0x55a848['model'];_0x27a1d6['order']=qs[_0x8216('0x4d')](_0x373039[_0x8216('0x31')]['sort']);_0x27a1d6[_0x8216('0x39')]=qs[_0x8216('0x32')](_[_0x8216('0x3a')](_0x373039[_0x8216('0x31')],_0x55a848[_0x8216('0x32')]));if(_0x373039[_0x8216('0x31')][_0x8216('0x3c')]){_0x27a1d6[_0x8216('0x39')]=_[_0x8216('0x3d')](_0x27a1d6['where'],{'$or':_[_0x8216('0x2c')](_0x27a1d6[_0x8216('0x34')],function(_0xef2514){var _0x50f751={};_0x50f751[_0xef2514]={'$like':'%'+_0x373039[_0x8216('0x31')][_0x8216('0x3c')]+'%'};return _0x50f751;})});}_0x27a1d6=_['merge']({},_0x27a1d6,_0x373039['options']);return _0x592dc8['getFields'](_0x27a1d6);}})[_0x8216('0x25')](function(_0x318923){if(_0x318923){_0x1b3a04=_0x318923[_0x8216('0x36')];if(!_0x373039[_0x8216('0x31')][_0x8216('0x37')](_0x8216('0x4e'))){_0x27a1d6[_0x8216('0x1d')]=qs[_0x8216('0x1d')](_0x373039[_0x8216('0x31')][_0x8216('0x1d')]);_0x27a1d6[_0x8216('0x1b')]=qs[_0x8216('0x1b')](_0x373039['query'][_0x8216('0x1b')]);}return _0x592dc8[_0x8216('0x4f')](_0x27a1d6);}})[_0x8216('0x25')](function(_0x4ad703){if(_0x4ad703){return _0x4ad703?{'count':_0x1b3a04,'rows':_0x4ad703}:null;}})[_0x8216('0x25')](respondWithResult(_0x1d944b,null))[_0x8216('0x46')](handleError(_0x1d944b,null));};exports['getSubjects']=function(_0x3b008a,_0x48cbb,_0x5471dd){var _0x30be6c={};var _0x1ce6b6={};var _0x1fd959;var _0x36d8d2;return db[_0x8216('0x2d')][_0x8216('0x4a')]({'where':{'id':_0x3b008a[_0x8216('0x42')]['id']}})[_0x8216('0x25')](handleEntityNotFound(_0x48cbb,null))[_0x8216('0x25')](function(_0x249a40){if(_0x249a40){_0x1fd959=_0x249a40;_0x1ce6b6[_0x8216('0x30')]=_[_0x8216('0x43')](db[_0x8216('0x4b')]['rawAttributes']);_0x1ce6b6['query']=_[_0x8216('0x43')](_0x3b008a[_0x8216('0x31')]);_0x1ce6b6['filters']=_[_0x8216('0x33')](_0x1ce6b6['model'],_0x1ce6b6[_0x8216('0x31')]);_0x30be6c['attributes']=_[_0x8216('0x33')](_0x1ce6b6['model'],qs[_0x8216('0x35')](_0x3b008a[_0x8216('0x31')][_0x8216('0x35')]));_0x30be6c[_0x8216('0x34')]=_0x30be6c[_0x8216('0x34')][_0x8216('0x36')]?_0x30be6c[_0x8216('0x34')]:_0x1ce6b6[_0x8216('0x30')];_0x30be6c[_0x8216('0x38')]=qs['sort'](_0x3b008a[_0x8216('0x31')][_0x8216('0x4d')]);_0x30be6c[_0x8216('0x39')]=qs[_0x8216('0x32')](_[_0x8216('0x3a')](_0x3b008a[_0x8216('0x31')],_0x1ce6b6[_0x8216('0x32')]));if(_0x3b008a[_0x8216('0x31')][_0x8216('0x3c')]){_0x30be6c[_0x8216('0x39')]=_[_0x8216('0x3d')](_0x30be6c[_0x8216('0x39')],{'$or':_[_0x8216('0x2c')](_0x30be6c[_0x8216('0x34')],function(_0x1b399e){var _0x22bcba={};_0x22bcba[_0x1b399e]={'$like':'%'+_0x3b008a[_0x8216('0x31')][_0x8216('0x3c')]+'%'};return _0x22bcba;})});}_0x30be6c=_[_0x8216('0x3d')]({},_0x30be6c,_0x3b008a[_0x8216('0x3e')]);return _0x1fd959['getSubjects'](_0x30be6c);}})[_0x8216('0x25')](function(_0x523651){if(_0x523651){_0x36d8d2=_0x523651[_0x8216('0x36')];if(!_0x3b008a[_0x8216('0x31')]['hasOwnProperty']('nolimit')){_0x30be6c[_0x8216('0x1d')]=qs[_0x8216('0x1d')](_0x3b008a[_0x8216('0x31')][_0x8216('0x1d')]);_0x30be6c[_0x8216('0x1b')]=qs[_0x8216('0x1b')](_0x3b008a[_0x8216('0x31')]['offset']);}return _0x1fd959[_0x8216('0x50')](_0x30be6c);}})[_0x8216('0x25')](function(_0x5f510b){if(_0x5f510b){return _0x5f510b?{'count':_0x36d8d2,'rows':_0x5f510b}:null;}})[_0x8216('0x25')](respondWithResult(_0x48cbb,null))[_0x8216('0x46')](handleError(_0x48cbb,null));};exports[_0x8216('0x51')]=function(_0x110ecf,_0x375e4c,_0x209b46){var _0x464267={};var _0xe15004={};var _0x5d7815;var _0x5dc198;return db[_0x8216('0x2d')][_0x8216('0x4a')]({'where':{'id':_0x110ecf[_0x8216('0x42')]['id']}})[_0x8216('0x25')](handleEntityNotFound(_0x375e4c,null))['then'](function(_0xa4ab58){if(_0xa4ab58){_0x5d7815=_0xa4ab58;_0xe15004[_0x8216('0x30')]=_['keys'](db['ServicenowField'][_0x8216('0x4c')]);_0xe15004[_0x8216('0x31')]=_[_0x8216('0x43')](_0x110ecf[_0x8216('0x31')]);_0xe15004['filters']=_[_0x8216('0x33')](_0xe15004[_0x8216('0x30')],_0xe15004[_0x8216('0x31')]);_0x464267[_0x8216('0x34')]=_[_0x8216('0x33')](_0xe15004[_0x8216('0x30')],qs[_0x8216('0x35')](_0x110ecf[_0x8216('0x31')][_0x8216('0x35')]));_0x464267[_0x8216('0x34')]=_0x464267[_0x8216('0x34')][_0x8216('0x36')]?_0x464267[_0x8216('0x34')]:_0xe15004['model'];_0x464267['order']=qs[_0x8216('0x4d')](_0x110ecf[_0x8216('0x31')][_0x8216('0x4d')]);_0x464267[_0x8216('0x39')]=qs[_0x8216('0x32')](_[_0x8216('0x3a')](_0x110ecf[_0x8216('0x31')],_0xe15004[_0x8216('0x32')]));if(_0x110ecf[_0x8216('0x31')]['filter']){_0x464267[_0x8216('0x39')]=_[_0x8216('0x3d')](_0x464267[_0x8216('0x39')],{'$or':_[_0x8216('0x2c')](_0x464267[_0x8216('0x34')],function(_0x4c1a96){var _0x5757fd={};_0x5757fd[_0x4c1a96]={'$like':'%'+_0x110ecf[_0x8216('0x31')]['filter']+'%'};return _0x5757fd;})});}_0x464267=_[_0x8216('0x3d')]({},_0x464267,_0x110ecf['options']);return _0x5d7815[_0x8216('0x51')](_0x464267);}})[_0x8216('0x25')](function(_0x1e9353){if(_0x1e9353){_0x5dc198=_0x1e9353[_0x8216('0x36')];if(!_0x110ecf['query']['hasOwnProperty'](_0x8216('0x4e'))){_0x464267[_0x8216('0x1d')]=qs[_0x8216('0x1d')](_0x110ecf['query'][_0x8216('0x1d')]);_0x464267[_0x8216('0x1b')]=qs[_0x8216('0x1b')](_0x110ecf[_0x8216('0x31')][_0x8216('0x1b')]);}return _0x5d7815['getDescriptions'](_0x464267);}})['then'](function(_0x12cfee){if(_0x12cfee){return _0x12cfee?{'count':_0x5dc198,'rows':_0x12cfee}:null;}})[_0x8216('0x25')](respondWithResult(_0x375e4c,null))[_0x8216('0x46')](handleError(_0x375e4c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 30c0785..84baaf1 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 _0xd48a=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','int_servicenow_configurations'];(function(_0x33ef42,_0x452e3f){var _0x5d9057=function(_0x1d1dc7){while(--_0x1d1dc7){_0x33ef42['push'](_0x33ef42['shift']());}};_0x5d9057(++_0x452e3f);}(_0xd48a,0x96));var _0xad48=function(_0x393dc7,_0x5338c8){_0x393dc7=_0x393dc7-0x0;var _0x432acb=_0xd48a[_0x393dc7];return _0x432acb;};'use strict';var _=require(_0xad48('0x0'));var util=require('util');var logger=require(_0xad48('0x1'))(_0xad48('0x2'));var moment=require(_0xad48('0x3'));var BPromise=require(_0xad48('0x4'));var rp=require(_0xad48('0x5'));var fs=require('fs');var path=require(_0xad48('0x6'));var rimraf=require('rimraf');var config=require(_0xad48('0x7'));var attributes=require(_0xad48('0x8'));module['exports']=function(_0x143780,_0x584cf0){return _0x143780['define']('ServicenowConfiguration',attributes,{'tableName':_0xad48('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ea2=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0x5ea2,0x99));var _0x25ea=function(_0x34c35e,_0x173be4){_0x34c35e=_0x34c35e-0x0;var _0x22d26e=_0x5ea2[_0x34c35e];return _0x22d26e;};'use strict';var _=require(_0x25ea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x25ea('0x1'));var moment=require(_0x25ea('0x2'));var BPromise=require(_0x25ea('0x3'));var rp=require(_0x25ea('0x4'));var fs=require('fs');var path=require(_0x25ea('0x5'));var rimraf=require('rimraf');var config=require(_0x25ea('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x3e32e9,_0x310a27){return _0x3e32e9[_0x25ea('0x7')](_0x25ea('0x8'),attributes,{'tableName':_0x25ea('0x9'),'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 a4db921..b8921b8 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 _0x133b=['error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0x133b,0x101));var _0xb133=function(_0x4f65ed,_0x2cd830){_0x4f65ed=_0x4f65ed-0x0;var _0x2d9d39=_0x133b[_0x4f65ed];return _0x2d9d39;};'use strict';var _=require(_0xb133('0x0'));var util=require(_0xb133('0x1'));var moment=require(_0xb133('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb133('0x3'));var db=require(_0xb133('0x4'))['db'];var utils=require(_0xb133('0x5'));var logger=require('../../config/logger')(_0xb133('0x6'));var config=require(_0xb133('0x7'));var jayson=require(_0xb133('0x8'));var client=jayson['client'][_0xb133('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x96cf09,_0xefc7d,_0x36ddea){return new BPromise(function(_0x7016eb,_0x5380f6){return client[_0xb133('0xa')](_0x96cf09,_0x36ddea)[_0xb133('0xb')](function(_0x428388){logger[_0xb133('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0xefc7d,_0xb133('0xd'));logger[_0xb133('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0xefc7d,_0xb133('0xd'),JSON[_0xb133('0xf')](_0x428388));if(_0x428388[_0xb133('0x10')]){if(_0x428388[_0xb133('0x10')][_0xb133('0x11')]===0x1f4){logger['error'](_0xb133('0x12'),_0xefc7d,_0x428388[_0xb133('0x10')][_0xb133('0x13')]);return _0x5380f6(_0x428388['error'][_0xb133('0x13')]);}logger[_0xb133('0x10')](_0xb133('0x12'),_0xefc7d,_0x428388['error'][_0xb133('0x13')]);return _0x7016eb(_0x428388[_0xb133('0x10')][_0xb133('0x13')]);}else{logger[_0xb133('0xc')](_0xb133('0x12'),_0xefc7d,'request\x20sent');_0x7016eb(_0x428388[_0xb133('0x14')][_0xb133('0x13')]);}})['catch'](function(_0xbb89ae){logger[_0xb133('0x10')](_0xb133('0x12'),_0xefc7d,_0xbb89ae);_0x5380f6(_0xbb89ae);});});} \ No newline at end of file +var _0x75e9=['../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x4264bf,_0x39db0f){var _0x515e5f=function(_0x130168){while(--_0x130168){_0x4264bf['push'](_0x4264bf['shift']());}};_0x515e5f(++_0x39db0f);}(_0x75e9,0x152));var _0x975e=function(_0x127bc7,_0x436710){_0x127bc7=_0x127bc7-0x0;var _0x1420c2=_0x75e9[_0x127bc7];return _0x1420c2;};'use strict';var _=require(_0x975e('0x0'));var util=require(_0x975e('0x1'));var moment=require(_0x975e('0x2'));var BPromise=require(_0x975e('0x3'));var rs=require(_0x975e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x975e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x975e('0x6'));var config=require(_0x975e('0x7'));var jayson=require(_0x975e('0x8'));var client=jayson[_0x975e('0x9')][_0x975e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e4a96,_0x15fa04,_0x2fa4c8){return new BPromise(function(_0x55a78a,_0x5d31a7){return client[_0x975e('0xb')](_0x1e4a96,_0x2fa4c8)[_0x975e('0xc')](function(_0x54669a){logger[_0x975e('0xd')](_0x975e('0xe'),_0x15fa04,_0x975e('0xf'));logger[_0x975e('0x10')](_0x975e('0x11'),_0x15fa04,_0x975e('0xf'),JSON[_0x975e('0x12')](_0x54669a));if(_0x54669a[_0x975e('0x13')]){if(_0x54669a[_0x975e('0x13')][_0x975e('0x14')]===0x1f4){logger[_0x975e('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x15fa04,_0x54669a['error']['message']);return _0x5d31a7(_0x54669a[_0x975e('0x13')][_0x975e('0x15')]);}logger[_0x975e('0x13')](_0x975e('0xe'),_0x15fa04,_0x54669a[_0x975e('0x13')][_0x975e('0x15')]);return _0x55a78a(_0x54669a[_0x975e('0x13')][_0x975e('0x15')]);}else{logger[_0x975e('0xd')](_0x975e('0xe'),_0x15fa04,_0x975e('0xf'));_0x55a78a(_0x54669a[_0x975e('0x16')][_0x975e('0x15')]);}})['catch'](function(_0x20ee11){logger[_0x975e('0x13')](_0x975e('0xe'),_0x15fa04,_0x20ee11);_0x5d31a7(_0x20ee11);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 5ffe9fe..bc47d07 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 _0x23ed=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x23ed,0x1b6));var _0xd23e=function(_0x1ea6eb,_0x108e77){_0x1ea6eb=_0x1ea6eb-0x0;var _0x24f28c=_0x23ed[_0x1ea6eb];return _0x24f28c;};'use strict';var multer=require(_0xd23e('0x0'));var util=require(_0xd23e('0x1'));var path=require(_0xd23e('0x2'));var timeout=require(_0xd23e('0x3'));var express=require(_0xd23e('0x4'));var router=express[_0xd23e('0x5')]();var fs_extra=require(_0xd23e('0x6'));var auth=require(_0xd23e('0x7'));var interaction=require(_0xd23e('0x8'));var config=require(_0xd23e('0x9'));var controller=require(_0xd23e('0xa'));router['get']('/',auth[_0xd23e('0xb')](),controller[_0xd23e('0xc')]);router[_0xd23e('0xd')](_0xd23e('0xe'),auth[_0xd23e('0xb')](),controller['show']);router[_0xd23e('0xf')]('/',auth[_0xd23e('0xb')](),controller[_0xd23e('0x10')]);router[_0xd23e('0x11')](_0xd23e('0xe'),auth[_0xd23e('0xb')](),controller[_0xd23e('0x12')]);router[_0xd23e('0x13')](_0xd23e('0xe'),auth[_0xd23e('0xb')](),controller[_0xd23e('0x14')]);module[_0xd23e('0x15')]=router; \ No newline at end of file +var _0x111b=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intServicenowField.controller','get','isAuthenticated','/:id','post','put'];(function(_0x260424,_0x472e16){var _0x4996c3=function(_0x28de07){while(--_0x28de07){_0x260424['push'](_0x260424['shift']());}};_0x4996c3(++_0x472e16);}(_0x111b,0x1f4));var _0xb111=function(_0x3ca775,_0x423723){_0x3ca775=_0x3ca775-0x0;var _0x3c5432=_0x111b[_0x3ca775];return _0x3c5432;};'use strict';var multer=require(_0xb111('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb111('0x1'));var express=require(_0xb111('0x2'));var router=express[_0xb111('0x3')]();var fs_extra=require(_0xb111('0x4'));var auth=require(_0xb111('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb111('0x6'));router[_0xb111('0x7')]('/',auth[_0xb111('0x8')](),controller['index']);router[_0xb111('0x7')](_0xb111('0x9'),auth[_0xb111('0x8')](),controller['show']);router[_0xb111('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb111('0xb')](_0xb111('0x9'),auth['isAuthenticated'](),controller[_0xb111('0xc')]);router[_0xb111('0xd')](_0xb111('0x9'),auth[_0xb111('0x8')](),controller[_0xb111('0xe')]);module[_0xb111('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 95e51a5..f4817a1 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 _0xf1dd=['customVariable','keyValue','string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x20dc06,_0x293e17){var _0x371f1c=function(_0xc356c6){while(--_0xc356c6){_0x20dc06['push'](_0x20dc06['shift']());}};_0x371f1c(++_0x293e17);}(_0xf1dd,0x105));var _0xdf1d=function(_0x4d8789,_0x3fdff1){_0x4d8789=_0x4d8789-0x0;var _0x404e41=_0xf1dd[_0x4d8789];return _0x404e41;};'use strict';var Sequelize=require('sequelize');module[_0xdf1d('0x0')]={'type':{'type':Sequelize[_0xdf1d('0x1')]('string',_0xdf1d('0x2'),_0xdf1d('0x3'),_0xdf1d('0x4'),'picklist'),'defaultValue':_0xdf1d('0x5')},'content':{'type':Sequelize[_0xdf1d('0x6')]},'key':{'type':Sequelize[_0xdf1d('0x6')]},'keyType':{'type':Sequelize[_0xdf1d('0x1')](_0xdf1d('0x5'),'variable',_0xdf1d('0x3'))},'keyContent':{'type':Sequelize[_0xdf1d('0x6')]},'idField':{'type':Sequelize[_0xdf1d('0x6')]},'nameField':{'type':Sequelize[_0xdf1d('0x6')]},'customField':{'type':Sequelize[_0xdf1d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaa3=['sequelize','exports','string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN'];(function(_0x3a4e14,_0x3758e9){var _0x54c291=function(_0x295d64){while(--_0x295d64){_0x3a4e14['push'](_0x3a4e14['shift']());}};_0x54c291(++_0x3758e9);}(_0xbaa3,0xe1));var _0x3baa=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0xbaa3[_0x427217];return _0x5b28fb;};'use strict';var Sequelize=require(_0x3baa('0x0'));module[_0x3baa('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3baa('0x2'),_0x3baa('0x3'),_0x3baa('0x4'),'keyValue',_0x3baa('0x5')),'defaultValue':_0x3baa('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3baa('0x6')]},'keyType':{'type':Sequelize[_0x3baa('0x7')]('string',_0x3baa('0x3'),_0x3baa('0x4'))},'keyContent':{'type':Sequelize[_0x3baa('0x6')]},'idField':{'type':Sequelize[_0x3baa('0x6')]},'nameField':{'type':Sequelize[_0x3baa('0x6')]},'customField':{'type':Sequelize[_0x3baa('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3baa('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 0d2f12d..13a5ba4 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 _0x34ef=['destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','to-csv','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','Content-Range','apply','reject','save','update','stack','name','send','index','map','ServicenowField','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','then','includeAll','include','rows','catch','show','params','options','find','create','body'];(function(_0x4d617a,_0xf1bc41){var _0x5b04e5=function(_0x6235c0){while(--_0x6235c0){_0x4d617a['push'](_0x4d617a['shift']());}};_0x5b04e5(++_0xf1bc41);}(_0x34ef,0x1b7));var _0xf34e=function(_0x14aaa7,_0x4b6b89){_0x14aaa7=_0x14aaa7-0x0;var _0x55c8ef=_0x34ef[_0x14aaa7];return _0x55c8ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf34e('0x0'));var zipdir=require(_0xf34e('0x1'));var jsonpatch=require(_0xf34e('0x2'));var rp=require('request-promise');var moment=require(_0xf34e('0x3'));var BPromise=require(_0xf34e('0x4'));var Mustache=require(_0xf34e('0x5'));var util=require(_0xf34e('0x6'));var path=require(_0xf34e('0x7'));var sox=require(_0xf34e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf34e('0x9'));var _=require(_0xf34e('0xa'));var squel=require(_0xf34e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf34e('0xc'));var querystring=require(_0xf34e('0xd'));var Papa=require(_0xf34e('0xe'));var Redis=require(_0xf34e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf34e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf34e('0x11'))(_0xf34e('0x12'));var utils=require(_0xf34e('0x13'));var config=require(_0xf34e('0x14'));var licenseUtil=require(_0xf34e('0x15'));var db=require(_0xf34e('0x16'))['db'];function respondWithStatusCode(_0x4c89b3,_0x1d070d){_0x1d070d=_0x1d070d||0xcc;return function(_0x1d8ad6){if(_0x1d8ad6){return _0x4c89b3[_0xf34e('0x17')](_0x1d070d);}return _0x4c89b3[_0xf34e('0x18')](_0x1d070d)[_0xf34e('0x19')]();};}function respondWithResult(_0x30cea1,_0x461c87){_0x461c87=_0x461c87||0xc8;return function(_0x2064ae){if(_0x2064ae){return _0x30cea1[_0xf34e('0x18')](_0x461c87)[_0xf34e('0x1a')](_0x2064ae);}};}function respondWithFilteredResult(_0x3f39a3,_0x5bfff4){return function(_0x365cfe){if(_0x365cfe){var _0x1a3c96=typeof _0x5bfff4[_0xf34e('0x1b')]===_0xf34e('0x1c')&&typeof _0x5bfff4[_0xf34e('0x1d')]===_0xf34e('0x1c');var _0x26d64f=_0x365cfe[_0xf34e('0x1e')];var _0x46293f=_0x1a3c96?0x0:_0x5bfff4[_0xf34e('0x1b')];var _0x23ff53=_0x1a3c96?_0x365cfe[_0xf34e('0x1e')]:_0x5bfff4['offset']+_0x5bfff4[_0xf34e('0x1d')];var _0x439761;if(_0x23ff53>=_0x26d64f){_0x23ff53=_0x26d64f;_0x439761=0xc8;}else{_0x439761=0xce;}_0x3f39a3[_0xf34e('0x18')](_0x439761);return _0x3f39a3['set'](_0xf34e('0x1f'),_0x46293f+'-'+_0x23ff53+'/'+_0x26d64f)[_0xf34e('0x1a')](_0x365cfe);}return null;};}function patchUpdates(_0x37047a){return function(_0x4f6791){try{jsonpatch[_0xf34e('0x20')](_0x4f6791,_0x37047a,!![]);}catch(_0x4897aa){return BPromise[_0xf34e('0x21')](_0x4897aa);}return _0x4f6791[_0xf34e('0x22')]();};}function saveUpdates(_0x59390e,_0x44738a){return function(_0x59834d){if(_0x59834d){return _0x59834d[_0xf34e('0x23')](_0x59390e)['then'](function(_0xc2270f){return _0xc2270f;});}return null;};}function removeEntity(_0x254198,_0x5dd1f6){return function(_0x42e462){if(_0x42e462){return _0x42e462['destroy']()['then'](function(){_0x254198[_0xf34e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28e32a,_0x57071c){return function(_0x56b430){if(!_0x56b430){_0x28e32a[_0xf34e('0x17')](0x194);}return _0x56b430;};}function handleError(_0x578585,_0x4d3de5){_0x4d3de5=_0x4d3de5||0x1f4;return function(_0x587b36){logger['error'](_0x587b36[_0xf34e('0x24')]);if(_0x587b36[_0xf34e('0x25')]){delete _0x587b36['name'];}_0x578585['status'](_0x4d3de5)[_0xf34e('0x26')](_0x587b36);};}exports[_0xf34e('0x27')]=function(_0x3a7df7,_0x1ab4b4){var _0x432079={},_0x376f56={},_0x36fc93={'count':0x0,'rows':[]};var _0x255446=_[_0xf34e('0x28')](db[_0xf34e('0x29')][_0xf34e('0x2a')],function(_0x45ed93){return{'name':_0x45ed93['fieldName'],'type':_0x45ed93[_0xf34e('0x2b')][_0xf34e('0x2c')]};});_0x376f56[_0xf34e('0x2d')]=_['map'](_0x255446,_0xf34e('0x25'));_0x376f56['query']=_[_0xf34e('0x2e')](_0x3a7df7['query']);_0x376f56[_0xf34e('0x2f')]=_[_0xf34e('0x30')](_0x376f56[_0xf34e('0x2d')],_0x376f56[_0xf34e('0x31')]);_0x432079[_0xf34e('0x32')]=_[_0xf34e('0x30')](_0x376f56[_0xf34e('0x2d')],qs[_0xf34e('0x33')](_0x3a7df7[_0xf34e('0x31')][_0xf34e('0x33')]));_0x432079[_0xf34e('0x32')]=_0x432079[_0xf34e('0x32')][_0xf34e('0x34')]?_0x432079[_0xf34e('0x32')]:_0x376f56['model'];if(!_0x3a7df7[_0xf34e('0x31')][_0xf34e('0x35')](_0xf34e('0x36'))){_0x432079[_0xf34e('0x1d')]=qs[_0xf34e('0x1d')](_0x3a7df7['query'][_0xf34e('0x1d')]);_0x432079[_0xf34e('0x1b')]=qs[_0xf34e('0x1b')](_0x3a7df7['query'][_0xf34e('0x1b')]);}_0x432079[_0xf34e('0x37')]=qs[_0xf34e('0x38')](_0x3a7df7[_0xf34e('0x31')][_0xf34e('0x38')]);_0x432079[_0xf34e('0x39')]=qs['filters'](_[_0xf34e('0x3a')](_0x3a7df7[_0xf34e('0x31')],_0x376f56[_0xf34e('0x2f')]),_0x255446);if(_0x3a7df7[_0xf34e('0x31')][_0xf34e('0x3b')]){_0x432079['where']=_['merge'](_0x432079[_0xf34e('0x39')],{'$or':_['map'](_0x255446,function(_0x20468a){if(_0x20468a['type']!=='VIRTUAL'){var _0x515e97={};_0x515e97[_0x20468a[_0xf34e('0x25')]]={'$like':'%'+_0x3a7df7['query'][_0xf34e('0x3b')]+'%'};return _0x515e97;}})});}_0x432079=_[_0xf34e('0x3c')]({},_0x432079,_0x3a7df7['options']);var _0x4adf1c={'where':_0x432079[_0xf34e('0x39')]};return db[_0xf34e('0x29')]['count'](_0x4adf1c)[_0xf34e('0x3d')](function(_0xfae95e){_0x36fc93[_0xf34e('0x1e')]=_0xfae95e;if(_0x3a7df7[_0xf34e('0x31')][_0xf34e('0x3e')]){_0x432079[_0xf34e('0x3f')]=[{'all':!![]}];}return db[_0xf34e('0x29')]['findAll'](_0x432079);})[_0xf34e('0x3d')](function(_0x10a1fc){_0x36fc93[_0xf34e('0x40')]=_0x10a1fc;return _0x36fc93;})[_0xf34e('0x3d')](respondWithFilteredResult(_0x1ab4b4,_0x432079))[_0xf34e('0x41')](handleError(_0x1ab4b4,null));};exports[_0xf34e('0x42')]=function(_0x54c81c,_0x18dd70){var _0x3351e7={'raw':!![],'where':{'id':_0x54c81c[_0xf34e('0x43')]['id']}},_0x551648={};_0x551648[_0xf34e('0x2d')]=_[_0xf34e('0x2e')](db[_0xf34e('0x29')][_0xf34e('0x2a')]);_0x551648[_0xf34e('0x31')]=_[_0xf34e('0x2e')](_0x54c81c[_0xf34e('0x31')]);_0x551648['filters']=_['intersection'](_0x551648[_0xf34e('0x2d')],_0x551648[_0xf34e('0x31')]);_0x3351e7[_0xf34e('0x32')]=_[_0xf34e('0x30')](_0x551648[_0xf34e('0x2d')],qs[_0xf34e('0x33')](_0x54c81c[_0xf34e('0x31')][_0xf34e('0x33')]));_0x3351e7['attributes']=_0x3351e7[_0xf34e('0x32')]['length']?_0x3351e7[_0xf34e('0x32')]:_0x551648[_0xf34e('0x2d')];if(_0x54c81c[_0xf34e('0x31')]['includeAll']){_0x3351e7['include']=[{'all':!![]}];}_0x3351e7=_['merge']({},_0x3351e7,_0x54c81c[_0xf34e('0x44')]);return db[_0xf34e('0x29')][_0xf34e('0x45')](_0x3351e7)[_0xf34e('0x3d')](handleEntityNotFound(_0x18dd70,null))[_0xf34e('0x3d')](respondWithResult(_0x18dd70,null))['catch'](handleError(_0x18dd70,null));};exports[_0xf34e('0x46')]=function(_0x87e529,_0x4375d3){return db[_0xf34e('0x29')][_0xf34e('0x46')](_0x87e529[_0xf34e('0x47')],{})[_0xf34e('0x3d')](respondWithResult(_0x4375d3,0xc9))['catch'](handleError(_0x4375d3,null));};exports[_0xf34e('0x23')]=function(_0x990734,_0x82571d){if(_0x990734[_0xf34e('0x47')]['id']){delete _0x990734[_0xf34e('0x47')]['id'];}return db[_0xf34e('0x29')]['find']({'where':{'id':_0x990734[_0xf34e('0x43')]['id']}})[_0xf34e('0x3d')](handleEntityNotFound(_0x82571d,null))[_0xf34e('0x3d')](saveUpdates(_0x990734[_0xf34e('0x47')],null))['then'](respondWithResult(_0x82571d,null))[_0xf34e('0x41')](handleError(_0x82571d,null));};exports[_0xf34e('0x48')]=function(_0x461a54,_0xaf25ef){return db[_0xf34e('0x29')]['find']({'where':{'id':_0x461a54['params']['id']}})[_0xf34e('0x3d')](handleEntityNotFound(_0xaf25ef,null))[_0xf34e('0x3d')](removeEntity(_0xaf25ef,null))[_0xf34e('0x41')](handleError(_0xaf25ef,null));}; \ No newline at end of file +var _0x0afa=['merge','includeAll','include','rows','catch','params','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','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','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','name','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter'];(function(_0x27c4ad,_0x30e571){var _0x5f011e=function(_0x3cc9d6){while(--_0x3cc9d6){_0x27c4ad['push'](_0x27c4ad['shift']());}};_0x5f011e(++_0x30e571);}(_0x0afa,0x98));var _0xa0af=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0afa[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0af('0x0'));var zipdir=require(_0xa0af('0x1'));var jsonpatch=require(_0xa0af('0x2'));var rp=require(_0xa0af('0x3'));var moment=require('moment');var BPromise=require(_0xa0af('0x4'));var Mustache=require(_0xa0af('0x5'));var util=require(_0xa0af('0x6'));var path=require(_0xa0af('0x7'));var sox=require(_0xa0af('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0af('0x9'));var _=require(_0xa0af('0xa'));var squel=require(_0xa0af('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa0af('0xc'));var toCsv=require(_0xa0af('0xd'));var querystring=require(_0xa0af('0xe'));var Papa=require(_0xa0af('0xf'));var Redis=require(_0xa0af('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa0af('0x11'));var as=require(_0xa0af('0x12'));var hardwareService=require(_0xa0af('0x13'));var logger=require(_0xa0af('0x14'))(_0xa0af('0x15'));var utils=require(_0xa0af('0x16'));var config=require(_0xa0af('0x17'));var licenseUtil=require(_0xa0af('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x163146,_0x3255cd){_0x3255cd=_0x3255cd||0xcc;return function(_0x54260c){if(_0x54260c){return _0x163146[_0xa0af('0x19')](_0x3255cd);}return _0x163146[_0xa0af('0x1a')](_0x3255cd)[_0xa0af('0x1b')]();};}function respondWithResult(_0x472d80,_0x1cddcb){_0x1cddcb=_0x1cddcb||0xc8;return function(_0x39695b){if(_0x39695b){return _0x472d80[_0xa0af('0x1a')](_0x1cddcb)[_0xa0af('0x1c')](_0x39695b);}};}function respondWithFilteredResult(_0x2a8073,_0x5301e1){return function(_0x5aba10){if(_0x5aba10){var _0x1b6335=typeof _0x5301e1['offset']==='undefined'&&typeof _0x5301e1[_0xa0af('0x1d')]===_0xa0af('0x1e');var _0x33f214=_0x5aba10[_0xa0af('0x1f')];var _0x145942=_0x1b6335?0x0:_0x5301e1['offset'];var _0x46d2b6=_0x1b6335?_0x5aba10[_0xa0af('0x1f')]:_0x5301e1['offset']+_0x5301e1[_0xa0af('0x1d')];var _0x40b289;if(_0x46d2b6>=_0x33f214){_0x46d2b6=_0x33f214;_0x40b289=0xc8;}else{_0x40b289=0xce;}_0x2a8073['status'](_0x40b289);return _0x2a8073[_0xa0af('0x20')](_0xa0af('0x21'),_0x145942+'-'+_0x46d2b6+'/'+_0x33f214)[_0xa0af('0x1c')](_0x5aba10);}return null;};}function patchUpdates(_0x20cf75){return function(_0x13d616){try{jsonpatch[_0xa0af('0x22')](_0x13d616,_0x20cf75,!![]);}catch(_0x48150c){return BPromise[_0xa0af('0x23')](_0x48150c);}return _0x13d616['save']();};}function saveUpdates(_0xae7f21,_0xd30c1){return function(_0x3ffa74){if(_0x3ffa74){return _0x3ffa74[_0xa0af('0x24')](_0xae7f21)[_0xa0af('0x25')](function(_0x5026ef){return _0x5026ef;});}return null;};}function removeEntity(_0x21e0bf,_0x20b623){return function(_0x16977b){if(_0x16977b){return _0x16977b[_0xa0af('0x26')]()[_0xa0af('0x25')](function(){_0x21e0bf[_0xa0af('0x1a')](0xcc)[_0xa0af('0x1b')]();});}};}function handleEntityNotFound(_0x5dce11,_0x4de6e6){return function(_0x3e3fb1){if(!_0x3e3fb1){_0x5dce11[_0xa0af('0x19')](0x194);}return _0x3e3fb1;};}function handleError(_0x39fd21,_0x3abf41){_0x3abf41=_0x3abf41||0x1f4;return function(_0x1af3a9){logger['error'](_0x1af3a9['stack']);if(_0x1af3a9[_0xa0af('0x27')]){delete _0x1af3a9['name'];}_0x39fd21[_0xa0af('0x1a')](_0x3abf41)['send'](_0x1af3a9);};}exports['index']=function(_0x407443,_0xe4a5b7){var _0x3b893d={},_0x5f2863={},_0xbfb419={'count':0x0,'rows':[]};var _0x2d7d2c=_[_0xa0af('0x28')](db[_0xa0af('0x29')][_0xa0af('0x2a')],function(_0x5b1618){return{'name':_0x5b1618[_0xa0af('0x2b')],'type':_0x5b1618[_0xa0af('0x2c')][_0xa0af('0x2d')]};});_0x5f2863['model']=_[_0xa0af('0x28')](_0x2d7d2c,'name');_0x5f2863[_0xa0af('0x2e')]=_[_0xa0af('0x2f')](_0x407443[_0xa0af('0x2e')]);_0x5f2863[_0xa0af('0x30')]=_[_0xa0af('0x31')](_0x5f2863[_0xa0af('0x32')],_0x5f2863[_0xa0af('0x2e')]);_0x3b893d[_0xa0af('0x33')]=_[_0xa0af('0x31')](_0x5f2863[_0xa0af('0x32')],qs[_0xa0af('0x34')](_0x407443[_0xa0af('0x2e')][_0xa0af('0x34')]));_0x3b893d[_0xa0af('0x33')]=_0x3b893d[_0xa0af('0x33')][_0xa0af('0x35')]?_0x3b893d[_0xa0af('0x33')]:_0x5f2863[_0xa0af('0x32')];if(!_0x407443[_0xa0af('0x2e')][_0xa0af('0x36')](_0xa0af('0x37'))){_0x3b893d[_0xa0af('0x1d')]=qs['limit'](_0x407443[_0xa0af('0x2e')][_0xa0af('0x1d')]);_0x3b893d[_0xa0af('0x38')]=qs['offset'](_0x407443['query'][_0xa0af('0x38')]);}_0x3b893d['order']=qs[_0xa0af('0x39')](_0x407443[_0xa0af('0x2e')][_0xa0af('0x39')]);_0x3b893d[_0xa0af('0x3a')]=qs[_0xa0af('0x30')](_[_0xa0af('0x3b')](_0x407443[_0xa0af('0x2e')],_0x5f2863[_0xa0af('0x30')]),_0x2d7d2c);if(_0x407443[_0xa0af('0x2e')][_0xa0af('0x3c')]){_0x3b893d['where']=_[_0xa0af('0x3d')](_0x3b893d[_0xa0af('0x3a')],{'$or':_[_0xa0af('0x28')](_0x2d7d2c,function(_0x1ef0ab){if(_0x1ef0ab[_0xa0af('0x2c')]!=='VIRTUAL'){var _0x285be4={};_0x285be4[_0x1ef0ab[_0xa0af('0x27')]]={'$like':'%'+_0x407443[_0xa0af('0x2e')][_0xa0af('0x3c')]+'%'};return _0x285be4;}})});}_0x3b893d=_['merge']({},_0x3b893d,_0x407443['options']);var _0x632764={'where':_0x3b893d[_0xa0af('0x3a')]};return db[_0xa0af('0x29')][_0xa0af('0x1f')](_0x632764)['then'](function(_0x59a5ee){_0xbfb419[_0xa0af('0x1f')]=_0x59a5ee;if(_0x407443['query'][_0xa0af('0x3e')]){_0x3b893d[_0xa0af('0x3f')]=[{'all':!![]}];}return db[_0xa0af('0x29')]['findAll'](_0x3b893d);})[_0xa0af('0x25')](function(_0x2d3e6d){_0xbfb419[_0xa0af('0x40')]=_0x2d3e6d;return _0xbfb419;})['then'](respondWithFilteredResult(_0xe4a5b7,_0x3b893d))[_0xa0af('0x41')](handleError(_0xe4a5b7,null));};exports['show']=function(_0x555164,_0x17076f){var _0x47cc6d={'raw':!![],'where':{'id':_0x555164[_0xa0af('0x42')]['id']}},_0x34ec6d={};_0x34ec6d[_0xa0af('0x32')]=_[_0xa0af('0x2f')](db[_0xa0af('0x29')]['rawAttributes']);_0x34ec6d[_0xa0af('0x2e')]=_[_0xa0af('0x2f')](_0x555164[_0xa0af('0x2e')]);_0x34ec6d[_0xa0af('0x30')]=_[_0xa0af('0x31')](_0x34ec6d[_0xa0af('0x32')],_0x34ec6d[_0xa0af('0x2e')]);_0x47cc6d[_0xa0af('0x33')]=_[_0xa0af('0x31')](_0x34ec6d[_0xa0af('0x32')],qs['fields'](_0x555164[_0xa0af('0x2e')]['fields']));_0x47cc6d[_0xa0af('0x33')]=_0x47cc6d[_0xa0af('0x33')][_0xa0af('0x35')]?_0x47cc6d['attributes']:_0x34ec6d[_0xa0af('0x32')];if(_0x555164[_0xa0af('0x2e')][_0xa0af('0x3e')]){_0x47cc6d[_0xa0af('0x3f')]=[{'all':!![]}];}_0x47cc6d=_[_0xa0af('0x3d')]({},_0x47cc6d,_0x555164[_0xa0af('0x43')]);return db[_0xa0af('0x29')][_0xa0af('0x44')](_0x47cc6d)['then'](handleEntityNotFound(_0x17076f,null))[_0xa0af('0x25')](respondWithResult(_0x17076f,null))['catch'](handleError(_0x17076f,null));};exports[_0xa0af('0x45')]=function(_0x300fbe,_0x40233a){return db[_0xa0af('0x29')][_0xa0af('0x45')](_0x300fbe[_0xa0af('0x46')],{})[_0xa0af('0x25')](respondWithResult(_0x40233a,0xc9))[_0xa0af('0x41')](handleError(_0x40233a,null));};exports['update']=function(_0x3c04f9,_0x591f8e){if(_0x3c04f9[_0xa0af('0x46')]['id']){delete _0x3c04f9['body']['id'];}return db[_0xa0af('0x29')]['find']({'where':{'id':_0x3c04f9[_0xa0af('0x42')]['id']}})[_0xa0af('0x25')](handleEntityNotFound(_0x591f8e,null))[_0xa0af('0x25')](saveUpdates(_0x3c04f9['body'],null))[_0xa0af('0x25')](respondWithResult(_0x591f8e,null))['catch'](handleError(_0x591f8e,null));};exports['destroy']=function(_0x5dd771,_0x123ba5){return db[_0xa0af('0x29')][_0xa0af('0x44')]({'where':{'id':_0x5dd771[_0xa0af('0x42')]['id']}})['then'](handleEntityNotFound(_0x123ba5,null))[_0xa0af('0x25')](removeEntity(_0x123ba5,null))[_0xa0af('0x41')](handleError(_0x123ba5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index abe347e..c01e7b3 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 _0xcbd3=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','ServicenowField'];(function(_0xd4470d,_0x47318d){var _0x5544c5=function(_0x3486cb){while(--_0x3486cb){_0xd4470d['push'](_0xd4470d['shift']());}};_0x5544c5(++_0x47318d);}(_0xcbd3,0x86));var _0x3cbd=function(_0x5b3155,_0x573dbb){_0x5b3155=_0x5b3155-0x0;var _0x200a1a=_0xcbd3[_0x5b3155];return _0x200a1a;};'use strict';var _=require('lodash');var util=require(_0x3cbd('0x0'));var logger=require(_0x3cbd('0x1'))(_0x3cbd('0x2'));var moment=require(_0x3cbd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cbd('0x4'));var rimraf=require(_0x3cbd('0x5'));var config=require(_0x3cbd('0x6'));var attributes=require('./intServicenowField.attributes');module[_0x3cbd('0x7')]=function(_0x28d2cd,_0x586d7a){return _0x28d2cd['define'](_0x3cbd('0x8'),attributes,{'tableName':_0x3cbd('0x9'),'paranoid':![],'indexes':[{'name':_0x3cbd('0xa'),'fields':[_0x3cbd('0xb'),_0x3cbd('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1fa9=['moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','idField','FieldId','lodash','../../config/logger'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x1fa9,0x136));var _0x91fa=function(_0x4ea443,_0xee49a5){_0x4ea443=_0x4ea443-0x0;var _0xf5fa4f=_0x1fa9[_0x4ea443];return _0xf5fa4f;};'use strict';var _=require(_0x91fa('0x0'));var util=require('util');var logger=require(_0x91fa('0x1'))('api');var moment=require(_0x91fa('0x2'));var BPromise=require(_0x91fa('0x3'));var rp=require(_0x91fa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91fa('0x5'));var config=require(_0x91fa('0x6'));var attributes=require(_0x91fa('0x7'));module[_0x91fa('0x8')]=function(_0xd050dc,_0x50f800){return _0xd050dc[_0x91fa('0x9')](_0x91fa('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x91fa('0xb'),_0x91fa('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index dd47f9d..6c64da5 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 _0xbdb7=['request\x20sent','debug','ServicenowField,\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','ServicenowField,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5c6951,_0x507abb){_0x5c6951=_0x5c6951-0x0;var _0x5ee145=_0xbdb7[_0x5c6951];return _0x5ee145;};'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 +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0xda3f,0xec));var _0xfda3=function(_0x4929e3,_0xbf222e){_0x4929e3=_0x4929e3-0x0;var _0x425284=_0xda3f[_0x4929e3];return _0x425284;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 66d3aae..5eac83a 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(_0x164fe9,_0x208caa){var _0x17d9cc=function(_0xdf45e4){while(--_0xdf45e4){_0x164fe9['push'](_0x164fe9['shift']());}};_0x17d9cc(++_0x208caa);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x121581,_0x424903){var _0x349de4=function(_0x4cfc43){while(--_0x4cfc43){_0x121581['push'](_0x121581['shift']());}};_0x349de4(++_0x424903);}(_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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index b84cfc3..a7c9f77 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(_0x3af43c,_0x414d69){var _0x4b370d=function(_0x1dc71f){while(--_0x1dc71f){_0x3af43c['push'](_0x3af43c['shift']());}};_0x4b370d(++_0x414d69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x4c49fe,_0x22ba7a){var _0x1d70f7=function(_0x4062b8){while(--_0x4062b8){_0x4c49fe['push'](_0x4c49fe['shift']());}};_0x1d70f7(++_0x22ba7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 af0b9d9..65ae14c 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 _0x672d=['includeAll','include','rows','show','params','length','find','catch','create','body','getConfigurations','SugarcrmConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_minutes','parent_id','parent_type','direction','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','error','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x5b69d2,_0x227711){var _0x1a3bab=function(_0x685b14){while(--_0x685b14){_0x5b69d2['push'](_0x5b69d2['shift']());}};_0x1a3bab(++_0x227711);}(_0x672d,0x121));var _0xd672=function(_0x56d9e7,_0x1096c1){_0x56d9e7=_0x56d9e7-0x0;var _0x13bfda=_0x672d[_0x56d9e7];return _0x13bfda;};'use strict';var emlformat=require(_0xd672('0x0'));var rimraf=require(_0xd672('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd672('0x2'));var rp=require(_0xd672('0x3'));var moment=require(_0xd672('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd672('0x5'));var util=require(_0xd672('0x6'));var path=require('path');var sox=require(_0xd672('0x7'));var csv=require(_0xd672('0x8'));var ejs=require(_0xd672('0x9'));var fs=require('fs');var fs_extra=require(_0xd672('0xa'));var _=require(_0xd672('0xb'));var squel=require('squel');var crypto=require(_0xd672('0xc'));var jsforce=require(_0xd672('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd672('0x8'));var querystring=require('querystring');var Papa=require(_0xd672('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd672('0xf'));var as=require(_0xd672('0x10'));var hardwareService=require(_0xd672('0x11'));var logger=require(_0xd672('0x12'))('api');var utils=require(_0xd672('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd672('0x14'));var db=require(_0xd672('0x15'))['db'];var integrations=require(_0xd672('0x16'));function respondWithStatusCode(_0x2589c6,_0x523410){_0x523410=_0x523410||0xcc;return function(_0x55d1b1){if(_0x55d1b1){return _0x2589c6[_0xd672('0x17')](_0x523410);}return _0x2589c6['status'](_0x523410)[_0xd672('0x18')]();};}function respondWithResult(_0x4a29a3,_0x495fba){_0x495fba=_0x495fba||0xc8;return function(_0xf6f231){if(_0xf6f231){return _0x4a29a3[_0xd672('0x19')](_0x495fba)['json'](_0xf6f231);}};}function respondWithFilteredResult(_0x1900ea,_0x69508){return function(_0x1765ed){if(_0x1765ed){var _0x2cef00=typeof _0x69508[_0xd672('0x1a')]==='undefined'&&typeof _0x69508[_0xd672('0x1b')]===_0xd672('0x1c');var _0x5eacc5=_0x1765ed[_0xd672('0x1d')];var _0x4a76a4=_0x2cef00?0x0:_0x69508['offset'];var _0x4f5e3e=_0x2cef00?_0x1765ed[_0xd672('0x1d')]:_0x69508['offset']+_0x69508[_0xd672('0x1b')];var _0x4e59bb;if(_0x4f5e3e>=_0x5eacc5){_0x4f5e3e=_0x5eacc5;_0x4e59bb=0xc8;}else{_0x4e59bb=0xce;}_0x1900ea['status'](_0x4e59bb);return _0x1900ea[_0xd672('0x1e')](_0xd672('0x1f'),_0x4a76a4+'-'+_0x4f5e3e+'/'+_0x5eacc5)[_0xd672('0x20')](_0x1765ed);}return null;};}function patchUpdates(_0x3e2414){return function(_0x28e872){try{jsonpatch[_0xd672('0x21')](_0x28e872,_0x3e2414,!![]);}catch(_0x1c6bac){return BPromise['reject'](_0x1c6bac);}return _0x28e872[_0xd672('0x22')]();};}function saveUpdates(_0x1b2830,_0x266c95){return function(_0x261c97){if(_0x261c97){return _0x261c97['update'](_0x1b2830)[_0xd672('0x23')](function(_0x3ba12c){return _0x3ba12c;});}return null;};}function removeEntity(_0x59117f,_0x3f281a){return function(_0x162c42){if(_0x162c42){return _0x162c42[_0xd672('0x24')]()[_0xd672('0x23')](function(){_0x59117f[_0xd672('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22816a,_0x4a961b){return function(_0x2f7c3f){if(!_0x2f7c3f){_0x22816a['sendStatus'](0x194);}return _0x2f7c3f;};}function handleError(_0x5bdcd4,_0x5c92f4){_0x5c92f4=_0x5c92f4||0x1f4;return function(_0x566a9a){logger[_0xd672('0x25')](_0x566a9a['stack']);if(_0x566a9a[_0xd672('0x26')]){delete _0x566a9a[_0xd672('0x26')];}_0x5bdcd4[_0xd672('0x19')](_0x5c92f4)[_0xd672('0x27')](_0x566a9a);};}exports[_0xd672('0x28')]=function(_0x292c57,_0x156a34){var _0x54932a={},_0x3c711d={},_0x34c820={'count':0x0,'rows':[]};var _0x25f53f=_[_0xd672('0x29')](db[_0xd672('0x2a')][_0xd672('0x2b')],function(_0x164d0e){return{'name':_0x164d0e['fieldName'],'type':_0x164d0e[_0xd672('0x2c')][_0xd672('0x2d')]};});_0x3c711d['model']=_[_0xd672('0x29')](_0x25f53f,'name');_0x3c711d['query']=_[_0xd672('0x2e')](_0x292c57[_0xd672('0x2f')]);_0x3c711d[_0xd672('0x30')]=_[_0xd672('0x31')](_0x3c711d[_0xd672('0x32')],_0x3c711d[_0xd672('0x2f')]);_0x54932a[_0xd672('0x33')]=_[_0xd672('0x31')](_0x3c711d[_0xd672('0x32')],qs[_0xd672('0x34')](_0x292c57['query'][_0xd672('0x34')]));_0x54932a['attributes']=_0x54932a['attributes']['length']?_0x54932a[_0xd672('0x33')]:_0x3c711d['model'];if(!_0x292c57[_0xd672('0x2f')][_0xd672('0x35')]('nolimit')){_0x54932a['limit']=qs[_0xd672('0x1b')](_0x292c57[_0xd672('0x2f')][_0xd672('0x1b')]);_0x54932a['offset']=qs[_0xd672('0x1a')](_0x292c57[_0xd672('0x2f')][_0xd672('0x1a')]);}_0x54932a[_0xd672('0x36')]=qs[_0xd672('0x37')](_0x292c57['query'][_0xd672('0x37')]);_0x54932a[_0xd672('0x38')]=qs[_0xd672('0x30')](_[_0xd672('0x39')](_0x292c57[_0xd672('0x2f')],_0x3c711d[_0xd672('0x30')]),_0x25f53f);if(_0x292c57['query'][_0xd672('0x3a')]){_0x54932a[_0xd672('0x38')]=_[_0xd672('0x3b')](_0x54932a[_0xd672('0x38')],{'$or':_[_0xd672('0x29')](_0x25f53f,function(_0x336309){if(_0x336309['type']!==_0xd672('0x3c')){var _0x1e2f5c={};_0x1e2f5c[_0x336309[_0xd672('0x26')]]={'$like':'%'+_0x292c57[_0xd672('0x2f')][_0xd672('0x3a')]+'%'};return _0x1e2f5c;}})});}_0x54932a=_[_0xd672('0x3b')]({},_0x54932a,_0x292c57[_0xd672('0x3d')]);var _0x17ebb8={'where':_0x54932a[_0xd672('0x38')]};return db[_0xd672('0x2a')][_0xd672('0x1d')](_0x17ebb8)[_0xd672('0x23')](function(_0x79f3ab){_0x34c820[_0xd672('0x1d')]=_0x79f3ab;if(_0x292c57[_0xd672('0x2f')][_0xd672('0x3e')]){_0x54932a[_0xd672('0x3f')]=[{'all':!![]}];}return db[_0xd672('0x2a')]['findAll'](_0x54932a);})[_0xd672('0x23')](function(_0x22e631){_0x34c820[_0xd672('0x40')]=_0x22e631;return _0x34c820;})[_0xd672('0x23')](respondWithFilteredResult(_0x156a34,_0x54932a))['catch'](handleError(_0x156a34,null));};exports[_0xd672('0x41')]=function(_0xd0c707,_0x4756bf){var _0x3004e3={'raw':![],'where':{'id':_0xd0c707[_0xd672('0x42')]['id']}},_0x583c03={};_0x583c03[_0xd672('0x32')]=_['keys'](db[_0xd672('0x2a')][_0xd672('0x2b')]);_0x583c03[_0xd672('0x2f')]=_[_0xd672('0x2e')](_0xd0c707[_0xd672('0x2f')]);_0x583c03[_0xd672('0x30')]=_[_0xd672('0x31')](_0x583c03['model'],_0x583c03['query']);_0x3004e3[_0xd672('0x33')]=_[_0xd672('0x31')](_0x583c03[_0xd672('0x32')],qs[_0xd672('0x34')](_0xd0c707[_0xd672('0x2f')][_0xd672('0x34')]));_0x3004e3['attributes']=_0x3004e3[_0xd672('0x33')][_0xd672('0x43')]?_0x3004e3[_0xd672('0x33')]:_0x583c03[_0xd672('0x32')];if(_0xd0c707[_0xd672('0x2f')][_0xd672('0x3e')]){_0x3004e3[_0xd672('0x3f')]=[{'all':!![]}];}_0x3004e3=_[_0xd672('0x3b')]({},_0x3004e3,_0xd0c707[_0xd672('0x3d')]);return db[_0xd672('0x2a')][_0xd672('0x44')](_0x3004e3)['then'](handleEntityNotFound(_0x4756bf,null))[_0xd672('0x23')](respondWithResult(_0x4756bf,null))[_0xd672('0x45')](handleError(_0x4756bf,null));};exports[_0xd672('0x46')]=function(_0x78fc0,_0x22e667){return db[_0xd672('0x2a')][_0xd672('0x46')](_0x78fc0[_0xd672('0x47')],{})['then'](respondWithResult(_0x22e667,0xc9))[_0xd672('0x45')](handleError(_0x22e667,null));};exports['update']=function(_0x17891f,_0x29edd9){if(_0x17891f[_0xd672('0x47')]['id']){delete _0x17891f[_0xd672('0x47')]['id'];}return db[_0xd672('0x2a')][_0xd672('0x44')]({'where':{'id':_0x17891f['params']['id']}})[_0xd672('0x23')](handleEntityNotFound(_0x29edd9,null))[_0xd672('0x23')](saveUpdates(_0x17891f[_0xd672('0x47')],null))['then'](respondWithResult(_0x29edd9,null))[_0xd672('0x45')](handleError(_0x29edd9,null));};exports[_0xd672('0x24')]=function(_0x106e59,_0x5383f4){return db[_0xd672('0x2a')][_0xd672('0x44')]({'where':{'id':_0x106e59[_0xd672('0x42')]['id']}})['then'](handleEntityNotFound(_0x5383f4,null))[_0xd672('0x23')](removeEntity(_0x5383f4,null))[_0xd672('0x45')](handleError(_0x5383f4,null));};exports[_0xd672('0x48')]=function(_0xcbaa3b,_0x4bd587,_0x1baccf){var _0x232a5f={};var _0x52a50a={};var _0x57b34a;var _0x27ffea;return db['SugarcrmAccount']['findOne']({'where':{'id':_0xcbaa3b[_0xd672('0x42')]['id']}})[_0xd672('0x23')](handleEntityNotFound(_0x4bd587,null))[_0xd672('0x23')](function(_0x4d052b){if(_0x4d052b){_0x57b34a=_0x4d052b;_0x52a50a[_0xd672('0x32')]=_[_0xd672('0x2e')](db[_0xd672('0x49')]['rawAttributes']);_0x52a50a[_0xd672('0x2f')]=_[_0xd672('0x2e')](_0xcbaa3b[_0xd672('0x2f')]);_0x52a50a['filters']=_[_0xd672('0x31')](_0x52a50a[_0xd672('0x32')],_0x52a50a[_0xd672('0x2f')]);_0x232a5f[_0xd672('0x33')]=_['intersection'](_0x52a50a['model'],qs[_0xd672('0x34')](_0xcbaa3b[_0xd672('0x2f')]['fields']));_0x232a5f['attributes']=_0x232a5f[_0xd672('0x33')][_0xd672('0x43')]?_0x232a5f[_0xd672('0x33')]:_0x52a50a['model'];_0x232a5f[_0xd672('0x36')]=qs[_0xd672('0x37')](_0xcbaa3b['query'][_0xd672('0x37')]);_0x232a5f[_0xd672('0x38')]=qs[_0xd672('0x30')](_[_0xd672('0x39')](_0xcbaa3b['query'],_0x52a50a[_0xd672('0x30')]));if(_0xcbaa3b[_0xd672('0x2f')]['filter']){_0x232a5f[_0xd672('0x38')]=_[_0xd672('0x3b')](_0x232a5f['where'],{'$or':_[_0xd672('0x29')](_0x232a5f[_0xd672('0x33')],function(_0x4e9db1){var _0x533722={};_0x533722[_0x4e9db1]={'$like':'%'+_0xcbaa3b['query'][_0xd672('0x3a')]+'%'};return _0x533722;})});}_0x232a5f=_[_0xd672('0x3b')]({},_0x232a5f,_0xcbaa3b['options']);return _0x57b34a[_0xd672('0x48')](_0x232a5f);}})[_0xd672('0x23')](function(_0x511b60){if(_0x511b60){_0x27ffea=_0x511b60['length'];if(!_0xcbaa3b[_0xd672('0x2f')][_0xd672('0x35')]('nolimit')){_0x232a5f[_0xd672('0x1b')]=qs[_0xd672('0x1b')](_0xcbaa3b[_0xd672('0x2f')][_0xd672('0x1b')]);_0x232a5f[_0xd672('0x1a')]=qs[_0xd672('0x1a')](_0xcbaa3b[_0xd672('0x2f')][_0xd672('0x1a')]);}return _0x57b34a[_0xd672('0x48')](_0x232a5f);}})['then'](function(_0x7ef417){if(_0x7ef417){return _0x7ef417?{'count':_0x27ffea,'rows':_0x7ef417}:null;}})['then'](respondWithResult(_0x4bd587,null))[_0xd672('0x45')](handleError(_0x4bd587,null));};exports[_0xd672('0x4a')]=function(_0x4d783a,_0x451862,_0x4870c7){if(_0x4d783a[_0xd672('0x47')]['id']){delete _0x4d783a[_0xd672('0x47')]['id'];}return db[_0xd672('0x2a')][_0xd672('0x4b')]({'where':{'id':_0x4d783a[_0xd672('0x42')]['id']}})['then'](handleEntityNotFound(_0x451862,null))[_0xd672('0x23')](function(_0x15e211){if(_0x15e211){_0x4d783a['body'][_0xd672('0x4c')]=_0x15e211['id'];_0x4d783a[_0xd672('0x47')][_0xd672('0x4d')]=integrations[_0xd672('0x4e')](_0x4d783a[_0xd672('0x47')][_0xd672('0x4f')],_0x4d783a[_0xd672('0x47')][_0xd672('0x2c')]);_0x4d783a[_0xd672('0x47')][_0xd672('0x50')]=integrations[_0xd672('0x51')](_0x4d783a[_0xd672('0x47')]['channel'],_0x4d783a[_0xd672('0x47')][_0xd672('0x2c')]);return db[_0xd672('0x49')]['create'](_0x4d783a['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xd672('0x4d')},{'model':db[_0xd672('0x52')],'as':_0xd672('0x50')}]});}return null;})['then'](respondWithResult(_0x451862,null))['catch'](handleError(_0x451862,null));};exports[_0xd672('0x53')]=function(_0x42b9d6,_0x471dc5,_0x27466c){var _0x151364='';var _0x5f5621=['id',_0xd672('0x26'),_0xd672('0x54'),_0xd672('0x55'),'description',_0xd672('0x56'),'duration_hours',_0xd672('0x57'),_0xd672('0x58'),_0xd672('0x59'),'parent_name',_0xd672('0x5a')];return db['SugarcrmAccount'][_0xd672('0x4b')]({'where':{'id':_0x42b9d6[_0xd672('0x42')]['id']},'attributes':['id','username',_0xd672('0x5b'),_0xd672('0x5c')]})['then'](handleEntityNotFound(_0x471dc5,null))[_0xd672('0x23')](function(_0x38be55){if(_0x38be55){_0x151364=_0x38be55['remoteUri'];var _0x5cf991=_0x151364[_0xd672('0x5d')](-0x1);if(_0x5cf991==='/'){_0x151364=_0x151364[_0xd672('0x5e')](0x0,_0x151364['lastIndexOf'](_0x5cf991));}return rp({'method':_0xd672('0x5f'),'uri':util[_0xd672('0x60')](_0xd672('0x61'),_0x151364,_0xd672('0x62')),'json':!![],'form':{'method':_0xd672('0x63'),'input_type':_0xd672('0x64'),'response_type':_0xd672('0x64'),'rest_data':JSON[_0xd672('0x65')]({'user_auth':{'user_name':_0x38be55[_0xd672('0x66')],'password':_0x38be55[_0xd672('0x5b')],'encryption':_0xd672('0x67')},'application':_0xd672('0x68')})}});}})[_0xd672('0x23')](function(_0x594d3d){if(_0x594d3d&&_0x594d3d[_0xd672('0x26')]!==_0xd672('0x69')&&_0x594d3d[_0xd672('0x26')]!=='Password\x20Expired'){return rp({'method':_0xd672('0x5f'),'uri':util['format'](_0xd672('0x61'),_0x151364,_0xd672('0x62')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xd672('0x64'),'rest_data':JSON[_0xd672('0x65')]({'session':_0x594d3d['id'],'module_name':'Calls'})}})[_0xd672('0x23')](function(_0x5ba2b2){if(_0x5ba2b2){var _0xec7df=_[_0xd672('0x6a')](_0x5ba2b2[_0xd672('0x6b')]);_[_0xd672('0x6c')](_0xec7df,function(_0x9b0723){return _0x5f5621[_0xd672('0x6d')](_0x9b0723[_0xd672('0x26')]);});return{'count':_0xec7df[_0xd672('0x43')],'rows':_[_0xd672('0x29')](_0xec7df,function(_0x59c344){return{'id':_0x59c344[_0xd672('0x26')],'name':_0x59c344[_0xd672('0x6e')],'custom':_[_0xd672('0x6f')](_0x59c344[_0xd672('0x26')],'_c')?!![]:![],'options':_0x59c344[_0xd672('0x3d')]?_[_0xd672('0x29')](_['values'](_0x59c344['options']),function(_0x25246c){return{'name':_0x25246c[_0xd672('0x70')],'value':_0x25246c[_0xd672('0x26')]};}):[]};})};}})[_0xd672('0x23')](respondWithResult(_0x471dc5,null))['catch'](function(_0x290c9d){var _0x4b2a34=_0x42b9d6[_0xd672('0x2f')][_0xd672('0x71')]?0x1f4:_0x290c9d[_0xd672('0x72')]||0x1f4;logger[_0xd672('0x25')](_0xd672('0x73'),_0xd672('0x53'),_0x4b2a34,JSON['stringify'](_0x290c9d));delete _0x290c9d[_0xd672('0x26')];if(_0x4b2a34===0x191){_0x4b2a34=0x190;}_0x471dc5[_0xd672('0x19')](_0x4b2a34)[_0xd672('0x27')](_0x42b9d6[_0xd672('0x2f')][_0xd672('0x71')]?{'message':_0xd672('0x74'),'statusCode':_0x290c9d[_0xd672('0x72')]}:_0x290c9d);});}else{var _0xd53b06=0x1f4;_0x471dc5['status'](_0xd53b06)[_0xd672('0x27')]({'message':_0xd672('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x58d5=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','rawAttributes','fieldName','type','key','map','query','intersection','attributes','model','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','includeAll','include','SugarcrmAccount','findAll','rows','catch','keys','fields','length','merge','options','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','AccountId','Subjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','label','endsWith','value','send','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x2f3957,_0x5a3cc0){var _0x2f08ca=function(_0x27b25e){while(--_0x27b25e){_0x2f3957['push'](_0x2f3957['shift']());}};_0x2f08ca(++_0x5a3cc0);}(_0x58d5,0xea));var _0x558d=function(_0x3a853a,_0x502bae){_0x3a853a=_0x3a853a-0x0;var _0x504f83=_0x58d5[_0x3a853a];return _0x504f83;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x558d('0x0'));var zipdir=require(_0x558d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x558d('0x2'));var moment=require(_0x558d('0x3'));var BPromise=require(_0x558d('0x4'));var Mustache=require(_0x558d('0x5'));var util=require(_0x558d('0x6'));var path=require(_0x558d('0x7'));var sox=require(_0x558d('0x8'));var csv=require(_0x558d('0x9'));var ejs=require(_0x558d('0xa'));var fs=require('fs');var fs_extra=require(_0x558d('0xb'));var _=require(_0x558d('0xc'));var squel=require(_0x558d('0xd'));var crypto=require('crypto');var jsforce=require(_0x558d('0xe'));var deskjs=require(_0x558d('0xf'));var toCsv=require(_0x558d('0x9'));var querystring=require(_0x558d('0x10'));var Papa=require(_0x558d('0x11'));var Redis=require(_0x558d('0x12'));var authService=require(_0x558d('0x13'));var qs=require(_0x558d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x558d('0x15'));var logger=require(_0x558d('0x16'))(_0x558d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x558d('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x297d93,_0x3df958){_0x3df958=_0x3df958||0xcc;return function(_0x34e78d){if(_0x34e78d){return _0x297d93[_0x558d('0x19')](_0x3df958);}return _0x297d93[_0x558d('0x1a')](_0x3df958)[_0x558d('0x1b')]();};}function respondWithResult(_0x55c0f1,_0x1c5c93){_0x1c5c93=_0x1c5c93||0xc8;return function(_0x165727){if(_0x165727){return _0x55c0f1[_0x558d('0x1a')](_0x1c5c93)[_0x558d('0x1c')](_0x165727);}};}function respondWithFilteredResult(_0x14b95b,_0x16da44){return function(_0x113931){if(_0x113931){var _0x370fff=typeof _0x16da44[_0x558d('0x1d')]===_0x558d('0x1e')&&typeof _0x16da44['limit']==='undefined';var _0x134cdd=_0x113931['count'];var _0x71bf5f=_0x370fff?0x0:_0x16da44[_0x558d('0x1d')];var _0x34614e=_0x370fff?_0x113931[_0x558d('0x1f')]:_0x16da44[_0x558d('0x1d')]+_0x16da44[_0x558d('0x20')];var _0x5fc189;if(_0x34614e>=_0x134cdd){_0x34614e=_0x134cdd;_0x5fc189=0xc8;}else{_0x5fc189=0xce;}_0x14b95b[_0x558d('0x1a')](_0x5fc189);return _0x14b95b[_0x558d('0x21')](_0x558d('0x22'),_0x71bf5f+'-'+_0x34614e+'/'+_0x134cdd)['json'](_0x113931);}return null;};}function patchUpdates(_0x5080e5){return function(_0x3913a1){try{jsonpatch[_0x558d('0x23')](_0x3913a1,_0x5080e5,!![]);}catch(_0x4219b4){return BPromise[_0x558d('0x24')](_0x4219b4);}return _0x3913a1[_0x558d('0x25')]();};}function saveUpdates(_0x46ba7d,_0x1835ea){return function(_0x321c28){if(_0x321c28){return _0x321c28[_0x558d('0x26')](_0x46ba7d)[_0x558d('0x27')](function(_0x396943){return _0x396943;});}return null;};}function removeEntity(_0x1e16e1,_0x337687){return function(_0xf073c0){if(_0xf073c0){return _0xf073c0[_0x558d('0x28')]()[_0x558d('0x27')](function(){_0x1e16e1[_0x558d('0x1a')](0xcc)[_0x558d('0x1b')]();});}};}function handleEntityNotFound(_0x5546bb,_0x4a8f59){return function(_0x21c353){if(!_0x21c353){_0x5546bb[_0x558d('0x19')](0x194);}return _0x21c353;};}function handleError(_0x4c9763,_0x199671){_0x199671=_0x199671||0x1f4;return function(_0x5a5393){logger[_0x558d('0x29')](_0x5a5393[_0x558d('0x2a')]);if(_0x5a5393[_0x558d('0x2b')]){delete _0x5a5393[_0x558d('0x2b')];}_0x4c9763[_0x558d('0x1a')](_0x199671)['send'](_0x5a5393);};}exports['index']=function(_0xaa6450,_0x565b39){var _0x5d1ea5={},_0x38eed8={},_0x3bcd0b={'count':0x0,'rows':[]};var _0x5b7c36=_['map'](db['SugarcrmAccount'][_0x558d('0x2c')],function(_0xb7f350){return{'name':_0xb7f350[_0x558d('0x2d')],'type':_0xb7f350[_0x558d('0x2e')][_0x558d('0x2f')]};});_0x38eed8['model']=_[_0x558d('0x30')](_0x5b7c36,'name');_0x38eed8[_0x558d('0x31')]=_['keys'](_0xaa6450['query']);_0x38eed8['filters']=_[_0x558d('0x32')](_0x38eed8['model'],_0x38eed8['query']);_0x5d1ea5[_0x558d('0x33')]=_[_0x558d('0x32')](_0x38eed8['model'],qs['fields'](_0xaa6450[_0x558d('0x31')]['fields']));_0x5d1ea5[_0x558d('0x33')]=_0x5d1ea5['attributes']['length']?_0x5d1ea5['attributes']:_0x38eed8[_0x558d('0x34')];if(!_0xaa6450['query']['hasOwnProperty'](_0x558d('0x35'))){_0x5d1ea5[_0x558d('0x20')]=qs[_0x558d('0x20')](_0xaa6450[_0x558d('0x31')][_0x558d('0x20')]);_0x5d1ea5[_0x558d('0x1d')]=qs[_0x558d('0x1d')](_0xaa6450[_0x558d('0x31')][_0x558d('0x1d')]);}_0x5d1ea5[_0x558d('0x36')]=qs[_0x558d('0x37')](_0xaa6450[_0x558d('0x31')][_0x558d('0x37')]);_0x5d1ea5['where']=qs[_0x558d('0x38')](_[_0x558d('0x39')](_0xaa6450[_0x558d('0x31')],_0x38eed8[_0x558d('0x38')]),_0x5b7c36);if(_0xaa6450[_0x558d('0x31')][_0x558d('0x3a')]){_0x5d1ea5[_0x558d('0x3b')]=_['merge'](_0x5d1ea5[_0x558d('0x3b')],{'$or':_[_0x558d('0x30')](_0x5b7c36,function(_0x22a3a2){if(_0x22a3a2['type']!==_0x558d('0x3c')){var _0x2c045e={};_0x2c045e[_0x22a3a2[_0x558d('0x2b')]]={'$like':'%'+_0xaa6450[_0x558d('0x31')]['filter']+'%'};return _0x2c045e;}})});}_0x5d1ea5=_['merge']({},_0x5d1ea5,_0xaa6450['options']);var _0x327f84={'where':_0x5d1ea5[_0x558d('0x3b')]};return db['SugarcrmAccount'][_0x558d('0x1f')](_0x327f84)['then'](function(_0x3042e2){_0x3bcd0b[_0x558d('0x1f')]=_0x3042e2;if(_0xaa6450[_0x558d('0x31')][_0x558d('0x3d')]){_0x5d1ea5[_0x558d('0x3e')]=[{'all':!![]}];}return db[_0x558d('0x3f')][_0x558d('0x40')](_0x5d1ea5);})[_0x558d('0x27')](function(_0x5c5326){_0x3bcd0b[_0x558d('0x41')]=_0x5c5326;return _0x3bcd0b;})[_0x558d('0x27')](respondWithFilteredResult(_0x565b39,_0x5d1ea5))[_0x558d('0x42')](handleError(_0x565b39,null));};exports['show']=function(_0x158e23,_0xce2153){var _0x139ed6={'raw':![],'where':{'id':_0x158e23['params']['id']}},_0xa1c8b0={};_0xa1c8b0[_0x558d('0x34')]=_[_0x558d('0x43')](db[_0x558d('0x3f')][_0x558d('0x2c')]);_0xa1c8b0[_0x558d('0x31')]=_[_0x558d('0x43')](_0x158e23[_0x558d('0x31')]);_0xa1c8b0[_0x558d('0x38')]=_[_0x558d('0x32')](_0xa1c8b0[_0x558d('0x34')],_0xa1c8b0[_0x558d('0x31')]);_0x139ed6['attributes']=_['intersection'](_0xa1c8b0[_0x558d('0x34')],qs[_0x558d('0x44')](_0x158e23[_0x558d('0x31')][_0x558d('0x44')]));_0x139ed6['attributes']=_0x139ed6[_0x558d('0x33')][_0x558d('0x45')]?_0x139ed6[_0x558d('0x33')]:_0xa1c8b0[_0x558d('0x34')];if(_0x158e23[_0x558d('0x31')][_0x558d('0x3d')]){_0x139ed6[_0x558d('0x3e')]=[{'all':!![]}];}_0x139ed6=_[_0x558d('0x46')]({},_0x139ed6,_0x158e23[_0x558d('0x47')]);return db[_0x558d('0x3f')][_0x558d('0x48')](_0x139ed6)[_0x558d('0x27')](handleEntityNotFound(_0xce2153,null))[_0x558d('0x27')](respondWithResult(_0xce2153,null))['catch'](handleError(_0xce2153,null));};exports['create']=function(_0x14cbb0,_0xa16c5a){return db[_0x558d('0x3f')][_0x558d('0x49')](_0x14cbb0[_0x558d('0x4a')],{})['then'](respondWithResult(_0xa16c5a,0xc9))[_0x558d('0x42')](handleError(_0xa16c5a,null));};exports[_0x558d('0x26')]=function(_0x427960,_0x147c6d){if(_0x427960['body']['id']){delete _0x427960[_0x558d('0x4a')]['id'];}return db['SugarcrmAccount'][_0x558d('0x48')]({'where':{'id':_0x427960[_0x558d('0x4b')]['id']}})[_0x558d('0x27')](handleEntityNotFound(_0x147c6d,null))['then'](saveUpdates(_0x427960[_0x558d('0x4a')],null))[_0x558d('0x27')](respondWithResult(_0x147c6d,null))[_0x558d('0x42')](handleError(_0x147c6d,null));};exports[_0x558d('0x28')]=function(_0x2bddd4,_0x5f5da4){return db[_0x558d('0x3f')]['find']({'where':{'id':_0x2bddd4[_0x558d('0x4b')]['id']}})[_0x558d('0x27')](handleEntityNotFound(_0x5f5da4,null))[_0x558d('0x27')](removeEntity(_0x5f5da4,null))[_0x558d('0x42')](handleError(_0x5f5da4,null));};exports[_0x558d('0x4c')]=function(_0x4cac0a,_0x11c023,_0x31bc98){var _0x3738b7={};var _0x5d1604={};var _0x2e37c7;var _0x2ee8c4;return db[_0x558d('0x3f')][_0x558d('0x4d')]({'where':{'id':_0x4cac0a[_0x558d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11c023,null))['then'](function(_0xfc0d99){if(_0xfc0d99){_0x2e37c7=_0xfc0d99;_0x5d1604['model']=_[_0x558d('0x43')](db[_0x558d('0x4e')]['rawAttributes']);_0x5d1604[_0x558d('0x31')]=_['keys'](_0x4cac0a[_0x558d('0x31')]);_0x5d1604[_0x558d('0x38')]=_[_0x558d('0x32')](_0x5d1604[_0x558d('0x34')],_0x5d1604['query']);_0x3738b7[_0x558d('0x33')]=_['intersection'](_0x5d1604[_0x558d('0x34')],qs[_0x558d('0x44')](_0x4cac0a[_0x558d('0x31')][_0x558d('0x44')]));_0x3738b7[_0x558d('0x33')]=_0x3738b7[_0x558d('0x33')][_0x558d('0x45')]?_0x3738b7['attributes']:_0x5d1604[_0x558d('0x34')];_0x3738b7['order']=qs[_0x558d('0x37')](_0x4cac0a[_0x558d('0x31')]['sort']);_0x3738b7['where']=qs[_0x558d('0x38')](_[_0x558d('0x39')](_0x4cac0a[_0x558d('0x31')],_0x5d1604['filters']));if(_0x4cac0a[_0x558d('0x31')][_0x558d('0x3a')]){_0x3738b7[_0x558d('0x3b')]=_[_0x558d('0x46')](_0x3738b7['where'],{'$or':_['map'](_0x3738b7[_0x558d('0x33')],function(_0xbd4cfe){var _0x5dbee6={};_0x5dbee6[_0xbd4cfe]={'$like':'%'+_0x4cac0a['query'][_0x558d('0x3a')]+'%'};return _0x5dbee6;})});}_0x3738b7=_[_0x558d('0x46')]({},_0x3738b7,_0x4cac0a[_0x558d('0x47')]);return _0x2e37c7[_0x558d('0x4c')](_0x3738b7);}})[_0x558d('0x27')](function(_0x34d166){if(_0x34d166){_0x2ee8c4=_0x34d166['length'];if(!_0x4cac0a[_0x558d('0x31')][_0x558d('0x4f')](_0x558d('0x35'))){_0x3738b7['limit']=qs[_0x558d('0x20')](_0x4cac0a['query']['limit']);_0x3738b7[_0x558d('0x1d')]=qs[_0x558d('0x1d')](_0x4cac0a[_0x558d('0x31')]['offset']);}return _0x2e37c7['getConfigurations'](_0x3738b7);}})[_0x558d('0x27')](function(_0xc5f8){if(_0xc5f8){return _0xc5f8?{'count':_0x2ee8c4,'rows':_0xc5f8}:null;}})[_0x558d('0x27')](respondWithResult(_0x11c023,null))['catch'](handleError(_0x11c023,null));};exports['addConfiguration']=function(_0x3f827b,_0x8810b7,_0x35377d){if(_0x3f827b[_0x558d('0x4a')]['id']){delete _0x3f827b['body']['id'];}return db[_0x558d('0x3f')][_0x558d('0x4d')]({'where':{'id':_0x3f827b[_0x558d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8810b7,null))[_0x558d('0x27')](function(_0x305f23){if(_0x305f23){_0x3f827b[_0x558d('0x4a')][_0x558d('0x50')]=_0x305f23['id'];_0x3f827b[_0x558d('0x4a')][_0x558d('0x51')]=integrations['getSubjects'](_0x3f827b[_0x558d('0x4a')][_0x558d('0x52')],_0x3f827b['body'][_0x558d('0x2e')]);_0x3f827b[_0x558d('0x4a')][_0x558d('0x53')]=integrations['getDescriptions'](_0x3f827b[_0x558d('0x4a')][_0x558d('0x52')],_0x3f827b[_0x558d('0x4a')][_0x558d('0x2e')]);return db['SugarcrmConfiguration'][_0x558d('0x49')](_0x3f827b['body'],{'include':[{'model':db[_0x558d('0x54')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x558d('0x53')}]});}return null;})['then'](respondWithResult(_0x8810b7,null))[_0x558d('0x42')](handleError(_0x8810b7,null));};exports[_0x558d('0x55')]=function(_0x593465,_0x3e93f7,_0x53c728){var _0x4ad624='';var _0x8913f=['id',_0x558d('0x2b'),_0x558d('0x56'),_0x558d('0x57'),'description',_0x558d('0x58'),'duration_hours',_0x558d('0x59'),_0x558d('0x5a'),_0x558d('0x5b'),_0x558d('0x5c'),_0x558d('0x5d')];return db[_0x558d('0x3f')][_0x558d('0x4d')]({'where':{'id':_0x593465[_0x558d('0x4b')]['id']},'attributes':['id','username',_0x558d('0x5e'),_0x558d('0x5f')]})[_0x558d('0x27')](handleEntityNotFound(_0x3e93f7,null))[_0x558d('0x27')](function(_0x300782){if(_0x300782){_0x4ad624=_0x300782[_0x558d('0x5f')];var _0xcec6b9=_0x4ad624[_0x558d('0x60')](-0x1);if(_0xcec6b9==='/'){_0x4ad624=_0x4ad624[_0x558d('0x61')](0x0,_0x4ad624[_0x558d('0x62')](_0xcec6b9));}return rp({'method':_0x558d('0x63'),'uri':util[_0x558d('0x64')](_0x558d('0x65'),_0x4ad624,_0x558d('0x66')),'json':!![],'form':{'method':_0x558d('0x67'),'input_type':_0x558d('0x68'),'response_type':_0x558d('0x68'),'rest_data':JSON[_0x558d('0x69')]({'user_auth':{'user_name':_0x300782[_0x558d('0x6a')],'password':_0x300782[_0x558d('0x5e')],'encryption':_0x558d('0x6b')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x558d('0x27')](function(_0x4085d3){if(_0x4085d3&&_0x4085d3[_0x558d('0x2b')]!==_0x558d('0x6c')&&_0x4085d3[_0x558d('0x2b')]!==_0x558d('0x6d')){return rp({'method':_0x558d('0x63'),'uri':util[_0x558d('0x64')]('%s%s',_0x4ad624,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x558d('0x6e'),'input_type':_0x558d('0x68'),'response_type':_0x558d('0x68'),'rest_data':JSON[_0x558d('0x69')]({'session':_0x4085d3['id'],'module_name':_0x558d('0x6f')})}})[_0x558d('0x27')](function(_0x3d06f9){if(_0x3d06f9){var _0x36b021=_[_0x558d('0x70')](_0x3d06f9[_0x558d('0x71')]);_[_0x558d('0x72')](_0x36b021,function(_0x4b5578){return _0x8913f['includes'](_0x4b5578[_0x558d('0x2b')]);});return{'count':_0x36b021[_0x558d('0x45')],'rows':_['map'](_0x36b021,function(_0xc5f68d){return{'id':_0xc5f68d[_0x558d('0x2b')],'name':_0xc5f68d[_0x558d('0x73')],'custom':_[_0x558d('0x74')](_0xc5f68d[_0x558d('0x2b')],'_c')?!![]:![],'options':_0xc5f68d[_0x558d('0x47')]?_[_0x558d('0x30')](_[_0x558d('0x70')](_0xc5f68d[_0x558d('0x47')]),function(_0x47ef5a){return{'name':_0x47ef5a[_0x558d('0x75')],'value':_0x47ef5a[_0x558d('0x2b')]};}):[]};})};}})[_0x558d('0x27')](respondWithResult(_0x3e93f7,null))[_0x558d('0x42')](function(_0x1592e6){var _0x5bda2d=_0x593465['query']['test']?0x1f4:_0x1592e6['statusCode']||0x1f4;logger[_0x558d('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5bda2d,JSON[_0x558d('0x69')](_0x1592e6));delete _0x1592e6[_0x558d('0x2b')];if(_0x5bda2d===0x191){_0x5bda2d=0x190;}_0x3e93f7[_0x558d('0x1a')](_0x5bda2d)[_0x558d('0x76')](_0x593465[_0x558d('0x31')][_0x558d('0x77')]?{'message':_0x558d('0x78'),'statusCode':_0x1592e6[_0x558d('0x79')]}:_0x1592e6);});}else{var _0x51e978=0x1f4;_0x3e93f7[_0x558d('0x1a')](_0x51e978)[_0x558d('0x76')]({'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 8e3d01c..bccba41 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 _0x80f7=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','int_sugarcrm_accounts','lodash'];(function(_0x4c7c4a,_0x520920){var _0x4d78ae=function(_0x3bcee0){while(--_0x3bcee0){_0x4c7c4a['push'](_0x4c7c4a['shift']());}};_0x4d78ae(++_0x520920);}(_0x80f7,0x1b9));var _0x780f=function(_0x2ed4c9,_0x243771){_0x2ed4c9=_0x2ed4c9-0x0;var _0x237f0a=_0x80f7[_0x2ed4c9];return _0x237f0a;};'use strict';var _=require(_0x780f('0x0'));var util=require(_0x780f('0x1'));var logger=require(_0x780f('0x2'))(_0x780f('0x3'));var moment=require(_0x780f('0x4'));var BPromise=require(_0x780f('0x5'));var rp=require(_0x780f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x780f('0x7'));var config=require(_0x780f('0x8'));var attributes=require(_0x780f('0x9'));var integrations=require(_0x780f('0xa'));module[_0x780f('0xb')]=function(_0x2b8f23,_0x38933d){return _0x2b8f23['define']('SugarcrmAccount',attributes,{'tableName':_0x780f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2085=['exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x2714a1,_0x19f3b9){var _0x53784b=function(_0x385dc2){while(--_0x385dc2){_0x2714a1['push'](_0x2714a1['shift']());}};_0x53784b(++_0x19f3b9);}(_0x2085,0x13f));var _0x5208=function(_0x2e11d3,_0x26a29a){_0x2e11d3=_0x2e11d3-0x0;var _0x3f7f7f=_0x2085[_0x2e11d3];return _0x3f7f7f;};'use strict';var _=require(_0x5208('0x0'));var util=require(_0x5208('0x1'));var logger=require(_0x5208('0x2'))(_0x5208('0x3'));var moment=require(_0x5208('0x4'));var BPromise=require(_0x5208('0x5'));var rp=require(_0x5208('0x6'));var fs=require('fs');var path=require(_0x5208('0x7'));var rimraf=require('rimraf');var config=require(_0x5208('0x8'));var attributes=require(_0x5208('0x9'));var integrations=require(_0x5208('0xa'));module[_0x5208('0xb')]=function(_0xc93e8f,_0x2030f4){return _0xc93e8f[_0x5208('0xc')](_0x5208('0xd'),attributes,{'tableName':_0x5208('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 e5d6e44..d1cd788 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 _0x5ed2=['result','SugarcrmAccount','options','raw','where','attributes','limit','map','include','model','GetSugarcrmAccount','catch','find','then','ShowSugarcrmAccount','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1f66c3,_0x173ac4){var _0x367f92=function(_0x10ebbd){while(--_0x10ebbd){_0x1f66c3['push'](_0x1f66c3['shift']());}};_0x367f92(++_0x173ac4);}(_0x5ed2,0x1a7));var _0x25ed=function(_0x1b1c4f,_0x32eb9c){_0x1b1c4f=_0x1b1c4f-0x0;var _0x3f02c1=_0x5ed2[_0x1b1c4f];return _0x3f02c1;};'use strict';var _=require(_0x25ed('0x0'));var util=require(_0x25ed('0x1'));var moment=require(_0x25ed('0x2'));var BPromise=require(_0x25ed('0x3'));var rs=require(_0x25ed('0x4'));var fs=require('fs');var Redis=require(_0x25ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x25ed('0x6'));var logger=require('../../config/logger')(_0x25ed('0x7'));var config=require(_0x25ed('0x8'));var jayson=require(_0x25ed('0x9'));var client=jayson[_0x25ed('0xa')][_0x25ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d064b,_0x3c601a,_0x25cb9f){return new BPromise(function(_0x264b72,_0x4854e4){return client[_0x25ed('0xc')](_0x4d064b,_0x25cb9f)['then'](function(_0x5592eb){logger[_0x25ed('0xd')](_0x25ed('0xe'),_0x3c601a,_0x25ed('0xf'));logger['debug'](_0x25ed('0x10'),_0x3c601a,_0x25ed('0xf'),JSON[_0x25ed('0x11')](_0x5592eb));if(_0x5592eb[_0x25ed('0x12')]){if(_0x5592eb[_0x25ed('0x12')][_0x25ed('0x13')]===0x1f4){logger['error'](_0x25ed('0xe'),_0x3c601a,_0x5592eb[_0x25ed('0x12')][_0x25ed('0x14')]);return _0x4854e4(_0x5592eb[_0x25ed('0x12')][_0x25ed('0x14')]);}logger[_0x25ed('0x12')](_0x25ed('0xe'),_0x3c601a,_0x5592eb[_0x25ed('0x12')][_0x25ed('0x14')]);return _0x264b72(_0x5592eb[_0x25ed('0x12')][_0x25ed('0x14')]);}else{logger['info'](_0x25ed('0xe'),_0x3c601a,'request\x20sent');_0x264b72(_0x5592eb[_0x25ed('0x15')]['message']);}})['catch'](function(_0x263c7a){logger[_0x25ed('0x12')](_0x25ed('0xe'),_0x3c601a,_0x263c7a);_0x4854e4(_0x263c7a);});});}exports['GetSugarcrmAccount']=function(_0x9af76c){var _0x42534e=this;return new Promise(function(_0x5e5246,_0x316779){return db[_0x25ed('0x16')]['findAll']({'raw':_0x9af76c[_0x25ed('0x17')]?_0x9af76c[_0x25ed('0x17')][_0x25ed('0x18')]===undefined?!![]:![]:!![],'where':_0x9af76c[_0x25ed('0x17')]?_0x9af76c[_0x25ed('0x17')][_0x25ed('0x19')]||null:null,'attributes':_0x9af76c['options']?_0x9af76c['options'][_0x25ed('0x1a')]||null:null,'limit':_0x9af76c[_0x25ed('0x17')]?_0x9af76c[_0x25ed('0x17')][_0x25ed('0x1b')]||null:null,'include':_0x9af76c[_0x25ed('0x17')]?_0x9af76c[_0x25ed('0x17')]['include']?_[_0x25ed('0x1c')](_0x9af76c['options'][_0x25ed('0x1d')],function(_0x12b854){return{'model':db[_0x12b854[_0x25ed('0x1e')]],'as':_0x12b854['as'],'attributes':_0x12b854[_0x25ed('0x1a')],'include':_0x12b854[_0x25ed('0x1d')]?_['map'](_0x12b854[_0x25ed('0x1d')],function(_0x3d6220){return{'model':db[_0x3d6220[_0x25ed('0x1e')]],'as':_0x3d6220['as'],'attributes':_0x3d6220[_0x25ed('0x1a')],'include':_0x3d6220[_0x25ed('0x1d')]?_['map'](_0x3d6220['include'],function(_0x5ca529){return{'model':db[_0x5ca529[_0x25ed('0x1e')]],'as':_0x5ca529['as'],'attributes':_0x5ca529[_0x25ed('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45b32a){logger[_0x25ed('0xd')]('GetSugarcrmAccount',_0x9af76c);logger['debug'](_0x25ed('0x1f'),_0x9af76c,JSON[_0x25ed('0x11')](_0x45b32a));_0x5e5246(_0x45b32a);})[_0x25ed('0x20')](function(_0x474f5e){logger[_0x25ed('0x12')](_0x25ed('0x1f'),_0x474f5e[_0x25ed('0x14')],_0x9af76c);_0x316779(_0x42534e[_0x25ed('0x12')](0x1f4,_0x474f5e[_0x25ed('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0xd9c867){var _0xaf5446=this;return new Promise(function(_0x157c2a,_0x133857){return db['SugarcrmAccount'][_0x25ed('0x21')]({'raw':_0xd9c867[_0x25ed('0x17')]?_0xd9c867[_0x25ed('0x17')][_0x25ed('0x18')]===undefined?!![]:![]:!![],'where':_0xd9c867[_0x25ed('0x17')]?_0xd9c867[_0x25ed('0x17')][_0x25ed('0x19')]||null:null,'attributes':_0xd9c867['options']?_0xd9c867[_0x25ed('0x17')]['attributes']||null:null,'include':_0xd9c867[_0x25ed('0x17')]?_0xd9c867[_0x25ed('0x17')][_0x25ed('0x1d')]?_[_0x25ed('0x1c')](_0xd9c867[_0x25ed('0x17')]['include'],function(_0x33ebca){return{'model':db[_0x33ebca[_0x25ed('0x1e')]],'as':_0x33ebca['as'],'attributes':_0x33ebca[_0x25ed('0x1a')],'include':_0x33ebca['include']?_[_0x25ed('0x1c')](_0x33ebca['include'],function(_0x5ac41d){return{'model':db[_0x5ac41d[_0x25ed('0x1e')]],'as':_0x5ac41d['as'],'attributes':_0x5ac41d['attributes'],'include':_0x5ac41d['include']?_[_0x25ed('0x1c')](_0x5ac41d[_0x25ed('0x1d')],function(_0xbb31c){return{'model':db[_0xbb31c[_0x25ed('0x1e')]],'as':_0xbb31c['as'],'attributes':_0xbb31c[_0x25ed('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x25ed('0x22')](function(_0x2442db){logger[_0x25ed('0xd')](_0x25ed('0x23'),_0xd9c867);logger[_0x25ed('0x24')](_0x25ed('0x23'),_0xd9c867,JSON[_0x25ed('0x11')](_0x2442db));_0x157c2a(_0x2442db);})[_0x25ed('0x20')](function(_0x4eaf3f){logger['error']('ShowSugarcrmAccount',_0x4eaf3f[_0x25ed('0x14')],_0xd9c867);_0x133857(_0xaf5446[_0x25ed('0x12')](0x1f4,_0x4eaf3f['message']));});});}; \ No newline at end of file +var _0x4af5=['message','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetSugarcrmAccount','catch','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x4af5,0x185));var _0x54af=function(_0x4e0634,_0x433057){_0x4e0634=_0x4e0634-0x0;var _0x4bea07=_0x4af5[_0x4e0634];return _0x4bea07;};'use strict';var _=require(_0x54af('0x0'));var util=require(_0x54af('0x1'));var moment=require(_0x54af('0x2'));var BPromise=require(_0x54af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54af('0x4'));var db=require(_0x54af('0x5'))['db'];var utils=require(_0x54af('0x6'));var logger=require(_0x54af('0x7'))(_0x54af('0x8'));var config=require('../../config/environment');var jayson=require(_0x54af('0x9'));var client=jayson[_0x54af('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36ae09,_0x226817,_0x53c5b3){return new BPromise(function(_0x31c8e3,_0x21914c){return client[_0x54af('0xb')](_0x36ae09,_0x53c5b3)[_0x54af('0xc')](function(_0x8459cb){logger[_0x54af('0xd')](_0x54af('0xe'),_0x226817,_0x54af('0xf'));logger[_0x54af('0x10')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x226817,_0x54af('0xf'),JSON[_0x54af('0x11')](_0x8459cb));if(_0x8459cb['error']){if(_0x8459cb[_0x54af('0x12')]['code']===0x1f4){logger[_0x54af('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x226817,_0x8459cb[_0x54af('0x12')][_0x54af('0x13')]);return _0x21914c(_0x8459cb[_0x54af('0x12')][_0x54af('0x13')]);}logger[_0x54af('0x12')](_0x54af('0xe'),_0x226817,_0x8459cb[_0x54af('0x12')][_0x54af('0x13')]);return _0x31c8e3(_0x8459cb[_0x54af('0x12')][_0x54af('0x13')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x226817,_0x54af('0xf'));_0x31c8e3(_0x8459cb['result'][_0x54af('0x13')]);}})['catch'](function(_0x5be86f){logger['error'](_0x54af('0xe'),_0x226817,_0x5be86f);_0x21914c(_0x5be86f);});});}exports['GetSugarcrmAccount']=function(_0x1c8bb7){var _0x265b31=this;return new Promise(function(_0x1ffbdb,_0x266cb1){return db[_0x54af('0x14')][_0x54af('0x15')]({'raw':_0x1c8bb7[_0x54af('0x16')]?_0x1c8bb7[_0x54af('0x16')][_0x54af('0x17')]===undefined?!![]:![]:!![],'where':_0x1c8bb7[_0x54af('0x16')]?_0x1c8bb7['options'][_0x54af('0x18')]||null:null,'attributes':_0x1c8bb7[_0x54af('0x16')]?_0x1c8bb7[_0x54af('0x16')][_0x54af('0x19')]||null:null,'limit':_0x1c8bb7[_0x54af('0x16')]?_0x1c8bb7[_0x54af('0x16')][_0x54af('0x1a')]||null:null,'include':_0x1c8bb7[_0x54af('0x16')]?_0x1c8bb7[_0x54af('0x16')][_0x54af('0x1b')]?_['map'](_0x1c8bb7['options']['include'],function(_0x4f9ee3){return{'model':db[_0x4f9ee3[_0x54af('0x1c')]],'as':_0x4f9ee3['as'],'attributes':_0x4f9ee3[_0x54af('0x19')],'include':_0x4f9ee3[_0x54af('0x1b')]?_[_0x54af('0x1d')](_0x4f9ee3[_0x54af('0x1b')],function(_0x76eedc){return{'model':db[_0x76eedc[_0x54af('0x1c')]],'as':_0x76eedc['as'],'attributes':_0x76eedc[_0x54af('0x19')],'include':_0x76eedc['include']?_['map'](_0x76eedc[_0x54af('0x1b')],function(_0x35056c){return{'model':db[_0x35056c[_0x54af('0x1c')]],'as':_0x35056c['as'],'attributes':_0x35056c['attributes']};}):[]};}):[]};}):[]:[]})[_0x54af('0xc')](function(_0x2d6980){logger[_0x54af('0xd')](_0x54af('0x1e'),_0x1c8bb7);logger[_0x54af('0x10')](_0x54af('0x1e'),_0x1c8bb7,JSON[_0x54af('0x11')](_0x2d6980));_0x1ffbdb(_0x2d6980);})[_0x54af('0x1f')](function(_0x4e8382){logger[_0x54af('0x12')](_0x54af('0x1e'),_0x4e8382[_0x54af('0x13')],_0x1c8bb7);_0x266cb1(_0x265b31['error'](0x1f4,_0x4e8382['message']));});});};exports[_0x54af('0x20')]=function(_0x294ea5){var _0x5e3b69=this;return new Promise(function(_0x26ca2a,_0x39524a){return db[_0x54af('0x14')][_0x54af('0x21')]({'raw':_0x294ea5[_0x54af('0x16')]?_0x294ea5[_0x54af('0x16')][_0x54af('0x17')]===undefined?!![]:![]:!![],'where':_0x294ea5[_0x54af('0x16')]?_0x294ea5[_0x54af('0x16')][_0x54af('0x18')]||null:null,'attributes':_0x294ea5[_0x54af('0x16')]?_0x294ea5[_0x54af('0x16')][_0x54af('0x19')]||null:null,'include':_0x294ea5[_0x54af('0x16')]?_0x294ea5[_0x54af('0x16')]['include']?_[_0x54af('0x1d')](_0x294ea5[_0x54af('0x16')][_0x54af('0x1b')],function(_0x5d13a6){return{'model':db[_0x5d13a6[_0x54af('0x1c')]],'as':_0x5d13a6['as'],'attributes':_0x5d13a6[_0x54af('0x19')],'include':_0x5d13a6['include']?_[_0x54af('0x1d')](_0x5d13a6[_0x54af('0x1b')],function(_0x55a0de){return{'model':db[_0x55a0de[_0x54af('0x1c')]],'as':_0x55a0de['as'],'attributes':_0x55a0de['attributes'],'include':_0x55a0de[_0x54af('0x1b')]?_[_0x54af('0x1d')](_0x55a0de[_0x54af('0x1b')],function(_0x8469dc){return{'model':db[_0x8469dc[_0x54af('0x1c')]],'as':_0x8469dc['as'],'attributes':_0x8469dc[_0x54af('0x19')]};}):[]};}):[]};}):[]:[]})[_0x54af('0xc')](function(_0x17743c){logger[_0x54af('0xd')](_0x54af('0x20'),_0x294ea5);logger[_0x54af('0x10')]('ShowSugarcrmAccount',_0x294ea5,JSON[_0x54af('0x11')](_0x17743c));_0x26ca2a(_0x17743c);})[_0x54af('0x1f')](function(_0x48d227){logger[_0x54af('0x12')](_0x54af('0x20'),_0x48d227[_0x54af('0x13')],_0x294ea5);_0x39524a(_0x5e3b69[_0x54af('0x12')](0x1f4,_0x48d227['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 8b2d38e..676f505 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 _0xbfa8=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','util','path'];(function(_0x46cfa6,_0x5707d1){var _0xb14cf1=function(_0x5506d7){while(--_0x5506d7){_0x46cfa6['push'](_0x46cfa6['shift']());}};_0xb14cf1(++_0x5707d1);}(_0xbfa8,0x106));var _0x8bfa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbfa8[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x8bfa('0x0'));var path=require(_0x8bfa('0x1'));var timeout=require(_0x8bfa('0x2'));var express=require('express');var router=express[_0x8bfa('0x3')]();var fs_extra=require(_0x8bfa('0x4'));var auth=require(_0x8bfa('0x5'));var interaction=require(_0x8bfa('0x6'));var config=require(_0x8bfa('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x8bfa('0x8')]('/',auth[_0x8bfa('0x9')](),controller[_0x8bfa('0xa')]);router[_0x8bfa('0x8')]('/:id',auth[_0x8bfa('0x9')](),controller[_0x8bfa('0xb')]);router['get'](_0x8bfa('0xc'),auth[_0x8bfa('0x9')](),controller[_0x8bfa('0xd')]);router[_0x8bfa('0x8')](_0x8bfa('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x8bfa('0x8')](_0x8bfa('0xf'),auth[_0x8bfa('0x9')](),controller[_0x8bfa('0x10')]);router[_0x8bfa('0x11')]('/',auth[_0x8bfa('0x9')](),controller[_0x8bfa('0x12')]);router['put'](_0x8bfa('0x13'),auth[_0x8bfa('0x9')](),controller[_0x8bfa('0x14')]);router[_0x8bfa('0x15')](_0x8bfa('0x13'),auth[_0x8bfa('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x12f2=['isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x118e87,_0x334b5c){var _0x5a9d5e=function(_0x35e3b7){while(--_0x35e3b7){_0x118e87['push'](_0x118e87['shift']());}};_0x5a9d5e(++_0x334b5c);}(_0x12f2,0x1a8));var _0x212f=function(_0x2e1dbe,_0x448ced){_0x2e1dbe=_0x2e1dbe-0x0;var _0x1ceeee=_0x12f2[_0x2e1dbe];return _0x1ceeee;};'use strict';var multer=require(_0x212f('0x0'));var util=require(_0x212f('0x1'));var path=require('path');var timeout=require(_0x212f('0x2'));var express=require(_0x212f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x212f('0x4'));var interaction=require(_0x212f('0x5'));var config=require(_0x212f('0x6'));var controller=require(_0x212f('0x7'));router['get']('/',auth[_0x212f('0x8')](),controller[_0x212f('0x9')]);router[_0x212f('0xa')](_0x212f('0xb'),auth[_0x212f('0x8')](),controller[_0x212f('0xc')]);router[_0x212f('0xa')](_0x212f('0xd'),auth[_0x212f('0x8')](),controller[_0x212f('0xe')]);router[_0x212f('0xa')](_0x212f('0xf'),auth['isAuthenticated'](),controller[_0x212f('0x10')]);router[_0x212f('0xa')](_0x212f('0x11'),auth[_0x212f('0x8')](),controller[_0x212f('0x12')]);router['post']('/',auth[_0x212f('0x8')](),controller[_0x212f('0x13')]);router['put'](_0x212f('0xb'),auth[_0x212f('0x8')](),controller[_0x212f('0x14')]);router[_0x212f('0x15')](_0x212f('0xb'),auth['isAuthenticated'](),controller[_0x212f('0x16')]);module[_0x212f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c2902a7..5242caa 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 _0x8e60=['sequelize','exports','STRING'];(function(_0x5bc241,_0x1e7e19){var _0xcfddd7=function(_0x3d905a){while(--_0x3d905a){_0x5bc241['push'](_0x5bc241['shift']());}};_0xcfddd7(++_0x1e7e19);}(_0x8e60,0x18c));var _0x08e6=function(_0x4bf3f9,_0x459195){_0x4bf3f9=_0x4bf3f9-0x0;var _0x7bd6fc=_0x8e60[_0x4bf3f9];return _0x7bd6fc;};'use strict';var Sequelize=require(_0x08e6('0x0'));module[_0x08e6('0x1')]={'name':{'type':Sequelize[_0x08e6('0x2')]},'description':{'type':Sequelize[_0x08e6('0x2')]}}; \ No newline at end of file +var _0x022e=['sequelize','exports','STRING'];(function(_0x18c950,_0x552379){var _0x521094=function(_0x59836c){while(--_0x59836c){_0x18c950['push'](_0x18c950['shift']());}};_0x521094(++_0x552379);}(_0x022e,0x18c));var _0xe022=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0x022e[_0x5c3ae9];return _0x3f5950;};'use strict';var Sequelize=require(_0xe022('0x0'));module[_0xe022('0x1')]={'name':{'type':Sequelize[_0xe022('0x2')]},'description':{'type':Sequelize[_0xe022('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 6368341..6d02d0e 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 _0x9cb1=['SugarcrmConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send','index'];(function(_0x38ecb0,_0x3dee6d){var _0x37aa84=function(_0x2f9568){while(--_0x2f9568){_0x38ecb0['push'](_0x38ecb0['shift']());}};_0x37aa84(++_0x3dee6d);}(_0x9cb1,0x76));var _0x19cb=function(_0x283cbb,_0x2d8839){_0x283cbb=_0x283cbb-0x0;var _0x4755e8=_0x9cb1[_0x283cbb];return _0x4755e8;};'use strict';var emlformat=require(_0x19cb('0x0'));var rimraf=require(_0x19cb('0x1'));var zipdir=require(_0x19cb('0x2'));var jsonpatch=require(_0x19cb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x19cb('0x4'));var Mustache=require('mustache');var util=require(_0x19cb('0x5'));var path=require(_0x19cb('0x6'));var sox=require(_0x19cb('0x7'));var csv=require(_0x19cb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x19cb('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x19cb('0xa'));var jsforce=require(_0x19cb('0xb'));var deskjs=require(_0x19cb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x19cb('0xd'));var Papa=require(_0x19cb('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x19cb('0xf'));var as=require(_0x19cb('0x10'));var hardwareService=require(_0x19cb('0x11'));var logger=require(_0x19cb('0x12'))(_0x19cb('0x13'));var utils=require(_0x19cb('0x14'));var config=require(_0x19cb('0x15'));var licenseUtil=require(_0x19cb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x151fb5,_0x1b491c){_0x1b491c=_0x1b491c||0xcc;return function(_0x7e9467){if(_0x7e9467){return _0x151fb5['sendStatus'](_0x1b491c);}return _0x151fb5[_0x19cb('0x17')](_0x1b491c)['end']();};}function respondWithResult(_0xcabb54,_0x14a6c9){_0x14a6c9=_0x14a6c9||0xc8;return function(_0x536c16){if(_0x536c16){return _0xcabb54['status'](_0x14a6c9)['json'](_0x536c16);}};}function respondWithFilteredResult(_0x38e5b8,_0x1c97bd){return function(_0x248297){if(_0x248297){var _0x39b4f4=typeof _0x1c97bd['offset']==='undefined'&&typeof _0x1c97bd[_0x19cb('0x18')]==='undefined';var _0x22de18=_0x248297[_0x19cb('0x19')];var _0x573d95=_0x39b4f4?0x0:_0x1c97bd[_0x19cb('0x1a')];var _0x3e4eb9=_0x39b4f4?_0x248297[_0x19cb('0x19')]:_0x1c97bd[_0x19cb('0x1a')]+_0x1c97bd[_0x19cb('0x18')];var _0x3d24c3;if(_0x3e4eb9>=_0x22de18){_0x3e4eb9=_0x22de18;_0x3d24c3=0xc8;}else{_0x3d24c3=0xce;}_0x38e5b8[_0x19cb('0x17')](_0x3d24c3);return _0x38e5b8[_0x19cb('0x1b')](_0x19cb('0x1c'),_0x573d95+'-'+_0x3e4eb9+'/'+_0x22de18)[_0x19cb('0x1d')](_0x248297);}return null;};}function patchUpdates(_0x2a82a7){return function(_0x434e9e){try{jsonpatch[_0x19cb('0x1e')](_0x434e9e,_0x2a82a7,!![]);}catch(_0x49aa8a){return BPromise[_0x19cb('0x1f')](_0x49aa8a);}return _0x434e9e[_0x19cb('0x20')]();};}function saveUpdates(_0x2f4779,_0xc1e9cc){return function(_0x566278){if(_0x566278){return _0x566278[_0x19cb('0x21')](_0x2f4779)['then'](function(_0x41b3fd){return _0x41b3fd;});}return null;};}function removeEntity(_0x5e3de4,_0x2b65e5){return function(_0x9210ac){if(_0x9210ac){return _0x9210ac[_0x19cb('0x22')]()[_0x19cb('0x23')](function(){_0x5e3de4[_0x19cb('0x17')](0xcc)[_0x19cb('0x24')]();});}};}function handleEntityNotFound(_0x1a6be6,_0xc286a2){return function(_0x4b3ff5){if(!_0x4b3ff5){_0x1a6be6[_0x19cb('0x25')](0x194);}return _0x4b3ff5;};}function handleError(_0x5567f6,_0x3f1bcd){_0x3f1bcd=_0x3f1bcd||0x1f4;return function(_0xba516c){logger['error'](_0xba516c[_0x19cb('0x26')]);if(_0xba516c[_0x19cb('0x27')]){delete _0xba516c[_0x19cb('0x27')];}_0x5567f6[_0x19cb('0x17')](_0x3f1bcd)[_0x19cb('0x28')](_0xba516c);};}exports[_0x19cb('0x29')]=function(_0x181d3e,_0x1fd75b){var _0x13ac34={},_0x3c49fd={},_0x46b61d={'count':0x0,'rows':[]};var _0x3c98b3=_['map'](db[_0x19cb('0x2a')][_0x19cb('0x2b')],function(_0x253090){return{'name':_0x253090[_0x19cb('0x2c')],'type':_0x253090[_0x19cb('0x2d')]['key']};});_0x3c49fd[_0x19cb('0x2e')]=_[_0x19cb('0x2f')](_0x3c98b3,_0x19cb('0x27'));_0x3c49fd[_0x19cb('0x30')]=_[_0x19cb('0x31')](_0x181d3e[_0x19cb('0x30')]);_0x3c49fd[_0x19cb('0x32')]=_[_0x19cb('0x33')](_0x3c49fd['model'],_0x3c49fd[_0x19cb('0x30')]);_0x13ac34[_0x19cb('0x34')]=_[_0x19cb('0x33')](_0x3c49fd[_0x19cb('0x2e')],qs['fields'](_0x181d3e['query'][_0x19cb('0x35')]));_0x13ac34[_0x19cb('0x34')]=_0x13ac34['attributes'][_0x19cb('0x36')]?_0x13ac34[_0x19cb('0x34')]:_0x3c49fd[_0x19cb('0x2e')];if(!_0x181d3e['query'][_0x19cb('0x37')](_0x19cb('0x38'))){_0x13ac34[_0x19cb('0x18')]=qs[_0x19cb('0x18')](_0x181d3e[_0x19cb('0x30')][_0x19cb('0x18')]);_0x13ac34[_0x19cb('0x1a')]=qs[_0x19cb('0x1a')](_0x181d3e[_0x19cb('0x30')]['offset']);}_0x13ac34['order']=qs['sort'](_0x181d3e['query'][_0x19cb('0x39')]);_0x13ac34['where']=qs[_0x19cb('0x32')](_[_0x19cb('0x3a')](_0x181d3e[_0x19cb('0x30')],_0x3c49fd[_0x19cb('0x32')]),_0x3c98b3);if(_0x181d3e[_0x19cb('0x30')][_0x19cb('0x3b')]){_0x13ac34['where']=_['merge'](_0x13ac34[_0x19cb('0x3c')],{'$or':_['map'](_0x3c98b3,function(_0x35e864){if(_0x35e864[_0x19cb('0x2d')]!==_0x19cb('0x3d')){var _0x3273e8={};_0x3273e8[_0x35e864[_0x19cb('0x27')]]={'$like':'%'+_0x181d3e['query'][_0x19cb('0x3b')]+'%'};return _0x3273e8;}})});}_0x13ac34=_['merge']({},_0x13ac34,_0x181d3e[_0x19cb('0x3e')]);var _0x41bf80={'where':_0x13ac34[_0x19cb('0x3c')]};return db[_0x19cb('0x2a')][_0x19cb('0x19')](_0x41bf80)['then'](function(_0x309706){_0x46b61d[_0x19cb('0x19')]=_0x309706;if(_0x181d3e[_0x19cb('0x30')][_0x19cb('0x3f')]){_0x13ac34[_0x19cb('0x40')]=[{'all':!![]}];}return db[_0x19cb('0x2a')][_0x19cb('0x41')](_0x13ac34);})['then'](function(_0x138f80){_0x46b61d[_0x19cb('0x42')]=_0x138f80;return _0x46b61d;})['then'](respondWithFilteredResult(_0x1fd75b,_0x13ac34))[_0x19cb('0x43')](handleError(_0x1fd75b,null));};exports[_0x19cb('0x44')]=function(_0x4d8c0e,_0x4a363){var _0x379880={'raw':![],'where':{'id':_0x4d8c0e[_0x19cb('0x45')]['id']}},_0x309819={};_0x309819['model']=_[_0x19cb('0x31')](db['SugarcrmConfiguration']['rawAttributes']);_0x309819[_0x19cb('0x30')]=_[_0x19cb('0x31')](_0x4d8c0e[_0x19cb('0x30')]);_0x309819[_0x19cb('0x32')]=_[_0x19cb('0x33')](_0x309819['model'],_0x309819['query']);_0x379880[_0x19cb('0x34')]=_[_0x19cb('0x33')](_0x309819[_0x19cb('0x2e')],qs[_0x19cb('0x35')](_0x4d8c0e[_0x19cb('0x30')][_0x19cb('0x35')]));_0x379880[_0x19cb('0x34')]=_0x379880[_0x19cb('0x34')][_0x19cb('0x36')]?_0x379880[_0x19cb('0x34')]:_0x309819[_0x19cb('0x2e')];if(_0x4d8c0e['query'][_0x19cb('0x3f')]){_0x379880[_0x19cb('0x40')]=[{'all':!![]}];}_0x379880=_[_0x19cb('0x46')]({},_0x379880,_0x4d8c0e['options']);return db[_0x19cb('0x2a')]['find'](_0x379880)[_0x19cb('0x23')](handleEntityNotFound(_0x4a363,null))[_0x19cb('0x23')](respondWithResult(_0x4a363,null))[_0x19cb('0x43')](handleError(_0x4a363,null));};exports[_0x19cb('0x47')]=function(_0x16ebc1,_0x110811){return db[_0x19cb('0x2a')][_0x19cb('0x47')](_0x16ebc1[_0x19cb('0x48')],{})[_0x19cb('0x23')](respondWithResult(_0x110811,0xc9))[_0x19cb('0x43')](handleError(_0x110811,null));};exports[_0x19cb('0x21')]=function(_0x58efd7,_0x2913a5){if(_0x58efd7[_0x19cb('0x48')]['id']){delete _0x58efd7['body']['id'];}return db[_0x19cb('0x2a')][_0x19cb('0x49')]({'where':{'id':_0x58efd7[_0x19cb('0x45')]['id']}})[_0x19cb('0x23')](handleEntityNotFound(_0x2913a5,null))['then'](saveUpdates(_0x58efd7[_0x19cb('0x48')],null))[_0x19cb('0x23')](respondWithResult(_0x2913a5,null))[_0x19cb('0x43')](handleError(_0x2913a5,null));};exports[_0x19cb('0x22')]=function(_0x4599a,_0x301ad2){return db[_0x19cb('0x2a')][_0x19cb('0x49')]({'where':{'id':_0x4599a[_0x19cb('0x45')]['id']}})['then'](handleEntityNotFound(_0x301ad2,null))['then'](removeEntity(_0x301ad2,null))[_0x19cb('0x43')](handleError(_0x301ad2,null));};exports[_0x19cb('0x4a')]=function(_0x4115cf,_0x72e9a0,_0x65057){var _0x134723={};var _0x577751={};var _0x30abb3;var _0x345fd9;return db[_0x19cb('0x2a')][_0x19cb('0x4b')]({'where':{'id':_0x4115cf[_0x19cb('0x45')]['id']}})[_0x19cb('0x23')](handleEntityNotFound(_0x72e9a0,null))[_0x19cb('0x23')](function(_0x4287d4){if(_0x4287d4){_0x30abb3=_0x4287d4;_0x577751[_0x19cb('0x2e')]=_[_0x19cb('0x31')](db[_0x19cb('0x4c')][_0x19cb('0x2b')]);_0x577751[_0x19cb('0x30')]=_[_0x19cb('0x31')](_0x4115cf[_0x19cb('0x30')]);_0x577751[_0x19cb('0x32')]=_[_0x19cb('0x33')](_0x577751[_0x19cb('0x2e')],_0x577751[_0x19cb('0x30')]);_0x134723['attributes']=_['intersection'](_0x577751[_0x19cb('0x2e')],qs[_0x19cb('0x35')](_0x4115cf['query'][_0x19cb('0x35')]));_0x134723[_0x19cb('0x34')]=_0x134723[_0x19cb('0x34')]['length']?_0x134723[_0x19cb('0x34')]:_0x577751[_0x19cb('0x2e')];_0x134723[_0x19cb('0x4d')]=qs[_0x19cb('0x39')](_0x4115cf[_0x19cb('0x30')][_0x19cb('0x39')]);_0x134723[_0x19cb('0x3c')]=qs[_0x19cb('0x32')](_[_0x19cb('0x3a')](_0x4115cf[_0x19cb('0x30')],_0x577751[_0x19cb('0x32')]));if(_0x4115cf[_0x19cb('0x30')][_0x19cb('0x3b')]){_0x134723[_0x19cb('0x3c')]=_['merge'](_0x134723[_0x19cb('0x3c')],{'$or':_[_0x19cb('0x2f')](_0x134723[_0x19cb('0x34')],function(_0x25e3b6){var _0x300831={};_0x300831[_0x25e3b6]={'$like':'%'+_0x4115cf[_0x19cb('0x30')][_0x19cb('0x3b')]+'%'};return _0x300831;})});}_0x134723=_[_0x19cb('0x46')]({},_0x134723,_0x4115cf['options']);return _0x30abb3['getFields'](_0x134723);}})[_0x19cb('0x23')](function(_0x29e837){if(_0x29e837){_0x345fd9=_0x29e837[_0x19cb('0x36')];if(!_0x4115cf[_0x19cb('0x30')][_0x19cb('0x37')](_0x19cb('0x38'))){_0x134723[_0x19cb('0x18')]=qs[_0x19cb('0x18')](_0x4115cf[_0x19cb('0x30')]['limit']);_0x134723[_0x19cb('0x1a')]=qs['offset'](_0x4115cf[_0x19cb('0x30')][_0x19cb('0x1a')]);}return _0x30abb3[_0x19cb('0x4a')](_0x134723);}})[_0x19cb('0x23')](function(_0x4f87a8){if(_0x4f87a8){return _0x4f87a8?{'count':_0x345fd9,'rows':_0x4f87a8}:null;}})[_0x19cb('0x23')](respondWithResult(_0x72e9a0,null))['catch'](handleError(_0x72e9a0,null));};exports[_0x19cb('0x4e')]=function(_0x1b0c7a,_0x38fc12,_0x3d441c){var _0x379617={};var _0x13e653={};var _0x4050c5;var _0x5971b2;return db['SugarcrmConfiguration'][_0x19cb('0x4b')]({'where':{'id':_0x1b0c7a['params']['id']}})[_0x19cb('0x23')](handleEntityNotFound(_0x38fc12,null))[_0x19cb('0x23')](function(_0x16bf9c){if(_0x16bf9c){_0x4050c5=_0x16bf9c;_0x13e653[_0x19cb('0x2e')]=_[_0x19cb('0x31')](db['SugarcrmField'][_0x19cb('0x2b')]);_0x13e653[_0x19cb('0x30')]=_[_0x19cb('0x31')](_0x1b0c7a['query']);_0x13e653[_0x19cb('0x32')]=_[_0x19cb('0x33')](_0x13e653[_0x19cb('0x2e')],_0x13e653[_0x19cb('0x30')]);_0x379617['attributes']=_[_0x19cb('0x33')](_0x13e653['model'],qs[_0x19cb('0x35')](_0x1b0c7a[_0x19cb('0x30')][_0x19cb('0x35')]));_0x379617[_0x19cb('0x34')]=_0x379617[_0x19cb('0x34')][_0x19cb('0x36')]?_0x379617[_0x19cb('0x34')]:_0x13e653['model'];_0x379617[_0x19cb('0x4d')]=qs[_0x19cb('0x39')](_0x1b0c7a[_0x19cb('0x30')][_0x19cb('0x39')]);_0x379617[_0x19cb('0x3c')]=qs[_0x19cb('0x32')](_[_0x19cb('0x3a')](_0x1b0c7a[_0x19cb('0x30')],_0x13e653[_0x19cb('0x32')]));if(_0x1b0c7a['query'][_0x19cb('0x3b')]){_0x379617[_0x19cb('0x3c')]=_['merge'](_0x379617[_0x19cb('0x3c')],{'$or':_[_0x19cb('0x2f')](_0x379617[_0x19cb('0x34')],function(_0x55061d){var _0x1c8714={};_0x1c8714[_0x55061d]={'$like':'%'+_0x1b0c7a['query'][_0x19cb('0x3b')]+'%'};return _0x1c8714;})});}_0x379617=_[_0x19cb('0x46')]({},_0x379617,_0x1b0c7a['options']);return _0x4050c5['getSubjects'](_0x379617);}})['then'](function(_0x20fdcc){if(_0x20fdcc){_0x5971b2=_0x20fdcc[_0x19cb('0x36')];if(!_0x1b0c7a[_0x19cb('0x30')][_0x19cb('0x37')](_0x19cb('0x38'))){_0x379617['limit']=qs[_0x19cb('0x18')](_0x1b0c7a[_0x19cb('0x30')]['limit']);_0x379617[_0x19cb('0x1a')]=qs['offset'](_0x1b0c7a[_0x19cb('0x30')][_0x19cb('0x1a')]);}return _0x4050c5[_0x19cb('0x4e')](_0x379617);}})['then'](function(_0x3714a4){if(_0x3714a4){return _0x3714a4?{'count':_0x5971b2,'rows':_0x3714a4}:null;}})[_0x19cb('0x23')](respondWithResult(_0x38fc12,null))['catch'](handleError(_0x38fc12,null));};exports[_0x19cb('0x4f')]=function(_0xdb12a0,_0x3e9a78,_0x1974d7){var _0x1b4a74={};var _0x4f1fa5={};var _0x213781;var _0x3dcc69;return db[_0x19cb('0x2a')][_0x19cb('0x4b')]({'where':{'id':_0xdb12a0['params']['id']}})[_0x19cb('0x23')](handleEntityNotFound(_0x3e9a78,null))[_0x19cb('0x23')](function(_0x28c562){if(_0x28c562){_0x213781=_0x28c562;_0x4f1fa5[_0x19cb('0x2e')]=_['keys'](db[_0x19cb('0x4c')]['rawAttributes']);_0x4f1fa5[_0x19cb('0x30')]=_[_0x19cb('0x31')](_0xdb12a0[_0x19cb('0x30')]);_0x4f1fa5[_0x19cb('0x32')]=_[_0x19cb('0x33')](_0x4f1fa5['model'],_0x4f1fa5[_0x19cb('0x30')]);_0x1b4a74[_0x19cb('0x34')]=_[_0x19cb('0x33')](_0x4f1fa5[_0x19cb('0x2e')],qs[_0x19cb('0x35')](_0xdb12a0[_0x19cb('0x30')][_0x19cb('0x35')]));_0x1b4a74[_0x19cb('0x34')]=_0x1b4a74['attributes']['length']?_0x1b4a74[_0x19cb('0x34')]:_0x4f1fa5[_0x19cb('0x2e')];_0x1b4a74[_0x19cb('0x4d')]=qs['sort'](_0xdb12a0[_0x19cb('0x30')]['sort']);_0x1b4a74[_0x19cb('0x3c')]=qs[_0x19cb('0x32')](_[_0x19cb('0x3a')](_0xdb12a0['query'],_0x4f1fa5['filters']));if(_0xdb12a0[_0x19cb('0x30')][_0x19cb('0x3b')]){_0x1b4a74[_0x19cb('0x3c')]=_['merge'](_0x1b4a74[_0x19cb('0x3c')],{'$or':_[_0x19cb('0x2f')](_0x1b4a74[_0x19cb('0x34')],function(_0x3b982c){var _0x2b433c={};_0x2b433c[_0x3b982c]={'$like':'%'+_0xdb12a0[_0x19cb('0x30')][_0x19cb('0x3b')]+'%'};return _0x2b433c;})});}_0x1b4a74=_['merge']({},_0x1b4a74,_0xdb12a0[_0x19cb('0x3e')]);return _0x213781['getDescriptions'](_0x1b4a74);}})[_0x19cb('0x23')](function(_0x561eeb){if(_0x561eeb){_0x3dcc69=_0x561eeb[_0x19cb('0x36')];if(!_0xdb12a0['query'][_0x19cb('0x37')]('nolimit')){_0x1b4a74[_0x19cb('0x18')]=qs[_0x19cb('0x18')](_0xdb12a0['query'][_0x19cb('0x18')]);_0x1b4a74[_0x19cb('0x1a')]=qs['offset'](_0xdb12a0[_0x19cb('0x30')][_0x19cb('0x1a')]);}return _0x213781[_0x19cb('0x4f')](_0x1b4a74);}})[_0x19cb('0x23')](function(_0x1a4b57){if(_0x1a4b57){return _0x1a4b57?{'count':_0x3dcc69,'rows':_0x1a4b57}:null;}})[_0x19cb('0x23')](respondWithResult(_0x3e9a78,null))[_0x19cb('0x43')](handleError(_0x3e9a78,null));}; \ No newline at end of file +var _0x8e04=['update','then','end','stack','name','index','map','SugarcrmConfiguration','rawAttributes','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','fields','include','options','find','create','body','destroy','getFields','SugarcrmField','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','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','json','undefined','limit','count','offset','set','apply','reject','save'];(function(_0x172691,_0x319afb){var _0xd8626e=function(_0xb5fea4){while(--_0xb5fea4){_0x172691['push'](_0x172691['shift']());}};_0xd8626e(++_0x319afb);}(_0x8e04,0x116));var _0x48e0=function(_0x5c23cc,_0x3bac85){_0x5c23cc=_0x5c23cc-0x0;var _0x1add2d=_0x8e04[_0x5c23cc];return _0x1add2d;};'use strict';var emlformat=require(_0x48e0('0x0'));var rimraf=require(_0x48e0('0x1'));var zipdir=require(_0x48e0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48e0('0x3'));var moment=require('moment');var BPromise=require(_0x48e0('0x4'));var Mustache=require(_0x48e0('0x5'));var util=require(_0x48e0('0x6'));var path=require(_0x48e0('0x7'));var sox=require(_0x48e0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48e0('0x9'));var squel=require(_0x48e0('0xa'));var crypto=require(_0x48e0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x48e0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x48e0('0xd'));var Papa=require('papaparse');var Redis=require(_0x48e0('0xe'));var authService=require(_0x48e0('0xf'));var qs=require(_0x48e0('0x10'));var as=require(_0x48e0('0x11'));var hardwareService=require(_0x48e0('0x12'));var logger=require(_0x48e0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x48e0('0x14'));var licenseUtil=require(_0x48e0('0x15'));var db=require(_0x48e0('0x16'))['db'];function respondWithStatusCode(_0x2910b8,_0x321e18){_0x321e18=_0x321e18||0xcc;return function(_0x304619){if(_0x304619){return _0x2910b8[_0x48e0('0x17')](_0x321e18);}return _0x2910b8['status'](_0x321e18)['end']();};}function respondWithResult(_0x1b374f,_0x67c39e){_0x67c39e=_0x67c39e||0xc8;return function(_0x2152b3){if(_0x2152b3){return _0x1b374f[_0x48e0('0x18')](_0x67c39e)[_0x48e0('0x19')](_0x2152b3);}};}function respondWithFilteredResult(_0x4e2755,_0x1222e4){return function(_0x204d63){if(_0x204d63){var _0x3981f3=typeof _0x1222e4['offset']===_0x48e0('0x1a')&&typeof _0x1222e4[_0x48e0('0x1b')]===_0x48e0('0x1a');var _0x4d112a=_0x204d63['count'];var _0x558e23=_0x3981f3?0x0:_0x1222e4['offset'];var _0x217d84=_0x3981f3?_0x204d63[_0x48e0('0x1c')]:_0x1222e4[_0x48e0('0x1d')]+_0x1222e4[_0x48e0('0x1b')];var _0x4880dc;if(_0x217d84>=_0x4d112a){_0x217d84=_0x4d112a;_0x4880dc=0xc8;}else{_0x4880dc=0xce;}_0x4e2755[_0x48e0('0x18')](_0x4880dc);return _0x4e2755[_0x48e0('0x1e')]('Content-Range',_0x558e23+'-'+_0x217d84+'/'+_0x4d112a)['json'](_0x204d63);}return null;};}function patchUpdates(_0x4cafc4){return function(_0x35793f){try{jsonpatch[_0x48e0('0x1f')](_0x35793f,_0x4cafc4,!![]);}catch(_0x3d1ff4){return BPromise[_0x48e0('0x20')](_0x3d1ff4);}return _0x35793f[_0x48e0('0x21')]();};}function saveUpdates(_0x5b15e3,_0x24e23d){return function(_0x31e526){if(_0x31e526){return _0x31e526[_0x48e0('0x22')](_0x5b15e3)[_0x48e0('0x23')](function(_0x1a81d1){return _0x1a81d1;});}return null;};}function removeEntity(_0x164205,_0x19481e){return function(_0x4b6c83){if(_0x4b6c83){return _0x4b6c83['destroy']()[_0x48e0('0x23')](function(){_0x164205[_0x48e0('0x18')](0xcc)[_0x48e0('0x24')]();});}};}function handleEntityNotFound(_0x1bd0db,_0x5ac46a){return function(_0x465292){if(!_0x465292){_0x1bd0db['sendStatus'](0x194);}return _0x465292;};}function handleError(_0x5ad93e,_0xc4be51){_0xc4be51=_0xc4be51||0x1f4;return function(_0x1744dd){logger['error'](_0x1744dd[_0x48e0('0x25')]);if(_0x1744dd[_0x48e0('0x26')]){delete _0x1744dd['name'];}_0x5ad93e[_0x48e0('0x18')](_0xc4be51)['send'](_0x1744dd);};}exports[_0x48e0('0x27')]=function(_0x452478,_0x46a85a){var _0x22b9f4={},_0x67b012={},_0x2dc99d={'count':0x0,'rows':[]};var _0x2333b6=_[_0x48e0('0x28')](db[_0x48e0('0x29')][_0x48e0('0x2a')],function(_0x575cf6){return{'name':_0x575cf6['fieldName'],'type':_0x575cf6[_0x48e0('0x2b')]['key']};});_0x67b012[_0x48e0('0x2c')]=_[_0x48e0('0x28')](_0x2333b6,_0x48e0('0x26'));_0x67b012[_0x48e0('0x2d')]=_[_0x48e0('0x2e')](_0x452478[_0x48e0('0x2d')]);_0x67b012['filters']=_[_0x48e0('0x2f')](_0x67b012[_0x48e0('0x2c')],_0x67b012[_0x48e0('0x2d')]);_0x22b9f4['attributes']=_['intersection'](_0x67b012[_0x48e0('0x2c')],qs['fields'](_0x452478[_0x48e0('0x2d')]['fields']));_0x22b9f4[_0x48e0('0x30')]=_0x22b9f4[_0x48e0('0x30')][_0x48e0('0x31')]?_0x22b9f4['attributes']:_0x67b012[_0x48e0('0x2c')];if(!_0x452478[_0x48e0('0x2d')][_0x48e0('0x32')](_0x48e0('0x33'))){_0x22b9f4[_0x48e0('0x1b')]=qs[_0x48e0('0x1b')](_0x452478[_0x48e0('0x2d')][_0x48e0('0x1b')]);_0x22b9f4[_0x48e0('0x1d')]=qs['offset'](_0x452478[_0x48e0('0x2d')][_0x48e0('0x1d')]);}_0x22b9f4[_0x48e0('0x34')]=qs[_0x48e0('0x35')](_0x452478['query'][_0x48e0('0x35')]);_0x22b9f4[_0x48e0('0x36')]=qs[_0x48e0('0x37')](_[_0x48e0('0x38')](_0x452478[_0x48e0('0x2d')],_0x67b012[_0x48e0('0x37')]),_0x2333b6);if(_0x452478[_0x48e0('0x2d')][_0x48e0('0x39')]){_0x22b9f4[_0x48e0('0x36')]=_['merge'](_0x22b9f4[_0x48e0('0x36')],{'$or':_[_0x48e0('0x28')](_0x2333b6,function(_0x5641bf){if(_0x5641bf['type']!==_0x48e0('0x3a')){var _0x37e501={};_0x37e501[_0x5641bf[_0x48e0('0x26')]]={'$like':'%'+_0x452478[_0x48e0('0x2d')][_0x48e0('0x39')]+'%'};return _0x37e501;}})});}_0x22b9f4=_[_0x48e0('0x3b')]({},_0x22b9f4,_0x452478['options']);var _0x9cf6f={'where':_0x22b9f4[_0x48e0('0x36')]};return db[_0x48e0('0x29')][_0x48e0('0x1c')](_0x9cf6f)[_0x48e0('0x23')](function(_0xd140f5){_0x2dc99d[_0x48e0('0x1c')]=_0xd140f5;if(_0x452478[_0x48e0('0x2d')][_0x48e0('0x3c')]){_0x22b9f4['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x48e0('0x3d')](_0x22b9f4);})[_0x48e0('0x23')](function(_0x47c813){_0x2dc99d[_0x48e0('0x3e')]=_0x47c813;return _0x2dc99d;})['then'](respondWithFilteredResult(_0x46a85a,_0x22b9f4))[_0x48e0('0x3f')](handleError(_0x46a85a,null));};exports[_0x48e0('0x40')]=function(_0x3cb688,_0x492754){var _0x33ca84={'raw':![],'where':{'id':_0x3cb688[_0x48e0('0x41')]['id']}},_0x48387f={};_0x48387f['model']=_[_0x48e0('0x2e')](db[_0x48e0('0x29')][_0x48e0('0x2a')]);_0x48387f[_0x48e0('0x2d')]=_[_0x48e0('0x2e')](_0x3cb688[_0x48e0('0x2d')]);_0x48387f[_0x48e0('0x37')]=_[_0x48e0('0x2f')](_0x48387f['model'],_0x48387f[_0x48e0('0x2d')]);_0x33ca84[_0x48e0('0x30')]=_[_0x48e0('0x2f')](_0x48387f[_0x48e0('0x2c')],qs[_0x48e0('0x42')](_0x3cb688[_0x48e0('0x2d')]['fields']));_0x33ca84[_0x48e0('0x30')]=_0x33ca84[_0x48e0('0x30')][_0x48e0('0x31')]?_0x33ca84[_0x48e0('0x30')]:_0x48387f[_0x48e0('0x2c')];if(_0x3cb688[_0x48e0('0x2d')][_0x48e0('0x3c')]){_0x33ca84[_0x48e0('0x43')]=[{'all':!![]}];}_0x33ca84=_[_0x48e0('0x3b')]({},_0x33ca84,_0x3cb688[_0x48e0('0x44')]);return db[_0x48e0('0x29')][_0x48e0('0x45')](_0x33ca84)['then'](handleEntityNotFound(_0x492754,null))[_0x48e0('0x23')](respondWithResult(_0x492754,null))[_0x48e0('0x3f')](handleError(_0x492754,null));};exports[_0x48e0('0x46')]=function(_0x10bb3a,_0x3aa3dc){return db[_0x48e0('0x29')][_0x48e0('0x46')](_0x10bb3a['body'],{})[_0x48e0('0x23')](respondWithResult(_0x3aa3dc,0xc9))[_0x48e0('0x3f')](handleError(_0x3aa3dc,null));};exports[_0x48e0('0x22')]=function(_0x2c3301,_0x403961){if(_0x2c3301[_0x48e0('0x47')]['id']){delete _0x2c3301[_0x48e0('0x47')]['id'];}return db[_0x48e0('0x29')][_0x48e0('0x45')]({'where':{'id':_0x2c3301['params']['id']}})[_0x48e0('0x23')](handleEntityNotFound(_0x403961,null))[_0x48e0('0x23')](saveUpdates(_0x2c3301[_0x48e0('0x47')],null))[_0x48e0('0x23')](respondWithResult(_0x403961,null))[_0x48e0('0x3f')](handleError(_0x403961,null));};exports[_0x48e0('0x48')]=function(_0x2b7bc7,_0x4be594){return db[_0x48e0('0x29')][_0x48e0('0x45')]({'where':{'id':_0x2b7bc7[_0x48e0('0x41')]['id']}})[_0x48e0('0x23')](handleEntityNotFound(_0x4be594,null))[_0x48e0('0x23')](removeEntity(_0x4be594,null))[_0x48e0('0x3f')](handleError(_0x4be594,null));};exports[_0x48e0('0x49')]=function(_0x2eb119,_0x3c7537,_0x467568){var _0x30b109={};var _0x503a7f={};var _0x5ef434;var _0x391503;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2eb119[_0x48e0('0x41')]['id']}})[_0x48e0('0x23')](handleEntityNotFound(_0x3c7537,null))[_0x48e0('0x23')](function(_0x460ec8){if(_0x460ec8){_0x5ef434=_0x460ec8;_0x503a7f[_0x48e0('0x2c')]=_[_0x48e0('0x2e')](db[_0x48e0('0x4a')]['rawAttributes']);_0x503a7f[_0x48e0('0x2d')]=_['keys'](_0x2eb119['query']);_0x503a7f[_0x48e0('0x37')]=_[_0x48e0('0x2f')](_0x503a7f['model'],_0x503a7f[_0x48e0('0x2d')]);_0x30b109[_0x48e0('0x30')]=_['intersection'](_0x503a7f[_0x48e0('0x2c')],qs[_0x48e0('0x42')](_0x2eb119[_0x48e0('0x2d')]['fields']));_0x30b109[_0x48e0('0x30')]=_0x30b109[_0x48e0('0x30')][_0x48e0('0x31')]?_0x30b109[_0x48e0('0x30')]:_0x503a7f['model'];_0x30b109['order']=qs[_0x48e0('0x35')](_0x2eb119[_0x48e0('0x2d')]['sort']);_0x30b109['where']=qs['filters'](_[_0x48e0('0x38')](_0x2eb119[_0x48e0('0x2d')],_0x503a7f[_0x48e0('0x37')]));if(_0x2eb119[_0x48e0('0x2d')]['filter']){_0x30b109[_0x48e0('0x36')]=_[_0x48e0('0x3b')](_0x30b109[_0x48e0('0x36')],{'$or':_[_0x48e0('0x28')](_0x30b109[_0x48e0('0x30')],function(_0xfdb68b){var _0x2b0701={};_0x2b0701[_0xfdb68b]={'$like':'%'+_0x2eb119[_0x48e0('0x2d')][_0x48e0('0x39')]+'%'};return _0x2b0701;})});}_0x30b109=_[_0x48e0('0x3b')]({},_0x30b109,_0x2eb119[_0x48e0('0x44')]);return _0x5ef434[_0x48e0('0x49')](_0x30b109);}})[_0x48e0('0x23')](function(_0x31ff9f){if(_0x31ff9f){_0x391503=_0x31ff9f['length'];if(!_0x2eb119['query']['hasOwnProperty'](_0x48e0('0x33'))){_0x30b109['limit']=qs[_0x48e0('0x1b')](_0x2eb119['query'][_0x48e0('0x1b')]);_0x30b109[_0x48e0('0x1d')]=qs[_0x48e0('0x1d')](_0x2eb119['query'][_0x48e0('0x1d')]);}return _0x5ef434['getFields'](_0x30b109);}})[_0x48e0('0x23')](function(_0x3bc6cd){if(_0x3bc6cd){return _0x3bc6cd?{'count':_0x391503,'rows':_0x3bc6cd}:null;}})['then'](respondWithResult(_0x3c7537,null))[_0x48e0('0x3f')](handleError(_0x3c7537,null));};exports[_0x48e0('0x4b')]=function(_0x35bc0b,_0xed255a,_0x3a5d00){var _0x32b1ff={};var _0x5e1af7={};var _0xfe067b;var _0x13bb9b;return db[_0x48e0('0x29')]['findOne']({'where':{'id':_0x35bc0b[_0x48e0('0x41')]['id']}})[_0x48e0('0x23')](handleEntityNotFound(_0xed255a,null))[_0x48e0('0x23')](function(_0xe07f87){if(_0xe07f87){_0xfe067b=_0xe07f87;_0x5e1af7[_0x48e0('0x2c')]=_[_0x48e0('0x2e')](db[_0x48e0('0x4a')][_0x48e0('0x2a')]);_0x5e1af7[_0x48e0('0x2d')]=_[_0x48e0('0x2e')](_0x35bc0b[_0x48e0('0x2d')]);_0x5e1af7[_0x48e0('0x37')]=_[_0x48e0('0x2f')](_0x5e1af7['model'],_0x5e1af7[_0x48e0('0x2d')]);_0x32b1ff[_0x48e0('0x30')]=_[_0x48e0('0x2f')](_0x5e1af7['model'],qs[_0x48e0('0x42')](_0x35bc0b[_0x48e0('0x2d')][_0x48e0('0x42')]));_0x32b1ff[_0x48e0('0x30')]=_0x32b1ff[_0x48e0('0x30')][_0x48e0('0x31')]?_0x32b1ff[_0x48e0('0x30')]:_0x5e1af7[_0x48e0('0x2c')];_0x32b1ff[_0x48e0('0x34')]=qs['sort'](_0x35bc0b[_0x48e0('0x2d')][_0x48e0('0x35')]);_0x32b1ff['where']=qs[_0x48e0('0x37')](_['pick'](_0x35bc0b[_0x48e0('0x2d')],_0x5e1af7[_0x48e0('0x37')]));if(_0x35bc0b[_0x48e0('0x2d')][_0x48e0('0x39')]){_0x32b1ff['where']=_[_0x48e0('0x3b')](_0x32b1ff['where'],{'$or':_[_0x48e0('0x28')](_0x32b1ff['attributes'],function(_0x2f6e17){var _0x18cc73={};_0x18cc73[_0x2f6e17]={'$like':'%'+_0x35bc0b['query'][_0x48e0('0x39')]+'%'};return _0x18cc73;})});}_0x32b1ff=_[_0x48e0('0x3b')]({},_0x32b1ff,_0x35bc0b[_0x48e0('0x44')]);return _0xfe067b[_0x48e0('0x4b')](_0x32b1ff);}})[_0x48e0('0x23')](function(_0xfba24c){if(_0xfba24c){_0x13bb9b=_0xfba24c[_0x48e0('0x31')];if(!_0x35bc0b['query']['hasOwnProperty'](_0x48e0('0x33'))){_0x32b1ff[_0x48e0('0x1b')]=qs[_0x48e0('0x1b')](_0x35bc0b[_0x48e0('0x2d')][_0x48e0('0x1b')]);_0x32b1ff[_0x48e0('0x1d')]=qs['offset'](_0x35bc0b[_0x48e0('0x2d')][_0x48e0('0x1d')]);}return _0xfe067b[_0x48e0('0x4b')](_0x32b1ff);}})[_0x48e0('0x23')](function(_0x15b212){if(_0x15b212){return _0x15b212?{'count':_0x13bb9b,'rows':_0x15b212}:null;}})['then'](respondWithResult(_0xed255a,null))[_0x48e0('0x3f')](handleError(_0xed255a,null));};exports[_0x48e0('0x4c')]=function(_0x506fab,_0xa0d210,_0x5f123b){var _0x4b78ea={};var _0x421e63={};var _0x536c2e;var _0x3000f3;return db[_0x48e0('0x29')][_0x48e0('0x4d')]({'where':{'id':_0x506fab['params']['id']}})['then'](handleEntityNotFound(_0xa0d210,null))[_0x48e0('0x23')](function(_0x513228){if(_0x513228){_0x536c2e=_0x513228;_0x421e63[_0x48e0('0x2c')]=_[_0x48e0('0x2e')](db[_0x48e0('0x4a')][_0x48e0('0x2a')]);_0x421e63['query']=_[_0x48e0('0x2e')](_0x506fab[_0x48e0('0x2d')]);_0x421e63[_0x48e0('0x37')]=_[_0x48e0('0x2f')](_0x421e63[_0x48e0('0x2c')],_0x421e63[_0x48e0('0x2d')]);_0x4b78ea[_0x48e0('0x30')]=_[_0x48e0('0x2f')](_0x421e63[_0x48e0('0x2c')],qs[_0x48e0('0x42')](_0x506fab[_0x48e0('0x2d')]['fields']));_0x4b78ea[_0x48e0('0x30')]=_0x4b78ea[_0x48e0('0x30')][_0x48e0('0x31')]?_0x4b78ea[_0x48e0('0x30')]:_0x421e63[_0x48e0('0x2c')];_0x4b78ea['order']=qs[_0x48e0('0x35')](_0x506fab[_0x48e0('0x2d')][_0x48e0('0x35')]);_0x4b78ea[_0x48e0('0x36')]=qs[_0x48e0('0x37')](_[_0x48e0('0x38')](_0x506fab[_0x48e0('0x2d')],_0x421e63['filters']));if(_0x506fab['query']['filter']){_0x4b78ea[_0x48e0('0x36')]=_['merge'](_0x4b78ea[_0x48e0('0x36')],{'$or':_[_0x48e0('0x28')](_0x4b78ea['attributes'],function(_0x57e51a){var _0x15d80f={};_0x15d80f[_0x57e51a]={'$like':'%'+_0x506fab['query'][_0x48e0('0x39')]+'%'};return _0x15d80f;})});}_0x4b78ea=_[_0x48e0('0x3b')]({},_0x4b78ea,_0x506fab[_0x48e0('0x44')]);return _0x536c2e['getDescriptions'](_0x4b78ea);}})[_0x48e0('0x23')](function(_0x464af3){if(_0x464af3){_0x3000f3=_0x464af3['length'];if(!_0x506fab[_0x48e0('0x2d')][_0x48e0('0x32')](_0x48e0('0x33'))){_0x4b78ea['limit']=qs[_0x48e0('0x1b')](_0x506fab[_0x48e0('0x2d')][_0x48e0('0x1b')]);_0x4b78ea[_0x48e0('0x1d')]=qs[_0x48e0('0x1d')](_0x506fab[_0x48e0('0x2d')][_0x48e0('0x1d')]);}return _0x536c2e[_0x48e0('0x4c')](_0x4b78ea);}})[_0x48e0('0x23')](function(_0x33bd25){if(_0x33bd25){return _0x33bd25?{'count':_0x3000f3,'rows':_0x33bd25}:null;}})['then'](respondWithResult(_0xa0d210,null))[_0x48e0('0x3f')](handleError(_0xa0d210,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 8b2d807..909f0f4 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 _0xcd8d=['lodash','util','../../config/logger','api','moment','request-promise','path','./intSugarcrmConfiguration.attributes','define'];(function(_0x52098c,_0x2166fb){var _0x4f5b1f=function(_0x314fa3){while(--_0x314fa3){_0x52098c['push'](_0x52098c['shift']());}};_0x4f5b1f(++_0x2166fb);}(_0xcd8d,0x120));var _0xdcd8=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0xcd8d[_0x4687df];return _0x32eaef;};'use strict';var _=require(_0xdcd8('0x0'));var util=require(_0xdcd8('0x1'));var logger=require(_0xdcd8('0x2'))(_0xdcd8('0x3'));var moment=require(_0xdcd8('0x4'));var BPromise=require('bluebird');var rp=require(_0xdcd8('0x5'));var fs=require('fs');var path=require(_0xdcd8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdcd8('0x7'));module['exports']=function(_0x972698,_0x40e396){return _0x972698[_0xdcd8('0x8')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9f4=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes'];(function(_0x40e22b,_0xf82f79){var _0x26e2b6=function(_0x14b585){while(--_0x14b585){_0x40e22b['push'](_0x40e22b['shift']());}};_0x26e2b6(++_0xf82f79);}(_0xa9f4,0x14d));var _0x4a9f=function(_0x394cb6,_0x3ba169){_0x394cb6=_0x394cb6-0x0;var _0x326968=_0xa9f4[_0x394cb6];return _0x326968;};'use strict';var _=require('lodash');var util=require(_0x4a9f('0x0'));var logger=require(_0x4a9f('0x1'))(_0x4a9f('0x2'));var moment=require('moment');var BPromise=require(_0x4a9f('0x3'));var rp=require(_0x4a9f('0x4'));var fs=require('fs');var path=require(_0x4a9f('0x5'));var rimraf=require(_0x4a9f('0x6'));var config=require('../../config/environment');var attributes=require(_0x4a9f('0x7'));module[_0x4a9f('0x8')]=function(_0x146b3d,_0x4a6388){return _0x146b3d['define'](_0x4a9f('0x9'),attributes,{'tableName':_0x4a9f('0xa'),'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 be902fa..dc03ce1 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 _0xfed9=['../../config/utils','../../config/environment','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xfed9,0x152));var _0x9fed=function(_0xb6a965,_0x5c5ace){_0xb6a965=_0xb6a965-0x0;var _0x51d37d=_0xfed9[_0xb6a965];return _0x51d37d;};'use strict';var _=require(_0x9fed('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9fed('0x1'));var fs=require('fs');var Redis=require(_0x9fed('0x2'));var db=require(_0x9fed('0x3'))['db'];var utils=require(_0x9fed('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9fed('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9fed('0x6')][_0x9fed('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x128678,_0x216997,_0x2f53b8){return new BPromise(function(_0x262a1a,_0x863051){return client['request'](_0x128678,_0x2f53b8)[_0x9fed('0x8')](function(_0x2c12bb){logger[_0x9fed('0x9')](_0x9fed('0xa'),_0x216997,_0x9fed('0xb'));logger[_0x9fed('0xc')](_0x9fed('0xd'),_0x216997,_0x9fed('0xb'),JSON['stringify'](_0x2c12bb));if(_0x2c12bb[_0x9fed('0xe')]){if(_0x2c12bb[_0x9fed('0xe')][_0x9fed('0xf')]===0x1f4){logger['error'](_0x9fed('0xa'),_0x216997,_0x2c12bb[_0x9fed('0xe')][_0x9fed('0x10')]);return _0x863051(_0x2c12bb['error']['message']);}logger['error'](_0x9fed('0xa'),_0x216997,_0x2c12bb[_0x9fed('0xe')][_0x9fed('0x10')]);return _0x262a1a(_0x2c12bb['error'][_0x9fed('0x10')]);}else{logger['info'](_0x9fed('0xa'),_0x216997,'request\x20sent');_0x262a1a(_0x2c12bb[_0x9fed('0x11')][_0x9fed('0x10')]);}})[_0x9fed('0x12')](function(_0x5c9e44){logger[_0x9fed('0xe')](_0x9fed('0xa'),_0x216997,_0x5c9e44);_0x863051(_0x5c9e44);});});} \ No newline at end of file +var _0xd790=['SugarcrmConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x125ca2,_0x5ac3d0){var _0x402039=function(_0x30a4d){while(--_0x30a4d){_0x125ca2['push'](_0x125ca2['shift']());}};_0x402039(++_0x5ac3d0);}(_0xd790,0x102));var _0x0d79=function(_0x132765,_0x2663cd){_0x132765=_0x132765-0x0;var _0x2f3263=_0xd790[_0x132765];return _0x2f3263;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0d79('0x0'));var BPromise=require(_0x0d79('0x1'));var rs=require(_0x0d79('0x2'));var fs=require('fs');var Redis=require(_0x0d79('0x3'));var db=require(_0x0d79('0x4'))['db'];var utils=require(_0x0d79('0x5'));var logger=require(_0x0d79('0x6'))(_0x0d79('0x7'));var config=require(_0x0d79('0x8'));var jayson=require(_0x0d79('0x9'));var client=jayson[_0x0d79('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c2b91,_0xf90363,_0x5855eb){return new BPromise(function(_0x200acf,_0x40f547){return client[_0x0d79('0xb')](_0x5c2b91,_0x5855eb)[_0x0d79('0xc')](function(_0x246efc){logger[_0x0d79('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xf90363,'request\x20sent');logger[_0x0d79('0xe')](_0x0d79('0xf'),_0xf90363,'request\x20sent',JSON['stringify'](_0x246efc));if(_0x246efc[_0x0d79('0x10')]){if(_0x246efc[_0x0d79('0x10')][_0x0d79('0x11')]===0x1f4){logger[_0x0d79('0x10')](_0x0d79('0x12'),_0xf90363,_0x246efc['error'][_0x0d79('0x13')]);return _0x40f547(_0x246efc[_0x0d79('0x10')][_0x0d79('0x13')]);}logger[_0x0d79('0x10')](_0x0d79('0x12'),_0xf90363,_0x246efc[_0x0d79('0x10')]['message']);return _0x200acf(_0x246efc[_0x0d79('0x10')][_0x0d79('0x13')]);}else{logger['info'](_0x0d79('0x12'),_0xf90363,_0x0d79('0x14'));_0x200acf(_0x246efc[_0x0d79('0x15')][_0x0d79('0x13')]);}})[_0x0d79('0x16')](function(_0x29429b){logger[_0x0d79('0x10')](_0x0d79('0x12'),_0xf90363,_0x29429b);_0x40f547(_0x29429b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e6d0f9b..bb795d5 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 _0x8f4e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','index','get','show','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x19bec2,_0xce0495){var _0x345c0c=function(_0x2a643a){while(--_0x2a643a){_0x19bec2['push'](_0x19bec2['shift']());}};_0x345c0c(++_0xce0495);}(_0x8f4e,0xfe));var _0xe8f4=function(_0x4d4c36,_0x1e2d05){_0x4d4c36=_0x4d4c36-0x0;var _0x47360e=_0x8f4e[_0x4d4c36];return _0x47360e;};'use strict';var multer=require(_0xe8f4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe8f4('0x1'));var express=require(_0xe8f4('0x2'));var router=express[_0xe8f4('0x3')]();var fs_extra=require(_0xe8f4('0x4'));var auth=require(_0xe8f4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe8f4('0x6'));var controller=require(_0xe8f4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8f4('0x8')]);router[_0xe8f4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe8f4('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xe8f4('0xb'),auth[_0xe8f4('0xc')](),controller[_0xe8f4('0xd')]);router[_0xe8f4('0xe')](_0xe8f4('0xb'),auth['isAuthenticated'](),controller[_0xe8f4('0xf')]);module[_0xe8f4('0x10')]=router; \ No newline at end of file +var _0x54eb=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show'];(function(_0x52af6f,_0x3f223d){var _0x55105a=function(_0x50a8a9){while(--_0x50a8a9){_0x52af6f['push'](_0x52af6f['shift']());}};_0x55105a(++_0x3f223d);}(_0x54eb,0x1d3));var _0xb54e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x54eb[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xb54e('0x0'));var util=require(_0xb54e('0x1'));var path=require(_0xb54e('0x2'));var timeout=require(_0xb54e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb54e('0x4'));var auth=require(_0xb54e('0x5'));var interaction=require(_0xb54e('0x6'));var config=require(_0xb54e('0x7'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb54e('0x8')]);router[_0xb54e('0x9')](_0xb54e('0xa'),auth[_0xb54e('0xb')](),controller[_0xb54e('0xc')]);router[_0xb54e('0xd')]('/',auth[_0xb54e('0xb')](),controller[_0xb54e('0xe')]);router[_0xb54e('0xf')](_0xb54e('0xa'),auth[_0xb54e('0xb')](),controller[_0xb54e('0x10')]);router[_0xb54e('0x11')](_0xb54e('0xa'),auth[_0xb54e('0xb')](),controller[_0xb54e('0x12')]);module[_0xb54e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 9c03933..2f49555 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 _0x7897=['STRING','BOOLEAN','sequelize','string','variable','customVariable'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0x7897,0xe0));var _0x7789=function(_0x379421,_0x20357d){_0x379421=_0x379421-0x0;var _0x2170c6=_0x7897[_0x379421];return _0x2170c6;};'use strict';var Sequelize=require(_0x7789('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x7789('0x1'),_0x7789('0x2'),_0x7789('0x3'),'keyValue','picklist'),'defaultValue':_0x7789('0x1')},'content':{'type':Sequelize[_0x7789('0x4')]},'key':{'type':Sequelize[_0x7789('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0x7789('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x7789('0x4')]},'idField':{'type':Sequelize[_0x7789('0x4')]},'nameField':{'type':Sequelize[_0x7789('0x4')]},'customField':{'type':Sequelize[_0x7789('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5218=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x5dc88d,_0xcd283e){var _0x5b595b=function(_0x1600bc){while(--_0x1600bc){_0x5dc88d['push'](_0x5dc88d['shift']());}};_0x5b595b(++_0xcd283e);}(_0x5218,0x191));var _0x8521=function(_0x5b79c6,_0x3495f3){_0x5b79c6=_0x5b79c6-0x0;var _0x3cb3bd=_0x5218[_0x5b79c6];return _0x3cb3bd;};'use strict';var Sequelize=require(_0x8521('0x0'));module[_0x8521('0x1')]={'type':{'type':Sequelize[_0x8521('0x2')](_0x8521('0x3'),_0x8521('0x4'),_0x8521('0x5'),_0x8521('0x6'),'picklist'),'defaultValue':_0x8521('0x3')},'content':{'type':Sequelize[_0x8521('0x7')]},'key':{'type':Sequelize[_0x8521('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x8521('0x3'),_0x8521('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x8521('0x7')]},'idField':{'type':Sequelize[_0x8521('0x7')]},'nameField':{'type':Sequelize[_0x8521('0x7')]},'customField':{'type':Sequelize[_0x8521('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 2dca64c..841138a 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 _0x9c4f=['key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','type'];(function(_0x42c44a,_0x2e0ce7){var _0x322517=function(_0x5b874c){while(--_0x5b874c){_0x42c44a['push'](_0x42c44a['shift']());}};_0x322517(++_0x2e0ce7);}(_0x9c4f,0x6d));var _0xf9c4=function(_0x5e6310,_0x136d16){_0x5e6310=_0x5e6310-0x0;var _0x4900f9=_0x9c4f[_0x5e6310];return _0x4900f9;};'use strict';var emlformat=require(_0xf9c4('0x0'));var rimraf=require(_0xf9c4('0x1'));var zipdir=require(_0xf9c4('0x2'));var jsonpatch=require(_0xf9c4('0x3'));var rp=require(_0xf9c4('0x4'));var moment=require(_0xf9c4('0x5'));var BPromise=require(_0xf9c4('0x6'));var Mustache=require(_0xf9c4('0x7'));var util=require(_0xf9c4('0x8'));var path=require('path');var sox=require(_0xf9c4('0x9'));var csv=require(_0xf9c4('0xa'));var ejs=require(_0xf9c4('0xb'));var fs=require('fs');var fs_extra=require(_0xf9c4('0xc'));var _=require(_0xf9c4('0xd'));var squel=require(_0xf9c4('0xe'));var crypto=require(_0xf9c4('0xf'));var jsforce=require(_0xf9c4('0x10'));var deskjs=require(_0xf9c4('0x11'));var toCsv=require(_0xf9c4('0xa'));var querystring=require(_0xf9c4('0x12'));var Papa=require('papaparse');var Redis=require(_0xf9c4('0x13'));var authService=require(_0xf9c4('0x14'));var qs=require(_0xf9c4('0x15'));var as=require(_0xf9c4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf9c4('0x17'))(_0xf9c4('0x18'));var utils=require('../../config/utils');var config=require(_0xf9c4('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9c4('0x1a'))['db'];function respondWithStatusCode(_0x2c2057,_0x33e28d){_0x33e28d=_0x33e28d||0xcc;return function(_0x4389c1){if(_0x4389c1){return _0x2c2057['sendStatus'](_0x33e28d);}return _0x2c2057[_0xf9c4('0x1b')](_0x33e28d)['end']();};}function respondWithResult(_0x55655d,_0x280475){_0x280475=_0x280475||0xc8;return function(_0x55c36c){if(_0x55c36c){return _0x55655d[_0xf9c4('0x1b')](_0x280475)[_0xf9c4('0x1c')](_0x55c36c);}};}function respondWithFilteredResult(_0x25b4e4,_0x24a0f5){return function(_0x2ffc3c){if(_0x2ffc3c){var _0x30a2ac=typeof _0x24a0f5[_0xf9c4('0x1d')]===_0xf9c4('0x1e')&&typeof _0x24a0f5[_0xf9c4('0x1f')]===_0xf9c4('0x1e');var _0x4b7cc4=_0x2ffc3c[_0xf9c4('0x20')];var _0x5b6265=_0x30a2ac?0x0:_0x24a0f5[_0xf9c4('0x1d')];var _0x5de035=_0x30a2ac?_0x2ffc3c[_0xf9c4('0x20')]:_0x24a0f5[_0xf9c4('0x1d')]+_0x24a0f5[_0xf9c4('0x1f')];var _0x5785b3;if(_0x5de035>=_0x4b7cc4){_0x5de035=_0x4b7cc4;_0x5785b3=0xc8;}else{_0x5785b3=0xce;}_0x25b4e4['status'](_0x5785b3);return _0x25b4e4[_0xf9c4('0x21')](_0xf9c4('0x22'),_0x5b6265+'-'+_0x5de035+'/'+_0x4b7cc4)[_0xf9c4('0x1c')](_0x2ffc3c);}return null;};}function patchUpdates(_0x17471c){return function(_0x45d8f0){try{jsonpatch[_0xf9c4('0x23')](_0x45d8f0,_0x17471c,!![]);}catch(_0x14f832){return BPromise[_0xf9c4('0x24')](_0x14f832);}return _0x45d8f0[_0xf9c4('0x25')]();};}function saveUpdates(_0x2f5eba,_0x5ae88d){return function(_0x31dd37){if(_0x31dd37){return _0x31dd37[_0xf9c4('0x26')](_0x2f5eba)[_0xf9c4('0x27')](function(_0xa77d28){return _0xa77d28;});}return null;};}function removeEntity(_0x5a7aef,_0x3c3be7){return function(_0x102248){if(_0x102248){return _0x102248[_0xf9c4('0x28')]()[_0xf9c4('0x27')](function(){_0x5a7aef[_0xf9c4('0x1b')](0xcc)[_0xf9c4('0x29')]();});}};}function handleEntityNotFound(_0x1887a0,_0x1591b4){return function(_0x16a5f5){if(!_0x16a5f5){_0x1887a0['sendStatus'](0x194);}return _0x16a5f5;};}function handleError(_0x28fd2f,_0x194776){_0x194776=_0x194776||0x1f4;return function(_0x3f2180){logger[_0xf9c4('0x2a')](_0x3f2180[_0xf9c4('0x2b')]);if(_0x3f2180[_0xf9c4('0x2c')]){delete _0x3f2180['name'];}_0x28fd2f[_0xf9c4('0x1b')](_0x194776)[_0xf9c4('0x2d')](_0x3f2180);};}exports[_0xf9c4('0x2e')]=function(_0x37d2d3,_0x17b96a){var _0x19a7d9={},_0x6bb745={},_0x260572={'count':0x0,'rows':[]};var _0x42667b=_['map'](db[_0xf9c4('0x2f')][_0xf9c4('0x30')],function(_0x2948e3){return{'name':_0x2948e3[_0xf9c4('0x31')],'type':_0x2948e3[_0xf9c4('0x32')][_0xf9c4('0x33')]};});_0x6bb745[_0xf9c4('0x34')]=_[_0xf9c4('0x35')](_0x42667b,_0xf9c4('0x2c'));_0x6bb745[_0xf9c4('0x36')]=_['keys'](_0x37d2d3[_0xf9c4('0x36')]);_0x6bb745['filters']=_['intersection'](_0x6bb745[_0xf9c4('0x34')],_0x6bb745['query']);_0x19a7d9[_0xf9c4('0x37')]=_[_0xf9c4('0x38')](_0x6bb745['model'],qs[_0xf9c4('0x39')](_0x37d2d3[_0xf9c4('0x36')][_0xf9c4('0x39')]));_0x19a7d9['attributes']=_0x19a7d9[_0xf9c4('0x37')][_0xf9c4('0x3a')]?_0x19a7d9[_0xf9c4('0x37')]:_0x6bb745[_0xf9c4('0x34')];if(!_0x37d2d3['query'][_0xf9c4('0x3b')](_0xf9c4('0x3c'))){_0x19a7d9[_0xf9c4('0x1f')]=qs[_0xf9c4('0x1f')](_0x37d2d3[_0xf9c4('0x36')][_0xf9c4('0x1f')]);_0x19a7d9[_0xf9c4('0x1d')]=qs[_0xf9c4('0x1d')](_0x37d2d3[_0xf9c4('0x36')]['offset']);}_0x19a7d9[_0xf9c4('0x3d')]=qs[_0xf9c4('0x3e')](_0x37d2d3[_0xf9c4('0x36')][_0xf9c4('0x3e')]);_0x19a7d9[_0xf9c4('0x3f')]=qs[_0xf9c4('0x40')](_['pick'](_0x37d2d3['query'],_0x6bb745[_0xf9c4('0x40')]),_0x42667b);if(_0x37d2d3[_0xf9c4('0x36')]['filter']){_0x19a7d9[_0xf9c4('0x3f')]=_[_0xf9c4('0x41')](_0x19a7d9[_0xf9c4('0x3f')],{'$or':_[_0xf9c4('0x35')](_0x42667b,function(_0x6cf215){if(_0x6cf215[_0xf9c4('0x32')]!==_0xf9c4('0x42')){var _0x759fd2={};_0x759fd2[_0x6cf215[_0xf9c4('0x2c')]]={'$like':'%'+_0x37d2d3[_0xf9c4('0x36')][_0xf9c4('0x43')]+'%'};return _0x759fd2;}})});}_0x19a7d9=_[_0xf9c4('0x41')]({},_0x19a7d9,_0x37d2d3[_0xf9c4('0x44')]);var _0x455935={'where':_0x19a7d9[_0xf9c4('0x3f')]};return db[_0xf9c4('0x2f')][_0xf9c4('0x20')](_0x455935)[_0xf9c4('0x27')](function(_0x335773){_0x260572[_0xf9c4('0x20')]=_0x335773;if(_0x37d2d3['query'][_0xf9c4('0x45')]){_0x19a7d9[_0xf9c4('0x46')]=[{'all':!![]}];}return db['SugarcrmField'][_0xf9c4('0x47')](_0x19a7d9);})[_0xf9c4('0x27')](function(_0xbf88d5){_0x260572[_0xf9c4('0x48')]=_0xbf88d5;return _0x260572;})[_0xf9c4('0x27')](respondWithFilteredResult(_0x17b96a,_0x19a7d9))[_0xf9c4('0x49')](handleError(_0x17b96a,null));};exports[_0xf9c4('0x4a')]=function(_0x22c3a1,_0x1c1970){var _0x114d4b={'raw':!![],'where':{'id':_0x22c3a1[_0xf9c4('0x4b')]['id']}},_0x1ac99a={};_0x1ac99a[_0xf9c4('0x34')]=_[_0xf9c4('0x4c')](db[_0xf9c4('0x2f')]['rawAttributes']);_0x1ac99a[_0xf9c4('0x36')]=_[_0xf9c4('0x4c')](_0x22c3a1['query']);_0x1ac99a[_0xf9c4('0x40')]=_['intersection'](_0x1ac99a['model'],_0x1ac99a[_0xf9c4('0x36')]);_0x114d4b[_0xf9c4('0x37')]=_[_0xf9c4('0x38')](_0x1ac99a[_0xf9c4('0x34')],qs[_0xf9c4('0x39')](_0x22c3a1['query'][_0xf9c4('0x39')]));_0x114d4b[_0xf9c4('0x37')]=_0x114d4b[_0xf9c4('0x37')]['length']?_0x114d4b[_0xf9c4('0x37')]:_0x1ac99a[_0xf9c4('0x34')];if(_0x22c3a1[_0xf9c4('0x36')]['includeAll']){_0x114d4b[_0xf9c4('0x46')]=[{'all':!![]}];}_0x114d4b=_[_0xf9c4('0x41')]({},_0x114d4b,_0x22c3a1[_0xf9c4('0x44')]);return db['SugarcrmField'][_0xf9c4('0x4d')](_0x114d4b)[_0xf9c4('0x27')](handleEntityNotFound(_0x1c1970,null))[_0xf9c4('0x27')](respondWithResult(_0x1c1970,null))[_0xf9c4('0x49')](handleError(_0x1c1970,null));};exports[_0xf9c4('0x4e')]=function(_0x3fd057,_0x3c8993){return db[_0xf9c4('0x2f')][_0xf9c4('0x4e')](_0x3fd057[_0xf9c4('0x4f')],{})[_0xf9c4('0x27')](respondWithResult(_0x3c8993,0xc9))[_0xf9c4('0x49')](handleError(_0x3c8993,null));};exports[_0xf9c4('0x26')]=function(_0x525926,_0xce4bbd){if(_0x525926[_0xf9c4('0x4f')]['id']){delete _0x525926['body']['id'];}return db[_0xf9c4('0x2f')]['find']({'where':{'id':_0x525926[_0xf9c4('0x4b')]['id']}})[_0xf9c4('0x27')](handleEntityNotFound(_0xce4bbd,null))[_0xf9c4('0x27')](saveUpdates(_0x525926[_0xf9c4('0x4f')],null))[_0xf9c4('0x27')](respondWithResult(_0xce4bbd,null))['catch'](handleError(_0xce4bbd,null));};exports[_0xf9c4('0x28')]=function(_0x39c848,_0x754cae){return db[_0xf9c4('0x2f')][_0xf9c4('0x4d')]({'where':{'id':_0x39c848[_0xf9c4('0x4b')]['id']}})[_0xf9c4('0x27')](handleEntityNotFound(_0x754cae,null))['then'](removeEntity(_0x754cae,null))[_0xf9c4('0x49')](handleError(_0x754cae,null));}; \ No newline at end of file +var _0xa752=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','SugarcrmField','fieldName','key','model','query','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','attributes','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x2ec01a,_0x5698c5){var _0x3244df=function(_0x3dbd11){while(--_0x3dbd11){_0x2ec01a['push'](_0x2ec01a['shift']());}};_0x3244df(++_0x5698c5);}(_0xa752,0xcb));var _0x2a75=function(_0x1efb75,_0x57a1f0){_0x1efb75=_0x1efb75-0x0;var _0x84e7dd=_0xa752[_0x1efb75];return _0x84e7dd;};'use strict';var emlformat=require(_0x2a75('0x0'));var rimraf=require(_0x2a75('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a75('0x2'));var rp=require(_0x2a75('0x3'));var moment=require(_0x2a75('0x4'));var BPromise=require(_0x2a75('0x5'));var Mustache=require(_0x2a75('0x6'));var util=require(_0x2a75('0x7'));var path=require(_0x2a75('0x8'));var sox=require(_0x2a75('0x9'));var csv=require(_0x2a75('0xa'));var ejs=require(_0x2a75('0xb'));var fs=require('fs');var fs_extra=require(_0x2a75('0xc'));var _=require('lodash');var squel=require(_0x2a75('0xd'));var crypto=require(_0x2a75('0xe'));var jsforce=require(_0x2a75('0xf'));var deskjs=require(_0x2a75('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2a75('0x11'));var Redis=require(_0x2a75('0x12'));var authService=require(_0x2a75('0x13'));var qs=require(_0x2a75('0x14'));var as=require(_0x2a75('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2a75('0x16'));var utils=require(_0x2a75('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34911e,_0x366685){_0x366685=_0x366685||0xcc;return function(_0x2ad0a3){if(_0x2ad0a3){return _0x34911e[_0x2a75('0x18')](_0x366685);}return _0x34911e[_0x2a75('0x19')](_0x366685)[_0x2a75('0x1a')]();};}function respondWithResult(_0x435566,_0x4f4763){_0x4f4763=_0x4f4763||0xc8;return function(_0x343f6b){if(_0x343f6b){return _0x435566['status'](_0x4f4763)[_0x2a75('0x1b')](_0x343f6b);}};}function respondWithFilteredResult(_0x15c528,_0x584859){return function(_0x30fd5a){if(_0x30fd5a){var _0x49eb83=typeof _0x584859[_0x2a75('0x1c')]===_0x2a75('0x1d')&&typeof _0x584859[_0x2a75('0x1e')]===_0x2a75('0x1d');var _0x435a79=_0x30fd5a[_0x2a75('0x1f')];var _0x49515b=_0x49eb83?0x0:_0x584859['offset'];var _0x3ab1d8=_0x49eb83?_0x30fd5a[_0x2a75('0x1f')]:_0x584859['offset']+_0x584859['limit'];var _0xa656e4;if(_0x3ab1d8>=_0x435a79){_0x3ab1d8=_0x435a79;_0xa656e4=0xc8;}else{_0xa656e4=0xce;}_0x15c528['status'](_0xa656e4);return _0x15c528['set'](_0x2a75('0x20'),_0x49515b+'-'+_0x3ab1d8+'/'+_0x435a79)[_0x2a75('0x1b')](_0x30fd5a);}return null;};}function patchUpdates(_0x24e0fe){return function(_0x1b75cc){try{jsonpatch[_0x2a75('0x21')](_0x1b75cc,_0x24e0fe,!![]);}catch(_0x5e46e8){return BPromise[_0x2a75('0x22')](_0x5e46e8);}return _0x1b75cc['save']();};}function saveUpdates(_0x11fe32,_0x2691cb){return function(_0x1f1f5f){if(_0x1f1f5f){return _0x1f1f5f[_0x2a75('0x23')](_0x11fe32)[_0x2a75('0x24')](function(_0x219816){return _0x219816;});}return null;};}function removeEntity(_0x5e255c,_0x517dc8){return function(_0x3b7d2f){if(_0x3b7d2f){return _0x3b7d2f[_0x2a75('0x25')]()['then'](function(){_0x5e255c['status'](0xcc)[_0x2a75('0x1a')]();});}};}function handleEntityNotFound(_0x50de47,_0x15f914){return function(_0x1444ae){if(!_0x1444ae){_0x50de47[_0x2a75('0x18')](0x194);}return _0x1444ae;};}function handleError(_0x59754e,_0x15056b){_0x15056b=_0x15056b||0x1f4;return function(_0x4def94){logger[_0x2a75('0x26')](_0x4def94[_0x2a75('0x27')]);if(_0x4def94['name']){delete _0x4def94[_0x2a75('0x28')];}_0x59754e[_0x2a75('0x19')](_0x15056b)[_0x2a75('0x29')](_0x4def94);};}exports['index']=function(_0x3e2f73,_0x4311c8){var _0x2ba4ff={},_0x111011={},_0x4e575c={'count':0x0,'rows':[]};var _0x3db509=_[_0x2a75('0x2a')](db[_0x2a75('0x2b')]['rawAttributes'],function(_0xf2742a){return{'name':_0xf2742a[_0x2a75('0x2c')],'type':_0xf2742a['type'][_0x2a75('0x2d')]};});_0x111011[_0x2a75('0x2e')]=_[_0x2a75('0x2a')](_0x3db509,_0x2a75('0x28'));_0x111011[_0x2a75('0x2f')]=_['keys'](_0x3e2f73[_0x2a75('0x2f')]);_0x111011['filters']=_[_0x2a75('0x30')](_0x111011[_0x2a75('0x2e')],_0x111011[_0x2a75('0x2f')]);_0x2ba4ff['attributes']=_[_0x2a75('0x30')](_0x111011[_0x2a75('0x2e')],qs[_0x2a75('0x31')](_0x3e2f73['query'][_0x2a75('0x31')]));_0x2ba4ff['attributes']=_0x2ba4ff['attributes'][_0x2a75('0x32')]?_0x2ba4ff['attributes']:_0x111011[_0x2a75('0x2e')];if(!_0x3e2f73['query'][_0x2a75('0x33')](_0x2a75('0x34'))){_0x2ba4ff[_0x2a75('0x1e')]=qs[_0x2a75('0x1e')](_0x3e2f73[_0x2a75('0x2f')]['limit']);_0x2ba4ff[_0x2a75('0x1c')]=qs['offset'](_0x3e2f73['query'][_0x2a75('0x1c')]);}_0x2ba4ff[_0x2a75('0x35')]=qs[_0x2a75('0x36')](_0x3e2f73['query'][_0x2a75('0x36')]);_0x2ba4ff[_0x2a75('0x37')]=qs['filters'](_[_0x2a75('0x38')](_0x3e2f73['query'],_0x111011[_0x2a75('0x39')]),_0x3db509);if(_0x3e2f73[_0x2a75('0x2f')][_0x2a75('0x3a')]){_0x2ba4ff[_0x2a75('0x37')]=_[_0x2a75('0x3b')](_0x2ba4ff[_0x2a75('0x37')],{'$or':_[_0x2a75('0x2a')](_0x3db509,function(_0x4159cf){if(_0x4159cf[_0x2a75('0x3c')]!==_0x2a75('0x3d')){var _0x3323a7={};_0x3323a7[_0x4159cf['name']]={'$like':'%'+_0x3e2f73[_0x2a75('0x2f')][_0x2a75('0x3a')]+'%'};return _0x3323a7;}})});}_0x2ba4ff=_[_0x2a75('0x3b')]({},_0x2ba4ff,_0x3e2f73['options']);var _0x6b3bf7={'where':_0x2ba4ff[_0x2a75('0x37')]};return db[_0x2a75('0x2b')]['count'](_0x6b3bf7)[_0x2a75('0x24')](function(_0xc3a2ee){_0x4e575c[_0x2a75('0x1f')]=_0xc3a2ee;if(_0x3e2f73['query'][_0x2a75('0x3e')]){_0x2ba4ff[_0x2a75('0x3f')]=[{'all':!![]}];}return db[_0x2a75('0x2b')][_0x2a75('0x40')](_0x2ba4ff);})[_0x2a75('0x24')](function(_0x51754e){_0x4e575c['rows']=_0x51754e;return _0x4e575c;})['then'](respondWithFilteredResult(_0x4311c8,_0x2ba4ff))[_0x2a75('0x41')](handleError(_0x4311c8,null));};exports[_0x2a75('0x42')]=function(_0x4e1030,_0x1bd10a){var _0x505f76={'raw':!![],'where':{'id':_0x4e1030[_0x2a75('0x43')]['id']}},_0x4fa2ea={};_0x4fa2ea['model']=_[_0x2a75('0x44')](db['SugarcrmField']['rawAttributes']);_0x4fa2ea[_0x2a75('0x2f')]=_[_0x2a75('0x44')](_0x4e1030['query']);_0x4fa2ea[_0x2a75('0x39')]=_[_0x2a75('0x30')](_0x4fa2ea['model'],_0x4fa2ea[_0x2a75('0x2f')]);_0x505f76[_0x2a75('0x45')]=_[_0x2a75('0x30')](_0x4fa2ea[_0x2a75('0x2e')],qs['fields'](_0x4e1030[_0x2a75('0x2f')][_0x2a75('0x31')]));_0x505f76['attributes']=_0x505f76['attributes']['length']?_0x505f76[_0x2a75('0x45')]:_0x4fa2ea['model'];if(_0x4e1030[_0x2a75('0x2f')]['includeAll']){_0x505f76[_0x2a75('0x3f')]=[{'all':!![]}];}_0x505f76=_[_0x2a75('0x3b')]({},_0x505f76,_0x4e1030[_0x2a75('0x46')]);return db[_0x2a75('0x2b')][_0x2a75('0x47')](_0x505f76)[_0x2a75('0x24')](handleEntityNotFound(_0x1bd10a,null))[_0x2a75('0x24')](respondWithResult(_0x1bd10a,null))[_0x2a75('0x41')](handleError(_0x1bd10a,null));};exports['create']=function(_0x1135ed,_0x1bffce){return db[_0x2a75('0x2b')][_0x2a75('0x48')](_0x1135ed[_0x2a75('0x49')],{})[_0x2a75('0x24')](respondWithResult(_0x1bffce,0xc9))[_0x2a75('0x41')](handleError(_0x1bffce,null));};exports[_0x2a75('0x23')]=function(_0x3b7684,_0x41dc71){if(_0x3b7684[_0x2a75('0x49')]['id']){delete _0x3b7684[_0x2a75('0x49')]['id'];}return db['SugarcrmField'][_0x2a75('0x47')]({'where':{'id':_0x3b7684['params']['id']}})[_0x2a75('0x24')](handleEntityNotFound(_0x41dc71,null))[_0x2a75('0x24')](saveUpdates(_0x3b7684['body'],null))['then'](respondWithResult(_0x41dc71,null))[_0x2a75('0x41')](handleError(_0x41dc71,null));};exports[_0x2a75('0x25')]=function(_0x1bace3,_0x52e1ca){return db[_0x2a75('0x2b')][_0x2a75('0x47')]({'where':{'id':_0x1bace3['params']['id']}})[_0x2a75('0x24')](handleEntityNotFound(_0x52e1ca,null))['then'](removeEntity(_0x52e1ca,null))[_0x2a75('0x41')](handleError(_0x52e1ca,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 4d4b19b..b363ba5 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 _0x0329=['FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x517409,_0x1d95fd){var _0x433839=function(_0x41799f){while(--_0x41799f){_0x517409['push'](_0x517409['shift']());}};_0x433839(++_0x1d95fd);}(_0x0329,0x119));var _0x9032=function(_0x12e6e5,_0x39855b){_0x12e6e5=_0x12e6e5-0x0;var _0x4ef6ce=_0x0329[_0x12e6e5];return _0x4ef6ce;};'use strict';var _=require(_0x9032('0x0'));var util=require('util');var logger=require(_0x9032('0x1'))(_0x9032('0x2'));var moment=require(_0x9032('0x3'));var BPromise=require(_0x9032('0x4'));var rp=require(_0x9032('0x5'));var fs=require('fs');var path=require(_0x9032('0x6'));var rimraf=require('rimraf');var config=require(_0x9032('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x9032('0x8')]=function(_0x1e4f55,_0x23fc0e){return _0x1e4f55['define'](_0x9032('0x9'),attributes,{'tableName':_0x9032('0xa'),'paranoid':![],'indexes':[{'name':_0x9032('0xb'),'fields':[_0x9032('0xc'),_0x9032('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c9c=['request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c9c,0x174));var _0xc2c9=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x2c9c[_0x31295c];return _0x2c150e;};'use strict';var _=require(_0xc2c9('0x0'));var util=require(_0xc2c9('0x1'));var logger=require('../../config/logger')(_0xc2c9('0x2'));var moment=require(_0xc2c9('0x3'));var BPromise=require(_0xc2c9('0x4'));var rp=require(_0xc2c9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc2c9('0x6'));var config=require(_0xc2c9('0x7'));var attributes=require(_0xc2c9('0x8'));module[_0xc2c9('0x9')]=function(_0x24674e,_0x3089b4){return _0x24674e['define']('SugarcrmField',attributes,{'tableName':_0xc2c9('0xa'),'paranoid':![],'indexes':[{'name':_0xc2c9('0xb'),'fields':['idField',_0xc2c9('0xc')],'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 ee4b3cb..b7579c2 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 _0x31b1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x523899,_0x100efd){var _0x4788f6=function(_0x1b26f4){while(--_0x1b26f4){_0x523899['push'](_0x523899['shift']());}};_0x4788f6(++_0x100efd);}(_0x31b1,0x1c9));var _0x131b=function(_0x3b84a2,_0x4af976){_0x3b84a2=_0x3b84a2-0x0;var _0x26d753=_0x31b1[_0x3b84a2];return _0x26d753;};'use strict';var _=require('lodash');var util=require(_0x131b('0x0'));var moment=require(_0x131b('0x1'));var BPromise=require(_0x131b('0x2'));var rs=require(_0x131b('0x3'));var fs=require('fs');var Redis=require(_0x131b('0x4'));var db=require(_0x131b('0x5'))['db'];var utils=require(_0x131b('0x6'));var logger=require(_0x131b('0x7'))(_0x131b('0x8'));var config=require(_0x131b('0x9'));var jayson=require(_0x131b('0xa'));var client=jayson[_0x131b('0xb')][_0x131b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b0b6b,_0x1d73cb,_0x4a82bf){return new BPromise(function(_0x19fbaf,_0x326d45){return client[_0x131b('0xd')](_0x1b0b6b,_0x4a82bf)['then'](function(_0x4b023b){logger[_0x131b('0xe')](_0x131b('0xf'),_0x1d73cb,_0x131b('0x10'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x1d73cb,_0x131b('0x10'),JSON['stringify'](_0x4b023b));if(_0x4b023b[_0x131b('0x11')]){if(_0x4b023b[_0x131b('0x11')][_0x131b('0x12')]===0x1f4){logger[_0x131b('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x1d73cb,_0x4b023b[_0x131b('0x11')][_0x131b('0x13')]);return _0x326d45(_0x4b023b['error']['message']);}logger[_0x131b('0x11')](_0x131b('0xf'),_0x1d73cb,_0x4b023b[_0x131b('0x11')]['message']);return _0x19fbaf(_0x4b023b[_0x131b('0x11')][_0x131b('0x13')]);}else{logger[_0x131b('0xe')](_0x131b('0xf'),_0x1d73cb,_0x131b('0x10'));_0x19fbaf(_0x4b023b[_0x131b('0x14')]['message']);}})[_0x131b('0x15')](function(_0x1ef635){logger['error'](_0x131b('0xf'),_0x1d73cb,_0x1ef635);_0x326d45(_0x1ef635);});});} \ No newline at end of file +var _0xb5e6=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','SugarcrmField,\x20%s,\x20%s','message','info','result','lodash','util','bluebird'];(function(_0x3f899a,_0x25760d){var _0x36eacd=function(_0x3528e1){while(--_0x3528e1){_0x3f899a['push'](_0x3f899a['shift']());}};_0x36eacd(++_0x25760d);}(_0xb5e6,0x10e));var _0x6b5e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb5e6[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x6b5e('0x0'));var util=require(_0x6b5e('0x1'));var moment=require('moment');var BPromise=require(_0x6b5e('0x2'));var rs=require(_0x6b5e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b5e('0x4'))['db'];var utils=require(_0x6b5e('0x5'));var logger=require(_0x6b5e('0x6'))('rpc');var config=require(_0x6b5e('0x7'));var jayson=require(_0x6b5e('0x8'));var client=jayson[_0x6b5e('0x9')][_0x6b5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x552983,_0x5e0fa0,_0x4b4f8d){return new BPromise(function(_0x1d392c,_0xa07579){return client[_0x6b5e('0xb')](_0x552983,_0x4b4f8d)[_0x6b5e('0xc')](function(_0x2b4f2e){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x5e0fa0,_0x6b5e('0xd'));logger[_0x6b5e('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x5e0fa0,_0x6b5e('0xd'),JSON[_0x6b5e('0xf')](_0x2b4f2e));if(_0x2b4f2e[_0x6b5e('0x10')]){if(_0x2b4f2e[_0x6b5e('0x10')]['code']===0x1f4){logger[_0x6b5e('0x10')](_0x6b5e('0x11'),_0x5e0fa0,_0x2b4f2e[_0x6b5e('0x10')]['message']);return _0xa07579(_0x2b4f2e[_0x6b5e('0x10')][_0x6b5e('0x12')]);}logger[_0x6b5e('0x10')](_0x6b5e('0x11'),_0x5e0fa0,_0x2b4f2e['error'][_0x6b5e('0x12')]);return _0x1d392c(_0x2b4f2e[_0x6b5e('0x10')][_0x6b5e('0x12')]);}else{logger[_0x6b5e('0x13')](_0x6b5e('0x11'),_0x5e0fa0,_0x6b5e('0xd'));_0x1d392c(_0x2b4f2e[_0x6b5e('0x14')]['message']);}})['catch'](function(_0x5331ab){logger[_0x6b5e('0x10')](_0x6b5e('0x11'),_0x5e0fa0,_0x5331ab);_0xa07579(_0x5331ab);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 6323277..a2a3091 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 _0xcacd=['post','addConfiguration','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','create'];(function(_0x2c90f8,_0x4f998b){var _0x1e2bf2=function(_0x5f1dbf){while(--_0x5f1dbf){_0x2c90f8['push'](_0x2c90f8['shift']());}};_0x1e2bf2(++_0x4f998b);}(_0xcacd,0x1bf));var _0xdcac=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xcacd[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xdcac('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdcac('0x1'));var router=express[_0xdcac('0x2')]();var fs_extra=require(_0xdcac('0x3'));var auth=require(_0xdcac('0x4'));var interaction=require(_0xdcac('0x5'));var config=require('../../config/environment');var controller=require(_0xdcac('0x6'));router[_0xdcac('0x7')]('/',auth[_0xdcac('0x8')](),controller['index']);router[_0xdcac('0x7')](_0xdcac('0x9'),auth[_0xdcac('0x8')](),controller['show']);router[_0xdcac('0x7')](_0xdcac('0xa'),auth['isAuthenticated'](),controller[_0xdcac('0xb')]);router[_0xdcac('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xdcac('0x8')](),controller[_0xdcac('0xc')]);router[_0xdcac('0xd')](_0xdcac('0xa'),auth[_0xdcac('0x8')](),controller[_0xdcac('0xe')]);router[_0xdcac('0xf')](_0xdcac('0x9'),auth['isAuthenticated'](),controller[_0xdcac('0x10')]);router[_0xdcac('0x11')](_0xdcac('0x9'),auth['isAuthenticated'](),controller[_0xdcac('0x12')]);module[_0xdcac('0x13')]=router; \ No newline at end of file +var _0x634d=['./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x53c807,_0x4b25c8){var _0x588b2c=function(_0x33919b){while(--_0x33919b){_0x53c807['push'](_0x53c807['shift']());}};_0x588b2c(++_0x4b25c8);}(_0x634d,0x120));var _0xd634=function(_0x40da84,_0x5deaab){_0x40da84=_0x40da84-0x0;var _0x1b92b1=_0x634d[_0x40da84];return _0x1b92b1;};'use strict';var multer=require(_0xd634('0x0'));var util=require(_0xd634('0x1'));var path=require(_0xd634('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd634('0x3'));var auth=require(_0xd634('0x4'));var interaction=require(_0xd634('0x5'));var config=require('../../config/environment');var controller=require(_0xd634('0x6'));router[_0xd634('0x7')]('/',auth['isAuthenticated'](),controller[_0xd634('0x8')]);router[_0xd634('0x7')](_0xd634('0x9'),auth[_0xd634('0xa')](),controller[_0xd634('0xb')]);router[_0xd634('0x7')]('/:id/configurations',auth[_0xd634('0xa')](),controller[_0xd634('0xc')]);router['get'](_0xd634('0xd'),auth[_0xd634('0xa')](),controller['getFields']);router[_0xd634('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xd634('0xf'),auth[_0xd634('0xa')](),controller[_0xd634('0x10')]);router['put']('/:id',auth[_0xd634('0xa')](),controller[_0xd634('0x11')]);router[_0xd634('0x12')]('/:id',auth[_0xd634('0xa')](),controller[_0xd634('0x13')]);module[_0xd634('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index baa937c..35e5945 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 _0xbef2=['exports','STRING'];(function(_0x496d8f,_0x3d877d){var _0x1dd7a5=function(_0x8bdc2e){while(--_0x8bdc2e){_0x496d8f['push'](_0x496d8f['shift']());}};_0x1dd7a5(++_0x3d877d);}(_0xbef2,0xd6));var _0x2bef=function(_0x49215b,_0x246058){_0x49215b=_0x49215b-0x0;var _0x1cb78e=_0xbef2[_0x49215b];return _0x1cb78e;};'use strict';var Sequelize=require('sequelize');module[_0x2bef('0x0')]={'name':{'type':Sequelize[_0x2bef('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2bef('0x1')]},'username':{'type':Sequelize[_0x2bef('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2bef('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x2bef('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2bef('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2bef('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3619=['sequelize','exports','STRING','HelpDesk'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x3619,0xec));var _0x9361=function(_0x2fe8ed,_0x20d673){_0x2fe8ed=_0x2fe8ed-0x0;var _0x306061=_0x3619[_0x2fe8ed];return _0x306061;};'use strict';var Sequelize=require(_0x9361('0x0'));module[_0x9361('0x1')]={'name':{'type':Sequelize[_0x9361('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9361('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9361('0x2')],'allowNull':![],'defaultValue':_0x9361('0x3')},'remoteUri':{'type':Sequelize[_0x9361('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9361('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 96178ef..d959c74 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 _0x922b=['include','findAll','rows','show','params','fields','find','create','body','catch','update','findOne','rawAttributes','length','getConfigurations','nolimit','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','getFields','description','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','username','success','POST','login','token','describe','sessionName','autogenerated','result','includes','remove','editable','label','startsWith','picklist','picklistValues','log','vTiger\x20error:\x20','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','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','count','offset','json','apply','reject','save','then','error','name','send','index','VtigerAccount','fieldName','type','key','model','map','query','keys','intersection','attributes','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x922b,0x12a));var _0xb922=function(_0x7f605b,_0x24ba07){_0x7f605b=_0x7f605b-0x0;var _0xe2b053=_0x922b[_0x7f605b];return _0xe2b053;};'use strict';var emlformat=require(_0xb922('0x0'));var rimraf=require(_0xb922('0x1'));var zipdir=require(_0xb922('0x2'));var jsonpatch=require(_0xb922('0x3'));var rp=require(_0xb922('0x4'));var moment=require(_0xb922('0x5'));var BPromise=require(_0xb922('0x6'));var Mustache=require(_0xb922('0x7'));var util=require(_0xb922('0x8'));var path=require(_0xb922('0x9'));var sox=require('sox');var csv=require(_0xb922('0xa'));var ejs=require(_0xb922('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb922('0xc'));var squel=require(_0xb922('0xd'));var crypto=require(_0xb922('0xe'));var jsforce=require(_0xb922('0xf'));var deskjs=require(_0xb922('0x10'));var toCsv=require(_0xb922('0xa'));var querystring=require(_0xb922('0x11'));var Papa=require(_0xb922('0x12'));var Redis=require(_0xb922('0x13'));var authService=require(_0xb922('0x14'));var qs=require(_0xb922('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb922('0x16'));var logger=require(_0xb922('0x17'))(_0xb922('0x18'));var utils=require(_0xb922('0x19'));var config=require(_0xb922('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xb922('0x1b'))['db'];var integrations=require(_0xb922('0x1c'));function respondWithStatusCode(_0x123ba2,_0x2a677b){_0x2a677b=_0x2a677b||0xcc;return function(_0x660dc1){if(_0x660dc1){return _0x123ba2[_0xb922('0x1d')](_0x2a677b);}return _0x123ba2[_0xb922('0x1e')](_0x2a677b)[_0xb922('0x1f')]();};}function respondWithResult(_0x74c537,_0x253d00){_0x253d00=_0x253d00||0xc8;return function(_0xebb8b4){if(_0xebb8b4){return _0x74c537[_0xb922('0x1e')](_0x253d00)['json'](_0xebb8b4);}};}function respondWithFilteredResult(_0x57275d,_0x21d2c2){return function(_0xa9a590){if(_0xa9a590){var _0x270959=typeof _0x21d2c2['offset']===_0xb922('0x20')&&typeof _0x21d2c2['limit']===_0xb922('0x20');var _0x19c4ed=_0xa9a590[_0xb922('0x21')];var _0x5b7a85=_0x270959?0x0:_0x21d2c2[_0xb922('0x22')];var _0x1ee7f0=_0x270959?_0xa9a590[_0xb922('0x21')]:_0x21d2c2[_0xb922('0x22')]+_0x21d2c2['limit'];var _0xe2dfb4;if(_0x1ee7f0>=_0x19c4ed){_0x1ee7f0=_0x19c4ed;_0xe2dfb4=0xc8;}else{_0xe2dfb4=0xce;}_0x57275d[_0xb922('0x1e')](_0xe2dfb4);return _0x57275d['set']('Content-Range',_0x5b7a85+'-'+_0x1ee7f0+'/'+_0x19c4ed)[_0xb922('0x23')](_0xa9a590);}return null;};}function patchUpdates(_0x3b49b1){return function(_0x33b8e7){try{jsonpatch[_0xb922('0x24')](_0x33b8e7,_0x3b49b1,!![]);}catch(_0x2d2e39){return BPromise[_0xb922('0x25')](_0x2d2e39);}return _0x33b8e7[_0xb922('0x26')]();};}function saveUpdates(_0x49e126,_0x5c6a26){return function(_0x42d0b6){if(_0x42d0b6){return _0x42d0b6['update'](_0x49e126)[_0xb922('0x27')](function(_0x168a09){return _0x168a09;});}return null;};}function removeEntity(_0x200b2f,_0x3ee8e4){return function(_0x2014b8){if(_0x2014b8){return _0x2014b8['destroy']()[_0xb922('0x27')](function(){_0x200b2f[_0xb922('0x1e')](0xcc)[_0xb922('0x1f')]();});}};}function handleEntityNotFound(_0x14bcab,_0x3f7c4e){return function(_0x6b4ed1){if(!_0x6b4ed1){_0x14bcab[_0xb922('0x1d')](0x194);}return _0x6b4ed1;};}function handleError(_0x4dfe3b,_0x20be81){_0x20be81=_0x20be81||0x1f4;return function(_0x563d8c){logger[_0xb922('0x28')](_0x563d8c['stack']);if(_0x563d8c[_0xb922('0x29')]){delete _0x563d8c[_0xb922('0x29')];}_0x4dfe3b[_0xb922('0x1e')](_0x20be81)[_0xb922('0x2a')](_0x563d8c);};}exports[_0xb922('0x2b')]=function(_0x1cd7fa,_0x118ee8){var _0x4c5937={},_0x5c57ab={},_0x5b038f={'count':0x0,'rows':[]};var _0x559354=_['map'](db[_0xb922('0x2c')]['rawAttributes'],function(_0x23a2f5){return{'name':_0x23a2f5[_0xb922('0x2d')],'type':_0x23a2f5[_0xb922('0x2e')][_0xb922('0x2f')]};});_0x5c57ab[_0xb922('0x30')]=_[_0xb922('0x31')](_0x559354,_0xb922('0x29'));_0x5c57ab[_0xb922('0x32')]=_[_0xb922('0x33')](_0x1cd7fa[_0xb922('0x32')]);_0x5c57ab['filters']=_[_0xb922('0x34')](_0x5c57ab[_0xb922('0x30')],_0x5c57ab[_0xb922('0x32')]);_0x4c5937[_0xb922('0x35')]=_['intersection'](_0x5c57ab[_0xb922('0x30')],qs['fields'](_0x1cd7fa[_0xb922('0x32')]['fields']));_0x4c5937[_0xb922('0x35')]=_0x4c5937['attributes']['length']?_0x4c5937['attributes']:_0x5c57ab['model'];if(!_0x1cd7fa[_0xb922('0x32')][_0xb922('0x36')]('nolimit')){_0x4c5937[_0xb922('0x37')]=qs[_0xb922('0x37')](_0x1cd7fa['query'][_0xb922('0x37')]);_0x4c5937['offset']=qs[_0xb922('0x22')](_0x1cd7fa[_0xb922('0x32')][_0xb922('0x22')]);}_0x4c5937[_0xb922('0x38')]=qs[_0xb922('0x39')](_0x1cd7fa[_0xb922('0x32')][_0xb922('0x39')]);_0x4c5937[_0xb922('0x3a')]=qs[_0xb922('0x3b')](_[_0xb922('0x3c')](_0x1cd7fa[_0xb922('0x32')],_0x5c57ab[_0xb922('0x3b')]),_0x559354);if(_0x1cd7fa[_0xb922('0x32')][_0xb922('0x3d')]){_0x4c5937[_0xb922('0x3a')]=_[_0xb922('0x3e')](_0x4c5937[_0xb922('0x3a')],{'$or':_[_0xb922('0x31')](_0x559354,function(_0x5a6228){if(_0x5a6228['type']!=='VIRTUAL'){var _0x161f81={};_0x161f81[_0x5a6228[_0xb922('0x29')]]={'$like':'%'+_0x1cd7fa[_0xb922('0x32')]['filter']+'%'};return _0x161f81;}})});}_0x4c5937=_[_0xb922('0x3e')]({},_0x4c5937,_0x1cd7fa[_0xb922('0x3f')]);var _0x1d2908={'where':_0x4c5937['where']};return db['VtigerAccount']['count'](_0x1d2908)['then'](function(_0x261f8a){_0x5b038f[_0xb922('0x21')]=_0x261f8a;if(_0x1cd7fa[_0xb922('0x32')][_0xb922('0x40')]){_0x4c5937[_0xb922('0x41')]=[{'all':!![]}];}return db['VtigerAccount'][_0xb922('0x42')](_0x4c5937);})[_0xb922('0x27')](function(_0x40d75f){_0x5b038f[_0xb922('0x43')]=_0x40d75f;return _0x5b038f;})[_0xb922('0x27')](respondWithFilteredResult(_0x118ee8,_0x4c5937))['catch'](handleError(_0x118ee8,null));};exports[_0xb922('0x44')]=function(_0x5977c3,_0x33e38f){var _0x2b1fca={'raw':![],'where':{'id':_0x5977c3[_0xb922('0x45')]['id']}},_0x284251={};_0x284251['model']=_[_0xb922('0x33')](db[_0xb922('0x2c')]['rawAttributes']);_0x284251[_0xb922('0x32')]=_[_0xb922('0x33')](_0x5977c3['query']);_0x284251[_0xb922('0x3b')]=_[_0xb922('0x34')](_0x284251[_0xb922('0x30')],_0x284251[_0xb922('0x32')]);_0x2b1fca[_0xb922('0x35')]=_[_0xb922('0x34')](_0x284251[_0xb922('0x30')],qs[_0xb922('0x46')](_0x5977c3[_0xb922('0x32')]['fields']));_0x2b1fca[_0xb922('0x35')]=_0x2b1fca['attributes']['length']?_0x2b1fca[_0xb922('0x35')]:_0x284251[_0xb922('0x30')];if(_0x5977c3[_0xb922('0x32')][_0xb922('0x40')]){_0x2b1fca[_0xb922('0x41')]=[{'all':!![]}];}_0x2b1fca=_[_0xb922('0x3e')]({},_0x2b1fca,_0x5977c3[_0xb922('0x3f')]);return db[_0xb922('0x2c')][_0xb922('0x47')](_0x2b1fca)['then'](handleEntityNotFound(_0x33e38f,null))[_0xb922('0x27')](respondWithResult(_0x33e38f,null))['catch'](handleError(_0x33e38f,null));};exports[_0xb922('0x48')]=function(_0x5512d5,_0x44a406){return db[_0xb922('0x2c')][_0xb922('0x48')](_0x5512d5[_0xb922('0x49')],{})[_0xb922('0x27')](respondWithResult(_0x44a406,0xc9))[_0xb922('0x4a')](handleError(_0x44a406,null));};exports[_0xb922('0x4b')]=function(_0x32d4eb,_0x20d009){if(_0x32d4eb[_0xb922('0x49')]['id']){delete _0x32d4eb[_0xb922('0x49')]['id'];}return db[_0xb922('0x2c')][_0xb922('0x47')]({'where':{'id':_0x32d4eb[_0xb922('0x45')]['id']}})[_0xb922('0x27')](handleEntityNotFound(_0x20d009,null))[_0xb922('0x27')](saveUpdates(_0x32d4eb['body'],null))[_0xb922('0x27')](respondWithResult(_0x20d009,null))['catch'](handleError(_0x20d009,null));};exports['destroy']=function(_0x2938cc,_0x1cce3c){return db[_0xb922('0x2c')][_0xb922('0x47')]({'where':{'id':_0x2938cc[_0xb922('0x45')]['id']}})[_0xb922('0x27')](handleEntityNotFound(_0x1cce3c,null))[_0xb922('0x27')](removeEntity(_0x1cce3c,null))[_0xb922('0x4a')](handleError(_0x1cce3c,null));};exports['getConfigurations']=function(_0x38bcff,_0x3b5828,_0x5331bf){var _0xefe5ff={};var _0x19d671={};var _0x5ac12a;var _0xbd6345;return db[_0xb922('0x2c')][_0xb922('0x4c')]({'where':{'id':_0x38bcff['params']['id']}})[_0xb922('0x27')](handleEntityNotFound(_0x3b5828,null))[_0xb922('0x27')](function(_0x30713e){if(_0x30713e){_0x5ac12a=_0x30713e;_0x19d671[_0xb922('0x30')]=_[_0xb922('0x33')](db['VtigerConfiguration'][_0xb922('0x4d')]);_0x19d671[_0xb922('0x32')]=_[_0xb922('0x33')](_0x38bcff[_0xb922('0x32')]);_0x19d671[_0xb922('0x3b')]=_[_0xb922('0x34')](_0x19d671['model'],_0x19d671[_0xb922('0x32')]);_0xefe5ff['attributes']=_[_0xb922('0x34')](_0x19d671[_0xb922('0x30')],qs['fields'](_0x38bcff['query']['fields']));_0xefe5ff[_0xb922('0x35')]=_0xefe5ff[_0xb922('0x35')][_0xb922('0x4e')]?_0xefe5ff['attributes']:_0x19d671[_0xb922('0x30')];_0xefe5ff[_0xb922('0x38')]=qs[_0xb922('0x39')](_0x38bcff['query'][_0xb922('0x39')]);_0xefe5ff[_0xb922('0x3a')]=qs[_0xb922('0x3b')](_[_0xb922('0x3c')](_0x38bcff['query'],_0x19d671[_0xb922('0x3b')]));if(_0x38bcff['query'][_0xb922('0x3d')]){_0xefe5ff['where']=_['merge'](_0xefe5ff['where'],{'$or':_[_0xb922('0x31')](_0xefe5ff[_0xb922('0x35')],function(_0x3f57f4){var _0x36ae5f={};_0x36ae5f[_0x3f57f4]={'$like':'%'+_0x38bcff['query'][_0xb922('0x3d')]+'%'};return _0x36ae5f;})});}_0xefe5ff=_[_0xb922('0x3e')]({},_0xefe5ff,_0x38bcff[_0xb922('0x3f')]);return _0x5ac12a[_0xb922('0x4f')](_0xefe5ff);}})[_0xb922('0x27')](function(_0x2aeb1b){if(_0x2aeb1b){_0xbd6345=_0x2aeb1b[_0xb922('0x4e')];if(!_0x38bcff['query'][_0xb922('0x36')](_0xb922('0x50'))){_0xefe5ff[_0xb922('0x37')]=qs[_0xb922('0x37')](_0x38bcff['query']['limit']);_0xefe5ff[_0xb922('0x22')]=qs[_0xb922('0x22')](_0x38bcff[_0xb922('0x32')][_0xb922('0x22')]);}return _0x5ac12a[_0xb922('0x4f')](_0xefe5ff);}})[_0xb922('0x27')](function(_0x535692){if(_0x535692){return _0x535692?{'count':_0xbd6345,'rows':_0x535692}:null;}})[_0xb922('0x27')](respondWithResult(_0x3b5828,null))['catch'](handleError(_0x3b5828,null));};exports['addConfiguration']=function(_0x80795f,_0x44f1d8,_0x2088cf){if(_0x80795f[_0xb922('0x49')]['id']){delete _0x80795f[_0xb922('0x49')]['id'];}return db[_0xb922('0x2c')]['findOne']({'where':{'id':_0x80795f[_0xb922('0x45')]['id']}})[_0xb922('0x27')](handleEntityNotFound(_0x44f1d8,null))[_0xb922('0x27')](function(_0x1467e0){if(_0x1467e0){_0x80795f[_0xb922('0x49')][_0xb922('0x51')]=_0x1467e0['id'];_0x80795f[_0xb922('0x49')][_0xb922('0x52')]=integrations['getSubjects'](_0x80795f['body'][_0xb922('0x53')],_0x80795f[_0xb922('0x49')][_0xb922('0x2e')]);_0x80795f[_0xb922('0x49')][_0xb922('0x54')]=integrations[_0xb922('0x55')](_0x80795f['body']['channel'],_0x80795f['body'][_0xb922('0x2e')]);return db[_0xb922('0x56')][_0xb922('0x48')](_0x80795f[_0xb922('0x49')],{'include':[{'model':db[_0xb922('0x57')],'as':_0xb922('0x52')},{'model':db['VtigerField'],'as':_0xb922('0x54')}]});}return null;})[_0xb922('0x27')](respondWithResult(_0x44f1d8,null))[_0xb922('0x4a')](handleError(_0x44f1d8,null));};var md5=require('md5');exports[_0xb922('0x58')]=function(_0x5a976b,_0x31fd3c,_0x3da5e0){var _0x83b799=null;var _0x2ef419=null;var _0x9c082b=null;var _0x423ab6=null;var _0x54199a='';return db[_0xb922('0x2c')][_0xb922('0x4c')]({'where':{'id':_0x5a976b[_0xb922('0x45')]['id']},'attributes':['id','name','username',_0xb922('0x59'),'moduleName',_0xb922('0x5a'),_0xb922('0x5b'),_0xb922('0x5c')]})[_0xb922('0x27')](handleEntityNotFound(_0x31fd3c,null))[_0xb922('0x27')](function(_0x4f6fde){if(_0x4f6fde){_0x83b799=_0x4f6fde['username'];_0x2ef419=_0x4f6fde[_0xb922('0x5c')];_0x9c082b=_0x4f6fde['moduleName'];_0x54199a=_0x4f6fde[_0xb922('0x5a')];var _0x2eaa94=_0x54199a['slice'](-0x1);if(_0x2eaa94==='/'){_0x54199a=_0x54199a[_0xb922('0x5d')](0x0,_0x54199a[_0xb922('0x5e')](_0x2eaa94));}_0x423ab6=util['format'](_0xb922('0x5f'),_0x54199a);var _0xd9b56d={'method':_0xb922('0x60'),'uri':_0x423ab6,'qs':{'operation':_0xb922('0x61'),'username':_0x4f6fde[_0xb922('0x62')]},'json':!![]};return rp(_0xd9b56d);}})['then'](function(_0x4946cd){if(_0x4946cd[_0xb922('0x63')]){var _0x1f6f1e={'method':_0xb922('0x64'),'uri':_0x423ab6,'form':{'operation':_0xb922('0x65'),'username':_0x83b799,'accessKey':md5(_0x4946cd['result'][_0xb922('0x66')]+_0x2ef419)},'json':!![]};return rp(_0x1f6f1e);}})[_0xb922('0x27')](function(_0x3d04b0){if(_0x3d04b0[_0xb922('0x63')]){var _0x3ab339={'method':_0xb922('0x60'),'uri':_0x423ab6,'qs':{'operation':_0xb922('0x67'),'username':_0x83b799,'sessionName':_0x3d04b0['result'][_0xb922('0x68')],'elementType':_0x9c082b},'json':!![]};return rp(_0x3ab339);}})[_0xb922('0x27')](function(_0x355b38){if(_0x355b38[_0xb922('0x63')]){var _0x53a10c=[_0xb922('0x69'),'reference','owner'];_['remove'](_0x355b38[_0xb922('0x6a')][_0xb922('0x46')],function(_0x5cbe01){return _0x53a10c[_0xb922('0x6b')](_0x5cbe01['type']['name']);});_[_0xb922('0x6c')](_0x355b38['result'][_0xb922('0x46')],function(_0x1ca89e){return _0x1ca89e[_0xb922('0x6d')]==='false';});return{'count':_0x355b38[_0xb922('0x6a')][_0xb922('0x46')][_0xb922('0x4e')],'rows':_['map'](_0x355b38[_0xb922('0x6a')][_0xb922('0x46')],function(_0x11dc8c){return{'id':_0x11dc8c[_0xb922('0x29')],'name':_0x11dc8c[_0xb922('0x6e')],'custom':_[_0xb922('0x6f')](_0x11dc8c[_0xb922('0x29')],'cf_')?!![]:![],'options':_0x11dc8c['type'][_0xb922('0x29')]===_0xb922('0x70')&&_0x11dc8c['type'][_0xb922('0x71')][_0xb922('0x4e')]>0x0?_[_0xb922('0x31')](_0x11dc8c['type']['picklistValues'],function(_0x3ab885){return{'name':_0x3ab885[_0xb922('0x6e')],'value':_0x3ab885['value']};}):[]};})};}})['then'](respondWithResult(_0x31fd3c,null))[_0xb922('0x4a')](function(_0x419c46){console[_0xb922('0x72')](_0xb922('0x73')+_0x419c46);var _0x11df36=_0x5a976b['query'][_0xb922('0x74')]?0x1f4:_0x419c46[_0xb922('0x75')]||0x1f4;logger['error'](_0xb922('0x76'),'getFields',_0x11df36,JSON[_0xb922('0x77')](_0x419c46));delete _0x419c46[_0xb922('0x29')];if(_0x11df36===0x191){_0x11df36=0x190;}_0x31fd3c['status'](_0x11df36)[_0xb922('0x2a')](_0x5a976b[_0xb922('0x32')][_0xb922('0x74')]?{'message':_0xb922('0x78'),'statusCode':_0x419c46[_0xb922('0x75')]}:_0x419c46);});}; \ No newline at end of file +var _0x2184=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','VtigerAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','VtigerField','description','moduleName','username','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','POST','login','result','token','GET','describe','sessionName','success','autogenerated','reference','owner','remove','false','startsWith','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto'];(function(_0x4bfdf5,_0x301c76){var _0x34860b=function(_0x9fba90){while(--_0x9fba90){_0x4bfdf5['push'](_0x4bfdf5['shift']());}};_0x34860b(++_0x301c76);}(_0x2184,0x6b));var _0x4218=function(_0x1468bb,_0x53db2c){_0x1468bb=_0x1468bb-0x0;var _0x1ca99d=_0x2184[_0x1468bb];return _0x1ca99d;};'use strict';var emlformat=require(_0x4218('0x0'));var rimraf=require(_0x4218('0x1'));var zipdir=require(_0x4218('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4218('0x3'));var moment=require(_0x4218('0x4'));var BPromise=require(_0x4218('0x5'));var Mustache=require(_0x4218('0x6'));var util=require(_0x4218('0x7'));var path=require(_0x4218('0x8'));var sox=require(_0x4218('0x9'));var csv=require('to-csv');var ejs=require(_0x4218('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4218('0xb'));var squel=require(_0x4218('0xc'));var crypto=require(_0x4218('0xd'));var jsforce=require(_0x4218('0xe'));var deskjs=require(_0x4218('0xf'));var toCsv=require(_0x4218('0x10'));var querystring=require(_0x4218('0x11'));var Papa=require(_0x4218('0x12'));var Redis=require(_0x4218('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4218('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4218('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4218('0x16'))['db'];var integrations=require(_0x4218('0x17'));function respondWithStatusCode(_0x4060ed,_0xcfd6b4){_0xcfd6b4=_0xcfd6b4||0xcc;return function(_0x902d34){if(_0x902d34){return _0x4060ed[_0x4218('0x18')](_0xcfd6b4);}return _0x4060ed['status'](_0xcfd6b4)[_0x4218('0x19')]();};}function respondWithResult(_0x3ab196,_0x260138){_0x260138=_0x260138||0xc8;return function(_0x3a283e){if(_0x3a283e){return _0x3ab196[_0x4218('0x1a')](_0x260138)[_0x4218('0x1b')](_0x3a283e);}};}function respondWithFilteredResult(_0xcd9b91,_0x44d0c5){return function(_0x4974a2){if(_0x4974a2){var _0x3d0ab1=typeof _0x44d0c5['offset']===_0x4218('0x1c')&&typeof _0x44d0c5[_0x4218('0x1d')]===_0x4218('0x1c');var _0x3c7840=_0x4974a2[_0x4218('0x1e')];var _0x29b9ac=_0x3d0ab1?0x0:_0x44d0c5[_0x4218('0x1f')];var _0x418930=_0x3d0ab1?_0x4974a2[_0x4218('0x1e')]:_0x44d0c5[_0x4218('0x1f')]+_0x44d0c5['limit'];var _0xcb540c;if(_0x418930>=_0x3c7840){_0x418930=_0x3c7840;_0xcb540c=0xc8;}else{_0xcb540c=0xce;}_0xcd9b91[_0x4218('0x1a')](_0xcb540c);return _0xcd9b91[_0x4218('0x20')](_0x4218('0x21'),_0x29b9ac+'-'+_0x418930+'/'+_0x3c7840)[_0x4218('0x1b')](_0x4974a2);}return null;};}function patchUpdates(_0xcfad82){return function(_0x7efa15){try{jsonpatch[_0x4218('0x22')](_0x7efa15,_0xcfad82,!![]);}catch(_0x5dc33a){return BPromise[_0x4218('0x23')](_0x5dc33a);}return _0x7efa15['save']();};}function saveUpdates(_0x350799,_0x43d339){return function(_0x4cb4f4){if(_0x4cb4f4){return _0x4cb4f4[_0x4218('0x24')](_0x350799)[_0x4218('0x25')](function(_0x8f8fc7){return _0x8f8fc7;});}return null;};}function removeEntity(_0x37286d,_0x4e8abc){return function(_0x55b781){if(_0x55b781){return _0x55b781[_0x4218('0x26')]()[_0x4218('0x25')](function(){_0x37286d[_0x4218('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x78ca7a,_0x5f0451){return function(_0x36681f){if(!_0x36681f){_0x78ca7a[_0x4218('0x18')](0x194);}return _0x36681f;};}function handleError(_0x16df95,_0x397890){_0x397890=_0x397890||0x1f4;return function(_0x22ac51){logger[_0x4218('0x27')](_0x22ac51['stack']);if(_0x22ac51[_0x4218('0x28')]){delete _0x22ac51['name'];}_0x16df95[_0x4218('0x1a')](_0x397890)[_0x4218('0x29')](_0x22ac51);};}exports[_0x4218('0x2a')]=function(_0x4b23bf,_0x1ed11b){var _0x5c3dae={},_0xbe9c96={},_0x45da3b={'count':0x0,'rows':[]};var _0x3bea01=_['map'](db['VtigerAccount'][_0x4218('0x2b')],function(_0x3844f6){return{'name':_0x3844f6[_0x4218('0x2c')],'type':_0x3844f6[_0x4218('0x2d')][_0x4218('0x2e')]};});_0xbe9c96[_0x4218('0x2f')]=_[_0x4218('0x30')](_0x3bea01,_0x4218('0x28'));_0xbe9c96[_0x4218('0x31')]=_[_0x4218('0x32')](_0x4b23bf[_0x4218('0x31')]);_0xbe9c96['filters']=_['intersection'](_0xbe9c96[_0x4218('0x2f')],_0xbe9c96[_0x4218('0x31')]);_0x5c3dae[_0x4218('0x33')]=_[_0x4218('0x34')](_0xbe9c96[_0x4218('0x2f')],qs[_0x4218('0x35')](_0x4b23bf[_0x4218('0x31')]['fields']));_0x5c3dae[_0x4218('0x33')]=_0x5c3dae[_0x4218('0x33')][_0x4218('0x36')]?_0x5c3dae[_0x4218('0x33')]:_0xbe9c96[_0x4218('0x2f')];if(!_0x4b23bf['query'][_0x4218('0x37')](_0x4218('0x38'))){_0x5c3dae['limit']=qs[_0x4218('0x1d')](_0x4b23bf[_0x4218('0x31')][_0x4218('0x1d')]);_0x5c3dae[_0x4218('0x1f')]=qs[_0x4218('0x1f')](_0x4b23bf[_0x4218('0x31')][_0x4218('0x1f')]);}_0x5c3dae[_0x4218('0x39')]=qs[_0x4218('0x3a')](_0x4b23bf[_0x4218('0x31')][_0x4218('0x3a')]);_0x5c3dae[_0x4218('0x3b')]=qs['filters'](_[_0x4218('0x3c')](_0x4b23bf[_0x4218('0x31')],_0xbe9c96[_0x4218('0x3d')]),_0x3bea01);if(_0x4b23bf['query'][_0x4218('0x3e')]){_0x5c3dae[_0x4218('0x3b')]=_['merge'](_0x5c3dae[_0x4218('0x3b')],{'$or':_['map'](_0x3bea01,function(_0x5528d6){if(_0x5528d6[_0x4218('0x2d')]!==_0x4218('0x3f')){var _0x5180be={};_0x5180be[_0x5528d6[_0x4218('0x28')]]={'$like':'%'+_0x4b23bf['query'][_0x4218('0x3e')]+'%'};return _0x5180be;}})});}_0x5c3dae=_[_0x4218('0x40')]({},_0x5c3dae,_0x4b23bf[_0x4218('0x41')]);var _0x4c5422={'where':_0x5c3dae[_0x4218('0x3b')]};return db[_0x4218('0x42')][_0x4218('0x1e')](_0x4c5422)['then'](function(_0x1eff3c){_0x45da3b[_0x4218('0x1e')]=_0x1eff3c;if(_0x4b23bf['query'][_0x4218('0x43')]){_0x5c3dae[_0x4218('0x44')]=[{'all':!![]}];}return db[_0x4218('0x42')][_0x4218('0x45')](_0x5c3dae);})[_0x4218('0x25')](function(_0x2180e4){_0x45da3b[_0x4218('0x46')]=_0x2180e4;return _0x45da3b;})[_0x4218('0x25')](respondWithFilteredResult(_0x1ed11b,_0x5c3dae))[_0x4218('0x47')](handleError(_0x1ed11b,null));};exports[_0x4218('0x48')]=function(_0x3957fc,_0x27fd8c){var _0xdc6344={'raw':![],'where':{'id':_0x3957fc[_0x4218('0x49')]['id']}},_0x2dabb2={};_0x2dabb2[_0x4218('0x2f')]=_[_0x4218('0x32')](db[_0x4218('0x42')][_0x4218('0x2b')]);_0x2dabb2[_0x4218('0x31')]=_[_0x4218('0x32')](_0x3957fc[_0x4218('0x31')]);_0x2dabb2[_0x4218('0x3d')]=_[_0x4218('0x34')](_0x2dabb2[_0x4218('0x2f')],_0x2dabb2[_0x4218('0x31')]);_0xdc6344[_0x4218('0x33')]=_[_0x4218('0x34')](_0x2dabb2['model'],qs[_0x4218('0x35')](_0x3957fc[_0x4218('0x31')][_0x4218('0x35')]));_0xdc6344['attributes']=_0xdc6344[_0x4218('0x33')][_0x4218('0x36')]?_0xdc6344[_0x4218('0x33')]:_0x2dabb2[_0x4218('0x2f')];if(_0x3957fc['query'][_0x4218('0x43')]){_0xdc6344[_0x4218('0x44')]=[{'all':!![]}];}_0xdc6344=_[_0x4218('0x40')]({},_0xdc6344,_0x3957fc[_0x4218('0x41')]);return db[_0x4218('0x42')][_0x4218('0x4a')](_0xdc6344)[_0x4218('0x25')](handleEntityNotFound(_0x27fd8c,null))[_0x4218('0x25')](respondWithResult(_0x27fd8c,null))[_0x4218('0x47')](handleError(_0x27fd8c,null));};exports['create']=function(_0x14f227,_0xec85b9){return db['VtigerAccount'][_0x4218('0x4b')](_0x14f227[_0x4218('0x4c')],{})[_0x4218('0x25')](respondWithResult(_0xec85b9,0xc9))[_0x4218('0x47')](handleError(_0xec85b9,null));};exports[_0x4218('0x24')]=function(_0xebdee4,_0x4783b6){if(_0xebdee4['body']['id']){delete _0xebdee4[_0x4218('0x4c')]['id'];}return db[_0x4218('0x42')][_0x4218('0x4a')]({'where':{'id':_0xebdee4['params']['id']}})['then'](handleEntityNotFound(_0x4783b6,null))[_0x4218('0x25')](saveUpdates(_0xebdee4['body'],null))[_0x4218('0x25')](respondWithResult(_0x4783b6,null))['catch'](handleError(_0x4783b6,null));};exports['destroy']=function(_0x3bd532,_0x246985){return db['VtigerAccount'][_0x4218('0x4a')]({'where':{'id':_0x3bd532[_0x4218('0x49')]['id']}})[_0x4218('0x25')](handleEntityNotFound(_0x246985,null))[_0x4218('0x25')](removeEntity(_0x246985,null))['catch'](handleError(_0x246985,null));};exports['getConfigurations']=function(_0x14b9cc,_0xba4ec8,_0x3067d4){var _0x1b3694={};var _0x40de23={};var _0x4c8050;var _0x20a77c;return db[_0x4218('0x42')][_0x4218('0x4d')]({'where':{'id':_0x14b9cc[_0x4218('0x49')]['id']}})[_0x4218('0x25')](handleEntityNotFound(_0xba4ec8,null))['then'](function(_0x48a00f){if(_0x48a00f){_0x4c8050=_0x48a00f;_0x40de23[_0x4218('0x2f')]=_[_0x4218('0x32')](db[_0x4218('0x4e')][_0x4218('0x2b')]);_0x40de23['query']=_[_0x4218('0x32')](_0x14b9cc[_0x4218('0x31')]);_0x40de23[_0x4218('0x3d')]=_[_0x4218('0x34')](_0x40de23[_0x4218('0x2f')],_0x40de23[_0x4218('0x31')]);_0x1b3694['attributes']=_[_0x4218('0x34')](_0x40de23[_0x4218('0x2f')],qs[_0x4218('0x35')](_0x14b9cc[_0x4218('0x31')][_0x4218('0x35')]));_0x1b3694[_0x4218('0x33')]=_0x1b3694[_0x4218('0x33')][_0x4218('0x36')]?_0x1b3694[_0x4218('0x33')]:_0x40de23[_0x4218('0x2f')];_0x1b3694[_0x4218('0x39')]=qs['sort'](_0x14b9cc[_0x4218('0x31')][_0x4218('0x3a')]);_0x1b3694[_0x4218('0x3b')]=qs[_0x4218('0x3d')](_[_0x4218('0x3c')](_0x14b9cc['query'],_0x40de23[_0x4218('0x3d')]));if(_0x14b9cc[_0x4218('0x31')][_0x4218('0x3e')]){_0x1b3694[_0x4218('0x3b')]=_[_0x4218('0x40')](_0x1b3694[_0x4218('0x3b')],{'$or':_[_0x4218('0x30')](_0x1b3694['attributes'],function(_0x4d7b8e){var _0xb59e7f={};_0xb59e7f[_0x4d7b8e]={'$like':'%'+_0x14b9cc[_0x4218('0x31')][_0x4218('0x3e')]+'%'};return _0xb59e7f;})});}_0x1b3694=_[_0x4218('0x40')]({},_0x1b3694,_0x14b9cc[_0x4218('0x41')]);return _0x4c8050['getConfigurations'](_0x1b3694);}})['then'](function(_0x42c0c1){if(_0x42c0c1){_0x20a77c=_0x42c0c1['length'];if(!_0x14b9cc[_0x4218('0x31')][_0x4218('0x37')](_0x4218('0x38'))){_0x1b3694[_0x4218('0x1d')]=qs[_0x4218('0x1d')](_0x14b9cc[_0x4218('0x31')][_0x4218('0x1d')]);_0x1b3694[_0x4218('0x1f')]=qs[_0x4218('0x1f')](_0x14b9cc[_0x4218('0x31')][_0x4218('0x1f')]);}return _0x4c8050[_0x4218('0x4f')](_0x1b3694);}})[_0x4218('0x25')](function(_0x12bba2){if(_0x12bba2){return _0x12bba2?{'count':_0x20a77c,'rows':_0x12bba2}:null;}})[_0x4218('0x25')](respondWithResult(_0xba4ec8,null))['catch'](handleError(_0xba4ec8,null));};exports[_0x4218('0x50')]=function(_0x13b278,_0x58d5bc,_0x5b369b){if(_0x13b278[_0x4218('0x4c')]['id']){delete _0x13b278[_0x4218('0x4c')]['id'];}return db[_0x4218('0x42')][_0x4218('0x4d')]({'where':{'id':_0x13b278[_0x4218('0x49')]['id']}})[_0x4218('0x25')](handleEntityNotFound(_0x58d5bc,null))[_0x4218('0x25')](function(_0x251a62){if(_0x251a62){_0x13b278[_0x4218('0x4c')][_0x4218('0x51')]=_0x251a62['id'];_0x13b278['body'][_0x4218('0x52')]=integrations[_0x4218('0x53')](_0x13b278[_0x4218('0x4c')]['channel'],_0x13b278[_0x4218('0x4c')][_0x4218('0x2d')]);_0x13b278['body']['Descriptions']=integrations[_0x4218('0x54')](_0x13b278['body']['channel'],_0x13b278[_0x4218('0x4c')][_0x4218('0x2d')]);return db[_0x4218('0x4e')][_0x4218('0x4b')](_0x13b278['body'],{'include':[{'model':db[_0x4218('0x55')],'as':'Subjects'},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x4218('0x25')](respondWithResult(_0x58d5bc,null))[_0x4218('0x47')](handleError(_0x58d5bc,null));};var md5=require('md5');exports['getFields']=function(_0x6f2538,_0x26856b,_0xbf60b5){var _0x2bcf64=null;var _0x5dbe74=null;var _0x5b819d=null;var _0x2f2781=null;var _0x23f763='';return db[_0x4218('0x42')][_0x4218('0x4d')]({'where':{'id':_0x6f2538['params']['id']},'attributes':['id','name','username',_0x4218('0x56'),_0x4218('0x57'),'remoteUri','serverUrl','accessKey']})[_0x4218('0x25')](handleEntityNotFound(_0x26856b,null))['then'](function(_0x166b18){if(_0x166b18){_0x2bcf64=_0x166b18[_0x4218('0x58')];_0x5dbe74=_0x166b18[_0x4218('0x59')];_0x5b819d=_0x166b18[_0x4218('0x57')];_0x23f763=_0x166b18[_0x4218('0x5a')];var _0x2416cb=_0x23f763[_0x4218('0x5b')](-0x1);if(_0x2416cb==='/'){_0x23f763=_0x23f763[_0x4218('0x5c')](0x0,_0x23f763[_0x4218('0x5d')](_0x2416cb));}_0x2f2781=util[_0x4218('0x5e')](_0x4218('0x5f'),_0x23f763);var _0x583edc={'method':'GET','uri':_0x2f2781,'qs':{'operation':_0x4218('0x60'),'username':_0x166b18[_0x4218('0x58')]},'json':!![]};return rp(_0x583edc);}})['then'](function(_0x189171){if(_0x189171['success']){var _0x58da09={'method':_0x4218('0x61'),'uri':_0x2f2781,'form':{'operation':_0x4218('0x62'),'username':_0x2bcf64,'accessKey':md5(_0x189171[_0x4218('0x63')][_0x4218('0x64')]+_0x5dbe74)},'json':!![]};return rp(_0x58da09);}})[_0x4218('0x25')](function(_0x39d738){if(_0x39d738['success']){var _0x3f5af3={'method':_0x4218('0x65'),'uri':_0x2f2781,'qs':{'operation':_0x4218('0x66'),'username':_0x2bcf64,'sessionName':_0x39d738['result'][_0x4218('0x67')],'elementType':_0x5b819d},'json':!![]};return rp(_0x3f5af3);}})[_0x4218('0x25')](function(_0xf52f85){if(_0xf52f85[_0x4218('0x68')]){var _0xdef1a=[_0x4218('0x69'),_0x4218('0x6a'),_0x4218('0x6b')];_[_0x4218('0x6c')](_0xf52f85['result'][_0x4218('0x35')],function(_0x531d36){return _0xdef1a['includes'](_0x531d36[_0x4218('0x2d')]['name']);});_[_0x4218('0x6c')](_0xf52f85[_0x4218('0x63')]['fields'],function(_0x56d7dc){return _0x56d7dc['editable']===_0x4218('0x6d');});return{'count':_0xf52f85[_0x4218('0x63')][_0x4218('0x35')]['length'],'rows':_['map'](_0xf52f85['result'][_0x4218('0x35')],function(_0x4e7044){return{'id':_0x4e7044[_0x4218('0x28')],'name':_0x4e7044['label'],'custom':_[_0x4218('0x6e')](_0x4e7044[_0x4218('0x28')],'cf_')?!![]:![],'options':_0x4e7044[_0x4218('0x2d')][_0x4218('0x28')]==='picklist'&&_0x4e7044[_0x4218('0x2d')][_0x4218('0x6f')][_0x4218('0x36')]>0x0?_[_0x4218('0x30')](_0x4e7044['type']['picklistValues'],function(_0x28b865){return{'name':_0x28b865[_0x4218('0x70')],'value':_0x28b865[_0x4218('0x71')]};}):[]};})};}})[_0x4218('0x25')](respondWithResult(_0x26856b,null))[_0x4218('0x47')](function(_0x2d3981){console[_0x4218('0x72')](_0x4218('0x73')+_0x2d3981);var _0x22f9b8=_0x6f2538[_0x4218('0x31')][_0x4218('0x74')]?0x1f4:_0x2d3981[_0x4218('0x75')]||0x1f4;logger[_0x4218('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x4218('0x76'),_0x22f9b8,JSON[_0x4218('0x77')](_0x2d3981));delete _0x2d3981['name'];if(_0x22f9b8===0x191){_0x22f9b8=0x190;}_0x26856b['status'](_0x22f9b8)[_0x4218('0x29')](_0x6f2538[_0x4218('0x31')][_0x4218('0x74')]?{'message':_0x4218('0x78'),'statusCode':_0x2d3981[_0x4218('0x75')]}:_0x2d3981);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index fc3372f..f0515d8 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 _0x0094=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xa070d2,_0x1aa4bf){var _0x222f7b=function(_0x42b5be){while(--_0x42b5be){_0xa070d2['push'](_0xa070d2['shift']());}};_0x222f7b(++_0x1aa4bf);}(_0x0094,0x161));var _0x4009=function(_0x386c25,_0x47649f){_0x386c25=_0x386c25-0x0;var _0x2922a1=_0x0094[_0x386c25];return _0x2922a1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4009('0x0'))(_0x4009('0x1'));var moment=require(_0x4009('0x2'));var BPromise=require(_0x4009('0x3'));var rp=require(_0x4009('0x4'));var fs=require('fs');var path=require(_0x4009('0x5'));var rimraf=require(_0x4009('0x6'));var config=require(_0x4009('0x7'));var attributes=require(_0x4009('0x8'));var integrations=require(_0x4009('0x9'));module[_0x4009('0xa')]=function(_0x8d733c,_0x595f90){return _0x8d733c['define'](_0x4009('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebb9=['int_vtiger_accounts','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xebb9,0x9d));var _0x9ebb=function(_0x14ab01,_0x34fd2a){_0x14ab01=_0x14ab01-0x0;var _0x5ee177=_0xebb9[_0x14ab01];return _0x5ee177;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9ebb('0x0'))('api');var moment=require(_0x9ebb('0x1'));var BPromise=require(_0x9ebb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ebb('0x3'));var rimraf=require(_0x9ebb('0x4'));var config=require(_0x9ebb('0x5'));var attributes=require(_0x9ebb('0x6'));var integrations=require(_0x9ebb('0x7'));module[_0x9ebb('0x8')]=function(_0x18fcb8,_0x5113e2){return _0x18fcb8[_0x9ebb('0x9')](_0x9ebb('0xa'),attributes,{'tableName':_0x9ebb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 691c94f..726633c 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 _0x57f8=['request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','options','where','attributes','include','model','map','debug','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xb09d7b,_0xb35901){var _0x4b525a=function(_0x4b73a0){while(--_0x4b73a0){_0xb09d7b['push'](_0xb09d7b['shift']());}};_0x4b525a(++_0xb35901);}(_0x57f8,0x198));var _0x857f=function(_0x1c67a2,_0x599648){_0x1c67a2=_0x1c67a2-0x0;var _0x4fbd8e=_0x57f8[_0x1c67a2];return _0x4fbd8e;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var moment=require(_0x857f('0x1'));var BPromise=require(_0x857f('0x2'));var rs=require(_0x857f('0x3'));var fs=require('fs');var Redis=require(_0x857f('0x4'));var db=require(_0x857f('0x5'))['db'];var utils=require(_0x857f('0x6'));var logger=require(_0x857f('0x7'))(_0x857f('0x8'));var config=require(_0x857f('0x9'));var jayson=require(_0x857f('0xa'));var client=jayson[_0x857f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8380e8,_0x197098,_0x1aaeea){return new BPromise(function(_0x577fc3,_0x5f6a66){return client[_0x857f('0xc')](_0x8380e8,_0x1aaeea)[_0x857f('0xd')](function(_0x4f2b09){logger[_0x857f('0xe')](_0x857f('0xf'),_0x197098,_0x857f('0x10'));logger['debug'](_0x857f('0x11'),_0x197098,_0x857f('0x10'),JSON[_0x857f('0x12')](_0x4f2b09));if(_0x4f2b09[_0x857f('0x13')]){if(_0x4f2b09[_0x857f('0x13')][_0x857f('0x14')]===0x1f4){logger[_0x857f('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x197098,_0x4f2b09[_0x857f('0x13')][_0x857f('0x15')]);return _0x5f6a66(_0x4f2b09[_0x857f('0x13')][_0x857f('0x15')]);}logger[_0x857f('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x197098,_0x4f2b09['error'][_0x857f('0x15')]);return _0x577fc3(_0x4f2b09['error'][_0x857f('0x15')]);}else{logger['info'](_0x857f('0xf'),_0x197098,_0x857f('0x10'));_0x577fc3(_0x4f2b09['result'][_0x857f('0x15')]);}})[_0x857f('0x16')](function(_0xdf14fe){logger[_0x857f('0x13')](_0x857f('0xf'),_0x197098,_0xdf14fe);_0x5f6a66(_0xdf14fe);});});}exports[_0x857f('0x17')]=function(_0x1a9ef8){var _0x429e23=this;return new Promise(function(_0x1014ca,_0x38a242){return db[_0x857f('0x18')]['findAll']({'raw':_0x1a9ef8[_0x857f('0x19')]?_0x1a9ef8[_0x857f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1a9ef8[_0x857f('0x19')]?_0x1a9ef8[_0x857f('0x19')][_0x857f('0x1a')]||null:null,'attributes':_0x1a9ef8['options']?_0x1a9ef8['options'][_0x857f('0x1b')]||null:null,'limit':_0x1a9ef8[_0x857f('0x19')]?_0x1a9ef8[_0x857f('0x19')]['limit']||null:null,'include':_0x1a9ef8[_0x857f('0x19')]?_0x1a9ef8[_0x857f('0x19')][_0x857f('0x1c')]?_['map'](_0x1a9ef8[_0x857f('0x19')][_0x857f('0x1c')],function(_0x50bfb7){return{'model':db[_0x50bfb7[_0x857f('0x1d')]],'as':_0x50bfb7['as'],'attributes':_0x50bfb7[_0x857f('0x1b')],'include':_0x50bfb7[_0x857f('0x1c')]?_[_0x857f('0x1e')](_0x50bfb7[_0x857f('0x1c')],function(_0x3b23a7){return{'model':db[_0x3b23a7[_0x857f('0x1d')]],'as':_0x3b23a7['as'],'attributes':_0x3b23a7[_0x857f('0x1b')],'include':_0x3b23a7[_0x857f('0x1c')]?_[_0x857f('0x1e')](_0x3b23a7[_0x857f('0x1c')],function(_0x4782ab){return{'model':db[_0x4782ab[_0x857f('0x1d')]],'as':_0x4782ab['as'],'attributes':_0x4782ab[_0x857f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17e415){logger[_0x857f('0xe')](_0x857f('0x17'),_0x1a9ef8);logger[_0x857f('0x1f')]('GetVtigerAccount',_0x1a9ef8,JSON[_0x857f('0x12')](_0x17e415));_0x1014ca(_0x17e415);})['catch'](function(_0x1b405a){logger[_0x857f('0x13')](_0x857f('0x17'),_0x1b405a[_0x857f('0x15')],_0x1a9ef8);_0x38a242(_0x429e23[_0x857f('0x13')](0x1f4,_0x1b405a[_0x857f('0x15')]));});});};exports[_0x857f('0x20')]=function(_0xe79241){var _0x17e7b6=this;return new Promise(function(_0x41f832,_0x24adc2){return db[_0x857f('0x18')][_0x857f('0x21')]({'raw':_0xe79241['options']?_0xe79241[_0x857f('0x19')][_0x857f('0x22')]===undefined?!![]:![]:!![],'where':_0xe79241['options']?_0xe79241[_0x857f('0x19')][_0x857f('0x1a')]||null:null,'attributes':_0xe79241['options']?_0xe79241[_0x857f('0x19')][_0x857f('0x1b')]||null:null,'include':_0xe79241['options']?_0xe79241[_0x857f('0x19')][_0x857f('0x1c')]?_[_0x857f('0x1e')](_0xe79241[_0x857f('0x19')]['include'],function(_0x596b2f){return{'model':db[_0x596b2f[_0x857f('0x1d')]],'as':_0x596b2f['as'],'attributes':_0x596b2f[_0x857f('0x1b')],'include':_0x596b2f['include']?_[_0x857f('0x1e')](_0x596b2f['include'],function(_0x1ff000){return{'model':db[_0x1ff000[_0x857f('0x1d')]],'as':_0x1ff000['as'],'attributes':_0x1ff000[_0x857f('0x1b')],'include':_0x1ff000[_0x857f('0x1c')]?_[_0x857f('0x1e')](_0x1ff000['include'],function(_0x47cfed){return{'model':db[_0x47cfed[_0x857f('0x1d')]],'as':_0x47cfed['as'],'attributes':_0x47cfed['attributes']};}):[]};}):[]};}):[]:[]})[_0x857f('0xd')](function(_0x227602){logger[_0x857f('0xe')]('ShowVtigerAccount',_0xe79241);logger[_0x857f('0x1f')](_0x857f('0x20'),_0xe79241,JSON[_0x857f('0x12')](_0x227602));_0x41f832(_0x227602);})[_0x857f('0x16')](function(_0x36e6bd){logger[_0x857f('0x13')](_0x857f('0x20'),_0x36e6bd['message'],_0xe79241);_0x24adc2(_0x17e7b6[_0x857f('0x13')](0x1f4,_0x36e6bd[_0x857f('0x15')]));});});}; \ No newline at end of file +var _0xeffd=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetVtigerAccount','find','ShowVtigerAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeffd,0x6b));var _0xdeff=function(_0x245016,_0x517e16){_0x245016=_0x245016-0x0;var _0x1ef78e=_0xeffd[_0x245016];return _0x1ef78e;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x281ad7,_0x256323,_0x39878e){return new BPromise(function(_0x12e953,_0x24897a){return client['request'](_0x281ad7,_0x39878e)[_0xdeff('0xd')](function(_0x45a8a6){logger[_0xdeff('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x256323,_0xdeff('0xf'));logger[_0xdeff('0x10')](_0xdeff('0x11'),_0x256323,_0xdeff('0xf'),JSON[_0xdeff('0x12')](_0x45a8a6));if(_0x45a8a6[_0xdeff('0x13')]){if(_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x14')]===0x1f4){logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')]['message']);return _0x24897a(_0x45a8a6[_0xdeff('0x13')]['message']);}logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x16')]);return _0x12e953(_0x45a8a6[_0xdeff('0x13')]['message']);}else{logger[_0xdeff('0xe')](_0xdeff('0x15'),_0x256323,_0xdeff('0xf'));_0x12e953(_0x45a8a6[_0xdeff('0x17')][_0xdeff('0x16')]);}})[_0xdeff('0x18')](function(_0x577244){logger['error'](_0xdeff('0x15'),_0x256323,_0x577244);_0x24897a(_0x577244);});});}exports['GetVtigerAccount']=function(_0x5c9837){var _0x35635f=this;return new Promise(function(_0x369e13,_0x4b14b6){return db[_0xdeff('0x19')][_0xdeff('0x1a')]({'raw':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837[_0xdeff('0x1b')][_0xdeff('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837[_0xdeff('0x1b')][_0xdeff('0x1d')]||null:null,'attributes':_0x5c9837['options']?_0x5c9837['options']['attributes']||null:null,'limit':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837['options'][_0xdeff('0x1e')]||null:null,'include':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837['options'][_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0x5c9837['options']['include'],function(_0x3b2554){return{'model':db[_0x3b2554[_0xdeff('0x21')]],'as':_0x3b2554['as'],'attributes':_0x3b2554[_0xdeff('0x22')],'include':_0x3b2554[_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0x3b2554['include'],function(_0xb08f19){return{'model':db[_0xb08f19[_0xdeff('0x21')]],'as':_0xb08f19['as'],'attributes':_0xb08f19[_0xdeff('0x22')],'include':_0xb08f19[_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0xb08f19[_0xdeff('0x1f')],function(_0x3d0111){return{'model':db[_0x3d0111['model']],'as':_0x3d0111['as'],'attributes':_0x3d0111[_0xdeff('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdeff('0xd')](function(_0x53b168){logger['info'](_0xdeff('0x23'),_0x5c9837);logger[_0xdeff('0x10')](_0xdeff('0x23'),_0x5c9837,JSON[_0xdeff('0x12')](_0x53b168));_0x369e13(_0x53b168);})[_0xdeff('0x18')](function(_0xf9b278){logger[_0xdeff('0x13')]('GetVtigerAccount',_0xf9b278[_0xdeff('0x16')],_0x5c9837);_0x4b14b6(_0x35635f[_0xdeff('0x13')](0x1f4,_0xf9b278[_0xdeff('0x16')]));});});};exports['ShowVtigerAccount']=function(_0x59f7a0){var _0x346743=this;return new Promise(function(_0x505e3f,_0x69842a){return db[_0xdeff('0x19')][_0xdeff('0x24')]({'raw':_0x59f7a0['options']?_0x59f7a0[_0xdeff('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x59f7a0['options']?_0x59f7a0[_0xdeff('0x1b')][_0xdeff('0x1d')]||null:null,'attributes':_0x59f7a0[_0xdeff('0x1b')]?_0x59f7a0[_0xdeff('0x1b')]['attributes']||null:null,'include':_0x59f7a0[_0xdeff('0x1b')]?_0x59f7a0[_0xdeff('0x1b')][_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0x59f7a0[_0xdeff('0x1b')][_0xdeff('0x1f')],function(_0x321ef0){return{'model':db[_0x321ef0['model']],'as':_0x321ef0['as'],'attributes':_0x321ef0[_0xdeff('0x22')],'include':_0x321ef0['include']?_[_0xdeff('0x20')](_0x321ef0[_0xdeff('0x1f')],function(_0x2e1736){return{'model':db[_0x2e1736[_0xdeff('0x21')]],'as':_0x2e1736['as'],'attributes':_0x2e1736[_0xdeff('0x22')],'include':_0x2e1736[_0xdeff('0x1f')]?_['map'](_0x2e1736[_0xdeff('0x1f')],function(_0x3bf462){return{'model':db[_0x3bf462['model']],'as':_0x3bf462['as'],'attributes':_0x3bf462[_0xdeff('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdeff('0xd')](function(_0x1c6d4c){logger[_0xdeff('0xe')](_0xdeff('0x25'),_0x59f7a0);logger[_0xdeff('0x10')](_0xdeff('0x25'),_0x59f7a0,JSON[_0xdeff('0x12')](_0x1c6d4c));_0x505e3f(_0x1c6d4c);})['catch'](function(_0x118752){logger['error'](_0xdeff('0x25'),_0x118752[_0xdeff('0x16')],_0x59f7a0);_0x69842a(_0x346743[_0xdeff('0x13')](0x1f4,_0x118752['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 0770927..a357a2f 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 _0xc9ca=['../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id/fields','getFields','getSubjects','getDescriptions','post','put','/:id','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xc9ca,0x8d));var _0xac9c=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0xc9ca[_0x3e0763];return _0x351ca2;};'use strict';var multer=require(_0xac9c('0x0'));var util=require(_0xac9c('0x1'));var path=require(_0xac9c('0x2'));var timeout=require(_0xac9c('0x3'));var express=require('express');var router=express[_0xac9c('0x4')]();var fs_extra=require(_0xac9c('0x5'));var auth=require(_0xac9c('0x6'));var interaction=require(_0xac9c('0x7'));var config=require('../../config/environment');var controller=require(_0xac9c('0x8'));router['get']('/',auth[_0xac9c('0x9')](),controller[_0xac9c('0xa')]);router['get']('/:id',auth[_0xac9c('0x9')](),controller['show']);router[_0xac9c('0xb')](_0xac9c('0xc'),auth[_0xac9c('0x9')](),controller[_0xac9c('0xd')]);router[_0xac9c('0xb')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xac9c('0xe')]);router[_0xac9c('0xb')]('/:id/descriptions',auth[_0xac9c('0x9')](),controller[_0xac9c('0xf')]);router[_0xac9c('0x10')]('/',auth[_0xac9c('0x9')](),controller['create']);router[_0xac9c('0x11')](_0xac9c('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xac9c('0x13')](_0xac9c('0x12'),auth[_0xac9c('0x9')](),controller[_0xac9c('0x14')]);module['exports']=router; \ No newline at end of file +var _0x88e3=['../../components/auth/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x489548,_0x782180){var _0x14341b=function(_0x2d9486){while(--_0x2d9486){_0x489548['push'](_0x489548['shift']());}};_0x14341b(++_0x782180);}(_0x88e3,0x1de));var _0x388e=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0x88e3[_0x43a6cd];return _0x5acb36;};'use strict';var multer=require('multer');var util=require(_0x388e('0x0'));var path=require(_0x388e('0x1'));var timeout=require(_0x388e('0x2'));var express=require('express');var router=express[_0x388e('0x3')]();var fs_extra=require(_0x388e('0x4'));var auth=require(_0x388e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x388e('0x6'));router[_0x388e('0x7')]('/',auth[_0x388e('0x8')](),controller[_0x388e('0x9')]);router[_0x388e('0x7')](_0x388e('0xa'),auth[_0x388e('0x8')](),controller[_0x388e('0xb')]);router[_0x388e('0x7')]('/:id/fields',auth[_0x388e('0x8')](),controller['getFields']);router[_0x388e('0x7')](_0x388e('0xc'),auth[_0x388e('0x8')](),controller[_0x388e('0xd')]);router['get'](_0x388e('0xe'),auth[_0x388e('0x8')](),controller[_0x388e('0xf')]);router['post']('/',auth[_0x388e('0x8')](),controller[_0x388e('0x10')]);router[_0x388e('0x11')](_0x388e('0xa'),auth[_0x388e('0x8')](),controller['update']);router[_0x388e('0x12')](_0x388e('0xa'),auth['isAuthenticated'](),controller[_0x388e('0x13')]);module[_0x388e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 35824a4..612270a 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 _0x5d4b=['STRING','sequelize'];(function(_0x12a669,_0x2bdfd1){var _0x3327d2=function(_0x28de3e){while(--_0x28de3e){_0x12a669['push'](_0x12a669['shift']());}};_0x3327d2(++_0x2bdfd1);}(_0x5d4b,0x69));var _0xb5d4=function(_0x2d9beb,_0x3f7c5a){_0x2d9beb=_0x2d9beb-0x0;var _0x487500=_0x5d4b[_0x2d9beb];return _0x487500;};'use strict';var Sequelize=require(_0xb5d4('0x0'));module['exports']={'name':{'type':Sequelize[_0xb5d4('0x1')]},'description':{'type':Sequelize[_0xb5d4('0x1')]}}; \ No newline at end of file +var _0x3fc1=['sequelize','STRING'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3fc1,0x1ec));var _0x13fc=function(_0x4845a5,_0x50245f){_0x4845a5=_0x4845a5-0x0;var _0x160934=_0x3fc1[_0x4845a5];return _0x160934;};'use strict';var Sequelize=require(_0x13fc('0x0'));module['exports']={'name':{'type':Sequelize[_0x13fc('0x1')]},'description':{'type':Sequelize[_0x13fc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 3608f13..77023c7 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 _0x4718=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VtigerConfiguration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getFields','findOne','order','hasOwnProperty','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x4edcde,_0x447a76){var _0x4baa21=function(_0x177d90){while(--_0x177d90){_0x4edcde['push'](_0x4edcde['shift']());}};_0x4baa21(++_0x447a76);}(_0x4718,0x17c));var _0x8471=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0x4718[_0x1fa759];return _0x2da9f4;};'use strict';var emlformat=require(_0x8471('0x0'));var rimraf=require(_0x8471('0x1'));var zipdir=require(_0x8471('0x2'));var jsonpatch=require(_0x8471('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8471('0x4'));var util=require(_0x8471('0x5'));var path=require(_0x8471('0x6'));var sox=require(_0x8471('0x7'));var csv=require(_0x8471('0x8'));var ejs=require(_0x8471('0x9'));var fs=require('fs');var fs_extra=require(_0x8471('0xa'));var _=require(_0x8471('0xb'));var squel=require(_0x8471('0xc'));var crypto=require(_0x8471('0xd'));var jsforce=require(_0x8471('0xe'));var deskjs=require(_0x8471('0xf'));var toCsv=require(_0x8471('0x8'));var querystring=require(_0x8471('0x10'));var Papa=require('papaparse');var Redis=require(_0x8471('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8471('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8471('0x13'))(_0x8471('0x14'));var utils=require(_0x8471('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8471('0x16'));var db=require(_0x8471('0x17'))['db'];function respondWithStatusCode(_0x36046c,_0x34f545){_0x34f545=_0x34f545||0xcc;return function(_0x5a3535){if(_0x5a3535){return _0x36046c[_0x8471('0x18')](_0x34f545);}return _0x36046c[_0x8471('0x19')](_0x34f545)[_0x8471('0x1a')]();};}function respondWithResult(_0x350c83,_0x15b0dd){_0x15b0dd=_0x15b0dd||0xc8;return function(_0x5e1554){if(_0x5e1554){return _0x350c83[_0x8471('0x19')](_0x15b0dd)[_0x8471('0x1b')](_0x5e1554);}};}function respondWithFilteredResult(_0x55ba73,_0x49c587){return function(_0x478be3){if(_0x478be3){var _0x5a51b8=typeof _0x49c587[_0x8471('0x1c')]==='undefined'&&typeof _0x49c587[_0x8471('0x1d')]==='undefined';var _0x2fd2bd=_0x478be3[_0x8471('0x1e')];var _0x25ee3a=_0x5a51b8?0x0:_0x49c587['offset'];var _0x2128b0=_0x5a51b8?_0x478be3['count']:_0x49c587['offset']+_0x49c587[_0x8471('0x1d')];var _0x1d00e0;if(_0x2128b0>=_0x2fd2bd){_0x2128b0=_0x2fd2bd;_0x1d00e0=0xc8;}else{_0x1d00e0=0xce;}_0x55ba73[_0x8471('0x19')](_0x1d00e0);return _0x55ba73[_0x8471('0x1f')](_0x8471('0x20'),_0x25ee3a+'-'+_0x2128b0+'/'+_0x2fd2bd)[_0x8471('0x1b')](_0x478be3);}return null;};}function patchUpdates(_0x3c6890){return function(_0x4d83e0){try{jsonpatch[_0x8471('0x21')](_0x4d83e0,_0x3c6890,!![]);}catch(_0x46946f){return BPromise[_0x8471('0x22')](_0x46946f);}return _0x4d83e0[_0x8471('0x23')]();};}function saveUpdates(_0x3b92bc,_0x47d2cc){return function(_0x545693){if(_0x545693){return _0x545693[_0x8471('0x24')](_0x3b92bc)[_0x8471('0x25')](function(_0x144319){return _0x144319;});}return null;};}function removeEntity(_0x3ae3a9,_0x73b686){return function(_0x24fc6e){if(_0x24fc6e){return _0x24fc6e[_0x8471('0x26')]()['then'](function(){_0x3ae3a9[_0x8471('0x19')](0xcc)[_0x8471('0x1a')]();});}};}function handleEntityNotFound(_0x4e7f40,_0x478720){return function(_0x4f188b){if(!_0x4f188b){_0x4e7f40['sendStatus'](0x194);}return _0x4f188b;};}function handleError(_0x27ffba,_0x234e4e){_0x234e4e=_0x234e4e||0x1f4;return function(_0x13c2a6){logger[_0x8471('0x27')](_0x13c2a6['stack']);if(_0x13c2a6[_0x8471('0x28')]){delete _0x13c2a6['name'];}_0x27ffba[_0x8471('0x19')](_0x234e4e)[_0x8471('0x29')](_0x13c2a6);};}exports[_0x8471('0x2a')]=function(_0x5a092e,_0x4e3ac7){var _0x38655d={},_0x2c3b39={},_0x53f633={'count':0x0,'rows':[]};var _0x130d9f=_[_0x8471('0x2b')](db[_0x8471('0x2c')]['rawAttributes'],function(_0x387844){return{'name':_0x387844[_0x8471('0x2d')],'type':_0x387844[_0x8471('0x2e')]['key']};});_0x2c3b39[_0x8471('0x2f')]=_[_0x8471('0x2b')](_0x130d9f,_0x8471('0x28'));_0x2c3b39[_0x8471('0x30')]=_[_0x8471('0x31')](_0x5a092e['query']);_0x2c3b39[_0x8471('0x32')]=_[_0x8471('0x33')](_0x2c3b39[_0x8471('0x2f')],_0x2c3b39[_0x8471('0x30')]);_0x38655d[_0x8471('0x34')]=_[_0x8471('0x33')](_0x2c3b39[_0x8471('0x2f')],qs['fields'](_0x5a092e[_0x8471('0x30')][_0x8471('0x35')]));_0x38655d[_0x8471('0x34')]=_0x38655d['attributes'][_0x8471('0x36')]?_0x38655d[_0x8471('0x34')]:_0x2c3b39['model'];if(!_0x5a092e[_0x8471('0x30')]['hasOwnProperty'](_0x8471('0x37'))){_0x38655d['limit']=qs[_0x8471('0x1d')](_0x5a092e[_0x8471('0x30')][_0x8471('0x1d')]);_0x38655d[_0x8471('0x1c')]=qs['offset'](_0x5a092e[_0x8471('0x30')][_0x8471('0x1c')]);}_0x38655d['order']=qs[_0x8471('0x38')](_0x5a092e['query'][_0x8471('0x38')]);_0x38655d[_0x8471('0x39')]=qs[_0x8471('0x32')](_[_0x8471('0x3a')](_0x5a092e[_0x8471('0x30')],_0x2c3b39['filters']),_0x130d9f);if(_0x5a092e['query'][_0x8471('0x3b')]){_0x38655d[_0x8471('0x39')]=_[_0x8471('0x3c')](_0x38655d[_0x8471('0x39')],{'$or':_['map'](_0x130d9f,function(_0x4c7279){if(_0x4c7279['type']!=='VIRTUAL'){var _0x1fa98b={};_0x1fa98b[_0x4c7279[_0x8471('0x28')]]={'$like':'%'+_0x5a092e[_0x8471('0x30')][_0x8471('0x3b')]+'%'};return _0x1fa98b;}})});}_0x38655d=_['merge']({},_0x38655d,_0x5a092e[_0x8471('0x3d')]);var _0x352643={'where':_0x38655d[_0x8471('0x39')]};return db[_0x8471('0x2c')][_0x8471('0x1e')](_0x352643)['then'](function(_0x4851ef){_0x53f633[_0x8471('0x1e')]=_0x4851ef;if(_0x5a092e[_0x8471('0x30')]['includeAll']){_0x38655d[_0x8471('0x3e')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x8471('0x3f')](_0x38655d);})['then'](function(_0x14cd04){_0x53f633[_0x8471('0x40')]=_0x14cd04;return _0x53f633;})[_0x8471('0x25')](respondWithFilteredResult(_0x4e3ac7,_0x38655d))[_0x8471('0x41')](handleError(_0x4e3ac7,null));};exports[_0x8471('0x42')]=function(_0x50a43b,_0x6f910e){var _0x1310fd={'raw':![],'where':{'id':_0x50a43b[_0x8471('0x43')]['id']}},_0x572803={};_0x572803['model']=_[_0x8471('0x31')](db['VtigerConfiguration'][_0x8471('0x44')]);_0x572803['query']=_[_0x8471('0x31')](_0x50a43b[_0x8471('0x30')]);_0x572803[_0x8471('0x32')]=_['intersection'](_0x572803[_0x8471('0x2f')],_0x572803[_0x8471('0x30')]);_0x1310fd[_0x8471('0x34')]=_[_0x8471('0x33')](_0x572803[_0x8471('0x2f')],qs[_0x8471('0x35')](_0x50a43b['query'][_0x8471('0x35')]));_0x1310fd[_0x8471('0x34')]=_0x1310fd[_0x8471('0x34')][_0x8471('0x36')]?_0x1310fd[_0x8471('0x34')]:_0x572803[_0x8471('0x2f')];if(_0x50a43b[_0x8471('0x30')][_0x8471('0x45')]){_0x1310fd[_0x8471('0x3e')]=[{'all':!![]}];}_0x1310fd=_[_0x8471('0x3c')]({},_0x1310fd,_0x50a43b['options']);return db[_0x8471('0x2c')][_0x8471('0x46')](_0x1310fd)[_0x8471('0x25')](handleEntityNotFound(_0x6f910e,null))[_0x8471('0x25')](respondWithResult(_0x6f910e,null))['catch'](handleError(_0x6f910e,null));};exports['create']=function(_0x1f7a1c,_0x139d49){return db[_0x8471('0x2c')][_0x8471('0x47')](_0x1f7a1c[_0x8471('0x48')],{})[_0x8471('0x25')](respondWithResult(_0x139d49,0xc9))[_0x8471('0x41')](handleError(_0x139d49,null));};exports['update']=function(_0x22ef30,_0x2fe095){if(_0x22ef30[_0x8471('0x48')]['id']){delete _0x22ef30['body']['id'];}return db[_0x8471('0x2c')][_0x8471('0x46')]({'where':{'id':_0x22ef30['params']['id']}})[_0x8471('0x25')](handleEntityNotFound(_0x2fe095,null))[_0x8471('0x25')](saveUpdates(_0x22ef30['body'],null))[_0x8471('0x25')](respondWithResult(_0x2fe095,null))[_0x8471('0x41')](handleError(_0x2fe095,null));};exports[_0x8471('0x26')]=function(_0x54098f,_0x1c5405){return db[_0x8471('0x2c')][_0x8471('0x46')]({'where':{'id':_0x54098f['params']['id']}})[_0x8471('0x25')](handleEntityNotFound(_0x1c5405,null))[_0x8471('0x25')](removeEntity(_0x1c5405,null))['catch'](handleError(_0x1c5405,null));};exports[_0x8471('0x49')]=function(_0x20409b,_0x3cd4bd,_0x2479e2){var _0x55a4e8={};var _0x1614ea={};var _0x1ce2f3;var _0x6c3237;return db[_0x8471('0x2c')][_0x8471('0x4a')]({'where':{'id':_0x20409b[_0x8471('0x43')]['id']}})[_0x8471('0x25')](handleEntityNotFound(_0x3cd4bd,null))[_0x8471('0x25')](function(_0x4ff18f){if(_0x4ff18f){_0x1ce2f3=_0x4ff18f;_0x1614ea['model']=_[_0x8471('0x31')](db['VtigerField'][_0x8471('0x44')]);_0x1614ea[_0x8471('0x30')]=_[_0x8471('0x31')](_0x20409b[_0x8471('0x30')]);_0x1614ea[_0x8471('0x32')]=_[_0x8471('0x33')](_0x1614ea[_0x8471('0x2f')],_0x1614ea[_0x8471('0x30')]);_0x55a4e8['attributes']=_['intersection'](_0x1614ea[_0x8471('0x2f')],qs['fields'](_0x20409b[_0x8471('0x30')][_0x8471('0x35')]));_0x55a4e8[_0x8471('0x34')]=_0x55a4e8[_0x8471('0x34')][_0x8471('0x36')]?_0x55a4e8['attributes']:_0x1614ea[_0x8471('0x2f')];_0x55a4e8[_0x8471('0x4b')]=qs['sort'](_0x20409b[_0x8471('0x30')][_0x8471('0x38')]);_0x55a4e8[_0x8471('0x39')]=qs['filters'](_[_0x8471('0x3a')](_0x20409b[_0x8471('0x30')],_0x1614ea[_0x8471('0x32')]));if(_0x20409b['query'][_0x8471('0x3b')]){_0x55a4e8[_0x8471('0x39')]=_[_0x8471('0x3c')](_0x55a4e8[_0x8471('0x39')],{'$or':_[_0x8471('0x2b')](_0x55a4e8[_0x8471('0x34')],function(_0x26066c){var _0x26d97f={};_0x26d97f[_0x26066c]={'$like':'%'+_0x20409b[_0x8471('0x30')][_0x8471('0x3b')]+'%'};return _0x26d97f;})});}_0x55a4e8=_[_0x8471('0x3c')]({},_0x55a4e8,_0x20409b[_0x8471('0x3d')]);return _0x1ce2f3[_0x8471('0x49')](_0x55a4e8);}})[_0x8471('0x25')](function(_0x4f12af){if(_0x4f12af){_0x6c3237=_0x4f12af[_0x8471('0x36')];if(!_0x20409b[_0x8471('0x30')][_0x8471('0x4c')](_0x8471('0x37'))){_0x55a4e8[_0x8471('0x1d')]=qs['limit'](_0x20409b[_0x8471('0x30')][_0x8471('0x1d')]);_0x55a4e8[_0x8471('0x1c')]=qs[_0x8471('0x1c')](_0x20409b[_0x8471('0x30')][_0x8471('0x1c')]);}return _0x1ce2f3[_0x8471('0x49')](_0x55a4e8);}})[_0x8471('0x25')](function(_0x3e566e){if(_0x3e566e){return _0x3e566e?{'count':_0x6c3237,'rows':_0x3e566e}:null;}})[_0x8471('0x25')](respondWithResult(_0x3cd4bd,null))[_0x8471('0x41')](handleError(_0x3cd4bd,null));};exports[_0x8471('0x4d')]=function(_0x520f9c,_0x82e368,_0x7f4585){var _0x3c857b={};var _0xcc5cc7={};var _0x43168f;var _0x32f24b;return db[_0x8471('0x2c')][_0x8471('0x4a')]({'where':{'id':_0x520f9c[_0x8471('0x43')]['id']}})['then'](handleEntityNotFound(_0x82e368,null))[_0x8471('0x25')](function(_0x101968){if(_0x101968){_0x43168f=_0x101968;_0xcc5cc7[_0x8471('0x2f')]=_[_0x8471('0x31')](db[_0x8471('0x4e')]['rawAttributes']);_0xcc5cc7['query']=_[_0x8471('0x31')](_0x520f9c[_0x8471('0x30')]);_0xcc5cc7[_0x8471('0x32')]=_['intersection'](_0xcc5cc7[_0x8471('0x2f')],_0xcc5cc7['query']);_0x3c857b[_0x8471('0x34')]=_['intersection'](_0xcc5cc7[_0x8471('0x2f')],qs[_0x8471('0x35')](_0x520f9c[_0x8471('0x30')][_0x8471('0x35')]));_0x3c857b[_0x8471('0x34')]=_0x3c857b['attributes']['length']?_0x3c857b[_0x8471('0x34')]:_0xcc5cc7[_0x8471('0x2f')];_0x3c857b[_0x8471('0x4b')]=qs[_0x8471('0x38')](_0x520f9c[_0x8471('0x30')][_0x8471('0x38')]);_0x3c857b['where']=qs[_0x8471('0x32')](_[_0x8471('0x3a')](_0x520f9c[_0x8471('0x30')],_0xcc5cc7[_0x8471('0x32')]));if(_0x520f9c[_0x8471('0x30')]['filter']){_0x3c857b['where']=_['merge'](_0x3c857b[_0x8471('0x39')],{'$or':_['map'](_0x3c857b[_0x8471('0x34')],function(_0x4f1c8d){var _0x4dfa46={};_0x4dfa46[_0x4f1c8d]={'$like':'%'+_0x520f9c[_0x8471('0x30')][_0x8471('0x3b')]+'%'};return _0x4dfa46;})});}_0x3c857b=_[_0x8471('0x3c')]({},_0x3c857b,_0x520f9c[_0x8471('0x3d')]);return _0x43168f[_0x8471('0x4d')](_0x3c857b);}})['then'](function(_0x472341){if(_0x472341){_0x32f24b=_0x472341[_0x8471('0x36')];if(!_0x520f9c[_0x8471('0x30')][_0x8471('0x4c')](_0x8471('0x37'))){_0x3c857b[_0x8471('0x1d')]=qs[_0x8471('0x1d')](_0x520f9c[_0x8471('0x30')][_0x8471('0x1d')]);_0x3c857b['offset']=qs[_0x8471('0x1c')](_0x520f9c[_0x8471('0x30')][_0x8471('0x1c')]);}return _0x43168f[_0x8471('0x4d')](_0x3c857b);}})[_0x8471('0x25')](function(_0x215345){if(_0x215345){return _0x215345?{'count':_0x32f24b,'rows':_0x215345}:null;}})[_0x8471('0x25')](respondWithResult(_0x82e368,null))[_0x8471('0x41')](handleError(_0x82e368,null));};exports[_0x8471('0x4f')]=function(_0x3b46ca,_0x528239,_0x4913a9){var _0x48f164={};var _0x296123={};var _0x195823;var _0x289a1b;return db[_0x8471('0x2c')][_0x8471('0x4a')]({'where':{'id':_0x3b46ca[_0x8471('0x43')]['id']}})[_0x8471('0x25')](handleEntityNotFound(_0x528239,null))[_0x8471('0x25')](function(_0x35abac){if(_0x35abac){_0x195823=_0x35abac;_0x296123[_0x8471('0x2f')]=_[_0x8471('0x31')](db['VtigerField']['rawAttributes']);_0x296123[_0x8471('0x30')]=_[_0x8471('0x31')](_0x3b46ca[_0x8471('0x30')]);_0x296123[_0x8471('0x32')]=_['intersection'](_0x296123['model'],_0x296123[_0x8471('0x30')]);_0x48f164[_0x8471('0x34')]=_['intersection'](_0x296123[_0x8471('0x2f')],qs[_0x8471('0x35')](_0x3b46ca[_0x8471('0x30')][_0x8471('0x35')]));_0x48f164[_0x8471('0x34')]=_0x48f164[_0x8471('0x34')][_0x8471('0x36')]?_0x48f164[_0x8471('0x34')]:_0x296123[_0x8471('0x2f')];_0x48f164[_0x8471('0x4b')]=qs[_0x8471('0x38')](_0x3b46ca['query'][_0x8471('0x38')]);_0x48f164[_0x8471('0x39')]=qs['filters'](_[_0x8471('0x3a')](_0x3b46ca[_0x8471('0x30')],_0x296123['filters']));if(_0x3b46ca['query'][_0x8471('0x3b')]){_0x48f164[_0x8471('0x39')]=_[_0x8471('0x3c')](_0x48f164[_0x8471('0x39')],{'$or':_[_0x8471('0x2b')](_0x48f164[_0x8471('0x34')],function(_0x595bef){var _0x5c4903={};_0x5c4903[_0x595bef]={'$like':'%'+_0x3b46ca['query'][_0x8471('0x3b')]+'%'};return _0x5c4903;})});}_0x48f164=_[_0x8471('0x3c')]({},_0x48f164,_0x3b46ca['options']);return _0x195823[_0x8471('0x4f')](_0x48f164);}})[_0x8471('0x25')](function(_0x5960c8){if(_0x5960c8){_0x289a1b=_0x5960c8[_0x8471('0x36')];if(!_0x3b46ca['query'][_0x8471('0x4c')]('nolimit')){_0x48f164[_0x8471('0x1d')]=qs['limit'](_0x3b46ca[_0x8471('0x30')][_0x8471('0x1d')]);_0x48f164[_0x8471('0x1c')]=qs[_0x8471('0x1c')](_0x3b46ca[_0x8471('0x30')][_0x8471('0x1c')]);}return _0x195823['getDescriptions'](_0x48f164);}})[_0x8471('0x25')](function(_0x4e2eb7){if(_0x4e2eb7){return _0x4e2eb7?{'count':_0x289a1b,'rows':_0x4e2eb7}:null;}})[_0x8471('0x25')](respondWithResult(_0x528239,null))[_0x8471('0x41')](handleError(_0x528239,null));}; \ No newline at end of file +var _0xe2d4=['jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','VtigerConfiguration','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','keys','includeAll','find','create','body','params','getFields','rawAttributes','length','order','options','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','fs-extra','lodash','crypto'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe2d4,0xd9));var _0x4e2d=function(_0x3e444f,_0x264303){_0x3e444f=_0x3e444f-0x0;var _0xa6b325=_0xe2d4[_0x3e444f];return _0xa6b325;};'use strict';var emlformat=require(_0x4e2d('0x0'));var rimraf=require(_0x4e2d('0x1'));var zipdir=require(_0x4e2d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e2d('0x3'));var moment=require(_0x4e2d('0x4'));var BPromise=require(_0x4e2d('0x5'));var Mustache=require('mustache');var util=require(_0x4e2d('0x6'));var path=require('path');var sox=require(_0x4e2d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e2d('0x8'));var _=require(_0x4e2d('0x9'));var squel=require('squel');var crypto=require(_0x4e2d('0xa'));var jsforce=require(_0x4e2d('0xb'));var deskjs=require(_0x4e2d('0xc'));var toCsv=require(_0x4e2d('0xd'));var querystring=require(_0x4e2d('0xe'));var Papa=require(_0x4e2d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e2d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e2d('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x4e2d('0x12'));var config=require(_0x4e2d('0x13'));var licenseUtil=require(_0x4e2d('0x14'));var db=require(_0x4e2d('0x15'))['db'];function respondWithStatusCode(_0x392b0d,_0x10da00){_0x10da00=_0x10da00||0xcc;return function(_0x465efb){if(_0x465efb){return _0x392b0d[_0x4e2d('0x16')](_0x10da00);}return _0x392b0d[_0x4e2d('0x17')](_0x10da00)[_0x4e2d('0x18')]();};}function respondWithResult(_0x29563c,_0x3d84d6){_0x3d84d6=_0x3d84d6||0xc8;return function(_0x2a5e0e){if(_0x2a5e0e){return _0x29563c['status'](_0x3d84d6)[_0x4e2d('0x19')](_0x2a5e0e);}};}function respondWithFilteredResult(_0x2e21c1,_0xcf4929){return function(_0x2db016){if(_0x2db016){var _0x5e4815=typeof _0xcf4929[_0x4e2d('0x1a')]===_0x4e2d('0x1b')&&typeof _0xcf4929[_0x4e2d('0x1c')]===_0x4e2d('0x1b');var _0x163211=_0x2db016[_0x4e2d('0x1d')];var _0x3a3bab=_0x5e4815?0x0:_0xcf4929['offset'];var _0x25fffb=_0x5e4815?_0x2db016[_0x4e2d('0x1d')]:_0xcf4929[_0x4e2d('0x1a')]+_0xcf4929[_0x4e2d('0x1c')];var _0x39a35b;if(_0x25fffb>=_0x163211){_0x25fffb=_0x163211;_0x39a35b=0xc8;}else{_0x39a35b=0xce;}_0x2e21c1['status'](_0x39a35b);return _0x2e21c1['set'](_0x4e2d('0x1e'),_0x3a3bab+'-'+_0x25fffb+'/'+_0x163211)[_0x4e2d('0x19')](_0x2db016);}return null;};}function patchUpdates(_0x1a0169){return function(_0x2f0d3f){try{jsonpatch[_0x4e2d('0x1f')](_0x2f0d3f,_0x1a0169,!![]);}catch(_0x507492){return BPromise[_0x4e2d('0x20')](_0x507492);}return _0x2f0d3f[_0x4e2d('0x21')]();};}function saveUpdates(_0x1d336b,_0x3e3978){return function(_0x586436){if(_0x586436){return _0x586436[_0x4e2d('0x22')](_0x1d336b)[_0x4e2d('0x23')](function(_0x252bf0){return _0x252bf0;});}return null;};}function removeEntity(_0x365105,_0x16d3a0){return function(_0x247327){if(_0x247327){return _0x247327[_0x4e2d('0x24')]()[_0x4e2d('0x23')](function(){_0x365105['status'](0xcc)[_0x4e2d('0x18')]();});}};}function handleEntityNotFound(_0xf09ffc,_0x28385d){return function(_0x241af6){if(!_0x241af6){_0xf09ffc[_0x4e2d('0x16')](0x194);}return _0x241af6;};}function handleError(_0x27082,_0x3db470){_0x3db470=_0x3db470||0x1f4;return function(_0x450ff7){logger[_0x4e2d('0x25')](_0x450ff7[_0x4e2d('0x26')]);if(_0x450ff7['name']){delete _0x450ff7[_0x4e2d('0x27')];}_0x27082['status'](_0x3db470)['send'](_0x450ff7);};}exports['index']=function(_0x4d8328,_0x105998){var _0x522e2a={},_0x653f81={},_0x5702a1={'count':0x0,'rows':[]};var _0x151df6=_['map'](db[_0x4e2d('0x28')]['rawAttributes'],function(_0x17650d){return{'name':_0x17650d[_0x4e2d('0x29')],'type':_0x17650d[_0x4e2d('0x2a')]['key']};});_0x653f81[_0x4e2d('0x2b')]=_[_0x4e2d('0x2c')](_0x151df6,'name');_0x653f81[_0x4e2d('0x2d')]=_['keys'](_0x4d8328[_0x4e2d('0x2d')]);_0x653f81[_0x4e2d('0x2e')]=_[_0x4e2d('0x2f')](_0x653f81[_0x4e2d('0x2b')],_0x653f81[_0x4e2d('0x2d')]);_0x522e2a[_0x4e2d('0x30')]=_[_0x4e2d('0x2f')](_0x653f81[_0x4e2d('0x2b')],qs[_0x4e2d('0x31')](_0x4d8328['query']['fields']));_0x522e2a[_0x4e2d('0x30')]=_0x522e2a[_0x4e2d('0x30')]['length']?_0x522e2a[_0x4e2d('0x30')]:_0x653f81[_0x4e2d('0x2b')];if(!_0x4d8328[_0x4e2d('0x2d')][_0x4e2d('0x32')](_0x4e2d('0x33'))){_0x522e2a[_0x4e2d('0x1c')]=qs[_0x4e2d('0x1c')](_0x4d8328[_0x4e2d('0x2d')][_0x4e2d('0x1c')]);_0x522e2a[_0x4e2d('0x1a')]=qs[_0x4e2d('0x1a')](_0x4d8328[_0x4e2d('0x2d')]['offset']);}_0x522e2a['order']=qs[_0x4e2d('0x34')](_0x4d8328[_0x4e2d('0x2d')][_0x4e2d('0x34')]);_0x522e2a[_0x4e2d('0x35')]=qs['filters'](_[_0x4e2d('0x36')](_0x4d8328['query'],_0x653f81[_0x4e2d('0x2e')]),_0x151df6);if(_0x4d8328[_0x4e2d('0x2d')]['filter']){_0x522e2a['where']=_[_0x4e2d('0x37')](_0x522e2a[_0x4e2d('0x35')],{'$or':_[_0x4e2d('0x2c')](_0x151df6,function(_0x39cb43){if(_0x39cb43[_0x4e2d('0x2a')]!==_0x4e2d('0x38')){var _0x2b5e4a={};_0x2b5e4a[_0x39cb43[_0x4e2d('0x27')]]={'$like':'%'+_0x4d8328[_0x4e2d('0x2d')][_0x4e2d('0x39')]+'%'};return _0x2b5e4a;}})});}_0x522e2a=_[_0x4e2d('0x37')]({},_0x522e2a,_0x4d8328['options']);var _0x924d34={'where':_0x522e2a[_0x4e2d('0x35')]};return db[_0x4e2d('0x28')]['count'](_0x924d34)[_0x4e2d('0x23')](function(_0x1bdaca){_0x5702a1[_0x4e2d('0x1d')]=_0x1bdaca;if(_0x4d8328[_0x4e2d('0x2d')]['includeAll']){_0x522e2a[_0x4e2d('0x3a')]=[{'all':!![]}];}return db[_0x4e2d('0x28')][_0x4e2d('0x3b')](_0x522e2a);})['then'](function(_0x37e6a9){_0x5702a1[_0x4e2d('0x3c')]=_0x37e6a9;return _0x5702a1;})['then'](respondWithFilteredResult(_0x105998,_0x522e2a))[_0x4e2d('0x3d')](handleError(_0x105998,null));};exports['show']=function(_0x5d66ec,_0x4d2330){var _0x19c814={'raw':![],'where':{'id':_0x5d66ec['params']['id']}},_0x1dfee9={};_0x1dfee9['model']=_[_0x4e2d('0x3e')](db[_0x4e2d('0x28')]['rawAttributes']);_0x1dfee9[_0x4e2d('0x2d')]=_[_0x4e2d('0x3e')](_0x5d66ec[_0x4e2d('0x2d')]);_0x1dfee9[_0x4e2d('0x2e')]=_['intersection'](_0x1dfee9[_0x4e2d('0x2b')],_0x1dfee9['query']);_0x19c814[_0x4e2d('0x30')]=_[_0x4e2d('0x2f')](_0x1dfee9[_0x4e2d('0x2b')],qs[_0x4e2d('0x31')](_0x5d66ec[_0x4e2d('0x2d')]['fields']));_0x19c814[_0x4e2d('0x30')]=_0x19c814[_0x4e2d('0x30')]['length']?_0x19c814['attributes']:_0x1dfee9['model'];if(_0x5d66ec[_0x4e2d('0x2d')][_0x4e2d('0x3f')]){_0x19c814[_0x4e2d('0x3a')]=[{'all':!![]}];}_0x19c814=_[_0x4e2d('0x37')]({},_0x19c814,_0x5d66ec['options']);return db[_0x4e2d('0x28')][_0x4e2d('0x40')](_0x19c814)[_0x4e2d('0x23')](handleEntityNotFound(_0x4d2330,null))[_0x4e2d('0x23')](respondWithResult(_0x4d2330,null))[_0x4e2d('0x3d')](handleError(_0x4d2330,null));};exports[_0x4e2d('0x41')]=function(_0xe55c0e,_0x18864f){return db[_0x4e2d('0x28')][_0x4e2d('0x41')](_0xe55c0e['body'],{})[_0x4e2d('0x23')](respondWithResult(_0x18864f,0xc9))['catch'](handleError(_0x18864f,null));};exports[_0x4e2d('0x22')]=function(_0x2e0874,_0x1f87af){if(_0x2e0874[_0x4e2d('0x42')]['id']){delete _0x2e0874[_0x4e2d('0x42')]['id'];}return db[_0x4e2d('0x28')][_0x4e2d('0x40')]({'where':{'id':_0x2e0874[_0x4e2d('0x43')]['id']}})[_0x4e2d('0x23')](handleEntityNotFound(_0x1f87af,null))[_0x4e2d('0x23')](saveUpdates(_0x2e0874[_0x4e2d('0x42')],null))[_0x4e2d('0x23')](respondWithResult(_0x1f87af,null))['catch'](handleError(_0x1f87af,null));};exports[_0x4e2d('0x24')]=function(_0x310324,_0x7a3866){return db[_0x4e2d('0x28')]['find']({'where':{'id':_0x310324[_0x4e2d('0x43')]['id']}})[_0x4e2d('0x23')](handleEntityNotFound(_0x7a3866,null))[_0x4e2d('0x23')](removeEntity(_0x7a3866,null))['catch'](handleError(_0x7a3866,null));};exports[_0x4e2d('0x44')]=function(_0x236220,_0x51c76f,_0x2fe153){var _0x55432d={};var _0x3df470={};var _0xb73c14;var _0x5bf08f;return db[_0x4e2d('0x28')]['findOne']({'where':{'id':_0x236220[_0x4e2d('0x43')]['id']}})[_0x4e2d('0x23')](handleEntityNotFound(_0x51c76f,null))['then'](function(_0x43579c){if(_0x43579c){_0xb73c14=_0x43579c;_0x3df470[_0x4e2d('0x2b')]=_[_0x4e2d('0x3e')](db['VtigerField'][_0x4e2d('0x45')]);_0x3df470[_0x4e2d('0x2d')]=_[_0x4e2d('0x3e')](_0x236220[_0x4e2d('0x2d')]);_0x3df470[_0x4e2d('0x2e')]=_[_0x4e2d('0x2f')](_0x3df470[_0x4e2d('0x2b')],_0x3df470[_0x4e2d('0x2d')]);_0x55432d[_0x4e2d('0x30')]=_['intersection'](_0x3df470[_0x4e2d('0x2b')],qs[_0x4e2d('0x31')](_0x236220[_0x4e2d('0x2d')]['fields']));_0x55432d[_0x4e2d('0x30')]=_0x55432d[_0x4e2d('0x30')][_0x4e2d('0x46')]?_0x55432d[_0x4e2d('0x30')]:_0x3df470[_0x4e2d('0x2b')];_0x55432d[_0x4e2d('0x47')]=qs[_0x4e2d('0x34')](_0x236220['query'][_0x4e2d('0x34')]);_0x55432d[_0x4e2d('0x35')]=qs[_0x4e2d('0x2e')](_[_0x4e2d('0x36')](_0x236220['query'],_0x3df470['filters']));if(_0x236220['query'][_0x4e2d('0x39')]){_0x55432d[_0x4e2d('0x35')]=_[_0x4e2d('0x37')](_0x55432d[_0x4e2d('0x35')],{'$or':_[_0x4e2d('0x2c')](_0x55432d[_0x4e2d('0x30')],function(_0x220c7d){var _0x425179={};_0x425179[_0x220c7d]={'$like':'%'+_0x236220[_0x4e2d('0x2d')][_0x4e2d('0x39')]+'%'};return _0x425179;})});}_0x55432d=_[_0x4e2d('0x37')]({},_0x55432d,_0x236220[_0x4e2d('0x48')]);return _0xb73c14[_0x4e2d('0x44')](_0x55432d);}})[_0x4e2d('0x23')](function(_0x3bb804){if(_0x3bb804){_0x5bf08f=_0x3bb804['length'];if(!_0x236220[_0x4e2d('0x2d')]['hasOwnProperty'](_0x4e2d('0x33'))){_0x55432d[_0x4e2d('0x1c')]=qs[_0x4e2d('0x1c')](_0x236220[_0x4e2d('0x2d')]['limit']);_0x55432d['offset']=qs[_0x4e2d('0x1a')](_0x236220[_0x4e2d('0x2d')][_0x4e2d('0x1a')]);}return _0xb73c14[_0x4e2d('0x44')](_0x55432d);}})['then'](function(_0x3dfdff){if(_0x3dfdff){return _0x3dfdff?{'count':_0x5bf08f,'rows':_0x3dfdff}:null;}})['then'](respondWithResult(_0x51c76f,null))[_0x4e2d('0x3d')](handleError(_0x51c76f,null));};exports[_0x4e2d('0x49')]=function(_0x3808e1,_0x23cf95,_0x3fc067){var _0x256610={};var _0x172bf3={};var _0x435c96;var _0x30dad4;return db[_0x4e2d('0x28')]['findOne']({'where':{'id':_0x3808e1[_0x4e2d('0x43')]['id']}})[_0x4e2d('0x23')](handleEntityNotFound(_0x23cf95,null))[_0x4e2d('0x23')](function(_0x8ed67f){if(_0x8ed67f){_0x435c96=_0x8ed67f;_0x172bf3[_0x4e2d('0x2b')]=_[_0x4e2d('0x3e')](db[_0x4e2d('0x4a')][_0x4e2d('0x45')]);_0x172bf3[_0x4e2d('0x2d')]=_[_0x4e2d('0x3e')](_0x3808e1[_0x4e2d('0x2d')]);_0x172bf3['filters']=_[_0x4e2d('0x2f')](_0x172bf3[_0x4e2d('0x2b')],_0x172bf3[_0x4e2d('0x2d')]);_0x256610[_0x4e2d('0x30')]=_[_0x4e2d('0x2f')](_0x172bf3['model'],qs[_0x4e2d('0x31')](_0x3808e1[_0x4e2d('0x2d')][_0x4e2d('0x31')]));_0x256610['attributes']=_0x256610[_0x4e2d('0x30')][_0x4e2d('0x46')]?_0x256610[_0x4e2d('0x30')]:_0x172bf3[_0x4e2d('0x2b')];_0x256610[_0x4e2d('0x47')]=qs['sort'](_0x3808e1['query'][_0x4e2d('0x34')]);_0x256610[_0x4e2d('0x35')]=qs['filters'](_[_0x4e2d('0x36')](_0x3808e1[_0x4e2d('0x2d')],_0x172bf3[_0x4e2d('0x2e')]));if(_0x3808e1['query'][_0x4e2d('0x39')]){_0x256610[_0x4e2d('0x35')]=_[_0x4e2d('0x37')](_0x256610[_0x4e2d('0x35')],{'$or':_[_0x4e2d('0x2c')](_0x256610[_0x4e2d('0x30')],function(_0x1338e2){var _0xdce3f2={};_0xdce3f2[_0x1338e2]={'$like':'%'+_0x3808e1['query'][_0x4e2d('0x39')]+'%'};return _0xdce3f2;})});}_0x256610=_[_0x4e2d('0x37')]({},_0x256610,_0x3808e1[_0x4e2d('0x48')]);return _0x435c96['getSubjects'](_0x256610);}})[_0x4e2d('0x23')](function(_0x351acc){if(_0x351acc){_0x30dad4=_0x351acc[_0x4e2d('0x46')];if(!_0x3808e1[_0x4e2d('0x2d')][_0x4e2d('0x32')]('nolimit')){_0x256610[_0x4e2d('0x1c')]=qs[_0x4e2d('0x1c')](_0x3808e1[_0x4e2d('0x2d')][_0x4e2d('0x1c')]);_0x256610[_0x4e2d('0x1a')]=qs['offset'](_0x3808e1[_0x4e2d('0x2d')]['offset']);}return _0x435c96[_0x4e2d('0x49')](_0x256610);}})[_0x4e2d('0x23')](function(_0x4264af){if(_0x4264af){return _0x4264af?{'count':_0x30dad4,'rows':_0x4264af}:null;}})[_0x4e2d('0x23')](respondWithResult(_0x23cf95,null))['catch'](handleError(_0x23cf95,null));};exports[_0x4e2d('0x4b')]=function(_0x4e3f8b,_0x2a8072,_0x26dc41){var _0x19b6d4={};var _0x517a38={};var _0x912443;var _0x53de7b;return db[_0x4e2d('0x28')]['findOne']({'where':{'id':_0x4e3f8b[_0x4e2d('0x43')]['id']}})['then'](handleEntityNotFound(_0x2a8072,null))[_0x4e2d('0x23')](function(_0x18492c){if(_0x18492c){_0x912443=_0x18492c;_0x517a38[_0x4e2d('0x2b')]=_['keys'](db[_0x4e2d('0x4a')][_0x4e2d('0x45')]);_0x517a38[_0x4e2d('0x2d')]=_[_0x4e2d('0x3e')](_0x4e3f8b['query']);_0x517a38[_0x4e2d('0x2e')]=_[_0x4e2d('0x2f')](_0x517a38[_0x4e2d('0x2b')],_0x517a38[_0x4e2d('0x2d')]);_0x19b6d4[_0x4e2d('0x30')]=_[_0x4e2d('0x2f')](_0x517a38[_0x4e2d('0x2b')],qs[_0x4e2d('0x31')](_0x4e3f8b[_0x4e2d('0x2d')][_0x4e2d('0x31')]));_0x19b6d4[_0x4e2d('0x30')]=_0x19b6d4[_0x4e2d('0x30')][_0x4e2d('0x46')]?_0x19b6d4[_0x4e2d('0x30')]:_0x517a38['model'];_0x19b6d4[_0x4e2d('0x47')]=qs[_0x4e2d('0x34')](_0x4e3f8b[_0x4e2d('0x2d')][_0x4e2d('0x34')]);_0x19b6d4[_0x4e2d('0x35')]=qs['filters'](_[_0x4e2d('0x36')](_0x4e3f8b[_0x4e2d('0x2d')],_0x517a38[_0x4e2d('0x2e')]));if(_0x4e3f8b['query'][_0x4e2d('0x39')]){_0x19b6d4['where']=_['merge'](_0x19b6d4[_0x4e2d('0x35')],{'$or':_[_0x4e2d('0x2c')](_0x19b6d4[_0x4e2d('0x30')],function(_0x47b9c5){var _0x421219={};_0x421219[_0x47b9c5]={'$like':'%'+_0x4e3f8b[_0x4e2d('0x2d')]['filter']+'%'};return _0x421219;})});}_0x19b6d4=_[_0x4e2d('0x37')]({},_0x19b6d4,_0x4e3f8b[_0x4e2d('0x48')]);return _0x912443[_0x4e2d('0x4b')](_0x19b6d4);}})[_0x4e2d('0x23')](function(_0x2acfbb){if(_0x2acfbb){_0x53de7b=_0x2acfbb[_0x4e2d('0x46')];if(!_0x4e3f8b['query'][_0x4e2d('0x32')](_0x4e2d('0x33'))){_0x19b6d4[_0x4e2d('0x1c')]=qs[_0x4e2d('0x1c')](_0x4e3f8b[_0x4e2d('0x2d')][_0x4e2d('0x1c')]);_0x19b6d4[_0x4e2d('0x1a')]=qs['offset'](_0x4e3f8b[_0x4e2d('0x2d')][_0x4e2d('0x1a')]);}return _0x912443[_0x4e2d('0x4b')](_0x19b6d4);}})['then'](function(_0x56bc46){if(_0x56bc46){return _0x56bc46?{'count':_0x53de7b,'rows':_0x56bc46}:null;}})[_0x4e2d('0x23')](respondWithResult(_0x2a8072,null))[_0x4e2d('0x3d')](handleError(_0x2a8072,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 6c77e6c..8b646cd 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 _0xa7c8=['request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','util','../../config/logger','api','moment','bluebird'];(function(_0x3e861a,_0x34868f){var _0x4bc3fc=function(_0x1e9c6c){while(--_0x1e9c6c){_0x3e861a['push'](_0x3e861a['shift']());}};_0x4bc3fc(++_0x34868f);}(_0xa7c8,0x13f));var _0x8a7c=function(_0x2bab4e,_0xd6d087){_0x2bab4e=_0x2bab4e-0x0;var _0x30f709=_0xa7c8[_0x2bab4e];return _0x30f709;};'use strict';var _=require('lodash');var util=require(_0x8a7c('0x0'));var logger=require(_0x8a7c('0x1'))(_0x8a7c('0x2'));var moment=require(_0x8a7c('0x3'));var BPromise=require(_0x8a7c('0x4'));var rp=require(_0x8a7c('0x5'));var fs=require('fs');var path=require(_0x8a7c('0x6'));var rimraf=require('rimraf');var config=require(_0x8a7c('0x7'));var attributes=require(_0x8a7c('0x8'));module['exports']=function(_0xbcc514,_0xf05edc){return _0xbcc514['define']('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bb0=['../../config/logger','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x7bb0,0x1d5));var _0x07bb=function(_0x356504,_0x3d8d8e){_0x356504=_0x356504-0x0;var _0xd6992f=_0x7bb0[_0x356504];return _0xd6992f;};'use strict';var _=require(_0x07bb('0x0'));var util=require('util');var logger=require(_0x07bb('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x07bb('0x2'));var fs=require('fs');var path=require(_0x07bb('0x3'));var rimraf=require(_0x07bb('0x4'));var config=require(_0x07bb('0x5'));var attributes=require(_0x07bb('0x6'));module[_0x07bb('0x7')]=function(_0xa82ce2,_0x36309f){return _0xa82ce2[_0x07bb('0x8')](_0x07bb('0x9'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 1c278f1..8de7554 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 _0xdb33=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1e9254,_0x262668){var _0xcfca7d=function(_0x56b929){while(--_0x56b929){_0x1e9254['push'](_0x1e9254['shift']());}};_0xcfca7d(++_0x262668);}(_0xdb33,0x18c));var _0x3db3=function(_0x3816c2,_0xb221e1){_0x3816c2=_0x3816c2-0x0;var _0x144669=_0xdb33[_0x3816c2];return _0x144669;};'use strict';var _=require(_0x3db3('0x0'));var util=require(_0x3db3('0x1'));var moment=require(_0x3db3('0x2'));var BPromise=require(_0x3db3('0x3'));var rs=require(_0x3db3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3db3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3db3('0x6'))(_0x3db3('0x7'));var config=require(_0x3db3('0x8'));var jayson=require(_0x3db3('0x9'));var client=jayson[_0x3db3('0xa')][_0x3db3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10108b,_0x52e866,_0x5263ee){return new BPromise(function(_0x217c97,_0x2b091f){return client[_0x3db3('0xc')](_0x10108b,_0x5263ee)[_0x3db3('0xd')](function(_0x24bdc8){logger[_0x3db3('0xe')](_0x3db3('0xf'),_0x52e866,_0x3db3('0x10'));logger[_0x3db3('0x11')](_0x3db3('0x12'),_0x52e866,'request\x20sent',JSON[_0x3db3('0x13')](_0x24bdc8));if(_0x24bdc8['error']){if(_0x24bdc8[_0x3db3('0x14')][_0x3db3('0x15')]===0x1f4){logger[_0x3db3('0x14')](_0x3db3('0xf'),_0x52e866,_0x24bdc8['error']['message']);return _0x2b091f(_0x24bdc8[_0x3db3('0x14')]['message']);}logger['error'](_0x3db3('0xf'),_0x52e866,_0x24bdc8[_0x3db3('0x14')][_0x3db3('0x16')]);return _0x217c97(_0x24bdc8[_0x3db3('0x14')][_0x3db3('0x16')]);}else{logger[_0x3db3('0xe')](_0x3db3('0xf'),_0x52e866,_0x3db3('0x10'));_0x217c97(_0x24bdc8[_0x3db3('0x17')][_0x3db3('0x16')]);}})[_0x3db3('0x18')](function(_0x469a04){logger['error'](_0x3db3('0xf'),_0x52e866,_0x469a04);_0x2b091f(_0x469a04);});});} \ No newline at end of file +var _0xc9e6=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x556add,_0x4b0cba){var _0x1490a4=function(_0x3b0c0d){while(--_0x3b0c0d){_0x556add['push'](_0x556add['shift']());}};_0x1490a4(++_0x4b0cba);}(_0xc9e6,0x95));var _0x6c9e=function(_0x474bce,_0x1e5425){_0x474bce=_0x474bce-0x0;var _0x56eb15=_0xc9e6[_0x474bce];return _0x56eb15;};'use strict';var _=require(_0x6c9e('0x0'));var util=require('util');var moment=require(_0x6c9e('0x1'));var BPromise=require(_0x6c9e('0x2'));var rs=require(_0x6c9e('0x3'));var fs=require('fs');var Redis=require(_0x6c9e('0x4'));var db=require(_0x6c9e('0x5'))['db'];var utils=require(_0x6c9e('0x6'));var logger=require(_0x6c9e('0x7'))(_0x6c9e('0x8'));var config=require(_0x6c9e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6c9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fc4f7,_0x5a3f99,_0xb3fa79){return new BPromise(function(_0x371095,_0x37031c){return client[_0x6c9e('0xb')](_0x1fc4f7,_0xb3fa79)['then'](function(_0x55d023){logger['info'](_0x6c9e('0xc'),_0x5a3f99,_0x6c9e('0xd'));logger[_0x6c9e('0xe')](_0x6c9e('0xf'),_0x5a3f99,'request\x20sent',JSON[_0x6c9e('0x10')](_0x55d023));if(_0x55d023['error']){if(_0x55d023[_0x6c9e('0x11')][_0x6c9e('0x12')]===0x1f4){logger[_0x6c9e('0x11')](_0x6c9e('0xc'),_0x5a3f99,_0x55d023['error'][_0x6c9e('0x13')]);return _0x37031c(_0x55d023['error'][_0x6c9e('0x13')]);}logger[_0x6c9e('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x5a3f99,_0x55d023['error'][_0x6c9e('0x13')]);return _0x371095(_0x55d023['error'][_0x6c9e('0x13')]);}else{logger[_0x6c9e('0x14')](_0x6c9e('0xc'),_0x5a3f99,'request\x20sent');_0x371095(_0x55d023[_0x6c9e('0x15')][_0x6c9e('0x13')]);}})[_0x6c9e('0x16')](function(_0x48ab8e){logger[_0x6c9e('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x5a3f99,_0x48ab8e);_0x37031c(_0x48ab8e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 52a55e5..c305bbe 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 _0x4a3a=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intVtigerField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update'];(function(_0xf6a12,_0x58264d){var _0x24d263=function(_0x194046){while(--_0x194046){_0xf6a12['push'](_0xf6a12['shift']());}};_0x24d263(++_0x58264d);}(_0x4a3a,0xb7));var _0xa4a3=function(_0xc92e7b,_0x3e6956){_0xc92e7b=_0xc92e7b-0x0;var _0x4273e0=_0x4a3a[_0xc92e7b];return _0x4273e0;};'use strict';var multer=require(_0xa4a3('0x0'));var util=require(_0xa4a3('0x1'));var path=require(_0xa4a3('0x2'));var timeout=require(_0xa4a3('0x3'));var express=require(_0xa4a3('0x4'));var router=express['Router']();var fs_extra=require(_0xa4a3('0x5'));var auth=require(_0xa4a3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa4a3('0x7'));router[_0xa4a3('0x8')]('/',auth['isAuthenticated'](),controller[_0xa4a3('0x9')]);router[_0xa4a3('0x8')](_0xa4a3('0xa'),auth[_0xa4a3('0xb')](),controller[_0xa4a3('0xc')]);router[_0xa4a3('0xd')]('/',auth[_0xa4a3('0xb')](),controller[_0xa4a3('0xe')]);router[_0xa4a3('0xf')]('/:id',auth[_0xa4a3('0xb')](),controller[_0xa4a3('0x10')]);router[_0xa4a3('0x11')](_0xa4a3('0xa'),auth['isAuthenticated'](),controller[_0xa4a3('0x12')]);module[_0xa4a3('0x13')]=router; \ No newline at end of file +var _0xf036=['express','Router','fs-extra','../../components/auth/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path'];(function(_0x5271d3,_0xa34c8d){var _0x4f49a5=function(_0x476c17){while(--_0x476c17){_0x5271d3['push'](_0x5271d3['shift']());}};_0x4f49a5(++_0xa34c8d);}(_0xf036,0x12d));var _0x6f03=function(_0x1bebab,_0x23592d){_0x1bebab=_0x1bebab-0x0;var _0x410361=_0xf036[_0x1bebab];return _0x410361;};'use strict';var multer=require(_0x6f03('0x0'));var util=require(_0x6f03('0x1'));var path=require(_0x6f03('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f03('0x3'));var router=express[_0x6f03('0x4')]();var fs_extra=require(_0x6f03('0x5'));var auth=require(_0x6f03('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f03('0x7'));router[_0x6f03('0x8')]('/',auth[_0x6f03('0x9')](),controller[_0x6f03('0xa')]);router[_0x6f03('0x8')](_0x6f03('0xb'),auth['isAuthenticated'](),controller[_0x6f03('0xc')]);router[_0x6f03('0xd')]('/',auth[_0x6f03('0x9')](),controller[_0x6f03('0xe')]);router[_0x6f03('0xf')](_0x6f03('0xb'),auth[_0x6f03('0x9')](),controller[_0x6f03('0x10')]);router[_0x6f03('0x11')](_0x6f03('0xb'),auth[_0x6f03('0x9')](),controller['destroy']);module[_0x6f03('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 6ed383d..53cf1b3 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 _0x6a23=['ENUM','string','variable','picklist','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x1b944d,_0x14ac0f){var _0x1caddc=function(_0x3290b3){while(--_0x3290b3){_0x1b944d['push'](_0x1b944d['shift']());}};_0x1caddc(++_0x14ac0f);}(_0x6a23,0x8e));var _0x36a2=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0x6a23[_0x4e4519];return _0x340044;};'use strict';var Sequelize=require(_0x36a2('0x0'));module[_0x36a2('0x1')]={'type':{'type':Sequelize[_0x36a2('0x2')](_0x36a2('0x3'),_0x36a2('0x4'),'customVariable','keyValue',_0x36a2('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x36a2('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x36a2('0x2')](_0x36a2('0x3'),_0x36a2('0x4'),_0x36a2('0x7'))},'keyContent':{'type':Sequelize[_0x36a2('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x36a2('0x6')]},'customField':{'type':Sequelize[_0x36a2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x36a2('0x6')]}}; \ No newline at end of file +var _0x1b03=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x5b071b,_0x21cbd6){var _0x58c3a5=function(_0x106b34){while(--_0x106b34){_0x5b071b['push'](_0x5b071b['shift']());}};_0x58c3a5(++_0x21cbd6);}(_0x1b03,0x1ea));var _0x31b0=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x1b03[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x31b0('0x0'));module[_0x31b0('0x1')]={'type':{'type':Sequelize[_0x31b0('0x2')](_0x31b0('0x3'),_0x31b0('0x4'),_0x31b0('0x5'),_0x31b0('0x6'),_0x31b0('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x31b0('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x31b0('0x2')]('string','variable',_0x31b0('0x5'))},'keyContent':{'type':Sequelize[_0x31b0('0x8')]},'idField':{'type':Sequelize[_0x31b0('0x8')]},'nameField':{'type':Sequelize[_0x31b0('0x8')]},'customField':{'type':Sequelize[_0x31b0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x31b0('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f657818..22f1a00 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 _0x0ea2=['rows','show','params','options','find','catch','create','body','update','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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/license/util','../../mysqldb','status','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','includeAll','include','findAll'];(function(_0x2fd515,_0x3ab670){var _0x370cca=function(_0x319d59){while(--_0x319d59){_0x2fd515['push'](_0x2fd515['shift']());}};_0x370cca(++_0x3ab670);}(_0x0ea2,0x18b));var _0x20ea=function(_0x2978e1,_0x26b3f5){_0x2978e1=_0x2978e1-0x0;var _0xca0ea8=_0x0ea2[_0x2978e1];return _0xca0ea8;};'use strict';var emlformat=require(_0x20ea('0x0'));var rimraf=require(_0x20ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20ea('0x2'));var rp=require(_0x20ea('0x3'));var moment=require(_0x20ea('0x4'));var BPromise=require(_0x20ea('0x5'));var Mustache=require(_0x20ea('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x20ea('0x7'));var ejs=require(_0x20ea('0x8'));var fs=require('fs');var fs_extra=require(_0x20ea('0x9'));var _=require(_0x20ea('0xa'));var squel=require(_0x20ea('0xb'));var crypto=require(_0x20ea('0xc'));var jsforce=require(_0x20ea('0xd'));var deskjs=require(_0x20ea('0xe'));var toCsv=require(_0x20ea('0x7'));var querystring=require(_0x20ea('0xf'));var Papa=require(_0x20ea('0x10'));var Redis=require(_0x20ea('0x11'));var authService=require(_0x20ea('0x12'));var qs=require(_0x20ea('0x13'));var as=require(_0x20ea('0x14'));var hardwareService=require(_0x20ea('0x15'));var logger=require(_0x20ea('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x20ea('0x17'));var db=require(_0x20ea('0x18'))['db'];function respondWithStatusCode(_0x38446e,_0x5001e1){_0x5001e1=_0x5001e1||0xcc;return function(_0x497f33){if(_0x497f33){return _0x38446e['sendStatus'](_0x5001e1);}return _0x38446e[_0x20ea('0x19')](_0x5001e1)['end']();};}function respondWithResult(_0xca80ff,_0x1acab3){_0x1acab3=_0x1acab3||0xc8;return function(_0x3a573e){if(_0x3a573e){return _0xca80ff[_0x20ea('0x19')](_0x1acab3)['json'](_0x3a573e);}};}function respondWithFilteredResult(_0x431be1,_0xbb2801){return function(_0x133077){if(_0x133077){var _0x11d84b=typeof _0xbb2801['offset']===_0x20ea('0x1a')&&typeof _0xbb2801[_0x20ea('0x1b')]===_0x20ea('0x1a');var _0x2f84f6=_0x133077[_0x20ea('0x1c')];var _0x1f4daa=_0x11d84b?0x0:_0xbb2801['offset'];var _0x1579fc=_0x11d84b?_0x133077[_0x20ea('0x1c')]:_0xbb2801['offset']+_0xbb2801['limit'];var _0x2bf7a0;if(_0x1579fc>=_0x2f84f6){_0x1579fc=_0x2f84f6;_0x2bf7a0=0xc8;}else{_0x2bf7a0=0xce;}_0x431be1[_0x20ea('0x19')](_0x2bf7a0);return _0x431be1[_0x20ea('0x1d')](_0x20ea('0x1e'),_0x1f4daa+'-'+_0x1579fc+'/'+_0x2f84f6)[_0x20ea('0x1f')](_0x133077);}return null;};}function patchUpdates(_0x235e3b){return function(_0x10c06a){try{jsonpatch[_0x20ea('0x20')](_0x10c06a,_0x235e3b,!![]);}catch(_0x5f3ce7){return BPromise[_0x20ea('0x21')](_0x5f3ce7);}return _0x10c06a[_0x20ea('0x22')]();};}function saveUpdates(_0x2649cd,_0x39f15a){return function(_0x1fb68a){if(_0x1fb68a){return _0x1fb68a['update'](_0x2649cd)[_0x20ea('0x23')](function(_0x185c5a){return _0x185c5a;});}return null;};}function removeEntity(_0x54f049,_0x1761ec){return function(_0x1334b3){if(_0x1334b3){return _0x1334b3['destroy']()[_0x20ea('0x23')](function(){_0x54f049[_0x20ea('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20a97e,_0x1b93d3){return function(_0x52941a){if(!_0x52941a){_0x20a97e[_0x20ea('0x24')](0x194);}return _0x52941a;};}function handleError(_0x5e1728,_0x2e319c){_0x2e319c=_0x2e319c||0x1f4;return function(_0x1008a7){logger[_0x20ea('0x25')](_0x1008a7[_0x20ea('0x26')]);if(_0x1008a7['name']){delete _0x1008a7[_0x20ea('0x27')];}_0x5e1728[_0x20ea('0x19')](_0x2e319c)['send'](_0x1008a7);};}exports[_0x20ea('0x28')]=function(_0x2a7100,_0xcca3e5){var _0x9687f1={},_0x288d0d={},_0x51ad97={'count':0x0,'rows':[]};var _0x35feb8=_[_0x20ea('0x29')](db[_0x20ea('0x2a')][_0x20ea('0x2b')],function(_0x3bee3f){return{'name':_0x3bee3f[_0x20ea('0x2c')],'type':_0x3bee3f[_0x20ea('0x2d')][_0x20ea('0x2e')]};});_0x288d0d['model']=_[_0x20ea('0x29')](_0x35feb8,'name');_0x288d0d[_0x20ea('0x2f')]=_[_0x20ea('0x30')](_0x2a7100[_0x20ea('0x2f')]);_0x288d0d[_0x20ea('0x31')]=_[_0x20ea('0x32')](_0x288d0d[_0x20ea('0x33')],_0x288d0d[_0x20ea('0x2f')]);_0x9687f1[_0x20ea('0x34')]=_['intersection'](_0x288d0d[_0x20ea('0x33')],qs[_0x20ea('0x35')](_0x2a7100[_0x20ea('0x2f')][_0x20ea('0x35')]));_0x9687f1[_0x20ea('0x34')]=_0x9687f1[_0x20ea('0x34')][_0x20ea('0x36')]?_0x9687f1[_0x20ea('0x34')]:_0x288d0d['model'];if(!_0x2a7100[_0x20ea('0x2f')][_0x20ea('0x37')](_0x20ea('0x38'))){_0x9687f1[_0x20ea('0x1b')]=qs[_0x20ea('0x1b')](_0x2a7100[_0x20ea('0x2f')][_0x20ea('0x1b')]);_0x9687f1[_0x20ea('0x39')]=qs[_0x20ea('0x39')](_0x2a7100[_0x20ea('0x2f')][_0x20ea('0x39')]);}_0x9687f1[_0x20ea('0x3a')]=qs['sort'](_0x2a7100[_0x20ea('0x2f')][_0x20ea('0x3b')]);_0x9687f1[_0x20ea('0x3c')]=qs[_0x20ea('0x31')](_[_0x20ea('0x3d')](_0x2a7100[_0x20ea('0x2f')],_0x288d0d[_0x20ea('0x31')]),_0x35feb8);if(_0x2a7100['query']['filter']){_0x9687f1[_0x20ea('0x3c')]=_[_0x20ea('0x3e')](_0x9687f1[_0x20ea('0x3c')],{'$or':_[_0x20ea('0x29')](_0x35feb8,function(_0x470bab){if(_0x470bab[_0x20ea('0x2d')]!=='VIRTUAL'){var _0x1cbcd4={};_0x1cbcd4[_0x470bab[_0x20ea('0x27')]]={'$like':'%'+_0x2a7100[_0x20ea('0x2f')][_0x20ea('0x3f')]+'%'};return _0x1cbcd4;}})});}_0x9687f1=_[_0x20ea('0x3e')]({},_0x9687f1,_0x2a7100['options']);var _0x5e9814={'where':_0x9687f1[_0x20ea('0x3c')]};return db[_0x20ea('0x2a')][_0x20ea('0x1c')](_0x5e9814)['then'](function(_0x2327ce){_0x51ad97['count']=_0x2327ce;if(_0x2a7100[_0x20ea('0x2f')][_0x20ea('0x40')]){_0x9687f1[_0x20ea('0x41')]=[{'all':!![]}];}return db['VtigerField'][_0x20ea('0x42')](_0x9687f1);})[_0x20ea('0x23')](function(_0xd7214a){_0x51ad97[_0x20ea('0x43')]=_0xd7214a;return _0x51ad97;})[_0x20ea('0x23')](respondWithFilteredResult(_0xcca3e5,_0x9687f1))['catch'](handleError(_0xcca3e5,null));};exports[_0x20ea('0x44')]=function(_0xe64aaf,_0xf55439){var _0x533189={'raw':!![],'where':{'id':_0xe64aaf[_0x20ea('0x45')]['id']}},_0x1ed9a1={};_0x1ed9a1[_0x20ea('0x33')]=_['keys'](db[_0x20ea('0x2a')][_0x20ea('0x2b')]);_0x1ed9a1[_0x20ea('0x2f')]=_[_0x20ea('0x30')](_0xe64aaf[_0x20ea('0x2f')]);_0x1ed9a1['filters']=_[_0x20ea('0x32')](_0x1ed9a1[_0x20ea('0x33')],_0x1ed9a1[_0x20ea('0x2f')]);_0x533189[_0x20ea('0x34')]=_[_0x20ea('0x32')](_0x1ed9a1[_0x20ea('0x33')],qs[_0x20ea('0x35')](_0xe64aaf[_0x20ea('0x2f')][_0x20ea('0x35')]));_0x533189[_0x20ea('0x34')]=_0x533189[_0x20ea('0x34')]['length']?_0x533189[_0x20ea('0x34')]:_0x1ed9a1[_0x20ea('0x33')];if(_0xe64aaf[_0x20ea('0x2f')]['includeAll']){_0x533189['include']=[{'all':!![]}];}_0x533189=_[_0x20ea('0x3e')]({},_0x533189,_0xe64aaf[_0x20ea('0x46')]);return db['VtigerField'][_0x20ea('0x47')](_0x533189)[_0x20ea('0x23')](handleEntityNotFound(_0xf55439,null))[_0x20ea('0x23')](respondWithResult(_0xf55439,null))[_0x20ea('0x48')](handleError(_0xf55439,null));};exports[_0x20ea('0x49')]=function(_0x32c430,_0x305723){return db[_0x20ea('0x2a')]['create'](_0x32c430[_0x20ea('0x4a')],{})['then'](respondWithResult(_0x305723,0xc9))[_0x20ea('0x48')](handleError(_0x305723,null));};exports[_0x20ea('0x4b')]=function(_0x37dc8f,_0x32e663){if(_0x37dc8f[_0x20ea('0x4a')]['id']){delete _0x37dc8f[_0x20ea('0x4a')]['id'];}return db[_0x20ea('0x2a')]['find']({'where':{'id':_0x37dc8f['params']['id']}})['then'](handleEntityNotFound(_0x32e663,null))[_0x20ea('0x23')](saveUpdates(_0x37dc8f[_0x20ea('0x4a')],null))['then'](respondWithResult(_0x32e663,null))[_0x20ea('0x48')](handleError(_0x32e663,null));};exports[_0x20ea('0x4c')]=function(_0x48bd32,_0x3d3659){return db['VtigerField'][_0x20ea('0x47')]({'where':{'id':_0x48bd32[_0x20ea('0x45')]['id']}})[_0x20ea('0x23')](handleEntityNotFound(_0x3d3659,null))['then'](removeEntity(_0x3d3659,null))['catch'](handleError(_0x3d3659,null));}; \ No newline at end of file +var _0x2067=['json','apply','reject','save','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerField','include','findAll','catch','show','includeAll','find','create','body','params','destroy','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','offset','undefined','count','limit','set'];(function(_0x54bbfc,_0x26b002){var _0x1351cd=function(_0x4ea130){while(--_0x4ea130){_0x54bbfc['push'](_0x54bbfc['shift']());}};_0x1351cd(++_0x26b002);}(_0x2067,0xc4));var _0x7206=function(_0x3a491d,_0x263bad){_0x3a491d=_0x3a491d-0x0;var _0x46415d=_0x2067[_0x3a491d];return _0x46415d;};'use strict';var emlformat=require(_0x7206('0x0'));var rimraf=require(_0x7206('0x1'));var zipdir=require(_0x7206('0x2'));var jsonpatch=require(_0x7206('0x3'));var rp=require(_0x7206('0x4'));var moment=require(_0x7206('0x5'));var BPromise=require(_0x7206('0x6'));var Mustache=require(_0x7206('0x7'));var util=require(_0x7206('0x8'));var path=require(_0x7206('0x9'));var sox=require(_0x7206('0xa'));var csv=require(_0x7206('0xb'));var ejs=require(_0x7206('0xc'));var fs=require('fs');var fs_extra=require(_0x7206('0xd'));var _=require(_0x7206('0xe'));var squel=require('squel');var crypto=require(_0x7206('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7206('0x10'));var toCsv=require(_0x7206('0xb'));var querystring=require(_0x7206('0x11'));var Papa=require('papaparse');var Redis=require(_0x7206('0x12'));var authService=require(_0x7206('0x13'));var qs=require(_0x7206('0x14'));var as=require(_0x7206('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7206('0x16'))(_0x7206('0x17'));var utils=require(_0x7206('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7206('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4531da,_0x4f6d09){_0x4f6d09=_0x4f6d09||0xcc;return function(_0x17bde0){if(_0x17bde0){return _0x4531da['sendStatus'](_0x4f6d09);}return _0x4531da['status'](_0x4f6d09)['end']();};}function respondWithResult(_0x12f998,_0x455f2f){_0x455f2f=_0x455f2f||0xc8;return function(_0x2d93be){if(_0x2d93be){return _0x12f998[_0x7206('0x1a')](_0x455f2f)['json'](_0x2d93be);}};}function respondWithFilteredResult(_0x344035,_0x120d1f){return function(_0x25725e){if(_0x25725e){var _0x4c482e=typeof _0x120d1f[_0x7206('0x1b')]===_0x7206('0x1c')&&typeof _0x120d1f['limit']===_0x7206('0x1c');var _0x86af42=_0x25725e[_0x7206('0x1d')];var _0x38c43d=_0x4c482e?0x0:_0x120d1f[_0x7206('0x1b')];var _0x7d0634=_0x4c482e?_0x25725e[_0x7206('0x1d')]:_0x120d1f[_0x7206('0x1b')]+_0x120d1f[_0x7206('0x1e')];var _0x5bef55;if(_0x7d0634>=_0x86af42){_0x7d0634=_0x86af42;_0x5bef55=0xc8;}else{_0x5bef55=0xce;}_0x344035[_0x7206('0x1a')](_0x5bef55);return _0x344035[_0x7206('0x1f')]('Content-Range',_0x38c43d+'-'+_0x7d0634+'/'+_0x86af42)[_0x7206('0x20')](_0x25725e);}return null;};}function patchUpdates(_0x26f83a){return function(_0x92a921){try{jsonpatch[_0x7206('0x21')](_0x92a921,_0x26f83a,!![]);}catch(_0x2cd6a4){return BPromise[_0x7206('0x22')](_0x2cd6a4);}return _0x92a921[_0x7206('0x23')]();};}function saveUpdates(_0x359ec4,_0x4f5344){return function(_0x4077ce){if(_0x4077ce){return _0x4077ce['update'](_0x359ec4)[_0x7206('0x24')](function(_0x255d7f){return _0x255d7f;});}return null;};}function removeEntity(_0xc89097,_0x241ff8){return function(_0xc91f8d){if(_0xc91f8d){return _0xc91f8d['destroy']()['then'](function(){_0xc89097['status'](0xcc)[_0x7206('0x25')]();});}};}function handleEntityNotFound(_0x322956,_0x37a546){return function(_0x5f4fed){if(!_0x5f4fed){_0x322956[_0x7206('0x26')](0x194);}return _0x5f4fed;};}function handleError(_0x41f1b4,_0x1cfc3c){_0x1cfc3c=_0x1cfc3c||0x1f4;return function(_0x450fa3){logger[_0x7206('0x27')](_0x450fa3[_0x7206('0x28')]);if(_0x450fa3[_0x7206('0x29')]){delete _0x450fa3['name'];}_0x41f1b4[_0x7206('0x1a')](_0x1cfc3c)[_0x7206('0x2a')](_0x450fa3);};}exports[_0x7206('0x2b')]=function(_0x58988e,_0x5415aa){var _0x25f00b={},_0x3cfb2a={},_0x4471a4={'count':0x0,'rows':[]};var _0x6ef3cf=_[_0x7206('0x2c')](db['VtigerField'][_0x7206('0x2d')],function(_0x12d7c1){return{'name':_0x12d7c1[_0x7206('0x2e')],'type':_0x12d7c1[_0x7206('0x2f')]['key']};});_0x3cfb2a['model']=_[_0x7206('0x2c')](_0x6ef3cf,_0x7206('0x29'));_0x3cfb2a[_0x7206('0x30')]=_[_0x7206('0x31')](_0x58988e[_0x7206('0x30')]);_0x3cfb2a[_0x7206('0x32')]=_[_0x7206('0x33')](_0x3cfb2a[_0x7206('0x34')],_0x3cfb2a['query']);_0x25f00b['attributes']=_[_0x7206('0x33')](_0x3cfb2a[_0x7206('0x34')],qs[_0x7206('0x35')](_0x58988e[_0x7206('0x30')][_0x7206('0x35')]));_0x25f00b[_0x7206('0x36')]=_0x25f00b['attributes'][_0x7206('0x37')]?_0x25f00b[_0x7206('0x36')]:_0x3cfb2a[_0x7206('0x34')];if(!_0x58988e[_0x7206('0x30')][_0x7206('0x38')]('nolimit')){_0x25f00b['limit']=qs[_0x7206('0x1e')](_0x58988e[_0x7206('0x30')][_0x7206('0x1e')]);_0x25f00b[_0x7206('0x1b')]=qs[_0x7206('0x1b')](_0x58988e[_0x7206('0x30')][_0x7206('0x1b')]);}_0x25f00b[_0x7206('0x39')]=qs[_0x7206('0x3a')](_0x58988e[_0x7206('0x30')][_0x7206('0x3a')]);_0x25f00b[_0x7206('0x3b')]=qs[_0x7206('0x32')](_[_0x7206('0x3c')](_0x58988e[_0x7206('0x30')],_0x3cfb2a[_0x7206('0x32')]),_0x6ef3cf);if(_0x58988e[_0x7206('0x30')][_0x7206('0x3d')]){_0x25f00b[_0x7206('0x3b')]=_[_0x7206('0x3e')](_0x25f00b[_0x7206('0x3b')],{'$or':_[_0x7206('0x2c')](_0x6ef3cf,function(_0x1dade1){if(_0x1dade1[_0x7206('0x2f')]!==_0x7206('0x3f')){var _0x35a844={};_0x35a844[_0x1dade1['name']]={'$like':'%'+_0x58988e[_0x7206('0x30')][_0x7206('0x3d')]+'%'};return _0x35a844;}})});}_0x25f00b=_['merge']({},_0x25f00b,_0x58988e[_0x7206('0x40')]);var _0x352a0d={'where':_0x25f00b[_0x7206('0x3b')]};return db[_0x7206('0x41')][_0x7206('0x1d')](_0x352a0d)[_0x7206('0x24')](function(_0x1ba4e2){_0x4471a4[_0x7206('0x1d')]=_0x1ba4e2;if(_0x58988e[_0x7206('0x30')]['includeAll']){_0x25f00b[_0x7206('0x42')]=[{'all':!![]}];}return db['VtigerField'][_0x7206('0x43')](_0x25f00b);})[_0x7206('0x24')](function(_0x4656ab){_0x4471a4['rows']=_0x4656ab;return _0x4471a4;})[_0x7206('0x24')](respondWithFilteredResult(_0x5415aa,_0x25f00b))[_0x7206('0x44')](handleError(_0x5415aa,null));};exports[_0x7206('0x45')]=function(_0x5466d5,_0x1d4c5a){var _0x11a4db={'raw':!![],'where':{'id':_0x5466d5['params']['id']}},_0x110542={};_0x110542[_0x7206('0x34')]=_[_0x7206('0x31')](db[_0x7206('0x41')][_0x7206('0x2d')]);_0x110542[_0x7206('0x30')]=_[_0x7206('0x31')](_0x5466d5['query']);_0x110542[_0x7206('0x32')]=_[_0x7206('0x33')](_0x110542[_0x7206('0x34')],_0x110542[_0x7206('0x30')]);_0x11a4db[_0x7206('0x36')]=_[_0x7206('0x33')](_0x110542[_0x7206('0x34')],qs[_0x7206('0x35')](_0x5466d5[_0x7206('0x30')][_0x7206('0x35')]));_0x11a4db[_0x7206('0x36')]=_0x11a4db[_0x7206('0x36')][_0x7206('0x37')]?_0x11a4db[_0x7206('0x36')]:_0x110542['model'];if(_0x5466d5[_0x7206('0x30')][_0x7206('0x46')]){_0x11a4db[_0x7206('0x42')]=[{'all':!![]}];}_0x11a4db=_['merge']({},_0x11a4db,_0x5466d5['options']);return db[_0x7206('0x41')][_0x7206('0x47')](_0x11a4db)['then'](handleEntityNotFound(_0x1d4c5a,null))[_0x7206('0x24')](respondWithResult(_0x1d4c5a,null))[_0x7206('0x44')](handleError(_0x1d4c5a,null));};exports['create']=function(_0x460d19,_0x335788){return db[_0x7206('0x41')][_0x7206('0x48')](_0x460d19[_0x7206('0x49')],{})[_0x7206('0x24')](respondWithResult(_0x335788,0xc9))[_0x7206('0x44')](handleError(_0x335788,null));};exports['update']=function(_0xd4735f,_0x3b5b1b){if(_0xd4735f[_0x7206('0x49')]['id']){delete _0xd4735f[_0x7206('0x49')]['id'];}return db[_0x7206('0x41')][_0x7206('0x47')]({'where':{'id':_0xd4735f[_0x7206('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b5b1b,null))[_0x7206('0x24')](saveUpdates(_0xd4735f[_0x7206('0x49')],null))[_0x7206('0x24')](respondWithResult(_0x3b5b1b,null))[_0x7206('0x44')](handleError(_0x3b5b1b,null));};exports[_0x7206('0x4b')]=function(_0x8885e7,_0x4bf81f){return db[_0x7206('0x41')][_0x7206('0x47')]({'where':{'id':_0x8885e7[_0x7206('0x4a')]['id']}})[_0x7206('0x24')](handleEntityNotFound(_0x4bf81f,null))['then'](removeEntity(_0x4bf81f,null))[_0x7206('0x44')](handleError(_0x4bf81f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6abbc02..7e0470a 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 _0x83db=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','moment'];(function(_0x5c7643,_0x135b30){var _0x1e2513=function(_0xcc3a38){while(--_0xcc3a38){_0x5c7643['push'](_0x5c7643['shift']());}};_0x1e2513(++_0x135b30);}(_0x83db,0x143));var _0xb83d=function(_0x4cf5f5,_0x218a3f){_0x4cf5f5=_0x4cf5f5-0x0;var _0x2d36a7=_0x83db[_0x4cf5f5];return _0x2d36a7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb83d('0x0'));var BPromise=require(_0xb83d('0x1'));var rp=require(_0xb83d('0x2'));var fs=require('fs');var path=require(_0xb83d('0x3'));var rimraf=require(_0xb83d('0x4'));var config=require(_0xb83d('0x5'));var attributes=require(_0xb83d('0x6'));module['exports']=function(_0x751822,_0x3db760){return _0x751822[_0xb83d('0x7')](_0xb83d('0x8'),attributes,{'tableName':_0xb83d('0x9'),'paranoid':![],'indexes':[{'name':_0xb83d('0xa'),'fields':[_0xb83d('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb102=['define','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1d1278,_0x18b112){var _0x4c46ab=function(_0x2f83f9){while(--_0x2f83f9){_0x1d1278['push'](_0x1d1278['shift']());}};_0x4c46ab(++_0x18b112);}(_0xb102,0x16d));var _0x2b10=function(_0xdd1d3,_0x3f1c20){_0xdd1d3=_0xdd1d3-0x0;var _0x5ac121=_0xb102[_0xdd1d3];return _0x5ac121;};'use strict';var _=require(_0x2b10('0x0'));var util=require('util');var logger=require(_0x2b10('0x1'))(_0x2b10('0x2'));var moment=require(_0x2b10('0x3'));var BPromise=require(_0x2b10('0x4'));var rp=require(_0x2b10('0x5'));var fs=require('fs');var path=require(_0x2b10('0x6'));var rimraf=require(_0x2b10('0x7'));var config=require(_0x2b10('0x8'));var attributes=require('./intVtigerField.attributes');module[_0x2b10('0x9')]=function(_0x32e818,_0x438ba9){return _0x32e818[_0x2b10('0xa')]('VtigerField',attributes,{'tableName':_0x2b10('0xb'),'paranoid':![],'indexes':[{'name':_0x2b10('0xc'),'fields':[_0x2b10('0xd'),_0x2b10('0xe')],'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 56d23e0..4f12917 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 _0xfc52=['http','request','then','info','request\x20sent','debug','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x42e172,_0x252160){var _0x36f809=function(_0x2ac92a){while(--_0x2ac92a){_0x42e172['push'](_0x42e172['shift']());}};_0x36f809(++_0x252160);}(_0xfc52,0xc9));var _0x2fc5=function(_0x1780ec,_0x3af2fa){_0x1780ec=_0x1780ec-0x0;var _0x5c5663=_0xfc52[_0x1780ec];return _0x5c5663;};'use strict';var _=require(_0x2fc5('0x0'));var util=require(_0x2fc5('0x1'));var moment=require('moment');var BPromise=require(_0x2fc5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fc5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2fc5('0x4'));var logger=require(_0x2fc5('0x5'))('rpc');var config=require(_0x2fc5('0x6'));var jayson=require(_0x2fc5('0x7'));var client=jayson[_0x2fc5('0x8')][_0x2fc5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ed08e,_0x36efc5,_0x5d395c){return new BPromise(function(_0x4dfbfe,_0x25a42a){return client[_0x2fc5('0xa')](_0x1ed08e,_0x5d395c)[_0x2fc5('0xb')](function(_0x53afcf){logger[_0x2fc5('0xc')]('VtigerField,\x20%s,\x20%s',_0x36efc5,_0x2fc5('0xd'));logger[_0x2fc5('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x36efc5,_0x2fc5('0xd'),JSON[_0x2fc5('0xf')](_0x53afcf));if(_0x53afcf['error']){if(_0x53afcf[_0x2fc5('0x10')][_0x2fc5('0x11')]===0x1f4){logger['error'](_0x2fc5('0x12'),_0x36efc5,_0x53afcf['error'][_0x2fc5('0x13')]);return _0x25a42a(_0x53afcf['error']['message']);}logger[_0x2fc5('0x10')](_0x2fc5('0x12'),_0x36efc5,_0x53afcf[_0x2fc5('0x10')]['message']);return _0x4dfbfe(_0x53afcf[_0x2fc5('0x10')][_0x2fc5('0x13')]);}else{logger[_0x2fc5('0xc')](_0x2fc5('0x12'),_0x36efc5,_0x2fc5('0xd'));_0x4dfbfe(_0x53afcf[_0x2fc5('0x14')][_0x2fc5('0x13')]);}})['catch'](function(_0x45eca6){logger[_0x2fc5('0x10')](_0x2fc5('0x12'),_0x36efc5,_0x45eca6);_0x25a42a(_0x45eca6);});});} \ No newline at end of file +var _0x67d8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','randomstring'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0x67d8,0xed));var _0x867d=function(_0x1249a0,_0xd781d2){_0x1249a0=_0x1249a0-0x0;var _0x34e848=_0x67d8[_0x1249a0];return _0x34e848;};'use strict';var _=require(_0x867d('0x0'));var util=require(_0x867d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x867d('0x2'));var fs=require('fs');var Redis=require(_0x867d('0x3'));var db=require(_0x867d('0x4'))['db'];var utils=require(_0x867d('0x5'));var logger=require(_0x867d('0x6'))('rpc');var config=require(_0x867d('0x7'));var jayson=require(_0x867d('0x8'));var client=jayson[_0x867d('0x9')][_0x867d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x69286,_0x5a1e6c,_0x102003){return new BPromise(function(_0x511d82,_0x3e13c5){return client[_0x867d('0xb')](_0x69286,_0x102003)['then'](function(_0x14539a){logger[_0x867d('0xc')](_0x867d('0xd'),_0x5a1e6c,_0x867d('0xe'));logger[_0x867d('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x5a1e6c,_0x867d('0xe'),JSON['stringify'](_0x14539a));if(_0x14539a[_0x867d('0x10')]){if(_0x14539a[_0x867d('0x10')][_0x867d('0x11')]===0x1f4){logger[_0x867d('0x10')]('VtigerField,\x20%s,\x20%s',_0x5a1e6c,_0x14539a[_0x867d('0x10')][_0x867d('0x12')]);return _0x3e13c5(_0x14539a[_0x867d('0x10')][_0x867d('0x12')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x5a1e6c,_0x14539a[_0x867d('0x10')][_0x867d('0x12')]);return _0x511d82(_0x14539a[_0x867d('0x10')][_0x867d('0x12')]);}else{logger[_0x867d('0xc')]('VtigerField,\x20%s,\x20%s',_0x5a1e6c,'request\x20sent');_0x511d82(_0x14539a['result']['message']);}})[_0x867d('0x13')](function(_0x41067f){logger['error'](_0x867d('0xd'),_0x5a1e6c,_0x41067f);_0x3e13c5(_0x41067f);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index ffac5c1..808f8a0 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 _0x874d=['../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','getFields','post','create','/:id','update','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3f8f37,_0x5493b9){var _0x29bb50=function(_0x188b53){while(--_0x188b53){_0x3f8f37['push'](_0x3f8f37['shift']());}};_0x29bb50(++_0x5493b9);}(_0x874d,0x1e8));var _0xd874=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x874d[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xd874('0x0'));var path=require(_0xd874('0x1'));var timeout=require(_0xd874('0x2'));var express=require('express');var router=express[_0xd874('0x3')]();var fs_extra=require(_0xd874('0x4'));var auth=require(_0xd874('0x5'));var interaction=require(_0xd874('0x6'));var config=require('../../config/environment');var controller=require(_0xd874('0x7'));router[_0xd874('0x8')]('/',auth[_0xd874('0x9')](),controller[_0xd874('0xa')]);router[_0xd874('0x8')]('/:id',auth[_0xd874('0x9')](),controller[_0xd874('0xb')]);router[_0xd874('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xd874('0xc')]);router[_0xd874('0x8')]('/:id/fields',auth[_0xd874('0x9')](),controller[_0xd874('0xd')]);router[_0xd874('0xe')]('/',auth['isAuthenticated'](),controller[_0xd874('0xf')]);router['post']('/:id/configurations',auth[_0xd874('0x9')](),controller['addConfiguration']);router['put'](_0xd874('0x10'),auth[_0xd874('0x9')](),controller[_0xd874('0x11')]);router[_0xd874('0x12')](_0xd874('0x10'),auth[_0xd874('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdd34=['./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0xdd34,0xe8));var _0x4dd3=function(_0x119880,_0x4f291f){_0x119880=_0x119880-0x0;var _0x4a1707=_0xdd34[_0x119880];return _0x4a1707;};'use strict';var multer=require(_0x4dd3('0x0'));var util=require(_0x4dd3('0x1'));var path=require(_0x4dd3('0x2'));var timeout=require(_0x4dd3('0x3'));var express=require('express');var router=express[_0x4dd3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4dd3('0x5'));var interaction=require(_0x4dd3('0x6'));var config=require(_0x4dd3('0x7'));var controller=require(_0x4dd3('0x8'));router[_0x4dd3('0x9')]('/',auth[_0x4dd3('0xa')](),controller[_0x4dd3('0xb')]);router[_0x4dd3('0x9')](_0x4dd3('0xc'),auth[_0x4dd3('0xa')](),controller['show']);router['get'](_0x4dd3('0xd'),auth[_0x4dd3('0xa')](),controller[_0x4dd3('0xe')]);router[_0x4dd3('0x9')](_0x4dd3('0xf'),auth[_0x4dd3('0xa')](),controller['getFields']);router[_0x4dd3('0x10')]('/',auth[_0x4dd3('0xa')](),controller['create']);router[_0x4dd3('0x10')](_0x4dd3('0xd'),auth['isAuthenticated'](),controller[_0x4dd3('0x11')]);router['put'](_0x4dd3('0xc'),auth[_0x4dd3('0xa')](),controller[_0x4dd3('0x12')]);router[_0x4dd3('0x13')](_0x4dd3('0xc'),auth[_0x4dd3('0xa')](),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 c4d9e75..38bda4d 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 _0xeda7=['remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0xeda7,0x196));var _0x7eda=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xeda7[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0x7eda('0x0'));module[_0x7eda('0x1')]={'name':{'type':Sequelize[_0x7eda('0x2')]},'description':{'type':Sequelize[_0x7eda('0x2')]},'username':{'type':Sequelize[_0x7eda('0x2')],'unique':_0x7eda('0x3')},'password':{'type':Sequelize[_0x7eda('0x2')]},'token':{'type':Sequelize[_0x7eda('0x2')]},'remoteUri':{'type':Sequelize[_0x7eda('0x2')],'unique':_0x7eda('0x4')},'authType':{'type':Sequelize[_0x7eda('0x5')](_0x7eda('0x6'),_0x7eda('0x7')),'defaultValue':_0x7eda('0x6')},'serverUrl':{'type':Sequelize[_0x7eda('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7eda('0x5')](_0x7eda('0x8'),_0x7eda('0x9')),'defaultValue':_0x7eda('0x8')}}; \ No newline at end of file +var _0x8aad=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','token','password'];(function(_0x3922ba,_0x4196bf){var _0x687f32=function(_0x2e1d0c){while(--_0x2e1d0c){_0x3922ba['push'](_0x3922ba['shift']());}};_0x687f32(++_0x4196bf);}(_0x8aad,0x146));var _0xd8aa=function(_0x69cbc3,_0x1c6281){_0x69cbc3=_0x69cbc3-0x0;var _0x92b8fc=_0x8aad[_0x69cbc3];return _0x92b8fc;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd8aa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x3')},'password':{'type':Sequelize[_0xd8aa('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0xd8aa('0x5')),'defaultValue':_0xd8aa('0x6')},'serverUrl':{'type':Sequelize[_0xd8aa('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd8aa('0x7'),_0xd8aa('0x8')),'defaultValue':_0xd8aa('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 4146fd5..08c9cb8 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 _0xa5fa=['send','ZendeskAccount','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','include','findAll','catch','show','params','keys','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','username','password','token','remoteUri','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','stack','name'];(function(_0x28a962,_0x21927e){var _0x5e4417=function(_0x3f90a4){while(--_0x3f90a4){_0x28a962['push'](_0x28a962['shift']());}};_0x5e4417(++_0x21927e);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x490f59,_0x51681d){_0x490f59=_0x490f59-0x0;var _0x5e4394=_0xa5fa[_0x490f59];return _0x5e4394;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa5f('0x0'));var zipdir=require(_0xaa5f('0x1'));var jsonpatch=require(_0xaa5f('0x2'));var rp=require(_0xaa5f('0x3'));var moment=require('moment');var BPromise=require(_0xaa5f('0x4'));var Mustache=require(_0xaa5f('0x5'));var util=require('util');var path=require(_0xaa5f('0x6'));var sox=require(_0xaa5f('0x7'));var csv=require(_0xaa5f('0x8'));var ejs=require(_0xaa5f('0x9'));var fs=require('fs');var fs_extra=require(_0xaa5f('0xa'));var _=require(_0xaa5f('0xb'));var squel=require(_0xaa5f('0xc'));var crypto=require(_0xaa5f('0xd'));var jsforce=require(_0xaa5f('0xe'));var deskjs=require(_0xaa5f('0xf'));var toCsv=require(_0xaa5f('0x8'));var querystring=require('querystring');var Papa=require(_0xaa5f('0x10'));var Redis=require(_0xaa5f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa5f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa5f('0x13'));var utils=require('../../config/utils');var config=require(_0xaa5f('0x14'));var licenseUtil=require(_0xaa5f('0x15'));var db=require(_0xaa5f('0x16'))['db'];var integrations=require(_0xaa5f('0x17'));function respondWithStatusCode(_0x252ae0,_0x48d1d3){_0x48d1d3=_0x48d1d3||0xcc;return function(_0xbd4e10){if(_0xbd4e10){return _0x252ae0['sendStatus'](_0x48d1d3);}return _0x252ae0[_0xaa5f('0x18')](_0x48d1d3)[_0xaa5f('0x19')]();};}function respondWithResult(_0x31eabc,_0x19aa27){_0x19aa27=_0x19aa27||0xc8;return function(_0x2e1ca5){if(_0x2e1ca5){return _0x31eabc['status'](_0x19aa27)['json'](_0x2e1ca5);}};}function respondWithFilteredResult(_0x1f37fb,_0x291042){return function(_0xb0bfb6){if(_0xb0bfb6){var _0x4265ab=typeof _0x291042[_0xaa5f('0x1a')]===_0xaa5f('0x1b')&&typeof _0x291042[_0xaa5f('0x1c')]===_0xaa5f('0x1b');var _0x202ea8=_0xb0bfb6[_0xaa5f('0x1d')];var _0x22175f=_0x4265ab?0x0:_0x291042[_0xaa5f('0x1a')];var _0x4f4cd5=_0x4265ab?_0xb0bfb6[_0xaa5f('0x1d')]:_0x291042[_0xaa5f('0x1a')]+_0x291042[_0xaa5f('0x1c')];var _0x358d2e;if(_0x4f4cd5>=_0x202ea8){_0x4f4cd5=_0x202ea8;_0x358d2e=0xc8;}else{_0x358d2e=0xce;}_0x1f37fb[_0xaa5f('0x18')](_0x358d2e);return _0x1f37fb[_0xaa5f('0x1e')](_0xaa5f('0x1f'),_0x22175f+'-'+_0x4f4cd5+'/'+_0x202ea8)[_0xaa5f('0x20')](_0xb0bfb6);}return null;};}function patchUpdates(_0x2d8fc3){return function(_0xe3d7d){try{jsonpatch[_0xaa5f('0x21')](_0xe3d7d,_0x2d8fc3,!![]);}catch(_0x10f287){return BPromise[_0xaa5f('0x22')](_0x10f287);}return _0xe3d7d['save']();};}function saveUpdates(_0x1e917d,_0x57082c){return function(_0x2e04e6){if(_0x2e04e6){return _0x2e04e6[_0xaa5f('0x23')](_0x1e917d)['then'](function(_0x1baa2e){return _0x1baa2e;});}return null;};}function removeEntity(_0x1032ce,_0x5b9f0b){return function(_0xf6a8c3){if(_0xf6a8c3){return _0xf6a8c3[_0xaa5f('0x24')]()[_0xaa5f('0x25')](function(){_0x1032ce[_0xaa5f('0x18')](0xcc)[_0xaa5f('0x19')]();});}};}function handleEntityNotFound(_0xacbded,_0x3d7bca){return function(_0x2fba7d){if(!_0x2fba7d){_0xacbded['sendStatus'](0x194);}return _0x2fba7d;};}function handleError(_0x2445a6,_0x3a66e8){_0x3a66e8=_0x3a66e8||0x1f4;return function(_0x1ed8eb){logger['error'](_0x1ed8eb[_0xaa5f('0x26')]);if(_0x1ed8eb[_0xaa5f('0x27')]){delete _0x1ed8eb[_0xaa5f('0x27')];}_0x2445a6['status'](_0x3a66e8)[_0xaa5f('0x28')](_0x1ed8eb);};}exports['index']=function(_0x5990d2,_0x27d1a4){var _0x50998f={},_0x1bffec={},_0x4e0ec9={'count':0x0,'rows':[]};var _0x4c5dc0=_['map'](db[_0xaa5f('0x29')]['rawAttributes'],function(_0x310828){return{'name':_0x310828[_0xaa5f('0x2a')],'type':_0x310828['type']['key']};});_0x1bffec[_0xaa5f('0x2b')]=_['map'](_0x4c5dc0,_0xaa5f('0x27'));_0x1bffec[_0xaa5f('0x2c')]=_['keys'](_0x5990d2[_0xaa5f('0x2c')]);_0x1bffec[_0xaa5f('0x2d')]=_[_0xaa5f('0x2e')](_0x1bffec['model'],_0x1bffec[_0xaa5f('0x2c')]);_0x50998f[_0xaa5f('0x2f')]=_['intersection'](_0x1bffec['model'],qs['fields'](_0x5990d2['query'][_0xaa5f('0x30')]));_0x50998f[_0xaa5f('0x2f')]=_0x50998f[_0xaa5f('0x2f')][_0xaa5f('0x31')]?_0x50998f[_0xaa5f('0x2f')]:_0x1bffec[_0xaa5f('0x2b')];if(!_0x5990d2[_0xaa5f('0x2c')]['hasOwnProperty'](_0xaa5f('0x32'))){_0x50998f[_0xaa5f('0x1c')]=qs[_0xaa5f('0x1c')](_0x5990d2[_0xaa5f('0x2c')][_0xaa5f('0x1c')]);_0x50998f[_0xaa5f('0x1a')]=qs['offset'](_0x5990d2[_0xaa5f('0x2c')][_0xaa5f('0x1a')]);}_0x50998f[_0xaa5f('0x33')]=qs[_0xaa5f('0x34')](_0x5990d2[_0xaa5f('0x2c')]['sort']);_0x50998f['where']=qs[_0xaa5f('0x2d')](_[_0xaa5f('0x35')](_0x5990d2[_0xaa5f('0x2c')],_0x1bffec[_0xaa5f('0x2d')]),_0x4c5dc0);if(_0x5990d2['query'][_0xaa5f('0x36')]){_0x50998f[_0xaa5f('0x37')]=_[_0xaa5f('0x38')](_0x50998f[_0xaa5f('0x37')],{'$or':_[_0xaa5f('0x39')](_0x4c5dc0,function(_0x1869c2){if(_0x1869c2[_0xaa5f('0x3a')]!==_0xaa5f('0x3b')){var _0xc6deec={};_0xc6deec[_0x1869c2[_0xaa5f('0x27')]]={'$like':'%'+_0x5990d2[_0xaa5f('0x2c')]['filter']+'%'};return _0xc6deec;}})});}_0x50998f=_[_0xaa5f('0x38')]({},_0x50998f,_0x5990d2[_0xaa5f('0x3c')]);var _0xcd9c30={'where':_0x50998f[_0xaa5f('0x37')]};return db[_0xaa5f('0x29')][_0xaa5f('0x1d')](_0xcd9c30)[_0xaa5f('0x25')](function(_0xa490d9){_0x4e0ec9[_0xaa5f('0x1d')]=_0xa490d9;if(_0x5990d2[_0xaa5f('0x2c')]['includeAll']){_0x50998f[_0xaa5f('0x3d')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xaa5f('0x3e')](_0x50998f);})[_0xaa5f('0x25')](function(_0x17bb4d){_0x4e0ec9['rows']=_0x17bb4d;return _0x4e0ec9;})[_0xaa5f('0x25')](respondWithFilteredResult(_0x27d1a4,_0x50998f))[_0xaa5f('0x3f')](handleError(_0x27d1a4,null));};exports[_0xaa5f('0x40')]=function(_0x528b08,_0x12a8e4){var _0x179be8={'raw':![],'where':{'id':_0x528b08[_0xaa5f('0x41')]['id']}},_0x1ac9b6={};_0x1ac9b6['model']=_[_0xaa5f('0x42')](db[_0xaa5f('0x29')][_0xaa5f('0x43')]);_0x1ac9b6[_0xaa5f('0x2c')]=_[_0xaa5f('0x42')](_0x528b08[_0xaa5f('0x2c')]);_0x1ac9b6[_0xaa5f('0x2d')]=_[_0xaa5f('0x2e')](_0x1ac9b6['model'],_0x1ac9b6[_0xaa5f('0x2c')]);_0x179be8['attributes']=_[_0xaa5f('0x2e')](_0x1ac9b6['model'],qs[_0xaa5f('0x30')](_0x528b08[_0xaa5f('0x2c')]['fields']));_0x179be8[_0xaa5f('0x2f')]=_0x179be8[_0xaa5f('0x2f')][_0xaa5f('0x31')]?_0x179be8['attributes']:_0x1ac9b6['model'];if(_0x528b08['query'][_0xaa5f('0x44')]){_0x179be8['include']=[{'all':!![]}];}_0x179be8=_[_0xaa5f('0x38')]({},_0x179be8,_0x528b08[_0xaa5f('0x3c')]);return db[_0xaa5f('0x29')][_0xaa5f('0x45')](_0x179be8)['then'](handleEntityNotFound(_0x12a8e4,null))[_0xaa5f('0x25')](respondWithResult(_0x12a8e4,null))[_0xaa5f('0x3f')](handleError(_0x12a8e4,null));};exports[_0xaa5f('0x46')]=function(_0x231ad1,_0x27ea4b){return db[_0xaa5f('0x29')][_0xaa5f('0x46')](_0x231ad1[_0xaa5f('0x47')],{})[_0xaa5f('0x25')](respondWithResult(_0x27ea4b,0xc9))[_0xaa5f('0x3f')](handleError(_0x27ea4b,null));};exports[_0xaa5f('0x23')]=function(_0x2de737,_0x2be44d){if(_0x2de737[_0xaa5f('0x47')]['id']){delete _0x2de737[_0xaa5f('0x47')]['id'];}return db[_0xaa5f('0x29')]['find']({'where':{'id':_0x2de737[_0xaa5f('0x41')]['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x2be44d,null))[_0xaa5f('0x25')](saveUpdates(_0x2de737[_0xaa5f('0x47')],null))[_0xaa5f('0x25')](respondWithResult(_0x2be44d,null))[_0xaa5f('0x3f')](handleError(_0x2be44d,null));};exports[_0xaa5f('0x24')]=function(_0x4aa556,_0xf5a6b6){return db[_0xaa5f('0x29')][_0xaa5f('0x45')]({'where':{'id':_0x4aa556[_0xaa5f('0x41')]['id']}})['then'](handleEntityNotFound(_0xf5a6b6,null))[_0xaa5f('0x25')](removeEntity(_0xf5a6b6,null))[_0xaa5f('0x3f')](handleError(_0xf5a6b6,null));};exports[_0xaa5f('0x48')]=function(_0x575803,_0x5bbdce,_0x506dce){var _0x56cdd6={};var _0x585559={};var _0x509c61;var _0x1f47a0;return db[_0xaa5f('0x29')][_0xaa5f('0x49')]({'where':{'id':_0x575803[_0xaa5f('0x41')]['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x5bbdce,null))[_0xaa5f('0x25')](function(_0x48c473){if(_0x48c473){_0x509c61=_0x48c473;_0x585559['model']=_[_0xaa5f('0x42')](db[_0xaa5f('0x4a')]['rawAttributes']);_0x585559[_0xaa5f('0x2c')]=_[_0xaa5f('0x42')](_0x575803[_0xaa5f('0x2c')]);_0x585559[_0xaa5f('0x2d')]=_[_0xaa5f('0x2e')](_0x585559[_0xaa5f('0x2b')],_0x585559[_0xaa5f('0x2c')]);_0x56cdd6['attributes']=_['intersection'](_0x585559[_0xaa5f('0x2b')],qs[_0xaa5f('0x30')](_0x575803['query']['fields']));_0x56cdd6['attributes']=_0x56cdd6[_0xaa5f('0x2f')]['length']?_0x56cdd6[_0xaa5f('0x2f')]:_0x585559['model'];_0x56cdd6['order']=qs[_0xaa5f('0x34')](_0x575803[_0xaa5f('0x2c')][_0xaa5f('0x34')]);_0x56cdd6['where']=qs[_0xaa5f('0x2d')](_[_0xaa5f('0x35')](_0x575803[_0xaa5f('0x2c')],_0x585559['filters']));if(_0x575803[_0xaa5f('0x2c')][_0xaa5f('0x36')]){_0x56cdd6['where']=_[_0xaa5f('0x38')](_0x56cdd6[_0xaa5f('0x37')],{'$or':_[_0xaa5f('0x39')](_0x56cdd6[_0xaa5f('0x2f')],function(_0x334282){var _0x178d90={};_0x178d90[_0x334282]={'$like':'%'+_0x575803[_0xaa5f('0x2c')][_0xaa5f('0x36')]+'%'};return _0x178d90;})});}_0x56cdd6=_[_0xaa5f('0x38')]({},_0x56cdd6,_0x575803['options']);return _0x509c61[_0xaa5f('0x48')](_0x56cdd6);}})[_0xaa5f('0x25')](function(_0x1d02af){if(_0x1d02af){_0x1f47a0=_0x1d02af[_0xaa5f('0x31')];if(!_0x575803[_0xaa5f('0x2c')][_0xaa5f('0x4b')](_0xaa5f('0x32'))){_0x56cdd6[_0xaa5f('0x1c')]=qs['limit'](_0x575803[_0xaa5f('0x2c')]['limit']);_0x56cdd6[_0xaa5f('0x1a')]=qs[_0xaa5f('0x1a')](_0x575803[_0xaa5f('0x2c')][_0xaa5f('0x1a')]);}return _0x509c61['getConfigurations'](_0x56cdd6);}})[_0xaa5f('0x25')](function(_0x1bc0e7){if(_0x1bc0e7){return _0x1bc0e7?{'count':_0x1f47a0,'rows':_0x1bc0e7}:null;}})[_0xaa5f('0x25')](respondWithResult(_0x5bbdce,null))['catch'](handleError(_0x5bbdce,null));};exports[_0xaa5f('0x4c')]=function(_0x524f42,_0x42ea3b,_0x5e7a74){if(_0x524f42[_0xaa5f('0x47')]['id']){delete _0x524f42[_0xaa5f('0x47')]['id'];}return db[_0xaa5f('0x29')][_0xaa5f('0x49')]({'where':{'id':_0x524f42['params']['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x42ea3b,null))[_0xaa5f('0x25')](function(_0x47a160){if(_0x47a160){_0x524f42['body'][_0xaa5f('0x4d')]=_0x47a160['id'];_0x524f42[_0xaa5f('0x47')]['Subjects']=integrations[_0xaa5f('0x4e')](_0x524f42[_0xaa5f('0x47')][_0xaa5f('0x4f')],_0x524f42['body'][_0xaa5f('0x3a')]);_0x524f42[_0xaa5f('0x47')]['Descriptions']=integrations[_0xaa5f('0x50')](_0x524f42[_0xaa5f('0x47')][_0xaa5f('0x4f')],_0x524f42['body'][_0xaa5f('0x3a')]);return db[_0xaa5f('0x4a')]['create'](_0x524f42[_0xaa5f('0x47')],{'include':[{'model':db[_0xaa5f('0x51')],'as':_0xaa5f('0x52')},{'model':db[_0xaa5f('0x51')],'as':_0xaa5f('0x53')}]});}return null;})['then'](respondWithResult(_0x42ea3b,null))[_0xaa5f('0x3f')](handleError(_0x42ea3b,null));};exports[_0xaa5f('0x54')]=function(_0x464ac7,_0x216399,_0x2a1049){var _0x508fe7='';return db[_0xaa5f('0x29')]['findOne']({'where':{'id':_0x464ac7[_0xaa5f('0x41')]['id']},'attributes':['id',_0xaa5f('0x55'),_0xaa5f('0x56'),_0xaa5f('0x57'),'authType',_0xaa5f('0x58')]})[_0xaa5f('0x25')](handleEntityNotFound(_0x216399,null))[_0xaa5f('0x25')](function(_0x424b43){if(_0x424b43){_0x508fe7=_0x424b43[_0xaa5f('0x58')];var _0x201b8b=_0x508fe7['slice'](-0x1);if(_0x201b8b==='/'){_0x508fe7=_0x508fe7['substring'](0x0,_0x508fe7[_0xaa5f('0x59')](_0x201b8b));}var _0x300350={'method':_0xaa5f('0x5a'),'uri':util[_0xaa5f('0x5b')](_0xaa5f('0x5c'),_0x508fe7,'ticket_fields'),'json':!![]};switch(_0x424b43['authType']){case _0xaa5f('0x56'):_0x300350[_0xaa5f('0x5d')]={'Authorization':util['format'](_0xaa5f('0x5e'),new Buffer(util['format'](_0xaa5f('0x5f'),_0x424b43[_0xaa5f('0x55')],_0x424b43['password']))[_0xaa5f('0x60')](_0xaa5f('0x61')))};break;case _0xaa5f('0x57'):_0x300350[_0xaa5f('0x5d')]={'Authorization':util[_0xaa5f('0x5b')](_0xaa5f('0x5e'),new Buffer(util[_0xaa5f('0x5b')]('%s/token:%s',_0x424b43[_0xaa5f('0x55')],_0x424b43[_0xaa5f('0x57')]))[_0xaa5f('0x60')]('base64'))};break;default:throw new db[(_0xaa5f('0x62'))][(_0xaa5f('0x63'))](_0xaa5f('0x64'));}return rp(_0x300350);}})[_0xaa5f('0x25')](function(_0x281004){if(_0x281004){var _0x5d4cab=[_0xaa5f('0x65'),_0xaa5f('0x66'),_0xaa5f('0x67'),_0xaa5f('0x68')];_[_0xaa5f('0x69')](_0x281004[_0xaa5f('0x6a')],function(_0x155eb4){return _0x5d4cab[_0xaa5f('0x6b')](_0x155eb4[_0xaa5f('0x3a')]);});return{'count':_0x281004[_0xaa5f('0x6a')]['length'],'rows':_['map'](_0x281004[_0xaa5f('0x6a')],function(_0xa7ecc9){return{'id':_0xa7ecc9['id'],'name':_0xa7ecc9[_0xaa5f('0x6c')]>0x7?_0xa7ecc9[_0xaa5f('0x6d')]:_0xa7ecc9[_0xaa5f('0x3a')],'custom':_0xa7ecc9[_0xaa5f('0x6c')]>0x7?!![]:![],'options':_0xa7ecc9[_0xaa5f('0x6e')]?_0xa7ecc9[_0xaa5f('0x6e')]:_0xa7ecc9['custom_field_options']?_0xa7ecc9[_0xaa5f('0x6f')]:[]};})};}})[_0xaa5f('0x25')](respondWithResult(_0x216399,null))[_0xaa5f('0x3f')](function(_0x5f2484){var _0x55a3f9=_0x464ac7[_0xaa5f('0x2c')][_0xaa5f('0x70')]?0x1f4:_0x5f2484[_0xaa5f('0x71')]||0x1f4;logger[_0xaa5f('0x72')](_0xaa5f('0x73'),_0xaa5f('0x54'),_0x55a3f9,JSON[_0xaa5f('0x74')](_0x5f2484));delete _0x5f2484[_0xaa5f('0x27')];if(_0x55a3f9===0x191){_0x55a3f9=0x190;}_0x216399[_0xaa5f('0x18')](_0x55a3f9)[_0xaa5f('0x28')](_0x464ac7['query'][_0xaa5f('0x70')]?{'message':_0xaa5f('0x75'),'statusCode':_0x5f2484[_0xaa5f('0x71')]}:_0x5f2484);});}; \ No newline at end of file +var _0xf4eb=['includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields','stringify','send','Wrong\x20credentials','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','filter','options','includeAll','include','catch','show','params','find','create','body','getConfigurations','order','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskConfiguration','ZendeskField','findOne','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','token','ValidationError','description','assignee','remove','ticket_fields'];(function(_0x47d5cf,_0xf5581d){var _0x76ab23=function(_0x4c5ac3){while(--_0x4c5ac3){_0x47d5cf['push'](_0x47d5cf['shift']());}};_0x76ab23(++_0xf5581d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x22ef3a,_0x211e80){_0x22ef3a=_0x22ef3a-0x0;var _0x447429=_0xf4eb[_0x22ef3a];return _0x447429;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbf4e('0x13'));function respondWithStatusCode(_0x5a3035,_0x56d185){_0x56d185=_0x56d185||0xcc;return function(_0x209b25){if(_0x209b25){return _0x5a3035[_0xbf4e('0x14')](_0x56d185);}return _0x5a3035[_0xbf4e('0x15')](_0x56d185)[_0xbf4e('0x16')]();};}function respondWithResult(_0x3b74bd,_0x61bd54){_0x61bd54=_0x61bd54||0xc8;return function(_0x4984b4){if(_0x4984b4){return _0x3b74bd['status'](_0x61bd54)[_0xbf4e('0x17')](_0x4984b4);}};}function respondWithFilteredResult(_0x1735ae,_0x28fc6b){return function(_0x542909){if(_0x542909){var _0x14110b=typeof _0x28fc6b[_0xbf4e('0x18')]===_0xbf4e('0x19')&&typeof _0x28fc6b[_0xbf4e('0x1a')]==='undefined';var _0x247322=_0x542909['count'];var _0x5db03f=_0x14110b?0x0:_0x28fc6b['offset'];var _0x4f8762=_0x14110b?_0x542909[_0xbf4e('0x1b')]:_0x28fc6b[_0xbf4e('0x18')]+_0x28fc6b[_0xbf4e('0x1a')];var _0x4d9c2a;if(_0x4f8762>=_0x247322){_0x4f8762=_0x247322;_0x4d9c2a=0xc8;}else{_0x4d9c2a=0xce;}_0x1735ae['status'](_0x4d9c2a);return _0x1735ae[_0xbf4e('0x1c')](_0xbf4e('0x1d'),_0x5db03f+'-'+_0x4f8762+'/'+_0x247322)[_0xbf4e('0x17')](_0x542909);}return null;};}function patchUpdates(_0x3a875b){return function(_0x344727){try{jsonpatch[_0xbf4e('0x1e')](_0x344727,_0x3a875b,!![]);}catch(_0x415963){return BPromise[_0xbf4e('0x1f')](_0x415963);}return _0x344727[_0xbf4e('0x20')]();};}function saveUpdates(_0x376832,_0x30539b){return function(_0x59bd84){if(_0x59bd84){return _0x59bd84[_0xbf4e('0x21')](_0x376832)[_0xbf4e('0x22')](function(_0x51648c){return _0x51648c;});}return null;};}function removeEntity(_0x31e3f5,_0x30994d){return function(_0x114412){if(_0x114412){return _0x114412[_0xbf4e('0x23')]()[_0xbf4e('0x22')](function(){_0x31e3f5['status'](0xcc)[_0xbf4e('0x16')]();});}};}function handleEntityNotFound(_0x36688a,_0x3d6863){return function(_0x5766d4){if(!_0x5766d4){_0x36688a[_0xbf4e('0x14')](0x194);}return _0x5766d4;};}function handleError(_0x5e08b1,_0x5bcf71){_0x5bcf71=_0x5bcf71||0x1f4;return function(_0x2bfccf){logger['error'](_0x2bfccf[_0xbf4e('0x24')]);if(_0x2bfccf[_0xbf4e('0x25')]){delete _0x2bfccf[_0xbf4e('0x25')];}_0x5e08b1[_0xbf4e('0x15')](_0x5bcf71)['send'](_0x2bfccf);};}exports[_0xbf4e('0x26')]=function(_0x8e0ab5,_0x43879d){var _0x4cd4a1={},_0x681c3b={},_0x590c85={'count':0x0,'rows':[]};var _0x1dfa81=_[_0xbf4e('0x27')](db[_0xbf4e('0x28')]['rawAttributes'],function(_0x1d12e2){return{'name':_0x1d12e2[_0xbf4e('0x29')],'type':_0x1d12e2[_0xbf4e('0x2a')][_0xbf4e('0x2b')]};});_0x681c3b[_0xbf4e('0x2c')]=_[_0xbf4e('0x27')](_0x1dfa81,'name');_0x681c3b[_0xbf4e('0x2d')]=_[_0xbf4e('0x2e')](_0x8e0ab5['query']);_0x681c3b[_0xbf4e('0x2f')]=_[_0xbf4e('0x30')](_0x681c3b['model'],_0x681c3b[_0xbf4e('0x2d')]);_0x4cd4a1['attributes']=_[_0xbf4e('0x30')](_0x681c3b['model'],qs[_0xbf4e('0x31')](_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x31')]));_0x4cd4a1['attributes']=_0x4cd4a1[_0xbf4e('0x32')][_0xbf4e('0x33')]?_0x4cd4a1[_0xbf4e('0x32')]:_0x681c3b[_0xbf4e('0x2c')];if(!_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x34')]('nolimit')){_0x4cd4a1[_0xbf4e('0x1a')]=qs[_0xbf4e('0x1a')](_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x1a')]);_0x4cd4a1[_0xbf4e('0x18')]=qs['offset'](_0x8e0ab5['query']['offset']);}_0x4cd4a1['order']=qs[_0xbf4e('0x35')](_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x35')]);_0x4cd4a1[_0xbf4e('0x36')]=qs[_0xbf4e('0x2f')](_[_0xbf4e('0x37')](_0x8e0ab5[_0xbf4e('0x2d')],_0x681c3b[_0xbf4e('0x2f')]),_0x1dfa81);if(_0x8e0ab5[_0xbf4e('0x2d')]['filter']){_0x4cd4a1['where']=_[_0xbf4e('0x38')](_0x4cd4a1[_0xbf4e('0x36')],{'$or':_[_0xbf4e('0x27')](_0x1dfa81,function(_0x4ae676){if(_0x4ae676[_0xbf4e('0x2a')]!=='VIRTUAL'){var _0x370d90={};_0x370d90[_0x4ae676[_0xbf4e('0x25')]]={'$like':'%'+_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x39')]+'%'};return _0x370d90;}})});}_0x4cd4a1=_['merge']({},_0x4cd4a1,_0x8e0ab5[_0xbf4e('0x3a')]);var _0x78ab2d={'where':_0x4cd4a1[_0xbf4e('0x36')]};return db[_0xbf4e('0x28')]['count'](_0x78ab2d)[_0xbf4e('0x22')](function(_0x44e96b){_0x590c85[_0xbf4e('0x1b')]=_0x44e96b;if(_0x8e0ab5[_0xbf4e('0x2d')][_0xbf4e('0x3b')]){_0x4cd4a1[_0xbf4e('0x3c')]=[{'all':!![]}];}return db[_0xbf4e('0x28')]['findAll'](_0x4cd4a1);})[_0xbf4e('0x22')](function(_0x7b3a94){_0x590c85['rows']=_0x7b3a94;return _0x590c85;})['then'](respondWithFilteredResult(_0x43879d,_0x4cd4a1))[_0xbf4e('0x3d')](handleError(_0x43879d,null));};exports[_0xbf4e('0x3e')]=function(_0x495e53,_0x5bfc4d){var _0x2b1bf4={'raw':![],'where':{'id':_0x495e53[_0xbf4e('0x3f')]['id']}},_0x150224={};_0x150224[_0xbf4e('0x2c')]=_[_0xbf4e('0x2e')](db[_0xbf4e('0x28')]['rawAttributes']);_0x150224[_0xbf4e('0x2d')]=_[_0xbf4e('0x2e')](_0x495e53['query']);_0x150224['filters']=_['intersection'](_0x150224['model'],_0x150224[_0xbf4e('0x2d')]);_0x2b1bf4['attributes']=_[_0xbf4e('0x30')](_0x150224[_0xbf4e('0x2c')],qs['fields'](_0x495e53['query'][_0xbf4e('0x31')]));_0x2b1bf4[_0xbf4e('0x32')]=_0x2b1bf4[_0xbf4e('0x32')][_0xbf4e('0x33')]?_0x2b1bf4[_0xbf4e('0x32')]:_0x150224['model'];if(_0x495e53[_0xbf4e('0x2d')][_0xbf4e('0x3b')]){_0x2b1bf4[_0xbf4e('0x3c')]=[{'all':!![]}];}_0x2b1bf4=_[_0xbf4e('0x38')]({},_0x2b1bf4,_0x495e53[_0xbf4e('0x3a')]);return db[_0xbf4e('0x28')][_0xbf4e('0x40')](_0x2b1bf4)[_0xbf4e('0x22')](handleEntityNotFound(_0x5bfc4d,null))['then'](respondWithResult(_0x5bfc4d,null))[_0xbf4e('0x3d')](handleError(_0x5bfc4d,null));};exports[_0xbf4e('0x41')]=function(_0x1833c1,_0x32bed6){return db[_0xbf4e('0x28')][_0xbf4e('0x41')](_0x1833c1[_0xbf4e('0x42')],{})[_0xbf4e('0x22')](respondWithResult(_0x32bed6,0xc9))[_0xbf4e('0x3d')](handleError(_0x32bed6,null));};exports[_0xbf4e('0x21')]=function(_0x2fdba9,_0x6fd78d){if(_0x2fdba9[_0xbf4e('0x42')]['id']){delete _0x2fdba9[_0xbf4e('0x42')]['id'];}return db[_0xbf4e('0x28')][_0xbf4e('0x40')]({'where':{'id':_0x2fdba9[_0xbf4e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x6fd78d,null))[_0xbf4e('0x22')](saveUpdates(_0x2fdba9[_0xbf4e('0x42')],null))[_0xbf4e('0x22')](respondWithResult(_0x6fd78d,null))['catch'](handleError(_0x6fd78d,null));};exports[_0xbf4e('0x23')]=function(_0x5ed838,_0x4a050e){return db[_0xbf4e('0x28')][_0xbf4e('0x40')]({'where':{'id':_0x5ed838['params']['id']}})[_0xbf4e('0x22')](handleEntityNotFound(_0x4a050e,null))[_0xbf4e('0x22')](removeEntity(_0x4a050e,null))[_0xbf4e('0x3d')](handleError(_0x4a050e,null));};exports[_0xbf4e('0x43')]=function(_0x42eef6,_0x2ac2c8,_0x419969){var _0x1cdd8c={};var _0x3cd61b={};var _0xc058e1;var _0x271ad2;return db['ZendeskAccount']['findOne']({'where':{'id':_0x42eef6[_0xbf4e('0x3f')]['id']}})[_0xbf4e('0x22')](handleEntityNotFound(_0x2ac2c8,null))[_0xbf4e('0x22')](function(_0x586f5d){if(_0x586f5d){_0xc058e1=_0x586f5d;_0x3cd61b[_0xbf4e('0x2c')]=_[_0xbf4e('0x2e')](db['ZendeskConfiguration']['rawAttributes']);_0x3cd61b[_0xbf4e('0x2d')]=_['keys'](_0x42eef6['query']);_0x3cd61b[_0xbf4e('0x2f')]=_[_0xbf4e('0x30')](_0x3cd61b[_0xbf4e('0x2c')],_0x3cd61b[_0xbf4e('0x2d')]);_0x1cdd8c[_0xbf4e('0x32')]=_['intersection'](_0x3cd61b[_0xbf4e('0x2c')],qs['fields'](_0x42eef6[_0xbf4e('0x2d')]['fields']));_0x1cdd8c[_0xbf4e('0x32')]=_0x1cdd8c['attributes'][_0xbf4e('0x33')]?_0x1cdd8c[_0xbf4e('0x32')]:_0x3cd61b[_0xbf4e('0x2c')];_0x1cdd8c[_0xbf4e('0x44')]=qs[_0xbf4e('0x35')](_0x42eef6['query']['sort']);_0x1cdd8c['where']=qs['filters'](_[_0xbf4e('0x37')](_0x42eef6[_0xbf4e('0x2d')],_0x3cd61b['filters']));if(_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x39')]){_0x1cdd8c[_0xbf4e('0x36')]=_[_0xbf4e('0x38')](_0x1cdd8c[_0xbf4e('0x36')],{'$or':_[_0xbf4e('0x27')](_0x1cdd8c[_0xbf4e('0x32')],function(_0x48682c){var _0x25c254={};_0x25c254[_0x48682c]={'$like':'%'+_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x39')]+'%'};return _0x25c254;})});}_0x1cdd8c=_['merge']({},_0x1cdd8c,_0x42eef6['options']);return _0xc058e1[_0xbf4e('0x43')](_0x1cdd8c);}})[_0xbf4e('0x22')](function(_0x2e8a62){if(_0x2e8a62){_0x271ad2=_0x2e8a62['length'];if(!_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x34')](_0xbf4e('0x45'))){_0x1cdd8c[_0xbf4e('0x1a')]=qs[_0xbf4e('0x1a')](_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x1a')]);_0x1cdd8c[_0xbf4e('0x18')]=qs[_0xbf4e('0x18')](_0x42eef6[_0xbf4e('0x2d')][_0xbf4e('0x18')]);}return _0xc058e1[_0xbf4e('0x43')](_0x1cdd8c);}})['then'](function(_0x21cbd2){if(_0x21cbd2){return _0x21cbd2?{'count':_0x271ad2,'rows':_0x21cbd2}:null;}})['then'](respondWithResult(_0x2ac2c8,null))[_0xbf4e('0x3d')](handleError(_0x2ac2c8,null));};exports[_0xbf4e('0x46')]=function(_0x400fa5,_0x180b13,_0x2080ec){if(_0x400fa5[_0xbf4e('0x42')]['id']){delete _0x400fa5[_0xbf4e('0x42')]['id'];}return db[_0xbf4e('0x28')]['findOne']({'where':{'id':_0x400fa5[_0xbf4e('0x3f')]['id']}})[_0xbf4e('0x22')](handleEntityNotFound(_0x180b13,null))[_0xbf4e('0x22')](function(_0x33f9c4){if(_0x33f9c4){_0x400fa5[_0xbf4e('0x42')]['AccountId']=_0x33f9c4['id'];_0x400fa5[_0xbf4e('0x42')][_0xbf4e('0x47')]=integrations[_0xbf4e('0x48')](_0x400fa5[_0xbf4e('0x42')][_0xbf4e('0x49')],_0x400fa5[_0xbf4e('0x42')]['type']);_0x400fa5[_0xbf4e('0x42')]['Descriptions']=integrations[_0xbf4e('0x4a')](_0x400fa5[_0xbf4e('0x42')][_0xbf4e('0x49')],_0x400fa5[_0xbf4e('0x42')]['type']);return db[_0xbf4e('0x4b')]['create'](_0x400fa5['body'],{'include':[{'model':db[_0xbf4e('0x4c')],'as':_0xbf4e('0x47')},{'model':db[_0xbf4e('0x4c')],'as':'Descriptions'}]});}return null;})[_0xbf4e('0x22')](respondWithResult(_0x180b13,null))[_0xbf4e('0x3d')](handleError(_0x180b13,null));};exports['getFields']=function(_0x19c5b4,_0x42df5f,_0x4405b9){var _0x137224='';return db[_0xbf4e('0x28')][_0xbf4e('0x4d')]({'where':{'id':_0x19c5b4[_0xbf4e('0x3f')]['id']},'attributes':['id',_0xbf4e('0x4e'),_0xbf4e('0x4f'),'token',_0xbf4e('0x50'),_0xbf4e('0x51')]})[_0xbf4e('0x22')](handleEntityNotFound(_0x42df5f,null))[_0xbf4e('0x22')](function(_0x54f450){if(_0x54f450){_0x137224=_0x54f450[_0xbf4e('0x51')];var _0x667836=_0x137224[_0xbf4e('0x52')](-0x1);if(_0x667836==='/'){_0x137224=_0x137224[_0xbf4e('0x53')](0x0,_0x137224[_0xbf4e('0x54')](_0x667836));}var _0x3448f5={'method':_0xbf4e('0x55'),'uri':util[_0xbf4e('0x56')](_0xbf4e('0x57'),_0x137224,'ticket_fields'),'json':!![]};switch(_0x54f450[_0xbf4e('0x50')]){case'password':_0x3448f5[_0xbf4e('0x58')]={'Authorization':util[_0xbf4e('0x56')](_0xbf4e('0x59'),new Buffer(util[_0xbf4e('0x56')](_0xbf4e('0x5a'),_0x54f450['username'],_0x54f450[_0xbf4e('0x4f')]))[_0xbf4e('0x5b')](_0xbf4e('0x5c')))};break;case'token':_0x3448f5[_0xbf4e('0x58')]={'Authorization':util[_0xbf4e('0x56')](_0xbf4e('0x59'),new Buffer(util['format'](_0xbf4e('0x5d'),_0x54f450[_0xbf4e('0x4e')],_0x54f450[_0xbf4e('0x5e')]))[_0xbf4e('0x5b')](_0xbf4e('0x5c')))};break;default:throw new db['Sequelize'][(_0xbf4e('0x5f'))]('Unknown\x20authentication\x20type');}return rp(_0x3448f5);}})[_0xbf4e('0x22')](function(_0x504723){if(_0x504723){var _0x19a7e9=['subject',_0xbf4e('0x60'),'group',_0xbf4e('0x61')];_[_0xbf4e('0x62')](_0x504723[_0xbf4e('0x63')],function(_0x23de82){return _0x19a7e9[_0xbf4e('0x64')](_0x23de82[_0xbf4e('0x2a')]);});return{'count':_0x504723[_0xbf4e('0x63')]['length'],'rows':_[_0xbf4e('0x27')](_0x504723[_0xbf4e('0x63')],function(_0x2a242b){return{'id':_0x2a242b['id'],'name':_0x2a242b[_0xbf4e('0x65')]>0x7?_0x2a242b[_0xbf4e('0x66')]:_0x2a242b[_0xbf4e('0x2a')],'custom':_0x2a242b['position']>0x7?!![]:![],'options':_0x2a242b[_0xbf4e('0x67')]?_0x2a242b[_0xbf4e('0x67')]:_0x2a242b['custom_field_options']?_0x2a242b[_0xbf4e('0x68')]:[]};})};}})[_0xbf4e('0x22')](respondWithResult(_0x42df5f,null))[_0xbf4e('0x3d')](function(_0xb6d122){var _0x19ec7e=_0x19c5b4[_0xbf4e('0x2d')][_0xbf4e('0x69')]?0x1f4:_0xb6d122[_0xbf4e('0x6a')]||0x1f4;logger[_0xbf4e('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0xbf4e('0x6c'),_0x19ec7e,JSON[_0xbf4e('0x6d')](_0xb6d122));delete _0xb6d122[_0xbf4e('0x25')];if(_0x19ec7e===0x191){_0x19ec7e=0x190;}_0x42df5f['status'](_0x19ec7e)[_0xbf4e('0x6e')](_0x19c5b4[_0xbf4e('0x2d')]['test']?{'message':_0xbf4e('0x6f'),'statusCode':_0xb6d122[_0xbf4e('0x6a')]}:_0xb6d122);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 43f0022..412c3e7 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 _0xf96f=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','int_zendesk_accounts','lodash','util'];(function(_0x9bfc6c,_0x159ef2){var _0x1f8376=function(_0x475856){while(--_0x475856){_0x9bfc6c['push'](_0x9bfc6c['shift']());}};_0x1f8376(++_0x159ef2);}(_0xf96f,0xbe));var _0xff96=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf96f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xff96('0x0'));var util=require(_0xff96('0x1'));var logger=require(_0xff96('0x2'))(_0xff96('0x3'));var moment=require('moment');var BPromise=require(_0xff96('0x4'));var rp=require(_0xff96('0x5'));var fs=require('fs');var path=require(_0xff96('0x6'));var rimraf=require(_0xff96('0x7'));var config=require(_0xff96('0x8'));var attributes=require(_0xff96('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xff96('0xa')]=function(_0x3e9be2,_0x45ad9a){return _0x3e9be2['define']('ZendeskAccount',attributes,{'tableName':_0xff96('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc016=['../../config/logger','api','moment','request-promise','path','../../config/environment','./intZendeskAccount.attributes','exports','ZendeskAccount','int_zendesk_accounts','util'];(function(_0x360ec,_0x585d47){var _0xf03953=function(_0xf081db){while(--_0xf081db){_0x360ec['push'](_0x360ec['shift']());}};_0xf03953(++_0x585d47);}(_0xc016,0xf1));var _0x6c01=function(_0x4efd85,_0x4d86e3){_0x4efd85=_0x4efd85-0x0;var _0x4f0cdb=_0xc016[_0x4efd85];return _0x4f0cdb;};'use strict';var _=require('lodash');var util=require(_0x6c01('0x0'));var logger=require(_0x6c01('0x1'))(_0x6c01('0x2'));var moment=require(_0x6c01('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c01('0x4'));var fs=require('fs');var path=require(_0x6c01('0x5'));var rimraf=require('rimraf');var config=require(_0x6c01('0x6'));var attributes=require(_0x6c01('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x6c01('0x8')]=function(_0x12f07a,_0x4a9597){return _0x12f07a['define'](_0x6c01('0x9'),attributes,{'tableName':_0x6c01('0xa'),'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 bfc61b6..5a49282 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 _0xd7b0=['debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','include','model','map','ShowZendeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0xd7b0,0x12c));var _0x0d7b=function(_0x388b24,_0x4c7529){_0x388b24=_0x388b24-0x0;var _0x585b85=_0xd7b0[_0x388b24];return _0x585b85;};'use strict';var _=require(_0x0d7b('0x0'));var util=require('util');var moment=require(_0x0d7b('0x1'));var BPromise=require(_0x0d7b('0x2'));var rs=require(_0x0d7b('0x3'));var fs=require('fs');var Redis=require(_0x0d7b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d7b('0x5'));var logger=require(_0x0d7b('0x6'))(_0x0d7b('0x7'));var config=require(_0x0d7b('0x8'));var jayson=require(_0x0d7b('0x9'));var client=jayson['client'][_0x0d7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x362e41,_0x30a486,_0x23cb2c){return new BPromise(function(_0xe3d8f8,_0x5ae58){return client[_0x0d7b('0xb')](_0x362e41,_0x23cb2c)[_0x0d7b('0xc')](function(_0x549bf1){logger[_0x0d7b('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x30a486,_0x0d7b('0xe'));logger[_0x0d7b('0xf')](_0x0d7b('0x10'),_0x30a486,_0x0d7b('0xe'),JSON[_0x0d7b('0x11')](_0x549bf1));if(_0x549bf1['error']){if(_0x549bf1[_0x0d7b('0x12')][_0x0d7b('0x13')]===0x1f4){logger['error'](_0x0d7b('0x14'),_0x30a486,_0x549bf1[_0x0d7b('0x12')]['message']);return _0x5ae58(_0x549bf1[_0x0d7b('0x12')][_0x0d7b('0x15')]);}logger[_0x0d7b('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x30a486,_0x549bf1[_0x0d7b('0x12')][_0x0d7b('0x15')]);return _0xe3d8f8(_0x549bf1[_0x0d7b('0x12')]['message']);}else{logger[_0x0d7b('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x30a486,'request\x20sent');_0xe3d8f8(_0x549bf1[_0x0d7b('0x16')][_0x0d7b('0x15')]);}})[_0x0d7b('0x17')](function(_0x4871bf){logger[_0x0d7b('0x12')](_0x0d7b('0x14'),_0x30a486,_0x4871bf);_0x5ae58(_0x4871bf);});});}exports[_0x0d7b('0x18')]=function(_0x28c59e){var _0x74e58e=this;return new Promise(function(_0x248b42,_0x251a18){return db[_0x0d7b('0x19')]['findAll']({'raw':_0x28c59e[_0x0d7b('0x1a')]?_0x28c59e['options'][_0x0d7b('0x1b')]===undefined?!![]:![]:!![],'where':_0x28c59e['options']?_0x28c59e[_0x0d7b('0x1a')][_0x0d7b('0x1c')]||null:null,'attributes':_0x28c59e[_0x0d7b('0x1a')]?_0x28c59e[_0x0d7b('0x1a')][_0x0d7b('0x1d')]||null:null,'limit':_0x28c59e[_0x0d7b('0x1a')]?_0x28c59e[_0x0d7b('0x1a')][_0x0d7b('0x1e')]||null:null,'include':_0x28c59e['options']?_0x28c59e[_0x0d7b('0x1a')][_0x0d7b('0x1f')]?_['map'](_0x28c59e['options']['include'],function(_0x4bc2bd){return{'model':db[_0x4bc2bd[_0x0d7b('0x20')]],'as':_0x4bc2bd['as'],'attributes':_0x4bc2bd[_0x0d7b('0x1d')],'include':_0x4bc2bd[_0x0d7b('0x1f')]?_[_0x0d7b('0x21')](_0x4bc2bd[_0x0d7b('0x1f')],function(_0x4aae29){return{'model':db[_0x4aae29[_0x0d7b('0x20')]],'as':_0x4aae29['as'],'attributes':_0x4aae29[_0x0d7b('0x1d')],'include':_0x4aae29[_0x0d7b('0x1f')]?_['map'](_0x4aae29[_0x0d7b('0x1f')],function(_0x3d73bc){return{'model':db[_0x3d73bc['model']],'as':_0x3d73bc['as'],'attributes':_0x3d73bc['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d7b('0xc')](function(_0x196987){logger[_0x0d7b('0xd')](_0x0d7b('0x18'),_0x28c59e);logger[_0x0d7b('0xf')]('GetZendeskAccount',_0x28c59e,JSON[_0x0d7b('0x11')](_0x196987));_0x248b42(_0x196987);})[_0x0d7b('0x17')](function(_0x3230e9){logger[_0x0d7b('0x12')](_0x0d7b('0x18'),_0x3230e9[_0x0d7b('0x15')],_0x28c59e);_0x251a18(_0x74e58e['error'](0x1f4,_0x3230e9[_0x0d7b('0x15')]));});});};exports[_0x0d7b('0x22')]=function(_0x244e3d){var _0x4f3105=this;return new Promise(function(_0x2b859c,_0x170fcc){return db[_0x0d7b('0x19')]['find']({'raw':_0x244e3d['options']?_0x244e3d[_0x0d7b('0x1a')][_0x0d7b('0x1b')]===undefined?!![]:![]:!![],'where':_0x244e3d[_0x0d7b('0x1a')]?_0x244e3d['options'][_0x0d7b('0x1c')]||null:null,'attributes':_0x244e3d[_0x0d7b('0x1a')]?_0x244e3d['options'][_0x0d7b('0x1d')]||null:null,'include':_0x244e3d[_0x0d7b('0x1a')]?_0x244e3d[_0x0d7b('0x1a')][_0x0d7b('0x1f')]?_['map'](_0x244e3d[_0x0d7b('0x1a')]['include'],function(_0x4d41b9){return{'model':db[_0x4d41b9[_0x0d7b('0x20')]],'as':_0x4d41b9['as'],'attributes':_0x4d41b9[_0x0d7b('0x1d')],'include':_0x4d41b9[_0x0d7b('0x1f')]?_['map'](_0x4d41b9[_0x0d7b('0x1f')],function(_0x25474f){return{'model':db[_0x25474f[_0x0d7b('0x20')]],'as':_0x25474f['as'],'attributes':_0x25474f[_0x0d7b('0x1d')],'include':_0x25474f['include']?_[_0x0d7b('0x21')](_0x25474f[_0x0d7b('0x1f')],function(_0x2c7b3a){return{'model':db[_0x2c7b3a[_0x0d7b('0x20')]],'as':_0x2c7b3a['as'],'attributes':_0x2c7b3a[_0x0d7b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3882ef){logger['info'](_0x0d7b('0x22'),_0x244e3d);logger[_0x0d7b('0xf')](_0x0d7b('0x22'),_0x244e3d,JSON[_0x0d7b('0x11')](_0x3882ef));_0x2b859c(_0x3882ef);})[_0x0d7b('0x17')](function(_0x238ad7){logger['error'](_0x0d7b('0x22'),_0x238ad7[_0x0d7b('0x15')],_0x244e3d);_0x170fcc(_0x4f3105[_0x0d7b('0x12')](0x1f4,_0x238ad7['message']));});});}; \ No newline at end of file +var _0x85ce=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','attributes','limit','include','model','map','GetZendeskAccount','ShowZendeskAccount','find','where','moment','bluebird'];(function(_0x19f568,_0x50baf4){var _0x525a6a=function(_0x22c4bc){while(--_0x22c4bc){_0x19f568['push'](_0x19f568['shift']());}};_0x525a6a(++_0x50baf4);}(_0x85ce,0x191));var _0xe85c=function(_0x3a614d,_0x3e7879){_0x3a614d=_0x3a614d-0x0;var _0x3295f7=_0x85ce[_0x3a614d];return _0x3295f7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe85c('0x0'));var BPromise=require(_0xe85c('0x1'));var rs=require(_0xe85c('0x2'));var fs=require('fs');var Redis=require(_0xe85c('0x3'));var db=require(_0xe85c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe85c('0x5'))(_0xe85c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe85c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3856d4,_0x5ad0cb,_0x5deab1){return new BPromise(function(_0x47444e,_0x31f211){return client[_0xe85c('0x8')](_0x3856d4,_0x5deab1)[_0xe85c('0x9')](function(_0x3d94d3){logger[_0xe85c('0xa')](_0xe85c('0xb'),_0x5ad0cb,_0xe85c('0xc'));logger[_0xe85c('0xd')](_0xe85c('0xe'),_0x5ad0cb,_0xe85c('0xc'),JSON[_0xe85c('0xf')](_0x3d94d3));if(_0x3d94d3[_0xe85c('0x10')]){if(_0x3d94d3['error'][_0xe85c('0x11')]===0x1f4){logger[_0xe85c('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x5ad0cb,_0x3d94d3[_0xe85c('0x10')][_0xe85c('0x12')]);return _0x31f211(_0x3d94d3[_0xe85c('0x10')][_0xe85c('0x12')]);}logger[_0xe85c('0x10')](_0xe85c('0xb'),_0x5ad0cb,_0x3d94d3['error'][_0xe85c('0x12')]);return _0x47444e(_0x3d94d3[_0xe85c('0x10')][_0xe85c('0x12')]);}else{logger[_0xe85c('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x5ad0cb,_0xe85c('0xc'));_0x47444e(_0x3d94d3['result'][_0xe85c('0x12')]);}})[_0xe85c('0x13')](function(_0x5ea7a2){logger[_0xe85c('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x5ad0cb,_0x5ea7a2);_0x31f211(_0x5ea7a2);});});}exports['GetZendeskAccount']=function(_0x230f97){var _0x493455=this;return new Promise(function(_0xab5de,_0x2aae55){return db['ZendeskAccount'][_0xe85c('0x14')]({'raw':_0x230f97[_0xe85c('0x15')]?_0x230f97[_0xe85c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x230f97['options']?_0x230f97[_0xe85c('0x15')]['where']||null:null,'attributes':_0x230f97[_0xe85c('0x15')]?_0x230f97[_0xe85c('0x15')][_0xe85c('0x16')]||null:null,'limit':_0x230f97[_0xe85c('0x15')]?_0x230f97['options'][_0xe85c('0x17')]||null:null,'include':_0x230f97[_0xe85c('0x15')]?_0x230f97[_0xe85c('0x15')][_0xe85c('0x18')]?_['map'](_0x230f97[_0xe85c('0x15')]['include'],function(_0x34d3c5){return{'model':db[_0x34d3c5[_0xe85c('0x19')]],'as':_0x34d3c5['as'],'attributes':_0x34d3c5[_0xe85c('0x16')],'include':_0x34d3c5['include']?_[_0xe85c('0x1a')](_0x34d3c5[_0xe85c('0x18')],function(_0x13a6ad){return{'model':db[_0x13a6ad[_0xe85c('0x19')]],'as':_0x13a6ad['as'],'attributes':_0x13a6ad[_0xe85c('0x16')],'include':_0x13a6ad[_0xe85c('0x18')]?_[_0xe85c('0x1a')](_0x13a6ad[_0xe85c('0x18')],function(_0x5ab017){return{'model':db[_0x5ab017[_0xe85c('0x19')]],'as':_0x5ab017['as'],'attributes':_0x5ab017[_0xe85c('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe85c('0x9')](function(_0x1717b3){logger[_0xe85c('0xa')](_0xe85c('0x1b'),_0x230f97);logger[_0xe85c('0xd')](_0xe85c('0x1b'),_0x230f97,JSON[_0xe85c('0xf')](_0x1717b3));_0xab5de(_0x1717b3);})[_0xe85c('0x13')](function(_0x198d18){logger[_0xe85c('0x10')](_0xe85c('0x1b'),_0x198d18[_0xe85c('0x12')],_0x230f97);_0x2aae55(_0x493455[_0xe85c('0x10')](0x1f4,_0x198d18[_0xe85c('0x12')]));});});};exports[_0xe85c('0x1c')]=function(_0x29d8fb){var _0x18ef03=this;return new Promise(function(_0x4e798c,_0x21a1be){return db['ZendeskAccount'][_0xe85c('0x1d')]({'raw':_0x29d8fb[_0xe85c('0x15')]?_0x29d8fb[_0xe85c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x29d8fb['options']?_0x29d8fb[_0xe85c('0x15')][_0xe85c('0x1e')]||null:null,'attributes':_0x29d8fb[_0xe85c('0x15')]?_0x29d8fb[_0xe85c('0x15')]['attributes']||null:null,'include':_0x29d8fb['options']?_0x29d8fb[_0xe85c('0x15')][_0xe85c('0x18')]?_[_0xe85c('0x1a')](_0x29d8fb[_0xe85c('0x15')][_0xe85c('0x18')],function(_0x48632b){return{'model':db[_0x48632b['model']],'as':_0x48632b['as'],'attributes':_0x48632b['attributes'],'include':_0x48632b[_0xe85c('0x18')]?_['map'](_0x48632b['include'],function(_0x38c8e5){return{'model':db[_0x38c8e5[_0xe85c('0x19')]],'as':_0x38c8e5['as'],'attributes':_0x38c8e5[_0xe85c('0x16')],'include':_0x38c8e5['include']?_[_0xe85c('0x1a')](_0x38c8e5[_0xe85c('0x18')],function(_0x4f5923){return{'model':db[_0x4f5923['model']],'as':_0x4f5923['as'],'attributes':_0x4f5923['attributes']};}):[]};}):[]};}):[]:[]})[_0xe85c('0x9')](function(_0x3f8195){logger[_0xe85c('0xa')](_0xe85c('0x1c'),_0x29d8fb);logger[_0xe85c('0xd')](_0xe85c('0x1c'),_0x29d8fb,JSON['stringify'](_0x3f8195));_0x4e798c(_0x3f8195);})[_0xe85c('0x13')](function(_0x10262c){logger['error']('ShowZendeskAccount',_0x10262c[_0xe85c('0x12')],_0x29d8fb);_0x21a1be(_0x18ef03['error'](0x1f4,_0x10262c['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8585cd4..279fd3e 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 _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0x51b661,_0x566ef8){var _0x5d1971=function(_0x5cc6b8){while(--_0x5cc6b8){_0x51b661['push'](_0x51b661['shift']());}};_0x5d1971(++_0x566ef8);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x527a01,_0x99a1af){_0x527a01=_0x527a01-0x0;var _0x39d696=_0xbdb7[_0x527a01];return _0x39d696;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x3feb8a,_0x47c784){var _0x4523ca=function(_0x4fba86){while(--_0x4fba86){_0x3feb8a['push'](_0x3feb8a['shift']());}};_0x4523ca(++_0x47c784);}(_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('./intZendeskConfiguration.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/descriptions',auth[_0x0d8b('0x7')](),controller['getDescriptions']);router[_0x0d8b('0x9')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller['update']);router[_0x0d8b('0x16')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x17')]);module[_0x0d8b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 537bcb7..64a98a4 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 _0x94ae=['sequelize','STRING'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x94ae,0xae));var _0xe94a=function(_0x60b2ca,_0x244b4c){_0x60b2ca=_0x60b2ca-0x0;var _0x34ff01=_0x94ae[_0x60b2ca];return _0x34ff01;};'use strict';var Sequelize=require(_0xe94a('0x0'));module['exports']={'name':{'type':Sequelize[_0xe94a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xddfa=['sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xddfa,0x1b0));var _0xaddf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xddfa[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xaddf('0x0'));module[_0xaddf('0x1')]={'name':{'type':Sequelize[_0xaddf('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 b900f0d..bfb1f69 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 _0x549c=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','rows','rawAttributes','options','catch','create','body','find','params','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','type','key'];(function(_0x2ff2e4,_0x73bbc8){var _0xad9e12=function(_0x5f5930){while(--_0x5f5930){_0x2ff2e4['push'](_0x2ff2e4['shift']());}};_0xad9e12(++_0x73bbc8);}(_0x549c,0x120));var _0xc549=function(_0x56a7ef,_0x2e44fa){_0x56a7ef=_0x56a7ef-0x0;var _0x5f36d5=_0x549c[_0x56a7ef];return _0x5f36d5;};'use strict';var emlformat=require(_0xc549('0x0'));var rimraf=require(_0xc549('0x1'));var zipdir=require(_0xc549('0x2'));var jsonpatch=require(_0xc549('0x3'));var rp=require(_0xc549('0x4'));var moment=require(_0xc549('0x5'));var BPromise=require(_0xc549('0x6'));var Mustache=require('mustache');var util=require(_0xc549('0x7'));var path=require(_0xc549('0x8'));var sox=require(_0xc549('0x9'));var csv=require('to-csv');var ejs=require(_0xc549('0xa'));var fs=require('fs');var fs_extra=require(_0xc549('0xb'));var _=require(_0xc549('0xc'));var squel=require(_0xc549('0xd'));var crypto=require(_0xc549('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc549('0xf'));var toCsv=require(_0xc549('0x10'));var querystring=require(_0xc549('0x11'));var Papa=require(_0xc549('0x12'));var Redis=require(_0xc549('0x13'));var authService=require(_0xc549('0x14'));var qs=require(_0xc549('0x15'));var as=require(_0xc549('0x16'));var hardwareService=require(_0xc549('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xc549('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc549('0x19'));var db=require(_0xc549('0x1a'))['db'];function respondWithStatusCode(_0x215f7d,_0x57dc7c){_0x57dc7c=_0x57dc7c||0xcc;return function(_0x14b1a6){if(_0x14b1a6){return _0x215f7d[_0xc549('0x1b')](_0x57dc7c);}return _0x215f7d[_0xc549('0x1c')](_0x57dc7c)[_0xc549('0x1d')]();};}function respondWithResult(_0x234f3a,_0x412cc1){_0x412cc1=_0x412cc1||0xc8;return function(_0x3c8f52){if(_0x3c8f52){return _0x234f3a[_0xc549('0x1c')](_0x412cc1)['json'](_0x3c8f52);}};}function respondWithFilteredResult(_0x19cac9,_0x152b40){return function(_0x17bc2b){if(_0x17bc2b){var _0x3c344c=typeof _0x152b40[_0xc549('0x1e')]==='undefined'&&typeof _0x152b40['limit']==='undefined';var _0x597638=_0x17bc2b[_0xc549('0x1f')];var _0xdff776=_0x3c344c?0x0:_0x152b40[_0xc549('0x1e')];var _0x1be438=_0x3c344c?_0x17bc2b[_0xc549('0x1f')]:_0x152b40[_0xc549('0x1e')]+_0x152b40[_0xc549('0x20')];var _0x5ed28d;if(_0x1be438>=_0x597638){_0x1be438=_0x597638;_0x5ed28d=0xc8;}else{_0x5ed28d=0xce;}_0x19cac9[_0xc549('0x1c')](_0x5ed28d);return _0x19cac9['set'](_0xc549('0x21'),_0xdff776+'-'+_0x1be438+'/'+_0x597638)['json'](_0x17bc2b);}return null;};}function patchUpdates(_0xce419a){return function(_0x20f8b9){try{jsonpatch[_0xc549('0x22')](_0x20f8b9,_0xce419a,!![]);}catch(_0x5440f5){return BPromise['reject'](_0x5440f5);}return _0x20f8b9[_0xc549('0x23')]();};}function saveUpdates(_0x1e53ce,_0x2d30fe){return function(_0x18f874){if(_0x18f874){return _0x18f874[_0xc549('0x24')](_0x1e53ce)[_0xc549('0x25')](function(_0x199ace){return _0x199ace;});}return null;};}function removeEntity(_0x418964,_0x14adc0){return function(_0x1aa67f){if(_0x1aa67f){return _0x1aa67f[_0xc549('0x26')]()[_0xc549('0x25')](function(){_0x418964[_0xc549('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfe1e65,_0x217d5f){return function(_0x5e58cb){if(!_0x5e58cb){_0xfe1e65['sendStatus'](0x194);}return _0x5e58cb;};}function handleError(_0xc350ab,_0x22254a){_0x22254a=_0x22254a||0x1f4;return function(_0x5e07e7){logger[_0xc549('0x27')](_0x5e07e7[_0xc549('0x28')]);if(_0x5e07e7[_0xc549('0x29')]){delete _0x5e07e7[_0xc549('0x29')];}_0xc350ab[_0xc549('0x1c')](_0x22254a)[_0xc549('0x2a')](_0x5e07e7);};}exports[_0xc549('0x2b')]=function(_0x43e1cb,_0x37732a){var _0x528ab2={},_0x409646={},_0x532887={'count':0x0,'rows':[]};var _0x1fe539=_[_0xc549('0x2c')](db[_0xc549('0x2d')]['rawAttributes'],function(_0x106b48){return{'name':_0x106b48['fieldName'],'type':_0x106b48[_0xc549('0x2e')][_0xc549('0x2f')]};});_0x409646[_0xc549('0x30')]=_['map'](_0x1fe539,_0xc549('0x29'));_0x409646[_0xc549('0x31')]=_[_0xc549('0x32')](_0x43e1cb[_0xc549('0x31')]);_0x409646[_0xc549('0x33')]=_[_0xc549('0x34')](_0x409646[_0xc549('0x30')],_0x409646[_0xc549('0x31')]);_0x528ab2[_0xc549('0x35')]=_[_0xc549('0x34')](_0x409646[_0xc549('0x30')],qs[_0xc549('0x36')](_0x43e1cb[_0xc549('0x31')]['fields']));_0x528ab2[_0xc549('0x35')]=_0x528ab2[_0xc549('0x35')][_0xc549('0x37')]?_0x528ab2[_0xc549('0x35')]:_0x409646[_0xc549('0x30')];if(!_0x43e1cb[_0xc549('0x31')][_0xc549('0x38')](_0xc549('0x39'))){_0x528ab2[_0xc549('0x20')]=qs[_0xc549('0x20')](_0x43e1cb[_0xc549('0x31')][_0xc549('0x20')]);_0x528ab2['offset']=qs[_0xc549('0x1e')](_0x43e1cb[_0xc549('0x31')]['offset']);}_0x528ab2[_0xc549('0x3a')]=qs[_0xc549('0x3b')](_0x43e1cb[_0xc549('0x31')]['sort']);_0x528ab2[_0xc549('0x3c')]=qs[_0xc549('0x33')](_[_0xc549('0x3d')](_0x43e1cb[_0xc549('0x31')],_0x409646[_0xc549('0x33')]),_0x1fe539);if(_0x43e1cb[_0xc549('0x31')]['filter']){_0x528ab2[_0xc549('0x3c')]=_['merge'](_0x528ab2['where'],{'$or':_[_0xc549('0x2c')](_0x1fe539,function(_0x2a53a2){if(_0x2a53a2[_0xc549('0x2e')]!==_0xc549('0x3e')){var _0x1db2ac={};_0x1db2ac[_0x2a53a2[_0xc549('0x29')]]={'$like':'%'+_0x43e1cb[_0xc549('0x31')][_0xc549('0x3f')]+'%'};return _0x1db2ac;}})});}_0x528ab2=_[_0xc549('0x40')]({},_0x528ab2,_0x43e1cb['options']);var _0x516a61={'where':_0x528ab2[_0xc549('0x3c')]};return db['ZendeskConfiguration'][_0xc549('0x1f')](_0x516a61)['then'](function(_0x5ca689){_0x532887[_0xc549('0x1f')]=_0x5ca689;if(_0x43e1cb[_0xc549('0x31')][_0xc549('0x41')]){_0x528ab2[_0xc549('0x42')]=[{'all':!![]}];}return db[_0xc549('0x2d')]['findAll'](_0x528ab2);})[_0xc549('0x25')](function(_0x332be5){_0x532887[_0xc549('0x43')]=_0x332be5;return _0x532887;})[_0xc549('0x25')](respondWithFilteredResult(_0x37732a,_0x528ab2))['catch'](handleError(_0x37732a,null));};exports['show']=function(_0x2379f2,_0x421b39){var _0x5854f7={'raw':![],'where':{'id':_0x2379f2['params']['id']}},_0x176185={};_0x176185[_0xc549('0x30')]=_[_0xc549('0x32')](db[_0xc549('0x2d')][_0xc549('0x44')]);_0x176185[_0xc549('0x31')]=_[_0xc549('0x32')](_0x2379f2['query']);_0x176185['filters']=_[_0xc549('0x34')](_0x176185['model'],_0x176185[_0xc549('0x31')]);_0x5854f7[_0xc549('0x35')]=_[_0xc549('0x34')](_0x176185[_0xc549('0x30')],qs[_0xc549('0x36')](_0x2379f2['query'][_0xc549('0x36')]));_0x5854f7['attributes']=_0x5854f7[_0xc549('0x35')][_0xc549('0x37')]?_0x5854f7['attributes']:_0x176185[_0xc549('0x30')];if(_0x2379f2[_0xc549('0x31')][_0xc549('0x41')]){_0x5854f7[_0xc549('0x42')]=[{'all':!![]}];}_0x5854f7=_[_0xc549('0x40')]({},_0x5854f7,_0x2379f2[_0xc549('0x45')]);return db[_0xc549('0x2d')]['find'](_0x5854f7)[_0xc549('0x25')](handleEntityNotFound(_0x421b39,null))[_0xc549('0x25')](respondWithResult(_0x421b39,null))[_0xc549('0x46')](handleError(_0x421b39,null));};exports['create']=function(_0x44df12,_0x3e9061){return db[_0xc549('0x2d')][_0xc549('0x47')](_0x44df12[_0xc549('0x48')],{})[_0xc549('0x25')](respondWithResult(_0x3e9061,0xc9))['catch'](handleError(_0x3e9061,null));};exports[_0xc549('0x24')]=function(_0x268604,_0x467021){if(_0x268604[_0xc549('0x48')]['id']){delete _0x268604[_0xc549('0x48')]['id'];}return db['ZendeskConfiguration'][_0xc549('0x49')]({'where':{'id':_0x268604[_0xc549('0x4a')]['id']}})[_0xc549('0x25')](handleEntityNotFound(_0x467021,null))['then'](saveUpdates(_0x268604[_0xc549('0x48')],null))['then'](respondWithResult(_0x467021,null))[_0xc549('0x46')](handleError(_0x467021,null));};exports[_0xc549('0x26')]=function(_0x559219,_0x514e9b){return db[_0xc549('0x2d')][_0xc549('0x49')]({'where':{'id':_0x559219[_0xc549('0x4a')]['id']}})[_0xc549('0x25')](handleEntityNotFound(_0x514e9b,null))['then'](removeEntity(_0x514e9b,null))[_0xc549('0x46')](handleError(_0x514e9b,null));};exports[_0xc549('0x4b')]=function(_0x3e137a,_0x48e925,_0x14de03){var _0x4fae3d={};var _0x1ec6d7={};var _0x4db57c;var _0x1e8761;return db[_0xc549('0x2d')][_0xc549('0x4c')]({'where':{'id':_0x3e137a['params']['id']}})[_0xc549('0x25')](handleEntityNotFound(_0x48e925,null))[_0xc549('0x25')](function(_0x2daa5e){if(_0x2daa5e){_0x4db57c=_0x2daa5e;_0x1ec6d7['model']=_['keys'](db[_0xc549('0x4d')][_0xc549('0x44')]);_0x1ec6d7['query']=_['keys'](_0x3e137a[_0xc549('0x31')]);_0x1ec6d7[_0xc549('0x33')]=_[_0xc549('0x34')](_0x1ec6d7[_0xc549('0x30')],_0x1ec6d7['query']);_0x4fae3d[_0xc549('0x35')]=_[_0xc549('0x34')](_0x1ec6d7[_0xc549('0x30')],qs[_0xc549('0x36')](_0x3e137a[_0xc549('0x31')][_0xc549('0x36')]));_0x4fae3d[_0xc549('0x35')]=_0x4fae3d['attributes'][_0xc549('0x37')]?_0x4fae3d['attributes']:_0x1ec6d7[_0xc549('0x30')];_0x4fae3d['order']=qs[_0xc549('0x3b')](_0x3e137a[_0xc549('0x31')][_0xc549('0x3b')]);_0x4fae3d[_0xc549('0x3c')]=qs[_0xc549('0x33')](_[_0xc549('0x3d')](_0x3e137a[_0xc549('0x31')],_0x1ec6d7[_0xc549('0x33')]));if(_0x3e137a[_0xc549('0x31')]['filter']){_0x4fae3d['where']=_[_0xc549('0x40')](_0x4fae3d[_0xc549('0x3c')],{'$or':_['map'](_0x4fae3d[_0xc549('0x35')],function(_0x5e01d8){var _0x3be817={};_0x3be817[_0x5e01d8]={'$like':'%'+_0x3e137a['query'][_0xc549('0x3f')]+'%'};return _0x3be817;})});}_0x4fae3d=_[_0xc549('0x40')]({},_0x4fae3d,_0x3e137a[_0xc549('0x45')]);return _0x4db57c[_0xc549('0x4b')](_0x4fae3d);}})['then'](function(_0x5e3709){if(_0x5e3709){_0x1e8761=_0x5e3709[_0xc549('0x37')];if(!_0x3e137a[_0xc549('0x31')][_0xc549('0x38')]('nolimit')){_0x4fae3d[_0xc549('0x20')]=qs[_0xc549('0x20')](_0x3e137a[_0xc549('0x31')]['limit']);_0x4fae3d[_0xc549('0x1e')]=qs[_0xc549('0x1e')](_0x3e137a[_0xc549('0x31')][_0xc549('0x1e')]);}return _0x4db57c['getFields'](_0x4fae3d);}})[_0xc549('0x25')](function(_0x4042df){if(_0x4042df){return _0x4042df?{'count':_0x1e8761,'rows':_0x4042df}:null;}})[_0xc549('0x25')](respondWithResult(_0x48e925,null))[_0xc549('0x46')](handleError(_0x48e925,null));};exports[_0xc549('0x4e')]=function(_0x605c07,_0x1b6d95,_0x10955a){var _0x51aa22={};var _0x537f72={};var _0x45ca82;var _0x45108f;return db[_0xc549('0x2d')][_0xc549('0x4c')]({'where':{'id':_0x605c07['params']['id']}})['then'](handleEntityNotFound(_0x1b6d95,null))[_0xc549('0x25')](function(_0x5c11d7){if(_0x5c11d7){_0x45ca82=_0x5c11d7;_0x537f72[_0xc549('0x30')]=_[_0xc549('0x32')](db[_0xc549('0x4d')]['rawAttributes']);_0x537f72[_0xc549('0x31')]=_['keys'](_0x605c07['query']);_0x537f72['filters']=_[_0xc549('0x34')](_0x537f72['model'],_0x537f72[_0xc549('0x31')]);_0x51aa22[_0xc549('0x35')]=_[_0xc549('0x34')](_0x537f72['model'],qs[_0xc549('0x36')](_0x605c07['query'][_0xc549('0x36')]));_0x51aa22['attributes']=_0x51aa22[_0xc549('0x35')]['length']?_0x51aa22[_0xc549('0x35')]:_0x537f72[_0xc549('0x30')];_0x51aa22[_0xc549('0x3a')]=qs['sort'](_0x605c07[_0xc549('0x31')][_0xc549('0x3b')]);_0x51aa22[_0xc549('0x3c')]=qs[_0xc549('0x33')](_[_0xc549('0x3d')](_0x605c07[_0xc549('0x31')],_0x537f72['filters']));if(_0x605c07['query'][_0xc549('0x3f')]){_0x51aa22['where']=_[_0xc549('0x40')](_0x51aa22['where'],{'$or':_[_0xc549('0x2c')](_0x51aa22[_0xc549('0x35')],function(_0x429d4d){var _0x3c9fd2={};_0x3c9fd2[_0x429d4d]={'$like':'%'+_0x605c07[_0xc549('0x31')][_0xc549('0x3f')]+'%'};return _0x3c9fd2;})});}_0x51aa22=_[_0xc549('0x40')]({},_0x51aa22,_0x605c07[_0xc549('0x45')]);return _0x45ca82[_0xc549('0x4e')](_0x51aa22);}})[_0xc549('0x25')](function(_0x2cda7f){if(_0x2cda7f){_0x45108f=_0x2cda7f[_0xc549('0x37')];if(!_0x605c07['query'][_0xc549('0x38')](_0xc549('0x39'))){_0x51aa22[_0xc549('0x20')]=qs[_0xc549('0x20')](_0x605c07[_0xc549('0x31')][_0xc549('0x20')]);_0x51aa22[_0xc549('0x1e')]=qs['offset'](_0x605c07[_0xc549('0x31')]['offset']);}return _0x45ca82[_0xc549('0x4e')](_0x51aa22);}})['then'](function(_0x5bc121){if(_0x5bc121){return _0x5bc121?{'count':_0x45108f,'rows':_0x5bc121}:null;}})['then'](respondWithResult(_0x1b6d95,null))['catch'](handleError(_0x1b6d95,null));};exports['getDescriptions']=function(_0x2ae888,_0x5e7627,_0x150722){var _0x21f194={};var _0x4d98a8={};var _0x234484;var _0x752090;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2ae888[_0xc549('0x4a')]['id']}})[_0xc549('0x25')](handleEntityNotFound(_0x5e7627,null))[_0xc549('0x25')](function(_0x4c427d){if(_0x4c427d){_0x234484=_0x4c427d;_0x4d98a8[_0xc549('0x30')]=_[_0xc549('0x32')](db['ZendeskField']['rawAttributes']);_0x4d98a8['query']=_[_0xc549('0x32')](_0x2ae888[_0xc549('0x31')]);_0x4d98a8[_0xc549('0x33')]=_[_0xc549('0x34')](_0x4d98a8[_0xc549('0x30')],_0x4d98a8[_0xc549('0x31')]);_0x21f194[_0xc549('0x35')]=_[_0xc549('0x34')](_0x4d98a8[_0xc549('0x30')],qs['fields'](_0x2ae888['query'][_0xc549('0x36')]));_0x21f194['attributes']=_0x21f194[_0xc549('0x35')][_0xc549('0x37')]?_0x21f194['attributes']:_0x4d98a8['model'];_0x21f194['order']=qs[_0xc549('0x3b')](_0x2ae888[_0xc549('0x31')][_0xc549('0x3b')]);_0x21f194[_0xc549('0x3c')]=qs['filters'](_[_0xc549('0x3d')](_0x2ae888[_0xc549('0x31')],_0x4d98a8[_0xc549('0x33')]));if(_0x2ae888[_0xc549('0x31')][_0xc549('0x3f')]){_0x21f194[_0xc549('0x3c')]=_[_0xc549('0x40')](_0x21f194[_0xc549('0x3c')],{'$or':_['map'](_0x21f194[_0xc549('0x35')],function(_0x282659){var _0x11c35d={};_0x11c35d[_0x282659]={'$like':'%'+_0x2ae888['query'][_0xc549('0x3f')]+'%'};return _0x11c35d;})});}_0x21f194=_[_0xc549('0x40')]({},_0x21f194,_0x2ae888['options']);return _0x234484[_0xc549('0x4f')](_0x21f194);}})[_0xc549('0x25')](function(_0x18da4c){if(_0x18da4c){_0x752090=_0x18da4c['length'];if(!_0x2ae888[_0xc549('0x31')][_0xc549('0x38')](_0xc549('0x39'))){_0x21f194[_0xc549('0x20')]=qs[_0xc549('0x20')](_0x2ae888[_0xc549('0x31')][_0xc549('0x20')]);_0x21f194[_0xc549('0x1e')]=qs[_0xc549('0x1e')](_0x2ae888[_0xc549('0x31')][_0xc549('0x1e')]);}return _0x234484['getDescriptions'](_0x21f194);}})[_0xc549('0x25')](function(_0x2536a9){if(_0x2536a9){return _0x2536a9?{'count':_0x752090,'rows':_0x2536a9}:null;}})[_0xc549('0x25')](respondWithResult(_0x5e7627,null))[_0xc549('0x46')](handleError(_0x5e7627,null));};exports[_0xc549('0x50')]=function(_0x3f58b6,_0x4ab27d,_0x58af76){var _0x45d27f={};var _0x3dd4d9={};var _0x15ca50;var _0x1e0697;return db[_0xc549('0x2d')][_0xc549('0x4c')]({'where':{'id':_0x3f58b6[_0xc549('0x4a')]['id']}})[_0xc549('0x25')](handleEntityNotFound(_0x4ab27d,null))['then'](function(_0x1fca3c){if(_0x1fca3c){_0x15ca50=_0x1fca3c;_0x3dd4d9[_0xc549('0x30')]=_['keys'](db[_0xc549('0x51')][_0xc549('0x44')]);_0x3dd4d9[_0xc549('0x31')]=_[_0xc549('0x32')](_0x3f58b6[_0xc549('0x31')]);_0x3dd4d9[_0xc549('0x33')]=_[_0xc549('0x34')](_0x3dd4d9[_0xc549('0x30')],_0x3dd4d9[_0xc549('0x31')]);_0x45d27f[_0xc549('0x35')]=_[_0xc549('0x34')](_0x3dd4d9['model'],qs[_0xc549('0x36')](_0x3f58b6[_0xc549('0x31')][_0xc549('0x36')]));_0x45d27f['attributes']=_0x45d27f[_0xc549('0x35')][_0xc549('0x37')]?_0x45d27f['attributes']:_0x3dd4d9[_0xc549('0x30')];_0x45d27f[_0xc549('0x3a')]=qs['sort'](_0x3f58b6[_0xc549('0x31')][_0xc549('0x3b')]);_0x45d27f['where']=qs[_0xc549('0x33')](_[_0xc549('0x3d')](_0x3f58b6[_0xc549('0x31')],_0x3dd4d9[_0xc549('0x33')]));if(_0x3f58b6[_0xc549('0x31')]['filter']){_0x45d27f[_0xc549('0x3c')]=_[_0xc549('0x40')](_0x45d27f[_0xc549('0x3c')],{'$or':_['map'](_0x45d27f[_0xc549('0x35')],function(_0x1fcbf8){var _0x1bea41={};_0x1bea41[_0x1fcbf8]={'$like':'%'+_0x3f58b6[_0xc549('0x31')][_0xc549('0x3f')]+'%'};return _0x1bea41;})});}_0x45d27f=_[_0xc549('0x40')]({},_0x45d27f,_0x3f58b6[_0xc549('0x45')]);return _0x15ca50['getTags'](_0x45d27f);}})[_0xc549('0x25')](function(_0x193314){if(_0x193314){_0x1e0697=_0x193314[_0xc549('0x37')];if(!_0x3f58b6[_0xc549('0x31')]['hasOwnProperty'](_0xc549('0x39'))){_0x45d27f['limit']=qs[_0xc549('0x20')](_0x3f58b6['query'][_0xc549('0x20')]);_0x45d27f[_0xc549('0x1e')]=qs['offset'](_0x3f58b6[_0xc549('0x31')][_0xc549('0x1e')]);}return _0x15ca50[_0xc549('0x50')](_0x45d27f);}})[_0xc549('0x25')](function(_0x37f04d){if(_0x37f04d){return _0x37f04d?{'count':_0x1e0697,'rows':_0x37f04d}:null;}})[_0xc549('0x25')](respondWithResult(_0x4ab27d,null))['catch'](handleError(_0x4ab27d,null));};exports[_0xc549('0x52')]=function(_0x3d7b75,_0x1817a5,_0x39c28d){if(_0x3d7b75['body']['id']){delete _0x3d7b75[_0xc549('0x48')]['id'];}return db[_0xc549('0x2d')][_0xc549('0x4c')]({'where':{'id':_0x3d7b75[_0xc549('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1817a5,null))['then'](function(_0x305092){if(_0x305092){return _0x305092[_0xc549('0x52')](_0x3d7b75[_0xc549('0x48')][_0xc549('0x53')]||[]);}return null;})[_0xc549('0x25')](respondWithResult(_0x1817a5,null))[_0xc549('0x46')](handleError(_0x1817a5,null));}; \ No newline at end of file +var _0xe463=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','options','ZendeskConfiguration','includeAll','include','rows','catch','params','find','body','getFields','order','pick','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xe463,0xe5));var _0x3e46=function(_0x29884b,_0x463f71){_0x29884b=_0x29884b-0x0;var _0x1b88c6=_0xe463[_0x29884b];return _0x1b88c6;};'use strict';var emlformat=require(_0x3e46('0x0'));var rimraf=require(_0x3e46('0x1'));var zipdir=require(_0x3e46('0x2'));var jsonpatch=require(_0x3e46('0x3'));var rp=require(_0x3e46('0x4'));var moment=require(_0x3e46('0x5'));var BPromise=require(_0x3e46('0x6'));var Mustache=require(_0x3e46('0x7'));var util=require('util');var path=require(_0x3e46('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3e46('0x9'));var fs=require('fs');var fs_extra=require(_0x3e46('0xa'));var _=require(_0x3e46('0xb'));var squel=require(_0x3e46('0xc'));var crypto=require(_0x3e46('0xd'));var jsforce=require(_0x3e46('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3e46('0xf'));var querystring=require(_0x3e46('0x10'));var Papa=require(_0x3e46('0x11'));var Redis=require(_0x3e46('0x12'));var authService=require(_0x3e46('0x13'));var qs=require(_0x3e46('0x14'));var as=require(_0x3e46('0x15'));var hardwareService=require(_0x3e46('0x16'));var logger=require('../../config/logger')(_0x3e46('0x17'));var utils=require(_0x3e46('0x18'));var config=require(_0x3e46('0x19'));var licenseUtil=require(_0x3e46('0x1a'));var db=require(_0x3e46('0x1b'))['db'];function respondWithStatusCode(_0x143a1,_0xaa3669){_0xaa3669=_0xaa3669||0xcc;return function(_0x5db855){if(_0x5db855){return _0x143a1[_0x3e46('0x1c')](_0xaa3669);}return _0x143a1[_0x3e46('0x1d')](_0xaa3669)[_0x3e46('0x1e')]();};}function respondWithResult(_0x28f590,_0x42d42c){_0x42d42c=_0x42d42c||0xc8;return function(_0x3632b0){if(_0x3632b0){return _0x28f590[_0x3e46('0x1d')](_0x42d42c)[_0x3e46('0x1f')](_0x3632b0);}};}function respondWithFilteredResult(_0x59f2cd,_0x2d37ff){return function(_0x28b1c2){if(_0x28b1c2){var _0x29b035=typeof _0x2d37ff[_0x3e46('0x20')]===_0x3e46('0x21')&&typeof _0x2d37ff['limit']===_0x3e46('0x21');var _0x174114=_0x28b1c2[_0x3e46('0x22')];var _0xae7040=_0x29b035?0x0:_0x2d37ff[_0x3e46('0x20')];var _0x3aa324=_0x29b035?_0x28b1c2[_0x3e46('0x22')]:_0x2d37ff[_0x3e46('0x20')]+_0x2d37ff['limit'];var _0x56d3f5;if(_0x3aa324>=_0x174114){_0x3aa324=_0x174114;_0x56d3f5=0xc8;}else{_0x56d3f5=0xce;}_0x59f2cd['status'](_0x56d3f5);return _0x59f2cd[_0x3e46('0x23')](_0x3e46('0x24'),_0xae7040+'-'+_0x3aa324+'/'+_0x174114)[_0x3e46('0x1f')](_0x28b1c2);}return null;};}function patchUpdates(_0x14c411){return function(_0x45c4b2){try{jsonpatch[_0x3e46('0x25')](_0x45c4b2,_0x14c411,!![]);}catch(_0x1bc273){return BPromise['reject'](_0x1bc273);}return _0x45c4b2[_0x3e46('0x26')]();};}function saveUpdates(_0x512cd3,_0x3ff793){return function(_0x3e7ff9){if(_0x3e7ff9){return _0x3e7ff9[_0x3e46('0x27')](_0x512cd3)[_0x3e46('0x28')](function(_0x379517){return _0x379517;});}return null;};}function removeEntity(_0x2ca352,_0x316cb1){return function(_0xe9b236){if(_0xe9b236){return _0xe9b236[_0x3e46('0x29')]()[_0x3e46('0x28')](function(){_0x2ca352[_0x3e46('0x1d')](0xcc)[_0x3e46('0x1e')]();});}};}function handleEntityNotFound(_0x57ac28,_0x494b27){return function(_0x112b49){if(!_0x112b49){_0x57ac28[_0x3e46('0x1c')](0x194);}return _0x112b49;};}function handleError(_0x63db4,_0x3e5d9f){_0x3e5d9f=_0x3e5d9f||0x1f4;return function(_0x567de4){logger[_0x3e46('0x2a')](_0x567de4[_0x3e46('0x2b')]);if(_0x567de4['name']){delete _0x567de4[_0x3e46('0x2c')];}_0x63db4[_0x3e46('0x1d')](_0x3e5d9f)['send'](_0x567de4);};}exports[_0x3e46('0x2d')]=function(_0x1d7eb0,_0x28d5b3){var _0x4ec658={},_0x306f8c={},_0x186182={'count':0x0,'rows':[]};var _0x31ebf6=_[_0x3e46('0x2e')](db['ZendeskConfiguration'][_0x3e46('0x2f')],function(_0xb68991){return{'name':_0xb68991['fieldName'],'type':_0xb68991[_0x3e46('0x30')]['key']};});_0x306f8c[_0x3e46('0x31')]=_[_0x3e46('0x2e')](_0x31ebf6,_0x3e46('0x2c'));_0x306f8c['query']=_[_0x3e46('0x32')](_0x1d7eb0[_0x3e46('0x33')]);_0x306f8c[_0x3e46('0x34')]=_[_0x3e46('0x35')](_0x306f8c[_0x3e46('0x31')],_0x306f8c[_0x3e46('0x33')]);_0x4ec658[_0x3e46('0x36')]=_[_0x3e46('0x35')](_0x306f8c['model'],qs[_0x3e46('0x37')](_0x1d7eb0['query'][_0x3e46('0x37')]));_0x4ec658[_0x3e46('0x36')]=_0x4ec658['attributes'][_0x3e46('0x38')]?_0x4ec658[_0x3e46('0x36')]:_0x306f8c[_0x3e46('0x31')];if(!_0x1d7eb0[_0x3e46('0x33')][_0x3e46('0x39')](_0x3e46('0x3a'))){_0x4ec658[_0x3e46('0x3b')]=qs[_0x3e46('0x3b')](_0x1d7eb0[_0x3e46('0x33')][_0x3e46('0x3b')]);_0x4ec658[_0x3e46('0x20')]=qs[_0x3e46('0x20')](_0x1d7eb0[_0x3e46('0x33')][_0x3e46('0x20')]);}_0x4ec658['order']=qs[_0x3e46('0x3c')](_0x1d7eb0[_0x3e46('0x33')][_0x3e46('0x3c')]);_0x4ec658[_0x3e46('0x3d')]=qs['filters'](_['pick'](_0x1d7eb0[_0x3e46('0x33')],_0x306f8c[_0x3e46('0x34')]),_0x31ebf6);if(_0x1d7eb0[_0x3e46('0x33')][_0x3e46('0x3e')]){_0x4ec658[_0x3e46('0x3d')]=_[_0x3e46('0x3f')](_0x4ec658['where'],{'$or':_['map'](_0x31ebf6,function(_0x54fa1a){if(_0x54fa1a['type']!=='VIRTUAL'){var _0x359ff1={};_0x359ff1[_0x54fa1a[_0x3e46('0x2c')]]={'$like':'%'+_0x1d7eb0[_0x3e46('0x33')][_0x3e46('0x3e')]+'%'};return _0x359ff1;}})});}_0x4ec658=_[_0x3e46('0x3f')]({},_0x4ec658,_0x1d7eb0[_0x3e46('0x40')]);var _0x6840b3={'where':_0x4ec658[_0x3e46('0x3d')]};return db[_0x3e46('0x41')][_0x3e46('0x22')](_0x6840b3)[_0x3e46('0x28')](function(_0x4eb3f3){_0x186182[_0x3e46('0x22')]=_0x4eb3f3;if(_0x1d7eb0[_0x3e46('0x33')][_0x3e46('0x42')]){_0x4ec658[_0x3e46('0x43')]=[{'all':!![]}];}return db[_0x3e46('0x41')]['findAll'](_0x4ec658);})[_0x3e46('0x28')](function(_0x132061){_0x186182[_0x3e46('0x44')]=_0x132061;return _0x186182;})[_0x3e46('0x28')](respondWithFilteredResult(_0x28d5b3,_0x4ec658))[_0x3e46('0x45')](handleError(_0x28d5b3,null));};exports['show']=function(_0x21e66d,_0x591d84){var _0x51c9c7={'raw':![],'where':{'id':_0x21e66d[_0x3e46('0x46')]['id']}},_0x9f18b0={};_0x9f18b0[_0x3e46('0x31')]=_['keys'](db['ZendeskConfiguration'][_0x3e46('0x2f')]);_0x9f18b0['query']=_[_0x3e46('0x32')](_0x21e66d[_0x3e46('0x33')]);_0x9f18b0[_0x3e46('0x34')]=_[_0x3e46('0x35')](_0x9f18b0[_0x3e46('0x31')],_0x9f18b0['query']);_0x51c9c7[_0x3e46('0x36')]=_[_0x3e46('0x35')](_0x9f18b0[_0x3e46('0x31')],qs['fields'](_0x21e66d[_0x3e46('0x33')]['fields']));_0x51c9c7[_0x3e46('0x36')]=_0x51c9c7[_0x3e46('0x36')]['length']?_0x51c9c7[_0x3e46('0x36')]:_0x9f18b0[_0x3e46('0x31')];if(_0x21e66d[_0x3e46('0x33')][_0x3e46('0x42')]){_0x51c9c7['include']=[{'all':!![]}];}_0x51c9c7=_[_0x3e46('0x3f')]({},_0x51c9c7,_0x21e66d[_0x3e46('0x40')]);return db[_0x3e46('0x41')][_0x3e46('0x47')](_0x51c9c7)['then'](handleEntityNotFound(_0x591d84,null))['then'](respondWithResult(_0x591d84,null))[_0x3e46('0x45')](handleError(_0x591d84,null));};exports['create']=function(_0x44ae01,_0x237cc9){return db[_0x3e46('0x41')]['create'](_0x44ae01['body'],{})[_0x3e46('0x28')](respondWithResult(_0x237cc9,0xc9))['catch'](handleError(_0x237cc9,null));};exports['update']=function(_0x469362,_0x103025){if(_0x469362[_0x3e46('0x48')]['id']){delete _0x469362[_0x3e46('0x48')]['id'];}return db[_0x3e46('0x41')][_0x3e46('0x47')]({'where':{'id':_0x469362[_0x3e46('0x46')]['id']}})[_0x3e46('0x28')](handleEntityNotFound(_0x103025,null))[_0x3e46('0x28')](saveUpdates(_0x469362[_0x3e46('0x48')],null))[_0x3e46('0x28')](respondWithResult(_0x103025,null))[_0x3e46('0x45')](handleError(_0x103025,null));};exports[_0x3e46('0x29')]=function(_0x7d9c2a,_0x5a89ae){return db[_0x3e46('0x41')][_0x3e46('0x47')]({'where':{'id':_0x7d9c2a[_0x3e46('0x46')]['id']}})[_0x3e46('0x28')](handleEntityNotFound(_0x5a89ae,null))[_0x3e46('0x28')](removeEntity(_0x5a89ae,null))[_0x3e46('0x45')](handleError(_0x5a89ae,null));};exports[_0x3e46('0x49')]=function(_0x582865,_0x567f23,_0x1e4214){var _0x423b45={};var _0x592a56={};var _0x14b465;var _0x3ca036;return db[_0x3e46('0x41')]['findOne']({'where':{'id':_0x582865['params']['id']}})[_0x3e46('0x28')](handleEntityNotFound(_0x567f23,null))[_0x3e46('0x28')](function(_0x5b62a5){if(_0x5b62a5){_0x14b465=_0x5b62a5;_0x592a56[_0x3e46('0x31')]=_['keys'](db['ZendeskField'][_0x3e46('0x2f')]);_0x592a56[_0x3e46('0x33')]=_[_0x3e46('0x32')](_0x582865[_0x3e46('0x33')]);_0x592a56[_0x3e46('0x34')]=_[_0x3e46('0x35')](_0x592a56[_0x3e46('0x31')],_0x592a56[_0x3e46('0x33')]);_0x423b45[_0x3e46('0x36')]=_[_0x3e46('0x35')](_0x592a56[_0x3e46('0x31')],qs[_0x3e46('0x37')](_0x582865[_0x3e46('0x33')][_0x3e46('0x37')]));_0x423b45['attributes']=_0x423b45['attributes'][_0x3e46('0x38')]?_0x423b45[_0x3e46('0x36')]:_0x592a56[_0x3e46('0x31')];_0x423b45[_0x3e46('0x4a')]=qs[_0x3e46('0x3c')](_0x582865['query']['sort']);_0x423b45['where']=qs[_0x3e46('0x34')](_[_0x3e46('0x4b')](_0x582865['query'],_0x592a56[_0x3e46('0x34')]));if(_0x582865[_0x3e46('0x33')][_0x3e46('0x3e')]){_0x423b45['where']=_['merge'](_0x423b45[_0x3e46('0x3d')],{'$or':_[_0x3e46('0x2e')](_0x423b45[_0x3e46('0x36')],function(_0x56c9a2){var _0xbb9c26={};_0xbb9c26[_0x56c9a2]={'$like':'%'+_0x582865[_0x3e46('0x33')]['filter']+'%'};return _0xbb9c26;})});}_0x423b45=_[_0x3e46('0x3f')]({},_0x423b45,_0x582865[_0x3e46('0x40')]);return _0x14b465[_0x3e46('0x49')](_0x423b45);}})[_0x3e46('0x28')](function(_0xdcf9c0){if(_0xdcf9c0){_0x3ca036=_0xdcf9c0[_0x3e46('0x38')];if(!_0x582865[_0x3e46('0x33')][_0x3e46('0x39')](_0x3e46('0x3a'))){_0x423b45[_0x3e46('0x3b')]=qs[_0x3e46('0x3b')](_0x582865[_0x3e46('0x33')][_0x3e46('0x3b')]);_0x423b45['offset']=qs[_0x3e46('0x20')](_0x582865[_0x3e46('0x33')][_0x3e46('0x20')]);}return _0x14b465['getFields'](_0x423b45);}})['then'](function(_0x1ec461){if(_0x1ec461){return _0x1ec461?{'count':_0x3ca036,'rows':_0x1ec461}:null;}})[_0x3e46('0x28')](respondWithResult(_0x567f23,null))[_0x3e46('0x45')](handleError(_0x567f23,null));};exports[_0x3e46('0x4c')]=function(_0x51a430,_0xc9276,_0xd605cb){var _0x5baf4c={};var _0x27301d={};var _0x6b06bc;var _0x1f756e;return db[_0x3e46('0x41')][_0x3e46('0x4d')]({'where':{'id':_0x51a430[_0x3e46('0x46')]['id']}})[_0x3e46('0x28')](handleEntityNotFound(_0xc9276,null))[_0x3e46('0x28')](function(_0x1fcdac){if(_0x1fcdac){_0x6b06bc=_0x1fcdac;_0x27301d[_0x3e46('0x31')]=_[_0x3e46('0x32')](db[_0x3e46('0x4e')][_0x3e46('0x2f')]);_0x27301d[_0x3e46('0x33')]=_[_0x3e46('0x32')](_0x51a430['query']);_0x27301d[_0x3e46('0x34')]=_[_0x3e46('0x35')](_0x27301d['model'],_0x27301d['query']);_0x5baf4c[_0x3e46('0x36')]=_[_0x3e46('0x35')](_0x27301d[_0x3e46('0x31')],qs[_0x3e46('0x37')](_0x51a430[_0x3e46('0x33')][_0x3e46('0x37')]));_0x5baf4c[_0x3e46('0x36')]=_0x5baf4c['attributes'][_0x3e46('0x38')]?_0x5baf4c['attributes']:_0x27301d[_0x3e46('0x31')];_0x5baf4c[_0x3e46('0x4a')]=qs[_0x3e46('0x3c')](_0x51a430[_0x3e46('0x33')][_0x3e46('0x3c')]);_0x5baf4c[_0x3e46('0x3d')]=qs[_0x3e46('0x34')](_[_0x3e46('0x4b')](_0x51a430[_0x3e46('0x33')],_0x27301d[_0x3e46('0x34')]));if(_0x51a430[_0x3e46('0x33')][_0x3e46('0x3e')]){_0x5baf4c[_0x3e46('0x3d')]=_[_0x3e46('0x3f')](_0x5baf4c['where'],{'$or':_['map'](_0x5baf4c['attributes'],function(_0x17038d){var _0x45ae29={};_0x45ae29[_0x17038d]={'$like':'%'+_0x51a430[_0x3e46('0x33')]['filter']+'%'};return _0x45ae29;})});}_0x5baf4c=_['merge']({},_0x5baf4c,_0x51a430[_0x3e46('0x40')]);return _0x6b06bc['getSubjects'](_0x5baf4c);}})['then'](function(_0x248d6d){if(_0x248d6d){_0x1f756e=_0x248d6d['length'];if(!_0x51a430[_0x3e46('0x33')][_0x3e46('0x39')](_0x3e46('0x3a'))){_0x5baf4c[_0x3e46('0x3b')]=qs['limit'](_0x51a430[_0x3e46('0x33')]['limit']);_0x5baf4c[_0x3e46('0x20')]=qs[_0x3e46('0x20')](_0x51a430[_0x3e46('0x33')][_0x3e46('0x20')]);}return _0x6b06bc[_0x3e46('0x4c')](_0x5baf4c);}})[_0x3e46('0x28')](function(_0x48fef3){if(_0x48fef3){return _0x48fef3?{'count':_0x1f756e,'rows':_0x48fef3}:null;}})[_0x3e46('0x28')](respondWithResult(_0xc9276,null))[_0x3e46('0x45')](handleError(_0xc9276,null));};exports['getDescriptions']=function(_0x244505,_0x2604d5,_0xa3ac55){var _0x570bab={};var _0x232ca0={};var _0x2a5010;var _0x2bb143;return db['ZendeskConfiguration'][_0x3e46('0x4d')]({'where':{'id':_0x244505[_0x3e46('0x46')]['id']}})[_0x3e46('0x28')](handleEntityNotFound(_0x2604d5,null))[_0x3e46('0x28')](function(_0xdd6cbe){if(_0xdd6cbe){_0x2a5010=_0xdd6cbe;_0x232ca0[_0x3e46('0x31')]=_['keys'](db[_0x3e46('0x4e')]['rawAttributes']);_0x232ca0[_0x3e46('0x33')]=_[_0x3e46('0x32')](_0x244505[_0x3e46('0x33')]);_0x232ca0[_0x3e46('0x34')]=_[_0x3e46('0x35')](_0x232ca0[_0x3e46('0x31')],_0x232ca0[_0x3e46('0x33')]);_0x570bab[_0x3e46('0x36')]=_[_0x3e46('0x35')](_0x232ca0[_0x3e46('0x31')],qs[_0x3e46('0x37')](_0x244505['query'][_0x3e46('0x37')]));_0x570bab['attributes']=_0x570bab[_0x3e46('0x36')][_0x3e46('0x38')]?_0x570bab[_0x3e46('0x36')]:_0x232ca0['model'];_0x570bab[_0x3e46('0x4a')]=qs[_0x3e46('0x3c')](_0x244505[_0x3e46('0x33')][_0x3e46('0x3c')]);_0x570bab[_0x3e46('0x3d')]=qs[_0x3e46('0x34')](_[_0x3e46('0x4b')](_0x244505[_0x3e46('0x33')],_0x232ca0[_0x3e46('0x34')]));if(_0x244505[_0x3e46('0x33')][_0x3e46('0x3e')]){_0x570bab[_0x3e46('0x3d')]=_[_0x3e46('0x3f')](_0x570bab[_0x3e46('0x3d')],{'$or':_[_0x3e46('0x2e')](_0x570bab[_0x3e46('0x36')],function(_0x29ae53){var _0x15394e={};_0x15394e[_0x29ae53]={'$like':'%'+_0x244505[_0x3e46('0x33')][_0x3e46('0x3e')]+'%'};return _0x15394e;})});}_0x570bab=_['merge']({},_0x570bab,_0x244505[_0x3e46('0x40')]);return _0x2a5010['getDescriptions'](_0x570bab);}})[_0x3e46('0x28')](function(_0x2bf6eb){if(_0x2bf6eb){_0x2bb143=_0x2bf6eb[_0x3e46('0x38')];if(!_0x244505[_0x3e46('0x33')][_0x3e46('0x39')](_0x3e46('0x3a'))){_0x570bab[_0x3e46('0x3b')]=qs[_0x3e46('0x3b')](_0x244505[_0x3e46('0x33')][_0x3e46('0x3b')]);_0x570bab['offset']=qs['offset'](_0x244505[_0x3e46('0x33')][_0x3e46('0x20')]);}return _0x2a5010[_0x3e46('0x4f')](_0x570bab);}})['then'](function(_0x56c067){if(_0x56c067){return _0x56c067?{'count':_0x2bb143,'rows':_0x56c067}:null;}})['then'](respondWithResult(_0x2604d5,null))[_0x3e46('0x45')](handleError(_0x2604d5,null));};exports[_0x3e46('0x50')]=function(_0x86df31,_0x21bf1a,_0x3908b1){var _0x2cff7a={};var _0x1d348f={};var _0x38d883;var _0x32a0f5;return db[_0x3e46('0x41')][_0x3e46('0x4d')]({'where':{'id':_0x86df31[_0x3e46('0x46')]['id']}})['then'](handleEntityNotFound(_0x21bf1a,null))[_0x3e46('0x28')](function(_0x3a9e50){if(_0x3a9e50){_0x38d883=_0x3a9e50;_0x1d348f[_0x3e46('0x31')]=_[_0x3e46('0x32')](db[_0x3e46('0x51')]['rawAttributes']);_0x1d348f[_0x3e46('0x33')]=_[_0x3e46('0x32')](_0x86df31[_0x3e46('0x33')]);_0x1d348f['filters']=_[_0x3e46('0x35')](_0x1d348f[_0x3e46('0x31')],_0x1d348f[_0x3e46('0x33')]);_0x2cff7a[_0x3e46('0x36')]=_[_0x3e46('0x35')](_0x1d348f['model'],qs[_0x3e46('0x37')](_0x86df31[_0x3e46('0x33')][_0x3e46('0x37')]));_0x2cff7a[_0x3e46('0x36')]=_0x2cff7a[_0x3e46('0x36')]['length']?_0x2cff7a['attributes']:_0x1d348f['model'];_0x2cff7a['order']=qs['sort'](_0x86df31[_0x3e46('0x33')][_0x3e46('0x3c')]);_0x2cff7a['where']=qs[_0x3e46('0x34')](_[_0x3e46('0x4b')](_0x86df31[_0x3e46('0x33')],_0x1d348f[_0x3e46('0x34')]));if(_0x86df31[_0x3e46('0x33')]['filter']){_0x2cff7a[_0x3e46('0x3d')]=_['merge'](_0x2cff7a['where'],{'$or':_[_0x3e46('0x2e')](_0x2cff7a[_0x3e46('0x36')],function(_0x20a68b){var _0x31f289={};_0x31f289[_0x20a68b]={'$like':'%'+_0x86df31[_0x3e46('0x33')][_0x3e46('0x3e')]+'%'};return _0x31f289;})});}_0x2cff7a=_[_0x3e46('0x3f')]({},_0x2cff7a,_0x86df31['options']);return _0x38d883[_0x3e46('0x50')](_0x2cff7a);}})['then'](function(_0x2f90e6){if(_0x2f90e6){_0x32a0f5=_0x2f90e6[_0x3e46('0x38')];if(!_0x86df31['query']['hasOwnProperty'](_0x3e46('0x3a'))){_0x2cff7a['limit']=qs['limit'](_0x86df31[_0x3e46('0x33')]['limit']);_0x2cff7a[_0x3e46('0x20')]=qs[_0x3e46('0x20')](_0x86df31[_0x3e46('0x33')][_0x3e46('0x20')]);}return _0x38d883[_0x3e46('0x50')](_0x2cff7a);}})[_0x3e46('0x28')](function(_0x267245){if(_0x267245){return _0x267245?{'count':_0x32a0f5,'rows':_0x267245}:null;}})[_0x3e46('0x28')](respondWithResult(_0x21bf1a,null))[_0x3e46('0x45')](handleError(_0x21bf1a,null));};exports[_0x3e46('0x52')]=function(_0x3fa320,_0xce62f,_0x38abd8){if(_0x3fa320[_0x3e46('0x48')]['id']){delete _0x3fa320[_0x3e46('0x48')]['id'];}return db[_0x3e46('0x41')]['findOne']({'where':{'id':_0x3fa320['params']['id']}})[_0x3e46('0x28')](handleEntityNotFound(_0xce62f,null))[_0x3e46('0x28')](function(_0x4edff5){if(_0x4edff5){return _0x4edff5[_0x3e46('0x52')](_0x3fa320[_0x3e46('0x48')][_0x3e46('0x53')]||[]);}return null;})['then'](respondWithResult(_0xce62f,null))[_0x3e46('0x45')](handleError(_0xce62f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index b7071d5..7f5925c 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 _0x5423=['request-promise','path','rimraf','../../config/environment','exports','define','ZendeskConfiguration','lodash','util','api','moment'];(function(_0x1b2816,_0x57cde7){var _0x5e2cee=function(_0x47f234){while(--_0x47f234){_0x1b2816['push'](_0x1b2816['shift']());}};_0x5e2cee(++_0x57cde7);}(_0x5423,0xe3));var _0x3542=function(_0x11088e,_0x5a5df3){_0x11088e=_0x11088e-0x0;var _0x3d8f41=_0x5423[_0x11088e];return _0x3d8f41;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x373d=['define','ZendeskConfiguration','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x373d,0x1e2));var _0xd373=function(_0x1b046f,_0x8e5fa6){_0x1b046f=_0x1b046f-0x0;var _0x1f6c8f=_0x373d[_0x1b046f];return _0x1f6c8f;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var logger=require(_0xd373('0x1'))(_0xd373('0x2'));var moment=require(_0xd373('0x3'));var BPromise=require(_0xd373('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd373('0x5'));var rimraf=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x31a0fb,_0x3e4443){return _0x31a0fb[_0xd373('0x8')](_0xd373('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 7fa463d..0927a8e 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 _0x7199=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2fa2aa,_0x18205f){var _0x3fb7db=function(_0x1fe65f){while(--_0x1fe65f){_0x2fa2aa['push'](_0x2fa2aa['shift']());}};_0x3fb7db(++_0x18205f);}(_0x7199,0xef));var _0x9719=function(_0x47b0cd,_0x159049){_0x47b0cd=_0x47b0cd-0x0;var _0x20fcd5=_0x7199[_0x47b0cd];return _0x20fcd5;};'use strict';var _=require('lodash');var util=require(_0x9719('0x0'));var moment=require(_0x9719('0x1'));var BPromise=require(_0x9719('0x2'));var rs=require(_0x9719('0x3'));var fs=require('fs');var Redis=require(_0x9719('0x4'));var db=require(_0x9719('0x5'))['db'];var utils=require(_0x9719('0x6'));var logger=require('../../config/logger')(_0x9719('0x7'));var config=require(_0x9719('0x8'));var jayson=require(_0x9719('0x9'));var client=jayson[_0x9719('0xa')][_0x9719('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19fc40,_0x5f4c5c,_0x375e5d){return new BPromise(function(_0x1418a2,_0x3326e1){return client[_0x9719('0xc')](_0x19fc40,_0x375e5d)[_0x9719('0xd')](function(_0x4b1871){logger['info'](_0x9719('0xe'),_0x5f4c5c,_0x9719('0xf'));logger[_0x9719('0x10')](_0x9719('0x11'),_0x5f4c5c,_0x9719('0xf'),JSON['stringify'](_0x4b1871));if(_0x4b1871[_0x9719('0x12')]){if(_0x4b1871[_0x9719('0x12')][_0x9719('0x13')]===0x1f4){logger[_0x9719('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5f4c5c,_0x4b1871[_0x9719('0x12')][_0x9719('0x14')]);return _0x3326e1(_0x4b1871[_0x9719('0x12')]['message']);}logger[_0x9719('0x12')](_0x9719('0xe'),_0x5f4c5c,_0x4b1871[_0x9719('0x12')][_0x9719('0x14')]);return _0x1418a2(_0x4b1871[_0x9719('0x12')]['message']);}else{logger['info'](_0x9719('0xe'),_0x5f4c5c,'request\x20sent');_0x1418a2(_0x4b1871[_0x9719('0x15')][_0x9719('0x14')]);}})[_0x9719('0x16')](function(_0x3c725e){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5f4c5c,_0x3c725e);_0x3326e1(_0x3c725e);});});} \ No newline at end of file +var _0x386e=['result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x386e,0xbe));var _0xe386=function(_0x2a5262,_0x578588){_0x2a5262=_0x2a5262-0x0;var _0x483802=_0x386e[_0x2a5262];return _0x483802;};'use strict';var _=require(_0xe386('0x0'));var util=require(_0xe386('0x1'));var moment=require(_0xe386('0x2'));var BPromise=require('bluebird');var rs=require(_0xe386('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe386('0x4'))['db'];var utils=require(_0xe386('0x5'));var logger=require('../../config/logger')(_0xe386('0x6'));var config=require(_0xe386('0x7'));var jayson=require(_0xe386('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46b45c,_0x26d1f2,_0x3019ae){return new BPromise(function(_0x16ea83,_0x246f44){return client[_0xe386('0x9')](_0x46b45c,_0x3019ae)[_0xe386('0xa')](function(_0x31216d){logger[_0xe386('0xb')](_0xe386('0xc'),_0x26d1f2,_0xe386('0xd'));logger[_0xe386('0xe')](_0xe386('0xf'),_0x26d1f2,_0xe386('0xd'),JSON[_0xe386('0x10')](_0x31216d));if(_0x31216d[_0xe386('0x11')]){if(_0x31216d[_0xe386('0x11')][_0xe386('0x12')]===0x1f4){logger[_0xe386('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x26d1f2,_0x31216d['error'][_0xe386('0x13')]);return _0x246f44(_0x31216d[_0xe386('0x11')][_0xe386('0x13')]);}logger[_0xe386('0x11')](_0xe386('0xc'),_0x26d1f2,_0x31216d[_0xe386('0x11')][_0xe386('0x13')]);return _0x16ea83(_0x31216d[_0xe386('0x11')][_0xe386('0x13')]);}else{logger[_0xe386('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x26d1f2,_0xe386('0xd'));_0x16ea83(_0x31216d[_0xe386('0x14')]['message']);}})['catch'](function(_0x240378){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x26d1f2,_0x240378);_0x246f44(_0x240378);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 6363963..1a58dfa 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 _0x89e6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','post','create','put','/:id','isAuthenticated','update','delete','exports','util','path'];(function(_0x953b7b,_0x5b5dd9){var _0x33d067=function(_0x341851){while(--_0x341851){_0x953b7b['push'](_0x953b7b['shift']());}};_0x33d067(++_0x5b5dd9);}(_0x89e6,0x1a0));var _0x689e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x89e6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x689e('0x0'));var path=require(_0x689e('0x1'));var timeout=require('connect-timeout');var express=require(_0x689e('0x2'));var router=express[_0x689e('0x3')]();var fs_extra=require(_0x689e('0x4'));var auth=require(_0x689e('0x5'));var interaction=require(_0x689e('0x6'));var config=require(_0x689e('0x7'));var controller=require(_0x689e('0x8'));router[_0x689e('0x9')]('/',auth['isAuthenticated'](),controller[_0x689e('0xa')]);router[_0x689e('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x689e('0xb')]('/',auth['isAuthenticated'](),controller[_0x689e('0xc')]);router[_0x689e('0xd')](_0x689e('0xe'),auth[_0x689e('0xf')](),controller[_0x689e('0x10')]);router[_0x689e('0x11')](_0x689e('0xe'),auth[_0x689e('0xf')](),controller['destroy']);module[_0x689e('0x12')]=router; \ No newline at end of file +var _0x2c29=['put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','show','post'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x2c29,0x10a));var _0x92c2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2c29[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x92c2('0x0'));var util=require(_0x92c2('0x1'));var path=require(_0x92c2('0x2'));var timeout=require(_0x92c2('0x3'));var express=require(_0x92c2('0x4'));var router=express[_0x92c2('0x5')]();var fs_extra=require(_0x92c2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x92c2('0x7'));var config=require('../../config/environment');var controller=require(_0x92c2('0x8'));router[_0x92c2('0x9')]('/',auth[_0x92c2('0xa')](),controller[_0x92c2('0xb')]);router[_0x92c2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x92c2('0xc')]);router[_0x92c2('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x92c2('0xe')]('/:id',auth[_0x92c2('0xa')](),controller[_0x92c2('0xf')]);router[_0x92c2('0x10')](_0x92c2('0x11'),auth[_0x92c2('0xa')](),controller[_0x92c2('0x12')]);module[_0x92c2('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 67025a8..754ae64 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 _0x70af=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x70af,0x150));var _0xf70a=function(_0x314810,_0x5d0e31){_0x314810=_0x314810-0x0;var _0xec232d=_0x70af[_0x314810];return _0xec232d;};'use strict';var Sequelize=require(_0xf70a('0x0'));module[_0xf70a('0x1')]={'type':{'type':Sequelize[_0xf70a('0x2')](_0xf70a('0x3'),_0xf70a('0x4'),_0xf70a('0x5'),_0xf70a('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xf70a('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf70a('0x2')](_0xf70a('0x3'),'variable',_0xf70a('0x5'))},'keyContent':{'type':Sequelize[_0xf70a('0x7')]},'idField':{'type':Sequelize[_0xf70a('0x7')]},'nameField':{'type':Sequelize[_0xf70a('0x7')]},'customField':{'type':Sequelize[_0xf70a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x707a=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x707a,0x11a));var _0xa707=function(_0xe5a5a3,_0x39ee6b){_0xe5a5a3=_0xe5a5a3-0x0;var _0x42a400=_0x707a[_0xe5a5a3];return _0x42a400;};'use strict';var Sequelize=require(_0xa707('0x0'));module[_0xa707('0x1')]={'type':{'type':Sequelize[_0xa707('0x2')](_0xa707('0x3'),_0xa707('0x4'),'customVariable','keyValue','picklist'),'defaultValue':_0xa707('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa707('0x2')](_0xa707('0x3'),'variable',_0xa707('0x5'))},'keyContent':{'type':Sequelize[_0xa707('0x6')]},'idField':{'type':Sequelize[_0xa707('0x6')]},'nameField':{'type':Sequelize[_0xa707('0x6')]},'customField':{'type':Sequelize[_0xa707('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 0963413..00240bf 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 _0x155d=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','ZendeskField','fieldName','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x516c37,_0x4d27d3){var _0x418b48=function(_0x260e0e){while(--_0x260e0e){_0x516c37['push'](_0x516c37['shift']());}};_0x418b48(++_0x4d27d3);}(_0x155d,0x89));var _0xd155=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x155d[_0x2d61b2];return _0x12df89;};'use strict';var emlformat=require(_0xd155('0x0'));var rimraf=require(_0xd155('0x1'));var zipdir=require(_0xd155('0x2'));var jsonpatch=require(_0xd155('0x3'));var rp=require('request-promise');var moment=require(_0xd155('0x4'));var BPromise=require(_0xd155('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd155('0x6'));var ejs=require(_0xd155('0x7'));var fs=require('fs');var fs_extra=require(_0xd155('0x8'));var _=require(_0xd155('0x9'));var squel=require(_0xd155('0xa'));var crypto=require(_0xd155('0xb'));var jsforce=require(_0xd155('0xc'));var deskjs=require(_0xd155('0xd'));var toCsv=require(_0xd155('0x6'));var querystring=require(_0xd155('0xe'));var Papa=require('papaparse');var Redis=require(_0xd155('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd155('0x10'));var as=require(_0xd155('0x11'));var hardwareService=require(_0xd155('0x12'));var logger=require(_0xd155('0x13'))(_0xd155('0x14'));var utils=require(_0xd155('0x15'));var config=require(_0xd155('0x16'));var licenseUtil=require(_0xd155('0x17'));var db=require(_0xd155('0x18'))['db'];function respondWithStatusCode(_0x7bd657,_0x181b44){_0x181b44=_0x181b44||0xcc;return function(_0x69bf8b){if(_0x69bf8b){return _0x7bd657['sendStatus'](_0x181b44);}return _0x7bd657[_0xd155('0x19')](_0x181b44)[_0xd155('0x1a')]();};}function respondWithResult(_0x5582d2,_0x58e502){_0x58e502=_0x58e502||0xc8;return function(_0x464f3b){if(_0x464f3b){return _0x5582d2['status'](_0x58e502)['json'](_0x464f3b);}};}function respondWithFilteredResult(_0xb37166,_0x3195e8){return function(_0x41dc3d){if(_0x41dc3d){var _0x39d2e6=typeof _0x3195e8[_0xd155('0x1b')]===_0xd155('0x1c')&&typeof _0x3195e8[_0xd155('0x1d')]===_0xd155('0x1c');var _0x118dec=_0x41dc3d['count'];var _0x40d271=_0x39d2e6?0x0:_0x3195e8['offset'];var _0x52457c=_0x39d2e6?_0x41dc3d[_0xd155('0x1e')]:_0x3195e8[_0xd155('0x1b')]+_0x3195e8[_0xd155('0x1d')];var _0x5a6bf0;if(_0x52457c>=_0x118dec){_0x52457c=_0x118dec;_0x5a6bf0=0xc8;}else{_0x5a6bf0=0xce;}_0xb37166[_0xd155('0x19')](_0x5a6bf0);return _0xb37166[_0xd155('0x1f')](_0xd155('0x20'),_0x40d271+'-'+_0x52457c+'/'+_0x118dec)[_0xd155('0x21')](_0x41dc3d);}return null;};}function patchUpdates(_0x2169ca){return function(_0xf0bf21){try{jsonpatch[_0xd155('0x22')](_0xf0bf21,_0x2169ca,!![]);}catch(_0x8a873a){return BPromise['reject'](_0x8a873a);}return _0xf0bf21[_0xd155('0x23')]();};}function saveUpdates(_0x46f5a7,_0x13a521){return function(_0xe3ac77){if(_0xe3ac77){return _0xe3ac77[_0xd155('0x24')](_0x46f5a7)[_0xd155('0x25')](function(_0x4c16a8){return _0x4c16a8;});}return null;};}function removeEntity(_0x2bda29,_0x498c91){return function(_0x2456d3){if(_0x2456d3){return _0x2456d3[_0xd155('0x26')]()[_0xd155('0x25')](function(){_0x2bda29[_0xd155('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48cbbc,_0xa1a362){return function(_0xd32d53){if(!_0xd32d53){_0x48cbbc[_0xd155('0x27')](0x194);}return _0xd32d53;};}function handleError(_0x3fa6f3,_0x5d82f0){_0x5d82f0=_0x5d82f0||0x1f4;return function(_0x11dfb2){logger[_0xd155('0x28')](_0x11dfb2[_0xd155('0x29')]);if(_0x11dfb2[_0xd155('0x2a')]){delete _0x11dfb2[_0xd155('0x2a')];}_0x3fa6f3[_0xd155('0x19')](_0x5d82f0)['send'](_0x11dfb2);};}exports['index']=function(_0x1ec49f,_0x3453e8){var _0xfef7e8={},_0x3cdff9={},_0x49f513={'count':0x0,'rows':[]};var _0x2ec9e6=_['map'](db[_0xd155('0x2b')]['rawAttributes'],function(_0x462d63){return{'name':_0x462d63[_0xd155('0x2c')],'type':_0x462d63['type'][_0xd155('0x2d')]};});_0x3cdff9['model']=_[_0xd155('0x2e')](_0x2ec9e6,_0xd155('0x2a'));_0x3cdff9[_0xd155('0x2f')]=_[_0xd155('0x30')](_0x1ec49f['query']);_0x3cdff9[_0xd155('0x31')]=_['intersection'](_0x3cdff9[_0xd155('0x32')],_0x3cdff9['query']);_0xfef7e8['attributes']=_[_0xd155('0x33')](_0x3cdff9['model'],qs[_0xd155('0x34')](_0x1ec49f['query'][_0xd155('0x34')]));_0xfef7e8[_0xd155('0x35')]=_0xfef7e8[_0xd155('0x35')][_0xd155('0x36')]?_0xfef7e8['attributes']:_0x3cdff9[_0xd155('0x32')];if(!_0x1ec49f[_0xd155('0x2f')][_0xd155('0x37')](_0xd155('0x38'))){_0xfef7e8[_0xd155('0x1d')]=qs[_0xd155('0x1d')](_0x1ec49f[_0xd155('0x2f')][_0xd155('0x1d')]);_0xfef7e8[_0xd155('0x1b')]=qs[_0xd155('0x1b')](_0x1ec49f[_0xd155('0x2f')][_0xd155('0x1b')]);}_0xfef7e8['order']=qs[_0xd155('0x39')](_0x1ec49f[_0xd155('0x2f')][_0xd155('0x39')]);_0xfef7e8['where']=qs[_0xd155('0x31')](_[_0xd155('0x3a')](_0x1ec49f[_0xd155('0x2f')],_0x3cdff9['filters']),_0x2ec9e6);if(_0x1ec49f[_0xd155('0x2f')][_0xd155('0x3b')]){_0xfef7e8[_0xd155('0x3c')]=_['merge'](_0xfef7e8[_0xd155('0x3c')],{'$or':_[_0xd155('0x2e')](_0x2ec9e6,function(_0x18c5c9){if(_0x18c5c9[_0xd155('0x3d')]!==_0xd155('0x3e')){var _0x2d4fc8={};_0x2d4fc8[_0x18c5c9[_0xd155('0x2a')]]={'$like':'%'+_0x1ec49f['query'][_0xd155('0x3b')]+'%'};return _0x2d4fc8;}})});}_0xfef7e8=_[_0xd155('0x3f')]({},_0xfef7e8,_0x1ec49f[_0xd155('0x40')]);var _0x44ddb3={'where':_0xfef7e8['where']};return db[_0xd155('0x2b')][_0xd155('0x1e')](_0x44ddb3)[_0xd155('0x25')](function(_0x497cbd){_0x49f513['count']=_0x497cbd;if(_0x1ec49f[_0xd155('0x2f')]['includeAll']){_0xfef7e8[_0xd155('0x41')]=[{'all':!![]}];}return db[_0xd155('0x2b')][_0xd155('0x42')](_0xfef7e8);})[_0xd155('0x25')](function(_0x21c42a){_0x49f513[_0xd155('0x43')]=_0x21c42a;return _0x49f513;})[_0xd155('0x25')](respondWithFilteredResult(_0x3453e8,_0xfef7e8))[_0xd155('0x44')](handleError(_0x3453e8,null));};exports[_0xd155('0x45')]=function(_0x11b8da,_0xfcd860){var _0x520f24={'raw':!![],'where':{'id':_0x11b8da[_0xd155('0x46')]['id']}},_0x2ff16e={};_0x2ff16e[_0xd155('0x32')]=_[_0xd155('0x30')](db[_0xd155('0x2b')][_0xd155('0x47')]);_0x2ff16e[_0xd155('0x2f')]=_[_0xd155('0x30')](_0x11b8da[_0xd155('0x2f')]);_0x2ff16e[_0xd155('0x31')]=_[_0xd155('0x33')](_0x2ff16e['model'],_0x2ff16e['query']);_0x520f24['attributes']=_['intersection'](_0x2ff16e[_0xd155('0x32')],qs[_0xd155('0x34')](_0x11b8da['query'][_0xd155('0x34')]));_0x520f24[_0xd155('0x35')]=_0x520f24[_0xd155('0x35')]['length']?_0x520f24[_0xd155('0x35')]:_0x2ff16e[_0xd155('0x32')];if(_0x11b8da['query'][_0xd155('0x48')]){_0x520f24[_0xd155('0x41')]=[{'all':!![]}];}_0x520f24=_[_0xd155('0x3f')]({},_0x520f24,_0x11b8da[_0xd155('0x40')]);return db[_0xd155('0x2b')][_0xd155('0x49')](_0x520f24)[_0xd155('0x25')](handleEntityNotFound(_0xfcd860,null))[_0xd155('0x25')](respondWithResult(_0xfcd860,null))[_0xd155('0x44')](handleError(_0xfcd860,null));};exports['create']=function(_0x12a457,_0x3e60bb){return db[_0xd155('0x2b')][_0xd155('0x4a')](_0x12a457[_0xd155('0x4b')],{})['then'](respondWithResult(_0x3e60bb,0xc9))[_0xd155('0x44')](handleError(_0x3e60bb,null));};exports[_0xd155('0x24')]=function(_0x160d0b,_0x17a708){if(_0x160d0b[_0xd155('0x4b')]['id']){delete _0x160d0b[_0xd155('0x4b')]['id'];}return db['ZendeskField'][_0xd155('0x49')]({'where':{'id':_0x160d0b['params']['id']}})[_0xd155('0x25')](handleEntityNotFound(_0x17a708,null))[_0xd155('0x25')](saveUpdates(_0x160d0b[_0xd155('0x4b')],null))[_0xd155('0x25')](respondWithResult(_0x17a708,null))[_0xd155('0x44')](handleError(_0x17a708,null));};exports[_0xd155('0x26')]=function(_0x532799,_0x565800){return db[_0xd155('0x2b')][_0xd155('0x49')]({'where':{'id':_0x532799['params']['id']}})[_0xd155('0x25')](handleEntityNotFound(_0x565800,null))['then'](removeEntity(_0x565800,null))['catch'](handleError(_0x565800,null));}; \ No newline at end of file +var _0xbf97=['keys','attributes','fields','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','intersection','length','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','type','key','model','query'];(function(_0x12ee80,_0x59a81d){var _0x25ddc1=function(_0x412f24){while(--_0x412f24){_0x12ee80['push'](_0x12ee80['shift']());}};_0x25ddc1(++_0x59a81d);}(_0xbf97,0xa6));var _0x7bf9=function(_0x1de06e,_0x24751a){_0x1de06e=_0x1de06e-0x0;var _0x5eef89=_0xbf97[_0x1de06e];return _0x5eef89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7bf9('0x0'));var zipdir=require(_0x7bf9('0x1'));var jsonpatch=require(_0x7bf9('0x2'));var rp=require(_0x7bf9('0x3'));var moment=require('moment');var BPromise=require(_0x7bf9('0x4'));var Mustache=require(_0x7bf9('0x5'));var util=require(_0x7bf9('0x6'));var path=require(_0x7bf9('0x7'));var sox=require('sox');var csv=require(_0x7bf9('0x8'));var ejs=require(_0x7bf9('0x9'));var fs=require('fs');var fs_extra=require(_0x7bf9('0xa'));var _=require(_0x7bf9('0xb'));var squel=require(_0x7bf9('0xc'));var crypto=require(_0x7bf9('0xd'));var jsforce=require(_0x7bf9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7bf9('0x8'));var querystring=require(_0x7bf9('0xf'));var Papa=require(_0x7bf9('0x10'));var Redis=require(_0x7bf9('0x11'));var authService=require(_0x7bf9('0x12'));var qs=require(_0x7bf9('0x13'));var as=require(_0x7bf9('0x14'));var hardwareService=require(_0x7bf9('0x15'));var logger=require('../../config/logger')(_0x7bf9('0x16'));var utils=require(_0x7bf9('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a0ad8,_0x592374){_0x592374=_0x592374||0xcc;return function(_0x40f073){if(_0x40f073){return _0x4a0ad8[_0x7bf9('0x18')](_0x592374);}return _0x4a0ad8[_0x7bf9('0x19')](_0x592374)[_0x7bf9('0x1a')]();};}function respondWithResult(_0x5b898f,_0x508d62){_0x508d62=_0x508d62||0xc8;return function(_0x5275b4){if(_0x5275b4){return _0x5b898f['status'](_0x508d62)[_0x7bf9('0x1b')](_0x5275b4);}};}function respondWithFilteredResult(_0x3b9de5,_0x39b7b8){return function(_0x359f82){if(_0x359f82){var _0x561017=typeof _0x39b7b8[_0x7bf9('0x1c')]===_0x7bf9('0x1d')&&typeof _0x39b7b8[_0x7bf9('0x1e')]==='undefined';var _0x442bd9=_0x359f82[_0x7bf9('0x1f')];var _0xb60c9e=_0x561017?0x0:_0x39b7b8[_0x7bf9('0x1c')];var _0x5bb5f0=_0x561017?_0x359f82[_0x7bf9('0x1f')]:_0x39b7b8[_0x7bf9('0x1c')]+_0x39b7b8[_0x7bf9('0x1e')];var _0x20cafa;if(_0x5bb5f0>=_0x442bd9){_0x5bb5f0=_0x442bd9;_0x20cafa=0xc8;}else{_0x20cafa=0xce;}_0x3b9de5[_0x7bf9('0x19')](_0x20cafa);return _0x3b9de5['set'](_0x7bf9('0x20'),_0xb60c9e+'-'+_0x5bb5f0+'/'+_0x442bd9)['json'](_0x359f82);}return null;};}function patchUpdates(_0x44dfc5){return function(_0x447f6a){try{jsonpatch[_0x7bf9('0x21')](_0x447f6a,_0x44dfc5,!![]);}catch(_0xbed3c5){return BPromise[_0x7bf9('0x22')](_0xbed3c5);}return _0x447f6a[_0x7bf9('0x23')]();};}function saveUpdates(_0x54f657,_0x5a42c6){return function(_0x1d7c1f){if(_0x1d7c1f){return _0x1d7c1f[_0x7bf9('0x24')](_0x54f657)[_0x7bf9('0x25')](function(_0x4def52){return _0x4def52;});}return null;};}function removeEntity(_0x4e3ff8,_0x516e56){return function(_0x18ce03){if(_0x18ce03){return _0x18ce03[_0x7bf9('0x26')]()[_0x7bf9('0x25')](function(){_0x4e3ff8[_0x7bf9('0x19')](0xcc)[_0x7bf9('0x1a')]();});}};}function handleEntityNotFound(_0x236769,_0x3ff53b){return function(_0x4746f0){if(!_0x4746f0){_0x236769[_0x7bf9('0x18')](0x194);}return _0x4746f0;};}function handleError(_0x451db2,_0x48335b){_0x48335b=_0x48335b||0x1f4;return function(_0x39e2b8){logger[_0x7bf9('0x27')](_0x39e2b8[_0x7bf9('0x28')]);if(_0x39e2b8[_0x7bf9('0x29')]){delete _0x39e2b8['name'];}_0x451db2[_0x7bf9('0x19')](_0x48335b)[_0x7bf9('0x2a')](_0x39e2b8);};}exports[_0x7bf9('0x2b')]=function(_0x5b526d,_0x51a238){var _0x5c5d75={},_0x13b96a={},_0x948d8d={'count':0x0,'rows':[]};var _0x198676=_[_0x7bf9('0x2c')](db[_0x7bf9('0x2d')]['rawAttributes'],function(_0x46f2ff){return{'name':_0x46f2ff['fieldName'],'type':_0x46f2ff[_0x7bf9('0x2e')][_0x7bf9('0x2f')]};});_0x13b96a[_0x7bf9('0x30')]=_[_0x7bf9('0x2c')](_0x198676,_0x7bf9('0x29'));_0x13b96a[_0x7bf9('0x31')]=_[_0x7bf9('0x32')](_0x5b526d[_0x7bf9('0x31')]);_0x13b96a['filters']=_['intersection'](_0x13b96a[_0x7bf9('0x30')],_0x13b96a[_0x7bf9('0x31')]);_0x5c5d75[_0x7bf9('0x33')]=_['intersection'](_0x13b96a[_0x7bf9('0x30')],qs[_0x7bf9('0x34')](_0x5b526d['query']['fields']));_0x5c5d75[_0x7bf9('0x33')]=_0x5c5d75[_0x7bf9('0x33')]['length']?_0x5c5d75['attributes']:_0x13b96a[_0x7bf9('0x30')];if(!_0x5b526d[_0x7bf9('0x31')]['hasOwnProperty']('nolimit')){_0x5c5d75['limit']=qs[_0x7bf9('0x1e')](_0x5b526d[_0x7bf9('0x31')]['limit']);_0x5c5d75[_0x7bf9('0x1c')]=qs[_0x7bf9('0x1c')](_0x5b526d['query']['offset']);}_0x5c5d75['order']=qs[_0x7bf9('0x35')](_0x5b526d[_0x7bf9('0x31')][_0x7bf9('0x35')]);_0x5c5d75[_0x7bf9('0x36')]=qs[_0x7bf9('0x37')](_[_0x7bf9('0x38')](_0x5b526d['query'],_0x13b96a[_0x7bf9('0x37')]),_0x198676);if(_0x5b526d[_0x7bf9('0x31')][_0x7bf9('0x39')]){_0x5c5d75[_0x7bf9('0x36')]=_[_0x7bf9('0x3a')](_0x5c5d75[_0x7bf9('0x36')],{'$or':_[_0x7bf9('0x2c')](_0x198676,function(_0x40d7ff){if(_0x40d7ff[_0x7bf9('0x2e')]!==_0x7bf9('0x3b')){var _0x280e2e={};_0x280e2e[_0x40d7ff[_0x7bf9('0x29')]]={'$like':'%'+_0x5b526d[_0x7bf9('0x31')]['filter']+'%'};return _0x280e2e;}})});}_0x5c5d75=_['merge']({},_0x5c5d75,_0x5b526d[_0x7bf9('0x3c')]);var _0x14fdab={'where':_0x5c5d75['where']};return db[_0x7bf9('0x2d')]['count'](_0x14fdab)['then'](function(_0x4cebf6){_0x948d8d[_0x7bf9('0x1f')]=_0x4cebf6;if(_0x5b526d[_0x7bf9('0x31')][_0x7bf9('0x3d')]){_0x5c5d75[_0x7bf9('0x3e')]=[{'all':!![]}];}return db['ZendeskField'][_0x7bf9('0x3f')](_0x5c5d75);})['then'](function(_0x5930e0){_0x948d8d['rows']=_0x5930e0;return _0x948d8d;})[_0x7bf9('0x25')](respondWithFilteredResult(_0x51a238,_0x5c5d75))[_0x7bf9('0x40')](handleError(_0x51a238,null));};exports[_0x7bf9('0x41')]=function(_0x6eefb8,_0x370a82){var _0x90e25={'raw':!![],'where':{'id':_0x6eefb8['params']['id']}},_0x59901f={};_0x59901f['model']=_[_0x7bf9('0x32')](db['ZendeskField'][_0x7bf9('0x42')]);_0x59901f[_0x7bf9('0x31')]=_[_0x7bf9('0x32')](_0x6eefb8[_0x7bf9('0x31')]);_0x59901f[_0x7bf9('0x37')]=_[_0x7bf9('0x43')](_0x59901f[_0x7bf9('0x30')],_0x59901f[_0x7bf9('0x31')]);_0x90e25[_0x7bf9('0x33')]=_['intersection'](_0x59901f['model'],qs['fields'](_0x6eefb8[_0x7bf9('0x31')]['fields']));_0x90e25[_0x7bf9('0x33')]=_0x90e25[_0x7bf9('0x33')][_0x7bf9('0x44')]?_0x90e25[_0x7bf9('0x33')]:_0x59901f[_0x7bf9('0x30')];if(_0x6eefb8[_0x7bf9('0x31')][_0x7bf9('0x3d')]){_0x90e25[_0x7bf9('0x3e')]=[{'all':!![]}];}_0x90e25=_[_0x7bf9('0x3a')]({},_0x90e25,_0x6eefb8[_0x7bf9('0x3c')]);return db[_0x7bf9('0x2d')]['find'](_0x90e25)[_0x7bf9('0x25')](handleEntityNotFound(_0x370a82,null))[_0x7bf9('0x25')](respondWithResult(_0x370a82,null))[_0x7bf9('0x40')](handleError(_0x370a82,null));};exports[_0x7bf9('0x45')]=function(_0x5021d2,_0x40275e){return db[_0x7bf9('0x2d')][_0x7bf9('0x45')](_0x5021d2[_0x7bf9('0x46')],{})[_0x7bf9('0x25')](respondWithResult(_0x40275e,0xc9))[_0x7bf9('0x40')](handleError(_0x40275e,null));};exports[_0x7bf9('0x24')]=function(_0x344bb8,_0x303cb3){if(_0x344bb8[_0x7bf9('0x46')]['id']){delete _0x344bb8[_0x7bf9('0x46')]['id'];}return db[_0x7bf9('0x2d')][_0x7bf9('0x47')]({'where':{'id':_0x344bb8['params']['id']}})[_0x7bf9('0x25')](handleEntityNotFound(_0x303cb3,null))['then'](saveUpdates(_0x344bb8[_0x7bf9('0x46')],null))[_0x7bf9('0x25')](respondWithResult(_0x303cb3,null))[_0x7bf9('0x40')](handleError(_0x303cb3,null));};exports[_0x7bf9('0x26')]=function(_0x4617ed,_0x322346){return db['ZendeskField'][_0x7bf9('0x47')]({'where':{'id':_0x4617ed['params']['id']}})[_0x7bf9('0x25')](handleEntityNotFound(_0x322346,null))[_0x7bf9('0x25')](removeEntity(_0x322346,null))['catch'](handleError(_0x322346,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index eddbcbd..bab6fcf 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 _0x5c3c=['bluebird','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','FieldId','lodash','../../config/logger','api','moment'];(function(_0x20294f,_0x4848ee){var _0x2e6673=function(_0x28baae){while(--_0x28baae){_0x20294f['push'](_0x20294f['shift']());}};_0x2e6673(++_0x4848ee);}(_0x5c3c,0x128));var _0xc5c3=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5c3c[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xc5c3('0x0'));var util=require('util');var logger=require(_0xc5c3('0x1'))(_0xc5c3('0x2'));var moment=require(_0xc5c3('0x3'));var BPromise=require(_0xc5c3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc5c3('0x5'));var config=require(_0xc5c3('0x6'));var attributes=require(_0xc5c3('0x7'));module[_0xc5c3('0x8')]=function(_0xa58286,_0xa20964){return _0xa58286['define'](_0xc5c3('0x9'),attributes,{'tableName':_0xc5c3('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xc5c3('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa446=['../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x567533,_0x3cd25f){var _0x5d9a7f=function(_0xf13c44){while(--_0xf13c44){_0x567533['push'](_0x567533['shift']());}};_0x5d9a7f(++_0x3cd25f);}(_0xa446,0x1f1));var _0x6a44=function(_0x94a0f2,_0x30eabd){_0x94a0f2=_0x94a0f2-0x0;var _0x1c8122=_0xa446[_0x94a0f2];return _0x1c8122;};'use strict';var _=require(_0x6a44('0x0'));var util=require(_0x6a44('0x1'));var logger=require('../../config/logger')(_0x6a44('0x2'));var moment=require(_0x6a44('0x3'));var BPromise=require(_0x6a44('0x4'));var rp=require(_0x6a44('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a44('0x6'));var config=require(_0x6a44('0x7'));var attributes=require(_0x6a44('0x8'));module[_0x6a44('0x9')]=function(_0x3d6503,_0x1f8b9d){return _0x3d6503[_0x6a44('0xa')]('ZendeskField',attributes,{'tableName':_0x6a44('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x6a44('0xc'),_0x6a44('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 9edb5b4..0dc0a11 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 _0xe5c3=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','debug','request\x20sent','error','code','ZendeskField,\x20%s,\x20%s','message'];(function(_0xde770b,_0x4c4183){var _0x4703bc=function(_0x2078b2){while(--_0x2078b2){_0xde770b['push'](_0xde770b['shift']());}};_0x4703bc(++_0x4c4183);}(_0xe5c3,0x11a));var _0x3e5c=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xe5c3[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x3e5c('0x0'));var util=require('util');var moment=require(_0x3e5c('0x1'));var BPromise=require('bluebird');var rs=require(_0x3e5c('0x2'));var fs=require('fs');var Redis=require(_0x3e5c('0x3'));var db=require(_0x3e5c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e5c('0x5'))(_0x3e5c('0x6'));var config=require(_0x3e5c('0x7'));var jayson=require(_0x3e5c('0x8'));var client=jayson[_0x3e5c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c19ec,_0x40a677,_0x1fce42){return new BPromise(function(_0x5e7d8a,_0x53d5a7){return client[_0x3e5c('0xa')](_0x4c19ec,_0x1fce42)['then'](function(_0x499c31){logger[_0x3e5c('0xb')]('ZendeskField,\x20%s,\x20%s',_0x40a677,'request\x20sent');logger[_0x3e5c('0xc')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x40a677,_0x3e5c('0xd'),JSON['stringify'](_0x499c31));if(_0x499c31['error']){if(_0x499c31[_0x3e5c('0xe')][_0x3e5c('0xf')]===0x1f4){logger[_0x3e5c('0xe')](_0x3e5c('0x10'),_0x40a677,_0x499c31[_0x3e5c('0xe')]['message']);return _0x53d5a7(_0x499c31[_0x3e5c('0xe')][_0x3e5c('0x11')]);}logger[_0x3e5c('0xe')](_0x3e5c('0x10'),_0x40a677,_0x499c31['error'][_0x3e5c('0x11')]);return _0x5e7d8a(_0x499c31[_0x3e5c('0xe')][_0x3e5c('0x11')]);}else{logger[_0x3e5c('0xb')](_0x3e5c('0x10'),_0x40a677,_0x3e5c('0xd'));_0x5e7d8a(_0x499c31[_0x3e5c('0x12')][_0x3e5c('0x11')]);}})[_0x3e5c('0x13')](function(_0x361098){logger[_0x3e5c('0xe')]('ZendeskField,\x20%s,\x20%s',_0x40a677,_0x361098);_0x53d5a7(_0x361098);});});} \ No newline at end of file +var _0xca26=['../../config/environment','jayson/promise','client','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x27f466,_0x3f2041){var _0x551754=function(_0xf7c821){while(--_0xf7c821){_0x27f466['push'](_0x27f466['shift']());}};_0x551754(++_0x3f2041);}(_0xca26,0x1f1));var _0x6ca2=function(_0x909913,_0x479c00){_0x909913=_0x909913-0x0;var _0x456bca=_0xca26[_0x909913];return _0x456bca;};'use strict';var _=require(_0x6ca2('0x0'));var util=require(_0x6ca2('0x1'));var moment=require(_0x6ca2('0x2'));var BPromise=require(_0x6ca2('0x3'));var rs=require(_0x6ca2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ca2('0x5'))['db'];var utils=require(_0x6ca2('0x6'));var logger=require(_0x6ca2('0x7'))(_0x6ca2('0x8'));var config=require(_0x6ca2('0x9'));var jayson=require(_0x6ca2('0xa'));var client=jayson[_0x6ca2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed0ba,_0x4d7c2f,_0x3c5581){return new BPromise(function(_0x3fb51,_0x319bb5){return client[_0x6ca2('0xc')](_0x4ed0ba,_0x3c5581)['then'](function(_0x1dac38){logger[_0x6ca2('0xd')](_0x6ca2('0xe'),_0x4d7c2f,_0x6ca2('0xf'));logger[_0x6ca2('0x10')](_0x6ca2('0x11'),_0x4d7c2f,'request\x20sent',JSON['stringify'](_0x1dac38));if(_0x1dac38[_0x6ca2('0x12')]){if(_0x1dac38['error'][_0x6ca2('0x13')]===0x1f4){logger[_0x6ca2('0x12')](_0x6ca2('0xe'),_0x4d7c2f,_0x1dac38[_0x6ca2('0x12')]['message']);return _0x319bb5(_0x1dac38[_0x6ca2('0x12')][_0x6ca2('0x14')]);}logger[_0x6ca2('0x12')](_0x6ca2('0xe'),_0x4d7c2f,_0x1dac38['error'][_0x6ca2('0x14')]);return _0x3fb51(_0x1dac38[_0x6ca2('0x12')][_0x6ca2('0x14')]);}else{logger[_0x6ca2('0xd')](_0x6ca2('0xe'),_0x4d7c2f,'request\x20sent');_0x3fb51(_0x1dac38[_0x6ca2('0x15')]['message']);}})[_0x6ca2('0x16')](function(_0x3c4a60){logger[_0x6ca2('0x12')]('ZendeskField,\x20%s,\x20%s',_0x4d7c2f,_0x3c4a60);_0x319bb5(_0x3c4a60);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 3680c72..e47e456 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 _0x350f=['post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x386316,_0x43226f){var _0x47e11a=function(_0x4d6c6f){while(--_0x4d6c6f){_0x386316['push'](_0x386316['shift']());}};_0x47e11a(++_0x43226f);}(_0x350f,0x69));var _0xf350=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0x350f[_0x37cc52];return _0x2b4a90;};'use strict';var multer=require(_0xf350('0x0'));var util=require(_0xf350('0x1'));var path=require(_0xf350('0x2'));var timeout=require(_0xf350('0x3'));var express=require(_0xf350('0x4'));var router=express[_0xf350('0x5')]();var fs_extra=require(_0xf350('0x6'));var auth=require(_0xf350('0x7'));var interaction=require(_0xf350('0x8'));var config=require(_0xf350('0x9'));var controller=require(_0xf350('0xa'));router[_0xf350('0xb')]('/',auth[_0xf350('0xc')](),controller[_0xf350('0xd')]);router[_0xf350('0xb')](_0xf350('0xe'),auth[_0xf350('0xc')](),controller[_0xf350('0xf')]);router[_0xf350('0xb')](_0xf350('0x10'),auth['isAuthenticated'](),controller[_0xf350('0x11')]);router[_0xf350('0xb')](_0xf350('0x12'),auth[_0xf350('0xc')](),controller[_0xf350('0x13')]);router[_0xf350('0x14')]('/',auth[_0xf350('0xc')](),controller['create']);router[_0xf350('0x14')](_0xf350('0x10'),auth[_0xf350('0xc')](),controller['addConfiguration']);router['put']('/:id',auth[_0xf350('0xc')](),controller[_0xf350('0x15')]);router[_0xf350('0x16')](_0xf350('0xe'),auth[_0xf350('0xc')](),controller[_0xf350('0x17')]);module[_0xf350('0x18')]=router; \ No newline at end of file +var _0x8ea5=['index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x8ea5,0x177));var _0x58ea=function(_0x5f173e,_0x15335e){_0x5f173e=_0x5f173e-0x0;var _0xf0176b=_0x8ea5[_0x5f173e];return _0xf0176b;};'use strict';var multer=require('multer');var util=require(_0x58ea('0x0'));var path=require(_0x58ea('0x1'));var timeout=require(_0x58ea('0x2'));var express=require(_0x58ea('0x3'));var router=express['Router']();var fs_extra=require(_0x58ea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x58ea('0x5'));var config=require(_0x58ea('0x6'));var controller=require(_0x58ea('0x7'));router['get']('/',auth[_0x58ea('0x8')](),controller[_0x58ea('0x9')]);router[_0x58ea('0xa')](_0x58ea('0xb'),auth['isAuthenticated'](),controller[_0x58ea('0xc')]);router[_0x58ea('0xa')](_0x58ea('0xd'),auth[_0x58ea('0x8')](),controller[_0x58ea('0xe')]);router[_0x58ea('0xa')](_0x58ea('0xf'),auth['isAuthenticated'](),controller[_0x58ea('0x10')]);router[_0x58ea('0x11')]('/',auth[_0x58ea('0x8')](),controller[_0x58ea('0x12')]);router[_0x58ea('0x11')]('/:id/configurations',auth[_0x58ea('0x8')](),controller['addConfiguration']);router[_0x58ea('0x13')]('/:id',auth[_0x58ea('0x8')](),controller[_0x58ea('0x14')]);router[_0x58ea('0x15')]('/:id',auth[_0x58ea('0x8')](),controller[_0x58ea('0x16')]);module[_0x58ea('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 3c71c9b..cf3e079 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 _0x22fb=['STRING'];(function(_0x501d4b,_0xf0fb8e){var _0x5d7db0=function(_0x215479){while(--_0x215479){_0x501d4b['push'](_0x501d4b['shift']());}};_0x5d7db0(++_0xf0fb8e);}(_0x22fb,0x192));var _0xb22f=function(_0x1bf742,_0x21dde5){_0x1bf742=_0x1bf742-0x0;var _0x40a358=_0x22fb[_0x1bf742];return _0x40a358;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb22f('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb22f('0x0')]},'zone':{'type':Sequelize[_0xb22f('0x0')]},'clientId':{'type':Sequelize[_0xb22f('0x0')]},'clientSecret':{'type':Sequelize[_0xb22f('0x0')]},'serverUrl':{'type':Sequelize[_0xb22f('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb22f('0x0')]}}; \ No newline at end of file +var _0xa75b=['sequelize','STRING'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xa75b,0x170));var _0xba75=function(_0x2adbea,_0x7e83af){_0x2adbea=_0x2adbea-0x0;var _0x162510=_0xa75b[_0x2adbea];return _0x162510;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba75('0x1')]},'host':{'type':Sequelize[_0xba75('0x1')]},'zone':{'type':Sequelize[_0xba75('0x1')]},'clientId':{'type':Sequelize[_0xba75('0x1')]},'clientSecret':{'type':Sequelize[_0xba75('0x1')]},'serverUrl':{'type':Sequelize[_0xba75('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xba75('0x1')]},'refreshToken':{'type':Sequelize[_0xba75('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 626ce3a..54f98a0 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 _0x751e=['index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','length','create','body','find','getConfigurations','ZohoConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','push','display_label','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','limit','offset','count','json','reject','save','then','destroy','stack'];(function(_0x314a45,_0x4de035){var _0x3fee4b=function(_0x54397d){while(--_0x54397d){_0x314a45['push'](_0x314a45['shift']());}};_0x3fee4b(++_0x4de035);}(_0x751e,0x1ce));var _0xe751=function(_0xa205ef,_0x5a64cf){_0xa205ef=_0xa205ef-0x0;var _0x59d23d=_0x751e[_0xa205ef];return _0x59d23d;};'use strict';var emlformat=require(_0xe751('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe751('0x1'));var jsonpatch=require(_0xe751('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe751('0x3'));var Mustache=require(_0xe751('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe751('0x5'));var csv=require(_0xe751('0x6'));var ejs=require(_0xe751('0x7'));var fs=require('fs');var fs_extra=require(_0xe751('0x8'));var _=require('lodash');var squel=require(_0xe751('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe751('0x6'));var querystring=require(_0xe751('0xa'));var Papa=require(_0xe751('0xb'));var Redis=require(_0xe751('0xc'));var authService=require(_0xe751('0xd'));var qs=require(_0xe751('0xe'));var as=require(_0xe751('0xf'));var hardwareService=require(_0xe751('0x10'));var logger=require(_0xe751('0x11'))(_0xe751('0x12'));var utils=require(_0xe751('0x13'));var config=require(_0xe751('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe751('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x122d01,_0x1b888d){_0x1b888d=_0x1b888d||0xcc;return function(_0x3bf8bf){if(_0x3bf8bf){return _0x122d01['sendStatus'](_0x1b888d);}return _0x122d01[_0xe751('0x16')](_0x1b888d)[_0xe751('0x17')]();};}function respondWithResult(_0x1888fa,_0x1e948b){_0x1e948b=_0x1e948b||0xc8;return function(_0x13c9d2){if(_0x13c9d2){return _0x1888fa[_0xe751('0x16')](_0x1e948b)['json'](_0x13c9d2);}};}function respondWithFilteredResult(_0x102e82,_0x2fb218){return function(_0x1b1130){if(_0x1b1130){var _0x28ad7d=typeof _0x2fb218['offset']===_0xe751('0x18')&&typeof _0x2fb218[_0xe751('0x19')]===_0xe751('0x18');var _0x2fe1ef=_0x1b1130['count'];var _0xbcc03=_0x28ad7d?0x0:_0x2fb218[_0xe751('0x1a')];var _0x25904f=_0x28ad7d?_0x1b1130[_0xe751('0x1b')]:_0x2fb218[_0xe751('0x1a')]+_0x2fb218[_0xe751('0x19')];var _0x404084;if(_0x25904f>=_0x2fe1ef){_0x25904f=_0x2fe1ef;_0x404084=0xc8;}else{_0x404084=0xce;}_0x102e82['status'](_0x404084);return _0x102e82['set']('Content-Range',_0xbcc03+'-'+_0x25904f+'/'+_0x2fe1ef)[_0xe751('0x1c')](_0x1b1130);}return null;};}function patchUpdates(_0x3d8283){return function(_0x31e76a){try{jsonpatch['apply'](_0x31e76a,_0x3d8283,!![]);}catch(_0x160bc6){return BPromise[_0xe751('0x1d')](_0x160bc6);}return _0x31e76a[_0xe751('0x1e')]();};}function saveUpdates(_0x2e68c0,_0x22810e){return function(_0xd2fb4c){if(_0xd2fb4c){return _0xd2fb4c['update'](_0x2e68c0)[_0xe751('0x1f')](function(_0x43cf12){return _0x43cf12;});}return null;};}function removeEntity(_0x3e8cf3,_0x5cc7f5){return function(_0x5537aa){if(_0x5537aa){return _0x5537aa[_0xe751('0x20')]()[_0xe751('0x1f')](function(){_0x3e8cf3[_0xe751('0x16')](0xcc)[_0xe751('0x17')]();});}};}function handleEntityNotFound(_0x24ef31,_0x4dfdca){return function(_0x5de5d0){if(!_0x5de5d0){_0x24ef31['sendStatus'](0x194);}return _0x5de5d0;};}function handleError(_0x46754e,_0x17fc9f){_0x17fc9f=_0x17fc9f||0x1f4;return function(_0x23a1aa){logger['error'](_0x23a1aa[_0xe751('0x21')]);if(_0x23a1aa['name']){delete _0x23a1aa['name'];}_0x46754e[_0xe751('0x16')](_0x17fc9f)['send'](_0x23a1aa);};}exports[_0xe751('0x22')]=function(_0x5a542e,_0x5e756f){var _0x5b3be4={},_0x47b4a1={},_0x318a92={'count':0x0,'rows':[]};var _0x135bbb=_['map'](db[_0xe751('0x23')][_0xe751('0x24')],function(_0x178b77){return{'name':_0x178b77[_0xe751('0x25')],'type':_0x178b77[_0xe751('0x26')][_0xe751('0x27')]};});_0x47b4a1[_0xe751('0x28')]=_[_0xe751('0x29')](_0x135bbb,_0xe751('0x2a'));_0x47b4a1[_0xe751('0x2b')]=_[_0xe751('0x2c')](_0x5a542e['query']);_0x47b4a1['filters']=_[_0xe751('0x2d')](_0x47b4a1['model'],_0x47b4a1[_0xe751('0x2b')]);_0x5b3be4[_0xe751('0x2e')]=_[_0xe751('0x2d')](_0x47b4a1[_0xe751('0x28')],qs[_0xe751('0x2f')](_0x5a542e[_0xe751('0x2b')][_0xe751('0x2f')]));_0x5b3be4['attributes']=_0x5b3be4[_0xe751('0x2e')]['length']?_0x5b3be4[_0xe751('0x2e')]:_0x47b4a1[_0xe751('0x28')];if(!_0x5a542e[_0xe751('0x2b')][_0xe751('0x30')](_0xe751('0x31'))){_0x5b3be4[_0xe751('0x19')]=qs['limit'](_0x5a542e[_0xe751('0x2b')][_0xe751('0x19')]);_0x5b3be4['offset']=qs[_0xe751('0x1a')](_0x5a542e[_0xe751('0x2b')][_0xe751('0x1a')]);}_0x5b3be4[_0xe751('0x32')]=qs[_0xe751('0x33')](_0x5a542e[_0xe751('0x2b')][_0xe751('0x33')]);_0x5b3be4[_0xe751('0x34')]=qs['filters'](_['pick'](_0x5a542e[_0xe751('0x2b')],_0x47b4a1[_0xe751('0x35')]),_0x135bbb);if(_0x5a542e[_0xe751('0x2b')][_0xe751('0x36')]){_0x5b3be4['where']=_['merge'](_0x5b3be4[_0xe751('0x34')],{'$or':_[_0xe751('0x29')](_0x135bbb,function(_0x2d9243){if(_0x2d9243[_0xe751('0x26')]!==_0xe751('0x37')){var _0x3e8a08={};_0x3e8a08[_0x2d9243[_0xe751('0x2a')]]={'$like':'%'+_0x5a542e[_0xe751('0x2b')]['filter']+'%'};return _0x3e8a08;}})});}_0x5b3be4=_[_0xe751('0x38')]({},_0x5b3be4,_0x5a542e[_0xe751('0x39')]);var _0x11f65b={'where':_0x5b3be4[_0xe751('0x34')]};return db['ZohoAccount']['count'](_0x11f65b)[_0xe751('0x1f')](function(_0x546cd0){_0x318a92[_0xe751('0x1b')]=_0x546cd0;if(_0x5a542e[_0xe751('0x2b')][_0xe751('0x3a')]){_0x5b3be4[_0xe751('0x3b')]=[{'all':!![]}];}return db['ZohoAccount'][_0xe751('0x3c')](_0x5b3be4);})[_0xe751('0x1f')](function(_0x32ee75){_0x318a92[_0xe751('0x3d')]=_0x32ee75;return _0x318a92;})[_0xe751('0x1f')](respondWithFilteredResult(_0x5e756f,_0x5b3be4))[_0xe751('0x3e')](handleError(_0x5e756f,null));};exports['show']=function(_0x3dd44c,_0x4f0a2b){var _0x402e26={'raw':![],'where':{'id':_0x3dd44c[_0xe751('0x3f')]['id']}},_0x47b394={};_0x47b394['model']=_[_0xe751('0x2c')](db[_0xe751('0x23')][_0xe751('0x24')]);_0x47b394[_0xe751('0x2b')]=_['keys'](_0x3dd44c['query']);_0x47b394[_0xe751('0x35')]=_[_0xe751('0x2d')](_0x47b394['model'],_0x47b394[_0xe751('0x2b')]);_0x402e26[_0xe751('0x2e')]=_['intersection'](_0x47b394[_0xe751('0x28')],qs[_0xe751('0x2f')](_0x3dd44c[_0xe751('0x2b')][_0xe751('0x2f')]));_0x402e26[_0xe751('0x2e')]=_0x402e26[_0xe751('0x2e')][_0xe751('0x40')]?_0x402e26['attributes']:_0x47b394[_0xe751('0x28')];if(_0x3dd44c[_0xe751('0x2b')][_0xe751('0x3a')]){_0x402e26[_0xe751('0x3b')]=[{'all':!![]}];}_0x402e26=_['merge']({},_0x402e26,_0x3dd44c[_0xe751('0x39')]);return db[_0xe751('0x23')]['find'](_0x402e26)['then'](handleEntityNotFound(_0x4f0a2b,null))['then'](respondWithResult(_0x4f0a2b,null))[_0xe751('0x3e')](handleError(_0x4f0a2b,null));};exports[_0xe751('0x41')]=function(_0x410f0d,_0x2062da){return db[_0xe751('0x23')][_0xe751('0x41')](_0x410f0d[_0xe751('0x42')],{})['then'](respondWithResult(_0x2062da,0xc9))[_0xe751('0x3e')](handleError(_0x2062da,null));};exports['update']=function(_0xe8b891,_0xeb6953){if(_0xe8b891[_0xe751('0x42')]['id']){delete _0xe8b891[_0xe751('0x42')]['id'];}return db[_0xe751('0x23')][_0xe751('0x43')]({'where':{'id':_0xe8b891[_0xe751('0x3f')]['id']}})[_0xe751('0x1f')](handleEntityNotFound(_0xeb6953,null))[_0xe751('0x1f')](saveUpdates(_0xe8b891[_0xe751('0x42')],null))[_0xe751('0x1f')](respondWithResult(_0xeb6953,null))[_0xe751('0x3e')](handleError(_0xeb6953,null));};exports[_0xe751('0x20')]=function(_0x19bc5a,_0x6415c8){return db[_0xe751('0x23')][_0xe751('0x43')]({'where':{'id':_0x19bc5a['params']['id']}})[_0xe751('0x1f')](handleEntityNotFound(_0x6415c8,null))[_0xe751('0x1f')](removeEntity(_0x6415c8,null))[_0xe751('0x3e')](handleError(_0x6415c8,null));};exports[_0xe751('0x44')]=function(_0x421cf9,_0x4c1b5c,_0x2dd75b){var _0x304272={};var _0x158322={};var _0x119519;var _0x170f31;return db[_0xe751('0x23')]['findOne']({'where':{'id':_0x421cf9[_0xe751('0x3f')]['id']}})[_0xe751('0x1f')](handleEntityNotFound(_0x4c1b5c,null))[_0xe751('0x1f')](function(_0x58e5cb){if(_0x58e5cb){_0x119519=_0x58e5cb;_0x158322[_0xe751('0x28')]=_[_0xe751('0x2c')](db[_0xe751('0x45')]['rawAttributes']);_0x158322[_0xe751('0x2b')]=_[_0xe751('0x2c')](_0x421cf9[_0xe751('0x2b')]);_0x158322[_0xe751('0x35')]=_[_0xe751('0x2d')](_0x158322[_0xe751('0x28')],_0x158322[_0xe751('0x2b')]);_0x304272[_0xe751('0x2e')]=_[_0xe751('0x2d')](_0x158322[_0xe751('0x28')],qs[_0xe751('0x2f')](_0x421cf9[_0xe751('0x2b')]['fields']));_0x304272['attributes']=_0x304272[_0xe751('0x2e')][_0xe751('0x40')]?_0x304272[_0xe751('0x2e')]:_0x158322['model'];_0x304272[_0xe751('0x32')]=qs[_0xe751('0x33')](_0x421cf9[_0xe751('0x2b')]['sort']);_0x304272[_0xe751('0x34')]=qs['filters'](_['pick'](_0x421cf9['query'],_0x158322[_0xe751('0x35')]));if(_0x421cf9[_0xe751('0x2b')][_0xe751('0x36')]){_0x304272[_0xe751('0x34')]=_['merge'](_0x304272['where'],{'$or':_['map'](_0x304272[_0xe751('0x2e')],function(_0x281029){var _0x5686aa={};_0x5686aa[_0x281029]={'$like':'%'+_0x421cf9[_0xe751('0x2b')][_0xe751('0x36')]+'%'};return _0x5686aa;})});}_0x304272=_[_0xe751('0x38')]({},_0x304272,_0x421cf9[_0xe751('0x39')]);return _0x119519[_0xe751('0x44')](_0x304272);}})[_0xe751('0x1f')](function(_0x3ca65f){if(_0x3ca65f){_0x170f31=_0x3ca65f[_0xe751('0x40')];if(!_0x421cf9[_0xe751('0x2b')][_0xe751('0x30')](_0xe751('0x31'))){_0x304272[_0xe751('0x19')]=qs[_0xe751('0x19')](_0x421cf9['query']['limit']);_0x304272[_0xe751('0x1a')]=qs[_0xe751('0x1a')](_0x421cf9[_0xe751('0x2b')][_0xe751('0x1a')]);}return _0x119519[_0xe751('0x44')](_0x304272);}})[_0xe751('0x1f')](function(_0x16fc96){if(_0x16fc96){return _0x16fc96?{'count':_0x170f31,'rows':_0x16fc96}:null;}})['then'](respondWithResult(_0x4c1b5c,null))[_0xe751('0x3e')](handleError(_0x4c1b5c,null));};exports['addConfiguration']=function(_0x27aa23,_0x22feef,_0x5aa597){if(_0x27aa23[_0xe751('0x42')]['id']){delete _0x27aa23[_0xe751('0x42')]['id'];}return db['ZohoAccount'][_0xe751('0x46')]({'where':{'id':_0x27aa23[_0xe751('0x3f')]['id']}})[_0xe751('0x1f')](handleEntityNotFound(_0x22feef,null))[_0xe751('0x1f')](function(_0x300f54){if(_0x300f54){_0x27aa23[_0xe751('0x42')][_0xe751('0x47')]=_0x300f54['id'];_0x27aa23['body'][_0xe751('0x48')]=integrations[_0xe751('0x49')](_0x27aa23[_0xe751('0x42')][_0xe751('0x4a')],_0x27aa23['body'][_0xe751('0x26')]);_0x27aa23[_0xe751('0x42')][_0xe751('0x4b')]=integrations['getDescriptions'](_0x27aa23[_0xe751('0x42')][_0xe751('0x4a')],_0x27aa23[_0xe751('0x42')]['type']);return db[_0xe751('0x45')][_0xe751('0x41')](_0x27aa23[_0xe751('0x42')],{'include':[{'model':db[_0xe751('0x4c')],'as':_0xe751('0x48')},{'model':db[_0xe751('0x4c')],'as':_0xe751('0x4b')}]});}return null;})[_0xe751('0x1f')](respondWithResult(_0x22feef,null))[_0xe751('0x3e')](handleError(_0x22feef,null));};function getAccessToken(_0x4b5afe){return new Promise(function(_0x595c54,_0x5dd450){var _0x31243f;switch(_0x4b5afe[_0xe751('0x4d')]){case'US':_0x31243f='https://accounts.zoho.com';break;case'AU':_0x31243f=_0xe751('0x4e');break;case'EU':_0x31243f=_0xe751('0x4f');break;case'IN':_0x31243f=_0xe751('0x50');break;case'CN':_0x31243f=_0xe751('0x51');break;default:_0x31243f=_0xe751('0x4f');break;}var _0x10bcc0={'method':_0xe751('0x52'),'uri':_0x31243f+'/oauth/v2/token','qs':{'refresh_token':_0x4b5afe[_0xe751('0x53')],'client_id':_0x4b5afe[_0xe751('0x54')],'client_secret':_0x4b5afe[_0xe751('0x55')],'grant_type':_0xe751('0x56')},'json':!![]};return rp(_0x10bcc0)[_0xe751('0x1f')](function(_0xb497c2){if(_0xb497c2[_0xe751('0x57')]){_0x595c54(_0xb497c2[_0xe751('0x57')]);}else{_0x5dd450(_0xe751('0x58'));}})['catch'](function(_0x548779){_0x5dd450(_0x548779);});});}exports[_0xe751('0x59')]=function(_0x303994,_0x4273be,_0x52fc86){var _0x1562ae,_0x206b3b,_0x59770f,_0x2f9925,_0x3c2b31;return db['ZohoAccount'][_0xe751('0x46')]({'where':{'id':_0x303994['params']['id']},'attributes':['id',_0xe751('0x5a'),_0xe751('0x4d'),_0xe751('0x54'),_0xe751('0x55'),_0xe751('0x5b'),'code',_0xe751('0x53')]})[_0xe751('0x1f')](handleEntityNotFound(_0x4273be,null))[_0xe751('0x1f')](function(_0x2e592f){_0x3c2b31=_0x2e592f;_0x1562ae=_0x3c2b31[_0xe751('0x5a')];_0x206b3b=_0x1562ae===_0xe751('0x5c')?'eu':_0xe751('0x5d');_0x59770f=_0x3c2b31[_0xe751('0x5b')];var _0x36e303=_0x59770f[_0xe751('0x5e')](-0x1);if(_0x36e303==='/'||_0x36e303==='\x5c'||_0x36e303===':'){_0x59770f=_0x59770f[_0xe751('0x5f')](0x0,_0x59770f['lastIndexOf'](_0x36e303));}if(!_0x3c2b31[_0xe751('0x53')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x3c2b31);})[_0xe751('0x1f')](function(_0x4564ba){if(_0x4564ba){return rp({'method':_0xe751('0x60'),'uri':util[_0xe751('0x61')](_0xe751('0x62'),_0x206b3b),'qs':{'module':_0xe751('0x63')},'headers':{'Authorization':_0xe751('0x64')+_0x4564ba},'json':!![]});}})[_0xe751('0x1f')](function(_0x49d5d9){if(_0x49d5d9){if(_0x49d5d9[_0xe751('0x65')]&&_0x49d5d9[_0xe751('0x65')][_0xe751('0x66')]){throw new Error(_0x49d5d9[_0xe751('0x65')]['error'][_0xe751('0x67')]);}var _0x3d2262=[];var _0x2d2f21=[];var _0x2cd506=[_0xe751('0x68'),_0xe751('0x69'),_0xe751('0x6a'),_0xe751('0x6b'),_0xe751('0x6c'),_0xe751('0x6d'),_0xe751('0x6e'),'Call_Type'];_0x2d2f21=_[_0xe751('0x6f')](_0x49d5d9[_0xe751('0x2f')],function(_0x3e1a1e){return _0x2cd506[_0xe751('0x70')](_0x3e1a1e[_0xe751('0x71')]);});for(var _0x3cc34e=0x0;_0x3cc34e<_0x2d2f21[_0xe751('0x40')];_0x3cc34e++){if(_0x2d2f21[_0x3cc34e]['system_mandatory']===![]){_0x3d2262[_0xe751('0x72')]({'id':_0x2d2f21[_0x3cc34e]['id'],'name':_0x2d2f21[_0x3cc34e][_0xe751('0x73')],'custom':_0x2d2f21[_0x3cc34e]['custom_field'],'options':_0x2d2f21[_0x3cc34e][_0xe751('0x74')]==='picklist'&&_0x2d2f21[_0x3cc34e][_0xe751('0x75')][_0xe751('0x40')]>-0x1?_['map'](_0x2d2f21[_0x3cc34e][_0xe751('0x75')],function(_0xdc968b){return{'name':_0xdc968b,'value':_0xdc968b};}):[]});}}return{'count':_0x3d2262['length'],'rows':_0x3d2262};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4273be,null))[_0xe751('0x3e')](function(_0x59eafb){var _0x5383db=_0x303994[_0xe751('0x2b')][_0xe751('0x76')]?0x1f4:_0x59eafb[_0xe751('0x77')]||0x1f4;logger['error'](_0xe751('0x78'),_0xe751('0x59'),_0x5383db,JSON[_0xe751('0x79')](_0x59eafb));delete _0x59eafb[_0xe751('0x2a')];if(_0x5383db===0x191){_0x5383db=0x190;}_0x4273be[_0xe751('0x16')](_0x5383db)[_0xe751('0x7a')](_0x303994['query'][_0xe751('0x76')]?{'message':_0xe751('0x7b'),'statusCode':_0x59eafb['statusCode']}:_0x59eafb);});}; \ No newline at end of file +var _0xaa73=['pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','apply','save','then','destroy','error','name','ZohoAccount','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','getConfigurations','findOne','ZohoConfiguration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','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','zoho.eu','com','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','WhoId','Call_Duration','Call_Result','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist'];(function(_0x58988c,_0x5c297f){var _0x33e4b6=function(_0x268c33){while(--_0x268c33){_0x58988c['push'](_0x58988c['shift']());}};_0x33e4b6(++_0x5c297f);}(_0xaa73,0xfe));var _0x3aa7=function(_0x3c4b1e,_0x466d35){_0x3c4b1e=_0x3c4b1e-0x0;var _0x1cacee=_0xaa73[_0x3c4b1e];return _0x1cacee;};'use strict';var emlformat=require(_0x3aa7('0x0'));var rimraf=require(_0x3aa7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3aa7('0x2'));var rp=require(_0x3aa7('0x3'));var moment=require(_0x3aa7('0x4'));var BPromise=require(_0x3aa7('0x5'));var Mustache=require(_0x3aa7('0x6'));var util=require('util');var path=require(_0x3aa7('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3aa7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3aa7('0x9'));var squel=require('squel');var crypto=require(_0x3aa7('0xa'));var jsforce=require(_0x3aa7('0xb'));var deskjs=require(_0x3aa7('0xc'));var toCsv=require(_0x3aa7('0xd'));var querystring=require(_0x3aa7('0xe'));var Papa=require(_0x3aa7('0xf'));var Redis=require(_0x3aa7('0x10'));var authService=require(_0x3aa7('0x11'));var qs=require(_0x3aa7('0x12'));var as=require(_0x3aa7('0x13'));var hardwareService=require(_0x3aa7('0x14'));var logger=require('../../config/logger')(_0x3aa7('0x15'));var utils=require(_0x3aa7('0x16'));var config=require(_0x3aa7('0x17'));var licenseUtil=require(_0x3aa7('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3aa7('0x19'));function respondWithStatusCode(_0x5edf6b,_0x17f0b4){_0x17f0b4=_0x17f0b4||0xcc;return function(_0x1db79a){if(_0x1db79a){return _0x5edf6b[_0x3aa7('0x1a')](_0x17f0b4);}return _0x5edf6b['status'](_0x17f0b4)[_0x3aa7('0x1b')]();};}function respondWithResult(_0xc0928c,_0x5f26cc){_0x5f26cc=_0x5f26cc||0xc8;return function(_0x15f8f0){if(_0x15f8f0){return _0xc0928c[_0x3aa7('0x1c')](_0x5f26cc)[_0x3aa7('0x1d')](_0x15f8f0);}};}function respondWithFilteredResult(_0x21de33,_0x5f3c62){return function(_0x1f8218){if(_0x1f8218){var _0x1d00d7=typeof _0x5f3c62[_0x3aa7('0x1e')]===_0x3aa7('0x1f')&&typeof _0x5f3c62['limit']==='undefined';var _0x3f6b6f=_0x1f8218[_0x3aa7('0x20')];var _0x54c8fd=_0x1d00d7?0x0:_0x5f3c62[_0x3aa7('0x1e')];var _0x4f47a2=_0x1d00d7?_0x1f8218[_0x3aa7('0x20')]:_0x5f3c62[_0x3aa7('0x1e')]+_0x5f3c62[_0x3aa7('0x21')];var _0x326717;if(_0x4f47a2>=_0x3f6b6f){_0x4f47a2=_0x3f6b6f;_0x326717=0xc8;}else{_0x326717=0xce;}_0x21de33['status'](_0x326717);return _0x21de33['set']('Content-Range',_0x54c8fd+'-'+_0x4f47a2+'/'+_0x3f6b6f)['json'](_0x1f8218);}return null;};}function patchUpdates(_0x3f4acd){return function(_0x237c22){try{jsonpatch[_0x3aa7('0x22')](_0x237c22,_0x3f4acd,!![]);}catch(_0x69983f){return BPromise['reject'](_0x69983f);}return _0x237c22[_0x3aa7('0x23')]();};}function saveUpdates(_0x46473f,_0x11131b){return function(_0x20d184){if(_0x20d184){return _0x20d184['update'](_0x46473f)[_0x3aa7('0x24')](function(_0xae7451){return _0xae7451;});}return null;};}function removeEntity(_0x38d202,_0x336582){return function(_0x11a948){if(_0x11a948){return _0x11a948[_0x3aa7('0x25')]()[_0x3aa7('0x24')](function(){_0x38d202[_0x3aa7('0x1c')](0xcc)[_0x3aa7('0x1b')]();});}};}function handleEntityNotFound(_0x2d88b6,_0x408750){return function(_0x3dfbb7){if(!_0x3dfbb7){_0x2d88b6[_0x3aa7('0x1a')](0x194);}return _0x3dfbb7;};}function handleError(_0x18fe8c,_0x321eb5){_0x321eb5=_0x321eb5||0x1f4;return function(_0x31e833){logger[_0x3aa7('0x26')](_0x31e833['stack']);if(_0x31e833[_0x3aa7('0x27')]){delete _0x31e833['name'];}_0x18fe8c[_0x3aa7('0x1c')](_0x321eb5)['send'](_0x31e833);};}exports['index']=function(_0xd7b35c,_0x5ac224){var _0x259930={},_0x39d590={},_0x41d135={'count':0x0,'rows':[]};var _0x5a2ee4=_['map'](db[_0x3aa7('0x28')]['rawAttributes'],function(_0x43054b){return{'name':_0x43054b['fieldName'],'type':_0x43054b[_0x3aa7('0x29')]['key']};});_0x39d590['model']=_[_0x3aa7('0x2a')](_0x5a2ee4,_0x3aa7('0x27'));_0x39d590[_0x3aa7('0x2b')]=_['keys'](_0xd7b35c[_0x3aa7('0x2b')]);_0x39d590[_0x3aa7('0x2c')]=_[_0x3aa7('0x2d')](_0x39d590[_0x3aa7('0x2e')],_0x39d590[_0x3aa7('0x2b')]);_0x259930[_0x3aa7('0x2f')]=_['intersection'](_0x39d590[_0x3aa7('0x2e')],qs[_0x3aa7('0x30')](_0xd7b35c[_0x3aa7('0x2b')][_0x3aa7('0x30')]));_0x259930[_0x3aa7('0x2f')]=_0x259930[_0x3aa7('0x2f')][_0x3aa7('0x31')]?_0x259930[_0x3aa7('0x2f')]:_0x39d590[_0x3aa7('0x2e')];if(!_0xd7b35c[_0x3aa7('0x2b')][_0x3aa7('0x32')](_0x3aa7('0x33'))){_0x259930['limit']=qs['limit'](_0xd7b35c[_0x3aa7('0x2b')][_0x3aa7('0x21')]);_0x259930[_0x3aa7('0x1e')]=qs[_0x3aa7('0x1e')](_0xd7b35c[_0x3aa7('0x2b')]['offset']);}_0x259930[_0x3aa7('0x34')]=qs[_0x3aa7('0x35')](_0xd7b35c[_0x3aa7('0x2b')][_0x3aa7('0x35')]);_0x259930[_0x3aa7('0x36')]=qs[_0x3aa7('0x2c')](_[_0x3aa7('0x37')](_0xd7b35c[_0x3aa7('0x2b')],_0x39d590[_0x3aa7('0x2c')]),_0x5a2ee4);if(_0xd7b35c[_0x3aa7('0x2b')][_0x3aa7('0x38')]){_0x259930[_0x3aa7('0x36')]=_[_0x3aa7('0x39')](_0x259930[_0x3aa7('0x36')],{'$or':_[_0x3aa7('0x2a')](_0x5a2ee4,function(_0x4bcd39){if(_0x4bcd39[_0x3aa7('0x29')]!=='VIRTUAL'){var _0x185409={};_0x185409[_0x4bcd39[_0x3aa7('0x27')]]={'$like':'%'+_0xd7b35c['query']['filter']+'%'};return _0x185409;}})});}_0x259930=_[_0x3aa7('0x39')]({},_0x259930,_0xd7b35c[_0x3aa7('0x3a')]);var _0x560bb4={'where':_0x259930[_0x3aa7('0x36')]};return db['ZohoAccount'][_0x3aa7('0x20')](_0x560bb4)['then'](function(_0x49bcf4){_0x41d135['count']=_0x49bcf4;if(_0xd7b35c[_0x3aa7('0x2b')][_0x3aa7('0x3b')]){_0x259930[_0x3aa7('0x3c')]=[{'all':!![]}];}return db['ZohoAccount'][_0x3aa7('0x3d')](_0x259930);})[_0x3aa7('0x24')](function(_0x54543b){_0x41d135[_0x3aa7('0x3e')]=_0x54543b;return _0x41d135;})[_0x3aa7('0x24')](respondWithFilteredResult(_0x5ac224,_0x259930))['catch'](handleError(_0x5ac224,null));};exports[_0x3aa7('0x3f')]=function(_0x3ae804,_0x3260af){var _0x343b75={'raw':![],'where':{'id':_0x3ae804[_0x3aa7('0x40')]['id']}},_0x7146c6={};_0x7146c6[_0x3aa7('0x2e')]=_[_0x3aa7('0x41')](db[_0x3aa7('0x28')]['rawAttributes']);_0x7146c6['query']=_[_0x3aa7('0x41')](_0x3ae804['query']);_0x7146c6[_0x3aa7('0x2c')]=_[_0x3aa7('0x2d')](_0x7146c6[_0x3aa7('0x2e')],_0x7146c6[_0x3aa7('0x2b')]);_0x343b75[_0x3aa7('0x2f')]=_[_0x3aa7('0x2d')](_0x7146c6[_0x3aa7('0x2e')],qs['fields'](_0x3ae804[_0x3aa7('0x2b')][_0x3aa7('0x30')]));_0x343b75[_0x3aa7('0x2f')]=_0x343b75[_0x3aa7('0x2f')][_0x3aa7('0x31')]?_0x343b75[_0x3aa7('0x2f')]:_0x7146c6['model'];if(_0x3ae804[_0x3aa7('0x2b')][_0x3aa7('0x3b')]){_0x343b75[_0x3aa7('0x3c')]=[{'all':!![]}];}_0x343b75=_[_0x3aa7('0x39')]({},_0x343b75,_0x3ae804[_0x3aa7('0x3a')]);return db[_0x3aa7('0x28')][_0x3aa7('0x42')](_0x343b75)[_0x3aa7('0x24')](handleEntityNotFound(_0x3260af,null))[_0x3aa7('0x24')](respondWithResult(_0x3260af,null))[_0x3aa7('0x43')](handleError(_0x3260af,null));};exports['create']=function(_0x320151,_0x52a176){return db[_0x3aa7('0x28')][_0x3aa7('0x44')](_0x320151['body'],{})['then'](respondWithResult(_0x52a176,0xc9))['catch'](handleError(_0x52a176,null));};exports['update']=function(_0x37b7fa,_0x15acce){if(_0x37b7fa[_0x3aa7('0x45')]['id']){delete _0x37b7fa[_0x3aa7('0x45')]['id'];}return db[_0x3aa7('0x28')][_0x3aa7('0x42')]({'where':{'id':_0x37b7fa['params']['id']}})[_0x3aa7('0x24')](handleEntityNotFound(_0x15acce,null))[_0x3aa7('0x24')](saveUpdates(_0x37b7fa[_0x3aa7('0x45')],null))['then'](respondWithResult(_0x15acce,null))[_0x3aa7('0x43')](handleError(_0x15acce,null));};exports['destroy']=function(_0x11fb60,_0x3e0f58){return db['ZohoAccount'][_0x3aa7('0x42')]({'where':{'id':_0x11fb60[_0x3aa7('0x40')]['id']}})[_0x3aa7('0x24')](handleEntityNotFound(_0x3e0f58,null))[_0x3aa7('0x24')](removeEntity(_0x3e0f58,null))['catch'](handleError(_0x3e0f58,null));};exports[_0x3aa7('0x46')]=function(_0x2ffc4c,_0xc703c0,_0x472378){var _0x10d75d={};var _0x3bca18={};var _0x2f4c9a;var _0x456e11;return db[_0x3aa7('0x28')][_0x3aa7('0x47')]({'where':{'id':_0x2ffc4c[_0x3aa7('0x40')]['id']}})['then'](handleEntityNotFound(_0xc703c0,null))[_0x3aa7('0x24')](function(_0x4931f8){if(_0x4931f8){_0x2f4c9a=_0x4931f8;_0x3bca18['model']=_[_0x3aa7('0x41')](db[_0x3aa7('0x48')][_0x3aa7('0x49')]);_0x3bca18['query']=_[_0x3aa7('0x41')](_0x2ffc4c[_0x3aa7('0x2b')]);_0x3bca18[_0x3aa7('0x2c')]=_[_0x3aa7('0x2d')](_0x3bca18['model'],_0x3bca18[_0x3aa7('0x2b')]);_0x10d75d['attributes']=_[_0x3aa7('0x2d')](_0x3bca18[_0x3aa7('0x2e')],qs[_0x3aa7('0x30')](_0x2ffc4c[_0x3aa7('0x2b')][_0x3aa7('0x30')]));_0x10d75d[_0x3aa7('0x2f')]=_0x10d75d[_0x3aa7('0x2f')][_0x3aa7('0x31')]?_0x10d75d['attributes']:_0x3bca18['model'];_0x10d75d[_0x3aa7('0x34')]=qs[_0x3aa7('0x35')](_0x2ffc4c['query']['sort']);_0x10d75d['where']=qs['filters'](_[_0x3aa7('0x37')](_0x2ffc4c[_0x3aa7('0x2b')],_0x3bca18[_0x3aa7('0x2c')]));if(_0x2ffc4c[_0x3aa7('0x2b')][_0x3aa7('0x38')]){_0x10d75d[_0x3aa7('0x36')]=_[_0x3aa7('0x39')](_0x10d75d[_0x3aa7('0x36')],{'$or':_[_0x3aa7('0x2a')](_0x10d75d['attributes'],function(_0x38d365){var _0xda867e={};_0xda867e[_0x38d365]={'$like':'%'+_0x2ffc4c['query'][_0x3aa7('0x38')]+'%'};return _0xda867e;})});}_0x10d75d=_[_0x3aa7('0x39')]({},_0x10d75d,_0x2ffc4c[_0x3aa7('0x3a')]);return _0x2f4c9a[_0x3aa7('0x46')](_0x10d75d);}})[_0x3aa7('0x24')](function(_0x31abac){if(_0x31abac){_0x456e11=_0x31abac['length'];if(!_0x2ffc4c[_0x3aa7('0x2b')][_0x3aa7('0x32')](_0x3aa7('0x33'))){_0x10d75d[_0x3aa7('0x21')]=qs[_0x3aa7('0x21')](_0x2ffc4c[_0x3aa7('0x2b')][_0x3aa7('0x21')]);_0x10d75d[_0x3aa7('0x1e')]=qs[_0x3aa7('0x1e')](_0x2ffc4c[_0x3aa7('0x2b')]['offset']);}return _0x2f4c9a[_0x3aa7('0x46')](_0x10d75d);}})[_0x3aa7('0x24')](function(_0x5073be){if(_0x5073be){return _0x5073be?{'count':_0x456e11,'rows':_0x5073be}:null;}})[_0x3aa7('0x24')](respondWithResult(_0xc703c0,null))[_0x3aa7('0x43')](handleError(_0xc703c0,null));};exports[_0x3aa7('0x4a')]=function(_0x51b3f9,_0x56fa85,_0x682750){if(_0x51b3f9[_0x3aa7('0x45')]['id']){delete _0x51b3f9['body']['id'];}return db[_0x3aa7('0x28')][_0x3aa7('0x47')]({'where':{'id':_0x51b3f9[_0x3aa7('0x40')]['id']}})[_0x3aa7('0x24')](handleEntityNotFound(_0x56fa85,null))[_0x3aa7('0x24')](function(_0xb70b50){if(_0xb70b50){_0x51b3f9['body'][_0x3aa7('0x4b')]=_0xb70b50['id'];_0x51b3f9[_0x3aa7('0x45')][_0x3aa7('0x4c')]=integrations[_0x3aa7('0x4d')](_0x51b3f9['body'][_0x3aa7('0x4e')],_0x51b3f9['body'][_0x3aa7('0x29')]);_0x51b3f9['body'][_0x3aa7('0x4f')]=integrations[_0x3aa7('0x50')](_0x51b3f9['body'][_0x3aa7('0x4e')],_0x51b3f9[_0x3aa7('0x45')][_0x3aa7('0x29')]);return db[_0x3aa7('0x48')][_0x3aa7('0x44')](_0x51b3f9[_0x3aa7('0x45')],{'include':[{'model':db['ZohoField'],'as':_0x3aa7('0x4c')},{'model':db[_0x3aa7('0x51')],'as':_0x3aa7('0x4f')}]});}return null;})[_0x3aa7('0x24')](respondWithResult(_0x56fa85,null))[_0x3aa7('0x43')](handleError(_0x56fa85,null));};function getAccessToken(_0x5717c5){return new Promise(function(_0x24ae47,_0x13d7a1){var _0x19d847;switch(_0x5717c5['zone']){case'US':_0x19d847=_0x3aa7('0x52');break;case'AU':_0x19d847='https://accounts.zoho.com.au';break;case'EU':_0x19d847=_0x3aa7('0x53');break;case'IN':_0x19d847=_0x3aa7('0x54');break;case'CN':_0x19d847='https://accounts.zoho.com.cn';break;default:_0x19d847=_0x3aa7('0x53');break;}var _0x2529aa={'method':_0x3aa7('0x55'),'uri':_0x19d847+_0x3aa7('0x56'),'qs':{'refresh_token':_0x5717c5[_0x3aa7('0x57')],'client_id':_0x5717c5[_0x3aa7('0x58')],'client_secret':_0x5717c5[_0x3aa7('0x59')],'grant_type':_0x3aa7('0x5a')},'json':!![]};return rp(_0x2529aa)[_0x3aa7('0x24')](function(_0x591afe){if(_0x591afe[_0x3aa7('0x5b')]){_0x24ae47(_0x591afe[_0x3aa7('0x5b')]);}else{_0x13d7a1(_0x3aa7('0x5c'));}})[_0x3aa7('0x43')](function(_0x5f5622){_0x13d7a1(_0x5f5622);});});}exports[_0x3aa7('0x5d')]=function(_0x42aff5,_0x58fa9f,_0x1f8f6f){var _0x356abe,_0x304fac,_0x5cf94b,_0x145183,_0x4a5ef2;return db[_0x3aa7('0x28')]['findOne']({'where':{'id':_0x42aff5[_0x3aa7('0x40')]['id']},'attributes':['id',_0x3aa7('0x5e'),_0x3aa7('0x5f'),_0x3aa7('0x58'),'clientSecret',_0x3aa7('0x60'),'code',_0x3aa7('0x57')]})[_0x3aa7('0x24')](handleEntityNotFound(_0x58fa9f,null))[_0x3aa7('0x24')](function(_0x479974){_0x4a5ef2=_0x479974;_0x356abe=_0x4a5ef2[_0x3aa7('0x5e')];_0x304fac=_0x356abe===_0x3aa7('0x61')?'eu':_0x3aa7('0x62');_0x5cf94b=_0x4a5ef2[_0x3aa7('0x60')];var _0x5ac03b=_0x5cf94b[_0x3aa7('0x63')](-0x1);if(_0x5ac03b==='/'||_0x5ac03b==='\x5c'||_0x5ac03b===':'){_0x5cf94b=_0x5cf94b['substring'](0x0,_0x5cf94b['lastIndexOf'](_0x5ac03b));}if(!_0x4a5ef2['refreshToken']){throw new Error(_0x3aa7('0x64'));}return getAccessToken(_0x4a5ef2);})[_0x3aa7('0x24')](function(_0xd64579){if(_0xd64579){return rp({'method':_0x3aa7('0x65'),'uri':util[_0x3aa7('0x66')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x304fac),'qs':{'module':_0x3aa7('0x67')},'headers':{'Authorization':_0x3aa7('0x68')+_0xd64579},'json':!![]});}})[_0x3aa7('0x24')](function(_0x13edc5){if(_0x13edc5){if(_0x13edc5[_0x3aa7('0x69')]&&_0x13edc5[_0x3aa7('0x69')][_0x3aa7('0x26')]){throw new Error(_0x13edc5['response']['error'][_0x3aa7('0x6a')]);}var _0x1cc1eb=[];var _0x27ee94=[];var _0x3b465d=['Owner','Subject','Description',_0x3aa7('0x6b'),_0x3aa7('0x6c'),_0x3aa7('0x6d'),'Call_Start_Time','Call_Type'];_0x27ee94=_[_0x3aa7('0x6e')](_0x13edc5[_0x3aa7('0x30')],function(_0x49ac87){return _0x3b465d[_0x3aa7('0x6f')](_0x49ac87['api_name']);});for(var _0x5126ab=0x0;_0x5126ab<_0x27ee94[_0x3aa7('0x31')];_0x5126ab++){if(_0x27ee94[_0x5126ab][_0x3aa7('0x70')]===![]){_0x1cc1eb[_0x3aa7('0x71')]({'id':_0x27ee94[_0x5126ab]['id'],'name':_0x27ee94[_0x5126ab][_0x3aa7('0x72')],'custom':_0x27ee94[_0x5126ab][_0x3aa7('0x73')],'options':_0x27ee94[_0x5126ab][_0x3aa7('0x74')]===_0x3aa7('0x75')&&_0x27ee94[_0x5126ab][_0x3aa7('0x76')]['length']>-0x1?_['map'](_0x27ee94[_0x5126ab][_0x3aa7('0x76')],function(_0xf964c0){return{'name':_0xf964c0,'value':_0xf964c0};}):[]});}}return{'count':_0x1cc1eb[_0x3aa7('0x31')],'rows':_0x1cc1eb};}else{return{'count':0x0,'rows':[]};}})[_0x3aa7('0x24')](respondWithResult(_0x58fa9f,null))[_0x3aa7('0x43')](function(_0x5bdf99){var _0x324e4=_0x42aff5[_0x3aa7('0x2b')]['test']?0x1f4:_0x5bdf99[_0x3aa7('0x77')]||0x1f4;logger[_0x3aa7('0x26')](_0x3aa7('0x78'),_0x3aa7('0x5d'),_0x324e4,JSON[_0x3aa7('0x79')](_0x5bdf99));delete _0x5bdf99[_0x3aa7('0x27')];if(_0x324e4===0x191){_0x324e4=0x190;}_0x58fa9f[_0x3aa7('0x1c')](_0x324e4)[_0x3aa7('0x7a')](_0x42aff5[_0x3aa7('0x2b')][_0x3aa7('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x5bdf99[_0x3aa7('0x77')]}:_0x5bdf99);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index f2eb02c..630d9ad 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 _0x7c74=['ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','host','substring','lastIndexOf','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','authorization_code','code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x4e63e4,_0x53420e){var _0x562c39=function(_0x3e9327){while(--_0x3e9327){_0x4e63e4['push'](_0x4e63e4['shift']());}};_0x562c39(++_0x53420e);}(_0x7c74,0x79));var _0x47c7=function(_0x14b767,_0x577e84){_0x14b767=_0x14b767-0x0;var _0x22267a=_0x7c74[_0x14b767];return _0x22267a;};'use strict';var _=require(_0x47c7('0x0'));var util=require(_0x47c7('0x1'));var logger=require(_0x47c7('0x2'))(_0x47c7('0x3'));var moment=require(_0x47c7('0x4'));var BPromise=require(_0x47c7('0x5'));var rp=require(_0x47c7('0x6'));var fs=require('fs');var path=require(_0x47c7('0x7'));var rimraf=require(_0x47c7('0x8'));var config=require(_0x47c7('0x9'));var attributes=require(_0x47c7('0xa'));var integrations=require(_0x47c7('0xb'));module[_0x47c7('0xc')]=function(_0x2b3d08,_0x1a9dc6){return _0x2b3d08[_0x47c7('0xd')](_0x47c7('0xe'),attributes,{'tableName':_0x47c7('0xf'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe16072,_0x2c6053,_0x45a8e3){if(_0xe16072['changed']('zone')||_0xe16072[_0x47c7('0x10')](_0x47c7('0x11'))||_0xe16072[_0x47c7('0x10')](_0x47c7('0x12'))||_0xe16072[_0x47c7('0x10')](_0x47c7('0x13'))||_0xe16072[_0x47c7('0x10')]('code')||_0xe16072[_0x47c7('0x10')](_0x47c7('0x14'))){var _0x45db70,_0x13e225;_0x45db70=_0xe16072[_0x47c7('0x11')];var _0xd722f4=_0x45db70['slice'](-0x1);if(_0xd722f4==='/'||_0xd722f4==='\x5c'||_0xd722f4===':'){_0x45db70=_0x45db70[_0x47c7('0x15')](0x0,_0x45db70[_0x47c7('0x16')](_0xd722f4));}switch(_0xe16072[_0x47c7('0x17')]){case'US':_0x13e225=_0x47c7('0x18');break;case'AU':_0x13e225=_0x47c7('0x19');break;case'IN':_0x13e225=_0x47c7('0x1a');break;case'CN':_0x13e225=_0x47c7('0x1b');break;default:_0x13e225=_0x47c7('0x1c');break;}var _0x52e2cd={'method':_0x47c7('0x1d'),'uri':_0x13e225+_0x47c7('0x1e'),'form':{'grant_type':_0x47c7('0x1f'),'client_id':_0xe16072[_0x47c7('0x12')],'client_secret':_0xe16072[_0x47c7('0x13')],'redirect_uri':_0xe16072[_0x47c7('0x11')],'code':_0xe16072[_0x47c7('0x20')]},'headers':{'Content-Type':_0x47c7('0x21')}};return rp(_0x52e2cd)[_0x47c7('0x22')](function(_0x526978){var _0x5dc9a0=JSON[_0x47c7('0x23')](_0x526978);if(_0x5dc9a0['refresh_token']){_0xe16072[_0x47c7('0x24')]=_0x5dc9a0[_0x47c7('0x25')];logger[_0x47c7('0x26')](util[_0x47c7('0x27')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xe16072['name'],_0xe16072['id']));}else{logger[_0x47c7('0x28')](util['format'](_0x47c7('0x29'),_0xe16072[_0x47c7('0x2a')],_0xe16072['id']),util[_0x47c7('0x2b')](_0x5dc9a0,{'showHidden':![],'depth':null}));}return _0x45a8e3(null,_0x2c6053);})[_0x47c7('0x2c')](function(_0x9504ad){logger['error'](util[_0x47c7('0x27')](_0x47c7('0x29'),_0xe16072[_0x47c7('0x2a')],_0xe16072['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x45a8e3(_0x9504ad);});}else{return _0x45a8e3(null,_0x2c6053);}},'beforeUpdate':function(_0x5c40e3,_0x181662,_0x45e01b){if(_0x5c40e3['changed'](_0x47c7('0x17'))||_0x5c40e3[_0x47c7('0x10')](_0x47c7('0x11'))||_0x5c40e3[_0x47c7('0x10')]('clientId')||_0x5c40e3[_0x47c7('0x10')](_0x47c7('0x13'))||_0x5c40e3[_0x47c7('0x10')](_0x47c7('0x20'))||_0x5c40e3[_0x47c7('0x10')]('host')){var _0xfc138b,_0x527714;_0xfc138b=_0x5c40e3[_0x47c7('0x11')];var _0x233413=_0xfc138b['slice'](-0x1);if(_0x233413==='/'||_0x233413==='\x5c'||_0x233413===':'){_0xfc138b=_0xfc138b[_0x47c7('0x15')](0x0,_0xfc138b[_0x47c7('0x16')](_0x233413));}switch(_0x5c40e3[_0x47c7('0x17')]){case'US':_0x527714=_0x47c7('0x18');break;case'AU':_0x527714=_0x47c7('0x19');break;case'IN':_0x527714=_0x47c7('0x1a');break;case'CN':_0x527714=_0x47c7('0x1b');break;default:_0x527714=_0x47c7('0x1c');break;}var _0xfe4386={'method':'POST','uri':_0x527714+_0x47c7('0x1e'),'form':{'grant_type':'authorization_code','client_id':_0x5c40e3[_0x47c7('0x12')],'client_secret':_0x5c40e3[_0x47c7('0x13')],'redirect_uri':_0x5c40e3['serverUrl'],'code':_0x5c40e3[_0x47c7('0x20')]},'headers':{'Content-Type':_0x47c7('0x21')}};return rp(_0xfe4386)[_0x47c7('0x22')](function(_0x4411db){var _0x11637b=JSON[_0x47c7('0x23')](_0x4411db);if(_0x11637b[_0x47c7('0x25')]){_0x5c40e3[_0x47c7('0x24')]=_0x11637b['refresh_token'];logger[_0x47c7('0x26')](util[_0x47c7('0x27')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5c40e3[_0x47c7('0x2a')],_0x5c40e3['id']));}else{logger[_0x47c7('0x28')](util[_0x47c7('0x27')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5c40e3['name'],_0x5c40e3['id']),util[_0x47c7('0x2b')](_0x11637b,{'showHidden':![],'depth':null}));}return _0x45e01b(null,_0x181662);})['catch'](function(_0x124dbf){logger['error'](util[_0x47c7('0x27')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5c40e3['name'],_0x5c40e3['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x45e01b(_0x124dbf);});}else{return _0x45e01b(null,_0x181662);}}}});}; \ No newline at end of file +var _0xc7e7=['https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','application/x-www-form-urlencoded','parse','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','host','refresh_token','catch','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xc7e7,0x103));var _0x7c7e=function(_0xcc1445,_0x3a62a3){_0xcc1445=_0xcc1445-0x0;var _0x2c8bf0=_0xc7e7[_0xcc1445];return _0x2c8bf0;};'use strict';var _=require(_0x7c7e('0x0'));var util=require('util');var logger=require(_0x7c7e('0x1'))(_0x7c7e('0x2'));var moment=require(_0x7c7e('0x3'));var BPromise=require('bluebird');var rp=require(_0x7c7e('0x4'));var fs=require('fs');var path=require(_0x7c7e('0x5'));var rimraf=require('rimraf');var config=require(_0x7c7e('0x6'));var attributes=require(_0x7c7e('0x7'));var integrations=require(_0x7c7e('0x8'));module['exports']=function(_0x1e04a4,_0x7297ad){return _0x1e04a4['define'](_0x7c7e('0x9'),attributes,{'tableName':_0x7c7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x212768,_0x4c06f7,_0x5bc887){if(_0x212768[_0x7c7e('0xb')](_0x7c7e('0xc'))||_0x212768[_0x7c7e('0xb')](_0x7c7e('0xd'))||_0x212768[_0x7c7e('0xb')]('clientId')||_0x212768[_0x7c7e('0xb')](_0x7c7e('0xe'))||_0x212768[_0x7c7e('0xb')](_0x7c7e('0xf'))||_0x212768['changed']('host')){var _0x4916c4,_0x2a2815;_0x4916c4=_0x212768[_0x7c7e('0xd')];var _0x4c235a=_0x4916c4[_0x7c7e('0x10')](-0x1);if(_0x4c235a==='/'||_0x4c235a==='\x5c'||_0x4c235a===':'){_0x4916c4=_0x4916c4[_0x7c7e('0x11')](0x0,_0x4916c4[_0x7c7e('0x12')](_0x4c235a));}switch(_0x212768['zone']){case'US':_0x2a2815=_0x7c7e('0x13');break;case'AU':_0x2a2815=_0x7c7e('0x14');break;case'IN':_0x2a2815=_0x7c7e('0x15');break;case'CN':_0x2a2815=_0x7c7e('0x16');break;default:_0x2a2815=_0x7c7e('0x17');break;}var _0x3e3817={'method':_0x7c7e('0x18'),'uri':_0x2a2815+_0x7c7e('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x212768[_0x7c7e('0x1a')],'client_secret':_0x212768['clientSecret'],'redirect_uri':_0x212768[_0x7c7e('0xd')],'code':_0x212768[_0x7c7e('0xf')]},'headers':{'Content-Type':_0x7c7e('0x1b')}};return rp(_0x3e3817)['then'](function(_0x2c65f0){var _0x236cf9=JSON[_0x7c7e('0x1c')](_0x2c65f0);if(_0x236cf9['refresh_token']){_0x212768[_0x7c7e('0x1d')]=_0x236cf9['refresh_token'];logger[_0x7c7e('0x1e')](util[_0x7c7e('0x1f')](_0x7c7e('0x20'),_0x212768[_0x7c7e('0x21')],_0x212768['id']));}else{logger[_0x7c7e('0x22')](util[_0x7c7e('0x1f')](_0x7c7e('0x23'),_0x212768[_0x7c7e('0x21')],_0x212768['id']),util[_0x7c7e('0x24')](_0x236cf9,{'showHidden':![],'depth':null}));}return _0x5bc887(null,_0x4c06f7);})['catch'](function(_0x3538c8){logger[_0x7c7e('0x22')](util[_0x7c7e('0x1f')](_0x7c7e('0x23'),_0x212768[_0x7c7e('0x21')],_0x212768['id']),util[_0x7c7e('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5bc887(_0x3538c8);});}else{return _0x5bc887(null,_0x4c06f7);}},'beforeUpdate':function(_0x5543db,_0x14127f,_0x106572){if(_0x5543db[_0x7c7e('0xb')](_0x7c7e('0xc'))||_0x5543db[_0x7c7e('0xb')](_0x7c7e('0xd'))||_0x5543db[_0x7c7e('0xb')](_0x7c7e('0x1a'))||_0x5543db[_0x7c7e('0xb')]('clientSecret')||_0x5543db['changed'](_0x7c7e('0xf'))||_0x5543db[_0x7c7e('0xb')](_0x7c7e('0x25'))){var _0x4f4f8c,_0x1e3096;_0x4f4f8c=_0x5543db['serverUrl'];var _0x2b49c1=_0x4f4f8c[_0x7c7e('0x10')](-0x1);if(_0x2b49c1==='/'||_0x2b49c1==='\x5c'||_0x2b49c1===':'){_0x4f4f8c=_0x4f4f8c[_0x7c7e('0x11')](0x0,_0x4f4f8c[_0x7c7e('0x12')](_0x2b49c1));}switch(_0x5543db['zone']){case'US':_0x1e3096=_0x7c7e('0x13');break;case'AU':_0x1e3096=_0x7c7e('0x14');break;case'IN':_0x1e3096=_0x7c7e('0x15');break;case'CN':_0x1e3096='https://accounts.zoho.com.cn';break;default:_0x1e3096=_0x7c7e('0x17');break;}var _0x412958={'method':_0x7c7e('0x18'),'uri':_0x1e3096+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x5543db['clientId'],'client_secret':_0x5543db[_0x7c7e('0xe')],'redirect_uri':_0x5543db[_0x7c7e('0xd')],'code':_0x5543db[_0x7c7e('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x412958)['then'](function(_0x3d54c3){var _0x2a0e2a=JSON[_0x7c7e('0x1c')](_0x3d54c3);if(_0x2a0e2a[_0x7c7e('0x26')]){_0x5543db[_0x7c7e('0x1d')]=_0x2a0e2a[_0x7c7e('0x26')];logger[_0x7c7e('0x1e')](util[_0x7c7e('0x1f')](_0x7c7e('0x20'),_0x5543db[_0x7c7e('0x21')],_0x5543db['id']));}else{logger['error'](util[_0x7c7e('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5543db[_0x7c7e('0x21')],_0x5543db['id']),util[_0x7c7e('0x24')](_0x2a0e2a,{'showHidden':![],'depth':null}));}return _0x106572(null,_0x14127f);})[_0x7c7e('0x27')](function(_0x1e4cc6){logger[_0x7c7e('0x22')](util[_0x7c7e('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5543db[_0x7c7e('0x21')],_0x5543db['id']),util[_0x7c7e('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x106572(_0x1e4cc6);});}else{return _0x106572(null,_0x14127f);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 939c46b..80c324a 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 _0xe558=['debug','ShowZohoAccount','ZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','findAll','options','raw','where','limit','include','map','attributes','model','GetZohoAccount'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xe558,0x70));var _0x8e55=function(_0x10c673,_0x4a60c9){_0x10c673=_0x10c673-0x0;var _0x4f1b71=_0xe558[_0x10c673];return _0x4f1b71;};'use strict';var _=require(_0x8e55('0x0'));var util=require(_0x8e55('0x1'));var moment=require(_0x8e55('0x2'));var BPromise=require(_0x8e55('0x3'));var rs=require(_0x8e55('0x4'));var fs=require('fs');var Redis=require(_0x8e55('0x5'));var db=require(_0x8e55('0x6'))['db'];var utils=require(_0x8e55('0x7'));var logger=require(_0x8e55('0x8'))('rpc');var config=require(_0x8e55('0x9'));var jayson=require(_0x8e55('0xa'));var client=jayson[_0x8e55('0xb')][_0x8e55('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cef42,_0x13c5db,_0x493307){return new BPromise(function(_0xe27f09,_0x429679){return client['request'](_0x3cef42,_0x493307)[_0x8e55('0xd')](function(_0x578110){logger['info'](_0x8e55('0xe'),_0x13c5db,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x13c5db,_0x8e55('0xf'),JSON[_0x8e55('0x10')](_0x578110));if(_0x578110[_0x8e55('0x11')]){if(_0x578110[_0x8e55('0x11')]['code']===0x1f4){logger[_0x8e55('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x13c5db,_0x578110['error']['message']);return _0x429679(_0x578110[_0x8e55('0x11')]['message']);}logger[_0x8e55('0x11')](_0x8e55('0xe'),_0x13c5db,_0x578110[_0x8e55('0x11')][_0x8e55('0x12')]);return _0xe27f09(_0x578110[_0x8e55('0x11')][_0x8e55('0x12')]);}else{logger[_0x8e55('0x13')](_0x8e55('0xe'),_0x13c5db,_0x8e55('0xf'));_0xe27f09(_0x578110[_0x8e55('0x14')][_0x8e55('0x12')]);}})[_0x8e55('0x15')](function(_0x202bc4){logger[_0x8e55('0x11')](_0x8e55('0xe'),_0x13c5db,_0x202bc4);_0x429679(_0x202bc4);});});}exports['GetZohoAccount']=function(_0xda8f1a){var _0x1e5d1f=this;return new Promise(function(_0x2d69e8,_0x3381c7){return db['ZohoAccount'][_0x8e55('0x16')]({'raw':_0xda8f1a[_0x8e55('0x17')]?_0xda8f1a[_0x8e55('0x17')][_0x8e55('0x18')]===undefined?!![]:![]:!![],'where':_0xda8f1a[_0x8e55('0x17')]?_0xda8f1a[_0x8e55('0x17')][_0x8e55('0x19')]||null:null,'attributes':_0xda8f1a[_0x8e55('0x17')]?_0xda8f1a['options']['attributes']||null:null,'limit':_0xda8f1a[_0x8e55('0x17')]?_0xda8f1a[_0x8e55('0x17')][_0x8e55('0x1a')]||null:null,'include':_0xda8f1a['options']?_0xda8f1a[_0x8e55('0x17')][_0x8e55('0x1b')]?_[_0x8e55('0x1c')](_0xda8f1a[_0x8e55('0x17')][_0x8e55('0x1b')],function(_0x25a8f3){return{'model':db[_0x25a8f3['model']],'as':_0x25a8f3['as'],'attributes':_0x25a8f3[_0x8e55('0x1d')],'include':_0x25a8f3[_0x8e55('0x1b')]?_['map'](_0x25a8f3[_0x8e55('0x1b')],function(_0x3f6fd8){return{'model':db[_0x3f6fd8[_0x8e55('0x1e')]],'as':_0x3f6fd8['as'],'attributes':_0x3f6fd8[_0x8e55('0x1d')],'include':_0x3f6fd8[_0x8e55('0x1b')]?_[_0x8e55('0x1c')](_0x3f6fd8[_0x8e55('0x1b')],function(_0x3b5d0f){return{'model':db[_0x3b5d0f[_0x8e55('0x1e')]],'as':_0x3b5d0f['as'],'attributes':_0x3b5d0f[_0x8e55('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8e55('0xd')](function(_0x5393e6){logger[_0x8e55('0x13')](_0x8e55('0x1f'),_0xda8f1a);logger[_0x8e55('0x20')](_0x8e55('0x1f'),_0xda8f1a,JSON['stringify'](_0x5393e6));_0x2d69e8(_0x5393e6);})[_0x8e55('0x15')](function(_0x4b96c9){logger[_0x8e55('0x11')](_0x8e55('0x1f'),_0x4b96c9['message'],_0xda8f1a);_0x3381c7(_0x1e5d1f[_0x8e55('0x11')](0x1f4,_0x4b96c9[_0x8e55('0x12')]));});});};exports[_0x8e55('0x21')]=function(_0x52b0d8){var _0x3a8c4d=this;return new Promise(function(_0x1228b3,_0x259d91){return db[_0x8e55('0x22')][_0x8e55('0x23')]({'raw':_0x52b0d8[_0x8e55('0x17')]?_0x52b0d8[_0x8e55('0x17')][_0x8e55('0x18')]===undefined?!![]:![]:!![],'where':_0x52b0d8['options']?_0x52b0d8['options']['where']||null:null,'attributes':_0x52b0d8[_0x8e55('0x17')]?_0x52b0d8[_0x8e55('0x17')][_0x8e55('0x1d')]||null:null,'include':_0x52b0d8['options']?_0x52b0d8[_0x8e55('0x17')]['include']?_['map'](_0x52b0d8[_0x8e55('0x17')][_0x8e55('0x1b')],function(_0x519a3f){return{'model':db[_0x519a3f[_0x8e55('0x1e')]],'as':_0x519a3f['as'],'attributes':_0x519a3f[_0x8e55('0x1d')],'include':_0x519a3f[_0x8e55('0x1b')]?_[_0x8e55('0x1c')](_0x519a3f[_0x8e55('0x1b')],function(_0x5f11f0){return{'model':db[_0x5f11f0[_0x8e55('0x1e')]],'as':_0x5f11f0['as'],'attributes':_0x5f11f0[_0x8e55('0x1d')],'include':_0x5f11f0[_0x8e55('0x1b')]?_[_0x8e55('0x1c')](_0x5f11f0['include'],function(_0x11c458){return{'model':db[_0x11c458[_0x8e55('0x1e')]],'as':_0x11c458['as'],'attributes':_0x11c458[_0x8e55('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17e3dc){logger[_0x8e55('0x13')](_0x8e55('0x21'),_0x52b0d8);logger[_0x8e55('0x20')](_0x8e55('0x21'),_0x52b0d8,JSON[_0x8e55('0x10')](_0x17e3dc));_0x1228b3(_0x17e3dc);})['catch'](function(_0x40f69d){logger[_0x8e55('0x11')](_0x8e55('0x21'),_0x40f69d[_0x8e55('0x12')],_0x52b0d8);_0x259d91(_0x3a8c4d[_0x8e55('0x11')](0x1f4,_0x40f69d[_0x8e55('0x12')]));});});}; \ No newline at end of file +var _0x6017=['model','find','ShowZohoAccount','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x4d7b67,_0x5b3c9f){var _0x2d85e6=function(_0x4c1558){while(--_0x4c1558){_0x4d7b67['push'](_0x4d7b67['shift']());}};_0x2d85e6(++_0x5b3c9f);}(_0x6017,0xae));var _0x7601=function(_0x39bb78,_0x52f827){_0x39bb78=_0x39bb78-0x0;var _0x11b11a=_0x6017[_0x39bb78];return _0x11b11a;};'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')]('ZohoAccount,\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')]('ZohoAccount,\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')]('ZohoAccount,\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')]({'raw':_0x5c3fb7[_0x7601('0x17')]?_0x5c3fb7[_0x7601('0x17')][_0x7601('0x18')]===undefined?!![]:![]:!![],'where':_0x5c3fb7['options']?_0x5c3fb7[_0x7601('0x17')][_0x7601('0x19')]||null:null,'attributes':_0x5c3fb7['options']?_0x5c3fb7[_0x7601('0x17')][_0x7601('0x1a')]||null:null,'limit':_0x5c3fb7[_0x7601('0x17')]?_0x5c3fb7[_0x7601('0x17')][_0x7601('0x1b')]||null:null,'include':_0x5c3fb7[_0x7601('0x17')]?_0x5c3fb7['options'][_0x7601('0x1c')]?_[_0x7601('0x1d')](_0x5c3fb7[_0x7601('0x17')][_0x7601('0x1c')],function(_0x57e7a6){return{'model':db[_0x57e7a6[_0x7601('0x1e')]],'as':_0x57e7a6['as'],'attributes':_0x57e7a6['attributes'],'include':_0x57e7a6[_0x7601('0x1c')]?_['map'](_0x57e7a6['include'],function(_0x326f8f){return{'model':db[_0x326f8f[_0x7601('0x1e')]],'as':_0x326f8f['as'],'attributes':_0x326f8f['attributes'],'include':_0x326f8f['include']?_[_0x7601('0x1d')](_0x326f8f['include'],function(_0x57f6e9){return{'model':db[_0x57f6e9[_0x7601('0x1e')]],'as':_0x57f6e9['as'],'attributes':_0x57f6e9[_0x7601('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7601('0xa')](function(_0x5807ce){logger[_0x7601('0x12')]('GetZohoAccount',_0x5c3fb7);logger[_0x7601('0xd')](_0x7601('0x14'),_0x5c3fb7,JSON['stringify'](_0x5807ce));_0x22520e(_0x5807ce);})['catch'](function(_0x44d765){logger[_0x7601('0xf')](_0x7601('0x14'),_0x44d765[_0x7601('0x11')],_0x5c3fb7);_0x403e38(_0x5f530e[_0x7601('0xf')](0x1f4,_0x44d765[_0x7601('0x11')]));});});};exports['ShowZohoAccount']=function(_0x497f5f){var _0x27f423=this;return new Promise(function(_0x170d27,_0xa483c4){return db[_0x7601('0x15')][_0x7601('0x1f')]({'raw':_0x497f5f['options']?_0x497f5f['options'][_0x7601('0x18')]===undefined?!![]:![]:!![],'where':_0x497f5f[_0x7601('0x17')]?_0x497f5f[_0x7601('0x17')][_0x7601('0x19')]||null:null,'attributes':_0x497f5f[_0x7601('0x17')]?_0x497f5f['options'][_0x7601('0x1a')]||null:null,'include':_0x497f5f[_0x7601('0x17')]?_0x497f5f['options'][_0x7601('0x1c')]?_[_0x7601('0x1d')](_0x497f5f[_0x7601('0x17')][_0x7601('0x1c')],function(_0x1f9d17){return{'model':db[_0x1f9d17['model']],'as':_0x1f9d17['as'],'attributes':_0x1f9d17[_0x7601('0x1a')],'include':_0x1f9d17[_0x7601('0x1c')]?_[_0x7601('0x1d')](_0x1f9d17[_0x7601('0x1c')],function(_0x570770){return{'model':db[_0x570770[_0x7601('0x1e')]],'as':_0x570770['as'],'attributes':_0x570770['attributes'],'include':_0x570770['include']?_[_0x7601('0x1d')](_0x570770[_0x7601('0x1c')],function(_0x46d013){return{'model':db[_0x46d013[_0x7601('0x1e')]],'as':_0x46d013['as'],'attributes':_0x46d013[_0x7601('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7601('0xa')](function(_0x259fd1){logger[_0x7601('0x12')](_0x7601('0x20'),_0x497f5f);logger[_0x7601('0xd')](_0x7601('0x20'),_0x497f5f,JSON[_0x7601('0xe')](_0x259fd1));_0x170d27(_0x259fd1);})[_0x7601('0x21')](function(_0x30c3cc){logger['error'](_0x7601('0x20'),_0x30c3cc[_0x7601('0x11')],_0x497f5f);_0xa483c4(_0x27f423[_0x7601('0xf')](0x1f4,_0x30c3cc[_0x7601('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 96c2cbf..0606d0a 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 _0xe22b=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','/:id/descriptions','create','put','update'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xe22b,0xfe));var _0xbe22=function(_0x170b30,_0x9d842e){_0x170b30=_0x170b30-0x0;var _0x10a1dd=_0xe22b[_0x170b30];return _0x10a1dd;};'use strict';var multer=require(_0xbe22('0x0'));var util=require(_0xbe22('0x1'));var path=require(_0xbe22('0x2'));var timeout=require(_0xbe22('0x3'));var express=require('express');var router=express[_0xbe22('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbe22('0x5'));var interaction=require(_0xbe22('0x6'));var config=require(_0xbe22('0x7'));var controller=require(_0xbe22('0x8'));router[_0xbe22('0x9')]('/',auth[_0xbe22('0xa')](),controller['index']);router[_0xbe22('0x9')](_0xbe22('0xb'),auth[_0xbe22('0xa')](),controller[_0xbe22('0xc')]);router[_0xbe22('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xbe22('0xd')]);router['get'](_0xbe22('0xe'),auth[_0xbe22('0xa')](),controller['getSubjects']);router['get'](_0xbe22('0xf'),auth[_0xbe22('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0xbe22('0xa')](),controller[_0xbe22('0x10')]);router[_0xbe22('0x11')]('/:id',auth[_0xbe22('0xa')](),controller[_0xbe22('0x12')]);router['delete'](_0xbe22('0xb'),auth[_0xbe22('0xa')](),controller[_0xbe22('0x13')]);module[_0xbe22('0x14')]=router; \ No newline at end of file +var _0xddfc=['isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2046dd,_0x40a9ab){var _0x2eb055=function(_0x1c65e8){while(--_0x1c65e8){_0x2046dd['push'](_0x2046dd['shift']());}};_0x2eb055(++_0x40a9ab);}(_0xddfc,0xf3));var _0xcddf=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xddfc[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xcddf('0x0'));var util=require(_0xcddf('0x1'));var path=require(_0xcddf('0x2'));var timeout=require(_0xcddf('0x3'));var express=require(_0xcddf('0x4'));var router=express[_0xcddf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcddf('0x6'));var interaction=require(_0xcddf('0x7'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xcddf('0x8')]('/',auth[_0xcddf('0x9')](),controller['index']);router[_0xcddf('0x8')](_0xcddf('0xa'),auth[_0xcddf('0x9')](),controller[_0xcddf('0xb')]);router[_0xcddf('0x8')](_0xcddf('0xc'),auth[_0xcddf('0x9')](),controller[_0xcddf('0xd')]);router['get'](_0xcddf('0xe'),auth[_0xcddf('0x9')](),controller['getSubjects']);router[_0xcddf('0x8')]('/:id/descriptions',auth[_0xcddf('0x9')](),controller[_0xcddf('0xf')]);router[_0xcddf('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcddf('0x11')](_0xcddf('0xa'),auth['isAuthenticated'](),controller[_0xcddf('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xcddf('0x13')]);module[_0xcddf('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 28d669a..c413488 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 _0x4b0b=['contact','sequelize','exports','STRING','ENUM','lead','contact_lead'];(function(_0x3d9c1b,_0x18c512){var _0x12b4e3=function(_0x3a87a3){while(--_0x3a87a3){_0x3d9c1b['push'](_0x3d9c1b['shift']());}};_0x12b4e3(++_0x18c512);}(_0x4b0b,0x94));var _0xb4b0=function(_0x194810,_0x1417f8){_0x194810=_0x194810-0x0;var _0x58324a=_0x4b0b[_0x194810];return _0x58324a;};'use strict';var Sequelize=require(_0xb4b0('0x0'));module[_0xb4b0('0x1')]={'name':{'type':Sequelize[_0xb4b0('0x2')]},'moduleCreate':{'type':Sequelize[_0xb4b0('0x3')](_0xb4b0('0x4'),'contact','nothing'),'defaultValue':_0xb4b0('0x4')},'moduleSearch':{'type':Sequelize[_0xb4b0('0x3')](_0xb4b0('0x5'),_0xb4b0('0x6'),_0xb4b0('0x4')),'defaultValue':_0xb4b0('0x5')},'description':{'type':Sequelize[_0xb4b0('0x2')]}}; \ No newline at end of file +var _0x6700=['nothing','lead','contact_lead','sequelize','exports','STRING','ENUM','contact'];(function(_0x4d0fb8,_0x129740){var _0x475a89=function(_0x145b76){while(--_0x145b76){_0x4d0fb8['push'](_0x4d0fb8['shift']());}};_0x475a89(++_0x129740);}(_0x6700,0xb3));var _0x0670=function(_0x5d3a11,_0x4ac110){_0x5d3a11=_0x5d3a11-0x0;var _0x5110b8=_0x6700[_0x5d3a11];return _0x5110b8;};'use strict';var Sequelize=require(_0x0670('0x0'));module[_0x0670('0x1')]={'name':{'type':Sequelize[_0x0670('0x2')]},'moduleCreate':{'type':Sequelize[_0x0670('0x3')]('lead',_0x0670('0x4'),_0x0670('0x5')),'defaultValue':_0x0670('0x6')},'moduleSearch':{'type':Sequelize[_0x0670('0x3')](_0x0670('0x7'),_0x0670('0x4'),'lead'),'defaultValue':_0x0670('0x7')},'description':{'type':Sequelize[_0x0670('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index f8702d8..0a3d694 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 _0x0041=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','find','findOne','getFields','getSubjects','ZohoField','getDescriptions','nolimit','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','ZohoConfiguration','fieldName','type','key'];(function(_0x47a12a,_0x70f591){var _0x30cd40=function(_0x46b68f){while(--_0x46b68f){_0x47a12a['push'](_0x47a12a['shift']());}};_0x30cd40(++_0x70f591);}(_0x0041,0x16e));var _0x1004=function(_0x239460,_0x316686){_0x239460=_0x239460-0x0;var _0x4ca7e5=_0x0041[_0x239460];return _0x4ca7e5;};'use strict';var emlformat=require(_0x1004('0x0'));var rimraf=require(_0x1004('0x1'));var zipdir=require(_0x1004('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1004('0x3'));var moment=require('moment');var BPromise=require(_0x1004('0x4'));var Mustache=require(_0x1004('0x5'));var util=require(_0x1004('0x6'));var path=require(_0x1004('0x7'));var sox=require(_0x1004('0x8'));var csv=require('to-csv');var ejs=require(_0x1004('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1004('0xa'));var crypto=require(_0x1004('0xb'));var jsforce=require(_0x1004('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1004('0xd'));var querystring=require(_0x1004('0xe'));var Papa=require('papaparse');var Redis=require(_0x1004('0xf'));var authService=require(_0x1004('0x10'));var qs=require(_0x1004('0x11'));var as=require(_0x1004('0x12'));var hardwareService=require(_0x1004('0x13'));var logger=require(_0x1004('0x14'))(_0x1004('0x15'));var utils=require(_0x1004('0x16'));var config=require(_0x1004('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1004('0x18'))['db'];function respondWithStatusCode(_0x58bbb1,_0x54846d){_0x54846d=_0x54846d||0xcc;return function(_0xdf6643){if(_0xdf6643){return _0x58bbb1['sendStatus'](_0x54846d);}return _0x58bbb1[_0x1004('0x19')](_0x54846d)[_0x1004('0x1a')]();};}function respondWithResult(_0x23ae06,_0x237881){_0x237881=_0x237881||0xc8;return function(_0x2d9aee){if(_0x2d9aee){return _0x23ae06[_0x1004('0x19')](_0x237881)[_0x1004('0x1b')](_0x2d9aee);}};}function respondWithFilteredResult(_0x4d3e83,_0x24778a){return function(_0x1960ae){if(_0x1960ae){var _0x26b4c7=typeof _0x24778a[_0x1004('0x1c')]===_0x1004('0x1d')&&typeof _0x24778a[_0x1004('0x1e')]==='undefined';var _0x1f07c5=_0x1960ae[_0x1004('0x1f')];var _0x25ac1b=_0x26b4c7?0x0:_0x24778a[_0x1004('0x1c')];var _0x5c16d1=_0x26b4c7?_0x1960ae[_0x1004('0x1f')]:_0x24778a[_0x1004('0x1c')]+_0x24778a[_0x1004('0x1e')];var _0x6786e3;if(_0x5c16d1>=_0x1f07c5){_0x5c16d1=_0x1f07c5;_0x6786e3=0xc8;}else{_0x6786e3=0xce;}_0x4d3e83['status'](_0x6786e3);return _0x4d3e83[_0x1004('0x20')](_0x1004('0x21'),_0x25ac1b+'-'+_0x5c16d1+'/'+_0x1f07c5)[_0x1004('0x1b')](_0x1960ae);}return null;};}function patchUpdates(_0x27b5b0){return function(_0x325209){try{jsonpatch[_0x1004('0x22')](_0x325209,_0x27b5b0,!![]);}catch(_0x3b4ee5){return BPromise[_0x1004('0x23')](_0x3b4ee5);}return _0x325209[_0x1004('0x24')]();};}function saveUpdates(_0x39ad89,_0x325ce8){return function(_0x38c633){if(_0x38c633){return _0x38c633[_0x1004('0x25')](_0x39ad89)['then'](function(_0x151559){return _0x151559;});}return null;};}function removeEntity(_0x47c8b7,_0x1f0701){return function(_0x14b33c){if(_0x14b33c){return _0x14b33c['destroy']()[_0x1004('0x26')](function(){_0x47c8b7[_0x1004('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x506460,_0x5c075b){return function(_0x55f3e8){if(!_0x55f3e8){_0x506460[_0x1004('0x27')](0x194);}return _0x55f3e8;};}function handleError(_0x4b525a,_0x540238){_0x540238=_0x540238||0x1f4;return function(_0x204db8){logger[_0x1004('0x28')](_0x204db8[_0x1004('0x29')]);if(_0x204db8[_0x1004('0x2a')]){delete _0x204db8[_0x1004('0x2a')];}_0x4b525a['status'](_0x540238)['send'](_0x204db8);};}exports[_0x1004('0x2b')]=function(_0x44708c,_0x1a71d2){var _0x59664d={},_0x3635cd={},_0x39d992={'count':0x0,'rows':[]};var _0x3548f4=_[_0x1004('0x2c')](db[_0x1004('0x2d')]['rawAttributes'],function(_0x28ed14){return{'name':_0x28ed14[_0x1004('0x2e')],'type':_0x28ed14[_0x1004('0x2f')][_0x1004('0x30')]};});_0x3635cd[_0x1004('0x31')]=_[_0x1004('0x2c')](_0x3548f4,_0x1004('0x2a'));_0x3635cd[_0x1004('0x32')]=_[_0x1004('0x33')](_0x44708c[_0x1004('0x32')]);_0x3635cd[_0x1004('0x34')]=_['intersection'](_0x3635cd[_0x1004('0x31')],_0x3635cd[_0x1004('0x32')]);_0x59664d[_0x1004('0x35')]=_[_0x1004('0x36')](_0x3635cd[_0x1004('0x31')],qs[_0x1004('0x37')](_0x44708c['query'][_0x1004('0x37')]));_0x59664d[_0x1004('0x35')]=_0x59664d[_0x1004('0x35')][_0x1004('0x38')]?_0x59664d[_0x1004('0x35')]:_0x3635cd[_0x1004('0x31')];if(!_0x44708c['query'][_0x1004('0x39')]('nolimit')){_0x59664d[_0x1004('0x1e')]=qs[_0x1004('0x1e')](_0x44708c[_0x1004('0x32')][_0x1004('0x1e')]);_0x59664d[_0x1004('0x1c')]=qs[_0x1004('0x1c')](_0x44708c['query']['offset']);}_0x59664d[_0x1004('0x3a')]=qs[_0x1004('0x3b')](_0x44708c[_0x1004('0x32')][_0x1004('0x3b')]);_0x59664d['where']=qs[_0x1004('0x34')](_[_0x1004('0x3c')](_0x44708c['query'],_0x3635cd['filters']),_0x3548f4);if(_0x44708c[_0x1004('0x32')][_0x1004('0x3d')]){_0x59664d[_0x1004('0x3e')]=_[_0x1004('0x3f')](_0x59664d[_0x1004('0x3e')],{'$or':_[_0x1004('0x2c')](_0x3548f4,function(_0x3a2d68){if(_0x3a2d68[_0x1004('0x2f')]!==_0x1004('0x40')){var _0x1c2d3e={};_0x1c2d3e[_0x3a2d68['name']]={'$like':'%'+_0x44708c[_0x1004('0x32')][_0x1004('0x3d')]+'%'};return _0x1c2d3e;}})});}_0x59664d=_[_0x1004('0x3f')]({},_0x59664d,_0x44708c[_0x1004('0x41')]);var _0x546380={'where':_0x59664d[_0x1004('0x3e')]};return db[_0x1004('0x2d')][_0x1004('0x1f')](_0x546380)[_0x1004('0x26')](function(_0x126c8d){_0x39d992[_0x1004('0x1f')]=_0x126c8d;if(_0x44708c[_0x1004('0x32')][_0x1004('0x42')]){_0x59664d[_0x1004('0x43')]=[{'all':!![]}];}return db[_0x1004('0x2d')][_0x1004('0x44')](_0x59664d);})[_0x1004('0x26')](function(_0x5a5044){_0x39d992[_0x1004('0x45')]=_0x5a5044;return _0x39d992;})[_0x1004('0x26')](respondWithFilteredResult(_0x1a71d2,_0x59664d))['catch'](handleError(_0x1a71d2,null));};exports[_0x1004('0x46')]=function(_0x50950f,_0x323061){var _0x369bfe={'raw':![],'where':{'id':_0x50950f[_0x1004('0x47')]['id']}},_0x520bc2={};_0x520bc2[_0x1004('0x31')]=_['keys'](db[_0x1004('0x2d')][_0x1004('0x48')]);_0x520bc2[_0x1004('0x32')]=_[_0x1004('0x33')](_0x50950f[_0x1004('0x32')]);_0x520bc2[_0x1004('0x34')]=_[_0x1004('0x36')](_0x520bc2[_0x1004('0x31')],_0x520bc2[_0x1004('0x32')]);_0x369bfe[_0x1004('0x35')]=_[_0x1004('0x36')](_0x520bc2['model'],qs[_0x1004('0x37')](_0x50950f[_0x1004('0x32')]['fields']));_0x369bfe[_0x1004('0x35')]=_0x369bfe[_0x1004('0x35')][_0x1004('0x38')]?_0x369bfe[_0x1004('0x35')]:_0x520bc2[_0x1004('0x31')];if(_0x50950f[_0x1004('0x32')][_0x1004('0x42')]){_0x369bfe[_0x1004('0x43')]=[{'all':!![]}];}_0x369bfe=_[_0x1004('0x3f')]({},_0x369bfe,_0x50950f[_0x1004('0x41')]);return db[_0x1004('0x2d')]['find'](_0x369bfe)['then'](handleEntityNotFound(_0x323061,null))[_0x1004('0x26')](respondWithResult(_0x323061,null))[_0x1004('0x49')](handleError(_0x323061,null));};exports[_0x1004('0x4a')]=function(_0x405bc3,_0x1cdbaa){return db[_0x1004('0x2d')]['create'](_0x405bc3[_0x1004('0x4b')],{})[_0x1004('0x26')](respondWithResult(_0x1cdbaa,0xc9))[_0x1004('0x49')](handleError(_0x1cdbaa,null));};exports['update']=function(_0x2d8ea7,_0x53d666){if(_0x2d8ea7[_0x1004('0x4b')]['id']){delete _0x2d8ea7['body']['id'];}return db[_0x1004('0x2d')]['find']({'where':{'id':_0x2d8ea7[_0x1004('0x47')]['id']}})[_0x1004('0x26')](handleEntityNotFound(_0x53d666,null))[_0x1004('0x26')](saveUpdates(_0x2d8ea7[_0x1004('0x4b')],null))[_0x1004('0x26')](respondWithResult(_0x53d666,null))[_0x1004('0x49')](handleError(_0x53d666,null));};exports['destroy']=function(_0x16245c,_0x277327){return db[_0x1004('0x2d')][_0x1004('0x4c')]({'where':{'id':_0x16245c[_0x1004('0x47')]['id']}})['then'](handleEntityNotFound(_0x277327,null))[_0x1004('0x26')](removeEntity(_0x277327,null))[_0x1004('0x49')](handleError(_0x277327,null));};exports['getFields']=function(_0x3786df,_0x1d70d7,_0x49bb2d){var _0x138b15={};var _0x4e86a4={};var _0x484922;var _0x41dc6b;return db['ZohoConfiguration'][_0x1004('0x4d')]({'where':{'id':_0x3786df[_0x1004('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d70d7,null))[_0x1004('0x26')](function(_0x5d6bb1){if(_0x5d6bb1){_0x484922=_0x5d6bb1;_0x4e86a4['model']=_['keys'](db['ZohoField'][_0x1004('0x48')]);_0x4e86a4['query']=_[_0x1004('0x33')](_0x3786df[_0x1004('0x32')]);_0x4e86a4[_0x1004('0x34')]=_[_0x1004('0x36')](_0x4e86a4[_0x1004('0x31')],_0x4e86a4[_0x1004('0x32')]);_0x138b15[_0x1004('0x35')]=_['intersection'](_0x4e86a4['model'],qs[_0x1004('0x37')](_0x3786df[_0x1004('0x32')]['fields']));_0x138b15[_0x1004('0x35')]=_0x138b15[_0x1004('0x35')]['length']?_0x138b15[_0x1004('0x35')]:_0x4e86a4[_0x1004('0x31')];_0x138b15[_0x1004('0x3a')]=qs[_0x1004('0x3b')](_0x3786df['query'][_0x1004('0x3b')]);_0x138b15[_0x1004('0x3e')]=qs[_0x1004('0x34')](_[_0x1004('0x3c')](_0x3786df[_0x1004('0x32')],_0x4e86a4[_0x1004('0x34')]));if(_0x3786df['query'][_0x1004('0x3d')]){_0x138b15['where']=_['merge'](_0x138b15[_0x1004('0x3e')],{'$or':_[_0x1004('0x2c')](_0x138b15[_0x1004('0x35')],function(_0x219c8a){var _0x1a3580={};_0x1a3580[_0x219c8a]={'$like':'%'+_0x3786df['query']['filter']+'%'};return _0x1a3580;})});}_0x138b15=_['merge']({},_0x138b15,_0x3786df[_0x1004('0x41')]);return _0x484922[_0x1004('0x4e')](_0x138b15);}})[_0x1004('0x26')](function(_0xd25eaf){if(_0xd25eaf){_0x41dc6b=_0xd25eaf[_0x1004('0x38')];if(!_0x3786df[_0x1004('0x32')][_0x1004('0x39')]('nolimit')){_0x138b15[_0x1004('0x1e')]=qs[_0x1004('0x1e')](_0x3786df['query'][_0x1004('0x1e')]);_0x138b15[_0x1004('0x1c')]=qs['offset'](_0x3786df['query'][_0x1004('0x1c')]);}return _0x484922[_0x1004('0x4e')](_0x138b15);}})[_0x1004('0x26')](function(_0x513a48){if(_0x513a48){return _0x513a48?{'count':_0x41dc6b,'rows':_0x513a48}:null;}})['then'](respondWithResult(_0x1d70d7,null))[_0x1004('0x49')](handleError(_0x1d70d7,null));};exports[_0x1004('0x4f')]=function(_0x12ee36,_0x52e814,_0x3cb88c){var _0xf5b427={};var _0x1b5b37={};var _0x503b76;var _0x48dc02;return db[_0x1004('0x2d')][_0x1004('0x4d')]({'where':{'id':_0x12ee36['params']['id']}})[_0x1004('0x26')](handleEntityNotFound(_0x52e814,null))[_0x1004('0x26')](function(_0x143a4f){if(_0x143a4f){_0x503b76=_0x143a4f;_0x1b5b37['model']=_['keys'](db[_0x1004('0x50')]['rawAttributes']);_0x1b5b37[_0x1004('0x32')]=_[_0x1004('0x33')](_0x12ee36[_0x1004('0x32')]);_0x1b5b37['filters']=_[_0x1004('0x36')](_0x1b5b37[_0x1004('0x31')],_0x1b5b37['query']);_0xf5b427['attributes']=_[_0x1004('0x36')](_0x1b5b37['model'],qs[_0x1004('0x37')](_0x12ee36['query']['fields']));_0xf5b427[_0x1004('0x35')]=_0xf5b427[_0x1004('0x35')][_0x1004('0x38')]?_0xf5b427[_0x1004('0x35')]:_0x1b5b37[_0x1004('0x31')];_0xf5b427[_0x1004('0x3a')]=qs['sort'](_0x12ee36[_0x1004('0x32')][_0x1004('0x3b')]);_0xf5b427[_0x1004('0x3e')]=qs['filters'](_[_0x1004('0x3c')](_0x12ee36[_0x1004('0x32')],_0x1b5b37[_0x1004('0x34')]));if(_0x12ee36[_0x1004('0x32')][_0x1004('0x3d')]){_0xf5b427[_0x1004('0x3e')]=_['merge'](_0xf5b427[_0x1004('0x3e')],{'$or':_[_0x1004('0x2c')](_0xf5b427['attributes'],function(_0xc80aa3){var _0x4c7267={};_0x4c7267[_0xc80aa3]={'$like':'%'+_0x12ee36[_0x1004('0x32')][_0x1004('0x3d')]+'%'};return _0x4c7267;})});}_0xf5b427=_[_0x1004('0x3f')]({},_0xf5b427,_0x12ee36[_0x1004('0x41')]);return _0x503b76['getSubjects'](_0xf5b427);}})[_0x1004('0x26')](function(_0x5ab736){if(_0x5ab736){_0x48dc02=_0x5ab736['length'];if(!_0x12ee36[_0x1004('0x32')]['hasOwnProperty']('nolimit')){_0xf5b427['limit']=qs['limit'](_0x12ee36[_0x1004('0x32')][_0x1004('0x1e')]);_0xf5b427[_0x1004('0x1c')]=qs[_0x1004('0x1c')](_0x12ee36[_0x1004('0x32')][_0x1004('0x1c')]);}return _0x503b76[_0x1004('0x4f')](_0xf5b427);}})[_0x1004('0x26')](function(_0x52430a){if(_0x52430a){return _0x52430a?{'count':_0x48dc02,'rows':_0x52430a}:null;}})[_0x1004('0x26')](respondWithResult(_0x52e814,null))['catch'](handleError(_0x52e814,null));};exports[_0x1004('0x51')]=function(_0x850f0d,_0x1570f5,_0x319d45){var _0x431009={};var _0x52418d={};var _0x3a96c7;var _0xa2d3c5;return db[_0x1004('0x2d')][_0x1004('0x4d')]({'where':{'id':_0x850f0d['params']['id']}})[_0x1004('0x26')](handleEntityNotFound(_0x1570f5,null))['then'](function(_0xb37232){if(_0xb37232){_0x3a96c7=_0xb37232;_0x52418d[_0x1004('0x31')]=_[_0x1004('0x33')](db['ZohoField'][_0x1004('0x48')]);_0x52418d[_0x1004('0x32')]=_['keys'](_0x850f0d[_0x1004('0x32')]);_0x52418d[_0x1004('0x34')]=_[_0x1004('0x36')](_0x52418d[_0x1004('0x31')],_0x52418d[_0x1004('0x32')]);_0x431009['attributes']=_[_0x1004('0x36')](_0x52418d[_0x1004('0x31')],qs[_0x1004('0x37')](_0x850f0d[_0x1004('0x32')][_0x1004('0x37')]));_0x431009[_0x1004('0x35')]=_0x431009[_0x1004('0x35')][_0x1004('0x38')]?_0x431009[_0x1004('0x35')]:_0x52418d[_0x1004('0x31')];_0x431009[_0x1004('0x3a')]=qs[_0x1004('0x3b')](_0x850f0d['query'][_0x1004('0x3b')]);_0x431009[_0x1004('0x3e')]=qs[_0x1004('0x34')](_[_0x1004('0x3c')](_0x850f0d['query'],_0x52418d[_0x1004('0x34')]));if(_0x850f0d['query'][_0x1004('0x3d')]){_0x431009['where']=_[_0x1004('0x3f')](_0x431009[_0x1004('0x3e')],{'$or':_['map'](_0x431009[_0x1004('0x35')],function(_0x4f823f){var _0x65c96a={};_0x65c96a[_0x4f823f]={'$like':'%'+_0x850f0d[_0x1004('0x32')]['filter']+'%'};return _0x65c96a;})});}_0x431009=_[_0x1004('0x3f')]({},_0x431009,_0x850f0d[_0x1004('0x41')]);return _0x3a96c7['getDescriptions'](_0x431009);}})[_0x1004('0x26')](function(_0x15ba20){if(_0x15ba20){_0xa2d3c5=_0x15ba20[_0x1004('0x38')];if(!_0x850f0d[_0x1004('0x32')][_0x1004('0x39')](_0x1004('0x52'))){_0x431009['limit']=qs['limit'](_0x850f0d[_0x1004('0x32')][_0x1004('0x1e')]);_0x431009[_0x1004('0x1c')]=qs[_0x1004('0x1c')](_0x850f0d[_0x1004('0x32')][_0x1004('0x1c')]);}return _0x3a96c7['getDescriptions'](_0x431009);}})[_0x1004('0x26')](function(_0x3ed1ff){if(_0x3ed1ff){return _0x3ed1ff?{'count':_0xa2d3c5,'rows':_0x3ed1ff}:null;}})['then'](respondWithResult(_0x1570f5,null))[_0x1004('0x49')](handleError(_0x1570f5,null));}; \ No newline at end of file +var _0xd2bc=['reject','save','update','then','destroy','sendStatus','error','stack','name','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','getFields','findOne','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','status','end','json','undefined','limit','offset','count','set','Content-Range','apply'];(function(_0x12df52,_0x4dddf5){var _0x228658=function(_0x518081){while(--_0x518081){_0x12df52['push'](_0x12df52['shift']());}};_0x228658(++_0x4dddf5);}(_0xd2bc,0x169));var _0xcd2b=function(_0x1c8307,_0x436ce5){_0x1c8307=_0x1c8307-0x0;var _0x5d4e8e=_0xd2bc[_0x1c8307];return _0x5d4e8e;};'use strict';var emlformat=require(_0xcd2b('0x0'));var rimraf=require(_0xcd2b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd2b('0x2'));var rp=require(_0xcd2b('0x3'));var moment=require(_0xcd2b('0x4'));var BPromise=require(_0xcd2b('0x5'));var Mustache=require(_0xcd2b('0x6'));var util=require(_0xcd2b('0x7'));var path=require(_0xcd2b('0x8'));var sox=require(_0xcd2b('0x9'));var csv=require(_0xcd2b('0xa'));var ejs=require(_0xcd2b('0xb'));var fs=require('fs');var fs_extra=require(_0xcd2b('0xc'));var _=require(_0xcd2b('0xd'));var squel=require(_0xcd2b('0xe'));var crypto=require(_0xcd2b('0xf'));var jsforce=require(_0xcd2b('0x10'));var deskjs=require(_0xcd2b('0x11'));var toCsv=require(_0xcd2b('0xa'));var querystring=require('querystring');var Papa=require(_0xcd2b('0x12'));var Redis=require(_0xcd2b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xcd2b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd2b('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xcd2b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcd2b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50ad98,_0x553ae1){_0x553ae1=_0x553ae1||0xcc;return function(_0x258127){if(_0x258127){return _0x50ad98['sendStatus'](_0x553ae1);}return _0x50ad98[_0xcd2b('0x18')](_0x553ae1)[_0xcd2b('0x19')]();};}function respondWithResult(_0x49edd1,_0x12c9df){_0x12c9df=_0x12c9df||0xc8;return function(_0x20affc){if(_0x20affc){return _0x49edd1[_0xcd2b('0x18')](_0x12c9df)[_0xcd2b('0x1a')](_0x20affc);}};}function respondWithFilteredResult(_0x2f45fd,_0x1627d8){return function(_0xa349af){if(_0xa349af){var _0x4bf5e6=typeof _0x1627d8['offset']===_0xcd2b('0x1b')&&typeof _0x1627d8[_0xcd2b('0x1c')]==='undefined';var _0x589022=_0xa349af['count'];var _0x48eb7e=_0x4bf5e6?0x0:_0x1627d8[_0xcd2b('0x1d')];var _0x552970=_0x4bf5e6?_0xa349af[_0xcd2b('0x1e')]:_0x1627d8[_0xcd2b('0x1d')]+_0x1627d8[_0xcd2b('0x1c')];var _0x23bd68;if(_0x552970>=_0x589022){_0x552970=_0x589022;_0x23bd68=0xc8;}else{_0x23bd68=0xce;}_0x2f45fd[_0xcd2b('0x18')](_0x23bd68);return _0x2f45fd[_0xcd2b('0x1f')](_0xcd2b('0x20'),_0x48eb7e+'-'+_0x552970+'/'+_0x589022)[_0xcd2b('0x1a')](_0xa349af);}return null;};}function patchUpdates(_0x4fe40d){return function(_0x3228c9){try{jsonpatch[_0xcd2b('0x21')](_0x3228c9,_0x4fe40d,!![]);}catch(_0x4be306){return BPromise[_0xcd2b('0x22')](_0x4be306);}return _0x3228c9[_0xcd2b('0x23')]();};}function saveUpdates(_0x170e64,_0x38eb32){return function(_0x4d0f73){if(_0x4d0f73){return _0x4d0f73[_0xcd2b('0x24')](_0x170e64)[_0xcd2b('0x25')](function(_0x246de1){return _0x246de1;});}return null;};}function removeEntity(_0x48aeee,_0x1e4768){return function(_0x277f2a){if(_0x277f2a){return _0x277f2a[_0xcd2b('0x26')]()['then'](function(){_0x48aeee['status'](0xcc)[_0xcd2b('0x19')]();});}};}function handleEntityNotFound(_0x95dbc5,_0x41e696){return function(_0x2fe690){if(!_0x2fe690){_0x95dbc5[_0xcd2b('0x27')](0x194);}return _0x2fe690;};}function handleError(_0x30b0fc,_0x4a1ec7){_0x4a1ec7=_0x4a1ec7||0x1f4;return function(_0x486877){logger[_0xcd2b('0x28')](_0x486877[_0xcd2b('0x29')]);if(_0x486877[_0xcd2b('0x2a')]){delete _0x486877[_0xcd2b('0x2a')];}_0x30b0fc[_0xcd2b('0x18')](_0x4a1ec7)['send'](_0x486877);};}exports['index']=function(_0x5682ed,_0x544787){var _0x581fab={},_0x33ed24={},_0x256184={'count':0x0,'rows':[]};var _0x56cfa9=_[_0xcd2b('0x2b')](db[_0xcd2b('0x2c')][_0xcd2b('0x2d')],function(_0x14b3da){return{'name':_0x14b3da[_0xcd2b('0x2e')],'type':_0x14b3da[_0xcd2b('0x2f')]['key']};});_0x33ed24[_0xcd2b('0x30')]=_[_0xcd2b('0x2b')](_0x56cfa9,'name');_0x33ed24[_0xcd2b('0x31')]=_[_0xcd2b('0x32')](_0x5682ed[_0xcd2b('0x31')]);_0x33ed24[_0xcd2b('0x33')]=_['intersection'](_0x33ed24['model'],_0x33ed24[_0xcd2b('0x31')]);_0x581fab[_0xcd2b('0x34')]=_[_0xcd2b('0x35')](_0x33ed24[_0xcd2b('0x30')],qs[_0xcd2b('0x36')](_0x5682ed[_0xcd2b('0x31')][_0xcd2b('0x36')]));_0x581fab[_0xcd2b('0x34')]=_0x581fab[_0xcd2b('0x34')][_0xcd2b('0x37')]?_0x581fab['attributes']:_0x33ed24[_0xcd2b('0x30')];if(!_0x5682ed[_0xcd2b('0x31')][_0xcd2b('0x38')](_0xcd2b('0x39'))){_0x581fab[_0xcd2b('0x1c')]=qs['limit'](_0x5682ed['query'][_0xcd2b('0x1c')]);_0x581fab[_0xcd2b('0x1d')]=qs[_0xcd2b('0x1d')](_0x5682ed[_0xcd2b('0x31')][_0xcd2b('0x1d')]);}_0x581fab[_0xcd2b('0x3a')]=qs[_0xcd2b('0x3b')](_0x5682ed[_0xcd2b('0x31')][_0xcd2b('0x3b')]);_0x581fab[_0xcd2b('0x3c')]=qs[_0xcd2b('0x33')](_[_0xcd2b('0x3d')](_0x5682ed[_0xcd2b('0x31')],_0x33ed24[_0xcd2b('0x33')]),_0x56cfa9);if(_0x5682ed[_0xcd2b('0x31')][_0xcd2b('0x3e')]){_0x581fab[_0xcd2b('0x3c')]=_[_0xcd2b('0x3f')](_0x581fab[_0xcd2b('0x3c')],{'$or':_[_0xcd2b('0x2b')](_0x56cfa9,function(_0x309bf0){if(_0x309bf0[_0xcd2b('0x2f')]!==_0xcd2b('0x40')){var _0x29bdec={};_0x29bdec[_0x309bf0['name']]={'$like':'%'+_0x5682ed[_0xcd2b('0x31')][_0xcd2b('0x3e')]+'%'};return _0x29bdec;}})});}_0x581fab=_[_0xcd2b('0x3f')]({},_0x581fab,_0x5682ed[_0xcd2b('0x41')]);var _0x503107={'where':_0x581fab[_0xcd2b('0x3c')]};return db[_0xcd2b('0x2c')][_0xcd2b('0x1e')](_0x503107)['then'](function(_0xd7df43){_0x256184[_0xcd2b('0x1e')]=_0xd7df43;if(_0x5682ed[_0xcd2b('0x31')][_0xcd2b('0x42')]){_0x581fab[_0xcd2b('0x43')]=[{'all':!![]}];}return db[_0xcd2b('0x2c')][_0xcd2b('0x44')](_0x581fab);})[_0xcd2b('0x25')](function(_0x1bc3c3){_0x256184['rows']=_0x1bc3c3;return _0x256184;})['then'](respondWithFilteredResult(_0x544787,_0x581fab))['catch'](handleError(_0x544787,null));};exports[_0xcd2b('0x45')]=function(_0x59ae6d,_0x3e5323){var _0x247e52={'raw':![],'where':{'id':_0x59ae6d[_0xcd2b('0x46')]['id']}},_0x54b6fb={};_0x54b6fb['model']=_[_0xcd2b('0x32')](db[_0xcd2b('0x2c')][_0xcd2b('0x2d')]);_0x54b6fb[_0xcd2b('0x31')]=_[_0xcd2b('0x32')](_0x59ae6d[_0xcd2b('0x31')]);_0x54b6fb[_0xcd2b('0x33')]=_[_0xcd2b('0x35')](_0x54b6fb[_0xcd2b('0x30')],_0x54b6fb[_0xcd2b('0x31')]);_0x247e52[_0xcd2b('0x34')]=_[_0xcd2b('0x35')](_0x54b6fb[_0xcd2b('0x30')],qs[_0xcd2b('0x36')](_0x59ae6d['query'][_0xcd2b('0x36')]));_0x247e52['attributes']=_0x247e52[_0xcd2b('0x34')][_0xcd2b('0x37')]?_0x247e52[_0xcd2b('0x34')]:_0x54b6fb['model'];if(_0x59ae6d[_0xcd2b('0x31')][_0xcd2b('0x42')]){_0x247e52['include']=[{'all':!![]}];}_0x247e52=_[_0xcd2b('0x3f')]({},_0x247e52,_0x59ae6d['options']);return db[_0xcd2b('0x2c')][_0xcd2b('0x47')](_0x247e52)[_0xcd2b('0x25')](handleEntityNotFound(_0x3e5323,null))[_0xcd2b('0x25')](respondWithResult(_0x3e5323,null))[_0xcd2b('0x48')](handleError(_0x3e5323,null));};exports['create']=function(_0x51b1b3,_0x404586){return db[_0xcd2b('0x2c')]['create'](_0x51b1b3[_0xcd2b('0x49')],{})[_0xcd2b('0x25')](respondWithResult(_0x404586,0xc9))['catch'](handleError(_0x404586,null));};exports[_0xcd2b('0x24')]=function(_0xbd3436,_0x45ffff){if(_0xbd3436[_0xcd2b('0x49')]['id']){delete _0xbd3436[_0xcd2b('0x49')]['id'];}return db[_0xcd2b('0x2c')][_0xcd2b('0x47')]({'where':{'id':_0xbd3436[_0xcd2b('0x46')]['id']}})['then'](handleEntityNotFound(_0x45ffff,null))[_0xcd2b('0x25')](saveUpdates(_0xbd3436[_0xcd2b('0x49')],null))[_0xcd2b('0x25')](respondWithResult(_0x45ffff,null))[_0xcd2b('0x48')](handleError(_0x45ffff,null));};exports['destroy']=function(_0xe2fb41,_0x3bcbe6){return db[_0xcd2b('0x2c')][_0xcd2b('0x47')]({'where':{'id':_0xe2fb41[_0xcd2b('0x46')]['id']}})['then'](handleEntityNotFound(_0x3bcbe6,null))[_0xcd2b('0x25')](removeEntity(_0x3bcbe6,null))['catch'](handleError(_0x3bcbe6,null));};exports[_0xcd2b('0x4a')]=function(_0x458288,_0x226c08,_0x10e154){var _0x3a0b7a={};var _0x11c3ac={};var _0x27c8e7;var _0x548213;return db[_0xcd2b('0x2c')][_0xcd2b('0x4b')]({'where':{'id':_0x458288[_0xcd2b('0x46')]['id']}})[_0xcd2b('0x25')](handleEntityNotFound(_0x226c08,null))[_0xcd2b('0x25')](function(_0x22455d){if(_0x22455d){_0x27c8e7=_0x22455d;_0x11c3ac[_0xcd2b('0x30')]=_[_0xcd2b('0x32')](db['ZohoField'][_0xcd2b('0x2d')]);_0x11c3ac[_0xcd2b('0x31')]=_['keys'](_0x458288[_0xcd2b('0x31')]);_0x11c3ac[_0xcd2b('0x33')]=_['intersection'](_0x11c3ac['model'],_0x11c3ac[_0xcd2b('0x31')]);_0x3a0b7a[_0xcd2b('0x34')]=_['intersection'](_0x11c3ac['model'],qs['fields'](_0x458288[_0xcd2b('0x31')][_0xcd2b('0x36')]));_0x3a0b7a[_0xcd2b('0x34')]=_0x3a0b7a[_0xcd2b('0x34')]['length']?_0x3a0b7a['attributes']:_0x11c3ac[_0xcd2b('0x30')];_0x3a0b7a['order']=qs['sort'](_0x458288[_0xcd2b('0x31')][_0xcd2b('0x3b')]);_0x3a0b7a[_0xcd2b('0x3c')]=qs[_0xcd2b('0x33')](_['pick'](_0x458288[_0xcd2b('0x31')],_0x11c3ac['filters']));if(_0x458288[_0xcd2b('0x31')][_0xcd2b('0x3e')]){_0x3a0b7a[_0xcd2b('0x3c')]=_[_0xcd2b('0x3f')](_0x3a0b7a[_0xcd2b('0x3c')],{'$or':_[_0xcd2b('0x2b')](_0x3a0b7a['attributes'],function(_0x32c589){var _0xb2d779={};_0xb2d779[_0x32c589]={'$like':'%'+_0x458288[_0xcd2b('0x31')]['filter']+'%'};return _0xb2d779;})});}_0x3a0b7a=_[_0xcd2b('0x3f')]({},_0x3a0b7a,_0x458288[_0xcd2b('0x41')]);return _0x27c8e7['getFields'](_0x3a0b7a);}})[_0xcd2b('0x25')](function(_0x2cb27f){if(_0x2cb27f){_0x548213=_0x2cb27f[_0xcd2b('0x37')];if(!_0x458288[_0xcd2b('0x31')]['hasOwnProperty'](_0xcd2b('0x39'))){_0x3a0b7a[_0xcd2b('0x1c')]=qs[_0xcd2b('0x1c')](_0x458288[_0xcd2b('0x31')][_0xcd2b('0x1c')]);_0x3a0b7a[_0xcd2b('0x1d')]=qs[_0xcd2b('0x1d')](_0x458288[_0xcd2b('0x31')][_0xcd2b('0x1d')]);}return _0x27c8e7[_0xcd2b('0x4a')](_0x3a0b7a);}})[_0xcd2b('0x25')](function(_0x481273){if(_0x481273){return _0x481273?{'count':_0x548213,'rows':_0x481273}:null;}})[_0xcd2b('0x25')](respondWithResult(_0x226c08,null))[_0xcd2b('0x48')](handleError(_0x226c08,null));};exports[_0xcd2b('0x4c')]=function(_0x149bff,_0x473bc9,_0x23b696){var _0xe16672={};var _0x4b3f83={};var _0x5c31b1;var _0x412cd4;return db['ZohoConfiguration'][_0xcd2b('0x4b')]({'where':{'id':_0x149bff[_0xcd2b('0x46')]['id']}})[_0xcd2b('0x25')](handleEntityNotFound(_0x473bc9,null))['then'](function(_0x59d794){if(_0x59d794){_0x5c31b1=_0x59d794;_0x4b3f83[_0xcd2b('0x30')]=_[_0xcd2b('0x32')](db[_0xcd2b('0x4d')]['rawAttributes']);_0x4b3f83[_0xcd2b('0x31')]=_[_0xcd2b('0x32')](_0x149bff['query']);_0x4b3f83['filters']=_[_0xcd2b('0x35')](_0x4b3f83[_0xcd2b('0x30')],_0x4b3f83[_0xcd2b('0x31')]);_0xe16672[_0xcd2b('0x34')]=_[_0xcd2b('0x35')](_0x4b3f83[_0xcd2b('0x30')],qs['fields'](_0x149bff[_0xcd2b('0x31')][_0xcd2b('0x36')]));_0xe16672['attributes']=_0xe16672[_0xcd2b('0x34')][_0xcd2b('0x37')]?_0xe16672['attributes']:_0x4b3f83['model'];_0xe16672[_0xcd2b('0x3a')]=qs[_0xcd2b('0x3b')](_0x149bff[_0xcd2b('0x31')][_0xcd2b('0x3b')]);_0xe16672[_0xcd2b('0x3c')]=qs[_0xcd2b('0x33')](_[_0xcd2b('0x3d')](_0x149bff[_0xcd2b('0x31')],_0x4b3f83[_0xcd2b('0x33')]));if(_0x149bff[_0xcd2b('0x31')][_0xcd2b('0x3e')]){_0xe16672[_0xcd2b('0x3c')]=_[_0xcd2b('0x3f')](_0xe16672[_0xcd2b('0x3c')],{'$or':_[_0xcd2b('0x2b')](_0xe16672['attributes'],function(_0x1cc5ff){var _0x2cce04={};_0x2cce04[_0x1cc5ff]={'$like':'%'+_0x149bff[_0xcd2b('0x31')][_0xcd2b('0x3e')]+'%'};return _0x2cce04;})});}_0xe16672=_[_0xcd2b('0x3f')]({},_0xe16672,_0x149bff[_0xcd2b('0x41')]);return _0x5c31b1[_0xcd2b('0x4c')](_0xe16672);}})[_0xcd2b('0x25')](function(_0x23b557){if(_0x23b557){_0x412cd4=_0x23b557[_0xcd2b('0x37')];if(!_0x149bff[_0xcd2b('0x31')]['hasOwnProperty'](_0xcd2b('0x39'))){_0xe16672[_0xcd2b('0x1c')]=qs['limit'](_0x149bff[_0xcd2b('0x31')][_0xcd2b('0x1c')]);_0xe16672['offset']=qs['offset'](_0x149bff['query'][_0xcd2b('0x1d')]);}return _0x5c31b1[_0xcd2b('0x4c')](_0xe16672);}})[_0xcd2b('0x25')](function(_0x5ae577){if(_0x5ae577){return _0x5ae577?{'count':_0x412cd4,'rows':_0x5ae577}:null;}})[_0xcd2b('0x25')](respondWithResult(_0x473bc9,null))[_0xcd2b('0x48')](handleError(_0x473bc9,null));};exports[_0xcd2b('0x4e')]=function(_0x2e21a9,_0x34a9f4,_0x56008d){var _0x204854={};var _0x4c6f36={};var _0x5a5214;var _0x451661;return db[_0xcd2b('0x2c')][_0xcd2b('0x4b')]({'where':{'id':_0x2e21a9['params']['id']}})['then'](handleEntityNotFound(_0x34a9f4,null))[_0xcd2b('0x25')](function(_0x2c6157){if(_0x2c6157){_0x5a5214=_0x2c6157;_0x4c6f36[_0xcd2b('0x30')]=_['keys'](db[_0xcd2b('0x4d')][_0xcd2b('0x2d')]);_0x4c6f36[_0xcd2b('0x31')]=_[_0xcd2b('0x32')](_0x2e21a9[_0xcd2b('0x31')]);_0x4c6f36[_0xcd2b('0x33')]=_['intersection'](_0x4c6f36['model'],_0x4c6f36[_0xcd2b('0x31')]);_0x204854[_0xcd2b('0x34')]=_[_0xcd2b('0x35')](_0x4c6f36[_0xcd2b('0x30')],qs[_0xcd2b('0x36')](_0x2e21a9[_0xcd2b('0x31')][_0xcd2b('0x36')]));_0x204854[_0xcd2b('0x34')]=_0x204854[_0xcd2b('0x34')][_0xcd2b('0x37')]?_0x204854[_0xcd2b('0x34')]:_0x4c6f36[_0xcd2b('0x30')];_0x204854['order']=qs[_0xcd2b('0x3b')](_0x2e21a9[_0xcd2b('0x31')][_0xcd2b('0x3b')]);_0x204854[_0xcd2b('0x3c')]=qs[_0xcd2b('0x33')](_[_0xcd2b('0x3d')](_0x2e21a9[_0xcd2b('0x31')],_0x4c6f36[_0xcd2b('0x33')]));if(_0x2e21a9[_0xcd2b('0x31')]['filter']){_0x204854[_0xcd2b('0x3c')]=_[_0xcd2b('0x3f')](_0x204854['where'],{'$or':_['map'](_0x204854[_0xcd2b('0x34')],function(_0x5f53a0){var _0x5d983c={};_0x5d983c[_0x5f53a0]={'$like':'%'+_0x2e21a9[_0xcd2b('0x31')]['filter']+'%'};return _0x5d983c;})});}_0x204854=_['merge']({},_0x204854,_0x2e21a9[_0xcd2b('0x41')]);return _0x5a5214[_0xcd2b('0x4e')](_0x204854);}})[_0xcd2b('0x25')](function(_0x4eb351){if(_0x4eb351){_0x451661=_0x4eb351[_0xcd2b('0x37')];if(!_0x2e21a9['query'][_0xcd2b('0x38')](_0xcd2b('0x39'))){_0x204854[_0xcd2b('0x1c')]=qs[_0xcd2b('0x1c')](_0x2e21a9[_0xcd2b('0x31')][_0xcd2b('0x1c')]);_0x204854[_0xcd2b('0x1d')]=qs['offset'](_0x2e21a9[_0xcd2b('0x31')][_0xcd2b('0x1d')]);}return _0x5a5214[_0xcd2b('0x4e')](_0x204854);}})[_0xcd2b('0x25')](function(_0x3c0fa8){if(_0x3c0fa8){return _0x3c0fa8?{'count':_0x451661,'rows':_0x3c0fa8}:null;}})[_0xcd2b('0x25')](respondWithResult(_0x34a9f4,null))[_0xcd2b('0x48')](handleError(_0x34a9f4,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index e2d44c4..5c9b040 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 _0xb37f=['int_zoho_configurations','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration'];(function(_0x4f66f8,_0x25a921){var _0x43006e=function(_0x69dce5){while(--_0x69dce5){_0x4f66f8['push'](_0x4f66f8['shift']());}};_0x43006e(++_0x25a921);}(_0xb37f,0x6f));var _0xfb37=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xb37f[_0x25e7cb];return _0x375d92;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfb37('0x0'))('api');var moment=require(_0xfb37('0x1'));var BPromise=require(_0xfb37('0x2'));var rp=require(_0xfb37('0x3'));var fs=require('fs');var path=require(_0xfb37('0x4'));var rimraf=require('rimraf');var config=require(_0xfb37('0x5'));var attributes=require(_0xfb37('0x6'));module[_0xfb37('0x7')]=function(_0x1bf1f7,_0x1f1c2e){return _0x1bf1f7['define'](_0xfb37('0x8'),attributes,{'tableName':_0xfb37('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff1d=['../../config/environment','./intZohoConfiguration.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x5a7d6f,_0x488f7d){var _0x1ffe4e=function(_0x2a1422){while(--_0x2a1422){_0x5a7d6f['push'](_0x5a7d6f['shift']());}};_0x1ffe4e(++_0x488f7d);}(_0xff1d,0x1a6));var _0xdff1=function(_0x21d2cc,_0x81b56d){_0x21d2cc=_0x21d2cc-0x0;var _0x35176c=_0xff1d[_0x21d2cc];return _0x35176c;};'use strict';var _=require(_0xdff1('0x0'));var util=require(_0xdff1('0x1'));var logger=require(_0xdff1('0x2'))('api');var moment=require(_0xdff1('0x3'));var BPromise=require(_0xdff1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdff1('0x5'));var rimraf=require(_0xdff1('0x6'));var config=require(_0xdff1('0x7'));var attributes=require(_0xdff1('0x8'));module[_0xdff1('0x9')]=function(_0x3816a8,_0x2d0c45){return _0x3816a8[_0xdff1('0xa')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 661d278..6f1f97c 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 _0xf4a6=['request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x73e4cf,_0x2a8375){var _0x1e1bf8=function(_0xca0967){while(--_0xca0967){_0x73e4cf['push'](_0x73e4cf['shift']());}};_0x1e1bf8(++_0x2a8375);}(_0xf4a6,0x7a));var _0x6f4a=function(_0x531f9f,_0x2e5609){_0x531f9f=_0x531f9f-0x0;var _0x37fbce=_0xf4a6[_0x531f9f];return _0x37fbce;};'use strict';var _=require(_0x6f4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f4a('0x1'));var fs=require('fs');var Redis=require(_0x6f4a('0x2'));var db=require(_0x6f4a('0x3'))['db'];var utils=require(_0x6f4a('0x4'));var logger=require(_0x6f4a('0x5'))(_0x6f4a('0x6'));var config=require(_0x6f4a('0x7'));var jayson=require(_0x6f4a('0x8'));var client=jayson['client'][_0x6f4a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e982b,_0x188d19,_0x3a7d81){return new BPromise(function(_0x2bb0c6,_0x354081){return client[_0x6f4a('0xa')](_0x4e982b,_0x3a7d81)[_0x6f4a('0xb')](function(_0x31698d){logger[_0x6f4a('0xc')](_0x6f4a('0xd'),_0x188d19,_0x6f4a('0xe'));logger[_0x6f4a('0xf')](_0x6f4a('0x10'),_0x188d19,'request\x20sent',JSON[_0x6f4a('0x11')](_0x31698d));if(_0x31698d['error']){if(_0x31698d[_0x6f4a('0x12')][_0x6f4a('0x13')]===0x1f4){logger[_0x6f4a('0x12')](_0x6f4a('0xd'),_0x188d19,_0x31698d[_0x6f4a('0x12')][_0x6f4a('0x14')]);return _0x354081(_0x31698d[_0x6f4a('0x12')][_0x6f4a('0x14')]);}logger['error'](_0x6f4a('0xd'),_0x188d19,_0x31698d[_0x6f4a('0x12')][_0x6f4a('0x14')]);return _0x2bb0c6(_0x31698d[_0x6f4a('0x12')][_0x6f4a('0x14')]);}else{logger[_0x6f4a('0xc')](_0x6f4a('0xd'),_0x188d19,_0x6f4a('0xe'));_0x2bb0c6(_0x31698d[_0x6f4a('0x15')][_0x6f4a('0x14')]);}})['catch'](function(_0x1352eb){logger[_0x6f4a('0x12')](_0x6f4a('0xd'),_0x188d19,_0x1352eb);_0x354081(_0x1352eb);});});} \ No newline at end of file +var _0xbddb=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x1c2dd0,_0x2f539d){var _0x2063d7=function(_0x58ebd0){while(--_0x58ebd0){_0x1c2dd0['push'](_0x1c2dd0['shift']());}};_0x2063d7(++_0x2f539d);}(_0xbddb,0x14b));var _0xbbdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbddb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbbdd('0x0'));var BPromise=require(_0xbbdd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbdd('0x2'))['db'];var utils=require(_0xbbdd('0x3'));var logger=require('../../config/logger')(_0xbbdd('0x4'));var config=require(_0xbbdd('0x5'));var jayson=require(_0xbbdd('0x6'));var client=jayson['client'][_0xbbdd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x13c7c2,_0x2ca7e7,_0x3e84ff){return new BPromise(function(_0x1e8399,_0x5952e0){return client['request'](_0x13c7c2,_0x3e84ff)[_0xbbdd('0x8')](function(_0x2fea51){logger[_0xbbdd('0x9')](_0xbbdd('0xa'),_0x2ca7e7,_0xbbdd('0xb'));logger[_0xbbdd('0xc')](_0xbbdd('0xd'),_0x2ca7e7,_0xbbdd('0xb'),JSON[_0xbbdd('0xe')](_0x2fea51));if(_0x2fea51[_0xbbdd('0xf')]){if(_0x2fea51[_0xbbdd('0xf')][_0xbbdd('0x10')]===0x1f4){logger[_0xbbdd('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x2ca7e7,_0x2fea51[_0xbbdd('0xf')][_0xbbdd('0x11')]);return _0x5952e0(_0x2fea51['error'][_0xbbdd('0x11')]);}logger[_0xbbdd('0xf')](_0xbbdd('0xa'),_0x2ca7e7,_0x2fea51['error']['message']);return _0x1e8399(_0x2fea51[_0xbbdd('0xf')][_0xbbdd('0x11')]);}else{logger['info'](_0xbbdd('0xa'),_0x2ca7e7,_0xbbdd('0xb'));_0x1e8399(_0x2fea51[_0xbbdd('0x12')][_0xbbdd('0x11')]);}})[_0xbbdd('0x13')](function(_0x15d758){logger['error'](_0xbbdd('0xa'),_0x2ca7e7,_0x15d758);_0x5952e0(_0x15d758);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index dc6fae9..ada1208 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 _0xdc3d=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','post','update','delete','destroy','exports','multer'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xdc3d,0x7d));var _0xddc3=function(_0x457eed,_0xabbbb6){_0x457eed=_0x457eed-0x0;var _0x22af7f=_0xdc3d[_0x457eed];return _0x22af7f;};'use strict';var multer=require(_0xddc3('0x0'));var util=require(_0xddc3('0x1'));var path=require('path');var timeout=require(_0xddc3('0x2'));var express=require(_0xddc3('0x3'));var router=express[_0xddc3('0x4')]();var fs_extra=require(_0xddc3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xddc3('0x6'));var config=require(_0xddc3('0x7'));var controller=require(_0xddc3('0x8'));router[_0xddc3('0x9')]('/',auth[_0xddc3('0xa')](),controller[_0xddc3('0xb')]);router[_0xddc3('0x9')](_0xddc3('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xddc3('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xddc3('0xc'),auth[_0xddc3('0xa')](),controller[_0xddc3('0xe')]);router[_0xddc3('0xf')](_0xddc3('0xc'),auth[_0xddc3('0xa')](),controller[_0xddc3('0x10')]);module[_0xddc3('0x11')]=router; \ No newline at end of file +var _0x439c=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy'];(function(_0x424158,_0x5d73b4){var _0x4322b6=function(_0x215976){while(--_0x215976){_0x424158['push'](_0x424158['shift']());}};_0x4322b6(++_0x5d73b4);}(_0x439c,0x14b));var _0xc439=function(_0x20fc8d,_0x593460){_0x20fc8d=_0x20fc8d-0x0;var _0x2f4f05=_0x439c[_0x20fc8d];return _0x2f4f05;};'use strict';var multer=require(_0xc439('0x0'));var util=require(_0xc439('0x1'));var path=require(_0xc439('0x2'));var timeout=require(_0xc439('0x3'));var express=require(_0xc439('0x4'));var router=express[_0xc439('0x5')]();var fs_extra=require(_0xc439('0x6'));var auth=require(_0xc439('0x7'));var interaction=require(_0xc439('0x8'));var config=require(_0xc439('0x9'));var controller=require(_0xc439('0xa'));router[_0xc439('0xb')]('/',auth['isAuthenticated'](),controller[_0xc439('0xc')]);router[_0xc439('0xb')](_0xc439('0xd'),auth[_0xc439('0xe')](),controller[_0xc439('0xf')]);router[_0xc439('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc439('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc439('0x12')]);router[_0xc439('0x13')](_0xc439('0xd'),auth['isAuthenticated'](),controller[_0xc439('0x14')]);module[_0xc439('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a3d3af6..8a6eda7 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 _0x8e2a=['string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x56186d,_0x5257fd){var _0x5e03d7=function(_0x2e6206){while(--_0x2e6206){_0x56186d['push'](_0x56186d['shift']());}};_0x5e03d7(++_0x5257fd);}(_0x8e2a,0x1f0));var _0xa8e2=function(_0x29e398,_0x134e25){_0x29e398=_0x29e398-0x0;var _0x521b8a=_0x8e2a[_0x29e398];return _0x521b8a;};'use strict';var Sequelize=require(_0xa8e2('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa8e2('0x1'),_0xa8e2('0x2'),'customVariable',_0xa8e2('0x3'),_0xa8e2('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa8e2('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xa8e2('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xa8e2('0x5')]},'idField':{'type':Sequelize[_0xa8e2('0x5')]},'nameField':{'type':Sequelize[_0xa8e2('0x5')]},'customField':{'type':Sequelize[_0xa8e2('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8549=['sequelize','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN'];(function(_0x18bf17,_0x32626e){var _0x7c4e02=function(_0x4afbbe){while(--_0x4afbbe){_0x18bf17['push'](_0x18bf17['shift']());}};_0x7c4e02(++_0x32626e);}(_0x8549,0x140));var _0x9854=function(_0x5b3602,_0x1fcd24){_0x5b3602=_0x5b3602-0x0;var _0xdf4076=_0x8549[_0x5b3602];return _0xdf4076;};'use strict';var Sequelize=require(_0x9854('0x0'));module['exports']={'type':{'type':Sequelize[_0x9854('0x1')]('string',_0x9854('0x2'),_0x9854('0x3'),_0x9854('0x4'),'picklist'),'defaultValue':_0x9854('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9854('0x6')]},'keyType':{'type':Sequelize[_0x9854('0x1')](_0x9854('0x5'),_0x9854('0x2'),_0x9854('0x3'))},'keyContent':{'type':Sequelize[_0x9854('0x6')]},'idField':{'type':Sequelize[_0x9854('0x6')]},'nameField':{'type':Sequelize[_0x9854('0x6')]},'customField':{'type':Sequelize[_0x9854('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9854('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b18b6b2..20fe547 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 _0xc738=['show','params','keys','intersection','merge','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','ZohoField','rawAttributes','fieldName','key','model','map','query','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','options','include','rows'];(function(_0x42e616,_0x33d424){var _0x5ba1c5=function(_0x29d451){while(--_0x29d451){_0x42e616['push'](_0x42e616['shift']());}};_0x5ba1c5(++_0x33d424);}(_0xc738,0x135));var _0x8c73=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0xc738[_0x6eb833];return _0xdfc38c;};'use strict';var emlformat=require(_0x8c73('0x0'));var rimraf=require(_0x8c73('0x1'));var zipdir=require(_0x8c73('0x2'));var jsonpatch=require(_0x8c73('0x3'));var rp=require(_0x8c73('0x4'));var moment=require(_0x8c73('0x5'));var BPromise=require(_0x8c73('0x6'));var Mustache=require('mustache');var util=require(_0x8c73('0x7'));var path=require('path');var sox=require(_0x8c73('0x8'));var csv=require(_0x8c73('0x9'));var ejs=require(_0x8c73('0xa'));var fs=require('fs');var fs_extra=require(_0x8c73('0xb'));var _=require('lodash');var squel=require(_0x8c73('0xc'));var crypto=require(_0x8c73('0xd'));var jsforce=require(_0x8c73('0xe'));var deskjs=require(_0x8c73('0xf'));var toCsv=require(_0x8c73('0x9'));var querystring=require(_0x8c73('0x10'));var Papa=require('papaparse');var Redis=require(_0x8c73('0x11'));var authService=require(_0x8c73('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8c73('0x13'));var hardwareService=require(_0x8c73('0x14'));var logger=require('../../config/logger')(_0x8c73('0x15'));var utils=require(_0x8c73('0x16'));var config=require(_0x8c73('0x17'));var licenseUtil=require(_0x8c73('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b08c9,_0x11a2b6){_0x11a2b6=_0x11a2b6||0xcc;return function(_0x2bf6ed){if(_0x2bf6ed){return _0x5b08c9[_0x8c73('0x19')](_0x11a2b6);}return _0x5b08c9[_0x8c73('0x1a')](_0x11a2b6)[_0x8c73('0x1b')]();};}function respondWithResult(_0x410e7c,_0x1186c0){_0x1186c0=_0x1186c0||0xc8;return function(_0x3884ca){if(_0x3884ca){return _0x410e7c[_0x8c73('0x1a')](_0x1186c0)[_0x8c73('0x1c')](_0x3884ca);}};}function respondWithFilteredResult(_0xddad0b,_0x5dffcc){return function(_0x5dfd8f){if(_0x5dfd8f){var _0x145d3c=typeof _0x5dffcc[_0x8c73('0x1d')]===_0x8c73('0x1e')&&typeof _0x5dffcc[_0x8c73('0x1f')]==='undefined';var _0x510e06=_0x5dfd8f[_0x8c73('0x20')];var _0x580f0a=_0x145d3c?0x0:_0x5dffcc['offset'];var _0x31ad6c=_0x145d3c?_0x5dfd8f[_0x8c73('0x20')]:_0x5dffcc[_0x8c73('0x1d')]+_0x5dffcc[_0x8c73('0x1f')];var _0xf98a63;if(_0x31ad6c>=_0x510e06){_0x31ad6c=_0x510e06;_0xf98a63=0xc8;}else{_0xf98a63=0xce;}_0xddad0b[_0x8c73('0x1a')](_0xf98a63);return _0xddad0b[_0x8c73('0x21')]('Content-Range',_0x580f0a+'-'+_0x31ad6c+'/'+_0x510e06)['json'](_0x5dfd8f);}return null;};}function patchUpdates(_0x4a7916){return function(_0x4ac5cd){try{jsonpatch[_0x8c73('0x22')](_0x4ac5cd,_0x4a7916,!![]);}catch(_0x47acb9){return BPromise[_0x8c73('0x23')](_0x47acb9);}return _0x4ac5cd[_0x8c73('0x24')]();};}function saveUpdates(_0x45323b,_0x18fcc7){return function(_0x3e7cd6){if(_0x3e7cd6){return _0x3e7cd6[_0x8c73('0x25')](_0x45323b)[_0x8c73('0x26')](function(_0x80664e){return _0x80664e;});}return null;};}function removeEntity(_0xe7d78d,_0xfb9015){return function(_0x13605e){if(_0x13605e){return _0x13605e[_0x8c73('0x27')]()[_0x8c73('0x26')](function(){_0xe7d78d[_0x8c73('0x1a')](0xcc)[_0x8c73('0x1b')]();});}};}function handleEntityNotFound(_0x2dba8c,_0x27281c){return function(_0x1e8958){if(!_0x1e8958){_0x2dba8c[_0x8c73('0x19')](0x194);}return _0x1e8958;};}function handleError(_0x1b4364,_0x66b031){_0x66b031=_0x66b031||0x1f4;return function(_0x1ffc0a){logger[_0x8c73('0x28')](_0x1ffc0a[_0x8c73('0x29')]);if(_0x1ffc0a[_0x8c73('0x2a')]){delete _0x1ffc0a['name'];}_0x1b4364[_0x8c73('0x1a')](_0x66b031)['send'](_0x1ffc0a);};}exports[_0x8c73('0x2b')]=function(_0x419be0,_0x1c38aa){var _0x501663={},_0x550ce8={},_0x3562b1={'count':0x0,'rows':[]};var _0x2e6730=_['map'](db[_0x8c73('0x2c')][_0x8c73('0x2d')],function(_0x472e67){return{'name':_0x472e67[_0x8c73('0x2e')],'type':_0x472e67['type'][_0x8c73('0x2f')]};});_0x550ce8[_0x8c73('0x30')]=_[_0x8c73('0x31')](_0x2e6730,'name');_0x550ce8[_0x8c73('0x32')]=_['keys'](_0x419be0[_0x8c73('0x32')]);_0x550ce8[_0x8c73('0x33')]=_['intersection'](_0x550ce8[_0x8c73('0x30')],_0x550ce8[_0x8c73('0x32')]);_0x501663['attributes']=_['intersection'](_0x550ce8[_0x8c73('0x30')],qs['fields'](_0x419be0[_0x8c73('0x32')][_0x8c73('0x34')]));_0x501663['attributes']=_0x501663[_0x8c73('0x35')][_0x8c73('0x36')]?_0x501663[_0x8c73('0x35')]:_0x550ce8[_0x8c73('0x30')];if(!_0x419be0[_0x8c73('0x32')][_0x8c73('0x37')]('nolimit')){_0x501663[_0x8c73('0x1f')]=qs[_0x8c73('0x1f')](_0x419be0[_0x8c73('0x32')][_0x8c73('0x1f')]);_0x501663[_0x8c73('0x1d')]=qs[_0x8c73('0x1d')](_0x419be0[_0x8c73('0x32')][_0x8c73('0x1d')]);}_0x501663[_0x8c73('0x38')]=qs[_0x8c73('0x39')](_0x419be0['query'][_0x8c73('0x39')]);_0x501663[_0x8c73('0x3a')]=qs[_0x8c73('0x33')](_[_0x8c73('0x3b')](_0x419be0[_0x8c73('0x32')],_0x550ce8[_0x8c73('0x33')]),_0x2e6730);if(_0x419be0[_0x8c73('0x32')][_0x8c73('0x3c')]){_0x501663['where']=_['merge'](_0x501663[_0x8c73('0x3a')],{'$or':_['map'](_0x2e6730,function(_0x171637){if(_0x171637[_0x8c73('0x3d')]!==_0x8c73('0x3e')){var _0x88e6b2={};_0x88e6b2[_0x171637[_0x8c73('0x2a')]]={'$like':'%'+_0x419be0[_0x8c73('0x32')][_0x8c73('0x3c')]+'%'};return _0x88e6b2;}})});}_0x501663=_['merge']({},_0x501663,_0x419be0[_0x8c73('0x3f')]);var _0xc47c47={'where':_0x501663[_0x8c73('0x3a')]};return db[_0x8c73('0x2c')][_0x8c73('0x20')](_0xc47c47)['then'](function(_0x7ef94f){_0x3562b1[_0x8c73('0x20')]=_0x7ef94f;if(_0x419be0[_0x8c73('0x32')]['includeAll']){_0x501663[_0x8c73('0x40')]=[{'all':!![]}];}return db[_0x8c73('0x2c')]['findAll'](_0x501663);})[_0x8c73('0x26')](function(_0x4c1a84){_0x3562b1[_0x8c73('0x41')]=_0x4c1a84;return _0x3562b1;})[_0x8c73('0x26')](respondWithFilteredResult(_0x1c38aa,_0x501663))['catch'](handleError(_0x1c38aa,null));};exports[_0x8c73('0x42')]=function(_0x5ec7a9,_0x55cf81){var _0x1ba3d7={'raw':!![],'where':{'id':_0x5ec7a9[_0x8c73('0x43')]['id']}},_0x7b0887={};_0x7b0887[_0x8c73('0x30')]=_['keys'](db[_0x8c73('0x2c')][_0x8c73('0x2d')]);_0x7b0887[_0x8c73('0x32')]=_[_0x8c73('0x44')](_0x5ec7a9[_0x8c73('0x32')]);_0x7b0887['filters']=_[_0x8c73('0x45')](_0x7b0887[_0x8c73('0x30')],_0x7b0887['query']);_0x1ba3d7[_0x8c73('0x35')]=_[_0x8c73('0x45')](_0x7b0887[_0x8c73('0x30')],qs[_0x8c73('0x34')](_0x5ec7a9[_0x8c73('0x32')]['fields']));_0x1ba3d7[_0x8c73('0x35')]=_0x1ba3d7[_0x8c73('0x35')][_0x8c73('0x36')]?_0x1ba3d7[_0x8c73('0x35')]:_0x7b0887[_0x8c73('0x30')];if(_0x5ec7a9[_0x8c73('0x32')]['includeAll']){_0x1ba3d7[_0x8c73('0x40')]=[{'all':!![]}];}_0x1ba3d7=_[_0x8c73('0x46')]({},_0x1ba3d7,_0x5ec7a9[_0x8c73('0x3f')]);return db['ZohoField'][_0x8c73('0x47')](_0x1ba3d7)['then'](handleEntityNotFound(_0x55cf81,null))[_0x8c73('0x26')](respondWithResult(_0x55cf81,null))[_0x8c73('0x48')](handleError(_0x55cf81,null));};exports['create']=function(_0x1ada46,_0x347c8d){return db[_0x8c73('0x2c')][_0x8c73('0x49')](_0x1ada46[_0x8c73('0x4a')],{})[_0x8c73('0x26')](respondWithResult(_0x347c8d,0xc9))[_0x8c73('0x48')](handleError(_0x347c8d,null));};exports['update']=function(_0x24721d,_0x48cf57){if(_0x24721d[_0x8c73('0x4a')]['id']){delete _0x24721d['body']['id'];}return db['ZohoField'][_0x8c73('0x47')]({'where':{'id':_0x24721d['params']['id']}})[_0x8c73('0x26')](handleEntityNotFound(_0x48cf57,null))[_0x8c73('0x26')](saveUpdates(_0x24721d['body'],null))[_0x8c73('0x26')](respondWithResult(_0x48cf57,null))[_0x8c73('0x48')](handleError(_0x48cf57,null));};exports[_0x8c73('0x27')]=function(_0x1c06e5,_0x5c2fae){return db[_0x8c73('0x2c')][_0x8c73('0x47')]({'where':{'id':_0x1c06e5[_0x8c73('0x43')]['id']}})[_0x8c73('0x26')](handleEntityNotFound(_0x5c2fae,null))[_0x8c73('0x26')](removeEntity(_0x5c2fae,null))['catch'](handleError(_0x5c2fae,null));}; \ No newline at end of file +var _0xaed1=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','sendStatus','error','name','send','index','ZohoField','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','rows','show','find','create','body','catch','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xaed1,0x1b1));var _0x1aed=function(_0x2f479d,_0x1d6836){_0x2f479d=_0x2f479d-0x0;var _0x300d48=_0xaed1[_0x2f479d];return _0x300d48;};'use strict';var emlformat=require(_0x1aed('0x0'));var rimraf=require(_0x1aed('0x1'));var zipdir=require(_0x1aed('0x2'));var jsonpatch=require(_0x1aed('0x3'));var rp=require(_0x1aed('0x4'));var moment=require(_0x1aed('0x5'));var BPromise=require(_0x1aed('0x6'));var Mustache=require(_0x1aed('0x7'));var util=require(_0x1aed('0x8'));var path=require(_0x1aed('0x9'));var sox=require(_0x1aed('0xa'));var csv=require(_0x1aed('0xb'));var ejs=require(_0x1aed('0xc'));var fs=require('fs');var fs_extra=require(_0x1aed('0xd'));var _=require(_0x1aed('0xe'));var squel=require(_0x1aed('0xf'));var crypto=require('crypto');var jsforce=require(_0x1aed('0x10'));var deskjs=require(_0x1aed('0x11'));var toCsv=require(_0x1aed('0xb'));var querystring=require('querystring');var Papa=require(_0x1aed('0x12'));var Redis=require(_0x1aed('0x13'));var authService=require(_0x1aed('0x14'));var qs=require(_0x1aed('0x15'));var as=require(_0x1aed('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1aed('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x1aed('0x18'));var licenseUtil=require(_0x1aed('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x233e4,_0xf95ca3){_0xf95ca3=_0xf95ca3||0xcc;return function(_0x4db5d4){if(_0x4db5d4){return _0x233e4['sendStatus'](_0xf95ca3);}return _0x233e4[_0x1aed('0x1a')](_0xf95ca3)['end']();};}function respondWithResult(_0x4d88c9,_0x163fcc){_0x163fcc=_0x163fcc||0xc8;return function(_0x3abfd9){if(_0x3abfd9){return _0x4d88c9[_0x1aed('0x1a')](_0x163fcc)[_0x1aed('0x1b')](_0x3abfd9);}};}function respondWithFilteredResult(_0x8d87be,_0x1c8bcf){return function(_0x5e466e){if(_0x5e466e){var _0x9ed034=typeof _0x1c8bcf[_0x1aed('0x1c')]===_0x1aed('0x1d')&&typeof _0x1c8bcf[_0x1aed('0x1e')]===_0x1aed('0x1d');var _0x23c4e4=_0x5e466e[_0x1aed('0x1f')];var _0x2df4ef=_0x9ed034?0x0:_0x1c8bcf[_0x1aed('0x1c')];var _0x462871=_0x9ed034?_0x5e466e['count']:_0x1c8bcf[_0x1aed('0x1c')]+_0x1c8bcf[_0x1aed('0x1e')];var _0x21e4ec;if(_0x462871>=_0x23c4e4){_0x462871=_0x23c4e4;_0x21e4ec=0xc8;}else{_0x21e4ec=0xce;}_0x8d87be[_0x1aed('0x1a')](_0x21e4ec);return _0x8d87be[_0x1aed('0x20')]('Content-Range',_0x2df4ef+'-'+_0x462871+'/'+_0x23c4e4)[_0x1aed('0x1b')](_0x5e466e);}return null;};}function patchUpdates(_0x174451){return function(_0x54c90c){try{jsonpatch[_0x1aed('0x21')](_0x54c90c,_0x174451,!![]);}catch(_0x5aafb4){return BPromise[_0x1aed('0x22')](_0x5aafb4);}return _0x54c90c[_0x1aed('0x23')]();};}function saveUpdates(_0x467cc8,_0x53246f){return function(_0xf45c60){if(_0xf45c60){return _0xf45c60[_0x1aed('0x24')](_0x467cc8)['then'](function(_0x2ab3f3){return _0x2ab3f3;});}return null;};}function removeEntity(_0xd00bdc,_0x2af36c){return function(_0x24e937){if(_0x24e937){return _0x24e937['destroy']()[_0x1aed('0x25')](function(){_0xd00bdc[_0x1aed('0x1a')](0xcc)[_0x1aed('0x26')]();});}};}function handleEntityNotFound(_0x31c4e6,_0x396a5f){return function(_0xc19d30){if(!_0xc19d30){_0x31c4e6[_0x1aed('0x27')](0x194);}return _0xc19d30;};}function handleError(_0x333551,_0x592fc2){_0x592fc2=_0x592fc2||0x1f4;return function(_0x5d3fca){logger[_0x1aed('0x28')](_0x5d3fca['stack']);if(_0x5d3fca[_0x1aed('0x29')]){delete _0x5d3fca['name'];}_0x333551[_0x1aed('0x1a')](_0x592fc2)[_0x1aed('0x2a')](_0x5d3fca);};}exports[_0x1aed('0x2b')]=function(_0x130cd0,_0x38cf7d){var _0x6f4dab={},_0x4aba03={},_0x3d8a33={'count':0x0,'rows':[]};var _0x4f9c49=_['map'](db[_0x1aed('0x2c')]['rawAttributes'],function(_0x278e0a){return{'name':_0x278e0a[_0x1aed('0x2d')],'type':_0x278e0a[_0x1aed('0x2e')]['key']};});_0x4aba03[_0x1aed('0x2f')]=_[_0x1aed('0x30')](_0x4f9c49,_0x1aed('0x29'));_0x4aba03[_0x1aed('0x31')]=_[_0x1aed('0x32')](_0x130cd0[_0x1aed('0x31')]);_0x4aba03['filters']=_[_0x1aed('0x33')](_0x4aba03[_0x1aed('0x2f')],_0x4aba03[_0x1aed('0x31')]);_0x6f4dab[_0x1aed('0x34')]=_[_0x1aed('0x33')](_0x4aba03[_0x1aed('0x2f')],qs[_0x1aed('0x35')](_0x130cd0[_0x1aed('0x31')][_0x1aed('0x35')]));_0x6f4dab[_0x1aed('0x34')]=_0x6f4dab['attributes'][_0x1aed('0x36')]?_0x6f4dab[_0x1aed('0x34')]:_0x4aba03[_0x1aed('0x2f')];if(!_0x130cd0[_0x1aed('0x31')][_0x1aed('0x37')](_0x1aed('0x38'))){_0x6f4dab[_0x1aed('0x1e')]=qs[_0x1aed('0x1e')](_0x130cd0[_0x1aed('0x31')][_0x1aed('0x1e')]);_0x6f4dab[_0x1aed('0x1c')]=qs[_0x1aed('0x1c')](_0x130cd0[_0x1aed('0x31')][_0x1aed('0x1c')]);}_0x6f4dab['order']=qs['sort'](_0x130cd0[_0x1aed('0x31')][_0x1aed('0x39')]);_0x6f4dab[_0x1aed('0x3a')]=qs[_0x1aed('0x3b')](_['pick'](_0x130cd0[_0x1aed('0x31')],_0x4aba03[_0x1aed('0x3b')]),_0x4f9c49);if(_0x130cd0[_0x1aed('0x31')][_0x1aed('0x3c')]){_0x6f4dab['where']=_[_0x1aed('0x3d')](_0x6f4dab[_0x1aed('0x3a')],{'$or':_[_0x1aed('0x30')](_0x4f9c49,function(_0x45fe00){if(_0x45fe00[_0x1aed('0x2e')]!=='VIRTUAL'){var _0x111a45={};_0x111a45[_0x45fe00[_0x1aed('0x29')]]={'$like':'%'+_0x130cd0[_0x1aed('0x31')][_0x1aed('0x3c')]+'%'};return _0x111a45;}})});}_0x6f4dab=_[_0x1aed('0x3d')]({},_0x6f4dab,_0x130cd0[_0x1aed('0x3e')]);var _0x404ca9={'where':_0x6f4dab[_0x1aed('0x3a')]};return db[_0x1aed('0x2c')]['count'](_0x404ca9)[_0x1aed('0x25')](function(_0x4bba95){_0x3d8a33['count']=_0x4bba95;if(_0x130cd0[_0x1aed('0x31')][_0x1aed('0x3f')]){_0x6f4dab[_0x1aed('0x40')]=[{'all':!![]}];}return db[_0x1aed('0x2c')]['findAll'](_0x6f4dab);})[_0x1aed('0x25')](function(_0x577efb){_0x3d8a33[_0x1aed('0x41')]=_0x577efb;return _0x3d8a33;})[_0x1aed('0x25')](respondWithFilteredResult(_0x38cf7d,_0x6f4dab))['catch'](handleError(_0x38cf7d,null));};exports[_0x1aed('0x42')]=function(_0x2f1446,_0x579f5c){var _0x319ab6={'raw':!![],'where':{'id':_0x2f1446['params']['id']}},_0x29e4eb={};_0x29e4eb[_0x1aed('0x2f')]=_['keys'](db[_0x1aed('0x2c')]['rawAttributes']);_0x29e4eb['query']=_[_0x1aed('0x32')](_0x2f1446[_0x1aed('0x31')]);_0x29e4eb['filters']=_['intersection'](_0x29e4eb['model'],_0x29e4eb[_0x1aed('0x31')]);_0x319ab6[_0x1aed('0x34')]=_['intersection'](_0x29e4eb['model'],qs[_0x1aed('0x35')](_0x2f1446[_0x1aed('0x31')][_0x1aed('0x35')]));_0x319ab6[_0x1aed('0x34')]=_0x319ab6[_0x1aed('0x34')][_0x1aed('0x36')]?_0x319ab6[_0x1aed('0x34')]:_0x29e4eb[_0x1aed('0x2f')];if(_0x2f1446[_0x1aed('0x31')][_0x1aed('0x3f')]){_0x319ab6[_0x1aed('0x40')]=[{'all':!![]}];}_0x319ab6=_[_0x1aed('0x3d')]({},_0x319ab6,_0x2f1446[_0x1aed('0x3e')]);return db[_0x1aed('0x2c')][_0x1aed('0x43')](_0x319ab6)[_0x1aed('0x25')](handleEntityNotFound(_0x579f5c,null))[_0x1aed('0x25')](respondWithResult(_0x579f5c,null))['catch'](handleError(_0x579f5c,null));};exports[_0x1aed('0x44')]=function(_0xa2e9e2,_0x2cf38e){return db[_0x1aed('0x2c')][_0x1aed('0x44')](_0xa2e9e2[_0x1aed('0x45')],{})[_0x1aed('0x25')](respondWithResult(_0x2cf38e,0xc9))[_0x1aed('0x46')](handleError(_0x2cf38e,null));};exports[_0x1aed('0x24')]=function(_0x24e20c,_0x501bab){if(_0x24e20c[_0x1aed('0x45')]['id']){delete _0x24e20c[_0x1aed('0x45')]['id'];}return db[_0x1aed('0x2c')]['find']({'where':{'id':_0x24e20c[_0x1aed('0x47')]['id']}})[_0x1aed('0x25')](handleEntityNotFound(_0x501bab,null))['then'](saveUpdates(_0x24e20c['body'],null))[_0x1aed('0x25')](respondWithResult(_0x501bab,null))[_0x1aed('0x46')](handleError(_0x501bab,null));};exports[_0x1aed('0x48')]=function(_0x6239a9,_0x364b16){return db[_0x1aed('0x2c')][_0x1aed('0x43')]({'where':{'id':_0x6239a9[_0x1aed('0x47')]['id']}})[_0x1aed('0x25')](handleEntityNotFound(_0x364b16,null))[_0x1aed('0x25')](removeEntity(_0x364b16,null))[_0x1aed('0x46')](handleError(_0x364b16,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a88d296..49ce778 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 _0x8e3f=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var logger=require(_0xf8e3('0x2'))('api');var moment=require(_0xf8e3('0x3'));var BPromise=require(_0xf8e3('0x4'));var rp=require(_0xf8e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var attributes=require('./intZohoField.attributes');module[_0xf8e3('0x8')]=function(_0xb21f8d,_0x2621c5){return _0xb21f8d[_0xf8e3('0x9')]('ZohoField',attributes,{'tableName':_0xf8e3('0xa'),'paranoid':![],'indexes':[{'name':_0xf8e3('0xb'),'fields':[_0xf8e3('0xc'),_0xf8e3('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a85=['rimraf','../../config/environment','exports','ZohoField','int_zoho_fields','idField','../../config/logger','api','moment','path'];(function(_0x9bd285,_0x1367ef){var _0x4bdc01=function(_0x58af36){while(--_0x58af36){_0x9bd285['push'](_0x9bd285['shift']());}};_0x4bdc01(++_0x1367ef);}(_0x1a85,0x178));var _0x51a8=function(_0x34d993,_0x3c7017){_0x34d993=_0x34d993-0x0;var _0x4728c7=_0x1a85[_0x34d993];return _0x4728c7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./intZohoField.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x51a8('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index a9fbefb..f327066 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 _0x34cd=['error','code','message','ZohoField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify'];(function(_0x420687,_0x2a6c25){var _0x190813=function(_0x55f062){while(--_0x55f062){_0x420687['push'](_0x420687['shift']());}};_0x190813(++_0x2a6c25);}(_0x34cd,0x156));var _0xd34c=function(_0x849ff7,_0x5d9f47){_0x849ff7=_0x849ff7-0x0;var _0x254e48=_0x34cd[_0x849ff7];return _0x254e48;};'use strict';var _=require(_0xd34c('0x0'));var util=require(_0xd34c('0x1'));var moment=require(_0xd34c('0x2'));var BPromise=require(_0xd34c('0x3'));var rs=require(_0xd34c('0x4'));var fs=require('fs');var Redis=require(_0xd34c('0x5'));var db=require(_0xd34c('0x6'))['db'];var utils=require(_0xd34c('0x7'));var logger=require('../../config/logger')(_0xd34c('0x8'));var config=require(_0xd34c('0x9'));var jayson=require(_0xd34c('0xa'));var client=jayson[_0xd34c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b86a9,_0x3a6fe7,_0x3b69ef){return new BPromise(function(_0x285d55,_0x13a7df){return client[_0xd34c('0xc')](_0x2b86a9,_0x3b69ef)[_0xd34c('0xd')](function(_0x51fd29){logger[_0xd34c('0xe')]('ZohoField,\x20%s,\x20%s',_0x3a6fe7,_0xd34c('0xf'));logger[_0xd34c('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x3a6fe7,_0xd34c('0xf'),JSON[_0xd34c('0x11')](_0x51fd29));if(_0x51fd29[_0xd34c('0x12')]){if(_0x51fd29[_0xd34c('0x12')][_0xd34c('0x13')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x3a6fe7,_0x51fd29['error']['message']);return _0x13a7df(_0x51fd29[_0xd34c('0x12')][_0xd34c('0x14')]);}logger[_0xd34c('0x12')](_0xd34c('0x15'),_0x3a6fe7,_0x51fd29[_0xd34c('0x12')][_0xd34c('0x14')]);return _0x285d55(_0x51fd29['error'][_0xd34c('0x14')]);}else{logger[_0xd34c('0xe')](_0xd34c('0x15'),_0x3a6fe7,'request\x20sent');_0x285d55(_0x51fd29[_0xd34c('0x16')][_0xd34c('0x14')]);}})[_0xd34c('0x17')](function(_0x16c082){logger['error'](_0xd34c('0x15'),_0x3a6fe7,_0x16c082);_0x13a7df(_0x16c082);});});} \ No newline at end of file +var _0x89ef=['error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5393a6,_0x3c972d){var _0x477463=function(_0x5d6f37){while(--_0x5d6f37){_0x5393a6['push'](_0x5393a6['shift']());}};_0x477463(++_0x3c972d);}(_0x89ef,0x16c));var _0xf89e=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0x89ef[_0x2e7a43];return _0x52e9e1;};'use strict';var _=require(_0xf89e('0x0'));var util=require(_0xf89e('0x1'));var moment=require('moment');var BPromise=require(_0xf89e('0x2'));var rs=require(_0xf89e('0x3'));var fs=require('fs');var Redis=require(_0xf89e('0x4'));var db=require(_0xf89e('0x5'))['db'];var utils=require(_0xf89e('0x6'));var logger=require(_0xf89e('0x7'))(_0xf89e('0x8'));var config=require('../../config/environment');var jayson=require(_0xf89e('0x9'));var client=jayson[_0xf89e('0xa')][_0xf89e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x520691,_0x14e9ba,_0x440e0d){return new BPromise(function(_0x3910eb,_0xac2270){return client[_0xf89e('0xc')](_0x520691,_0x440e0d)[_0xf89e('0xd')](function(_0x27bb5b){logger[_0xf89e('0xe')](_0xf89e('0xf'),_0x14e9ba,_0xf89e('0x10'));logger[_0xf89e('0x11')](_0xf89e('0x12'),_0x14e9ba,_0xf89e('0x10'),JSON[_0xf89e('0x13')](_0x27bb5b));if(_0x27bb5b['error']){if(_0x27bb5b[_0xf89e('0x14')][_0xf89e('0x15')]===0x1f4){logger[_0xf89e('0x14')](_0xf89e('0xf'),_0x14e9ba,_0x27bb5b['error'][_0xf89e('0x16')]);return _0xac2270(_0x27bb5b['error'][_0xf89e('0x16')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x14e9ba,_0x27bb5b[_0xf89e('0x14')][_0xf89e('0x16')]);return _0x3910eb(_0x27bb5b[_0xf89e('0x14')][_0xf89e('0x16')]);}else{logger['info'](_0xf89e('0xf'),_0x14e9ba,_0xf89e('0x10'));_0x3910eb(_0x27bb5b['result'][_0xf89e('0x16')]);}})[_0xf89e('0x17')](function(_0x15b20b){logger[_0xf89e('0x14')]('ZohoField,\x20%s,\x20%s',_0x14e9ba,_0x15b20b);_0xac2270(_0x15b20b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 6038dc8..65202fb 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2ae5ce,_0x481760){var _0x3ccd3c=function(_0x3b870c){while(--_0x3b870c){_0x2ae5ce['push'](_0x2ae5ce['shift']());}};_0x3ccd3c(++_0x481760);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x527dc5,_0x1de7e7){var _0x216de9=function(_0xde9c52){while(--_0xde9c52){_0x527dc5['push'](_0x527dc5['shift']());}};_0x216de9(++_0x1de7e7);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index efd2fb5..006f5d6 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 _0xe032=['state','sequelize','exports','STRING','unique_name_and_version','BOOLEAN'];(function(_0x2689cd,_0x574890){var _0x171ffe=function(_0x3e057a){while(--_0x3e057a){_0x2689cd['push'](_0x2689cd['shift']());}};_0x171ffe(++_0x574890);}(_0xe032,0x175));var _0x2e03=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0xe032[_0x4ed32d];return _0xf624df;};'use strict';var Sequelize=require(_0x2e03('0x0'));module[_0x2e03('0x1')]={'name':{'type':Sequelize[_0x2e03('0x2')],'allowNull':![],'unique':_0x2e03('0x3')},'version':{'type':Sequelize[_0x2e03('0x2')],'allowNull':![],'unique':_0x2e03('0x3')},'main':{'type':Sequelize[_0x2e03('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x2e03('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2e03('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x2e03('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x2e03('0x2')]},'logo':{'type':Sequelize[_0x2e03('0x2')]},'state':{'type':Sequelize[_0x2e03('0x2')],'unique':_0x2e03('0x5')},'description':{'type':Sequelize[_0x2e03('0x2')]},'title':{'type':Sequelize[_0x2e03('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x9863=['INTEGER','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x5b57b6,_0x5b688f){var _0xf82c03=function(_0x3627a9){while(--_0x3627a9){_0x5b57b6['push'](_0x5b57b6['shift']());}};_0xf82c03(++_0x5b688f);}(_0x9863,0x160));var _0x3986=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9863[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x3986('0x0'));module[_0x3986('0x1')]={'name':{'type':Sequelize[_0x3986('0x2')],'allowNull':![],'unique':_0x3986('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3986('0x3')},'main':{'type':Sequelize[_0x3986('0x2')],'defaultValue':_0x3986('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3986('0x2')]},'size':{'type':Sequelize[_0x3986('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x3986('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x3986('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x3986('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'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 b2a8b38..ccf47f7 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 _0x2a07=['name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x2a07,0x74));var _0x72a0=function(_0x155506,_0x202f81){_0x155506=_0x155506-0x0;var _0x14b973=_0x2a07[_0x155506];return _0x14b973;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['Integration'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['Integration']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));}; \ No newline at end of file +var _0x6343=['hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','Integration','then','rows','catch','show','params','keys','includeAll','include','create','body','find','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length'];(function(_0x20eb51,_0x32c4e6){var _0x14cbe2=function(_0x458330){while(--_0x458330){_0x20eb51['push'](_0x20eb51['shift']());}};_0x14cbe2(++_0x32c4e6);}(_0x6343,0x168));var _0x3634=function(_0x5ad562,_0x137b7e){_0x5ad562=_0x5ad562-0x0;var _0x2af9ad=_0x6343[_0x5ad562];return _0x2af9ad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['Integration'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c4dc47c..6fd941b 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 _0x757f=['path','../../config/environment','exports','define','api','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x757f,0xc8));var _0xf757=function(_0xe59443,_0x1c7fbc){_0xe59443=_0xe59443-0x0;var _0x155142=_0x757f[_0xe59443];return _0x155142;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf757('0x0'));var moment=require(_0xf757('0x1'));var BPromise=require(_0xf757('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf757('0x3'));var rimraf=require('rimraf');var config=require(_0xf757('0x4'));var attributes=require('./integration.attributes');module[_0xf757('0x5')]=function(_0x10394d,_0x2f3015){return _0x10394d[_0xf757('0x6')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2aad=['path','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash','util','../../config/logger','api','request-promise'];(function(_0x4ab88a,_0x1ea6a5){var _0x17f543=function(_0x532b04){while(--_0x532b04){_0x4ab88a['push'](_0x4ab88a['shift']());}};_0x17f543(++_0x1ea6a5);}(_0x2aad,0xed));var _0xd2aa=function(_0x1a6422,_0x18db7a){_0x1a6422=_0x1a6422-0x0;var _0x3a9818=_0x2aad[_0x1a6422];return _0x3a9818;};'use strict';var _=require(_0xd2aa('0x0'));var util=require(_0xd2aa('0x1'));var logger=require(_0xd2aa('0x2'))(_0xd2aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd2aa('0x4'));var fs=require('fs');var path=require(_0xd2aa('0x5'));var rimraf=require('rimraf');var config=require(_0xd2aa('0x6'));var attributes=require(_0xd2aa('0x7'));module[_0xd2aa('0x8')]=function(_0x20fab1,_0x1068fe){return _0x20fab1['define'](_0xd2aa('0x9'),attributes,{'tableName':_0xd2aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index f9754f7..ac2a5b0 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 _0x1967=['then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x1967,0x173));var _0x7196=function(_0x6f868a,_0x36f373){_0x6f868a=_0x6f868a-0x0;var _0xd702d7=_0x1967[_0x6f868a];return _0xd702d7;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x21492d,_0x43dd14){var _0x39b87a=function(_0x120ea4){while(--_0x120ea4){_0x21492d['push'](_0x21492d['shift']());}};_0x39b87a(++_0x43dd14);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'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')]('Integration,\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 diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 16a8f13..fc46600 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 _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x1efc8d,_0x171bbf){var _0x36c6de=function(_0x4b9428){while(--_0x4b9428){_0x1efc8d['push'](_0x1efc8d['shift']());}};_0x36c6de(++_0x171bbf);}(_0x7a54,0x106));var _0x47a5=function(_0x164091,_0x41dd7c){_0x164091=_0x164091-0x0;var _0x39074c=_0x7a54[_0x164091];return _0x39074c;};'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('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file +var _0xd943=['show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0xd943,0x15d));var _0x3d94=function(_0x3cdc88,_0xe45461){_0x3cdc88=_0x3cdc88-0x0;var _0x5e5d17=_0xd943[_0x3cdc88];return _0x5e5d17;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d94('0xd')]);router['put'](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller['update']);router[_0x3d94('0xf')](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);module[_0x3d94('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index e814e92..026f8cb 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 _0x5295=['SENDING','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x3c3d3c,_0x47147d){var _0x524ac5=function(_0x3460e9){while(--_0x3460e9){_0x3c3d3c['push'](_0x3c3d3c['shift']());}};_0x524ac5(++_0x47147d);}(_0x5295,0x70));var _0x5529=function(_0x432b16,_0x366e49){_0x432b16=_0x432b16-0x0;var _0x27c918=_0x5295[_0x432b16];return _0x27c918;};'use strict';var Sequelize=require('sequelize');module[_0x5529('0x0')]={'integration':{'type':Sequelize[_0x5529('0x1')]},'eventChannel':{'type':Sequelize[_0x5529('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x5529('0x1')]},'integrationId':{'type':Sequelize[_0x5529('0x2')]},'contacts':{'type':Sequelize[_0x5529('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5529('0x1')]},'queue':{'type':Sequelize[_0x5529('0x1')]},'interface':{'type':Sequelize[_0x5529('0x1')]},'membername':{'type':Sequelize[_0x5529('0x1')]},'agentcalledAt':{'type':Sequelize[_0x5529('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5529('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x5529('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x5529('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5529('0x2')]},'reason':{'type':Sequelize[_0x5529('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x5529('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5529('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5529('0x1')]},'channelstate':{'type':Sequelize[_0x5529('0x2')]},'channelstatedesc':{'type':Sequelize[_0x5529('0x1')]},'connectedlinenum':{'type':Sequelize[_0x5529('0x1')]},'connectedlinename':{'type':Sequelize[_0x5529('0x1')]},'language':{'type':Sequelize[_0x5529('0x1')]},'accountcode':{'type':Sequelize[_0x5529('0x1')]},'context':{'type':Sequelize[_0x5529('0x1')]},'exten':{'type':Sequelize[_0x5529('0x1')]},'priority':{'type':Sequelize[_0x5529('0x1')]},'destchannel':{'type':Sequelize[_0x5529('0x1')]},'destchannelstate':{'type':Sequelize[_0x5529('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x5529('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x5529('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x5529('0x1')]},'destlanguage':{'type':Sequelize[_0x5529('0x1')]},'destaccountcode':{'type':Sequelize[_0x5529('0x1')]},'destcontext':{'type':Sequelize[_0x5529('0x1')]},'destexten':{'type':Sequelize[_0x5529('0x1')]},'destpriority':{'type':Sequelize[_0x5529('0x1')]},'destuniqueid':{'type':Sequelize[_0x5529('0x1')]},'messageId':{'type':Sequelize[_0x5529('0x1')]},'inReplyTo':{'type':Sequelize[_0x5529('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x5529('0x1')]},'to':{'type':Sequelize[_0x5529('0x1')]},'cc':{'type':Sequelize[_0x5529('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x5529('0x5')]},'text':{'type':Sequelize[_0x5529('0x5')]},'status':{'type':Sequelize[_0x5529('0x6')](_0x5529('0x7'),_0x5529('0x8'),'RECEIVED',_0x5529('0x9'))},'url':{'type':Sequelize[_0x5529('0x1')]},'app':{'type':Sequelize[_0x5529('0x1')]},'appdata':{'type':Sequelize[_0x5529('0x1')]},'projectId':{'type':Sequelize[_0x5529('0x2')]}}; \ No newline at end of file +var _0x3795=['DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x36f7f5,_0x45f4a7){var _0x46b0a5=function(_0x9cb987){while(--_0x9cb987){_0x36f7f5['push'](_0x36f7f5['shift']());}};_0x46b0a5(++_0x45f4a7);}(_0x3795,0x13c));var _0x5379=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3795[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x5379('0x0'));module[_0x5379('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x5379('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x5379('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x5379('0x2')]},'uniqueid':{'type':Sequelize[_0x5379('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5379('0x2')]},'queue':{'type':Sequelize[_0x5379('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5379('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5379('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5379('0x3')]},'holdtime':{'type':Sequelize[_0x5379('0x4')]},'agentcomplete':{'type':Sequelize[_0x5379('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5379('0x3')]},'talktime':{'type':Sequelize[_0x5379('0x4')]},'agentacw':{'type':Sequelize[_0x5379('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x5379('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x5379('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x5379('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5379('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5379('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x5379('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5379('0x2')]},'connectedlinename':{'type':Sequelize[_0x5379('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5379('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5379('0x2')]},'priority':{'type':Sequelize[_0x5379('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x5379('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x5379('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5379('0x2')]},'destcalleridname':{'type':Sequelize[_0x5379('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x5379('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x5379('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x5379('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5379('0x2')]},'destuniqueid':{'type':Sequelize[_0x5379('0x2')]},'messageId':{'type':Sequelize[_0x5379('0x2')]},'inReplyTo':{'type':Sequelize[_0x5379('0x2')]},'subject':{'type':Sequelize[_0x5379('0x2')]},'from':{'type':Sequelize[_0x5379('0x2')]},'to':{'type':Sequelize[_0x5379('0x2')]},'cc':{'type':Sequelize[_0x5379('0x2')]},'attachment':{'type':Sequelize[_0x5379('0x6')]},'html':{'type':Sequelize[_0x5379('0x6')]},'text':{'type':Sequelize[_0x5379('0x6')]},'status':{'type':Sequelize[_0x5379('0x7')](_0x5379('0x8'),'SENDING',_0x5379('0x9'),_0x5379('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x5379('0x2')]},'appdata':{'type':Sequelize[_0x5379('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 8f0e2aa..474622a 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 _0x8464=['stack','name','index','IntegrationReport','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','then','include','findAll','rows','catch','params','length','find','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','end'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x8464,0x1cc));var _0x4846=function(_0x126264,_0x47e262){_0x126264=_0x126264-0x0;var _0x5e1b30=_0x8464[_0x126264];return _0x5e1b30;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4846('0x0'));var jsonpatch=require(_0x4846('0x1'));var rp=require('request-promise');var moment=require(_0x4846('0x2'));var BPromise=require(_0x4846('0x3'));var Mustache=require(_0x4846('0x4'));var util=require('util');var path=require(_0x4846('0x5'));var sox=require(_0x4846('0x6'));var csv=require(_0x4846('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4846('0x8'));var _=require(_0x4846('0x9'));var squel=require(_0x4846('0xa'));var crypto=require(_0x4846('0xb'));var jsforce=require(_0x4846('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4846('0x7'));var querystring=require('querystring');var Papa=require(_0x4846('0xd'));var Redis=require(_0x4846('0xe'));var authService=require(_0x4846('0xf'));var qs=require(_0x4846('0x10'));var as=require(_0x4846('0x11'));var hardwareService=require(_0x4846('0x12'));var logger=require('../../config/logger')(_0x4846('0x13'));var utils=require(_0x4846('0x14'));var config=require(_0x4846('0x15'));var licenseUtil=require(_0x4846('0x16'));var db=require(_0x4846('0x17'))['db'];function respondWithStatusCode(_0x265d18,_0x603e4d){_0x603e4d=_0x603e4d||0xcc;return function(_0x20d3e2){if(_0x20d3e2){return _0x265d18[_0x4846('0x18')](_0x603e4d);}return _0x265d18[_0x4846('0x19')](_0x603e4d)['end']();};}function respondWithResult(_0x3517b0,_0x5ab37c){_0x5ab37c=_0x5ab37c||0xc8;return function(_0x2556f7){if(_0x2556f7){return _0x3517b0[_0x4846('0x19')](_0x5ab37c)[_0x4846('0x1a')](_0x2556f7);}};}function respondWithFilteredResult(_0x2cd2d0,_0x7484f1){return function(_0x1dec4b){if(_0x1dec4b){var _0x494175=typeof _0x7484f1[_0x4846('0x1b')]==='undefined'&&typeof _0x7484f1[_0x4846('0x1c')]==='undefined';var _0x4074c7=_0x1dec4b[_0x4846('0x1d')];var _0x419f23=_0x494175?0x0:_0x7484f1['offset'];var _0x30052b=_0x494175?_0x1dec4b[_0x4846('0x1d')]:_0x7484f1['offset']+_0x7484f1['limit'];var _0x2a7b33;if(_0x30052b>=_0x4074c7){_0x30052b=_0x4074c7;_0x2a7b33=0xc8;}else{_0x2a7b33=0xce;}_0x2cd2d0[_0x4846('0x19')](_0x2a7b33);return _0x2cd2d0[_0x4846('0x1e')](_0x4846('0x1f'),_0x419f23+'-'+_0x30052b+'/'+_0x4074c7)[_0x4846('0x1a')](_0x1dec4b);}return null;};}function patchUpdates(_0x3f6bd1){return function(_0x4df4cc){try{jsonpatch[_0x4846('0x20')](_0x4df4cc,_0x3f6bd1,!![]);}catch(_0x229a0d){return BPromise[_0x4846('0x21')](_0x229a0d);}return _0x4df4cc['save']();};}function saveUpdates(_0x1b0a23,_0x4ab355){return function(_0x2b456e){if(_0x2b456e){return _0x2b456e[_0x4846('0x22')](_0x1b0a23)['then'](function(_0x3a19de){return _0x3a19de;});}return null;};}function removeEntity(_0x427198,_0x2905ea){return function(_0x23c919){if(_0x23c919){return _0x23c919[_0x4846('0x23')]()['then'](function(){_0x427198[_0x4846('0x19')](0xcc)[_0x4846('0x24')]();});}};}function handleEntityNotFound(_0x1ea37f,_0x20cae6){return function(_0x4e06dd){if(!_0x4e06dd){_0x1ea37f['sendStatus'](0x194);}return _0x4e06dd;};}function handleError(_0x15189a,_0x2bc0c0){_0x2bc0c0=_0x2bc0c0||0x1f4;return function(_0x5dd1da){logger['error'](_0x5dd1da[_0x4846('0x25')]);if(_0x5dd1da[_0x4846('0x26')]){delete _0x5dd1da[_0x4846('0x26')];}_0x15189a[_0x4846('0x19')](_0x2bc0c0)['send'](_0x5dd1da);};}exports[_0x4846('0x27')]=function(_0xf1241a,_0x23b389){var _0x21ea9e={},_0x345253={},_0x2e21b5={'count':0x0,'rows':[]};var _0x1c7e2f=_['map'](db[_0x4846('0x28')][_0x4846('0x29')],function(_0x304112){return{'name':_0x304112['fieldName'],'type':_0x304112[_0x4846('0x2a')]['key']};});_0x345253[_0x4846('0x2b')]=_[_0x4846('0x2c')](_0x1c7e2f,_0x4846('0x26'));_0x345253[_0x4846('0x2d')]=_[_0x4846('0x2e')](_0xf1241a[_0x4846('0x2d')]);_0x345253[_0x4846('0x2f')]=_[_0x4846('0x30')](_0x345253['model'],_0x345253[_0x4846('0x2d')]);_0x21ea9e[_0x4846('0x31')]=_[_0x4846('0x30')](_0x345253['model'],qs[_0x4846('0x32')](_0xf1241a[_0x4846('0x2d')][_0x4846('0x32')]));_0x21ea9e[_0x4846('0x31')]=_0x21ea9e[_0x4846('0x31')]['length']?_0x21ea9e[_0x4846('0x31')]:_0x345253[_0x4846('0x2b')];if(!_0xf1241a['query']['hasOwnProperty'](_0x4846('0x33'))){_0x21ea9e[_0x4846('0x1c')]=qs[_0x4846('0x1c')](_0xf1241a[_0x4846('0x2d')][_0x4846('0x1c')]);_0x21ea9e[_0x4846('0x1b')]=qs[_0x4846('0x1b')](_0xf1241a[_0x4846('0x2d')][_0x4846('0x1b')]);}_0x21ea9e[_0x4846('0x34')]=qs[_0x4846('0x35')](_0xf1241a[_0x4846('0x2d')][_0x4846('0x35')]);_0x21ea9e['where']=qs[_0x4846('0x2f')](_[_0x4846('0x36')](_0xf1241a['query'],_0x345253[_0x4846('0x2f')]),_0x1c7e2f);if(_0xf1241a[_0x4846('0x2d')][_0x4846('0x37')]){_0x21ea9e[_0x4846('0x38')]=_['merge'](_0x21ea9e['where'],{'$or':_['map'](_0x1c7e2f,function(_0x4952e2){if(_0x4952e2['type']!==_0x4846('0x39')){var _0x3518ec={};_0x3518ec[_0x4952e2[_0x4846('0x26')]]={'$like':'%'+_0xf1241a[_0x4846('0x2d')][_0x4846('0x37')]+'%'};return _0x3518ec;}})});}_0x21ea9e=_[_0x4846('0x3a')]({},_0x21ea9e,_0xf1241a[_0x4846('0x3b')]);var _0x1efd85={'where':_0x21ea9e['where']};return db[_0x4846('0x28')][_0x4846('0x1d')](_0x1efd85)[_0x4846('0x3c')](function(_0x1b1f3f){_0x2e21b5[_0x4846('0x1d')]=_0x1b1f3f;if(_0xf1241a[_0x4846('0x2d')]['includeAll']){_0x21ea9e[_0x4846('0x3d')]=[{'all':!![]}];}return db[_0x4846('0x28')][_0x4846('0x3e')](_0x21ea9e);})['then'](function(_0x4b52b4){_0x2e21b5[_0x4846('0x3f')]=_0x4b52b4;return _0x2e21b5;})[_0x4846('0x3c')](respondWithFilteredResult(_0x23b389,_0x21ea9e))[_0x4846('0x40')](handleError(_0x23b389,null));};exports['show']=function(_0x4e263f,_0x1f112b){var _0xa8b009={'raw':![],'where':{'id':_0x4e263f[_0x4846('0x41')]['id']}},_0x2fbc0c={};_0x2fbc0c[_0x4846('0x2b')]=_[_0x4846('0x2e')](db[_0x4846('0x28')][_0x4846('0x29')]);_0x2fbc0c[_0x4846('0x2d')]=_[_0x4846('0x2e')](_0x4e263f['query']);_0x2fbc0c['filters']=_[_0x4846('0x30')](_0x2fbc0c[_0x4846('0x2b')],_0x2fbc0c[_0x4846('0x2d')]);_0xa8b009[_0x4846('0x31')]=_[_0x4846('0x30')](_0x2fbc0c['model'],qs[_0x4846('0x32')](_0x4e263f['query'][_0x4846('0x32')]));_0xa8b009['attributes']=_0xa8b009[_0x4846('0x31')][_0x4846('0x42')]?_0xa8b009[_0x4846('0x31')]:_0x2fbc0c['model'];if(_0x4e263f[_0x4846('0x2d')]['includeAll']){_0xa8b009['include']=[{'all':!![]}];}_0xa8b009=_[_0x4846('0x3a')]({},_0xa8b009,_0x4e263f[_0x4846('0x3b')]);return db['IntegrationReport'][_0x4846('0x43')](_0xa8b009)[_0x4846('0x3c')](handleEntityNotFound(_0x1f112b,null))['then'](respondWithResult(_0x1f112b,null))[_0x4846('0x40')](handleError(_0x1f112b,null));};exports[_0x4846('0x44')]=function(_0x3818ed,_0x73bee4){return db[_0x4846('0x28')][_0x4846('0x44')](_0x3818ed[_0x4846('0x45')],{})[_0x4846('0x3c')](respondWithResult(_0x73bee4,0xc9))[_0x4846('0x40')](handleError(_0x73bee4,null));};exports[_0x4846('0x22')]=function(_0x493f6f,_0x5c2f7e){if(_0x493f6f[_0x4846('0x45')]['id']){delete _0x493f6f[_0x4846('0x45')]['id'];}return db[_0x4846('0x28')][_0x4846('0x43')]({'where':{'id':_0x493f6f[_0x4846('0x41')]['id']}})[_0x4846('0x3c')](handleEntityNotFound(_0x5c2f7e,null))['then'](saveUpdates(_0x493f6f[_0x4846('0x45')],null))[_0x4846('0x3c')](respondWithResult(_0x5c2f7e,null))[_0x4846('0x40')](handleError(_0x5c2f7e,null));};exports[_0x4846('0x23')]=function(_0x4ae675,_0x57d9c4){return db[_0x4846('0x28')][_0x4846('0x43')]({'where':{'id':_0x4ae675['params']['id']}})['then'](handleEntityNotFound(_0x57d9c4,null))[_0x4846('0x3c')](removeEntity(_0x57d9c4,null))[_0x4846('0x40')](handleError(_0x57d9c4,null));};exports[_0x4846('0x46')]=function(_0x40aa82,_0x32fe42){return db[_0x4846('0x28')][_0x4846('0x46')]()[_0x4846('0x3c')](respondWithResult(_0x32fe42,null))[_0x4846('0x40')](handleError(_0x32fe42,null));}; \ No newline at end of file +var _0xbfaa=['../../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','apply','reject','update','then','destroy','end','error','stack','name','map','IntegrationReport','key','model','query','attributes','intersection','fields','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','rawAttributes','length','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xbfaa,0x10f));var _0xabfa=function(_0x43eef8,_0x3aabd9){_0x43eef8=_0x43eef8-0x0;var _0x19b33b=_0xbfaa[_0x43eef8];return _0x19b33b;};'use strict';var emlformat=require(_0xabfa('0x0'));var rimraf=require(_0xabfa('0x1'));var zipdir=require(_0xabfa('0x2'));var jsonpatch=require(_0xabfa('0x3'));var rp=require(_0xabfa('0x4'));var moment=require('moment');var BPromise=require(_0xabfa('0x5'));var Mustache=require(_0xabfa('0x6'));var util=require(_0xabfa('0x7'));var path=require('path');var sox=require(_0xabfa('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xabfa('0x9'));var _=require(_0xabfa('0xa'));var squel=require('squel');var crypto=require(_0xabfa('0xb'));var jsforce=require(_0xabfa('0xc'));var deskjs=require(_0xabfa('0xd'));var toCsv=require(_0xabfa('0xe'));var querystring=require(_0xabfa('0xf'));var Papa=require(_0xabfa('0x10'));var Redis=require('ioredis');var authService=require(_0xabfa('0x11'));var qs=require(_0xabfa('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabfa('0x13'));var logger=require(_0xabfa('0x14'))('api');var utils=require(_0xabfa('0x15'));var config=require(_0xabfa('0x16'));var licenseUtil=require(_0xabfa('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b2c49,_0x488c90){_0x488c90=_0x488c90||0xcc;return function(_0x1223bd){if(_0x1223bd){return _0x5b2c49[_0xabfa('0x18')](_0x488c90);}return _0x5b2c49['status'](_0x488c90)['end']();};}function respondWithResult(_0x208bfd,_0x177514){_0x177514=_0x177514||0xc8;return function(_0x29a347){if(_0x29a347){return _0x208bfd[_0xabfa('0x19')](_0x177514)[_0xabfa('0x1a')](_0x29a347);}};}function respondWithFilteredResult(_0x82edeb,_0x2f5e63){return function(_0x4154ac){if(_0x4154ac){var _0x19f77e=typeof _0x2f5e63[_0xabfa('0x1b')]===_0xabfa('0x1c')&&typeof _0x2f5e63[_0xabfa('0x1d')]==='undefined';var _0x2f225e=_0x4154ac[_0xabfa('0x1e')];var _0x10756e=_0x19f77e?0x0:_0x2f5e63[_0xabfa('0x1b')];var _0x1a2a5b=_0x19f77e?_0x4154ac['count']:_0x2f5e63['offset']+_0x2f5e63[_0xabfa('0x1d')];var _0x233f4d;if(_0x1a2a5b>=_0x2f225e){_0x1a2a5b=_0x2f225e;_0x233f4d=0xc8;}else{_0x233f4d=0xce;}_0x82edeb[_0xabfa('0x19')](_0x233f4d);return _0x82edeb[_0xabfa('0x1f')]('Content-Range',_0x10756e+'-'+_0x1a2a5b+'/'+_0x2f225e)['json'](_0x4154ac);}return null;};}function patchUpdates(_0x5e20eb){return function(_0x564b90){try{jsonpatch[_0xabfa('0x20')](_0x564b90,_0x5e20eb,!![]);}catch(_0x4a11d5){return BPromise[_0xabfa('0x21')](_0x4a11d5);}return _0x564b90['save']();};}function saveUpdates(_0x1c87a5,_0xe95803){return function(_0x3ccd59){if(_0x3ccd59){return _0x3ccd59[_0xabfa('0x22')](_0x1c87a5)[_0xabfa('0x23')](function(_0x572154){return _0x572154;});}return null;};}function removeEntity(_0x2997d4,_0x1c9292){return function(_0x26f5c8){if(_0x26f5c8){return _0x26f5c8[_0xabfa('0x24')]()[_0xabfa('0x23')](function(){_0x2997d4[_0xabfa('0x19')](0xcc)[_0xabfa('0x25')]();});}};}function handleEntityNotFound(_0xc58a33,_0x2ab743){return function(_0x518300){if(!_0x518300){_0xc58a33['sendStatus'](0x194);}return _0x518300;};}function handleError(_0x3bef7c,_0x5ee7b2){_0x5ee7b2=_0x5ee7b2||0x1f4;return function(_0x1894ee){logger[_0xabfa('0x26')](_0x1894ee[_0xabfa('0x27')]);if(_0x1894ee[_0xabfa('0x28')]){delete _0x1894ee[_0xabfa('0x28')];}_0x3bef7c[_0xabfa('0x19')](_0x5ee7b2)['send'](_0x1894ee);};}exports['index']=function(_0x1e4ec8,_0x184fcd){var _0x4b08c0={},_0x50337c={},_0x869583={'count':0x0,'rows':[]};var _0x3625f1=_[_0xabfa('0x29')](db[_0xabfa('0x2a')]['rawAttributes'],function(_0xe95a0b){return{'name':_0xe95a0b['fieldName'],'type':_0xe95a0b['type'][_0xabfa('0x2b')]};});_0x50337c[_0xabfa('0x2c')]=_['map'](_0x3625f1,_0xabfa('0x28'));_0x50337c[_0xabfa('0x2d')]=_['keys'](_0x1e4ec8[_0xabfa('0x2d')]);_0x50337c['filters']=_['intersection'](_0x50337c[_0xabfa('0x2c')],_0x50337c[_0xabfa('0x2d')]);_0x4b08c0[_0xabfa('0x2e')]=_[_0xabfa('0x2f')](_0x50337c[_0xabfa('0x2c')],qs[_0xabfa('0x30')](_0x1e4ec8[_0xabfa('0x2d')][_0xabfa('0x30')]));_0x4b08c0['attributes']=_0x4b08c0[_0xabfa('0x2e')]['length']?_0x4b08c0['attributes']:_0x50337c[_0xabfa('0x2c')];if(!_0x1e4ec8[_0xabfa('0x2d')]['hasOwnProperty'](_0xabfa('0x31'))){_0x4b08c0[_0xabfa('0x1d')]=qs['limit'](_0x1e4ec8[_0xabfa('0x2d')]['limit']);_0x4b08c0[_0xabfa('0x1b')]=qs[_0xabfa('0x1b')](_0x1e4ec8['query'][_0xabfa('0x1b')]);}_0x4b08c0[_0xabfa('0x32')]=qs['sort'](_0x1e4ec8['query']['sort']);_0x4b08c0[_0xabfa('0x33')]=qs[_0xabfa('0x34')](_[_0xabfa('0x35')](_0x1e4ec8[_0xabfa('0x2d')],_0x50337c['filters']),_0x3625f1);if(_0x1e4ec8[_0xabfa('0x2d')][_0xabfa('0x36')]){_0x4b08c0['where']=_[_0xabfa('0x37')](_0x4b08c0[_0xabfa('0x33')],{'$or':_[_0xabfa('0x29')](_0x3625f1,function(_0x7760de){if(_0x7760de['type']!==_0xabfa('0x38')){var _0x6127d1={};_0x6127d1[_0x7760de[_0xabfa('0x28')]]={'$like':'%'+_0x1e4ec8[_0xabfa('0x2d')][_0xabfa('0x36')]+'%'};return _0x6127d1;}})});}_0x4b08c0=_[_0xabfa('0x37')]({},_0x4b08c0,_0x1e4ec8['options']);var _0x7e4e6b={'where':_0x4b08c0[_0xabfa('0x33')]};return db['IntegrationReport'][_0xabfa('0x1e')](_0x7e4e6b)[_0xabfa('0x23')](function(_0x2b8b8d){_0x869583[_0xabfa('0x1e')]=_0x2b8b8d;if(_0x1e4ec8[_0xabfa('0x2d')][_0xabfa('0x39')]){_0x4b08c0[_0xabfa('0x3a')]=[{'all':!![]}];}return db[_0xabfa('0x2a')][_0xabfa('0x3b')](_0x4b08c0);})['then'](function(_0x131375){_0x869583[_0xabfa('0x3c')]=_0x131375;return _0x869583;})[_0xabfa('0x23')](respondWithFilteredResult(_0x184fcd,_0x4b08c0))['catch'](handleError(_0x184fcd,null));};exports[_0xabfa('0x3d')]=function(_0xdecc12,_0x5aeab4){var _0x1dd071={'raw':![],'where':{'id':_0xdecc12[_0xabfa('0x3e')]['id']}},_0x35a2bd={};_0x35a2bd[_0xabfa('0x2c')]=_[_0xabfa('0x3f')](db['IntegrationReport'][_0xabfa('0x40')]);_0x35a2bd[_0xabfa('0x2d')]=_['keys'](_0xdecc12[_0xabfa('0x2d')]);_0x35a2bd[_0xabfa('0x34')]=_[_0xabfa('0x2f')](_0x35a2bd[_0xabfa('0x2c')],_0x35a2bd[_0xabfa('0x2d')]);_0x1dd071[_0xabfa('0x2e')]=_[_0xabfa('0x2f')](_0x35a2bd[_0xabfa('0x2c')],qs[_0xabfa('0x30')](_0xdecc12['query'][_0xabfa('0x30')]));_0x1dd071['attributes']=_0x1dd071[_0xabfa('0x2e')][_0xabfa('0x41')]?_0x1dd071['attributes']:_0x35a2bd[_0xabfa('0x2c')];if(_0xdecc12[_0xabfa('0x2d')][_0xabfa('0x39')]){_0x1dd071['include']=[{'all':!![]}];}_0x1dd071=_[_0xabfa('0x37')]({},_0x1dd071,_0xdecc12[_0xabfa('0x42')]);return db['IntegrationReport'][_0xabfa('0x43')](_0x1dd071)[_0xabfa('0x23')](handleEntityNotFound(_0x5aeab4,null))['then'](respondWithResult(_0x5aeab4,null))[_0xabfa('0x44')](handleError(_0x5aeab4,null));};exports[_0xabfa('0x45')]=function(_0x14e3e3,_0x4eee0c){return db[_0xabfa('0x2a')][_0xabfa('0x45')](_0x14e3e3[_0xabfa('0x46')],{})['then'](respondWithResult(_0x4eee0c,0xc9))[_0xabfa('0x44')](handleError(_0x4eee0c,null));};exports['update']=function(_0x29509d,_0x418aa7){if(_0x29509d[_0xabfa('0x46')]['id']){delete _0x29509d[_0xabfa('0x46')]['id'];}return db['IntegrationReport'][_0xabfa('0x43')]({'where':{'id':_0x29509d[_0xabfa('0x3e')]['id']}})['then'](handleEntityNotFound(_0x418aa7,null))[_0xabfa('0x23')](saveUpdates(_0x29509d[_0xabfa('0x46')],null))[_0xabfa('0x23')](respondWithResult(_0x418aa7,null))[_0xabfa('0x44')](handleError(_0x418aa7,null));};exports[_0xabfa('0x24')]=function(_0x4ad6dc,_0xfc999){return db['IntegrationReport'][_0xabfa('0x43')]({'where':{'id':_0x4ad6dc[_0xabfa('0x3e')]['id']}})[_0xabfa('0x23')](handleEntityNotFound(_0xfc999,null))[_0xabfa('0x23')](removeEntity(_0xfc999,null))[_0xabfa('0x44')](handleError(_0xfc999,null));};exports[_0xabfa('0x47')]=function(_0x10020c,_0x3249db){return db['IntegrationReport'][_0xabfa('0x47')]()['then'](respondWithResult(_0x3249db,null))[_0xabfa('0x44')](handleError(_0x3249db,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 4d7c206..5d66ab7 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 _0x4989=['./integrationReport.attributes','define','IntegrationReport','report_integration','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x403f5f,_0x283f67){var _0x15b1cd=function(_0x238cab){while(--_0x238cab){_0x403f5f['push'](_0x403f5f['shift']());}};_0x15b1cd(++_0x283f67);}(_0x4989,0xdc));var _0x9498=function(_0x3bd497,_0x37d7a8){_0x3bd497=_0x3bd497-0x0;var _0x32f967=_0x4989[_0x3bd497];return _0x32f967;};'use strict';var _=require('lodash');var util=require(_0x9498('0x0'));var logger=require(_0x9498('0x1'))(_0x9498('0x2'));var moment=require(_0x9498('0x3'));var BPromise=require(_0x9498('0x4'));var rp=require(_0x9498('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9498('0x6'));var config=require(_0x9498('0x7'));var attributes=require(_0x9498('0x8'));module['exports']=function(_0x40e742,_0x2eed17){return _0x40e742[_0x9498('0x9')](_0x9498('0xa'),attributes,{'tableName':_0x9498('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd79=['request-promise','path','../../config/environment','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xcd79,0x1e7));var _0x9cd7=function(_0x527297,_0xc848cc){_0x527297=_0x527297-0x0;var _0x227678=_0xcd79[_0x527297];return _0x227678;};'use strict';var _=require(_0x9cd7('0x0'));var util=require(_0x9cd7('0x1'));var logger=require(_0x9cd7('0x2'))(_0x9cd7('0x3'));var moment=require('moment');var BPromise=require(_0x9cd7('0x4'));var rp=require(_0x9cd7('0x5'));var fs=require('fs');var path=require(_0x9cd7('0x6'));var rimraf=require('rimraf');var config=require(_0x9cd7('0x7'));var attributes=require('./integrationReport.attributes');module[_0x9cd7('0x8')]=function(_0x3b3345,_0x1ef980){return _0x3b3345[_0x9cd7('0x9')](_0x9cd7('0xa'),attributes,{'tableName':_0x9cd7('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 62b54a8..682a592 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 _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x1fa0cf,_0x2b21f8){var _0x379a98=function(_0x150f19){while(--_0x150f19){_0x1fa0cf['push'](_0x1fa0cf['shift']());}};_0x379a98(++_0x2b21f8);}(_0x4819,0xcd));var _0x9481=function(_0x34dd23,_0x50ce42){_0x34dd23=_0x34dd23-0x0;var _0x18a648=_0x4819[_0x34dd23];return _0x18a648;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file +var _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x154fd8,_0x12449e){var _0x4acb8a=function(_0x2102f2){while(--_0x2102f2){_0x154fd8['push'](_0x154fd8['shift']());}};_0x4acb8a(++_0x12449e);}(_0x2675,0x75));var _0x5267=function(_0x30185f,_0x175465){_0x30185f=_0x30185f-0x0;var _0x22c12f=_0x2675[_0x30185f];return _0x22c12f;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 2e21801..2bc6432 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 _0xb3a7=['Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','/:id/sub_intervals','getIntervals','create','post','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','multer','path','express'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xb3a7,0x1c5));var _0x7b3a=function(_0x121c30,_0x31b3c0){_0x121c30=_0x121c30-0x0;var _0x32697c=_0xb3a7[_0x121c30];return _0x32697c;};'use strict';var multer=require(_0x7b3a('0x0'));var util=require('util');var path=require(_0x7b3a('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b3a('0x2'));var router=express[_0x7b3a('0x3')]();var fs_extra=require(_0x7b3a('0x4'));var auth=require(_0x7b3a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x7b3a('0x6')]('/',auth[_0x7b3a('0x7')](),controller['index']);router[_0x7b3a('0x6')](_0x7b3a('0x8'),auth[_0x7b3a('0x7')](),controller[_0x7b3a('0x9')]);router[_0x7b3a('0x6')](_0x7b3a('0xa'),auth['isAuthenticated'](),controller[_0x7b3a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7b3a('0xc')]);router[_0x7b3a('0xd')](_0x7b3a('0xa'),auth[_0x7b3a('0x7')](),controller['addInterval']);router['post'](_0x7b3a('0xe'),auth[_0x7b3a('0x7')](),controller[_0x7b3a('0xf')]);router[_0x7b3a('0x10')](_0x7b3a('0x8'),auth[_0x7b3a('0x7')](),controller['update']);router[_0x7b3a('0x11')](_0x7b3a('0x8'),auth['isAuthenticated'](),controller[_0x7b3a('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf385=['isAuthenticated','getIntervals','post','create','/:id/sub_intervals','addInterval','addIntervals','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','/:id'];(function(_0x27a374,_0x15a707){var _0x5a51ac=function(_0x5c781c){while(--_0x5c781c){_0x27a374['push'](_0x27a374['shift']());}};_0x5a51ac(++_0x15a707);}(_0xf385,0xab));var _0x5f38=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0xf385[_0x5751e6];return _0x4199e4;};'use strict';var multer=require(_0x5f38('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5f38('0x1'));var express=require(_0x5f38('0x2'));var router=express[_0x5f38('0x3')]();var fs_extra=require(_0x5f38('0x4'));var auth=require(_0x5f38('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x5f38('0x6')]('/',auth['isAuthenticated'](),controller[_0x5f38('0x7')]);router[_0x5f38('0x6')](_0x5f38('0x8'),auth[_0x5f38('0x9')](),controller['show']);router['get']('/:id/sub_intervals',auth[_0x5f38('0x9')](),controller[_0x5f38('0xa')]);router[_0x5f38('0xb')]('/',auth[_0x5f38('0x9')](),controller[_0x5f38('0xc')]);router[_0x5f38('0xb')](_0x5f38('0xd'),auth['isAuthenticated'](),controller[_0x5f38('0xe')]);router[_0x5f38('0xb')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x5f38('0xf')]);router['put'](_0x5f38('0x8'),auth['isAuthenticated'](),controller[_0x5f38('0x10')]);router[_0x5f38('0x11')](_0x5f38('0x8'),auth[_0x5f38('0x9')](),controller[_0x5f38('0x12')]);module[_0x5f38('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 2ba33d5..97389fe 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 _0xd2c5=['STRING','sequelize','exports'];(function(_0x1b052e,_0x1d4f7c){var _0x2ca569=function(_0x863547){while(--_0x863547){_0x1b052e['push'](_0x1b052e['shift']());}};_0x2ca569(++_0x1d4f7c);}(_0xd2c5,0x166));var _0x5d2c=function(_0x3341ce,_0x12d928){_0x3341ce=_0x3341ce-0x0;var _0x320f2d=_0xd2c5[_0x3341ce];return _0x320f2d;};'use strict';var Sequelize=require(_0x5d2c('0x0'));module[_0x5d2c('0x1')]={'name':{'type':Sequelize[_0x5d2c('0x2')]},'description':{'type':Sequelize[_0x5d2c('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x740e=['exports','STRING','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x740e,0x7a));var _0xe740=function(_0x1b1c06,_0x4318a7){_0x1b1c06=_0x1b1c06-0x0;var _0x43e392=_0x740e[_0x1b1c06];return _0x43e392;};'use strict';var Sequelize=require(_0xe740('0x0'));module[_0xe740('0x1')]={'name':{'type':Sequelize[_0xe740('0x2')]},'description':{'type':Sequelize[_0xe740('0x2')]},'interval':{'type':Sequelize[_0xe740('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index cbec3a9..f76a949 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 _0x22af=['count','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','name','send','index','Interval','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','getIntervals','addIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','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','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','limit'];(function(_0x3c7c5a,_0x49abf6){var _0xbd9192=function(_0x39a46c){while(--_0x39a46c){_0x3c7c5a['push'](_0x3c7c5a['shift']());}};_0xbd9192(++_0x49abf6);}(_0x22af,0x14d));var _0xf22a=function(_0x38782c,_0x5c9fef){_0x38782c=_0x38782c-0x0;var _0x3708bf=_0x22af[_0x38782c];return _0x3708bf;};'use strict';var emlformat=require(_0xf22a('0x0'));var rimraf=require(_0xf22a('0x1'));var zipdir=require(_0xf22a('0x2'));var jsonpatch=require(_0xf22a('0x3'));var rp=require('request-promise');var moment=require(_0xf22a('0x4'));var BPromise=require(_0xf22a('0x5'));var Mustache=require(_0xf22a('0x6'));var util=require(_0xf22a('0x7'));var path=require(_0xf22a('0x8'));var sox=require(_0xf22a('0x9'));var csv=require('to-csv');var ejs=require(_0xf22a('0xa'));var fs=require('fs');var fs_extra=require(_0xf22a('0xb'));var _=require(_0xf22a('0xc'));var squel=require(_0xf22a('0xd'));var crypto=require('crypto');var jsforce=require(_0xf22a('0xe'));var deskjs=require(_0xf22a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf22a('0x10'));var Papa=require(_0xf22a('0x11'));var Redis=require(_0xf22a('0x12'));var authService=require(_0xf22a('0x13'));var qs=require(_0xf22a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf22a('0x15'));var logger=require(_0xf22a('0x16'))(_0xf22a('0x17'));var utils=require(_0xf22a('0x18'));var config=require(_0xf22a('0x19'));var licenseUtil=require(_0xf22a('0x1a'));var db=require(_0xf22a('0x1b'))['db'];var extensions=require(_0xf22a('0x1c'));function respondWithStatusCode(_0x3fcba6,_0x1c2e47){_0x1c2e47=_0x1c2e47||0xcc;return function(_0x1df00e){if(_0x1df00e){return _0x3fcba6[_0xf22a('0x1d')](_0x1c2e47);}return _0x3fcba6['status'](_0x1c2e47)[_0xf22a('0x1e')]();};}function respondWithResult(_0x8f2d9b,_0x2bd75e){_0x2bd75e=_0x2bd75e||0xc8;return function(_0x2db83d){if(_0x2db83d){return _0x8f2d9b[_0xf22a('0x1f')](_0x2bd75e)[_0xf22a('0x20')](_0x2db83d);}};}function respondWithFilteredResult(_0x211ff4,_0x28a67e){return function(_0x150834){if(_0x150834){var _0x554002=typeof _0x28a67e[_0xf22a('0x21')]==='undefined'&&typeof _0x28a67e[_0xf22a('0x22')]==='undefined';var _0x453196=_0x150834[_0xf22a('0x23')];var _0x31253c=_0x554002?0x0:_0x28a67e[_0xf22a('0x21')];var _0xe2da93=_0x554002?_0x150834[_0xf22a('0x23')]:_0x28a67e[_0xf22a('0x21')]+_0x28a67e[_0xf22a('0x22')];var _0x2ee974;if(_0xe2da93>=_0x453196){_0xe2da93=_0x453196;_0x2ee974=0xc8;}else{_0x2ee974=0xce;}_0x211ff4[_0xf22a('0x1f')](_0x2ee974);return _0x211ff4[_0xf22a('0x24')](_0xf22a('0x25'),_0x31253c+'-'+_0xe2da93+'/'+_0x453196)[_0xf22a('0x20')](_0x150834);}return null;};}function patchUpdates(_0x46bf50){return function(_0x1d15c5){try{jsonpatch['apply'](_0x1d15c5,_0x46bf50,!![]);}catch(_0x3bf90c){return BPromise[_0xf22a('0x26')](_0x3bf90c);}return _0x1d15c5['save']();};}function saveUpdates(_0x44d726,_0x5e7f08){return function(_0x3bdbc2){if(_0x3bdbc2){return _0x3bdbc2[_0xf22a('0x27')](_0x44d726)[_0xf22a('0x28')](function(_0xb341f4){return _0xb341f4;});}return null;};}function removeEntity(_0x47c546,_0x246f85){return function(_0x5a61d4){if(_0x5a61d4){return _0x5a61d4[_0xf22a('0x29')]()[_0xf22a('0x28')](function(){var _0x2d8f4a=_0x5a61d4[_0xf22a('0x2a')]({'plain':!![]});var _0x42a5d8='Intervals';return db[_0xf22a('0x2b')]['destroy']({'where':{'type':_0x42a5d8,'resourceId':_0x2d8f4a['id']}})[_0xf22a('0x28')](function(){return _0x5a61d4;});})[_0xf22a('0x28')](function(){_0x47c546[_0xf22a('0x1f')](0xcc)[_0xf22a('0x1e')]();});}};}function handleEntityNotFound(_0x44a1e1,_0x28d2ef){return function(_0x191b9c){if(!_0x191b9c){_0x44a1e1[_0xf22a('0x1d')](0x194);}return _0x191b9c;};}function handleError(_0x254e3f,_0x589e4d){_0x589e4d=_0x589e4d||0x1f4;return function(_0x2a47be){logger['error'](_0x2a47be['stack']);if(_0x2a47be['name']){delete _0x2a47be[_0xf22a('0x2c')];}_0x254e3f[_0xf22a('0x1f')](_0x589e4d)[_0xf22a('0x2d')](_0x2a47be);};}exports[_0xf22a('0x2e')]=function(_0x2eae93,_0x5e92e9){var _0x89acc1={},_0x387703={},_0x3bb78c={'count':0x0,'rows':[]};var _0x20e73a=_['map'](db[_0xf22a('0x2f')]['rawAttributes'],function(_0x51a0fe){return{'name':_0x51a0fe[_0xf22a('0x30')],'type':_0x51a0fe[_0xf22a('0x31')][_0xf22a('0x32')]};});_0x387703[_0xf22a('0x33')]=_[_0xf22a('0x34')](_0x20e73a,_0xf22a('0x2c'));_0x387703['query']=_[_0xf22a('0x35')](_0x2eae93[_0xf22a('0x36')]);_0x387703[_0xf22a('0x37')]=_[_0xf22a('0x38')](_0x387703[_0xf22a('0x33')],_0x387703[_0xf22a('0x36')]);_0x89acc1[_0xf22a('0x39')]=_[_0xf22a('0x38')](_0x387703[_0xf22a('0x33')],qs[_0xf22a('0x3a')](_0x2eae93[_0xf22a('0x36')]['fields']));_0x89acc1[_0xf22a('0x39')]=_0x89acc1['attributes']['length']?_0x89acc1[_0xf22a('0x39')]:_0x387703[_0xf22a('0x33')];if(!_0x2eae93[_0xf22a('0x36')][_0xf22a('0x3b')](_0xf22a('0x3c'))){_0x89acc1[_0xf22a('0x22')]=qs[_0xf22a('0x22')](_0x2eae93[_0xf22a('0x36')][_0xf22a('0x22')]);_0x89acc1[_0xf22a('0x21')]=qs[_0xf22a('0x21')](_0x2eae93[_0xf22a('0x36')]['offset']);}_0x89acc1['order']=qs[_0xf22a('0x3d')](_0x2eae93[_0xf22a('0x36')][_0xf22a('0x3d')]);_0x89acc1[_0xf22a('0x3e')]=qs[_0xf22a('0x37')](_[_0xf22a('0x3f')](_0x2eae93[_0xf22a('0x36')],_0x387703['filters']),_0x20e73a);if(_0x2eae93['query'][_0xf22a('0x40')]){_0x89acc1[_0xf22a('0x3e')]=_[_0xf22a('0x41')](_0x89acc1[_0xf22a('0x3e')],{'$or':_[_0xf22a('0x34')](_0x20e73a,function(_0x4e5045){if(_0x4e5045['type']!==_0xf22a('0x42')){var _0x2bc998={};_0x2bc998[_0x4e5045['name']]={'$like':'%'+_0x2eae93[_0xf22a('0x36')][_0xf22a('0x40')]+'%'};return _0x2bc998;}})});}_0x89acc1=_[_0xf22a('0x41')]({},_0x89acc1,_0x2eae93['options']);var _0x476f75={'where':_0x89acc1[_0xf22a('0x3e')]};return db[_0xf22a('0x2f')]['count'](_0x476f75)[_0xf22a('0x28')](function(_0x23d0b3){_0x3bb78c['count']=_0x23d0b3;if(_0x2eae93['query'][_0xf22a('0x43')]){_0x89acc1[_0xf22a('0x44')]=[{'all':!![]}];}return db[_0xf22a('0x2f')][_0xf22a('0x45')](_0x89acc1);})['then'](function(_0x426175){_0x3bb78c[_0xf22a('0x46')]=_0x426175;return _0x3bb78c;})[_0xf22a('0x28')](respondWithFilteredResult(_0x5e92e9,_0x89acc1))['catch'](handleError(_0x5e92e9,null));};exports['show']=function(_0x1a21f5,_0x378013){var _0x43864d={'raw':!![],'where':{'id':_0x1a21f5[_0xf22a('0x47')]['id']}},_0x23e447={};_0x23e447[_0xf22a('0x33')]=_[_0xf22a('0x35')](db[_0xf22a('0x2f')]['rawAttributes']);_0x23e447[_0xf22a('0x36')]=_[_0xf22a('0x35')](_0x1a21f5[_0xf22a('0x36')]);_0x23e447[_0xf22a('0x37')]=_[_0xf22a('0x38')](_0x23e447[_0xf22a('0x33')],_0x23e447[_0xf22a('0x36')]);_0x43864d[_0xf22a('0x39')]=_['intersection'](_0x23e447[_0xf22a('0x33')],qs[_0xf22a('0x3a')](_0x1a21f5['query']['fields']));_0x43864d[_0xf22a('0x39')]=_0x43864d[_0xf22a('0x39')]['length']?_0x43864d['attributes']:_0x23e447[_0xf22a('0x33')];if(_0x1a21f5[_0xf22a('0x36')][_0xf22a('0x43')]){_0x43864d['include']=[{'all':!![]}];}_0x43864d=_[_0xf22a('0x41')]({},_0x43864d,_0x1a21f5[_0xf22a('0x48')]);return db[_0xf22a('0x2f')][_0xf22a('0x49')](_0x43864d)[_0xf22a('0x28')](handleEntityNotFound(_0x378013,null))['then'](respondWithResult(_0x378013,null))[_0xf22a('0x4a')](handleError(_0x378013,null));};exports[_0xf22a('0x4b')]=function(_0x12186b,_0x283b61){return db['Interval']['create'](_0x12186b['body'],{})['then'](function(_0x4e66d8){var _0x220ac6=_0x12186b[_0xf22a('0x4c')][_0xf22a('0x2a')]({'plain':!![]});if(!_0x220ac6)throw new Error(_0xf22a('0x4d'));if(_0x220ac6['role']==='user'){var _0x52f05f=_0x4e66d8[_0xf22a('0x2a')]({'plain':!![]});var _0x1a6894=_0xf22a('0x4e');return db[_0xf22a('0x4f')]['find']({'where':{'name':_0x1a6894,'userProfileId':_0x220ac6['userProfileId']},'raw':!![]})[_0xf22a('0x28')](function(_0x15d014){if(_0x15d014&&_0x15d014[_0xf22a('0x50')]===0x0){return db[_0xf22a('0x2b')][_0xf22a('0x4b')]({'name':_0x52f05f[_0xf22a('0x2c')],'resourceId':_0x52f05f['id'],'type':_0x15d014[_0xf22a('0x2c')],'sectionId':_0x15d014['id']},{})[_0xf22a('0x28')](function(){return _0x4e66d8;});}else{return _0x4e66d8;}})['catch'](function(_0x7e9f05){logger[_0xf22a('0x51')](_0xf22a('0x52'),_0x7e9f05);throw _0x7e9f05;});}return _0x4e66d8;})[_0xf22a('0x28')](respondWithResult(_0x283b61,0xc9))['catch'](handleError(_0x283b61,null));};exports[_0xf22a('0x27')]=function(_0xbcad39,_0x31bfca){if(_0xbcad39[_0xf22a('0x53')]['id']){delete _0xbcad39[_0xf22a('0x53')]['id'];}return db[_0xf22a('0x2f')][_0xf22a('0x49')]({'where':{'id':_0xbcad39['params']['id']}})[_0xf22a('0x28')](handleEntityNotFound(_0x31bfca,null))[_0xf22a('0x28')](saveUpdates(_0xbcad39['body'],null))[_0xf22a('0x28')](respondWithResult(_0x31bfca,null))['catch'](handleError(_0x31bfca,null));};exports[_0xf22a('0x29')]=function(_0x2cca9f,_0x4bff33){return db[_0xf22a('0x2f')][_0xf22a('0x49')]({'where':{'id':_0x2cca9f[_0xf22a('0x47')]['id']}})[_0xf22a('0x28')](handleEntityNotFound(_0x4bff33,null))[_0xf22a('0x28')](removeEntity(_0x4bff33,null))[_0xf22a('0x4a')](handleError(_0x4bff33,null));};exports[_0xf22a('0x54')]=function(_0x30b5d1,_0x3ffee7,_0x593e0d){if(_0x30b5d1['body']['id']){delete _0x30b5d1[_0xf22a('0x53')]['id'];}return db[_0xf22a('0x2f')][_0xf22a('0x49')]({'where':{'id':_0x30b5d1[_0xf22a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ffee7,null))['then'](function(_0x356230){if(_0x356230){_0x30b5d1[_0xf22a('0x53')]['IntervalId']=_0x356230['id'];return db[_0xf22a('0x2f')][_0xf22a('0x4b')](_0x30b5d1['body']);}})[_0xf22a('0x28')](respondWithResult(_0x3ffee7,null))[_0xf22a('0x4a')](handleError(_0x3ffee7,null));};exports[_0xf22a('0x55')]=function(_0x4cdab9,_0xaa1c4d,_0x453155){var _0x2620fe={};var _0x55f306={};var _0x33b9a9;var _0x44fab0;return db[_0xf22a('0x2f')]['findOne']({'where':{'id':_0x4cdab9[_0xf22a('0x47')]['id']}})[_0xf22a('0x28')](handleEntityNotFound(_0xaa1c4d,null))[_0xf22a('0x28')](function(_0x4c8687){if(_0x4c8687){_0x33b9a9=_0x4c8687;_0x55f306[_0xf22a('0x33')]=_[_0xf22a('0x35')](db[_0xf22a('0x2f')]['rawAttributes']);_0x55f306[_0xf22a('0x36')]=_[_0xf22a('0x35')](_0x4cdab9[_0xf22a('0x36')]);_0x55f306[_0xf22a('0x37')]=_[_0xf22a('0x38')](_0x55f306[_0xf22a('0x33')],_0x55f306[_0xf22a('0x36')]);_0x2620fe[_0xf22a('0x39')]=_[_0xf22a('0x38')](_0x55f306['model'],qs['fields'](_0x4cdab9[_0xf22a('0x36')][_0xf22a('0x3a')]));_0x2620fe[_0xf22a('0x39')]=_0x2620fe[_0xf22a('0x39')]['length']?_0x2620fe[_0xf22a('0x39')]:_0x55f306[_0xf22a('0x33')];_0x2620fe['order']=qs['sort'](_0x4cdab9[_0xf22a('0x36')][_0xf22a('0x3d')]);_0x2620fe[_0xf22a('0x3e')]=qs[_0xf22a('0x37')](_[_0xf22a('0x3f')](_0x4cdab9[_0xf22a('0x36')],_0x55f306['filters']));if(_0x4cdab9['query'][_0xf22a('0x40')]){_0x2620fe[_0xf22a('0x3e')]=_[_0xf22a('0x41')](_0x2620fe['where'],{'$or':_[_0xf22a('0x34')](_0x2620fe[_0xf22a('0x39')],function(_0x3ff51c){var _0x3eeea9={};_0x3eeea9[_0x3ff51c]={'$like':'%'+_0x4cdab9[_0xf22a('0x36')][_0xf22a('0x40')]+'%'};return _0x3eeea9;})});}_0x2620fe=_['merge']({},_0x2620fe,_0x4cdab9[_0xf22a('0x48')]);return _0x33b9a9[_0xf22a('0x55')](_0x2620fe);}})[_0xf22a('0x28')](function(_0xefc646){if(_0xefc646){_0x44fab0=_0xefc646['length'];if(!_0x4cdab9[_0xf22a('0x36')][_0xf22a('0x3b')](_0xf22a('0x3c'))){_0x2620fe[_0xf22a('0x22')]=qs[_0xf22a('0x22')](_0x4cdab9['query'][_0xf22a('0x22')]);_0x2620fe[_0xf22a('0x21')]=qs[_0xf22a('0x21')](_0x4cdab9[_0xf22a('0x36')][_0xf22a('0x21')]);}return _0x33b9a9[_0xf22a('0x55')](_0x2620fe);}})['then'](function(_0x110cf1){if(_0x110cf1){return _0x110cf1?{'count':_0x44fab0,'rows':_0x110cf1}:null;}})[_0xf22a('0x28')](respondWithResult(_0xaa1c4d,null))['catch'](handleError(_0xaa1c4d,null));};exports[_0xf22a('0x56')]=function(_0x2a36ca,_0x4d7573,_0x778435){return db['Interval'][_0xf22a('0x57')]({'where':{'id':_0x2a36ca['params']['id']}})['then'](handleEntityNotFound(_0x4d7573,null))['then'](function(_0x4355c1){if(_0x4355c1){return db[_0xf22a('0x58')][_0xf22a('0x59')](function(_0x24a684){return db[_0xf22a('0x2f')][_0xf22a('0x29')]({'where':{'IntervalId':_0x2a36ca[_0xf22a('0x47')]['id']},'transaction':_0x24a684})[_0xf22a('0x28')](function(_0x367e6b){var _0x2d3201=_[_0xf22a('0x34')](_0x2a36ca['body'],function(_0xd55774){delete _0xd55774['id'];_0xd55774[_0xf22a('0x5a')]=_0x2a36ca[_0xf22a('0x47')]['id'];return _0xd55774;});return db['Interval'][_0xf22a('0x5b')](_0x2d3201,{'transaction':_0x24a684});});})['then'](function(){return db[_0xf22a('0x2f')][_0xf22a('0x45')]({'where':{'IntervalId':_0x2a36ca[_0xf22a('0x47')]['id']}});});}})[_0xf22a('0x28')](respondWithResult(_0x4d7573,null))[_0xf22a('0x4a')](handleError(_0x4d7573,null));}; \ No newline at end of file +var _0x7531=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','error','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','getIntervals','findOne','sequelize','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3a8027,_0x1d8123){var _0x15db0f=function(_0x1d4178){while(--_0x1d4178){_0x3a8027['push'](_0x3a8027['shift']());}};_0x15db0f(++_0x1d8123);}(_0x7531,0x158));var _0x1753=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7531[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x1753('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1753('0x1'));var jsonpatch=require(_0x1753('0x2'));var rp=require(_0x1753('0x3'));var moment=require(_0x1753('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1753('0x5'));var sox=require(_0x1753('0x6'));var csv=require(_0x1753('0x7'));var ejs=require(_0x1753('0x8'));var fs=require('fs');var fs_extra=require(_0x1753('0x9'));var _=require(_0x1753('0xa'));var squel=require(_0x1753('0xb'));var crypto=require(_0x1753('0xc'));var jsforce=require(_0x1753('0xd'));var deskjs=require(_0x1753('0xe'));var toCsv=require(_0x1753('0x7'));var querystring=require(_0x1753('0xf'));var Papa=require(_0x1753('0x10'));var Redis=require(_0x1753('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1753('0x12'));var as=require(_0x1753('0x13'));var hardwareService=require(_0x1753('0x14'));var logger=require(_0x1753('0x15'))('api');var utils=require(_0x1753('0x16'));var config=require(_0x1753('0x17'));var licenseUtil=require(_0x1753('0x18'));var db=require('../../mysqldb')['db'];var extensions=require(_0x1753('0x19'));function respondWithStatusCode(_0x151cf3,_0x347ab7){_0x347ab7=_0x347ab7||0xcc;return function(_0x35c52c){if(_0x35c52c){return _0x151cf3['sendStatus'](_0x347ab7);}return _0x151cf3[_0x1753('0x1a')](_0x347ab7)[_0x1753('0x1b')]();};}function respondWithResult(_0x2daed4,_0x1b9f17){_0x1b9f17=_0x1b9f17||0xc8;return function(_0x5d7459){if(_0x5d7459){return _0x2daed4[_0x1753('0x1a')](_0x1b9f17)[_0x1753('0x1c')](_0x5d7459);}};}function respondWithFilteredResult(_0x10fe11,_0xff69ed){return function(_0x3343ba){if(_0x3343ba){var _0x40d2b5=typeof _0xff69ed['offset']===_0x1753('0x1d')&&typeof _0xff69ed['limit']===_0x1753('0x1d');var _0xe1dfe7=_0x3343ba[_0x1753('0x1e')];var _0x51ca06=_0x40d2b5?0x0:_0xff69ed['offset'];var _0x429f7e=_0x40d2b5?_0x3343ba['count']:_0xff69ed[_0x1753('0x1f')]+_0xff69ed[_0x1753('0x20')];var _0x45d376;if(_0x429f7e>=_0xe1dfe7){_0x429f7e=_0xe1dfe7;_0x45d376=0xc8;}else{_0x45d376=0xce;}_0x10fe11[_0x1753('0x1a')](_0x45d376);return _0x10fe11[_0x1753('0x21')](_0x1753('0x22'),_0x51ca06+'-'+_0x429f7e+'/'+_0xe1dfe7)[_0x1753('0x1c')](_0x3343ba);}return null;};}function patchUpdates(_0xa58024){return function(_0x57dcef){try{jsonpatch[_0x1753('0x23')](_0x57dcef,_0xa58024,!![]);}catch(_0x39f087){return BPromise[_0x1753('0x24')](_0x39f087);}return _0x57dcef[_0x1753('0x25')]();};}function saveUpdates(_0x49d58e,_0xdb833e){return function(_0x34e8db){if(_0x34e8db){return _0x34e8db[_0x1753('0x26')](_0x49d58e)[_0x1753('0x27')](function(_0x5f3976){return _0x5f3976;});}return null;};}function removeEntity(_0x19d26a,_0x377a67){return function(_0x4e8154){if(_0x4e8154){return _0x4e8154[_0x1753('0x28')]()[_0x1753('0x27')](function(){var _0x5ac318=_0x4e8154[_0x1753('0x29')]({'plain':!![]});var _0x1e31bb=_0x1753('0x2a');return db['UserProfileResource'][_0x1753('0x28')]({'where':{'type':_0x1e31bb,'resourceId':_0x5ac318['id']}})['then'](function(){return _0x4e8154;});})['then'](function(){_0x19d26a[_0x1753('0x1a')](0xcc)[_0x1753('0x1b')]();});}};}function handleEntityNotFound(_0x3983ac,_0x1adeb2){return function(_0x302c7f){if(!_0x302c7f){_0x3983ac['sendStatus'](0x194);}return _0x302c7f;};}function handleError(_0x3d9980,_0x45ab2f){_0x45ab2f=_0x45ab2f||0x1f4;return function(_0x5f2f07){logger[_0x1753('0x2b')](_0x5f2f07['stack']);if(_0x5f2f07[_0x1753('0x2c')]){delete _0x5f2f07[_0x1753('0x2c')];}_0x3d9980[_0x1753('0x1a')](_0x45ab2f)['send'](_0x5f2f07);};}exports[_0x1753('0x2d')]=function(_0x1fe5fa,_0x2b694c){var _0x3ef319={},_0x2143db={},_0x527c3b={'count':0x0,'rows':[]};var _0x376544=_[_0x1753('0x2e')](db[_0x1753('0x2f')][_0x1753('0x30')],function(_0x3a7995){return{'name':_0x3a7995[_0x1753('0x31')],'type':_0x3a7995[_0x1753('0x32')][_0x1753('0x33')]};});_0x2143db[_0x1753('0x34')]=_[_0x1753('0x2e')](_0x376544,_0x1753('0x2c'));_0x2143db[_0x1753('0x35')]=_[_0x1753('0x36')](_0x1fe5fa['query']);_0x2143db[_0x1753('0x37')]=_[_0x1753('0x38')](_0x2143db[_0x1753('0x34')],_0x2143db[_0x1753('0x35')]);_0x3ef319[_0x1753('0x39')]=_[_0x1753('0x38')](_0x2143db[_0x1753('0x34')],qs['fields'](_0x1fe5fa[_0x1753('0x35')][_0x1753('0x3a')]));_0x3ef319[_0x1753('0x39')]=_0x3ef319[_0x1753('0x39')][_0x1753('0x3b')]?_0x3ef319[_0x1753('0x39')]:_0x2143db['model'];if(!_0x1fe5fa['query'][_0x1753('0x3c')](_0x1753('0x3d'))){_0x3ef319[_0x1753('0x20')]=qs['limit'](_0x1fe5fa[_0x1753('0x35')]['limit']);_0x3ef319[_0x1753('0x1f')]=qs[_0x1753('0x1f')](_0x1fe5fa[_0x1753('0x35')][_0x1753('0x1f')]);}_0x3ef319[_0x1753('0x3e')]=qs[_0x1753('0x3f')](_0x1fe5fa[_0x1753('0x35')][_0x1753('0x3f')]);_0x3ef319[_0x1753('0x40')]=qs[_0x1753('0x37')](_[_0x1753('0x41')](_0x1fe5fa[_0x1753('0x35')],_0x2143db[_0x1753('0x37')]),_0x376544);if(_0x1fe5fa[_0x1753('0x35')][_0x1753('0x42')]){_0x3ef319[_0x1753('0x40')]=_[_0x1753('0x43')](_0x3ef319[_0x1753('0x40')],{'$or':_[_0x1753('0x2e')](_0x376544,function(_0x5eeba5){if(_0x5eeba5[_0x1753('0x32')]!==_0x1753('0x44')){var _0x3c5795={};_0x3c5795[_0x5eeba5[_0x1753('0x2c')]]={'$like':'%'+_0x1fe5fa[_0x1753('0x35')][_0x1753('0x42')]+'%'};return _0x3c5795;}})});}_0x3ef319=_['merge']({},_0x3ef319,_0x1fe5fa['options']);var _0x366d8f={'where':_0x3ef319[_0x1753('0x40')]};return db['Interval']['count'](_0x366d8f)['then'](function(_0x880d2d){_0x527c3b['count']=_0x880d2d;if(_0x1fe5fa[_0x1753('0x35')][_0x1753('0x45')]){_0x3ef319[_0x1753('0x46')]=[{'all':!![]}];}return db[_0x1753('0x2f')][_0x1753('0x47')](_0x3ef319);})[_0x1753('0x27')](function(_0x19936e){_0x527c3b[_0x1753('0x48')]=_0x19936e;return _0x527c3b;})[_0x1753('0x27')](respondWithFilteredResult(_0x2b694c,_0x3ef319))[_0x1753('0x49')](handleError(_0x2b694c,null));};exports[_0x1753('0x4a')]=function(_0x1a7edb,_0x481bd1){var _0x3cacbb={'raw':!![],'where':{'id':_0x1a7edb[_0x1753('0x4b')]['id']}},_0x35942c={};_0x35942c['model']=_[_0x1753('0x36')](db['Interval'][_0x1753('0x30')]);_0x35942c[_0x1753('0x35')]=_['keys'](_0x1a7edb['query']);_0x35942c['filters']=_[_0x1753('0x38')](_0x35942c[_0x1753('0x34')],_0x35942c[_0x1753('0x35')]);_0x3cacbb['attributes']=_[_0x1753('0x38')](_0x35942c[_0x1753('0x34')],qs[_0x1753('0x3a')](_0x1a7edb[_0x1753('0x35')]['fields']));_0x3cacbb[_0x1753('0x39')]=_0x3cacbb['attributes']['length']?_0x3cacbb['attributes']:_0x35942c[_0x1753('0x34')];if(_0x1a7edb[_0x1753('0x35')][_0x1753('0x45')]){_0x3cacbb[_0x1753('0x46')]=[{'all':!![]}];}_0x3cacbb=_[_0x1753('0x43')]({},_0x3cacbb,_0x1a7edb[_0x1753('0x4c')]);return db[_0x1753('0x2f')][_0x1753('0x4d')](_0x3cacbb)['then'](handleEntityNotFound(_0x481bd1,null))['then'](respondWithResult(_0x481bd1,null))[_0x1753('0x49')](handleError(_0x481bd1,null));};exports[_0x1753('0x4e')]=function(_0x2eb722,_0x1975d7){return db[_0x1753('0x2f')][_0x1753('0x4e')](_0x2eb722['body'],{})[_0x1753('0x27')](function(_0x53c75f){var _0x46a908=_0x2eb722[_0x1753('0x4f')][_0x1753('0x29')]({'plain':!![]});if(!_0x46a908)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46a908['role']===_0x1753('0x4f')){var _0x460e29=_0x53c75f[_0x1753('0x29')]({'plain':!![]});var _0x15c115=_0x1753('0x2a');return db[_0x1753('0x50')]['find']({'where':{'name':_0x15c115,'userProfileId':_0x46a908[_0x1753('0x51')]},'raw':!![]})[_0x1753('0x27')](function(_0x401971){if(_0x401971&&_0x401971['autoAssociation']===0x0){return db[_0x1753('0x52')]['create']({'name':_0x460e29['name'],'resourceId':_0x460e29['id'],'type':_0x401971[_0x1753('0x2c')],'sectionId':_0x401971['id']},{})[_0x1753('0x27')](function(){return _0x53c75f;});}else{return _0x53c75f;}})[_0x1753('0x49')](function(_0x2c5d80){logger['error'](_0x1753('0x53'),_0x2c5d80);throw _0x2c5d80;});}return _0x53c75f;})[_0x1753('0x27')](respondWithResult(_0x1975d7,0xc9))['catch'](handleError(_0x1975d7,null));};exports[_0x1753('0x26')]=function(_0x5e5de6,_0x5310f5){if(_0x5e5de6[_0x1753('0x54')]['id']){delete _0x5e5de6[_0x1753('0x54')]['id'];}return db[_0x1753('0x2f')]['find']({'where':{'id':_0x5e5de6[_0x1753('0x4b')]['id']}})[_0x1753('0x27')](handleEntityNotFound(_0x5310f5,null))[_0x1753('0x27')](saveUpdates(_0x5e5de6[_0x1753('0x54')],null))[_0x1753('0x27')](respondWithResult(_0x5310f5,null))[_0x1753('0x49')](handleError(_0x5310f5,null));};exports[_0x1753('0x28')]=function(_0x391a65,_0x55b3ed){return db[_0x1753('0x2f')]['find']({'where':{'id':_0x391a65['params']['id']}})[_0x1753('0x27')](handleEntityNotFound(_0x55b3ed,null))['then'](removeEntity(_0x55b3ed,null))['catch'](handleError(_0x55b3ed,null));};exports[_0x1753('0x55')]=function(_0xe89d93,_0x23f328,_0x59705f){if(_0xe89d93[_0x1753('0x54')]['id']){delete _0xe89d93[_0x1753('0x54')]['id'];}return db[_0x1753('0x2f')][_0x1753('0x4d')]({'where':{'id':_0xe89d93[_0x1753('0x4b')]['id']}})[_0x1753('0x27')](handleEntityNotFound(_0x23f328,null))[_0x1753('0x27')](function(_0x10c64e){if(_0x10c64e){_0xe89d93[_0x1753('0x54')]['IntervalId']=_0x10c64e['id'];return db[_0x1753('0x2f')][_0x1753('0x4e')](_0xe89d93[_0x1753('0x54')]);}})[_0x1753('0x27')](respondWithResult(_0x23f328,null))[_0x1753('0x49')](handleError(_0x23f328,null));};exports[_0x1753('0x56')]=function(_0x43d910,_0x2e131b,_0x21a903){var _0x472730={};var _0x1f7cc2={};var _0x3a54d5;var _0x85db52;return db[_0x1753('0x2f')][_0x1753('0x57')]({'where':{'id':_0x43d910['params']['id']}})[_0x1753('0x27')](handleEntityNotFound(_0x2e131b,null))['then'](function(_0x1f7952){if(_0x1f7952){_0x3a54d5=_0x1f7952;_0x1f7cc2[_0x1753('0x34')]=_[_0x1753('0x36')](db[_0x1753('0x2f')][_0x1753('0x30')]);_0x1f7cc2['query']=_['keys'](_0x43d910[_0x1753('0x35')]);_0x1f7cc2[_0x1753('0x37')]=_[_0x1753('0x38')](_0x1f7cc2[_0x1753('0x34')],_0x1f7cc2[_0x1753('0x35')]);_0x472730[_0x1753('0x39')]=_[_0x1753('0x38')](_0x1f7cc2[_0x1753('0x34')],qs[_0x1753('0x3a')](_0x43d910['query'][_0x1753('0x3a')]));_0x472730['attributes']=_0x472730['attributes'][_0x1753('0x3b')]?_0x472730[_0x1753('0x39')]:_0x1f7cc2[_0x1753('0x34')];_0x472730[_0x1753('0x3e')]=qs[_0x1753('0x3f')](_0x43d910[_0x1753('0x35')][_0x1753('0x3f')]);_0x472730[_0x1753('0x40')]=qs[_0x1753('0x37')](_['pick'](_0x43d910['query'],_0x1f7cc2[_0x1753('0x37')]));if(_0x43d910['query'][_0x1753('0x42')]){_0x472730[_0x1753('0x40')]=_[_0x1753('0x43')](_0x472730[_0x1753('0x40')],{'$or':_['map'](_0x472730[_0x1753('0x39')],function(_0x4315bc){var _0x3954e4={};_0x3954e4[_0x4315bc]={'$like':'%'+_0x43d910[_0x1753('0x35')][_0x1753('0x42')]+'%'};return _0x3954e4;})});}_0x472730=_[_0x1753('0x43')]({},_0x472730,_0x43d910[_0x1753('0x4c')]);return _0x3a54d5[_0x1753('0x56')](_0x472730);}})[_0x1753('0x27')](function(_0x14b427){if(_0x14b427){_0x85db52=_0x14b427[_0x1753('0x3b')];if(!_0x43d910[_0x1753('0x35')][_0x1753('0x3c')](_0x1753('0x3d'))){_0x472730[_0x1753('0x20')]=qs[_0x1753('0x20')](_0x43d910[_0x1753('0x35')]['limit']);_0x472730[_0x1753('0x1f')]=qs['offset'](_0x43d910[_0x1753('0x35')]['offset']);}return _0x3a54d5[_0x1753('0x56')](_0x472730);}})['then'](function(_0x587eed){if(_0x587eed){return _0x587eed?{'count':_0x85db52,'rows':_0x587eed}:null;}})[_0x1753('0x27')](respondWithResult(_0x2e131b,null))['catch'](handleError(_0x2e131b,null));};exports['addIntervals']=function(_0x32c70f,_0x4bd342,_0x258a83){return db[_0x1753('0x2f')][_0x1753('0x57')]({'where':{'id':_0x32c70f[_0x1753('0x4b')]['id']}})[_0x1753('0x27')](handleEntityNotFound(_0x4bd342,null))[_0x1753('0x27')](function(_0x19ff14){if(_0x19ff14){return db[_0x1753('0x58')]['transaction'](function(_0xe3e26c){return db['Interval']['destroy']({'where':{'IntervalId':_0x32c70f[_0x1753('0x4b')]['id']},'transaction':_0xe3e26c})['then'](function(_0x4eff9c){var _0x68fedc=_['map'](_0x32c70f['body'],function(_0x52ef5e){delete _0x52ef5e['id'];_0x52ef5e['IntervalId']=_0x32c70f[_0x1753('0x4b')]['id'];return _0x52ef5e;});return db[_0x1753('0x2f')][_0x1753('0x59')](_0x68fedc,{'transaction':_0xe3e26c});});})[_0x1753('0x27')](function(){return db[_0x1753('0x2f')][_0x1753('0x47')]({'where':{'IntervalId':_0x32c70f[_0x1753('0x4b')]['id']}});});}})[_0x1753('0x27')](respondWithResult(_0x4bd342,null))[_0x1753('0x49')](handleError(_0x4bd342,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index c73bb40..4535b0f 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 _0xd545=['./interval.attributes','../../utils/iftime','define','tools_intervals','rewrite','interval','string','getIntervals','map','then'];(function(_0x38488c,_0x4bb115){var _0xecbfa0=function(_0x19b4cc){while(--_0x19b4cc){_0x38488c['push'](_0x38488c['shift']());}};_0xecbfa0(++_0x4bb115);}(_0xd545,0x1f4));var _0x5d54=function(_0x25794d,_0x85b5d1){_0x25794d=_0x25794d-0x0;var _0x4dea00=_0xd545[_0x25794d];return _0x4dea00;};'use strict';var attributes=require(_0x5d54('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x5d54('0x1'))['iftime'];module['exports']=function(_0xe9f69b){return _0xe9f69b[_0x5d54('0x2')]('Interval',attributes,{'tableName':_0x5d54('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2590a8){extensions[_0x5d54('0x4')](_0xe9f69b,_0x2590a8);},'afterBulkCreate':function(_0x496dfd,_0x517ff2,_0x8960a1){_0x8960a1();extensions['rewrite'](_0xe9f69b,_0x496dfd[0x0]);},'afterUpdate':function(_0x1d20c1){extensions[_0x5d54('0x4')](_0xe9f69b,_0x1d20c1);},'afterDestroy':function(_0x4b5309){extensions[_0x5d54('0x4')](_0xe9f69b,_0x4b5309);}},'instanceMethods':{'ifTime':function(_0x4ba466=undefined,_0x452711=new Date()){if(typeof this[_0x5d54('0x5')]===_0x5d54('0x6')){return iftime(this[_0x5d54('0x5')],_0x4ba466,_0x452711);}else{return this[_0x5d54('0x7')]()['then'](function(_0x39e4ee){return Promise['all'](_0x39e4ee[_0x5d54('0x8')](function(_0x273490){return _0x273490['ifTime'](_0x4ba466,_0x452711);}));})[_0x5d54('0x9')](function(_0x5a8424){return _0x5a8424['reduce'](function(_0x2f8d28,_0x3b947b){return _0x2f8d28||_0x3b947b;},![]);});}}}});}; \ No newline at end of file +var _0xc6c9=['all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','Interval','rewrite','interval','string','getIntervals','then'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0xc6c9,0x1d2));var _0x9c6c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc6c9[_0x3b380d];return _0x54502b;};'use strict';var attributes=require(_0x9c6c('0x0'));var extensions=require(_0x9c6c('0x1'));var iftime=require(_0x9c6c('0x2'))[_0x9c6c('0x3')];module['exports']=function(_0x8d345){return _0x8d345['define'](_0x9c6c('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5861e7){extensions[_0x9c6c('0x5')](_0x8d345,_0x5861e7);},'afterBulkCreate':function(_0x1c7524,_0x7fcf06,_0x5903de){_0x5903de();extensions[_0x9c6c('0x5')](_0x8d345,_0x1c7524[0x0]);},'afterUpdate':function(_0x4e20b0){extensions['rewrite'](_0x8d345,_0x4e20b0);},'afterDestroy':function(_0x4a1dcc){extensions[_0x9c6c('0x5')](_0x8d345,_0x4a1dcc);}},'instanceMethods':{'ifTime':function(_0x4e019c=undefined,_0x419cee=new Date()){if(typeof this[_0x9c6c('0x6')]===_0x9c6c('0x7')){return iftime(this[_0x9c6c('0x6')],_0x4e019c,_0x419cee);}else{return this[_0x9c6c('0x8')]()[_0x9c6c('0x9')](function(_0xb63ff2){return Promise[_0x9c6c('0xa')](_0xb63ff2[_0x9c6c('0xb')](function(_0x34f182){return _0x34f182[_0x9c6c('0xc')](_0x4e019c,_0x419cee);}));})[_0x9c6c('0x9')](function(_0x52ea1f){return _0x52ea1f[_0x9c6c('0xd')](function(_0x45637a,_0x2e7ac7){return _0x45637a||_0x2e7ac7;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c955a7d..49f0218 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 _0x03b8=['reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','name','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','debug','resolve','lodash','util','../../mysqldb','iftime','rpc','GetInterval','Interval','findAll','options','where','limit','include','map','model','attributes','then','info','stringify','catch','message','error','ShowInterval','find','raw','ifTime'];(function(_0x4ec328,_0x31e00c){var _0x565272=function(_0x8839a8){while(--_0x8839a8){_0x4ec328['push'](_0x4ec328['shift']());}};_0x565272(++_0x31e00c);}(_0x03b8,0x1ef));var _0x803b=function(_0x464bec,_0x5302b0){_0x464bec=_0x464bec-0x0;var _0x5d36f3=_0x03b8[_0x464bec];return _0x5d36f3;};'use strict';var _=require(_0x803b('0x0'));var util=require(_0x803b('0x1'));var db=require(_0x803b('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x803b('0x3')];var logger=require('../../config/logger')(_0x803b('0x4'));exports[_0x803b('0x5')]=function(_0x2e382e){var _0x37c80b=this;return new Promise(function(_0x13f3e0,_0x336ea9){return db[_0x803b('0x6')][_0x803b('0x7')]({'raw':_0x2e382e[_0x803b('0x8')]?_0x2e382e['options']['raw']===undefined?!![]:![]:!![],'where':_0x2e382e[_0x803b('0x8')]?_0x2e382e[_0x803b('0x8')][_0x803b('0x9')]||null:null,'attributes':_0x2e382e[_0x803b('0x8')]?_0x2e382e[_0x803b('0x8')]['attributes']||null:null,'limit':_0x2e382e[_0x803b('0x8')]?_0x2e382e[_0x803b('0x8')][_0x803b('0xa')]||null:null,'include':_0x2e382e[_0x803b('0x8')]?_0x2e382e[_0x803b('0x8')][_0x803b('0xb')]?_[_0x803b('0xc')](_0x2e382e[_0x803b('0x8')]['include'],function(_0xbdddf7){return{'model':db[_0xbdddf7[_0x803b('0xd')]],'as':_0xbdddf7['as'],'attributes':_0xbdddf7[_0x803b('0xe')],'include':_0xbdddf7[_0x803b('0xb')]?_['map'](_0xbdddf7['include'],function(_0x21483c){return{'model':db[_0x21483c[_0x803b('0xd')]],'as':_0x21483c['as'],'attributes':_0x21483c[_0x803b('0xe')],'include':_0x21483c[_0x803b('0xb')]?_[_0x803b('0xc')](_0x21483c[_0x803b('0xb')],function(_0x41a157){return{'model':db[_0x41a157[_0x803b('0xd')]],'as':_0x41a157['as'],'attributes':_0x41a157['attributes']};}):[]};}):[]};}):[]:[]})[_0x803b('0xf')](function(_0x561606){logger[_0x803b('0x10')](_0x803b('0x5'),_0x2e382e);logger['debug'](_0x803b('0x5'),_0x2e382e,JSON[_0x803b('0x11')](_0x561606));_0x13f3e0(_0x561606);})[_0x803b('0x12')](function(_0x5e8c90){logger['error'](_0x803b('0x5'),_0x5e8c90[_0x803b('0x13')],_0x2e382e);_0x336ea9(_0x37c80b[_0x803b('0x14')](0x1f4,_0x5e8c90['message']));});});};exports[_0x803b('0x15')]=function(_0x1e1296){var _0x349e80=this;return new Promise(function(_0x22c92a,_0x4f0569){return db[_0x803b('0x6')][_0x803b('0x16')]({'raw':_0x1e1296[_0x803b('0x8')]?_0x1e1296[_0x803b('0x8')][_0x803b('0x17')]===undefined?!![]:![]:!![],'where':_0x1e1296[_0x803b('0x8')]?_0x1e1296[_0x803b('0x8')][_0x803b('0x9')]||null:null,'attributes':_0x1e1296[_0x803b('0x8')]?_0x1e1296[_0x803b('0x8')][_0x803b('0xe')]||null:null,'include':_0x1e1296[_0x803b('0x8')]?_0x1e1296['options'][_0x803b('0xb')]?_[_0x803b('0xc')](_0x1e1296['options'][_0x803b('0xb')],function(_0x22894a){return{'model':db[_0x22894a['model']],'as':_0x22894a['as'],'attributes':_0x22894a[_0x803b('0xe')],'include':_0x22894a['include']?_[_0x803b('0xc')](_0x22894a[_0x803b('0xb')],function(_0x329511){return{'model':db[_0x329511[_0x803b('0xd')]],'as':_0x329511['as'],'attributes':_0x329511[_0x803b('0xe')],'include':_0x329511['include']?_['map'](_0x329511[_0x803b('0xb')],function(_0x436196){return{'model':db[_0x436196[_0x803b('0xd')]],'as':_0x436196['as'],'attributes':_0x436196['attributes']};}):[]};}):[]};}):[]:[]})[_0x803b('0xf')](function(_0x2f9f62){logger[_0x803b('0x10')]('ShowInterval',_0x1e1296);logger['debug']('ShowInterval',_0x1e1296,JSON[_0x803b('0x11')](_0x2f9f62));_0x22c92a(_0x2f9f62);})[_0x803b('0x12')](function(_0x706ee6){logger[_0x803b('0x14')](_0x803b('0x15'),_0x706ee6[_0x803b('0x13')],_0x1e1296);_0x4f0569(_0x349e80[_0x803b('0x14')](0x1f4,_0x706ee6[_0x803b('0x13')]));});});};function checkArrayOfIntervals(_0x3d4ef2,_0x35fa5f){var _0x221422=[];return db[_0x803b('0x6')][_0x803b('0x7')]({'where':{'id':_0x3d4ef2}})[_0x803b('0xf')](function(_0x1fbabb){_0x221422=_0x1fbabb;return Promise['all'](_0x221422[_0x803b('0xc')](function(_0x4c865a){return _0x4c865a[_0x803b('0x18')](_0x35fa5f);}));})['then'](function(_0x14e3a2){var _0x426d6a=_0x14e3a2[_0x803b('0x19')](function(_0x13362c,_0x4a8c14){return _0x13362c||_0x4a8c14;},![]);logger[_0x803b('0x10')](util[_0x803b('0x1a')](_0x803b('0x1b'),_0x221422[_0x803b('0xc')](function(_0x2a5736){return _0x2a5736['name'];})[_0x803b('0x1c')](',\x20'),_0x221422[_0x803b('0xc')](function(_0x2ffdc2){return _0x2ffdc2['id'];})[_0x803b('0x1c')](',\x20')));return _0x426d6a;});}function checkSingleInterval(_0x5a6cae,_0x128c51){return db[_0x803b('0x6')]['findById'](_0x5a6cae)['then'](function(_0x11679b){if(_0x11679b){logger[_0x803b('0x10')](util[_0x803b('0x1a')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x11679b[_0x803b('0x1d')],_0x11679b['id']));return _0x11679b[_0x803b('0x18')](_0x128c51);}});}exports[_0x803b('0x1e')]=function(_0x2d79bf){var _0x53280f=_0x2d79bf[_0x803b('0x1f')];var _0x520588=Array[_0x803b('0x20')](_0x2d79bf[_0x803b('0x21')])?_0x2d79bf[_0x803b('0x21')]:typeof _0x2d79bf[_0x803b('0x21')]===_0x803b('0x22')?[_0x2d79bf[_0x803b('0x21')]]:[];var _0x4a1a7a=_0x2d79bf[_0x803b('0x23')]||undefined;var _0x58ac7c=![];if(_0x520588[_0x803b('0x24')]){logger[_0x803b('0x10')](util[_0x803b('0x1a')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x520588['join'](';\x20')));}if(_0x4a1a7a){logger[_0x803b('0x10')](util[_0x803b('0x1a')](_0x803b('0x25'),_0x4a1a7a));}logger[_0x803b('0x26')]('Iftime',_0x58ac7c);logger['silly'](_0x803b('0x1e'),_0x2d79bf);return Promise[_0x803b('0x27')]()[_0x803b('0xf')](function(){if(Array[_0x803b('0x20')](_0x53280f)){return checkArrayOfIntervals(_0x53280f,_0x4a1a7a);}else if(_0x53280f){return checkSingleInterval(_0x53280f,_0x4a1a7a);}})[_0x803b('0xf')](function(_0x3b28ff){var _0xe64c15=_0x520588[_0x803b('0x19')](function(_0x11ba7c,_0x234ed9){return _0x11ba7c||iftime(_0x234ed9,_0x4a1a7a);},![]);_0x58ac7c=_0x3b28ff||_0xe64c15;return _0x58ac7c;})[_0x803b('0x12')](function(_0x378759){logger[_0x803b('0x14')](_0x803b('0x1e'),_0x2d79bf,_0x378759);throw this[_0x803b('0x14')](0x1f4,_0x378759['message']);});}; \ No newline at end of file +var _0x4673=['intervals','string','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','../../utils/iftime','iftime','../../config/logger','GetInterval','findAll','options','raw','where','attributes','limit','map','include','model','info','catch','error','message','find','ShowInterval','debug','Interval','all','reduce','format','join','findById','then','ifTime','isArray'];(function(_0x57acb9,_0x468810){var _0x16ac38=function(_0x541fb2){while(--_0x541fb2){_0x57acb9['push'](_0x57acb9['shift']());}};_0x16ac38(++_0x468810);}(_0x4673,0x113));var _0x3467=function(_0xfe962a,_0x282280){_0xfe962a=_0xfe962a-0x0;var _0x36f876=_0x4673[_0xfe962a];return _0x36f876;};'use strict';var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var iftime=require(_0x3467('0x0'))[_0x3467('0x1')];var logger=require(_0x3467('0x2'))('rpc');exports[_0x3467('0x3')]=function(_0x1170e6){var _0x108296=this;return new Promise(function(_0x6c4971,_0x6393fc){return db['Interval'][_0x3467('0x4')]({'raw':_0x1170e6[_0x3467('0x5')]?_0x1170e6['options'][_0x3467('0x6')]===undefined?!![]:![]:!![],'where':_0x1170e6[_0x3467('0x5')]?_0x1170e6[_0x3467('0x5')][_0x3467('0x7')]||null:null,'attributes':_0x1170e6[_0x3467('0x5')]?_0x1170e6[_0x3467('0x5')][_0x3467('0x8')]||null:null,'limit':_0x1170e6[_0x3467('0x5')]?_0x1170e6[_0x3467('0x5')][_0x3467('0x9')]||null:null,'include':_0x1170e6[_0x3467('0x5')]?_0x1170e6['options']['include']?_[_0x3467('0xa')](_0x1170e6[_0x3467('0x5')][_0x3467('0xb')],function(_0x54702d){return{'model':db[_0x54702d[_0x3467('0xc')]],'as':_0x54702d['as'],'attributes':_0x54702d[_0x3467('0x8')],'include':_0x54702d[_0x3467('0xb')]?_[_0x3467('0xa')](_0x54702d[_0x3467('0xb')],function(_0x306360){return{'model':db[_0x306360[_0x3467('0xc')]],'as':_0x306360['as'],'attributes':_0x306360[_0x3467('0x8')],'include':_0x306360[_0x3467('0xb')]?_['map'](_0x306360[_0x3467('0xb')],function(_0x2f014a){return{'model':db[_0x2f014a[_0x3467('0xc')]],'as':_0x2f014a['as'],'attributes':_0x2f014a[_0x3467('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33941f){logger[_0x3467('0xd')](_0x3467('0x3'),_0x1170e6);logger['debug'](_0x3467('0x3'),_0x1170e6,JSON['stringify'](_0x33941f));_0x6c4971(_0x33941f);})[_0x3467('0xe')](function(_0x57ad37){logger[_0x3467('0xf')](_0x3467('0x3'),_0x57ad37[_0x3467('0x10')],_0x1170e6);_0x6393fc(_0x108296[_0x3467('0xf')](0x1f4,_0x57ad37[_0x3467('0x10')]));});});};exports['ShowInterval']=function(_0x278eed){var _0x406443=this;return new Promise(function(_0x11bb12,_0x5db33f){return db['Interval'][_0x3467('0x11')]({'raw':_0x278eed[_0x3467('0x5')]?_0x278eed[_0x3467('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x278eed[_0x3467('0x5')]?_0x278eed[_0x3467('0x5')][_0x3467('0x7')]||null:null,'attributes':_0x278eed['options']?_0x278eed[_0x3467('0x5')][_0x3467('0x8')]||null:null,'include':_0x278eed[_0x3467('0x5')]?_0x278eed[_0x3467('0x5')]['include']?_[_0x3467('0xa')](_0x278eed[_0x3467('0x5')][_0x3467('0xb')],function(_0x559112){return{'model':db[_0x559112[_0x3467('0xc')]],'as':_0x559112['as'],'attributes':_0x559112[_0x3467('0x8')],'include':_0x559112[_0x3467('0xb')]?_['map'](_0x559112[_0x3467('0xb')],function(_0x3529f4){return{'model':db[_0x3529f4[_0x3467('0xc')]],'as':_0x3529f4['as'],'attributes':_0x3529f4[_0x3467('0x8')],'include':_0x3529f4['include']?_[_0x3467('0xa')](_0x3529f4[_0x3467('0xb')],function(_0x53a92c){return{'model':db[_0x53a92c[_0x3467('0xc')]],'as':_0x53a92c['as'],'attributes':_0x53a92c[_0x3467('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fec1e){logger['info'](_0x3467('0x12'),_0x278eed);logger[_0x3467('0x13')](_0x3467('0x12'),_0x278eed,JSON['stringify'](_0x2fec1e));_0x11bb12(_0x2fec1e);})[_0x3467('0xe')](function(_0x12d96a){logger[_0x3467('0xf')]('ShowInterval',_0x12d96a[_0x3467('0x10')],_0x278eed);_0x5db33f(_0x406443[_0x3467('0xf')](0x1f4,_0x12d96a['message']));});});};function checkArrayOfIntervals(_0x36875a,_0x3f69db){var _0x2b1a25=[];return db[_0x3467('0x14')][_0x3467('0x4')]({'where':{'id':_0x36875a}})['then'](function(_0xc5170a){_0x2b1a25=_0xc5170a;return Promise[_0x3467('0x15')](_0x2b1a25[_0x3467('0xa')](function(_0x3d3fb0){return _0x3d3fb0['ifTime'](_0x3f69db);}));})['then'](function(_0x1fd48d){var _0x3a6200=_0x1fd48d[_0x3467('0x16')](function(_0x1a1c49,_0x138f39){return _0x1a1c49||_0x138f39;},![]);logger['info'](util[_0x3467('0x17')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x2b1a25['map'](function(_0x5bad58){return _0x5bad58['name'];})[_0x3467('0x18')](',\x20'),_0x2b1a25[_0x3467('0xa')](function(_0x4546e9){return _0x4546e9['id'];})[_0x3467('0x18')](',\x20')));return _0x3a6200;});}function checkSingleInterval(_0x25b338,_0x4b2f07){return db[_0x3467('0x14')][_0x3467('0x19')](_0x25b338)[_0x3467('0x1a')](function(_0x31a34b){if(_0x31a34b){logger[_0x3467('0xd')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x31a34b['name'],_0x31a34b['id']));return _0x31a34b[_0x3467('0x1b')](_0x4b2f07);}});}exports['IntervalIftime']=function(_0x3c8693){var _0x51d399=_0x3c8693['intervalIds'];var _0x1f2bfb=Array[_0x3467('0x1c')](_0x3c8693['intervals'])?_0x3c8693['intervals']:typeof _0x3c8693[_0x3467('0x1d')]===_0x3467('0x1e')?[_0x3c8693['intervals']]:[];var _0x36f129=_0x3c8693[_0x3467('0x1f')]||undefined;var _0x5b7ec7=![];if(_0x1f2bfb[_0x3467('0x20')]){logger['info'](util[_0x3467('0x17')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x1f2bfb[_0x3467('0x18')](';\x20')));}if(_0x36f129){logger[_0x3467('0xd')](util['format'](_0x3467('0x21'),_0x36f129));}logger[_0x3467('0x13')](_0x3467('0x22'),_0x5b7ec7);logger[_0x3467('0x23')](_0x3467('0x24'),_0x3c8693);return Promise[_0x3467('0x25')]()[_0x3467('0x1a')](function(){if(Array['isArray'](_0x51d399)){return checkArrayOfIntervals(_0x51d399,_0x36f129);}else if(_0x51d399){return checkSingleInterval(_0x51d399,_0x36f129);}})[_0x3467('0x1a')](function(_0x343582){var _0x53079b=_0x1f2bfb['reduce'](function(_0x3086f6,_0x4b3e09){return _0x3086f6||iftime(_0x4b3e09,_0x36f129);},![]);_0x5b7ec7=_0x343582||_0x53079b;return _0x5b7ec7;})[_0x3467('0xe')](function(_0x45bcb8){logger['error'](_0x3467('0x24'),_0x3c8693,_0x45bcb8);throw this[_0x3467('0xf')](0x1f4,_0x45bcb8[_0x3467('0x10')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 06d6428..1b66e32 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x5ef0ae,_0x5a4316){var _0x19a792=function(_0x4a896c){while(--_0x4a896c){_0x5ef0ae['push'](_0x5ef0ae['shift']());}};_0x19a792(++_0x5a4316);}(_0x2ef3,0xba));var _0x32ef=function(_0x3820ee,_0x5ab0d4){_0x3820ee=_0x3820ee-0x0;var _0x33f612=_0x2ef3[_0x3820ee];return _0x33f612;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x10e3f9,_0x2fdaa4){var _0x1ddf9a=function(_0x3d9a5c){while(--_0x3d9a5c){_0x10e3f9['push'](_0x10e3f9['shift']());}};_0x1ddf9a(++_0x2fdaa4);}(_0x2ef3,0xba));var _0x32ef=function(_0x22d840,_0x2c502f){_0x22d840=_0x22d840-0x0;var _0x1fcc02=_0x2ef3[_0x22d840];return _0x1fcc02;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('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 d354588..a7b27ab 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 _0x5bab=['key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','api','3eAmWpBVP0'];(function(_0x6fae04,_0x33078d){var _0x546f87=function(_0xf771a0){while(--_0xf771a0){_0x6fae04['push'](_0x6fae04['shift']());}};_0x546f87(++_0x33078d);}(_0x5bab,0x139));var _0xb5ba=function(_0x319d8b,_0xb0cb14){_0x319d8b=_0x319d8b-0x0;var _0xfc4897=_0x5bab[_0x319d8b];return _0xfc4897;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require('../../config/logger')(_0xb5ba('0x0'));var USERNAME='support';var PASSWORD=_0xb5ba('0x1');function openIssue(_0x3568d0,_0x1d5217){var _0x4e8547={'fields':{'project':{'key':_0x3568d0[_0xb5ba('0x2')]||_0xb5ba('0x3')},'summary':(_0x3568d0[_0xb5ba('0x4')]||_0xb5ba('0x5'))+_0xb5ba('0x6')+_0x3568d0['ip'],'description':_0x3568d0[_0xb5ba('0x7')]||JSON[_0xb5ba('0x8')](_0x3568d0),'issuetype':{'name':_0x3568d0[_0xb5ba('0x9')]||_0xb5ba('0xa')}}};_0x4e8547[_0xb5ba('0xb')][_0xb5ba('0xc')]=_0x3568d0['email'];_0x4e8547[_0xb5ba('0xb')][_0xb5ba('0xd')]=_0x3568d0[_0xb5ba('0xe')];_0x4e8547[_0xb5ba('0xb')]['customfield_11502']=_0x3568d0[_0xb5ba('0xf')];_0x4e8547['fields'][_0xb5ba('0x10')]=_0x3568d0[_0xb5ba('0x11')];_0x4e8547[_0xb5ba('0xb')][_0xb5ba('0x12')]=_0x3568d0[_0xb5ba('0x13')];_0x4e8547[_0xb5ba('0xb')]['customfield_10102']=_0x3568d0['ip'];var _0x46dae7={'host':_0xb5ba('0x14'),'port':0x1bb,'path':_0xb5ba('0x15'),'method':_0xb5ba('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xb5ba('0x17'),'Authorization':_0xb5ba('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xb5ba('0x19')](_0xb5ba('0x1a'))}};var _0x24a0c2=JSON[_0xb5ba('0x8')](_0x4e8547);var _0x1f9a87=https[_0xb5ba('0x1b')](_0x46dae7,function(_0x158663){_0x158663['setEncoding']('utf8');var _0x1903de='';_0x158663['on']('data',function(_0x1b898c){_0x1903de+=_0x1b898c;});_0x158663['on'](_0xb5ba('0x1c'),function(){if(_0x1d5217){return _0x1d5217[_0xb5ba('0x1d')](_0x158663[_0xb5ba('0x1e')])[_0xb5ba('0x1f')](JSON[_0xb5ba('0x20')](_0x1903de));}});});_0x1f9a87['on'](_0xb5ba('0x21'),function(_0x5bdbfa){if(_0x1d5217){return _0x1d5217['status'](0x1f4)['json']({'errors':[{'message':_0xb5ba('0x22'),'type':_0xb5ba('0x23')}]});}});_0x1f9a87[_0xb5ba('0x24')](_0x24a0c2);_0x1f9a87['end']();}exports[_0xb5ba('0x25')]=openIssue;exports[_0xb5ba('0x26')]=function(_0x42f5f1,_0x1cb3c6){_0x42f5f1[_0xb5ba('0x27')]['ip']=_0x42f5f1[_0xb5ba('0x28')][_0xb5ba('0x29')]||_0x42f5f1[_0xb5ba('0x2a')]['remoteAddress']||_0x42f5f1[_0xb5ba('0x2b')]['remoteAddress']||_0x42f5f1['connection']['socket'][_0xb5ba('0x2c')];return openIssue(_0x42f5f1[_0xb5ba('0x27')],_0x1cb3c6);}; \ No newline at end of file +var _0x87b7=['customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','setEncoding','utf8','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','Bug','fields'];(function(_0x4ed9be,_0x1339fc){var _0x4a520a=function(_0x99965a){while(--_0x99965a){_0x4ed9be['push'](_0x4ed9be['shift']());}};_0x4a520a(++_0x1339fc);}(_0x87b7,0x14b));var _0x787b=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x87b7[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x787b('0x0'))(_0x787b('0x1'));var USERNAME=_0x787b('0x2');var PASSWORD=_0x787b('0x3');function openIssue(_0x39b24f,_0x1353d4){var _0x141564={'fields':{'project':{'key':_0x39b24f[_0x787b('0x4')]||_0x787b('0x5')},'summary':(_0x39b24f[_0x787b('0x6')]||'Report')+_0x787b('0x7')+_0x39b24f['ip'],'description':_0x39b24f[_0x787b('0x8')]||JSON[_0x787b('0x9')](_0x39b24f),'issuetype':{'name':_0x39b24f['issuetype']||_0x787b('0xa')}}};_0x141564[_0x787b('0xb')][_0x787b('0xc')]=_0x39b24f[_0x787b('0xd')];_0x141564['fields'][_0x787b('0xe')]=_0x39b24f[_0x787b('0xf')];_0x141564['fields'][_0x787b('0x10')]=_0x39b24f[_0x787b('0x11')];_0x141564[_0x787b('0xb')][_0x787b('0x12')]=_0x39b24f[_0x787b('0x13')];_0x141564[_0x787b('0xb')][_0x787b('0x14')]=_0x39b24f[_0x787b('0x15')];_0x141564[_0x787b('0xb')][_0x787b('0x16')]=_0x39b24f['ip'];var _0x5e0c59={'host':_0x787b('0x17'),'port':0x1bb,'path':_0x787b('0x18'),'method':_0x787b('0x19'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x787b('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x787b('0x1b')](_0x787b('0x1c'))}};var _0x8d75a2=JSON[_0x787b('0x9')](_0x141564);var _0x133dc6=https['request'](_0x5e0c59,function(_0x1fadfb){_0x1fadfb[_0x787b('0x1d')](_0x787b('0x1e'));var _0x27f4c8='';_0x1fadfb['on'](_0x787b('0x1f'),function(_0x4903a3){_0x27f4c8+=_0x4903a3;});_0x1fadfb['on']('end',function(){if(_0x1353d4){return _0x1353d4[_0x787b('0x20')](_0x1fadfb[_0x787b('0x21')])[_0x787b('0x22')](JSON[_0x787b('0x23')](_0x27f4c8));}});});_0x133dc6['on'](_0x787b('0x24'),function(_0x16b4c7){if(_0x1353d4){return _0x1353d4[_0x787b('0x20')](0x1f4)['json']({'errors':[{'message':_0x787b('0x25'),'type':_0x787b('0x26')}]});}});_0x133dc6[_0x787b('0x27')](_0x8d75a2);_0x133dc6[_0x787b('0x28')]();}exports[_0x787b('0x29')]=openIssue;exports[_0x787b('0x2a')]=function(_0x3f4ba9,_0x2ca653){_0x3f4ba9[_0x787b('0x2b')]['ip']=_0x3f4ba9[_0x787b('0x2c')][_0x787b('0x2d')]||_0x3f4ba9[_0x787b('0x2e')][_0x787b('0x2f')]||_0x3f4ba9['socket'][_0x787b('0x2f')]||_0x3f4ba9[_0x787b('0x2e')][_0x787b('0x30')]['remoteAddress'];return openIssue(_0x3f4ba9['body'],_0x2ca653);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 2ffc5ac..81389ef 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x58d217,_0x5acb1a){var _0x2774ac=function(_0x128afa){while(--_0x128afa){_0x58d217['push'](_0x58d217['shift']());}};_0x2774ac(++_0x5acb1a);}(_0xedd9,0xfc));var _0x9edd=function(_0x3ef951,_0xae273a){_0x3ef951=_0x3ef951-0x0;var _0x2e8659=_0xedd9[_0x3ef951];return _0x2e8659;};'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'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router['delete'](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x13')]);module[_0x9edd('0x14')]=router; \ No newline at end of file +var _0x4483=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x4483,0x1a3));var _0x3448=function(_0x1eb42d,_0x2a0328){_0x1eb42d=_0x1eb42d-0x0;var _0x42ddbb=_0x4483[_0x1eb42d];return _0x42ddbb;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0xf')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x11')](_0x3448('0x12'),auth[_0x3448('0xa')](),controller[_0x3448('0x13')]);router[_0x3448('0x14')](_0x3448('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x3448('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 64a559e..5db33b2 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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x1caf45,_0x2de2e5){_0x1caf45=_0x1caf45-0x0;var _0x1e3ce1=_0x7a54[_0x1caf45];return _0x1e3ce1;};'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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0xb8878b,_0x13a2ab){_0xb8878b=_0xb8878b-0x0;var _0x416c20=_0x7a54[_0xb8878b];return _0x416c20;};'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 7075a12..917aded 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 _0x0960=['offset','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','JscriptyAnswerReport','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','includeAll','include','rows','params','keys','rawAttributes','options','create','body','update','find','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count'];(function(_0x3fdd66,_0x1d905c){var _0x2dc3cc=function(_0x574afa){while(--_0x574afa){_0x3fdd66['push'](_0x3fdd66['shift']());}};_0x2dc3cc(++_0x1d905c);}(_0x0960,0xc2));var _0x0096=function(_0x427028,_0x10483b){_0x427028=_0x427028-0x0;var _0x1b6d69=_0x0960[_0x427028];return _0x1b6d69;};'use strict';var emlformat=require(_0x0096('0x0'));var rimraf=require(_0x0096('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0096('0x2'));var rp=require(_0x0096('0x3'));var moment=require(_0x0096('0x4'));var BPromise=require(_0x0096('0x5'));var Mustache=require(_0x0096('0x6'));var util=require(_0x0096('0x7'));var path=require(_0x0096('0x8'));var sox=require(_0x0096('0x9'));var csv=require(_0x0096('0xa'));var ejs=require(_0x0096('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0096('0xc'));var squel=require('squel');var crypto=require(_0x0096('0xd'));var jsforce=require(_0x0096('0xe'));var deskjs=require(_0x0096('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0096('0x10'));var Papa=require(_0x0096('0x11'));var Redis=require(_0x0096('0x12'));var authService=require(_0x0096('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0096('0x14'));var hardwareService=require(_0x0096('0x15'));var logger=require('../../config/logger')(_0x0096('0x16'));var utils=require('../../config/utils');var config=require(_0x0096('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0096('0x18'))['db'];function respondWithStatusCode(_0x25011c,_0x55678a){_0x55678a=_0x55678a||0xcc;return function(_0x2be406){if(_0x2be406){return _0x25011c[_0x0096('0x19')](_0x55678a);}return _0x25011c['status'](_0x55678a)['end']();};}function respondWithResult(_0x753d99,_0x39b6f6){_0x39b6f6=_0x39b6f6||0xc8;return function(_0x407361){if(_0x407361){return _0x753d99[_0x0096('0x1a')](_0x39b6f6)[_0x0096('0x1b')](_0x407361);}};}function respondWithFilteredResult(_0x5c901f,_0x590c96){return function(_0x19db10){if(_0x19db10){var _0x50c804=typeof _0x590c96['offset']===_0x0096('0x1c')&&typeof _0x590c96[_0x0096('0x1d')]==='undefined';var _0x7afa5f=_0x19db10[_0x0096('0x1e')];var _0x5468e2=_0x50c804?0x0:_0x590c96[_0x0096('0x1f')];var _0x27462a=_0x50c804?_0x19db10[_0x0096('0x1e')]:_0x590c96[_0x0096('0x1f')]+_0x590c96[_0x0096('0x1d')];var _0x507463;if(_0x27462a>=_0x7afa5f){_0x27462a=_0x7afa5f;_0x507463=0xc8;}else{_0x507463=0xce;}_0x5c901f[_0x0096('0x1a')](_0x507463);return _0x5c901f[_0x0096('0x20')](_0x0096('0x21'),_0x5468e2+'-'+_0x27462a+'/'+_0x7afa5f)['json'](_0x19db10);}return null;};}function patchUpdates(_0x1f5aad){return function(_0xef7a81){try{jsonpatch[_0x0096('0x22')](_0xef7a81,_0x1f5aad,!![]);}catch(_0x4e6338){return BPromise[_0x0096('0x23')](_0x4e6338);}return _0xef7a81[_0x0096('0x24')]();};}function saveUpdates(_0x4ac6f0,_0x263951){return function(_0x29b2c2){if(_0x29b2c2){return _0x29b2c2['update'](_0x4ac6f0)[_0x0096('0x25')](function(_0xfb20d0){return _0xfb20d0;});}return null;};}function removeEntity(_0x1a8e0e,_0x5ee101){return function(_0x224748){if(_0x224748){return _0x224748[_0x0096('0x26')]()[_0x0096('0x25')](function(){_0x1a8e0e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x569a7e,_0x2ea1df){return function(_0x1a6df7){if(!_0x1a6df7){_0x569a7e['sendStatus'](0x194);}return _0x1a6df7;};}function handleError(_0x47abff,_0x230d46){_0x230d46=_0x230d46||0x1f4;return function(_0x3eac07){logger['error'](_0x3eac07['stack']);if(_0x3eac07[_0x0096('0x27')]){delete _0x3eac07[_0x0096('0x27')];}_0x47abff['status'](_0x230d46)[_0x0096('0x28')](_0x3eac07);};}exports[_0x0096('0x29')]=function(_0x204002,_0x205b79){var _0x102346={},_0x48e20f={},_0x511806={'count':0x0,'rows':[]};var _0x3b842b=_[_0x0096('0x2a')](db[_0x0096('0x2b')]['rawAttributes'],function(_0x593074){return{'name':_0x593074[_0x0096('0x2c')],'type':_0x593074['type'][_0x0096('0x2d')]};});_0x48e20f[_0x0096('0x2e')]=_[_0x0096('0x2a')](_0x3b842b,_0x0096('0x27'));_0x48e20f['query']=_['keys'](_0x204002[_0x0096('0x2f')]);_0x48e20f['filters']=_[_0x0096('0x30')](_0x48e20f[_0x0096('0x2e')],_0x48e20f[_0x0096('0x2f')]);_0x102346[_0x0096('0x31')]=_[_0x0096('0x30')](_0x48e20f[_0x0096('0x2e')],qs[_0x0096('0x32')](_0x204002[_0x0096('0x2f')][_0x0096('0x32')]));_0x102346[_0x0096('0x31')]=_0x102346[_0x0096('0x31')][_0x0096('0x33')]?_0x102346['attributes']:_0x48e20f[_0x0096('0x2e')];if(!_0x204002[_0x0096('0x2f')][_0x0096('0x34')](_0x0096('0x35'))){_0x102346[_0x0096('0x1d')]=qs[_0x0096('0x1d')](_0x204002[_0x0096('0x2f')]['limit']);_0x102346[_0x0096('0x1f')]=qs[_0x0096('0x1f')](_0x204002[_0x0096('0x2f')][_0x0096('0x1f')]);}_0x102346[_0x0096('0x36')]=qs[_0x0096('0x37')](_0x204002[_0x0096('0x2f')][_0x0096('0x37')]);_0x102346[_0x0096('0x38')]=qs[_0x0096('0x39')](_[_0x0096('0x3a')](_0x204002[_0x0096('0x2f')],_0x48e20f['filters']),_0x3b842b);if(_0x204002[_0x0096('0x2f')]['filter']){_0x102346[_0x0096('0x38')]=_['merge'](_0x102346['where'],{'$or':_[_0x0096('0x2a')](_0x3b842b,function(_0x179496){if(_0x179496[_0x0096('0x3b')]!==_0x0096('0x3c')){var _0x157a61={};_0x157a61[_0x179496['name']]={'$like':'%'+_0x204002[_0x0096('0x2f')][_0x0096('0x3d')]+'%'};return _0x157a61;}})});}_0x102346=_['merge']({},_0x102346,_0x204002['options']);var _0x505ede={'where':_0x102346[_0x0096('0x38')]};return db[_0x0096('0x2b')][_0x0096('0x1e')](_0x505ede)[_0x0096('0x25')](function(_0x5722b6){_0x511806[_0x0096('0x1e')]=_0x5722b6;if(_0x204002[_0x0096('0x2f')][_0x0096('0x3e')]){_0x102346[_0x0096('0x3f')]=[{'all':!![]}];}return db[_0x0096('0x2b')]['findAll'](_0x102346);})[_0x0096('0x25')](function(_0x2dccba){_0x511806[_0x0096('0x40')]=_0x2dccba;return _0x511806;})[_0x0096('0x25')](respondWithFilteredResult(_0x205b79,_0x102346))['catch'](handleError(_0x205b79,null));};exports['show']=function(_0x4b4ab7,_0x12d010){var _0x543e14={'raw':!![],'where':{'id':_0x4b4ab7[_0x0096('0x41')]['id']}},_0x31f7c0={};_0x31f7c0[_0x0096('0x2e')]=_[_0x0096('0x42')](db['JscriptyAnswerReport'][_0x0096('0x43')]);_0x31f7c0[_0x0096('0x2f')]=_[_0x0096('0x42')](_0x4b4ab7[_0x0096('0x2f')]);_0x31f7c0[_0x0096('0x39')]=_[_0x0096('0x30')](_0x31f7c0['model'],_0x31f7c0[_0x0096('0x2f')]);_0x543e14['attributes']=_[_0x0096('0x30')](_0x31f7c0[_0x0096('0x2e')],qs[_0x0096('0x32')](_0x4b4ab7['query'][_0x0096('0x32')]));_0x543e14[_0x0096('0x31')]=_0x543e14[_0x0096('0x31')]['length']?_0x543e14[_0x0096('0x31')]:_0x31f7c0[_0x0096('0x2e')];if(_0x4b4ab7['query'][_0x0096('0x3e')]){_0x543e14[_0x0096('0x3f')]=[{'all':!![]}];}_0x543e14=_['merge']({},_0x543e14,_0x4b4ab7[_0x0096('0x44')]);return db[_0x0096('0x2b')]['find'](_0x543e14)[_0x0096('0x25')](handleEntityNotFound(_0x12d010,null))[_0x0096('0x25')](respondWithResult(_0x12d010,null))['catch'](handleError(_0x12d010,null));};exports['create']=function(_0x34cc4d,_0x18baac){return db['JscriptyAnswerReport'][_0x0096('0x45')](_0x34cc4d[_0x0096('0x46')],{})['then'](respondWithResult(_0x18baac,0xc9))['catch'](handleError(_0x18baac,null));};exports[_0x0096('0x47')]=function(_0x392ca0,_0x29993c){if(_0x392ca0[_0x0096('0x46')]['id']){delete _0x392ca0[_0x0096('0x46')]['id'];}return db[_0x0096('0x2b')][_0x0096('0x48')]({'where':{'id':_0x392ca0[_0x0096('0x41')]['id']}})[_0x0096('0x25')](handleEntityNotFound(_0x29993c,null))[_0x0096('0x25')](saveUpdates(_0x392ca0['body'],null))['then'](respondWithResult(_0x29993c,null))[_0x0096('0x49')](handleError(_0x29993c,null));};exports[_0x0096('0x26')]=function(_0x2f5f2f,_0x7fc578){return db[_0x0096('0x2b')]['find']({'where':{'id':_0x2f5f2f[_0x0096('0x41')]['id']}})[_0x0096('0x25')](handleEntityNotFound(_0x7fc578,null))[_0x0096('0x25')](removeEntity(_0x7fc578,null))[_0x0096('0x49')](handleError(_0x7fc578,null));};exports['describe']=function(_0x56a7c8,_0x425f60){return db[_0x0096('0x2b')][_0x0096('0x4a')]()[_0x0096('0x25')](respondWithResult(_0x425f60,null))[_0x0096('0x49')](handleError(_0x425f60,null));}; \ No newline at end of file +var _0xdb8b=['apply','reject','save','update','then','destroy','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','catch','show','include','find','body','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','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/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x582011,_0x10a134){var _0x1b215e=function(_0x3f19ae){while(--_0x3f19ae){_0x582011['push'](_0x582011['shift']());}};_0x1b215e(++_0x10a134);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x450a18,_0x43dcb8){_0x450a18=_0x450a18-0x0;var _0x2afe7a=_0xdb8b[_0x450a18];return _0x2afe7a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbdb8('0x0'));var zipdir=require(_0xbdb8('0x1'));var jsonpatch=require(_0xbdb8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbdb8('0x3'));var Mustache=require('mustache');var util=require(_0xbdb8('0x4'));var path=require(_0xbdb8('0x5'));var sox=require(_0xbdb8('0x6'));var csv=require(_0xbdb8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbdb8('0x8'));var _=require('lodash');var squel=require(_0xbdb8('0x9'));var crypto=require(_0xbdb8('0xa'));var jsforce=require(_0xbdb8('0xb'));var deskjs=require(_0xbdb8('0xc'));var toCsv=require(_0xbdb8('0x7'));var querystring=require(_0xbdb8('0xd'));var Papa=require('papaparse');var Redis=require(_0xbdb8('0xe'));var authService=require(_0xbdb8('0xf'));var qs=require(_0xbdb8('0x10'));var as=require(_0xbdb8('0x11'));var hardwareService=require(_0xbdb8('0x12'));var logger=require(_0xbdb8('0x13'))(_0xbdb8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbdb8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x74d1a,_0x5ad84f){_0x5ad84f=_0x5ad84f||0xcc;return function(_0x3c520b){if(_0x3c520b){return _0x74d1a['sendStatus'](_0x5ad84f);}return _0x74d1a[_0xbdb8('0x16')](_0x5ad84f)[_0xbdb8('0x17')]();};}function respondWithResult(_0x1e8888,_0x407bd0){_0x407bd0=_0x407bd0||0xc8;return function(_0x20984d){if(_0x20984d){return _0x1e8888[_0xbdb8('0x16')](_0x407bd0)[_0xbdb8('0x18')](_0x20984d);}};}function respondWithFilteredResult(_0x207187,_0x149568){return function(_0xcf6e71){if(_0xcf6e71){var _0x3d583b=typeof _0x149568[_0xbdb8('0x19')]===_0xbdb8('0x1a')&&typeof _0x149568['limit']===_0xbdb8('0x1a');var _0x3fc32f=_0xcf6e71[_0xbdb8('0x1b')];var _0x5e5330=_0x3d583b?0x0:_0x149568['offset'];var _0x133800=_0x3d583b?_0xcf6e71['count']:_0x149568[_0xbdb8('0x19')]+_0x149568[_0xbdb8('0x1c')];var _0xb496f8;if(_0x133800>=_0x3fc32f){_0x133800=_0x3fc32f;_0xb496f8=0xc8;}else{_0xb496f8=0xce;}_0x207187[_0xbdb8('0x16')](_0xb496f8);return _0x207187[_0xbdb8('0x1d')](_0xbdb8('0x1e'),_0x5e5330+'-'+_0x133800+'/'+_0x3fc32f)[_0xbdb8('0x18')](_0xcf6e71);}return null;};}function patchUpdates(_0x437095){return function(_0x3cc214){try{jsonpatch[_0xbdb8('0x1f')](_0x3cc214,_0x437095,!![]);}catch(_0x39cfb9){return BPromise[_0xbdb8('0x20')](_0x39cfb9);}return _0x3cc214[_0xbdb8('0x21')]();};}function saveUpdates(_0x25b131,_0x2074e0){return function(_0x3588ee){if(_0x3588ee){return _0x3588ee[_0xbdb8('0x22')](_0x25b131)[_0xbdb8('0x23')](function(_0x1e9398){return _0x1e9398;});}return null;};}function removeEntity(_0x9c0aa0,_0x2a31e6){return function(_0x50c6db){if(_0x50c6db){return _0x50c6db[_0xbdb8('0x24')]()['then'](function(){_0x9c0aa0[_0xbdb8('0x16')](0xcc)[_0xbdb8('0x17')]();});}};}function handleEntityNotFound(_0x4e9e42,_0x1da624){return function(_0x38709a){if(!_0x38709a){_0x4e9e42['sendStatus'](0x194);}return _0x38709a;};}function handleError(_0x6bff1b,_0x453dbb){_0x453dbb=_0x453dbb||0x1f4;return function(_0x1985d1){logger[_0xbdb8('0x25')](_0x1985d1[_0xbdb8('0x26')]);if(_0x1985d1[_0xbdb8('0x27')]){delete _0x1985d1[_0xbdb8('0x27')];}_0x6bff1b['status'](_0x453dbb)[_0xbdb8('0x28')](_0x1985d1);};}exports['index']=function(_0x4d2103,_0x369aed){var _0xdb9223={},_0x459231={},_0x321139={'count':0x0,'rows':[]};var _0x4bc79c=_[_0xbdb8('0x29')](db[_0xbdb8('0x2a')][_0xbdb8('0x2b')],function(_0x477c83){return{'name':_0x477c83['fieldName'],'type':_0x477c83[_0xbdb8('0x2c')][_0xbdb8('0x2d')]};});_0x459231[_0xbdb8('0x2e')]=_[_0xbdb8('0x29')](_0x4bc79c,_0xbdb8('0x27'));_0x459231[_0xbdb8('0x2f')]=_[_0xbdb8('0x30')](_0x4d2103['query']);_0x459231[_0xbdb8('0x31')]=_[_0xbdb8('0x32')](_0x459231['model'],_0x459231['query']);_0xdb9223[_0xbdb8('0x33')]=_[_0xbdb8('0x32')](_0x459231[_0xbdb8('0x2e')],qs['fields'](_0x4d2103[_0xbdb8('0x2f')][_0xbdb8('0x34')]));_0xdb9223[_0xbdb8('0x33')]=_0xdb9223[_0xbdb8('0x33')]['length']?_0xdb9223[_0xbdb8('0x33')]:_0x459231['model'];if(!_0x4d2103['query'][_0xbdb8('0x35')](_0xbdb8('0x36'))){_0xdb9223['limit']=qs[_0xbdb8('0x1c')](_0x4d2103['query'][_0xbdb8('0x1c')]);_0xdb9223[_0xbdb8('0x19')]=qs['offset'](_0x4d2103[_0xbdb8('0x2f')][_0xbdb8('0x19')]);}_0xdb9223[_0xbdb8('0x37')]=qs[_0xbdb8('0x38')](_0x4d2103['query'][_0xbdb8('0x38')]);_0xdb9223[_0xbdb8('0x39')]=qs[_0xbdb8('0x31')](_['pick'](_0x4d2103['query'],_0x459231[_0xbdb8('0x31')]),_0x4bc79c);if(_0x4d2103[_0xbdb8('0x2f')]['filter']){_0xdb9223['where']=_['merge'](_0xdb9223[_0xbdb8('0x39')],{'$or':_[_0xbdb8('0x29')](_0x4bc79c,function(_0x2f1c00){if(_0x2f1c00['type']!==_0xbdb8('0x3a')){var _0x89b5cf={};_0x89b5cf[_0x2f1c00['name']]={'$like':'%'+_0x4d2103['query'][_0xbdb8('0x3b')]+'%'};return _0x89b5cf;}})});}_0xdb9223=_[_0xbdb8('0x3c')]({},_0xdb9223,_0x4d2103[_0xbdb8('0x3d')]);var _0x32d38c={'where':_0xdb9223['where']};return db[_0xbdb8('0x2a')]['count'](_0x32d38c)[_0xbdb8('0x23')](function(_0x531338){_0x321139[_0xbdb8('0x1b')]=_0x531338;if(_0x4d2103[_0xbdb8('0x2f')]['includeAll']){_0xdb9223['include']=[{'all':!![]}];}return db[_0xbdb8('0x2a')]['findAll'](_0xdb9223);})[_0xbdb8('0x23')](function(_0x3006a1){_0x321139['rows']=_0x3006a1;return _0x321139;})[_0xbdb8('0x23')](respondWithFilteredResult(_0x369aed,_0xdb9223))[_0xbdb8('0x3e')](handleError(_0x369aed,null));};exports[_0xbdb8('0x3f')]=function(_0x43f480,_0x3a51db){var _0x3d9c75={'raw':!![],'where':{'id':_0x43f480['params']['id']}},_0x1b1500={};_0x1b1500['model']=_[_0xbdb8('0x30')](db[_0xbdb8('0x2a')][_0xbdb8('0x2b')]);_0x1b1500['query']=_[_0xbdb8('0x30')](_0x43f480[_0xbdb8('0x2f')]);_0x1b1500[_0xbdb8('0x31')]=_[_0xbdb8('0x32')](_0x1b1500[_0xbdb8('0x2e')],_0x1b1500[_0xbdb8('0x2f')]);_0x3d9c75[_0xbdb8('0x33')]=_[_0xbdb8('0x32')](_0x1b1500['model'],qs[_0xbdb8('0x34')](_0x43f480[_0xbdb8('0x2f')][_0xbdb8('0x34')]));_0x3d9c75[_0xbdb8('0x33')]=_0x3d9c75[_0xbdb8('0x33')]['length']?_0x3d9c75[_0xbdb8('0x33')]:_0x1b1500[_0xbdb8('0x2e')];if(_0x43f480[_0xbdb8('0x2f')]['includeAll']){_0x3d9c75[_0xbdb8('0x40')]=[{'all':!![]}];}_0x3d9c75=_[_0xbdb8('0x3c')]({},_0x3d9c75,_0x43f480[_0xbdb8('0x3d')]);return db['JscriptyAnswerReport'][_0xbdb8('0x41')](_0x3d9c75)[_0xbdb8('0x23')](handleEntityNotFound(_0x3a51db,null))[_0xbdb8('0x23')](respondWithResult(_0x3a51db,null))[_0xbdb8('0x3e')](handleError(_0x3a51db,null));};exports['create']=function(_0x3c43c8,_0x537395){return db[_0xbdb8('0x2a')]['create'](_0x3c43c8[_0xbdb8('0x42')],{})[_0xbdb8('0x23')](respondWithResult(_0x537395,0xc9))[_0xbdb8('0x3e')](handleError(_0x537395,null));};exports[_0xbdb8('0x22')]=function(_0x5cbe97,_0x8cef64){if(_0x5cbe97[_0xbdb8('0x42')]['id']){delete _0x5cbe97[_0xbdb8('0x42')]['id'];}return db[_0xbdb8('0x2a')][_0xbdb8('0x41')]({'where':{'id':_0x5cbe97['params']['id']}})[_0xbdb8('0x23')](handleEntityNotFound(_0x8cef64,null))[_0xbdb8('0x23')](saveUpdates(_0x5cbe97['body'],null))[_0xbdb8('0x23')](respondWithResult(_0x8cef64,null))[_0xbdb8('0x3e')](handleError(_0x8cef64,null));};exports[_0xbdb8('0x24')]=function(_0x527bb8,_0x543d3c){return db[_0xbdb8('0x2a')][_0xbdb8('0x41')]({'where':{'id':_0x527bb8[_0xbdb8('0x43')]['id']}})[_0xbdb8('0x23')](handleEntityNotFound(_0x543d3c,null))[_0xbdb8('0x23')](removeEntity(_0x543d3c,null))['catch'](handleError(_0x543d3c,null));};exports[_0xbdb8('0x44')]=function(_0x3944cf,_0x2b1e0f){return db[_0xbdb8('0x2a')][_0xbdb8('0x44')]()[_0xbdb8('0x23')](respondWithResult(_0x2b1e0f,null))[_0xbdb8('0x3e')](handleError(_0x2b1e0f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index c0a7222..756d329 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 _0x1370=['./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x18f69a,_0x217962){var _0x4057fd=function(_0x2d650d){while(--_0x2d650d){_0x18f69a['push'](_0x18f69a['shift']());}};_0x4057fd(++_0x217962);}(_0x1370,0xfb));var _0x0137=function(_0x34f0fb,_0x3323b2){_0x34f0fb=_0x34f0fb-0x0;var _0x9b7b2b=_0x1370[_0x34f0fb];return _0x9b7b2b;};'use strict';var _=require(_0x0137('0x0'));var util=require(_0x0137('0x1'));var logger=require(_0x0137('0x2'))(_0x0137('0x3'));var moment=require(_0x0137('0x4'));var BPromise=require(_0x0137('0x5'));var rp=require(_0x0137('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0137('0x7'));var config=require(_0x0137('0x8'));var attributes=require(_0x0137('0x9'));module[_0x0137('0xa')]=function(_0x116103,_0x542cad){return _0x116103[_0x0137('0xb')](_0x0137('0xc'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4764=['../../config/logger','api','moment','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util'];(function(_0x50d8f3,_0x13ff72){var _0x34bbf0=function(_0x50a60b){while(--_0x50a60b){_0x50d8f3['push'](_0x50d8f3['shift']());}};_0x34bbf0(++_0x13ff72);}(_0x4764,0x15e));var _0x4476=function(_0x1a3a74,_0x41959a){_0x1a3a74=_0x1a3a74-0x0;var _0x19f346=_0x4764[_0x1a3a74];return _0x19f346;};'use strict';var _=require(_0x4476('0x0'));var util=require(_0x4476('0x1'));var logger=require(_0x4476('0x2'))(_0x4476('0x3'));var moment=require(_0x4476('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4476('0x5'));var rimraf=require(_0x4476('0x6'));var config=require('../../config/environment');var attributes=require(_0x4476('0x7'));module[_0x4476('0x8')]=function(_0x5cc3a5,_0x3f37ed){return _0x5cc3a5[_0x4476('0x9')]('JscriptyAnswerReport',attributes,{'tableName':_0x4476('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 987d61d..8f54a7d 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 _0xeb5d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash'];(function(_0x598a1c,_0x4e8629){var _0x416507=function(_0x2ab598){while(--_0x2ab598){_0x598a1c['push'](_0x598a1c['shift']());}};_0x416507(++_0x4e8629);}(_0xeb5d,0xef));var _0xdeb5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xeb5d[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xdeb5('0x0'));var util=require(_0xdeb5('0x1'));var moment=require(_0xdeb5('0x2'));var BPromise=require(_0xdeb5('0x3'));var rs=require(_0xdeb5('0x4'));var fs=require('fs');var Redis=require(_0xdeb5('0x5'));var db=require(_0xdeb5('0x6'))['db'];var utils=require(_0xdeb5('0x7'));var logger=require(_0xdeb5('0x8'))(_0xdeb5('0x9'));var config=require(_0xdeb5('0xa'));var jayson=require(_0xdeb5('0xb'));var client=jayson[_0xdeb5('0xc')][_0xdeb5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38b20a,_0x367eca,_0x5db987){return new BPromise(function(_0x26ec0c,_0x6301da){return client[_0xdeb5('0xe')](_0x38b20a,_0x5db987)['then'](function(_0x2c9ac6){logger[_0xdeb5('0xf')](_0xdeb5('0x10'),_0x367eca,_0xdeb5('0x11'));logger[_0xdeb5('0x12')](_0xdeb5('0x13'),_0x367eca,_0xdeb5('0x11'),JSON['stringify'](_0x2c9ac6));if(_0x2c9ac6[_0xdeb5('0x14')]){if(_0x2c9ac6[_0xdeb5('0x14')][_0xdeb5('0x15')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x367eca,_0x2c9ac6[_0xdeb5('0x14')][_0xdeb5('0x16')]);return _0x6301da(_0x2c9ac6[_0xdeb5('0x14')]['message']);}logger[_0xdeb5('0x14')](_0xdeb5('0x10'),_0x367eca,_0x2c9ac6[_0xdeb5('0x14')][_0xdeb5('0x16')]);return _0x26ec0c(_0x2c9ac6[_0xdeb5('0x14')][_0xdeb5('0x16')]);}else{logger['info'](_0xdeb5('0x10'),_0x367eca,'request\x20sent');_0x26ec0c(_0x2c9ac6['result'][_0xdeb5('0x16')]);}})[_0xdeb5('0x17')](function(_0x4174d5){logger[_0xdeb5('0x14')](_0xdeb5('0x10'),_0x367eca,_0x4174d5);_0x6301da(_0x4174d5);});});} \ No newline at end of file +var _0xf0b1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','JscriptyAnswerReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x58da8a,_0x1c0584){var _0x5ba3a3=function(_0x31552b){while(--_0x31552b){_0x58da8a['push'](_0x58da8a['shift']());}};_0x5ba3a3(++_0x1c0584);}(_0xf0b1,0x13c));var _0x1f0b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xf0b1[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x1f0b('0x0'));var util=require(_0x1f0b('0x1'));var moment=require(_0x1f0b('0x2'));var BPromise=require(_0x1f0b('0x3'));var rs=require(_0x1f0b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f0b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f0b('0x6'))(_0x1f0b('0x7'));var config=require(_0x1f0b('0x8'));var jayson=require(_0x1f0b('0x9'));var client=jayson[_0x1f0b('0xa')][_0x1f0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x470288,_0x3f333e,_0xef6bfe){return new BPromise(function(_0x49bd22,_0x404cfd){return client[_0x1f0b('0xc')](_0x470288,_0xef6bfe)[_0x1f0b('0xd')](function(_0x40d63d){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3f333e,_0x1f0b('0xe'));logger[_0x1f0b('0xf')](_0x1f0b('0x10'),_0x3f333e,'request\x20sent',JSON['stringify'](_0x40d63d));if(_0x40d63d[_0x1f0b('0x11')]){if(_0x40d63d[_0x1f0b('0x11')]['code']===0x1f4){logger['error'](_0x1f0b('0x12'),_0x3f333e,_0x40d63d[_0x1f0b('0x11')][_0x1f0b('0x13')]);return _0x404cfd(_0x40d63d[_0x1f0b('0x11')][_0x1f0b('0x13')]);}logger[_0x1f0b('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3f333e,_0x40d63d['error'][_0x1f0b('0x13')]);return _0x49bd22(_0x40d63d[_0x1f0b('0x11')][_0x1f0b('0x13')]);}else{logger[_0x1f0b('0x14')](_0x1f0b('0x12'),_0x3f333e,'request\x20sent');_0x49bd22(_0x40d63d[_0x1f0b('0x15')][_0x1f0b('0x13')]);}})[_0x1f0b('0x16')](function(_0x4129b6){logger['error'](_0x1f0b('0x12'),_0x3f333e,_0x4129b6);_0x404cfd(_0x4129b6);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 21d3cfe..795c99b 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 _0x3c86=['/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','get','show','getSessions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c86,0x11c));var _0x63c8=function(_0x1cba47,_0x37b9ea){_0x1cba47=_0x1cba47-0x0;var _0x26d7af=_0x3c86[_0x1cba47];return _0x26d7af;};'use strict';var multer=require(_0x63c8('0x0'));var util=require(_0x63c8('0x1'));var path=require(_0x63c8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x63c8('0x3')]();var fs_extra=require(_0x63c8('0x4'));var auth=require(_0x63c8('0x5'));var interaction=require(_0x63c8('0x6'));var config=require(_0x63c8('0x7'));var controller=require(_0x63c8('0x8'));router['get']('/',auth[_0x63c8('0x9')](),controller['index']);router[_0x63c8('0xa')]('/:id',auth[_0x63c8('0x9')](),controller[_0x63c8('0xb')]);router[_0x63c8('0xa')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x63c8('0xc')]);router[_0x63c8('0xa')](_0x63c8('0xd'),auth['isAuthenticated'](),controller[_0x63c8('0xe')]);router[_0x63c8('0xa')](_0x63c8('0xf'),auth['isAuthenticated'](),timeout(_0x63c8('0x10')),controller[_0x63c8('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x63c8('0x12')]);router[_0x63c8('0x13')](_0x63c8('0x14'),auth['isAuthenticated'](),controller[_0x63c8('0x15')]);router[_0x63c8('0x16')](_0x63c8('0x17'),auth[_0x63c8('0x9')](),controller[_0x63c8('0x18')]);router[_0x63c8('0x19')](_0x63c8('0x17'),auth[_0x63c8('0x9')](),controller['destroy']);module[_0x63c8('0x1a')]=router; \ No newline at end of file +var _0x916a=['getSessions','/:id/answers','30s','getSummary','post','clone','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','get','show','/:id/sessions'];(function(_0x7627bf,_0x4c07f2){var _0x84bfac=function(_0x163cd5){while(--_0x163cd5){_0x7627bf['push'](_0x7627bf['shift']());}};_0x84bfac(++_0x4c07f2);}(_0x916a,0x70));var _0xa916=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0x916a[_0x1e48d3];return _0x2852b1;};'use strict';var multer=require(_0xa916('0x0'));var util=require('util');var path=require(_0xa916('0x1'));var timeout=require(_0xa916('0x2'));var express=require(_0xa916('0x3'));var router=express['Router']();var fs_extra=require(_0xa916('0x4'));var auth=require(_0xa916('0x5'));var interaction=require(_0xa916('0x6'));var config=require(_0xa916('0x7'));var controller=require(_0xa916('0x8'));router['get']('/',auth[_0xa916('0x9')](),controller['index']);router[_0xa916('0xa')]('/:id',auth[_0xa916('0x9')](),controller[_0xa916('0xb')]);router[_0xa916('0xa')](_0xa916('0xc'),auth['isAuthenticated'](),controller[_0xa916('0xd')]);router[_0xa916('0xa')](_0xa916('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router['get']('/:id/summary',auth[_0xa916('0x9')](),timeout(_0xa916('0xf')),controller[_0xa916('0x10')]);router[_0xa916('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa916('0x11')]('/:id/clone',auth[_0xa916('0x9')](),controller[_0xa916('0x12')]);router[_0xa916('0x13')](_0xa916('0x14'),auth[_0xa916('0x9')](),controller[_0xa916('0x15')]);router[_0xa916('0x16')](_0xa916('0x14'),auth['isAuthenticated'](),controller[_0xa916('0x17')]);module[_0xa916('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index fae1660..2799a09 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 _0x8dc6=['util','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','formData','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0x54a5db,_0x4ed287){var _0x47a5fc=function(_0xc059b0){while(--_0xc059b0){_0x54a5db['push'](_0x54a5db['shift']());}};_0x47a5fc(++_0x4ed287);}(_0x8dc6,0x98));var _0x68dc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8dc6[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x68dc('0x0'));var _=require(_0x68dc('0x1'));var util=require(_0x68dc('0x2'));module['exports']={'name':{'type':Sequelize[_0x68dc('0x3')],'unique':_0x68dc('0x4')},'description':{'type':Sequelize[_0x68dc('0x3')]},'formData':{'type':Sequelize[_0x68dc('0x5')](_0x68dc('0x6')),'set':function(_0x40d67e){if(_[_0x68dc('0x7')](_0x40d67e)){this[_0x68dc('0x8')]('formData',JSON[_0x68dc('0x9')](_0x40d67e));}else if(_['isString'](_0x40d67e)){this['setDataValue'](_0x68dc('0xa'),_0x40d67e);}else{this['setDataValue'](_0x68dc('0xa'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x68dc('0xb')](_0x68dc('0x4'))||'',this['getDataValue'](_0x68dc('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x68dc('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x41fc=['isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name','getDataValue','BOOLEAN','sequelize','util','STRING','setDataValue','formData'];(function(_0x40f154,_0x22a66d){var _0x3f900a=function(_0x4cf737){while(--_0x4cf737){_0x40f154['push'](_0x40f154['shift']());}};_0x3f900a(++_0x22a66d);}(_0x41fc,0x181));var _0xc41f=function(_0x36a260,_0x4566cf){_0x36a260=_0x36a260-0x0;var _0x261bb3=_0x41fc[_0x36a260];return _0x261bb3;};'use strict';var Sequelize=require(_0xc41f('0x0'));var _=require('lodash');var util=require(_0xc41f('0x1'));module['exports']={'name':{'type':Sequelize[_0xc41f('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x2f08bc){if(_['isObjectLike'](_0x2f08bc)){this[_0xc41f('0x3')](_0xc41f('0x4'),JSON['stringify'](_0x2f08bc));}else if(_[_0xc41f('0x5')](_0x2f08bc)){this[_0xc41f('0x3')](_0xc41f('0x4'),_0x2f08bc);}else{this[_0xc41f('0x3')]('formData',util['format'](_0xc41f('0x6'),this['getDataValue'](_0xc41f('0x7'))||'',this[_0xc41f('0x8')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc41f('0x9')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xc41f('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 5c5ea0b..4f0cd36 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 _0x7d25=['fromCharCode','toString','indexOf','replace','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','to-csv','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','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','updatedAt','body','getSessions','JscriptySessionReport','nolimit','order','ProjectId','findAll','getAnswers','findOne','JscriptyAnswerReport','number'];(function(_0x4abf9f,_0x5edac3){var _0x513755=function(_0x1e675f){while(--_0x1e675f){_0x4abf9f['push'](_0x4abf9f['shift']());}};_0x513755(++_0x5edac3);}(_0x7d25,0x8a));var _0x57d2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7d25[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];function respondWithStatusCode(_0x43d7fb,_0x32c33a){_0x32c33a=_0x32c33a||0xcc;return function(_0x28428b){if(_0x28428b){return _0x43d7fb[_0x57d2('0x17')](_0x32c33a);}return _0x43d7fb[_0x57d2('0x18')](_0x32c33a)[_0x57d2('0x19')]();};}function respondWithResult(_0x1ba57e,_0x4086f3){_0x4086f3=_0x4086f3||0xc8;return function(_0x5382d9){if(_0x5382d9){return _0x1ba57e['status'](_0x4086f3)[_0x57d2('0x1a')](_0x5382d9);}};}function respondWithFilteredResult(_0x148ef3,_0x4ec4b1){return function(_0x8cf637){if(_0x8cf637){var _0x319489=typeof _0x4ec4b1['offset']===_0x57d2('0x1b')&&typeof _0x4ec4b1['limit']===_0x57d2('0x1b');var _0x4b4fe0=_0x8cf637[_0x57d2('0x1c')];var _0x7d4cf1=_0x319489?0x0:_0x4ec4b1[_0x57d2('0x1d')];var _0x4a94e3=_0x319489?_0x8cf637['count']:_0x4ec4b1[_0x57d2('0x1d')]+_0x4ec4b1[_0x57d2('0x1e')];var _0x2662cd;if(_0x4a94e3>=_0x4b4fe0){_0x4a94e3=_0x4b4fe0;_0x2662cd=0xc8;}else{_0x2662cd=0xce;}_0x148ef3[_0x57d2('0x18')](_0x2662cd);return _0x148ef3['set'](_0x57d2('0x1f'),_0x7d4cf1+'-'+_0x4a94e3+'/'+_0x4b4fe0)[_0x57d2('0x1a')](_0x8cf637);}return null;};}function patchUpdates(_0x55191e){return function(_0x5f3fd5){try{jsonpatch[_0x57d2('0x20')](_0x5f3fd5,_0x55191e,!![]);}catch(_0x326d49){return BPromise[_0x57d2('0x21')](_0x326d49);}return _0x5f3fd5[_0x57d2('0x22')]();};}function saveUpdates(_0x386196,_0x803c25){return function(_0x32c7c8){if(_0x32c7c8){return _0x32c7c8[_0x57d2('0x23')](_0x386196)[_0x57d2('0x24')](function(_0x26718e){return _0x26718e;});}return null;};}function removeEntity(_0x46a4d1,_0x456fe1){return function(_0x12ff19){if(_0x12ff19){return _0x12ff19[_0x57d2('0x25')]()['then'](function(){var _0x424ddc=_0x12ff19[_0x57d2('0x26')]({'plain':!![]});var _0x3c7de8=_0x57d2('0x27');return db[_0x57d2('0x28')]['destroy']({'where':{'type':_0x3c7de8,'resourceId':_0x424ddc['id']}})[_0x57d2('0x24')](function(){return _0x12ff19;});})[_0x57d2('0x24')](function(){_0x46a4d1[_0x57d2('0x18')](0xcc)[_0x57d2('0x19')]();});}};}function handleEntityNotFound(_0x18d500,_0x4b3d8e){return function(_0x9bdb11){if(!_0x9bdb11){_0x18d500['sendStatus'](0x194);}return _0x9bdb11;};}function handleError(_0x1ae5ff,_0x15f1ba){_0x15f1ba=_0x15f1ba||0x1f4;return function(_0x277426){logger[_0x57d2('0x29')](_0x277426[_0x57d2('0x2a')]);if(_0x277426[_0x57d2('0x2b')]){delete _0x277426[_0x57d2('0x2b')];}_0x1ae5ff[_0x57d2('0x18')](_0x15f1ba)[_0x57d2('0x2c')](_0x277426);};}exports[_0x57d2('0x2d')]=function(_0x574589,_0x4e9178){var _0x3da926={},_0x26e052={},_0x3e017c={'count':0x0,'rows':[]};var _0x484597=_[_0x57d2('0x2e')](db[_0x57d2('0x2f')][_0x57d2('0x30')],function(_0x290c2d){return{'name':_0x290c2d[_0x57d2('0x31')],'type':_0x290c2d[_0x57d2('0x32')][_0x57d2('0x33')]};});_0x26e052[_0x57d2('0x34')]=_[_0x57d2('0x2e')](_0x484597,'name');_0x26e052[_0x57d2('0x35')]=_[_0x57d2('0x36')](_0x574589['query']);_0x26e052[_0x57d2('0x37')]=_[_0x57d2('0x38')](_0x26e052['model'],_0x26e052[_0x57d2('0x35')]);_0x3da926[_0x57d2('0x39')]=_[_0x57d2('0x38')](_0x26e052[_0x57d2('0x34')],qs[_0x57d2('0x3a')](_0x574589['query']['fields']));_0x3da926['attributes']=_0x3da926['attributes'][_0x57d2('0x3b')]?_0x3da926[_0x57d2('0x39')]:_0x26e052[_0x57d2('0x34')];if(!_0x574589[_0x57d2('0x35')][_0x57d2('0x3c')]('nolimit')){_0x3da926[_0x57d2('0x1e')]=qs['limit'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1e')]);_0x3da926[_0x57d2('0x1d')]=qs['offset'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1d')]);}_0x3da926['order']=qs[_0x57d2('0x3d')](_0x574589[_0x57d2('0x35')][_0x57d2('0x3d')]);_0x3da926[_0x57d2('0x3e')]=qs[_0x57d2('0x37')](_[_0x57d2('0x3f')](_0x574589['query'],_0x26e052[_0x57d2('0x37')]),_0x484597);if(_0x574589['query'][_0x57d2('0x40')]){_0x3da926[_0x57d2('0x3e')]=_[_0x57d2('0x41')](_0x3da926[_0x57d2('0x3e')],{'$or':_[_0x57d2('0x2e')](_0x484597,function(_0x512dbf){if(_0x512dbf[_0x57d2('0x32')]!==_0x57d2('0x42')){var _0x4f6955={};_0x4f6955[_0x512dbf[_0x57d2('0x2b')]]={'$like':'%'+_0x574589[_0x57d2('0x35')][_0x57d2('0x40')]+'%'};return _0x4f6955;}})});}_0x3da926=_['merge']({},_0x3da926,_0x574589[_0x57d2('0x43')]);var _0x2fe0cd={'where':_0x3da926[_0x57d2('0x3e')]};return db[_0x57d2('0x2f')]['count'](_0x2fe0cd)['then'](function(_0x11a2ec){_0x3e017c[_0x57d2('0x1c')]=_0x11a2ec;if(_0x574589[_0x57d2('0x35')]['includeAll']){_0x3da926['include']=[{'all':!![]}];}return db[_0x57d2('0x2f')]['findAll'](_0x3da926);})[_0x57d2('0x24')](function(_0x1bb8ad){_0x3e017c[_0x57d2('0x44')]=_0x1bb8ad;return _0x3e017c;})[_0x57d2('0x24')](respondWithFilteredResult(_0x4e9178,_0x3da926))[_0x57d2('0x45')](handleError(_0x4e9178,null));};exports['show']=function(_0x13216b,_0x1c069a){var _0x53ab43={'raw':![],'where':{'id':_0x13216b['params']['id']}},_0x775f8c={};_0x775f8c[_0x57d2('0x34')]=_[_0x57d2('0x36')](db[_0x57d2('0x2f')][_0x57d2('0x30')]);_0x775f8c['query']=_['keys'](_0x13216b[_0x57d2('0x35')]);_0x775f8c['filters']=_['intersection'](_0x775f8c[_0x57d2('0x34')],_0x775f8c['query']);_0x53ab43['attributes']=_[_0x57d2('0x38')](_0x775f8c['model'],qs[_0x57d2('0x3a')](_0x13216b['query'][_0x57d2('0x3a')]));_0x53ab43['attributes']=_0x53ab43['attributes'][_0x57d2('0x3b')]?_0x53ab43[_0x57d2('0x39')]:_0x775f8c[_0x57d2('0x34')];if(_0x13216b[_0x57d2('0x35')][_0x57d2('0x46')]){_0x53ab43[_0x57d2('0x47')]=[{'all':!![]}];}_0x53ab43=_['merge']({},_0x53ab43,_0x13216b[_0x57d2('0x43')]);return db[_0x57d2('0x2f')][_0x57d2('0x48')](_0x53ab43)[_0x57d2('0x24')](handleEntityNotFound(_0x1c069a,null))[_0x57d2('0x24')](respondWithResult(_0x1c069a,null))[_0x57d2('0x45')](handleError(_0x1c069a,null));};exports[_0x57d2('0x49')]=function(_0x406375,_0x51f172){return db[_0x57d2('0x2f')][_0x57d2('0x49')](_0x406375['body'],{})[_0x57d2('0x24')](function(_0x5b06f7){var _0x59a6eb=_0x406375[_0x57d2('0x4a')][_0x57d2('0x26')]({'plain':!![]});if(!_0x59a6eb)throw new Error(_0x57d2('0x4b'));if(_0x59a6eb[_0x57d2('0x4c')]==='user'){var _0x265d24=_0x5b06f7[_0x57d2('0x26')]({'plain':!![]});var _0x51b535='Projects';return db[_0x57d2('0x4d')][_0x57d2('0x48')]({'where':{'name':_0x51b535,'userProfileId':_0x59a6eb[_0x57d2('0x4e')]},'raw':!![]})[_0x57d2('0x24')](function(_0x3092c8){if(_0x3092c8&&_0x3092c8[_0x57d2('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x265d24['name'],'resourceId':_0x265d24['id'],'type':_0x3092c8[_0x57d2('0x2b')],'sectionId':_0x3092c8['id']},{})['then'](function(){return _0x5b06f7;});}else{return _0x5b06f7;}})[_0x57d2('0x45')](function(_0x2ef710){logger['error'](_0x57d2('0x50'),_0x2ef710);throw _0x2ef710;});}return _0x5b06f7;})[_0x57d2('0x24')](respondWithResult(_0x51f172,0xc9))[_0x57d2('0x45')](handleError(_0x51f172,null));};exports['clone']=function(_0x10d4e5,_0x224b7d){var _0x25e121={'where':{'id':_0x10d4e5[_0x57d2('0x51')]['id']}},_0x1d8329={};_0x1d8329[_0x57d2('0x34')]=_[_0x57d2('0x36')](db[_0x57d2('0x2f')][_0x57d2('0x30')]);_0x25e121['attributes']=_[_0x57d2('0x38')](_0x1d8329[_0x57d2('0x34')],qs[_0x57d2('0x3a')](_0x10d4e5['query'][_0x57d2('0x3a')]));_0x25e121[_0x57d2('0x39')]=_0x25e121[_0x57d2('0x39')]['length']?_0x25e121['attributes']:_0x1d8329['model'];if(_0x10d4e5[_0x57d2('0x35')]['includeAll']){_0x25e121[_0x57d2('0x47')]=[{'all':!![]}];}_0x25e121=_['merge']({},_0x25e121,_0x10d4e5[_0x57d2('0x43')]);return db['JscriptyProject'][_0x57d2('0x48')](_0x25e121)[_0x57d2('0x24')](handleEntityNotFound(_0x224b7d,null))[_0x57d2('0x24')](function(_0x54640d){if(_0x54640d){var _0x5985e4=_0x54640d[_0x57d2('0x26')]({'plain':!![]});_0x5985e4=qs[_0x57d2('0x52')](_0x5985e4,['id',_0x57d2('0x53'),_0x57d2('0x54')]);_0x10d4e5[_0x57d2('0x55')]=_[_0x57d2('0x52')](_0x10d4e5['body'],['id','createdAt',_0x57d2('0x54')]);return db[_0x57d2('0x2f')][_0x57d2('0x49')](_[_0x57d2('0x41')](_0x5985e4,_0x10d4e5['body']),{'include':_0x10d4e5['query'][_0x57d2('0x46')]?[{'all':!![]}]:undefined})[_0x57d2('0x24')](function(_0x4f6b8a){var _0xad397=_0x10d4e5[_0x57d2('0x4a')][_0x57d2('0x26')]({'plain':!![]});if(!_0xad397)throw new Error(_0x57d2('0x4b'));if(_0xad397['role']==='user'){var _0x55f669=_0x4f6b8a['get']({'plain':!![]});var _0x434cb7=_0x57d2('0x27');return db[_0x57d2('0x4d')][_0x57d2('0x48')]({'where':{'name':_0x434cb7,'userProfileId':_0xad397[_0x57d2('0x4e')]},'raw':!![]})[_0x57d2('0x24')](function(_0x2737ab){if(_0x2737ab&&_0x2737ab['autoAssociation']===0x0){return db[_0x57d2('0x28')]['create']({'name':_0x55f669[_0x57d2('0x2b')],'resourceId':_0x55f669['id'],'type':_0x2737ab['name'],'sectionId':_0x2737ab['id']},{})[_0x57d2('0x24')](function(){return _0x4f6b8a;});}else{return _0x4f6b8a;}})[_0x57d2('0x45')](function(_0x453e6c){logger[_0x57d2('0x29')](_0x57d2('0x50'),_0x453e6c);throw _0x453e6c;});}return _0x4f6b8a;});}})[_0x57d2('0x24')](respondWithResult(_0x224b7d,0xc9))['catch'](handleError(_0x224b7d,null));};exports[_0x57d2('0x23')]=function(_0x24d3bf,_0x27b27a){if(_0x24d3bf[_0x57d2('0x55')]['id']){delete _0x24d3bf[_0x57d2('0x55')]['id'];}return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x24d3bf[_0x57d2('0x51')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x27b27a,null))['then'](saveUpdates(_0x24d3bf[_0x57d2('0x55')],null))['then'](respondWithResult(_0x27b27a,null))['catch'](handleError(_0x27b27a,null));};exports['destroy']=function(_0x270de8,_0x4b92e1){return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x270de8['params']['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x4b92e1,null))[_0x57d2('0x24')](removeEntity(_0x4b92e1,null))[_0x57d2('0x45')](handleError(_0x4b92e1,null));};exports[_0x57d2('0x56')]=function(_0x5eb7a3,_0x3afeb9,_0xfa63ab){var _0x53a4b0={'raw':!![],'where':{}};var _0x4cfae2={};var _0x28c7ff={'count':0x0,'rows':[]};return db[_0x57d2('0x2f')]['findOne']({'where':{'id':_0x5eb7a3[_0x57d2('0x51')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x3afeb9,null))[_0x57d2('0x24')](function(_0x858d6e){if(_0x858d6e){_0x4cfae2[_0x57d2('0x34')]=_[_0x57d2('0x36')](db[_0x57d2('0x57')][_0x57d2('0x30')]);_0x4cfae2[_0x57d2('0x35')]=_[_0x57d2('0x36')](_0x5eb7a3[_0x57d2('0x35')]);_0x4cfae2[_0x57d2('0x37')]=_[_0x57d2('0x38')](_0x4cfae2['model'],_0x4cfae2[_0x57d2('0x35')]);_0x53a4b0[_0x57d2('0x39')]=_[_0x57d2('0x38')](_0x4cfae2[_0x57d2('0x34')],qs[_0x57d2('0x3a')](_0x5eb7a3[_0x57d2('0x35')][_0x57d2('0x3a')]));_0x53a4b0[_0x57d2('0x39')]=_0x53a4b0[_0x57d2('0x39')][_0x57d2('0x3b')]?_0x53a4b0[_0x57d2('0x39')]:_0x4cfae2[_0x57d2('0x34')];if(!_0x5eb7a3[_0x57d2('0x35')][_0x57d2('0x3c')](_0x57d2('0x58'))){_0x53a4b0[_0x57d2('0x1e')]=qs['limit'](_0x5eb7a3[_0x57d2('0x35')][_0x57d2('0x1e')]);_0x53a4b0['offset']=qs[_0x57d2('0x1d')](_0x5eb7a3[_0x57d2('0x35')][_0x57d2('0x1d')]);}_0x53a4b0[_0x57d2('0x59')]=qs['sort'](_0x5eb7a3[_0x57d2('0x35')]['sort']);_0x53a4b0['where']=qs[_0x57d2('0x37')](_['pick'](_0x5eb7a3[_0x57d2('0x35')],_0x4cfae2[_0x57d2('0x37')]));_0x53a4b0[_0x57d2('0x3e')][_0x57d2('0x5a')]=_0x858d6e['id'];if(_0x5eb7a3['query'][_0x57d2('0x40')]){_0x53a4b0[_0x57d2('0x3e')]=_[_0x57d2('0x41')](_0x53a4b0[_0x57d2('0x3e')],{'$or':_[_0x57d2('0x2e')](_0x53a4b0[_0x57d2('0x39')],function(_0xc26657){var _0x41ca89={};_0x41ca89[_0xc26657]={'$like':'%'+_0x5eb7a3[_0x57d2('0x35')][_0x57d2('0x40')]+'%'};return _0x41ca89;})});}_0x53a4b0=_['merge']({},_0x53a4b0,_0x5eb7a3[_0x57d2('0x43')]);return db[_0x57d2('0x57')][_0x57d2('0x1c')]({'where':_0x53a4b0[_0x57d2('0x3e')]})[_0x57d2('0x24')](function(_0x1375fa){_0x28c7ff[_0x57d2('0x1c')]=_0x1375fa;if(_0x5eb7a3[_0x57d2('0x35')][_0x57d2('0x46')]){_0x53a4b0[_0x57d2('0x47')]=[{'all':!![]}];}return db[_0x57d2('0x57')][_0x57d2('0x5b')](_0x53a4b0);})['then'](function(_0x5aa569){_0x28c7ff[_0x57d2('0x44')]=_0x5aa569;return _0x28c7ff;});}})[_0x57d2('0x24')](respondWithFilteredResult(_0x3afeb9,_0x53a4b0))[_0x57d2('0x45')](handleError(_0x3afeb9,null));};exports[_0x57d2('0x5c')]=function(_0xe60b2e,_0x58040b,_0x54673d){var _0x3e9c36={'raw':!![],'where':{}};var _0x14b5e1={};var _0x20529b={'count':0x0,'rows':[]};return db[_0x57d2('0x2f')][_0x57d2('0x5d')]({'where':{'id':_0xe60b2e[_0x57d2('0x51')]['id']}})['then'](handleEntityNotFound(_0x58040b,null))[_0x57d2('0x24')](function(_0x2f5625){if(_0x2f5625){_0x14b5e1['model']=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x14b5e1[_0x57d2('0x35')]=_['keys'](_0xe60b2e[_0x57d2('0x35')]);_0x14b5e1['filters']=_[_0x57d2('0x38')](_0x14b5e1[_0x57d2('0x34')],_0x14b5e1[_0x57d2('0x35')]);_0x3e9c36[_0x57d2('0x39')]=_[_0x57d2('0x38')](_0x14b5e1['model'],qs[_0x57d2('0x3a')](_0xe60b2e[_0x57d2('0x35')][_0x57d2('0x3a')]));_0x3e9c36['attributes']=_0x3e9c36[_0x57d2('0x39')][_0x57d2('0x3b')]?_0x3e9c36[_0x57d2('0x39')]:_0x14b5e1[_0x57d2('0x34')];if(!_0xe60b2e[_0x57d2('0x35')][_0x57d2('0x3c')](_0x57d2('0x58'))){_0x3e9c36['limit']=qs['limit'](_0xe60b2e['query'][_0x57d2('0x1e')]);_0x3e9c36[_0x57d2('0x1d')]=qs[_0x57d2('0x1d')](_0xe60b2e['query'][_0x57d2('0x1d')]);}_0x3e9c36[_0x57d2('0x59')]=qs[_0x57d2('0x3d')](_0xe60b2e[_0x57d2('0x35')][_0x57d2('0x3d')]);_0x3e9c36[_0x57d2('0x3e')]=qs[_0x57d2('0x37')](_[_0x57d2('0x3f')](_0xe60b2e['query'],_0x14b5e1[_0x57d2('0x37')]));_0x3e9c36[_0x57d2('0x3e')][_0x57d2('0x5a')]=_0x2f5625['id'];if(_0xe60b2e[_0x57d2('0x35')]['filter']){_0x3e9c36['where']=_[_0x57d2('0x41')](_0x3e9c36['where'],{'$or':_[_0x57d2('0x2e')](_0x3e9c36['attributes'],function(_0x3a35d7){var _0x12fb54={};_0x12fb54[_0x3a35d7]={'$like':'%'+_0xe60b2e[_0x57d2('0x35')]['filter']+'%'};return _0x12fb54;})});}_0x3e9c36=_[_0x57d2('0x41')]({},_0x3e9c36,_0xe60b2e['options']);return db[_0x57d2('0x5e')][_0x57d2('0x1c')]({'where':_0x3e9c36[_0x57d2('0x3e')]})[_0x57d2('0x24')](function(_0x3c6aba){_0x20529b[_0x57d2('0x1c')]=_0x3c6aba;if(_0xe60b2e[_0x57d2('0x35')][_0x57d2('0x46')]){_0x3e9c36[_0x57d2('0x47')]=[{'all':!![]}];}return db[_0x57d2('0x5e')][_0x57d2('0x5b')](_0x3e9c36);})[_0x57d2('0x24')](function(_0x27e55b){_0x20529b[_0x57d2('0x44')]=_0x27e55b;return _0x20529b;});}})[_0x57d2('0x24')](respondWithFilteredResult(_0x58040b,_0x3e9c36))['catch'](handleError(_0x58040b,null));};function char(_0x3a7d89){return _0x57d2('0x5f')===typeof _0x3a7d89?String[_0x57d2('0x60')][_0x57d2('0x20')](null,arguments):_0x3a7d89;}function needsEncapsulation(_0x4d83cf){return!!_0x4d83cf&&(_0x4d83cf[_0x57d2('0x61')]()[_0x57d2('0x62')](char(0xd))>=0x0||_0x4d83cf[_0x57d2('0x61')]()['indexOf'](char(0xa))>=0x0||_0x4d83cf[_0x57d2('0x61')]()[_0x57d2('0x62')](char(0x2c))>=0x0||_0x4d83cf[_0x57d2('0x61')]()[_0x57d2('0x62')](char(0x22))>=0x0);}function encapsulate(_0x44d126){var _0xad3ca9=char(0x22),_0xb76480='\x5c'+char(0x22),_0x1ba236=_0x44d126[_0x57d2('0x61')]()[_0x57d2('0x63')](new RegExp(_0xad3ca9,'g'),_0xb76480);return _0xad3ca9+_0x1ba236+_0xad3ca9;}exports['getSummary']=function(_0x4ca002,_0x63db36,_0x3dc4ae){var _0x26ce9f,_0x19bc4b;var _0x4a4d97={'where':{'ProjectId':_0x4ca002[_0x57d2('0x51')]['id']}};if(_0x4ca002[_0x57d2('0x35')][_0x57d2('0x64')]){_0x4a4d97[_0x57d2('0x3e')][_0x57d2('0x65')]=JSON['parse'](_0x4ca002['query']['startTime']);}return db['JscriptySessionReport']['findAll'](_0x4a4d97)[_0x57d2('0x24')](handleEntityNotFound(_0x63db36,null))['then'](function(_0xd6ec3d){if(_0xd6ec3d){_0x26ce9f=_0xd6ec3d;return db[_0x57d2('0x66')]['findAll']({'where':{'SessionId':{'$in':_[_0x57d2('0x2e')](_0x26ce9f,'id')},'ProjectId':_0x4ca002['params']['id']},'order':_0x57d2('0x67')});}})[_0x57d2('0x24')](handleEntityNotFound(_0x63db36,null))[_0x57d2('0x24')](function(_0x1ea605){if(_0x1ea605){_0x19bc4b=_0x1ea605;var _0x52163e={};for(var _0x30ae34=0x0,_0x4aff18=_0x19bc4b['length'];_0x30ae34<_0x4aff18;_0x30ae34++){if(!_0x52163e[_0x57d2('0x3c')](_0x19bc4b[_0x30ae34][_0x57d2('0x68')])){_0x52163e[_0x19bc4b[_0x30ae34][_0x57d2('0x68')]]=needsEncapsulation(_0x19bc4b[_0x30ae34][_0x57d2('0x69')])?encapsulate(_0x19bc4b[_0x30ae34][_0x57d2('0x69')]):_0x19bc4b[_0x30ae34]['question'];}}var _0x4b7687=[],_0x1d1164={};for(var _0x42ce47=0x0,_0x2d1e7b=_0x26ce9f[_0x57d2('0x3b')];_0x42ce47<_0x2d1e7b;_0x42ce47++){_0x1d1164={'ProjectId':_0x4ca002[_0x57d2('0x51')]['id'],'SessionId':_0x26ce9f[_0x42ce47]['id'],'StartTime':moment(_0x26ce9f[_0x42ce47][_0x57d2('0x65')])[_0x57d2('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4fc95c=0x0,_0x305a6f=_0x19bc4b['length'];_0x4fc95c<_0x305a6f;_0x4fc95c++){if(_0x19bc4b[_0x4fc95c][_0x57d2('0x6b')]==_0x26ce9f[_0x42ce47]['id']&&_0x52163e[_0x57d2('0x3c')](_0x19bc4b[_0x4fc95c][_0x57d2('0x68')])){_0x1d1164[_0x52163e[_0x19bc4b[_0x4fc95c][_0x57d2('0x68')]]]=_0x19bc4b[_0x4fc95c][_0x57d2('0x6c')];}}for(var _0x5ebb32 in _0x52163e){if(!_0x1d1164[_0x57d2('0x3c')](_0x52163e[_0x5ebb32])){_0x1d1164[_0x52163e[_0x5ebb32]]=null;}}_0x4b7687['push'](_0x1d1164);}return _0x4b7687;}})[_0x57d2('0x24')](function(_0x888a75){if(!_[_0x57d2('0x6d')](_0x888a75)){var _0xfeaefd=toCsv(_0x888a75);var _0x41883f=Date[_0x57d2('0x6e')]();fs[_0x57d2('0x6f')](util[_0x57d2('0x6a')](_0x57d2('0x70'),_0x4ca002[_0x57d2('0x51')]['id'],_0x41883f),_0xfeaefd);_0x63db36[_0x57d2('0x71')]('Content-disposition','attachment;\x20filename='+util['format'](_0x57d2('0x72'),_0x4ca002[_0x57d2('0x51')]['id'],_0x41883f));_0x63db36[_0x57d2('0x71')](_0x57d2('0x73'),'text/csv');return _0x63db36[_0x57d2('0x74')](util[_0x57d2('0x6a')](_0x57d2('0x70'),_0x4ca002[_0x57d2('0x51')]['id'],_0x41883f));}else{return _0x63db36['sendStatus'](0xcc);}})[_0x57d2('0x45')](handleError(_0x63db36,null));}; \ No newline at end of file +var _0xe495=['question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','then','get','Projects','UserProfileResource','end','error','name','send','index','map','JscriptyProject','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','update','destroy','findOne','ProjectId','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','getSummary','params','parse','startTime','JscriptySessionReport','JscriptyQuestionReport','-createdAt','questionId'];(function(_0x1333ce,_0x248d21){var _0x3c7af0=function(_0x2c89de){while(--_0x2c89de){_0x1333ce['push'](_0x1333ce['shift']());}};_0x3c7af0(++_0x248d21);}(_0xe495,0xfe));var _0x5e49=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xe495[_0x1deb03];return _0x189fe7;};'use strict';var emlformat=require(_0x5e49('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5e49('0x1'));var jsonpatch=require(_0x5e49('0x2'));var rp=require('request-promise');var moment=require(_0x5e49('0x3'));var BPromise=require(_0x5e49('0x4'));var Mustache=require(_0x5e49('0x5'));var util=require('util');var path=require(_0x5e49('0x6'));var sox=require(_0x5e49('0x7'));var csv=require(_0x5e49('0x8'));var ejs=require(_0x5e49('0x9'));var fs=require('fs');var fs_extra=require(_0x5e49('0xa'));var _=require(_0x5e49('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5e49('0xc'));var deskjs=require(_0x5e49('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5e49('0xe'));var Redis=require('ioredis');var authService=require(_0x5e49('0xf'));var qs=require(_0x5e49('0x10'));var as=require(_0x5e49('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e49('0x12'))(_0x5e49('0x13'));var utils=require(_0x5e49('0x14'));var config=require(_0x5e49('0x15'));var licenseUtil=require(_0x5e49('0x16'));var db=require(_0x5e49('0x17'))['db'];function respondWithStatusCode(_0x32909f,_0x1c8bac){_0x1c8bac=_0x1c8bac||0xcc;return function(_0x34fefd){if(_0x34fefd){return _0x32909f[_0x5e49('0x18')](_0x1c8bac);}return _0x32909f[_0x5e49('0x19')](_0x1c8bac)['end']();};}function respondWithResult(_0x25149e,_0x50157d){_0x50157d=_0x50157d||0xc8;return function(_0x43f447){if(_0x43f447){return _0x25149e[_0x5e49('0x19')](_0x50157d)[_0x5e49('0x1a')](_0x43f447);}};}function respondWithFilteredResult(_0x44e570,_0x368044){return function(_0x1ed998){if(_0x1ed998){var _0x48d55d=typeof _0x368044[_0x5e49('0x1b')]==='undefined'&&typeof _0x368044[_0x5e49('0x1c')]===_0x5e49('0x1d');var _0x43c424=_0x1ed998[_0x5e49('0x1e')];var _0x3b4b7e=_0x48d55d?0x0:_0x368044[_0x5e49('0x1b')];var _0x59ec99=_0x48d55d?_0x1ed998[_0x5e49('0x1e')]:_0x368044[_0x5e49('0x1b')]+_0x368044[_0x5e49('0x1c')];var _0xd2d53a;if(_0x59ec99>=_0x43c424){_0x59ec99=_0x43c424;_0xd2d53a=0xc8;}else{_0xd2d53a=0xce;}_0x44e570[_0x5e49('0x19')](_0xd2d53a);return _0x44e570['set'](_0x5e49('0x1f'),_0x3b4b7e+'-'+_0x59ec99+'/'+_0x43c424)['json'](_0x1ed998);}return null;};}function patchUpdates(_0x3803ce){return function(_0x574b96){try{jsonpatch[_0x5e49('0x20')](_0x574b96,_0x3803ce,!![]);}catch(_0x1468a3){return BPromise[_0x5e49('0x21')](_0x1468a3);}return _0x574b96['save']();};}function saveUpdates(_0x5330b4,_0x5c3e3b){return function(_0x3ea542){if(_0x3ea542){return _0x3ea542['update'](_0x5330b4)[_0x5e49('0x22')](function(_0x125933){return _0x125933;});}return null;};}function removeEntity(_0x9ba537,_0x45fe11){return function(_0x34966a){if(_0x34966a){return _0x34966a['destroy']()['then'](function(){var _0x22847f=_0x34966a[_0x5e49('0x23')]({'plain':!![]});var _0x1b5b1b=_0x5e49('0x24');return db[_0x5e49('0x25')]['destroy']({'where':{'type':_0x1b5b1b,'resourceId':_0x22847f['id']}})[_0x5e49('0x22')](function(){return _0x34966a;});})[_0x5e49('0x22')](function(){_0x9ba537['status'](0xcc)[_0x5e49('0x26')]();});}};}function handleEntityNotFound(_0x15bd2e,_0x1047bc){return function(_0x2014d7){if(!_0x2014d7){_0x15bd2e[_0x5e49('0x18')](0x194);}return _0x2014d7;};}function handleError(_0x154092,_0x59e78d){_0x59e78d=_0x59e78d||0x1f4;return function(_0x446dee){logger[_0x5e49('0x27')](_0x446dee['stack']);if(_0x446dee[_0x5e49('0x28')]){delete _0x446dee[_0x5e49('0x28')];}_0x154092['status'](_0x59e78d)[_0x5e49('0x29')](_0x446dee);};}exports[_0x5e49('0x2a')]=function(_0x591df5,_0x1c8577){var _0x294a52={},_0x5aa240={},_0x15c7be={'count':0x0,'rows':[]};var _0x1c3b8f=_[_0x5e49('0x2b')](db[_0x5e49('0x2c')][_0x5e49('0x2d')],function(_0x42f526){return{'name':_0x42f526['fieldName'],'type':_0x42f526[_0x5e49('0x2e')][_0x5e49('0x2f')]};});_0x5aa240[_0x5e49('0x30')]=_[_0x5e49('0x2b')](_0x1c3b8f,_0x5e49('0x28'));_0x5aa240[_0x5e49('0x31')]=_[_0x5e49('0x32')](_0x591df5[_0x5e49('0x31')]);_0x5aa240[_0x5e49('0x33')]=_[_0x5e49('0x34')](_0x5aa240['model'],_0x5aa240['query']);_0x294a52[_0x5e49('0x35')]=_[_0x5e49('0x34')](_0x5aa240[_0x5e49('0x30')],qs[_0x5e49('0x36')](_0x591df5[_0x5e49('0x31')][_0x5e49('0x36')]));_0x294a52[_0x5e49('0x35')]=_0x294a52['attributes'][_0x5e49('0x37')]?_0x294a52[_0x5e49('0x35')]:_0x5aa240[_0x5e49('0x30')];if(!_0x591df5['query'][_0x5e49('0x38')](_0x5e49('0x39'))){_0x294a52[_0x5e49('0x1c')]=qs[_0x5e49('0x1c')](_0x591df5['query'][_0x5e49('0x1c')]);_0x294a52[_0x5e49('0x1b')]=qs[_0x5e49('0x1b')](_0x591df5[_0x5e49('0x31')][_0x5e49('0x1b')]);}_0x294a52[_0x5e49('0x3a')]=qs[_0x5e49('0x3b')](_0x591df5[_0x5e49('0x31')][_0x5e49('0x3b')]);_0x294a52['where']=qs['filters'](_[_0x5e49('0x3c')](_0x591df5[_0x5e49('0x31')],_0x5aa240[_0x5e49('0x33')]),_0x1c3b8f);if(_0x591df5[_0x5e49('0x31')][_0x5e49('0x3d')]){_0x294a52['where']=_[_0x5e49('0x3e')](_0x294a52[_0x5e49('0x3f')],{'$or':_[_0x5e49('0x2b')](_0x1c3b8f,function(_0x5953cf){if(_0x5953cf[_0x5e49('0x2e')]!==_0x5e49('0x40')){var _0x238e2d={};_0x238e2d[_0x5953cf[_0x5e49('0x28')]]={'$like':'%'+_0x591df5['query'][_0x5e49('0x3d')]+'%'};return _0x238e2d;}})});}_0x294a52=_['merge']({},_0x294a52,_0x591df5[_0x5e49('0x41')]);var _0x492b6a={'where':_0x294a52[_0x5e49('0x3f')]};return db[_0x5e49('0x2c')][_0x5e49('0x1e')](_0x492b6a)[_0x5e49('0x22')](function(_0xf1cd9e){_0x15c7be['count']=_0xf1cd9e;if(_0x591df5[_0x5e49('0x31')][_0x5e49('0x42')]){_0x294a52[_0x5e49('0x43')]=[{'all':!![]}];}return db[_0x5e49('0x2c')][_0x5e49('0x44')](_0x294a52);})[_0x5e49('0x22')](function(_0xef9fec){_0x15c7be[_0x5e49('0x45')]=_0xef9fec;return _0x15c7be;})[_0x5e49('0x22')](respondWithFilteredResult(_0x1c8577,_0x294a52))[_0x5e49('0x46')](handleError(_0x1c8577,null));};exports[_0x5e49('0x47')]=function(_0x29b3dc,_0x1aa339){var _0x5a4b5d={'raw':![],'where':{'id':_0x29b3dc['params']['id']}},_0xcc52bb={};_0xcc52bb[_0x5e49('0x30')]=_[_0x5e49('0x32')](db[_0x5e49('0x2c')][_0x5e49('0x2d')]);_0xcc52bb[_0x5e49('0x31')]=_['keys'](_0x29b3dc['query']);_0xcc52bb[_0x5e49('0x33')]=_[_0x5e49('0x34')](_0xcc52bb[_0x5e49('0x30')],_0xcc52bb[_0x5e49('0x31')]);_0x5a4b5d[_0x5e49('0x35')]=_['intersection'](_0xcc52bb[_0x5e49('0x30')],qs[_0x5e49('0x36')](_0x29b3dc[_0x5e49('0x31')]['fields']));_0x5a4b5d[_0x5e49('0x35')]=_0x5a4b5d['attributes'][_0x5e49('0x37')]?_0x5a4b5d['attributes']:_0xcc52bb[_0x5e49('0x30')];if(_0x29b3dc['query'][_0x5e49('0x42')]){_0x5a4b5d[_0x5e49('0x43')]=[{'all':!![]}];}_0x5a4b5d=_['merge']({},_0x5a4b5d,_0x29b3dc['options']);return db[_0x5e49('0x2c')][_0x5e49('0x48')](_0x5a4b5d)[_0x5e49('0x22')](handleEntityNotFound(_0x1aa339,null))[_0x5e49('0x22')](respondWithResult(_0x1aa339,null))['catch'](handleError(_0x1aa339,null));};exports[_0x5e49('0x49')]=function(_0x2046e3,_0xad14d9){return db[_0x5e49('0x2c')]['create'](_0x2046e3[_0x5e49('0x4a')],{})[_0x5e49('0x22')](function(_0x15f302){var _0x438fab=_0x2046e3['user'][_0x5e49('0x23')]({'plain':!![]});if(!_0x438fab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x438fab[_0x5e49('0x4b')]===_0x5e49('0x4c')){var _0x5c047d=_0x15f302[_0x5e49('0x23')]({'plain':!![]});var _0x1e2a96=_0x5e49('0x24');return db[_0x5e49('0x4d')][_0x5e49('0x48')]({'where':{'name':_0x1e2a96,'userProfileId':_0x438fab[_0x5e49('0x4e')]},'raw':!![]})[_0x5e49('0x22')](function(_0x109700){if(_0x109700&&_0x109700['autoAssociation']===0x0){return db[_0x5e49('0x25')][_0x5e49('0x49')]({'name':_0x5c047d['name'],'resourceId':_0x5c047d['id'],'type':_0x109700[_0x5e49('0x28')],'sectionId':_0x109700['id']},{})['then'](function(){return _0x15f302;});}else{return _0x15f302;}})[_0x5e49('0x46')](function(_0x4f731d){logger['error'](_0x5e49('0x4f'),_0x4f731d);throw _0x4f731d;});}return _0x15f302;})[_0x5e49('0x22')](respondWithResult(_0xad14d9,0xc9))[_0x5e49('0x46')](handleError(_0xad14d9,null));};exports[_0x5e49('0x50')]=function(_0x2d636c,_0x33239f){var _0x372eb0={'where':{'id':_0x2d636c['params']['id']}},_0x26be76={};_0x26be76[_0x5e49('0x30')]=_['keys'](db[_0x5e49('0x2c')]['rawAttributes']);_0x372eb0['attributes']=_[_0x5e49('0x34')](_0x26be76[_0x5e49('0x30')],qs[_0x5e49('0x36')](_0x2d636c[_0x5e49('0x31')]['fields']));_0x372eb0[_0x5e49('0x35')]=_0x372eb0[_0x5e49('0x35')][_0x5e49('0x37')]?_0x372eb0[_0x5e49('0x35')]:_0x26be76[_0x5e49('0x30')];if(_0x2d636c[_0x5e49('0x31')][_0x5e49('0x42')]){_0x372eb0[_0x5e49('0x43')]=[{'all':!![]}];}_0x372eb0=_['merge']({},_0x372eb0,_0x2d636c[_0x5e49('0x41')]);return db[_0x5e49('0x2c')][_0x5e49('0x48')](_0x372eb0)[_0x5e49('0x22')](handleEntityNotFound(_0x33239f,null))['then'](function(_0x34b2be){if(_0x34b2be){var _0x2e5e1f=_0x34b2be[_0x5e49('0x23')]({'plain':!![]});_0x2e5e1f=qs['omit'](_0x2e5e1f,['id',_0x5e49('0x51'),'updatedAt']);_0x2d636c[_0x5e49('0x4a')]=_[_0x5e49('0x52')](_0x2d636c[_0x5e49('0x4a')],['id',_0x5e49('0x51'),'updatedAt']);return db['JscriptyProject']['create'](_[_0x5e49('0x3e')](_0x2e5e1f,_0x2d636c['body']),{'include':_0x2d636c[_0x5e49('0x31')][_0x5e49('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x48ce4e){var _0x174311=_0x2d636c['user'][_0x5e49('0x23')]({'plain':!![]});if(!_0x174311)throw new Error(_0x5e49('0x53'));if(_0x174311[_0x5e49('0x4b')]===_0x5e49('0x4c')){var _0x566804=_0x48ce4e[_0x5e49('0x23')]({'plain':!![]});var _0x2b7e01=_0x5e49('0x24');return db[_0x5e49('0x4d')][_0x5e49('0x48')]({'where':{'name':_0x2b7e01,'userProfileId':_0x174311[_0x5e49('0x4e')]},'raw':!![]})[_0x5e49('0x22')](function(_0x1f1245){if(_0x1f1245&&_0x1f1245[_0x5e49('0x54')]===0x0){return db[_0x5e49('0x25')][_0x5e49('0x49')]({'name':_0x566804['name'],'resourceId':_0x566804['id'],'type':_0x1f1245[_0x5e49('0x28')],'sectionId':_0x1f1245['id']},{})['then'](function(){return _0x48ce4e;});}else{return _0x48ce4e;}})['catch'](function(_0x11c04c){logger[_0x5e49('0x27')](_0x5e49('0x4f'),_0x11c04c);throw _0x11c04c;});}return _0x48ce4e;});}})[_0x5e49('0x22')](respondWithResult(_0x33239f,0xc9))[_0x5e49('0x46')](handleError(_0x33239f,null));};exports[_0x5e49('0x55')]=function(_0x589cb8,_0x4ecaf4){if(_0x589cb8[_0x5e49('0x4a')]['id']){delete _0x589cb8[_0x5e49('0x4a')]['id'];}return db['JscriptyProject'][_0x5e49('0x48')]({'where':{'id':_0x589cb8['params']['id']}})[_0x5e49('0x22')](handleEntityNotFound(_0x4ecaf4,null))[_0x5e49('0x22')](saveUpdates(_0x589cb8[_0x5e49('0x4a')],null))[_0x5e49('0x22')](respondWithResult(_0x4ecaf4,null))[_0x5e49('0x46')](handleError(_0x4ecaf4,null));};exports[_0x5e49('0x56')]=function(_0x228a97,_0x36d5ad){return db[_0x5e49('0x2c')][_0x5e49('0x48')]({'where':{'id':_0x228a97['params']['id']}})[_0x5e49('0x22')](handleEntityNotFound(_0x36d5ad,null))[_0x5e49('0x22')](removeEntity(_0x36d5ad,null))['catch'](handleError(_0x36d5ad,null));};exports['getSessions']=function(_0x5eb75d,_0x303067,_0x383c6b){var _0x2df8a1={'raw':!![],'where':{}};var _0xf4dcd9={};var _0x3b8b3f={'count':0x0,'rows':[]};return db[_0x5e49('0x2c')][_0x5e49('0x57')]({'where':{'id':_0x5eb75d['params']['id']}})['then'](handleEntityNotFound(_0x303067,null))[_0x5e49('0x22')](function(_0x48b3e3){if(_0x48b3e3){_0xf4dcd9['model']=_[_0x5e49('0x32')](db['JscriptySessionReport']['rawAttributes']);_0xf4dcd9['query']=_['keys'](_0x5eb75d[_0x5e49('0x31')]);_0xf4dcd9[_0x5e49('0x33')]=_['intersection'](_0xf4dcd9['model'],_0xf4dcd9[_0x5e49('0x31')]);_0x2df8a1[_0x5e49('0x35')]=_['intersection'](_0xf4dcd9[_0x5e49('0x30')],qs['fields'](_0x5eb75d[_0x5e49('0x31')]['fields']));_0x2df8a1[_0x5e49('0x35')]=_0x2df8a1[_0x5e49('0x35')][_0x5e49('0x37')]?_0x2df8a1[_0x5e49('0x35')]:_0xf4dcd9[_0x5e49('0x30')];if(!_0x5eb75d['query'][_0x5e49('0x38')](_0x5e49('0x39'))){_0x2df8a1[_0x5e49('0x1c')]=qs[_0x5e49('0x1c')](_0x5eb75d[_0x5e49('0x31')][_0x5e49('0x1c')]);_0x2df8a1[_0x5e49('0x1b')]=qs[_0x5e49('0x1b')](_0x5eb75d['query'][_0x5e49('0x1b')]);}_0x2df8a1['order']=qs['sort'](_0x5eb75d[_0x5e49('0x31')][_0x5e49('0x3b')]);_0x2df8a1[_0x5e49('0x3f')]=qs[_0x5e49('0x33')](_[_0x5e49('0x3c')](_0x5eb75d['query'],_0xf4dcd9[_0x5e49('0x33')]));_0x2df8a1[_0x5e49('0x3f')][_0x5e49('0x58')]=_0x48b3e3['id'];if(_0x5eb75d['query']['filter']){_0x2df8a1[_0x5e49('0x3f')]=_[_0x5e49('0x3e')](_0x2df8a1[_0x5e49('0x3f')],{'$or':_[_0x5e49('0x2b')](_0x2df8a1['attributes'],function(_0x247ef2){var _0x3e3748={};_0x3e3748[_0x247ef2]={'$like':'%'+_0x5eb75d[_0x5e49('0x31')][_0x5e49('0x3d')]+'%'};return _0x3e3748;})});}_0x2df8a1=_[_0x5e49('0x3e')]({},_0x2df8a1,_0x5eb75d['options']);return db['JscriptySessionReport'][_0x5e49('0x1e')]({'where':_0x2df8a1[_0x5e49('0x3f')]})['then'](function(_0x3025b5){_0x3b8b3f[_0x5e49('0x1e')]=_0x3025b5;if(_0x5eb75d[_0x5e49('0x31')][_0x5e49('0x42')]){_0x2df8a1[_0x5e49('0x43')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x2df8a1);})[_0x5e49('0x22')](function(_0x3dbaae){_0x3b8b3f[_0x5e49('0x45')]=_0x3dbaae;return _0x3b8b3f;});}})[_0x5e49('0x22')](respondWithFilteredResult(_0x303067,_0x2df8a1))[_0x5e49('0x46')](handleError(_0x303067,null));};exports['getAnswers']=function(_0x47cef3,_0x1c8eb,_0x4b68f9){var _0x2a395b={'raw':!![],'where':{}};var _0xcd3fb1={};var _0x16cce8={'count':0x0,'rows':[]};return db[_0x5e49('0x2c')][_0x5e49('0x57')]({'where':{'id':_0x47cef3['params']['id']}})[_0x5e49('0x22')](handleEntityNotFound(_0x1c8eb,null))[_0x5e49('0x22')](function(_0x5a006a){if(_0x5a006a){_0xcd3fb1[_0x5e49('0x30')]=_[_0x5e49('0x32')](db[_0x5e49('0x59')][_0x5e49('0x2d')]);_0xcd3fb1[_0x5e49('0x31')]=_['keys'](_0x47cef3[_0x5e49('0x31')]);_0xcd3fb1[_0x5e49('0x33')]=_[_0x5e49('0x34')](_0xcd3fb1['model'],_0xcd3fb1[_0x5e49('0x31')]);_0x2a395b[_0x5e49('0x35')]=_['intersection'](_0xcd3fb1['model'],qs[_0x5e49('0x36')](_0x47cef3[_0x5e49('0x31')]['fields']));_0x2a395b[_0x5e49('0x35')]=_0x2a395b[_0x5e49('0x35')][_0x5e49('0x37')]?_0x2a395b[_0x5e49('0x35')]:_0xcd3fb1[_0x5e49('0x30')];if(!_0x47cef3[_0x5e49('0x31')][_0x5e49('0x38')](_0x5e49('0x39'))){_0x2a395b['limit']=qs['limit'](_0x47cef3[_0x5e49('0x31')][_0x5e49('0x1c')]);_0x2a395b[_0x5e49('0x1b')]=qs[_0x5e49('0x1b')](_0x47cef3[_0x5e49('0x31')][_0x5e49('0x1b')]);}_0x2a395b[_0x5e49('0x3a')]=qs['sort'](_0x47cef3[_0x5e49('0x31')][_0x5e49('0x3b')]);_0x2a395b[_0x5e49('0x3f')]=qs[_0x5e49('0x33')](_[_0x5e49('0x3c')](_0x47cef3[_0x5e49('0x31')],_0xcd3fb1[_0x5e49('0x33')]));_0x2a395b['where'][_0x5e49('0x58')]=_0x5a006a['id'];if(_0x47cef3[_0x5e49('0x31')]['filter']){_0x2a395b['where']=_[_0x5e49('0x3e')](_0x2a395b[_0x5e49('0x3f')],{'$or':_[_0x5e49('0x2b')](_0x2a395b['attributes'],function(_0x3e7c57){var _0xf146ba={};_0xf146ba[_0x3e7c57]={'$like':'%'+_0x47cef3['query'][_0x5e49('0x3d')]+'%'};return _0xf146ba;})});}_0x2a395b=_['merge']({},_0x2a395b,_0x47cef3[_0x5e49('0x41')]);return db[_0x5e49('0x59')][_0x5e49('0x1e')]({'where':_0x2a395b['where']})[_0x5e49('0x22')](function(_0x5f56bf){_0x16cce8[_0x5e49('0x1e')]=_0x5f56bf;if(_0x47cef3[_0x5e49('0x31')][_0x5e49('0x42')]){_0x2a395b[_0x5e49('0x43')]=[{'all':!![]}];}return db[_0x5e49('0x59')][_0x5e49('0x44')](_0x2a395b);})[_0x5e49('0x22')](function(_0x5b2c5e){_0x16cce8['rows']=_0x5b2c5e;return _0x16cce8;});}})[_0x5e49('0x22')](respondWithFilteredResult(_0x1c8eb,_0x2a395b))['catch'](handleError(_0x1c8eb,null));};function char(_0x5c666e){return _0x5e49('0x5a')===typeof _0x5c666e?String[_0x5e49('0x5b')][_0x5e49('0x20')](null,arguments):_0x5c666e;}function needsEncapsulation(_0x4a614d){return!!_0x4a614d&&(_0x4a614d['toString']()[_0x5e49('0x5c')](char(0xd))>=0x0||_0x4a614d[_0x5e49('0x5d')]()[_0x5e49('0x5c')](char(0xa))>=0x0||_0x4a614d[_0x5e49('0x5d')]()[_0x5e49('0x5c')](char(0x2c))>=0x0||_0x4a614d['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x575180){var _0x16c03e=char(0x22),_0x40ee4b='\x5c'+char(0x22),_0x190217=_0x575180['toString']()[_0x5e49('0x5e')](new RegExp(_0x16c03e,'g'),_0x40ee4b);return _0x16c03e+_0x190217+_0x16c03e;}exports[_0x5e49('0x5f')]=function(_0x47e916,_0xdb5dcb,_0x365ed6){var _0x4ad7c7,_0x1456a7;var _0x6e6569={'where':{'ProjectId':_0x47e916[_0x5e49('0x60')]['id']}};if(_0x47e916[_0x5e49('0x31')]['startTime']){_0x6e6569[_0x5e49('0x3f')]['starttime']=JSON[_0x5e49('0x61')](_0x47e916[_0x5e49('0x31')][_0x5e49('0x62')]);}return db[_0x5e49('0x63')]['findAll'](_0x6e6569)[_0x5e49('0x22')](handleEntityNotFound(_0xdb5dcb,null))[_0x5e49('0x22')](function(_0x19aba6){if(_0x19aba6){_0x4ad7c7=_0x19aba6;return db[_0x5e49('0x64')][_0x5e49('0x44')]({'where':{'SessionId':{'$in':_[_0x5e49('0x2b')](_0x4ad7c7,'id')},'ProjectId':_0x47e916['params']['id']},'order':_0x5e49('0x65')});}})[_0x5e49('0x22')](handleEntityNotFound(_0xdb5dcb,null))[_0x5e49('0x22')](function(_0x30e1dd){if(_0x30e1dd){_0x1456a7=_0x30e1dd;var _0x402649={};for(var _0x354fab=0x0,_0x12705d=_0x1456a7[_0x5e49('0x37')];_0x354fab<_0x12705d;_0x354fab++){if(!_0x402649[_0x5e49('0x38')](_0x1456a7[_0x354fab][_0x5e49('0x66')])){_0x402649[_0x1456a7[_0x354fab][_0x5e49('0x66')]]=needsEncapsulation(_0x1456a7[_0x354fab][_0x5e49('0x67')])?encapsulate(_0x1456a7[_0x354fab]['question']):_0x1456a7[_0x354fab][_0x5e49('0x67')];}}var _0x58880b=[],_0x4f2b59={};for(var _0x2db9e0=0x0,_0x9ed276=_0x4ad7c7[_0x5e49('0x37')];_0x2db9e0<_0x9ed276;_0x2db9e0++){_0x4f2b59={'ProjectId':_0x47e916['params']['id'],'SessionId':_0x4ad7c7[_0x2db9e0]['id'],'StartTime':moment(_0x4ad7c7[_0x2db9e0][_0x5e49('0x68')])[_0x5e49('0x69')](_0x5e49('0x6a'))};for(var _0x27833e=0x0,_0x411b51=_0x1456a7[_0x5e49('0x37')];_0x27833e<_0x411b51;_0x27833e++){if(_0x1456a7[_0x27833e][_0x5e49('0x6b')]==_0x4ad7c7[_0x2db9e0]['id']&&_0x402649['hasOwnProperty'](_0x1456a7[_0x27833e][_0x5e49('0x66')])){_0x4f2b59[_0x402649[_0x1456a7[_0x27833e][_0x5e49('0x66')]]]=_0x1456a7[_0x27833e][_0x5e49('0x6c')];}}for(var _0x3f25c8 in _0x402649){if(!_0x4f2b59['hasOwnProperty'](_0x402649[_0x3f25c8])){_0x4f2b59[_0x402649[_0x3f25c8]]=null;}}_0x58880b[_0x5e49('0x6d')](_0x4f2b59);}return _0x58880b;}})[_0x5e49('0x22')](function(_0x2f4284){if(!_[_0x5e49('0x6e')](_0x2f4284)){var _0x2d259c=toCsv(_0x2f4284);var _0x30d392=Date[_0x5e49('0x6f')]();fs['writeFileSync'](util['format'](_0x5e49('0x70'),_0x47e916[_0x5e49('0x60')]['id'],_0x30d392),_0x2d259c);_0xdb5dcb['setHeader'](_0x5e49('0x71'),_0x5e49('0x72')+util[_0x5e49('0x69')]('Jscripty_Project_%d_Summary_%s.csv',_0x47e916[_0x5e49('0x60')]['id'],_0x30d392));_0xdb5dcb[_0x5e49('0x73')](_0x5e49('0x74'),_0x5e49('0x75'));return _0xdb5dcb[_0x5e49('0x76')](util['format'](_0x5e49('0x70'),_0x47e916[_0x5e49('0x60')]['id'],_0x30d392));}else{return _0xdb5dcb[_0x5e49('0x18')](0xcc);}})[_0x5e49('0x46')](handleError(_0xdb5dcb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index a25dca9..a3883ad 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 _0xf611=['path','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','util','../../config/logger','api'];(function(_0x4c0690,_0x4ae8fa){var _0x319270=function(_0x48a5b0){while(--_0x48a5b0){_0x4c0690['push'](_0x4c0690['shift']());}};_0x319270(++_0x4ae8fa);}(_0xf611,0x7b));var _0x1f61=function(_0x388914,_0x3c63f9){_0x388914=_0x388914-0x0;var _0x1f9111=_0xf611[_0x388914];return _0x1f9111;};'use strict';var _=require('lodash');var util=require(_0x1f61('0x0'));var logger=require(_0x1f61('0x1'))(_0x1f61('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f61('0x3'));var rimraf=require('rimraf');var config=require(_0x1f61('0x4'));var attributes=require(_0x1f61('0x5'));module['exports']=function(_0x4faa5b,_0x290165){return _0x4faa5b[_0x1f61('0x6')](_0x1f61('0x7'),attributes,{'tableName':_0x1f61('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bdc=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects','lodash','util'];(function(_0x3d0477,_0x5266fe){var _0x28b589=function(_0x2ea695){while(--_0x2ea695){_0x3d0477['push'](_0x3d0477['shift']());}};_0x28b589(++_0x5266fe);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x34b921,_0x4d209e){_0x34b921=_0x34b921-0x0;var _0x1ebc80=_0x6bdc[_0x34b921];return _0x1ebc80;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var logger=require(_0xc6bd('0x2'))(_0xc6bd('0x3'));var moment=require(_0xc6bd('0x4'));var BPromise=require(_0xc6bd('0x5'));var rp=require(_0xc6bd('0x6'));var fs=require('fs');var path=require(_0xc6bd('0x7'));var rimraf=require(_0xc6bd('0x8'));var config=require(_0xc6bd('0x9'));var attributes=require('./jscriptyProject.attributes');module[_0xc6bd('0xa')]=function(_0x26218a,_0x158271){return _0x26218a[_0xc6bd('0xb')](_0xc6bd('0xc'),attributes,{'tableName':_0xc6bd('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 ddaf710..14fa738 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 _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x348a2e,_0x55e645){var _0x165d97=function(_0x21cebe){while(--_0x21cebe){_0x348a2e['push'](_0x348a2e['shift']());}};_0x165d97(++_0x55e645);}(_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')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xac4a,0x13f));var _0xaac4=function(_0x2dbc4f,_0x233e24){_0x2dbc4f=_0x2dbc4f-0x0;var _0x44a559=_0xac4a[_0x2dbc4f];return _0x44a559;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 4b49e62..cbf7a21 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 _0xe859=['/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe859,0xaf));var _0x9e85=function(_0x525790,_0x1064af){_0x525790=_0x525790-0x0;var _0x3e82db=_0xe859[_0x525790];return _0x3e82db;};'use strict';var multer=require('multer');var util=require(_0x9e85('0x0'));var path=require(_0x9e85('0x1'));var timeout=require(_0x9e85('0x2'));var express=require(_0x9e85('0x3'));var router=express['Router']();var fs_extra=require(_0x9e85('0x4'));var auth=require(_0x9e85('0x5'));var interaction=require(_0x9e85('0x6'));var config=require(_0x9e85('0x7'));var controller=require(_0x9e85('0x8'));router[_0x9e85('0x9')]('/',auth[_0x9e85('0xa')](),controller[_0x9e85('0xb')]);router[_0x9e85('0x9')](_0x9e85('0xc'),auth['isAuthenticated'](),controller[_0x9e85('0xd')]);router['get'](_0x9e85('0xe'),auth[_0x9e85('0xa')](),controller[_0x9e85('0xf')]);router[_0x9e85('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9e85('0x11')]('/:id',auth[_0x9e85('0xa')](),controller['update']);router[_0x9e85('0x12')]('/:id',auth[_0x9e85('0xa')](),controller[_0x9e85('0x13')]);module[_0x9e85('0x14')]=router; \ No newline at end of file +var _0x7512=['connect-timeout','express','fs-extra','../../components/auth/service','./jscriptyQuestionReport.controller','isAuthenticated','get','/:id','show','post','create','delete','destroy','exports','multer','util','path'];(function(_0x433aac,_0x56acbd){var _0x1785c4=function(_0x1e6446){while(--_0x1e6446){_0x433aac['push'](_0x433aac['shift']());}};_0x1785c4(++_0x56acbd);}(_0x7512,0xda));var _0x2751=function(_0x22766f,_0x577e75){_0x22766f=_0x22766f-0x0;var _0x5e0773=_0x7512[_0x22766f];return _0x5e0773;};'use strict';var multer=require(_0x2751('0x0'));var util=require(_0x2751('0x1'));var path=require(_0x2751('0x2'));var timeout=require(_0x2751('0x3'));var express=require(_0x2751('0x4'));var router=express['Router']();var fs_extra=require(_0x2751('0x5'));var auth=require(_0x2751('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2751('0x7'));router['get']('/',auth[_0x2751('0x8')](),controller['index']);router[_0x2751('0x9')]('/describe',auth[_0x2751('0x8')](),controller['describe']);router[_0x2751('0x9')](_0x2751('0xa'),auth[_0x2751('0x8')](),controller[_0x2751('0xb')]);router[_0x2751('0xc')]('/',auth[_0x2751('0x8')](),controller[_0x2751('0xd')]);router['put']('/:id',auth[_0x2751('0x8')](),controller['update']);router[_0x2751('0xe')](_0x2751('0xa'),auth[_0x2751('0x8')](),controller[_0x2751('0xf')]);module[_0x2751('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 1ffe32e..a73f1dd 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x5a0db7,_0x5dd0d6){_0x5a0db7=_0x5a0db7-0x0;var _0x3ab2f4=_0x7a54[_0x5a0db7];return _0x3ab2f4;};'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(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7a54,0x106));var _0x47a5=function(_0x251c5b,_0x357c18){_0x251c5b=_0x251c5b-0x0;var _0x9ce564=_0x7a54[_0x251c5b];return _0x9ce564;};'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 8d34fb1..41579dc 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 _0x8b63=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','JscriptyQuestionReport','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','jsforce','papaparse'];(function(_0x1ae99a,_0x2550c4){var _0x56d9f2=function(_0x3babb5){while(--_0x3babb5){_0x1ae99a['push'](_0x1ae99a['shift']());}};_0x56d9f2(++_0x2550c4);}(_0x8b63,0x1a1));var _0x38b6=function(_0x20c373,_0x2d855e){_0x20c373=_0x20c373-0x0;var _0x417478=_0x8b63[_0x20c373];return _0x417478;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x38b6('0x0'));var rp=require(_0x38b6('0x1'));var moment=require(_0x38b6('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x38b6('0x3'));var path=require(_0x38b6('0x4'));var sox=require('sox');var csv=require(_0x38b6('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38b6('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x38b6('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x38b6('0x5'));var querystring=require('querystring');var Papa=require(_0x38b6('0x8'));var Redis=require(_0x38b6('0x9'));var authService=require(_0x38b6('0xa'));var qs=require(_0x38b6('0xb'));var as=require(_0x38b6('0xc'));var hardwareService=require(_0x38b6('0xd'));var logger=require(_0x38b6('0xe'))(_0x38b6('0xf'));var utils=require(_0x38b6('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x38b6('0x11'));var db=require(_0x38b6('0x12'))['db'];function respondWithStatusCode(_0x3ea0e2,_0x43a0e8){_0x43a0e8=_0x43a0e8||0xcc;return function(_0x6f3808){if(_0x6f3808){return _0x3ea0e2['sendStatus'](_0x43a0e8);}return _0x3ea0e2[_0x38b6('0x13')](_0x43a0e8)[_0x38b6('0x14')]();};}function respondWithResult(_0x30d1f8,_0x236fd8){_0x236fd8=_0x236fd8||0xc8;return function(_0x13cd54){if(_0x13cd54){return _0x30d1f8['status'](_0x236fd8)[_0x38b6('0x15')](_0x13cd54);}};}function respondWithFilteredResult(_0x55e7fc,_0x30ff92){return function(_0x346110){if(_0x346110){var _0x11a878=typeof _0x30ff92['offset']===_0x38b6('0x16')&&typeof _0x30ff92[_0x38b6('0x17')]===_0x38b6('0x16');var _0x5bc8bc=_0x346110[_0x38b6('0x18')];var _0x269ff3=_0x11a878?0x0:_0x30ff92[_0x38b6('0x19')];var _0x52c507=_0x11a878?_0x346110['count']:_0x30ff92[_0x38b6('0x19')]+_0x30ff92[_0x38b6('0x17')];var _0x1fd61b;if(_0x52c507>=_0x5bc8bc){_0x52c507=_0x5bc8bc;_0x1fd61b=0xc8;}else{_0x1fd61b=0xce;}_0x55e7fc[_0x38b6('0x13')](_0x1fd61b);return _0x55e7fc[_0x38b6('0x1a')](_0x38b6('0x1b'),_0x269ff3+'-'+_0x52c507+'/'+_0x5bc8bc)[_0x38b6('0x15')](_0x346110);}return null;};}function patchUpdates(_0x3ed194){return function(_0x354408){try{jsonpatch[_0x38b6('0x1c')](_0x354408,_0x3ed194,!![]);}catch(_0x2d4ec8){return BPromise['reject'](_0x2d4ec8);}return _0x354408[_0x38b6('0x1d')]();};}function saveUpdates(_0x453bcc,_0x2acb49){return function(_0x3dc0c8){if(_0x3dc0c8){return _0x3dc0c8[_0x38b6('0x1e')](_0x453bcc)['then'](function(_0x173259){return _0x173259;});}return null;};}function removeEntity(_0x149b41,_0x118da4){return function(_0x20b44d){if(_0x20b44d){return _0x20b44d[_0x38b6('0x1f')]()[_0x38b6('0x20')](function(){_0x149b41[_0x38b6('0x13')](0xcc)[_0x38b6('0x14')]();});}};}function handleEntityNotFound(_0x4e447b,_0x4405f7){return function(_0xe86d48){if(!_0xe86d48){_0x4e447b[_0x38b6('0x21')](0x194);}return _0xe86d48;};}function handleError(_0x329d4f,_0x4c9edd){_0x4c9edd=_0x4c9edd||0x1f4;return function(_0x2250ae){logger['error'](_0x2250ae[_0x38b6('0x22')]);if(_0x2250ae[_0x38b6('0x23')]){delete _0x2250ae['name'];}_0x329d4f[_0x38b6('0x13')](_0x4c9edd)['send'](_0x2250ae);};}exports[_0x38b6('0x24')]=function(_0xd9ab6a,_0x11ff32){var _0x32a35e={},_0x471c4f={},_0x375d12={'count':0x0,'rows':[]};var _0x57cece=_[_0x38b6('0x25')](db['JscriptyQuestionReport'][_0x38b6('0x26')],function(_0x202d54){return{'name':_0x202d54[_0x38b6('0x27')],'type':_0x202d54['type'][_0x38b6('0x28')]};});_0x471c4f[_0x38b6('0x29')]=_[_0x38b6('0x25')](_0x57cece,_0x38b6('0x23'));_0x471c4f['query']=_[_0x38b6('0x2a')](_0xd9ab6a[_0x38b6('0x2b')]);_0x471c4f[_0x38b6('0x2c')]=_[_0x38b6('0x2d')](_0x471c4f[_0x38b6('0x29')],_0x471c4f['query']);_0x32a35e['attributes']=_[_0x38b6('0x2d')](_0x471c4f[_0x38b6('0x29')],qs[_0x38b6('0x2e')](_0xd9ab6a[_0x38b6('0x2b')][_0x38b6('0x2e')]));_0x32a35e['attributes']=_0x32a35e[_0x38b6('0x2f')][_0x38b6('0x30')]?_0x32a35e[_0x38b6('0x2f')]:_0x471c4f[_0x38b6('0x29')];if(!_0xd9ab6a[_0x38b6('0x2b')][_0x38b6('0x31')](_0x38b6('0x32'))){_0x32a35e[_0x38b6('0x17')]=qs[_0x38b6('0x17')](_0xd9ab6a[_0x38b6('0x2b')][_0x38b6('0x17')]);_0x32a35e[_0x38b6('0x19')]=qs[_0x38b6('0x19')](_0xd9ab6a[_0x38b6('0x2b')][_0x38b6('0x19')]);}_0x32a35e['order']=qs[_0x38b6('0x33')](_0xd9ab6a[_0x38b6('0x2b')][_0x38b6('0x33')]);_0x32a35e[_0x38b6('0x34')]=qs[_0x38b6('0x2c')](_[_0x38b6('0x35')](_0xd9ab6a[_0x38b6('0x2b')],_0x471c4f['filters']),_0x57cece);if(_0xd9ab6a[_0x38b6('0x2b')][_0x38b6('0x36')]){_0x32a35e[_0x38b6('0x34')]=_['merge'](_0x32a35e[_0x38b6('0x34')],{'$or':_['map'](_0x57cece,function(_0x1e4a28){if(_0x1e4a28[_0x38b6('0x37')]!==_0x38b6('0x38')){var _0x3dcca3={};_0x3dcca3[_0x1e4a28[_0x38b6('0x23')]]={'$like':'%'+_0xd9ab6a['query'][_0x38b6('0x36')]+'%'};return _0x3dcca3;}})});}_0x32a35e=_[_0x38b6('0x39')]({},_0x32a35e,_0xd9ab6a[_0x38b6('0x3a')]);var _0x12836f={'where':_0x32a35e['where']};return db[_0x38b6('0x3b')][_0x38b6('0x18')](_0x12836f)[_0x38b6('0x20')](function(_0x550f20){_0x375d12[_0x38b6('0x18')]=_0x550f20;if(_0xd9ab6a[_0x38b6('0x2b')]['includeAll']){_0x32a35e[_0x38b6('0x3c')]=[{'all':!![]}];}return db[_0x38b6('0x3b')][_0x38b6('0x3d')](_0x32a35e);})[_0x38b6('0x20')](function(_0x1d48da){_0x375d12[_0x38b6('0x3e')]=_0x1d48da;return _0x375d12;})[_0x38b6('0x20')](respondWithFilteredResult(_0x11ff32,_0x32a35e))['catch'](handleError(_0x11ff32,null));};exports[_0x38b6('0x3f')]=function(_0xe2d5bb,_0x50503e){var _0xefd021={'raw':!![],'where':{'id':_0xe2d5bb[_0x38b6('0x40')]['id']}},_0x5ebfe1={};_0x5ebfe1[_0x38b6('0x29')]=_[_0x38b6('0x2a')](db[_0x38b6('0x3b')][_0x38b6('0x26')]);_0x5ebfe1[_0x38b6('0x2b')]=_[_0x38b6('0x2a')](_0xe2d5bb[_0x38b6('0x2b')]);_0x5ebfe1[_0x38b6('0x2c')]=_[_0x38b6('0x2d')](_0x5ebfe1[_0x38b6('0x29')],_0x5ebfe1[_0x38b6('0x2b')]);_0xefd021[_0x38b6('0x2f')]=_[_0x38b6('0x2d')](_0x5ebfe1[_0x38b6('0x29')],qs[_0x38b6('0x2e')](_0xe2d5bb[_0x38b6('0x2b')][_0x38b6('0x2e')]));_0xefd021[_0x38b6('0x2f')]=_0xefd021['attributes'][_0x38b6('0x30')]?_0xefd021[_0x38b6('0x2f')]:_0x5ebfe1['model'];if(_0xe2d5bb[_0x38b6('0x2b')][_0x38b6('0x41')]){_0xefd021['include']=[{'all':!![]}];}_0xefd021=_[_0x38b6('0x39')]({},_0xefd021,_0xe2d5bb[_0x38b6('0x3a')]);return db[_0x38b6('0x3b')][_0x38b6('0x42')](_0xefd021)[_0x38b6('0x20')](handleEntityNotFound(_0x50503e,null))[_0x38b6('0x20')](respondWithResult(_0x50503e,null))[_0x38b6('0x43')](handleError(_0x50503e,null));};exports[_0x38b6('0x44')]=function(_0x1f9357,_0x12e2be){return db[_0x38b6('0x3b')][_0x38b6('0x44')](_0x1f9357[_0x38b6('0x45')],{})[_0x38b6('0x20')](respondWithResult(_0x12e2be,0xc9))[_0x38b6('0x43')](handleError(_0x12e2be,null));};exports[_0x38b6('0x1e')]=function(_0x43b0c7,_0x43a510){if(_0x43b0c7[_0x38b6('0x45')]['id']){delete _0x43b0c7[_0x38b6('0x45')]['id'];}return db[_0x38b6('0x3b')]['find']({'where':{'id':_0x43b0c7['params']['id']}})['then'](handleEntityNotFound(_0x43a510,null))[_0x38b6('0x20')](saveUpdates(_0x43b0c7[_0x38b6('0x45')],null))['then'](respondWithResult(_0x43a510,null))[_0x38b6('0x43')](handleError(_0x43a510,null));};exports[_0x38b6('0x1f')]=function(_0x250606,_0x44b640){return db[_0x38b6('0x3b')]['find']({'where':{'id':_0x250606[_0x38b6('0x40')]['id']}})['then'](handleEntityNotFound(_0x44b640,null))[_0x38b6('0x20')](removeEntity(_0x44b640,null))[_0x38b6('0x43')](handleError(_0x44b640,null));};exports[_0x38b6('0x46')]=function(_0x1c6aaf,_0xf6ebc3){return db[_0x38b6('0x3b')][_0x38b6('0x46')]()['then'](respondWithResult(_0xf6ebc3,null))[_0x38b6('0x43')](handleError(_0xf6ebc3,null));}; \ No newline at end of file +var _0x802b=['ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','JscriptyQuestionReport','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x802b,0x92));var _0xb802=function(_0x4bd29a,_0x1b88ff){_0x4bd29a=_0x4bd29a-0x0;var _0xdf0693=_0x802b[_0x4bd29a];return _0xdf0693;};'use strict';var emlformat=require(_0xb802('0x0'));var rimraf=require(_0xb802('0x1'));var zipdir=require(_0xb802('0x2'));var jsonpatch=require(_0xb802('0x3'));var rp=require(_0xb802('0x4'));var moment=require('moment');var BPromise=require(_0xb802('0x5'));var Mustache=require(_0xb802('0x6'));var util=require(_0xb802('0x7'));var path=require(_0xb802('0x8'));var sox=require(_0xb802('0x9'));var csv=require('to-csv');var ejs=require(_0xb802('0xa'));var fs=require('fs');var fs_extra=require(_0xb802('0xb'));var _=require(_0xb802('0xc'));var squel=require('squel');var crypto=require(_0xb802('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb802('0xe'));var toCsv=require(_0xb802('0xf'));var querystring=require(_0xb802('0x10'));var Papa=require(_0xb802('0x11'));var Redis=require(_0xb802('0x12'));var authService=require(_0xb802('0x13'));var qs=require(_0xb802('0x14'));var as=require(_0xb802('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb802('0x16'))(_0xb802('0x17'));var utils=require('../../config/utils');var config=require(_0xb802('0x18'));var licenseUtil=require(_0xb802('0x19'));var db=require(_0xb802('0x1a'))['db'];function respondWithStatusCode(_0x214eea,_0x435ee2){_0x435ee2=_0x435ee2||0xcc;return function(_0x4b96ef){if(_0x4b96ef){return _0x214eea['sendStatus'](_0x435ee2);}return _0x214eea[_0xb802('0x1b')](_0x435ee2)['end']();};}function respondWithResult(_0x2646a3,_0x69de69){_0x69de69=_0x69de69||0xc8;return function(_0x2f27fc){if(_0x2f27fc){return _0x2646a3['status'](_0x69de69)[_0xb802('0x1c')](_0x2f27fc);}};}function respondWithFilteredResult(_0x275d12,_0x1636a4){return function(_0x393bfd){if(_0x393bfd){var _0x5731d9=typeof _0x1636a4[_0xb802('0x1d')]==='undefined'&&typeof _0x1636a4[_0xb802('0x1e')]===_0xb802('0x1f');var _0x2d5a0e=_0x393bfd[_0xb802('0x20')];var _0x1e72f1=_0x5731d9?0x0:_0x1636a4[_0xb802('0x1d')];var _0x4693ae=_0x5731d9?_0x393bfd[_0xb802('0x20')]:_0x1636a4[_0xb802('0x1d')]+_0x1636a4['limit'];var _0x2fc9bb;if(_0x4693ae>=_0x2d5a0e){_0x4693ae=_0x2d5a0e;_0x2fc9bb=0xc8;}else{_0x2fc9bb=0xce;}_0x275d12[_0xb802('0x1b')](_0x2fc9bb);return _0x275d12['set'](_0xb802('0x21'),_0x1e72f1+'-'+_0x4693ae+'/'+_0x2d5a0e)['json'](_0x393bfd);}return null;};}function patchUpdates(_0x2a3521){return function(_0x258469){try{jsonpatch['apply'](_0x258469,_0x2a3521,!![]);}catch(_0x356df4){return BPromise[_0xb802('0x22')](_0x356df4);}return _0x258469[_0xb802('0x23')]();};}function saveUpdates(_0x27d564,_0x9a8d8a){return function(_0x54afc8){if(_0x54afc8){return _0x54afc8[_0xb802('0x24')](_0x27d564)['then'](function(_0x3db9bb){return _0x3db9bb;});}return null;};}function removeEntity(_0x156305,_0x17a462){return function(_0x1e1b6f){if(_0x1e1b6f){return _0x1e1b6f[_0xb802('0x25')]()[_0xb802('0x26')](function(){_0x156305[_0xb802('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x238ba2,_0x279a22){return function(_0x4e93a3){if(!_0x4e93a3){_0x238ba2[_0xb802('0x27')](0x194);}return _0x4e93a3;};}function handleError(_0x5e3315,_0x5cb7b6){_0x5cb7b6=_0x5cb7b6||0x1f4;return function(_0x2388f7){logger[_0xb802('0x28')](_0x2388f7[_0xb802('0x29')]);if(_0x2388f7[_0xb802('0x2a')]){delete _0x2388f7[_0xb802('0x2a')];}_0x5e3315[_0xb802('0x1b')](_0x5cb7b6)['send'](_0x2388f7);};}exports[_0xb802('0x2b')]=function(_0x209ee0,_0x51104d){var _0x513c74={},_0x263275={},_0x2e3a8e={'count':0x0,'rows':[]};var _0x52a82e=_[_0xb802('0x2c')](db['JscriptyQuestionReport'][_0xb802('0x2d')],function(_0xfae4a6){return{'name':_0xfae4a6[_0xb802('0x2e')],'type':_0xfae4a6['type'][_0xb802('0x2f')]};});_0x263275['model']=_[_0xb802('0x2c')](_0x52a82e,_0xb802('0x2a'));_0x263275[_0xb802('0x30')]=_[_0xb802('0x31')](_0x209ee0[_0xb802('0x30')]);_0x263275['filters']=_['intersection'](_0x263275[_0xb802('0x32')],_0x263275[_0xb802('0x30')]);_0x513c74['attributes']=_[_0xb802('0x33')](_0x263275[_0xb802('0x32')],qs[_0xb802('0x34')](_0x209ee0['query'][_0xb802('0x34')]));_0x513c74[_0xb802('0x35')]=_0x513c74['attributes']['length']?_0x513c74['attributes']:_0x263275[_0xb802('0x32')];if(!_0x209ee0['query'][_0xb802('0x36')](_0xb802('0x37'))){_0x513c74[_0xb802('0x1e')]=qs[_0xb802('0x1e')](_0x209ee0['query'][_0xb802('0x1e')]);_0x513c74[_0xb802('0x1d')]=qs[_0xb802('0x1d')](_0x209ee0[_0xb802('0x30')][_0xb802('0x1d')]);}_0x513c74[_0xb802('0x38')]=qs[_0xb802('0x39')](_0x209ee0['query'][_0xb802('0x39')]);_0x513c74[_0xb802('0x3a')]=qs[_0xb802('0x3b')](_[_0xb802('0x3c')](_0x209ee0[_0xb802('0x30')],_0x263275[_0xb802('0x3b')]),_0x52a82e);if(_0x209ee0[_0xb802('0x30')][_0xb802('0x3d')]){_0x513c74[_0xb802('0x3a')]=_[_0xb802('0x3e')](_0x513c74[_0xb802('0x3a')],{'$or':_['map'](_0x52a82e,function(_0x5e2c29){if(_0x5e2c29[_0xb802('0x3f')]!==_0xb802('0x40')){var _0x366edf={};_0x366edf[_0x5e2c29[_0xb802('0x2a')]]={'$like':'%'+_0x209ee0[_0xb802('0x30')][_0xb802('0x3d')]+'%'};return _0x366edf;}})});}_0x513c74=_[_0xb802('0x3e')]({},_0x513c74,_0x209ee0[_0xb802('0x41')]);var _0x1809ad={'where':_0x513c74[_0xb802('0x3a')]};return db['JscriptyQuestionReport'][_0xb802('0x20')](_0x1809ad)[_0xb802('0x26')](function(_0x4529e8){_0x2e3a8e[_0xb802('0x20')]=_0x4529e8;if(_0x209ee0[_0xb802('0x30')][_0xb802('0x42')]){_0x513c74[_0xb802('0x43')]=[{'all':!![]}];}return db[_0xb802('0x44')][_0xb802('0x45')](_0x513c74);})[_0xb802('0x26')](function(_0x120a23){_0x2e3a8e[_0xb802('0x46')]=_0x120a23;return _0x2e3a8e;})['then'](respondWithFilteredResult(_0x51104d,_0x513c74))[_0xb802('0x47')](handleError(_0x51104d,null));};exports[_0xb802('0x48')]=function(_0x5293b2,_0x4aa87f){var _0x398486={'raw':!![],'where':{'id':_0x5293b2['params']['id']}},_0x9118cf={};_0x9118cf[_0xb802('0x32')]=_[_0xb802('0x31')](db[_0xb802('0x44')][_0xb802('0x2d')]);_0x9118cf[_0xb802('0x30')]=_[_0xb802('0x31')](_0x5293b2[_0xb802('0x30')]);_0x9118cf[_0xb802('0x3b')]=_['intersection'](_0x9118cf[_0xb802('0x32')],_0x9118cf[_0xb802('0x30')]);_0x398486[_0xb802('0x35')]=_[_0xb802('0x33')](_0x9118cf[_0xb802('0x32')],qs[_0xb802('0x34')](_0x5293b2[_0xb802('0x30')][_0xb802('0x34')]));_0x398486[_0xb802('0x35')]=_0x398486[_0xb802('0x35')]['length']?_0x398486[_0xb802('0x35')]:_0x9118cf['model'];if(_0x5293b2[_0xb802('0x30')][_0xb802('0x42')]){_0x398486[_0xb802('0x43')]=[{'all':!![]}];}_0x398486=_['merge']({},_0x398486,_0x5293b2[_0xb802('0x41')]);return db['JscriptyQuestionReport'][_0xb802('0x49')](_0x398486)[_0xb802('0x26')](handleEntityNotFound(_0x4aa87f,null))[_0xb802('0x26')](respondWithResult(_0x4aa87f,null))[_0xb802('0x47')](handleError(_0x4aa87f,null));};exports[_0xb802('0x4a')]=function(_0x335b5a,_0x10932d){return db[_0xb802('0x44')][_0xb802('0x4a')](_0x335b5a['body'],{})[_0xb802('0x26')](respondWithResult(_0x10932d,0xc9))[_0xb802('0x47')](handleError(_0x10932d,null));};exports[_0xb802('0x24')]=function(_0x308644,_0x3c3a28){if(_0x308644[_0xb802('0x4b')]['id']){delete _0x308644[_0xb802('0x4b')]['id'];}return db[_0xb802('0x44')]['find']({'where':{'id':_0x308644[_0xb802('0x4c')]['id']}})[_0xb802('0x26')](handleEntityNotFound(_0x3c3a28,null))['then'](saveUpdates(_0x308644[_0xb802('0x4b')],null))[_0xb802('0x26')](respondWithResult(_0x3c3a28,null))['catch'](handleError(_0x3c3a28,null));};exports[_0xb802('0x25')]=function(_0x124ff8,_0x887173){return db[_0xb802('0x44')][_0xb802('0x49')]({'where':{'id':_0x124ff8['params']['id']}})[_0xb802('0x26')](handleEntityNotFound(_0x887173,null))[_0xb802('0x26')](removeEntity(_0x887173,null))[_0xb802('0x47')](handleError(_0x887173,null));};exports['describe']=function(_0x54c7d7,_0x416ce3){return db[_0xb802('0x44')][_0xb802('0x4d')]()['then'](respondWithResult(_0x416ce3,null))[_0xb802('0x47')](handleError(_0x416ce3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index b2c8233..f74ea29 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 _0x61fa=['JscriptyQuestionReport','lodash','api','moment','bluebird','request-promise','../../config/environment','./jscriptyQuestionReport.attributes','define'];(function(_0xcfcbaa,_0x369d95){var _0x157ed0=function(_0x3a0b62){while(--_0x3a0b62){_0xcfcbaa['push'](_0xcfcbaa['shift']());}};_0x157ed0(++_0x369d95);}(_0x61fa,0x1b1));var _0xa61f=function(_0x4f6c26,_0x5c2c54){_0x4f6c26=_0x4f6c26-0x0;var _0x4809a0=_0x61fa[_0x4f6c26];return _0x4809a0;};'use strict';var _=require(_0xa61f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa61f('0x1'));var moment=require(_0xa61f('0x2'));var BPromise=require(_0xa61f('0x3'));var rp=require(_0xa61f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa61f('0x5'));var attributes=require(_0xa61f('0x6'));module['exports']=function(_0x41033b,_0x6f2e89){return _0x41033b[_0xa61f('0x7')](_0xa61f('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeca9=['path','rimraf','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','bluebird'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xeca9,0x181));var _0x9eca=function(_0x2631c1,_0x78938){_0x2631c1=_0x2631c1-0x0;var _0x3a5f1f=_0xeca9[_0x2631c1];return _0x3a5f1f;};'use strict';var _=require(_0x9eca('0x0'));var util=require(_0x9eca('0x1'));var logger=require(_0x9eca('0x2'))(_0x9eca('0x3'));var moment=require('moment');var BPromise=require(_0x9eca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9eca('0x5'));var rimraf=require(_0x9eca('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0x9eca('0x7')]=function(_0x2c7a9a,_0x63d7ac){return _0x2c7a9a['define'](_0x9eca('0x8'),attributes,{'tableName':_0x9eca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 23ee50a..213412d 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 _0x4754=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5f50d4,_0x3d876a){var _0x2a13b0=function(_0xf7c3af){while(--_0xf7c3af){_0x5f50d4['push'](_0x5f50d4['shift']());}};_0x2a13b0(++_0x3d876a);}(_0x4754,0x1d7));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4475('0x0'));var util=require(_0x4475('0x1'));var moment=require(_0x4475('0x2'));var BPromise=require(_0x4475('0x3'));var rs=require(_0x4475('0x4'));var fs=require('fs');var Redis=require(_0x4475('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4475('0x6'));var logger=require(_0x4475('0x7'))(_0x4475('0x8'));var config=require(_0x4475('0x9'));var jayson=require(_0x4475('0xa'));var client=jayson[_0x4475('0xb')][_0x4475('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x298726,_0x12c798,_0x33d8e5){return new BPromise(function(_0x52aa2d,_0x31e2b8){return client[_0x4475('0xd')](_0x298726,_0x33d8e5)[_0x4475('0xe')](function(_0x536712){logger[_0x4475('0xf')](_0x4475('0x10'),_0x12c798,_0x4475('0x11'));logger[_0x4475('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x12c798,'request\x20sent',JSON[_0x4475('0x13')](_0x536712));if(_0x536712[_0x4475('0x14')]){if(_0x536712[_0x4475('0x14')]['code']===0x1f4){logger[_0x4475('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x12c798,_0x536712[_0x4475('0x14')][_0x4475('0x15')]);return _0x31e2b8(_0x536712[_0x4475('0x14')]['message']);}logger[_0x4475('0x14')](_0x4475('0x10'),_0x12c798,_0x536712[_0x4475('0x14')][_0x4475('0x15')]);return _0x52aa2d(_0x536712['error'][_0x4475('0x15')]);}else{logger[_0x4475('0xf')](_0x4475('0x10'),_0x12c798,_0x4475('0x11'));_0x52aa2d(_0x536712[_0x4475('0x16')][_0x4475('0x15')]);}})[_0x4475('0x17')](function(_0x431767){logger[_0x4475('0x14')](_0x4475('0x10'),_0x12c798,_0x431767);_0x31e2b8(_0x431767);});});} \ No newline at end of file +var _0xeb5c=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x35aeb5,_0x4e8855){var _0x18fcec=function(_0x2f81a5){while(--_0x2f81a5){_0x35aeb5['push'](_0x35aeb5['shift']());}};_0x18fcec(++_0x4e8855);}(_0xeb5c,0xed));var _0xceb5=function(_0x579dad,_0x200a74){_0x579dad=_0x579dad-0x0;var _0x3a53fa=_0xeb5c[_0x579dad];return _0x3a53fa;};'use strict';var _=require(_0xceb5('0x0'));var util=require(_0xceb5('0x1'));var moment=require(_0xceb5('0x2'));var BPromise=require(_0xceb5('0x3'));var rs=require(_0xceb5('0x4'));var fs=require('fs');var Redis=require(_0xceb5('0x5'));var db=require(_0xceb5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xceb5('0x7'))(_0xceb5('0x8'));var config=require('../../config/environment');var jayson=require(_0xceb5('0x9'));var client=jayson[_0xceb5('0xa')][_0xceb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33cf57,_0x10c09d,_0x11374f){return new BPromise(function(_0xf35ec4,_0x497d37){return client[_0xceb5('0xc')](_0x33cf57,_0x11374f)[_0xceb5('0xd')](function(_0x2a347c){logger['info'](_0xceb5('0xe'),_0x10c09d,_0xceb5('0xf'));logger[_0xceb5('0x10')](_0xceb5('0x11'),_0x10c09d,_0xceb5('0xf'),JSON['stringify'](_0x2a347c));if(_0x2a347c['error']){if(_0x2a347c[_0xceb5('0x12')][_0xceb5('0x13')]===0x1f4){logger['error'](_0xceb5('0xe'),_0x10c09d,_0x2a347c['error'][_0xceb5('0x14')]);return _0x497d37(_0x2a347c[_0xceb5('0x12')][_0xceb5('0x14')]);}logger[_0xceb5('0x12')](_0xceb5('0xe'),_0x10c09d,_0x2a347c['error'][_0xceb5('0x14')]);return _0xf35ec4(_0x2a347c[_0xceb5('0x12')][_0xceb5('0x14')]);}else{logger[_0xceb5('0x15')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x10c09d,'request\x20sent');_0xf35ec4(_0x2a347c[_0xceb5('0x16')][_0xceb5('0x14')]);}})['catch'](function(_0x2272bc){logger[_0xceb5('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x10c09d,_0x2272bc);_0x497d37(_0x2272bc);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 7e755b5..4bc1a3a 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 _0x0b43=['/:id/questions','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show'];(function(_0x3b8be2,_0x541473){var _0x2824fe=function(_0x197129){while(--_0x197129){_0x3b8be2['push'](_0x3b8be2['shift']());}};_0x2824fe(++_0x541473);}(_0x0b43,0x94));var _0x30b4=function(_0x299861,_0x86225f){_0x299861=_0x299861-0x0;var _0x12cdb3=_0x0b43[_0x299861];return _0x12cdb3;};'use strict';var multer=require(_0x30b4('0x0'));var util=require(_0x30b4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x30b4('0x2'));var router=express[_0x30b4('0x3')]();var fs_extra=require(_0x30b4('0x4'));var auth=require(_0x30b4('0x5'));var interaction=require(_0x30b4('0x6'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0x30b4('0x7')]('/',auth['isAuthenticated'](),controller[_0x30b4('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x30b4('0x7')](_0x30b4('0x9'),auth[_0x30b4('0xa')](),controller[_0x30b4('0xb')]);router[_0x30b4('0x7')](_0x30b4('0xc'),auth[_0x30b4('0xa')](),controller['getQuestions']);router[_0x30b4('0xd')]('/',auth[_0x30b4('0xa')](),controller[_0x30b4('0xe')]);router[_0x30b4('0xf')](_0x30b4('0x9'),auth[_0x30b4('0xa')](),controller[_0x30b4('0x10')]);router[_0x30b4('0x11')](_0x30b4('0x9'),auth[_0x30b4('0xa')](),controller[_0x30b4('0x12')]);module[_0x30b4('0x13')]=router; \ No newline at end of file +var _0x8647=['post','create','put','update','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','getQuestions'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x8647,0x115));var _0x7864=function(_0x5879d2,_0x30bf5e){_0x5879d2=_0x5879d2-0x0;var _0x3194a5=_0x8647[_0x5879d2];return _0x3194a5;};'use strict';var multer=require('multer');var util=require(_0x7864('0x0'));var path=require(_0x7864('0x1'));var timeout=require(_0x7864('0x2'));var express=require('express');var router=express[_0x7864('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7864('0x4'));var interaction=require(_0x7864('0x5'));var config=require(_0x7864('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0x7864('0x7')]('/',auth[_0x7864('0x8')](),controller['index']);router[_0x7864('0x7')](_0x7864('0x9'),auth[_0x7864('0x8')](),controller['describe']);router[_0x7864('0x7')](_0x7864('0xa'),auth[_0x7864('0x8')](),controller['show']);router['get']('/:id/questions',auth[_0x7864('0x8')](),controller[_0x7864('0xb')]);router[_0x7864('0xc')]('/',auth['isAuthenticated'](),controller[_0x7864('0xd')]);router[_0x7864('0xe')](_0x7864('0xa'),auth[_0x7864('0x8')](),controller[_0x7864('0xf')]);router['delete']('/:id',auth[_0x7864('0x8')](),controller['destroy']);module[_0x7864('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index d3fd2de..e602548 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 _0x0d24=['setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','exports','DATE'];(function(_0x4a2707,_0x56a7aa){var _0x2eb468=function(_0x5ef08d){while(--_0x5ef08d){_0x4a2707['push'](_0x4a2707['shift']());}};_0x2eb468(++_0x56a7aa);}(_0x0d24,0xeb));var _0x40d2=function(_0x4a8142,_0x482a01){_0x4a8142=_0x4a8142-0x0;var _0x548ee5=_0x0d24[_0x4a8142];return _0x548ee5;};'use strict';var moment=require(_0x40d2('0x0'));var Sequelize=require('sequelize');module[_0x40d2('0x1')]={'starttime':{'type':Sequelize[_0x40d2('0x2')],'set':function(_0x495591){this[_0x40d2('0x3')]('starttime',_0x495591);this['setDataValue'](_0x40d2('0x4'),moment()['format'](_0x40d2('0x5')));}},'endtime':{'type':Sequelize[_0x40d2('0x2')]},'membername':{'type':Sequelize[_0x40d2('0x6')]},'projectname':{'type':Sequelize[_0x40d2('0x6')]},'queue':{'type':Sequelize[_0x40d2('0x6')]},'uniqueid':{'type':Sequelize[_0x40d2('0x6')]},'calleridname':{'type':Sequelize[_0x40d2('0x6')]},'calleridnum':{'type':Sequelize[_0x40d2('0x6')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd9bf=['format','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd9bf,0x162));var _0xfd9b=function(_0x5b6c1d,_0x5d8b64){_0x5b6c1d=_0x5b6c1d-0x0;var _0x218846=_0xd9bf[_0x5b6c1d];return _0x218846;};'use strict';var moment=require(_0xfd9b('0x0'));var Sequelize=require(_0xfd9b('0x1'));module[_0xfd9b('0x2')]={'starttime':{'type':Sequelize[_0xfd9b('0x3')],'set':function(_0x5a9636){this[_0xfd9b('0x4')](_0xfd9b('0x5'),_0x5a9636);this[_0xfd9b('0x4')]('endtime',moment()[_0xfd9b('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xfd9b('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xfd9b('0x7')]},'queue':{'type':Sequelize[_0xfd9b('0x7')]},'uniqueid':{'type':Sequelize[_0xfd9b('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xfd9b('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 4f098cb..45629ea 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 _0x2f03=['describe','getQuestions','findOne','SessionId','JscriptyQuestionReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','JscriptySessionReport','findAll','rows','show','params','keys','rawAttributes','create','body','catch','find'];(function(_0x57849c,_0x3ec50f){var _0x3c6dbb=function(_0x47eb72){while(--_0x47eb72){_0x57849c['push'](_0x57849c['shift']());}};_0x3c6dbb(++_0x3ec50f);}(_0x2f03,0x107));var _0x32f0=function(_0x315e51,_0xe12b3c){_0x315e51=_0x315e51-0x0;var _0x307619=_0x2f03[_0x315e51];return _0x307619;};'use strict';var emlformat=require(_0x32f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32f0('0x1'));var jsonpatch=require(_0x32f0('0x2'));var rp=require(_0x32f0('0x3'));var moment=require(_0x32f0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x32f0('0x5'));var path=require(_0x32f0('0x6'));var sox=require('sox');var csv=require(_0x32f0('0x7'));var ejs=require(_0x32f0('0x8'));var fs=require('fs');var fs_extra=require(_0x32f0('0x9'));var _=require(_0x32f0('0xa'));var squel=require(_0x32f0('0xb'));var crypto=require(_0x32f0('0xc'));var jsforce=require(_0x32f0('0xd'));var deskjs=require(_0x32f0('0xe'));var toCsv=require(_0x32f0('0x7'));var querystring=require(_0x32f0('0xf'));var Papa=require(_0x32f0('0x10'));var Redis=require(_0x32f0('0x11'));var authService=require(_0x32f0('0x12'));var qs=require(_0x32f0('0x13'));var as=require(_0x32f0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x32f0('0x15'))(_0x32f0('0x16'));var utils=require(_0x32f0('0x17'));var config=require(_0x32f0('0x18'));var licenseUtil=require(_0x32f0('0x19'));var db=require(_0x32f0('0x1a'))['db'];function respondWithStatusCode(_0xc93257,_0xe40ce1){_0xe40ce1=_0xe40ce1||0xcc;return function(_0x2b80f3){if(_0x2b80f3){return _0xc93257[_0x32f0('0x1b')](_0xe40ce1);}return _0xc93257[_0x32f0('0x1c')](_0xe40ce1)[_0x32f0('0x1d')]();};}function respondWithResult(_0x31179f,_0x1e6c75){_0x1e6c75=_0x1e6c75||0xc8;return function(_0x1faef3){if(_0x1faef3){return _0x31179f[_0x32f0('0x1c')](_0x1e6c75)[_0x32f0('0x1e')](_0x1faef3);}};}function respondWithFilteredResult(_0x1c8ba5,_0xfbfeeb){return function(_0x1a878f){if(_0x1a878f){var _0x5a9841=typeof _0xfbfeeb['offset']===_0x32f0('0x1f')&&typeof _0xfbfeeb[_0x32f0('0x20')]==='undefined';var _0x361d2c=_0x1a878f['count'];var _0x537720=_0x5a9841?0x0:_0xfbfeeb[_0x32f0('0x21')];var _0x3d3d85=_0x5a9841?_0x1a878f[_0x32f0('0x22')]:_0xfbfeeb[_0x32f0('0x21')]+_0xfbfeeb[_0x32f0('0x20')];var _0x4968ba;if(_0x3d3d85>=_0x361d2c){_0x3d3d85=_0x361d2c;_0x4968ba=0xc8;}else{_0x4968ba=0xce;}_0x1c8ba5['status'](_0x4968ba);return _0x1c8ba5[_0x32f0('0x23')](_0x32f0('0x24'),_0x537720+'-'+_0x3d3d85+'/'+_0x361d2c)[_0x32f0('0x1e')](_0x1a878f);}return null;};}function patchUpdates(_0x1915a0){return function(_0x29ae6e){try{jsonpatch[_0x32f0('0x25')](_0x29ae6e,_0x1915a0,!![]);}catch(_0x3da102){return BPromise[_0x32f0('0x26')](_0x3da102);}return _0x29ae6e[_0x32f0('0x27')]();};}function saveUpdates(_0x5310,_0xfb5a93){return function(_0x329139){if(_0x329139){return _0x329139[_0x32f0('0x28')](_0x5310)[_0x32f0('0x29')](function(_0x238cb1){return _0x238cb1;});}return null;};}function removeEntity(_0x4ac32a,_0x204fbc){return function(_0xb467b9){if(_0xb467b9){return _0xb467b9[_0x32f0('0x2a')]()['then'](function(){_0x4ac32a[_0x32f0('0x1c')](0xcc)[_0x32f0('0x1d')]();});}};}function handleEntityNotFound(_0x2a5c6b,_0x249a6e){return function(_0x2706ae){if(!_0x2706ae){_0x2a5c6b[_0x32f0('0x1b')](0x194);}return _0x2706ae;};}function handleError(_0x34d8cd,_0xbcf879){_0xbcf879=_0xbcf879||0x1f4;return function(_0x50a2da){logger[_0x32f0('0x2b')](_0x50a2da[_0x32f0('0x2c')]);if(_0x50a2da['name']){delete _0x50a2da[_0x32f0('0x2d')];}_0x34d8cd['status'](_0xbcf879)[_0x32f0('0x2e')](_0x50a2da);};}exports[_0x32f0('0x2f')]=function(_0x352a08,_0x11718a){var _0x2cf535={},_0x335430={},_0x315523={'count':0x0,'rows':[]};var _0x7f50e0=_[_0x32f0('0x30')](db['JscriptySessionReport']['rawAttributes'],function(_0x285249){return{'name':_0x285249[_0x32f0('0x31')],'type':_0x285249[_0x32f0('0x32')][_0x32f0('0x33')]};});_0x335430['model']=_[_0x32f0('0x30')](_0x7f50e0,'name');_0x335430[_0x32f0('0x34')]=_['keys'](_0x352a08[_0x32f0('0x34')]);_0x335430[_0x32f0('0x35')]=_[_0x32f0('0x36')](_0x335430[_0x32f0('0x37')],_0x335430['query']);_0x2cf535[_0x32f0('0x38')]=_['intersection'](_0x335430[_0x32f0('0x37')],qs['fields'](_0x352a08['query'][_0x32f0('0x39')]));_0x2cf535['attributes']=_0x2cf535[_0x32f0('0x38')][_0x32f0('0x3a')]?_0x2cf535[_0x32f0('0x38')]:_0x335430['model'];if(!_0x352a08[_0x32f0('0x34')][_0x32f0('0x3b')]('nolimit')){_0x2cf535['limit']=qs['limit'](_0x352a08[_0x32f0('0x34')]['limit']);_0x2cf535['offset']=qs[_0x32f0('0x21')](_0x352a08[_0x32f0('0x34')]['offset']);}_0x2cf535[_0x32f0('0x3c')]=qs[_0x32f0('0x3d')](_0x352a08[_0x32f0('0x34')][_0x32f0('0x3d')]);_0x2cf535[_0x32f0('0x3e')]=qs['filters'](_[_0x32f0('0x3f')](_0x352a08['query'],_0x335430[_0x32f0('0x35')]),_0x7f50e0);if(_0x352a08['query'][_0x32f0('0x40')]){_0x2cf535[_0x32f0('0x3e')]=_[_0x32f0('0x41')](_0x2cf535[_0x32f0('0x3e')],{'$or':_[_0x32f0('0x30')](_0x7f50e0,function(_0x597d3d){if(_0x597d3d['type']!==_0x32f0('0x42')){var _0x23d046={};_0x23d046[_0x597d3d[_0x32f0('0x2d')]]={'$like':'%'+_0x352a08['query']['filter']+'%'};return _0x23d046;}})});}_0x2cf535=_['merge']({},_0x2cf535,_0x352a08[_0x32f0('0x43')]);var _0x3a0782={'where':_0x2cf535[_0x32f0('0x3e')]};return db['JscriptySessionReport']['count'](_0x3a0782)['then'](function(_0x5422f4){_0x315523[_0x32f0('0x22')]=_0x5422f4;if(_0x352a08[_0x32f0('0x34')][_0x32f0('0x44')]){_0x2cf535[_0x32f0('0x45')]=[{'all':!![]}];}return db[_0x32f0('0x46')][_0x32f0('0x47')](_0x2cf535);})[_0x32f0('0x29')](function(_0x11058d){_0x315523[_0x32f0('0x48')]=_0x11058d;return _0x315523;})[_0x32f0('0x29')](respondWithFilteredResult(_0x11718a,_0x2cf535))['catch'](handleError(_0x11718a,null));};exports[_0x32f0('0x49')]=function(_0x28a78e,_0x285b19){var _0x10aa57={'raw':!![],'where':{'id':_0x28a78e[_0x32f0('0x4a')]['id']}},_0x306b1c={};_0x306b1c['model']=_[_0x32f0('0x4b')](db[_0x32f0('0x46')][_0x32f0('0x4c')]);_0x306b1c[_0x32f0('0x34')]=_['keys'](_0x28a78e['query']);_0x306b1c[_0x32f0('0x35')]=_[_0x32f0('0x36')](_0x306b1c['model'],_0x306b1c[_0x32f0('0x34')]);_0x10aa57['attributes']=_[_0x32f0('0x36')](_0x306b1c[_0x32f0('0x37')],qs[_0x32f0('0x39')](_0x28a78e[_0x32f0('0x34')][_0x32f0('0x39')]));_0x10aa57[_0x32f0('0x38')]=_0x10aa57['attributes'][_0x32f0('0x3a')]?_0x10aa57[_0x32f0('0x38')]:_0x306b1c[_0x32f0('0x37')];if(_0x28a78e[_0x32f0('0x34')][_0x32f0('0x44')]){_0x10aa57['include']=[{'all':!![]}];}_0x10aa57=_['merge']({},_0x10aa57,_0x28a78e['options']);return db[_0x32f0('0x46')]['find'](_0x10aa57)[_0x32f0('0x29')](handleEntityNotFound(_0x285b19,null))[_0x32f0('0x29')](respondWithResult(_0x285b19,null))['catch'](handleError(_0x285b19,null));};exports['create']=function(_0xb07041,_0x21a834){return db[_0x32f0('0x46')][_0x32f0('0x4d')](_0xb07041[_0x32f0('0x4e')],{})[_0x32f0('0x29')](respondWithResult(_0x21a834,0xc9))[_0x32f0('0x4f')](handleError(_0x21a834,null));};exports[_0x32f0('0x28')]=function(_0x3a7cd2,_0x927f0d){if(_0x3a7cd2[_0x32f0('0x4e')]['id']){delete _0x3a7cd2['body']['id'];}return db[_0x32f0('0x46')][_0x32f0('0x50')]({'where':{'id':_0x3a7cd2[_0x32f0('0x4a')]['id']}})[_0x32f0('0x29')](handleEntityNotFound(_0x927f0d,null))[_0x32f0('0x29')](saveUpdates(_0x3a7cd2[_0x32f0('0x4e')],null))[_0x32f0('0x29')](respondWithResult(_0x927f0d,null))[_0x32f0('0x4f')](handleError(_0x927f0d,null));};exports['destroy']=function(_0x50b533,_0x23f74a){return db[_0x32f0('0x46')][_0x32f0('0x50')]({'where':{'id':_0x50b533[_0x32f0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x23f74a,null))[_0x32f0('0x29')](removeEntity(_0x23f74a,null))[_0x32f0('0x4f')](handleError(_0x23f74a,null));};exports[_0x32f0('0x51')]=function(_0x12a38f,_0x13c19a){return db[_0x32f0('0x46')]['describe']()[_0x32f0('0x29')](respondWithResult(_0x13c19a,null))[_0x32f0('0x4f')](handleError(_0x13c19a,null));};exports[_0x32f0('0x52')]=function(_0x26fe2a,_0x48c632,_0x10a155){var _0x587c31={'raw':!![],'where':{}};var _0x4685ce={};var _0x37371e={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x32f0('0x53')]({'where':{'id':_0x26fe2a[_0x32f0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x48c632,null))['then'](function(_0x3113f1){if(_0x3113f1){_0x4685ce[_0x32f0('0x37')]=_[_0x32f0('0x4b')](db['JscriptyQuestionReport'][_0x32f0('0x4c')]);_0x4685ce[_0x32f0('0x34')]=_[_0x32f0('0x4b')](_0x26fe2a[_0x32f0('0x34')]);_0x4685ce[_0x32f0('0x35')]=_['intersection'](_0x4685ce[_0x32f0('0x37')],_0x4685ce[_0x32f0('0x34')]);_0x587c31['attributes']=_[_0x32f0('0x36')](_0x4685ce[_0x32f0('0x37')],qs[_0x32f0('0x39')](_0x26fe2a[_0x32f0('0x34')][_0x32f0('0x39')]));_0x587c31[_0x32f0('0x38')]=_0x587c31['attributes'][_0x32f0('0x3a')]?_0x587c31[_0x32f0('0x38')]:_0x4685ce['model'];if(!_0x26fe2a['query'][_0x32f0('0x3b')]('nolimit')){_0x587c31['limit']=qs['limit'](_0x26fe2a['query'][_0x32f0('0x20')]);_0x587c31[_0x32f0('0x21')]=qs[_0x32f0('0x21')](_0x26fe2a['query'][_0x32f0('0x21')]);}_0x587c31['order']=qs[_0x32f0('0x3d')](_0x26fe2a[_0x32f0('0x34')]['sort']);_0x587c31['where']=qs[_0x32f0('0x35')](_[_0x32f0('0x3f')](_0x26fe2a['query'],_0x4685ce['filters']));_0x587c31[_0x32f0('0x3e')][_0x32f0('0x54')]=_0x3113f1['id'];if(_0x26fe2a[_0x32f0('0x34')][_0x32f0('0x40')]){_0x587c31[_0x32f0('0x3e')]=_[_0x32f0('0x41')](_0x587c31[_0x32f0('0x3e')],{'$or':_['map'](_0x587c31[_0x32f0('0x38')],function(_0x2f8044){var _0x806c8b={};_0x806c8b[_0x2f8044]={'$like':'%'+_0x26fe2a[_0x32f0('0x34')]['filter']+'%'};return _0x806c8b;})});}_0x587c31=_[_0x32f0('0x41')]({},_0x587c31,_0x26fe2a[_0x32f0('0x43')]);return db['JscriptyQuestionReport'][_0x32f0('0x22')]({'where':_0x587c31[_0x32f0('0x3e')]})[_0x32f0('0x29')](function(_0x46985d){_0x37371e[_0x32f0('0x22')]=_0x46985d;if(_0x26fe2a[_0x32f0('0x34')][_0x32f0('0x44')]){_0x587c31[_0x32f0('0x45')]=[{'all':!![]}];}return db[_0x32f0('0x55')]['findAll'](_0x587c31);})[_0x32f0('0x29')](function(_0x14ea16){_0x37371e[_0x32f0('0x48')]=_0x14ea16;return _0x37371e;});}})[_0x32f0('0x29')](respondWithFilteredResult(_0x48c632,_0x587c31))[_0x32f0('0x4f')](handleError(_0x48c632,null));}; \ No newline at end of file +var _0x3352=['SessionId','rows','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','type','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','catch','show','params','keys','find','create','body','getQuestions','JscriptyQuestionReport','nolimit'];(function(_0x210756,_0x2be6e0){var _0x594bd4=function(_0x4a9c05){while(--_0x4a9c05){_0x210756['push'](_0x210756['shift']());}};_0x594bd4(++_0x2be6e0);}(_0x3352,0xf5));var _0x2335=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x3352[_0x351509];return _0x4e9861;};'use strict';var emlformat=require(_0x2335('0x0'));var rimraf=require(_0x2335('0x1'));var zipdir=require(_0x2335('0x2'));var jsonpatch=require(_0x2335('0x3'));var rp=require(_0x2335('0x4'));var moment=require(_0x2335('0x5'));var BPromise=require(_0x2335('0x6'));var Mustache=require(_0x2335('0x7'));var util=require(_0x2335('0x8'));var path=require(_0x2335('0x9'));var sox=require(_0x2335('0xa'));var csv=require(_0x2335('0xb'));var ejs=require(_0x2335('0xc'));var fs=require('fs');var fs_extra=require(_0x2335('0xd'));var _=require(_0x2335('0xe'));var squel=require(_0x2335('0xf'));var crypto=require(_0x2335('0x10'));var jsforce=require(_0x2335('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x2335('0xb'));var querystring=require(_0x2335('0x12'));var Papa=require(_0x2335('0x13'));var Redis=require(_0x2335('0x14'));var authService=require(_0x2335('0x15'));var qs=require(_0x2335('0x16'));var as=require(_0x2335('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2335('0x18'));var utils=require('../../config/utils');var config=require(_0x2335('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2335('0x1a'))['db'];function respondWithStatusCode(_0x4f3252,_0x22cdac){_0x22cdac=_0x22cdac||0xcc;return function(_0x5d34cf){if(_0x5d34cf){return _0x4f3252[_0x2335('0x1b')](_0x22cdac);}return _0x4f3252[_0x2335('0x1c')](_0x22cdac)[_0x2335('0x1d')]();};}function respondWithResult(_0xccc8f6,_0x2a30e2){_0x2a30e2=_0x2a30e2||0xc8;return function(_0x4f9d07){if(_0x4f9d07){return _0xccc8f6[_0x2335('0x1c')](_0x2a30e2)[_0x2335('0x1e')](_0x4f9d07);}};}function respondWithFilteredResult(_0x5db494,_0x3bcead){return function(_0x521c62){if(_0x521c62){var _0x57ba65=typeof _0x3bcead[_0x2335('0x1f')]===_0x2335('0x20')&&typeof _0x3bcead['limit']===_0x2335('0x20');var _0x1f6721=_0x521c62[_0x2335('0x21')];var _0x5c9821=_0x57ba65?0x0:_0x3bcead[_0x2335('0x1f')];var _0x73b554=_0x57ba65?_0x521c62[_0x2335('0x21')]:_0x3bcead['offset']+_0x3bcead[_0x2335('0x22')];var _0xe91f8e;if(_0x73b554>=_0x1f6721){_0x73b554=_0x1f6721;_0xe91f8e=0xc8;}else{_0xe91f8e=0xce;}_0x5db494[_0x2335('0x1c')](_0xe91f8e);return _0x5db494[_0x2335('0x23')](_0x2335('0x24'),_0x5c9821+'-'+_0x73b554+'/'+_0x1f6721)['json'](_0x521c62);}return null;};}function patchUpdates(_0x382e1a){return function(_0x57e613){try{jsonpatch[_0x2335('0x25')](_0x57e613,_0x382e1a,!![]);}catch(_0x38a2b2){return BPromise[_0x2335('0x26')](_0x38a2b2);}return _0x57e613[_0x2335('0x27')]();};}function saveUpdates(_0x3ab83b,_0x6d3260){return function(_0x16d3f3){if(_0x16d3f3){return _0x16d3f3[_0x2335('0x28')](_0x3ab83b)[_0x2335('0x29')](function(_0x1fc975){return _0x1fc975;});}return null;};}function removeEntity(_0x38f19d,_0x14f36e){return function(_0xd5cdae){if(_0xd5cdae){return _0xd5cdae['destroy']()[_0x2335('0x29')](function(){_0x38f19d[_0x2335('0x1c')](0xcc)[_0x2335('0x1d')]();});}};}function handleEntityNotFound(_0x20c87a,_0x38dd48){return function(_0x32c93a){if(!_0x32c93a){_0x20c87a[_0x2335('0x1b')](0x194);}return _0x32c93a;};}function handleError(_0x483d3c,_0x3cccda){_0x3cccda=_0x3cccda||0x1f4;return function(_0x74e2ab){logger[_0x2335('0x2a')](_0x74e2ab['stack']);if(_0x74e2ab[_0x2335('0x2b')]){delete _0x74e2ab['name'];}_0x483d3c[_0x2335('0x1c')](_0x3cccda)[_0x2335('0x2c')](_0x74e2ab);};}exports[_0x2335('0x2d')]=function(_0xbb7b36,_0x2bbc14){var _0x43f134={},_0x1e3c89={},_0x140d3e={'count':0x0,'rows':[]};var _0x14c52b=_[_0x2335('0x2e')](db['JscriptySessionReport'][_0x2335('0x2f')],function(_0x498180){return{'name':_0x498180['fieldName'],'type':_0x498180[_0x2335('0x30')]['key']};});_0x1e3c89[_0x2335('0x31')]=_[_0x2335('0x2e')](_0x14c52b,_0x2335('0x2b'));_0x1e3c89['query']=_['keys'](_0xbb7b36['query']);_0x1e3c89[_0x2335('0x32')]=_[_0x2335('0x33')](_0x1e3c89[_0x2335('0x31')],_0x1e3c89[_0x2335('0x34')]);_0x43f134['attributes']=_[_0x2335('0x33')](_0x1e3c89[_0x2335('0x31')],qs[_0x2335('0x35')](_0xbb7b36[_0x2335('0x34')][_0x2335('0x35')]));_0x43f134[_0x2335('0x36')]=_0x43f134['attributes'][_0x2335('0x37')]?_0x43f134[_0x2335('0x36')]:_0x1e3c89[_0x2335('0x31')];if(!_0xbb7b36[_0x2335('0x34')][_0x2335('0x38')]('nolimit')){_0x43f134['limit']=qs['limit'](_0xbb7b36[_0x2335('0x34')][_0x2335('0x22')]);_0x43f134[_0x2335('0x1f')]=qs[_0x2335('0x1f')](_0xbb7b36[_0x2335('0x34')]['offset']);}_0x43f134[_0x2335('0x39')]=qs[_0x2335('0x3a')](_0xbb7b36[_0x2335('0x34')][_0x2335('0x3a')]);_0x43f134[_0x2335('0x3b')]=qs['filters'](_[_0x2335('0x3c')](_0xbb7b36[_0x2335('0x34')],_0x1e3c89[_0x2335('0x32')]),_0x14c52b);if(_0xbb7b36['query'][_0x2335('0x3d')]){_0x43f134[_0x2335('0x3b')]=_[_0x2335('0x3e')](_0x43f134['where'],{'$or':_[_0x2335('0x2e')](_0x14c52b,function(_0x567ea4){if(_0x567ea4[_0x2335('0x30')]!==_0x2335('0x3f')){var _0x1d78f2={};_0x1d78f2[_0x567ea4[_0x2335('0x2b')]]={'$like':'%'+_0xbb7b36[_0x2335('0x34')][_0x2335('0x3d')]+'%'};return _0x1d78f2;}})});}_0x43f134=_[_0x2335('0x3e')]({},_0x43f134,_0xbb7b36[_0x2335('0x40')]);var _0x157f7f={'where':_0x43f134[_0x2335('0x3b')]};return db[_0x2335('0x41')][_0x2335('0x21')](_0x157f7f)['then'](function(_0x5028d1){_0x140d3e[_0x2335('0x21')]=_0x5028d1;if(_0xbb7b36[_0x2335('0x34')][_0x2335('0x42')]){_0x43f134[_0x2335('0x43')]=[{'all':!![]}];}return db[_0x2335('0x41')][_0x2335('0x44')](_0x43f134);})[_0x2335('0x29')](function(_0x31747d){_0x140d3e['rows']=_0x31747d;return _0x140d3e;})[_0x2335('0x29')](respondWithFilteredResult(_0x2bbc14,_0x43f134))[_0x2335('0x45')](handleError(_0x2bbc14,null));};exports[_0x2335('0x46')]=function(_0xa1d85a,_0x23ea8c){var _0x3affa9={'raw':!![],'where':{'id':_0xa1d85a[_0x2335('0x47')]['id']}},_0x19253c={};_0x19253c[_0x2335('0x31')]=_[_0x2335('0x48')](db[_0x2335('0x41')][_0x2335('0x2f')]);_0x19253c[_0x2335('0x34')]=_[_0x2335('0x48')](_0xa1d85a[_0x2335('0x34')]);_0x19253c[_0x2335('0x32')]=_[_0x2335('0x33')](_0x19253c['model'],_0x19253c[_0x2335('0x34')]);_0x3affa9['attributes']=_[_0x2335('0x33')](_0x19253c[_0x2335('0x31')],qs[_0x2335('0x35')](_0xa1d85a['query']['fields']));_0x3affa9['attributes']=_0x3affa9[_0x2335('0x36')][_0x2335('0x37')]?_0x3affa9['attributes']:_0x19253c[_0x2335('0x31')];if(_0xa1d85a['query'][_0x2335('0x42')]){_0x3affa9[_0x2335('0x43')]=[{'all':!![]}];}_0x3affa9=_['merge']({},_0x3affa9,_0xa1d85a[_0x2335('0x40')]);return db['JscriptySessionReport'][_0x2335('0x49')](_0x3affa9)[_0x2335('0x29')](handleEntityNotFound(_0x23ea8c,null))[_0x2335('0x29')](respondWithResult(_0x23ea8c,null))[_0x2335('0x45')](handleError(_0x23ea8c,null));};exports[_0x2335('0x4a')]=function(_0x3e2a3a,_0x2ee113){return db[_0x2335('0x41')][_0x2335('0x4a')](_0x3e2a3a['body'],{})[_0x2335('0x29')](respondWithResult(_0x2ee113,0xc9))[_0x2335('0x45')](handleError(_0x2ee113,null));};exports[_0x2335('0x28')]=function(_0x45e742,_0x27e47a){if(_0x45e742[_0x2335('0x4b')]['id']){delete _0x45e742[_0x2335('0x4b')]['id'];}return db[_0x2335('0x41')][_0x2335('0x49')]({'where':{'id':_0x45e742[_0x2335('0x47')]['id']}})[_0x2335('0x29')](handleEntityNotFound(_0x27e47a,null))['then'](saveUpdates(_0x45e742['body'],null))[_0x2335('0x29')](respondWithResult(_0x27e47a,null))[_0x2335('0x45')](handleError(_0x27e47a,null));};exports['destroy']=function(_0x316478,_0x32313b){return db[_0x2335('0x41')][_0x2335('0x49')]({'where':{'id':_0x316478[_0x2335('0x47')]['id']}})[_0x2335('0x29')](handleEntityNotFound(_0x32313b,null))['then'](removeEntity(_0x32313b,null))[_0x2335('0x45')](handleError(_0x32313b,null));};exports['describe']=function(_0x318136,_0xcdd340){return db[_0x2335('0x41')]['describe']()[_0x2335('0x29')](respondWithResult(_0xcdd340,null))['catch'](handleError(_0xcdd340,null));};exports[_0x2335('0x4c')]=function(_0x4f01fd,_0x237c11,_0x1d2bda){var _0x540871={'raw':!![],'where':{}};var _0x55f602={};var _0x27ee66={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x4f01fd['params']['id']}})[_0x2335('0x29')](handleEntityNotFound(_0x237c11,null))['then'](function(_0x19dac6){if(_0x19dac6){_0x55f602[_0x2335('0x31')]=_['keys'](db[_0x2335('0x4d')][_0x2335('0x2f')]);_0x55f602[_0x2335('0x34')]=_['keys'](_0x4f01fd[_0x2335('0x34')]);_0x55f602['filters']=_['intersection'](_0x55f602['model'],_0x55f602[_0x2335('0x34')]);_0x540871[_0x2335('0x36')]=_[_0x2335('0x33')](_0x55f602['model'],qs[_0x2335('0x35')](_0x4f01fd[_0x2335('0x34')]['fields']));_0x540871['attributes']=_0x540871[_0x2335('0x36')]['length']?_0x540871[_0x2335('0x36')]:_0x55f602['model'];if(!_0x4f01fd['query'][_0x2335('0x38')](_0x2335('0x4e'))){_0x540871['limit']=qs[_0x2335('0x22')](_0x4f01fd[_0x2335('0x34')][_0x2335('0x22')]);_0x540871['offset']=qs['offset'](_0x4f01fd['query'][_0x2335('0x1f')]);}_0x540871[_0x2335('0x39')]=qs['sort'](_0x4f01fd[_0x2335('0x34')][_0x2335('0x3a')]);_0x540871['where']=qs[_0x2335('0x32')](_[_0x2335('0x3c')](_0x4f01fd[_0x2335('0x34')],_0x55f602[_0x2335('0x32')]));_0x540871['where'][_0x2335('0x4f')]=_0x19dac6['id'];if(_0x4f01fd[_0x2335('0x34')][_0x2335('0x3d')]){_0x540871[_0x2335('0x3b')]=_['merge'](_0x540871[_0x2335('0x3b')],{'$or':_[_0x2335('0x2e')](_0x540871[_0x2335('0x36')],function(_0x33c0ba){var _0x47ad86={};_0x47ad86[_0x33c0ba]={'$like':'%'+_0x4f01fd[_0x2335('0x34')][_0x2335('0x3d')]+'%'};return _0x47ad86;})});}_0x540871=_[_0x2335('0x3e')]({},_0x540871,_0x4f01fd[_0x2335('0x40')]);return db['JscriptyQuestionReport'][_0x2335('0x21')]({'where':_0x540871['where']})['then'](function(_0x5f0266){_0x27ee66[_0x2335('0x21')]=_0x5f0266;if(_0x4f01fd[_0x2335('0x34')][_0x2335('0x42')]){_0x540871['include']=[{'all':!![]}];}return db[_0x2335('0x4d')][_0x2335('0x44')](_0x540871);})[_0x2335('0x29')](function(_0x29c346){_0x27ee66[_0x2335('0x50')]=_0x29c346;return _0x27ee66;});}})[_0x2335('0x29')](respondWithFilteredResult(_0x237c11,_0x540871))[_0x2335('0x45')](handleError(_0x237c11,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 487e9c9..414c2a6 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 _0x2675=['lodash','moment','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0x2675,0x75));var _0x5267=function(_0x3ccc14,_0x49f4aa){_0x3ccc14=_0x3ccc14-0x0;var _0x28bd9c=_0x2675[_0x3ccc14];return _0x28bd9c;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash'];(function(_0x6f460f,_0xddf85a){var _0x5b9367=function(_0x2f3a34){while(--_0x2f3a34){_0x6f460f['push'](_0x6f460f['shift']());}};_0x5b9367(++_0xddf85a);}(_0xabce,0x103));var _0xeabc=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xabce[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('JscriptySessionReport',attributes,{'tableName':_0xeabc('0x9'),'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 ba679f1..564c405 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 _0x6d11=['message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5cc8d7,_0x2b82e3){var _0x4e1ac3=function(_0x3feb3f){while(--_0x3feb3f){_0x5cc8d7['push'](_0x5cc8d7['shift']());}};_0x4e1ac3(++_0x2b82e3);}(_0x6d11,0xbf));var _0x16d1=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0x6d11[_0x50e40b];return _0x2608b7;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d1('0x4'))['db'];var utils=require(_0x16d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x16d1('0x6'));var jayson=require(_0x16d1('0x7'));var client=jayson[_0x16d1('0x8')][_0x16d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1009dc,_0x150217,_0x19390d){return new BPromise(function(_0x5d0e3f,_0x58a7a2){return client['request'](_0x1009dc,_0x19390d)[_0x16d1('0xa')](function(_0xcfbb15){logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,'request\x20sent');logger[_0x16d1('0xd')](_0x16d1('0xe'),_0x150217,_0x16d1('0xf'),JSON[_0x16d1('0x10')](_0xcfbb15));if(_0xcfbb15[_0x16d1('0x11')]){if(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x12')]===0x1f4){logger[_0x16d1('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x58a7a2(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}logger[_0x16d1('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x5d0e3f(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}else{logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,_0x16d1('0xf'));_0x5d0e3f(_0xcfbb15['result'][_0x16d1('0x13')]);}})[_0x16d1('0x14')](function(_0x555b2d){logger['error'](_0x16d1('0xc'),_0x150217,_0x555b2d);_0x58a7a2(_0x555b2d);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','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','bluebird','randomstring','../../config/logger','rpc'];(function(_0x4d0daf,_0x4af699){var _0x37e9aa=function(_0xe12de8){while(--_0xe12de8){_0x4d0daf['push'](_0x4d0daf['shift']());}};_0x37e9aa(++_0x4af699);}(_0xba34,0x119));var _0x4ba3=function(_0x40718d,_0x5d48f2){_0x40718d=_0x40718d-0x0;var _0x2a906c=_0xba34[_0x40718d];return _0x2a906c;};'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 diff --git a/server/api/license/index.js b/server/api/license/index.js index 194bf88..e1aeb79 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 _0xde2e=['downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','index','put','/:id','isAuthenticated','update','get'];(function(_0x21f7cf,_0x3a574b){var _0xf03e2e=function(_0x25e860){while(--_0x25e860){_0x21f7cf['push'](_0x21f7cf['shift']());}};_0xf03e2e(++_0x3a574b);}(_0xde2e,0x92));var _0xede2=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xde2e[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0xede2('0x0'));var util=require(_0xede2('0x1'));var path=require(_0xede2('0x2'));var timeout=require(_0xede2('0x3'));var express=require(_0xede2('0x4'));var router=express[_0xede2('0x5')]();var fs_extra=require(_0xede2('0x6'));var auth=require(_0xede2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xede2('0x8'));var controller=require(_0xede2('0x9'));router['get']('/',controller[_0xede2('0xa')]);router[_0xede2('0xb')](_0xede2('0xc'),auth[_0xede2('0xd')](),controller[_0xede2('0xe')]);router[_0xede2('0xf')]('/download_log_file',auth[_0xede2('0xd')](),controller[_0xede2('0x10')]);module[_0xede2('0x11')]=router; \ No newline at end of file +var _0x8370=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','put','isAuthenticated','update','exports','multer'];(function(_0x27844c,_0x1e8f34){var _0x21fff3=function(_0x1324fe){while(--_0x1324fe){_0x27844c['push'](_0x27844c['shift']());}};_0x21fff3(++_0x1e8f34);}(_0x8370,0x167));var _0x0837=function(_0x280916,_0x4427c5){_0x280916=_0x280916-0x0;var _0x2c6700=_0x8370[_0x280916];return _0x2c6700;};'use strict';var multer=require(_0x0837('0x0'));var util=require(_0x0837('0x1'));var path=require(_0x0837('0x2'));var timeout=require(_0x0837('0x3'));var express=require(_0x0837('0x4'));var router=express[_0x0837('0x5')]();var fs_extra=require(_0x0837('0x6'));var auth=require(_0x0837('0x7'));var interaction=require(_0x0837('0x8'));var config=require(_0x0837('0x9'));var controller=require(_0x0837('0xa'));router['get']('/',controller['index']);router[_0x0837('0xb')]('/:id',auth[_0x0837('0xc')](),controller[_0x0837('0xd')]);router['get']('/download_log_file',auth[_0x0837('0xc')](),controller['downloadLogFile']);module[_0x0837('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 39d5982..093f4a3 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 _0x0a90=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0x0a90,0x155));var _0x00a9=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0a90[_0x31a371];return _0x2a5bd6;};'use strict';var Sequelize=require(_0x00a9('0x0'));module[_0x00a9('0x1')]={'license':{'type':Sequelize[_0x00a9('0x2')]},'data1':{'type':Sequelize[_0x00a9('0x3')]},'data2':{'type':Sequelize[_0x00a9('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x00a9('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x05b0=['STRING','INTEGER','exports'];(function(_0x2f4de8,_0x313395){var _0x4569cb=function(_0x17572f){while(--_0x17572f){_0x2f4de8['push'](_0x2f4de8['shift']());}};_0x4569cb(++_0x313395);}(_0x05b0,0x89));var _0x005b=function(_0x908539,_0x85702d){_0x908539=_0x908539-0x0;var _0x5693be=_0x05b0[_0x908539];return _0x5693be;};'use strict';var Sequelize=require('sequelize');module[_0x005b('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x005b('0x1')]},'data2':{'type':Sequelize[_0x005b('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x005b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index dfc58b3..417c1c9 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 _0x6e16=['send','index','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','getLicense','catch','update','body','License','find','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','xcally','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','then','sendStatus','error','stack','name'];(function(_0x4e6455,_0x4b45dd){var _0x51a571=function(_0x2b3aaa){while(--_0x2b3aaa){_0x4e6455['push'](_0x4e6455['shift']());}};_0x51a571(++_0x4b45dd);}(_0x6e16,0x17b));var _0x66e1=function(_0x41b9b4,_0x5ed884){_0x41b9b4=_0x41b9b4-0x0;var _0x236296=_0x6e16[_0x41b9b4];return _0x236296;};'use strict';var emlformat=require(_0x66e1('0x0'));var rimraf=require(_0x66e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66e1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x66e1('0x3'));var Mustache=require(_0x66e1('0x4'));var util=require(_0x66e1('0x5'));var path=require(_0x66e1('0x6'));var sox=require('sox');var csv=require(_0x66e1('0x7'));var ejs=require(_0x66e1('0x8'));var fs=require('fs');var fs_extra=require(_0x66e1('0x9'));var _=require('lodash');var squel=require(_0x66e1('0xa'));var crypto=require(_0x66e1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x66e1('0xc'));var toCsv=require(_0x66e1('0x7'));var querystring=require(_0x66e1('0xd'));var Papa=require('papaparse');var Redis=require(_0x66e1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x66e1('0xf'));var hardwareService=require(_0x66e1('0x10'));var logger=require(_0x66e1('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x66e1('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c9f11,_0x542609){_0x542609=_0x542609||0xcc;return function(_0xac05aa){if(_0xac05aa){return _0x2c9f11['sendStatus'](_0x542609);}return _0x2c9f11[_0x66e1('0x13')](_0x542609)[_0x66e1('0x14')]();};}function respondWithResult(_0x2a4d70,_0x55f397){_0x55f397=_0x55f397||0xc8;return function(_0x5931cb){if(_0x5931cb){return _0x2a4d70['status'](_0x55f397)[_0x66e1('0x15')](_0x5931cb);}};}function respondWithFilteredResult(_0x5e1c6c,_0x1783cb){return function(_0x58bd37){if(_0x58bd37){var _0x891770=typeof _0x1783cb['offset']===_0x66e1('0x16')&&typeof _0x1783cb['limit']===_0x66e1('0x16');var _0x4e0cfb=_0x58bd37['count'];var _0x10f474=_0x891770?0x0:_0x1783cb[_0x66e1('0x17')];var _0x451c7d=_0x891770?_0x58bd37[_0x66e1('0x18')]:_0x1783cb[_0x66e1('0x17')]+_0x1783cb[_0x66e1('0x19')];var _0x1ab726;if(_0x451c7d>=_0x4e0cfb){_0x451c7d=_0x4e0cfb;_0x1ab726=0xc8;}else{_0x1ab726=0xce;}_0x5e1c6c['status'](_0x1ab726);return _0x5e1c6c[_0x66e1('0x1a')](_0x66e1('0x1b'),_0x10f474+'-'+_0x451c7d+'/'+_0x4e0cfb)[_0x66e1('0x15')](_0x58bd37);}return null;};}function patchUpdates(_0xb9b0f7){return function(_0x135a51){try{jsonpatch[_0x66e1('0x1c')](_0x135a51,_0xb9b0f7,!![]);}catch(_0x43bcd9){return BPromise['reject'](_0x43bcd9);}return _0x135a51[_0x66e1('0x1d')]();};}function saveUpdates(_0x433413,_0x55c25e){return function(_0x59528e){if(_0x59528e){return _0x59528e['update'](_0x433413)[_0x66e1('0x1e')](function(_0x47d116){return _0x47d116;});}return null;};}function removeEntity(_0x4aa15f,_0x552997){return function(_0x2e6609){if(_0x2e6609){return _0x2e6609['destroy']()['then'](function(){_0x4aa15f[_0x66e1('0x13')](0xcc)[_0x66e1('0x14')]();});}};}function handleEntityNotFound(_0x3eed1b,_0x2efec4){return function(_0xf427d8){if(!_0xf427d8){_0x3eed1b[_0x66e1('0x1f')](0x194);}return _0xf427d8;};}function handleError(_0x2e8e1e,_0x358402){_0x358402=_0x358402||0x1f4;return function(_0x14b142){logger[_0x66e1('0x20')](_0x14b142[_0x66e1('0x21')]);if(_0x14b142['name']){delete _0x14b142[_0x66e1('0x22')];}_0x2e8e1e[_0x66e1('0x13')](_0x358402)[_0x66e1('0x23')](_0x14b142);};}var utilLicense=require(_0x66e1('0x12'));exports[_0x66e1('0x24')]=function(_0x5977ad,_0x386af0){var _0x2c3a77={'raw':!![],'where':{'id':0x1}},_0x5a3287={};_0x5a3287[_0x66e1('0x25')]=_[_0x66e1('0x26')](db['License'][_0x66e1('0x27')]);_0x5a3287[_0x66e1('0x28')]=_['keys'](_0x5977ad[_0x66e1('0x28')]);_0x5a3287[_0x66e1('0x29')]=_[_0x66e1('0x2a')](_0x5a3287['model'],_0x5a3287[_0x66e1('0x28')]);_0x2c3a77['attributes']=_[_0x66e1('0x2a')](_0x5a3287[_0x66e1('0x25')],qs[_0x66e1('0x2b')](_0x5977ad['query'][_0x66e1('0x2b')]));_0x2c3a77[_0x66e1('0x2c')]=_0x2c3a77[_0x66e1('0x2c')][_0x66e1('0x2d')]?_0x2c3a77['attributes']:_0x5a3287[_0x66e1('0x25')];_0x2c3a77=_[_0x66e1('0x2e')]({},_0x2c3a77,_0x5977ad[_0x66e1('0x2f')]);return utilLicense[_0x66e1('0x30')](_0x2c3a77)[_0x66e1('0x1e')](respondWithResult(_0x386af0,null))[_0x66e1('0x31')](handleError(_0x386af0,null));};exports[_0x66e1('0x32')]=function(_0x1a38ed,_0x5903df){if(_0x1a38ed[_0x66e1('0x33')]['id']){delete _0x1a38ed[_0x66e1('0x33')]['id'];}return db[_0x66e1('0x34')][_0x66e1('0x35')]({'where':{'id':_0x1a38ed[_0x66e1('0x36')]['id']}})[_0x66e1('0x1e')](handleEntityNotFound(_0x5903df,null))['then'](function(_0x2e19c7){var _0x2e77d0=_0x2e19c7[_0x66e1('0x37')]({'plain':!![]});return utilLicense[_0x66e1('0x38')](_0x2e77d0,_0x1a38ed['body'][_0x66e1('0x39')]);})[_0x66e1('0x1e')](function(_0x1c9fb4){if(!_0x1c9fb4[_0x66e1('0x3a')]){return saveUpdates(_0x1a38ed['body'],null);}return _0x1c9fb4;})[_0x66e1('0x1e')](respondWithResult(_0x5903df,null))[_0x66e1('0x31')](handleError(_0x5903df,null));};exports[_0x66e1('0x3b')]=function(_0x1984f8,_0x7461bc){var _0x5b2194=_0x66e1('0x3c');var _0x28eba3=path[_0x66e1('0x3d')](_0x66e1('0x3e'),'log',_0x66e1('0x3f'),_0x5b2194);_0x7461bc[_0x66e1('0x40')]('Content-disposition',_0x66e1('0x41')+_0x5b2194);_0x7461bc['set'](_0x66e1('0x42'),_0x66e1('0x43'));_0x7461bc[_0x66e1('0x44')](_0x28eba3);}; \ No newline at end of file +var _0x9840=['reject','save','destroy','stack','name','send','../../config/license/util','index','model','keys','License','query','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','then','get','checkLicense','demo','downloadLogFile','license-info.log','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','limit'];(function(_0x308ed8,_0x1462ea){var _0x1f9326=function(_0x2ec9c1){while(--_0x2ec9c1){_0x308ed8['push'](_0x308ed8['shift']());}};_0x1f9326(++_0x1462ea);}(_0x9840,0x1c8));var _0x0984=function(_0x5cc9d3,_0xb5bcce){_0x5cc9d3=_0x5cc9d3-0x0;var _0x78cec9=_0x9840[_0x5cc9d3];return _0x78cec9;};'use strict';var emlformat=require(_0x0984('0x0'));var rimraf=require(_0x0984('0x1'));var zipdir=require(_0x0984('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0984('0x3'));var moment=require(_0x0984('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0984('0x5'));var util=require(_0x0984('0x6'));var path=require(_0x0984('0x7'));var sox=require(_0x0984('0x8'));var csv=require('to-csv');var ejs=require(_0x0984('0x9'));var fs=require('fs');var fs_extra=require(_0x0984('0xa'));var _=require('lodash');var squel=require(_0x0984('0xb'));var crypto=require('crypto');var jsforce=require(_0x0984('0xc'));var deskjs=require(_0x0984('0xd'));var toCsv=require(_0x0984('0xe'));var querystring=require(_0x0984('0xf'));var Papa=require(_0x0984('0x10'));var Redis=require(_0x0984('0x11'));var authService=require(_0x0984('0x12'));var qs=require(_0x0984('0x13'));var as=require(_0x0984('0x14'));var hardwareService=require(_0x0984('0x15'));var logger=require(_0x0984('0x16'))(_0x0984('0x17'));var utils=require(_0x0984('0x18'));var config=require(_0x0984('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0984('0x1a'))['db'];function respondWithStatusCode(_0x153912,_0x2d0d14){_0x2d0d14=_0x2d0d14||0xcc;return function(_0x3c80c0){if(_0x3c80c0){return _0x153912[_0x0984('0x1b')](_0x2d0d14);}return _0x153912[_0x0984('0x1c')](_0x2d0d14)[_0x0984('0x1d')]();};}function respondWithResult(_0xbd082e,_0x361dab){_0x361dab=_0x361dab||0xc8;return function(_0x3f6753){if(_0x3f6753){return _0xbd082e['status'](_0x361dab)[_0x0984('0x1e')](_0x3f6753);}};}function respondWithFilteredResult(_0x5e7bb0,_0x5dd053){return function(_0x391c27){if(_0x391c27){var _0x3b8d36=typeof _0x5dd053[_0x0984('0x1f')]==='undefined'&&typeof _0x5dd053['limit']==='undefined';var _0x50324e=_0x391c27['count'];var _0x377f16=_0x3b8d36?0x0:_0x5dd053['offset'];var _0x2da4da=_0x3b8d36?_0x391c27[_0x0984('0x20')]:_0x5dd053[_0x0984('0x1f')]+_0x5dd053[_0x0984('0x21')];var _0x255e50;if(_0x2da4da>=_0x50324e){_0x2da4da=_0x50324e;_0x255e50=0xc8;}else{_0x255e50=0xce;}_0x5e7bb0['status'](_0x255e50);return _0x5e7bb0['set']('Content-Range',_0x377f16+'-'+_0x2da4da+'/'+_0x50324e)[_0x0984('0x1e')](_0x391c27);}return null;};}function patchUpdates(_0x44b98e){return function(_0x16f635){try{jsonpatch['apply'](_0x16f635,_0x44b98e,!![]);}catch(_0x494d06){return BPromise[_0x0984('0x22')](_0x494d06);}return _0x16f635[_0x0984('0x23')]();};}function saveUpdates(_0x1dee59,_0xceebaa){return function(_0x1052d3){if(_0x1052d3){return _0x1052d3['update'](_0x1dee59)['then'](function(_0x16c29e){return _0x16c29e;});}return null;};}function removeEntity(_0x1f7b12,_0x289a1e){return function(_0x42cf92){if(_0x42cf92){return _0x42cf92[_0x0984('0x24')]()['then'](function(){_0x1f7b12[_0x0984('0x1c')](0xcc)[_0x0984('0x1d')]();});}};}function handleEntityNotFound(_0x24a324,_0x41091d){return function(_0x3c1f01){if(!_0x3c1f01){_0x24a324[_0x0984('0x1b')](0x194);}return _0x3c1f01;};}function handleError(_0x22d717,_0x3fa88a){_0x3fa88a=_0x3fa88a||0x1f4;return function(_0x47c7e5){logger['error'](_0x47c7e5[_0x0984('0x25')]);if(_0x47c7e5[_0x0984('0x26')]){delete _0x47c7e5[_0x0984('0x26')];}_0x22d717[_0x0984('0x1c')](_0x3fa88a)[_0x0984('0x27')](_0x47c7e5);};}var utilLicense=require(_0x0984('0x28'));exports[_0x0984('0x29')]=function(_0x10dfcc,_0x646270){var _0x2454e3={'raw':!![],'where':{'id':0x1}},_0x33ba3e={};_0x33ba3e[_0x0984('0x2a')]=_[_0x0984('0x2b')](db[_0x0984('0x2c')]['rawAttributes']);_0x33ba3e[_0x0984('0x2d')]=_[_0x0984('0x2b')](_0x10dfcc[_0x0984('0x2d')]);_0x33ba3e['filters']=_[_0x0984('0x2e')](_0x33ba3e[_0x0984('0x2a')],_0x33ba3e[_0x0984('0x2d')]);_0x2454e3[_0x0984('0x2f')]=_[_0x0984('0x2e')](_0x33ba3e[_0x0984('0x2a')],qs[_0x0984('0x30')](_0x10dfcc['query'][_0x0984('0x30')]));_0x2454e3[_0x0984('0x2f')]=_0x2454e3['attributes'][_0x0984('0x31')]?_0x2454e3[_0x0984('0x2f')]:_0x33ba3e[_0x0984('0x2a')];_0x2454e3=_[_0x0984('0x32')]({},_0x2454e3,_0x10dfcc[_0x0984('0x33')]);return utilLicense[_0x0984('0x34')](_0x2454e3)['then'](respondWithResult(_0x646270,null))[_0x0984('0x35')](handleError(_0x646270,null));};exports['update']=function(_0x2ce6bf,_0x153a5c){if(_0x2ce6bf[_0x0984('0x36')]['id']){delete _0x2ce6bf['body']['id'];}return db[_0x0984('0x2c')][_0x0984('0x37')]({'where':{'id':_0x2ce6bf[_0x0984('0x38')]['id']}})[_0x0984('0x39')](handleEntityNotFound(_0x153a5c,null))[_0x0984('0x39')](function(_0x1455ba){var _0x136ac8=_0x1455ba[_0x0984('0x3a')]({'plain':!![]});return utilLicense[_0x0984('0x3b')](_0x136ac8,_0x2ce6bf[_0x0984('0x36')]['key']);})['then'](function(_0x1176b3){if(!_0x1176b3[_0x0984('0x3c')]){return saveUpdates(_0x2ce6bf[_0x0984('0x36')],null);}return _0x1176b3;})['then'](respondWithResult(_0x153a5c,null))[_0x0984('0x35')](handleError(_0x153a5c,null));};exports[_0x0984('0x3d')]=function(_0x1eb0b8,_0x4bf791){var _0x9141bc=_0x0984('0x3e');var _0xc64685=path['join']('/var',_0x0984('0x3f'),'xcally',_0x9141bc);_0x4bf791[_0x0984('0x40')](_0x0984('0x41'),_0x0984('0x42')+_0x9141bc);_0x4bf791['set'](_0x0984('0x43'),_0x0984('0x44'));_0x4bf791[_0x0984('0x45')](_0xc64685);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index e817306..40e8b42 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 _0x2e57=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','License','lodash','util'];(function(_0xaf0fe9,_0x3aaca0){var _0x598cb2=function(_0x4fb298){while(--_0x4fb298){_0xaf0fe9['push'](_0xaf0fe9['shift']());}};_0x598cb2(++_0x3aaca0);}(_0x2e57,0xc4));var _0x72e5=function(_0x31dbc6,_0x4d32de){_0x31dbc6=_0x31dbc6-0x0;var _0x3b27b6=_0x2e57[_0x31dbc6];return _0x3b27b6;};'use strict';var _=require(_0x72e5('0x0'));var util=require(_0x72e5('0x1'));var logger=require('../../config/logger')(_0x72e5('0x2'));var moment=require('moment');var BPromise=require(_0x72e5('0x3'));var rp=require(_0x72e5('0x4'));var fs=require('fs');var path=require(_0x72e5('0x5'));var rimraf=require(_0x72e5('0x6'));var config=require(_0x72e5('0x7'));var attributes=require('./license.attributes');module[_0x72e5('0x8')]=function(_0x3fd181,_0x19e2ae){return _0x3fd181[_0x72e5('0x9')](_0x72e5('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa289=['bluebird','path','../../config/environment','./license.attributes','exports','define','license','util','../../config/logger','api'];(function(_0x4a96d2,_0x689504){var _0x38af04=function(_0x3a67cd){while(--_0x3a67cd){_0x4a96d2['push'](_0x4a96d2['shift']());}};_0x38af04(++_0x689504);}(_0xa289,0x9d));var _0x9a28=function(_0xa26de4,_0x2aaf5d){_0xa26de4=_0xa26de4-0x0;var _0x3c88e4=_0xa289[_0xa26de4];return _0x3c88e4;};'use strict';var _=require('lodash');var util=require(_0x9a28('0x0'));var logger=require(_0x9a28('0x1'))(_0x9a28('0x2'));var moment=require('moment');var BPromise=require(_0x9a28('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a28('0x4'));var rimraf=require('rimraf');var config=require(_0x9a28('0x5'));var attributes=require(_0x9a28('0x6'));module[_0x9a28('0x7')]=function(_0x3267f6,_0x46b47f){return _0x3267f6[_0x9a28('0x8')]('License',attributes,{'tableName':_0x9a28('0x9'),'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 43e71af..720b79b 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 _0x031f=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','moment'];(function(_0x31e374,_0x20340c){var _0x16a0a5=function(_0x36e902){while(--_0x36e902){_0x31e374['push'](_0x31e374['shift']());}};_0x16a0a5(++_0x20340c);}(_0x031f,0x7d));var _0xf031=function(_0x20f4c7,_0x45a832){_0x20f4c7=_0x20f4c7-0x0;var _0x1a1640=_0x031f[_0x20f4c7];return _0x1a1640;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf031('0x0'));var BPromise=require('bluebird');var rs=require(_0xf031('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf031('0x2'))['db'];var utils=require(_0xf031('0x3'));var logger=require(_0xf031('0x4'))('rpc');var config=require(_0xf031('0x5'));var jayson=require(_0xf031('0x6'));var client=jayson[_0xf031('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5be6cf,_0x23cf3b,_0x5918d7){return new BPromise(function(_0xf3fab4,_0x332792){return client[_0xf031('0x8')](_0x5be6cf,_0x5918d7)[_0xf031('0x9')](function(_0x34011d){logger[_0xf031('0xa')](_0xf031('0xb'),_0x23cf3b,_0xf031('0xc'));logger[_0xf031('0xd')](_0xf031('0xe'),_0x23cf3b,_0xf031('0xc'),JSON['stringify'](_0x34011d));if(_0x34011d['error']){if(_0x34011d[_0xf031('0xf')][_0xf031('0x10')]===0x1f4){logger[_0xf031('0xf')](_0xf031('0xb'),_0x23cf3b,_0x34011d[_0xf031('0xf')][_0xf031('0x11')]);return _0x332792(_0x34011d[_0xf031('0xf')][_0xf031('0x11')]);}logger['error'](_0xf031('0xb'),_0x23cf3b,_0x34011d[_0xf031('0xf')][_0xf031('0x11')]);return _0xf3fab4(_0x34011d[_0xf031('0xf')][_0xf031('0x11')]);}else{logger['info'](_0xf031('0xb'),_0x23cf3b,_0xf031('0xc'));_0xf3fab4(_0x34011d['result'][_0xf031('0x11')]);}})['catch'](function(_0x5310ab){logger[_0xf031('0xf')](_0xf031('0xb'),_0x23cf3b,_0x5310ab);_0x332792(_0x5310ab);});});} \ No newline at end of file +var _0x2083=['License,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','License,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5f259e,_0x50caf3){var _0xa7a0d9=function(_0x5e349b){while(--_0x5e349b){_0x5f259e['push'](_0x5f259e['shift']());}};_0xa7a0d9(++_0x50caf3);}(_0x2083,0x101));var _0x3208=function(_0x259c99,_0x28fc7b){_0x259c99=_0x259c99-0x0;var _0x589fef=_0x2083[_0x259c99];return _0x589fef;};'use strict';var _=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var moment=require(_0x3208('0x2'));var BPromise=require(_0x3208('0x3'));var rs=require(_0x3208('0x4'));var fs=require('fs');var Redis=require(_0x3208('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3208('0x6'));var logger=require(_0x3208('0x7'))(_0x3208('0x8'));var config=require(_0x3208('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3208('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13ba87,_0x541509,_0x552ea9){return new BPromise(function(_0x5500fe,_0x313668){return client[_0x3208('0xb')](_0x13ba87,_0x552ea9)[_0x3208('0xc')](function(_0x2c3940){logger['info'](_0x3208('0xd'),_0x541509,_0x3208('0xe'));logger[_0x3208('0xf')](_0x3208('0x10'),_0x541509,'request\x20sent',JSON['stringify'](_0x2c3940));if(_0x2c3940[_0x3208('0x11')]){if(_0x2c3940[_0x3208('0x11')][_0x3208('0x12')]===0x1f4){logger[_0x3208('0x11')](_0x3208('0xd'),_0x541509,_0x2c3940[_0x3208('0x11')]['message']);return _0x313668(_0x2c3940[_0x3208('0x11')][_0x3208('0x13')]);}logger[_0x3208('0x11')]('License,\x20%s,\x20%s',_0x541509,_0x2c3940[_0x3208('0x11')][_0x3208('0x13')]);return _0x5500fe(_0x2c3940[_0x3208('0x11')][_0x3208('0x13')]);}else{logger['info'](_0x3208('0xd'),_0x541509,_0x3208('0xe'));_0x5500fe(_0x2c3940['result']['message']);}})[_0x3208('0x14')](function(_0xf72972){logger[_0x3208('0x11')](_0x3208('0xd'),_0x541509,_0xf72972);_0x313668(_0xf72972);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index e308520..16fdd6e 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 _0x05ec=['removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','/:id/users','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','send','put','update','delete'];(function(_0x14eb73,_0x33d2a1){var _0x686a1c=function(_0xb8dbaf){while(--_0xb8dbaf){_0x14eb73['push'](_0x14eb73['shift']());}};_0x686a1c(++_0x33d2a1);}(_0x05ec,0x19f));var _0xc05e=function(_0x236ce6,_0x26024a){_0x236ce6=_0x236ce6-0x0;var _0x3bc82d=_0x05ec[_0x236ce6];return _0x3bc82d;};'use strict';var multer=require(_0xc05e('0x0'));var util=require(_0xc05e('0x1'));var path=require(_0xc05e('0x2'));var timeout=require(_0xc05e('0x3'));var express=require(_0xc05e('0x4'));var router=express[_0xc05e('0x5')]();var fs_extra=require(_0xc05e('0x6'));var auth=require(_0xc05e('0x7'));var interaction=require(_0xc05e('0x8'));var config=require(_0xc05e('0x9'));var controller=require(_0xc05e('0xa'));router[_0xc05e('0xb')]('/',auth[_0xc05e('0xc')](),controller['index']);router[_0xc05e('0xb')](_0xc05e('0xd'),auth[_0xc05e('0xc')](),controller['describe']);router[_0xc05e('0xb')](_0xc05e('0xe'),auth[_0xc05e('0xc')](),controller[_0xc05e('0xf')]);router['get'](_0xc05e('0x10'),auth[_0xc05e('0xc')](),controller[_0xc05e('0x11')]);router[_0xc05e('0xb')](_0xc05e('0x12'),auth['isAuthenticated'](),controller[_0xc05e('0x13')]);router['get'](_0xc05e('0x14'),auth['isAuthenticated'](),controller[_0xc05e('0x15')]);router['get'](_0xc05e('0x16'),auth[_0xc05e('0xc')](),controller[_0xc05e('0x17')]);router[_0xc05e('0xb')](_0xc05e('0x18'),auth[_0xc05e('0xc')](),controller['getInteractions']);router['get'](_0xc05e('0x19'),auth[_0xc05e('0xc')](),controller[_0xc05e('0x1a')]);router[_0xc05e('0xb')](_0xc05e('0x1b'),auth[_0xc05e('0xc')](),controller[_0xc05e('0x1c')]);router[_0xc05e('0xb')](_0xc05e('0x1d'),auth['isAuthenticated'](),controller[_0xc05e('0x1e')]);router[_0xc05e('0xb')]('/:id/users',auth[_0xc05e('0xc')](),controller[_0xc05e('0x1f')]);router[_0xc05e('0x20')](_0xc05e('0x10'),auth[_0xc05e('0xc')](),controller[_0xc05e('0x21')]);router[_0xc05e('0x20')](_0xc05e('0x12'),auth['isAuthenticated'](),controller[_0xc05e('0x22')]);router[_0xc05e('0x20')]('/',auth['isAuthenticated'](),controller[_0xc05e('0x23')]);router[_0xc05e('0x20')]('/:id/in_servers',auth[_0xc05e('0xc')](),controller[_0xc05e('0x24')]);router[_0xc05e('0x20')](_0xc05e('0x16'),auth[_0xc05e('0xc')](),controller[_0xc05e('0x25')]);router[_0xc05e('0x20')](_0xc05e('0x18'),auth['isAuthenticated'](),controller[_0xc05e('0x26')]);router['post'](_0xc05e('0x19'),auth[_0xc05e('0xc')](),controller['addApplications']);router['post'](_0xc05e('0x27'),auth['isAuthenticated'](),controller[_0xc05e('0x28')]);router[_0xc05e('0x20')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xc05e('0x29')](_0xc05e('0xe'),auth[_0xc05e('0xc')](),controller[_0xc05e('0x2a')]);router[_0xc05e('0x2b')]('/:id/dispositions',auth[_0xc05e('0xc')](),controller[_0xc05e('0x2c')]);router[_0xc05e('0x2b')]('/:id/canned_answers',auth[_0xc05e('0xc')](),controller[_0xc05e('0x2d')]);router[_0xc05e('0x2b')](_0xc05e('0x14'),auth[_0xc05e('0xc')](),controller[_0xc05e('0x2e')]);router[_0xc05e('0x2b')]('/:id/out_servers',auth[_0xc05e('0xc')](),controller[_0xc05e('0x2f')]);router[_0xc05e('0x2b')](_0xc05e('0xe'),auth[_0xc05e('0xc')](),controller[_0xc05e('0x30')]);router[_0xc05e('0x2b')](_0xc05e('0x31'),auth[_0xc05e('0xc')](),controller['removeAgents']);module[_0xc05e('0x32')]=router; \ No newline at end of file +var _0xc09f=['./mailAccount.controller','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','addDisposition','post','/:id/canned_answers','addAnswer','create','addImap','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc09f,0xda));var _0xfc09=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xc09f[_0x62c958];return _0x57ec61;};'use strict';var multer=require(_0xfc09('0x0'));var util=require(_0xfc09('0x1'));var path=require('path');var timeout=require(_0xfc09('0x2'));var express=require(_0xfc09('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfc09('0x4'));var interaction=require(_0xfc09('0x5'));var config=require(_0xfc09('0x6'));var controller=require(_0xfc09('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfc09('0x8')]('/describe',auth[_0xfc09('0x9')](),controller[_0xfc09('0xa')]);router[_0xfc09('0x8')](_0xfc09('0xb'),auth[_0xfc09('0x9')](),controller['show']);router[_0xfc09('0x8')](_0xfc09('0xc'),auth[_0xfc09('0x9')](),controller[_0xfc09('0xd')]);router[_0xfc09('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xfc09('0x8')](_0xfc09('0xe'),auth[_0xfc09('0x9')](),controller[_0xfc09('0xf')]);router[_0xfc09('0x8')](_0xfc09('0x10'),auth[_0xfc09('0x9')](),controller[_0xfc09('0x11')]);router[_0xfc09('0x8')](_0xfc09('0x12'),auth[_0xfc09('0x9')](),controller[_0xfc09('0x13')]);router[_0xfc09('0x8')]('/:id/applications',auth[_0xfc09('0x9')](),controller[_0xfc09('0x14')]);router[_0xfc09('0x8')](_0xfc09('0x15'),auth[_0xfc09('0x9')](),controller[_0xfc09('0x16')]);router[_0xfc09('0x8')](_0xfc09('0x17'),auth[_0xfc09('0x9')](),controller[_0xfc09('0x18')]);router[_0xfc09('0x8')](_0xfc09('0x19'),auth[_0xfc09('0x9')](),controller['getAgents']);router['post'](_0xfc09('0xc'),auth[_0xfc09('0x9')](),controller[_0xfc09('0x1a')]);router[_0xfc09('0x1b')](_0xfc09('0x1c'),auth[_0xfc09('0x9')](),controller[_0xfc09('0x1d')]);router[_0xfc09('0x1b')]('/',auth[_0xfc09('0x9')](),controller[_0xfc09('0x1e')]);router[_0xfc09('0x1b')](_0xfc09('0xe'),auth[_0xfc09('0x9')](),controller[_0xfc09('0x1f')]);router[_0xfc09('0x1b')](_0xfc09('0x10'),auth[_0xfc09('0x9')](),controller['addSmtp']);router[_0xfc09('0x1b')](_0xfc09('0x12'),auth[_0xfc09('0x9')](),controller[_0xfc09('0x20')]);router[_0xfc09('0x1b')](_0xfc09('0x21'),auth[_0xfc09('0x9')](),controller[_0xfc09('0x22')]);router[_0xfc09('0x1b')](_0xfc09('0x23'),auth['isAuthenticated'](),controller[_0xfc09('0x24')]);router[_0xfc09('0x1b')](_0xfc09('0x19'),auth[_0xfc09('0x9')](),controller[_0xfc09('0x25')]);router[_0xfc09('0x26')]('/:id',auth[_0xfc09('0x9')](),controller['update']);router[_0xfc09('0x27')]('/:id/dispositions',auth[_0xfc09('0x9')](),controller[_0xfc09('0x28')]);router[_0xfc09('0x27')](_0xfc09('0x1c'),auth[_0xfc09('0x9')](),controller[_0xfc09('0x29')]);router[_0xfc09('0x27')]('/:id/in_servers',auth[_0xfc09('0x9')](),controller[_0xfc09('0x2a')]);router[_0xfc09('0x27')]('/:id/out_servers',auth[_0xfc09('0x9')](),controller[_0xfc09('0x2b')]);router[_0xfc09('0x27')](_0xfc09('0xb'),auth[_0xfc09('0x9')](),controller['destroy']);router['delete'](_0xfc09('0x19'),auth[_0xfc09('0x9')](),controller[_0xfc09('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 3949790..5677d15 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 _0xdfd2=['yahoo','outlook365','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','gmail','hotmail'];(function(_0x12e967,_0x149823){var _0x352aa7=function(_0x328bf9){while(--_0x328bf9){_0x12e967['push'](_0x12e967['shift']());}};_0x352aa7(++_0x149823);}(_0xdfd2,0x1a6));var _0x2dfd=function(_0xa2e08b,_0x536496){_0xa2e08b=_0xa2e08b-0x0;var _0xcad732=_0xdfd2[_0xa2e08b];return _0xcad732;};'use strict';var Sequelize=require(_0x2dfd('0x0'));module[_0x2dfd('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2dfd('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x2dfd('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2dfd('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2dfd('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x2dfd('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2dfd('0x2')],'allowNull':![],'defaultValue':_0x2dfd('0x5')},'fontSize':{'type':Sequelize[_0x2dfd('0x6')](0x2)[_0x2dfd('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x2dfd('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2dfd('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2dfd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2dfd('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2dfd('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2dfd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x2dfd('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2dfd('0x3')],'defaultValue':![],'comment':_0x2dfd('0x9'),'set':function(_0x53d08c){if(!_0x53d08c)this['setDataValue'](_0x2dfd('0xa'),null);this[_0x2dfd('0xb')](_0x2dfd('0xc'),_0x53d08c);}},'provider':{'type':Sequelize['ENUM'](_0x2dfd('0xd'),_0x2dfd('0xe'),_0x2dfd('0xf'),_0x2dfd('0x10')),'defaultValue':null,'get':function(){var _0x230249=this['getDataValue'](_0x2dfd('0x11'));return _0x230249||_0x2dfd('0x12');},'set':function(_0x1052af){if(_0x1052af===_0x2dfd('0x12')){_0x1052af=null;}return this[_0x2dfd('0xb')]('provider',_0x1052af);}}}; \ No newline at end of file +var _0xcfaf=['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}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','gmail','hotmail','yahoo','outlook365','getDataValue','custom','sequelize'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0xcfaf,0x76));var _0xfcfa=function(_0x542838,_0x2062d6){_0x542838=_0x542838-0x0;var _0xd9c696=_0xcfaf[_0x542838];return _0xd9c696;};'use strict';var Sequelize=require(_0xfcfa('0x0'));module[_0xfcfa('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xfcfa('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xfcfa('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xfcfa('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xfcfa('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xfcfa('0x4')]},'markAsUnread':{'type':Sequelize[_0xfcfa('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xfcfa('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xfcfa('0x5')](0x2)[_0xfcfa('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xfcfa('0x4')],'defaultValue':function(){return _0xfcfa('0x7');}},'notificationSound':{'type':Sequelize[_0xfcfa('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfcfa('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfcfa('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfcfa('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfcfa('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfcfa('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xfcfa('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xfcfa('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x103fb2){if(!_0x103fb2)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xfcfa('0x9')](_0xfcfa('0xa'),_0x103fb2);}},'provider':{'type':Sequelize['ENUM'](_0xfcfa('0xb'),_0xfcfa('0xc'),_0xfcfa('0xd'),_0xfcfa('0xe')),'defaultValue':null,'get':function(){var _0x4a154a=this[_0xfcfa('0xf')]('provider');return _0x4a154a||_0xfcfa('0x10');},'set':function(_0x38aa6b){if(_0x38aa6b===_0xfcfa('0x10')){_0x38aa6b=null;}return this[_0xfcfa('0x9')]('provider',_0x38aa6b);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index b874a46..b341933 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 _0xe2c9=['server/files/attachments','basename','getSmtpOptions','sendMail','List\x20not\x20found','defaults','subject','attach','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','then','destroy','MailAccounts','UserProfileResource','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerIn','map','MailAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','MailServerOut','Pause','mandatoryDispositionPause','keys','options','find','update','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','key','email','ListId','isNil','active','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','true','split','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2c9,0x1a3));var _0x9e2c=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xe2c9[_0x2b5eae];return _0x5f3ac9;};'use strict';var moment=require('moment');var BPromise=require(_0x9e2c('0x0'));var util=require('util');var path=require(_0x9e2c('0x1'));var _=require(_0x9e2c('0x2'));var juice=require(_0x9e2c('0x3'));var Redis=require(_0x9e2c('0x4'));var qs=require(_0x9e2c('0x5'));var logger=require(_0x9e2c('0x6'))('api');var config=require(_0x9e2c('0x7'));var db=require(_0x9e2c('0x8'))['db'];config[_0x9e2c('0x9')]=_['defaults'](config[_0x9e2c('0x9')],{'host':_0x9e2c('0xa'),'port':0x18eb});var socket=require(_0x9e2c('0xb'))(new Redis(config[_0x9e2c('0x9')]));require(_0x9e2c('0xc'))[_0x9e2c('0xd')](socket);var jayson=require(_0x9e2c('0xe'));var client=jayson[_0x9e2c('0xf')][_0x9e2c('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x7f23d1,_0x5b8943,_0x36a396,_0x51d77f){return new BPromise(function(_0x568dce,_0x244575){var _0x11524b=_0x51d77f||client;return _0x11524b[_0x9e2c('0x11')](_0x7f23d1,_0x36a396)['then'](function(_0x3a4b7b){logger[_0x9e2c('0x12')](_0x9e2c('0x13'),_0x5b8943,_0x9e2c('0x14'));logger[_0x9e2c('0x15')](_0x9e2c('0x16'),_0x5b8943,'request\x20sent',JSON['stringify'](_0x3a4b7b));if(_0x3a4b7b[_0x9e2c('0x17')]){if(_0x3a4b7b[_0x9e2c('0x17')][_0x9e2c('0x18')]===0x1f4){logger[_0x9e2c('0x17')](_0x9e2c('0x13'),_0x5b8943,_0x3a4b7b['error'][_0x9e2c('0x19')]);return _0x244575(_0x3a4b7b[_0x9e2c('0x17')]['message']);}logger[_0x9e2c('0x17')]('MailAccount,\x20%s,\x20%s',_0x5b8943,_0x3a4b7b[_0x9e2c('0x17')][_0x9e2c('0x19')]);return _0x568dce(_0x3a4b7b[_0x9e2c('0x17')][_0x9e2c('0x19')]);}else{logger[_0x9e2c('0x12')]('MailAccount,\x20%s,\x20%s',_0x5b8943,_0x9e2c('0x14'));_0x568dce(_0x3a4b7b[_0x9e2c('0x1a')][_0x9e2c('0x19')]);}})[_0x9e2c('0x1b')](function(_0x3cbdcc){logger[_0x9e2c('0x17')]('MailAccount,\x20%s,\x20%s',_0x5b8943,_0x3cbdcc);_0x244575(_0x3cbdcc);});});}function respondWithStatusCode(_0x358bb8,_0x57b9fa){_0x57b9fa=_0x57b9fa||0xcc;return function(_0x344635){if(_0x344635){return _0x358bb8[_0x9e2c('0x1c')](_0x57b9fa);}return _0x358bb8[_0x9e2c('0x1d')](_0x57b9fa)[_0x9e2c('0x1e')]();};}function respondWithResult(_0x2eca7b,_0x5a011e){_0x5a011e=_0x5a011e||0xc8;return function(_0x23d2b2){if(_0x23d2b2){return _0x2eca7b[_0x9e2c('0x1d')](_0x5a011e)[_0x9e2c('0x1f')](_0x23d2b2);}};}function respondWithFilteredResult(_0x3ea0f1,_0x4e13cb){return function(_0x982422){if(_0x982422){var _0x2f33d0=typeof _0x4e13cb[_0x9e2c('0x20')]===_0x9e2c('0x21')&&typeof _0x4e13cb[_0x9e2c('0x22')]==='undefined';var _0x358cd9=_0x982422[_0x9e2c('0x23')];var _0x12dcae=_0x2f33d0?0x0:_0x4e13cb[_0x9e2c('0x20')];var _0x2c09e2=_0x2f33d0?_0x982422[_0x9e2c('0x23')]:_0x4e13cb[_0x9e2c('0x20')]+_0x4e13cb[_0x9e2c('0x22')];var _0xc8b199;if(_0x2c09e2>=_0x358cd9){_0x2c09e2=_0x358cd9;_0xc8b199=0xc8;}else{_0xc8b199=0xce;}_0x3ea0f1[_0x9e2c('0x1d')](_0xc8b199);return _0x3ea0f1[_0x9e2c('0x24')]('Content-Range',_0x12dcae+'-'+_0x2c09e2+'/'+_0x358cd9)[_0x9e2c('0x1f')](_0x982422);}return null;};}function saveUpdates(_0x3c140d){return function(_0x333e3f){if(_0x333e3f){return _0x333e3f['update'](_0x3c140d)[_0x9e2c('0x25')](function(_0x445e2a){return _0x445e2a;});}return null;};}function removeEntity(_0x55988c){return function(_0x5d83ec){if(_0x5d83ec){return _0x5d83ec[_0x9e2c('0x26')]()['then'](function(){var _0x1ac363=_0x5d83ec['get']({'plain':!![]});var _0x1bcd89=_0x9e2c('0x27');return db[_0x9e2c('0x28')][_0x9e2c('0x26')]({'where':{'type':_0x1bcd89,'resourceId':_0x1ac363['id']}})[_0x9e2c('0x25')](function(){return _0x5d83ec;});})[_0x9e2c('0x25')](function(){_0x55988c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45e8fa){return function(_0xc69ff0){if(!_0xc69ff0){_0x45e8fa[_0x9e2c('0x1c')](0x194);}return _0xc69ff0;};}function handleError(_0x37306c,_0x5072f4){_0x5072f4=_0x5072f4||0x1f4;return function(_0x4af464){logger['error'](_0x4af464[_0x9e2c('0x29')]);if(_0x4af464['name']){delete _0x4af464[_0x9e2c('0x2a')];}_0x37306c['status'](_0x5072f4)[_0x9e2c('0x2b')](_0x4af464);};}function getImapHost(_0x57304c){switch(_0x57304c){case'gmail':return _0x9e2c('0x2c');case _0x9e2c('0x2d'):return _0x9e2c('0x2e');case _0x9e2c('0x2f'):return _0x9e2c('0x30');case _0x9e2c('0x31'):return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x57304c);}function getSmtpHost(_0x1f286e){switch(_0x1f286e){case _0x9e2c('0x32'):return _0x9e2c('0x33');case'yahoo':return _0x9e2c('0x34');case _0x9e2c('0x2f'):return _0x9e2c('0x35');case'outlook365':return _0x9e2c('0x36');}throw new Error(_0x9e2c('0x37'),_0x1f286e);}function getAuthenticationOptions(_0xd9aca6,_0x3e059b){var _0x180d4c={};var _0x2c5d41={};if(_0xd9aca6){_0x180d4c[_0x9e2c('0x38')]=_0x2c5d41[_0x9e2c('0x38')]=_0x3e059b[_0x9e2c('0x39')];_0x180d4c[_0x9e2c('0x3a')]=_0x2c5d41[_0x9e2c('0x3b')]=_0x3e059b['password'];if(_0x3e059b[_0x9e2c('0x3c')]){_0x180d4c[_0x9e2c('0x3c')]=_0x2c5d41[_0x9e2c('0x3c')]=!![];_0x180d4c[_0x9e2c('0x3d')]=_0x2c5d41[_0x9e2c('0x3d')]=_0x3e059b[_0x9e2c('0x3d')];_0x180d4c[_0x9e2c('0x3a')]=_0x2c5d41[_0x9e2c('0x3b')]=null;}else{_0x180d4c[_0x9e2c('0x3d')]=_0x2c5d41[_0x9e2c('0x3d')]=null;}_0x180d4c[_0x9e2c('0x3e')]=getImapHost(_0xd9aca6);_0x180d4c[_0x9e2c('0x3f')]=0x3e1;_0x2c5d41[_0x9e2c('0x3e')]=getSmtpHost(_0xd9aca6);_0x2c5d41[_0x9e2c('0x3f')]=0x24b;_0x2c5d41[_0x9e2c('0x40')]=![];_0x180d4c[_0x9e2c('0x41')]=_0x2c5d41[_0x9e2c('0x41')]=null;}else{if(_0x3e059b['authentication']){_0x180d4c['user']=_0x2c5d41[_0x9e2c('0x38')]=_0x3e059b[_0x9e2c('0x39')];_0x180d4c[_0x9e2c('0x3a')]=_0x2c5d41[_0x9e2c('0x3b')]=_0x3e059b[_0x9e2c('0x3a')];}else{_0x180d4c[_0x9e2c('0x42')]=_0x2c5d41[_0x9e2c('0x42')]=![];_0x180d4c[_0x9e2c('0x38')]=_0x2c5d41[_0x9e2c('0x38')]=null;_0x180d4c['password']=_0x2c5d41[_0x9e2c('0x3b')]=null;}_0x180d4c[_0x9e2c('0x3e')]=_0x3e059b[_0x9e2c('0x43')]['host'];_0x180d4c[_0x9e2c('0x3f')]=_0x3e059b[_0x9e2c('0x43')][_0x9e2c('0x3f')];_0x2c5d41[_0x9e2c('0x3e')]=_0x3e059b[_0x9e2c('0x44')][_0x9e2c('0x3e')];_0x2c5d41[_0x9e2c('0x3f')]=_0x3e059b[_0x9e2c('0x44')][_0x9e2c('0x3f')];}return{'Imap':_0x180d4c,'Smtp':_0x2c5d41};}exports['index']=function(_0x2edd54,_0x52c16c){var _0x513a15={'include':[{'model':db[_0x9e2c('0x45')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x9e2c('0x44')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x126a2b={},_0x3237c6={'count':0x0,'rows':[]};var _0xa30633=_[_0x9e2c('0x46')](db[_0x9e2c('0x47')][_0x9e2c('0x48')],function(_0x577d3d){return{'name':_0x577d3d[_0x9e2c('0x49')],'type':_0x577d3d[_0x9e2c('0x4a')]['key']};});_0x126a2b[_0x9e2c('0x4b')]=_[_0x9e2c('0x46')](_0xa30633,_0x9e2c('0x2a'));_0x126a2b[_0x9e2c('0x4c')]=_['keys'](_0x2edd54[_0x9e2c('0x4c')]);_0x126a2b[_0x9e2c('0x4d')]=_[_0x9e2c('0x4e')](_0x126a2b[_0x9e2c('0x4b')],_0x126a2b['query']);_0x513a15[_0x9e2c('0x4f')]=_[_0x9e2c('0x4e')](_0x126a2b['model'],qs[_0x9e2c('0x50')](_0x2edd54[_0x9e2c('0x4c')][_0x9e2c('0x50')]));_0x513a15[_0x9e2c('0x4f')]=_0x513a15[_0x9e2c('0x4f')][_0x9e2c('0x51')]?_0x513a15[_0x9e2c('0x4f')]:_0x126a2b[_0x9e2c('0x4b')];if(!_0x2edd54['query'][_0x9e2c('0x52')](_0x9e2c('0x53'))){_0x513a15['limit']=qs[_0x9e2c('0x22')](_0x2edd54[_0x9e2c('0x4c')][_0x9e2c('0x22')]);_0x513a15[_0x9e2c('0x20')]=qs[_0x9e2c('0x20')](_0x2edd54[_0x9e2c('0x4c')][_0x9e2c('0x20')]);}_0x513a15[_0x9e2c('0x54')]=qs[_0x9e2c('0x55')](_0x2edd54[_0x9e2c('0x4c')][_0x9e2c('0x55')]);_0x513a15[_0x9e2c('0x56')]=qs['filters'](_[_0x9e2c('0x57')](_0x2edd54['query'],_0x126a2b[_0x9e2c('0x4d')]),_0xa30633);if(_0x2edd54['query']['filter']){_0x513a15[_0x9e2c('0x56')]=_[_0x9e2c('0x58')](_0x513a15[_0x9e2c('0x56')],{'$or':_[_0x9e2c('0x46')](_0xa30633,function(_0x5f09b4){if(_0x5f09b4[_0x9e2c('0x4a')]!==_0x9e2c('0x59')){var _0x55c9e7={};_0x55c9e7[_0x5f09b4[_0x9e2c('0x2a')]]={'$like':'%'+_0x2edd54[_0x9e2c('0x4c')][_0x9e2c('0x5a')]+'%'};return _0x55c9e7;}})});}_0x513a15=_['merge']({},_0x513a15,_0x2edd54['options']);var _0x42cb2a={'where':_0x513a15[_0x9e2c('0x56')]};return db[_0x9e2c('0x47')][_0x9e2c('0x23')](_0x42cb2a)[_0x9e2c('0x25')](function(_0x296cf1){_0x3237c6[_0x9e2c('0x23')]=_0x296cf1;if(_0x2edd54[_0x9e2c('0x4c')][_0x9e2c('0x5b')]){_0x513a15[_0x9e2c('0x5c')]=[{'all':!![]}];}return db[_0x9e2c('0x47')][_0x9e2c('0x5d')](_0x513a15);})[_0x9e2c('0x25')](function(_0x40e24c){_0x3237c6[_0x9e2c('0x5e')]=_0x40e24c;return _0x3237c6;})[_0x9e2c('0x25')](respondWithFilteredResult(_0x52c16c,_0x513a15))[_0x9e2c('0x1b')](handleError(_0x52c16c,null));};exports[_0x9e2c('0x5f')]=function(_0x421f6a,_0x570fb5){var _0x843b27={'raw':![],'where':{'id':_0x421f6a[_0x9e2c('0x60')]['id']},'include':[{'model':db[_0x9e2c('0x45')],'as':_0x9e2c('0x43')},{'model':db[_0x9e2c('0x61')],'as':_0x9e2c('0x44')},{'model':db[_0x9e2c('0x62')],'as':_0x9e2c('0x63')}]},_0x1892f7={};_0x1892f7[_0x9e2c('0x4b')]=_['keys'](db[_0x9e2c('0x47')]['rawAttributes']);_0x1892f7[_0x9e2c('0x4c')]=_[_0x9e2c('0x64')](_0x421f6a['query']);_0x1892f7['filters']=_[_0x9e2c('0x4e')](_0x1892f7[_0x9e2c('0x4b')],_0x1892f7[_0x9e2c('0x4c')]);_0x843b27[_0x9e2c('0x4f')]=_[_0x9e2c('0x4e')](_0x1892f7[_0x9e2c('0x4b')],qs[_0x9e2c('0x50')](_0x421f6a[_0x9e2c('0x4c')][_0x9e2c('0x50')]));_0x843b27[_0x9e2c('0x4f')]=_0x843b27[_0x9e2c('0x4f')]['length']?_0x843b27[_0x9e2c('0x4f')]:_0x1892f7[_0x9e2c('0x4b')];if(_0x421f6a[_0x9e2c('0x4c')][_0x9e2c('0x5b')]){_0x843b27[_0x9e2c('0x5c')]=[{'all':!![]}];}_0x843b27=_[_0x9e2c('0x58')]({},_0x843b27,_0x421f6a[_0x9e2c('0x65')]);return db[_0x9e2c('0x47')][_0x9e2c('0x66')](_0x843b27)[_0x9e2c('0x25')](handleEntityNotFound(_0x570fb5,null))['then'](respondWithResult(_0x570fb5,null))[_0x9e2c('0x1b')](handleError(_0x570fb5,null));};exports[_0x9e2c('0x67')]=function(_0x4a1537,_0x54ed5c){if(_0x4a1537['body']['id']){delete _0x4a1537[_0x9e2c('0x68')]['id'];}var _0x5e10c6=_0x4a1537['body'][_0x9e2c('0x69')]===_0x9e2c('0x6a')?null:_0x4a1537[_0x9e2c('0x68')]['provider'];var _0x562634=_0x4a1537['body'][_0x9e2c('0x43')]||{};var _0x52e35d=_0x4a1537[_0x9e2c('0x68')][_0x9e2c('0x44')]||{};if(_0x5e10c6){_0x562634[_0x9e2c('0x3e')]=getImapHost(_0x5e10c6);_0x562634[_0x9e2c('0x3f')]=0x3e1;_0x52e35d[_0x9e2c('0x3e')]=getSmtpHost(_0x5e10c6);_0x52e35d[_0x9e2c('0x3f')]=0x24b;_0x52e35d[_0x9e2c('0x40')]=![];}if(_0x52e35d['modernAuthentication']){_0x52e35d[_0x9e2c('0x40')]=![];}else{_0x52e35d[_0x9e2c('0x3d')]=null;}if(!_0x562634['modernAuthentication'])_0x562634[_0x9e2c('0x3d')]=null;_0x4a1537[_0x9e2c('0x68')][_0x9e2c('0x43')]=_0x562634;_0x4a1537[_0x9e2c('0x68')]['Smtp']=_0x52e35d;return db[_0x9e2c('0x47')][_0x9e2c('0x66')]({'where':{'id':_0x4a1537['params']['id']},'include':[{'model':db[_0x9e2c('0x45')],'as':_0x9e2c('0x43')},{'model':db[_0x9e2c('0x61')],'as':_0x9e2c('0x44')},{'model':db[_0x9e2c('0x62')],'as':_0x9e2c('0x63')}]})[_0x9e2c('0x25')](handleEntityNotFound(_0x54ed5c,null))[_0x9e2c('0x25')](function(_0x2ff2f1){if(!_0x2ff2f1)throw new Error(_0x9e2c('0x6b'));if(_0x2ff2f1[_0x9e2c('0x41')])delete _0x4a1537[_0x9e2c('0x68')][_0x9e2c('0x43')];return _0x2ff2f1;})['then'](saveUpdates(_0x4a1537[_0x9e2c('0x68')],null))[_0x9e2c('0x25')](function(_0x5f3b2c){if(!_0x4a1537['body'][_0x9e2c('0x43')])return _0x5f3b2c;return db[_0x9e2c('0x45')][_0x9e2c('0x67')](_0x4a1537['body'][_0x9e2c('0x43')],{'where':{'MailAccountId':_0x5f3b2c['id']}})[_0x9e2c('0x25')](function(){return _0x5f3b2c;});})['then'](function(_0x2a8321){if(!_0x4a1537['body']['Smtp'])return _0x2a8321;return db[_0x9e2c('0x61')][_0x9e2c('0x67')](_0x4a1537[_0x9e2c('0x68')]['Smtp'],{'where':{'MailAccountId':_0x2a8321['id']}})[_0x9e2c('0x25')](function(){return _0x2a8321;});})[_0x9e2c('0x25')](respondWithResult(_0x54ed5c,null))[_0x9e2c('0x1b')](handleError(_0x54ed5c,null));};exports['describe']=function(_0x2eaa1b,_0x4e47b3){return db['MailAccount'][_0x9e2c('0x6c')]()[_0x9e2c('0x25')](respondWithResult(_0x4e47b3,null))['catch'](handleError(_0x4e47b3,null));};exports[_0x9e2c('0x6d')]=function(_0x4b0289,_0x348c46){if(_0x4b0289['body']['id']){delete _0x4b0289[_0x9e2c('0x68')]['id'];}return db[_0x9e2c('0x47')][_0x9e2c('0x66')]({'where':{'id':_0x4b0289[_0x9e2c('0x60')]['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x348c46,null))[_0x9e2c('0x25')](function(_0x527290){if(_0x527290){_0x4b0289['body'][_0x9e2c('0x6e')]=_0x527290['id'];return db[_0x9e2c('0x6f')][_0x9e2c('0x70')](_0x4b0289['body']);}})[_0x9e2c('0x25')](respondWithResult(_0x348c46,null))[_0x9e2c('0x1b')](handleError(_0x348c46,null));};exports[_0x9e2c('0x71')]=function(_0x2aed4e,_0xbe18ff){var _0x15d088={'raw':![],'where':{}};var _0x515d18={};var _0x169b28={'count':0x0,'rows':[]};return db[_0x9e2c('0x47')][_0x9e2c('0x72')]({'where':{'id':_0x2aed4e[_0x9e2c('0x60')]['id']}})['then'](handleEntityNotFound(_0xbe18ff,null))[_0x9e2c('0x25')](function(_0x1ea9dc){if(_0x1ea9dc){_0x515d18['model']=_[_0x9e2c('0x64')](db['Disposition']['rawAttributes']);_0x515d18[_0x9e2c('0x4c')]=_[_0x9e2c('0x64')](_0x2aed4e['query']);_0x515d18[_0x9e2c('0x4d')]=_[_0x9e2c('0x4e')](_0x515d18['model'],_0x515d18[_0x9e2c('0x4c')]);_0x15d088[_0x9e2c('0x4f')]=_[_0x9e2c('0x4e')](_0x515d18[_0x9e2c('0x4b')],qs[_0x9e2c('0x50')](_0x2aed4e[_0x9e2c('0x4c')][_0x9e2c('0x50')]));_0x15d088[_0x9e2c('0x4f')]=_0x15d088['attributes'][_0x9e2c('0x51')]?_0x15d088[_0x9e2c('0x4f')]:_0x515d18[_0x9e2c('0x4b')];if(!_0x2aed4e[_0x9e2c('0x4c')][_0x9e2c('0x52')](_0x9e2c('0x53'))){_0x15d088[_0x9e2c('0x22')]=qs[_0x9e2c('0x22')](_0x2aed4e[_0x9e2c('0x4c')][_0x9e2c('0x22')]);_0x15d088[_0x9e2c('0x20')]=qs[_0x9e2c('0x20')](_0x2aed4e[_0x9e2c('0x4c')][_0x9e2c('0x20')]);}_0x15d088['order']=qs[_0x9e2c('0x55')](_0x2aed4e[_0x9e2c('0x4c')][_0x9e2c('0x55')]);_0x15d088[_0x9e2c('0x56')]=qs['filters'](_[_0x9e2c('0x57')](_0x2aed4e[_0x9e2c('0x4c')],_0x515d18[_0x9e2c('0x4d')]));_0x15d088[_0x9e2c('0x56')]['MailAccountId']=_0x1ea9dc['id'];if(_0x2aed4e['query'][_0x9e2c('0x5a')]){_0x15d088[_0x9e2c('0x56')]=_[_0x9e2c('0x58')](_0x15d088[_0x9e2c('0x56')],{'$or':_[_0x9e2c('0x46')](_0x15d088['attributes'],function(_0x258fa3){var _0x515d64={};_0x515d64[_0x258fa3]={'$like':'%'+_0x2aed4e[_0x9e2c('0x4c')][_0x9e2c('0x5a')]+'%'};return _0x515d64;})});}_0x15d088=_[_0x9e2c('0x58')]({},_0x15d088,_0x2aed4e['options']);return db[_0x9e2c('0x6f')][_0x9e2c('0x23')]({'where':_0x15d088['where']})[_0x9e2c('0x25')](function(_0x271c29){_0x169b28['count']=_0x271c29;if(_0x2aed4e['query']['includeAll']){_0x15d088['include']=[{'all':!![]}];}return db[_0x9e2c('0x6f')][_0x9e2c('0x5d')](_0x15d088);})[_0x9e2c('0x25')](function(_0x1384f8){_0x169b28['rows']=_0x1384f8;return _0x169b28;});}})[_0x9e2c('0x25')](respondWithFilteredResult(_0xbe18ff,_0x15d088))[_0x9e2c('0x1b')](handleError(_0xbe18ff,null));};exports[_0x9e2c('0x73')]=function(_0x55007c,_0x418e83){return db[_0x9e2c('0x47')][_0x9e2c('0x66')]({'where':{'id':_0x55007c[_0x9e2c('0x60')]['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x418e83,null))[_0x9e2c('0x25')](function(_0x312f09){if(_0x312f09){return _0x312f09[_0x9e2c('0x73')](_0x55007c[_0x9e2c('0x4c')][_0x9e2c('0x74')]);}})['then'](respondWithStatusCode(_0x418e83,null))[_0x9e2c('0x1b')](handleError(_0x418e83,null));};exports['addAnswer']=function(_0x14b5cd,_0x158104){if(_0x14b5cd[_0x9e2c('0x68')]['id']){delete _0x14b5cd['body']['id'];}return db[_0x9e2c('0x47')][_0x9e2c('0x66')]({'where':{'id':_0x14b5cd[_0x9e2c('0x60')]['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x158104,null))[_0x9e2c('0x25')](function(_0xfbb223){if(_0xfbb223){_0x14b5cd[_0x9e2c('0x68')][_0x9e2c('0x6e')]=_0xfbb223['id'];return db['CannedAnswer'][_0x9e2c('0x70')](_0x14b5cd[_0x9e2c('0x68')]);}})['then'](respondWithResult(_0x158104,null))['catch'](handleError(_0x158104,null));};exports[_0x9e2c('0x75')]=function(_0x118767,_0x559c5d){var _0x54e045={'raw':![],'where':{}};var _0x4fe3c3={};var _0xb9278f={'count':0x0,'rows':[]};return db['MailAccount'][_0x9e2c('0x72')]({'where':{'id':_0x118767['params']['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x559c5d,null))[_0x9e2c('0x25')](function(_0x21f33d){if(_0x21f33d){_0x4fe3c3['model']=_['keys'](db[_0x9e2c('0x76')][_0x9e2c('0x48')]);_0x4fe3c3[_0x9e2c('0x4c')]=_[_0x9e2c('0x64')](_0x118767['query']);_0x4fe3c3[_0x9e2c('0x4d')]=_['intersection'](_0x4fe3c3[_0x9e2c('0x4b')],_0x4fe3c3[_0x9e2c('0x4c')]);_0x54e045[_0x9e2c('0x4f')]=_[_0x9e2c('0x4e')](_0x4fe3c3[_0x9e2c('0x4b')],qs['fields'](_0x118767[_0x9e2c('0x4c')][_0x9e2c('0x50')]));_0x54e045[_0x9e2c('0x4f')]=_0x54e045[_0x9e2c('0x4f')][_0x9e2c('0x51')]?_0x54e045['attributes']:_0x4fe3c3[_0x9e2c('0x4b')];if(!_0x118767[_0x9e2c('0x4c')][_0x9e2c('0x52')]('nolimit')){_0x54e045[_0x9e2c('0x22')]=qs[_0x9e2c('0x22')](_0x118767[_0x9e2c('0x4c')][_0x9e2c('0x22')]);_0x54e045[_0x9e2c('0x20')]=qs[_0x9e2c('0x20')](_0x118767[_0x9e2c('0x4c')][_0x9e2c('0x20')]);}_0x54e045[_0x9e2c('0x54')]=qs['sort'](_0x118767[_0x9e2c('0x4c')][_0x9e2c('0x55')]);_0x54e045[_0x9e2c('0x56')]=qs[_0x9e2c('0x4d')](_[_0x9e2c('0x57')](_0x118767[_0x9e2c('0x4c')],_0x4fe3c3[_0x9e2c('0x4d')]));_0x54e045[_0x9e2c('0x56')][_0x9e2c('0x6e')]=_0x21f33d['id'];if(_0x118767[_0x9e2c('0x4c')][_0x9e2c('0x5a')]){_0x54e045['where']=_[_0x9e2c('0x58')](_0x54e045[_0x9e2c('0x56')],{'$or':_[_0x9e2c('0x46')](_0x54e045[_0x9e2c('0x4f')],function(_0x29c940){var _0x121d60={};_0x121d60[_0x29c940]={'$like':'%'+_0x118767[_0x9e2c('0x4c')][_0x9e2c('0x5a')]+'%'};return _0x121d60;})});}_0x54e045=_[_0x9e2c('0x58')]({},_0x54e045,_0x118767['options']);return db[_0x9e2c('0x76')]['count']({'where':_0x54e045[_0x9e2c('0x56')]})[_0x9e2c('0x25')](function(_0x2cfc1a){_0xb9278f[_0x9e2c('0x23')]=_0x2cfc1a;if(_0x118767[_0x9e2c('0x4c')][_0x9e2c('0x5b')]){_0x54e045[_0x9e2c('0x5c')]=[{'all':!![]}];}return db[_0x9e2c('0x76')][_0x9e2c('0x5d')](_0x54e045);})[_0x9e2c('0x25')](function(_0x5761e9){_0xb9278f[_0x9e2c('0x5e')]=_0x5761e9;return _0xb9278f;});}})[_0x9e2c('0x25')](respondWithFilteredResult(_0x559c5d,_0x54e045))[_0x9e2c('0x1b')](handleError(_0x559c5d,null));};exports[_0x9e2c('0x77')]=function(_0x5da56a,_0x49c98e){return db[_0x9e2c('0x47')]['find']({'where':{'id':_0x5da56a['params']['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x49c98e,null))[_0x9e2c('0x25')](function(_0x1aa043){if(_0x1aa043){return _0x1aa043[_0x9e2c('0x77')](_0x5da56a['query'][_0x9e2c('0x74')]);}})[_0x9e2c('0x25')](respondWithStatusCode(_0x49c98e,null))[_0x9e2c('0x1b')](handleError(_0x49c98e,null));};exports['create']=function(_0x2d37cc,_0x1ee3f8){var _0x1e5d25={'name':_0x2d37cc[_0x9e2c('0x68')]['name'],'key':_0x2d37cc[_0x9e2c('0x68')][_0x9e2c('0x78')],'provider':_0x2d37cc[_0x9e2c('0x68')][_0x9e2c('0x69')]==='custom'?null:_0x2d37cc[_0x9e2c('0x68')][_0x9e2c('0x69')],'email':_0x2d37cc['body'][_0x9e2c('0x79')],'ListId':_0x2d37cc['body'][_0x9e2c('0x7a')],'active':!_[_0x9e2c('0x7b')](_0x2d37cc['body'][_0x9e2c('0x7c')])?_0x2d37cc['body']['active']:!![],'description':_0x2d37cc[_0x9e2c('0x68')]['description']||null};var _0x5d761e=getAuthenticationOptions(_0x1e5d25[_0x9e2c('0x69')],_0x2d37cc[_0x9e2c('0x68')]);_0x1e5d25[_0x9e2c('0x43')]=_0x5d761e[_0x9e2c('0x43')];_0x1e5d25[_0x9e2c('0x44')]=_0x5d761e['Smtp'];return db[_0x9e2c('0x47')][_0x9e2c('0x70')](_0x1e5d25,{'include':[{'model':db[_0x9e2c('0x61')],'as':_0x9e2c('0x44')},{'model':db[_0x9e2c('0x45')],'as':_0x9e2c('0x43')}]})[_0x9e2c('0x25')](function(_0x761338){var _0x4061a8=_0x2d37cc[_0x9e2c('0x38')][_0x9e2c('0x7d')]({'plain':!![]});if(!_0x4061a8)throw new Error(_0x9e2c('0x7e'));if(_0x4061a8[_0x9e2c('0x7f')]===_0x9e2c('0x38')){var _0x1f92d8=_0x761338['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x9e2c('0x27'),'userProfileId':_0x4061a8['userProfileId']},'raw':!![]})[_0x9e2c('0x25')](function(_0x4d82be){if(_0x4d82be&&_0x4d82be[_0x9e2c('0x80')]===0x0){return db['UserProfileResource']['create']({'name':_0x1f92d8[_0x9e2c('0x2a')],'resourceId':_0x1f92d8['id'],'type':_0x4d82be[_0x9e2c('0x2a')],'sectionId':_0x4d82be['id']},{})[_0x9e2c('0x25')](function(){return _0x761338;});}else{return _0x761338;}})[_0x9e2c('0x1b')](function(_0x1691e1){logger[_0x9e2c('0x17')](_0x9e2c('0x81'),_0x1691e1);throw _0x1691e1;});}return _0x761338;})[_0x9e2c('0x25')](respondWithResult(_0x1ee3f8,0xc9))[_0x9e2c('0x1b')](handleError(_0x1ee3f8,null));};exports[_0x9e2c('0x82')]=function(_0xda986b,_0x2d9756){return db[_0x9e2c('0x47')]['findOne']({'where':{'id':_0xda986b['params']['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x2d9756,null))['then'](function(_0x45ad7e){if(_0x45ad7e){return _0x45ad7e['getImap']();}return null;})[_0x9e2c('0x25')](respondWithResult(_0x2d9756,null))[_0x9e2c('0x1b')](handleError(_0x2d9756,null));};exports[_0x9e2c('0x83')]=function(_0x1fa08b,_0x5b7c73){if(_0x1fa08b[_0x9e2c('0x68')]['id']){delete _0x1fa08b['body']['id'];}return db['MailAccount'][_0x9e2c('0x66')]({'where':{'id':_0x1fa08b[_0x9e2c('0x60')]['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x5b7c73,null))[_0x9e2c('0x25')](function(_0x5dec45){if(_0x5dec45){_0x1fa08b['body'][_0x9e2c('0x6e')]=_0x5dec45['id'];return db[_0x9e2c('0x45')][_0x9e2c('0x70')](_0x1fa08b[_0x9e2c('0x68')]);}})[_0x9e2c('0x25')](respondWithResult(_0x5b7c73,null))[_0x9e2c('0x1b')](handleError(_0x5b7c73,null));};exports[_0x9e2c('0x84')]=function(_0x3295f8,_0x3abac9){return db[_0x9e2c('0x47')][_0x9e2c('0x72')]({'where':{'id':_0x3295f8[_0x9e2c('0x60')]['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x3abac9,null))[_0x9e2c('0x25')](function(_0x58c079){if(_0x58c079){return _0x58c079[_0x9e2c('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x3abac9,null))['catch'](handleError(_0x3abac9,null));};exports['getSmtp']=function(_0x185409,_0x15dd6a){return db[_0x9e2c('0x47')][_0x9e2c('0x72')]({'where':{'id':_0x185409[_0x9e2c('0x60')]['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x15dd6a,null))[_0x9e2c('0x25')](function(_0x2a80ef){if(_0x2a80ef){return _0x2a80ef[_0x9e2c('0x86')]();}return null;})[_0x9e2c('0x25')](respondWithResult(_0x15dd6a,null))[_0x9e2c('0x1b')](handleError(_0x15dd6a,null));};exports[_0x9e2c('0x87')]=function(_0x476018,_0x279fe5){if(_0x476018['body']['id']){delete _0x476018[_0x9e2c('0x68')]['id'];}return db[_0x9e2c('0x47')]['find']({'where':{'id':_0x476018[_0x9e2c('0x60')]['id']}})['then'](handleEntityNotFound(_0x279fe5,null))[_0x9e2c('0x25')](function(_0x336e0b){if(_0x336e0b){_0x476018[_0x9e2c('0x68')][_0x9e2c('0x6e')]=_0x336e0b['id'];return db[_0x9e2c('0x61')][_0x9e2c('0x70')](_0x476018[_0x9e2c('0x68')]);}})[_0x9e2c('0x25')](respondWithResult(_0x279fe5,null))['catch'](handleError(_0x279fe5,null));};exports[_0x9e2c('0x88')]=function(_0x53630a,_0xf6d5f4){return db[_0x9e2c('0x47')][_0x9e2c('0x72')]({'where':{'id':_0x53630a[_0x9e2c('0x60')]['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0xf6d5f4,null))['then'](function(_0xf1928e){if(_0xf1928e){return _0xf1928e[_0x9e2c('0x89')](null);}return null;})[_0x9e2c('0x25')](respondWithStatusCode(_0xf6d5f4,null))['catch'](handleError(_0xf6d5f4,null));};exports[_0x9e2c('0x8a')]=function(_0xa1db34,_0x4a6bca){return db[_0x9e2c('0x8b')][_0x9e2c('0x66')]({'where':{'id':_0xa1db34['params']['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x4a6bca,null))[_0x9e2c('0x25')](function(_0x29c327){if(_0x29c327){return _0x29c327[_0x9e2c('0x8a')](_0xa1db34[_0x9e2c('0x68')][_0x9e2c('0x74')],_['omit'](_0xa1db34[_0x9e2c('0x68')],[_0x9e2c('0x74'),'id'])||{});}})[_0x9e2c('0x25')](respondWithResult(_0x4a6bca,null))[_0x9e2c('0x1b')](handleError(_0x4a6bca,null));};exports['getInteractions']=function(_0xb23b3f,_0x282007){var _0x42e5a8={'raw':![],'where':{}};var _0x266ff9={};var _0x4d6168={'count':0x0,'rows':[]};return db['MailAccount'][_0x9e2c('0x72')]({'where':{'id':_0xb23b3f[_0x9e2c('0x60')]['id']}})['then'](handleEntityNotFound(_0x282007,null))[_0x9e2c('0x25')](function(_0x5c04fe){if(_0x5c04fe){_0x266ff9[_0x9e2c('0x4b')]=_['keys'](db[_0x9e2c('0x8b')][_0x9e2c('0x48')]);_0x266ff9[_0x9e2c('0x4c')]=_['keys'](_0xb23b3f[_0x9e2c('0x4c')]);_0x266ff9[_0x9e2c('0x4d')]=_[_0x9e2c('0x4e')](_0x266ff9[_0x9e2c('0x4b')],_0x266ff9[_0x9e2c('0x4c')]);_0x42e5a8['attributes']=_[_0x9e2c('0x4e')](_0x266ff9[_0x9e2c('0x4b')],qs[_0x9e2c('0x50')](_0xb23b3f[_0x9e2c('0x4c')]['fields']));_0x42e5a8[_0x9e2c('0x4f')]=_0x42e5a8['attributes'][_0x9e2c('0x51')]?_0x42e5a8[_0x9e2c('0x4f')]:_0x266ff9[_0x9e2c('0x4b')];if(!_0xb23b3f[_0x9e2c('0x4c')]['hasOwnProperty'](_0x9e2c('0x53'))){_0x42e5a8[_0x9e2c('0x22')]=qs['limit'](_0xb23b3f[_0x9e2c('0x4c')][_0x9e2c('0x22')]);_0x42e5a8[_0x9e2c('0x20')]=qs[_0x9e2c('0x20')](_0xb23b3f[_0x9e2c('0x4c')][_0x9e2c('0x20')]);}_0x42e5a8['order']=qs[_0x9e2c('0x55')](_0xb23b3f[_0x9e2c('0x4c')][_0x9e2c('0x55')]);_0x42e5a8[_0x9e2c('0x56')]=qs['filters'](_[_0x9e2c('0x57')](_0xb23b3f['query'],_0x266ff9['filters']));_0x42e5a8[_0x9e2c('0x56')][_0x9e2c('0x6e')]=_0x5c04fe['id'];if(_0xb23b3f['query']['filter']){_0x42e5a8[_0x9e2c('0x56')]=_[_0x9e2c('0x58')](_0x42e5a8[_0x9e2c('0x56')],{'$or':_[_0x9e2c('0x46')](_0x42e5a8[_0x9e2c('0x4f')],function(_0x41ab43){var _0x488917={};_0x488917[_0x41ab43]={'$like':'%'+_0xb23b3f['query'][_0x9e2c('0x5a')]+'%'};return _0x488917;})});}_0x42e5a8=_['merge']({},_0x42e5a8,_0xb23b3f[_0x9e2c('0x65')]);return db['MailInteraction']['count']({'where':_0x42e5a8['where']})[_0x9e2c('0x25')](function(_0x4d0489){_0x4d6168[_0x9e2c('0x23')]=_0x4d0489;if(_0xb23b3f[_0x9e2c('0x4c')]['includeAll']){_0x42e5a8[_0x9e2c('0x5c')]=[{'model':db[_0x9e2c('0x8c')],'as':_0x9e2c('0x8d'),'required':![]},{'model':db[_0x9e2c('0x8e')],'as':_0x9e2c('0x8f'),'attributes':[_0x9e2c('0x2a'),_0x9e2c('0x90'),'internal'],'required':![]},{'model':db[_0x9e2c('0x91')],'as':_0x9e2c('0x92'),'attributes':['id',_0x9e2c('0x2a'),_0x9e2c('0x93')],'where':_0xb23b3f[_0x9e2c('0x4c')][_0x9e2c('0x94')]?{'id':_0xb23b3f[_0x9e2c('0x4c')]['tag']}:undefined,'required':_0xb23b3f[_0x9e2c('0x4c')][_0x9e2c('0x94')]?!![]:![]}];}return db[_0x9e2c('0x8b')][_0x9e2c('0x5d')](_0x42e5a8);})['then'](function(_0x425f1d){_0x4d6168['rows']=_0x425f1d;return _0x4d6168;});}})[_0x9e2c('0x25')](respondWithFilteredResult(_0x282007,_0x42e5a8))[_0x9e2c('0x1b')](handleError(_0x282007,null));};exports[_0x9e2c('0x95')]=function addApplications(_0x3bd498,_0x4909da){var _0x2f9c6d=_0x3bd498['params']['id'];var _0x12786f=_0x3bd498[_0x9e2c('0x68')];var _0x48bf81=0xc8;var _0x4ef4c8=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x9e2c('0x96')][_0x9e2c('0x97')][_0x9e2c('0x98')]},function(_0x5ce61b){return db[_0x9e2c('0x47')]['findOne']({'where':{'id':_0x2f9c6d},'transaction':_0x5ce61b})['then'](function(_0x5d203a){if(_0x5d203a){return db[_0x9e2c('0x99')][_0x9e2c('0x26')]({'where':{'MailAccountId':_0x2f9c6d},'transaction':_0x5ce61b})['then'](function(){var _0x2ac164=_[_0x9e2c('0x46')](_0x12786f,function(_0x43595e){_0x43595e[_0x9e2c('0x6e')]=_0x2f9c6d;return _0x43595e;});return db['MailApplication'][_0x9e2c('0x9a')](_0x2ac164,{'transaction':_0x5ce61b});});}else{_0x48bf81=0x194;_0x4ef4c8=[];}});})[_0x9e2c('0x25')](function(){if(_0x48bf81!==0x194){return db[_0x9e2c('0x99')][_0x9e2c('0x9b')]({'where':{'MailAccountId':_0x2f9c6d},'order':_0x9e2c('0x9c')})['then'](function(_0x4a0329){_0x4ef4c8=_0x4a0329;});}})[_0x9e2c('0x1b')](function(_0x34737d){_0x48bf81=0x1f4;logger[_0x9e2c('0x17')](_0x34737d[_0x9e2c('0x29')]);if(_0x34737d['name']){delete _0x34737d[_0x9e2c('0x2a')];}_0x4ef4c8=_0x34737d;})[_0x9e2c('0x9d')](function(){if(_0x4ef4c8===null){_0x4909da['sendStatus'](_0x48bf81);}else{if(_0x48bf81===0x1f4){_0x4909da[_0x9e2c('0x1d')](_0x48bf81)['send'](_0x4ef4c8);}else{_0x4909da['status'](_0x48bf81)[_0x9e2c('0x1f')](_0x4ef4c8);}}});};exports[_0x9e2c('0x9e')]=function(_0x4e23dc,_0x4a80e7){var _0x47ff48={};var _0x41ced0={};var _0x548450;var _0x10b7de;return db[_0x9e2c('0x47')]['findOne']({'where':{'id':_0x4e23dc[_0x9e2c('0x60')]['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x4a80e7,null))['then'](function(_0x335100){if(_0x335100){_0x548450=_0x335100;_0x41ced0['model']=_['keys'](db[_0x9e2c('0x99')][_0x9e2c('0x48')]);_0x41ced0[_0x9e2c('0x4c')]=_[_0x9e2c('0x64')](_0x4e23dc[_0x9e2c('0x4c')]);_0x41ced0[_0x9e2c('0x4d')]=_['intersection'](_0x41ced0['model'],_0x41ced0[_0x9e2c('0x4c')]);_0x47ff48['attributes']=_[_0x9e2c('0x4e')](_0x41ced0[_0x9e2c('0x4b')],qs[_0x9e2c('0x50')](_0x4e23dc['query'][_0x9e2c('0x50')]));_0x47ff48[_0x9e2c('0x4f')]=_0x47ff48[_0x9e2c('0x4f')][_0x9e2c('0x51')]?_0x47ff48['attributes']:_0x41ced0[_0x9e2c('0x4b')];_0x47ff48[_0x9e2c('0x54')]=qs[_0x9e2c('0x55')](_0x4e23dc[_0x9e2c('0x4c')]['sort']);_0x47ff48[_0x9e2c('0x56')]=qs[_0x9e2c('0x4d')](_['pick'](_0x4e23dc[_0x9e2c('0x4c')],_0x41ced0['filters']));if(_0x4e23dc['query']['filter']){_0x47ff48['where']=_[_0x9e2c('0x58')](_0x47ff48[_0x9e2c('0x56')],{'$or':_[_0x9e2c('0x46')](_0x47ff48[_0x9e2c('0x4f')],function(_0xa99b7){var _0x244808={};_0x244808[_0xa99b7]={'$like':'%'+_0x4e23dc['query']['filter']+'%'};return _0x244808;})});}_0x47ff48=_[_0x9e2c('0x58')]({},_0x47ff48,_0x4e23dc[_0x9e2c('0x65')]);return _0x548450[_0x9e2c('0x9e')](_0x47ff48);}})[_0x9e2c('0x25')](function(_0x347107){if(_0x347107){_0x10b7de=_0x347107[_0x9e2c('0x51')];if(!_0x4e23dc[_0x9e2c('0x4c')][_0x9e2c('0x52')]('nolimit')){_0x47ff48['limit']=qs[_0x9e2c('0x22')](_0x4e23dc[_0x9e2c('0x4c')][_0x9e2c('0x22')]);_0x47ff48[_0x9e2c('0x20')]=qs[_0x9e2c('0x20')](_0x4e23dc[_0x9e2c('0x4c')]['offset']);}return _0x548450['getApplications'](_0x47ff48);}})[_0x9e2c('0x25')](function(_0x15d68c){if(_0x15d68c){return _0x15d68c?{'count':_0x10b7de,'rows':_0x15d68c}:null;}})['then'](respondWithResult(_0x4a80e7,null))[_0x9e2c('0x1b')](handleError(_0x4a80e7,null));};exports['getMessages']=function(_0x348a0d,_0x5e2229){var _0x24fa0e={'raw':!![],'where':{}};var _0x1a4a20={};var _0x554d45={'count':0x0,'rows':[]};return db[_0x9e2c('0x47')][_0x9e2c('0x72')]({'where':{'id':_0x348a0d[_0x9e2c('0x60')]['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x5e2229,null))[_0x9e2c('0x25')](function(_0x145386){if(_0x145386){_0x1a4a20['model']=_[_0x9e2c('0x64')](db[_0x9e2c('0x9f')][_0x9e2c('0x48')]);_0x1a4a20['query']=_[_0x9e2c('0x64')](_0x348a0d[_0x9e2c('0x4c')]);_0x1a4a20['filters']=_['intersection'](_0x1a4a20['model'],_0x1a4a20[_0x9e2c('0x4c')]);_0x24fa0e['attributes']=_[_0x9e2c('0x4e')](_0x1a4a20[_0x9e2c('0x4b')],qs[_0x9e2c('0x50')](_0x348a0d[_0x9e2c('0x4c')][_0x9e2c('0x50')]));_0x24fa0e[_0x9e2c('0x4f')]=_0x24fa0e[_0x9e2c('0x4f')][_0x9e2c('0x51')]?_0x24fa0e[_0x9e2c('0x4f')]:_0x1a4a20[_0x9e2c('0x4b')];if(!_0x348a0d[_0x9e2c('0x4c')][_0x9e2c('0x52')](_0x9e2c('0x53'))){_0x24fa0e[_0x9e2c('0x22')]=qs[_0x9e2c('0x22')](_0x348a0d[_0x9e2c('0x4c')]['limit']);_0x24fa0e[_0x9e2c('0x20')]=qs[_0x9e2c('0x20')](_0x348a0d['query'][_0x9e2c('0x20')]);}_0x24fa0e[_0x9e2c('0x54')]=qs['sort'](_0x348a0d[_0x9e2c('0x4c')]['sort']);_0x24fa0e[_0x9e2c('0x56')]=qs[_0x9e2c('0x4d')](_[_0x9e2c('0x57')](_0x348a0d[_0x9e2c('0x4c')],_0x1a4a20[_0x9e2c('0x4d')]));_0x24fa0e[_0x9e2c('0x56')][_0x9e2c('0x6e')]=_0x145386['id'];if(_0x348a0d[_0x9e2c('0x4c')][_0x9e2c('0x5a')]){_0x24fa0e['where']=_[_0x9e2c('0x58')](_0x24fa0e[_0x9e2c('0x56')],{'$or':_[_0x9e2c('0x46')](_0x24fa0e[_0x9e2c('0x4f')],function(_0x85e77){var _0x3ed490={};_0x3ed490[_0x85e77]={'$like':'%'+_0x348a0d[_0x9e2c('0x4c')][_0x9e2c('0x5a')]+'%'};return _0x3ed490;})});}if(_0x348a0d['query'][_0x9e2c('0xa0')]){var _0x3453f3=_0x348a0d[_0x9e2c('0x4c')][_0x9e2c('0xa0')]['split'](',');var _0x1c937e={};_0x1c937e[_0x3453f3[0x0]]={'$gte':moment(_0x3453f3[0x1])[_0x9e2c('0xa1')](_0x9e2c('0xa2'))};_0x24fa0e[_0x9e2c('0x56')]=_[_0x9e2c('0x58')](_0x24fa0e['where'],_0x1c937e);}_0x24fa0e=_[_0x9e2c('0x58')]({},_0x24fa0e,_0x348a0d[_0x9e2c('0x65')]);return db[_0x9e2c('0x9f')][_0x9e2c('0x23')]({'where':_0x24fa0e[_0x9e2c('0x56')]})[_0x9e2c('0x25')](function(_0xbdb375){_0x554d45[_0x9e2c('0x23')]=_0xbdb375;if(_0x348a0d[_0x9e2c('0x4c')][_0x9e2c('0x5b')]){_0x24fa0e[_0x9e2c('0x5c')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x24fa0e);})[_0x9e2c('0x25')](function(_0x54100b){if(_0x348a0d[_0x9e2c('0x4c')]['inlineCss']===_0x9e2c('0xa3')){for(var _0x12d924=0x0;_0x12d924<_0x54100b[_0x9e2c('0x51')];_0x12d924++){_0x54100b[_0x12d924][_0x9e2c('0x68')]=juice(_0x54100b[_0x12d924]['body']);}}_0x554d45[_0x9e2c('0x5e')]=_0x54100b;return _0x554d45;});}})[_0x9e2c('0x25')](respondWithFilteredResult(_0x5e2229,_0x24fa0e))['catch'](handleError(_0x5e2229,null));};exports[_0x9e2c('0x2b')]=function(_0x336c0f,_0x325606){var _0xb68be1,_0x40f2ac={},_0x53c933;if(_0x336c0f[_0x9e2c('0x68')]['to']){_0x53c933=_0x336c0f[_0x9e2c('0x68')]['to'][_0x9e2c('0xa4')](',')[0x0];}return db[_0x9e2c('0x47')][_0x9e2c('0x66')]({'where':{'id':_0x336c0f[_0x9e2c('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0x9e2c('0xa5'),'include':[{'model':db[_0x9e2c('0x8c')],'as':_0x9e2c('0xa6'),'where':{'email':_0x53c933},'limit':0x1,'order':[[_0x9e2c('0xa7'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x9e2c('0x44'),'raw':!![],'include':[{'model':db[_0x9e2c('0xa8')],'as':_0x9e2c('0xa8'),'raw':!![]}]}]})[_0x9e2c('0x25')](handleEntityNotFound(_0x325606,null))[_0x9e2c('0x25')](function(_0xd01645){if(!_0xd01645)return;_0xb68be1=_0xd01645;if(!_0xd01645[_0x9e2c('0x44')])throw new Error(_0x9e2c('0xa9'));if(_['isNil'](_0x336c0f[_0x9e2c('0x68')][_0x9e2c('0xaa')])){_0x336c0f[_0x9e2c('0x68')][_0x9e2c('0xaa')]=util[_0x9e2c('0xa1')](_0x9e2c('0xab'),_0xd01645[_0x9e2c('0x2a')],_0xd01645[_0x9e2c('0x79')]||_0xd01645['Smtp']['user']);}if(_0x336c0f[_0x9e2c('0x68')][_0x9e2c('0xac')]&&_0x336c0f['body'][_0x9e2c('0xac')][_0x9e2c('0x51')]){for(var _0x31dc35=0x0;_0x31dc35<_0x336c0f[_0x9e2c('0x68')]['attachments'][_0x9e2c('0x51')];_0x31dc35+=0x1){_0x336c0f['body']['attachments'][_0x31dc35]={'filename':_0x336c0f[_0x9e2c('0x68')][_0x9e2c('0xac')][_0x31dc35][_0x9e2c('0x2a')],'path':path[_0x9e2c('0xad')](config[_0x9e2c('0xae')],_0x9e2c('0xaf'),_0x336c0f[_0x9e2c('0x68')][_0x9e2c('0xac')][_0x31dc35][_0x9e2c('0xb0')])};}}var _0x3f56fd=_0xd01645[_0x9e2c('0xb1')]();return respondWithRpcPromise('SendMail',_0x9e2c('0xb2'),{'account':_0x3f56fd,'message':_0x336c0f['body']});})['then'](function(_0x2dd956){if(!_0x2dd956)return;_0x40f2ac=_0x2dd956;if(!_0xb68be1[_0x9e2c('0xa5')])throw new Error(_0x9e2c('0xb3'));if(_0xb68be1[_0x9e2c('0xa5')][_0x9e2c('0xa6')]['length'])return _0xb68be1[_0x9e2c('0xa5')][_0x9e2c('0xa6')][0x0];return db['CmContact'][_0x9e2c('0x70')](_[_0x9e2c('0xb4')](_0x336c0f[_0x9e2c('0x68')],{'firstName':_0x336c0f[_0x9e2c('0x68')]['to'],'email':_0x336c0f[_0x9e2c('0x68')]['to'],'phone':_0x336c0f[_0x9e2c('0x68')]['to'],'ListId':_0xb68be1[_0x9e2c('0x7a')]}));})[_0x9e2c('0x25')](function(_0x19d3a8){if(!_0x19d3a8)return;var _0x3d8236={'UserId':_0x336c0f[_0x9e2c('0x38')]['id'],'ContactId':_0x19d3a8['id'],'MailAccountId':_0xb68be1['id'],'inReplyTo':_0x40f2ac['messageId'],'to':_0x336c0f[_0x9e2c('0x68')][_0x9e2c('0xaa')],'cc':_0x336c0f[_0x9e2c('0x68')]['cc'],'subject':_0x336c0f[_0x9e2c('0x68')][_0x9e2c('0xb5')],'attach':_0x336c0f[_0x9e2c('0x68')][_0x9e2c('0xb6')],'firstMsgDirection':_0x9e2c('0xb7'),'lastMsgAt':moment()[_0x9e2c('0xa1')](_0x9e2c('0xa2')),'lastMsgDirection':_0x9e2c('0xb7'),'Messages':[_[_0x9e2c('0x58')](_0x336c0f[_0x9e2c('0x68')],{'messageId':_0x40f2ac[_0x9e2c('0xb8')],'sentAt':moment()[_0x9e2c('0xa1')](_0x9e2c('0xa2')),'read':!![],'MailAccountId':_0xb68be1['id'],'UserId':_0x336c0f['user']['id'],'ContactId':_0x19d3a8['id']})]};if(_0x336c0f[_0x9e2c('0x68')]['Interaction']){_0x3d8236=_[_0x9e2c('0x58')](_0x3d8236,_0x336c0f['body'][_0x9e2c('0xb9')]);}return db[_0x9e2c('0x8b')][_0x9e2c('0x70')](_0x3d8236,{'include':[{'model':db[_0x9e2c('0x9f')],'as':_0x9e2c('0xba')}]});})[_0x9e2c('0x25')](respondWithResult(_0x325606,null))[_0x9e2c('0x1b')](handleError(_0x325606,null));};exports[_0x9e2c('0xbb')]=function(_0x29cb76,_0x1f1690){return db[_0x9e2c('0x47')][_0x9e2c('0x66')]({'where':{'id':_0x29cb76['params']['id']},'include':[{'model':db[_0x9e2c('0x61')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x9e2c('0xa8'),'raw':!![]}]}]})[_0x9e2c('0x25')](handleEntityNotFound(_0x1f1690,null))[_0x9e2c('0x25')](function(_0x31e86b){if(!_0x31e86b['Smtp'])return;var _0x160c89=_0x31e86b[_0x9e2c('0xb1')]();return respondWithRpcPromise(_0x9e2c('0xbc'),_0x9e2c('0xbb'),{'account':_0x160c89});})[_0x9e2c('0x25')](respondWithResult(_0x1f1690,null))[_0x9e2c('0x1b')](handleError(_0x1f1690,null));};exports[_0x9e2c('0x26')]=function(_0x5142d9,_0x30b5a){return db[_0x9e2c('0x47')][_0x9e2c('0x66')]({'where':{'id':_0x5142d9[_0x9e2c('0x60')]['id']}})['then'](handleEntityNotFound(_0x30b5a,null))[_0x9e2c('0x25')](function(_0x541bad){if(_0x541bad&&_0x541bad['service']){throw new db[(_0x9e2c('0xbd'))]['ValidationError'](_0x9e2c('0xbe'));}return _0x541bad;})[_0x9e2c('0x25')](removeEntity(_0x30b5a,null))[_0x9e2c('0x1b')](handleError(_0x30b5a,null));};exports['addAgents']=function(_0x8b833c,_0x8df98f){return db['MailAccount'][_0x9e2c('0x66')]({'where':{'id':_0x8b833c['params']['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x8df98f,null))[_0x9e2c('0x25')](function(_0x3d54b4){if(_0x3d54b4){return _0x3d54b4[_0x9e2c('0xbf')](_0x8b833c[_0x9e2c('0x68')][_0x9e2c('0x74')],_['omit'](_0x8b833c[_0x9e2c('0x68')],[_0x9e2c('0x74'),'id'])||{})['spread'](function(_0x534756){for(var _0x383269=0x0;_0x383269<_0x8b833c[_0x9e2c('0x68')][_0x9e2c('0x74')]['length'];_0x383269+=0x1){socket[_0x9e2c('0xc0')](_0x9e2c('0xc1'),{'UserId':Number(_0x8b833c['body']['ids'][_0x383269]),'MailAccountId':Number(_0x8b833c[_0x9e2c('0x60')]['id'])});}return _0x534756;});}})[_0x9e2c('0x25')](respondWithResult(_0x8df98f,null))[_0x9e2c('0x1b')](handleError(_0x8df98f,null));};exports[_0x9e2c('0xc2')]=function(_0x352f9d,_0x2cb149){return db[_0x9e2c('0x47')]['find']({'where':{'id':_0x352f9d[_0x9e2c('0x60')]['id']}})['then'](handleEntityNotFound(_0x2cb149,null))[_0x9e2c('0x25')](function(_0x196edb){if(_0x196edb){return _0x196edb[_0x9e2c('0xc2')](_0x352f9d[_0x9e2c('0x4c')][_0x9e2c('0x74')])['then'](function(){if(_[_0x9e2c('0xc3')](_0x352f9d['query']['ids'])){for(var _0x275445=0x0;_0x275445<_0x352f9d[_0x9e2c('0x4c')][_0x9e2c('0x74')]['length'];_0x275445+=0x1){socket['emit'](_0x9e2c('0xc4'),{'UserId':Number(_0x352f9d[_0x9e2c('0x4c')][_0x9e2c('0x74')][_0x275445]),'MailAccountId':Number(_0x352f9d[_0x9e2c('0x60')]['id'])});}}else{socket['emit'](_0x9e2c('0xc4'),{'UserId':Number(_0x352f9d[_0x9e2c('0x4c')]['ids']),'MailAccountId':Number(_0x352f9d[_0x9e2c('0x60')]['id'])});}});}})[_0x9e2c('0x25')](respondWithStatusCode(_0x2cb149,null))[_0x9e2c('0x1b')](handleError(_0x2cb149,null));};exports[_0x9e2c('0xc5')]=function(_0x2bbcaa,_0x334c4e){var _0x30f1e5={};var _0x5d24e6={};var _0x1eae86;var _0x5145cd;return db[_0x9e2c('0x47')][_0x9e2c('0x72')]({'where':{'id':_0x2bbcaa[_0x9e2c('0x60')]['id']}})[_0x9e2c('0x25')](handleEntityNotFound(_0x334c4e,null))['then'](function(_0x115b82){if(_0x115b82){_0x1eae86=_0x115b82;_0x5d24e6[_0x9e2c('0x4b')]=_[_0x9e2c('0x64')](db[_0x9e2c('0x8e')]['rawAttributes']);_0x5d24e6[_0x9e2c('0x4c')]=_[_0x9e2c('0x64')](_0x2bbcaa[_0x9e2c('0x4c')]);_0x5d24e6[_0x9e2c('0x4d')]=_[_0x9e2c('0x4e')](_0x5d24e6[_0x9e2c('0x4b')],_0x5d24e6[_0x9e2c('0x4c')]);_0x30f1e5[_0x9e2c('0x4f')]=_[_0x9e2c('0x4e')](_0x5d24e6[_0x9e2c('0x4b')],qs[_0x9e2c('0x50')](_0x2bbcaa[_0x9e2c('0x4c')]['fields']));_0x30f1e5['attributes']=_0x30f1e5[_0x9e2c('0x4f')][_0x9e2c('0x51')]?_0x30f1e5[_0x9e2c('0x4f')]:_0x5d24e6['model'];_0x30f1e5[_0x9e2c('0x54')]=qs[_0x9e2c('0x55')](_0x2bbcaa['query'][_0x9e2c('0x55')]);_0x30f1e5[_0x9e2c('0x56')]=qs[_0x9e2c('0x4d')](_[_0x9e2c('0x57')](_0x2bbcaa[_0x9e2c('0x4c')],_0x5d24e6[_0x9e2c('0x4d')]));if(_0x2bbcaa[_0x9e2c('0x4c')]['filter']){_0x30f1e5[_0x9e2c('0x56')]=_[_0x9e2c('0x58')](_0x30f1e5[_0x9e2c('0x56')],{'$or':_[_0x9e2c('0x46')](_0x30f1e5[_0x9e2c('0x4f')],function(_0x157ea4){var _0x3ec554={};_0x3ec554[_0x157ea4]={'$like':'%'+_0x2bbcaa[_0x9e2c('0x4c')][_0x9e2c('0x5a')]+'%'};return _0x3ec554;})});}_0x30f1e5=_[_0x9e2c('0x58')]({},_0x30f1e5,_0x2bbcaa[_0x9e2c('0x65')]);return _0x1eae86[_0x9e2c('0xc5')](_0x30f1e5);}})[_0x9e2c('0x25')](function(_0x1cb919){if(_0x1cb919){_0x5145cd=_0x1cb919[_0x9e2c('0x51')];if(!_0x2bbcaa['query'][_0x9e2c('0x52')](_0x9e2c('0x53'))){_0x30f1e5[_0x9e2c('0x22')]=qs['limit'](_0x2bbcaa[_0x9e2c('0x4c')][_0x9e2c('0x22')]);_0x30f1e5['offset']=qs[_0x9e2c('0x20')](_0x2bbcaa[_0x9e2c('0x4c')][_0x9e2c('0x20')]);}return _0x1eae86[_0x9e2c('0xc5')](_0x30f1e5);}})[_0x9e2c('0x25')](function(_0x1aff4b){if(_0x1aff4b){return _0x1aff4b?{'count':_0x5145cd,'rows':_0x1aff4b}:null;}})[_0x9e2c('0x25')](respondWithResult(_0x334c4e,null))[_0x9e2c('0x1b')](handleError(_0x334c4e,null));}; \ No newline at end of file +var _0x51b1=['lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./mailAccount.socket','register','jayson/promise','client','http','request','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','MailAccounts','then','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','Smtp','index','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','MailServerIn','MailServerOut','find','catch','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','findOne','order','removeDispositions','ids','CannedAnswer','create','getAnswers','removeAnswers','custom','email','ListId','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','Transaction','MailApplication','bulkCreate','finally','sendStatus','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','basename','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path'];(function(_0x360949,_0x41ac33){var _0x197a7f=function(_0x4029f7){while(--_0x4029f7){_0x360949['push'](_0x360949['shift']());}};_0x197a7f(++_0x41ac33);}(_0x51b1,0xc6));var _0x151b=function(_0x8cd627,_0x1bf5ca){_0x8cd627=_0x8cd627-0x0;var _0x7e454=_0x51b1[_0x8cd627];return _0x7e454;};'use strict';var moment=require('moment');var BPromise=require(_0x151b('0x0'));var util=require(_0x151b('0x1'));var path=require(_0x151b('0x2'));var _=require(_0x151b('0x3'));var juice=require(_0x151b('0x4'));var Redis=require(_0x151b('0x5'));var qs=require(_0x151b('0x6'));var logger=require(_0x151b('0x7'))(_0x151b('0x8'));var config=require(_0x151b('0x9'));var db=require(_0x151b('0xa'))['db'];config[_0x151b('0xb')]=_[_0x151b('0xc')](config[_0x151b('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x151b('0xd'))[_0x151b('0xe')](socket);var jayson=require(_0x151b('0xf'));var client=jayson[_0x151b('0x10')][_0x151b('0x11')]({'port':0x232b});function respondWithRpcPromise(_0xb3652f,_0x522d47,_0x10f3c1,_0x1df128){return new BPromise(function(_0x498094,_0x40f6b3){var _0xe63231=_0x1df128||client;return _0xe63231[_0x151b('0x12')](_0xb3652f,_0x10f3c1)['then'](function(_0x3fbe9d){logger['info'](_0x151b('0x13'),_0x522d47,'request\x20sent');logger[_0x151b('0x14')](_0x151b('0x15'),_0x522d47,'request\x20sent',JSON[_0x151b('0x16')](_0x3fbe9d));if(_0x3fbe9d[_0x151b('0x17')]){if(_0x3fbe9d[_0x151b('0x17')][_0x151b('0x18')]===0x1f4){logger['error'](_0x151b('0x13'),_0x522d47,_0x3fbe9d[_0x151b('0x17')][_0x151b('0x19')]);return _0x40f6b3(_0x3fbe9d[_0x151b('0x17')]['message']);}logger[_0x151b('0x17')](_0x151b('0x13'),_0x522d47,_0x3fbe9d[_0x151b('0x17')]['message']);return _0x498094(_0x3fbe9d[_0x151b('0x17')][_0x151b('0x19')]);}else{logger[_0x151b('0x1a')](_0x151b('0x13'),_0x522d47,'request\x20sent');_0x498094(_0x3fbe9d['result']['message']);}})['catch'](function(_0x5680d5){logger[_0x151b('0x17')](_0x151b('0x13'),_0x522d47,_0x5680d5);_0x40f6b3(_0x5680d5);});});}function respondWithStatusCode(_0x3193f8,_0x464309){_0x464309=_0x464309||0xcc;return function(_0x5d073b){if(_0x5d073b){return _0x3193f8['sendStatus'](_0x464309);}return _0x3193f8[_0x151b('0x1b')](_0x464309)[_0x151b('0x1c')]();};}function respondWithResult(_0x9fbe9b,_0x2fcca6){_0x2fcca6=_0x2fcca6||0xc8;return function(_0x25c89a){if(_0x25c89a){return _0x9fbe9b['status'](_0x2fcca6)[_0x151b('0x1d')](_0x25c89a);}};}function respondWithFilteredResult(_0x389928,_0x219150){return function(_0x2a8252){if(_0x2a8252){var _0x26411d=typeof _0x219150[_0x151b('0x1e')]===_0x151b('0x1f')&&typeof _0x219150[_0x151b('0x20')]===_0x151b('0x1f');var _0x4a1cfc=_0x2a8252[_0x151b('0x21')];var _0x5b6060=_0x26411d?0x0:_0x219150[_0x151b('0x1e')];var _0x173e3b=_0x26411d?_0x2a8252[_0x151b('0x21')]:_0x219150['offset']+_0x219150[_0x151b('0x20')];var _0x37272d;if(_0x173e3b>=_0x4a1cfc){_0x173e3b=_0x4a1cfc;_0x37272d=0xc8;}else{_0x37272d=0xce;}_0x389928[_0x151b('0x1b')](_0x37272d);return _0x389928[_0x151b('0x22')](_0x151b('0x23'),_0x5b6060+'-'+_0x173e3b+'/'+_0x4a1cfc)[_0x151b('0x1d')](_0x2a8252);}return null;};}function saveUpdates(_0x42843d){return function(_0x1cea63){if(_0x1cea63){return _0x1cea63[_0x151b('0x24')](_0x42843d)['then'](function(_0x1dfad4){return _0x1dfad4;});}return null;};}function removeEntity(_0x9ce1fc){return function(_0x5410aa){if(_0x5410aa){return _0x5410aa[_0x151b('0x25')]()['then'](function(){var _0x1ac344=_0x5410aa[_0x151b('0x26')]({'plain':!![]});var _0x13e3cf=_0x151b('0x27');return db['UserProfileResource'][_0x151b('0x25')]({'where':{'type':_0x13e3cf,'resourceId':_0x1ac344['id']}})[_0x151b('0x28')](function(){return _0x5410aa;});})['then'](function(){_0x9ce1fc[_0x151b('0x1b')](0xcc)[_0x151b('0x1c')]();});}};}function handleEntityNotFound(_0x2310f4){return function(_0x1061a6){if(!_0x1061a6){_0x2310f4['sendStatus'](0x194);}return _0x1061a6;};}function handleError(_0x213fb6,_0x247a72){_0x247a72=_0x247a72||0x1f4;return function(_0x556ab9){logger[_0x151b('0x17')](_0x556ab9['stack']);if(_0x556ab9[_0x151b('0x29')]){delete _0x556ab9['name'];}_0x213fb6[_0x151b('0x1b')](_0x247a72)[_0x151b('0x2a')](_0x556ab9);};}function getImapHost(_0x37186f){switch(_0x37186f){case _0x151b('0x2b'):return _0x151b('0x2c');case _0x151b('0x2d'):return _0x151b('0x2e');case _0x151b('0x2f'):return _0x151b('0x30');case _0x151b('0x31'):return _0x151b('0x32');}throw new Error(_0x151b('0x33'),_0x37186f);}function getSmtpHost(_0x493f6c){switch(_0x493f6c){case _0x151b('0x2b'):return'smtp.gmail.com';case _0x151b('0x2d'):return _0x151b('0x34');case _0x151b('0x2f'):return _0x151b('0x35');case _0x151b('0x31'):return _0x151b('0x36');}throw new Error(_0x151b('0x33'),_0x493f6c);}function getAuthenticationOptions(_0x51946e,_0xdf21ef){var _0x29010b={};var _0x26bd7e={};if(_0x51946e){_0x29010b[_0x151b('0x37')]=_0x26bd7e[_0x151b('0x37')]=_0xdf21ef['username'];_0x29010b[_0x151b('0x38')]=_0x26bd7e[_0x151b('0x39')]=_0xdf21ef['password'];if(_0xdf21ef['modernAuthentication']){_0x29010b[_0x151b('0x3a')]=_0x26bd7e[_0x151b('0x3a')]=!![];_0x29010b[_0x151b('0x3b')]=_0x26bd7e[_0x151b('0x3b')]=_0xdf21ef[_0x151b('0x3b')];_0x29010b[_0x151b('0x38')]=_0x26bd7e[_0x151b('0x39')]=null;}else{_0x29010b[_0x151b('0x3b')]=_0x26bd7e[_0x151b('0x3b')]=null;}_0x29010b[_0x151b('0x3c')]=getImapHost(_0x51946e);_0x29010b[_0x151b('0x3d')]=0x3e1;_0x26bd7e[_0x151b('0x3c')]=getSmtpHost(_0x51946e);_0x26bd7e[_0x151b('0x3d')]=0x24b;_0x26bd7e[_0x151b('0x3e')]=![];_0x29010b[_0x151b('0x3f')]=_0x26bd7e[_0x151b('0x3f')]=null;}else{if(_0xdf21ef[_0x151b('0x40')]){_0x29010b['user']=_0x26bd7e['user']=_0xdf21ef[_0x151b('0x41')];_0x29010b[_0x151b('0x38')]=_0x26bd7e[_0x151b('0x39')]=_0xdf21ef[_0x151b('0x38')];}else{_0x29010b[_0x151b('0x40')]=_0x26bd7e[_0x151b('0x40')]=![];_0x29010b['user']=_0x26bd7e[_0x151b('0x37')]=null;_0x29010b[_0x151b('0x38')]=_0x26bd7e['pass']=null;}_0x29010b[_0x151b('0x3c')]=_0xdf21ef[_0x151b('0x42')][_0x151b('0x3c')];_0x29010b[_0x151b('0x3d')]=_0xdf21ef[_0x151b('0x42')][_0x151b('0x3d')];_0x26bd7e['host']=_0xdf21ef[_0x151b('0x43')][_0x151b('0x3c')];_0x26bd7e[_0x151b('0x3d')]=_0xdf21ef[_0x151b('0x43')][_0x151b('0x3d')];}return{'Imap':_0x29010b,'Smtp':_0x26bd7e};}exports[_0x151b('0x44')]=function(_0x2b75e1,_0xd95dda){var _0x23ed70={'include':[{'model':db['MailServerIn'],'as':_0x151b('0x42')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x151b('0x45')],'as':_0x151b('0x46')}]},_0x1cf4e1={},_0x50d24b={'count':0x0,'rows':[]};var _0xcf6854=_[_0x151b('0x47')](db[_0x151b('0x48')][_0x151b('0x49')],function(_0x52d763){return{'name':_0x52d763['fieldName'],'type':_0x52d763[_0x151b('0x4a')][_0x151b('0x4b')]};});_0x1cf4e1[_0x151b('0x4c')]=_[_0x151b('0x47')](_0xcf6854,_0x151b('0x29'));_0x1cf4e1[_0x151b('0x4d')]=_[_0x151b('0x4e')](_0x2b75e1['query']);_0x1cf4e1[_0x151b('0x4f')]=_[_0x151b('0x50')](_0x1cf4e1['model'],_0x1cf4e1[_0x151b('0x4d')]);_0x23ed70[_0x151b('0x51')]=_[_0x151b('0x50')](_0x1cf4e1['model'],qs[_0x151b('0x52')](_0x2b75e1[_0x151b('0x4d')]['fields']));_0x23ed70['attributes']=_0x23ed70['attributes'][_0x151b('0x53')]?_0x23ed70['attributes']:_0x1cf4e1['model'];if(!_0x2b75e1['query'][_0x151b('0x54')](_0x151b('0x55'))){_0x23ed70['limit']=qs[_0x151b('0x20')](_0x2b75e1['query'][_0x151b('0x20')]);_0x23ed70[_0x151b('0x1e')]=qs['offset'](_0x2b75e1[_0x151b('0x4d')][_0x151b('0x1e')]);}_0x23ed70['order']=qs[_0x151b('0x56')](_0x2b75e1['query'][_0x151b('0x56')]);_0x23ed70['where']=qs[_0x151b('0x4f')](_[_0x151b('0x57')](_0x2b75e1[_0x151b('0x4d')],_0x1cf4e1[_0x151b('0x4f')]),_0xcf6854);if(_0x2b75e1[_0x151b('0x4d')][_0x151b('0x58')]){_0x23ed70[_0x151b('0x59')]=_['merge'](_0x23ed70['where'],{'$or':_[_0x151b('0x47')](_0xcf6854,function(_0x19b8b5){if(_0x19b8b5[_0x151b('0x4a')]!==_0x151b('0x5a')){var _0x2af767={};_0x2af767[_0x19b8b5['name']]={'$like':'%'+_0x2b75e1[_0x151b('0x4d')][_0x151b('0x58')]+'%'};return _0x2af767;}})});}_0x23ed70=_[_0x151b('0x5b')]({},_0x23ed70,_0x2b75e1[_0x151b('0x5c')]);var _0xc2effb={'where':_0x23ed70['where']};return db[_0x151b('0x48')][_0x151b('0x21')](_0xc2effb)[_0x151b('0x28')](function(_0x550168){_0x50d24b[_0x151b('0x21')]=_0x550168;if(_0x2b75e1[_0x151b('0x4d')][_0x151b('0x5d')]){_0x23ed70[_0x151b('0x5e')]=[{'all':!![]}];}return db[_0x151b('0x48')][_0x151b('0x5f')](_0x23ed70);})[_0x151b('0x28')](function(_0x4f0a95){_0x50d24b[_0x151b('0x60')]=_0x4f0a95;return _0x50d24b;})[_0x151b('0x28')](respondWithFilteredResult(_0xd95dda,_0x23ed70))['catch'](handleError(_0xd95dda,null));};exports[_0x151b('0x61')]=function(_0x2c88f3,_0x1fd192){var _0x2589ce={'raw':![],'where':{'id':_0x2c88f3[_0x151b('0x62')]['id']},'include':[{'model':db[_0x151b('0x63')],'as':_0x151b('0x42')},{'model':db[_0x151b('0x64')],'as':'Smtp'},{'model':db[_0x151b('0x45')],'as':_0x151b('0x46')}]},_0x5124e6={};_0x5124e6[_0x151b('0x4c')]=_['keys'](db[_0x151b('0x48')][_0x151b('0x49')]);_0x5124e6[_0x151b('0x4d')]=_[_0x151b('0x4e')](_0x2c88f3[_0x151b('0x4d')]);_0x5124e6[_0x151b('0x4f')]=_[_0x151b('0x50')](_0x5124e6[_0x151b('0x4c')],_0x5124e6[_0x151b('0x4d')]);_0x2589ce[_0x151b('0x51')]=_[_0x151b('0x50')](_0x5124e6[_0x151b('0x4c')],qs[_0x151b('0x52')](_0x2c88f3['query'][_0x151b('0x52')]));_0x2589ce[_0x151b('0x51')]=_0x2589ce[_0x151b('0x51')][_0x151b('0x53')]?_0x2589ce[_0x151b('0x51')]:_0x5124e6[_0x151b('0x4c')];if(_0x2c88f3[_0x151b('0x4d')][_0x151b('0x5d')]){_0x2589ce[_0x151b('0x5e')]=[{'all':!![]}];}_0x2589ce=_['merge']({},_0x2589ce,_0x2c88f3['options']);return db[_0x151b('0x48')][_0x151b('0x65')](_0x2589ce)['then'](handleEntityNotFound(_0x1fd192,null))[_0x151b('0x28')](respondWithResult(_0x1fd192,null))[_0x151b('0x66')](handleError(_0x1fd192,null));};exports[_0x151b('0x24')]=function(_0x33f06a,_0xe76b45){if(_0x33f06a[_0x151b('0x67')]['id']){delete _0x33f06a[_0x151b('0x67')]['id'];}var _0x4eab19=_0x33f06a[_0x151b('0x67')]['provider']==='custom'?null:_0x33f06a[_0x151b('0x67')][_0x151b('0x68')];var _0x22ad13=_0x33f06a['body'][_0x151b('0x42')]||{};var _0x34eac8=_0x33f06a['body']['Smtp']||{};if(_0x4eab19){_0x22ad13[_0x151b('0x3c')]=getImapHost(_0x4eab19);_0x22ad13[_0x151b('0x3d')]=0x3e1;_0x34eac8[_0x151b('0x3c')]=getSmtpHost(_0x4eab19);_0x34eac8[_0x151b('0x3d')]=0x24b;_0x34eac8['secure']=![];}if(_0x34eac8[_0x151b('0x3a')]){_0x34eac8[_0x151b('0x3e')]=![];}else{_0x34eac8[_0x151b('0x3b')]=null;}if(!_0x22ad13['modernAuthentication'])_0x22ad13[_0x151b('0x3b')]=null;_0x33f06a['body'][_0x151b('0x42')]=_0x22ad13;_0x33f06a[_0x151b('0x67')][_0x151b('0x43')]=_0x34eac8;return db[_0x151b('0x48')][_0x151b('0x65')]({'where':{'id':_0x33f06a[_0x151b('0x62')]['id']},'include':[{'model':db[_0x151b('0x63')],'as':_0x151b('0x42')},{'model':db[_0x151b('0x64')],'as':_0x151b('0x43')},{'model':db[_0x151b('0x45')],'as':_0x151b('0x46')}]})[_0x151b('0x28')](handleEntityNotFound(_0xe76b45,null))[_0x151b('0x28')](function(_0xf074ca){if(!_0xf074ca)throw new Error(_0x151b('0x69'));if(_0xf074ca['service'])delete _0x33f06a[_0x151b('0x67')][_0x151b('0x42')];return _0xf074ca;})[_0x151b('0x28')](saveUpdates(_0x33f06a[_0x151b('0x67')],null))[_0x151b('0x28')](function(_0x595892){if(!_0x33f06a['body'][_0x151b('0x42')])return _0x595892;return db[_0x151b('0x63')]['update'](_0x33f06a['body'][_0x151b('0x42')],{'where':{'MailAccountId':_0x595892['id']}})[_0x151b('0x28')](function(){return _0x595892;});})[_0x151b('0x28')](function(_0x5d0971){if(!_0x33f06a[_0x151b('0x67')]['Smtp'])return _0x5d0971;return db[_0x151b('0x64')]['update'](_0x33f06a[_0x151b('0x67')][_0x151b('0x43')],{'where':{'MailAccountId':_0x5d0971['id']}})[_0x151b('0x28')](function(){return _0x5d0971;});})[_0x151b('0x28')](respondWithResult(_0xe76b45,null))[_0x151b('0x66')](handleError(_0xe76b45,null));};exports[_0x151b('0x6a')]=function(_0x13bdd5,_0x4b061d){return db['MailAccount'][_0x151b('0x6a')]()[_0x151b('0x28')](respondWithResult(_0x4b061d,null))['catch'](handleError(_0x4b061d,null));};exports[_0x151b('0x6b')]=function(_0x2e8fd5,_0x15ab21){if(_0x2e8fd5['body']['id']){delete _0x2e8fd5[_0x151b('0x67')]['id'];}return db['MailAccount'][_0x151b('0x65')]({'where':{'id':_0x2e8fd5[_0x151b('0x62')]['id']}})[_0x151b('0x28')](handleEntityNotFound(_0x15ab21,null))[_0x151b('0x28')](function(_0x1c798c){if(_0x1c798c){_0x2e8fd5['body'][_0x151b('0x6c')]=_0x1c798c['id'];return db[_0x151b('0x6d')]['create'](_0x2e8fd5[_0x151b('0x67')]);}})[_0x151b('0x28')](respondWithResult(_0x15ab21,null))[_0x151b('0x66')](handleError(_0x15ab21,null));};exports['getDispositions']=function(_0x3d7d99,_0x464b4d){var _0x5e7a33={'raw':![],'where':{}};var _0xfcbcae={};var _0x135e7a={'count':0x0,'rows':[]};return db[_0x151b('0x48')][_0x151b('0x6e')]({'where':{'id':_0x3d7d99[_0x151b('0x62')]['id']}})[_0x151b('0x28')](handleEntityNotFound(_0x464b4d,null))[_0x151b('0x28')](function(_0x42578c){if(_0x42578c){_0xfcbcae[_0x151b('0x4c')]=_[_0x151b('0x4e')](db['Disposition'][_0x151b('0x49')]);_0xfcbcae['query']=_[_0x151b('0x4e')](_0x3d7d99[_0x151b('0x4d')]);_0xfcbcae[_0x151b('0x4f')]=_[_0x151b('0x50')](_0xfcbcae['model'],_0xfcbcae['query']);_0x5e7a33['attributes']=_['intersection'](_0xfcbcae[_0x151b('0x4c')],qs['fields'](_0x3d7d99[_0x151b('0x4d')][_0x151b('0x52')]));_0x5e7a33[_0x151b('0x51')]=_0x5e7a33['attributes'][_0x151b('0x53')]?_0x5e7a33[_0x151b('0x51')]:_0xfcbcae[_0x151b('0x4c')];if(!_0x3d7d99[_0x151b('0x4d')][_0x151b('0x54')](_0x151b('0x55'))){_0x5e7a33['limit']=qs[_0x151b('0x20')](_0x3d7d99[_0x151b('0x4d')][_0x151b('0x20')]);_0x5e7a33['offset']=qs[_0x151b('0x1e')](_0x3d7d99[_0x151b('0x4d')]['offset']);}_0x5e7a33[_0x151b('0x6f')]=qs[_0x151b('0x56')](_0x3d7d99[_0x151b('0x4d')][_0x151b('0x56')]);_0x5e7a33[_0x151b('0x59')]=qs[_0x151b('0x4f')](_[_0x151b('0x57')](_0x3d7d99[_0x151b('0x4d')],_0xfcbcae[_0x151b('0x4f')]));_0x5e7a33[_0x151b('0x59')]['MailAccountId']=_0x42578c['id'];if(_0x3d7d99['query'][_0x151b('0x58')]){_0x5e7a33['where']=_['merge'](_0x5e7a33[_0x151b('0x59')],{'$or':_['map'](_0x5e7a33[_0x151b('0x51')],function(_0x5834e3){var _0x32e3de={};_0x32e3de[_0x5834e3]={'$like':'%'+_0x3d7d99['query']['filter']+'%'};return _0x32e3de;})});}_0x5e7a33=_[_0x151b('0x5b')]({},_0x5e7a33,_0x3d7d99['options']);return db[_0x151b('0x6d')]['count']({'where':_0x5e7a33['where']})['then'](function(_0x1c0757){_0x135e7a['count']=_0x1c0757;if(_0x3d7d99['query'][_0x151b('0x5d')]){_0x5e7a33[_0x151b('0x5e')]=[{'all':!![]}];}return db['Disposition'][_0x151b('0x5f')](_0x5e7a33);})[_0x151b('0x28')](function(_0x4b6716){_0x135e7a['rows']=_0x4b6716;return _0x135e7a;});}})[_0x151b('0x28')](respondWithFilteredResult(_0x464b4d,_0x5e7a33))[_0x151b('0x66')](handleError(_0x464b4d,null));};exports['removeDispositions']=function(_0x41a365,_0x1672c3){return db[_0x151b('0x48')][_0x151b('0x65')]({'where':{'id':_0x41a365[_0x151b('0x62')]['id']}})['then'](handleEntityNotFound(_0x1672c3,null))[_0x151b('0x28')](function(_0x414a2a){if(_0x414a2a){return _0x414a2a[_0x151b('0x70')](_0x41a365[_0x151b('0x4d')][_0x151b('0x71')]);}})[_0x151b('0x28')](respondWithStatusCode(_0x1672c3,null))['catch'](handleError(_0x1672c3,null));};exports['addAnswer']=function(_0xb78f38,_0x3a3d51){if(_0xb78f38['body']['id']){delete _0xb78f38['body']['id'];}return db['MailAccount'][_0x151b('0x65')]({'where':{'id':_0xb78f38['params']['id']}})[_0x151b('0x28')](handleEntityNotFound(_0x3a3d51,null))['then'](function(_0x4185a1){if(_0x4185a1){_0xb78f38[_0x151b('0x67')][_0x151b('0x6c')]=_0x4185a1['id'];return db[_0x151b('0x72')][_0x151b('0x73')](_0xb78f38['body']);}})[_0x151b('0x28')](respondWithResult(_0x3a3d51,null))[_0x151b('0x66')](handleError(_0x3a3d51,null));};exports[_0x151b('0x74')]=function(_0x1a981e,_0x5496e8){var _0x7b3fcb={'raw':![],'where':{}};var _0x31158a={};var _0x1b061a={'count':0x0,'rows':[]};return db[_0x151b('0x48')][_0x151b('0x6e')]({'where':{'id':_0x1a981e[_0x151b('0x62')]['id']}})['then'](handleEntityNotFound(_0x5496e8,null))[_0x151b('0x28')](function(_0x5dda85){if(_0x5dda85){_0x31158a[_0x151b('0x4c')]=_['keys'](db[_0x151b('0x72')][_0x151b('0x49')]);_0x31158a[_0x151b('0x4d')]=_[_0x151b('0x4e')](_0x1a981e['query']);_0x31158a[_0x151b('0x4f')]=_[_0x151b('0x50')](_0x31158a[_0x151b('0x4c')],_0x31158a[_0x151b('0x4d')]);_0x7b3fcb[_0x151b('0x51')]=_[_0x151b('0x50')](_0x31158a[_0x151b('0x4c')],qs[_0x151b('0x52')](_0x1a981e[_0x151b('0x4d')][_0x151b('0x52')]));_0x7b3fcb['attributes']=_0x7b3fcb[_0x151b('0x51')][_0x151b('0x53')]?_0x7b3fcb[_0x151b('0x51')]:_0x31158a[_0x151b('0x4c')];if(!_0x1a981e[_0x151b('0x4d')][_0x151b('0x54')]('nolimit')){_0x7b3fcb[_0x151b('0x20')]=qs[_0x151b('0x20')](_0x1a981e['query']['limit']);_0x7b3fcb[_0x151b('0x1e')]=qs[_0x151b('0x1e')](_0x1a981e[_0x151b('0x4d')]['offset']);}_0x7b3fcb[_0x151b('0x6f')]=qs[_0x151b('0x56')](_0x1a981e[_0x151b('0x4d')]['sort']);_0x7b3fcb[_0x151b('0x59')]=qs[_0x151b('0x4f')](_[_0x151b('0x57')](_0x1a981e[_0x151b('0x4d')],_0x31158a[_0x151b('0x4f')]));_0x7b3fcb[_0x151b('0x59')]['MailAccountId']=_0x5dda85['id'];if(_0x1a981e['query'][_0x151b('0x58')]){_0x7b3fcb[_0x151b('0x59')]=_['merge'](_0x7b3fcb['where'],{'$or':_[_0x151b('0x47')](_0x7b3fcb[_0x151b('0x51')],function(_0xdd1448){var _0x149367={};_0x149367[_0xdd1448]={'$like':'%'+_0x1a981e[_0x151b('0x4d')][_0x151b('0x58')]+'%'};return _0x149367;})});}_0x7b3fcb=_[_0x151b('0x5b')]({},_0x7b3fcb,_0x1a981e[_0x151b('0x5c')]);return db[_0x151b('0x72')][_0x151b('0x21')]({'where':_0x7b3fcb['where']})[_0x151b('0x28')](function(_0x234583){_0x1b061a[_0x151b('0x21')]=_0x234583;if(_0x1a981e[_0x151b('0x4d')]['includeAll']){_0x7b3fcb[_0x151b('0x5e')]=[{'all':!![]}];}return db[_0x151b('0x72')][_0x151b('0x5f')](_0x7b3fcb);})['then'](function(_0x28b3fd){_0x1b061a[_0x151b('0x60')]=_0x28b3fd;return _0x1b061a;});}})['then'](respondWithFilteredResult(_0x5496e8,_0x7b3fcb))[_0x151b('0x66')](handleError(_0x5496e8,null));};exports['removeAnswers']=function(_0x175871,_0x113064){return db[_0x151b('0x48')][_0x151b('0x65')]({'where':{'id':_0x175871[_0x151b('0x62')]['id']}})[_0x151b('0x28')](handleEntityNotFound(_0x113064,null))[_0x151b('0x28')](function(_0x3fc8d9){if(_0x3fc8d9){return _0x3fc8d9[_0x151b('0x75')](_0x175871[_0x151b('0x4d')][_0x151b('0x71')]);}})['then'](respondWithStatusCode(_0x113064,null))[_0x151b('0x66')](handleError(_0x113064,null));};exports['create']=function(_0x339061,_0x2cc836){var _0x45f05a={'name':_0x339061['body']['name'],'key':_0x339061['body'][_0x151b('0x4b')],'provider':_0x339061[_0x151b('0x67')]['provider']===_0x151b('0x76')?null:_0x339061[_0x151b('0x67')]['provider'],'email':_0x339061[_0x151b('0x67')][_0x151b('0x77')],'ListId':_0x339061['body'][_0x151b('0x78')],'active':!_['isNil'](_0x339061['body'][_0x151b('0x79')])?_0x339061[_0x151b('0x67')]['active']:!![],'description':_0x339061[_0x151b('0x67')]['description']||null};var _0x58d7d0=getAuthenticationOptions(_0x45f05a[_0x151b('0x68')],_0x339061['body']);_0x45f05a[_0x151b('0x42')]=_0x58d7d0[_0x151b('0x42')];_0x45f05a['Smtp']=_0x58d7d0[_0x151b('0x43')];return db[_0x151b('0x48')]['create'](_0x45f05a,{'include':[{'model':db[_0x151b('0x64')],'as':_0x151b('0x43')},{'model':db['MailServerIn'],'as':_0x151b('0x42')}]})['then'](function(_0x423fe9){var _0x4e8d55=_0x339061[_0x151b('0x37')][_0x151b('0x26')]({'plain':!![]});if(!_0x4e8d55)throw new Error(_0x151b('0x7a'));if(_0x4e8d55[_0x151b('0x7b')]===_0x151b('0x37')){var _0x2d2981=_0x423fe9[_0x151b('0x26')]({'plain':!![]});return db[_0x151b('0x7c')][_0x151b('0x65')]({'where':{'name':_0x151b('0x27'),'userProfileId':_0x4e8d55[_0x151b('0x7d')]},'raw':!![]})[_0x151b('0x28')](function(_0x1fd8db){if(_0x1fd8db&&_0x1fd8db[_0x151b('0x7e')]===0x0){return db[_0x151b('0x7f')][_0x151b('0x73')]({'name':_0x2d2981[_0x151b('0x29')],'resourceId':_0x2d2981['id'],'type':_0x1fd8db[_0x151b('0x29')],'sectionId':_0x1fd8db['id']},{})[_0x151b('0x28')](function(){return _0x423fe9;});}else{return _0x423fe9;}})['catch'](function(_0x2c4883){logger[_0x151b('0x17')](_0x151b('0x80'),_0x2c4883);throw _0x2c4883;});}return _0x423fe9;})[_0x151b('0x28')](respondWithResult(_0x2cc836,0xc9))['catch'](handleError(_0x2cc836,null));};exports['getImap']=function(_0x112c13,_0x6c1450){return db[_0x151b('0x48')]['findOne']({'where':{'id':_0x112c13['params']['id']}})['then'](handleEntityNotFound(_0x6c1450,null))[_0x151b('0x28')](function(_0x51491a){if(_0x51491a){return _0x51491a[_0x151b('0x81')]();}return null;})[_0x151b('0x28')](respondWithResult(_0x6c1450,null))[_0x151b('0x66')](handleError(_0x6c1450,null));};exports[_0x151b('0x82')]=function(_0x88e4f5,_0x1e5909){if(_0x88e4f5[_0x151b('0x67')]['id']){delete _0x88e4f5[_0x151b('0x67')]['id'];}return db[_0x151b('0x48')][_0x151b('0x65')]({'where':{'id':_0x88e4f5[_0x151b('0x62')]['id']}})[_0x151b('0x28')](handleEntityNotFound(_0x1e5909,null))[_0x151b('0x28')](function(_0x2e6d01){if(_0x2e6d01){_0x88e4f5[_0x151b('0x67')][_0x151b('0x6c')]=_0x2e6d01['id'];return db['MailServerIn']['create'](_0x88e4f5[_0x151b('0x67')]);}})[_0x151b('0x28')](respondWithResult(_0x1e5909,null))[_0x151b('0x66')](handleError(_0x1e5909,null));};exports[_0x151b('0x83')]=function(_0x34b3d2,_0x58e416){return db[_0x151b('0x48')][_0x151b('0x6e')]({'where':{'id':_0x34b3d2[_0x151b('0x62')]['id']}})['then'](handleEntityNotFound(_0x58e416,null))[_0x151b('0x28')](function(_0x27c407){if(_0x27c407){return _0x27c407[_0x151b('0x84')](null);}return null;})[_0x151b('0x28')](respondWithStatusCode(_0x58e416,null))[_0x151b('0x66')](handleError(_0x58e416,null));};exports[_0x151b('0x85')]=function(_0x22e9cf,_0x3ac409){return db['MailAccount'][_0x151b('0x6e')]({'where':{'id':_0x22e9cf[_0x151b('0x62')]['id']}})[_0x151b('0x28')](handleEntityNotFound(_0x3ac409,null))['then'](function(_0x10a8a2){if(_0x10a8a2){return _0x10a8a2['getSmtp']();}return null;})[_0x151b('0x28')](respondWithResult(_0x3ac409,null))[_0x151b('0x66')](handleError(_0x3ac409,null));};exports[_0x151b('0x86')]=function(_0x12914e,_0x42c713){if(_0x12914e['body']['id']){delete _0x12914e[_0x151b('0x67')]['id'];}return db[_0x151b('0x48')][_0x151b('0x65')]({'where':{'id':_0x12914e[_0x151b('0x62')]['id']}})[_0x151b('0x28')](handleEntityNotFound(_0x42c713,null))[_0x151b('0x28')](function(_0x161e43){if(_0x161e43){_0x12914e[_0x151b('0x67')]['MailAccountId']=_0x161e43['id'];return db[_0x151b('0x64')][_0x151b('0x73')](_0x12914e[_0x151b('0x67')]);}})[_0x151b('0x28')](respondWithResult(_0x42c713,null))['catch'](handleError(_0x42c713,null));};exports['removeSmtp']=function(_0x2a1700,_0x4608ab){return db[_0x151b('0x48')][_0x151b('0x6e')]({'where':{'id':_0x2a1700[_0x151b('0x62')]['id']}})['then'](handleEntityNotFound(_0x4608ab,null))['then'](function(_0x1a56be){if(_0x1a56be){return _0x1a56be[_0x151b('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x4608ab,null))[_0x151b('0x66')](handleError(_0x4608ab,null));};exports[_0x151b('0x88')]=function(_0x1b57f0,_0x2aa6b9){return db[_0x151b('0x89')][_0x151b('0x65')]({'where':{'id':_0x1b57f0[_0x151b('0x62')]['id']}})[_0x151b('0x28')](handleEntityNotFound(_0x2aa6b9,null))[_0x151b('0x28')](function(_0x269c2c){if(_0x269c2c){return _0x269c2c[_0x151b('0x88')](_0x1b57f0[_0x151b('0x67')]['ids'],_[_0x151b('0x8a')](_0x1b57f0[_0x151b('0x67')],[_0x151b('0x71'),'id'])||{});}})[_0x151b('0x28')](respondWithResult(_0x2aa6b9,null))[_0x151b('0x66')](handleError(_0x2aa6b9,null));};exports[_0x151b('0x8b')]=function(_0x19d1a8,_0x8e3bba){var _0x5f0e23={'raw':![],'where':{}};var _0x4bc33a={};var _0x17d9da={'count':0x0,'rows':[]};return db[_0x151b('0x48')]['findOne']({'where':{'id':_0x19d1a8[_0x151b('0x62')]['id']}})['then'](handleEntityNotFound(_0x8e3bba,null))[_0x151b('0x28')](function(_0x5d38f3){if(_0x5d38f3){_0x4bc33a[_0x151b('0x4c')]=_[_0x151b('0x4e')](db[_0x151b('0x89')][_0x151b('0x49')]);_0x4bc33a['query']=_[_0x151b('0x4e')](_0x19d1a8[_0x151b('0x4d')]);_0x4bc33a[_0x151b('0x4f')]=_[_0x151b('0x50')](_0x4bc33a['model'],_0x4bc33a[_0x151b('0x4d')]);_0x5f0e23[_0x151b('0x51')]=_[_0x151b('0x50')](_0x4bc33a['model'],qs[_0x151b('0x52')](_0x19d1a8[_0x151b('0x4d')][_0x151b('0x52')]));_0x5f0e23[_0x151b('0x51')]=_0x5f0e23[_0x151b('0x51')]['length']?_0x5f0e23[_0x151b('0x51')]:_0x4bc33a[_0x151b('0x4c')];if(!_0x19d1a8[_0x151b('0x4d')][_0x151b('0x54')]('nolimit')){_0x5f0e23['limit']=qs[_0x151b('0x20')](_0x19d1a8[_0x151b('0x4d')]['limit']);_0x5f0e23[_0x151b('0x1e')]=qs[_0x151b('0x1e')](_0x19d1a8[_0x151b('0x4d')][_0x151b('0x1e')]);}_0x5f0e23['order']=qs[_0x151b('0x56')](_0x19d1a8[_0x151b('0x4d')][_0x151b('0x56')]);_0x5f0e23[_0x151b('0x59')]=qs[_0x151b('0x4f')](_[_0x151b('0x57')](_0x19d1a8['query'],_0x4bc33a['filters']));_0x5f0e23[_0x151b('0x59')][_0x151b('0x6c')]=_0x5d38f3['id'];if(_0x19d1a8[_0x151b('0x4d')]['filter']){_0x5f0e23[_0x151b('0x59')]=_[_0x151b('0x5b')](_0x5f0e23[_0x151b('0x59')],{'$or':_['map'](_0x5f0e23[_0x151b('0x51')],function(_0x56948a){var _0x52bd23={};_0x52bd23[_0x56948a]={'$like':'%'+_0x19d1a8[_0x151b('0x4d')][_0x151b('0x58')]+'%'};return _0x52bd23;})});}_0x5f0e23=_['merge']({},_0x5f0e23,_0x19d1a8['options']);return db['MailInteraction']['count']({'where':_0x5f0e23['where']})[_0x151b('0x28')](function(_0x10ab74){_0x17d9da[_0x151b('0x21')]=_0x10ab74;if(_0x19d1a8['query']['includeAll']){_0x5f0e23[_0x151b('0x5e')]=[{'model':db['CmContact'],'as':_0x151b('0x8c'),'required':![]},{'model':db[_0x151b('0x8d')],'as':_0x151b('0x8e'),'attributes':[_0x151b('0x29'),_0x151b('0x8f'),'internal'],'required':![]},{'model':db[_0x151b('0x90')],'as':_0x151b('0x91'),'attributes':['id','name',_0x151b('0x92')],'where':_0x19d1a8['query'][_0x151b('0x93')]?{'id':_0x19d1a8[_0x151b('0x4d')][_0x151b('0x93')]}:undefined,'required':_0x19d1a8[_0x151b('0x4d')][_0x151b('0x93')]?!![]:![]}];}return db[_0x151b('0x89')][_0x151b('0x5f')](_0x5f0e23);})[_0x151b('0x28')](function(_0x16281b){_0x17d9da['rows']=_0x16281b;return _0x17d9da;});}})[_0x151b('0x28')](respondWithFilteredResult(_0x8e3bba,_0x5f0e23))['catch'](handleError(_0x8e3bba,null));};exports[_0x151b('0x94')]=function addApplications(_0x3cc141,_0x5397da){var _0x1ba83b=_0x3cc141[_0x151b('0x62')]['id'];var _0x2e0a51=_0x3cc141[_0x151b('0x67')];var _0x56d1a4=0xc8;var _0x5d6301=null;return db[_0x151b('0x95')]['transaction']({'isolationLevel':db[_0x151b('0x95')][_0x151b('0x96')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x348ea0){return db['MailAccount'][_0x151b('0x6e')]({'where':{'id':_0x1ba83b},'transaction':_0x348ea0})['then'](function(_0x105cf6){if(_0x105cf6){return db['MailApplication'][_0x151b('0x25')]({'where':{'MailAccountId':_0x1ba83b},'transaction':_0x348ea0})[_0x151b('0x28')](function(){var _0xd86ffd=_[_0x151b('0x47')](_0x2e0a51,function(_0xa97d4c){_0xa97d4c[_0x151b('0x6c')]=_0x1ba83b;return _0xa97d4c;});return db[_0x151b('0x97')][_0x151b('0x98')](_0xd86ffd,{'transaction':_0x348ea0});});}else{_0x56d1a4=0x194;_0x5d6301=[];}});})[_0x151b('0x28')](function(){if(_0x56d1a4!==0x194){return db[_0x151b('0x97')]['findAndCountAll']({'where':{'MailAccountId':_0x1ba83b},'order':'priority'})[_0x151b('0x28')](function(_0x580eda){_0x5d6301=_0x580eda;});}})[_0x151b('0x66')](function(_0x1c27e4){_0x56d1a4=0x1f4;logger[_0x151b('0x17')](_0x1c27e4['stack']);if(_0x1c27e4['name']){delete _0x1c27e4['name'];}_0x5d6301=_0x1c27e4;})[_0x151b('0x99')](function(){if(_0x5d6301===null){_0x5397da[_0x151b('0x9a')](_0x56d1a4);}else{if(_0x56d1a4===0x1f4){_0x5397da[_0x151b('0x1b')](_0x56d1a4)[_0x151b('0x2a')](_0x5d6301);}else{_0x5397da[_0x151b('0x1b')](_0x56d1a4)['json'](_0x5d6301);}}});};exports[_0x151b('0x9b')]=function(_0x44a5da,_0x6536f0){var _0xa35b8c={};var _0x129439={};var _0x21f720;var _0x2de35f;return db[_0x151b('0x48')][_0x151b('0x6e')]({'where':{'id':_0x44a5da[_0x151b('0x62')]['id']}})[_0x151b('0x28')](handleEntityNotFound(_0x6536f0,null))[_0x151b('0x28')](function(_0x284ce8){if(_0x284ce8){_0x21f720=_0x284ce8;_0x129439['model']=_[_0x151b('0x4e')](db['MailApplication'][_0x151b('0x49')]);_0x129439[_0x151b('0x4d')]=_[_0x151b('0x4e')](_0x44a5da[_0x151b('0x4d')]);_0x129439[_0x151b('0x4f')]=_[_0x151b('0x50')](_0x129439[_0x151b('0x4c')],_0x129439[_0x151b('0x4d')]);_0xa35b8c[_0x151b('0x51')]=_[_0x151b('0x50')](_0x129439[_0x151b('0x4c')],qs['fields'](_0x44a5da[_0x151b('0x4d')][_0x151b('0x52')]));_0xa35b8c[_0x151b('0x51')]=_0xa35b8c[_0x151b('0x51')]['length']?_0xa35b8c[_0x151b('0x51')]:_0x129439[_0x151b('0x4c')];_0xa35b8c[_0x151b('0x6f')]=qs['sort'](_0x44a5da[_0x151b('0x4d')]['sort']);_0xa35b8c[_0x151b('0x59')]=qs[_0x151b('0x4f')](_[_0x151b('0x57')](_0x44a5da[_0x151b('0x4d')],_0x129439[_0x151b('0x4f')]));if(_0x44a5da[_0x151b('0x4d')][_0x151b('0x58')]){_0xa35b8c[_0x151b('0x59')]=_[_0x151b('0x5b')](_0xa35b8c[_0x151b('0x59')],{'$or':_['map'](_0xa35b8c[_0x151b('0x51')],function(_0x2c33ee){var _0x51659c={};_0x51659c[_0x2c33ee]={'$like':'%'+_0x44a5da[_0x151b('0x4d')][_0x151b('0x58')]+'%'};return _0x51659c;})});}_0xa35b8c=_[_0x151b('0x5b')]({},_0xa35b8c,_0x44a5da[_0x151b('0x5c')]);return _0x21f720[_0x151b('0x9b')](_0xa35b8c);}})[_0x151b('0x28')](function(_0x22e8dd){if(_0x22e8dd){_0x2de35f=_0x22e8dd[_0x151b('0x53')];if(!_0x44a5da[_0x151b('0x4d')][_0x151b('0x54')]('nolimit')){_0xa35b8c[_0x151b('0x20')]=qs['limit'](_0x44a5da['query'][_0x151b('0x20')]);_0xa35b8c[_0x151b('0x1e')]=qs[_0x151b('0x1e')](_0x44a5da[_0x151b('0x4d')][_0x151b('0x1e')]);}return _0x21f720[_0x151b('0x9b')](_0xa35b8c);}})[_0x151b('0x28')](function(_0x4c7260){if(_0x4c7260){return _0x4c7260?{'count':_0x2de35f,'rows':_0x4c7260}:null;}})[_0x151b('0x28')](respondWithResult(_0x6536f0,null))[_0x151b('0x66')](handleError(_0x6536f0,null));};exports[_0x151b('0x9c')]=function(_0x2415f3,_0xcd4c4d){var _0x3fc0f5={'raw':!![],'where':{}};var _0x15632a={};var _0x58c6fd={'count':0x0,'rows':[]};return db[_0x151b('0x48')][_0x151b('0x6e')]({'where':{'id':_0x2415f3['params']['id']}})[_0x151b('0x28')](handleEntityNotFound(_0xcd4c4d,null))[_0x151b('0x28')](function(_0x3ad683){if(_0x3ad683){_0x15632a[_0x151b('0x4c')]=_[_0x151b('0x4e')](db[_0x151b('0x9d')]['rawAttributes']);_0x15632a['query']=_[_0x151b('0x4e')](_0x2415f3[_0x151b('0x4d')]);_0x15632a[_0x151b('0x4f')]=_[_0x151b('0x50')](_0x15632a[_0x151b('0x4c')],_0x15632a['query']);_0x3fc0f5[_0x151b('0x51')]=_['intersection'](_0x15632a[_0x151b('0x4c')],qs[_0x151b('0x52')](_0x2415f3[_0x151b('0x4d')][_0x151b('0x52')]));_0x3fc0f5[_0x151b('0x51')]=_0x3fc0f5[_0x151b('0x51')][_0x151b('0x53')]?_0x3fc0f5[_0x151b('0x51')]:_0x15632a['model'];if(!_0x2415f3['query']['hasOwnProperty'](_0x151b('0x55'))){_0x3fc0f5[_0x151b('0x20')]=qs[_0x151b('0x20')](_0x2415f3[_0x151b('0x4d')][_0x151b('0x20')]);_0x3fc0f5[_0x151b('0x1e')]=qs['offset'](_0x2415f3['query'][_0x151b('0x1e')]);}_0x3fc0f5[_0x151b('0x6f')]=qs[_0x151b('0x56')](_0x2415f3[_0x151b('0x4d')][_0x151b('0x56')]);_0x3fc0f5['where']=qs['filters'](_[_0x151b('0x57')](_0x2415f3[_0x151b('0x4d')],_0x15632a[_0x151b('0x4f')]));_0x3fc0f5['where'][_0x151b('0x6c')]=_0x3ad683['id'];if(_0x2415f3['query'][_0x151b('0x58')]){_0x3fc0f5[_0x151b('0x59')]=_[_0x151b('0x5b')](_0x3fc0f5['where'],{'$or':_[_0x151b('0x47')](_0x3fc0f5[_0x151b('0x51')],function(_0x2f43c2){var _0x596998={};_0x596998[_0x2f43c2]={'$like':'%'+_0x2415f3['query'][_0x151b('0x58')]+'%'};return _0x596998;})});}if(_0x2415f3[_0x151b('0x4d')][_0x151b('0x9e')]){var _0x4f28d6=_0x2415f3[_0x151b('0x4d')][_0x151b('0x9e')][_0x151b('0x9f')](',');var _0xf41b82={};_0xf41b82[_0x4f28d6[0x0]]={'$gte':moment(_0x4f28d6[0x1])[_0x151b('0xa0')](_0x151b('0xa1'))};_0x3fc0f5[_0x151b('0x59')]=_[_0x151b('0x5b')](_0x3fc0f5[_0x151b('0x59')],_0xf41b82);}_0x3fc0f5=_[_0x151b('0x5b')]({},_0x3fc0f5,_0x2415f3['options']);return db[_0x151b('0x9d')][_0x151b('0x21')]({'where':_0x3fc0f5[_0x151b('0x59')]})['then'](function(_0x314482){_0x58c6fd[_0x151b('0x21')]=_0x314482;if(_0x2415f3['query'][_0x151b('0x5d')]){_0x3fc0f5[_0x151b('0x5e')]=[{'all':!![]}];}return db['MailMessage'][_0x151b('0x5f')](_0x3fc0f5);})[_0x151b('0x28')](function(_0x25097e){if(_0x2415f3[_0x151b('0x4d')][_0x151b('0xa2')]===_0x151b('0xa3')){for(var _0x442760=0x0;_0x442760<_0x25097e[_0x151b('0x53')];_0x442760++){_0x25097e[_0x442760][_0x151b('0x67')]=juice(_0x25097e[_0x442760][_0x151b('0x67')]);}}_0x58c6fd[_0x151b('0x60')]=_0x25097e;return _0x58c6fd;});}})['then'](respondWithFilteredResult(_0xcd4c4d,_0x3fc0f5))[_0x151b('0x66')](handleError(_0xcd4c4d,null));};exports[_0x151b('0x2a')]=function(_0x134738,_0x1ec013){var _0x272c0f,_0x1b20d9={},_0x4498b9;if(_0x134738[_0x151b('0x67')]['to']){_0x4498b9=_0x134738[_0x151b('0x67')]['to'][_0x151b('0x9f')](',')[0x0];}return db['MailAccount'][_0x151b('0x65')]({'where':{'id':_0x134738[_0x151b('0x62')]['id']},'include':[{'model':db[_0x151b('0xa4')],'as':_0x151b('0xa5'),'include':[{'model':db['CmContact'],'as':_0x151b('0xa6'),'where':{'email':_0x4498b9},'limit':0x1,'order':[[_0x151b('0xa7'),_0x151b('0xa8')]]}]},{'model':db[_0x151b('0x64')],'as':_0x151b('0x43'),'raw':!![],'include':[{'model':db[_0x151b('0xa9')],'as':_0x151b('0xa9'),'raw':!![]}]}]})[_0x151b('0x28')](handleEntityNotFound(_0x1ec013,null))[_0x151b('0x28')](function(_0x1a74c6){if(!_0x1a74c6)return;_0x272c0f=_0x1a74c6;if(!_0x1a74c6[_0x151b('0x43')])throw new Error(_0x151b('0xaa'));if(_[_0x151b('0xab')](_0x134738[_0x151b('0x67')][_0x151b('0xac')])){_0x134738['body'][_0x151b('0xac')]=util[_0x151b('0xa0')](_0x151b('0xad'),_0x1a74c6[_0x151b('0x29')],_0x1a74c6[_0x151b('0x77')]||_0x1a74c6['Smtp'][_0x151b('0x37')]);}if(_0x134738[_0x151b('0x67')][_0x151b('0xae')]&&_0x134738[_0x151b('0x67')][_0x151b('0xae')][_0x151b('0x53')]){for(var _0x2012f5=0x0;_0x2012f5<_0x134738[_0x151b('0x67')]['attachments'][_0x151b('0x53')];_0x2012f5+=0x1){_0x134738[_0x151b('0x67')]['attachments'][_0x2012f5]={'filename':_0x134738[_0x151b('0x67')]['attachments'][_0x2012f5][_0x151b('0x29')],'path':path[_0x151b('0xaf')](config[_0x151b('0xb0')],'server/files/attachments',_0x134738[_0x151b('0x67')][_0x151b('0xae')][_0x2012f5][_0x151b('0xb1')])};}}var _0x5ecac9=_0x1a74c6['getSmtpOptions']();return respondWithRpcPromise(_0x151b('0xb2'),_0x151b('0xb3'),{'account':_0x5ecac9,'message':_0x134738['body']});})[_0x151b('0x28')](function(_0x47b44f){if(!_0x47b44f)return;_0x1b20d9=_0x47b44f;if(!_0x272c0f[_0x151b('0xa5')])throw new Error(_0x151b('0xb4'));if(_0x272c0f['List']['Contacts'][_0x151b('0x53')])return _0x272c0f[_0x151b('0xa5')]['Contacts'][0x0];return db['CmContact']['create'](_[_0x151b('0xc')](_0x134738[_0x151b('0x67')],{'firstName':_0x134738[_0x151b('0x67')]['to'],'email':_0x134738[_0x151b('0x67')]['to'],'phone':_0x134738[_0x151b('0x67')]['to'],'ListId':_0x272c0f[_0x151b('0x78')]}));})[_0x151b('0x28')](function(_0x359292){if(!_0x359292)return;var _0x2ac1b7={'UserId':_0x134738['user']['id'],'ContactId':_0x359292['id'],'MailAccountId':_0x272c0f['id'],'inReplyTo':_0x1b20d9[_0x151b('0xb5')],'to':_0x134738[_0x151b('0x67')][_0x151b('0xac')],'cc':_0x134738[_0x151b('0x67')]['cc'],'subject':_0x134738[_0x151b('0x67')][_0x151b('0xb6')],'attach':_0x134738[_0x151b('0x67')][_0x151b('0xb7')],'firstMsgDirection':_0x151b('0xb8'),'lastMsgAt':moment()[_0x151b('0xa0')](_0x151b('0xa1')),'lastMsgDirection':_0x151b('0xb8'),'Messages':[_['merge'](_0x134738['body'],{'messageId':_0x1b20d9[_0x151b('0xb5')],'sentAt':moment()['format'](_0x151b('0xa1')),'read':!![],'MailAccountId':_0x272c0f['id'],'UserId':_0x134738['user']['id'],'ContactId':_0x359292['id']})]};if(_0x134738[_0x151b('0x67')][_0x151b('0xb9')]){_0x2ac1b7=_[_0x151b('0x5b')](_0x2ac1b7,_0x134738[_0x151b('0x67')][_0x151b('0xb9')]);}return db[_0x151b('0x89')][_0x151b('0x73')](_0x2ac1b7,{'include':[{'model':db[_0x151b('0x9d')],'as':_0x151b('0xba')}]});})[_0x151b('0x28')](respondWithResult(_0x1ec013,null))['catch'](handleError(_0x1ec013,null));};exports[_0x151b('0xbb')]=function(_0x33729a,_0x2fe8ed){return db['MailAccount'][_0x151b('0x65')]({'where':{'id':_0x33729a[_0x151b('0x62')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x151b('0x43'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x151b('0xa9'),'raw':!![]}]}]})[_0x151b('0x28')](handleEntityNotFound(_0x2fe8ed,null))['then'](function(_0x3e9fc3){if(!_0x3e9fc3[_0x151b('0x43')])return;var _0x20a40d=_0x3e9fc3[_0x151b('0xbc')]();return respondWithRpcPromise(_0x151b('0xbd'),_0x151b('0xbb'),{'account':_0x20a40d});})[_0x151b('0x28')](respondWithResult(_0x2fe8ed,null))[_0x151b('0x66')](handleError(_0x2fe8ed,null));};exports[_0x151b('0x25')]=function(_0x8b5a26,_0x453b72){return db[_0x151b('0x48')][_0x151b('0x65')]({'where':{'id':_0x8b5a26['params']['id']}})['then'](handleEntityNotFound(_0x453b72,null))[_0x151b('0x28')](function(_0x560ba4){if(_0x560ba4&&_0x560ba4[_0x151b('0x3f')]){throw new db[(_0x151b('0xbe'))][(_0x151b('0xbf'))](_0x151b('0xc0'));}return _0x560ba4;})['then'](removeEntity(_0x453b72,null))['catch'](handleError(_0x453b72,null));};exports[_0x151b('0xc1')]=function(_0x4ca5da,_0x184ceb){return db[_0x151b('0x48')][_0x151b('0x65')]({'where':{'id':_0x4ca5da[_0x151b('0x62')]['id']}})[_0x151b('0x28')](handleEntityNotFound(_0x184ceb,null))['then'](function(_0x498dad){if(_0x498dad){return _0x498dad[_0x151b('0xc1')](_0x4ca5da[_0x151b('0x67')][_0x151b('0x71')],_[_0x151b('0x8a')](_0x4ca5da['body'],[_0x151b('0x71'),'id'])||{})[_0x151b('0xc2')](function(_0x4ff44e){for(var _0x52eb95=0x0;_0x52eb95<_0x4ca5da['body'][_0x151b('0x71')][_0x151b('0x53')];_0x52eb95+=0x1){socket[_0x151b('0xc3')](_0x151b('0xc4'),{'UserId':Number(_0x4ca5da['body']['ids'][_0x52eb95]),'MailAccountId':Number(_0x4ca5da['params']['id'])});}return _0x4ff44e;});}})['then'](respondWithResult(_0x184ceb,null))['catch'](handleError(_0x184ceb,null));};exports[_0x151b('0xc5')]=function(_0x6b2a6a,_0x2aed90){return db['MailAccount']['find']({'where':{'id':_0x6b2a6a[_0x151b('0x62')]['id']}})['then'](handleEntityNotFound(_0x2aed90,null))[_0x151b('0x28')](function(_0x3bab33){if(_0x3bab33){return _0x3bab33['removeAgents'](_0x6b2a6a[_0x151b('0x4d')][_0x151b('0x71')])[_0x151b('0x28')](function(){if(_[_0x151b('0xc6')](_0x6b2a6a[_0x151b('0x4d')][_0x151b('0x71')])){for(var _0x156baa=0x0;_0x156baa<_0x6b2a6a[_0x151b('0x4d')][_0x151b('0x71')][_0x151b('0x53')];_0x156baa+=0x1){socket[_0x151b('0xc3')](_0x151b('0xc7'),{'UserId':Number(_0x6b2a6a[_0x151b('0x4d')][_0x151b('0x71')][_0x156baa]),'MailAccountId':Number(_0x6b2a6a[_0x151b('0x62')]['id'])});}}else{socket[_0x151b('0xc3')]('userMailAccount:remove',{'UserId':Number(_0x6b2a6a[_0x151b('0x4d')][_0x151b('0x71')]),'MailAccountId':Number(_0x6b2a6a[_0x151b('0x62')]['id'])});}});}})[_0x151b('0x28')](respondWithStatusCode(_0x2aed90,null))[_0x151b('0x66')](handleError(_0x2aed90,null));};exports[_0x151b('0xc8')]=function(_0x191876,_0x483e4e){var _0x22c6c3={};var _0x2e4182={};var _0x4f3cb0;var _0x3db85b;return db['MailAccount']['findOne']({'where':{'id':_0x191876[_0x151b('0x62')]['id']}})[_0x151b('0x28')](handleEntityNotFound(_0x483e4e,null))[_0x151b('0x28')](function(_0x52209f){if(_0x52209f){_0x4f3cb0=_0x52209f;_0x2e4182[_0x151b('0x4c')]=_[_0x151b('0x4e')](db[_0x151b('0x8d')]['rawAttributes']);_0x2e4182[_0x151b('0x4d')]=_[_0x151b('0x4e')](_0x191876[_0x151b('0x4d')]);_0x2e4182['filters']=_['intersection'](_0x2e4182[_0x151b('0x4c')],_0x2e4182[_0x151b('0x4d')]);_0x22c6c3[_0x151b('0x51')]=_[_0x151b('0x50')](_0x2e4182[_0x151b('0x4c')],qs[_0x151b('0x52')](_0x191876[_0x151b('0x4d')][_0x151b('0x52')]));_0x22c6c3[_0x151b('0x51')]=_0x22c6c3[_0x151b('0x51')][_0x151b('0x53')]?_0x22c6c3['attributes']:_0x2e4182[_0x151b('0x4c')];_0x22c6c3[_0x151b('0x6f')]=qs[_0x151b('0x56')](_0x191876[_0x151b('0x4d')][_0x151b('0x56')]);_0x22c6c3[_0x151b('0x59')]=qs[_0x151b('0x4f')](_['pick'](_0x191876['query'],_0x2e4182['filters']));if(_0x191876[_0x151b('0x4d')][_0x151b('0x58')]){_0x22c6c3[_0x151b('0x59')]=_[_0x151b('0x5b')](_0x22c6c3[_0x151b('0x59')],{'$or':_[_0x151b('0x47')](_0x22c6c3[_0x151b('0x51')],function(_0xa41a3f){var _0x12cd7b={};_0x12cd7b[_0xa41a3f]={'$like':'%'+_0x191876[_0x151b('0x4d')][_0x151b('0x58')]+'%'};return _0x12cd7b;})});}_0x22c6c3=_['merge']({},_0x22c6c3,_0x191876[_0x151b('0x5c')]);return _0x4f3cb0[_0x151b('0xc8')](_0x22c6c3);}})['then'](function(_0x153560){if(_0x153560){_0x3db85b=_0x153560[_0x151b('0x53')];if(!_0x191876[_0x151b('0x4d')][_0x151b('0x54')](_0x151b('0x55'))){_0x22c6c3['limit']=qs[_0x151b('0x20')](_0x191876[_0x151b('0x4d')][_0x151b('0x20')]);_0x22c6c3[_0x151b('0x1e')]=qs[_0x151b('0x1e')](_0x191876[_0x151b('0x4d')]['offset']);}return _0x4f3cb0[_0x151b('0xc8')](_0x22c6c3);}})[_0x151b('0x28')](function(_0x2a94d1){if(_0x2a94d1){return _0x2a94d1?{'count':_0x3db85b,'rows':_0x2a94d1}:null;}})[_0x151b('0x28')](respondWithResult(_0x483e4e,null))[_0x151b('0x66')](handleError(_0x483e4e,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index edd37bf..142be79 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 _0xdbcd=['save','update','remove','hasOwnProperty','events','../../mysqldb'];(function(_0x1a3918,_0x7117a2){var _0x295746=function(_0x4af873){while(--_0x4af873){_0x1a3918['push'](_0x1a3918['shift']());}};_0x295746(++_0x7117a2);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x30aeb5,_0x300c2f){_0x30aeb5=_0x30aeb5-0x0;var _0x3b3e8c=_0xdbcd[_0x30aeb5];return _0x3b3e8c;};'use strict';var EventEmitter=require(_0xddbc('0x0'));var MailAccount=require(_0xddbc('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xddbc('0x2'),'afterUpdate':_0xddbc('0x3'),'afterDestroy':_0xddbc('0x4')};function emitEvent(_0x59c52a){return function(_0x1ce7da,_0x11a04e,_0x4816af){MailAccountEvents['emit'](_0x59c52a+':'+_0x1ce7da['id'],_0x1ce7da);MailAccountEvents['emit'](_0x59c52a,_0x1ce7da);_0x4816af(null);};}for(var e in events){if(events[_0xddbc('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x7753=['hook','events','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x48d0fc,_0x4c94c8){var _0x16ce17=function(_0x41b1ae){while(--_0x41b1ae){_0x48d0fc['push'](_0x48d0fc['shift']());}};_0x16ce17(++_0x4c94c8);}(_0x7753,0xfd));var _0x3775=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0x7753[_0x5ac1e5];return _0x1bccc6;};'use strict';var EventEmitter=require(_0x3775('0x0'));var MailAccount=require(_0x3775('0x1'))['db'][_0x3775('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3775('0x3')](0x0);var events={'afterCreate':_0x3775('0x4'),'afterUpdate':'update','afterDestroy':_0x3775('0x5')};function emitEvent(_0x1e33d1){return function(_0x9cb153,_0x5afdec,_0x1762a6){MailAccountEvents[_0x3775('0x6')](_0x1e33d1+':'+_0x9cb153['id'],_0x9cb153);MailAccountEvents['emit'](_0x1e33d1,_0x9cb153);_0x1762a6(null);};}for(var e in events){if(events[_0x3775('0x7')](e)){var event=events[e];MailAccount[_0x3775('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f4f1bca..5538d60 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 _0x9bd5=['custom','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','user','data5','auth','pass','exports','define','mail_accounts','provider'];(function(_0x4a82e3,_0x5ef734){var _0x666c92=function(_0x51a923){while(--_0x51a923){_0x4a82e3['push'](_0x4a82e3['shift']());}};_0x666c92(++_0x5ef734);}(_0x9bd5,0x1c7));var _0x59bd=function(_0x3fd754,_0xe0122d){_0x3fd754=_0x3fd754-0x0;var _0x348e4c=_0x9bd5[_0x3fd754];return _0x348e4c;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x59bd('0x0')]=function(_0x5aed7e){return _0x5aed7e[_0x59bd('0x1')]('MailAccount',attributes,{'tableName':_0x59bd('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x28afbe=this;var _0x50fb27={'id':_0x28afbe['id'],'tls':{'rejectUnauthorized':![]}};if(_0x28afbe[_0x59bd('0x3')]!==_0x59bd('0x4')){_0x50fb27['service']=_0x28afbe[_0x59bd('0x3')];}else{_0x50fb27[_0x59bd('0x5')]=_0x28afbe[_0x59bd('0x6')][_0x59bd('0x5')];_0x50fb27[_0x59bd('0x7')]=_0x28afbe[_0x59bd('0x6')][_0x59bd('0x7')];_0x50fb27['secure']=_0x28afbe[_0x59bd('0x6')][_0x59bd('0x8')];}if(_0x28afbe[_0x59bd('0x6')][_0x59bd('0x9')]){if(_0x28afbe[_0x59bd('0x6')][_0x59bd('0xa')]){if(!_0x28afbe[_0x59bd('0x6')][_0x59bd('0xb')])throw new Error(_0x59bd('0xc'));_0x50fb27['auth']={'type':'OAuth2','user':_0x28afbe['Smtp'][_0x59bd('0xd')],'accessToken':_0x28afbe[_0x59bd('0x6')][_0x59bd('0xb')][_0x59bd('0xe')]};}else{_0x50fb27[_0x59bd('0xf')]={'user':_0x28afbe[_0x59bd('0x6')]['user'],'pass':_0x28afbe[_0x59bd('0x6')][_0x59bd('0x10')]};}}return _0x50fb27;}}});}; \ No newline at end of file +var _0x1abc=['Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','./mailAccount.attributes','MailAccount','mail_accounts','custom','service','provider','host','Smtp','port','secure','authentication','CloudProvider'];(function(_0x32ac55,_0x1fe375){var _0x202acf=function(_0xbb8a15){while(--_0xbb8a15){_0x32ac55['push'](_0x32ac55['shift']());}};_0x202acf(++_0x1fe375);}(_0x1abc,0x8d));var _0xc1ab=function(_0x1522db,_0x7efece){_0x1522db=_0x1522db-0x0;var _0x165585=_0x1abc[_0x1522db];return _0x165585;};'use strict';var attributes=require(_0xc1ab('0x0'));module['exports']=function(_0x305c69){return _0x305c69['define'](_0xc1ab('0x1'),attributes,{'tableName':_0xc1ab('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4a1fa8=this;var _0x122f89={'id':_0x4a1fa8['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4a1fa8['provider']!==_0xc1ab('0x3')){_0x122f89[_0xc1ab('0x4')]=_0x4a1fa8[_0xc1ab('0x5')];}else{_0x122f89[_0xc1ab('0x6')]=_0x4a1fa8[_0xc1ab('0x7')][_0xc1ab('0x6')];_0x122f89[_0xc1ab('0x8')]=_0x4a1fa8['Smtp'][_0xc1ab('0x8')];_0x122f89[_0xc1ab('0x9')]=_0x4a1fa8[_0xc1ab('0x7')][_0xc1ab('0x9')];}if(_0x4a1fa8[_0xc1ab('0x7')][_0xc1ab('0xa')]){if(_0x4a1fa8['Smtp']['modernAuthentication']){if(!_0x4a1fa8[_0xc1ab('0x7')][_0xc1ab('0xb')])throw new Error(_0xc1ab('0xc'));_0x122f89[_0xc1ab('0xd')]={'type':'OAuth2','user':_0x4a1fa8['Smtp'][_0xc1ab('0xe')],'accessToken':_0x4a1fa8[_0xc1ab('0x7')][_0xc1ab('0xb')][_0xc1ab('0xf')]};}else{_0x122f89[_0xc1ab('0xd')]={'user':_0x4a1fa8[_0xc1ab('0x7')][_0xc1ab('0xe')],'pass':_0x4a1fa8[_0xc1ab('0x7')][_0xc1ab('0x10')]};}}return _0x122f89;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index c14cb6e..1e42085 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 _0xae24=['NotifyMailAccount','difference','keys','CmContact','createdAt','updatedAt','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','Contacts','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','List','omit','applications','list','orderBy','asc','push','length','close','autoclose','*,*,*,*','List\x20not\x20found','contact','messageId','generate','subject','format','MailInteraction','MailMessage','Messages','create','Contact\x20not\x20found','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','get','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','interaction','UserId','name','agent','waitForTheAssignedAgent','MailQueue','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','bluebird','ioredis','../../mysqldb','../../config/environment','client','http','redis','defaults','localhost','./mailAccount.socket','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','MailAccount','findAll','options','attributes','include','map','model','GetMailAccount','ShowMailAccount','find','raw','where','setDataValue','smtpOptions','getSmtpOptions'];(function(_0x46b81c,_0x1e984d){var _0x968725=function(_0xdf8671){while(--_0xdf8671){_0x46b81c['push'](_0x46b81c['shift']());}};_0x968725(++_0x1e984d);}(_0xae24,0x182));var _0x4ae2=function(_0x2689f2,_0x3b5ac8){_0x2689f2=_0x2689f2-0x0;var _0x18c3ce=_0xae24[_0x2689f2];return _0x18c3ce;};'use strict';var _=require(_0x4ae2('0x0'));var moment=require('moment');var BPromise=require(_0x4ae2('0x1'));var rs=require('randomstring');var Redis=require(_0x4ae2('0x2'));var db=require(_0x4ae2('0x3'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x4ae2('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x4ae2('0x5')][_0x4ae2('0x6')]({'port':0x232c});config[_0x4ae2('0x7')]=_[_0x4ae2('0x8')](config[_0x4ae2('0x7')],{'host':_0x4ae2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4ae2('0xa'))['register'](socket);function respondWithRpcPromise(_0x564ef9,_0xb5587a,_0xb01e8e){return new BPromise(function(_0x5c32b7,_0x3b3acc){return client[_0x4ae2('0xb')](_0x564ef9,_0xb01e8e)[_0x4ae2('0xc')](function(_0xb70265){logger['info'](_0x4ae2('0xd'),_0xb5587a,_0x4ae2('0xe'));logger[_0x4ae2('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xb5587a,_0x4ae2('0xe'),JSON[_0x4ae2('0x10')](_0xb70265));if(_0xb70265[_0x4ae2('0x11')]){if(_0xb70265[_0x4ae2('0x11')][_0x4ae2('0x12')]===0x1f4){logger[_0x4ae2('0x11')](_0x4ae2('0xd'),_0xb5587a,_0xb70265[_0x4ae2('0x11')][_0x4ae2('0x13')]);return _0x3b3acc(_0xb70265['error']['message']);}logger['error'](_0x4ae2('0xd'),_0xb5587a,_0xb70265[_0x4ae2('0x11')]['message']);return _0x5c32b7(_0xb70265[_0x4ae2('0x11')][_0x4ae2('0x13')]);}else{logger[_0x4ae2('0x14')](_0x4ae2('0xd'),_0xb5587a,_0x4ae2('0xe'));_0x5c32b7(_0xb70265[_0x4ae2('0x15')][_0x4ae2('0x13')]);}})[_0x4ae2('0x16')](function(_0x41b672){logger[_0x4ae2('0x11')]('MailAccount,\x20%s,\x20%s',_0xb5587a,_0x41b672);_0x3b3acc(_0x41b672);});});}exports['GetMailAccount']=function(_0x44a2d3){var _0x2d910c=this;return new Promise(function(_0x51e20c,_0x45c1bf){return db[_0x4ae2('0x17')][_0x4ae2('0x18')]({'raw':_0x44a2d3[_0x4ae2('0x19')]?_0x44a2d3[_0x4ae2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x44a2d3[_0x4ae2('0x19')]?_0x44a2d3['options']['where']||null:null,'attributes':_0x44a2d3[_0x4ae2('0x19')]?_0x44a2d3[_0x4ae2('0x19')][_0x4ae2('0x1a')]||null:null,'limit':_0x44a2d3[_0x4ae2('0x19')]?_0x44a2d3[_0x4ae2('0x19')]['limit']||null:null,'include':_0x44a2d3[_0x4ae2('0x19')]?_0x44a2d3['options'][_0x4ae2('0x1b')]?_[_0x4ae2('0x1c')](_0x44a2d3[_0x4ae2('0x19')]['include'],function(_0x43f112){return{'model':db[_0x43f112[_0x4ae2('0x1d')]],'as':_0x43f112['as'],'attributes':_0x43f112[_0x4ae2('0x1a')],'include':_0x43f112[_0x4ae2('0x1b')]?_[_0x4ae2('0x1c')](_0x43f112[_0x4ae2('0x1b')],function(_0x5b2e65){return{'model':db[_0x5b2e65['model']],'as':_0x5b2e65['as'],'attributes':_0x5b2e65[_0x4ae2('0x1a')],'include':_0x5b2e65[_0x4ae2('0x1b')]?_[_0x4ae2('0x1c')](_0x5b2e65[_0x4ae2('0x1b')],function(_0x3a9b96){return{'model':db[_0x3a9b96[_0x4ae2('0x1d')]],'as':_0x3a9b96['as'],'attributes':_0x3a9b96['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e2666){logger['info']('GetMailAccount',_0x44a2d3);logger['debug'](_0x4ae2('0x1e'),_0x44a2d3,JSON[_0x4ae2('0x10')](_0x3e2666));_0x51e20c(_0x3e2666);})['catch'](function(_0x883fd5){logger[_0x4ae2('0x11')](_0x4ae2('0x1e'),_0x883fd5[_0x4ae2('0x13')],_0x44a2d3);_0x45c1bf(_0x2d910c[_0x4ae2('0x11')](0x1f4,_0x883fd5[_0x4ae2('0x13')]));});});};exports[_0x4ae2('0x1f')]=function(_0x269603){var _0x2904f1=this;return new Promise(function(_0x3542df,_0x386687){return db[_0x4ae2('0x17')][_0x4ae2('0x20')]({'raw':_0x269603[_0x4ae2('0x19')]?_0x269603[_0x4ae2('0x19')][_0x4ae2('0x21')]===undefined?!![]:![]:!![],'where':_0x269603[_0x4ae2('0x19')]?_0x269603['options'][_0x4ae2('0x22')]||null:null,'attributes':_0x269603['options']?_0x269603[_0x4ae2('0x19')][_0x4ae2('0x1a')]||null:null,'include':_0x269603['options']?_0x269603[_0x4ae2('0x19')][_0x4ae2('0x1b')]?_[_0x4ae2('0x1c')](_0x269603[_0x4ae2('0x19')]['include'],function(_0x349c84){return{'model':db[_0x349c84[_0x4ae2('0x1d')]],'as':_0x349c84['as'],'attributes':_0x349c84[_0x4ae2('0x1a')],'include':_0x349c84[_0x4ae2('0x1b')]?_[_0x4ae2('0x1c')](_0x349c84[_0x4ae2('0x1b')],function(_0x32e3ec){return{'model':db[_0x32e3ec[_0x4ae2('0x1d')]],'as':_0x32e3ec['as'],'attributes':_0x32e3ec[_0x4ae2('0x1a')],'include':_0x32e3ec['include']?_[_0x4ae2('0x1c')](_0x32e3ec['include'],function(_0xe34b4c){return{'model':db[_0xe34b4c[_0x4ae2('0x1d')]],'as':_0xe34b4c['as'],'attributes':_0xe34b4c[_0x4ae2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4ae2('0xc')](function(_0x771c14){if(_0x269603[_0x4ae2('0x19')]['smtp']===!![])_0x771c14[_0x4ae2('0x23')](_0x4ae2('0x24'),_0x771c14[_0x4ae2('0x25')]());logger[_0x4ae2('0x14')]('ShowMailAccount',_0x269603);logger[_0x4ae2('0xf')](_0x4ae2('0x1f'),_0x269603,JSON[_0x4ae2('0x10')](_0x771c14));_0x3542df(_0x771c14);})[_0x4ae2('0x16')](function(_0x232243){logger[_0x4ae2('0x11')](_0x4ae2('0x1f'),_0x232243[_0x4ae2('0x13')],_0x269603);_0x386687(_0x2904f1[_0x4ae2('0x11')](0x1f4,_0x232243[_0x4ae2('0x13')]));});});};exports[_0x4ae2('0x26')]=function(_0x57801a){var _0x2c3676=this;return new Promise(function(_0x3f0b3f,_0x23f120){var _0x1473e6={'body':_0x57801a['body'],'channel':'mail'};var _0xd46eed=_[_0x4ae2('0x27')](_[_0x4ae2('0x28')](db[_0x4ae2('0x29')]['rawAttributes']),[_0x4ae2('0x2a'),_0x4ae2('0x2b'),'CompanyId',_0x4ae2('0x2c')]);var _0x2a85eb=![];if(_0x57801a[_0x4ae2('0x2d')]['id']){delete _0x57801a['body']['id'];}if(_[_0x4ae2('0x2e')](_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x2f')])){return _0x23f120(_0x2c3676[_0x4ae2('0x11')](0x1f4,_0x4ae2('0x30')));}if(_[_0x4ae2('0x2e')](_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x2d')])||_0x57801a['body'][_0x4ae2('0x2d')]===''){return _0x23f120(_0x2c3676[_0x4ae2('0x11')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x4ae2('0x2e')](_0x57801a[_0x4ae2('0x2d')]['mapKey'])){return _0x23f120(_0x2c3676[_0x4ae2('0x11')](0x1f4,_0x4ae2('0x31')+_0xd46eed));}if(!_['includes'](_0xd46eed,_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x32')])){return _0x23f120(_0x2c3676[_0x4ae2('0x11')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xd46eed));}var _0x4fc82f={};_0x4fc82f[_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x32')]]=_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x2f')];return db['MailAccount'][_0x4ae2('0x20')]({'where':{'id':_0x57801a[_0x4ae2('0x33')]['id']},'include':[{'model':db[_0x4ae2('0x34')],'as':'List','include':[{'model':db[_0x4ae2('0x29')],'as':_0x4ae2('0x35'),'where':_0x4fc82f,'limit':0x1,'order':[[_0x4ae2('0x2b'),'DESC']]}]},{'model':db[_0x4ae2('0x36')],'as':_0x4ae2('0x37')},{'model':db[_0x4ae2('0x38')],'as':_0x4ae2('0x39'),'include':[{'model':db[_0x4ae2('0x3a')],'as':_0x4ae2('0x3a')}]}]})[_0x4ae2('0xc')](function(_0x2fe532){if(_0x2fe532&&_0x2fe532[_0x4ae2('0x3b')]){var _0xf6d12a=_0x2fe532['get']({'plain':!![]});_0x1473e6[_0x4ae2('0x33')]=_[_0x4ae2('0x3c')](_0xf6d12a,[_0x4ae2('0x37'),_0x4ae2('0x3b')]);_0x1473e6[_0x4ae2('0x33')][_0x4ae2('0x24')]=_0x2fe532[_0x4ae2('0x25')]();_0x1473e6[_0x4ae2('0x3d')]=_0xf6d12a['Applications'];_0x1473e6[_0x4ae2('0x3e')]=_0xf6d12a[_0x4ae2('0x3b')];_0x1473e6['applications']=_[_0x4ae2('0x3f')](_0x1473e6[_0x4ae2('0x3d')],['priority'],[_0x4ae2('0x40')]);if(_0x1473e6['account']&&_0x1473e6[_0x4ae2('0x33')]['autoclose']){_0x1473e6[_0x4ae2('0x3d')][_0x4ae2('0x41')]({'id':0x0,'priority':_0x1473e6[_0x4ae2('0x3d')][_0x4ae2('0x42')]+0x1,'app':_0x4ae2('0x43'),'appdata':_0x4ae2('0x44'),'interval':_0x4ae2('0x45')});}if(_0x1473e6[_0x4ae2('0x33')][_0x4ae2('0x37')]){delete _0x1473e6['account'][_0x4ae2('0x37')];}if(_0x1473e6[_0x4ae2('0x33')][_0x4ae2('0x3b')]){delete _0x1473e6[_0x4ae2('0x33')]['List'];}if(_0xf6d12a[_0x4ae2('0x3b')][_0x4ae2('0x35')][_0x4ae2('0x42')]){return _0xf6d12a['List']['Contacts'][0x0];}var _0x70ece4=_[_0x4ae2('0x8')](_0x57801a[_0x4ae2('0x2d')],{'firstName':_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x2f')],'ListId':_0xf6d12a[_0x4ae2('0x2c')]});_0x70ece4[_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x32')]]=_0x57801a[_0x4ae2('0x2d')]['from'];return db[_0x4ae2('0x29')]['create'](_0x70ece4);}else{throw new Error(_0x4ae2('0x46'));}})[_0x4ae2('0xc')](function(_0x28e7a8){_0x1473e6[_0x4ae2('0x47')]=_0x28e7a8;if(_0x28e7a8){if(!_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x13')][_0x4ae2('0x48')]){_0x57801a[_0x4ae2('0x2d')]['message']['messageId']=rs[_0x4ae2('0x49')]()+'\x20'+_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x13')]['from'];}var _0x5872ca={'ContactId':_0x28e7a8['id'],'MailAccountId':_0x57801a[_0x4ae2('0x33')]['id'],'inReplyTo':_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x13')][_0x4ae2('0x48')],'to':_0x57801a[_0x4ae2('0x2d')]['message']['from'],'cc':_0x57801a['body'][_0x4ae2('0x13')]['cc'],'subject':_0x57801a['body']['message'][_0x4ae2('0x4a')],'attach':_0x57801a['body'][_0x4ae2('0x13')]['attach'],'lastMsgAt':moment()[_0x4ae2('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x4ae2('0x4c')]['find']({'where':{'closed':![],'MailAccountId':_0x57801a[_0x4ae2('0x33')]['id']},'include':[{'model':db[_0x4ae2('0x4d')],'as':_0x4ae2('0x4e'),'attributes':[_0x4ae2('0x48')],'where':{'messageId':_0x57801a[_0x4ae2('0x2d')]['message']['inReplyTo']}}]})[_0x4ae2('0xc')](function(_0x256d2f){if(_0x256d2f){return[_0x256d2f,![]];}return db['MailInteraction'][_0x4ae2('0x4f')](_0x5872ca)[_0x4ae2('0xc')](function(_0x517800){return[_0x517800,!![]];});});}else{throw new Error(_0x4ae2('0x50'));}})[_0x4ae2('0x51')](function(_0x49c58c,_0x56b88d){if(_0x49c58c){_0x2a85eb=_0x56b88d;if(!_0x56b88d){return _0x49c58c[_0x4ae2('0x52')]({'inReplyTo':_0x57801a[_0x4ae2('0x2d')]['message'][_0x4ae2('0x48')],'to':_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x13')][_0x4ae2('0x2f')],'cc':_0x57801a['body'][_0x4ae2('0x13')]['cc'],'subject':_0x57801a[_0x4ae2('0x2d')]['message'][_0x4ae2('0x4a')],'attach':_0x49c58c[_0x4ae2('0x53')]?_0x49c58c[_0x4ae2('0x53')]:_0x57801a['body']['message'][_0x4ae2('0x53')],'substatus':null,'substatusAt':moment()['format'](_0x4ae2('0x54')),'lastMsgAt':moment()['format'](_0x4ae2('0x54')),'lastMsgDirection':'in'});}else{return _0x49c58c;}}})['then'](function(_0x2758c0){_0x1473e6['interaction']=_0x2758c0[_0x4ae2('0x55')]({'plain':!![]});_0x1473e6['interaction']['created']=_0x2a85eb;return db[_0x4ae2('0x4d')][_0x4ae2('0x4f')]({'body':_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x2d')],'MailAccountId':_0x57801a[_0x4ae2('0x33')]['id'],'MailInteractionId':_0x2758c0['id'],'direction':'in','ContactId':_0x1473e6[_0x4ae2('0x47')]['id'],'messageId':_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x13')][_0x4ae2('0x48')],'from':_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x13')][_0x4ae2('0x2f')],'to':_0x57801a['body'][_0x4ae2('0x13')]['to'],'cc':_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x13')]['cc'],'subject':_0x57801a[_0x4ae2('0x2d')]['message'][_0x4ae2('0x4a')],'attach':_0x57801a['body'][_0x4ae2('0x13')][_0x4ae2('0x53')],'Attachments':_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x13')][_0x4ae2('0x56')],'originTo':_0x57801a[_0x4ae2('0x2d')]['message'][_0x4ae2('0x57')],'originCc':_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x13')]['originCc'],'bcc':_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x13')][_0x4ae2('0x58')],'ChatWebsiteId':_0x57801a['body'][_0x4ae2('0x13')][_0x4ae2('0x59')]||null,'originChannel':_0x57801a[_0x4ae2('0x2d')]['message'][_0x4ae2('0x5a')]||_0x4ae2('0x5b'),'ChatOfflineMessageId':_0x57801a[_0x4ae2('0x2d')][_0x4ae2('0x13')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x4ae2('0x5c')],'as':_0x4ae2('0x5d')}]});})[_0x4ae2('0xc')](function(_0x98272b){_0x1473e6[_0x4ae2('0x13')]=_0x98272b;if(!_0x1473e6[_0x4ae2('0x5e')][_0x4ae2('0x5f')]){return;}return db['User']['find']({'attributes':['id',_0x4ae2('0x60')],'where':{'id':_0x1473e6[_0x4ae2('0x5e')][_0x4ae2('0x5f')]}});})[_0x4ae2('0xc')](function(_0x222e62){if(_0x222e62){_0x1473e6[_0x4ae2('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4ae2('0x61'),'appdata':_0x222e62[_0x4ae2('0x60')]+','+(_0x1473e6[_0x4ae2('0x33')][_0x4ae2('0x62')]||0xa),'interval':_0x4ae2('0x45')});}if(!_0x1473e6[_0x4ae2('0x5e')]['queueId']){return;}return db[_0x4ae2('0x63')][_0x4ae2('0x20')]({'attributes':['id',_0x4ae2('0x60')],'where':{'id':_0x1473e6[_0x4ae2('0x5e')][_0x4ae2('0x64')]}});})[_0x4ae2('0xc')](function(_0x5efbe9){if(_0x5efbe9){_0x1473e6['applications'][_0x4ae2('0x65')]({'id':0x0,'priority':0x1,'app':_0x4ae2('0x66'),'appdata':_0x5efbe9['name']+','+(_0x1473e6[_0x4ae2('0x33')][_0x4ae2('0x67')]||0x12c),'interval':_0x4ae2('0x45')});}return respondWithRpcPromise(_0x4ae2('0x68'),_0x4ae2('0x69'),_0x1473e6);})[_0x4ae2('0xc')](function(_0xc4748b){_0x3f0b3f(_0xc4748b);})['catch'](function(_0xde9c0b){_0x23f120(_0x2c3676[_0x4ae2('0x11')](0x1f4,_0xde9c0b[_0x4ae2('0x13')]));});});}; \ No newline at end of file +var _0x5075=['name','unshift','agent','*,*,*,*','queueId','waitForTheAssignedQueue','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./mailAccount.socket','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','debug','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','smtpOptions','getSmtpOptions','applications','Applications','orderBy','priority','asc','autoclose','push','length','close','create','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','format','interaction','get','created','originTo','originCc','originChannel','Email','Attachment','Attachments','UserId','User'];(function(_0x32a804,_0x2b4402){var _0x485a4a=function(_0x347e2e){while(--_0x347e2e){_0x32a804['push'](_0x32a804['shift']());}};_0x485a4a(++_0x2b4402);}(_0x5075,0x73));var _0x5507=function(_0x5b710b,_0x103f64){_0x5b710b=_0x5b710b-0x0;var _0x40ccbe=_0x5075[_0x5b710b];return _0x40ccbe;};'use strict';var _=require(_0x5507('0x0'));var moment=require(_0x5507('0x1'));var BPromise=require(_0x5507('0x2'));var rs=require(_0x5507('0x3'));var Redis=require(_0x5507('0x4'));var db=require(_0x5507('0x5'))['db'];var logger=require(_0x5507('0x6'))('rpc');var config=require(_0x5507('0x7'));var jayson=require(_0x5507('0x8'));var client=jayson[_0x5507('0x9')]['http']({'port':0x232c});config['redis']=_[_0x5507('0xa')](config[_0x5507('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5507('0xc'))(new Redis(config[_0x5507('0xb')]));require(_0x5507('0xd'))['register'](socket);function respondWithRpcPromise(_0x5b2591,_0xe8c49,_0x441bdc){return new BPromise(function(_0xbbb0fc,_0x36c9eb){return client['request'](_0x5b2591,_0x441bdc)[_0x5507('0xe')](function(_0x1a6792){logger['info'](_0x5507('0xf'),_0xe8c49,_0x5507('0x10'));logger['debug'](_0x5507('0x11'),_0xe8c49,_0x5507('0x10'),JSON[_0x5507('0x12')](_0x1a6792));if(_0x1a6792[_0x5507('0x13')]){if(_0x1a6792[_0x5507('0x13')][_0x5507('0x14')]===0x1f4){logger['error'](_0x5507('0xf'),_0xe8c49,_0x1a6792[_0x5507('0x13')][_0x5507('0x15')]);return _0x36c9eb(_0x1a6792[_0x5507('0x13')]['message']);}logger[_0x5507('0x13')](_0x5507('0xf'),_0xe8c49,_0x1a6792[_0x5507('0x13')][_0x5507('0x15')]);return _0xbbb0fc(_0x1a6792[_0x5507('0x13')][_0x5507('0x15')]);}else{logger[_0x5507('0x16')](_0x5507('0xf'),_0xe8c49,_0x5507('0x10'));_0xbbb0fc(_0x1a6792[_0x5507('0x17')][_0x5507('0x15')]);}})[_0x5507('0x18')](function(_0x3822dd){logger['error'](_0x5507('0xf'),_0xe8c49,_0x3822dd);_0x36c9eb(_0x3822dd);});});}exports[_0x5507('0x19')]=function(_0x4054c6){var _0x193eda=this;return new Promise(function(_0x54f473,_0x1dc53e){return db[_0x5507('0x1a')][_0x5507('0x1b')]({'raw':_0x4054c6[_0x5507('0x1c')]?_0x4054c6[_0x5507('0x1c')][_0x5507('0x1d')]===undefined?!![]:![]:!![],'where':_0x4054c6['options']?_0x4054c6[_0x5507('0x1c')][_0x5507('0x1e')]||null:null,'attributes':_0x4054c6[_0x5507('0x1c')]?_0x4054c6[_0x5507('0x1c')][_0x5507('0x1f')]||null:null,'limit':_0x4054c6[_0x5507('0x1c')]?_0x4054c6[_0x5507('0x1c')][_0x5507('0x20')]||null:null,'include':_0x4054c6[_0x5507('0x1c')]?_0x4054c6[_0x5507('0x1c')][_0x5507('0x21')]?_[_0x5507('0x22')](_0x4054c6[_0x5507('0x1c')][_0x5507('0x21')],function(_0x1a2203){return{'model':db[_0x1a2203['model']],'as':_0x1a2203['as'],'attributes':_0x1a2203[_0x5507('0x1f')],'include':_0x1a2203['include']?_[_0x5507('0x22')](_0x1a2203['include'],function(_0xa66a01){return{'model':db[_0xa66a01[_0x5507('0x23')]],'as':_0xa66a01['as'],'attributes':_0xa66a01['attributes'],'include':_0xa66a01['include']?_[_0x5507('0x22')](_0xa66a01[_0x5507('0x21')],function(_0x5912d4){return{'model':db[_0x5912d4[_0x5507('0x23')]],'as':_0x5912d4['as'],'attributes':_0x5912d4[_0x5507('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5507('0xe')](function(_0x38f4d9){logger[_0x5507('0x16')](_0x5507('0x19'),_0x4054c6);logger['debug'](_0x5507('0x19'),_0x4054c6,JSON[_0x5507('0x12')](_0x38f4d9));_0x54f473(_0x38f4d9);})[_0x5507('0x18')](function(_0x38f0f5){logger[_0x5507('0x13')]('GetMailAccount',_0x38f0f5['message'],_0x4054c6);_0x1dc53e(_0x193eda[_0x5507('0x13')](0x1f4,_0x38f0f5[_0x5507('0x15')]));});});};exports[_0x5507('0x24')]=function(_0x10704d){var _0x5e6f25=this;return new Promise(function(_0x777eb7,_0x13b6e5){return db[_0x5507('0x1a')][_0x5507('0x25')]({'raw':_0x10704d[_0x5507('0x1c')]?_0x10704d[_0x5507('0x1c')][_0x5507('0x1d')]===undefined?!![]:![]:!![],'where':_0x10704d[_0x5507('0x1c')]?_0x10704d['options'][_0x5507('0x1e')]||null:null,'attributes':_0x10704d[_0x5507('0x1c')]?_0x10704d[_0x5507('0x1c')]['attributes']||null:null,'include':_0x10704d['options']?_0x10704d[_0x5507('0x1c')][_0x5507('0x21')]?_[_0x5507('0x22')](_0x10704d[_0x5507('0x1c')][_0x5507('0x21')],function(_0x574fc6){return{'model':db[_0x574fc6['model']],'as':_0x574fc6['as'],'attributes':_0x574fc6[_0x5507('0x1f')],'include':_0x574fc6[_0x5507('0x21')]?_[_0x5507('0x22')](_0x574fc6[_0x5507('0x21')],function(_0x5dcd57){return{'model':db[_0x5dcd57['model']],'as':_0x5dcd57['as'],'attributes':_0x5dcd57[_0x5507('0x1f')],'include':_0x5dcd57['include']?_[_0x5507('0x22')](_0x5dcd57[_0x5507('0x21')],function(_0xe421){return{'model':db[_0xe421[_0x5507('0x23')]],'as':_0xe421['as'],'attributes':_0xe421[_0x5507('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5507('0xe')](function(_0x1c8506){if(_0x10704d[_0x5507('0x1c')][_0x5507('0x26')]===!![])_0x1c8506[_0x5507('0x27')]('smtpOptions',_0x1c8506['getSmtpOptions']());logger['info']('ShowMailAccount',_0x10704d);logger[_0x5507('0x28')](_0x5507('0x24'),_0x10704d,JSON[_0x5507('0x12')](_0x1c8506));_0x777eb7(_0x1c8506);})[_0x5507('0x18')](function(_0x2b32a5){logger[_0x5507('0x13')](_0x5507('0x24'),_0x2b32a5[_0x5507('0x15')],_0x10704d);_0x13b6e5(_0x5e6f25[_0x5507('0x13')](0x1f4,_0x2b32a5[_0x5507('0x15')]));});});};exports[_0x5507('0x29')]=function(_0x2e2307){var _0x2db0b2=this;return new Promise(function(_0x4418de,_0x4fe79b){var _0x53b3f3={'body':_0x2e2307['body'],'channel':_0x5507('0x2a')};var _0x41283f=_[_0x5507('0x2b')](_[_0x5507('0x2c')](db[_0x5507('0x2d')][_0x5507('0x2e')]),[_0x5507('0x2f'),_0x5507('0x30'),_0x5507('0x31'),_0x5507('0x32')]);var _0x1a2df8=![];if(_0x2e2307[_0x5507('0x33')]['id']){delete _0x2e2307[_0x5507('0x33')]['id'];}if(_[_0x5507('0x34')](_0x2e2307[_0x5507('0x33')][_0x5507('0x35')])){return _0x4fe79b(_0x2db0b2[_0x5507('0x13')](0x1f4,_0x5507('0x36')));}if(_[_0x5507('0x34')](_0x2e2307['body'][_0x5507('0x33')])||_0x2e2307[_0x5507('0x33')]['body']===''){return _0x4fe79b(_0x2db0b2['error'](0x1f4,_0x5507('0x37')));}if(_[_0x5507('0x34')](_0x2e2307[_0x5507('0x33')][_0x5507('0x38')])){return _0x4fe79b(_0x2db0b2[_0x5507('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x41283f));}if(!_[_0x5507('0x39')](_0x41283f,_0x2e2307[_0x5507('0x33')][_0x5507('0x38')])){return _0x4fe79b(_0x2db0b2['error'](0x1f4,_0x5507('0x3a')+_0x41283f));}var _0x33022e={};_0x33022e[_0x2e2307[_0x5507('0x33')][_0x5507('0x38')]]=_0x2e2307[_0x5507('0x33')]['from'];return db[_0x5507('0x1a')]['find']({'where':{'id':_0x2e2307[_0x5507('0x3b')]['id']},'include':[{'model':db[_0x5507('0x3c')],'as':_0x5507('0x3d'),'include':[{'model':db[_0x5507('0x2d')],'as':_0x5507('0x3e'),'where':_0x33022e,'limit':0x1,'order':[[_0x5507('0x30'),_0x5507('0x3f')]]}]},{'model':db[_0x5507('0x40')],'as':'Applications'},{'model':db[_0x5507('0x41')],'as':_0x5507('0x42'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x39b20f){if(_0x39b20f&&_0x39b20f['List']){var _0x403d03=_0x39b20f['get']({'plain':!![]});_0x53b3f3[_0x5507('0x3b')]=_['omit'](_0x403d03,['Applications',_0x5507('0x3d')]);_0x53b3f3[_0x5507('0x3b')][_0x5507('0x43')]=_0x39b20f[_0x5507('0x44')]();_0x53b3f3[_0x5507('0x45')]=_0x403d03[_0x5507('0x46')];_0x53b3f3['list']=_0x403d03[_0x5507('0x3d')];_0x53b3f3[_0x5507('0x45')]=_[_0x5507('0x47')](_0x53b3f3['applications'],[_0x5507('0x48')],[_0x5507('0x49')]);if(_0x53b3f3[_0x5507('0x3b')]&&_0x53b3f3[_0x5507('0x3b')][_0x5507('0x4a')]){_0x53b3f3[_0x5507('0x45')][_0x5507('0x4b')]({'id':0x0,'priority':_0x53b3f3[_0x5507('0x45')][_0x5507('0x4c')]+0x1,'app':_0x5507('0x4d'),'appdata':_0x5507('0x4a'),'interval':'*,*,*,*'});}if(_0x53b3f3['account'][_0x5507('0x46')]){delete _0x53b3f3[_0x5507('0x3b')][_0x5507('0x46')];}if(_0x53b3f3[_0x5507('0x3b')][_0x5507('0x3d')]){delete _0x53b3f3[_0x5507('0x3b')][_0x5507('0x3d')];}if(_0x403d03[_0x5507('0x3d')][_0x5507('0x3e')][_0x5507('0x4c')]){return _0x403d03[_0x5507('0x3d')][_0x5507('0x3e')][0x0];}var _0x3e044c=_[_0x5507('0xa')](_0x2e2307[_0x5507('0x33')],{'firstName':_0x2e2307[_0x5507('0x33')]['from'],'ListId':_0x403d03[_0x5507('0x32')]});_0x3e044c[_0x2e2307['body']['mapKey']]=_0x2e2307[_0x5507('0x33')][_0x5507('0x35')];return db[_0x5507('0x2d')][_0x5507('0x4e')](_0x3e044c);}else{throw new Error('List\x20not\x20found');}})[_0x5507('0xe')](function(_0x2f41a9){_0x53b3f3[_0x5507('0x4f')]=_0x2f41a9;if(_0x2f41a9){if(!_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x50')]){_0x2e2307['body'][_0x5507('0x15')][_0x5507('0x50')]=rs[_0x5507('0x51')]()+'\x20'+_0x2e2307['body']['message'][_0x5507('0x35')];}var _0x49eed9={'ContactId':_0x2f41a9['id'],'MailAccountId':_0x2e2307[_0x5507('0x3b')]['id'],'inReplyTo':_0x2e2307[_0x5507('0x33')]['message'][_0x5507('0x50')],'to':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x35')],'cc':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')]['cc'],'subject':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x52')],'attach':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x53')],'lastMsgAt':moment()['format'](_0x5507('0x54')),'lastMsgDirection':'in'};return db[_0x5507('0x55')][_0x5507('0x25')]({'where':{'closed':![],'MailAccountId':_0x2e2307[_0x5507('0x3b')]['id']},'include':[{'model':db[_0x5507('0x56')],'as':'Messages','attributes':[_0x5507('0x50')],'where':{'messageId':_0x2e2307['body'][_0x5507('0x15')][_0x5507('0x57')]}}]})[_0x5507('0xe')](function(_0x54c009){if(_0x54c009){return[_0x54c009,![]];}return db[_0x5507('0x55')][_0x5507('0x4e')](_0x49eed9)[_0x5507('0xe')](function(_0x56632b){return[_0x56632b,!![]];});});}else{throw new Error(_0x5507('0x58'));}})['spread'](function(_0x3dca7d,_0x5545ad){if(_0x3dca7d){_0x1a2df8=_0x5545ad;if(!_0x5545ad){return _0x3dca7d['update']({'inReplyTo':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x50')],'to':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x35')],'cc':_0x2e2307['body']['message']['cc'],'subject':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x52')],'attach':_0x3dca7d[_0x5507('0x53')]?_0x3dca7d['attach']:_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x53')],'substatus':null,'substatusAt':moment()[_0x5507('0x59')](_0x5507('0x54')),'lastMsgAt':moment()[_0x5507('0x59')](_0x5507('0x54')),'lastMsgDirection':'in'});}else{return _0x3dca7d;}}})['then'](function(_0x3802dd){_0x53b3f3[_0x5507('0x5a')]=_0x3802dd[_0x5507('0x5b')]({'plain':!![]});_0x53b3f3['interaction'][_0x5507('0x5c')]=_0x1a2df8;return db['MailMessage']['create']({'body':_0x2e2307['body'][_0x5507('0x33')],'MailAccountId':_0x2e2307[_0x5507('0x3b')]['id'],'MailInteractionId':_0x3802dd['id'],'direction':'in','ContactId':_0x53b3f3[_0x5507('0x4f')]['id'],'messageId':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x50')],'from':_0x2e2307[_0x5507('0x33')]['message'][_0x5507('0x35')],'to':_0x2e2307['body'][_0x5507('0x15')]['to'],'cc':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')]['cc'],'subject':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x52')],'attach':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x53')],'Attachments':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')]['attachments'],'originTo':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x5d')],'originCc':_0x2e2307['body'][_0x5507('0x15')][_0x5507('0x5e')],'bcc':_0x2e2307['body'][_0x5507('0x15')]['bcc'],'ChatWebsiteId':_0x2e2307['body'][_0x5507('0x15')]['ChatWebsiteId']||null,'originChannel':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')][_0x5507('0x5f')]||_0x5507('0x60'),'ChatOfflineMessageId':_0x2e2307[_0x5507('0x33')][_0x5507('0x15')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x5507('0x61')],'as':_0x5507('0x62')}]});})[_0x5507('0xe')](function(_0x75aa3c){_0x53b3f3[_0x5507('0x15')]=_0x75aa3c;if(!_0x53b3f3[_0x5507('0x5a')][_0x5507('0x63')]){return;}return db[_0x5507('0x64')][_0x5507('0x25')]({'attributes':['id',_0x5507('0x65')],'where':{'id':_0x53b3f3[_0x5507('0x5a')][_0x5507('0x63')]}});})['then'](function(_0x255b14){if(_0x255b14){_0x53b3f3[_0x5507('0x45')][_0x5507('0x66')]({'id':0x0,'priority':0x0,'app':_0x5507('0x67'),'appdata':_0x255b14[_0x5507('0x65')]+','+(_0x53b3f3[_0x5507('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0x5507('0x68')});}if(!_0x53b3f3['interaction'][_0x5507('0x69')]){return;}return db['MailQueue']['find']({'attributes':['id',_0x5507('0x65')],'where':{'id':_0x53b3f3[_0x5507('0x5a')][_0x5507('0x69')]}});})[_0x5507('0xe')](function(_0x447e8d){if(_0x447e8d){_0x53b3f3['applications'][_0x5507('0x66')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x447e8d[_0x5507('0x65')]+','+(_0x53b3f3[_0x5507('0x3b')][_0x5507('0x6a')]||0x12c),'interval':_0x5507('0x68')});}return respondWithRpcPromise('Start',_0x5507('0x6b'),_0x53b3f3);})[_0x5507('0xe')](function(_0x42bef4){_0x4418de(_0x42bef4);})['catch'](function(_0x56500e){_0x4fe79b(_0x2db0b2[_0x5507('0x13')](0x1f4,_0x56500e[_0x5507('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 4c203f0..a41b54d 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 _0xc911=['register','length','mailAccount:','./mailAccount.events','removeListener'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xc911,0x1c0));var _0x1c91=function(_0x3acc1b,_0x59da12){_0x3acc1b=_0x3acc1b-0x0;var _0x5e9885=_0xc911[_0x3acc1b];return _0x5e9885;};'use strict';var MailAccountEvents=require(_0x1c91('0x0'));var events=['save','remove','update'];function createListener(_0x236efb,_0x3b4503){return function(_0xd3425){_0x3b4503['emit'](_0x236efb,_0xd3425);};}function removeListener(_0x1cad53,_0x2fe3af){return function(){MailAccountEvents[_0x1c91('0x1')](_0x1cad53,_0x2fe3af);};}exports[_0x1c91('0x2')]=function(_0x5261cc){for(var _0x14d26f=0x0,_0x4e82da=events[_0x1c91('0x3')];_0x14d26f<_0x4e82da;_0x14d26f++){var _0x38a86e=events[_0x14d26f];var _0x436080=createListener(_0x1c91('0x4')+_0x38a86e,_0x5261cc);MailAccountEvents['on'](_0x38a86e,_0x436080);}}; \ No newline at end of file +var _0x90aa=['register','length','./mailAccount.events','save','update','emit','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x90aa,0x152));var _0xa90a=function(_0x2baec6,_0x1ce648){_0x2baec6=_0x2baec6-0x0;var _0x5bac72=_0x90aa[_0x2baec6];return _0x5bac72;};'use strict';var MailAccountEvents=require(_0xa90a('0x0'));var events=[_0xa90a('0x1'),'remove',_0xa90a('0x2')];function createListener(_0x12fa47,_0x586ab4){return function(_0x410de4){_0x586ab4[_0xa90a('0x3')](_0x12fa47,_0x410de4);};}function removeListener(_0x48c6b0,_0x138683){return function(){MailAccountEvents[_0xa90a('0x4')](_0x48c6b0,_0x138683);};}exports[_0xa90a('0x5')]=function(_0x5b320a){for(var _0x2d6858=0x0,_0x22593c=events[_0xa90a('0x6')];_0x2d6858<_0x22593c;_0x2d6858++){var _0x16c4e0=events[_0x2d6858];var _0x46c9ed=createListener('mailAccount:'+_0x16c4e0,_0x5b320a);MailAccountEvents['on'](_0x16c4e0,_0x46c9ed);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index f0bc776..5005715 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 _0xcd7b=['update','delete','/:id','isAuthenticated','exports','multer','util','path','express','fs-extra','../../components/auth/service','get','show'];(function(_0x2d4fee,_0xc38b94){var _0x265b33=function(_0x315350){while(--_0x315350){_0x2d4fee['push'](_0x2d4fee['shift']());}};_0x265b33(++_0xc38b94);}(_0xcd7b,0x1bf));var _0xbcd7=function(_0x4b6129,_0x46e37a){_0x4b6129=_0x4b6129-0x0;var _0x1f1d28=_0xcd7b[_0x4b6129];return _0x1f1d28;};'use strict';var multer=require(_0xbcd7('0x0'));var util=require(_0xbcd7('0x1'));var path=require(_0xbcd7('0x2'));var timeout=require('connect-timeout');var express=require(_0xbcd7('0x3'));var router=express['Router']();var fs_extra=require(_0xbcd7('0x4'));var auth=require(_0xbcd7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0xbcd7('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xbcd7('0x7')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbcd7('0x8')]);router[_0xbcd7('0x9')](_0xbcd7('0xa'),auth[_0xbcd7('0xb')](),controller['destroy']);module[_0xbcd7('0xc')]=router; \ No newline at end of file +var _0xde54=['./mailApplication.controller','get','isAuthenticated','show','put','/:id','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2facd6,_0x2aaf16){var _0x4fbcb0=function(_0x4a8838){while(--_0x4a8838){_0x2facd6['push'](_0x2facd6['shift']());}};_0x4fbcb0(++_0x2aaf16);}(_0xde54,0x1ac));var _0x4de5=function(_0x4a7aba,_0x519e84){_0x4a7aba=_0x4a7aba-0x0;var _0x15d1e8=_0xde54[_0x4a7aba];return _0x15d1e8;};'use strict';var multer=require('multer');var util=require(_0x4de5('0x0'));var path=require(_0x4de5('0x1'));var timeout=require(_0x4de5('0x2'));var express=require(_0x4de5('0x3'));var router=express[_0x4de5('0x4')]();var fs_extra=require(_0x4de5('0x5'));var auth=require(_0x4de5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4de5('0x7'));router[_0x4de5('0x8')]('/:id',auth[_0x4de5('0x9')](),controller[_0x4de5('0xa')]);router[_0x4de5('0xb')](_0x4de5('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4de5('0xd')](_0x4de5('0xc'),auth[_0x4de5('0x9')](),controller['destroy']);module[_0x4de5('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b4a8f05..1b91852 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 _0x866a=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x866a,0x156));var _0xa866=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0x866a[_0x333fed];return _0x12cac2;};'use strict';var Sequelize=require('sequelize');module[_0xa866('0x0')]={'priority':{'type':Sequelize[_0xa866('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa866('0x2')],'allowNull':![],'defaultValue':_0xa866('0x3')},'appdata':{'type':Sequelize[_0xa866('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa866('0x2')],'defaultValue':_0xa866('0x5')}}; \ No newline at end of file +var _0x4b09=['*,*,*,*','sequelize','STRING','TEXT'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0x4b09,0x1cd));var _0x94b0=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x4b09[_0x368fb9];return _0x4892fb;};'use strict';var Sequelize=require(_0x94b0('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x94b0('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x94b0('0x2')]()},'description':{'type':Sequelize[_0x94b0('0x1')]},'interval':{'type':Sequelize[_0x94b0('0x1')],'defaultValue':_0x94b0('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 88b032c..d67c7d9 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 _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x189c70,_0xd1c0bd){var _0x553b4e=function(_0x4def4d){while(--_0x4def4d){_0x189c70['push'](_0x189c70['shift']());}};_0x553b4e(++_0xd1c0bd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x35b5e3,_0xa50391){var _0x3a7cff=function(_0xd83327){while(--_0xd83327){_0x35b5e3['push'](_0x35b5e3['shift']());}};_0x3a7cff(++_0xa50391);}(_0x70e0,0x17b));var _0x070e=function(_0x53c103,_0xc56ec8){_0x53c103=_0x53c103-0x0;var _0x72809=_0x70e0[_0x53c103];return _0x72809;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ba07dd3..9f537c1 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 _0x1e3a=['api','moment','request-promise','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x2bb79f,_0x538a00){var _0x1526a7=function(_0x3b710e){while(--_0x3b710e){_0x2bb79f['push'](_0x2bb79f['shift']());}};_0x1526a7(++_0x538a00);}(_0x1e3a,0x83));var _0xa1e3=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0x1e3a[_0x438912];return _0x18112f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa1e3('0x0'))(_0xa1e3('0x1'));var moment=require(_0xa1e3('0x2'));var BPromise=require('bluebird');var rp=require(_0xa1e3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa1e3('0x4'));module[_0xa1e3('0x5')]=function(_0x3cc721,_0x1717de){return _0x3cc721[_0xa1e3('0x6')](_0xa1e3('0x7'),attributes,{'tableName':_0xa1e3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa1e3('0x9'),'collate':_0xa1e3('0xa')});}; \ No newline at end of file +var _0xcfb4=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcfb4,0xa9));var _0x4cfb=function(_0x343e57,_0x5bcb1a){_0x343e57=_0x343e57-0x0;var _0x241c72=_0xcfb4[_0x343e57];return _0x241c72;};'use strict';var _=require(_0x4cfb('0x0'));var util=require(_0x4cfb('0x1'));var logger=require(_0x4cfb('0x2'))(_0x4cfb('0x3'));var moment=require('moment');var BPromise=require(_0x4cfb('0x4'));var rp=require(_0x4cfb('0x5'));var fs=require('fs');var path=require(_0x4cfb('0x6'));var rimraf=require(_0x4cfb('0x7'));var config=require(_0x4cfb('0x8'));var attributes=require(_0x4cfb('0x9'));module['exports']=function(_0x4500cb,_0x2a2100){return _0x4500cb[_0x4cfb('0xa')](_0x4cfb('0xb'),attributes,{'tableName':_0x4cfb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4cfb('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 92511ae..6ef8b1c 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 _0xc513=['UpdateMailApplication','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailApplication','update','options','raw','where','attributes','then'];(function(_0x15c51a,_0x15941f){var _0x304bf6=function(_0x359447){while(--_0x359447){_0x15c51a['push'](_0x15c51a['shift']());}};_0x304bf6(++_0x15941f);}(_0xc513,0x8e));var _0x3c51=function(_0x313ba0,_0xcbdd6f){_0x313ba0=_0x313ba0-0x0;var _0x591d00=_0xc513[_0x313ba0];return _0x591d00;};'use strict';var _=require(_0x3c51('0x0'));var util=require(_0x3c51('0x1'));var moment=require(_0x3c51('0x2'));var BPromise=require('bluebird');var rs=require(_0x3c51('0x3'));var fs=require('fs');var Redis=require(_0x3c51('0x4'));var db=require(_0x3c51('0x5'))['db'];var utils=require(_0x3c51('0x6'));var logger=require(_0x3c51('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3c51('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fc346,_0x20d5f6,_0x2611a6){return new BPromise(function(_0x4769d0,_0x52adef){return client['request'](_0x3fc346,_0x2611a6)['then'](function(_0xe5a1dc){logger[_0x3c51('0x9')](_0x3c51('0xa'),_0x20d5f6,_0x3c51('0xb'));logger[_0x3c51('0xc')](_0x3c51('0xd'),_0x20d5f6,_0x3c51('0xb'),JSON[_0x3c51('0xe')](_0xe5a1dc));if(_0xe5a1dc[_0x3c51('0xf')]){if(_0xe5a1dc[_0x3c51('0xf')][_0x3c51('0x10')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x20d5f6,_0xe5a1dc[_0x3c51('0xf')][_0x3c51('0x11')]);return _0x52adef(_0xe5a1dc[_0x3c51('0xf')][_0x3c51('0x11')]);}logger[_0x3c51('0xf')]('MailApplication,\x20%s,\x20%s',_0x20d5f6,_0xe5a1dc[_0x3c51('0xf')][_0x3c51('0x11')]);return _0x4769d0(_0xe5a1dc[_0x3c51('0xf')][_0x3c51('0x11')]);}else{logger[_0x3c51('0x9')](_0x3c51('0xa'),_0x20d5f6,_0x3c51('0xb'));_0x4769d0(_0xe5a1dc[_0x3c51('0x12')][_0x3c51('0x11')]);}})['catch'](function(_0x1dec29){logger[_0x3c51('0xf')]('MailApplication,\x20%s,\x20%s',_0x20d5f6,_0x1dec29);_0x52adef(_0x1dec29);});});}exports['UpdateMailApplication']=function(_0x2378af){var _0x1a7d92=this;return new Promise(function(_0x32b43c,_0x89a948){return db[_0x3c51('0x13')][_0x3c51('0x14')](_0x2378af['body'],{'raw':_0x2378af['options']?_0x2378af[_0x3c51('0x15')][_0x3c51('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2378af[_0x3c51('0x15')]?_0x2378af[_0x3c51('0x15')][_0x3c51('0x17')]||null:null,'attributes':_0x2378af[_0x3c51('0x15')]?_0x2378af[_0x3c51('0x15')][_0x3c51('0x18')]||null:null,'limit':_0x2378af[_0x3c51('0x15')]?_0x2378af[_0x3c51('0x15')]['limit']||null:null})[_0x3c51('0x19')](function(_0xbe7d6e){logger[_0x3c51('0x9')](_0x3c51('0x1a'),_0x2378af);logger[_0x3c51('0xc')](_0x3c51('0x1a'),_0x2378af,JSON[_0x3c51('0xe')](_0xbe7d6e));_0x32b43c(_0xbe7d6e);})[_0x3c51('0x1b')](function(_0x34ca66){logger[_0x3c51('0xf')]('UpdateMailApplication',_0x34ca66[_0x3c51('0x11')],_0x2378af);_0x89a948(_0x1a7d92[_0x3c51('0xf')](0x1f4,_0x34ca66[_0x3c51('0x11')]));});});}; \ No newline at end of file +var _0xbc1d=['MailApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','UpdateMailApplication'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xbc1d,0x12a));var _0xdbc1=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0xbc1d[_0x4cfc1d];return _0x1c01a0;};'use strict';var _=require(_0xdbc1('0x0'));var util=require(_0xdbc1('0x1'));var moment=require(_0xdbc1('0x2'));var BPromise=require('bluebird');var rs=require(_0xdbc1('0x3'));var fs=require('fs');var Redis=require(_0xdbc1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdbc1('0x5'));var logger=require(_0xdbc1('0x6'))('rpc');var config=require(_0xdbc1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdbc1('0x8')][_0xdbc1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28b00c,_0x18fccf,_0x1606b0){return new BPromise(function(_0x43ef54,_0x37cd8e){return client[_0xdbc1('0xa')](_0x28b00c,_0x1606b0)[_0xdbc1('0xb')](function(_0x559a39){logger[_0xdbc1('0xc')](_0xdbc1('0xd'),_0x18fccf,_0xdbc1('0xe'));logger[_0xdbc1('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x18fccf,'request\x20sent',JSON[_0xdbc1('0x10')](_0x559a39));if(_0x559a39[_0xdbc1('0x11')]){if(_0x559a39[_0xdbc1('0x11')]['code']===0x1f4){logger['error'](_0xdbc1('0xd'),_0x18fccf,_0x559a39[_0xdbc1('0x11')][_0xdbc1('0x12')]);return _0x37cd8e(_0x559a39[_0xdbc1('0x11')]['message']);}logger['error'](_0xdbc1('0xd'),_0x18fccf,_0x559a39[_0xdbc1('0x11')]['message']);return _0x43ef54(_0x559a39[_0xdbc1('0x11')]['message']);}else{logger[_0xdbc1('0xc')]('MailApplication,\x20%s,\x20%s',_0x18fccf,'request\x20sent');_0x43ef54(_0x559a39['result'][_0xdbc1('0x12')]);}})[_0xdbc1('0x13')](function(_0x2290a0){logger['error'](_0xdbc1('0xd'),_0x18fccf,_0x2290a0);_0x37cd8e(_0x2290a0);});});}exports[_0xdbc1('0x14')]=function(_0x3775df){var _0x52a4fa=this;return new Promise(function(_0x1f9141,_0x483280){return db[_0xdbc1('0x15')][_0xdbc1('0x16')](_0x3775df[_0xdbc1('0x17')],{'raw':_0x3775df['options']?_0x3775df[_0xdbc1('0x18')][_0xdbc1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3775df['options']?_0x3775df['options'][_0xdbc1('0x1a')]||null:null,'attributes':_0x3775df[_0xdbc1('0x18')]?_0x3775df[_0xdbc1('0x18')][_0xdbc1('0x1b')]||null:null,'limit':_0x3775df[_0xdbc1('0x18')]?_0x3775df[_0xdbc1('0x18')][_0xdbc1('0x1c')]||null:null})[_0xdbc1('0xb')](function(_0x2aba8b){logger[_0xdbc1('0xc')]('UpdateMailApplication',_0x3775df);logger[_0xdbc1('0xf')](_0xdbc1('0x14'),_0x3775df,JSON[_0xdbc1('0x10')](_0x2aba8b));_0x1f9141(_0x2aba8b);})[_0xdbc1('0x13')](function(_0x3708fa){logger[_0xdbc1('0x11')](_0xdbc1('0x14'),_0x3708fa[_0xdbc1('0x12')],_0x3775df);_0x483280(_0x52a4fa[_0xdbc1('0x11')](0x1f4,_0x3708fa[_0xdbc1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index f60a8cc..f9cc45a 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 _0x2390=['create','post','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','destroy','removeTags','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download'];(function(_0x5669c7,_0x387508){var _0x1c09d9=function(_0x424e96){while(--_0x424e96){_0x5669c7['push'](_0x5669c7['shift']());}};_0x1c09d9(++_0x387508);}(_0x2390,0x146));var _0x0239=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x2390[_0x376b45];return _0x2341b3;};'use strict';var express=require(_0x0239('0x0'));var router=express['Router']();var auth=require(_0x0239('0x1'));var interaction=require(_0x0239('0x2'));var controller=require(_0x0239('0x3'));router[_0x0239('0x4')]('/',auth[_0x0239('0x5')](),controller['index']);router['get'](_0x0239('0x6'),auth[_0x0239('0x5')](),controller[_0x0239('0x7')]);router[_0x0239('0x4')](_0x0239('0x8'),auth[_0x0239('0x5')](),controller['show']);router[_0x0239('0x4')]('/:id/messages',auth[_0x0239('0x5')](),controller['getMessages']);router[_0x0239('0x4')](_0x0239('0x9'),auth[_0x0239('0x5')](),controller['download']);router['post']('/',auth[_0x0239('0x5')](),controller[_0x0239('0xa')]);router[_0x0239('0xb')](_0x0239('0xc'),auth[_0x0239('0x5')](),controller[_0x0239('0xd')]);router[_0x0239('0xb')](_0x0239('0xe'),auth['isAuthenticated'](),interaction[_0x0239('0xf')](_0x0239('0x10'),_0x0239('0x11')),controller[_0x0239('0x12')]);router[_0x0239('0x13')](_0x0239('0x8'),auth[_0x0239('0x5')](),interaction[_0x0239('0xf')](_0x0239('0x10'),'mailinteraction:update'),controller[_0x0239('0x14')]);router[_0x0239('0x15')]('/:id',auth[_0x0239('0x5')](),interaction['tracked'](_0x0239('0x10'),'mailinteraction:destroy'),controller[_0x0239('0x16')]);router[_0x0239('0x15')](_0x0239('0xe'),auth[_0x0239('0x5')](),controller[_0x0239('0x17')]);module['exports']=router; \ No newline at end of file +var _0x7be5=['mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','post','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0x7be5,0x126));var _0x57be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7be5[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0x57be('0x0'));var router=express[_0x57be('0x1')]();var auth=require(_0x57be('0x2'));var interaction=require(_0x57be('0x3'));var controller=require('./mailInteraction.controller');router[_0x57be('0x4')]('/',auth[_0x57be('0x5')](),controller[_0x57be('0x6')]);router['get'](_0x57be('0x7'),auth['isAuthenticated'](),controller[_0x57be('0x8')]);router[_0x57be('0x4')](_0x57be('0x9'),auth[_0x57be('0x5')](),controller[_0x57be('0xa')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x57be('0xb')]);router['get']('/:id/download',auth[_0x57be('0x5')](),controller[_0x57be('0xc')]);router[_0x57be('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x57be('0xd')](_0x57be('0xe'),auth[_0x57be('0x5')](),controller[_0x57be('0xf')]);router[_0x57be('0xd')](_0x57be('0x10'),auth[_0x57be('0x5')](),interaction[_0x57be('0x11')](_0x57be('0x12'),_0x57be('0x13')),controller[_0x57be('0x14')]);router[_0x57be('0x15')](_0x57be('0x9'),auth[_0x57be('0x5')](),interaction[_0x57be('0x11')]('mail',_0x57be('0x16')),controller[_0x57be('0x17')]);router[_0x57be('0x18')]('/:id',auth[_0x57be('0x5')](),interaction[_0x57be('0x11')](_0x57be('0x12'),'mailinteraction:destroy'),controller['destroy']);router[_0x57be('0x18')](_0x57be('0x10'),auth[_0x57be('0x5')](),controller[_0x57be('0x19')]);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 ea18ecb..f976849 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 _0xc536=['STRING','TEXT','long','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN','DATE'];(function(_0x102da0,_0x539e28){var _0x41361c=function(_0x460e1d){while(--_0x460e1d){_0x102da0['push'](_0x102da0['shift']());}};_0x41361c(++_0x539e28);}(_0xc536,0x1b3));var _0x6c53=function(_0x19d4c4,_0x2bb4e0){_0x19d4c4=_0x19d4c4-0x0;var _0x43d651=_0xc536[_0x19d4c4];return _0x43d651;};'use strict';var Sequelize=require(_0x6c53('0x0'));var iconv=require(_0x6c53('0x1'));module[_0x6c53('0x2')]={'closed':{'type':Sequelize[_0x6c53('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6c53('0x4')]},'disposition':{'type':Sequelize[_0x6c53('0x5')]},'secondDisposition':{'type':Sequelize[_0x6c53('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6c53('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6c53('0x6')](_0x6c53('0x7'))},'subject':{'type':Sequelize[_0x6c53('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6c53('0x4')]},'substatus':{'type':Sequelize[_0x6c53('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x6c53('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6c53('0x8')]('in',_0x6c53('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6c53('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x6c53('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6c53('0xa')]}}; \ No newline at end of file +var _0x4df2=['DATE','ENUM','out','INTEGER','sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x1c910c,_0x32695a){var _0x21d962=function(_0x12a589){while(--_0x12a589){_0x1c910c['push'](_0x1c910c['shift']());}};_0x21d962(++_0x32695a);}(_0x4df2,0xe5));var _0x24df=function(_0x3ce5e4,_0x27bd40){_0x3ce5e4=_0x3ce5e4-0x0;var _0x43c8f9=_0x4df2[_0x3ce5e4];return _0x43c8f9;};'use strict';var Sequelize=require(_0x24df('0x0'));var iconv=require('iconv');module[_0x24df('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x24df('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x24df('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x24df('0x2')](0x1fe)},'to':{'type':Sequelize[_0x24df('0x2')]},'cc':{'type':Sequelize[_0x24df('0x3')]('long')},'subject':{'type':Sequelize[_0x24df('0x3')]()},'attach':{'type':Sequelize[_0x24df('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x24df('0x5')]},'substatus':{'type':Sequelize[_0x24df('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x24df('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x24df('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x24df('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x24df('0x6')]('in',_0x24df('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x24df('0x4')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x24df('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 521a93d..129377d 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 _0x7ff3=['unix','join','root','server','tmp','files','attachments','push','Attachment','from','bcc','subject','Messages','get','mkdirSync','each','missing.recipient@your.company.com','createdAt','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','moment','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','limit','undefined','offset','set','Content-Range','json','update','destroy','error','stack','name','send','index','map','MailInteraction','fieldName','type','getOptions','findAll','query','then','catch','show','params','model','keys','rawAttributes','intersection','fields','attributes','length','includeAll','options','create','body','find','describe','addMessage','MailMessage','ids','omit','findOne','hasOwnProperty','order','sort','where','filters','pick','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','include','inlineCss','true','rows','addTags','setTags','emit','mailInteractionTags:save','removeTags','download'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ff3,0x175));var _0x37ff=function(_0x4ffa64,_0x271035){_0x4ffa64=_0x4ffa64-0x0;var _0x5da001=_0x7ff3[_0x4ffa64];return _0x5da001;};'use strict';var emlformat=require(_0x37ff('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x37ff('0x1'));var BPromise=require('bluebird');var util=require(_0x37ff('0x2'));var path=require(_0x37ff('0x3'));var fs=require('fs');var _=require(_0x37ff('0x4'));var juice=require(_0x37ff('0x5'));var Redis=require(_0x37ff('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x37ff('0x7'));var logger=require(_0x37ff('0x8'))(_0x37ff('0x9'));var config=require(_0x37ff('0xa'));var db=require(_0x37ff('0xb'))['db'];var htmlEntities=require(_0x37ff('0xc'));config[_0x37ff('0xd')]=_[_0x37ff('0xe')](config[_0x37ff('0xd')],{'host':_0x37ff('0xf'),'port':0x18eb});var socket=require(_0x37ff('0x10'))(new Redis(config[_0x37ff('0xd')]));require(_0x37ff('0x11'))[_0x37ff('0x12')](socket);function respondWithStatusCode(_0x5d519d,_0x19d020){_0x19d020=_0x19d020||0xcc;return function(_0x165a18){if(_0x165a18){return _0x5d519d[_0x37ff('0x13')](_0x19d020);}return _0x5d519d[_0x37ff('0x14')](_0x19d020)[_0x37ff('0x15')]();};}function respondWithResult(_0xb660d0,_0x47acf2){_0x47acf2=_0x47acf2||0xc8;return function(_0xc5b52d){if(_0xc5b52d){return _0xb660d0[_0x37ff('0x14')](_0x47acf2)['json'](_0xc5b52d);}};}function respondWithFilteredResult(_0x3ab278,_0xd77fba){return function(_0x2d312c){if(_0x2d312c){var _0x2612b3=typeof _0xd77fba['offset']==='undefined'&&typeof _0xd77fba[_0x37ff('0x16')]===_0x37ff('0x17');var _0x5a12a8=_0x2d312c['count'];var _0x329711=_0x2612b3?0x0:_0xd77fba[_0x37ff('0x18')];var _0x2e7fbd=_0x2612b3?_0x2d312c['count']:_0xd77fba['offset']+_0xd77fba['limit'];var _0x596b48;if(_0x2e7fbd>=_0x5a12a8){_0x2e7fbd=_0x5a12a8;_0x596b48=0xc8;}else{_0x596b48=0xce;}_0x3ab278[_0x37ff('0x14')](_0x596b48);return _0x3ab278[_0x37ff('0x19')](_0x37ff('0x1a'),_0x329711+'-'+_0x2e7fbd+'/'+_0x5a12a8)[_0x37ff('0x1b')](_0x2d312c);}return null;};}function saveUpdates(_0x492b15){return function(_0x38d32a){if(_0x38d32a){return _0x38d32a[_0x37ff('0x1c')](_0x492b15)['then'](function(_0x498d99){return _0x498d99;});}return null;};}function removeEntity(_0x2c74a0){return function(_0x3f177f){if(_0x3f177f){return _0x3f177f[_0x37ff('0x1d')]()['then'](function(){_0x2c74a0[_0x37ff('0x14')](0xcc)[_0x37ff('0x15')]();});}};}function handleEntityNotFound(_0x4fe5e9){return function(_0x298417){if(!_0x298417){_0x4fe5e9[_0x37ff('0x13')](0x194);}return _0x298417;};}function handleError(_0x294b44,_0x2be2d1){_0x2be2d1=_0x2be2d1||0x1f4;return function(_0x462829){logger[_0x37ff('0x1e')](_0x462829[_0x37ff('0x1f')]);if(_0x462829[_0x37ff('0x20')]){delete _0x462829[_0x37ff('0x20')];}_0x294b44[_0x37ff('0x14')](_0x2be2d1)[_0x37ff('0x21')](_0x462829);};}exports[_0x37ff('0x22')]=function(_0x1d46da,_0x41ee1e){var _0x1bee5f={};var _0x180c88=_[_0x37ff('0x23')](db[_0x37ff('0x24')]['rawAttributes'],function(_0x4a0c38){return{'name':_0x4a0c38[_0x37ff('0x25')],'type':_0x4a0c38[_0x37ff('0x26')]['key']};});_0x1bee5f=qs[_0x37ff('0x27')](_0x180c88,_0x1d46da);return interaction[_0x37ff('0x28')]('mail',_0x1d46da[_0x37ff('0x29')],_0x1d46da['user'],_0x1bee5f,_0x180c88)[_0x37ff('0x2a')](respondWithFilteredResult(_0x41ee1e,_0x1bee5f))[_0x37ff('0x2b')](handleError(_0x41ee1e,null));};exports[_0x37ff('0x2c')]=function(_0x1cb15d,_0x1c5da2){var _0x59d35d={'raw':![],'where':{'id':_0x1cb15d[_0x37ff('0x2d')]['id']}},_0x19c605={};_0x19c605[_0x37ff('0x2e')]=_[_0x37ff('0x2f')](db[_0x37ff('0x24')][_0x37ff('0x30')]);_0x19c605[_0x37ff('0x29')]=_[_0x37ff('0x2f')](_0x1cb15d[_0x37ff('0x29')]);_0x19c605['filters']=_[_0x37ff('0x31')](_0x19c605[_0x37ff('0x2e')],_0x19c605['query']);_0x59d35d['attributes']=_['intersection'](_0x19c605[_0x37ff('0x2e')],qs[_0x37ff('0x32')](_0x1cb15d[_0x37ff('0x29')]['fields']));_0x59d35d[_0x37ff('0x33')]=_0x59d35d['attributes'][_0x37ff('0x34')]?_0x59d35d[_0x37ff('0x33')]:_0x19c605[_0x37ff('0x2e')];if(_0x1cb15d['query'][_0x37ff('0x35')]){_0x59d35d['include']=[{'all':!![]}];}_0x59d35d=_['merge']({},_0x59d35d,_0x1cb15d[_0x37ff('0x36')]);return db['MailInteraction']['find'](_0x59d35d)[_0x37ff('0x2a')](handleEntityNotFound(_0x1c5da2,null))[_0x37ff('0x2a')](respondWithResult(_0x1c5da2,null))[_0x37ff('0x2b')](handleError(_0x1c5da2,null));};exports[_0x37ff('0x37')]=function(_0x2018dd,_0x453e58){return db[_0x37ff('0x24')]['create'](_0x2018dd['body'],{})[_0x37ff('0x2a')](respondWithResult(_0x453e58,0xc9))[_0x37ff('0x2b')](handleError(_0x453e58,null));};exports[_0x37ff('0x1c')]=function(_0x529597,_0x5865ca){if(_0x529597[_0x37ff('0x38')]['id']){delete _0x529597['body']['id'];}return db[_0x37ff('0x24')]['find']({'where':{'id':_0x529597[_0x37ff('0x2d')]['id']}})[_0x37ff('0x2a')](handleEntityNotFound(_0x5865ca,null))[_0x37ff('0x2a')](saveUpdates(_0x529597[_0x37ff('0x38')],null))[_0x37ff('0x2a')](respondWithResult(_0x5865ca,null))['catch'](handleError(_0x5865ca,null));};exports[_0x37ff('0x1d')]=function(_0x454601,_0x3091ff){return db['MailInteraction'][_0x37ff('0x39')]({'where':{'id':_0x454601['params']['id']}})[_0x37ff('0x2a')](handleEntityNotFound(_0x3091ff,null))[_0x37ff('0x2a')](removeEntity(_0x3091ff,null))[_0x37ff('0x2b')](handleError(_0x3091ff,null));};exports['describe']=function(_0x82d8d0,_0x2aed18){return db['MailInteraction'][_0x37ff('0x3a')]()['then'](respondWithResult(_0x2aed18,null))[_0x37ff('0x2b')](handleError(_0x2aed18,null));};exports[_0x37ff('0x3b')]=function(_0x154363,_0x571f83){return db[_0x37ff('0x3c')]['find']({'where':{'id':_0x154363[_0x37ff('0x2d')]['id']}})[_0x37ff('0x2a')](handleEntityNotFound(_0x571f83,null))[_0x37ff('0x2a')](function(_0x3cbec1){if(_0x3cbec1){return _0x3cbec1[_0x37ff('0x3b')](_0x154363['body'][_0x37ff('0x3d')],_[_0x37ff('0x3e')](_0x154363[_0x37ff('0x38')],[_0x37ff('0x3d'),'id'])||{});}})[_0x37ff('0x2a')](respondWithResult(_0x571f83,null))['catch'](handleError(_0x571f83,null));};exports['getMessages']=function(_0x63adde,_0x4ba22a){var _0x22b839={'raw':![],'where':{}};var _0x1f055a={};var _0x2b7100={'count':0x0,'rows':[]};return db[_0x37ff('0x24')][_0x37ff('0x3f')]({'where':{'id':_0x63adde[_0x37ff('0x2d')]['id']}})[_0x37ff('0x2a')](handleEntityNotFound(_0x4ba22a,null))[_0x37ff('0x2a')](function(_0x1c0a92){if(_0x1c0a92){_0x1f055a[_0x37ff('0x2e')]=_[_0x37ff('0x2f')](db[_0x37ff('0x3c')][_0x37ff('0x30')]);_0x1f055a[_0x37ff('0x29')]=_[_0x37ff('0x2f')](_0x63adde[_0x37ff('0x29')]);_0x1f055a['filters']=_[_0x37ff('0x31')](_0x1f055a[_0x37ff('0x2e')],_0x1f055a[_0x37ff('0x29')]);_0x22b839['attributes']=_[_0x37ff('0x31')](_0x1f055a[_0x37ff('0x2e')],qs[_0x37ff('0x32')](_0x63adde[_0x37ff('0x29')][_0x37ff('0x32')]));_0x22b839[_0x37ff('0x33')]=_0x22b839[_0x37ff('0x33')]['length']?_0x22b839[_0x37ff('0x33')]:_0x1f055a[_0x37ff('0x2e')];if(!_0x63adde[_0x37ff('0x29')][_0x37ff('0x40')]('nolimit')){_0x22b839['limit']=qs[_0x37ff('0x16')](_0x63adde[_0x37ff('0x29')][_0x37ff('0x16')]);_0x22b839[_0x37ff('0x18')]=qs[_0x37ff('0x18')](_0x63adde[_0x37ff('0x29')][_0x37ff('0x18')]);}_0x22b839[_0x37ff('0x41')]=qs['sort'](_0x63adde[_0x37ff('0x29')][_0x37ff('0x42')]);_0x22b839[_0x37ff('0x43')]=qs[_0x37ff('0x44')](_[_0x37ff('0x45')](_0x63adde[_0x37ff('0x29')],_0x1f055a[_0x37ff('0x44')]));_0x22b839[_0x37ff('0x43')]['MailInteractionId']=_0x1c0a92['id'];if(_0x63adde['query']['filter']){_0x22b839[_0x37ff('0x43')]=_[_0x37ff('0x46')](_0x22b839['where'],{'$or':_[_0x37ff('0x23')](_0x22b839[_0x37ff('0x33')],function(_0x2fd701){var _0x430414={};_0x430414[_0x2fd701]={'$like':'%'+_0x63adde[_0x37ff('0x29')][_0x37ff('0x47')]+'%'};return _0x430414;})});}if(_0x63adde[_0x37ff('0x29')][_0x37ff('0x48')]){var _0x223602=_0x63adde[_0x37ff('0x29')][_0x37ff('0x48')][_0x37ff('0x49')](',');var _0x3d8004={};_0x3d8004[_0x223602[0x0]]={'$gte':moment(_0x223602[0x1])[_0x37ff('0x4a')](_0x37ff('0x4b'))};_0x22b839[_0x37ff('0x43')]=_[_0x37ff('0x46')](_0x22b839[_0x37ff('0x43')],_0x3d8004);}_0x22b839=_['merge']({},_0x22b839,_0x63adde[_0x37ff('0x36')]);return db[_0x37ff('0x3c')][_0x37ff('0x4c')]({'where':_0x22b839[_0x37ff('0x43')]})[_0x37ff('0x2a')](function(_0x4a60c5){_0x2b7100[_0x37ff('0x4c')]=_0x4a60c5;if(_0x63adde[_0x37ff('0x29')][_0x37ff('0x35')]){_0x22b839[_0x37ff('0x4d')]=[{'all':!![]}];}return db[_0x37ff('0x3c')][_0x37ff('0x28')](_0x22b839);})[_0x37ff('0x2a')](function(_0x491a86){if(_0x63adde[_0x37ff('0x29')][_0x37ff('0x4e')]===_0x37ff('0x4f')){for(var _0x1176be=0x0;_0x1176be<_0x491a86[_0x37ff('0x34')];_0x1176be++){_0x491a86[_0x1176be]['body']=juice(_0x491a86[_0x1176be][_0x37ff('0x38')]);}}_0x2b7100[_0x37ff('0x50')]=_0x491a86;return _0x2b7100;});}})[_0x37ff('0x2a')](respondWithFilteredResult(_0x4ba22a,_0x22b839))[_0x37ff('0x2b')](handleError(_0x4ba22a,null));};exports[_0x37ff('0x51')]=function(_0x50fc50,_0x5844a0){return db[_0x37ff('0x24')][_0x37ff('0x39')]({'where':{'id':_0x50fc50[_0x37ff('0x2d')]['id']}})[_0x37ff('0x2a')](handleEntityNotFound(_0x5844a0,null))[_0x37ff('0x2a')](function(_0xcb2f97){if(_0xcb2f97){return _0xcb2f97[_0x37ff('0x52')](_0x50fc50[_0x37ff('0x38')][_0x37ff('0x3d')],_[_0x37ff('0x3e')](_0x50fc50[_0x37ff('0x38')],[_0x37ff('0x3d'),'id'])||{})['spread'](function(){return db['Tag'][_0x37ff('0x28')]({'attributes':['id',_0x37ff('0x20'),'color'],'where':{'id':_0x50fc50[_0x37ff('0x38')][_0x37ff('0x3d')]}});})[_0x37ff('0x2a')](function(_0x20a657){socket[_0x37ff('0x53')](_0x37ff('0x54'),{'id':Number(_0x50fc50[_0x37ff('0x2d')]['id']),'tags':_0x20a657||[]});return{'id':Number(_0x50fc50['params']['id']),'tags':_0x20a657||[]};});}})[_0x37ff('0x2a')](respondWithResult(_0x5844a0,null))[_0x37ff('0x2b')](handleError(_0x5844a0,null));};exports['removeTags']=function(_0x41ef97,_0x362a78){return db[_0x37ff('0x24')][_0x37ff('0x39')]({'where':{'id':_0x41ef97[_0x37ff('0x2d')]['id']}})[_0x37ff('0x2a')](handleEntityNotFound(_0x362a78,null))[_0x37ff('0x2a')](function(_0x5d8d67){if(_0x5d8d67){return _0x5d8d67[_0x37ff('0x55')](_0x41ef97[_0x37ff('0x29')][_0x37ff('0x3d')]);}})[_0x37ff('0x2a')](respondWithStatusCode(_0x362a78,null))['catch'](handleError(_0x362a78,null));};exports[_0x37ff('0x56')]=function(_0x46938c,_0x4429a9){var _0x38c575=moment()[_0x37ff('0x57')]()['toString']();var _0x1c328a=path[_0x37ff('0x58')](config[_0x37ff('0x59')],_0x37ff('0x5a'),'files',_0x37ff('0x5b'));var _0x19c5c4=path[_0x37ff('0x58')](config['root'],_0x37ff('0x5a'),_0x37ff('0x5c'),_0x37ff('0x5d'));var _0x3cbb32=path['join'](_0x1c328a,_0x38c575);var _0x5b3cfd=util[_0x37ff('0x4a')]('transcript-%d-%s.zip',_0x46938c[_0x37ff('0x2d')]['id'],_0x38c575);var _0x68af45=path[_0x37ff('0x58')](_0x1c328a,_0x5b3cfd);var _0x55be0d=[];if(_0x46938c[_0x37ff('0x29')][_0x37ff('0x5d')]){_0x55be0d[_0x37ff('0x5e')]({'model':db[_0x37ff('0x5f')],'as':'Attachments','raw':!![]});}var _0x349e8c=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x37ff('0x38'),_0x37ff('0x60'),'to','cc',_0x37ff('0x61'),_0x37ff('0x62'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x55be0d}];return db[_0x37ff('0x24')][_0x37ff('0x39')]({'where':{'id':_0x46938c[_0x37ff('0x2d')]['id']},'include':_0x349e8c})[_0x37ff('0x2a')](handleEntityNotFound(_0x4429a9,null))[_0x37ff('0x2a')](function(_0x5518d0){if(_0x5518d0&&_0x5518d0[_0x37ff('0x63')]){var _0x44d233=_0x5518d0[_0x37ff('0x64')]({'plain':!![]});fs[_0x37ff('0x65')](_0x3cbb32);return BPromise[_0x37ff('0x66')](_0x44d233[_0x37ff('0x63')],function(_0x510b41,_0x2a4f4a){var _0x3e2bc4={'from':_0x510b41[_0x37ff('0x60')],'to':_0x510b41['to']||_0x37ff('0x67'),'subject':_0x510b41[_0x37ff('0x62')],'html':htmlEntities['decode'](_0x510b41['body']),'headers':{'Date':moment(_0x510b41[_0x37ff('0x68')])[_0x37ff('0x4a')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x510b41['cc']){_0x3e2bc4['headers']['Cc']=_0x510b41['cc'];}if(_0x510b41[_0x37ff('0x61')]){_0x3e2bc4[_0x37ff('0x69')][_0x37ff('0x6a')]=_0x510b41[_0x37ff('0x61')];}return new BPromise(function(_0x109585,_0x22f7d1){if(_0x510b41[_0x37ff('0x6b')]){for(var _0x338157=0x0;_0x338157<_0x510b41[_0x37ff('0x6b')]['length'];_0x338157++){var _0x90d79e=_0x510b41['Attachments'][_0x338157];var _0x3cb8a0=path[_0x37ff('0x58')](_0x19c5c4,_0x90d79e[_0x37ff('0x6c')]);if(fs[_0x37ff('0x6d')](_0x3cb8a0)){_0x3e2bc4[_0x37ff('0x5d')]['push']({'name':_0x90d79e[_0x37ff('0x20')],'contentType':_0x90d79e[_0x37ff('0x26')],'data':fs[_0x37ff('0x6e')](_0x3cb8a0)});}}}emlformat[_0x37ff('0x6f')](_0x3e2bc4,function(_0x274285,_0x4cf9e0){if(_0x274285)return _0x22f7d1(_0x274285);fs[_0x37ff('0x70')](path[_0x37ff('0x58')](_0x3cbb32,util[_0x37ff('0x4a')](_0x37ff('0x71'),_0x2a4f4a)),_0x4cf9e0);return _0x109585(_0x4cf9e0);});});})[_0x37ff('0x2a')](function(){return new BPromise(function(_0x2744a8,_0xed4f9c){zipdir(_0x3cbb32,{'saveTo':_0x68af45},function(_0x501b9d,_0x59fd){if(_0x501b9d)return _0xed4f9c(_0x501b9d);return _0x2744a8(_0x59fd);});})['then'](function(){return new BPromise(function(_0x1272e8,_0x358e46){rimraf(_0x3cbb32,function(_0x10a6c1){if(_0x10a6c1)_0x358e46(_0x10a6c1);return _0x1272e8();});});})[_0x37ff('0x2a')](function(){return _0x4429a9[_0x37ff('0x56')](_0x68af45,_0x5b3cfd,function(_0x4c4360){if(!_0x4c4360)fs[_0x37ff('0x72')](_0x68af45);});});});}else{return _0x4429a9[_0x37ff('0x13')](0xc8);}})['catch'](handleError(_0x4429a9,null));}; \ No newline at end of file +var _0xa58b=['createdAt','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','push','writeFileSync','message%d.eml','download','rimraf','moment','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','MailInteraction','fieldName','type','getOptions','findAll','query','user','catch','show','params','keys','rawAttributes','filters','intersection','attributes','model','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','nolimit','sort','where','pick','MailInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','toString','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','from','bcc','subject'];(function(_0x47fb54,_0x28698c){var _0x1139a7=function(_0x17c781){while(--_0x17c781){_0x47fb54['push'](_0x47fb54['shift']());}};_0x1139a7(++_0x28698c);}(_0xa58b,0x1d6));var _0xba58=function(_0x50dc29,_0x2b2bd9){_0x50dc29=_0x50dc29-0x0;var _0xe74693=_0xa58b[_0x50dc29];return _0xe74693;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba58('0x0'));var zipdir=require('zip-dir');var moment=require(_0xba58('0x1'));var BPromise=require('bluebird');var util=require(_0xba58('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xba58('0x3'));var juice=require(_0xba58('0x4'));var Redis=require(_0xba58('0x5'));var interaction=require(_0xba58('0x6'));var qs=require(_0xba58('0x7'));var logger=require(_0xba58('0x8'))(_0xba58('0x9'));var config=require(_0xba58('0xa'));var db=require(_0xba58('0xb'))['db'];var htmlEntities=require('html-entities');config[_0xba58('0xc')]=_[_0xba58('0xd')](config[_0xba58('0xc')],{'host':_0xba58('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba58('0xc')]));require(_0xba58('0xf'))[_0xba58('0x10')](socket);function respondWithStatusCode(_0x129cf4,_0x1c1ef3){_0x1c1ef3=_0x1c1ef3||0xcc;return function(_0x511b4c){if(_0x511b4c){return _0x129cf4[_0xba58('0x11')](_0x1c1ef3);}return _0x129cf4[_0xba58('0x12')](_0x1c1ef3)[_0xba58('0x13')]();};}function respondWithResult(_0x4db936,_0x5d2303){_0x5d2303=_0x5d2303||0xc8;return function(_0x4ea953){if(_0x4ea953){return _0x4db936['status'](_0x5d2303)[_0xba58('0x14')](_0x4ea953);}};}function respondWithFilteredResult(_0x324b03,_0x135dd9){return function(_0x43dcff){if(_0x43dcff){var _0x3dd693=typeof _0x135dd9[_0xba58('0x15')]===_0xba58('0x16')&&typeof _0x135dd9['limit']==='undefined';var _0x11a697=_0x43dcff[_0xba58('0x17')];var _0x3905ce=_0x3dd693?0x0:_0x135dd9[_0xba58('0x15')];var _0x4a5c07=_0x3dd693?_0x43dcff['count']:_0x135dd9[_0xba58('0x15')]+_0x135dd9[_0xba58('0x18')];var _0x4797da;if(_0x4a5c07>=_0x11a697){_0x4a5c07=_0x11a697;_0x4797da=0xc8;}else{_0x4797da=0xce;}_0x324b03['status'](_0x4797da);return _0x324b03[_0xba58('0x19')](_0xba58('0x1a'),_0x3905ce+'-'+_0x4a5c07+'/'+_0x11a697)[_0xba58('0x14')](_0x43dcff);}return null;};}function saveUpdates(_0xe4a160){return function(_0x4ec423){if(_0x4ec423){return _0x4ec423[_0xba58('0x1b')](_0xe4a160)[_0xba58('0x1c')](function(_0x3c1a5c){return _0x3c1a5c;});}return null;};}function removeEntity(_0x4a3a16){return function(_0x41273f){if(_0x41273f){return _0x41273f[_0xba58('0x1d')]()[_0xba58('0x1c')](function(){_0x4a3a16[_0xba58('0x12')](0xcc)[_0xba58('0x13')]();});}};}function handleEntityNotFound(_0x48c899){return function(_0x2a3736){if(!_0x2a3736){_0x48c899['sendStatus'](0x194);}return _0x2a3736;};}function handleError(_0x88735a,_0x41b1e6){_0x41b1e6=_0x41b1e6||0x1f4;return function(_0x35c272){logger[_0xba58('0x1e')](_0x35c272[_0xba58('0x1f')]);if(_0x35c272['name']){delete _0x35c272[_0xba58('0x20')];}_0x88735a['status'](_0x41b1e6)[_0xba58('0x21')](_0x35c272);};}exports[_0xba58('0x22')]=function(_0x170ff1,_0x5375f0){var _0x1a5490={};var _0xbc0033=_[_0xba58('0x23')](db[_0xba58('0x24')]['rawAttributes'],function(_0xa999f8){return{'name':_0xa999f8[_0xba58('0x25')],'type':_0xa999f8[_0xba58('0x26')]['key']};});_0x1a5490=qs[_0xba58('0x27')](_0xbc0033,_0x170ff1);return interaction[_0xba58('0x28')]('mail',_0x170ff1[_0xba58('0x29')],_0x170ff1[_0xba58('0x2a')],_0x1a5490,_0xbc0033)[_0xba58('0x1c')](respondWithFilteredResult(_0x5375f0,_0x1a5490))[_0xba58('0x2b')](handleError(_0x5375f0,null));};exports[_0xba58('0x2c')]=function(_0x44c6dc,_0x4cd019){var _0x1fb60f={'raw':![],'where':{'id':_0x44c6dc[_0xba58('0x2d')]['id']}},_0x3b3e07={};_0x3b3e07['model']=_[_0xba58('0x2e')](db[_0xba58('0x24')][_0xba58('0x2f')]);_0x3b3e07[_0xba58('0x29')]=_[_0xba58('0x2e')](_0x44c6dc[_0xba58('0x29')]);_0x3b3e07[_0xba58('0x30')]=_[_0xba58('0x31')](_0x3b3e07['model'],_0x3b3e07[_0xba58('0x29')]);_0x1fb60f[_0xba58('0x32')]=_[_0xba58('0x31')](_0x3b3e07[_0xba58('0x33')],qs[_0xba58('0x34')](_0x44c6dc[_0xba58('0x29')][_0xba58('0x34')]));_0x1fb60f['attributes']=_0x1fb60f[_0xba58('0x32')][_0xba58('0x35')]?_0x1fb60f['attributes']:_0x3b3e07[_0xba58('0x33')];if(_0x44c6dc[_0xba58('0x29')][_0xba58('0x36')]){_0x1fb60f[_0xba58('0x37')]=[{'all':!![]}];}_0x1fb60f=_[_0xba58('0x38')]({},_0x1fb60f,_0x44c6dc[_0xba58('0x39')]);return db[_0xba58('0x24')][_0xba58('0x3a')](_0x1fb60f)['then'](handleEntityNotFound(_0x4cd019,null))[_0xba58('0x1c')](respondWithResult(_0x4cd019,null))[_0xba58('0x2b')](handleError(_0x4cd019,null));};exports[_0xba58('0x3b')]=function(_0xcaab45,_0x1e30f8){return db[_0xba58('0x24')]['create'](_0xcaab45[_0xba58('0x3c')],{})['then'](respondWithResult(_0x1e30f8,0xc9))[_0xba58('0x2b')](handleError(_0x1e30f8,null));};exports['update']=function(_0x4370b1,_0x39daf3){if(_0x4370b1[_0xba58('0x3c')]['id']){delete _0x4370b1['body']['id'];}return db[_0xba58('0x24')][_0xba58('0x3a')]({'where':{'id':_0x4370b1['params']['id']}})[_0xba58('0x1c')](handleEntityNotFound(_0x39daf3,null))[_0xba58('0x1c')](saveUpdates(_0x4370b1[_0xba58('0x3c')],null))['then'](respondWithResult(_0x39daf3,null))[_0xba58('0x2b')](handleError(_0x39daf3,null));};exports[_0xba58('0x1d')]=function(_0xabd5ac,_0x14ab76){return db['MailInteraction']['find']({'where':{'id':_0xabd5ac[_0xba58('0x2d')]['id']}})[_0xba58('0x1c')](handleEntityNotFound(_0x14ab76,null))[_0xba58('0x1c')](removeEntity(_0x14ab76,null))[_0xba58('0x2b')](handleError(_0x14ab76,null));};exports['describe']=function(_0x306421,_0x32d985){return db[_0xba58('0x24')][_0xba58('0x3d')]()[_0xba58('0x1c')](respondWithResult(_0x32d985,null))[_0xba58('0x2b')](handleError(_0x32d985,null));};exports[_0xba58('0x3e')]=function(_0x2e0498,_0x33c3f5){return db[_0xba58('0x3f')][_0xba58('0x3a')]({'where':{'id':_0x2e0498[_0xba58('0x2d')]['id']}})['then'](handleEntityNotFound(_0x33c3f5,null))[_0xba58('0x1c')](function(_0x40ab5d){if(_0x40ab5d){return _0x40ab5d[_0xba58('0x3e')](_0x2e0498[_0xba58('0x3c')][_0xba58('0x40')],_[_0xba58('0x41')](_0x2e0498['body'],[_0xba58('0x40'),'id'])||{});}})['then'](respondWithResult(_0x33c3f5,null))[_0xba58('0x2b')](handleError(_0x33c3f5,null));};exports[_0xba58('0x42')]=function(_0x4626fa,_0x4d3923){var _0x2557b6={'raw':![],'where':{}};var _0x13adb3={};var _0x40b4d3={'count':0x0,'rows':[]};return db[_0xba58('0x24')][_0xba58('0x43')]({'where':{'id':_0x4626fa['params']['id']}})[_0xba58('0x1c')](handleEntityNotFound(_0x4d3923,null))[_0xba58('0x1c')](function(_0x106ee5){if(_0x106ee5){_0x13adb3['model']=_[_0xba58('0x2e')](db[_0xba58('0x3f')][_0xba58('0x2f')]);_0x13adb3[_0xba58('0x29')]=_[_0xba58('0x2e')](_0x4626fa[_0xba58('0x29')]);_0x13adb3[_0xba58('0x30')]=_[_0xba58('0x31')](_0x13adb3[_0xba58('0x33')],_0x13adb3['query']);_0x2557b6[_0xba58('0x32')]=_[_0xba58('0x31')](_0x13adb3['model'],qs[_0xba58('0x34')](_0x4626fa[_0xba58('0x29')][_0xba58('0x34')]));_0x2557b6[_0xba58('0x32')]=_0x2557b6[_0xba58('0x32')][_0xba58('0x35')]?_0x2557b6['attributes']:_0x13adb3['model'];if(!_0x4626fa[_0xba58('0x29')]['hasOwnProperty'](_0xba58('0x44'))){_0x2557b6[_0xba58('0x18')]=qs[_0xba58('0x18')](_0x4626fa[_0xba58('0x29')][_0xba58('0x18')]);_0x2557b6[_0xba58('0x15')]=qs[_0xba58('0x15')](_0x4626fa[_0xba58('0x29')][_0xba58('0x15')]);}_0x2557b6['order']=qs['sort'](_0x4626fa[_0xba58('0x29')][_0xba58('0x45')]);_0x2557b6[_0xba58('0x46')]=qs[_0xba58('0x30')](_[_0xba58('0x47')](_0x4626fa['query'],_0x13adb3[_0xba58('0x30')]));_0x2557b6[_0xba58('0x46')][_0xba58('0x48')]=_0x106ee5['id'];if(_0x4626fa[_0xba58('0x29')]['filter']){_0x2557b6['where']=_['merge'](_0x2557b6[_0xba58('0x46')],{'$or':_['map'](_0x2557b6[_0xba58('0x32')],function(_0xd3ea5e){var _0x5b78e8={};_0x5b78e8[_0xd3ea5e]={'$like':'%'+_0x4626fa[_0xba58('0x29')]['filter']+'%'};return _0x5b78e8;})});}if(_0x4626fa[_0xba58('0x29')][_0xba58('0x49')]){var _0x5edc44=_0x4626fa[_0xba58('0x29')][_0xba58('0x49')][_0xba58('0x4a')](',');var _0x3cdc2a={};_0x3cdc2a[_0x5edc44[0x0]]={'$gte':moment(_0x5edc44[0x1])[_0xba58('0x4b')](_0xba58('0x4c'))};_0x2557b6[_0xba58('0x46')]=_[_0xba58('0x38')](_0x2557b6[_0xba58('0x46')],_0x3cdc2a);}_0x2557b6=_[_0xba58('0x38')]({},_0x2557b6,_0x4626fa['options']);return db[_0xba58('0x3f')]['count']({'where':_0x2557b6[_0xba58('0x46')]})[_0xba58('0x1c')](function(_0x257aa0){_0x40b4d3[_0xba58('0x17')]=_0x257aa0;if(_0x4626fa[_0xba58('0x29')][_0xba58('0x36')]){_0x2557b6['include']=[{'all':!![]}];}return db['MailMessage'][_0xba58('0x28')](_0x2557b6);})[_0xba58('0x1c')](function(_0x2316ac){if(_0x4626fa[_0xba58('0x29')][_0xba58('0x4d')]===_0xba58('0x4e')){for(var _0x5a8329=0x0;_0x5a8329<_0x2316ac[_0xba58('0x35')];_0x5a8329++){_0x2316ac[_0x5a8329][_0xba58('0x3c')]=juice(_0x2316ac[_0x5a8329]['body']);}}_0x40b4d3[_0xba58('0x4f')]=_0x2316ac;return _0x40b4d3;});}})['then'](respondWithFilteredResult(_0x4d3923,_0x2557b6))[_0xba58('0x2b')](handleError(_0x4d3923,null));};exports[_0xba58('0x50')]=function(_0x18699d,_0x1f01ae){return db[_0xba58('0x24')][_0xba58('0x3a')]({'where':{'id':_0x18699d['params']['id']}})[_0xba58('0x1c')](handleEntityNotFound(_0x1f01ae,null))[_0xba58('0x1c')](function(_0x4a790d){if(_0x4a790d){return _0x4a790d[_0xba58('0x51')](_0x18699d[_0xba58('0x3c')]['ids'],_[_0xba58('0x41')](_0x18699d[_0xba58('0x3c')],[_0xba58('0x40'),'id'])||{})[_0xba58('0x52')](function(){return db[_0xba58('0x53')][_0xba58('0x28')]({'attributes':['id',_0xba58('0x20'),_0xba58('0x54')],'where':{'id':_0x18699d[_0xba58('0x3c')][_0xba58('0x40')]}});})[_0xba58('0x1c')](function(_0xcaa4d0){socket[_0xba58('0x55')](_0xba58('0x56'),{'id':Number(_0x18699d[_0xba58('0x2d')]['id']),'tags':_0xcaa4d0||[]});return{'id':Number(_0x18699d[_0xba58('0x2d')]['id']),'tags':_0xcaa4d0||[]};});}})[_0xba58('0x1c')](respondWithResult(_0x1f01ae,null))['catch'](handleError(_0x1f01ae,null));};exports[_0xba58('0x57')]=function(_0x4c658c,_0x1b911d){return db[_0xba58('0x24')][_0xba58('0x3a')]({'where':{'id':_0x4c658c['params']['id']}})[_0xba58('0x1c')](handleEntityNotFound(_0x1b911d,null))[_0xba58('0x1c')](function(_0x133882){if(_0x133882){return _0x133882[_0xba58('0x57')](_0x4c658c[_0xba58('0x29')][_0xba58('0x40')]);}})[_0xba58('0x1c')](respondWithStatusCode(_0x1b911d,null))[_0xba58('0x2b')](handleError(_0x1b911d,null));};exports['download']=function(_0x5159af,_0xbb49f3){var _0x3a4a57=moment()['unix']()[_0xba58('0x58')]();var _0x4ca903=path[_0xba58('0x59')](config[_0xba58('0x5a')],_0xba58('0x5b'),'files','tmp');var _0x3df28c=path[_0xba58('0x59')](config[_0xba58('0x5a')],'server',_0xba58('0x5c'),_0xba58('0x5d'));var _0x3f0baf=path[_0xba58('0x59')](_0x4ca903,_0x3a4a57);var _0x1f4ecc=util['format'](_0xba58('0x5e'),_0x5159af[_0xba58('0x2d')]['id'],_0x3a4a57);var _0x4d8a41=path[_0xba58('0x59')](_0x4ca903,_0x1f4ecc);var _0xf6c8e8=[];if(_0x5159af['query'][_0xba58('0x5d')]){_0xf6c8e8['push']({'model':db[_0xba58('0x5f')],'as':'Attachments','raw':!![]});}var _0x27e0a6=[{'model':db['MailMessage'],'as':_0xba58('0x60'),'attributes':['id',_0xba58('0x3c'),_0xba58('0x61'),'to','cc',_0xba58('0x62'),_0xba58('0x63'),_0xba58('0x64')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0xf6c8e8}];return db[_0xba58('0x24')][_0xba58('0x3a')]({'where':{'id':_0x5159af['params']['id']},'include':_0x27e0a6})[_0xba58('0x1c')](handleEntityNotFound(_0xbb49f3,null))[_0xba58('0x1c')](function(_0x1504ea){if(_0x1504ea&&_0x1504ea[_0xba58('0x60')]){var _0xcf2d60=_0x1504ea['get']({'plain':!![]});fs[_0xba58('0x65')](_0x3f0baf);return BPromise[_0xba58('0x66')](_0xcf2d60[_0xba58('0x60')],function(_0x4330f8,_0x381f23){var _0x10a1ab={'from':_0x4330f8['from'],'to':_0x4330f8['to']||_0xba58('0x67'),'subject':_0x4330f8['subject'],'html':htmlEntities[_0xba58('0x68')](_0x4330f8[_0xba58('0x3c')]),'headers':{'Date':moment(_0x4330f8['createdAt'])[_0xba58('0x4b')](_0xba58('0x69'))},'attachments':[]};if(_0x4330f8['cc']){_0x10a1ab[_0xba58('0x6a')]['Cc']=_0x4330f8['cc'];}if(_0x4330f8[_0xba58('0x62')]){_0x10a1ab[_0xba58('0x6a')][_0xba58('0x6b')]=_0x4330f8[_0xba58('0x62')];}return new BPromise(function(_0x398a5f,_0x301cbf){if(_0x4330f8[_0xba58('0x6c')]){for(var _0x2a1cf3=0x0;_0x2a1cf3<_0x4330f8[_0xba58('0x6c')][_0xba58('0x35')];_0x2a1cf3++){var _0x563fde=_0x4330f8['Attachments'][_0x2a1cf3];var _0x38510f=path[_0xba58('0x59')](_0x3df28c,_0x563fde[_0xba58('0x6d')]);if(fs['existsSync'](_0x38510f)){_0x10a1ab[_0xba58('0x5d')][_0xba58('0x6e')]({'name':_0x563fde[_0xba58('0x20')],'contentType':_0x563fde[_0xba58('0x26')],'data':fs['readFileSync'](_0x38510f)});}}}emlformat['build'](_0x10a1ab,function(_0x22f89d,_0x68266b){if(_0x22f89d)return _0x301cbf(_0x22f89d);fs[_0xba58('0x6f')](path[_0xba58('0x59')](_0x3f0baf,util[_0xba58('0x4b')](_0xba58('0x70'),_0x381f23)),_0x68266b);return _0x398a5f(_0x68266b);});});})['then'](function(){return new BPromise(function(_0x4d4551,_0x364275){zipdir(_0x3f0baf,{'saveTo':_0x4d8a41},function(_0x26591e,_0x3ec2fa){if(_0x26591e)return _0x364275(_0x26591e);return _0x4d4551(_0x3ec2fa);});})[_0xba58('0x1c')](function(){return new BPromise(function(_0x319442,_0x52bb85){rimraf(_0x3f0baf,function(_0x369131){if(_0x369131)_0x52bb85(_0x369131);return _0x319442();});});})[_0xba58('0x1c')](function(){return _0xbb49f3[_0xba58('0x71')](_0x4d8a41,_0x1f4ecc,function(_0x4e703e){if(!_0x4e703e)fs['unlinkSync'](_0x4d8a41);});});});}else{return _0xbb49f3[_0xba58('0x11')](0xc8);}})['catch'](handleError(_0xbb49f3,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 0cdf82b..0629df1 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 _0x343f=['unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','MailMessage','setMaxListeners','save','then','setDataValue','Users','map','findAll'];(function(_0x256005,_0x1b3837){var _0x464d07=function(_0x1f604c){while(--_0x1f604c){_0x256005['push'](_0x256005['shift']());}};_0x464d07(++_0x1b3837);}(_0x343f,0xb6));var _0xf343=function(_0x1e7d44,_0x157c80){_0x1e7d44=_0x1e7d44-0x0;var _0x1943f5=_0x343f[_0x1e7d44];return _0x1943f5;};'use strict';var EventEmitter=require(_0xf343('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xf343('0x1')];var MailMessage=require('../../mysqldb')['db'][_0xf343('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf343('0x3')](0x0);var events={'afterCreate':_0xf343('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x32f10b){return function(_0x153a85,_0x48dd3f,_0x893cf1){_0x153a85['getUsers']({'attributes':['id'],'raw':!![]})[_0xf343('0x5')](function(_0x3c09ba){_0x153a85[_0xf343('0x6')](_0xf343('0x7'),_0x3c09ba[_0xf343('0x8')](function(_0x5348e4){return{'id':_0x5348e4['id']};}));return MailMessage[_0xf343('0x9')]({'where':{'MailInteractionId':_0x153a85['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf343('0x5')](function(_0x3eccce){_0x153a85['setDataValue'](_0xf343('0xa'),_0x3eccce['length']);MailInteractionEvents[_0xf343('0xb')](_0x32f10b+':'+_0x153a85['id'],_0x153a85);MailInteractionEvents[_0xf343('0xb')](_0x32f10b,_0x153a85);_0x893cf1(null);})[_0xf343('0xc')](_0x893cf1(null));};}for(var e in events){if(events[_0xf343('0xd')](e)){var event=events[e];MailInteraction[_0xf343('0xe')](e,emitEvent(event));}}module[_0xf343('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0xf14f=['hook','exports','events','MailInteraction','../../mysqldb','MailMessage','save','update','getUsers','then','Users','map','findAll','unreadMessages','length','emit','catch'];(function(_0xfe7e73,_0x25efd6){var _0x266de2=function(_0x368250){while(--_0x368250){_0xfe7e73['push'](_0xfe7e73['shift']());}};_0x266de2(++_0x25efd6);}(_0xf14f,0xce));var _0xff14=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0xf14f[_0x480bc8];return _0x28c245;};'use strict';var EventEmitter=require(_0xff14('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xff14('0x1')];var MailMessage=require(_0xff14('0x2'))['db'][_0xff14('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xff14('0x4'),'afterUpdate':_0xff14('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38b7a9){return function(_0x259650,_0x3b24a,_0x1c181e){_0x259650[_0xff14('0x6')]({'attributes':['id'],'raw':!![]})[_0xff14('0x7')](function(_0x268e16){_0x259650['setDataValue'](_0xff14('0x8'),_0x268e16[_0xff14('0x9')](function(_0x2a04eb){return{'id':_0x2a04eb['id']};}));return MailMessage[_0xff14('0xa')]({'where':{'MailInteractionId':_0x259650['id'],'direction':'in','read':![]},'raw':!![]});})[_0xff14('0x7')](function(_0x2bed80){_0x259650['setDataValue'](_0xff14('0xb'),_0x2bed80[_0xff14('0xc')]);MailInteractionEvents[_0xff14('0xd')](_0x38b7a9+':'+_0x259650['id'],_0x259650);MailInteractionEvents[_0xff14('0xd')](_0x38b7a9,_0x259650);_0x1c181e(null);})[_0xff14('0xe')](_0x1c181e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xff14('0xf')](e,emitEvent(event));}}module[_0xff14('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 3b91b93..6943a05 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 _0x07ad=['substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','format','changed','models','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','fti_mail_interactions','subject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07ad,0x84));var _0xd07a=function(_0x279a96,_0x28d0e8){_0x279a96=_0x279a96-0x0;var _0x967f87=_0x07ad[_0x279a96];return _0x967f87;};'use strict';var _=require(_0xd07a('0x0'));var util=require(_0xd07a('0x1'));var logger=require(_0xd07a('0x2'))('api');var moment=require(_0xd07a('0x3'));var BPromise=require(_0xd07a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd07a('0x5'));var rimraf=require(_0xd07a('0x6'));var config=require(_0xd07a('0x7'));var attributes=require(_0xd07a('0x8'));module[_0xd07a('0x9')]=function(_0x4eb6d1,_0x983a7c){return _0x4eb6d1['define']('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xd07a('0xa'),'fields':[_0xd07a('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x474af9,_0x351ebc,_0x1cc5e6){if(_0x474af9[_0xd07a('0xc')]){_0x474af9[_0xd07a('0xd')]=moment()['format'](_0xd07a('0xe'));}if(_0x474af9[_0xd07a('0xf')]){_0x474af9['closedAt']=moment()[_0xd07a('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1cc5e6(null,_0x351ebc);},'beforeUpdate':function(_0x4ba9ed,_0x37c7cd,_0xfca823){if(_0x4ba9ed[_0xd07a('0x11')]('substatus')){_0x4ba9ed[_0xd07a('0xd')]=_0x4ba9ed['substatus']?moment()['format'](_0xd07a('0xe')):null;}if(_0x4ba9ed[_0xd07a('0x11')](_0xd07a('0xf'))){_0x4ba9ed['closedAt']=moment()[_0xd07a('0x10')](_0xd07a('0xe'));_0x4ba9ed[_0xd07a('0xc')]=null;_0x4ba9ed[_0xd07a('0xd')]=null;}_0xfca823(null,_0x4ba9ed);},'afterUpdate':function(_0xae4143,_0x455e15,_0x4beb0b){var _0x15d715=_0x4eb6d1[_0xd07a('0x12')];var _0x42ebbe=_0xae4143['get']({'plain':!![]});if(_0x42ebbe[_0xd07a('0xf')]){return _0x15d715[_0xd07a('0x13')][_0xd07a('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x42ebbe['id']}})['then'](function(){_0x4beb0b();})[_0xd07a('0x15')](function(_0x5d6d62){_0x4beb0b(_0x5d6d62);});}else{_0x4beb0b();}}},'charset':_0xd07a('0x16'),'collate':_0xd07a('0x17')});}; \ No newline at end of file +var _0xb264=['catch','lodash','../../config/logger','api','moment','bluebird','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','substatusAt','models','update','then'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xb264,0x65));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4b26('0x0'));var util=require('util');var logger=require(_0x4b26('0x1'))(_0x4b26('0x2'));var moment=require(_0x4b26('0x3'));var BPromise=require(_0x4b26('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4b26('0x5'));var attributes=require(_0x4b26('0x6'));module[_0x4b26('0x7')]=function(_0x57a4e1,_0x2af441){return _0x57a4e1[_0x4b26('0x8')](_0x4b26('0x9'),attributes,{'tableName':_0x4b26('0xa'),'paranoid':![],'indexes':[{'name':_0x4b26('0xb'),'fields':[_0x4b26('0xc'),'to'],'type':_0x4b26('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5bc38e,_0x6f9158,_0x4c8eef){if(_0x5bc38e[_0x4b26('0xe')]){_0x5bc38e['substatusAt']=moment()['format'](_0x4b26('0xf'));}if(_0x5bc38e[_0x4b26('0x10')]){_0x5bc38e[_0x4b26('0x11')]=moment()[_0x4b26('0x12')](_0x4b26('0xf'));}_0x4c8eef(null,_0x6f9158);},'beforeUpdate':function(_0x29a13f,_0x272174,_0xf7187){if(_0x29a13f[_0x4b26('0x13')]('substatus')){_0x29a13f[_0x4b26('0x14')]=_0x29a13f[_0x4b26('0xe')]?moment()[_0x4b26('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x29a13f[_0x4b26('0x13')]('closed')){_0x29a13f[_0x4b26('0x11')]=moment()[_0x4b26('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x29a13f[_0x4b26('0xe')]=null;_0x29a13f[_0x4b26('0x14')]=null;}_0xf7187(null,_0x29a13f);},'afterUpdate':function(_0xefccbc,_0x3cbd03,_0x318cfd){var _0x32360a=_0x57a4e1[_0x4b26('0x15')];var _0x999dc7=_0xefccbc['get']({'plain':!![]});if(_0x999dc7['closed']){return _0x32360a['MailMessage'][_0x4b26('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x999dc7['id']}})[_0x4b26('0x17')](function(){_0x318cfd();})[_0x4b26('0x18')](function(_0x2183b3){_0x318cfd(_0x2183b3);});}else{_0x318cfd();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b196ced..e649170 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 _0x139e=['attributes','limit','AddTagsToMailInteraction','MailInteraction','find','addTags','omit','ids','spread','AddTags','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateMailInteraction','update','body','options','raw','where'];(function(_0x270420,_0x1225ba){var _0x52d8d2=function(_0x9bd645){while(--_0x9bd645){_0x270420['push'](_0x270420['shift']());}};_0x52d8d2(++_0x1225ba);}(_0x139e,0xe7));var _0xe139=function(_0x5064b8,_0x4554b1){_0x5064b8=_0x5064b8-0x0;var _0x211914=_0x139e[_0x5064b8];return _0x211914;};'use strict';var _=require(_0xe139('0x0'));var util=require('util');var moment=require(_0xe139('0x1'));var BPromise=require(_0xe139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe139('0x3'));var db=require(_0xe139('0x4'))['db'];var utils=require(_0xe139('0x5'));var logger=require(_0xe139('0x6'))('rpc');var config=require(_0xe139('0x7'));var jayson=require(_0xe139('0x8'));var client=jayson[_0xe139('0x9')][_0xe139('0xa')]({'port':0x232a});config[_0xe139('0xb')]=_[_0xe139('0xc')](config[_0xe139('0xb')],{'host':_0xe139('0xd'),'port':0x18eb});var socket=require(_0xe139('0xe'))(new Redis(config[_0xe139('0xb')]));require(_0xe139('0xf'))[_0xe139('0x10')](socket);function respondWithRpcPromise(_0x3e0974,_0x14288e,_0x2dd8c0){return new BPromise(function(_0x12997a,_0xa95bb8){return client[_0xe139('0x11')](_0x3e0974,_0x2dd8c0)[_0xe139('0x12')](function(_0x578dac){logger[_0xe139('0x13')](_0xe139('0x14'),_0x14288e,_0xe139('0x15'));logger[_0xe139('0x16')](_0xe139('0x17'),_0x14288e,_0xe139('0x15'),JSON[_0xe139('0x18')](_0x578dac));if(_0x578dac[_0xe139('0x19')]){if(_0x578dac[_0xe139('0x19')]['code']===0x1f4){logger[_0xe139('0x19')]('MailInteraction,\x20%s,\x20%s',_0x14288e,_0x578dac[_0xe139('0x19')]['message']);return _0xa95bb8(_0x578dac[_0xe139('0x19')][_0xe139('0x1a')]);}logger[_0xe139('0x19')]('MailInteraction,\x20%s,\x20%s',_0x14288e,_0x578dac[_0xe139('0x19')][_0xe139('0x1a')]);return _0x12997a(_0x578dac[_0xe139('0x19')][_0xe139('0x1a')]);}else{logger[_0xe139('0x13')](_0xe139('0x14'),_0x14288e,_0xe139('0x15'));_0x12997a(_0x578dac['result'][_0xe139('0x1a')]);}})['catch'](function(_0x12ebaa){logger[_0xe139('0x19')]('MailInteraction,\x20%s,\x20%s',_0x14288e,_0x12ebaa);_0xa95bb8(_0x12ebaa);});});}exports[_0xe139('0x1b')]=function(_0x44ea2f){var _0x508290=this;return new Promise(function(_0x2f9bec,_0x5882ba){return db['MailInteraction'][_0xe139('0x1c')](_0x44ea2f[_0xe139('0x1d')],{'raw':_0x44ea2f[_0xe139('0x1e')]?_0x44ea2f[_0xe139('0x1e')][_0xe139('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44ea2f[_0xe139('0x1e')]?_0x44ea2f[_0xe139('0x1e')][_0xe139('0x20')]||null:null,'attributes':_0x44ea2f[_0xe139('0x1e')]?_0x44ea2f['options'][_0xe139('0x21')]||null:null,'limit':_0x44ea2f[_0xe139('0x1e')]?_0x44ea2f[_0xe139('0x1e')][_0xe139('0x22')]||null:null})[_0xe139('0x12')](function(_0x48c0c9){logger[_0xe139('0x13')](_0xe139('0x1b'),_0x44ea2f);logger[_0xe139('0x16')](_0xe139('0x1b'),_0x44ea2f,JSON[_0xe139('0x18')](_0x48c0c9));_0x2f9bec(_0x48c0c9);})['catch'](function(_0x3f036b){logger[_0xe139('0x19')](_0xe139('0x1b'),_0x3f036b[_0xe139('0x1a')],_0x44ea2f);_0x5882ba(_0x508290['error'](0x1f4,_0x3f036b[_0xe139('0x1a')]));});});};exports[_0xe139('0x23')]=function(_0x10b8bb){return new Promise(function(_0x22e8ee,_0x269b54){return db[_0xe139('0x24')][_0xe139('0x25')]({'where':_0x10b8bb['options']?_0x10b8bb[_0xe139('0x1e')]['where']||null:null})[_0xe139('0x12')](function(_0x387d4b){if(_0x387d4b){return _0x387d4b[_0xe139('0x26')](_0x10b8bb['body']['ids'],_[_0xe139('0x27')](_0x10b8bb[_0xe139('0x1d')],[_0xe139('0x28'),'id'])||{});}})[_0xe139('0x29')](function(_0x3edf12){logger['info']('AddTags',_0x10b8bb);logger[_0xe139('0x16')](_0xe139('0x2a'),_0x10b8bb,JSON[_0xe139('0x18')](_0x3edf12));_0x22e8ee(_0x3edf12);})[_0xe139('0x2b')](function(_0x2327fa){logger[_0xe139('0x19')]('AddTags',_0x2327fa[_0xe139('0x1a')],_0x10b8bb);_0x269b54(_this[_0xe139('0x19')](0x1f4,_0x2327fa[_0xe139('0x1a')]));});});}; \ No newline at end of file +var _0xd177=['debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailInteraction','update','options','limit','AddTagsToMailInteraction','MailInteraction','find','where','body','ids','omit','stringify','AddTags','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x4b90b7,_0x2b0ab0){var _0x36ac5f=function(_0x33662a){while(--_0x33662a){_0x4b90b7['push'](_0x4b90b7['shift']());}};_0x36ac5f(++_0x2b0ab0);}(_0xd177,0x11e));var _0x7d17=function(_0x5c5631,_0xc4c764){_0x5c5631=_0x5c5631-0x0;var _0x56e267=_0xd177[_0x5c5631];return _0x56e267;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7d17('0x0'));var BPromise=require(_0x7d17('0x1'));var rs=require(_0x7d17('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d17('0x3'));var logger=require(_0x7d17('0x4'))(_0x7d17('0x5'));var config=require(_0x7d17('0x6'));var jayson=require(_0x7d17('0x7'));var client=jayson['client'][_0x7d17('0x8')]({'port':0x232a});config[_0x7d17('0x9')]=_[_0x7d17('0xa')](config[_0x7d17('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d17('0xb'))(new Redis(config['redis']));require(_0x7d17('0xc'))[_0x7d17('0xd')](socket);function respondWithRpcPromise(_0x59cb50,_0x550193,_0x43e92f){return new BPromise(function(_0x552e69,_0x46b53f){return client['request'](_0x59cb50,_0x43e92f)[_0x7d17('0xe')](function(_0x37d71a){logger[_0x7d17('0xf')](_0x7d17('0x10'),_0x550193,_0x7d17('0x11'));logger[_0x7d17('0x12')](_0x7d17('0x13'),_0x550193,_0x7d17('0x11'),JSON['stringify'](_0x37d71a));if(_0x37d71a[_0x7d17('0x14')]){if(_0x37d71a[_0x7d17('0x14')][_0x7d17('0x15')]===0x1f4){logger[_0x7d17('0x14')]('MailInteraction,\x20%s,\x20%s',_0x550193,_0x37d71a['error'][_0x7d17('0x16')]);return _0x46b53f(_0x37d71a[_0x7d17('0x14')]['message']);}logger['error'](_0x7d17('0x10'),_0x550193,_0x37d71a[_0x7d17('0x14')][_0x7d17('0x16')]);return _0x552e69(_0x37d71a[_0x7d17('0x14')][_0x7d17('0x16')]);}else{logger[_0x7d17('0xf')](_0x7d17('0x10'),_0x550193,_0x7d17('0x11'));_0x552e69(_0x37d71a[_0x7d17('0x17')]['message']);}})[_0x7d17('0x18')](function(_0x18b90b){logger['error'](_0x7d17('0x10'),_0x550193,_0x18b90b);_0x46b53f(_0x18b90b);});});}exports[_0x7d17('0x19')]=function(_0x36f4d9){var _0x2c171e=this;return new Promise(function(_0x2688a9,_0x22dd7a){return db['MailInteraction'][_0x7d17('0x1a')](_0x36f4d9['body'],{'raw':_0x36f4d9[_0x7d17('0x1b')]?_0x36f4d9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36f4d9['options']?_0x36f4d9['options']['where']||null:null,'attributes':_0x36f4d9[_0x7d17('0x1b')]?_0x36f4d9[_0x7d17('0x1b')]['attributes']||null:null,'limit':_0x36f4d9[_0x7d17('0x1b')]?_0x36f4d9['options'][_0x7d17('0x1c')]||null:null})[_0x7d17('0xe')](function(_0x52024a){logger[_0x7d17('0xf')]('UpdateMailInteraction',_0x36f4d9);logger[_0x7d17('0x12')](_0x7d17('0x19'),_0x36f4d9,JSON['stringify'](_0x52024a));_0x2688a9(_0x52024a);})['catch'](function(_0x168b9d){logger['error'](_0x7d17('0x19'),_0x168b9d['message'],_0x36f4d9);_0x22dd7a(_0x2c171e[_0x7d17('0x14')](0x1f4,_0x168b9d[_0x7d17('0x16')]));});});};exports[_0x7d17('0x1d')]=function(_0x1b8f17){return new Promise(function(_0xe6dfb5,_0x606401){return db[_0x7d17('0x1e')][_0x7d17('0x1f')]({'where':_0x1b8f17[_0x7d17('0x1b')]?_0x1b8f17[_0x7d17('0x1b')][_0x7d17('0x20')]||null:null})[_0x7d17('0xe')](function(_0x3fb1bc){if(_0x3fb1bc){return _0x3fb1bc['addTags'](_0x1b8f17[_0x7d17('0x21')][_0x7d17('0x22')],_[_0x7d17('0x23')](_0x1b8f17[_0x7d17('0x21')],[_0x7d17('0x22'),'id'])||{});}})['spread'](function(_0x46aad3){logger[_0x7d17('0xf')]('AddTags',_0x1b8f17);logger[_0x7d17('0x12')]('AddTags',_0x1b8f17,JSON[_0x7d17('0x24')](_0x46aad3));_0xe6dfb5(_0x46aad3);})[_0x7d17('0x18')](function(_0x6e1cbc){logger['error'](_0x7d17('0x25'),_0x6e1cbc[_0x7d17('0x16')],_0x1b8f17);_0x606401(_this[_0x7d17('0x14')](0x1f4,_0x6e1cbc[_0x7d17('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 104b819..108e23d 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 _0x5460=['register','length','./mailInteraction.events','save','remove','update','removeListener'];(function(_0x2be6de,_0x1f2f8e){var _0x430210=function(_0x4a5ead){while(--_0x4a5ead){_0x2be6de['push'](_0x2be6de['shift']());}};_0x430210(++_0x1f2f8e);}(_0x5460,0x9c));var _0x0546=function(_0x229d27,_0x250f34){_0x229d27=_0x229d27-0x0;var _0x5b02a=_0x5460[_0x229d27];return _0x5b02a;};'use strict';var MailInteractionEvents=require(_0x0546('0x0'));var events=[_0x0546('0x1'),_0x0546('0x2'),_0x0546('0x3')];function createListener(_0x3569d1,_0x2cd206){return function(_0x77f5c5){_0x2cd206['emit'](_0x3569d1,_0x77f5c5);};}function removeListener(_0x54cd97,_0x279526){return function(){MailInteractionEvents[_0x0546('0x4')](_0x54cd97,_0x279526);};}exports[_0x0546('0x5')]=function(_0x28457a){for(var _0x509c5f=0x0,_0x1249d6=events[_0x0546('0x6')];_0x509c5f<_0x1249d6;_0x509c5f++){var _0x7c2dbb=events[_0x509c5f];var _0x364a1b=createListener('mailInteraction:'+_0x7c2dbb,_0x28457a);MailInteractionEvents['on'](_0x7c2dbb,_0x364a1b);}}; \ No newline at end of file +var _0x5568=['mailInteraction:','./mailInteraction.events','update','emit','register','length'];(function(_0x24fd45,_0x5ca1ac){var _0x10fb9f=function(_0x32d800){while(--_0x32d800){_0x24fd45['push'](_0x24fd45['shift']());}};_0x10fb9f(++_0x5ca1ac);}(_0x5568,0x115));var _0x8556=function(_0x57d19a,_0x4eedfb){_0x57d19a=_0x57d19a-0x0;var _0x4ff61c=_0x5568[_0x57d19a];return _0x4ff61c;};'use strict';var MailInteractionEvents=require(_0x8556('0x0'));var events=['save','remove',_0x8556('0x1')];function createListener(_0x41bb69,_0x3083b6){return function(_0x41157e){_0x3083b6[_0x8556('0x2')](_0x41bb69,_0x41157e);};}function removeListener(_0x56fa0b,_0xc9c7e8){return function(){MailInteractionEvents['removeListener'](_0x56fa0b,_0xc9c7e8);};}exports[_0x8556('0x3')]=function(_0x58fcb4){for(var _0x1d4b21=0x0,_0x31cf4e=events[_0x8556('0x4')];_0x1d4b21<_0x31cf4e;_0x1d4b21++){var _0x329e2f=events[_0x1d4b21];var _0x5c616d=createListener(_0x8556('0x5')+_0x329e2f,_0x58fcb4);MailInteractionEvents['on'](_0x329e2f,_0x5c616d);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index cb94fb8..4fb31d7 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc46=['express','../../components/auth/service','./mailInteractionHasTag.controller','get','isAuthenticated','describe','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfc46,0x9a));var _0x6fc4=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0xfc46[_0x17c483];return _0x112bdb;};'use strict';var express=require(_0x6fc4('0x0'));var router=express['Router']();var auth=require(_0x6fc4('0x1'));var controller=require(_0x6fc4('0x2'));router[_0x6fc4('0x3')]('/describe',auth[_0x6fc4('0x4')](),controller[_0x6fc4('0x5')]);module[_0x6fc4('0x6')]=router; \ No newline at end of file +var _0xc2a5=['../../components/auth/service','./mailInteractionHasTag.controller','get','isAuthenticated','describe','exports','express','Router'];(function(_0x2044ec,_0x86721e){var _0x4472e3=function(_0x10972e){while(--_0x10972e){_0x2044ec['push'](_0x2044ec['shift']());}};_0x4472e3(++_0x86721e);}(_0xc2a5,0x14e));var _0x5c2a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc2a5[_0xa464c9];return _0x3d73c4;};'use strict';var express=require(_0x5c2a('0x0'));var router=express[_0x5c2a('0x1')]();var auth=require(_0x5c2a('0x2'));var controller=require(_0x5c2a('0x3'));router[_0x5c2a('0x4')]('/describe',auth[_0x5c2a('0x5')](),controller[_0x5c2a('0x6')]);module[_0x5c2a('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index c4f4030..e246617 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x4ca19c,_0x3dabe7){var _0x38209f=function(_0x2f4700){while(--_0x2f4700){_0x4ca19c['push'](_0x4ca19c['shift']());}};_0x38209f(++_0x3dabe7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x4b57aa,_0x11dfc7){var _0x460047=function(_0x412ff5){while(--_0x412ff5){_0x4b57aa['push'](_0x4b57aa['shift']());}};_0x460047(++_0x11dfc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 7b6c8d9..e076f5e 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4000=['sequelize','exports','INTEGER'];(function(_0x2d3dc,_0x548c4b){var _0x632bb0=function(_0x3fc2c5){while(--_0x3fc2c5){_0x2d3dc['push'](_0x2d3dc['shift']());}};_0x632bb0(++_0x548c4b);}(_0x4000,0xdb));var _0x0400=function(_0x59042f,_0x3dcc3c){_0x59042f=_0x59042f-0x0;var _0x11b2b7=_0x4000[_0x59042f];return _0x11b2b7;};'use strict';var Sequelize=require(_0x0400('0x0'));module[_0x0400('0x1')]={'MailInteractionId':{'type':Sequelize[_0x0400('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x0400('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xb546=['exports','INTEGER'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0xb546,0x1e4));var _0x6b54=function(_0x2e38e3,_0x5c443e){_0x2e38e3=_0x2e38e3-0x0;var _0x5cb83c=_0xb546[_0x2e38e3];return _0x5cb83c;};'use strict';var Sequelize=require('sequelize');module[_0x6b54('0x0')]={'MailInteractionId':{'type':Sequelize[_0x6b54('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x6b54('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 40578ab..398b79c 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77d9=['mail_interaction_has_tags','define','MailInteractionHasTag'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x77d9,0x94));var _0x977d=function(_0x1f184a,_0x19ff0c){_0x1f184a=_0x1f184a-0x0;var _0x5780b1=_0x77d9[_0x1f184a];return _0x5780b1;};'use strict';var attributes=require('./mailInteractionHasTag');module['exports']=function(_0x3f82e5){return _0x3f82e5[_0x977d('0x0')](_0x977d('0x1'),attributes,{'tableName':_0x977d('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50cb=['MailInteractionHasTag','exports'];(function(_0x65cd03,_0x2913ee){var _0x21c579=function(_0xee6ad4){while(--_0xee6ad4){_0x65cd03['push'](_0x65cd03['shift']());}};_0x21c579(++_0x2913ee);}(_0x50cb,0x97));var _0xb50c=function(_0x232273,_0x50cb15){_0x232273=_0x232273-0x0;var _0x3e4a56=_0x50cb[_0x232273];return _0x3e4a56;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0xb50c('0x0')]=function(_0x4bb2ed){return _0x4bb2ed['define'](_0xb50c('0x1'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 80484ff..f72a0de 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 _0xbd20=['accept','reject','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','index','describe','/:id','isAuthenticated','show','download','post','tracked','mailmessage:create','put','/:id/accept'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0xbd20,0x14a));var _0x0bd2=function(_0x5af89d,_0xa40ecd){_0x5af89d=_0x5af89d-0x0;var _0x44e390=_0xbd20[_0x5af89d];return _0x44e390;};'use strict';var multer=require(_0x0bd2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0bd2('0x1'));var express=require(_0x0bd2('0x2'));var router=express[_0x0bd2('0x3')]();var fs_extra=require(_0x0bd2('0x4'));var auth=require(_0x0bd2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0bd2('0x6'));var controller=require(_0x0bd2('0x7'));router[_0x0bd2('0x8')]('/',auth['isAuthenticated'](),controller[_0x0bd2('0x9')]);router[_0x0bd2('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x0bd2('0xa')]);router[_0x0bd2('0x8')](_0x0bd2('0xb'),auth[_0x0bd2('0xc')](),controller[_0x0bd2('0xd')]);router['get']('/:id/download',auth[_0x0bd2('0xc')](),controller[_0x0bd2('0xe')]);router[_0x0bd2('0xf')]('/',auth[_0x0bd2('0xc')](),interaction[_0x0bd2('0x10')]('mail',_0x0bd2('0x11')),controller['create']);router[_0x0bd2('0x12')](_0x0bd2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0bd2('0x12')](_0x0bd2('0x13'),auth[_0x0bd2('0xc')](),controller[_0x0bd2('0x14')]);router[_0x0bd2('0x12')]('/:id/reject',auth['isAuthenticated'](),controller[_0x0bd2('0x15')]);router[_0x0bd2('0x16')]('/:id',auth[_0x0bd2('0xc')](),controller[_0x0bd2('0x17')]);module[_0x0bd2('0x18')]=router; \ No newline at end of file +var _0x29a5=['../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x523aed,_0x19032d){var _0x2656de=function(_0x1ad8f7){while(--_0x1ad8f7){_0x523aed['push'](_0x523aed['shift']());}};_0x2656de(++_0x19032d);}(_0x29a5,0x1e0));var _0x529a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x29a5[_0x21549c];return _0x426cbd;};'use strict';var multer=require(_0x529a('0x0'));var util=require(_0x529a('0x1'));var path=require(_0x529a('0x2'));var timeout=require('connect-timeout');var express=require(_0x529a('0x3'));var router=express[_0x529a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x529a('0x5'));var interaction=require(_0x529a('0x6'));var config=require('../../config/environment');var controller=require(_0x529a('0x7'));router[_0x529a('0x8')]('/',auth[_0x529a('0x9')](),controller[_0x529a('0xa')]);router[_0x529a('0x8')](_0x529a('0xb'),auth[_0x529a('0x9')](),controller['describe']);router[_0x529a('0x8')](_0x529a('0xc'),auth[_0x529a('0x9')](),controller['show']);router[_0x529a('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x529a('0xd')]);router[_0x529a('0xe')]('/',auth[_0x529a('0x9')](),interaction[_0x529a('0xf')](_0x529a('0x10'),_0x529a('0x11')),controller[_0x529a('0x12')]);router[_0x529a('0x13')](_0x529a('0xc'),auth[_0x529a('0x9')](),controller[_0x529a('0x14')]);router[_0x529a('0x13')](_0x529a('0x15'),auth[_0x529a('0x9')](),controller[_0x529a('0x16')]);router[_0x529a('0x13')]('/:id/reject',auth[_0x529a('0x9')](),controller[_0x529a('0x17')]);router[_0x529a('0x18')]('/:id',auth[_0x529a('0x9')](),controller[_0x529a('0x19')]);module[_0x529a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 33fe306..d016640 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 _0x51cf=['exports','TEXT','long','medium','BOOLEAN','out','STRING','DATE','INTEGER','ENUM','Chat','Email','sequelize','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51cf,0x16a));var _0xf51c=function(_0x3a8443,_0xb2db1f){_0x3a8443=_0x3a8443-0x0;var _0x32e51e=_0x51cf[_0x3a8443];return _0x32e51e;};'use strict';var Sequelize=require(_0xf51c('0x0'));var _=require(_0xf51c('0x1'));module[_0xf51c('0x2')]={'body':{'type':Sequelize[_0xf51c('0x3')](_0xf51c('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xf51c('0x5'))},'read':{'type':Sequelize[_0xf51c('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf51c('0x7')),'defaultValue':_0xf51c('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf51c('0x8')](0x1fe)},'from':{'type':Sequelize[_0xf51c('0x8')]},'to':{'type':Sequelize[_0xf51c('0x3')](_0xf51c('0x4'))},'cc':{'type':Sequelize[_0xf51c('0x3')](_0xf51c('0x4'))},'bcc':{'type':Sequelize[_0xf51c('0x3')]('long')},'subject':{'type':Sequelize[_0xf51c('0x3')]},'sentAt':{'type':Sequelize[_0xf51c('0x9')]},'attach':{'type':Sequelize[_0xf51c('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xf51c('0x9')]},'originTo':{'type':Sequelize[_0xf51c('0x3')](_0xf51c('0x4'))},'originCc':{'type':Sequelize[_0xf51c('0x3')]('long')},'originChannel':{'type':Sequelize[_0xf51c('0xb')]('Email',_0xf51c('0xc')),'defaultValue':_0xf51c('0xd'),'allowNull':![]}}; \ No newline at end of file +var _0x4141=['Email','Chat','sequelize','lodash','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4141,0x136));var _0x1414=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4141[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1414('0x0'));var _=require(_0x1414('0x1'));module['exports']={'body':{'type':Sequelize[_0x1414('0x2')](_0x1414('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x1414('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1414('0x5')]('in',_0x1414('0x6')),'defaultValue':_0x1414('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x1414('0x7')]},'to':{'type':Sequelize['TEXT'](_0x1414('0x3'))},'cc':{'type':Sequelize[_0x1414('0x2')](_0x1414('0x3'))},'bcc':{'type':Sequelize[_0x1414('0x2')](_0x1414('0x3'))},'subject':{'type':Sequelize[_0x1414('0x2')]},'sentAt':{'type':Sequelize[_0x1414('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x1414('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x1414('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0x1414('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0x1414('0x3'))},'originChannel':{'type':Sequelize[_0x1414('0x5')](_0x1414('0x9'),_0x1414('0xa')),'defaultValue':_0x1414('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f8bf4dc..231f406 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 _0x4d22=['query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','includeAll','include','show','params','options','find','update','body','describe','create','direction','out','secret','split','MailAccount','findOne','CmList','List','CmContact','DESC','Smtp','CloudProvider','attachments','root','Contacts','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','user','agent','get','MailInteraction','MailInteractionId','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','QueryTypes','contact','reject','rejectmessage','download','unix','join','server','files','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','readFileSync','build','unlinkSync','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','json','undefined','limit','count','offset','set','Content-Range','destroy','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','keys'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4d22,0xfc));var _0x24d2=function(_0x15f51c,_0x32bd75){_0x15f51c=_0x15f51c-0x0;var _0x34149e=_0x4d22[_0x15f51c];return _0x34149e;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0x24d2('0x0'));var fs=require('fs');var _=require(_0x24d2('0x1'));var Redis=require(_0x24d2('0x2'));var htmlToText=require(_0x24d2('0x3'));var qs=require(_0x24d2('0x4'));var logger=require(_0x24d2('0x5'))(_0x24d2('0x6'));var interaction_log=require(_0x24d2('0x5'))(_0x24d2('0x7'));var config=require(_0x24d2('0x8'));var db=require('../../mysqldb')['db'];config[_0x24d2('0x9')]=_[_0x24d2('0xa')](config[_0x24d2('0x9')],{'host':_0x24d2('0xb'),'port':0x18eb});var socket=require(_0x24d2('0xc'))(new Redis(config['redis']));var htmlEntities=require(_0x24d2('0xd'));require(_0x24d2('0xe'))['register'](socket);var jayson=require(_0x24d2('0xf'));var client=jayson['client'][_0x24d2('0x10')]({'port':0x232c});var client9003=jayson[_0x24d2('0x11')][_0x24d2('0x10')]({'port':0x232b});var client9002=jayson['client'][_0x24d2('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x13ef6c,_0x308732,_0x594399,_0xd212c2){return new BPromise(function(_0x1ef752,_0x13adc4){var _0x4c3098=_0xd212c2||client;return _0x4c3098[_0x24d2('0x12')](_0x13ef6c,_0x594399)[_0x24d2('0x13')](function(_0x1a297a){logger[_0x24d2('0x14')](_0x24d2('0x15'),_0x308732,_0x24d2('0x16'));logger['debug'](_0x24d2('0x17'),_0x308732,_0x24d2('0x16'),JSON['stringify'](_0x1a297a));if(_0x1a297a['error']){if(_0x1a297a[_0x24d2('0x18')][_0x24d2('0x19')]===0x1f4){logger[_0x24d2('0x18')](_0x24d2('0x15'),_0x308732,_0x1a297a['error']['message']);return _0x13adc4(_0x1a297a[_0x24d2('0x18')][_0x24d2('0x1a')]);}logger[_0x24d2('0x18')]('MailMessage,\x20%s,\x20%s',_0x308732,_0x1a297a[_0x24d2('0x18')][_0x24d2('0x1a')]);return _0x1ef752(_0x1a297a[_0x24d2('0x18')][_0x24d2('0x1a')]);}else{logger[_0x24d2('0x14')](_0x24d2('0x15'),_0x308732,'request\x20sent');_0x1ef752(_0x1a297a['result'][_0x24d2('0x1a')]);}})[_0x24d2('0x1b')](function(_0x39f668){logger[_0x24d2('0x18')](_0x24d2('0x15'),_0x308732,_0x39f668);_0x13adc4(_0x39f668);});});}function respondWithResult(_0x517405,_0x4e892f){_0x4e892f=_0x4e892f||0xc8;return function(_0x61b5eb){if(_0x61b5eb){return _0x517405[_0x24d2('0x1c')](_0x4e892f)[_0x24d2('0x1d')](_0x61b5eb);}};}function respondWithFilteredResult(_0x48ed9d,_0x56dbd5){return function(_0x4540f6){if(_0x4540f6){var _0x38736a=typeof _0x56dbd5['offset']===_0x24d2('0x1e')&&typeof _0x56dbd5[_0x24d2('0x1f')]===_0x24d2('0x1e');var _0x2ed40e=_0x4540f6[_0x24d2('0x20')];var _0x12bbd5=_0x38736a?0x0:_0x56dbd5[_0x24d2('0x21')];var _0x5554f3=_0x38736a?_0x4540f6['count']:_0x56dbd5[_0x24d2('0x21')]+_0x56dbd5['limit'];var _0x1dd96b;if(_0x5554f3>=_0x2ed40e){_0x5554f3=_0x2ed40e;_0x1dd96b=0xc8;}else{_0x1dd96b=0xce;}_0x48ed9d['status'](_0x1dd96b);return _0x48ed9d[_0x24d2('0x22')](_0x24d2('0x23'),_0x12bbd5+'-'+_0x5554f3+'/'+_0x2ed40e)[_0x24d2('0x1d')](_0x4540f6);}return null;};}function saveUpdates(_0x1f222b){return function(_0x54eade){if(_0x54eade){return _0x54eade['update'](_0x1f222b)[_0x24d2('0x13')](function(_0x344362){return _0x344362;});}return null;};}function removeEntity(_0x399551){return function(_0xcf153d){if(_0xcf153d){return _0xcf153d[_0x24d2('0x24')]()[_0x24d2('0x13')](function(){_0x399551['status'](0xcc)[_0x24d2('0x25')]();});}};}function handleEntityNotFound(_0x313b3a){return function(_0x89308e){if(!_0x89308e){_0x313b3a[_0x24d2('0x26')](0x194);}return _0x89308e;};}function handleError(_0x392cce,_0x295837){_0x295837=_0x295837||0x1f4;return function(_0x1f07a5){logger[_0x24d2('0x18')](_0x1f07a5[_0x24d2('0x27')]);if(_0x1f07a5[_0x24d2('0x28')]){delete _0x1f07a5[_0x24d2('0x28')];}_0x392cce[_0x24d2('0x1c')](_0x295837)['send'](_0x1f07a5);};}exports[_0x24d2('0x29')]=function(_0xe9370e,_0x44a463){var _0x436a6d={},_0x3bf33a={},_0x47e770={'count':0x0,'rows':[]};var _0x122d7f=_[_0x24d2('0x2a')](db[_0x24d2('0x2b')][_0x24d2('0x2c')],function(_0x154ba9){return{'name':_0x154ba9[_0x24d2('0x2d')],'type':_0x154ba9[_0x24d2('0x2e')][_0x24d2('0x2f')]};});_0x3bf33a[_0x24d2('0x30')]=_[_0x24d2('0x2a')](_0x122d7f,_0x24d2('0x28'));_0x3bf33a['query']=_[_0x24d2('0x31')](_0xe9370e[_0x24d2('0x32')]);_0x3bf33a[_0x24d2('0x33')]=_[_0x24d2('0x34')](_0x3bf33a[_0x24d2('0x30')],_0x3bf33a['query']);_0x436a6d[_0x24d2('0x35')]=_['intersection'](_0x3bf33a[_0x24d2('0x30')],qs[_0x24d2('0x36')](_0xe9370e['query'][_0x24d2('0x36')]));_0x436a6d[_0x24d2('0x35')]=_0x436a6d[_0x24d2('0x35')][_0x24d2('0x37')]?_0x436a6d['attributes']:_0x3bf33a['model'];if(!_0xe9370e[_0x24d2('0x32')]['hasOwnProperty'](_0x24d2('0x38'))){_0x436a6d[_0x24d2('0x1f')]=qs[_0x24d2('0x1f')](_0xe9370e['query']['limit']);_0x436a6d['offset']=qs['offset'](_0xe9370e[_0x24d2('0x32')][_0x24d2('0x21')]);}_0x436a6d['order']=qs['sort'](_0xe9370e[_0x24d2('0x32')][_0x24d2('0x39')]);_0x436a6d[_0x24d2('0x3a')]=qs['filters'](_[_0x24d2('0x3b')](_0xe9370e[_0x24d2('0x32')],_0x3bf33a[_0x24d2('0x33')]),_0x122d7f);if(_0xe9370e[_0x24d2('0x32')][_0x24d2('0x3c')]){_0x436a6d[_0x24d2('0x3a')]=_[_0x24d2('0x3d')](_0x436a6d[_0x24d2('0x3a')],{'$or':_[_0x24d2('0x2a')](_0x122d7f,function(_0x21e5c7){if(_0x21e5c7['type']!=='VIRTUAL'){var _0x40740d={};_0x40740d[_0x21e5c7[_0x24d2('0x28')]]={'$like':'%'+_0xe9370e['query'][_0x24d2('0x3c')]+'%'};return _0x40740d;}})});}_0x436a6d=_[_0x24d2('0x3d')]({},_0x436a6d,_0xe9370e['options']);var _0x43de3b={'where':_0x436a6d[_0x24d2('0x3a')]};return db[_0x24d2('0x2b')][_0x24d2('0x20')](_0x43de3b)[_0x24d2('0x13')](function(_0x5997fe){_0x47e770[_0x24d2('0x20')]=_0x5997fe;if(_0xe9370e[_0x24d2('0x32')][_0x24d2('0x3e')]){_0x436a6d[_0x24d2('0x3f')]=[{'all':!![]}];}return db[_0x24d2('0x2b')]['findAll'](_0x436a6d);})['then'](function(_0x3d2d90){_0x47e770['rows']=_0x3d2d90;return _0x47e770;})[_0x24d2('0x13')](respondWithFilteredResult(_0x44a463,_0x436a6d))[_0x24d2('0x1b')](handleError(_0x44a463,null));};exports[_0x24d2('0x40')]=function(_0x27f3d1,_0x12653a){var _0x2e673f={'raw':!![],'where':{'id':_0x27f3d1[_0x24d2('0x41')]['id']}},_0x2535fb={};_0x2535fb[_0x24d2('0x30')]=_['keys'](db[_0x24d2('0x2b')][_0x24d2('0x2c')]);_0x2535fb[_0x24d2('0x32')]=_[_0x24d2('0x31')](_0x27f3d1['query']);_0x2535fb['filters']=_[_0x24d2('0x34')](_0x2535fb[_0x24d2('0x30')],_0x2535fb[_0x24d2('0x32')]);_0x2e673f[_0x24d2('0x35')]=_[_0x24d2('0x34')](_0x2535fb[_0x24d2('0x30')],qs[_0x24d2('0x36')](_0x27f3d1['query'][_0x24d2('0x36')]));_0x2e673f[_0x24d2('0x35')]=_0x2e673f[_0x24d2('0x35')][_0x24d2('0x37')]?_0x2e673f['attributes']:_0x2535fb[_0x24d2('0x30')];if(_0x27f3d1['query']['includeAll']){_0x2e673f['include']=[{'all':!![]}];}_0x2e673f=_[_0x24d2('0x3d')]({},_0x2e673f,_0x27f3d1[_0x24d2('0x42')]);return db[_0x24d2('0x2b')][_0x24d2('0x43')](_0x2e673f)[_0x24d2('0x13')](handleEntityNotFound(_0x12653a,null))[_0x24d2('0x13')](respondWithResult(_0x12653a,null))['catch'](handleError(_0x12653a,null));};exports[_0x24d2('0x44')]=function(_0x3574c4,_0x2540ae){if(_0x3574c4[_0x24d2('0x45')]['id']){delete _0x3574c4[_0x24d2('0x45')]['id'];}return db[_0x24d2('0x2b')][_0x24d2('0x43')]({'where':{'id':_0x3574c4[_0x24d2('0x41')]['id']}})[_0x24d2('0x13')](handleEntityNotFound(_0x2540ae,null))[_0x24d2('0x13')](saveUpdates(_0x3574c4['body'],null))[_0x24d2('0x13')](respondWithResult(_0x2540ae,null))[_0x24d2('0x1b')](handleError(_0x2540ae,null));};exports[_0x24d2('0x24')]=function(_0x567a83,_0x7e8b6f){return db[_0x24d2('0x2b')][_0x24d2('0x43')]({'where':{'id':_0x567a83[_0x24d2('0x41')]['id']}})[_0x24d2('0x13')](handleEntityNotFound(_0x7e8b6f,null))[_0x24d2('0x13')](removeEntity(_0x7e8b6f,null))[_0x24d2('0x1b')](handleError(_0x7e8b6f,null));};exports['describe']=function(_0x59acca,_0x309964){return db[_0x24d2('0x2b')][_0x24d2('0x46')]()[_0x24d2('0x13')](respondWithResult(_0x309964,null))[_0x24d2('0x1b')](handleError(_0x309964,null));};exports[_0x24d2('0x47')]=function(_0x2e8b0e,_0x5e58b9){return db[_0x24d2('0x2b')]['create'](_0x2e8b0e['body'])[_0x24d2('0x13')](function(_0x178a74){if(_0x178a74){if(_0x178a74[_0x24d2('0x48')]===_0x24d2('0x49')&&!_0x178a74[_0x24d2('0x4a')]){var _0x3ee26f,_0x2eb40c,_0xeaf02b;if(_0x2e8b0e[_0x24d2('0x45')]['to']){_0x2eb40c=_0x2e8b0e[_0x24d2('0x45')]['to'][_0x24d2('0x4b')](',')[0x0];}return db[_0x24d2('0x4c')][_0x24d2('0x4d')]({'where':{'id':_0x178a74['MailAccountId']},'include':[{'model':db[_0x24d2('0x4e')],'as':_0x24d2('0x4f'),'include':[{'model':db[_0x24d2('0x50')],'as':'Contacts','where':{'email':_0x2eb40c},'limit':0x1,'order':[['updatedAt',_0x24d2('0x51')]]}]},{'model':db['MailServerOut'],'as':_0x24d2('0x52'),'raw':!![],'include':[{'model':db[_0x24d2('0x53')],'as':_0x24d2('0x53'),'raw':!![]}]}]})[_0x24d2('0x13')](function(_0x1bbad1){_0x3ee26f=_0x1bbad1;if(!_0x3ee26f||!_0x3ee26f[_0x24d2('0x52')])return;var _0x41664f=_0x3ee26f['getSmtpOptions']();if(_0x2e8b0e[_0x24d2('0x45')][_0x24d2('0x54')]&&_0x2e8b0e[_0x24d2('0x45')][_0x24d2('0x54')][_0x24d2('0x37')]){for(var _0x4781ca=0x0;_0x4781ca<_0x2e8b0e[_0x24d2('0x45')][_0x24d2('0x54')][_0x24d2('0x37')];_0x4781ca+=0x1){_0x2e8b0e['body'][_0x24d2('0x54')][_0x4781ca]={'filename':_0x2e8b0e[_0x24d2('0x45')][_0x24d2('0x54')][_0x4781ca][_0x24d2('0x28')],'path':path['join'](config[_0x24d2('0x55')],'server/files/attachments',_0x2e8b0e['body'][_0x24d2('0x54')][_0x4781ca]['basename'])};}}_0xeaf02b={'account':_0x41664f,'message':_0x2e8b0e[_0x24d2('0x45')]};return;})['then'](function(){if(_0x3ee26f[_0x24d2('0x4f')]){if(_0x3ee26f['List'][_0x24d2('0x56')][_0x24d2('0x37')]){return _0x3ee26f[_0x24d2('0x4f')]['Contacts'][0x0];}else{return db[_0x24d2('0x50')]['create'](_[_0x24d2('0xa')](_0x2e8b0e[_0x24d2('0x45')],{'firstName':_0x2e8b0e[_0x24d2('0x45')]['to'],'email':_0x2e8b0e[_0x24d2('0x45')]['to'],'phone':_0x2e8b0e[_0x24d2('0x45')]['to'],'ListId':_0x3ee26f[_0x24d2('0x57')]}));}}else{throw new Error(_0x24d2('0x58'));}})['then'](function(){if(_0xeaf02b){return respondWithRpcPromise(_0x24d2('0x59'),'sendMail',_0xeaf02b,client9003)[_0x24d2('0x13')](function(_0x544acb){return _0x178a74[_0x24d2('0x44')]({'read':!![],'messageId':_0x544acb[_0x24d2('0x5a')],'sentAt':moment()[_0x24d2('0x5b')](_0x24d2('0x5c'))});})[_0x24d2('0x1b')](function(_0x5e2742){logger['error']('%s',JSON['stringify'](_0x5e2742));return _0x178a74;});}return _0x178a74;});}return _0x178a74;}})[_0x24d2('0x13')](respondWithResult(_0x5e58b9,0xc9))[_0x24d2('0x1b')](handleError(_0x5e58b9,null));};exports[_0x24d2('0x5d')]=function(_0x51d716,_0x2b44cb){var _0xb6d40a={'agent':{},'channel':_0x24d2('0x5e')};if(_0x51d716[_0x24d2('0x45')]['id']){delete _0x51d716['body']['id'];}_0x51d716[_0x24d2('0x45')][_0x24d2('0x5f')]=!![];_0x51d716['body']['readAt']=moment()[_0x24d2('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x51d716['body'][_0x24d2('0x60')]=_0x51d716[_0x24d2('0x45')][_0x24d2('0x60')]||_0x51d716[_0x24d2('0x61')]['id'];_0xb6d40a[_0x24d2('0x62')]['id']=_0x51d716[_0x24d2('0x45')][_0x24d2('0x60')];return db[_0x24d2('0x2b')][_0x24d2('0x43')]({'where':{'id':_0x51d716[_0x24d2('0x41')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b44cb,null))[_0x24d2('0x13')](saveUpdates(_0x51d716[_0x24d2('0x45')],null))[_0x24d2('0x13')](function(_0x53afa9){if(_0x53afa9){_0xb6d40a[_0x24d2('0x1a')]=_0x53afa9[_0x24d2('0x63')]({'plain':!![]});return db[_0x24d2('0x64')][_0x24d2('0x43')]({'where':{'id':_0x53afa9[_0x24d2('0x65')]}});}return null;})[_0x24d2('0x13')](handleEntityNotFound(_0x2b44cb,null))[_0x24d2('0x13')](function(_0x5c5b83){if(_0x5c5b83){return _0x5c5b83[_0x24d2('0x44')]({'UserId':_0x51d716[_0x24d2('0x45')][_0x24d2('0x60')],'read1stAt':_['isNil'](_0x5c5b83['read1stAt'])?moment()[_0x24d2('0x5b')](_0x24d2('0x5c')):undefined});}return null;})[_0x24d2('0x13')](function(_0x1474b0){if(_0x1474b0){_0xb6d40a['interaction']=_0x1474b0[_0x24d2('0x63')]({'plain':!![]});interaction_log['info'](_0x24d2('0x66'),_0x51d716[_0x24d2('0x61')]['id'],_0x51d716[_0x24d2('0x61')][_0x24d2('0x28')],_0x51d716[_0x24d2('0x61')][_0x24d2('0x67')],_0xb6d40a[_0x24d2('0x68')]['id'],_0x51d716[_0x24d2('0x45')]?JSON[_0x24d2('0x69')](_0x51d716['body']):_0x24d2('0x6a'));return respondWithRpcPromise(_0x24d2('0x6b'),_0x24d2('0x6c'),_0xb6d40a);}return null;})[_0x24d2('0x13')](function(_0x5954f8){var _0x3b1280=_0x24d2('0x6d')+_0x5954f8[_0x24d2('0x1a')][_0x24d2('0x6e')];return db[_0x24d2('0x6f')]['query'](_0x3b1280,{'type':db[_0x24d2('0x70')]['QueryTypes'][_0x24d2('0x71')],'raw':!![]})[_0x24d2('0x13')](function(_0x992737){return _0x992737;});})[_0x24d2('0x13')](function(_0x427d80){if(_0x427d80){_0xb6d40a[_0x24d2('0x1a')]['contact']=_0x427d80[0x0];if(!_0x51d716[_0x24d2('0x45')][_0x24d2('0x60')])return;return db[_0x24d2('0x72')]['find']({'where':{'id':_0x51d716[_0x24d2('0x45')][_0x24d2('0x60')],'role':_0x24d2('0x62')},'attributes':['id',_0x24d2('0x28'),_0x24d2('0x73'),_0x24d2('0x74'),_0x24d2('0x75')],'raw':!![]});}return null;})[_0x24d2('0x13')](function(_0x9f1254){if(!_0x9f1254)return null;_0xb6d40a[_0x24d2('0x1a')][_0x24d2('0x62')]=_0x9f1254;return _0xb6d40a;})[_0x24d2('0x13')](function(_0x351c24){if(_0x351c24){if(_0x51d716['body'][_0x24d2('0x76')]){_0xb6d40a[_0x24d2('0x1a')]['interface']=util[_0x24d2('0x5b')](_0x24d2('0x77'),_0x51d716[_0x24d2('0x61')][_0x24d2('0x28')]);_0xb6d40a[_0x24d2('0x1a')][_0x24d2('0x78')]=_0xb6d40a[_0x24d2('0x78')];_0xb6d40a[_0x24d2('0x1a')][_0x24d2('0x79')]=_0xb6d40a[_0x24d2('0x78')];_0xb6d40a[_0x24d2('0x1a')][_0x24d2('0x7a')]=_0x24d2('0x5d');_0xb6d40a[_0x24d2('0x1a')][_0x24d2('0x45')]=htmlToText[_0x24d2('0x7b')](_0xb6d40a[_0x24d2('0x1a')][_0x24d2('0x45')]);return respondWithRpcPromise(_0x24d2('0x7c'),_0x24d2('0x7c'),{'event':'acceptmessage','message':_0xb6d40a[_0x24d2('0x1a')]},client9002)['then'](function(){return _0xb6d40a;});}return _0xb6d40a;}return null;})[_0x24d2('0x13')](respondWithResult(_0x2b44cb,null))[_0x24d2('0x1b')](handleError(_0x2b44cb,null));};exports['reject']=function(_0x6c7cf4,_0x1bec6a){var _0x1c9007={'agent':{},'channel':_0x24d2('0x5e')};if(_0x6c7cf4[_0x24d2('0x45')]['id']){delete _0x6c7cf4['body']['id'];}_0x6c7cf4[_0x24d2('0x45')][_0x24d2('0x60')]=_0x6c7cf4[_0x24d2('0x45')]['UserId']||_0x6c7cf4[_0x24d2('0x61')]['id'];_0x1c9007[_0x24d2('0x62')]['id']=_0x6c7cf4[_0x24d2('0x45')][_0x24d2('0x60')];return db[_0x24d2('0x2b')]['find']({'where':{'id':_0x6c7cf4[_0x24d2('0x41')]['id'],'UserId':null}})[_0x24d2('0x13')](handleEntityNotFound(_0x1bec6a,null))['then'](function(_0x48aaa3){if(_0x48aaa3){_0x1c9007[_0x24d2('0x1a')]=_0x48aaa3[_0x24d2('0x63')]({'plain':!![]});return db['MailInteraction'][_0x24d2('0x43')]({'where':{'id':_0x48aaa3[_0x24d2('0x65')]}});}return null;})[_0x24d2('0x13')](handleEntityNotFound(_0x1bec6a,null))[_0x24d2('0x13')](function(_0x531cba){if(_0x531cba){_0x1c9007[_0x24d2('0x68')]=_0x531cba[_0x24d2('0x63')]({'plain':!![]});interaction_log[_0x24d2('0x14')](_0x24d2('0x7d'),_0x6c7cf4[_0x24d2('0x61')]['id'],_0x6c7cf4[_0x24d2('0x61')][_0x24d2('0x28')],_0x6c7cf4[_0x24d2('0x61')][_0x24d2('0x67')],_0x1c9007[_0x24d2('0x68')]['id'],_0x6c7cf4[_0x24d2('0x45')]?JSON['stringify'](_0x6c7cf4[_0x24d2('0x45')]):_0x24d2('0x6a'));return respondWithRpcPromise('RejectMessage',_0x24d2('0x7e'),_0x1c9007);}return null;})[_0x24d2('0x13')](function(_0x31bf15){var _0x2a230e=_0x24d2('0x6d')+_0x31bf15[_0x24d2('0x1a')][_0x24d2('0x6e')];return db[_0x24d2('0x6f')][_0x24d2('0x32')](_0x2a230e,{'type':db[_0x24d2('0x70')][_0x24d2('0x7f')][_0x24d2('0x71')],'raw':!![]})[_0x24d2('0x13')](function(_0x131f54){return _0x131f54;});})['then'](function(_0x340042){if(_0x340042){_0x1c9007[_0x24d2('0x1a')][_0x24d2('0x80')]=_0x340042[0x0];if(!_0x6c7cf4['body'][_0x24d2('0x60')])return;return db[_0x24d2('0x72')][_0x24d2('0x43')]({'where':{'id':_0x6c7cf4[_0x24d2('0x45')][_0x24d2('0x60')],'role':_0x24d2('0x62')},'attributes':['id',_0x24d2('0x28'),_0x24d2('0x73'),_0x24d2('0x74'),_0x24d2('0x75')],'raw':!![]});}return null;})[_0x24d2('0x13')](function(_0x4063e8){if(!_0x4063e8)return null;_0x1c9007[_0x24d2('0x1a')][_0x24d2('0x62')]=_0x4063e8;return _0x1c9007;})[_0x24d2('0x13')](function(_0x2cfeda){if(_0x2cfeda){_0x2cfeda['message']['interface']=util[_0x24d2('0x5b')](_0x24d2('0x77'),_0x6c7cf4['user'][_0x24d2('0x28')]);_0x2cfeda[_0x24d2('0x1a')][_0x24d2('0x78')]=_0x1c9007[_0x24d2('0x78')];_0x2cfeda[_0x24d2('0x1a')][_0x24d2('0x79')]=_0x1c9007[_0x24d2('0x78')];_0x2cfeda[_0x24d2('0x1a')][_0x24d2('0x7a')]=_0x24d2('0x81');_0x2cfeda[_0x24d2('0x1a')][_0x24d2('0x45')]=htmlToText[_0x24d2('0x7b')](_0x1c9007[_0x24d2('0x1a')][_0x24d2('0x45')]);respondWithRpcPromise(_0x24d2('0x7c'),_0x24d2('0x7c'),{'event':_0x24d2('0x82'),'message':_0x2cfeda[_0x24d2('0x1a')]},client9002);return _0x1c9007;}return null;})['then'](respondWithResult(_0x1bec6a,null))[_0x24d2('0x1b')](handleError(_0x1bec6a,null));};exports[_0x24d2('0x83')]=function(_0x5532f9,_0x5712ff){var _0x271073=moment()[_0x24d2('0x84')]()['toString']();var _0x4fd6b8=path[_0x24d2('0x85')](config['root'],_0x24d2('0x86'),'files','tmp');var _0x5d0f32=path[_0x24d2('0x85')](config[_0x24d2('0x55')],'server',_0x24d2('0x87'),_0x24d2('0x54'));var _0x3ae685=util[_0x24d2('0x5b')]('message-%s.eml',_0x271073);return db[_0x24d2('0x2b')][_0x24d2('0x43')]({'where':{'id':_0x5532f9[_0x24d2('0x41')]['id']},'attributes':['id',_0x24d2('0x45'),_0x24d2('0x88'),'to','cc','bcc',_0x24d2('0x89'),_0x24d2('0x8a')],'include':_0x5532f9[_0x24d2('0x32')]['attachments']?[{'model':db[_0x24d2('0x8b')],'as':_0x24d2('0x8c')}]:undefined})[_0x24d2('0x13')](handleEntityNotFound(_0x5712ff,null))['then'](function(_0x145a12){if(_0x145a12){var _0xa791bc=_0x145a12;var _0x55bd03={'from':_0xa791bc[_0x24d2('0x88')],'to':_0xa791bc['to'],'subject':_0xa791bc[_0x24d2('0x89')],'html':htmlEntities[_0x24d2('0x8d')](_0xa791bc[_0x24d2('0x45')]),'headers':{'Date':moment(_0xa791bc[_0x24d2('0x8a')])['format'](_0x24d2('0x8e'))},'attachments':[]};if(_0x145a12['cc']){_0x55bd03[_0x24d2('0x8f')]['Cc']=_0x145a12['cc'];}if(_0x145a12[_0x24d2('0x90')]){_0x55bd03[_0x24d2('0x8f')][_0x24d2('0x91')]=_0x145a12[_0x24d2('0x90')];}return new BPromise(function(_0x3cafbb,_0x1c1947){if(_0x145a12[_0x24d2('0x8c')]){for(var _0x1cf149=0x0;_0x1cf149<_0x145a12[_0x24d2('0x8c')]['length'];_0x1cf149++){var _0x3a2f46=_0x145a12[_0x24d2('0x8c')][_0x1cf149];var _0x1f6bd0=path[_0x24d2('0x85')](_0x5d0f32,_0x3a2f46['basename']);if(fs[_0x24d2('0x92')](_0x1f6bd0)){_0x55bd03[_0x24d2('0x54')][_0x24d2('0x93')]({'name':_0x3a2f46[_0x24d2('0x28')],'contentType':_0x3a2f46[_0x24d2('0x2e')],'data':fs[_0x24d2('0x94')](_0x1f6bd0)});}}}emlformat[_0x24d2('0x95')](_0x55bd03,function(_0x26c5d8,_0x33eedc){if(_0x26c5d8)return _0x1c1947(_0x26c5d8);fs['writeFileSync'](path[_0x24d2('0x85')](_0x4fd6b8,_0x3ae685),_0x33eedc);return _0x3cafbb(_0x33eedc);});});}})[_0x24d2('0x13')](function(_0x5474c9){if(_0x5474c9){return _0x5712ff['download'](path['join'](_0x4fd6b8,_0x3ae685),_0x3ae685,function(_0x2e4d3f){if(!_0x2e4d3f)fs[_0x24d2('0x96')](path[_0x24d2('0x85')](_0x4fd6b8,_0x3ae685));});}})[_0x24d2('0x1b')](handleError(_0x5712ff,null));}; \ No newline at end of file +var _0x9dd9=['message','info','result','status','json','offset','undefined','limit','count','set','Content-Range','update','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','include','rows','includeAll','options','find','catch','body','params','destroy','describe','create','out','secret','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','CmContact','defaults','ListId','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','format','user','agent','UserId','get','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','mail','MailInteractionId','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','contact','rejectmessage','download','unix','toString','files','server','bcc','subject','createdAt','Attachment','Attachments','decode','headers','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','redis','localhost','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x45d1ad,_0x35eccb){var _0x5402e8=function(_0x1afdb2){while(--_0x1afdb2){_0x45d1ad['push'](_0x45d1ad['shift']());}};_0x5402e8(++_0x35eccb);}(_0x9dd9,0x122));var _0x99dd=function(_0x24a073,_0x35ccc6){_0x24a073=_0x24a073-0x0;var _0x149419=_0x9dd9[_0x24a073];return _0x149419;};'use strict';var emlformat=require(_0x99dd('0x0'));var moment=require(_0x99dd('0x1'));var BPromise=require(_0x99dd('0x2'));var util=require('util');var path=require(_0x99dd('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0x99dd('0x4'));var qs=require(_0x99dd('0x5'));var logger=require(_0x99dd('0x6'))(_0x99dd('0x7'));var interaction_log=require(_0x99dd('0x6'))(_0x99dd('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x99dd('0x9')],{'host':_0x99dd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x99dd('0x9')]));var htmlEntities=require(_0x99dd('0xb'));require(_0x99dd('0xc'))[_0x99dd('0xd')](socket);var jayson=require(_0x99dd('0xe'));var client=jayson['client'][_0x99dd('0xf')]({'port':0x232c});var client9003=jayson[_0x99dd('0x10')][_0x99dd('0xf')]({'port':0x232b});var client9002=jayson[_0x99dd('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x328dd5,_0xcdffec,_0xa6f976,_0x55ab0a){return new BPromise(function(_0x48715a,_0x30df80){var _0x1d9678=_0x55ab0a||client;return _0x1d9678[_0x99dd('0x11')](_0x328dd5,_0xa6f976)[_0x99dd('0x12')](function(_0x1a7e31){logger['info'](_0x99dd('0x13'),_0xcdffec,_0x99dd('0x14'));logger[_0x99dd('0x15')]('MailMessage,\x20%s,\x20%s,\x20%s',_0xcdffec,_0x99dd('0x14'),JSON[_0x99dd('0x16')](_0x1a7e31));if(_0x1a7e31['error']){if(_0x1a7e31[_0x99dd('0x17')]['code']===0x1f4){logger['error'](_0x99dd('0x13'),_0xcdffec,_0x1a7e31[_0x99dd('0x17')]['message']);return _0x30df80(_0x1a7e31[_0x99dd('0x17')]['message']);}logger[_0x99dd('0x17')](_0x99dd('0x13'),_0xcdffec,_0x1a7e31[_0x99dd('0x17')][_0x99dd('0x18')]);return _0x48715a(_0x1a7e31[_0x99dd('0x17')][_0x99dd('0x18')]);}else{logger[_0x99dd('0x19')](_0x99dd('0x13'),_0xcdffec,'request\x20sent');_0x48715a(_0x1a7e31[_0x99dd('0x1a')][_0x99dd('0x18')]);}})['catch'](function(_0x28d798){logger[_0x99dd('0x17')](_0x99dd('0x13'),_0xcdffec,_0x28d798);_0x30df80(_0x28d798);});});}function respondWithResult(_0x3bf57c,_0x3e1fbf){_0x3e1fbf=_0x3e1fbf||0xc8;return function(_0x12cd62){if(_0x12cd62){return _0x3bf57c[_0x99dd('0x1b')](_0x3e1fbf)[_0x99dd('0x1c')](_0x12cd62);}};}function respondWithFilteredResult(_0x307403,_0x5b1a45){return function(_0x28de47){if(_0x28de47){var _0x484192=typeof _0x5b1a45[_0x99dd('0x1d')]===_0x99dd('0x1e')&&typeof _0x5b1a45[_0x99dd('0x1f')]===_0x99dd('0x1e');var _0xde6b80=_0x28de47['count'];var _0x5682e7=_0x484192?0x0:_0x5b1a45[_0x99dd('0x1d')];var _0x1712c4=_0x484192?_0x28de47[_0x99dd('0x20')]:_0x5b1a45[_0x99dd('0x1d')]+_0x5b1a45[_0x99dd('0x1f')];var _0x561e5b;if(_0x1712c4>=_0xde6b80){_0x1712c4=_0xde6b80;_0x561e5b=0xc8;}else{_0x561e5b=0xce;}_0x307403[_0x99dd('0x1b')](_0x561e5b);return _0x307403[_0x99dd('0x21')](_0x99dd('0x22'),_0x5682e7+'-'+_0x1712c4+'/'+_0xde6b80)['json'](_0x28de47);}return null;};}function saveUpdates(_0x389af7){return function(_0x112bb7){if(_0x112bb7){return _0x112bb7[_0x99dd('0x23')](_0x389af7)[_0x99dd('0x12')](function(_0x1dd384){return _0x1dd384;});}return null;};}function removeEntity(_0x53dedc){return function(_0x5675cf){if(_0x5675cf){return _0x5675cf['destroy']()['then'](function(){_0x53dedc[_0x99dd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e846){return function(_0x50975a){if(!_0x50975a){_0x25e846[_0x99dd('0x24')](0x194);}return _0x50975a;};}function handleError(_0x54d515,_0xa72560){_0xa72560=_0xa72560||0x1f4;return function(_0x71b4e7){logger[_0x99dd('0x17')](_0x71b4e7[_0x99dd('0x25')]);if(_0x71b4e7[_0x99dd('0x26')]){delete _0x71b4e7[_0x99dd('0x26')];}_0x54d515[_0x99dd('0x1b')](_0xa72560)[_0x99dd('0x27')](_0x71b4e7);};}exports[_0x99dd('0x28')]=function(_0x1fe7c2,_0x4e65cf){var _0x14ff49={},_0x2f584f={},_0x3eb2a9={'count':0x0,'rows':[]};var _0x24eeb4=_['map'](db[_0x99dd('0x29')][_0x99dd('0x2a')],function(_0x1ba383){return{'name':_0x1ba383[_0x99dd('0x2b')],'type':_0x1ba383[_0x99dd('0x2c')][_0x99dd('0x2d')]};});_0x2f584f['model']=_['map'](_0x24eeb4,_0x99dd('0x26'));_0x2f584f[_0x99dd('0x2e')]=_[_0x99dd('0x2f')](_0x1fe7c2['query']);_0x2f584f[_0x99dd('0x30')]=_['intersection'](_0x2f584f[_0x99dd('0x31')],_0x2f584f[_0x99dd('0x2e')]);_0x14ff49[_0x99dd('0x32')]=_[_0x99dd('0x33')](_0x2f584f[_0x99dd('0x31')],qs['fields'](_0x1fe7c2[_0x99dd('0x2e')][_0x99dd('0x34')]));_0x14ff49[_0x99dd('0x32')]=_0x14ff49[_0x99dd('0x32')][_0x99dd('0x35')]?_0x14ff49['attributes']:_0x2f584f[_0x99dd('0x31')];if(!_0x1fe7c2[_0x99dd('0x2e')][_0x99dd('0x36')]('nolimit')){_0x14ff49[_0x99dd('0x1f')]=qs[_0x99dd('0x1f')](_0x1fe7c2[_0x99dd('0x2e')][_0x99dd('0x1f')]);_0x14ff49[_0x99dd('0x1d')]=qs[_0x99dd('0x1d')](_0x1fe7c2['query']['offset']);}_0x14ff49[_0x99dd('0x37')]=qs[_0x99dd('0x38')](_0x1fe7c2[_0x99dd('0x2e')][_0x99dd('0x38')]);_0x14ff49['where']=qs[_0x99dd('0x30')](_[_0x99dd('0x39')](_0x1fe7c2[_0x99dd('0x2e')],_0x2f584f['filters']),_0x24eeb4);if(_0x1fe7c2[_0x99dd('0x2e')][_0x99dd('0x3a')]){_0x14ff49[_0x99dd('0x3b')]=_[_0x99dd('0x3c')](_0x14ff49[_0x99dd('0x3b')],{'$or':_[_0x99dd('0x3d')](_0x24eeb4,function(_0x5ccd8c){if(_0x5ccd8c['type']!==_0x99dd('0x3e')){var _0x4ab180={};_0x4ab180[_0x5ccd8c[_0x99dd('0x26')]]={'$like':'%'+_0x1fe7c2[_0x99dd('0x2e')][_0x99dd('0x3a')]+'%'};return _0x4ab180;}})});}_0x14ff49=_['merge']({},_0x14ff49,_0x1fe7c2['options']);var _0x11f7b9={'where':_0x14ff49['where']};return db[_0x99dd('0x29')][_0x99dd('0x20')](_0x11f7b9)[_0x99dd('0x12')](function(_0xbd0fd5){_0x3eb2a9[_0x99dd('0x20')]=_0xbd0fd5;if(_0x1fe7c2[_0x99dd('0x2e')]['includeAll']){_0x14ff49[_0x99dd('0x3f')]=[{'all':!![]}];}return db[_0x99dd('0x29')]['findAll'](_0x14ff49);})[_0x99dd('0x12')](function(_0x31a996){_0x3eb2a9[_0x99dd('0x40')]=_0x31a996;return _0x3eb2a9;})[_0x99dd('0x12')](respondWithFilteredResult(_0x4e65cf,_0x14ff49))['catch'](handleError(_0x4e65cf,null));};exports['show']=function(_0x224fbb,_0x3a3994){var _0x4584ea={'raw':!![],'where':{'id':_0x224fbb['params']['id']}},_0x4d3e43={};_0x4d3e43[_0x99dd('0x31')]=_[_0x99dd('0x2f')](db['MailMessage'][_0x99dd('0x2a')]);_0x4d3e43['query']=_[_0x99dd('0x2f')](_0x224fbb[_0x99dd('0x2e')]);_0x4d3e43[_0x99dd('0x30')]=_[_0x99dd('0x33')](_0x4d3e43[_0x99dd('0x31')],_0x4d3e43[_0x99dd('0x2e')]);_0x4584ea[_0x99dd('0x32')]=_[_0x99dd('0x33')](_0x4d3e43[_0x99dd('0x31')],qs['fields'](_0x224fbb['query'][_0x99dd('0x34')]));_0x4584ea[_0x99dd('0x32')]=_0x4584ea[_0x99dd('0x32')]['length']?_0x4584ea[_0x99dd('0x32')]:_0x4d3e43[_0x99dd('0x31')];if(_0x224fbb['query'][_0x99dd('0x41')]){_0x4584ea[_0x99dd('0x3f')]=[{'all':!![]}];}_0x4584ea=_[_0x99dd('0x3c')]({},_0x4584ea,_0x224fbb[_0x99dd('0x42')]);return db[_0x99dd('0x29')][_0x99dd('0x43')](_0x4584ea)[_0x99dd('0x12')](handleEntityNotFound(_0x3a3994,null))['then'](respondWithResult(_0x3a3994,null))[_0x99dd('0x44')](handleError(_0x3a3994,null));};exports[_0x99dd('0x23')]=function(_0x1b84da,_0x4935f7){if(_0x1b84da['body']['id']){delete _0x1b84da[_0x99dd('0x45')]['id'];}return db[_0x99dd('0x29')][_0x99dd('0x43')]({'where':{'id':_0x1b84da[_0x99dd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4935f7,null))['then'](saveUpdates(_0x1b84da[_0x99dd('0x45')],null))[_0x99dd('0x12')](respondWithResult(_0x4935f7,null))[_0x99dd('0x44')](handleError(_0x4935f7,null));};exports[_0x99dd('0x47')]=function(_0x1ba28e,_0x58e1da){return db[_0x99dd('0x29')]['find']({'where':{'id':_0x1ba28e[_0x99dd('0x46')]['id']}})[_0x99dd('0x12')](handleEntityNotFound(_0x58e1da,null))[_0x99dd('0x12')](removeEntity(_0x58e1da,null))[_0x99dd('0x44')](handleError(_0x58e1da,null));};exports['describe']=function(_0x267336,_0x31882a){return db[_0x99dd('0x29')][_0x99dd('0x48')]()[_0x99dd('0x12')](respondWithResult(_0x31882a,null))[_0x99dd('0x44')](handleError(_0x31882a,null));};exports[_0x99dd('0x49')]=function(_0x4d2b01,_0x7c12be){return db[_0x99dd('0x29')][_0x99dd('0x49')](_0x4d2b01['body'])[_0x99dd('0x12')](function(_0x231bc9){if(_0x231bc9){if(_0x231bc9['direction']===_0x99dd('0x4a')&&!_0x231bc9[_0x99dd('0x4b')]){var _0x4b6dc1,_0x7f907,_0x186d0b;if(_0x4d2b01[_0x99dd('0x45')]['to']){_0x7f907=_0x4d2b01[_0x99dd('0x45')]['to']['split'](',')[0x0];}return db[_0x99dd('0x4c')]['findOne']({'where':{'id':_0x231bc9[_0x99dd('0x4d')]},'include':[{'model':db[_0x99dd('0x4e')],'as':_0x99dd('0x4f'),'include':[{'model':db['CmContact'],'as':_0x99dd('0x50'),'where':{'email':_0x7f907},'limit':0x1,'order':[[_0x99dd('0x51'),_0x99dd('0x52')]]}]},{'model':db[_0x99dd('0x53')],'as':_0x99dd('0x54'),'raw':!![],'include':[{'model':db[_0x99dd('0x55')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x1755ba){_0x4b6dc1=_0x1755ba;if(!_0x4b6dc1||!_0x4b6dc1[_0x99dd('0x54')])return;var _0x3f4acd=_0x4b6dc1[_0x99dd('0x56')]();if(_0x4d2b01[_0x99dd('0x45')][_0x99dd('0x57')]&&_0x4d2b01[_0x99dd('0x45')][_0x99dd('0x57')][_0x99dd('0x35')]){for(var _0x2edb83=0x0;_0x2edb83<_0x4d2b01['body'][_0x99dd('0x57')][_0x99dd('0x35')];_0x2edb83+=0x1){_0x4d2b01[_0x99dd('0x45')][_0x99dd('0x57')][_0x2edb83]={'filename':_0x4d2b01['body'][_0x99dd('0x57')][_0x2edb83][_0x99dd('0x26')],'path':path[_0x99dd('0x58')](config[_0x99dd('0x59')],_0x99dd('0x5a'),_0x4d2b01[_0x99dd('0x45')][_0x99dd('0x57')][_0x2edb83][_0x99dd('0x5b')])};}}_0x186d0b={'account':_0x3f4acd,'message':_0x4d2b01[_0x99dd('0x45')]};return;})[_0x99dd('0x12')](function(){if(_0x4b6dc1[_0x99dd('0x4f')]){if(_0x4b6dc1[_0x99dd('0x4f')][_0x99dd('0x50')][_0x99dd('0x35')]){return _0x4b6dc1['List']['Contacts'][0x0];}else{return db[_0x99dd('0x5c')]['create'](_[_0x99dd('0x5d')](_0x4d2b01[_0x99dd('0x45')],{'firstName':_0x4d2b01[_0x99dd('0x45')]['to'],'email':_0x4d2b01[_0x99dd('0x45')]['to'],'phone':_0x4d2b01[_0x99dd('0x45')]['to'],'ListId':_0x4b6dc1[_0x99dd('0x5e')]}));}}else{throw new Error(_0x99dd('0x5f'));}})[_0x99dd('0x12')](function(){if(_0x186d0b){return respondWithRpcPromise(_0x99dd('0x60'),_0x99dd('0x61'),_0x186d0b,client9003)[_0x99dd('0x12')](function(_0x2adf70){return _0x231bc9[_0x99dd('0x23')]({'read':!![],'messageId':_0x2adf70['messageId'],'sentAt':moment()['format'](_0x99dd('0x62'))});})['catch'](function(_0x5ef750){logger[_0x99dd('0x17')]('%s',JSON['stringify'](_0x5ef750));return _0x231bc9;});}return _0x231bc9;});}return _0x231bc9;}})[_0x99dd('0x12')](respondWithResult(_0x7c12be,0xc9))[_0x99dd('0x44')](handleError(_0x7c12be,null));};exports[_0x99dd('0x63')]=function(_0x27440e,_0x4a9680){var _0x151f6e={'agent':{},'channel':'mail'};if(_0x27440e['body']['id']){delete _0x27440e[_0x99dd('0x45')]['id'];}_0x27440e[_0x99dd('0x45')][_0x99dd('0x64')]=!![];_0x27440e[_0x99dd('0x45')][_0x99dd('0x65')]=moment()[_0x99dd('0x66')](_0x99dd('0x62'));_0x27440e[_0x99dd('0x45')]['UserId']=_0x27440e[_0x99dd('0x45')]['UserId']||_0x27440e[_0x99dd('0x67')]['id'];_0x151f6e[_0x99dd('0x68')]['id']=_0x27440e[_0x99dd('0x45')][_0x99dd('0x69')];return db['MailMessage'][_0x99dd('0x43')]({'where':{'id':_0x27440e[_0x99dd('0x46')]['id'],'UserId':null}})[_0x99dd('0x12')](handleEntityNotFound(_0x4a9680,null))[_0x99dd('0x12')](saveUpdates(_0x27440e[_0x99dd('0x45')],null))['then'](function(_0x157852){if(_0x157852){_0x151f6e[_0x99dd('0x18')]=_0x157852[_0x99dd('0x6a')]({'plain':!![]});return db['MailInteraction'][_0x99dd('0x43')]({'where':{'id':_0x157852['MailInteractionId']}});}return null;})[_0x99dd('0x12')](handleEntityNotFound(_0x4a9680,null))[_0x99dd('0x12')](function(_0x24839c){if(_0x24839c){return _0x24839c[_0x99dd('0x23')]({'UserId':_0x27440e[_0x99dd('0x45')]['UserId'],'read1stAt':_[_0x99dd('0x6b')](_0x24839c['read1stAt'])?moment()[_0x99dd('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x3c4f9d){if(_0x3c4f9d){_0x151f6e[_0x99dd('0x6c')]=_0x3c4f9d[_0x99dd('0x6a')]({'plain':!![]});interaction_log[_0x99dd('0x19')](_0x99dd('0x6d'),_0x27440e['user']['id'],_0x27440e[_0x99dd('0x67')][_0x99dd('0x26')],_0x27440e[_0x99dd('0x67')][_0x99dd('0x6e')],_0x151f6e[_0x99dd('0x6c')]['id'],_0x27440e['body']?JSON[_0x99dd('0x16')](_0x27440e[_0x99dd('0x45')]):_0x99dd('0x6f'));return respondWithRpcPromise(_0x99dd('0x70'),_0x99dd('0x71'),_0x151f6e);}return null;})[_0x99dd('0x12')](function(_0x20a99c){var _0xef04db='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x20a99c[_0x99dd('0x18')]['ContactId'];return db[_0x99dd('0x72')][_0x99dd('0x2e')](_0xef04db,{'type':db[_0x99dd('0x73')][_0x99dd('0x74')][_0x99dd('0x75')],'raw':!![]})[_0x99dd('0x12')](function(_0x277c6c){return _0x277c6c;});})[_0x99dd('0x12')](function(_0x4ee684){if(_0x4ee684){_0x151f6e[_0x99dd('0x18')]['contact']=_0x4ee684[0x0];if(!_0x27440e[_0x99dd('0x45')][_0x99dd('0x69')])return;return db[_0x99dd('0x76')][_0x99dd('0x43')]({'where':{'id':_0x27440e[_0x99dd('0x45')][_0x99dd('0x69')],'role':'agent'},'attributes':['id',_0x99dd('0x26'),_0x99dd('0x77'),_0x99dd('0x78'),_0x99dd('0x79')],'raw':!![]});}return null;})[_0x99dd('0x12')](function(_0x403faa){if(!_0x403faa)return null;_0x151f6e[_0x99dd('0x18')]['agent']=_0x403faa;return _0x151f6e;})[_0x99dd('0x12')](function(_0x350842){if(_0x350842){if(_0x27440e[_0x99dd('0x45')]['manual']){_0x151f6e['message'][_0x99dd('0x7a')]=util[_0x99dd('0x66')](_0x99dd('0x7b'),_0x27440e[_0x99dd('0x67')][_0x99dd('0x26')]);_0x151f6e[_0x99dd('0x18')][_0x99dd('0x7c')]=_0x151f6e[_0x99dd('0x7c')];_0x151f6e[_0x99dd('0x18')][_0x99dd('0x7d')]=_0x151f6e[_0x99dd('0x7c')];_0x151f6e[_0x99dd('0x18')][_0x99dd('0x7e')]=_0x99dd('0x63');_0x151f6e[_0x99dd('0x18')]['body']=htmlToText[_0x99dd('0x7f')](_0x151f6e[_0x99dd('0x18')][_0x99dd('0x45')]);return respondWithRpcPromise(_0x99dd('0x80'),'EventManager',{'event':_0x99dd('0x81'),'message':_0x151f6e[_0x99dd('0x18')]},client9002)[_0x99dd('0x12')](function(){return _0x151f6e;});}return _0x151f6e;}return null;})[_0x99dd('0x12')](respondWithResult(_0x4a9680,null))['catch'](handleError(_0x4a9680,null));};exports[_0x99dd('0x82')]=function(_0x33a82a,_0x257025){var _0x6dc61d={'agent':{},'channel':_0x99dd('0x83')};if(_0x33a82a['body']['id']){delete _0x33a82a[_0x99dd('0x45')]['id'];}_0x33a82a[_0x99dd('0x45')][_0x99dd('0x69')]=_0x33a82a['body']['UserId']||_0x33a82a['user']['id'];_0x6dc61d[_0x99dd('0x68')]['id']=_0x33a82a[_0x99dd('0x45')]['UserId'];return db['MailMessage']['find']({'where':{'id':_0x33a82a[_0x99dd('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x257025,null))['then'](function(_0x4cd7ea){if(_0x4cd7ea){_0x6dc61d[_0x99dd('0x18')]=_0x4cd7ea[_0x99dd('0x6a')]({'plain':!![]});return db['MailInteraction'][_0x99dd('0x43')]({'where':{'id':_0x4cd7ea[_0x99dd('0x84')]}});}return null;})[_0x99dd('0x12')](handleEntityNotFound(_0x257025,null))[_0x99dd('0x12')](function(_0x2b76e0){if(_0x2b76e0){_0x6dc61d['interaction']=_0x2b76e0['get']({'plain':!![]});interaction_log[_0x99dd('0x19')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x33a82a[_0x99dd('0x67')]['id'],_0x33a82a[_0x99dd('0x67')]['name'],_0x33a82a[_0x99dd('0x67')][_0x99dd('0x6e')],_0x6dc61d[_0x99dd('0x6c')]['id'],_0x33a82a[_0x99dd('0x45')]?JSON[_0x99dd('0x16')](_0x33a82a[_0x99dd('0x45')]):_0x99dd('0x6f'));return respondWithRpcPromise(_0x99dd('0x85'),_0x99dd('0x86'),_0x6dc61d);}return null;})[_0x99dd('0x12')](function(_0x12bbd2){var _0x1d58c9=_0x99dd('0x87')+_0x12bbd2[_0x99dd('0x18')][_0x99dd('0x88')];return db[_0x99dd('0x72')][_0x99dd('0x2e')](_0x1d58c9,{'type':db[_0x99dd('0x73')][_0x99dd('0x74')][_0x99dd('0x75')],'raw':!![]})[_0x99dd('0x12')](function(_0x1fb4b0){return _0x1fb4b0;});})[_0x99dd('0x12')](function(_0x3d30dd){if(_0x3d30dd){_0x6dc61d[_0x99dd('0x18')][_0x99dd('0x89')]=_0x3d30dd[0x0];if(!_0x33a82a[_0x99dd('0x45')][_0x99dd('0x69')])return;return db[_0x99dd('0x76')]['find']({'where':{'id':_0x33a82a[_0x99dd('0x45')]['UserId'],'role':_0x99dd('0x68')},'attributes':['id',_0x99dd('0x26'),_0x99dd('0x77'),_0x99dd('0x78'),_0x99dd('0x79')],'raw':!![]});}return null;})[_0x99dd('0x12')](function(_0x5064fb){if(!_0x5064fb)return null;_0x6dc61d[_0x99dd('0x18')][_0x99dd('0x68')]=_0x5064fb;return _0x6dc61d;})['then'](function(_0x425c41){if(_0x425c41){_0x425c41[_0x99dd('0x18')][_0x99dd('0x7a')]=util['format']('SIP/%s',_0x33a82a[_0x99dd('0x67')][_0x99dd('0x26')]);_0x425c41['message'][_0x99dd('0x7c')]=_0x6dc61d['channel'];_0x425c41[_0x99dd('0x18')]['motionChannel']=_0x6dc61d[_0x99dd('0x7c')];_0x425c41[_0x99dd('0x18')][_0x99dd('0x7e')]=_0x99dd('0x82');_0x425c41['message']['body']=htmlToText[_0x99dd('0x7f')](_0x6dc61d[_0x99dd('0x18')]['body']);respondWithRpcPromise(_0x99dd('0x80'),_0x99dd('0x80'),{'event':_0x99dd('0x8a'),'message':_0x425c41[_0x99dd('0x18')]},client9002);return _0x6dc61d;}return null;})[_0x99dd('0x12')](respondWithResult(_0x257025,null))[_0x99dd('0x44')](handleError(_0x257025,null));};exports[_0x99dd('0x8b')]=function(_0x731b3b,_0x25a797){var _0x42e0ae=moment()[_0x99dd('0x8c')]()[_0x99dd('0x8d')]();var _0x5ae629=path['join'](config[_0x99dd('0x59')],'server',_0x99dd('0x8e'),'tmp');var _0x153ed7=path['join'](config[_0x99dd('0x59')],_0x99dd('0x8f'),_0x99dd('0x8e'),'attachments');var _0x2f1bb8=util[_0x99dd('0x66')]('message-%s.eml',_0x42e0ae);return db[_0x99dd('0x29')][_0x99dd('0x43')]({'where':{'id':_0x731b3b[_0x99dd('0x46')]['id']},'attributes':['id',_0x99dd('0x45'),'from','to','cc',_0x99dd('0x90'),_0x99dd('0x91'),_0x99dd('0x92')],'include':_0x731b3b['query']['attachments']?[{'model':db[_0x99dd('0x93')],'as':_0x99dd('0x94')}]:undefined})[_0x99dd('0x12')](handleEntityNotFound(_0x25a797,null))[_0x99dd('0x12')](function(_0x8b9ccb){if(_0x8b9ccb){var _0x471efe=_0x8b9ccb;var _0x3f7580={'from':_0x471efe['from'],'to':_0x471efe['to'],'subject':_0x471efe['subject'],'html':htmlEntities[_0x99dd('0x95')](_0x471efe[_0x99dd('0x45')]),'headers':{'Date':moment(_0x471efe['createdAt'])[_0x99dd('0x66')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x8b9ccb['cc']){_0x3f7580[_0x99dd('0x96')]['Cc']=_0x8b9ccb['cc'];}if(_0x8b9ccb[_0x99dd('0x90')]){_0x3f7580[_0x99dd('0x96')]['Bcc']=_0x8b9ccb['bcc'];}return new BPromise(function(_0x358ab5,_0x8e99ff){if(_0x8b9ccb['Attachments']){for(var _0x5d14e3=0x0;_0x5d14e3<_0x8b9ccb[_0x99dd('0x94')][_0x99dd('0x35')];_0x5d14e3++){var _0x1a5e1b=_0x8b9ccb[_0x99dd('0x94')][_0x5d14e3];var _0xef869c=path[_0x99dd('0x58')](_0x153ed7,_0x1a5e1b[_0x99dd('0x5b')]);if(fs[_0x99dd('0x97')](_0xef869c)){_0x3f7580[_0x99dd('0x57')][_0x99dd('0x98')]({'name':_0x1a5e1b['name'],'contentType':_0x1a5e1b['type'],'data':fs[_0x99dd('0x99')](_0xef869c)});}}}emlformat[_0x99dd('0x9a')](_0x3f7580,function(_0x180cf5,_0x1f1132){if(_0x180cf5)return _0x8e99ff(_0x180cf5);fs[_0x99dd('0x9b')](path['join'](_0x5ae629,_0x2f1bb8),_0x1f1132);return _0x358ab5(_0x1f1132);});});}})[_0x99dd('0x12')](function(_0x592f1f){if(_0x592f1f){return _0x25a797['download'](path[_0x99dd('0x58')](_0x5ae629,_0x2f1bb8),_0x2f1bb8,function(_0x17e869){if(!_0x17e869)fs[_0x99dd('0x9c')](path[_0x99dd('0x58')](_0x5ae629,_0x2f1bb8));});}})[_0x99dd('0x44')](handleError(_0x25a797,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 13c156e..b3b7f93 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 _0x26df=['remove','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x1bf735,_0x242b6e){var _0x4237d2=function(_0x30f42f){while(--_0x30f42f){_0x1bf735['push'](_0x1bf735['shift']());}};_0x4237d2(++_0x242b6e);}(_0x26df,0x143));var _0xf26d=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x26df[_0x267c52];return _0x46c47b;};'use strict';var EventEmitter=require(_0xf26d('0x0'));var MailMessage=require(_0xf26d('0x1'))['db'][_0xf26d('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf26d('0x3')](0x0);var events={'afterCreate':_0xf26d('0x4'),'afterUpdate':'update','afterDestroy':_0xf26d('0x5')};function emitEvent(_0x3aabb1){return function(_0x4ca828,_0x4d89fd,_0x4beede){MailMessageEvents['emit'](_0x3aabb1+':'+_0x4ca828['id'],_0x4ca828);MailMessageEvents['emit'](_0x3aabb1,_0x4ca828);_0x4beede(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xf26d('0x6')](e,emitEvent(event));}}module[_0xf26d('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x1a99=['events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5ac625,_0x49c43b){var _0x1dfed1=function(_0x1b8afd){while(--_0x1b8afd){_0x5ac625['push'](_0x5ac625['shift']());}};_0x1dfed1(++_0x49c43b);}(_0x1a99,0x14a));var _0x91a9=function(_0x5bcadb,_0x35270a){_0x5bcadb=_0x5bcadb-0x0;var _0x501049=_0x1a99[_0x5bcadb];return _0x501049;};'use strict';var EventEmitter=require(_0x91a9('0x0'));var MailMessage=require(_0x91a9('0x1'))['db'][_0x91a9('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x91a9('0x3')](0x0);var events={'afterCreate':_0x91a9('0x4'),'afterUpdate':_0x91a9('0x5'),'afterDestroy':_0x91a9('0x6')};function emitEvent(_0x381627){return function(_0x45f9ba,_0x3c1554,_0x16986d){MailMessageEvents[_0x91a9('0x7')](_0x381627+':'+_0x45f9ba['id'],_0x45f9ba);MailMessageEvents[_0x91a9('0x7')](_0x381627,_0x45f9ba);_0x16986d(null);};}for(var e in events){if(events[_0x91a9('0x8')](e)){var event=events[e];MailMessage[_0x91a9('0x9')](e,emitEvent(event));}}module[_0x91a9('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 8d66d43..8452ba1 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 _0x2d75=['exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','body','get','direction','toLowerCase','out','isNil','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d75,0xc3));var _0x52d7=function(_0x18f6ee,_0x241f93){_0x18f6ee=_0x18f6ee-0x0;var _0x42ac3f=_0x2d75[_0x18f6ee];return _0x42ac3f;};'use strict';var _=require('lodash');var util=require(_0x52d7('0x0'));var logger=require(_0x52d7('0x1'))(_0x52d7('0x2'));var moment=require(_0x52d7('0x3'));var BPromise=require(_0x52d7('0x4'));var rp=require(_0x52d7('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0x52d7('0x6'));var config=require(_0x52d7('0x7'));var attributes=require('./mailMessage.attributes');module[_0x52d7('0x8')]=function(_0x55e7b2,_0x193060){return _0x55e7b2[_0x52d7('0x9')](_0x52d7('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x52d7('0xb'),'fields':['messageId']},{'name':_0x52d7('0xc'),'fields':[_0x52d7('0xd'),_0x52d7('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x13f277,_0x4c4c90,_0x5ea4af){if(_0x13f277[_0x52d7('0xf')]){_0x13f277[_0x52d7('0xd')]=htmlToText['fromString'](_0x13f277[_0x52d7('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5ea4af(null,_0x4c4c90);},'afterCreate':function(_0x1fa47c,_0xf23ea9,_0x5a2241){var _0x5902f7=_0x55e7b2['models'];var _0x1d4848=_0x1fa47c[_0x52d7('0x10')]({'plain':!![]});if(_0x1d4848[_0x52d7('0x11')][_0x52d7('0x12')]()==='in'||_0x1d4848[_0x52d7('0x11')]['toLowerCase']()===_0x52d7('0x13')&&!_0x1d4848['secret']&&!_[_0x52d7('0x14')](_0x1d4848['UserId'])){_0x5902f7['MailInteraction'][_0x52d7('0x15')]({'where':{'id':_0x1d4848[_0x52d7('0x16')]}})[_0x52d7('0x17')](function(_0x44853c){if(_0x44853c){_0x44853c[_0x52d7('0x18')]({'lastMsgAt':_0x1d4848[_0x52d7('0x19')],'lastMsgDirection':_0x1d4848[_0x52d7('0x11')][_0x52d7('0x12')]()});}})[_0x52d7('0x1a')](function(_0x4a2d77){console['error'](_0x4a2d77);});}_0x5a2241();}},'charset':_0x52d7('0x1b'),'collate':_0x52d7('0x1c')});}; \ No newline at end of file +var _0x0946=['direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','update','catch','error','utf8mb4','lodash','util','../../config/logger','api','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','get'];(function(_0x3789b9,_0x5c2f00){var _0x4d020d=function(_0x170650){while(--_0x170650){_0x3789b9['push'](_0x3789b9['shift']());}};_0x4d020d(++_0x5c2f00);}(_0x0946,0x148));var _0x6094=function(_0x127c7b,_0x1f65e7){_0x127c7b=_0x127c7b-0x0;var _0x1708eb=_0x0946[_0x127c7b];return _0x1708eb;};'use strict';var _=require(_0x6094('0x0'));var util=require(_0x6094('0x1'));var logger=require(_0x6094('0x2'))(_0x6094('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6094('0x4'));var htmlToText=require(_0x6094('0x5'));var fs=require('fs');var path=require(_0x6094('0x6'));var rimraf=require(_0x6094('0x7'));var config=require(_0x6094('0x8'));var attributes=require(_0x6094('0x9'));module[_0x6094('0xa')]=function(_0x305617,_0x45c48a){return _0x305617[_0x6094('0xb')](_0x6094('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6094('0xd')]},{'name':_0x6094('0xe'),'fields':[_0x6094('0xf'),_0x6094('0x10')],'type':_0x6094('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5e3ffc,_0x5d75cc,_0x3eadc6){if(_0x5e3ffc['body']){_0x5e3ffc[_0x6094('0xf')]=htmlToText[_0x6094('0x12')](_0x5e3ffc[_0x6094('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3eadc6(null,_0x5d75cc);},'afterCreate':function(_0x1a7549,_0x977014,_0x78dc2){var _0x5148a6=_0x305617[_0x6094('0x14')];var _0x7a548b=_0x1a7549[_0x6094('0x15')]({'plain':!![]});if(_0x7a548b[_0x6094('0x16')][_0x6094('0x17')]()==='in'||_0x7a548b[_0x6094('0x16')]['toLowerCase']()===_0x6094('0x18')&&!_0x7a548b[_0x6094('0x19')]&&!_[_0x6094('0x1a')](_0x7a548b[_0x6094('0x1b')])){_0x5148a6['MailInteraction'][_0x6094('0x1c')]({'where':{'id':_0x7a548b[_0x6094('0x1d')]}})[_0x6094('0x1e')](function(_0x22227b){if(_0x22227b){_0x22227b[_0x6094('0x1f')]({'lastMsgAt':_0x7a548b['createdAt'],'lastMsgDirection':_0x7a548b['direction'][_0x6094('0x17')]()});}})[_0x6094('0x20')](function(_0x2499e1){console[_0x6094('0x21')](_0x2499e1);});}_0x78dc2();}},'charset':_0x6094('0x22'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 3d445c5..e2a48c2 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 _0x0972=['message','catch','CreateMailMessage','MailMessage','body','options','raw','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x351be4,_0x2d1332){var _0x192da5=function(_0x3e0e25){while(--_0x3e0e25){_0x351be4['push'](_0x351be4['shift']());}};_0x192da5(++_0x2d1332);}(_0x0972,0x64));var _0x2097=function(_0x20257c,_0x392ba9){_0x20257c=_0x20257c-0x0;var _0x2db5a6=_0x0972[_0x20257c];return _0x2db5a6;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});config[_0x2097('0xa')]=_['defaults'](config[_0x2097('0xa')],{'host':_0x2097('0xb'),'port':0x18eb});var socket=require(_0x2097('0xc'))(new Redis(config[_0x2097('0xa')]));require(_0x2097('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e0024,_0x3b8b76,_0x131f06){return new BPromise(function(_0x430754,_0x7baeb3){return client[_0x2097('0xe')](_0x2e0024,_0x131f06)[_0x2097('0xf')](function(_0x1d1166){logger[_0x2097('0x10')](_0x2097('0x11'),_0x3b8b76,_0x2097('0x12'));logger[_0x2097('0x13')](_0x2097('0x14'),_0x3b8b76,_0x2097('0x12'),JSON[_0x2097('0x15')](_0x1d1166));if(_0x1d1166[_0x2097('0x16')]){if(_0x1d1166[_0x2097('0x16')][_0x2097('0x17')]===0x1f4){logger[_0x2097('0x16')](_0x2097('0x11'),_0x3b8b76,_0x1d1166['error'][_0x2097('0x18')]);return _0x7baeb3(_0x1d1166[_0x2097('0x16')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x3b8b76,_0x1d1166[_0x2097('0x16')]['message']);return _0x430754(_0x1d1166[_0x2097('0x16')][_0x2097('0x18')]);}else{logger[_0x2097('0x10')](_0x2097('0x11'),_0x3b8b76,_0x2097('0x12'));_0x430754(_0x1d1166['result'][_0x2097('0x18')]);}})[_0x2097('0x19')](function(_0x451584){logger[_0x2097('0x16')](_0x2097('0x11'),_0x3b8b76,_0x451584);_0x7baeb3(_0x451584);});});}exports[_0x2097('0x1a')]=function(_0x253f5d){var _0x46b5e0=this;return new Promise(function(_0x5d8b9e,_0x4d957e){return db[_0x2097('0x1b')]['create'](_0x253f5d[_0x2097('0x1c')],{'raw':_0x253f5d[_0x2097('0x1d')]?_0x253f5d['options'][_0x2097('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2e17c8){logger[_0x2097('0x10')](_0x2097('0x1a'),_0x253f5d);logger[_0x2097('0x13')](_0x2097('0x1a'),_0x253f5d,JSON[_0x2097('0x15')](_0x2e17c8));_0x5d8b9e(_0x2e17c8);})['catch'](function(_0xae5f9){logger['error'](_0x2097('0x1a'),_0xae5f9[_0x2097('0x18')],_0x253f5d);_0x4d957e(_0x46b5e0[_0x2097('0x16')](0x1f4,_0xae5f9[_0x2097('0x18')]));});});}; \ No newline at end of file +var _0xed3c=['request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateMailMessage','MailMessage','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','localhost','register'];(function(_0x59e95d,_0x15fec9){var _0xb86518=function(_0x2f9417){while(--_0x2f9417){_0x59e95d['push'](_0x59e95d['shift']());}};_0xb86518(++_0x15fec9);}(_0xed3c,0x1a6));var _0xced3=function(_0x211311,_0x5e08e9){_0x211311=_0x211311-0x0;var _0x12d89b=_0xed3c[_0x211311];return _0x12d89b;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xced3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0xced3('0xc')](socket);function respondWithRpcPromise(_0x321c42,_0x3e5a04,_0x12612f){return new BPromise(function(_0x1cb639,_0x5934b2){return client[_0xced3('0xd')](_0x321c42,_0x12612f)[_0xced3('0xe')](function(_0x3da0ff){logger['info'](_0xced3('0xf'),_0x3e5a04,_0xced3('0x10'));logger[_0xced3('0x11')](_0xced3('0x12'),_0x3e5a04,_0xced3('0x10'),JSON[_0xced3('0x13')](_0x3da0ff));if(_0x3da0ff[_0xced3('0x14')]){if(_0x3da0ff['error'][_0xced3('0x15')]===0x1f4){logger['error'](_0xced3('0xf'),_0x3e5a04,_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);return _0x5934b2(_0x3da0ff[_0xced3('0x14')]['message']);}logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x3da0ff['error'][_0xced3('0x16')]);return _0x1cb639(_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);}else{logger[_0xced3('0x17')]('MailMessage,\x20%s,\x20%s',_0x3e5a04,_0xced3('0x10'));_0x1cb639(_0x3da0ff['result'][_0xced3('0x16')]);}})[_0xced3('0x18')](function(_0x32c402){logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x32c402);_0x5934b2(_0x32c402);});});}exports[_0xced3('0x19')]=function(_0xe0cf2e){var _0x16d30d=this;return new Promise(function(_0x3f688c,_0x17c011){return db[_0xced3('0x1a')]['create'](_0xe0cf2e['body'],{'raw':_0xe0cf2e['options']?_0xe0cf2e[_0xced3('0x1b')][_0xced3('0x1c')]===undefined?!![]:![]:!![]})[_0xced3('0xe')](function(_0x4bf915){logger[_0xced3('0x17')](_0xced3('0x19'),_0xe0cf2e);logger['debug']('CreateMailMessage',_0xe0cf2e,JSON[_0xced3('0x13')](_0x4bf915));_0x3f688c(_0x4bf915);})[_0xced3('0x18')](function(_0x219fa8){logger[_0xced3('0x14')]('CreateMailMessage',_0x219fa8[_0xced3('0x16')],_0xe0cf2e);_0x17c011(_0x16d30d[_0xced3('0x14')](0x1f4,_0x219fa8['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index b63a990..55d58a8 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 _0x4beb=['remove','update','emit','register','./mailMessage.events'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x4beb,0x17b));var _0xb4be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4beb[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require(_0xb4be('0x0'));var events=['save',_0xb4be('0x1'),_0xb4be('0x2')];function createListener(_0x2e384b,_0x2ce379){return function(_0x1bd77b){_0x2ce379[_0xb4be('0x3')](_0x2e384b,_0x1bd77b);};}function removeListener(_0x551157,_0x45e478){return function(){MailMessageEvents['removeListener'](_0x551157,_0x45e478);};}exports[_0xb4be('0x4')]=function(_0x317703){for(var _0x225f26=0x0,_0x4312b7=events['length'];_0x225f26<_0x4312b7;_0x225f26++){var _0x288716=events[_0x225f26];var _0x3217dd=createListener('mailMessage:'+_0x288716,_0x317703);MailMessageEvents['on'](_0x288716,_0x3217dd);}}; \ No newline at end of file +var _0xb885=['save','update','emit','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0x2fd8a7,_0x5db621){var _0x4bdc24=function(_0x30ef41){while(--_0x30ef41){_0x2fd8a7['push'](_0x2fd8a7['shift']());}};_0x4bdc24(++_0x5db621);}(_0xb885,0x6f));var _0x5b88=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0xb885[_0x594ece];return _0x471bc4;};'use strict';var MailMessageEvents=require(_0x5b88('0x0'));var events=[_0x5b88('0x1'),'remove',_0x5b88('0x2')];function createListener(_0x2f3724,_0x2eb468){return function(_0x3372e4){_0x2eb468[_0x5b88('0x3')](_0x2f3724,_0x3372e4);};}function removeListener(_0x3fdcdf,_0x348039){return function(){MailMessageEvents[_0x5b88('0x4')](_0x3fdcdf,_0x348039);};}exports[_0x5b88('0x5')]=function(_0x116286){for(var _0x44d2cd=0x0,_0xe57ab8=events[_0x5b88('0x6')];_0x44d2cd<_0xe57ab8;_0x44d2cd++){var _0xc94adb=events[_0x44d2cd];var _0x42806f=createListener(_0x5b88('0x7')+_0xc94adb,_0x116286);MailMessageEvents['on'](_0xc94adb,_0x42806f);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 6ee1945..85cf28e 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 _0xa584=['/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe'];(function(_0x241404,_0x59c73d){var _0x542ade=function(_0x536fd8){while(--_0x536fd8){_0x241404['push'](_0x241404['shift']());}};_0x542ade(++_0x59c73d);}(_0xa584,0x109));var _0x4a58=function(_0x28e5e4,_0x2c022c){_0x28e5e4=_0x28e5e4-0x0;var _0x29d092=_0xa584[_0x28e5e4];return _0x29d092;};'use strict';var multer=require(_0x4a58('0x0'));var util=require(_0x4a58('0x1'));var path=require(_0x4a58('0x2'));var timeout=require(_0x4a58('0x3'));var express=require(_0x4a58('0x4'));var router=express[_0x4a58('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4a58('0x6'));var interaction=require(_0x4a58('0x7'));var config=require(_0x4a58('0x8'));var controller=require(_0x4a58('0x9'));router[_0x4a58('0xa')]('/',auth[_0x4a58('0xb')](),controller['index']);router['get'](_0x4a58('0xc'),auth['isAuthenticated'](),controller[_0x4a58('0xd')]);router[_0x4a58('0xa')](_0x4a58('0xe'),auth[_0x4a58('0xb')](),controller[_0x4a58('0xf')]);router['get'](_0x4a58('0x10'),auth[_0x4a58('0xb')](),controller['getMembers']);router['get'](_0x4a58('0x11'),auth[_0x4a58('0xb')](),controller[_0x4a58('0x12')]);router[_0x4a58('0xa')](_0x4a58('0x13'),auth[_0x4a58('0xb')](),controller[_0x4a58('0x14')]);router[_0x4a58('0x15')]('/',auth['isAuthenticated'](),controller[_0x4a58('0x16')]);router['post'](_0x4a58('0x11'),auth[_0x4a58('0xb')](),controller[_0x4a58('0x17')]);router[_0x4a58('0x15')](_0x4a58('0x13'),auth[_0x4a58('0xb')](),controller[_0x4a58('0x18')]);router[_0x4a58('0x19')](_0x4a58('0xe'),auth[_0x4a58('0xb')](),controller['update']);router['delete'](_0x4a58('0xe'),auth[_0x4a58('0xb')](),controller[_0x4a58('0x1a')]);router[_0x4a58('0x1b')]('/:id/teams',auth[_0x4a58('0xb')](),controller[_0x4a58('0x1c')]);router[_0x4a58('0x1b')](_0x4a58('0x13'),auth[_0x4a58('0xb')](),controller[_0x4a58('0x1d')]);module[_0x4a58('0x1e')]=router; \ No newline at end of file +var _0x363d=['../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','destroy','removeTeams','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x363d,0x107));var _0xd363=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0x363d[_0x2c96f6];return _0x6d4808;};'use strict';var multer=require(_0xd363('0x0'));var util=require(_0xd363('0x1'));var path=require(_0xd363('0x2'));var timeout=require('connect-timeout');var express=require(_0xd363('0x3'));var router=express['Router']();var fs_extra=require(_0xd363('0x4'));var auth=require(_0xd363('0x5'));var interaction=require(_0xd363('0x6'));var config=require(_0xd363('0x7'));var controller=require(_0xd363('0x8'));router[_0xd363('0x9')]('/',auth[_0xd363('0xa')](),controller[_0xd363('0xb')]);router[_0xd363('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xd363('0xc')]);router['get'](_0xd363('0xd'),auth[_0xd363('0xa')](),controller['show']);router[_0xd363('0x9')](_0xd363('0xe'),auth[_0xd363('0xa')](),controller[_0xd363('0xf')]);router[_0xd363('0x9')](_0xd363('0x10'),auth[_0xd363('0xa')](),controller[_0xd363('0x11')]);router[_0xd363('0x9')]('/:id/users',auth[_0xd363('0xa')](),controller[_0xd363('0x12')]);router[_0xd363('0x13')]('/',auth[_0xd363('0xa')](),controller[_0xd363('0x14')]);router[_0xd363('0x13')]('/:id/teams',auth[_0xd363('0xa')](),controller[_0xd363('0x15')]);router[_0xd363('0x13')](_0xd363('0x16'),auth[_0xd363('0xa')](),controller[_0xd363('0x17')]);router[_0xd363('0x18')](_0xd363('0xd'),auth[_0xd363('0xa')](),controller[_0xd363('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd363('0x1a')]);router['delete'](_0xd363('0x10'),auth[_0xd363('0xa')](),controller[_0xd363('0x1b')]);router[_0xd363('0x1c')](_0xd363('0x16'),auth[_0xd363('0xa')](),controller['removeAgents']);module[_0xd363('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 83b4799..b01e19e 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 _0x5c5b=['STRING','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x44ab97,_0x329dcf){var _0x226980=function(_0x3863fd){while(--_0x3863fd){_0x44ab97['push'](_0x44ab97['shift']());}};_0x226980(++_0x329dcf);}(_0x5c5b,0x167));var _0xb5c5=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0x5c5b[_0x1d2bbb];return _0x38082b;};'use strict';var Sequelize=require(_0xb5c5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb5c5('0x1')]},'timeout':{'type':Sequelize[_0xb5c5('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb5c5('0x3')](_0xb5c5('0x4'),_0xb5c5('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x6bdc=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x1addbf,_0x147de4){var _0x1ca823=function(_0x4aa96c){while(--_0x4aa96c){_0x1addbf['push'](_0x1addbf['shift']());}};_0x1ca823(++_0x147de4);}(_0x6bdc,0x87));var _0xc6bd=function(_0x5d799f,_0x3d9a5e){_0x5d799f=_0x5d799f-0x0;var _0x2c08f7=_0x6bdc[_0x5d799f];return _0x2c08f7;};'use strict';var Sequelize=require(_0xc6bd('0x0'));module[_0xc6bd('0x1')]={'name':{'type':Sequelize[_0xc6bd('0x2')],'unique':_0xc6bd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc6bd('0x2')]},'timeout':{'type':Sequelize[_0xc6bd('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc6bd('0x5')](_0xc6bd('0x6'),_0xc6bd('0x7'),_0xc6bd('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 212fa27..161eda0 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 _0x9dbb=['./mailQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','MailQueue','include','query','findAll','rows','show','model','keys','filters','intersection','attributes','length','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','describe','getMembers','findOne','UserMailQueue','fields','hasOwnProperty','order','sort','pick','MailQueueId','filter','options','User','UserId','agent','mailPause','updatedAt','createdAt','format','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','Agents','each','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','bluebird','lodash','squel','ioredis','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0x9dbb,0x1e3));var _0xb9db=function(_0x21aa5b,_0x2c808f){_0x21aa5b=_0x21aa5b-0x0;var _0x2ca4c8=_0x9dbb[_0x21aa5b];return _0x2ca4c8;};'use strict';var BPromise=require(_0xb9db('0x0'));var util=require('util');var _=require(_0xb9db('0x1'));var squel=require(_0xb9db('0x2'));var Redis=require(_0xb9db('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0xb9db('0x4'));var db=require(_0xb9db('0x5'))['db'];config['redis']=_['defaults'](config[_0xb9db('0x6')],{'host':_0xb9db('0x7'),'port':0x18eb});var socket=require(_0xb9db('0x8'))(new Redis(config[_0xb9db('0x6')]));require(_0xb9db('0x9'))['register'](socket);function respondWithStatusCode(_0x5800a3,_0x158121){_0x158121=_0x158121||0xcc;return function(_0x34b848){if(_0x34b848){return _0x5800a3[_0xb9db('0xa')](_0x158121);}return _0x5800a3['status'](_0x158121)[_0xb9db('0xb')]();};}function respondWithResult(_0x11d49d,_0x513969){_0x513969=_0x513969||0xc8;return function(_0x584e8c){if(_0x584e8c){return _0x11d49d[_0xb9db('0xc')](_0x513969)[_0xb9db('0xd')](_0x584e8c);}};}function respondWithFilteredResult(_0x1efab5,_0x153f64){return function(_0x3064f8){if(_0x3064f8){var _0x1fa5cb=typeof _0x153f64[_0xb9db('0xe')]===_0xb9db('0xf')&&typeof _0x153f64[_0xb9db('0x10')]===_0xb9db('0xf');var _0x3ecb12=_0x3064f8[_0xb9db('0x11')];var _0x562040=_0x1fa5cb?0x0:_0x153f64['offset'];var _0x3d4005=_0x1fa5cb?_0x3064f8[_0xb9db('0x11')]:_0x153f64[_0xb9db('0xe')]+_0x153f64['limit'];var _0x33e235;if(_0x3d4005>=_0x3ecb12){_0x3d4005=_0x3ecb12;_0x33e235=0xc8;}else{_0x33e235=0xce;}_0x1efab5[_0xb9db('0xc')](_0x33e235);return _0x1efab5[_0xb9db('0x12')]('Content-Range',_0x562040+'-'+_0x3d4005+'/'+_0x3ecb12)[_0xb9db('0xd')](_0x3064f8);}return null;};}function saveUpdates(_0x466168){return function(_0x36f794){if(_0x36f794){return _0x36f794[_0xb9db('0x13')](_0x466168)[_0xb9db('0x14')](function(_0x244d13){return _0x244d13;});}return null;};}function removeEntity(_0x4af9a5){return function(_0x5d20df){if(_0x5d20df){return _0x5d20df[_0xb9db('0x15')]()[_0xb9db('0x14')](function(){var _0x2980a7=_0x5d20df['get']({'plain':!![]});var _0x59296a=_0xb9db('0x16');return db[_0xb9db('0x17')][_0xb9db('0x15')]({'where':{'type':_0x59296a,'resourceId':_0x2980a7['id']}})[_0xb9db('0x14')](function(){return _0x5d20df;});})['then'](function(){_0x4af9a5[_0xb9db('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bdd34){return function(_0x2aefe0){if(!_0x2aefe0){_0x4bdd34[_0xb9db('0xa')](0x194);}return _0x2aefe0;};}function handleError(_0x5cb2f0,_0x441a02){_0x441a02=_0x441a02||0x1f4;return function(_0x9209b6){logger[_0xb9db('0x18')](_0x9209b6[_0xb9db('0x19')]);if(_0x9209b6['name']){delete _0x9209b6[_0xb9db('0x1a')];}_0x5cb2f0['status'](_0x441a02)[_0xb9db('0x1b')](_0x9209b6);};}exports[_0xb9db('0x1c')]=function(_0x21006a,_0x7920b2){var _0x58771a={};var _0x548e58={'count':0x0,'rows':[]};var _0x3eb245=_[_0xb9db('0x1d')](db['MailQueue'][_0xb9db('0x1e')],function(_0x469fee){return{'name':_0x469fee[_0xb9db('0x1f')],'type':_0x469fee[_0xb9db('0x20')][_0xb9db('0x21')]};});_0x58771a=qs[_0xb9db('0x22')](_0x3eb245,_0x21006a);var _0x1678a6={'where':_0x58771a[_0xb9db('0x23')]};return db[_0xb9db('0x24')]['count'](_0x1678a6)[_0xb9db('0x14')](function(_0x415f87){_0x548e58[_0xb9db('0x11')]=_0x415f87;_0x58771a[_0xb9db('0x25')]=qs[_0xb9db('0x25')](_0x21006a[_0xb9db('0x26')]);return db[_0xb9db('0x24')][_0xb9db('0x27')](_0x58771a);})[_0xb9db('0x14')](function(_0x239753){_0x548e58[_0xb9db('0x28')]=_0x239753;return _0x548e58;})[_0xb9db('0x14')](respondWithFilteredResult(_0x7920b2,_0x58771a))['catch'](handleError(_0x7920b2,null));};exports[_0xb9db('0x29')]=function(_0x429ee6,_0x190f78){var _0x4db41a={'raw':!![],'where':{'id':_0x429ee6['params']['id']}},_0x2274c2={};_0x2274c2[_0xb9db('0x2a')]=_['keys'](db[_0xb9db('0x24')][_0xb9db('0x1e')]);_0x2274c2[_0xb9db('0x26')]=_[_0xb9db('0x2b')](_0x429ee6['query']);_0x2274c2[_0xb9db('0x2c')]=_[_0xb9db('0x2d')](_0x2274c2[_0xb9db('0x2a')],_0x2274c2['query']);_0x4db41a[_0xb9db('0x2e')]=_[_0xb9db('0x2d')](_0x2274c2[_0xb9db('0x2a')],qs['fields'](_0x429ee6['query']['fields']));_0x4db41a[_0xb9db('0x2e')]=_0x4db41a[_0xb9db('0x2e')][_0xb9db('0x2f')]?_0x4db41a[_0xb9db('0x2e')]:_0x2274c2[_0xb9db('0x2a')];if(_0x429ee6['query']['includeAll']){_0x4db41a[_0xb9db('0x25')]=[{'all':!![]}];}_0x4db41a=_[_0xb9db('0x30')]({},_0x4db41a,_0x429ee6['options']);return db[_0xb9db('0x24')][_0xb9db('0x31')](_0x4db41a)[_0xb9db('0x14')](handleEntityNotFound(_0x190f78,null))['then'](respondWithResult(_0x190f78,null))['catch'](handleError(_0x190f78,null));};exports[_0xb9db('0x32')]=function(_0x9bb84b,_0x514efa){return db[_0xb9db('0x24')][_0xb9db('0x32')](_0x9bb84b[_0xb9db('0x33')],{})[_0xb9db('0x14')](function(_0x1d9e9f){var _0x1dd4aa=_0x9bb84b[_0xb9db('0x34')][_0xb9db('0x35')]({'plain':!![]});if(!_0x1dd4aa)throw new Error(_0xb9db('0x36'));if(_0x1dd4aa['role']==='user'){var _0x1855f7=_0x1d9e9f[_0xb9db('0x35')]({'plain':!![]});var _0x11747d=_0xb9db('0x16');return db['UserProfileSection'][_0xb9db('0x31')]({'where':{'name':_0x11747d,'userProfileId':_0x1dd4aa['userProfileId']},'raw':!![]})[_0xb9db('0x14')](function(_0x13be05){if(_0x13be05&&_0x13be05[_0xb9db('0x37')]===0x0){return db[_0xb9db('0x17')][_0xb9db('0x32')]({'name':_0x1855f7['name'],'resourceId':_0x1855f7['id'],'type':_0x13be05[_0xb9db('0x1a')],'sectionId':_0x13be05['id']},{})[_0xb9db('0x14')](function(){return _0x1d9e9f;});}else{return _0x1d9e9f;}})['catch'](function(_0x9bd358){logger['error'](_0xb9db('0x38'),_0x9bd358);throw _0x9bd358;});}return _0x1d9e9f;})[_0xb9db('0x14')](respondWithResult(_0x514efa,0xc9))[_0xb9db('0x39')](handleError(_0x514efa,null));};exports['update']=function(_0x197335,_0x44b317){if(_0x197335['body']['id']){delete _0x197335[_0xb9db('0x33')]['id'];}return db[_0xb9db('0x24')][_0xb9db('0x31')]({'where':{'id':_0x197335[_0xb9db('0x3a')]['id']}})[_0xb9db('0x14')](handleEntityNotFound(_0x44b317,null))['then'](saveUpdates(_0x197335[_0xb9db('0x33')],null))[_0xb9db('0x14')](respondWithResult(_0x44b317,null))[_0xb9db('0x39')](handleError(_0x44b317,null));};exports[_0xb9db('0x15')]=function(_0x1a3253,_0x316c06){return db[_0xb9db('0x24')]['find']({'where':{'id':_0x1a3253[_0xb9db('0x3a')]['id']}})['then'](handleEntityNotFound(_0x316c06,null))[_0xb9db('0x14')](removeEntity(_0x316c06,null))['catch'](handleError(_0x316c06,null));};exports[_0xb9db('0x3b')]=function(_0x2f6b72,_0x584909){return db[_0xb9db('0x24')][_0xb9db('0x3b')]()['then'](respondWithResult(_0x584909,null))['catch'](handleError(_0x584909,null));};exports[_0xb9db('0x3c')]=function(_0x30d62b,_0x162a66){var _0x17e0f4={'raw':!![],'where':{}},_0x29f85d={},_0x27d110;return db[_0xb9db('0x24')][_0xb9db('0x3d')]({'where':{'id':_0x30d62b[_0xb9db('0x3a')]['id']}})[_0xb9db('0x14')](handleEntityNotFound(_0x162a66,null))['then'](function(_0x3d6e63){if(_0x3d6e63){_0x27d110=_0x3d6e63['get']({'plain':!![]});_0x29f85d[_0xb9db('0x2a')]=_[_0xb9db('0x2b')](db[_0xb9db('0x3e')]['rawAttributes']);_0x29f85d[_0xb9db('0x26')]=_[_0xb9db('0x2b')](_0x30d62b['query']);_0x29f85d[_0xb9db('0x2c')]=_['intersection'](_0x29f85d[_0xb9db('0x2a')],_0x29f85d['query']);_0x17e0f4[_0xb9db('0x2e')]=_[_0xb9db('0x2d')](_0x29f85d[_0xb9db('0x2a')],qs[_0xb9db('0x3f')](_0x30d62b[_0xb9db('0x26')][_0xb9db('0x3f')]));_0x17e0f4[_0xb9db('0x2e')]=_0x17e0f4[_0xb9db('0x2e')][_0xb9db('0x2f')]?_0x17e0f4[_0xb9db('0x2e')]:_0x29f85d[_0xb9db('0x2a')];if(!_0x30d62b[_0xb9db('0x26')][_0xb9db('0x40')]('nolimit')){_0x17e0f4[_0xb9db('0x10')]=qs[_0xb9db('0x10')](_0x30d62b[_0xb9db('0x26')][_0xb9db('0x10')]);_0x17e0f4['offset']=qs[_0xb9db('0xe')](_0x30d62b[_0xb9db('0x26')]['offset']);}_0x17e0f4[_0xb9db('0x41')]=qs[_0xb9db('0x42')](_0x30d62b[_0xb9db('0x26')][_0xb9db('0x42')]);_0x17e0f4[_0xb9db('0x23')]=qs[_0xb9db('0x2c')](_[_0xb9db('0x43')](_0x30d62b['query'],_0x29f85d['filters']));_0x17e0f4[_0xb9db('0x23')][_0xb9db('0x44')]=_0x3d6e63['id'];if(_0x30d62b[_0xb9db('0x26')][_0xb9db('0x45')]){_0x17e0f4[_0xb9db('0x23')]=_[_0xb9db('0x30')](_0x17e0f4['where'],{'$or':_[_0xb9db('0x1d')](_0x17e0f4[_0xb9db('0x2e')],function(_0x2d0d80){var _0x4d6a12={};_0x4d6a12[_0x2d0d80]={'$like':'%'+_0x30d62b[_0xb9db('0x26')][_0xb9db('0x45')]+'%'};return _0x4d6a12;})});}_0x17e0f4=_[_0xb9db('0x30')]({},_0x17e0f4,_0x30d62b[_0xb9db('0x46')]);return db[_0xb9db('0x3e')]['findAll'](_0x17e0f4);}})[_0xb9db('0x14')](function(_0x3ea9bb){if(_0x3ea9bb){return db[_0xb9db('0x47')]['findAndCountAll']({'where':{'id':_[_0xb9db('0x1d')](_0x3ea9bb,_0xb9db('0x48')),'role':_0xb9db('0x49')},'attributes':['id',_0xb9db('0x1a'),_0xb9db('0x4a'),_0xb9db('0x4b'),_0xb9db('0x4c')]});}})['then'](function(_0x41054f){if(_0x41054f){return{'count':_0x41054f[_0xb9db('0x11')],'rows':_[_0xb9db('0x1d')](_0x41054f['rows'],function(_0x50e989){return{'membername':_0x50e989['name'],'UserId':_0x50e989['id'],'queue_name':_0x27d110[_0xb9db('0x1a')],'MailQueueId':_0x27d110['id'],'interface':util[_0xb9db('0x4d')]('%s/%s',_0xb9db('0x4e'),_0x50e989['name']),'penalty':0x0,'paused':_0x50e989[_0xb9db('0x4a')],'createdAt':_0x50e989['createdAt'],'updatedAt':_0x50e989['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb9db('0x14')](respondWithFilteredResult(_0x162a66,_0x17e0f4))[_0xb9db('0x39')](handleError(_0x162a66,null));};exports[_0xb9db('0x4f')]=function(_0xeb4c6,_0xc6f952){var _0x33a676={};var _0x26b7f0={};var _0x237882;var _0x14f235;return db['MailQueue'][_0xb9db('0x3d')]({'where':{'id':_0xeb4c6[_0xb9db('0x3a')]['id']}})[_0xb9db('0x14')](handleEntityNotFound(_0xc6f952,null))[_0xb9db('0x14')](function(_0x4e6fd2){if(_0x4e6fd2){_0x237882=_0x4e6fd2;_0x26b7f0[_0xb9db('0x2a')]=_[_0xb9db('0x2b')](db[_0xb9db('0x50')][_0xb9db('0x1e')]);_0x26b7f0['query']=_['keys'](_0xeb4c6[_0xb9db('0x26')]);_0x26b7f0['filters']=_[_0xb9db('0x2d')](_0x26b7f0['model'],_0x26b7f0['query']);_0x33a676[_0xb9db('0x2e')]=_[_0xb9db('0x2d')](_0x26b7f0[_0xb9db('0x2a')],qs[_0xb9db('0x3f')](_0xeb4c6['query']['fields']));_0x33a676[_0xb9db('0x2e')]=_0x33a676[_0xb9db('0x2e')][_0xb9db('0x2f')]?_0x33a676[_0xb9db('0x2e')]:_0x26b7f0['model'];_0x33a676[_0xb9db('0x41')]=qs['sort'](_0xeb4c6[_0xb9db('0x26')][_0xb9db('0x42')]);_0x33a676[_0xb9db('0x23')]=qs['filters'](_[_0xb9db('0x43')](_0xeb4c6['query'],_0x26b7f0['filters']));if(_0xeb4c6[_0xb9db('0x26')]['filter']){_0x33a676['where']=_[_0xb9db('0x30')](_0x33a676[_0xb9db('0x23')],{'$or':_[_0xb9db('0x1d')](_0x33a676[_0xb9db('0x2e')],function(_0x48337e){var _0x27e666={};_0x27e666[_0x48337e]={'$like':'%'+_0xeb4c6['query'][_0xb9db('0x45')]+'%'};return _0x27e666;})});}_0x33a676=_[_0xb9db('0x30')]({},_0x33a676,_0xeb4c6[_0xb9db('0x46')]);return _0x237882[_0xb9db('0x4f')](_0x33a676);}})[_0xb9db('0x14')](function(_0x26a560){if(_0x26a560){_0x14f235=_0x26a560[_0xb9db('0x2f')];if(!_0xeb4c6[_0xb9db('0x26')][_0xb9db('0x40')](_0xb9db('0x51'))){_0x33a676[_0xb9db('0x10')]=qs[_0xb9db('0x10')](_0xeb4c6[_0xb9db('0x26')][_0xb9db('0x10')]);_0x33a676[_0xb9db('0xe')]=qs[_0xb9db('0xe')](_0xeb4c6[_0xb9db('0x26')]['offset']);}return _0x237882[_0xb9db('0x4f')](_0x33a676);}})['then'](function(_0x48518a){if(_0x48518a){return _0x48518a?{'count':_0x14f235,'rows':_0x48518a}:null;}})['then'](respondWithResult(_0xc6f952,null))['catch'](handleError(_0xc6f952,null));};exports[_0xb9db('0x52')]=function(_0x290eb7,_0x587f95){var _0x709a72=_0x290eb7[_0xb9db('0x33')][_0xb9db('0x53')];return db['Team'][_0xb9db('0x27')]({'where':{'id':_0x709a72},'attributes':['id'],'include':[{'model':db[_0xb9db('0x47')],'as':'Agents','attributes':['id',_0xb9db('0x1a'),_0xb9db('0x54'),_0xb9db('0x55'),'interface'],'raw':!![]}]})[_0xb9db('0x14')](function(_0x25638b){if(_0x25638b){var _0x193f15=_[_0xb9db('0x56')](_0x25638b,function(_0x5dbfb6){var _0x2d963d=_0x5dbfb6[_0xb9db('0x35')]({'plain':!![]});return _0x2d963d[_0xb9db('0x57')];});return db[_0xb9db('0x24')][_0xb9db('0x31')]({'where':{'id':_0x290eb7[_0xb9db('0x3a')]['id']}})[_0xb9db('0x14')](function(_0x4c6dcc){return db['sequelize']['transaction'](function(_0x3efb76){return _0x4c6dcc[_0xb9db('0x52')](_0x709a72,{'transaction':_0x3efb76})['then'](function(){return BPromise[_0xb9db('0x58')](_0x193f15,function(_0x31b4c4){return db[_0xb9db('0x3e')]['findOrCreate']({'where':{'UserId':_0x31b4c4['id'],'MailQueueId':_0x290eb7[_0xb9db('0x3a')]['id']},'transaction':_0x3efb76});});})[_0xb9db('0x14')](function(){_0x193f15[_0xb9db('0x59')](function(_0xe52984){socket[_0xb9db('0x5a')](_0xb9db('0x5b'),{'UserId':_0xe52984['id'],'MailQueueId':_0x4c6dcc['id']});});});});});}})['then'](respondWithStatusCode(_0x587f95,null))[_0xb9db('0x39')](handleError(_0x587f95,null));};exports['removeTeams']=function(_0x43fd63,_0x4d64e0){return db[_0xb9db('0x50')][_0xb9db('0x27')]({'where':{'id':_0x43fd63['query'][_0xb9db('0x53')]},'attributes':['id'],'include':[{'model':db[_0xb9db('0x47')],'as':_0xb9db('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64e0,null))[_0xb9db('0x14')](function(_0x5df674){var _0x5f2c99=_[_0xb9db('0x1d')](_0x5df674,'id');var _0x8ed7cd=[];var _0x63aa41=[];var _0x1f1d02=squel[_0xb9db('0x5c')]();_0x1f1d02[_0xb9db('0x5d')](_0xb9db('0x5e'))[_0xb9db('0x5f')](_0xb9db('0x60'),'tq')[_0xb9db('0x61')](_0xb9db('0x62'),'ut',_0xb9db('0x63'))[_0xb9db('0x23')](_0xb9db('0x64'),_0x43fd63[_0xb9db('0x3a')]['id']);for(var _0x5f5b05=0x0;_0x5f5b05<_0x5df674[_0xb9db('0x2f')];_0x5f5b05+=0x1){let _0x8f88e9=_0x5df674[_0x5f5b05];for(var _0x24e3a9=0x0;_0x24e3a9<_0x8f88e9[_0xb9db('0x57')][_0xb9db('0x2f')];_0x24e3a9+=0x1){let _0x59200d=_0x8f88e9[_0xb9db('0x57')][_0x24e3a9];var _0x45be84=_0x1f1d02[_0xb9db('0x65')]();_0x45be84[_0xb9db('0x23')](_0xb9db('0x66'),_0x59200d['id']);_0x63aa41[_0xb9db('0x67')](db[_0xb9db('0x68')][_0xb9db('0x26')](_0x45be84[_0xb9db('0x69')](),{'type':db[_0xb9db('0x68')][_0xb9db('0x6a')]['SELECT']})['then'](function(_0x200274){if(_0x200274[_0xb9db('0x2f')]===0x1){return _0x59200d['id'];}else{var _0x152971=_[_0xb9db('0x6b')](_[_0xb9db('0x1d')](_0x200274,_0xb9db('0x6c')),function(_0x65db49){return _[_0xb9db('0x6d')](_0x5f2c99,_0x65db49);});if(_0x152971){return _0x59200d['id'];}}}));}}return BPromise[_0xb9db('0x6e')](_0x63aa41)[_0xb9db('0x14')](function(_0x6225ff){_0x8ed7cd=_(_0x8ed7cd)[_0xb9db('0x6f')](_0x6225ff)[_0xb9db('0x70')]()[_0xb9db('0x71')]();return db['MailQueue']['find']({'where':{'id':_0x43fd63[_0xb9db('0x3a')]['id']}})[_0xb9db('0x14')](function(_0x1e6838){return db[_0xb9db('0x68')][_0xb9db('0x72')](function(_0x29bd3c){return _0x1e6838[_0xb9db('0x73')](_0x43fd63[_0xb9db('0x26')][_0xb9db('0x53')],{'transaction':_0x29bd3c})[_0xb9db('0x14')](function(){if(!_[_0xb9db('0x74')](_0x8ed7cd)){return _0x1e6838[_0xb9db('0x75')](_0x8ed7cd,{'transaction':_0x29bd3c});}})[_0xb9db('0x14')](function(){_0x8ed7cd[_0xb9db('0x59')](function(_0x51cf68){socket[_0xb9db('0x5a')](_0xb9db('0x76'),{'UserId':_0x51cf68,'MailQueueId':_0x1e6838['id']});});});});});});})[_0xb9db('0x14')](respondWithStatusCode(_0x4d64e0,null))[_0xb9db('0x39')](handleError(_0x4d64e0,null));};exports[_0xb9db('0x77')]=function(_0x1359e2,_0x27bc69){return db['MailQueue'][_0xb9db('0x31')]({'where':{'id':_0x1359e2[_0xb9db('0x3a')]['id']}})[_0xb9db('0x14')](handleEntityNotFound(_0x27bc69,null))[_0xb9db('0x14')](function(_0x53b640){if(_0x53b640){return _0x53b640[_0xb9db('0x77')](_0x1359e2[_0xb9db('0x33')][_0xb9db('0x53')],_[_0xb9db('0x78')](_0x1359e2[_0xb9db('0x33')],[_0xb9db('0x53'),'id'])||{})[_0xb9db('0x79')](function(_0x134318){for(var _0x518045=0x0;_0x518045<_0x1359e2[_0xb9db('0x33')]['ids']['length'];_0x518045+=0x1){socket['emit'](_0xb9db('0x5b'),{'UserId':Number(_0x1359e2[_0xb9db('0x33')][_0xb9db('0x53')][_0x518045]),'MailQueueId':Number(_0x1359e2[_0xb9db('0x3a')]['id'])});}return _0x134318;});}})[_0xb9db('0x14')](respondWithResult(_0x27bc69,null))[_0xb9db('0x39')](handleError(_0x27bc69,null));};exports[_0xb9db('0x75')]=function(_0x510f1c,_0x4b179a){return db[_0xb9db('0x24')][_0xb9db('0x31')]({'where':{'id':_0x510f1c[_0xb9db('0x3a')]['id']}})[_0xb9db('0x14')](handleEntityNotFound(_0x4b179a,null))[_0xb9db('0x14')](function(_0x4b072f){if(_0x4b072f){return _0x4b072f['removeAgents'](_0x510f1c[_0xb9db('0x26')][_0xb9db('0x53')])['then'](function(){if(_['isArray'](_0x510f1c[_0xb9db('0x26')]['ids'])){for(var _0x12f412=0x0;_0x12f412<_0x510f1c[_0xb9db('0x26')][_0xb9db('0x53')][_0xb9db('0x2f')];_0x12f412+=0x1){socket[_0xb9db('0x5a')](_0xb9db('0x76'),{'UserId':Number(_0x510f1c[_0xb9db('0x26')][_0xb9db('0x53')][_0x12f412]),'MailQueueId':Number(_0x510f1c[_0xb9db('0x3a')]['id'])});}}else{socket['emit'](_0xb9db('0x76'),{'UserId':Number(_0x510f1c[_0xb9db('0x26')][_0xb9db('0x53')]),'MailQueueId':Number(_0x510f1c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4b179a,null))['catch'](handleError(_0x4b179a,null));};exports[_0xb9db('0x7a')]=function(_0x1b9f41,_0x5882bb){var _0x3b12dd={};var _0x5de8d1={};var _0x29ad30;var _0x545d44;return db[_0xb9db('0x24')]['findOne']({'where':{'id':_0x1b9f41[_0xb9db('0x3a')]['id']}})[_0xb9db('0x14')](handleEntityNotFound(_0x5882bb,null))['then'](function(_0x9a26db){if(_0x9a26db){_0x29ad30=_0x9a26db;_0x5de8d1[_0xb9db('0x2a')]=_[_0xb9db('0x2b')](db[_0xb9db('0x47')][_0xb9db('0x1e')]);_0x5de8d1['query']=_[_0xb9db('0x2b')](_0x1b9f41[_0xb9db('0x26')]);_0x5de8d1['filters']=_[_0xb9db('0x2d')](_0x5de8d1[_0xb9db('0x2a')],_0x5de8d1[_0xb9db('0x26')]);_0x3b12dd[_0xb9db('0x2e')]=_[_0xb9db('0x2d')](_0x5de8d1[_0xb9db('0x2a')],qs[_0xb9db('0x3f')](_0x1b9f41[_0xb9db('0x26')]['fields']));_0x3b12dd[_0xb9db('0x2e')]=_0x3b12dd[_0xb9db('0x2e')]['length']?_0x3b12dd['attributes']:_0x5de8d1[_0xb9db('0x2a')];_0x3b12dd[_0xb9db('0x41')]=qs[_0xb9db('0x42')](_0x1b9f41[_0xb9db('0x26')]['sort']);_0x3b12dd[_0xb9db('0x23')]=qs['filters'](_[_0xb9db('0x43')](_0x1b9f41[_0xb9db('0x26')],_0x5de8d1['filters']));if(_0x1b9f41[_0xb9db('0x26')][_0xb9db('0x45')]){_0x3b12dd[_0xb9db('0x23')]=_[_0xb9db('0x30')](_0x3b12dd[_0xb9db('0x23')],{'$or':_[_0xb9db('0x1d')](_0x3b12dd['attributes'],function(_0x129e2f){var _0x2bce3c={};_0x2bce3c[_0x129e2f]={'$like':'%'+_0x1b9f41[_0xb9db('0x26')]['filter']+'%'};return _0x2bce3c;})});}_0x3b12dd=_['merge']({},_0x3b12dd,_0x1b9f41['options']);return _0x29ad30[_0xb9db('0x7a')](_0x3b12dd);}})[_0xb9db('0x14')](function(_0xa59637){if(_0xa59637){_0x545d44=_0xa59637['length'];if(!_0x1b9f41[_0xb9db('0x26')][_0xb9db('0x40')](_0xb9db('0x51'))){_0x3b12dd['limit']=qs[_0xb9db('0x10')](_0x1b9f41['query'][_0xb9db('0x10')]);_0x3b12dd[_0xb9db('0xe')]=qs[_0xb9db('0xe')](_0x1b9f41[_0xb9db('0x26')][_0xb9db('0xe')]);}return _0x29ad30[_0xb9db('0x7a')](_0x3b12dd);}})[_0xb9db('0x14')](function(_0x34787c){if(_0x34787c){return _0x34787c?{'count':_0x545d44,'rows':_0x34787c}:null;}})[_0xb9db('0x14')](respondWithResult(_0x5882bb,null))['catch'](handleError(_0x5882bb,null));}; \ No newline at end of file +var _0xac60=['User','agent','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','pick','nolimit','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','isArray','getAgents','bluebird','lodash','squel','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','key','getOptions','where','include','findAll','rows','catch','show','params','keys','query','filters','model','attributes','intersection','fields','length','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','sort','filter','map'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0xac60,0x11b));var _0x0ac6=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xac60[_0x618414];return _0x21c19a;};'use strict';var BPromise=require(_0x0ac6('0x0'));var util=require('util');var _=require(_0x0ac6('0x1'));var squel=require(_0x0ac6('0x2'));var Redis=require('ioredis');var qs=require(_0x0ac6('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x0ac6('0x4'));var db=require('../../mysqldb')['db'];config[_0x0ac6('0x5')]=_[_0x0ac6('0x6')](config[_0x0ac6('0x5')],{'host':_0x0ac6('0x7'),'port':0x18eb});var socket=require(_0x0ac6('0x8'))(new Redis(config[_0x0ac6('0x5')]));require(_0x0ac6('0x9'))[_0x0ac6('0xa')](socket);function respondWithStatusCode(_0x2b22fd,_0x1405e1){_0x1405e1=_0x1405e1||0xcc;return function(_0x203e9f){if(_0x203e9f){return _0x2b22fd[_0x0ac6('0xb')](_0x1405e1);}return _0x2b22fd[_0x0ac6('0xc')](_0x1405e1)[_0x0ac6('0xd')]();};}function respondWithResult(_0x5a7055,_0x5a55fb){_0x5a55fb=_0x5a55fb||0xc8;return function(_0x7c3074){if(_0x7c3074){return _0x5a7055[_0x0ac6('0xc')](_0x5a55fb)[_0x0ac6('0xe')](_0x7c3074);}};}function respondWithFilteredResult(_0x8e5e35,_0x5f22bd){return function(_0x3676c2){if(_0x3676c2){var _0x184a88=typeof _0x5f22bd['offset']==='undefined'&&typeof _0x5f22bd[_0x0ac6('0xf')]===_0x0ac6('0x10');var _0x372cd7=_0x3676c2[_0x0ac6('0x11')];var _0x182854=_0x184a88?0x0:_0x5f22bd[_0x0ac6('0x12')];var _0x5c63d7=_0x184a88?_0x3676c2[_0x0ac6('0x11')]:_0x5f22bd[_0x0ac6('0x12')]+_0x5f22bd['limit'];var _0x4349e8;if(_0x5c63d7>=_0x372cd7){_0x5c63d7=_0x372cd7;_0x4349e8=0xc8;}else{_0x4349e8=0xce;}_0x8e5e35[_0x0ac6('0xc')](_0x4349e8);return _0x8e5e35[_0x0ac6('0x13')]('Content-Range',_0x182854+'-'+_0x5c63d7+'/'+_0x372cd7)['json'](_0x3676c2);}return null;};}function saveUpdates(_0x79410b){return function(_0x443211){if(_0x443211){return _0x443211['update'](_0x79410b)[_0x0ac6('0x14')](function(_0x5c31a2){return _0x5c31a2;});}return null;};}function removeEntity(_0x31491b){return function(_0x304d23){if(_0x304d23){return _0x304d23[_0x0ac6('0x15')]()[_0x0ac6('0x14')](function(){var _0x5567dd=_0x304d23[_0x0ac6('0x16')]({'plain':!![]});var _0x1a5222=_0x0ac6('0x17');return db[_0x0ac6('0x18')][_0x0ac6('0x15')]({'where':{'type':_0x1a5222,'resourceId':_0x5567dd['id']}})[_0x0ac6('0x14')](function(){return _0x304d23;});})[_0x0ac6('0x14')](function(){_0x31491b[_0x0ac6('0xc')](0xcc)[_0x0ac6('0xd')]();});}};}function handleEntityNotFound(_0x5b5fe0){return function(_0x50fcdc){if(!_0x50fcdc){_0x5b5fe0[_0x0ac6('0xb')](0x194);}return _0x50fcdc;};}function handleError(_0x4db7ae,_0x1c23bf){_0x1c23bf=_0x1c23bf||0x1f4;return function(_0x2838ad){logger[_0x0ac6('0x19')](_0x2838ad[_0x0ac6('0x1a')]);if(_0x2838ad[_0x0ac6('0x1b')]){delete _0x2838ad['name'];}_0x4db7ae['status'](_0x1c23bf)[_0x0ac6('0x1c')](_0x2838ad);};}exports[_0x0ac6('0x1d')]=function(_0x3bc636,_0x282a64){var _0x19144c={};var _0xde742={'count':0x0,'rows':[]};var _0x1210c3=_['map'](db[_0x0ac6('0x1e')][_0x0ac6('0x1f')],function(_0x13082a){return{'name':_0x13082a[_0x0ac6('0x20')],'type':_0x13082a['type'][_0x0ac6('0x21')]};});_0x19144c=qs[_0x0ac6('0x22')](_0x1210c3,_0x3bc636);var _0x1c3274={'where':_0x19144c[_0x0ac6('0x23')]};return db['MailQueue'][_0x0ac6('0x11')](_0x1c3274)[_0x0ac6('0x14')](function(_0x528eaf){_0xde742[_0x0ac6('0x11')]=_0x528eaf;_0x19144c[_0x0ac6('0x24')]=qs[_0x0ac6('0x24')](_0x3bc636['query']);return db[_0x0ac6('0x1e')][_0x0ac6('0x25')](_0x19144c);})[_0x0ac6('0x14')](function(_0x44bf47){_0xde742[_0x0ac6('0x26')]=_0x44bf47;return _0xde742;})[_0x0ac6('0x14')](respondWithFilteredResult(_0x282a64,_0x19144c))[_0x0ac6('0x27')](handleError(_0x282a64,null));};exports[_0x0ac6('0x28')]=function(_0xcf3eac,_0x46d37e){var _0x24905a={'raw':!![],'where':{'id':_0xcf3eac[_0x0ac6('0x29')]['id']}},_0x2ed5b7={};_0x2ed5b7['model']=_[_0x0ac6('0x2a')](db[_0x0ac6('0x1e')]['rawAttributes']);_0x2ed5b7[_0x0ac6('0x2b')]=_[_0x0ac6('0x2a')](_0xcf3eac[_0x0ac6('0x2b')]);_0x2ed5b7[_0x0ac6('0x2c')]=_['intersection'](_0x2ed5b7[_0x0ac6('0x2d')],_0x2ed5b7['query']);_0x24905a[_0x0ac6('0x2e')]=_[_0x0ac6('0x2f')](_0x2ed5b7[_0x0ac6('0x2d')],qs[_0x0ac6('0x30')](_0xcf3eac['query'][_0x0ac6('0x30')]));_0x24905a['attributes']=_0x24905a['attributes'][_0x0ac6('0x31')]?_0x24905a[_0x0ac6('0x2e')]:_0x2ed5b7[_0x0ac6('0x2d')];if(_0xcf3eac[_0x0ac6('0x2b')]['includeAll']){_0x24905a[_0x0ac6('0x24')]=[{'all':!![]}];}_0x24905a=_[_0x0ac6('0x32')]({},_0x24905a,_0xcf3eac[_0x0ac6('0x33')]);return db[_0x0ac6('0x1e')][_0x0ac6('0x34')](_0x24905a)['then'](handleEntityNotFound(_0x46d37e,null))[_0x0ac6('0x14')](respondWithResult(_0x46d37e,null))[_0x0ac6('0x27')](handleError(_0x46d37e,null));};exports[_0x0ac6('0x35')]=function(_0x63dfee,_0x38e8e3){return db[_0x0ac6('0x1e')][_0x0ac6('0x35')](_0x63dfee['body'],{})[_0x0ac6('0x14')](function(_0x13b0ff){var _0x34902e=_0x63dfee[_0x0ac6('0x36')][_0x0ac6('0x16')]({'plain':!![]});if(!_0x34902e)throw new Error(_0x0ac6('0x37'));if(_0x34902e['role']===_0x0ac6('0x36')){var _0x4dbbd4=_0x13b0ff[_0x0ac6('0x16')]({'plain':!![]});var _0x89f8fa=_0x0ac6('0x17');return db[_0x0ac6('0x38')]['find']({'where':{'name':_0x89f8fa,'userProfileId':_0x34902e[_0x0ac6('0x39')]},'raw':!![]})[_0x0ac6('0x14')](function(_0x2bc72e){if(_0x2bc72e&&_0x2bc72e[_0x0ac6('0x3a')]===0x0){return db['UserProfileResource'][_0x0ac6('0x35')]({'name':_0x4dbbd4[_0x0ac6('0x1b')],'resourceId':_0x4dbbd4['id'],'type':_0x2bc72e['name'],'sectionId':_0x2bc72e['id']},{})[_0x0ac6('0x14')](function(){return _0x13b0ff;});}else{return _0x13b0ff;}})[_0x0ac6('0x27')](function(_0x553354){logger[_0x0ac6('0x19')](_0x0ac6('0x3b'),_0x553354);throw _0x553354;});}return _0x13b0ff;})[_0x0ac6('0x14')](respondWithResult(_0x38e8e3,0xc9))[_0x0ac6('0x27')](handleError(_0x38e8e3,null));};exports[_0x0ac6('0x3c')]=function(_0x52e4f4,_0x4614eb){if(_0x52e4f4[_0x0ac6('0x3d')]['id']){delete _0x52e4f4[_0x0ac6('0x3d')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x52e4f4[_0x0ac6('0x29')]['id']}})[_0x0ac6('0x14')](handleEntityNotFound(_0x4614eb,null))[_0x0ac6('0x14')](saveUpdates(_0x52e4f4['body'],null))[_0x0ac6('0x14')](respondWithResult(_0x4614eb,null))[_0x0ac6('0x27')](handleError(_0x4614eb,null));};exports[_0x0ac6('0x15')]=function(_0x2610b5,_0x287692){return db['MailQueue']['find']({'where':{'id':_0x2610b5['params']['id']}})[_0x0ac6('0x14')](handleEntityNotFound(_0x287692,null))['then'](removeEntity(_0x287692,null))[_0x0ac6('0x27')](handleError(_0x287692,null));};exports['describe']=function(_0x580d4d,_0x1e2586){return db[_0x0ac6('0x1e')][_0x0ac6('0x3e')]()[_0x0ac6('0x14')](respondWithResult(_0x1e2586,null))[_0x0ac6('0x27')](handleError(_0x1e2586,null));};exports[_0x0ac6('0x3f')]=function(_0x50d1ab,_0x5104ff){var _0x3f9120={'raw':!![],'where':{}},_0x532736={},_0x24ae63;return db[_0x0ac6('0x1e')][_0x0ac6('0x40')]({'where':{'id':_0x50d1ab[_0x0ac6('0x29')]['id']}})[_0x0ac6('0x14')](handleEntityNotFound(_0x5104ff,null))[_0x0ac6('0x14')](function(_0x30a495){if(_0x30a495){_0x24ae63=_0x30a495[_0x0ac6('0x16')]({'plain':!![]});_0x532736[_0x0ac6('0x2d')]=_[_0x0ac6('0x2a')](db[_0x0ac6('0x41')][_0x0ac6('0x1f')]);_0x532736[_0x0ac6('0x2b')]=_['keys'](_0x50d1ab[_0x0ac6('0x2b')]);_0x532736[_0x0ac6('0x2c')]=_[_0x0ac6('0x2f')](_0x532736[_0x0ac6('0x2d')],_0x532736[_0x0ac6('0x2b')]);_0x3f9120[_0x0ac6('0x2e')]=_[_0x0ac6('0x2f')](_0x532736[_0x0ac6('0x2d')],qs[_0x0ac6('0x30')](_0x50d1ab[_0x0ac6('0x2b')][_0x0ac6('0x30')]));_0x3f9120[_0x0ac6('0x2e')]=_0x3f9120[_0x0ac6('0x2e')][_0x0ac6('0x31')]?_0x3f9120[_0x0ac6('0x2e')]:_0x532736[_0x0ac6('0x2d')];if(!_0x50d1ab[_0x0ac6('0x2b')][_0x0ac6('0x42')]('nolimit')){_0x3f9120[_0x0ac6('0xf')]=qs['limit'](_0x50d1ab['query'][_0x0ac6('0xf')]);_0x3f9120[_0x0ac6('0x12')]=qs[_0x0ac6('0x12')](_0x50d1ab['query'][_0x0ac6('0x12')]);}_0x3f9120[_0x0ac6('0x43')]=qs[_0x0ac6('0x44')](_0x50d1ab['query']['sort']);_0x3f9120[_0x0ac6('0x23')]=qs['filters'](_['pick'](_0x50d1ab[_0x0ac6('0x2b')],_0x532736[_0x0ac6('0x2c')]));_0x3f9120[_0x0ac6('0x23')]['MailQueueId']=_0x30a495['id'];if(_0x50d1ab[_0x0ac6('0x2b')][_0x0ac6('0x45')]){_0x3f9120[_0x0ac6('0x23')]=_[_0x0ac6('0x32')](_0x3f9120[_0x0ac6('0x23')],{'$or':_[_0x0ac6('0x46')](_0x3f9120[_0x0ac6('0x2e')],function(_0x587b68){var _0x529a3a={};_0x529a3a[_0x587b68]={'$like':'%'+_0x50d1ab['query'][_0x0ac6('0x45')]+'%'};return _0x529a3a;})});}_0x3f9120=_[_0x0ac6('0x32')]({},_0x3f9120,_0x50d1ab[_0x0ac6('0x33')]);return db[_0x0ac6('0x41')][_0x0ac6('0x25')](_0x3f9120);}})[_0x0ac6('0x14')](function(_0x2dae88){if(_0x2dae88){return db[_0x0ac6('0x47')]['findAndCountAll']({'where':{'id':_[_0x0ac6('0x46')](_0x2dae88,'UserId'),'role':_0x0ac6('0x48')},'attributes':['id','name',_0x0ac6('0x49'),_0x0ac6('0x4a'),_0x0ac6('0x4b')]});}})['then'](function(_0x57ad66){if(_0x57ad66){return{'count':_0x57ad66[_0x0ac6('0x11')],'rows':_[_0x0ac6('0x46')](_0x57ad66[_0x0ac6('0x26')],function(_0x2315cd){return{'membername':_0x2315cd[_0x0ac6('0x1b')],'UserId':_0x2315cd['id'],'queue_name':_0x24ae63[_0x0ac6('0x1b')],'MailQueueId':_0x24ae63['id'],'interface':util[_0x0ac6('0x4c')](_0x0ac6('0x4d'),'SIP',_0x2315cd['name']),'penalty':0x0,'paused':_0x2315cd[_0x0ac6('0x49')],'createdAt':_0x2315cd[_0x0ac6('0x4b')],'updatedAt':_0x2315cd[_0x0ac6('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0ac6('0x14')](respondWithFilteredResult(_0x5104ff,_0x3f9120))[_0x0ac6('0x27')](handleError(_0x5104ff,null));};exports[_0x0ac6('0x4e')]=function(_0x3e797f,_0x5bb045){var _0x45f659={};var _0x3924e6={};var _0x50c301;var _0x30aab5;return db['MailQueue'][_0x0ac6('0x40')]({'where':{'id':_0x3e797f[_0x0ac6('0x29')]['id']}})['then'](handleEntityNotFound(_0x5bb045,null))[_0x0ac6('0x14')](function(_0x3d2e48){if(_0x3d2e48){_0x50c301=_0x3d2e48;_0x3924e6[_0x0ac6('0x2d')]=_[_0x0ac6('0x2a')](db['Team'][_0x0ac6('0x1f')]);_0x3924e6[_0x0ac6('0x2b')]=_[_0x0ac6('0x2a')](_0x3e797f[_0x0ac6('0x2b')]);_0x3924e6[_0x0ac6('0x2c')]=_[_0x0ac6('0x2f')](_0x3924e6[_0x0ac6('0x2d')],_0x3924e6['query']);_0x45f659[_0x0ac6('0x2e')]=_[_0x0ac6('0x2f')](_0x3924e6[_0x0ac6('0x2d')],qs[_0x0ac6('0x30')](_0x3e797f[_0x0ac6('0x2b')][_0x0ac6('0x30')]));_0x45f659[_0x0ac6('0x2e')]=_0x45f659[_0x0ac6('0x2e')][_0x0ac6('0x31')]?_0x45f659[_0x0ac6('0x2e')]:_0x3924e6[_0x0ac6('0x2d')];_0x45f659[_0x0ac6('0x43')]=qs[_0x0ac6('0x44')](_0x3e797f[_0x0ac6('0x2b')]['sort']);_0x45f659[_0x0ac6('0x23')]=qs[_0x0ac6('0x2c')](_[_0x0ac6('0x4f')](_0x3e797f[_0x0ac6('0x2b')],_0x3924e6['filters']));if(_0x3e797f['query'][_0x0ac6('0x45')]){_0x45f659[_0x0ac6('0x23')]=_[_0x0ac6('0x32')](_0x45f659[_0x0ac6('0x23')],{'$or':_['map'](_0x45f659[_0x0ac6('0x2e')],function(_0x454519){var _0x212d72={};_0x212d72[_0x454519]={'$like':'%'+_0x3e797f[_0x0ac6('0x2b')][_0x0ac6('0x45')]+'%'};return _0x212d72;})});}_0x45f659=_['merge']({},_0x45f659,_0x3e797f[_0x0ac6('0x33')]);return _0x50c301[_0x0ac6('0x4e')](_0x45f659);}})[_0x0ac6('0x14')](function(_0x548336){if(_0x548336){_0x30aab5=_0x548336[_0x0ac6('0x31')];if(!_0x3e797f[_0x0ac6('0x2b')]['hasOwnProperty'](_0x0ac6('0x50'))){_0x45f659[_0x0ac6('0xf')]=qs['limit'](_0x3e797f[_0x0ac6('0x2b')][_0x0ac6('0xf')]);_0x45f659[_0x0ac6('0x12')]=qs['offset'](_0x3e797f['query'][_0x0ac6('0x12')]);}return _0x50c301[_0x0ac6('0x4e')](_0x45f659);}})['then'](function(_0x4e0aaf){if(_0x4e0aaf){return _0x4e0aaf?{'count':_0x30aab5,'rows':_0x4e0aaf}:null;}})['then'](respondWithResult(_0x5bb045,null))['catch'](handleError(_0x5bb045,null));};exports[_0x0ac6('0x51')]=function(_0x47c435,_0xc1a36f){var _0x11a254=_0x47c435[_0x0ac6('0x3d')][_0x0ac6('0x52')];return db[_0x0ac6('0x53')]['findAll']({'where':{'id':_0x11a254},'attributes':['id'],'include':[{'model':db[_0x0ac6('0x47')],'as':_0x0ac6('0x54'),'attributes':['id',_0x0ac6('0x1b'),_0x0ac6('0x55'),_0x0ac6('0x56'),_0x0ac6('0x57')],'raw':!![]}]})[_0x0ac6('0x14')](function(_0x5943da){if(_0x5943da){var _0x6747b9=_[_0x0ac6('0x58')](_0x5943da,function(_0x5a342e){var _0x1419f7=_0x5a342e['get']({'plain':!![]});return _0x1419f7[_0x0ac6('0x54')];});return db[_0x0ac6('0x1e')][_0x0ac6('0x34')]({'where':{'id':_0x47c435[_0x0ac6('0x29')]['id']}})['then'](function(_0x4205a2){return db[_0x0ac6('0x59')][_0x0ac6('0x5a')](function(_0x34e2ae){return _0x4205a2['addTeams'](_0x11a254,{'transaction':_0x34e2ae})[_0x0ac6('0x14')](function(){return BPromise['each'](_0x6747b9,function(_0x521c6b){return db[_0x0ac6('0x41')][_0x0ac6('0x5b')]({'where':{'UserId':_0x521c6b['id'],'MailQueueId':_0x47c435[_0x0ac6('0x29')]['id']},'transaction':_0x34e2ae});});})[_0x0ac6('0x14')](function(){_0x6747b9[_0x0ac6('0x5c')](function(_0x66b68e){socket[_0x0ac6('0x5d')](_0x0ac6('0x5e'),{'UserId':_0x66b68e['id'],'MailQueueId':_0x4205a2['id']});});});});});}})[_0x0ac6('0x14')](respondWithStatusCode(_0xc1a36f,null))[_0x0ac6('0x27')](handleError(_0xc1a36f,null));};exports[_0x0ac6('0x5f')]=function(_0x4756ff,_0x48173e){return db['Team'][_0x0ac6('0x25')]({'where':{'id':_0x4756ff['query'][_0x0ac6('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0ac6('0x54'),'attributes':['id'],'raw':!![]}]})[_0x0ac6('0x14')](handleEntityNotFound(_0x48173e,null))[_0x0ac6('0x14')](function(_0x2ddaff){var _0x4f76da=_[_0x0ac6('0x46')](_0x2ddaff,'id');var _0x22cc06=[];var _0x788210=[];var _0x26c266=squel['select']();_0x26c266[_0x0ac6('0x60')](_0x0ac6('0x61'))[_0x0ac6('0x62')](_0x0ac6('0x63'),'tq')[_0x0ac6('0x64')](_0x0ac6('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x0ac6('0x66'),_0x4756ff[_0x0ac6('0x29')]['id']);for(var _0x226fb1=0x0;_0x226fb1<_0x2ddaff['length'];_0x226fb1+=0x1){let _0x1fdad6=_0x2ddaff[_0x226fb1];for(var _0x76f8b7=0x0;_0x76f8b7<_0x1fdad6[_0x0ac6('0x54')][_0x0ac6('0x31')];_0x76f8b7+=0x1){let _0x304bbe=_0x1fdad6[_0x0ac6('0x54')][_0x76f8b7];var _0x11a7be=_0x26c266[_0x0ac6('0x67')]();_0x11a7be[_0x0ac6('0x23')](_0x0ac6('0x68'),_0x304bbe['id']);_0x788210['push'](db[_0x0ac6('0x59')]['query'](_0x11a7be[_0x0ac6('0x69')](),{'type':db[_0x0ac6('0x59')][_0x0ac6('0x6a')]['SELECT']})[_0x0ac6('0x14')](function(_0x200b3f){if(_0x200b3f[_0x0ac6('0x31')]===0x1){return _0x304bbe['id'];}else{var _0x9fe4bb=_['every'](_[_0x0ac6('0x46')](_0x200b3f,'TeamId'),function(_0x430bf8){return _['includes'](_0x4f76da,_0x430bf8);});if(_0x9fe4bb){return _0x304bbe['id'];}}}));}}return BPromise[_0x0ac6('0x6b')](_0x788210)[_0x0ac6('0x14')](function(_0x41719a){_0x22cc06=_(_0x22cc06)[_0x0ac6('0x6c')](_0x41719a)[_0x0ac6('0x6d')]()[_0x0ac6('0x6e')]();return db[_0x0ac6('0x1e')][_0x0ac6('0x34')]({'where':{'id':_0x4756ff[_0x0ac6('0x29')]['id']}})['then'](function(_0x1998ae){return db[_0x0ac6('0x59')][_0x0ac6('0x5a')](function(_0x5dacf2){return _0x1998ae[_0x0ac6('0x5f')](_0x4756ff[_0x0ac6('0x2b')][_0x0ac6('0x52')],{'transaction':_0x5dacf2})['then'](function(){if(!_[_0x0ac6('0x6f')](_0x22cc06)){return _0x1998ae[_0x0ac6('0x70')](_0x22cc06,{'transaction':_0x5dacf2});}})[_0x0ac6('0x14')](function(){_0x22cc06[_0x0ac6('0x5c')](function(_0x49695c){socket['emit'](_0x0ac6('0x71'),{'UserId':_0x49695c,'MailQueueId':_0x1998ae['id']});});});});});});})[_0x0ac6('0x14')](respondWithStatusCode(_0x48173e,null))[_0x0ac6('0x27')](handleError(_0x48173e,null));};exports['addAgents']=function(_0x12d0d2,_0x28ebdd){return db[_0x0ac6('0x1e')][_0x0ac6('0x34')]({'where':{'id':_0x12d0d2[_0x0ac6('0x29')]['id']}})[_0x0ac6('0x14')](handleEntityNotFound(_0x28ebdd,null))[_0x0ac6('0x14')](function(_0x38a306){if(_0x38a306){return _0x38a306[_0x0ac6('0x72')](_0x12d0d2[_0x0ac6('0x3d')][_0x0ac6('0x52')],_[_0x0ac6('0x73')](_0x12d0d2[_0x0ac6('0x3d')],[_0x0ac6('0x52'),'id'])||{})['spread'](function(_0x53d254){for(var _0x53423b=0x0;_0x53423b<_0x12d0d2[_0x0ac6('0x3d')][_0x0ac6('0x52')][_0x0ac6('0x31')];_0x53423b+=0x1){socket[_0x0ac6('0x5d')](_0x0ac6('0x5e'),{'UserId':Number(_0x12d0d2['body'][_0x0ac6('0x52')][_0x53423b]),'MailQueueId':Number(_0x12d0d2['params']['id'])});}return _0x53d254;});}})[_0x0ac6('0x14')](respondWithResult(_0x28ebdd,null))[_0x0ac6('0x27')](handleError(_0x28ebdd,null));};exports[_0x0ac6('0x70')]=function(_0x433965,_0x949b05){return db['MailQueue'][_0x0ac6('0x34')]({'where':{'id':_0x433965['params']['id']}})[_0x0ac6('0x14')](handleEntityNotFound(_0x949b05,null))['then'](function(_0x3b929b){if(_0x3b929b){return _0x3b929b['removeAgents'](_0x433965[_0x0ac6('0x2b')]['ids'])[_0x0ac6('0x14')](function(){if(_[_0x0ac6('0x74')](_0x433965['query'][_0x0ac6('0x52')])){for(var _0x4705e2=0x0;_0x4705e2<_0x433965['query'][_0x0ac6('0x52')][_0x0ac6('0x31')];_0x4705e2+=0x1){socket[_0x0ac6('0x5d')](_0x0ac6('0x71'),{'UserId':Number(_0x433965['query']['ids'][_0x4705e2]),'MailQueueId':Number(_0x433965[_0x0ac6('0x29')]['id'])});}}else{socket[_0x0ac6('0x5d')](_0x0ac6('0x71'),{'UserId':Number(_0x433965[_0x0ac6('0x2b')][_0x0ac6('0x52')]),'MailQueueId':Number(_0x433965[_0x0ac6('0x29')]['id'])});}});}})[_0x0ac6('0x14')](respondWithStatusCode(_0x949b05,null))[_0x0ac6('0x27')](handleError(_0x949b05,null));};exports['getAgents']=function(_0x67d059,_0x25f5a9){var _0x572269={};var _0x2b2057={};var _0x3b46ec;var _0x5c51d3;return db[_0x0ac6('0x1e')][_0x0ac6('0x40')]({'where':{'id':_0x67d059[_0x0ac6('0x29')]['id']}})[_0x0ac6('0x14')](handleEntityNotFound(_0x25f5a9,null))[_0x0ac6('0x14')](function(_0x2bfa2f){if(_0x2bfa2f){_0x3b46ec=_0x2bfa2f;_0x2b2057[_0x0ac6('0x2d')]=_[_0x0ac6('0x2a')](db['User']['rawAttributes']);_0x2b2057['query']=_[_0x0ac6('0x2a')](_0x67d059[_0x0ac6('0x2b')]);_0x2b2057['filters']=_[_0x0ac6('0x2f')](_0x2b2057[_0x0ac6('0x2d')],_0x2b2057['query']);_0x572269['attributes']=_[_0x0ac6('0x2f')](_0x2b2057['model'],qs[_0x0ac6('0x30')](_0x67d059[_0x0ac6('0x2b')][_0x0ac6('0x30')]));_0x572269['attributes']=_0x572269[_0x0ac6('0x2e')]['length']?_0x572269[_0x0ac6('0x2e')]:_0x2b2057[_0x0ac6('0x2d')];_0x572269['order']=qs[_0x0ac6('0x44')](_0x67d059[_0x0ac6('0x2b')][_0x0ac6('0x44')]);_0x572269[_0x0ac6('0x23')]=qs[_0x0ac6('0x2c')](_[_0x0ac6('0x4f')](_0x67d059[_0x0ac6('0x2b')],_0x2b2057[_0x0ac6('0x2c')]));if(_0x67d059[_0x0ac6('0x2b')][_0x0ac6('0x45')]){_0x572269['where']=_[_0x0ac6('0x32')](_0x572269['where'],{'$or':_[_0x0ac6('0x46')](_0x572269['attributes'],function(_0x117e3a){var _0xea765d={};_0xea765d[_0x117e3a]={'$like':'%'+_0x67d059[_0x0ac6('0x2b')][_0x0ac6('0x45')]+'%'};return _0xea765d;})});}_0x572269=_[_0x0ac6('0x32')]({},_0x572269,_0x67d059[_0x0ac6('0x33')]);return _0x3b46ec[_0x0ac6('0x75')](_0x572269);}})[_0x0ac6('0x14')](function(_0x234443){if(_0x234443){_0x5c51d3=_0x234443['length'];if(!_0x67d059[_0x0ac6('0x2b')][_0x0ac6('0x42')](_0x0ac6('0x50'))){_0x572269['limit']=qs[_0x0ac6('0xf')](_0x67d059['query'][_0x0ac6('0xf')]);_0x572269[_0x0ac6('0x12')]=qs[_0x0ac6('0x12')](_0x67d059[_0x0ac6('0x2b')][_0x0ac6('0x12')]);}return _0x3b46ec['getAgents'](_0x572269);}})['then'](function(_0x2ad9b6){if(_0x2ad9b6){return _0x2ad9b6?{'count':_0x5c51d3,'rows':_0x2ad9b6}:null;}})[_0x0ac6('0x14')](respondWithResult(_0x25f5a9,null))[_0x0ac6('0x27')](handleError(_0x25f5a9,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index d8b8bfe..551a4a3 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 _0xa7d5=['emit','MailQueue','setMaxListeners','save','update','remove'];(function(_0x1bc635,_0x4a1b08){var _0x1179e0=function(_0x48b2ed){while(--_0x48b2ed){_0x1bc635['push'](_0x1bc635['shift']());}};_0x1179e0(++_0x4a1b08);}(_0xa7d5,0x151));var _0x5a7d=function(_0x412bb3,_0x3c906b){_0x412bb3=_0x412bb3-0x0;var _0x339cf9=_0xa7d5[_0x412bb3];return _0x339cf9;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x5a7d('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x5a7d('0x1')](0x0);var events={'afterCreate':_0x5a7d('0x2'),'afterUpdate':_0x5a7d('0x3'),'afterDestroy':_0x5a7d('0x4')};function emitEvent(_0xc59dd){return function(_0xf983cc,_0x3ac3ab,_0x49c834){MailQueueEvents[_0x5a7d('0x5')](_0xc59dd+':'+_0xf983cc['id'],_0xf983cc);MailQueueEvents[_0x5a7d('0x5')](_0xc59dd,_0xf983cc);_0x49c834(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xb528=['MailQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb528,0x1f2));var _0x8b52=function(_0x35a9bb,_0x123ae8){_0x35a9bb=_0x35a9bb-0x0;var _0x55e795=_0xb528[_0x35a9bb];return _0x55e795;};'use strict';var EventEmitter=require(_0x8b52('0x0'));var MailQueue=require(_0x8b52('0x1'))['db'][_0x8b52('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8b52('0x3'),'afterUpdate':_0x8b52('0x4'),'afterDestroy':_0x8b52('0x5')};function emitEvent(_0x40c9d2){return function(_0x20599d,_0x51c71f,_0x1e373f){MailQueueEvents[_0x8b52('0x6')](_0x40c9d2+':'+_0x20599d['id'],_0x20599d);MailQueueEvents['emit'](_0x40c9d2,_0x20599d);_0x1e373f(null);};}for(var e in events){if(events[_0x8b52('0x7')](e)){var event=events[e];MailQueue[_0x8b52('0x8')](e,emitEvent(event));}}module[_0x8b52('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 0d45985..dc645fe 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 _0x7018=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','moment','bluebird'];(function(_0x37b66d,_0x58c084){var _0x3eb80b=function(_0x3e1331){while(--_0x3e1331){_0x37b66d['push'](_0x37b66d['shift']());}};_0x3eb80b(++_0x58c084);}(_0x7018,0x134));var _0x8701=function(_0x4c80d,_0x5a03cc){_0x4c80d=_0x4c80d-0x0;var _0x3e9b9b=_0x7018[_0x4c80d];return _0x3e9b9b;};'use strict';var _=require(_0x8701('0x0'));var util=require(_0x8701('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8701('0x2'));var BPromise=require(_0x8701('0x3'));var rp=require(_0x8701('0x4'));var fs=require('fs');var path=require(_0x8701('0x5'));var rimraf=require(_0x8701('0x6'));var config=require(_0x8701('0x7'));var attributes=require(_0x8701('0x8'));module[_0x8701('0x9')]=function(_0xf5f91d,_0x946b2b){return _0xf5f91d[_0x8701('0xa')](_0x8701('0xb'),attributes,{'tableName':_0x8701('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a8a=['define','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x35ef35,_0x51f7d6){var _0x423f27=function(_0x4986f5){while(--_0x4986f5){_0x35ef35['push'](_0x35ef35['shift']());}};_0x423f27(++_0x51f7d6);}(_0x8a8a,0x113));var _0xa8a8=function(_0x126f82,_0x210216){_0x126f82=_0x126f82-0x0;var _0x36b4c5=_0x8a8a[_0x126f82];return _0x36b4c5;};'use strict';var _=require(_0xa8a8('0x0'));var util=require(_0xa8a8('0x1'));var logger=require(_0xa8a8('0x2'))(_0xa8a8('0x3'));var moment=require(_0xa8a8('0x4'));var BPromise=require(_0xa8a8('0x5'));var rp=require(_0xa8a8('0x6'));var fs=require('fs');var path=require(_0xa8a8('0x7'));var rimraf=require(_0xa8a8('0x8'));var config=require(_0xa8a8('0x9'));var attributes=require(_0xa8a8('0xa'));module['exports']=function(_0x581a3a,_0x2bfc6f){return _0x581a3a[_0xa8a8('0xb')]('MailQueue',attributes,{'tableName':_0xa8a8('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 ffe0314..e270996 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 _0x692e=['client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','map','include','model','debug','ShowMailQueue','find','util','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4cacfb,_0x380269){var _0x1a684e=function(_0x49a470){while(--_0x49a470){_0x4cacfb['push'](_0x4cacfb['shift']());}};_0x1a684e(++_0x380269);}(_0x692e,0x6c));var _0xe692=function(_0x32e034,_0x71502){_0x32e034=_0x32e034-0x0;var _0x105f5b=_0x692e[_0x32e034];return _0x105f5b;};'use strict';var _=require('lodash');var util=require(_0xe692('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe692('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xe692('0x2'));var logger=require('../../config/logger')(_0xe692('0x3'));var config=require(_0xe692('0x4'));var jayson=require(_0xe692('0x5'));var client=jayson[_0xe692('0x6')][_0xe692('0x7')]({'port':0x232a});config[_0xe692('0x8')]=_['defaults'](config[_0xe692('0x8')],{'host':_0xe692('0x9'),'port':0x18eb});var socket=require(_0xe692('0xa'))(new Redis(config[_0xe692('0x8')]));require(_0xe692('0xb'))[_0xe692('0xc')](socket);function respondWithRpcPromise(_0x2fd4b1,_0x4a0a26,_0x54a1a0){return new BPromise(function(_0x4abe9f,_0x1a17ed){return client[_0xe692('0xd')](_0x2fd4b1,_0x54a1a0)[_0xe692('0xe')](function(_0x3f7d2a){logger[_0xe692('0xf')](_0xe692('0x10'),_0x4a0a26,'request\x20sent');logger['debug'](_0xe692('0x11'),_0x4a0a26,_0xe692('0x12'),JSON[_0xe692('0x13')](_0x3f7d2a));if(_0x3f7d2a['error']){if(_0x3f7d2a[_0xe692('0x14')][_0xe692('0x15')]===0x1f4){logger['error'](_0xe692('0x10'),_0x4a0a26,_0x3f7d2a[_0xe692('0x14')][_0xe692('0x16')]);return _0x1a17ed(_0x3f7d2a[_0xe692('0x14')][_0xe692('0x16')]);}logger[_0xe692('0x14')](_0xe692('0x10'),_0x4a0a26,_0x3f7d2a[_0xe692('0x14')][_0xe692('0x16')]);return _0x4abe9f(_0x3f7d2a[_0xe692('0x14')][_0xe692('0x16')]);}else{logger[_0xe692('0xf')](_0xe692('0x10'),_0x4a0a26,_0xe692('0x12'));_0x4abe9f(_0x3f7d2a['result'][_0xe692('0x16')]);}})[_0xe692('0x17')](function(_0x58ed26){logger[_0xe692('0x14')](_0xe692('0x10'),_0x4a0a26,_0x58ed26);_0x1a17ed(_0x58ed26);});});}exports[_0xe692('0x18')]=function(_0xad3ebb){var _0x373409=this;return new Promise(function(_0x19a94b,_0x1b35af){return db[_0xe692('0x19')][_0xe692('0x1a')]({'raw':_0xad3ebb[_0xe692('0x1b')]?_0xad3ebb[_0xe692('0x1b')][_0xe692('0x1c')]===undefined?!![]:![]:!![],'where':_0xad3ebb[_0xe692('0x1b')]?_0xad3ebb['options'][_0xe692('0x1d')]||null:null,'attributes':_0xad3ebb[_0xe692('0x1b')]?_0xad3ebb[_0xe692('0x1b')][_0xe692('0x1e')]||null:null,'limit':_0xad3ebb[_0xe692('0x1b')]?_0xad3ebb['options'][_0xe692('0x1f')]||null:null,'include':_0xad3ebb[_0xe692('0x1b')]?_0xad3ebb[_0xe692('0x1b')]['include']?_[_0xe692('0x20')](_0xad3ebb[_0xe692('0x1b')][_0xe692('0x21')],function(_0x8bca85){return{'model':db[_0x8bca85[_0xe692('0x22')]],'as':_0x8bca85['as'],'attributes':_0x8bca85[_0xe692('0x1e')],'include':_0x8bca85[_0xe692('0x21')]?_['map'](_0x8bca85[_0xe692('0x21')],function(_0xc1232){return{'model':db[_0xc1232[_0xe692('0x22')]],'as':_0xc1232['as'],'attributes':_0xc1232['attributes'],'include':_0xc1232['include']?_[_0xe692('0x20')](_0xc1232[_0xe692('0x21')],function(_0x28da73){return{'model':db[_0x28da73[_0xe692('0x22')]],'as':_0x28da73['as'],'attributes':_0x28da73['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c4a8a){logger[_0xe692('0xf')](_0xe692('0x18'),_0xad3ebb);logger[_0xe692('0x23')](_0xe692('0x18'),_0xad3ebb,JSON[_0xe692('0x13')](_0x4c4a8a));_0x19a94b(_0x4c4a8a);})[_0xe692('0x17')](function(_0x4123f7){logger[_0xe692('0x14')](_0xe692('0x18'),_0x4123f7['message'],_0xad3ebb);_0x1b35af(_0x373409['error'](0x1f4,_0x4123f7[_0xe692('0x16')]));});});};exports[_0xe692('0x24')]=function(_0x52467b){var _0x2f5b79=this;return new Promise(function(_0x252d1e,_0x11f91a){return db['MailQueue'][_0xe692('0x25')]({'raw':_0x52467b[_0xe692('0x1b')]?_0x52467b[_0xe692('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x52467b[_0xe692('0x1b')]?_0x52467b[_0xe692('0x1b')][_0xe692('0x1d')]||null:null,'attributes':_0x52467b[_0xe692('0x1b')]?_0x52467b[_0xe692('0x1b')]['attributes']||null:null,'include':_0x52467b['options']?_0x52467b[_0xe692('0x1b')]['include']?_['map'](_0x52467b[_0xe692('0x1b')][_0xe692('0x21')],function(_0xc51ebd){return{'model':db[_0xc51ebd[_0xe692('0x22')]],'as':_0xc51ebd['as'],'attributes':_0xc51ebd[_0xe692('0x1e')],'include':_0xc51ebd[_0xe692('0x21')]?_[_0xe692('0x20')](_0xc51ebd[_0xe692('0x21')],function(_0x39a950){return{'model':db[_0x39a950[_0xe692('0x22')]],'as':_0x39a950['as'],'attributes':_0x39a950[_0xe692('0x1e')],'include':_0x39a950['include']?_['map'](_0x39a950[_0xe692('0x21')],function(_0x54d86c){return{'model':db[_0x54d86c['model']],'as':_0x54d86c['as'],'attributes':_0x54d86c[_0xe692('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x219ca7){logger[_0xe692('0xf')](_0xe692('0x24'),_0x52467b);logger[_0xe692('0x23')](_0xe692('0x24'),_0x52467b,JSON['stringify'](_0x219ca7));_0x252d1e(_0x219ca7);})[_0xe692('0x17')](function(_0x47b2f0){logger[_0xe692('0x14')](_0xe692('0x24'),_0x47b2f0[_0xe692('0x16')],_0x52467b);_0x11f91a(_0x2f5b79['error'](0x1f4,_0x47b2f0[_0xe692('0x16')]));});});}; \ No newline at end of file +var _0x9211=['code','message','info','result','MailQueue','findAll','options','raw','where','attributes','map','include','model','GetMailQueue','ShowMailQueue','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','localhost','redis','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1d4a06,_0x56700f){var _0x32b622=function(_0x5ba4fb){while(--_0x5ba4fb){_0x1d4a06['push'](_0x1d4a06['shift']());}};_0x32b622(++_0x56700f);}(_0x9211,0x170));var _0x1921=function(_0x18d8e9,_0x2d9568){_0x18d8e9=_0x18d8e9-0x0;var _0x1b9102=_0x9211[_0x18d8e9];return _0x1b9102;};'use strict';var _=require(_0x1921('0x0'));var util=require('util');var moment=require(_0x1921('0x1'));var BPromise=require(_0x1921('0x2'));var rs=require(_0x1921('0x3'));var fs=require('fs');var Redis=require(_0x1921('0x4'));var db=require(_0x1921('0x5'))['db'];var utils=require(_0x1921('0x6'));var logger=require('../../config/logger')(_0x1921('0x7'));var config=require(_0x1921('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1921('0x9')][_0x1921('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x1921('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1921('0xc')]));require(_0x1921('0xd'))[_0x1921('0xe')](socket);function respondWithRpcPromise(_0x512781,_0x18ffad,_0xebc0d2){return new BPromise(function(_0x536e0a,_0x1787d5){return client[_0x1921('0xf')](_0x512781,_0xebc0d2)['then'](function(_0x29040f){logger['info'](_0x1921('0x10'),_0x18ffad,_0x1921('0x11'));logger[_0x1921('0x12')](_0x1921('0x13'),_0x18ffad,'request\x20sent',JSON[_0x1921('0x14')](_0x29040f));if(_0x29040f['error']){if(_0x29040f[_0x1921('0x15')][_0x1921('0x16')]===0x1f4){logger[_0x1921('0x15')]('MailQueue,\x20%s,\x20%s',_0x18ffad,_0x29040f[_0x1921('0x15')][_0x1921('0x17')]);return _0x1787d5(_0x29040f[_0x1921('0x15')][_0x1921('0x17')]);}logger[_0x1921('0x15')](_0x1921('0x10'),_0x18ffad,_0x29040f['error']['message']);return _0x536e0a(_0x29040f[_0x1921('0x15')]['message']);}else{logger[_0x1921('0x18')](_0x1921('0x10'),_0x18ffad,_0x1921('0x11'));_0x536e0a(_0x29040f[_0x1921('0x19')][_0x1921('0x17')]);}})['catch'](function(_0x102fd3){logger[_0x1921('0x15')]('MailQueue,\x20%s,\x20%s',_0x18ffad,_0x102fd3);_0x1787d5(_0x102fd3);});});}exports['GetMailQueue']=function(_0x5f1db0){var _0x372053=this;return new Promise(function(_0x30d252,_0x1ff30f){return db[_0x1921('0x1a')][_0x1921('0x1b')]({'raw':_0x5f1db0[_0x1921('0x1c')]?_0x5f1db0[_0x1921('0x1c')][_0x1921('0x1d')]===undefined?!![]:![]:!![],'where':_0x5f1db0['options']?_0x5f1db0[_0x1921('0x1c')][_0x1921('0x1e')]||null:null,'attributes':_0x5f1db0['options']?_0x5f1db0[_0x1921('0x1c')][_0x1921('0x1f')]||null:null,'limit':_0x5f1db0[_0x1921('0x1c')]?_0x5f1db0[_0x1921('0x1c')]['limit']||null:null,'include':_0x5f1db0[_0x1921('0x1c')]?_0x5f1db0[_0x1921('0x1c')]['include']?_[_0x1921('0x20')](_0x5f1db0[_0x1921('0x1c')][_0x1921('0x21')],function(_0x5e6e0d){return{'model':db[_0x5e6e0d[_0x1921('0x22')]],'as':_0x5e6e0d['as'],'attributes':_0x5e6e0d[_0x1921('0x1f')],'include':_0x5e6e0d['include']?_[_0x1921('0x20')](_0x5e6e0d[_0x1921('0x21')],function(_0x154130){return{'model':db[_0x154130[_0x1921('0x22')]],'as':_0x154130['as'],'attributes':_0x154130[_0x1921('0x1f')],'include':_0x154130[_0x1921('0x21')]?_[_0x1921('0x20')](_0x154130['include'],function(_0x21a193){return{'model':db[_0x21a193['model']],'as':_0x21a193['as'],'attributes':_0x21a193[_0x1921('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dede6){logger[_0x1921('0x18')](_0x1921('0x23'),_0x5f1db0);logger[_0x1921('0x12')]('GetMailQueue',_0x5f1db0,JSON['stringify'](_0x3dede6));_0x30d252(_0x3dede6);})['catch'](function(_0x9d5c5){logger[_0x1921('0x15')](_0x1921('0x23'),_0x9d5c5[_0x1921('0x17')],_0x5f1db0);_0x1ff30f(_0x372053[_0x1921('0x15')](0x1f4,_0x9d5c5[_0x1921('0x17')]));});});};exports[_0x1921('0x24')]=function(_0x32e5e7){var _0x5c1b53=this;return new Promise(function(_0x2fdade,_0x517b30){return db[_0x1921('0x1a')]['find']({'raw':_0x32e5e7[_0x1921('0x1c')]?_0x32e5e7['options'][_0x1921('0x1d')]===undefined?!![]:![]:!![],'where':_0x32e5e7[_0x1921('0x1c')]?_0x32e5e7[_0x1921('0x1c')][_0x1921('0x1e')]||null:null,'attributes':_0x32e5e7[_0x1921('0x1c')]?_0x32e5e7[_0x1921('0x1c')][_0x1921('0x1f')]||null:null,'include':_0x32e5e7[_0x1921('0x1c')]?_0x32e5e7[_0x1921('0x1c')]['include']?_[_0x1921('0x20')](_0x32e5e7[_0x1921('0x1c')][_0x1921('0x21')],function(_0x1c843a){return{'model':db[_0x1c843a['model']],'as':_0x1c843a['as'],'attributes':_0x1c843a['attributes'],'include':_0x1c843a[_0x1921('0x21')]?_[_0x1921('0x20')](_0x1c843a['include'],function(_0x31ae6a){return{'model':db[_0x31ae6a['model']],'as':_0x31ae6a['as'],'attributes':_0x31ae6a['attributes'],'include':_0x31ae6a[_0x1921('0x21')]?_['map'](_0x31ae6a[_0x1921('0x21')],function(_0x14d5e7){return{'model':db[_0x14d5e7['model']],'as':_0x14d5e7['as'],'attributes':_0x14d5e7[_0x1921('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1921('0x25')](function(_0x4ea4bb){logger[_0x1921('0x18')](_0x1921('0x24'),_0x32e5e7);logger['debug'](_0x1921('0x24'),_0x32e5e7,JSON['stringify'](_0x4ea4bb));_0x2fdade(_0x4ea4bb);})[_0x1921('0x26')](function(_0x157c08){logger['error']('ShowMailQueue',_0x157c08[_0x1921('0x17')],_0x32e5e7);_0x517b30(_0x5c1b53[_0x1921('0x15')](0x1f4,_0x157c08[_0x1921('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 2450eb0..84b2f76 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 _0xa509=['update','emit','removeListener','./mailQueue.events','save','remove'];(function(_0x21b20c,_0xee87ec){var _0x445a6b=function(_0x519f73){while(--_0x519f73){_0x21b20c['push'](_0x21b20c['shift']());}};_0x445a6b(++_0xee87ec);}(_0xa509,0x12f));var _0x9a50=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa509[_0x20a584];return _0x4b41a8;};'use strict';var MailQueueEvents=require(_0x9a50('0x0'));var events=[_0x9a50('0x1'),_0x9a50('0x2'),_0x9a50('0x3')];function createListener(_0x5f1b6c,_0x5f5e9a){return function(_0x4ceeed){_0x5f5e9a[_0x9a50('0x4')](_0x5f1b6c,_0x4ceeed);};}function removeListener(_0x2b428a,_0x3a8bc3){return function(){MailQueueEvents[_0x9a50('0x5')](_0x2b428a,_0x3a8bc3);};}exports['register']=function(_0x23fba6){for(var _0x5a7a94=0x0,_0x3f6789=events['length'];_0x5a7a94<_0x3f6789;_0x5a7a94++){var _0x5cf0b9=events[_0x5a7a94];var _0x5e83e8=createListener('mailQueue:'+_0x5cf0b9,_0x23fba6);MailQueueEvents['on'](_0x5cf0b9,_0x5e83e8);}}; \ No newline at end of file +var _0x4058=['emit','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4058,0x129));var _0x8405=function(_0x50d4e2,_0x2c5585){_0x50d4e2=_0x50d4e2-0x0;var _0x1dfe0c=_0x4058[_0x50d4e2];return _0x1dfe0c;};'use strict';var MailQueueEvents=require(_0x8405('0x0'));var events=[_0x8405('0x1'),_0x8405('0x2'),_0x8405('0x3')];function createListener(_0x46c215,_0x22f2ce){return function(_0x70944b){_0x22f2ce[_0x8405('0x4')](_0x46c215,_0x70944b);};}function removeListener(_0xf8c24c,_0x4948b2){return function(){MailQueueEvents['removeListener'](_0xf8c24c,_0x4948b2);};}exports['register']=function(_0x1db7ea){for(var _0x257d43=0x0,_0x3d9bf6=events[_0x8405('0x5')];_0x257d43<_0x3d9bf6;_0x257d43++){var _0x1cb061=events[_0x257d43];var _0x479c97=createListener(_0x8405('0x6')+_0x1cb061,_0x1db7ea);MailQueueEvents['on'](_0x1cb061,_0x479c97);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index e764220..a03e709 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 _0x4cf7=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','delete','destroy','util'];(function(_0x4c17a8,_0x9b080d){var _0x4159bf=function(_0x46349b){while(--_0x46349b){_0x4c17a8['push'](_0x4c17a8['shift']());}};_0x4159bf(++_0x9b080d);}(_0x4cf7,0x117));var _0x74cf=function(_0x2dacfd,_0x1cb6bc){_0x2dacfd=_0x2dacfd-0x0;var _0x30a2ef=_0x4cf7[_0x2dacfd];return _0x30a2ef;};'use strict';var multer=require('multer');var util=require(_0x74cf('0x0'));var path=require(_0x74cf('0x1'));var timeout=require(_0x74cf('0x2'));var express=require(_0x74cf('0x3'));var router=express[_0x74cf('0x4')]();var fs_extra=require(_0x74cf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x74cf('0x6'));var config=require(_0x74cf('0x7'));var controller=require(_0x74cf('0x8'));router['get']('/',auth[_0x74cf('0x9')](),controller['index']);router[_0x74cf('0xa')](_0x74cf('0xb'),auth['isAuthenticated'](),controller[_0x74cf('0xc')]);router['get'](_0x74cf('0xd'),auth[_0x74cf('0x9')](),controller[_0x74cf('0xe')]);router[_0x74cf('0xf')]('/',auth[_0x74cf('0x9')](),controller[_0x74cf('0x10')]);router[_0x74cf('0x11')](_0x74cf('0xd'),auth[_0x74cf('0x9')](),controller['update']);router[_0x74cf('0x12')](_0x74cf('0xd'),auth[_0x74cf('0x9')](),controller[_0x74cf('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbc93=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','index','get','/describe','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xbc93,0x14a));var _0x3bc9=function(_0x28fa98,_0x4d3db3){_0x28fa98=_0x28fa98-0x0;var _0x1e20d8=_0xbc93[_0x28fa98];return _0x1e20d8;};'use strict';var multer=require(_0x3bc9('0x0'));var util=require(_0x3bc9('0x1'));var path=require(_0x3bc9('0x2'));var timeout=require(_0x3bc9('0x3'));var express=require(_0x3bc9('0x4'));var router=express[_0x3bc9('0x5')]();var fs_extra=require(_0x3bc9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3bc9('0x7'));var config=require(_0x3bc9('0x8'));var controller=require(_0x3bc9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x3bc9('0xa')]);router[_0x3bc9('0xb')](_0x3bc9('0xc'),auth[_0x3bc9('0xd')](),controller['describe']);router[_0x3bc9('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x3bc9('0xe')]);router[_0x3bc9('0xf')]('/',auth[_0x3bc9('0xd')](),controller[_0x3bc9('0x10')]);router[_0x3bc9('0x11')](_0x3bc9('0x12'),auth[_0x3bc9('0xd')](),controller['update']);router[_0x3bc9('0x13')](_0x3bc9('0x12'),auth[_0x3bc9('0xd')](),controller[_0x3bc9('0x14')]);module[_0x3bc9('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index caa2486..966af84 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 _0x5137=['moment','sequelize','exports','STRING','DATE'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x5137,0x1e5));var _0x7513=function(_0x587783,_0x6296e6){_0x587783=_0x587783-0x0;var _0x1cca44=_0x5137[_0x587783];return _0x1cca44;};'use strict';var moment=require(_0x7513('0x0'));var Sequelize=require(_0x7513('0x1'));module[_0x7513('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7513('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7513('0x4')]},'acceptAt':{'type':Sequelize[_0x7513('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7513('0x3')]}}; \ No newline at end of file +var _0xfb3b=['moment','sequelize','exports','STRING','DATE'];(function(_0x55dd91,_0x18cb78){var _0x53930b=function(_0x4ea002){while(--_0x4ea002){_0x55dd91['push'](_0x55dd91['shift']());}};_0x53930b(++_0x18cb78);}(_0xfb3b,0x109));var _0xbfb3=function(_0x56c19f,_0x46296e){_0x56c19f=_0x56c19f-0x0;var _0x2a5904=_0xfb3b[_0x56c19f];return _0x2a5904;};'use strict';var moment=require(_0xbfb3('0x0'));var Sequelize=require(_0xbfb3('0x1'));module[_0xbfb3('0x2')]={'uniqueid':{'type':Sequelize[_0xbfb3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbfb3('0x3')]},'joinAt':{'type':Sequelize[_0xbfb3('0x4')]},'leaveAt':{'type':Sequelize[_0xbfb3('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbfb3('0x4')]},'reason':{'type':Sequelize[_0xbfb3('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 0ca181d..279e460 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 _0x6d11=['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','stack','name','send','index','map','MailQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','fields','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6d11,0xbf));var _0x16d1=function(_0x4f067e,_0x406536){_0x4f067e=_0x4f067e-0x0;var _0x3930d1=_0x6d11[_0x4f067e];return _0x3930d1;};'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(){_0x17e038[_0x16d1('0x1a')](0xcc)[_0x16d1('0x1b')]();});}};}function handleEntityNotFound(_0x335c24,_0x4b2b5c){return function(_0x15203b){if(!_0x15203b){_0x335c24[_0x16d1('0x19')](0x194);}return _0x15203b;};}function handleError(_0x262f89,_0x346b69){_0x346b69=_0x346b69||0x1f4;return function(_0x2b8403){logger['error'](_0x2b8403[_0x16d1('0x24')]);if(_0x2b8403[_0x16d1('0x25')]){delete _0x2b8403[_0x16d1('0x25')];}_0x262f89['status'](_0x346b69)[_0x16d1('0x26')](_0x2b8403);};}exports[_0x16d1('0x27')]=function(_0x364bf7,_0x22e5b3){var _0x6396fc={},_0x462e5b={},_0x1dd574={'count':0x0,'rows':[]};var _0x562908=_[_0x16d1('0x28')](db[_0x16d1('0x29')][_0x16d1('0x2a')],function(_0x30cd8f){return{'name':_0x30cd8f['fieldName'],'type':_0x30cd8f['type'][_0x16d1('0x2b')]};});_0x462e5b[_0x16d1('0x2c')]=_[_0x16d1('0x28')](_0x562908,_0x16d1('0x25'));_0x462e5b[_0x16d1('0x2d')]=_[_0x16d1('0x2e')](_0x364bf7[_0x16d1('0x2d')]);_0x462e5b[_0x16d1('0x2f')]=_[_0x16d1('0x30')](_0x462e5b[_0x16d1('0x2c')],_0x462e5b[_0x16d1('0x2d')]);_0x6396fc[_0x16d1('0x31')]=_[_0x16d1('0x30')](_0x462e5b[_0x16d1('0x2c')],qs['fields'](_0x364bf7[_0x16d1('0x2d')]['fields']));_0x6396fc[_0x16d1('0x31')]=_0x6396fc[_0x16d1('0x31')][_0x16d1('0x32')]?_0x6396fc[_0x16d1('0x31')]:_0x462e5b[_0x16d1('0x2c')];if(!_0x364bf7[_0x16d1('0x2d')]['hasOwnProperty']('nolimit')){_0x6396fc['limit']=qs[_0x16d1('0x1f')](_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x1f')]);_0x6396fc[_0x16d1('0x1d')]=qs['offset'](_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x1d')]);}_0x6396fc['order']=qs['sort'](_0x364bf7['query'][_0x16d1('0x33')]);_0x6396fc[_0x16d1('0x34')]=qs[_0x16d1('0x2f')](_['pick'](_0x364bf7[_0x16d1('0x2d')],_0x462e5b[_0x16d1('0x2f')]),_0x562908);if(_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x35')]){_0x6396fc[_0x16d1('0x34')]=_[_0x16d1('0x36')](_0x6396fc[_0x16d1('0x34')],{'$or':_['map'](_0x562908,function(_0x50267b){if(_0x50267b['type']!==_0x16d1('0x37')){var _0x2306d3={};_0x2306d3[_0x50267b[_0x16d1('0x25')]]={'$like':'%'+_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x35')]+'%'};return _0x2306d3;}})});}_0x6396fc=_[_0x16d1('0x36')]({},_0x6396fc,_0x364bf7[_0x16d1('0x38')]);var _0x369b1c={'where':_0x6396fc['where']};return db[_0x16d1('0x29')]['count'](_0x369b1c)['then'](function(_0x352c5b){_0x1dd574[_0x16d1('0x39')]=_0x352c5b;if(_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x3a')]){_0x6396fc[_0x16d1('0x3b')]=[{'all':!![]}];}return db[_0x16d1('0x29')]['findAll'](_0x6396fc);})[_0x16d1('0x22')](function(_0x525212){_0x1dd574['rows']=_0x525212;return _0x1dd574;})['then'](respondWithFilteredResult(_0x22e5b3,_0x6396fc))['catch'](handleError(_0x22e5b3,null));};exports[_0x16d1('0x3c')]=function(_0x168e14,_0x24038b){var _0x1eb761={'raw':!![],'where':{'id':_0x168e14[_0x16d1('0x3d')]['id']}},_0x53de06={};_0x53de06['model']=_[_0x16d1('0x2e')](db[_0x16d1('0x29')][_0x16d1('0x2a')]);_0x53de06[_0x16d1('0x2d')]=_[_0x16d1('0x2e')](_0x168e14[_0x16d1('0x2d')]);_0x53de06[_0x16d1('0x2f')]=_[_0x16d1('0x30')](_0x53de06[_0x16d1('0x2c')],_0x53de06[_0x16d1('0x2d')]);_0x1eb761[_0x16d1('0x31')]=_[_0x16d1('0x30')](_0x53de06[_0x16d1('0x2c')],qs[_0x16d1('0x3e')](_0x168e14[_0x16d1('0x2d')]['fields']));_0x1eb761['attributes']=_0x1eb761[_0x16d1('0x31')][_0x16d1('0x32')]?_0x1eb761[_0x16d1('0x31')]:_0x53de06[_0x16d1('0x2c')];if(_0x168e14[_0x16d1('0x2d')][_0x16d1('0x3a')]){_0x1eb761['include']=[{'all':!![]}];}_0x1eb761=_[_0x16d1('0x36')]({},_0x1eb761,_0x168e14[_0x16d1('0x38')]);return db[_0x16d1('0x29')]['find'](_0x1eb761)['then'](handleEntityNotFound(_0x24038b,null))[_0x16d1('0x22')](respondWithResult(_0x24038b,null))[_0x16d1('0x3f')](handleError(_0x24038b,null));};exports['create']=function(_0x1cc137,_0x583151){return db[_0x16d1('0x29')][_0x16d1('0x40')](_0x1cc137[_0x16d1('0x41')],{})[_0x16d1('0x22')](respondWithResult(_0x583151,0xc9))['catch'](handleError(_0x583151,null));};exports['update']=function(_0x1d92cd,_0x8bb0c1){if(_0x1d92cd['body']['id']){delete _0x1d92cd[_0x16d1('0x41')]['id'];}return db[_0x16d1('0x29')][_0x16d1('0x42')]({'where':{'id':_0x1d92cd[_0x16d1('0x3d')]['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x8bb0c1,null))['then'](saveUpdates(_0x1d92cd[_0x16d1('0x41')],null))['then'](respondWithResult(_0x8bb0c1,null))[_0x16d1('0x3f')](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x23')]=function(_0x5d384c,_0x413acd){return db[_0x16d1('0x29')][_0x16d1('0x42')]({'where':{'id':_0x5d384c[_0x16d1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x413acd,null))['then'](removeEntity(_0x413acd,null))['catch'](handleError(_0x413acd,null));};exports[_0x16d1('0x43')]=function(_0xbf100f,_0x39fd41){return db[_0x16d1('0x29')]['describe']()[_0x16d1('0x22')](respondWithResult(_0x39fd41,null))[_0x16d1('0x3f')](handleError(_0x39fd41,null));}; \ No newline at end of file +var _0x430c=['status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','describe','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x430c,0x1a1));var _0xc430=function(_0x3fa7d3,_0x37f83c){_0x3fa7d3=_0x3fa7d3-0x0;var _0x4c51bd=_0x430c[_0x3fa7d3];return _0x4c51bd;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':!![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));};exports[_0xc430('0x48')]=function(_0x214954,_0x2a5143){return db[_0xc430('0x25')][_0xc430('0x48')]()[_0xc430('0x1e')](respondWithResult(_0x2a5143,null))['catch'](handleError(_0x2a5143,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index fda4e4b..13d80d6 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 _0x61f1=['lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','MailQueueReport','uniqueid'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x61f1,0xf3));var _0x161f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x61f1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x161f('0x0'));var util=require('util');var logger=require(_0x161f('0x1'))('api');var moment=require(_0x161f('0x2'));var BPromise=require(_0x161f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x161f('0x4'));var config=require(_0x161f('0x5'));var attributes=require('./mailQueueReport.attributes');module[_0x161f('0x6')]=function(_0x4ba71f,_0x153f80){return _0x4ba71f['define'](_0x161f('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x161f('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e2d=['path','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0x1e2d,0x127));var _0xd1e2=function(_0x9f91f5,_0x2ac64b){_0x9f91f5=_0x9f91f5-0x0;var _0x257122=_0x1e2d[_0x9f91f5];return _0x257122;};'use strict';var _=require('lodash');var util=require(_0xd1e2('0x0'));var logger=require(_0xd1e2('0x1'))(_0xd1e2('0x2'));var moment=require('moment');var BPromise=require(_0xd1e2('0x3'));var rp=require(_0xd1e2('0x4'));var fs=require('fs');var path=require(_0xd1e2('0x5'));var rimraf=require('rimraf');var config=require(_0xd1e2('0x6'));var attributes=require(_0xd1e2('0x7'));module['exports']=function(_0x205aeb,_0x2b14e0){return _0x205aeb[_0xd1e2('0x8')](_0xd1e2('0x9'),attributes,{'tableName':_0xd1e2('0xa'),'paranoid':![],'indexes':[{'name':_0xd1e2('0xb'),'fields':[_0xd1e2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 4e9bdea..b7f53cc 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x5950e7,_0x43a5bb){var _0x47494d=function(_0x275377){while(--_0x275377){_0x5950e7['push'](_0x5950e7['shift']());}};_0x47494d(++_0x43a5bb);}(_0x2ef3,0xba));var _0x32ef=function(_0x2849b9,_0x263367){_0x2849b9=_0x2849b9-0x0;var _0x526164=_0x2ef3[_0x2849b9];return _0x526164;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +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(_0x261645,_0x1c13bf){var _0x75d3c1=function(_0xca9602){while(--_0xca9602){_0x261645['push'](_0x261645['shift']());}};_0x75d3c1(++_0x1c13bf);}(_0x1261,0x144));var _0x1126=function(_0x249dfe,_0x21f85c){_0x249dfe=_0x249dfe-0x0;var _0xc7c7be=_0x1261[_0x249dfe];return _0xc7c7be;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index b003011..7a738b4 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2d440e,_0x32b440){var _0x38030d=function(_0x1af1a0){while(--_0x1af1a0){_0x2d440e['push'](_0x2d440e['shift']());}};_0x38030d(++_0x32b440);}(_0xe706,0xa3));var _0x6e70=function(_0x50da6f,_0xfeb8d1){_0x50da6f=_0x50da6f-0x0;var _0xaff1c5=_0xe706[_0x50da6f];return _0xaff1c5;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x7ea1fb,_0x2f0b74){var _0x478241=function(_0xd06b3a){while(--_0xd06b3a){_0x7ea1fb['push'](_0x7ea1fb['shift']());}};_0x478241(++_0x2f0b74);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index be7a83f..1f5b885 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 _0x3e49=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x46f6d7,_0x8abc26){var _0x20b442=function(_0x37f331){while(--_0x37f331){_0x46f6d7['push'](_0x46f6d7['shift']());}};_0x20b442(++_0x8abc26);}(_0x3e49,0x1b1));var _0x93e4=function(_0x1c2206,_0x500ca9){_0x1c2206=_0x1c2206-0x0;var _0x3d2c57=_0x3e49[_0x1c2206];return _0x3d2c57;};'use strict';var Sequelize=require(_0x93e4('0x0'));module[_0x93e4('0x1')]={'description':{'type':Sequelize[_0x93e4('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x93e4('0x2')]},'password':{'type':Sequelize[_0x93e4('0x2')]},'port':{'type':Sequelize[_0x93e4('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x93e4('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x93e4('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x93e4('0x2')]},'modernAuthentication':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1c68=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1c68,0xe9));var _0x81c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c68[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x81c6('0x0'));module[_0x81c6('0x1')]={'description':{'type':Sequelize[_0x81c6('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x81c6('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x81c6('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x81c6('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x81c6('0x2')],'defaultValue':_0x81c6('0x5')},'connTimeout':{'type':Sequelize[_0x81c6('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x81c6('0x2')]},'modernAuthentication':{'type':Sequelize[_0x81c6('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 d49e9d6..828312c 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 _0x753e=['../../config/environment','./mailServerIn.attributes','define','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0x753e,0x122));var _0xe753=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x753e[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xe753('0x0'));var util=require(_0xe753('0x1'));var logger=require(_0xe753('0x2'))(_0xe753('0x3'));var moment=require(_0xe753('0x4'));var BPromise=require(_0xe753('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe753('0x6'));var rimraf=require('rimraf');var config=require(_0xe753('0x7'));var attributes=require(_0xe753('0x8'));module['exports']=function(_0xc13f77,_0x499357){return _0xc13f77[_0xe753('0x9')]('MailServerIn',attributes,{'tableName':_0xe753('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4637=['exports','define','mail_servers_in','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x497d8e,_0x3a2dae){var _0x3a4344=function(_0x284b43){while(--_0x284b43){_0x497d8e['push'](_0x497d8e['shift']());}};_0x3a4344(++_0x3a2dae);}(_0x4637,0x116));var _0x7463=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x4637[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x7463('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7463('0x1'));var moment=require(_0x7463('0x2'));var BPromise=require(_0x7463('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7463('0x4'));var rimraf=require(_0x7463('0x5'));var config=require(_0x7463('0x6'));var attributes=require(_0x7463('0x7'));module[_0x7463('0x8')]=function(_0x56f731,_0x53da16){return _0x56f731[_0x7463('0x9')]('MailServerIn',attributes,{'tableName':_0x7463('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 8211b5b..42169a2 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 _0x923f=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','limit','include','map','attributes','model','lodash'];(function(_0x30eccd,_0x23aa4f){var _0x28cc46=function(_0xead786){while(--_0xead786){_0x30eccd['push'](_0x30eccd['shift']());}};_0x28cc46(++_0x23aa4f);}(_0x923f,0x7b));var _0xf923=function(_0x34353,_0x55ab02){_0x34353=_0x34353-0x0;var _0x4124db=_0x923f[_0x34353];return _0x4124db;};'use strict';var _=require(_0xf923('0x0'));var util=require(_0xf923('0x1'));var moment=require(_0xf923('0x2'));var BPromise=require(_0xf923('0x3'));var rs=require(_0xf923('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf923('0x5'))['db'];var utils=require(_0xf923('0x6'));var logger=require(_0xf923('0x7'))('rpc');var config=require(_0xf923('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf923('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30f2b7,_0x42738b,_0x19501c){return new BPromise(function(_0x3db5ab,_0x2cfc53){return client[_0xf923('0xa')](_0x30f2b7,_0x19501c)['then'](function(_0x3ab9b){logger['info'](_0xf923('0xb'),_0x42738b,'request\x20sent');logger[_0xf923('0xc')](_0xf923('0xd'),_0x42738b,_0xf923('0xe'),JSON[_0xf923('0xf')](_0x3ab9b));if(_0x3ab9b[_0xf923('0x10')]){if(_0x3ab9b['error'][_0xf923('0x11')]===0x1f4){logger[_0xf923('0x10')]('MailServerIn,\x20%s,\x20%s',_0x42738b,_0x3ab9b[_0xf923('0x10')]['message']);return _0x2cfc53(_0x3ab9b[_0xf923('0x10')]['message']);}logger[_0xf923('0x10')](_0xf923('0xb'),_0x42738b,_0x3ab9b[_0xf923('0x10')][_0xf923('0x12')]);return _0x3db5ab(_0x3ab9b[_0xf923('0x10')][_0xf923('0x12')]);}else{logger['info'](_0xf923('0xb'),_0x42738b,_0xf923('0xe'));_0x3db5ab(_0x3ab9b[_0xf923('0x13')][_0xf923('0x12')]);}})[_0xf923('0x14')](function(_0x259cc9){logger[_0xf923('0x10')](_0xf923('0xb'),_0x42738b,_0x259cc9);_0x2cfc53(_0x259cc9);});});}exports[_0xf923('0x15')]=function(_0x27068f){var _0xc66907=this;return new Promise(function(_0x4a457e,_0x5aacf3){return db[_0xf923('0x16')]['findAll']({'raw':_0x27068f[_0xf923('0x17')]?_0x27068f[_0xf923('0x17')][_0xf923('0x18')]===undefined?!![]:![]:!![],'where':_0x27068f[_0xf923('0x17')]?_0x27068f['options'][_0xf923('0x19')]||null:null,'attributes':_0x27068f[_0xf923('0x17')]?_0x27068f[_0xf923('0x17')]['attributes']||null:null,'limit':_0x27068f['options']?_0x27068f['options'][_0xf923('0x1a')]||null:null,'include':_0x27068f[_0xf923('0x17')]?_0x27068f['options'][_0xf923('0x1b')]?_[_0xf923('0x1c')](_0x27068f[_0xf923('0x17')][_0xf923('0x1b')],function(_0x27789f){return{'model':db[_0x27789f['model']],'as':_0x27789f['as'],'attributes':_0x27789f[_0xf923('0x1d')],'include':_0x27789f[_0xf923('0x1b')]?_[_0xf923('0x1c')](_0x27789f[_0xf923('0x1b')],function(_0x6843fa){return{'model':db[_0x6843fa[_0xf923('0x1e')]],'as':_0x6843fa['as'],'attributes':_0x6843fa['attributes'],'include':_0x6843fa[_0xf923('0x1b')]?_['map'](_0x6843fa['include'],function(_0x578c51){return{'model':db[_0x578c51[_0xf923('0x1e')]],'as':_0x578c51['as'],'attributes':_0x578c51[_0xf923('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f4fa1){logger['info'](_0xf923('0x15'),_0x27068f);logger['debug'](_0xf923('0x15'),_0x27068f,JSON[_0xf923('0xf')](_0x5f4fa1));_0x4a457e(_0x5f4fa1);})['catch'](function(_0x299568){logger[_0xf923('0x10')](_0xf923('0x15'),_0x299568[_0xf923('0x12')],_0x27068f);_0x5aacf3(_0xc66907[_0xf923('0x10')](0x1f4,_0x299568['message']));});});}; \ No newline at end of file +var _0x7e04=['then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','map','model','stringify','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2fda66,_0x448ecf){var _0x34ce66=function(_0x573f65){while(--_0x573f65){_0x2fda66['push'](_0x2fda66['shift']());}};_0x34ce66(++_0x448ecf);}(_0x7e04,0x1cf));var _0x47e0=function(_0x3a1c91,_0x46fb03){_0x3a1c91=_0x3a1c91-0x0;var _0x6c5a86=_0x7e04[_0x3a1c91];return _0x6c5a86;};'use strict';var _=require(_0x47e0('0x0'));var util=require('util');var moment=require(_0x47e0('0x1'));var BPromise=require(_0x47e0('0x2'));var rs=require(_0x47e0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47e0('0x4'))['db'];var utils=require(_0x47e0('0x5'));var logger=require(_0x47e0('0x6'))(_0x47e0('0x7'));var config=require(_0x47e0('0x8'));var jayson=require(_0x47e0('0x9'));var client=jayson[_0x47e0('0xa')][_0x47e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb409fc,_0x3bf217,_0x1dc151){return new BPromise(function(_0x357f65,_0x352405){return client[_0x47e0('0xc')](_0xb409fc,_0x1dc151)[_0x47e0('0xd')](function(_0x50fb5a){logger['info'](_0x47e0('0xe'),_0x3bf217,_0x47e0('0xf'));logger[_0x47e0('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x3bf217,_0x47e0('0xf'),JSON['stringify'](_0x50fb5a));if(_0x50fb5a[_0x47e0('0x11')]){if(_0x50fb5a['error'][_0x47e0('0x12')]===0x1f4){logger[_0x47e0('0x11')](_0x47e0('0xe'),_0x3bf217,_0x50fb5a['error'][_0x47e0('0x13')]);return _0x352405(_0x50fb5a[_0x47e0('0x11')]['message']);}logger[_0x47e0('0x11')](_0x47e0('0xe'),_0x3bf217,_0x50fb5a[_0x47e0('0x11')][_0x47e0('0x13')]);return _0x357f65(_0x50fb5a[_0x47e0('0x11')]['message']);}else{logger[_0x47e0('0x14')](_0x47e0('0xe'),_0x3bf217,_0x47e0('0xf'));_0x357f65(_0x50fb5a[_0x47e0('0x15')][_0x47e0('0x13')]);}})['catch'](function(_0x22509a){logger[_0x47e0('0x11')]('MailServerIn,\x20%s,\x20%s',_0x3bf217,_0x22509a);_0x352405(_0x22509a);});});}exports[_0x47e0('0x16')]=function(_0x4f9669){var _0x4f334e=this;return new Promise(function(_0x34f605,_0x58dc5c){return db[_0x47e0('0x17')]['findAll']({'raw':_0x4f9669['options']?_0x4f9669[_0x47e0('0x18')][_0x47e0('0x19')]===undefined?!![]:![]:!![],'where':_0x4f9669[_0x47e0('0x18')]?_0x4f9669[_0x47e0('0x18')][_0x47e0('0x1a')]||null:null,'attributes':_0x4f9669['options']?_0x4f9669['options'][_0x47e0('0x1b')]||null:null,'limit':_0x4f9669[_0x47e0('0x18')]?_0x4f9669[_0x47e0('0x18')][_0x47e0('0x1c')]||null:null,'include':_0x4f9669[_0x47e0('0x18')]?_0x4f9669['options'][_0x47e0('0x1d')]?_[_0x47e0('0x1e')](_0x4f9669[_0x47e0('0x18')]['include'],function(_0x727694){return{'model':db[_0x727694[_0x47e0('0x1f')]],'as':_0x727694['as'],'attributes':_0x727694['attributes'],'include':_0x727694[_0x47e0('0x1d')]?_['map'](_0x727694[_0x47e0('0x1d')],function(_0x42ca4d){return{'model':db[_0x42ca4d[_0x47e0('0x1f')]],'as':_0x42ca4d['as'],'attributes':_0x42ca4d[_0x47e0('0x1b')],'include':_0x42ca4d[_0x47e0('0x1d')]?_[_0x47e0('0x1e')](_0x42ca4d[_0x47e0('0x1d')],function(_0x30db19){return{'model':db[_0x30db19[_0x47e0('0x1f')]],'as':_0x30db19['as'],'attributes':_0x30db19[_0x47e0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x47e0('0xd')](function(_0x1ac8d0){logger[_0x47e0('0x14')]('GetMailServerIn',_0x4f9669);logger['debug'](_0x47e0('0x16'),_0x4f9669,JSON[_0x47e0('0x20')](_0x1ac8d0));_0x34f605(_0x1ac8d0);})[_0x47e0('0x21')](function(_0x1c8c75){logger[_0x47e0('0x11')]('GetMailServerIn',_0x1c8c75[_0x47e0('0x13')],_0x4f9669);_0x58dc5c(_0x4f334e[_0x47e0('0x11')](0x1f4,_0x1c8c75[_0x47e0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 8965abe..ab0583f 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 _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(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 +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(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7a54,0x106));var _0x47a5=function(_0x5dfdfc,_0x110689){_0x5dfdfc=_0x5dfdfc-0x0;var _0x2f29e3=_0x7a54[_0x5dfdfc];return _0x2f29e3;};'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 diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 5eab911..8e2413a 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 _0x6324=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3d5db9,_0x2dbe0a){var _0x3c114c=function(_0x3e0239){while(--_0x3e0239){_0x3d5db9['push'](_0x3d5db9['shift']());}};_0x3c114c(++_0x2dbe0a);}(_0x6324,0x142));var _0x4632=function(_0x3c95a3,_0x1159f1){_0x3c95a3=_0x3c95a3-0x0;var _0x57b25b=_0x6324[_0x3c95a3];return _0x57b25b;};'use strict';var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'description':{'type':Sequelize[_0x4632('0x2')]},'host':{'type':Sequelize[_0x4632('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x4632('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x4632('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x4632('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0102=['exports','STRING','BOOLEAN'];(function(_0x480afe,_0x175253){var _0x19e5f9=function(_0x57d2d6){while(--_0x57d2d6){_0x480afe['push'](_0x480afe['shift']());}};_0x19e5f9(++_0x175253);}(_0x0102,0x186));var _0x2010=function(_0x2bcfb1,_0x1945b5){_0x2bcfb1=_0x2bcfb1-0x0;var _0x3b74dd=_0x0102[_0x2bcfb1];return _0x3b74dd;};'use strict';var Sequelize=require('sequelize');module[_0x2010('0x0')]={'description':{'type':Sequelize[_0x2010('0x1')]},'host':{'type':Sequelize[_0x2010('0x1')]},'user':{'type':Sequelize[_0x2010('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x2010('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 66637a4..6936cac 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 _0x6c88=['show','params','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','MailServerOut','includeAll','include','findAll','rows','catch'];(function(_0x4a951e,_0x2cf03f){var _0x1ca5e0=function(_0xceada7){while(--_0xceada7){_0x4a951e['push'](_0x4a951e['shift']());}};_0x1ca5e0(++_0x2cf03f);}(_0x6c88,0x141));var _0x86c8=function(_0x4def98,_0x421f3f){_0x4def98=_0x4def98-0x0;var _0x40f8cc=_0x6c88[_0x4def98];return _0x40f8cc;};'use strict';var emlformat=require(_0x86c8('0x0'));var rimraf=require(_0x86c8('0x1'));var zipdir=require(_0x86c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x86c8('0x3'));var BPromise=require(_0x86c8('0x4'));var Mustache=require(_0x86c8('0x5'));var util=require(_0x86c8('0x6'));var path=require(_0x86c8('0x7'));var sox=require(_0x86c8('0x8'));var csv=require(_0x86c8('0x9'));var ejs=require(_0x86c8('0xa'));var fs=require('fs');var fs_extra=require(_0x86c8('0xb'));var _=require('lodash');var squel=require(_0x86c8('0xc'));var crypto=require(_0x86c8('0xd'));var jsforce=require(_0x86c8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x86c8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86c8('0x10'));var qs=require(_0x86c8('0x11'));var as=require(_0x86c8('0x12'));var hardwareService=require(_0x86c8('0x13'));var logger=require(_0x86c8('0x14'))(_0x86c8('0x15'));var utils=require(_0x86c8('0x16'));var config=require(_0x86c8('0x17'));var licenseUtil=require(_0x86c8('0x18'));var db=require(_0x86c8('0x19'))['db'];function respondWithStatusCode(_0x4cde4c,_0x2ed60a){_0x2ed60a=_0x2ed60a||0xcc;return function(_0x4ea511){if(_0x4ea511){return _0x4cde4c[_0x86c8('0x1a')](_0x2ed60a);}return _0x4cde4c[_0x86c8('0x1b')](_0x2ed60a)[_0x86c8('0x1c')]();};}function respondWithResult(_0x33e0f6,_0x46a009){_0x46a009=_0x46a009||0xc8;return function(_0x908bec){if(_0x908bec){return _0x33e0f6['status'](_0x46a009)[_0x86c8('0x1d')](_0x908bec);}};}function respondWithFilteredResult(_0x246ba0,_0x275592){return function(_0x55f45f){if(_0x55f45f){var _0x39624d=typeof _0x275592[_0x86c8('0x1e')]===_0x86c8('0x1f')&&typeof _0x275592[_0x86c8('0x20')]===_0x86c8('0x1f');var _0x987d53=_0x55f45f[_0x86c8('0x21')];var _0x39e27f=_0x39624d?0x0:_0x275592[_0x86c8('0x1e')];var _0x14932b=_0x39624d?_0x55f45f[_0x86c8('0x21')]:_0x275592[_0x86c8('0x1e')]+_0x275592[_0x86c8('0x20')];var _0x3c0e2d;if(_0x14932b>=_0x987d53){_0x14932b=_0x987d53;_0x3c0e2d=0xc8;}else{_0x3c0e2d=0xce;}_0x246ba0[_0x86c8('0x1b')](_0x3c0e2d);return _0x246ba0[_0x86c8('0x22')](_0x86c8('0x23'),_0x39e27f+'-'+_0x14932b+'/'+_0x987d53)[_0x86c8('0x1d')](_0x55f45f);}return null;};}function patchUpdates(_0x2fc95e){return function(_0x452d4e){try{jsonpatch[_0x86c8('0x24')](_0x452d4e,_0x2fc95e,!![]);}catch(_0x34c881){return BPromise[_0x86c8('0x25')](_0x34c881);}return _0x452d4e[_0x86c8('0x26')]();};}function saveUpdates(_0x264970,_0xea7700){return function(_0x282a90){if(_0x282a90){return _0x282a90[_0x86c8('0x27')](_0x264970)[_0x86c8('0x28')](function(_0x52aae6){return _0x52aae6;});}return null;};}function removeEntity(_0x4e4eea,_0x148aff){return function(_0x4bdbd2){if(_0x4bdbd2){return _0x4bdbd2[_0x86c8('0x29')]()[_0x86c8('0x28')](function(){_0x4e4eea['status'](0xcc)[_0x86c8('0x1c')]();});}};}function handleEntityNotFound(_0x1c1ce1,_0x2a06e1){return function(_0x15db72){if(!_0x15db72){_0x1c1ce1[_0x86c8('0x1a')](0x194);}return _0x15db72;};}function handleError(_0x5c01cd,_0x25ed00){_0x25ed00=_0x25ed00||0x1f4;return function(_0x11ab6a){logger['error'](_0x11ab6a[_0x86c8('0x2a')]);if(_0x11ab6a[_0x86c8('0x2b')]){delete _0x11ab6a[_0x86c8('0x2b')];}_0x5c01cd[_0x86c8('0x1b')](_0x25ed00)[_0x86c8('0x2c')](_0x11ab6a);};}exports[_0x86c8('0x2d')]=function(_0x227190,_0x2b9d1b){var _0x29a5e9={},_0x64ab36={},_0x416248={'count':0x0,'rows':[]};var _0x2e1ac6=_['map'](db['MailServerOut'][_0x86c8('0x2e')],function(_0x322157){return{'name':_0x322157['fieldName'],'type':_0x322157[_0x86c8('0x2f')][_0x86c8('0x30')]};});_0x64ab36[_0x86c8('0x31')]=_[_0x86c8('0x32')](_0x2e1ac6,'name');_0x64ab36[_0x86c8('0x33')]=_[_0x86c8('0x34')](_0x227190[_0x86c8('0x33')]);_0x64ab36[_0x86c8('0x35')]=_[_0x86c8('0x36')](_0x64ab36[_0x86c8('0x31')],_0x64ab36[_0x86c8('0x33')]);_0x29a5e9[_0x86c8('0x37')]=_[_0x86c8('0x36')](_0x64ab36['model'],qs[_0x86c8('0x38')](_0x227190[_0x86c8('0x33')][_0x86c8('0x38')]));_0x29a5e9[_0x86c8('0x37')]=_0x29a5e9[_0x86c8('0x37')][_0x86c8('0x39')]?_0x29a5e9[_0x86c8('0x37')]:_0x64ab36[_0x86c8('0x31')];if(!_0x227190['query'][_0x86c8('0x3a')](_0x86c8('0x3b'))){_0x29a5e9[_0x86c8('0x20')]=qs[_0x86c8('0x20')](_0x227190['query'][_0x86c8('0x20')]);_0x29a5e9[_0x86c8('0x1e')]=qs[_0x86c8('0x1e')](_0x227190[_0x86c8('0x33')]['offset']);}_0x29a5e9[_0x86c8('0x3c')]=qs[_0x86c8('0x3d')](_0x227190[_0x86c8('0x33')][_0x86c8('0x3d')]);_0x29a5e9['where']=qs[_0x86c8('0x35')](_[_0x86c8('0x3e')](_0x227190[_0x86c8('0x33')],_0x64ab36[_0x86c8('0x35')]),_0x2e1ac6);if(_0x227190[_0x86c8('0x33')][_0x86c8('0x3f')]){_0x29a5e9[_0x86c8('0x40')]=_['merge'](_0x29a5e9['where'],{'$or':_[_0x86c8('0x32')](_0x2e1ac6,function(_0x3314e3){if(_0x3314e3[_0x86c8('0x2f')]!==_0x86c8('0x41')){var _0x4dd029={};_0x4dd029[_0x3314e3[_0x86c8('0x2b')]]={'$like':'%'+_0x227190[_0x86c8('0x33')][_0x86c8('0x3f')]+'%'};return _0x4dd029;}})});}_0x29a5e9=_[_0x86c8('0x42')]({},_0x29a5e9,_0x227190[_0x86c8('0x43')]);var _0x3353dc={'where':_0x29a5e9['where']};return db[_0x86c8('0x44')][_0x86c8('0x21')](_0x3353dc)[_0x86c8('0x28')](function(_0x2c9067){_0x416248[_0x86c8('0x21')]=_0x2c9067;if(_0x227190[_0x86c8('0x33')][_0x86c8('0x45')]){_0x29a5e9[_0x86c8('0x46')]=[{'all':!![]}];}return db['MailServerOut'][_0x86c8('0x47')](_0x29a5e9);})['then'](function(_0x52530b){_0x416248[_0x86c8('0x48')]=_0x52530b;return _0x416248;})[_0x86c8('0x28')](respondWithFilteredResult(_0x2b9d1b,_0x29a5e9))[_0x86c8('0x49')](handleError(_0x2b9d1b,null));};exports[_0x86c8('0x4a')]=function(_0x380c34,_0x4ac4f4){var _0x4cfc3d={'raw':!![],'where':{'id':_0x380c34[_0x86c8('0x4b')]['id']}},_0x51e4d1={};_0x51e4d1['model']=_[_0x86c8('0x34')](db[_0x86c8('0x44')]['rawAttributes']);_0x51e4d1[_0x86c8('0x33')]=_[_0x86c8('0x34')](_0x380c34[_0x86c8('0x33')]);_0x51e4d1[_0x86c8('0x35')]=_[_0x86c8('0x36')](_0x51e4d1[_0x86c8('0x31')],_0x51e4d1[_0x86c8('0x33')]);_0x4cfc3d[_0x86c8('0x37')]=_[_0x86c8('0x36')](_0x51e4d1[_0x86c8('0x31')],qs[_0x86c8('0x38')](_0x380c34[_0x86c8('0x33')][_0x86c8('0x38')]));_0x4cfc3d['attributes']=_0x4cfc3d['attributes']['length']?_0x4cfc3d[_0x86c8('0x37')]:_0x51e4d1[_0x86c8('0x31')];if(_0x380c34['query'][_0x86c8('0x45')]){_0x4cfc3d['include']=[{'all':!![]}];}_0x4cfc3d=_[_0x86c8('0x42')]({},_0x4cfc3d,_0x380c34['options']);return db[_0x86c8('0x44')][_0x86c8('0x4c')](_0x4cfc3d)[_0x86c8('0x28')](handleEntityNotFound(_0x4ac4f4,null))[_0x86c8('0x28')](respondWithResult(_0x4ac4f4,null))[_0x86c8('0x49')](handleError(_0x4ac4f4,null));};exports[_0x86c8('0x4d')]=function(_0x2d41b4,_0x11bba0){return db[_0x86c8('0x44')][_0x86c8('0x4d')](_0x2d41b4['body'],{})[_0x86c8('0x28')](respondWithResult(_0x11bba0,0xc9))[_0x86c8('0x49')](handleError(_0x11bba0,null));};exports[_0x86c8('0x27')]=function(_0x5d66b4,_0x327f8e){if(_0x5d66b4[_0x86c8('0x4e')]['id']){delete _0x5d66b4[_0x86c8('0x4e')]['id'];}return db[_0x86c8('0x44')][_0x86c8('0x4c')]({'where':{'id':_0x5d66b4[_0x86c8('0x4b')]['id']}})[_0x86c8('0x28')](handleEntityNotFound(_0x327f8e,null))[_0x86c8('0x28')](saveUpdates(_0x5d66b4['body'],null))[_0x86c8('0x28')](respondWithResult(_0x327f8e,null))[_0x86c8('0x49')](handleError(_0x327f8e,null));};exports[_0x86c8('0x29')]=function(_0xc25987,_0x3de4c7){return db['MailServerOut'][_0x86c8('0x4c')]({'where':{'id':_0xc25987[_0x86c8('0x4b')]['id']}})[_0x86c8('0x28')](handleEntityNotFound(_0x3de4c7,null))['then'](removeEntity(_0x3de4c7,null))['catch'](handleError(_0x3de4c7,null));}; \ No newline at end of file +var _0x9da6=['filters','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','params','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','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','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','MailServerOut','rawAttributes','fieldName','key','query','keys'];(function(_0x179791,_0xd1e02f){var _0x2be9f8=function(_0x252382){while(--_0x252382){_0x179791['push'](_0x179791['shift']());}};_0x2be9f8(++_0xd1e02f);}(_0x9da6,0xb0));var _0x69da=function(_0xfcf498,_0x3f39b6){_0xfcf498=_0xfcf498-0x0;var _0x7c1fd6=_0x9da6[_0xfcf498];return _0x7c1fd6;};'use strict';var emlformat=require(_0x69da('0x0'));var rimraf=require(_0x69da('0x1'));var zipdir=require(_0x69da('0x2'));var jsonpatch=require(_0x69da('0x3'));var rp=require(_0x69da('0x4'));var moment=require('moment');var BPromise=require(_0x69da('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x69da('0x6'));var sox=require(_0x69da('0x7'));var csv=require(_0x69da('0x8'));var ejs=require(_0x69da('0x9'));var fs=require('fs');var fs_extra=require(_0x69da('0xa'));var _=require(_0x69da('0xb'));var squel=require(_0x69da('0xc'));var crypto=require('crypto');var jsforce=require(_0x69da('0xd'));var deskjs=require(_0x69da('0xe'));var toCsv=require('to-csv');var querystring=require(_0x69da('0xf'));var Papa=require(_0x69da('0x10'));var Redis=require(_0x69da('0x11'));var authService=require(_0x69da('0x12'));var qs=require(_0x69da('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x69da('0x14'));var logger=require(_0x69da('0x15'))('api');var utils=require(_0x69da('0x16'));var config=require(_0x69da('0x17'));var licenseUtil=require(_0x69da('0x18'));var db=require(_0x69da('0x19'))['db'];function respondWithStatusCode(_0x5582a9,_0x31cfc1){_0x31cfc1=_0x31cfc1||0xcc;return function(_0x58d321){if(_0x58d321){return _0x5582a9['sendStatus'](_0x31cfc1);}return _0x5582a9[_0x69da('0x1a')](_0x31cfc1)[_0x69da('0x1b')]();};}function respondWithResult(_0xca87d0,_0x1c5ee9){_0x1c5ee9=_0x1c5ee9||0xc8;return function(_0x1ba13c){if(_0x1ba13c){return _0xca87d0[_0x69da('0x1a')](_0x1c5ee9)[_0x69da('0x1c')](_0x1ba13c);}};}function respondWithFilteredResult(_0x4dcb7b,_0x5b7ffb){return function(_0x295ff8){if(_0x295ff8){var _0x12dbfc=typeof _0x5b7ffb['offset']==='undefined'&&typeof _0x5b7ffb[_0x69da('0x1d')]===_0x69da('0x1e');var _0x17e3fb=_0x295ff8['count'];var _0x560ff8=_0x12dbfc?0x0:_0x5b7ffb[_0x69da('0x1f')];var _0x89639f=_0x12dbfc?_0x295ff8['count']:_0x5b7ffb[_0x69da('0x1f')]+_0x5b7ffb[_0x69da('0x1d')];var _0x1600b8;if(_0x89639f>=_0x17e3fb){_0x89639f=_0x17e3fb;_0x1600b8=0xc8;}else{_0x1600b8=0xce;}_0x4dcb7b['status'](_0x1600b8);return _0x4dcb7b[_0x69da('0x20')](_0x69da('0x21'),_0x560ff8+'-'+_0x89639f+'/'+_0x17e3fb)[_0x69da('0x1c')](_0x295ff8);}return null;};}function patchUpdates(_0x33ca9b){return function(_0x403e01){try{jsonpatch[_0x69da('0x22')](_0x403e01,_0x33ca9b,!![]);}catch(_0x19828a){return BPromise[_0x69da('0x23')](_0x19828a);}return _0x403e01[_0x69da('0x24')]();};}function saveUpdates(_0x324b64,_0x21ed87){return function(_0x4b60e4){if(_0x4b60e4){return _0x4b60e4[_0x69da('0x25')](_0x324b64)[_0x69da('0x26')](function(_0x5b844a){return _0x5b844a;});}return null;};}function removeEntity(_0x2fcba6,_0x3d7fba){return function(_0x54adf4){if(_0x54adf4){return _0x54adf4[_0x69da('0x27')]()['then'](function(){_0x2fcba6[_0x69da('0x1a')](0xcc)[_0x69da('0x1b')]();});}};}function handleEntityNotFound(_0x4c285f,_0x36a5c3){return function(_0x27ab0e){if(!_0x27ab0e){_0x4c285f[_0x69da('0x28')](0x194);}return _0x27ab0e;};}function handleError(_0x13881b,_0x263c88){_0x263c88=_0x263c88||0x1f4;return function(_0x339f6a){logger[_0x69da('0x29')](_0x339f6a[_0x69da('0x2a')]);if(_0x339f6a[_0x69da('0x2b')]){delete _0x339f6a['name'];}_0x13881b[_0x69da('0x1a')](_0x263c88)[_0x69da('0x2c')](_0x339f6a);};}exports['index']=function(_0x216504,_0x2cf51a){var _0x4b03a9={},_0x29d0be={},_0x4848c3={'count':0x0,'rows':[]};var _0x3dc69a=_[_0x69da('0x2d')](db[_0x69da('0x2e')][_0x69da('0x2f')],function(_0x319fa4){return{'name':_0x319fa4[_0x69da('0x30')],'type':_0x319fa4['type'][_0x69da('0x31')]};});_0x29d0be['model']=_['map'](_0x3dc69a,'name');_0x29d0be[_0x69da('0x32')]=_[_0x69da('0x33')](_0x216504[_0x69da('0x32')]);_0x29d0be[_0x69da('0x34')]=_['intersection'](_0x29d0be[_0x69da('0x35')],_0x29d0be['query']);_0x4b03a9['attributes']=_['intersection'](_0x29d0be['model'],qs[_0x69da('0x36')](_0x216504[_0x69da('0x32')]['fields']));_0x4b03a9[_0x69da('0x37')]=_0x4b03a9[_0x69da('0x37')][_0x69da('0x38')]?_0x4b03a9['attributes']:_0x29d0be[_0x69da('0x35')];if(!_0x216504['query']['hasOwnProperty'](_0x69da('0x39'))){_0x4b03a9[_0x69da('0x1d')]=qs[_0x69da('0x1d')](_0x216504[_0x69da('0x32')][_0x69da('0x1d')]);_0x4b03a9[_0x69da('0x1f')]=qs[_0x69da('0x1f')](_0x216504['query']['offset']);}_0x4b03a9[_0x69da('0x3a')]=qs[_0x69da('0x3b')](_0x216504[_0x69da('0x32')]['sort']);_0x4b03a9[_0x69da('0x3c')]=qs[_0x69da('0x34')](_['pick'](_0x216504[_0x69da('0x32')],_0x29d0be['filters']),_0x3dc69a);if(_0x216504[_0x69da('0x32')][_0x69da('0x3d')]){_0x4b03a9[_0x69da('0x3c')]=_[_0x69da('0x3e')](_0x4b03a9['where'],{'$or':_['map'](_0x3dc69a,function(_0x464bc9){if(_0x464bc9[_0x69da('0x3f')]!==_0x69da('0x40')){var _0x3823c6={};_0x3823c6[_0x464bc9[_0x69da('0x2b')]]={'$like':'%'+_0x216504[_0x69da('0x32')][_0x69da('0x3d')]+'%'};return _0x3823c6;}})});}_0x4b03a9=_['merge']({},_0x4b03a9,_0x216504[_0x69da('0x41')]);var _0x860320={'where':_0x4b03a9[_0x69da('0x3c')]};return db[_0x69da('0x2e')][_0x69da('0x42')](_0x860320)[_0x69da('0x26')](function(_0x5d093e){_0x4848c3[_0x69da('0x42')]=_0x5d093e;if(_0x216504[_0x69da('0x32')][_0x69da('0x43')]){_0x4b03a9[_0x69da('0x44')]=[{'all':!![]}];}return db[_0x69da('0x2e')][_0x69da('0x45')](_0x4b03a9);})[_0x69da('0x26')](function(_0x34f508){_0x4848c3['rows']=_0x34f508;return _0x4848c3;})[_0x69da('0x26')](respondWithFilteredResult(_0x2cf51a,_0x4b03a9))[_0x69da('0x46')](handleError(_0x2cf51a,null));};exports['show']=function(_0x2c87d0,_0x36eaac){var _0x3cae32={'raw':!![],'where':{'id':_0x2c87d0[_0x69da('0x47')]['id']}},_0x1a2655={};_0x1a2655[_0x69da('0x35')]=_[_0x69da('0x33')](db[_0x69da('0x2e')][_0x69da('0x2f')]);_0x1a2655['query']=_[_0x69da('0x33')](_0x2c87d0[_0x69da('0x32')]);_0x1a2655[_0x69da('0x34')]=_[_0x69da('0x48')](_0x1a2655[_0x69da('0x35')],_0x1a2655[_0x69da('0x32')]);_0x3cae32[_0x69da('0x37')]=_[_0x69da('0x48')](_0x1a2655[_0x69da('0x35')],qs[_0x69da('0x36')](_0x2c87d0[_0x69da('0x32')]['fields']));_0x3cae32[_0x69da('0x37')]=_0x3cae32['attributes'][_0x69da('0x38')]?_0x3cae32['attributes']:_0x1a2655[_0x69da('0x35')];if(_0x2c87d0['query'][_0x69da('0x43')]){_0x3cae32[_0x69da('0x44')]=[{'all':!![]}];}_0x3cae32=_[_0x69da('0x3e')]({},_0x3cae32,_0x2c87d0['options']);return db['MailServerOut'][_0x69da('0x49')](_0x3cae32)[_0x69da('0x26')](handleEntityNotFound(_0x36eaac,null))['then'](respondWithResult(_0x36eaac,null))[_0x69da('0x46')](handleError(_0x36eaac,null));};exports[_0x69da('0x4a')]=function(_0x3bfb94,_0x28add0){return db[_0x69da('0x2e')][_0x69da('0x4a')](_0x3bfb94[_0x69da('0x4b')],{})['then'](respondWithResult(_0x28add0,0xc9))[_0x69da('0x46')](handleError(_0x28add0,null));};exports[_0x69da('0x25')]=function(_0x5a9dfe,_0x213c94){if(_0x5a9dfe[_0x69da('0x4b')]['id']){delete _0x5a9dfe[_0x69da('0x4b')]['id'];}return db[_0x69da('0x2e')]['find']({'where':{'id':_0x5a9dfe[_0x69da('0x47')]['id']}})[_0x69da('0x26')](handleEntityNotFound(_0x213c94,null))[_0x69da('0x26')](saveUpdates(_0x5a9dfe['body'],null))[_0x69da('0x26')](respondWithResult(_0x213c94,null))['catch'](handleError(_0x213c94,null));};exports['destroy']=function(_0x39d1a3,_0x3a00eb){return db['MailServerOut'][_0x69da('0x49')]({'where':{'id':_0x39d1a3[_0x69da('0x47')]['id']}})[_0x69da('0x26')](handleEntityNotFound(_0x3a00eb,null))[_0x69da('0x26')](removeEntity(_0x3a00eb,null))[_0x69da('0x46')](handleError(_0x3a00eb,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 2d422d5..50681d6 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 _0x6299=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','lodash','util','../../config/logger'];(function(_0x4413cf,_0x3f70e8){var _0x9a1479=function(_0x5b4b2b){while(--_0x5b4b2b){_0x4413cf['push'](_0x4413cf['shift']());}};_0x9a1479(++_0x3f70e8);}(_0x6299,0xeb));var _0x9629=function(_0x502157,_0x2f9f2e){_0x502157=_0x502157-0x0;var _0xc73676=_0x6299[_0x502157];return _0xc73676;};'use strict';var _=require(_0x9629('0x0'));var util=require(_0x9629('0x1'));var logger=require(_0x9629('0x2'))(_0x9629('0x3'));var moment=require(_0x9629('0x4'));var BPromise=require(_0x9629('0x5'));var rp=require(_0x9629('0x6'));var fs=require('fs');var path=require(_0x9629('0x7'));var rimraf=require(_0x9629('0x8'));var config=require(_0x9629('0x9'));var attributes=require(_0x9629('0xa'));module[_0x9629('0xb')]=function(_0x453406,_0x393620){return _0x453406[_0x9629('0xc')](_0x9629('0xd'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47ce=['bluebird','request-promise','path','./mailServerOut.attributes','MailServerOut','mail_servers_out','../../config/logger','api','moment'];(function(_0x3abf32,_0x85b62f){var _0x4069ab=function(_0x2bb1c8){while(--_0x2bb1c8){_0x3abf32['push'](_0x3abf32['shift']());}};_0x4069ab(++_0x85b62f);}(_0x47ce,0x153));var _0xe47c=function(_0x4a9046,_0x367c82){_0x4a9046=_0x4a9046-0x0;var _0x44a6a1=_0x47ce[_0x4a9046];return _0x44a6a1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe47c('0x0'))(_0xe47c('0x1'));var moment=require(_0xe47c('0x2'));var BPromise=require(_0xe47c('0x3'));var rp=require(_0xe47c('0x4'));var fs=require('fs');var path=require(_0xe47c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe47c('0x6'));module['exports']=function(_0x4b71b3,_0x4fa65a){return _0x4b71b3['define'](_0xe47c('0x7'),attributes,{'tableName':_0xe47c('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 efea967..e51e918 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4bae36,_0x58a2b2){var _0x4ca0c5=function(_0x496275){while(--_0x496275){_0x4bae36['push'](_0x4bae36['shift']());}};_0x4ca0c5(++_0x58a2b2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x43ab40,_0x3abc12){_0x43ab40=_0x43ab40-0x0;var _0x43de5d=_0x5f2f[_0x43ab40];return _0x43de5d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1c58b9,_0x4e1614){var _0x5217c1=function(_0x59045a){while(--_0x59045a){_0x1c58b9['push'](_0x1c58b9['shift']());}};_0x5217c1(++_0x4e1614);}(_0xdb28,0x106));var _0x8db2=function(_0x42c372,_0x55eff9){_0x42c372=_0x42c372-0x0;var _0x14de68=_0xdb28[_0x42c372];return _0x14de68;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e677489..ab3cc11 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 _0xdb43=['get','index','isAuthenticated','describe','/:id','post','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller'];(function(_0x1867e3,_0x589b2d){var _0x4b22aa=function(_0x36a685){while(--_0x36a685){_0x1867e3['push'](_0x1867e3['shift']());}};_0x4b22aa(++_0x589b2d);}(_0xdb43,0x69));var _0x3db4=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xdb43[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0x3db4('0x0'));var util=require(_0x3db4('0x1'));var path=require('path');var timeout=require(_0x3db4('0x2'));var express=require(_0x3db4('0x3'));var router=express[_0x3db4('0x4')]();var fs_extra=require(_0x3db4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3db4('0x6'));var config=require(_0x3db4('0x7'));var controller=require(_0x3db4('0x8'));router[_0x3db4('0x9')]('/',auth['isAuthenticated'](),controller[_0x3db4('0xa')]);router[_0x3db4('0x9')]('/describe',auth[_0x3db4('0xb')](),controller[_0x3db4('0xc')]);router[_0x3db4('0x9')](_0x3db4('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x3db4('0xe')]('/',auth[_0x3db4('0xb')](),controller[_0x3db4('0xf')]);router[_0x3db4('0x10')](_0x3db4('0xd'),auth['isAuthenticated'](),controller[_0x3db4('0x11')]);router['delete']('/:id',auth[_0x3db4('0xb')](),controller[_0x3db4('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4913=['path','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x3ead55,_0x22bc51){var _0x3ea16d=function(_0x2a59e0){while(--_0x2a59e0){_0x3ead55['push'](_0x3ead55['shift']());}};_0x3ea16d(++_0x22bc51);}(_0x4913,0x1c6));var _0x3491=function(_0x4d9817,_0x487471){_0x4d9817=_0x4d9817-0x0;var _0x3636f1=_0x4913[_0x4d9817];return _0x3636f1;};'use strict';var multer=require(_0x3491('0x0'));var util=require(_0x3491('0x1'));var path=require(_0x3491('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3491('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3491('0x4'));var interaction=require(_0x3491('0x5'));var config=require('../../config/environment');var controller=require(_0x3491('0x6'));router['get']('/',auth[_0x3491('0x7')](),controller[_0x3491('0x8')]);router[_0x3491('0x9')](_0x3491('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x3491('0x9')](_0x3491('0xb'),auth[_0x3491('0x7')](),controller[_0x3491('0xc')]);router[_0x3491('0xd')]('/',auth[_0x3491('0x7')](),controller[_0x3491('0xe')]);router['put'](_0x3491('0xb'),auth[_0x3491('0x7')](),controller[_0x3491('0xf')]);router[_0x3491('0x10')](_0x3491('0xb'),auth[_0x3491('0x7')](),controller[_0x3491('0x11')]);module[_0x3491('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e6fbc4b..c9fed1a 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 _0x13f5=['exports','STRING','name','sequelize'];(function(_0xa57601,_0x44dee4){var _0x49c699=function(_0x204b63){while(--_0x204b63){_0xa57601['push'](_0xa57601['shift']());}};_0x49c699(++_0x44dee4);}(_0x13f5,0xc3));var _0x513f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x13f5[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x513f('0x0'));module[_0x513f('0x1')]={'name':{'type':Sequelize[_0x513f('0x2')],'unique':_0x513f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7fbe=['STRING','name'];(function(_0x4cc280,_0x3b77f3){var _0x16ed24=function(_0x473e10){while(--_0x473e10){_0x4cc280['push'](_0x4cc280['shift']());}};_0x16ed24(++_0x3b77f3);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5a4a1e,_0x5f014c){_0x5a4a1e=_0x5a4a1e-0x0;var _0x13b91d=_0x7fbe[_0x5a4a1e];return _0x13b91d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'unique':_0xe7fb('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe7fb('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 2a06c14..20ede7d 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 _0xcdca=['map','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','MailSubstatus','find','create','body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name'];(function(_0x2f9d9c,_0x42bcc9){var _0x2be03d=function(_0x597ea1){while(--_0x597ea1){_0x2f9d9c['push'](_0x2f9d9c['shift']());}};_0x2be03d(++_0x42bcc9);}(_0xcdca,0x1cc));var _0xacdc=function(_0x20e11b,_0x328bbd){_0x20e11b=_0x20e11b-0x0;var _0x46ead7=_0xcdca[_0x20e11b];return _0x46ead7;};'use strict';var emlformat=require(_0xacdc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xacdc('0x1'));var rp=require('request-promise');var moment=require(_0xacdc('0x2'));var BPromise=require(_0xacdc('0x3'));var Mustache=require(_0xacdc('0x4'));var util=require(_0xacdc('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xacdc('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xacdc('0x7'));var squel=require(_0xacdc('0x8'));var crypto=require(_0xacdc('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xacdc('0xa'));var toCsv=require(_0xacdc('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xacdc('0xb'));var authService=require(_0xacdc('0xc'));var qs=require(_0xacdc('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacdc('0xe'));var logger=require(_0xacdc('0xf'))(_0xacdc('0x10'));var utils=require('../../config/utils');var config=require(_0xacdc('0x11'));var licenseUtil=require(_0xacdc('0x12'));var db=require(_0xacdc('0x13'))['db'];function respondWithStatusCode(_0x44d56b,_0x26a380){_0x26a380=_0x26a380||0xcc;return function(_0x419c46){if(_0x419c46){return _0x44d56b[_0xacdc('0x14')](_0x26a380);}return _0x44d56b[_0xacdc('0x15')](_0x26a380)[_0xacdc('0x16')]();};}function respondWithResult(_0x23731c,_0x39407d){_0x39407d=_0x39407d||0xc8;return function(_0x3b2a50){if(_0x3b2a50){return _0x23731c[_0xacdc('0x15')](_0x39407d)['json'](_0x3b2a50);}};}function respondWithFilteredResult(_0x108061,_0x1956b8){return function(_0x1a714f){if(_0x1a714f){var _0x5f0aa5=typeof _0x1956b8[_0xacdc('0x17')]===_0xacdc('0x18')&&typeof _0x1956b8['limit']===_0xacdc('0x18');var _0x25d4ed=_0x1a714f[_0xacdc('0x19')];var _0x1622a3=_0x5f0aa5?0x0:_0x1956b8[_0xacdc('0x17')];var _0x14cce5=_0x5f0aa5?_0x1a714f[_0xacdc('0x19')]:_0x1956b8['offset']+_0x1956b8[_0xacdc('0x1a')];var _0x251a42;if(_0x14cce5>=_0x25d4ed){_0x14cce5=_0x25d4ed;_0x251a42=0xc8;}else{_0x251a42=0xce;}_0x108061[_0xacdc('0x15')](_0x251a42);return _0x108061[_0xacdc('0x1b')](_0xacdc('0x1c'),_0x1622a3+'-'+_0x14cce5+'/'+_0x25d4ed)[_0xacdc('0x1d')](_0x1a714f);}return null;};}function patchUpdates(_0x5b2d92){return function(_0x4fa29a){try{jsonpatch[_0xacdc('0x1e')](_0x4fa29a,_0x5b2d92,!![]);}catch(_0x269551){return BPromise[_0xacdc('0x1f')](_0x269551);}return _0x4fa29a['save']();};}function saveUpdates(_0x39a370,_0x3bae17){return function(_0x2cc2d8){if(_0x2cc2d8){return _0x2cc2d8[_0xacdc('0x20')](_0x39a370)[_0xacdc('0x21')](function(_0x2232d2){return _0x2232d2;});}return null;};}function removeEntity(_0x26f7bf,_0xeef8f9){return function(_0x1f4891){if(_0x1f4891){return _0x1f4891[_0xacdc('0x22')]()[_0xacdc('0x21')](function(){_0x26f7bf[_0xacdc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dc6cd,_0x1f5013){return function(_0x5d2109){if(!_0x5d2109){_0x2dc6cd[_0xacdc('0x14')](0x194);}return _0x5d2109;};}function handleError(_0x33ac9e,_0x880669){_0x880669=_0x880669||0x1f4;return function(_0xdfea1){logger['error'](_0xdfea1[_0xacdc('0x23')]);if(_0xdfea1[_0xacdc('0x24')]){delete _0xdfea1['name'];}_0x33ac9e[_0xacdc('0x15')](_0x880669)['send'](_0xdfea1);};}exports['index']=function(_0x1a33d8,_0x528b55){var _0x5118cf={},_0x4c471a={},_0x229b3c={'count':0x0,'rows':[]};var _0x4b738d=_[_0xacdc('0x25')](db['MailSubstatus'][_0xacdc('0x26')],function(_0x3b14bc){return{'name':_0x3b14bc[_0xacdc('0x27')],'type':_0x3b14bc['type']['key']};});_0x4c471a[_0xacdc('0x28')]=_[_0xacdc('0x25')](_0x4b738d,_0xacdc('0x24'));_0x4c471a[_0xacdc('0x29')]=_[_0xacdc('0x2a')](_0x1a33d8[_0xacdc('0x29')]);_0x4c471a['filters']=_['intersection'](_0x4c471a['model'],_0x4c471a[_0xacdc('0x29')]);_0x5118cf[_0xacdc('0x2b')]=_[_0xacdc('0x2c')](_0x4c471a[_0xacdc('0x28')],qs[_0xacdc('0x2d')](_0x1a33d8[_0xacdc('0x29')][_0xacdc('0x2d')]));_0x5118cf[_0xacdc('0x2b')]=_0x5118cf['attributes'][_0xacdc('0x2e')]?_0x5118cf[_0xacdc('0x2b')]:_0x4c471a['model'];if(!_0x1a33d8[_0xacdc('0x29')][_0xacdc('0x2f')](_0xacdc('0x30'))){_0x5118cf['limit']=qs[_0xacdc('0x1a')](_0x1a33d8[_0xacdc('0x29')][_0xacdc('0x1a')]);_0x5118cf[_0xacdc('0x17')]=qs[_0xacdc('0x17')](_0x1a33d8[_0xacdc('0x29')]['offset']);}_0x5118cf[_0xacdc('0x31')]=qs['sort'](_0x1a33d8['query'][_0xacdc('0x32')]);_0x5118cf['where']=qs[_0xacdc('0x33')](_[_0xacdc('0x34')](_0x1a33d8[_0xacdc('0x29')],_0x4c471a[_0xacdc('0x33')]),_0x4b738d);if(_0x1a33d8[_0xacdc('0x29')][_0xacdc('0x35')]){_0x5118cf[_0xacdc('0x36')]=_[_0xacdc('0x37')](_0x5118cf[_0xacdc('0x36')],{'$or':_['map'](_0x4b738d,function(_0x1304ef){if(_0x1304ef[_0xacdc('0x38')]!==_0xacdc('0x39')){var _0xbe998a={};_0xbe998a[_0x1304ef[_0xacdc('0x24')]]={'$like':'%'+_0x1a33d8['query']['filter']+'%'};return _0xbe998a;}})});}_0x5118cf=_['merge']({},_0x5118cf,_0x1a33d8[_0xacdc('0x3a')]);var _0x477842={'where':_0x5118cf[_0xacdc('0x36')]};return db['MailSubstatus'][_0xacdc('0x19')](_0x477842)[_0xacdc('0x21')](function(_0x107927){_0x229b3c[_0xacdc('0x19')]=_0x107927;if(_0x1a33d8['query'][_0xacdc('0x3b')]){_0x5118cf[_0xacdc('0x3c')]=[{'all':!![]}];}return db['MailSubstatus'][_0xacdc('0x3d')](_0x5118cf);})[_0xacdc('0x21')](function(_0x23b5f5){_0x229b3c[_0xacdc('0x3e')]=_0x23b5f5;return _0x229b3c;})['then'](respondWithFilteredResult(_0x528b55,_0x5118cf))[_0xacdc('0x3f')](handleError(_0x528b55,null));};exports[_0xacdc('0x40')]=function(_0x46aa9c,_0x10deab){var _0xa3e5ec={'raw':!![],'where':{'id':_0x46aa9c[_0xacdc('0x41')]['id']}},_0xf733b2={};_0xf733b2['model']=_[_0xacdc('0x2a')](db[_0xacdc('0x42')]['rawAttributes']);_0xf733b2[_0xacdc('0x29')]=_['keys'](_0x46aa9c[_0xacdc('0x29')]);_0xf733b2[_0xacdc('0x33')]=_[_0xacdc('0x2c')](_0xf733b2[_0xacdc('0x28')],_0xf733b2[_0xacdc('0x29')]);_0xa3e5ec[_0xacdc('0x2b')]=_['intersection'](_0xf733b2[_0xacdc('0x28')],qs[_0xacdc('0x2d')](_0x46aa9c[_0xacdc('0x29')][_0xacdc('0x2d')]));_0xa3e5ec[_0xacdc('0x2b')]=_0xa3e5ec[_0xacdc('0x2b')]['length']?_0xa3e5ec[_0xacdc('0x2b')]:_0xf733b2['model'];if(_0x46aa9c['query']['includeAll']){_0xa3e5ec[_0xacdc('0x3c')]=[{'all':!![]}];}_0xa3e5ec=_[_0xacdc('0x37')]({},_0xa3e5ec,_0x46aa9c[_0xacdc('0x3a')]);return db[_0xacdc('0x42')][_0xacdc('0x43')](_0xa3e5ec)[_0xacdc('0x21')](handleEntityNotFound(_0x10deab,null))[_0xacdc('0x21')](respondWithResult(_0x10deab,null))[_0xacdc('0x3f')](handleError(_0x10deab,null));};exports['create']=function(_0x2a9c40,_0x31396e){return db[_0xacdc('0x42')][_0xacdc('0x44')](_0x2a9c40[_0xacdc('0x45')],{})[_0xacdc('0x21')](respondWithResult(_0x31396e,0xc9))[_0xacdc('0x3f')](handleError(_0x31396e,null));};exports['update']=function(_0x4f90f1,_0x2503ad){if(_0x4f90f1['body']['id']){delete _0x4f90f1['body']['id'];}return db[_0xacdc('0x42')][_0xacdc('0x43')]({'where':{'id':_0x4f90f1[_0xacdc('0x41')]['id']}})['then'](handleEntityNotFound(_0x2503ad,null))[_0xacdc('0x21')](saveUpdates(_0x4f90f1[_0xacdc('0x45')],null))['then'](respondWithResult(_0x2503ad,null))[_0xacdc('0x3f')](handleError(_0x2503ad,null));};exports[_0xacdc('0x22')]=function(_0x32f6be,_0x44b132){return db[_0xacdc('0x42')][_0xacdc('0x43')]({'where':{'id':_0x32f6be['params']['id']}})[_0xacdc('0x21')](handleEntityNotFound(_0x44b132,null))['then'](removeEntity(_0x44b132,null))[_0xacdc('0x3f')](handleError(_0x44b132,null));};exports[_0xacdc('0x46')]=function(_0x17cc1f,_0x4277b5){return db[_0xacdc('0x42')][_0xacdc('0x46')]()[_0xacdc('0x21')](respondWithResult(_0x4277b5,null))[_0xacdc('0x3f')](handleError(_0x4277b5,null));}; \ No newline at end of file +var _0xd63f=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','apply','update','then','error','stack','name','MailSubstatus','rawAttributes','fieldName','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x165c4e,_0x16942c){var _0x15e35f=function(_0x459fec){while(--_0x459fec){_0x165c4e['push'](_0x165c4e['shift']());}};_0x15e35f(++_0x16942c);}(_0xd63f,0x1b9));var _0xfd63=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd63f[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xfd63('0x0'));var rimraf=require(_0xfd63('0x1'));var zipdir=require(_0xfd63('0x2'));var jsonpatch=require(_0xfd63('0x3'));var rp=require(_0xfd63('0x4'));var moment=require(_0xfd63('0x5'));var BPromise=require(_0xfd63('0x6'));var Mustache=require('mustache');var util=require(_0xfd63('0x7'));var path=require(_0xfd63('0x8'));var sox=require(_0xfd63('0x9'));var csv=require(_0xfd63('0xa'));var ejs=require(_0xfd63('0xb'));var fs=require('fs');var fs_extra=require(_0xfd63('0xc'));var _=require(_0xfd63('0xd'));var squel=require(_0xfd63('0xe'));var crypto=require('crypto');var jsforce=require(_0xfd63('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfd63('0xa'));var querystring=require(_0xfd63('0x10'));var Papa=require(_0xfd63('0x11'));var Redis=require(_0xfd63('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfd63('0x13'));var as=require(_0xfd63('0x14'));var hardwareService=require(_0xfd63('0x15'));var logger=require('../../config/logger')(_0xfd63('0x16'));var utils=require(_0xfd63('0x17'));var config=require(_0xfd63('0x18'));var licenseUtil=require(_0xfd63('0x19'));var db=require(_0xfd63('0x1a'))['db'];function respondWithStatusCode(_0x4b8d11,_0x5711b1){_0x5711b1=_0x5711b1||0xcc;return function(_0x4eff10){if(_0x4eff10){return _0x4b8d11[_0xfd63('0x1b')](_0x5711b1);}return _0x4b8d11['status'](_0x5711b1)[_0xfd63('0x1c')]();};}function respondWithResult(_0x9a632e,_0x51dcf5){_0x51dcf5=_0x51dcf5||0xc8;return function(_0x220bb6){if(_0x220bb6){return _0x9a632e[_0xfd63('0x1d')](_0x51dcf5)['json'](_0x220bb6);}};}function respondWithFilteredResult(_0x452a27,_0x40ed92){return function(_0x4a039f){if(_0x4a039f){var _0x56342d=typeof _0x40ed92['offset']===_0xfd63('0x1e')&&typeof _0x40ed92[_0xfd63('0x1f')]===_0xfd63('0x1e');var _0x4efd86=_0x4a039f[_0xfd63('0x20')];var _0x473a19=_0x56342d?0x0:_0x40ed92['offset'];var _0x4847a7=_0x56342d?_0x4a039f[_0xfd63('0x20')]:_0x40ed92[_0xfd63('0x21')]+_0x40ed92[_0xfd63('0x1f')];var _0x415484;if(_0x4847a7>=_0x4efd86){_0x4847a7=_0x4efd86;_0x415484=0xc8;}else{_0x415484=0xce;}_0x452a27[_0xfd63('0x1d')](_0x415484);return _0x452a27[_0xfd63('0x22')](_0xfd63('0x23'),_0x473a19+'-'+_0x4847a7+'/'+_0x4efd86)['json'](_0x4a039f);}return null;};}function patchUpdates(_0x1787d2){return function(_0x5dc7f4){try{jsonpatch[_0xfd63('0x24')](_0x5dc7f4,_0x1787d2,!![]);}catch(_0x47b668){return BPromise['reject'](_0x47b668);}return _0x5dc7f4['save']();};}function saveUpdates(_0x32086c,_0x4edc15){return function(_0x1fbb91){if(_0x1fbb91){return _0x1fbb91[_0xfd63('0x25')](_0x32086c)[_0xfd63('0x26')](function(_0x432286){return _0x432286;});}return null;};}function removeEntity(_0x55fb2e,_0x547455){return function(_0x36d5ee){if(_0x36d5ee){return _0x36d5ee['destroy']()[_0xfd63('0x26')](function(){_0x55fb2e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bf65f,_0x22aaf2){return function(_0x2a1330){if(!_0x2a1330){_0x2bf65f[_0xfd63('0x1b')](0x194);}return _0x2a1330;};}function handleError(_0x48a482,_0x18ac5c){_0x18ac5c=_0x18ac5c||0x1f4;return function(_0xee5a41){logger[_0xfd63('0x27')](_0xee5a41[_0xfd63('0x28')]);if(_0xee5a41['name']){delete _0xee5a41[_0xfd63('0x29')];}_0x48a482[_0xfd63('0x1d')](_0x18ac5c)['send'](_0xee5a41);};}exports['index']=function(_0x3ef848,_0x30b79c){var _0x2e98c1={},_0x42ce63={},_0x405bc3={'count':0x0,'rows':[]};var _0x4e63cb=_['map'](db[_0xfd63('0x2a')][_0xfd63('0x2b')],function(_0x471826){return{'name':_0x471826[_0xfd63('0x2c')],'type':_0x471826['type']['key']};});_0x42ce63[_0xfd63('0x2d')]=_[_0xfd63('0x2e')](_0x4e63cb,'name');_0x42ce63[_0xfd63('0x2f')]=_[_0xfd63('0x30')](_0x3ef848[_0xfd63('0x2f')]);_0x42ce63['filters']=_['intersection'](_0x42ce63[_0xfd63('0x2d')],_0x42ce63[_0xfd63('0x2f')]);_0x2e98c1['attributes']=_[_0xfd63('0x31')](_0x42ce63[_0xfd63('0x2d')],qs[_0xfd63('0x32')](_0x3ef848['query'][_0xfd63('0x32')]));_0x2e98c1[_0xfd63('0x33')]=_0x2e98c1[_0xfd63('0x33')][_0xfd63('0x34')]?_0x2e98c1[_0xfd63('0x33')]:_0x42ce63['model'];if(!_0x3ef848[_0xfd63('0x2f')][_0xfd63('0x35')]('nolimit')){_0x2e98c1[_0xfd63('0x1f')]=qs[_0xfd63('0x1f')](_0x3ef848[_0xfd63('0x2f')][_0xfd63('0x1f')]);_0x2e98c1['offset']=qs['offset'](_0x3ef848[_0xfd63('0x2f')][_0xfd63('0x21')]);}_0x2e98c1[_0xfd63('0x36')]=qs[_0xfd63('0x37')](_0x3ef848[_0xfd63('0x2f')][_0xfd63('0x37')]);_0x2e98c1['where']=qs[_0xfd63('0x38')](_[_0xfd63('0x39')](_0x3ef848[_0xfd63('0x2f')],_0x42ce63['filters']),_0x4e63cb);if(_0x3ef848[_0xfd63('0x2f')][_0xfd63('0x3a')]){_0x2e98c1[_0xfd63('0x3b')]=_['merge'](_0x2e98c1[_0xfd63('0x3b')],{'$or':_[_0xfd63('0x2e')](_0x4e63cb,function(_0xf157c1){if(_0xf157c1[_0xfd63('0x3c')]!==_0xfd63('0x3d')){var _0x5609fc={};_0x5609fc[_0xf157c1['name']]={'$like':'%'+_0x3ef848[_0xfd63('0x2f')][_0xfd63('0x3a')]+'%'};return _0x5609fc;}})});}_0x2e98c1=_[_0xfd63('0x3e')]({},_0x2e98c1,_0x3ef848[_0xfd63('0x3f')]);var _0x4a161c={'where':_0x2e98c1[_0xfd63('0x3b')]};return db[_0xfd63('0x2a')][_0xfd63('0x20')](_0x4a161c)['then'](function(_0x100872){_0x405bc3[_0xfd63('0x20')]=_0x100872;if(_0x3ef848[_0xfd63('0x2f')][_0xfd63('0x40')]){_0x2e98c1[_0xfd63('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0xfd63('0x42')](_0x2e98c1);})[_0xfd63('0x26')](function(_0x1465a5){_0x405bc3[_0xfd63('0x43')]=_0x1465a5;return _0x405bc3;})[_0xfd63('0x26')](respondWithFilteredResult(_0x30b79c,_0x2e98c1))[_0xfd63('0x44')](handleError(_0x30b79c,null));};exports[_0xfd63('0x45')]=function(_0x346731,_0x7ea666){var _0x41927d={'raw':!![],'where':{'id':_0x346731[_0xfd63('0x46')]['id']}},_0x1ff80f={};_0x1ff80f['model']=_[_0xfd63('0x30')](db[_0xfd63('0x2a')][_0xfd63('0x2b')]);_0x1ff80f[_0xfd63('0x2f')]=_['keys'](_0x346731['query']);_0x1ff80f[_0xfd63('0x38')]=_[_0xfd63('0x31')](_0x1ff80f[_0xfd63('0x2d')],_0x1ff80f['query']);_0x41927d[_0xfd63('0x33')]=_['intersection'](_0x1ff80f['model'],qs[_0xfd63('0x32')](_0x346731[_0xfd63('0x2f')][_0xfd63('0x32')]));_0x41927d[_0xfd63('0x33')]=_0x41927d[_0xfd63('0x33')][_0xfd63('0x34')]?_0x41927d[_0xfd63('0x33')]:_0x1ff80f['model'];if(_0x346731[_0xfd63('0x2f')][_0xfd63('0x40')]){_0x41927d[_0xfd63('0x41')]=[{'all':!![]}];}_0x41927d=_[_0xfd63('0x3e')]({},_0x41927d,_0x346731[_0xfd63('0x3f')]);return db[_0xfd63('0x2a')][_0xfd63('0x47')](_0x41927d)[_0xfd63('0x26')](handleEntityNotFound(_0x7ea666,null))[_0xfd63('0x26')](respondWithResult(_0x7ea666,null))['catch'](handleError(_0x7ea666,null));};exports[_0xfd63('0x48')]=function(_0x1960aa,_0x495df3){return db[_0xfd63('0x2a')][_0xfd63('0x48')](_0x1960aa[_0xfd63('0x49')],{})['then'](respondWithResult(_0x495df3,0xc9))['catch'](handleError(_0x495df3,null));};exports[_0xfd63('0x25')]=function(_0x58090e,_0x127089){if(_0x58090e[_0xfd63('0x49')]['id']){delete _0x58090e[_0xfd63('0x49')]['id'];}return db[_0xfd63('0x2a')][_0xfd63('0x47')]({'where':{'id':_0x58090e[_0xfd63('0x46')]['id']}})['then'](handleEntityNotFound(_0x127089,null))['then'](saveUpdates(_0x58090e[_0xfd63('0x49')],null))[_0xfd63('0x26')](respondWithResult(_0x127089,null))['catch'](handleError(_0x127089,null));};exports[_0xfd63('0x4a')]=function(_0x55954d,_0x300b85){return db[_0xfd63('0x2a')]['find']({'where':{'id':_0x55954d[_0xfd63('0x46')]['id']}})[_0xfd63('0x26')](handleEntityNotFound(_0x300b85,null))['then'](removeEntity(_0x300b85,null))[_0xfd63('0x44')](handleError(_0x300b85,null));};exports[_0xfd63('0x4b')]=function(_0x466893,_0x72606f){return db[_0xfd63('0x2a')][_0xfd63('0x4b')]()['then'](respondWithResult(_0x72606f,null))[_0xfd63('0x44')](handleError(_0x72606f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 8c55561..1564115 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 _0xf617=['hook','exports','../../mysqldb','MailSubstatus','emit','hasOwnProperty'];(function(_0x6d76e8,_0x3a5b96){var _0x10a933=function(_0xcca43b){while(--_0xcca43b){_0x6d76e8['push'](_0x6d76e8['shift']());}};_0x10a933(++_0x3a5b96);}(_0xf617,0xf8));var _0x7f61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf617[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x7f61('0x0'))['db'][_0x7f61('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x471a94){return function(_0x560d7f,_0x292eca,_0x20f1ba){MailSubstatusEvents[_0x7f61('0x2')](_0x471a94+':'+_0x560d7f['id'],_0x560d7f);MailSubstatusEvents[_0x7f61('0x2')](_0x471a94,_0x560d7f);_0x20f1ba(null);};}for(var e in events){if(events[_0x7f61('0x3')](e)){var event=events[e];MailSubstatus[_0x7f61('0x4')](e,emitEvent(event));}}module[_0x7f61('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x9263=['events','../../mysqldb','MailSubstatus','update','emit','hasOwnProperty','exports'];(function(_0x120302,_0x17034e){var _0xbc2164=function(_0x12d949){while(--_0x12d949){_0x120302['push'](_0x120302['shift']());}};_0xbc2164(++_0x17034e);}(_0x9263,0xf5));var _0x3926=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x9263[_0x4b7b62];return _0x2280df;};'use strict';var EventEmitter=require(_0x3926('0x0'));var MailSubstatus=require(_0x3926('0x1'))['db'][_0x3926('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x3926('0x3')};function emitEvent(_0x5228c9){return function(_0x3ea3c7,_0x32d268,_0x6e8194){MailSubstatusEvents['emit'](_0x5228c9+':'+_0x3ea3c7['id'],_0x3ea3c7);MailSubstatusEvents[_0x3926('0x4')](_0x5228c9,_0x3ea3c7);_0x6e8194(null);};}for(var e in events){if(events[_0x3926('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x3926('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 2c05bd1..eb5ff08 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 _0xa5c5=['Condition','update','name','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses'];(function(_0x28f299,_0xbfcfd7){var _0x33ca7e=function(_0x3c0be7){while(--_0x3c0be7){_0x28f299['push'](_0x28f299['shift']());}};_0x33ca7e(++_0xbfcfd7);}(_0xa5c5,0xba));var _0x5a5c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xa5c5[_0x432682];return _0x463d05;};'use strict';var attributes=require(_0x5a5c('0x0'));module[_0x5a5c('0x1')]=function(_0x374a75){var _0x5bc368=_0x374a75[_0x5a5c('0x2')];return _0x374a75[_0x5a5c('0x3')](_0x5a5c('0x4'),attributes,{'tableName':_0x5a5c('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xdfd17d,_0x54e820,_0x3986ff){return _0x5bc368[_0x5a5c('0x6')][_0x5a5c('0x7')]({'value':_0xdfd17d[_0x5a5c('0x8')]},{'where':{'field':'mailSubstatus','value':_0xdfd17d[_0x5a5c('0x9')][_0x5a5c('0x8')]}})[_0x5a5c('0xa')](function(){_0x3986ff();})[_0x5a5c('0xb')](function(_0x5b061b){_0x3986ff(_0x5b061b);});}}});}; \ No newline at end of file +var _0xedc8=['./mailSubstatus.attributes','exports','models','define','MailSubstatus','update','name','mailSubstatus','_previousDataValues'];(function(_0x1a63e0,_0x48bb75){var _0x12f52e=function(_0x577aac){while(--_0x577aac){_0x1a63e0['push'](_0x1a63e0['shift']());}};_0x12f52e(++_0x48bb75);}(_0xedc8,0x99));var _0x8edc=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xedc8[_0x5f309e];return _0x487b5e;};'use strict';var attributes=require(_0x8edc('0x0'));module[_0x8edc('0x1')]=function(_0x2455e6){var _0x6ed604=_0x2455e6[_0x8edc('0x2')];return _0x2455e6[_0x8edc('0x3')](_0x8edc('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5adbca,_0x262b49,_0x4f3f4d){return _0x6ed604['Condition'][_0x8edc('0x5')]({'value':_0x5adbca[_0x8edc('0x6')]},{'where':{'field':_0x8edc('0x7'),'value':_0x5adbca[_0x8edc('0x8')][_0x8edc('0x6')]}})['then'](function(){_0x4f3f4d();})['catch'](function(_0x56732d){_0x4f3f4d(_0x56732d);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 965f757..0385bda 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 _0x896d=['message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x18a772,_0x1a4d3f){var _0xbaac04=function(_0x467aa6){while(--_0x467aa6){_0x18a772['push'](_0x18a772['shift']());}};_0xbaac04(++_0x1a4d3f);}(_0x896d,0xfe));var _0xd896=function(_0x34b01e,_0x24b49f){_0x34b01e=_0x34b01e-0x0;var _0x5d596c=_0x896d[_0x34b01e];return _0x5d596c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd896('0x0'));var rs=require(_0xd896('0x1'));var fs=require('fs');var Redis=require(_0xd896('0x2'));var db=require(_0xd896('0x3'))['db'];var utils=require(_0xd896('0x4'));var logger=require(_0xd896('0x5'))('rpc');var config=require(_0xd896('0x6'));var jayson=require(_0xd896('0x7'));var client=jayson[_0xd896('0x8')][_0xd896('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49dbdf,_0x1d7510,_0x3555b4){return new BPromise(function(_0x36741a,_0xcae1bc){return client[_0xd896('0xa')](_0x49dbdf,_0x3555b4)[_0xd896('0xb')](function(_0x40729b){logger[_0xd896('0xc')](_0xd896('0xd'),_0x1d7510,_0xd896('0xe'));logger[_0xd896('0xf')](_0xd896('0x10'),_0x1d7510,_0xd896('0xe'),JSON[_0xd896('0x11')](_0x40729b));if(_0x40729b['error']){if(_0x40729b[_0xd896('0x12')]['code']===0x1f4){logger[_0xd896('0x12')](_0xd896('0xd'),_0x1d7510,_0x40729b[_0xd896('0x12')][_0xd896('0x13')]);return _0xcae1bc(_0x40729b[_0xd896('0x12')][_0xd896('0x13')]);}logger[_0xd896('0x12')](_0xd896('0xd'),_0x1d7510,_0x40729b[_0xd896('0x12')][_0xd896('0x13')]);return _0x36741a(_0x40729b[_0xd896('0x12')]['message']);}else{logger[_0xd896('0xc')](_0xd896('0xd'),_0x1d7510,_0xd896('0xe'));_0x36741a(_0x40729b['result']['message']);}})[_0xd896('0x14')](function(_0x24e7a5){logger[_0xd896('0x12')](_0xd896('0xd'),_0x1d7510,_0x24e7a5);_0xcae1bc(_0x24e7a5);});});} \ No newline at end of file +var _0x4f67=['request\x20sent','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4f67,0x1bd));var _0x74f6=function(_0x1e9ae1,_0x10dc5d){_0x1e9ae1=_0x1e9ae1-0x0;var _0xc6bc15=_0x4f67[_0x1e9ae1];return _0xc6bc15;};'use strict';var _=require(_0x74f6('0x0'));var util=require(_0x74f6('0x1'));var moment=require('moment');var BPromise=require(_0x74f6('0x2'));var rs=require(_0x74f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74f6('0x4'))['db'];var utils=require(_0x74f6('0x5'));var logger=require(_0x74f6('0x6'))('rpc');var config=require(_0x74f6('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x74f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29c20c,_0x3efdff,_0x4114db){return new BPromise(function(_0x2f0073,_0x1b7d75){return client[_0x74f6('0x9')](_0x29c20c,_0x4114db)['then'](function(_0x296e22){logger[_0x74f6('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x3efdff,'request\x20sent');logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x3efdff,_0x74f6('0xb'),JSON[_0x74f6('0xc')](_0x296e22));if(_0x296e22['error']){if(_0x296e22[_0x74f6('0xd')][_0x74f6('0xe')]===0x1f4){logger['error'](_0x74f6('0xf'),_0x3efdff,_0x296e22[_0x74f6('0xd')]['message']);return _0x1b7d75(_0x296e22[_0x74f6('0xd')][_0x74f6('0x10')]);}logger[_0x74f6('0xd')](_0x74f6('0xf'),_0x3efdff,_0x296e22[_0x74f6('0xd')][_0x74f6('0x10')]);return _0x2f0073(_0x296e22['error'][_0x74f6('0x10')]);}else{logger[_0x74f6('0xa')](_0x74f6('0xf'),_0x3efdff,_0x74f6('0xb'));_0x2f0073(_0x296e22[_0x74f6('0x11')]['message']);}})[_0x74f6('0x12')](function(_0x42bd2c){logger[_0x74f6('0xd')](_0x74f6('0xf'),_0x3efdff,_0x42bd2c);_0x1b7d75(_0x42bd2c);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f8d18f7..a3aa396 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 _0xed3f=['delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/:id','post','create','put','update'];(function(_0x59bd3b,_0x53eff9){var _0x586c53=function(_0xee0b0b){while(--_0xee0b0b){_0x59bd3b['push'](_0x59bd3b['shift']());}};_0x586c53(++_0x53eff9);}(_0xed3f,0x122));var _0xfed3=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0xed3f[_0x16aaef];return _0x1c82ef;};'use strict';var multer=require(_0xfed3('0x0'));var util=require(_0xfed3('0x1'));var path=require(_0xfed3('0x2'));var timeout=require('connect-timeout');var express=require(_0xfed3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfed3('0x4'));var interaction=require(_0xfed3('0x5'));var config=require(_0xfed3('0x6'));var controller=require(_0xfed3('0x7'));router['get']('/',auth[_0xfed3('0x8')](),controller[_0xfed3('0x9')]);router[_0xfed3('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xfed3('0xa')](_0xfed3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xfed3('0xc')]('/',auth['isAuthenticated'](),controller[_0xfed3('0xd')]);router[_0xfed3('0xe')](_0xfed3('0xb'),auth['isAuthenticated'](),controller[_0xfed3('0xf')]);router[_0xfed3('0x10')]('/:id',auth[_0xfed3('0x8')](),controller['destroy']);module[_0xfed3('0x11')]=router; \ No newline at end of file +var _0xdd56=['./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment'];(function(_0x19eddf,_0x3b50cf){var _0x1c10f6=function(_0x171010){while(--_0x171010){_0x19eddf['push'](_0x19eddf['shift']());}};_0x1c10f6(++_0x3b50cf);}(_0xdd56,0xea));var _0x6dd5=function(_0x567126,_0x103b95){_0x567126=_0x567126-0x0;var _0x38ac5b=_0xdd56[_0x567126];return _0x38ac5b;};'use strict';var multer=require(_0x6dd5('0x0'));var util=require(_0x6dd5('0x1'));var path=require(_0x6dd5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6dd5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6dd5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6dd5('0x5'));var controller=require(_0x6dd5('0x6'));router['get']('/',auth[_0x6dd5('0x7')](),controller[_0x6dd5('0x8')]);router[_0x6dd5('0x9')](_0x6dd5('0xa'),auth[_0x6dd5('0x7')](),controller[_0x6dd5('0xb')]);router[_0x6dd5('0x9')](_0x6dd5('0xc'),auth[_0x6dd5('0x7')](),controller[_0x6dd5('0xd')]);router[_0x6dd5('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6dd5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6dd5('0x10')]);router[_0x6dd5('0x11')](_0x6dd5('0xc'),auth[_0x6dd5('0x7')](),controller[_0x6dd5('0x12')]);module[_0x6dd5('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index cc20e5c..f31019f 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x4dd1b3,_0x4ec057){var _0x3495af=function(_0x1db9da){while(--_0x1db9da){_0x4dd1b3['push'](_0x4dd1b3['shift']());}};_0x3495af(++_0x4ec057);}(_0x4b84,0x1cc));var _0x44b8=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0x4b84[_0x378b4];return _0x11d07b;};'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 +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x48475b,_0x4d3077){var _0x3b241a=function(_0x5c4a49){while(--_0x5c4a49){_0x48475b['push'](_0x48475b['shift']());}};_0x3b241a(++_0x4d3077);}(_0x008c,0x188));var _0xc008=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0x008c[_0x124f88];return _0xed0e3b;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 631203f..fc805ac 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 _0x1f1e=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','name','send','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','catch','show','keys','length','create','body','find','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1ed8cb,_0x2f0e7b){var _0x2dbcf5=function(_0x1e194c){while(--_0x1e194c){_0x1ed8cb['push'](_0x1ed8cb['shift']());}};_0x2dbcf5(++_0x2f0e7b);}(_0x1f1e,0x11a));var _0xe1f1=function(_0x28ab92,_0x51f71c){_0x28ab92=_0x28ab92-0x0;var _0x5171f6=_0x1f1e[_0x28ab92];return _0x5171f6;};'use strict';var emlformat=require(_0xe1f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe1f1('0x1'));var rp=require(_0xe1f1('0x2'));var moment=require(_0xe1f1('0x3'));var BPromise=require(_0xe1f1('0x4'));var Mustache=require(_0xe1f1('0x5'));var util=require(_0xe1f1('0x6'));var path=require(_0xe1f1('0x7'));var sox=require(_0xe1f1('0x8'));var csv=require(_0xe1f1('0x9'));var ejs=require(_0xe1f1('0xa'));var fs=require('fs');var fs_extra=require(_0xe1f1('0xb'));var _=require(_0xe1f1('0xc'));var squel=require(_0xe1f1('0xd'));var crypto=require('crypto');var jsforce=require(_0xe1f1('0xe'));var deskjs=require(_0xe1f1('0xf'));var toCsv=require(_0xe1f1('0x9'));var querystring=require(_0xe1f1('0x10'));var Papa=require('papaparse');var Redis=require(_0xe1f1('0x11'));var authService=require(_0xe1f1('0x12'));var qs=require(_0xe1f1('0x13'));var as=require(_0xe1f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1f1('0x15'))(_0xe1f1('0x16'));var utils=require('../../config/utils');var config=require(_0xe1f1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe1f1('0x18'))['db'];function respondWithStatusCode(_0x45d886,_0x4699aa){_0x4699aa=_0x4699aa||0xcc;return function(_0x2b0d43){if(_0x2b0d43){return _0x45d886['sendStatus'](_0x4699aa);}return _0x45d886['status'](_0x4699aa)[_0xe1f1('0x19')]();};}function respondWithResult(_0x3c4cce,_0x572177){_0x572177=_0x572177||0xc8;return function(_0x26f56f){if(_0x26f56f){return _0x3c4cce[_0xe1f1('0x1a')](_0x572177)[_0xe1f1('0x1b')](_0x26f56f);}};}function respondWithFilteredResult(_0x4a6879,_0x1de93a){return function(_0xd1b753){if(_0xd1b753){var _0x4215a0=typeof _0x1de93a['offset']===_0xe1f1('0x1c')&&typeof _0x1de93a[_0xe1f1('0x1d')]==='undefined';var _0x356b7f=_0xd1b753[_0xe1f1('0x1e')];var _0x3f14f1=_0x4215a0?0x0:_0x1de93a[_0xe1f1('0x1f')];var _0x3d05dc=_0x4215a0?_0xd1b753[_0xe1f1('0x1e')]:_0x1de93a[_0xe1f1('0x1f')]+_0x1de93a['limit'];var _0x2de768;if(_0x3d05dc>=_0x356b7f){_0x3d05dc=_0x356b7f;_0x2de768=0xc8;}else{_0x2de768=0xce;}_0x4a6879['status'](_0x2de768);return _0x4a6879['set'](_0xe1f1('0x20'),_0x3f14f1+'-'+_0x3d05dc+'/'+_0x356b7f)[_0xe1f1('0x1b')](_0xd1b753);}return null;};}function patchUpdates(_0x533744){return function(_0x5e25e6){try{jsonpatch[_0xe1f1('0x21')](_0x5e25e6,_0x533744,!![]);}catch(_0x1fdec7){return BPromise[_0xe1f1('0x22')](_0x1fdec7);}return _0x5e25e6['save']();};}function saveUpdates(_0xe8c798,_0x589424){return function(_0xc9787d){if(_0xc9787d){return _0xc9787d[_0xe1f1('0x23')](_0xe8c798)[_0xe1f1('0x24')](function(_0x1471b0){return _0x1471b0;});}return null;};}function removeEntity(_0xc05a7e,_0x407e05){return function(_0x594635){if(_0x594635){return _0x594635[_0xe1f1('0x25')]()[_0xe1f1('0x24')](function(){_0xc05a7e[_0xe1f1('0x1a')](0xcc)[_0xe1f1('0x19')]();});}};}function handleEntityNotFound(_0x24b68f,_0x33a2b7){return function(_0x43875f){if(!_0x43875f){_0x24b68f['sendStatus'](0x194);}return _0x43875f;};}function handleError(_0x4477a9,_0x287861){_0x287861=_0x287861||0x1f4;return function(_0x3db23b){logger[_0xe1f1('0x26')](_0x3db23b['stack']);if(_0x3db23b[_0xe1f1('0x27')]){delete _0x3db23b[_0xe1f1('0x27')];}_0x4477a9[_0xe1f1('0x1a')](_0x287861)[_0xe1f1('0x28')](_0x3db23b);};}exports[_0xe1f1('0x29')]=function(_0x2c8ade,_0x90268b){var _0x128b30={},_0x179e12={},_0xd74956={'count':0x0,'rows':[]};var _0x73565c=_['map'](db[_0xe1f1('0x2a')][_0xe1f1('0x2b')],function(_0x4541ed){return{'name':_0x4541ed[_0xe1f1('0x2c')],'type':_0x4541ed[_0xe1f1('0x2d')][_0xe1f1('0x2e')]};});_0x179e12[_0xe1f1('0x2f')]=_[_0xe1f1('0x30')](_0x73565c,_0xe1f1('0x27'));_0x179e12[_0xe1f1('0x31')]=_['keys'](_0x2c8ade[_0xe1f1('0x31')]);_0x179e12[_0xe1f1('0x32')]=_[_0xe1f1('0x33')](_0x179e12[_0xe1f1('0x2f')],_0x179e12[_0xe1f1('0x31')]);_0x128b30[_0xe1f1('0x34')]=_[_0xe1f1('0x33')](_0x179e12[_0xe1f1('0x2f')],qs['fields'](_0x2c8ade[_0xe1f1('0x31')][_0xe1f1('0x35')]));_0x128b30['attributes']=_0x128b30[_0xe1f1('0x34')]['length']?_0x128b30[_0xe1f1('0x34')]:_0x179e12[_0xe1f1('0x2f')];if(!_0x2c8ade[_0xe1f1('0x31')][_0xe1f1('0x36')](_0xe1f1('0x37'))){_0x128b30[_0xe1f1('0x1d')]=qs['limit'](_0x2c8ade[_0xe1f1('0x31')][_0xe1f1('0x1d')]);_0x128b30['offset']=qs['offset'](_0x2c8ade[_0xe1f1('0x31')]['offset']);}_0x128b30[_0xe1f1('0x38')]=qs['sort'](_0x2c8ade[_0xe1f1('0x31')][_0xe1f1('0x39')]);_0x128b30[_0xe1f1('0x3a')]=qs[_0xe1f1('0x32')](_['pick'](_0x2c8ade[_0xe1f1('0x31')],_0x179e12[_0xe1f1('0x32')]),_0x73565c);if(_0x2c8ade['query']['filter']){_0x128b30[_0xe1f1('0x3a')]=_[_0xe1f1('0x3b')](_0x128b30[_0xe1f1('0x3a')],{'$or':_[_0xe1f1('0x30')](_0x73565c,function(_0x120610){if(_0x120610[_0xe1f1('0x2d')]!==_0xe1f1('0x3c')){var _0x339386={};_0x339386[_0x120610[_0xe1f1('0x27')]]={'$like':'%'+_0x2c8ade[_0xe1f1('0x31')][_0xe1f1('0x3d')]+'%'};return _0x339386;}})});}_0x128b30=_[_0xe1f1('0x3b')]({},_0x128b30,_0x2c8ade[_0xe1f1('0x3e')]);var _0x3d2958={'where':_0x128b30[_0xe1f1('0x3a')]};return db[_0xe1f1('0x2a')][_0xe1f1('0x1e')](_0x3d2958)[_0xe1f1('0x24')](function(_0x4b9371){_0xd74956[_0xe1f1('0x1e')]=_0x4b9371;if(_0x2c8ade[_0xe1f1('0x31')][_0xe1f1('0x3f')]){_0x128b30[_0xe1f1('0x40')]=[{'all':!![]}];}return db[_0xe1f1('0x2a')]['findAll'](_0x128b30);})['then'](function(_0x5b46d4){_0xd74956['rows']=_0x5b46d4;return _0xd74956;})['then'](respondWithFilteredResult(_0x90268b,_0x128b30))[_0xe1f1('0x41')](handleError(_0x90268b,null));};exports[_0xe1f1('0x42')]=function(_0x4b59cb,_0x5ed202){var _0x2e1b86={'raw':!![],'where':{'id':_0x4b59cb['params']['id']}},_0x1e3939={};_0x1e3939['model']=_[_0xe1f1('0x43')](db['MailTransferReport'][_0xe1f1('0x2b')]);_0x1e3939[_0xe1f1('0x31')]=_['keys'](_0x4b59cb[_0xe1f1('0x31')]);_0x1e3939['filters']=_[_0xe1f1('0x33')](_0x1e3939[_0xe1f1('0x2f')],_0x1e3939[_0xe1f1('0x31')]);_0x2e1b86['attributes']=_[_0xe1f1('0x33')](_0x1e3939['model'],qs[_0xe1f1('0x35')](_0x4b59cb['query'][_0xe1f1('0x35')]));_0x2e1b86[_0xe1f1('0x34')]=_0x2e1b86[_0xe1f1('0x34')][_0xe1f1('0x44')]?_0x2e1b86['attributes']:_0x1e3939[_0xe1f1('0x2f')];if(_0x4b59cb['query'][_0xe1f1('0x3f')]){_0x2e1b86[_0xe1f1('0x40')]=[{'all':!![]}];}_0x2e1b86=_[_0xe1f1('0x3b')]({},_0x2e1b86,_0x4b59cb[_0xe1f1('0x3e')]);return db['MailTransferReport']['find'](_0x2e1b86)['then'](handleEntityNotFound(_0x5ed202,null))['then'](respondWithResult(_0x5ed202,null))[_0xe1f1('0x41')](handleError(_0x5ed202,null));};exports[_0xe1f1('0x45')]=function(_0x2d0601,_0x7de102){return db[_0xe1f1('0x2a')]['create'](_0x2d0601['body'],{})[_0xe1f1('0x24')](respondWithResult(_0x7de102,0xc9))[_0xe1f1('0x41')](handleError(_0x7de102,null));};exports['update']=function(_0x17f2b0,_0x2d6a4d){if(_0x17f2b0[_0xe1f1('0x46')]['id']){delete _0x17f2b0[_0xe1f1('0x46')]['id'];}return db['MailTransferReport'][_0xe1f1('0x47')]({'where':{'id':_0x17f2b0[_0xe1f1('0x48')]['id']}})[_0xe1f1('0x24')](handleEntityNotFound(_0x2d6a4d,null))[_0xe1f1('0x24')](saveUpdates(_0x17f2b0[_0xe1f1('0x46')],null))[_0xe1f1('0x24')](respondWithResult(_0x2d6a4d,null))[_0xe1f1('0x41')](handleError(_0x2d6a4d,null));};exports[_0xe1f1('0x25')]=function(_0x47d2f6,_0x15b493){return db[_0xe1f1('0x2a')][_0xe1f1('0x47')]({'where':{'id':_0x47d2f6[_0xe1f1('0x48')]['id']}})[_0xe1f1('0x24')](handleEntityNotFound(_0x15b493,null))[_0xe1f1('0x24')](removeEntity(_0x15b493,null))['catch'](handleError(_0x15b493,null));};exports[_0xe1f1('0x49')]=function(_0x5d927f,_0x3eacf9){return db['MailTransferReport'][_0xe1f1('0x49')]()[_0xe1f1('0x24')](respondWithResult(_0x3eacf9,null))[_0xe1f1('0x41')](handleError(_0x3eacf9,null));}; \ No newline at end of file +var _0xe671=['findAll','catch','show','params','keys','include','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','MailTransferReport','then','includeAll'];(function(_0x1cbd33,_0x2d695f){var _0x2262a3=function(_0x4bc8ad){while(--_0x4bc8ad){_0x1cbd33['push'](_0x1cbd33['shift']());}};_0x2262a3(++_0x2d695f);}(_0xe671,0xe0));var _0x1e67=function(_0x470718,_0x3fa24c){_0x470718=_0x470718-0x0;var _0x5e2d5f=_0xe671[_0x470718];return _0x5e2d5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e67('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e67('0x1'));var rp=require(_0x1e67('0x2'));var moment=require(_0x1e67('0x3'));var BPromise=require(_0x1e67('0x4'));var Mustache=require('mustache');var util=require(_0x1e67('0x5'));var path=require('path');var sox=require(_0x1e67('0x6'));var csv=require(_0x1e67('0x7'));var ejs=require(_0x1e67('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1e67('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e67('0x7'));var querystring=require(_0x1e67('0xa'));var Papa=require('papaparse');var Redis=require(_0x1e67('0xb'));var authService=require(_0x1e67('0xc'));var qs=require(_0x1e67('0xd'));var as=require(_0x1e67('0xe'));var hardwareService=require(_0x1e67('0xf'));var logger=require(_0x1e67('0x10'))('api');var utils=require(_0x1e67('0x11'));var config=require(_0x1e67('0x12'));var licenseUtil=require(_0x1e67('0x13'));var db=require(_0x1e67('0x14'))['db'];function respondWithStatusCode(_0x64792e,_0x779cd7){_0x779cd7=_0x779cd7||0xcc;return function(_0x3ea57b){if(_0x3ea57b){return _0x64792e['sendStatus'](_0x779cd7);}return _0x64792e[_0x1e67('0x15')](_0x779cd7)[_0x1e67('0x16')]();};}function respondWithResult(_0x3708cb,_0x16ca3d){_0x16ca3d=_0x16ca3d||0xc8;return function(_0xe3bf9d){if(_0xe3bf9d){return _0x3708cb['status'](_0x16ca3d)[_0x1e67('0x17')](_0xe3bf9d);}};}function respondWithFilteredResult(_0x2196e9,_0xe52003){return function(_0x2a10d9){if(_0x2a10d9){var _0xb274f9=typeof _0xe52003[_0x1e67('0x18')]===_0x1e67('0x19')&&typeof _0xe52003['limit']==='undefined';var _0x49208e=_0x2a10d9[_0x1e67('0x1a')];var _0x55195c=_0xb274f9?0x0:_0xe52003[_0x1e67('0x18')];var _0x1a6f56=_0xb274f9?_0x2a10d9[_0x1e67('0x1a')]:_0xe52003[_0x1e67('0x18')]+_0xe52003[_0x1e67('0x1b')];var _0x2c7085;if(_0x1a6f56>=_0x49208e){_0x1a6f56=_0x49208e;_0x2c7085=0xc8;}else{_0x2c7085=0xce;}_0x2196e9['status'](_0x2c7085);return _0x2196e9['set'](_0x1e67('0x1c'),_0x55195c+'-'+_0x1a6f56+'/'+_0x49208e)[_0x1e67('0x17')](_0x2a10d9);}return null;};}function patchUpdates(_0x855ae7){return function(_0x2a5ce6){try{jsonpatch[_0x1e67('0x1d')](_0x2a5ce6,_0x855ae7,!![]);}catch(_0x910bae){return BPromise[_0x1e67('0x1e')](_0x910bae);}return _0x2a5ce6[_0x1e67('0x1f')]();};}function saveUpdates(_0x25ad35,_0x58fa09){return function(_0x2f3254){if(_0x2f3254){return _0x2f3254[_0x1e67('0x20')](_0x25ad35)['then'](function(_0x4d0a00){return _0x4d0a00;});}return null;};}function removeEntity(_0x26c11d,_0x16487c){return function(_0x3a1179){if(_0x3a1179){return _0x3a1179['destroy']()['then'](function(){_0x26c11d[_0x1e67('0x15')](0xcc)[_0x1e67('0x16')]();});}};}function handleEntityNotFound(_0x4347cd,_0x526236){return function(_0x2833dc){if(!_0x2833dc){_0x4347cd['sendStatus'](0x194);}return _0x2833dc;};}function handleError(_0x3a773f,_0x1eca11){_0x1eca11=_0x1eca11||0x1f4;return function(_0x3a9daf){logger[_0x1e67('0x21')](_0x3a9daf[_0x1e67('0x22')]);if(_0x3a9daf[_0x1e67('0x23')]){delete _0x3a9daf['name'];}_0x3a773f['status'](_0x1eca11)[_0x1e67('0x24')](_0x3a9daf);};}exports[_0x1e67('0x25')]=function(_0x589ed0,_0x1f7136){var _0x49b32c={},_0x3b705a={},_0x57e810={'count':0x0,'rows':[]};var _0x31cb7a=_[_0x1e67('0x26')](db['MailTransferReport'][_0x1e67('0x27')],function(_0xccadf7){return{'name':_0xccadf7['fieldName'],'type':_0xccadf7['type'][_0x1e67('0x28')]};});_0x3b705a[_0x1e67('0x29')]=_[_0x1e67('0x26')](_0x31cb7a,_0x1e67('0x23'));_0x3b705a[_0x1e67('0x2a')]=_['keys'](_0x589ed0[_0x1e67('0x2a')]);_0x3b705a[_0x1e67('0x2b')]=_[_0x1e67('0x2c')](_0x3b705a['model'],_0x3b705a['query']);_0x49b32c[_0x1e67('0x2d')]=_['intersection'](_0x3b705a[_0x1e67('0x29')],qs[_0x1e67('0x2e')](_0x589ed0[_0x1e67('0x2a')][_0x1e67('0x2e')]));_0x49b32c[_0x1e67('0x2d')]=_0x49b32c['attributes'][_0x1e67('0x2f')]?_0x49b32c['attributes']:_0x3b705a[_0x1e67('0x29')];if(!_0x589ed0[_0x1e67('0x2a')]['hasOwnProperty'](_0x1e67('0x30'))){_0x49b32c[_0x1e67('0x1b')]=qs[_0x1e67('0x1b')](_0x589ed0[_0x1e67('0x2a')][_0x1e67('0x1b')]);_0x49b32c[_0x1e67('0x18')]=qs[_0x1e67('0x18')](_0x589ed0[_0x1e67('0x2a')][_0x1e67('0x18')]);}_0x49b32c[_0x1e67('0x31')]=qs[_0x1e67('0x32')](_0x589ed0[_0x1e67('0x2a')][_0x1e67('0x32')]);_0x49b32c[_0x1e67('0x33')]=qs[_0x1e67('0x2b')](_[_0x1e67('0x34')](_0x589ed0['query'],_0x3b705a[_0x1e67('0x2b')]),_0x31cb7a);if(_0x589ed0['query']['filter']){_0x49b32c[_0x1e67('0x33')]=_[_0x1e67('0x35')](_0x49b32c[_0x1e67('0x33')],{'$or':_['map'](_0x31cb7a,function(_0x56687a){if(_0x56687a[_0x1e67('0x36')]!==_0x1e67('0x37')){var _0x54af7c={};_0x54af7c[_0x56687a[_0x1e67('0x23')]]={'$like':'%'+_0x589ed0[_0x1e67('0x2a')][_0x1e67('0x38')]+'%'};return _0x54af7c;}})});}_0x49b32c=_[_0x1e67('0x35')]({},_0x49b32c,_0x589ed0['options']);var _0x275c0d={'where':_0x49b32c[_0x1e67('0x33')]};return db[_0x1e67('0x39')][_0x1e67('0x1a')](_0x275c0d)[_0x1e67('0x3a')](function(_0x3b2178){_0x57e810['count']=_0x3b2178;if(_0x589ed0[_0x1e67('0x2a')][_0x1e67('0x3b')]){_0x49b32c['include']=[{'all':!![]}];}return db[_0x1e67('0x39')][_0x1e67('0x3c')](_0x49b32c);})[_0x1e67('0x3a')](function(_0x261996){_0x57e810['rows']=_0x261996;return _0x57e810;})['then'](respondWithFilteredResult(_0x1f7136,_0x49b32c))[_0x1e67('0x3d')](handleError(_0x1f7136,null));};exports[_0x1e67('0x3e')]=function(_0x412142,_0x10dcf8){var _0x575600={'raw':!![],'where':{'id':_0x412142[_0x1e67('0x3f')]['id']}},_0x2f9f6c={};_0x2f9f6c['model']=_[_0x1e67('0x40')](db[_0x1e67('0x39')][_0x1e67('0x27')]);_0x2f9f6c['query']=_[_0x1e67('0x40')](_0x412142[_0x1e67('0x2a')]);_0x2f9f6c[_0x1e67('0x2b')]=_[_0x1e67('0x2c')](_0x2f9f6c[_0x1e67('0x29')],_0x2f9f6c[_0x1e67('0x2a')]);_0x575600[_0x1e67('0x2d')]=_['intersection'](_0x2f9f6c['model'],qs['fields'](_0x412142[_0x1e67('0x2a')][_0x1e67('0x2e')]));_0x575600[_0x1e67('0x2d')]=_0x575600['attributes'][_0x1e67('0x2f')]?_0x575600[_0x1e67('0x2d')]:_0x2f9f6c[_0x1e67('0x29')];if(_0x412142[_0x1e67('0x2a')][_0x1e67('0x3b')]){_0x575600[_0x1e67('0x41')]=[{'all':!![]}];}_0x575600=_[_0x1e67('0x35')]({},_0x575600,_0x412142[_0x1e67('0x42')]);return db['MailTransferReport'][_0x1e67('0x43')](_0x575600)[_0x1e67('0x3a')](handleEntityNotFound(_0x10dcf8,null))[_0x1e67('0x3a')](respondWithResult(_0x10dcf8,null))['catch'](handleError(_0x10dcf8,null));};exports[_0x1e67('0x44')]=function(_0x28fe17,_0x96a083){return db[_0x1e67('0x39')][_0x1e67('0x44')](_0x28fe17[_0x1e67('0x45')],{})[_0x1e67('0x3a')](respondWithResult(_0x96a083,0xc9))[_0x1e67('0x3d')](handleError(_0x96a083,null));};exports[_0x1e67('0x20')]=function(_0x26705e,_0xbdba53){if(_0x26705e[_0x1e67('0x45')]['id']){delete _0x26705e[_0x1e67('0x45')]['id'];}return db[_0x1e67('0x39')]['find']({'where':{'id':_0x26705e[_0x1e67('0x3f')]['id']}})[_0x1e67('0x3a')](handleEntityNotFound(_0xbdba53,null))[_0x1e67('0x3a')](saveUpdates(_0x26705e[_0x1e67('0x45')],null))[_0x1e67('0x3a')](respondWithResult(_0xbdba53,null))[_0x1e67('0x3d')](handleError(_0xbdba53,null));};exports['destroy']=function(_0x8dfc3f,_0x2f2a87){return db[_0x1e67('0x39')][_0x1e67('0x43')]({'where':{'id':_0x8dfc3f[_0x1e67('0x3f')]['id']}})[_0x1e67('0x3a')](handleEntityNotFound(_0x2f2a87,null))[_0x1e67('0x3a')](removeEntity(_0x2f2a87,null))[_0x1e67('0x3d')](handleError(_0x2f2a87,null));};exports[_0x1e67('0x46')]=function(_0x16c78c,_0x40bb1f){return db[_0x1e67('0x39')]['describe']()[_0x1e67('0x3a')](respondWithResult(_0x40bb1f,null))[_0x1e67('0x3d')](handleError(_0x40bb1f,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 5078281..136dba8 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 _0xdc0d=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','bluebird','request-promise','path'];(function(_0x10c921,_0xda4317){var _0x3295e6=function(_0x33b623){while(--_0x33b623){_0x10c921['push'](_0x10c921['shift']());}};_0x3295e6(++_0xda4317);}(_0xdc0d,0x1db));var _0xddc0=function(_0x44bfac,_0x207cce){_0x44bfac=_0x44bfac-0x0;var _0x2463e4=_0xdc0d[_0x44bfac];return _0x2463e4;};'use strict';var _=require(_0xddc0('0x0'));var util=require(_0xddc0('0x1'));var logger=require('../../config/logger')(_0xddc0('0x2'));var moment=require('moment');var BPromise=require(_0xddc0('0x3'));var rp=require(_0xddc0('0x4'));var fs=require('fs');var path=require(_0xddc0('0x5'));var rimraf=require(_0xddc0('0x6'));var config=require(_0xddc0('0x7'));var attributes=require(_0xddc0('0x8'));module[_0xddc0('0x9')]=function(_0x39a8da,_0x20f5a9){return _0x39a8da['define'](_0xddc0('0xa'),attributes,{'tableName':_0xddc0('0xb'),'paranoid':![],'indexes':[{'name':_0xddc0('0xc'),'fields':[_0xddc0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d2=['util','api','moment','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x533daf,_0x19a7bf){var _0x3c161f=function(_0x521824){while(--_0x521824){_0x533daf['push'](_0x533daf['shift']());}};_0x3c161f(++_0x19a7bf);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x30ae52,_0x26f26f){_0x30ae52=_0x30ae52-0x0;var _0x2caf63=_0xd6d2[_0x30ae52];return _0x2caf63;};'use strict';var _=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var logger=require('../../config/logger')(_0x2d6d('0x2'));var moment=require(_0x2d6d('0x3'));var BPromise=require('bluebird');var rp=require(_0x2d6d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d6d('0x5'));var config=require(_0x2d6d('0x6'));var attributes=require(_0x2d6d('0x7'));module['exports']=function(_0xfcdb1d,_0x132361){return _0xfcdb1d[_0x2d6d('0x8')](_0x2d6d('0x9'),attributes,{'tableName':_0x2d6d('0xa'),'paranoid':![],'indexes':[{'name':_0x2d6d('0xb'),'fields':[_0x2d6d('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 c02d899..8c57aca 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 _0x918f=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0x918f,0x9e));var _0xf918=function(_0xef4ef0,_0x3c72f9){_0xef4ef0=_0xef4ef0-0x0;var _0x39b60b=_0x918f[_0xef4ef0];return _0x39b60b;};'use strict';var _=require(_0xf918('0x0'));var util=require(_0xf918('0x1'));var moment=require(_0xf918('0x2'));var BPromise=require(_0xf918('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf918('0x4'))['db'];var utils=require(_0xf918('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf918('0x6'));var jayson=require(_0xf918('0x7'));var client=jayson[_0xf918('0x8')][_0xf918('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dfd08,_0x13e929,_0x5bca11){return new BPromise(function(_0x181e7f,_0x4f18e4){return client[_0xf918('0xa')](_0x2dfd08,_0x5bca11)[_0xf918('0xb')](function(_0x2a0856){logger[_0xf918('0xc')](_0xf918('0xd'),_0x13e929,_0xf918('0xe'));logger[_0xf918('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x13e929,_0xf918('0xe'),JSON[_0xf918('0x10')](_0x2a0856));if(_0x2a0856['error']){if(_0x2a0856[_0xf918('0x11')][_0xf918('0x12')]===0x1f4){logger[_0xf918('0x11')](_0xf918('0xd'),_0x13e929,_0x2a0856[_0xf918('0x11')]['message']);return _0x4f18e4(_0x2a0856[_0xf918('0x11')][_0xf918('0x13')]);}logger[_0xf918('0x11')](_0xf918('0xd'),_0x13e929,_0x2a0856['error'][_0xf918('0x13')]);return _0x181e7f(_0x2a0856[_0xf918('0x11')][_0xf918('0x13')]);}else{logger[_0xf918('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x13e929,'request\x20sent');_0x181e7f(_0x2a0856['result'][_0xf918('0x13')]);}})[_0xf918('0x14')](function(_0x2e83cd){logger[_0xf918('0x11')](_0xf918('0xd'),_0x13e929,_0x2e83cd);_0x4f18e4(_0x2e83cd);});});} \ No newline at end of file +var _0x903b=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x5d411e,_0x4d68fa){var _0x5674d1=function(_0xb73f3e){while(--_0xb73f3e){_0x5d411e['push'](_0x5d411e['shift']());}};_0x5674d1(++_0x4d68fa);}(_0x903b,0x1ca));var _0xb903=function(_0x3768f3,_0x4a40f1){_0x3768f3=_0x3768f3-0x0;var _0x526a13=_0x903b[_0x3768f3];return _0x526a13;};'use strict';var _=require('lodash');var util=require(_0xb903('0x0'));var moment=require(_0xb903('0x1'));var BPromise=require(_0xb903('0x2'));var rs=require(_0xb903('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb903('0x4'))['db'];var utils=require(_0xb903('0x5'));var logger=require(_0xb903('0x6'))(_0xb903('0x7'));var config=require('../../config/environment');var jayson=require(_0xb903('0x8'));var client=jayson[_0xb903('0x9')][_0xb903('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50f52a,_0x2d2978,_0x6c526f){return new BPromise(function(_0x8d855d,_0x4f78ec){return client[_0xb903('0xb')](_0x50f52a,_0x6c526f)[_0xb903('0xc')](function(_0x9b90a4){logger[_0xb903('0xd')](_0xb903('0xe'),_0x2d2978,'request\x20sent');logger[_0xb903('0xf')](_0xb903('0x10'),_0x2d2978,_0xb903('0x11'),JSON['stringify'](_0x9b90a4));if(_0x9b90a4[_0xb903('0x12')]){if(_0x9b90a4[_0xb903('0x12')]['code']===0x1f4){logger[_0xb903('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x2d2978,_0x9b90a4[_0xb903('0x12')][_0xb903('0x13')]);return _0x4f78ec(_0x9b90a4[_0xb903('0x12')][_0xb903('0x13')]);}logger[_0xb903('0x12')](_0xb903('0xe'),_0x2d2978,_0x9b90a4[_0xb903('0x12')]['message']);return _0x8d855d(_0x9b90a4[_0xb903('0x12')][_0xb903('0x13')]);}else{logger[_0xb903('0xd')](_0xb903('0xe'),_0x2d2978,'request\x20sent');_0x8d855d(_0x9b90a4[_0xb903('0x14')]['message']);}})[_0xb903('0x15')](function(_0xda5867){logger[_0xb903('0x12')](_0xb903('0xe'),_0x2d2978,_0xda5867);_0x4f78ec(_0xda5867);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 1f356bb..706f5f6 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 _0x9420=['fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','index','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x10f3cc,_0x44b3bf){var _0x464ba1=function(_0x182f63){while(--_0x182f63){_0x10f3cc['push'](_0x10f3cc['shift']());}};_0x464ba1(++_0x44b3bf);}(_0x9420,0x164));var _0x0942=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x9420[_0x34021d];return _0x16597b;};'use strict';var multer=require(_0x0942('0x0'));var util=require(_0x0942('0x1'));var path=require(_0x0942('0x2'));var timeout=require(_0x0942('0x3'));var express=require('express');var router=express[_0x0942('0x4')]();var fs_extra=require(_0x0942('0x5'));var auth=require(_0x0942('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0942('0x7'));var controller=require(_0x0942('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0942('0x9')]);router[_0x0942('0xa')]('/describe',auth[_0x0942('0xb')](),controller[_0x0942('0xc')]);router[_0x0942('0xa')](_0x0942('0xd'),auth[_0x0942('0xb')](),controller['show']);router[_0x0942('0xe')]('/',auth[_0x0942('0xb')](),controller[_0x0942('0xf')]);router[_0x0942('0x10')](_0x0942('0xd'),auth[_0x0942('0xb')](),controller['update']);router[_0x0942('0x11')](_0x0942('0xd'),auth[_0x0942('0xb')](),controller[_0x0942('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb1af=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb1af,0x146));var _0xfb1a=function(_0x5eccca,_0x511b6d){_0x5eccca=_0x5eccca-0x0;var _0x27140e=_0xb1af[_0x5eccca];return _0x27140e;};'use strict';var multer=require(_0xfb1a('0x0'));var util=require(_0xfb1a('0x1'));var path=require('path');var timeout=require(_0xfb1a('0x2'));var express=require('express');var router=express[_0xfb1a('0x3')]();var fs_extra=require(_0xfb1a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfb1a('0x5'));var config=require(_0xfb1a('0x6'));var controller=require('./memberReport.controller');router[_0xfb1a('0x7')]('/',auth[_0xfb1a('0x8')](),controller[_0xfb1a('0x9')]);router[_0xfb1a('0x7')](_0xfb1a('0xa'),auth['isAuthenticated'](),controller[_0xfb1a('0xb')]);router[_0xfb1a('0x7')](_0xfb1a('0xc'),auth[_0xfb1a('0x8')](),controller['show']);router['post']('/',auth[_0xfb1a('0x8')](),controller[_0xfb1a('0xd')]);router[_0xfb1a('0xe')]('/:id',auth[_0xfb1a('0x8')](),controller[_0xfb1a('0xf')]);router[_0xfb1a('0x10')](_0xfb1a('0xc'),auth[_0xfb1a('0x8')](),controller[_0xfb1a('0x11')]);module[_0xfb1a('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 59b3ff3..747ea54 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 _0x7515=['INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','talk:[start]','talk:[dial\x20string]','talk:[queue]','moment','STRING'];(function(_0x7a84f2,_0x1e1e67){var _0x2822f0=function(_0x5eac00){while(--_0x5eac00){_0x7a84f2['push'](_0x7a84f2['shift']());}};_0x2822f0(++_0x1e1e67);}(_0x7515,0x82));var _0x5751=function(_0x30e9b5,_0x337678){_0x30e9b5=_0x30e9b5-0x0;var _0x3682e6=_0x7515[_0x30e9b5];return _0x3682e6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5751('0x0'));module['exports']={'channel':{'type':Sequelize[_0x5751('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x5751('0x1')]},'type':{'type':Sequelize[_0x5751('0x1')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x5751('0x2')]},'enterAt':{'type':Sequelize[_0x5751('0x3')]},'exitAt':{'type':Sequelize[_0x5751('0x3')],'set':function(_0x118b33){var _0x4d9476=moment(_0x118b33);var _0x158b1d=moment(this[_0x5751('0x4')](_0x5751('0x5')));var _0x37e673=_0x4d9476['diff'](_0x158b1d,_0x5751('0x6'));this[_0x5751('0x7')](_0x5751('0x8'),_0x118b33);this['setDataValue']('duration',_0x37e673>=0x0?_0x37e673:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x5751('0x1')],'comment':_0x5751('0x9')},'data3':{'type':Sequelize[_0x5751('0x1')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x5751('0x1')],'comment':_0x5751('0xa')},'data5':{'type':Sequelize[_0x5751('0x1')],'comment':_0x5751('0xb')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x5751('0x2')]},'uniqueid':{'type':Sequelize[_0x5751('0x1')]}}; \ No newline at end of file +var _0x2def=['INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration','talk:[destination]','talk:[dial\x20string]','talk:[queue]'];(function(_0x22e34e,_0x598a1d){var _0x411e59=function(_0x63f722){while(--_0x63f722){_0x22e34e['push'](_0x22e34e['shift']());}};_0x411e59(++_0x598a1d);}(_0x2def,0xde));var _0xf2de=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x2def[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xf2de('0x0'));var moment=require(_0xf2de('0x1'));module[_0xf2de('0x2')]={'channel':{'type':Sequelize[_0xf2de('0x3')]},'membername':{'type':Sequelize[_0xf2de('0x3')]},'interface':{'type':Sequelize[_0xf2de('0x3')]},'type':{'type':Sequelize[_0xf2de('0x3')],'defaultValue':_0xf2de('0x4'),'comment':_0xf2de('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xf2de('0x6')]},'exitAt':{'type':Sequelize[_0xf2de('0x6')],'set':function(_0x58d861){var _0x2ead4c=moment(_0x58d861);var _0x50d991=moment(this[_0xf2de('0x7')]('enterAt'));var _0x337a24=_0x2ead4c[_0xf2de('0x8')](_0x50d991,_0xf2de('0x9'));this[_0xf2de('0xa')](_0xf2de('0xb'),_0x58d861);this[_0xf2de('0xa')](_0xf2de('0xc'),_0x337a24>=0x0?_0x337a24:null);}},'data1':{'type':Sequelize[_0xf2de('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xf2de('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xf2de('0x3')],'comment':_0xf2de('0xd')},'data4':{'type':Sequelize[_0xf2de('0x3')],'comment':_0xf2de('0xe')},'data5':{'type':Sequelize[_0xf2de('0x3')],'comment':_0xf2de('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xf2de('0x10')]},'uniqueid':{'type':Sequelize[_0xf2de('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 8bdb555..c7c4d35 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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xedd9,0xfc));var _0x9edd=function(_0x251de2,_0x2b092f){_0x251de2=_0x251de2-0x0;var _0x13108f=_0xedd9[_0x251de2];return _0x13108f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x186680,_0x4ba94c){var _0x49606a=function(_0x2bfd17){while(--_0x2bfd17){_0x186680['push'](_0x186680['shift']());}};_0x49606a(++_0x4ba94c);}(_0x7217,0x19e));var _0x7721=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x7217[_0x4ea69d];return _0x5318e0;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 778f647..dc0e874 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 _0xb012=['moment','bluebird','request-promise','path','rimraf','exports','define','MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger','api'];(function(_0x32b307,_0x4485f8){var _0x5ead1c=function(_0x139461){while(--_0x139461){_0x32b307['push'](_0x32b307['shift']());}};_0x5ead1c(++_0x4485f8);}(_0xb012,0x92));var _0x2b01=function(_0xa9f4f7,_0x3d207a){_0xa9f4f7=_0xa9f4f7-0x0;var _0x3d0859=_0xb012[_0xa9f4f7];return _0x3d0859;};'use strict';var _=require(_0x2b01('0x0'));var util=require(_0x2b01('0x1'));var logger=require(_0x2b01('0x2'))(_0x2b01('0x3'));var moment=require(_0x2b01('0x4'));var BPromise=require(_0x2b01('0x5'));var rp=require(_0x2b01('0x6'));var fs=require('fs');var path=require(_0x2b01('0x7'));var rimraf=require(_0x2b01('0x8'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x2b01('0x9')]=function(_0x377d01,_0x18810e){return _0x377d01[_0x2b01('0xa')](_0x2b01('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x2b01('0xc'),'fields':[_0x2b01('0xd'),_0x2b01('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x23d5=['membername_interface','interface','../../config/logger','api','request-promise','rimraf','../../config/environment','./memberReport.attributes','report_member'];(function(_0x4f3c9b,_0x28e078){var _0x84e58a=function(_0x37bf49){while(--_0x37bf49){_0x4f3c9b['push'](_0x4f3c9b['shift']());}};_0x84e58a(++_0x28e078);}(_0x23d5,0xd1));var _0x523d=function(_0x47980d,_0x5383b6){_0x47980d=_0x47980d-0x0;var _0x421d10=_0x23d5[_0x47980d];return _0x421d10;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x523d('0x0'))(_0x523d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x523d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x523d('0x3'));var config=require(_0x523d('0x4'));var attributes=require(_0x523d('0x5'));module['exports']=function(_0x182956,_0x3ab2ef){return _0x182956['define']('MemberReport',attributes,{'tableName':_0x523d('0x6'),'paranoid':![],'indexes':[{'name':_0x523d('0x7'),'fields':['membername',_0x523d('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 60fc8e9..246838a 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 _0x282a=['findAll','options','raw','where','attributes','limit','include','map','model','CreateMemberReport','create','body','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport'];(function(_0xfff1d6,_0x212dd5){var _0x3fbc33=function(_0x34cc94){while(--_0x34cc94){_0xfff1d6['push'](_0xfff1d6['shift']());}};_0x3fbc33(++_0x212dd5);}(_0x282a,0xa2));var _0xa282=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x282a[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0xa282('0x0'));var moment=require(_0xa282('0x1'));var BPromise=require(_0xa282('0x2'));var rs=require(_0xa282('0x3'));var fs=require('fs');var Redis=require(_0xa282('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa282('0x5'));var logger=require(_0xa282('0x6'))('rpc');var config=require(_0xa282('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa282('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a2c3d,_0x1e6765,_0x1d1e7a){return new BPromise(function(_0x5e41ef,_0x4ff77f){return client['request'](_0x1a2c3d,_0x1d1e7a)[_0xa282('0x9')](function(_0x3f704c){logger[_0xa282('0xa')](_0xa282('0xb'),_0x1e6765,_0xa282('0xc'));logger[_0xa282('0xd')](_0xa282('0xe'),_0x1e6765,_0xa282('0xc'),JSON[_0xa282('0xf')](_0x3f704c));if(_0x3f704c[_0xa282('0x10')]){if(_0x3f704c[_0xa282('0x10')][_0xa282('0x11')]===0x1f4){logger[_0xa282('0x10')](_0xa282('0xb'),_0x1e6765,_0x3f704c[_0xa282('0x10')][_0xa282('0x12')]);return _0x4ff77f(_0x3f704c[_0xa282('0x10')][_0xa282('0x12')]);}logger['error'](_0xa282('0xb'),_0x1e6765,_0x3f704c[_0xa282('0x10')][_0xa282('0x12')]);return _0x5e41ef(_0x3f704c[_0xa282('0x10')][_0xa282('0x12')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x1e6765,_0xa282('0xc'));_0x5e41ef(_0x3f704c[_0xa282('0x13')][_0xa282('0x12')]);}})[_0xa282('0x14')](function(_0x1b4c2d){logger['error']('MemberReport,\x20%s,\x20%s',_0x1e6765,_0x1b4c2d);_0x4ff77f(_0x1b4c2d);});});}exports[_0xa282('0x15')]=function(_0x19aef2){var _0x2d951c=this;return new Promise(function(_0x3280b7,_0x101897){return db[_0xa282('0x16')][_0xa282('0x17')]({'raw':_0x19aef2[_0xa282('0x18')]?_0x19aef2[_0xa282('0x18')][_0xa282('0x19')]===undefined?!![]:![]:!![],'where':_0x19aef2['options']?_0x19aef2[_0xa282('0x18')][_0xa282('0x1a')]||null:null,'attributes':_0x19aef2['options']?_0x19aef2[_0xa282('0x18')][_0xa282('0x1b')]||null:null,'limit':_0x19aef2[_0xa282('0x18')]?_0x19aef2[_0xa282('0x18')][_0xa282('0x1c')]||null:null,'include':_0x19aef2[_0xa282('0x18')]?_0x19aef2[_0xa282('0x18')][_0xa282('0x1d')]?_[_0xa282('0x1e')](_0x19aef2[_0xa282('0x18')][_0xa282('0x1d')],function(_0x400cf4){return{'model':db[_0x400cf4[_0xa282('0x1f')]],'as':_0x400cf4['as'],'attributes':_0x400cf4[_0xa282('0x1b')],'include':_0x400cf4['include']?_['map'](_0x400cf4[_0xa282('0x1d')],function(_0x3c616f){return{'model':db[_0x3c616f[_0xa282('0x1f')]],'as':_0x3c616f['as'],'attributes':_0x3c616f[_0xa282('0x1b')],'include':_0x3c616f[_0xa282('0x1d')]?_[_0xa282('0x1e')](_0x3c616f[_0xa282('0x1d')],function(_0x472e60){return{'model':db[_0x472e60['model']],'as':_0x472e60['as'],'attributes':_0x472e60[_0xa282('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13938e){logger[_0xa282('0xa')](_0xa282('0x15'),_0x19aef2);logger['debug']('GetMemberReport',_0x19aef2,JSON['stringify'](_0x13938e));_0x3280b7(_0x13938e);})[_0xa282('0x14')](function(_0x514879){logger[_0xa282('0x10')](_0xa282('0x15'),_0x514879['message'],_0x19aef2);_0x101897(_0x2d951c[_0xa282('0x10')](0x1f4,_0x514879[_0xa282('0x12')]));});});};exports[_0xa282('0x20')]=function(_0x143f02){var _0x2541c6=this;return new Promise(function(_0x43deb3,_0x97c148){return db['MemberReport'][_0xa282('0x21')](_0x143f02[_0xa282('0x22')],{'raw':_0x143f02[_0xa282('0x18')]?_0x143f02[_0xa282('0x18')][_0xa282('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x53da84){logger['info']('CreateMemberReport',_0x143f02);logger[_0xa282('0xd')](_0xa282('0x20'),_0x143f02,JSON['stringify'](_0x53da84));_0x43deb3(_0x53da84);})[_0xa282('0x14')](function(_0x411b99){logger[_0xa282('0x10')](_0xa282('0x20'),_0x411b99['message'],_0x143f02);_0x97c148(_0x2541c6[_0xa282('0x10')](0x1f4,_0x411b99[_0xa282('0x12')]));});});};exports[_0xa282('0x23')]=function(_0xb55258){var _0x57cde3=this;return new Promise(function(_0x12afb9,_0x56b991){return db[_0xa282('0x16')][_0xa282('0x24')](_0xb55258[_0xa282('0x22')],{'raw':_0xb55258[_0xa282('0x18')]?_0xb55258[_0xa282('0x18')][_0xa282('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb55258[_0xa282('0x18')]?_0xb55258[_0xa282('0x18')][_0xa282('0x1a')]||null:null,'attributes':_0xb55258[_0xa282('0x18')]?_0xb55258[_0xa282('0x18')]['attributes']||null:null,'limit':_0xb55258[_0xa282('0x18')]?_0xb55258[_0xa282('0x18')][_0xa282('0x1c')]||null:null})[_0xa282('0x9')](function(_0x156362){logger['info'](_0xa282('0x23'),_0xb55258);logger[_0xa282('0xd')](_0xa282('0x23'),_0xb55258,JSON[_0xa282('0xf')](_0x156362));_0x12afb9(_0x156362);})[_0xa282('0x14')](function(_0x3900ea){logger[_0xa282('0x10')](_0xa282('0x23'),_0x3900ea['message'],_0xb55258);_0x56b991(_0x57cde3[_0xa282('0x10')](0x1f4,_0x3900ea[_0xa282('0x12')]));});});}; \ No newline at end of file +var _0x1c75=['http','request','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','GetMemberReport','MemberReport','options','where','attributes','map','include','model','then','body','raw','CreateMemberReport','UpdateMemberReport','update','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c75,0xce));var _0x51c7=function(_0x34357e,_0x5af72a){_0x34357e=_0x34357e-0x0;var _0x488189=_0x1c75[_0x34357e];return _0x488189;};'use strict';var _=require(_0x51c7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x51c7('0x1'));var fs=require('fs');var Redis=require(_0x51c7('0x2'));var db=require(_0x51c7('0x3'))['db'];var utils=require(_0x51c7('0x4'));var logger=require(_0x51c7('0x5'))(_0x51c7('0x6'));var config=require(_0x51c7('0x7'));var jayson=require(_0x51c7('0x8'));var client=jayson[_0x51c7('0x9')][_0x51c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283d6b,_0x56b9a0,_0x1feb9a){return new BPromise(function(_0x18850c,_0xca4934){return client[_0x51c7('0xb')](_0x283d6b,_0x1feb9a)['then'](function(_0x24bc5a){logger['info'](_0x51c7('0xc'),_0x56b9a0,'request\x20sent');logger[_0x51c7('0xd')](_0x51c7('0xe'),_0x56b9a0,'request\x20sent',JSON[_0x51c7('0xf')](_0x24bc5a));if(_0x24bc5a[_0x51c7('0x10')]){if(_0x24bc5a[_0x51c7('0x10')]['code']===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x56b9a0,_0x24bc5a[_0x51c7('0x10')][_0x51c7('0x11')]);return _0xca4934(_0x24bc5a[_0x51c7('0x10')]['message']);}logger[_0x51c7('0x10')]('MemberReport,\x20%s,\x20%s',_0x56b9a0,_0x24bc5a[_0x51c7('0x10')]['message']);return _0x18850c(_0x24bc5a[_0x51c7('0x10')]['message']);}else{logger[_0x51c7('0x12')](_0x51c7('0xc'),_0x56b9a0,_0x51c7('0x13'));_0x18850c(_0x24bc5a[_0x51c7('0x14')]['message']);}})[_0x51c7('0x15')](function(_0x1782d6){logger[_0x51c7('0x10')](_0x51c7('0xc'),_0x56b9a0,_0x1782d6);_0xca4934(_0x1782d6);});});}exports[_0x51c7('0x16')]=function(_0x36b29a){var _0x4a64e4=this;return new Promise(function(_0xe4cf49,_0x8dd5b0){return db[_0x51c7('0x17')]['findAll']({'raw':_0x36b29a[_0x51c7('0x18')]?_0x36b29a[_0x51c7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x36b29a['options']?_0x36b29a[_0x51c7('0x18')][_0x51c7('0x19')]||null:null,'attributes':_0x36b29a[_0x51c7('0x18')]?_0x36b29a[_0x51c7('0x18')][_0x51c7('0x1a')]||null:null,'limit':_0x36b29a[_0x51c7('0x18')]?_0x36b29a[_0x51c7('0x18')]['limit']||null:null,'include':_0x36b29a[_0x51c7('0x18')]?_0x36b29a[_0x51c7('0x18')]['include']?_[_0x51c7('0x1b')](_0x36b29a['options'][_0x51c7('0x1c')],function(_0x3f7858){return{'model':db[_0x3f7858[_0x51c7('0x1d')]],'as':_0x3f7858['as'],'attributes':_0x3f7858['attributes'],'include':_0x3f7858[_0x51c7('0x1c')]?_[_0x51c7('0x1b')](_0x3f7858[_0x51c7('0x1c')],function(_0x13a3ad){return{'model':db[_0x13a3ad[_0x51c7('0x1d')]],'as':_0x13a3ad['as'],'attributes':_0x13a3ad[_0x51c7('0x1a')],'include':_0x13a3ad['include']?_[_0x51c7('0x1b')](_0x13a3ad['include'],function(_0x3d9ec8){return{'model':db[_0x3d9ec8[_0x51c7('0x1d')]],'as':_0x3d9ec8['as'],'attributes':_0x3d9ec8[_0x51c7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x51c7('0x1e')](function(_0x375a70){logger[_0x51c7('0x12')](_0x51c7('0x16'),_0x36b29a);logger[_0x51c7('0xd')](_0x51c7('0x16'),_0x36b29a,JSON[_0x51c7('0xf')](_0x375a70));_0xe4cf49(_0x375a70);})[_0x51c7('0x15')](function(_0x16db1b){logger['error'](_0x51c7('0x16'),_0x16db1b[_0x51c7('0x11')],_0x36b29a);_0x8dd5b0(_0x4a64e4[_0x51c7('0x10')](0x1f4,_0x16db1b[_0x51c7('0x11')]));});});};exports['CreateMemberReport']=function(_0x21ff27){var _0x5e90bc=this;return new Promise(function(_0x3d590d,_0x29b08a){return db[_0x51c7('0x17')]['create'](_0x21ff27[_0x51c7('0x1f')],{'raw':_0x21ff27['options']?_0x21ff27[_0x51c7('0x18')][_0x51c7('0x20')]===undefined?!![]:![]:!![]})[_0x51c7('0x1e')](function(_0x38fd20){logger[_0x51c7('0x12')](_0x51c7('0x21'),_0x21ff27);logger[_0x51c7('0xd')](_0x51c7('0x21'),_0x21ff27,JSON[_0x51c7('0xf')](_0x38fd20));_0x3d590d(_0x38fd20);})[_0x51c7('0x15')](function(_0x48aa16){logger[_0x51c7('0x10')]('CreateMemberReport',_0x48aa16[_0x51c7('0x11')],_0x21ff27);_0x29b08a(_0x5e90bc[_0x51c7('0x10')](0x1f4,_0x48aa16['message']));});});};exports[_0x51c7('0x22')]=function(_0x18ff99){var _0x379f6d=this;return new Promise(function(_0x29e604,_0x483e4d){return db[_0x51c7('0x17')][_0x51c7('0x23')](_0x18ff99[_0x51c7('0x1f')],{'raw':_0x18ff99[_0x51c7('0x18')]?_0x18ff99['options'][_0x51c7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18ff99[_0x51c7('0x18')]?_0x18ff99[_0x51c7('0x18')][_0x51c7('0x19')]||null:null,'attributes':_0x18ff99[_0x51c7('0x18')]?_0x18ff99['options'][_0x51c7('0x1a')]||null:null,'limit':_0x18ff99['options']?_0x18ff99[_0x51c7('0x18')]['limit']||null:null})[_0x51c7('0x1e')](function(_0x18a642){logger['info'](_0x51c7('0x22'),_0x18ff99);logger[_0x51c7('0xd')](_0x51c7('0x22'),_0x18ff99,JSON[_0x51c7('0xf')](_0x18a642));_0x29e604(_0x18a642);})['catch'](function(_0x5a1e2a){logger[_0x51c7('0x10')](_0x51c7('0x22'),_0x5a1e2a[_0x51c7('0x11')],_0x18ff99);_0x483e4d(_0x379f6d[_0x51c7('0x10')](0x1f4,_0x5a1e2a['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 9dbbabb..f0a3dcb 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 _0xf350=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x137b03,_0x1696cb){var _0xff0289=function(_0x36da97){while(--_0x36da97){_0x137b03['push'](_0x137b03['shift']());}};_0xff0289(++_0x1696cb);}(_0xf350,0x105));var _0x0f35=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf350[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0f35('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0f35('0x1'));var express=require(_0x0f35('0x2'));var router=express[_0x0f35('0x3')]();var fs_extra=require(_0x0f35('0x4'));var auth=require(_0x0f35('0x5'));var interaction=require(_0x0f35('0x6'));var config=require(_0x0f35('0x7'));var controller=require('./migration.controller');router['get']('/',controller['index']);module[_0x0f35('0x8')]=router; \ No newline at end of file +var _0xa2f3=['index','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xbd2ce9,_0x401b82){var _0x251b15=function(_0x9c5084){while(--_0x9c5084){_0xbd2ce9['push'](_0xbd2ce9['shift']());}};_0x251b15(++_0x401b82);}(_0xa2f3,0x76));var _0x3a2f=function(_0x5f17be,_0x98a814){_0x5f17be=_0x5f17be-0x0;var _0x3a2675=_0xa2f3[_0x5f17be];return _0x3a2675;};'use strict';var multer=require('multer');var util=require(_0x3a2f('0x0'));var path=require('path');var timeout=require(_0x3a2f('0x1'));var express=require(_0x3a2f('0x2'));var router=express['Router']();var fs_extra=require(_0x3a2f('0x3'));var auth=require(_0x3a2f('0x4'));var interaction=require(_0x3a2f('0x5'));var config=require(_0x3a2f('0x6'));var controller=require('./migration.controller');router[_0x3a2f('0x7')]('/',controller[_0x3a2f('0x8')]);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 f9b54a9..ccdd0dc 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 _0x52f4=['exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x52f4,0x64));var _0x452f=function(_0x5a0467,_0x1e69b4){_0x5a0467=_0x5a0467-0x0;var _0x1c3318=_0x52f4[_0x5a0467];return _0x1c3318;};'use strict';var Sequelize=require('sequelize');module[_0x452f('0x0')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x6f97=['sequelize','exports','version'];(function(_0x5f436b,_0x716f61){var _0x2088cd=function(_0x2ec952){while(--_0x2ec952){_0x5f436b['push'](_0x5f436b['shift']());}};_0x2088cd(++_0x716f61);}(_0x6f97,0x1dd));var _0x76f9=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0x6f97[_0x23be51];return _0x47a26d;};'use strict';var Sequelize=require(_0x76f9('0x0'));module[_0x76f9('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x76f9('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 5ac2a26..9cf1a4d 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 _0x4f96=['name','includeAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','stack','send','index','Migration','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type'];(function(_0x2a4786,_0x53df36){var _0x2508d1=function(_0x4d77cb){while(--_0x4d77cb){_0x2a4786['push'](_0x2a4786['shift']());}};_0x2508d1(++_0x53df36);}(_0x4f96,0xb9));var _0x64f9=function(_0x3b0575,_0x57dcff){_0x3b0575=_0x3b0575-0x0;var _0x3e3bea=_0x4f96[_0x3b0575];return _0x3e3bea;};'use strict';var emlformat=require(_0x64f9('0x0'));var rimraf=require(_0x64f9('0x1'));var zipdir=require(_0x64f9('0x2'));var jsonpatch=require(_0x64f9('0x3'));var rp=require(_0x64f9('0x4'));var moment=require(_0x64f9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x64f9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x64f9('0x7'));var csv=require('to-csv');var ejs=require(_0x64f9('0x8'));var fs=require('fs');var fs_extra=require(_0x64f9('0x9'));var _=require(_0x64f9('0xa'));var squel=require(_0x64f9('0xb'));var crypto=require(_0x64f9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x64f9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x64f9('0xe'));var Papa=require(_0x64f9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x64f9('0x10'));var as=require(_0x64f9('0x11'));var hardwareService=require(_0x64f9('0x12'));var logger=require(_0x64f9('0x13'))(_0x64f9('0x14'));var utils=require('../../config/utils');var config=require(_0x64f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x64f9('0x16'))['db'];function respondWithStatusCode(_0x4491bb,_0x4b5ecd){_0x4b5ecd=_0x4b5ecd||0xcc;return function(_0x2db632){if(_0x2db632){return _0x4491bb[_0x64f9('0x17')](_0x4b5ecd);}return _0x4491bb[_0x64f9('0x18')](_0x4b5ecd)[_0x64f9('0x19')]();};}function respondWithResult(_0x33da78,_0x4b52b3){_0x4b52b3=_0x4b52b3||0xc8;return function(_0x14febc){if(_0x14febc){return _0x33da78['status'](_0x4b52b3)['json'](_0x14febc);}};}function respondWithFilteredResult(_0x3f69a5,_0x2109cb){return function(_0x5c2a12){if(_0x5c2a12){var _0xd9aa4b=typeof _0x2109cb[_0x64f9('0x1a')]==='undefined'&&typeof _0x2109cb['limit']==='undefined';var _0x534c2c=_0x5c2a12[_0x64f9('0x1b')];var _0x28553e=_0xd9aa4b?0x0:_0x2109cb[_0x64f9('0x1a')];var _0x238672=_0xd9aa4b?_0x5c2a12['count']:_0x2109cb['offset']+_0x2109cb[_0x64f9('0x1c')];var _0x482a6d;if(_0x238672>=_0x534c2c){_0x238672=_0x534c2c;_0x482a6d=0xc8;}else{_0x482a6d=0xce;}_0x3f69a5[_0x64f9('0x18')](_0x482a6d);return _0x3f69a5[_0x64f9('0x1d')](_0x64f9('0x1e'),_0x28553e+'-'+_0x238672+'/'+_0x534c2c)[_0x64f9('0x1f')](_0x5c2a12);}return null;};}function patchUpdates(_0x1bdda9){return function(_0x89eb57){try{jsonpatch[_0x64f9('0x20')](_0x89eb57,_0x1bdda9,!![]);}catch(_0x40b9b7){return BPromise[_0x64f9('0x21')](_0x40b9b7);}return _0x89eb57[_0x64f9('0x22')]();};}function saveUpdates(_0x253a94,_0x327e59){return function(_0x55ca87){if(_0x55ca87){return _0x55ca87[_0x64f9('0x23')](_0x253a94)[_0x64f9('0x24')](function(_0x714f93){return _0x714f93;});}return null;};}function removeEntity(_0x4a1796,_0x5ce72e){return function(_0x51544b){if(_0x51544b){return _0x51544b['destroy']()[_0x64f9('0x24')](function(){_0x4a1796[_0x64f9('0x18')](0xcc)[_0x64f9('0x19')]();});}};}function handleEntityNotFound(_0x1f8e45,_0x25c7aa){return function(_0x1ac533){if(!_0x1ac533){_0x1f8e45['sendStatus'](0x194);}return _0x1ac533;};}function handleError(_0x4ba839,_0x32f550){_0x32f550=_0x32f550||0x1f4;return function(_0x4e4639){logger['error'](_0x4e4639[_0x64f9('0x25')]);if(_0x4e4639['name']){delete _0x4e4639['name'];}_0x4ba839[_0x64f9('0x18')](_0x32f550)[_0x64f9('0x26')](_0x4e4639);};}exports[_0x64f9('0x27')]=function(_0x2d9c3e,_0xc6977){var _0x5a2518={},_0x10cd04={},_0x276a2a={'count':0x0,'rows':[]};var _0x45075b=_['map'](db[_0x64f9('0x28')][_0x64f9('0x29')],function(_0x276714){return{'name':_0x276714['fieldName'],'type':_0x276714['type']['key']};});_0x10cd04[_0x64f9('0x2a')]=_[_0x64f9('0x2b')](_0x45075b,'name');_0x10cd04[_0x64f9('0x2c')]=_[_0x64f9('0x2d')](_0x2d9c3e[_0x64f9('0x2c')]);_0x10cd04[_0x64f9('0x2e')]=_[_0x64f9('0x2f')](_0x10cd04[_0x64f9('0x2a')],_0x10cd04[_0x64f9('0x2c')]);_0x5a2518[_0x64f9('0x30')]=_[_0x64f9('0x2f')](_0x10cd04[_0x64f9('0x2a')],qs['fields'](_0x2d9c3e[_0x64f9('0x2c')][_0x64f9('0x31')]));_0x5a2518[_0x64f9('0x30')]=_0x5a2518[_0x64f9('0x30')][_0x64f9('0x32')]?_0x5a2518['attributes']:_0x10cd04[_0x64f9('0x2a')];if(!_0x2d9c3e[_0x64f9('0x2c')]['hasOwnProperty'](_0x64f9('0x33'))){_0x5a2518['limit']=qs['limit'](_0x2d9c3e[_0x64f9('0x2c')][_0x64f9('0x1c')]);_0x5a2518[_0x64f9('0x1a')]=qs[_0x64f9('0x1a')](_0x2d9c3e[_0x64f9('0x2c')][_0x64f9('0x1a')]);}_0x5a2518[_0x64f9('0x34')]=qs[_0x64f9('0x35')](_0x2d9c3e['query'][_0x64f9('0x35')]);_0x5a2518[_0x64f9('0x36')]=qs[_0x64f9('0x2e')](_[_0x64f9('0x37')](_0x2d9c3e[_0x64f9('0x2c')],_0x10cd04[_0x64f9('0x2e')]),_0x45075b);if(_0x2d9c3e[_0x64f9('0x2c')][_0x64f9('0x38')]){_0x5a2518[_0x64f9('0x36')]=_[_0x64f9('0x39')](_0x5a2518['where'],{'$or':_[_0x64f9('0x2b')](_0x45075b,function(_0x188243){if(_0x188243[_0x64f9('0x3a')]!=='VIRTUAL'){var _0x4e61d3={};_0x4e61d3[_0x188243[_0x64f9('0x3b')]]={'$like':'%'+_0x2d9c3e[_0x64f9('0x2c')][_0x64f9('0x38')]+'%'};return _0x4e61d3;}})});}_0x5a2518=_[_0x64f9('0x39')]({},_0x5a2518,_0x2d9c3e['options']);var _0x311e61={'where':_0x5a2518[_0x64f9('0x36')]};return db[_0x64f9('0x28')][_0x64f9('0x1b')](_0x311e61)[_0x64f9('0x24')](function(_0x40b2cc){_0x276a2a[_0x64f9('0x1b')]=_0x40b2cc;if(_0x2d9c3e['query'][_0x64f9('0x3c')]){_0x5a2518['include']=[{'all':!![]}];}return db[_0x64f9('0x28')]['findAll'](_0x5a2518);})[_0x64f9('0x24')](function(_0x3a20d8){_0x276a2a['rows']=_0x3a20d8;return _0x276a2a;})[_0x64f9('0x24')](respondWithFilteredResult(_0xc6977,_0x5a2518))['catch'](handleError(_0xc6977,null));}; \ No newline at end of file +var _0xb0b4=['Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','index','map','Migration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb0b4,0x134));var _0x4b0b=function(_0x2421cc,_0xb42b87){_0x2421cc=_0x2421cc-0x0;var _0x237d11=_0xb0b4[_0x2421cc];return _0x237d11;};'use strict';var emlformat=require(_0x4b0b('0x0'));var rimraf=require(_0x4b0b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b0b('0x2'));var rp=require(_0x4b0b('0x3'));var moment=require('moment');var BPromise=require(_0x4b0b('0x4'));var Mustache=require(_0x4b0b('0x5'));var util=require(_0x4b0b('0x6'));var path=require(_0x4b0b('0x7'));var sox=require(_0x4b0b('0x8'));var csv=require(_0x4b0b('0x9'));var ejs=require(_0x4b0b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4b0b('0xb'));var crypto=require(_0x4b0b('0xc'));var jsforce=require(_0x4b0b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4b0b('0x9'));var querystring=require(_0x4b0b('0xe'));var Papa=require(_0x4b0b('0xf'));var Redis=require(_0x4b0b('0x10'));var authService=require(_0x4b0b('0x11'));var qs=require(_0x4b0b('0x12'));var as=require(_0x4b0b('0x13'));var hardwareService=require(_0x4b0b('0x14'));var logger=require(_0x4b0b('0x15'))(_0x4b0b('0x16'));var utils=require('../../config/utils');var config=require(_0x4b0b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b0b('0x18'))['db'];function respondWithStatusCode(_0x2749e8,_0x3d5020){_0x3d5020=_0x3d5020||0xcc;return function(_0x13ffff){if(_0x13ffff){return _0x2749e8['sendStatus'](_0x3d5020);}return _0x2749e8[_0x4b0b('0x19')](_0x3d5020)[_0x4b0b('0x1a')]();};}function respondWithResult(_0x4ab5fc,_0x1b4b9d){_0x1b4b9d=_0x1b4b9d||0xc8;return function(_0x537689){if(_0x537689){return _0x4ab5fc[_0x4b0b('0x19')](_0x1b4b9d)['json'](_0x537689);}};}function respondWithFilteredResult(_0x1a6a78,_0x56e3b2){return function(_0x3fc4f1){if(_0x3fc4f1){var _0x41419b=typeof _0x56e3b2[_0x4b0b('0x1b')]===_0x4b0b('0x1c')&&typeof _0x56e3b2[_0x4b0b('0x1d')]==='undefined';var _0x24f911=_0x3fc4f1[_0x4b0b('0x1e')];var _0x4e330b=_0x41419b?0x0:_0x56e3b2[_0x4b0b('0x1b')];var _0x47d030=_0x41419b?_0x3fc4f1['count']:_0x56e3b2[_0x4b0b('0x1b')]+_0x56e3b2['limit'];var _0x5d2e85;if(_0x47d030>=_0x24f911){_0x47d030=_0x24f911;_0x5d2e85=0xc8;}else{_0x5d2e85=0xce;}_0x1a6a78['status'](_0x5d2e85);return _0x1a6a78[_0x4b0b('0x1f')](_0x4b0b('0x20'),_0x4e330b+'-'+_0x47d030+'/'+_0x24f911)[_0x4b0b('0x21')](_0x3fc4f1);}return null;};}function patchUpdates(_0x595f78){return function(_0x30eef4){try{jsonpatch[_0x4b0b('0x22')](_0x30eef4,_0x595f78,!![]);}catch(_0x6c61e5){return BPromise[_0x4b0b('0x23')](_0x6c61e5);}return _0x30eef4[_0x4b0b('0x24')]();};}function saveUpdates(_0x2bc7b5,_0x2a7733){return function(_0x29e65f){if(_0x29e65f){return _0x29e65f[_0x4b0b('0x25')](_0x2bc7b5)[_0x4b0b('0x26')](function(_0x3948dd){return _0x3948dd;});}return null;};}function removeEntity(_0x1fbded,_0x58f66c){return function(_0x3ce08b){if(_0x3ce08b){return _0x3ce08b[_0x4b0b('0x27')]()[_0x4b0b('0x26')](function(){_0x1fbded[_0x4b0b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50091b,_0x506a55){return function(_0x357dc0){if(!_0x357dc0){_0x50091b[_0x4b0b('0x28')](0x194);}return _0x357dc0;};}function handleError(_0x2b2dc3,_0x2366a3){_0x2366a3=_0x2366a3||0x1f4;return function(_0x23fea6){logger[_0x4b0b('0x29')](_0x23fea6['stack']);if(_0x23fea6['name']){delete _0x23fea6[_0x4b0b('0x2a')];}_0x2b2dc3[_0x4b0b('0x19')](_0x2366a3)['send'](_0x23fea6);};}exports[_0x4b0b('0x2b')]=function(_0x39dd1a,_0x204c98){var _0x7bc1eb={},_0x26d814={},_0x248115={'count':0x0,'rows':[]};var _0x51fce9=_[_0x4b0b('0x2c')](db[_0x4b0b('0x2d')][_0x4b0b('0x2e')],function(_0x4a6e93){return{'name':_0x4a6e93[_0x4b0b('0x2f')],'type':_0x4a6e93[_0x4b0b('0x30')][_0x4b0b('0x31')]};});_0x26d814['model']=_[_0x4b0b('0x2c')](_0x51fce9,'name');_0x26d814['query']=_['keys'](_0x39dd1a[_0x4b0b('0x32')]);_0x26d814[_0x4b0b('0x33')]=_[_0x4b0b('0x34')](_0x26d814[_0x4b0b('0x35')],_0x26d814[_0x4b0b('0x32')]);_0x7bc1eb[_0x4b0b('0x36')]=_[_0x4b0b('0x34')](_0x26d814[_0x4b0b('0x35')],qs['fields'](_0x39dd1a[_0x4b0b('0x32')][_0x4b0b('0x37')]));_0x7bc1eb['attributes']=_0x7bc1eb[_0x4b0b('0x36')][_0x4b0b('0x38')]?_0x7bc1eb['attributes']:_0x26d814['model'];if(!_0x39dd1a['query']['hasOwnProperty'](_0x4b0b('0x39'))){_0x7bc1eb[_0x4b0b('0x1d')]=qs[_0x4b0b('0x1d')](_0x39dd1a[_0x4b0b('0x32')][_0x4b0b('0x1d')]);_0x7bc1eb[_0x4b0b('0x1b')]=qs[_0x4b0b('0x1b')](_0x39dd1a[_0x4b0b('0x32')][_0x4b0b('0x1b')]);}_0x7bc1eb['order']=qs[_0x4b0b('0x3a')](_0x39dd1a[_0x4b0b('0x32')]['sort']);_0x7bc1eb['where']=qs[_0x4b0b('0x33')](_[_0x4b0b('0x3b')](_0x39dd1a['query'],_0x26d814[_0x4b0b('0x33')]),_0x51fce9);if(_0x39dd1a[_0x4b0b('0x32')][_0x4b0b('0x3c')]){_0x7bc1eb[_0x4b0b('0x3d')]=_[_0x4b0b('0x3e')](_0x7bc1eb[_0x4b0b('0x3d')],{'$or':_[_0x4b0b('0x2c')](_0x51fce9,function(_0x44fb12){if(_0x44fb12[_0x4b0b('0x30')]!==_0x4b0b('0x3f')){var _0x286ca5={};_0x286ca5[_0x44fb12[_0x4b0b('0x2a')]]={'$like':'%'+_0x39dd1a[_0x4b0b('0x32')][_0x4b0b('0x3c')]+'%'};return _0x286ca5;}})});}_0x7bc1eb=_[_0x4b0b('0x3e')]({},_0x7bc1eb,_0x39dd1a[_0x4b0b('0x40')]);var _0xdf63d7={'where':_0x7bc1eb['where']};return db[_0x4b0b('0x2d')]['count'](_0xdf63d7)[_0x4b0b('0x26')](function(_0xd276cc){_0x248115[_0x4b0b('0x1e')]=_0xd276cc;if(_0x39dd1a['query']['includeAll']){_0x7bc1eb[_0x4b0b('0x41')]=[{'all':!![]}];}return db[_0x4b0b('0x2d')][_0x4b0b('0x42')](_0x7bc1eb);})['then'](function(_0x136491){_0x248115['rows']=_0x136491;return _0x248115;})[_0x4b0b('0x26')](respondWithFilteredResult(_0x204c98,_0x7bc1eb))[_0x4b0b('0x43')](handleError(_0x204c98,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index ba70d15..e470b73 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 _0xde16=['request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2696b6,_0x1caa51){var _0x414ca2=function(_0x293d50){while(--_0x293d50){_0x2696b6['push'](_0x2696b6['shift']());}};_0x414ca2(++_0x1caa51);}(_0xde16,0x13f));var _0x6de1=function(_0x17da69,_0x205f98){_0x17da69=_0x17da69-0x0;var _0x420fde=_0xde16[_0x17da69];return _0x420fde;};'use strict';var _=require(_0x6de1('0x0'));var util=require('util');var logger=require(_0x6de1('0x1'))(_0x6de1('0x2'));var moment=require(_0x6de1('0x3'));var BPromise=require(_0x6de1('0x4'));var rp=require(_0x6de1('0x5'));var fs=require('fs');var path=require(_0x6de1('0x6'));var rimraf=require(_0x6de1('0x7'));var config=require(_0x6de1('0x8'));var attributes=require(_0x6de1('0x9'));module[_0x6de1('0xa')]=function(_0x3e1bfe,_0x121798){return _0x3e1bfe[_0x6de1('0xb')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17fe=['path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x6c8051,_0x3f612b){var _0x459102=function(_0x163eb2){while(--_0x163eb2){_0x6c8051['push'](_0x6c8051['shift']());}};_0x459102(++_0x3f612b);}(_0x17fe,0x1b4));var _0xe17f=function(_0xe689f3,_0x1d4d42){_0xe689f3=_0xe689f3-0x0;var _0x41e19d=_0x17fe[_0xe689f3];return _0x41e19d;};'use strict';var _=require(_0xe17f('0x0'));var util=require(_0xe17f('0x1'));var logger=require(_0xe17f('0x2'))('api');var moment=require(_0xe17f('0x3'));var BPromise=require(_0xe17f('0x4'));var rp=require(_0xe17f('0x5'));var fs=require('fs');var path=require(_0xe17f('0x6'));var rimraf=require(_0xe17f('0x7'));var config=require(_0xe17f('0x8'));var attributes=require(_0xe17f('0x9'));module[_0xe17f('0xa')]=function(_0x308487,_0x426663){return _0x308487[_0xe17f('0xb')](_0xe17f('0xc'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index dc6b807..86e44e2 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 _0x9063=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Migration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x9063,0x1a2));var _0x3906=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x9063[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x3906('0x0'));var util=require(_0x3906('0x1'));var moment=require(_0x3906('0x2'));var BPromise=require(_0x3906('0x3'));var rs=require(_0x3906('0x4'));var fs=require('fs');var Redis=require(_0x3906('0x5'));var db=require(_0x3906('0x6'))['db'];var utils=require(_0x3906('0x7'));var logger=require('../../config/logger')(_0x3906('0x8'));var config=require(_0x3906('0x9'));var jayson=require(_0x3906('0xa'));var client=jayson[_0x3906('0xb')][_0x3906('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x522b71,_0x54637d,_0x4a8864){return new BPromise(function(_0x331b42,_0x14f37c){return client[_0x3906('0xd')](_0x522b71,_0x4a8864)['then'](function(_0x45f3bf){logger[_0x3906('0xe')]('Migration,\x20%s,\x20%s',_0x54637d,_0x3906('0xf'));logger[_0x3906('0x10')](_0x3906('0x11'),_0x54637d,'request\x20sent',JSON[_0x3906('0x12')](_0x45f3bf));if(_0x45f3bf[_0x3906('0x13')]){if(_0x45f3bf['error'][_0x3906('0x14')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x54637d,_0x45f3bf[_0x3906('0x13')][_0x3906('0x15')]);return _0x14f37c(_0x45f3bf['error']['message']);}logger[_0x3906('0x13')](_0x3906('0x16'),_0x54637d,_0x45f3bf['error']['message']);return _0x331b42(_0x45f3bf[_0x3906('0x13')][_0x3906('0x15')]);}else{logger[_0x3906('0xe')](_0x3906('0x16'),_0x54637d,_0x3906('0xf'));_0x331b42(_0x45f3bf[_0x3906('0x17')][_0x3906('0x15')]);}})[_0x3906('0x18')](function(_0x3f8515){logger[_0x3906('0x13')]('Migration,\x20%s,\x20%s',_0x54637d,_0x3f8515);_0x14f37c(_0x3f8515);});});} \ No newline at end of file +var _0xbb53=['http','then','info','request\x20sent','stringify','error','message','Migration,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xbb53,0x121));var _0x3bb5=function(_0x1098c6,_0x3ce02c){_0x1098c6=_0x1098c6-0x0;var _0x4edddd=_0xbb53[_0x1098c6];return _0x4edddd;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var BPromise=require(_0x3bb5('0x3'));var rs=require(_0x3bb5('0x4'));var fs=require('fs');var Redis=require(_0x3bb5('0x5'));var db=require(_0x3bb5('0x6'))['db'];var utils=require(_0x3bb5('0x7'));var logger=require(_0x3bb5('0x8'))(_0x3bb5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bb5('0xa')][_0x3bb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aa7d,_0x157e04,_0x22f92f){return new BPromise(function(_0x480f9c,_0x5a4ae3){return client['request'](_0x28aa7d,_0x22f92f)[_0x3bb5('0xc')](function(_0x2e0cfa){logger[_0x3bb5('0xd')]('Migration,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'),JSON[_0x3bb5('0xf')](_0x2e0cfa));if(_0x2e0cfa['error']){if(_0x2e0cfa[_0x3bb5('0x10')]['code']===0x1f4){logger[_0x3bb5('0x10')]('Migration,\x20%s,\x20%s',_0x157e04,_0x2e0cfa['error'][_0x3bb5('0x11')]);return _0x5a4ae3(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}logger['error'](_0x3bb5('0x12'),_0x157e04,_0x2e0cfa[_0x3bb5('0x10')]['message']);return _0x480f9c(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x157e04,'request\x20sent');_0x480f9c(_0x2e0cfa[_0x3bb5('0x13')][_0x3bb5('0x11')]);}})['catch'](function(_0x25d774){logger[_0x3bb5('0x10')](_0x3bb5('0x12'),_0x157e04,_0x25d774);_0x5a4ae3(_0x25d774);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 27cade2..8312b07 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 _0xc247=['util','path','express','Router','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','post','put','update','destroy','exports','multer'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc247,0xfe));var _0x7c24=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0xc247[_0x3747ae];return _0x339035;};'use strict';var multer=require(_0x7c24('0x0'));var util=require(_0x7c24('0x1'));var path=require(_0x7c24('0x2'));var timeout=require('connect-timeout');var express=require(_0x7c24('0x3'));var router=express[_0x7c24('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7c24('0x5'));var config=require(_0x7c24('0x6'));var controller=require(_0x7c24('0x7'));router[_0x7c24('0x8')]('/',auth[_0x7c24('0x9')](),controller[_0x7c24('0xa')]);router[_0x7c24('0x8')](_0x7c24('0xb'),auth[_0x7c24('0x9')](),controller['show']);router[_0x7c24('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7c24('0xd')](_0x7c24('0xb'),auth[_0x7c24('0x9')](),controller[_0x7c24('0xe')]);router['delete'](_0x7c24('0xb'),auth['isAuthenticated'](),controller[_0x7c24('0xf')]);module[_0x7c24('0x10')]=router; \ No newline at end of file +var _0xf156=['create','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','/:id','show','post','isAuthenticated'];(function(_0x15541e,_0x1d6472){var _0x556e80=function(_0x145d1d){while(--_0x145d1d){_0x15541e['push'](_0x15541e['shift']());}};_0x556e80(++_0x1d6472);}(_0xf156,0x137));var _0x6f15=function(_0x492892,_0x28c6b0){_0x492892=_0x492892-0x0;var _0x209270=_0xf156[_0x492892];return _0x209270;};'use strict';var multer=require('multer');var util=require(_0x6f15('0x0'));var path=require(_0x6f15('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f15('0x2'));var router=express['Router']();var fs_extra=require(_0x6f15('0x3'));var auth=require(_0x6f15('0x4'));var interaction=require(_0x6f15('0x5'));var config=require(_0x6f15('0x6'));var controller=require(_0x6f15('0x7'));router[_0x6f15('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6f15('0x8')](_0x6f15('0x9'),auth['isAuthenticated'](),controller[_0x6f15('0xa')]);router[_0x6f15('0xb')]('/',auth[_0x6f15('0xc')](),controller[_0x6f15('0xd')]);router['put']('/:id',auth[_0x6f15('0xc')](),controller[_0x6f15('0xe')]);router[_0x6f15('0xf')](_0x6f15('0x9'),auth[_0x6f15('0xc')](),controller[_0x6f15('0x10')]);module[_0x6f15('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 98a15f0..736612a 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 _0x0361=['ENUM','localnet','stun','STRING','exports'];(function(_0x53c807,_0x4b25c8){var _0x588b2c=function(_0x33919b){while(--_0x33919b){_0x53c807['push'](_0x53c807['shift']());}};_0x588b2c(++_0x4b25c8);}(_0x0361,0x11c));var _0x1036=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0361[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x1036('0x0')]={'type':{'type':Sequelize[_0x1036('0x1')](_0x1036('0x2'),'externip',_0x1036('0x3'),'turn')},'value':{'type':Sequelize[_0x1036('0x4')]},'username':{'type':Sequelize[_0x1036('0x4')]},'password':{'type':Sequelize[_0x1036('0x4')]}}; \ No newline at end of file +var _0x0736=['sequelize','exports','localnet','externip','STRING'];(function(_0x462749,_0x3347de){var _0x591b25=function(_0x10b615){while(--_0x10b615){_0x462749['push'](_0x462749['shift']());}};_0x591b25(++_0x3347de);}(_0x0736,0xa0));var _0x6073=function(_0x33d4c8,_0x1a0fd6){_0x33d4c8=_0x33d4c8-0x0;var _0x45eac0=_0x0736[_0x33d4c8];return _0x45eac0;};'use strict';var Sequelize=require(_0x6073('0x0'));module[_0x6073('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6073('0x2'),_0x6073('0x3'),'stun','turn')},'value':{'type':Sequelize[_0x6073('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x6073('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 3ec51fc..34aaac3 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 _0xe36b=['key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Network','keys','merge','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','util','path','ejs','lodash','../../config/logger','api','../../config/environment','jayson/promise','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','undefined','limit','offset','count','set','Content-Range','update','destroy','name','index','map','rawAttributes','fieldName','type'];(function(_0x4156c4,_0x2df8b5){var _0xc48952=function(_0x36ae1b){while(--_0x36ae1b){_0x4156c4['push'](_0x4156c4['shift']());}};_0xc48952(++_0x2df8b5);}(_0xe36b,0x17b));var _0xbe36=function(_0x2ae7a2,_0x46ed3d){_0x2ae7a2=_0x2ae7a2-0x0;var _0x5693b6=_0xe36b[_0x2ae7a2];return _0x5693b6;};'use strict';var util=require(_0xbe36('0x0'));var path=require(_0xbe36('0x1'));var ejs=require(_0xbe36('0x2'));var fs=require('fs');var _=require(_0xbe36('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe36('0x4'))(_0xbe36('0x5'));var config=require(_0xbe36('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0xbe36('0x7'));var client=jayson['client'][_0xbe36('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4da183,_0x31427a,_0x5eb53f,_0x5d3a13){return new Promise(function(_0x30b2e7,_0x445496){var _0x32b71b=_0x5d3a13||client;return _0x32b71b['request'](_0x4da183,_0x5eb53f)[_0xbe36('0x9')](function(_0xf36405){logger[_0xbe36('0xa')](_0xbe36('0xb'),_0x31427a,_0xbe36('0xc'));logger[_0xbe36('0xd')](_0xbe36('0xe'),_0x31427a,_0xbe36('0xc'),JSON['stringify'](_0xf36405));if(_0xf36405[_0xbe36('0xf')]){if(_0xf36405[_0xbe36('0xf')][_0xbe36('0x10')]===0x1f4){logger['error'](_0xbe36('0xb'),_0x31427a,_0xf36405[_0xbe36('0xf')]['message']);return _0x445496(_0xf36405[_0xbe36('0xf')][_0xbe36('0x11')]);}logger[_0xbe36('0xf')]('Network,\x20%s,\x20%s',_0x31427a,_0xf36405[_0xbe36('0xf')][_0xbe36('0x11')]);return _0x30b2e7(_0xf36405['error'][_0xbe36('0x11')]);}else{logger[_0xbe36('0xa')](_0xbe36('0xb'),_0x31427a,_0xbe36('0xc'));_0x30b2e7(_0xf36405[_0xbe36('0x12')][_0xbe36('0x11')]);}})[_0xbe36('0x13')](function(_0x2201bd){logger['error']('Network,\x20%s,\x20%s',_0x31427a,_0x2201bd);_0x445496(_0x2201bd);});});}function respondWithResult(_0x6ad5bb,_0x22456d){_0x22456d=_0x22456d||0xc8;return function(_0x2dd0c1){if(_0x2dd0c1){return _0x6ad5bb[_0xbe36('0x14')](_0x22456d)[_0xbe36('0x15')](_0x2dd0c1);}};}function respondWithFilteredResult(_0x39370d,_0x34c5d3){return function(_0x34b1c2){if(_0x34b1c2){var _0x223ca5=typeof _0x34c5d3['offset']===_0xbe36('0x16')&&typeof _0x34c5d3[_0xbe36('0x17')]===_0xbe36('0x16');var _0x1c93fb=_0x34b1c2['count'];var _0x8325fa=_0x223ca5?0x0:_0x34c5d3[_0xbe36('0x18')];var _0xd9e2f1=_0x223ca5?_0x34b1c2[_0xbe36('0x19')]:_0x34c5d3[_0xbe36('0x18')]+_0x34c5d3[_0xbe36('0x17')];var _0x323c18;if(_0xd9e2f1>=_0x1c93fb){_0xd9e2f1=_0x1c93fb;_0x323c18=0xc8;}else{_0x323c18=0xce;}_0x39370d[_0xbe36('0x14')](_0x323c18);return _0x39370d[_0xbe36('0x1a')](_0xbe36('0x1b'),_0x8325fa+'-'+_0xd9e2f1+'/'+_0x1c93fb)[_0xbe36('0x15')](_0x34b1c2);}return null;};}function saveUpdates(_0x2a3792){return function(_0x38887c){if(_0x38887c){return _0x38887c[_0xbe36('0x1c')](_0x2a3792)[_0xbe36('0x9')](function(_0x5840b1){return _0x5840b1;});}return null;};}function removeEntity(_0x698330){return function(_0x928a45){if(_0x928a45){return _0x928a45[_0xbe36('0x1d')]()[_0xbe36('0x9')](function(){_0x698330[_0xbe36('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fdce5){return function(_0x53446b){if(!_0x53446b){_0x1fdce5['sendStatus'](0x194);}return _0x53446b;};}function handleError(_0xa2cee6,_0x1c6d2d){_0x1c6d2d=_0x1c6d2d||0x1f4;return function(_0x547b75){logger[_0xbe36('0xf')](_0x547b75['stack']);if(_0x547b75[_0xbe36('0x1e')]){delete _0x547b75['name'];}_0xa2cee6[_0xbe36('0x14')](_0x1c6d2d)['send'](_0x547b75);};}exports[_0xbe36('0x1f')]=function(_0x47e314,_0x47b50b){var _0x2e356a={},_0x128a48={},_0x14f582={'count':0x0,'rows':[]};var _0x36c02d=_[_0xbe36('0x20')](db['Network'][_0xbe36('0x21')],function(_0x4bcbaa){return{'name':_0x4bcbaa[_0xbe36('0x22')],'type':_0x4bcbaa[_0xbe36('0x23')][_0xbe36('0x24')]};});_0x128a48[_0xbe36('0x25')]=_['map'](_0x36c02d,_0xbe36('0x1e'));_0x128a48[_0xbe36('0x26')]=_['keys'](_0x47e314['query']);_0x128a48[_0xbe36('0x27')]=_[_0xbe36('0x28')](_0x128a48[_0xbe36('0x25')],_0x128a48[_0xbe36('0x26')]);_0x2e356a[_0xbe36('0x29')]=_['intersection'](_0x128a48[_0xbe36('0x25')],qs[_0xbe36('0x2a')](_0x47e314[_0xbe36('0x26')]['fields']));_0x2e356a['attributes']=_0x2e356a[_0xbe36('0x29')][_0xbe36('0x2b')]?_0x2e356a[_0xbe36('0x29')]:_0x128a48[_0xbe36('0x25')];if(!_0x47e314['query']['hasOwnProperty'](_0xbe36('0x2c'))){_0x2e356a['limit']=qs[_0xbe36('0x17')](_0x47e314[_0xbe36('0x26')][_0xbe36('0x17')]);_0x2e356a[_0xbe36('0x18')]=qs[_0xbe36('0x18')](_0x47e314[_0xbe36('0x26')][_0xbe36('0x18')]);}_0x2e356a[_0xbe36('0x2d')]=qs[_0xbe36('0x2e')](_0x47e314[_0xbe36('0x26')]['sort']);_0x2e356a[_0xbe36('0x2f')]=qs[_0xbe36('0x27')](_['pick'](_0x47e314[_0xbe36('0x26')],_0x128a48['filters']),_0x36c02d);if(_0x47e314[_0xbe36('0x26')][_0xbe36('0x30')]){_0x2e356a[_0xbe36('0x2f')]=_['merge'](_0x2e356a[_0xbe36('0x2f')],{'$or':_['map'](_0x36c02d,function(_0x3808af){if(_0x3808af[_0xbe36('0x23')]!==_0xbe36('0x31')){var _0x40a8ec={};_0x40a8ec[_0x3808af[_0xbe36('0x1e')]]={'$like':'%'+_0x47e314[_0xbe36('0x26')][_0xbe36('0x30')]+'%'};return _0x40a8ec;}})});}_0x2e356a=_['merge']({},_0x2e356a,_0x47e314[_0xbe36('0x32')]);var _0x31513b={'where':_0x2e356a[_0xbe36('0x2f')]};return db['Network'][_0xbe36('0x19')](_0x31513b)[_0xbe36('0x9')](function(_0x2b3e96){_0x14f582[_0xbe36('0x19')]=_0x2b3e96;if(_0x47e314[_0xbe36('0x26')][_0xbe36('0x33')]){_0x2e356a[_0xbe36('0x34')]=[{'all':!![]}];}return db['Network'][_0xbe36('0x35')](_0x2e356a);})[_0xbe36('0x9')](function(_0x5a48f2){_0x14f582[_0xbe36('0x36')]=_0x5a48f2;return _0x14f582;})[_0xbe36('0x9')](respondWithFilteredResult(_0x47b50b,_0x2e356a))[_0xbe36('0x13')](handleError(_0x47b50b,null));};exports[_0xbe36('0x37')]=function(_0x529ec7,_0x42b072){var _0x1285cf={'raw':!![],'where':{'id':_0x529ec7[_0xbe36('0x38')]['id']}},_0x233598={};_0x233598[_0xbe36('0x25')]=_['keys'](db[_0xbe36('0x39')][_0xbe36('0x21')]);_0x233598[_0xbe36('0x26')]=_[_0xbe36('0x3a')](_0x529ec7[_0xbe36('0x26')]);_0x233598[_0xbe36('0x27')]=_[_0xbe36('0x28')](_0x233598[_0xbe36('0x25')],_0x233598[_0xbe36('0x26')]);_0x1285cf['attributes']=_[_0xbe36('0x28')](_0x233598[_0xbe36('0x25')],qs[_0xbe36('0x2a')](_0x529ec7[_0xbe36('0x26')][_0xbe36('0x2a')]));_0x1285cf[_0xbe36('0x29')]=_0x1285cf['attributes'][_0xbe36('0x2b')]?_0x1285cf[_0xbe36('0x29')]:_0x233598[_0xbe36('0x25')];if(_0x529ec7[_0xbe36('0x26')][_0xbe36('0x33')]){_0x1285cf['include']=[{'all':!![]}];}_0x1285cf=_[_0xbe36('0x3b')]({},_0x1285cf,_0x529ec7['options']);return db[_0xbe36('0x39')][_0xbe36('0x3c')](_0x1285cf)[_0xbe36('0x9')](handleEntityNotFound(_0x42b072,null))[_0xbe36('0x9')](respondWithResult(_0x42b072,null))[_0xbe36('0x13')](handleError(_0x42b072,null));};exports[_0xbe36('0x3d')]=function(_0x473271,_0x136f26){var _0x525e7b;return db[_0xbe36('0x39')][_0xbe36('0x3d')](_0x473271[_0xbe36('0x3e')],{'raw':!![]})[_0xbe36('0x9')](function(_0x1f837d){_0x525e7b=_0x1f837d;return db[_0xbe36('0x39')][_0xbe36('0x35')]({'where':{'type':_0x473271[_0xbe36('0x3e')][_0xbe36('0x23')]},'raw':!![]});})[_0xbe36('0x9')](function(_0x4180b2){if(_0x525e7b[_0xbe36('0x23')][_0xbe36('0x3f')]()==_0xbe36('0x40')){var _0x4ed313=fs[_0xbe36('0x41')](path[_0xbe36('0x42')](config[_0xbe36('0x43')],_0xbe36('0x44')),_0xbe36('0x45'));var _0x5b794e=ejs['render'](_0x4ed313,{'networks':_0x4180b2||[]});fs[_0xbe36('0x46')](_0xbe36('0x47'),_0x5b794e);return respondWithRpcPromise(_0xbe36('0x48'),_0xbe36('0x3d'),{'module':'res_stun_monitor.so'});}else if(_0x525e7b[_0xbe36('0x23')][_0xbe36('0x3f')]()==_0xbe36('0x49')){var _0x2c77f0=fs[_0xbe36('0x41')](path[_0xbe36('0x42')](config[_0xbe36('0x43')],_0xbe36('0x4a')),_0xbe36('0x45'));var _0x4c23f5=ejs[_0xbe36('0x4b')](_0x2c77f0,{'networks':_0x4180b2||[]});fs[_0xbe36('0x46')](_0xbe36('0x4c'),_0x4c23f5);return respondWithRpcPromise('Reload',_0xbe36('0x3d'),{'module':_0xbe36('0x4d')});}else{var _0x11fcd5=fs['readFileSync'](path[_0xbe36('0x42')](config[_0xbe36('0x43')],_0xbe36('0x4e')),_0xbe36('0x45'));var _0x150d48=ejs[_0xbe36('0x4b')](_0x11fcd5,{'networks':_0x4180b2||[]});fs['writeFileSync'](util[_0xbe36('0x4f')](_0xbe36('0x50'),_0x473271[_0xbe36('0x3e')][_0xbe36('0x23')][_0xbe36('0x51')]()),_0x150d48);return respondWithRpcPromise(_0xbe36('0x48'),_0xbe36('0x3d'),{'module':_0xbe36('0x52')});}})[_0xbe36('0x9')](function(){return _0x525e7b;})[_0xbe36('0x9')](respondWithResult(_0x136f26,0xc9))[_0xbe36('0x13')](handleError(_0x136f26,null));};exports[_0xbe36('0x1c')]=function(_0x1391bf,_0x4da0c1){var _0x23c3d4;return db[_0xbe36('0x39')][_0xbe36('0x3c')]({'where':{'id':_0x1391bf[_0xbe36('0x38')]['id']}})[_0xbe36('0x9')](handleEntityNotFound(_0x4da0c1,null))[_0xbe36('0x9')](saveUpdates(_0x1391bf[_0xbe36('0x3e')],null))[_0xbe36('0x9')](function(_0x3ab9dc){if(_0x3ab9dc){_0x23c3d4=_0x3ab9dc;return db[_0xbe36('0x39')][_0xbe36('0x35')]({'where':{'type':_0x23c3d4['type']},'raw':!![]});}return null;})[_0xbe36('0x9')](function(_0x58178a){if(_0x23c3d4[_0xbe36('0x23')][_0xbe36('0x3f')]()==_0xbe36('0x40')){var _0x2368d9=fs['readFileSync'](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0xbe36('0x45'));var _0x1d7f41=ejs[_0xbe36('0x4b')](_0x2368d9,{'networks':_0x58178a||[]});fs[_0xbe36('0x46')](_0xbe36('0x47'),_0x1d7f41);return respondWithRpcPromise(_0xbe36('0x48'),_0xbe36('0x1c'),{'module':_0xbe36('0x4d')});}else if(_0x23c3d4['type']['toUpperCase']()==_0xbe36('0x49')){var _0x58f4a9=fs[_0xbe36('0x41')](path[_0xbe36('0x42')](config[_0xbe36('0x43')],_0xbe36('0x4a')),_0xbe36('0x45'));var _0x549524=ejs['render'](_0x58f4a9,{'networks':_0x58178a||[]});fs[_0xbe36('0x46')](_0xbe36('0x4c'),_0x549524);return respondWithRpcPromise(_0xbe36('0x48'),_0xbe36('0x1c'),{'module':_0xbe36('0x4d')});}else{var _0x543f1c=fs[_0xbe36('0x41')](path[_0xbe36('0x42')](config[_0xbe36('0x43')],_0xbe36('0x4e')),_0xbe36('0x45'));var _0x145e98=ejs[_0xbe36('0x4b')](_0x543f1c,{'networks':_0x58178a||[]});fs['writeFileSync'](util[_0xbe36('0x4f')](_0xbe36('0x50'),_0x1391bf[_0xbe36('0x3e')][_0xbe36('0x23')][_0xbe36('0x51')]()),_0x145e98);return respondWithRpcPromise(_0xbe36('0x48'),'update',{'module':_0xbe36('0x52')});}})[_0xbe36('0x9')](function(_0x1701de){if(_0x1701de){return _0x23c3d4;}return null;})[_0xbe36('0x9')](respondWithResult(_0x4da0c1,null))[_0xbe36('0x13')](handleError(_0x4da0c1,null));};exports['destroy']=function(_0x505011,_0x1f1889){var _0x3b0fe5;return db[_0xbe36('0x39')]['find']({'where':{'id':_0x505011[_0xbe36('0x38')]['id']}})[_0xbe36('0x9')](function(_0x5aa550){_0x3b0fe5=_0x5aa550;return _0x5aa550;})['then'](handleEntityNotFound(_0x1f1889,null))[_0xbe36('0x9')](removeEntity(_0x1f1889,null))['then'](function(){if(_0x3b0fe5){return db[_0xbe36('0x39')][_0xbe36('0x35')]({'where':{'type':_0x3b0fe5[_0xbe36('0x23')]},'raw':!![]});}})[_0xbe36('0x9')](function(_0x1d3683){if(_0x3b0fe5['type'][_0xbe36('0x3f')]()==_0xbe36('0x40')){var _0x41d983=fs[_0xbe36('0x41')](path['join'](config['root'],_0xbe36('0x44')),_0xbe36('0x45'));var _0x2fef57=ejs[_0xbe36('0x4b')](_0x41d983,{'networks':_0x1d3683||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2fef57);return respondWithRpcPromise(_0xbe36('0x48'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x3b0fe5[_0xbe36('0x23')][_0xbe36('0x3f')]()==_0xbe36('0x49')){var _0x32484a=fs['readFileSync'](path['join'](config[_0xbe36('0x43')],_0xbe36('0x4a')),'utf8');var _0x42de95=ejs[_0xbe36('0x4b')](_0x32484a,{'networks':_0x1d3683||[]});fs[_0xbe36('0x46')](_0xbe36('0x4c'),_0x42de95);return respondWithRpcPromise(_0xbe36('0x48'),_0xbe36('0x1d'),{'module':_0xbe36('0x4d')});}else{var _0x2c1711=fs[_0xbe36('0x41')](path[_0xbe36('0x42')](config[_0xbe36('0x43')],_0xbe36('0x4e')),'utf8');var _0x60f58e=ejs['render'](_0x2c1711,{'networks':_0x1d3683||[]});fs[_0xbe36('0x46')](util[_0xbe36('0x4f')](_0xbe36('0x50'),_0x3b0fe5[_0xbe36('0x23')][_0xbe36('0x51')]()),_0x60f58e);return respondWithRpcPromise(_0xbe36('0x48'),'destroy',{'module':_0xbe36('0x52')});}})[_0xbe36('0x13')](handleError(_0x1f1889,null));}; \ No newline at end of file +var _0x035d=['fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','options','Network','includeAll','include','show','params','keys','rawAttributes','find','create','body','findAll','toUpperCase','STUN','join','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','root','render','/etc/asterisk/turn_xcally.conf','Reload','readFileSync','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','chan_sip.so','destroy','lodash','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','limit','undefined','count','offset','set','update','end','sendStatus','stack','name','send','index'];(function(_0x10b185,_0x5c0479){var _0x579835=function(_0x5942c5){while(--_0x5942c5){_0x10b185['push'](_0x10b185['shift']());}};_0x579835(++_0x5c0479);}(_0x035d,0xe0));var _0xd035=function(_0x1c7876,_0x5cc2fb){_0x1c7876=_0x1c7876-0x0;var _0x23479b=_0x035d[_0x1c7876];return _0x23479b;};'use strict';var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd035('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xd035('0x1'))(_0xd035('0x2'));var config=require(_0xd035('0x3'));var db=require(_0xd035('0x4'))['db'];var jayson=require(_0xd035('0x5'));var client=jayson[_0xd035('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a1f13,_0x3478f6,_0x1f11e7,_0x6b8360){return new Promise(function(_0xb6c8cd,_0x467210){var _0x42e722=_0x6b8360||client;return _0x42e722[_0xd035('0x7')](_0x4a1f13,_0x1f11e7)[_0xd035('0x8')](function(_0x3145c3){logger[_0xd035('0x9')](_0xd035('0xa'),_0x3478f6,_0xd035('0xb'));logger[_0xd035('0xc')](_0xd035('0xd'),_0x3478f6,_0xd035('0xb'),JSON[_0xd035('0xe')](_0x3145c3));if(_0x3145c3[_0xd035('0xf')]){if(_0x3145c3['error'][_0xd035('0x10')]===0x1f4){logger[_0xd035('0xf')](_0xd035('0xa'),_0x3478f6,_0x3145c3[_0xd035('0xf')][_0xd035('0x11')]);return _0x467210(_0x3145c3['error']['message']);}logger[_0xd035('0xf')](_0xd035('0xa'),_0x3478f6,_0x3145c3[_0xd035('0xf')][_0xd035('0x11')]);return _0xb6c8cd(_0x3145c3[_0xd035('0xf')][_0xd035('0x11')]);}else{logger[_0xd035('0x9')](_0xd035('0xa'),_0x3478f6,_0xd035('0xb'));_0xb6c8cd(_0x3145c3[_0xd035('0x12')][_0xd035('0x11')]);}})[_0xd035('0x13')](function(_0x359ae8){logger[_0xd035('0xf')](_0xd035('0xa'),_0x3478f6,_0x359ae8);_0x467210(_0x359ae8);});});}function respondWithResult(_0x4ba5e6,_0x24c112){_0x24c112=_0x24c112||0xc8;return function(_0x37d61a){if(_0x37d61a){return _0x4ba5e6[_0xd035('0x14')](_0x24c112)[_0xd035('0x15')](_0x37d61a);}};}function respondWithFilteredResult(_0x33e80d,_0x2b3751){return function(_0xe842a5){if(_0xe842a5){var _0x34b2a6=typeof _0x2b3751['offset']==='undefined'&&typeof _0x2b3751[_0xd035('0x16')]===_0xd035('0x17');var _0x4812df=_0xe842a5[_0xd035('0x18')];var _0x393ef1=_0x34b2a6?0x0:_0x2b3751[_0xd035('0x19')];var _0x1c37c7=_0x34b2a6?_0xe842a5[_0xd035('0x18')]:_0x2b3751[_0xd035('0x19')]+_0x2b3751[_0xd035('0x16')];var _0x4b1632;if(_0x1c37c7>=_0x4812df){_0x1c37c7=_0x4812df;_0x4b1632=0xc8;}else{_0x4b1632=0xce;}_0x33e80d['status'](_0x4b1632);return _0x33e80d[_0xd035('0x1a')]('Content-Range',_0x393ef1+'-'+_0x1c37c7+'/'+_0x4812df)[_0xd035('0x15')](_0xe842a5);}return null;};}function saveUpdates(_0x3f5919){return function(_0x38f094){if(_0x38f094){return _0x38f094[_0xd035('0x1b')](_0x3f5919)[_0xd035('0x8')](function(_0x23d7db){return _0x23d7db;});}return null;};}function removeEntity(_0x5d955a){return function(_0x29c4be){if(_0x29c4be){return _0x29c4be['destroy']()['then'](function(){_0x5d955a[_0xd035('0x14')](0xcc)[_0xd035('0x1c')]();});}};}function handleEntityNotFound(_0x34b75b){return function(_0x35d8ad){if(!_0x35d8ad){_0x34b75b[_0xd035('0x1d')](0x194);}return _0x35d8ad;};}function handleError(_0x4ec055,_0x23c067){_0x23c067=_0x23c067||0x1f4;return function(_0x24da18){logger[_0xd035('0xf')](_0x24da18[_0xd035('0x1e')]);if(_0x24da18[_0xd035('0x1f')]){delete _0x24da18[_0xd035('0x1f')];}_0x4ec055[_0xd035('0x14')](_0x23c067)[_0xd035('0x20')](_0x24da18);};}exports[_0xd035('0x21')]=function(_0x3d2b6d,_0x417a65){var _0x1edc42={},_0x21bda1={},_0x4436c5={'count':0x0,'rows':[]};var _0x26400e=_['map'](db['Network']['rawAttributes'],function(_0x9d39bf){return{'name':_0x9d39bf[_0xd035('0x22')],'type':_0x9d39bf[_0xd035('0x23')][_0xd035('0x24')]};});_0x21bda1[_0xd035('0x25')]=_[_0xd035('0x26')](_0x26400e,_0xd035('0x1f'));_0x21bda1[_0xd035('0x27')]=_['keys'](_0x3d2b6d[_0xd035('0x27')]);_0x21bda1[_0xd035('0x28')]=_[_0xd035('0x29')](_0x21bda1[_0xd035('0x25')],_0x21bda1[_0xd035('0x27')]);_0x1edc42[_0xd035('0x2a')]=_[_0xd035('0x29')](_0x21bda1[_0xd035('0x25')],qs[_0xd035('0x2b')](_0x3d2b6d[_0xd035('0x27')][_0xd035('0x2b')]));_0x1edc42[_0xd035('0x2a')]=_0x1edc42['attributes'][_0xd035('0x2c')]?_0x1edc42[_0xd035('0x2a')]:_0x21bda1[_0xd035('0x25')];if(!_0x3d2b6d[_0xd035('0x27')][_0xd035('0x2d')](_0xd035('0x2e'))){_0x1edc42['limit']=qs['limit'](_0x3d2b6d[_0xd035('0x27')]['limit']);_0x1edc42[_0xd035('0x19')]=qs['offset'](_0x3d2b6d[_0xd035('0x27')][_0xd035('0x19')]);}_0x1edc42[_0xd035('0x2f')]=qs[_0xd035('0x30')](_0x3d2b6d[_0xd035('0x27')][_0xd035('0x30')]);_0x1edc42['where']=qs['filters'](_[_0xd035('0x31')](_0x3d2b6d['query'],_0x21bda1[_0xd035('0x28')]),_0x26400e);if(_0x3d2b6d[_0xd035('0x27')]['filter']){_0x1edc42[_0xd035('0x32')]=_['merge'](_0x1edc42[_0xd035('0x32')],{'$or':_[_0xd035('0x26')](_0x26400e,function(_0x4b6dee){if(_0x4b6dee[_0xd035('0x23')]!==_0xd035('0x33')){var _0xb09105={};_0xb09105[_0x4b6dee[_0xd035('0x1f')]]={'$like':'%'+_0x3d2b6d[_0xd035('0x27')]['filter']+'%'};return _0xb09105;}})});}_0x1edc42=_[_0xd035('0x34')]({},_0x1edc42,_0x3d2b6d[_0xd035('0x35')]);var _0x5d1f05={'where':_0x1edc42[_0xd035('0x32')]};return db[_0xd035('0x36')][_0xd035('0x18')](_0x5d1f05)['then'](function(_0x35ca3c){_0x4436c5[_0xd035('0x18')]=_0x35ca3c;if(_0x3d2b6d[_0xd035('0x27')][_0xd035('0x37')]){_0x1edc42[_0xd035('0x38')]=[{'all':!![]}];}return db[_0xd035('0x36')]['findAll'](_0x1edc42);})[_0xd035('0x8')](function(_0x35dabb){_0x4436c5['rows']=_0x35dabb;return _0x4436c5;})['then'](respondWithFilteredResult(_0x417a65,_0x1edc42))[_0xd035('0x13')](handleError(_0x417a65,null));};exports[_0xd035('0x39')]=function(_0x27ae15,_0x1ed4d9){var _0xe67457={'raw':!![],'where':{'id':_0x27ae15[_0xd035('0x3a')]['id']}},_0x3bdc78={};_0x3bdc78['model']=_[_0xd035('0x3b')](db['Network'][_0xd035('0x3c')]);_0x3bdc78[_0xd035('0x27')]=_['keys'](_0x27ae15[_0xd035('0x27')]);_0x3bdc78['filters']=_[_0xd035('0x29')](_0x3bdc78[_0xd035('0x25')],_0x3bdc78[_0xd035('0x27')]);_0xe67457[_0xd035('0x2a')]=_[_0xd035('0x29')](_0x3bdc78['model'],qs[_0xd035('0x2b')](_0x27ae15[_0xd035('0x27')]['fields']));_0xe67457[_0xd035('0x2a')]=_0xe67457['attributes']['length']?_0xe67457['attributes']:_0x3bdc78['model'];if(_0x27ae15[_0xd035('0x27')][_0xd035('0x37')]){_0xe67457[_0xd035('0x38')]=[{'all':!![]}];}_0xe67457=_[_0xd035('0x34')]({},_0xe67457,_0x27ae15[_0xd035('0x35')]);return db[_0xd035('0x36')][_0xd035('0x3d')](_0xe67457)[_0xd035('0x8')](handleEntityNotFound(_0x1ed4d9,null))[_0xd035('0x8')](respondWithResult(_0x1ed4d9,null))[_0xd035('0x13')](handleError(_0x1ed4d9,null));};exports[_0xd035('0x3e')]=function(_0x1994dc,_0x164eff){var _0x19b488;return db[_0xd035('0x36')][_0xd035('0x3e')](_0x1994dc[_0xd035('0x3f')],{'raw':!![]})[_0xd035('0x8')](function(_0x11ee59){_0x19b488=_0x11ee59;return db['Network'][_0xd035('0x40')]({'where':{'type':_0x1994dc[_0xd035('0x3f')][_0xd035('0x23')]},'raw':!![]});})[_0xd035('0x8')](function(_0x150110){if(_0x19b488['type'][_0xd035('0x41')]()==_0xd035('0x42')){var _0x3738e1=fs['readFileSync'](path[_0xd035('0x43')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xd035('0x44'));var _0x334555=ejs['render'](_0x3738e1,{'networks':_0x150110||[]});fs[_0xd035('0x45')](_0xd035('0x46'),_0x334555);return respondWithRpcPromise('Reload',_0xd035('0x3e'),{'module':_0xd035('0x47')});}else if(_0x19b488[_0xd035('0x23')]['toUpperCase']()==_0xd035('0x48')){var _0x1d87e2=fs['readFileSync'](path[_0xd035('0x43')](config[_0xd035('0x49')],'server/files/templates/turn_multiple.ejs'),_0xd035('0x44'));var _0x2c08d2=ejs[_0xd035('0x4a')](_0x1d87e2,{'networks':_0x150110||[]});fs[_0xd035('0x45')](_0xd035('0x4b'),_0x2c08d2);return respondWithRpcPromise(_0xd035('0x4c'),'create',{'module':_0xd035('0x47')});}else{var _0x25413f=fs[_0xd035('0x4d')](path[_0xd035('0x43')](config[_0xd035('0x49')],_0xd035('0x4e')),'utf8');var _0x1b0a3b=ejs[_0xd035('0x4a')](_0x25413f,{'networks':_0x150110||[]});fs['writeFileSync'](util[_0xd035('0x4f')](_0xd035('0x50'),_0x1994dc[_0xd035('0x3f')]['type'][_0xd035('0x51')]()),_0x1b0a3b);return respondWithRpcPromise(_0xd035('0x4c'),_0xd035('0x3e'),{'module':'chan_sip.so'});}})['then'](function(){return _0x19b488;})[_0xd035('0x8')](respondWithResult(_0x164eff,0xc9))[_0xd035('0x13')](handleError(_0x164eff,null));};exports[_0xd035('0x1b')]=function(_0x2fcd49,_0x10ec2c){var _0x1a371e;return db['Network'][_0xd035('0x3d')]({'where':{'id':_0x2fcd49[_0xd035('0x3a')]['id']}})[_0xd035('0x8')](handleEntityNotFound(_0x10ec2c,null))[_0xd035('0x8')](saveUpdates(_0x2fcd49['body'],null))['then'](function(_0x54b5f0){if(_0x54b5f0){_0x1a371e=_0x54b5f0;return db[_0xd035('0x36')][_0xd035('0x40')]({'where':{'type':_0x1a371e[_0xd035('0x23')]},'raw':!![]});}return null;})[_0xd035('0x8')](function(_0x2ee4ce){if(_0x1a371e[_0xd035('0x23')][_0xd035('0x41')]()==_0xd035('0x42')){var _0x3a6ae7=fs[_0xd035('0x4d')](path['join'](config[_0xd035('0x49')],_0xd035('0x52')),_0xd035('0x44'));var _0x4846d0=ejs[_0xd035('0x4a')](_0x3a6ae7,{'networks':_0x2ee4ce||[]});fs['writeFileSync'](_0xd035('0x46'),_0x4846d0);return respondWithRpcPromise(_0xd035('0x4c'),'update',{'module':_0xd035('0x47')});}else if(_0x1a371e[_0xd035('0x23')]['toUpperCase']()==_0xd035('0x48')){var _0xcb51cb=fs['readFileSync'](path[_0xd035('0x43')](config[_0xd035('0x49')],_0xd035('0x53')),_0xd035('0x44'));var _0x34c4c6=ejs[_0xd035('0x4a')](_0xcb51cb,{'networks':_0x2ee4ce||[]});fs[_0xd035('0x45')](_0xd035('0x4b'),_0x34c4c6);return respondWithRpcPromise(_0xd035('0x4c'),_0xd035('0x1b'),{'module':'res_stun_monitor.so'});}else{var _0x36c13c=fs[_0xd035('0x4d')](path[_0xd035('0x43')](config[_0xd035('0x49')],_0xd035('0x4e')),'utf8');var _0xad8f7c=ejs[_0xd035('0x4a')](_0x36c13c,{'networks':_0x2ee4ce||[]});fs[_0xd035('0x45')](util[_0xd035('0x4f')](_0xd035('0x50'),_0x2fcd49[_0xd035('0x3f')][_0xd035('0x23')][_0xd035('0x51')]()),_0xad8f7c);return respondWithRpcPromise(_0xd035('0x4c'),_0xd035('0x1b'),{'module':_0xd035('0x54')});}})[_0xd035('0x8')](function(_0x1dc5f1){if(_0x1dc5f1){return _0x1a371e;}return null;})[_0xd035('0x8')](respondWithResult(_0x10ec2c,null))[_0xd035('0x13')](handleError(_0x10ec2c,null));};exports[_0xd035('0x55')]=function(_0x1ab258,_0x182b6e){var _0x116163;return db[_0xd035('0x36')][_0xd035('0x3d')]({'where':{'id':_0x1ab258[_0xd035('0x3a')]['id']}})['then'](function(_0x938182){_0x116163=_0x938182;return _0x938182;})[_0xd035('0x8')](handleEntityNotFound(_0x182b6e,null))[_0xd035('0x8')](removeEntity(_0x182b6e,null))['then'](function(){if(_0x116163){return db[_0xd035('0x36')][_0xd035('0x40')]({'where':{'type':_0x116163['type']},'raw':!![]});}})[_0xd035('0x8')](function(_0x1ff9d3){if(_0x116163[_0xd035('0x23')]['toUpperCase']()==_0xd035('0x42')){var _0x2681f5=fs[_0xd035('0x4d')](path[_0xd035('0x43')](config[_0xd035('0x49')],_0xd035('0x52')),_0xd035('0x44'));var _0x2f1b39=ejs[_0xd035('0x4a')](_0x2681f5,{'networks':_0x1ff9d3||[]});fs[_0xd035('0x45')](_0xd035('0x46'),_0x2f1b39);return respondWithRpcPromise(_0xd035('0x4c'),_0xd035('0x55'),{'module':_0xd035('0x47')});}else if(_0x116163['type'][_0xd035('0x41')]()==_0xd035('0x48')){var _0x4cc1c6=fs[_0xd035('0x4d')](path[_0xd035('0x43')](config[_0xd035('0x49')],_0xd035('0x53')),'utf8');var _0x298c79=ejs[_0xd035('0x4a')](_0x4cc1c6,{'networks':_0x1ff9d3||[]});fs[_0xd035('0x45')](_0xd035('0x4b'),_0x298c79);return respondWithRpcPromise(_0xd035('0x4c'),_0xd035('0x55'),{'module':_0xd035('0x47')});}else{var _0x4c26ba=fs[_0xd035('0x4d')](path[_0xd035('0x43')](config['root'],_0xd035('0x4e')),_0xd035('0x44'));var _0x167669=ejs[_0xd035('0x4a')](_0x4c26ba,{'networks':_0x1ff9d3||[]});fs[_0xd035('0x45')](util[_0xd035('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x116163[_0xd035('0x23')][_0xd035('0x51')]()),_0x167669);return respondWithRpcPromise(_0xd035('0x4c'),_0xd035('0x55'),{'module':_0xd035('0x54')});}})[_0xd035('0x13')](handleError(_0x182b6e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 3545c2f..c91905d 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 _0xca66=['api','moment','bluebird','path','../../config/environment','exports','define','Network','network','lodash'];(function(_0x4bc452,_0x4afdd6){var _0x307aca=function(_0x56db6b){while(--_0x56db6b){_0x4bc452['push'](_0x4bc452['shift']());}};_0x307aca(++_0x4afdd6);}(_0xca66,0x8b));var _0x6ca6=function(_0x453436,_0x57717f){_0x453436=_0x453436-0x0;var _0x26b6e3=_0xca66[_0x453436];return _0x26b6e3;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ca6('0x1'));var moment=require(_0x6ca6('0x2'));var BPromise=require(_0x6ca6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ca6('0x4'));var rimraf=require('rimraf');var config=require(_0x6ca6('0x5'));var attributes=require('./network.attributes');module[_0x6ca6('0x6')]=function(_0x27d8c6,_0x34836f){return _0x27d8c6[_0x6ca6('0x7')](_0x6ca6('0x8'),attributes,{'tableName':_0x6ca6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b73=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','Network','network','util'];(function(_0x8cbb1d,_0x2fb2d0){var _0x1b8275=function(_0x28835b){while(--_0x28835b){_0x8cbb1d['push'](_0x8cbb1d['shift']());}};_0x1b8275(++_0x2fb2d0);}(_0x1b73,0x1d5));var _0x31b7=function(_0x4fbc80,_0x5d3eb7){_0x4fbc80=_0x4fbc80-0x0;var _0x4ed9b0=_0x1b73[_0x4fbc80];return _0x4ed9b0;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var logger=require(_0x31b7('0x1'))(_0x31b7('0x2'));var moment=require(_0x31b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x31b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31b7('0x5'));var config=require(_0x31b7('0x6'));var attributes=require('./network.attributes');module[_0x31b7('0x7')]=function(_0x3d058f,_0x15c31e){return _0x3d058f['define'](_0x31b7('0x8'),attributes,{'tableName':_0x31b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 081fc26..173f33e 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 _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x24967f,_0x563a43){_0x24967f=_0x24967f-0x0;var _0x2d638b=_0x7a54[_0x24967f];return _0x2d638b;};'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')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x44c433,_0x29ed64){_0x44c433=_0x44c433-0x0;var _0x3770d2=_0x7a54[_0x44c433];return _0x3770d2;};'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')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index ce5ab37..03b5f15 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 _0x4bd3=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','/:id/dispositions','addDisposition','post','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','delete','removeDispositions','removeAnswers','exports','multer','path'];(function(_0x3059aa,_0x400a77){var _0x4cca35=function(_0x44eac8){while(--_0x44eac8){_0x3059aa['push'](_0x3059aa['shift']());}};_0x4cca35(++_0x400a77);}(_0x4bd3,0x174));var _0x34bd=function(_0x444a75,_0x37960d){_0x444a75=_0x444a75-0x0;var _0x24d071=_0x4bd3[_0x444a75];return _0x24d071;};'use strict';var multer=require(_0x34bd('0x0'));var util=require('util');var path=require(_0x34bd('0x1'));var timeout=require(_0x34bd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x34bd('0x3'));var interaction=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var controller=require('./openchannelAccount.controller');router[_0x34bd('0x6')]('/',auth[_0x34bd('0x7')](),controller['index']);router[_0x34bd('0x6')](_0x34bd('0x8'),auth['isAuthenticated'](),controller[_0x34bd('0x9')]);router[_0x34bd('0x6')](_0x34bd('0xa'),auth[_0x34bd('0x7')](),controller[_0x34bd('0xb')]);router[_0x34bd('0x6')]('/:id/dispositions',auth[_0x34bd('0x7')](),controller[_0x34bd('0xc')]);router[_0x34bd('0x6')](_0x34bd('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x34bd('0x6')]('/:id/applications',auth['isAuthenticated'](),controller[_0x34bd('0xe')]);router[_0x34bd('0x6')](_0x34bd('0xf'),auth[_0x34bd('0x7')](),controller[_0x34bd('0x10')]);router[_0x34bd('0x6')](_0x34bd('0x11'),auth[_0x34bd('0x7')](),controller[_0x34bd('0x12')]);router['post']('/',auth[_0x34bd('0x7')](),controller['create']);router['post'](_0x34bd('0x13'),auth[_0x34bd('0x7')](),controller[_0x34bd('0x14')]);router[_0x34bd('0x15')](_0x34bd('0xd'),auth[_0x34bd('0x7')](),controller[_0x34bd('0x16')]);router[_0x34bd('0x15')](_0x34bd('0x17'),controller[_0x34bd('0x18')]);router[_0x34bd('0x15')]('/:id/applications',auth[_0x34bd('0x7')](),controller[_0x34bd('0x19')]);router[_0x34bd('0x15')](_0x34bd('0x11'),auth[_0x34bd('0x7')](),controller[_0x34bd('0x1a')]);router[_0x34bd('0x15')](_0x34bd('0x1b'),auth[_0x34bd('0x7')](),controller['send']);router[_0x34bd('0x1c')](_0x34bd('0xa'),auth[_0x34bd('0x7')](),controller[_0x34bd('0x1d')]);router[_0x34bd('0x1e')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x34bd('0x13'),auth['isAuthenticated'](),controller[_0x34bd('0x1f')]);router[_0x34bd('0x1e')](_0x34bd('0xd'),auth['isAuthenticated'](),controller[_0x34bd('0x20')]);router[_0x34bd('0x1e')](_0x34bd('0x11'),auth[_0x34bd('0x7')](),controller['removeAgents']);module[_0x34bd('0x21')]=router; \ No newline at end of file +var _0x5eb8=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getAgents','post','create','addDisposition','notify','/:id/applications','addApplications','addAgents','update','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5bff9e,_0x39ea3a){_0x5bff9e=_0x5bff9e-0x0;var _0x7f42ef=_0x5eb8[_0x5bff9e];return _0x7f42ef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/applications',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x9')](_0x85eb('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x85eb('0x9')]('/:id/users',auth[_0x85eb('0xa')](),controller[_0x85eb('0x16')]);router[_0x85eb('0x17')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0x18')]);router['post'](_0x85eb('0x10'),auth['isAuthenticated'](),controller[_0x85eb('0x19')]);router[_0x85eb('0x17')](_0x85eb('0x12'),auth[_0x85eb('0xa')](),controller['addAnswer']);router['post']('/:id/notify',controller[_0x85eb('0x1a')]);router[_0x85eb('0x17')](_0x85eb('0x1b'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x1c')]);router[_0x85eb('0x17')]('/:id/users',auth[_0x85eb('0xa')](),controller[_0x85eb('0x1d')]);router[_0x85eb('0x17')]('/:id/send',auth['isAuthenticated'](),controller['send']);router['put'](_0x85eb('0xe'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x1e')]);router[_0x85eb('0x1f')](_0x85eb('0xe'),auth[_0x85eb('0xa')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x85eb('0xa')](),controller[_0x85eb('0x20')]);router[_0x85eb('0x1f')](_0x85eb('0x12'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x21')]);router['delete'](_0x85eb('0x22'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x23')]);module[_0x85eb('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index acc6e84..1f719f6 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 _0xb442=['STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name'];(function(_0x26acf6,_0x14316){var _0x28fc93=function(_0x151eb6){while(--_0x151eb6){_0x26acf6['push'](_0x26acf6['shift']());}};_0x28fc93(++_0x14316);}(_0xb442,0x1e8));var _0x2b44=function(_0x24079b,_0x473683){_0x24079b=_0x24079b-0x0;var _0x40276d=_0xb442[_0x24079b];return _0x40276d;};'use strict';var Sequelize=require(_0x2b44('0x0'));var rs=require(_0x2b44('0x1'));module[_0x2b44('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x2b44('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2b44('0x4')]},'token':{'type':Sequelize[_0x2b44('0x4')],'defaultValue':function(){return rs[_0x2b44('0x5')]();}},'replyUri':{'type':Sequelize[_0x2b44('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2b44('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2b44('0x6');}},'notificationSound':{'type':Sequelize[_0x2b44('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2b44('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2b44('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2b44('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2b44('0x4')]},'queueTransfer':{'type':Sequelize[_0x2b44('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2b44('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2b44('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2b44('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2b44('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x2b44('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x2b44('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5b1108){if(!_0x5b1108)this[_0x2b44('0xa')]('mandatoryDispositionPauseId',null);this[_0x2b44('0xa')](_0x2b44('0xb'),_0x5b1108);}}}; \ No newline at end of file +var _0x55c6=['mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING','name','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'];(function(_0x7a242a,_0x423353){var _0x3b20c3=function(_0x467c4e){while(--_0x467c4e){_0x7a242a['push'](_0x7a242a['shift']());}};_0x3b20c3(++_0x423353);}(_0x55c6,0x17b));var _0x655c=function(_0x2426fa,_0x4a5015){_0x2426fa=_0x2426fa-0x0;var _0x40aabb=_0x55c6[_0x2426fa];return _0x40aabb;};'use strict';var Sequelize=require(_0x655c('0x0'));var rs=require(_0x655c('0x1'));module[_0x655c('0x2')]={'name':{'type':Sequelize[_0x655c('0x3')],'unique':_0x655c('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x655c('0x3')]},'token':{'type':Sequelize[_0x655c('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x655c('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x655c('0x5')],'defaultValue':function(){return _0x655c('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x655c('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x655c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x655c('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x655c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x655c('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x655c('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x655c('0x7')],'defaultValue':![],'comment':_0x655c('0xa'),'set':function(_0x28dded){if(!_0x28dded)this['setDataValue'](_0x655c('0xb'),null);this[_0x655c('0xc')]('mandatoryDisposition',_0x28dded);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b82ba65..ad1462f 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 _0x323e=['omit','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','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','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then','destroy','get','OpenchannelAccounts','stack','name','send','index','Pause','OpenchannelAccount','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','mandatoryDispositionPause','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','CannedAnswer','map','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','Sequelize','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','updatedAt','DESC','OpenchannelApplication','Applications','applications','List','orderBy','priority','asc','account','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','contact','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','waitForTheAssignedQueue','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','getInteractions','fullname','internal','Tag','tag','addAgents'];(function(_0x2588ad,_0x4ad81b){var _0x262404=function(_0x1eeb62){while(--_0x1eeb62){_0x2588ad['push'](_0x2588ad['shift']());}};_0x262404(++_0x4ad81b);}(_0x323e,0x188));var _0xe323=function(_0x522df5,_0x3364ae){_0x522df5=_0x522df5-0x0;var _0x3fffd4=_0x323e[_0x522df5];return _0x3fffd4;};'use strict';var emlformat=require(_0xe323('0x0'));var rimraf=require(_0xe323('0x1'));var zipdir=require(_0xe323('0x2'));var jsonpatch=require(_0xe323('0x3'));var rp=require(_0xe323('0x4'));var moment=require(_0xe323('0x5'));var BPromise=require(_0xe323('0x6'));var Mustache=require(_0xe323('0x7'));var util=require(_0xe323('0x8'));var path=require(_0xe323('0x9'));var sox=require(_0xe323('0xa'));var csv=require(_0xe323('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe323('0xc'));var _=require('lodash');var squel=require(_0xe323('0xd'));var crypto=require(_0xe323('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe323('0xf'));var toCsv=require(_0xe323('0xb'));var querystring=require(_0xe323('0x10'));var Papa=require(_0xe323('0x11'));var Redis=require(_0xe323('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe323('0x13'));var as=require(_0xe323('0x14'));var hardwareService=require(_0xe323('0x15'));var logger=require(_0xe323('0x16'))(_0xe323('0x17'));var utils=require(_0xe323('0x18'));var config=require(_0xe323('0x19'));var licenseUtil=require(_0xe323('0x1a'));var db=require(_0xe323('0x1b'))['db'];config[_0xe323('0x1c')]=_[_0xe323('0x1d')](config['redis'],{'host':_0xe323('0x1e'),'port':0x18eb});var socket=require(_0xe323('0x1f'))(new Redis(config[_0xe323('0x1c')]));require(_0xe323('0x20'))[_0xe323('0x21')](socket);var jayson=require(_0xe323('0x22'));var client=jayson['client'][_0xe323('0x23')]({'port':0x232c});var client9002=jayson['client'][_0xe323('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2ba55b,_0x12aab8,_0x19e749,_0x1bc115){return new BPromise(function(_0x25c213,_0x18d377){var _0xf55ce1=_0x1bc115||client;return _0xf55ce1['request'](_0x2ba55b,_0x19e749)['then'](function(_0x53dc09){logger[_0xe323('0x24')](_0xe323('0x25'),_0x12aab8,_0xe323('0x26'));logger[_0xe323('0x27')](_0xe323('0x28'),_0x12aab8,_0xe323('0x26'),JSON[_0xe323('0x29')](_0x53dc09));if(_0x53dc09['error']){if(_0x53dc09[_0xe323('0x2a')][_0xe323('0x2b')]===0x1f4){logger[_0xe323('0x2a')](_0xe323('0x25'),_0x12aab8,_0x53dc09['error'][_0xe323('0x2c')]);return _0x18d377(_0x53dc09['error'][_0xe323('0x2c')]);}logger[_0xe323('0x2a')](_0xe323('0x25'),_0x12aab8,_0x53dc09[_0xe323('0x2a')][_0xe323('0x2c')]);return _0x25c213(_0x53dc09[_0xe323('0x2a')][_0xe323('0x2c')]);}else{logger[_0xe323('0x24')](_0xe323('0x25'),_0x12aab8,_0xe323('0x26'));_0x25c213(_0x53dc09['result'][_0xe323('0x2c')]);}})[_0xe323('0x2d')](function(_0x473be5){logger[_0xe323('0x2a')](_0xe323('0x25'),_0x12aab8,_0x473be5);_0x18d377(_0x473be5);});});}function respondWithStatusCode(_0x43bf49,_0x17970e){_0x17970e=_0x17970e||0xcc;return function(_0x2019ab){if(_0x2019ab){return _0x43bf49[_0xe323('0x2e')](_0x17970e);}return _0x43bf49[_0xe323('0x2f')](_0x17970e)['end']();};}function respondWithResult(_0x592bf0,_0x153363){_0x153363=_0x153363||0xc8;return function(_0x49e6d1){if(_0x49e6d1){return _0x592bf0[_0xe323('0x2f')](_0x153363)['json'](_0x49e6d1);}};}function respondWithFilteredResult(_0x3b1333,_0x37f6f1){return function(_0x1610fd){if(_0x1610fd){var _0x2f1a6b=typeof _0x37f6f1[_0xe323('0x30')]===_0xe323('0x31')&&typeof _0x37f6f1['limit']===_0xe323('0x31');var _0x2da913=_0x1610fd[_0xe323('0x32')];var _0x3db860=_0x2f1a6b?0x0:_0x37f6f1[_0xe323('0x30')];var _0x3a0193=_0x2f1a6b?_0x1610fd[_0xe323('0x32')]:_0x37f6f1[_0xe323('0x30')]+_0x37f6f1[_0xe323('0x33')];var _0x372eaf;if(_0x3a0193>=_0x2da913){_0x3a0193=_0x2da913;_0x372eaf=0xc8;}else{_0x372eaf=0xce;}_0x3b1333[_0xe323('0x2f')](_0x372eaf);return _0x3b1333['set'](_0xe323('0x34'),_0x3db860+'-'+_0x3a0193+'/'+_0x2da913)[_0xe323('0x35')](_0x1610fd);}return null;};}function patchUpdates(_0x20c0f1){return function(_0x54d926){try{jsonpatch[_0xe323('0x36')](_0x54d926,_0x20c0f1,!![]);}catch(_0x138308){return BPromise[_0xe323('0x37')](_0x138308);}return _0x54d926['save']();};}function saveUpdates(_0x586511,_0x408a13){return function(_0x185db8){if(_0x185db8){return _0x185db8[_0xe323('0x38')](_0x586511)[_0xe323('0x39')](function(_0x2263b0){return _0x2263b0;});}return null;};}function removeEntity(_0x1b557b,_0x80f3bb){return function(_0x5ca1a1){if(_0x5ca1a1){return _0x5ca1a1[_0xe323('0x3a')]()[_0xe323('0x39')](function(){var _0x3eda9f=_0x5ca1a1[_0xe323('0x3b')]({'plain':!![]});var _0x893d92=_0xe323('0x3c');return db['UserProfileResource'][_0xe323('0x3a')]({'where':{'type':_0x893d92,'resourceId':_0x3eda9f['id']}})[_0xe323('0x39')](function(){return _0x5ca1a1;});})[_0xe323('0x39')](function(){_0x1b557b[_0xe323('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2caf27,_0x3c7e5c){return function(_0x5ddf48){if(!_0x5ddf48){_0x2caf27[_0xe323('0x2e')](0x194);}return _0x5ddf48;};}function handleError(_0x235075,_0x4a610b){_0x4a610b=_0x4a610b||0x1f4;return function(_0x595f13){logger[_0xe323('0x2a')](_0x595f13[_0xe323('0x3d')]);if(_0x595f13[_0xe323('0x3e')]){delete _0x595f13[_0xe323('0x3e')];}_0x235075[_0xe323('0x2f')](_0x4a610b)[_0xe323('0x3f')](_0x595f13);};}exports[_0xe323('0x40')]=function(_0x5a580f,_0x20825d){var _0x1aa22e={'include':[{'model':db[_0xe323('0x41')],'as':'mandatoryDispositionPause'}]},_0x17e2b5={},_0x42c7ef={'count':0x0,'rows':[]};var _0x56917b=_['map'](db[_0xe323('0x42')]['rawAttributes'],function(_0x3380d3){return{'name':_0x3380d3[_0xe323('0x43')],'type':_0x3380d3[_0xe323('0x44')]['key']};});_0x17e2b5[_0xe323('0x45')]=_['map'](_0x56917b,_0xe323('0x3e'));_0x17e2b5[_0xe323('0x46')]=_[_0xe323('0x47')](_0x5a580f[_0xe323('0x46')]);_0x17e2b5['filters']=_[_0xe323('0x48')](_0x17e2b5[_0xe323('0x45')],_0x17e2b5[_0xe323('0x46')]);_0x1aa22e[_0xe323('0x49')]=_[_0xe323('0x48')](_0x17e2b5['model'],qs[_0xe323('0x4a')](_0x5a580f[_0xe323('0x46')][_0xe323('0x4a')]));_0x1aa22e['attributes']=_0x1aa22e['attributes'][_0xe323('0x4b')]?_0x1aa22e['attributes']:_0x17e2b5[_0xe323('0x45')];if(!_0x5a580f[_0xe323('0x46')][_0xe323('0x4c')](_0xe323('0x4d'))){_0x1aa22e[_0xe323('0x33')]=qs[_0xe323('0x33')](_0x5a580f[_0xe323('0x46')]['limit']);_0x1aa22e[_0xe323('0x30')]=qs[_0xe323('0x30')](_0x5a580f[_0xe323('0x46')][_0xe323('0x30')]);}_0x1aa22e[_0xe323('0x4e')]=qs[_0xe323('0x4f')](_0x5a580f[_0xe323('0x46')]['sort']);_0x1aa22e[_0xe323('0x50')]=qs[_0xe323('0x51')](_[_0xe323('0x52')](_0x5a580f[_0xe323('0x46')],_0x17e2b5[_0xe323('0x51')]),_0x56917b);if(_0x5a580f[_0xe323('0x46')][_0xe323('0x53')]){_0x1aa22e[_0xe323('0x50')]=_[_0xe323('0x54')](_0x1aa22e[_0xe323('0x50')],{'$or':_['map'](_0x56917b,function(_0x2fd6c6){if(_0x2fd6c6[_0xe323('0x44')]!==_0xe323('0x55')){var _0x6097b3={};_0x6097b3[_0x2fd6c6['name']]={'$like':'%'+_0x5a580f[_0xe323('0x46')][_0xe323('0x53')]+'%'};return _0x6097b3;}})});}_0x1aa22e=_['merge']({},_0x1aa22e,_0x5a580f[_0xe323('0x56')]);var _0x176701={'where':_0x1aa22e[_0xe323('0x50')]};return db['OpenchannelAccount'][_0xe323('0x32')](_0x176701)['then'](function(_0x38dfdd){_0x42c7ef[_0xe323('0x32')]=_0x38dfdd;if(_0x5a580f['query'][_0xe323('0x57')]){_0x1aa22e[_0xe323('0x58')]=[{'all':!![]}];}return db[_0xe323('0x42')][_0xe323('0x59')](_0x1aa22e);})[_0xe323('0x39')](function(_0x3d0049){_0x42c7ef['rows']=_0x3d0049;return _0x42c7ef;})['then'](respondWithFilteredResult(_0x20825d,_0x1aa22e))[_0xe323('0x2d')](handleError(_0x20825d,null));};exports[_0xe323('0x5a')]=function(_0x264f65,_0x59a087){var _0xbe19e8={'raw':![],'where':{'id':_0x264f65[_0xe323('0x5b')]['id']},'include':[{'model':db[_0xe323('0x41')],'as':_0xe323('0x5c')}]},_0xccf771={};_0xccf771[_0xe323('0x45')]=_['keys'](db[_0xe323('0x42')][_0xe323('0x5d')]);_0xccf771[_0xe323('0x46')]=_['keys'](_0x264f65[_0xe323('0x46')]);_0xccf771[_0xe323('0x51')]=_['intersection'](_0xccf771[_0xe323('0x45')],_0xccf771[_0xe323('0x46')]);_0xbe19e8[_0xe323('0x49')]=_[_0xe323('0x48')](_0xccf771['model'],qs[_0xe323('0x4a')](_0x264f65[_0xe323('0x46')][_0xe323('0x4a')]));_0xbe19e8[_0xe323('0x49')]=_0xbe19e8[_0xe323('0x49')][_0xe323('0x4b')]?_0xbe19e8[_0xe323('0x49')]:_0xccf771[_0xe323('0x45')];if(_0x264f65[_0xe323('0x46')]['includeAll']){_0xbe19e8[_0xe323('0x58')]=[{'all':!![]}];}_0xbe19e8=_[_0xe323('0x54')]({},_0xbe19e8,_0x264f65[_0xe323('0x56')]);return db[_0xe323('0x42')][_0xe323('0x5e')](_0xbe19e8)['then'](handleEntityNotFound(_0x59a087,null))[_0xe323('0x39')](respondWithResult(_0x59a087,null))['catch'](handleError(_0x59a087,null));};exports['create']=function(_0x2d0804,_0xee62d1){return db['OpenchannelAccount'][_0xe323('0x5f')](_0x2d0804['body'],{})[_0xe323('0x39')](function(_0x30efe5){var _0x27a2a2=_0x2d0804[_0xe323('0x60')][_0xe323('0x3b')]({'plain':!![]});if(!_0x27a2a2)throw new Error(_0xe323('0x61'));if(_0x27a2a2[_0xe323('0x62')]===_0xe323('0x60')){var _0x3aa671=_0x30efe5['get']({'plain':!![]});var _0x2409e9='OpenchannelAccounts';return db[_0xe323('0x63')]['find']({'where':{'name':_0x2409e9,'userProfileId':_0x27a2a2[_0xe323('0x64')]},'raw':!![]})[_0xe323('0x39')](function(_0x162706){if(_0x162706&&_0x162706[_0xe323('0x65')]===0x0){return db[_0xe323('0x66')][_0xe323('0x5f')]({'name':_0x3aa671[_0xe323('0x3e')],'resourceId':_0x3aa671['id'],'type':_0x162706['name'],'sectionId':_0x162706['id']},{})[_0xe323('0x39')](function(){return _0x30efe5;});}else{return _0x30efe5;}})[_0xe323('0x2d')](function(_0x5628dc){logger[_0xe323('0x2a')](_0xe323('0x67'),_0x5628dc);throw _0x5628dc;});}return _0x30efe5;})[_0xe323('0x39')](respondWithResult(_0xee62d1,0xc9))[_0xe323('0x2d')](handleError(_0xee62d1,null));};exports['update']=function(_0x6f1f54,_0x4ba275){if(_0x6f1f54[_0xe323('0x68')]['id']){delete _0x6f1f54[_0xe323('0x68')]['id'];}return db[_0xe323('0x42')]['find']({'where':{'id':_0x6f1f54[_0xe323('0x5b')]['id']},'include':[{'model':db[_0xe323('0x41')],'as':_0xe323('0x5c')}]})[_0xe323('0x39')](handleEntityNotFound(_0x4ba275,null))[_0xe323('0x39')](saveUpdates(_0x6f1f54['body'],null))['then'](respondWithResult(_0x4ba275,null))[_0xe323('0x2d')](handleError(_0x4ba275,null));};exports[_0xe323('0x3a')]=function(_0x508fee,_0x56ccd1){return db[_0xe323('0x42')]['find']({'where':{'id':_0x508fee['params']['id']}})[_0xe323('0x39')](handleEntityNotFound(_0x56ccd1,null))[_0xe323('0x39')](removeEntity(_0x56ccd1,null))[_0xe323('0x2d')](handleError(_0x56ccd1,null));};exports[_0xe323('0x69')]=function(_0x3ef51b,_0x255be4){return db[_0xe323('0x42')]['describe']()[_0xe323('0x39')](respondWithResult(_0x255be4,null))['catch'](handleError(_0x255be4,null));};exports['addDisposition']=function(_0x2778e7,_0x45e62f,_0x40e28b){if(_0x2778e7[_0xe323('0x68')]['id']){delete _0x2778e7[_0xe323('0x68')]['id'];}return db[_0xe323('0x42')][_0xe323('0x5e')]({'where':{'id':_0x2778e7[_0xe323('0x5b')]['id']}})[_0xe323('0x39')](handleEntityNotFound(_0x45e62f,null))[_0xe323('0x39')](function(_0x45222e){if(_0x45222e){_0x2778e7[_0xe323('0x68')][_0xe323('0x6a')]=_0x45222e['id'];return db[_0xe323('0x6b')]['create'](_0x2778e7['body']);}})[_0xe323('0x39')](respondWithResult(_0x45e62f,null))[_0xe323('0x2d')](handleError(_0x45e62f,null));};exports[_0xe323('0x6c')]=function(_0x47c5aa,_0xd0e7de,_0x3f845f){var _0x2e2711={'raw':![],'where':{}};var _0x10f329={};var _0x29d99d={'count':0x0,'rows':[]};return db[_0xe323('0x42')][_0xe323('0x6d')]({'where':{'id':_0x47c5aa[_0xe323('0x5b')]['id']}})[_0xe323('0x39')](handleEntityNotFound(_0xd0e7de,null))[_0xe323('0x39')](function(_0x3cdf53){if(_0x3cdf53){_0x10f329['model']=_[_0xe323('0x47')](db['Disposition']['rawAttributes']);_0x10f329[_0xe323('0x46')]=_[_0xe323('0x47')](_0x47c5aa[_0xe323('0x46')]);_0x10f329['filters']=_[_0xe323('0x48')](_0x10f329[_0xe323('0x45')],_0x10f329[_0xe323('0x46')]);_0x2e2711[_0xe323('0x49')]=_[_0xe323('0x48')](_0x10f329[_0xe323('0x45')],qs[_0xe323('0x4a')](_0x47c5aa[_0xe323('0x46')]['fields']));_0x2e2711[_0xe323('0x49')]=_0x2e2711[_0xe323('0x49')][_0xe323('0x4b')]?_0x2e2711['attributes']:_0x10f329['model'];if(!_0x47c5aa[_0xe323('0x46')]['hasOwnProperty'](_0xe323('0x4d'))){_0x2e2711[_0xe323('0x33')]=qs[_0xe323('0x33')](_0x47c5aa[_0xe323('0x46')][_0xe323('0x33')]);_0x2e2711['offset']=qs[_0xe323('0x30')](_0x47c5aa[_0xe323('0x46')]['offset']);}_0x2e2711[_0xe323('0x4e')]=qs['sort'](_0x47c5aa[_0xe323('0x46')][_0xe323('0x4f')]);_0x2e2711[_0xe323('0x50')]=qs[_0xe323('0x51')](_[_0xe323('0x52')](_0x47c5aa[_0xe323('0x46')],_0x10f329[_0xe323('0x51')]));_0x2e2711[_0xe323('0x50')][_0xe323('0x6a')]=_0x3cdf53['id'];if(_0x47c5aa['query'][_0xe323('0x53')]){_0x2e2711[_0xe323('0x50')]=_[_0xe323('0x54')](_0x2e2711[_0xe323('0x50')],{'$or':_['map'](_0x2e2711[_0xe323('0x49')],function(_0xf36b44){var _0x3b768c={};_0x3b768c[_0xf36b44]={'$like':'%'+_0x47c5aa['query']['filter']+'%'};return _0x3b768c;})});}_0x2e2711=_[_0xe323('0x54')]({},_0x2e2711,_0x47c5aa[_0xe323('0x56')]);return db['Disposition'][_0xe323('0x32')]({'where':_0x2e2711[_0xe323('0x50')]})['then'](function(_0x2da5e9){_0x29d99d[_0xe323('0x32')]=_0x2da5e9;if(_0x47c5aa[_0xe323('0x46')]['includeAll']){_0x2e2711[_0xe323('0x58')]=[{'all':!![]}];}return db['Disposition'][_0xe323('0x59')](_0x2e2711);})['then'](function(_0x577962){_0x29d99d[_0xe323('0x6e')]=_0x577962;return _0x29d99d;});}})[_0xe323('0x39')](respondWithFilteredResult(_0xd0e7de,_0x2e2711))['catch'](handleError(_0xd0e7de,null));};exports[_0xe323('0x6f')]=function(_0x3eeae3,_0x37d0aa,_0xb3aa96){return db[_0xe323('0x42')][_0xe323('0x5e')]({'where':{'id':_0x3eeae3[_0xe323('0x5b')]['id']}})[_0xe323('0x39')](handleEntityNotFound(_0x37d0aa,null))[_0xe323('0x39')](function(_0x533f01){if(_0x533f01){return _0x533f01[_0xe323('0x6f')](_0x3eeae3['query'][_0xe323('0x70')]);}})['then'](respondWithStatusCode(_0x37d0aa,null))[_0xe323('0x2d')](handleError(_0x37d0aa,null));};exports['addAnswer']=function(_0x3a099d,_0x254d72,_0x5b1ac2){if(_0x3a099d[_0xe323('0x68')]['id']){delete _0x3a099d['body']['id'];}return db['OpenchannelAccount'][_0xe323('0x5e')]({'where':{'id':_0x3a099d[_0xe323('0x5b')]['id']}})['then'](handleEntityNotFound(_0x254d72,null))['then'](function(_0x394c5f){if(_0x394c5f){_0x3a099d[_0xe323('0x68')]['OpenchannelAccountId']=_0x394c5f['id'];return db['CannedAnswer'][_0xe323('0x5f')](_0x3a099d[_0xe323('0x68')]);}})['then'](respondWithResult(_0x254d72,null))[_0xe323('0x2d')](handleError(_0x254d72,null));};exports['getAnswers']=function(_0x425b97,_0x565a6,_0x3d78f4){var _0x2e49bb={'raw':![],'where':{}};var _0x224fe7={};var _0x5d97c3={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe323('0x6d')]({'where':{'id':_0x425b97[_0xe323('0x5b')]['id']}})[_0xe323('0x39')](handleEntityNotFound(_0x565a6,null))['then'](function(_0x443011){if(_0x443011){_0x224fe7[_0xe323('0x45')]=_[_0xe323('0x47')](db[_0xe323('0x71')][_0xe323('0x5d')]);_0x224fe7[_0xe323('0x46')]=_[_0xe323('0x47')](_0x425b97['query']);_0x224fe7[_0xe323('0x51')]=_[_0xe323('0x48')](_0x224fe7[_0xe323('0x45')],_0x224fe7[_0xe323('0x46')]);_0x2e49bb[_0xe323('0x49')]=_[_0xe323('0x48')](_0x224fe7[_0xe323('0x45')],qs[_0xe323('0x4a')](_0x425b97[_0xe323('0x46')][_0xe323('0x4a')]));_0x2e49bb[_0xe323('0x49')]=_0x2e49bb[_0xe323('0x49')][_0xe323('0x4b')]?_0x2e49bb[_0xe323('0x49')]:_0x224fe7[_0xe323('0x45')];if(!_0x425b97[_0xe323('0x46')]['hasOwnProperty'](_0xe323('0x4d'))){_0x2e49bb[_0xe323('0x33')]=qs[_0xe323('0x33')](_0x425b97[_0xe323('0x46')]['limit']);_0x2e49bb[_0xe323('0x30')]=qs[_0xe323('0x30')](_0x425b97['query']['offset']);}_0x2e49bb[_0xe323('0x4e')]=qs[_0xe323('0x4f')](_0x425b97[_0xe323('0x46')][_0xe323('0x4f')]);_0x2e49bb['where']=qs[_0xe323('0x51')](_[_0xe323('0x52')](_0x425b97[_0xe323('0x46')],_0x224fe7[_0xe323('0x51')]));_0x2e49bb[_0xe323('0x50')]['OpenchannelAccountId']=_0x443011['id'];if(_0x425b97['query'][_0xe323('0x53')]){_0x2e49bb[_0xe323('0x50')]=_[_0xe323('0x54')](_0x2e49bb[_0xe323('0x50')],{'$or':_[_0xe323('0x72')](_0x2e49bb[_0xe323('0x49')],function(_0x41c138){var _0x5bf751={};_0x5bf751[_0x41c138]={'$like':'%'+_0x425b97[_0xe323('0x46')][_0xe323('0x53')]+'%'};return _0x5bf751;})});}_0x2e49bb=_[_0xe323('0x54')]({},_0x2e49bb,_0x425b97[_0xe323('0x56')]);return db[_0xe323('0x71')][_0xe323('0x32')]({'where':_0x2e49bb[_0xe323('0x50')]})[_0xe323('0x39')](function(_0x482117){_0x5d97c3[_0xe323('0x32')]=_0x482117;if(_0x425b97[_0xe323('0x46')]['includeAll']){_0x2e49bb[_0xe323('0x58')]=[{'all':!![]}];}return db[_0xe323('0x71')][_0xe323('0x59')](_0x2e49bb);})[_0xe323('0x39')](function(_0x2947d6){_0x5d97c3['rows']=_0x2947d6;return _0x5d97c3;});}})[_0xe323('0x39')](respondWithFilteredResult(_0x565a6,_0x2e49bb))['catch'](handleError(_0x565a6,null));};exports[_0xe323('0x73')]=function(_0x1e4203,_0x1424ac,_0x24bbd0){return db['OpenchannelAccount']['find']({'where':{'id':_0x1e4203[_0xe323('0x5b')]['id']}})[_0xe323('0x39')](handleEntityNotFound(_0x1424ac,null))[_0xe323('0x39')](function(_0x41efc1){if(_0x41efc1){return _0x41efc1[_0xe323('0x73')](_0x1e4203['query'][_0xe323('0x70')]);}})['then'](respondWithStatusCode(_0x1424ac,null))[_0xe323('0x2d')](handleError(_0x1424ac,null));};exports[_0xe323('0x74')]=function(_0x3229e9,_0x5c6c4c,_0x3fd893){var _0xdde0e3={'body':_0x3229e9[_0xe323('0x68')],'channel':_0xe323('0x75')};var _0x34beb6=[];var _0x52e19f=[];var _0x5bfbd2={};var _0x45cb48=![];return db[_0xe323('0x76')][_0xe323('0x69')]()[_0xe323('0x39')](function(_0x176d8f){if(!_0x176d8f){throw new db['Sequelize'][(_0xe323('0x77'))](_0xe323('0x78'));}_0x34beb6=_[_0xe323('0x79')](_[_0xe323('0x47')](_0x176d8f),[_0xe323('0x7a'),'updatedAt']);_0x52e19f=_['difference'](_[_0xe323('0x47')](_0x176d8f),[_0xe323('0x7a'),'updatedAt',_0xe323('0x7b'),_0xe323('0x7c')]);if(_0x3229e9[_0xe323('0x68')]['id']){delete _0x3229e9[_0xe323('0x68')]['id'];}if(_[_0xe323('0x7d')](_0x3229e9[_0xe323('0x68')]['from'])){throw new db['Sequelize'][(_0xe323('0x77'))](_0xe323('0x7e'));}if(_[_0xe323('0x7d')](_0x3229e9[_0xe323('0x68')][_0xe323('0x68')])||_0x3229e9[_0xe323('0x68')][_0xe323('0x68')]===''){throw new db['Sequelize'][(_0xe323('0x77'))](_0xe323('0x7f'));}if(_[_0xe323('0x7d')](_0x3229e9[_0xe323('0x68')]['mapKey'])){throw new db[(_0xe323('0x80'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x52e19f);}if(!_[_0xe323('0x81')](_0x52e19f,_0x3229e9[_0xe323('0x68')][_0xe323('0x82')])){throw new db['Sequelize'][(_0xe323('0x77'))](_0xe323('0x83')+_0x52e19f);}_0x5bfbd2[_0x3229e9['body'][_0xe323('0x82')]]=_0x3229e9[_0xe323('0x68')][_0xe323('0x84')];})[_0xe323('0x39')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x3229e9['params']['id']},'include':[{'model':db[_0xe323('0x85')],'as':'List','include':[{'model':db['CmContact'],'as':_0xe323('0x86'),'where':_0x5bfbd2,'limit':0x1,'order':[[_0xe323('0x87'),_0xe323('0x88')]]}]},{'model':db[_0xe323('0x89')],'as':_0xe323('0x8a')}]});})[_0xe323('0x39')](handleEntityNotFound(_0x5c6c4c,null))['then'](function(_0x54f51c){if(_0x54f51c&&_0x54f51c['List']){_0xdde0e3['account']=_0x54f51c;_0xdde0e3[_0xe323('0x8b')]=_0x54f51c[_0xe323('0x8a')];_0xdde0e3['list']=_0x54f51c[_0xe323('0x8c')];_0xdde0e3['applications']=_[_0xe323('0x8d')](_0xdde0e3[_0xe323('0x8b')],[_0xe323('0x8e')],[_0xe323('0x8f')]);if(_0xdde0e3[_0xe323('0x90')][_0xe323('0x8a')]){delete _0xdde0e3[_0xe323('0x90')][_0xe323('0x8a')];}if(_0xdde0e3[_0xe323('0x90')]['List']&&_0xdde0e3[_0xe323('0x90')]['List'][_0xe323('0x86')]['length']){return _0xdde0e3[_0xe323('0x90')][_0xe323('0x8c')][_0xe323('0x86')][0x0];}var _0x4423ce=_[_0xe323('0x1d')](_0x3229e9[_0xe323('0x68')],{'firstName':_0x3229e9[_0xe323('0x68')][_0xe323('0x84')],'ListId':_0x54f51c[_0xe323('0x7c')]});_0x4423ce[_0x3229e9[_0xe323('0x68')][_0xe323('0x82')]]=_0x3229e9['body']['from'];return db[_0xe323('0x76')][_0xe323('0x5f')](_0x4423ce,{'fields':_0x34beb6,'raw':!![]});}})[_0xe323('0x39')](handleEntityNotFound(_0x5c6c4c,null))['then'](function(_0x3a1eb2){_0xdde0e3['contact']=_0x3a1eb2;if(_0x3a1eb2){var _0x36d1a8={'ContactId':_0x3a1eb2['id'],'OpenchannelAccountId':_0x3229e9['params']['id'],'from':(_0x3a1eb2[_0xe323('0x91')]||'')+'\x20'+(_0x3a1eb2[_0xe323('0x92')]||'')};var _0x8ebc70={'OpenchannelAccountId':_0x3229e9[_0xe323('0x5b')]['id'],'closed':![]};if(_0x3229e9[_0xe323('0x68')][_0xe323('0x93')]){_0x8ebc70['threadId']=_0x3229e9[_0xe323('0x68')]['threadId'];return db['OpenchannelInteraction'][_0xe323('0x5e')]({'where':_0x8ebc70})['then'](function(_0x50dcb5){if(_0x50dcb5){return[_0x50dcb5,![]];}_0x36d1a8[_0xe323('0x93')]=_0x3229e9[_0xe323('0x68')][_0xe323('0x93')];_0x36d1a8[_0xe323('0x94')]=_0x3229e9[_0xe323('0x68')]['externalUrl'];return db[_0xe323('0x95')][_0xe323('0x5f')](_0x36d1a8)[_0xe323('0x39')](function(_0x3c3a02){return[_0x3c3a02,!![]];});});}else{_0x8ebc70[_0xe323('0x93')]=null;}_0x8ebc70[_0xe323('0x96')]=_0x3a1eb2['id'];return db['OpenchannelInteraction'][_0xe323('0x5e')]({'where':_0x8ebc70})['then'](function(_0x28e5d7){if(_0x28e5d7){return[_0x28e5d7,![]];}return db[_0xe323('0x95')][_0xe323('0x5f')](_0x36d1a8)['then'](function(_0x252442){return[_0x252442,!![]];});});}})[_0xe323('0x97')](function(_0x458510,_0x6c62aa){if(_0x458510){_0x45cb48=_0x6c62aa;if(!_0x6c62aa){var _0x30a869={'from':(_0xdde0e3[_0xe323('0x98')][_0xe323('0x91')]||'')+'\x20'+(_0xdde0e3[_0xe323('0x98')][_0xe323('0x92')]||'')};if(_0x3229e9['body'][_0xe323('0x93')]&&_0x3229e9[_0xe323('0x68')][_0xe323('0x99')]&&_0x3229e9[_0xe323('0x68')][_0xe323('0x93')]!=_0x3229e9[_0xe323('0x68')][_0xe323('0x99')]){_0x30a869[_0xe323('0x93')]=_0x3229e9['body'][_0xe323('0x99')];}return _0x458510[_0xe323('0x38')](_0x30a869);}else{return _0x458510;}}})['then'](function(_0x480757){_0xdde0e3['interaction']=_0x480757[_0xe323('0x3b')]({'plain':!![]});_0xdde0e3[_0xe323('0x9a')][_0xe323('0x9b')]=_0x45cb48;if(_0xdde0e3['interaction'][_0xe323('0x9b')]){if(_0xdde0e3[_0xe323('0x90')][_0xe323('0x9c')]){_0xdde0e3[_0xe323('0x8b')][_0xe323('0x9d')]({'id':0x0,'priority':_0xdde0e3[_0xe323('0x8b')]['length']+0x1,'app':'close','appdata':_0xe323('0x9e'),'interval':_0xe323('0x9f')});}}return db['OpenchannelMessage'][_0xe323('0x5f')]({'body':_0x3229e9[_0xe323('0x68')][_0xe323('0x68')],'OpenchannelAccountId':_0x3229e9['params']['id'],'OpenchannelInteractionId':_0x480757['id'],'direction':'in','ContactId':_0xdde0e3[_0xe323('0x98')]['id'],'AttachmentId':_0x3229e9[_0xe323('0x68')]['AttachmentId']});})[_0xe323('0x39')](function(_0x129de0){_0xdde0e3[_0xe323('0x2c')]=_0x129de0;if(!_0xdde0e3['interaction'][_0xe323('0xa0')])return;return db[_0xe323('0xa1')]['find']({'attributes':['id',_0xe323('0x3e')],'where':{'id':_0xdde0e3[_0xe323('0x9a')]['UserId']}});})['then'](function(_0x2386d9){if(_0x2386d9){_0xdde0e3[_0xe323('0x8b')][_0xe323('0xa2')]({'id':0x0,'priority':0x0,'app':_0xe323('0xa3'),'appdata':_0x2386d9[_0xe323('0x3e')]+','+(_0xdde0e3[_0xe323('0x90')][_0xe323('0xa4')]||0xa),'interval':_0xe323('0x9f')});}if(!_0xdde0e3['interaction'][_0xe323('0xa5')])return;return db[_0xe323('0xa6')][_0xe323('0x5e')]({'attributes':['id',_0xe323('0x3e')],'where':{'id':_0xdde0e3[_0xe323('0x9a')]['queueId']}});})[_0xe323('0x39')](function(_0x19f88){if(_0x19f88){_0xdde0e3['applications'][_0xe323('0xa2')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x19f88['name']+','+(_0xdde0e3['account'][_0xe323('0xa7')]||0x12c),'interval':_0xe323('0x9f')});}return respondWithRpcPromise('Start','startRouting',_0xdde0e3);})['then'](function(_0x24dd8d){respondWithRpcPromise(_0xe323('0xa8'),'EventManager',{'event':_0xe323('0x74'),'message':_0x24dd8d},client9002);return _0x24dd8d;})[_0xe323('0x39')](respondWithResult(_0x5c6c4c,null))[_0xe323('0x2d')](handleError(_0x5c6c4c,null));};exports[_0xe323('0xa9')]=function(_0x556af2,_0x3bcfc7){var _0xa510b7=_0x556af2['params']['id'];var _0x5afae7=_0x556af2['body'];var _0x5606e0=0xc8;var _0x13f018=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xe323('0xaa')][_0xe323('0xab')][_0xe323('0xac')]['READ_COMMITTED']},function(_0x461960){return db['OpenchannelAccount'][_0xe323('0x6d')]({'where':{'id':_0xa510b7},'transaction':_0x461960})[_0xe323('0x39')](function(_0x21684b){if(_0x21684b){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0xa510b7},'transaction':_0x461960})[_0xe323('0x39')](function(){var _0x59173e=_['map'](_0x5afae7,function(_0x587267){_0x587267[_0xe323('0x6a')]=_0xa510b7;return _0x587267;});return db[_0xe323('0x89')][_0xe323('0xad')](_0x59173e,{'transaction':_0x461960});});}else{_0x5606e0=0x194;_0x13f018=[];}});})[_0xe323('0x39')](function(){if(_0x5606e0!==0x194){return db[_0xe323('0x89')][_0xe323('0xae')]({'where':{'OpenchannelAccountId':_0xa510b7},'order':_0xe323('0x8e')})[_0xe323('0x39')](function(_0x4b23cf){_0x13f018=_0x4b23cf;});}})[_0xe323('0x2d')](function(_0xe834c4){_0x5606e0=0x1f4;logger[_0xe323('0x2a')](_0xe834c4[_0xe323('0x3d')]);if(_0xe834c4['name']){delete _0xe834c4[_0xe323('0x3e')];}_0x13f018=_0xe834c4;})['finally'](function(){if(_0x13f018===null){_0x3bcfc7[_0xe323('0x2e')](_0x5606e0);}else{if(_0x5606e0===0x1f4){_0x3bcfc7[_0xe323('0x2f')](_0x5606e0)[_0xe323('0x3f')](_0x13f018);}else{_0x3bcfc7[_0xe323('0x2f')](_0x5606e0)[_0xe323('0x35')](_0x13f018);}}});};exports['getApplications']=function(_0x5e95c0,_0x32f4ce,_0x12f5d3){var _0x24a5e2={};var _0x1c717a={};var _0xe1ca2;var _0x2dd9d5;return db[_0xe323('0x42')][_0xe323('0x6d')]({'where':{'id':_0x5e95c0['params']['id']}})[_0xe323('0x39')](handleEntityNotFound(_0x32f4ce,null))[_0xe323('0x39')](function(_0x2e25fe){if(_0x2e25fe){_0xe1ca2=_0x2e25fe;_0x1c717a[_0xe323('0x45')]=_[_0xe323('0x47')](db['OpenchannelApplication'][_0xe323('0x5d')]);_0x1c717a['query']=_[_0xe323('0x47')](_0x5e95c0['query']);_0x1c717a[_0xe323('0x51')]=_[_0xe323('0x48')](_0x1c717a[_0xe323('0x45')],_0x1c717a['query']);_0x24a5e2[_0xe323('0x49')]=_[_0xe323('0x48')](_0x1c717a[_0xe323('0x45')],qs[_0xe323('0x4a')](_0x5e95c0[_0xe323('0x46')][_0xe323('0x4a')]));_0x24a5e2['attributes']=_0x24a5e2[_0xe323('0x49')][_0xe323('0x4b')]?_0x24a5e2[_0xe323('0x49')]:_0x1c717a['model'];_0x24a5e2[_0xe323('0x4e')]=qs['sort'](_0x5e95c0['query'][_0xe323('0x4f')]);_0x24a5e2[_0xe323('0x50')]=qs[_0xe323('0x51')](_[_0xe323('0x52')](_0x5e95c0['query'],_0x1c717a[_0xe323('0x51')]));if(_0x5e95c0[_0xe323('0x46')][_0xe323('0x53')]){_0x24a5e2[_0xe323('0x50')]=_[_0xe323('0x54')](_0x24a5e2[_0xe323('0x50')],{'$or':_[_0xe323('0x72')](_0x24a5e2['attributes'],function(_0x5a3275){var _0x4b6b8d={};_0x4b6b8d[_0x5a3275]={'$like':'%'+_0x5e95c0[_0xe323('0x46')]['filter']+'%'};return _0x4b6b8d;})});}_0x24a5e2=_[_0xe323('0x54')]({},_0x24a5e2,_0x5e95c0[_0xe323('0x56')]);return _0xe1ca2['getApplications'](_0x24a5e2);}})[_0xe323('0x39')](function(_0x1deae5){if(_0x1deae5){_0x2dd9d5=_0x1deae5['length'];if(!_0x5e95c0[_0xe323('0x46')][_0xe323('0x4c')]('nolimit')){_0x24a5e2[_0xe323('0x33')]=qs[_0xe323('0x33')](_0x5e95c0[_0xe323('0x46')][_0xe323('0x33')]);_0x24a5e2[_0xe323('0x30')]=qs[_0xe323('0x30')](_0x5e95c0[_0xe323('0x46')][_0xe323('0x30')]);}return _0xe1ca2['getApplications'](_0x24a5e2);}})['then'](function(_0x301df9){if(_0x301df9){return _0x301df9?{'count':_0x2dd9d5,'rows':_0x301df9}:null;}})[_0xe323('0x39')](respondWithResult(_0x32f4ce,null))['catch'](handleError(_0x32f4ce,null));};exports[_0xe323('0xaf')]=function(_0x147cec,_0x22ec86,_0x467827){var _0x41a110={'raw':![],'where':{}};var _0x4636cc={};var _0x1b56d7={'count':0x0,'rows':[]};return db[_0xe323('0x42')][_0xe323('0x6d')]({'where':{'id':_0x147cec[_0xe323('0x5b')]['id']}})[_0xe323('0x39')](handleEntityNotFound(_0x22ec86,null))['then'](function(_0x5a1730){if(_0x5a1730){_0x4636cc[_0xe323('0x45')]=_[_0xe323('0x47')](db['OpenchannelInteraction']['rawAttributes']);_0x4636cc[_0xe323('0x46')]=_['keys'](_0x147cec[_0xe323('0x46')]);_0x4636cc[_0xe323('0x51')]=_['intersection'](_0x4636cc['model'],_0x4636cc[_0xe323('0x46')]);_0x41a110[_0xe323('0x49')]=_[_0xe323('0x48')](_0x4636cc[_0xe323('0x45')],qs[_0xe323('0x4a')](_0x147cec[_0xe323('0x46')][_0xe323('0x4a')]));_0x41a110[_0xe323('0x49')]=_0x41a110[_0xe323('0x49')][_0xe323('0x4b')]?_0x41a110[_0xe323('0x49')]:_0x4636cc['model'];if(!_0x147cec[_0xe323('0x46')][_0xe323('0x4c')]('nolimit')){_0x41a110[_0xe323('0x33')]=qs['limit'](_0x147cec[_0xe323('0x46')][_0xe323('0x33')]);_0x41a110[_0xe323('0x30')]=qs[_0xe323('0x30')](_0x147cec[_0xe323('0x46')][_0xe323('0x30')]);}_0x41a110[_0xe323('0x4e')]=qs[_0xe323('0x4f')](_0x147cec['query'][_0xe323('0x4f')]);_0x41a110[_0xe323('0x50')]=qs[_0xe323('0x51')](_[_0xe323('0x52')](_0x147cec[_0xe323('0x46')],_0x4636cc[_0xe323('0x51')]));_0x41a110[_0xe323('0x50')]['OpenchannelAccountId']=_0x5a1730['id'];if(_0x147cec[_0xe323('0x46')][_0xe323('0x53')]){_0x41a110[_0xe323('0x50')]=_[_0xe323('0x54')](_0x41a110[_0xe323('0x50')],{'$or':_[_0xe323('0x72')](_0x41a110['attributes'],function(_0x30faca){var _0x5ab2eb={};_0x5ab2eb[_0x30faca]={'$like':'%'+_0x147cec['query'][_0xe323('0x53')]+'%'};return _0x5ab2eb;})});}_0x41a110=_['merge']({},_0x41a110,_0x147cec[_0xe323('0x56')]);return db[_0xe323('0x95')]['count']({'where':_0x41a110[_0xe323('0x50')]})[_0xe323('0x39')](function(_0x2c6a20){_0x1b56d7[_0xe323('0x32')]=_0x2c6a20;if(_0x147cec[_0xe323('0x46')][_0xe323('0x57')]){_0x41a110[_0xe323('0x58')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xe323('0xa1')],'as':'Owner','attributes':[_0xe323('0x3e'),_0xe323('0xb0'),_0xe323('0xb1')],'required':![]},{'model':db[_0xe323('0xb2')],'as':'Tags','attributes':['id',_0xe323('0x3e'),'color'],'where':_0x147cec[_0xe323('0x46')][_0xe323('0xb3')]?{'id':_0x147cec[_0xe323('0x46')][_0xe323('0xb3')]}:undefined,'required':_0x147cec[_0xe323('0x46')][_0xe323('0xb3')]?!![]:![]}];}return db[_0xe323('0x95')][_0xe323('0x59')](_0x41a110);})['then'](function(_0x3ce01c){_0x1b56d7[_0xe323('0x6e')]=_0x3ce01c;return _0x1b56d7;});}})[_0xe323('0x39')](respondWithFilteredResult(_0x22ec86,_0x41a110))[_0xe323('0x2d')](handleError(_0x22ec86,null));};exports['addAgents']=function(_0x4c3e32,_0x4b2374,_0x4f7c0d){return db[_0xe323('0x42')]['find']({'where':{'id':_0x4c3e32[_0xe323('0x5b')]['id']}})[_0xe323('0x39')](handleEntityNotFound(_0x4b2374,null))[_0xe323('0x39')](function(_0x5068e9){if(_0x5068e9){return _0x5068e9[_0xe323('0xb4')](_0x4c3e32[_0xe323('0x68')][_0xe323('0x70')],_[_0xe323('0xb5')](_0x4c3e32[_0xe323('0x68')],[_0xe323('0x70'),'id'])||{})[_0xe323('0x97')](function(_0x35afdf){for(var _0x572fd2=0x0;_0x572fd2<_0x4c3e32[_0xe323('0x68')][_0xe323('0x70')][_0xe323('0x4b')];_0x572fd2+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x4c3e32['body'][_0xe323('0x70')][_0x572fd2]),'OpenchannelAccountId':Number(_0x4c3e32['params']['id'])});}return _0x35afdf;});}})[_0xe323('0x39')](respondWithResult(_0x4b2374,null))['catch'](handleError(_0x4b2374,null));};exports[_0xe323('0xb6')]=function(_0x435c3c,_0x25970b,_0x5478a0){return db[_0xe323('0x42')][_0xe323('0x5e')]({'where':{'id':_0x435c3c['params']['id']}})[_0xe323('0x39')](handleEntityNotFound(_0x25970b,null))[_0xe323('0x39')](function(_0x5ae090){if(_0x5ae090){return _0x5ae090[_0xe323('0xb6')](_0x435c3c[_0xe323('0x46')]['ids'])[_0xe323('0x39')](function(){if(_[_0xe323('0xb7')](_0x435c3c[_0xe323('0x46')][_0xe323('0x70')])){for(var _0x25581b=0x0;_0x25581b<_0x435c3c[_0xe323('0x46')][_0xe323('0x70')][_0xe323('0x4b')];_0x25581b+=0x1){socket[_0xe323('0xb8')](_0xe323('0xb9'),{'UserId':Number(_0x435c3c[_0xe323('0x46')][_0xe323('0x70')][_0x25581b]),'OpenchannelAccountId':Number(_0x435c3c[_0xe323('0x5b')]['id'])});}}else{socket[_0xe323('0xb8')](_0xe323('0xb9'),{'UserId':Number(_0x435c3c[_0xe323('0x46')][_0xe323('0x70')]),'OpenchannelAccountId':Number(_0x435c3c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x25970b,null))[_0xe323('0x2d')](handleError(_0x25970b,null));};exports[_0xe323('0xba')]=function(_0x3e8ac4,_0x4d9f59,_0x7fc410){var _0x5e9d6d={};var _0x225377={};var _0x11afba;var _0x5e0be4;return db[_0xe323('0x42')][_0xe323('0x6d')]({'where':{'id':_0x3e8ac4[_0xe323('0x5b')]['id']}})[_0xe323('0x39')](handleEntityNotFound(_0x4d9f59,null))[_0xe323('0x39')](function(_0x394d1f){if(_0x394d1f){_0x11afba=_0x394d1f;_0x225377['model']=_['keys'](db['User'][_0xe323('0x5d')]);_0x225377[_0xe323('0x46')]=_[_0xe323('0x47')](_0x3e8ac4['query']);_0x225377['filters']=_['intersection'](_0x225377[_0xe323('0x45')],_0x225377['query']);_0x5e9d6d[_0xe323('0x49')]=_[_0xe323('0x48')](_0x225377['model'],qs[_0xe323('0x4a')](_0x3e8ac4[_0xe323('0x46')]['fields']));_0x5e9d6d[_0xe323('0x49')]=_0x5e9d6d[_0xe323('0x49')][_0xe323('0x4b')]?_0x5e9d6d[_0xe323('0x49')]:_0x225377[_0xe323('0x45')];_0x5e9d6d[_0xe323('0x4e')]=qs[_0xe323('0x4f')](_0x3e8ac4[_0xe323('0x46')]['sort']);_0x5e9d6d[_0xe323('0x50')]=qs['filters'](_[_0xe323('0x52')](_0x3e8ac4[_0xe323('0x46')],_0x225377[_0xe323('0x51')]));if(_0x3e8ac4[_0xe323('0x46')][_0xe323('0x53')]){_0x5e9d6d[_0xe323('0x50')]=_[_0xe323('0x54')](_0x5e9d6d['where'],{'$or':_[_0xe323('0x72')](_0x5e9d6d['attributes'],function(_0x2948c8){var _0x3a4a0a={};_0x3a4a0a[_0x2948c8]={'$like':'%'+_0x3e8ac4[_0xe323('0x46')][_0xe323('0x53')]+'%'};return _0x3a4a0a;})});}_0x5e9d6d=_[_0xe323('0x54')]({},_0x5e9d6d,_0x3e8ac4['options']);return _0x11afba[_0xe323('0xba')](_0x5e9d6d);}})['then'](function(_0x3697ae){if(_0x3697ae){_0x5e0be4=_0x3697ae['length'];if(!_0x3e8ac4['query'][_0xe323('0x4c')](_0xe323('0x4d'))){_0x5e9d6d[_0xe323('0x33')]=qs[_0xe323('0x33')](_0x3e8ac4[_0xe323('0x46')]['limit']);_0x5e9d6d[_0xe323('0x30')]=qs[_0xe323('0x30')](_0x3e8ac4['query']['offset']);}return _0x11afba[_0xe323('0xba')](_0x5e9d6d);}})[_0xe323('0x39')](function(_0x444da5){if(_0x444da5){return _0x444da5?{'count':_0x5e0be4,'rows':_0x444da5}:null;}})[_0xe323('0x39')](respondWithResult(_0x4d9f59,null))[_0xe323('0x2d')](handleError(_0x4d9f59,null));};exports[_0xe323('0x3f')]=function(_0xdfeba5,_0x5910e6,_0x35cad8){var _0x194912,_0x733a96,_0xc8f6da;if(_[_0xe323('0x7d')](_0xdfeba5['body'][_0xe323('0x68')])||_0xdfeba5[_0xe323('0x68')]['body']===''){throw new db[(_0xe323('0x80'))][(_0xe323('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xdfeba5['body']['to'])){}_0x194912=_0xdfeba5[_0xe323('0x68')]['to'];return db[_0xe323('0x42')][_0xe323('0x6d')]({'where':{'id':_0xdfeba5[_0xe323('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5910e6,null))[_0xe323('0x39')](function(_0x559fb9){if(_0x559fb9){return db[_0xe323('0x42')][_0xe323('0x5e')]({'where':{'id':_0x559fb9['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xe323('0x76')],'as':_0xe323('0x86'),'where':{[_0x559fb9['mapKey']]:_0x194912},'limit':0x1,'order':[[_0xe323('0x87'),_0xe323('0x88')]]}]}]})['then'](handleEntityNotFound(_0x5910e6,null))[_0xe323('0x39')](function(_0x15fa2c){if(_0x15fa2c&&_0x15fa2c[_0xe323('0x8c')]){_0x733a96=_0x15fa2c['get']({'plain':!![]});if(_0x733a96[_0xe323('0x8c')]&&_0x733a96[_0xe323('0x8c')][_0xe323('0x86')][_0xe323('0x4b')]){return _0x733a96[_0xe323('0x8c')][_0xe323('0x86')][0x0];}return db[_0xe323('0x76')][_0xe323('0x5f')](_[_0xe323('0x1d')](_0xdfeba5[_0xe323('0x68')],{'firstName':_0x194912,[_0x15fa2c[_0xe323('0x82')]]:_0x194912,'phone':_0x194912,'ListId':_0x733a96[_0xe323('0x7c')]}));}})[_0xe323('0x39')](handleEntityNotFound(_0x5910e6,null))['then'](function(_0x299556){if(_0x299556){_0xc8f6da=_0x299556;return db[_0xe323('0x95')]['find']({'where':{'ContactId':_0xc8f6da['id'],'closed':![],'OpenchannelAccountId':_0x733a96['id']}})[_0xe323('0x39')](function(_0xb2aa3a){if(_0xb2aa3a){return[_0xb2aa3a,![]];}return db['OpenchannelInteraction'][_0xe323('0x5f')]({'UserId':_0xdfeba5[_0xe323('0x60')]['id'],'ContactId':_0xc8f6da['id'],'OpenchannelAccountId':_0x733a96['id'],'lastMsgDirection':'out','firstMsgDirection':_0xe323('0xbb'),'Messages':[_[_0xe323('0x54')](_0xdfeba5[_0xe323('0x68')],{'read':![],'body':_0xdfeba5['body'][_0xe323('0x68')],'OpenchannelAccountId':_0x733a96['id'],'UserId':_0xdfeba5[_0xe323('0x60')]['id'],'ContactId':_0xc8f6da['id']})]},{'include':[{'model':db[_0xe323('0xbc')],'as':'Messages'}]})[_0xe323('0x39')](function(_0x4fefb9){return[_0x4fefb9,!![]];});});}})[_0xe323('0x97')](function(_0x1e0cdb,_0x5ce809){if(_0x5ce809){return _0x1e0cdb;}return db['OpenchannelMessage'][_0xe323('0x5f')](_[_0xe323('0x54')](_0xdfeba5[_0xe323('0x68')],{'read':![],'body':_0xdfeba5[_0xe323('0x68')][_0xe323('0x68')],'OpenchannelAccountId':_0x733a96['id'],'OpenchannelInteractionId':_0x1e0cdb['id'],'UserId':_0xdfeba5[_0xe323('0x60')]['id'],'ContactId':_0xc8f6da['id']}))[_0xe323('0x39')](function(_0x5e2bbd){_0x1e0cdb['dataValues'][_0xe323('0xbd')]=[];_0x1e0cdb[_0xe323('0xbe')]['Messages']['push'](_0x5e2bbd[_0xe323('0xbe')]);return _0x1e0cdb;});});}})[_0xe323('0x39')](respondWithResult(_0x5910e6,null))[_0xe323('0x2d')](handleError(_0x5910e6,null));}; \ No newline at end of file +var _0x8b52=['error','code','message','info','catch','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','include','findAll','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','ContactId','spread','messageId','interaction','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','*,*,*,*','queueId','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','OpenchannelAccountId','bulkCreate','findAndCountAll','sendStatus','send','getApplications','getInteractions','Contact','Owner','fullname','Tags','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x208ba2,_0x533f2f){var _0xc21cb3=function(_0xb532d8){while(--_0xb532d8){_0x208ba2['push'](_0x208ba2['shift']());}};_0xc21cb3(++_0x533f2f);}(_0x8b52,0x151));var _0x28b5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8b52[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x28b5('0x0'));var rimraf=require(_0x28b5('0x1'));var zipdir=require(_0x28b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28b5('0x3'));var moment=require(_0x28b5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x28b5('0x5'));var util=require(_0x28b5('0x6'));var path=require(_0x28b5('0x7'));var sox=require(_0x28b5('0x8'));var csv=require(_0x28b5('0x9'));var ejs=require(_0x28b5('0xa'));var fs=require('fs');var fs_extra=require(_0x28b5('0xb'));var _=require(_0x28b5('0xc'));var squel=require(_0x28b5('0xd'));var crypto=require('crypto');var jsforce=require(_0x28b5('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x28b5('0xf'));var Papa=require(_0x28b5('0x10'));var Redis=require('ioredis');var authService=require(_0x28b5('0x11'));var qs=require(_0x28b5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28b5('0x13'));var logger=require(_0x28b5('0x14'))(_0x28b5('0x15'));var utils=require(_0x28b5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x28b5('0x17'));var db=require('../../mysqldb')['db'];config[_0x28b5('0x18')]=_[_0x28b5('0x19')](config['redis'],{'host':_0x28b5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x28b5('0x18')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x28b5('0x1b'));var client=jayson[_0x28b5('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x28b5('0x1c')][_0x28b5('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1e4a10,_0x16c115,_0x39ae7f,_0x593561){return new BPromise(function(_0x356b82,_0x4adf12){var _0x7b6900=_0x593561||client;return _0x7b6900[_0x28b5('0x1e')](_0x1e4a10,_0x39ae7f)[_0x28b5('0x1f')](function(_0x1a4f53){logger['info'](_0x28b5('0x20'),_0x16c115,_0x28b5('0x21'));logger[_0x28b5('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x16c115,_0x28b5('0x21'),JSON['stringify'](_0x1a4f53));if(_0x1a4f53[_0x28b5('0x23')]){if(_0x1a4f53[_0x28b5('0x23')][_0x28b5('0x24')]===0x1f4){logger[_0x28b5('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x16c115,_0x1a4f53[_0x28b5('0x23')][_0x28b5('0x25')]);return _0x4adf12(_0x1a4f53[_0x28b5('0x23')][_0x28b5('0x25')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x16c115,_0x1a4f53['error'][_0x28b5('0x25')]);return _0x356b82(_0x1a4f53[_0x28b5('0x23')][_0x28b5('0x25')]);}else{logger[_0x28b5('0x26')](_0x28b5('0x20'),_0x16c115,_0x28b5('0x21'));_0x356b82(_0x1a4f53['result']['message']);}})[_0x28b5('0x27')](function(_0x528993){logger[_0x28b5('0x23')](_0x28b5('0x20'),_0x16c115,_0x528993);_0x4adf12(_0x528993);});});}function respondWithStatusCode(_0x24954d,_0x18176c){_0x18176c=_0x18176c||0xcc;return function(_0x127ab0){if(_0x127ab0){return _0x24954d['sendStatus'](_0x18176c);}return _0x24954d['status'](_0x18176c)[_0x28b5('0x28')]();};}function respondWithResult(_0x41784a,_0x12c721){_0x12c721=_0x12c721||0xc8;return function(_0xb109dd){if(_0xb109dd){return _0x41784a[_0x28b5('0x29')](_0x12c721)[_0x28b5('0x2a')](_0xb109dd);}};}function respondWithFilteredResult(_0x2db6f1,_0x1bbe54){return function(_0x139524){if(_0x139524){var _0x2a182a=typeof _0x1bbe54['offset']===_0x28b5('0x2b')&&typeof _0x1bbe54[_0x28b5('0x2c')]==='undefined';var _0x6ee12b=_0x139524[_0x28b5('0x2d')];var _0x225f0b=_0x2a182a?0x0:_0x1bbe54[_0x28b5('0x2e')];var _0x104717=_0x2a182a?_0x139524[_0x28b5('0x2d')]:_0x1bbe54[_0x28b5('0x2e')]+_0x1bbe54['limit'];var _0x2b3465;if(_0x104717>=_0x6ee12b){_0x104717=_0x6ee12b;_0x2b3465=0xc8;}else{_0x2b3465=0xce;}_0x2db6f1['status'](_0x2b3465);return _0x2db6f1[_0x28b5('0x2f')](_0x28b5('0x30'),_0x225f0b+'-'+_0x104717+'/'+_0x6ee12b)[_0x28b5('0x2a')](_0x139524);}return null;};}function patchUpdates(_0x22d4dc){return function(_0x26fb31){try{jsonpatch[_0x28b5('0x31')](_0x26fb31,_0x22d4dc,!![]);}catch(_0x3f4c74){return BPromise[_0x28b5('0x32')](_0x3f4c74);}return _0x26fb31[_0x28b5('0x33')]();};}function saveUpdates(_0x2c815d,_0x88bb17){return function(_0x270b73){if(_0x270b73){return _0x270b73[_0x28b5('0x34')](_0x2c815d)[_0x28b5('0x1f')](function(_0x31bf13){return _0x31bf13;});}return null;};}function removeEntity(_0x15de12,_0x56deaa){return function(_0x360b9a){if(_0x360b9a){return _0x360b9a['destroy']()[_0x28b5('0x1f')](function(){var _0x412219=_0x360b9a[_0x28b5('0x35')]({'plain':!![]});var _0x135f3e='OpenchannelAccounts';return db[_0x28b5('0x36')][_0x28b5('0x37')]({'where':{'type':_0x135f3e,'resourceId':_0x412219['id']}})[_0x28b5('0x1f')](function(){return _0x360b9a;});})['then'](function(){_0x15de12['status'](0xcc)[_0x28b5('0x28')]();});}};}function handleEntityNotFound(_0x765c7b,_0x4176da){return function(_0x3d3791){if(!_0x3d3791){_0x765c7b['sendStatus'](0x194);}return _0x3d3791;};}function handleError(_0x2ef3f6,_0x388339){_0x388339=_0x388339||0x1f4;return function(_0x22f1f7){logger[_0x28b5('0x23')](_0x22f1f7[_0x28b5('0x38')]);if(_0x22f1f7[_0x28b5('0x39')]){delete _0x22f1f7[_0x28b5('0x39')];}_0x2ef3f6[_0x28b5('0x29')](_0x388339)['send'](_0x22f1f7);};}exports[_0x28b5('0x3a')]=function(_0x360671,_0x4d3d09){var _0x428596={'include':[{'model':db[_0x28b5('0x3b')],'as':_0x28b5('0x3c')}]},_0x4ee7cc={},_0x1ca663={'count':0x0,'rows':[]};var _0x5e1fb2=_[_0x28b5('0x3d')](db[_0x28b5('0x3e')][_0x28b5('0x3f')],function(_0x392f97){return{'name':_0x392f97[_0x28b5('0x40')],'type':_0x392f97[_0x28b5('0x41')]['key']};});_0x4ee7cc[_0x28b5('0x42')]=_[_0x28b5('0x3d')](_0x5e1fb2,_0x28b5('0x39'));_0x4ee7cc[_0x28b5('0x43')]=_[_0x28b5('0x44')](_0x360671['query']);_0x4ee7cc[_0x28b5('0x45')]=_[_0x28b5('0x46')](_0x4ee7cc[_0x28b5('0x42')],_0x4ee7cc[_0x28b5('0x43')]);_0x428596[_0x28b5('0x47')]=_['intersection'](_0x4ee7cc[_0x28b5('0x42')],qs[_0x28b5('0x48')](_0x360671[_0x28b5('0x43')][_0x28b5('0x48')]));_0x428596[_0x28b5('0x47')]=_0x428596[_0x28b5('0x47')]['length']?_0x428596['attributes']:_0x4ee7cc[_0x28b5('0x42')];if(!_0x360671[_0x28b5('0x43')][_0x28b5('0x49')](_0x28b5('0x4a'))){_0x428596[_0x28b5('0x2c')]=qs['limit'](_0x360671[_0x28b5('0x43')]['limit']);_0x428596[_0x28b5('0x2e')]=qs[_0x28b5('0x2e')](_0x360671[_0x28b5('0x43')][_0x28b5('0x2e')]);}_0x428596[_0x28b5('0x4b')]=qs[_0x28b5('0x4c')](_0x360671[_0x28b5('0x43')]['sort']);_0x428596[_0x28b5('0x4d')]=qs[_0x28b5('0x45')](_[_0x28b5('0x4e')](_0x360671[_0x28b5('0x43')],_0x4ee7cc[_0x28b5('0x45')]),_0x5e1fb2);if(_0x360671[_0x28b5('0x43')][_0x28b5('0x4f')]){_0x428596[_0x28b5('0x4d')]=_[_0x28b5('0x50')](_0x428596['where'],{'$or':_[_0x28b5('0x3d')](_0x5e1fb2,function(_0x126782){if(_0x126782[_0x28b5('0x41')]!==_0x28b5('0x51')){var _0x4c36f9={};_0x4c36f9[_0x126782[_0x28b5('0x39')]]={'$like':'%'+_0x360671[_0x28b5('0x43')][_0x28b5('0x4f')]+'%'};return _0x4c36f9;}})});}_0x428596=_[_0x28b5('0x50')]({},_0x428596,_0x360671[_0x28b5('0x52')]);var _0xaf449d={'where':_0x428596[_0x28b5('0x4d')]};return db[_0x28b5('0x3e')][_0x28b5('0x2d')](_0xaf449d)[_0x28b5('0x1f')](function(_0x974244){_0x1ca663[_0x28b5('0x2d')]=_0x974244;if(_0x360671[_0x28b5('0x43')][_0x28b5('0x53')]){_0x428596['include']=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x428596);})[_0x28b5('0x1f')](function(_0x97af32){_0x1ca663['rows']=_0x97af32;return _0x1ca663;})[_0x28b5('0x1f')](respondWithFilteredResult(_0x4d3d09,_0x428596))[_0x28b5('0x27')](handleError(_0x4d3d09,null));};exports['show']=function(_0x225857,_0x3c334e){var _0x3acc40={'raw':![],'where':{'id':_0x225857['params']['id']},'include':[{'model':db['Pause'],'as':_0x28b5('0x3c')}]},_0x2d3425={};_0x2d3425[_0x28b5('0x42')]=_[_0x28b5('0x44')](db[_0x28b5('0x3e')][_0x28b5('0x3f')]);_0x2d3425['query']=_['keys'](_0x225857[_0x28b5('0x43')]);_0x2d3425[_0x28b5('0x45')]=_['intersection'](_0x2d3425[_0x28b5('0x42')],_0x2d3425[_0x28b5('0x43')]);_0x3acc40[_0x28b5('0x47')]=_[_0x28b5('0x46')](_0x2d3425['model'],qs[_0x28b5('0x48')](_0x225857[_0x28b5('0x43')]['fields']));_0x3acc40[_0x28b5('0x47')]=_0x3acc40[_0x28b5('0x47')][_0x28b5('0x54')]?_0x3acc40[_0x28b5('0x47')]:_0x2d3425[_0x28b5('0x42')];if(_0x225857[_0x28b5('0x43')][_0x28b5('0x53')]){_0x3acc40['include']=[{'all':!![]}];}_0x3acc40=_['merge']({},_0x3acc40,_0x225857[_0x28b5('0x52')]);return db['OpenchannelAccount'][_0x28b5('0x55')](_0x3acc40)[_0x28b5('0x1f')](handleEntityNotFound(_0x3c334e,null))[_0x28b5('0x1f')](respondWithResult(_0x3c334e,null))[_0x28b5('0x27')](handleError(_0x3c334e,null));};exports['create']=function(_0x49f837,_0x14217){return db[_0x28b5('0x3e')]['create'](_0x49f837[_0x28b5('0x56')],{})['then'](function(_0x54ceaa){var _0x916e02=_0x49f837[_0x28b5('0x57')][_0x28b5('0x35')]({'plain':!![]});if(!_0x916e02)throw new Error(_0x28b5('0x58'));if(_0x916e02['role']===_0x28b5('0x57')){var _0x400cf3=_0x54ceaa[_0x28b5('0x35')]({'plain':!![]});var _0x5e81aa=_0x28b5('0x59');return db[_0x28b5('0x5a')]['find']({'where':{'name':_0x5e81aa,'userProfileId':_0x916e02['userProfileId']},'raw':!![]})['then'](function(_0x704b90){if(_0x704b90&&_0x704b90['autoAssociation']===0x0){return db[_0x28b5('0x36')][_0x28b5('0x5b')]({'name':_0x400cf3[_0x28b5('0x39')],'resourceId':_0x400cf3['id'],'type':_0x704b90[_0x28b5('0x39')],'sectionId':_0x704b90['id']},{})[_0x28b5('0x1f')](function(){return _0x54ceaa;});}else{return _0x54ceaa;}})['catch'](function(_0x59130a){logger['error'](_0x28b5('0x5c'),_0x59130a);throw _0x59130a;});}return _0x54ceaa;})[_0x28b5('0x1f')](respondWithResult(_0x14217,0xc9))[_0x28b5('0x27')](handleError(_0x14217,null));};exports['update']=function(_0x274d19,_0x325141){if(_0x274d19[_0x28b5('0x56')]['id']){delete _0x274d19['body']['id'];}return db[_0x28b5('0x3e')][_0x28b5('0x55')]({'where':{'id':_0x274d19['params']['id']},'include':[{'model':db['Pause'],'as':_0x28b5('0x3c')}]})[_0x28b5('0x1f')](handleEntityNotFound(_0x325141,null))[_0x28b5('0x1f')](saveUpdates(_0x274d19['body'],null))[_0x28b5('0x1f')](respondWithResult(_0x325141,null))[_0x28b5('0x27')](handleError(_0x325141,null));};exports['destroy']=function(_0x5672a4,_0x1e2bac){return db[_0x28b5('0x3e')][_0x28b5('0x55')]({'where':{'id':_0x5672a4[_0x28b5('0x5d')]['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0x1e2bac,null))[_0x28b5('0x1f')](removeEntity(_0x1e2bac,null))[_0x28b5('0x27')](handleError(_0x1e2bac,null));};exports[_0x28b5('0x5e')]=function(_0x2ae881,_0x18ddfb){return db[_0x28b5('0x3e')][_0x28b5('0x5e')]()[_0x28b5('0x1f')](respondWithResult(_0x18ddfb,null))[_0x28b5('0x27')](handleError(_0x18ddfb,null));};exports[_0x28b5('0x5f')]=function(_0x3275b7,_0x13ddc6,_0x35f9b6){if(_0x3275b7[_0x28b5('0x56')]['id']){delete _0x3275b7['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x3275b7[_0x28b5('0x5d')]['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0x13ddc6,null))[_0x28b5('0x1f')](function(_0x320d81){if(_0x320d81){_0x3275b7[_0x28b5('0x56')]['OpenchannelAccountId']=_0x320d81['id'];return db[_0x28b5('0x60')][_0x28b5('0x5b')](_0x3275b7[_0x28b5('0x56')]);}})[_0x28b5('0x1f')](respondWithResult(_0x13ddc6,null))['catch'](handleError(_0x13ddc6,null));};exports[_0x28b5('0x61')]=function(_0x348d01,_0x1ff1cb,_0xba696f){var _0x107e17={'raw':![],'where':{}};var _0x50e97a={};var _0x19cab5={'count':0x0,'rows':[]};return db[_0x28b5('0x3e')][_0x28b5('0x62')]({'where':{'id':_0x348d01['params']['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0x1ff1cb,null))['then'](function(_0x135e43){if(_0x135e43){_0x50e97a[_0x28b5('0x42')]=_[_0x28b5('0x44')](db[_0x28b5('0x60')][_0x28b5('0x3f')]);_0x50e97a[_0x28b5('0x43')]=_['keys'](_0x348d01[_0x28b5('0x43')]);_0x50e97a[_0x28b5('0x45')]=_['intersection'](_0x50e97a[_0x28b5('0x42')],_0x50e97a[_0x28b5('0x43')]);_0x107e17[_0x28b5('0x47')]=_[_0x28b5('0x46')](_0x50e97a[_0x28b5('0x42')],qs[_0x28b5('0x48')](_0x348d01[_0x28b5('0x43')][_0x28b5('0x48')]));_0x107e17['attributes']=_0x107e17[_0x28b5('0x47')][_0x28b5('0x54')]?_0x107e17[_0x28b5('0x47')]:_0x50e97a[_0x28b5('0x42')];if(!_0x348d01[_0x28b5('0x43')][_0x28b5('0x49')](_0x28b5('0x4a'))){_0x107e17['limit']=qs['limit'](_0x348d01['query'][_0x28b5('0x2c')]);_0x107e17[_0x28b5('0x2e')]=qs[_0x28b5('0x2e')](_0x348d01['query'][_0x28b5('0x2e')]);}_0x107e17[_0x28b5('0x4b')]=qs[_0x28b5('0x4c')](_0x348d01['query'][_0x28b5('0x4c')]);_0x107e17[_0x28b5('0x4d')]=qs['filters'](_[_0x28b5('0x4e')](_0x348d01[_0x28b5('0x43')],_0x50e97a[_0x28b5('0x45')]));_0x107e17['where']['OpenchannelAccountId']=_0x135e43['id'];if(_0x348d01[_0x28b5('0x43')][_0x28b5('0x4f')]){_0x107e17[_0x28b5('0x4d')]=_[_0x28b5('0x50')](_0x107e17[_0x28b5('0x4d')],{'$or':_['map'](_0x107e17[_0x28b5('0x47')],function(_0x30fb57){var _0x2ef3e1={};_0x2ef3e1[_0x30fb57]={'$like':'%'+_0x348d01[_0x28b5('0x43')][_0x28b5('0x4f')]+'%'};return _0x2ef3e1;})});}_0x107e17=_[_0x28b5('0x50')]({},_0x107e17,_0x348d01[_0x28b5('0x52')]);return db[_0x28b5('0x60')]['count']({'where':_0x107e17[_0x28b5('0x4d')]})['then'](function(_0xe867ab){_0x19cab5[_0x28b5('0x2d')]=_0xe867ab;if(_0x348d01[_0x28b5('0x43')]['includeAll']){_0x107e17['include']=[{'all':!![]}];}return db[_0x28b5('0x60')]['findAll'](_0x107e17);})[_0x28b5('0x1f')](function(_0x40fa6c){_0x19cab5[_0x28b5('0x63')]=_0x40fa6c;return _0x19cab5;});}})['then'](respondWithFilteredResult(_0x1ff1cb,_0x107e17))[_0x28b5('0x27')](handleError(_0x1ff1cb,null));};exports[_0x28b5('0x64')]=function(_0x7ba15,_0x32c97c,_0x4e6aa1){return db[_0x28b5('0x3e')][_0x28b5('0x55')]({'where':{'id':_0x7ba15[_0x28b5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x32c97c,null))[_0x28b5('0x1f')](function(_0x13a08c){if(_0x13a08c){return _0x13a08c[_0x28b5('0x64')](_0x7ba15[_0x28b5('0x43')][_0x28b5('0x65')]);}})[_0x28b5('0x1f')](respondWithStatusCode(_0x32c97c,null))[_0x28b5('0x27')](handleError(_0x32c97c,null));};exports[_0x28b5('0x66')]=function(_0x1a81d1,_0x9f8f13,_0x2afee9){if(_0x1a81d1[_0x28b5('0x56')]['id']){delete _0x1a81d1[_0x28b5('0x56')]['id'];}return db[_0x28b5('0x3e')]['find']({'where':{'id':_0x1a81d1[_0x28b5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x9f8f13,null))[_0x28b5('0x1f')](function(_0x221dc5){if(_0x221dc5){_0x1a81d1['body']['OpenchannelAccountId']=_0x221dc5['id'];return db['CannedAnswer'][_0x28b5('0x5b')](_0x1a81d1[_0x28b5('0x56')]);}})[_0x28b5('0x1f')](respondWithResult(_0x9f8f13,null))[_0x28b5('0x27')](handleError(_0x9f8f13,null));};exports['getAnswers']=function(_0x4cce03,_0x3fdedb,_0x2610ea){var _0x39ee82={'raw':![],'where':{}};var _0x539441={};var _0xf58381={'count':0x0,'rows':[]};return db[_0x28b5('0x3e')][_0x28b5('0x62')]({'where':{'id':_0x4cce03[_0x28b5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3fdedb,null))[_0x28b5('0x1f')](function(_0x563586){if(_0x563586){_0x539441['model']=_[_0x28b5('0x44')](db[_0x28b5('0x67')][_0x28b5('0x3f')]);_0x539441['query']=_[_0x28b5('0x44')](_0x4cce03['query']);_0x539441[_0x28b5('0x45')]=_[_0x28b5('0x46')](_0x539441['model'],_0x539441['query']);_0x39ee82[_0x28b5('0x47')]=_['intersection'](_0x539441[_0x28b5('0x42')],qs[_0x28b5('0x48')](_0x4cce03[_0x28b5('0x43')][_0x28b5('0x48')]));_0x39ee82[_0x28b5('0x47')]=_0x39ee82[_0x28b5('0x47')][_0x28b5('0x54')]?_0x39ee82[_0x28b5('0x47')]:_0x539441[_0x28b5('0x42')];if(!_0x4cce03[_0x28b5('0x43')][_0x28b5('0x49')](_0x28b5('0x4a'))){_0x39ee82[_0x28b5('0x2c')]=qs[_0x28b5('0x2c')](_0x4cce03[_0x28b5('0x43')]['limit']);_0x39ee82['offset']=qs[_0x28b5('0x2e')](_0x4cce03[_0x28b5('0x43')]['offset']);}_0x39ee82['order']=qs['sort'](_0x4cce03[_0x28b5('0x43')][_0x28b5('0x4c')]);_0x39ee82[_0x28b5('0x4d')]=qs[_0x28b5('0x45')](_[_0x28b5('0x4e')](_0x4cce03[_0x28b5('0x43')],_0x539441[_0x28b5('0x45')]));_0x39ee82['where']['OpenchannelAccountId']=_0x563586['id'];if(_0x4cce03[_0x28b5('0x43')][_0x28b5('0x4f')]){_0x39ee82[_0x28b5('0x4d')]=_['merge'](_0x39ee82[_0x28b5('0x4d')],{'$or':_['map'](_0x39ee82[_0x28b5('0x47')],function(_0x2a0497){var _0xdc207={};_0xdc207[_0x2a0497]={'$like':'%'+_0x4cce03[_0x28b5('0x43')][_0x28b5('0x4f')]+'%'};return _0xdc207;})});}_0x39ee82=_['merge']({},_0x39ee82,_0x4cce03[_0x28b5('0x52')]);return db[_0x28b5('0x67')]['count']({'where':_0x39ee82[_0x28b5('0x4d')]})[_0x28b5('0x1f')](function(_0x2d8898){_0xf58381[_0x28b5('0x2d')]=_0x2d8898;if(_0x4cce03[_0x28b5('0x43')][_0x28b5('0x53')]){_0x39ee82[_0x28b5('0x68')]=[{'all':!![]}];}return db['CannedAnswer'][_0x28b5('0x69')](_0x39ee82);})[_0x28b5('0x1f')](function(_0x289eac){_0xf58381[_0x28b5('0x63')]=_0x289eac;return _0xf58381;});}})['then'](respondWithFilteredResult(_0x3fdedb,_0x39ee82))[_0x28b5('0x27')](handleError(_0x3fdedb,null));};exports[_0x28b5('0x6a')]=function(_0x10af3b,_0x231c0e,_0x405761){return db[_0x28b5('0x3e')][_0x28b5('0x55')]({'where':{'id':_0x10af3b[_0x28b5('0x5d')]['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0x231c0e,null))[_0x28b5('0x1f')](function(_0x4e1e3e){if(_0x4e1e3e){return _0x4e1e3e[_0x28b5('0x6a')](_0x10af3b[_0x28b5('0x43')][_0x28b5('0x65')]);}})[_0x28b5('0x1f')](respondWithStatusCode(_0x231c0e,null))[_0x28b5('0x27')](handleError(_0x231c0e,null));};exports[_0x28b5('0x6b')]=function(_0x443eb9,_0x59ba8b,_0xf437c0){var _0x1aa8a8={'body':_0x443eb9[_0x28b5('0x56')],'channel':_0x28b5('0x6c')};var _0x482dd8=[];var _0x1e779e=[];var _0x4ef808={};var _0x535ede=![];return db[_0x28b5('0x6d')][_0x28b5('0x5e')]()[_0x28b5('0x1f')](function(_0x269cb2){if(!_0x269cb2){throw new db[(_0x28b5('0x6e'))][(_0x28b5('0x6f'))](_0x28b5('0x70'));}_0x482dd8=_['difference'](_['keys'](_0x269cb2),[_0x28b5('0x71'),'updatedAt']);_0x1e779e=_[_0x28b5('0x72')](_['keys'](_0x269cb2),[_0x28b5('0x71'),_0x28b5('0x73'),'CompanyId',_0x28b5('0x74')]);if(_0x443eb9[_0x28b5('0x56')]['id']){delete _0x443eb9[_0x28b5('0x56')]['id'];}if(_[_0x28b5('0x75')](_0x443eb9[_0x28b5('0x56')]['from'])){throw new db['Sequelize'][(_0x28b5('0x6f'))]('from\x20is\x20mandatory');}if(_[_0x28b5('0x75')](_0x443eb9[_0x28b5('0x56')][_0x28b5('0x56')])||_0x443eb9[_0x28b5('0x56')]['body']===''){throw new db[(_0x28b5('0x6e'))][(_0x28b5('0x6f'))](_0x28b5('0x76'));}if(_[_0x28b5('0x75')](_0x443eb9['body'][_0x28b5('0x77')])){throw new db[(_0x28b5('0x6e'))][(_0x28b5('0x6f'))](_0x28b5('0x78')+_0x1e779e);}if(!_[_0x28b5('0x79')](_0x1e779e,_0x443eb9[_0x28b5('0x56')][_0x28b5('0x77')])){throw new db[(_0x28b5('0x6e'))][(_0x28b5('0x6f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1e779e);}_0x4ef808[_0x443eb9[_0x28b5('0x56')][_0x28b5('0x77')]]=_0x443eb9[_0x28b5('0x56')][_0x28b5('0x7a')];})[_0x28b5('0x1f')](function(){return db[_0x28b5('0x3e')][_0x28b5('0x55')]({'where':{'id':_0x443eb9[_0x28b5('0x5d')]['id']},'include':[{'model':db[_0x28b5('0x7b')],'as':_0x28b5('0x7c'),'include':[{'model':db[_0x28b5('0x6d')],'as':_0x28b5('0x7d'),'where':_0x4ef808,'limit':0x1,'order':[[_0x28b5('0x73'),_0x28b5('0x7e')]]}]},{'model':db['OpenchannelApplication'],'as':_0x28b5('0x7f')}]});})[_0x28b5('0x1f')](handleEntityNotFound(_0x59ba8b,null))['then'](function(_0x4be713){if(_0x4be713&&_0x4be713['List']){_0x1aa8a8[_0x28b5('0x80')]=_0x4be713;_0x1aa8a8[_0x28b5('0x81')]=_0x4be713[_0x28b5('0x7f')];_0x1aa8a8[_0x28b5('0x82')]=_0x4be713[_0x28b5('0x7c')];_0x1aa8a8['applications']=_[_0x28b5('0x83')](_0x1aa8a8[_0x28b5('0x81')],[_0x28b5('0x84')],[_0x28b5('0x85')]);if(_0x1aa8a8[_0x28b5('0x80')][_0x28b5('0x7f')]){delete _0x1aa8a8[_0x28b5('0x80')][_0x28b5('0x7f')];}if(_0x1aa8a8[_0x28b5('0x80')]['List']&&_0x1aa8a8[_0x28b5('0x80')][_0x28b5('0x7c')][_0x28b5('0x7d')][_0x28b5('0x54')]){return _0x1aa8a8[_0x28b5('0x80')]['List'][_0x28b5('0x7d')][0x0];}var _0x27a2b0=_[_0x28b5('0x19')](_0x443eb9[_0x28b5('0x56')],{'firstName':_0x443eb9['body'][_0x28b5('0x7a')],'ListId':_0x4be713[_0x28b5('0x74')]});_0x27a2b0[_0x443eb9[_0x28b5('0x56')][_0x28b5('0x77')]]=_0x443eb9[_0x28b5('0x56')]['from'];return db[_0x28b5('0x6d')]['create'](_0x27a2b0,{'fields':_0x482dd8,'raw':!![]});}})['then'](handleEntityNotFound(_0x59ba8b,null))[_0x28b5('0x1f')](function(_0x4ac482){_0x1aa8a8[_0x28b5('0x86')]=_0x4ac482;if(_0x4ac482){var _0x319160={'ContactId':_0x4ac482['id'],'OpenchannelAccountId':_0x443eb9[_0x28b5('0x5d')]['id'],'from':(_0x4ac482[_0x28b5('0x87')]||'')+'\x20'+(_0x4ac482[_0x28b5('0x88')]||'')};var _0x1d4abd={'OpenchannelAccountId':_0x443eb9['params']['id'],'closed':![]};if(_0x443eb9[_0x28b5('0x56')][_0x28b5('0x89')]){_0x1d4abd['threadId']=_0x443eb9[_0x28b5('0x56')][_0x28b5('0x89')];return db[_0x28b5('0x8a')][_0x28b5('0x55')]({'where':_0x1d4abd})[_0x28b5('0x1f')](function(_0x479905){if(_0x479905){return[_0x479905,![]];}_0x319160['threadId']=_0x443eb9['body']['threadId'];_0x319160['externalUrl']=_0x443eb9[_0x28b5('0x56')]['externalUrl'];return db[_0x28b5('0x8a')][_0x28b5('0x5b')](_0x319160)[_0x28b5('0x1f')](function(_0x43f4db){return[_0x43f4db,!![]];});});}else{_0x1d4abd[_0x28b5('0x89')]=null;}_0x1d4abd[_0x28b5('0x8b')]=_0x4ac482['id'];return db['OpenchannelInteraction'][_0x28b5('0x55')]({'where':_0x1d4abd})[_0x28b5('0x1f')](function(_0x4c382f){if(_0x4c382f){return[_0x4c382f,![]];}return db[_0x28b5('0x8a')][_0x28b5('0x5b')](_0x319160)[_0x28b5('0x1f')](function(_0x37c5f8){return[_0x37c5f8,!![]];});});}})[_0x28b5('0x8c')](function(_0x42bb4b,_0x1b3233){if(_0x42bb4b){_0x535ede=_0x1b3233;if(!_0x1b3233){var _0x444699={'from':(_0x1aa8a8['contact'][_0x28b5('0x87')]||'')+'\x20'+(_0x1aa8a8[_0x28b5('0x86')][_0x28b5('0x88')]||'')};if(_0x443eb9['body']['threadId']&&_0x443eb9[_0x28b5('0x56')][_0x28b5('0x8d')]&&_0x443eb9['body'][_0x28b5('0x89')]!=_0x443eb9['body'][_0x28b5('0x8d')]){_0x444699['threadId']=_0x443eb9[_0x28b5('0x56')][_0x28b5('0x8d')];}return _0x42bb4b[_0x28b5('0x34')](_0x444699);}else{return _0x42bb4b;}}})[_0x28b5('0x1f')](function(_0x5aa7b2){_0x1aa8a8['interaction']=_0x5aa7b2[_0x28b5('0x35')]({'plain':!![]});_0x1aa8a8[_0x28b5('0x8e')]['created']=_0x535ede;if(_0x1aa8a8['interaction']['created']){if(_0x1aa8a8[_0x28b5('0x80')][_0x28b5('0x8f')]){_0x1aa8a8[_0x28b5('0x81')][_0x28b5('0x90')]({'id':0x0,'priority':_0x1aa8a8[_0x28b5('0x81')][_0x28b5('0x54')]+0x1,'app':_0x28b5('0x91'),'appdata':_0x28b5('0x92'),'interval':'*,*,*,*'});}}return db[_0x28b5('0x93')][_0x28b5('0x5b')]({'body':_0x443eb9['body']['body'],'OpenchannelAccountId':_0x443eb9[_0x28b5('0x5d')]['id'],'OpenchannelInteractionId':_0x5aa7b2['id'],'direction':'in','ContactId':_0x1aa8a8[_0x28b5('0x86')]['id'],'AttachmentId':_0x443eb9['body'][_0x28b5('0x94')]});})[_0x28b5('0x1f')](function(_0x5affdd){_0x1aa8a8['message']=_0x5affdd;if(!_0x1aa8a8[_0x28b5('0x8e')][_0x28b5('0x95')])return;return db[_0x28b5('0x96')][_0x28b5('0x55')]({'attributes':['id',_0x28b5('0x39')],'where':{'id':_0x1aa8a8[_0x28b5('0x8e')][_0x28b5('0x95')]}});})[_0x28b5('0x1f')](function(_0x1b93cc){if(_0x1b93cc){_0x1aa8a8[_0x28b5('0x81')][_0x28b5('0x97')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1b93cc[_0x28b5('0x39')]+','+(_0x1aa8a8['account']['waitForTheAssignedAgent']||0xa),'interval':_0x28b5('0x98')});}if(!_0x1aa8a8[_0x28b5('0x8e')][_0x28b5('0x99')])return;return db['OpenchannelQueue'][_0x28b5('0x55')]({'attributes':['id',_0x28b5('0x39')],'where':{'id':_0x1aa8a8[_0x28b5('0x8e')][_0x28b5('0x99')]}});})[_0x28b5('0x1f')](function(_0x19e048){if(_0x19e048){_0x1aa8a8[_0x28b5('0x81')][_0x28b5('0x97')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x19e048[_0x28b5('0x39')]+','+(_0x1aa8a8[_0x28b5('0x80')][_0x28b5('0x9a')]||0x12c),'interval':_0x28b5('0x98')});}return respondWithRpcPromise('Start',_0x28b5('0x9b'),_0x1aa8a8);})[_0x28b5('0x1f')](function(_0x3cffb9){respondWithRpcPromise(_0x28b5('0x9c'),_0x28b5('0x9c'),{'event':'notify','message':_0x3cffb9},client9002);return _0x3cffb9;})[_0x28b5('0x1f')](respondWithResult(_0x59ba8b,null))[_0x28b5('0x27')](handleError(_0x59ba8b,null));};exports[_0x28b5('0x9d')]=function(_0x2908f2,_0xaae9a9){var _0x45fbe0=_0x2908f2['params']['id'];var _0x4e5a12=_0x2908f2['body'];var _0x2c5d6d=0xc8;var _0x20c265=null;return db[_0x28b5('0x9e')][_0x28b5('0x9f')]({'isolationLevel':db[_0x28b5('0x9e')][_0x28b5('0xa0')][_0x28b5('0xa1')][_0x28b5('0xa2')]},function(_0x5c8929){return db['OpenchannelAccount'][_0x28b5('0x62')]({'where':{'id':_0x45fbe0},'transaction':_0x5c8929})[_0x28b5('0x1f')](function(_0x2d8a9b){if(_0x2d8a9b){return db[_0x28b5('0xa3')]['destroy']({'where':{'OpenchannelAccountId':_0x45fbe0},'transaction':_0x5c8929})[_0x28b5('0x1f')](function(){var _0x57d5e6=_['map'](_0x4e5a12,function(_0x1bccdc){_0x1bccdc[_0x28b5('0xa4')]=_0x45fbe0;return _0x1bccdc;});return db[_0x28b5('0xa3')][_0x28b5('0xa5')](_0x57d5e6,{'transaction':_0x5c8929});});}else{_0x2c5d6d=0x194;_0x20c265=[];}});})[_0x28b5('0x1f')](function(){if(_0x2c5d6d!==0x194){return db['OpenchannelApplication'][_0x28b5('0xa6')]({'where':{'OpenchannelAccountId':_0x45fbe0},'order':_0x28b5('0x84')})[_0x28b5('0x1f')](function(_0xc3fbc8){_0x20c265=_0xc3fbc8;});}})[_0x28b5('0x27')](function(_0x4cbafe){_0x2c5d6d=0x1f4;logger[_0x28b5('0x23')](_0x4cbafe[_0x28b5('0x38')]);if(_0x4cbafe[_0x28b5('0x39')]){delete _0x4cbafe[_0x28b5('0x39')];}_0x20c265=_0x4cbafe;})['finally'](function(){if(_0x20c265===null){_0xaae9a9[_0x28b5('0xa7')](_0x2c5d6d);}else{if(_0x2c5d6d===0x1f4){_0xaae9a9['status'](_0x2c5d6d)[_0x28b5('0xa8')](_0x20c265);}else{_0xaae9a9['status'](_0x2c5d6d)['json'](_0x20c265);}}});};exports[_0x28b5('0xa9')]=function(_0x125bcd,_0x1802fe,_0x39c768){var _0x36a7d8={};var _0x5a50a9={};var _0x49bd3e;var _0x896dcb;return db[_0x28b5('0x3e')][_0x28b5('0x62')]({'where':{'id':_0x125bcd['params']['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0x1802fe,null))[_0x28b5('0x1f')](function(_0x4c325f){if(_0x4c325f){_0x49bd3e=_0x4c325f;_0x5a50a9[_0x28b5('0x42')]=_['keys'](db[_0x28b5('0xa3')][_0x28b5('0x3f')]);_0x5a50a9[_0x28b5('0x43')]=_[_0x28b5('0x44')](_0x125bcd[_0x28b5('0x43')]);_0x5a50a9[_0x28b5('0x45')]=_[_0x28b5('0x46')](_0x5a50a9[_0x28b5('0x42')],_0x5a50a9[_0x28b5('0x43')]);_0x36a7d8[_0x28b5('0x47')]=_[_0x28b5('0x46')](_0x5a50a9[_0x28b5('0x42')],qs[_0x28b5('0x48')](_0x125bcd[_0x28b5('0x43')][_0x28b5('0x48')]));_0x36a7d8[_0x28b5('0x47')]=_0x36a7d8[_0x28b5('0x47')]['length']?_0x36a7d8[_0x28b5('0x47')]:_0x5a50a9[_0x28b5('0x42')];_0x36a7d8['order']=qs['sort'](_0x125bcd[_0x28b5('0x43')][_0x28b5('0x4c')]);_0x36a7d8['where']=qs['filters'](_[_0x28b5('0x4e')](_0x125bcd[_0x28b5('0x43')],_0x5a50a9[_0x28b5('0x45')]));if(_0x125bcd[_0x28b5('0x43')][_0x28b5('0x4f')]){_0x36a7d8[_0x28b5('0x4d')]=_[_0x28b5('0x50')](_0x36a7d8[_0x28b5('0x4d')],{'$or':_[_0x28b5('0x3d')](_0x36a7d8['attributes'],function(_0x56fd56){var _0x24c587={};_0x24c587[_0x56fd56]={'$like':'%'+_0x125bcd[_0x28b5('0x43')]['filter']+'%'};return _0x24c587;})});}_0x36a7d8=_['merge']({},_0x36a7d8,_0x125bcd[_0x28b5('0x52')]);return _0x49bd3e[_0x28b5('0xa9')](_0x36a7d8);}})[_0x28b5('0x1f')](function(_0x444d08){if(_0x444d08){_0x896dcb=_0x444d08[_0x28b5('0x54')];if(!_0x125bcd[_0x28b5('0x43')][_0x28b5('0x49')](_0x28b5('0x4a'))){_0x36a7d8[_0x28b5('0x2c')]=qs[_0x28b5('0x2c')](_0x125bcd['query']['limit']);_0x36a7d8[_0x28b5('0x2e')]=qs[_0x28b5('0x2e')](_0x125bcd['query'][_0x28b5('0x2e')]);}return _0x49bd3e[_0x28b5('0xa9')](_0x36a7d8);}})[_0x28b5('0x1f')](function(_0x16c767){if(_0x16c767){return _0x16c767?{'count':_0x896dcb,'rows':_0x16c767}:null;}})[_0x28b5('0x1f')](respondWithResult(_0x1802fe,null))['catch'](handleError(_0x1802fe,null));};exports[_0x28b5('0xaa')]=function(_0x632bf9,_0xfd7018,_0x124d85){var _0x444f79={'raw':![],'where':{}};var _0x25b683={};var _0x200e4d={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x28b5('0x62')]({'where':{'id':_0x632bf9['params']['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0xfd7018,null))[_0x28b5('0x1f')](function(_0x3aaa86){if(_0x3aaa86){_0x25b683['model']=_[_0x28b5('0x44')](db[_0x28b5('0x8a')][_0x28b5('0x3f')]);_0x25b683[_0x28b5('0x43')]=_['keys'](_0x632bf9['query']);_0x25b683[_0x28b5('0x45')]=_['intersection'](_0x25b683['model'],_0x25b683['query']);_0x444f79[_0x28b5('0x47')]=_[_0x28b5('0x46')](_0x25b683[_0x28b5('0x42')],qs[_0x28b5('0x48')](_0x632bf9[_0x28b5('0x43')][_0x28b5('0x48')]));_0x444f79[_0x28b5('0x47')]=_0x444f79[_0x28b5('0x47')][_0x28b5('0x54')]?_0x444f79[_0x28b5('0x47')]:_0x25b683['model'];if(!_0x632bf9[_0x28b5('0x43')]['hasOwnProperty']('nolimit')){_0x444f79[_0x28b5('0x2c')]=qs[_0x28b5('0x2c')](_0x632bf9[_0x28b5('0x43')][_0x28b5('0x2c')]);_0x444f79[_0x28b5('0x2e')]=qs[_0x28b5('0x2e')](_0x632bf9[_0x28b5('0x43')][_0x28b5('0x2e')]);}_0x444f79[_0x28b5('0x4b')]=qs[_0x28b5('0x4c')](_0x632bf9[_0x28b5('0x43')][_0x28b5('0x4c')]);_0x444f79[_0x28b5('0x4d')]=qs[_0x28b5('0x45')](_[_0x28b5('0x4e')](_0x632bf9['query'],_0x25b683[_0x28b5('0x45')]));_0x444f79[_0x28b5('0x4d')]['OpenchannelAccountId']=_0x3aaa86['id'];if(_0x632bf9[_0x28b5('0x43')][_0x28b5('0x4f')]){_0x444f79[_0x28b5('0x4d')]=_[_0x28b5('0x50')](_0x444f79[_0x28b5('0x4d')],{'$or':_[_0x28b5('0x3d')](_0x444f79[_0x28b5('0x47')],function(_0x1e1494){var _0xf050f7={};_0xf050f7[_0x1e1494]={'$like':'%'+_0x632bf9[_0x28b5('0x43')][_0x28b5('0x4f')]+'%'};return _0xf050f7;})});}_0x444f79=_[_0x28b5('0x50')]({},_0x444f79,_0x632bf9['options']);return db[_0x28b5('0x8a')][_0x28b5('0x2d')]({'where':_0x444f79[_0x28b5('0x4d')]})['then'](function(_0x3371a1){_0x200e4d[_0x28b5('0x2d')]=_0x3371a1;if(_0x632bf9[_0x28b5('0x43')][_0x28b5('0x53')]){_0x444f79['include']=[{'model':db[_0x28b5('0x6d')],'as':_0x28b5('0xab'),'required':![]},{'model':db[_0x28b5('0x96')],'as':_0x28b5('0xac'),'attributes':[_0x28b5('0x39'),_0x28b5('0xad'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x28b5('0xae'),'attributes':['id',_0x28b5('0x39'),'color'],'where':_0x632bf9[_0x28b5('0x43')][_0x28b5('0xaf')]?{'id':_0x632bf9[_0x28b5('0x43')][_0x28b5('0xaf')]}:undefined,'required':_0x632bf9[_0x28b5('0x43')][_0x28b5('0xaf')]?!![]:![]}];}return db[_0x28b5('0x8a')][_0x28b5('0x69')](_0x444f79);})[_0x28b5('0x1f')](function(_0x6dd42c){_0x200e4d['rows']=_0x6dd42c;return _0x200e4d;});}})[_0x28b5('0x1f')](respondWithFilteredResult(_0xfd7018,_0x444f79))[_0x28b5('0x27')](handleError(_0xfd7018,null));};exports[_0x28b5('0xb0')]=function(_0x5782a7,_0x39f327,_0x50d4bd){return db[_0x28b5('0x3e')][_0x28b5('0x55')]({'where':{'id':_0x5782a7['params']['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0x39f327,null))[_0x28b5('0x1f')](function(_0x4cf796){if(_0x4cf796){return _0x4cf796[_0x28b5('0xb0')](_0x5782a7[_0x28b5('0x56')][_0x28b5('0x65')],_[_0x28b5('0xb1')](_0x5782a7[_0x28b5('0x56')],[_0x28b5('0x65'),'id'])||{})['spread'](function(_0x268ece){for(var _0x1feee3=0x0;_0x1feee3<_0x5782a7['body'][_0x28b5('0x65')][_0x28b5('0x54')];_0x1feee3+=0x1){socket['emit'](_0x28b5('0xb2'),{'UserId':Number(_0x5782a7[_0x28b5('0x56')][_0x28b5('0x65')][_0x1feee3]),'OpenchannelAccountId':Number(_0x5782a7[_0x28b5('0x5d')]['id'])});}return _0x268ece;});}})[_0x28b5('0x1f')](respondWithResult(_0x39f327,null))[_0x28b5('0x27')](handleError(_0x39f327,null));};exports[_0x28b5('0xb3')]=function(_0x44f14c,_0x52d341,_0x40c731){return db[_0x28b5('0x3e')][_0x28b5('0x55')]({'where':{'id':_0x44f14c['params']['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0x52d341,null))[_0x28b5('0x1f')](function(_0x4c39d2){if(_0x4c39d2){return _0x4c39d2[_0x28b5('0xb3')](_0x44f14c[_0x28b5('0x43')]['ids'])[_0x28b5('0x1f')](function(){if(_['isArray'](_0x44f14c[_0x28b5('0x43')]['ids'])){for(var _0x258928=0x0;_0x258928<_0x44f14c[_0x28b5('0x43')][_0x28b5('0x65')]['length'];_0x258928+=0x1){socket[_0x28b5('0xb4')](_0x28b5('0xb5'),{'UserId':Number(_0x44f14c['query'][_0x28b5('0x65')][_0x258928]),'OpenchannelAccountId':Number(_0x44f14c[_0x28b5('0x5d')]['id'])});}}else{socket[_0x28b5('0xb4')](_0x28b5('0xb5'),{'UserId':Number(_0x44f14c[_0x28b5('0x43')][_0x28b5('0x65')]),'OpenchannelAccountId':Number(_0x44f14c[_0x28b5('0x5d')]['id'])});}});}})[_0x28b5('0x1f')](respondWithStatusCode(_0x52d341,null))[_0x28b5('0x27')](handleError(_0x52d341,null));};exports[_0x28b5('0xb6')]=function(_0x32a412,_0x512dd9,_0x239c26){var _0x3e2062={};var _0x4fb0d4={};var _0x48fa42;var _0x597a42;return db[_0x28b5('0x3e')]['findOne']({'where':{'id':_0x32a412[_0x28b5('0x5d')]['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0x512dd9,null))['then'](function(_0x514cc2){if(_0x514cc2){_0x48fa42=_0x514cc2;_0x4fb0d4[_0x28b5('0x42')]=_[_0x28b5('0x44')](db[_0x28b5('0x96')][_0x28b5('0x3f')]);_0x4fb0d4[_0x28b5('0x43')]=_[_0x28b5('0x44')](_0x32a412[_0x28b5('0x43')]);_0x4fb0d4[_0x28b5('0x45')]=_[_0x28b5('0x46')](_0x4fb0d4[_0x28b5('0x42')],_0x4fb0d4['query']);_0x3e2062[_0x28b5('0x47')]=_[_0x28b5('0x46')](_0x4fb0d4['model'],qs['fields'](_0x32a412[_0x28b5('0x43')]['fields']));_0x3e2062[_0x28b5('0x47')]=_0x3e2062['attributes']['length']?_0x3e2062[_0x28b5('0x47')]:_0x4fb0d4[_0x28b5('0x42')];_0x3e2062['order']=qs[_0x28b5('0x4c')](_0x32a412[_0x28b5('0x43')][_0x28b5('0x4c')]);_0x3e2062[_0x28b5('0x4d')]=qs['filters'](_['pick'](_0x32a412[_0x28b5('0x43')],_0x4fb0d4[_0x28b5('0x45')]));if(_0x32a412[_0x28b5('0x43')][_0x28b5('0x4f')]){_0x3e2062[_0x28b5('0x4d')]=_[_0x28b5('0x50')](_0x3e2062[_0x28b5('0x4d')],{'$or':_['map'](_0x3e2062[_0x28b5('0x47')],function(_0x3dc83b){var _0x51b332={};_0x51b332[_0x3dc83b]={'$like':'%'+_0x32a412['query'][_0x28b5('0x4f')]+'%'};return _0x51b332;})});}_0x3e2062=_[_0x28b5('0x50')]({},_0x3e2062,_0x32a412['options']);return _0x48fa42[_0x28b5('0xb6')](_0x3e2062);}})[_0x28b5('0x1f')](function(_0x57f6f9){if(_0x57f6f9){_0x597a42=_0x57f6f9[_0x28b5('0x54')];if(!_0x32a412[_0x28b5('0x43')]['hasOwnProperty'](_0x28b5('0x4a'))){_0x3e2062[_0x28b5('0x2c')]=qs[_0x28b5('0x2c')](_0x32a412[_0x28b5('0x43')][_0x28b5('0x2c')]);_0x3e2062['offset']=qs[_0x28b5('0x2e')](_0x32a412[_0x28b5('0x43')][_0x28b5('0x2e')]);}return _0x48fa42[_0x28b5('0xb6')](_0x3e2062);}})[_0x28b5('0x1f')](function(_0x339791){if(_0x339791){return _0x339791?{'count':_0x597a42,'rows':_0x339791}:null;}})['then'](respondWithResult(_0x512dd9,null))[_0x28b5('0x27')](handleError(_0x512dd9,null));};exports[_0x28b5('0xa8')]=function(_0x371987,_0x200839,_0x416838){var _0xa0039f,_0x5a1629,_0x1a0850;if(_['isNil'](_0x371987[_0x28b5('0x56')][_0x28b5('0x56')])||_0x371987['body'][_0x28b5('0x56')]===''){throw new db[(_0x28b5('0x6e'))][(_0x28b5('0x6f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x28b5('0x75')](_0x371987[_0x28b5('0x56')]['to'])){}_0xa0039f=_0x371987[_0x28b5('0x56')]['to'];return db[_0x28b5('0x3e')][_0x28b5('0x62')]({'where':{'id':_0x371987[_0x28b5('0x5d')]['id']}})[_0x28b5('0x1f')](handleEntityNotFound(_0x200839,null))[_0x28b5('0x1f')](function(_0x2ad640){if(_0x2ad640){return db[_0x28b5('0x3e')]['find']({'where':{'id':_0x2ad640['id']},'include':[{'model':db[_0x28b5('0x7b')],'as':_0x28b5('0x7c'),'include':[{'model':db['CmContact'],'as':_0x28b5('0x7d'),'where':{[_0x2ad640[_0x28b5('0x77')]]:_0xa0039f},'limit':0x1,'order':[[_0x28b5('0x73'),_0x28b5('0x7e')]]}]}]})[_0x28b5('0x1f')](handleEntityNotFound(_0x200839,null))[_0x28b5('0x1f')](function(_0x54a5c9){if(_0x54a5c9&&_0x54a5c9[_0x28b5('0x7c')]){_0x5a1629=_0x54a5c9[_0x28b5('0x35')]({'plain':!![]});if(_0x5a1629['List']&&_0x5a1629[_0x28b5('0x7c')]['Contacts']['length']){return _0x5a1629[_0x28b5('0x7c')][_0x28b5('0x7d')][0x0];}return db[_0x28b5('0x6d')][_0x28b5('0x5b')](_['defaults'](_0x371987['body'],{'firstName':_0xa0039f,[_0x54a5c9[_0x28b5('0x77')]]:_0xa0039f,'phone':_0xa0039f,'ListId':_0x5a1629[_0x28b5('0x74')]}));}})[_0x28b5('0x1f')](handleEntityNotFound(_0x200839,null))['then'](function(_0x101164){if(_0x101164){_0x1a0850=_0x101164;return db[_0x28b5('0x8a')][_0x28b5('0x55')]({'where':{'ContactId':_0x1a0850['id'],'closed':![],'OpenchannelAccountId':_0x5a1629['id']}})[_0x28b5('0x1f')](function(_0x24815b){if(_0x24815b){return[_0x24815b,![]];}return db['OpenchannelInteraction'][_0x28b5('0x5b')]({'UserId':_0x371987[_0x28b5('0x57')]['id'],'ContactId':_0x1a0850['id'],'OpenchannelAccountId':_0x5a1629['id'],'lastMsgDirection':_0x28b5('0xb7'),'firstMsgDirection':'out','Messages':[_[_0x28b5('0x50')](_0x371987[_0x28b5('0x56')],{'read':![],'body':_0x371987[_0x28b5('0x56')]['body'],'OpenchannelAccountId':_0x5a1629['id'],'UserId':_0x371987[_0x28b5('0x57')]['id'],'ContactId':_0x1a0850['id']})]},{'include':[{'model':db[_0x28b5('0x93')],'as':_0x28b5('0xb8')}]})[_0x28b5('0x1f')](function(_0x4c11e1){return[_0x4c11e1,!![]];});});}})[_0x28b5('0x8c')](function(_0x40a176,_0x7e014c){if(_0x7e014c){return _0x40a176;}return db[_0x28b5('0x93')][_0x28b5('0x5b')](_[_0x28b5('0x50')](_0x371987[_0x28b5('0x56')],{'read':![],'body':_0x371987[_0x28b5('0x56')][_0x28b5('0x56')],'OpenchannelAccountId':_0x5a1629['id'],'OpenchannelInteractionId':_0x40a176['id'],'UserId':_0x371987['user']['id'],'ContactId':_0x1a0850['id']}))[_0x28b5('0x1f')](function(_0x126efc){_0x40a176[_0x28b5('0xb9')][_0x28b5('0xb8')]=[];_0x40a176['dataValues'][_0x28b5('0xb8')][_0x28b5('0x90')](_0x126efc['dataValues']);return _0x40a176;});});}})['then'](respondWithResult(_0x200839,null))[_0x28b5('0x27')](handleError(_0x200839,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 0ae2c99..1d7577e 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 _0x54ef=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update'];(function(_0x57b336,_0x5aa2fa){var _0x57213a=function(_0x27d10d){while(--_0x27d10d){_0x57b336['push'](_0x57b336['shift']());}};_0x57213a(++_0x5aa2fa);}(_0x54ef,0x112));var _0xf54e=function(_0x14bbc4,_0x3ebbc6){_0x14bbc4=_0x14bbc4-0x0;var _0x427a50=_0x54ef[_0x14bbc4];return _0x427a50;};'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 +var _0xec56=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0xec56,0x1bd));var _0x6ec5=function(_0x4395d3,_0x23c9bf){_0x4395d3=_0x4395d3-0x0;var _0x1882fb=_0xec56[_0x4395d3];return _0x1882fb;};'use strict';var EventEmitter=require(_0x6ec5('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6ec5('0x1')](0x0);var events={'afterCreate':_0x6ec5('0x2'),'afterUpdate':_0x6ec5('0x3'),'afterDestroy':_0x6ec5('0x4')};function emitEvent(_0x43c2cd){return function(_0x399441,_0x469679,_0x173aeb){OpenchannelAccountEvents[_0x6ec5('0x5')](_0x43c2cd+':'+_0x399441['id'],_0x399441);OpenchannelAccountEvents[_0x6ec5('0x5')](_0x43c2cd,_0x399441);_0x173aeb(null);};}for(var e in events){if(events[_0x6ec5('0x6')](e)){var event=events[e];OpenchannelAccount[_0x6ec5('0x7')](e,emitEvent(event));}}module[_0x6ec5('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 9c8cd59..f0d91b4 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(_0x27b8f1,_0x2c02a2){var _0x2f7c80=function(_0x15d1fb){while(--_0x15d1fb){_0x27b8f1['push'](_0x27b8f1['shift']());}};_0x2f7c80(++_0x2c02a2);}(_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':'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(_0x4bcbe7,_0x14c907){var _0x5f2423=function(_0x30b4df){while(--_0x30b4df){_0x4bcbe7['push'](_0x4bcbe7['shift']());}};_0x5f2423(++_0x14c907);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 ab3ea72..835f497 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 _0xae60=['client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x3ccd6d,_0x5a84a1){var _0x1905ec=function(_0x4e283e){while(--_0x4e283e){_0x3ccd6d['push'](_0x3ccd6d['shift']());}};_0x1905ec(++_0x5a84a1);}(_0xae60,0x1c7));var _0x0ae6=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xae60[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});config[_0x0ae6('0xb')]=_[_0x0ae6('0xc')](config[_0x0ae6('0xb')],{'host':_0x0ae6('0xd'),'port':0x18eb});var socket=require(_0x0ae6('0xe'))(new Redis(config['redis']));require(_0x0ae6('0xf'))[_0x0ae6('0x10')](socket);function respondWithRpcPromise(_0x3a8b0e,_0x39787a,_0x4c2698){return new BPromise(function(_0x24e211,_0x1def8c){return client[_0x0ae6('0x11')](_0x3a8b0e,_0x4c2698)[_0x0ae6('0x12')](function(_0x3ae7fa){logger[_0x0ae6('0x13')](_0x0ae6('0x14'),_0x39787a,_0x0ae6('0x15'));logger[_0x0ae6('0x16')](_0x0ae6('0x17'),_0x39787a,_0x0ae6('0x15'),JSON[_0x0ae6('0x18')](_0x3ae7fa));if(_0x3ae7fa[_0x0ae6('0x19')]){if(_0x3ae7fa[_0x0ae6('0x19')]['code']===0x1f4){logger[_0x0ae6('0x19')](_0x0ae6('0x14'),_0x39787a,_0x3ae7fa[_0x0ae6('0x19')][_0x0ae6('0x1a')]);return _0x1def8c(_0x3ae7fa[_0x0ae6('0x19')][_0x0ae6('0x1a')]);}logger[_0x0ae6('0x19')](_0x0ae6('0x14'),_0x39787a,_0x3ae7fa[_0x0ae6('0x19')][_0x0ae6('0x1a')]);return _0x24e211(_0x3ae7fa[_0x0ae6('0x19')][_0x0ae6('0x1a')]);}else{logger[_0x0ae6('0x13')](_0x0ae6('0x14'),_0x39787a,_0x0ae6('0x15'));_0x24e211(_0x3ae7fa[_0x0ae6('0x1b')][_0x0ae6('0x1a')]);}})[_0x0ae6('0x1c')](function(_0x2ca2a3){logger[_0x0ae6('0x19')](_0x0ae6('0x14'),_0x39787a,_0x2ca2a3);_0x1def8c(_0x2ca2a3);});});} \ No newline at end of file +var _0x76dc=['error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x18c769,_0x414ce3){var _0x10af0f=function(_0x4f64aa){while(--_0x4f64aa){_0x18c769['push'](_0x18c769['shift']());}};_0x10af0f(++_0x414ce3);}(_0x76dc,0x1f2));var _0xc76d=function(_0x4be618,_0x31cd76){_0x4be618=_0x4be618-0x0;var _0x2ab2f1=_0x76dc[_0x4be618];return _0x2ab2f1;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var moment=require(_0xc76d('0x2'));var BPromise=require(_0xc76d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc76d('0x4'));var db=require(_0xc76d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc76d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc76d('0x7'));var client=jayson[_0xc76d('0x8')][_0xc76d('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc76d('0xa')],{'host':_0xc76d('0xb'),'port':0x18eb});var socket=require(_0xc76d('0xc'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xc76d('0xd')](socket);function respondWithRpcPromise(_0x2f81bd,_0x4d625c,_0x39a47f){return new BPromise(function(_0x583e46,_0xd5c042){return client[_0xc76d('0xe')](_0x2f81bd,_0x39a47f)[_0xc76d('0xf')](function(_0x95e06b){logger[_0xc76d('0x10')](_0xc76d('0x11'),_0x4d625c,_0xc76d('0x12'));logger[_0xc76d('0x13')](_0xc76d('0x14'),_0x4d625c,_0xc76d('0x12'),JSON[_0xc76d('0x15')](_0x95e06b));if(_0x95e06b[_0xc76d('0x16')]){if(_0x95e06b[_0xc76d('0x16')][_0xc76d('0x17')]===0x1f4){logger['error'](_0xc76d('0x11'),_0x4d625c,_0x95e06b[_0xc76d('0x16')]['message']);return _0xd5c042(_0x95e06b[_0xc76d('0x16')][_0xc76d('0x18')]);}logger[_0xc76d('0x16')](_0xc76d('0x11'),_0x4d625c,_0x95e06b['error'][_0xc76d('0x18')]);return _0x583e46(_0x95e06b['error']['message']);}else{logger[_0xc76d('0x10')](_0xc76d('0x11'),_0x4d625c,_0xc76d('0x12'));_0x583e46(_0x95e06b[_0xc76d('0x19')][_0xc76d('0x18')]);}})['catch'](function(_0x20a078){logger[_0xc76d('0x16')](_0xc76d('0x11'),_0x4d625c,_0x20a078);_0xd5c042(_0x20a078);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 8baaca7..a9202ca 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 _0xb492=['remove','update','emit','removeListener','length','openchannelAccount:','save'];(function(_0x2123a2,_0x3a2254){var _0x5bde85=function(_0x34469d){while(--_0x34469d){_0x2123a2['push'](_0x2123a2['shift']());}};_0x5bde85(++_0x3a2254);}(_0xb492,0x172));var _0x2b49=function(_0x416ba0,_0x2f291f){_0x416ba0=_0x416ba0-0x0;var _0x31381f=_0xb492[_0x416ba0];return _0x31381f;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x2b49('0x0'),_0x2b49('0x1'),_0x2b49('0x2')];function createListener(_0x1f3b35,_0x51fad7){return function(_0x522210){_0x51fad7[_0x2b49('0x3')](_0x1f3b35,_0x522210);};}function removeListener(_0x340296,_0x317a1d){return function(){OpenchannelAccountEvents[_0x2b49('0x4')](_0x340296,_0x317a1d);};}exports['register']=function(_0x53508a){for(var _0x346359=0x0,_0x363d21=events[_0x2b49('0x5')];_0x346359<_0x363d21;_0x346359++){var _0x2b745f=events[_0x346359];var _0x1b06c2=createListener(_0x2b49('0x6')+_0x2b745f,_0x53508a);OpenchannelAccountEvents['on'](_0x2b745f,_0x1b06c2);}}; \ No newline at end of file +var _0xe9f9=['./openchannelAccount.events','remove','update','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9f9,0x174));var _0x9e9f=function(_0x3a9605,_0x4dfb0b){_0x3a9605=_0x3a9605-0x0;var _0x387c8a=_0xe9f9[_0x3a9605];return _0x387c8a;};'use strict';var OpenchannelAccountEvents=require(_0x9e9f('0x0'));var events=['save',_0x9e9f('0x1'),_0x9e9f('0x2')];function createListener(_0x24e489,_0x439590){return function(_0x15d8d0){_0x439590['emit'](_0x24e489,_0x15d8d0);};}function removeListener(_0x2020b3,_0x47f4c7){return function(){OpenchannelAccountEvents[_0x9e9f('0x3')](_0x2020b3,_0x47f4c7);};}exports[_0x9e9f('0x4')]=function(_0x549ea5){for(var _0x32da7a=0x0,_0x54f87c=events[_0x9e9f('0x5')];_0x32da7a<_0x54f87c;_0x32da7a++){var _0x661886=events[_0x32da7a];var _0x10d43b=createListener('openchannelAccount:'+_0x661886,_0x549ea5);OpenchannelAccountEvents['on'](_0x661886,_0x10d43b);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index abc0999..642df14 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 _0x01ab=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0x01ab,0x13e));var _0xb01a=function(_0x4e8401,_0x51b328){_0x4e8401=_0x4e8401-0x0;var _0x17269f=_0x01ab[_0x4e8401];return _0x17269f;};'use strict';var multer=require(_0xb01a('0x0'));var util=require(_0xb01a('0x1'));var path=require(_0xb01a('0x2'));var timeout=require('connect-timeout');var express=require(_0xb01a('0x3'));var router=express[_0xb01a('0x4')]();var fs_extra=require(_0xb01a('0x5'));var auth=require(_0xb01a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb01a('0x7'));var controller=require(_0xb01a('0x8'));router[_0xb01a('0x9')]('/',auth[_0xb01a('0xa')](),controller[_0xb01a('0xb')]);router[_0xb01a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb01a('0xc')]);router[_0xb01a('0xd')]('/',auth[_0xb01a('0xa')](),controller[_0xb01a('0xe')]);router[_0xb01a('0xf')](_0xb01a('0x10'),auth[_0xb01a('0xa')](),controller[_0xb01a('0x11')]);router[_0xb01a('0x12')]('/:id',auth[_0xb01a('0xa')](),controller[_0xb01a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5cfe=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2c51b2,_0x2536d4){var _0x44de83=function(_0xc45e9c){while(--_0xc45e9c){_0x2c51b2['push'](_0x2c51b2['shift']());}};_0x44de83(++_0x2536d4);}(_0x5cfe,0x199));var _0xe5cf=function(_0x311194,_0x52f52b){_0x311194=_0x311194-0x0;var _0x59e87d=_0x5cfe[_0x311194];return _0x59e87d;};'use strict';var multer=require(_0xe5cf('0x0'));var util=require(_0xe5cf('0x1'));var path=require(_0xe5cf('0x2'));var timeout=require(_0xe5cf('0x3'));var express=require(_0xe5cf('0x4'));var router=express[_0xe5cf('0x5')]();var fs_extra=require(_0xe5cf('0x6'));var auth=require(_0xe5cf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe5cf('0x8'));var controller=require('./openchannelApplication.controller');router[_0xe5cf('0x9')]('/',auth[_0xe5cf('0xa')](),controller['index']);router[_0xe5cf('0x9')](_0xe5cf('0xb'),auth['isAuthenticated'](),controller[_0xe5cf('0xc')]);router['post']('/',auth[_0xe5cf('0xa')](),controller['create']);router[_0xe5cf('0xd')](_0xe5cf('0xb'),auth[_0xe5cf('0xa')](),controller[_0xe5cf('0xe')]);router[_0xe5cf('0xf')](_0xe5cf('0xb'),auth['isAuthenticated'](),controller[_0xe5cf('0x10')]);module[_0xe5cf('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 dea2dac..d7ccdcc 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 _0x4414=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x25a19a,_0x536079){var _0x9d8a38=function(_0x55a45c){while(--_0x55a45c){_0x25a19a['push'](_0x25a19a['shift']());}};_0x9d8a38(++_0x536079);}(_0x4414,0x15f));var _0x4441=function(_0x4a9d73,_0x404b5f){_0x4a9d73=_0x4a9d73-0x0;var _0x2544c1=_0x4414[_0x4a9d73];return _0x2544c1;};'use strict';var Sequelize=require(_0x4441('0x0'));module[_0x4441('0x1')]={'priority':{'type':Sequelize[_0x4441('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4441('0x3')],'allowNull':![],'defaultValue':_0x4441('0x4')},'appdata':{'type':Sequelize[_0x4441('0x5')]()},'description':{'type':Sequelize[_0x4441('0x3')]},'interval':{'type':Sequelize[_0x4441('0x3')],'defaultValue':_0x4441('0x6')}}; \ No newline at end of file +var _0xdf47=['noop','STRING','*,*,*,*','exports','INTEGER'];(function(_0x3a4464,_0x37afa0){var _0x42503f=function(_0x379ce7){while(--_0x379ce7){_0x3a4464['push'](_0x3a4464['shift']());}};_0x42503f(++_0x37afa0);}(_0xdf47,0xc6));var _0x7df4=function(_0x331666,_0x205306){_0x331666=_0x331666-0x0;var _0x31b881=_0xdf47[_0x331666];return _0x31b881;};'use strict';var Sequelize=require('sequelize');module[_0x7df4('0x0')]={'priority':{'type':Sequelize[_0x7df4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7df4('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7df4('0x3')]},'interval':{'type':Sequelize[_0x7df4('0x3')],'defaultValue':_0x7df4('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index dd643ea..58adad1 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 _0xeccc=['path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','OpenchannelApplication','includeAll','include','findAll','rows','catch','show','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0xa9eac1,_0x39a4f7){var _0x282f35=function(_0x30dbd4){while(--_0x30dbd4){_0xa9eac1['push'](_0xa9eac1['shift']());}};_0x282f35(++_0x39a4f7);}(_0xeccc,0x90));var _0xcecc=function(_0x4fedd4,_0x1dbf05){_0x4fedd4=_0x4fedd4-0x0;var _0x5dce0d=_0xeccc[_0x4fedd4];return _0x5dce0d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcecc('0x0'));var jsonpatch=require(_0xcecc('0x1'));var rp=require(_0xcecc('0x2'));var moment=require(_0xcecc('0x3'));var BPromise=require(_0xcecc('0x4'));var Mustache=require(_0xcecc('0x5'));var util=require('util');var path=require(_0xcecc('0x6'));var sox=require(_0xcecc('0x7'));var csv=require(_0xcecc('0x8'));var ejs=require(_0xcecc('0x9'));var fs=require('fs');var fs_extra=require(_0xcecc('0xa'));var _=require('lodash');var squel=require(_0xcecc('0xb'));var crypto=require('crypto');var jsforce=require(_0xcecc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcecc('0x8'));var querystring=require(_0xcecc('0xd'));var Papa=require(_0xcecc('0xe'));var Redis=require(_0xcecc('0xf'));var authService=require(_0xcecc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcecc('0x11'));var hardwareService=require(_0xcecc('0x12'));var logger=require(_0xcecc('0x13'))(_0xcecc('0x14'));var utils=require(_0xcecc('0x15'));var config=require(_0xcecc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcecc('0x17'))['db'];function respondWithStatusCode(_0x5308ee,_0x35829c){_0x35829c=_0x35829c||0xcc;return function(_0x30d77e){if(_0x30d77e){return _0x5308ee[_0xcecc('0x18')](_0x35829c);}return _0x5308ee[_0xcecc('0x19')](_0x35829c)[_0xcecc('0x1a')]();};}function respondWithResult(_0x2dcfa5,_0x2b03f8){_0x2b03f8=_0x2b03f8||0xc8;return function(_0x3e4198){if(_0x3e4198){return _0x2dcfa5[_0xcecc('0x19')](_0x2b03f8)['json'](_0x3e4198);}};}function respondWithFilteredResult(_0x2f2130,_0x1f501e){return function(_0x3f5c5a){if(_0x3f5c5a){var _0x536d5c=typeof _0x1f501e[_0xcecc('0x1b')]==='undefined'&&typeof _0x1f501e[_0xcecc('0x1c')]===_0xcecc('0x1d');var _0x21003f=_0x3f5c5a[_0xcecc('0x1e')];var _0x30a991=_0x536d5c?0x0:_0x1f501e[_0xcecc('0x1b')];var _0x59e92b=_0x536d5c?_0x3f5c5a[_0xcecc('0x1e')]:_0x1f501e[_0xcecc('0x1b')]+_0x1f501e[_0xcecc('0x1c')];var _0x5cf21c;if(_0x59e92b>=_0x21003f){_0x59e92b=_0x21003f;_0x5cf21c=0xc8;}else{_0x5cf21c=0xce;}_0x2f2130[_0xcecc('0x19')](_0x5cf21c);return _0x2f2130['set'](_0xcecc('0x1f'),_0x30a991+'-'+_0x59e92b+'/'+_0x21003f)['json'](_0x3f5c5a);}return null;};}function patchUpdates(_0x169838){return function(_0x354814){try{jsonpatch[_0xcecc('0x20')](_0x354814,_0x169838,!![]);}catch(_0x4299d6){return BPromise['reject'](_0x4299d6);}return _0x354814[_0xcecc('0x21')]();};}function saveUpdates(_0x3375f2,_0x3c58ad){return function(_0x585ffa){if(_0x585ffa){return _0x585ffa[_0xcecc('0x22')](_0x3375f2)[_0xcecc('0x23')](function(_0x2ecfc5){return _0x2ecfc5;});}return null;};}function removeEntity(_0x156372,_0x452697){return function(_0x20e427){if(_0x20e427){return _0x20e427[_0xcecc('0x24')]()[_0xcecc('0x23')](function(){_0x156372[_0xcecc('0x19')](0xcc)[_0xcecc('0x1a')]();});}};}function handleEntityNotFound(_0x5a6090,_0x571708){return function(_0x277384){if(!_0x277384){_0x5a6090[_0xcecc('0x18')](0x194);}return _0x277384;};}function handleError(_0x5aeed3,_0x3a287b){_0x3a287b=_0x3a287b||0x1f4;return function(_0x53b7c4){logger[_0xcecc('0x25')](_0x53b7c4[_0xcecc('0x26')]);if(_0x53b7c4['name']){delete _0x53b7c4[_0xcecc('0x27')];}_0x5aeed3['status'](_0x3a287b)[_0xcecc('0x28')](_0x53b7c4);};}exports[_0xcecc('0x29')]=function(_0x74a24b,_0x22b324){var _0x18fac4={},_0x343a7d={},_0x46ef6c={'count':0x0,'rows':[]};var _0x417777=_[_0xcecc('0x2a')](db['OpenchannelApplication'][_0xcecc('0x2b')],function(_0x312fd7){return{'name':_0x312fd7[_0xcecc('0x2c')],'type':_0x312fd7[_0xcecc('0x2d')][_0xcecc('0x2e')]};});_0x343a7d[_0xcecc('0x2f')]=_[_0xcecc('0x2a')](_0x417777,_0xcecc('0x27'));_0x343a7d['query']=_[_0xcecc('0x30')](_0x74a24b['query']);_0x343a7d['filters']=_[_0xcecc('0x31')](_0x343a7d['model'],_0x343a7d[_0xcecc('0x32')]);_0x18fac4[_0xcecc('0x33')]=_['intersection'](_0x343a7d[_0xcecc('0x2f')],qs[_0xcecc('0x34')](_0x74a24b[_0xcecc('0x32')][_0xcecc('0x34')]));_0x18fac4[_0xcecc('0x33')]=_0x18fac4[_0xcecc('0x33')]['length']?_0x18fac4[_0xcecc('0x33')]:_0x343a7d['model'];if(!_0x74a24b[_0xcecc('0x32')][_0xcecc('0x35')](_0xcecc('0x36'))){_0x18fac4[_0xcecc('0x1c')]=qs[_0xcecc('0x1c')](_0x74a24b[_0xcecc('0x32')][_0xcecc('0x1c')]);_0x18fac4[_0xcecc('0x1b')]=qs[_0xcecc('0x1b')](_0x74a24b['query']['offset']);}_0x18fac4[_0xcecc('0x37')]=qs[_0xcecc('0x38')](_0x74a24b[_0xcecc('0x32')]['sort']);_0x18fac4['where']=qs['filters'](_[_0xcecc('0x39')](_0x74a24b[_0xcecc('0x32')],_0x343a7d[_0xcecc('0x3a')]),_0x417777);if(_0x74a24b[_0xcecc('0x32')]['filter']){_0x18fac4[_0xcecc('0x3b')]=_[_0xcecc('0x3c')](_0x18fac4[_0xcecc('0x3b')],{'$or':_['map'](_0x417777,function(_0x5228f9){if(_0x5228f9[_0xcecc('0x2d')]!==_0xcecc('0x3d')){var _0x228a8f={};_0x228a8f[_0x5228f9['name']]={'$like':'%'+_0x74a24b[_0xcecc('0x32')][_0xcecc('0x3e')]+'%'};return _0x228a8f;}})});}_0x18fac4=_[_0xcecc('0x3c')]({},_0x18fac4,_0x74a24b[_0xcecc('0x3f')]);var _0x14e814={'where':_0x18fac4['where']};return db[_0xcecc('0x40')]['count'](_0x14e814)[_0xcecc('0x23')](function(_0x36e5ad){_0x46ef6c[_0xcecc('0x1e')]=_0x36e5ad;if(_0x74a24b['query'][_0xcecc('0x41')]){_0x18fac4[_0xcecc('0x42')]=[{'all':!![]}];}return db[_0xcecc('0x40')][_0xcecc('0x43')](_0x18fac4);})[_0xcecc('0x23')](function(_0x9fd8bc){_0x46ef6c[_0xcecc('0x44')]=_0x9fd8bc;return _0x46ef6c;})[_0xcecc('0x23')](respondWithFilteredResult(_0x22b324,_0x18fac4))[_0xcecc('0x45')](handleError(_0x22b324,null));};exports[_0xcecc('0x46')]=function(_0x27f0c2,_0x5e823e){var _0x4c5556={'raw':!![],'where':{'id':_0x27f0c2['params']['id']}},_0x1e5b22={};_0x1e5b22[_0xcecc('0x2f')]=_['keys'](db[_0xcecc('0x40')][_0xcecc('0x2b')]);_0x1e5b22[_0xcecc('0x32')]=_[_0xcecc('0x30')](_0x27f0c2[_0xcecc('0x32')]);_0x1e5b22[_0xcecc('0x3a')]=_[_0xcecc('0x31')](_0x1e5b22[_0xcecc('0x2f')],_0x1e5b22[_0xcecc('0x32')]);_0x4c5556[_0xcecc('0x33')]=_[_0xcecc('0x31')](_0x1e5b22[_0xcecc('0x2f')],qs[_0xcecc('0x34')](_0x27f0c2[_0xcecc('0x32')][_0xcecc('0x34')]));_0x4c5556[_0xcecc('0x33')]=_0x4c5556[_0xcecc('0x33')]['length']?_0x4c5556['attributes']:_0x1e5b22[_0xcecc('0x2f')];if(_0x27f0c2[_0xcecc('0x32')][_0xcecc('0x41')]){_0x4c5556['include']=[{'all':!![]}];}_0x4c5556=_['merge']({},_0x4c5556,_0x27f0c2['options']);return db[_0xcecc('0x40')][_0xcecc('0x47')](_0x4c5556)[_0xcecc('0x23')](handleEntityNotFound(_0x5e823e,null))[_0xcecc('0x23')](respondWithResult(_0x5e823e,null))[_0xcecc('0x45')](handleError(_0x5e823e,null));};exports['create']=function(_0x1de544,_0x246cb9){return db['OpenchannelApplication'][_0xcecc('0x48')](_0x1de544['body'],{})[_0xcecc('0x23')](respondWithResult(_0x246cb9,0xc9))[_0xcecc('0x45')](handleError(_0x246cb9,null));};exports[_0xcecc('0x22')]=function(_0x4ec4ce,_0x528bd6){if(_0x4ec4ce['body']['id']){delete _0x4ec4ce[_0xcecc('0x49')]['id'];}return db[_0xcecc('0x40')][_0xcecc('0x47')]({'where':{'id':_0x4ec4ce['params']['id']}})[_0xcecc('0x23')](handleEntityNotFound(_0x528bd6,null))['then'](saveUpdates(_0x4ec4ce[_0xcecc('0x49')],null))[_0xcecc('0x23')](respondWithResult(_0x528bd6,null))[_0xcecc('0x45')](handleError(_0x528bd6,null));};exports[_0xcecc('0x24')]=function(_0x4a9da2,_0x4fcf4f){return db[_0xcecc('0x40')][_0xcecc('0x47')]({'where':{'id':_0x4a9da2[_0xcecc('0x4a')]['id']}})[_0xcecc('0x23')](handleEntityNotFound(_0x4fcf4f,null))[_0xcecc('0x23')](removeEntity(_0x4fcf4f,null))[_0xcecc('0x45')](handleError(_0x4fcf4f,null));}; \ No newline at end of file +var _0x261a=['body','update','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','then','error','stack','name','send','OpenchannelApplication','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','catch'];(function(_0x384055,_0x14ac05){var _0x10f5f0=function(_0x18c8fd){while(--_0x18c8fd){_0x384055['push'](_0x384055['shift']());}};_0x10f5f0(++_0x14ac05);}(_0x261a,0x170));var _0xa261=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x261a[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa261('0x0'));var zipdir=require(_0xa261('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa261('0x2'));var moment=require(_0xa261('0x3'));var BPromise=require(_0xa261('0x4'));var Mustache=require(_0xa261('0x5'));var util=require(_0xa261('0x6'));var path=require(_0xa261('0x7'));var sox=require(_0xa261('0x8'));var csv=require(_0xa261('0x9'));var ejs=require(_0xa261('0xa'));var fs=require('fs');var fs_extra=require(_0xa261('0xb'));var _=require(_0xa261('0xc'));var squel=require(_0xa261('0xd'));var crypto=require(_0xa261('0xe'));var jsforce=require(_0xa261('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa261('0x9'));var querystring=require(_0xa261('0x10'));var Papa=require(_0xa261('0x11'));var Redis=require(_0xa261('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa261('0x13'));var as=require(_0xa261('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa261('0x15'))(_0xa261('0x16'));var utils=require('../../config/utils');var config=require(_0xa261('0x17'));var licenseUtil=require(_0xa261('0x18'));var db=require(_0xa261('0x19'))['db'];function respondWithStatusCode(_0x460477,_0x354453){_0x354453=_0x354453||0xcc;return function(_0x2a9ef2){if(_0x2a9ef2){return _0x460477[_0xa261('0x1a')](_0x354453);}return _0x460477[_0xa261('0x1b')](_0x354453)[_0xa261('0x1c')]();};}function respondWithResult(_0x5aef09,_0x35dcf4){_0x35dcf4=_0x35dcf4||0xc8;return function(_0x5c8f61){if(_0x5c8f61){return _0x5aef09[_0xa261('0x1b')](_0x35dcf4)[_0xa261('0x1d')](_0x5c8f61);}};}function respondWithFilteredResult(_0x123fc1,_0x175693){return function(_0x3365b5){if(_0x3365b5){var _0x1ca78c=typeof _0x175693[_0xa261('0x1e')]==='undefined'&&typeof _0x175693[_0xa261('0x1f')]===_0xa261('0x20');var _0x265f95=_0x3365b5[_0xa261('0x21')];var _0x42b32a=_0x1ca78c?0x0:_0x175693['offset'];var _0x5dccca=_0x1ca78c?_0x3365b5[_0xa261('0x21')]:_0x175693[_0xa261('0x1e')]+_0x175693[_0xa261('0x1f')];var _0x339fe2;if(_0x5dccca>=_0x265f95){_0x5dccca=_0x265f95;_0x339fe2=0xc8;}else{_0x339fe2=0xce;}_0x123fc1[_0xa261('0x1b')](_0x339fe2);return _0x123fc1[_0xa261('0x22')](_0xa261('0x23'),_0x42b32a+'-'+_0x5dccca+'/'+_0x265f95)[_0xa261('0x1d')](_0x3365b5);}return null;};}function patchUpdates(_0x43ef5e){return function(_0x3fa0e6){try{jsonpatch['apply'](_0x3fa0e6,_0x43ef5e,!![]);}catch(_0x1d9846){return BPromise[_0xa261('0x24')](_0x1d9846);}return _0x3fa0e6[_0xa261('0x25')]();};}function saveUpdates(_0x8d5264,_0x2e26d9){return function(_0x58cdad){if(_0x58cdad){return _0x58cdad['update'](_0x8d5264)['then'](function(_0x5d8c07){return _0x5d8c07;});}return null;};}function removeEntity(_0x263139,_0x4e501e){return function(_0x4a1906){if(_0x4a1906){return _0x4a1906[_0xa261('0x26')]()[_0xa261('0x27')](function(){_0x263139[_0xa261('0x1b')](0xcc)[_0xa261('0x1c')]();});}};}function handleEntityNotFound(_0x37aa93,_0x46548d){return function(_0x441b15){if(!_0x441b15){_0x37aa93['sendStatus'](0x194);}return _0x441b15;};}function handleError(_0x5819c2,_0x29f364){_0x29f364=_0x29f364||0x1f4;return function(_0x1a8cb1){logger[_0xa261('0x28')](_0x1a8cb1[_0xa261('0x29')]);if(_0x1a8cb1['name']){delete _0x1a8cb1[_0xa261('0x2a')];}_0x5819c2[_0xa261('0x1b')](_0x29f364)[_0xa261('0x2b')](_0x1a8cb1);};}exports['index']=function(_0x11da29,_0x285b4e){var _0xbaa13b={},_0x453986={},_0x2b5b11={'count':0x0,'rows':[]};var _0x3fa23b=_['map'](db[_0xa261('0x2c')][_0xa261('0x2d')],function(_0x65d23b){return{'name':_0x65d23b[_0xa261('0x2e')],'type':_0x65d23b['type']['key']};});_0x453986[_0xa261('0x2f')]=_['map'](_0x3fa23b,'name');_0x453986['query']=_[_0xa261('0x30')](_0x11da29[_0xa261('0x31')]);_0x453986[_0xa261('0x32')]=_[_0xa261('0x33')](_0x453986['model'],_0x453986[_0xa261('0x31')]);_0xbaa13b[_0xa261('0x34')]=_[_0xa261('0x33')](_0x453986[_0xa261('0x2f')],qs[_0xa261('0x35')](_0x11da29[_0xa261('0x31')]['fields']));_0xbaa13b[_0xa261('0x34')]=_0xbaa13b[_0xa261('0x34')][_0xa261('0x36')]?_0xbaa13b[_0xa261('0x34')]:_0x453986[_0xa261('0x2f')];if(!_0x11da29[_0xa261('0x31')]['hasOwnProperty']('nolimit')){_0xbaa13b[_0xa261('0x1f')]=qs[_0xa261('0x1f')](_0x11da29[_0xa261('0x31')][_0xa261('0x1f')]);_0xbaa13b['offset']=qs[_0xa261('0x1e')](_0x11da29[_0xa261('0x31')][_0xa261('0x1e')]);}_0xbaa13b[_0xa261('0x37')]=qs[_0xa261('0x38')](_0x11da29[_0xa261('0x31')][_0xa261('0x38')]);_0xbaa13b[_0xa261('0x39')]=qs[_0xa261('0x32')](_[_0xa261('0x3a')](_0x11da29['query'],_0x453986[_0xa261('0x32')]),_0x3fa23b);if(_0x11da29['query'][_0xa261('0x3b')]){_0xbaa13b[_0xa261('0x39')]=_[_0xa261('0x3c')](_0xbaa13b['where'],{'$or':_['map'](_0x3fa23b,function(_0x4a3030){if(_0x4a3030['type']!==_0xa261('0x3d')){var _0x349319={};_0x349319[_0x4a3030[_0xa261('0x2a')]]={'$like':'%'+_0x11da29['query'][_0xa261('0x3b')]+'%'};return _0x349319;}})});}_0xbaa13b=_[_0xa261('0x3c')]({},_0xbaa13b,_0x11da29[_0xa261('0x3e')]);var _0x35979f={'where':_0xbaa13b[_0xa261('0x39')]};return db[_0xa261('0x2c')][_0xa261('0x21')](_0x35979f)[_0xa261('0x27')](function(_0xee09f9){_0x2b5b11['count']=_0xee09f9;if(_0x11da29[_0xa261('0x31')][_0xa261('0x3f')]){_0xbaa13b['include']=[{'all':!![]}];}return db[_0xa261('0x2c')][_0xa261('0x40')](_0xbaa13b);})[_0xa261('0x27')](function(_0x31b485){_0x2b5b11[_0xa261('0x41')]=_0x31b485;return _0x2b5b11;})[_0xa261('0x27')](respondWithFilteredResult(_0x285b4e,_0xbaa13b))['catch'](handleError(_0x285b4e,null));};exports[_0xa261('0x42')]=function(_0x516607,_0x18efef){var _0x365e2c={'raw':!![],'where':{'id':_0x516607[_0xa261('0x43')]['id']}},_0x4f98c3={};_0x4f98c3['model']=_[_0xa261('0x30')](db['OpenchannelApplication']['rawAttributes']);_0x4f98c3['query']=_[_0xa261('0x30')](_0x516607[_0xa261('0x31')]);_0x4f98c3[_0xa261('0x32')]=_[_0xa261('0x33')](_0x4f98c3[_0xa261('0x2f')],_0x4f98c3[_0xa261('0x31')]);_0x365e2c[_0xa261('0x34')]=_[_0xa261('0x33')](_0x4f98c3[_0xa261('0x2f')],qs['fields'](_0x516607[_0xa261('0x31')][_0xa261('0x35')]));_0x365e2c['attributes']=_0x365e2c['attributes'][_0xa261('0x36')]?_0x365e2c[_0xa261('0x34')]:_0x4f98c3[_0xa261('0x2f')];if(_0x516607[_0xa261('0x31')][_0xa261('0x3f')]){_0x365e2c[_0xa261('0x44')]=[{'all':!![]}];}_0x365e2c=_[_0xa261('0x3c')]({},_0x365e2c,_0x516607[_0xa261('0x3e')]);return db[_0xa261('0x2c')]['find'](_0x365e2c)['then'](handleEntityNotFound(_0x18efef,null))[_0xa261('0x27')](respondWithResult(_0x18efef,null))[_0xa261('0x45')](handleError(_0x18efef,null));};exports['create']=function(_0x24293d,_0x220bb6){return db[_0xa261('0x2c')]['create'](_0x24293d[_0xa261('0x46')],{})[_0xa261('0x27')](respondWithResult(_0x220bb6,0xc9))[_0xa261('0x45')](handleError(_0x220bb6,null));};exports[_0xa261('0x47')]=function(_0x4331d7,_0x2d1871){if(_0x4331d7[_0xa261('0x46')]['id']){delete _0x4331d7[_0xa261('0x46')]['id'];}return db[_0xa261('0x2c')][_0xa261('0x48')]({'where':{'id':_0x4331d7['params']['id']}})[_0xa261('0x27')](handleEntityNotFound(_0x2d1871,null))[_0xa261('0x27')](saveUpdates(_0x4331d7['body'],null))['then'](respondWithResult(_0x2d1871,null))['catch'](handleError(_0x2d1871,null));};exports[_0xa261('0x26')]=function(_0x42eb1d,_0x537009){return db[_0xa261('0x2c')][_0xa261('0x48')]({'where':{'id':_0x42eb1d['params']['id']}})[_0xa261('0x27')](handleEntityNotFound(_0x537009,null))['then'](removeEntity(_0x537009,null))[_0xa261('0x45')](handleError(_0x537009,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index fa6e669..65cac3c 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 _0x8739=['exports','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','./openchannelApplication.attributes'];(function(_0x25806f,_0x16dbdd){var _0x163f12=function(_0x3d1990){while(--_0x3d1990){_0x25806f['push'](_0x25806f['shift']());}};_0x163f12(++_0x16dbdd);}(_0x8739,0xe8));var _0x9873=function(_0xec8e4e,_0x54840c){_0xec8e4e=_0xec8e4e-0x0;var _0x4525fa=_0x8739[_0xec8e4e];return _0x4525fa;};'use strict';var _=require(_0x9873('0x0'));var util=require(_0x9873('0x1'));var logger=require('../../config/logger')(_0x9873('0x2'));var moment=require(_0x9873('0x3'));var BPromise=require(_0x9873('0x4'));var rp=require(_0x9873('0x5'));var fs=require('fs');var path=require(_0x9873('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9873('0x7'));module[_0x9873('0x8')]=function(_0x436e2c,_0x482868){return _0x436e2c['define'](_0x9873('0x9'),attributes,{'tableName':_0x9873('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9873('0xb')});}; \ No newline at end of file +var _0x2dd4=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x492fbd,_0x56f184){var _0x26c9e3=function(_0x252dd5){while(--_0x252dd5){_0x492fbd['push'](_0x492fbd['shift']());}};_0x26c9e3(++_0x56f184);}(_0x2dd4,0xa8));var _0x42dd=function(_0x384861,_0x276157){_0x384861=_0x384861-0x0;var _0x373374=_0x2dd4[_0x384861];return _0x373374;};'use strict';var _=require(_0x42dd('0x0'));var util=require(_0x42dd('0x1'));var logger=require(_0x42dd('0x2'))('api');var moment=require(_0x42dd('0x3'));var BPromise=require(_0x42dd('0x4'));var rp=require(_0x42dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42dd('0x6'));var config=require(_0x42dd('0x7'));var attributes=require(_0x42dd('0x8'));module[_0x42dd('0x9')]=function(_0x2e0188,_0x7120c4){return _0x2e0188['define'](_0x42dd('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x42dd('0xb'),'collate':_0x42dd('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 05689d3..fa28cf0 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 _0x4cae=['attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x4cae,0xa7));var _0xe4ca=function(_0x887f79,_0x1f4395){_0x887f79=_0x887f79-0x0;var _0x2ba5e8=_0x4cae[_0x887f79];return _0x2ba5e8;};'use strict';var _=require(_0xe4ca('0x0'));var util=require('util');var moment=require(_0xe4ca('0x1'));var BPromise=require(_0xe4ca('0x2'));var rs=require(_0xe4ca('0x3'));var fs=require('fs');var Redis=require(_0xe4ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4ca('0x5'));var logger=require(_0xe4ca('0x6'))(_0xe4ca('0x7'));var config=require(_0xe4ca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe4ca('0x9')][_0xe4ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xae7532,_0xbf6d8,_0x5aa00f){return new BPromise(function(_0x1e7466,_0xcfa025){return client[_0xe4ca('0xb')](_0xae7532,_0x5aa00f)[_0xe4ca('0xc')](function(_0x59cf7c){logger[_0xe4ca('0xd')](_0xe4ca('0xe'),_0xbf6d8,_0xe4ca('0xf'));logger[_0xe4ca('0x10')](_0xe4ca('0x11'),_0xbf6d8,'request\x20sent',JSON[_0xe4ca('0x12')](_0x59cf7c));if(_0x59cf7c[_0xe4ca('0x13')]){if(_0x59cf7c[_0xe4ca('0x13')][_0xe4ca('0x14')]===0x1f4){logger[_0xe4ca('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0xbf6d8,_0x59cf7c[_0xe4ca('0x13')][_0xe4ca('0x15')]);return _0xcfa025(_0x59cf7c[_0xe4ca('0x13')][_0xe4ca('0x15')]);}logger[_0xe4ca('0x13')](_0xe4ca('0xe'),_0xbf6d8,_0x59cf7c[_0xe4ca('0x13')]['message']);return _0x1e7466(_0x59cf7c[_0xe4ca('0x13')]['message']);}else{logger[_0xe4ca('0xd')](_0xe4ca('0xe'),_0xbf6d8,'request\x20sent');_0x1e7466(_0x59cf7c[_0xe4ca('0x16')][_0xe4ca('0x15')]);}})[_0xe4ca('0x17')](function(_0x218087){logger[_0xe4ca('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0xbf6d8,_0x218087);_0xcfa025(_0x218087);});});}exports[_0xe4ca('0x18')]=function(_0x1e2245){var _0x1753c4=this;return new Promise(function(_0x2a59a1,_0x4e3708){return db[_0xe4ca('0x19')][_0xe4ca('0x1a')](_0x1e2245[_0xe4ca('0x1b')],{'raw':_0x1e2245[_0xe4ca('0x1c')]?_0x1e2245[_0xe4ca('0x1c')][_0xe4ca('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e2245['options']?_0x1e2245[_0xe4ca('0x1c')][_0xe4ca('0x1e')]||null:null,'attributes':_0x1e2245[_0xe4ca('0x1c')]?_0x1e2245[_0xe4ca('0x1c')][_0xe4ca('0x1f')]||null:null,'limit':_0x1e2245[_0xe4ca('0x1c')]?_0x1e2245[_0xe4ca('0x1c')][_0xe4ca('0x20')]||null:null})[_0xe4ca('0xc')](function(_0x543111){logger[_0xe4ca('0xd')](_0xe4ca('0x18'),_0x1e2245);logger[_0xe4ca('0x10')](_0xe4ca('0x18'),_0x1e2245,JSON[_0xe4ca('0x12')](_0x543111));_0x2a59a1(_0x543111);})[_0xe4ca('0x17')](function(_0xeacc72){logger[_0xe4ca('0x13')](_0xe4ca('0x18'),_0xeacc72[_0xe4ca('0x15')],_0x1e2245);_0x4e3708(_0x1753c4[_0xe4ca('0x13')](0x1f4,_0xeacc72[_0xe4ca('0x15')]));});});}; \ No newline at end of file +var _0x991b=['jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','attributes','limit','debug','stringify','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x23e393,_0xb339cb){var _0x623dd2=function(_0x58a8a6){while(--_0x58a8a6){_0x23e393['push'](_0x23e393['shift']());}};_0x623dd2(++_0xb339cb);}(_0x991b,0x1c8));var _0xb991=function(_0x3120ee,_0x3d5335){_0x3120ee=_0x3120ee-0x0;var _0x572249=_0x991b[_0x3120ee];return _0x572249;};'use strict';var _=require(_0xb991('0x0'));var util=require('util');var moment=require(_0xb991('0x1'));var BPromise=require(_0xb991('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb991('0x3'));var db=require(_0xb991('0x4'))['db'];var utils=require(_0xb991('0x5'));var logger=require(_0xb991('0x6'))(_0xb991('0x7'));var config=require(_0xb991('0x8'));var jayson=require(_0xb991('0x9'));var client=jayson[_0xb991('0xa')][_0xb991('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412b38,_0x3d1e84,_0x41c6b){return new BPromise(function(_0x27dbc8,_0x18bcca){return client[_0xb991('0xc')](_0x412b38,_0x41c6b)[_0xb991('0xd')](function(_0x29cd3d){logger['info'](_0xb991('0xe'),_0x3d1e84,'request\x20sent');logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x3d1e84,_0xb991('0xf'),JSON['stringify'](_0x29cd3d));if(_0x29cd3d[_0xb991('0x10')]){if(_0x29cd3d[_0xb991('0x10')][_0xb991('0x11')]===0x1f4){logger['error'](_0xb991('0xe'),_0x3d1e84,_0x29cd3d[_0xb991('0x10')][_0xb991('0x12')]);return _0x18bcca(_0x29cd3d[_0xb991('0x10')]['message']);}logger[_0xb991('0x10')](_0xb991('0xe'),_0x3d1e84,_0x29cd3d[_0xb991('0x10')][_0xb991('0x12')]);return _0x27dbc8(_0x29cd3d[_0xb991('0x10')][_0xb991('0x12')]);}else{logger[_0xb991('0x13')](_0xb991('0xe'),_0x3d1e84,'request\x20sent');_0x27dbc8(_0x29cd3d[_0xb991('0x14')][_0xb991('0x12')]);}})['catch'](function(_0x54bb53){logger[_0xb991('0x10')](_0xb991('0xe'),_0x3d1e84,_0x54bb53);_0x18bcca(_0x54bb53);});});}exports[_0xb991('0x15')]=function(_0x248abc){var _0xc2f54=this;return new Promise(function(_0x513381,_0x3902d3){return db[_0xb991('0x16')]['update'](_0x248abc[_0xb991('0x17')],{'raw':_0x248abc[_0xb991('0x18')]?_0x248abc[_0xb991('0x18')][_0xb991('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x248abc['options']?_0x248abc[_0xb991('0x18')]['where']||null:null,'attributes':_0x248abc[_0xb991('0x18')]?_0x248abc['options'][_0xb991('0x1a')]||null:null,'limit':_0x248abc[_0xb991('0x18')]?_0x248abc[_0xb991('0x18')][_0xb991('0x1b')]||null:null})[_0xb991('0xd')](function(_0x579f13){logger[_0xb991('0x13')](_0xb991('0x15'),_0x248abc);logger[_0xb991('0x1c')](_0xb991('0x15'),_0x248abc,JSON[_0xb991('0x1d')](_0x579f13));_0x513381(_0x579f13);})[_0xb991('0x1e')](function(_0x4e7210){logger[_0xb991('0x10')](_0xb991('0x15'),_0x4e7210['message'],_0x248abc);_0x3902d3(_0xc2f54[_0xb991('0x10')](0x1f4,_0x4e7210[_0xb991('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 46b8aec..04f0f8d 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 _0x08b6=['/:id/tags','tracked','openchannel','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','show','/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','addMessage'];(function(_0x3e8082,_0x481707){var _0x58794=function(_0x25fb94){while(--_0x25fb94){_0x3e8082['push'](_0x3e8082['shift']());}};_0x58794(++_0x481707);}(_0x08b6,0x182));var _0x608b=function(_0x4cee20,_0x38ac24){_0x4cee20=_0x4cee20-0x0;var _0x9d9646=_0x08b6[_0x4cee20];return _0x9d9646;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x608b('0x0'));var timeout=require(_0x608b('0x1'));var express=require(_0x608b('0x2'));var router=express[_0x608b('0x3')]();var fs_extra=require(_0x608b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x608b('0x5'));var config=require(_0x608b('0x6'));var controller=require('./openchannelInteraction.controller');router[_0x608b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x608b('0x7')](_0x608b('0x8'),auth['isAuthenticated'](),controller[_0x608b('0x9')]);router['get'](_0x608b('0xa'),auth['isAuthenticated'](),controller[_0x608b('0xb')]);router[_0x608b('0x7')](_0x608b('0xc'),auth[_0x608b('0xd')](),controller[_0x608b('0xe')]);router[_0x608b('0x7')](_0x608b('0xf'),auth[_0x608b('0xd')](),controller[_0x608b('0x10')]);router[_0x608b('0x11')]('/',auth[_0x608b('0xd')](),controller[_0x608b('0x12')]);router['post'](_0x608b('0xc'),auth[_0x608b('0xd')](),controller[_0x608b('0x13')]);router[_0x608b('0x11')](_0x608b('0x14'),auth['isAuthenticated'](),interaction[_0x608b('0x15')](_0x608b('0x16'),'openchannelinteraction:addtags'),controller[_0x608b('0x17')]);router['put'](_0x608b('0xa'),auth['isAuthenticated'](),interaction[_0x608b('0x15')](_0x608b('0x16'),_0x608b('0x18')),controller[_0x608b('0x19')]);router[_0x608b('0x1a')](_0x608b('0xa'),auth[_0x608b('0xd')](),interaction[_0x608b('0x15')]('openchannel',_0x608b('0x1b')),controller['destroy']);router[_0x608b('0x1a')](_0x608b('0x14'),auth[_0x608b('0xd')](),controller[_0x608b('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xc559=['path','express','Router','fs-extra','../../components/auth/service','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post','/:id/messages','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','multer'];(function(_0x30f956,_0x4f7ea3){var _0x5b9027=function(_0xbe7708){while(--_0xbe7708){_0x30f956['push'](_0x30f956['shift']());}};_0x5b9027(++_0x4f7ea3);}(_0xc559,0x149));var _0x9c55=function(_0x340250,_0x4dd136){_0x340250=_0x340250-0x0;var _0x527217=_0xc559[_0x340250];return _0x527217;};'use strict';var multer=require(_0x9c55('0x0'));var util=require('util');var path=require(_0x9c55('0x1'));var timeout=require('connect-timeout');var express=require(_0x9c55('0x2'));var router=express[_0x9c55('0x3')]();var fs_extra=require(_0x9c55('0x4'));var auth=require(_0x9c55('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9c55('0x6'));router[_0x9c55('0x7')]('/',auth[_0x9c55('0x8')](),controller['index']);router[_0x9c55('0x7')](_0x9c55('0x9'),auth[_0x9c55('0x8')](),controller[_0x9c55('0xa')]);router[_0x9c55('0x7')](_0x9c55('0xb'),auth['isAuthenticated'](),controller[_0x9c55('0xc')]);router[_0x9c55('0x7')]('/:id/messages',auth[_0x9c55('0x8')](),controller[_0x9c55('0xd')]);router[_0x9c55('0x7')](_0x9c55('0xe'),auth[_0x9c55('0x8')](),controller[_0x9c55('0xf')]);router[_0x9c55('0x10')]('/',auth[_0x9c55('0x8')](),controller['create']);router['post'](_0x9c55('0x11'),auth[_0x9c55('0x8')](),controller['addMessage']);router[_0x9c55('0x10')](_0x9c55('0x12'),auth[_0x9c55('0x8')](),interaction[_0x9c55('0x13')](_0x9c55('0x14'),_0x9c55('0x15')),controller[_0x9c55('0x16')]);router[_0x9c55('0x17')](_0x9c55('0xb'),auth[_0x9c55('0x8')](),interaction[_0x9c55('0x13')](_0x9c55('0x14'),_0x9c55('0x18')),controller[_0x9c55('0x19')]);router[_0x9c55('0x1a')](_0x9c55('0xb'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0x9c55('0x1b')),controller['destroy']);router[_0x9c55('0x1a')]('/:id/tags',auth[_0x9c55('0x8')](),controller[_0x9c55('0x1c')]);module[_0x9c55('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 59a72f4..d145b8e 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 _0x6ea9=['DATE','STRING','ENUM','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0x6ea9,0x89));var _0x96ea=function(_0x50556a,_0x2f7043){_0x50556a=_0x50556a-0x0;var _0x5a0c2d=_0x6ea9[_0x50556a];return _0x5a0c2d;};'use strict';var Sequelize=require(_0x96ea('0x0'));module[_0x96ea('0x1')]={'closed':{'type':Sequelize[_0x96ea('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x96ea('0x3')]},'disposition':{'type':Sequelize[_0x96ea('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x96ea('0x4')]},'note':{'type':Sequelize[_0x96ea('0x4')]},'read1stAt':{'type':Sequelize[_0x96ea('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x96ea('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x96ea('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x96ea('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x96ea('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x96ea('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x96ea('0x6')]}}; \ No newline at end of file +var _0x9354=['exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x5409ff,_0x5d8294){var _0x31ee88=function(_0x191b91){while(--_0x191b91){_0x5409ff['push'](_0x5409ff['shift']());}};_0x31ee88(++_0x5d8294);}(_0x9354,0x96));var _0x4935=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x9354[_0x55abd9];return _0x3e5669;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'closed':{'type':Sequelize[_0x4935('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4935('0x2')]},'secondDisposition':{'type':Sequelize[_0x4935('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4935('0x2')]},'note':{'type':Sequelize[_0x4935('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x4935('0x2')]},'externalUrl':{'type':Sequelize[_0x4935('0x2')]},'lastMsgAt':{'type':Sequelize[_0x4935('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4935('0x4')]('in',_0x4935('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x4935('0x4')]('in',_0x4935('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x4935('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x4935('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 20f2a0a..4395d70 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 _0x4c7f=['then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','intersection','attributes','fields','include','merge','options','find','create','body','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','filters','hasOwnProperty','nolimit','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','omit','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','format','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','Public','basename','createReadStream','createWriteStream','out','System','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update'];(function(_0x23f6fb,_0x123c9f){var _0x18b3ba=function(_0x36b934){while(--_0x36b934){_0x23f6fb['push'](_0x23f6fb['shift']());}};_0x18b3ba(++_0x123c9f);}(_0x4c7f,0x1e5));var _0xf4c7=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x4c7f[_0x2283dc];return _0x16db90;};'use strict';var rimraf=require(_0xf4c7('0x0'));var zipdir=require(_0xf4c7('0x1'));var moment=require(_0xf4c7('0x2'));var util=require(_0xf4c7('0x3'));var path=require(_0xf4c7('0x4'));var ejs=require(_0xf4c7('0x5'));var fs=require('fs');var _=require(_0xf4c7('0x6'));var Redis=require(_0xf4c7('0x7'));var interaction=require(_0xf4c7('0x8'));var qs=require(_0xf4c7('0x9'));var pdf=require(_0xf4c7('0xa'));var logger=require('../../config/logger')(_0xf4c7('0xb'));var config=require(_0xf4c7('0xc'));var db=require('../../mysqldb')['db'];config[_0xf4c7('0xd')]=_[_0xf4c7('0xe')](config[_0xf4c7('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf4c7('0xf'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xf4c7('0x10')](socket);function respondWithStatusCode(_0x5c394e,_0x4bfc72){_0x4bfc72=_0x4bfc72||0xcc;return function(_0x5b13d6){if(_0x5b13d6){return _0x5c394e[_0xf4c7('0x11')](_0x4bfc72);}return _0x5c394e[_0xf4c7('0x12')](_0x4bfc72)['end']();};}function respondWithResult(_0x50f460,_0x54c97f){_0x54c97f=_0x54c97f||0xc8;return function(_0x12298d){if(_0x12298d){return _0x50f460[_0xf4c7('0x12')](_0x54c97f)[_0xf4c7('0x13')](_0x12298d);}};}function respondWithFilteredResult(_0x3e8b96,_0x37daad){return function(_0x163c59){if(_0x163c59){var _0x2399f5=typeof _0x37daad[_0xf4c7('0x14')]===_0xf4c7('0x15')&&typeof _0x37daad[_0xf4c7('0x16')]==='undefined';var _0x316fc5=_0x163c59['count'];var _0x1003cf=_0x2399f5?0x0:_0x37daad[_0xf4c7('0x14')];var _0xcf5c11=_0x2399f5?_0x163c59[_0xf4c7('0x17')]:_0x37daad[_0xf4c7('0x14')]+_0x37daad[_0xf4c7('0x16')];var _0x122e34;if(_0xcf5c11>=_0x316fc5){_0xcf5c11=_0x316fc5;_0x122e34=0xc8;}else{_0x122e34=0xce;}_0x3e8b96['status'](_0x122e34);return _0x3e8b96[_0xf4c7('0x18')](_0xf4c7('0x19'),_0x1003cf+'-'+_0xcf5c11+'/'+_0x316fc5)[_0xf4c7('0x13')](_0x163c59);}return null;};}function saveUpdates(_0x5d6aa6){return function(_0x562c24){if(_0x562c24){return _0x562c24[_0xf4c7('0x1a')](_0x5d6aa6)[_0xf4c7('0x1b')](function(_0x3cb5a4){return _0x3cb5a4;});}return null;};}function removeEntity(_0x9d23f2){return function(_0x22277e){if(_0x22277e){return _0x22277e[_0xf4c7('0x1c')]()[_0xf4c7('0x1b')](function(){_0x9d23f2[_0xf4c7('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x557964){return function(_0x1c28f3){if(!_0x1c28f3){_0x557964[_0xf4c7('0x11')](0x194);}return _0x1c28f3;};}function handleError(_0x1266e5,_0x154782){_0x154782=_0x154782||0x1f4;return function(_0x3aad68){logger[_0xf4c7('0x1d')](_0x3aad68[_0xf4c7('0x1e')]);if(_0x3aad68[_0xf4c7('0x1f')]){delete _0x3aad68[_0xf4c7('0x1f')];}_0x1266e5[_0xf4c7('0x12')](_0x154782)[_0xf4c7('0x20')](_0x3aad68);};}exports[_0xf4c7('0x21')]=function(_0x39ea25,_0x577bd4){var _0x10a8e3={};var _0x44ff1f=_[_0xf4c7('0x22')](db[_0xf4c7('0x23')][_0xf4c7('0x24')],function(_0x267e64){return{'name':_0x267e64[_0xf4c7('0x25')],'type':_0x267e64[_0xf4c7('0x26')][_0xf4c7('0x27')]};});_0x10a8e3=qs[_0xf4c7('0x28')](_0x44ff1f,_0x39ea25);return interaction[_0xf4c7('0x29')](_0xf4c7('0x2a'),_0x39ea25[_0xf4c7('0x2b')],_0x39ea25[_0xf4c7('0x2c')],_0x10a8e3,_0x44ff1f)[_0xf4c7('0x1b')](respondWithFilteredResult(_0x577bd4,_0x10a8e3))[_0xf4c7('0x2d')](handleError(_0x577bd4,null));};exports[_0xf4c7('0x2e')]=function(_0xf2f2a4,_0x5ad1be){var _0x15fe8e={};if(_0xf2f2a4[_0xf4c7('0x2b')][_0xf4c7('0x26')]&&_0xf2f2a4[_0xf4c7('0x2b')][_0xf4c7('0x26')]==='from'){_0x15fe8e[_0xf4c7('0x2f')]=_0xf2f2a4[_0xf4c7('0x30')]['id'];}else{_0x15fe8e['id']=_0xf2f2a4[_0xf4c7('0x30')]['id'];}var _0x4a11db={'raw':![],'where':_0x15fe8e},_0x29b70b={};_0x29b70b[_0xf4c7('0x31')]=_['keys'](db[_0xf4c7('0x23')][_0xf4c7('0x24')]);_0x29b70b[_0xf4c7('0x2b')]=_[_0xf4c7('0x32')](_0xf2f2a4[_0xf4c7('0x2b')]);_0x29b70b['filters']=_[_0xf4c7('0x33')](_0x29b70b[_0xf4c7('0x31')],_0x29b70b[_0xf4c7('0x2b')]);_0x4a11db[_0xf4c7('0x34')]=_['intersection'](_0x29b70b['model'],qs[_0xf4c7('0x35')](_0xf2f2a4[_0xf4c7('0x2b')][_0xf4c7('0x35')]));_0x4a11db['attributes']=_0x4a11db[_0xf4c7('0x34')]['length']?_0x4a11db['attributes']:_0x29b70b[_0xf4c7('0x31')];if(_0xf2f2a4[_0xf4c7('0x2b')]['includeAll']){_0x4a11db[_0xf4c7('0x36')]=[{'all':!![]}];}_0x4a11db=_[_0xf4c7('0x37')]({},_0x4a11db,_0xf2f2a4[_0xf4c7('0x38')]);return db[_0xf4c7('0x23')][_0xf4c7('0x39')](_0x4a11db)[_0xf4c7('0x1b')](handleEntityNotFound(_0x5ad1be,null))[_0xf4c7('0x1b')](respondWithResult(_0x5ad1be,null))['catch'](handleError(_0x5ad1be,null));};exports[_0xf4c7('0x3a')]=function(_0x1cf324,_0x616160){return db[_0xf4c7('0x23')]['create'](_0x1cf324[_0xf4c7('0x3b')],{})['then'](respondWithResult(_0x616160,0xc9))['catch'](handleError(_0x616160,null));};exports[_0xf4c7('0x1a')]=function(_0x316d63,_0x1dda42){if(_0x316d63['body']['id']){delete _0x316d63[_0xf4c7('0x3b')]['id'];}return db[_0xf4c7('0x23')][_0xf4c7('0x39')]({'where':{'id':_0x316d63['params']['id']}})[_0xf4c7('0x1b')](handleEntityNotFound(_0x1dda42,null))[_0xf4c7('0x1b')](saveUpdates(_0x316d63[_0xf4c7('0x3b')],null))[_0xf4c7('0x1b')](respondWithResult(_0x1dda42,null))[_0xf4c7('0x2d')](handleError(_0x1dda42,null));};exports[_0xf4c7('0x1c')]=function(_0x663167,_0x3a922b){return db['OpenchannelInteraction']['find']({'where':{'id':_0x663167[_0xf4c7('0x30')]['id']}})[_0xf4c7('0x1b')](handleEntityNotFound(_0x3a922b,null))[_0xf4c7('0x1b')](removeEntity(_0x3a922b,null))[_0xf4c7('0x2d')](handleError(_0x3a922b,null));};exports['describe']=function(_0x4b292e,_0x3f7abf){return db[_0xf4c7('0x23')][_0xf4c7('0x3c')]()[_0xf4c7('0x1b')](respondWithResult(_0x3f7abf,null))['catch'](handleError(_0x3f7abf,null));};exports[_0xf4c7('0x3d')]=function(_0x118296,_0x5eeab2){return db['OpenchannelMessage'][_0xf4c7('0x39')]({'where':{'id':_0x118296['params']['id']}})[_0xf4c7('0x1b')](handleEntityNotFound(_0x5eeab2,null))[_0xf4c7('0x1b')](function(_0x5a8dfa){if(_0x5a8dfa){return _0x5a8dfa[_0xf4c7('0x3d')](_0x118296[_0xf4c7('0x3b')][_0xf4c7('0x3e')],_['omit'](_0x118296['body'],[_0xf4c7('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x5eeab2,null))[_0xf4c7('0x2d')](handleError(_0x5eeab2,null));};exports[_0xf4c7('0x3f')]=function(_0x42e555,_0x54d43c){var _0xafc75b={'raw':![],'where':{}};var _0x1c3fd2={};var _0x35a785={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xf4c7('0x40')]({'where':{'id':_0x42e555['params']['id']}})[_0xf4c7('0x1b')](handleEntityNotFound(_0x54d43c,null))[_0xf4c7('0x1b')](function(_0x6603bc){if(_0x6603bc){_0x1c3fd2[_0xf4c7('0x31')]=_[_0xf4c7('0x32')](db[_0xf4c7('0x41')]['rawAttributes']);_0x1c3fd2['query']=_[_0xf4c7('0x32')](_0x42e555[_0xf4c7('0x2b')]);_0x1c3fd2[_0xf4c7('0x42')]=_[_0xf4c7('0x33')](_0x1c3fd2[_0xf4c7('0x31')],_0x1c3fd2[_0xf4c7('0x2b')]);_0xafc75b[_0xf4c7('0x34')]=_[_0xf4c7('0x33')](_0x1c3fd2['model'],qs[_0xf4c7('0x35')](_0x42e555[_0xf4c7('0x2b')][_0xf4c7('0x35')]));_0xafc75b[_0xf4c7('0x34')]=_0xafc75b['attributes']['length']?_0xafc75b[_0xf4c7('0x34')]:_0x1c3fd2[_0xf4c7('0x31')];if(!_0x42e555[_0xf4c7('0x2b')][_0xf4c7('0x43')](_0xf4c7('0x44'))){_0xafc75b['limit']=qs[_0xf4c7('0x16')](_0x42e555[_0xf4c7('0x2b')]['limit']);_0xafc75b['offset']=qs[_0xf4c7('0x14')](_0x42e555[_0xf4c7('0x2b')]['offset']);}_0xafc75b['order']=qs[_0xf4c7('0x45')](_0x42e555['query'][_0xf4c7('0x45')]);_0xafc75b[_0xf4c7('0x46')]=qs['filters'](_[_0xf4c7('0x47')](_0x42e555[_0xf4c7('0x2b')],_0x1c3fd2[_0xf4c7('0x42')]));_0xafc75b[_0xf4c7('0x46')][_0xf4c7('0x48')]=_0x6603bc['id'];if(_0x42e555[_0xf4c7('0x2b')]['filter']){_0xafc75b[_0xf4c7('0x46')]=_[_0xf4c7('0x37')](_0xafc75b['where'],{'$or':_['map'](_0xafc75b[_0xf4c7('0x34')],function(_0x3b6c19){var _0x27da02={};_0x27da02[_0x3b6c19]={'$like':'%'+_0x42e555[_0xf4c7('0x2b')][_0xf4c7('0x49')]+'%'};return _0x27da02;})});}if(_0x42e555[_0xf4c7('0x2b')][_0xf4c7('0x4a')]){var _0x5616c2=_0x42e555[_0xf4c7('0x2b')][_0xf4c7('0x4a')][_0xf4c7('0x4b')](',');var _0x3fdd45={};_0x3fdd45[_0x5616c2[0x0]]={'$gte':moment(_0x5616c2[0x1])['format'](_0xf4c7('0x4c'))};_0xafc75b[_0xf4c7('0x46')]=_[_0xf4c7('0x37')](_0xafc75b[_0xf4c7('0x46')],_0x3fdd45);}_0xafc75b=_[_0xf4c7('0x37')]({},_0xafc75b,_0x42e555[_0xf4c7('0x38')]);return db['OpenchannelMessage'][_0xf4c7('0x17')]({'where':_0xafc75b[_0xf4c7('0x46')]})[_0xf4c7('0x1b')](function(_0x576222){_0x35a785[_0xf4c7('0x17')]=_0x576222;if(_0x42e555[_0xf4c7('0x2b')][_0xf4c7('0x4d')]){_0xafc75b['include']=[{'all':!![]}];}return db[_0xf4c7('0x41')][_0xf4c7('0x29')](_0xafc75b);})[_0xf4c7('0x1b')](function(_0x5434e3){_0x35a785['rows']=_0x5434e3;return _0x35a785;});}})[_0xf4c7('0x1b')](respondWithFilteredResult(_0x54d43c,_0xafc75b))[_0xf4c7('0x2d')](handleError(_0x54d43c,null));};exports[_0xf4c7('0x4e')]=function(_0x5308f5,_0x301d64){return db[_0xf4c7('0x23')][_0xf4c7('0x39')]({'where':{'id':_0x5308f5[_0xf4c7('0x30')]['id']}})[_0xf4c7('0x1b')](handleEntityNotFound(_0x301d64,null))[_0xf4c7('0x1b')](function(_0x463a16){if(_0x463a16){return _0x463a16[_0xf4c7('0x4f')](_0x5308f5['body'][_0xf4c7('0x3e')],_[_0xf4c7('0x50')](_0x5308f5['body'],[_0xf4c7('0x3e'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0xf4c7('0x1f'),_0xf4c7('0x51')],'where':{'id':_0x5308f5[_0xf4c7('0x3b')][_0xf4c7('0x3e')]}});})[_0xf4c7('0x1b')](function(_0x40a06a){socket[_0xf4c7('0x52')](_0xf4c7('0x53'),{'id':Number(_0x5308f5['params']['id']),'tags':_0x40a06a||[]});return{'id':Number(_0x5308f5[_0xf4c7('0x30')]['id']),'tags':_0x40a06a||[]};});}})[_0xf4c7('0x1b')](respondWithResult(_0x301d64,null))['catch'](handleError(_0x301d64,null));};exports['removeTags']=function(_0x2ad558,_0x502e40){return db['OpenchannelInteraction'][_0xf4c7('0x39')]({'where':{'id':_0x2ad558[_0xf4c7('0x30')]['id']}})['then'](handleEntityNotFound(_0x502e40,null))[_0xf4c7('0x1b')](function(_0x131fd8){if(_0x131fd8){return _0x131fd8[_0xf4c7('0x54')](_0x2ad558[_0xf4c7('0x2b')][_0xf4c7('0x3e')]);}})[_0xf4c7('0x1b')](respondWithStatusCode(_0x502e40,null))[_0xf4c7('0x2d')](handleError(_0x502e40,null));};exports[_0xf4c7('0x55')]=function(_0x322bbd,_0x4c6e35){var _0x3418c6=moment()[_0xf4c7('0x56')]()[_0xf4c7('0x57')]();var _0x44f6d8=path[_0xf4c7('0x58')](config[_0xf4c7('0x59')],_0xf4c7('0x5a'),_0xf4c7('0x5b'),'tmp');var _0x50bf8d=path[_0xf4c7('0x58')](config[_0xf4c7('0x59')],_0xf4c7('0x5a'),_0xf4c7('0x5b'),_0xf4c7('0x5c'));var _0x2eba3b=path[_0xf4c7('0x58')](_0x44f6d8,_0x3418c6);var _0x53cc21=util[_0xf4c7('0x5d')]('transcript-%d-%s.zip',_0x322bbd[_0xf4c7('0x30')]['id'],_0x3418c6);var _0x2ddaca=path[_0xf4c7('0x58')](_0x44f6d8,_0x53cc21);var _0x2991ba=[];_0x2991ba[_0xf4c7('0x5e')]({'model':db[_0xf4c7('0x5f')],'as':'User','attributes':['id',_0xf4c7('0x60')],'raw':!![]});_0x2991ba[_0xf4c7('0x5e')]({'model':db[_0xf4c7('0x61')],'as':_0xf4c7('0x62'),'attributes':['id',_0xf4c7('0x63'),_0xf4c7('0x64')],'raw':!![]});if(_0x322bbd[_0xf4c7('0x2b')][_0xf4c7('0x5c')]){_0x2991ba[_0xf4c7('0x5e')]({'model':db[_0xf4c7('0x65')],'as':'Attachment','raw':!![]});}var _0x473c25=[{'model':db['OpenchannelMessage'],'as':_0xf4c7('0x66'),'attributes':['id','body',_0xf4c7('0x67'),_0xf4c7('0x68'),_0xf4c7('0x69'),_0xf4c7('0x6a')],'include':_0x2991ba}];_0x473c25[_0xf4c7('0x5e')]({'model':db[_0xf4c7('0x6b')],'as':_0xf4c7('0x6c'),'attributes':['id','name']});_0x473c25[_0xf4c7('0x5e')]({'model':db[_0xf4c7('0x5f')],'as':_0xf4c7('0x6d'),'attributes':['id',_0xf4c7('0x60')]});return db[_0xf4c7('0x23')][_0xf4c7('0x39')]({'where':{'id':_0x322bbd[_0xf4c7('0x30')]['id']},'include':_0x473c25})[_0xf4c7('0x1b')](handleEntityNotFound(_0x4c6e35,null))[_0xf4c7('0x1b')](function(_0x1093aa){if(_0x1093aa){var _0xf8baad=_0x1093aa[_0xf4c7('0x6e')]({'plain':!![]});fs[_0xf4c7('0x6f')](_0x2eba3b);var _0x36e700={'channel':_0xf4c7('0x70'),'account':_0xf8baad[_0xf4c7('0x6c')][_0xf4c7('0x1f')],'agent':_0xf8baad['Owner']?_0xf8baad['Owner']['fullname']:_0xf4c7('0x71'),'createdAt':moment(_0xf8baad['createdAt'])[_0xf4c7('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf4c7('0x57')](),'closedAt':_0xf8baad[_0xf4c7('0x72')]?moment(_0xf8baad[_0xf4c7('0x73')])[_0xf4c7('0x5d')](_0xf4c7('0x4c'))[_0xf4c7('0x57')]():'','disposition':_0xf8baad['disposition'],'visibility':_0xf8baad['threadId']?_0xf4c7('0x74'):'Private','messages':_(_0xf8baad[_0xf4c7('0x66')])[_0xf4c7('0x49')]({'secret':![]})[_0xf4c7('0x22')](function(_0xe561f1){if(_0xe561f1[_0xf4c7('0x65')]){var _0xeb30eb=path[_0xf4c7('0x58')](_0x50bf8d,_0xe561f1[_0xf4c7('0x65')][_0xf4c7('0x75')]);if(fs['existsSync'](_0xeb30eb)){fs[_0xf4c7('0x76')](_0xeb30eb)['pipe'](fs[_0xf4c7('0x77')](path[_0xf4c7('0x58')](_0x2eba3b,_0xe561f1['Attachment'][_0xf4c7('0x75')])));}}return{'date':moment(_0xe561f1[_0xf4c7('0x67')])[_0xf4c7('0x5d')](_0xf4c7('0x4c'))['toString'](),'sender':_0xe561f1[_0xf4c7('0x68')]===_0xf4c7('0x78')?_0xe561f1[_0xf4c7('0x5f')]?_0xe561f1[_0xf4c7('0x5f')][_0xf4c7('0x60')]:_0xf4c7('0x79'):_0xe561f1['Contact'][_0xf4c7('0x63')]+(_0xe561f1[_0xf4c7('0x62')][_0xf4c7('0x64')]?'\x20'+_0xe561f1[_0xf4c7('0x62')][_0xf4c7('0x64')]:''),'body':_0xe561f1[_0xf4c7('0x65')]?_0xe561f1[_0xf4c7('0x65')][_0xf4c7('0x75')]:_0xe561f1[_0xf4c7('0x3b')],'direction':_0xe561f1[_0xf4c7('0x68')]===_0xf4c7('0x78')?'A':'C','secret':_0xe561f1['secret'],'read':_0xe561f1[_0xf4c7('0x6a')],'attachment':_0xe561f1['Attachment']};})[_0xf4c7('0x7a')]()};return ejs[_0xf4c7('0x7b')](path[_0xf4c7('0x58')](config[_0xf4c7('0x59')],_0xf4c7('0x5a'),'views',_0xf4c7('0x7c')),{'interaction':_0x36e700})['then'](function(_0x19d86f){var _0x26d01b=path['join'](_0x2eba3b,_0xf4c7('0x7d')+_0xf8baad['id']+'-'+_0x3418c6+_0xf4c7('0x7e'));var _0x548491={'path':_0x26d01b,'channel':'Openchannel','interactionId':_0xf8baad['id']};return pdf[_0xf4c7('0x7f')](_0x19d86f,_0x548491);})['then'](function(){return new Promise(function(_0x539386,_0x4c9480){zipdir(_0x2eba3b,{'saveTo':_0x2ddaca},function(_0x522772,_0x54b3f8){if(_0x522772)return _0x4c9480(_0x522772);return _0x539386(_0x54b3f8);});})[_0xf4c7('0x1b')](function(){return new Promise(function(_0x1cf2ae,_0x440fd3){rimraf(_0x2eba3b,function(_0x561057){if(_0x561057)_0x440fd3(_0x561057);return _0x1cf2ae();});});})['then'](function(){return _0x4c6e35[_0xf4c7('0x55')](_0x2ddaca,_0x53cc21,function(_0x57399a){if(_0x57399a){logger[_0xf4c7('0x1d')]('Unable\x20to\x20delete\x20zip\x20file',_0x57399a);}else{fs['unlinkSync'](_0x2ddaca);}});});});}else{return _0x4c6e35[_0xf4c7('0x11')](0xc8);}})[_0xf4c7('0x2d')](handleError(_0x4c6e35,null));}; \ No newline at end of file +var _0x6e51=['format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','User','Owner','Openchannel','N.A.','createdAt','closed','closedAt','disposition','threadId','Private','basename','existsSync','createReadStream','createWriteStream','System','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','util','lodash','ioredis','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','fieldName','type','key','findAll','query','user','catch','show','from','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','sort','pick','OpenchannelInteractionId','filter','where','$gte'];(function(_0x51eb3b,_0x2800a5){var _0x534da7=function(_0x1c20f5){while(--_0x1c20f5){_0x51eb3b['push'](_0x51eb3b['shift']());}};_0x534da7(++_0x2800a5);}(_0x6e51,0x1b6));var _0x16e5=function(_0x554d5f,_0x84f97c){_0x554d5f=_0x554d5f-0x0;var _0x9437ef=_0x6e51[_0x554d5f];return _0x9437ef;};'use strict';var rimraf=require(_0x16e5('0x0'));var zipdir=require(_0x16e5('0x1'));var moment=require(_0x16e5('0x2'));var util=require(_0x16e5('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x16e5('0x4'));var Redis=require(_0x16e5('0x5'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x16e5('0x6'));var logger=require(_0x16e5('0x7'))(_0x16e5('0x8'));var config=require(_0x16e5('0x9'));var db=require('../../mysqldb')['db'];config[_0x16e5('0xa')]=_[_0x16e5('0xb')](config[_0x16e5('0xa')],{'host':_0x16e5('0xc'),'port':0x18eb});var socket=require(_0x16e5('0xd'))(new Redis(config[_0x16e5('0xa')]));require(_0x16e5('0xe'))[_0x16e5('0xf')](socket);function respondWithStatusCode(_0x2bc2b2,_0x2492cf){_0x2492cf=_0x2492cf||0xcc;return function(_0x34e88a){if(_0x34e88a){return _0x2bc2b2[_0x16e5('0x10')](_0x2492cf);}return _0x2bc2b2[_0x16e5('0x11')](_0x2492cf)[_0x16e5('0x12')]();};}function respondWithResult(_0xf9def6,_0x4652ab){_0x4652ab=_0x4652ab||0xc8;return function(_0x59b446){if(_0x59b446){return _0xf9def6[_0x16e5('0x11')](_0x4652ab)[_0x16e5('0x13')](_0x59b446);}};}function respondWithFilteredResult(_0x523dcb,_0x4413fd){return function(_0x38a313){if(_0x38a313){var _0x2526a2=typeof _0x4413fd['offset']===_0x16e5('0x14')&&typeof _0x4413fd[_0x16e5('0x15')]==='undefined';var _0x5f4d7a=_0x38a313[_0x16e5('0x16')];var _0x5ed4c7=_0x2526a2?0x0:_0x4413fd[_0x16e5('0x17')];var _0x3902e7=_0x2526a2?_0x38a313[_0x16e5('0x16')]:_0x4413fd[_0x16e5('0x17')]+_0x4413fd[_0x16e5('0x15')];var _0x884d73;if(_0x3902e7>=_0x5f4d7a){_0x3902e7=_0x5f4d7a;_0x884d73=0xc8;}else{_0x884d73=0xce;}_0x523dcb[_0x16e5('0x11')](_0x884d73);return _0x523dcb[_0x16e5('0x18')](_0x16e5('0x19'),_0x5ed4c7+'-'+_0x3902e7+'/'+_0x5f4d7a)[_0x16e5('0x13')](_0x38a313);}return null;};}function saveUpdates(_0x56df9b){return function(_0x2ed08a){if(_0x2ed08a){return _0x2ed08a[_0x16e5('0x1a')](_0x56df9b)[_0x16e5('0x1b')](function(_0x304bf8){return _0x304bf8;});}return null;};}function removeEntity(_0x3b408d){return function(_0x4a2fea){if(_0x4a2fea){return _0x4a2fea[_0x16e5('0x1c')]()[_0x16e5('0x1b')](function(){_0x3b408d[_0x16e5('0x11')](0xcc)[_0x16e5('0x12')]();});}};}function handleEntityNotFound(_0x51ff03){return function(_0x4886ff){if(!_0x4886ff){_0x51ff03['sendStatus'](0x194);}return _0x4886ff;};}function handleError(_0x42376b,_0x36cb96){_0x36cb96=_0x36cb96||0x1f4;return function(_0xa7fbec){logger[_0x16e5('0x1d')](_0xa7fbec[_0x16e5('0x1e')]);if(_0xa7fbec['name']){delete _0xa7fbec[_0x16e5('0x1f')];}_0x42376b[_0x16e5('0x11')](_0x36cb96)[_0x16e5('0x20')](_0xa7fbec);};}exports[_0x16e5('0x21')]=function(_0x19e576,_0x2276ba){var _0x3f2722={};var _0x4e6096=_[_0x16e5('0x22')](db[_0x16e5('0x23')]['rawAttributes'],function(_0x205bea){return{'name':_0x205bea[_0x16e5('0x24')],'type':_0x205bea[_0x16e5('0x25')][_0x16e5('0x26')]};});_0x3f2722=qs['getOptions'](_0x4e6096,_0x19e576);return interaction[_0x16e5('0x27')]('openchannel',_0x19e576[_0x16e5('0x28')],_0x19e576[_0x16e5('0x29')],_0x3f2722,_0x4e6096)[_0x16e5('0x1b')](respondWithFilteredResult(_0x2276ba,_0x3f2722))[_0x16e5('0x2a')](handleError(_0x2276ba,null));};exports[_0x16e5('0x2b')]=function(_0x44981e,_0x643ee4){var _0x599b9b={};if(_0x44981e[_0x16e5('0x28')]['type']&&_0x44981e[_0x16e5('0x28')]['type']===_0x16e5('0x2c')){_0x599b9b['from']=_0x44981e[_0x16e5('0x2d')]['id'];}else{_0x599b9b['id']=_0x44981e['params']['id'];}var _0x18c445={'raw':![],'where':_0x599b9b},_0x1df7d1={};_0x1df7d1[_0x16e5('0x2e')]=_[_0x16e5('0x2f')](db[_0x16e5('0x23')][_0x16e5('0x30')]);_0x1df7d1[_0x16e5('0x28')]=_[_0x16e5('0x2f')](_0x44981e[_0x16e5('0x28')]);_0x1df7d1[_0x16e5('0x31')]=_[_0x16e5('0x32')](_0x1df7d1[_0x16e5('0x2e')],_0x1df7d1[_0x16e5('0x28')]);_0x18c445[_0x16e5('0x33')]=_['intersection'](_0x1df7d1[_0x16e5('0x2e')],qs[_0x16e5('0x34')](_0x44981e[_0x16e5('0x28')][_0x16e5('0x34')]));_0x18c445[_0x16e5('0x33')]=_0x18c445[_0x16e5('0x33')][_0x16e5('0x35')]?_0x18c445[_0x16e5('0x33')]:_0x1df7d1[_0x16e5('0x2e')];if(_0x44981e[_0x16e5('0x28')][_0x16e5('0x36')]){_0x18c445[_0x16e5('0x37')]=[{'all':!![]}];}_0x18c445=_[_0x16e5('0x38')]({},_0x18c445,_0x44981e['options']);return db[_0x16e5('0x23')][_0x16e5('0x39')](_0x18c445)[_0x16e5('0x1b')](handleEntityNotFound(_0x643ee4,null))[_0x16e5('0x1b')](respondWithResult(_0x643ee4,null))[_0x16e5('0x2a')](handleError(_0x643ee4,null));};exports[_0x16e5('0x3a')]=function(_0x48cd05,_0x22cd4d){return db[_0x16e5('0x23')]['create'](_0x48cd05[_0x16e5('0x3b')],{})[_0x16e5('0x1b')](respondWithResult(_0x22cd4d,0xc9))[_0x16e5('0x2a')](handleError(_0x22cd4d,null));};exports[_0x16e5('0x1a')]=function(_0x280a4e,_0x338ca3){if(_0x280a4e['body']['id']){delete _0x280a4e[_0x16e5('0x3b')]['id'];}return db['OpenchannelInteraction'][_0x16e5('0x39')]({'where':{'id':_0x280a4e[_0x16e5('0x2d')]['id']}})['then'](handleEntityNotFound(_0x338ca3,null))[_0x16e5('0x1b')](saveUpdates(_0x280a4e['body'],null))[_0x16e5('0x1b')](respondWithResult(_0x338ca3,null))[_0x16e5('0x2a')](handleError(_0x338ca3,null));};exports[_0x16e5('0x1c')]=function(_0x94b522,_0x38ae20){return db[_0x16e5('0x23')][_0x16e5('0x39')]({'where':{'id':_0x94b522[_0x16e5('0x2d')]['id']}})[_0x16e5('0x1b')](handleEntityNotFound(_0x38ae20,null))['then'](removeEntity(_0x38ae20,null))[_0x16e5('0x2a')](handleError(_0x38ae20,null));};exports[_0x16e5('0x3c')]=function(_0x405583,_0x2e034e){return db[_0x16e5('0x23')][_0x16e5('0x3c')]()[_0x16e5('0x1b')](respondWithResult(_0x2e034e,null))[_0x16e5('0x2a')](handleError(_0x2e034e,null));};exports[_0x16e5('0x3d')]=function(_0x50d055,_0x1ff783){return db[_0x16e5('0x3e')][_0x16e5('0x39')]({'where':{'id':_0x50d055[_0x16e5('0x2d')]['id']}})[_0x16e5('0x1b')](handleEntityNotFound(_0x1ff783,null))[_0x16e5('0x1b')](function(_0x407072){if(_0x407072){return _0x407072[_0x16e5('0x3d')](_0x50d055[_0x16e5('0x3b')][_0x16e5('0x3f')],_[_0x16e5('0x40')](_0x50d055[_0x16e5('0x3b')],[_0x16e5('0x3f'),'id'])||{});}})[_0x16e5('0x1b')](respondWithResult(_0x1ff783,null))[_0x16e5('0x2a')](handleError(_0x1ff783,null));};exports[_0x16e5('0x41')]=function(_0x560cfe,_0x3ef966){var _0xb987b0={'raw':![],'where':{}};var _0x2f7bf0={};var _0x43078f={'count':0x0,'rows':[]};return db[_0x16e5('0x23')][_0x16e5('0x42')]({'where':{'id':_0x560cfe['params']['id']}})['then'](handleEntityNotFound(_0x3ef966,null))[_0x16e5('0x1b')](function(_0x4dc4e7){if(_0x4dc4e7){_0x2f7bf0['model']=_['keys'](db[_0x16e5('0x3e')][_0x16e5('0x30')]);_0x2f7bf0['query']=_[_0x16e5('0x2f')](_0x560cfe[_0x16e5('0x28')]);_0x2f7bf0['filters']=_[_0x16e5('0x32')](_0x2f7bf0[_0x16e5('0x2e')],_0x2f7bf0[_0x16e5('0x28')]);_0xb987b0['attributes']=_[_0x16e5('0x32')](_0x2f7bf0[_0x16e5('0x2e')],qs['fields'](_0x560cfe[_0x16e5('0x28')]['fields']));_0xb987b0[_0x16e5('0x33')]=_0xb987b0[_0x16e5('0x33')]['length']?_0xb987b0[_0x16e5('0x33')]:_0x2f7bf0[_0x16e5('0x2e')];if(!_0x560cfe[_0x16e5('0x28')]['hasOwnProperty'](_0x16e5('0x43'))){_0xb987b0[_0x16e5('0x15')]=qs['limit'](_0x560cfe[_0x16e5('0x28')][_0x16e5('0x15')]);_0xb987b0['offset']=qs[_0x16e5('0x17')](_0x560cfe[_0x16e5('0x28')][_0x16e5('0x17')]);}_0xb987b0['order']=qs[_0x16e5('0x44')](_0x560cfe['query']['sort']);_0xb987b0['where']=qs[_0x16e5('0x31')](_[_0x16e5('0x45')](_0x560cfe[_0x16e5('0x28')],_0x2f7bf0['filters']));_0xb987b0['where'][_0x16e5('0x46')]=_0x4dc4e7['id'];if(_0x560cfe[_0x16e5('0x28')][_0x16e5('0x47')]){_0xb987b0['where']=_[_0x16e5('0x38')](_0xb987b0[_0x16e5('0x48')],{'$or':_[_0x16e5('0x22')](_0xb987b0[_0x16e5('0x33')],function(_0x538411){var _0x507fad={};_0x507fad[_0x538411]={'$like':'%'+_0x560cfe[_0x16e5('0x28')][_0x16e5('0x47')]+'%'};return _0x507fad;})});}if(_0x560cfe['query'][_0x16e5('0x49')]){var _0x576820=_0x560cfe[_0x16e5('0x28')]['$gte']['split'](',');var _0x200076={};_0x200076[_0x576820[0x0]]={'$gte':moment(_0x576820[0x1])[_0x16e5('0x4a')](_0x16e5('0x4b'))};_0xb987b0[_0x16e5('0x48')]=_[_0x16e5('0x38')](_0xb987b0[_0x16e5('0x48')],_0x200076);}_0xb987b0=_['merge']({},_0xb987b0,_0x560cfe[_0x16e5('0x4c')]);return db[_0x16e5('0x3e')]['count']({'where':_0xb987b0[_0x16e5('0x48')]})['then'](function(_0x519145){_0x43078f['count']=_0x519145;if(_0x560cfe[_0x16e5('0x28')][_0x16e5('0x36')]){_0xb987b0['include']=[{'all':!![]}];}return db[_0x16e5('0x3e')][_0x16e5('0x27')](_0xb987b0);})[_0x16e5('0x1b')](function(_0x4d37c8){_0x43078f['rows']=_0x4d37c8;return _0x43078f;});}})[_0x16e5('0x1b')](respondWithFilteredResult(_0x3ef966,_0xb987b0))[_0x16e5('0x2a')](handleError(_0x3ef966,null));};exports[_0x16e5('0x4d')]=function(_0x6146c,_0x56acd4){return db['OpenchannelInteraction'][_0x16e5('0x39')]({'where':{'id':_0x6146c[_0x16e5('0x2d')]['id']}})[_0x16e5('0x1b')](handleEntityNotFound(_0x56acd4,null))[_0x16e5('0x1b')](function(_0x45ba52){if(_0x45ba52){return _0x45ba52[_0x16e5('0x4e')](_0x6146c[_0x16e5('0x3b')]['ids'],_[_0x16e5('0x40')](_0x6146c[_0x16e5('0x3b')],[_0x16e5('0x3f'),'id'])||{})[_0x16e5('0x4f')](function(){return db['Tag'][_0x16e5('0x27')]({'attributes':['id',_0x16e5('0x1f'),'color'],'where':{'id':_0x6146c[_0x16e5('0x3b')][_0x16e5('0x3f')]}});})[_0x16e5('0x1b')](function(_0x305d8f){socket['emit'](_0x16e5('0x50'),{'id':Number(_0x6146c[_0x16e5('0x2d')]['id']),'tags':_0x305d8f||[]});return{'id':Number(_0x6146c[_0x16e5('0x2d')]['id']),'tags':_0x305d8f||[]};});}})[_0x16e5('0x1b')](respondWithResult(_0x56acd4,null))[_0x16e5('0x2a')](handleError(_0x56acd4,null));};exports['removeTags']=function(_0x2df484,_0x2dd78d){return db[_0x16e5('0x23')]['find']({'where':{'id':_0x2df484[_0x16e5('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2dd78d,null))[_0x16e5('0x1b')](function(_0x161c12){if(_0x161c12){return _0x161c12[_0x16e5('0x51')](_0x2df484['query']['ids']);}})[_0x16e5('0x1b')](respondWithStatusCode(_0x2dd78d,null))[_0x16e5('0x2a')](handleError(_0x2dd78d,null));};exports[_0x16e5('0x52')]=function(_0x1205fd,_0x75ab46){var _0x2bd3b9=moment()[_0x16e5('0x53')]()[_0x16e5('0x54')]();var _0x5e233c=path[_0x16e5('0x55')](config[_0x16e5('0x56')],_0x16e5('0x57'),_0x16e5('0x58'),_0x16e5('0x59'));var _0x5bf650=path[_0x16e5('0x55')](config['root'],_0x16e5('0x57'),_0x16e5('0x58'),_0x16e5('0x5a'));var _0x160212=path['join'](_0x5e233c,_0x2bd3b9);var _0x41ce9f=util[_0x16e5('0x4a')]('transcript-%d-%s.zip',_0x1205fd[_0x16e5('0x2d')]['id'],_0x2bd3b9);var _0x5ca71e=path[_0x16e5('0x55')](_0x5e233c,_0x41ce9f);var _0x507980=[];_0x507980[_0x16e5('0x5b')]({'model':db['User'],'as':'User','attributes':['id',_0x16e5('0x5c')],'raw':!![]});_0x507980[_0x16e5('0x5b')]({'model':db[_0x16e5('0x5d')],'as':_0x16e5('0x5e'),'attributes':['id',_0x16e5('0x5f'),_0x16e5('0x60')],'raw':!![]});if(_0x1205fd[_0x16e5('0x28')][_0x16e5('0x5a')]){_0x507980[_0x16e5('0x5b')]({'model':db[_0x16e5('0x61')],'as':_0x16e5('0x61'),'raw':!![]});}var _0x46a467=[{'model':db[_0x16e5('0x3e')],'as':_0x16e5('0x62'),'attributes':['id',_0x16e5('0x3b'),'createdAt',_0x16e5('0x63'),_0x16e5('0x64'),_0x16e5('0x65')],'include':_0x507980}];_0x46a467[_0x16e5('0x5b')]({'model':db[_0x16e5('0x66')],'as':_0x16e5('0x67'),'attributes':['id',_0x16e5('0x1f')]});_0x46a467[_0x16e5('0x5b')]({'model':db[_0x16e5('0x68')],'as':_0x16e5('0x69'),'attributes':['id','fullname']});return db[_0x16e5('0x23')][_0x16e5('0x39')]({'where':{'id':_0x1205fd[_0x16e5('0x2d')]['id']},'include':_0x46a467})[_0x16e5('0x1b')](handleEntityNotFound(_0x75ab46,null))[_0x16e5('0x1b')](function(_0x4802dd){if(_0x4802dd){var _0x4de44b=_0x4802dd['get']({'plain':!![]});fs['mkdirSync'](_0x160212);var _0x1d989c={'channel':_0x16e5('0x6a'),'account':_0x4de44b[_0x16e5('0x67')][_0x16e5('0x1f')],'agent':_0x4de44b[_0x16e5('0x69')]?_0x4de44b[_0x16e5('0x69')]['fullname']:_0x16e5('0x6b'),'createdAt':moment(_0x4de44b[_0x16e5('0x6c')])[_0x16e5('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x16e5('0x54')](),'closedAt':_0x4de44b[_0x16e5('0x6d')]?moment(_0x4de44b[_0x16e5('0x6e')])[_0x16e5('0x4a')](_0x16e5('0x4b'))[_0x16e5('0x54')]():'','disposition':_0x4de44b[_0x16e5('0x6f')],'visibility':_0x4de44b[_0x16e5('0x70')]?'Public':_0x16e5('0x71'),'messages':_(_0x4de44b[_0x16e5('0x62')])[_0x16e5('0x47')]({'secret':![]})[_0x16e5('0x22')](function(_0x287d2e){if(_0x287d2e['Attachment']){var _0x4364b0=path[_0x16e5('0x55')](_0x5bf650,_0x287d2e[_0x16e5('0x61')][_0x16e5('0x72')]);if(fs[_0x16e5('0x73')](_0x4364b0)){fs[_0x16e5('0x74')](_0x4364b0)['pipe'](fs[_0x16e5('0x75')](path[_0x16e5('0x55')](_0x160212,_0x287d2e[_0x16e5('0x61')][_0x16e5('0x72')])));}}return{'date':moment(_0x287d2e[_0x16e5('0x6c')])['format'](_0x16e5('0x4b'))[_0x16e5('0x54')](),'sender':_0x287d2e[_0x16e5('0x63')]==='out'?_0x287d2e[_0x16e5('0x68')]?_0x287d2e[_0x16e5('0x68')][_0x16e5('0x5c')]:_0x16e5('0x76'):_0x287d2e[_0x16e5('0x5e')][_0x16e5('0x5f')]+(_0x287d2e[_0x16e5('0x5e')]['lastName']?'\x20'+_0x287d2e['Contact'][_0x16e5('0x60')]:''),'body':_0x287d2e[_0x16e5('0x61')]?_0x287d2e[_0x16e5('0x61')][_0x16e5('0x72')]:_0x287d2e[_0x16e5('0x3b')],'direction':_0x287d2e[_0x16e5('0x63')]===_0x16e5('0x77')?'A':'C','secret':_0x287d2e[_0x16e5('0x64')],'read':_0x287d2e[_0x16e5('0x65')],'attachment':_0x287d2e['Attachment']};})[_0x16e5('0x78')]()};return ejs[_0x16e5('0x79')](path[_0x16e5('0x55')](config[_0x16e5('0x56')],'server',_0x16e5('0x7a'),_0x16e5('0x7b')),{'interaction':_0x1d989c})[_0x16e5('0x1b')](function(_0x3ad956){var _0x3ea429=path['join'](_0x160212,_0x16e5('0x7c')+_0x4de44b['id']+'-'+_0x2bd3b9+_0x16e5('0x7d'));var _0x364eb1={'path':_0x3ea429,'channel':_0x16e5('0x6a'),'interactionId':_0x4de44b['id']};return pdf[_0x16e5('0x7e')](_0x3ad956,_0x364eb1);})[_0x16e5('0x1b')](function(){return new Promise(function(_0x1e2eee,_0x3da398){zipdir(_0x160212,{'saveTo':_0x5ca71e},function(_0x239ada,_0x5f3bf6){if(_0x239ada)return _0x3da398(_0x239ada);return _0x1e2eee(_0x5f3bf6);});})[_0x16e5('0x1b')](function(){return new Promise(function(_0x255cf7,_0x266434){rimraf(_0x160212,function(_0x5abdec){if(_0x5abdec)_0x266434(_0x5abdec);return _0x255cf7();});});})[_0x16e5('0x1b')](function(){return _0x75ab46[_0x16e5('0x52')](_0x5ca71e,_0x41ce9f,function(_0x1e68a3){if(_0x1e68a3){logger[_0x16e5('0x1d')]('Unable\x20to\x20delete\x20zip\x20file',_0x1e68a3);}else{fs[_0x16e5('0x7f')](_0x5ca71e);}});});});}else{return _0x75ab46[_0x16e5('0x10')](0xc8);}})['catch'](handleError(_0x75ab46,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f52bbeb..2cc6409 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 _0x4d79=['unreadMessages','length','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','Users','map','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d79,0x16a));var _0x94d7=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0x4d79[_0x360739];return _0x3e23a1;};'use strict';var EventEmitter=require(_0x94d7('0x0'));var OpenchannelInteraction=require(_0x94d7('0x1'))['db'][_0x94d7('0x2')];var OpenchannelMessage=require(_0x94d7('0x1'))['db'][_0x94d7('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x94d7('0x4')](0x0);var events={'afterCreate':_0x94d7('0x5'),'afterUpdate':_0x94d7('0x6'),'afterDestroy':_0x94d7('0x7')};function emitEvent(_0x190f9a){return function(_0x53c9a0,_0x361310,_0x26da2d){_0x53c9a0[_0x94d7('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3d0afa){_0x53c9a0['setDataValue'](_0x94d7('0x9'),_0x3d0afa[_0x94d7('0xa')](function(_0x1d90f1){return{'id':_0x1d90f1['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x53c9a0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x94d7('0xb')](function(_0x39c685){_0x53c9a0['setDataValue'](_0x94d7('0xc'),_0x39c685[_0x94d7('0xd')]);OpenchannelInteractionEvents['emit'](_0x190f9a+':'+_0x53c9a0['id'],_0x53c9a0);OpenchannelInteractionEvents['emit'](_0x190f9a,_0x53c9a0);_0x26da2d(null);})['catch'](_0x26da2d(null));};}for(var e in events){if(events[_0x94d7('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x94d7('0xf')](e,emitEvent(event));}}module[_0x94d7('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x343e=['unreadMessages','length','emit','hasOwnProperty','hook','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x3251b9,_0x5c2c23){var _0x490cda=function(_0x4751b7){while(--_0x4751b7){_0x3251b9['push'](_0x3251b9['shift']());}};_0x490cda(++_0x5c2c23);}(_0x343e,0xe9));var _0xe343=function(_0x13bec2,_0x33b1a9){_0x13bec2=_0x13bec2-0x0;var _0x4e9dea=_0x343e[_0x13bec2];return _0x4e9dea;};'use strict';var EventEmitter=require(_0xe343('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xe343('0x1')];var OpenchannelMessage=require(_0xe343('0x2'))['db'][_0xe343('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe343('0x4')](0x0);var events={'afterCreate':_0xe343('0x5'),'afterUpdate':_0xe343('0x6'),'afterDestroy':_0xe343('0x7')};function emitEvent(_0x18470c){return function(_0xbceb97,_0x37cdb8,_0x1e2105){_0xbceb97[_0xe343('0x8')]({'attributes':['id'],'raw':!![]})[_0xe343('0x9')](function(_0x57d824){_0xbceb97[_0xe343('0xa')](_0xe343('0xb'),_0x57d824[_0xe343('0xc')](function(_0x571402){return{'id':_0x571402['id']};}));return OpenchannelMessage[_0xe343('0xd')]({'where':{'OpenchannelInteractionId':_0xbceb97['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2b6e88){_0xbceb97[_0xe343('0xa')](_0xe343('0xe'),_0x2b6e88[_0xe343('0xf')]);OpenchannelInteractionEvents[_0xe343('0x10')](_0x18470c+':'+_0xbceb97['id'],_0xbceb97);OpenchannelInteractionEvents[_0xe343('0x10')](_0x18470c,_0xbceb97);_0x1e2105(null);})['catch'](_0x1e2105(null));};}for(var e in events){if(events[_0xe343('0x11')](e)){var event=events[e];OpenchannelInteraction[_0xe343('0x12')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index aee2e02..fa052da 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 _0x072c=['openchannel_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path','rimraf','exports','define','OpenchannelInteraction'];(function(_0x387af5,_0x51f550){var _0x339b6e=function(_0x126909){while(--_0x126909){_0x387af5['push'](_0x387af5['shift']());}};_0x339b6e(++_0x51f550);}(_0x072c,0x18b));var _0xc072=function(_0x159da9,_0x2fbb02){_0x159da9=_0x159da9-0x0;var _0x2204ca=_0x072c[_0x159da9];return _0x2204ca;};'use strict';var _=require(_0xc072('0x0'));var util=require(_0xc072('0x1'));var logger=require(_0xc072('0x2'))(_0xc072('0x3'));var moment=require(_0xc072('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc072('0x5'));var rimraf=require(_0xc072('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xc072('0x7')]=function(_0xe0fe1d,_0x1d385e){return _0xe0fe1d[_0xc072('0x8')](_0xc072('0x9'),attributes,{'tableName':_0xc072('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x997d8e,_0x526eeb,_0x1b1855){if(_0x997d8e[_0xc072('0xb')](_0xc072('0xc'))){_0x997d8e['closedAt']=moment()[_0xc072('0xd')](_0xc072('0xe'));}_0x1b1855(null,_0x997d8e);}}});}; \ No newline at end of file +var _0x37de=['util','../../config/logger','moment','bluebird','path','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x37de,0x10f));var _0xe37d=function(_0x6c9ac2,_0x35886a){_0x6c9ac2=_0x6c9ac2-0x0;var _0x4d9f44=_0x37de[_0x6c9ac2];return _0x4d9f44;};'use strict';var _=require(_0xe37d('0x0'));var util=require(_0xe37d('0x1'));var logger=require(_0xe37d('0x2'))('api');var moment=require(_0xe37d('0x3'));var BPromise=require(_0xe37d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe37d('0x5'));var rimraf=require('rimraf');var config=require(_0xe37d('0x6'));var attributes=require(_0xe37d('0x7'));module[_0xe37d('0x8')]=function(_0x1f7f32,_0x5ddaa0){return _0x1f7f32['define'](_0xe37d('0x9'),attributes,{'tableName':_0xe37d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe37d('0xb'),'hooks':{'beforeUpdate':function(_0x317f8e,_0x1fd0ef,_0x5f98b1){if(_0x317f8e[_0xe37d('0xc')](_0xe37d('0xd'))){_0x317f8e[_0xe37d('0xe')]=moment()[_0xe37d('0xf')](_0xe37d('0x10'));}_0x5f98b1(null,_0x317f8e);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 6bc621f..3c3d260 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 _0x28df=['attributes','AddTagsToOpenchannelInteraction','OpenchannelInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./openchannelInteraction.socket','request','then','info','request\x20sent','debug','stringify','code','error','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','body','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28df,0x170));var _0xf28d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x28df[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf28d('0x0'));var util=require(_0xf28d('0x1'));var moment=require(_0xf28d('0x2'));var BPromise=require(_0xf28d('0x3'));var rs=require(_0xf28d('0x4'));var fs=require('fs');var Redis=require(_0xf28d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf28d('0x6'));var logger=require(_0xf28d('0x7'))(_0xf28d('0x8'));var config=require(_0xf28d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf28d('0xa')][_0xf28d('0xb')]({'port':0x232a});config[_0xf28d('0xc')]=_['defaults'](config[_0xf28d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf28d('0xd'))(new Redis(config[_0xf28d('0xc')]));require(_0xf28d('0xe'))['register'](socket);function respondWithRpcPromise(_0x34e616,_0x2de8ff,_0x313fe1){return new BPromise(function(_0x1aaf0b,_0x38100f){return client[_0xf28d('0xf')](_0x34e616,_0x313fe1)[_0xf28d('0x10')](function(_0x1d353a){logger[_0xf28d('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2de8ff,_0xf28d('0x12'));logger[_0xf28d('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x2de8ff,_0xf28d('0x12'),JSON[_0xf28d('0x14')](_0x1d353a));if(_0x1d353a['error']){if(_0x1d353a['error'][_0xf28d('0x15')]===0x1f4){logger[_0xf28d('0x16')](_0xf28d('0x17'),_0x2de8ff,_0x1d353a[_0xf28d('0x16')]['message']);return _0x38100f(_0x1d353a[_0xf28d('0x16')][_0xf28d('0x18')]);}logger[_0xf28d('0x16')](_0xf28d('0x17'),_0x2de8ff,_0x1d353a[_0xf28d('0x16')]['message']);return _0x1aaf0b(_0x1d353a[_0xf28d('0x16')][_0xf28d('0x18')]);}else{logger[_0xf28d('0x11')](_0xf28d('0x17'),_0x2de8ff,_0xf28d('0x12'));_0x1aaf0b(_0x1d353a[_0xf28d('0x19')][_0xf28d('0x18')]);}})[_0xf28d('0x1a')](function(_0x360cf3){logger[_0xf28d('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2de8ff,_0x360cf3);_0x38100f(_0x360cf3);});});}exports[_0xf28d('0x1b')]=function(_0x51adfe){var _0x4e5611=this;return new Promise(function(_0x565154,_0x4ed3de){return db['OpenchannelInteraction']['update'](_0x51adfe[_0xf28d('0x1c')],{'raw':_0x51adfe[_0xf28d('0x1d')]?_0x51adfe[_0xf28d('0x1d')][_0xf28d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51adfe[_0xf28d('0x1d')]?_0x51adfe[_0xf28d('0x1d')][_0xf28d('0x1f')]||null:null,'attributes':_0x51adfe['options']?_0x51adfe['options'][_0xf28d('0x20')]||null:null,'limit':_0x51adfe[_0xf28d('0x1d')]?_0x51adfe[_0xf28d('0x1d')]['limit']||null:null})[_0xf28d('0x10')](function(_0x1442ac){logger[_0xf28d('0x11')](_0xf28d('0x1b'),_0x51adfe);logger[_0xf28d('0x13')]('UpdateOpenchannelInteraction',_0x51adfe,JSON[_0xf28d('0x14')](_0x1442ac));_0x565154(_0x1442ac);})[_0xf28d('0x1a')](function(_0x2bf303){logger[_0xf28d('0x16')](_0xf28d('0x1b'),_0x2bf303[_0xf28d('0x18')],_0x51adfe);_0x4ed3de(_0x4e5611[_0xf28d('0x16')](0x1f4,_0x2bf303[_0xf28d('0x18')]));});});};exports[_0xf28d('0x21')]=function(_0x43c2d0){return new Promise(function(_0x5381c5,_0x1ad598){return db[_0xf28d('0x22')]['find']({'where':_0x43c2d0[_0xf28d('0x1d')]?_0x43c2d0['options'][_0xf28d('0x1f')]||null:null})[_0xf28d('0x10')](function(_0x4132d8){if(_0x4132d8){return _0x4132d8[_0xf28d('0x23')](_0x43c2d0[_0xf28d('0x1c')][_0xf28d('0x24')],_[_0xf28d('0x25')](_0x43c2d0[_0xf28d('0x1c')],[_0xf28d('0x24'),'id'])||{});}})[_0xf28d('0x26')](function(_0x54c8d0){logger['info'](_0xf28d('0x27'),_0x43c2d0);logger['debug'](_0xf28d('0x27'),_0x43c2d0,JSON[_0xf28d('0x14')](_0x54c8d0));_0x5381c5(_0x54c8d0);})[_0xf28d('0x1a')](function(_0x38ac13){logger[_0xf28d('0x16')]('AddTags',_0x38ac13['message'],_0x43c2d0);_0x1ad598(_this[_0xf28d('0x16')](0x1f4,_0x38ac13[_0xf28d('0x18')]));});});}; \ No newline at end of file +var _0x1840=['localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','redis','defaults'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x1840,0x99));var _0x0184=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x1840[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x0184('0x0'));var util=require(_0x0184('0x1'));var moment=require(_0x0184('0x2'));var BPromise=require('bluebird');var rs=require(_0x0184('0x3'));var fs=require('fs');var Redis=require(_0x0184('0x4'));var db=require(_0x0184('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0184('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0184('0x7')][_0x0184('0x8')]({'port':0x232a});config[_0x0184('0x9')]=_[_0x0184('0xa')](config[_0x0184('0x9')],{'host':_0x0184('0xb'),'port':0x18eb});var socket=require(_0x0184('0xc'))(new Redis(config[_0x0184('0x9')]));require(_0x0184('0xd'))['register'](socket);function respondWithRpcPromise(_0x1bb8cf,_0xefa595,_0x165452){return new BPromise(function(_0x534cca,_0x38ae9f){return client[_0x0184('0xe')](_0x1bb8cf,_0x165452)[_0x0184('0xf')](function(_0x50ceed){logger[_0x0184('0x10')](_0x0184('0x11'),_0xefa595,_0x0184('0x12'));logger[_0x0184('0x13')](_0x0184('0x14'),_0xefa595,_0x0184('0x12'),JSON[_0x0184('0x15')](_0x50ceed));if(_0x50ceed['error']){if(_0x50ceed[_0x0184('0x16')][_0x0184('0x17')]===0x1f4){logger[_0x0184('0x16')](_0x0184('0x11'),_0xefa595,_0x50ceed[_0x0184('0x16')][_0x0184('0x18')]);return _0x38ae9f(_0x50ceed['error'][_0x0184('0x18')]);}logger[_0x0184('0x16')](_0x0184('0x11'),_0xefa595,_0x50ceed[_0x0184('0x16')][_0x0184('0x18')]);return _0x534cca(_0x50ceed[_0x0184('0x16')][_0x0184('0x18')]);}else{logger['info'](_0x0184('0x11'),_0xefa595,_0x0184('0x12'));_0x534cca(_0x50ceed[_0x0184('0x19')][_0x0184('0x18')]);}})[_0x0184('0x1a')](function(_0x1e1dc9){logger[_0x0184('0x16')](_0x0184('0x11'),_0xefa595,_0x1e1dc9);_0x38ae9f(_0x1e1dc9);});});}exports[_0x0184('0x1b')]=function(_0x36574e){var _0x45269c=this;return new Promise(function(_0x3080f3,_0x51e0ec){return db['OpenchannelInteraction'][_0x0184('0x1c')](_0x36574e[_0x0184('0x1d')],{'raw':_0x36574e[_0x0184('0x1e')]?_0x36574e[_0x0184('0x1e')][_0x0184('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36574e['options']?_0x36574e[_0x0184('0x1e')]['where']||null:null,'attributes':_0x36574e[_0x0184('0x1e')]?_0x36574e[_0x0184('0x1e')]['attributes']||null:null,'limit':_0x36574e[_0x0184('0x1e')]?_0x36574e[_0x0184('0x1e')][_0x0184('0x20')]||null:null})['then'](function(_0xc5e42f){logger['info'](_0x0184('0x1b'),_0x36574e);logger['debug'](_0x0184('0x1b'),_0x36574e,JSON[_0x0184('0x15')](_0xc5e42f));_0x3080f3(_0xc5e42f);})['catch'](function(_0x5d13a2){logger[_0x0184('0x16')](_0x0184('0x1b'),_0x5d13a2[_0x0184('0x18')],_0x36574e);_0x51e0ec(_0x45269c['error'](0x1f4,_0x5d13a2[_0x0184('0x18')]));});});};exports[_0x0184('0x21')]=function(_0x3657a8){return new Promise(function(_0x204025,_0x1ceab4){return db[_0x0184('0x22')]['find']({'where':_0x3657a8[_0x0184('0x1e')]?_0x3657a8['options'][_0x0184('0x23')]||null:null})[_0x0184('0xf')](function(_0x234e7f){if(_0x234e7f){return _0x234e7f[_0x0184('0x24')](_0x3657a8[_0x0184('0x1d')][_0x0184('0x25')],_[_0x0184('0x26')](_0x3657a8['body'],[_0x0184('0x25'),'id'])||{});}})[_0x0184('0x27')](function(_0x323e3d){logger['info']('AddTags',_0x3657a8);logger[_0x0184('0x13')](_0x0184('0x28'),_0x3657a8,JSON[_0x0184('0x15')](_0x323e3d));_0x204025(_0x323e3d);})[_0x0184('0x1a')](function(_0x24b62c){logger[_0x0184('0x16')]('AddTags',_0x24b62c['message'],_0x3657a8);_0x1ceab4(_this[_0x0184('0x16')](0x1f4,_0x24b62c[_0x0184('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 6ac4c5a..e912f31 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 _0x4782=['openchannelInteraction:','./openchannelInteraction.events','remove','update','emit','removeListener','register'];(function(_0x19a51d,_0x496181){var _0x153ac5=function(_0x703fdd){while(--_0x703fdd){_0x19a51d['push'](_0x19a51d['shift']());}};_0x153ac5(++_0x496181);}(_0x4782,0x8d));var _0x2478=function(_0x3ccf96,_0x5e0892){_0x3ccf96=_0x3ccf96-0x0;var _0x10dec4=_0x4782[_0x3ccf96];return _0x10dec4;};'use strict';var OpenchannelInteractionEvents=require(_0x2478('0x0'));var events=['save',_0x2478('0x1'),_0x2478('0x2')];function createListener(_0x37ccbe,_0x1590a6){return function(_0x3eb20d){_0x1590a6[_0x2478('0x3')](_0x37ccbe,_0x3eb20d);};}function removeListener(_0x19281e,_0x3575e9){return function(){OpenchannelInteractionEvents[_0x2478('0x4')](_0x19281e,_0x3575e9);};}exports[_0x2478('0x5')]=function(_0x5507e4){for(var _0x11e99b=0x0,_0x2ba369=events['length'];_0x11e99b<_0x2ba369;_0x11e99b++){var _0x2c9990=events[_0x11e99b];var _0x42ce28=createListener(_0x2478('0x6')+_0x2c9990,_0x5507e4);OpenchannelInteractionEvents['on'](_0x2c9990,_0x42ce28);}}; \ No newline at end of file +var _0x52f1=['remove','update','register','./openchannelInteraction.events'];(function(_0x2c19ae,_0x485f3c){var _0x2dbcbc=function(_0x3b6b82){while(--_0x3b6b82){_0x2c19ae['push'](_0x2c19ae['shift']());}};_0x2dbcbc(++_0x485f3c);}(_0x52f1,0x147));var _0x152f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x52f1[_0x432682];return _0x463d05;};'use strict';var OpenchannelInteractionEvents=require(_0x152f('0x0'));var events=['save',_0x152f('0x1'),_0x152f('0x2')];function createListener(_0x28a5b6,_0x446377){return function(_0x451822){_0x446377['emit'](_0x28a5b6,_0x451822);};}function removeListener(_0x149435,_0x511dd9){return function(){OpenchannelInteractionEvents['removeListener'](_0x149435,_0x511dd9);};}exports[_0x152f('0x3')]=function(_0x2b11f5){for(var _0x1c32a8=0x0,_0x309f2c=events['length'];_0x1c32a8<_0x309f2c;_0x1c32a8++){var _0x2e7fe4=events[_0x1c32a8];var _0x14dd9a=createListener('openchannelInteraction:'+_0x2e7fe4,_0x2b11f5);OpenchannelInteractionEvents['on'](_0x2e7fe4,_0x14dd9a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index c62facf..81376c8 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x52ebca,_0x318d26){var _0x54ff1=function(_0xe1ca3a){while(--_0xe1ca3a){_0x52ebca['push'](_0x52ebca['shift']());}};_0x54ff1(++_0x318d26);}(_0xe706,0xa3));var _0x6e70=function(_0x67098f,_0x55e2d0){_0x67098f=_0x67098f-0x0;var _0x4cf120=_0xe706[_0x67098f];return _0x4cf120;};'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'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x3cc115,_0xabbcb7){var _0x4e93eb=function(_0x5e54f4){while(--_0x5e54f4){_0x3cc115['push'](_0x3cc115['shift']());}};_0x4e93eb(++_0xabbcb7);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'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['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 4134a8c..7712a8d 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 _0x39c4=['exports','BOOLEAN','out','DATE','STRING','TEXT'];(function(_0x9a5d51,_0x53a75f){var _0xaf46af=function(_0x11a006){while(--_0x11a006){_0x9a5d51['push'](_0x9a5d51['shift']());}};_0xaf46af(++_0x53a75f);}(_0x39c4,0x174));var _0x439c=function(_0x4942cf,_0x30f99b){_0x4942cf=_0x4942cf-0x0;var _0x1ca6c7=_0x39c4[_0x4942cf];return _0x1ca6c7;};'use strict';var Sequelize=require('sequelize');module[_0x439c('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x439c('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x439c('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x439c('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x439c('0x3')]},'providerName':{'type':Sequelize[_0x439c('0x4')]},'providerResponse':{'type':Sequelize[_0x439c('0x5')]}}; \ No newline at end of file +var _0x153c=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x8d4d5c,_0x2cf560){var _0x17a49a=function(_0x8a73d4){while(--_0x8a73d4){_0x8d4d5c['push'](_0x8d4d5c['shift']());}};_0x17a49a(++_0x2cf560);}(_0x153c,0x8c));var _0xc153=function(_0x345105,_0x39e487){_0x345105=_0x345105-0x0;var _0x3eb32b=_0x153c[_0x345105];return _0x3eb32b;};'use strict';var Sequelize=require(_0xc153('0x0'));module[_0xc153('0x1')]={'body':{'type':Sequelize[_0xc153('0x2')](_0xc153('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xc153('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc153('0x5')]('in',_0xc153('0x6')),'defaultValue':_0xc153('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc153('0x7')]},'providerName':{'type':Sequelize[_0xc153('0x8')]},'providerResponse':{'type':Sequelize[_0xc153('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index b9576b4..291f3b0 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 _0x6a56=['util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','map','type','include','findAll','rows','show','params','keys','includeAll','options','find','create','update','body','describe','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','openchannel-interactions','reject','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','interface','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x41b31d,_0x29197e){var _0x26567f=function(_0x2bb2e7){while(--_0x2bb2e7){_0x41b31d['push'](_0x41b31d['shift']());}};_0x26567f(++_0x29197e);}(_0x6a56,0x182));var _0x66a5=function(_0x578275,_0xe7ae46){_0x578275=_0x578275-0x0;var _0xf78041=_0x6a56[_0x578275];return _0xf78041;};'use strict';var emlformat=require(_0x66a5('0x0'));var rimraf=require(_0x66a5('0x1'));var zipdir=require(_0x66a5('0x2'));var jsonpatch=require(_0x66a5('0x3'));var rp=require(_0x66a5('0x4'));var moment=require(_0x66a5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x66a5('0x6'));var util=require(_0x66a5('0x7'));var path=require('path');var sox=require(_0x66a5('0x8'));var csv=require(_0x66a5('0x9'));var ejs=require(_0x66a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66a5('0xb'));var squel=require(_0x66a5('0xc'));var crypto=require(_0x66a5('0xd'));var jsforce=require(_0x66a5('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x66a5('0xf'));var Redis=require(_0x66a5('0x10'));var authService=require(_0x66a5('0x11'));var qs=require(_0x66a5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x66a5('0x13'))(_0x66a5('0x14'));var utils=require(_0x66a5('0x15'));var config=require(_0x66a5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x66a5('0x17'))['db'];config['redis']=_['defaults'](config[_0x66a5('0x18')],{'host':_0x66a5('0x19'),'port':0x18eb});var socket=require(_0x66a5('0x1a'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x66a5('0x1b')](socket);var jayson=require(_0x66a5('0x1c'));var client=jayson[_0x66a5('0x1d')][_0x66a5('0x1e')]({'port':0x232c});var client9002=jayson[_0x66a5('0x1d')][_0x66a5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x25b46f,_0x38655d,_0x102bfd,_0x2c3b43){return new BPromise(function(_0x58af7e,_0x348a3f){var _0x426043=_0x2c3b43||client;return _0x426043[_0x66a5('0x1f')](_0x25b46f,_0x102bfd)[_0x66a5('0x20')](function(_0x4cf3bb){logger[_0x66a5('0x21')](_0x66a5('0x22'),_0x38655d,'request\x20sent');logger[_0x66a5('0x23')](_0x66a5('0x24'),_0x38655d,_0x66a5('0x25'),JSON[_0x66a5('0x26')](_0x4cf3bb));if(_0x4cf3bb['error']){if(_0x4cf3bb[_0x66a5('0x27')][_0x66a5('0x28')]===0x1f4){logger[_0x66a5('0x27')](_0x66a5('0x22'),_0x38655d,_0x4cf3bb[_0x66a5('0x27')][_0x66a5('0x29')]);return _0x348a3f(_0x4cf3bb[_0x66a5('0x27')][_0x66a5('0x29')]);}logger['error'](_0x66a5('0x22'),_0x38655d,_0x4cf3bb[_0x66a5('0x27')][_0x66a5('0x29')]);return _0x58af7e(_0x4cf3bb[_0x66a5('0x27')][_0x66a5('0x29')]);}else{logger[_0x66a5('0x21')](_0x66a5('0x22'),_0x38655d,_0x66a5('0x25'));_0x58af7e(_0x4cf3bb[_0x66a5('0x2a')][_0x66a5('0x29')]);}})[_0x66a5('0x2b')](function(_0x11dbd7){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x38655d,_0x11dbd7);_0x348a3f(_0x11dbd7);});});}function respondWithStatusCode(_0x16d1cd,_0x3c5cb2){_0x3c5cb2=_0x3c5cb2||0xcc;return function(_0xbbb32f){if(_0xbbb32f){return _0x16d1cd[_0x66a5('0x2c')](_0x3c5cb2);}return _0x16d1cd[_0x66a5('0x2d')](_0x3c5cb2)[_0x66a5('0x2e')]();};}function respondWithResult(_0x5d3832,_0x22ccaa){_0x22ccaa=_0x22ccaa||0xc8;return function(_0x536a78){if(_0x536a78){return _0x5d3832['status'](_0x22ccaa)['json'](_0x536a78);}};}function respondWithFilteredResult(_0x4a9b74,_0x1a8e09){return function(_0x157640){if(_0x157640){var _0x118561=typeof _0x1a8e09[_0x66a5('0x2f')]===_0x66a5('0x30')&&typeof _0x1a8e09[_0x66a5('0x31')]===_0x66a5('0x30');var _0x560c0e=_0x157640[_0x66a5('0x32')];var _0x1157db=_0x118561?0x0:_0x1a8e09[_0x66a5('0x2f')];var _0x14c157=_0x118561?_0x157640[_0x66a5('0x32')]:_0x1a8e09[_0x66a5('0x2f')]+_0x1a8e09[_0x66a5('0x31')];var _0x244f28;if(_0x14c157>=_0x560c0e){_0x14c157=_0x560c0e;_0x244f28=0xc8;}else{_0x244f28=0xce;}_0x4a9b74[_0x66a5('0x2d')](_0x244f28);return _0x4a9b74[_0x66a5('0x33')](_0x66a5('0x34'),_0x1157db+'-'+_0x14c157+'/'+_0x560c0e)['json'](_0x157640);}return null;};}function patchUpdates(_0x448268){return function(_0x158ad9){try{jsonpatch[_0x66a5('0x35')](_0x158ad9,_0x448268,!![]);}catch(_0x431d95){return BPromise['reject'](_0x431d95);}return _0x158ad9[_0x66a5('0x36')]();};}function saveUpdates(_0x4d18ad,_0xf0ae40){return function(_0xf83cfd){if(_0xf83cfd){return _0xf83cfd['update'](_0x4d18ad)[_0x66a5('0x20')](function(_0x492d69){return _0x492d69;});}return null;};}function removeEntity(_0x232c2e,_0x2f1749){return function(_0x3f787b){if(_0x3f787b){return _0x3f787b[_0x66a5('0x37')]()[_0x66a5('0x20')](function(){_0x232c2e[_0x66a5('0x2d')](0xcc)[_0x66a5('0x2e')]();});}};}function handleEntityNotFound(_0x123c01,_0x1ca7e6){return function(_0xe49792){if(!_0xe49792){_0x123c01[_0x66a5('0x2c')](0x194);}return _0xe49792;};}function handleError(_0x430cc7,_0x54c538){_0x54c538=_0x54c538||0x1f4;return function(_0x1af158){logger['error'](_0x1af158[_0x66a5('0x38')]);if(_0x1af158[_0x66a5('0x39')]){delete _0x1af158[_0x66a5('0x39')];}_0x430cc7[_0x66a5('0x2d')](_0x54c538)[_0x66a5('0x3a')](_0x1af158);};}exports[_0x66a5('0x3b')]=function(_0x379547,_0x1cf341){var _0x104369={},_0x9d32e2={},_0xc43d1b={'count':0x0,'rows':[]};var _0x22750a=_['map'](db[_0x66a5('0x3c')][_0x66a5('0x3d')],function(_0x43b8ba){return{'name':_0x43b8ba[_0x66a5('0x3e')],'type':_0x43b8ba['type'][_0x66a5('0x3f')]};});_0x9d32e2[_0x66a5('0x40')]=_['map'](_0x22750a,_0x66a5('0x39'));_0x9d32e2[_0x66a5('0x41')]=_['keys'](_0x379547[_0x66a5('0x41')]);_0x9d32e2[_0x66a5('0x42')]=_[_0x66a5('0x43')](_0x9d32e2[_0x66a5('0x40')],_0x9d32e2['query']);_0x104369[_0x66a5('0x44')]=_[_0x66a5('0x43')](_0x9d32e2[_0x66a5('0x40')],qs[_0x66a5('0x45')](_0x379547[_0x66a5('0x41')][_0x66a5('0x45')]));_0x104369['attributes']=_0x104369['attributes']['length']?_0x104369[_0x66a5('0x44')]:_0x9d32e2['model'];if(!_0x379547['query'][_0x66a5('0x46')](_0x66a5('0x47'))){_0x104369[_0x66a5('0x31')]=qs[_0x66a5('0x31')](_0x379547[_0x66a5('0x41')][_0x66a5('0x31')]);_0x104369[_0x66a5('0x2f')]=qs[_0x66a5('0x2f')](_0x379547['query'][_0x66a5('0x2f')]);}_0x104369['order']=qs[_0x66a5('0x48')](_0x379547[_0x66a5('0x41')][_0x66a5('0x48')]);_0x104369[_0x66a5('0x49')]=qs[_0x66a5('0x42')](_['pick'](_0x379547[_0x66a5('0x41')],_0x9d32e2[_0x66a5('0x42')]),_0x22750a);if(_0x379547[_0x66a5('0x41')][_0x66a5('0x4a')]){_0x104369[_0x66a5('0x49')]=_[_0x66a5('0x4b')](_0x104369[_0x66a5('0x49')],{'$or':_[_0x66a5('0x4c')](_0x22750a,function(_0x4425be){if(_0x4425be[_0x66a5('0x4d')]!=='VIRTUAL'){var _0x537d01={};_0x537d01[_0x4425be['name']]={'$like':'%'+_0x379547[_0x66a5('0x41')][_0x66a5('0x4a')]+'%'};return _0x537d01;}})});}_0x104369=_[_0x66a5('0x4b')]({},_0x104369,_0x379547['options']);var _0x565be5={'where':_0x104369[_0x66a5('0x49')]};return db[_0x66a5('0x3c')][_0x66a5('0x32')](_0x565be5)['then'](function(_0x5b613a){_0xc43d1b[_0x66a5('0x32')]=_0x5b613a;if(_0x379547[_0x66a5('0x41')]['includeAll']){_0x104369[_0x66a5('0x4e')]=[{'all':!![]}];}return db[_0x66a5('0x3c')][_0x66a5('0x4f')](_0x104369);})['then'](function(_0x34894a){_0xc43d1b[_0x66a5('0x50')]=_0x34894a;return _0xc43d1b;})[_0x66a5('0x20')](respondWithFilteredResult(_0x1cf341,_0x104369))[_0x66a5('0x2b')](handleError(_0x1cf341,null));};exports[_0x66a5('0x51')]=function(_0xdb0e82,_0x1cdcdf){var _0x3aca49={'raw':!![],'where':{'id':_0xdb0e82[_0x66a5('0x52')]['id']}},_0x254ffc={};_0x254ffc[_0x66a5('0x40')]=_['keys'](db[_0x66a5('0x3c')][_0x66a5('0x3d')]);_0x254ffc[_0x66a5('0x41')]=_[_0x66a5('0x53')](_0xdb0e82['query']);_0x254ffc['filters']=_[_0x66a5('0x43')](_0x254ffc['model'],_0x254ffc['query']);_0x3aca49[_0x66a5('0x44')]=_['intersection'](_0x254ffc[_0x66a5('0x40')],qs[_0x66a5('0x45')](_0xdb0e82[_0x66a5('0x41')][_0x66a5('0x45')]));_0x3aca49[_0x66a5('0x44')]=_0x3aca49[_0x66a5('0x44')]['length']?_0x3aca49[_0x66a5('0x44')]:_0x254ffc[_0x66a5('0x40')];if(_0xdb0e82[_0x66a5('0x41')][_0x66a5('0x54')]){_0x3aca49[_0x66a5('0x4e')]=[{'all':!![]}];}_0x3aca49=_[_0x66a5('0x4b')]({},_0x3aca49,_0xdb0e82[_0x66a5('0x55')]);return db[_0x66a5('0x3c')][_0x66a5('0x56')](_0x3aca49)[_0x66a5('0x20')](handleEntityNotFound(_0x1cdcdf,null))[_0x66a5('0x20')](respondWithResult(_0x1cdcdf,null))[_0x66a5('0x2b')](handleError(_0x1cdcdf,null));};exports['create']=function(_0x31bb27,_0x4a3764){return db[_0x66a5('0x3c')][_0x66a5('0x57')](_0x31bb27['body'],{})['then'](respondWithResult(_0x4a3764,0xc9))[_0x66a5('0x2b')](handleError(_0x4a3764,null));};exports[_0x66a5('0x58')]=function(_0x25dc89,_0x156388){if(_0x25dc89['body']['id']){delete _0x25dc89[_0x66a5('0x59')]['id'];}return db['OpenchannelMessage'][_0x66a5('0x56')]({'where':{'id':_0x25dc89[_0x66a5('0x52')]['id']}})[_0x66a5('0x20')](handleEntityNotFound(_0x156388,null))['then'](saveUpdates(_0x25dc89[_0x66a5('0x59')],null))[_0x66a5('0x20')](respondWithResult(_0x156388,null))[_0x66a5('0x2b')](handleError(_0x156388,null));};exports['destroy']=function(_0x4f17e6,_0x25e8c1){return db[_0x66a5('0x3c')][_0x66a5('0x56')]({'where':{'id':_0x4f17e6[_0x66a5('0x52')]['id']}})[_0x66a5('0x20')](handleEntityNotFound(_0x25e8c1,null))[_0x66a5('0x20')](removeEntity(_0x25e8c1,null))[_0x66a5('0x2b')](handleError(_0x25e8c1,null));};exports[_0x66a5('0x5a')]=function(_0x3a95fb,_0x390312){return db[_0x66a5('0x3c')][_0x66a5('0x5a')]()['then'](respondWithResult(_0x390312,null))['catch'](handleError(_0x390312,null));};var interaction_log=require(_0x66a5('0x13'))('openchannel-interactions');exports[_0x66a5('0x5b')]=function(_0x454a0d,_0x11018e,_0x111f9e){var _0x3eabf3={'agent':{},'channel':'openchannel'};if(_0x454a0d[_0x66a5('0x59')]['id']){delete _0x454a0d[_0x66a5('0x59')]['id'];}_0x454a0d['body'][_0x66a5('0x5c')]=!![];_0x454a0d[_0x66a5('0x59')]['readAt']=moment()[_0x66a5('0x5d')](_0x66a5('0x5e'));_0x454a0d[_0x66a5('0x59')]['UserId']=_0x454a0d[_0x66a5('0x59')][_0x66a5('0x5f')]||_0x454a0d[_0x66a5('0x60')]['id'];_0x3eabf3[_0x66a5('0x61')]['id']=_0x454a0d[_0x66a5('0x59')][_0x66a5('0x5f')];return db['OpenchannelMessage'][_0x66a5('0x56')]({'where':{'id':_0x454a0d[_0x66a5('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x11018e,null))[_0x66a5('0x20')](saveUpdates(_0x454a0d[_0x66a5('0x59')],null))[_0x66a5('0x20')](function(_0x5cc0da){if(_0x5cc0da){_0x3eabf3['message']=_0x5cc0da[_0x66a5('0x62')]({'plain':!![]});return db[_0x66a5('0x63')][_0x66a5('0x56')]({'where':{'id':_0x5cc0da[_0x66a5('0x64')]}});}return null;})[_0x66a5('0x20')](handleEntityNotFound(_0x11018e,null))[_0x66a5('0x20')](function(_0x77af63){if(_0x77af63){return _0x77af63['update']({'UserId':_0x454a0d[_0x66a5('0x59')][_0x66a5('0x5f')],'read1stAt':_[_0x66a5('0x65')](_0x77af63[_0x66a5('0x66')])?moment()[_0x66a5('0x5d')](_0x66a5('0x5e')):undefined});}return null;})[_0x66a5('0x20')](function(_0x595fce){if(_0x595fce){_0x3eabf3[_0x66a5('0x67')]=_0x595fce[_0x66a5('0x62')]({'plain':!![]});interaction_log[_0x66a5('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x454a0d[_0x66a5('0x60')]['id'],_0x454a0d[_0x66a5('0x60')]['name'],_0x454a0d[_0x66a5('0x60')][_0x66a5('0x68')],_0x3eabf3['interaction']['id'],_0x454a0d['body']?JSON['stringify'](_0x454a0d[_0x66a5('0x59')]):_0x66a5('0x69'));return respondWithRpcPromise(_0x66a5('0x6a'),'acceptMessage',_0x3eabf3);}return null;})[_0x66a5('0x20')](function(_0x4f55fa){var _0x379ae6=_0x66a5('0x6b')+_0x4f55fa[_0x66a5('0x29')][_0x66a5('0x6c')];return db[_0x66a5('0x6d')][_0x66a5('0x41')](_0x379ae6,{'type':db[_0x66a5('0x6e')]['QueryTypes'][_0x66a5('0x6f')],'raw':!![]})[_0x66a5('0x20')](function(_0x2c1e80){return _0x2c1e80;});})[_0x66a5('0x20')](function(_0x49969c){if(_0x49969c){_0x3eabf3[_0x66a5('0x29')][_0x66a5('0x70')]=_0x49969c[0x0];if(!_0x454a0d[_0x66a5('0x59')][_0x66a5('0x5f')])return;return db[_0x66a5('0x71')]['find']({'where':{'id':_0x454a0d['body'][_0x66a5('0x5f')],'role':'agent'},'attributes':['id',_0x66a5('0x39'),'fullname',_0x66a5('0x72'),'internal'],'raw':!![]});}return null;})[_0x66a5('0x20')](function(_0x11b6b5){if(!_0x11b6b5)return null;_0x3eabf3[_0x66a5('0x29')][_0x66a5('0x61')]=_0x11b6b5;return _0x3eabf3;})['then'](function(_0x3530aa){if(_0x3530aa){if(_0x454a0d['body'][_0x66a5('0x73')]){_0x3eabf3[_0x66a5('0x29')]['interface']=util[_0x66a5('0x5d')](_0x66a5('0x74'),_0x454a0d[_0x66a5('0x60')]['name']);_0x3eabf3[_0x66a5('0x29')]['channel']=_0x3eabf3[_0x66a5('0x75')];_0x3eabf3[_0x66a5('0x29')][_0x66a5('0x76')]=_0x3eabf3['channel'];_0x3eabf3[_0x66a5('0x29')]['event']='accept';return respondWithRpcPromise(_0x66a5('0x77'),_0x66a5('0x77'),{'event':_0x66a5('0x78'),'message':_0x3eabf3[_0x66a5('0x29')]},client9002)['then'](function(){return _0x3eabf3;});}return _0x3eabf3;}return null;})['then'](respondWithResult(_0x11018e,null))['catch'](handleError(_0x11018e,null));};var interaction_log=require(_0x66a5('0x13'))(_0x66a5('0x79'));exports[_0x66a5('0x7a')]=function(_0x1911d2,_0x5ef452,_0x4465ed){var _0xc33758={'agent':{},'channel':_0x66a5('0x7b')};if(_0x1911d2[_0x66a5('0x59')]['id']){delete _0x1911d2['body']['id'];}_0x1911d2[_0x66a5('0x59')][_0x66a5('0x5f')]=_0x1911d2['body'][_0x66a5('0x5f')]||_0x1911d2[_0x66a5('0x60')]['id'];_0xc33758[_0x66a5('0x61')]['id']=_0x1911d2['body']['UserId'];return db[_0x66a5('0x3c')][_0x66a5('0x56')]({'where':{'id':_0x1911d2[_0x66a5('0x52')]['id'],'UserId':null}})[_0x66a5('0x20')](handleEntityNotFound(_0x5ef452,null))[_0x66a5('0x20')](function(_0x2c1546){if(_0x2c1546){_0xc33758['message']=_0x2c1546[_0x66a5('0x62')]({'plain':!![]});return db[_0x66a5('0x63')][_0x66a5('0x56')]({'where':{'id':_0x2c1546[_0x66a5('0x64')]}});}return null;})[_0x66a5('0x20')](handleEntityNotFound(_0x5ef452,null))[_0x66a5('0x20')](function(_0x8f7254){if(_0x8f7254){_0xc33758[_0x66a5('0x67')]=_0x8f7254[_0x66a5('0x62')]({'plain':!![]});interaction_log[_0x66a5('0x21')](_0x66a5('0x7c'),_0x1911d2['user']['id'],_0x1911d2[_0x66a5('0x60')][_0x66a5('0x39')],_0x1911d2['user'][_0x66a5('0x68')],_0xc33758[_0x66a5('0x67')]['id'],_0x1911d2[_0x66a5('0x59')]?JSON[_0x66a5('0x26')](_0x1911d2[_0x66a5('0x59')]):_0x66a5('0x69'));return respondWithRpcPromise(_0x66a5('0x7d'),_0x66a5('0x7e'),_0xc33758);}return null;})[_0x66a5('0x20')](function(_0x5d775b){var _0x39a6fa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5d775b[_0x66a5('0x29')][_0x66a5('0x6c')];return db[_0x66a5('0x6d')]['query'](_0x39a6fa,{'type':db[_0x66a5('0x6e')]['QueryTypes'][_0x66a5('0x6f')],'raw':!![]})[_0x66a5('0x20')](function(_0x44c720){return _0x44c720;});})[_0x66a5('0x20')](function(_0x5b555d){if(_0x5b555d){_0xc33758[_0x66a5('0x29')][_0x66a5('0x70')]=_0x5b555d[0x0];if(!_0x1911d2[_0x66a5('0x59')][_0x66a5('0x5f')])return;return db[_0x66a5('0x71')][_0x66a5('0x56')]({'where':{'id':_0x1911d2[_0x66a5('0x59')][_0x66a5('0x5f')],'role':'agent'},'attributes':['id','name',_0x66a5('0x7f'),'email','internal'],'raw':!![]});}return null;})[_0x66a5('0x20')](function(_0x9978d5){if(!_0x9978d5)return null;_0xc33758[_0x66a5('0x29')][_0x66a5('0x61')]=_0x9978d5;return _0xc33758;})['then'](function(_0x2b2a8d){if(_0x2b2a8d){_0x2b2a8d[_0x66a5('0x29')][_0x66a5('0x80')]=util[_0x66a5('0x5d')](_0x66a5('0x74'),_0x1911d2['user'][_0x66a5('0x39')]);_0x2b2a8d[_0x66a5('0x29')][_0x66a5('0x75')]=_0xc33758[_0x66a5('0x75')];_0x2b2a8d['message'][_0x66a5('0x76')]=_0xc33758[_0x66a5('0x75')];_0x2b2a8d[_0x66a5('0x29')][_0x66a5('0x81')]=_0x66a5('0x7a');respondWithRpcPromise(_0x66a5('0x77'),_0x66a5('0x77'),{'event':_0x66a5('0x82'),'message':_0x2b2a8d['message']},client9002);return _0xc33758;}return null;})[_0x66a5('0x20')](respondWithResult(_0x5ef452,null))[_0x66a5('0x2b')](handleError(_0x5ef452,null));}; \ No newline at end of file +var _0x6471=['client','http','request','then','request\x20sent','debug','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','stack','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','name','filter','options','findAll','rows','params','fields','includeAll','include','find','create','body','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','fullname','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','RejectMessage','rejectMessage','QueryTypes','SELECT','contact','User','email','internal','SIP/%s','eml-format','zip-dir','bluebird','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x6471,0x1ee));var _0x1647=function(_0x18e33f,_0x26f0f7){_0x18e33f=_0x18e33f-0x0;var _0x1150e9=_0x6471[_0x18e33f];return _0x1150e9;};'use strict';var emlformat=require(_0x1647('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1647('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1647('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1647('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1647('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1647('0x5'));var squel=require(_0x1647('0x6'));var crypto=require(_0x1647('0x7'));var jsforce=require(_0x1647('0x8'));var deskjs=require(_0x1647('0x9'));var toCsv=require(_0x1647('0xa'));var querystring=require(_0x1647('0xb'));var Papa=require(_0x1647('0xc'));var Redis=require('ioredis');var authService=require(_0x1647('0xd'));var qs=require(_0x1647('0xe'));var as=require(_0x1647('0xf'));var hardwareService=require(_0x1647('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x1647('0x11'));var config=require(_0x1647('0x12'));var licenseUtil=require(_0x1647('0x13'));var db=require('../../mysqldb')['db'];config[_0x1647('0x14')]=_[_0x1647('0x15')](config[_0x1647('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x1647('0x16'))(new Redis(config[_0x1647('0x14')]));require(_0x1647('0x17'))[_0x1647('0x18')](socket);var jayson=require(_0x1647('0x19'));var client=jayson[_0x1647('0x1a')][_0x1647('0x1b')]({'port':0x232c});var client9002=jayson[_0x1647('0x1a')][_0x1647('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x151197,_0x5b5b74,_0x14faf0,_0x38153b){return new BPromise(function(_0x5e5efd,_0x1a74f4){var _0x59e18b=_0x38153b||client;return _0x59e18b[_0x1647('0x1c')](_0x151197,_0x14faf0)[_0x1647('0x1d')](function(_0x148a5e){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x5b5b74,_0x1647('0x1e'));logger[_0x1647('0x1f')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5b5b74,_0x1647('0x1e'),JSON['stringify'](_0x148a5e));if(_0x148a5e[_0x1647('0x20')]){if(_0x148a5e[_0x1647('0x20')][_0x1647('0x21')]===0x1f4){logger[_0x1647('0x20')](_0x1647('0x22'),_0x5b5b74,_0x148a5e[_0x1647('0x20')][_0x1647('0x23')]);return _0x1a74f4(_0x148a5e[_0x1647('0x20')]['message']);}logger[_0x1647('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x5b5b74,_0x148a5e[_0x1647('0x20')][_0x1647('0x23')]);return _0x5e5efd(_0x148a5e[_0x1647('0x20')][_0x1647('0x23')]);}else{logger[_0x1647('0x24')](_0x1647('0x22'),_0x5b5b74,'request\x20sent');_0x5e5efd(_0x148a5e[_0x1647('0x25')][_0x1647('0x23')]);}})[_0x1647('0x26')](function(_0x338e5d){logger[_0x1647('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x5b5b74,_0x338e5d);_0x1a74f4(_0x338e5d);});});}function respondWithStatusCode(_0x469de0,_0xb873f7){_0xb873f7=_0xb873f7||0xcc;return function(_0x33d4df){if(_0x33d4df){return _0x469de0[_0x1647('0x27')](_0xb873f7);}return _0x469de0[_0x1647('0x28')](_0xb873f7)['end']();};}function respondWithResult(_0x2a2a20,_0x5dae76){_0x5dae76=_0x5dae76||0xc8;return function(_0x9e055f){if(_0x9e055f){return _0x2a2a20['status'](_0x5dae76)[_0x1647('0x29')](_0x9e055f);}};}function respondWithFilteredResult(_0x287eef,_0x48d277){return function(_0x29d6f4){if(_0x29d6f4){var _0x93e63e=typeof _0x48d277[_0x1647('0x2a')]==='undefined'&&typeof _0x48d277[_0x1647('0x2b')]===_0x1647('0x2c');var _0xf04fb1=_0x29d6f4['count'];var _0x2acc17=_0x93e63e?0x0:_0x48d277['offset'];var _0x34ce44=_0x93e63e?_0x29d6f4[_0x1647('0x2d')]:_0x48d277[_0x1647('0x2a')]+_0x48d277[_0x1647('0x2b')];var _0x2b3b41;if(_0x34ce44>=_0xf04fb1){_0x34ce44=_0xf04fb1;_0x2b3b41=0xc8;}else{_0x2b3b41=0xce;}_0x287eef[_0x1647('0x28')](_0x2b3b41);return _0x287eef[_0x1647('0x2e')](_0x1647('0x2f'),_0x2acc17+'-'+_0x34ce44+'/'+_0xf04fb1)[_0x1647('0x29')](_0x29d6f4);}return null;};}function patchUpdates(_0x1e4498){return function(_0x5ec404){try{jsonpatch[_0x1647('0x30')](_0x5ec404,_0x1e4498,!![]);}catch(_0x133f21){return BPromise[_0x1647('0x31')](_0x133f21);}return _0x5ec404['save']();};}function saveUpdates(_0xda826c,_0x24e56b){return function(_0x2c6974){if(_0x2c6974){return _0x2c6974[_0x1647('0x32')](_0xda826c)['then'](function(_0x3407d7){return _0x3407d7;});}return null;};}function removeEntity(_0x24ebd9,_0x5af2f1){return function(_0x55ed45){if(_0x55ed45){return _0x55ed45[_0x1647('0x33')]()[_0x1647('0x1d')](function(){_0x24ebd9[_0x1647('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48b419,_0x5bec69){return function(_0x414fbe){if(!_0x414fbe){_0x48b419[_0x1647('0x27')](0x194);}return _0x414fbe;};}function handleError(_0x39b54d,_0x4669c4){_0x4669c4=_0x4669c4||0x1f4;return function(_0x3b1402){logger['error'](_0x3b1402[_0x1647('0x34')]);if(_0x3b1402['name']){delete _0x3b1402['name'];}_0x39b54d['status'](_0x4669c4)['send'](_0x3b1402);};}exports['index']=function(_0x434451,_0x5e98b4){var _0x32fadc={},_0x50a515={},_0x4d46d7={'count':0x0,'rows':[]};var _0x436200=_[_0x1647('0x35')](db[_0x1647('0x36')][_0x1647('0x37')],function(_0x1c29a9){return{'name':_0x1c29a9[_0x1647('0x38')],'type':_0x1c29a9['type'][_0x1647('0x39')]};});_0x50a515[_0x1647('0x3a')]=_[_0x1647('0x35')](_0x436200,'name');_0x50a515[_0x1647('0x3b')]=_[_0x1647('0x3c')](_0x434451[_0x1647('0x3b')]);_0x50a515[_0x1647('0x3d')]=_['intersection'](_0x50a515[_0x1647('0x3a')],_0x50a515[_0x1647('0x3b')]);_0x32fadc[_0x1647('0x3e')]=_[_0x1647('0x3f')](_0x50a515[_0x1647('0x3a')],qs['fields'](_0x434451[_0x1647('0x3b')]['fields']));_0x32fadc[_0x1647('0x3e')]=_0x32fadc[_0x1647('0x3e')][_0x1647('0x40')]?_0x32fadc[_0x1647('0x3e')]:_0x50a515[_0x1647('0x3a')];if(!_0x434451['query'][_0x1647('0x41')](_0x1647('0x42'))){_0x32fadc[_0x1647('0x2b')]=qs[_0x1647('0x2b')](_0x434451[_0x1647('0x3b')][_0x1647('0x2b')]);_0x32fadc['offset']=qs[_0x1647('0x2a')](_0x434451[_0x1647('0x3b')][_0x1647('0x2a')]);}_0x32fadc[_0x1647('0x43')]=qs['sort'](_0x434451[_0x1647('0x3b')][_0x1647('0x44')]);_0x32fadc[_0x1647('0x45')]=qs[_0x1647('0x3d')](_[_0x1647('0x46')](_0x434451[_0x1647('0x3b')],_0x50a515[_0x1647('0x3d')]),_0x436200);if(_0x434451[_0x1647('0x3b')]['filter']){_0x32fadc[_0x1647('0x45')]=_[_0x1647('0x47')](_0x32fadc[_0x1647('0x45')],{'$or':_[_0x1647('0x35')](_0x436200,function(_0x352ce5){if(_0x352ce5[_0x1647('0x48')]!==_0x1647('0x49')){var _0x4b4424={};_0x4b4424[_0x352ce5[_0x1647('0x4a')]]={'$like':'%'+_0x434451['query'][_0x1647('0x4b')]+'%'};return _0x4b4424;}})});}_0x32fadc=_[_0x1647('0x47')]({},_0x32fadc,_0x434451[_0x1647('0x4c')]);var _0x49b9ff={'where':_0x32fadc[_0x1647('0x45')]};return db[_0x1647('0x36')][_0x1647('0x2d')](_0x49b9ff)[_0x1647('0x1d')](function(_0x3158c5){_0x4d46d7[_0x1647('0x2d')]=_0x3158c5;if(_0x434451[_0x1647('0x3b')]['includeAll']){_0x32fadc['include']=[{'all':!![]}];}return db[_0x1647('0x36')][_0x1647('0x4d')](_0x32fadc);})[_0x1647('0x1d')](function(_0x3939e7){_0x4d46d7[_0x1647('0x4e')]=_0x3939e7;return _0x4d46d7;})[_0x1647('0x1d')](respondWithFilteredResult(_0x5e98b4,_0x32fadc))[_0x1647('0x26')](handleError(_0x5e98b4,null));};exports['show']=function(_0x2df28d,_0xe82e2a){var _0x2066b2={'raw':!![],'where':{'id':_0x2df28d[_0x1647('0x4f')]['id']}},_0x2d8d15={};_0x2d8d15[_0x1647('0x3a')]=_[_0x1647('0x3c')](db[_0x1647('0x36')][_0x1647('0x37')]);_0x2d8d15[_0x1647('0x3b')]=_[_0x1647('0x3c')](_0x2df28d[_0x1647('0x3b')]);_0x2d8d15[_0x1647('0x3d')]=_[_0x1647('0x3f')](_0x2d8d15[_0x1647('0x3a')],_0x2d8d15[_0x1647('0x3b')]);_0x2066b2[_0x1647('0x3e')]=_[_0x1647('0x3f')](_0x2d8d15[_0x1647('0x3a')],qs['fields'](_0x2df28d['query'][_0x1647('0x50')]));_0x2066b2[_0x1647('0x3e')]=_0x2066b2['attributes'][_0x1647('0x40')]?_0x2066b2[_0x1647('0x3e')]:_0x2d8d15[_0x1647('0x3a')];if(_0x2df28d['query'][_0x1647('0x51')]){_0x2066b2[_0x1647('0x52')]=[{'all':!![]}];}_0x2066b2=_['merge']({},_0x2066b2,_0x2df28d['options']);return db['OpenchannelMessage'][_0x1647('0x53')](_0x2066b2)['then'](handleEntityNotFound(_0xe82e2a,null))[_0x1647('0x1d')](respondWithResult(_0xe82e2a,null))[_0x1647('0x26')](handleError(_0xe82e2a,null));};exports[_0x1647('0x54')]=function(_0x1ae702,_0x37106f){return db[_0x1647('0x36')][_0x1647('0x54')](_0x1ae702['body'],{})[_0x1647('0x1d')](respondWithResult(_0x37106f,0xc9))[_0x1647('0x26')](handleError(_0x37106f,null));};exports['update']=function(_0x230ffd,_0x239071){if(_0x230ffd[_0x1647('0x55')]['id']){delete _0x230ffd['body']['id'];}return db[_0x1647('0x36')][_0x1647('0x53')]({'where':{'id':_0x230ffd[_0x1647('0x4f')]['id']}})['then'](handleEntityNotFound(_0x239071,null))['then'](saveUpdates(_0x230ffd[_0x1647('0x55')],null))[_0x1647('0x1d')](respondWithResult(_0x239071,null))[_0x1647('0x26')](handleError(_0x239071,null));};exports['destroy']=function(_0x9414a9,_0xe0e871){return db[_0x1647('0x36')][_0x1647('0x53')]({'where':{'id':_0x9414a9[_0x1647('0x4f')]['id']}})[_0x1647('0x1d')](handleEntityNotFound(_0xe0e871,null))[_0x1647('0x1d')](removeEntity(_0xe0e871,null))[_0x1647('0x26')](handleError(_0xe0e871,null));};exports['describe']=function(_0x4d4e70,_0x1d3529){return db[_0x1647('0x36')][_0x1647('0x56')]()['then'](respondWithResult(_0x1d3529,null))['catch'](handleError(_0x1d3529,null));};var interaction_log=require(_0x1647('0x57'))(_0x1647('0x58'));exports[_0x1647('0x59')]=function(_0x32ab0e,_0x4ef10f,_0x3c9717){var _0x45a047={'agent':{},'channel':_0x1647('0x5a')};if(_0x32ab0e[_0x1647('0x55')]['id']){delete _0x32ab0e[_0x1647('0x55')]['id'];}_0x32ab0e[_0x1647('0x55')][_0x1647('0x5b')]=!![];_0x32ab0e[_0x1647('0x55')]['readAt']=moment()[_0x1647('0x5c')](_0x1647('0x5d'));_0x32ab0e[_0x1647('0x55')]['UserId']=_0x32ab0e[_0x1647('0x55')][_0x1647('0x5e')]||_0x32ab0e[_0x1647('0x5f')]['id'];_0x45a047[_0x1647('0x60')]['id']=_0x32ab0e[_0x1647('0x55')][_0x1647('0x5e')];return db[_0x1647('0x36')][_0x1647('0x53')]({'where':{'id':_0x32ab0e[_0x1647('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4ef10f,null))[_0x1647('0x1d')](saveUpdates(_0x32ab0e[_0x1647('0x55')],null))[_0x1647('0x1d')](function(_0x371e88){if(_0x371e88){_0x45a047[_0x1647('0x23')]=_0x371e88['get']({'plain':!![]});return db[_0x1647('0x61')][_0x1647('0x53')]({'where':{'id':_0x371e88[_0x1647('0x62')]}});}return null;})[_0x1647('0x1d')](handleEntityNotFound(_0x4ef10f,null))[_0x1647('0x1d')](function(_0x78f6bf){if(_0x78f6bf){return _0x78f6bf[_0x1647('0x32')]({'UserId':_0x32ab0e[_0x1647('0x55')][_0x1647('0x5e')],'read1stAt':_[_0x1647('0x63')](_0x78f6bf[_0x1647('0x64')])?moment()['format'](_0x1647('0x5d')):undefined});}return null;})['then'](function(_0x4f7dc4){if(_0x4f7dc4){_0x45a047['interaction']=_0x4f7dc4[_0x1647('0x65')]({'plain':!![]});interaction_log[_0x1647('0x24')](_0x1647('0x66'),_0x32ab0e[_0x1647('0x5f')]['id'],_0x32ab0e[_0x1647('0x5f')][_0x1647('0x4a')],_0x32ab0e[_0x1647('0x5f')]['role'],_0x45a047['interaction']['id'],_0x32ab0e[_0x1647('0x55')]?JSON['stringify'](_0x32ab0e['body']):'null');return respondWithRpcPromise(_0x1647('0x67'),'acceptMessage',_0x45a047);}return null;})[_0x1647('0x1d')](function(_0x27f273){var _0x7e538e=_0x1647('0x68')+_0x27f273[_0x1647('0x23')][_0x1647('0x69')];return db[_0x1647('0x6a')][_0x1647('0x3b')](_0x7e538e,{'type':db[_0x1647('0x6b')]['QueryTypes']['SELECT'],'raw':!![]})[_0x1647('0x1d')](function(_0x51398f){return _0x51398f;});})['then'](function(_0x2f7e5d){if(_0x2f7e5d){_0x45a047[_0x1647('0x23')]['contact']=_0x2f7e5d[0x0];if(!_0x32ab0e[_0x1647('0x55')][_0x1647('0x5e')])return;return db['User'][_0x1647('0x53')]({'where':{'id':_0x32ab0e[_0x1647('0x55')][_0x1647('0x5e')],'role':_0x1647('0x60')},'attributes':['id',_0x1647('0x4a'),_0x1647('0x6c'),'email','internal'],'raw':!![]});}return null;})[_0x1647('0x1d')](function(_0x3ab2a9){if(!_0x3ab2a9)return null;_0x45a047[_0x1647('0x23')][_0x1647('0x60')]=_0x3ab2a9;return _0x45a047;})[_0x1647('0x1d')](function(_0x461deb){if(_0x461deb){if(_0x32ab0e[_0x1647('0x55')][_0x1647('0x6d')]){_0x45a047['message'][_0x1647('0x6e')]=util[_0x1647('0x5c')]('SIP/%s',_0x32ab0e[_0x1647('0x5f')]['name']);_0x45a047['message'][_0x1647('0x6f')]=_0x45a047[_0x1647('0x6f')];_0x45a047[_0x1647('0x23')][_0x1647('0x70')]=_0x45a047[_0x1647('0x6f')];_0x45a047[_0x1647('0x23')][_0x1647('0x71')]=_0x1647('0x59');return respondWithRpcPromise(_0x1647('0x72'),_0x1647('0x72'),{'event':_0x1647('0x73'),'message':_0x45a047['message']},client9002)['then'](function(){return _0x45a047;});}return _0x45a047;}return null;})['then'](respondWithResult(_0x4ef10f,null))[_0x1647('0x26')](handleError(_0x4ef10f,null));};var interaction_log=require(_0x1647('0x57'))('openchannel-interactions');exports[_0x1647('0x31')]=function(_0x51b4d1,_0x4e3bbb,_0x317243){var _0x4024fc={'agent':{},'channel':_0x1647('0x5a')};if(_0x51b4d1[_0x1647('0x55')]['id']){delete _0x51b4d1[_0x1647('0x55')]['id'];}_0x51b4d1[_0x1647('0x55')][_0x1647('0x5e')]=_0x51b4d1[_0x1647('0x55')]['UserId']||_0x51b4d1[_0x1647('0x5f')]['id'];_0x4024fc[_0x1647('0x60')]['id']=_0x51b4d1[_0x1647('0x55')][_0x1647('0x5e')];return db[_0x1647('0x36')][_0x1647('0x53')]({'where':{'id':_0x51b4d1['params']['id'],'UserId':null}})[_0x1647('0x1d')](handleEntityNotFound(_0x4e3bbb,null))[_0x1647('0x1d')](function(_0x35a63f){if(_0x35a63f){_0x4024fc[_0x1647('0x23')]=_0x35a63f[_0x1647('0x65')]({'plain':!![]});return db['OpenchannelInteraction'][_0x1647('0x53')]({'where':{'id':_0x35a63f[_0x1647('0x62')]}});}return null;})[_0x1647('0x1d')](handleEntityNotFound(_0x4e3bbb,null))['then'](function(_0x16fdb5){if(_0x16fdb5){_0x4024fc[_0x1647('0x74')]=_0x16fdb5[_0x1647('0x65')]({'plain':!![]});interaction_log[_0x1647('0x24')](_0x1647('0x75'),_0x51b4d1['user']['id'],_0x51b4d1[_0x1647('0x5f')][_0x1647('0x4a')],_0x51b4d1[_0x1647('0x5f')][_0x1647('0x76')],_0x4024fc[_0x1647('0x74')]['id'],_0x51b4d1[_0x1647('0x55')]?JSON[_0x1647('0x77')](_0x51b4d1[_0x1647('0x55')]):_0x1647('0x78'));return respondWithRpcPromise(_0x1647('0x79'),_0x1647('0x7a'),_0x4024fc);}return null;})['then'](function(_0x4f3272){var _0xa4b0b7=_0x1647('0x68')+_0x4f3272[_0x1647('0x23')][_0x1647('0x69')];return db[_0x1647('0x6a')][_0x1647('0x3b')](_0xa4b0b7,{'type':db[_0x1647('0x6b')][_0x1647('0x7b')][_0x1647('0x7c')],'raw':!![]})[_0x1647('0x1d')](function(_0x5e51a9){return _0x5e51a9;});})[_0x1647('0x1d')](function(_0x5c3dbd){if(_0x5c3dbd){_0x4024fc[_0x1647('0x23')][_0x1647('0x7d')]=_0x5c3dbd[0x0];if(!_0x51b4d1[_0x1647('0x55')][_0x1647('0x5e')])return;return db[_0x1647('0x7e')][_0x1647('0x53')]({'where':{'id':_0x51b4d1[_0x1647('0x55')][_0x1647('0x5e')],'role':'agent'},'attributes':['id','name',_0x1647('0x6c'),_0x1647('0x7f'),_0x1647('0x80')],'raw':!![]});}return null;})['then'](function(_0x4ead4c){if(!_0x4ead4c)return null;_0x4024fc[_0x1647('0x23')][_0x1647('0x60')]=_0x4ead4c;return _0x4024fc;})[_0x1647('0x1d')](function(_0x5adbda){if(_0x5adbda){_0x5adbda[_0x1647('0x23')]['interface']=util[_0x1647('0x5c')](_0x1647('0x81'),_0x51b4d1[_0x1647('0x5f')][_0x1647('0x4a')]);_0x5adbda[_0x1647('0x23')][_0x1647('0x6f')]=_0x4024fc[_0x1647('0x6f')];_0x5adbda[_0x1647('0x23')][_0x1647('0x70')]=_0x4024fc['channel'];_0x5adbda[_0x1647('0x23')][_0x1647('0x71')]=_0x1647('0x31');respondWithRpcPromise(_0x1647('0x72'),_0x1647('0x72'),{'event':'rejectmessage','message':_0x5adbda[_0x1647('0x23')]},client9002);return _0x4024fc;}return null;})[_0x1647('0x1d')](respondWithResult(_0x4e3bbb,null))['catch'](handleError(_0x4e3bbb,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 9a4232c..b94d8d2 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 _0x8cb2=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelMessage'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x8cb2,0x1a5));var _0x28cb=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8cb2[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0x28cb('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x28cb('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x28cb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x28cb('0x3'),'afterDestroy':_0x28cb('0x4')};function emitEvent(_0x369dca){return function(_0x510f96,_0x588118,_0x2f7b30){OpenchannelMessageEvents[_0x28cb('0x5')](_0x369dca+':'+_0x510f96['id'],_0x510f96);OpenchannelMessageEvents[_0x28cb('0x5')](_0x369dca,_0x510f96);_0x2f7b30(null);};}for(var e in events){if(events[_0x28cb('0x6')](e)){var event=events[e];OpenchannelMessage[_0x28cb('0x7')](e,emitEvent(event));}}module[_0x28cb('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x1e13=['remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x15fc0d,_0x39ad79){var _0x6ab1eb=function(_0x44b1cb){while(--_0x44b1cb){_0x15fc0d['push'](_0x15fc0d['shift']());}};_0x6ab1eb(++_0x39ad79);}(_0x1e13,0x198));var _0x31e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1e13[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x31e1('0x0'));var OpenchannelMessage=require(_0x31e1('0x1'))['db'][_0x31e1('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x31e1('0x3')](0x0);var events={'afterCreate':_0x31e1('0x4'),'afterUpdate':_0x31e1('0x5'),'afterDestroy':_0x31e1('0x6')};function emitEvent(_0x364813){return function(_0xa6b239,_0x5131d5,_0x35f7e8){OpenchannelMessageEvents[_0x31e1('0x7')](_0x364813+':'+_0xa6b239['id'],_0xa6b239);OpenchannelMessageEvents['emit'](_0x364813,_0xa6b239);_0x35f7e8(null);};}for(var e in events){if(events[_0x31e1('0x8')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 91b33e3..051a848 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 _0x2753=['replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','Interaction','omit','POST','method','GET','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteractionId','Contact'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2753,0xe4));var _0x3275=function(_0x524d5e,_0x269f75){_0x524d5e=_0x524d5e-0x0;var _0x3a1eca=_0x2753[_0x524d5e];return _0x3a1eca;};'use strict';var _=require(_0x3275('0x0'));var util=require(_0x3275('0x1'));var logger=require(_0x3275('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3275('0x3'));var rp=require(_0x3275('0x4'));var fs=require('fs');var path=require(_0x3275('0x5'));var rimraf=require(_0x3275('0x6'));var config=require(_0x3275('0x7'));var attributes=require(_0x3275('0x8'));module[_0x3275('0x9')]=function(_0x385ba4,_0x35b38c){return _0x385ba4[_0x3275('0xa')](_0x3275('0xb'),attributes,{'tableName':_0x3275('0xc'),'paranoid':![],'indexes':[{'name':_0x3275('0xd'),'fields':[_0x3275('0xe')],'type':_0x3275('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56b8ac,_0x295752,_0x4e381b){var _0x21844b=_0x385ba4[_0x3275('0x10')];var _0x294f58=_0x56b8ac[_0x3275('0x11')]({'plain':!![]});if(_0x294f58['direction'][_0x3275('0x12')]()==='in'||_0x294f58[_0x3275('0x13')][_0x3275('0x12')]()===_0x3275('0x14')&&!_0x294f58[_0x3275('0x15')]&&!_[_0x3275('0x16')](_0x294f58[_0x3275('0x17')])){_0x21844b[_0x3275('0x18')][_0x3275('0x19')]({'where':{'id':_0x294f58['OpenchannelInteractionId']}})['then'](function(_0x566768){if(_0x566768){_0x566768[_0x3275('0x1a')]({'lastMsgAt':_0x294f58[_0x3275('0x1b')],'lastMsgDirection':_0x294f58[_0x3275('0x13')]['toLowerCase']()});}})[_0x3275('0x1c')](function(_0x19aeb6){console[_0x3275('0x1d')](_0x19aeb6);});}if(_0x294f58['direction']===_0x3275('0x14')&&!_0x294f58[_0x3275('0x15')]){var _0x2dff6f;_0x21844b[_0x3275('0x1e')][_0x3275('0x1f')]()[_0x3275('0x20')](function(_0x3927e0){return _0x21844b[_0x3275('0x21')]['find']({'where':{'id':_0x294f58[_0x3275('0x22')]},'include':[{'model':_0x21844b['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x294f58[_0x3275('0x23')]},'limit':0x1,'include':[{'model':_0x21844b[_0x3275('0x1e')],'as':_0x3275('0x24'),'attributes':_['keys'](_0x3927e0)}]}]});})[_0x3275('0x20')](function(_0x562ad4){_0x2dff6f=_0x562ad4[_0x3275('0x11')]({'plain':!![]});if(_0x2dff6f&&_0x2dff6f[_0x3275('0x25')]){logger[_0x3275('0x26')](_0x3275('0x27'),_0x3275('0x28'),util['format'](_0x3275('0x29'),_0x294f58['id'],_0x2dff6f['replyUri']));if(_0x2dff6f[_0x3275('0x2a')]&&_0x2dff6f[_0x3275('0x2a')]['length']){_0x294f58[_0x3275('0x2b')]=_[_0x3275('0x2c')](_0x2dff6f['Interactions'][0x0],_0x3275('0x24'));_0x294f58[_0x3275('0x24')]=_0x2dff6f['Interactions'][0x0][_0x3275('0x24')];}var _0x295752={'method':_0x3275('0x2d'),'uri':encodeURI(_0x2dff6f[_0x3275('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x295752[_0x3275('0x2e')]){case _0x3275('0x2f'):_0x295752['qs']=_0x294f58;break;case _0x3275('0x2d'):_0x295752['body']=_0x294f58;break;}return rp(_0x295752)['then'](function(_0x3109ed){logger['info'](_0x3275('0x27'),_0x3275('0x28'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x294f58['id'],_0x2dff6f[_0x3275('0x25')]));if(_0x3109ed['body'][_0x3275('0x30')]&&_0x3109ed[_0x3275('0xe')]['threadId']!=_0x294f58['Interaction'][_0x3275('0x30')]){return _0x21844b[_0x3275('0x18')]['update']({'threadId':_0x3109ed[_0x3275('0xe')][_0x3275('0x30')]},{'where':{'id':_0x294f58['Interaction']['id']}});}else{return;}})[_0x3275('0x20')](function(){return _0x56b8ac[_0x3275('0x1a')]({'read':!![]});})['catch'](function(_0x1557ac){logger[_0x3275('0x1d')](_0x3275('0x27'),_0x3275('0x28'),util[_0x3275('0x31')](_0x1557ac,{'showHidden':![],'depth':null}));_0x4e381b();});}else{_0x4e381b();}})[_0x3275('0x32')](function(){_0x4e381b();});}else{_0x4e381b();}}},'charset':_0x3275('0x33'),'collate':_0x3275('0x34')});}; \ No newline at end of file +var _0x271b=['openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','OpenchannelInteraction','update','createdAt','catch','error','CmContact','describe','then','find','Interactions','Contact','keys','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','threadId','inspect','finally','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage'];(function(_0x2ff24c,_0x23b786){var _0xbcafd3=function(_0x4cd29f){while(--_0x4cd29f){_0x2ff24c['push'](_0x2ff24c['shift']());}};_0xbcafd3(++_0x23b786);}(_0x271b,0x13e));var _0xb271=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x271b[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xb271('0x0'));var util=require(_0xb271('0x1'));var logger=require(_0xb271('0x2'))(_0xb271('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb271('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb271('0x5'));var config=require(_0xb271('0x6'));var attributes=require(_0xb271('0x7'));module[_0xb271('0x8')]=function(_0x15b5b4,_0x4158a9){return _0x15b5b4[_0xb271('0x9')](_0xb271('0xa'),attributes,{'tableName':_0xb271('0xb'),'paranoid':![],'indexes':[{'name':_0xb271('0xc'),'fields':[_0xb271('0xd')],'type':_0xb271('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1cbcc8,_0x2e4092,_0x2321d6){var _0x5dfc14=_0x15b5b4[_0xb271('0xf')];var _0x54a462=_0x1cbcc8[_0xb271('0x10')]({'plain':!![]});if(_0x54a462[_0xb271('0x11')][_0xb271('0x12')]()==='in'||_0x54a462[_0xb271('0x11')][_0xb271('0x12')]()===_0xb271('0x13')&&!_0x54a462[_0xb271('0x14')]&&!_['isNil'](_0x54a462['UserId'])){_0x5dfc14[_0xb271('0x15')]['findOne']({'where':{'id':_0x54a462['OpenchannelInteractionId']}})['then'](function(_0x2fe4e9){if(_0x2fe4e9){_0x2fe4e9[_0xb271('0x16')]({'lastMsgAt':_0x54a462[_0xb271('0x17')],'lastMsgDirection':_0x54a462['direction'][_0xb271('0x12')]()});}})[_0xb271('0x18')](function(_0x20fd6d){console[_0xb271('0x19')](_0x20fd6d);});}if(_0x54a462[_0xb271('0x11')]===_0xb271('0x13')&&!_0x54a462[_0xb271('0x14')]){var _0x534b18;_0x5dfc14[_0xb271('0x1a')][_0xb271('0x1b')]()[_0xb271('0x1c')](function(_0x2b94e3){return _0x5dfc14['OpenchannelAccount'][_0xb271('0x1d')]({'where':{'id':_0x54a462['OpenchannelAccountId']},'include':[{'model':_0x5dfc14[_0xb271('0x15')],'as':_0xb271('0x1e'),'where':{'id':_0x54a462['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x5dfc14[_0xb271('0x1a')],'as':_0xb271('0x1f'),'attributes':_[_0xb271('0x20')](_0x2b94e3)}]}]});})[_0xb271('0x1c')](function(_0x1979be){_0x534b18=_0x1979be['get']({'plain':!![]});if(_0x534b18&&_0x534b18['replyUri']){logger[_0xb271('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0xb271('0x22'),util[_0xb271('0x23')](_0xb271('0x24'),_0x54a462['id'],_0x534b18[_0xb271('0x25')]));if(_0x534b18['Interactions']&&_0x534b18['Interactions'][_0xb271('0x26')]){_0x54a462[_0xb271('0x27')]=_['omit'](_0x534b18[_0xb271('0x1e')][0x0],_0xb271('0x1f'));_0x54a462['Contact']=_0x534b18[_0xb271('0x1e')][0x0][_0xb271('0x1f')];}var _0x2e4092={'method':_0xb271('0x28'),'uri':encodeURI(_0x534b18[_0xb271('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2e4092[_0xb271('0x29')]){case _0xb271('0x2a'):_0x2e4092['qs']=_0x54a462;break;case'POST':_0x2e4092['body']=_0x54a462;break;}return rp(_0x2e4092)[_0xb271('0x1c')](function(_0xed8f5a){logger[_0xb271('0x21')](_0xb271('0x2b'),_0xb271('0x22'),util[_0xb271('0x23')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x54a462['id'],_0x534b18[_0xb271('0x25')]));if(_0xed8f5a['body'][_0xb271('0x2c')]&&_0xed8f5a[_0xb271('0xd')][_0xb271('0x2c')]!=_0x54a462[_0xb271('0x27')]['threadId']){return _0x5dfc14['OpenchannelInteraction'][_0xb271('0x16')]({'threadId':_0xed8f5a[_0xb271('0xd')]['threadId']},{'where':{'id':_0x54a462[_0xb271('0x27')]['id']}});}else{return;}})[_0xb271('0x1c')](function(){return _0x1cbcc8['update']({'read':!![]});})[_0xb271('0x18')](function(_0x31fa09){logger[_0xb271('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0xb271('0x22'),util[_0xb271('0x2d')](_0x31fa09,{'showHidden':![],'depth':null}));_0x2321d6();});}else{_0x2321d6();}})[_0xb271('0x2e')](function(){_0x2321d6();});}else{_0x2321d6();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 8fa5452..be31584 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 _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1c3309,_0x1d5971){var _0x2626c4=function(_0x2b9bbf){while(--_0x2b9bbf){_0x1c3309['push'](_0x1c3309['shift']());}};_0x2626c4(++_0x1d5971);}(_0x5f2f,0x73));var _0xf5f2=function(_0x528330,_0x3d47ac){_0x528330=_0x528330-0x0;var _0x1cbb2c=_0x5f2f[_0x528330];return _0x1cbb2c;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +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(_0x1b668f,_0x27c1a2){var _0x12bbf4=function(_0x2cbd7c){while(--_0x2cbd7c){_0x1b668f['push'](_0x1b668f['shift']());}};_0x12bbf4(++_0x27c1a2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x17dcd1,_0x3b7ccb){_0x17dcd1=_0x17dcd1-0x0;var _0x12af77=_0x0b0e[_0x17dcd1];return _0x12af77;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 35ca6da..8a34402 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 _0xffde=['remove','update','emit','removeListener','register','length','openchannelMessage:','save'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xffde,0x9f));var _0xeffd=function(_0x130de7,_0x1d6e80){_0x130de7=_0x130de7-0x0;var _0x4bc1d4=_0xffde[_0x130de7];return _0x4bc1d4;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xeffd('0x0'),_0xeffd('0x1'),_0xeffd('0x2')];function createListener(_0xf55bb2,_0xd1aa96){return function(_0x2f83e0){_0xd1aa96[_0xeffd('0x3')](_0xf55bb2,_0x2f83e0);};}function removeListener(_0x2c23ce,_0x49ded4){return function(){OpenchannelMessageEvents[_0xeffd('0x4')](_0x2c23ce,_0x49ded4);};}exports[_0xeffd('0x5')]=function(_0x24216c){for(var _0x111b43=0x0,_0x3544c3=events[_0xeffd('0x6')];_0x111b43<_0x3544c3;_0x111b43++){var _0x4c0086=events[_0x111b43];var _0x5a25ba=createListener(_0xeffd('0x7')+_0x4c0086,_0x24216c);OpenchannelMessageEvents['on'](_0x4c0086,_0x5a25ba);}}; \ No newline at end of file +var _0xd07e=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x147d34,_0x38a3bd){var _0x10fa67=function(_0x383244){while(--_0x383244){_0x147d34['push'](_0x147d34['shift']());}};_0x10fa67(++_0x38a3bd);}(_0xd07e,0x10a));var _0xed07=function(_0x552453,_0x21f751){_0x552453=_0x552453-0x0;var _0x4edfb7=_0xd07e[_0x552453];return _0x4edfb7;};'use strict';var OpenchannelMessageEvents=require(_0xed07('0x0'));var events=[_0xed07('0x1'),_0xed07('0x2'),_0xed07('0x3')];function createListener(_0x4433aa,_0x455c3a){return function(_0x12b552){_0x455c3a[_0xed07('0x4')](_0x4433aa,_0x12b552);};}function removeListener(_0x2ba301,_0x56697a){return function(){OpenchannelMessageEvents[_0xed07('0x5')](_0x2ba301,_0x56697a);};}exports[_0xed07('0x6')]=function(_0x3c1eec){for(var _0xde23f9=0x0,_0x2ecc98=events[_0xed07('0x7')];_0xde23f9<_0x2ecc98;_0xde23f9++){var _0x20c0b9=events[_0xde23f9];var _0x5cca8d=createListener(_0xed07('0x8')+_0x20c0b9,_0x3c1eec);OpenchannelMessageEvents['on'](_0x20c0b9,_0x5cca8d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 8715921..ea43a01 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 _0x2ba9=['../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','connect-timeout','express','fs-extra'];(function(_0x2b17a0,_0x51e228){var _0x55904b=function(_0x4422f3){while(--_0x4422f3){_0x2b17a0['push'](_0x2b17a0['shift']());}};_0x55904b(++_0x51e228);}(_0x2ba9,0xdb));var _0x92ba=function(_0xa3368f,_0x18cd13){_0xa3368f=_0xa3368f-0x0;var _0x90c54e=_0x2ba9[_0xa3368f];return _0x90c54e;};'use strict';var multer=require(_0x92ba('0x0'));var util=require(_0x92ba('0x1'));var path=require('path');var timeout=require(_0x92ba('0x2'));var express=require(_0x92ba('0x3'));var router=express['Router']();var fs_extra=require(_0x92ba('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x92ba('0x5'));var config=require(_0x92ba('0x6'));var controller=require(_0x92ba('0x7'));router[_0x92ba('0x8')]('/',auth[_0x92ba('0x9')](),controller[_0x92ba('0xa')]);router[_0x92ba('0x8')](_0x92ba('0xb'),auth['isAuthenticated'](),controller[_0x92ba('0xc')]);router[_0x92ba('0x8')](_0x92ba('0xd'),auth[_0x92ba('0x9')](),controller['show']);router[_0x92ba('0x8')](_0x92ba('0xe'),auth[_0x92ba('0x9')](),controller[_0x92ba('0xf')]);router['get'](_0x92ba('0x10'),auth[_0x92ba('0x9')](),controller[_0x92ba('0x11')]);router[_0x92ba('0x8')]('/:id/users',auth[_0x92ba('0x9')](),controller[_0x92ba('0x12')]);router[_0x92ba('0x13')]('/',auth[_0x92ba('0x9')](),controller[_0x92ba('0x14')]);router[_0x92ba('0x13')](_0x92ba('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x92ba('0x13')](_0x92ba('0x15'),auth[_0x92ba('0x9')](),controller[_0x92ba('0x16')]);router[_0x92ba('0x17')](_0x92ba('0xd'),auth[_0x92ba('0x9')](),controller[_0x92ba('0x18')]);router['delete'](_0x92ba('0xd'),auth[_0x92ba('0x9')](),controller['destroy']);router[_0x92ba('0x19')](_0x92ba('0x10'),auth[_0x92ba('0x9')](),controller[_0x92ba('0x1a')]);router[_0x92ba('0x19')](_0x92ba('0x15'),auth[_0x92ba('0x9')](),controller[_0x92ba('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x50d1=['../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','post','create','addTeams','/:id/users','update','destroy','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x575fc5,_0x190de6){var _0x6829e2=function(_0x57b1ac){while(--_0x57b1ac){_0x575fc5['push'](_0x575fc5['shift']());}};_0x6829e2(++_0x190de6);}(_0x50d1,0x173));var _0x150d=function(_0x39b1e6,_0x5ef555){_0x39b1e6=_0x39b1e6-0x0;var _0x45c644=_0x50d1[_0x39b1e6];return _0x45c644;};'use strict';var multer=require(_0x150d('0x0'));var util=require('util');var path=require(_0x150d('0x1'));var timeout=require(_0x150d('0x2'));var express=require(_0x150d('0x3'));var router=express[_0x150d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x150d('0x5'));var interaction=require(_0x150d('0x6'));var config=require(_0x150d('0x7'));var controller=require(_0x150d('0x8'));router[_0x150d('0x9')]('/',auth[_0x150d('0xa')](),controller[_0x150d('0xb')]);router[_0x150d('0x9')](_0x150d('0xc'),auth[_0x150d('0xa')](),controller[_0x150d('0xd')]);router[_0x150d('0x9')](_0x150d('0xe'),auth[_0x150d('0xa')](),controller[_0x150d('0xf')]);router[_0x150d('0x9')](_0x150d('0x10'),auth[_0x150d('0xa')](),controller['getMembers']);router['get'](_0x150d('0x11'),auth[_0x150d('0xa')](),controller[_0x150d('0x12')]);router[_0x150d('0x9')]('/:id/users',auth[_0x150d('0xa')](),controller['getAgents']);router[_0x150d('0x13')]('/',auth[_0x150d('0xa')](),controller[_0x150d('0x14')]);router[_0x150d('0x13')](_0x150d('0x11'),auth['isAuthenticated'](),controller[_0x150d('0x15')]);router[_0x150d('0x13')](_0x150d('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x150d('0xa')](),controller[_0x150d('0x17')]);router['delete']('/:id',auth[_0x150d('0xa')](),controller[_0x150d('0x18')]);router[_0x150d('0x19')](_0x150d('0x11'),auth[_0x150d('0xa')](),controller[_0x150d('0x1a')]);router['delete'](_0x150d('0x16'),auth['isAuthenticated'](),controller[_0x150d('0x1b')]);module[_0x150d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index a38a17a..2bcaca2 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 _0xaf9e=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0xe1441d,_0x36fb8e){var _0x2ef242=function(_0x52bf2d){while(--_0x52bf2d){_0xe1441d['push'](_0xe1441d['shift']());}};_0x2ef242(++_0x36fb8e);}(_0xaf9e,0x1e9));var _0xeaf9=function(_0x3f1e64,_0x2cc75f){_0x3f1e64=_0x3f1e64-0x0;var _0x1fbeac=_0xaf9e[_0x3f1e64];return _0x1fbeac;};'use strict';var Sequelize=require(_0xeaf9('0x0'));module[_0xeaf9('0x1')]={'name':{'type':Sequelize[_0xeaf9('0x2')],'unique':_0xeaf9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeaf9('0x2')]},'timeout':{'type':Sequelize[_0xeaf9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeaf9('0x5')](_0xeaf9('0x6'),_0xeaf9('0x7'),_0xeaf9('0x8'))}}; \ No newline at end of file +var _0x8162=['rrmemory','roundrobin','exports','STRING','name','ENUM'];(function(_0x20cf5f,_0x1eaf58){var _0x27f0fd=function(_0x406168){while(--_0x406168){_0x20cf5f['push'](_0x20cf5f['shift']());}};_0x27f0fd(++_0x1eaf58);}(_0x8162,0x140));var _0x2816=function(_0x3e4db1,_0x385cd6){_0x3e4db1=_0x3e4db1-0x0;var _0x33ecd5=_0x8162[_0x3e4db1];return _0x33ecd5;};'use strict';var Sequelize=require('sequelize');module[_0x2816('0x0')]={'name':{'type':Sequelize[_0x2816('0x1')],'unique':_0x2816('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2816('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2816('0x3')](_0x2816('0x4'),'beepall',_0x2816('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 3c60214..098d1a2 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 _0x501b=['../../config/environment','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','destroy','get','error','stack','name','send','type','key','where','OpenchannelQueue','include','query','findAll','rows','catch','show','params','model','keys','intersection','attributes','fields','includeAll','merge','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','rawAttributes','filters','length','nolimit','order','sort','pick','filter','map','UserOpenchannelQueue','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','updatedAt','findOne','Team','getTeams','hasOwnProperty','addTeams','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','isEmpty','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','options','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x347541,_0x137cf){var _0x5c0e38=function(_0x32a276){while(--_0x32a276){_0x347541['push'](_0x347541['shift']());}};_0x5c0e38(++_0x137cf);}(_0x501b,0x1dd));var _0xb501=function(_0x17d2f7,_0x356e72){_0x17d2f7=_0x17d2f7-0x0;var _0x125bf9=_0x501b[_0x17d2f7];return _0x125bf9;};'use strict';var BPromise=require(_0xb501('0x0'));var util=require(_0xb501('0x1'));var _=require(_0xb501('0x2'));var squel=require(_0xb501('0x3'));var Redis=require(_0xb501('0x4'));var qs=require(_0xb501('0x5'));var logger=require(_0xb501('0x6'))('api');var config=require(_0xb501('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb501('0x8'),'port':0x18eb});var socket=require(_0xb501('0x9'))(new Redis(config[_0xb501('0xa')]));require(_0xb501('0xb'))[_0xb501('0xc')](socket);function respondWithStatusCode(_0x5954fe,_0x5b9d69){_0x5b9d69=_0x5b9d69||0xcc;return function(_0x568703){if(_0x568703){return _0x5954fe[_0xb501('0xd')](_0x5b9d69);}return _0x5954fe[_0xb501('0xe')](_0x5b9d69)[_0xb501('0xf')]();};}function respondWithResult(_0x58e64d,_0x5a9fa9){_0x5a9fa9=_0x5a9fa9||0xc8;return function(_0x1bf419){if(_0x1bf419){return _0x58e64d[_0xb501('0xe')](_0x5a9fa9)[_0xb501('0x10')](_0x1bf419);}};}function respondWithFilteredResult(_0x2d7192,_0x4cbb8){return function(_0x289ed3){if(_0x289ed3){var _0x52eb00=typeof _0x4cbb8[_0xb501('0x11')]==='undefined'&&typeof _0x4cbb8[_0xb501('0x12')]==='undefined';var _0x3a514b=_0x289ed3[_0xb501('0x13')];var _0x5d3913=_0x52eb00?0x0:_0x4cbb8[_0xb501('0x11')];var _0x3e75d1=_0x52eb00?_0x289ed3[_0xb501('0x13')]:_0x4cbb8[_0xb501('0x11')]+_0x4cbb8['limit'];var _0x31632d;if(_0x3e75d1>=_0x3a514b){_0x3e75d1=_0x3a514b;_0x31632d=0xc8;}else{_0x31632d=0xce;}_0x2d7192[_0xb501('0xe')](_0x31632d);return _0x2d7192[_0xb501('0x14')](_0xb501('0x15'),_0x5d3913+'-'+_0x3e75d1+'/'+_0x3a514b)['json'](_0x289ed3);}return null;};}function saveUpdates(_0x31b005){return function(_0x46d2e0){if(_0x46d2e0){return _0x46d2e0[_0xb501('0x16')](_0x31b005)[_0xb501('0x17')](function(_0x3cca51){return _0x3cca51;});}return null;};}function removeEntity(_0xd4816c){return function(_0x16af99){if(_0x16af99){return _0x16af99[_0xb501('0x18')]()[_0xb501('0x17')](function(){var _0xaa85cf=_0x16af99[_0xb501('0x19')]({'plain':!![]});var _0x19983d='OpenchannelQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x19983d,'resourceId':_0xaa85cf['id']}})[_0xb501('0x17')](function(){return _0x16af99;});})[_0xb501('0x17')](function(){_0xd4816c[_0xb501('0xe')](0xcc)[_0xb501('0xf')]();});}};}function handleEntityNotFound(_0x560de4){return function(_0x2eafc1){if(!_0x2eafc1){_0x560de4[_0xb501('0xd')](0x194);}return _0x2eafc1;};}function handleError(_0x2f0e99,_0x1c16d0){_0x1c16d0=_0x1c16d0||0x1f4;return function(_0x54d22f){logger[_0xb501('0x1a')](_0x54d22f[_0xb501('0x1b')]);if(_0x54d22f[_0xb501('0x1c')]){delete _0x54d22f[_0xb501('0x1c')];}_0x2f0e99[_0xb501('0xe')](_0x1c16d0)[_0xb501('0x1d')](_0x54d22f);};}exports['index']=function(_0xaa4cae,_0x44abbd){var _0x576c05={};var _0x4db493={'count':0x0,'rows':[]};var _0xf49b3f=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x526432){return{'name':_0x526432['fieldName'],'type':_0x526432[_0xb501('0x1e')][_0xb501('0x1f')]};});_0x576c05=qs['getOptions'](_0xf49b3f,_0xaa4cae);var _0x20e877={'where':_0x576c05[_0xb501('0x20')]};return db[_0xb501('0x21')][_0xb501('0x13')](_0x20e877)[_0xb501('0x17')](function(_0x13726e){_0x4db493[_0xb501('0x13')]=_0x13726e;_0x576c05[_0xb501('0x22')]=qs[_0xb501('0x22')](_0xaa4cae[_0xb501('0x23')]);return db[_0xb501('0x21')][_0xb501('0x24')](_0x576c05);})['then'](function(_0x4c2fe2){_0x4db493[_0xb501('0x25')]=_0x4c2fe2;return _0x4db493;})[_0xb501('0x17')](respondWithFilteredResult(_0x44abbd,_0x576c05))[_0xb501('0x26')](handleError(_0x44abbd,null));};exports[_0xb501('0x27')]=function(_0x588147,_0x83dd1e){var _0x23649a={'raw':!![],'where':{'id':_0x588147[_0xb501('0x28')]['id']}},_0x201b1d={};_0x201b1d[_0xb501('0x29')]=_[_0xb501('0x2a')](db[_0xb501('0x21')]['rawAttributes']);_0x201b1d[_0xb501('0x23')]=_[_0xb501('0x2a')](_0x588147['query']);_0x201b1d['filters']=_[_0xb501('0x2b')](_0x201b1d[_0xb501('0x29')],_0x201b1d[_0xb501('0x23')]);_0x23649a[_0xb501('0x2c')]=_[_0xb501('0x2b')](_0x201b1d[_0xb501('0x29')],qs['fields'](_0x588147[_0xb501('0x23')][_0xb501('0x2d')]));_0x23649a[_0xb501('0x2c')]=_0x23649a['attributes']['length']?_0x23649a[_0xb501('0x2c')]:_0x201b1d[_0xb501('0x29')];if(_0x588147[_0xb501('0x23')][_0xb501('0x2e')]){_0x23649a['include']=[{'all':!![]}];}_0x23649a=_[_0xb501('0x2f')]({},_0x23649a,_0x588147['options']);return db[_0xb501('0x21')]['find'](_0x23649a)[_0xb501('0x17')](handleEntityNotFound(_0x83dd1e,null))['then'](respondWithResult(_0x83dd1e,null))['catch'](handleError(_0x83dd1e,null));};exports['create']=function(_0x443791,_0x56fb4e){return db['OpenchannelQueue']['create'](_0x443791[_0xb501('0x30')],{})[_0xb501('0x17')](function(_0x2b8cda){var _0x3707bc=_0x443791[_0xb501('0x31')][_0xb501('0x19')]({'plain':!![]});if(!_0x3707bc)throw new Error(_0xb501('0x32'));if(_0x3707bc[_0xb501('0x33')]===_0xb501('0x31')){var _0x29e02c=_0x2b8cda[_0xb501('0x19')]({'plain':!![]});var _0x4f4e8f=_0xb501('0x34');return db[_0xb501('0x35')][_0xb501('0x36')]({'where':{'name':_0x4f4e8f,'userProfileId':_0x3707bc[_0xb501('0x37')]},'raw':!![]})['then'](function(_0x247a07){if(_0x247a07&&_0x247a07['autoAssociation']===0x0){return db[_0xb501('0x38')]['create']({'name':_0x29e02c[_0xb501('0x1c')],'resourceId':_0x29e02c['id'],'type':_0x247a07[_0xb501('0x1c')],'sectionId':_0x247a07['id']},{})['then'](function(){return _0x2b8cda;});}else{return _0x2b8cda;}})[_0xb501('0x26')](function(_0x206681){logger['error'](_0xb501('0x39'),_0x206681);throw _0x206681;});}return _0x2b8cda;})['then'](respondWithResult(_0x56fb4e,0xc9))[_0xb501('0x26')](handleError(_0x56fb4e,null));};exports['update']=function(_0x424f6c,_0x2de663){if(_0x424f6c['body']['id']){delete _0x424f6c['body']['id'];}return db['OpenchannelQueue'][_0xb501('0x36')]({'where':{'id':_0x424f6c[_0xb501('0x28')]['id']}})[_0xb501('0x17')](handleEntityNotFound(_0x2de663,null))['then'](saveUpdates(_0x424f6c['body'],null))['then'](respondWithResult(_0x2de663,null))['catch'](handleError(_0x2de663,null));};exports['destroy']=function(_0x2b222f,_0x386c91){return db[_0xb501('0x21')][_0xb501('0x36')]({'where':{'id':_0x2b222f[_0xb501('0x28')]['id']}})[_0xb501('0x17')](handleEntityNotFound(_0x386c91,null))['then'](removeEntity(_0x386c91,null))[_0xb501('0x26')](handleError(_0x386c91,null));};exports[_0xb501('0x3a')]=function(_0x53e96c,_0x470bde){return db['OpenchannelQueue'][_0xb501('0x3a')]()[_0xb501('0x17')](respondWithResult(_0x470bde,null))[_0xb501('0x26')](handleError(_0x470bde,null));};exports[_0xb501('0x3b')]=function(_0x3b61e8,_0x59ee95){var _0x65703c={'raw':!![],'where':{}},_0x20a8e5={},_0x12517c;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x3b61e8[_0xb501('0x28')]['id']}})[_0xb501('0x17')](handleEntityNotFound(_0x59ee95,null))[_0xb501('0x17')](function(_0x37456a){if(_0x37456a){_0x12517c=_0x37456a[_0xb501('0x19')]({'plain':!![]});_0x20a8e5[_0xb501('0x29')]=_[_0xb501('0x2a')](db['UserOpenchannelQueue'][_0xb501('0x3c')]);_0x20a8e5[_0xb501('0x23')]=_[_0xb501('0x2a')](_0x3b61e8['query']);_0x20a8e5[_0xb501('0x3d')]=_[_0xb501('0x2b')](_0x20a8e5[_0xb501('0x29')],_0x20a8e5[_0xb501('0x23')]);_0x65703c[_0xb501('0x2c')]=_[_0xb501('0x2b')](_0x20a8e5['model'],qs[_0xb501('0x2d')](_0x3b61e8['query'][_0xb501('0x2d')]));_0x65703c[_0xb501('0x2c')]=_0x65703c[_0xb501('0x2c')][_0xb501('0x3e')]?_0x65703c[_0xb501('0x2c')]:_0x20a8e5[_0xb501('0x29')];if(!_0x3b61e8[_0xb501('0x23')]['hasOwnProperty'](_0xb501('0x3f'))){_0x65703c[_0xb501('0x12')]=qs[_0xb501('0x12')](_0x3b61e8[_0xb501('0x23')][_0xb501('0x12')]);_0x65703c['offset']=qs[_0xb501('0x11')](_0x3b61e8[_0xb501('0x23')][_0xb501('0x11')]);}_0x65703c[_0xb501('0x40')]=qs[_0xb501('0x41')](_0x3b61e8[_0xb501('0x23')][_0xb501('0x41')]);_0x65703c['where']=qs[_0xb501('0x3d')](_[_0xb501('0x42')](_0x3b61e8[_0xb501('0x23')],_0x20a8e5['filters']));_0x65703c[_0xb501('0x20')]['OpenchannelQueueId']=_0x37456a['id'];if(_0x3b61e8[_0xb501('0x23')][_0xb501('0x43')]){_0x65703c['where']=_[_0xb501('0x2f')](_0x65703c['where'],{'$or':_[_0xb501('0x44')](_0x65703c[_0xb501('0x2c')],function(_0x5a48ee){var _0x21a33f={};_0x21a33f[_0x5a48ee]={'$like':'%'+_0x3b61e8['query'][_0xb501('0x43')]+'%'};return _0x21a33f;})});}_0x65703c=_[_0xb501('0x2f')]({},_0x65703c,_0x3b61e8['options']);return db[_0xb501('0x45')][_0xb501('0x24')](_0x65703c);}})[_0xb501('0x17')](function(_0x3f0ad0){if(_0x3f0ad0){return db['User'][_0xb501('0x46')]({'where':{'id':_[_0xb501('0x44')](_0x3f0ad0,_0xb501('0x47')),'role':_0xb501('0x48')},'attributes':['id','name',_0xb501('0x49'),'updatedAt',_0xb501('0x4a')]});}})['then'](function(_0x32bff7){if(_0x32bff7){return{'count':_0x32bff7[_0xb501('0x13')],'rows':_[_0xb501('0x44')](_0x32bff7['rows'],function(_0x14a7b8){return{'membername':_0x14a7b8[_0xb501('0x1c')],'UserId':_0x14a7b8['id'],'queue_name':_0x12517c['name'],'OpenchannelQueueId':_0x12517c['id'],'interface':util[_0xb501('0x4b')](_0xb501('0x4c'),'SIP',_0x14a7b8[_0xb501('0x1c')]),'penalty':0x0,'paused':_0x14a7b8[_0xb501('0x49')],'createdAt':_0x14a7b8[_0xb501('0x4a')],'updatedAt':_0x14a7b8[_0xb501('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb501('0x17')](respondWithFilteredResult(_0x59ee95,_0x65703c))['catch'](handleError(_0x59ee95,null));};exports['getTeams']=function(_0x346e62,_0x4a5295){var _0x517f2e={};var _0x39be2e={};var _0x24c132;var _0x556b29;return db[_0xb501('0x21')][_0xb501('0x4e')]({'where':{'id':_0x346e62[_0xb501('0x28')]['id']}})['then'](handleEntityNotFound(_0x4a5295,null))[_0xb501('0x17')](function(_0x5537ec){if(_0x5537ec){_0x24c132=_0x5537ec;_0x39be2e['model']=_[_0xb501('0x2a')](db[_0xb501('0x4f')]['rawAttributes']);_0x39be2e['query']=_[_0xb501('0x2a')](_0x346e62[_0xb501('0x23')]);_0x39be2e[_0xb501('0x3d')]=_[_0xb501('0x2b')](_0x39be2e[_0xb501('0x29')],_0x39be2e[_0xb501('0x23')]);_0x517f2e[_0xb501('0x2c')]=_[_0xb501('0x2b')](_0x39be2e[_0xb501('0x29')],qs[_0xb501('0x2d')](_0x346e62[_0xb501('0x23')][_0xb501('0x2d')]));_0x517f2e[_0xb501('0x2c')]=_0x517f2e[_0xb501('0x2c')][_0xb501('0x3e')]?_0x517f2e[_0xb501('0x2c')]:_0x39be2e[_0xb501('0x29')];_0x517f2e[_0xb501('0x40')]=qs[_0xb501('0x41')](_0x346e62[_0xb501('0x23')][_0xb501('0x41')]);_0x517f2e['where']=qs['filters'](_[_0xb501('0x42')](_0x346e62[_0xb501('0x23')],_0x39be2e[_0xb501('0x3d')]));if(_0x346e62[_0xb501('0x23')][_0xb501('0x43')]){_0x517f2e[_0xb501('0x20')]=_[_0xb501('0x2f')](_0x517f2e[_0xb501('0x20')],{'$or':_[_0xb501('0x44')](_0x517f2e['attributes'],function(_0x4366e2){var _0x19a72d={};_0x19a72d[_0x4366e2]={'$like':'%'+_0x346e62[_0xb501('0x23')][_0xb501('0x43')]+'%'};return _0x19a72d;})});}_0x517f2e=_[_0xb501('0x2f')]({},_0x517f2e,_0x346e62['options']);return _0x24c132[_0xb501('0x50')](_0x517f2e);}})[_0xb501('0x17')](function(_0x27ca35){if(_0x27ca35){_0x556b29=_0x27ca35[_0xb501('0x3e')];if(!_0x346e62[_0xb501('0x23')][_0xb501('0x51')](_0xb501('0x3f'))){_0x517f2e[_0xb501('0x12')]=qs[_0xb501('0x12')](_0x346e62['query'][_0xb501('0x12')]);_0x517f2e[_0xb501('0x11')]=qs['offset'](_0x346e62[_0xb501('0x23')][_0xb501('0x11')]);}return _0x24c132[_0xb501('0x50')](_0x517f2e);}})[_0xb501('0x17')](function(_0x5a3e87){if(_0x5a3e87){return _0x5a3e87?{'count':_0x556b29,'rows':_0x5a3e87}:null;}})[_0xb501('0x17')](respondWithResult(_0x4a5295,null))[_0xb501('0x26')](handleError(_0x4a5295,null));};exports[_0xb501('0x52')]=function(_0x5d3bd4,_0x241f7c){var _0x2cd941=_0x5d3bd4[_0xb501('0x30')]['ids'];return db[_0xb501('0x4f')][_0xb501('0x24')]({'where':{'id':_0x2cd941},'attributes':['id'],'include':[{'model':db[_0xb501('0x53')],'as':'Agents','attributes':['id',_0xb501('0x1c'),_0xb501('0x54'),_0xb501('0x55'),_0xb501('0x56')],'raw':!![]}]})[_0xb501('0x17')](function(_0x44822d){if(_0x44822d){var _0x1e8822=_[_0xb501('0x57')](_0x44822d,function(_0x427ab1){var _0x372860=_0x427ab1[_0xb501('0x19')]({'plain':!![]});return _0x372860[_0xb501('0x58')];});return db['OpenchannelQueue'][_0xb501('0x36')]({'where':{'id':_0x5d3bd4[_0xb501('0x28')]['id']}})[_0xb501('0x17')](function(_0x525852){return db[_0xb501('0x59')][_0xb501('0x5a')](function(_0x4f6b0d){return _0x525852['addTeams'](_0x2cd941,{'transaction':_0x4f6b0d})['then'](function(){return BPromise[_0xb501('0x5b')](_0x1e8822,function(_0x20b402){return db[_0xb501('0x45')]['findOrCreate']({'where':{'UserId':_0x20b402['id'],'OpenchannelQueueId':_0x5d3bd4[_0xb501('0x28')]['id']},'transaction':_0x4f6b0d});});})[_0xb501('0x17')](function(){_0x1e8822[_0xb501('0x5c')](function(_0x427c7a){socket[_0xb501('0x5d')](_0xb501('0x5e'),{'UserId':_0x427c7a['id'],'OpenchannelQueueId':_0x525852['id']});});});});});}})['then'](respondWithStatusCode(_0x241f7c,null))['catch'](handleError(_0x241f7c,null));};exports[_0xb501('0x5f')]=function(_0x32ea8a,_0x8773c7){return db[_0xb501('0x4f')][_0xb501('0x24')]({'where':{'id':_0x32ea8a[_0xb501('0x23')][_0xb501('0x60')]},'attributes':['id'],'include':[{'model':db[_0xb501('0x53')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x8773c7,null))[_0xb501('0x17')](function(_0x4cb667){var _0x3f4fe8=_[_0xb501('0x44')](_0x4cb667,'id');var _0x4b14f3=[];var _0x265ed5=[];var _0x307650=squel['select']();_0x307650[_0xb501('0x61')]('tq.TeamId')[_0xb501('0x62')]('team_has_openchannel_queues','tq')[_0xb501('0x63')](_0xb501('0x64'),'ut',_0xb501('0x65'))[_0xb501('0x20')](_0xb501('0x66'),_0x32ea8a[_0xb501('0x28')]['id']);for(var _0x3f7694=0x0;_0x3f7694<_0x4cb667[_0xb501('0x3e')];_0x3f7694+=0x1){let _0x132894=_0x4cb667[_0x3f7694];for(var _0xa84e6a=0x0;_0xa84e6a<_0x132894['Agents']['length'];_0xa84e6a+=0x1){let _0xecfa16=_0x132894[_0xb501('0x58')][_0xa84e6a];var _0x1110d0=_0x307650['clone']();_0x1110d0[_0xb501('0x20')](_0xb501('0x67'),_0xecfa16['id']);_0x265ed5[_0xb501('0x68')](db['sequelize'][_0xb501('0x23')](_0x1110d0[_0xb501('0x69')](),{'type':db[_0xb501('0x59')]['QueryTypes'][_0xb501('0x6a')]})[_0xb501('0x17')](function(_0x2b7182){if(_0x2b7182['length']===0x1){return _0xecfa16['id'];}else{var _0x58d240=_[_0xb501('0x6b')](_[_0xb501('0x44')](_0x2b7182,_0xb501('0x6c')),function(_0x311af3){return _[_0xb501('0x6d')](_0x3f4fe8,_0x311af3);});if(_0x58d240){return _0xecfa16['id'];}}}));}}return BPromise[_0xb501('0x6e')](_0x265ed5)['then'](function(_0x39c81c){_0x4b14f3=_(_0x4b14f3)['union'](_0x39c81c)[_0xb501('0x6f')]()['value']();return db[_0xb501('0x21')]['find']({'where':{'id':_0x32ea8a['params']['id']}})[_0xb501('0x17')](function(_0x497be6){return db[_0xb501('0x59')][_0xb501('0x5a')](function(_0xb8fc2){return _0x497be6[_0xb501('0x5f')](_0x32ea8a[_0xb501('0x23')][_0xb501('0x60')],{'transaction':_0xb8fc2})[_0xb501('0x17')](function(){if(!_[_0xb501('0x70')](_0x4b14f3)){return _0x497be6[_0xb501('0x71')](_0x4b14f3,{'transaction':_0xb8fc2});}})[_0xb501('0x17')](function(){_0x4b14f3['forEach'](function(_0x2dd44b){socket[_0xb501('0x5d')]('userOpenchannelQueue:remove',{'UserId':_0x2dd44b,'OpenchannelQueueId':_0x497be6['id']});});});});});});})[_0xb501('0x17')](respondWithStatusCode(_0x8773c7,null))[_0xb501('0x26')](handleError(_0x8773c7,null));};exports['addAgents']=function(_0x590622,_0x1ea814){return db[_0xb501('0x21')][_0xb501('0x36')]({'where':{'id':_0x590622[_0xb501('0x28')]['id']}})[_0xb501('0x17')](handleEntityNotFound(_0x1ea814,null))[_0xb501('0x17')](function(_0x2df026){if(_0x2df026){return _0x2df026[_0xb501('0x72')](_0x590622['body']['ids'],_[_0xb501('0x73')](_0x590622[_0xb501('0x30')],[_0xb501('0x60'),'id'])||{})[_0xb501('0x74')](function(_0x14227f){for(var _0x46c0ca=0x0;_0x46c0ca<_0x590622[_0xb501('0x30')][_0xb501('0x60')][_0xb501('0x3e')];_0x46c0ca+=0x1){socket[_0xb501('0x5d')](_0xb501('0x5e'),{'UserId':Number(_0x590622[_0xb501('0x30')][_0xb501('0x60')][_0x46c0ca]),'OpenchannelQueueId':Number(_0x590622[_0xb501('0x28')]['id'])});}return _0x14227f;});}})[_0xb501('0x17')](respondWithResult(_0x1ea814,null))[_0xb501('0x26')](handleError(_0x1ea814,null));};exports[_0xb501('0x71')]=function(_0x4e6f95,_0x273a06){return db[_0xb501('0x21')][_0xb501('0x36')]({'where':{'id':_0x4e6f95[_0xb501('0x28')]['id']}})['then'](handleEntityNotFound(_0x273a06,null))[_0xb501('0x17')](function(_0x2a2875){if(_0x2a2875){return _0x2a2875[_0xb501('0x71')](_0x4e6f95[_0xb501('0x23')][_0xb501('0x60')])[_0xb501('0x17')](function(){if(_[_0xb501('0x75')](_0x4e6f95[_0xb501('0x23')]['ids'])){for(var _0xbbba94=0x0;_0xbbba94<_0x4e6f95[_0xb501('0x23')][_0xb501('0x60')][_0xb501('0x3e')];_0xbbba94+=0x1){socket[_0xb501('0x5d')](_0xb501('0x76'),{'UserId':Number(_0x4e6f95[_0xb501('0x23')][_0xb501('0x60')][_0xbbba94]),'OpenchannelQueueId':Number(_0x4e6f95[_0xb501('0x28')]['id'])});}}else{socket[_0xb501('0x5d')](_0xb501('0x76'),{'UserId':Number(_0x4e6f95[_0xb501('0x23')][_0xb501('0x60')]),'OpenchannelQueueId':Number(_0x4e6f95['params']['id'])});}});}})[_0xb501('0x17')](respondWithStatusCode(_0x273a06,null))[_0xb501('0x26')](handleError(_0x273a06,null));};exports[_0xb501('0x77')]=function(_0x50e51b,_0x164388){var _0x5e95a1={};var _0x5e3509={};var _0x482fc5;var _0x3269b0;return db[_0xb501('0x21')][_0xb501('0x4e')]({'where':{'id':_0x50e51b[_0xb501('0x28')]['id']}})[_0xb501('0x17')](handleEntityNotFound(_0x164388,null))[_0xb501('0x17')](function(_0x340d29){if(_0x340d29){_0x482fc5=_0x340d29;_0x5e3509[_0xb501('0x29')]=_['keys'](db['User']['rawAttributes']);_0x5e3509[_0xb501('0x23')]=_['keys'](_0x50e51b[_0xb501('0x23')]);_0x5e3509[_0xb501('0x3d')]=_['intersection'](_0x5e3509[_0xb501('0x29')],_0x5e3509['query']);_0x5e95a1[_0xb501('0x2c')]=_['intersection'](_0x5e3509[_0xb501('0x29')],qs[_0xb501('0x2d')](_0x50e51b[_0xb501('0x23')]['fields']));_0x5e95a1[_0xb501('0x2c')]=_0x5e95a1['attributes'][_0xb501('0x3e')]?_0x5e95a1[_0xb501('0x2c')]:_0x5e3509['model'];_0x5e95a1['order']=qs['sort'](_0x50e51b['query'][_0xb501('0x41')]);_0x5e95a1[_0xb501('0x20')]=qs[_0xb501('0x3d')](_[_0xb501('0x42')](_0x50e51b['query'],_0x5e3509[_0xb501('0x3d')]));if(_0x50e51b[_0xb501('0x23')][_0xb501('0x43')]){_0x5e95a1[_0xb501('0x20')]=_[_0xb501('0x2f')](_0x5e95a1[_0xb501('0x20')],{'$or':_[_0xb501('0x44')](_0x5e95a1[_0xb501('0x2c')],function(_0x2ffd3f){var _0x4b0287={};_0x4b0287[_0x2ffd3f]={'$like':'%'+_0x50e51b[_0xb501('0x23')][_0xb501('0x43')]+'%'};return _0x4b0287;})});}_0x5e95a1=_['merge']({},_0x5e95a1,_0x50e51b[_0xb501('0x78')]);return _0x482fc5[_0xb501('0x77')](_0x5e95a1);}})[_0xb501('0x17')](function(_0x3e6c13){if(_0x3e6c13){_0x3269b0=_0x3e6c13[_0xb501('0x3e')];if(!_0x50e51b[_0xb501('0x23')][_0xb501('0x51')](_0xb501('0x3f'))){_0x5e95a1[_0xb501('0x12')]=qs['limit'](_0x50e51b['query'][_0xb501('0x12')]);_0x5e95a1[_0xb501('0x11')]=qs[_0xb501('0x11')](_0x50e51b[_0xb501('0x23')]['offset']);}return _0x482fc5[_0xb501('0x77')](_0x5e95a1);}})[_0xb501('0x17')](function(_0x332f7f){if(_0x332f7f){return _0x332f7f?{'count':_0x3269b0,'rows':_0x332f7f}:null;}})[_0xb501('0x17')](respondWithResult(_0x164388,null))['catch'](handleError(_0x164388,null));}; \ No newline at end of file +var _0xbba0=['error','stack','name','send','index','rawAttributes','fieldName','type','key','getOptions','where','query','findAll','model','keys','OpenchannelQueue','filters','intersection','attributes','fields','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','params','describe','getMembers','findOne','UserOpenchannelQueue','length','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','merge','User','findAndCountAll','map','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','Team','addTeams','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','undefined','count','offset','limit','set','Content-Range','json','then','destroy','get','OpenchannelQueues','UserProfileResource'];(function(_0x50c540,_0x17a27b){var _0x60c4a7=function(_0x5a7376){while(--_0x5a7376){_0x50c540['push'](_0x50c540['shift']());}};_0x60c4a7(++_0x17a27b);}(_0xbba0,0xe3));var _0x0bba=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xbba0[_0x12fc8d];return _0x3f9d04;};'use strict';var BPromise=require('bluebird');var util=require(_0x0bba('0x0'));var _=require(_0x0bba('0x1'));var squel=require('squel');var Redis=require(_0x0bba('0x2'));var qs=require(_0x0bba('0x3'));var logger=require(_0x0bba('0x4'))(_0x0bba('0x5'));var config=require(_0x0bba('0x6'));var db=require(_0x0bba('0x7'))['db'];config[_0x0bba('0x8')]=_[_0x0bba('0x9')](config['redis'],{'host':_0x0bba('0xa'),'port':0x18eb});var socket=require(_0x0bba('0xb'))(new Redis(config['redis']));require(_0x0bba('0xc'))[_0x0bba('0xd')](socket);function respondWithStatusCode(_0x1698cf,_0x44cb01){_0x44cb01=_0x44cb01||0xcc;return function(_0x20376c){if(_0x20376c){return _0x1698cf['sendStatus'](_0x44cb01);}return _0x1698cf[_0x0bba('0xe')](_0x44cb01)['end']();};}function respondWithResult(_0xeac67e,_0x35d629){_0x35d629=_0x35d629||0xc8;return function(_0x16d610){if(_0x16d610){return _0xeac67e[_0x0bba('0xe')](_0x35d629)['json'](_0x16d610);}};}function respondWithFilteredResult(_0x553afd,_0x300441){return function(_0x2e5b89){if(_0x2e5b89){var _0x296117=typeof _0x300441['offset']===_0x0bba('0xf')&&typeof _0x300441['limit']===_0x0bba('0xf');var _0x4e60d5=_0x2e5b89[_0x0bba('0x10')];var _0x28a6a5=_0x296117?0x0:_0x300441[_0x0bba('0x11')];var _0x5cd277=_0x296117?_0x2e5b89[_0x0bba('0x10')]:_0x300441[_0x0bba('0x11')]+_0x300441[_0x0bba('0x12')];var _0x55588e;if(_0x5cd277>=_0x4e60d5){_0x5cd277=_0x4e60d5;_0x55588e=0xc8;}else{_0x55588e=0xce;}_0x553afd[_0x0bba('0xe')](_0x55588e);return _0x553afd[_0x0bba('0x13')](_0x0bba('0x14'),_0x28a6a5+'-'+_0x5cd277+'/'+_0x4e60d5)[_0x0bba('0x15')](_0x2e5b89);}return null;};}function saveUpdates(_0x19598d){return function(_0x497c04){if(_0x497c04){return _0x497c04['update'](_0x19598d)[_0x0bba('0x16')](function(_0x45f1db){return _0x45f1db;});}return null;};}function removeEntity(_0x2e560b){return function(_0x2d128d){if(_0x2d128d){return _0x2d128d[_0x0bba('0x17')]()[_0x0bba('0x16')](function(){var _0x3699e3=_0x2d128d[_0x0bba('0x18')]({'plain':!![]});var _0x5df81e=_0x0bba('0x19');return db[_0x0bba('0x1a')][_0x0bba('0x17')]({'where':{'type':_0x5df81e,'resourceId':_0x3699e3['id']}})[_0x0bba('0x16')](function(){return _0x2d128d;});})['then'](function(){_0x2e560b[_0x0bba('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19e822){return function(_0x449d68){if(!_0x449d68){_0x19e822['sendStatus'](0x194);}return _0x449d68;};}function handleError(_0xc9ad61,_0x3ac445){_0x3ac445=_0x3ac445||0x1f4;return function(_0x3becf2){logger[_0x0bba('0x1b')](_0x3becf2[_0x0bba('0x1c')]);if(_0x3becf2[_0x0bba('0x1d')]){delete _0x3becf2['name'];}_0xc9ad61[_0x0bba('0xe')](_0x3ac445)[_0x0bba('0x1e')](_0x3becf2);};}exports[_0x0bba('0x1f')]=function(_0x428fa9,_0x5bef62){var _0xe123c1={};var _0x1d6c36={'count':0x0,'rows':[]};var _0x5d3869=_['map'](db['OpenchannelQueue'][_0x0bba('0x20')],function(_0x3dd1e8){return{'name':_0x3dd1e8[_0x0bba('0x21')],'type':_0x3dd1e8[_0x0bba('0x22')][_0x0bba('0x23')]};});_0xe123c1=qs[_0x0bba('0x24')](_0x5d3869,_0x428fa9);var _0x4f3ad9={'where':_0xe123c1[_0x0bba('0x25')]};return db['OpenchannelQueue'][_0x0bba('0x10')](_0x4f3ad9)[_0x0bba('0x16')](function(_0x12dade){_0x1d6c36[_0x0bba('0x10')]=_0x12dade;_0xe123c1['include']=qs['include'](_0x428fa9[_0x0bba('0x26')]);return db['OpenchannelQueue'][_0x0bba('0x27')](_0xe123c1);})[_0x0bba('0x16')](function(_0x5bd36c){_0x1d6c36['rows']=_0x5bd36c;return _0x1d6c36;})['then'](respondWithFilteredResult(_0x5bef62,_0xe123c1))['catch'](handleError(_0x5bef62,null));};exports['show']=function(_0x789439,_0x409d63){var _0x45a2c4={'raw':!![],'where':{'id':_0x789439['params']['id']}},_0x5cde1c={};_0x5cde1c[_0x0bba('0x28')]=_[_0x0bba('0x29')](db[_0x0bba('0x2a')][_0x0bba('0x20')]);_0x5cde1c[_0x0bba('0x26')]=_['keys'](_0x789439[_0x0bba('0x26')]);_0x5cde1c[_0x0bba('0x2b')]=_[_0x0bba('0x2c')](_0x5cde1c[_0x0bba('0x28')],_0x5cde1c['query']);_0x45a2c4[_0x0bba('0x2d')]=_['intersection'](_0x5cde1c[_0x0bba('0x28')],qs[_0x0bba('0x2e')](_0x789439[_0x0bba('0x26')][_0x0bba('0x2e')]));_0x45a2c4[_0x0bba('0x2d')]=_0x45a2c4['attributes']['length']?_0x45a2c4[_0x0bba('0x2d')]:_0x5cde1c[_0x0bba('0x28')];if(_0x789439['query'][_0x0bba('0x2f')]){_0x45a2c4[_0x0bba('0x30')]=[{'all':!![]}];}_0x45a2c4=_['merge']({},_0x45a2c4,_0x789439[_0x0bba('0x31')]);return db['OpenchannelQueue'][_0x0bba('0x32')](_0x45a2c4)[_0x0bba('0x16')](handleEntityNotFound(_0x409d63,null))['then'](respondWithResult(_0x409d63,null))['catch'](handleError(_0x409d63,null));};exports[_0x0bba('0x33')]=function(_0x1b1e02,_0x5c2c9e){return db[_0x0bba('0x2a')][_0x0bba('0x33')](_0x1b1e02[_0x0bba('0x34')],{})[_0x0bba('0x16')](function(_0x4655d6){var _0x2b39a7=_0x1b1e02[_0x0bba('0x35')][_0x0bba('0x18')]({'plain':!![]});if(!_0x2b39a7)throw new Error(_0x0bba('0x36'));if(_0x2b39a7[_0x0bba('0x37')]===_0x0bba('0x35')){var _0x4dcceb=_0x4655d6[_0x0bba('0x18')]({'plain':!![]});var _0x571400=_0x0bba('0x19');return db[_0x0bba('0x38')][_0x0bba('0x32')]({'where':{'name':_0x571400,'userProfileId':_0x2b39a7['userProfileId']},'raw':!![]})[_0x0bba('0x16')](function(_0x5525af){if(_0x5525af&&_0x5525af['autoAssociation']===0x0){return db['UserProfileResource'][_0x0bba('0x33')]({'name':_0x4dcceb[_0x0bba('0x1d')],'resourceId':_0x4dcceb['id'],'type':_0x5525af[_0x0bba('0x1d')],'sectionId':_0x5525af['id']},{})[_0x0bba('0x16')](function(){return _0x4655d6;});}else{return _0x4655d6;}})['catch'](function(_0x1de94d){logger[_0x0bba('0x1b')](_0x0bba('0x39'),_0x1de94d);throw _0x1de94d;});}return _0x4655d6;})[_0x0bba('0x16')](respondWithResult(_0x5c2c9e,0xc9))[_0x0bba('0x3a')](handleError(_0x5c2c9e,null));};exports[_0x0bba('0x3b')]=function(_0x306dd8,_0xb797b2){if(_0x306dd8['body']['id']){delete _0x306dd8[_0x0bba('0x34')]['id'];}return db['OpenchannelQueue'][_0x0bba('0x32')]({'where':{'id':_0x306dd8[_0x0bba('0x3c')]['id']}})[_0x0bba('0x16')](handleEntityNotFound(_0xb797b2,null))[_0x0bba('0x16')](saveUpdates(_0x306dd8[_0x0bba('0x34')],null))['then'](respondWithResult(_0xb797b2,null))[_0x0bba('0x3a')](handleError(_0xb797b2,null));};exports['destroy']=function(_0x4b9b4e,_0x943f48){return db[_0x0bba('0x2a')][_0x0bba('0x32')]({'where':{'id':_0x4b9b4e[_0x0bba('0x3c')]['id']}})[_0x0bba('0x16')](handleEntityNotFound(_0x943f48,null))[_0x0bba('0x16')](removeEntity(_0x943f48,null))[_0x0bba('0x3a')](handleError(_0x943f48,null));};exports[_0x0bba('0x3d')]=function(_0x4f8a95,_0x2dc8ca){return db[_0x0bba('0x2a')][_0x0bba('0x3d')]()['then'](respondWithResult(_0x2dc8ca,null))['catch'](handleError(_0x2dc8ca,null));};exports[_0x0bba('0x3e')]=function(_0x2dc84d,_0x3f7d1b){var _0x26132d={'raw':!![],'where':{}},_0x11dadc={},_0x17b648;return db[_0x0bba('0x2a')][_0x0bba('0x3f')]({'where':{'id':_0x2dc84d[_0x0bba('0x3c')]['id']}})[_0x0bba('0x16')](handleEntityNotFound(_0x3f7d1b,null))['then'](function(_0x31a5d6){if(_0x31a5d6){_0x17b648=_0x31a5d6['get']({'plain':!![]});_0x11dadc[_0x0bba('0x28')]=_[_0x0bba('0x29')](db[_0x0bba('0x40')][_0x0bba('0x20')]);_0x11dadc[_0x0bba('0x26')]=_[_0x0bba('0x29')](_0x2dc84d[_0x0bba('0x26')]);_0x11dadc['filters']=_['intersection'](_0x11dadc['model'],_0x11dadc['query']);_0x26132d['attributes']=_[_0x0bba('0x2c')](_0x11dadc['model'],qs['fields'](_0x2dc84d[_0x0bba('0x26')][_0x0bba('0x2e')]));_0x26132d[_0x0bba('0x2d')]=_0x26132d['attributes'][_0x0bba('0x41')]?_0x26132d['attributes']:_0x11dadc[_0x0bba('0x28')];if(!_0x2dc84d[_0x0bba('0x26')][_0x0bba('0x42')](_0x0bba('0x43'))){_0x26132d[_0x0bba('0x12')]=qs['limit'](_0x2dc84d['query'][_0x0bba('0x12')]);_0x26132d[_0x0bba('0x11')]=qs['offset'](_0x2dc84d[_0x0bba('0x26')]['offset']);}_0x26132d[_0x0bba('0x44')]=qs[_0x0bba('0x45')](_0x2dc84d['query']['sort']);_0x26132d[_0x0bba('0x25')]=qs[_0x0bba('0x2b')](_[_0x0bba('0x46')](_0x2dc84d[_0x0bba('0x26')],_0x11dadc[_0x0bba('0x2b')]));_0x26132d[_0x0bba('0x25')][_0x0bba('0x47')]=_0x31a5d6['id'];if(_0x2dc84d[_0x0bba('0x26')][_0x0bba('0x48')]){_0x26132d[_0x0bba('0x25')]=_[_0x0bba('0x49')](_0x26132d[_0x0bba('0x25')],{'$or':_['map'](_0x26132d[_0x0bba('0x2d')],function(_0x17b60b){var _0x476d4a={};_0x476d4a[_0x17b60b]={'$like':'%'+_0x2dc84d[_0x0bba('0x26')]['filter']+'%'};return _0x476d4a;})});}_0x26132d=_[_0x0bba('0x49')]({},_0x26132d,_0x2dc84d[_0x0bba('0x31')]);return db[_0x0bba('0x40')][_0x0bba('0x27')](_0x26132d);}})[_0x0bba('0x16')](function(_0x3f5088){if(_0x3f5088){return db[_0x0bba('0x4a')][_0x0bba('0x4b')]({'where':{'id':_[_0x0bba('0x4c')](_0x3f5088,_0x0bba('0x4d')),'role':_0x0bba('0x4e')},'attributes':['id',_0x0bba('0x1d'),'openchannelPause',_0x0bba('0x4f'),_0x0bba('0x50')]});}})['then'](function(_0x5929f9){if(_0x5929f9){return{'count':_0x5929f9['count'],'rows':_[_0x0bba('0x4c')](_0x5929f9['rows'],function(_0x362a4f){return{'membername':_0x362a4f[_0x0bba('0x1d')],'UserId':_0x362a4f['id'],'queue_name':_0x17b648['name'],'OpenchannelQueueId':_0x17b648['id'],'interface':util[_0x0bba('0x51')](_0x0bba('0x52'),_0x0bba('0x53'),_0x362a4f[_0x0bba('0x1d')]),'penalty':0x0,'paused':_0x362a4f[_0x0bba('0x54')],'createdAt':_0x362a4f['createdAt'],'updatedAt':_0x362a4f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0bba('0x16')](respondWithFilteredResult(_0x3f7d1b,_0x26132d))[_0x0bba('0x3a')](handleError(_0x3f7d1b,null));};exports[_0x0bba('0x55')]=function(_0x2cc4f2,_0x309636){var _0x38439e={};var _0x4cdb7e={};var _0x409b4c;var _0x485800;return db[_0x0bba('0x2a')][_0x0bba('0x3f')]({'where':{'id':_0x2cc4f2['params']['id']}})[_0x0bba('0x16')](handleEntityNotFound(_0x309636,null))[_0x0bba('0x16')](function(_0x48b773){if(_0x48b773){_0x409b4c=_0x48b773;_0x4cdb7e['model']=_[_0x0bba('0x29')](db[_0x0bba('0x56')][_0x0bba('0x20')]);_0x4cdb7e['query']=_[_0x0bba('0x29')](_0x2cc4f2[_0x0bba('0x26')]);_0x4cdb7e[_0x0bba('0x2b')]=_[_0x0bba('0x2c')](_0x4cdb7e[_0x0bba('0x28')],_0x4cdb7e[_0x0bba('0x26')]);_0x38439e[_0x0bba('0x2d')]=_['intersection'](_0x4cdb7e['model'],qs[_0x0bba('0x2e')](_0x2cc4f2[_0x0bba('0x26')]['fields']));_0x38439e[_0x0bba('0x2d')]=_0x38439e['attributes']['length']?_0x38439e[_0x0bba('0x2d')]:_0x4cdb7e[_0x0bba('0x28')];_0x38439e[_0x0bba('0x44')]=qs[_0x0bba('0x45')](_0x2cc4f2['query']['sort']);_0x38439e[_0x0bba('0x25')]=qs['filters'](_[_0x0bba('0x46')](_0x2cc4f2['query'],_0x4cdb7e[_0x0bba('0x2b')]));if(_0x2cc4f2['query'][_0x0bba('0x48')]){_0x38439e['where']=_[_0x0bba('0x49')](_0x38439e[_0x0bba('0x25')],{'$or':_['map'](_0x38439e[_0x0bba('0x2d')],function(_0x52dd02){var _0x228f9b={};_0x228f9b[_0x52dd02]={'$like':'%'+_0x2cc4f2[_0x0bba('0x26')]['filter']+'%'};return _0x228f9b;})});}_0x38439e=_['merge']({},_0x38439e,_0x2cc4f2['options']);return _0x409b4c[_0x0bba('0x55')](_0x38439e);}})[_0x0bba('0x16')](function(_0x5dfe83){if(_0x5dfe83){_0x485800=_0x5dfe83[_0x0bba('0x41')];if(!_0x2cc4f2[_0x0bba('0x26')][_0x0bba('0x42')]('nolimit')){_0x38439e[_0x0bba('0x12')]=qs['limit'](_0x2cc4f2[_0x0bba('0x26')][_0x0bba('0x12')]);_0x38439e[_0x0bba('0x11')]=qs[_0x0bba('0x11')](_0x2cc4f2[_0x0bba('0x26')][_0x0bba('0x11')]);}return _0x409b4c['getTeams'](_0x38439e);}})['then'](function(_0x3c44ac){if(_0x3c44ac){return _0x3c44ac?{'count':_0x485800,'rows':_0x3c44ac}:null;}})[_0x0bba('0x16')](respondWithResult(_0x309636,null))[_0x0bba('0x3a')](handleError(_0x309636,null));};exports[_0x0bba('0x57')]=function(_0x36816a,_0x11fc14){var _0x5a7202=_0x36816a[_0x0bba('0x34')]['ids'];return db[_0x0bba('0x56')][_0x0bba('0x27')]({'where':{'id':_0x5a7202},'attributes':['id'],'include':[{'model':db[_0x0bba('0x4a')],'as':'Agents','attributes':['id',_0x0bba('0x1d'),_0x0bba('0x58'),_0x0bba('0x59'),_0x0bba('0x5a')],'raw':!![]}]})[_0x0bba('0x16')](function(_0x326851){if(_0x326851){var _0x16a993=_[_0x0bba('0x5b')](_0x326851,function(_0x1751df){var _0x253c6b=_0x1751df[_0x0bba('0x18')]({'plain':!![]});return _0x253c6b[_0x0bba('0x5c')];});return db[_0x0bba('0x2a')][_0x0bba('0x32')]({'where':{'id':_0x36816a[_0x0bba('0x3c')]['id']}})[_0x0bba('0x16')](function(_0x24e95f){return db[_0x0bba('0x5d')]['transaction'](function(_0x39f429){return _0x24e95f['addTeams'](_0x5a7202,{'transaction':_0x39f429})[_0x0bba('0x16')](function(){return BPromise[_0x0bba('0x5e')](_0x16a993,function(_0xc3c84a){return db['UserOpenchannelQueue'][_0x0bba('0x5f')]({'where':{'UserId':_0xc3c84a['id'],'OpenchannelQueueId':_0x36816a['params']['id']},'transaction':_0x39f429});});})[_0x0bba('0x16')](function(){_0x16a993[_0x0bba('0x60')](function(_0x5c0149){socket[_0x0bba('0x61')](_0x0bba('0x62'),{'UserId':_0x5c0149['id'],'OpenchannelQueueId':_0x24e95f['id']});});});});});}})[_0x0bba('0x16')](respondWithStatusCode(_0x11fc14,null))['catch'](handleError(_0x11fc14,null));};exports[_0x0bba('0x63')]=function(_0x4695f4,_0x1a2c6a){return db[_0x0bba('0x56')][_0x0bba('0x27')]({'where':{'id':_0x4695f4['query'][_0x0bba('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0bba('0x5c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1a2c6a,null))['then'](function(_0x30ed38){var _0x54e9b9=_[_0x0bba('0x4c')](_0x30ed38,'id');var _0x58f52b=[];var _0x3fd17f=[];var _0xc3a749=squel['select']();_0xc3a749[_0x0bba('0x65')]('tq.TeamId')[_0x0bba('0x66')](_0x0bba('0x67'),'tq')[_0x0bba('0x68')](_0x0bba('0x69'),'ut',_0x0bba('0x6a'))[_0x0bba('0x25')](_0x0bba('0x6b'),_0x4695f4[_0x0bba('0x3c')]['id']);for(var _0x91021b=0x0;_0x91021b<_0x30ed38[_0x0bba('0x41')];_0x91021b+=0x1){let _0x5c81a5=_0x30ed38[_0x91021b];for(var _0x495d6a=0x0;_0x495d6a<_0x5c81a5[_0x0bba('0x5c')][_0x0bba('0x41')];_0x495d6a+=0x1){let _0x4565a9=_0x5c81a5['Agents'][_0x495d6a];var _0x30847a=_0xc3a749[_0x0bba('0x6c')]();_0x30847a[_0x0bba('0x25')](_0x0bba('0x6d'),_0x4565a9['id']);_0x3fd17f['push'](db[_0x0bba('0x5d')][_0x0bba('0x26')](_0x30847a[_0x0bba('0x6e')](),{'type':db[_0x0bba('0x5d')]['QueryTypes'][_0x0bba('0x6f')]})['then'](function(_0x31a255){if(_0x31a255['length']===0x1){return _0x4565a9['id'];}else{var _0x3d6f87=_[_0x0bba('0x70')](_['map'](_0x31a255,_0x0bba('0x71')),function(_0x21929c){return _[_0x0bba('0x72')](_0x54e9b9,_0x21929c);});if(_0x3d6f87){return _0x4565a9['id'];}}}));}}return BPromise[_0x0bba('0x73')](_0x3fd17f)[_0x0bba('0x16')](function(_0x26e318){_0x58f52b=_(_0x58f52b)[_0x0bba('0x74')](_0x26e318)[_0x0bba('0x75')]()['value']();return db['OpenchannelQueue'][_0x0bba('0x32')]({'where':{'id':_0x4695f4[_0x0bba('0x3c')]['id']}})['then'](function(_0x102d79){return db[_0x0bba('0x5d')][_0x0bba('0x76')](function(_0x18e517){return _0x102d79['removeTeams'](_0x4695f4[_0x0bba('0x26')][_0x0bba('0x64')],{'transaction':_0x18e517})[_0x0bba('0x16')](function(){if(!_[_0x0bba('0x77')](_0x58f52b)){return _0x102d79[_0x0bba('0x78')](_0x58f52b,{'transaction':_0x18e517});}})[_0x0bba('0x16')](function(){_0x58f52b[_0x0bba('0x60')](function(_0xfbb597){socket[_0x0bba('0x61')](_0x0bba('0x79'),{'UserId':_0xfbb597,'OpenchannelQueueId':_0x102d79['id']});});});});});});})[_0x0bba('0x16')](respondWithStatusCode(_0x1a2c6a,null))['catch'](handleError(_0x1a2c6a,null));};exports[_0x0bba('0x7a')]=function(_0x3972ee,_0x42f41b){return db['OpenchannelQueue'][_0x0bba('0x32')]({'where':{'id':_0x3972ee['params']['id']}})['then'](handleEntityNotFound(_0x42f41b,null))[_0x0bba('0x16')](function(_0x5a1b6d){if(_0x5a1b6d){return _0x5a1b6d[_0x0bba('0x7a')](_0x3972ee[_0x0bba('0x34')]['ids'],_[_0x0bba('0x7b')](_0x3972ee[_0x0bba('0x34')],[_0x0bba('0x64'),'id'])||{})[_0x0bba('0x7c')](function(_0x25e001){for(var _0x49f5ec=0x0;_0x49f5ec<_0x3972ee['body'][_0x0bba('0x64')][_0x0bba('0x41')];_0x49f5ec+=0x1){socket[_0x0bba('0x61')](_0x0bba('0x62'),{'UserId':Number(_0x3972ee[_0x0bba('0x34')][_0x0bba('0x64')][_0x49f5ec]),'OpenchannelQueueId':Number(_0x3972ee[_0x0bba('0x3c')]['id'])});}return _0x25e001;});}})[_0x0bba('0x16')](respondWithResult(_0x42f41b,null))[_0x0bba('0x3a')](handleError(_0x42f41b,null));};exports[_0x0bba('0x78')]=function(_0x5ae3a8,_0x3e1303){return db['OpenchannelQueue'][_0x0bba('0x32')]({'where':{'id':_0x5ae3a8[_0x0bba('0x3c')]['id']}})[_0x0bba('0x16')](handleEntityNotFound(_0x3e1303,null))[_0x0bba('0x16')](function(_0x5e1165){if(_0x5e1165){return _0x5e1165[_0x0bba('0x78')](_0x5ae3a8['query'][_0x0bba('0x64')])[_0x0bba('0x16')](function(){if(_[_0x0bba('0x7d')](_0x5ae3a8[_0x0bba('0x26')][_0x0bba('0x64')])){for(var _0x384d3a=0x0;_0x384d3a<_0x5ae3a8['query'][_0x0bba('0x64')][_0x0bba('0x41')];_0x384d3a+=0x1){socket['emit'](_0x0bba('0x79'),{'UserId':Number(_0x5ae3a8[_0x0bba('0x26')]['ids'][_0x384d3a]),'OpenchannelQueueId':Number(_0x5ae3a8['params']['id'])});}}else{socket[_0x0bba('0x61')](_0x0bba('0x79'),{'UserId':Number(_0x5ae3a8[_0x0bba('0x26')]['ids']),'OpenchannelQueueId':Number(_0x5ae3a8[_0x0bba('0x3c')]['id'])});}});}})[_0x0bba('0x16')](respondWithStatusCode(_0x3e1303,null))['catch'](handleError(_0x3e1303,null));};exports[_0x0bba('0x7e')]=function(_0x39967a,_0x4b2b18){var _0x3ec0aa={};var _0x188860={};var _0x290709;var _0x56a794;return db[_0x0bba('0x2a')][_0x0bba('0x3f')]({'where':{'id':_0x39967a[_0x0bba('0x3c')]['id']}})[_0x0bba('0x16')](handleEntityNotFound(_0x4b2b18,null))[_0x0bba('0x16')](function(_0x49c8d8){if(_0x49c8d8){_0x290709=_0x49c8d8;_0x188860[_0x0bba('0x28')]=_[_0x0bba('0x29')](db[_0x0bba('0x4a')][_0x0bba('0x20')]);_0x188860[_0x0bba('0x26')]=_[_0x0bba('0x29')](_0x39967a[_0x0bba('0x26')]);_0x188860[_0x0bba('0x2b')]=_['intersection'](_0x188860['model'],_0x188860[_0x0bba('0x26')]);_0x3ec0aa[_0x0bba('0x2d')]=_[_0x0bba('0x2c')](_0x188860[_0x0bba('0x28')],qs[_0x0bba('0x2e')](_0x39967a[_0x0bba('0x26')][_0x0bba('0x2e')]));_0x3ec0aa[_0x0bba('0x2d')]=_0x3ec0aa[_0x0bba('0x2d')][_0x0bba('0x41')]?_0x3ec0aa[_0x0bba('0x2d')]:_0x188860[_0x0bba('0x28')];_0x3ec0aa['order']=qs[_0x0bba('0x45')](_0x39967a[_0x0bba('0x26')][_0x0bba('0x45')]);_0x3ec0aa[_0x0bba('0x25')]=qs[_0x0bba('0x2b')](_[_0x0bba('0x46')](_0x39967a[_0x0bba('0x26')],_0x188860[_0x0bba('0x2b')]));if(_0x39967a[_0x0bba('0x26')][_0x0bba('0x48')]){_0x3ec0aa[_0x0bba('0x25')]=_[_0x0bba('0x49')](_0x3ec0aa[_0x0bba('0x25')],{'$or':_[_0x0bba('0x4c')](_0x3ec0aa[_0x0bba('0x2d')],function(_0xf9a901){var _0x383ebe={};_0x383ebe[_0xf9a901]={'$like':'%'+_0x39967a['query'][_0x0bba('0x48')]+'%'};return _0x383ebe;})});}_0x3ec0aa=_['merge']({},_0x3ec0aa,_0x39967a['options']);return _0x290709[_0x0bba('0x7e')](_0x3ec0aa);}})[_0x0bba('0x16')](function(_0x361a20){if(_0x361a20){_0x56a794=_0x361a20[_0x0bba('0x41')];if(!_0x39967a[_0x0bba('0x26')]['hasOwnProperty'](_0x0bba('0x43'))){_0x3ec0aa['limit']=qs[_0x0bba('0x12')](_0x39967a[_0x0bba('0x26')][_0x0bba('0x12')]);_0x3ec0aa['offset']=qs[_0x0bba('0x11')](_0x39967a[_0x0bba('0x26')][_0x0bba('0x11')]);}return _0x290709[_0x0bba('0x7e')](_0x3ec0aa);}})[_0x0bba('0x16')](function(_0x5ba12f){if(_0x5ba12f){return _0x5ba12f?{'count':_0x56a794,'rows':_0x5ba12f}:null;}})[_0x0bba('0x16')](respondWithResult(_0x4b2b18,null))[_0x0bba('0x3a')](handleError(_0x4b2b18,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 99e5414..11cca58 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 _0x91fd=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x250858,_0x4381dc){var _0x4ba9f8=function(_0x163a37){while(--_0x163a37){_0x250858['push'](_0x250858['shift']());}};_0x4ba9f8(++_0x4381dc);}(_0x91fd,0x16d));var _0xd91f=function(_0x4ff186,_0x21e242){_0x4ff186=_0x4ff186-0x0;var _0x1aeade=_0x91fd[_0x4ff186];return _0x1aeade;};'use strict';var EventEmitter=require(_0xd91f('0x0'));var OpenchannelQueue=require(_0xd91f('0x1'))['db'][_0xd91f('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd91f('0x3'),'afterUpdate':'update','afterDestroy':_0xd91f('0x4')};function emitEvent(_0x305091){return function(_0x33e9ab,_0x15b9ff,_0x11b1b7){OpenchannelQueueEvents[_0xd91f('0x5')](_0x305091+':'+_0x33e9ab['id'],_0x33e9ab);OpenchannelQueueEvents['emit'](_0x305091,_0x33e9ab);_0x11b1b7(null);};}for(var e in events){if(events[_0xd91f('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xd91f('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x02db=['exports','OpenchannelQueue','save','remove','emit','hasOwnProperty'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x02db,0x1c9));var _0xb02d=function(_0x1e12ce,_0x51ebbc){_0x1e12ce=_0x1e12ce-0x0;var _0x194a5d=_0x02db[_0x1e12ce];return _0x194a5d;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0xb02d('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb02d('0x1'),'afterUpdate':'update','afterDestroy':_0xb02d('0x2')};function emitEvent(_0x5768d7){return function(_0x5ecf76,_0x2912aa,_0x3eceef){OpenchannelQueueEvents[_0xb02d('0x3')](_0x5768d7+':'+_0x5ecf76['id'],_0x5ecf76);OpenchannelQueueEvents[_0xb02d('0x3')](_0x5768d7,_0x5ecf76);_0x3eceef(null);};}for(var e in events){if(events[_0xb02d('0x4')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xb02d('0x5')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 18e2d99..c898774 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 _0x148f=['lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x148f,0xbb));var _0xf148=function(_0x531b7f,_0x589660){_0x531b7f=_0x531b7f-0x0;var _0x52ecf8=_0x148f[_0x531b7f];return _0x52ecf8;};'use strict';var _=require(_0xf148('0x0'));var util=require(_0xf148('0x1'));var logger=require(_0xf148('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf148('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf148('0x4'));var config=require(_0xf148('0x5'));var attributes=require(_0xf148('0x6'));module[_0xf148('0x7')]=function(_0x5a1f94,_0x3e01cb){return _0x5a1f94[_0xf148('0x8')](_0xf148('0x9'),attributes,{'tableName':_0xf148('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb97f=['exports','OpenchannelQueue','openchannel_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x524021,_0x25d5ea){var _0x269c3e=function(_0x2418a5){while(--_0x2418a5){_0x524021['push'](_0x524021['shift']());}};_0x269c3e(++_0x25d5ea);}(_0xb97f,0x1e4));var _0xfb97=function(_0x2832e7,_0x17c237){_0x2832e7=_0x2832e7-0x0;var _0xb70d71=_0xb97f[_0x2832e7];return _0xb70d71;};'use strict';var _=require(_0xfb97('0x0'));var util=require(_0xfb97('0x1'));var logger=require('../../config/logger')(_0xfb97('0x2'));var moment=require(_0xfb97('0x3'));var BPromise=require(_0xfb97('0x4'));var rp=require(_0xfb97('0x5'));var fs=require('fs');var path=require(_0xfb97('0x6'));var rimraf=require(_0xfb97('0x7'));var config=require(_0xfb97('0x8'));var attributes=require(_0xfb97('0x9'));module[_0xfb97('0xa')]=function(_0x55635f,_0x12fdf3){return _0x55635f['define'](_0xfb97('0xb'),attributes,{'tableName':_0xfb97('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 17285e7..367d4a4 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 _0x0a1f=['stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','include','model','map','then','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x395a03,_0x362943){var _0x8de6f=function(_0x56ae29){while(--_0x56ae29){_0x395a03['push'](_0x395a03['shift']());}};_0x8de6f(++_0x362943);}(_0x0a1f,0x184));var _0xf0a1=function(_0x5896d8,_0x1ac7a4){_0x5896d8=_0x5896d8-0x0;var _0x524d15=_0x0a1f[_0x5896d8];return _0x524d15;};'use strict';var _=require(_0xf0a1('0x0'));var util=require(_0xf0a1('0x1'));var moment=require(_0xf0a1('0x2'));var BPromise=require(_0xf0a1('0x3'));var rs=require(_0xf0a1('0x4'));var fs=require('fs');var Redis=require(_0xf0a1('0x5'));var db=require(_0xf0a1('0x6'))['db'];var utils=require(_0xf0a1('0x7'));var logger=require(_0xf0a1('0x8'))(_0xf0a1('0x9'));var config=require(_0xf0a1('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf0a1('0xb')][_0xf0a1('0xc')]({'port':0x232a});config['redis']=_[_0xf0a1('0xd')](config['redis'],{'host':_0xf0a1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf0a1('0xf'))[_0xf0a1('0x10')](socket);function respondWithRpcPromise(_0x13aa64,_0x567ce3,_0x407a6b){return new BPromise(function(_0x2ea328,_0x1c1292){return client[_0xf0a1('0x11')](_0x13aa64,_0x407a6b)['then'](function(_0x30923a){logger['info'](_0xf0a1('0x12'),_0x567ce3,_0xf0a1('0x13'));logger[_0xf0a1('0x14')](_0xf0a1('0x15'),_0x567ce3,'request\x20sent',JSON[_0xf0a1('0x16')](_0x30923a));if(_0x30923a['error']){if(_0x30923a[_0xf0a1('0x17')][_0xf0a1('0x18')]===0x1f4){logger[_0xf0a1('0x17')](_0xf0a1('0x12'),_0x567ce3,_0x30923a[_0xf0a1('0x17')][_0xf0a1('0x19')]);return _0x1c1292(_0x30923a[_0xf0a1('0x17')][_0xf0a1('0x19')]);}logger[_0xf0a1('0x17')](_0xf0a1('0x12'),_0x567ce3,_0x30923a[_0xf0a1('0x17')][_0xf0a1('0x19')]);return _0x2ea328(_0x30923a[_0xf0a1('0x17')][_0xf0a1('0x19')]);}else{logger[_0xf0a1('0x1a')]('OpenchannelQueue,\x20%s,\x20%s',_0x567ce3,'request\x20sent');_0x2ea328(_0x30923a[_0xf0a1('0x1b')][_0xf0a1('0x19')]);}})[_0xf0a1('0x1c')](function(_0x53dfd2){logger[_0xf0a1('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x567ce3,_0x53dfd2);_0x1c1292(_0x53dfd2);});});}exports[_0xf0a1('0x1d')]=function(_0x5c3692){var _0x4e155e=this;return new Promise(function(_0x4c32a3,_0x466a95){return db[_0xf0a1('0x1e')][_0xf0a1('0x1f')]({'raw':_0x5c3692[_0xf0a1('0x20')]?_0x5c3692['options'][_0xf0a1('0x21')]===undefined?!![]:![]:!![],'where':_0x5c3692['options']?_0x5c3692[_0xf0a1('0x20')]['where']||null:null,'attributes':_0x5c3692['options']?_0x5c3692['options'][_0xf0a1('0x22')]||null:null,'limit':_0x5c3692[_0xf0a1('0x20')]?_0x5c3692[_0xf0a1('0x20')]['limit']||null:null,'include':_0x5c3692['options']?_0x5c3692['options'][_0xf0a1('0x23')]?_['map'](_0x5c3692[_0xf0a1('0x20')]['include'],function(_0x521d85){return{'model':db[_0x521d85[_0xf0a1('0x24')]],'as':_0x521d85['as'],'attributes':_0x521d85[_0xf0a1('0x22')],'include':_0x521d85[_0xf0a1('0x23')]?_[_0xf0a1('0x25')](_0x521d85['include'],function(_0x38f1d7){return{'model':db[_0x38f1d7[_0xf0a1('0x24')]],'as':_0x38f1d7['as'],'attributes':_0x38f1d7[_0xf0a1('0x22')],'include':_0x38f1d7[_0xf0a1('0x23')]?_[_0xf0a1('0x25')](_0x38f1d7['include'],function(_0x13fd2a){return{'model':db[_0x13fd2a['model']],'as':_0x13fd2a['as'],'attributes':_0x13fd2a[_0xf0a1('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf0a1('0x26')](function(_0x2558c4){logger[_0xf0a1('0x1a')](_0xf0a1('0x1d'),_0x5c3692);logger['debug'](_0xf0a1('0x1d'),_0x5c3692,JSON[_0xf0a1('0x16')](_0x2558c4));_0x4c32a3(_0x2558c4);})[_0xf0a1('0x1c')](function(_0x2d257f){logger[_0xf0a1('0x17')]('GetOpenchannelQueue',_0x2d257f[_0xf0a1('0x19')],_0x5c3692);_0x466a95(_0x4e155e['error'](0x1f4,_0x2d257f[_0xf0a1('0x19')]));});});};exports[_0xf0a1('0x27')]=function(_0x3cd654){var _0xce1fbd=this;return new Promise(function(_0x24053c,_0x55b2ec){return db[_0xf0a1('0x1e')][_0xf0a1('0x28')]({'raw':_0x3cd654[_0xf0a1('0x20')]?_0x3cd654['options'][_0xf0a1('0x21')]===undefined?!![]:![]:!![],'where':_0x3cd654[_0xf0a1('0x20')]?_0x3cd654[_0xf0a1('0x20')]['where']||null:null,'attributes':_0x3cd654[_0xf0a1('0x20')]?_0x3cd654[_0xf0a1('0x20')][_0xf0a1('0x22')]||null:null,'include':_0x3cd654[_0xf0a1('0x20')]?_0x3cd654[_0xf0a1('0x20')][_0xf0a1('0x23')]?_[_0xf0a1('0x25')](_0x3cd654[_0xf0a1('0x20')]['include'],function(_0x5e2535){return{'model':db[_0x5e2535[_0xf0a1('0x24')]],'as':_0x5e2535['as'],'attributes':_0x5e2535['attributes'],'include':_0x5e2535[_0xf0a1('0x23')]?_[_0xf0a1('0x25')](_0x5e2535[_0xf0a1('0x23')],function(_0x697a8){return{'model':db[_0x697a8[_0xf0a1('0x24')]],'as':_0x697a8['as'],'attributes':_0x697a8[_0xf0a1('0x22')],'include':_0x697a8['include']?_[_0xf0a1('0x25')](_0x697a8[_0xf0a1('0x23')],function(_0x17b047){return{'model':db[_0x17b047[_0xf0a1('0x24')]],'as':_0x17b047['as'],'attributes':_0x17b047[_0xf0a1('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf0a1('0x26')](function(_0x4b4bfb){logger['info'](_0xf0a1('0x27'),_0x3cd654);logger['debug'](_0xf0a1('0x27'),_0x3cd654,JSON['stringify'](_0x4b4bfb));_0x24053c(_0x4b4bfb);})[_0xf0a1('0x1c')](function(_0x22bccf){logger[_0xf0a1('0x17')](_0xf0a1('0x27'),_0x22bccf['message'],_0x3cd654);_0x55b2ec(_0xce1fbd[_0xf0a1('0x17')](0x1f4,_0x22bccf[_0xf0a1('0x19')]));});});}; \ No newline at end of file +var _0x69ce=['model','map','then','catch','ShowOpenchannelQueue','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue','OpenchannelQueue','options','where','attributes','limit','include'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x69ce,0x147));var _0xe69c=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x69ce[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require(_0xe69c('0x0'));var moment=require(_0xe69c('0x1'));var BPromise=require('bluebird');var rs=require(_0xe69c('0x2'));var fs=require('fs');var Redis=require(_0xe69c('0x3'));var db=require(_0xe69c('0x4'))['db'];var utils=require(_0xe69c('0x5'));var logger=require(_0xe69c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe69c('0x7'));var client=jayson[_0xe69c('0x8')][_0xe69c('0x9')]({'port':0x232a});config[_0xe69c('0xa')]=_[_0xe69c('0xb')](config[_0xe69c('0xa')],{'host':_0xe69c('0xc'),'port':0x18eb});var socket=require(_0xe69c('0xd'))(new Redis(config[_0xe69c('0xa')]));require('./openchannelQueue.socket')[_0xe69c('0xe')](socket);function respondWithRpcPromise(_0x439fe0,_0x1b11cb,_0x17a7ec){return new BPromise(function(_0x349bcb,_0x5181e6){return client[_0xe69c('0xf')](_0x439fe0,_0x17a7ec)['then'](function(_0x357873){logger[_0xe69c('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x1b11cb,_0xe69c('0x11'));logger[_0xe69c('0x12')](_0xe69c('0x13'),_0x1b11cb,_0xe69c('0x11'),JSON[_0xe69c('0x14')](_0x357873));if(_0x357873[_0xe69c('0x15')]){if(_0x357873[_0xe69c('0x15')][_0xe69c('0x16')]===0x1f4){logger[_0xe69c('0x15')](_0xe69c('0x17'),_0x1b11cb,_0x357873[_0xe69c('0x15')][_0xe69c('0x18')]);return _0x5181e6(_0x357873[_0xe69c('0x15')][_0xe69c('0x18')]);}logger[_0xe69c('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x1b11cb,_0x357873[_0xe69c('0x15')]['message']);return _0x349bcb(_0x357873['error'][_0xe69c('0x18')]);}else{logger[_0xe69c('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x1b11cb,_0xe69c('0x11'));_0x349bcb(_0x357873[_0xe69c('0x19')][_0xe69c('0x18')]);}})['catch'](function(_0x5b6eb5){logger[_0xe69c('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x1b11cb,_0x5b6eb5);_0x5181e6(_0x5b6eb5);});});}exports[_0xe69c('0x1a')]=function(_0x1f9f4d){var _0x44b7d9=this;return new Promise(function(_0x15bd7e,_0x32d7e8){return db[_0xe69c('0x1b')]['findAll']({'raw':_0x1f9f4d['options']?_0x1f9f4d[_0xe69c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1f9f4d[_0xe69c('0x1c')]?_0x1f9f4d[_0xe69c('0x1c')][_0xe69c('0x1d')]||null:null,'attributes':_0x1f9f4d[_0xe69c('0x1c')]?_0x1f9f4d[_0xe69c('0x1c')][_0xe69c('0x1e')]||null:null,'limit':_0x1f9f4d[_0xe69c('0x1c')]?_0x1f9f4d[_0xe69c('0x1c')][_0xe69c('0x1f')]||null:null,'include':_0x1f9f4d[_0xe69c('0x1c')]?_0x1f9f4d['options'][_0xe69c('0x20')]?_['map'](_0x1f9f4d[_0xe69c('0x1c')][_0xe69c('0x20')],function(_0x5a292a){return{'model':db[_0x5a292a[_0xe69c('0x21')]],'as':_0x5a292a['as'],'attributes':_0x5a292a['attributes'],'include':_0x5a292a[_0xe69c('0x20')]?_[_0xe69c('0x22')](_0x5a292a[_0xe69c('0x20')],function(_0x119318){return{'model':db[_0x119318[_0xe69c('0x21')]],'as':_0x119318['as'],'attributes':_0x119318[_0xe69c('0x1e')],'include':_0x119318[_0xe69c('0x20')]?_['map'](_0x119318[_0xe69c('0x20')],function(_0x185053){return{'model':db[_0x185053[_0xe69c('0x21')]],'as':_0x185053['as'],'attributes':_0x185053['attributes']};}):[]};}):[]};}):[]:[]})[_0xe69c('0x23')](function(_0x16cccb){logger[_0xe69c('0x10')](_0xe69c('0x1a'),_0x1f9f4d);logger['debug'](_0xe69c('0x1a'),_0x1f9f4d,JSON['stringify'](_0x16cccb));_0x15bd7e(_0x16cccb);})[_0xe69c('0x24')](function(_0x3fa131){logger[_0xe69c('0x15')](_0xe69c('0x1a'),_0x3fa131[_0xe69c('0x18')],_0x1f9f4d);_0x32d7e8(_0x44b7d9[_0xe69c('0x15')](0x1f4,_0x3fa131[_0xe69c('0x18')]));});});};exports[_0xe69c('0x25')]=function(_0x8ddd0e){var _0x2bf0e1=this;return new Promise(function(_0x4aab71,_0x34c7b3){return db[_0xe69c('0x1b')][_0xe69c('0x26')]({'raw':_0x8ddd0e['options']?_0x8ddd0e[_0xe69c('0x1c')][_0xe69c('0x27')]===undefined?!![]:![]:!![],'where':_0x8ddd0e[_0xe69c('0x1c')]?_0x8ddd0e['options']['where']||null:null,'attributes':_0x8ddd0e['options']?_0x8ddd0e[_0xe69c('0x1c')][_0xe69c('0x1e')]||null:null,'include':_0x8ddd0e[_0xe69c('0x1c')]?_0x8ddd0e[_0xe69c('0x1c')]['include']?_[_0xe69c('0x22')](_0x8ddd0e['options']['include'],function(_0x1cbc35){return{'model':db[_0x1cbc35[_0xe69c('0x21')]],'as':_0x1cbc35['as'],'attributes':_0x1cbc35[_0xe69c('0x1e')],'include':_0x1cbc35[_0xe69c('0x20')]?_[_0xe69c('0x22')](_0x1cbc35[_0xe69c('0x20')],function(_0x2f0c19){return{'model':db[_0x2f0c19[_0xe69c('0x21')]],'as':_0x2f0c19['as'],'attributes':_0x2f0c19[_0xe69c('0x1e')],'include':_0x2f0c19[_0xe69c('0x20')]?_[_0xe69c('0x22')](_0x2f0c19[_0xe69c('0x20')],function(_0x582a79){return{'model':db[_0x582a79[_0xe69c('0x21')]],'as':_0x582a79['as'],'attributes':_0x582a79[_0xe69c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe69c('0x23')](function(_0x579ff5){logger['info']('ShowOpenchannelQueue',_0x8ddd0e);logger['debug'](_0xe69c('0x25'),_0x8ddd0e,JSON['stringify'](_0x579ff5));_0x4aab71(_0x579ff5);})[_0xe69c('0x24')](function(_0x4aad01){logger['error'](_0xe69c('0x25'),_0x4aad01[_0xe69c('0x18')],_0x8ddd0e);_0x34c7b3(_0x2bf0e1[_0xe69c('0x15')](0x1f4,_0x4aad01[_0xe69c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 934b9d5..9541967 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 _0x56e3=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56e3,0x1d4));var _0x356e=function(_0x55fa3d,_0x104c3b){_0x55fa3d=_0x55fa3d-0x0;var _0x51e971=_0x56e3[_0x55fa3d];return _0x51e971;};'use strict';var OpenchannelQueueEvents=require(_0x356e('0x0'));var events=[_0x356e('0x1'),'remove',_0x356e('0x2')];function createListener(_0x2953ac,_0x4ba21e){return function(_0x14f929){_0x4ba21e[_0x356e('0x3')](_0x2953ac,_0x14f929);};}function removeListener(_0x3cb053,_0x2a489f){return function(){OpenchannelQueueEvents[_0x356e('0x4')](_0x3cb053,_0x2a489f);};}exports[_0x356e('0x5')]=function(_0x139b8e){for(var _0x369148=0x0,_0xaccb72=events[_0x356e('0x6')];_0x369148<_0xaccb72;_0x369148++){var _0x4bca9c=events[_0x369148];var _0x5e33a4=createListener(_0x356e('0x7')+_0x4bca9c,_0x139b8e);OpenchannelQueueEvents['on'](_0x4bca9c,_0x5e33a4);}}; \ No newline at end of file +var _0x5566=['emit','removeListener','./openchannelQueue.events','remove','update'];(function(_0x315822,_0x1d4466){var _0x1525fd=function(_0x310311){while(--_0x310311){_0x315822['push'](_0x315822['shift']());}};_0x1525fd(++_0x1d4466);}(_0x5566,0x179));var _0x6556=function(_0x3dc2f1,_0xcdc605){_0x3dc2f1=_0x3dc2f1-0x0;var _0x5f2730=_0x5566[_0x3dc2f1];return _0x5f2730;};'use strict';var OpenchannelQueueEvents=require(_0x6556('0x0'));var events=['save',_0x6556('0x1'),_0x6556('0x2')];function createListener(_0x435340,_0x5cf550){return function(_0xd6a604){_0x5cf550[_0x6556('0x3')](_0x435340,_0xd6a604);};}function removeListener(_0x5792bd,_0x110857){return function(){OpenchannelQueueEvents[_0x6556('0x4')](_0x5792bd,_0x110857);};}exports['register']=function(_0x379718){for(var _0xc7ab6=0x0,_0xfd376a=events['length'];_0xc7ab6<_0xfd376a;_0xc7ab6++){var _0x2d5063=events[_0xc7ab6];var _0x35d991=createListener('openchannelQueue:'+_0x2d5063,_0x379718);OpenchannelQueueEvents['on'](_0x2d5063,_0x35d991);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 5629a37..2b533c7 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 _0x5007=['show','post','create','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x5007,0x1be));var _0x7500=function(_0x3336ea,_0x4d2ce4){_0x3336ea=_0x3336ea-0x0;var _0x3676d=_0x5007[_0x3336ea];return _0x3676d;};'use strict';var multer=require(_0x7500('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7500('0x1'));var express=require(_0x7500('0x2'));var router=express[_0x7500('0x3')]();var fs_extra=require(_0x7500('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7500('0x5'));var config=require(_0x7500('0x6'));var controller=require(_0x7500('0x7'));router[_0x7500('0x8')]('/',auth['isAuthenticated'](),controller[_0x7500('0x9')]);router[_0x7500('0x8')](_0x7500('0xa'),auth[_0x7500('0xb')](),controller[_0x7500('0xc')]);router[_0x7500('0x8')](_0x7500('0xd'),auth[_0x7500('0xb')](),controller[_0x7500('0xe')]);router[_0x7500('0xf')]('/',auth[_0x7500('0xb')](),controller[_0x7500('0x10')]);router['put']('/:id',auth[_0x7500('0xb')](),controller['update']);router[_0x7500('0x11')](_0x7500('0xd'),auth[_0x7500('0xb')](),controller[_0x7500('0x12')]);module[_0x7500('0x13')]=router; \ No newline at end of file +var _0xd8e6=['/:id','show','post','create','put','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x185241,_0x453cd6){var _0x1fa6c3=function(_0x1b1d26){while(--_0x1b1d26){_0x185241['push'](_0x185241['shift']());}};_0x1fa6c3(++_0x453cd6);}(_0xd8e6,0x16e));var _0x6d8e=function(_0x178064,_0x41896e){_0x178064=_0x178064-0x0;var _0x1d90fd=_0xd8e6[_0x178064];return _0x1d90fd;};'use strict';var multer=require(_0x6d8e('0x0'));var util=require('util');var path=require(_0x6d8e('0x1'));var timeout=require(_0x6d8e('0x2'));var express=require(_0x6d8e('0x3'));var router=express[_0x6d8e('0x4')]();var fs_extra=require(_0x6d8e('0x5'));var auth=require(_0x6d8e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6d8e('0x7'));var controller=require(_0x6d8e('0x8'));router['get']('/',auth[_0x6d8e('0x9')](),controller[_0x6d8e('0xa')]);router[_0x6d8e('0xb')](_0x6d8e('0xc'),auth[_0x6d8e('0x9')](),controller[_0x6d8e('0xd')]);router['get'](_0x6d8e('0xe'),auth[_0x6d8e('0x9')](),controller[_0x6d8e('0xf')]);router[_0x6d8e('0x10')]('/',auth['isAuthenticated'](),controller[_0x6d8e('0x11')]);router[_0x6d8e('0x12')]('/:id',auth[_0x6d8e('0x9')](),controller['update']);router[_0x6d8e('0x13')](_0x6d8e('0xe'),auth[_0x6d8e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 750a234..b480da3 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 _0xa573=['exports','STRING','DATE','moment','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa573,0x12f));var _0x3a57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa573[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x3a57('0x0'));var Sequelize=require(_0x3a57('0x1'));module[_0x3a57('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3a57('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3a57('0x4')]},'acceptAt':{'type':Sequelize[_0x3a57('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3a57('0x3')]}}; \ No newline at end of file +var _0x1961=['STRING','DATE','moment','sequelize','exports'];(function(_0x1cbaa2,_0x16f4d8){var _0x114440=function(_0x22d234){while(--_0x22d234){_0x1cbaa2['push'](_0x1cbaa2['shift']());}};_0x114440(++_0x16f4d8);}(_0x1961,0x15b));var _0x1196=function(_0x4df87e,_0x47f749){_0x4df87e=_0x4df87e-0x0;var _0x1329fe=_0x1961[_0x4df87e];return _0x1329fe;};'use strict';var moment=require(_0x1196('0x0'));var Sequelize=require(_0x1196('0x1'));module[_0x1196('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1196('0x3')]},'joinAt':{'type':Sequelize[_0x1196('0x4')]},'leaveAt':{'type':Sequelize[_0x1196('0x4')]},'acceptAt':{'type':Sequelize[_0x1196('0x4')]},'exitAt':{'type':Sequelize[_0x1196('0x4')]},'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 d30e381..a95160a 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 _0x74d3=['fieldName','type','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','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/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport'];(function(_0x331e83,_0x1f978b){var _0x4296dc=function(_0x3755ec){while(--_0x3755ec){_0x331e83['push'](_0x331e83['shift']());}};_0x4296dc(++_0x1f978b);}(_0x74d3,0x155));var _0x374d=function(_0x11f373,_0x200696){_0x11f373=_0x11f373-0x0;var _0xec7711=_0x74d3[_0x11f373];return _0xec7711;};'use strict';var emlformat=require(_0x374d('0x0'));var rimraf=require(_0x374d('0x1'));var zipdir=require(_0x374d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x374d('0x3'));var moment=require('moment');var BPromise=require(_0x374d('0x4'));var Mustache=require('mustache');var util=require(_0x374d('0x5'));var path=require(_0x374d('0x6'));var sox=require(_0x374d('0x7'));var csv=require(_0x374d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x374d('0x9'));var _=require(_0x374d('0xa'));var squel=require(_0x374d('0xb'));var crypto=require(_0x374d('0xc'));var jsforce=require(_0x374d('0xd'));var deskjs=require(_0x374d('0xe'));var toCsv=require(_0x374d('0x8'));var querystring=require('querystring');var Papa=require(_0x374d('0xf'));var Redis=require(_0x374d('0x10'));var authService=require(_0x374d('0x11'));var qs=require(_0x374d('0x12'));var as=require(_0x374d('0x13'));var hardwareService=require(_0x374d('0x14'));var logger=require(_0x374d('0x15'))(_0x374d('0x16'));var utils=require(_0x374d('0x17'));var config=require(_0x374d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x374d('0x19'))['db'];function respondWithStatusCode(_0x390aeb,_0x42dcaa){_0x42dcaa=_0x42dcaa||0xcc;return function(_0x251fe6){if(_0x251fe6){return _0x390aeb[_0x374d('0x1a')](_0x42dcaa);}return _0x390aeb[_0x374d('0x1b')](_0x42dcaa)[_0x374d('0x1c')]();};}function respondWithResult(_0x1bd410,_0x2505f0){_0x2505f0=_0x2505f0||0xc8;return function(_0x1967bb){if(_0x1967bb){return _0x1bd410[_0x374d('0x1b')](_0x2505f0)[_0x374d('0x1d')](_0x1967bb);}};}function respondWithFilteredResult(_0x471d35,_0x2f8e4b){return function(_0x33ba75){if(_0x33ba75){var _0xb534dd=typeof _0x2f8e4b[_0x374d('0x1e')]==='undefined'&&typeof _0x2f8e4b[_0x374d('0x1f')]===_0x374d('0x20');var _0x4dd3f1=_0x33ba75[_0x374d('0x21')];var _0x2128ec=_0xb534dd?0x0:_0x2f8e4b['offset'];var _0x2c55b3=_0xb534dd?_0x33ba75[_0x374d('0x21')]:_0x2f8e4b[_0x374d('0x1e')]+_0x2f8e4b['limit'];var _0x1b1659;if(_0x2c55b3>=_0x4dd3f1){_0x2c55b3=_0x4dd3f1;_0x1b1659=0xc8;}else{_0x1b1659=0xce;}_0x471d35['status'](_0x1b1659);return _0x471d35[_0x374d('0x22')](_0x374d('0x23'),_0x2128ec+'-'+_0x2c55b3+'/'+_0x4dd3f1)[_0x374d('0x1d')](_0x33ba75);}return null;};}function patchUpdates(_0xbe257b){return function(_0x1ab40a){try{jsonpatch[_0x374d('0x24')](_0x1ab40a,_0xbe257b,!![]);}catch(_0x2350c4){return BPromise[_0x374d('0x25')](_0x2350c4);}return _0x1ab40a[_0x374d('0x26')]();};}function saveUpdates(_0x18b7e,_0x597598){return function(_0x3a4517){if(_0x3a4517){return _0x3a4517[_0x374d('0x27')](_0x18b7e)[_0x374d('0x28')](function(_0x2b32d1){return _0x2b32d1;});}return null;};}function removeEntity(_0x2616ac,_0x18e369){return function(_0x4d27d9){if(_0x4d27d9){return _0x4d27d9[_0x374d('0x29')]()[_0x374d('0x28')](function(){_0x2616ac[_0x374d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d5312,_0x1224fe){return function(_0x30290b){if(!_0x30290b){_0x2d5312['sendStatus'](0x194);}return _0x30290b;};}function handleError(_0x2281e2,_0x2404a6){_0x2404a6=_0x2404a6||0x1f4;return function(_0x145c55){logger[_0x374d('0x2a')](_0x145c55[_0x374d('0x2b')]);if(_0x145c55['name']){delete _0x145c55[_0x374d('0x2c')];}_0x2281e2[_0x374d('0x1b')](_0x2404a6)[_0x374d('0x2d')](_0x145c55);};}exports[_0x374d('0x2e')]=function(_0x6420a2,_0x59d90e){var _0x89fb1f={},_0x2879b8={},_0x17247f={'count':0x0,'rows':[]};var _0x322d85=_[_0x374d('0x2f')](db[_0x374d('0x30')]['rawAttributes'],function(_0x4a98bc){return{'name':_0x4a98bc[_0x374d('0x31')],'type':_0x4a98bc[_0x374d('0x32')]['key']};});_0x2879b8['model']=_[_0x374d('0x2f')](_0x322d85,_0x374d('0x2c'));_0x2879b8[_0x374d('0x33')]=_['keys'](_0x6420a2[_0x374d('0x33')]);_0x2879b8[_0x374d('0x34')]=_[_0x374d('0x35')](_0x2879b8['model'],_0x2879b8[_0x374d('0x33')]);_0x89fb1f['attributes']=_[_0x374d('0x35')](_0x2879b8['model'],qs[_0x374d('0x36')](_0x6420a2['query'][_0x374d('0x36')]));_0x89fb1f[_0x374d('0x37')]=_0x89fb1f[_0x374d('0x37')][_0x374d('0x38')]?_0x89fb1f[_0x374d('0x37')]:_0x2879b8[_0x374d('0x39')];if(!_0x6420a2[_0x374d('0x33')][_0x374d('0x3a')](_0x374d('0x3b'))){_0x89fb1f[_0x374d('0x1f')]=qs['limit'](_0x6420a2['query'][_0x374d('0x1f')]);_0x89fb1f[_0x374d('0x1e')]=qs[_0x374d('0x1e')](_0x6420a2[_0x374d('0x33')]['offset']);}_0x89fb1f['order']=qs['sort'](_0x6420a2[_0x374d('0x33')][_0x374d('0x3c')]);_0x89fb1f[_0x374d('0x3d')]=qs[_0x374d('0x34')](_['pick'](_0x6420a2['query'],_0x2879b8[_0x374d('0x34')]),_0x322d85);if(_0x6420a2['query']['filter']){_0x89fb1f[_0x374d('0x3d')]=_[_0x374d('0x3e')](_0x89fb1f['where'],{'$or':_[_0x374d('0x2f')](_0x322d85,function(_0xb9f2e8){if(_0xb9f2e8[_0x374d('0x32')]!==_0x374d('0x3f')){var _0x53e8ab={};_0x53e8ab[_0xb9f2e8[_0x374d('0x2c')]]={'$like':'%'+_0x6420a2['query'][_0x374d('0x40')]+'%'};return _0x53e8ab;}})});}_0x89fb1f=_['merge']({},_0x89fb1f,_0x6420a2[_0x374d('0x41')]);var _0x34614b={'where':_0x89fb1f['where']};return db[_0x374d('0x30')]['count'](_0x34614b)[_0x374d('0x28')](function(_0x136b35){_0x17247f[_0x374d('0x21')]=_0x136b35;if(_0x6420a2[_0x374d('0x33')][_0x374d('0x42')]){_0x89fb1f[_0x374d('0x43')]=[{'all':!![]}];}return db[_0x374d('0x30')][_0x374d('0x44')](_0x89fb1f);})[_0x374d('0x28')](function(_0x4a5d78){_0x17247f['rows']=_0x4a5d78;return _0x17247f;})[_0x374d('0x28')](respondWithFilteredResult(_0x59d90e,_0x89fb1f))['catch'](handleError(_0x59d90e,null));};exports[_0x374d('0x45')]=function(_0x8b68e3,_0x5384f0){var _0x578170={'raw':!![],'where':{'id':_0x8b68e3[_0x374d('0x46')]['id']}},_0x5ecf71={};_0x5ecf71[_0x374d('0x39')]=_[_0x374d('0x47')](db[_0x374d('0x30')][_0x374d('0x48')]);_0x5ecf71[_0x374d('0x33')]=_['keys'](_0x8b68e3['query']);_0x5ecf71[_0x374d('0x34')]=_[_0x374d('0x35')](_0x5ecf71[_0x374d('0x39')],_0x5ecf71[_0x374d('0x33')]);_0x578170[_0x374d('0x37')]=_['intersection'](_0x5ecf71['model'],qs[_0x374d('0x36')](_0x8b68e3[_0x374d('0x33')]['fields']));_0x578170[_0x374d('0x37')]=_0x578170[_0x374d('0x37')][_0x374d('0x38')]?_0x578170['attributes']:_0x5ecf71[_0x374d('0x39')];if(_0x8b68e3[_0x374d('0x33')][_0x374d('0x42')]){_0x578170['include']=[{'all':!![]}];}_0x578170=_[_0x374d('0x3e')]({},_0x578170,_0x8b68e3['options']);return db[_0x374d('0x30')][_0x374d('0x49')](_0x578170)[_0x374d('0x28')](handleEntityNotFound(_0x5384f0,null))[_0x374d('0x28')](respondWithResult(_0x5384f0,null))[_0x374d('0x4a')](handleError(_0x5384f0,null));};exports['create']=function(_0x5a6d07,_0x58eb94){return db[_0x374d('0x30')][_0x374d('0x4b')](_0x5a6d07[_0x374d('0x4c')],{})[_0x374d('0x28')](respondWithResult(_0x58eb94,0xc9))[_0x374d('0x4a')](handleError(_0x58eb94,null));};exports[_0x374d('0x27')]=function(_0x3a5f9b,_0x27d02c){if(_0x3a5f9b[_0x374d('0x4c')]['id']){delete _0x3a5f9b[_0x374d('0x4c')]['id'];}return db[_0x374d('0x30')]['find']({'where':{'id':_0x3a5f9b[_0x374d('0x46')]['id']}})[_0x374d('0x28')](handleEntityNotFound(_0x27d02c,null))[_0x374d('0x28')](saveUpdates(_0x3a5f9b[_0x374d('0x4c')],null))['then'](respondWithResult(_0x27d02c,null))[_0x374d('0x4a')](handleError(_0x27d02c,null));};exports[_0x374d('0x29')]=function(_0x1d71c8,_0x561fe6){return db['OpenchannelQueueReport'][_0x374d('0x49')]({'where':{'id':_0x1d71c8[_0x374d('0x46')]['id']}})[_0x374d('0x28')](handleEntityNotFound(_0x561fe6,null))[_0x374d('0x28')](removeEntity(_0x561fe6,null))[_0x374d('0x4a')](handleError(_0x561fe6,null));};exports[_0x374d('0x4d')]=function(_0x4a6967,_0x2daea2){return db[_0x374d('0x30')][_0x374d('0x4d')]()[_0x374d('0x28')](respondWithResult(_0x2daea2,null))['catch'](handleError(_0x2daea2,null));}; \ No newline at end of file +var _0x3052=['set','Content-Range','save','then','destroy','error','stack','name','index','OpenchannelQueueReport','rawAttributes','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','create','update','body','params','describe','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x2c8bf7,_0x4d6b00){var _0x15e0e3=function(_0x4a128a){while(--_0x4a128a){_0x2c8bf7['push'](_0x2c8bf7['shift']());}};_0x15e0e3(++_0x4d6b00);}(_0x3052,0x1e0));var _0x2305=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3052[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2305('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2305('0x1'));var rp=require(_0x2305('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2305('0x3'));var util=require(_0x2305('0x4'));var path=require(_0x2305('0x5'));var sox=require(_0x2305('0x6'));var csv=require(_0x2305('0x7'));var ejs=require(_0x2305('0x8'));var fs=require('fs');var fs_extra=require(_0x2305('0x9'));var _=require(_0x2305('0xa'));var squel=require('squel');var crypto=require(_0x2305('0xb'));var jsforce=require(_0x2305('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2305('0x7'));var querystring=require(_0x2305('0xd'));var Papa=require(_0x2305('0xe'));var Redis=require(_0x2305('0xf'));var authService=require(_0x2305('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2305('0x11'));var hardwareService=require(_0x2305('0x12'));var logger=require(_0x2305('0x13'))(_0x2305('0x14'));var utils=require(_0x2305('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2305('0x16'))['db'];function respondWithStatusCode(_0x1451e9,_0x4b0a3a){_0x4b0a3a=_0x4b0a3a||0xcc;return function(_0x1b6b29){if(_0x1b6b29){return _0x1451e9[_0x2305('0x17')](_0x4b0a3a);}return _0x1451e9[_0x2305('0x18')](_0x4b0a3a)[_0x2305('0x19')]();};}function respondWithResult(_0x1cfc4d,_0x295565){_0x295565=_0x295565||0xc8;return function(_0x2f0558){if(_0x2f0558){return _0x1cfc4d['status'](_0x295565)[_0x2305('0x1a')](_0x2f0558);}};}function respondWithFilteredResult(_0x3b980e,_0x528ef9){return function(_0x4ce660){if(_0x4ce660){var _0x327e9e=typeof _0x528ef9[_0x2305('0x1b')]===_0x2305('0x1c')&&typeof _0x528ef9[_0x2305('0x1d')]===_0x2305('0x1c');var _0x178835=_0x4ce660[_0x2305('0x1e')];var _0x80ed70=_0x327e9e?0x0:_0x528ef9[_0x2305('0x1b')];var _0x2147e2=_0x327e9e?_0x4ce660['count']:_0x528ef9[_0x2305('0x1b')]+_0x528ef9[_0x2305('0x1d')];var _0x7f4ec6;if(_0x2147e2>=_0x178835){_0x2147e2=_0x178835;_0x7f4ec6=0xc8;}else{_0x7f4ec6=0xce;}_0x3b980e[_0x2305('0x18')](_0x7f4ec6);return _0x3b980e[_0x2305('0x1f')](_0x2305('0x20'),_0x80ed70+'-'+_0x2147e2+'/'+_0x178835)[_0x2305('0x1a')](_0x4ce660);}return null;};}function patchUpdates(_0x52f791){return function(_0x248855){try{jsonpatch['apply'](_0x248855,_0x52f791,!![]);}catch(_0x507060){return BPromise['reject'](_0x507060);}return _0x248855[_0x2305('0x21')]();};}function saveUpdates(_0x30b211,_0x395608){return function(_0x59e1ac){if(_0x59e1ac){return _0x59e1ac['update'](_0x30b211)[_0x2305('0x22')](function(_0x5b6049){return _0x5b6049;});}return null;};}function removeEntity(_0x292025,_0x19ff3d){return function(_0xee6360){if(_0xee6360){return _0xee6360[_0x2305('0x23')]()[_0x2305('0x22')](function(){_0x292025[_0x2305('0x18')](0xcc)[_0x2305('0x19')]();});}};}function handleEntityNotFound(_0x390561,_0x5ea2fa){return function(_0x473c47){if(!_0x473c47){_0x390561[_0x2305('0x17')](0x194);}return _0x473c47;};}function handleError(_0x2006ae,_0x878ead){_0x878ead=_0x878ead||0x1f4;return function(_0x1774f9){logger[_0x2305('0x24')](_0x1774f9[_0x2305('0x25')]);if(_0x1774f9['name']){delete _0x1774f9[_0x2305('0x26')];}_0x2006ae[_0x2305('0x18')](_0x878ead)['send'](_0x1774f9);};}exports[_0x2305('0x27')]=function(_0x244721,_0x5eff2a){var _0x4097f1={},_0x887b44={},_0x5026a0={'count':0x0,'rows':[]};var _0x13e862=_['map'](db[_0x2305('0x28')][_0x2305('0x29')],function(_0x3aacfe){return{'name':_0x3aacfe['fieldName'],'type':_0x3aacfe['type'][_0x2305('0x2a')]};});_0x887b44[_0x2305('0x2b')]=_[_0x2305('0x2c')](_0x13e862,'name');_0x887b44['query']=_[_0x2305('0x2d')](_0x244721[_0x2305('0x2e')]);_0x887b44[_0x2305('0x2f')]=_[_0x2305('0x30')](_0x887b44[_0x2305('0x2b')],_0x887b44[_0x2305('0x2e')]);_0x4097f1['attributes']=_['intersection'](_0x887b44['model'],qs[_0x2305('0x31')](_0x244721[_0x2305('0x2e')][_0x2305('0x31')]));_0x4097f1[_0x2305('0x32')]=_0x4097f1[_0x2305('0x32')][_0x2305('0x33')]?_0x4097f1[_0x2305('0x32')]:_0x887b44[_0x2305('0x2b')];if(!_0x244721[_0x2305('0x2e')][_0x2305('0x34')](_0x2305('0x35'))){_0x4097f1['limit']=qs[_0x2305('0x1d')](_0x244721[_0x2305('0x2e')][_0x2305('0x1d')]);_0x4097f1['offset']=qs[_0x2305('0x1b')](_0x244721[_0x2305('0x2e')][_0x2305('0x1b')]);}_0x4097f1[_0x2305('0x36')]=qs[_0x2305('0x37')](_0x244721[_0x2305('0x2e')][_0x2305('0x37')]);_0x4097f1[_0x2305('0x38')]=qs[_0x2305('0x2f')](_[_0x2305('0x39')](_0x244721['query'],_0x887b44[_0x2305('0x2f')]),_0x13e862);if(_0x244721[_0x2305('0x2e')][_0x2305('0x3a')]){_0x4097f1[_0x2305('0x38')]=_['merge'](_0x4097f1[_0x2305('0x38')],{'$or':_[_0x2305('0x2c')](_0x13e862,function(_0x15c94a){if(_0x15c94a[_0x2305('0x3b')]!==_0x2305('0x3c')){var _0x1d54d7={};_0x1d54d7[_0x15c94a[_0x2305('0x26')]]={'$like':'%'+_0x244721[_0x2305('0x2e')]['filter']+'%'};return _0x1d54d7;}})});}_0x4097f1=_[_0x2305('0x3d')]({},_0x4097f1,_0x244721[_0x2305('0x3e')]);var _0x3abe13={'where':_0x4097f1[_0x2305('0x38')]};return db[_0x2305('0x28')][_0x2305('0x1e')](_0x3abe13)[_0x2305('0x22')](function(_0x17d292){_0x5026a0[_0x2305('0x1e')]=_0x17d292;if(_0x244721['query'][_0x2305('0x3f')]){_0x4097f1[_0x2305('0x40')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x2305('0x41')](_0x4097f1);})[_0x2305('0x22')](function(_0x2cb126){_0x5026a0[_0x2305('0x42')]=_0x2cb126;return _0x5026a0;})[_0x2305('0x22')](respondWithFilteredResult(_0x5eff2a,_0x4097f1))[_0x2305('0x43')](handleError(_0x5eff2a,null));};exports['show']=function(_0xcf2875,_0x2f38ef){var _0x305649={'raw':!![],'where':{'id':_0xcf2875['params']['id']}},_0x500f31={};_0x500f31[_0x2305('0x2b')]=_[_0x2305('0x2d')](db[_0x2305('0x28')][_0x2305('0x29')]);_0x500f31[_0x2305('0x2e')]=_['keys'](_0xcf2875['query']);_0x500f31[_0x2305('0x2f')]=_[_0x2305('0x30')](_0x500f31[_0x2305('0x2b')],_0x500f31[_0x2305('0x2e')]);_0x305649[_0x2305('0x32')]=_[_0x2305('0x30')](_0x500f31[_0x2305('0x2b')],qs['fields'](_0xcf2875[_0x2305('0x2e')][_0x2305('0x31')]));_0x305649[_0x2305('0x32')]=_0x305649[_0x2305('0x32')][_0x2305('0x33')]?_0x305649[_0x2305('0x32')]:_0x500f31['model'];if(_0xcf2875[_0x2305('0x2e')][_0x2305('0x3f')]){_0x305649[_0x2305('0x40')]=[{'all':!![]}];}_0x305649=_[_0x2305('0x3d')]({},_0x305649,_0xcf2875['options']);return db['OpenchannelQueueReport']['find'](_0x305649)[_0x2305('0x22')](handleEntityNotFound(_0x2f38ef,null))[_0x2305('0x22')](respondWithResult(_0x2f38ef,null))['catch'](handleError(_0x2f38ef,null));};exports[_0x2305('0x44')]=function(_0x2a39ee,_0x3c2a80){return db[_0x2305('0x28')][_0x2305('0x44')](_0x2a39ee['body'],{})[_0x2305('0x22')](respondWithResult(_0x3c2a80,0xc9))[_0x2305('0x43')](handleError(_0x3c2a80,null));};exports[_0x2305('0x45')]=function(_0x240491,_0x33d1b5){if(_0x240491[_0x2305('0x46')]['id']){delete _0x240491[_0x2305('0x46')]['id'];}return db[_0x2305('0x28')]['find']({'where':{'id':_0x240491[_0x2305('0x47')]['id']}})['then'](handleEntityNotFound(_0x33d1b5,null))['then'](saveUpdates(_0x240491[_0x2305('0x46')],null))[_0x2305('0x22')](respondWithResult(_0x33d1b5,null))[_0x2305('0x43')](handleError(_0x33d1b5,null));};exports[_0x2305('0x23')]=function(_0x1e034f,_0x15ab31){return db[_0x2305('0x28')]['find']({'where':{'id':_0x1e034f[_0x2305('0x47')]['id']}})[_0x2305('0x22')](handleEntityNotFound(_0x15ab31,null))[_0x2305('0x22')](removeEntity(_0x15ab31,null))[_0x2305('0x43')](handleError(_0x15ab31,null));};exports['describe']=function(_0x39979e,_0xd0b9e6){return db[_0x2305('0x28')][_0x2305('0x48')]()[_0x2305('0x22')](respondWithResult(_0xd0b9e6,null))[_0x2305('0x43')](handleError(_0xd0b9e6,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index c69536a..9c52a87 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 _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x2b6430,_0x584d96){var _0x48fed1=function(_0x499ee5){while(--_0x499ee5){_0x2b6430['push'](_0x2b6430['shift']());}};_0x48fed1(++_0x584d96);}(_0x2ef3,0xba));var _0x32ef=function(_0x50224d,_0xc08d8e){_0x50224d=_0x50224d-0x0;var _0x561cda=_0x2ef3[_0x50224d];return _0x561cda;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'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(_0x3027b1,_0x282484){var _0x59447f=function(_0x20adff){while(--_0x20adff){_0x3027b1['push'](_0x3027b1['shift']());}};_0x59447f(++_0x282484);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0x5fc3[_0x4f0c2b];return _0x526436;};'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 232459e..6daae40 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 _0xea28=['request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','debug','UpdateOpenchannelQueueReport','update','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x750888,_0x22fd3f){var _0x30b506=function(_0x223ae4){while(--_0x223ae4){_0x750888['push'](_0x750888['shift']());}};_0x30b506(++_0x22fd3f);}(_0xea28,0x13a));var _0x8ea2=function(_0x1ea61d,_0x5142c1){_0x1ea61d=_0x1ea61d-0x0;var _0x3f0817=_0xea28[_0x1ea61d];return _0x3f0817;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435d78,_0xb7f278,_0x39b1fa){return new BPromise(function(_0x28b5b8,_0x929304){return client[_0x8ea2('0xc')](_0x435d78,_0x39b1fa)[_0x8ea2('0xd')](function(_0x3de4a1){logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xb7f278,_0x8ea2('0x10'),JSON[_0x8ea2('0x11')](_0x3de4a1));if(_0x3de4a1[_0x8ea2('0x12')]){if(_0x3de4a1['error'][_0x8ea2('0x13')]===0x1f4){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x929304(_0x3de4a1['error'][_0x8ea2('0x14')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x28b5b8(_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);}else{logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));_0x28b5b8(_0x3de4a1[_0x8ea2('0x15')][_0x8ea2('0x14')]);}})[_0x8ea2('0x16')](function(_0x2dfa7c){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x2dfa7c);_0x929304(_0x2dfa7c);});});}exports[_0x8ea2('0x17')]=function(_0x1b64cf){var _0x174ef2=this;return new Promise(function(_0x467045,_0x2a0329){return db[_0x8ea2('0x18')][_0x8ea2('0x19')](_0x1b64cf[_0x8ea2('0x1a')],{'raw':_0x1b64cf[_0x8ea2('0x1b')]?_0x1b64cf['options']['raw']===undefined?!![]:![]:!![]})[_0x8ea2('0xd')](function(_0x248c18){logger[_0x8ea2('0xe')]('CreateOpenchannelQueueReport',_0x1b64cf);logger[_0x8ea2('0x1c')](_0x8ea2('0x17'),_0x1b64cf,JSON['stringify'](_0x248c18));_0x467045(_0x248c18);})[_0x8ea2('0x16')](function(_0x283f00){logger[_0x8ea2('0x12')](_0x8ea2('0x17'),_0x283f00[_0x8ea2('0x14')],_0x1b64cf);_0x2a0329(_0x174ef2[_0x8ea2('0x12')](0x1f4,_0x283f00[_0x8ea2('0x14')]));});});};exports[_0x8ea2('0x1d')]=function(_0x18ec34){var _0x4d5030=this;return new Promise(function(_0x433bc5,_0x4f48bd){return db[_0x8ea2('0x18')][_0x8ea2('0x1e')](_0x18ec34[_0x8ea2('0x1a')],{'raw':_0x18ec34['options']?_0x18ec34['options'][_0x8ea2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18ec34['options']?_0x18ec34[_0x8ea2('0x1b')]['where']||null:null,'attributes':_0x18ec34[_0x8ea2('0x1b')]?_0x18ec34[_0x8ea2('0x1b')][_0x8ea2('0x20')]||null:null,'limit':_0x18ec34[_0x8ea2('0x1b')]?_0x18ec34['options']['limit']||null:null})[_0x8ea2('0xd')](function(_0x4da5b3){logger[_0x8ea2('0xe')](_0x8ea2('0x1d'),_0x18ec34);logger[_0x8ea2('0x1c')](_0x8ea2('0x1d'),_0x18ec34,JSON[_0x8ea2('0x11')](_0x4da5b3));_0x433bc5(_0x4da5b3);})[_0x8ea2('0x16')](function(_0x32e225){logger[_0x8ea2('0x12')](_0x8ea2('0x1d'),_0x32e225[_0x8ea2('0x14')],_0x18ec34);_0x4f48bd(_0x4d5030['error'](0x1f4,_0x32e225['message']));});});}; \ No newline at end of file +var _0x15b8=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','util','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15b8,0xcd));var _0x815b=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x15b8[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var moment=require(_0x815b('0x1'));var BPromise=require(_0x815b('0x2'));var rs=require(_0x815b('0x3'));var fs=require('fs');var Redis=require(_0x815b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x815b('0x5'));var logger=require(_0x815b('0x6'))(_0x815b('0x7'));var config=require(_0x815b('0x8'));var jayson=require(_0x815b('0x9'));var client=jayson[_0x815b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9fc0,_0xdfdf6,_0x26119a){return new BPromise(function(_0x175053,_0x2170c5){return client[_0x815b('0xb')](_0x1e9fc0,_0x26119a)[_0x815b('0xc')](function(_0x221ce4){logger[_0x815b('0xd')](_0x815b('0xe'),_0xdfdf6,_0x815b('0xf'));logger[_0x815b('0x10')](_0x815b('0x11'),_0xdfdf6,_0x815b('0xf'),JSON[_0x815b('0x12')](_0x221ce4));if(_0x221ce4[_0x815b('0x13')]){if(_0x221ce4[_0x815b('0x13')][_0x815b('0x14')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xdfdf6,_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);return _0x2170c5(_0x221ce4['error']['message']);}logger['error'](_0x815b('0xe'),_0xdfdf6,_0x221ce4['error']['message']);return _0x175053(_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);}else{logger[_0x815b('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xdfdf6,'request\x20sent');_0x175053(_0x221ce4[_0x815b('0x16')][_0x815b('0x15')]);}})[_0x815b('0x17')](function(_0x4078db){logger[_0x815b('0x13')](_0x815b('0xe'),_0xdfdf6,_0x4078db);_0x2170c5(_0x4078db);});});}exports[_0x815b('0x18')]=function(_0x92d86a){var _0x26a8a3=this;return new Promise(function(_0x2fa2bd,_0x2ade43){return db[_0x815b('0x19')][_0x815b('0x1a')](_0x92d86a['body'],{'raw':_0x92d86a[_0x815b('0x1b')]?_0x92d86a[_0x815b('0x1b')][_0x815b('0x1c')]===undefined?!![]:![]:!![]})[_0x815b('0xc')](function(_0x3f710c){logger['info'](_0x815b('0x18'),_0x92d86a);logger[_0x815b('0x10')](_0x815b('0x18'),_0x92d86a,JSON['stringify'](_0x3f710c));_0x2fa2bd(_0x3f710c);})['catch'](function(_0x3ffdb7){logger[_0x815b('0x13')](_0x815b('0x18'),_0x3ffdb7[_0x815b('0x15')],_0x92d86a);_0x2ade43(_0x26a8a3[_0x815b('0x13')](0x1f4,_0x3ffdb7[_0x815b('0x15')]));});});};exports[_0x815b('0x1d')]=function(_0x480c89){var _0x4a2431=this;return new Promise(function(_0x3be736,_0x2fa0df){return db[_0x815b('0x19')][_0x815b('0x1e')](_0x480c89[_0x815b('0x1f')],{'raw':_0x480c89[_0x815b('0x1b')]?_0x480c89[_0x815b('0x1b')][_0x815b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480c89['options']?_0x480c89[_0x815b('0x1b')][_0x815b('0x20')]||null:null,'attributes':_0x480c89[_0x815b('0x1b')]?_0x480c89['options'][_0x815b('0x21')]||null:null,'limit':_0x480c89[_0x815b('0x1b')]?_0x480c89['options'][_0x815b('0x22')]||null:null})[_0x815b('0xc')](function(_0x1b1b13){logger[_0x815b('0xd')](_0x815b('0x1d'),_0x480c89);logger[_0x815b('0x10')](_0x815b('0x1d'),_0x480c89,JSON[_0x815b('0x12')](_0x1b1b13));_0x3be736(_0x1b1b13);})[_0x815b('0x17')](function(_0x3f11bd){logger['error'](_0x815b('0x1d'),_0x3f11bd[_0x815b('0x15')],_0x480c89);_0x2fa0df(_0x4a2431[_0x815b('0x13')](0x1f4,_0x3f11bd[_0x815b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 7454388..2de1a1c 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 _0x9fea=['isAuthenticated','describe','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get'];(function(_0x3eace6,_0x2569e5){var _0x528ceb=function(_0x5cf0b6){while(--_0x5cf0b6){_0x3eace6['push'](_0x3eace6['shift']());}};_0x528ceb(++_0x2569e5);}(_0x9fea,0x197));var _0xa9fe=function(_0x4420e4,_0x2c1efc){_0x4420e4=_0x4420e4-0x0;var _0x1ab5eb=_0x9fea[_0x4420e4];return _0x1ab5eb;};'use strict';var multer=require(_0xa9fe('0x0'));var util=require(_0xa9fe('0x1'));var path=require(_0xa9fe('0x2'));var timeout=require(_0xa9fe('0x3'));var express=require(_0xa9fe('0x4'));var router=express[_0xa9fe('0x5')]();var fs_extra=require(_0xa9fe('0x6'));var auth=require(_0xa9fe('0x7'));var interaction=require(_0xa9fe('0x8'));var config=require('../../config/environment');var controller=require(_0xa9fe('0x9'));router[_0xa9fe('0xa')]('/',auth[_0xa9fe('0xb')](),controller['index']);router[_0xa9fe('0xa')]('/describe',auth[_0xa9fe('0xb')](),controller[_0xa9fe('0xc')]);router['get']('/:id',auth[_0xa9fe('0xb')](),controller['show']);router[_0xa9fe('0xd')]('/',auth[_0xa9fe('0xb')](),controller[_0xa9fe('0xe')]);router['put'](_0xa9fe('0xf'),auth[_0xa9fe('0xb')](),controller[_0xa9fe('0x10')]);router[_0xa9fe('0x11')](_0xa9fe('0xf'),auth[_0xa9fe('0xb')](),controller[_0xa9fe('0x12')]);module['exports']=router; \ No newline at end of file +var _0x13a0=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','destroy','exports','multer'];(function(_0x35f33c,_0x295efb){var _0x5a578b=function(_0x1e8ce7){while(--_0x1e8ce7){_0x35f33c['push'](_0x35f33c['shift']());}};_0x5a578b(++_0x295efb);}(_0x13a0,0x17b));var _0x013a=function(_0xd5709b,_0x101823){_0xd5709b=_0xd5709b-0x0;var _0x3dc484=_0x13a0[_0xd5709b];return _0x3dc484;};'use strict';var multer=require(_0x013a('0x0'));var util=require(_0x013a('0x1'));var path=require(_0x013a('0x2'));var timeout=require(_0x013a('0x3'));var express=require(_0x013a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x013a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x013a('0x6'));var controller=require(_0x013a('0x7'));router[_0x013a('0x8')]('/',auth[_0x013a('0x9')](),controller[_0x013a('0xa')]);router[_0x013a('0x8')](_0x013a('0xb'),auth[_0x013a('0x9')](),controller['describe']);router[_0x013a('0x8')](_0x013a('0xc'),auth['isAuthenticated'](),controller[_0x013a('0xd')]);router['post']('/',auth[_0x013a('0x9')](),controller[_0x013a('0xe')]);router[_0x013a('0xf')](_0x013a('0xc'),auth[_0x013a('0x9')](),controller['update']);router[_0x013a('0x10')](_0x013a('0xc'),auth[_0x013a('0x9')](),controller[_0x013a('0x11')]);module[_0x013a('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index efbe2c5..fc2c388 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x8ba6ac,_0xe23fc9){var _0x23d1bc=function(_0x3bfb33){while(--_0x3bfb33){_0x8ba6ac['push'](_0x8ba6ac['shift']());}};_0x23d1bc(++_0xe23fc9);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a4e84,_0x4eea00){_0x3a4e84=_0x3a4e84-0x0;var _0x56cc8b=_0xedd9[_0x3a4e84];return _0x56cc8b;};'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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x5c96dd,_0x3017af){var _0x20416f=function(_0x30a54e){while(--_0x30a54e){_0x5c96dd['push'](_0x5c96dd['shift']());}};_0x20416f(++_0x3017af);}(_0x34e8,0x12c));var _0x834e=function(_0x489b13,_0x431a3c){_0x489b13=_0x489b13-0x0;var _0x55364a=_0x34e8[_0x489b13];return _0x55364a;};'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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index db68320..e8918f4 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 _0x1580=['limit','set','Content-Range','apply','update','then','name','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','count'];(function(_0x4b321d,_0x270770){var _0x16b3ef=function(_0x3b5aa1){while(--_0x3b5aa1){_0x4b321d['push'](_0x4b321d['shift']());}};_0x16b3ef(++_0x270770);}(_0x1580,0x6f));var _0x0158=function(_0x49c5ab,_0xdd7c55){_0x49c5ab=_0x49c5ab-0x0;var _0x48126c=_0x1580[_0x49c5ab];return _0x48126c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0158('0x0'));var zipdir=require(_0x0158('0x1'));var jsonpatch=require(_0x0158('0x2'));var rp=require(_0x0158('0x3'));var moment=require(_0x0158('0x4'));var BPromise=require(_0x0158('0x5'));var Mustache=require(_0x0158('0x6'));var util=require('util');var path=require(_0x0158('0x7'));var sox=require(_0x0158('0x8'));var csv=require(_0x0158('0x9'));var ejs=require(_0x0158('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0158('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0158('0x9'));var querystring=require(_0x0158('0xc'));var Papa=require('papaparse');var Redis=require(_0x0158('0xd'));var authService=require(_0x0158('0xe'));var qs=require(_0x0158('0xf'));var as=require(_0x0158('0x10'));var hardwareService=require(_0x0158('0x11'));var logger=require(_0x0158('0x12'))(_0x0158('0x13'));var utils=require(_0x0158('0x14'));var config=require(_0x0158('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0158('0x16'))['db'];function respondWithStatusCode(_0x230f06,_0x4e31dd){_0x4e31dd=_0x4e31dd||0xcc;return function(_0x4dd5e0){if(_0x4dd5e0){return _0x230f06[_0x0158('0x17')](_0x4e31dd);}return _0x230f06['status'](_0x4e31dd)[_0x0158('0x18')]();};}function respondWithResult(_0x792769,_0x475750){_0x475750=_0x475750||0xc8;return function(_0x581e97){if(_0x581e97){return _0x792769[_0x0158('0x19')](_0x475750)[_0x0158('0x1a')](_0x581e97);}};}function respondWithFilteredResult(_0x4d894a,_0x33c638){return function(_0x4c0be0){if(_0x4c0be0){var _0x496db7=typeof _0x33c638[_0x0158('0x1b')]==='undefined'&&typeof _0x33c638['limit']==='undefined';var _0x2c4403=_0x4c0be0[_0x0158('0x1c')];var _0x432b9d=_0x496db7?0x0:_0x33c638[_0x0158('0x1b')];var _0x369477=_0x496db7?_0x4c0be0[_0x0158('0x1c')]:_0x33c638[_0x0158('0x1b')]+_0x33c638[_0x0158('0x1d')];var _0x11eb7c;if(_0x369477>=_0x2c4403){_0x369477=_0x2c4403;_0x11eb7c=0xc8;}else{_0x11eb7c=0xce;}_0x4d894a['status'](_0x11eb7c);return _0x4d894a[_0x0158('0x1e')](_0x0158('0x1f'),_0x432b9d+'-'+_0x369477+'/'+_0x2c4403)['json'](_0x4c0be0);}return null;};}function patchUpdates(_0x59931f){return function(_0x4c3ea3){try{jsonpatch[_0x0158('0x20')](_0x4c3ea3,_0x59931f,!![]);}catch(_0x30049c){return BPromise['reject'](_0x30049c);}return _0x4c3ea3['save']();};}function saveUpdates(_0x51b093,_0x54d033){return function(_0x8ad6b8){if(_0x8ad6b8){return _0x8ad6b8[_0x0158('0x21')](_0x51b093)[_0x0158('0x22')](function(_0x50a69b){return _0x50a69b;});}return null;};}function removeEntity(_0x5ce000,_0x2f811c){return function(_0x362774){if(_0x362774){return _0x362774['destroy']()[_0x0158('0x22')](function(){_0x5ce000[_0x0158('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23a546,_0x3fb1c0){return function(_0x5e33c4){if(!_0x5e33c4){_0x23a546[_0x0158('0x17')](0x194);}return _0x5e33c4;};}function handleError(_0x5df752,_0x465975){_0x465975=_0x465975||0x1f4;return function(_0x3c4bdf){logger['error'](_0x3c4bdf['stack']);if(_0x3c4bdf[_0x0158('0x23')]){delete _0x3c4bdf[_0x0158('0x23')];}_0x5df752['status'](_0x465975)['send'](_0x3c4bdf);};}exports['index']=function(_0x57a9b5,_0x25a461){var _0x1d3ba0={},_0x3c619a={},_0x54686d={'count':0x0,'rows':[]};var _0x45d163=_[_0x0158('0x24')](db[_0x0158('0x25')][_0x0158('0x26')],function(_0x56cbfa){return{'name':_0x56cbfa[_0x0158('0x27')],'type':_0x56cbfa[_0x0158('0x28')][_0x0158('0x29')]};});_0x3c619a['model']=_[_0x0158('0x24')](_0x45d163,_0x0158('0x23'));_0x3c619a[_0x0158('0x2a')]=_[_0x0158('0x2b')](_0x57a9b5[_0x0158('0x2a')]);_0x3c619a[_0x0158('0x2c')]=_[_0x0158('0x2d')](_0x3c619a['model'],_0x3c619a[_0x0158('0x2a')]);_0x1d3ba0[_0x0158('0x2e')]=_[_0x0158('0x2d')](_0x3c619a[_0x0158('0x2f')],qs[_0x0158('0x30')](_0x57a9b5[_0x0158('0x2a')][_0x0158('0x30')]));_0x1d3ba0['attributes']=_0x1d3ba0[_0x0158('0x2e')][_0x0158('0x31')]?_0x1d3ba0[_0x0158('0x2e')]:_0x3c619a[_0x0158('0x2f')];if(!_0x57a9b5['query'][_0x0158('0x32')]('nolimit')){_0x1d3ba0[_0x0158('0x1d')]=qs[_0x0158('0x1d')](_0x57a9b5[_0x0158('0x2a')][_0x0158('0x1d')]);_0x1d3ba0[_0x0158('0x1b')]=qs['offset'](_0x57a9b5[_0x0158('0x2a')][_0x0158('0x1b')]);}_0x1d3ba0[_0x0158('0x33')]=qs[_0x0158('0x34')](_0x57a9b5['query'][_0x0158('0x34')]);_0x1d3ba0[_0x0158('0x35')]=qs[_0x0158('0x2c')](_[_0x0158('0x36')](_0x57a9b5['query'],_0x3c619a[_0x0158('0x2c')]),_0x45d163);if(_0x57a9b5['query'][_0x0158('0x37')]){_0x1d3ba0['where']=_[_0x0158('0x38')](_0x1d3ba0['where'],{'$or':_[_0x0158('0x24')](_0x45d163,function(_0x347846){if(_0x347846[_0x0158('0x28')]!==_0x0158('0x39')){var _0x1d209d={};_0x1d209d[_0x347846[_0x0158('0x23')]]={'$like':'%'+_0x57a9b5['query'][_0x0158('0x37')]+'%'};return _0x1d209d;}})});}_0x1d3ba0=_[_0x0158('0x38')]({},_0x1d3ba0,_0x57a9b5[_0x0158('0x3a')]);var _0xeac3a5={'where':_0x1d3ba0[_0x0158('0x35')]};return db['OpenchannelTransferReport']['count'](_0xeac3a5)['then'](function(_0x23ccdb){_0x54686d[_0x0158('0x1c')]=_0x23ccdb;if(_0x57a9b5['query'][_0x0158('0x3b')]){_0x1d3ba0[_0x0158('0x3c')]=[{'all':!![]}];}return db[_0x0158('0x25')][_0x0158('0x3d')](_0x1d3ba0);})['then'](function(_0x11c4f6){_0x54686d[_0x0158('0x3e')]=_0x11c4f6;return _0x54686d;})['then'](respondWithFilteredResult(_0x25a461,_0x1d3ba0))[_0x0158('0x3f')](handleError(_0x25a461,null));};exports[_0x0158('0x40')]=function(_0x48c0fe,_0x11d163){var _0x1d27c2={'raw':!![],'where':{'id':_0x48c0fe[_0x0158('0x41')]['id']}},_0x550436={};_0x550436[_0x0158('0x2f')]=_[_0x0158('0x2b')](db[_0x0158('0x25')]['rawAttributes']);_0x550436[_0x0158('0x2a')]=_[_0x0158('0x2b')](_0x48c0fe[_0x0158('0x2a')]);_0x550436[_0x0158('0x2c')]=_[_0x0158('0x2d')](_0x550436[_0x0158('0x2f')],_0x550436['query']);_0x1d27c2['attributes']=_['intersection'](_0x550436[_0x0158('0x2f')],qs[_0x0158('0x30')](_0x48c0fe[_0x0158('0x2a')][_0x0158('0x30')]));_0x1d27c2['attributes']=_0x1d27c2['attributes']['length']?_0x1d27c2[_0x0158('0x2e')]:_0x550436['model'];if(_0x48c0fe[_0x0158('0x2a')][_0x0158('0x3b')]){_0x1d27c2[_0x0158('0x3c')]=[{'all':!![]}];}_0x1d27c2=_[_0x0158('0x38')]({},_0x1d27c2,_0x48c0fe['options']);return db[_0x0158('0x25')]['find'](_0x1d27c2)[_0x0158('0x22')](handleEntityNotFound(_0x11d163,null))[_0x0158('0x22')](respondWithResult(_0x11d163,null))[_0x0158('0x3f')](handleError(_0x11d163,null));};exports[_0x0158('0x42')]=function(_0x2f7c02,_0xb244b9){return db[_0x0158('0x25')][_0x0158('0x42')](_0x2f7c02['body'],{})['then'](respondWithResult(_0xb244b9,0xc9))[_0x0158('0x3f')](handleError(_0xb244b9,null));};exports['update']=function(_0x27f82d,_0x51f3cc){if(_0x27f82d[_0x0158('0x43')]['id']){delete _0x27f82d[_0x0158('0x43')]['id'];}return db[_0x0158('0x25')]['find']({'where':{'id':_0x27f82d[_0x0158('0x41')]['id']}})['then'](handleEntityNotFound(_0x51f3cc,null))['then'](saveUpdates(_0x27f82d[_0x0158('0x43')],null))['then'](respondWithResult(_0x51f3cc,null))['catch'](handleError(_0x51f3cc,null));};exports[_0x0158('0x44')]=function(_0x3b839a,_0x3829f3){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x3b839a[_0x0158('0x41')]['id']}})['then'](handleEntityNotFound(_0x3829f3,null))[_0x0158('0x22')](removeEntity(_0x3829f3,null))[_0x0158('0x3f')](handleError(_0x3829f3,null));};exports['describe']=function(_0x43fd2f,_0x4fcfd2){return db[_0x0158('0x25')][_0x0158('0x45')]()['then'](respondWithResult(_0x4fcfd2,null))[_0x0158('0x3f')](handleError(_0x4fcfd2,null));}; \ No newline at end of file +var _0x02d8=['create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','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/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','apply','save','destroy','stack','name','index','map','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','then','rows','catch','show','params','rawAttributes','find'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x02d8,0x9a));var _0x802d=function(_0x4049ed,_0x210343){_0x4049ed=_0x4049ed-0x0;var _0x4c93a3=_0x02d8[_0x4049ed];return _0x4c93a3;};'use strict';var emlformat=require(_0x802d('0x0'));var rimraf=require(_0x802d('0x1'));var zipdir=require(_0x802d('0x2'));var jsonpatch=require(_0x802d('0x3'));var rp=require(_0x802d('0x4'));var moment=require(_0x802d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x802d('0x6'));var util=require('util');var path=require(_0x802d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x802d('0x8'));var fs=require('fs');var fs_extra=require(_0x802d('0x9'));var _=require(_0x802d('0xa'));var squel=require(_0x802d('0xb'));var crypto=require(_0x802d('0xc'));var jsforce=require(_0x802d('0xd'));var deskjs=require(_0x802d('0xe'));var toCsv=require(_0x802d('0xf'));var querystring=require('querystring');var Papa=require(_0x802d('0x10'));var Redis=require(_0x802d('0x11'));var authService=require(_0x802d('0x12'));var qs=require(_0x802d('0x13'));var as=require(_0x802d('0x14'));var hardwareService=require(_0x802d('0x15'));var logger=require(_0x802d('0x16'))('api');var utils=require(_0x802d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x802d('0x18'));var db=require(_0x802d('0x19'))['db'];function respondWithStatusCode(_0x49903b,_0x1785e0){_0x1785e0=_0x1785e0||0xcc;return function(_0x14e3ce){if(_0x14e3ce){return _0x49903b[_0x802d('0x1a')](_0x1785e0);}return _0x49903b['status'](_0x1785e0)[_0x802d('0x1b')]();};}function respondWithResult(_0xceb880,_0x330899){_0x330899=_0x330899||0xc8;return function(_0x142d93){if(_0x142d93){return _0xceb880[_0x802d('0x1c')](_0x330899)['json'](_0x142d93);}};}function respondWithFilteredResult(_0x3c1578,_0x44ee06){return function(_0x32edd9){if(_0x32edd9){var _0x17a6f5=typeof _0x44ee06[_0x802d('0x1d')]==='undefined'&&typeof _0x44ee06[_0x802d('0x1e')]===_0x802d('0x1f');var _0x40d6c=_0x32edd9[_0x802d('0x20')];var _0x41966d=_0x17a6f5?0x0:_0x44ee06[_0x802d('0x1d')];var _0x15e4ad=_0x17a6f5?_0x32edd9[_0x802d('0x20')]:_0x44ee06[_0x802d('0x1d')]+_0x44ee06[_0x802d('0x1e')];var _0x4f3678;if(_0x15e4ad>=_0x40d6c){_0x15e4ad=_0x40d6c;_0x4f3678=0xc8;}else{_0x4f3678=0xce;}_0x3c1578[_0x802d('0x1c')](_0x4f3678);return _0x3c1578[_0x802d('0x21')]('Content-Range',_0x41966d+'-'+_0x15e4ad+'/'+_0x40d6c)['json'](_0x32edd9);}return null;};}function patchUpdates(_0x476413){return function(_0x183390){try{jsonpatch[_0x802d('0x22')](_0x183390,_0x476413,!![]);}catch(_0x13e5a7){return BPromise['reject'](_0x13e5a7);}return _0x183390[_0x802d('0x23')]();};}function saveUpdates(_0x35a2a1,_0x325a5a){return function(_0x1fe7e8){if(_0x1fe7e8){return _0x1fe7e8['update'](_0x35a2a1)['then'](function(_0x1a313d){return _0x1a313d;});}return null;};}function removeEntity(_0x3979ae,_0x51f489){return function(_0x4012e2){if(_0x4012e2){return _0x4012e2[_0x802d('0x24')]()['then'](function(){_0x3979ae[_0x802d('0x1c')](0xcc)[_0x802d('0x1b')]();});}};}function handleEntityNotFound(_0x28e7cd,_0x45b6af){return function(_0x222aee){if(!_0x222aee){_0x28e7cd[_0x802d('0x1a')](0x194);}return _0x222aee;};}function handleError(_0x37f7b8,_0x41cbc0){_0x41cbc0=_0x41cbc0||0x1f4;return function(_0x4018a0){logger['error'](_0x4018a0[_0x802d('0x25')]);if(_0x4018a0[_0x802d('0x26')]){delete _0x4018a0[_0x802d('0x26')];}_0x37f7b8[_0x802d('0x1c')](_0x41cbc0)['send'](_0x4018a0);};}exports[_0x802d('0x27')]=function(_0x550fd8,_0x42b76d){var _0x89259b={},_0x2f7871={},_0x3ee621={'count':0x0,'rows':[]};var _0x24bd15=_[_0x802d('0x28')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x36b7c8){return{'name':_0x36b7c8[_0x802d('0x29')],'type':_0x36b7c8['type'][_0x802d('0x2a')]};});_0x2f7871[_0x802d('0x2b')]=_[_0x802d('0x28')](_0x24bd15,_0x802d('0x26'));_0x2f7871[_0x802d('0x2c')]=_[_0x802d('0x2d')](_0x550fd8[_0x802d('0x2c')]);_0x2f7871[_0x802d('0x2e')]=_['intersection'](_0x2f7871[_0x802d('0x2b')],_0x2f7871[_0x802d('0x2c')]);_0x89259b[_0x802d('0x2f')]=_[_0x802d('0x30')](_0x2f7871[_0x802d('0x2b')],qs['fields'](_0x550fd8[_0x802d('0x2c')][_0x802d('0x31')]));_0x89259b['attributes']=_0x89259b[_0x802d('0x2f')][_0x802d('0x32')]?_0x89259b[_0x802d('0x2f')]:_0x2f7871[_0x802d('0x2b')];if(!_0x550fd8[_0x802d('0x2c')][_0x802d('0x33')](_0x802d('0x34'))){_0x89259b[_0x802d('0x1e')]=qs['limit'](_0x550fd8[_0x802d('0x2c')]['limit']);_0x89259b[_0x802d('0x1d')]=qs[_0x802d('0x1d')](_0x550fd8['query']['offset']);}_0x89259b['order']=qs[_0x802d('0x35')](_0x550fd8['query'][_0x802d('0x35')]);_0x89259b[_0x802d('0x36')]=qs['filters'](_[_0x802d('0x37')](_0x550fd8[_0x802d('0x2c')],_0x2f7871[_0x802d('0x2e')]),_0x24bd15);if(_0x550fd8[_0x802d('0x2c')][_0x802d('0x38')]){_0x89259b[_0x802d('0x36')]=_[_0x802d('0x39')](_0x89259b[_0x802d('0x36')],{'$or':_[_0x802d('0x28')](_0x24bd15,function(_0x2980f6){if(_0x2980f6[_0x802d('0x3a')]!==_0x802d('0x3b')){var _0x56988b={};_0x56988b[_0x2980f6[_0x802d('0x26')]]={'$like':'%'+_0x550fd8[_0x802d('0x2c')][_0x802d('0x38')]+'%'};return _0x56988b;}})});}_0x89259b=_['merge']({},_0x89259b,_0x550fd8[_0x802d('0x3c')]);var _0x52c1d3={'where':_0x89259b['where']};return db[_0x802d('0x3d')][_0x802d('0x20')](_0x52c1d3)['then'](function(_0x33c7e3){_0x3ee621[_0x802d('0x20')]=_0x33c7e3;if(_0x550fd8[_0x802d('0x2c')][_0x802d('0x3e')]){_0x89259b[_0x802d('0x3f')]=[{'all':!![]}];}return db[_0x802d('0x3d')]['findAll'](_0x89259b);})[_0x802d('0x40')](function(_0x598a04){_0x3ee621[_0x802d('0x41')]=_0x598a04;return _0x3ee621;})[_0x802d('0x40')](respondWithFilteredResult(_0x42b76d,_0x89259b))[_0x802d('0x42')](handleError(_0x42b76d,null));};exports[_0x802d('0x43')]=function(_0x1b6e64,_0xcfc389){var _0x5aee00={'raw':!![],'where':{'id':_0x1b6e64[_0x802d('0x44')]['id']}},_0x4965cc={};_0x4965cc[_0x802d('0x2b')]=_[_0x802d('0x2d')](db[_0x802d('0x3d')][_0x802d('0x45')]);_0x4965cc[_0x802d('0x2c')]=_[_0x802d('0x2d')](_0x1b6e64['query']);_0x4965cc[_0x802d('0x2e')]=_[_0x802d('0x30')](_0x4965cc[_0x802d('0x2b')],_0x4965cc[_0x802d('0x2c')]);_0x5aee00[_0x802d('0x2f')]=_[_0x802d('0x30')](_0x4965cc[_0x802d('0x2b')],qs['fields'](_0x1b6e64[_0x802d('0x2c')]['fields']));_0x5aee00[_0x802d('0x2f')]=_0x5aee00[_0x802d('0x2f')]['length']?_0x5aee00[_0x802d('0x2f')]:_0x4965cc[_0x802d('0x2b')];if(_0x1b6e64[_0x802d('0x2c')][_0x802d('0x3e')]){_0x5aee00[_0x802d('0x3f')]=[{'all':!![]}];}_0x5aee00=_[_0x802d('0x39')]({},_0x5aee00,_0x1b6e64[_0x802d('0x3c')]);return db['OpenchannelTransferReport'][_0x802d('0x46')](_0x5aee00)['then'](handleEntityNotFound(_0xcfc389,null))[_0x802d('0x40')](respondWithResult(_0xcfc389,null))['catch'](handleError(_0xcfc389,null));};exports[_0x802d('0x47')]=function(_0x5af89b,_0x4f4553){return db[_0x802d('0x3d')][_0x802d('0x47')](_0x5af89b[_0x802d('0x48')],{})[_0x802d('0x40')](respondWithResult(_0x4f4553,0xc9))[_0x802d('0x42')](handleError(_0x4f4553,null));};exports[_0x802d('0x49')]=function(_0x231f0f,_0x26d3ce){if(_0x231f0f[_0x802d('0x48')]['id']){delete _0x231f0f['body']['id'];}return db['OpenchannelTransferReport'][_0x802d('0x46')]({'where':{'id':_0x231f0f[_0x802d('0x44')]['id']}})[_0x802d('0x40')](handleEntityNotFound(_0x26d3ce,null))['then'](saveUpdates(_0x231f0f[_0x802d('0x48')],null))[_0x802d('0x40')](respondWithResult(_0x26d3ce,null))[_0x802d('0x42')](handleError(_0x26d3ce,null));};exports[_0x802d('0x24')]=function(_0x44c86f,_0x4c6c29){return db[_0x802d('0x3d')][_0x802d('0x46')]({'where':{'id':_0x44c86f[_0x802d('0x44')]['id']}})[_0x802d('0x40')](handleEntityNotFound(_0x4c6c29,null))['then'](removeEntity(_0x4c6c29,null))['catch'](handleError(_0x4c6c29,null));};exports['describe']=function(_0x504cdc,_0x946ef7){return db[_0x802d('0x3d')][_0x802d('0x4a')]()[_0x802d('0x40')](respondWithResult(_0x946ef7,null))['catch'](handleError(_0x946ef7,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 316476a..5106c50 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 _0x0e2b=['bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','moment'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x0e2b,0x17d));var _0xb0e2=function(_0x486541,_0xdb9374){_0x486541=_0x486541-0x0;var _0xd92757=_0x0e2b[_0x486541];return _0xd92757;};'use strict';var _=require(_0xb0e2('0x0'));var util=require(_0xb0e2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb0e2('0x2'));var BPromise=require(_0xb0e2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0e2('0x4'));var rimraf=require(_0xb0e2('0x5'));var config=require(_0xb0e2('0x6'));var attributes=require(_0xb0e2('0x7'));module[_0xb0e2('0x8')]=function(_0x169339,_0x1dee48){return _0x169339['define'](_0xb0e2('0x9'),attributes,{'tableName':_0xb0e2('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb0e2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c70=['OpenchannelTransferReport','uniqueid','lodash','util','api','moment','bluebird','rimraf','./openchannelTransferReport.attributes','exports','define'];(function(_0x1d887f,_0x3737a5){var _0x4125b5=function(_0x1f93af){while(--_0x1f93af){_0x1d887f['push'](_0x1d887f['shift']());}};_0x4125b5(++_0x3737a5);}(_0x9c70,0xe9));var _0x09c7=function(_0x7be910,_0x2b381b){_0x7be910=_0x7be910-0x0;var _0x496ddf=_0x9c70[_0x7be910];return _0x496ddf;};'use strict';var _=require(_0x09c7('0x0'));var util=require(_0x09c7('0x1'));var logger=require('../../config/logger')(_0x09c7('0x2'));var moment=require(_0x09c7('0x3'));var BPromise=require(_0x09c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x09c7('0x5'));var config=require('../../config/environment');var attributes=require(_0x09c7('0x6'));module[_0x09c7('0x7')]=function(_0x2d31ff,_0x534910){return _0x2d31ff[_0x09c7('0x8')](_0x09c7('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x09c7('0xa'),'fields':[_0x09c7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 4344c7e..7da9d0e 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 _0xf9d5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis'];(function(_0x124752,_0x5a697b){var _0x4b476b=function(_0x42b2b6){while(--_0x42b2b6){_0x124752['push'](_0x124752['shift']());}};_0x4b476b(++_0x5a697b);}(_0xf9d5,0x122));var _0x5f9d=function(_0x18f441,_0x5dc25f){_0x18f441=_0x18f441-0x0;var _0x3fdba7=_0xf9d5[_0x18f441];return _0x3fdba7;};'use strict';var _=require('lodash');var util=require(_0x5f9d('0x0'));var moment=require(_0x5f9d('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f9d('0x2'));var fs=require('fs');var Redis=require(_0x5f9d('0x3'));var db=require(_0x5f9d('0x4'))['db'];var utils=require(_0x5f9d('0x5'));var logger=require(_0x5f9d('0x6'))(_0x5f9d('0x7'));var config=require(_0x5f9d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f9d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24999e,_0x38fb6b,_0x4fb9f7){return new BPromise(function(_0x3420b2,_0x23e865){return client[_0x5f9d('0xa')](_0x24999e,_0x4fb9f7)[_0x5f9d('0xb')](function(_0xcc3772){logger[_0x5f9d('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38fb6b,_0x5f9d('0xd'));logger[_0x5f9d('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x38fb6b,'request\x20sent',JSON[_0x5f9d('0xf')](_0xcc3772));if(_0xcc3772[_0x5f9d('0x10')]){if(_0xcc3772[_0x5f9d('0x10')]['code']===0x1f4){logger[_0x5f9d('0x10')](_0x5f9d('0x11'),_0x38fb6b,_0xcc3772[_0x5f9d('0x10')][_0x5f9d('0x12')]);return _0x23e865(_0xcc3772['error'][_0x5f9d('0x12')]);}logger[_0x5f9d('0x10')](_0x5f9d('0x11'),_0x38fb6b,_0xcc3772['error'][_0x5f9d('0x12')]);return _0x3420b2(_0xcc3772[_0x5f9d('0x10')]['message']);}else{logger['info'](_0x5f9d('0x11'),_0x38fb6b,_0x5f9d('0xd'));_0x3420b2(_0xcc3772[_0x5f9d('0x13')][_0x5f9d('0x12')]);}})[_0x5f9d('0x14')](function(_0x47f480){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x38fb6b,_0x47f480);_0x23e865(_0x47f480);});});} \ No newline at end of file +var _0x2b83=['request','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x24e560,_0x55092b){var _0x457a58=function(_0x3e1a96){while(--_0x3e1a96){_0x24e560['push'](_0x24e560['shift']());}};_0x457a58(++_0x55092b);}(_0x2b83,0x1d3));var _0x32b8=function(_0x1c4161,_0x3c3b25){_0x1c4161=_0x1c4161-0x0;var _0x2e3f51=_0x2b83[_0x1c4161];return _0x2e3f51;};'use strict';var _=require('lodash');var util=require(_0x32b8('0x0'));var moment=require(_0x32b8('0x1'));var BPromise=require('bluebird');var rs=require(_0x32b8('0x2'));var fs=require('fs');var Redis=require(_0x32b8('0x3'));var db=require(_0x32b8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x32b8('0x5'));var config=require(_0x32b8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x32b8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18150c,_0x342a03,_0x36bde3){return new BPromise(function(_0x10a967,_0x5cc6b2){return client[_0x32b8('0x8')](_0x18150c,_0x36bde3)[_0x32b8('0x9')](function(_0x48257a){logger['info'](_0x32b8('0xa'),_0x342a03,'request\x20sent');logger[_0x32b8('0xb')](_0x32b8('0xc'),_0x342a03,_0x32b8('0xd'),JSON[_0x32b8('0xe')](_0x48257a));if(_0x48257a['error']){if(_0x48257a[_0x32b8('0xf')][_0x32b8('0x10')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x342a03,_0x48257a[_0x32b8('0xf')]['message']);return _0x5cc6b2(_0x48257a[_0x32b8('0xf')]['message']);}logger[_0x32b8('0xf')](_0x32b8('0xa'),_0x342a03,_0x48257a[_0x32b8('0xf')][_0x32b8('0x11')]);return _0x10a967(_0x48257a[_0x32b8('0xf')]['message']);}else{logger['info'](_0x32b8('0xa'),_0x342a03,'request\x20sent');_0x10a967(_0x48257a['result']['message']);}})[_0x32b8('0x12')](function(_0x57a060){logger['error'](_0x32b8('0xa'),_0x342a03,_0x57a060);_0x5cc6b2(_0x57a060);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index c2922f5..d915cc8 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 _0x0aab=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','isAuthenticated','index','show','create','put','/:id','update','delete','destroy'];(function(_0x5b6919,_0x37d7e2){var _0x41fac6=function(_0xfc0464){while(--_0xfc0464){_0x5b6919['push'](_0x5b6919['shift']());}};_0x41fac6(++_0x37d7e2);}(_0x0aab,0x169));var _0xb0aa=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0x0aab[_0x725a4c];return _0x37b2cc;};'use strict';var multer=require(_0xb0aa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb0aa('0x1'));var express=require(_0xb0aa('0x2'));var router=express[_0xb0aa('0x3')]();var fs_extra=require(_0xb0aa('0x4'));var auth=require(_0xb0aa('0x5'));var interaction=require(_0xb0aa('0x6'));var config=require('../../config/environment');var controller=require(_0xb0aa('0x7'));router['get']('/',auth[_0xb0aa('0x8')](),controller[_0xb0aa('0x9')]);router['get']('/:id',auth[_0xb0aa('0x8')](),controller[_0xb0aa('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb0aa('0xb')]);router[_0xb0aa('0xc')](_0xb0aa('0xd'),auth[_0xb0aa('0x8')](),controller[_0xb0aa('0xe')]);router[_0xb0aa('0xf')](_0xb0aa('0xd'),auth[_0xb0aa('0x8')](),controller[_0xb0aa('0x10')]);module[_0xb0aa('0x11')]=router; \ No newline at end of file +var _0xb01a=['/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','show','post','create'];(function(_0x2c44c7,_0x2ff92c){var _0x566482=function(_0x25f753){while(--_0x25f753){_0x2c44c7['push'](_0x2c44c7['shift']());}};_0x566482(++_0x2ff92c);}(_0xb01a,0xe0));var _0xab01=function(_0x4c335d,_0x419504){_0x4c335d=_0x4c335d-0x0;var _0x947bcd=_0xb01a[_0x4c335d];return _0x947bcd;};'use strict';var multer=require(_0xab01('0x0'));var util=require(_0xab01('0x1'));var path=require(_0xab01('0x2'));var timeout=require(_0xab01('0x3'));var express=require(_0xab01('0x4'));var router=express[_0xab01('0x5')]();var fs_extra=require(_0xab01('0x6'));var auth=require(_0xab01('0x7'));var interaction=require(_0xab01('0x8'));var config=require(_0xab01('0x9'));var controller=require(_0xab01('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xab01('0xb')]('/:id',auth[_0xab01('0xc')](),controller[_0xab01('0xd')]);router[_0xab01('0xe')]('/',auth[_0xab01('0xc')](),controller[_0xab01('0xf')]);router['put'](_0xab01('0x10'),auth[_0xab01('0xc')](),controller[_0xab01('0x11')]);router[_0xab01('0x12')](_0xab01('0x10'),auth[_0xab01('0xc')](),controller['destroy']);module[_0xab01('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 0fda151..34a1639 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 _0x9eb1=['sequelize','STRING','name'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0x9eb1,0x18f));var _0x19eb=function(_0x518d6a,_0x5a0164){_0x518d6a=_0x518d6a-0x0;var _0x58446b=_0x9eb1[_0x518d6a];return _0x58446b;};'use strict';var Sequelize=require(_0x19eb('0x0'));module['exports']={'name':{'type':Sequelize[_0x19eb('0x1')],'unique':_0x19eb('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x19eb('0x1')]}}; \ No newline at end of file +var _0x165d=['name','STRING','sequelize'];(function(_0x6790c2,_0x43b69e){var _0x385c24=function(_0x44db5d){while(--_0x44db5d){_0x6790c2['push'](_0x6790c2['shift']());}};_0x385c24(++_0x43b69e);}(_0x165d,0x1a0));var _0xd165=function(_0x2f3c87,_0x25dcb6){_0x2f3c87=_0x2f3c87-0x0;var _0x136a06=_0x165d[_0x2f3c87];return _0x136a06;};'use strict';var Sequelize=require(_0xd165('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd165('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xd165('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 0b16d2d..c1b1694 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 _0x5b4a=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','Pause','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','Pauses','UserProfileResource','sendStatus','stack'];(function(_0x18475f,_0xcaaafe){var _0xb6bcf0=function(_0x33869c){while(--_0x33869c){_0x18475f['push'](_0x18475f['shift']());}};_0xb6bcf0(++_0xcaaafe);}(_0x5b4a,0xcf));var _0xa5b4=function(_0x55dcaa,_0x55f333){_0x55dcaa=_0x55dcaa-0x0;var _0x5aea42=_0x5b4a[_0x55dcaa];return _0x5aea42;};'use strict';var emlformat=require(_0xa5b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa5b4('0x1'));var jsonpatch=require(_0xa5b4('0x2'));var rp=require(_0xa5b4('0x3'));var moment=require(_0xa5b4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa5b4('0x5'));var util=require(_0xa5b4('0x6'));var path=require(_0xa5b4('0x7'));var sox=require(_0xa5b4('0x8'));var csv=require('to-csv');var ejs=require(_0xa5b4('0x9'));var fs=require('fs');var fs_extra=require(_0xa5b4('0xa'));var _=require(_0xa5b4('0xb'));var squel=require(_0xa5b4('0xc'));var crypto=require(_0xa5b4('0xd'));var jsforce=require(_0xa5b4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa5b4('0xf'));var querystring=require(_0xa5b4('0x10'));var Papa=require(_0xa5b4('0x11'));var Redis=require('ioredis');var authService=require(_0xa5b4('0x12'));var qs=require(_0xa5b4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5b4('0x14'))(_0xa5b4('0x15'));var utils=require(_0xa5b4('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa5b4('0x17'))['db'];function respondWithStatusCode(_0xab10af,_0x4f659c){_0x4f659c=_0x4f659c||0xcc;return function(_0x2c5e6b){if(_0x2c5e6b){return _0xab10af['sendStatus'](_0x4f659c);}return _0xab10af[_0xa5b4('0x18')](_0x4f659c)[_0xa5b4('0x19')]();};}function respondWithResult(_0x461a76,_0x5a5dda){_0x5a5dda=_0x5a5dda||0xc8;return function(_0x57972f){if(_0x57972f){return _0x461a76[_0xa5b4('0x18')](_0x5a5dda)[_0xa5b4('0x1a')](_0x57972f);}};}function respondWithFilteredResult(_0x3328d3,_0x141e26){return function(_0x5ef9a2){if(_0x5ef9a2){var _0x3bddb2=typeof _0x141e26[_0xa5b4('0x1b')]===_0xa5b4('0x1c')&&typeof _0x141e26[_0xa5b4('0x1d')]===_0xa5b4('0x1c');var _0x22cb1f=_0x5ef9a2[_0xa5b4('0x1e')];var _0x2cfbc0=_0x3bddb2?0x0:_0x141e26[_0xa5b4('0x1b')];var _0x358422=_0x3bddb2?_0x5ef9a2[_0xa5b4('0x1e')]:_0x141e26['offset']+_0x141e26[_0xa5b4('0x1d')];var _0x9b6b01;if(_0x358422>=_0x22cb1f){_0x358422=_0x22cb1f;_0x9b6b01=0xc8;}else{_0x9b6b01=0xce;}_0x3328d3[_0xa5b4('0x18')](_0x9b6b01);return _0x3328d3[_0xa5b4('0x1f')](_0xa5b4('0x20'),_0x2cfbc0+'-'+_0x358422+'/'+_0x22cb1f)[_0xa5b4('0x1a')](_0x5ef9a2);}return null;};}function patchUpdates(_0x4e6eff){return function(_0x5a59f1){try{jsonpatch['apply'](_0x5a59f1,_0x4e6eff,!![]);}catch(_0x27b1ad){return BPromise[_0xa5b4('0x21')](_0x27b1ad);}return _0x5a59f1[_0xa5b4('0x22')]();};}function saveUpdates(_0x103490,_0x226793){return function(_0xcc41cc){if(_0xcc41cc){return _0xcc41cc[_0xa5b4('0x23')](_0x103490)['then'](function(_0x2da107){return _0x2da107;});}return null;};}function removeEntity(_0x1300a8,_0x1daa3b){return function(_0x42d6ae){if(_0x42d6ae){return _0x42d6ae[_0xa5b4('0x24')]()[_0xa5b4('0x25')](function(){var _0x2d07b6=_0x42d6ae['get']({'plain':!![]});var _0x503b7b=_0xa5b4('0x26');return db[_0xa5b4('0x27')][_0xa5b4('0x24')]({'where':{'type':_0x503b7b,'resourceId':_0x2d07b6['id']}})[_0xa5b4('0x25')](function(){return _0x42d6ae;});})['then'](function(){_0x1300a8[_0xa5b4('0x18')](0xcc)[_0xa5b4('0x19')]();});}};}function handleEntityNotFound(_0xbb5ebc,_0x5ac39a){return function(_0x2d5cc5){if(!_0x2d5cc5){_0xbb5ebc[_0xa5b4('0x28')](0x194);}return _0x2d5cc5;};}function handleError(_0x40382f,_0x59ea24){_0x59ea24=_0x59ea24||0x1f4;return function(_0x1cf826){logger['error'](_0x1cf826[_0xa5b4('0x29')]);if(_0x1cf826[_0xa5b4('0x2a')]){delete _0x1cf826[_0xa5b4('0x2a')];}_0x40382f[_0xa5b4('0x18')](_0x59ea24)[_0xa5b4('0x2b')](_0x1cf826);};}exports[_0xa5b4('0x2c')]=function(_0x1646b7,_0x4c4f0b){var _0x542cde={},_0x2b6b84={},_0x598ba3={'count':0x0,'rows':[]};var _0x42ba11=_[_0xa5b4('0x2d')](db['Pause'][_0xa5b4('0x2e')],function(_0x66ded2){return{'name':_0x66ded2[_0xa5b4('0x2f')],'type':_0x66ded2[_0xa5b4('0x30')][_0xa5b4('0x31')]};});_0x2b6b84[_0xa5b4('0x32')]=_[_0xa5b4('0x2d')](_0x42ba11,_0xa5b4('0x2a'));_0x2b6b84[_0xa5b4('0x33')]=_[_0xa5b4('0x34')](_0x1646b7[_0xa5b4('0x33')]);_0x2b6b84[_0xa5b4('0x35')]=_[_0xa5b4('0x36')](_0x2b6b84[_0xa5b4('0x32')],_0x2b6b84['query']);_0x542cde['attributes']=_[_0xa5b4('0x36')](_0x2b6b84[_0xa5b4('0x32')],qs[_0xa5b4('0x37')](_0x1646b7['query']['fields']));_0x542cde[_0xa5b4('0x38')]=_0x542cde[_0xa5b4('0x38')][_0xa5b4('0x39')]?_0x542cde[_0xa5b4('0x38')]:_0x2b6b84[_0xa5b4('0x32')];if(!_0x1646b7[_0xa5b4('0x33')][_0xa5b4('0x3a')](_0xa5b4('0x3b'))){_0x542cde[_0xa5b4('0x1d')]=qs['limit'](_0x1646b7[_0xa5b4('0x33')]['limit']);_0x542cde[_0xa5b4('0x1b')]=qs[_0xa5b4('0x1b')](_0x1646b7[_0xa5b4('0x33')][_0xa5b4('0x1b')]);}_0x542cde[_0xa5b4('0x3c')]=qs[_0xa5b4('0x3d')](_0x1646b7[_0xa5b4('0x33')][_0xa5b4('0x3d')]);_0x542cde[_0xa5b4('0x3e')]=qs[_0xa5b4('0x35')](_['pick'](_0x1646b7[_0xa5b4('0x33')],_0x2b6b84[_0xa5b4('0x35')]),_0x42ba11);if(_0x1646b7['query'][_0xa5b4('0x3f')]){_0x542cde[_0xa5b4('0x3e')]=_[_0xa5b4('0x40')](_0x542cde[_0xa5b4('0x3e')],{'$or':_[_0xa5b4('0x2d')](_0x42ba11,function(_0x314e0f){if(_0x314e0f[_0xa5b4('0x30')]!=='VIRTUAL'){var _0xf498cc={};_0xf498cc[_0x314e0f['name']]={'$like':'%'+_0x1646b7[_0xa5b4('0x33')]['filter']+'%'};return _0xf498cc;}})});}_0x542cde=_[_0xa5b4('0x40')]({},_0x542cde,_0x1646b7[_0xa5b4('0x41')]);var _0x498d6c={'where':_0x542cde['where']};return db['Pause'][_0xa5b4('0x1e')](_0x498d6c)[_0xa5b4('0x25')](function(_0x2ab682){_0x598ba3[_0xa5b4('0x1e')]=_0x2ab682;if(_0x1646b7[_0xa5b4('0x33')]['includeAll']){_0x542cde[_0xa5b4('0x42')]=[{'all':!![]}];}return db[_0xa5b4('0x43')][_0xa5b4('0x44')](_0x542cde);})[_0xa5b4('0x25')](function(_0x55e87f){_0x598ba3['rows']=_0x55e87f;return _0x598ba3;})[_0xa5b4('0x25')](respondWithFilteredResult(_0x4c4f0b,_0x542cde))[_0xa5b4('0x45')](handleError(_0x4c4f0b,null));};exports[_0xa5b4('0x46')]=function(_0x1a7ca2,_0x3e51b3){var _0x20bc28={'raw':!![],'where':{'id':_0x1a7ca2[_0xa5b4('0x47')]['id']}},_0x5044fa={};_0x5044fa[_0xa5b4('0x32')]=_[_0xa5b4('0x34')](db[_0xa5b4('0x43')][_0xa5b4('0x2e')]);_0x5044fa[_0xa5b4('0x33')]=_[_0xa5b4('0x34')](_0x1a7ca2['query']);_0x5044fa[_0xa5b4('0x35')]=_['intersection'](_0x5044fa[_0xa5b4('0x32')],_0x5044fa[_0xa5b4('0x33')]);_0x20bc28[_0xa5b4('0x38')]=_[_0xa5b4('0x36')](_0x5044fa[_0xa5b4('0x32')],qs[_0xa5b4('0x37')](_0x1a7ca2['query'][_0xa5b4('0x37')]));_0x20bc28['attributes']=_0x20bc28['attributes']['length']?_0x20bc28[_0xa5b4('0x38')]:_0x5044fa[_0xa5b4('0x32')];if(_0x1a7ca2[_0xa5b4('0x33')]['includeAll']){_0x20bc28[_0xa5b4('0x42')]=[{'all':!![]}];}_0x20bc28=_['merge']({},_0x20bc28,_0x1a7ca2[_0xa5b4('0x41')]);return db[_0xa5b4('0x43')][_0xa5b4('0x48')](_0x20bc28)[_0xa5b4('0x25')](handleEntityNotFound(_0x3e51b3,null))[_0xa5b4('0x25')](respondWithResult(_0x3e51b3,null))[_0xa5b4('0x45')](handleError(_0x3e51b3,null));};exports['create']=function(_0x305752,_0xa0fdfc){return db[_0xa5b4('0x43')][_0xa5b4('0x49')](_0x305752[_0xa5b4('0x4a')],{})['then'](function(_0x4807ad){var _0x4787c5=_0x305752[_0xa5b4('0x4b')]['get']({'plain':!![]});if(!_0x4787c5)throw new Error(_0xa5b4('0x4c'));if(_0x4787c5[_0xa5b4('0x4d')]===_0xa5b4('0x4b')){var _0x530804=_0x4807ad[_0xa5b4('0x4e')]({'plain':!![]});var _0xa01a6='Pauses';return db[_0xa5b4('0x4f')][_0xa5b4('0x48')]({'where':{'name':_0xa01a6,'userProfileId':_0x4787c5[_0xa5b4('0x50')]},'raw':!![]})[_0xa5b4('0x25')](function(_0x56c943){if(_0x56c943&&_0x56c943[_0xa5b4('0x51')]===0x0){return db[_0xa5b4('0x27')][_0xa5b4('0x49')]({'name':_0x530804[_0xa5b4('0x2a')],'resourceId':_0x530804['id'],'type':_0x56c943[_0xa5b4('0x2a')],'sectionId':_0x56c943['id']},{})[_0xa5b4('0x25')](function(){return _0x4807ad;});}else{return _0x4807ad;}})[_0xa5b4('0x45')](function(_0x3f1474){logger['error'](_0xa5b4('0x52'),_0x3f1474);throw _0x3f1474;});}return _0x4807ad;})[_0xa5b4('0x25')](respondWithResult(_0xa0fdfc,0xc9))[_0xa5b4('0x45')](handleError(_0xa0fdfc,null));};exports[_0xa5b4('0x23')]=function(_0x1b567c,_0x581017){if(_0x1b567c[_0xa5b4('0x4a')]['id']){delete _0x1b567c['body']['id'];}return db['Pause'][_0xa5b4('0x48')]({'where':{'id':_0x1b567c[_0xa5b4('0x47')]['id']}})[_0xa5b4('0x25')](handleEntityNotFound(_0x581017,null))[_0xa5b4('0x25')](saveUpdates(_0x1b567c[_0xa5b4('0x4a')],null))[_0xa5b4('0x25')](respondWithResult(_0x581017,null))[_0xa5b4('0x45')](handleError(_0x581017,null));};exports[_0xa5b4('0x24')]=function(_0x392860,_0x5dcf3f){return db[_0xa5b4('0x43')][_0xa5b4('0x48')]({'where':{'id':_0x392860[_0xa5b4('0x47')]['id']}})[_0xa5b4('0x25')](handleEntityNotFound(_0x5dcf3f,null))[_0xa5b4('0x25')](removeEntity(_0x5dcf3f,null))[_0xa5b4('0x45')](handleError(_0x5dcf3f,null));}; \ No newline at end of file +var _0x50ed=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','map','Pause','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','sort','filters','where','merge','filter','includeAll','rows','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','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'];(function(_0x2463f8,_0x278755){var _0x428d86=function(_0x1cd03e){while(--_0x1cd03e){_0x2463f8['push'](_0x2463f8['shift']());}};_0x428d86(++_0x278755);}(_0x50ed,0x13e));var _0xd50e=function(_0x5ee776,_0x3282d4){_0x5ee776=_0x5ee776-0x0;var _0x36b63e=_0x50ed[_0x5ee776];return _0x36b63e;};'use strict';var emlformat=require(_0xd50e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd50e('0x1'));var rp=require(_0xd50e('0x2'));var moment=require(_0xd50e('0x3'));var BPromise=require(_0xd50e('0x4'));var Mustache=require(_0xd50e('0x5'));var util=require(_0xd50e('0x6'));var path=require(_0xd50e('0x7'));var sox=require(_0xd50e('0x8'));var csv=require(_0xd50e('0x9'));var ejs=require(_0xd50e('0xa'));var fs=require('fs');var fs_extra=require(_0xd50e('0xb'));var _=require(_0xd50e('0xc'));var squel=require('squel');var crypto=require(_0xd50e('0xd'));var jsforce=require(_0xd50e('0xe'));var deskjs=require(_0xd50e('0xf'));var toCsv=require(_0xd50e('0x9'));var querystring=require(_0xd50e('0x10'));var Papa=require(_0xd50e('0x11'));var Redis=require(_0xd50e('0x12'));var authService=require(_0xd50e('0x13'));var qs=require(_0xd50e('0x14'));var as=require(_0xd50e('0x15'));var hardwareService=require(_0xd50e('0x16'));var logger=require(_0xd50e('0x17'))(_0xd50e('0x18'));var utils=require('../../config/utils');var config=require(_0xd50e('0x19'));var licenseUtil=require(_0xd50e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f1e9d,_0x4ad7af){_0x4ad7af=_0x4ad7af||0xcc;return function(_0x210524){if(_0x210524){return _0x4f1e9d[_0xd50e('0x1b')](_0x4ad7af);}return _0x4f1e9d['status'](_0x4ad7af)[_0xd50e('0x1c')]();};}function respondWithResult(_0x5437d4,_0x2b0d8d){_0x2b0d8d=_0x2b0d8d||0xc8;return function(_0x332b28){if(_0x332b28){return _0x5437d4['status'](_0x2b0d8d)['json'](_0x332b28);}};}function respondWithFilteredResult(_0x21730f,_0x524f4e){return function(_0x463093){if(_0x463093){var _0x2dd8e0=typeof _0x524f4e[_0xd50e('0x1d')]===_0xd50e('0x1e')&&typeof _0x524f4e[_0xd50e('0x1f')]===_0xd50e('0x1e');var _0x479f22=_0x463093[_0xd50e('0x20')];var _0x432e4a=_0x2dd8e0?0x0:_0x524f4e[_0xd50e('0x1d')];var _0x552f63=_0x2dd8e0?_0x463093[_0xd50e('0x20')]:_0x524f4e[_0xd50e('0x1d')]+_0x524f4e[_0xd50e('0x1f')];var _0x582d72;if(_0x552f63>=_0x479f22){_0x552f63=_0x479f22;_0x582d72=0xc8;}else{_0x582d72=0xce;}_0x21730f[_0xd50e('0x21')](_0x582d72);return _0x21730f[_0xd50e('0x22')](_0xd50e('0x23'),_0x432e4a+'-'+_0x552f63+'/'+_0x479f22)[_0xd50e('0x24')](_0x463093);}return null;};}function patchUpdates(_0x2cebc4){return function(_0x245afb){try{jsonpatch[_0xd50e('0x25')](_0x245afb,_0x2cebc4,!![]);}catch(_0x2cff68){return BPromise[_0xd50e('0x26')](_0x2cff68);}return _0x245afb[_0xd50e('0x27')]();};}function saveUpdates(_0x183994,_0x23862e){return function(_0x3a5ea5){if(_0x3a5ea5){return _0x3a5ea5[_0xd50e('0x28')](_0x183994)[_0xd50e('0x29')](function(_0x890871){return _0x890871;});}return null;};}function removeEntity(_0x38b6f2,_0x5d78dc){return function(_0x22f2ca){if(_0x22f2ca){return _0x22f2ca[_0xd50e('0x2a')]()[_0xd50e('0x29')](function(){var _0x384ab3=_0x22f2ca[_0xd50e('0x2b')]({'plain':!![]});var _0x196346=_0xd50e('0x2c');return db[_0xd50e('0x2d')]['destroy']({'where':{'type':_0x196346,'resourceId':_0x384ab3['id']}})['then'](function(){return _0x22f2ca;});})[_0xd50e('0x29')](function(){_0x38b6f2[_0xd50e('0x21')](0xcc)[_0xd50e('0x1c')]();});}};}function handleEntityNotFound(_0x4f6961,_0x2af638){return function(_0x1e8ac8){if(!_0x1e8ac8){_0x4f6961[_0xd50e('0x1b')](0x194);}return _0x1e8ac8;};}function handleError(_0x433757,_0x1b09ee){_0x1b09ee=_0x1b09ee||0x1f4;return function(_0x1d3aba){logger[_0xd50e('0x2e')](_0x1d3aba[_0xd50e('0x2f')]);if(_0x1d3aba['name']){delete _0x1d3aba[_0xd50e('0x30')];}_0x433757[_0xd50e('0x21')](_0x1b09ee)[_0xd50e('0x31')](_0x1d3aba);};}exports['index']=function(_0x3f0c1f,_0x2b8e9f){var _0xef1bec={},_0x4fd240={},_0x336738={'count':0x0,'rows':[]};var _0x43fef4=_[_0xd50e('0x32')](db[_0xd50e('0x33')]['rawAttributes'],function(_0x15266e){return{'name':_0x15266e[_0xd50e('0x34')],'type':_0x15266e[_0xd50e('0x35')][_0xd50e('0x36')]};});_0x4fd240['model']=_['map'](_0x43fef4,'name');_0x4fd240['query']=_[_0xd50e('0x37')](_0x3f0c1f[_0xd50e('0x38')]);_0x4fd240['filters']=_[_0xd50e('0x39')](_0x4fd240['model'],_0x4fd240['query']);_0xef1bec['attributes']=_['intersection'](_0x4fd240[_0xd50e('0x3a')],qs[_0xd50e('0x3b')](_0x3f0c1f[_0xd50e('0x38')][_0xd50e('0x3b')]));_0xef1bec[_0xd50e('0x3c')]=_0xef1bec['attributes'][_0xd50e('0x3d')]?_0xef1bec[_0xd50e('0x3c')]:_0x4fd240[_0xd50e('0x3a')];if(!_0x3f0c1f[_0xd50e('0x38')][_0xd50e('0x3e')]('nolimit')){_0xef1bec[_0xd50e('0x1f')]=qs['limit'](_0x3f0c1f[_0xd50e('0x38')]['limit']);_0xef1bec[_0xd50e('0x1d')]=qs['offset'](_0x3f0c1f[_0xd50e('0x38')]['offset']);}_0xef1bec['order']=qs[_0xd50e('0x3f')](_0x3f0c1f[_0xd50e('0x38')][_0xd50e('0x3f')]);_0xef1bec['where']=qs[_0xd50e('0x40')](_['pick'](_0x3f0c1f[_0xd50e('0x38')],_0x4fd240[_0xd50e('0x40')]),_0x43fef4);if(_0x3f0c1f['query']['filter']){_0xef1bec[_0xd50e('0x41')]=_[_0xd50e('0x42')](_0xef1bec[_0xd50e('0x41')],{'$or':_[_0xd50e('0x32')](_0x43fef4,function(_0x22e9f8){if(_0x22e9f8['type']!=='VIRTUAL'){var _0x19abf5={};_0x19abf5[_0x22e9f8['name']]={'$like':'%'+_0x3f0c1f[_0xd50e('0x38')][_0xd50e('0x43')]+'%'};return _0x19abf5;}})});}_0xef1bec=_[_0xd50e('0x42')]({},_0xef1bec,_0x3f0c1f['options']);var _0xe4ba21={'where':_0xef1bec['where']};return db[_0xd50e('0x33')][_0xd50e('0x20')](_0xe4ba21)[_0xd50e('0x29')](function(_0x323654){_0x336738[_0xd50e('0x20')]=_0x323654;if(_0x3f0c1f['query'][_0xd50e('0x44')]){_0xef1bec['include']=[{'all':!![]}];}return db[_0xd50e('0x33')]['findAll'](_0xef1bec);})[_0xd50e('0x29')](function(_0xf3e1f7){_0x336738[_0xd50e('0x45')]=_0xf3e1f7;return _0x336738;})[_0xd50e('0x29')](respondWithFilteredResult(_0x2b8e9f,_0xef1bec))[_0xd50e('0x46')](handleError(_0x2b8e9f,null));};exports[_0xd50e('0x47')]=function(_0x5a0a12,_0x124439){var _0x47e984={'raw':!![],'where':{'id':_0x5a0a12[_0xd50e('0x48')]['id']}},_0x103ecf={};_0x103ecf['model']=_[_0xd50e('0x37')](db['Pause']['rawAttributes']);_0x103ecf[_0xd50e('0x38')]=_['keys'](_0x5a0a12['query']);_0x103ecf['filters']=_[_0xd50e('0x39')](_0x103ecf[_0xd50e('0x3a')],_0x103ecf[_0xd50e('0x38')]);_0x47e984['attributes']=_[_0xd50e('0x39')](_0x103ecf['model'],qs[_0xd50e('0x3b')](_0x5a0a12[_0xd50e('0x38')]['fields']));_0x47e984[_0xd50e('0x3c')]=_0x47e984[_0xd50e('0x3c')]['length']?_0x47e984[_0xd50e('0x3c')]:_0x103ecf[_0xd50e('0x3a')];if(_0x5a0a12['query'][_0xd50e('0x44')]){_0x47e984[_0xd50e('0x49')]=[{'all':!![]}];}_0x47e984=_['merge']({},_0x47e984,_0x5a0a12[_0xd50e('0x4a')]);return db[_0xd50e('0x33')][_0xd50e('0x4b')](_0x47e984)[_0xd50e('0x29')](handleEntityNotFound(_0x124439,null))[_0xd50e('0x29')](respondWithResult(_0x124439,null))['catch'](handleError(_0x124439,null));};exports[_0xd50e('0x4c')]=function(_0x228406,_0x1aeec3){return db[_0xd50e('0x33')][_0xd50e('0x4c')](_0x228406[_0xd50e('0x4d')],{})['then'](function(_0x40f07c){var _0x2aa618=_0x228406[_0xd50e('0x4e')]['get']({'plain':!![]});if(!_0x2aa618)throw new Error(_0xd50e('0x4f'));if(_0x2aa618[_0xd50e('0x50')]===_0xd50e('0x4e')){var _0x33d7d0=_0x40f07c[_0xd50e('0x2b')]({'plain':!![]});var _0x2b2d72=_0xd50e('0x2c');return db[_0xd50e('0x51')][_0xd50e('0x4b')]({'where':{'name':_0x2b2d72,'userProfileId':_0x2aa618[_0xd50e('0x52')]},'raw':!![]})[_0xd50e('0x29')](function(_0x5cbee4){if(_0x5cbee4&&_0x5cbee4[_0xd50e('0x53')]===0x0){return db[_0xd50e('0x2d')][_0xd50e('0x4c')]({'name':_0x33d7d0[_0xd50e('0x30')],'resourceId':_0x33d7d0['id'],'type':_0x5cbee4[_0xd50e('0x30')],'sectionId':_0x5cbee4['id']},{})[_0xd50e('0x29')](function(){return _0x40f07c;});}else{return _0x40f07c;}})[_0xd50e('0x46')](function(_0x5300e2){logger[_0xd50e('0x2e')](_0xd50e('0x54'),_0x5300e2);throw _0x5300e2;});}return _0x40f07c;})[_0xd50e('0x29')](respondWithResult(_0x1aeec3,0xc9))[_0xd50e('0x46')](handleError(_0x1aeec3,null));};exports[_0xd50e('0x28')]=function(_0x382b4c,_0x55f422){if(_0x382b4c[_0xd50e('0x4d')]['id']){delete _0x382b4c[_0xd50e('0x4d')]['id'];}return db['Pause'][_0xd50e('0x4b')]({'where':{'id':_0x382b4c[_0xd50e('0x48')]['id']}})[_0xd50e('0x29')](handleEntityNotFound(_0x55f422,null))[_0xd50e('0x29')](saveUpdates(_0x382b4c[_0xd50e('0x4d')],null))[_0xd50e('0x29')](respondWithResult(_0x55f422,null))[_0xd50e('0x46')](handleError(_0x55f422,null));};exports[_0xd50e('0x2a')]=function(_0x3f60e4,_0x344820){return db[_0xd50e('0x33')][_0xd50e('0x4b')]({'where':{'id':_0x3f60e4[_0xd50e('0x48')]['id']}})[_0xd50e('0x29')](handleEntityNotFound(_0x344820,null))[_0xd50e('0x29')](removeEntity(_0x344820,null))[_0xd50e('0x46')](handleError(_0x344820,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 6e4c734..4cf9668 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 _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x53a07a,_0x3fd512){var _0x357f7a=function(_0x412876){while(--_0x412876){_0x53a07a['push'](_0x53a07a['shift']());}};_0x357f7a(++_0x3fd512);}(_0x1cb9,0x14e));var _0x91cb=function(_0x41a1ef,_0x3c4f9a){_0x41a1ef=_0x41a1ef-0x0;var _0x35815c=_0x1cb9[_0x41a1ef];return _0x35815c;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6aa7,0x178));var _0x76aa=function(_0x3e0985,_0x4469d9){_0x3e0985=_0x3e0985-0x0;var _0x1f8a7e=_0x6aa7[_0x3e0985];return _0x1f8a7e;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'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 231207a..3f44cd3 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 _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x4fc59e,_0xfaa2b8){var _0x16e306=function(_0x5477c7){while(--_0x5477c7){_0x4fc59e['push'](_0x4fc59e['shift']());}};_0x16e306(++_0xfaa2b8);}(_0x7a54,0x106));var _0x47a5=function(_0x1c228e,_0x1721b7){_0x1c228e=_0x1c228e-0x0;var _0x2fe587=_0x7a54[_0x1c228e];return _0x2fe587;};'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')]('Pause,\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['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x249337,_0x475c05){var _0x43971b=function(_0x1634ff){while(--_0x1634ff){_0x249337['push'](_0x249337['shift']());}};_0x43971b(++_0x475c05);}(_0x7a54,0x106));var _0x47a5=function(_0x5af13c,_0x3e3204){_0x5af13c=_0x5af13c-0x0;var _0x28c4c4=_0x7a54[_0x5af13c];return _0x28c4c4;};'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')]('Pause,\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['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 6f19eb6..4f82648 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 _0x68fc=['webhookPost','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','upload','/webhook'];(function(_0x22c965,_0x3bc990){var _0x47284e=function(_0x477f20){while(--_0x477f20){_0x22c965['push'](_0x22c965['shift']());}};_0x47284e(++_0x3bc990);}(_0x68fc,0xa5));var _0xc68f=function(_0x4ddb0b,_0x239b05){_0x4ddb0b=_0x4ddb0b-0x0;var _0x5168ec=_0x68fc[_0x4ddb0b];return _0x5168ec;};'use strict';var multer=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var path=require(_0xc68f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc68f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc68f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc68f('0x5'));router[_0xc68f('0x6')]('/',auth[_0xc68f('0x7')](),controller[_0xc68f('0x8')]);router['get']('/webhook',controller[_0xc68f('0x9')]);router[_0xc68f('0x6')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xb')]);router[_0xc68f('0x6')](_0xc68f('0xc'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xd')]);var upload=multer({'storage':multer[_0xc68f('0xe')]({'destination':function(_0x5777f9,_0x3b1a43,_0x29f1fe){_0x29f1fe(null,path[_0xc68f('0xf')](config[_0xc68f('0x10')],_0xc68f('0x11')));},'filename':function(_0x2a0a52,_0x3ccebe,_0x41aeb8){_0x3ccebe[_0xc68f('0x12')]=_0x3ccebe[_0xc68f('0x12')][_0xc68f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41aeb8(null,util['format'](_0xc68f('0x14'),path[_0xc68f('0x15')](_0x3ccebe[_0xc68f('0x12')],path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])),Date[_0xc68f('0x17')](),path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])));}})});router[_0xc68f('0x18')]('/',upload['single']('file'),controller[_0xc68f('0x19')]);router[_0xc68f('0x18')](_0xc68f('0x1a'),controller[_0xc68f('0x1b')]);router[_0xc68f('0x1c')](_0xc68f('0xa'),auth['isAuthenticated'](),controller[_0xc68f('0x1d')]);router[_0xc68f('0x1e')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0x1e')]);module[_0xc68f('0x1f')]=router; \ No newline at end of file +var _0xd13e=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./plugin.controller','get','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','replace','%s-%s%s','extname','post','single','file','upload','webhookPost','put','update','delete'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xd13e,0x193));var _0xed13=function(_0x25268f,_0x3dd529){_0x25268f=_0x25268f-0x0;var _0x1a1396=_0xd13e[_0x25268f];return _0x1a1396;};'use strict';var multer=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var path=require(_0xed13('0x2'));var timeout=require(_0xed13('0x3'));var express=require('express');var router=express[_0xed13('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed13('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed13('0x6'));var controller=require(_0xed13('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xed13('0x8')](_0xed13('0x9'),controller[_0xed13('0xa')]);router[_0xed13('0x8')](_0xed13('0xb'),auth[_0xed13('0xc')](),controller[_0xed13('0xd')]);router[_0xed13('0x8')](_0xed13('0xe'),auth['isAuthenticated'](),controller[_0xed13('0xf')]);var upload=multer({'storage':multer[_0xed13('0x10')]({'destination':function(_0x11adaf,_0x39575c,_0x2b290c){_0x2b290c(null,path['join'](config[_0xed13('0x11')],_0xed13('0x12')));},'filename':function(_0x2c68db,_0x3c0b22,_0x936103){_0x3c0b22[_0xed13('0x13')]=_0x3c0b22['originalname'][_0xed13('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x936103(null,util['format'](_0xed13('0x15'),path['basename'](_0x3c0b22[_0xed13('0x13')],path['extname'](_0x3c0b22[_0xed13('0x13')])),Date['now'](),path[_0xed13('0x16')](_0x3c0b22[_0xed13('0x13')])));}})});router[_0xed13('0x17')]('/',upload[_0xed13('0x18')](_0xed13('0x19')),controller[_0xed13('0x1a')]);router[_0xed13('0x17')](_0xed13('0x9'),controller[_0xed13('0x1b')]);router[_0xed13('0x1c')](_0xed13('0xb'),auth[_0xed13('0xc')](),controller[_0xed13('0x1d')]);router[_0xed13('0x1e')](_0xed13('0xb'),auth[_0xed13('0xc')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 81d9800..d832b92 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 _0xb4f9=['exports','ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0x288449,_0x223038){var _0x2bd5e3=function(_0x4006ed){while(--_0x4006ed){_0x288449['push'](_0x288449['shift']());}};_0x2bd5e3(++_0x223038);}(_0xb4f9,0x14f));var _0x9b4f=function(_0x4ba2d2,_0x9f2ef){_0x4ba2d2=_0x4ba2d2-0x0;var _0x179cc9=_0xb4f9[_0x4ba2d2];return _0x179cc9;};'use strict';var Sequelize=require(_0x9b4f('0x0'));module[_0x9b4f('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9b4f('0x2')](_0x9b4f('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x9b4f('0x4')]},'path':{'type':Sequelize[_0x9b4f('0x5')],'comment':_0x9b4f('0x6')},'active':{'type':Sequelize[_0x9b4f('0x7')],'defaultValue':0x0,'comment':_0x9b4f('0x8')},'sidebar':{'type':Sequelize[_0x9b4f('0x2')](_0x9b4f('0x9'),_0x9b4f('0xa'),'always',_0x9b4f('0xb')),'defaultValue':_0x9b4f('0xc'),'comment':_0x9b4f('0xd')},'icon':{'type':Sequelize[_0x9b4f('0x5')]},'adminUrl':{'type':Sequelize[_0x9b4f('0x5')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x9b4f('0x5')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xccbe=['agentOnly','always','sequelize','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0x32c647,_0x18f706){var _0x112645=function(_0x142a54){while(--_0x142a54){_0x32c647['push'](_0x32c647['shift']());}};_0x112645(++_0x18f706);}(_0xccbe,0x141));var _0xeccb=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0xccbe[_0x2bd1ec];return _0x2f7577;};'use strict';var Sequelize=require(_0xeccb('0x0'));module['exports']={'name':{'type':Sequelize[_0xeccb('0x1')]},'type':{'type':Sequelize[_0xeccb('0x2')](_0xeccb('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xeccb('0x4')]},'path':{'type':Sequelize[_0xeccb('0x1')],'comment':_0xeccb('0x5')},'active':{'type':Sequelize[_0xeccb('0x6')],'defaultValue':0x0,'comment':_0xeccb('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0xeccb('0x8'),_0xeccb('0x9'),_0xeccb('0xa'),'never'),'defaultValue':_0xeccb('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xeccb('0x1')]},'adminUrl':{'type':Sequelize[_0xeccb('0x1')]},'agentUrl':{'type':Sequelize[_0xeccb('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xeccb('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 4ba6565..6f582a0 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 _0x2fd2=['test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','body','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','statusCode','sendStatus','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','%s%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','rimraf','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./plugin.socket','register','status','json','limit','undefined','count','offset','set','Content-Range','reject','then','destroy','get','Plugins','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','Plugin','includeAll','include','findAll','catch','show','params','keys','find','download','join','root','server/files/plugins','format','basename','createWriteStream','zip','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','%s.zip','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','file','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','html'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2fd2,0xc1));var _0x22fd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2fd2[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x22fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x22fd('0x1'));var jsonpatch=require(_0x22fd('0x2'));var rp=require(_0x22fd('0x3'));var moment=require(_0x22fd('0x4'));var BPromise=require(_0x22fd('0x5'));var Mustache=require(_0x22fd('0x6'));var util=require('util');var path=require(_0x22fd('0x7'));var sox=require(_0x22fd('0x8'));var csv=require('to-csv');var ejs=require(_0x22fd('0x9'));var fs=require('fs');var fs_extra=require(_0x22fd('0xa'));var _=require(_0x22fd('0xb'));var squel=require(_0x22fd('0xc'));var crypto=require('crypto');var jsforce=require(_0x22fd('0xd'));var deskjs=require(_0x22fd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x22fd('0xf'));var Papa=require(_0x22fd('0x10'));var extract=require('extract-zip');var rimraf=require(_0x22fd('0x11'));var archiver=require(_0x22fd('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x22fd('0x13'));var as=require(_0x22fd('0x14'));var hardwareService=require(_0x22fd('0x15'));var logger=require(_0x22fd('0x16'))(_0x22fd('0x17'));var utils=require(_0x22fd('0x18'));var config=require(_0x22fd('0x19'));var licenseUtil=require(_0x22fd('0x1a'));var db=require('../../mysqldb')['db'];config[_0x22fd('0x1b')]=_[_0x22fd('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x22fd('0x1d'))(new Redis(config[_0x22fd('0x1b')]));require(_0x22fd('0x1e'))[_0x22fd('0x1f')](socket);function respondWithStatusCode(_0x1be223,_0x5dca0e){_0x5dca0e=_0x5dca0e||0xcc;return function(_0x59771e){if(_0x59771e){return _0x1be223['sendStatus'](_0x5dca0e);}return _0x1be223[_0x22fd('0x20')](_0x5dca0e)['end']();};}function respondWithResult(_0x4df3c5,_0x182fdc){_0x182fdc=_0x182fdc||0xc8;return function(_0x5bd130){if(_0x5bd130){return _0x4df3c5[_0x22fd('0x20')](_0x182fdc)[_0x22fd('0x21')](_0x5bd130);}};}function respondWithFilteredResult(_0x28480c,_0x3f3532){return function(_0x473deb){if(_0x473deb){var _0x170a84=typeof _0x3f3532['offset']==='undefined'&&typeof _0x3f3532[_0x22fd('0x22')]===_0x22fd('0x23');var _0x1a3111=_0x473deb[_0x22fd('0x24')];var _0x58d3d3=_0x170a84?0x0:_0x3f3532['offset'];var _0x41af92=_0x170a84?_0x473deb['count']:_0x3f3532[_0x22fd('0x25')]+_0x3f3532[_0x22fd('0x22')];var _0x83f000;if(_0x41af92>=_0x1a3111){_0x41af92=_0x1a3111;_0x83f000=0xc8;}else{_0x83f000=0xce;}_0x28480c[_0x22fd('0x20')](_0x83f000);return _0x28480c[_0x22fd('0x26')](_0x22fd('0x27'),_0x58d3d3+'-'+_0x41af92+'/'+_0x1a3111)[_0x22fd('0x21')](_0x473deb);}return null;};}function patchUpdates(_0x1f4de6){return function(_0x270bfa){try{jsonpatch['apply'](_0x270bfa,_0x1f4de6,!![]);}catch(_0x37dc30){return BPromise[_0x22fd('0x28')](_0x37dc30);}return _0x270bfa['save']();};}function saveUpdates(_0x36eef1,_0x57d451){return function(_0x39c041){if(_0x39c041){return _0x39c041['update'](_0x36eef1)[_0x22fd('0x29')](function(_0x55078f){return _0x55078f;});}return null;};}function removeEntity(_0x1bc47e,_0x3e6d83){return function(_0xd4dd8b){if(_0xd4dd8b){return _0xd4dd8b[_0x22fd('0x2a')]()[_0x22fd('0x29')](function(){var _0x8f6c7c=_0xd4dd8b[_0x22fd('0x2b')]({'plain':!![]});var _0x5e7afb=_0x22fd('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x5e7afb,'resourceId':_0x8f6c7c['id']}})[_0x22fd('0x29')](function(){return _0xd4dd8b;});})[_0x22fd('0x29')](function(){_0x1bc47e[_0x22fd('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bdc91,_0x36b1b){return function(_0x558f49){if(!_0x558f49){_0x1bdc91['sendStatus'](0x194);}return _0x558f49;};}function handleError(_0x1186fe,_0x31cc14){_0x31cc14=_0x31cc14||0x1f4;return function(_0x8f83aa){logger['error'](_0x8f83aa['stack']);if(_0x8f83aa['name']){delete _0x8f83aa[_0x22fd('0x2d')];}_0x1186fe['status'](_0x31cc14)[_0x22fd('0x2e')](_0x8f83aa);};}exports[_0x22fd('0x2f')]=function(_0x3ac8ad,_0x36c27a){var _0x3c0404={},_0x5d2f5a={},_0xdd1999={'count':0x0,'rows':[]};var _0xdf48b5=_[_0x22fd('0x30')](db['Plugin'][_0x22fd('0x31')],function(_0x2b1f9c){return{'name':_0x2b1f9c['fieldName'],'type':_0x2b1f9c[_0x22fd('0x32')][_0x22fd('0x33')]};});_0x5d2f5a['model']=_[_0x22fd('0x30')](_0xdf48b5,_0x22fd('0x2d'));_0x5d2f5a[_0x22fd('0x34')]=_['keys'](_0x3ac8ad['query']);_0x5d2f5a[_0x22fd('0x35')]=_[_0x22fd('0x36')](_0x5d2f5a[_0x22fd('0x37')],_0x5d2f5a[_0x22fd('0x34')]);_0x3c0404[_0x22fd('0x38')]=_[_0x22fd('0x36')](_0x5d2f5a[_0x22fd('0x37')],qs[_0x22fd('0x39')](_0x3ac8ad[_0x22fd('0x34')][_0x22fd('0x39')]));_0x3c0404['attributes']=_0x3c0404[_0x22fd('0x38')][_0x22fd('0x3a')]?_0x3c0404[_0x22fd('0x38')]:_0x5d2f5a['model'];if(!_0x3ac8ad[_0x22fd('0x34')][_0x22fd('0x3b')](_0x22fd('0x3c'))){_0x3c0404['limit']=qs[_0x22fd('0x22')](_0x3ac8ad['query'][_0x22fd('0x22')]);_0x3c0404[_0x22fd('0x25')]=qs[_0x22fd('0x25')](_0x3ac8ad['query']['offset']);}_0x3c0404['order']=qs[_0x22fd('0x3d')](_0x3ac8ad[_0x22fd('0x34')]['sort']);_0x3c0404[_0x22fd('0x3e')]=qs[_0x22fd('0x35')](_[_0x22fd('0x3f')](_0x3ac8ad[_0x22fd('0x34')],_0x5d2f5a[_0x22fd('0x35')]),_0xdf48b5);if(_0x3ac8ad[_0x22fd('0x34')]['filter']){_0x3c0404[_0x22fd('0x3e')]=_[_0x22fd('0x40')](_0x3c0404[_0x22fd('0x3e')],{'$or':_[_0x22fd('0x30')](_0xdf48b5,function(_0x16e521){if(_0x16e521['type']!==_0x22fd('0x41')){var _0x3f0639={};_0x3f0639[_0x16e521[_0x22fd('0x2d')]]={'$like':'%'+_0x3ac8ad['query'][_0x22fd('0x42')]+'%'};return _0x3f0639;}})});}_0x3c0404=_[_0x22fd('0x40')]({},_0x3c0404,_0x3ac8ad[_0x22fd('0x43')]);var _0x1e1ec6={'where':_0x3c0404['where']};return db[_0x22fd('0x44')][_0x22fd('0x24')](_0x1e1ec6)['then'](function(_0x481e6f){_0xdd1999[_0x22fd('0x24')]=_0x481e6f;if(_0x3ac8ad[_0x22fd('0x34')][_0x22fd('0x45')]){_0x3c0404[_0x22fd('0x46')]=[{'all':!![]}];}return db[_0x22fd('0x44')][_0x22fd('0x47')](_0x3c0404);})[_0x22fd('0x29')](function(_0x2b3cc6){_0xdd1999['rows']=_0x2b3cc6;return _0xdd1999;})['then'](respondWithFilteredResult(_0x36c27a,_0x3c0404))[_0x22fd('0x48')](handleError(_0x36c27a,null));};exports[_0x22fd('0x49')]=function(_0xe8d52,_0xb9b81a){var _0x8742e7={'raw':!![],'where':{'id':_0xe8d52[_0x22fd('0x4a')]['id']}},_0x17f7c3={};_0x17f7c3[_0x22fd('0x37')]=_[_0x22fd('0x4b')](db[_0x22fd('0x44')]['rawAttributes']);_0x17f7c3[_0x22fd('0x34')]=_['keys'](_0xe8d52[_0x22fd('0x34')]);_0x17f7c3['filters']=_[_0x22fd('0x36')](_0x17f7c3[_0x22fd('0x37')],_0x17f7c3[_0x22fd('0x34')]);_0x8742e7['attributes']=_[_0x22fd('0x36')](_0x17f7c3[_0x22fd('0x37')],qs['fields'](_0xe8d52[_0x22fd('0x34')][_0x22fd('0x39')]));_0x8742e7[_0x22fd('0x38')]=_0x8742e7['attributes'][_0x22fd('0x3a')]?_0x8742e7['attributes']:_0x17f7c3[_0x22fd('0x37')];if(_0xe8d52[_0x22fd('0x34')]['includeAll']){_0x8742e7[_0x22fd('0x46')]=[{'all':!![]}];}_0x8742e7=_[_0x22fd('0x40')]({},_0x8742e7,_0xe8d52[_0x22fd('0x43')]);return db['Plugin'][_0x22fd('0x4c')](_0x8742e7)[_0x22fd('0x29')](handleEntityNotFound(_0xb9b81a,null))['then'](respondWithResult(_0xb9b81a,null))[_0x22fd('0x48')](handleError(_0xb9b81a,null));};exports[_0x22fd('0x4d')]=function(_0x42477f,_0x35e5e2,_0x50d7a1){return db[_0x22fd('0x44')][_0x22fd('0x4c')]({'where':{'id':_0x42477f[_0x22fd('0x4a')]['id']},'attributes':[_0x22fd('0x2d'),_0x22fd('0x7')],'raw':!![]})[_0x22fd('0x29')](handleEntityNotFound(_0x35e5e2,null))[_0x22fd('0x29')](function(_0x454062){if(_0x454062){var _0x33854d=path[_0x22fd('0x4e')](config[_0x22fd('0x4f')],_0x22fd('0x50'),util[_0x22fd('0x51')]('%s.zip',path[_0x22fd('0x52')](_0x454062['path'])));var _0x5861cf=fs[_0x22fd('0x53')](_0x33854d);var _0x4926d3=archiver(_0x22fd('0x54'),{'zlib':{'level':0x9}});_0x4926d3['on']('warning',function(_0x3120f6){if(_0x3120f6[_0x22fd('0x55')]===_0x22fd('0x56')){logger[_0x22fd('0x57')](_0x3120f6);}else{throw new db[(_0x22fd('0x58'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x4926d3['on']('error',function(_0x8b4b64){throw new db[(_0x22fd('0x58'))][(_0x22fd('0x59'))](_0x22fd('0x5a'));});_0x4926d3[_0x22fd('0x5b')](_0x5861cf);_0x4926d3['glob']('**/*',{'cwd':path[_0x22fd('0x4e')](config[_0x22fd('0x4f')],'server/files/plugins',path[_0x22fd('0x5c')](_0x454062[_0x22fd('0x7')])),'ignore':[path[_0x22fd('0x4e')](path[_0x22fd('0x52')](_0x454062[_0x22fd('0x7')]),_0x22fd('0x5d')),path[_0x22fd('0x4e')](path[_0x22fd('0x52')](_0x454062[_0x22fd('0x7')]),_0x22fd('0x5e'))],'nodir':!![]})[_0x22fd('0x5f')]();_0x5861cf['on'](_0x22fd('0x60'),function(){if(!fs[_0x22fd('0x61')](_0x33854d)){throw new db[(_0x22fd('0x58'))][(_0x22fd('0x59'))]('Plugin\x20not\x20found');}return _0x35e5e2[_0x22fd('0x4d')](_0x33854d,util['format'](_0x22fd('0x62'),path[_0x22fd('0x52')](_0x454062[_0x22fd('0x7')])),function(_0x412cbc){if(_0x412cbc){throw new db[(_0x22fd('0x58'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x33854d);logger[_0x22fd('0x63')](_0x22fd('0x64'));logger[_0x22fd('0x63')](_0x22fd('0x65'));});});}return null;})['catch'](handleError(_0x35e5e2,null));};exports[_0x22fd('0x66')]=function(_0x1e2673,_0xe5b287,_0x1b06e0){var _0x477282=path[_0x22fd('0x52')](_0x1e2673['file'][_0x22fd('0x67')],path['extname'](_0x1e2673['file'][_0x22fd('0x67')]));var _0x242664=path[_0x22fd('0x4e')](config['root'],_0x22fd('0x50'),_0x1e2673[_0x22fd('0x68')]['filename']);var _0xe5e82e=path['join'](config['root'],_0x22fd('0x50'),_0x477282);logger[_0x22fd('0x63')]('Plugin\x20upload\x20filepath:\x20%s',_0x242664);logger[_0x22fd('0x63')]('Plugin\x20upload\x20destination:\x20%s',_0xe5e82e);try{fs[_0x22fd('0x69')](_0x242664,parseInt(_0x22fd('0x6a'),0x8));extract(_0x242664,{'dir':_0xe5e82e},function(_0x2dc5db){if(_0x2dc5db){logger['error'](_0x2dc5db);handleError(_0x2dc5db,!![]);};var _0x39ff7c=fs[_0x22fd('0x6b')](_0xe5e82e);if(_0x39ff7c[_0x22fd('0x3a')]>0x1){removeReferences(_0x242664,_0xe5e82e);logger[_0x22fd('0x57')]('Invalid\x20plugin\x20structure');return _0x1b06e0(new Error(_0x22fd('0x6c')));}var _0x16708b=fs[_0x22fd('0x6d')](path[_0x22fd('0x4e')](_0xe5e82e,_0x39ff7c[0x0]));if(_0x16708b['isFile']()){removeReferences(_0x242664,_0xe5e82e);logger[_0x22fd('0x57')](_0x22fd('0x6c'));return _0x1b06e0(new Error(_0x22fd('0x6c')));}if(_0x16708b[_0x22fd('0x6e')]()){var _0x29b4c9=fs['readdirSync'](path[_0x22fd('0x4e')](_0xe5e82e,_0x39ff7c[0x0]));if(_0x29b4c9['length']===0x0){removeReferences(_0x242664,_0xe5e82e);logger[_0x22fd('0x57')](_0x22fd('0x6c'));return _0x1b06e0(new Error(_0x22fd('0x6c')));}var _0x107b7c=_0x29b4c9['some'](function(_0x4fb662){return _0x4fb662===_0x22fd('0x6f');});if(!_0x107b7c){return _0x1b06e0(new Error('Plugin\x20manifest\x20missing'));}var _0x5b2551=fs[_0x22fd('0x70')](path[_0x22fd('0x4e')](_0xe5e82e,_0x39ff7c[0x0],'manifest.json'));var _0x1f03dd=JSON[_0x22fd('0x71')](_0x5b2551);if(_0x22fd('0x23')==typeof _0x1f03dd[_0x22fd('0x2d')]){return _0x1b06e0(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x1f03dd['type']){return _0x1b06e0(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x22fd('0x23')==typeof _0x1f03dd['version']){return _0x1b06e0(new Error(_0x22fd('0x72')));}if(_0x22fd('0x23')==typeof _0x1f03dd[_0x22fd('0x73')]){return _0x1b06e0(new Error(_0x22fd('0x74')));}if(_0x1f03dd[_0x22fd('0x32')]==='html'){if('undefined'==typeof _0x1f03dd['parameters']['views']){return _0x1b06e0(new Error(_0x22fd('0x75')));}if(_0x22fd('0x23')==typeof _0x1f03dd[_0x22fd('0x73')][_0x22fd('0x76')][_0x22fd('0x77')]&&'undefined'==typeof _0x1f03dd[_0x22fd('0x73')][_0x22fd('0x76')][_0x22fd('0x78')]){return _0x1b06e0(new Error(_0x22fd('0x79')));}}else if(_0x1f03dd[_0x22fd('0x32')]===_0x22fd('0x7a')){if(_0x22fd('0x23')==typeof _0x1f03dd[_0x22fd('0x73')][_0x22fd('0x7b')]){return _0x1b06e0(new Error(_0x22fd('0x7c')));}if(_0x22fd('0x23')==typeof _0x1f03dd['parameters'][_0x22fd('0x7d')]){return _0x1b06e0(new Error(_0x22fd('0x7e')));}}else{return _0x1b06e0(new Error(_0x22fd('0x7f')));}var _0x443c18=_0x1f03dd['name'];var _0x25538f=_0x1f03dd[_0x22fd('0x80')];var _0x48f07a=_0x1f03dd[_0x22fd('0x32')];var _0x21fa3a=_0x1f03dd[_0x22fd('0x81')]?_0x1f03dd[_0x22fd('0x81')]:_0x22fd('0x82');var _0x578a13=_0x1f03dd[_0x22fd('0x83')]?_0x1f03dd[_0x22fd('0x83')]:_0x22fd('0x84');var _0x11f140='';var _0x3e1100='';var _0x2f7516='';var _0x1ff7d4='';var _0x4ae7d1=_0x1f03dd[_0x22fd('0x85')];if(_0x48f07a===_0x22fd('0x86')){if(_0x22fd('0x23')!=typeof _0x1f03dd[_0x22fd('0x73')][_0x22fd('0x76')][_0x22fd('0x77')]){var _0x1197c9=_0x1f03dd['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x22fd('0x87')](_0x1197c9)){_0x11f140=path['join'](_0x22fd('0x88'),_0x477282,_0x39ff7c[0x0],_0x1197c9);}else{_0x11f140=_0x1197c9;}}else{logger['info'](_0x22fd('0x89'));}if(_0x22fd('0x23')!=typeof _0x1f03dd[_0x22fd('0x73')][_0x22fd('0x76')][_0x22fd('0x78')]){var _0xc38eaa=_0x1f03dd[_0x22fd('0x73')][_0x22fd('0x76')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0xc38eaa)){_0x3e1100=path['join'](_0x22fd('0x88'),_0x477282,_0x39ff7c[0x0],_0xc38eaa);}else{_0x3e1100=_0xc38eaa;}}else{logger[_0x22fd('0x63')](_0x22fd('0x8a'));}}else if(_0x48f07a===_0x22fd('0x7a')){_0x2f7516=_0x1f03dd[_0x22fd('0x73')][_0x22fd('0x7b')];_0x1ff7d4=_0x1f03dd[_0x22fd('0x73')][_0x22fd('0x7d')];if(_0x22fd('0x23')!=typeof _0x1f03dd['parameters'][_0x22fd('0x76')]){if(_0x22fd('0x23')!=typeof _0x1f03dd[_0x22fd('0x73')][_0x22fd('0x76')]['admin']){var _0x1197c9=_0x1f03dd[_0x22fd('0x73')][_0x22fd('0x76')][_0x22fd('0x77')];if(!/^(f|ht)tps?:\/\//i[_0x22fd('0x87')](_0x1197c9)){_0x11f140=path['join'](_0x22fd('0x88'),_0x477282,_0x39ff7c[0x0],_0x1197c9);}else{_0x11f140=_0x1197c9;}}if(_0x22fd('0x23')!=typeof _0x1f03dd['parameters'][_0x22fd('0x76')][_0x22fd('0x78')]){var _0xc38eaa=_0x1f03dd[_0x22fd('0x73')][_0x22fd('0x76')][_0x22fd('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x22fd('0x87')](_0xc38eaa)){_0x3e1100=path['join'](_0x22fd('0x88'),_0x477282,_0x39ff7c[0x0],_0xc38eaa);}else{_0x3e1100=_0xc38eaa;}}}}var _0xda36a7={'name':_0x443c18,'description':_0x25538f,'path':path['join'](_0x477282,_0x39ff7c[0x0]),'type':_0x48f07a,'sidebar':_0x21fa3a,'icon':_0x578a13,'adminUrl':_0x11f140,'agentUrl':_0x3e1100,'scriptName':_0x2f7516,'scriptPath':_0x1ff7d4,'version':_0x4ae7d1};removeReferences(_0x242664,null);return db[_0x22fd('0x44')][_0x22fd('0x8b')](_0xda36a7)['then'](function(_0x4f23fb){var _0x5a2569={'role':_0x1e2673['body']['role'],'userProfileId':_0x1e2673['body'][_0x22fd('0x8c')]};if(!_0x5a2569)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a2569['role']===_0x22fd('0x8d')){var _0x3d76d6=_0x4f23fb['get']({'plain':!![]});return db[_0x22fd('0x8e')][_0x22fd('0x4c')]({'where':{'name':_0x22fd('0x2c'),'userProfileId':_0x5a2569[_0x22fd('0x8c')]},'raw':!![]})[_0x22fd('0x29')](function(_0x74532b){if(_0x74532b&&_0x74532b[_0x22fd('0x8f')]===0x0){return db['UserProfileResource'][_0x22fd('0x8b')]({'name':_0x3d76d6[_0x22fd('0x2d')],'resourceId':_0x3d76d6['id'],'type':_0x74532b['name'],'sectionId':_0x74532b['id']},{})['then'](function(){return _0x4f23fb;});}else{return _0x4f23fb;}})[_0x22fd('0x48')](function(_0x31b966){logger[_0x22fd('0x57')](_0x22fd('0x90'),_0x31b966);throw _0x31b966;});}return _0x4f23fb;})[_0x22fd('0x29')](respondWithResult(_0xe5b287,null))[_0x22fd('0x48')](handleError(_0xe5b287,null));}});}catch(_0x556dba){_0xe5b287['status'](0x1f4)['send'](_0x556dba);}};function removeReferences(_0x5e5c58,_0x11ce08){try{if(_0x5e5c58){fs['unlinkSync'](_0x5e5c58);logger[_0x22fd('0x63')](_0x22fd('0x91'));}if(_0x11ce08){rimraf(_0x11ce08,function(){});logger['info'](_0x22fd('0x92'));}}catch(_0x337f2a){logger[_0x22fd('0x57')](_0x337f2a);}}exports[_0x22fd('0x93')]=function(_0x348f37,_0x122b16,_0x3bc19f){return db[_0x22fd('0x44')]['find']({'where':{'id':_0x348f37[_0x22fd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x122b16,null))[_0x22fd('0x29')](saveUpdates(_0x348f37[_0x22fd('0x94')],null))[_0x22fd('0x29')](respondWithResult(_0x122b16,null))[_0x22fd('0x48')](handleError(_0x122b16,null));};exports['delete']=function(_0xf6f4da,_0x1971dc,_0x391383){return db['Plugin']['find']({'where':{'id':_0xf6f4da[_0x22fd('0x4a')]['id']}})[_0x22fd('0x29')](function(_0x281728){if(_0x281728){return _0x281728[_0x22fd('0x2a')]();}})[_0x22fd('0x29')](function(_0x324678){rimraf(path[_0x22fd('0x4e')](config[_0x22fd('0x4f')],_0x22fd('0x50'),path[_0x22fd('0x5c')](_0x324678[_0x22fd('0x7')])),function(){});return _0x324678;})[_0x22fd('0x29')](handleEntityNotFound(_0x1971dc,null))[_0x22fd('0x29')](respondWithStatusCode(_0x1971dc,null))[_0x22fd('0x48')](handleError(_0x1971dc,null));};exports['webhookGet']=function(_0xf97fc1,_0x233cd6,_0x286270){return BPromise[_0x22fd('0x95')]()[_0x22fd('0x29')](function(){if(!_0xf97fc1['query'][_0x22fd('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xf97fc1[_0x22fd('0x34')][_0x22fd('0x96')]){throw new Error(_0x22fd('0x97'));}var _0x481573=_0xf97fc1[_0x22fd('0x34')][_0x22fd('0x98')]?_0xf97fc1[_0x22fd('0x34')][_0x22fd('0x98')]+':'+_0xf97fc1[_0x22fd('0x34')][_0x22fd('0x96')]:_0x22fd('0x99')+_0xf97fc1[_0x22fd('0x34')][_0x22fd('0x96')];var _0x494a89=_0xf97fc1[_0x22fd('0x34')][_0x22fd('0x21')]?_0xf97fc1[_0x22fd('0x34')][_0x22fd('0x21')]:!![];var _0x29a0ec=_0xf97fc1[_0x22fd('0x34')][_0x22fd('0x9a')]?_0xf97fc1[_0x22fd('0x34')][_0x22fd('0x9a')]:null;var _0x31ffb7={'method':_0xf97fc1[_0x22fd('0x9b')],'uri':util[_0x22fd('0x51')]('%s%s',_0x481573,_0xf97fc1[_0x22fd('0x34')][_0x22fd('0x7')]),'json':_0x494a89,'resolveWithFullResponse':!![],'encoding':_0x29a0ec,'qs':_0xf97fc1[_0x22fd('0x34')]};if(_0xf97fc1['headers']){_0x31ffb7[_0x22fd('0x9c')]=_0xf97fc1['headers'];if(_0x31ffb7[_0x22fd('0x9c')][_0x22fd('0x9d')]){delete _0x31ffb7[_0x22fd('0x9c')][_0x22fd('0x9d')];}}if(_0x31ffb7[_0x22fd('0x9c')][_0x22fd('0x9e')]){delete _0x31ffb7[_0x22fd('0x9c')][_0x22fd('0x9e')];}return rp(_0x31ffb7);})[_0x22fd('0x29')](function(_0x353add){if(_0x353add){_0x233cd6[_0x22fd('0x26')](_0x353add[_0x22fd('0x9c')]);logger[_0x22fd('0x63')](_0x353add[_0x22fd('0x94')]);if(_['endsWith'](_0xf97fc1[_0x22fd('0x34')][_0x22fd('0x7')],_0x22fd('0x4d'))&&_0x353add[_0x22fd('0x9f')]==0x1f4){return _0x233cd6['sendStatus'](_0x353add[_0x22fd('0x9f')]);}else{return _0x233cd6['status'](_0x353add[_0x22fd('0x9f')])[_0x22fd('0x2e')](_0x353add[_0x22fd('0x94')]);}}else{return _0x233cd6[_0x22fd('0xa0')](0xc8);}})[_0x22fd('0x48')](handleError(_0x233cd6,null));};exports[_0x22fd('0xa1')]=function(_0x4104a9,_0x23ce51,_0x221dae){return BPromise[_0x22fd('0x95')]()[_0x22fd('0x29')](function(){if(!_0x4104a9[_0x22fd('0x34')]['path']){throw new Error(_0x22fd('0xa2'));}if(!_0x4104a9['query'][_0x22fd('0x96')]){throw new Error(_0x22fd('0x97'));}var _0x49680d=_0x4104a9[_0x22fd('0x34')][_0x22fd('0x98')]?_0x4104a9['query'][_0x22fd('0x98')]+':'+_0x4104a9[_0x22fd('0x34')][_0x22fd('0x96')]:_0x22fd('0x99')+_0x4104a9['query'][_0x22fd('0x96')];var _0x46a5ae=_0x4104a9['query'][_0x22fd('0x21')]?_0x4104a9[_0x22fd('0x34')][_0x22fd('0x21')]:!![];var _0x546372=_0x4104a9[_0x22fd('0x34')][_0x22fd('0x9a')]?_0x4104a9[_0x22fd('0x34')][_0x22fd('0x9a')]:null;var _0x15d83a={'method':_0x4104a9['method'],'uri':util[_0x22fd('0x51')](_0x22fd('0xa3'),_0x49680d,_0x4104a9[_0x22fd('0x34')][_0x22fd('0x7')]),'json':_0x46a5ae,'resolveWithFullResponse':!![],'encoding':_0x546372,'body':_0x4104a9[_0x22fd('0x94')]};if(_0x4104a9[_0x22fd('0x9c')]){_0x15d83a['headers']=_0x4104a9['headers'];if(_0x15d83a[_0x22fd('0x9c')][_0x22fd('0x9d')]){delete _0x15d83a['headers'][_0x22fd('0x9d')];}}if(_0x15d83a[_0x22fd('0x9c')][_0x22fd('0x9e')]){delete _0x15d83a['headers'][_0x22fd('0x9e')];}return rp(_0x15d83a);})[_0x22fd('0x29')](function(_0x1b8700){if(_0x1b8700){_0x23ce51[_0x22fd('0x26')](_0x1b8700['headers']);logger[_0x22fd('0x63')](_0x1b8700[_0x22fd('0x94')]);return _0x23ce51['status'](_0x1b8700['statusCode'])[_0x22fd('0x2e')](_0x1b8700[_0x22fd('0x94')]);}else{return _0x23ce51['sendStatus'](0xc8);}})[_0x22fd('0x48')](handleError(_0x23ce51,null));}; \ No newline at end of file +var _0x7f32=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','sendStatus','error','name','send','Plugin','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','fields','options','find','download','join','root','server/files/plugins','%s.zip','basename','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','filename','extname','file','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','views','parameters','admin','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','scriptPath','create','body','userProfileId','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','params','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','format','%s%s','headers','content-length','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','content-type','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x41e706,_0x1a5050){var _0x30dfa5=function(_0x4d212d){while(--_0x4d212d){_0x41e706['push'](_0x41e706['shift']());}};_0x30dfa5(++_0x1a5050);}(_0x7f32,0x1e1));var _0x27f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f32[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x27f3('0x0'));var rimraf=require(_0x27f3('0x1'));var zipdir=require(_0x27f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27f3('0x3'));var moment=require(_0x27f3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x27f3('0x5'));var util=require(_0x27f3('0x6'));var path=require(_0x27f3('0x7'));var sox=require(_0x27f3('0x8'));var csv=require(_0x27f3('0x9'));var ejs=require(_0x27f3('0xa'));var fs=require('fs');var fs_extra=require(_0x27f3('0xb'));var _=require(_0x27f3('0xc'));var squel=require('squel');var crypto=require(_0x27f3('0xd'));var jsforce=require(_0x27f3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x27f3('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x27f3('0xf'));var rimraf=require(_0x27f3('0x1'));var archiver=require(_0x27f3('0x10'));var Redis=require(_0x27f3('0x11'));var authService=require(_0x27f3('0x12'));var qs=require(_0x27f3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27f3('0x14'));var logger=require(_0x27f3('0x15'))(_0x27f3('0x16'));var utils=require('../../config/utils');var config=require(_0x27f3('0x17'));var licenseUtil=require(_0x27f3('0x18'));var db=require(_0x27f3('0x19'))['db'];config[_0x27f3('0x1a')]=_[_0x27f3('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x27f3('0x1c'))(new Redis(config[_0x27f3('0x1a')]));require(_0x27f3('0x1d'))[_0x27f3('0x1e')](socket);function respondWithStatusCode(_0x683d71,_0x72452a){_0x72452a=_0x72452a||0xcc;return function(_0x4965ad){if(_0x4965ad){return _0x683d71['sendStatus'](_0x72452a);}return _0x683d71[_0x27f3('0x1f')](_0x72452a)[_0x27f3('0x20')]();};}function respondWithResult(_0x480563,_0x559152){_0x559152=_0x559152||0xc8;return function(_0x159b7b){if(_0x159b7b){return _0x480563[_0x27f3('0x1f')](_0x559152)['json'](_0x159b7b);}};}function respondWithFilteredResult(_0x260db4,_0x36c792){return function(_0x1448f6){if(_0x1448f6){var _0x5ae32c=typeof _0x36c792[_0x27f3('0x21')]==='undefined'&&typeof _0x36c792[_0x27f3('0x22')]===_0x27f3('0x23');var _0x5a747f=_0x1448f6[_0x27f3('0x24')];var _0x3a6b4b=_0x5ae32c?0x0:_0x36c792[_0x27f3('0x21')];var _0x16a005=_0x5ae32c?_0x1448f6[_0x27f3('0x24')]:_0x36c792[_0x27f3('0x21')]+_0x36c792[_0x27f3('0x22')];var _0x545418;if(_0x16a005>=_0x5a747f){_0x16a005=_0x5a747f;_0x545418=0xc8;}else{_0x545418=0xce;}_0x260db4[_0x27f3('0x1f')](_0x545418);return _0x260db4[_0x27f3('0x25')](_0x27f3('0x26'),_0x3a6b4b+'-'+_0x16a005+'/'+_0x5a747f)[_0x27f3('0x27')](_0x1448f6);}return null;};}function patchUpdates(_0x4ae266){return function(_0x19b8d0){try{jsonpatch[_0x27f3('0x28')](_0x19b8d0,_0x4ae266,!![]);}catch(_0x10aff5){return BPromise[_0x27f3('0x29')](_0x10aff5);}return _0x19b8d0[_0x27f3('0x2a')]();};}function saveUpdates(_0x2cce21,_0x1077de){return function(_0x13db4c){if(_0x13db4c){return _0x13db4c[_0x27f3('0x2b')](_0x2cce21)['then'](function(_0x44d6e2){return _0x44d6e2;});}return null;};}function removeEntity(_0xe4108,_0x22d02d){return function(_0x531a88){if(_0x531a88){return _0x531a88[_0x27f3('0x2c')]()[_0x27f3('0x2d')](function(){var _0x5da540=_0x531a88[_0x27f3('0x2e')]({'plain':!![]});var _0x1615e6=_0x27f3('0x2f');return db[_0x27f3('0x30')]['destroy']({'where':{'type':_0x1615e6,'resourceId':_0x5da540['id']}})[_0x27f3('0x2d')](function(){return _0x531a88;});})['then'](function(){_0xe4108[_0x27f3('0x1f')](0xcc)[_0x27f3('0x20')]();});}};}function handleEntityNotFound(_0x51245f,_0x428c02){return function(_0x7becc7){if(!_0x7becc7){_0x51245f[_0x27f3('0x31')](0x194);}return _0x7becc7;};}function handleError(_0x444b3d,_0x417103){_0x417103=_0x417103||0x1f4;return function(_0xf8c5a2){logger[_0x27f3('0x32')](_0xf8c5a2['stack']);if(_0xf8c5a2[_0x27f3('0x33')]){delete _0xf8c5a2['name'];}_0x444b3d['status'](_0x417103)[_0x27f3('0x34')](_0xf8c5a2);};}exports['index']=function(_0x307dbe,_0x2cae69){var _0xcaaba3={},_0x529361={},_0x1c6bcd={'count':0x0,'rows':[]};var _0x258f24=_['map'](db[_0x27f3('0x35')][_0x27f3('0x36')],function(_0x4cb099){return{'name':_0x4cb099[_0x27f3('0x37')],'type':_0x4cb099[_0x27f3('0x38')][_0x27f3('0x39')]};});_0x529361['model']=_[_0x27f3('0x3a')](_0x258f24,_0x27f3('0x33'));_0x529361[_0x27f3('0x3b')]=_[_0x27f3('0x3c')](_0x307dbe['query']);_0x529361[_0x27f3('0x3d')]=_[_0x27f3('0x3e')](_0x529361[_0x27f3('0x3f')],_0x529361['query']);_0xcaaba3[_0x27f3('0x40')]=_[_0x27f3('0x3e')](_0x529361['model'],qs['fields'](_0x307dbe['query']['fields']));_0xcaaba3['attributes']=_0xcaaba3[_0x27f3('0x40')][_0x27f3('0x41')]?_0xcaaba3[_0x27f3('0x40')]:_0x529361[_0x27f3('0x3f')];if(!_0x307dbe[_0x27f3('0x3b')][_0x27f3('0x42')](_0x27f3('0x43'))){_0xcaaba3[_0x27f3('0x22')]=qs[_0x27f3('0x22')](_0x307dbe[_0x27f3('0x3b')][_0x27f3('0x22')]);_0xcaaba3[_0x27f3('0x21')]=qs['offset'](_0x307dbe[_0x27f3('0x3b')][_0x27f3('0x21')]);}_0xcaaba3[_0x27f3('0x44')]=qs[_0x27f3('0x45')](_0x307dbe['query'][_0x27f3('0x45')]);_0xcaaba3['where']=qs[_0x27f3('0x3d')](_[_0x27f3('0x46')](_0x307dbe[_0x27f3('0x3b')],_0x529361['filters']),_0x258f24);if(_0x307dbe[_0x27f3('0x3b')][_0x27f3('0x47')]){_0xcaaba3[_0x27f3('0x48')]=_[_0x27f3('0x49')](_0xcaaba3[_0x27f3('0x48')],{'$or':_[_0x27f3('0x3a')](_0x258f24,function(_0x405c76){if(_0x405c76['type']!==_0x27f3('0x4a')){var _0x59ce13={};_0x59ce13[_0x405c76[_0x27f3('0x33')]]={'$like':'%'+_0x307dbe[_0x27f3('0x3b')][_0x27f3('0x47')]+'%'};return _0x59ce13;}})});}_0xcaaba3=_['merge']({},_0xcaaba3,_0x307dbe['options']);var _0x2d12ed={'where':_0xcaaba3[_0x27f3('0x48')]};return db[_0x27f3('0x35')][_0x27f3('0x24')](_0x2d12ed)['then'](function(_0x2e426d){_0x1c6bcd[_0x27f3('0x24')]=_0x2e426d;if(_0x307dbe[_0x27f3('0x3b')][_0x27f3('0x4b')]){_0xcaaba3['include']=[{'all':!![]}];}return db['Plugin'][_0x27f3('0x4c')](_0xcaaba3);})[_0x27f3('0x2d')](function(_0x1f730a){_0x1c6bcd[_0x27f3('0x4d')]=_0x1f730a;return _0x1c6bcd;})['then'](respondWithFilteredResult(_0x2cae69,_0xcaaba3))[_0x27f3('0x4e')](handleError(_0x2cae69,null));};exports[_0x27f3('0x4f')]=function(_0x198b67,_0x35327f){var _0x13cdc6={'raw':!![],'where':{'id':_0x198b67['params']['id']}},_0x220baf={};_0x220baf['model']=_['keys'](db[_0x27f3('0x35')][_0x27f3('0x36')]);_0x220baf[_0x27f3('0x3b')]=_['keys'](_0x198b67[_0x27f3('0x3b')]);_0x220baf[_0x27f3('0x3d')]=_[_0x27f3('0x3e')](_0x220baf[_0x27f3('0x3f')],_0x220baf[_0x27f3('0x3b')]);_0x13cdc6[_0x27f3('0x40')]=_[_0x27f3('0x3e')](_0x220baf[_0x27f3('0x3f')],qs[_0x27f3('0x50')](_0x198b67['query'][_0x27f3('0x50')]));_0x13cdc6[_0x27f3('0x40')]=_0x13cdc6[_0x27f3('0x40')][_0x27f3('0x41')]?_0x13cdc6[_0x27f3('0x40')]:_0x220baf[_0x27f3('0x3f')];if(_0x198b67['query'][_0x27f3('0x4b')]){_0x13cdc6['include']=[{'all':!![]}];}_0x13cdc6=_[_0x27f3('0x49')]({},_0x13cdc6,_0x198b67[_0x27f3('0x51')]);return db[_0x27f3('0x35')][_0x27f3('0x52')](_0x13cdc6)[_0x27f3('0x2d')](handleEntityNotFound(_0x35327f,null))[_0x27f3('0x2d')](respondWithResult(_0x35327f,null))[_0x27f3('0x4e')](handleError(_0x35327f,null));};exports[_0x27f3('0x53')]=function(_0x2e5193,_0xe219b4,_0x159821){return db[_0x27f3('0x35')][_0x27f3('0x52')]({'where':{'id':_0x2e5193['params']['id']},'attributes':[_0x27f3('0x33'),_0x27f3('0x7')],'raw':!![]})[_0x27f3('0x2d')](handleEntityNotFound(_0xe219b4,null))[_0x27f3('0x2d')](function(_0x1a3570){if(_0x1a3570){var _0x3400ed=path[_0x27f3('0x54')](config[_0x27f3('0x55')],_0x27f3('0x56'),util['format'](_0x27f3('0x57'),path[_0x27f3('0x58')](_0x1a3570['path'])));var _0x6f284b=fs['createWriteStream'](_0x3400ed);var _0x35816a=archiver(_0x27f3('0x59'),{'zlib':{'level':0x9}});_0x35816a['on'](_0x27f3('0x5a'),function(_0x3358c9){if(_0x3358c9['code']===_0x27f3('0x5b')){logger[_0x27f3('0x32')](_0x3358c9);}else{throw new db[(_0x27f3('0x5c'))][(_0x27f3('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x35816a['on'](_0x27f3('0x32'),function(_0xa9141e){throw new db[(_0x27f3('0x5c'))]['Error'](_0x27f3('0x5e'));});_0x35816a[_0x27f3('0x5f')](_0x6f284b);_0x35816a[_0x27f3('0x60')]('**/*',{'cwd':path[_0x27f3('0x54')](config[_0x27f3('0x55')],_0x27f3('0x56'),path[_0x27f3('0x61')](_0x1a3570[_0x27f3('0x7')])),'ignore':[path[_0x27f3('0x54')](path[_0x27f3('0x58')](_0x1a3570[_0x27f3('0x7')]),'node_modules/**/*'),path[_0x27f3('0x54')](path[_0x27f3('0x58')](_0x1a3570[_0x27f3('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x6f284b['on']('close',function(){if(!fs[_0x27f3('0x62')](_0x3400ed)){throw new db[(_0x27f3('0x5c'))]['Error'](_0x27f3('0x63'));}return _0xe219b4[_0x27f3('0x53')](_0x3400ed,util['format'](_0x27f3('0x57'),path[_0x27f3('0x58')](_0x1a3570[_0x27f3('0x7')])),function(_0x555074){if(_0x555074){throw new db[(_0x27f3('0x5c'))][(_0x27f3('0x5d'))](_0x27f3('0x64'));}fs[_0x27f3('0x65')](_0x3400ed);logger[_0x27f3('0x66')]('Download\x20completed');logger[_0x27f3('0x66')]('Temporary\x20file\x20removed');});});}return null;})[_0x27f3('0x4e')](handleError(_0xe219b4,null));};exports['upload']=function(_0x34facf,_0x3b8ffa,_0x984792){var _0x5b4b38=path[_0x27f3('0x58')](_0x34facf['file'][_0x27f3('0x67')],path[_0x27f3('0x68')](_0x34facf[_0x27f3('0x69')][_0x27f3('0x67')]));var _0x21fac5=path[_0x27f3('0x54')](config[_0x27f3('0x55')],_0x27f3('0x56'),_0x34facf[_0x27f3('0x69')][_0x27f3('0x67')]);var _0x6d6114=path[_0x27f3('0x54')](config[_0x27f3('0x55')],'server/files/plugins',_0x5b4b38);logger[_0x27f3('0x66')]('Plugin\x20upload\x20filepath:\x20%s',_0x21fac5);logger[_0x27f3('0x66')](_0x27f3('0x6a'),_0x6d6114);try{fs['chmodSync'](_0x21fac5,parseInt('0777',0x8));extract(_0x21fac5,{'dir':_0x6d6114},function(_0x5490c0){if(_0x5490c0){logger[_0x27f3('0x32')](_0x5490c0);handleError(_0x5490c0,!![]);};var _0x38cd37=fs[_0x27f3('0x6b')](_0x6d6114);if(_0x38cd37[_0x27f3('0x41')]>0x1){removeReferences(_0x21fac5,_0x6d6114);logger[_0x27f3('0x32')](_0x27f3('0x6c'));return _0x984792(new Error(_0x27f3('0x6c')));}var _0x35f377=fs[_0x27f3('0x6d')](path[_0x27f3('0x54')](_0x6d6114,_0x38cd37[0x0]));if(_0x35f377[_0x27f3('0x6e')]()){removeReferences(_0x21fac5,_0x6d6114);logger[_0x27f3('0x32')](_0x27f3('0x6c'));return _0x984792(new Error('Invalid\x20plugin\x20structure'));}if(_0x35f377[_0x27f3('0x6f')]()){var _0x48875e=fs[_0x27f3('0x6b')](path[_0x27f3('0x54')](_0x6d6114,_0x38cd37[0x0]));if(_0x48875e[_0x27f3('0x41')]===0x0){removeReferences(_0x21fac5,_0x6d6114);logger['error'](_0x27f3('0x6c'));return _0x984792(new Error('Invalid\x20plugin\x20structure'));}var _0x2cb55b=_0x48875e['some'](function(_0x3e5542){return _0x3e5542===_0x27f3('0x70');});if(!_0x2cb55b){return _0x984792(new Error(_0x27f3('0x71')));}var _0x16e99b=fs[_0x27f3('0x72')](path[_0x27f3('0x54')](_0x6d6114,_0x38cd37[0x0],_0x27f3('0x70')));var _0x294d38=JSON[_0x27f3('0x73')](_0x16e99b);if(_0x27f3('0x23')==typeof _0x294d38[_0x27f3('0x33')]){return _0x984792(new Error(_0x27f3('0x74')));}if(_0x27f3('0x23')==typeof _0x294d38[_0x27f3('0x38')]){return _0x984792(new Error(_0x27f3('0x75')));}if(_0x27f3('0x23')==typeof _0x294d38[_0x27f3('0x76')]){return _0x984792(new Error(_0x27f3('0x77')));}if(_0x27f3('0x23')==typeof _0x294d38['parameters']){return _0x984792(new Error(_0x27f3('0x78')));}if(_0x294d38[_0x27f3('0x38')]==='html'){if(_0x27f3('0x23')==typeof _0x294d38['parameters'][_0x27f3('0x79')]){return _0x984792(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x27f3('0x23')==typeof _0x294d38[_0x27f3('0x7a')]['views'][_0x27f3('0x7b')]&&'undefined'==typeof _0x294d38[_0x27f3('0x7a')][_0x27f3('0x79')]['agent']){return _0x984792(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x294d38['type']==='script'){if(_0x27f3('0x23')==typeof _0x294d38[_0x27f3('0x7a')][_0x27f3('0x7c')]){return _0x984792(new Error(_0x27f3('0x7d')));}if(_0x27f3('0x23')==typeof _0x294d38['parameters']['scriptPath']){return _0x984792(new Error(_0x27f3('0x7e')));}}else{return _0x984792(new Error(_0x27f3('0x7f')));}var _0x26c0c7=_0x294d38[_0x27f3('0x33')];var _0x45e7d6=_0x294d38[_0x27f3('0x80')];var _0x10987c=_0x294d38['type'];var _0x4b39a4=_0x294d38['sidebar']?_0x294d38[_0x27f3('0x81')]:_0x27f3('0x82');var _0x13d7bb=_0x294d38[_0x27f3('0x83')]?_0x294d38['icon']:_0x27f3('0x84');var _0x569125='';var _0xfbfd47='';var _0x2b2fa7='';var _0x3aa76b='';var _0x492ae0=_0x294d38[_0x27f3('0x76')];if(_0x10987c==='html'){if(_0x27f3('0x23')!=typeof _0x294d38[_0x27f3('0x7a')][_0x27f3('0x79')]['admin']){var _0x5d1eca=_0x294d38[_0x27f3('0x7a')][_0x27f3('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x27f3('0x85')](_0x5d1eca)){_0x569125=path[_0x27f3('0x54')](_0x27f3('0x86'),_0x5b4b38,_0x38cd37[0x0],_0x5d1eca);}else{_0x569125=_0x5d1eca;}}else{logger['info'](_0x27f3('0x87'));}if(_0x27f3('0x23')!=typeof _0x294d38[_0x27f3('0x7a')]['views'][_0x27f3('0x88')]){var _0x18ed53=_0x294d38[_0x27f3('0x7a')][_0x27f3('0x79')][_0x27f3('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x27f3('0x85')](_0x18ed53)){_0xfbfd47=path['join'](_0x27f3('0x86'),_0x5b4b38,_0x38cd37[0x0],_0x18ed53);}else{_0xfbfd47=_0x18ed53;}}else{logger[_0x27f3('0x66')](_0x27f3('0x89'));}}else if(_0x10987c===_0x27f3('0x8a')){_0x2b2fa7=_0x294d38[_0x27f3('0x7a')][_0x27f3('0x7c')];_0x3aa76b=_0x294d38[_0x27f3('0x7a')][_0x27f3('0x8b')];if(_0x27f3('0x23')!=typeof _0x294d38[_0x27f3('0x7a')]['views']){if('undefined'!=typeof _0x294d38[_0x27f3('0x7a')][_0x27f3('0x79')][_0x27f3('0x7b')]){var _0x5d1eca=_0x294d38[_0x27f3('0x7a')][_0x27f3('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x5d1eca)){_0x569125=path[_0x27f3('0x54')](_0x27f3('0x86'),_0x5b4b38,_0x38cd37[0x0],_0x5d1eca);}else{_0x569125=_0x5d1eca;}}if(_0x27f3('0x23')!=typeof _0x294d38[_0x27f3('0x7a')][_0x27f3('0x79')][_0x27f3('0x88')]){var _0x18ed53=_0x294d38[_0x27f3('0x7a')][_0x27f3('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x27f3('0x85')](_0x18ed53)){_0xfbfd47=path[_0x27f3('0x54')](_0x27f3('0x86'),_0x5b4b38,_0x38cd37[0x0],_0x18ed53);}else{_0xfbfd47=_0x18ed53;}}}}var _0x541560={'name':_0x26c0c7,'description':_0x45e7d6,'path':path['join'](_0x5b4b38,_0x38cd37[0x0]),'type':_0x10987c,'sidebar':_0x4b39a4,'icon':_0x13d7bb,'adminUrl':_0x569125,'agentUrl':_0xfbfd47,'scriptName':_0x2b2fa7,'scriptPath':_0x3aa76b,'version':_0x492ae0};removeReferences(_0x21fac5,null);return db[_0x27f3('0x35')][_0x27f3('0x8c')](_0x541560)[_0x27f3('0x2d')](function(_0x4bffeb){var _0x108bc6={'role':_0x34facf['body']['role'],'userProfileId':_0x34facf[_0x27f3('0x8d')][_0x27f3('0x8e')]};if(!_0x108bc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x108bc6[_0x27f3('0x8f')]===_0x27f3('0x90')){var _0x9100b6=_0x4bffeb[_0x27f3('0x2e')]({'plain':!![]});return db[_0x27f3('0x91')][_0x27f3('0x52')]({'where':{'name':_0x27f3('0x2f'),'userProfileId':_0x108bc6[_0x27f3('0x8e')]},'raw':!![]})[_0x27f3('0x2d')](function(_0xdf318c){if(_0xdf318c&&_0xdf318c[_0x27f3('0x92')]===0x0){return db['UserProfileResource'][_0x27f3('0x8c')]({'name':_0x9100b6[_0x27f3('0x33')],'resourceId':_0x9100b6['id'],'type':_0xdf318c[_0x27f3('0x33')],'sectionId':_0xdf318c['id']},{})[_0x27f3('0x2d')](function(){return _0x4bffeb;});}else{return _0x4bffeb;}})[_0x27f3('0x4e')](function(_0x5d5e0f){logger[_0x27f3('0x32')](_0x27f3('0x93'),_0x5d5e0f);throw _0x5d5e0f;});}return _0x4bffeb;})[_0x27f3('0x2d')](respondWithResult(_0x3b8ffa,null))[_0x27f3('0x4e')](handleError(_0x3b8ffa,null));}});}catch(_0x5ee0dc){_0x3b8ffa[_0x27f3('0x1f')](0x1f4)[_0x27f3('0x34')](_0x5ee0dc);}};function removeReferences(_0x8f8c01,_0x384cbd){try{if(_0x8f8c01){fs[_0x27f3('0x65')](_0x8f8c01);logger[_0x27f3('0x66')](_0x27f3('0x94'));}if(_0x384cbd){rimraf(_0x384cbd,function(){});logger[_0x27f3('0x66')](_0x27f3('0x95'));}}catch(_0xeb52d4){logger[_0x27f3('0x32')](_0xeb52d4);}}exports[_0x27f3('0x2b')]=function(_0x1a9aa4,_0x1fceb9,_0x787812){return db[_0x27f3('0x35')][_0x27f3('0x52')]({'where':{'id':_0x1a9aa4[_0x27f3('0x96')]['id']}})[_0x27f3('0x2d')](handleEntityNotFound(_0x1fceb9,null))[_0x27f3('0x2d')](saveUpdates(_0x1a9aa4[_0x27f3('0x8d')],null))[_0x27f3('0x2d')](respondWithResult(_0x1fceb9,null))[_0x27f3('0x4e')](handleError(_0x1fceb9,null));};exports[_0x27f3('0x97')]=function(_0x4fab98,_0x242599,_0x2af459){return db[_0x27f3('0x35')]['find']({'where':{'id':_0x4fab98[_0x27f3('0x96')]['id']}})['then'](function(_0x4799ab){if(_0x4799ab){return _0x4799ab[_0x27f3('0x2c')]();}})[_0x27f3('0x2d')](function(_0x3e367e){rimraf(path['join'](config[_0x27f3('0x55')],_0x27f3('0x56'),path['dirname'](_0x3e367e[_0x27f3('0x7')])),function(){});return _0x3e367e;})[_0x27f3('0x2d')](handleEntityNotFound(_0x242599,null))[_0x27f3('0x2d')](respondWithStatusCode(_0x242599,null))[_0x27f3('0x4e')](handleError(_0x242599,null));};exports[_0x27f3('0x98')]=function(_0xb74389,_0x36f07f,_0x33c739){return BPromise[_0x27f3('0x99')]()[_0x27f3('0x2d')](function(){if(!_0xb74389[_0x27f3('0x3b')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xb74389[_0x27f3('0x3b')][_0x27f3('0x9a')]){throw new Error(_0x27f3('0x9b'));}var _0x99fd2=_0xb74389[_0x27f3('0x3b')][_0x27f3('0x9c')]?_0xb74389[_0x27f3('0x3b')][_0x27f3('0x9c')]+':'+_0xb74389[_0x27f3('0x3b')][_0x27f3('0x9a')]:_0x27f3('0x9d')+_0xb74389[_0x27f3('0x3b')][_0x27f3('0x9a')];var _0xccb24f=_0xb74389[_0x27f3('0x3b')][_0x27f3('0x27')]?_0xb74389[_0x27f3('0x3b')][_0x27f3('0x27')]:!![];var _0xd8abe6=_0xb74389[_0x27f3('0x3b')][_0x27f3('0x9e')]?_0xb74389[_0x27f3('0x3b')]['encoding']:null;var _0x541be4={'method':_0xb74389[_0x27f3('0x9f')],'uri':util[_0x27f3('0xa0')](_0x27f3('0xa1'),_0x99fd2,_0xb74389['query'][_0x27f3('0x7')]),'json':_0xccb24f,'resolveWithFullResponse':!![],'encoding':_0xd8abe6,'qs':_0xb74389[_0x27f3('0x3b')]};if(_0xb74389['headers']){_0x541be4[_0x27f3('0xa2')]=_0xb74389[_0x27f3('0xa2')];if(_0x541be4['headers'][_0x27f3('0xa3')]){delete _0x541be4[_0x27f3('0xa2')][_0x27f3('0xa3')];}}if(_0x541be4['headers']['content-type']){delete _0x541be4[_0x27f3('0xa2')]['content-type'];}return rp(_0x541be4);})[_0x27f3('0x2d')](function(_0x230d17){if(_0x230d17){_0x36f07f[_0x27f3('0x25')](_0x230d17[_0x27f3('0xa2')]);logger[_0x27f3('0x66')](_0x230d17[_0x27f3('0x8d')]);if(_[_0x27f3('0xa4')](_0xb74389[_0x27f3('0x3b')][_0x27f3('0x7')],'download')&&_0x230d17['statusCode']==0x1f4){return _0x36f07f[_0x27f3('0x31')](_0x230d17[_0x27f3('0xa5')]);}else{return _0x36f07f[_0x27f3('0x1f')](_0x230d17['statusCode'])['send'](_0x230d17[_0x27f3('0x8d')]);}}else{return _0x36f07f[_0x27f3('0x31')](0xc8);}})[_0x27f3('0x4e')](handleError(_0x36f07f,null));};exports['webhookPost']=function(_0x5d3e0e,_0x129724,_0x3e5998){return BPromise[_0x27f3('0x99')]()[_0x27f3('0x2d')](function(){if(!_0x5d3e0e[_0x27f3('0x3b')][_0x27f3('0x7')]){throw new Error(_0x27f3('0xa6'));}if(!_0x5d3e0e[_0x27f3('0x3b')][_0x27f3('0x9a')]){throw new Error(_0x27f3('0x9b'));}var _0x1fb92d=_0x5d3e0e['query'][_0x27f3('0x9c')]?_0x5d3e0e[_0x27f3('0x3b')][_0x27f3('0x9c')]+':'+_0x5d3e0e[_0x27f3('0x3b')][_0x27f3('0x9a')]:_0x27f3('0x9d')+_0x5d3e0e[_0x27f3('0x3b')][_0x27f3('0x9a')];var _0x218888=_0x5d3e0e['query']['json']?_0x5d3e0e['query'][_0x27f3('0x27')]:!![];var _0xc471a7=_0x5d3e0e[_0x27f3('0x3b')][_0x27f3('0x9e')]?_0x5d3e0e[_0x27f3('0x3b')][_0x27f3('0x9e')]:null;var _0x5b8153={'method':_0x5d3e0e[_0x27f3('0x9f')],'uri':util['format'](_0x27f3('0xa1'),_0x1fb92d,_0x5d3e0e[_0x27f3('0x3b')][_0x27f3('0x7')]),'json':_0x218888,'resolveWithFullResponse':!![],'encoding':_0xc471a7,'body':_0x5d3e0e[_0x27f3('0x8d')]};if(_0x5d3e0e[_0x27f3('0xa2')]){_0x5b8153[_0x27f3('0xa2')]=_0x5d3e0e[_0x27f3('0xa2')];if(_0x5b8153[_0x27f3('0xa2')][_0x27f3('0xa3')]){delete _0x5b8153['headers'][_0x27f3('0xa3')];}}if(_0x5b8153[_0x27f3('0xa2')][_0x27f3('0xa7')]){delete _0x5b8153[_0x27f3('0xa2')][_0x27f3('0xa7')];}return rp(_0x5b8153);})[_0x27f3('0x2d')](function(_0x447a95){if(_0x447a95){_0x129724[_0x27f3('0x25')](_0x447a95['headers']);logger[_0x27f3('0x66')](_0x447a95['body']);return _0x129724['status'](_0x447a95[_0x27f3('0xa5')])[_0x27f3('0x34')](_0x447a95['body']);}else{return _0x129724[_0x27f3('0x31')](0xc8);}})[_0x27f3('0x4e')](handleError(_0x129724,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 61fe29b..3664db4 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 _0xce22=['events','../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0xa7de0e,_0x22ae8d){var _0x508b97=function(_0x1e9f2d){while(--_0x1e9f2d){_0xa7de0e['push'](_0xa7de0e['shift']());}};_0x508b97(++_0x22ae8d);}(_0xce22,0xea));var _0x2ce2=function(_0xcc61ed,_0xaa2193){_0xcc61ed=_0xcc61ed-0x0;var _0x4eee8=_0xce22[_0xcc61ed];return _0x4eee8;};'use strict';var EventEmitter=require(_0x2ce2('0x0'));var Plugin=require(_0x2ce2('0x1'))['db'][_0x2ce2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x2ce2('0x3')](0x0);var events={'afterCreate':_0x2ce2('0x4'),'afterUpdate':'update','afterDestroy':_0x2ce2('0x5')};function emitEvent(_0x5bc506){return function(_0x26b273,_0x1801be,_0x470a06){PluginEvents[_0x2ce2('0x6')](_0x5bc506+':'+_0x26b273['id'],_0x26b273);PluginEvents[_0x2ce2('0x6')](_0x5bc506,_0x26b273);_0x470a06(null);};}for(var e in events){if(events[_0x2ce2('0x7')](e)){var event=events[e];Plugin[_0x2ce2('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xaee6=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x493a89,_0x2f5fac){var _0x5be45c=function(_0x1147ed){while(--_0x1147ed){_0x493a89['push'](_0x493a89['shift']());}};_0x5be45c(++_0x2f5fac);}(_0xaee6,0x187));var _0x6aee=function(_0x2ab9ff,_0x2cad1b){_0x2ab9ff=_0x2ab9ff-0x0;var _0xde6c81=_0xaee6[_0x2ab9ff];return _0xde6c81;};'use strict';var EventEmitter=require(_0x6aee('0x0'));var Plugin=require(_0x6aee('0x1'))['db'][_0x6aee('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6aee('0x3')](0x0);var events={'afterCreate':_0x6aee('0x4'),'afterUpdate':_0x6aee('0x5'),'afterDestroy':'remove'};function emitEvent(_0x46980d){return function(_0x3f11af,_0x1e23ba,_0x5e83b4){PluginEvents[_0x6aee('0x6')](_0x46980d+':'+_0x3f11af['id'],_0x3f11af);PluginEvents[_0x6aee('0x6')](_0x46980d,_0x3f11af);_0x5e83b4(null);};}for(var e in events){if(events[_0x6aee('0x7')](e)){var event=events[e];Plugin[_0x6aee('0x8')](e,emitEvent(event));}}module[_0x6aee('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 4c48007..3380119 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 _0x09f8=['util','api','moment','path','rimraf','./plugin.attributes','exports','define','Plugin','plugins','lodash'];(function(_0xa3400,_0x3a980a){var _0x33dba2=function(_0x5e988b){while(--_0x5e988b){_0xa3400['push'](_0xa3400['shift']());}};_0x33dba2(++_0x3a980a);}(_0x09f8,0x8e));var _0x809f=function(_0x4e7c78,_0x14a6e7){_0x4e7c78=_0x4e7c78-0x0;var _0x353032=_0x09f8[_0x4e7c78];return _0x353032;};'use strict';var _=require(_0x809f('0x0'));var util=require(_0x809f('0x1'));var logger=require('../../config/logger')(_0x809f('0x2'));var moment=require(_0x809f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x809f('0x4'));var rimraf=require(_0x809f('0x5'));var config=require('../../config/environment');var attributes=require(_0x809f('0x6'));module[_0x809f('0x7')]=function(_0x2c7dcc,_0x3f62f4){return _0x2c7dcc[_0x809f('0x8')](_0x809f('0x9'),attributes,{'tableName':_0x809f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d60=['bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define','plugins','lodash','util','../../config/logger','api','moment'];(function(_0x47d95d,_0xe3f35a){var _0x154f04=function(_0x272d74){while(--_0x272d74){_0x47d95d['push'](_0x47d95d['shift']());}};_0x154f04(++_0xe3f35a);}(_0x5d60,0x126));var _0x05d6=function(_0x8d1fc8,_0x61858f){_0x8d1fc8=_0x8d1fc8-0x0;var _0x47f3c5=_0x5d60[_0x8d1fc8];return _0x47f3c5;};'use strict';var _=require(_0x05d6('0x0'));var util=require(_0x05d6('0x1'));var logger=require(_0x05d6('0x2'))(_0x05d6('0x3'));var moment=require(_0x05d6('0x4'));var BPromise=require(_0x05d6('0x5'));var rp=require(_0x05d6('0x6'));var fs=require('fs');var path=require(_0x05d6('0x7'));var rimraf=require(_0x05d6('0x8'));var config=require('../../config/environment');var attributes=require(_0x05d6('0x9'));module[_0x05d6('0xa')]=function(_0x5bf70c,_0x29616c){return _0x5bf70c[_0x05d6('0xb')]('Plugin',attributes,{'tableName':_0x05d6('0xc'),'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 82812f8..b67abe6 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 _0x4e5a=['then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','Plugin','create','body','raw','CreatePlugin','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','register'];(function(_0x2d7b1d,_0x599a25){var _0x51d73f=function(_0x2477dc){while(--_0x2477dc){_0x2d7b1d['push'](_0x2d7b1d['shift']());}};_0x51d73f(++_0x599a25);}(_0x4e5a,0x143));var _0xa4e5=function(_0x3c357e,_0x4c3edf){_0x3c357e=_0x3c357e-0x0;var _0x5cec9c=_0x4e5a[_0x3c357e];return _0x5cec9c;};'use strict';var _=require(_0xa4e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa4e5('0x1'));var rs=require(_0xa4e5('0x2'));var fs=require('fs');var Redis=require(_0xa4e5('0x3'));var db=require(_0xa4e5('0x4'))['db'];var utils=require(_0xa4e5('0x5'));var logger=require(_0xa4e5('0x6'))(_0xa4e5('0x7'));var config=require(_0xa4e5('0x8'));var jayson=require(_0xa4e5('0x9'));var client=jayson[_0xa4e5('0xa')][_0xa4e5('0xb')]({'port':0x232a});config[_0xa4e5('0xc')]=_[_0xa4e5('0xd')](config[_0xa4e5('0xc')],{'host':_0xa4e5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa4e5('0xc')]));require(_0xa4e5('0xf'))[_0xa4e5('0x10')](socket);function respondWithRpcPromise(_0x203879,_0x22313c,_0x343c05){return new BPromise(function(_0x57ab1d,_0x4f54fa){return client['request'](_0x203879,_0x343c05)[_0xa4e5('0x11')](function(_0x1c51fc){logger[_0xa4e5('0x12')](_0xa4e5('0x13'),_0x22313c,_0xa4e5('0x14'));logger[_0xa4e5('0x15')](_0xa4e5('0x16'),_0x22313c,'request\x20sent',JSON[_0xa4e5('0x17')](_0x1c51fc));if(_0x1c51fc['error']){if(_0x1c51fc['error'][_0xa4e5('0x18')]===0x1f4){logger[_0xa4e5('0x19')](_0xa4e5('0x13'),_0x22313c,_0x1c51fc[_0xa4e5('0x19')]['message']);return _0x4f54fa(_0x1c51fc[_0xa4e5('0x19')][_0xa4e5('0x1a')]);}logger['error'](_0xa4e5('0x13'),_0x22313c,_0x1c51fc[_0xa4e5('0x19')][_0xa4e5('0x1a')]);return _0x57ab1d(_0x1c51fc['error']['message']);}else{logger[_0xa4e5('0x12')](_0xa4e5('0x13'),_0x22313c,_0xa4e5('0x14'));_0x57ab1d(_0x1c51fc[_0xa4e5('0x1b')][_0xa4e5('0x1a')]);}})['catch'](function(_0x4f4d45){logger['error'](_0xa4e5('0x13'),_0x22313c,_0x4f4d45);_0x4f54fa(_0x4f4d45);});});}exports['CreatePlugin']=function(_0x3200d0){var _0x3e1d63=this;return new Promise(function(_0x574b9f,_0x56a06c){return db[_0xa4e5('0x1c')][_0xa4e5('0x1d')](_0x3200d0[_0xa4e5('0x1e')],{'raw':_0x3200d0['options']?_0x3200d0['options'][_0xa4e5('0x1f')]===undefined?!![]:![]:!![]})[_0xa4e5('0x11')](function(_0x41029b){logger[_0xa4e5('0x12')]('CreatePlugin',_0x3200d0);logger[_0xa4e5('0x15')](_0xa4e5('0x20'),_0x3200d0,JSON['stringify'](_0x41029b));_0x574b9f(_0x41029b);})[_0xa4e5('0x21')](function(_0x1c753e){logger['error']('CreatePlugin',_0x1c753e[_0xa4e5('0x1a')],_0x3200d0);_0x56a06c(_0x3e1d63['error'](0x1f4,_0x1c753e[_0xa4e5('0x1a')]));});});}; \ No newline at end of file +var _0x8754=['raw','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','Plugin','create','body','options'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0x8754,0xf7));var _0x4875=function(_0x35c8ca,_0xf2a176){_0x35c8ca=_0x35c8ca-0x0;var _0x2a3cbd=_0x8754[_0x35c8ca];return _0x2a3cbd;};'use strict';var _=require(_0x4875('0x0'));var util=require(_0x4875('0x1'));var moment=require(_0x4875('0x2'));var BPromise=require(_0x4875('0x3'));var rs=require(_0x4875('0x4'));var fs=require('fs');var Redis=require(_0x4875('0x5'));var db=require(_0x4875('0x6'))['db'];var utils=require(_0x4875('0x7'));var logger=require(_0x4875('0x8'))(_0x4875('0x9'));var config=require(_0x4875('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4875('0xb')][_0x4875('0xc')]({'port':0x232a});config[_0x4875('0xd')]=_['defaults'](config[_0x4875('0xd')],{'host':_0x4875('0xe'),'port':0x18eb});var socket=require(_0x4875('0xf'))(new Redis(config[_0x4875('0xd')]));require(_0x4875('0x10'))[_0x4875('0x11')](socket);function respondWithRpcPromise(_0x175642,_0x35c846,_0x344b54){return new BPromise(function(_0xfa5682,_0x320ea1){return client[_0x4875('0x12')](_0x175642,_0x344b54)['then'](function(_0x279adb){logger[_0x4875('0x13')](_0x4875('0x14'),_0x35c846,_0x4875('0x15'));logger[_0x4875('0x16')]('Plugin,\x20%s,\x20%s,\x20%s',_0x35c846,_0x4875('0x15'),JSON[_0x4875('0x17')](_0x279adb));if(_0x279adb[_0x4875('0x18')]){if(_0x279adb[_0x4875('0x18')][_0x4875('0x19')]===0x1f4){logger['error'](_0x4875('0x14'),_0x35c846,_0x279adb[_0x4875('0x18')][_0x4875('0x1a')]);return _0x320ea1(_0x279adb[_0x4875('0x18')][_0x4875('0x1a')]);}logger[_0x4875('0x18')](_0x4875('0x14'),_0x35c846,_0x279adb[_0x4875('0x18')]['message']);return _0xfa5682(_0x279adb[_0x4875('0x18')][_0x4875('0x1a')]);}else{logger[_0x4875('0x13')](_0x4875('0x14'),_0x35c846,_0x4875('0x15'));_0xfa5682(_0x279adb[_0x4875('0x1b')]['message']);}})[_0x4875('0x1c')](function(_0x1bb113){logger[_0x4875('0x18')](_0x4875('0x14'),_0x35c846,_0x1bb113);_0x320ea1(_0x1bb113);});});}exports['CreatePlugin']=function(_0x1a3852){var _0x3dbeef=this;return new Promise(function(_0x14f02c,_0x54f7f1){return db[_0x4875('0x1d')][_0x4875('0x1e')](_0x1a3852[_0x4875('0x1f')],{'raw':_0x1a3852[_0x4875('0x20')]?_0x1a3852['options'][_0x4875('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x5236d6){logger[_0x4875('0x13')]('CreatePlugin',_0x1a3852);logger[_0x4875('0x16')]('CreatePlugin',_0x1a3852,JSON[_0x4875('0x17')](_0x5236d6));_0x14f02c(_0x5236d6);})[_0x4875('0x1c')](function(_0xbd2da){logger[_0x4875('0x18')](_0x4875('0x22'),_0xbd2da[_0x4875('0x1a')],_0x1a3852);_0x54f7f1(_0x3dbeef[_0x4875('0x18')](0x1f4,_0xbd2da['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index aa155bc..11ed1be 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 _0x003e=['update','emit','removeListener','register','length','plugin:','./plugin.events','save','remove'];(function(_0x22a699,_0x45b671){var _0x5951b0=function(_0x12eea8){while(--_0x12eea8){_0x22a699['push'](_0x22a699['shift']());}};_0x5951b0(++_0x45b671);}(_0x003e,0x1a4));var _0xe003=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x003e[_0xa148b7];return _0x51efd3;};'use strict';var PluginEvents=require(_0xe003('0x0'));var events=[_0xe003('0x1'),_0xe003('0x2'),_0xe003('0x3')];function createListener(_0x2a5383,_0x42b3dc){return function(_0x1c53b8){_0x42b3dc[_0xe003('0x4')](_0x2a5383,_0x1c53b8);};}function removeListener(_0x375291,_0x48ec90){return function(){PluginEvents[_0xe003('0x5')](_0x375291,_0x48ec90);};}exports[_0xe003('0x6')]=function(_0x3fc774){for(var _0x2e8fb3=0x0,_0x374ecd=events[_0xe003('0x7')];_0x2e8fb3<_0x374ecd;_0x2e8fb3++){var _0x51fd9e=events[_0x2e8fb3];var _0x21bd0e=createListener(_0xe003('0x8')+_0x51fd9e,_0x3fc774);PluginEvents['on'](_0x51fd9e,_0x21bd0e);}}; \ No newline at end of file +var _0xfbc1=['./plugin.events','save','update','removeListener','register','length'];(function(_0x3a196b,_0x1a03c4){var _0x192dd8=function(_0x122487){while(--_0x122487){_0x3a196b['push'](_0x3a196b['shift']());}};_0x192dd8(++_0x1a03c4);}(_0xfbc1,0x90));var _0x1fbc=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xfbc1[_0x1f1e31];return _0x229b56;};'use strict';var PluginEvents=require(_0x1fbc('0x0'));var events=[_0x1fbc('0x1'),'remove',_0x1fbc('0x2')];function createListener(_0x494141,_0x53497e){return function(_0x3e9259){_0x53497e['emit'](_0x494141,_0x3e9259);};}function removeListener(_0x5ee4a0,_0x28d910){return function(){PluginEvents[_0x1fbc('0x3')](_0x5ee4a0,_0x28d910);};}exports[_0x1fbc('0x4')]=function(_0x416a36){for(var _0x4f1317=0x0,_0x39604e=events[_0x1fbc('0x5')];_0x4f1317<_0x39604e;_0x4f1317++){var _0x540652=events[_0x4f1317];var _0x23e77a=createListener('plugin:'+_0x540652,_0x416a36);PluginEvents['on'](_0x540652,_0x23e77a);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 849e504..8c98b2e 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(_0x2c5fab,_0x2e035a){var _0x17f7de=function(_0x3686a5){while(--_0x3686a5){_0x2c5fab['push'](_0x2c5fab['shift']());}};_0x17f7de(++_0x2e035a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x2e0c5e,_0x62a6cf){var _0x115508=function(_0x83d869){while(--_0x83d869){_0x2e0c5e['push'](_0x2e0c5e['shift']());}};_0x115508(++_0x62a6cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 bf23681..1f46109 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 _0xb688=['error','stack','name','send','info','index','then','reject','motion2','catch','show','describe','params','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','update','stop','Unknown\x20status','destroy','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','status','json'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0xb688,0xcf));var _0x8b68=function(_0x56e614,_0x257613){_0x56e614=_0x56e614-0x0;var _0x1417d4=_0xb688[_0x56e614];return _0x1417d4;};'use strict';var _=require('lodash');var pm2=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var path=require(_0x8b68('0x3'));var exec=require(_0x8b68('0x4'))[_0x8b68('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x41030e,_0x27925d){return function(_0x30f33d){if(!_0x30f33d){_0x41030e[_0x8b68('0x6')](0x194);;}return _0x30f33d;};}function respondWithResult(_0x583d16,_0x34314e){_0x34314e=_0x34314e||0xc8;return function(_0x57ee56){if(_0x57ee56){return _0x583d16[_0x8b68('0x7')](_0x34314e)[_0x8b68('0x8')](_0x57ee56);}return null;};}function handleError(_0x130892,_0xa5571b){_0xa5571b=_0xa5571b||0x1f4;return function(_0x132617){logger[_0x8b68('0x9')](_0x132617[_0x8b68('0xa')]);if(_0x132617[_0x8b68('0xb')]){delete _0x132617[_0x8b68('0xb')];}_0x130892[_0x8b68('0x7')](_0xa5571b)[_0x8b68('0xc')](_0x132617);};}function execChildProcess(){return new BPromise(function(_0x317d01,_0x2a852a){exec('npm\x20install',function(_0x2c0f3b,_0x4426d1,_0x5e76c){logger[_0x8b68('0xd')](_0x4426d1);logger[_0x8b68('0xd')](_0x5e76c);if(_0x2c0f3b){logger[_0x8b68('0x9')](_0x2c0f3b);return _0x2a852a(_0x2c0f3b);}return _0x317d01(_0x4426d1);});});}exports[_0x8b68('0xe')]=function(_0x137c8e,_0x2686c7){return pm2['list']()[_0x8b68('0xf')](function(_0x509033){if(_0x509033){var _0x5e3c66=_[_0x8b68('0x10')](_0x509033,function(_0x1554d6){return _0x1554d6[_0x8b68('0xb')]==='express'||_0x1554d6['name']===_0x8b68('0x11');});return{'rows':_0x5e3c66,'count':_0x5e3c66['length']};}return null;})[_0x8b68('0xf')](respondWithResult(_0x2686c7,null))[_0x8b68('0x12')](handleError(_0x2686c7,null));};exports[_0x8b68('0x13')]=function(_0x10c9c6,_0x491695){return pm2[_0x8b68('0x14')](_0x10c9c6[_0x8b68('0x15')]['id'])['then'](respondWithResult(_0x491695,null))[_0x8b68('0xf')](handleEntityNotFound(_0x491695,null))[_0x8b68('0x12')](handleError(_0x491695,null));};exports[_0x8b68('0x16')]=function(_0x17f321,_0x38b7a7){if(_0x17f321['body'][_0x8b68('0xb')]&&_0x17f321[_0x8b68('0x17')][_0x8b68('0x18')]){var _0x1a9788=path[_0x8b68('0x19')](__dirname,_0x8b68('0x1a'),_0x17f321['body']['script']);var _0x23edc1=process['cwd']();process[_0x8b68('0x1b')](path[_0x8b68('0x1c')](_0x1a9788));return execChildProcess()[_0x8b68('0xf')](function(_0x21ecca){process[_0x8b68('0x1b')](_0x23edc1);return pm2[_0x8b68('0x1d')]({'name':_0x17f321['body'][_0x8b68('0xb')],'script':_0x1a9788});})[_0x8b68('0xf')](function(_0x4ca77d){pm2[_0x8b68('0x1e')]();return _0x4ca77d[0x0];})[_0x8b68('0xf')](respondWithResult(_0x38b7a7,0xc9))[_0x8b68('0x12')](handleError(_0x38b7a7,null));}else{return _0x38b7a7['status'](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8b68('0x1f')]=function(_0x448e43,_0x2ba2a3){if(_0x448e43['body']['id']){delete _0x448e43[_0x8b68('0x17')]['id'];}var _0x53aaa2={'online':'restart','stopped':_0x8b68('0x20')};if(_0x53aaa2['hasOwnProperty'](_0x448e43[_0x8b68('0x17')][_0x8b68('0x7')])){return pm2[_0x53aaa2[_0x448e43['body']['status']]](_0x448e43[_0x8b68('0x15')]['id'])[_0x8b68('0xf')](respondWithResult(_0x2ba2a3,0xc8))[_0x8b68('0x12')](handleError(_0x2ba2a3,null));}else{return _0x2ba2a3[_0x8b68('0x7')](0x1f4)[_0x8b68('0xc')]({'message':_0x8b68('0x21')});}};exports[_0x8b68('0x22')]=function(_0x5b7ed1,_0x3b6d1b){if(_0x5b7ed1['body']['id']){delete _0x5b7ed1[_0x8b68('0x17')]['id'];}if(_0x5b7ed1[_0x8b68('0x15')]['id']){return pm2['delete'](_0x5b7ed1[_0x8b68('0x15')]['id'])[_0x8b68('0xf')](function(_0x26fe0e){pm2['dump']();return _0x26fe0e[0x0];})['then'](respondWithResult(_0x3b6d1b,null))[_0x8b68('0x12')](handleError(_0x3b6d1b,null));}else{return _0x3b6d1b[_0x8b68('0x7')](0x1f4)[_0x8b68('0xc')]({'message':_0x8b68('0x23')});}}; \ No newline at end of file +var _0x153f=['Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','json','error','stack','name','status','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty'];(function(_0x571601,_0x984923){var _0x1894e0=function(_0x1a31dc){while(--_0x1a31dc){_0x571601['push'](_0x571601['shift']());}};_0x1894e0(++_0x984923);}(_0x153f,0x15b));var _0xf153=function(_0x5d32a5,_0x5aa329){_0x5d32a5=_0x5d32a5-0x0;var _0x442dc5=_0x153f[_0x5d32a5];return _0x442dc5;};'use strict';var _=require(_0xf153('0x0'));var pm2=require(_0xf153('0x1'));var logger=require(_0xf153('0x2'))(_0xf153('0x3'));var path=require(_0xf153('0x4'));var exec=require(_0xf153('0x5'))[_0xf153('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x364e65,_0x5c49c7){return function(_0x1f9ead){if(!_0x1f9ead){_0x364e65[_0xf153('0x7')](0x194);;}return _0x1f9ead;};}function respondWithResult(_0x342a45,_0xafd987){_0xafd987=_0xafd987||0xc8;return function(_0x21f432){if(_0x21f432){return _0x342a45['status'](_0xafd987)[_0xf153('0x8')](_0x21f432);}return null;};}function handleError(_0x143497,_0x224f88){_0x224f88=_0x224f88||0x1f4;return function(_0x5f6cb5){logger[_0xf153('0x9')](_0x5f6cb5[_0xf153('0xa')]);if(_0x5f6cb5[_0xf153('0xb')]){delete _0x5f6cb5[_0xf153('0xb')];}_0x143497[_0xf153('0xc')](_0x224f88)[_0xf153('0xd')](_0x5f6cb5);};}function execChildProcess(){return new BPromise(function(_0x5c8ae9,_0x2b76eb){exec(_0xf153('0xe'),function(_0x2bea70,_0x493324,_0x3a8838){logger[_0xf153('0xf')](_0x493324);logger[_0xf153('0xf')](_0x3a8838);if(_0x2bea70){logger[_0xf153('0x9')](_0x2bea70);return _0x2b76eb(_0x2bea70);}return _0x5c8ae9(_0x493324);});});}exports[_0xf153('0x10')]=function(_0x107d31,_0x3f915c){return pm2[_0xf153('0x11')]()[_0xf153('0x12')](function(_0x4c5283){if(_0x4c5283){var _0x18be7e=_[_0xf153('0x13')](_0x4c5283,function(_0x2b666e){return _0x2b666e[_0xf153('0xb')]===_0xf153('0x14')||_0x2b666e[_0xf153('0xb')]===_0xf153('0x15');});return{'rows':_0x18be7e,'count':_0x18be7e[_0xf153('0x16')]};}return null;})['then'](respondWithResult(_0x3f915c,null))[_0xf153('0x17')](handleError(_0x3f915c,null));};exports['show']=function(_0x37093a,_0x2c62b6){return pm2[_0xf153('0x18')](_0x37093a[_0xf153('0x19')]['id'])['then'](respondWithResult(_0x2c62b6,null))[_0xf153('0x12')](handleEntityNotFound(_0x2c62b6,null))[_0xf153('0x17')](handleError(_0x2c62b6,null));};exports[_0xf153('0x1a')]=function(_0x14b83f,_0x15230c){if(_0x14b83f[_0xf153('0x1b')][_0xf153('0xb')]&&_0x14b83f[_0xf153('0x1b')][_0xf153('0x1c')]){var _0x1dd340=path[_0xf153('0x1d')](__dirname,_0xf153('0x1e'),_0x14b83f['body'][_0xf153('0x1c')]);var _0x395f28=process[_0xf153('0x1f')]();process[_0xf153('0x20')](path[_0xf153('0x21')](_0x1dd340));return execChildProcess()[_0xf153('0x12')](function(_0x465d88){process[_0xf153('0x20')](_0x395f28);return pm2[_0xf153('0x22')]({'name':_0x14b83f[_0xf153('0x1b')][_0xf153('0xb')],'script':_0x1dd340});})[_0xf153('0x12')](function(_0x35cfe3){pm2[_0xf153('0x23')]();return _0x35cfe3[0x0];})[_0xf153('0x12')](respondWithResult(_0x15230c,0xc9))[_0xf153('0x17')](handleError(_0x15230c,null));}else{return _0x15230c[_0xf153('0xc')](0x1f4)[_0xf153('0xd')]({'message':_0xf153('0x24')});}};exports[_0xf153('0x25')]=function(_0x48ebdc,_0x6d62ef){if(_0x48ebdc[_0xf153('0x1b')]['id']){delete _0x48ebdc['body']['id'];}var _0x16cdcd={'online':_0xf153('0x26'),'stopped':'stop'};if(_0x16cdcd[_0xf153('0x27')](_0x48ebdc[_0xf153('0x1b')][_0xf153('0xc')])){return pm2[_0x16cdcd[_0x48ebdc[_0xf153('0x1b')][_0xf153('0xc')]]](_0x48ebdc[_0xf153('0x19')]['id'])[_0xf153('0x12')](respondWithResult(_0x6d62ef,0xc8))[_0xf153('0x17')](handleError(_0x6d62ef,null));}else{return _0x6d62ef[_0xf153('0xc')](0x1f4)[_0xf153('0xd')]({'message':_0xf153('0x28')});}};exports[_0xf153('0x29')]=function(_0x5b5237,_0x258fb0){if(_0x5b5237[_0xf153('0x1b')]['id']){delete _0x5b5237[_0xf153('0x1b')]['id'];}if(_0x5b5237[_0xf153('0x19')]['id']){return pm2['delete'](_0x5b5237['params']['id'])[_0xf153('0x12')](function(_0x4c6ea0){pm2['dump']();return _0x4c6ea0[0x0];})[_0xf153('0x12')](respondWithResult(_0x258fb0,null))['catch'](handleError(_0x258fb0,null));}else{return _0x258fb0[_0xf153('0xc')](0x1f4)['send']({'message':_0xf153('0x2a')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index fa99fd3..1552c5f 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 _0xe0b7=['isAuthenticated','getAgents','/queues','getQueues','express','Router','../../components/auth/service','get','/agents'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0xe0b7,0x82));var _0x7e0b=function(_0x2fe403,_0x5a4ee4){_0x2fe403=_0x2fe403-0x0;var _0x97a134=_0xe0b7[_0x2fe403];return _0x97a134;};'use strict';var express=require(_0x7e0b('0x0'));var router=express[_0x7e0b('0x1')]();var auth=require(_0x7e0b('0x2'));var controller=require('./realtime.controller');router[_0x7e0b('0x3')](_0x7e0b('0x4'),auth[_0x7e0b('0x5')](),controller[_0x7e0b('0x6')]);router[_0x7e0b('0x3')](_0x7e0b('0x7'),auth[_0x7e0b('0x5')](),controller[_0x7e0b('0x8')]);module['exports']=router; \ No newline at end of file +var _0xc97d=['isAuthenticated','getQueues','exports','express','Router','../../components/auth/service','get','/agents','getAgents','/queues'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0xc97d,0x125));var _0xdc97=function(_0x18921c,_0x14eb31){_0x18921c=_0x18921c-0x0;var _0x2e7a11=_0xc97d[_0x18921c];return _0x2e7a11;};'use strict';var express=require(_0xdc97('0x0'));var router=express[_0xdc97('0x1')]();var auth=require(_0xdc97('0x2'));var controller=require('./realtime.controller');router[_0xdc97('0x3')](_0xdc97('0x4'),auth['isAuthenticated'](),controller[_0xdc97('0x5')]);router['get'](_0xdc97('0x6'),auth[_0xdc97('0x7')](),controller[_0xdc97('0x8')]);module[_0xdc97('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 17c4bad..d0355b0 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 _0x050d=['limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pause','*pause','resolve','then','isValidChannel','channel','format','includes','globalStatus','getUpdatedSortOptions','sort','fields','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','User','fieldName','type','role','agent','raw','length','push','sequelize','literal','FIELD(id,','forEach','Pause','where','user','userProfileId','Agents','online','extraQueryConditions','UserProfile','getResources','map','filterAgentAttributes','merge','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','Queue','rawAttributes','key','outbound','dialActive','dialMethod','join','getOptions','QueueCampaigns','startCase','Queues','name','filter','assign','findAndCountAll','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','offset','undefined'];(function(_0x2fde21,_0x5998d4){var _0x3f726d=function(_0x367c22){while(--_0x367c22){_0x2fde21['push'](_0x2fde21['shift']());}};_0x3f726d(++_0x5998d4);}(_0x050d,0x156));var _0xd050=function(_0x48fa01,_0x261143){_0x48fa01=_0x48fa01-0x0;var _0x8c57f0=_0x050d[_0x48fa01];return _0x8c57f0;};'use strict';var _=require(_0xd050('0x0'));var util=require(_0xd050('0x1'));var rta=require(_0xd050('0x2'));var rtq=require(_0xd050('0x3'));var qs=require(_0xd050('0x4'));var utils=require(_0xd050('0x5'));var db=require(_0xd050('0x6'))['db'];var APIBadRequestError=require(_0xd050('0x7'))['APIBadRequestError'];var APIHandleError=require(_0xd050('0x7'))['handleError'];function respondWithFilteredResult(_0x5404b8,_0x2cfafc){return function(_0x28f3c6){if(_0x28f3c6){var _0x264d9b=typeof _0x2cfafc[_0xd050('0x8')]===_0xd050('0x9')&&typeof _0x2cfafc[_0xd050('0xa')]===_0xd050('0x9');var _0x510d32=_0x28f3c6['count'];var _0x1b7d7f=_0x264d9b?0x0:_0x2cfafc['offset'];var _0x457099=_0x264d9b?_0x28f3c6[_0xd050('0xb')]:_0x2cfafc[_0xd050('0x8')]+_0x2cfafc['limit'];var _0x363bf3;if(_0x457099>=_0x510d32){_0x457099=_0x510d32;_0x363bf3=0xc8;}else{_0x363bf3=0xce;}_0x5404b8[_0xd050('0xc')](_0x363bf3);return _0x5404b8[_0xd050('0xd')](_0xd050('0xe'),_0x1b7d7f+'-'+_0x457099+'/'+_0x510d32)[_0xd050('0xf')](_0x28f3c6);}return null;};}exports[_0xd050('0x10')]=function(_0x41a53e,_0x322b09){var _0x41f1aa={'count':0x0,'rows':[]};var _0x27cf1c={};var _0x32269d;var _0xef858c=utils[_0xd050('0x11')]();var _0x21d9e7;var _0x59ee5e;var _0x65f9bc=_0x41a53e['query']['globalQueueFilter'];var _0x37a766=_0x41a53e[_0xd050('0x12')][_0xd050('0x13')];var _0x22d90a=_0x41a53e[_0xd050('0x12')]['pauseTypeFilter'];var _0x1d4686=_0x37a766===_0xd050('0x14')||_0x37a766===_0xd050('0x15')?!![]:![];var _0x357f69=[];var _0x35fd37;var _0x1f4bbf;Promise[_0xd050('0x16')]()[_0xd050('0x17')](function(){if(_0x41a53e[_0xd050('0x12')]['channel']){if(!utils[_0xd050('0x18')](_0x41a53e[_0xd050('0x12')][_0xd050('0x19')])){throw new APIBadRequestError(util[_0xd050('0x1a')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x41a53e['query']['channel']));}_0x32269d=_0x41a53e[_0xd050('0x12')]['channel']['toLowerCase']();}if(!_0x41a53e['query']['sort']||!_0x41a53e[_0xd050('0x12')]['sort'][_0xd050('0x1b')](_0xd050('0x1c'))){_0x41a53e['query']['sort']=rta['validateSortParameter'](_0x41a53e[_0xd050('0x12')]['sort']);return;}var _0x4eaec3=rta[_0xd050('0x1d')](_0x41a53e[_0xd050('0x12')][_0xd050('0x1e')]);_0x41a53e['query'][_0xd050('0x1e')]=_0x4eaec3[_0xd050('0x1f')]['join'](',');_0x35fd37=_0x4eaec3[_0xd050('0x20')];})[_0xd050('0x17')](function(){if(!_0x65f9bc){return[];}return rta[_0xd050('0x21')](_0x65f9bc,_0x32269d);})[_0xd050('0x17')](function(_0x401774){_0x357f69=_0x401774;return rta[_0xd050('0x22')]();})[_0xd050('0x17')](function(_0x3ad22f){_0x59ee5e=_0x3ad22f[_0xd050('0x23')];if((!_0x37a766||_0x1d4686)&&!_0x35fd37){return _0x357f69;}if(_0x35fd37&&!_0x37a766){return rta['getSortedAgentsIdsByStatus'](_0x59ee5e,_0x357f69,_0x35fd37);}else{return rta[_0xd050('0x24')](_0x59ee5e,_0x357f69,_0x37a766);}})['then'](function(_0x30f5ea){_0x357f69=_0x30f5ea;var _0x1e8771=![];if(_0x357f69['length']===0x0){if(_0x65f9bc||_0x37a766){_0x1e8771=!![];}if(_0x1d4686){_0x1e8771=![];}}if(_0x1e8771){return _0x41f1aa;}var _0x13516a=_['map'](db[_0xd050('0x25')]['rawAttributes'],function(_0x23b0d1){return{'name':_0x23b0d1[_0xd050('0x26')],'type':_0x23b0d1[_0xd050('0x27')]['key']};});_0x41a53e[_0xd050('0x12')][_0xd050('0x28')]=_0xd050('0x29');_0x27cf1c=qs['getOptions'](_0x13516a,_0x41a53e);_0x27cf1c[_0xd050('0x2a')]=!![];var _0x1b2126=[];if(_0x357f69[_0xd050('0x2b')]>0x0){_0x1b2126[_0xd050('0x2c')]({'id':{'$in':_0x357f69}});if(_0x35fd37&&!_0x37a766){_0x1f4bbf=[db[_0xd050('0x2d')][_0xd050('0x2e')](_0xd050('0x2f')+_0x357f69+')')];_0x27cf1c[_0xd050('0x20')]=_0x1f4bbf;}}if(_0x1d4686){_0xef858c[_0xd050('0x30')](function(_0x2e12a7){var _0x370f7f=!![];if(_0x37a766===_0xd050('0x15')&&_0x32269d!==_0x2e12a7){_0x370f7f=![];}_0x1b2126[_0xd050('0x2c')]({[_0x2e12a7+_0xd050('0x31')]:_0x370f7f});});if(_0x22d90a){_0x1b2126['push']({'pauseType':_0x22d90a});}}else if(_0x37a766){_0xef858c[_0xd050('0x30')](function(_0x35077e){_0x1b2126['push']({[_0x35077e+_0xd050('0x31')]:![]});});}_0x27cf1c[_0xd050('0x32')]=_['merge'](_0x27cf1c['where'],{'$and':_0x1b2126});if(_0x41a53e['user'][_0xd050('0x28')]===_0xd050('0x33')){var _0x691b12={'params':{'id':_0x41a53e['user'][_0xd050('0x34')]},'query':{'section':_0xd050('0x35'),'role':'agent','raw':!![],'ids':_0x357f69,'customSorting':_0x1f4bbf}};if(_0x41a53e[_0xd050('0x12')][_0xd050('0x36')]){_0x691b12['query'][_0xd050('0x36')]=!![];}if(_0x1d4686){_0x691b12[_0xd050('0x12')][_0xd050('0x37')]=_0x1b2126;}_0x691b12[_0xd050('0x12')]=Object['assign'](_0x691b12[_0xd050('0x12')],_0x41a53e[_0xd050('0x12')]);return db[_0xd050('0x38')][_0xd050('0x39')](_0x691b12);}return db['User']['findAndCountAll'](_0x27cf1c);})['then'](function(_0x2fc349){_0x41f1aa[_0xd050('0xb')]=_0x2fc349[_0xd050('0xb')];_0x21d9e7=_0x2fc349[_0xd050('0x23')];return _0x21d9e7[_0xd050('0x3a')](function(_0x16d0b2){var _0x43d187=_['find'](_0x59ee5e,['id',_0x16d0b2['id']]);if(_0x43d187){var _0x47e2b7=rta[_0xd050('0x3b')](_0x43d187);_[_0xd050('0x3c')](_0x16d0b2,_0x47e2b7);}_0x16d0b2['globalStatus']=rta[_0xd050('0x3d')](_0x16d0b2);if(_0x16d0b2[_0xd050('0x1c')][_0xd050('0x1b')](_0xd050('0x14'))){_0xef858c[_0xd050('0x30')](function(_0x2bd8ab){if(_0x16d0b2[_0x2bd8ab+'Pause']){if(_0x2bd8ab===_0xd050('0x3e')){if(_0x16d0b2[_0xd050('0x3f')]!==_0xd050('0x40')){_0x16d0b2[_0xd050('0x3f')]=_0xd050('0x14');}}else{_0x16d0b2[_0x2bd8ab+_0xd050('0x41')]=_0xd050('0x14');}}});}return _0x16d0b2;});})[_0xd050('0x17')](function(_0x446b68){if(!_0x35fd37||_0x1f4bbf){return _0x446b68;}return rta[_0xd050('0x42')](_0x446b68,_0x35fd37);})[_0xd050('0x17')](function(_0x12ada0){var _0x5e6f90=rta[_0xd050('0x43')]();_0x41f1aa[_0xd050('0x23')]=_0x12ada0['map'](function(_0x4976d5){return _['pick'](_0x4976d5,_0x5e6f90);});return _0x41f1aa;})[_0xd050('0x17')](respondWithFilteredResult(_0x322b09,_0x27cf1c))[_0xd050('0x44')](APIHandleError(_0x322b09));};exports[_0xd050('0x45')]=function(_0x521dd5,_0xdc2411){var _0x2708e6={'count':0x0,'rows':[]};var _0x466d1b={};var _0x3b34ff;var _0x2ef17d;var _0x39b8d3;Promise['resolve']()[_0xd050('0x17')](function(){if(_0x521dd5[_0xd050('0x12')]['channel']){if(!utils['isValidChannel'](_0x521dd5[_0xd050('0x12')][_0xd050('0x19')])){throw new APIBadRequestError(util[_0xd050('0x1a')](_0xd050('0x46'),_0x521dd5[_0xd050('0x12')][_0xd050('0x19')]));}_0x3b34ff=_0x521dd5[_0xd050('0x12')][_0xd050('0x19')][_0xd050('0x47')]();}var _0x3779da=_['startCase'](_0x3b34ff)+_0xd050('0x48');var _0x47a351=_[_0xd050('0x3a')](db[_0x3779da][_0xd050('0x49')],function(_0x538420){return{'name':_0x538420[_0xd050('0x26')],'type':_0x538420[_0xd050('0x27')][_0xd050('0x4a')]};});if(!_0x521dd5[_0xd050('0x12')][_0xd050('0x1f')]){var _0x1619f6=['id','name'];if(_0x3b34ff===_0xd050('0x3e')){_0x1619f6['push']('type');if(_0x521dd5['query'][_0xd050('0x27')]===_0xd050('0x4b')){_0x1619f6['push']([_0xd050('0x4c'),_0xd050('0x4d')]);}}_0x521dd5[_0xd050('0x12')][_0xd050('0x1f')]=_0x1619f6[_0xd050('0x4e')](',');}_0x466d1b=qs[_0xd050('0x4f')](_0x47a351,_0x521dd5);if(_0x521dd5[_0xd050('0x33')]['role']===_0xd050('0x33')){var _0x1ed299={'params':{'id':_0x521dd5['user'][_0xd050('0x34')]},'query':{'section':_0x3b34ff===_0xd050('0x3e')&&_0x521dd5[_0xd050('0x12')][_0xd050('0x27')]===_0xd050('0x4b')?_0xd050('0x50'):_[_0xd050('0x51')](_0x3b34ff)+_0xd050('0x52'),'type':_0x521dd5['query'][_0xd050('0x27')],'nolimit':!![],'sort':_0xd050('0x53'),'filter':_0x521dd5[_0xd050('0x12')][_0xd050('0x54')]}};_0x1ed299[_0xd050('0x12')]=Object[_0xd050('0x55')](_0x1ed299[_0xd050('0x12')],_0x521dd5[_0xd050('0x12')]);delete _0x1ed299[_0xd050('0x12')]['id'];return db[_0xd050('0x38')]['getResources'](_0x1ed299);}return db[_0x3779da][_0xd050('0x56')](_0x466d1b);})[_0xd050('0x17')](function(_0x581107){_0x2708e6[_0xd050('0xb')]=_0x581107[_0xd050('0xb')];_0x2ef17d=_0x581107[_0xd050('0x23')];return rtq['getRealtimeQueues'](_0x521dd5,_0x3b34ff);})[_0xd050('0x17')](function(_0x3860ff){_0x39b8d3=_0x3860ff['rows'];return rtq[_0xd050('0x57')](_0x2ef17d,_0x39b8d3,_0x3b34ff,_0x521dd5[_0xd050('0x12')][_0xd050('0x27')]);})['then'](function(_0x17b2ec){_0x2708e6['rows']=_0x17b2ec;return _0x2708e6;})['then'](respondWithFilteredResult(_0xdc2411,_0x466d1b))[_0xd050('0x44')](APIHandleError(_0xdc2411));}; \ No newline at end of file +var _0x7c61=['voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','catch','resolve','format','startCase','Queue','fieldName','key','name','outbound','dialActive','dialMethod','userProfileId','QueueCampaigns','Queues','filter','initializeQueues','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','globalQueueFilter','query','globalStatusFilter','pause','*pause','then','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','getUpdatedSortOptions','join','order','getAgentIdsByQueues','rows','getAgentIdsByStatus','length','map','User','rawAttributes','type','role','agent','getOptions','push','literal','FIELD(id,','Pause','merge','where','user','online','assign','UserProfile','getResources','findAndCountAll','find'];(function(_0x476a26,_0x43e6e9){var _0xac50d1=function(_0x30e888){while(--_0x30e888){_0x476a26['push'](_0x476a26['shift']());}};_0xac50d1(++_0x43e6e9);}(_0x7c61,0xb6));var _0x17c6=function(_0x550b84,_0x199ee0){_0x550b84=_0x550b84-0x0;var _0x3cdfb1=_0x7c61[_0x550b84];return _0x3cdfb1;};'use strict';var _=require('lodash');var util=require(_0x17c6('0x0'));var rta=require(_0x17c6('0x1'));var rtq=require('../../components/realtime/queues');var qs=require(_0x17c6('0x2'));var utils=require(_0x17c6('0x3'));var db=require(_0x17c6('0x4'))['db'];var APIBadRequestError=require(_0x17c6('0x5'))[_0x17c6('0x6')];var APIHandleError=require(_0x17c6('0x5'))[_0x17c6('0x7')];function respondWithFilteredResult(_0x465305,_0x25621f){return function(_0x49d1e4){if(_0x49d1e4){var _0x1aa903=typeof _0x25621f[_0x17c6('0x8')]===_0x17c6('0x9')&&typeof _0x25621f[_0x17c6('0xa')]==='undefined';var _0x4f3df4=_0x49d1e4['count'];var _0x409dea=_0x1aa903?0x0:_0x25621f[_0x17c6('0x8')];var _0x1d2222=_0x1aa903?_0x49d1e4[_0x17c6('0xb')]:_0x25621f[_0x17c6('0x8')]+_0x25621f[_0x17c6('0xa')];var _0xe81eb1;if(_0x1d2222>=_0x4f3df4){_0x1d2222=_0x4f3df4;_0xe81eb1=0xc8;}else{_0xe81eb1=0xce;}_0x465305[_0x17c6('0xc')](_0xe81eb1);return _0x465305[_0x17c6('0xd')](_0x17c6('0xe'),_0x409dea+'-'+_0x1d2222+'/'+_0x4f3df4)[_0x17c6('0xf')](_0x49d1e4);}return null;};}exports[_0x17c6('0x10')]=function(_0x1413ca,_0xb96a49){var _0xb4a6af={'count':0x0,'rows':[]};var _0x472731={};var _0x3b28c9;var _0x20e28d=utils[_0x17c6('0x11')]();var _0x533cff;var _0x1ef849;var _0x490d9f=_0x1413ca['query'][_0x17c6('0x12')];var _0xb199d1=_0x1413ca[_0x17c6('0x13')][_0x17c6('0x14')];var _0x5c912e=_0x1413ca[_0x17c6('0x13')]['pauseTypeFilter'];var _0x46e6be=_0xb199d1===_0x17c6('0x15')||_0xb199d1===_0x17c6('0x16')?!![]:![];var _0x3fe14a=[];var _0x1ff5b8;var _0x48205a;Promise['resolve']()[_0x17c6('0x17')](function(){if(_0x1413ca[_0x17c6('0x13')][_0x17c6('0x18')]){if(!utils[_0x17c6('0x19')](_0x1413ca[_0x17c6('0x13')][_0x17c6('0x18')])){throw new APIBadRequestError(util['format'](_0x17c6('0x1a'),_0x1413ca[_0x17c6('0x13')][_0x17c6('0x18')]));}_0x3b28c9=_0x1413ca['query'][_0x17c6('0x18')][_0x17c6('0x1b')]();}if(!_0x1413ca[_0x17c6('0x13')][_0x17c6('0x1c')]||!_0x1413ca[_0x17c6('0x13')]['sort'][_0x17c6('0x1d')](_0x17c6('0x1e'))){_0x1413ca[_0x17c6('0x13')][_0x17c6('0x1c')]=rta['validateSortParameter'](_0x1413ca[_0x17c6('0x13')][_0x17c6('0x1c')]);return;}var _0x45ed35=rta[_0x17c6('0x1f')](_0x1413ca[_0x17c6('0x13')][_0x17c6('0x1c')]);_0x1413ca['query'][_0x17c6('0x1c')]=_0x45ed35['fields'][_0x17c6('0x20')](',');_0x1ff5b8=_0x45ed35[_0x17c6('0x21')];})[_0x17c6('0x17')](function(){if(!_0x490d9f){return[];}return rta[_0x17c6('0x22')](_0x490d9f,_0x3b28c9);})['then'](function(_0x5b0e34){_0x3fe14a=_0x5b0e34;return rta['getRealtimeAgents']();})[_0x17c6('0x17')](function(_0x2f83c1){_0x1ef849=_0x2f83c1[_0x17c6('0x23')];if((!_0xb199d1||_0x46e6be)&&!_0x1ff5b8){return _0x3fe14a;}if(_0x1ff5b8&&!_0xb199d1){return rta['getSortedAgentsIdsByStatus'](_0x1ef849,_0x3fe14a,_0x1ff5b8);}else{return rta[_0x17c6('0x24')](_0x1ef849,_0x3fe14a,_0xb199d1);}})[_0x17c6('0x17')](function(_0x1263f4){_0x3fe14a=_0x1263f4;var _0x2ab71d=![];if(_0x3fe14a[_0x17c6('0x25')]===0x0){if(_0x490d9f||_0xb199d1){_0x2ab71d=!![];}if(_0x46e6be){_0x2ab71d=![];}}if(_0x2ab71d){return _0xb4a6af;}var _0x35a5e9=_[_0x17c6('0x26')](db[_0x17c6('0x27')][_0x17c6('0x28')],function(_0x25691c){return{'name':_0x25691c['fieldName'],'type':_0x25691c[_0x17c6('0x29')]['key']};});_0x1413ca['query'][_0x17c6('0x2a')]=_0x17c6('0x2b');_0x472731=qs[_0x17c6('0x2c')](_0x35a5e9,_0x1413ca);_0x472731['raw']=!![];var _0xc4eb73=[];if(_0x3fe14a[_0x17c6('0x25')]>0x0){_0xc4eb73[_0x17c6('0x2d')]({'id':{'$in':_0x3fe14a}});if(_0x1ff5b8&&!_0xb199d1){_0x48205a=[db['sequelize'][_0x17c6('0x2e')](_0x17c6('0x2f')+_0x3fe14a+')')];_0x472731['order']=_0x48205a;}}if(_0x46e6be){_0x20e28d['forEach'](function(_0x846001){var _0x4bbc05=!![];if(_0xb199d1===_0x17c6('0x16')&&_0x3b28c9!==_0x846001){_0x4bbc05=![];}_0xc4eb73[_0x17c6('0x2d')]({[_0x846001+_0x17c6('0x30')]:_0x4bbc05});});if(_0x5c912e){_0xc4eb73[_0x17c6('0x2d')]({'pauseType':_0x5c912e});}}else if(_0xb199d1){_0x20e28d['forEach'](function(_0x432f90){_0xc4eb73[_0x17c6('0x2d')]({[_0x432f90+_0x17c6('0x30')]:![]});});}_0x472731['where']=_[_0x17c6('0x31')](_0x472731[_0x17c6('0x32')],{'$and':_0xc4eb73});if(_0x1413ca[_0x17c6('0x33')]['role']===_0x17c6('0x33')){var _0x5de8cb={'params':{'id':_0x1413ca[_0x17c6('0x33')]['userProfileId']},'query':{'section':'Agents','role':'agent','raw':!![],'ids':_0x3fe14a,'customSorting':_0x48205a}};if(_0x1413ca['query']['online']){_0x5de8cb[_0x17c6('0x13')][_0x17c6('0x34')]=!![];}if(_0x46e6be){_0x5de8cb[_0x17c6('0x13')]['extraQueryConditions']=_0xc4eb73;}_0x5de8cb[_0x17c6('0x13')]=Object[_0x17c6('0x35')](_0x5de8cb['query'],_0x1413ca[_0x17c6('0x13')]);return db[_0x17c6('0x36')][_0x17c6('0x37')](_0x5de8cb);}return db[_0x17c6('0x27')][_0x17c6('0x38')](_0x472731);})[_0x17c6('0x17')](function(_0x26ffe6){_0xb4a6af[_0x17c6('0xb')]=_0x26ffe6[_0x17c6('0xb')];_0x533cff=_0x26ffe6['rows'];return _0x533cff[_0x17c6('0x26')](function(_0xa4f4b3){var _0x5a18d2=_[_0x17c6('0x39')](_0x1ef849,['id',_0xa4f4b3['id']]);if(_0x5a18d2){var _0x3ccba9=rta['filterAgentAttributes'](_0x5a18d2);_[_0x17c6('0x31')](_0xa4f4b3,_0x3ccba9);}_0xa4f4b3[_0x17c6('0x1e')]=rta['getAgentStatus'](_0xa4f4b3);if(_0xa4f4b3[_0x17c6('0x1e')][_0x17c6('0x1d')](_0x17c6('0x15'))){_0x20e28d['forEach'](function(_0x302b5e){if(_0xa4f4b3[_0x302b5e+_0x17c6('0x30')]){if(_0x302b5e===_0x17c6('0x3a')){if(_0xa4f4b3[_0x17c6('0x3b')]!==_0x17c6('0x3c')){_0xa4f4b3[_0x17c6('0x3b')]=_0x17c6('0x15');}}else{_0xa4f4b3[_0x302b5e+_0x17c6('0x3d')]='pause';}}});}return _0xa4f4b3;});})['then'](function(_0x5751d0){if(!_0x1ff5b8||_0x48205a){return _0x5751d0;}return rta[_0x17c6('0x3e')](_0x5751d0,_0x1ff5b8);})[_0x17c6('0x17')](function(_0x418e60){var _0x44d42c=rta[_0x17c6('0x3f')]();_0xb4a6af[_0x17c6('0x23')]=_0x418e60[_0x17c6('0x26')](function(_0x5a4ba5){return _['pick'](_0x5a4ba5,_0x44d42c);});return _0xb4a6af;})[_0x17c6('0x17')](respondWithFilteredResult(_0xb96a49,_0x472731))[_0x17c6('0x40')](APIHandleError(_0xb96a49));};exports['getQueues']=function(_0x3967aa,_0x31b159){var _0x120b60={'count':0x0,'rows':[]};var _0x166b6d={};var _0x1aec01;var _0x3bcd91;var _0x557033;Promise[_0x17c6('0x41')]()['then'](function(){if(_0x3967aa[_0x17c6('0x13')]['channel']){if(!utils[_0x17c6('0x19')](_0x3967aa[_0x17c6('0x13')][_0x17c6('0x18')])){throw new APIBadRequestError(util[_0x17c6('0x42')](_0x17c6('0x1a'),_0x3967aa[_0x17c6('0x13')]['channel']));}_0x1aec01=_0x3967aa[_0x17c6('0x13')][_0x17c6('0x18')][_0x17c6('0x1b')]();}var _0x60de8b=_[_0x17c6('0x43')](_0x1aec01)+_0x17c6('0x44');var _0x369e26=_[_0x17c6('0x26')](db[_0x60de8b]['rawAttributes'],function(_0x40f0a8){return{'name':_0x40f0a8[_0x17c6('0x45')],'type':_0x40f0a8[_0x17c6('0x29')][_0x17c6('0x46')]};});if(!_0x3967aa[_0x17c6('0x13')]['fields']){var _0x3fa8a0=['id',_0x17c6('0x47')];if(_0x1aec01===_0x17c6('0x3a')){_0x3fa8a0['push'](_0x17c6('0x29'));if(_0x3967aa[_0x17c6('0x13')][_0x17c6('0x29')]===_0x17c6('0x48')){_0x3fa8a0[_0x17c6('0x2d')]([_0x17c6('0x49'),_0x17c6('0x4a')]);}}_0x3967aa[_0x17c6('0x13')]['fields']=_0x3fa8a0[_0x17c6('0x20')](',');}_0x166b6d=qs[_0x17c6('0x2c')](_0x369e26,_0x3967aa);if(_0x3967aa['user'][_0x17c6('0x2a')]==='user'){var _0x334a11={'params':{'id':_0x3967aa[_0x17c6('0x33')][_0x17c6('0x4b')]},'query':{'section':_0x1aec01==='voice'&&_0x3967aa['query'][_0x17c6('0x29')]==='outbound'?_0x17c6('0x4c'):_['startCase'](_0x1aec01)+_0x17c6('0x4d'),'type':_0x3967aa[_0x17c6('0x13')][_0x17c6('0x29')],'nolimit':!![],'sort':_0x17c6('0x47'),'filter':_0x3967aa[_0x17c6('0x13')][_0x17c6('0x4e')]}};_0x334a11[_0x17c6('0x13')]=Object[_0x17c6('0x35')](_0x334a11[_0x17c6('0x13')],_0x3967aa['query']);delete _0x334a11[_0x17c6('0x13')]['id'];return db[_0x17c6('0x36')][_0x17c6('0x37')](_0x334a11);}return db[_0x60de8b][_0x17c6('0x38')](_0x166b6d);})[_0x17c6('0x17')](function(_0x3afb75){_0x120b60['count']=_0x3afb75['count'];_0x3bcd91=_0x3afb75['rows'];return rtq['getRealtimeQueues'](_0x3967aa,_0x1aec01);})[_0x17c6('0x17')](function(_0x59fab5){_0x557033=_0x59fab5['rows'];return rtq[_0x17c6('0x4f')](_0x3bcd91,_0x557033,_0x1aec01,_0x3967aa[_0x17c6('0x13')][_0x17c6('0x29')]);})[_0x17c6('0x17')](function(_0x451551){_0x120b60['rows']=_0x451551;return _0x120b60;})[_0x17c6('0x17')](respondWithFilteredResult(_0x31b159,_0x166b6d))[_0x17c6('0x40')](APIHandleError(_0x31b159));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 9d644e1..87c82f6 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1d29de,_0x521099){var _0x3df404=function(_0x2d54a3){while(--_0x2d54a3){_0x1d29de['push'](_0x1d29de['shift']());}};_0x3df404(++_0x521099);}(_0x70e0,0x17b));var _0x070e=function(_0x2879f5,_0x2d0617){_0x2879f5=_0x2879f5-0x0;var _0x4b4ea7=_0x70e0[_0x2879f5];return _0x4b4ea7;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x37c3a5,_0x1f7bf3){var _0x693995=function(_0x2d0ca5){while(--_0x2d0ca5){_0x37c3a5['push'](_0x37c3a5['shift']());}};_0x693995(++_0x1f7bf3);}(_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 diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5cd500c..28484d1 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 _0x2706=['INTEGER','STRING','DATE','exports'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x2706,0x107));var _0x6270=function(_0x2c2456,_0x572fab){_0x2c2456=_0x2c2456-0x0;var _0x1d8bd4=_0x2706[_0x2c2456];return _0x1d8bd4;};'use strict';var Sequelize=require('sequelize');module[_0x6270('0x0')]={'state':{'type':Sequelize[_0x6270('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x6270('0x2')]},'scheduledat':{'type':Sequelize[_0x6270('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6270('0x3')]},'responsetime':{'type':Sequelize[_0x6270('0x3')]},'ringtime':{'type':Sequelize[_0x6270('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6270('0x2')]},'campaigntype':{'type':Sequelize[_0x6270('0x2')]},'membername':{'type':Sequelize[_0x6270('0x2')]}}; \ No newline at end of file +var _0x0309=['STRING','sequelize','INTEGER','DATE'];(function(_0x216523,_0x4b5f00){var _0x4034b1=function(_0x144f36){while(--_0x144f36){_0x216523['push'](_0x216523['shift']());}};_0x4034b1(++_0x4b5f00);}(_0x0309,0x165));var _0x9030=function(_0x16f36d,_0x585c2c){_0x16f36d=_0x16f36d-0x0;var _0x51d24f=_0x0309[_0x16f36d];return _0x51d24f;};'use strict';var Sequelize=require(_0x9030('0x0'));module['exports']={'state':{'type':Sequelize[_0x9030('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x9030('0x2')]},'uniqueid':{'type':Sequelize[_0x9030('0x3')]},'starttime':{'type':Sequelize[_0x9030('0x2')]},'responsetime':{'type':Sequelize[_0x9030('0x2')]},'ringtime':{'type':Sequelize[_0x9030('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9030('0x3')]},'campaigntype':{'type':Sequelize[_0x9030('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 1f87661..b288e62 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 _0xc13a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','ReportAgentPreview','lodash','util'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xc13a,0x132));var _0xac13=function(_0x1a2665,_0x3a493b){_0x1a2665=_0x1a2665-0x0;var _0x18c4f0=_0xc13a[_0x1a2665];return _0x18c4f0;};'use strict';var _=require(_0xac13('0x0'));var util=require(_0xac13('0x1'));var logger=require(_0xac13('0x2'))(_0xac13('0x3'));var moment=require(_0xac13('0x4'));var BPromise=require(_0xac13('0x5'));var rp=require(_0xac13('0x6'));var fs=require('fs');var path=require(_0xac13('0x7'));var rimraf=require(_0xac13('0x8'));var config=require(_0xac13('0x9'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x125c66,_0x163093){return _0x125c66['define'](_0xac13('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa995=['path','rimraf','../../config/environment','exports','define','ReportAgentPreview','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4de23c,_0x149c53){var _0x45c31a=function(_0x457012){while(--_0x457012){_0x4de23c['push'](_0x4de23c['shift']());}};_0x45c31a(++_0x149c53);}(_0xa995,0x1c0));var _0x5a99=function(_0x2ec7dd,_0x461d55){_0x2ec7dd=_0x2ec7dd-0x0;var _0x55bcce=_0xa995[_0x2ec7dd];return _0x55bcce;};'use strict';var _=require(_0x5a99('0x0'));var util=require(_0x5a99('0x1'));var logger=require(_0x5a99('0x2'))(_0x5a99('0x3'));var moment=require(_0x5a99('0x4'));var BPromise=require(_0x5a99('0x5'));var rp=require(_0x5a99('0x6'));var fs=require('fs');var path=require(_0x5a99('0x7'));var rimraf=require(_0x5a99('0x8'));var config=require(_0x5a99('0x9'));var attributes=require('./reportAgentPreview.attributes');module[_0x5a99('0xa')]=function(_0x4c9710,_0x24d72a){return _0x4c9710[_0x5a99('0xb')](_0x5a99('0xc'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index f5b2828..6c8633d 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 _0xba52=['then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0xba52,0xf1));var _0x2ba5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba52[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2ba5('0x0'));var util=require(_0x2ba5('0x1'));var moment=require(_0x2ba5('0x2'));var BPromise=require(_0x2ba5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ba5('0x4'));var db=require(_0x2ba5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ba5('0x6'))(_0x2ba5('0x7'));var config=require('../../config/environment');var jayson=require(_0x2ba5('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbe6b85,_0x5b9e1a,_0x4c604d){return new BPromise(function(_0x154f17,_0x2d4297){return client['request'](_0xbe6b85,_0x4c604d)[_0x2ba5('0x9')](function(_0x286d7b){logger[_0x2ba5('0xa')](_0x2ba5('0xb'),_0x5b9e1a,_0x2ba5('0xc'));logger['debug'](_0x2ba5('0xd'),_0x5b9e1a,'request\x20sent',JSON[_0x2ba5('0xe')](_0x286d7b));if(_0x286d7b[_0x2ba5('0xf')]){if(_0x286d7b[_0x2ba5('0xf')][_0x2ba5('0x10')]===0x1f4){logger[_0x2ba5('0xf')](_0x2ba5('0xb'),_0x5b9e1a,_0x286d7b[_0x2ba5('0xf')][_0x2ba5('0x11')]);return _0x2d4297(_0x286d7b[_0x2ba5('0xf')]['message']);}logger['error'](_0x2ba5('0xb'),_0x5b9e1a,_0x286d7b['error']['message']);return _0x154f17(_0x286d7b['error']['message']);}else{logger[_0x2ba5('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x5b9e1a,_0x2ba5('0xc'));_0x154f17(_0x286d7b['result'][_0x2ba5('0x11')]);}})['catch'](function(_0x205a89){logger[_0x2ba5('0xf')](_0x2ba5('0xb'),_0x5b9e1a,_0x205a89);_0x2d4297(_0x205a89);});});}exports['CreateReportAgentPreview']=function(_0x581adc){var _0x43ad03=this;return new Promise(function(_0x40864f,_0x4681a9){return db[_0x2ba5('0x12')]['create'](_0x581adc[_0x2ba5('0x13')],{'raw':_0x581adc[_0x2ba5('0x14')]?_0x581adc['options'][_0x2ba5('0x15')]===undefined?!![]:![]:!![]})[_0x2ba5('0x9')](function(_0xe7d5fa){logger[_0x2ba5('0xa')](_0x2ba5('0x16'),_0x581adc);logger[_0x2ba5('0x17')](_0x2ba5('0x16'),_0x581adc,JSON['stringify'](_0xe7d5fa));_0x40864f(_0xe7d5fa);})[_0x2ba5('0x18')](function(_0x29de4e){logger[_0x2ba5('0xf')](_0x2ba5('0x16'),_0x29de4e['message'],_0x581adc);_0x4681a9(_0x43ad03['error'](0x1f4,_0x29de4e[_0x2ba5('0x11')]));});});}; \ No newline at end of file +var _0x7981=['stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','then','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x5214b0,_0x546abd){var _0x58af72=function(_0x3ef9ca){while(--_0x3ef9ca){_0x5214b0['push'](_0x5214b0['shift']());}};_0x58af72(++_0x546abd);}(_0x7981,0x150));var _0x1798=function(_0x4b77ad,_0x438b83){_0x4b77ad=_0x4b77ad-0x0;var _0xfe57fd=_0x7981[_0x4b77ad];return _0xfe57fd;};'use strict';var _=require(_0x1798('0x0'));var util=require(_0x1798('0x1'));var moment=require(_0x1798('0x2'));var BPromise=require(_0x1798('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1798('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1798('0x5'));var logger=require(_0x1798('0x6'))(_0x1798('0x7'));var config=require(_0x1798('0x8'));var jayson=require(_0x1798('0x9'));var client=jayson[_0x1798('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27dd47,_0x255d0e,_0x53df0c){return new BPromise(function(_0x2c8cfe,_0x2fad85){return client['request'](_0x27dd47,_0x53df0c)['then'](function(_0x1165d2){logger[_0x1798('0xb')](_0x1798('0xc'),_0x255d0e,_0x1798('0xd'));logger['debug'](_0x1798('0xe'),_0x255d0e,'request\x20sent',JSON[_0x1798('0xf')](_0x1165d2));if(_0x1165d2['error']){if(_0x1165d2[_0x1798('0x10')][_0x1798('0x11')]===0x1f4){logger['error'](_0x1798('0xc'),_0x255d0e,_0x1165d2['error'][_0x1798('0x12')]);return _0x2fad85(_0x1165d2[_0x1798('0x10')][_0x1798('0x12')]);}logger[_0x1798('0x10')](_0x1798('0xc'),_0x255d0e,_0x1165d2[_0x1798('0x10')][_0x1798('0x12')]);return _0x2c8cfe(_0x1165d2['error']['message']);}else{logger['info'](_0x1798('0xc'),_0x255d0e,_0x1798('0xd'));_0x2c8cfe(_0x1165d2['result']['message']);}})[_0x1798('0x13')](function(_0x2ecea0){logger['error'](_0x1798('0xc'),_0x255d0e,_0x2ecea0);_0x2fad85(_0x2ecea0);});});}exports[_0x1798('0x14')]=function(_0x2843d4){var _0x33b742=this;return new Promise(function(_0x1295f0,_0x935589){return db[_0x1798('0x15')][_0x1798('0x16')](_0x2843d4[_0x1798('0x17')],{'raw':_0x2843d4[_0x1798('0x18')]?_0x2843d4[_0x1798('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x1798('0x19')](function(_0x36bf34){logger[_0x1798('0xb')](_0x1798('0x14'),_0x2843d4);logger[_0x1798('0x1a')](_0x1798('0x14'),_0x2843d4,JSON['stringify'](_0x36bf34));_0x1295f0(_0x36bf34);})['catch'](function(_0xb07eb3){logger[_0x1798('0x10')](_0x1798('0x14'),_0xb07eb3['message'],_0x2843d4);_0x935589(_0x33b742[_0x1798('0x10')](0x1f4,_0xb07eb3[_0x1798('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c6ba32c..b1b8f32 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 _0x7551=['/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/chat/queues','/mail/queues','mailQueues','/mail/accounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues'];(function(_0x324fe8,_0x1ccb46){var _0x4a1cd9=function(_0x506af2){while(--_0x506af2){_0x324fe8['push'](_0x324fe8['shift']());}};_0x4a1cd9(++_0x1ccb46);}(_0x7551,0x1a3));var _0x1755=function(_0xf7c016,_0x18ed88){_0xf7c016=_0xf7c016-0x0;var _0x18e7ea=_0x7551[_0xf7c016];return _0x18e7ea;};'use strict';var multer=require(_0x1755('0x0'));var util=require(_0x1755('0x1'));var path=require(_0x1755('0x2'));var express=require(_0x1755('0x3'));var router=express[_0x1755('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0x1755('0x5'));router[_0x1755('0x6')](_0x1755('0x7'),auth['isAuthenticated'](),controller[_0x1755('0x8')]);router[_0x1755('0x6')](_0x1755('0x9'),auth[_0x1755('0xa')](),controller[_0x1755('0xb')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x1755('0xa')](),controller['voiceChannelStopMixMonitor']);router['get']('/voice/queues',auth[_0x1755('0xa')](),controller['voiceQueues']);router['get'](_0x1755('0xc'),auth['isAuthenticated'](),controller['chatQueues']);router[_0x1755('0x6')](_0x1755('0xd'),auth[_0x1755('0xa')](),controller[_0x1755('0xe')]);router['get'](_0x1755('0xf'),auth[_0x1755('0xa')](),controller['mailAccounts']);router[_0x1755('0x6')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0x1755('0x10')]);router['get'](_0x1755('0x11'),auth[_0x1755('0xa')](),controller[_0x1755('0x12')]);router[_0x1755('0x6')](_0x1755('0x13'),auth['isAuthenticated'](),controller[_0x1755('0x14')]);router['get']('/fax/queues',auth['isAuthenticated'](),controller[_0x1755('0x15')]);router[_0x1755('0x6')]('/voice/queues/preview/:id',auth[_0x1755('0xa')](),controller[_0x1755('0x16')]);router[_0x1755('0x6')](_0x1755('0x17'),auth['isAuthenticated'](),controller[_0x1755('0x18')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x1755('0xa')](),controller[_0x1755('0x19')]);router[_0x1755('0x6')](_0x1755('0x1a'),auth[_0x1755('0xa')](),controller['voiceQueuesChannelHangup']);router[_0x1755('0x6')](_0x1755('0x1b'),auth[_0x1755('0xa')](),controller[_0x1755('0x1c')]);router['get'](_0x1755('0x1d'),auth[_0x1755('0xa')](),controller[_0x1755('0x1e')]);router['put'](_0x1755('0x1d'),auth[_0x1755('0xa')](),controller[_0x1755('0x1f')]);router['get'](_0x1755('0x20'),auth['isAuthenticated'](),controller[_0x1755('0x21')]);router[_0x1755('0x6')](_0x1755('0x22'),auth[_0x1755('0xa')](),controller['outboundChannels']);router[_0x1755('0x6')](_0x1755('0x23'),auth[_0x1755('0xa')](),controller['agents']);router['put']('/agents/:id/capacity',auth[_0x1755('0xa')](),controller[_0x1755('0x24')]);router[_0x1755('0x6')](_0x1755('0x25'),auth[_0x1755('0xa')](),controller[_0x1755('0x26')]);router[_0x1755('0x6')](_0x1755('0x27'),auth[_0x1755('0xa')](),controller[_0x1755('0x28')]);router[_0x1755('0x6')](_0x1755('0x29'),auth['isAuthenticated'](),controller[_0x1755('0x2a')]);router[_0x1755('0x6')](_0x1755('0x2b'),auth['isAuthenticated'](),controller[_0x1755('0x2c')]);router[_0x1755('0x6')](_0x1755('0x2d'),auth[_0x1755('0xa')](),controller[_0x1755('0x2e')]);router['get']('/mail/queues/waitinginteractions',auth[_0x1755('0xa')](),controller[_0x1755('0x2f')]);router[_0x1755('0x6')](_0x1755('0x30'),auth['isAuthenticated'](),controller[_0x1755('0x31')]);router[_0x1755('0x6')](_0x1755('0x32'),auth[_0x1755('0xa')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x1755('0x6')](_0x1755('0x33'),auth[_0x1755('0xa')](),controller[_0x1755('0x34')]);router[_0x1755('0x6')](_0x1755('0x35'),auth[_0x1755('0xa')](),controller[_0x1755('0x36')]);router[_0x1755('0x6')]('/fax/queues/waitinginteractions',auth[_0x1755('0xa')](),controller['faxQueuesWaitingInteractions']);router[_0x1755('0x37')](_0x1755('0x38'),auth[_0x1755('0xa')](),controller[_0x1755('0x39')](_0x1755('0x3a')));router['get'](_0x1755('0x3b'),auth[_0x1755('0xa')](),controller[_0x1755('0x3c')]);router[_0x1755('0x37')](_0x1755('0x3d'),auth['isAuthenticated'](),controller[_0x1755('0x39')](_0x1755('0x3e')));router[_0x1755('0x6')](_0x1755('0x3f'),auth[_0x1755('0xa')](),controller[_0x1755('0x40')]);router[_0x1755('0x37')](_0x1755('0x41'),auth[_0x1755('0xa')](),controller[_0x1755('0x39')]('fax'));router[_0x1755('0x6')](_0x1755('0x42'),auth['isAuthenticated'](),controller[_0x1755('0x43')]);router[_0x1755('0x37')](_0x1755('0x44'),auth[_0x1755('0xa')](),controller['queueNotify'](_0x1755('0x45')));router[_0x1755('0x6')](_0x1755('0x46'),auth[_0x1755('0xa')](),controller[_0x1755('0x47')]);router['post'](_0x1755('0x48'),auth[_0x1755('0xa')](),controller[_0x1755('0x39')](_0x1755('0x49')));router[_0x1755('0x37')](_0x1755('0x4a'),auth[_0x1755('0xa')](),controller['queueNotify'](_0x1755('0x4b')));router['get']('/sms/queues/:id',auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x1755('0x6')](_0x1755('0x4c'),auth[_0x1755('0xa')](),controller[_0x1755('0x4d')]);router[_0x1755('0x37')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x1755('0x4e')]);module[_0x1755('0x4f')]=router; \ No newline at end of file +var _0x5eea=['/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','/fax/accounts','faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','/outbound','outbound','/outbound/channels','/agents','agents'];(function(_0x10347f,_0x5b48de){var _0x7efd56=function(_0x2d309b){while(--_0x2d309b){_0x10347f['push'](_0x10347f['shift']());}};_0x7efd56(++_0x5b48de);}(_0x5eea,0x1a7));var _0xa5ee=function(_0x336421,_0x52b2e5){_0x336421=_0x336421-0x0;var _0x2012cb=_0x5eea[_0x336421];return _0x2012cb;};'use strict';var multer=require(_0xa5ee('0x0'));var util=require(_0xa5ee('0x1'));var path=require('path');var express=require(_0xa5ee('0x2'));var router=express[_0xa5ee('0x3')]();var auth=require(_0xa5ee('0x4'));var controller=require(_0xa5ee('0x5'));router[_0xa5ee('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0xa5ee('0x7')]);router[_0xa5ee('0x6')](_0xa5ee('0x8'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0xa')]);router['get'](_0xa5ee('0xb'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0xc')]);router[_0xa5ee('0x6')](_0xa5ee('0xd'),auth[_0xa5ee('0x9')](),controller['voiceQueues']);router[_0xa5ee('0x6')]('/chat/queues',auth['isAuthenticated'](),controller[_0xa5ee('0xe')]);router[_0xa5ee('0x6')](_0xa5ee('0xf'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x10')]);router['get'](_0xa5ee('0x11'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x12')]);router[_0xa5ee('0x6')]('/openchannel/queues',auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x13')]);router[_0xa5ee('0x6')]('/sms/queues',auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x14')]);router[_0xa5ee('0x6')](_0xa5ee('0x15'),auth['isAuthenticated'](),controller[_0xa5ee('0x16')]);router[_0xa5ee('0x6')]('/fax/queues',auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x17')]);router['get'](_0xa5ee('0x18'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x19')]);router[_0xa5ee('0x6')](_0xa5ee('0x1a'),auth[_0xa5ee('0x9')](),controller['voiceQueuesChannels']);router['get'](_0xa5ee('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xa5ee('0x6')](_0xa5ee('0x1c'),auth[_0xa5ee('0x9')](),controller['voiceQueuesChannelHangup']);router['get'](_0xa5ee('0x1d'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x1e')]);router[_0xa5ee('0x6')]('/voice/queues/:id',auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x1f')]);router[_0xa5ee('0x20')](_0xa5ee('0x21'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0xa5ee('0x6')](_0xa5ee('0x22'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x23')]);router['get'](_0xa5ee('0x24'),auth['isAuthenticated'](),controller['outboundChannels']);router['get'](_0xa5ee('0x25'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x26')]);router[_0xa5ee('0x20')](_0xa5ee('0x27'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x28')]);router[_0xa5ee('0x6')](_0xa5ee('0x29'),auth['isAuthenticated'](),controller[_0xa5ee('0x2a')]);router[_0xa5ee('0x6')]('/trunks',auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x2b')]);router[_0xa5ee('0x6')](_0xa5ee('0x2c'),auth[_0xa5ee('0x9')](),controller['campaigns']);router['get'](_0xa5ee('0x2d'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x2e')]);router[_0xa5ee('0x6')]('/chat/queues/waitinginteractions',auth[_0xa5ee('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0xa5ee('0x6')](_0xa5ee('0x2f'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x30')]);router[_0xa5ee('0x6')](_0xa5ee('0x31'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x32')]);router[_0xa5ee('0x6')](_0xa5ee('0x33'),auth['isAuthenticated'](),controller[_0xa5ee('0x34')]);router[_0xa5ee('0x6')](_0xa5ee('0x35'),auth[_0xa5ee('0x9')](),controller['smsQueuesWaitingInteractions']);router['get'](_0xa5ee('0x36'),auth[_0xa5ee('0x9')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0xa5ee('0x37'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x38')]);router[_0xa5ee('0x39')](_0xa5ee('0x3a'),auth['isAuthenticated'](),controller[_0xa5ee('0x3b')](_0xa5ee('0x3c')));router[_0xa5ee('0x6')](_0xa5ee('0x3d'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x3e')]);router[_0xa5ee('0x39')](_0xa5ee('0x3f'),auth['isAuthenticated'](),controller[_0xa5ee('0x3b')]('chat'));router[_0xa5ee('0x6')](_0xa5ee('0x40'),auth[_0xa5ee('0x9')](),controller['showChatQueues']);router[_0xa5ee('0x39')](_0xa5ee('0x41'),auth[_0xa5ee('0x9')](),controller['queueNotify'](_0xa5ee('0x42')));router[_0xa5ee('0x6')](_0xa5ee('0x43'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0xa5ee('0x39')](_0xa5ee('0x44'),auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x3b')](_0xa5ee('0x45')));router[_0xa5ee('0x6')]('/openchannel/queues/:id',auth[_0xa5ee('0x9')](),controller['showOpenchannelQueues']);router[_0xa5ee('0x39')]('/sms/queues/:id/notify',auth[_0xa5ee('0x9')](),controller['queueNotify'](_0xa5ee('0x46')));router['post'](_0xa5ee('0x47'),auth['isAuthenticated'](),controller['queueNotify']('whatsapp'));router[_0xa5ee('0x6')]('/sms/queues/:id',auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x48')]);router[_0xa5ee('0x6')](_0xa5ee('0x49'),auth['isAuthenticated'](),controller[_0xa5ee('0x4a')]);router[_0xa5ee('0x39')]('/agents/:id/notify',auth[_0xa5ee('0x9')](),controller[_0xa5ee('0x4b')]);module[_0xa5ee('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 6836493..c3decdd 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 _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x19f6c2,_0x27ba35){var _0x457d2d=function(_0x330ca6){while(--_0x330ca6){_0x19f6c2['push'](_0x19f6c2['shift']());}};_0x457d2d(++_0x27ba35);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x45ded1,_0x4467be){var _0x143ccd=function(_0x1fd743){while(--_0x1fd743){_0x45ded1['push'](_0x45ded1['shift']());}};_0x143ccd(++_0x4467be);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d0d1cb5..e222f15 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 _0x6a43=['../../config/environment','./schedule.controller','get','/:id','isAuthenticated','show','run','post','create','update','multer','path','express','fs-extra','../../components/auth/service'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x6a43,0x1bd));var _0x36a4=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x6a43[_0x4d8ed9];return _0x1e2140;};'use strict';var multer=require(_0x36a4('0x0'));var util=require('util');var path=require(_0x36a4('0x1'));var timeout=require('connect-timeout');var express=require(_0x36a4('0x2'));var router=express['Router']();var fs_extra=require(_0x36a4('0x3'));var auth=require(_0x36a4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x36a4('0x5'));var controller=require(_0x36a4('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x36a4('0x7')](_0x36a4('0x8'),auth[_0x36a4('0x9')](),controller[_0x36a4('0xa')]);router[_0x36a4('0x7')]('/:id/run',auth[_0x36a4('0x9')](),controller[_0x36a4('0xb')]);router[_0x36a4('0xc')]('/',auth[_0x36a4('0x9')](),controller[_0x36a4('0xd')]);router['put'](_0x36a4('0x8'),auth[_0x36a4('0x9')](),controller[_0x36a4('0xe')]);router['delete'](_0x36a4('0x8'),auth[_0x36a4('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x31a6=['isAuthenticated','index','get','/:id','/:id/run','run','post','put','update','destroy','exports','multer','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5936b9,_0x30c67a){var _0x4d4887=function(_0x46ff42){while(--_0x46ff42){_0x5936b9['push'](_0x5936b9['shift']());}};_0x4d4887(++_0x30c67a);}(_0x31a6,0xb0));var _0x631a=function(_0x55f008,_0x132c15){_0x55f008=_0x55f008-0x0;var _0x572aa5=_0x31a6[_0x55f008];return _0x572aa5;};'use strict';var multer=require(_0x631a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x631a('0x1'));var auth=require(_0x631a('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x631a('0x3'));var controller=require('./schedule.controller');router['get']('/',auth[_0x631a('0x4')](),controller[_0x631a('0x5')]);router[_0x631a('0x6')](_0x631a('0x7'),auth[_0x631a('0x4')](),controller['show']);router['get'](_0x631a('0x8'),auth[_0x631a('0x4')](),controller[_0x631a('0x9')]);router[_0x631a('0xa')]('/',auth[_0x631a('0x4')](),controller['create']);router[_0x631a('0xb')](_0x631a('0x7'),auth[_0x631a('0x4')](),controller[_0x631a('0xc')]);router['delete'](_0x631a('0x7'),auth[_0x631a('0x4')](),controller[_0x631a('0xd')]);module[_0x631a('0xe')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 2c94ade..3f3ab0a 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 _0x6a68=['ENUM','csv','custom','default','BOOLEAN','TEXT','exports','STRING','DATE','INTEGER','quarters','months','weeks','days','hours','minutes'];(function(_0x2c39f6,_0x5e519f){var _0x2f0d99=function(_0x2d10b8){while(--_0x2d10b8){_0x2c39f6['push'](_0x2c39f6['shift']());}};_0x2f0d99(++_0x5e519f);}(_0x6a68,0x156));var _0x86a6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6a68[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x86a6('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x86a6('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x86a6('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x86a6('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x86a6('0x4'),_0x86a6('0x5'),_0x86a6('0x6'),_0x86a6('0x7'),_0x86a6('0x8'),_0x86a6('0x9')),'allowNull':![],'defaultValue':_0x86a6('0x7')},'output':{'type':Sequelize[_0x86a6('0xa')](_0x86a6('0xb'),'pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x86a6('0xa')](_0x86a6('0xc'),_0x86a6('0xd')),'allowNull':![],'defaultValue':_0x86a6('0xc')},'sendMail':{'type':Sequelize[_0x86a6('0xe')],'defaultValue':![]},'email':{'type':Sequelize[_0x86a6('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x86a6('0xf')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x27d2=['days','hours','minutes','csv','xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks'];(function(_0xa5f779,_0x2a0302){var _0x1e934a=function(_0x4eb8d8){while(--_0x4eb8d8){_0xa5f779['push'](_0xa5f779['shift']());}};_0x1e934a(++_0x2a0302);}(_0x27d2,0xd1));var _0x227d=function(_0x479e1b,_0x265238){_0x479e1b=_0x479e1b-0x0;var _0x5ef65a=_0x27d2[_0x479e1b];return _0x5ef65a;};'use strict';var Sequelize=require(_0x227d('0x0'));module[_0x227d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x227d('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x227d('0x2')],'allowNull':![],'defaultValue':_0x227d('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x227d('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x227d('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x227d('0x6')](_0x227d('0x7'),_0x227d('0x8'),_0x227d('0x9'),_0x227d('0xa'),_0x227d('0xb'),_0x227d('0xc'),_0x227d('0xd')),'allowNull':![],'defaultValue':_0x227d('0xb')},'output':{'type':Sequelize[_0x227d('0x6')](_0x227d('0xe'),'pdf',_0x227d('0xf')),'allowNull':![],'defaultValue':_0x227d('0xe')},'type':{'type':Sequelize['ENUM'](_0x227d('0x10'),_0x227d('0x11')),'allowNull':![],'defaultValue':_0x227d('0x10')},'sendMail':{'type':Sequelize[_0x227d('0x12')],'defaultValue':![]},'email':{'type':Sequelize[_0x227d('0x2')]},'cc':{'type':Sequelize[_0x227d('0x13')]},'bcc':{'type':Sequelize[_0x227d('0x13')]},'sendIfEmpty':{'type':Sequelize[_0x227d('0x12')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index a39b455..7bb41a0 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 _0xb27f=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Scheduler','UserProfileResource','end','error','stack','name','send','index','map','Schedule','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','rawAttributes','intersection','includeAll','options','find','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0xb27f,0x1ec));var _0xfb27=function(_0x55f207,_0x57a5b1){_0x55f207=_0x55f207-0x0;var _0x1d80fe=_0xb27f[_0x55f207];return _0x1d80fe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfb27('0x0'));var jsonpatch=require(_0xfb27('0x1'));var rp=require(_0xfb27('0x2'));var moment=require('moment');var BPromise=require(_0xfb27('0x3'));var Mustache=require(_0xfb27('0x4'));var util=require(_0xfb27('0x5'));var path=require(_0xfb27('0x6'));var sox=require(_0xfb27('0x7'));var csv=require(_0xfb27('0x8'));var ejs=require(_0xfb27('0x9'));var fs=require('fs');var fs_extra=require(_0xfb27('0xa'));var _=require(_0xfb27('0xb'));var squel=require(_0xfb27('0xc'));var crypto=require(_0xfb27('0xd'));var jsforce=require(_0xfb27('0xe'));var deskjs=require(_0xfb27('0xf'));var toCsv=require(_0xfb27('0x8'));var querystring=require('querystring');var Papa=require(_0xfb27('0x10'));var Redis=require(_0xfb27('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfb27('0x12'));var as=require(_0xfb27('0x13'));var hardwareService=require(_0xfb27('0x14'));var logger=require('../../config/logger')(_0xfb27('0x15'));var utils=require(_0xfb27('0x16'));var config=require(_0xfb27('0x17'));var licenseUtil=require(_0xfb27('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x253da3,_0x1fb951){_0x1fb951=_0x1fb951||0xcc;return function(_0x2f32fa){if(_0x2f32fa){return _0x253da3[_0xfb27('0x19')](_0x1fb951);}return _0x253da3[_0xfb27('0x1a')](_0x1fb951)['end']();};}function respondWithResult(_0x151471,_0x2a6d5d){_0x2a6d5d=_0x2a6d5d||0xc8;return function(_0x1946cf){if(_0x1946cf){return _0x151471[_0xfb27('0x1a')](_0x2a6d5d)[_0xfb27('0x1b')](_0x1946cf);}};}function respondWithFilteredResult(_0x4a6414,_0x401a9b){return function(_0x439b56){if(_0x439b56){var _0x13a45b=typeof _0x401a9b[_0xfb27('0x1c')]==='undefined'&&typeof _0x401a9b[_0xfb27('0x1d')]===_0xfb27('0x1e');var _0x1f94b1=_0x439b56[_0xfb27('0x1f')];var _0x534005=_0x13a45b?0x0:_0x401a9b[_0xfb27('0x1c')];var _0x410bac=_0x13a45b?_0x439b56[_0xfb27('0x1f')]:_0x401a9b[_0xfb27('0x1c')]+_0x401a9b['limit'];var _0x3e3555;if(_0x410bac>=_0x1f94b1){_0x410bac=_0x1f94b1;_0x3e3555=0xc8;}else{_0x3e3555=0xce;}_0x4a6414['status'](_0x3e3555);return _0x4a6414[_0xfb27('0x20')](_0xfb27('0x21'),_0x534005+'-'+_0x410bac+'/'+_0x1f94b1)['json'](_0x439b56);}return null;};}function patchUpdates(_0x4ddcd4){return function(_0x248e82){try{jsonpatch[_0xfb27('0x22')](_0x248e82,_0x4ddcd4,!![]);}catch(_0x3e203f){return BPromise['reject'](_0x3e203f);}return _0x248e82[_0xfb27('0x23')]();};}function saveUpdates(_0x496db5,_0x226449){return function(_0x24dc9d){if(_0x24dc9d){return _0x24dc9d[_0xfb27('0x24')](_0x496db5)[_0xfb27('0x25')](function(_0x367d54){return _0x367d54;});}return null;};}function removeEntity(_0x358c45,_0xf9116a){return function(_0x22a407){if(_0x22a407){return _0x22a407[_0xfb27('0x26')]()[_0xfb27('0x25')](function(){var _0xa6c386=_0x22a407[_0xfb27('0x27')]({'plain':!![]});var _0x360a91=_0xfb27('0x28');return db[_0xfb27('0x29')][_0xfb27('0x26')]({'where':{'type':_0x360a91,'resourceId':_0xa6c386['id']}})['then'](function(){return _0x22a407;});})[_0xfb27('0x25')](function(){_0x358c45[_0xfb27('0x1a')](0xcc)[_0xfb27('0x2a')]();});}};}function handleEntityNotFound(_0x692816,_0x19fa87){return function(_0x184cb7){if(!_0x184cb7){_0x692816[_0xfb27('0x19')](0x194);}return _0x184cb7;};}function handleError(_0x8d66dd,_0x57bfe2){_0x57bfe2=_0x57bfe2||0x1f4;return function(_0x7f59fa){logger[_0xfb27('0x2b')](_0x7f59fa[_0xfb27('0x2c')]);if(_0x7f59fa[_0xfb27('0x2d')]){delete _0x7f59fa[_0xfb27('0x2d')];}_0x8d66dd[_0xfb27('0x1a')](_0x57bfe2)[_0xfb27('0x2e')](_0x7f59fa);};}exports[_0xfb27('0x2f')]=function(_0x292d20,_0x439397){var _0x2ca607={},_0x413066={},_0x18ffe6={'count':0x0,'rows':[]};var _0x10d7c2=_[_0xfb27('0x30')](db[_0xfb27('0x31')]['rawAttributes'],function(_0x1b9231){return{'name':_0x1b9231[_0xfb27('0x32')],'type':_0x1b9231[_0xfb27('0x33')][_0xfb27('0x34')]};});_0x413066[_0xfb27('0x35')]=_[_0xfb27('0x30')](_0x10d7c2,_0xfb27('0x2d'));_0x413066[_0xfb27('0x36')]=_[_0xfb27('0x37')](_0x292d20[_0xfb27('0x36')]);_0x413066[_0xfb27('0x38')]=_['intersection'](_0x413066[_0xfb27('0x35')],_0x413066['query']);_0x2ca607[_0xfb27('0x39')]=_['intersection'](_0x413066[_0xfb27('0x35')],qs[_0xfb27('0x3a')](_0x292d20[_0xfb27('0x36')][_0xfb27('0x3a')]));_0x2ca607[_0xfb27('0x39')]=_0x2ca607[_0xfb27('0x39')][_0xfb27('0x3b')]?_0x2ca607['attributes']:_0x413066['model'];if(!_0x292d20['query']['hasOwnProperty'](_0xfb27('0x3c'))){_0x2ca607[_0xfb27('0x1d')]=qs['limit'](_0x292d20[_0xfb27('0x36')][_0xfb27('0x1d')]);_0x2ca607['offset']=qs['offset'](_0x292d20[_0xfb27('0x36')]['offset']);}_0x2ca607[_0xfb27('0x3d')]=qs['sort'](_0x292d20[_0xfb27('0x36')]['sort']);_0x2ca607[_0xfb27('0x3e')]=qs['filters'](_[_0xfb27('0x3f')](_0x292d20[_0xfb27('0x36')],_0x413066[_0xfb27('0x38')]),_0x10d7c2);if(_0x292d20[_0xfb27('0x36')][_0xfb27('0x40')]){_0x2ca607[_0xfb27('0x3e')]=_[_0xfb27('0x41')](_0x2ca607[_0xfb27('0x3e')],{'$or':_[_0xfb27('0x30')](_0x10d7c2,function(_0x4f35a3){if(_0x4f35a3[_0xfb27('0x33')]!==_0xfb27('0x42')){var _0x21bd27={};_0x21bd27[_0x4f35a3[_0xfb27('0x2d')]]={'$like':'%'+_0x292d20[_0xfb27('0x36')][_0xfb27('0x40')]+'%'};return _0x21bd27;}})});}_0x2ca607=_[_0xfb27('0x41')]({},_0x2ca607,_0x292d20['options']);var _0x4dad5a={'where':_0x2ca607[_0xfb27('0x3e')]};return db[_0xfb27('0x31')]['count'](_0x4dad5a)['then'](function(_0x46a462){_0x18ffe6[_0xfb27('0x1f')]=_0x46a462;if(_0x292d20[_0xfb27('0x36')]['includeAll']){_0x2ca607[_0xfb27('0x43')]=[{'all':!![]}];}return db['Schedule'][_0xfb27('0x44')](_0x2ca607);})[_0xfb27('0x25')](function(_0x41c1f1){_0x18ffe6[_0xfb27('0x45')]=_0x41c1f1;return _0x18ffe6;})[_0xfb27('0x25')](respondWithFilteredResult(_0x439397,_0x2ca607))[_0xfb27('0x46')](handleError(_0x439397,null));};exports['show']=function(_0x38c11e,_0x16291d){var _0x3c9d03={'raw':![],'where':{'id':_0x38c11e[_0xfb27('0x47')]['id']}},_0x30f2a2={};_0x30f2a2[_0xfb27('0x35')]=_['keys'](db[_0xfb27('0x31')][_0xfb27('0x48')]);_0x30f2a2['query']=_[_0xfb27('0x37')](_0x38c11e[_0xfb27('0x36')]);_0x30f2a2[_0xfb27('0x38')]=_[_0xfb27('0x49')](_0x30f2a2[_0xfb27('0x35')],_0x30f2a2[_0xfb27('0x36')]);_0x3c9d03['attributes']=_['intersection'](_0x30f2a2[_0xfb27('0x35')],qs[_0xfb27('0x3a')](_0x38c11e[_0xfb27('0x36')][_0xfb27('0x3a')]));_0x3c9d03[_0xfb27('0x39')]=_0x3c9d03[_0xfb27('0x39')][_0xfb27('0x3b')]?_0x3c9d03[_0xfb27('0x39')]:_0x30f2a2[_0xfb27('0x35')];if(_0x38c11e[_0xfb27('0x36')][_0xfb27('0x4a')]){_0x3c9d03[_0xfb27('0x43')]=[{'all':!![]}];}_0x3c9d03=_[_0xfb27('0x41')]({},_0x3c9d03,_0x38c11e[_0xfb27('0x4b')]);return db[_0xfb27('0x31')][_0xfb27('0x4c')](_0x3c9d03)[_0xfb27('0x25')](handleEntityNotFound(_0x16291d,null))[_0xfb27('0x25')](respondWithResult(_0x16291d,null))['catch'](handleError(_0x16291d,null));};exports[_0xfb27('0x4d')]=function(_0x35fe94,_0x14d485){return db['Schedule'][_0xfb27('0x4d')](_0x35fe94[_0xfb27('0x4e')],{})[_0xfb27('0x25')](function(_0x2b0b6f){var _0x54fbe8=_0x35fe94[_0xfb27('0x4f')][_0xfb27('0x27')]({'plain':!![]});if(!_0x54fbe8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54fbe8['role']===_0xfb27('0x4f')){var _0x37965d=_0x2b0b6f['get']({'plain':!![]});var _0x2b6825='Scheduler';return db['UserProfileSection'][_0xfb27('0x4c')]({'where':{'name':_0x2b6825,'userProfileId':_0x54fbe8[_0xfb27('0x50')]},'raw':!![]})[_0xfb27('0x25')](function(_0x163fbb){if(_0x163fbb&&_0x163fbb[_0xfb27('0x51')]===0x0){return db[_0xfb27('0x29')]['create']({'name':_0x37965d[_0xfb27('0x2d')],'resourceId':_0x37965d['id'],'type':_0x163fbb['name'],'sectionId':_0x163fbb['id']},{})[_0xfb27('0x25')](function(){return _0x2b0b6f;});}else{return _0x2b0b6f;}})[_0xfb27('0x46')](function(_0x2f4d95){logger[_0xfb27('0x2b')](_0xfb27('0x52'),_0x2f4d95);throw _0x2f4d95;});}return _0x2b0b6f;})[_0xfb27('0x25')](respondWithResult(_0x14d485,0xc9))[_0xfb27('0x46')](handleError(_0x14d485,null));};exports[_0xfb27('0x24')]=function(_0x8012ff,_0x34ee3c){if(_0x8012ff[_0xfb27('0x4e')]['id']){delete _0x8012ff[_0xfb27('0x4e')]['id'];}return db[_0xfb27('0x31')]['find']({'where':{'id':_0x8012ff[_0xfb27('0x47')]['id']}})[_0xfb27('0x25')](handleEntityNotFound(_0x34ee3c,null))[_0xfb27('0x25')](saveUpdates(_0x8012ff[_0xfb27('0x4e')],null))['then'](respondWithResult(_0x34ee3c,null))[_0xfb27('0x46')](handleError(_0x34ee3c,null));};exports[_0xfb27('0x26')]=function(_0x1528ea,_0x5c7aa3){return db['Schedule']['find']({'where':{'id':_0x1528ea['params']['id']}})[_0xfb27('0x25')](handleEntityNotFound(_0x5c7aa3,null))['then'](removeEntity(_0x5c7aa3,null))[_0xfb27('0x46')](handleError(_0x5c7aa3,null));};exports[_0xfb27('0x53')]=function(_0x380959,_0x37e65d,_0x525208){var _0x177d9e=require('../../config/schedule');return db[_0xfb27('0x31')][_0xfb27('0x4c')]({'where':{'id':_0x380959[_0xfb27('0x47')]['id']},'raw':!![]})[_0xfb27('0x25')](handleEntityNotFound(_0x37e65d,null))['then'](function(){_0x177d9e[_0xfb27('0x53')](_0x380959['params']['id']);})[_0xfb27('0x25')](respondWithStatusCode(_0x37e65d,null))['catch'](handleError(_0x37e65d,null));}; \ No newline at end of file +var _0xd5a5=['body','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','rawAttributes','type','map','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','filter','merge','options','Schedule','include','findAll','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x3f353c,_0x2c8e55){var _0x19e91b=function(_0x3623c5){while(--_0x3623c5){_0x3f353c['push'](_0x3f353c['shift']());}};_0x19e91b(++_0x2c8e55);}(_0xd5a5,0x19d));var _0x5d5a=function(_0x5ec0e0,_0x15b860){_0x5ec0e0=_0x5ec0e0-0x0;var _0x5b217c=_0xd5a5[_0x5ec0e0];return _0x5b217c;};'use strict';var emlformat=require(_0x5d5a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d5a('0x1'));var jsonpatch=require(_0x5d5a('0x2'));var rp=require(_0x5d5a('0x3'));var moment=require(_0x5d5a('0x4'));var BPromise=require(_0x5d5a('0x5'));var Mustache=require(_0x5d5a('0x6'));var util=require('util');var path=require(_0x5d5a('0x7'));var sox=require('sox');var csv=require(_0x5d5a('0x8'));var ejs=require(_0x5d5a('0x9'));var fs=require('fs');var fs_extra=require(_0x5d5a('0xa'));var _=require('lodash');var squel=require(_0x5d5a('0xb'));var crypto=require(_0x5d5a('0xc'));var jsforce=require(_0x5d5a('0xd'));var deskjs=require(_0x5d5a('0xe'));var toCsv=require(_0x5d5a('0x8'));var querystring=require(_0x5d5a('0xf'));var Papa=require(_0x5d5a('0x10'));var Redis=require('ioredis');var authService=require(_0x5d5a('0x11'));var qs=require(_0x5d5a('0x12'));var as=require(_0x5d5a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d5a('0x14'))(_0x5d5a('0x15'));var utils=require(_0x5d5a('0x16'));var config=require(_0x5d5a('0x17'));var licenseUtil=require(_0x5d5a('0x18'));var db=require(_0x5d5a('0x19'))['db'];function respondWithStatusCode(_0x42ae90,_0x2b20d7){_0x2b20d7=_0x2b20d7||0xcc;return function(_0x3874b0){if(_0x3874b0){return _0x42ae90['sendStatus'](_0x2b20d7);}return _0x42ae90[_0x5d5a('0x1a')](_0x2b20d7)[_0x5d5a('0x1b')]();};}function respondWithResult(_0x4492a5,_0x3dc08b){_0x3dc08b=_0x3dc08b||0xc8;return function(_0x41ee75){if(_0x41ee75){return _0x4492a5[_0x5d5a('0x1a')](_0x3dc08b)['json'](_0x41ee75);}};}function respondWithFilteredResult(_0x27b9ca,_0x54b854){return function(_0xbcc662){if(_0xbcc662){var _0x175c30=typeof _0x54b854['offset']===_0x5d5a('0x1c')&&typeof _0x54b854['limit']===_0x5d5a('0x1c');var _0x395f1e=_0xbcc662[_0x5d5a('0x1d')];var _0x171cff=_0x175c30?0x0:_0x54b854['offset'];var _0x5658a0=_0x175c30?_0xbcc662[_0x5d5a('0x1d')]:_0x54b854[_0x5d5a('0x1e')]+_0x54b854[_0x5d5a('0x1f')];var _0x4af545;if(_0x5658a0>=_0x395f1e){_0x5658a0=_0x395f1e;_0x4af545=0xc8;}else{_0x4af545=0xce;}_0x27b9ca[_0x5d5a('0x1a')](_0x4af545);return _0x27b9ca[_0x5d5a('0x20')]('Content-Range',_0x171cff+'-'+_0x5658a0+'/'+_0x395f1e)['json'](_0xbcc662);}return null;};}function patchUpdates(_0x1c6d55){return function(_0x54c5e5){try{jsonpatch[_0x5d5a('0x21')](_0x54c5e5,_0x1c6d55,!![]);}catch(_0x2ecbe){return BPromise[_0x5d5a('0x22')](_0x2ecbe);}return _0x54c5e5[_0x5d5a('0x23')]();};}function saveUpdates(_0x430fc2,_0x25dc4e){return function(_0x1b53c8){if(_0x1b53c8){return _0x1b53c8['update'](_0x430fc2)[_0x5d5a('0x24')](function(_0x27a44f){return _0x27a44f;});}return null;};}function removeEntity(_0x2241d2,_0x4fa975){return function(_0x313f76){if(_0x313f76){return _0x313f76[_0x5d5a('0x25')]()[_0x5d5a('0x24')](function(){var _0x1549c8=_0x313f76[_0x5d5a('0x26')]({'plain':!![]});var _0x2c6e9a='Scheduler';return db[_0x5d5a('0x27')][_0x5d5a('0x25')]({'where':{'type':_0x2c6e9a,'resourceId':_0x1549c8['id']}})['then'](function(){return _0x313f76;});})['then'](function(){_0x2241d2[_0x5d5a('0x1a')](0xcc)[_0x5d5a('0x1b')]();});}};}function handleEntityNotFound(_0x102edc,_0xf828d){return function(_0x33a8c9){if(!_0x33a8c9){_0x102edc[_0x5d5a('0x28')](0x194);}return _0x33a8c9;};}function handleError(_0x1c3166,_0x478945){_0x478945=_0x478945||0x1f4;return function(_0x1ec6b9){logger[_0x5d5a('0x29')](_0x1ec6b9[_0x5d5a('0x2a')]);if(_0x1ec6b9[_0x5d5a('0x2b')]){delete _0x1ec6b9[_0x5d5a('0x2b')];}_0x1c3166['status'](_0x478945)['send'](_0x1ec6b9);};}exports[_0x5d5a('0x2c')]=function(_0x54ec02,_0x55a4fc){var _0x1dba5a={},_0x5efee4={},_0x2921eb={'count':0x0,'rows':[]};var _0x48b3bf=_['map'](db['Schedule'][_0x5d5a('0x2d')],function(_0x378911){return{'name':_0x378911['fieldName'],'type':_0x378911[_0x5d5a('0x2e')]['key']};});_0x5efee4['model']=_[_0x5d5a('0x2f')](_0x48b3bf,'name');_0x5efee4[_0x5d5a('0x30')]=_[_0x5d5a('0x31')](_0x54ec02[_0x5d5a('0x30')]);_0x5efee4[_0x5d5a('0x32')]=_[_0x5d5a('0x33')](_0x5efee4[_0x5d5a('0x34')],_0x5efee4[_0x5d5a('0x30')]);_0x1dba5a['attributes']=_[_0x5d5a('0x33')](_0x5efee4[_0x5d5a('0x34')],qs['fields'](_0x54ec02[_0x5d5a('0x30')][_0x5d5a('0x35')]));_0x1dba5a[_0x5d5a('0x36')]=_0x1dba5a[_0x5d5a('0x36')][_0x5d5a('0x37')]?_0x1dba5a['attributes']:_0x5efee4[_0x5d5a('0x34')];if(!_0x54ec02[_0x5d5a('0x30')]['hasOwnProperty']('nolimit')){_0x1dba5a['limit']=qs['limit'](_0x54ec02[_0x5d5a('0x30')][_0x5d5a('0x1f')]);_0x1dba5a[_0x5d5a('0x1e')]=qs[_0x5d5a('0x1e')](_0x54ec02[_0x5d5a('0x30')][_0x5d5a('0x1e')]);}_0x1dba5a[_0x5d5a('0x38')]=qs[_0x5d5a('0x39')](_0x54ec02[_0x5d5a('0x30')][_0x5d5a('0x39')]);_0x1dba5a[_0x5d5a('0x3a')]=qs[_0x5d5a('0x32')](_['pick'](_0x54ec02[_0x5d5a('0x30')],_0x5efee4['filters']),_0x48b3bf);if(_0x54ec02[_0x5d5a('0x30')][_0x5d5a('0x3b')]){_0x1dba5a['where']=_[_0x5d5a('0x3c')](_0x1dba5a[_0x5d5a('0x3a')],{'$or':_[_0x5d5a('0x2f')](_0x48b3bf,function(_0x57b909){if(_0x57b909[_0x5d5a('0x2e')]!=='VIRTUAL'){var _0x581c7a={};_0x581c7a[_0x57b909[_0x5d5a('0x2b')]]={'$like':'%'+_0x54ec02[_0x5d5a('0x30')][_0x5d5a('0x3b')]+'%'};return _0x581c7a;}})});}_0x1dba5a=_[_0x5d5a('0x3c')]({},_0x1dba5a,_0x54ec02[_0x5d5a('0x3d')]);var _0x14e2d9={'where':_0x1dba5a[_0x5d5a('0x3a')]};return db[_0x5d5a('0x3e')][_0x5d5a('0x1d')](_0x14e2d9)[_0x5d5a('0x24')](function(_0x1fa871){_0x2921eb[_0x5d5a('0x1d')]=_0x1fa871;if(_0x54ec02['query']['includeAll']){_0x1dba5a[_0x5d5a('0x3f')]=[{'all':!![]}];}return db[_0x5d5a('0x3e')][_0x5d5a('0x40')](_0x1dba5a);})['then'](function(_0x84bb46){_0x2921eb['rows']=_0x84bb46;return _0x2921eb;})[_0x5d5a('0x24')](respondWithFilteredResult(_0x55a4fc,_0x1dba5a))[_0x5d5a('0x41')](handleError(_0x55a4fc,null));};exports[_0x5d5a('0x42')]=function(_0x5b8777,_0x986d2a){var _0x33d0fe={'raw':![],'where':{'id':_0x5b8777[_0x5d5a('0x43')]['id']}},_0x2c943d={};_0x2c943d['model']=_[_0x5d5a('0x31')](db[_0x5d5a('0x3e')][_0x5d5a('0x2d')]);_0x2c943d[_0x5d5a('0x30')]=_[_0x5d5a('0x31')](_0x5b8777['query']);_0x2c943d[_0x5d5a('0x32')]=_['intersection'](_0x2c943d[_0x5d5a('0x34')],_0x2c943d[_0x5d5a('0x30')]);_0x33d0fe[_0x5d5a('0x36')]=_['intersection'](_0x2c943d[_0x5d5a('0x34')],qs['fields'](_0x5b8777[_0x5d5a('0x30')][_0x5d5a('0x35')]));_0x33d0fe[_0x5d5a('0x36')]=_0x33d0fe[_0x5d5a('0x36')][_0x5d5a('0x37')]?_0x33d0fe['attributes']:_0x2c943d[_0x5d5a('0x34')];if(_0x5b8777[_0x5d5a('0x30')][_0x5d5a('0x44')]){_0x33d0fe['include']=[{'all':!![]}];}_0x33d0fe=_['merge']({},_0x33d0fe,_0x5b8777[_0x5d5a('0x3d')]);return db[_0x5d5a('0x3e')][_0x5d5a('0x45')](_0x33d0fe)[_0x5d5a('0x24')](handleEntityNotFound(_0x986d2a,null))[_0x5d5a('0x24')](respondWithResult(_0x986d2a,null))[_0x5d5a('0x41')](handleError(_0x986d2a,null));};exports[_0x5d5a('0x46')]=function(_0x4150fd,_0x2c0a3c){return db['Schedule'][_0x5d5a('0x46')](_0x4150fd['body'],{})[_0x5d5a('0x24')](function(_0x28ca08){var _0x13b6df=_0x4150fd[_0x5d5a('0x47')]['get']({'plain':!![]});if(!_0x13b6df)throw new Error(_0x5d5a('0x48'));if(_0x13b6df[_0x5d5a('0x49')]===_0x5d5a('0x47')){var _0x49b7c9=_0x28ca08['get']({'plain':!![]});var _0xbf0a51=_0x5d5a('0x4a');return db[_0x5d5a('0x4b')][_0x5d5a('0x45')]({'where':{'name':_0xbf0a51,'userProfileId':_0x13b6df[_0x5d5a('0x4c')]},'raw':!![]})[_0x5d5a('0x24')](function(_0x113fb9){if(_0x113fb9&&_0x113fb9[_0x5d5a('0x4d')]===0x0){return db[_0x5d5a('0x27')]['create']({'name':_0x49b7c9['name'],'resourceId':_0x49b7c9['id'],'type':_0x113fb9['name'],'sectionId':_0x113fb9['id']},{})[_0x5d5a('0x24')](function(){return _0x28ca08;});}else{return _0x28ca08;}})[_0x5d5a('0x41')](function(_0x5f00c2){logger['error'](_0x5d5a('0x4e'),_0x5f00c2);throw _0x5f00c2;});}return _0x28ca08;})['then'](respondWithResult(_0x2c0a3c,0xc9))[_0x5d5a('0x41')](handleError(_0x2c0a3c,null));};exports['update']=function(_0x498857,_0x568799){if(_0x498857[_0x5d5a('0x4f')]['id']){delete _0x498857[_0x5d5a('0x4f')]['id'];}return db[_0x5d5a('0x3e')]['find']({'where':{'id':_0x498857[_0x5d5a('0x43')]['id']}})[_0x5d5a('0x24')](handleEntityNotFound(_0x568799,null))[_0x5d5a('0x24')](saveUpdates(_0x498857['body'],null))[_0x5d5a('0x24')](respondWithResult(_0x568799,null))['catch'](handleError(_0x568799,null));};exports[_0x5d5a('0x25')]=function(_0x30213d,_0x53b6bb){return db[_0x5d5a('0x3e')]['find']({'where':{'id':_0x30213d[_0x5d5a('0x43')]['id']}})[_0x5d5a('0x24')](handleEntityNotFound(_0x53b6bb,null))['then'](removeEntity(_0x53b6bb,null))[_0x5d5a('0x41')](handleError(_0x53b6bb,null));};exports[_0x5d5a('0x50')]=function(_0x29c4bb,_0x72659,_0xf262a9){var _0x41bd8e=require(_0x5d5a('0x51'));return db['Schedule'][_0x5d5a('0x45')]({'where':{'id':_0x29c4bb[_0x5d5a('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x72659,null))[_0x5d5a('0x24')](function(){_0x41bd8e[_0x5d5a('0x50')](_0x29c4bb[_0x5d5a('0x43')]['id']);})[_0x5d5a('0x24')](respondWithStatusCode(_0x72659,null))['catch'](handleError(_0x72659,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 7e53d19..e9c9f3f 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 _0x6551=['./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2c8127,_0x4b3643){var _0x39d461=function(_0x401614){while(--_0x401614){_0x2c8127['push'](_0x2c8127['shift']());}};_0x39d461(++_0x4b3643);}(_0x6551,0xe2));var _0x1655=function(_0x554927,_0x20afee){_0x554927=_0x554927-0x0;var _0x8bc8c8=_0x6551[_0x554927];return _0x8bc8c8;};'use strict';var _=require(_0x1655('0x0'));var util=require(_0x1655('0x1'));var logger=require(_0x1655('0x2'))(_0x1655('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1655('0x4'));var fs=require('fs');var path=require(_0x1655('0x5'));var rimraf=require(_0x1655('0x6'));var config=require(_0x1655('0x7'));var attributes=require(_0x1655('0x8'));module[_0x1655('0x9')]=function(_0x1f1237,_0x377769){return _0x1f1237[_0x1655('0xa')](_0x1655('0xb'),attributes,{'tableName':_0x1655('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7618=['Schedule','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports'];(function(_0x5687d9,_0x43d0d6){var _0x182062=function(_0x41bd4a){while(--_0x41bd4a){_0x5687d9['push'](_0x5687d9['shift']());}};_0x182062(++_0x43d0d6);}(_0x7618,0xe5));var _0x8761=function(_0x24ae32,_0x4f85e5){_0x24ae32=_0x24ae32-0x0;var _0x51e395=_0x7618[_0x24ae32];return _0x51e395;};'use strict';var _=require(_0x8761('0x0'));var util=require(_0x8761('0x1'));var logger=require(_0x8761('0x2'))(_0x8761('0x3'));var moment=require(_0x8761('0x4'));var BPromise=require(_0x8761('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8761('0x6'));var rimraf=require(_0x8761('0x7'));var config=require(_0x8761('0x8'));var attributes=require(_0x8761('0x9'));module[_0x8761('0xa')]=function(_0xb9f4f6,_0x72bcd8){return _0xb9f4f6['define'](_0x8761('0xb'),attributes,{'tableName':'tools_schedules','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 5af8bed..799267b 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 _0x1202=['debug','stringify','error','code','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x596d89,_0x3f9156){var _0x571fd5=function(_0x1404ca){while(--_0x1404ca){_0x596d89['push'](_0x596d89['shift']());}};_0x571fd5(++_0x3f9156);}(_0x1202,0x15d));var _0x2120=function(_0x1bc519,_0x349b35){_0x1bc519=_0x1bc519-0x0;var _0x296b2f=_0x1202[_0x1bc519];return _0x296b2f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2120('0x0'));var rs=require(_0x2120('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2120('0x2'))['db'];var utils=require(_0x2120('0x3'));var logger=require(_0x2120('0x4'))(_0x2120('0x5'));var config=require('../../config/environment');var jayson=require(_0x2120('0x6'));var client=jayson[_0x2120('0x7')][_0x2120('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19b930,_0x27d944,_0x155913){return new BPromise(function(_0x1da807,_0x1618f3){return client['request'](_0x19b930,_0x155913)['then'](function(_0x2dfb92){logger[_0x2120('0x9')](_0x2120('0xa'),_0x27d944,_0x2120('0xb'));logger[_0x2120('0xc')]('Schedule,\x20%s,\x20%s,\x20%s',_0x27d944,_0x2120('0xb'),JSON[_0x2120('0xd')](_0x2dfb92));if(_0x2dfb92[_0x2120('0xe')]){if(_0x2dfb92['error'][_0x2120('0xf')]===0x1f4){logger['error'](_0x2120('0xa'),_0x27d944,_0x2dfb92[_0x2120('0xe')][_0x2120('0x10')]);return _0x1618f3(_0x2dfb92[_0x2120('0xe')]['message']);}logger['error'](_0x2120('0xa'),_0x27d944,_0x2dfb92['error'][_0x2120('0x10')]);return _0x1da807(_0x2dfb92[_0x2120('0xe')][_0x2120('0x10')]);}else{logger[_0x2120('0x9')](_0x2120('0xa'),_0x27d944,_0x2120('0xb'));_0x1da807(_0x2dfb92[_0x2120('0x11')][_0x2120('0x10')]);}})[_0x2120('0x12')](function(_0xd3d448){logger[_0x2120('0xe')](_0x2120('0xa'),_0x27d944,_0xd3d448);_0x1618f3(_0xd3d448);});});} \ No newline at end of file +var _0x0a2e=['../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ioredis','../../mysqldb','../../config/utils'];(function(_0x82b55,_0x4c3e95){var _0x56c7c2=function(_0x467d7e){while(--_0x467d7e){_0x82b55['push'](_0x82b55['shift']());}};_0x56c7c2(++_0x4c3e95);}(_0x0a2e,0x140));var _0xe0a2=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x0a2e[_0x38a7ac];return _0x53061a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0a2('0x0'));var db=require(_0xe0a2('0x1'))['db'];var utils=require(_0xe0a2('0x2'));var logger=require(_0xe0a2('0x3'))(_0xe0a2('0x4'));var config=require(_0xe0a2('0x5'));var jayson=require(_0xe0a2('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x560b62,_0x5b0e07,_0x3f4674){return new BPromise(function(_0x5e0db3,_0x354ec7){return client['request'](_0x560b62,_0x3f4674)[_0xe0a2('0x7')](function(_0x18e676){logger[_0xe0a2('0x8')](_0xe0a2('0x9'),_0x5b0e07,_0xe0a2('0xa'));logger['debug'](_0xe0a2('0xb'),_0x5b0e07,_0xe0a2('0xa'),JSON[_0xe0a2('0xc')](_0x18e676));if(_0x18e676['error']){if(_0x18e676[_0xe0a2('0xd')]['code']===0x1f4){logger[_0xe0a2('0xd')]('Schedule,\x20%s,\x20%s',_0x5b0e07,_0x18e676[_0xe0a2('0xd')][_0xe0a2('0xe')]);return _0x354ec7(_0x18e676[_0xe0a2('0xd')][_0xe0a2('0xe')]);}logger[_0xe0a2('0xd')](_0xe0a2('0x9'),_0x5b0e07,_0x18e676[_0xe0a2('0xd')]['message']);return _0x5e0db3(_0x18e676[_0xe0a2('0xd')][_0xe0a2('0xe')]);}else{logger[_0xe0a2('0x8')](_0xe0a2('0x9'),_0x5b0e07,_0xe0a2('0xa'));_0x5e0db3(_0x18e676[_0xe0a2('0xf')][_0xe0a2('0xe')]);}})[_0xe0a2('0x10')](function(_0x44106f){logger[_0xe0a2('0xd')]('Schedule,\x20%s,\x20%s',_0x5b0e07,_0x44106f);_0x354ec7(_0x44106f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index d1a6b76..4531cbd 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 _0xe605=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','show','/:id/download','download','put','/:id','delete','destroy','exports','multer'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0xe605,0x92));var _0x5e60=function(_0x35f339,_0x1a1f5a){_0x35f339=_0x35f339-0x0;var _0x4955db=_0xe605[_0x35f339];return _0x4955db;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/describe',auth[_0x5e60('0xb')](),controller['describe']);router['get']('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['post']('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x10')](_0x5e60('0x11'),auth[_0x5e60('0xb')](),controller['update']);router[_0x5e60('0x12')](_0x5e60('0x11'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x13')]);module[_0x5e60('0x14')]=router; \ No newline at end of file +var _0xece2=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','post','create','put','update','delete'];(function(_0x44a81d,_0x4d18a7){var _0x5b0d1c=function(_0x4fb1ee){while(--_0x4fb1ee){_0x44a81d['push'](_0x44a81d['shift']());}};_0x5b0d1c(++_0x4d18a7);}(_0xece2,0x1cd));var _0x2ece=function(_0x131c81,_0x12fe63){_0x131c81=_0x131c81-0x0;var _0x241e7a=_0xece2[_0x131c81];return _0x241e7a;};'use strict';var multer=require(_0x2ece('0x0'));var util=require(_0x2ece('0x1'));var path=require(_0x2ece('0x2'));var timeout=require(_0x2ece('0x3'));var express=require('express');var router=express[_0x2ece('0x4')]();var fs_extra=require(_0x2ece('0x5'));var auth=require(_0x2ece('0x6'));var interaction=require(_0x2ece('0x7'));var config=require(_0x2ece('0x8'));var controller=require(_0x2ece('0x9'));router['get']('/',auth[_0x2ece('0xa')](),controller['index']);router[_0x2ece('0xb')](_0x2ece('0xc'),auth[_0x2ece('0xa')](),controller[_0x2ece('0xd')]);router['get'](_0x2ece('0xe'),auth[_0x2ece('0xa')](),controller[_0x2ece('0xf')]);router['get'](_0x2ece('0x10'),auth[_0x2ece('0xa')](),controller['download']);router[_0x2ece('0x11')]('/',auth[_0x2ece('0xa')](),controller[_0x2ece('0x12')]);router[_0x2ece('0x13')](_0x2ece('0xe'),auth[_0x2ece('0xa')](),controller[_0x2ece('0x14')]);router[_0x2ece('0x15')]('/:id',auth[_0x2ece('0xa')](),controller[_0x2ece('0x16')]);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 1142337..a8cd4f8 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 _0xf5b6=['format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','path','../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','setDataValue','INTEGER','startedAt','closedAt','duration','DATE'];(function(_0x40ad6a,_0x5da3bf){var _0x313997=function(_0x1e7624){while(--_0x1e7624){_0x40ad6a['push'](_0x40ad6a['shift']());}};_0x313997(++_0x5da3bf);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x3fa0f8,_0x50ec7b){_0x3fa0f8=_0x3fa0f8-0x0;var _0x5e7ee1=_0xf5b6[_0x3fa0f8];return _0x5e7ee1;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x6f5b('0x0'));var config=require(_0x6f5b('0x1'));module[_0x6f5b('0x2')]={'format':{'type':Sequelize[_0x6f5b('0x3')],'get':function(){return this['getDataValue'](_0x6f5b('0x4'))?path[_0x6f5b('0x5')](this[_0x6f5b('0x6')](_0x6f5b('0x4'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x6f5b('0x7')],'set':function(_0x5cf395){var _0x58899e=_0x5cf395['replace'](/\\/g,'/');this[_0x6f5b('0x8')]('value',_0x58899e);}},'rating':{'type':Sequelize[_0x6f5b('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6f5b('0x9')],'set':function(_0x17692b){this['setDataValue'](_0x6f5b('0xa'),moment()['subtract'](_0x17692b,'ms'));this[_0x6f5b('0x8')](_0x6f5b('0xb'),moment());this[_0x6f5b('0x8')](_0x6f5b('0xc'),_0x17692b);}},'startedAt':{'type':Sequelize[_0x6f5b('0xd')],'get':function(){return moment(this['getDataValue'](_0x6f5b('0xa')))[_0x6f5b('0xe')](_0x6f5b('0xf'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6f5b('0x6')](_0x6f5b('0xb')))[_0x6f5b('0xe')](_0x6f5b('0xf'))[_0x6f5b('0x10')]();}},'createdAt':{'type':Sequelize[_0x6f5b('0xd')],'get':function(){return moment(this[_0x6f5b('0x6')]('createdAt'))[_0x6f5b('0xe')](_0x6f5b('0xf'))['toString']();}},'updatedAt':{'type':Sequelize[_0x6f5b('0xd')],'get':function(){return moment(this[_0x6f5b('0x6')](_0x6f5b('0x11')))[_0x6f5b('0xe')](_0x6f5b('0xf'))[_0x6f5b('0x10')]();}}}; \ No newline at end of file +var _0xa817=['../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','updatedAt','sequelize','moment','path'];(function(_0x1c5fd2,_0xf4e539){var _0x2df5fc=function(_0x3fe9a5){while(--_0x3fe9a5){_0x1c5fd2['push'](_0x1c5fd2['shift']());}};_0x2df5fc(++_0xf4e539);}(_0xa817,0x7b));var _0x7a81=function(_0x5cf64c,_0xcea70f){_0x5cf64c=_0x5cf64c-0x0;var _0x93e41b=_0xa817[_0x5cf64c];return _0x93e41b;};'use strict';var Sequelize=require(_0x7a81('0x0'));var moment=require(_0x7a81('0x1'));var path=require(_0x7a81('0x2'));var config=require(_0x7a81('0x3'));module[_0x7a81('0x4')]={'format':{'type':Sequelize[_0x7a81('0x5')],'get':function(){return this[_0x7a81('0x6')](_0x7a81('0x7'))?path[_0x7a81('0x8')](this['getDataValue'](_0x7a81('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x7a81('0x9')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x7a81('0x9')],'set':function(_0x35c35a){var _0x3ab25c=_0x35c35a[_0x7a81('0xa')](/\\/g,'/');this[_0x7a81('0xb')](_0x7a81('0x7'),_0x3ab25c);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7a81('0xc')],'set':function(_0x5b3b66){this['setDataValue'](_0x7a81('0xd'),moment()['subtract'](_0x5b3b66,'ms'));this[_0x7a81('0xb')](_0x7a81('0xe'),moment());this[_0x7a81('0xb')](_0x7a81('0xf'),_0x5b3b66);}},'startedAt':{'type':Sequelize[_0x7a81('0x10')],'get':function(){return moment(this[_0x7a81('0x6')](_0x7a81('0xd')))['format'](_0x7a81('0x11'))[_0x7a81('0x12')]();}},'closedAt':{'type':Sequelize[_0x7a81('0x10')],'get':function(){return moment(this['getDataValue'](_0x7a81('0xe')))[_0x7a81('0x13')](_0x7a81('0x11'))[_0x7a81('0x12')]();}},'createdAt':{'type':Sequelize[_0x7a81('0x10')],'get':function(){return moment(this[_0x7a81('0x6')]('createdAt'))['format'](_0x7a81('0x11'))[_0x7a81('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7a81('0x6')](_0x7a81('0x14')))[_0x7a81('0x13')](_0x7a81('0x11'))[_0x7a81('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index fea58dc..7578905 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 _0x0e85=['duration','createdAt','closedAt','params','describe','download','uniqueid','join','root','value','existsSync','secrets','recording','server/files/screen_recordings','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','util','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','key','model','format','query','filters','intersection','attributes','length','nolimit','sort','filter','where','merge','type','options','include','findAll','rows','catch','keys','fields','find','create','body'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x0e85,0x7c));var _0x50e8=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x0e85[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['differenceBy'](_['map'](_0x126c99,_0x50e8('0x26')),[_0x50e8('0x2e')]);_0x4f0b88[_0x50e8('0x2f')]=_['keys'](_0x30fedf['query']);_0x4f0b88[_0x50e8('0x30')]=_[_0x50e8('0x31')](_0x4f0b88['model'],_0x4f0b88[_0x50e8('0x2f')]);_0x42bbef[_0x50e8('0x32')]=_[_0x50e8('0x31')](_0x4f0b88[_0x50e8('0x2d')],qs['fields'](_0x30fedf[_0x50e8('0x2f')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef[_0x50e8('0x32')][_0x50e8('0x33')]?_0x42bbef['attributes']:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf[_0x50e8('0x2f')]['hasOwnProperty'](_0x50e8('0x34'))){_0x42bbef[_0x50e8('0x1d')]=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2f')]['limit']);_0x42bbef[_0x50e8('0x1b')]=qs[_0x50e8('0x1b')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x1b')]);}_0x42bbef['order']=qs[_0x50e8('0x35')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x35')]);_0x42bbef['where']=qs['filters'](_['pick'](_0x30fedf[_0x50e8('0x2f')],_0x4f0b88[_0x50e8('0x30')]),_0x126c99);if(_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]){_0x42bbef[_0x50e8('0x37')]=_[_0x50e8('0x38')](_0x42bbef[_0x50e8('0x37')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0x35f802){if(_0x35f802[_0x50e8('0x39')]!=='VIRTUAL'){var _0x3371a4={};_0x3371a4[_0x35f802[_0x50e8('0x26')]]={'$like':'%'+_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]+'%'};return _0x3371a4;}})});}_0x42bbef=_['merge']({},_0x42bbef,_0x30fedf[_0x50e8('0x3a')]);var _0x944e46={'where':_0x42bbef[_0x50e8('0x37')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x944e46)['then'](function(_0x53b198){_0x1041b9[_0x50e8('0x1e')]=_0x53b198;if(_0x30fedf[_0x50e8('0x2f')]['includeAll']){_0x42bbef[_0x50e8('0x3b')]=[{'all':!![]}];}return db[_0x50e8('0x29')][_0x50e8('0x3c')](_0x42bbef);})[_0x50e8('0x23')](function(_0x251e1c){_0x1041b9[_0x50e8('0x3d')]=_0x251e1c;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x3e')](handleError(_0x39c0c6,null));};exports['show']=function(_0x3d26bd,_0x44e0ca){var _0x3ea251={'raw':![],'where':{'id':_0x3d26bd['params']['id']}},_0x2adae0={};_0x2adae0[_0x50e8('0x2d')]=_[_0x50e8('0x3f')](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x2adae0['query']=_[_0x50e8('0x3f')](_0x3d26bd['query']);_0x2adae0['filters']=_['intersection'](_0x2adae0[_0x50e8('0x2d')],_0x2adae0[_0x50e8('0x2f')]);_0x3ea251['attributes']=_[_0x50e8('0x31')](_0x2adae0[_0x50e8('0x2d')],qs[_0x50e8('0x40')](_0x3d26bd[_0x50e8('0x2f')][_0x50e8('0x40')]));_0x3ea251[_0x50e8('0x32')]=_0x3ea251['attributes'][_0x50e8('0x33')]?_0x3ea251['attributes']:_0x2adae0[_0x50e8('0x2d')];if(_0x3d26bd[_0x50e8('0x2f')]['includeAll']){_0x3ea251[_0x50e8('0x3b')]=[{'all':!![]}];}_0x3ea251=_['merge']({},_0x3ea251,_0x3d26bd[_0x50e8('0x3a')]);return db[_0x50e8('0x29')][_0x50e8('0x41')](_0x3ea251)[_0x50e8('0x23')](handleEntityNotFound(_0x44e0ca,null))[_0x50e8('0x23')](respondWithResult(_0x44e0ca,null))[_0x50e8('0x3e')](handleError(_0x44e0ca,null));};exports[_0x50e8('0x42')]=function(_0x3e52b3,_0x141bd4){return db[_0x50e8('0x29')][_0x50e8('0x42')](_0x3e52b3['body'],{})[_0x50e8('0x23')](respondWithResult(_0x141bd4,0xc9))[_0x50e8('0x3e')](handleError(_0x141bd4,null));};exports['update']=function(_0x3692ba,_0x58f14e){if(_0x3692ba[_0x50e8('0x43')]['id']){delete _0x3692ba['body']['id'];}delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x44')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x45')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x46')];delete _0x3692ba[_0x50e8('0x43')]['value'];return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x3692ba[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x58f14e,null))[_0x50e8('0x23')](saveUpdates(_0x3692ba[_0x50e8('0x43')],null))['then'](respondWithResult(_0x58f14e,null))[_0x50e8('0x3e')](handleError(_0x58f14e,null));};exports[_0x50e8('0x48')]=function(_0xff2e24,_0x27c80a){return db['ScreenRecording'][_0x50e8('0x48')]()[_0x50e8('0x23')](respondWithResult(_0x27c80a,null))[_0x50e8('0x3e')](handleError(_0x27c80a,null));};exports[_0x50e8('0x49')]=function(_0x207f06,_0x1372e3,_0x320b00){var _0x5f5220=require('../../components/encryptor');var _0x55083e=![];var _0x2b54ad={};if(_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]&&_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]===_0x50e8('0x4a')){_0x2b54ad['uniqueid']=_0x207f06[_0x50e8('0x47')]['id'];}else{_0x2b54ad['id']=_0x207f06[_0x50e8('0x47')]['id'];}return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':_0x2b54ad,'attributes':['id','value'],'raw':!![]})[_0x50e8('0x23')](handleEntityNotFound(_0x1372e3,null))[_0x50e8('0x23')](function(_0x373b41){if(_0x373b41){var _0x1cc5ba=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],'server/files/screen_recordings',_0x373b41[_0x50e8('0x4d')]);var _0x5d0d54=util['format']('%s.cypher',_0x1cc5ba);if(fs[_0x50e8('0x4e')](_0x5d0d54)){_0x55083e=!![];return _0x5f5220['decryptFile'](_0x5d0d54,_0x1cc5ba,config[_0x50e8('0x4f')][_0x50e8('0x50')])[_0x50e8('0x23')](function(){return _0x373b41;});}return _0x373b41;}})[_0x50e8('0x23')](function(_0x279cf4){if(_0x279cf4){var _0x12224d=path[_0x50e8('0x4b')](config['root'],_0x50e8('0x51'),_0x279cf4[_0x50e8('0x4d')]);if(!fs[_0x50e8('0x4e')](_0x12224d)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x279cf4[_0x50e8('0x52')]){return _0x1372e3[_0x50e8('0x49')](_0x12224d,_0x279cf4[_0x50e8('0x52')]+path[_0x50e8('0x53')](_0x12224d),function(){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}else{return _0x1372e3[_0x50e8('0x49')](_0x12224d,function(_0x583d6a){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}}})['catch'](function(_0x255b48){if(_0x255b48[_0x50e8('0x55')]==='ScreenRecording\x20not\x20found'){_0x1372e3['status'](0x194)['send'](_0x50e8('0x56'));}else{return handleError(_0x1372e3,null);}});};exports[_0x50e8('0x57')]=function(_0x5d1fc8,_0x351047){return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x5d1fc8[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](function(_0x47b428){if(_[_0x50e8('0x58')](_0x47b428)){throw new ReferenceError(_0x50e8('0x59'));}return _0x47b428;})[_0x50e8('0x23')](function(_0x4b80ac){var _0x583e58=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],_0x50e8('0x51'),_0x4b80ac[_0x50e8('0x4d')]);logger[_0x50e8('0x5a')](_0x50e8('0x5b'),_0x583e58);if(!_['isNil'](_0x4b80ac['value'])&&fs[_0x50e8('0x4e')](_0x583e58)){logger['info'](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs['unlinkSync'](_0x583e58);}_0x583e58=_0x583e58+_0x50e8('0x5e');if(!_['isNil'](_0x4b80ac['value'])&&fs['existsSync'](_0x583e58)){logger[_0x50e8('0x5a')](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs[_0x50e8('0x5f')](_0x583e58);}return _0x4b80ac;})['then'](function(_0x480362){if(!_0x480362)throw new InternalError();return _0x480362[_0x50e8('0x57')]();})[_0x50e8('0x23')](function(){_0x351047[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();})[_0x50e8('0x3e')](handleError(_0x351047,null));}; \ No newline at end of file +var _0xac31=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','then','includeAll','findAll','rows','catch','params','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0xac31,0xca));var _0x1ac3=function(_0x1f2f5a,_0x27738d){_0x1f2f5a=_0x1f2f5a-0x0;var _0x1f4e37=_0xac31[_0x1f2f5a];return _0x1f4e37;};'use strict';var emlformat=require(_0x1ac3('0x0'));var rimraf=require(_0x1ac3('0x1'));var zipdir=require(_0x1ac3('0x2'));var jsonpatch=require(_0x1ac3('0x3'));var rp=require(_0x1ac3('0x4'));var moment=require(_0x1ac3('0x5'));var BPromise=require(_0x1ac3('0x6'));var Mustache=require('mustache');var util=require(_0x1ac3('0x7'));var path=require(_0x1ac3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1ac3('0x9'));var fs=require('fs');var fs_extra=require(_0x1ac3('0xa'));var _=require(_0x1ac3('0xb'));var squel=require(_0x1ac3('0xc'));var crypto=require(_0x1ac3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1ac3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ac3('0xf'));var Papa=require(_0x1ac3('0x10'));var Redis=require(_0x1ac3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1ac3('0x12'));var as=require(_0x1ac3('0x13'));var hardwareService=require(_0x1ac3('0x14'));var logger=require(_0x1ac3('0x15'))(_0x1ac3('0x16'));var utils=require(_0x1ac3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1ac3('0x18'));var db=require(_0x1ac3('0x19'))['db'];function respondWithStatusCode(_0x2eeabf,_0x2338b9){_0x2338b9=_0x2338b9||0xcc;return function(_0x50d3b6){if(_0x50d3b6){return _0x2eeabf[_0x1ac3('0x1a')](_0x2338b9);}return _0x2eeabf[_0x1ac3('0x1b')](_0x2338b9)[_0x1ac3('0x1c')]();};}function respondWithResult(_0x2def9f,_0x53cc35){_0x53cc35=_0x53cc35||0xc8;return function(_0x24bb5e){if(_0x24bb5e){return _0x2def9f[_0x1ac3('0x1b')](_0x53cc35)['json'](_0x24bb5e);}};}function respondWithFilteredResult(_0x29a7b3,_0x1f9641){return function(_0x38b52a){if(_0x38b52a){var _0x51f1e4=typeof _0x1f9641[_0x1ac3('0x1d')]===_0x1ac3('0x1e')&&typeof _0x1f9641[_0x1ac3('0x1f')]==='undefined';var _0x195683=_0x38b52a['count'];var _0x291616=_0x51f1e4?0x0:_0x1f9641[_0x1ac3('0x1d')];var _0x20091d=_0x51f1e4?_0x38b52a[_0x1ac3('0x20')]:_0x1f9641[_0x1ac3('0x1d')]+_0x1f9641['limit'];var _0x136e73;if(_0x20091d>=_0x195683){_0x20091d=_0x195683;_0x136e73=0xc8;}else{_0x136e73=0xce;}_0x29a7b3[_0x1ac3('0x1b')](_0x136e73);return _0x29a7b3[_0x1ac3('0x21')](_0x1ac3('0x22'),_0x291616+'-'+_0x20091d+'/'+_0x195683)['json'](_0x38b52a);}return null;};}function patchUpdates(_0x48d18a){return function(_0x2879d8){try{jsonpatch[_0x1ac3('0x23')](_0x2879d8,_0x48d18a,!![]);}catch(_0x14070b){return BPromise[_0x1ac3('0x24')](_0x14070b);}return _0x2879d8[_0x1ac3('0x25')]();};}function saveUpdates(_0x319988,_0x23b767){return function(_0x10912a){if(_0x10912a){return _0x10912a[_0x1ac3('0x26')](_0x319988)['then'](function(_0x1e277f){return _0x1e277f;});}return null;};}function removeEntity(_0x231b7f,_0x4b19f2){return function(_0x2b5182){if(_0x2b5182){return _0x2b5182[_0x1ac3('0x27')]()['then'](function(){_0x231b7f[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();});}};}function handleEntityNotFound(_0x145486,_0x2dfdb7){return function(_0x10db3d){if(!_0x10db3d){_0x145486['sendStatus'](0x194);}return _0x10db3d;};}function handleError(_0x5a2ab2,_0x503a64){_0x503a64=_0x503a64||0x1f4;return function(_0x528807){logger['error'](_0x528807[_0x1ac3('0x28')]);if(_0x528807['name']){delete _0x528807[_0x1ac3('0x29')];}_0x5a2ab2[_0x1ac3('0x1b')](_0x503a64)[_0x1ac3('0x2a')](_0x528807);};}exports[_0x1ac3('0x2b')]=function(_0x4b3d3c,_0x61441d){var _0x541da0={},_0x2ddd73={},_0x4000b0={'count':0x0,'rows':[]};var _0x440aed=_[_0x1ac3('0x2c')](db[_0x1ac3('0x2d')][_0x1ac3('0x2e')],function(_0x9c17c2){return{'name':_0x9c17c2['fieldName'],'type':_0x9c17c2[_0x1ac3('0x2f')][_0x1ac3('0x30')]};});_0x2ddd73[_0x1ac3('0x31')]=_[_0x1ac3('0x32')](_['map'](_0x440aed,_0x1ac3('0x29')),[_0x1ac3('0x33')]);_0x2ddd73[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4b3d3c[_0x1ac3('0x34')]);_0x2ddd73['filters']=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],_0x2ddd73[_0x1ac3('0x34')]);_0x541da0[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],qs['fields'](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x541da0[_0x1ac3('0x37')]=_0x541da0[_0x1ac3('0x37')]['length']?_0x541da0[_0x1ac3('0x37')]:_0x2ddd73[_0x1ac3('0x31')];if(!_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x39')](_0x1ac3('0x3a'))){_0x541da0[_0x1ac3('0x1f')]=qs[_0x1ac3('0x1f')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x1f')]);_0x541da0['offset']=qs[_0x1ac3('0x1d')](_0x4b3d3c[_0x1ac3('0x34')]['offset']);}_0x541da0[_0x1ac3('0x3b')]=qs[_0x1ac3('0x3c')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x3c')]);_0x541da0[_0x1ac3('0x3d')]=qs[_0x1ac3('0x3e')](_[_0x1ac3('0x3f')](_0x4b3d3c[_0x1ac3('0x34')],_0x2ddd73['filters']),_0x440aed);if(_0x4b3d3c[_0x1ac3('0x34')]['filter']){_0x541da0[_0x1ac3('0x3d')]=_[_0x1ac3('0x40')](_0x541da0[_0x1ac3('0x3d')],{'$or':_[_0x1ac3('0x2c')](_0x440aed,function(_0x3141ae){if(_0x3141ae[_0x1ac3('0x2f')]!=='VIRTUAL'){var _0x3b5c1c={};_0x3b5c1c[_0x3141ae[_0x1ac3('0x29')]]={'$like':'%'+_0x4b3d3c[_0x1ac3('0x34')]['filter']+'%'};return _0x3b5c1c;}})});}_0x541da0=_[_0x1ac3('0x40')]({},_0x541da0,_0x4b3d3c[_0x1ac3('0x41')]);var _0x5cec6b={'where':_0x541da0[_0x1ac3('0x3d')]};return db[_0x1ac3('0x2d')][_0x1ac3('0x20')](_0x5cec6b)[_0x1ac3('0x42')](function(_0x466a45){_0x4000b0[_0x1ac3('0x20')]=_0x466a45;if(_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x541da0['include']=[{'all':!![]}];}return db[_0x1ac3('0x2d')][_0x1ac3('0x44')](_0x541da0);})[_0x1ac3('0x42')](function(_0x254a77){_0x4000b0[_0x1ac3('0x45')]=_0x254a77;return _0x4000b0;})[_0x1ac3('0x42')](respondWithFilteredResult(_0x61441d,_0x541da0))[_0x1ac3('0x46')](handleError(_0x61441d,null));};exports['show']=function(_0x4edc4d,_0x2c2099){var _0x3f60ca={'raw':![],'where':{'id':_0x4edc4d[_0x1ac3('0x47')]['id']}},_0x4972d1={};_0x4972d1[_0x1ac3('0x31')]=_['keys'](db[_0x1ac3('0x2d')]['rawAttributes']);_0x4972d1[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4edc4d[_0x1ac3('0x34')]);_0x4972d1[_0x1ac3('0x3e')]=_['intersection'](_0x4972d1[_0x1ac3('0x31')],_0x4972d1[_0x1ac3('0x34')]);_0x3f60ca[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x4972d1[_0x1ac3('0x31')],qs['fields'](_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x3f60ca[_0x1ac3('0x37')]=_0x3f60ca[_0x1ac3('0x37')]['length']?_0x3f60ca[_0x1ac3('0x37')]:_0x4972d1[_0x1ac3('0x31')];if(_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x3f60ca['include']=[{'all':!![]}];}_0x3f60ca=_[_0x1ac3('0x40')]({},_0x3f60ca,_0x4edc4d[_0x1ac3('0x41')]);return db[_0x1ac3('0x2d')][_0x1ac3('0x48')](_0x3f60ca)['then'](handleEntityNotFound(_0x2c2099,null))[_0x1ac3('0x42')](respondWithResult(_0x2c2099,null))['catch'](handleError(_0x2c2099,null));};exports[_0x1ac3('0x49')]=function(_0x10bcaf,_0x2e3347){return db[_0x1ac3('0x2d')][_0x1ac3('0x49')](_0x10bcaf[_0x1ac3('0x4a')],{})[_0x1ac3('0x42')](respondWithResult(_0x2e3347,0xc9))['catch'](handleError(_0x2e3347,null));};exports['update']=function(_0xe8f33c,_0x249c2d){if(_0xe8f33c[_0x1ac3('0x4a')]['id']){delete _0xe8f33c['body']['id'];}delete _0xe8f33c['body']['duration'];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4b')];delete _0xe8f33c['body'][_0x1ac3('0x4c')];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4d')];return db[_0x1ac3('0x2d')]['find']({'where':{'id':_0xe8f33c['params']['id']}})[_0x1ac3('0x42')](handleEntityNotFound(_0x249c2d,null))[_0x1ac3('0x42')](saveUpdates(_0xe8f33c['body'],null))[_0x1ac3('0x42')](respondWithResult(_0x249c2d,null))['catch'](handleError(_0x249c2d,null));};exports['describe']=function(_0x2d628d,_0x220dd0){return db['ScreenRecording'][_0x1ac3('0x4e')]()['then'](respondWithResult(_0x220dd0,null))[_0x1ac3('0x46')](handleError(_0x220dd0,null));};exports[_0x1ac3('0x4f')]=function(_0x3586b9,_0x3a0320,_0x34ad43){var _0x40e9c7=require(_0x1ac3('0x50'));var _0x331374=![];var _0xeb7e49={};if(_0x3586b9[_0x1ac3('0x34')][_0x1ac3('0x2f')]&&_0x3586b9['query']['type']===_0x1ac3('0x51')){_0xeb7e49[_0x1ac3('0x51')]=_0x3586b9[_0x1ac3('0x47')]['id'];}else{_0xeb7e49['id']=_0x3586b9[_0x1ac3('0x47')]['id'];}return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':_0xeb7e49,'attributes':['id',_0x1ac3('0x4d')],'raw':!![]})[_0x1ac3('0x42')](handleEntityNotFound(_0x3a0320,null))[_0x1ac3('0x42')](function(_0x3149f6){if(_0x3149f6){var _0x541bba=path[_0x1ac3('0x52')](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x3149f6[_0x1ac3('0x4d')]);var _0x20c195=util['format'](_0x1ac3('0x55'),_0x541bba);if(fs[_0x1ac3('0x56')](_0x20c195)){_0x331374=!![];return _0x40e9c7['decryptFile'](_0x20c195,_0x541bba,config['secrets']['recording'])[_0x1ac3('0x42')](function(){return _0x3149f6;});}return _0x3149f6;}})[_0x1ac3('0x42')](function(_0x2a1f66){if(_0x2a1f66){var _0x5ad546=path[_0x1ac3('0x52')](config['root'],'server/files/screen_recordings',_0x2a1f66['value']);if(!fs['existsSync'](_0x5ad546)){throw new db[(_0x1ac3('0x57'))][(_0x1ac3('0x58'))](_0x1ac3('0x59'));}if(_0x2a1f66[_0x1ac3('0x5a')]){return _0x3a0320[_0x1ac3('0x4f')](_0x5ad546,_0x2a1f66['filename']+path[_0x1ac3('0x5b')](_0x5ad546),function(){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}else{return _0x3a0320['download'](_0x5ad546,function(_0x2bcb4b){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}}})[_0x1ac3('0x46')](function(_0x2e79b2){if(_0x2e79b2[_0x1ac3('0x5d')]==='ScreenRecording\x20not\x20found'){_0x3a0320[_0x1ac3('0x1b')](0x194)[_0x1ac3('0x2a')](_0x1ac3('0x5e'));}else{return handleError(_0x3a0320,null);}});};exports[_0x1ac3('0x27')]=function(_0x4cfa04,_0x19407a){return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':{'id':_0x4cfa04[_0x1ac3('0x47')]['id']}})[_0x1ac3('0x42')](function(_0x1ac283){if(_['isNil'](_0x1ac283)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1ac283;})['then'](function(_0x582fe2){var _0x3b930b=path['join'](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x582fe2[_0x1ac3('0x4d')]);logger[_0x1ac3('0x5f')](_0x1ac3('0x60'),_0x3b930b);if(!_[_0x1ac3('0x61')](_0x582fe2['value'])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')](_0x1ac3('0x62')+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}_0x3b930b=_0x3b930b+_0x1ac3('0x64');if(!_[_0x1ac3('0x61')](_0x582fe2[_0x1ac3('0x4d')])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')]('File:\x20\x22'+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}return _0x582fe2;})['then'](function(_0x402507){if(!_0x402507)throw new InternalError();return _0x402507[_0x1ac3('0x27')]();})[_0x1ac3('0x42')](function(){_0x19407a[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();})[_0x1ac3('0x46')](handleError(_0x19407a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 0948a5f..84f3107 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 _0xd297=['interactionid','lodash','api','bluebird','request-promise','rimraf','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings'];(function(_0x4e908a,_0x319580){var _0xaaa676=function(_0x4e1632){while(--_0x4e1632){_0x4e908a['push'](_0x4e908a['shift']());}};_0xaaa676(++_0x319580);}(_0xd297,0x90));var _0x7d29=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd297[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7d29('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7d29('0x1'));var moment=require('moment');var BPromise=require(_0x7d29('0x2'));var rp=require(_0x7d29('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d29('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d29('0x5'));module[_0x7d29('0x6')]=function(_0x479e6c,_0x440b64){return _0x479e6c[_0x7d29('0x7')](_0x7d29('0x8'),attributes,{'tableName':_0x7d29('0x9'),'paranoid':![],'indexes':[{'name':_0x7d29('0xa'),'fields':[_0x7d29('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0343=['bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x5cdbf4,_0x186b32){var _0x1d13a5=function(_0x3c342e){while(--_0x3c342e){_0x5cdbf4['push'](_0x5cdbf4['shift']());}};_0x1d13a5(++_0x186b32);}(_0x0343,0xeb));var _0x3034=function(_0x5914a3,_0x22e240){_0x5914a3=_0x5914a3-0x0;var _0x25af13=_0x0343[_0x5914a3];return _0x25af13;};'use strict';var _=require(_0x3034('0x0'));var util=require(_0x3034('0x1'));var logger=require(_0x3034('0x2'))(_0x3034('0x3'));var moment=require(_0x3034('0x4'));var BPromise=require(_0x3034('0x5'));var rp=require(_0x3034('0x6'));var fs=require('fs');var path=require(_0x3034('0x7'));var rimraf=require(_0x3034('0x8'));var config=require(_0x3034('0x9'));var attributes=require(_0x3034('0xa'));module[_0x3034('0xb')]=function(_0x2c4be3,_0x3f7ea9){return _0x2c4be3[_0x3034('0xc')](_0x3034('0xd'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x3034('0xe'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index a87d6ad..ee00183 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 _0x1bd9=['message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','then','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x24721a,_0x1ac53c){var _0x6a9880=function(_0x558dc8){while(--_0x558dc8){_0x24721a['push'](_0x24721a['shift']());}};_0x6a9880(++_0x1ac53c);}(_0x1bd9,0x133));var _0x91bd=function(_0xadfd73,_0xdfda04){_0xadfd73=_0xadfd73-0x0;var _0x2bbab6=_0x1bd9[_0xadfd73];return _0x2bbab6;};'use strict';var _=require(_0x91bd('0x0'));var util=require(_0x91bd('0x1'));var moment=require(_0x91bd('0x2'));var BPromise=require(_0x91bd('0x3'));var rs=require(_0x91bd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91bd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x91bd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x91bd('0x7'));var client=jayson[_0x91bd('0x8')][_0x91bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19c05a,_0x371b68,_0xb461d1){return new BPromise(function(_0x434e40,_0x53f7f3){return client['request'](_0x19c05a,_0xb461d1)[_0x91bd('0xa')](function(_0x3da3c9){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x371b68,_0x91bd('0xb'));logger['debug'](_0x91bd('0xc'),_0x371b68,_0x91bd('0xb'),JSON[_0x91bd('0xd')](_0x3da3c9));if(_0x3da3c9['error']){if(_0x3da3c9['error'][_0x91bd('0xe')]===0x1f4){logger[_0x91bd('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x371b68,_0x3da3c9[_0x91bd('0xf')][_0x91bd('0x10')]);return _0x53f7f3(_0x3da3c9[_0x91bd('0xf')][_0x91bd('0x10')]);}logger[_0x91bd('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x371b68,_0x3da3c9['error'][_0x91bd('0x10')]);return _0x434e40(_0x3da3c9[_0x91bd('0xf')][_0x91bd('0x10')]);}else{logger[_0x91bd('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x371b68,_0x91bd('0xb'));_0x434e40(_0x3da3c9['result']['message']);}})[_0x91bd('0x12')](function(_0x1c6a7f){logger[_0x91bd('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x371b68,_0x1c6a7f);_0x53f7f3(_0x1c6a7f);});});} \ No newline at end of file +var _0x523c=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util'];(function(_0x3bc36c,_0x4ada3b){var _0x581eae=function(_0x4a073f){while(--_0x4a073f){_0x3bc36c['push'](_0x3bc36c['shift']());}};_0x581eae(++_0x4ada3b);}(_0x523c,0x8f));var _0xc523=function(_0x40ba2b,_0x42772e){_0x40ba2b=_0x40ba2b-0x0;var _0x916a9c=_0x523c[_0x40ba2b];return _0x916a9c;};'use strict';var _=require('lodash');var util=require(_0xc523('0x0'));var moment=require('moment');var BPromise=require(_0xc523('0x1'));var rs=require(_0xc523('0x2'));var fs=require('fs');var Redis=require(_0xc523('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc523('0x4'))(_0xc523('0x5'));var config=require(_0xc523('0x6'));var jayson=require(_0xc523('0x7'));var client=jayson[_0xc523('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x127258,_0x584b82,_0xee16c4){return new BPromise(function(_0x140e79,_0x3c4877){return client['request'](_0x127258,_0xee16c4)['then'](function(_0x4ea73d){logger[_0xc523('0x9')](_0xc523('0xa'),_0x584b82,_0xc523('0xb'));logger[_0xc523('0xc')](_0xc523('0xd'),_0x584b82,_0xc523('0xb'),JSON[_0xc523('0xe')](_0x4ea73d));if(_0x4ea73d['error']){if(_0x4ea73d[_0xc523('0xf')][_0xc523('0x10')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x584b82,_0x4ea73d[_0xc523('0xf')]['message']);return _0x3c4877(_0x4ea73d['error'][_0xc523('0x11')]);}logger[_0xc523('0xf')](_0xc523('0xa'),_0x584b82,_0x4ea73d[_0xc523('0xf')][_0xc523('0x11')]);return _0x140e79(_0x4ea73d['error'][_0xc523('0x11')]);}else{logger['info'](_0xc523('0xa'),_0x584b82,'request\x20sent');_0x140e79(_0x4ea73d['result'][_0xc523('0x11')]);}})['catch'](function(_0x4fb069){logger['error'](_0xc523('0xa'),_0x584b82,_0x4fb069);_0x3c4877(_0x4fb069);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index fdc2ef2..207f09c 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 _0x808a=['server/files/images/logos/','format','%s%s','extname','/:id/logo','single','file','addLogo','logologin','originalname','post','addLogoLogin','addPreferred','favicon','addFavicon','put','/:id','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','getDate','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x808a,0x121));var _0xa808=function(_0x123831,_0x8fe1d6){_0x123831=_0x123831-0x0;var _0x47455b=_0x808a[_0x123831];return _0x47455b;};'use strict';var multer=require('multer');var util=require(_0xa808('0x0'));var path=require(_0xa808('0x1'));var timeout=require(_0xa808('0x2'));var express=require(_0xa808('0x3'));var router=express[_0xa808('0x4')]();var fs_extra=require(_0xa808('0x5'));var auth=require(_0xa808('0x6'));var interaction=require(_0xa808('0x7'));var config=require(_0xa808('0x8'));var controller=require(_0xa808('0x9'));router[_0xa808('0xa')]('/',auth[_0xa808('0xb')](),controller[_0xa808('0xc')]);router[_0xa808('0xa')]('/now',controller[_0xa808('0xd')]);router[_0xa808('0xa')]('/:id',controller[_0xa808('0xe')]);router[_0xa808('0xa')]('/:id/logo',controller[_0xa808('0xf')]);router[_0xa808('0xa')](_0xa808('0x10'),controller[_0xa808('0x11')]);router[_0xa808('0xa')](_0xa808('0x12'),controller[_0xa808('0x13')]);router[_0xa808('0xa')](_0xa808('0x14'),controller['getPreferred']);router[_0xa808('0xa')](_0xa808('0x15'),controller[_0xa808('0x16')]);var upload=multer({'storage':multer[_0xa808('0x17')]({'destination':function(_0x2104e2,_0x37ccde,_0x270ec3){_0x270ec3(null,path[_0xa808('0x18')](config[_0xa808('0x19')],_0xa808('0x1a')));},'filename':function(_0x4d15d8,_0x4267dc,_0x2f629f){_0x2f629f(null,util[_0xa808('0x1b')](_0xa808('0x1c'),'logo',path[_0xa808('0x1d')](_0x4267dc['originalname'])));}})});router['post'](_0xa808('0x1e'),upload[_0xa808('0x1f')](_0xa808('0x20')),controller[_0xa808('0x21')]);var upload=multer({'storage':multer[_0xa808('0x17')]({'destination':function(_0x2dea01,_0xeac81c,_0x310227){_0x310227(null,path[_0xa808('0x18')](config[_0xa808('0x19')],_0xa808('0x1a')));},'filename':function(_0x325794,_0x5cca2d,_0xbaab32){_0xbaab32(null,util['format'](_0xa808('0x1c'),_0xa808('0x22'),path[_0xa808('0x1d')](_0x5cca2d[_0xa808('0x23')])));}})});router[_0xa808('0x24')](_0xa808('0x10'),upload['single'](_0xa808('0x20')),controller[_0xa808('0x25')]);var upload=multer({'storage':multer[_0xa808('0x17')]({'destination':function(_0x115aa6,_0x5f1584,_0x1146a1){_0x1146a1(null,path['join'](config[_0xa808('0x19')],_0xa808('0x1a')));},'filename':function(_0x4821ad,_0x5926d1,_0x289ecd){_0x289ecd(null,util[_0xa808('0x1b')](_0xa808('0x1c'),'preferred',path[_0xa808('0x1d')](_0x5926d1[_0xa808('0x23')])));}})});router[_0xa808('0x24')](_0xa808('0x14'),upload[_0xa808('0x1f')](_0xa808('0x20')),controller[_0xa808('0x26')]);var upload=multer({'storage':multer[_0xa808('0x17')]({'destination':function(_0x5ce0b6,_0x55df1d,_0x2268a9){_0x2268a9(null,path['join'](config[_0xa808('0x19')],'server/files/images/logos/'));},'filename':function(_0x450d05,_0x52f4a6,_0x3a8752){_0x3a8752(null,util[_0xa808('0x1b')](_0xa808('0x1c'),_0xa808('0x27'),path[_0xa808('0x1d')](_0x52f4a6[_0xa808('0x23')])));}})});router[_0xa808('0x24')](_0xa808('0x15'),upload[_0xa808('0x1f')](_0xa808('0x20')),controller[_0xa808('0x28')]);router[_0xa808('0x29')](_0xa808('0x2a'),auth[_0xa808('0xb')](),controller[_0xa808('0x2b')]);module[_0xa808('0x2c')]=router; \ No newline at end of file +var _0xd8fd=['logologin','single','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/preferred','getPreferred','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','/:id/logo','file','addLogo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8fd,0x183));var _0xdd8f=function(_0x3e8184,_0xf9bbe2){_0x3e8184=_0x3e8184-0x0;var _0x5ec397=_0xd8fd[_0x3e8184];return _0x5ec397;};'use strict';var multer=require(_0xdd8f('0x0'));var util=require(_0xdd8f('0x1'));var path=require(_0xdd8f('0x2'));var timeout=require('connect-timeout');var express=require(_0xdd8f('0x3'));var router=express[_0xdd8f('0x4')]();var fs_extra=require(_0xdd8f('0x5'));var auth=require(_0xdd8f('0x6'));var interaction=require(_0xdd8f('0x7'));var config=require(_0xdd8f('0x8'));var controller=require(_0xdd8f('0x9'));router[_0xdd8f('0xa')]('/',auth[_0xdd8f('0xb')](),controller['index']);router[_0xdd8f('0xa')]('/now',controller[_0xdd8f('0xc')]);router['get'](_0xdd8f('0xd'),controller[_0xdd8f('0xe')]);router[_0xdd8f('0xa')]('/:id/logo',controller[_0xdd8f('0xf')]);router[_0xdd8f('0xa')](_0xdd8f('0x10'),controller[_0xdd8f('0x11')]);router[_0xdd8f('0xa')]('/:id/gdpr',controller['gdpr']);router[_0xdd8f('0xa')](_0xdd8f('0x12'),controller[_0xdd8f('0x13')]);router[_0xdd8f('0xa')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0xdd8f('0x14')]({'destination':function(_0x54472c,_0x3fddd1,_0x411f73){_0x411f73(null,path[_0xdd8f('0x15')](config[_0xdd8f('0x16')],_0xdd8f('0x17')));},'filename':function(_0x583a85,_0x494bdb,_0x540368){_0x540368(null,util[_0xdd8f('0x18')](_0xdd8f('0x19'),_0xdd8f('0x1a'),path[_0xdd8f('0x1b')](_0x494bdb[_0xdd8f('0x1c')])));}})});router[_0xdd8f('0x1d')](_0xdd8f('0x1e'),upload['single'](_0xdd8f('0x1f')),controller[_0xdd8f('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5e7054,_0x26be01,_0x3cde72){_0x3cde72(null,path['join'](config[_0xdd8f('0x16')],_0xdd8f('0x17')));},'filename':function(_0x3310f5,_0x11c3eb,_0x2c4c71){_0x2c4c71(null,util[_0xdd8f('0x18')](_0xdd8f('0x19'),_0xdd8f('0x21'),path[_0xdd8f('0x1b')](_0x11c3eb['originalname'])));}})});router[_0xdd8f('0x1d')](_0xdd8f('0x10'),upload[_0xdd8f('0x22')](_0xdd8f('0x1f')),controller[_0xdd8f('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36f7f0,_0x45cc38,_0x325abf){_0x325abf(null,path[_0xdd8f('0x15')](config[_0xdd8f('0x16')],'server/files/images/logos/'));},'filename':function(_0x22f546,_0x4269b5,_0x1bbbbb){_0x1bbbbb(null,util[_0xdd8f('0x18')](_0xdd8f('0x19'),_0xdd8f('0x24'),path[_0xdd8f('0x1b')](_0x4269b5[_0xdd8f('0x1c')])));}})});router['post'](_0xdd8f('0x12'),upload['single'](_0xdd8f('0x1f')),controller[_0xdd8f('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1f6ec3,_0x4afa8f,_0x364e49){_0x364e49(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x29f5d4,_0x3d0175,_0xaef263){_0xaef263(null,util[_0xdd8f('0x18')]('%s%s',_0xdd8f('0x26'),path[_0xdd8f('0x1b')](_0x3d0175[_0xdd8f('0x1c')])));}})});router[_0xdd8f('0x1d')]('/:id/favicon',upload[_0xdd8f('0x22')](_0xdd8f('0x1f')),controller[_0xdd8f('0x27')]);router[_0xdd8f('0x28')](_0xdd8f('0xd'),auth[_0xdd8f('0xb')](),controller['update']);module[_0xdd8f('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 7480665..bf30fa0 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 _0x0204=['UNSIGNED','sequelize','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0x0204,0x91));var _0x4020=function(_0x57d884,_0x1f1027){_0x57d884=_0x57d884-0x0;var _0x13ee7e=_0x0204[_0x57d884];return _0x13ee7e;};'use strict';var Sequelize=require(_0x4020('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x4020('0x1')](0xb),'unique':_0x4020('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x4020('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x4020('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x4020('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x4020('0x4')]},'defaultLogo':{'type':Sequelize[_0x4020('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x4020('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x4020('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x4020('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x4020('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x4020('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x4020('0x4')]},'turnaddr':{'type':Sequelize[_0x4020('0x4')]},'turnusername':{'type':Sequelize[_0x4020('0x4')]},'turnpassword':{'type':Sequelize[_0x4020('0x4')]},'pageTitle':{'type':Sequelize[_0x4020('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x4020('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x4020('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x4020('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x4020('0x6')},'enableEmailPreview':{'type':Sequelize[_0x4020('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4020('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x4020('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x4020('0x4')],'defaultValue':_0x4020('0x7')},'chatTimeout':{'type':Sequelize[_0x4020('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4020('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x4020('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x4020('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x4020('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x4020('0x4')]},'defaultFavicon':{'type':Sequelize[_0x4020('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x4020('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x4020('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x4020('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x4020('0x4')]},'sentiment':{'type':Sequelize[_0x4020('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x4020('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x4020('0x1')]},'sentimentRegion':{'type':Sequelize[_0x4020('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4020('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x4020('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x4020('0x1')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x4020('0x1')](0x2)[_0x4020('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x4020('0x1')](0x2)[_0x4020('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x4020('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x4020('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x4020('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x4020('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x4020('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x4020('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x4020('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x4020('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x4020('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x4020('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x226a=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox'];(function(_0x5b6d34,_0x2a32a0){var _0x65eb46=function(_0x2fed53){while(--_0x2fed53){_0x5b6d34['push'](_0x5b6d34['shift']());}};_0x65eb46(++_0x2a32a0);}(_0x226a,0xe5));var _0xa226=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0x226a[_0x55e1d1];return _0x1165db;};'use strict';var Sequelize=require(_0xa226('0x0'));module[_0xa226('0x1')]={'min_internal':{'type':Sequelize[_0xa226('0x2')](0xb),'unique':_0xa226('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xa226('0x2')](0xb),'unique':_0xa226('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xa226('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xa226('0x5')],'defaultValue':_0xa226('0x6')},'logo':{'type':Sequelize[_0xa226('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xa226('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xa226('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xa226('0x5')]},'turnusername':{'type':Sequelize[_0xa226('0x5')]},'turnpassword':{'type':Sequelize[_0xa226('0x5')]},'pageTitle':{'type':Sequelize[_0xa226('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xa226('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xa226('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xa226('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xa226('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xa226('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xa226('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xa226('0x5')]},'defaultPreferred':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xa226('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xa226('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xa226('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa226('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa226('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xa226('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xa226('0x2')]},'sentimentRegion':{'type':Sequelize[_0xa226('0x5')]},'language':{'type':Sequelize[_0xa226('0x5')]},'bucket':{'type':Sequelize[_0xa226('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xa226('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xa226('0x2')](0x2)[_0xa226('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xa226('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xa226('0x2')](0x2)[_0xa226('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xa226('0x2')](0x2)[_0xa226('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xa226('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xa226('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xa226('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xa226('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xa226('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xa226('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xa226('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xa226('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xa226('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 67b16fa..6bae735 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 _0x8d57=['defaultLogo','defaultFavicon','upperFirst','gdpr','securePassword','addPreferred','getPreferred','server/files/images/logos','getLicense','preferred','default_preferred.png','addFavicon','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','merge','options','include','rows','show','params','keys','includeAll','find','body','file','filename','addLogoLogin','logo','loginLogo','favicon','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','download','getLogoLogin'];(function(_0x3ca5ab,_0x101c2a){var _0x13afb8=function(_0x4b64de){while(--_0x4b64de){_0x3ca5ab['push'](_0x3ca5ab['shift']());}};_0x13afb8(++_0x101c2a);}(_0x8d57,0xfe));var _0x78d5=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x8d57[_0x31cb5f];return _0x586042;};'use strict';var emlformat=require(_0x78d5('0x0'));var rimraf=require(_0x78d5('0x1'));var zipdir=require(_0x78d5('0x2'));var jsonpatch=require(_0x78d5('0x3'));var rp=require(_0x78d5('0x4'));var moment=require(_0x78d5('0x5'));var BPromise=require(_0x78d5('0x6'));var Mustache=require(_0x78d5('0x7'));var util=require(_0x78d5('0x8'));var path=require(_0x78d5('0x9'));var sox=require(_0x78d5('0xa'));var csv=require('to-csv');var ejs=require(_0x78d5('0xb'));var fs=require('fs');var fs_extra=require(_0x78d5('0xc'));var _=require(_0x78d5('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x78d5('0xe'));var deskjs=require(_0x78d5('0xf'));var toCsv=require(_0x78d5('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x78d5('0x11'));var authService=require(_0x78d5('0x12'));var qs=require(_0x78d5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78d5('0x14'));var logger=require(_0x78d5('0x15'))(_0x78d5('0x16'));var utils=require('../../config/utils');var config=require(_0x78d5('0x17'));var licenseUtil=require(_0x78d5('0x18'));var db=require(_0x78d5('0x19'))['db'];var jayson=require(_0x78d5('0x1a'));var client=jayson[_0x78d5('0x1b')][_0x78d5('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3870a4,_0x26203a,_0x4ce12c,_0x1f0501){return new BPromise(function(_0x100881,_0xc605f2){var _0x235b9b=_0x1f0501||client;return _0x235b9b[_0x78d5('0x1d')](_0x3870a4,_0x4ce12c)[_0x78d5('0x1e')](function(_0x2256c9){logger[_0x78d5('0x1f')](_0x78d5('0x20'),_0x26203a,'request\x20sent');logger[_0x78d5('0x21')]('Setting,\x20%s,\x20%s,\x20%s',_0x26203a,_0x78d5('0x22'),JSON[_0x78d5('0x23')](_0x2256c9));if(_0x2256c9[_0x78d5('0x24')]){if(_0x2256c9[_0x78d5('0x24')][_0x78d5('0x25')]===0x1f4){logger[_0x78d5('0x24')](_0x78d5('0x20'),_0x26203a,_0x2256c9['error'][_0x78d5('0x26')]);return _0xc605f2(_0x2256c9[_0x78d5('0x24')][_0x78d5('0x26')]);}logger[_0x78d5('0x24')]('Setting,\x20%s,\x20%s',_0x26203a,_0x2256c9[_0x78d5('0x24')][_0x78d5('0x26')]);return _0x100881(_0x2256c9[_0x78d5('0x24')][_0x78d5('0x26')]);}else{logger[_0x78d5('0x1f')](_0x78d5('0x20'),_0x26203a,_0x78d5('0x22'));_0x100881(_0x2256c9['result'][_0x78d5('0x26')]);}})[_0x78d5('0x27')](function(_0x47aa2d){logger[_0x78d5('0x24')](_0x78d5('0x20'),_0x26203a,_0x47aa2d);_0xc605f2(_0x47aa2d);});});}function respondWithStatusCode(_0x299af6,_0x3c57a8){_0x3c57a8=_0x3c57a8||0xcc;return function(_0x29355d){if(_0x29355d){return _0x299af6[_0x78d5('0x28')](_0x3c57a8);}return _0x299af6[_0x78d5('0x29')](_0x3c57a8)[_0x78d5('0x2a')]();};}function respondWithResult(_0xe21692,_0x4e4389){_0x4e4389=_0x4e4389||0xc8;return function(_0x535778){if(_0x535778){return _0xe21692[_0x78d5('0x29')](_0x4e4389)['json'](_0x535778);}};}function respondWithFilteredResult(_0x2f3f4b,_0x1ea291){return function(_0x185c4a){if(_0x185c4a){var _0x35a0d9=typeof _0x1ea291[_0x78d5('0x2b')]===_0x78d5('0x2c')&&typeof _0x1ea291[_0x78d5('0x2d')]===_0x78d5('0x2c');var _0xc06146=_0x185c4a[_0x78d5('0x2e')];var _0x27df38=_0x35a0d9?0x0:_0x1ea291[_0x78d5('0x2b')];var _0x24b4ef=_0x35a0d9?_0x185c4a[_0x78d5('0x2e')]:_0x1ea291['offset']+_0x1ea291[_0x78d5('0x2d')];var _0x46cd34;if(_0x24b4ef>=_0xc06146){_0x24b4ef=_0xc06146;_0x46cd34=0xc8;}else{_0x46cd34=0xce;}_0x2f3f4b[_0x78d5('0x29')](_0x46cd34);return _0x2f3f4b['set']('Content-Range',_0x27df38+'-'+_0x24b4ef+'/'+_0xc06146)[_0x78d5('0x2f')](_0x185c4a);}return null;};}function patchUpdates(_0x137e2f){return function(_0x13c7c2){try{jsonpatch[_0x78d5('0x30')](_0x13c7c2,_0x137e2f,!![]);}catch(_0x5263aa){return BPromise[_0x78d5('0x31')](_0x5263aa);}return _0x13c7c2[_0x78d5('0x32')]();};}function saveUpdates(_0x22988e,_0x3997d8){return function(_0x50c08c){if(_0x50c08c){return _0x50c08c[_0x78d5('0x33')](_0x22988e)[_0x78d5('0x1e')](function(_0x42f481){return _0x42f481;});}return null;};}function removeEntity(_0xc6373e,_0x1a8776){return function(_0x25166e){if(_0x25166e){return _0x25166e['destroy']()['then'](function(){_0xc6373e[_0x78d5('0x29')](0xcc)[_0x78d5('0x2a')]();});}};}function handleEntityNotFound(_0x523bd8,_0x3749ea){return function(_0x5baef1){if(!_0x5baef1){_0x523bd8[_0x78d5('0x28')](0x194);}return _0x5baef1;};}function handleError(_0x15934f,_0x39b6c6){_0x39b6c6=_0x39b6c6||0x1f4;return function(_0x436997){logger['error'](_0x436997[_0x78d5('0x34')]);if(_0x436997[_0x78d5('0x35')]){delete _0x436997[_0x78d5('0x35')];}_0x15934f['status'](_0x39b6c6)[_0x78d5('0x36')](_0x436997);};}exports['index']=function(_0x3d6a60,_0x43135c){var _0x16b81f={},_0x571f32={},_0x30a4ad={'count':0x0,'rows':[]};var _0x448aaa=_[_0x78d5('0x37')](db[_0x78d5('0x38')][_0x78d5('0x39')],function(_0x2cfe1f){return{'name':_0x2cfe1f[_0x78d5('0x3a')],'type':_0x2cfe1f[_0x78d5('0x3b')][_0x78d5('0x3c')]};});_0x571f32[_0x78d5('0x3d')]=_[_0x78d5('0x37')](_0x448aaa,_0x78d5('0x35'));_0x571f32[_0x78d5('0x3e')]=_['keys'](_0x3d6a60[_0x78d5('0x3e')]);_0x571f32['filters']=_[_0x78d5('0x3f')](_0x571f32[_0x78d5('0x3d')],_0x571f32[_0x78d5('0x3e')]);_0x16b81f['attributes']=_[_0x78d5('0x3f')](_0x571f32[_0x78d5('0x3d')],qs[_0x78d5('0x40')](_0x3d6a60[_0x78d5('0x3e')][_0x78d5('0x40')]));_0x16b81f[_0x78d5('0x41')]=_0x16b81f[_0x78d5('0x41')]['length']?_0x16b81f[_0x78d5('0x41')]:_0x571f32['model'];if(!_0x3d6a60[_0x78d5('0x3e')][_0x78d5('0x42')](_0x78d5('0x43'))){_0x16b81f[_0x78d5('0x2d')]=qs['limit'](_0x3d6a60['query']['limit']);_0x16b81f[_0x78d5('0x2b')]=qs[_0x78d5('0x2b')](_0x3d6a60[_0x78d5('0x3e')][_0x78d5('0x2b')]);}_0x16b81f[_0x78d5('0x44')]=qs['sort'](_0x3d6a60['query']['sort']);_0x16b81f[_0x78d5('0x45')]=qs[_0x78d5('0x46')](_[_0x78d5('0x47')](_0x3d6a60['query'],_0x571f32[_0x78d5('0x46')]),_0x448aaa);if(_0x3d6a60['query'][_0x78d5('0x48')]){_0x16b81f[_0x78d5('0x45')]=_['merge'](_0x16b81f[_0x78d5('0x45')],{'$or':_[_0x78d5('0x37')](_0x448aaa,function(_0x5931a2){if(_0x5931a2['type']!==_0x78d5('0x49')){var _0xbacb5f={};_0xbacb5f[_0x5931a2[_0x78d5('0x35')]]={'$like':'%'+_0x3d6a60[_0x78d5('0x3e')]['filter']+'%'};return _0xbacb5f;}})});}_0x16b81f=_[_0x78d5('0x4a')]({},_0x16b81f,_0x3d6a60[_0x78d5('0x4b')]);var _0x23762a={'where':_0x16b81f[_0x78d5('0x45')]};return db[_0x78d5('0x38')][_0x78d5('0x2e')](_0x23762a)[_0x78d5('0x1e')](function(_0x1adfe6){_0x30a4ad[_0x78d5('0x2e')]=_0x1adfe6;if(_0x3d6a60[_0x78d5('0x3e')]['includeAll']){_0x16b81f[_0x78d5('0x4c')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x16b81f);})[_0x78d5('0x1e')](function(_0x238961){_0x30a4ad[_0x78d5('0x4d')]=_0x238961;return _0x30a4ad;})[_0x78d5('0x1e')](respondWithFilteredResult(_0x43135c,_0x16b81f))['catch'](handleError(_0x43135c,null));};exports[_0x78d5('0x4e')]=function(_0xb037b8,_0x1a8194){var _0x5c1e21={'raw':![],'where':{'id':_0xb037b8[_0x78d5('0x4f')]['id']}},_0x16d214={};_0x16d214[_0x78d5('0x3d')]=_[_0x78d5('0x50')](db['Setting'][_0x78d5('0x39')]);_0x16d214['query']=_[_0x78d5('0x50')](_0xb037b8['query']);_0x16d214[_0x78d5('0x46')]=_[_0x78d5('0x3f')](_0x16d214[_0x78d5('0x3d')],_0x16d214[_0x78d5('0x3e')]);_0x5c1e21[_0x78d5('0x41')]=_[_0x78d5('0x3f')](_0x16d214[_0x78d5('0x3d')],qs[_0x78d5('0x40')](_0xb037b8['query'][_0x78d5('0x40')]));_0x5c1e21[_0x78d5('0x41')]=_0x5c1e21[_0x78d5('0x41')]['length']?_0x5c1e21[_0x78d5('0x41')]:_0x16d214[_0x78d5('0x3d')];if(_0xb037b8[_0x78d5('0x3e')][_0x78d5('0x51')]){_0x5c1e21[_0x78d5('0x4c')]=[{'all':!![]}];}_0x5c1e21=_['merge']({},_0x5c1e21,_0xb037b8[_0x78d5('0x4b')]);return db[_0x78d5('0x38')][_0x78d5('0x52')](_0x5c1e21)['then'](handleEntityNotFound(_0x1a8194,null))[_0x78d5('0x1e')](respondWithResult(_0x1a8194,null))[_0x78d5('0x27')](handleError(_0x1a8194,null));};exports[_0x78d5('0x33')]=function(_0x576bb5,_0x4041fd){if(_0x576bb5[_0x78d5('0x53')]['id']){delete _0x576bb5[_0x78d5('0x53')]['id'];}return db[_0x78d5('0x38')][_0x78d5('0x52')]({'where':{'id':_0x576bb5[_0x78d5('0x4f')]['id']}})[_0x78d5('0x1e')](handleEntityNotFound(_0x4041fd,null))[_0x78d5('0x1e')](saveUpdates(_0x576bb5[_0x78d5('0x53')],null))[_0x78d5('0x1e')](respondWithResult(_0x4041fd,null))[_0x78d5('0x27')](handleError(_0x4041fd,null));};exports['addLogo']=function(_0x550245,_0x506240,_0x517526){if(_0x550245[_0x78d5('0x54')]&&_0x550245['file'][_0x78d5('0x55')]){_0x550245[_0x78d5('0x53')]['logo']=_0x550245[_0x78d5('0x54')][_0x78d5('0x55')];}return db['Setting'][_0x78d5('0x52')]({'where':{'id':_0x550245[_0x78d5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x506240,null))[_0x78d5('0x1e')](saveUpdates(_0x550245[_0x78d5('0x53')],null))[_0x78d5('0x1e')](respondWithResult(_0x506240,null))[_0x78d5('0x27')](handleError(_0x506240,null));};exports[_0x78d5('0x56')]=function(_0x327d60,_0x24217d,_0x111ae4){if(_0x327d60[_0x78d5('0x54')]&&_0x327d60[_0x78d5('0x54')]['filename']){_0x327d60[_0x78d5('0x53')]['loginLogo']=_0x327d60[_0x78d5('0x54')][_0x78d5('0x55')];}return db[_0x78d5('0x38')][_0x78d5('0x52')]({'where':{'id':_0x327d60[_0x78d5('0x4f')]['id']}})[_0x78d5('0x1e')](handleEntityNotFound(_0x24217d,null))[_0x78d5('0x1e')](saveUpdates(_0x327d60['body'],null))[_0x78d5('0x1e')](respondWithResult(_0x24217d,null))[_0x78d5('0x27')](handleError(_0x24217d,null));};var utilLicense=require(_0x78d5('0x18'));exports['getLogo']=function(_0x5b892d,_0x33c556,_0x3330d3){var _0x2946ee='server/files/images/logos';var _0xea0561={'custom':![]};return utilLicense['getLicense']()[_0x78d5('0x1e')](function(_0x1f3b01){if(_0x1f3b01){_0xea0561=_0x1f3b01;}return db[_0x78d5('0x38')][_0x78d5('0x52')]({'where':{'id':_0x5b892d[_0x78d5('0x4f')]['id']},'attributes':[_0x78d5('0x57'),_0x78d5('0x58'),'preferred',_0x78d5('0x59'),'defaultLogo',_0x78d5('0x5a'),_0x78d5('0x5b'),'defaultFavicon'],'raw':!![]});})[_0x78d5('0x1e')](handleEntityNotFound(_0x33c556,null))[_0x78d5('0x1e')](function(_0x19953c){if(_0x19953c){var _0x356aad=_0x19953c[_0x78d5('0x57')]&&fs[_0x78d5('0x5c')](path[_0x78d5('0x5d')](config[_0x78d5('0x5e')],_0x2946ee,_[_0x78d5('0x5f')](_0x19953c['logo'])))?path[_0x78d5('0x5d')](config[_0x78d5('0x5e')],_0x2946ee,_[_0x78d5('0x5f')](_0x19953c['logo'])):path[_0x78d5('0x5d')](config['root'],_0x2946ee,_[_0x78d5('0x5f')](_0x78d5('0x60')));var _0x389a6d=_0x78d5('0x61')+_['upperFirst'](_0x78d5('0x57'));if(_0x19953c[_0x389a6d]||!_0xea0561[_0x78d5('0x62')]){_0x356aad=path['join'](config[_0x78d5('0x5e')],_0x2946ee,_[_0x78d5('0x5f')](_0x78d5('0x60')));}if(!fs['existsSync'](_0x356aad)){throw new db[(_0x78d5('0x63'))][(_0x78d5('0x64'))](_['upperFirst'](_0x78d5('0x57'))+'\x20not\x20found');}return _0x33c556[_0x78d5('0x65')](_0x356aad);}})[_0x78d5('0x27')](handleError(_0x33c556,null));};var utilLicense=require('../../config/license/util');exports[_0x78d5('0x66')]=function(_0x315e0c,_0x3c0528,_0x94db21){var _0x183afe='server/files/images/logos';var _0x49546f={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xba5dc3){if(_0xba5dc3){_0x49546f=_0xba5dc3;}return db[_0x78d5('0x38')][_0x78d5('0x52')]({'where':{'id':_0x315e0c['params']['id']},'attributes':[_0x78d5('0x57'),_0x78d5('0x58'),'preferred',_0x78d5('0x59'),_0x78d5('0x67'),_0x78d5('0x5a'),_0x78d5('0x5b'),_0x78d5('0x68')],'raw':!![]});})[_0x78d5('0x1e')](handleEntityNotFound(_0x3c0528,null))[_0x78d5('0x1e')](function(_0x2aa03d){if(_0x2aa03d){var _0x1a22c2=_0x2aa03d[_0x78d5('0x58')]&&fs[_0x78d5('0x5c')](path[_0x78d5('0x5d')](config[_0x78d5('0x5e')],_0x183afe,_[_0x78d5('0x5f')](_0x2aa03d['loginLogo'])))?path[_0x78d5('0x5d')](config['root'],_0x183afe,_[_0x78d5('0x5f')](_0x2aa03d['loginLogo'])):path[_0x78d5('0x5d')](config[_0x78d5('0x5e')],_0x183afe,_[_0x78d5('0x5f')]('default_loginLogo.svg'));var _0x51b225=_0x78d5('0x61')+_[_0x78d5('0x69')](_0x78d5('0x58'));if(_0x2aa03d[_0x51b225]||!_0x49546f[_0x78d5('0x62')]){_0x1a22c2=path[_0x78d5('0x5d')](config[_0x78d5('0x5e')],_0x183afe,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x78d5('0x5c')](_0x1a22c2)){throw new db[(_0x78d5('0x63'))][(_0x78d5('0x64'))](_[_0x78d5('0x69')](_0x78d5('0x58'))+'\x20not\x20found');}return _0x3c0528[_0x78d5('0x65')](_0x1a22c2);}})['catch'](handleError(_0x3c0528,null));};exports[_0x78d5('0x6a')]=function(_0x292017,_0x52a1a0){return db[_0x78d5('0x38')][_0x78d5('0x52')]({'where':{'id':_0x292017[_0x78d5('0x4f')]['id']},'attributes':[_0x78d5('0x6b')]})[_0x78d5('0x1e')](respondWithResult(_0x52a1a0,null))[_0x78d5('0x27')](handleError(_0x52a1a0,null));};exports[_0x78d5('0x6c')]=function(_0x2229b7,_0x2a7f93,_0x170ebb){if(_0x2229b7[_0x78d5('0x54')]&&_0x2229b7[_0x78d5('0x54')][_0x78d5('0x55')]){_0x2229b7[_0x78d5('0x53')]['preferred']=_0x2229b7[_0x78d5('0x54')]['filename'];}return db[_0x78d5('0x38')][_0x78d5('0x52')]({'where':{'id':_0x2229b7[_0x78d5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2a7f93,null))[_0x78d5('0x1e')](saveUpdates(_0x2229b7['body'],null))[_0x78d5('0x1e')](respondWithResult(_0x2a7f93,null))['catch'](handleError(_0x2a7f93,null));};var utilLicense=require(_0x78d5('0x18'));exports[_0x78d5('0x6d')]=function(_0x42e40f,_0x1709c2,_0x3ea1b4){var _0x12d422=_0x78d5('0x6e');var _0x4a0891={'custom':![]};return utilLicense[_0x78d5('0x6f')]()[_0x78d5('0x1e')](function(_0x126fd3){if(_0x126fd3){_0x4a0891=_0x126fd3;}return db['Setting'][_0x78d5('0x52')]({'where':{'id':_0x42e40f[_0x78d5('0x4f')]['id']},'attributes':[_0x78d5('0x57'),_0x78d5('0x58'),'preferred','favicon',_0x78d5('0x67'),_0x78d5('0x5a'),_0x78d5('0x5b'),_0x78d5('0x68')],'raw':!![]});})[_0x78d5('0x1e')](handleEntityNotFound(_0x1709c2,null))[_0x78d5('0x1e')](function(_0x106855){if(_0x106855){var _0x50a6ef=_0x106855[_0x78d5('0x70')]&&fs[_0x78d5('0x5c')](path[_0x78d5('0x5d')](config[_0x78d5('0x5e')],_0x12d422,_[_0x78d5('0x5f')](_0x106855[_0x78d5('0x70')])))?path[_0x78d5('0x5d')](config['root'],_0x12d422,_[_0x78d5('0x5f')](_0x106855[_0x78d5('0x70')])):path['join'](config['root'],_0x12d422,_[_0x78d5('0x5f')]('default_preferred.png'));var _0x117212='default'+_['upperFirst']('preferred');if(_0x106855[_0x117212]||!_0x4a0891[_0x78d5('0x62')]||!_0x4a0891[_0x78d5('0x70')]){_0x50a6ef=path[_0x78d5('0x5d')](config[_0x78d5('0x5e')],_0x12d422,_[_0x78d5('0x5f')](_0x78d5('0x71')));}if(!fs[_0x78d5('0x5c')](_0x50a6ef)){throw new db[(_0x78d5('0x63'))][(_0x78d5('0x64'))](_[_0x78d5('0x69')](_0x78d5('0x70'))+'\x20not\x20found');}return _0x1709c2['download'](_0x50a6ef);}})[_0x78d5('0x27')](handleError(_0x1709c2,null));};exports[_0x78d5('0x72')]=function(_0x506f29,_0x4bf511,_0x514296){if(_0x506f29['file']&&_0x506f29['file'][_0x78d5('0x55')]){_0x506f29[_0x78d5('0x53')]['favicon']=_0x506f29[_0x78d5('0x54')]['filename'];}return db[_0x78d5('0x38')][_0x78d5('0x52')]({'where':{'id':_0x506f29['params']['id']}})[_0x78d5('0x1e')](handleEntityNotFound(_0x4bf511,null))[_0x78d5('0x1e')](saveUpdates(_0x506f29['body'],null))['then'](respondWithResult(_0x4bf511,null))['catch'](handleError(_0x4bf511,null));};var utilLicense=require(_0x78d5('0x18'));exports['getFavicon']=function(_0x27059e,_0x3816f6,_0x5694db){var _0x30249b=_0x78d5('0x6e');var _0x3cbf86={'custom':![]};return utilLicense[_0x78d5('0x6f')]()[_0x78d5('0x1e')](function(_0x24bc14){if(_0x24bc14){_0x3cbf86=_0x24bc14;}return db['Setting']['find']({'where':{'id':_0x27059e['params']['id']},'attributes':[_0x78d5('0x57'),'loginLogo',_0x78d5('0x70'),_0x78d5('0x59'),_0x78d5('0x67'),'defaultLoginLogo',_0x78d5('0x5b'),'defaultFavicon'],'raw':!![]});})[_0x78d5('0x1e')](handleEntityNotFound(_0x3816f6,null))[_0x78d5('0x1e')](function(_0x424f8c){if(_0x424f8c){var _0x4e182f=_0x424f8c[_0x78d5('0x59')]&&fs[_0x78d5('0x5c')](path[_0x78d5('0x5d')](config[_0x78d5('0x5e')],_0x30249b,_[_0x78d5('0x5f')](_0x424f8c['favicon'])))?path[_0x78d5('0x5d')](config[_0x78d5('0x5e')],_0x30249b,_[_0x78d5('0x5f')](_0x424f8c[_0x78d5('0x59')])):path[_0x78d5('0x5d')](config[_0x78d5('0x5e')],_0x30249b,_['toLower']('default_favicon.ico'));var _0x3ff077=_0x78d5('0x61')+_[_0x78d5('0x69')]('favicon');if(_0x424f8c[_0x3ff077]||!_0x3cbf86[_0x78d5('0x62')]){_0x4e182f=path[_0x78d5('0x5d')](config['root'],_0x30249b,_[_0x78d5('0x5f')]('default_favicon.ico'));}if(!fs[_0x78d5('0x5c')](_0x4e182f)){throw new db[(_0x78d5('0x63'))][(_0x78d5('0x64'))](_[_0x78d5('0x69')](_0x78d5('0x59'))+'\x20not\x20found');}return _0x3816f6[_0x78d5('0x65')](_0x4e182f);}})['catch'](handleError(_0x3816f6,null));};exports['getDate']=function(_0x52aab3,_0x1c7ff2){var _0x58a006={'offset':moment()[_0x78d5('0x73')]()};_0x58a006[_0x78d5('0x74')]=moment()[_0x78d5('0x73')](_0x58a006[_0x78d5('0x2b')])[_0x78d5('0x75')](_0x78d5('0x76'));return _0x1c7ff2['status'](0xc8)[_0x78d5('0x36')](_0x58a006);}; \ No newline at end of file +var _0x440f=['default_preferred.png','Sequelize','getFavicon','default_favicon.ico','getDate','utcOffset','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','body','find','file','filename','logo','addLogoLogin','../../config/license/util','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','download','addPreferred','getPreferred','favicon'];(function(_0x4143cf,_0x2290c1){var _0x549882=function(_0x49003c){while(--_0x49003c){_0x4143cf['push'](_0x4143cf['shift']());}};_0x549882(++_0x2290c1);}(_0x440f,0xfc));var _0xf440=function(_0x4b4c14,_0x2cdef9){_0x4b4c14=_0x4b4c14-0x0;var _0xf9f60d=_0x440f[_0x4b4c14];return _0xf9f60d;};'use strict';var emlformat=require(_0xf440('0x0'));var rimraf=require(_0xf440('0x1'));var zipdir=require(_0xf440('0x2'));var jsonpatch=require(_0xf440('0x3'));var rp=require(_0xf440('0x4'));var moment=require(_0xf440('0x5'));var BPromise=require(_0xf440('0x6'));var Mustache=require(_0xf440('0x7'));var util=require(_0xf440('0x8'));var path=require(_0xf440('0x9'));var sox=require('sox');var csv=require(_0xf440('0xa'));var ejs=require(_0xf440('0xb'));var fs=require('fs');var fs_extra=require(_0xf440('0xc'));var _=require(_0xf440('0xd'));var squel=require(_0xf440('0xe'));var crypto=require('crypto');var jsforce=require(_0xf440('0xf'));var deskjs=require(_0xf440('0x10'));var toCsv=require(_0xf440('0xa'));var querystring=require(_0xf440('0x11'));var Papa=require('papaparse');var Redis=require(_0xf440('0x12'));var authService=require(_0xf440('0x13'));var qs=require(_0xf440('0x14'));var as=require(_0xf440('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf440('0x16'));var utils=require(_0xf440('0x17'));var config=require(_0xf440('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf440('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf440('0x1a')][_0xf440('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x44f125,_0x49d834,_0xd4e921,_0x99a961){return new BPromise(function(_0x28962b,_0x2d1c23){var _0x14474c=_0x99a961||client;return _0x14474c[_0xf440('0x1c')](_0x44f125,_0xd4e921)['then'](function(_0x3a8a8c){logger[_0xf440('0x1d')](_0xf440('0x1e'),_0x49d834,_0xf440('0x1f'));logger[_0xf440('0x20')](_0xf440('0x21'),_0x49d834,_0xf440('0x1f'),JSON['stringify'](_0x3a8a8c));if(_0x3a8a8c['error']){if(_0x3a8a8c[_0xf440('0x22')][_0xf440('0x23')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x49d834,_0x3a8a8c['error'][_0xf440('0x24')]);return _0x2d1c23(_0x3a8a8c['error'][_0xf440('0x24')]);}logger['error']('Setting,\x20%s,\x20%s',_0x49d834,_0x3a8a8c['error'][_0xf440('0x24')]);return _0x28962b(_0x3a8a8c['error'][_0xf440('0x24')]);}else{logger[_0xf440('0x1d')](_0xf440('0x1e'),_0x49d834,'request\x20sent');_0x28962b(_0x3a8a8c[_0xf440('0x25')][_0xf440('0x24')]);}})['catch'](function(_0x37e97e){logger[_0xf440('0x22')](_0xf440('0x1e'),_0x49d834,_0x37e97e);_0x2d1c23(_0x37e97e);});});}function respondWithStatusCode(_0x6932d5,_0x288c26){_0x288c26=_0x288c26||0xcc;return function(_0x56d51d){if(_0x56d51d){return _0x6932d5[_0xf440('0x26')](_0x288c26);}return _0x6932d5['status'](_0x288c26)[_0xf440('0x27')]();};}function respondWithResult(_0x5745cb,_0x288de3){_0x288de3=_0x288de3||0xc8;return function(_0xc73626){if(_0xc73626){return _0x5745cb[_0xf440('0x28')](_0x288de3)[_0xf440('0x29')](_0xc73626);}};}function respondWithFilteredResult(_0x3de6e7,_0x13f114){return function(_0x3ca108){if(_0x3ca108){var _0x70463d=typeof _0x13f114[_0xf440('0x2a')]===_0xf440('0x2b')&&typeof _0x13f114[_0xf440('0x2c')]==='undefined';var _0x27d488=_0x3ca108[_0xf440('0x2d')];var _0x20ab54=_0x70463d?0x0:_0x13f114[_0xf440('0x2a')];var _0x38f609=_0x70463d?_0x3ca108['count']:_0x13f114['offset']+_0x13f114[_0xf440('0x2c')];var _0xa64bba;if(_0x38f609>=_0x27d488){_0x38f609=_0x27d488;_0xa64bba=0xc8;}else{_0xa64bba=0xce;}_0x3de6e7[_0xf440('0x28')](_0xa64bba);return _0x3de6e7[_0xf440('0x2e')](_0xf440('0x2f'),_0x20ab54+'-'+_0x38f609+'/'+_0x27d488)['json'](_0x3ca108);}return null;};}function patchUpdates(_0x51aa49){return function(_0x4dd2ff){try{jsonpatch['apply'](_0x4dd2ff,_0x51aa49,!![]);}catch(_0x5d202e){return BPromise[_0xf440('0x30')](_0x5d202e);}return _0x4dd2ff[_0xf440('0x31')]();};}function saveUpdates(_0x271918,_0x5825e){return function(_0x4d7140){if(_0x4d7140){return _0x4d7140[_0xf440('0x32')](_0x271918)[_0xf440('0x33')](function(_0x3fab46){return _0x3fab46;});}return null;};}function removeEntity(_0x462269,_0x1296e3){return function(_0x579e78){if(_0x579e78){return _0x579e78[_0xf440('0x34')]()[_0xf440('0x33')](function(){_0x462269['status'](0xcc)[_0xf440('0x27')]();});}};}function handleEntityNotFound(_0x349a70,_0x4e5182){return function(_0x5a131b){if(!_0x5a131b){_0x349a70['sendStatus'](0x194);}return _0x5a131b;};}function handleError(_0x1d5784,_0x4f4a23){_0x4f4a23=_0x4f4a23||0x1f4;return function(_0x99ce0d){logger[_0xf440('0x22')](_0x99ce0d[_0xf440('0x35')]);if(_0x99ce0d[_0xf440('0x36')]){delete _0x99ce0d[_0xf440('0x36')];}_0x1d5784[_0xf440('0x28')](_0x4f4a23)[_0xf440('0x37')](_0x99ce0d);};}exports[_0xf440('0x38')]=function(_0x5d0413,_0x382cec){var _0x5b6a5f={},_0x15b6f5={},_0x59ca01={'count':0x0,'rows':[]};var _0x2ec624=_[_0xf440('0x39')](db[_0xf440('0x3a')][_0xf440('0x3b')],function(_0x1fb63e){return{'name':_0x1fb63e[_0xf440('0x3c')],'type':_0x1fb63e[_0xf440('0x3d')][_0xf440('0x3e')]};});_0x15b6f5[_0xf440('0x3f')]=_[_0xf440('0x39')](_0x2ec624,_0xf440('0x36'));_0x15b6f5[_0xf440('0x40')]=_[_0xf440('0x41')](_0x5d0413[_0xf440('0x40')]);_0x15b6f5[_0xf440('0x42')]=_['intersection'](_0x15b6f5[_0xf440('0x3f')],_0x15b6f5[_0xf440('0x40')]);_0x5b6a5f[_0xf440('0x43')]=_[_0xf440('0x44')](_0x15b6f5['model'],qs['fields'](_0x5d0413[_0xf440('0x40')][_0xf440('0x45')]));_0x5b6a5f[_0xf440('0x43')]=_0x5b6a5f[_0xf440('0x43')]['length']?_0x5b6a5f[_0xf440('0x43')]:_0x15b6f5[_0xf440('0x3f')];if(!_0x5d0413['query'][_0xf440('0x46')](_0xf440('0x47'))){_0x5b6a5f[_0xf440('0x2c')]=qs[_0xf440('0x2c')](_0x5d0413['query']['limit']);_0x5b6a5f[_0xf440('0x2a')]=qs['offset'](_0x5d0413[_0xf440('0x40')][_0xf440('0x2a')]);}_0x5b6a5f[_0xf440('0x48')]=qs[_0xf440('0x49')](_0x5d0413[_0xf440('0x40')]['sort']);_0x5b6a5f['where']=qs[_0xf440('0x42')](_[_0xf440('0x4a')](_0x5d0413[_0xf440('0x40')],_0x15b6f5[_0xf440('0x42')]),_0x2ec624);if(_0x5d0413[_0xf440('0x40')][_0xf440('0x4b')]){_0x5b6a5f[_0xf440('0x4c')]=_[_0xf440('0x4d')](_0x5b6a5f[_0xf440('0x4c')],{'$or':_[_0xf440('0x39')](_0x2ec624,function(_0x544a07){if(_0x544a07[_0xf440('0x3d')]!==_0xf440('0x4e')){var _0x444f08={};_0x444f08[_0x544a07[_0xf440('0x36')]]={'$like':'%'+_0x5d0413[_0xf440('0x40')]['filter']+'%'};return _0x444f08;}})});}_0x5b6a5f=_['merge']({},_0x5b6a5f,_0x5d0413[_0xf440('0x4f')]);var _0x2cea30={'where':_0x5b6a5f[_0xf440('0x4c')]};return db[_0xf440('0x3a')][_0xf440('0x2d')](_0x2cea30)[_0xf440('0x33')](function(_0xf99ce5){_0x59ca01[_0xf440('0x2d')]=_0xf99ce5;if(_0x5d0413[_0xf440('0x40')][_0xf440('0x50')]){_0x5b6a5f[_0xf440('0x51')]=[{'all':!![]}];}return db[_0xf440('0x3a')]['findAll'](_0x5b6a5f);})[_0xf440('0x33')](function(_0x1f7aec){_0x59ca01[_0xf440('0x52')]=_0x1f7aec;return _0x59ca01;})['then'](respondWithFilteredResult(_0x382cec,_0x5b6a5f))[_0xf440('0x53')](handleError(_0x382cec,null));};exports[_0xf440('0x54')]=function(_0x18995b,_0x9f2304){var _0x585e11={'raw':![],'where':{'id':_0x18995b[_0xf440('0x55')]['id']}},_0x2a9182={};_0x2a9182[_0xf440('0x3f')]=_[_0xf440('0x41')](db['Setting'][_0xf440('0x3b')]);_0x2a9182[_0xf440('0x40')]=_[_0xf440('0x41')](_0x18995b[_0xf440('0x40')]);_0x2a9182[_0xf440('0x42')]=_[_0xf440('0x44')](_0x2a9182[_0xf440('0x3f')],_0x2a9182[_0xf440('0x40')]);_0x585e11[_0xf440('0x43')]=_[_0xf440('0x44')](_0x2a9182[_0xf440('0x3f')],qs[_0xf440('0x45')](_0x18995b[_0xf440('0x40')][_0xf440('0x45')]));_0x585e11[_0xf440('0x43')]=_0x585e11['attributes'][_0xf440('0x56')]?_0x585e11['attributes']:_0x2a9182[_0xf440('0x3f')];if(_0x18995b['query']['includeAll']){_0x585e11[_0xf440('0x51')]=[{'all':!![]}];}_0x585e11=_[_0xf440('0x4d')]({},_0x585e11,_0x18995b[_0xf440('0x4f')]);return db[_0xf440('0x3a')]['find'](_0x585e11)['then'](handleEntityNotFound(_0x9f2304,null))['then'](respondWithResult(_0x9f2304,null))[_0xf440('0x53')](handleError(_0x9f2304,null));};exports[_0xf440('0x32')]=function(_0x3cd471,_0x2138b8){if(_0x3cd471['body']['id']){delete _0x3cd471[_0xf440('0x57')]['id'];}return db[_0xf440('0x3a')][_0xf440('0x58')]({'where':{'id':_0x3cd471[_0xf440('0x55')]['id']}})[_0xf440('0x33')](handleEntityNotFound(_0x2138b8,null))[_0xf440('0x33')](saveUpdates(_0x3cd471[_0xf440('0x57')],null))[_0xf440('0x33')](respondWithResult(_0x2138b8,null))['catch'](handleError(_0x2138b8,null));};exports['addLogo']=function(_0x3e45ef,_0x75a17,_0x469791){if(_0x3e45ef[_0xf440('0x59')]&&_0x3e45ef['file'][_0xf440('0x5a')]){_0x3e45ef[_0xf440('0x57')][_0xf440('0x5b')]=_0x3e45ef['file'][_0xf440('0x5a')];}return db['Setting'][_0xf440('0x58')]({'where':{'id':_0x3e45ef['params']['id']}})['then'](handleEntityNotFound(_0x75a17,null))[_0xf440('0x33')](saveUpdates(_0x3e45ef[_0xf440('0x57')],null))[_0xf440('0x33')](respondWithResult(_0x75a17,null))[_0xf440('0x53')](handleError(_0x75a17,null));};exports[_0xf440('0x5c')]=function(_0x1773e4,_0x1b8298,_0x7cf0){if(_0x1773e4['file']&&_0x1773e4['file']['filename']){_0x1773e4[_0xf440('0x57')]['loginLogo']=_0x1773e4[_0xf440('0x59')][_0xf440('0x5a')];}return db[_0xf440('0x3a')][_0xf440('0x58')]({'where':{'id':_0x1773e4[_0xf440('0x55')]['id']}})[_0xf440('0x33')](handleEntityNotFound(_0x1b8298,null))[_0xf440('0x33')](saveUpdates(_0x1773e4[_0xf440('0x57')],null))['then'](respondWithResult(_0x1b8298,null))['catch'](handleError(_0x1b8298,null));};var utilLicense=require(_0xf440('0x5d'));exports[_0xf440('0x5e')]=function(_0x516b0a,_0x322ea5,_0x521cd7){var _0x1af22a=_0xf440('0x5f');var _0x8ffd83={'custom':![]};return utilLicense[_0xf440('0x60')]()['then'](function(_0x17c239){if(_0x17c239){_0x8ffd83=_0x17c239;}return db[_0xf440('0x3a')][_0xf440('0x58')]({'where':{'id':_0x516b0a[_0xf440('0x55')]['id']},'attributes':[_0xf440('0x5b'),_0xf440('0x61'),_0xf440('0x62'),'favicon',_0xf440('0x63'),_0xf440('0x64'),_0xf440('0x65'),_0xf440('0x66')],'raw':!![]});})[_0xf440('0x33')](handleEntityNotFound(_0x322ea5,null))[_0xf440('0x33')](function(_0x13438e){if(_0x13438e){var _0x416518=_0x13438e['logo']&&fs[_0xf440('0x67')](path[_0xf440('0x68')](config[_0xf440('0x69')],_0x1af22a,_[_0xf440('0x6a')](_0x13438e[_0xf440('0x5b')])))?path[_0xf440('0x68')](config[_0xf440('0x69')],_0x1af22a,_[_0xf440('0x6a')](_0x13438e[_0xf440('0x5b')])):path[_0xf440('0x68')](config[_0xf440('0x69')],_0x1af22a,_['toLower'](_0xf440('0x6b')));var _0x4dbd79=_0xf440('0x6c')+_[_0xf440('0x6d')]('logo');if(_0x13438e[_0x4dbd79]||!_0x8ffd83[_0xf440('0x6e')]){_0x416518=path['join'](config[_0xf440('0x69')],_0x1af22a,_[_0xf440('0x6a')](_0xf440('0x6b')));}if(!fs[_0xf440('0x67')](_0x416518)){throw new db['Sequelize'][(_0xf440('0x6f'))](_[_0xf440('0x6d')](_0xf440('0x5b'))+_0xf440('0x70'));}return _0x322ea5[_0xf440('0x71')](_0x416518);}})['catch'](handleError(_0x322ea5,null));};var utilLicense=require(_0xf440('0x5d'));exports['getLogoLogin']=function(_0x8d10bb,_0x1d7ed5,_0x16ecd5){var _0x3c8318=_0xf440('0x5f');var _0x57ada2={'custom':![]};return utilLicense['getLicense']()[_0xf440('0x33')](function(_0x35df3b){if(_0x35df3b){_0x57ada2=_0x35df3b;}return db['Setting'][_0xf440('0x58')]({'where':{'id':_0x8d10bb[_0xf440('0x55')]['id']},'attributes':[_0xf440('0x5b'),_0xf440('0x61'),_0xf440('0x62'),'favicon',_0xf440('0x63'),_0xf440('0x64'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x1d7ed5,null))[_0xf440('0x33')](function(_0x208e0e){if(_0x208e0e){var _0x192959=_0x208e0e[_0xf440('0x61')]&&fs[_0xf440('0x67')](path[_0xf440('0x68')](config[_0xf440('0x69')],_0x3c8318,_[_0xf440('0x6a')](_0x208e0e[_0xf440('0x61')])))?path['join'](config['root'],_0x3c8318,_[_0xf440('0x6a')](_0x208e0e[_0xf440('0x61')])):path[_0xf440('0x68')](config[_0xf440('0x69')],_0x3c8318,_[_0xf440('0x6a')]('default_loginLogo.svg'));var _0x1dcc5c=_0xf440('0x6c')+_[_0xf440('0x6d')](_0xf440('0x61'));if(_0x208e0e[_0x1dcc5c]||!_0x57ada2['custom']){_0x192959=path[_0xf440('0x68')](config[_0xf440('0x69')],_0x3c8318,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xf440('0x67')](_0x192959)){throw new db['Sequelize'][(_0xf440('0x6f'))](_[_0xf440('0x6d')]('loginLogo')+_0xf440('0x70'));}return _0x1d7ed5[_0xf440('0x71')](_0x192959);}})['catch'](handleError(_0x1d7ed5,null));};exports['gdpr']=function(_0x3d074f,_0x1c0cb3){return db[_0xf440('0x3a')][_0xf440('0x58')]({'where':{'id':_0x3d074f[_0xf440('0x55')]['id']},'attributes':['securePassword']})[_0xf440('0x33')](respondWithResult(_0x1c0cb3,null))[_0xf440('0x53')](handleError(_0x1c0cb3,null));};exports[_0xf440('0x72')]=function(_0x35a371,_0x237f21,_0x3eeb81){if(_0x35a371[_0xf440('0x59')]&&_0x35a371['file']['filename']){_0x35a371[_0xf440('0x57')]['preferred']=_0x35a371[_0xf440('0x59')]['filename'];}return db[_0xf440('0x3a')][_0xf440('0x58')]({'where':{'id':_0x35a371[_0xf440('0x55')]['id']}})[_0xf440('0x33')](handleEntityNotFound(_0x237f21,null))['then'](saveUpdates(_0x35a371['body'],null))['then'](respondWithResult(_0x237f21,null))[_0xf440('0x53')](handleError(_0x237f21,null));};var utilLicense=require(_0xf440('0x5d'));exports[_0xf440('0x73')]=function(_0x17550c,_0x4bf7e8,_0x3db457){var _0x170617=_0xf440('0x5f');var _0x26fd82={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2b18cf){if(_0x2b18cf){_0x26fd82=_0x2b18cf;}return db['Setting'][_0xf440('0x58')]({'where':{'id':_0x17550c[_0xf440('0x55')]['id']},'attributes':[_0xf440('0x5b'),_0xf440('0x61'),'preferred',_0xf440('0x74'),'defaultLogo','defaultLoginLogo',_0xf440('0x65'),_0xf440('0x66')],'raw':!![]});})[_0xf440('0x33')](handleEntityNotFound(_0x4bf7e8,null))[_0xf440('0x33')](function(_0x4dd045){if(_0x4dd045){var _0x363103=_0x4dd045[_0xf440('0x62')]&&fs[_0xf440('0x67')](path['join'](config[_0xf440('0x69')],_0x170617,_['toLower'](_0x4dd045[_0xf440('0x62')])))?path['join'](config[_0xf440('0x69')],_0x170617,_[_0xf440('0x6a')](_0x4dd045['preferred'])):path[_0xf440('0x68')](config[_0xf440('0x69')],_0x170617,_[_0xf440('0x6a')](_0xf440('0x75')));var _0x33ba1a=_0xf440('0x6c')+_['upperFirst'](_0xf440('0x62'));if(_0x4dd045[_0x33ba1a]||!_0x26fd82[_0xf440('0x6e')]||!_0x26fd82[_0xf440('0x62')]){_0x363103=path[_0xf440('0x68')](config[_0xf440('0x69')],_0x170617,_[_0xf440('0x6a')](_0xf440('0x75')));}if(!fs[_0xf440('0x67')](_0x363103)){throw new db[(_0xf440('0x76'))]['ValidationError'](_[_0xf440('0x6d')](_0xf440('0x62'))+'\x20not\x20found');}return _0x4bf7e8[_0xf440('0x71')](_0x363103);}})['catch'](handleError(_0x4bf7e8,null));};exports['addFavicon']=function(_0x39bc4a,_0x54530d,_0x5f19c3){if(_0x39bc4a[_0xf440('0x59')]&&_0x39bc4a[_0xf440('0x59')][_0xf440('0x5a')]){_0x39bc4a[_0xf440('0x57')]['favicon']=_0x39bc4a['file'][_0xf440('0x5a')];}return db[_0xf440('0x3a')][_0xf440('0x58')]({'where':{'id':_0x39bc4a[_0xf440('0x55')]['id']}})[_0xf440('0x33')](handleEntityNotFound(_0x54530d,null))[_0xf440('0x33')](saveUpdates(_0x39bc4a[_0xf440('0x57')],null))[_0xf440('0x33')](respondWithResult(_0x54530d,null))[_0xf440('0x53')](handleError(_0x54530d,null));};var utilLicense=require('../../config/license/util');exports[_0xf440('0x77')]=function(_0x42a171,_0x20cc67,_0x162729){var _0x199d79='server/files/images/logos';var _0x3a929d={'custom':![]};return utilLicense[_0xf440('0x60')]()[_0xf440('0x33')](function(_0x46b796){if(_0x46b796){_0x3a929d=_0x46b796;}return db[_0xf440('0x3a')]['find']({'where':{'id':_0x42a171[_0xf440('0x55')]['id']},'attributes':['logo',_0xf440('0x61'),'preferred',_0xf440('0x74'),'defaultLogo','defaultLoginLogo',_0xf440('0x65'),_0xf440('0x66')],'raw':!![]});})[_0xf440('0x33')](handleEntityNotFound(_0x20cc67,null))[_0xf440('0x33')](function(_0x5432e0){if(_0x5432e0){var _0x4cefe1=_0x5432e0[_0xf440('0x74')]&&fs['existsSync'](path[_0xf440('0x68')](config[_0xf440('0x69')],_0x199d79,_[_0xf440('0x6a')](_0x5432e0[_0xf440('0x74')])))?path['join'](config[_0xf440('0x69')],_0x199d79,_['toLower'](_0x5432e0[_0xf440('0x74')])):path[_0xf440('0x68')](config[_0xf440('0x69')],_0x199d79,_['toLower'](_0xf440('0x78')));var _0x4956d1=_0xf440('0x6c')+_[_0xf440('0x6d')](_0xf440('0x74'));if(_0x5432e0[_0x4956d1]||!_0x3a929d[_0xf440('0x6e')]){_0x4cefe1=path[_0xf440('0x68')](config[_0xf440('0x69')],_0x199d79,_[_0xf440('0x6a')](_0xf440('0x78')));}if(!fs['existsSync'](_0x4cefe1)){throw new db[(_0xf440('0x76'))][(_0xf440('0x6f'))](_[_0xf440('0x6d')](_0xf440('0x74'))+_0xf440('0x70'));}return _0x20cc67[_0xf440('0x71')](_0x4cefe1);}})['catch'](handleError(_0x20cc67,null));};exports[_0xf440('0x79')]=function(_0x4a3cb4,_0x4f6fe5){var _0x3f0fe9={'offset':moment()[_0xf440('0x7a')]()};_0x3f0fe9['now']=moment()[_0xf440('0x7a')](_0x3f0fe9[_0xf440('0x2a')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x4f6fe5[_0xf440('0x28')](0xc8)[_0xf440('0x37')](_0x3f0fe9);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 2ad4216..0549ae9 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x6b4adf,_0x178e4f){var _0x1c1f37=function(_0x587a34){while(--_0x587a34){_0x6b4adf['push'](_0x6b4adf['shift']());}};_0x1c1f37(++_0x178e4f);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a3dff,_0x20b8f5){_0x5a3dff=_0x5a3dff-0x0;var _0x48b1cf=_0xedd9[_0x5a3dff];return _0x48b1cf;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x200cf3,_0x5bd7ad){var _0x5806ca=function(_0x56222b){while(--_0x56222b){_0x200cf3['push'](_0x200cf3['shift']());}};_0x5806ca(++_0x5bd7ad);}(_0xedd9,0xfc));var _0x9edd=function(_0x593bb6,_0x3f60c1){_0x593bb6=_0x593bb6-0x0;var _0x2d5435=_0xedd9[_0x593bb6];return _0x2d5435;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 83cd803..3ff0ebb 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 _0x1711=['model','include','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','map'];(function(_0x57bf80,_0x50034b){var _0x3aed5=function(_0x12bd9a){while(--_0x12bd9a){_0x57bf80['push'](_0x57bf80['shift']());}};_0x3aed5(++_0x50034b);}(_0x1711,0x12b));var _0x1171=function(_0x4b44d3,_0x1a46c0){_0x4b44d3=_0x4b44d3-0x0;var _0x3609b3=_0x1711[_0x4b44d3];return _0x3609b3;};'use strict';var _=require(_0x1171('0x0'));var util=require(_0x1171('0x1'));var moment=require(_0x1171('0x2'));var BPromise=require(_0x1171('0x3'));var rs=require(_0x1171('0x4'));var fs=require('fs');var Redis=require(_0x1171('0x5'));var db=require(_0x1171('0x6'))['db'];var utils=require(_0x1171('0x7'));var logger=require(_0x1171('0x8'))('rpc');var config=require(_0x1171('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1171('0xa')][_0x1171('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x119032,_0x52cea0,_0x7d442a){return new BPromise(function(_0x4625e0,_0x4aab8e){return client['request'](_0x119032,_0x7d442a)[_0x1171('0xc')](function(_0x1d0553){logger[_0x1171('0xd')](_0x1171('0xe'),_0x52cea0,_0x1171('0xf'));logger[_0x1171('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x52cea0,'request\x20sent',JSON[_0x1171('0x11')](_0x1d0553));if(_0x1d0553[_0x1171('0x12')]){if(_0x1d0553[_0x1171('0x12')][_0x1171('0x13')]===0x1f4){logger[_0x1171('0x12')]('Setting,\x20%s,\x20%s',_0x52cea0,_0x1d0553[_0x1171('0x12')][_0x1171('0x14')]);return _0x4aab8e(_0x1d0553[_0x1171('0x12')][_0x1171('0x14')]);}logger[_0x1171('0x12')](_0x1171('0xe'),_0x52cea0,_0x1d0553[_0x1171('0x12')][_0x1171('0x14')]);return _0x4625e0(_0x1d0553[_0x1171('0x12')][_0x1171('0x14')]);}else{logger[_0x1171('0xd')](_0x1171('0xe'),_0x52cea0,'request\x20sent');_0x4625e0(_0x1d0553[_0x1171('0x15')][_0x1171('0x14')]);}})[_0x1171('0x16')](function(_0x3bbd7e){logger['error'](_0x1171('0xe'),_0x52cea0,_0x3bbd7e);_0x4aab8e(_0x3bbd7e);});});}exports[_0x1171('0x17')]=function(_0x2fadf6){var _0xfb07a=this;return new Promise(function(_0x4484b1,_0x34e239){return db[_0x1171('0x18')][_0x1171('0x19')]({'raw':_0x2fadf6[_0x1171('0x1a')]?_0x2fadf6[_0x1171('0x1a')][_0x1171('0x1b')]===undefined?!![]:![]:!![],'where':_0x2fadf6['options']?_0x2fadf6[_0x1171('0x1a')][_0x1171('0x1c')]||null:null,'attributes':_0x2fadf6[_0x1171('0x1a')]?_0x2fadf6['options'][_0x1171('0x1d')]||null:null,'include':_0x2fadf6[_0x1171('0x1a')]?_0x2fadf6[_0x1171('0x1a')]['include']?_[_0x1171('0x1e')](_0x2fadf6[_0x1171('0x1a')]['include'],function(_0x4cfb7a){return{'model':db[_0x4cfb7a[_0x1171('0x1f')]],'as':_0x4cfb7a['as'],'attributes':_0x4cfb7a[_0x1171('0x1d')],'include':_0x4cfb7a['include']?_[_0x1171('0x1e')](_0x4cfb7a['include'],function(_0x4c0618){return{'model':db[_0x4c0618[_0x1171('0x1f')]],'as':_0x4c0618['as'],'attributes':_0x4c0618[_0x1171('0x1d')],'include':_0x4c0618[_0x1171('0x20')]?_[_0x1171('0x1e')](_0x4c0618[_0x1171('0x20')],function(_0x15627e){return{'model':db[_0x15627e[_0x1171('0x1f')]],'as':_0x15627e['as'],'attributes':_0x15627e[_0x1171('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1171('0xc')](function(_0xee03c2){logger[_0x1171('0xd')](_0x1171('0x17'),_0x2fadf6);logger[_0x1171('0x10')](_0x1171('0x17'),_0x2fadf6,JSON['stringify'](_0xee03c2));_0x4484b1(_0xee03c2);})['catch'](function(_0x3c6c70){logger[_0x1171('0x12')](_0x1171('0x17'),_0x3c6c70[_0x1171('0x14')],_0x2fadf6);_0x34e239(_0xfb07a[_0x1171('0x12')](0x1f4,_0x3c6c70[_0x1171('0x14')]));});});}; \ No newline at end of file +var _0x523e=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','ShowSetting','Setting','options','raw','where','attributes','include','map','model','stringify','catch','lodash','util'];(function(_0x3d79fd,_0x204b29){var _0x3672fe=function(_0x5e099f){while(--_0x5e099f){_0x3d79fd['push'](_0x3d79fd['shift']());}};_0x3672fe(++_0x204b29);}(_0x523e,0x1eb));var _0xe523=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x523e[_0x432682];return _0x463d05;};'use strict';var _=require(_0xe523('0x0'));var util=require(_0xe523('0x1'));var moment=require('moment');var BPromise=require(_0xe523('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe523('0x3'));var db=require(_0xe523('0x4'))['db'];var utils=require(_0xe523('0x5'));var logger=require('../../config/logger')(_0xe523('0x6'));var config=require(_0xe523('0x7'));var jayson=require(_0xe523('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43ff51,_0x4b8a16,_0x2cc3c9){return new BPromise(function(_0xe1bd6f,_0x3749ce){return client[_0xe523('0x9')](_0x43ff51,_0x2cc3c9)[_0xe523('0xa')](function(_0x158cf0){logger[_0xe523('0xb')](_0xe523('0xc'),_0x4b8a16,_0xe523('0xd'));logger[_0xe523('0xe')](_0xe523('0xf'),_0x4b8a16,_0xe523('0xd'),JSON['stringify'](_0x158cf0));if(_0x158cf0['error']){if(_0x158cf0[_0xe523('0x10')]['code']===0x1f4){logger[_0xe523('0x10')](_0xe523('0xc'),_0x4b8a16,_0x158cf0[_0xe523('0x10')][_0xe523('0x11')]);return _0x3749ce(_0x158cf0['error'][_0xe523('0x11')]);}logger[_0xe523('0x10')](_0xe523('0xc'),_0x4b8a16,_0x158cf0[_0xe523('0x10')][_0xe523('0x11')]);return _0xe1bd6f(_0x158cf0['error'][_0xe523('0x11')]);}else{logger['info'](_0xe523('0xc'),_0x4b8a16,_0xe523('0xd'));_0xe1bd6f(_0x158cf0['result'][_0xe523('0x11')]);}})['catch'](function(_0x41958a){logger[_0xe523('0x10')](_0xe523('0xc'),_0x4b8a16,_0x41958a);_0x3749ce(_0x41958a);});});}exports[_0xe523('0x12')]=function(_0x2a61fd){var _0x12f30f=this;return new Promise(function(_0x4ff651,_0x334b12){return db[_0xe523('0x13')]['find']({'raw':_0x2a61fd[_0xe523('0x14')]?_0x2a61fd['options'][_0xe523('0x15')]===undefined?!![]:![]:!![],'where':_0x2a61fd[_0xe523('0x14')]?_0x2a61fd[_0xe523('0x14')][_0xe523('0x16')]||null:null,'attributes':_0x2a61fd[_0xe523('0x14')]?_0x2a61fd[_0xe523('0x14')][_0xe523('0x17')]||null:null,'include':_0x2a61fd['options']?_0x2a61fd[_0xe523('0x14')][_0xe523('0x18')]?_[_0xe523('0x19')](_0x2a61fd[_0xe523('0x14')]['include'],function(_0x15469a){return{'model':db[_0x15469a[_0xe523('0x1a')]],'as':_0x15469a['as'],'attributes':_0x15469a[_0xe523('0x17')],'include':_0x15469a[_0xe523('0x18')]?_[_0xe523('0x19')](_0x15469a['include'],function(_0x55aeff){return{'model':db[_0x55aeff['model']],'as':_0x55aeff['as'],'attributes':_0x55aeff[_0xe523('0x17')],'include':_0x55aeff[_0xe523('0x18')]?_[_0xe523('0x19')](_0x55aeff[_0xe523('0x18')],function(_0x21cc56){return{'model':db[_0x21cc56['model']],'as':_0x21cc56['as'],'attributes':_0x21cc56[_0xe523('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2de19f){logger['info'](_0xe523('0x12'),_0x2a61fd);logger[_0xe523('0xe')](_0xe523('0x12'),_0x2a61fd,JSON[_0xe523('0x1b')](_0x2de19f));_0x4ff651(_0x2de19f);})[_0xe523('0x1c')](function(_0x408c78){logger['error']('ShowSetting',_0x408c78[_0xe523('0x11')],_0x2a61fd);_0x334b12(_0x12f30f[_0xe523('0x10')](0x1f4,_0x408c78['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 44a9d45..fa2c9be 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 _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(_0x1e1dea,_0x16fe92){var _0x360ed7=function(_0x3fd6d5){while(--_0x3fd6d5){_0x1e1dea['push'](_0x1e1dea['shift']());}};_0x360ed7(++_0x16fe92);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var 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 +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(_0x1d38d9,_0xe319bc){var _0x157ed3=function(_0xde1798){while(--_0xde1798){_0x1d38d9['push'](_0x1d38d9['shift']());}};_0x157ed3(++_0xe319bc);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 12aee34..335ce6c 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 _0x5649=['generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name'];(function(_0x3a70e0,_0x3df982){var _0x5ad262=function(_0x43cd67){while(--_0x43cd67){_0x3a70e0['push'](_0x3a70e0['shift']());}};_0x5ad262(++_0x3df982);}(_0x5649,0xcc));var _0x9564=function(_0x564b7f,_0x162734){_0x564b7f=_0x564b7f-0x0;var _0x194ae6=_0x5649[_0x564b7f];return _0x194ae6;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x9564('0x0')]={'name':{'type':Sequelize[_0x9564('0x1')],'unique':_0x9564('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x9564('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x9564('0x1')],'defaultValue':function(){return rs[_0x9564('0x3')]();}},'phone':{'type':Sequelize[_0x9564('0x1')]},'type':{'type':Sequelize[_0x9564('0x4')](_0x9564('0x5'),_0x9564('0x6'),_0x9564('0x7'),_0x9564('0x8'),_0x9564('0x9'),_0x9564('0xa'),'bandwidth',_0x9564('0xb'),_0x9564('0xc'),_0x9564('0xd'))},'accountSid':{'type':Sequelize[_0x9564('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x9564('0x1')]},'smsMethod':{'type':Sequelize[_0x9564('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9564('0x1')]},'password':{'type':Sequelize[_0x9564('0x1')]},'apiKey':{'type':Sequelize[_0x9564('0x1')]},'applicationId':{'type':Sequelize[_0x9564('0x1')]},'accountId':{'type':Sequelize[_0x9564('0x1')]},'senderString':{'type':Sequelize[_0x9564('0x1')]},'deliveryReport':{'type':Sequelize[_0x9564('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x9564('0x1')]},'notificationTemplate':{'type':Sequelize[_0x9564('0xf')],'defaultValue':function(){return _0x9564('0x10');}},'notificationSound':{'type':Sequelize[_0x9564('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9564('0x11')],'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[_0x9564('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9564('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9564('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9564('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9564('0x11')],'comment':_0x9564('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x9564('0xe')],'defaultValue':![],'comment':_0x9564('0x13'),'set':function(_0x215801){if(!_0x215801)this[_0x9564('0x14')](_0x9564('0x15'),null);this[_0x9564('0x14')](_0x9564('0x16'),_0x215801);}}}; \ No newline at end of file +var _0x3838=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','skebby','connectel','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3838,0x70));var _0x8383=function(_0x308b86,_0x4cdd6d){_0x308b86=_0x308b86-0x0;var _0x1008b4=_0x3838[_0x308b86];return _0x1008b4;};'use strict';var Sequelize=require(_0x8383('0x0'));var rs=require(_0x8383('0x1'));module['exports']={'name':{'type':Sequelize[_0x8383('0x2')],'unique':_0x8383('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8383('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x8383('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x8383('0x2')],'defaultValue':function(){return rs[_0x8383('0x4')]();}},'phone':{'type':Sequelize[_0x8383('0x2')]},'type':{'type':Sequelize[_0x8383('0x5')]('twilio',_0x8383('0x6'),_0x8383('0x7'),'clicksend',_0x8383('0x8'),_0x8383('0x9'),_0x8383('0xa'),_0x8383('0xb'),_0x8383('0xc'),_0x8383('0xd'))},'accountSid':{'type':Sequelize[_0x8383('0x2')]},'authId':{'type':Sequelize[_0x8383('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x8383('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8383('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x8383('0x2')]},'applicationId':{'type':Sequelize[_0x8383('0x2')]},'accountId':{'type':Sequelize[_0x8383('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x8383('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x8383('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8383('0xf')],'defaultValue':function(){return _0x8383('0x10');}},'notificationSound':{'type':Sequelize[_0x8383('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8383('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8383('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8383('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8383('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8383('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8383('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8383('0x11')],'comment':_0x8383('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x8383('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xaaa770){if(!_0xaaa770)this[_0x8383('0x13')](_0x8383('0x14'),null);this[_0x8383('0x13')](_0x8383('0x15'),_0xaaa770);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ff1bfd5..3412409 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 _0x3ca3=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','get','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','filters','filter','merge','options','SmsAccount','include','rows','show','Pause','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','Applications','orderBy','priority','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','account','from','From','Body','messageId','MessageSid','skebby','sender','text','message_id','plivo','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','SmsInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','send','\x0a','addApplications','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','out','SmsMessage','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','DELIVERED','groupName','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf'];(function(_0x26c401,_0x5e0a1b){var _0x269a26=function(_0x3aa7bb){while(--_0x3aa7bb){_0x26c401['push'](_0x26c401['shift']());}};_0x269a26(++_0x5e0a1b);}(_0x3ca3,0xe4));var _0x33ca=function(_0x2ab124,_0x29445e){_0x2ab124=_0x2ab124-0x0;var _0x458b73=_0x3ca3[_0x2ab124];return _0x458b73;};'use strict';var emlformat=require(_0x33ca('0x0'));var rimraf=require(_0x33ca('0x1'));var zipdir=require(_0x33ca('0x2'));var jsonpatch=require(_0x33ca('0x3'));var rp=require(_0x33ca('0x4'));var moment=require(_0x33ca('0x5'));var BPromise=require(_0x33ca('0x6'));var Mustache=require(_0x33ca('0x7'));var util=require(_0x33ca('0x8'));var path=require(_0x33ca('0x9'));var sox=require(_0x33ca('0xa'));var csv=require('to-csv');var ejs=require(_0x33ca('0xb'));var fs=require('fs');var fs_extra=require(_0x33ca('0xc'));var _=require(_0x33ca('0xd'));var squel=require('squel');var crypto=require(_0x33ca('0xe'));var jsforce=require(_0x33ca('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x33ca('0x10'));var querystring=require(_0x33ca('0x11'));var Papa=require(_0x33ca('0x12'));var Redis=require('ioredis');var authService=require(_0x33ca('0x13'));var qs=require(_0x33ca('0x14'));var as=require(_0x33ca('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x33ca('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x33ca('0x17'));var db=require('../../mysqldb')['db'];config[_0x33ca('0x18')]=_[_0x33ca('0x19')](config['redis'],{'host':_0x33ca('0x1a'),'port':0x18eb});var socket=require(_0x33ca('0x1b'))(new Redis(config[_0x33ca('0x18')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x33ca('0x1c'));var client=jayson['client'][_0x33ca('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x117e6a,_0x422d5e,_0x4d0a6f,_0x412d24){return new BPromise(function(_0x8ca98,_0x1058d0){var _0x23a77e=_0x412d24||client;return _0x23a77e['request'](_0x117e6a,_0x4d0a6f)[_0x33ca('0x1e')](function(_0x2051f7){logger[_0x33ca('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x422d5e,_0x33ca('0x20'));logger[_0x33ca('0x21')](_0x33ca('0x22'),_0x422d5e,_0x33ca('0x20'),JSON[_0x33ca('0x23')](_0x2051f7));if(_0x2051f7[_0x33ca('0x24')]){if(_0x2051f7[_0x33ca('0x24')][_0x33ca('0x25')]===0x1f4){logger[_0x33ca('0x24')](_0x33ca('0x26'),_0x422d5e,_0x2051f7[_0x33ca('0x24')][_0x33ca('0x27')]);return _0x1058d0(_0x2051f7['error'][_0x33ca('0x27')]);}logger[_0x33ca('0x24')]('SmsAccount,\x20%s,\x20%s',_0x422d5e,_0x2051f7['error'][_0x33ca('0x27')]);return _0x8ca98(_0x2051f7[_0x33ca('0x24')][_0x33ca('0x27')]);}else{logger[_0x33ca('0x1f')](_0x33ca('0x26'),_0x422d5e,'request\x20sent');_0x8ca98(_0x2051f7[_0x33ca('0x28')][_0x33ca('0x27')]);}})[_0x33ca('0x29')](function(_0x4e822d){logger[_0x33ca('0x24')](_0x33ca('0x26'),_0x422d5e,_0x4e822d);_0x1058d0(_0x4e822d);});});}function respondWithStatusCode(_0x574f90,_0x144035){_0x144035=_0x144035||0xcc;return function(_0x55d866){if(_0x55d866){return _0x574f90[_0x33ca('0x2a')](_0x144035);}return _0x574f90[_0x33ca('0x2b')](_0x144035)[_0x33ca('0x2c')]();};}function respondWithResult(_0x35c101,_0x237ffe){_0x237ffe=_0x237ffe||0xc8;return function(_0xe3ac28){if(_0xe3ac28){return _0x35c101['status'](_0x237ffe)['json'](_0xe3ac28);}};}function respondWithFilteredResult(_0xbfec62,_0x4926dd){return function(_0x26ddc4){if(_0x26ddc4){var _0x4456eb=typeof _0x4926dd[_0x33ca('0x2d')]===_0x33ca('0x2e')&&typeof _0x4926dd['limit']==='undefined';var _0x124c5c=_0x26ddc4[_0x33ca('0x2f')];var _0x1b3957=_0x4456eb?0x0:_0x4926dd[_0x33ca('0x2d')];var _0x46577d=_0x4456eb?_0x26ddc4['count']:_0x4926dd[_0x33ca('0x2d')]+_0x4926dd[_0x33ca('0x30')];var _0x3f4477;if(_0x46577d>=_0x124c5c){_0x46577d=_0x124c5c;_0x3f4477=0xc8;}else{_0x3f4477=0xce;}_0xbfec62[_0x33ca('0x2b')](_0x3f4477);return _0xbfec62[_0x33ca('0x31')](_0x33ca('0x32'),_0x1b3957+'-'+_0x46577d+'/'+_0x124c5c)[_0x33ca('0x33')](_0x26ddc4);}return null;};}function patchUpdates(_0x34aacd){return function(_0x11e76b){try{jsonpatch['apply'](_0x11e76b,_0x34aacd,!![]);}catch(_0x168a94){return BPromise[_0x33ca('0x34')](_0x168a94);}return _0x11e76b[_0x33ca('0x35')]();};}function saveUpdates(_0x471fb1,_0x5620bd){return function(_0x1e7726){if(_0x1e7726){return _0x1e7726[_0x33ca('0x36')](_0x471fb1)[_0x33ca('0x1e')](function(_0x228e55){return _0x228e55;});}return null;};}function removeEntity(_0x1c8a80,_0x134391){return function(_0x1f45a1){if(_0x1f45a1){return _0x1f45a1[_0x33ca('0x37')]()[_0x33ca('0x1e')](function(){var _0xbeb924=_0x1f45a1[_0x33ca('0x38')]({'plain':!![]});var _0x44c6b5='SmsAccounts';return db[_0x33ca('0x39')][_0x33ca('0x37')]({'where':{'type':_0x44c6b5,'resourceId':_0xbeb924['id']}})[_0x33ca('0x1e')](function(){return _0x1f45a1;});})[_0x33ca('0x1e')](function(){_0x1c8a80[_0x33ca('0x2b')](0xcc)[_0x33ca('0x2c')]();});}};}function handleEntityNotFound(_0x2ab402,_0x58101b){return function(_0x10863a){if(!_0x10863a){_0x2ab402[_0x33ca('0x2a')](0x194);}return _0x10863a;};}function handleError(_0x38210a,_0x467437){_0x467437=_0x467437||0x1f4;return function(_0x403351){logger['error'](_0x403351[_0x33ca('0x3a')]);if(_0x403351[_0x33ca('0x3b')]){delete _0x403351[_0x33ca('0x3b')];}_0x38210a['status'](_0x467437)['send'](_0x403351);};}exports[_0x33ca('0x3c')]=function(_0x539099,_0x28d364){var _0x3a6134={'include':[{'model':db['Pause'],'as':_0x33ca('0x3d')}]},_0x2430e8={},_0x5dede7={'count':0x0,'rows':[]};var _0x1a7b17=_[_0x33ca('0x3e')](db['SmsAccount'][_0x33ca('0x3f')],function(_0x18296d){return{'name':_0x18296d[_0x33ca('0x40')],'type':_0x18296d[_0x33ca('0x41')][_0x33ca('0x42')]};});_0x2430e8['model']=_[_0x33ca('0x3e')](_0x1a7b17,_0x33ca('0x3b'));_0x2430e8[_0x33ca('0x43')]=_[_0x33ca('0x44')](_0x539099[_0x33ca('0x43')]);_0x2430e8['filters']=_[_0x33ca('0x45')](_0x2430e8[_0x33ca('0x46')],_0x2430e8[_0x33ca('0x43')]);_0x3a6134[_0x33ca('0x47')]=_['intersection'](_0x2430e8[_0x33ca('0x46')],qs[_0x33ca('0x48')](_0x539099[_0x33ca('0x43')][_0x33ca('0x48')]));_0x3a6134[_0x33ca('0x47')]=_0x3a6134[_0x33ca('0x47')]['length']?_0x3a6134['attributes']:_0x2430e8['model'];if(!_0x539099[_0x33ca('0x43')]['hasOwnProperty'](_0x33ca('0x49'))){_0x3a6134['limit']=qs['limit'](_0x539099[_0x33ca('0x43')][_0x33ca('0x30')]);_0x3a6134[_0x33ca('0x2d')]=qs['offset'](_0x539099[_0x33ca('0x43')]['offset']);}_0x3a6134[_0x33ca('0x4a')]=qs['sort'](_0x539099[_0x33ca('0x43')][_0x33ca('0x4b')]);_0x3a6134[_0x33ca('0x4c')]=qs[_0x33ca('0x4d')](_['pick'](_0x539099[_0x33ca('0x43')],_0x2430e8[_0x33ca('0x4d')]),_0x1a7b17);if(_0x539099[_0x33ca('0x43')][_0x33ca('0x4e')]){_0x3a6134['where']=_[_0x33ca('0x4f')](_0x3a6134['where'],{'$or':_[_0x33ca('0x3e')](_0x1a7b17,function(_0x3cd7c5){if(_0x3cd7c5[_0x33ca('0x41')]!=='VIRTUAL'){var _0xddaa37={};_0xddaa37[_0x3cd7c5[_0x33ca('0x3b')]]={'$like':'%'+_0x539099['query'][_0x33ca('0x4e')]+'%'};return _0xddaa37;}})});}_0x3a6134=_[_0x33ca('0x4f')]({},_0x3a6134,_0x539099[_0x33ca('0x50')]);var _0x283a43={'where':_0x3a6134[_0x33ca('0x4c')]};return db[_0x33ca('0x51')][_0x33ca('0x2f')](_0x283a43)['then'](function(_0x523362){_0x5dede7[_0x33ca('0x2f')]=_0x523362;if(_0x539099[_0x33ca('0x43')]['includeAll']){_0x3a6134[_0x33ca('0x52')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x3a6134);})[_0x33ca('0x1e')](function(_0x2da5bb){_0x5dede7[_0x33ca('0x53')]=_0x2da5bb;return _0x5dede7;})[_0x33ca('0x1e')](respondWithFilteredResult(_0x28d364,_0x3a6134))[_0x33ca('0x29')](handleError(_0x28d364,null));};exports[_0x33ca('0x54')]=function(_0x33fc63,_0x3a80c4){var _0x5af96f={'raw':![],'where':{'id':_0x33fc63['params']['id']},'include':[{'model':db[_0x33ca('0x55')],'as':_0x33ca('0x3d')}]},_0x3d2c0d={};_0x3d2c0d[_0x33ca('0x46')]=_[_0x33ca('0x44')](db['SmsAccount'][_0x33ca('0x3f')]);_0x3d2c0d[_0x33ca('0x43')]=_[_0x33ca('0x44')](_0x33fc63[_0x33ca('0x43')]);_0x3d2c0d[_0x33ca('0x4d')]=_['intersection'](_0x3d2c0d[_0x33ca('0x46')],_0x3d2c0d[_0x33ca('0x43')]);_0x5af96f['attributes']=_['intersection'](_0x3d2c0d[_0x33ca('0x46')],qs[_0x33ca('0x48')](_0x33fc63[_0x33ca('0x43')][_0x33ca('0x48')]));_0x5af96f[_0x33ca('0x47')]=_0x5af96f[_0x33ca('0x47')][_0x33ca('0x56')]?_0x5af96f[_0x33ca('0x47')]:_0x3d2c0d[_0x33ca('0x46')];if(_0x33fc63[_0x33ca('0x43')][_0x33ca('0x57')]){_0x5af96f[_0x33ca('0x52')]=[{'all':!![]}];}_0x5af96f=_[_0x33ca('0x4f')]({},_0x5af96f,_0x33fc63[_0x33ca('0x50')]);return db['SmsAccount'][_0x33ca('0x58')](_0x5af96f)[_0x33ca('0x1e')](handleEntityNotFound(_0x3a80c4,null))[_0x33ca('0x1e')](respondWithResult(_0x3a80c4,null))[_0x33ca('0x29')](handleError(_0x3a80c4,null));};exports[_0x33ca('0x59')]=function(_0x4fc37a,_0x1d7c7e){return db[_0x33ca('0x51')][_0x33ca('0x59')](_0x4fc37a[_0x33ca('0x5a')],{})['then'](function(_0x1a9c02){var _0x43d51c=_0x4fc37a[_0x33ca('0x5b')][_0x33ca('0x38')]({'plain':!![]});if(!_0x43d51c)throw new Error(_0x33ca('0x5c'));if(_0x43d51c['role']==='user'){var _0x43efad=_0x1a9c02[_0x33ca('0x38')]({'plain':!![]});var _0x3f6630=_0x33ca('0x5d');return db[_0x33ca('0x5e')][_0x33ca('0x58')]({'where':{'name':_0x3f6630,'userProfileId':_0x43d51c[_0x33ca('0x5f')]},'raw':!![]})['then'](function(_0xd4c004){if(_0xd4c004&&_0xd4c004[_0x33ca('0x60')]===0x0){return db[_0x33ca('0x39')][_0x33ca('0x59')]({'name':_0x43efad[_0x33ca('0x3b')],'resourceId':_0x43efad['id'],'type':_0xd4c004[_0x33ca('0x3b')],'sectionId':_0xd4c004['id']},{})[_0x33ca('0x1e')](function(){return _0x1a9c02;});}else{return _0x1a9c02;}})['catch'](function(_0x99f283){logger[_0x33ca('0x24')](_0x33ca('0x61'),_0x99f283);throw _0x99f283;});}return _0x1a9c02;})[_0x33ca('0x1e')](respondWithResult(_0x1d7c7e,0xc9))[_0x33ca('0x29')](handleError(_0x1d7c7e,null));};exports['update']=function(_0x20018c,_0x18f932){if(_0x20018c[_0x33ca('0x5a')]['id']){delete _0x20018c[_0x33ca('0x5a')]['id'];}return db[_0x33ca('0x51')][_0x33ca('0x58')]({'where':{'id':_0x20018c['params']['id']},'include':[{'model':db[_0x33ca('0x55')],'as':'mandatoryDispositionPause'}]})[_0x33ca('0x1e')](handleEntityNotFound(_0x18f932,null))[_0x33ca('0x1e')](saveUpdates(_0x20018c['body'],null))[_0x33ca('0x1e')](respondWithResult(_0x18f932,null))['catch'](handleError(_0x18f932,null));};exports[_0x33ca('0x37')]=function(_0x19c6f9,_0x253691){return db['SmsAccount'][_0x33ca('0x58')]({'where':{'id':_0x19c6f9[_0x33ca('0x62')]['id']}})['then'](handleEntityNotFound(_0x253691,null))[_0x33ca('0x1e')](removeEntity(_0x253691,null))[_0x33ca('0x29')](handleError(_0x253691,null));};exports[_0x33ca('0x63')]=function(_0x42b34e,_0x2f8454){return db[_0x33ca('0x51')]['describe']()[_0x33ca('0x1e')](respondWithResult(_0x2f8454,null))['catch'](handleError(_0x2f8454,null));};exports['addDisposition']=function(_0x3ce569,_0x1db45b,_0x4e2585){if(_0x3ce569[_0x33ca('0x5a')]['id']){delete _0x3ce569[_0x33ca('0x5a')]['id'];}return db[_0x33ca('0x51')][_0x33ca('0x58')]({'where':{'id':_0x3ce569[_0x33ca('0x62')]['id']}})[_0x33ca('0x1e')](handleEntityNotFound(_0x1db45b,null))[_0x33ca('0x1e')](function(_0x34c848){if(_0x34c848){_0x3ce569[_0x33ca('0x5a')][_0x33ca('0x64')]=_0x34c848['id'];return db[_0x33ca('0x65')][_0x33ca('0x59')](_0x3ce569[_0x33ca('0x5a')]);}})[_0x33ca('0x1e')](respondWithResult(_0x1db45b,null))[_0x33ca('0x29')](handleError(_0x1db45b,null));};exports[_0x33ca('0x66')]=function(_0x5394b6,_0x44f6a5,_0xd15b34){var _0x530763={'raw':![],'where':{}};var _0x378627={};var _0x458575={'count':0x0,'rows':[]};return db[_0x33ca('0x51')][_0x33ca('0x67')]({'where':{'id':_0x5394b6[_0x33ca('0x62')]['id']}})[_0x33ca('0x1e')](handleEntityNotFound(_0x44f6a5,null))[_0x33ca('0x1e')](function(_0x58994d){if(_0x58994d){_0x378627[_0x33ca('0x46')]=_['keys'](db[_0x33ca('0x65')][_0x33ca('0x3f')]);_0x378627[_0x33ca('0x43')]=_['keys'](_0x5394b6[_0x33ca('0x43')]);_0x378627[_0x33ca('0x4d')]=_[_0x33ca('0x45')](_0x378627['model'],_0x378627[_0x33ca('0x43')]);_0x530763[_0x33ca('0x47')]=_['intersection'](_0x378627[_0x33ca('0x46')],qs[_0x33ca('0x48')](_0x5394b6[_0x33ca('0x43')]['fields']));_0x530763[_0x33ca('0x47')]=_0x530763['attributes']['length']?_0x530763[_0x33ca('0x47')]:_0x378627[_0x33ca('0x46')];if(!_0x5394b6[_0x33ca('0x43')][_0x33ca('0x68')](_0x33ca('0x49'))){_0x530763['limit']=qs[_0x33ca('0x30')](_0x5394b6['query'][_0x33ca('0x30')]);_0x530763[_0x33ca('0x2d')]=qs['offset'](_0x5394b6[_0x33ca('0x43')]['offset']);}_0x530763[_0x33ca('0x4a')]=qs[_0x33ca('0x4b')](_0x5394b6['query'][_0x33ca('0x4b')]);_0x530763[_0x33ca('0x4c')]=qs[_0x33ca('0x4d')](_[_0x33ca('0x69')](_0x5394b6[_0x33ca('0x43')],_0x378627[_0x33ca('0x4d')]));_0x530763[_0x33ca('0x4c')][_0x33ca('0x64')]=_0x58994d['id'];if(_0x5394b6[_0x33ca('0x43')]['filter']){_0x530763[_0x33ca('0x4c')]=_[_0x33ca('0x4f')](_0x530763[_0x33ca('0x4c')],{'$or':_[_0x33ca('0x3e')](_0x530763[_0x33ca('0x47')],function(_0xd1af55){var _0x5ef083={};_0x5ef083[_0xd1af55]={'$like':'%'+_0x5394b6[_0x33ca('0x43')][_0x33ca('0x4e')]+'%'};return _0x5ef083;})});}_0x530763=_[_0x33ca('0x4f')]({},_0x530763,_0x5394b6[_0x33ca('0x50')]);return db['Disposition'][_0x33ca('0x2f')]({'where':_0x530763[_0x33ca('0x4c')]})[_0x33ca('0x1e')](function(_0x382ceb){_0x458575[_0x33ca('0x2f')]=_0x382ceb;if(_0x5394b6['query'][_0x33ca('0x57')]){_0x530763[_0x33ca('0x52')]=[{'all':!![]}];}return db[_0x33ca('0x65')][_0x33ca('0x6a')](_0x530763);})[_0x33ca('0x1e')](function(_0x3e5670){_0x458575[_0x33ca('0x53')]=_0x3e5670;return _0x458575;});}})[_0x33ca('0x1e')](respondWithFilteredResult(_0x44f6a5,_0x530763))[_0x33ca('0x29')](handleError(_0x44f6a5,null));};exports[_0x33ca('0x6b')]=function(_0x59f271,_0x2d0cde,_0x13da8a){return db[_0x33ca('0x51')][_0x33ca('0x58')]({'where':{'id':_0x59f271[_0x33ca('0x62')]['id']}})[_0x33ca('0x1e')](handleEntityNotFound(_0x2d0cde,null))[_0x33ca('0x1e')](function(_0x17482e){if(_0x17482e){return _0x17482e[_0x33ca('0x6b')](_0x59f271[_0x33ca('0x43')][_0x33ca('0x6c')]);}})[_0x33ca('0x1e')](respondWithStatusCode(_0x2d0cde,null))[_0x33ca('0x29')](handleError(_0x2d0cde,null));};exports[_0x33ca('0x6d')]=function(_0x1f259e,_0x5b09dd,_0x2c8983){if(_0x1f259e['body']['id']){delete _0x1f259e[_0x33ca('0x5a')]['id'];}return db[_0x33ca('0x51')][_0x33ca('0x58')]({'where':{'id':_0x1f259e[_0x33ca('0x62')]['id']}})['then'](handleEntityNotFound(_0x5b09dd,null))[_0x33ca('0x1e')](function(_0x47b8a8){if(_0x47b8a8){_0x1f259e[_0x33ca('0x5a')][_0x33ca('0x64')]=_0x47b8a8['id'];return db[_0x33ca('0x6e')][_0x33ca('0x59')](_0x1f259e['body']);}})[_0x33ca('0x1e')](respondWithResult(_0x5b09dd,null))[_0x33ca('0x29')](handleError(_0x5b09dd,null));};exports[_0x33ca('0x6f')]=function(_0x1f32d4,_0xb0f4c1,_0x3ba385){var _0x7c7523={'raw':![],'where':{}};var _0x602803={};var _0x5d5a49={'count':0x0,'rows':[]};return db[_0x33ca('0x51')][_0x33ca('0x67')]({'where':{'id':_0x1f32d4['params']['id']}})[_0x33ca('0x1e')](handleEntityNotFound(_0xb0f4c1,null))[_0x33ca('0x1e')](function(_0x1df048){if(_0x1df048){_0x602803['model']=_[_0x33ca('0x44')](db['CannedAnswer']['rawAttributes']);_0x602803['query']=_[_0x33ca('0x44')](_0x1f32d4[_0x33ca('0x43')]);_0x602803['filters']=_['intersection'](_0x602803['model'],_0x602803[_0x33ca('0x43')]);_0x7c7523[_0x33ca('0x47')]=_[_0x33ca('0x45')](_0x602803['model'],qs[_0x33ca('0x48')](_0x1f32d4[_0x33ca('0x43')][_0x33ca('0x48')]));_0x7c7523[_0x33ca('0x47')]=_0x7c7523[_0x33ca('0x47')][_0x33ca('0x56')]?_0x7c7523[_0x33ca('0x47')]:_0x602803[_0x33ca('0x46')];if(!_0x1f32d4[_0x33ca('0x43')][_0x33ca('0x68')](_0x33ca('0x49'))){_0x7c7523[_0x33ca('0x30')]=qs[_0x33ca('0x30')](_0x1f32d4[_0x33ca('0x43')][_0x33ca('0x30')]);_0x7c7523[_0x33ca('0x2d')]=qs[_0x33ca('0x2d')](_0x1f32d4['query']['offset']);}_0x7c7523['order']=qs['sort'](_0x1f32d4[_0x33ca('0x43')][_0x33ca('0x4b')]);_0x7c7523[_0x33ca('0x4c')]=qs['filters'](_[_0x33ca('0x69')](_0x1f32d4[_0x33ca('0x43')],_0x602803['filters']));_0x7c7523[_0x33ca('0x4c')]['SmsAccountId']=_0x1df048['id'];if(_0x1f32d4[_0x33ca('0x43')][_0x33ca('0x4e')]){_0x7c7523[_0x33ca('0x4c')]=_[_0x33ca('0x4f')](_0x7c7523[_0x33ca('0x4c')],{'$or':_['map'](_0x7c7523[_0x33ca('0x47')],function(_0x27d56c){var _0xdb73a7={};_0xdb73a7[_0x27d56c]={'$like':'%'+_0x1f32d4[_0x33ca('0x43')][_0x33ca('0x4e')]+'%'};return _0xdb73a7;})});}_0x7c7523=_[_0x33ca('0x4f')]({},_0x7c7523,_0x1f32d4[_0x33ca('0x50')]);return db[_0x33ca('0x6e')][_0x33ca('0x2f')]({'where':_0x7c7523[_0x33ca('0x4c')]})[_0x33ca('0x1e')](function(_0x50ff71){_0x5d5a49['count']=_0x50ff71;if(_0x1f32d4[_0x33ca('0x43')][_0x33ca('0x57')]){_0x7c7523[_0x33ca('0x52')]=[{'all':!![]}];}return db[_0x33ca('0x6e')][_0x33ca('0x6a')](_0x7c7523);})[_0x33ca('0x1e')](function(_0x407b18){_0x5d5a49['rows']=_0x407b18;return _0x5d5a49;});}})[_0x33ca('0x1e')](respondWithFilteredResult(_0xb0f4c1,_0x7c7523))['catch'](handleError(_0xb0f4c1,null));};exports[_0x33ca('0x70')]=function(_0x5883de,_0x5c0318,_0x2a410f){return db['SmsAccount'][_0x33ca('0x58')]({'where':{'id':_0x5883de[_0x33ca('0x62')]['id']}})[_0x33ca('0x1e')](handleEntityNotFound(_0x5c0318,null))['then'](function(_0xee2111){if(_0xee2111){return _0xee2111[_0x33ca('0x70')](_0x5883de[_0x33ca('0x43')][_0x33ca('0x6c')]);}})[_0x33ca('0x1e')](respondWithStatusCode(_0x5c0318,null))[_0x33ca('0x29')](handleError(_0x5c0318,null));};exports['notify']=function(_0x19403,_0xb13452,_0x55a2fd){var _0x21f4d3={'channel':_0x33ca('0x71')};var _0xce2f36=[];var _0xe573de=[];var _0x274276={};return db[_0x33ca('0x51')][_0x33ca('0x58')]({'where':{'id':_0x19403['params']['id']},'include':[{'model':db[_0x33ca('0x72')],'as':_0x33ca('0x73')}]})[_0x33ca('0x1e')](handleEntityNotFound(_0xb13452,null))[_0x33ca('0x1e')](function(_0x17f050){_0x21f4d3['account']=_0x17f050;_0x21f4d3['applications']=_[_0x33ca('0x74')](_0x17f050[_0x33ca('0x73')],[_0x33ca('0x75')],['asc']);if(_0x21f4d3['account'][_0x33ca('0x73')]){delete _0x21f4d3['account'][_0x33ca('0x73')];}return db[_0x33ca('0x76')][_0x33ca('0x63')]();})[_0x33ca('0x1e')](function(_0x175b98){if(!_0x175b98){throw new db[(_0x33ca('0x77'))]['ValidationError'](_0x33ca('0x78'));}_0xce2f36=_[_0x33ca('0x79')](_['keys'](_0x175b98),[_0x33ca('0x7a'),_0x33ca('0x7b')]);_0xe573de=_[_0x33ca('0x79')](_[_0x33ca('0x44')](_0x175b98),['createdAt',_0x33ca('0x7b'),_0x33ca('0x7c'),_0x33ca('0x7d')]);_0x21f4d3[_0x33ca('0x5a')]={'mapKey':_0x33ca('0x7e')};if(_0x21f4d3[_0x33ca('0x7f')][_0x33ca('0x41')]){switch(_0x21f4d3[_0x33ca('0x7f')][_0x33ca('0x41')]){case'twilio':_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x80')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x81')];_0x21f4d3[_0x33ca('0x5a')]['body']=_0x19403['body'][_0x33ca('0x82')];_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x83')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x84')];break;case _0x33ca('0x85'):_0x21f4d3[_0x33ca('0x5a')]['from']='+'+_0x19403[_0x33ca('0x5a')][_0x33ca('0x86')];_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x5a')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x87')];break;case'connectel':_0x21f4d3['body'][_0x33ca('0x80')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x80')];_0x21f4d3['body'][_0x33ca('0x5a')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x27')];break;case'clicksend':_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x80')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x80')];_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x5a')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x5a')];_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x83')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x88')];break;case _0x33ca('0x89'):_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x80')]=_0x19403['body'][_0x33ca('0x81')];_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x5a')]=_0x19403['body'][_0x33ca('0x8a')];_0x21f4d3[_0x33ca('0x5a')]['messageId']=_0x19403[_0x33ca('0x5a')]['MessageUUID'];break;case _0x33ca('0x8b'):_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x80')]='+'+_0x19403[_0x33ca('0x5a')]['results'][0x0][_0x33ca('0x80')];_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x5a')]=_0x19403['body'][_0x33ca('0x8c')][0x0][_0x33ca('0x87')];_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x83')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x8c')][0x0]['messageId'];break;case _0x33ca('0x8d'):_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x80')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x8e')];_0x21f4d3['body'][_0x33ca('0x5a')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x8f')]['message'];break;case _0x33ca('0x90'):_0x21f4d3['body'][_0x33ca('0x80')]=_0x19403['body'][_0x33ca('0x91')];_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x5a')]=_0x19403['body'][_0x33ca('0x87')];_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x83')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x92')];break;case _0x33ca('0x93'):_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x83')]=_0x19403[_0x33ca('0x5a')][0x0][_0x33ca('0x27')]['id'];_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x80')]=_0x19403['body'][0x0][_0x33ca('0x27')][_0x33ca('0x80')];_0x21f4d3[_0x33ca('0x5a')]['body']=_0x19403[_0x33ca('0x5a')][0x0][_0x33ca('0x27')][_0x33ca('0x87')];break;case _0x33ca('0x94'):_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x80')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x80')];_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x5a')]=_0x19403[_0x33ca('0x5a')][_0x33ca('0x27')];_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x83')]=_0x19403['body'][_0x33ca('0x95')];break;}}if(_0x21f4d3['body']['id']){delete _0x21f4d3[_0x33ca('0x5a')]['id'];}if(_[_0x33ca('0x96')](_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x80')])){throw new db[(_0x33ca('0x77'))][(_0x33ca('0x97'))](_0x33ca('0x98'));}if(_[_0x33ca('0x96')](_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x5a')])||_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x5a')]===''){throw new db[(_0x33ca('0x77'))][(_0x33ca('0x97'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x33ca('0x96')](_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x99')])){throw new db[(_0x33ca('0x77'))][(_0x33ca('0x97'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe573de);}if(!_[_0x33ca('0x9a')](_0xe573de,_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x99')])){throw new db['Sequelize'][(_0x33ca('0x97'))](_0x33ca('0x9b')+_0xe573de);}_0x274276[_0x21f4d3['body'][_0x33ca('0x99')]]=_0x21f4d3[_0x33ca('0x5a')]['from'];return db[_0x33ca('0x9c')]['find']({'where':{'id':_0x21f4d3[_0x33ca('0x7f')]['ListId']},'include':[{'model':db[_0x33ca('0x76')],'as':_0x33ca('0x9d'),'where':_0x274276,'limit':0x1,'order':[[_0x33ca('0x7b'),'DESC']]}]});})[_0x33ca('0x1e')](handleEntityNotFound(_0xb13452,null))[_0x33ca('0x1e')](function(_0x1cb4fd){if(_0x1cb4fd){_0x21f4d3[_0x33ca('0x9e')]=_['omit'](_0x1cb4fd,[_0x33ca('0x9d')]);if(_0x1cb4fd['Contacts'][_0x33ca('0x56')]){return _0x1cb4fd[_0x33ca('0x9d')][0x0];}var _0x452067=_[_0x33ca('0x19')](_0x21f4d3[_0x33ca('0x5a')],{'firstName':_0x21f4d3[_0x33ca('0x5a')]['from'],'ListId':_0x1cb4fd['id']});_0x452067[_0x21f4d3['body'][_0x33ca('0x99')]]=_0x21f4d3['body'][_0x33ca('0x80')];return db[_0x33ca('0x76')][_0x33ca('0x59')](_0x452067,{'fields':_0xce2f36,'raw':!![]});}})['then'](handleEntityNotFound(_0xb13452,null))[_0x33ca('0x1e')](function(_0x24bd6d){if(_0x24bd6d){_0x21f4d3[_0x33ca('0x9f')]=_0x24bd6d;var _0x4aac77={'ContactId':_0x24bd6d['id'],'phone':_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x80')],'SmsAccountId':_0x19403[_0x33ca('0x62')]['id']};var _0x309f60={'ContactId':_0x24bd6d['id'],'SmsAccountId':_0x19403[_0x33ca('0x62')]['id'],'closed':![]};return db[_0x33ca('0xa0')][_0x33ca('0x58')]({'where':_0x309f60})['then'](function(_0x265efb){if(_0x265efb){return[_0x265efb,![]];}return db[_0x33ca('0xa0')][_0x33ca('0x59')](_0x4aac77)[_0x33ca('0x1e')](function(_0x39a82f){return[_0x39a82f,!![]];});});}})['spread'](function(_0x2226ce,_0x577fbe){_0x21f4d3['interaction']=_0x2226ce[_0x33ca('0x38')]({'plain':!![]});_0x21f4d3[_0x33ca('0xa1')][_0x33ca('0xa2')]=![];if(_0x577fbe){if(_0x21f4d3['account'][_0x33ca('0xa3')]){_0x21f4d3[_0x33ca('0xa4')][_0x33ca('0xa5')]({'id':0x0,'priority':_0x21f4d3[_0x33ca('0xa4')][_0x33ca('0x56')]+0x1,'app':_0x33ca('0xa6'),'appdata':_0x33ca('0xa7'),'interval':_0x33ca('0xa8')});}_0x21f4d3[_0x33ca('0xa1')][_0x33ca('0xa2')]=!![];}return db['SmsMessage'][_0x33ca('0x59')]({'phone':_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x80')],'messageId':_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0x83')],'body':_0x21f4d3['body'][_0x33ca('0x5a')],'SmsAccountId':_0x19403[_0x33ca('0x62')]['id'],'SmsInteractionId':_0x2226ce['id'],'direction':'in','ContactId':_0x2226ce[_0x33ca('0xa9')],'AttachmentId':_0x21f4d3[_0x33ca('0x5a')][_0x33ca('0xaa')]});})[_0x33ca('0x1e')](function(_0x521487){_0x21f4d3[_0x33ca('0x27')]=_0x521487;if(!_0x21f4d3['interaction'][_0x33ca('0xab')])return;return db[_0x33ca('0xac')]['find']({'attributes':['id',_0x33ca('0x3b')],'where':{'id':_0x21f4d3[_0x33ca('0xa1')][_0x33ca('0xab')]}});})[_0x33ca('0x1e')](function(_0x3945c5){if(_0x3945c5){_0x21f4d3[_0x33ca('0xa4')][_0x33ca('0xad')]({'id':0x0,'priority':0x0,'app':_0x33ca('0xae'),'appdata':_0x3945c5[_0x33ca('0x3b')]+','+(_0x21f4d3[_0x33ca('0x7f')][_0x33ca('0xaf')]||0xa),'interval':_0x33ca('0xa8')});}if(!_0x21f4d3[_0x33ca('0xa1')][_0x33ca('0xb0')])return;return db[_0x33ca('0xb1')][_0x33ca('0x58')]({'attributes':['id','name'],'where':{'id':_0x21f4d3[_0x33ca('0xa1')]['queueId']}});})['then'](function(_0x5ebf67){if(_0x5ebf67){_0x21f4d3[_0x33ca('0xa4')]['unshift']({'id':0x0,'priority':0x1,'app':_0x33ca('0xb2'),'appdata':_0x5ebf67['name']+','+(_0x21f4d3[_0x33ca('0x7f')][_0x33ca('0xb3')]||0x12c),'interval':_0x33ca('0xa8')});}return respondWithRpcPromise(_0x33ca('0xb4'),'startRouting',_0x21f4d3);})[_0x33ca('0x1e')](function(_0x25f9ff){if(_0x25f9ff){var _0x4b5223=0xc8;var _0x790604=_0x33ca('0xb5');logger[_0x33ca('0x1f')](_0x33ca('0x22'),_0x790604,_0x4b5223,_0x33ca('0xb6'));logger[_0x33ca('0x21')](_0x33ca('0xb7'),_0x790604,_0x4b5223,'entity\x20found',JSON['stringify'](_0x25f9ff));if(_0x21f4d3['account'][_0x33ca('0x41')]===_0x33ca('0xb8')){return _0xb13452[_0x33ca('0x2b')](_0x4b5223)[_0x33ca('0x31')]('Content-Type',_0x33ca('0xb9'))[_0x33ca('0xba')](_0x33ca('0xbb'));}else{return _0xb13452['status'](_0x4b5223)[_0x33ca('0x33')](_0x25f9ff);}}})[_0x33ca('0x29')](handleError(_0xb13452,null));};exports[_0x33ca('0xbc')]=function(_0x4955c2,_0xff8482){var _0x54b11c=_0x4955c2[_0x33ca('0x62')]['id'];var _0x40238b=_0x4955c2[_0x33ca('0x5a')];var _0x1a0b17=0xc8;var _0x4a4bbe=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x33ca('0xbd')][_0x33ca('0xbe')]},function(_0xed599e){return db[_0x33ca('0x51')]['findOne']({'where':{'id':_0x54b11c},'transaction':_0xed599e})[_0x33ca('0x1e')](function(_0x396f05){if(_0x396f05){return db[_0x33ca('0x72')][_0x33ca('0x37')]({'where':{'SmsAccountId':_0x54b11c},'transaction':_0xed599e})[_0x33ca('0x1e')](function(){var _0x45fc31=_[_0x33ca('0x3e')](_0x40238b,function(_0x149549){_0x149549['SmsAccountId']=_0x54b11c;return _0x149549;});return db[_0x33ca('0x72')][_0x33ca('0xbf')](_0x45fc31,{'transaction':_0xed599e});});}else{_0x1a0b17=0x194;_0x4a4bbe=[];}});})['then'](function(){if(_0x1a0b17!==0x194){return db[_0x33ca('0x72')][_0x33ca('0xc0')]({'where':{'SmsAccountId':_0x54b11c},'order':_0x33ca('0x75')})[_0x33ca('0x1e')](function(_0xf80a39){_0x4a4bbe=_0xf80a39;});}})[_0x33ca('0x29')](function(_0x3b2570){_0x1a0b17=0x1f4;logger[_0x33ca('0x24')](_0x3b2570[_0x33ca('0x3a')]);if(_0x3b2570[_0x33ca('0x3b')]){delete _0x3b2570[_0x33ca('0x3b')];}_0x4a4bbe=_0x3b2570;})['finally'](function(){if(_0x4a4bbe===null){_0xff8482['sendStatus'](_0x1a0b17);}else{if(_0x1a0b17===0x1f4){_0xff8482[_0x33ca('0x2b')](_0x1a0b17)[_0x33ca('0xba')](_0x4a4bbe);}else{_0xff8482['status'](_0x1a0b17)[_0x33ca('0x33')](_0x4a4bbe);}}});};exports['getApplications']=function(_0x5c06f6,_0x5a7665,_0x2fdd7d){var _0x2bf8e4={};var _0x5f121e={};var _0x5a6da3;var _0x7469db;return db[_0x33ca('0x51')][_0x33ca('0x67')]({'where':{'id':_0x5c06f6[_0x33ca('0x62')]['id']}})['then'](handleEntityNotFound(_0x5a7665,null))[_0x33ca('0x1e')](function(_0x5882fc){if(_0x5882fc){_0x5a6da3=_0x5882fc;_0x5f121e['model']=_[_0x33ca('0x44')](db[_0x33ca('0x72')][_0x33ca('0x3f')]);_0x5f121e[_0x33ca('0x43')]=_[_0x33ca('0x44')](_0x5c06f6['query']);_0x5f121e['filters']=_[_0x33ca('0x45')](_0x5f121e[_0x33ca('0x46')],_0x5f121e[_0x33ca('0x43')]);_0x2bf8e4[_0x33ca('0x47')]=_[_0x33ca('0x45')](_0x5f121e['model'],qs[_0x33ca('0x48')](_0x5c06f6[_0x33ca('0x43')][_0x33ca('0x48')]));_0x2bf8e4[_0x33ca('0x47')]=_0x2bf8e4[_0x33ca('0x47')][_0x33ca('0x56')]?_0x2bf8e4[_0x33ca('0x47')]:_0x5f121e[_0x33ca('0x46')];_0x2bf8e4[_0x33ca('0x4a')]=qs['sort'](_0x5c06f6[_0x33ca('0x43')][_0x33ca('0x4b')]);_0x2bf8e4[_0x33ca('0x4c')]=qs[_0x33ca('0x4d')](_['pick'](_0x5c06f6[_0x33ca('0x43')],_0x5f121e[_0x33ca('0x4d')]));if(_0x5c06f6[_0x33ca('0x43')][_0x33ca('0x4e')]){_0x2bf8e4[_0x33ca('0x4c')]=_[_0x33ca('0x4f')](_0x2bf8e4['where'],{'$or':_['map'](_0x2bf8e4[_0x33ca('0x47')],function(_0x5d99e1){var _0x1fba29={};_0x1fba29[_0x5d99e1]={'$like':'%'+_0x5c06f6['query'][_0x33ca('0x4e')]+'%'};return _0x1fba29;})});}_0x2bf8e4=_['merge']({},_0x2bf8e4,_0x5c06f6[_0x33ca('0x50')]);return _0x5a6da3[_0x33ca('0xc1')](_0x2bf8e4);}})['then'](function(_0x1ccda0){if(_0x1ccda0){_0x7469db=_0x1ccda0['length'];if(!_0x5c06f6[_0x33ca('0x43')]['hasOwnProperty'](_0x33ca('0x49'))){_0x2bf8e4[_0x33ca('0x30')]=qs[_0x33ca('0x30')](_0x5c06f6['query']['limit']);_0x2bf8e4[_0x33ca('0x2d')]=qs[_0x33ca('0x2d')](_0x5c06f6[_0x33ca('0x43')][_0x33ca('0x2d')]);}return _0x5a6da3[_0x33ca('0xc1')](_0x2bf8e4);}})[_0x33ca('0x1e')](function(_0x54cb35){if(_0x54cb35){return _0x54cb35?{'count':_0x7469db,'rows':_0x54cb35}:null;}})[_0x33ca('0x1e')](respondWithResult(_0x5a7665,null))[_0x33ca('0x29')](handleError(_0x5a7665,null));};exports[_0x33ca('0xc2')]=function(_0x575dca,_0x154e4f,_0x567a9f){var _0x7a6c11={'raw':![],'where':{}};var _0x39a891={};var _0x292c20={'count':0x0,'rows':[]};return db[_0x33ca('0x51')][_0x33ca('0x67')]({'where':{'id':_0x575dca[_0x33ca('0x62')]['id']}})[_0x33ca('0x1e')](handleEntityNotFound(_0x154e4f,null))[_0x33ca('0x1e')](function(_0x1b701e){if(_0x1b701e){_0x39a891[_0x33ca('0x46')]=_[_0x33ca('0x44')](db[_0x33ca('0xa0')][_0x33ca('0x3f')]);_0x39a891['query']=_[_0x33ca('0x44')](_0x575dca[_0x33ca('0x43')]);_0x39a891[_0x33ca('0x4d')]=_['intersection'](_0x39a891['model'],_0x39a891['query']);_0x7a6c11['attributes']=_[_0x33ca('0x45')](_0x39a891[_0x33ca('0x46')],qs[_0x33ca('0x48')](_0x575dca['query'][_0x33ca('0x48')]));_0x7a6c11[_0x33ca('0x47')]=_0x7a6c11[_0x33ca('0x47')]['length']?_0x7a6c11[_0x33ca('0x47')]:_0x39a891['model'];if(!_0x575dca['query'][_0x33ca('0x68')]('nolimit')){_0x7a6c11[_0x33ca('0x30')]=qs['limit'](_0x575dca['query'][_0x33ca('0x30')]);_0x7a6c11[_0x33ca('0x2d')]=qs[_0x33ca('0x2d')](_0x575dca['query'][_0x33ca('0x2d')]);}_0x7a6c11[_0x33ca('0x4a')]=qs[_0x33ca('0x4b')](_0x575dca[_0x33ca('0x43')]['sort']);_0x7a6c11[_0x33ca('0x4c')]=qs[_0x33ca('0x4d')](_[_0x33ca('0x69')](_0x575dca[_0x33ca('0x43')],_0x39a891[_0x33ca('0x4d')]));_0x7a6c11['where'][_0x33ca('0x64')]=_0x1b701e['id'];if(_0x575dca[_0x33ca('0x43')]['filter']){_0x7a6c11[_0x33ca('0x4c')]=_['merge'](_0x7a6c11[_0x33ca('0x4c')],{'$or':_[_0x33ca('0x3e')](_0x7a6c11[_0x33ca('0x47')],function(_0x5bfe11){var _0x5e4764={};_0x5e4764[_0x5bfe11]={'$like':'%'+_0x575dca[_0x33ca('0x43')][_0x33ca('0x4e')]+'%'};return _0x5e4764;})});}_0x7a6c11=_['merge']({},_0x7a6c11,_0x575dca[_0x33ca('0x50')]);return db['SmsInteraction']['count']({'where':_0x7a6c11['where']})['then'](function(_0x54ac64){_0x292c20[_0x33ca('0x2f')]=_0x54ac64;if(_0x575dca[_0x33ca('0x43')][_0x33ca('0x57')]){_0x7a6c11[_0x33ca('0x52')]=[{'model':db[_0x33ca('0x76')],'as':_0x33ca('0xc3'),'required':![]},{'model':db[_0x33ca('0xac')],'as':_0x33ca('0xc4'),'attributes':[_0x33ca('0x3b'),_0x33ca('0xc5'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x33ca('0x3b'),'color'],'where':_0x575dca['query']['tag']?{'id':_0x575dca['query'][_0x33ca('0xc6')]}:undefined,'required':_0x575dca['query'][_0x33ca('0xc6')]?!![]:![]}];}return db['SmsInteraction'][_0x33ca('0x6a')](_0x7a6c11);})[_0x33ca('0x1e')](function(_0xbb59b6){_0x292c20[_0x33ca('0x53')]=_0xbb59b6;return _0x292c20;});}})['then'](respondWithFilteredResult(_0x154e4f,_0x7a6c11))[_0x33ca('0x29')](handleError(_0x154e4f,null));};exports[_0x33ca('0xba')]=function(_0x25604a,_0x5b7471,_0x1e8d69){var _0x361020,_0x209d37,_0x4264e4;if(_['isNil'](_0x25604a['body']['body'])||_0x25604a[_0x33ca('0x5a')][_0x33ca('0x5a')]===''){throw new db[(_0x33ca('0x77'))][(_0x33ca('0x97'))](_0x33ca('0xc7'));}if(_['isNil'](_0x25604a[_0x33ca('0x5a')]['to'])){throw new db[(_0x33ca('0x77'))]['ValidationError'](_0x33ca('0xc8'));}_0x361020=_0x25604a['body']['to'];return db['SmsAccount'][_0x33ca('0x58')]({'where':{'id':_0x25604a['params']['id']},'include':[{'model':db[_0x33ca('0x9c')],'as':_0x33ca('0xc9'),'include':[{'model':db[_0x33ca('0x76')],'as':'Contacts','where':{'mobile':_0x361020},'limit':0x1,'order':[[_0x33ca('0x7b'),_0x33ca('0xca')]]}]}]})[_0x33ca('0x1e')](handleEntityNotFound(_0x5b7471,null))['then'](function(_0xc52b50){if(_0xc52b50&&_0xc52b50[_0x33ca('0xc9')]){_0x209d37=_0xc52b50['get']({'plain':!![]});if(_0x209d37['List']&&_0x209d37[_0x33ca('0xc9')][_0x33ca('0x9d')]['length']){return _0x209d37[_0x33ca('0xc9')][_0x33ca('0x9d')][0x0];}return db['CmContact'][_0x33ca('0x59')](_[_0x33ca('0x19')](_0x25604a[_0x33ca('0x5a')],{'firstName':_0x361020,'mobile':_0x361020,'phone':_0x361020,'ListId':_0x209d37[_0x33ca('0x7d')]}));}})['then'](handleEntityNotFound(_0x5b7471,null))['then'](function(_0x14a8b5){if(_0x14a8b5){_0x4264e4=_0x14a8b5;return db[_0x33ca('0xa0')][_0x33ca('0x58')]({'where':{'ContactId':_0x4264e4['id'],'closed':![],'SmsAccountId':_0x209d37['id']}})[_0x33ca('0x1e')](function(_0x457b6d){if(_0x457b6d){return[_0x457b6d,![]];}return db[_0x33ca('0xa0')][_0x33ca('0x59')]({'UserId':_0x25604a[_0x33ca('0x5b')]['id'],'ContactId':_0x4264e4['id'],'SmsAccountId':_0x209d37['id'],'phone':_0x361020,'firstMsgDirection':_0x33ca('0xcb'),'Messages':[_[_0x33ca('0x4f')](_0x25604a[_0x33ca('0x5a')],{'read':![],'body':_0x25604a['body']['body'],'phone':_0x361020,'SmsAccountId':_0x209d37['id'],'UserId':_0x25604a['user']['id'],'ContactId':_0x4264e4['id']})]},{'include':[{'model':db[_0x33ca('0xcc')],'as':_0x33ca('0xcd')}]})[_0x33ca('0x1e')](function(_0x4ec152){return[_0x4ec152,!![]];});});}})[_0x33ca('0xce')](function(_0x46a53f,_0x504457){if(_0x504457){return _0x46a53f;}return db[_0x33ca('0xcc')][_0x33ca('0x59')](_[_0x33ca('0x4f')](_0x25604a[_0x33ca('0x5a')],{'read':![],'body':_0x25604a[_0x33ca('0x5a')][_0x33ca('0x5a')],'phone':_0x361020,'SmsAccountId':_0x209d37['id'],'SmsInteractionId':_0x46a53f['id'],'UserId':_0x25604a[_0x33ca('0x5b')]['id'],'ContactId':_0x4264e4['id']}))[_0x33ca('0x1e')](function(_0x40ef5f){_0x46a53f['dataValues'][_0x33ca('0xcd')]=[];_0x46a53f[_0x33ca('0xcf')][_0x33ca('0xcd')]['push'](_0x40ef5f[_0x33ca('0xcf')]);return _0x46a53f;});})[_0x33ca('0x1e')](respondWithResult(_0x5b7471,null))[_0x33ca('0x29')](handleError(_0x5b7471,null));};exports['status']=function(_0x1b4b4e,_0x945aa2,_0x4ac912){if(_0x1b4b4e[_0x33ca('0x5a')]['id']){delete _0x1b4b4e[_0x33ca('0x5a')]['id'];}var _0x190b6e,_0x5d23cb,_0x48ee5a;return db[_0x33ca('0x51')][_0x33ca('0x58')]({'where':{'id':_0x1b4b4e[_0x33ca('0x62')]['id']}})[_0x33ca('0x1e')](handleEntityNotFound(_0x945aa2,null))[_0x33ca('0x1e')](function(_0x810dcf){if(_0x810dcf){_0x48ee5a=_0x810dcf;logger[_0x33ca('0x21')](_0x33ca('0x22'),'status',_0x33ca('0xd0'),_0x810dcf[_0x33ca('0x41')],util[_0x33ca('0xd1')](_0x1b4b4e[_0x33ca('0x5a')],{'showHidden':![],'depth':null}));switch(_0x810dcf[_0x33ca('0x41')]){case'skebby':if(_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0xd2')]&&_0x1b4b4e[_0x33ca('0x5a')]['status']){_0x5d23cb=_0x1b4b4e['body']['status'];return db[_0x33ca('0xcc')][_0x33ca('0x58')]({'where':{'messageId':_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0xd2')]}});}break;case'connectel':if(_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0xd3')]&&_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0xd4')]){_0x5d23cb=_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0xd4')];return db[_0x33ca('0xcc')]['find']({'where':{'messageId':_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0xd3')]}});}break;case _0x33ca('0xd5'):if(_0x1b4b4e['body'][_0x33ca('0x88')]&&_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0xd6')]){_0x5d23cb=_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0xd6')];return db[_0x33ca('0xcc')][_0x33ca('0x58')]({'where':{'messageId':_0x1b4b4e['body']['message_id']}});}break;case'infobip':var _0x829b28=_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0x8c')][0x0];if(_0x829b28[_0x33ca('0x83')]&&_0x829b28[_0x33ca('0x2b')]['groupName']===_0x33ca('0xd7')){_0x5d23cb=_0x829b28[_0x33ca('0x2b')][_0x33ca('0xd8')];return db[_0x33ca('0xcc')]['find']({'where':{'messageId':_0x829b28[_0x33ca('0x83')]}});}break;case _0x33ca('0x90'):if(_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0x83')]&&_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0x2b')]){_0x5d23cb=_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0x2b')];return db['SmsMessage'][_0x33ca('0x58')]({'where':{'messageId':_0x1b4b4e['body'][_0x33ca('0x83')]}});}break;case _0x33ca('0x93'):if(_0x1b4b4e['body'][0x0][_0x33ca('0x27')]['id']){_0x5d23cb=_0x1b4b4e[_0x33ca('0x5a')][0x0][_0x33ca('0x41')];return db['SmsMessage'][_0x33ca('0x58')]({'where':{'messageId':_0x1b4b4e['body'][0x0][_0x33ca('0x27')]['id']}});}break;case _0x33ca('0x94'):if(_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0xd9')]&&_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0x2b')]){_0x5d23cb=_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0x2b')];return db[_0x33ca('0xcc')][_0x33ca('0x58')]({'where':{'messageId':_0x1b4b4e['body'][_0x33ca('0xd9')]}});}break;}}})[_0x33ca('0x1e')](handleEntityNotFound(_0x945aa2,null))['then'](function(_0x42fac0){if(_0x42fac0){_0x190b6e=_0x42fac0;switch(_0x48ee5a[_0x33ca('0x41')]){case _0x33ca('0x85'):if(_0x5d23cb===_0x33ca('0xd7')){return _0x190b6e[_0x33ca('0x36')]({'read':!![]});}else{logger[_0x33ca('0x24')](_0x33ca('0x22'),_0x33ca('0x2b'),_0x33ca('0x85'),util[_0x33ca('0xd1')](_0x1b4b4e['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x5d23cb==='1'){return _0x190b6e['update']({'read':!![]});}else{logger[_0x33ca('0x24')](_0x33ca('0x22'),_0x33ca('0x2b'),_0x33ca('0x85'),util['inspect'](_0x1b4b4e['body'],{'showHidden':![],'depth':null}));}break;case _0x33ca('0xd5'):if(!_0x1b4b4e['body']['error_code']&&_0x5d23cb>=0xc8&&_0x5d23cb<=0xce){return _0x190b6e[_0x33ca('0x36')]({'read':!![]});}else{logger[_0x33ca('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x33ca('0x2b'),_0x33ca('0xd5'),util['inspect'](_0x1b4b4e[_0x33ca('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x33ca('0x8b'):var _0x3f53df=_0x1b4b4e[_0x33ca('0x5a')][_0x33ca('0x8c')][0x0];if(_0x3f53df[_0x33ca('0x2b')][_0x33ca('0xd8')]===_0x33ca('0xd7')){return _0x190b6e[_0x33ca('0x36')]({'read':!![]});}else{logger[_0x33ca('0x24')](_0x33ca('0x22'),_0x33ca('0x2b'),_0x33ca('0x8b'),util[_0x33ca('0xd1')](_0x1b4b4e[_0x33ca('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x33ca('0x90'):if(_0x5d23cb==_0x33ca('0xda')||_0x5d23cb==_0x33ca('0xdb')){return _0x190b6e['update']({'read':!![]});}else{logger[_0x33ca('0x24')](_0x33ca('0x22'),_0x33ca('0x2b'),_0x33ca('0x90'),util[_0x33ca('0xd1')](_0x1b4b4e[_0x33ca('0x5a')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x5d23cb==_0x33ca('0xdc')){return _0x190b6e['update']({'read':!![]});}else{logger[_0x33ca('0x24')](_0x33ca('0x22'),'status',_0x33ca('0x93'),util[_0x33ca('0xd1')](_0x1b4b4e[_0x33ca('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x33ca('0x94'):if(_0x5d23cb==='DELIVRD'||_0x5d23cb===_0x33ca('0xdd')){return _0x190b6e['update']({'read':!![]});}else{logger[_0x33ca('0x24')](_0x33ca('0x22'),_0x33ca('0x2b'),_0x33ca('0x94'),util[_0x33ca('0xd1')](_0x1b4b4e[_0x33ca('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x190b6e;}})[_0x33ca('0x1e')](respondWithResult(_0x945aa2,null))['catch'](handleError(_0x945aa2,null));};exports[_0x33ca('0xde')]=function(_0x6e1ce3,_0x29d1dd,_0x400a03){var _0x429fc1,_0x10a75c,_0x98997f;return db[_0x33ca('0x51')][_0x33ca('0x58')]({'where':{'id':_0x6e1ce3[_0x33ca('0x62')]['id']}})[_0x33ca('0x1e')](handleEntityNotFound(_0x29d1dd,null))[_0x33ca('0x1e')](function(_0x203cc5){if(_0x203cc5){_0x98997f=_0x203cc5;logger[_0x33ca('0x21')](_0x33ca('0x22'),_0x33ca('0x2b'),_0x33ca('0xd0'),_0x203cc5['type'],util[_0x33ca('0xd1')](_0x6e1ce3[_0x33ca('0x43')],{'showHidden':![],'depth':null}));switch(_0x203cc5[_0x33ca('0x41')]){case _0x33ca('0x8d'):if(_0x6e1ce3['query'][_0x33ca('0xdf')]&&_0x6e1ce3[_0x33ca('0x43')]['state']){_0x10a75c=_0x6e1ce3[_0x33ca('0x43')][_0x33ca('0xe0')];return db[_0x33ca('0xcc')][_0x33ca('0x58')]({'where':{'messageId':_0x6e1ce3['query'][_0x33ca('0xdf')]}});}break;}}})[_0x33ca('0x1e')](handleEntityNotFound(_0x29d1dd,null))[_0x33ca('0x1e')](function(_0x26275b){if(_0x26275b){_0x429fc1=_0x26275b;switch(_0x98997f[_0x33ca('0x41')]){case _0x33ca('0x8d'):if(_0x10a75c==='2'||_0x10a75c==='6'){return _0x429fc1[_0x33ca('0x36')]({'read':!![]});}else{logger[_0x33ca('0x24')](_0x33ca('0x22'),_0x33ca('0x2b'),'csc',util[_0x33ca('0xd1')](_0x6e1ce3[_0x33ca('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x429fc1;}})['then'](respondWithResult(_0x29d1dd,null))['catch'](handleError(_0x29d1dd,null));};exports[_0x33ca('0xe1')]=function(_0x2d9ffb,_0x2898c5,_0x52bbbf){return db[_0x33ca('0x51')][_0x33ca('0x58')]({'where':{'id':_0x2d9ffb[_0x33ca('0x62')]['id']}})[_0x33ca('0x1e')](handleEntityNotFound(_0x2898c5,null))[_0x33ca('0x1e')](function(_0x21ea13){if(_0x21ea13){return _0x21ea13['addAgents'](_0x2d9ffb[_0x33ca('0x5a')][_0x33ca('0x6c')],_['omit'](_0x2d9ffb[_0x33ca('0x5a')],[_0x33ca('0x6c'),'id'])||{})['spread'](function(_0x2ea75d){for(var _0x3b4b4c=0x0;_0x3b4b4c<_0x2d9ffb[_0x33ca('0x5a')][_0x33ca('0x6c')][_0x33ca('0x56')];_0x3b4b4c+=0x1){socket[_0x33ca('0xe2')]('userSmsAccount:save',{'UserId':Number(_0x2d9ffb['body'][_0x33ca('0x6c')][_0x3b4b4c]),'SmsAccountId':Number(_0x2d9ffb[_0x33ca('0x62')]['id'])});}return _0x2ea75d;});}})['then'](respondWithResult(_0x2898c5,null))[_0x33ca('0x29')](handleError(_0x2898c5,null));};exports[_0x33ca('0xe3')]=function(_0x96681d,_0x21bdce,_0x59a1e2){return db[_0x33ca('0x51')]['find']({'where':{'id':_0x96681d[_0x33ca('0x62')]['id']}})[_0x33ca('0x1e')](handleEntityNotFound(_0x21bdce,null))['then'](function(_0x3828f2){if(_0x3828f2){return _0x3828f2['removeAgents'](_0x96681d[_0x33ca('0x43')][_0x33ca('0x6c')])[_0x33ca('0x1e')](function(){if(_['isArray'](_0x96681d[_0x33ca('0x43')][_0x33ca('0x6c')])){for(var _0x22cc83=0x0;_0x22cc83<_0x96681d[_0x33ca('0x43')][_0x33ca('0x6c')]['length'];_0x22cc83+=0x1){socket[_0x33ca('0xe2')](_0x33ca('0xe4'),{'UserId':Number(_0x96681d[_0x33ca('0x43')][_0x33ca('0x6c')][_0x22cc83]),'SmsAccountId':Number(_0x96681d['params']['id'])});}}else{socket[_0x33ca('0xe2')](_0x33ca('0xe4'),{'UserId':Number(_0x96681d[_0x33ca('0x43')][_0x33ca('0x6c')]),'SmsAccountId':Number(_0x96681d['params']['id'])});}});}})[_0x33ca('0x1e')](respondWithStatusCode(_0x21bdce,null))[_0x33ca('0x29')](handleError(_0x21bdce,null));};exports[_0x33ca('0xe5')]=function(_0x12b595,_0x177eba,_0x54aedb){var _0x168b86={};var _0x46f484={};var _0x3bff6e;var _0x3896aa;return db[_0x33ca('0x51')][_0x33ca('0x67')]({'where':{'id':_0x12b595[_0x33ca('0x62')]['id']}})[_0x33ca('0x1e')](handleEntityNotFound(_0x177eba,null))[_0x33ca('0x1e')](function(_0x2c6eb5){if(_0x2c6eb5){_0x3bff6e=_0x2c6eb5;_0x46f484[_0x33ca('0x46')]=_[_0x33ca('0x44')](db['User'][_0x33ca('0x3f')]);_0x46f484[_0x33ca('0x43')]=_['keys'](_0x12b595[_0x33ca('0x43')]);_0x46f484[_0x33ca('0x4d')]=_[_0x33ca('0x45')](_0x46f484['model'],_0x46f484['query']);_0x168b86[_0x33ca('0x47')]=_['intersection'](_0x46f484[_0x33ca('0x46')],qs['fields'](_0x12b595[_0x33ca('0x43')][_0x33ca('0x48')]));_0x168b86['attributes']=_0x168b86[_0x33ca('0x47')][_0x33ca('0x56')]?_0x168b86['attributes']:_0x46f484[_0x33ca('0x46')];_0x168b86['order']=qs['sort'](_0x12b595[_0x33ca('0x43')][_0x33ca('0x4b')]);_0x168b86[_0x33ca('0x4c')]=qs[_0x33ca('0x4d')](_[_0x33ca('0x69')](_0x12b595['query'],_0x46f484[_0x33ca('0x4d')]));if(_0x12b595['query']['filter']){_0x168b86[_0x33ca('0x4c')]=_[_0x33ca('0x4f')](_0x168b86[_0x33ca('0x4c')],{'$or':_['map'](_0x168b86[_0x33ca('0x47')],function(_0xd18cfb){var _0x561957={};_0x561957[_0xd18cfb]={'$like':'%'+_0x12b595[_0x33ca('0x43')][_0x33ca('0x4e')]+'%'};return _0x561957;})});}_0x168b86=_['merge']({},_0x168b86,_0x12b595[_0x33ca('0x50')]);return _0x3bff6e[_0x33ca('0xe5')](_0x168b86);}})[_0x33ca('0x1e')](function(_0x1e3020){if(_0x1e3020){_0x3896aa=_0x1e3020['length'];if(!_0x12b595['query']['hasOwnProperty'](_0x33ca('0x49'))){_0x168b86[_0x33ca('0x30')]=qs['limit'](_0x12b595[_0x33ca('0x43')]['limit']);_0x168b86[_0x33ca('0x2d')]=qs[_0x33ca('0x2d')](_0x12b595['query'][_0x33ca('0x2d')]);}return _0x3bff6e[_0x33ca('0xe5')](_0x168b86);}})[_0x33ca('0x1e')](function(_0x814302){if(_0x814302){return _0x814302?{'count':_0x3896aa,'rows':_0x814302}:null;}})[_0x33ca('0x1e')](respondWithResult(_0x177eba,null))[_0x33ca('0x29')](handleError(_0x177eba,null));}; \ No newline at end of file +var _0x9993=['ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','notify','SmsApplication','Applications','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','text','connectel','clicksend','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','fromNumber','bandwidth','intelepeer','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','spread','interaction','created','autoclose','applications','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','findAndCountAll','finally','getApplications','getInteractions','SmsInteraction','Contact','Owner','fullname','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','Messages','dataValues','push','inspect','skebby','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','groupName','DELIVERED','clickatell','redif','error_code','DELIVRD','statusGet','received\x20delivery\x20report\x20from','message-id','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','end','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','SmsAccount','findAll','rows','catch','params','Pause','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','SmsAccountId','Disposition','getDispositions'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x9993,0x7e));var _0x3999=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x9993[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0x3999('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3999('0x1'));var jsonpatch=require(_0x3999('0x2'));var rp=require(_0x3999('0x3'));var moment=require(_0x3999('0x4'));var BPromise=require(_0x3999('0x5'));var Mustache=require(_0x3999('0x6'));var util=require(_0x3999('0x7'));var path=require(_0x3999('0x8'));var sox=require(_0x3999('0x9'));var csv=require(_0x3999('0xa'));var ejs=require(_0x3999('0xb'));var fs=require('fs');var fs_extra=require(_0x3999('0xc'));var _=require('lodash');var squel=require(_0x3999('0xd'));var crypto=require(_0x3999('0xe'));var jsforce=require(_0x3999('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3999('0xa'));var querystring=require(_0x3999('0x10'));var Papa=require(_0x3999('0x11'));var Redis=require('ioredis');var authService=require(_0x3999('0x12'));var qs=require(_0x3999('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3999('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3999('0x15'));var db=require(_0x3999('0x16'))['db'];config['redis']=_[_0x3999('0x17')](config[_0x3999('0x18')],{'host':_0x3999('0x19'),'port':0x18eb});var socket=require(_0x3999('0x1a'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x3999('0x1b')](socket);var jayson=require(_0x3999('0x1c'));var client=jayson[_0x3999('0x1d')][_0x3999('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0xcc794f,_0x3297e6,_0x41d8d7,_0x4f1665){return new BPromise(function(_0x29ba9e,_0x223aee){var _0x1032b2=_0x4f1665||client;return _0x1032b2['request'](_0xcc794f,_0x41d8d7)[_0x3999('0x1f')](function(_0x1f370a){logger[_0x3999('0x20')](_0x3999('0x21'),_0x3297e6,_0x3999('0x22'));logger[_0x3999('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3297e6,_0x3999('0x22'),JSON['stringify'](_0x1f370a));if(_0x1f370a[_0x3999('0x24')]){if(_0x1f370a['error']['code']===0x1f4){logger[_0x3999('0x24')](_0x3999('0x21'),_0x3297e6,_0x1f370a[_0x3999('0x24')][_0x3999('0x25')]);return _0x223aee(_0x1f370a[_0x3999('0x24')][_0x3999('0x25')]);}logger[_0x3999('0x24')](_0x3999('0x21'),_0x3297e6,_0x1f370a[_0x3999('0x24')]['message']);return _0x29ba9e(_0x1f370a[_0x3999('0x24')][_0x3999('0x25')]);}else{logger[_0x3999('0x20')](_0x3999('0x21'),_0x3297e6,'request\x20sent');_0x29ba9e(_0x1f370a['result'][_0x3999('0x25')]);}})['catch'](function(_0x46da38){logger[_0x3999('0x24')](_0x3999('0x21'),_0x3297e6,_0x46da38);_0x223aee(_0x46da38);});});}function respondWithStatusCode(_0x2ff9d9,_0xcdbda2){_0xcdbda2=_0xcdbda2||0xcc;return function(_0x4ce891){if(_0x4ce891){return _0x2ff9d9['sendStatus'](_0xcdbda2);}return _0x2ff9d9['status'](_0xcdbda2)['end']();};}function respondWithResult(_0x17260f,_0x3d5f01){_0x3d5f01=_0x3d5f01||0xc8;return function(_0x59b270){if(_0x59b270){return _0x17260f[_0x3999('0x26')](_0x3d5f01)[_0x3999('0x27')](_0x59b270);}};}function respondWithFilteredResult(_0x3c9804,_0x441d87){return function(_0x54b34a){if(_0x54b34a){var _0x572df7=typeof _0x441d87[_0x3999('0x28')]==='undefined'&&typeof _0x441d87[_0x3999('0x29')]===_0x3999('0x2a');var _0x5715e3=_0x54b34a[_0x3999('0x2b')];var _0x1b51bf=_0x572df7?0x0:_0x441d87[_0x3999('0x28')];var _0x1a136f=_0x572df7?_0x54b34a[_0x3999('0x2b')]:_0x441d87['offset']+_0x441d87['limit'];var _0x58b0e3;if(_0x1a136f>=_0x5715e3){_0x1a136f=_0x5715e3;_0x58b0e3=0xc8;}else{_0x58b0e3=0xce;}_0x3c9804[_0x3999('0x26')](_0x58b0e3);return _0x3c9804['set'](_0x3999('0x2c'),_0x1b51bf+'-'+_0x1a136f+'/'+_0x5715e3)[_0x3999('0x27')](_0x54b34a);}return null;};}function patchUpdates(_0x400ce4){return function(_0xfca534){try{jsonpatch[_0x3999('0x2d')](_0xfca534,_0x400ce4,!![]);}catch(_0x53198c){return BPromise[_0x3999('0x2e')](_0x53198c);}return _0xfca534[_0x3999('0x2f')]();};}function saveUpdates(_0x305800,_0x535c7a){return function(_0x5bb483){if(_0x5bb483){return _0x5bb483[_0x3999('0x30')](_0x305800)[_0x3999('0x1f')](function(_0x49fe8e){return _0x49fe8e;});}return null;};}function removeEntity(_0x9ad039,_0x222136){return function(_0x136744){if(_0x136744){return _0x136744[_0x3999('0x31')]()['then'](function(){var _0x1dda7e=_0x136744[_0x3999('0x32')]({'plain':!![]});var _0x2dcb30=_0x3999('0x33');return db['UserProfileResource'][_0x3999('0x31')]({'where':{'type':_0x2dcb30,'resourceId':_0x1dda7e['id']}})['then'](function(){return _0x136744;});})[_0x3999('0x1f')](function(){_0x9ad039[_0x3999('0x26')](0xcc)[_0x3999('0x34')]();});}};}function handleEntityNotFound(_0x2fd101,_0x2d1cef){return function(_0x54a5d8){if(!_0x54a5d8){_0x2fd101[_0x3999('0x35')](0x194);}return _0x54a5d8;};}function handleError(_0x5bbfcf,_0x2c8eae){_0x2c8eae=_0x2c8eae||0x1f4;return function(_0x14880e){logger[_0x3999('0x24')](_0x14880e[_0x3999('0x36')]);if(_0x14880e[_0x3999('0x37')]){delete _0x14880e[_0x3999('0x37')];}_0x5bbfcf[_0x3999('0x26')](_0x2c8eae)[_0x3999('0x38')](_0x14880e);};}exports[_0x3999('0x39')]=function(_0x4f419a,_0x27b07e){var _0x3ff61e={'include':[{'model':db['Pause'],'as':_0x3999('0x3a')}]},_0x4a5065={},_0x530e39={'count':0x0,'rows':[]};var _0x5e0e69=_[_0x3999('0x3b')](db['SmsAccount'][_0x3999('0x3c')],function(_0x47a23d){return{'name':_0x47a23d[_0x3999('0x3d')],'type':_0x47a23d[_0x3999('0x3e')]['key']};});_0x4a5065[_0x3999('0x3f')]=_[_0x3999('0x3b')](_0x5e0e69,_0x3999('0x37'));_0x4a5065['query']=_[_0x3999('0x40')](_0x4f419a[_0x3999('0x41')]);_0x4a5065[_0x3999('0x42')]=_['intersection'](_0x4a5065[_0x3999('0x3f')],_0x4a5065['query']);_0x3ff61e['attributes']=_[_0x3999('0x43')](_0x4a5065[_0x3999('0x3f')],qs[_0x3999('0x44')](_0x4f419a[_0x3999('0x41')]['fields']));_0x3ff61e['attributes']=_0x3ff61e[_0x3999('0x45')][_0x3999('0x46')]?_0x3ff61e[_0x3999('0x45')]:_0x4a5065[_0x3999('0x3f')];if(!_0x4f419a['query'][_0x3999('0x47')](_0x3999('0x48'))){_0x3ff61e[_0x3999('0x29')]=qs['limit'](_0x4f419a['query'][_0x3999('0x29')]);_0x3ff61e[_0x3999('0x28')]=qs[_0x3999('0x28')](_0x4f419a['query'][_0x3999('0x28')]);}_0x3ff61e[_0x3999('0x49')]=qs[_0x3999('0x4a')](_0x4f419a[_0x3999('0x41')][_0x3999('0x4a')]);_0x3ff61e['where']=qs[_0x3999('0x42')](_['pick'](_0x4f419a[_0x3999('0x41')],_0x4a5065[_0x3999('0x42')]),_0x5e0e69);if(_0x4f419a['query'][_0x3999('0x4b')]){_0x3ff61e['where']=_[_0x3999('0x4c')](_0x3ff61e[_0x3999('0x4d')],{'$or':_[_0x3999('0x3b')](_0x5e0e69,function(_0x55ea75){if(_0x55ea75[_0x3999('0x3e')]!==_0x3999('0x4e')){var _0x4a0dce={};_0x4a0dce[_0x55ea75[_0x3999('0x37')]]={'$like':'%'+_0x4f419a[_0x3999('0x41')]['filter']+'%'};return _0x4a0dce;}})});}_0x3ff61e=_[_0x3999('0x4c')]({},_0x3ff61e,_0x4f419a[_0x3999('0x4f')]);var _0x485e10={'where':_0x3ff61e[_0x3999('0x4d')]};return db[_0x3999('0x50')]['count'](_0x485e10)['then'](function(_0x4172fb){_0x530e39[_0x3999('0x2b')]=_0x4172fb;if(_0x4f419a[_0x3999('0x41')]['includeAll']){_0x3ff61e['include']=[{'all':!![]}];}return db['SmsAccount'][_0x3999('0x51')](_0x3ff61e);})[_0x3999('0x1f')](function(_0x17f8e6){_0x530e39[_0x3999('0x52')]=_0x17f8e6;return _0x530e39;})[_0x3999('0x1f')](respondWithFilteredResult(_0x27b07e,_0x3ff61e))[_0x3999('0x53')](handleError(_0x27b07e,null));};exports['show']=function(_0x1ce097,_0x15b043){var _0x3a6cb5={'raw':![],'where':{'id':_0x1ce097[_0x3999('0x54')]['id']},'include':[{'model':db[_0x3999('0x55')],'as':_0x3999('0x3a')}]},_0x2b739f={};_0x2b739f[_0x3999('0x3f')]=_[_0x3999('0x40')](db[_0x3999('0x50')][_0x3999('0x3c')]);_0x2b739f['query']=_[_0x3999('0x40')](_0x1ce097[_0x3999('0x41')]);_0x2b739f['filters']=_[_0x3999('0x43')](_0x2b739f[_0x3999('0x3f')],_0x2b739f[_0x3999('0x41')]);_0x3a6cb5[_0x3999('0x45')]=_[_0x3999('0x43')](_0x2b739f[_0x3999('0x3f')],qs['fields'](_0x1ce097[_0x3999('0x41')][_0x3999('0x44')]));_0x3a6cb5[_0x3999('0x45')]=_0x3a6cb5['attributes'][_0x3999('0x46')]?_0x3a6cb5['attributes']:_0x2b739f[_0x3999('0x3f')];if(_0x1ce097[_0x3999('0x41')][_0x3999('0x56')]){_0x3a6cb5[_0x3999('0x57')]=[{'all':!![]}];}_0x3a6cb5=_[_0x3999('0x4c')]({},_0x3a6cb5,_0x1ce097[_0x3999('0x4f')]);return db[_0x3999('0x50')]['find'](_0x3a6cb5)['then'](handleEntityNotFound(_0x15b043,null))[_0x3999('0x1f')](respondWithResult(_0x15b043,null))['catch'](handleError(_0x15b043,null));};exports[_0x3999('0x58')]=function(_0x37315f,_0x534dc4){return db['SmsAccount']['create'](_0x37315f[_0x3999('0x59')],{})[_0x3999('0x1f')](function(_0x48255b){var _0x4b0869=_0x37315f[_0x3999('0x5a')]['get']({'plain':!![]});if(!_0x4b0869)throw new Error(_0x3999('0x5b'));if(_0x4b0869['role']==='user'){var _0xfbe57a=_0x48255b[_0x3999('0x32')]({'plain':!![]});var _0x229844='SmsAccounts';return db[_0x3999('0x5c')][_0x3999('0x5d')]({'where':{'name':_0x229844,'userProfileId':_0x4b0869[_0x3999('0x5e')]},'raw':!![]})[_0x3999('0x1f')](function(_0x3e01c8){if(_0x3e01c8&&_0x3e01c8[_0x3999('0x5f')]===0x0){return db[_0x3999('0x60')][_0x3999('0x58')]({'name':_0xfbe57a[_0x3999('0x37')],'resourceId':_0xfbe57a['id'],'type':_0x3e01c8[_0x3999('0x37')],'sectionId':_0x3e01c8['id']},{})[_0x3999('0x1f')](function(){return _0x48255b;});}else{return _0x48255b;}})[_0x3999('0x53')](function(_0x596449){logger[_0x3999('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x596449);throw _0x596449;});}return _0x48255b;})[_0x3999('0x1f')](respondWithResult(_0x534dc4,0xc9))['catch'](handleError(_0x534dc4,null));};exports[_0x3999('0x30')]=function(_0x30859d,_0x365435){if(_0x30859d[_0x3999('0x59')]['id']){delete _0x30859d[_0x3999('0x59')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x30859d[_0x3999('0x54')]['id']},'include':[{'model':db[_0x3999('0x55')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x365435,null))[_0x3999('0x1f')](saveUpdates(_0x30859d['body'],null))[_0x3999('0x1f')](respondWithResult(_0x365435,null))[_0x3999('0x53')](handleError(_0x365435,null));};exports[_0x3999('0x31')]=function(_0x44aa7a,_0x141f02){return db[_0x3999('0x50')][_0x3999('0x5d')]({'where':{'id':_0x44aa7a['params']['id']}})[_0x3999('0x1f')](handleEntityNotFound(_0x141f02,null))[_0x3999('0x1f')](removeEntity(_0x141f02,null))[_0x3999('0x53')](handleError(_0x141f02,null));};exports[_0x3999('0x61')]=function(_0xd15372,_0x380907){return db[_0x3999('0x50')][_0x3999('0x61')]()[_0x3999('0x1f')](respondWithResult(_0x380907,null))[_0x3999('0x53')](handleError(_0x380907,null));};exports[_0x3999('0x62')]=function(_0x40d8c8,_0x557f76,_0x11b200){if(_0x40d8c8[_0x3999('0x59')]['id']){delete _0x40d8c8['body']['id'];}return db['SmsAccount'][_0x3999('0x5d')]({'where':{'id':_0x40d8c8[_0x3999('0x54')]['id']}})[_0x3999('0x1f')](handleEntityNotFound(_0x557f76,null))['then'](function(_0x1fe887){if(_0x1fe887){_0x40d8c8[_0x3999('0x59')][_0x3999('0x63')]=_0x1fe887['id'];return db[_0x3999('0x64')]['create'](_0x40d8c8['body']);}})['then'](respondWithResult(_0x557f76,null))[_0x3999('0x53')](handleError(_0x557f76,null));};exports[_0x3999('0x65')]=function(_0x48c04e,_0x195e58,_0x3cf1cf){var _0x512bfa={'raw':![],'where':{}};var _0xbb5aa4={};var _0x26e94a={'count':0x0,'rows':[]};return db[_0x3999('0x50')]['findOne']({'where':{'id':_0x48c04e[_0x3999('0x54')]['id']}})[_0x3999('0x1f')](handleEntityNotFound(_0x195e58,null))[_0x3999('0x1f')](function(_0x4fd9da){if(_0x4fd9da){_0xbb5aa4[_0x3999('0x3f')]=_[_0x3999('0x40')](db[_0x3999('0x64')][_0x3999('0x3c')]);_0xbb5aa4[_0x3999('0x41')]=_['keys'](_0x48c04e[_0x3999('0x41')]);_0xbb5aa4[_0x3999('0x42')]=_[_0x3999('0x43')](_0xbb5aa4[_0x3999('0x3f')],_0xbb5aa4[_0x3999('0x41')]);_0x512bfa[_0x3999('0x45')]=_[_0x3999('0x43')](_0xbb5aa4[_0x3999('0x3f')],qs['fields'](_0x48c04e[_0x3999('0x41')][_0x3999('0x44')]));_0x512bfa['attributes']=_0x512bfa[_0x3999('0x45')][_0x3999('0x46')]?_0x512bfa[_0x3999('0x45')]:_0xbb5aa4[_0x3999('0x3f')];if(!_0x48c04e[_0x3999('0x41')][_0x3999('0x47')](_0x3999('0x48'))){_0x512bfa[_0x3999('0x29')]=qs[_0x3999('0x29')](_0x48c04e[_0x3999('0x41')][_0x3999('0x29')]);_0x512bfa[_0x3999('0x28')]=qs[_0x3999('0x28')](_0x48c04e[_0x3999('0x41')]['offset']);}_0x512bfa['order']=qs[_0x3999('0x4a')](_0x48c04e[_0x3999('0x41')][_0x3999('0x4a')]);_0x512bfa[_0x3999('0x4d')]=qs[_0x3999('0x42')](_['pick'](_0x48c04e[_0x3999('0x41')],_0xbb5aa4['filters']));_0x512bfa[_0x3999('0x4d')]['SmsAccountId']=_0x4fd9da['id'];if(_0x48c04e[_0x3999('0x41')][_0x3999('0x4b')]){_0x512bfa[_0x3999('0x4d')]=_[_0x3999('0x4c')](_0x512bfa[_0x3999('0x4d')],{'$or':_[_0x3999('0x3b')](_0x512bfa[_0x3999('0x45')],function(_0x4115f8){var _0x5d714b={};_0x5d714b[_0x4115f8]={'$like':'%'+_0x48c04e['query'][_0x3999('0x4b')]+'%'};return _0x5d714b;})});}_0x512bfa=_[_0x3999('0x4c')]({},_0x512bfa,_0x48c04e[_0x3999('0x4f')]);return db[_0x3999('0x64')][_0x3999('0x2b')]({'where':_0x512bfa[_0x3999('0x4d')]})['then'](function(_0x147602){_0x26e94a[_0x3999('0x2b')]=_0x147602;if(_0x48c04e[_0x3999('0x41')][_0x3999('0x56')]){_0x512bfa['include']=[{'all':!![]}];}return db[_0x3999('0x64')]['findAll'](_0x512bfa);})[_0x3999('0x1f')](function(_0x7d02a9){_0x26e94a[_0x3999('0x52')]=_0x7d02a9;return _0x26e94a;});}})[_0x3999('0x1f')](respondWithFilteredResult(_0x195e58,_0x512bfa))[_0x3999('0x53')](handleError(_0x195e58,null));};exports['removeDispositions']=function(_0x143c0f,_0x25ce1d,_0x3ac1b6){return db[_0x3999('0x50')][_0x3999('0x5d')]({'where':{'id':_0x143c0f[_0x3999('0x54')]['id']}})['then'](handleEntityNotFound(_0x25ce1d,null))[_0x3999('0x1f')](function(_0x5b9d17){if(_0x5b9d17){return _0x5b9d17['removeDispositions'](_0x143c0f['query'][_0x3999('0x66')]);}})[_0x3999('0x1f')](respondWithStatusCode(_0x25ce1d,null))['catch'](handleError(_0x25ce1d,null));};exports[_0x3999('0x67')]=function(_0x573bbc,_0x1b88ff,_0x28414c){if(_0x573bbc[_0x3999('0x59')]['id']){delete _0x573bbc[_0x3999('0x59')]['id'];}return db['SmsAccount'][_0x3999('0x5d')]({'where':{'id':_0x573bbc[_0x3999('0x54')]['id']}})[_0x3999('0x1f')](handleEntityNotFound(_0x1b88ff,null))['then'](function(_0x47ed84){if(_0x47ed84){_0x573bbc['body'][_0x3999('0x63')]=_0x47ed84['id'];return db[_0x3999('0x68')][_0x3999('0x58')](_0x573bbc['body']);}})['then'](respondWithResult(_0x1b88ff,null))[_0x3999('0x53')](handleError(_0x1b88ff,null));};exports[_0x3999('0x69')]=function(_0x238fb3,_0x418a46,_0xd613b6){var _0x5da30e={'raw':![],'where':{}};var _0x2760f8={};var _0x3ebeec={'count':0x0,'rows':[]};return db[_0x3999('0x50')]['findOne']({'where':{'id':_0x238fb3[_0x3999('0x54')]['id']}})[_0x3999('0x1f')](handleEntityNotFound(_0x418a46,null))['then'](function(_0x222113){if(_0x222113){_0x2760f8[_0x3999('0x3f')]=_['keys'](db[_0x3999('0x68')][_0x3999('0x3c')]);_0x2760f8['query']=_['keys'](_0x238fb3[_0x3999('0x41')]);_0x2760f8[_0x3999('0x42')]=_[_0x3999('0x43')](_0x2760f8[_0x3999('0x3f')],_0x2760f8[_0x3999('0x41')]);_0x5da30e['attributes']=_[_0x3999('0x43')](_0x2760f8[_0x3999('0x3f')],qs[_0x3999('0x44')](_0x238fb3[_0x3999('0x41')][_0x3999('0x44')]));_0x5da30e[_0x3999('0x45')]=_0x5da30e[_0x3999('0x45')][_0x3999('0x46')]?_0x5da30e['attributes']:_0x2760f8[_0x3999('0x3f')];if(!_0x238fb3[_0x3999('0x41')][_0x3999('0x47')](_0x3999('0x48'))){_0x5da30e['limit']=qs['limit'](_0x238fb3[_0x3999('0x41')][_0x3999('0x29')]);_0x5da30e[_0x3999('0x28')]=qs[_0x3999('0x28')](_0x238fb3['query'][_0x3999('0x28')]);}_0x5da30e[_0x3999('0x49')]=qs[_0x3999('0x4a')](_0x238fb3[_0x3999('0x41')][_0x3999('0x4a')]);_0x5da30e[_0x3999('0x4d')]=qs[_0x3999('0x42')](_[_0x3999('0x6a')](_0x238fb3[_0x3999('0x41')],_0x2760f8['filters']));_0x5da30e[_0x3999('0x4d')]['SmsAccountId']=_0x222113['id'];if(_0x238fb3[_0x3999('0x41')][_0x3999('0x4b')]){_0x5da30e['where']=_[_0x3999('0x4c')](_0x5da30e[_0x3999('0x4d')],{'$or':_[_0x3999('0x3b')](_0x5da30e[_0x3999('0x45')],function(_0x199aa8){var _0x2a49bc={};_0x2a49bc[_0x199aa8]={'$like':'%'+_0x238fb3[_0x3999('0x41')]['filter']+'%'};return _0x2a49bc;})});}_0x5da30e=_[_0x3999('0x4c')]({},_0x5da30e,_0x238fb3[_0x3999('0x4f')]);return db['CannedAnswer'][_0x3999('0x2b')]({'where':_0x5da30e[_0x3999('0x4d')]})[_0x3999('0x1f')](function(_0x34d545){_0x3ebeec[_0x3999('0x2b')]=_0x34d545;if(_0x238fb3[_0x3999('0x41')][_0x3999('0x56')]){_0x5da30e[_0x3999('0x57')]=[{'all':!![]}];}return db[_0x3999('0x68')][_0x3999('0x51')](_0x5da30e);})['then'](function(_0x13a291){_0x3ebeec['rows']=_0x13a291;return _0x3ebeec;});}})[_0x3999('0x1f')](respondWithFilteredResult(_0x418a46,_0x5da30e))[_0x3999('0x53')](handleError(_0x418a46,null));};exports[_0x3999('0x6b')]=function(_0x1163cf,_0x3f51c7,_0x183f9a){return db[_0x3999('0x50')][_0x3999('0x5d')]({'where':{'id':_0x1163cf['params']['id']}})['then'](handleEntityNotFound(_0x3f51c7,null))[_0x3999('0x1f')](function(_0x2f186e){if(_0x2f186e){return _0x2f186e[_0x3999('0x6b')](_0x1163cf[_0x3999('0x41')][_0x3999('0x66')]);}})[_0x3999('0x1f')](respondWithStatusCode(_0x3f51c7,null))[_0x3999('0x53')](handleError(_0x3f51c7,null));};exports[_0x3999('0x6c')]=function(_0x5a70ae,_0x38337e,_0x51f251){var _0x486942={'channel':'sms'};var _0x27f1e4=[];var _0x1a6b89=[];var _0x342c17={};return db[_0x3999('0x50')][_0x3999('0x5d')]({'where':{'id':_0x5a70ae[_0x3999('0x54')]['id']},'include':[{'model':db[_0x3999('0x6d')],'as':_0x3999('0x6e')}]})[_0x3999('0x1f')](handleEntityNotFound(_0x38337e,null))['then'](function(_0x57bcc1){_0x486942['account']=_0x57bcc1;_0x486942['applications']=_['orderBy'](_0x57bcc1[_0x3999('0x6e')],[_0x3999('0x6f')],[_0x3999('0x70')]);if(_0x486942[_0x3999('0x71')][_0x3999('0x6e')]){delete _0x486942[_0x3999('0x71')][_0x3999('0x6e')];}return db[_0x3999('0x72')][_0x3999('0x61')]();})[_0x3999('0x1f')](function(_0x517369){if(!_0x517369){throw new db[(_0x3999('0x73'))][(_0x3999('0x74'))](_0x3999('0x75'));}_0x27f1e4=_['difference'](_[_0x3999('0x40')](_0x517369),[_0x3999('0x76'),_0x3999('0x77')]);_0x1a6b89=_['difference'](_['keys'](_0x517369),[_0x3999('0x76'),'updatedAt',_0x3999('0x78'),_0x3999('0x79')]);_0x486942[_0x3999('0x59')]={'mapKey':_0x3999('0x7a')};if(_0x486942[_0x3999('0x71')][_0x3999('0x3e')]){switch(_0x486942[_0x3999('0x71')][_0x3999('0x3e')]){case'twilio':_0x486942[_0x3999('0x59')][_0x3999('0x7b')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x7c')];_0x486942['body'][_0x3999('0x59')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x7d')];_0x486942[_0x3999('0x59')][_0x3999('0x7e')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x7f')];break;case'skebby':_0x486942[_0x3999('0x59')][_0x3999('0x7b')]='+'+_0x5a70ae['body']['sender'];_0x486942[_0x3999('0x59')][_0x3999('0x59')]=_0x5a70ae['body'][_0x3999('0x80')];break;case _0x3999('0x81'):_0x486942['body'][_0x3999('0x7b')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x7b')];_0x486942[_0x3999('0x59')][_0x3999('0x59')]=_0x5a70ae['body'][_0x3999('0x25')];break;case _0x3999('0x82'):_0x486942[_0x3999('0x59')][_0x3999('0x7b')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x7b')];_0x486942['body'][_0x3999('0x59')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x59')];_0x486942[_0x3999('0x59')]['messageId']=_0x5a70ae[_0x3999('0x59')]['message_id'];break;case'plivo':_0x486942[_0x3999('0x59')][_0x3999('0x7b')]=_0x5a70ae['body']['From'];_0x486942[_0x3999('0x59')]['body']=_0x5a70ae[_0x3999('0x59')][_0x3999('0x83')];_0x486942[_0x3999('0x59')][_0x3999('0x7e')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x84')];break;case'infobip':_0x486942[_0x3999('0x59')][_0x3999('0x7b')]='+'+_0x5a70ae[_0x3999('0x59')][_0x3999('0x85')][0x0][_0x3999('0x7b')];_0x486942['body'][_0x3999('0x59')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x85')][0x0][_0x3999('0x80')];_0x486942[_0x3999('0x59')][_0x3999('0x7e')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x85')][0x0][_0x3999('0x7e')];break;case _0x3999('0x86'):_0x486942[_0x3999('0x59')][_0x3999('0x7b')]=_0x5a70ae['body'][_0x3999('0x87')];_0x486942[_0x3999('0x59')][_0x3999('0x59')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x88')][_0x3999('0x25')];break;case'clickatell':_0x486942[_0x3999('0x59')]['from']=_0x5a70ae['body'][_0x3999('0x89')];_0x486942[_0x3999('0x59')]['body']=_0x5a70ae['body'][_0x3999('0x80')];_0x486942[_0x3999('0x59')][_0x3999('0x7e')]=_0x5a70ae[_0x3999('0x59')]['replyMessageId'];break;case _0x3999('0x8a'):_0x486942['body'][_0x3999('0x7e')]=_0x5a70ae[_0x3999('0x59')][0x0][_0x3999('0x25')]['id'];_0x486942[_0x3999('0x59')][_0x3999('0x7b')]=_0x5a70ae['body'][0x0][_0x3999('0x25')]['from'];_0x486942[_0x3999('0x59')][_0x3999('0x59')]=_0x5a70ae['body'][0x0][_0x3999('0x25')][_0x3999('0x80')];break;case _0x3999('0x8b'):_0x486942[_0x3999('0x59')][_0x3999('0x7b')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x7b')];_0x486942['body'][_0x3999('0x59')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x25')];_0x486942[_0x3999('0x59')][_0x3999('0x7e')]=_0x5a70ae[_0x3999('0x59')][_0x3999('0x8c')];break;}}if(_0x486942[_0x3999('0x59')]['id']){delete _0x486942[_0x3999('0x59')]['id'];}if(_[_0x3999('0x8d')](_0x486942[_0x3999('0x59')][_0x3999('0x7b')])){throw new db[(_0x3999('0x73'))][(_0x3999('0x74'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x486942[_0x3999('0x59')][_0x3999('0x59')])||_0x486942['body'][_0x3999('0x59')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3999('0x8d')](_0x486942[_0x3999('0x59')][_0x3999('0x8e')])){throw new db[(_0x3999('0x73'))][(_0x3999('0x74'))](_0x3999('0x8f')+_0x1a6b89);}if(!_[_0x3999('0x90')](_0x1a6b89,_0x486942[_0x3999('0x59')]['mapKey'])){throw new db['Sequelize'][(_0x3999('0x74'))](_0x3999('0x91')+_0x1a6b89);}_0x342c17[_0x486942[_0x3999('0x59')][_0x3999('0x8e')]]=_0x486942[_0x3999('0x59')][_0x3999('0x7b')];return db[_0x3999('0x92')][_0x3999('0x5d')]({'where':{'id':_0x486942[_0x3999('0x71')][_0x3999('0x79')]},'include':[{'model':db[_0x3999('0x72')],'as':_0x3999('0x93'),'where':_0x342c17,'limit':0x1,'order':[['updatedAt',_0x3999('0x94')]]}]});})[_0x3999('0x1f')](handleEntityNotFound(_0x38337e,null))[_0x3999('0x1f')](function(_0x390fcf){if(_0x390fcf){_0x486942[_0x3999('0x95')]=_[_0x3999('0x96')](_0x390fcf,[_0x3999('0x93')]);if(_0x390fcf[_0x3999('0x93')][_0x3999('0x46')]){return _0x390fcf[_0x3999('0x93')][0x0];}var _0x519b34=_[_0x3999('0x17')](_0x486942[_0x3999('0x59')],{'firstName':_0x486942['body']['from'],'ListId':_0x390fcf['id']});_0x519b34[_0x486942['body'][_0x3999('0x8e')]]=_0x486942[_0x3999('0x59')]['from'];return db[_0x3999('0x72')]['create'](_0x519b34,{'fields':_0x27f1e4,'raw':!![]});}})[_0x3999('0x1f')](handleEntityNotFound(_0x38337e,null))[_0x3999('0x1f')](function(_0xf57c63){if(_0xf57c63){_0x486942[_0x3999('0x97')]=_0xf57c63;var _0x2e9471={'ContactId':_0xf57c63['id'],'phone':_0x486942[_0x3999('0x59')][_0x3999('0x7b')],'SmsAccountId':_0x5a70ae[_0x3999('0x54')]['id']};var _0x5be307={'ContactId':_0xf57c63['id'],'SmsAccountId':_0x5a70ae['params']['id'],'closed':![]};return db['SmsInteraction'][_0x3999('0x5d')]({'where':_0x5be307})[_0x3999('0x1f')](function(_0xc27d44){if(_0xc27d44){return[_0xc27d44,![]];}return db['SmsInteraction'][_0x3999('0x58')](_0x2e9471)['then'](function(_0x45eb1d){return[_0x45eb1d,!![]];});});}})[_0x3999('0x98')](function(_0x4ad5b8,_0xd0d634){_0x486942[_0x3999('0x99')]=_0x4ad5b8[_0x3999('0x32')]({'plain':!![]});_0x486942[_0x3999('0x99')][_0x3999('0x9a')]=![];if(_0xd0d634){if(_0x486942['account'][_0x3999('0x9b')]){_0x486942[_0x3999('0x9c')]['push']({'id':0x0,'priority':_0x486942[_0x3999('0x9c')]['length']+0x1,'app':_0x3999('0x9d'),'appdata':_0x3999('0x9e'),'interval':_0x3999('0x9f')});}_0x486942[_0x3999('0x99')]['created']=!![];}return db[_0x3999('0xa0')]['create']({'phone':_0x486942[_0x3999('0x59')]['from'],'messageId':_0x486942['body'][_0x3999('0x7e')],'body':_0x486942[_0x3999('0x59')]['body'],'SmsAccountId':_0x5a70ae[_0x3999('0x54')]['id'],'SmsInteractionId':_0x4ad5b8['id'],'direction':'in','ContactId':_0x4ad5b8['ContactId'],'AttachmentId':_0x486942['body'][_0x3999('0xa1')]});})[_0x3999('0x1f')](function(_0x591463){_0x486942[_0x3999('0x25')]=_0x591463;if(!_0x486942['interaction'][_0x3999('0xa2')])return;return db[_0x3999('0xa3')][_0x3999('0x5d')]({'attributes':['id',_0x3999('0x37')],'where':{'id':_0x486942[_0x3999('0x99')][_0x3999('0xa2')]}});})['then'](function(_0x47fbd0){if(_0x47fbd0){_0x486942[_0x3999('0x9c')][_0x3999('0xa4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x47fbd0['name']+','+(_0x486942[_0x3999('0x71')][_0x3999('0xa5')]||0xa),'interval':'*,*,*,*'});}if(!_0x486942['interaction'][_0x3999('0xa6')])return;return db[_0x3999('0xa7')]['find']({'attributes':['id',_0x3999('0x37')],'where':{'id':_0x486942[_0x3999('0x99')][_0x3999('0xa6')]}});})[_0x3999('0x1f')](function(_0x45632a){if(_0x45632a){_0x486942[_0x3999('0x9c')][_0x3999('0xa4')]({'id':0x0,'priority':0x1,'app':_0x3999('0xa8'),'appdata':_0x45632a['name']+','+(_0x486942[_0x3999('0x71')][_0x3999('0xa9')]||0x12c),'interval':_0x3999('0x9f')});}return respondWithRpcPromise('Start',_0x3999('0xaa'),_0x486942);})[_0x3999('0x1f')](function(_0x4faddd){if(_0x4faddd){var _0x249a31=0xc8;var _0x15c338=_0x3999('0xab');logger['info'](_0x3999('0xac'),_0x15c338,_0x249a31,_0x3999('0xad'));logger['debug'](_0x3999('0xae'),_0x15c338,_0x249a31,'entity\x20found',JSON[_0x3999('0xaf')](_0x4faddd));if(_0x486942[_0x3999('0x71')][_0x3999('0x3e')]==='twilio'){return _0x38337e[_0x3999('0x26')](_0x249a31)[_0x3999('0xb0')](_0x3999('0xb1'),_0x3999('0xb2'))[_0x3999('0x38')](_0x3999('0xb3'));}else{return _0x38337e[_0x3999('0x26')](_0x249a31)[_0x3999('0x27')](_0x4faddd);}}})[_0x3999('0x53')](handleError(_0x38337e,null));};exports[_0x3999('0xb4')]=function(_0x12656e,_0x290f02){var _0x27b984=_0x12656e[_0x3999('0x54')]['id'];var _0xafa0e8=_0x12656e[_0x3999('0x59')];var _0x1214a9=0xc8;var _0xc15377=null;return db[_0x3999('0xb5')][_0x3999('0xb6')]({'isolationLevel':db[_0x3999('0xb5')][_0x3999('0xb7')][_0x3999('0xb8')][_0x3999('0xb9')]},function(_0xf40b07){return db[_0x3999('0x50')][_0x3999('0xba')]({'where':{'id':_0x27b984},'transaction':_0xf40b07})[_0x3999('0x1f')](function(_0x4fd436){if(_0x4fd436){return db['SmsApplication'][_0x3999('0x31')]({'where':{'SmsAccountId':_0x27b984},'transaction':_0xf40b07})['then'](function(){var _0x4173f9=_[_0x3999('0x3b')](_0xafa0e8,function(_0x195a80){_0x195a80[_0x3999('0x63')]=_0x27b984;return _0x195a80;});return db[_0x3999('0x6d')]['bulkCreate'](_0x4173f9,{'transaction':_0xf40b07});});}else{_0x1214a9=0x194;_0xc15377=[];}});})['then'](function(){if(_0x1214a9!==0x194){return db[_0x3999('0x6d')][_0x3999('0xbb')]({'where':{'SmsAccountId':_0x27b984},'order':_0x3999('0x6f')})[_0x3999('0x1f')](function(_0xd10859){_0xc15377=_0xd10859;});}})['catch'](function(_0x6233ad){_0x1214a9=0x1f4;logger[_0x3999('0x24')](_0x6233ad[_0x3999('0x36')]);if(_0x6233ad[_0x3999('0x37')]){delete _0x6233ad[_0x3999('0x37')];}_0xc15377=_0x6233ad;})[_0x3999('0xbc')](function(){if(_0xc15377===null){_0x290f02[_0x3999('0x35')](_0x1214a9);}else{if(_0x1214a9===0x1f4){_0x290f02[_0x3999('0x26')](_0x1214a9)[_0x3999('0x38')](_0xc15377);}else{_0x290f02['status'](_0x1214a9)['json'](_0xc15377);}}});};exports[_0x3999('0xbd')]=function(_0x3ba94e,_0x45d817,_0x10b452){var _0x374cb4={};var _0x319e4c={};var _0x5ce314;var _0x3ebada;return db[_0x3999('0x50')][_0x3999('0xba')]({'where':{'id':_0x3ba94e[_0x3999('0x54')]['id']}})[_0x3999('0x1f')](handleEntityNotFound(_0x45d817,null))[_0x3999('0x1f')](function(_0x40fd43){if(_0x40fd43){_0x5ce314=_0x40fd43;_0x319e4c[_0x3999('0x3f')]=_[_0x3999('0x40')](db[_0x3999('0x6d')][_0x3999('0x3c')]);_0x319e4c['query']=_[_0x3999('0x40')](_0x3ba94e[_0x3999('0x41')]);_0x319e4c[_0x3999('0x42')]=_[_0x3999('0x43')](_0x319e4c[_0x3999('0x3f')],_0x319e4c[_0x3999('0x41')]);_0x374cb4[_0x3999('0x45')]=_[_0x3999('0x43')](_0x319e4c[_0x3999('0x3f')],qs[_0x3999('0x44')](_0x3ba94e[_0x3999('0x41')]['fields']));_0x374cb4[_0x3999('0x45')]=_0x374cb4[_0x3999('0x45')]['length']?_0x374cb4[_0x3999('0x45')]:_0x319e4c[_0x3999('0x3f')];_0x374cb4[_0x3999('0x49')]=qs['sort'](_0x3ba94e[_0x3999('0x41')]['sort']);_0x374cb4[_0x3999('0x4d')]=qs[_0x3999('0x42')](_[_0x3999('0x6a')](_0x3ba94e[_0x3999('0x41')],_0x319e4c['filters']));if(_0x3ba94e['query'][_0x3999('0x4b')]){_0x374cb4[_0x3999('0x4d')]=_[_0x3999('0x4c')](_0x374cb4[_0x3999('0x4d')],{'$or':_[_0x3999('0x3b')](_0x374cb4[_0x3999('0x45')],function(_0x5e7a3a){var _0x17f9c5={};_0x17f9c5[_0x5e7a3a]={'$like':'%'+_0x3ba94e[_0x3999('0x41')][_0x3999('0x4b')]+'%'};return _0x17f9c5;})});}_0x374cb4=_[_0x3999('0x4c')]({},_0x374cb4,_0x3ba94e[_0x3999('0x4f')]);return _0x5ce314[_0x3999('0xbd')](_0x374cb4);}})['then'](function(_0x48b272){if(_0x48b272){_0x3ebada=_0x48b272[_0x3999('0x46')];if(!_0x3ba94e[_0x3999('0x41')][_0x3999('0x47')](_0x3999('0x48'))){_0x374cb4[_0x3999('0x29')]=qs[_0x3999('0x29')](_0x3ba94e['query'][_0x3999('0x29')]);_0x374cb4[_0x3999('0x28')]=qs[_0x3999('0x28')](_0x3ba94e['query'][_0x3999('0x28')]);}return _0x5ce314[_0x3999('0xbd')](_0x374cb4);}})[_0x3999('0x1f')](function(_0x50f38d){if(_0x50f38d){return _0x50f38d?{'count':_0x3ebada,'rows':_0x50f38d}:null;}})[_0x3999('0x1f')](respondWithResult(_0x45d817,null))['catch'](handleError(_0x45d817,null));};exports[_0x3999('0xbe')]=function(_0x4de7e3,_0x2e44ff,_0x5823c0){var _0x5d370c={'raw':![],'where':{}};var _0x2f8113={};var _0x104718={'count':0x0,'rows':[]};return db[_0x3999('0x50')][_0x3999('0xba')]({'where':{'id':_0x4de7e3[_0x3999('0x54')]['id']}})[_0x3999('0x1f')](handleEntityNotFound(_0x2e44ff,null))['then'](function(_0x61c7f6){if(_0x61c7f6){_0x2f8113['model']=_[_0x3999('0x40')](db[_0x3999('0xbf')][_0x3999('0x3c')]);_0x2f8113[_0x3999('0x41')]=_[_0x3999('0x40')](_0x4de7e3[_0x3999('0x41')]);_0x2f8113[_0x3999('0x42')]=_[_0x3999('0x43')](_0x2f8113['model'],_0x2f8113[_0x3999('0x41')]);_0x5d370c[_0x3999('0x45')]=_[_0x3999('0x43')](_0x2f8113[_0x3999('0x3f')],qs[_0x3999('0x44')](_0x4de7e3[_0x3999('0x41')]['fields']));_0x5d370c[_0x3999('0x45')]=_0x5d370c[_0x3999('0x45')][_0x3999('0x46')]?_0x5d370c['attributes']:_0x2f8113[_0x3999('0x3f')];if(!_0x4de7e3[_0x3999('0x41')][_0x3999('0x47')](_0x3999('0x48'))){_0x5d370c[_0x3999('0x29')]=qs[_0x3999('0x29')](_0x4de7e3['query'][_0x3999('0x29')]);_0x5d370c[_0x3999('0x28')]=qs[_0x3999('0x28')](_0x4de7e3['query'][_0x3999('0x28')]);}_0x5d370c['order']=qs[_0x3999('0x4a')](_0x4de7e3['query'][_0x3999('0x4a')]);_0x5d370c[_0x3999('0x4d')]=qs[_0x3999('0x42')](_[_0x3999('0x6a')](_0x4de7e3[_0x3999('0x41')],_0x2f8113[_0x3999('0x42')]));_0x5d370c[_0x3999('0x4d')][_0x3999('0x63')]=_0x61c7f6['id'];if(_0x4de7e3['query'][_0x3999('0x4b')]){_0x5d370c[_0x3999('0x4d')]=_['merge'](_0x5d370c['where'],{'$or':_[_0x3999('0x3b')](_0x5d370c[_0x3999('0x45')],function(_0x33c884){var _0x451250={};_0x451250[_0x33c884]={'$like':'%'+_0x4de7e3[_0x3999('0x41')][_0x3999('0x4b')]+'%'};return _0x451250;})});}_0x5d370c=_[_0x3999('0x4c')]({},_0x5d370c,_0x4de7e3[_0x3999('0x4f')]);return db[_0x3999('0xbf')][_0x3999('0x2b')]({'where':_0x5d370c[_0x3999('0x4d')]})[_0x3999('0x1f')](function(_0x526d9e){_0x104718[_0x3999('0x2b')]=_0x526d9e;if(_0x4de7e3[_0x3999('0x41')][_0x3999('0x56')]){_0x5d370c['include']=[{'model':db['CmContact'],'as':_0x3999('0xc0'),'required':![]},{'model':db['User'],'as':_0x3999('0xc1'),'attributes':[_0x3999('0x37'),_0x3999('0xc2'),'internal'],'required':![]},{'model':db[_0x3999('0xc3')],'as':_0x3999('0xc4'),'attributes':['id',_0x3999('0x37'),_0x3999('0xc5')],'where':_0x4de7e3[_0x3999('0x41')]['tag']?{'id':_0x4de7e3[_0x3999('0x41')]['tag']}:undefined,'required':_0x4de7e3['query'][_0x3999('0xc6')]?!![]:![]}];}return db[_0x3999('0xbf')][_0x3999('0x51')](_0x5d370c);})[_0x3999('0x1f')](function(_0x47b866){_0x104718[_0x3999('0x52')]=_0x47b866;return _0x104718;});}})[_0x3999('0x1f')](respondWithFilteredResult(_0x2e44ff,_0x5d370c))[_0x3999('0x53')](handleError(_0x2e44ff,null));};exports[_0x3999('0x38')]=function(_0x199d5d,_0x5c8348,_0x5790ed){var _0x29a9b6,_0x265e4c,_0x22a2e8;if(_[_0x3999('0x8d')](_0x199d5d[_0x3999('0x59')]['body'])||_0x199d5d[_0x3999('0x59')][_0x3999('0x59')]===''){throw new db['Sequelize'][(_0x3999('0x74'))](_0x3999('0xc7'));}if(_[_0x3999('0x8d')](_0x199d5d[_0x3999('0x59')]['to'])){throw new db[(_0x3999('0x73'))][(_0x3999('0x74'))](_0x3999('0xc8'));}_0x29a9b6=_0x199d5d['body']['to'];return db[_0x3999('0x50')]['find']({'where':{'id':_0x199d5d[_0x3999('0x54')]['id']},'include':[{'model':db[_0x3999('0x92')],'as':_0x3999('0xc9'),'include':[{'model':db['CmContact'],'as':_0x3999('0x93'),'where':{'mobile':_0x29a9b6},'limit':0x1,'order':[[_0x3999('0x77'),_0x3999('0x94')]]}]}]})[_0x3999('0x1f')](handleEntityNotFound(_0x5c8348,null))[_0x3999('0x1f')](function(_0x2a9e97){if(_0x2a9e97&&_0x2a9e97[_0x3999('0xc9')]){_0x265e4c=_0x2a9e97[_0x3999('0x32')]({'plain':!![]});if(_0x265e4c[_0x3999('0xc9')]&&_0x265e4c['List'][_0x3999('0x93')][_0x3999('0x46')]){return _0x265e4c[_0x3999('0xc9')][_0x3999('0x93')][0x0];}return db[_0x3999('0x72')][_0x3999('0x58')](_[_0x3999('0x17')](_0x199d5d[_0x3999('0x59')],{'firstName':_0x29a9b6,'mobile':_0x29a9b6,'phone':_0x29a9b6,'ListId':_0x265e4c['ListId']}));}})['then'](handleEntityNotFound(_0x5c8348,null))[_0x3999('0x1f')](function(_0x2e19d8){if(_0x2e19d8){_0x22a2e8=_0x2e19d8;return db[_0x3999('0xbf')]['find']({'where':{'ContactId':_0x22a2e8['id'],'closed':![],'SmsAccountId':_0x265e4c['id']}})[_0x3999('0x1f')](function(_0xe49be5){if(_0xe49be5){return[_0xe49be5,![]];}return db[_0x3999('0xbf')][_0x3999('0x58')]({'UserId':_0x199d5d[_0x3999('0x5a')]['id'],'ContactId':_0x22a2e8['id'],'SmsAccountId':_0x265e4c['id'],'phone':_0x29a9b6,'firstMsgDirection':'out','Messages':[_[_0x3999('0x4c')](_0x199d5d['body'],{'read':![],'body':_0x199d5d[_0x3999('0x59')][_0x3999('0x59')],'phone':_0x29a9b6,'SmsAccountId':_0x265e4c['id'],'UserId':_0x199d5d[_0x3999('0x5a')]['id'],'ContactId':_0x22a2e8['id']})]},{'include':[{'model':db[_0x3999('0xa0')],'as':_0x3999('0xca')}]})[_0x3999('0x1f')](function(_0x3cc0e9){return[_0x3cc0e9,!![]];});});}})[_0x3999('0x98')](function(_0x225035,_0x36e09e){if(_0x36e09e){return _0x225035;}return db[_0x3999('0xa0')][_0x3999('0x58')](_[_0x3999('0x4c')](_0x199d5d[_0x3999('0x59')],{'read':![],'body':_0x199d5d[_0x3999('0x59')][_0x3999('0x59')],'phone':_0x29a9b6,'SmsAccountId':_0x265e4c['id'],'SmsInteractionId':_0x225035['id'],'UserId':_0x199d5d[_0x3999('0x5a')]['id'],'ContactId':_0x22a2e8['id']}))[_0x3999('0x1f')](function(_0x4a5a5f){_0x225035[_0x3999('0xcb')][_0x3999('0xca')]=[];_0x225035['dataValues']['Messages'][_0x3999('0xcc')](_0x4a5a5f[_0x3999('0xcb')]);return _0x225035;});})['then'](respondWithResult(_0x5c8348,null))[_0x3999('0x53')](handleError(_0x5c8348,null));};exports['status']=function(_0x41bc91,_0x33bdc2,_0x35b13d){if(_0x41bc91[_0x3999('0x59')]['id']){delete _0x41bc91[_0x3999('0x59')]['id'];}var _0x11f245,_0x47458b,_0x5a71f8;return db[_0x3999('0x50')][_0x3999('0x5d')]({'where':{'id':_0x41bc91['params']['id']}})['then'](handleEntityNotFound(_0x33bdc2,null))[_0x3999('0x1f')](function(_0x2ee9d9){if(_0x2ee9d9){_0x5a71f8=_0x2ee9d9;logger['debug'](_0x3999('0xac'),_0x3999('0x26'),'received\x20delivery\x20report\x20from',_0x2ee9d9[_0x3999('0x3e')],util[_0x3999('0xcd')](_0x41bc91[_0x3999('0x59')],{'showHidden':![],'depth':null}));switch(_0x2ee9d9[_0x3999('0x3e')]){case _0x3999('0xce'):if(_0x41bc91['body'][_0x3999('0xcf')]&&_0x41bc91[_0x3999('0x59')][_0x3999('0x26')]){_0x47458b=_0x41bc91[_0x3999('0x59')][_0x3999('0x26')];return db[_0x3999('0xa0')]['find']({'where':{'messageId':_0x41bc91['body'][_0x3999('0xcf')]}});}break;case'connectel':if(_0x41bc91[_0x3999('0x59')][_0x3999('0xd0')]&&_0x41bc91[_0x3999('0x59')][_0x3999('0xd1')]){_0x47458b=_0x41bc91[_0x3999('0x59')][_0x3999('0xd1')];return db['SmsMessage'][_0x3999('0x5d')]({'where':{'messageId':_0x41bc91[_0x3999('0x59')][_0x3999('0xd0')]}});}break;case _0x3999('0x82'):if(_0x41bc91[_0x3999('0x59')][_0x3999('0xd2')]&&_0x41bc91[_0x3999('0x59')]['status_code']){_0x47458b=_0x41bc91['body'][_0x3999('0xd3')];return db[_0x3999('0xa0')][_0x3999('0x5d')]({'where':{'messageId':_0x41bc91[_0x3999('0x59')]['message_id']}});}break;case _0x3999('0xd4'):var _0x28c5b8=_0x41bc91['body'][_0x3999('0x85')][0x0];if(_0x28c5b8[_0x3999('0x7e')]&&_0x28c5b8[_0x3999('0x26')][_0x3999('0xd5')]===_0x3999('0xd6')){_0x47458b=_0x28c5b8['status']['groupName'];return db['SmsMessage'][_0x3999('0x5d')]({'where':{'messageId':_0x28c5b8[_0x3999('0x7e')]}});}break;case _0x3999('0xd7'):if(_0x41bc91['body'][_0x3999('0x7e')]&&_0x41bc91[_0x3999('0x59')]['status']){_0x47458b=_0x41bc91[_0x3999('0x59')][_0x3999('0x26')];return db[_0x3999('0xa0')][_0x3999('0x5d')]({'where':{'messageId':_0x41bc91[_0x3999('0x59')][_0x3999('0x7e')]}});}break;case'bandwidth':if(_0x41bc91['body'][0x0][_0x3999('0x25')]['id']){_0x47458b=_0x41bc91[_0x3999('0x59')][0x0]['type'];return db[_0x3999('0xa0')][_0x3999('0x5d')]({'where':{'messageId':_0x41bc91[_0x3999('0x59')][0x0][_0x3999('0x25')]['id']}});}break;case _0x3999('0x8b'):if(_0x41bc91['body'][_0x3999('0xd8')]&&_0x41bc91[_0x3999('0x59')][_0x3999('0x26')]){_0x47458b=_0x41bc91['body'][_0x3999('0x26')];return db['SmsMessage'][_0x3999('0x5d')]({'where':{'messageId':_0x41bc91[_0x3999('0x59')][_0x3999('0xd8')]}});}break;}}})['then'](handleEntityNotFound(_0x33bdc2,null))[_0x3999('0x1f')](function(_0x157d0a){if(_0x157d0a){_0x11f245=_0x157d0a;switch(_0x5a71f8[_0x3999('0x3e')]){case _0x3999('0xce'):if(_0x47458b===_0x3999('0xd6')){return _0x11f245[_0x3999('0x30')]({'read':!![]});}else{logger[_0x3999('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3999('0x26'),_0x3999('0xce'),util[_0x3999('0xcd')](_0x41bc91['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x47458b==='1'){return _0x11f245[_0x3999('0x30')]({'read':!![]});}else{logger[_0x3999('0x24')](_0x3999('0xac'),_0x3999('0x26'),'skebby',util[_0x3999('0xcd')](_0x41bc91[_0x3999('0x59')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x41bc91[_0x3999('0x59')][_0x3999('0xd9')]&&_0x47458b>=0xc8&&_0x47458b<=0xce){return _0x11f245['update']({'read':!![]});}else{logger['error'](_0x3999('0xac'),_0x3999('0x26'),_0x3999('0x82'),util[_0x3999('0xcd')](_0x41bc91[_0x3999('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1b5cf4=_0x41bc91['body'][_0x3999('0x85')][0x0];if(_0x1b5cf4[_0x3999('0x26')][_0x3999('0xd5')]===_0x3999('0xd6')){return _0x11f245['update']({'read':!![]});}else{logger[_0x3999('0x24')](_0x3999('0xac'),_0x3999('0x26'),_0x3999('0xd4'),util['inspect'](_0x41bc91[_0x3999('0x59')],{'showHidden':![],'depth':null}));}break;case _0x3999('0xd7'):if(_0x47458b=='DELIVERED_TO_GATEWAY'||_0x47458b=='RECEIVED_BY_RECIPIENT'){return _0x11f245['update']({'read':!![]});}else{logger[_0x3999('0x24')](_0x3999('0xac'),_0x3999('0x26'),_0x3999('0xd7'),util[_0x3999('0xcd')](_0x41bc91['body'],{'showHidden':![],'depth':null}));}break;case _0x3999('0x8a'):if(_0x47458b=='message-delivered'){return _0x11f245[_0x3999('0x30')]({'read':!![]});}else{logger[_0x3999('0x24')](_0x3999('0xac'),_0x3999('0x26'),_0x3999('0x8a'),util[_0x3999('0xcd')](_0x41bc91[_0x3999('0x59')],{'showHidden':![],'depth':null}));}break;case _0x3999('0x8b'):if(_0x47458b===_0x3999('0xda')||_0x47458b==='ACCEPTD'){return _0x11f245['update']({'read':!![]});}else{logger['error'](_0x3999('0xac'),'status','intelepeer',util[_0x3999('0xcd')](_0x41bc91[_0x3999('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x11f245;}})[_0x3999('0x1f')](respondWithResult(_0x33bdc2,null))[_0x3999('0x53')](handleError(_0x33bdc2,null));};exports[_0x3999('0xdb')]=function(_0x5bbb83,_0x14c1e8,_0x4b08ae){var _0x1d6252,_0xae19,_0xd2970a;return db[_0x3999('0x50')][_0x3999('0x5d')]({'where':{'id':_0x5bbb83[_0x3999('0x54')]['id']}})[_0x3999('0x1f')](handleEntityNotFound(_0x14c1e8,null))['then'](function(_0x17895e){if(_0x17895e){_0xd2970a=_0x17895e;logger[_0x3999('0x23')](_0x3999('0xac'),_0x3999('0x26'),_0x3999('0xdc'),_0x17895e['type'],util[_0x3999('0xcd')](_0x5bbb83[_0x3999('0x41')],{'showHidden':![],'depth':null}));switch(_0x17895e[_0x3999('0x3e')]){case'csc':if(_0x5bbb83[_0x3999('0x41')][_0x3999('0xdd')]&&_0x5bbb83['query']['state']){_0xae19=_0x5bbb83[_0x3999('0x41')]['state'];return db[_0x3999('0xa0')][_0x3999('0x5d')]({'where':{'messageId':_0x5bbb83['query'][_0x3999('0xdd')]}});}break;}}})[_0x3999('0x1f')](handleEntityNotFound(_0x14c1e8,null))[_0x3999('0x1f')](function(_0x3fc983){if(_0x3fc983){_0x1d6252=_0x3fc983;switch(_0xd2970a[_0x3999('0x3e')]){case _0x3999('0x86'):if(_0xae19==='2'||_0xae19==='6'){return _0x1d6252[_0x3999('0x30')]({'read':!![]});}else{logger['error'](_0x3999('0xac'),_0x3999('0x26'),_0x3999('0x86'),util['inspect'](_0x5bbb83['query'],{'showHidden':![],'depth':null}));};break;}return _0x1d6252;}})[_0x3999('0x1f')](respondWithResult(_0x14c1e8,null))['catch'](handleError(_0x14c1e8,null));};exports[_0x3999('0xde')]=function(_0xb1cb26,_0x5981bf,_0x5155cd){return db[_0x3999('0x50')][_0x3999('0x5d')]({'where':{'id':_0xb1cb26[_0x3999('0x54')]['id']}})[_0x3999('0x1f')](handleEntityNotFound(_0x5981bf,null))['then'](function(_0x68cb81){if(_0x68cb81){return _0x68cb81[_0x3999('0xde')](_0xb1cb26[_0x3999('0x59')][_0x3999('0x66')],_['omit'](_0xb1cb26[_0x3999('0x59')],['ids','id'])||{})[_0x3999('0x98')](function(_0x3a1252){for(var _0x5509eb=0x0;_0x5509eb<_0xb1cb26['body'][_0x3999('0x66')][_0x3999('0x46')];_0x5509eb+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0xb1cb26[_0x3999('0x59')][_0x3999('0x66')][_0x5509eb]),'SmsAccountId':Number(_0xb1cb26[_0x3999('0x54')]['id'])});}return _0x3a1252;});}})['then'](respondWithResult(_0x5981bf,null))[_0x3999('0x53')](handleError(_0x5981bf,null));};exports[_0x3999('0xdf')]=function(_0x130f40,_0x7c8f4b,_0x912d3a){return db['SmsAccount'][_0x3999('0x5d')]({'where':{'id':_0x130f40[_0x3999('0x54')]['id']}})[_0x3999('0x1f')](handleEntityNotFound(_0x7c8f4b,null))[_0x3999('0x1f')](function(_0x1cccfa){if(_0x1cccfa){return _0x1cccfa[_0x3999('0xdf')](_0x130f40[_0x3999('0x41')]['ids'])[_0x3999('0x1f')](function(){if(_[_0x3999('0xe0')](_0x130f40[_0x3999('0x41')][_0x3999('0x66')])){for(var _0x184da3=0x0;_0x184da3<_0x130f40[_0x3999('0x41')][_0x3999('0x66')][_0x3999('0x46')];_0x184da3+=0x1){socket[_0x3999('0xe1')]('userSmsAccount:remove',{'UserId':Number(_0x130f40['query']['ids'][_0x184da3]),'SmsAccountId':Number(_0x130f40[_0x3999('0x54')]['id'])});}}else{socket[_0x3999('0xe1')](_0x3999('0xe2'),{'UserId':Number(_0x130f40['query'][_0x3999('0x66')]),'SmsAccountId':Number(_0x130f40[_0x3999('0x54')]['id'])});}});}})[_0x3999('0x1f')](respondWithStatusCode(_0x7c8f4b,null))[_0x3999('0x53')](handleError(_0x7c8f4b,null));};exports[_0x3999('0xe3')]=function(_0x44c948,_0xe7e1af,_0x48471a){var _0x386f4f={};var _0x4969dc={};var _0x3f9c09;var _0x156360;return db['SmsAccount'][_0x3999('0xba')]({'where':{'id':_0x44c948['params']['id']}})[_0x3999('0x1f')](handleEntityNotFound(_0xe7e1af,null))[_0x3999('0x1f')](function(_0x31f19d){if(_0x31f19d){_0x3f9c09=_0x31f19d;_0x4969dc['model']=_['keys'](db[_0x3999('0xa3')]['rawAttributes']);_0x4969dc['query']=_[_0x3999('0x40')](_0x44c948[_0x3999('0x41')]);_0x4969dc['filters']=_[_0x3999('0x43')](_0x4969dc[_0x3999('0x3f')],_0x4969dc['query']);_0x386f4f[_0x3999('0x45')]=_['intersection'](_0x4969dc[_0x3999('0x3f')],qs[_0x3999('0x44')](_0x44c948[_0x3999('0x41')]['fields']));_0x386f4f[_0x3999('0x45')]=_0x386f4f[_0x3999('0x45')][_0x3999('0x46')]?_0x386f4f[_0x3999('0x45')]:_0x4969dc['model'];_0x386f4f[_0x3999('0x49')]=qs['sort'](_0x44c948['query'][_0x3999('0x4a')]);_0x386f4f['where']=qs[_0x3999('0x42')](_[_0x3999('0x6a')](_0x44c948[_0x3999('0x41')],_0x4969dc[_0x3999('0x42')]));if(_0x44c948[_0x3999('0x41')][_0x3999('0x4b')]){_0x386f4f['where']=_[_0x3999('0x4c')](_0x386f4f['where'],{'$or':_[_0x3999('0x3b')](_0x386f4f[_0x3999('0x45')],function(_0x25dbe6){var _0x3cbe27={};_0x3cbe27[_0x25dbe6]={'$like':'%'+_0x44c948[_0x3999('0x41')][_0x3999('0x4b')]+'%'};return _0x3cbe27;})});}_0x386f4f=_['merge']({},_0x386f4f,_0x44c948[_0x3999('0x4f')]);return _0x3f9c09[_0x3999('0xe3')](_0x386f4f);}})[_0x3999('0x1f')](function(_0xaf3b69){if(_0xaf3b69){_0x156360=_0xaf3b69[_0x3999('0x46')];if(!_0x44c948[_0x3999('0x41')]['hasOwnProperty'](_0x3999('0x48'))){_0x386f4f[_0x3999('0x29')]=qs[_0x3999('0x29')](_0x44c948[_0x3999('0x41')]['limit']);_0x386f4f['offset']=qs[_0x3999('0x28')](_0x44c948['query'][_0x3999('0x28')]);}return _0x3f9c09[_0x3999('0xe3')](_0x386f4f);}})[_0x3999('0x1f')](function(_0x5929fc){if(_0x5929fc){return _0x5929fc?{'count':_0x156360,'rows':_0x5929fc}:null;}})[_0x3999('0x1f')](respondWithResult(_0xe7e1af,null))[_0x3999('0x53')](handleError(_0xe7e1af,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 43b41de..c148932 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 _0x815a=['exports','events','SmsAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x56405a,_0x2491cf){var _0x54c664=function(_0x29a081){while(--_0x29a081){_0x56405a['push'](_0x56405a['shift']());}};_0x54c664(++_0x2491cf);}(_0x815a,0x1a9));var _0xa815=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x815a[_0x5c351c];return _0x26f3b3;};'use strict';var EventEmitter=require(_0xa815('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xa815('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa815('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa815('0x3'),'afterDestroy':_0xa815('0x4')};function emitEvent(_0x4409ea){return function(_0x59b9db,_0x43ffbd,_0x135eab){SmsAccountEvents[_0xa815('0x5')](_0x4409ea+':'+_0x59b9db['id'],_0x59b9db);SmsAccountEvents['emit'](_0x4409ea,_0x59b9db);_0x135eab(null);};}for(var e in events){if(events[_0xa815('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xa815('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0xfcd6=['SmsAccount','setMaxListeners','emit','hook','exports','events','../../mysqldb'];(function(_0x55560c,_0xf929f9){var _0x3fe414=function(_0x3ee99f){while(--_0x3ee99f){_0x55560c['push'](_0x55560c['shift']());}};_0x3fe414(++_0xf929f9);}(_0xfcd6,0x101));var _0x6fcd=function(_0x26da15,_0x43252d){_0x26da15=_0x26da15-0x0;var _0x263987=_0xfcd6[_0x26da15];return _0x263987;};'use strict';var EventEmitter=require(_0x6fcd('0x0'));var SmsAccount=require(_0x6fcd('0x1'))['db'][_0x6fcd('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6fcd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5a6189){return function(_0x191a78,_0x3a29e4,_0x2d6f9e){SmsAccountEvents['emit'](_0x5a6189+':'+_0x191a78['id'],_0x191a78);SmsAccountEvents[_0x6fcd('0x4')](_0x5a6189,_0x191a78);_0x2d6f9e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x6fcd('0x5')](e,emitEvent(event));}}module[_0x6fcd('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index dce474e..f64d4a2 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 _0x977c=['../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x977c,0x171));var _0xc977=function(_0x16ce96,_0x11bbf7){_0x16ce96=_0x16ce96-0x0;var _0x9ec268=_0x977c[_0x16ce96];return _0x9ec268;};'use strict';var _=require('lodash');var util=require(_0xc977('0x0'));var logger=require(_0xc977('0x1'))(_0xc977('0x2'));var moment=require(_0xc977('0x3'));var BPromise=require(_0xc977('0x4'));var rp=require(_0xc977('0x5'));var fs=require('fs');var path=require(_0xc977('0x6'));var rimraf=require(_0xc977('0x7'));var config=require(_0xc977('0x8'));var attributes=require(_0xc977('0x9'));module['exports']=function(_0x282714,_0x4ffdbd){return _0x282714[_0xc977('0xa')](_0xc977('0xb'),attributes,{'tableName':_0xc977('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdc3=['sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','exports','define'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0xbdc3,0x90));var _0x3bdc=function(_0x59729e,_0x2ff55b){_0x59729e=_0x59729e-0x0;var _0x26499a=_0xbdc3[_0x59729e];return _0x26499a;};'use strict';var _=require(_0x3bdc('0x0'));var util=require(_0x3bdc('0x1'));var logger=require(_0x3bdc('0x2'))(_0x3bdc('0x3'));var moment=require(_0x3bdc('0x4'));var BPromise=require(_0x3bdc('0x5'));var rp=require(_0x3bdc('0x6'));var fs=require('fs');var path=require(_0x3bdc('0x7'));var rimraf=require('rimraf');var config=require(_0x3bdc('0x8'));var attributes=require(_0x3bdc('0x9'));module[_0x3bdc('0xa')]=function(_0x503d7c,_0xbf9602){return _0x503d7c[_0x3bdc('0xb')]('SmsAccount',attributes,{'tableName':_0x3bdc('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 1e059e5..eb30d0d 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 _0xfcbe=['ioredis','../../mysqldb','../../config/utils','../../config/environment','http','redis','defaults','localhost','register','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','catch','find','options','where','attributes','include','model','ShowSmsAccount','bluebird','randomstring'];(function(_0x47a12a,_0x70f591){var _0x30cd40=function(_0x46b68f){while(--_0x46b68f){_0x47a12a['push'](_0x47a12a['shift']());}};_0x30cd40(++_0x70f591);}(_0xfcbe,0x1ce));var _0xefcb=function(_0xfdc9a,_0xec8753){_0xfdc9a=_0xfdc9a-0x0;var _0x28f19a=_0xfcbe[_0xfdc9a];return _0x28f19a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xefcb('0x0'));var rs=require(_0xefcb('0x1'));var fs=require('fs');var Redis=require(_0xefcb('0x2'));var db=require(_0xefcb('0x3'))['db'];var utils=require(_0xefcb('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xefcb('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefcb('0x6')]({'port':0x232a});config[_0xefcb('0x7')]=_[_0xefcb('0x8')](config[_0xefcb('0x7')],{'host':_0xefcb('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0xefcb('0xa')](socket);function respondWithRpcPromise(_0x2539d5,_0x1b2536,_0xd631fc){return new BPromise(function(_0x5a2088,_0x5a1d86){return client['request'](_0x2539d5,_0xd631fc)[_0xefcb('0xb')](function(_0x1556b1){logger['info']('SmsAccount,\x20%s,\x20%s',_0x1b2536,_0xefcb('0xc'));logger[_0xefcb('0xd')](_0xefcb('0xe'),_0x1b2536,'request\x20sent',JSON[_0xefcb('0xf')](_0x1556b1));if(_0x1556b1[_0xefcb('0x10')]){if(_0x1556b1['error'][_0xefcb('0x11')]===0x1f4){logger[_0xefcb('0x10')](_0xefcb('0x12'),_0x1b2536,_0x1556b1['error'][_0xefcb('0x13')]);return _0x5a1d86(_0x1556b1[_0xefcb('0x10')][_0xefcb('0x13')]);}logger[_0xefcb('0x10')]('SmsAccount,\x20%s,\x20%s',_0x1b2536,_0x1556b1[_0xefcb('0x10')][_0xefcb('0x13')]);return _0x5a2088(_0x1556b1[_0xefcb('0x10')][_0xefcb('0x13')]);}else{logger[_0xefcb('0x14')](_0xefcb('0x12'),_0x1b2536,_0xefcb('0xc'));_0x5a2088(_0x1556b1['result'][_0xefcb('0x13')]);}})[_0xefcb('0x15')](function(_0x4c178c){logger[_0xefcb('0x10')](_0xefcb('0x12'),_0x1b2536,_0x4c178c);_0x5a1d86(_0x4c178c);});});}exports['ShowSmsAccount']=function(_0x1c1b5a){var _0x525546=this;return new Promise(function(_0x3fd284,_0x155e2e){return db['SmsAccount'][_0xefcb('0x16')]({'raw':_0x1c1b5a[_0xefcb('0x17')]?_0x1c1b5a[_0xefcb('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1c1b5a[_0xefcb('0x17')]?_0x1c1b5a['options'][_0xefcb('0x18')]||null:null,'attributes':_0x1c1b5a[_0xefcb('0x17')]?_0x1c1b5a[_0xefcb('0x17')][_0xefcb('0x19')]||null:null,'include':_0x1c1b5a[_0xefcb('0x17')]?_0x1c1b5a[_0xefcb('0x17')][_0xefcb('0x1a')]?_['map'](_0x1c1b5a[_0xefcb('0x17')][_0xefcb('0x1a')],function(_0x1cfb4c){return{'model':db[_0x1cfb4c[_0xefcb('0x1b')]],'as':_0x1cfb4c['as'],'attributes':_0x1cfb4c[_0xefcb('0x19')],'include':_0x1cfb4c[_0xefcb('0x1a')]?_['map'](_0x1cfb4c[_0xefcb('0x1a')],function(_0x330079){return{'model':db[_0x330079[_0xefcb('0x1b')]],'as':_0x330079['as'],'attributes':_0x330079[_0xefcb('0x19')],'include':_0x330079['include']?_['map'](_0x330079[_0xefcb('0x1a')],function(_0x4a9d69){return{'model':db[_0x4a9d69[_0xefcb('0x1b')]],'as':_0x4a9d69['as'],'attributes':_0x4a9d69[_0xefcb('0x19')]};}):[]};}):[]};}):[]:[]})[_0xefcb('0xb')](function(_0x498236){logger[_0xefcb('0x14')](_0xefcb('0x1c'),_0x1c1b5a);logger[_0xefcb('0xd')](_0xefcb('0x1c'),_0x1c1b5a,JSON[_0xefcb('0xf')](_0x498236));_0x3fd284(_0x498236);})['catch'](function(_0x36f491){logger['error'](_0xefcb('0x1c'),_0x36f491['message'],_0x1c1b5a);_0x155e2e(_0x525546[_0xefcb('0x10')](0x1f4,_0x36f491['message']));});});}; \ No newline at end of file +var _0x53ef=['localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model','lodash','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x8cd4f8,_0x3ca4c4){var _0x3182ee=function(_0x1f0bf9){while(--_0x1f0bf9){_0x8cd4f8['push'](_0x8cd4f8['shift']());}};_0x3182ee(++_0x3ca4c4);}(_0x53ef,0x18c));var _0xf53e=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x53ef[_0x237546];return _0x233e29;};'use strict';var _=require(_0xf53e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf53e('0x1'));var rs=require(_0xf53e('0x2'));var fs=require('fs');var Redis=require(_0xf53e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf53e('0x4'))('rpc');var config=require(_0xf53e('0x5'));var jayson=require(_0xf53e('0x6'));var client=jayson[_0xf53e('0x7')][_0xf53e('0x8')]({'port':0x232a});config[_0xf53e('0x9')]=_[_0xf53e('0xa')](config[_0xf53e('0x9')],{'host':_0xf53e('0xb'),'port':0x18eb});var socket=require(_0xf53e('0xc'))(new Redis(config[_0xf53e('0x9')]));require(_0xf53e('0xd'))[_0xf53e('0xe')](socket);function respondWithRpcPromise(_0x142001,_0x99ccb8,_0x6becbf){return new BPromise(function(_0x274104,_0x44acbb){return client[_0xf53e('0xf')](_0x142001,_0x6becbf)[_0xf53e('0x10')](function(_0x5d3646){logger[_0xf53e('0x11')](_0xf53e('0x12'),_0x99ccb8,'request\x20sent');logger[_0xf53e('0x13')](_0xf53e('0x14'),_0x99ccb8,_0xf53e('0x15'),JSON[_0xf53e('0x16')](_0x5d3646));if(_0x5d3646['error']){if(_0x5d3646[_0xf53e('0x17')][_0xf53e('0x18')]===0x1f4){logger[_0xf53e('0x17')]('SmsAccount,\x20%s,\x20%s',_0x99ccb8,_0x5d3646['error'][_0xf53e('0x19')]);return _0x44acbb(_0x5d3646[_0xf53e('0x17')][_0xf53e('0x19')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x99ccb8,_0x5d3646[_0xf53e('0x17')][_0xf53e('0x19')]);return _0x274104(_0x5d3646['error'][_0xf53e('0x19')]);}else{logger[_0xf53e('0x11')](_0xf53e('0x12'),_0x99ccb8,_0xf53e('0x15'));_0x274104(_0x5d3646[_0xf53e('0x1a')]['message']);}})[_0xf53e('0x1b')](function(_0x3b6ea6){logger['error'](_0xf53e('0x12'),_0x99ccb8,_0x3b6ea6);_0x44acbb(_0x3b6ea6);});});}exports[_0xf53e('0x1c')]=function(_0x40a99c){var _0x1a53ab=this;return new Promise(function(_0x6d581b,_0x5dd22e){return db[_0xf53e('0x1d')][_0xf53e('0x1e')]({'raw':_0x40a99c[_0xf53e('0x1f')]?_0x40a99c[_0xf53e('0x1f')][_0xf53e('0x20')]===undefined?!![]:![]:!![],'where':_0x40a99c[_0xf53e('0x1f')]?_0x40a99c[_0xf53e('0x1f')]['where']||null:null,'attributes':_0x40a99c['options']?_0x40a99c[_0xf53e('0x1f')][_0xf53e('0x21')]||null:null,'include':_0x40a99c[_0xf53e('0x1f')]?_0x40a99c['options'][_0xf53e('0x22')]?_[_0xf53e('0x23')](_0x40a99c[_0xf53e('0x1f')][_0xf53e('0x22')],function(_0x34c354){return{'model':db[_0x34c354[_0xf53e('0x24')]],'as':_0x34c354['as'],'attributes':_0x34c354['attributes'],'include':_0x34c354[_0xf53e('0x22')]?_[_0xf53e('0x23')](_0x34c354[_0xf53e('0x22')],function(_0x26987f){return{'model':db[_0x26987f[_0xf53e('0x24')]],'as':_0x26987f['as'],'attributes':_0x26987f[_0xf53e('0x21')],'include':_0x26987f['include']?_[_0xf53e('0x23')](_0x26987f[_0xf53e('0x22')],function(_0x3449b2){return{'model':db[_0x3449b2[_0xf53e('0x24')]],'as':_0x3449b2['as'],'attributes':_0x3449b2[_0xf53e('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf53e('0x10')](function(_0x21062a){logger[_0xf53e('0x11')](_0xf53e('0x1c'),_0x40a99c);logger[_0xf53e('0x13')](_0xf53e('0x1c'),_0x40a99c,JSON[_0xf53e('0x16')](_0x21062a));_0x6d581b(_0x21062a);})[_0xf53e('0x1b')](function(_0x558942){logger[_0xf53e('0x17')](_0xf53e('0x1c'),_0x558942[_0xf53e('0x19')],_0x40a99c);_0x5dd22e(_0x1a53ab['error'](0x1f4,_0x558942[_0xf53e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 6768c29..efc0201 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x220a76,_0x48ae6d){var _0x38bc6a=function(_0x2782cf){while(--_0x2782cf){_0x220a76['push'](_0x220a76['shift']());}};_0x38bc6a(++_0x48ae6d);}(_0x55ca,0x126));var _0xa55c=function(_0x2dd324,_0x2d0881){_0x2dd324=_0x2dd324-0x0;var _0x33bc5c=_0x55ca[_0x2dd324];return _0x33bc5c;};'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')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x565b84,_0x271f8e){var _0x535c21=function(_0x356ce0){while(--_0x356ce0){_0x565b84['push'](_0x565b84['shift']());}};_0x535c21(++_0x271f8e);}(_0x008c,0x188));var _0xc008=function(_0x412f4e,_0x4bfe0a){_0x412f4e=_0x412f4e-0x0;var _0x4c57d1=_0x008c[_0x412f4e];return _0x4c57d1;};'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('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 02b40c8..fed3fbc 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 _0x1915=['sequelize','exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x50ac24,_0x320386){var _0x27c096=function(_0xc2b4a){while(--_0xc2b4a){_0x50ac24['push'](_0x50ac24['shift']());}};_0x27c096(++_0x320386);}(_0x1915,0x150));var _0x5191=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1915[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x5191('0x0'));module[_0x5191('0x1')]={'priority':{'type':Sequelize[_0x5191('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5191('0x3')},'appdata':{'type':Sequelize[_0x5191('0x4')]()},'description':{'type':Sequelize[_0x5191('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5191('0x6')}}; \ No newline at end of file +var _0x40a1=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0xee9529,_0x8e4b73){var _0x5d1635=function(_0x6a12d){while(--_0x6a12d){_0xee9529['push'](_0xee9529['shift']());}};_0x5d1635(++_0x8e4b73);}(_0x40a1,0x82));var _0x140a=function(_0x204712,_0x5b4a14){_0x204712=_0x204712-0x0;var _0x862b8a=_0x40a1[_0x204712];return _0x862b8a;};'use strict';var Sequelize=require(_0x140a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x140a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x140a('0x2')],'allowNull':![],'defaultValue':_0x140a('0x3')},'appdata':{'type':Sequelize[_0x140a('0x4')]()},'description':{'type':Sequelize[_0x140a('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x140a('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 882fee1..b776698 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 _0x0520=['undefined','count','set','json','apply','reject','update','destroy','error','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','then','includeAll','include','rows','catch','show','intersection','length','options','create','body','params','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit'];(function(_0x11f7ee,_0x4cf2f7){var _0x5bf57c=function(_0x185440){while(--_0x185440){_0x11f7ee['push'](_0x11f7ee['shift']());}};_0x5bf57c(++_0x4cf2f7);}(_0x0520,0xc9));var _0x0052=function(_0x2098de,_0x95a0e7){_0x2098de=_0x2098de-0x0;var _0x1790b2=_0x0520[_0x2098de];return _0x1790b2;};'use strict';var emlformat=require(_0x0052('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0052('0x1'));var jsonpatch=require(_0x0052('0x2'));var rp=require('request-promise');var moment=require(_0x0052('0x3'));var BPromise=require(_0x0052('0x4'));var Mustache=require('mustache');var util=require(_0x0052('0x5'));var path=require(_0x0052('0x6'));var sox=require(_0x0052('0x7'));var csv=require('to-csv');var ejs=require(_0x0052('0x8'));var fs=require('fs');var fs_extra=require(_0x0052('0x9'));var _=require('lodash');var squel=require(_0x0052('0xa'));var crypto=require(_0x0052('0xb'));var jsforce=require(_0x0052('0xc'));var deskjs=require(_0x0052('0xd'));var toCsv=require(_0x0052('0xe'));var querystring=require('querystring');var Papa=require(_0x0052('0xf'));var Redis=require(_0x0052('0x10'));var authService=require(_0x0052('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0052('0x12'));var hardwareService=require(_0x0052('0x13'));var logger=require('../../config/logger')(_0x0052('0x14'));var utils=require(_0x0052('0x15'));var config=require(_0x0052('0x16'));var licenseUtil=require(_0x0052('0x17'));var db=require(_0x0052('0x18'))['db'];function respondWithStatusCode(_0x5201d7,_0x33b4df){_0x33b4df=_0x33b4df||0xcc;return function(_0x40febc){if(_0x40febc){return _0x5201d7[_0x0052('0x19')](_0x33b4df);}return _0x5201d7[_0x0052('0x1a')](_0x33b4df)[_0x0052('0x1b')]();};}function respondWithResult(_0x139ac3,_0x163bb0){_0x163bb0=_0x163bb0||0xc8;return function(_0x4bd26f){if(_0x4bd26f){return _0x139ac3[_0x0052('0x1a')](_0x163bb0)['json'](_0x4bd26f);}};}function respondWithFilteredResult(_0xd55470,_0x28ba87){return function(_0x4e6db5){if(_0x4e6db5){var _0x4e2a59=typeof _0x28ba87[_0x0052('0x1c')]==='undefined'&&typeof _0x28ba87[_0x0052('0x1d')]===_0x0052('0x1e');var _0x49813d=_0x4e6db5[_0x0052('0x1f')];var _0x37abe1=_0x4e2a59?0x0:_0x28ba87[_0x0052('0x1c')];var _0x4218da=_0x4e2a59?_0x4e6db5[_0x0052('0x1f')]:_0x28ba87[_0x0052('0x1c')]+_0x28ba87[_0x0052('0x1d')];var _0x406e17;if(_0x4218da>=_0x49813d){_0x4218da=_0x49813d;_0x406e17=0xc8;}else{_0x406e17=0xce;}_0xd55470[_0x0052('0x1a')](_0x406e17);return _0xd55470[_0x0052('0x20')]('Content-Range',_0x37abe1+'-'+_0x4218da+'/'+_0x49813d)[_0x0052('0x21')](_0x4e6db5);}return null;};}function patchUpdates(_0x48e554){return function(_0x4c938a){try{jsonpatch[_0x0052('0x22')](_0x4c938a,_0x48e554,!![]);}catch(_0x164a83){return BPromise[_0x0052('0x23')](_0x164a83);}return _0x4c938a['save']();};}function saveUpdates(_0xffcd9f,_0x43b1c3){return function(_0x58aeee){if(_0x58aeee){return _0x58aeee[_0x0052('0x24')](_0xffcd9f)['then'](function(_0x437b55){return _0x437b55;});}return null;};}function removeEntity(_0x4233c4,_0x14c5bc){return function(_0x2932f2){if(_0x2932f2){return _0x2932f2[_0x0052('0x25')]()['then'](function(){_0x4233c4[_0x0052('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a1152,_0x4c52c8){return function(_0x5c87f9){if(!_0x5c87f9){_0x4a1152[_0x0052('0x19')](0x194);}return _0x5c87f9;};}function handleError(_0x416ce2,_0x40883f){_0x40883f=_0x40883f||0x1f4;return function(_0x1ad095){logger[_0x0052('0x26')](_0x1ad095[_0x0052('0x27')]);if(_0x1ad095[_0x0052('0x28')]){delete _0x1ad095[_0x0052('0x28')];}_0x416ce2[_0x0052('0x1a')](_0x40883f)[_0x0052('0x29')](_0x1ad095);};}exports[_0x0052('0x2a')]=function(_0x5cee21,_0x190cce){var _0x2f9513={},_0x331e32={},_0x594e27={'count':0x0,'rows':[]};var _0x22fd68=_['map'](db[_0x0052('0x2b')][_0x0052('0x2c')],function(_0x58dbea){return{'name':_0x58dbea[_0x0052('0x2d')],'type':_0x58dbea[_0x0052('0x2e')][_0x0052('0x2f')]};});_0x331e32[_0x0052('0x30')]=_[_0x0052('0x31')](_0x22fd68,'name');_0x331e32[_0x0052('0x32')]=_[_0x0052('0x33')](_0x5cee21[_0x0052('0x32')]);_0x331e32['filters']=_['intersection'](_0x331e32[_0x0052('0x30')],_0x331e32['query']);_0x2f9513[_0x0052('0x34')]=_['intersection'](_0x331e32[_0x0052('0x30')],qs[_0x0052('0x35')](_0x5cee21['query'][_0x0052('0x35')]));_0x2f9513[_0x0052('0x34')]=_0x2f9513['attributes']['length']?_0x2f9513[_0x0052('0x34')]:_0x331e32['model'];if(!_0x5cee21[_0x0052('0x32')][_0x0052('0x36')](_0x0052('0x37'))){_0x2f9513[_0x0052('0x1d')]=qs['limit'](_0x5cee21['query'][_0x0052('0x1d')]);_0x2f9513[_0x0052('0x1c')]=qs[_0x0052('0x1c')](_0x5cee21[_0x0052('0x32')][_0x0052('0x1c')]);}_0x2f9513[_0x0052('0x38')]=qs[_0x0052('0x39')](_0x5cee21[_0x0052('0x32')]['sort']);_0x2f9513[_0x0052('0x3a')]=qs[_0x0052('0x3b')](_[_0x0052('0x3c')](_0x5cee21[_0x0052('0x32')],_0x331e32[_0x0052('0x3b')]),_0x22fd68);if(_0x5cee21[_0x0052('0x32')][_0x0052('0x3d')]){_0x2f9513[_0x0052('0x3a')]=_['merge'](_0x2f9513[_0x0052('0x3a')],{'$or':_[_0x0052('0x31')](_0x22fd68,function(_0x526225){if(_0x526225[_0x0052('0x2e')]!==_0x0052('0x3e')){var _0x4015fd={};_0x4015fd[_0x526225[_0x0052('0x28')]]={'$like':'%'+_0x5cee21[_0x0052('0x32')][_0x0052('0x3d')]+'%'};return _0x4015fd;}})});}_0x2f9513=_[_0x0052('0x3f')]({},_0x2f9513,_0x5cee21['options']);var _0x1705af={'where':_0x2f9513['where']};return db['SmsApplication'][_0x0052('0x1f')](_0x1705af)[_0x0052('0x40')](function(_0x323250){_0x594e27['count']=_0x323250;if(_0x5cee21[_0x0052('0x32')][_0x0052('0x41')]){_0x2f9513[_0x0052('0x42')]=[{'all':!![]}];}return db[_0x0052('0x2b')]['findAll'](_0x2f9513);})[_0x0052('0x40')](function(_0x4276e8){_0x594e27[_0x0052('0x43')]=_0x4276e8;return _0x594e27;})['then'](respondWithFilteredResult(_0x190cce,_0x2f9513))[_0x0052('0x44')](handleError(_0x190cce,null));};exports[_0x0052('0x45')]=function(_0x2e4ac4,_0x140067){var _0x3e6809={'raw':!![],'where':{'id':_0x2e4ac4['params']['id']}},_0x2cddbe={};_0x2cddbe['model']=_[_0x0052('0x33')](db[_0x0052('0x2b')]['rawAttributes']);_0x2cddbe[_0x0052('0x32')]=_[_0x0052('0x33')](_0x2e4ac4[_0x0052('0x32')]);_0x2cddbe['filters']=_[_0x0052('0x46')](_0x2cddbe['model'],_0x2cddbe[_0x0052('0x32')]);_0x3e6809[_0x0052('0x34')]=_[_0x0052('0x46')](_0x2cddbe[_0x0052('0x30')],qs[_0x0052('0x35')](_0x2e4ac4[_0x0052('0x32')][_0x0052('0x35')]));_0x3e6809[_0x0052('0x34')]=_0x3e6809[_0x0052('0x34')][_0x0052('0x47')]?_0x3e6809[_0x0052('0x34')]:_0x2cddbe[_0x0052('0x30')];if(_0x2e4ac4[_0x0052('0x32')][_0x0052('0x41')]){_0x3e6809[_0x0052('0x42')]=[{'all':!![]}];}_0x3e6809=_[_0x0052('0x3f')]({},_0x3e6809,_0x2e4ac4[_0x0052('0x48')]);return db[_0x0052('0x2b')]['find'](_0x3e6809)[_0x0052('0x40')](handleEntityNotFound(_0x140067,null))[_0x0052('0x40')](respondWithResult(_0x140067,null))[_0x0052('0x44')](handleError(_0x140067,null));};exports[_0x0052('0x49')]=function(_0x4a6194,_0x57750c){return db[_0x0052('0x2b')]['create'](_0x4a6194[_0x0052('0x4a')],{})[_0x0052('0x40')](respondWithResult(_0x57750c,0xc9))['catch'](handleError(_0x57750c,null));};exports[_0x0052('0x24')]=function(_0x2e1269,_0x11b44e){if(_0x2e1269[_0x0052('0x4a')]['id']){delete _0x2e1269[_0x0052('0x4a')]['id'];}return db[_0x0052('0x2b')]['find']({'where':{'id':_0x2e1269[_0x0052('0x4b')]['id']}})[_0x0052('0x40')](handleEntityNotFound(_0x11b44e,null))[_0x0052('0x40')](saveUpdates(_0x2e1269['body'],null))['then'](respondWithResult(_0x11b44e,null))['catch'](handleError(_0x11b44e,null));};exports[_0x0052('0x25')]=function(_0x21e93e,_0x3bf42c){return db[_0x0052('0x2b')][_0x0052('0x4c')]({'where':{'id':_0x21e93e[_0x0052('0x4b')]['id']}})[_0x0052('0x40')](handleEntityNotFound(_0x3bf42c,null))['then'](removeEntity(_0x3bf42c,null))['catch'](handleError(_0x3bf42c,null));}; \ No newline at end of file +var _0xf2b1=['order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x30b9b7,_0x360072){var _0x2eb37c=function(_0x43cb70){while(--_0x43cb70){_0x30b9b7['push'](_0x30b9b7['shift']());}};_0x2eb37c(++_0x360072);}(_0xf2b1,0x139));var _0x1f2b=function(_0x2e997e,_0x4edf31){_0x2e997e=_0x2e997e-0x0;var _0x5a6cb1=_0xf2b1[_0x2e997e];return _0x5a6cb1;};'use strict';var emlformat=require(_0x1f2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f2b('0x1'));var jsonpatch=require(_0x1f2b('0x2'));var rp=require(_0x1f2b('0x3'));var moment=require(_0x1f2b('0x4'));var BPromise=require(_0x1f2b('0x5'));var Mustache=require(_0x1f2b('0x6'));var util=require(_0x1f2b('0x7'));var path=require(_0x1f2b('0x8'));var sox=require(_0x1f2b('0x9'));var csv=require(_0x1f2b('0xa'));var ejs=require(_0x1f2b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f2b('0xc'));var squel=require(_0x1f2b('0xd'));var crypto=require(_0x1f2b('0xe'));var jsforce=require(_0x1f2b('0xf'));var deskjs=require(_0x1f2b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1f2b('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f2b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f2b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1f2b('0x14'));var licenseUtil=require(_0x1f2b('0x15'));var db=require(_0x1f2b('0x16'))['db'];function respondWithStatusCode(_0x343863,_0x2286f4){_0x2286f4=_0x2286f4||0xcc;return function(_0x31f4e3){if(_0x31f4e3){return _0x343863['sendStatus'](_0x2286f4);}return _0x343863[_0x1f2b('0x17')](_0x2286f4)[_0x1f2b('0x18')]();};}function respondWithResult(_0x2d7cf0,_0x48e4c8){_0x48e4c8=_0x48e4c8||0xc8;return function(_0x346084){if(_0x346084){return _0x2d7cf0['status'](_0x48e4c8)['json'](_0x346084);}};}function respondWithFilteredResult(_0xa4e773,_0xf6d867){return function(_0x5d4460){if(_0x5d4460){var _0x4db9bd=typeof _0xf6d867[_0x1f2b('0x19')]==='undefined'&&typeof _0xf6d867[_0x1f2b('0x1a')]===_0x1f2b('0x1b');var _0x1e27cd=_0x5d4460['count'];var _0x2b07de=_0x4db9bd?0x0:_0xf6d867[_0x1f2b('0x19')];var _0x322b09=_0x4db9bd?_0x5d4460[_0x1f2b('0x1c')]:_0xf6d867['offset']+_0xf6d867[_0x1f2b('0x1a')];var _0x20a61f;if(_0x322b09>=_0x1e27cd){_0x322b09=_0x1e27cd;_0x20a61f=0xc8;}else{_0x20a61f=0xce;}_0xa4e773[_0x1f2b('0x17')](_0x20a61f);return _0xa4e773['set'](_0x1f2b('0x1d'),_0x2b07de+'-'+_0x322b09+'/'+_0x1e27cd)['json'](_0x5d4460);}return null;};}function patchUpdates(_0x289623){return function(_0x50c4d8){try{jsonpatch[_0x1f2b('0x1e')](_0x50c4d8,_0x289623,!![]);}catch(_0x48269d){return BPromise[_0x1f2b('0x1f')](_0x48269d);}return _0x50c4d8[_0x1f2b('0x20')]();};}function saveUpdates(_0x30aa81,_0x1b9845){return function(_0x436585){if(_0x436585){return _0x436585[_0x1f2b('0x21')](_0x30aa81)['then'](function(_0x51e4b6){return _0x51e4b6;});}return null;};}function removeEntity(_0x38aa40,_0x4d0752){return function(_0x360f0c){if(_0x360f0c){return _0x360f0c[_0x1f2b('0x22')]()[_0x1f2b('0x23')](function(){_0x38aa40[_0x1f2b('0x17')](0xcc)[_0x1f2b('0x18')]();});}};}function handleEntityNotFound(_0x3f885d,_0x94bc86){return function(_0x595e8d){if(!_0x595e8d){_0x3f885d[_0x1f2b('0x24')](0x194);}return _0x595e8d;};}function handleError(_0x1d2d53,_0xa7d569){_0xa7d569=_0xa7d569||0x1f4;return function(_0x3ace48){logger[_0x1f2b('0x25')](_0x3ace48['stack']);if(_0x3ace48['name']){delete _0x3ace48[_0x1f2b('0x26')];}_0x1d2d53[_0x1f2b('0x17')](_0xa7d569)[_0x1f2b('0x27')](_0x3ace48);};}exports[_0x1f2b('0x28')]=function(_0x5d8ecd,_0x223bf3){var _0x1f4614={},_0x331921={},_0x5f404e={'count':0x0,'rows':[]};var _0x3ba8ee=_[_0x1f2b('0x29')](db[_0x1f2b('0x2a')][_0x1f2b('0x2b')],function(_0x54da37){return{'name':_0x54da37[_0x1f2b('0x2c')],'type':_0x54da37[_0x1f2b('0x2d')][_0x1f2b('0x2e')]};});_0x331921[_0x1f2b('0x2f')]=_[_0x1f2b('0x29')](_0x3ba8ee,_0x1f2b('0x26'));_0x331921[_0x1f2b('0x30')]=_[_0x1f2b('0x31')](_0x5d8ecd[_0x1f2b('0x30')]);_0x331921[_0x1f2b('0x32')]=_[_0x1f2b('0x33')](_0x331921[_0x1f2b('0x2f')],_0x331921[_0x1f2b('0x30')]);_0x1f4614['attributes']=_['intersection'](_0x331921['model'],qs[_0x1f2b('0x34')](_0x5d8ecd[_0x1f2b('0x30')][_0x1f2b('0x34')]));_0x1f4614[_0x1f2b('0x35')]=_0x1f4614[_0x1f2b('0x35')][_0x1f2b('0x36')]?_0x1f4614[_0x1f2b('0x35')]:_0x331921[_0x1f2b('0x2f')];if(!_0x5d8ecd[_0x1f2b('0x30')][_0x1f2b('0x37')](_0x1f2b('0x38'))){_0x1f4614[_0x1f2b('0x1a')]=qs[_0x1f2b('0x1a')](_0x5d8ecd[_0x1f2b('0x30')][_0x1f2b('0x1a')]);_0x1f4614[_0x1f2b('0x19')]=qs[_0x1f2b('0x19')](_0x5d8ecd[_0x1f2b('0x30')]['offset']);}_0x1f4614[_0x1f2b('0x39')]=qs[_0x1f2b('0x3a')](_0x5d8ecd['query'][_0x1f2b('0x3a')]);_0x1f4614['where']=qs['filters'](_[_0x1f2b('0x3b')](_0x5d8ecd['query'],_0x331921[_0x1f2b('0x32')]),_0x3ba8ee);if(_0x5d8ecd[_0x1f2b('0x30')][_0x1f2b('0x3c')]){_0x1f4614['where']=_[_0x1f2b('0x3d')](_0x1f4614[_0x1f2b('0x3e')],{'$or':_['map'](_0x3ba8ee,function(_0x3a8a9a){if(_0x3a8a9a[_0x1f2b('0x2d')]!==_0x1f2b('0x3f')){var _0x24c48e={};_0x24c48e[_0x3a8a9a[_0x1f2b('0x26')]]={'$like':'%'+_0x5d8ecd[_0x1f2b('0x30')]['filter']+'%'};return _0x24c48e;}})});}_0x1f4614=_[_0x1f2b('0x3d')]({},_0x1f4614,_0x5d8ecd['options']);var _0x5af94c={'where':_0x1f4614[_0x1f2b('0x3e')]};return db[_0x1f2b('0x2a')][_0x1f2b('0x1c')](_0x5af94c)['then'](function(_0x18ba1e){_0x5f404e[_0x1f2b('0x1c')]=_0x18ba1e;if(_0x5d8ecd['query'][_0x1f2b('0x40')]){_0x1f4614[_0x1f2b('0x41')]=[{'all':!![]}];}return db['SmsApplication'][_0x1f2b('0x42')](_0x1f4614);})['then'](function(_0x9ad9d2){_0x5f404e['rows']=_0x9ad9d2;return _0x5f404e;})['then'](respondWithFilteredResult(_0x223bf3,_0x1f4614))[_0x1f2b('0x43')](handleError(_0x223bf3,null));};exports[_0x1f2b('0x44')]=function(_0x8eb904,_0x8c45b1){var _0x6987e7={'raw':!![],'where':{'id':_0x8eb904[_0x1f2b('0x45')]['id']}},_0x4e17da={};_0x4e17da[_0x1f2b('0x2f')]=_[_0x1f2b('0x31')](db[_0x1f2b('0x2a')][_0x1f2b('0x2b')]);_0x4e17da[_0x1f2b('0x30')]=_[_0x1f2b('0x31')](_0x8eb904[_0x1f2b('0x30')]);_0x4e17da[_0x1f2b('0x32')]=_[_0x1f2b('0x33')](_0x4e17da['model'],_0x4e17da['query']);_0x6987e7[_0x1f2b('0x35')]=_[_0x1f2b('0x33')](_0x4e17da[_0x1f2b('0x2f')],qs[_0x1f2b('0x34')](_0x8eb904[_0x1f2b('0x30')][_0x1f2b('0x34')]));_0x6987e7[_0x1f2b('0x35')]=_0x6987e7[_0x1f2b('0x35')]['length']?_0x6987e7[_0x1f2b('0x35')]:_0x4e17da[_0x1f2b('0x2f')];if(_0x8eb904[_0x1f2b('0x30')][_0x1f2b('0x40')]){_0x6987e7['include']=[{'all':!![]}];}_0x6987e7=_[_0x1f2b('0x3d')]({},_0x6987e7,_0x8eb904[_0x1f2b('0x46')]);return db[_0x1f2b('0x2a')][_0x1f2b('0x47')](_0x6987e7)[_0x1f2b('0x23')](handleEntityNotFound(_0x8c45b1,null))[_0x1f2b('0x23')](respondWithResult(_0x8c45b1,null))[_0x1f2b('0x43')](handleError(_0x8c45b1,null));};exports[_0x1f2b('0x48')]=function(_0x4cef28,_0x4dde1b){return db[_0x1f2b('0x2a')][_0x1f2b('0x48')](_0x4cef28[_0x1f2b('0x49')],{})[_0x1f2b('0x23')](respondWithResult(_0x4dde1b,0xc9))[_0x1f2b('0x43')](handleError(_0x4dde1b,null));};exports[_0x1f2b('0x21')]=function(_0x49f656,_0x1319c9){if(_0x49f656[_0x1f2b('0x49')]['id']){delete _0x49f656[_0x1f2b('0x49')]['id'];}return db[_0x1f2b('0x2a')][_0x1f2b('0x47')]({'where':{'id':_0x49f656[_0x1f2b('0x45')]['id']}})[_0x1f2b('0x23')](handleEntityNotFound(_0x1319c9,null))['then'](saveUpdates(_0x49f656[_0x1f2b('0x49')],null))['then'](respondWithResult(_0x1319c9,null))['catch'](handleError(_0x1319c9,null));};exports[_0x1f2b('0x22')]=function(_0x3c58a7,_0x36998d){return db['SmsApplication'][_0x1f2b('0x47')]({'where':{'id':_0x3c58a7[_0x1f2b('0x45')]['id']}})[_0x1f2b('0x23')](handleEntityNotFound(_0x36998d,null))[_0x1f2b('0x23')](removeEntity(_0x36998d,null))[_0x1f2b('0x43')](handleError(_0x36998d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c8c9b3e..e3c87ed 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 _0x0547=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','define','SmsApplication'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0547,0x189));var _0x7054=function(_0x4a105f,_0x48f327){_0x4a105f=_0x4a105f-0x0;var _0x52b9d1=_0x0547[_0x4a105f];return _0x52b9d1;};'use strict';var _=require(_0x7054('0x0'));var util=require('util');var logger=require(_0x7054('0x1'))('api');var moment=require(_0x7054('0x2'));var BPromise=require(_0x7054('0x3'));var rp=require(_0x7054('0x4'));var fs=require('fs');var path=require(_0x7054('0x5'));var rimraf=require(_0x7054('0x6'));var config=require('../../config/environment');var attributes=require(_0x7054('0x7'));module['exports']=function(_0x4ff014,_0x5e95e3){return _0x4ff014[_0x7054('0x8')](_0x7054('0x9'),attributes,{'tableName':_0x7054('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7054('0xb'),'collate':_0x7054('0xc')});}; \ No newline at end of file +var _0x0d9c=['../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5a69ab,_0x610049){var _0x27f2f7=function(_0x452a0c){while(--_0x452a0c){_0x5a69ab['push'](_0x5a69ab['shift']());}};_0x27f2f7(++_0x610049);}(_0x0d9c,0x7c));var _0xc0d9=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0x0d9c[_0x21cb7f];return _0x5a079a;};'use strict';var _=require('lodash');var util=require(_0xc0d9('0x0'));var logger=require(_0xc0d9('0x1'))(_0xc0d9('0x2'));var moment=require(_0xc0d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0d9('0x4'));var fs=require('fs');var path=require(_0xc0d9('0x5'));var rimraf=require('rimraf');var config=require(_0xc0d9('0x6'));var attributes=require('./smsApplication.attributes');module[_0xc0d9('0x7')]=function(_0x3f2b59,_0x2b5ae3){return _0x3f2b59[_0xc0d9('0x8')](_0xc0d9('0x9'),attributes,{'tableName':_0xc0d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc0d9('0xb'),'collate':_0xc0d9('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 9bebe25..ee28906 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 _0x82d8=['jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','ioredis','../../config/utils','../../config/environment'];(function(_0x366f11,_0x3cab33){var _0x271375=function(_0x2e5d20){while(--_0x2e5d20){_0x366f11['push'](_0x366f11['shift']());}};_0x271375(++_0x3cab33);}(_0x82d8,0xff));var _0x882d=function(_0x561ab8,_0x56c82d){_0x561ab8=_0x561ab8-0x0;var _0x394b5e=_0x82d8[_0x561ab8];return _0x394b5e;};'use strict';var _=require(_0x882d('0x0'));var util=require('util');var moment=require(_0x882d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x882d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x882d('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x882d('0x4'));var jayson=require(_0x882d('0x5'));var client=jayson[_0x882d('0x6')][_0x882d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb7539b,_0x3c8b67,_0x4067a9){return new BPromise(function(_0x4ea710,_0x4035ba){return client[_0x882d('0x8')](_0xb7539b,_0x4067a9)[_0x882d('0x9')](function(_0x4da4aa){logger[_0x882d('0xa')](_0x882d('0xb'),_0x3c8b67,'request\x20sent');logger[_0x882d('0xc')](_0x882d('0xd'),_0x3c8b67,_0x882d('0xe'),JSON['stringify'](_0x4da4aa));if(_0x4da4aa[_0x882d('0xf')]){if(_0x4da4aa[_0x882d('0xf')][_0x882d('0x10')]===0x1f4){logger[_0x882d('0xf')](_0x882d('0xb'),_0x3c8b67,_0x4da4aa[_0x882d('0xf')][_0x882d('0x11')]);return _0x4035ba(_0x4da4aa['error']['message']);}logger[_0x882d('0xf')](_0x882d('0xb'),_0x3c8b67,_0x4da4aa[_0x882d('0xf')][_0x882d('0x11')]);return _0x4ea710(_0x4da4aa[_0x882d('0xf')]['message']);}else{logger[_0x882d('0xa')](_0x882d('0xb'),_0x3c8b67,_0x882d('0xe'));_0x4ea710(_0x4da4aa[_0x882d('0x12')][_0x882d('0x11')]);}})[_0x882d('0x13')](function(_0x46cfcc){logger[_0x882d('0xf')](_0x882d('0xb'),_0x3c8b67,_0x46cfcc);_0x4035ba(_0x46cfcc);});});} \ No newline at end of file +var _0xe9ef=['client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3c9548,_0x216a7e){var _0x2ce3ab=function(_0x300932){while(--_0x300932){_0x3c9548['push'](_0x3c9548['shift']());}};_0x2ce3ab(++_0x216a7e);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0xe9ef[_0x58a4ac];return _0x545810;};'use strict';var _=require(_0xfe9e('0x0'));var util=require('util');var moment=require(_0xfe9e('0x1'));var BPromise=require(_0xfe9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe9e('0x4'));var logger=require(_0xfe9e('0x5'))(_0xfe9e('0x6'));var config=require(_0xfe9e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfe9e('0x8')][_0xfe9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x493722,_0x539d85,_0x1ae09c){return new BPromise(function(_0x51d134,_0x4325a6){return client[_0xfe9e('0xa')](_0x493722,_0x1ae09c)[_0xfe9e('0xb')](function(_0x48cd0b){logger[_0xfe9e('0xc')](_0xfe9e('0xd'),_0x539d85,_0xfe9e('0xe'));logger['debug'](_0xfe9e('0xf'),_0x539d85,'request\x20sent',JSON[_0xfe9e('0x10')](_0x48cd0b));if(_0x48cd0b[_0xfe9e('0x11')]){if(_0x48cd0b[_0xfe9e('0x11')][_0xfe9e('0x12')]===0x1f4){logger[_0xfe9e('0x11')](_0xfe9e('0xd'),_0x539d85,_0x48cd0b[_0xfe9e('0x11')][_0xfe9e('0x13')]);return _0x4325a6(_0x48cd0b[_0xfe9e('0x11')]['message']);}logger[_0xfe9e('0x11')](_0xfe9e('0xd'),_0x539d85,_0x48cd0b['error'][_0xfe9e('0x13')]);return _0x51d134(_0x48cd0b[_0xfe9e('0x11')][_0xfe9e('0x13')]);}else{logger[_0xfe9e('0xc')]('SmsApplication,\x20%s,\x20%s',_0x539d85,'request\x20sent');_0x51d134(_0x48cd0b[_0xfe9e('0x14')][_0xfe9e('0x13')]);}})[_0xfe9e('0x15')](function(_0x30ad77){logger['error'](_0xfe9e('0xd'),_0x539d85,_0x30ad77);_0x4325a6(_0x30ad77);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 1f276af..eb51593 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 _0x2032=['./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','smsinteraction:update','update','smsinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0x2032,0xd9));var _0x2203=function(_0x12952e,_0x32221f){_0x12952e=_0x12952e-0x0;var _0x184e49=_0x2032[_0x12952e];return _0x184e49;};'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',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['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x2203('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction[_0x2203('0x19')](_0x2203('0x14'),_0x2203('0x1a')),controller[_0x2203('0x1b')]);router['delete'](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x1c')),controller['destroy']);router[_0x2203('0x1d')]('/:id/tags',auth[_0x2203('0x9')](),controller[_0x2203('0x1e')]);module[_0x2203('0x1f')]=router; \ No newline at end of file +var _0x9ffd=['sms','smsinteraction:addtags','put','smsinteraction:update','delete','tracked','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x5180c3,_0x4b35f7){var _0x55c975=function(_0x4746cb){while(--_0x4746cb){_0x5180c3['push'](_0x5180c3['shift']());}};_0x55c975(++_0x4b35f7);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2c9ad2,_0x33c36b){_0x2c9ad2=_0x2c9ad2-0x0;var _0x4db612=_0x9ffd[_0x2c9ad2];return _0x4db612;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0x12')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router['post']('/:id/messages',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x14')]);router[_0xd9ff('0x12')](_0xd9ff('0x15'),auth[_0xd9ff('0x9')](),interaction['tracked'](_0xd9ff('0x16'),_0xd9ff('0x17')),controller['addTags']);router[_0xd9ff('0x18')]('/:id',auth['isAuthenticated'](),interaction['tracked']('sms',_0xd9ff('0x19')),controller['update']);router[_0xd9ff('0x1a')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),interaction[_0xd9ff('0x1b')](_0xd9ff('0x16'),_0xd9ff('0x1c')),controller[_0xd9ff('0x1d')]);router[_0xd9ff('0x1a')](_0xd9ff('0x15'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x1e')]);module[_0xd9ff('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 6c50d8d..a6bd6a1 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 _0xf567=['INTEGER','sequelize','moment','exports','DATE','STRING','out','ENUM','BOOLEAN'];(function(_0x4c255c,_0x2ddb19){var _0x21e78e=function(_0x370ef3){while(--_0x370ef3){_0x4c255c['push'](_0x4c255c['shift']());}};_0x21e78e(++_0x2ddb19);}(_0xf567,0x118));var _0x7f56=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf567[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x7f56('0x0'));var moment=require(_0x7f56('0x1'));module[_0x7f56('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7f56('0x3')]},'disposition':{'type':Sequelize[_0x7f56('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7f56('0x4')]},'note':{'type':Sequelize[_0x7f56('0x4')]},'phone':{'type':Sequelize[_0x7f56('0x4')]},'read1stAt':{'type':Sequelize[_0x7f56('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7f56('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7f56('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7f56('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7f56('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7f56('0x8')]}}; \ No newline at end of file +var _0x6efe=['STRING','ENUM','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x6efe,0xc6));var _0xe6ef=function(_0xc715bd,_0x1a8b5f){_0xc715bd=_0xc715bd-0x0;var _0xfbd04c=_0x6efe[_0xc715bd];return _0xfbd04c;};'use strict';var Sequelize=require(_0xe6ef('0x0'));var moment=require(_0xe6ef('0x1'));module[_0xe6ef('0x2')]={'closed':{'type':Sequelize[_0xe6ef('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe6ef('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe6ef('0x5')]},'note':{'type':Sequelize[_0xe6ef('0x5')]},'phone':{'type':Sequelize[_0xe6ef('0x5')]},'read1stAt':{'type':Sequelize[_0xe6ef('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe6ef('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe6ef('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe6ef('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'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 c503957..212a617 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 _0x2a17=['Account','get','mkdirSync','Sms','Owner','N.A.','createdAt','closed','closedAt','Messages','out','System','lastName','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','err','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./smsInteraction.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','then','destroy','error','stack','name','send','index','map','SmsInteraction','rawAttributes','key','getOptions','findAll','sms','query','catch','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','update','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','SmsInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','direction','secret','read','SmsAccount'];(function(_0x5ad651,_0xf9a447){var _0x3283fd=function(_0x5a785a){while(--_0x5a785a){_0x5ad651['push'](_0x5ad651['shift']());}};_0x3283fd(++_0xf9a447);}(_0x2a17,0x1ec));var _0x72a1=function(_0x450fb4,_0x99a5e7){_0x450fb4=_0x450fb4-0x0;var _0x43e91a=_0x2a17[_0x450fb4];return _0x43e91a;};'use strict';var rimraf=require(_0x72a1('0x0'));var zipdir=require(_0x72a1('0x1'));var moment=require(_0x72a1('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x72a1('0x3'));var ejs=require(_0x72a1('0x4'));var fs=require('fs');var _=require(_0x72a1('0x5'));var Redis=require('ioredis');var interaction=require(_0x72a1('0x6'));var qs=require(_0x72a1('0x7'));var pdf=require(_0x72a1('0x8'));var logger=require(_0x72a1('0x9'))(_0x72a1('0xa'));var config=require(_0x72a1('0xb'));var db=require(_0x72a1('0xc'))['db'];config[_0x72a1('0xd')]=_[_0x72a1('0xe')](config[_0x72a1('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72a1('0xd')]));require(_0x72a1('0xf'))['register'](socket);function respondWithStatusCode(_0x4c5e30,_0x135a4a){_0x135a4a=_0x135a4a||0xcc;return function(_0x56bf87){if(_0x56bf87){return _0x4c5e30[_0x72a1('0x10')](_0x135a4a);}return _0x4c5e30[_0x72a1('0x11')](_0x135a4a)[_0x72a1('0x12')]();};}function respondWithResult(_0x42286c,_0x1bde34){_0x1bde34=_0x1bde34||0xc8;return function(_0x1b3ec6){if(_0x1b3ec6){return _0x42286c[_0x72a1('0x11')](_0x1bde34)[_0x72a1('0x13')](_0x1b3ec6);}};}function respondWithFilteredResult(_0x45d2c1,_0x285501){return function(_0x2b3dfe){if(_0x2b3dfe){var _0x513bf2=typeof _0x285501['offset']===_0x72a1('0x14')&&typeof _0x285501[_0x72a1('0x15')]===_0x72a1('0x14');var _0x4ddd30=_0x2b3dfe[_0x72a1('0x16')];var _0x268051=_0x513bf2?0x0:_0x285501[_0x72a1('0x17')];var _0xb9df97=_0x513bf2?_0x2b3dfe[_0x72a1('0x16')]:_0x285501['offset']+_0x285501[_0x72a1('0x15')];var _0x282459;if(_0xb9df97>=_0x4ddd30){_0xb9df97=_0x4ddd30;_0x282459=0xc8;}else{_0x282459=0xce;}_0x45d2c1[_0x72a1('0x11')](_0x282459);return _0x45d2c1[_0x72a1('0x18')]('Content-Range',_0x268051+'-'+_0xb9df97+'/'+_0x4ddd30)[_0x72a1('0x13')](_0x2b3dfe);}return null;};}function saveUpdates(_0x94de07){return function(_0x1649f9){if(_0x1649f9){return _0x1649f9['update'](_0x94de07)[_0x72a1('0x19')](function(_0x46a683){return _0x46a683;});}return null;};}function removeEntity(_0x36d263){return function(_0x20d781){if(_0x20d781){return _0x20d781[_0x72a1('0x1a')]()[_0x72a1('0x19')](function(){_0x36d263[_0x72a1('0x11')](0xcc)[_0x72a1('0x12')]();});}};}function handleEntityNotFound(_0xc7bde7){return function(_0x2e58de){if(!_0x2e58de){_0xc7bde7[_0x72a1('0x10')](0x194);}return _0x2e58de;};}function handleError(_0x52902d,_0x56e123){_0x56e123=_0x56e123||0x1f4;return function(_0x306b7d){logger[_0x72a1('0x1b')](_0x306b7d[_0x72a1('0x1c')]);if(_0x306b7d['name']){delete _0x306b7d[_0x72a1('0x1d')];}_0x52902d['status'](_0x56e123)[_0x72a1('0x1e')](_0x306b7d);};}exports[_0x72a1('0x1f')]=function(_0x403274,_0x5aa5c7){var _0x55fc1f={};var _0x30429e=_[_0x72a1('0x20')](db[_0x72a1('0x21')][_0x72a1('0x22')],function(_0x484473){return{'name':_0x484473['fieldName'],'type':_0x484473['type'][_0x72a1('0x23')]};});_0x55fc1f=qs[_0x72a1('0x24')](_0x30429e,_0x403274);return interaction[_0x72a1('0x25')](_0x72a1('0x26'),_0x403274[_0x72a1('0x27')],_0x403274['user'],_0x55fc1f,_0x30429e)[_0x72a1('0x19')](respondWithFilteredResult(_0x5aa5c7,_0x55fc1f))[_0x72a1('0x28')](handleError(_0x5aa5c7,null));};exports[_0x72a1('0x29')]=function(_0x13ed19,_0x161fbc){var _0x581712={'raw':![],'where':{'id':_0x13ed19[_0x72a1('0x2a')]['id']}},_0x29d0ce={};_0x29d0ce[_0x72a1('0x2b')]=_[_0x72a1('0x2c')](db[_0x72a1('0x21')][_0x72a1('0x22')]);_0x29d0ce[_0x72a1('0x27')]=_[_0x72a1('0x2c')](_0x13ed19[_0x72a1('0x27')]);_0x29d0ce[_0x72a1('0x2d')]=_['intersection'](_0x29d0ce[_0x72a1('0x2b')],_0x29d0ce['query']);_0x581712[_0x72a1('0x2e')]=_[_0x72a1('0x2f')](_0x29d0ce[_0x72a1('0x2b')],qs[_0x72a1('0x30')](_0x13ed19[_0x72a1('0x27')][_0x72a1('0x30')]));_0x581712[_0x72a1('0x2e')]=_0x581712['attributes'][_0x72a1('0x31')]?_0x581712[_0x72a1('0x2e')]:_0x29d0ce[_0x72a1('0x2b')];if(_0x13ed19['query'][_0x72a1('0x32')]){_0x581712[_0x72a1('0x33')]=[{'all':!![]}];}_0x581712=_[_0x72a1('0x34')]({},_0x581712,_0x13ed19[_0x72a1('0x35')]);return db['SmsInteraction'][_0x72a1('0x36')](_0x581712)[_0x72a1('0x19')](handleEntityNotFound(_0x161fbc,null))[_0x72a1('0x19')](respondWithResult(_0x161fbc,null))[_0x72a1('0x28')](handleError(_0x161fbc,null));};exports[_0x72a1('0x37')]=function(_0xf151b5,_0x5b0656){return db[_0x72a1('0x21')][_0x72a1('0x37')](_0xf151b5[_0x72a1('0x38')],{})['then'](respondWithResult(_0x5b0656,0xc9))[_0x72a1('0x28')](handleError(_0x5b0656,null));};exports[_0x72a1('0x39')]=function(_0x4f9429,_0x15968f){if(_0x4f9429[_0x72a1('0x38')]['id']){delete _0x4f9429['body']['id'];}return db[_0x72a1('0x21')][_0x72a1('0x36')]({'where':{'id':_0x4f9429['params']['id']}})[_0x72a1('0x19')](handleEntityNotFound(_0x15968f,null))[_0x72a1('0x19')](saveUpdates(_0x4f9429[_0x72a1('0x38')],null))[_0x72a1('0x19')](respondWithResult(_0x15968f,null))[_0x72a1('0x28')](handleError(_0x15968f,null));};exports[_0x72a1('0x1a')]=function(_0x34b234,_0x422602){return db[_0x72a1('0x21')][_0x72a1('0x36')]({'where':{'id':_0x34b234[_0x72a1('0x2a')]['id']}})[_0x72a1('0x19')](handleEntityNotFound(_0x422602,null))[_0x72a1('0x19')](removeEntity(_0x422602,null))[_0x72a1('0x28')](handleError(_0x422602,null));};exports['describe']=function(_0x30e94b,_0x418166){return db[_0x72a1('0x21')]['describe']()[_0x72a1('0x19')](respondWithResult(_0x418166,null))[_0x72a1('0x28')](handleError(_0x418166,null));};exports[_0x72a1('0x3a')]=function(_0x356576,_0x4e3adf){return db[_0x72a1('0x3b')][_0x72a1('0x36')]({'where':{'id':_0x356576[_0x72a1('0x2a')]['id']}})[_0x72a1('0x19')](handleEntityNotFound(_0x4e3adf,null))[_0x72a1('0x19')](function(_0x55b46b){if(_0x55b46b){return _0x55b46b[_0x72a1('0x3a')](_0x356576[_0x72a1('0x38')][_0x72a1('0x3c')],_[_0x72a1('0x3d')](_0x356576[_0x72a1('0x38')],['ids','id'])||{});}})[_0x72a1('0x19')](respondWithResult(_0x4e3adf,null))[_0x72a1('0x28')](handleError(_0x4e3adf,null));};exports[_0x72a1('0x3e')]=function(_0x5bdf9e,_0xe9c4f1){var _0x3af8aa={'raw':![],'where':{}};var _0x8faf58={};var _0x54c9c2={'count':0x0,'rows':[]};return db[_0x72a1('0x21')][_0x72a1('0x3f')]({'where':{'id':_0x5bdf9e[_0x72a1('0x2a')]['id']}})['then'](handleEntityNotFound(_0xe9c4f1,null))[_0x72a1('0x19')](function(_0x2a8de8){if(_0x2a8de8){_0x8faf58[_0x72a1('0x2b')]=_['keys'](db[_0x72a1('0x3b')][_0x72a1('0x22')]);_0x8faf58['query']=_[_0x72a1('0x2c')](_0x5bdf9e[_0x72a1('0x27')]);_0x8faf58['filters']=_[_0x72a1('0x2f')](_0x8faf58[_0x72a1('0x2b')],_0x8faf58[_0x72a1('0x27')]);_0x3af8aa[_0x72a1('0x2e')]=_[_0x72a1('0x2f')](_0x8faf58['model'],qs[_0x72a1('0x30')](_0x5bdf9e[_0x72a1('0x27')][_0x72a1('0x30')]));_0x3af8aa[_0x72a1('0x2e')]=_0x3af8aa[_0x72a1('0x2e')][_0x72a1('0x31')]?_0x3af8aa[_0x72a1('0x2e')]:_0x8faf58[_0x72a1('0x2b')];if(!_0x5bdf9e['query']['hasOwnProperty'](_0x72a1('0x40'))){_0x3af8aa[_0x72a1('0x15')]=qs[_0x72a1('0x15')](_0x5bdf9e[_0x72a1('0x27')][_0x72a1('0x15')]);_0x3af8aa['offset']=qs['offset'](_0x5bdf9e[_0x72a1('0x27')][_0x72a1('0x17')]);}_0x3af8aa[_0x72a1('0x41')]=qs[_0x72a1('0x42')](_0x5bdf9e[_0x72a1('0x27')][_0x72a1('0x42')]);_0x3af8aa[_0x72a1('0x43')]=qs[_0x72a1('0x2d')](_['pick'](_0x5bdf9e['query'],_0x8faf58[_0x72a1('0x2d')]));_0x3af8aa[_0x72a1('0x43')][_0x72a1('0x44')]=_0x2a8de8['id'];if(_0x5bdf9e['query'][_0x72a1('0x45')]){_0x3af8aa[_0x72a1('0x43')]=_['merge'](_0x3af8aa[_0x72a1('0x43')],{'$or':_['map'](_0x3af8aa[_0x72a1('0x2e')],function(_0x4cb9d8){var _0x18c10a={};_0x18c10a[_0x4cb9d8]={'$like':'%'+_0x5bdf9e[_0x72a1('0x27')][_0x72a1('0x45')]+'%'};return _0x18c10a;})});}if(_0x5bdf9e[_0x72a1('0x27')][_0x72a1('0x46')]){var _0x376d00=_0x5bdf9e[_0x72a1('0x27')][_0x72a1('0x46')]['split'](',');var _0x4a5465={};_0x4a5465[_0x376d00[0x0]]={'$gte':moment(_0x376d00[0x1])[_0x72a1('0x47')](_0x72a1('0x48'))};_0x3af8aa[_0x72a1('0x43')]=_[_0x72a1('0x34')](_0x3af8aa[_0x72a1('0x43')],_0x4a5465);}_0x3af8aa=_[_0x72a1('0x34')]({},_0x3af8aa,_0x5bdf9e[_0x72a1('0x35')]);return db[_0x72a1('0x3b')][_0x72a1('0x16')]({'where':_0x3af8aa[_0x72a1('0x43')]})[_0x72a1('0x19')](function(_0x336e97){_0x54c9c2['count']=_0x336e97;if(_0x5bdf9e['query'][_0x72a1('0x32')]){_0x3af8aa[_0x72a1('0x33')]=[{'all':!![]}];}return db[_0x72a1('0x3b')]['findAll'](_0x3af8aa);})[_0x72a1('0x19')](function(_0x2643d5){_0x54c9c2['rows']=_0x2643d5;return _0x54c9c2;});}})[_0x72a1('0x19')](respondWithFilteredResult(_0xe9c4f1,_0x3af8aa))['catch'](handleError(_0xe9c4f1,null));};exports[_0x72a1('0x49')]=function(_0x189ed1,_0x420b8e){return db[_0x72a1('0x21')][_0x72a1('0x36')]({'where':{'id':_0x189ed1[_0x72a1('0x2a')]['id']}})[_0x72a1('0x19')](handleEntityNotFound(_0x420b8e,null))['then'](function(_0x3aeaff){if(_0x3aeaff){return _0x3aeaff[_0x72a1('0x4a')](_0x189ed1['body'][_0x72a1('0x3c')],_[_0x72a1('0x3d')](_0x189ed1[_0x72a1('0x38')],[_0x72a1('0x3c'),'id'])||{})[_0x72a1('0x4b')](function(){return db['Tag'][_0x72a1('0x25')]({'attributes':['id',_0x72a1('0x1d'),_0x72a1('0x4c')],'where':{'id':_0x189ed1[_0x72a1('0x38')]['ids']}});})[_0x72a1('0x19')](function(_0x58e447){socket[_0x72a1('0x4d')](_0x72a1('0x4e'),{'id':Number(_0x189ed1[_0x72a1('0x2a')]['id']),'tags':_0x58e447||[]});return{'id':Number(_0x189ed1[_0x72a1('0x2a')]['id']),'tags':_0x58e447||[]};});}})['then'](respondWithResult(_0x420b8e,null))['catch'](handleError(_0x420b8e,null));};exports[_0x72a1('0x4f')]=function(_0x588593,_0x2efc43){return db['SmsInteraction'][_0x72a1('0x36')]({'where':{'id':_0x588593[_0x72a1('0x2a')]['id']}})[_0x72a1('0x19')](handleEntityNotFound(_0x2efc43,null))[_0x72a1('0x19')](function(_0x3b66d1){if(_0x3b66d1){return _0x3b66d1[_0x72a1('0x4f')](_0x588593[_0x72a1('0x27')][_0x72a1('0x3c')]);}})[_0x72a1('0x19')](respondWithStatusCode(_0x2efc43,null))[_0x72a1('0x28')](handleError(_0x2efc43,null));};exports['download']=function(_0x5cdfe7,_0x45c5dc){var _0x3eb4b2=moment()[_0x72a1('0x50')]()[_0x72a1('0x51')]();var _0x57e61b=path['join'](config[_0x72a1('0x52')],_0x72a1('0x53'),_0x72a1('0x54'),_0x72a1('0x55'));var _0x55c5d7=path[_0x72a1('0x56')](_0x57e61b,_0x3eb4b2);var _0x1123eb=util[_0x72a1('0x47')](_0x72a1('0x57'),_0x5cdfe7['params']['id'],_0x3eb4b2);var _0x5610f8=path[_0x72a1('0x56')](_0x57e61b,_0x1123eb);var _0x1fd467=[];_0x1fd467[_0x72a1('0x58')]({'model':db[_0x72a1('0x59')],'as':_0x72a1('0x59'),'attributes':['id',_0x72a1('0x5a')],'raw':!![]});_0x1fd467[_0x72a1('0x58')]({'model':db[_0x72a1('0x5b')],'as':_0x72a1('0x5c'),'attributes':['id',_0x72a1('0x5d'),'lastName'],'raw':!![]});var _0x3f6db0=[{'model':db[_0x72a1('0x3b')],'as':'Messages','attributes':['id',_0x72a1('0x38'),'createdAt',_0x72a1('0x5e'),_0x72a1('0x5f'),_0x72a1('0x60')],'include':_0x1fd467}];_0x3f6db0['push']({'model':db[_0x72a1('0x61')],'as':_0x72a1('0x62'),'attributes':['id',_0x72a1('0x1d')]});_0x3f6db0[_0x72a1('0x58')]({'model':db['User'],'as':'Owner','attributes':['id',_0x72a1('0x5a')]});return db[_0x72a1('0x21')][_0x72a1('0x36')]({'where':{'id':_0x5cdfe7[_0x72a1('0x2a')]['id']},'include':_0x3f6db0})['then'](handleEntityNotFound(_0x45c5dc,null))[_0x72a1('0x19')](function(_0x3226b1){if(_0x3226b1){var _0x14caad=_0x3226b1[_0x72a1('0x63')]({'plain':!![]});fs[_0x72a1('0x64')](_0x55c5d7);var _0x982c64={'channel':_0x72a1('0x65'),'account':_0x14caad[_0x72a1('0x62')][_0x72a1('0x1d')],'agent':_0x14caad[_0x72a1('0x66')]?_0x14caad[_0x72a1('0x66')][_0x72a1('0x5a')]:_0x72a1('0x67'),'createdAt':moment(_0x14caad[_0x72a1('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x72a1('0x51')](),'closedAt':_0x14caad[_0x72a1('0x69')]?moment(_0x14caad[_0x72a1('0x6a')])[_0x72a1('0x47')](_0x72a1('0x48'))[_0x72a1('0x51')]():'','disposition':_0x14caad['disposition'],'messages':_(_0x14caad[_0x72a1('0x6b')])[_0x72a1('0x45')]({'secret':![]})[_0x72a1('0x20')](function(_0x338a0c){return{'date':moment(_0x338a0c[_0x72a1('0x68')])[_0x72a1('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x72a1('0x51')](),'sender':_0x338a0c[_0x72a1('0x5e')]===_0x72a1('0x6c')?_0x338a0c[_0x72a1('0x59')]?_0x338a0c['User'][_0x72a1('0x5a')]:_0x72a1('0x6d'):_0x338a0c[_0x72a1('0x5c')][_0x72a1('0x5d')]+(_0x338a0c[_0x72a1('0x5c')][_0x72a1('0x6e')]?'\x20'+_0x338a0c[_0x72a1('0x5c')][_0x72a1('0x6e')]:''),'body':_0x338a0c[_0x72a1('0x38')],'direction':_0x338a0c[_0x72a1('0x5e')]===_0x72a1('0x6c')?'A':'C','secret':_0x338a0c[_0x72a1('0x5f')],'read':_0x338a0c[_0x72a1('0x60')]};})['value']()};return ejs[_0x72a1('0x6f')](path[_0x72a1('0x56')](config['root'],'server','views',_0x72a1('0x70')),{'interaction':_0x982c64})['then'](function(_0x448ece){var _0x247562=path[_0x72a1('0x56')](_0x55c5d7,'transcript-'+_0x14caad['id']+'-'+_0x3eb4b2+_0x72a1('0x71'));var _0x30b36d={'path':_0x247562,'channel':_0x72a1('0x65'),'interactionId':_0x14caad['id']};return pdf[_0x72a1('0x72')](_0x448ece,_0x30b36d);})['then'](function(){return new BPromise(function(_0x59f7d3,_0x4f2cf4){zipdir(_0x55c5d7,{'saveTo':_0x5610f8},function(_0x2a6eac,_0x2c54b1){if(_0x2a6eac)return _0x4f2cf4(_0x2a6eac);return _0x59f7d3(_0x2c54b1);});})[_0x72a1('0x19')](function(){return new BPromise(function(_0x524199,_0x41caf0){rimraf(_0x55c5d7,function(_0x1fc84d){if(_0x1fc84d)_0x41caf0(_0x1fc84d);return _0x524199();});});})[_0x72a1('0x19')](function(){return _0x45c5dc[_0x72a1('0x73')](_0x5610f8,_0x1123eb,function(_0x2ebc87){if(_0x2ebc87){console['log'](_0x72a1('0x74'),_0x2ebc87);}else{fs[_0x72a1('0x75')](_0x5610f8);}});});});}else{return _0x45c5dc[_0x72a1('0x10')](0xc8);}})['catch'](handleError(_0x45c5dc,null));}; \ No newline at end of file +var _0x02bc=['send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','show','keys','filters','model','attributes','intersection','fields','length','includeAll','include','options','find','catch','create','body','params','describe','SmsMessage','addMessage','ids','getMessages','hasOwnProperty','limit','order','sort','where','pick','SmsInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','omit','spread','color','emit','smsInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','push','User','CmContact','Contact','firstName','lastName','createdAt','direction','SmsAccount','Account','get','mkdirSync','Sms','Owner','fullname','closed','disposition','Messages','filter','out','secret','read','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./smsInteraction.socket','register','sendStatus','status','offset','undefined','count','set','Content-Range','json','update','then','destroy','end','error','stack','name'];(function(_0x13321a,_0x273c96){var _0x452c07=function(_0x3c653c){while(--_0x3c653c){_0x13321a['push'](_0x13321a['shift']());}};_0x452c07(++_0x273c96);}(_0x02bc,0x1c9));var _0xc02b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x02bc[_0x3947c9];return _0x2e7871;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc02b('0x0'));var moment=require(_0xc02b('0x1'));var BPromise=require('bluebird');var util=require(_0xc02b('0x2'));var path=require('path');var ejs=require(_0xc02b('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc02b('0x4'));var interaction=require(_0xc02b('0x5'));var qs=require(_0xc02b('0x6'));var pdf=require(_0xc02b('0x7'));var logger=require(_0xc02b('0x8'))(_0xc02b('0x9'));var config=require(_0xc02b('0xa'));var db=require(_0xc02b('0xb'))['db'];config[_0xc02b('0xc')]=_[_0xc02b('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc02b('0xe'))[_0xc02b('0xf')](socket);function respondWithStatusCode(_0x48ae4d,_0x127147){_0x127147=_0x127147||0xcc;return function(_0x244e13){if(_0x244e13){return _0x48ae4d[_0xc02b('0x10')](_0x127147);}return _0x48ae4d[_0xc02b('0x11')](_0x127147)['end']();};}function respondWithResult(_0x48a30c,_0x27624a){_0x27624a=_0x27624a||0xc8;return function(_0x40d9bf){if(_0x40d9bf){return _0x48a30c['status'](_0x27624a)['json'](_0x40d9bf);}};}function respondWithFilteredResult(_0x8a262c,_0x30576b){return function(_0x39f4df){if(_0x39f4df){var _0x4f296d=typeof _0x30576b[_0xc02b('0x12')]===_0xc02b('0x13')&&typeof _0x30576b['limit']===_0xc02b('0x13');var _0x1f0de9=_0x39f4df[_0xc02b('0x14')];var _0x378381=_0x4f296d?0x0:_0x30576b[_0xc02b('0x12')];var _0x21dad6=_0x4f296d?_0x39f4df['count']:_0x30576b[_0xc02b('0x12')]+_0x30576b['limit'];var _0x486ff3;if(_0x21dad6>=_0x1f0de9){_0x21dad6=_0x1f0de9;_0x486ff3=0xc8;}else{_0x486ff3=0xce;}_0x8a262c[_0xc02b('0x11')](_0x486ff3);return _0x8a262c[_0xc02b('0x15')](_0xc02b('0x16'),_0x378381+'-'+_0x21dad6+'/'+_0x1f0de9)[_0xc02b('0x17')](_0x39f4df);}return null;};}function saveUpdates(_0x501ef6){return function(_0x44ccfe){if(_0x44ccfe){return _0x44ccfe[_0xc02b('0x18')](_0x501ef6)[_0xc02b('0x19')](function(_0x45925d){return _0x45925d;});}return null;};}function removeEntity(_0x4bdd08){return function(_0x200185){if(_0x200185){return _0x200185[_0xc02b('0x1a')]()['then'](function(){_0x4bdd08[_0xc02b('0x11')](0xcc)[_0xc02b('0x1b')]();});}};}function handleEntityNotFound(_0x3ea3ce){return function(_0x50d1c6){if(!_0x50d1c6){_0x3ea3ce['sendStatus'](0x194);}return _0x50d1c6;};}function handleError(_0x3137c5,_0x5ec109){_0x5ec109=_0x5ec109||0x1f4;return function(_0x175f89){logger[_0xc02b('0x1c')](_0x175f89[_0xc02b('0x1d')]);if(_0x175f89[_0xc02b('0x1e')]){delete _0x175f89['name'];}_0x3137c5[_0xc02b('0x11')](_0x5ec109)[_0xc02b('0x1f')](_0x175f89);};}exports[_0xc02b('0x20')]=function(_0xd44cd1,_0x21ad1e){var _0x2d962d={};var _0x41fae2=_[_0xc02b('0x21')](db[_0xc02b('0x22')][_0xc02b('0x23')],function(_0x27e2e5){return{'name':_0x27e2e5[_0xc02b('0x24')],'type':_0x27e2e5[_0xc02b('0x25')][_0xc02b('0x26')]};});_0x2d962d=qs[_0xc02b('0x27')](_0x41fae2,_0xd44cd1);return interaction[_0xc02b('0x28')](_0xc02b('0x29'),_0xd44cd1[_0xc02b('0x2a')],_0xd44cd1[_0xc02b('0x2b')],_0x2d962d,_0x41fae2)[_0xc02b('0x19')](respondWithFilteredResult(_0x21ad1e,_0x2d962d))['catch'](handleError(_0x21ad1e,null));};exports[_0xc02b('0x2c')]=function(_0x28c577,_0x543321){var _0x2fe16d={'raw':![],'where':{'id':_0x28c577['params']['id']}},_0x28dda4={};_0x28dda4['model']=_[_0xc02b('0x2d')](db[_0xc02b('0x22')][_0xc02b('0x23')]);_0x28dda4['query']=_[_0xc02b('0x2d')](_0x28c577[_0xc02b('0x2a')]);_0x28dda4[_0xc02b('0x2e')]=_['intersection'](_0x28dda4[_0xc02b('0x2f')],_0x28dda4[_0xc02b('0x2a')]);_0x2fe16d[_0xc02b('0x30')]=_[_0xc02b('0x31')](_0x28dda4[_0xc02b('0x2f')],qs[_0xc02b('0x32')](_0x28c577[_0xc02b('0x2a')]['fields']));_0x2fe16d[_0xc02b('0x30')]=_0x2fe16d[_0xc02b('0x30')][_0xc02b('0x33')]?_0x2fe16d[_0xc02b('0x30')]:_0x28dda4[_0xc02b('0x2f')];if(_0x28c577[_0xc02b('0x2a')][_0xc02b('0x34')]){_0x2fe16d[_0xc02b('0x35')]=[{'all':!![]}];}_0x2fe16d=_['merge']({},_0x2fe16d,_0x28c577[_0xc02b('0x36')]);return db[_0xc02b('0x22')][_0xc02b('0x37')](_0x2fe16d)['then'](handleEntityNotFound(_0x543321,null))['then'](respondWithResult(_0x543321,null))[_0xc02b('0x38')](handleError(_0x543321,null));};exports[_0xc02b('0x39')]=function(_0x27bf19,_0x277c49){return db['SmsInteraction'][_0xc02b('0x39')](_0x27bf19['body'],{})[_0xc02b('0x19')](respondWithResult(_0x277c49,0xc9))[_0xc02b('0x38')](handleError(_0x277c49,null));};exports[_0xc02b('0x18')]=function(_0x18e801,_0x52b73b){if(_0x18e801[_0xc02b('0x3a')]['id']){delete _0x18e801[_0xc02b('0x3a')]['id'];}return db[_0xc02b('0x22')][_0xc02b('0x37')]({'where':{'id':_0x18e801[_0xc02b('0x3b')]['id']}})['then'](handleEntityNotFound(_0x52b73b,null))[_0xc02b('0x19')](saveUpdates(_0x18e801['body'],null))[_0xc02b('0x19')](respondWithResult(_0x52b73b,null))['catch'](handleError(_0x52b73b,null));};exports[_0xc02b('0x1a')]=function(_0x45d79f,_0x3a01ba){return db[_0xc02b('0x22')][_0xc02b('0x37')]({'where':{'id':_0x45d79f[_0xc02b('0x3b')]['id']}})[_0xc02b('0x19')](handleEntityNotFound(_0x3a01ba,null))['then'](removeEntity(_0x3a01ba,null))[_0xc02b('0x38')](handleError(_0x3a01ba,null));};exports[_0xc02b('0x3c')]=function(_0x12c8f0,_0x11e92f){return db[_0xc02b('0x22')][_0xc02b('0x3c')]()[_0xc02b('0x19')](respondWithResult(_0x11e92f,null))[_0xc02b('0x38')](handleError(_0x11e92f,null));};exports['addMessage']=function(_0x7c8463,_0x5f3ee9){return db[_0xc02b('0x3d')][_0xc02b('0x37')]({'where':{'id':_0x7c8463[_0xc02b('0x3b')]['id']}})[_0xc02b('0x19')](handleEntityNotFound(_0x5f3ee9,null))[_0xc02b('0x19')](function(_0x4d0cf5){if(_0x4d0cf5){return _0x4d0cf5[_0xc02b('0x3e')](_0x7c8463[_0xc02b('0x3a')][_0xc02b('0x3f')],_['omit'](_0x7c8463[_0xc02b('0x3a')],[_0xc02b('0x3f'),'id'])||{});}})[_0xc02b('0x19')](respondWithResult(_0x5f3ee9,null))['catch'](handleError(_0x5f3ee9,null));};exports[_0xc02b('0x40')]=function(_0x2bc5b1,_0x50e305){var _0xc52cbe={'raw':![],'where':{}};var _0x3a9cbe={};var _0x5187a4={'count':0x0,'rows':[]};return db[_0xc02b('0x22')]['findOne']({'where':{'id':_0x2bc5b1[_0xc02b('0x3b')]['id']}})[_0xc02b('0x19')](handleEntityNotFound(_0x50e305,null))['then'](function(_0x42814a){if(_0x42814a){_0x3a9cbe['model']=_[_0xc02b('0x2d')](db[_0xc02b('0x3d')][_0xc02b('0x23')]);_0x3a9cbe['query']=_[_0xc02b('0x2d')](_0x2bc5b1[_0xc02b('0x2a')]);_0x3a9cbe['filters']=_[_0xc02b('0x31')](_0x3a9cbe[_0xc02b('0x2f')],_0x3a9cbe[_0xc02b('0x2a')]);_0xc52cbe['attributes']=_['intersection'](_0x3a9cbe[_0xc02b('0x2f')],qs[_0xc02b('0x32')](_0x2bc5b1[_0xc02b('0x2a')]['fields']));_0xc52cbe[_0xc02b('0x30')]=_0xc52cbe[_0xc02b('0x30')]['length']?_0xc52cbe[_0xc02b('0x30')]:_0x3a9cbe[_0xc02b('0x2f')];if(!_0x2bc5b1['query'][_0xc02b('0x41')]('nolimit')){_0xc52cbe[_0xc02b('0x42')]=qs[_0xc02b('0x42')](_0x2bc5b1[_0xc02b('0x2a')][_0xc02b('0x42')]);_0xc52cbe[_0xc02b('0x12')]=qs[_0xc02b('0x12')](_0x2bc5b1[_0xc02b('0x2a')][_0xc02b('0x12')]);}_0xc52cbe[_0xc02b('0x43')]=qs[_0xc02b('0x44')](_0x2bc5b1[_0xc02b('0x2a')][_0xc02b('0x44')]);_0xc52cbe[_0xc02b('0x45')]=qs[_0xc02b('0x2e')](_[_0xc02b('0x46')](_0x2bc5b1['query'],_0x3a9cbe['filters']));_0xc52cbe['where'][_0xc02b('0x47')]=_0x42814a['id'];if(_0x2bc5b1[_0xc02b('0x2a')]['filter']){_0xc52cbe[_0xc02b('0x45')]=_['merge'](_0xc52cbe['where'],{'$or':_[_0xc02b('0x21')](_0xc52cbe[_0xc02b('0x30')],function(_0xe3abef){var _0x45431f={};_0x45431f[_0xe3abef]={'$like':'%'+_0x2bc5b1[_0xc02b('0x2a')]['filter']+'%'};return _0x45431f;})});}if(_0x2bc5b1[_0xc02b('0x2a')]['$gte']){var _0x126dfc=_0x2bc5b1[_0xc02b('0x2a')][_0xc02b('0x48')][_0xc02b('0x49')](',');var _0x275ea3={};_0x275ea3[_0x126dfc[0x0]]={'$gte':moment(_0x126dfc[0x1])[_0xc02b('0x4a')](_0xc02b('0x4b'))};_0xc52cbe[_0xc02b('0x45')]=_[_0xc02b('0x4c')](_0xc52cbe[_0xc02b('0x45')],_0x275ea3);}_0xc52cbe=_['merge']({},_0xc52cbe,_0x2bc5b1[_0xc02b('0x36')]);return db['SmsMessage'][_0xc02b('0x14')]({'where':_0xc52cbe[_0xc02b('0x45')]})[_0xc02b('0x19')](function(_0x5220e8){_0x5187a4[_0xc02b('0x14')]=_0x5220e8;if(_0x2bc5b1[_0xc02b('0x2a')][_0xc02b('0x34')]){_0xc52cbe[_0xc02b('0x35')]=[{'all':!![]}];}return db['SmsMessage'][_0xc02b('0x28')](_0xc52cbe);})[_0xc02b('0x19')](function(_0x1d7a39){_0x5187a4[_0xc02b('0x4d')]=_0x1d7a39;return _0x5187a4;});}})['then'](respondWithFilteredResult(_0x50e305,_0xc52cbe))[_0xc02b('0x38')](handleError(_0x50e305,null));};exports[_0xc02b('0x4e')]=function(_0x38c8c0,_0x10ead5){return db[_0xc02b('0x22')][_0xc02b('0x37')]({'where':{'id':_0x38c8c0[_0xc02b('0x3b')]['id']}})[_0xc02b('0x19')](handleEntityNotFound(_0x10ead5,null))[_0xc02b('0x19')](function(_0x446506){if(_0x446506){return _0x446506['setTags'](_0x38c8c0['body']['ids'],_[_0xc02b('0x4f')](_0x38c8c0[_0xc02b('0x3a')],['ids','id'])||{})[_0xc02b('0x50')](function(){return db['Tag'][_0xc02b('0x28')]({'attributes':['id',_0xc02b('0x1e'),_0xc02b('0x51')],'where':{'id':_0x38c8c0[_0xc02b('0x3a')][_0xc02b('0x3f')]}});})[_0xc02b('0x19')](function(_0x126bfb){socket[_0xc02b('0x52')](_0xc02b('0x53'),{'id':Number(_0x38c8c0['params']['id']),'tags':_0x126bfb||[]});return{'id':Number(_0x38c8c0[_0xc02b('0x3b')]['id']),'tags':_0x126bfb||[]};});}})['then'](respondWithResult(_0x10ead5,null))['catch'](handleError(_0x10ead5,null));};exports[_0xc02b('0x54')]=function(_0x2e072f,_0x25626a){return db[_0xc02b('0x22')][_0xc02b('0x37')]({'where':{'id':_0x2e072f[_0xc02b('0x3b')]['id']}})[_0xc02b('0x19')](handleEntityNotFound(_0x25626a,null))['then'](function(_0x450881){if(_0x450881){return _0x450881[_0xc02b('0x54')](_0x2e072f[_0xc02b('0x2a')][_0xc02b('0x3f')]);}})[_0xc02b('0x19')](respondWithStatusCode(_0x25626a,null))[_0xc02b('0x38')](handleError(_0x25626a,null));};exports[_0xc02b('0x55')]=function(_0x15d43b,_0x26da19){var _0xc2aca=moment()['unix']()[_0xc02b('0x56')]();var _0x1158f9=path[_0xc02b('0x57')](config[_0xc02b('0x58')],_0xc02b('0x59'),_0xc02b('0x5a'),_0xc02b('0x5b'));var _0x539bbe=path[_0xc02b('0x57')](_0x1158f9,_0xc2aca);var _0x1abe12=util['format']('transcript-%d-%s.zip',_0x15d43b['params']['id'],_0xc2aca);var _0x2dc623=path[_0xc02b('0x57')](_0x1158f9,_0x1abe12);var _0x47384b=[];_0x47384b[_0xc02b('0x5c')]({'model':db[_0xc02b('0x5d')],'as':_0xc02b('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x47384b[_0xc02b('0x5c')]({'model':db[_0xc02b('0x5e')],'as':_0xc02b('0x5f'),'attributes':['id',_0xc02b('0x60'),_0xc02b('0x61')],'raw':!![]});var _0x567711=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xc02b('0x3a'),_0xc02b('0x62'),_0xc02b('0x63'),'secret','read'],'include':_0x47384b}];_0x567711['push']({'model':db[_0xc02b('0x64')],'as':_0xc02b('0x65'),'attributes':['id',_0xc02b('0x1e')]});_0x567711[_0xc02b('0x5c')]({'model':db[_0xc02b('0x5d')],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0xc02b('0x37')]({'where':{'id':_0x15d43b[_0xc02b('0x3b')]['id']},'include':_0x567711})['then'](handleEntityNotFound(_0x26da19,null))[_0xc02b('0x19')](function(_0x337e40){if(_0x337e40){var _0x2cebab=_0x337e40[_0xc02b('0x66')]({'plain':!![]});fs[_0xc02b('0x67')](_0x539bbe);var _0x69fc4a={'channel':_0xc02b('0x68'),'account':_0x2cebab[_0xc02b('0x65')][_0xc02b('0x1e')],'agent':_0x2cebab[_0xc02b('0x69')]?_0x2cebab[_0xc02b('0x69')][_0xc02b('0x6a')]:'N.A.','createdAt':moment(_0x2cebab[_0xc02b('0x62')])[_0xc02b('0x4a')](_0xc02b('0x4b'))[_0xc02b('0x56')](),'closedAt':_0x2cebab[_0xc02b('0x6b')]?moment(_0x2cebab['closedAt'])[_0xc02b('0x4a')](_0xc02b('0x4b'))['toString']():'','disposition':_0x2cebab[_0xc02b('0x6c')],'messages':_(_0x2cebab[_0xc02b('0x6d')])[_0xc02b('0x6e')]({'secret':![]})[_0xc02b('0x21')](function(_0x22bd60){return{'date':moment(_0x22bd60[_0xc02b('0x62')])[_0xc02b('0x4a')](_0xc02b('0x4b'))[_0xc02b('0x56')](),'sender':_0x22bd60['direction']===_0xc02b('0x6f')?_0x22bd60[_0xc02b('0x5d')]?_0x22bd60[_0xc02b('0x5d')][_0xc02b('0x6a')]:'System':_0x22bd60[_0xc02b('0x5f')][_0xc02b('0x60')]+(_0x22bd60[_0xc02b('0x5f')][_0xc02b('0x61')]?'\x20'+_0x22bd60['Contact'][_0xc02b('0x61')]:''),'body':_0x22bd60[_0xc02b('0x3a')],'direction':_0x22bd60['direction']===_0xc02b('0x6f')?'A':'C','secret':_0x22bd60[_0xc02b('0x70')],'read':_0x22bd60[_0xc02b('0x71')]};})['value']()};return ejs[_0xc02b('0x72')](path['join'](config[_0xc02b('0x58')],_0xc02b('0x59'),_0xc02b('0x73'),'downloadInteraction.ejs'),{'interaction':_0x69fc4a})[_0xc02b('0x19')](function(_0x842500){var _0x54673d=path[_0xc02b('0x57')](_0x539bbe,_0xc02b('0x74')+_0x2cebab['id']+'-'+_0xc2aca+_0xc02b('0x75'));var _0x19851f={'path':_0x54673d,'channel':_0xc02b('0x68'),'interactionId':_0x2cebab['id']};return pdf[_0xc02b('0x76')](_0x842500,_0x19851f);})[_0xc02b('0x19')](function(){return new BPromise(function(_0x2a0c89,_0x24c913){zipdir(_0x539bbe,{'saveTo':_0x2dc623},function(_0x3ae9bf,_0x114893){if(_0x3ae9bf)return _0x24c913(_0x3ae9bf);return _0x2a0c89(_0x114893);});})[_0xc02b('0x19')](function(){return new BPromise(function(_0x566918,_0x3fe628){rimraf(_0x539bbe,function(_0x59def4){if(_0x59def4)_0x3fe628(_0x59def4);return _0x566918();});});})['then'](function(){return _0x26da19[_0xc02b('0x55')](_0x2dc623,_0x1abe12,function(_0xaa2033){if(_0xaa2033){console[_0xc02b('0x77')](_0xc02b('0x78'),_0xaa2033);}else{fs[_0xc02b('0x79')](_0x2dc623);}});});});}else{return _0x26da19[_0xc02b('0x10')](0xc8);}})['catch'](handleError(_0x26da19,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 94178cf..266bbb4 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 _0x0972=['save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x47fd5e,_0x206e7b){var _0x1ef01e=function(_0x27aa7d){while(--_0x27aa7d){_0x47fd5e['push'](_0x47fd5e['shift']());}};_0x1ef01e(++_0x206e7b);}(_0x0972,0x64));var _0x2097=function(_0x2c1a57,_0x452283){_0x2c1a57=_0x2c1a57-0x0;var _0x15cf0e=_0x0972[_0x2c1a57];return _0x15cf0e;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x2097('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x2097('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2097('0x1')](0x0);var events={'afterCreate':_0x2097('0x2'),'afterUpdate':'update','afterDestroy':_0x2097('0x3')};function emitEvent(_0x431d1c){return function(_0xe6fbae,_0x1a7d26,_0x2f84d8){_0xe6fbae[_0x2097('0x4')]({'attributes':['id'],'raw':!![]})[_0x2097('0x5')](function(_0x59739f){_0xe6fbae[_0x2097('0x6')](_0x2097('0x7'),_0x59739f[_0x2097('0x8')](function(_0x1d94e2){return{'id':_0x1d94e2['id']};}));return SmsMessage[_0x2097('0x9')]({'where':{'SmsInteractionId':_0xe6fbae['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2e0024){_0xe6fbae[_0x2097('0x6')](_0x2097('0xa'),_0x2e0024[_0x2097('0xb')]);SmsInteractionEvents[_0x2097('0xc')](_0x431d1c+':'+_0xe6fbae['id'],_0xe6fbae);SmsInteractionEvents[_0x2097('0xc')](_0x431d1c,_0xe6fbae);_0x2f84d8(null);})[_0x2097('0xd')](_0x2f84d8(null));};}for(var e in events){if(events[_0x2097('0xe')](e)){var event=events[e];SmsInteraction[_0x2097('0xf')](e,emitEvent(event));}}module[_0x2097('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x236c=['length','emit','catch','hasOwnProperty','exports','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','getUsers','setDataValue','findAll','unreadMessages'];(function(_0x1d9108,_0x1a2587){var _0xf25e9=function(_0x47da64){while(--_0x47da64){_0x1d9108['push'](_0x1d9108['shift']());}};_0xf25e9(++_0x1a2587);}(_0x236c,0x155));var _0xc236=function(_0x5db15a,_0xa57543){_0x5db15a=_0x5db15a-0x0;var _0x233c2d=_0x236c[_0x5db15a];return _0x233c2d;};'use strict';var EventEmitter=require(_0xc236('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xc236('0x1')];var SmsMessage=require(_0xc236('0x2'))['db'][_0xc236('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc236('0x4')](0x0);var events={'afterCreate':_0xc236('0x5'),'afterUpdate':'update','afterDestroy':_0xc236('0x6')};function emitEvent(_0x36e87d){return function(_0x33bc57,_0xd582f6,_0x23d3cc){_0x33bc57[_0xc236('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd612c6){_0x33bc57[_0xc236('0x8')]('Users',_0xd612c6['map'](function(_0x5cdee5){return{'id':_0x5cdee5['id']};}));return SmsMessage[_0xc236('0x9')]({'where':{'SmsInteractionId':_0x33bc57['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30a28d){_0x33bc57[_0xc236('0x8')](_0xc236('0xa'),_0x30a28d[_0xc236('0xb')]);SmsInteractionEvents[_0xc236('0xc')](_0x36e87d+':'+_0x33bc57['id'],_0x33bc57);SmsInteractionEvents['emit'](_0x36e87d,_0x33bc57);_0x23d3cc(null);})[_0xc236('0xd')](_0x23d3cc(null));};}for(var e in events){if(events[_0xc236('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xc236('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 5bf750a..29b4874 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 _0xc8b0=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','sms_interactions'];(function(_0x2e63e8,_0xed68f5){var _0x3fe904=function(_0x10e876){while(--_0x10e876){_0x2e63e8['push'](_0x2e63e8['shift']());}};_0x3fe904(++_0xed68f5);}(_0xc8b0,0x9e));var _0x0c8b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc8b0[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0c8b('0x0'));var util=require(_0x0c8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0c8b('0x2'));var rp=require(_0x0c8b('0x3'));var fs=require('fs');var path=require(_0x0c8b('0x4'));var rimraf=require(_0x0c8b('0x5'));var config=require(_0x0c8b('0x6'));var attributes=require('./smsInteraction.attributes');module[_0x0c8b('0x7')]=function(_0x414839,_0x6f012a){return _0x414839[_0x0c8b('0x8')]('SmsInteraction',attributes,{'tableName':_0x0c8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x538901,_0x1a4963,_0x12fb6e){if(_0x538901[_0x0c8b('0xa')](_0x0c8b('0xb'))){_0x538901[_0x0c8b('0xc')]=moment()['format'](_0x0c8b('0xd'));}_0x12fb6e(null,_0x538901);}}});}; \ No newline at end of file +var _0xc37d=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','sms_interactions','changed','closed'];(function(_0x3647a4,_0x532856){var _0x46dcee=function(_0x13d7e0){while(--_0x13d7e0){_0x3647a4['push'](_0x3647a4['shift']());}};_0x46dcee(++_0x532856);}(_0xc37d,0xb7));var _0xdc37=function(_0x501459,_0x163468){_0x501459=_0x501459-0x0;var _0x4b4874=_0xc37d[_0x501459];return _0x4b4874;};'use strict';var _=require('lodash');var util=require(_0xdc37('0x0'));var logger=require(_0xdc37('0x1'))(_0xdc37('0x2'));var moment=require('moment');var BPromise=require(_0xdc37('0x3'));var rp=require(_0xdc37('0x4'));var fs=require('fs');var path=require(_0xdc37('0x5'));var rimraf=require(_0xdc37('0x6'));var config=require(_0xdc37('0x7'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x495899,_0x322f7d){return _0x495899[_0xdc37('0x8')]('SmsInteraction',attributes,{'tableName':_0xdc37('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23b67e,_0x5d7760,_0x224f40){if(_0x23b67e[_0xdc37('0xa')](_0xdc37('0xb'))){_0x23b67e[_0xdc37('0xc')]=moment()[_0xdc37('0xd')](_0xdc37('0xe'));}_0x224f40(null,_0x23b67e);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 01f5262..db21439 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 _0xac92=['update','body','options','attributes','limit','catch','AddTagsToSmsInteraction','where','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsInteraction.socket','register','then','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsInteraction,\x20%s,\x20%s','message','info','result','UpdateSmsInteraction','SmsInteraction'];(function(_0x23698f,_0x4aa89d){var _0x3221a8=function(_0x1abbc7){while(--_0x1abbc7){_0x23698f['push'](_0x23698f['shift']());}};_0x3221a8(++_0x4aa89d);}(_0xac92,0xb0));var _0x2ac9=function(_0x366965,_0x31a4da){_0x366965=_0x366965-0x0;var _0x18f308=_0xac92[_0x366965];return _0x18f308;};'use strict';var _=require('lodash');var util=require(_0x2ac9('0x0'));var moment=require(_0x2ac9('0x1'));var BPromise=require(_0x2ac9('0x2'));var rs=require(_0x2ac9('0x3'));var fs=require('fs');var Redis=require(_0x2ac9('0x4'));var db=require(_0x2ac9('0x5'))['db'];var utils=require(_0x2ac9('0x6'));var logger=require(_0x2ac9('0x7'))(_0x2ac9('0x8'));var config=require(_0x2ac9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2ac9('0xa')][_0x2ac9('0xb')]({'port':0x232a});config[_0x2ac9('0xc')]=_[_0x2ac9('0xd')](config[_0x2ac9('0xc')],{'host':_0x2ac9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2ac9('0xf'))[_0x2ac9('0x10')](socket);function respondWithRpcPromise(_0x2158ed,_0x170795,_0x56bef6){return new BPromise(function(_0x52a836,_0x3b14a1){return client['request'](_0x2158ed,_0x56bef6)[_0x2ac9('0x11')](function(_0x89ad8b){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x170795,'request\x20sent');logger[_0x2ac9('0x12')](_0x2ac9('0x13'),_0x170795,_0x2ac9('0x14'),JSON[_0x2ac9('0x15')](_0x89ad8b));if(_0x89ad8b['error']){if(_0x89ad8b[_0x2ac9('0x16')]['code']===0x1f4){logger[_0x2ac9('0x16')](_0x2ac9('0x17'),_0x170795,_0x89ad8b['error'][_0x2ac9('0x18')]);return _0x3b14a1(_0x89ad8b[_0x2ac9('0x16')][_0x2ac9('0x18')]);}logger['error'](_0x2ac9('0x17'),_0x170795,_0x89ad8b[_0x2ac9('0x16')][_0x2ac9('0x18')]);return _0x52a836(_0x89ad8b[_0x2ac9('0x16')][_0x2ac9('0x18')]);}else{logger[_0x2ac9('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x170795,_0x2ac9('0x14'));_0x52a836(_0x89ad8b[_0x2ac9('0x1a')][_0x2ac9('0x18')]);}})['catch'](function(_0xd660ae){logger[_0x2ac9('0x16')](_0x2ac9('0x17'),_0x170795,_0xd660ae);_0x3b14a1(_0xd660ae);});});}exports[_0x2ac9('0x1b')]=function(_0x465b1d){var _0x4cfbfa=this;return new Promise(function(_0x5e38d2,_0x5b836b){return db[_0x2ac9('0x1c')][_0x2ac9('0x1d')](_0x465b1d[_0x2ac9('0x1e')],{'raw':_0x465b1d[_0x2ac9('0x1f')]?_0x465b1d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x465b1d['options']?_0x465b1d[_0x2ac9('0x1f')]['where']||null:null,'attributes':_0x465b1d[_0x2ac9('0x1f')]?_0x465b1d['options'][_0x2ac9('0x20')]||null:null,'limit':_0x465b1d[_0x2ac9('0x1f')]?_0x465b1d[_0x2ac9('0x1f')][_0x2ac9('0x21')]||null:null})['then'](function(_0x25da79){logger[_0x2ac9('0x19')](_0x2ac9('0x1b'),_0x465b1d);logger[_0x2ac9('0x12')]('UpdateSmsInteraction',_0x465b1d,JSON[_0x2ac9('0x15')](_0x25da79));_0x5e38d2(_0x25da79);})[_0x2ac9('0x22')](function(_0x37b18b){logger['error'](_0x2ac9('0x1b'),_0x37b18b['message'],_0x465b1d);_0x5b836b(_0x4cfbfa[_0x2ac9('0x16')](0x1f4,_0x37b18b[_0x2ac9('0x18')]));});});};exports[_0x2ac9('0x23')]=function(_0x44209d){return new Promise(function(_0x10ffad,_0x5d9fbc){return db[_0x2ac9('0x1c')]['find']({'where':_0x44209d[_0x2ac9('0x1f')]?_0x44209d[_0x2ac9('0x1f')][_0x2ac9('0x24')]||null:null})[_0x2ac9('0x11')](function(_0x8123f6){if(_0x8123f6){return _0x8123f6['addTags'](_0x44209d['body'][_0x2ac9('0x25')],_[_0x2ac9('0x26')](_0x44209d[_0x2ac9('0x1e')],['ids','id'])||{});}})[_0x2ac9('0x27')](function(_0x5c01a2){logger['info']('AddTags',_0x44209d);logger[_0x2ac9('0x12')](_0x2ac9('0x28'),_0x44209d,JSON[_0x2ac9('0x15')](_0x5c01a2));_0x10ffad(_0x5c01a2);})['catch'](function(_0x3286e7){logger[_0x2ac9('0x16')](_0x2ac9('0x28'),_0x3286e7['message'],_0x44209d);_0x5d9fbc(_this['error'](0x1f4,_0x3286e7['message']));});});}; \ No newline at end of file +var _0x43d1=['redis','localhost','socket.io-emitter','./smsInteraction.socket','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateSmsInteraction','body','options','raw','limit','info','AddTagsToSmsInteraction','SmsInteraction','find','where','addTags','ids','omit','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x43d1,0x1d7));var _0x143d=function(_0x3128fd,_0x1992f1){_0x3128fd=_0x3128fd-0x0;var _0x3743dd=_0x43d1[_0x3128fd];return _0x3743dd;};'use strict';var _=require(_0x143d('0x0'));var util=require(_0x143d('0x1'));var moment=require(_0x143d('0x2'));var BPromise=require(_0x143d('0x3'));var rs=require(_0x143d('0x4'));var fs=require('fs');var Redis=require(_0x143d('0x5'));var db=require(_0x143d('0x6'))['db'];var utils=require(_0x143d('0x7'));var logger=require('../../config/logger')(_0x143d('0x8'));var config=require(_0x143d('0x9'));var jayson=require(_0x143d('0xa'));var client=jayson[_0x143d('0xb')][_0x143d('0xc')]({'port':0x232a});config[_0x143d('0xd')]=_['defaults'](config[_0x143d('0xd')],{'host':_0x143d('0xe'),'port':0x18eb});var socket=require(_0x143d('0xf'))(new Redis(config['redis']));require(_0x143d('0x10'))['register'](socket);function respondWithRpcPromise(_0x45e164,_0x42dc9e,_0x269c6d){return new BPromise(function(_0x122a23,_0x518c6e){return client[_0x143d('0x11')](_0x45e164,_0x269c6d)[_0x143d('0x12')](function(_0x5edb55){logger['info'](_0x143d('0x13'),_0x42dc9e,_0x143d('0x14'));logger[_0x143d('0x15')](_0x143d('0x16'),_0x42dc9e,_0x143d('0x14'),JSON['stringify'](_0x5edb55));if(_0x5edb55[_0x143d('0x17')]){if(_0x5edb55[_0x143d('0x17')][_0x143d('0x18')]===0x1f4){logger[_0x143d('0x17')](_0x143d('0x13'),_0x42dc9e,_0x5edb55[_0x143d('0x17')][_0x143d('0x19')]);return _0x518c6e(_0x5edb55[_0x143d('0x17')]['message']);}logger[_0x143d('0x17')](_0x143d('0x13'),_0x42dc9e,_0x5edb55[_0x143d('0x17')][_0x143d('0x19')]);return _0x122a23(_0x5edb55[_0x143d('0x17')]['message']);}else{logger['info'](_0x143d('0x13'),_0x42dc9e,_0x143d('0x14'));_0x122a23(_0x5edb55[_0x143d('0x1a')][_0x143d('0x19')]);}})[_0x143d('0x1b')](function(_0xd1feb4){logger['error'](_0x143d('0x13'),_0x42dc9e,_0xd1feb4);_0x518c6e(_0xd1feb4);});});}exports[_0x143d('0x1c')]=function(_0x143113){var _0x189acf=this;return new Promise(function(_0x407521,_0x1d2901){return db['SmsInteraction']['update'](_0x143113[_0x143d('0x1d')],{'raw':_0x143113[_0x143d('0x1e')]?_0x143113[_0x143d('0x1e')][_0x143d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x143113[_0x143d('0x1e')]?_0x143113[_0x143d('0x1e')]['where']||null:null,'attributes':_0x143113[_0x143d('0x1e')]?_0x143113[_0x143d('0x1e')]['attributes']||null:null,'limit':_0x143113[_0x143d('0x1e')]?_0x143113[_0x143d('0x1e')][_0x143d('0x20')]||null:null})[_0x143d('0x12')](function(_0x38d904){logger[_0x143d('0x21')](_0x143d('0x1c'),_0x143113);logger[_0x143d('0x15')](_0x143d('0x1c'),_0x143113,JSON['stringify'](_0x38d904));_0x407521(_0x38d904);})[_0x143d('0x1b')](function(_0x2a24e3){logger[_0x143d('0x17')](_0x143d('0x1c'),_0x2a24e3[_0x143d('0x19')],_0x143113);_0x1d2901(_0x189acf[_0x143d('0x17')](0x1f4,_0x2a24e3[_0x143d('0x19')]));});});};exports[_0x143d('0x22')]=function(_0x2efcda){return new Promise(function(_0x4a4187,_0x5c5e20){return db[_0x143d('0x23')][_0x143d('0x24')]({'where':_0x2efcda[_0x143d('0x1e')]?_0x2efcda[_0x143d('0x1e')][_0x143d('0x25')]||null:null})[_0x143d('0x12')](function(_0x392c52){if(_0x392c52){return _0x392c52[_0x143d('0x26')](_0x2efcda[_0x143d('0x1d')][_0x143d('0x27')],_[_0x143d('0x28')](_0x2efcda[_0x143d('0x1d')],[_0x143d('0x27'),'id'])||{});}})[_0x143d('0x29')](function(_0x9cbacf){logger['info'](_0x143d('0x2a'),_0x2efcda);logger[_0x143d('0x15')](_0x143d('0x2a'),_0x2efcda,JSON[_0x143d('0x2b')](_0x9cbacf));_0x4a4187(_0x9cbacf);})['catch'](function(_0x4c611b){logger[_0x143d('0x17')](_0x143d('0x2a'),_0x4c611b[_0x143d('0x19')],_0x2efcda);_0x5c5e20(_this['error'](0x1f4,_0x4c611b[_0x143d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f15bfa4..1fabaaa 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 _0x11d8=['length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x11d8,0x1bb));var _0x811d=function(_0x331173,_0x3ea6ce){_0x331173=_0x331173-0x0;var _0x28cb62=_0x11d8[_0x331173];return _0x28cb62;};'use strict';var SmsInteractionEvents=require(_0x811d('0x0'));var events=[_0x811d('0x1'),_0x811d('0x2'),_0x811d('0x3')];function createListener(_0x762f4b,_0x404719){return function(_0x3481ba){_0x404719[_0x811d('0x4')](_0x762f4b,_0x3481ba);};}function removeListener(_0x168d7b,_0x4d41f5){return function(){SmsInteractionEvents[_0x811d('0x5')](_0x168d7b,_0x4d41f5);};}exports[_0x811d('0x6')]=function(_0x4f3a0a){for(var _0x300d2f=0x0,_0x557526=events[_0x811d('0x7')];_0x300d2f<_0x557526;_0x300d2f++){var _0x13405c=events[_0x300d2f];var _0x1c30fa=createListener(_0x811d('0x8')+_0x13405c,_0x4f3a0a);SmsInteractionEvents['on'](_0x13405c,_0x1c30fa);}}; \ No newline at end of file +var _0x1edb=['remove','register','smsInteraction:','./smsInteraction.events','save'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x1edb,0x116));var _0xb1ed=function(_0x488d0b,_0x120ac9){_0x488d0b=_0x488d0b-0x0;var _0x44718c=_0x1edb[_0x488d0b];return _0x44718c;};'use strict';var SmsInteractionEvents=require(_0xb1ed('0x0'));var events=[_0xb1ed('0x1'),_0xb1ed('0x2'),'update'];function createListener(_0x26068e,_0x3b1a36){return function(_0x384e09){_0x3b1a36['emit'](_0x26068e,_0x384e09);};}function removeListener(_0x58572e,_0x227faa){return function(){SmsInteractionEvents['removeListener'](_0x58572e,_0x227faa);};}exports[_0xb1ed('0x3')]=function(_0x5196b1){for(var _0x539ce1=0x0,_0x220044=events['length'];_0x539ce1<_0x220044;_0x539ce1++){var _0x583918=events[_0x539ce1];var _0x22217e=createListener(_0xb1ed('0x4')+_0x583918,_0x5196b1);SmsInteractionEvents['on'](_0x583918,_0x22217e);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index add529f..b5867fe 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 _0xdaf9=['../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','status','put','/:id/reject','reject','destroy','multer','util','path','express'];(function(_0x364f3d,_0x32d81d){var _0x248c05=function(_0x1c63db){while(--_0x1c63db){_0x364f3d['push'](_0x364f3d['shift']());}};_0x248c05(++_0x32d81d);}(_0xdaf9,0xac));var _0x9daf=function(_0x3e79de,_0xce06da){_0x3e79de=_0x3e79de-0x0;var _0x1244c8=_0xdaf9[_0x3e79de];return _0x1244c8;};'use strict';var multer=require(_0x9daf('0x0'));var util=require(_0x9daf('0x1'));var path=require(_0x9daf('0x2'));var timeout=require('connect-timeout');var express=require(_0x9daf('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9daf('0x4'));var interaction=require(_0x9daf('0x5'));var config=require('../../config/environment');var controller=require(_0x9daf('0x6'));router[_0x9daf('0x7')]('/',auth[_0x9daf('0x8')](),controller['index']);router[_0x9daf('0x7')](_0x9daf('0x9'),auth[_0x9daf('0x8')](),controller[_0x9daf('0xa')]);router[_0x9daf('0x7')](_0x9daf('0xb'),auth['isAuthenticated'](),controller[_0x9daf('0xc')]);router[_0x9daf('0xd')]('/',auth['isAuthenticated'](),interaction[_0x9daf('0xe')](_0x9daf('0xf'),_0x9daf('0x10')),controller['create']);router[_0x9daf('0xd')]('/:id/status',controller[_0x9daf('0x11')]);router[_0x9daf('0x12')](_0x9daf('0xb'),auth[_0x9daf('0x8')](),controller['update']);router[_0x9daf('0x12')]('/:id/accept',auth[_0x9daf('0x8')](),controller['accept']);router[_0x9daf('0x12')](_0x9daf('0x13'),auth[_0x9daf('0x8')](),controller[_0x9daf('0x14')]);router['delete'](_0x9daf('0xb'),auth[_0x9daf('0x8')](),controller[_0x9daf('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa5f1=['../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','post','sms','smsmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5ecb1a,_0x28ee8b){var _0x1ffa48=function(_0x4ecfcc){while(--_0x4ecfcc){_0x5ecb1a['push'](_0x5ecb1a['shift']());}};_0x1ffa48(++_0x28ee8b);}(_0xa5f1,0xff));var _0x1a5f=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa5f1[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x1a5f('0x0'));var util=require(_0x1a5f('0x1'));var path=require(_0x1a5f('0x2'));var timeout=require(_0x1a5f('0x3'));var express=require('express');var router=express[_0x1a5f('0x4')]();var fs_extra=require(_0x1a5f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1a5f('0x6'));var config=require(_0x1a5f('0x7'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0x1a5f('0x8')](),controller[_0x1a5f('0x9')]);router['get'](_0x1a5f('0xa'),auth[_0x1a5f('0x8')](),controller[_0x1a5f('0xb')]);router[_0x1a5f('0xc')](_0x1a5f('0xd'),auth[_0x1a5f('0x8')](),controller[_0x1a5f('0xe')]);router[_0x1a5f('0xf')]('/',auth[_0x1a5f('0x8')](),interaction['tracked'](_0x1a5f('0x10'),_0x1a5f('0x11')),controller[_0x1a5f('0x12')]);router['post']('/:id/status',controller[_0x1a5f('0x13')]);router[_0x1a5f('0x14')](_0x1a5f('0xd'),auth[_0x1a5f('0x8')](),controller[_0x1a5f('0x15')]);router['put'](_0x1a5f('0x16'),auth[_0x1a5f('0x8')](),controller[_0x1a5f('0x17')]);router[_0x1a5f('0x14')](_0x1a5f('0x18'),auth[_0x1a5f('0x8')](),controller[_0x1a5f('0x19')]);router[_0x1a5f('0x1a')](_0x1a5f('0xd'),auth[_0x1a5f('0x8')](),controller[_0x1a5f('0x1b')]);module[_0x1a5f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index f07b4d9..651c37e 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 _0x495c=['out','STRING','DATE','BOOLEAN','exports','TEXT','ENUM'];(function(_0x1bf5fb,_0xc73ad7){var _0x2e93b2=function(_0x4b4db8){while(--_0x4b4db8){_0x1bf5fb['push'](_0x1bf5fb['shift']());}};_0x2e93b2(++_0xc73ad7);}(_0x495c,0x1d2));var _0xc495=function(_0x2ca5c0,_0x4263a6){_0x2ca5c0=_0x2ca5c0-0x0;var _0x1c113b=_0x495c[_0x2ca5c0];return _0x1c113b;};'use strict';var Sequelize=require('sequelize');module[_0xc495('0x0')]={'body':{'type':Sequelize[_0xc495('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc495('0x2')]('in',_0xc495('0x3')),'defaultValue':_0xc495('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc495('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xc495('0x5')]},'secret':{'type':Sequelize[_0xc495('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc495('0x1')]}}; \ No newline at end of file +var _0x5e83=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x5eb404,_0x54980f){var _0xcd5a4d=function(_0x237677){while(--_0x237677){_0x5eb404['push'](_0x5eb404['shift']());}};_0xcd5a4d(++_0x54980f);}(_0x5e83,0x111));var _0x35e8=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x5e83[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0x35e8('0x0'));module[_0x35e8('0x1')]={'body':{'type':Sequelize[_0x35e8('0x2')](_0x35e8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x35e8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x35e8('0x5')]('in',_0x35e8('0x6')),'defaultValue':_0x35e8('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x35e8('0x7')](0xbe)},'phone':{'type':Sequelize[_0x35e8('0x7')]},'readAt':{'type':Sequelize[_0x35e8('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x35e8('0x7')]},'providerResponse':{'type':Sequelize[_0x35e8('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e9e10a1..61a4543 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 _0xb181=['acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','info','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','interface','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','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','socket.io-emitter','redis','./smsMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','stack','name','send','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','SmsMessage','includeAll','findAll','show','params','keys','rawAttributes','include','options','find','create','update','body','describe','sms-interactions','accept','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage'];(function(_0x42e99e,_0x13c67e){var _0x6b3d34=function(_0x1f7ed0){while(--_0x1f7ed0){_0x42e99e['push'](_0x42e99e['shift']());}};_0x6b3d34(++_0x13c67e);}(_0xb181,0xc6));var _0x1b18=function(_0x1e66b8,_0x4099ec){_0x1e66b8=_0x1e66b8-0x0;var _0x484f6d=_0xb181[_0x1e66b8];return _0x484f6d;};'use strict';var emlformat=require(_0x1b18('0x0'));var rimraf=require(_0x1b18('0x1'));var zipdir=require(_0x1b18('0x2'));var jsonpatch=require(_0x1b18('0x3'));var rp=require('request-promise');var moment=require(_0x1b18('0x4'));var BPromise=require(_0x1b18('0x5'));var Mustache=require('mustache');var util=require(_0x1b18('0x6'));var path=require(_0x1b18('0x7'));var sox=require(_0x1b18('0x8'));var csv=require(_0x1b18('0x9'));var ejs=require(_0x1b18('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b18('0xb'));var squel=require(_0x1b18('0xc'));var crypto=require('crypto');var jsforce=require(_0x1b18('0xd'));var deskjs=require(_0x1b18('0xe'));var toCsv=require(_0x1b18('0x9'));var querystring=require(_0x1b18('0xf'));var Papa=require('papaparse');var Redis=require(_0x1b18('0x10'));var authService=require(_0x1b18('0x11'));var qs=require(_0x1b18('0x12'));var as=require(_0x1b18('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b18('0x14'))(_0x1b18('0x15'));var utils=require(_0x1b18('0x16'));var config=require(_0x1b18('0x17'));var licenseUtil=require(_0x1b18('0x18'));var db=require(_0x1b18('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1b18('0x1a'))(new Redis(config[_0x1b18('0x1b')]));require(_0x1b18('0x1c'))[_0x1b18('0x1d')](socket);var jayson=require(_0x1b18('0x1e'));var client=jayson[_0x1b18('0x1f')][_0x1b18('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b301d,_0x5b421d,_0x3c8d52,_0xa4702b){return new BPromise(function(_0x364280,_0x1c7b95){var _0x294c8f=_0xa4702b||client;return _0x294c8f[_0x1b18('0x21')](_0x1b301d,_0x3c8d52)[_0x1b18('0x22')](function(_0x1e7d32){logger['info']('SmsMessage,\x20%s,\x20%s',_0x5b421d,_0x1b18('0x23'));logger[_0x1b18('0x24')](_0x1b18('0x25'),_0x5b421d,_0x1b18('0x23'),JSON['stringify'](_0x1e7d32));if(_0x1e7d32['error']){if(_0x1e7d32[_0x1b18('0x26')][_0x1b18('0x27')]===0x1f4){logger[_0x1b18('0x26')]('SmsMessage,\x20%s,\x20%s',_0x5b421d,_0x1e7d32['error']['message']);return _0x1c7b95(_0x1e7d32[_0x1b18('0x26')][_0x1b18('0x28')]);}logger['error'](_0x1b18('0x29'),_0x5b421d,_0x1e7d32[_0x1b18('0x26')][_0x1b18('0x28')]);return _0x364280(_0x1e7d32[_0x1b18('0x26')]['message']);}else{logger['info'](_0x1b18('0x29'),_0x5b421d,_0x1b18('0x23'));_0x364280(_0x1e7d32[_0x1b18('0x2a')][_0x1b18('0x28')]);}})[_0x1b18('0x2b')](function(_0x3523ce){logger[_0x1b18('0x26')]('SmsMessage,\x20%s,\x20%s',_0x5b421d,_0x3523ce);_0x1c7b95(_0x3523ce);});});}function respondWithStatusCode(_0x2bf404,_0x3308b6){_0x3308b6=_0x3308b6||0xcc;return function(_0x2a80e2){if(_0x2a80e2){return _0x2bf404[_0x1b18('0x2c')](_0x3308b6);}return _0x2bf404[_0x1b18('0x2d')](_0x3308b6)[_0x1b18('0x2e')]();};}function respondWithResult(_0x467b32,_0x511c90){_0x511c90=_0x511c90||0xc8;return function(_0x189b65){if(_0x189b65){return _0x467b32['status'](_0x511c90)[_0x1b18('0x2f')](_0x189b65);}};}function respondWithFilteredResult(_0x32500e,_0x1ce4ba){return function(_0x2ecc11){if(_0x2ecc11){var _0x187c07=typeof _0x1ce4ba[_0x1b18('0x30')]==='undefined'&&typeof _0x1ce4ba[_0x1b18('0x31')]===_0x1b18('0x32');var _0x1efc7c=_0x2ecc11[_0x1b18('0x33')];var _0x1e5e3d=_0x187c07?0x0:_0x1ce4ba[_0x1b18('0x30')];var _0x53e9c2=_0x187c07?_0x2ecc11[_0x1b18('0x33')]:_0x1ce4ba[_0x1b18('0x30')]+_0x1ce4ba[_0x1b18('0x31')];var _0x35f367;if(_0x53e9c2>=_0x1efc7c){_0x53e9c2=_0x1efc7c;_0x35f367=0xc8;}else{_0x35f367=0xce;}_0x32500e['status'](_0x35f367);return _0x32500e[_0x1b18('0x34')](_0x1b18('0x35'),_0x1e5e3d+'-'+_0x53e9c2+'/'+_0x1efc7c)[_0x1b18('0x2f')](_0x2ecc11);}return null;};}function patchUpdates(_0x34cb31){return function(_0x289e4c){try{jsonpatch[_0x1b18('0x36')](_0x289e4c,_0x34cb31,!![]);}catch(_0x146b97){return BPromise['reject'](_0x146b97);}return _0x289e4c[_0x1b18('0x37')]();};}function saveUpdates(_0x5fbecf,_0x714087){return function(_0x191126){if(_0x191126){return _0x191126['update'](_0x5fbecf)[_0x1b18('0x22')](function(_0x407b20){return _0x407b20;});}return null;};}function removeEntity(_0x1c2296,_0x473be2){return function(_0x39fca1){if(_0x39fca1){return _0x39fca1[_0x1b18('0x38')]()[_0x1b18('0x22')](function(){_0x1c2296[_0x1b18('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x120a58,_0x26da02){return function(_0x3f7468){if(!_0x3f7468){_0x120a58['sendStatus'](0x194);}return _0x3f7468;};}function handleError(_0x55bd28,_0x24ffde){_0x24ffde=_0x24ffde||0x1f4;return function(_0x203876){logger[_0x1b18('0x26')](_0x203876[_0x1b18('0x39')]);if(_0x203876[_0x1b18('0x3a')]){delete _0x203876['name'];}_0x55bd28[_0x1b18('0x2d')](_0x24ffde)[_0x1b18('0x3b')](_0x203876);};}exports['index']=function(_0x372b14,_0x5f193f){var _0x2b8ec6={},_0x3a8c27={},_0x486af6={'count':0x0,'rows':[]};var _0x3e6c86=_['map'](db['SmsMessage']['rawAttributes'],function(_0x261f07){return{'name':_0x261f07[_0x1b18('0x3c')],'type':_0x261f07[_0x1b18('0x3d')][_0x1b18('0x3e')]};});_0x3a8c27['model']=_[_0x1b18('0x3f')](_0x3e6c86,_0x1b18('0x3a'));_0x3a8c27[_0x1b18('0x40')]=_['keys'](_0x372b14['query']);_0x3a8c27[_0x1b18('0x41')]=_[_0x1b18('0x42')](_0x3a8c27[_0x1b18('0x43')],_0x3a8c27[_0x1b18('0x40')]);_0x2b8ec6[_0x1b18('0x44')]=_[_0x1b18('0x42')](_0x3a8c27[_0x1b18('0x43')],qs[_0x1b18('0x45')](_0x372b14[_0x1b18('0x40')][_0x1b18('0x45')]));_0x2b8ec6[_0x1b18('0x44')]=_0x2b8ec6['attributes'][_0x1b18('0x46')]?_0x2b8ec6[_0x1b18('0x44')]:_0x3a8c27['model'];if(!_0x372b14['query'][_0x1b18('0x47')]('nolimit')){_0x2b8ec6[_0x1b18('0x31')]=qs['limit'](_0x372b14[_0x1b18('0x40')][_0x1b18('0x31')]);_0x2b8ec6[_0x1b18('0x30')]=qs['offset'](_0x372b14[_0x1b18('0x40')]['offset']);}_0x2b8ec6[_0x1b18('0x48')]=qs['sort'](_0x372b14[_0x1b18('0x40')][_0x1b18('0x49')]);_0x2b8ec6[_0x1b18('0x4a')]=qs[_0x1b18('0x41')](_[_0x1b18('0x4b')](_0x372b14[_0x1b18('0x40')],_0x3a8c27[_0x1b18('0x41')]),_0x3e6c86);if(_0x372b14[_0x1b18('0x40')]['filter']){_0x2b8ec6[_0x1b18('0x4a')]=_['merge'](_0x2b8ec6['where'],{'$or':_['map'](_0x3e6c86,function(_0x105248){if(_0x105248[_0x1b18('0x3d')]!==_0x1b18('0x4c')){var _0xfd6f37={};_0xfd6f37[_0x105248[_0x1b18('0x3a')]]={'$like':'%'+_0x372b14[_0x1b18('0x40')][_0x1b18('0x4d')]+'%'};return _0xfd6f37;}})});}_0x2b8ec6=_[_0x1b18('0x4e')]({},_0x2b8ec6,_0x372b14['options']);var _0x23b1f5={'where':_0x2b8ec6[_0x1b18('0x4a')]};return db[_0x1b18('0x4f')]['count'](_0x23b1f5)[_0x1b18('0x22')](function(_0x4e4c40){_0x486af6[_0x1b18('0x33')]=_0x4e4c40;if(_0x372b14['query'][_0x1b18('0x50')]){_0x2b8ec6['include']=[{'all':!![]}];}return db[_0x1b18('0x4f')][_0x1b18('0x51')](_0x2b8ec6);})[_0x1b18('0x22')](function(_0x4fbc66){_0x486af6['rows']=_0x4fbc66;return _0x486af6;})[_0x1b18('0x22')](respondWithFilteredResult(_0x5f193f,_0x2b8ec6))[_0x1b18('0x2b')](handleError(_0x5f193f,null));};exports[_0x1b18('0x52')]=function(_0x281724,_0xfeaa07){var _0x535f2f={'raw':!![],'where':{'id':_0x281724[_0x1b18('0x53')]['id']}},_0x1cce4c={};_0x1cce4c[_0x1b18('0x43')]=_[_0x1b18('0x54')](db[_0x1b18('0x4f')][_0x1b18('0x55')]);_0x1cce4c[_0x1b18('0x40')]=_[_0x1b18('0x54')](_0x281724['query']);_0x1cce4c['filters']=_[_0x1b18('0x42')](_0x1cce4c['model'],_0x1cce4c[_0x1b18('0x40')]);_0x535f2f[_0x1b18('0x44')]=_[_0x1b18('0x42')](_0x1cce4c['model'],qs['fields'](_0x281724['query'][_0x1b18('0x45')]));_0x535f2f['attributes']=_0x535f2f['attributes'][_0x1b18('0x46')]?_0x535f2f[_0x1b18('0x44')]:_0x1cce4c[_0x1b18('0x43')];if(_0x281724[_0x1b18('0x40')][_0x1b18('0x50')]){_0x535f2f[_0x1b18('0x56')]=[{'all':!![]}];}_0x535f2f=_[_0x1b18('0x4e')]({},_0x535f2f,_0x281724[_0x1b18('0x57')]);return db['SmsMessage'][_0x1b18('0x58')](_0x535f2f)[_0x1b18('0x22')](handleEntityNotFound(_0xfeaa07,null))[_0x1b18('0x22')](respondWithResult(_0xfeaa07,null))[_0x1b18('0x2b')](handleError(_0xfeaa07,null));};exports['create']=function(_0x598788,_0x3ff1f0){return db['SmsMessage'][_0x1b18('0x59')](_0x598788['body'],{})[_0x1b18('0x22')](respondWithResult(_0x3ff1f0,0xc9))[_0x1b18('0x2b')](handleError(_0x3ff1f0,null));};exports[_0x1b18('0x5a')]=function(_0x47aa4a,_0x23d1de){if(_0x47aa4a[_0x1b18('0x5b')]['id']){delete _0x47aa4a[_0x1b18('0x5b')]['id'];}return db[_0x1b18('0x4f')][_0x1b18('0x58')]({'where':{'id':_0x47aa4a[_0x1b18('0x53')]['id']}})['then'](handleEntityNotFound(_0x23d1de,null))[_0x1b18('0x22')](saveUpdates(_0x47aa4a['body'],null))['then'](respondWithResult(_0x23d1de,null))[_0x1b18('0x2b')](handleError(_0x23d1de,null));};exports[_0x1b18('0x38')]=function(_0x5dd7f0,_0x40a6c3){return db[_0x1b18('0x4f')][_0x1b18('0x58')]({'where':{'id':_0x5dd7f0['params']['id']}})[_0x1b18('0x22')](handleEntityNotFound(_0x40a6c3,null))[_0x1b18('0x22')](removeEntity(_0x40a6c3,null))[_0x1b18('0x2b')](handleError(_0x40a6c3,null));};exports[_0x1b18('0x5c')]=function(_0x2757ad,_0x347f81){return db[_0x1b18('0x4f')][_0x1b18('0x5c')]()[_0x1b18('0x22')](respondWithResult(_0x347f81,null))['catch'](handleError(_0x347f81,null));};var interaction_log=require(_0x1b18('0x14'))(_0x1b18('0x5d'));exports[_0x1b18('0x5e')]=function(_0x14e081,_0x261eab,_0x28969c){var _0x56d1d9={'agent':{},'channel':_0x1b18('0x5f')};if(_0x14e081[_0x1b18('0x5b')]['id']){delete _0x14e081[_0x1b18('0x5b')]['id'];}_0x14e081['body'][_0x1b18('0x60')]=!![];_0x14e081['body']['readAt']=moment()['format'](_0x1b18('0x61'));_0x14e081[_0x1b18('0x5b')][_0x1b18('0x62')]=_0x14e081[_0x1b18('0x5b')][_0x1b18('0x62')]||_0x14e081[_0x1b18('0x63')]['id'];_0x56d1d9[_0x1b18('0x64')]['id']=_0x14e081[_0x1b18('0x5b')][_0x1b18('0x62')];return db['SmsMessage']['find']({'where':{'id':_0x14e081[_0x1b18('0x53')]['id'],'UserId':null}})[_0x1b18('0x22')](handleEntityNotFound(_0x261eab,null))[_0x1b18('0x22')](saveUpdates(_0x14e081[_0x1b18('0x5b')],null))[_0x1b18('0x22')](function(_0xcac858){if(_0xcac858){_0x56d1d9[_0x1b18('0x28')]=_0xcac858[_0x1b18('0x65')]({'plain':!![]});return db[_0x1b18('0x66')][_0x1b18('0x58')]({'where':{'id':_0xcac858[_0x1b18('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x261eab,null))['then'](function(_0x428179){if(_0x428179){return _0x428179[_0x1b18('0x5a')]({'UserId':_0x14e081[_0x1b18('0x5b')][_0x1b18('0x62')],'read1stAt':_['isNil'](_0x428179[_0x1b18('0x68')])?moment()[_0x1b18('0x69')](_0x1b18('0x61')):undefined});}return null;})[_0x1b18('0x22')](function(_0x532c28){if(_0x532c28){_0x56d1d9['interaction']=_0x532c28[_0x1b18('0x65')]({'plain':!![]});interaction_log['info'](_0x1b18('0x6a'),_0x14e081[_0x1b18('0x63')]['id'],_0x14e081[_0x1b18('0x63')][_0x1b18('0x3a')],_0x14e081[_0x1b18('0x63')][_0x1b18('0x6b')],_0x56d1d9[_0x1b18('0x6c')]['id'],_0x14e081[_0x1b18('0x5b')]?JSON[_0x1b18('0x6d')](_0x14e081[_0x1b18('0x5b')]):_0x1b18('0x6e'));return respondWithRpcPromise(_0x1b18('0x6f'),_0x1b18('0x70'),_0x56d1d9);}return null;})[_0x1b18('0x22')](function(_0x2bde07){var _0x17fbf0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2bde07[_0x1b18('0x28')][_0x1b18('0x71')];return db[_0x1b18('0x72')]['query'](_0x17fbf0,{'type':db[_0x1b18('0x73')][_0x1b18('0x74')]['SELECT'],'raw':!![]})['then'](function(_0x27678e){return _0x27678e;});})['then'](function(_0x3d783f){if(_0x3d783f){_0x56d1d9['message']['contact']=_0x3d783f[0x0];if(!_0x14e081[_0x1b18('0x5b')]['UserId'])return;return db[_0x1b18('0x75')][_0x1b18('0x58')]({'where':{'id':_0x14e081[_0x1b18('0x5b')][_0x1b18('0x62')],'role':'agent'},'attributes':['id','name',_0x1b18('0x76'),_0x1b18('0x77'),_0x1b18('0x78')],'raw':!![]});}return null;})['then'](function(_0x3a14ed){if(!_0x3a14ed)return null;_0x56d1d9['message']['agent']=_0x3a14ed;return _0x56d1d9;})[_0x1b18('0x22')](function(_0x1454e1){if(_0x1454e1){if(_0x14e081['body'][_0x1b18('0x79')]){_0x56d1d9['message']['interface']=util[_0x1b18('0x69')](_0x1b18('0x7a'),_0x14e081[_0x1b18('0x63')][_0x1b18('0x3a')]);_0x56d1d9[_0x1b18('0x28')]['channel']=_0x56d1d9[_0x1b18('0x7b')];_0x56d1d9[_0x1b18('0x28')][_0x1b18('0x7c')]=_0x56d1d9[_0x1b18('0x7b')];_0x56d1d9['message'][_0x1b18('0x7d')]=_0x1b18('0x5e');return respondWithRpcPromise(_0x1b18('0x7e'),_0x1b18('0x7e'),{'event':_0x1b18('0x7f'),'message':_0x56d1d9['message']},client9002)[_0x1b18('0x22')](function(){return _0x56d1d9;});}return _0x56d1d9;}return null;})[_0x1b18('0x22')](respondWithResult(_0x261eab,null))[_0x1b18('0x2b')](handleError(_0x261eab,null));};var interaction_log=require('../../config/logger')(_0x1b18('0x5d'));exports[_0x1b18('0x80')]=function(_0x2f4f37,_0x40a7ba,_0xc02ba6){var _0x3ed5f4={'agent':{},'channel':_0x1b18('0x5f')};if(_0x2f4f37[_0x1b18('0x5b')]['id']){delete _0x2f4f37[_0x1b18('0x5b')]['id'];}_0x2f4f37[_0x1b18('0x5b')][_0x1b18('0x62')]=_0x2f4f37[_0x1b18('0x5b')][_0x1b18('0x62')]||_0x2f4f37['user']['id'];_0x3ed5f4[_0x1b18('0x64')]['id']=_0x2f4f37[_0x1b18('0x5b')][_0x1b18('0x62')];return db[_0x1b18('0x4f')]['find']({'where':{'id':_0x2f4f37[_0x1b18('0x53')]['id'],'UserId':null}})[_0x1b18('0x22')](handleEntityNotFound(_0x40a7ba,null))[_0x1b18('0x22')](function(_0x3b939d){if(_0x3b939d){_0x3ed5f4['message']=_0x3b939d[_0x1b18('0x65')]({'plain':!![]});return db['SmsInteraction'][_0x1b18('0x58')]({'where':{'id':_0x3b939d[_0x1b18('0x67')]}});}return null;})[_0x1b18('0x22')](handleEntityNotFound(_0x40a7ba,null))[_0x1b18('0x22')](function(_0x29b864){if(_0x29b864){_0x3ed5f4[_0x1b18('0x6c')]=_0x29b864[_0x1b18('0x65')]({'plain':!![]});interaction_log[_0x1b18('0x81')](_0x1b18('0x82'),_0x2f4f37[_0x1b18('0x63')]['id'],_0x2f4f37[_0x1b18('0x63')][_0x1b18('0x3a')],_0x2f4f37[_0x1b18('0x63')][_0x1b18('0x6b')],_0x3ed5f4[_0x1b18('0x6c')]['id'],_0x2f4f37['body']?JSON[_0x1b18('0x6d')](_0x2f4f37[_0x1b18('0x5b')]):_0x1b18('0x6e'));return respondWithRpcPromise(_0x1b18('0x83'),_0x1b18('0x84'),_0x3ed5f4);}return null;})[_0x1b18('0x22')](function(_0x5998c7){var _0x44c455=_0x1b18('0x85')+_0x5998c7[_0x1b18('0x28')][_0x1b18('0x71')];return db['sequelize'][_0x1b18('0x40')](_0x44c455,{'type':db[_0x1b18('0x73')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x34c90d){return _0x34c90d;});})[_0x1b18('0x22')](function(_0x2ba191){if(_0x2ba191){_0x3ed5f4['message'][_0x1b18('0x86')]=_0x2ba191[0x0];if(!_0x2f4f37['body'][_0x1b18('0x62')])return;return db[_0x1b18('0x75')][_0x1b18('0x58')]({'where':{'id':_0x2f4f37[_0x1b18('0x5b')]['UserId'],'role':_0x1b18('0x64')},'attributes':['id',_0x1b18('0x3a'),'fullname',_0x1b18('0x77'),_0x1b18('0x78')],'raw':!![]});}return null;})[_0x1b18('0x22')](function(_0x2ab4c8){if(!_0x2ab4c8)return null;_0x3ed5f4[_0x1b18('0x28')][_0x1b18('0x64')]=_0x2ab4c8;return _0x3ed5f4;})[_0x1b18('0x22')](function(_0x5b6025){if(_0x5b6025){_0x5b6025[_0x1b18('0x28')][_0x1b18('0x87')]=util['format'](_0x1b18('0x7a'),_0x2f4f37[_0x1b18('0x63')][_0x1b18('0x3a')]);_0x5b6025[_0x1b18('0x28')][_0x1b18('0x7b')]=_0x3ed5f4[_0x1b18('0x7b')];_0x5b6025[_0x1b18('0x28')][_0x1b18('0x7c')]=_0x3ed5f4[_0x1b18('0x7b')];_0x5b6025[_0x1b18('0x28')]['event']='reject';respondWithRpcPromise(_0x1b18('0x7e'),_0x1b18('0x7e'),{'event':_0x1b18('0x88'),'message':_0x5b6025[_0x1b18('0x28')]},client9002);return _0x3ed5f4;}return null;})[_0x1b18('0x22')](respondWithResult(_0x40a7ba,null))['catch'](handleError(_0x40a7ba,null));};exports['status']=function(_0x2a3ecd,_0x10ea2c,_0x19d1bd){if(_0x2a3ecd[_0x1b18('0x5b')]['id']){delete _0x2a3ecd[_0x1b18('0x5b')]['id'];}var _0x22edc9;return db[_0x1b18('0x4f')][_0x1b18('0x58')]({'where':{'id':_0x2a3ecd['params']['id']}})[_0x1b18('0x22')](handleEntityNotFound(_0x10ea2c,null))[_0x1b18('0x22')](function(_0x3f8d8f){if(_0x3f8d8f){_0x22edc9=_0x3f8d8f;return db[_0x1b18('0x89')][_0x1b18('0x58')]({'where':{'id':_0x3f8d8f[_0x1b18('0x8a')]}});}})[_0x1b18('0x22')](handleEntityNotFound(_0x10ea2c,null))[_0x1b18('0x22')](function(_0x574bed){if(_0x574bed){logger[_0x1b18('0x24')](_0x1b18('0x25'),_0x1b18('0x2d'),_0x1b18('0x8b'),_0x574bed[_0x1b18('0x3d')],util[_0x1b18('0x8c')](_0x2a3ecd[_0x1b18('0x5b')],{'showHidden':![],'depth':null}));switch(_0x574bed[_0x1b18('0x3d')]){case _0x1b18('0x8d'):if(_0x2a3ecd[_0x1b18('0x5b')][_0x1b18('0x8e')]&&_0x2a3ecd[_0x1b18('0x5b')][_0x1b18('0x8e')]===_0x22edc9[_0x1b18('0x8f')]){return _0x22edc9['update']({'read':!![]});}else{logger[_0x1b18('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b18('0x2d'),_0x1b18('0x8d'),util[_0x1b18('0x8c')](_0x2a3ecd[_0x1b18('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x1b18('0x90'):if(_0x2a3ecd[_0x1b18('0x5b')][_0x1b18('0x91')]&&_0x2a3ecd['body'][_0x1b18('0x91')]===_0x22edc9[_0x1b18('0x8f')]&&_['indexOf']([_0x1b18('0x92'),_0x1b18('0x93')],_0x2a3ecd[_0x1b18('0x5b')][_0x1b18('0x94')])>=0x0){return _0x22edc9['update']({'read':!![]});}else{logger[_0x1b18('0x26')](_0x1b18('0x95'),_0x1b18('0x2d'),_0x1b18('0x96'),util[_0x1b18('0x8c')](_0x2a3ecd[_0x1b18('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x25f6be=_0x2a3ecd[_0x1b18('0x5b')][_0x1b18('0x97')][0x0];if(_0x25f6be[_0x1b18('0x2d')][_0x1b18('0x98')]===_0x1b18('0x99')){return _0x22edc9[_0x1b18('0x5a')]({'read':!![]});}else{logger[_0x1b18('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b18('0x2d'),_0x1b18('0x9a'),util[_0x1b18('0x8c')](_0x2a3ecd[_0x1b18('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x22edc9;}})[_0x1b18('0x22')](respondWithResult(_0x10ea2c,null))[_0x1b18('0x2b')](handleError(_0x10ea2c,null));}; \ No newline at end of file +var _0x7b77=['model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','internal','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','delivered','Status','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','debug','error','SmsMessage,\x20%s,\x20%s','message','info','request\x20sent','result','catch','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key'];(function(_0x58319a,_0x145060){var _0x4cf654=function(_0x314238){while(--_0x314238){_0x58319a['push'](_0x58319a['shift']());}};_0x4cf654(++_0x145060);}(_0x7b77,0x179));var _0x77b7=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0x7b77[_0x2c7dc6];return _0x10002b;};'use strict';var emlformat=require(_0x77b7('0x0'));var rimraf=require(_0x77b7('0x1'));var zipdir=require(_0x77b7('0x2'));var jsonpatch=require(_0x77b7('0x3'));var rp=require('request-promise');var moment=require(_0x77b7('0x4'));var BPromise=require(_0x77b7('0x5'));var Mustache=require(_0x77b7('0x6'));var util=require('util');var path=require(_0x77b7('0x7'));var sox=require(_0x77b7('0x8'));var csv=require(_0x77b7('0x9'));var ejs=require(_0x77b7('0xa'));var fs=require('fs');var fs_extra=require(_0x77b7('0xb'));var _=require(_0x77b7('0xc'));var squel=require('squel');var crypto=require(_0x77b7('0xd'));var jsforce=require(_0x77b7('0xe'));var deskjs=require(_0x77b7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x77b7('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x77b7('0x11'));var as=require(_0x77b7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x77b7('0x13'))(_0x77b7('0x14'));var utils=require(_0x77b7('0x15'));var config=require(_0x77b7('0x16'));var licenseUtil=require(_0x77b7('0x17'));var db=require(_0x77b7('0x18'))['db'];config[_0x77b7('0x19')]=_['defaults'](config[_0x77b7('0x19')],{'host':_0x77b7('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x77b7('0x1b')](socket);var jayson=require(_0x77b7('0x1c'));var client=jayson[_0x77b7('0x1d')][_0x77b7('0x1e')]({'port':0x232c});var client9002=jayson[_0x77b7('0x1d')][_0x77b7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4dbe04,_0x19d460,_0x253543,_0x3cb44b){return new BPromise(function(_0x2060df,_0x1cd7dd){var _0x25f361=_0x3cb44b||client;return _0x25f361[_0x77b7('0x1f')](_0x4dbe04,_0x253543)[_0x77b7('0x20')](function(_0x286046){logger['info']('SmsMessage,\x20%s,\x20%s',_0x19d460,'request\x20sent');logger[_0x77b7('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19d460,'request\x20sent',JSON['stringify'](_0x286046));if(_0x286046['error']){if(_0x286046[_0x77b7('0x22')]['code']===0x1f4){logger[_0x77b7('0x22')]('SmsMessage,\x20%s,\x20%s',_0x19d460,_0x286046[_0x77b7('0x22')]['message']);return _0x1cd7dd(_0x286046[_0x77b7('0x22')]['message']);}logger[_0x77b7('0x22')](_0x77b7('0x23'),_0x19d460,_0x286046[_0x77b7('0x22')][_0x77b7('0x24')]);return _0x2060df(_0x286046[_0x77b7('0x22')][_0x77b7('0x24')]);}else{logger[_0x77b7('0x25')](_0x77b7('0x23'),_0x19d460,_0x77b7('0x26'));_0x2060df(_0x286046[_0x77b7('0x27')][_0x77b7('0x24')]);}})[_0x77b7('0x28')](function(_0x29c2aa){logger[_0x77b7('0x22')](_0x77b7('0x23'),_0x19d460,_0x29c2aa);_0x1cd7dd(_0x29c2aa);});});}function respondWithStatusCode(_0x359b23,_0x300de9){_0x300de9=_0x300de9||0xcc;return function(_0x1cfcbb){if(_0x1cfcbb){return _0x359b23['sendStatus'](_0x300de9);}return _0x359b23['status'](_0x300de9)[_0x77b7('0x29')]();};}function respondWithResult(_0x22c56d,_0x3cae5a){_0x3cae5a=_0x3cae5a||0xc8;return function(_0x4c6f8d){if(_0x4c6f8d){return _0x22c56d[_0x77b7('0x2a')](_0x3cae5a)[_0x77b7('0x2b')](_0x4c6f8d);}};}function respondWithFilteredResult(_0x20de87,_0x16b66a){return function(_0x114cf0){if(_0x114cf0){var _0x323363=typeof _0x16b66a[_0x77b7('0x2c')]===_0x77b7('0x2d')&&typeof _0x16b66a[_0x77b7('0x2e')]==='undefined';var _0x2afbf5=_0x114cf0[_0x77b7('0x2f')];var _0x23aa7e=_0x323363?0x0:_0x16b66a[_0x77b7('0x2c')];var _0x2e87e6=_0x323363?_0x114cf0[_0x77b7('0x2f')]:_0x16b66a[_0x77b7('0x2c')]+_0x16b66a[_0x77b7('0x2e')];var _0xcac9e;if(_0x2e87e6>=_0x2afbf5){_0x2e87e6=_0x2afbf5;_0xcac9e=0xc8;}else{_0xcac9e=0xce;}_0x20de87[_0x77b7('0x2a')](_0xcac9e);return _0x20de87['set'](_0x77b7('0x30'),_0x23aa7e+'-'+_0x2e87e6+'/'+_0x2afbf5)[_0x77b7('0x2b')](_0x114cf0);}return null;};}function patchUpdates(_0x15eb97){return function(_0x4c4ba5){try{jsonpatch[_0x77b7('0x31')](_0x4c4ba5,_0x15eb97,!![]);}catch(_0x4b8d1e){return BPromise[_0x77b7('0x32')](_0x4b8d1e);}return _0x4c4ba5[_0x77b7('0x33')]();};}function saveUpdates(_0x4b24a2,_0x31102a){return function(_0x4eb758){if(_0x4eb758){return _0x4eb758[_0x77b7('0x34')](_0x4b24a2)[_0x77b7('0x20')](function(_0xad1a3c){return _0xad1a3c;});}return null;};}function removeEntity(_0x50345e,_0x21fae3){return function(_0x108c6d){if(_0x108c6d){return _0x108c6d[_0x77b7('0x35')]()[_0x77b7('0x20')](function(){_0x50345e[_0x77b7('0x2a')](0xcc)[_0x77b7('0x29')]();});}};}function handleEntityNotFound(_0x214257,_0x26a52d){return function(_0x3cf95f){if(!_0x3cf95f){_0x214257[_0x77b7('0x36')](0x194);}return _0x3cf95f;};}function handleError(_0x3546d8,_0xacd0b7){_0xacd0b7=_0xacd0b7||0x1f4;return function(_0xb5f230){logger['error'](_0xb5f230[_0x77b7('0x37')]);if(_0xb5f230[_0x77b7('0x38')]){delete _0xb5f230[_0x77b7('0x38')];}_0x3546d8['status'](_0xacd0b7)['send'](_0xb5f230);};}exports[_0x77b7('0x39')]=function(_0x2c5c77,_0x42d245){var _0x2d11ef={},_0x1bdfec={},_0x1f5184={'count':0x0,'rows':[]};var _0x1330e9=_[_0x77b7('0x3a')](db[_0x77b7('0x3b')][_0x77b7('0x3c')],function(_0x17f4ca){return{'name':_0x17f4ca[_0x77b7('0x3d')],'type':_0x17f4ca[_0x77b7('0x3e')][_0x77b7('0x3f')]};});_0x1bdfec[_0x77b7('0x40')]=_[_0x77b7('0x3a')](_0x1330e9,_0x77b7('0x38'));_0x1bdfec[_0x77b7('0x41')]=_[_0x77b7('0x42')](_0x2c5c77[_0x77b7('0x41')]);_0x1bdfec[_0x77b7('0x43')]=_['intersection'](_0x1bdfec[_0x77b7('0x40')],_0x1bdfec[_0x77b7('0x41')]);_0x2d11ef['attributes']=_[_0x77b7('0x44')](_0x1bdfec['model'],qs[_0x77b7('0x45')](_0x2c5c77[_0x77b7('0x41')]['fields']));_0x2d11ef[_0x77b7('0x46')]=_0x2d11ef['attributes']['length']?_0x2d11ef[_0x77b7('0x46')]:_0x1bdfec['model'];if(!_0x2c5c77[_0x77b7('0x41')]['hasOwnProperty'](_0x77b7('0x47'))){_0x2d11ef[_0x77b7('0x2e')]=qs[_0x77b7('0x2e')](_0x2c5c77[_0x77b7('0x41')][_0x77b7('0x2e')]);_0x2d11ef[_0x77b7('0x2c')]=qs['offset'](_0x2c5c77[_0x77b7('0x41')][_0x77b7('0x2c')]);}_0x2d11ef[_0x77b7('0x48')]=qs[_0x77b7('0x49')](_0x2c5c77[_0x77b7('0x41')][_0x77b7('0x49')]);_0x2d11ef[_0x77b7('0x4a')]=qs[_0x77b7('0x43')](_['pick'](_0x2c5c77[_0x77b7('0x41')],_0x1bdfec['filters']),_0x1330e9);if(_0x2c5c77[_0x77b7('0x41')]['filter']){_0x2d11ef[_0x77b7('0x4a')]=_[_0x77b7('0x4b')](_0x2d11ef[_0x77b7('0x4a')],{'$or':_[_0x77b7('0x3a')](_0x1330e9,function(_0x1250ad){if(_0x1250ad[_0x77b7('0x3e')]!==_0x77b7('0x4c')){var _0x52a73d={};_0x52a73d[_0x1250ad[_0x77b7('0x38')]]={'$like':'%'+_0x2c5c77[_0x77b7('0x41')]['filter']+'%'};return _0x52a73d;}})});}_0x2d11ef=_['merge']({},_0x2d11ef,_0x2c5c77[_0x77b7('0x4d')]);var _0x5dbb20={'where':_0x2d11ef[_0x77b7('0x4a')]};return db[_0x77b7('0x3b')][_0x77b7('0x2f')](_0x5dbb20)[_0x77b7('0x20')](function(_0x46d361){_0x1f5184[_0x77b7('0x2f')]=_0x46d361;if(_0x2c5c77[_0x77b7('0x41')][_0x77b7('0x4e')]){_0x2d11ef[_0x77b7('0x4f')]=[{'all':!![]}];}return db[_0x77b7('0x3b')][_0x77b7('0x50')](_0x2d11ef);})[_0x77b7('0x20')](function(_0x272bfb){_0x1f5184[_0x77b7('0x51')]=_0x272bfb;return _0x1f5184;})[_0x77b7('0x20')](respondWithFilteredResult(_0x42d245,_0x2d11ef))['catch'](handleError(_0x42d245,null));};exports[_0x77b7('0x52')]=function(_0x59a29d,_0x2da729){var _0x4ffde2={'raw':!![],'where':{'id':_0x59a29d[_0x77b7('0x53')]['id']}},_0x37ba6b={};_0x37ba6b[_0x77b7('0x40')]=_[_0x77b7('0x42')](db['SmsMessage'][_0x77b7('0x3c')]);_0x37ba6b['query']=_[_0x77b7('0x42')](_0x59a29d[_0x77b7('0x41')]);_0x37ba6b['filters']=_['intersection'](_0x37ba6b['model'],_0x37ba6b[_0x77b7('0x41')]);_0x4ffde2['attributes']=_[_0x77b7('0x44')](_0x37ba6b[_0x77b7('0x40')],qs[_0x77b7('0x45')](_0x59a29d[_0x77b7('0x41')]['fields']));_0x4ffde2[_0x77b7('0x46')]=_0x4ffde2[_0x77b7('0x46')][_0x77b7('0x54')]?_0x4ffde2[_0x77b7('0x46')]:_0x37ba6b['model'];if(_0x59a29d[_0x77b7('0x41')][_0x77b7('0x4e')]){_0x4ffde2['include']=[{'all':!![]}];}_0x4ffde2=_[_0x77b7('0x4b')]({},_0x4ffde2,_0x59a29d[_0x77b7('0x4d')]);return db[_0x77b7('0x3b')][_0x77b7('0x55')](_0x4ffde2)[_0x77b7('0x20')](handleEntityNotFound(_0x2da729,null))[_0x77b7('0x20')](respondWithResult(_0x2da729,null))[_0x77b7('0x28')](handleError(_0x2da729,null));};exports['create']=function(_0x404f23,_0x29d52b){return db['SmsMessage'][_0x77b7('0x56')](_0x404f23[_0x77b7('0x57')],{})[_0x77b7('0x20')](respondWithResult(_0x29d52b,0xc9))[_0x77b7('0x28')](handleError(_0x29d52b,null));};exports['update']=function(_0x50e6ab,_0x3a4902){if(_0x50e6ab[_0x77b7('0x57')]['id']){delete _0x50e6ab['body']['id'];}return db['SmsMessage'][_0x77b7('0x55')]({'where':{'id':_0x50e6ab[_0x77b7('0x53')]['id']}})[_0x77b7('0x20')](handleEntityNotFound(_0x3a4902,null))[_0x77b7('0x20')](saveUpdates(_0x50e6ab[_0x77b7('0x57')],null))[_0x77b7('0x20')](respondWithResult(_0x3a4902,null))[_0x77b7('0x28')](handleError(_0x3a4902,null));};exports[_0x77b7('0x35')]=function(_0x58296f,_0x5aa315){return db[_0x77b7('0x3b')][_0x77b7('0x55')]({'where':{'id':_0x58296f[_0x77b7('0x53')]['id']}})[_0x77b7('0x20')](handleEntityNotFound(_0x5aa315,null))[_0x77b7('0x20')](removeEntity(_0x5aa315,null))['catch'](handleError(_0x5aa315,null));};exports['describe']=function(_0x642f7a,_0x1323fc){return db['SmsMessage'][_0x77b7('0x58')]()['then'](respondWithResult(_0x1323fc,null))[_0x77b7('0x28')](handleError(_0x1323fc,null));};var interaction_log=require(_0x77b7('0x13'))(_0x77b7('0x59'));exports[_0x77b7('0x5a')]=function(_0x136fb5,_0x346083,_0x325208){var _0x1f590e={'agent':{},'channel':_0x77b7('0x5b')};if(_0x136fb5[_0x77b7('0x57')]['id']){delete _0x136fb5[_0x77b7('0x57')]['id'];}_0x136fb5['body'][_0x77b7('0x5c')]=!![];_0x136fb5[_0x77b7('0x57')][_0x77b7('0x5d')]=moment()[_0x77b7('0x5e')](_0x77b7('0x5f'));_0x136fb5[_0x77b7('0x57')][_0x77b7('0x60')]=_0x136fb5['body'][_0x77b7('0x60')]||_0x136fb5[_0x77b7('0x61')]['id'];_0x1f590e[_0x77b7('0x62')]['id']=_0x136fb5[_0x77b7('0x57')][_0x77b7('0x60')];return db[_0x77b7('0x3b')][_0x77b7('0x55')]({'where':{'id':_0x136fb5[_0x77b7('0x53')]['id'],'UserId':null}})[_0x77b7('0x20')](handleEntityNotFound(_0x346083,null))[_0x77b7('0x20')](saveUpdates(_0x136fb5[_0x77b7('0x57')],null))[_0x77b7('0x20')](function(_0x1da758){if(_0x1da758){_0x1f590e[_0x77b7('0x24')]=_0x1da758[_0x77b7('0x63')]({'plain':!![]});return db[_0x77b7('0x64')][_0x77b7('0x55')]({'where':{'id':_0x1da758[_0x77b7('0x65')]}});}return null;})[_0x77b7('0x20')](handleEntityNotFound(_0x346083,null))[_0x77b7('0x20')](function(_0x5e4338){if(_0x5e4338){return _0x5e4338['update']({'UserId':_0x136fb5[_0x77b7('0x57')][_0x77b7('0x60')],'read1stAt':_[_0x77b7('0x66')](_0x5e4338[_0x77b7('0x67')])?moment()[_0x77b7('0x5e')](_0x77b7('0x5f')):undefined});}return null;})[_0x77b7('0x20')](function(_0x4ddf38){if(_0x4ddf38){_0x1f590e[_0x77b7('0x68')]=_0x4ddf38['get']({'plain':!![]});interaction_log[_0x77b7('0x25')](_0x77b7('0x69'),_0x136fb5[_0x77b7('0x61')]['id'],_0x136fb5[_0x77b7('0x61')][_0x77b7('0x38')],_0x136fb5['user'][_0x77b7('0x6a')],_0x1f590e[_0x77b7('0x68')]['id'],_0x136fb5['body']?JSON[_0x77b7('0x6b')](_0x136fb5[_0x77b7('0x57')]):'null');return respondWithRpcPromise('AcceptMessage',_0x77b7('0x6c'),_0x1f590e);}return null;})['then'](function(_0x2e1910){var _0x571041='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2e1910[_0x77b7('0x24')][_0x77b7('0x6d')];return db[_0x77b7('0x6e')]['query'](_0x571041,{'type':db[_0x77b7('0x6f')]['QueryTypes'][_0x77b7('0x70')],'raw':!![]})[_0x77b7('0x20')](function(_0x23911a){return _0x23911a;});})[_0x77b7('0x20')](function(_0x57ce8b){if(_0x57ce8b){_0x1f590e['message'][_0x77b7('0x71')]=_0x57ce8b[0x0];if(!_0x136fb5[_0x77b7('0x57')][_0x77b7('0x60')])return;return db[_0x77b7('0x72')][_0x77b7('0x55')]({'where':{'id':_0x136fb5[_0x77b7('0x57')][_0x77b7('0x60')],'role':_0x77b7('0x62')},'attributes':['id',_0x77b7('0x38'),_0x77b7('0x73'),_0x77b7('0x74'),'internal'],'raw':!![]});}return null;})[_0x77b7('0x20')](function(_0x5bca0e){if(!_0x5bca0e)return null;_0x1f590e['message']['agent']=_0x5bca0e;return _0x1f590e;})['then'](function(_0x20aa17){if(_0x20aa17){if(_0x136fb5[_0x77b7('0x57')][_0x77b7('0x75')]){_0x1f590e[_0x77b7('0x24')][_0x77b7('0x76')]=util[_0x77b7('0x5e')](_0x77b7('0x77'),_0x136fb5['user']['name']);_0x1f590e[_0x77b7('0x24')][_0x77b7('0x78')]=_0x1f590e[_0x77b7('0x78')];_0x1f590e[_0x77b7('0x24')][_0x77b7('0x79')]=_0x1f590e[_0x77b7('0x78')];_0x1f590e[_0x77b7('0x24')][_0x77b7('0x7a')]=_0x77b7('0x5a');return respondWithRpcPromise(_0x77b7('0x7b'),'EventManager',{'event':_0x77b7('0x7c'),'message':_0x1f590e[_0x77b7('0x24')]},client9002)[_0x77b7('0x20')](function(){return _0x1f590e;});}return _0x1f590e;}return null;})[_0x77b7('0x20')](respondWithResult(_0x346083,null))[_0x77b7('0x28')](handleError(_0x346083,null));};var interaction_log=require('../../config/logger')(_0x77b7('0x59'));exports[_0x77b7('0x32')]=function(_0x2dea85,_0x48924c,_0x4fd6ce){var _0xbdf72f={'agent':{},'channel':'sms'};if(_0x2dea85[_0x77b7('0x57')]['id']){delete _0x2dea85[_0x77b7('0x57')]['id'];}_0x2dea85['body']['UserId']=_0x2dea85['body']['UserId']||_0x2dea85[_0x77b7('0x61')]['id'];_0xbdf72f[_0x77b7('0x62')]['id']=_0x2dea85['body'][_0x77b7('0x60')];return db['SmsMessage']['find']({'where':{'id':_0x2dea85[_0x77b7('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x48924c,null))[_0x77b7('0x20')](function(_0x56aa57){if(_0x56aa57){_0xbdf72f['message']=_0x56aa57[_0x77b7('0x63')]({'plain':!![]});return db[_0x77b7('0x64')][_0x77b7('0x55')]({'where':{'id':_0x56aa57[_0x77b7('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x48924c,null))['then'](function(_0x4e787f){if(_0x4e787f){_0xbdf72f[_0x77b7('0x68')]=_0x4e787f[_0x77b7('0x63')]({'plain':!![]});interaction_log[_0x77b7('0x25')](_0x77b7('0x7d'),_0x2dea85[_0x77b7('0x61')]['id'],_0x2dea85[_0x77b7('0x61')][_0x77b7('0x38')],_0x2dea85[_0x77b7('0x61')][_0x77b7('0x6a')],_0xbdf72f[_0x77b7('0x68')]['id'],_0x2dea85['body']?JSON['stringify'](_0x2dea85[_0x77b7('0x57')]):_0x77b7('0x7e'));return respondWithRpcPromise(_0x77b7('0x7f'),_0x77b7('0x80'),_0xbdf72f);}return null;})[_0x77b7('0x20')](function(_0x411810){var _0x385987=_0x77b7('0x81')+_0x411810[_0x77b7('0x24')][_0x77b7('0x6d')];return db['sequelize'][_0x77b7('0x41')](_0x385987,{'type':db[_0x77b7('0x6f')]['QueryTypes'][_0x77b7('0x70')],'raw':!![]})[_0x77b7('0x20')](function(_0x5d41fb){return _0x5d41fb;});})[_0x77b7('0x20')](function(_0x4ba5bd){if(_0x4ba5bd){_0xbdf72f[_0x77b7('0x24')][_0x77b7('0x71')]=_0x4ba5bd[0x0];if(!_0x2dea85[_0x77b7('0x57')][_0x77b7('0x60')])return;return db['User'][_0x77b7('0x55')]({'where':{'id':_0x2dea85['body'][_0x77b7('0x60')],'role':_0x77b7('0x62')},'attributes':['id',_0x77b7('0x38'),_0x77b7('0x73'),_0x77b7('0x74'),_0x77b7('0x82')],'raw':!![]});}return null;})[_0x77b7('0x20')](function(_0x2c4e23){if(!_0x2c4e23)return null;_0xbdf72f[_0x77b7('0x24')]['agent']=_0x2c4e23;return _0xbdf72f;})[_0x77b7('0x20')](function(_0x326b13){if(_0x326b13){_0x326b13[_0x77b7('0x24')][_0x77b7('0x76')]=util[_0x77b7('0x5e')](_0x77b7('0x77'),_0x2dea85['user']['name']);_0x326b13[_0x77b7('0x24')][_0x77b7('0x78')]=_0xbdf72f[_0x77b7('0x78')];_0x326b13['message'][_0x77b7('0x79')]=_0xbdf72f['channel'];_0x326b13[_0x77b7('0x24')][_0x77b7('0x7a')]=_0x77b7('0x32');respondWithRpcPromise(_0x77b7('0x7b'),_0x77b7('0x7b'),{'event':'rejectmessage','message':_0x326b13[_0x77b7('0x24')]},client9002);return _0xbdf72f;}return null;})['then'](respondWithResult(_0x48924c,null))[_0x77b7('0x28')](handleError(_0x48924c,null));};exports[_0x77b7('0x2a')]=function(_0x1a7afd,_0x2558fd,_0x11adb5){if(_0x1a7afd[_0x77b7('0x57')]['id']){delete _0x1a7afd['body']['id'];}var _0x1582ab;return db['SmsMessage'][_0x77b7('0x55')]({'where':{'id':_0x1a7afd['params']['id']}})[_0x77b7('0x20')](handleEntityNotFound(_0x2558fd,null))['then'](function(_0x2798da){if(_0x2798da){_0x1582ab=_0x2798da;return db['SmsAccount'][_0x77b7('0x55')]({'where':{'id':_0x2798da['SmsAccountId']}});}})[_0x77b7('0x20')](handleEntityNotFound(_0x2558fd,null))[_0x77b7('0x20')](function(_0x43faf7){if(_0x43faf7){logger['debug'](_0x77b7('0x83'),_0x77b7('0x2a'),_0x77b7('0x84'),_0x43faf7[_0x77b7('0x3e')],util['inspect'](_0x1a7afd[_0x77b7('0x57')],{'showHidden':![],'depth':null}));switch(_0x43faf7[_0x77b7('0x3e')]){case _0x77b7('0x85'):if(_0x1a7afd['body'][_0x77b7('0x86')]&&_0x1a7afd[_0x77b7('0x57')][_0x77b7('0x86')]===_0x1582ab[_0x77b7('0x87')]){return _0x1582ab[_0x77b7('0x34')]({'read':!![]});}else{logger['error'](_0x77b7('0x88'),_0x77b7('0x2a'),_0x77b7('0x85'),util[_0x77b7('0x89')](_0x1a7afd[_0x77b7('0x57')],{'showHidden':![],'depth':null}));}break;case _0x77b7('0x8a'):if(_0x1a7afd['body'][_0x77b7('0x8b')]&&_0x1a7afd[_0x77b7('0x57')][_0x77b7('0x8b')]===_0x1582ab['messageId']&&_[_0x77b7('0x8c')](['sent',_0x77b7('0x8d')],_0x1a7afd[_0x77b7('0x57')][_0x77b7('0x8e')])>=0x0){return _0x1582ab['update']({'read':!![]});}else{logger[_0x77b7('0x22')](_0x77b7('0x88'),_0x77b7('0x2a'),'plivio',util[_0x77b7('0x89')](_0x1a7afd['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5eb9de=_0x1a7afd['body'][_0x77b7('0x8f')][0x0];if(_0x5eb9de[_0x77b7('0x2a')][_0x77b7('0x90')]===_0x77b7('0x91')){return _0x1582ab[_0x77b7('0x34')]({'read':!![]});}else{logger[_0x77b7('0x22')](_0x77b7('0x88'),'status',_0x77b7('0x92'),util['inspect'](_0x1a7afd[_0x77b7('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x1582ab;}})[_0x77b7('0x20')](respondWithResult(_0x2558fd,null))[_0x77b7('0x28')](handleError(_0x2558fd,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d13378e..543b39a 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 _0x305a=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x49d104,_0x3dd68e){var _0x2a30b9=function(_0x3d3631){while(--_0x3d3631){_0x49d104['push'](_0x49d104['shift']());}};_0x2a30b9(++_0x3dd68e);}(_0x305a,0x6a));var _0xa305=function(_0x3707b4,_0x381890){_0x3707b4=_0x3707b4-0x0;var _0x46aa90=_0x305a[_0x3707b4];return _0x46aa90;};'use strict';var EventEmitter=require(_0xa305('0x0'));var SmsMessage=require(_0xa305('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa305('0x2')](0x0);var events={'afterCreate':_0xa305('0x3'),'afterUpdate':_0xa305('0x4'),'afterDestroy':'remove'};function emitEvent(_0x45397c){return function(_0x50ac6f,_0x55e58a,_0xa4ef82){SmsMessageEvents[_0xa305('0x5')](_0x45397c+':'+_0x50ac6f['id'],_0x50ac6f);SmsMessageEvents[_0xa305('0x5')](_0x45397c,_0x50ac6f);_0xa4ef82(null);};}for(var e in events){if(events[_0xa305('0x6')](e)){var event=events[e];SmsMessage[_0xa305('0x7')](e,emitEvent(event));}}module[_0xa305('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x5327=['emit','hook','exports','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x5b3291,_0x5670a8){var _0x419a48=function(_0x59baed){while(--_0x59baed){_0x5b3291['push'](_0x5b3291['shift']());}};_0x419a48(++_0x5670a8);}(_0x5327,0x1e3));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x7532('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7532('0x1')](0x0);var events={'afterCreate':_0x7532('0x2'),'afterUpdate':_0x7532('0x3'),'afterDestroy':_0x7532('0x4')};function emitEvent(_0x5065b2){return function(_0x247582,_0x967ac4,_0x2259a3){SmsMessageEvents[_0x7532('0x5')](_0x5065b2+':'+_0x247582['id'],_0x247582);SmsMessageEvents['emit'](_0x5065b2,_0x247582);_0x2259a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x7532('0x6')](e,emitEvent(event));}}module[_0x7532('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 d36270b..9452aa6 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 _0xd447=['direction','toLowerCase','isNil','UserId','findOne','SmsInteractionId','then','update','createdAt','catch','error','out','secret','SmsAccount','SmsAccountId','type','twilio','authToken','phone','accountSid','create','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','login?username=','&password=','GET','sms','POST','user_key','afterCreate','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','connectel','Missing\x20parameters:\x20authToken','clicksend','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','message_uuid','infobip','/auth/1/session','baseUrl','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','md5','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','applicationId','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get'];(function(_0x333d93,_0xdaf8af){var _0x2027b7=function(_0x23af5d){while(--_0x23af5d){_0x333d93['push'](_0x333d93['shift']());}};_0x2027b7(++_0xdaf8af);}(_0xd447,0x1da));var _0x7d44=function(_0x350c2f,_0x12263e){_0x350c2f=_0x350c2f-0x0;var _0x1be698=_0xd447[_0x350c2f];return _0x1be698;};'use strict';var _=require(_0x7d44('0x0'));var util=require(_0x7d44('0x1'));var logger=require(_0x7d44('0x2'))(_0x7d44('0x3'));var moment=require(_0x7d44('0x4'));var BPromise=require(_0x7d44('0x5'));var rp=require(_0x7d44('0x6'));var fs=require('fs');var path=require(_0x7d44('0x7'));var rimraf=require(_0x7d44('0x8'));var config=require(_0x7d44('0x9'));var attributes=require(_0x7d44('0xa'));module['exports']=function(_0x3a9d7e,_0x3fe451){return _0x3a9d7e['define'](_0x7d44('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x7d44('0xc'),'fields':[_0x7d44('0xc')]},{'name':_0x7d44('0xd'),'fields':[_0x7d44('0xe')],'type':_0x7d44('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x9ae202,_0x5f4e24,_0x527ae8){var _0x558499=_0x3a9d7e[_0x7d44('0x10')];var _0x4d1e35=_0x9ae202[_0x7d44('0x11')]({'plain':!![]});if(_0x4d1e35[_0x7d44('0x12')]['toLowerCase']()==='in'||_0x4d1e35[_0x7d44('0x12')][_0x7d44('0x13')]()==='out'&&!_0x4d1e35['secret']&&!_[_0x7d44('0x14')](_0x4d1e35[_0x7d44('0x15')])&&!_['isNil'](_0x4d1e35['SmsInteractionId'])){_0x558499['SmsInteraction'][_0x7d44('0x16')]({'where':{'id':_0x4d1e35[_0x7d44('0x17')]}})[_0x7d44('0x18')](function(_0x5dd50f){if(_0x5dd50f){_0x5dd50f[_0x7d44('0x19')]({'lastMsgAt':_0x4d1e35[_0x7d44('0x1a')],'lastMsgDirection':_0x4d1e35[_0x7d44('0x12')][_0x7d44('0x13')]()});}})[_0x7d44('0x1b')](function(_0x1dfe27){console[_0x7d44('0x1c')](_0x1dfe27);});}if(_0x4d1e35['direction']===_0x7d44('0x1d')&&!_0x4d1e35[_0x7d44('0x1e')]){var _0x1a17d4;_0x558499[_0x7d44('0x1f')]['find']({'where':{'id':_0x4d1e35[_0x7d44('0x20')]},'raw':!![]})[_0x7d44('0x18')](function(_0x1b2948){_0x1a17d4=_0x1b2948;if(_0x1a17d4&&_0x1a17d4[_0x7d44('0x21')]){switch(_0x1a17d4[_0x7d44('0x21')]){case _0x7d44('0x22'):var _0x315283=require(_0x7d44('0x22'));if(_0x1a17d4['accountSid']&&_0x1a17d4[_0x7d44('0x23')]&&_0x1a17d4[_0x7d44('0x24')]){var _0x1921f8=new _0x315283(_0x1a17d4[_0x7d44('0x25')],_0x1a17d4[_0x7d44('0x23')]);_0x1921f8['messages'][_0x7d44('0x26')]({'body':_0x4d1e35[_0x7d44('0xe')],'to':_0x4d1e35[_0x7d44('0x24')],'from':_0x1a17d4['phone'],'statusCallback':_0x1a17d4[_0x7d44('0x27')]+_0x7d44('0x28')+_0x4d1e35['id']+'/status?token='+_0x1a17d4[_0x7d44('0x29')]})[_0x7d44('0x18')](function(_0x10dc47){if(_0x10dc47[_0x7d44('0x2a')]){return _0x9ae202[_0x7d44('0x19')]({'messageId':_0x10dc47[_0x7d44('0x2a')]});}})[_0x7d44('0x1b')](function(_0x430a7d){logger['error'](_0x7d44('0x2b'),'afterCreate',_0x7d44('0x22'),util[_0x7d44('0x2c')](_0x430a7d,{'showHidden':![],'depth':null}));});}else{logger[_0x7d44('0x1c')](_0x7d44('0x2b'),'afterCreate','twilio',_0x7d44('0x2d'));}break;case _0x7d44('0x2e'):var _0x4c82fc='https://api.skebby.it/API/v1.0/REST/';if(_0x1a17d4[_0x7d44('0x2f')]&&_0x1a17d4[_0x7d44('0x30')]){var _0x429017={'recipient':[_0x4d1e35[_0x7d44('0x24')]],'message':_0x4d1e35[_0x7d44('0xe')],'message_type':_0x1a17d4[_0x7d44('0x31')]};if(_0x1a17d4['smsMethod']&&_0x1a17d4[_0x7d44('0x31')]!=='SI'){_0x429017['sender']=_0x1a17d4[_0x7d44('0x24')];}var _0x3d36f2={'url':_0x4c82fc+_0x7d44('0x32')+_0x1a17d4[_0x7d44('0x2f')]+_0x7d44('0x33')+_0x1a17d4['password'],'method':_0x7d44('0x34')};rp(_0x3d36f2)[_0x7d44('0x18')](function(_0x34130a){var _0x239655=_0x34130a['split'](';');var _0x219054={'user_key':_0x239655[0x0],'session_key':_0x239655[0x1]};_0x3d36f2={'url':_0x4c82fc+_0x7d44('0x35'),'method':_0x7d44('0x36'),'headers':{'user_key':_0x219054[_0x7d44('0x37')],'Session_key':_0x219054['session_key']},'json':!![],'body':_0x429017};return rp(_0x3d36f2);})[_0x7d44('0x18')](function(_0x1c6726){if(_0x1c6726['total_sent']>=0x1){var _0x662672={'messageId':_0x1c6726['internal_order_id']};if(_0x1a17d4[_0x7d44('0x31')]!=='GP'||!_0x1a17d4['deliveryReport']){_0x662672['read']=!![];}return _0x9ae202[_0x7d44('0x19')](_0x662672);}else{return logger[_0x7d44('0x1c')](_0x7d44('0x2b'),'afterCreate',_0x7d44('0x2e'),util[_0x7d44('0x2c')](_0x1c6726,{'showHidden':![],'depth':null}));}})[_0x7d44('0x1b')](function(_0x31f3ec){return logger[_0x7d44('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7d44('0x38'),_0x7d44('0x2e'),util['inspect'](_0x31f3ec,{'showHidden':![],'depth':null}));});}else{logger[_0x7d44('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7d44('0x38'),_0x7d44('0x2e'),_0x7d44('0x39'));}break;case'connectel':if(_0x1a17d4[_0x7d44('0x23')]){var _0x261d88={'recipient':_0x4d1e35[_0x7d44('0x24')],'message':_0x4d1e35[_0x7d44('0xe')],'sender':_0x1a17d4[_0x7d44('0x3a')]||_0x1a17d4['phone'],'authorization':_0x1a17d4[_0x7d44('0x23')]};var _0x5f4e24={'method':'POST','uri':_0x7d44('0x3b'),'body':_0x261d88,'json':!![]};rp(_0x5f4e24)[_0x7d44('0x18')](function(_0x1e3739){var _0x5794f4={'messageId':_0x1e3739[_0x7d44('0x3c')]};if(!_0x1a17d4[_0x7d44('0x3d')]){_0x5794f4[_0x7d44('0x3e')]=!![];}return _0x9ae202['update'](_0x5794f4);})[_0x7d44('0x1b')](function(_0x5e1202){logger[_0x7d44('0x1c')](_0x7d44('0x2b'),'afterCreate',_0x7d44('0x3f'),util[_0x7d44('0x2c')](_0x5e1202,{'showHidden':![],'depth':null}));});}else{logger[_0x7d44('0x1c')](_0x7d44('0x2b'),'afterCreate',_0x7d44('0x3f'),_0x7d44('0x40'));}break;case _0x7d44('0x41'):if(_0x1a17d4['username']&&_0x1a17d4[_0x7d44('0x30')]){var _0x261d88={'messages':[{'source':'xCALLY\x20Motion','to':_0x4d1e35[_0x7d44('0x24')],'body':_0x4d1e35[_0x7d44('0xe')],'from':_0x1a17d4[_0x7d44('0x3a')]||_0x1a17d4[_0x7d44('0x24')]}]};var _0x5e8da0=util[_0x7d44('0x42')]('%s:%s',_0x1a17d4[_0x7d44('0x2f')],_0x1a17d4['password']);var _0x5f4e24={'method':_0x7d44('0x36'),'uri':_0x7d44('0x43'),'body':_0x261d88,'headers':{'Authorization':util['format'](_0x7d44('0x44'),new Buffer(_0x5e8da0)['toString']('base64'))},'json':!![]};rp(_0x5f4e24)['then'](function(_0x36f079){if(_0x36f079[_0x7d44('0x45')]>=0xc8&&_0x36f079[_0x7d44('0x45')]<=0xce){if(_0x36f079[_0x7d44('0x46')]&&_0x36f079[_0x7d44('0x46')][_0x7d44('0x47')]>0x0){var _0x219ca0=_[_0x7d44('0x48')](_0x36f079[_0x7d44('0x46')][_0x7d44('0x49')]);var _0x448744={'messageId':_0x219ca0[_0x7d44('0x4a')]};if(!_0x1a17d4[_0x7d44('0x3d')]){_0x448744['read']=!![];}return _0x9ae202[_0x7d44('0x19')](_0x448744);}else{logger[_0x7d44('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7d44('0x38'),_0x7d44('0x4b'),util['inspect'](_0x36f079,{'showHidden':![],'depth':null}));}}else{logger[_0x7d44('0x1c')](_0x7d44('0x2b'),_0x7d44('0x38'),_0x7d44('0x4b'),util['inspect'](_0x36f079,{'showHidden':![],'depth':null}));}})[_0x7d44('0x1b')](function(_0x10033b){logger[_0x7d44('0x1c')](_0x7d44('0x2b'),_0x7d44('0x38'),_0x7d44('0x4b'),util[_0x7d44('0x2c')](_0x10033b,{'showHidden':![],'depth':null}));});}else{logger[_0x7d44('0x1c')](_0x7d44('0x2b'),_0x7d44('0x38'),'clickSend',_0x7d44('0x39'));}break;case _0x7d44('0x4c'):if(_0x1a17d4[_0x7d44('0x4d')]&&_0x1a17d4[_0x7d44('0x23')]){var _0x261d88={'dst':_0x4d1e35[_0x7d44('0x24')],'text':_0x4d1e35[_0x7d44('0xe')],'src':_0x1a17d4[_0x7d44('0x3a')]||_0x1a17d4[_0x7d44('0x24')],'url':_0x1a17d4[_0x7d44('0x27')]+'/api/sms/messages/'+_0x4d1e35['id']+'/status?token='+_0x1a17d4[_0x7d44('0x29')]};var _0x5e8da0=util[_0x7d44('0x42')](_0x7d44('0x4e'),_0x1a17d4[_0x7d44('0x4d')],_0x1a17d4[_0x7d44('0x23')]);var _0x5f4e24={'method':_0x7d44('0x36'),'uri':util[_0x7d44('0x42')](_0x7d44('0x4f'),_0x1a17d4['authId']),'body':_0x261d88,'headers':{'Authorization':util[_0x7d44('0x42')](_0x7d44('0x44'),new Buffer(_0x5e8da0)[_0x7d44('0x50')](_0x7d44('0x51')))},'json':!![]};rp(_0x5f4e24)[_0x7d44('0x18')](function(_0x49afed){var _0x1d0159={'messageId':_0x49afed[_0x7d44('0x52')][0x0]};return _0x9ae202['update'](_0x1d0159);})[_0x7d44('0x1b')](function(_0x4bea8c){logger[_0x7d44('0x1c')](_0x7d44('0x2b'),'afterCreate',_0x7d44('0x4c'),util[_0x7d44('0x2c')](_0x4bea8c,{'showHidden':![],'depth':null}));});}else{logger[_0x7d44('0x1c')](_0x7d44('0x2b'),'afterCreate',_0x7d44('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x7d44('0x53'):if(_0x1a17d4[_0x7d44('0x2f')]&&_0x1a17d4[_0x7d44('0x30')]){if(_0x1a17d4['baseUrl']){var _0x248414={'method':_0x7d44('0x36'),'uri':_0x1a17d4['baseUrl']+_0x7d44('0x54'),'body':{'username':_0x1a17d4['username'],'password':_0x1a17d4[_0x7d44('0x30')]},'json':!![]};return rp(_0x248414)[_0x7d44('0x18')](function(_0x2a463b){var _0xcfebae={'method':'POST','uri':_0x1a17d4[_0x7d44('0x55')]+_0x7d44('0x56'),'body':{'messages':[{'from':_0x1a17d4[_0x7d44('0x24')],'destinations':[{'to':_0x4d1e35['phone']}],'text':_0x4d1e35[_0x7d44('0xe')],'notifyUrl':_0x1a17d4[_0x7d44('0x27')]+'/api/sms/messages/'+_0x4d1e35['id']+_0x7d44('0x57')+_0x1a17d4[_0x7d44('0x29')],'notifyContentType':_0x7d44('0x58'),'callbackData':_0x1a17d4[_0x7d44('0x24')]+';'+_0x4d1e35['body']}]},'headers':{'Authorization':_0x7d44('0x59')+_0x2a463b[_0x7d44('0x29')]},'json':!![]};return rp(_0xcfebae)[_0x7d44('0x18')](function(_0x37a6a7){if(_0x37a6a7['messages']){var _0x10153c={'messageId':_0x37a6a7[_0x7d44('0x49')][0x0][_0x7d44('0xc')]};if(!_0x1a17d4['deliveryReport']){_0x10153c['read']=!![];}return _0x9ae202[_0x7d44('0x19')](_0x10153c);}else{return logger[_0x7d44('0x1c')](_0x7d44('0x2b'),_0x7d44('0x38'),_0x7d44('0x53'),util[_0x7d44('0x2c')](_0x37a6a7,{'showHidden':![],'depth':null}));}});})[_0x7d44('0x1b')](function(_0x79d4f2){return logger[_0x7d44('0x1c')](_0x7d44('0x2b'),'afterCreate',_0x7d44('0x53'),util[_0x7d44('0x2c')](_0x79d4f2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7d44('0x2b'),_0x7d44('0x38'),_0x7d44('0x53'),_0x7d44('0x5a'));}}else{logger[_0x7d44('0x1c')](_0x7d44('0x2b'),_0x7d44('0x38'),_0x7d44('0x53'),_0x7d44('0x39'));}break;case _0x7d44('0x5b'):var _0x4e59b1=require(_0x7d44('0x5c'));if(_0x1a17d4[_0x7d44('0x5d')]){var _0x59a1d0={};_0x59a1d0[_0x7d44('0x5e')]=_0x1a17d4[_0x7d44('0x2f')];_0x59a1d0[_0x7d44('0x24')]=_0x4d1e35[_0x7d44('0x24')];_0x59a1d0['sender']=_0x1a17d4[_0x7d44('0x24')];_0x59a1d0[_0x7d44('0x5f')]=_0x4d1e35[_0x7d44('0xe')];_0x59a1d0[_0x7d44('0x60')]=+new Date();var _0x44b846='';var _0x4c27a0='';var _0x3f7511=Object[_0x7d44('0x61')](_0x59a1d0);_0x3f7511[_0x7d44('0x62')]();for(var _0x2e91c8=0x0;_0x2e91c8<_0x3f7511['length'];_0x2e91c8++){if(_0x44b846!=''){_0x44b846+='&';}_0x44b846+=_0x3f7511[_0x2e91c8]+'='+encodeURIComponent(_0x59a1d0[_0x3f7511[_0x2e91c8]]);_0x4c27a0+=_0x59a1d0[_0x3f7511[_0x2e91c8]];}_0x4c27a0+=_0x1a17d4[_0x7d44('0x5d')];_0x4c27a0=_0x4e59b1['createHash'](_0x7d44('0x63'))[_0x7d44('0x19')](_0x4c27a0)[_0x7d44('0x64')]('hex');if(_0x44b846!==''){_0x44b846+='&';}_0x44b846+=_0x7d44('0x65')+_0x4c27a0;var _0x3d36f2={'method':_0x7d44('0x34'),'uri':_0x1a17d4['baseUrl']+_0x7d44('0x66')+_0x44b846,'json':!![]};return rp(_0x3d36f2)['then'](function(_0x201ec1){var _0xe5c064=Object[_0x7d44('0x61')](_0x201ec1);if(_0x201ec1[_0xe5c064[0x0]][_0x7d44('0x1c')]&&parseInt(_0x201ec1[_0xe5c064[0x0]][_0x7d44('0x1c')])===0x0){var _0x51cf20={'messageId':_0x201ec1[_0xe5c064[0x0]][_0x7d44('0x67')]};if(!_0x1a17d4['deliveryReport']){_0x51cf20[_0x7d44('0x3e')]=!![];}return _0x9ae202[_0x7d44('0x19')](_0x51cf20);}else{return logger['error'](_0x7d44('0x2b'),_0x7d44('0x38'),_0x7d44('0x5b'),util[_0x7d44('0x2c')](_0x201ec1[_0x7d44('0x1c')],{'showHidden':![],'depth':null}));}})[_0x7d44('0x1b')](function(_0x34d684){return logger[_0x7d44('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7d44('0x38'),_0x7d44('0x5b'),util[_0x7d44('0x2c')](_0x34d684,{'showHidden':![],'depth':null}));});}else{logger[_0x7d44('0x1c')](_0x7d44('0x2b'),'afterCreate','csc',_0x7d44('0x68'));}break;case'clickatell':if(_0x1a17d4[_0x7d44('0x5d')]){var _0x57f82b={'method':_0x7d44('0x36'),'uri':_0x7d44('0x69'),'headers':{'Authorization':_0x1a17d4[_0x7d44('0x5d')]},'body':{'content':_0x4d1e35[_0x7d44('0xe')],'to':[_0x4d1e35[_0x7d44('0x24')]],'from':_0x1a17d4[_0x7d44('0x24')],'binary':![],'clientMessageId':_0x7d44('0x6a'),'charset':_0x7d44('0x6b')},'json':!![]};rp(_0x57f82b)[_0x7d44('0x18')](function(_0x163076){if(!_0x163076[_0x7d44('0x1c')]){var _0x462749={'messageId':_0x163076[_0x7d44('0x49')][0x0][_0x7d44('0x6c')]};if(!_0x1a17d4[_0x7d44('0x3d')]){_0x462749[_0x7d44('0x3e')]=!![];}return _0x9ae202['update'](_0x462749);}else{return logger[_0x7d44('0x1c')](_0x7d44('0x2b'),_0x7d44('0x38'),_0x7d44('0x6d'),util[_0x7d44('0x2c')](_0x163076['error'],{'showHidden':![],'depth':null}));}})[_0x7d44('0x1b')](function(_0xbb2fdd){return logger[_0x7d44('0x1c')](_0x7d44('0x2b'),_0x7d44('0x38'),_0x7d44('0x6d'),util['inspect'](_0xbb2fdd,{'showHidden':![],'depth':null}));});}else{logger[_0x7d44('0x1c')](_0x7d44('0x2b'),_0x7d44('0x38'),_0x7d44('0x6d'),_0x7d44('0x68'));}break;case _0x7d44('0x6e'):if(_0x1a17d4[_0x7d44('0x2f')]&&_0x1a17d4[_0x7d44('0x30')]){var _0x5e8da0=util[_0x7d44('0x42')](_0x7d44('0x4e'),_0x1a17d4[_0x7d44('0x2f')],_0x1a17d4[_0x7d44('0x30')]);var _0x5f4e24={'method':_0x7d44('0x36'),'uri':_0x7d44('0x6f')+_0x1a17d4['accountId']+'/messages','body':{'to':[_0x4d1e35[_0x7d44('0x24')]],'text':_0x4d1e35['body'],'from':_0x1a17d4[_0x7d44('0x24')],'applicationId':_0x1a17d4[_0x7d44('0x70')]},'headers':{'Authorization':util[_0x7d44('0x42')]('Basic\x20%s',new Buffer(_0x5e8da0)[_0x7d44('0x50')](_0x7d44('0x51')))},'json':!![]};rp(_0x5f4e24)[_0x7d44('0x18')](function(_0x21906f){if(_0x21906f['id']){var _0x5433c9={'messageId':_0x21906f['id']};return _0x9ae202[_0x7d44('0x19')](_0x5433c9);}else{logger[_0x7d44('0x1c')](_0x7d44('0x2b'),_0x7d44('0x38'),_0x7d44('0x6e'),util[_0x7d44('0x2c')](_0x21906f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e4132){logger[_0x7d44('0x1c')](_0x7d44('0x2b'),'afterCreate','bandwidth',util[_0x7d44('0x2c')](_0x1e4132,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7d44('0x2b'),_0x7d44('0x38'),_0x7d44('0x6e'),_0x7d44('0x39'));}break;case'intelepeer':if(_0x1a17d4[_0x7d44('0x5d')]){var _0x335ad7={};var _0x3d36f2={'method':_0x7d44('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x7d44('0x71')+_0x1a17d4['apiKey'],'Content-Type':_0x7d44('0x58')},'body':{'from':_0x1a17d4[_0x7d44('0x24')],'to':_0x4d1e35[_0x7d44('0x24')],'text':_0x4d1e35[_0x7d44('0xe')]},'json':!![]};return rp(_0x3d36f2)[_0x7d44('0x18')](function(_0x9ba0a1){if(_0x9ba0a1['code']==0xca){_0x335ad7[_0x7d44('0x72')]=_0x9ba0a1;var _0x5d24a8={'method':_0x7d44('0x36'),'uri':_0x7d44('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x1a17d4[_0x7d44('0x5d')],'Content-Type':_0x7d44('0x58')},'body':{'refid':_0x335ad7[_0x7d44('0x72')][_0x7d44('0x74')]},'json':!![]};return rp(_0x5d24a8)['then'](function(_0x5e1d1f){_0x335ad7[_0x7d44('0x75')]=_0x5e1d1f;var _0x1b7ac1={'messageId':_0x335ad7[_0x7d44('0x72')]['refid'],'read':!![]};return _0x9ae202[_0x7d44('0x19')](_0x1b7ac1);});}else{return logger[_0x7d44('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7d44('0x38'),_0x7d44('0x76'),util[_0x7d44('0x2c')](_0x9ba0a1,{'showHidden':![],'depth':null}));}})[_0x7d44('0x1b')](function(_0x4cdf79){return logger[_0x7d44('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7d44('0x38'),_0x7d44('0x76'),util[_0x7d44('0x2c')](_0x4cdf79,{'showHidden':![],'depth':null}));});}else{return logger[_0x7d44('0x1c')](_0x7d44('0x2b'),_0x7d44('0x38'),_0x7d44('0x76'),_0x7d44('0x77'));}break;}}})[_0x7d44('0x78')](function(){_0x527ae8();});}else{_0x527ae8();}}},'charset':_0x7d44('0x79'),'collate':_0x7d44('0x7a')});}; \ No newline at end of file +var _0x78b4=['createdAt','error','secret','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','csc','login','text','keys','sort','length','apiKey','md5','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','accountId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','body','FULLTEXT','models','toLowerCase','direction','out','isNil','SmsInteractionId','SmsInteraction','findOne','then','update'];(function(_0x1ed666,_0x2860){var _0x1b0eef=function(_0xf689ad){while(--_0xf689ad){_0x1ed666['push'](_0x1ed666['shift']());}};_0x1b0eef(++_0x2860);}(_0x78b4,0xd3));var _0x478b=function(_0x4b6c86,_0x5d4199){_0x4b6c86=_0x4b6c86-0x0;var _0x4c5826=_0x78b4[_0x4b6c86];return _0x4c5826;};'use strict';var _=require(_0x478b('0x0'));var util=require(_0x478b('0x1'));var logger=require(_0x478b('0x2'))(_0x478b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x478b('0x4'));var config=require(_0x478b('0x5'));var attributes=require(_0x478b('0x6'));module[_0x478b('0x7')]=function(_0x196cc4,_0xb497ce){return _0x196cc4[_0x478b('0x8')](_0x478b('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x478b('0xa'),'fields':[_0x478b('0xa')]},{'name':'fti_sms_messages','fields':[_0x478b('0xb')],'type':_0x478b('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xaf3e8d,_0x23de52,_0x2ffb34){var _0x2926d9=_0x196cc4[_0x478b('0xd')];var _0x3fb12c=_0xaf3e8d['get']({'plain':!![]});if(_0x3fb12c['direction'][_0x478b('0xe')]()==='in'||_0x3fb12c[_0x478b('0xf')][_0x478b('0xe')]()===_0x478b('0x10')&&!_0x3fb12c['secret']&&!_[_0x478b('0x11')](_0x3fb12c['UserId'])&&!_[_0x478b('0x11')](_0x3fb12c[_0x478b('0x12')])){_0x2926d9[_0x478b('0x13')][_0x478b('0x14')]({'where':{'id':_0x3fb12c['SmsInteractionId']}})[_0x478b('0x15')](function(_0x4961a8){if(_0x4961a8){_0x4961a8[_0x478b('0x16')]({'lastMsgAt':_0x3fb12c[_0x478b('0x17')],'lastMsgDirection':_0x3fb12c[_0x478b('0xf')][_0x478b('0xe')]()});}})['catch'](function(_0x39949e){console[_0x478b('0x18')](_0x39949e);});}if(_0x3fb12c['direction']===_0x478b('0x10')&&!_0x3fb12c[_0x478b('0x19')]){var _0xaafaf6;_0x2926d9[_0x478b('0x1a')][_0x478b('0x1b')]({'where':{'id':_0x3fb12c[_0x478b('0x1c')]},'raw':!![]})[_0x478b('0x15')](function(_0xf670ee){_0xaafaf6=_0xf670ee;if(_0xaafaf6&&_0xaafaf6[_0x478b('0x1d')]){switch(_0xaafaf6[_0x478b('0x1d')]){case _0x478b('0x1e'):var _0x4a9306=require(_0x478b('0x1e'));if(_0xaafaf6['accountSid']&&_0xaafaf6[_0x478b('0x1f')]&&_0xaafaf6[_0x478b('0x20')]){var _0x1ee1fc=new _0x4a9306(_0xaafaf6['accountSid'],_0xaafaf6[_0x478b('0x1f')]);_0x1ee1fc[_0x478b('0x21')][_0x478b('0x22')]({'body':_0x3fb12c[_0x478b('0xb')],'to':_0x3fb12c[_0x478b('0x20')],'from':_0xaafaf6[_0x478b('0x20')],'statusCallback':_0xaafaf6[_0x478b('0x23')]+_0x478b('0x24')+_0x3fb12c['id']+'/status?token='+_0xaafaf6[_0x478b('0x25')]})[_0x478b('0x15')](function(_0x5f50ea){if(_0x5f50ea['sid']){return _0xaf3e8d[_0x478b('0x16')]({'messageId':_0x5f50ea[_0x478b('0x26')]});}})[_0x478b('0x27')](function(_0x53a0cd){logger[_0x478b('0x18')](_0x478b('0x28'),'afterCreate',_0x478b('0x1e'),util[_0x478b('0x29')](_0x53a0cd,{'showHidden':![],'depth':null}));});}else{logger[_0x478b('0x18')](_0x478b('0x28'),_0x478b('0x2a'),_0x478b('0x1e'),_0x478b('0x2b'));}break;case _0x478b('0x2c'):var _0x267f48=_0x478b('0x2d');if(_0xaafaf6['username']&&_0xaafaf6[_0x478b('0x2e')]){var _0x6f4cbe={'recipient':[_0x3fb12c[_0x478b('0x20')]],'message':_0x3fb12c[_0x478b('0xb')],'message_type':_0xaafaf6[_0x478b('0x2f')]};if(_0xaafaf6[_0x478b('0x2f')]&&_0xaafaf6['smsMethod']!=='SI'){_0x6f4cbe[_0x478b('0x30')]=_0xaafaf6['phone'];}var _0x4a00fd={'url':_0x267f48+_0x478b('0x31')+_0xaafaf6[_0x478b('0x32')]+'&password='+_0xaafaf6[_0x478b('0x2e')],'method':_0x478b('0x33')};rp(_0x4a00fd)[_0x478b('0x15')](function(_0x4a2d95){var _0x4ef98e=_0x4a2d95[_0x478b('0x34')](';');var _0x4dd1b8={'user_key':_0x4ef98e[0x0],'session_key':_0x4ef98e[0x1]};_0x4a00fd={'url':_0x267f48+_0x478b('0x35'),'method':_0x478b('0x36'),'headers':{'user_key':_0x4dd1b8['user_key'],'Session_key':_0x4dd1b8[_0x478b('0x37')]},'json':!![],'body':_0x6f4cbe};return rp(_0x4a00fd);})[_0x478b('0x15')](function(_0x516952){if(_0x516952[_0x478b('0x38')]>=0x1){var _0x489d00={'messageId':_0x516952[_0x478b('0x39')]};if(_0xaafaf6[_0x478b('0x2f')]!=='GP'||!_0xaafaf6[_0x478b('0x3a')]){_0x489d00[_0x478b('0x3b')]=!![];}return _0xaf3e8d['update'](_0x489d00);}else{return logger[_0x478b('0x18')](_0x478b('0x28'),'afterCreate',_0x478b('0x2c'),util['inspect'](_0x516952,{'showHidden':![],'depth':null}));}})[_0x478b('0x27')](function(_0x3d8d15){return logger[_0x478b('0x18')](_0x478b('0x28'),_0x478b('0x2a'),_0x478b('0x2c'),util[_0x478b('0x29')](_0x3d8d15,{'showHidden':![],'depth':null}));});}else{logger[_0x478b('0x18')](_0x478b('0x28'),'afterCreate',_0x478b('0x2c'),_0x478b('0x3c'));}break;case _0x478b('0x3d'):if(_0xaafaf6[_0x478b('0x1f')]){var _0x17390e={'recipient':_0x3fb12c[_0x478b('0x20')],'message':_0x3fb12c['body'],'sender':_0xaafaf6[_0x478b('0x3e')]||_0xaafaf6[_0x478b('0x20')],'authorization':_0xaafaf6[_0x478b('0x1f')]};var _0x23de52={'method':_0x478b('0x36'),'uri':_0x478b('0x3f'),'body':_0x17390e,'json':!![]};rp(_0x23de52)[_0x478b('0x15')](function(_0x227db2){var _0x55cb8c={'messageId':_0x227db2[_0x478b('0x40')]};if(!_0xaafaf6[_0x478b('0x3a')]){_0x55cb8c[_0x478b('0x3b')]=!![];}return _0xaf3e8d['update'](_0x55cb8c);})[_0x478b('0x27')](function(_0x174b26){logger[_0x478b('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x478b('0x3d'),util[_0x478b('0x29')](_0x174b26,{'showHidden':![],'depth':null}));});}else{logger[_0x478b('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x478b('0x2a'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0xaafaf6[_0x478b('0x32')]&&_0xaafaf6['password']){var _0x17390e={'messages':[{'source':_0x478b('0x41'),'to':_0x3fb12c[_0x478b('0x20')],'body':_0x3fb12c[_0x478b('0xb')],'from':_0xaafaf6['senderString']||_0xaafaf6[_0x478b('0x20')]}]};var _0x41cd7b=util[_0x478b('0x42')](_0x478b('0x43'),_0xaafaf6['username'],_0xaafaf6[_0x478b('0x2e')]);var _0x23de52={'method':_0x478b('0x36'),'uri':_0x478b('0x44'),'body':_0x17390e,'headers':{'Authorization':util['format'](_0x478b('0x45'),new Buffer(_0x41cd7b)[_0x478b('0x46')]('base64'))},'json':!![]};rp(_0x23de52)['then'](function(_0x4a3cd7){if(_0x4a3cd7[_0x478b('0x47')]>=0xc8&&_0x4a3cd7['http_code']<=0xce){if(_0x4a3cd7['data']&&_0x4a3cd7[_0x478b('0x48')][_0x478b('0x49')]>0x0){var _0x2323ae=_[_0x478b('0x4a')](_0x4a3cd7['data'][_0x478b('0x21')]);var _0x575e2b={'messageId':_0x2323ae[_0x478b('0x4b')]};if(!_0xaafaf6['deliveryReport']){_0x575e2b['read']=!![];}return _0xaf3e8d[_0x478b('0x16')](_0x575e2b);}else{logger[_0x478b('0x18')](_0x478b('0x28'),'afterCreate',_0x478b('0x4c'),util[_0x478b('0x29')](_0x4a3cd7,{'showHidden':![],'depth':null}));}}else{logger[_0x478b('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x478b('0x2a'),_0x478b('0x4c'),util[_0x478b('0x29')](_0x4a3cd7,{'showHidden':![],'depth':null}));}})[_0x478b('0x27')](function(_0x3f3798){logger[_0x478b('0x18')](_0x478b('0x28'),'afterCreate',_0x478b('0x4c'),util[_0x478b('0x29')](_0x3f3798,{'showHidden':![],'depth':null}));});}else{logger[_0x478b('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x478b('0x2a'),'clickSend',_0x478b('0x3c'));}break;case _0x478b('0x4d'):if(_0xaafaf6[_0x478b('0x4e')]&&_0xaafaf6[_0x478b('0x1f')]){var _0x17390e={'dst':_0x3fb12c[_0x478b('0x20')],'text':_0x3fb12c[_0x478b('0xb')],'src':_0xaafaf6[_0x478b('0x3e')]||_0xaafaf6[_0x478b('0x20')],'url':_0xaafaf6[_0x478b('0x23')]+_0x478b('0x24')+_0x3fb12c['id']+_0x478b('0x4f')+_0xaafaf6[_0x478b('0x25')]};var _0x41cd7b=util['format'](_0x478b('0x43'),_0xaafaf6[_0x478b('0x4e')],_0xaafaf6[_0x478b('0x1f')]);var _0x23de52={'method':'POST','uri':util['format'](_0x478b('0x50'),_0xaafaf6[_0x478b('0x4e')]),'body':_0x17390e,'headers':{'Authorization':util[_0x478b('0x42')]('Basic\x20%s',new Buffer(_0x41cd7b)[_0x478b('0x46')](_0x478b('0x51')))},'json':!![]};rp(_0x23de52)[_0x478b('0x15')](function(_0xc87098){var _0x143e67={'messageId':_0xc87098[_0x478b('0x52')][0x0]};return _0xaf3e8d[_0x478b('0x16')](_0x143e67);})['catch'](function(_0x1b5775){logger[_0x478b('0x18')](_0x478b('0x28'),_0x478b('0x2a'),_0x478b('0x4d'),util[_0x478b('0x29')](_0x1b5775,{'showHidden':![],'depth':null}));});}else{logger[_0x478b('0x18')](_0x478b('0x28'),_0x478b('0x2a'),_0x478b('0x4d'),_0x478b('0x53'));}break;case _0x478b('0x54'):if(_0xaafaf6[_0x478b('0x32')]&&_0xaafaf6[_0x478b('0x2e')]){if(_0xaafaf6[_0x478b('0x55')]){var _0x4cfce3={'method':'POST','uri':_0xaafaf6['baseUrl']+_0x478b('0x56'),'body':{'username':_0xaafaf6['username'],'password':_0xaafaf6[_0x478b('0x2e')]},'json':!![]};return rp(_0x4cfce3)[_0x478b('0x15')](function(_0x1ad706){var _0x42444c={'method':'POST','uri':_0xaafaf6[_0x478b('0x55')]+_0x478b('0x57'),'body':{'messages':[{'from':_0xaafaf6[_0x478b('0x20')],'destinations':[{'to':_0x3fb12c[_0x478b('0x20')]}],'text':_0x3fb12c[_0x478b('0xb')],'notifyUrl':_0xaafaf6[_0x478b('0x23')]+_0x478b('0x24')+_0x3fb12c['id']+'/status?token='+_0xaafaf6[_0x478b('0x25')],'notifyContentType':_0x478b('0x58'),'callbackData':_0xaafaf6['phone']+';'+_0x3fb12c[_0x478b('0xb')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x1ad706['token']},'json':!![]};return rp(_0x42444c)[_0x478b('0x15')](function(_0x1ef42c){if(_0x1ef42c[_0x478b('0x21')]){var _0x4c48ad={'messageId':_0x1ef42c[_0x478b('0x21')][0x0][_0x478b('0xa')]};if(!_0xaafaf6[_0x478b('0x3a')]){_0x4c48ad[_0x478b('0x3b')]=!![];}return _0xaf3e8d[_0x478b('0x16')](_0x4c48ad);}else{return logger[_0x478b('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x478b('0x2a'),_0x478b('0x54'),util[_0x478b('0x29')](_0x1ef42c,{'showHidden':![],'depth':null}));}});})[_0x478b('0x27')](function(_0x2d6e53){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x478b('0x2a'),_0x478b('0x54'),util[_0x478b('0x29')](_0x2d6e53,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x478b('0x28'),_0x478b('0x2a'),_0x478b('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x478b('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x478b('0x59'):var _0x5c1e8a=require('crypto');if(_0xaafaf6['apiKey']){var _0xd97560={};_0xd97560[_0x478b('0x5a')]=_0xaafaf6[_0x478b('0x32')];_0xd97560['phone']=_0x3fb12c[_0x478b('0x20')];_0xd97560[_0x478b('0x30')]=_0xaafaf6['phone'];_0xd97560[_0x478b('0x5b')]=_0x3fb12c['body'];_0xd97560['timestamp']=+new Date();var _0x59e964='';var _0x5585e9='';var _0x1a2732=Object[_0x478b('0x5c')](_0xd97560);_0x1a2732[_0x478b('0x5d')]();for(var _0x4c7d45=0x0;_0x4c7d45<_0x1a2732[_0x478b('0x5e')];_0x4c7d45++){if(_0x59e964!=''){_0x59e964+='&';}_0x59e964+=_0x1a2732[_0x4c7d45]+'='+encodeURIComponent(_0xd97560[_0x1a2732[_0x4c7d45]]);_0x5585e9+=_0xd97560[_0x1a2732[_0x4c7d45]];}_0x5585e9+=_0xaafaf6[_0x478b('0x5f')];_0x5585e9=_0x5c1e8a['createHash'](_0x478b('0x60'))[_0x478b('0x16')](_0x5585e9)['digest']('hex');if(_0x59e964!==''){_0x59e964+='&';}_0x59e964+=_0x478b('0x61')+_0x5585e9;var _0x4a00fd={'method':_0x478b('0x33'),'uri':_0xaafaf6[_0x478b('0x55')]+'/external/get/send.php?'+_0x59e964,'json':!![]};return rp(_0x4a00fd)[_0x478b('0x15')](function(_0x29fd49){var _0x5b1b1f=Object[_0x478b('0x5c')](_0x29fd49);if(_0x29fd49[_0x5b1b1f[0x0]][_0x478b('0x18')]&&parseInt(_0x29fd49[_0x5b1b1f[0x0]][_0x478b('0x18')])===0x0){var _0x5646b8={'messageId':_0x29fd49[_0x5b1b1f[0x0]][_0x478b('0x62')]};if(!_0xaafaf6[_0x478b('0x3a')]){_0x5646b8[_0x478b('0x3b')]=!![];}return _0xaf3e8d[_0x478b('0x16')](_0x5646b8);}else{return logger[_0x478b('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x478b('0x2a'),_0x478b('0x59'),util['inspect'](_0x29fd49[_0x478b('0x18')],{'showHidden':![],'depth':null}));}})[_0x478b('0x27')](function(_0xb849d5){return logger['error'](_0x478b('0x28'),_0x478b('0x2a'),'csc',util['inspect'](_0xb849d5,{'showHidden':![],'depth':null}));});}else{logger[_0x478b('0x18')](_0x478b('0x28'),'afterCreate','csc',_0x478b('0x63'));}break;case _0x478b('0x64'):if(_0xaafaf6[_0x478b('0x5f')]){var _0x484402={'method':_0x478b('0x36'),'uri':_0x478b('0x65'),'headers':{'Authorization':_0xaafaf6[_0x478b('0x5f')]},'body':{'content':_0x3fb12c[_0x478b('0xb')],'to':[_0x3fb12c['phone']],'from':_0xaafaf6[_0x478b('0x20')],'binary':![],'clientMessageId':_0x478b('0x66'),'charset':_0x478b('0x67')},'json':!![]};rp(_0x484402)[_0x478b('0x15')](function(_0x543c61){if(!_0x543c61[_0x478b('0x18')]){var _0x38b433={'messageId':_0x543c61['messages'][0x0][_0x478b('0x68')]};if(!_0xaafaf6[_0x478b('0x3a')]){_0x38b433[_0x478b('0x3b')]=!![];}return _0xaf3e8d[_0x478b('0x16')](_0x38b433);}else{return logger[_0x478b('0x18')](_0x478b('0x28'),'afterCreate',_0x478b('0x64'),util[_0x478b('0x29')](_0x543c61[_0x478b('0x18')],{'showHidden':![],'depth':null}));}})[_0x478b('0x27')](function(_0x5178a1){return logger[_0x478b('0x18')](_0x478b('0x28'),_0x478b('0x2a'),'clickatell',util[_0x478b('0x29')](_0x5178a1,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x478b('0x2a'),_0x478b('0x64'),_0x478b('0x63'));}break;case _0x478b('0x69'):if(_0xaafaf6[_0x478b('0x32')]&&_0xaafaf6[_0x478b('0x2e')]){var _0x41cd7b=util[_0x478b('0x42')]('%s:%s',_0xaafaf6[_0x478b('0x32')],_0xaafaf6[_0x478b('0x2e')]);var _0x23de52={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0xaafaf6[_0x478b('0x6a')]+'/messages','body':{'to':[_0x3fb12c[_0x478b('0x20')]],'text':_0x3fb12c[_0x478b('0xb')],'from':_0xaafaf6[_0x478b('0x20')],'applicationId':_0xaafaf6['applicationId']},'headers':{'Authorization':util[_0x478b('0x42')]('Basic\x20%s',new Buffer(_0x41cd7b)[_0x478b('0x46')](_0x478b('0x51')))},'json':!![]};rp(_0x23de52)['then'](function(_0x375f1c){if(_0x375f1c['id']){var _0x348d1a={'messageId':_0x375f1c['id']};return _0xaf3e8d[_0x478b('0x16')](_0x348d1a);}else{logger[_0x478b('0x18')](_0x478b('0x28'),'afterCreate',_0x478b('0x69'),util['inspect'](_0x375f1c,{'showHidden':![],'depth':null}));}})[_0x478b('0x27')](function(_0x19ef0a){logger[_0x478b('0x18')](_0x478b('0x28'),_0x478b('0x2a'),_0x478b('0x69'),util['inspect'](_0x19ef0a,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',_0x478b('0x3c'));}break;case _0x478b('0x6b'):if(_0xaafaf6[_0x478b('0x5f')]){var _0x221975={};var _0x4a00fd={'method':_0x478b('0x36'),'uri':_0x478b('0x6c'),'headers':{'Authorization':_0x478b('0x6d')+_0xaafaf6[_0x478b('0x5f')],'Content-Type':_0x478b('0x58')},'body':{'from':_0xaafaf6[_0x478b('0x20')],'to':_0x3fb12c[_0x478b('0x20')],'text':_0x3fb12c[_0x478b('0xb')]},'json':!![]};return rp(_0x4a00fd)['then'](function(_0x203893){if(_0x203893['code']==0xca){_0x221975[_0x478b('0x6e')]=_0x203893;var _0x4041a2={'method':_0x478b('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0xaafaf6[_0x478b('0x5f')],'Content-Type':_0x478b('0x58')},'body':{'refid':_0x221975[_0x478b('0x6e')]['refid']},'json':!![]};return rp(_0x4041a2)['then'](function(_0x2dde57){_0x221975[_0x478b('0x6f')]=_0x2dde57;var _0x40417d={'messageId':_0x221975[_0x478b('0x6e')][_0x478b('0x70')],'read':!![]};return _0xaf3e8d[_0x478b('0x16')](_0x40417d);});}else{return logger[_0x478b('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x478b('0x2a'),_0x478b('0x6b'),util[_0x478b('0x29')](_0x203893,{'showHidden':![],'depth':null}));}})[_0x478b('0x27')](function(_0x15704e){return logger[_0x478b('0x18')](_0x478b('0x28'),_0x478b('0x2a'),'intelepeer',util[_0x478b('0x29')](_0x15704e,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x478b('0x28'),_0x478b('0x2a'),_0x478b('0x6b'),_0x478b('0x71'));}break;}}})[_0x478b('0x72')](function(){_0x2ffb34();});}else{_0x2ffb34();}}},'charset':_0x478b('0x73'),'collate':_0x478b('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index afb773a..dc0ad84 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 _0x2369=['defaults','localhost','socket.io-emitter','./smsMessage.socket','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','create','body','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x35a1d1,_0x494ff4){var _0x49595f=function(_0x5d7fca){while(--_0x5d7fca){_0x35a1d1['push'](_0x35a1d1['shift']());}};_0x49595f(++_0x494ff4);}(_0x2369,0xb3));var _0x9236=function(_0x541f52,_0x2551b2){_0x541f52=_0x541f52-0x0;var _0x57d9e4=_0x2369[_0x541f52];return _0x57d9e4;};'use strict';var _=require(_0x9236('0x0'));var util=require(_0x9236('0x1'));var moment=require(_0x9236('0x2'));var BPromise=require(_0x9236('0x3'));var rs=require(_0x9236('0x4'));var fs=require('fs');var Redis=require(_0x9236('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9236('0x6'));var logger=require(_0x9236('0x7'))(_0x9236('0x8'));var config=require(_0x9236('0x9'));var jayson=require(_0x9236('0xa'));var client=jayson[_0x9236('0xb')]['http']({'port':0x232a});config[_0x9236('0xc')]=_[_0x9236('0xd')](config[_0x9236('0xc')],{'host':_0x9236('0xe'),'port':0x18eb});var socket=require(_0x9236('0xf'))(new Redis(config[_0x9236('0xc')]));require(_0x9236('0x10'))['register'](socket);function respondWithRpcPromise(_0x54c7a7,_0x309db5,_0x164a4f){return new BPromise(function(_0x51e04e,_0x81f229){return client['request'](_0x54c7a7,_0x164a4f)[_0x9236('0x11')](function(_0x2ee70e){logger[_0x9236('0x12')](_0x9236('0x13'),_0x309db5,_0x9236('0x14'));logger[_0x9236('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x309db5,'request\x20sent',JSON[_0x9236('0x16')](_0x2ee70e));if(_0x2ee70e['error']){if(_0x2ee70e['error'][_0x9236('0x17')]===0x1f4){logger[_0x9236('0x18')](_0x9236('0x13'),_0x309db5,_0x2ee70e['error'][_0x9236('0x19')]);return _0x81f229(_0x2ee70e[_0x9236('0x18')][_0x9236('0x19')]);}logger['error'](_0x9236('0x13'),_0x309db5,_0x2ee70e[_0x9236('0x18')][_0x9236('0x19')]);return _0x51e04e(_0x2ee70e[_0x9236('0x18')][_0x9236('0x19')]);}else{logger[_0x9236('0x12')](_0x9236('0x13'),_0x309db5,_0x9236('0x14'));_0x51e04e(_0x2ee70e['result'][_0x9236('0x19')]);}})[_0x9236('0x1a')](function(_0x4458cb){logger[_0x9236('0x18')](_0x9236('0x13'),_0x309db5,_0x4458cb);_0x81f229(_0x4458cb);});});}exports['CreateSmsMessage']=function(_0x55565a){var _0x327156=this;return new Promise(function(_0x219aac,_0x5a2978){return db['SmsMessage'][_0x9236('0x1b')](_0x55565a[_0x9236('0x1c')],{'raw':_0x55565a[_0x9236('0x1d')]?_0x55565a[_0x9236('0x1d')][_0x9236('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x517d2a){logger[_0x9236('0x12')]('CreateSmsMessage',_0x55565a);logger[_0x9236('0x15')](_0x9236('0x1f'),_0x55565a,JSON[_0x9236('0x16')](_0x517d2a));_0x219aac(_0x517d2a);})[_0x9236('0x1a')](function(_0x232bf4){logger[_0x9236('0x18')](_0x9236('0x1f'),_0x232bf4[_0x9236('0x19')],_0x55565a);_0x5a2978(_0x327156[_0x9236('0x18')](0x1f4,_0x232bf4[_0x9236('0x19')]));});});}; \ No newline at end of file +var _0x0876=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateSmsMessage','SmsMessage','create','body','options','raw'];(function(_0xd8825e,_0x178280){var _0x5eb3fa=function(_0xfd9ffd){while(--_0xfd9ffd){_0xd8825e['push'](_0xd8825e['shift']());}};_0x5eb3fa(++_0x178280);}(_0x0876,0xe7));var _0x6087=function(_0x167985,_0x440a09){_0x167985=_0x167985-0x0;var _0x3b1070=_0x0876[_0x167985];return _0x3b1070;};'use strict';var _=require(_0x6087('0x0'));var util=require('util');var moment=require(_0x6087('0x1'));var BPromise=require(_0x6087('0x2'));var rs=require(_0x6087('0x3'));var fs=require('fs');var Redis=require(_0x6087('0x4'));var db=require(_0x6087('0x5'))['db'];var utils=require(_0x6087('0x6'));var logger=require(_0x6087('0x7'))(_0x6087('0x8'));var config=require('../../config/environment');var jayson=require(_0x6087('0x9'));var client=jayson[_0x6087('0xa')][_0x6087('0xb')]({'port':0x232a});config[_0x6087('0xc')]=_['defaults'](config[_0x6087('0xc')],{'host':_0x6087('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6087('0xc')]));require(_0x6087('0xe'))[_0x6087('0xf')](socket);function respondWithRpcPromise(_0x598d14,_0x3eddba,_0x5b5cb){return new BPromise(function(_0x106181,_0x53b3b2){return client[_0x6087('0x10')](_0x598d14,_0x5b5cb)[_0x6087('0x11')](function(_0x3696d7){logger['info'](_0x6087('0x12'),_0x3eddba,_0x6087('0x13'));logger[_0x6087('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3eddba,'request\x20sent',JSON[_0x6087('0x15')](_0x3696d7));if(_0x3696d7[_0x6087('0x16')]){if(_0x3696d7[_0x6087('0x16')][_0x6087('0x17')]===0x1f4){logger[_0x6087('0x16')](_0x6087('0x12'),_0x3eddba,_0x3696d7[_0x6087('0x16')][_0x6087('0x18')]);return _0x53b3b2(_0x3696d7['error']['message']);}logger['error'](_0x6087('0x12'),_0x3eddba,_0x3696d7[_0x6087('0x16')][_0x6087('0x18')]);return _0x106181(_0x3696d7[_0x6087('0x16')]['message']);}else{logger[_0x6087('0x19')](_0x6087('0x12'),_0x3eddba,_0x6087('0x13'));_0x106181(_0x3696d7['result'][_0x6087('0x18')]);}})[_0x6087('0x1a')](function(_0x36695f){logger['error'](_0x6087('0x12'),_0x3eddba,_0x36695f);_0x53b3b2(_0x36695f);});});}exports[_0x6087('0x1b')]=function(_0x25fb1c){var _0x6d657f=this;return new Promise(function(_0x456746,_0x500c63){return db[_0x6087('0x1c')][_0x6087('0x1d')](_0x25fb1c[_0x6087('0x1e')],{'raw':_0x25fb1c['options']?_0x25fb1c[_0x6087('0x1f')][_0x6087('0x20')]===undefined?!![]:![]:!![]})[_0x6087('0x11')](function(_0x5f398b){logger[_0x6087('0x19')]('CreateSmsMessage',_0x25fb1c);logger[_0x6087('0x14')]('CreateSmsMessage',_0x25fb1c,JSON[_0x6087('0x15')](_0x5f398b));_0x456746(_0x5f398b);})[_0x6087('0x1a')](function(_0x4310a3){logger[_0x6087('0x16')](_0x6087('0x1b'),_0x4310a3['message'],_0x25fb1c);_0x500c63(_0x6d657f[_0x6087('0x16')](0x1f4,_0x4310a3[_0x6087('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c05892e..275639f 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 _0xa8a1=['removeListener','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x4b51fc,_0x4905d9){var _0x1bf5ae=function(_0xe4d48){while(--_0xe4d48){_0x4b51fc['push'](_0x4b51fc['shift']());}};_0x1bf5ae(++_0x4905d9);}(_0xa8a1,0x12f));var _0x1a8a=function(_0x44edc6,_0xd6d6ef){_0x44edc6=_0x44edc6-0x0;var _0x24be45=_0xa8a1[_0x44edc6];return _0x24be45;};'use strict';var SmsMessageEvents=require(_0x1a8a('0x0'));var events=['save',_0x1a8a('0x1'),_0x1a8a('0x2')];function createListener(_0x32f982,_0x420c51){return function(_0x3c51b7){_0x420c51['emit'](_0x32f982,_0x3c51b7);};}function removeListener(_0x45da86,_0xfcf834){return function(){SmsMessageEvents[_0x1a8a('0x3')](_0x45da86,_0xfcf834);};}exports['register']=function(_0xe0187){for(var _0x3dc3b7=0x0,_0x27eac5=events[_0x1a8a('0x4')];_0x3dc3b7<_0x27eac5;_0x3dc3b7++){var _0x1887b8=events[_0x3dc3b7];var _0x32c69c=createListener(_0x1a8a('0x5')+_0x1887b8,_0xe0187);SmsMessageEvents['on'](_0x1887b8,_0x32c69c);}}; \ No newline at end of file +var _0xeadc=['./smsMessage.events','save','remove','removeListener'];(function(_0x4f9b1d,_0x243cac){var _0x107856=function(_0x53c409){while(--_0x53c409){_0x4f9b1d['push'](_0x4f9b1d['shift']());}};_0x107856(++_0x243cac);}(_0xeadc,0x140));var _0xcead=function(_0x36f7ce,_0x1e0b8e){_0x36f7ce=_0x36f7ce-0x0;var _0x28a01d=_0xeadc[_0x36f7ce];return _0x28a01d;};'use strict';var SmsMessageEvents=require(_0xcead('0x0'));var events=[_0xcead('0x1'),_0xcead('0x2'),'update'];function createListener(_0x967ae6,_0x2351ed){return function(_0x213dd6){_0x2351ed['emit'](_0x967ae6,_0x213dd6);};}function removeListener(_0xe1233a,_0x1bb39f){return function(){SmsMessageEvents[_0xcead('0x3')](_0xe1233a,_0x1bb39f);};}exports['register']=function(_0x5de9c9){for(var _0x15678f=0x0,_0x36746b=events['length'];_0x15678f<_0x36746b;_0x15678f++){var _0x38034c=events[_0x15678f];var _0x2d037f=createListener('smsMessage:'+_0x38034c,_0x5de9c9);SmsMessageEvents['on'](_0x38034c,_0x2d037f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 0733a53..a21197d 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 _0xb6f0=['express','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','create','post','/:id/teams','addTeams','delete','removeAgents','exports','util','path','connect-timeout'];(function(_0xaeb10d,_0x40cc24){var _0x356997=function(_0x37d75e){while(--_0x37d75e){_0xaeb10d['push'](_0xaeb10d['shift']());}};_0x356997(++_0x40cc24);}(_0xb6f0,0x9e));var _0x0b6f=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0xb6f0[_0x36f47c];return _0x296c55;};'use strict';var multer=require('multer');var util=require(_0x0b6f('0x0'));var path=require(_0x0b6f('0x1'));var timeout=require(_0x0b6f('0x2'));var express=require(_0x0b6f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0b6f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0b6f('0x5'));var controller=require(_0x0b6f('0x6'));router[_0x0b6f('0x7')]('/',auth[_0x0b6f('0x8')](),controller['index']);router['get']('/describe',auth[_0x0b6f('0x8')](),controller[_0x0b6f('0x9')]);router['get'](_0x0b6f('0xa'),auth[_0x0b6f('0x8')](),controller[_0x0b6f('0xb')]);router[_0x0b6f('0x7')](_0x0b6f('0xc'),auth[_0x0b6f('0x8')](),controller[_0x0b6f('0xd')]);router[_0x0b6f('0x7')]('/:id/teams',auth[_0x0b6f('0x8')](),controller[_0x0b6f('0xe')]);router[_0x0b6f('0x7')](_0x0b6f('0xf'),auth[_0x0b6f('0x8')](),controller['getAgents']);router['post']('/',auth[_0x0b6f('0x8')](),controller[_0x0b6f('0x10')]);router[_0x0b6f('0x11')](_0x0b6f('0x12'),auth[_0x0b6f('0x8')](),controller[_0x0b6f('0x13')]);router[_0x0b6f('0x11')]('/:id/users',auth[_0x0b6f('0x8')](),controller['addAgents']);router['put'](_0x0b6f('0xa'),auth[_0x0b6f('0x8')](),controller['update']);router[_0x0b6f('0x14')](_0x0b6f('0xa'),auth[_0x0b6f('0x8')](),controller['destroy']);router['delete'](_0x0b6f('0x12'),auth[_0x0b6f('0x8')](),controller['removeTeams']);router[_0x0b6f('0x14')](_0x0b6f('0xf'),auth['isAuthenticated'](),controller[_0x0b6f('0x15')]);module[_0x0b6f('0x16')]=router; \ No newline at end of file +var _0x284e=['/:id','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put'];(function(_0x4a788f,_0x4e7502){var _0x5aa145=function(_0x3f4a48){while(--_0x3f4a48){_0x4a788f['push'](_0x4a788f['shift']());}};_0x5aa145(++_0x4e7502);}(_0x284e,0x17b));var _0xe284=function(_0x2873cd,_0x55116b){_0x2873cd=_0x2873cd-0x0;var _0x51599a=_0x284e[_0x2873cd];return _0x51599a;};'use strict';var multer=require('multer');var util=require(_0xe284('0x0'));var path=require(_0xe284('0x1'));var timeout=require(_0xe284('0x2'));var express=require(_0xe284('0x3'));var router=express[_0xe284('0x4')]();var fs_extra=require(_0xe284('0x5'));var auth=require(_0xe284('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe284('0x7'));var controller=require(_0xe284('0x8'));router[_0xe284('0x9')]('/',auth[_0xe284('0xa')](),controller['index']);router['get'](_0xe284('0xb'),auth[_0xe284('0xa')](),controller[_0xe284('0xc')]);router[_0xe284('0x9')]('/:id',auth[_0xe284('0xa')](),controller[_0xe284('0xd')]);router['get'](_0xe284('0xe'),auth[_0xe284('0xa')](),controller['getMembers']);router['get'](_0xe284('0xf'),auth[_0xe284('0xa')](),controller[_0xe284('0x10')]);router[_0xe284('0x9')](_0xe284('0x11'),auth['isAuthenticated'](),controller[_0xe284('0x12')]);router[_0xe284('0x13')]('/',auth[_0xe284('0xa')](),controller[_0xe284('0x14')]);router['post']('/:id/teams',auth[_0xe284('0xa')](),controller[_0xe284('0x15')]);router[_0xe284('0x13')](_0xe284('0x11'),auth[_0xe284('0xa')](),controller[_0xe284('0x16')]);router[_0xe284('0x17')](_0xe284('0x18'),auth[_0xe284('0xa')](),controller[_0xe284('0x19')]);router[_0xe284('0x1a')](_0xe284('0x18'),auth[_0xe284('0xa')](),controller[_0xe284('0x1b')]);router['delete'](_0xe284('0xf'),auth[_0xe284('0xa')](),controller[_0xe284('0x1c')]);router[_0xe284('0x1a')]('/:id/users',auth[_0xe284('0xa')](),controller[_0xe284('0x1d')]);module[_0xe284('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index b480e74..e1a8c34 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 _0x8f3d=['INTEGER','sequelize','exports','STRING'];(function(_0x50b7ce,_0x2ba6f7){var _0xbc4933=function(_0x1b28f9){while(--_0x1b28f9){_0x50b7ce['push'](_0x50b7ce['shift']());}};_0xbc4933(++_0x2ba6f7);}(_0x8f3d,0xc5));var _0xd8f3=function(_0x559885,_0x3e5b71){_0x559885=_0x559885-0x0;var _0x3ceca7=_0x8f3d[_0x559885];return _0x3ceca7;};'use strict';var Sequelize=require(_0xd8f3('0x0'));module[_0xd8f3('0x1')]={'name':{'type':Sequelize[_0xd8f3('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd8f3('0x2')]},'timeout':{'type':Sequelize[_0xd8f3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0xfcb3=['name','INTEGER','ENUM','roundrobin','STRING'];(function(_0x1af3f5,_0x3c7a6b){var _0x5ce823=function(_0x518aa9){while(--_0x518aa9){_0x1af3f5['push'](_0x1af3f5['shift']());}};_0x5ce823(++_0x3c7a6b);}(_0xfcb3,0x1b7));var _0x3fcb=function(_0x34e9a7,_0x3a819f){_0x34e9a7=_0x34e9a7-0x0;var _0x380c4f=_0xfcb3[_0x34e9a7];return _0x380c4f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3fcb('0x0')],'unique':_0x3fcb('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3fcb('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3fcb('0x3')]('rrmemory','beepall',_0x3fcb('0x4'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 2a5e585..aca2519 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 _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xadb5,0xad));var _0x5adb=function(_0x11a62f,_0x152168){_0x11a62f=_0x11a62f-0x0;var _0x2c86e2=_0xadb5[_0x11a62f];return _0x2c86e2;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file +var _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x3239f5,_0x50e77c){var _0x3559c8=function(_0x4f9f83){while(--_0x4f9f83){_0x3239f5['push'](_0x3239f5['shift']());}};_0x3559c8(++_0x50e77c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index d56b336..9c3e649 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 _0x621d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','SmsQueue'];(function(_0x29fe73,_0x35ff1b){var _0x500a23=function(_0x4dd14e){while(--_0x4dd14e){_0x29fe73['push'](_0x29fe73['shift']());}};_0x500a23(++_0x35ff1b);}(_0x621d,0x10c));var _0xd621=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x621d[_0x54d4fe];return _0x1ab5bb;};'use strict';var EventEmitter=require(_0xd621('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xd621('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd621('0x2')](0x0);var events={'afterCreate':_0xd621('0x3'),'afterUpdate':_0xd621('0x4'),'afterDestroy':_0xd621('0x5')};function emitEvent(_0x3c7178){return function(_0x229f05,_0x2d39a7,_0x386eb3){SmsQueueEvents['emit'](_0x3c7178+':'+_0x229f05['id'],_0x229f05);SmsQueueEvents[_0xd621('0x6')](_0x3c7178,_0x229f05);_0x386eb3(null);};}for(var e in events){if(events[_0xd621('0x7')](e)){var event=events[e];SmsQueue[_0xd621('0x8')](e,emitEvent(event));}}module[_0xd621('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x8c15=['events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x5c5e9b,_0x5ebec1){var _0x128162=function(_0x47fc01){while(--_0x47fc01){_0x5c5e9b['push'](_0x5c5e9b['shift']());}};_0x128162(++_0x5ebec1);}(_0x8c15,0x136));var _0x58c1=function(_0x2eae1f,_0xb6c1f4){_0x2eae1f=_0x2eae1f-0x0;var _0x3a1e92=_0x8c15[_0x2eae1f];return _0x3a1e92;};'use strict';var EventEmitter=require(_0x58c1('0x0'));var SmsQueue=require(_0x58c1('0x1'))['db'][_0x58c1('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x58c1('0x3')](0x0);var events={'afterCreate':_0x58c1('0x4'),'afterUpdate':_0x58c1('0x5'),'afterDestroy':_0x58c1('0x6')};function emitEvent(_0x3651ae){return function(_0x418b8c,_0x38cc81,_0x353a03){SmsQueueEvents[_0x58c1('0x7')](_0x3651ae+':'+_0x418b8c['id'],_0x418b8c);SmsQueueEvents[_0x58c1('0x7')](_0x3651ae,_0x418b8c);_0x353a03(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x58c1('0x8')](e,emitEvent(event));}}module[_0x58c1('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index a97c86a..ca9e97c 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 _0xe319=['sms_queues','util','../../config/logger','api','moment','request-promise','rimraf','./smsQueue.attributes','exports','SmsQueue'];(function(_0x4c5708,_0x34b1f9){var _0x37fa9b=function(_0x534dc4){while(--_0x534dc4){_0x4c5708['push'](_0x4c5708['shift']());}};_0x37fa9b(++_0x34b1f9);}(_0xe319,0x10f));var _0x9e31=function(_0x27404d,_0xe78b9b){_0x27404d=_0x27404d-0x0;var _0x14e0bc=_0xe319[_0x27404d];return _0x14e0bc;};'use strict';var _=require('lodash');var util=require(_0x9e31('0x0'));var logger=require(_0x9e31('0x1'))(_0x9e31('0x2'));var moment=require(_0x9e31('0x3'));var BPromise=require('bluebird');var rp=require(_0x9e31('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e31('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e31('0x6'));module[_0x9e31('0x7')]=function(_0x5a7df7,_0xc3f587){return _0x5a7df7['define'](_0x9e31('0x8'),attributes,{'tableName':_0x9e31('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c9a=['moment','bluebird','request-promise','path','rimraf','define','SmsQueue','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c9a,0xd7));var _0xa7c9=function(_0x32a8a8,_0x340cd5){_0x32a8a8=_0x32a8a8-0x0;var _0x25837c=_0x7c9a[_0x32a8a8];return _0x25837c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa7c9('0x0'));var moment=require(_0xa7c9('0x1'));var BPromise=require(_0xa7c9('0x2'));var rp=require(_0xa7c9('0x3'));var fs=require('fs');var path=require(_0xa7c9('0x4'));var rimraf=require(_0xa7c9('0x5'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module['exports']=function(_0x14090e,_0x18c8b8){return _0x14090e[_0xa7c9('0x6')](_0xa7c9('0x7'),attributes,{'tableName':'sms_queues','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 f3fe94b..babca1e 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 _0x622e=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','debug','stringify','ShowSmsQueue','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x521bcb,_0x9c35d5){var _0x1400da=function(_0x4e0824){while(--_0x4e0824){_0x521bcb['push'](_0x521bcb['shift']());}};_0x1400da(++_0x9c35d5);}(_0x622e,0x92));var _0xe622=function(_0xe59443,_0x1c7fbc){_0xe59443=_0xe59443-0x0;var _0x155142=_0x622e[_0xe59443];return _0x155142;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe622('0x0'));var BPromise=require(_0xe622('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe622('0x2'));var db=require(_0xe622('0x3'))['db'];var utils=require(_0xe622('0x4'));var logger=require(_0xe622('0x5'))(_0xe622('0x6'));var config=require(_0xe622('0x7'));var jayson=require(_0xe622('0x8'));var client=jayson[_0xe622('0x9')][_0xe622('0xa')]({'port':0x232a});config[_0xe622('0xb')]=_[_0xe622('0xc')](config[_0xe622('0xb')],{'host':_0xe622('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')[_0xe622('0xe')](socket);function respondWithRpcPromise(_0x281ffe,_0x285aba,_0x57f34e){return new BPromise(function(_0xddc60,_0x32eb42){return client[_0xe622('0xf')](_0x281ffe,_0x57f34e)['then'](function(_0x1e64a2){logger[_0xe622('0x10')](_0xe622('0x11'),_0x285aba,_0xe622('0x12'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x285aba,'request\x20sent',JSON['stringify'](_0x1e64a2));if(_0x1e64a2[_0xe622('0x13')]){if(_0x1e64a2[_0xe622('0x13')][_0xe622('0x14')]===0x1f4){logger[_0xe622('0x13')](_0xe622('0x11'),_0x285aba,_0x1e64a2[_0xe622('0x13')][_0xe622('0x15')]);return _0x32eb42(_0x1e64a2['error'][_0xe622('0x15')]);}logger[_0xe622('0x13')](_0xe622('0x11'),_0x285aba,_0x1e64a2['error']['message']);return _0xddc60(_0x1e64a2[_0xe622('0x13')][_0xe622('0x15')]);}else{logger[_0xe622('0x10')](_0xe622('0x11'),_0x285aba,_0xe622('0x12'));_0xddc60(_0x1e64a2[_0xe622('0x16')][_0xe622('0x15')]);}})[_0xe622('0x17')](function(_0x398d81){logger[_0xe622('0x13')](_0xe622('0x11'),_0x285aba,_0x398d81);_0x32eb42(_0x398d81);});});}exports[_0xe622('0x18')]=function(_0x33c69a){var _0x40c84c=this;return new Promise(function(_0x25a80a,_0x3543e1){return db[_0xe622('0x19')][_0xe622('0x1a')]({'raw':_0x33c69a[_0xe622('0x1b')]?_0x33c69a[_0xe622('0x1b')][_0xe622('0x1c')]===undefined?!![]:![]:!![],'where':_0x33c69a[_0xe622('0x1b')]?_0x33c69a[_0xe622('0x1b')][_0xe622('0x1d')]||null:null,'attributes':_0x33c69a[_0xe622('0x1b')]?_0x33c69a[_0xe622('0x1b')]['attributes']||null:null,'limit':_0x33c69a['options']?_0x33c69a[_0xe622('0x1b')][_0xe622('0x1e')]||null:null,'include':_0x33c69a[_0xe622('0x1b')]?_0x33c69a['options'][_0xe622('0x1f')]?_[_0xe622('0x20')](_0x33c69a[_0xe622('0x1b')][_0xe622('0x1f')],function(_0x49ebea){return{'model':db[_0x49ebea[_0xe622('0x21')]],'as':_0x49ebea['as'],'attributes':_0x49ebea[_0xe622('0x22')],'include':_0x49ebea['include']?_[_0xe622('0x20')](_0x49ebea['include'],function(_0x3fdaa8){return{'model':db[_0x3fdaa8[_0xe622('0x21')]],'as':_0x3fdaa8['as'],'attributes':_0x3fdaa8[_0xe622('0x22')],'include':_0x3fdaa8[_0xe622('0x1f')]?_['map'](_0x3fdaa8['include'],function(_0x59c27e){return{'model':db[_0x59c27e[_0xe622('0x21')]],'as':_0x59c27e['as'],'attributes':_0x59c27e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b31b3){logger[_0xe622('0x10')]('GetSmsQueue',_0x33c69a);logger[_0xe622('0x23')](_0xe622('0x18'),_0x33c69a,JSON[_0xe622('0x24')](_0x3b31b3));_0x25a80a(_0x3b31b3);})[_0xe622('0x17')](function(_0x35eabd){logger[_0xe622('0x13')]('GetSmsQueue',_0x35eabd[_0xe622('0x15')],_0x33c69a);_0x3543e1(_0x40c84c[_0xe622('0x13')](0x1f4,_0x35eabd['message']));});});};exports[_0xe622('0x25')]=function(_0x1ccc59){var _0x56d492=this;return new Promise(function(_0xfa96b0,_0x4b2992){return db[_0xe622('0x19')]['find']({'raw':_0x1ccc59[_0xe622('0x1b')]?_0x1ccc59[_0xe622('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1ccc59[_0xe622('0x1b')]?_0x1ccc59[_0xe622('0x1b')][_0xe622('0x1d')]||null:null,'attributes':_0x1ccc59[_0xe622('0x1b')]?_0x1ccc59[_0xe622('0x1b')][_0xe622('0x22')]||null:null,'include':_0x1ccc59[_0xe622('0x1b')]?_0x1ccc59[_0xe622('0x1b')][_0xe622('0x1f')]?_[_0xe622('0x20')](_0x1ccc59[_0xe622('0x1b')][_0xe622('0x1f')],function(_0x2bdeca){return{'model':db[_0x2bdeca[_0xe622('0x21')]],'as':_0x2bdeca['as'],'attributes':_0x2bdeca[_0xe622('0x22')],'include':_0x2bdeca['include']?_[_0xe622('0x20')](_0x2bdeca[_0xe622('0x1f')],function(_0xeb8264){return{'model':db[_0xeb8264['model']],'as':_0xeb8264['as'],'attributes':_0xeb8264[_0xe622('0x22')],'include':_0xeb8264['include']?_['map'](_0xeb8264[_0xe622('0x1f')],function(_0x378fe0){return{'model':db[_0x378fe0[_0xe622('0x21')]],'as':_0x378fe0['as'],'attributes':_0x378fe0[_0xe622('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d3d3d){logger[_0xe622('0x10')]('ShowSmsQueue',_0x1ccc59);logger[_0xe622('0x23')](_0xe622('0x25'),_0x1ccc59,JSON[_0xe622('0x24')](_0x3d3d3d));_0xfa96b0(_0x3d3d3d);})[_0xe622('0x17')](function(_0x5036df){logger[_0xe622('0x13')](_0xe622('0x25'),_0x5036df[_0xe622('0x15')],_0x1ccc59);_0x4b2992(_0x56d492[_0xe622('0x13')](0x1f4,_0x5036df[_0xe622('0x15')]));});});}; \ No newline at end of file +var _0xc569=['request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowSmsQueue','find','then','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x5b3e28,_0x2ad693){var _0x21a6f4=function(_0xea4216){while(--_0xea4216){_0x5b3e28['push'](_0x5b3e28['shift']());}};_0x21a6f4(++_0x2ad693);}(_0xc569,0x1d1));var _0x9c56=function(_0x1ae693,_0x5d93f6){_0x1ae693=_0x1ae693-0x0;var _0x1a15e2=_0xc569[_0x1ae693];return _0x1a15e2;};'use strict';var _=require(_0x9c56('0x0'));var util=require(_0x9c56('0x1'));var moment=require(_0x9c56('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c56('0x3'));var fs=require('fs');var Redis=require(_0x9c56('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c56('0x5'));var logger=require('../../config/logger')(_0x9c56('0x6'));var config=require(_0x9c56('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9c56('0x8')][_0x9c56('0x9')]({'port':0x232a});config['redis']=_[_0x9c56('0xa')](config[_0x9c56('0xb')],{'host':_0x9c56('0xc'),'port':0x18eb});var socket=require(_0x9c56('0xd'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x9c56('0xe')](socket);function respondWithRpcPromise(_0x525eca,_0x4cbcd5,_0x38e6c4){return new BPromise(function(_0x1929c4,_0x1e2daf){return client[_0x9c56('0xf')](_0x525eca,_0x38e6c4)['then'](function(_0x3aaf0e){logger[_0x9c56('0x10')](_0x9c56('0x11'),_0x4cbcd5,_0x9c56('0x12'));logger[_0x9c56('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x4cbcd5,_0x9c56('0x12'),JSON[_0x9c56('0x14')](_0x3aaf0e));if(_0x3aaf0e[_0x9c56('0x15')]){if(_0x3aaf0e[_0x9c56('0x15')][_0x9c56('0x16')]===0x1f4){logger['error'](_0x9c56('0x11'),_0x4cbcd5,_0x3aaf0e[_0x9c56('0x15')][_0x9c56('0x17')]);return _0x1e2daf(_0x3aaf0e[_0x9c56('0x15')]['message']);}logger[_0x9c56('0x15')](_0x9c56('0x11'),_0x4cbcd5,_0x3aaf0e[_0x9c56('0x15')]['message']);return _0x1929c4(_0x3aaf0e[_0x9c56('0x15')][_0x9c56('0x17')]);}else{logger[_0x9c56('0x10')](_0x9c56('0x11'),_0x4cbcd5,_0x9c56('0x12'));_0x1929c4(_0x3aaf0e[_0x9c56('0x18')][_0x9c56('0x17')]);}})[_0x9c56('0x19')](function(_0x5e3678){logger['error'](_0x9c56('0x11'),_0x4cbcd5,_0x5e3678);_0x1e2daf(_0x5e3678);});});}exports[_0x9c56('0x1a')]=function(_0x6d25da){var _0x1e9505=this;return new Promise(function(_0x294427,_0x1c831f){return db[_0x9c56('0x1b')][_0x9c56('0x1c')]({'raw':_0x6d25da[_0x9c56('0x1d')]?_0x6d25da[_0x9c56('0x1d')][_0x9c56('0x1e')]===undefined?!![]:![]:!![],'where':_0x6d25da['options']?_0x6d25da[_0x9c56('0x1d')][_0x9c56('0x1f')]||null:null,'attributes':_0x6d25da['options']?_0x6d25da[_0x9c56('0x1d')][_0x9c56('0x20')]||null:null,'limit':_0x6d25da['options']?_0x6d25da[_0x9c56('0x1d')][_0x9c56('0x21')]||null:null,'include':_0x6d25da[_0x9c56('0x1d')]?_0x6d25da[_0x9c56('0x1d')][_0x9c56('0x22')]?_['map'](_0x6d25da['options']['include'],function(_0x51e458){return{'model':db[_0x51e458[_0x9c56('0x23')]],'as':_0x51e458['as'],'attributes':_0x51e458[_0x9c56('0x20')],'include':_0x51e458[_0x9c56('0x22')]?_['map'](_0x51e458[_0x9c56('0x22')],function(_0xb4cf7e){return{'model':db[_0xb4cf7e['model']],'as':_0xb4cf7e['as'],'attributes':_0xb4cf7e[_0x9c56('0x20')],'include':_0xb4cf7e['include']?_[_0x9c56('0x24')](_0xb4cf7e[_0x9c56('0x22')],function(_0x4e0c8d){return{'model':db[_0x4e0c8d[_0x9c56('0x23')]],'as':_0x4e0c8d['as'],'attributes':_0x4e0c8d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a66d1){logger[_0x9c56('0x10')](_0x9c56('0x1a'),_0x6d25da);logger[_0x9c56('0x13')](_0x9c56('0x1a'),_0x6d25da,JSON[_0x9c56('0x14')](_0x2a66d1));_0x294427(_0x2a66d1);})['catch'](function(_0x5b5723){logger[_0x9c56('0x15')](_0x9c56('0x1a'),_0x5b5723[_0x9c56('0x17')],_0x6d25da);_0x1c831f(_0x1e9505[_0x9c56('0x15')](0x1f4,_0x5b5723[_0x9c56('0x17')]));});});};exports[_0x9c56('0x25')]=function(_0xcd21fd){var _0x1f592b=this;return new Promise(function(_0x741f74,_0x2a9ac5){return db[_0x9c56('0x1b')][_0x9c56('0x26')]({'raw':_0xcd21fd['options']?_0xcd21fd['options'][_0x9c56('0x1e')]===undefined?!![]:![]:!![],'where':_0xcd21fd[_0x9c56('0x1d')]?_0xcd21fd['options'][_0x9c56('0x1f')]||null:null,'attributes':_0xcd21fd[_0x9c56('0x1d')]?_0xcd21fd[_0x9c56('0x1d')]['attributes']||null:null,'include':_0xcd21fd[_0x9c56('0x1d')]?_0xcd21fd[_0x9c56('0x1d')][_0x9c56('0x22')]?_[_0x9c56('0x24')](_0xcd21fd[_0x9c56('0x1d')][_0x9c56('0x22')],function(_0x3f536e){return{'model':db[_0x3f536e[_0x9c56('0x23')]],'as':_0x3f536e['as'],'attributes':_0x3f536e[_0x9c56('0x20')],'include':_0x3f536e[_0x9c56('0x22')]?_[_0x9c56('0x24')](_0x3f536e[_0x9c56('0x22')],function(_0x129bb9){return{'model':db[_0x129bb9[_0x9c56('0x23')]],'as':_0x129bb9['as'],'attributes':_0x129bb9[_0x9c56('0x20')],'include':_0x129bb9['include']?_['map'](_0x129bb9[_0x9c56('0x22')],function(_0x146b7c){return{'model':db[_0x146b7c[_0x9c56('0x23')]],'as':_0x146b7c['as'],'attributes':_0x146b7c[_0x9c56('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9c56('0x27')](function(_0x58a516){logger['info'](_0x9c56('0x25'),_0xcd21fd);logger['debug'](_0x9c56('0x25'),_0xcd21fd,JSON['stringify'](_0x58a516));_0x741f74(_0x58a516);})[_0x9c56('0x19')](function(_0xeaa1dd){logger[_0x9c56('0x15')](_0x9c56('0x25'),_0xeaa1dd[_0x9c56('0x17')],_0xcd21fd);_0x2a9ac5(_0x1f592b[_0x9c56('0x15')](0x1f4,_0xeaa1dd[_0x9c56('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 5db595a..38175ab 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 _0xb1d3=['smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x845d6e,_0x4b66b0){var _0x5a9c1c=function(_0x56b184){while(--_0x56b184){_0x845d6e['push'](_0x845d6e['shift']());}};_0x5a9c1c(++_0x4b66b0);}(_0xb1d3,0x1d5));var _0x3b1d=function(_0x4d9db4,_0x5bb8e9){_0x4d9db4=_0x4d9db4-0x0;var _0x2a7bf4=_0xb1d3[_0x4d9db4];return _0x2a7bf4;};'use strict';var SmsQueueEvents=require(_0x3b1d('0x0'));var events=[_0x3b1d('0x1'),_0x3b1d('0x2'),_0x3b1d('0x3')];function createListener(_0x2953f7,_0x3176ad){return function(_0x2a868a){_0x3176ad[_0x3b1d('0x4')](_0x2953f7,_0x2a868a);};}function removeListener(_0x16480f,_0x365e72){return function(){SmsQueueEvents[_0x3b1d('0x5')](_0x16480f,_0x365e72);};}exports[_0x3b1d('0x6')]=function(_0x48bfba){for(var _0x4b40aa=0x0,_0x38a255=events[_0x3b1d('0x7')];_0x4b40aa<_0x38a255;_0x4b40aa++){var _0x85c346=events[_0x4b40aa];var _0x10b565=createListener(_0x3b1d('0x8')+_0x85c346,_0x48bfba);SmsQueueEvents['on'](_0x85c346,_0x10b565);}}; \ No newline at end of file +var _0x80d7=['length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0xfd9b19,_0x21d75f){var _0x514918=function(_0x52e212){while(--_0x52e212){_0xfd9b19['push'](_0xfd9b19['shift']());}};_0x514918(++_0x21d75f);}(_0x80d7,0x15a));var _0x780d=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0x80d7[_0x48999d];return _0x1ad0d1;};'use strict';var SmsQueueEvents=require(_0x780d('0x0'));var events=[_0x780d('0x1'),_0x780d('0x2'),_0x780d('0x3')];function createListener(_0x316e19,_0x35d6ac){return function(_0xad85a9){_0x35d6ac[_0x780d('0x4')](_0x316e19,_0xad85a9);};}function removeListener(_0x1ae580,_0x8f087c){return function(){SmsQueueEvents[_0x780d('0x5')](_0x1ae580,_0x8f087c);};}exports['register']=function(_0xa7b39c){for(var _0x21567c=0x0,_0x46125=events[_0x780d('0x6')];_0x21567c<_0x46125;_0x21567c++){var _0x3ff9a7=events[_0x21567c];var _0x341619=createListener(_0x780d('0x7')+_0x3ff9a7,_0xa7b39c);SmsQueueEvents['on'](_0x3ff9a7,_0x341619);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c29cf59..191af4f 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 _0x3be5=['post','create','put','update','exports','multer','path','connect-timeout','express','fs-extra','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x2b1741,_0x4376b0){var _0x2a62f0=function(_0x17cfc2){while(--_0x17cfc2){_0x2b1741['push'](_0x2b1741['shift']());}};_0x2a62f0(++_0x4376b0);}(_0x3be5,0x155));var _0x53be=function(_0x2a85fe,_0x157a6b){_0x2a85fe=_0x2a85fe-0x0;var _0x432e7e=_0x3be5[_0x2a85fe];return _0x432e7e;};'use strict';var multer=require(_0x53be('0x0'));var util=require('util');var path=require(_0x53be('0x1'));var timeout=require(_0x53be('0x2'));var express=require(_0x53be('0x3'));var router=express['Router']();var fs_extra=require(_0x53be('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x53be('0x5'));router[_0x53be('0x6')]('/',auth[_0x53be('0x7')](),controller[_0x53be('0x8')]);router[_0x53be('0x6')](_0x53be('0x9'),auth[_0x53be('0x7')](),controller['describe']);router['get'](_0x53be('0xa'),auth[_0x53be('0x7')](),controller['show']);router[_0x53be('0xb')]('/',auth[_0x53be('0x7')](),controller[_0x53be('0xc')]);router[_0x53be('0xd')]('/:id',auth[_0x53be('0x7')](),controller[_0x53be('0xe')]);router['delete']('/:id',auth[_0x53be('0x7')](),controller['destroy']);module[_0x53be('0xf')]=router; \ No newline at end of file +var _0xceae=['update','delete','multer','util','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x462780,_0x34821c){var _0x2b7c75=function(_0x4c4666){while(--_0x4c4666){_0x462780['push'](_0x462780['shift']());}};_0x2b7c75(++_0x34821c);}(_0xceae,0x122));var _0xecea=function(_0x53e787,_0x4298e6){_0x53e787=_0x53e787-0x0;var _0x2781a0=_0xceae[_0x53e787];return _0x2781a0;};'use strict';var multer=require(_0xecea('0x0'));var util=require(_0xecea('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xecea('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xecea('0x3'));var config=require(_0xecea('0x4'));var controller=require(_0xecea('0x5'));router[_0xecea('0x6')]('/',auth[_0xecea('0x7')](),controller[_0xecea('0x8')]);router[_0xecea('0x6')](_0xecea('0x9'),auth[_0xecea('0x7')](),controller[_0xecea('0xa')]);router['get'](_0xecea('0xb'),auth['isAuthenticated'](),controller[_0xecea('0xc')]);router[_0xecea('0xd')]('/',auth[_0xecea('0x7')](),controller[_0xecea('0xe')]);router[_0xecea('0xf')](_0xecea('0xb'),auth[_0xecea('0x7')](),controller[_0xecea('0x10')]);router[_0xecea('0x11')](_0xecea('0xb'),auth[_0xecea('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 98e3a05..8b6ed6d 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 _0xf435=['DATE','moment','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf435,0x115));var _0x5f43=function(_0x892a7f,_0x3b6e66){_0x892a7f=_0x892a7f-0x0;var _0x1696b7=_0xf435[_0x892a7f];return _0x1696b7;};'use strict';var moment=require(_0x5f43('0x0'));var Sequelize=require(_0x5f43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x5f43('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5f43('0x2')]},'joinAt':{'type':Sequelize[_0x5f43('0x3')]},'leaveAt':{'type':Sequelize[_0x5f43('0x3')]},'acceptAt':{'type':Sequelize[_0x5f43('0x3')]},'exitAt':{'type':Sequelize[_0x5f43('0x3')]},'reason':{'type':Sequelize[_0x5f43('0x2')]}}; \ No newline at end of file +var _0x6a13=['exports','STRING','DATE','moment','sequelize'];(function(_0x4e19aa,_0xabe3ad){var _0x5732b7=function(_0x54e05a){while(--_0x54e05a){_0x4e19aa['push'](_0x4e19aa['shift']());}};_0x5732b7(++_0xabe3ad);}(_0x6a13,0x6c));var _0x36a1=function(_0x2f8d06,_0x13fc5e){_0x2f8d06=_0x2f8d06-0x0;var _0x554a8e=_0x6a13[_0x2f8d06];return _0x554a8e;};'use strict';var moment=require(_0x36a1('0x0'));var Sequelize=require(_0x36a1('0x1'));module[_0x36a1('0x2')]={'uniqueid':{'type':Sequelize[_0x36a1('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x36a1('0x4')]},'leaveAt':{'type':Sequelize[_0x36a1('0x4')]},'acceptAt':{'type':Sequelize[_0x36a1('0x4')]},'exitAt':{'type':Sequelize[_0x36a1('0x4')]},'reason':{'type':Sequelize[_0x36a1('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index bb078e1..8ccd0f4 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 _0x94ed=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x308f,_0x282972){var _0x5959d3=function(_0x29775b){while(--_0x29775b){_0x308f['push'](_0x308f['shift']());}};_0x5959d3(++_0x282972);}(_0x94ed,0x123));var _0xd94e=function(_0x4bfd95,_0x1c3b3b){_0x4bfd95=_0x4bfd95-0x0;var _0x1484cd=_0x94ed[_0x4bfd95];return _0x1484cd;};'use strict';var emlformat=require(_0xd94e('0x0'));var rimraf=require(_0xd94e('0x1'));var zipdir=require(_0xd94e('0x2'));var jsonpatch=require(_0xd94e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd94e('0x4'));var Mustache=require(_0xd94e('0x5'));var util=require(_0xd94e('0x6'));var path=require('path');var sox=require(_0xd94e('0x7'));var csv=require(_0xd94e('0x8'));var ejs=require(_0xd94e('0x9'));var fs=require('fs');var fs_extra=require(_0xd94e('0xa'));var _=require(_0xd94e('0xb'));var squel=require(_0xd94e('0xc'));var crypto=require(_0xd94e('0xd'));var jsforce=require(_0xd94e('0xe'));var deskjs=require(_0xd94e('0xf'));var toCsv=require(_0xd94e('0x8'));var querystring=require(_0xd94e('0x10'));var Papa=require(_0xd94e('0x11'));var Redis=require(_0xd94e('0x12'));var authService=require(_0xd94e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd94e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd94e('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd94e('0x16'));var db=require(_0xd94e('0x17'))['db'];function respondWithStatusCode(_0x2970e5,_0x50a370){_0x50a370=_0x50a370||0xcc;return function(_0x5e105b){if(_0x5e105b){return _0x2970e5[_0xd94e('0x18')](_0x50a370);}return _0x2970e5[_0xd94e('0x19')](_0x50a370)['end']();};}function respondWithResult(_0x15ff86,_0x358b93){_0x358b93=_0x358b93||0xc8;return function(_0x1c13f5){if(_0x1c13f5){return _0x15ff86[_0xd94e('0x19')](_0x358b93)[_0xd94e('0x1a')](_0x1c13f5);}};}function respondWithFilteredResult(_0x5bb467,_0x205814){return function(_0x1e53ba){if(_0x1e53ba){var _0x5d9f99=typeof _0x205814[_0xd94e('0x1b')]===_0xd94e('0x1c')&&typeof _0x205814[_0xd94e('0x1d')]===_0xd94e('0x1c');var _0x309632=_0x1e53ba[_0xd94e('0x1e')];var _0x695bea=_0x5d9f99?0x0:_0x205814[_0xd94e('0x1b')];var _0x15508a=_0x5d9f99?_0x1e53ba['count']:_0x205814['offset']+_0x205814[_0xd94e('0x1d')];var _0x406226;if(_0x15508a>=_0x309632){_0x15508a=_0x309632;_0x406226=0xc8;}else{_0x406226=0xce;}_0x5bb467[_0xd94e('0x19')](_0x406226);return _0x5bb467['set'](_0xd94e('0x1f'),_0x695bea+'-'+_0x15508a+'/'+_0x309632)[_0xd94e('0x1a')](_0x1e53ba);}return null;};}function patchUpdates(_0x418102){return function(_0x2c357d){try{jsonpatch[_0xd94e('0x20')](_0x2c357d,_0x418102,!![]);}catch(_0x38159e){return BPromise[_0xd94e('0x21')](_0x38159e);}return _0x2c357d[_0xd94e('0x22')]();};}function saveUpdates(_0x54b0b6,_0x2aa281){return function(_0x2211cb){if(_0x2211cb){return _0x2211cb[_0xd94e('0x23')](_0x54b0b6)[_0xd94e('0x24')](function(_0x725648){return _0x725648;});}return null;};}function removeEntity(_0x1a1e47,_0x3e8a0c){return function(_0x55bab6){if(_0x55bab6){return _0x55bab6[_0xd94e('0x25')]()[_0xd94e('0x24')](function(){_0x1a1e47[_0xd94e('0x19')](0xcc)[_0xd94e('0x26')]();});}};}function handleEntityNotFound(_0x3e4c9b,_0x125b6a){return function(_0x203d8c){if(!_0x203d8c){_0x3e4c9b[_0xd94e('0x18')](0x194);}return _0x203d8c;};}function handleError(_0x390430,_0x2ce39c){_0x2ce39c=_0x2ce39c||0x1f4;return function(_0x2b7d6f){logger[_0xd94e('0x27')](_0x2b7d6f[_0xd94e('0x28')]);if(_0x2b7d6f['name']){delete _0x2b7d6f[_0xd94e('0x29')];}_0x390430['status'](_0x2ce39c)[_0xd94e('0x2a')](_0x2b7d6f);};}exports[_0xd94e('0x2b')]=function(_0x2c81ef,_0x5cb4a5){var _0x856357={},_0x1d5ea5={},_0x39781e={'count':0x0,'rows':[]};var _0x30b813=_[_0xd94e('0x2c')](db[_0xd94e('0x2d')][_0xd94e('0x2e')],function(_0x4cd879){return{'name':_0x4cd879[_0xd94e('0x2f')],'type':_0x4cd879[_0xd94e('0x30')]['key']};});_0x1d5ea5[_0xd94e('0x31')]=_[_0xd94e('0x2c')](_0x30b813,_0xd94e('0x29'));_0x1d5ea5[_0xd94e('0x32')]=_[_0xd94e('0x33')](_0x2c81ef[_0xd94e('0x32')]);_0x1d5ea5[_0xd94e('0x34')]=_[_0xd94e('0x35')](_0x1d5ea5['model'],_0x1d5ea5[_0xd94e('0x32')]);_0x856357['attributes']=_['intersection'](_0x1d5ea5[_0xd94e('0x31')],qs['fields'](_0x2c81ef['query']['fields']));_0x856357[_0xd94e('0x36')]=_0x856357[_0xd94e('0x36')][_0xd94e('0x37')]?_0x856357[_0xd94e('0x36')]:_0x1d5ea5[_0xd94e('0x31')];if(!_0x2c81ef[_0xd94e('0x32')][_0xd94e('0x38')](_0xd94e('0x39'))){_0x856357[_0xd94e('0x1d')]=qs[_0xd94e('0x1d')](_0x2c81ef[_0xd94e('0x32')][_0xd94e('0x1d')]);_0x856357[_0xd94e('0x1b')]=qs['offset'](_0x2c81ef['query'][_0xd94e('0x1b')]);}_0x856357[_0xd94e('0x3a')]=qs[_0xd94e('0x3b')](_0x2c81ef['query'][_0xd94e('0x3b')]);_0x856357[_0xd94e('0x3c')]=qs['filters'](_[_0xd94e('0x3d')](_0x2c81ef[_0xd94e('0x32')],_0x1d5ea5[_0xd94e('0x34')]),_0x30b813);if(_0x2c81ef['query'][_0xd94e('0x3e')]){_0x856357['where']=_[_0xd94e('0x3f')](_0x856357['where'],{'$or':_[_0xd94e('0x2c')](_0x30b813,function(_0x2cabe2){if(_0x2cabe2[_0xd94e('0x30')]!==_0xd94e('0x40')){var _0x46a8dd={};_0x46a8dd[_0x2cabe2[_0xd94e('0x29')]]={'$like':'%'+_0x2c81ef[_0xd94e('0x32')][_0xd94e('0x3e')]+'%'};return _0x46a8dd;}})});}_0x856357=_[_0xd94e('0x3f')]({},_0x856357,_0x2c81ef[_0xd94e('0x41')]);var _0x3c16e1={'where':_0x856357['where']};return db[_0xd94e('0x2d')][_0xd94e('0x1e')](_0x3c16e1)[_0xd94e('0x24')](function(_0x4d191a){_0x39781e['count']=_0x4d191a;if(_0x2c81ef['query'][_0xd94e('0x42')]){_0x856357[_0xd94e('0x43')]=[{'all':!![]}];}return db[_0xd94e('0x2d')]['findAll'](_0x856357);})[_0xd94e('0x24')](function(_0x54da29){_0x39781e[_0xd94e('0x44')]=_0x54da29;return _0x39781e;})['then'](respondWithFilteredResult(_0x5cb4a5,_0x856357))[_0xd94e('0x45')](handleError(_0x5cb4a5,null));};exports[_0xd94e('0x46')]=function(_0x2534ce,_0x169aca){var _0xb26185={'raw':!![],'where':{'id':_0x2534ce[_0xd94e('0x47')]['id']}},_0x11542f={};_0x11542f[_0xd94e('0x31')]=_[_0xd94e('0x33')](db[_0xd94e('0x2d')][_0xd94e('0x2e')]);_0x11542f[_0xd94e('0x32')]=_['keys'](_0x2534ce[_0xd94e('0x32')]);_0x11542f[_0xd94e('0x34')]=_['intersection'](_0x11542f[_0xd94e('0x31')],_0x11542f[_0xd94e('0x32')]);_0xb26185[_0xd94e('0x36')]=_['intersection'](_0x11542f[_0xd94e('0x31')],qs[_0xd94e('0x48')](_0x2534ce[_0xd94e('0x32')]['fields']));_0xb26185[_0xd94e('0x36')]=_0xb26185[_0xd94e('0x36')]['length']?_0xb26185[_0xd94e('0x36')]:_0x11542f['model'];if(_0x2534ce[_0xd94e('0x32')][_0xd94e('0x42')]){_0xb26185[_0xd94e('0x43')]=[{'all':!![]}];}_0xb26185=_[_0xd94e('0x3f')]({},_0xb26185,_0x2534ce[_0xd94e('0x41')]);return db[_0xd94e('0x2d')][_0xd94e('0x49')](_0xb26185)['then'](handleEntityNotFound(_0x169aca,null))[_0xd94e('0x24')](respondWithResult(_0x169aca,null))['catch'](handleError(_0x169aca,null));};exports[_0xd94e('0x4a')]=function(_0x190a60,_0x266352){return db[_0xd94e('0x2d')][_0xd94e('0x4a')](_0x190a60[_0xd94e('0x4b')],{})[_0xd94e('0x24')](respondWithResult(_0x266352,0xc9))[_0xd94e('0x45')](handleError(_0x266352,null));};exports[_0xd94e('0x23')]=function(_0x2c2929,_0xe2f270){if(_0x2c2929[_0xd94e('0x4b')]['id']){delete _0x2c2929['body']['id'];}return db[_0xd94e('0x2d')][_0xd94e('0x49')]({'where':{'id':_0x2c2929['params']['id']}})['then'](handleEntityNotFound(_0xe2f270,null))['then'](saveUpdates(_0x2c2929[_0xd94e('0x4b')],null))[_0xd94e('0x24')](respondWithResult(_0xe2f270,null))[_0xd94e('0x45')](handleError(_0xe2f270,null));};exports[_0xd94e('0x25')]=function(_0x274f40,_0x2afade){return db['SmsQueueReport']['find']({'where':{'id':_0x274f40[_0xd94e('0x47')]['id']}})[_0xd94e('0x24')](handleEntityNotFound(_0x2afade,null))['then'](removeEntity(_0x2afade,null))[_0xd94e('0x45')](handleError(_0x2afade,null));};exports['describe']=function(_0x4d0c81,_0x300f17){return db[_0xd94e('0x2d')][_0xd94e('0x4c')]()[_0xd94e('0x24')](respondWithResult(_0x300f17,null))[_0xd94e('0x45')](handleError(_0x300f17,null));}; \ No newline at end of file +var _0x767d=['order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','rawAttributes','length','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','SmsQueueReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x1ea5d4,_0xaaea7d){var _0x4399a8=function(_0xfe400b){while(--_0xfe400b){_0x1ea5d4['push'](_0x1ea5d4['shift']());}};_0x4399a8(++_0xaaea7d);}(_0x767d,0xa8));var _0xd767=function(_0x4f2474,_0x57698e){_0x4f2474=_0x4f2474-0x0;var _0x2ad8e5=_0x767d[_0x4f2474];return _0x2ad8e5;};'use strict';var emlformat=require(_0xd767('0x0'));var rimraf=require(_0xd767('0x1'));var zipdir=require(_0xd767('0x2'));var jsonpatch=require(_0xd767('0x3'));var rp=require(_0xd767('0x4'));var moment=require(_0xd767('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd767('0x6'));var path=require('path');var sox=require(_0xd767('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd767('0x8'));var squel=require('squel');var crypto=require(_0xd767('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd767('0xa'));var toCsv=require('to-csv');var querystring=require(_0xd767('0xb'));var Papa=require(_0xd767('0xc'));var Redis=require(_0xd767('0xd'));var authService=require(_0xd767('0xe'));var qs=require(_0xd767('0xf'));var as=require(_0xd767('0x10'));var hardwareService=require(_0xd767('0x11'));var logger=require('../../config/logger')(_0xd767('0x12'));var utils=require(_0xd767('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd767('0x14'));var db=require(_0xd767('0x15'))['db'];function respondWithStatusCode(_0x5f1ed5,_0x17fa79){_0x17fa79=_0x17fa79||0xcc;return function(_0x4ccc08){if(_0x4ccc08){return _0x5f1ed5['sendStatus'](_0x17fa79);}return _0x5f1ed5[_0xd767('0x16')](_0x17fa79)[_0xd767('0x17')]();};}function respondWithResult(_0x2405e9,_0x5cee33){_0x5cee33=_0x5cee33||0xc8;return function(_0x297d7c){if(_0x297d7c){return _0x2405e9[_0xd767('0x16')](_0x5cee33)['json'](_0x297d7c);}};}function respondWithFilteredResult(_0x3c23d1,_0x58982a){return function(_0x3eae97){if(_0x3eae97){var _0x41b0eb=typeof _0x58982a[_0xd767('0x18')]==='undefined'&&typeof _0x58982a[_0xd767('0x19')]===_0xd767('0x1a');var _0x2e7222=_0x3eae97[_0xd767('0x1b')];var _0x4eaa06=_0x41b0eb?0x0:_0x58982a[_0xd767('0x18')];var _0xbfd411=_0x41b0eb?_0x3eae97[_0xd767('0x1b')]:_0x58982a[_0xd767('0x18')]+_0x58982a[_0xd767('0x19')];var _0x3e64d5;if(_0xbfd411>=_0x2e7222){_0xbfd411=_0x2e7222;_0x3e64d5=0xc8;}else{_0x3e64d5=0xce;}_0x3c23d1[_0xd767('0x16')](_0x3e64d5);return _0x3c23d1[_0xd767('0x1c')](_0xd767('0x1d'),_0x4eaa06+'-'+_0xbfd411+'/'+_0x2e7222)[_0xd767('0x1e')](_0x3eae97);}return null;};}function patchUpdates(_0x4fc82a){return function(_0x40fa1e){try{jsonpatch[_0xd767('0x1f')](_0x40fa1e,_0x4fc82a,!![]);}catch(_0x26e22e){return BPromise[_0xd767('0x20')](_0x26e22e);}return _0x40fa1e[_0xd767('0x21')]();};}function saveUpdates(_0x31e496,_0x584ae0){return function(_0x527145){if(_0x527145){return _0x527145[_0xd767('0x22')](_0x31e496)[_0xd767('0x23')](function(_0xe82128){return _0xe82128;});}return null;};}function removeEntity(_0x13e086,_0xd16b46){return function(_0x2839c1){if(_0x2839c1){return _0x2839c1['destroy']()[_0xd767('0x23')](function(){_0x13e086['status'](0xcc)[_0xd767('0x17')]();});}};}function handleEntityNotFound(_0x311dee,_0x2821b7){return function(_0x233f8b){if(!_0x233f8b){_0x311dee['sendStatus'](0x194);}return _0x233f8b;};}function handleError(_0x2b3c6f,_0x249fd5){_0x249fd5=_0x249fd5||0x1f4;return function(_0x5762f4){logger[_0xd767('0x24')](_0x5762f4[_0xd767('0x25')]);if(_0x5762f4[_0xd767('0x26')]){delete _0x5762f4['name'];}_0x2b3c6f[_0xd767('0x16')](_0x249fd5)[_0xd767('0x27')](_0x5762f4);};}exports[_0xd767('0x28')]=function(_0x560125,_0x43e0fc){var _0x11bfbd={},_0x349afc={},_0x421c7a={'count':0x0,'rows':[]};var _0x50cbd1=_[_0xd767('0x29')](db[_0xd767('0x2a')]['rawAttributes'],function(_0x3560f3){return{'name':_0x3560f3[_0xd767('0x2b')],'type':_0x3560f3['type'][_0xd767('0x2c')]};});_0x349afc[_0xd767('0x2d')]=_[_0xd767('0x29')](_0x50cbd1,_0xd767('0x26'));_0x349afc[_0xd767('0x2e')]=_[_0xd767('0x2f')](_0x560125[_0xd767('0x2e')]);_0x349afc[_0xd767('0x30')]=_[_0xd767('0x31')](_0x349afc[_0xd767('0x2d')],_0x349afc[_0xd767('0x2e')]);_0x11bfbd[_0xd767('0x32')]=_['intersection'](_0x349afc['model'],qs[_0xd767('0x33')](_0x560125[_0xd767('0x2e')]['fields']));_0x11bfbd[_0xd767('0x32')]=_0x11bfbd[_0xd767('0x32')]['length']?_0x11bfbd[_0xd767('0x32')]:_0x349afc[_0xd767('0x2d')];if(!_0x560125[_0xd767('0x2e')][_0xd767('0x34')](_0xd767('0x35'))){_0x11bfbd[_0xd767('0x19')]=qs['limit'](_0x560125['query'][_0xd767('0x19')]);_0x11bfbd['offset']=qs[_0xd767('0x18')](_0x560125['query']['offset']);}_0x11bfbd[_0xd767('0x36')]=qs['sort'](_0x560125[_0xd767('0x2e')][_0xd767('0x37')]);_0x11bfbd[_0xd767('0x38')]=qs[_0xd767('0x30')](_[_0xd767('0x39')](_0x560125['query'],_0x349afc[_0xd767('0x30')]),_0x50cbd1);if(_0x560125[_0xd767('0x2e')][_0xd767('0x3a')]){_0x11bfbd[_0xd767('0x38')]=_[_0xd767('0x3b')](_0x11bfbd[_0xd767('0x38')],{'$or':_[_0xd767('0x29')](_0x50cbd1,function(_0x49da05){if(_0x49da05[_0xd767('0x3c')]!==_0xd767('0x3d')){var _0x285103={};_0x285103[_0x49da05[_0xd767('0x26')]]={'$like':'%'+_0x560125[_0xd767('0x2e')]['filter']+'%'};return _0x285103;}})});}_0x11bfbd=_[_0xd767('0x3b')]({},_0x11bfbd,_0x560125[_0xd767('0x3e')]);var _0x768dc6={'where':_0x11bfbd[_0xd767('0x38')]};return db[_0xd767('0x2a')]['count'](_0x768dc6)[_0xd767('0x23')](function(_0x16f156){_0x421c7a[_0xd767('0x1b')]=_0x16f156;if(_0x560125[_0xd767('0x2e')][_0xd767('0x3f')]){_0x11bfbd[_0xd767('0x40')]=[{'all':!![]}];}return db[_0xd767('0x2a')]['findAll'](_0x11bfbd);})['then'](function(_0x367cfb){_0x421c7a['rows']=_0x367cfb;return _0x421c7a;})[_0xd767('0x23')](respondWithFilteredResult(_0x43e0fc,_0x11bfbd))[_0xd767('0x41')](handleError(_0x43e0fc,null));};exports['show']=function(_0x102806,_0x575dc5){var _0x42aef6={'raw':!![],'where':{'id':_0x102806['params']['id']}},_0x258f52={};_0x258f52[_0xd767('0x2d')]=_[_0xd767('0x2f')](db[_0xd767('0x2a')][_0xd767('0x42')]);_0x258f52[_0xd767('0x2e')]=_[_0xd767('0x2f')](_0x102806[_0xd767('0x2e')]);_0x258f52['filters']=_[_0xd767('0x31')](_0x258f52[_0xd767('0x2d')],_0x258f52[_0xd767('0x2e')]);_0x42aef6[_0xd767('0x32')]=_[_0xd767('0x31')](_0x258f52[_0xd767('0x2d')],qs[_0xd767('0x33')](_0x102806[_0xd767('0x2e')]['fields']));_0x42aef6['attributes']=_0x42aef6[_0xd767('0x32')][_0xd767('0x43')]?_0x42aef6[_0xd767('0x32')]:_0x258f52[_0xd767('0x2d')];if(_0x102806[_0xd767('0x2e')]['includeAll']){_0x42aef6['include']=[{'all':!![]}];}_0x42aef6=_[_0xd767('0x3b')]({},_0x42aef6,_0x102806['options']);return db[_0xd767('0x2a')][_0xd767('0x44')](_0x42aef6)['then'](handleEntityNotFound(_0x575dc5,null))['then'](respondWithResult(_0x575dc5,null))[_0xd767('0x41')](handleError(_0x575dc5,null));};exports[_0xd767('0x45')]=function(_0x1a1824,_0x452905){return db[_0xd767('0x2a')][_0xd767('0x45')](_0x1a1824['body'],{})[_0xd767('0x23')](respondWithResult(_0x452905,0xc9))[_0xd767('0x41')](handleError(_0x452905,null));};exports['update']=function(_0x198a86,_0xb55d9d){if(_0x198a86[_0xd767('0x46')]['id']){delete _0x198a86['body']['id'];}return db[_0xd767('0x2a')][_0xd767('0x44')]({'where':{'id':_0x198a86[_0xd767('0x47')]['id']}})['then'](handleEntityNotFound(_0xb55d9d,null))[_0xd767('0x23')](saveUpdates(_0x198a86[_0xd767('0x46')],null))[_0xd767('0x23')](respondWithResult(_0xb55d9d,null))[_0xd767('0x41')](handleError(_0xb55d9d,null));};exports[_0xd767('0x48')]=function(_0x175c88,_0x2d7d87){return db['SmsQueueReport'][_0xd767('0x44')]({'where':{'id':_0x175c88[_0xd767('0x47')]['id']}})[_0xd767('0x23')](handleEntityNotFound(_0x2d7d87,null))[_0xd767('0x23')](removeEntity(_0x2d7d87,null))[_0xd767('0x41')](handleError(_0x2d7d87,null));};exports[_0xd767('0x49')]=function(_0x357da6,_0x57890d){return db[_0xd767('0x2a')][_0xd767('0x49')]()[_0xd767('0x23')](respondWithResult(_0x57890d,null))['catch'](handleError(_0x57890d,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index e364210..340471f 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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x1a14c3,_0x2c70c2){var _0x1d7ada=function(_0x40fafa){while(--_0x40fafa){_0x1a14c3['push'](_0x1a14c3['shift']());}};_0x1d7ada(++_0x2c70c2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x19af68,_0x36f956){var _0x4907fa=function(_0x30883f){while(--_0x30883f){_0x19af68['push'](_0x19af68['shift']());}};_0x4907fa(++_0x36f956);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 8031639..6038249 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 _0xcacd=['message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','options','raw','update','where','limit','then','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14363e,_0x4f0e0d){var _0x17c56d=function(_0x1c7bac){while(--_0x1c7bac){_0x14363e['push'](_0x14363e['shift']());}};_0x17c56d(++_0x4f0e0d);}(_0xcacd,0x161));var _0xdcac=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xcacd[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xdcac('0x0'));var util=require(_0xdcac('0x1'));var moment=require(_0xdcac('0x2'));var BPromise=require(_0xdcac('0x3'));var rs=require(_0xdcac('0x4'));var fs=require('fs');var Redis=require(_0xdcac('0x5'));var db=require(_0xdcac('0x6'))['db'];var utils=require(_0xdcac('0x7'));var logger=require(_0xdcac('0x8'))(_0xdcac('0x9'));var config=require(_0xdcac('0xa'));var jayson=require(_0xdcac('0xb'));var client=jayson[_0xdcac('0xc')][_0xdcac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x92f12b,_0x267db3,_0x428f9b){return new BPromise(function(_0x4dd00c,_0x2adff6){return client['request'](_0x92f12b,_0x428f9b)['then'](function(_0x5d40fa){logger['info'](_0xdcac('0xe'),_0x267db3,_0xdcac('0xf'));logger[_0xdcac('0x10')](_0xdcac('0x11'),_0x267db3,'request\x20sent',JSON[_0xdcac('0x12')](_0x5d40fa));if(_0x5d40fa[_0xdcac('0x13')]){if(_0x5d40fa[_0xdcac('0x13')][_0xdcac('0x14')]===0x1f4){logger[_0xdcac('0x13')](_0xdcac('0xe'),_0x267db3,_0x5d40fa[_0xdcac('0x13')]['message']);return _0x2adff6(_0x5d40fa[_0xdcac('0x13')][_0xdcac('0x15')]);}logger[_0xdcac('0x13')](_0xdcac('0xe'),_0x267db3,_0x5d40fa[_0xdcac('0x13')][_0xdcac('0x15')]);return _0x4dd00c(_0x5d40fa[_0xdcac('0x13')][_0xdcac('0x15')]);}else{logger[_0xdcac('0x16')](_0xdcac('0xe'),_0x267db3,_0xdcac('0xf'));_0x4dd00c(_0x5d40fa[_0xdcac('0x17')][_0xdcac('0x15')]);}})[_0xdcac('0x18')](function(_0x40f808){logger[_0xdcac('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x267db3,_0x40f808);_0x2adff6(_0x40f808);});});}exports[_0xdcac('0x19')]=function(_0x16a589){var _0x46fb24=this;return new Promise(function(_0x10b612,_0x52ff85){return db[_0xdcac('0x1a')]['create'](_0x16a589['body'],{'raw':_0x16a589[_0xdcac('0x1b')]?_0x16a589[_0xdcac('0x1b')][_0xdcac('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47d321){logger['info'](_0xdcac('0x19'),_0x16a589);logger['debug'](_0xdcac('0x19'),_0x16a589,JSON[_0xdcac('0x12')](_0x47d321));_0x10b612(_0x47d321);})[_0xdcac('0x18')](function(_0x58642c){logger[_0xdcac('0x13')](_0xdcac('0x19'),_0x58642c[_0xdcac('0x15')],_0x16a589);_0x52ff85(_0x46fb24[_0xdcac('0x13')](0x1f4,_0x58642c[_0xdcac('0x15')]));});});};exports['UpdateSmsQueueReport']=function(_0x3daf8e){var _0x4a227=this;return new Promise(function(_0x505bc7,_0x447295){return db[_0xdcac('0x1a')][_0xdcac('0x1d')](_0x3daf8e['body'],{'raw':_0x3daf8e[_0xdcac('0x1b')]?_0x3daf8e[_0xdcac('0x1b')][_0xdcac('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3daf8e['options']?_0x3daf8e[_0xdcac('0x1b')][_0xdcac('0x1e')]||null:null,'attributes':_0x3daf8e[_0xdcac('0x1b')]?_0x3daf8e[_0xdcac('0x1b')]['attributes']||null:null,'limit':_0x3daf8e[_0xdcac('0x1b')]?_0x3daf8e[_0xdcac('0x1b')][_0xdcac('0x1f')]||null:null})[_0xdcac('0x20')](function(_0x52ae3b){logger['info'](_0xdcac('0x21'),_0x3daf8e);logger[_0xdcac('0x10')](_0xdcac('0x21'),_0x3daf8e,JSON[_0xdcac('0x12')](_0x52ae3b));_0x505bc7(_0x52ae3b);})['catch'](function(_0x246709){logger[_0xdcac('0x13')](_0xdcac('0x21'),_0x246709[_0xdcac('0x15')],_0x3daf8e);_0x447295(_0x4a227[_0xdcac('0x13')](0x1f4,_0x246709[_0xdcac('0x15')]));});});}; \ No newline at end of file +var _0xb437=['request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSmsQueueReport','create','options','raw','stringify','catch','UpdateSmsQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xb437,0xef));var _0x7b43=function(_0x2cd7be,_0x3fd633){_0x2cd7be=_0x2cd7be-0x0;var _0x35b707=_0xb437[_0x2cd7be];return _0x35b707;};'use strict';var _=require(_0x7b43('0x0'));var util=require(_0x7b43('0x1'));var moment=require(_0x7b43('0x2'));var BPromise=require(_0x7b43('0x3'));var rs=require(_0x7b43('0x4'));var fs=require('fs');var Redis=require(_0x7b43('0x5'));var db=require(_0x7b43('0x6'))['db'];var utils=require(_0x7b43('0x7'));var logger=require(_0x7b43('0x8'))(_0x7b43('0x9'));var config=require(_0x7b43('0xa'));var jayson=require(_0x7b43('0xb'));var client=jayson[_0x7b43('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x241b94,_0x11da75,_0x584c6b){return new BPromise(function(_0x47c788,_0x29e055){return client[_0x7b43('0xd')](_0x241b94,_0x584c6b)[_0x7b43('0xe')](function(_0x393b6e){logger[_0x7b43('0xf')](_0x7b43('0x10'),_0x11da75,_0x7b43('0x11'));logger[_0x7b43('0x12')](_0x7b43('0x13'),_0x11da75,_0x7b43('0x11'),JSON['stringify'](_0x393b6e));if(_0x393b6e[_0x7b43('0x14')]){if(_0x393b6e[_0x7b43('0x14')][_0x7b43('0x15')]===0x1f4){logger[_0x7b43('0x14')](_0x7b43('0x10'),_0x11da75,_0x393b6e[_0x7b43('0x14')][_0x7b43('0x16')]);return _0x29e055(_0x393b6e[_0x7b43('0x14')][_0x7b43('0x16')]);}logger[_0x7b43('0x14')](_0x7b43('0x10'),_0x11da75,_0x393b6e[_0x7b43('0x14')][_0x7b43('0x16')]);return _0x47c788(_0x393b6e[_0x7b43('0x14')][_0x7b43('0x16')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x11da75,_0x7b43('0x11'));_0x47c788(_0x393b6e[_0x7b43('0x17')][_0x7b43('0x16')]);}})['catch'](function(_0x46ea6f){logger[_0x7b43('0x14')](_0x7b43('0x10'),_0x11da75,_0x46ea6f);_0x29e055(_0x46ea6f);});});}exports[_0x7b43('0x18')]=function(_0x5afac7){var _0x187c8d=this;return new Promise(function(_0x32c897,_0x21e200){return db['SmsQueueReport'][_0x7b43('0x19')](_0x5afac7['body'],{'raw':_0x5afac7[_0x7b43('0x1a')]?_0x5afac7[_0x7b43('0x1a')][_0x7b43('0x1b')]===undefined?!![]:![]:!![]})[_0x7b43('0xe')](function(_0x598a97){logger[_0x7b43('0xf')](_0x7b43('0x18'),_0x5afac7);logger['debug'](_0x7b43('0x18'),_0x5afac7,JSON[_0x7b43('0x1c')](_0x598a97));_0x32c897(_0x598a97);})[_0x7b43('0x1d')](function(_0x1d4449){logger[_0x7b43('0x14')]('CreateSmsQueueReport',_0x1d4449['message'],_0x5afac7);_0x21e200(_0x187c8d[_0x7b43('0x14')](0x1f4,_0x1d4449[_0x7b43('0x16')]));});});};exports[_0x7b43('0x1e')]=function(_0x52237a){var _0x1da4ce=this;return new Promise(function(_0x3c9351,_0x4ba9fa){return db['SmsQueueReport'][_0x7b43('0x1f')](_0x52237a[_0x7b43('0x20')],{'raw':_0x52237a[_0x7b43('0x1a')]?_0x52237a[_0x7b43('0x1a')][_0x7b43('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52237a['options']?_0x52237a[_0x7b43('0x1a')][_0x7b43('0x21')]||null:null,'attributes':_0x52237a[_0x7b43('0x1a')]?_0x52237a[_0x7b43('0x1a')][_0x7b43('0x22')]||null:null,'limit':_0x52237a['options']?_0x52237a[_0x7b43('0x1a')][_0x7b43('0x23')]||null:null})[_0x7b43('0xe')](function(_0x42521b){logger[_0x7b43('0xf')]('UpdateSmsQueueReport',_0x52237a);logger[_0x7b43('0x12')](_0x7b43('0x1e'),_0x52237a,JSON[_0x7b43('0x1c')](_0x42521b));_0x3c9351(_0x42521b);})[_0x7b43('0x1d')](function(_0x153a9c){logger[_0x7b43('0x14')]('UpdateSmsQueueReport',_0x153a9c[_0x7b43('0x16')],_0x52237a);_0x4ba9fa(_0x1da4ce['error'](0x1f4,_0x153a9c[_0x7b43('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 20f87ab..bec1238 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 _0xdf98=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','path','Router'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0xdf98,0xcf));var _0x8df9=function(_0x1b8f5a,_0x57c154){_0x1b8f5a=_0x1b8f5a-0x0;var _0x594189=_0xdf98[_0x1b8f5a];return _0x594189;};'use strict';var multer=require(_0x8df9('0x0'));var util=require('util');var path=require(_0x8df9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8df9('0x2')]();var fs_extra=require(_0x8df9('0x3'));var auth=require(_0x8df9('0x4'));var interaction=require(_0x8df9('0x5'));var config=require(_0x8df9('0x6'));var controller=require(_0x8df9('0x7'));router[_0x8df9('0x8')]('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0xa')]);router['get'](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xc')]);router['get']('/:id',auth[_0x8df9('0x9')](),controller['show']);router[_0x8df9('0xd')]('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0xe')]);router[_0x8df9('0xf')](_0x8df9('0x10'),auth[_0x8df9('0x9')](),controller[_0x8df9('0x11')]);router[_0x8df9('0x12')]('/:id',auth[_0x8df9('0x9')](),controller[_0x8df9('0x13')]);module[_0x8df9('0x14')]=router; \ No newline at end of file +var _0x032e=['get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller'];(function(_0x207114,_0x25902e){var _0x14d3b4=function(_0x4f8fe3){while(--_0x4f8fe3){_0x207114['push'](_0x207114['shift']());}};_0x14d3b4(++_0x25902e);}(_0x032e,0x124));var _0xe032=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x032e[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0xa')]);router[_0xe032('0x8')](_0xe032('0xb'),auth[_0xe032('0x9')](),controller[_0xe032('0xc')]);router[_0xe032('0x8')](_0xe032('0xd'),auth[_0xe032('0x9')](),controller[_0xe032('0xe')]);router[_0xe032('0xf')]('/',auth[_0xe032('0x9')](),controller['create']);router[_0xe032('0x10')](_0xe032('0xd'),auth[_0xe032('0x9')](),controller[_0xe032('0x11')]);router[_0xe032('0x12')](_0xe032('0xd'),auth[_0xe032('0x9')](),controller['destroy']);module[_0xe032('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index b0a2365..b659cfb 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0xbd5881,_0x4918fd){var _0x5a8ea3=function(_0x4d2dac){while(--_0x4d2dac){_0xbd5881['push'](_0xbd5881['shift']());}};_0x5a8ea3(++_0x4918fd);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x41f6d4,_0x255693){_0x41f6d4=_0x41f6d4-0x0;var _0x42a2a9=_0xf3cd[_0x41f6d4];return _0x42a2a9;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x37dbbb,_0x1909de){var _0x10068f=function(_0x2464b0){while(--_0x2464b0){_0x37dbbb['push'](_0x37dbbb['shift']());}};_0x10068f(++_0x1909de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 5fd59c8..d3fdc8b 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 _0x6f36=['undefined','count','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','options','includeAll','include','rows','show','params','keys','merge','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset'];(function(_0x5a4b16,_0x294bb1){var _0x5236dc=function(_0x33e049){while(--_0x33e049){_0x5a4b16['push'](_0x5a4b16['shift']());}};_0x5236dc(++_0x294bb1);}(_0x6f36,0x1f3));var _0x66f3=function(_0x4e1bff,_0x165340){_0x4e1bff=_0x4e1bff-0x0;var _0x2570f1=_0x6f36[_0x4e1bff];return _0x2570f1;};'use strict';var emlformat=require(_0x66f3('0x0'));var rimraf=require(_0x66f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66f3('0x2'));var rp=require(_0x66f3('0x3'));var moment=require(_0x66f3('0x4'));var BPromise=require(_0x66f3('0x5'));var Mustache=require('mustache');var util=require(_0x66f3('0x6'));var path=require(_0x66f3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66f3('0x8'));var _=require(_0x66f3('0x9'));var squel=require(_0x66f3('0xa'));var crypto=require('crypto');var jsforce=require(_0x66f3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x66f3('0xc'));var querystring=require(_0x66f3('0xd'));var Papa=require(_0x66f3('0xe'));var Redis=require(_0x66f3('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x66f3('0x10'));var hardwareService=require(_0x66f3('0x11'));var logger=require(_0x66f3('0x12'))(_0x66f3('0x13'));var utils=require(_0x66f3('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x66f3('0x15'))['db'];function respondWithStatusCode(_0x35dfd8,_0x493e9e){_0x493e9e=_0x493e9e||0xcc;return function(_0x143cfb){if(_0x143cfb){return _0x35dfd8[_0x66f3('0x16')](_0x493e9e);}return _0x35dfd8[_0x66f3('0x17')](_0x493e9e)['end']();};}function respondWithResult(_0x4d731a,_0x1e20b2){_0x1e20b2=_0x1e20b2||0xc8;return function(_0x7f7db0){if(_0x7f7db0){return _0x4d731a[_0x66f3('0x17')](_0x1e20b2)[_0x66f3('0x18')](_0x7f7db0);}};}function respondWithFilteredResult(_0x4fbf5f,_0x1cd03b){return function(_0x38cbe6){if(_0x38cbe6){var _0x3a7a61=typeof _0x1cd03b[_0x66f3('0x19')]==='undefined'&&typeof _0x1cd03b['limit']===_0x66f3('0x1a');var _0x34d1e5=_0x38cbe6[_0x66f3('0x1b')];var _0x56422e=_0x3a7a61?0x0:_0x1cd03b[_0x66f3('0x19')];var _0x20bbb8=_0x3a7a61?_0x38cbe6[_0x66f3('0x1b')]:_0x1cd03b[_0x66f3('0x19')]+_0x1cd03b['limit'];var _0x46f9df;if(_0x20bbb8>=_0x34d1e5){_0x20bbb8=_0x34d1e5;_0x46f9df=0xc8;}else{_0x46f9df=0xce;}_0x4fbf5f['status'](_0x46f9df);return _0x4fbf5f[_0x66f3('0x1c')](_0x66f3('0x1d'),_0x56422e+'-'+_0x20bbb8+'/'+_0x34d1e5)[_0x66f3('0x18')](_0x38cbe6);}return null;};}function patchUpdates(_0x53baa9){return function(_0xefcdf9){try{jsonpatch[_0x66f3('0x1e')](_0xefcdf9,_0x53baa9,!![]);}catch(_0x31c429){return BPromise[_0x66f3('0x1f')](_0x31c429);}return _0xefcdf9[_0x66f3('0x20')]();};}function saveUpdates(_0x2327b5,_0x512285){return function(_0x1d02cc){if(_0x1d02cc){return _0x1d02cc['update'](_0x2327b5)['then'](function(_0x4127a1){return _0x4127a1;});}return null;};}function removeEntity(_0x563f9e,_0x4481fc){return function(_0x2631f6){if(_0x2631f6){return _0x2631f6[_0x66f3('0x21')]()[_0x66f3('0x22')](function(){_0x563f9e[_0x66f3('0x17')](0xcc)[_0x66f3('0x23')]();});}};}function handleEntityNotFound(_0x224e81,_0x31731){return function(_0x3dcb8f){if(!_0x3dcb8f){_0x224e81[_0x66f3('0x16')](0x194);}return _0x3dcb8f;};}function handleError(_0x2fa23d,_0x2f95c6){_0x2f95c6=_0x2f95c6||0x1f4;return function(_0x362d51){logger[_0x66f3('0x24')](_0x362d51[_0x66f3('0x25')]);if(_0x362d51[_0x66f3('0x26')]){delete _0x362d51['name'];}_0x2fa23d['status'](_0x2f95c6)[_0x66f3('0x27')](_0x362d51);};}exports['index']=function(_0x9a98e8,_0x4df4de){var _0x1cce5a={},_0x58f4f9={},_0x5ddb03={'count':0x0,'rows':[]};var _0x37e5d0=_[_0x66f3('0x28')](db[_0x66f3('0x29')][_0x66f3('0x2a')],function(_0x54c690){return{'name':_0x54c690[_0x66f3('0x2b')],'type':_0x54c690[_0x66f3('0x2c')][_0x66f3('0x2d')]};});_0x58f4f9[_0x66f3('0x2e')]=_[_0x66f3('0x28')](_0x37e5d0,_0x66f3('0x26'));_0x58f4f9[_0x66f3('0x2f')]=_['keys'](_0x9a98e8['query']);_0x58f4f9[_0x66f3('0x30')]=_[_0x66f3('0x31')](_0x58f4f9[_0x66f3('0x2e')],_0x58f4f9[_0x66f3('0x2f')]);_0x1cce5a[_0x66f3('0x32')]=_[_0x66f3('0x31')](_0x58f4f9[_0x66f3('0x2e')],qs['fields'](_0x9a98e8[_0x66f3('0x2f')][_0x66f3('0x33')]));_0x1cce5a[_0x66f3('0x32')]=_0x1cce5a[_0x66f3('0x32')][_0x66f3('0x34')]?_0x1cce5a[_0x66f3('0x32')]:_0x58f4f9[_0x66f3('0x2e')];if(!_0x9a98e8[_0x66f3('0x2f')][_0x66f3('0x35')](_0x66f3('0x36'))){_0x1cce5a[_0x66f3('0x37')]=qs[_0x66f3('0x37')](_0x9a98e8[_0x66f3('0x2f')]['limit']);_0x1cce5a[_0x66f3('0x19')]=qs['offset'](_0x9a98e8[_0x66f3('0x2f')][_0x66f3('0x19')]);}_0x1cce5a[_0x66f3('0x38')]=qs[_0x66f3('0x39')](_0x9a98e8['query'][_0x66f3('0x39')]);_0x1cce5a[_0x66f3('0x3a')]=qs[_0x66f3('0x30')](_['pick'](_0x9a98e8[_0x66f3('0x2f')],_0x58f4f9['filters']),_0x37e5d0);if(_0x9a98e8[_0x66f3('0x2f')][_0x66f3('0x3b')]){_0x1cce5a[_0x66f3('0x3a')]=_['merge'](_0x1cce5a[_0x66f3('0x3a')],{'$or':_['map'](_0x37e5d0,function(_0x123e5c){if(_0x123e5c[_0x66f3('0x2c')]!==_0x66f3('0x3c')){var _0x36ceb8={};_0x36ceb8[_0x123e5c[_0x66f3('0x26')]]={'$like':'%'+_0x9a98e8[_0x66f3('0x2f')][_0x66f3('0x3b')]+'%'};return _0x36ceb8;}})});}_0x1cce5a=_['merge']({},_0x1cce5a,_0x9a98e8[_0x66f3('0x3d')]);var _0x4e5488={'where':_0x1cce5a[_0x66f3('0x3a')]};return db['SmsTransferReport']['count'](_0x4e5488)[_0x66f3('0x22')](function(_0x755887){_0x5ddb03['count']=_0x755887;if(_0x9a98e8['query'][_0x66f3('0x3e')]){_0x1cce5a[_0x66f3('0x3f')]=[{'all':!![]}];}return db[_0x66f3('0x29')]['findAll'](_0x1cce5a);})[_0x66f3('0x22')](function(_0x2133bf){_0x5ddb03[_0x66f3('0x40')]=_0x2133bf;return _0x5ddb03;})[_0x66f3('0x22')](respondWithFilteredResult(_0x4df4de,_0x1cce5a))['catch'](handleError(_0x4df4de,null));};exports[_0x66f3('0x41')]=function(_0x350b0d,_0x23ba7f){var _0x22b874={'raw':!![],'where':{'id':_0x350b0d[_0x66f3('0x42')]['id']}},_0x4b078a={};_0x4b078a[_0x66f3('0x2e')]=_[_0x66f3('0x43')](db[_0x66f3('0x29')][_0x66f3('0x2a')]);_0x4b078a['query']=_[_0x66f3('0x43')](_0x350b0d[_0x66f3('0x2f')]);_0x4b078a['filters']=_[_0x66f3('0x31')](_0x4b078a[_0x66f3('0x2e')],_0x4b078a[_0x66f3('0x2f')]);_0x22b874[_0x66f3('0x32')]=_[_0x66f3('0x31')](_0x4b078a[_0x66f3('0x2e')],qs[_0x66f3('0x33')](_0x350b0d[_0x66f3('0x2f')][_0x66f3('0x33')]));_0x22b874['attributes']=_0x22b874[_0x66f3('0x32')][_0x66f3('0x34')]?_0x22b874[_0x66f3('0x32')]:_0x4b078a[_0x66f3('0x2e')];if(_0x350b0d[_0x66f3('0x2f')][_0x66f3('0x3e')]){_0x22b874[_0x66f3('0x3f')]=[{'all':!![]}];}_0x22b874=_[_0x66f3('0x44')]({},_0x22b874,_0x350b0d[_0x66f3('0x3d')]);return db['SmsTransferReport'][_0x66f3('0x45')](_0x22b874)[_0x66f3('0x22')](handleEntityNotFound(_0x23ba7f,null))['then'](respondWithResult(_0x23ba7f,null))[_0x66f3('0x46')](handleError(_0x23ba7f,null));};exports['create']=function(_0x4e2bb9,_0x2f71e9){return db[_0x66f3('0x29')][_0x66f3('0x47')](_0x4e2bb9[_0x66f3('0x48')],{})[_0x66f3('0x22')](respondWithResult(_0x2f71e9,0xc9))[_0x66f3('0x46')](handleError(_0x2f71e9,null));};exports[_0x66f3('0x49')]=function(_0x104a01,_0x375072){if(_0x104a01[_0x66f3('0x48')]['id']){delete _0x104a01['body']['id'];}return db[_0x66f3('0x29')][_0x66f3('0x45')]({'where':{'id':_0x104a01[_0x66f3('0x42')]['id']}})['then'](handleEntityNotFound(_0x375072,null))[_0x66f3('0x22')](saveUpdates(_0x104a01[_0x66f3('0x48')],null))['then'](respondWithResult(_0x375072,null))[_0x66f3('0x46')](handleError(_0x375072,null));};exports[_0x66f3('0x21')]=function(_0x38b49b,_0x2afb64){return db[_0x66f3('0x29')][_0x66f3('0x45')]({'where':{'id':_0x38b49b['params']['id']}})[_0x66f3('0x22')](handleEntityNotFound(_0x2afb64,null))[_0x66f3('0x22')](removeEntity(_0x2afb64,null))['catch'](handleError(_0x2afb64,null));};exports[_0x66f3('0x4a')]=function(_0x17e37b,_0x5cae46){return db[_0x66f3('0x29')]['describe']()['then'](respondWithResult(_0x5cae46,null))['catch'](handleError(_0x5cae46,null));}; \ No newline at end of file +var _0x2d65=['fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','sendStatus','stack','name','index','map','SmsTransferReport','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x293947,_0x1ac925){var _0x585cc8=function(_0x331873){while(--_0x331873){_0x293947['push'](_0x293947['shift']());}};_0x585cc8(++_0x1ac925);}(_0x2d65,0xd2));var _0x52d6=function(_0x3a7b6e,_0x575ab1){_0x3a7b6e=_0x3a7b6e-0x0;var _0x4f12b5=_0x2d65[_0x3a7b6e];return _0x4f12b5;};'use strict';var emlformat=require(_0x52d6('0x0'));var rimraf=require(_0x52d6('0x1'));var zipdir=require(_0x52d6('0x2'));var jsonpatch=require(_0x52d6('0x3'));var rp=require(_0x52d6('0x4'));var moment=require(_0x52d6('0x5'));var BPromise=require(_0x52d6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x52d6('0x7'));var csv=require(_0x52d6('0x8'));var ejs=require(_0x52d6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52d6('0xa'));var squel=require(_0x52d6('0xb'));var crypto=require('crypto');var jsforce=require(_0x52d6('0xc'));var deskjs=require(_0x52d6('0xd'));var toCsv=require(_0x52d6('0x8'));var querystring=require(_0x52d6('0xe'));var Papa=require(_0x52d6('0xf'));var Redis=require('ioredis');var authService=require(_0x52d6('0x10'));var qs=require(_0x52d6('0x11'));var as=require(_0x52d6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x52d6('0x13'))(_0x52d6('0x14'));var utils=require('../../config/utils');var config=require(_0x52d6('0x15'));var licenseUtil=require(_0x52d6('0x16'));var db=require(_0x52d6('0x17'))['db'];function respondWithStatusCode(_0x5fd69d,_0x762abe){_0x762abe=_0x762abe||0xcc;return function(_0x326330){if(_0x326330){return _0x5fd69d['sendStatus'](_0x762abe);}return _0x5fd69d['status'](_0x762abe)['end']();};}function respondWithResult(_0x396290,_0x36a7ce){_0x36a7ce=_0x36a7ce||0xc8;return function(_0xa6cd12){if(_0xa6cd12){return _0x396290[_0x52d6('0x18')](_0x36a7ce)[_0x52d6('0x19')](_0xa6cd12);}};}function respondWithFilteredResult(_0x49a1a5,_0x457d96){return function(_0x2457b6){if(_0x2457b6){var _0x38ae86=typeof _0x457d96['offset']===_0x52d6('0x1a')&&typeof _0x457d96[_0x52d6('0x1b')]===_0x52d6('0x1a');var _0x2227d0=_0x2457b6['count'];var _0x2df54b=_0x38ae86?0x0:_0x457d96['offset'];var _0x4b7ef2=_0x38ae86?_0x2457b6[_0x52d6('0x1c')]:_0x457d96[_0x52d6('0x1d')]+_0x457d96[_0x52d6('0x1b')];var _0x3186f3;if(_0x4b7ef2>=_0x2227d0){_0x4b7ef2=_0x2227d0;_0x3186f3=0xc8;}else{_0x3186f3=0xce;}_0x49a1a5[_0x52d6('0x18')](_0x3186f3);return _0x49a1a5[_0x52d6('0x1e')]('Content-Range',_0x2df54b+'-'+_0x4b7ef2+'/'+_0x2227d0)[_0x52d6('0x19')](_0x2457b6);}return null;};}function patchUpdates(_0x4622f1){return function(_0xe73b2a){try{jsonpatch[_0x52d6('0x1f')](_0xe73b2a,_0x4622f1,!![]);}catch(_0x8c79d4){return BPromise[_0x52d6('0x20')](_0x8c79d4);}return _0xe73b2a[_0x52d6('0x21')]();};}function saveUpdates(_0x9456d2,_0x121929){return function(_0x1cf6a8){if(_0x1cf6a8){return _0x1cf6a8[_0x52d6('0x22')](_0x9456d2)[_0x52d6('0x23')](function(_0x480b1d){return _0x480b1d;});}return null;};}function removeEntity(_0x1ef137,_0x23a864){return function(_0x578649){if(_0x578649){return _0x578649['destroy']()[_0x52d6('0x23')](function(){_0x1ef137[_0x52d6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bf210,_0x4c1662){return function(_0x509d74){if(!_0x509d74){_0x3bf210[_0x52d6('0x24')](0x194);}return _0x509d74;};}function handleError(_0x27262f,_0x22cb21){_0x22cb21=_0x22cb21||0x1f4;return function(_0x38bb7a){logger['error'](_0x38bb7a[_0x52d6('0x25')]);if(_0x38bb7a[_0x52d6('0x26')]){delete _0x38bb7a[_0x52d6('0x26')];}_0x27262f[_0x52d6('0x18')](_0x22cb21)['send'](_0x38bb7a);};}exports[_0x52d6('0x27')]=function(_0x4ebd7f,_0x4fe03b){var _0x1bffdd={},_0x2b3821={},_0xb884c2={'count':0x0,'rows':[]};var _0x2d9ac7=_[_0x52d6('0x28')](db[_0x52d6('0x29')][_0x52d6('0x2a')],function(_0x2f2096){return{'name':_0x2f2096['fieldName'],'type':_0x2f2096[_0x52d6('0x2b')][_0x52d6('0x2c')]};});_0x2b3821['model']=_[_0x52d6('0x28')](_0x2d9ac7,_0x52d6('0x26'));_0x2b3821[_0x52d6('0x2d')]=_[_0x52d6('0x2e')](_0x4ebd7f[_0x52d6('0x2d')]);_0x2b3821[_0x52d6('0x2f')]=_['intersection'](_0x2b3821[_0x52d6('0x30')],_0x2b3821['query']);_0x1bffdd[_0x52d6('0x31')]=_[_0x52d6('0x32')](_0x2b3821[_0x52d6('0x30')],qs[_0x52d6('0x33')](_0x4ebd7f[_0x52d6('0x2d')][_0x52d6('0x33')]));_0x1bffdd[_0x52d6('0x31')]=_0x1bffdd[_0x52d6('0x31')][_0x52d6('0x34')]?_0x1bffdd[_0x52d6('0x31')]:_0x2b3821[_0x52d6('0x30')];if(!_0x4ebd7f[_0x52d6('0x2d')][_0x52d6('0x35')](_0x52d6('0x36'))){_0x1bffdd[_0x52d6('0x1b')]=qs[_0x52d6('0x1b')](_0x4ebd7f[_0x52d6('0x2d')][_0x52d6('0x1b')]);_0x1bffdd[_0x52d6('0x1d')]=qs['offset'](_0x4ebd7f[_0x52d6('0x2d')][_0x52d6('0x1d')]);}_0x1bffdd[_0x52d6('0x37')]=qs['sort'](_0x4ebd7f['query'][_0x52d6('0x38')]);_0x1bffdd[_0x52d6('0x39')]=qs[_0x52d6('0x2f')](_['pick'](_0x4ebd7f['query'],_0x2b3821[_0x52d6('0x2f')]),_0x2d9ac7);if(_0x4ebd7f['query']['filter']){_0x1bffdd['where']=_[_0x52d6('0x3a')](_0x1bffdd[_0x52d6('0x39')],{'$or':_['map'](_0x2d9ac7,function(_0x636d55){if(_0x636d55['type']!=='VIRTUAL'){var _0x3f3df8={};_0x3f3df8[_0x636d55[_0x52d6('0x26')]]={'$like':'%'+_0x4ebd7f[_0x52d6('0x2d')]['filter']+'%'};return _0x3f3df8;}})});}_0x1bffdd=_[_0x52d6('0x3a')]({},_0x1bffdd,_0x4ebd7f[_0x52d6('0x3b')]);var _0xadaaa1={'where':_0x1bffdd[_0x52d6('0x39')]};return db[_0x52d6('0x29')][_0x52d6('0x1c')](_0xadaaa1)[_0x52d6('0x23')](function(_0xd3c0b1){_0xb884c2['count']=_0xd3c0b1;if(_0x4ebd7f[_0x52d6('0x2d')][_0x52d6('0x3c')]){_0x1bffdd[_0x52d6('0x3d')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x52d6('0x3e')](_0x1bffdd);})['then'](function(_0x5bfdef){_0xb884c2['rows']=_0x5bfdef;return _0xb884c2;})[_0x52d6('0x23')](respondWithFilteredResult(_0x4fe03b,_0x1bffdd))[_0x52d6('0x3f')](handleError(_0x4fe03b,null));};exports[_0x52d6('0x40')]=function(_0x44ef25,_0x101d91){var _0x44bf93={'raw':!![],'where':{'id':_0x44ef25[_0x52d6('0x41')]['id']}},_0x388c7d={};_0x388c7d[_0x52d6('0x30')]=_[_0x52d6('0x2e')](db[_0x52d6('0x29')][_0x52d6('0x2a')]);_0x388c7d[_0x52d6('0x2d')]=_[_0x52d6('0x2e')](_0x44ef25[_0x52d6('0x2d')]);_0x388c7d[_0x52d6('0x2f')]=_[_0x52d6('0x32')](_0x388c7d[_0x52d6('0x30')],_0x388c7d[_0x52d6('0x2d')]);_0x44bf93[_0x52d6('0x31')]=_['intersection'](_0x388c7d[_0x52d6('0x30')],qs[_0x52d6('0x33')](_0x44ef25[_0x52d6('0x2d')][_0x52d6('0x33')]));_0x44bf93[_0x52d6('0x31')]=_0x44bf93[_0x52d6('0x31')][_0x52d6('0x34')]?_0x44bf93['attributes']:_0x388c7d[_0x52d6('0x30')];if(_0x44ef25[_0x52d6('0x2d')]['includeAll']){_0x44bf93['include']=[{'all':!![]}];}_0x44bf93=_['merge']({},_0x44bf93,_0x44ef25[_0x52d6('0x3b')]);return db[_0x52d6('0x29')][_0x52d6('0x42')](_0x44bf93)[_0x52d6('0x23')](handleEntityNotFound(_0x101d91,null))[_0x52d6('0x23')](respondWithResult(_0x101d91,null))[_0x52d6('0x3f')](handleError(_0x101d91,null));};exports[_0x52d6('0x43')]=function(_0x342fc0,_0x2bbcf2){return db['SmsTransferReport'][_0x52d6('0x43')](_0x342fc0['body'],{})[_0x52d6('0x23')](respondWithResult(_0x2bbcf2,0xc9))[_0x52d6('0x3f')](handleError(_0x2bbcf2,null));};exports[_0x52d6('0x22')]=function(_0x5ec67c,_0x28ca56){if(_0x5ec67c[_0x52d6('0x44')]['id']){delete _0x5ec67c[_0x52d6('0x44')]['id'];}return db[_0x52d6('0x29')]['find']({'where':{'id':_0x5ec67c[_0x52d6('0x41')]['id']}})[_0x52d6('0x23')](handleEntityNotFound(_0x28ca56,null))['then'](saveUpdates(_0x5ec67c['body'],null))[_0x52d6('0x23')](respondWithResult(_0x28ca56,null))['catch'](handleError(_0x28ca56,null));};exports[_0x52d6('0x45')]=function(_0x2ad0ad,_0x5981c6){return db['SmsTransferReport'][_0x52d6('0x42')]({'where':{'id':_0x2ad0ad[_0x52d6('0x41')]['id']}})[_0x52d6('0x23')](handleEntityNotFound(_0x5981c6,null))[_0x52d6('0x23')](removeEntity(_0x5981c6,null))['catch'](handleError(_0x5981c6,null));};exports[_0x52d6('0x46')]=function(_0x370e5e,_0x74db1b){return db['SmsTransferReport'][_0x52d6('0x46')]()[_0x52d6('0x23')](respondWithResult(_0x74db1b,null))[_0x52d6('0x3f')](handleError(_0x74db1b,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 27b6b44..400d626 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 _0xbfa4=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','api'];(function(_0x2704be,_0x2555d4){var _0x21d7b5=function(_0x5f2a1b){while(--_0x5f2a1b){_0x2704be['push'](_0x2704be['shift']());}};_0x21d7b5(++_0x2555d4);}(_0xbfa4,0x106));var _0x4bfa=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xbfa4[_0x587fb5];return _0x551105;};'use strict';var _=require(_0x4bfa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4bfa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bfa('0x2'));var rimraf=require(_0x4bfa('0x3'));var config=require(_0x4bfa('0x4'));var attributes=require(_0x4bfa('0x5'));module[_0x4bfa('0x6')]=function(_0x1ba9fe,_0x55eb98){return _0x1ba9fe[_0x4bfa('0x7')](_0x4bfa('0x8'),attributes,{'tableName':_0x4bfa('0x9'),'paranoid':![],'indexes':[{'name':_0x4bfa('0xa'),'fields':[_0x4bfa('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5cd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x52b17e,_0x4d2c7a){var _0x7b96b2=function(_0x3f4c2f){while(--_0x3f4c2f){_0x52b17e['push'](_0x52b17e['shift']());}};_0x7b96b2(++_0x4d2c7a);}(_0xd5cd,0x7e));var _0xdd5c=function(_0x126f0f,_0x12b2a2){_0x126f0f=_0x126f0f-0x0;var _0x2a4c60=_0xd5cd[_0x126f0f];return _0x2a4c60;};'use strict';var _=require(_0xdd5c('0x0'));var util=require(_0xdd5c('0x1'));var logger=require(_0xdd5c('0x2'))(_0xdd5c('0x3'));var moment=require(_0xdd5c('0x4'));var BPromise=require(_0xdd5c('0x5'));var rp=require(_0xdd5c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd5c('0x7'));var config=require(_0xdd5c('0x8'));var attributes=require(_0xdd5c('0x9'));module['exports']=function(_0x2ea27e,_0x5b9a93){return _0x2ea27e[_0xdd5c('0xa')](_0xdd5c('0xb'),attributes,{'tableName':_0xdd5c('0xc'),'paranoid':![],'indexes':[{'name':_0xdd5c('0xd'),'fields':[_0xdd5c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 38f6c99..897c344 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 _0x782e=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x417386,_0x190fa8){var _0x1a2c64=function(_0x273a7c){while(--_0x273a7c){_0x417386['push'](_0x417386['shift']());}};_0x1a2c64(++_0x190fa8);}(_0x782e,0xb9));var _0xe782=function(_0x281c12,_0x1a2fb4){_0x281c12=_0x281c12-0x0;var _0x37a19e=_0x782e[_0x281c12];return _0x37a19e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe782('0x0'));var BPromise=require(_0xe782('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe782('0x2'));var db=require(_0xe782('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe782('0x4'))(_0xe782('0x5'));var config=require(_0xe782('0x6'));var jayson=require(_0xe782('0x7'));var client=jayson['client'][_0xe782('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a0cf3,_0x4c1bb7,_0x1029b0){return new BPromise(function(_0x4c6dd1,_0x2f1640){return client[_0xe782('0x9')](_0x4a0cf3,_0x1029b0)[_0xe782('0xa')](function(_0x381a36){logger[_0xe782('0xb')](_0xe782('0xc'),_0x4c1bb7,_0xe782('0xd'));logger[_0xe782('0xe')](_0xe782('0xf'),_0x4c1bb7,_0xe782('0xd'),JSON[_0xe782('0x10')](_0x381a36));if(_0x381a36[_0xe782('0x11')]){if(_0x381a36[_0xe782('0x11')][_0xe782('0x12')]===0x1f4){logger['error'](_0xe782('0xc'),_0x4c1bb7,_0x381a36['error'][_0xe782('0x13')]);return _0x2f1640(_0x381a36[_0xe782('0x11')][_0xe782('0x13')]);}logger[_0xe782('0x11')](_0xe782('0xc'),_0x4c1bb7,_0x381a36[_0xe782('0x11')]['message']);return _0x4c6dd1(_0x381a36['error']['message']);}else{logger[_0xe782('0xb')](_0xe782('0xc'),_0x4c1bb7,'request\x20sent');_0x4c6dd1(_0x381a36[_0xe782('0x14')][_0xe782('0x13')]);}})[_0xe782('0x15')](function(_0x1a7c8e){logger[_0xe782('0x11')](_0xe782('0xc'),_0x4c1bb7,_0x1a7c8e);_0x2f1640(_0x1a7c8e);});});} \ No newline at end of file +var _0x744c=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5c4bf1,_0x9f597d){var _0x232bb9=function(_0x452614){while(--_0x452614){_0x5c4bf1['push'](_0x5c4bf1['shift']());}};_0x232bb9(++_0x9f597d);}(_0x744c,0xa0));var _0xc744=function(_0x56b891,_0x2f117e){_0x56b891=_0x56b891-0x0;var _0x41d994=_0x744c[_0x56b891];return _0x41d994;};'use strict';var _=require(_0xc744('0x0'));var util=require(_0xc744('0x1'));var moment=require(_0xc744('0x2'));var BPromise=require(_0xc744('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc744('0x4'));var db=require(_0xc744('0x5'))['db'];var utils=require(_0xc744('0x6'));var logger=require(_0xc744('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc744('0x8'));var client=jayson[_0xc744('0x9')][_0xc744('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d5009,_0x5625a5,_0x5a85d6){return new BPromise(function(_0x2bb565,_0xf1fc2f){return client['request'](_0x5d5009,_0x5a85d6)[_0xc744('0xb')](function(_0x24a8d3){logger[_0xc744('0xc')](_0xc744('0xd'),_0x5625a5,_0xc744('0xe'));logger[_0xc744('0xf')](_0xc744('0x10'),_0x5625a5,'request\x20sent',JSON[_0xc744('0x11')](_0x24a8d3));if(_0x24a8d3[_0xc744('0x12')]){if(_0x24a8d3[_0xc744('0x12')][_0xc744('0x13')]===0x1f4){logger[_0xc744('0x12')](_0xc744('0xd'),_0x5625a5,_0x24a8d3['error'][_0xc744('0x14')]);return _0xf1fc2f(_0x24a8d3['error'][_0xc744('0x14')]);}logger[_0xc744('0x12')](_0xc744('0xd'),_0x5625a5,_0x24a8d3['error']['message']);return _0x2bb565(_0x24a8d3['error']['message']);}else{logger[_0xc744('0xc')](_0xc744('0xd'),_0x5625a5,'request\x20sent');_0x2bb565(_0x24a8d3['result'][_0xc744('0x14')]);}})[_0xc744('0x15')](function(_0x36f42f){logger[_0xc744('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x5625a5,_0x36f42f);_0xf1fc2f(_0x36f42f);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 8677d09..6dde552 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 _0xbfe0=['diskStorage','join','root','server/files/sounds/original/','originalname','%s-%s%s','basename','now','extname','post','single','file','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','download'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xbfe0,0x110));var _0x0bfe=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xbfe0[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x0bfe('0x0'));var util=require(_0x0bfe('0x1'));var path=require(_0x0bfe('0x2'));var timeout=require(_0x0bfe('0x3'));var express=require(_0x0bfe('0x4'));var router=express[_0x0bfe('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0bfe('0x6'));var interaction=require(_0x0bfe('0x7'));var config=require(_0x0bfe('0x8'));var controller=require(_0x0bfe('0x9'));router[_0x0bfe('0xa')]('/',auth[_0x0bfe('0xb')](),controller[_0x0bfe('0xc')]);router[_0x0bfe('0xa')](_0x0bfe('0xd'),auth[_0x0bfe('0xb')](),controller[_0x0bfe('0xe')]);router[_0x0bfe('0xa')]('/:id/download',auth[_0x0bfe('0xb')](),controller[_0x0bfe('0xf')]);var upload=multer({'storage':multer[_0x0bfe('0x10')]({'destination':function(_0x5f416f,_0xd54448,_0x240eea){_0x240eea(null,path[_0x0bfe('0x11')](config[_0x0bfe('0x12')],_0x0bfe('0x13')));},'filename':function(_0x4cbb6f,_0x32055,_0x2094a9){_0x32055['originalname']=_0x32055[_0x0bfe('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2094a9(null,util['format'](_0x0bfe('0x15'),path[_0x0bfe('0x16')](_0x32055[_0x0bfe('0x14')],path['extname'](_0x32055['originalname'])),Date[_0x0bfe('0x17')](),path[_0x0bfe('0x18')](_0x32055['originalname'])));}})});router[_0x0bfe('0x19')]('/',upload[_0x0bfe('0x1a')](_0x0bfe('0x1b')),controller[_0x0bfe('0x1c')]);router['put'](_0x0bfe('0xd'),auth[_0x0bfe('0xb')](),controller[_0x0bfe('0x1d')]);router[_0x0bfe('0x1e')](_0x0bfe('0xd'),auth[_0x0bfe('0xb')](),controller[_0x0bfe('0x1e')]);module[_0x0bfe('0x1f')]=router; \ No newline at end of file +var _0x8e69=['../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','single','file','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x302bab,_0x508cfa){var _0x4aefc5=function(_0xcc6b22){while(--_0xcc6b22){_0x302bab['push'](_0x302bab['shift']());}};_0x4aefc5(++_0x508cfa);}(_0x8e69,0x1d9));var _0x98e6=function(_0x2dd4d8,_0x1e0984){_0x2dd4d8=_0x2dd4d8-0x0;var _0x55d1be=_0x8e69[_0x2dd4d8];return _0x55d1be;};'use strict';var multer=require(_0x98e6('0x0'));var util=require(_0x98e6('0x1'));var path=require(_0x98e6('0x2'));var timeout=require('connect-timeout');var express=require(_0x98e6('0x3'));var router=express[_0x98e6('0x4')]();var fs_extra=require(_0x98e6('0x5'));var auth=require(_0x98e6('0x6'));var interaction=require(_0x98e6('0x7'));var config=require(_0x98e6('0x8'));var controller=require(_0x98e6('0x9'));router[_0x98e6('0xa')]('/',auth[_0x98e6('0xb')](),controller['index']);router[_0x98e6('0xa')](_0x98e6('0xc'),auth[_0x98e6('0xb')](),controller[_0x98e6('0xd')]);router[_0x98e6('0xa')]('/:id/download',auth[_0x98e6('0xb')](),controller[_0x98e6('0xe')]);var upload=multer({'storage':multer[_0x98e6('0xf')]({'destination':function(_0x1ea43f,_0x3c0f48,_0x104375){_0x104375(null,path[_0x98e6('0x10')](config[_0x98e6('0x11')],_0x98e6('0x12')));},'filename':function(_0x197cd6,_0x364036,_0x125455){_0x364036[_0x98e6('0x13')]=_0x364036['originalname'][_0x98e6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x125455(null,util[_0x98e6('0x15')](_0x98e6('0x16'),path[_0x98e6('0x17')](_0x364036[_0x98e6('0x13')],path[_0x98e6('0x18')](_0x364036[_0x98e6('0x13')])),Date['now'](),path[_0x98e6('0x18')](_0x364036[_0x98e6('0x13')])));}})});router['post']('/',upload[_0x98e6('0x19')](_0x98e6('0x1a')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x98e6('0x1b')]);router[_0x98e6('0x1c')](_0x98e6('0xc'),auth[_0x98e6('0xb')](),controller[_0x98e6('0x1c')]);module[_0x98e6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 9c1e3fb..a9ac50c 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 _0x423e=['FLOAT','BIGINT','INTEGER','exports','name','STRING'];(function(_0x149b25,_0x2bb415){var _0x40b742=function(_0x103584){while(--_0x103584){_0x149b25['push'](_0x149b25['shift']());}};_0x40b742(++_0x2bb415);}(_0x423e,0x123));var _0xe423=function(_0x2a6490,_0x1adf0f){_0x2a6490=_0x2a6490-0x0;var _0x1b31df=_0x423e[_0x2a6490];return _0x1b31df;};'use strict';var Sequelize=require('sequelize');module[_0xe423('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xe423('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe423('0x2')]},'display_name':{'type':Sequelize[_0xe423('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xe423('0x2')]},'original_format':{'type':Sequelize[_0xe423('0x2')]},'original_duration':{'type':Sequelize[_0xe423('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xe423('0x4')]},'original_sampleRate':{'type':Sequelize[_0xe423('0x5')]},'converted_format':{'type':Sequelize[_0xe423('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xe423('0x4')]},'converted_channelCount':{'type':Sequelize[_0xe423('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xe423('0x5')]}}; \ No newline at end of file +var _0x94c5=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x59858f,_0x22393e){var _0x3eaad3=function(_0x24782b){while(--_0x24782b){_0x59858f['push'](_0x59858f['shift']());}};_0x3eaad3(++_0x22393e);}(_0x94c5,0x15f));var _0x594c=function(_0x1b0143,_0xfc68d7){_0x1b0143=_0x1b0143-0x0;var _0x3f7637=_0x94c5[_0x1b0143];return _0x3f7637;};'use strict';var Sequelize=require(_0x594c('0x0'));module[_0x594c('0x1')]={'name':{'type':Sequelize[_0x594c('0x2')],'unique':_0x594c('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x594c('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x594c('0x2')]},'original_format':{'type':Sequelize[_0x594c('0x2')]},'original_duration':{'type':Sequelize[_0x594c('0x4')]},'original_sampleCount':{'type':Sequelize[_0x594c('0x5')]},'original_channelCount':{'type':Sequelize[_0x594c('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x594c('0x2')]},'converted_duration':{'type':Sequelize[_0x594c('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x594c('0x5')]},'converted_channelCount':{'type':Sequelize[_0x594c('0x6')]},'converted_bitRate':{'type':Sequelize[_0x594c('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x594c('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 7451061..5ef2974 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 _0xb255=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','find','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','download','format','%s.%s','basename','file','extname','originalname','wav','root','server/files/sounds/original','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','src','duration','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','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','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Sounds','UserProfileResource','sendStatus','error','stack','name','index','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x19d4ae,_0x43245){var _0x1193b8=function(_0x3ce6ed){while(--_0x3ce6ed){_0x19d4ae['push'](_0x19d4ae['shift']());}};_0x1193b8(++_0x43245);}(_0xb255,0xb4));var _0x5b25=function(_0x152aad,_0x45310e){_0x152aad=_0x152aad-0x0;var _0x10e985=_0xb255[_0x152aad];return _0x10e985;};'use strict';var emlformat=require(_0x5b25('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b25('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b25('0x2'));var moment=require(_0x5b25('0x3'));var BPromise=require(_0x5b25('0x4'));var Mustache=require(_0x5b25('0x5'));var util=require(_0x5b25('0x6'));var path=require('path');var sox=require(_0x5b25('0x7'));var csv=require(_0x5b25('0x8'));var ejs=require(_0x5b25('0x9'));var fs=require('fs');var fs_extra=require(_0x5b25('0xa'));var _=require(_0x5b25('0xb'));var squel=require(_0x5b25('0xc'));var crypto=require(_0x5b25('0xd'));var jsforce=require(_0x5b25('0xe'));var deskjs=require(_0x5b25('0xf'));var toCsv=require(_0x5b25('0x8'));var querystring=require('querystring');var Papa=require(_0x5b25('0x10'));var Redis=require(_0x5b25('0x11'));var authService=require(_0x5b25('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5b25('0x13'));var hardwareService=require(_0x5b25('0x14'));var logger=require(_0x5b25('0x15'))(_0x5b25('0x16'));var utils=require(_0x5b25('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d7180,_0xdc4999){_0xdc4999=_0xdc4999||0xcc;return function(_0x58e0d4){if(_0x58e0d4){return _0x5d7180['sendStatus'](_0xdc4999);}return _0x5d7180[_0x5b25('0x18')](_0xdc4999)[_0x5b25('0x19')]();};}function respondWithResult(_0x3211bb,_0x31ed5a){_0x31ed5a=_0x31ed5a||0xc8;return function(_0x2acadf){if(_0x2acadf){return _0x3211bb[_0x5b25('0x18')](_0x31ed5a)[_0x5b25('0x1a')](_0x2acadf);}};}function respondWithFilteredResult(_0xa3df77,_0x7749ca){return function(_0x26d035){if(_0x26d035){var _0x1f606a=typeof _0x7749ca['offset']==='undefined'&&typeof _0x7749ca[_0x5b25('0x1b')]===_0x5b25('0x1c');var _0x1c4710=_0x26d035['count'];var _0x3bf897=_0x1f606a?0x0:_0x7749ca[_0x5b25('0x1d')];var _0x1f8a61=_0x1f606a?_0x26d035[_0x5b25('0x1e')]:_0x7749ca[_0x5b25('0x1d')]+_0x7749ca[_0x5b25('0x1b')];var _0x9bddf0;if(_0x1f8a61>=_0x1c4710){_0x1f8a61=_0x1c4710;_0x9bddf0=0xc8;}else{_0x9bddf0=0xce;}_0xa3df77[_0x5b25('0x18')](_0x9bddf0);return _0xa3df77[_0x5b25('0x1f')](_0x5b25('0x20'),_0x3bf897+'-'+_0x1f8a61+'/'+_0x1c4710)[_0x5b25('0x1a')](_0x26d035);}return null;};}function patchUpdates(_0x11954d){return function(_0xdb8731){try{jsonpatch[_0x5b25('0x21')](_0xdb8731,_0x11954d,!![]);}catch(_0x56a890){return BPromise[_0x5b25('0x22')](_0x56a890);}return _0xdb8731[_0x5b25('0x23')]();};}function saveUpdates(_0x492e95,_0x5ec256){return function(_0x306fe6){if(_0x306fe6){return _0x306fe6[_0x5b25('0x24')](_0x492e95)['then'](function(_0x7d4e68){return _0x7d4e68;});}return null;};}function removeEntity(_0x3ca210,_0x4c39eb){return function(_0x29142c){if(_0x29142c){return _0x29142c[_0x5b25('0x25')]()[_0x5b25('0x26')](function(){var _0x3c4f1a=_0x29142c[_0x5b25('0x27')]({'plain':!![]});var _0x3a0e94=_0x5b25('0x28');return db[_0x5b25('0x29')][_0x5b25('0x25')]({'where':{'type':_0x3a0e94,'resourceId':_0x3c4f1a['id']}})[_0x5b25('0x26')](function(){return _0x29142c;});})['then'](function(){_0x3ca210[_0x5b25('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x334525,_0x246304){return function(_0xf27f5a){if(!_0xf27f5a){_0x334525[_0x5b25('0x2a')](0x194);}return _0xf27f5a;};}function handleError(_0x268cd0,_0x3e16ac){_0x3e16ac=_0x3e16ac||0x1f4;return function(_0x25a861){logger[_0x5b25('0x2b')](_0x25a861[_0x5b25('0x2c')]);if(_0x25a861[_0x5b25('0x2d')]){delete _0x25a861[_0x5b25('0x2d')];}_0x268cd0['status'](_0x3e16ac)['send'](_0x25a861);};}exports[_0x5b25('0x2e')]=function(_0x178d60,_0x3cfe97){var _0x17a807={},_0x577f21={},_0x4ea5a6={'count':0x0,'rows':[]};var _0xe92721=_['map'](db[_0x5b25('0x2f')][_0x5b25('0x30')],function(_0x312405){return{'name':_0x312405[_0x5b25('0x31')],'type':_0x312405[_0x5b25('0x32')][_0x5b25('0x33')]};});_0x577f21[_0x5b25('0x34')]=_['map'](_0xe92721,_0x5b25('0x2d'));_0x577f21[_0x5b25('0x35')]=_[_0x5b25('0x36')](_0x178d60[_0x5b25('0x35')]);_0x577f21[_0x5b25('0x37')]=_[_0x5b25('0x38')](_0x577f21[_0x5b25('0x34')],_0x577f21[_0x5b25('0x35')]);_0x17a807['attributes']=_[_0x5b25('0x38')](_0x577f21[_0x5b25('0x34')],qs['fields'](_0x178d60[_0x5b25('0x35')][_0x5b25('0x39')]));_0x17a807[_0x5b25('0x3a')]=_0x17a807[_0x5b25('0x3a')][_0x5b25('0x3b')]?_0x17a807[_0x5b25('0x3a')]:_0x577f21['model'];if(!_0x178d60[_0x5b25('0x35')][_0x5b25('0x3c')](_0x5b25('0x3d'))){_0x17a807[_0x5b25('0x1b')]=qs[_0x5b25('0x1b')](_0x178d60[_0x5b25('0x35')]['limit']);_0x17a807['offset']=qs[_0x5b25('0x1d')](_0x178d60[_0x5b25('0x35')][_0x5b25('0x1d')]);}_0x17a807['order']=qs[_0x5b25('0x3e')](_0x178d60[_0x5b25('0x35')][_0x5b25('0x3e')]);_0x17a807[_0x5b25('0x3f')]=qs['filters'](_[_0x5b25('0x40')](_0x178d60[_0x5b25('0x35')],_0x577f21[_0x5b25('0x37')]),_0xe92721);if(_0x178d60[_0x5b25('0x35')][_0x5b25('0x41')]){_0x17a807[_0x5b25('0x3f')]=_[_0x5b25('0x42')](_0x17a807[_0x5b25('0x3f')],{'$or':_['map'](_0xe92721,function(_0x426c96){if(_0x426c96[_0x5b25('0x32')]!==_0x5b25('0x43')){var _0x294183={};_0x294183[_0x426c96[_0x5b25('0x2d')]]={'$like':'%'+_0x178d60['query'][_0x5b25('0x41')]+'%'};return _0x294183;}})});}_0x17a807=_['merge']({},_0x17a807,_0x178d60[_0x5b25('0x44')]);var _0x264fbd={'where':_0x17a807['where']};return db[_0x5b25('0x2f')][_0x5b25('0x1e')](_0x264fbd)[_0x5b25('0x26')](function(_0x2d816a){_0x4ea5a6[_0x5b25('0x1e')]=_0x2d816a;if(_0x178d60[_0x5b25('0x35')]['includeAll']){_0x17a807[_0x5b25('0x45')]=[{'all':!![]}];}return db[_0x5b25('0x2f')][_0x5b25('0x46')](_0x17a807);})[_0x5b25('0x26')](function(_0x28e546){_0x4ea5a6['rows']=_0x28e546;return _0x4ea5a6;})[_0x5b25('0x26')](respondWithFilteredResult(_0x3cfe97,_0x17a807))[_0x5b25('0x47')](handleError(_0x3cfe97,null));};exports[_0x5b25('0x48')]=function(_0x17dd33,_0x43487b){var _0x9a1bc6={'raw':!![],'where':{'id':_0x17dd33[_0x5b25('0x49')]['id']}},_0x23628b={};_0x23628b[_0x5b25('0x34')]=_[_0x5b25('0x36')](db[_0x5b25('0x2f')]['rawAttributes']);_0x23628b['query']=_[_0x5b25('0x36')](_0x17dd33['query']);_0x23628b[_0x5b25('0x37')]=_[_0x5b25('0x38')](_0x23628b[_0x5b25('0x34')],_0x23628b[_0x5b25('0x35')]);_0x9a1bc6[_0x5b25('0x3a')]=_[_0x5b25('0x38')](_0x23628b[_0x5b25('0x34')],qs['fields'](_0x17dd33[_0x5b25('0x35')]['fields']));_0x9a1bc6[_0x5b25('0x3a')]=_0x9a1bc6[_0x5b25('0x3a')][_0x5b25('0x3b')]?_0x9a1bc6[_0x5b25('0x3a')]:_0x23628b['model'];if(_0x17dd33[_0x5b25('0x35')]['includeAll']){_0x9a1bc6[_0x5b25('0x45')]=[{'all':!![]}];}_0x9a1bc6=_['merge']({},_0x9a1bc6,_0x17dd33[_0x5b25('0x44')]);return db['Sound']['find'](_0x9a1bc6)['then'](handleEntityNotFound(_0x43487b,null))[_0x5b25('0x26')](respondWithResult(_0x43487b,null))[_0x5b25('0x47')](handleError(_0x43487b,null));};exports['download']=function(_0x4b9189,_0x402605,_0x3963d6){return db[_0x5b25('0x2f')][_0x5b25('0x4a')]({'where':{'id':_0x4b9189[_0x5b25('0x49')]['id']},'attributes':['name',_0x5b25('0x4b'),_0x5b25('0x4c')],'raw':!![]})[_0x5b25('0x26')](handleEntityNotFound(_0x402605,null))['then'](function(_0x413c43){if(_0x413c43){if(!fs[_0x5b25('0x4d')](path[_0x5b25('0x4e')](config['root'],_0x5b25('0x4f'),_0x413c43['save_name']+'.'+_0x413c43[_0x5b25('0x4c')]))){throw new db[(_0x5b25('0x50'))]['ValidationError']('Sound\x20not\x20found');}return _0x402605[_0x5b25('0x51')](path[_0x5b25('0x4e')](config['root'],_0x5b25('0x4f'),util[_0x5b25('0x52')](_0x5b25('0x53'),_0x413c43['save_name'],_0x413c43[_0x5b25('0x4c')])),util[_0x5b25('0x52')](_0x5b25('0x53'),_0x413c43['name'],_0x413c43[_0x5b25('0x4c')]));}return null;})[_0x5b25('0x47')](handleError(_0x402605,null));};exports['create']=function(_0x423161,_0x263b60,_0x41d9bb){var _0x4c607a={'name':path[_0x5b25('0x54')](_0x423161[_0x5b25('0x55')]['originalname'],path[_0x5b25('0x56')](_0x423161['file'][_0x5b25('0x57')])),'save_name':path[_0x5b25('0x54')](_0x423161['file']['filename'],path[_0x5b25('0x56')](_0x423161['file']['filename'])),'original_format':path[_0x5b25('0x56')](_0x423161[_0x5b25('0x55')][_0x5b25('0x57')])['substring'](0x1),'converted_format':_0x5b25('0x58')};var _0xfd3776=path['join'](config[_0x5b25('0x59')],_0x5b25('0x5a'),_0x423161[_0x5b25('0x55')]['filename']);var _0x558599=path[_0x5b25('0x4e')](config[_0x5b25('0x59')],_0x5b25('0x4f'),util['format'](_0x5b25('0x53'),path[_0x5b25('0x54')](_0x423161[_0x5b25('0x55')][_0x5b25('0x5b')],path['extname'](_0x423161[_0x5b25('0x55')]['filename'])),_0x4c607a[_0x5b25('0x4c')]));logger[_0x5b25('0x5c')](_0x5b25('0x5d'),_0xfd3776);logger[_0x5b25('0x5c')](_0x5b25('0x5e'),_0x558599);try{fs[_0x5b25('0x5f')](_0xfd3776,parseInt(_0x5b25('0x60'),0x8));var _0x39a42a=sox[_0x5b25('0x61')](_0xfd3776,_0x558599,{'sampleRate':0x1f40,'format':_0x5b25('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x39a42a['on'](_0x5b25('0x2b'),function(_0x1bf9bc){fs[_0x5b25('0x62')](_0xfd3776);_0x263b60['status'](0x1f4)[_0x5b25('0x63')](_0x1bf9bc);});_0x39a42a['on'](_0x5b25('0x64'),function(_0x52285b){_0x4c607a['original_duration']=isNaN(_0x52285b[_0x5b25('0x65')])?null:_0x52285b[_0x5b25('0x65')]*0x3e8;_0x4c607a['original_sampleCount']=isNaN(_0x52285b[_0x5b25('0x66')])?null:_0x52285b[_0x5b25('0x66')];_0x4c607a['original_channelCount']=isNaN(_0x52285b[_0x5b25('0x67')])?null:_0x52285b[_0x5b25('0x67')];_0x4c607a['original_bitRate']=isNaN(_0x52285b['bitRate'])?null:_0x52285b[_0x5b25('0x68')];_0x4c607a[_0x5b25('0x69')]=isNaN(_0x52285b[_0x5b25('0x6a')])?null:_0x52285b[_0x5b25('0x6a')];});_0x39a42a['on']('dest',function(_0x5f562d){_0x4c607a[_0x5b25('0x6b')]=isNaN(_0x5f562d['duration'])?null:_0x5f562d[_0x5b25('0x65')]*0x3e8;_0x4c607a[_0x5b25('0x6c')]=isNaN(_0x5f562d['sampleCount'])?null:_0x5f562d[_0x5b25('0x66')];_0x4c607a['converted_channelCount']=isNaN(_0x5f562d[_0x5b25('0x67')])?null:_0x5f562d[_0x5b25('0x67')];_0x4c607a[_0x5b25('0x6d')]=isNaN(_0x5f562d[_0x5b25('0x68')])?null:_0x5f562d[_0x5b25('0x68')];_0x4c607a[_0x5b25('0x6e')]=isNaN(_0x5f562d[_0x5b25('0x6a')])?null:_0x5f562d[_0x5b25('0x6a')];});_0x39a42a['on'](_0x5b25('0x19'),function(){fs[_0x5b25('0x5f')](_0x558599,parseInt(_0x5b25('0x60'),0x8));return db['Sound']['create'](_0x4c607a)[_0x5b25('0x26')](function(_0x4640c8){var _0x4d40de={'role':_0x423161[_0x5b25('0x6f')][_0x5b25('0x70')],'userProfileId':_0x423161[_0x5b25('0x6f')][_0x5b25('0x71')]};if(!_0x4d40de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d40de[_0x5b25('0x70')]==='user'){var _0x6d0c9f=_0x4640c8[_0x5b25('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x5b25('0x4a')]({'where':{'name':_0x5b25('0x28'),'userProfileId':_0x4d40de[_0x5b25('0x71')]},'raw':!![]})[_0x5b25('0x26')](function(_0xa56e1b){if(_0xa56e1b&&_0xa56e1b[_0x5b25('0x72')]===0x0){return db[_0x5b25('0x29')][_0x5b25('0x73')]({'name':_0x6d0c9f[_0x5b25('0x2d')],'resourceId':_0x6d0c9f['id'],'type':_0xa56e1b[_0x5b25('0x2d')],'sectionId':_0xa56e1b['id']},{})['then'](function(){return _0x4640c8;});}else{return _0x4640c8;}})[_0x5b25('0x47')](function(_0x31130d){logger[_0x5b25('0x2b')](_0x5b25('0x74'),_0x31130d);throw _0x31130d;});}return _0x4640c8;})[_0x5b25('0x26')](respondWithResult(_0x263b60,null))[_0x5b25('0x47')](handleError(_0x263b60,null));});_0x39a42a[_0x5b25('0x75')]();}catch(_0xe7360f){_0x263b60[_0x5b25('0x18')](0x1f4)[_0x5b25('0x63')](_0xe7360f);}};exports[_0x5b25('0x24')]=function(_0x45b60b,_0x43952e,_0x6458ff){return db[_0x5b25('0x2f')][_0x5b25('0x4a')]({'where':{'id':_0x45b60b[_0x5b25('0x49')]['id']}})[_0x5b25('0x26')](handleEntityNotFound(_0x43952e,null))[_0x5b25('0x26')](saveUpdates(_[_0x5b25('0x40')](_0x45b60b['body'],['name','description']),null))[_0x5b25('0x26')](respondWithResult(_0x43952e,null))['catch'](handleError(_0x43952e,null));};exports[_0x5b25('0x76')]=function(_0x11841d,_0x9f9bba,_0x303f68){return db[_0x5b25('0x2f')][_0x5b25('0x4a')]({'where':{'id':_0x11841d[_0x5b25('0x49')]['id']}})['then'](function(_0x2a50b4){if(_0x2a50b4){return _0x2a50b4[_0x5b25('0x25')]();}})['then'](function(_0x5d6041){var _0xd19c72=path[_0x5b25('0x4e')](config[_0x5b25('0x59')],_0x5b25('0x5a'),util['format'](_0x5b25('0x53'),_0x5d6041['save_name'],_0x5d6041[_0x5b25('0x77')]));var _0x49c9bd=path['join'](config[_0x5b25('0x59')],_0x5b25('0x4f'),util['format']('%s.%s',_0x5d6041['save_name'],_0x5d6041['converted_format']));fs[_0x5b25('0x62')](_0xd19c72);fs['unlinkSync'](_0x49c9bd);return _0x5d6041;})[_0x5b25('0x26')](function(_0x226906){if(_0x226906){return _0x9f9bba[_0x5b25('0x18')](0xcc)[_0x5b25('0x19')]();}})[_0x5b25('0x26')](handleEntityNotFound(_0x9f9bba,null))[_0x5b25('0x47')](handleError(_0x9f9bba,null));}; \ No newline at end of file +var _0xa214=['type','VIRTUAL','merge','Sound','includeAll','include','findAll','rows','catch','show','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','file','originalname','extname','filename','substring','server/files/sounds/original','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','wav','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','0777','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','UserProfileResource','params','description','delete','original_format','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','limit','undefined','count','offset','set','reject','save','update','then','Sounds','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter'];(function(_0x19ea6d,_0x521402){var _0x126c7d=function(_0x13c1bb){while(--_0x13c1bb){_0x19ea6d['push'](_0x19ea6d['shift']());}};_0x126c7d(++_0x521402);}(_0xa214,0xbb));var _0x4a21=function(_0x2ebda5,_0x18c875){_0x2ebda5=_0x2ebda5-0x0;var _0x41356f=_0xa214[_0x2ebda5];return _0x41356f;};'use strict';var emlformat=require(_0x4a21('0x0'));var rimraf=require(_0x4a21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a21('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4a21('0x3'));var Mustache=require(_0x4a21('0x4'));var util=require(_0x4a21('0x5'));var path=require(_0x4a21('0x6'));var sox=require(_0x4a21('0x7'));var csv=require(_0x4a21('0x8'));var ejs=require(_0x4a21('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a21('0xa'));var squel=require(_0x4a21('0xb'));var crypto=require(_0x4a21('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4a21('0x8'));var querystring=require(_0x4a21('0xd'));var Papa=require(_0x4a21('0xe'));var Redis=require(_0x4a21('0xf'));var authService=require(_0x4a21('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a21('0x11'))(_0x4a21('0x12'));var utils=require(_0x4a21('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4a21('0x14'))['db'];function respondWithStatusCode(_0x4141d5,_0x23e8ce){_0x23e8ce=_0x23e8ce||0xcc;return function(_0x1bd22e){if(_0x1bd22e){return _0x4141d5['sendStatus'](_0x23e8ce);}return _0x4141d5['status'](_0x23e8ce)[_0x4a21('0x15')]();};}function respondWithResult(_0x253537,_0x4e5996){_0x4e5996=_0x4e5996||0xc8;return function(_0x473d71){if(_0x473d71){return _0x253537[_0x4a21('0x16')](_0x4e5996)[_0x4a21('0x17')](_0x473d71);}};}function respondWithFilteredResult(_0x246ed1,_0x4bda71){return function(_0x3f34c0){if(_0x3f34c0){var _0x26c181=typeof _0x4bda71['offset']==='undefined'&&typeof _0x4bda71[_0x4a21('0x18')]===_0x4a21('0x19');var _0x49deb9=_0x3f34c0[_0x4a21('0x1a')];var _0x2beb20=_0x26c181?0x0:_0x4bda71['offset'];var _0x254bed=_0x26c181?_0x3f34c0['count']:_0x4bda71[_0x4a21('0x1b')]+_0x4bda71['limit'];var _0x5c9781;if(_0x254bed>=_0x49deb9){_0x254bed=_0x49deb9;_0x5c9781=0xc8;}else{_0x5c9781=0xce;}_0x246ed1[_0x4a21('0x16')](_0x5c9781);return _0x246ed1[_0x4a21('0x1c')]('Content-Range',_0x2beb20+'-'+_0x254bed+'/'+_0x49deb9)[_0x4a21('0x17')](_0x3f34c0);}return null;};}function patchUpdates(_0x153e1d){return function(_0x4dcbcd){try{jsonpatch['apply'](_0x4dcbcd,_0x153e1d,!![]);}catch(_0x450e30){return BPromise[_0x4a21('0x1d')](_0x450e30);}return _0x4dcbcd[_0x4a21('0x1e')]();};}function saveUpdates(_0x56681c,_0x441d43){return function(_0x6590a7){if(_0x6590a7){return _0x6590a7[_0x4a21('0x1f')](_0x56681c)['then'](function(_0x327845){return _0x327845;});}return null;};}function removeEntity(_0x3ba7ac,_0x56b2ce){return function(_0x5bbc5b){if(_0x5bbc5b){return _0x5bbc5b['destroy']()[_0x4a21('0x20')](function(){var _0xec5341=_0x5bbc5b['get']({'plain':!![]});var _0x424d73=_0x4a21('0x21');return db['UserProfileResource'][_0x4a21('0x22')]({'where':{'type':_0x424d73,'resourceId':_0xec5341['id']}})[_0x4a21('0x20')](function(){return _0x5bbc5b;});})['then'](function(){_0x3ba7ac['status'](0xcc)[_0x4a21('0x15')]();});}};}function handleEntityNotFound(_0x19a4d3,_0x417c06){return function(_0x5e0eeb){if(!_0x5e0eeb){_0x19a4d3[_0x4a21('0x23')](0x194);}return _0x5e0eeb;};}function handleError(_0x33c67a,_0x39a0c7){_0x39a0c7=_0x39a0c7||0x1f4;return function(_0x53052f){logger[_0x4a21('0x24')](_0x53052f['stack']);if(_0x53052f[_0x4a21('0x25')]){delete _0x53052f['name'];}_0x33c67a[_0x4a21('0x16')](_0x39a0c7)[_0x4a21('0x26')](_0x53052f);};}exports[_0x4a21('0x27')]=function(_0x4c2467,_0x233d98){var _0x120696={},_0x2d218a={},_0x104770={'count':0x0,'rows':[]};var _0x4e2508=_[_0x4a21('0x28')](db['Sound'][_0x4a21('0x29')],function(_0x452b48){return{'name':_0x452b48[_0x4a21('0x2a')],'type':_0x452b48['type'][_0x4a21('0x2b')]};});_0x2d218a['model']=_[_0x4a21('0x28')](_0x4e2508,_0x4a21('0x25'));_0x2d218a[_0x4a21('0x2c')]=_[_0x4a21('0x2d')](_0x4c2467[_0x4a21('0x2c')]);_0x2d218a[_0x4a21('0x2e')]=_[_0x4a21('0x2f')](_0x2d218a[_0x4a21('0x30')],_0x2d218a['query']);_0x120696['attributes']=_[_0x4a21('0x2f')](_0x2d218a[_0x4a21('0x30')],qs['fields'](_0x4c2467['query'][_0x4a21('0x31')]));_0x120696[_0x4a21('0x32')]=_0x120696[_0x4a21('0x32')][_0x4a21('0x33')]?_0x120696[_0x4a21('0x32')]:_0x2d218a[_0x4a21('0x30')];if(!_0x4c2467[_0x4a21('0x2c')][_0x4a21('0x34')]('nolimit')){_0x120696['limit']=qs[_0x4a21('0x18')](_0x4c2467[_0x4a21('0x2c')]['limit']);_0x120696['offset']=qs[_0x4a21('0x1b')](_0x4c2467[_0x4a21('0x2c')][_0x4a21('0x1b')]);}_0x120696['order']=qs['sort'](_0x4c2467[_0x4a21('0x2c')][_0x4a21('0x35')]);_0x120696[_0x4a21('0x36')]=qs[_0x4a21('0x2e')](_[_0x4a21('0x37')](_0x4c2467[_0x4a21('0x2c')],_0x2d218a[_0x4a21('0x2e')]),_0x4e2508);if(_0x4c2467['query'][_0x4a21('0x38')]){_0x120696[_0x4a21('0x36')]=_['merge'](_0x120696[_0x4a21('0x36')],{'$or':_[_0x4a21('0x28')](_0x4e2508,function(_0xcb3b8){if(_0xcb3b8[_0x4a21('0x39')]!==_0x4a21('0x3a')){var _0x1e08f3={};_0x1e08f3[_0xcb3b8['name']]={'$like':'%'+_0x4c2467['query'][_0x4a21('0x38')]+'%'};return _0x1e08f3;}})});}_0x120696=_[_0x4a21('0x3b')]({},_0x120696,_0x4c2467['options']);var _0x48ff6b={'where':_0x120696[_0x4a21('0x36')]};return db[_0x4a21('0x3c')][_0x4a21('0x1a')](_0x48ff6b)[_0x4a21('0x20')](function(_0x2291be){_0x104770['count']=_0x2291be;if(_0x4c2467['query'][_0x4a21('0x3d')]){_0x120696[_0x4a21('0x3e')]=[{'all':!![]}];}return db['Sound'][_0x4a21('0x3f')](_0x120696);})[_0x4a21('0x20')](function(_0x1a8fe6){_0x104770[_0x4a21('0x40')]=_0x1a8fe6;return _0x104770;})[_0x4a21('0x20')](respondWithFilteredResult(_0x233d98,_0x120696))[_0x4a21('0x41')](handleError(_0x233d98,null));};exports[_0x4a21('0x42')]=function(_0x51bdfa,_0xd922a1){var _0xceef01={'raw':!![],'where':{'id':_0x51bdfa['params']['id']}},_0x40c07f={};_0x40c07f[_0x4a21('0x30')]=_['keys'](db['Sound'][_0x4a21('0x29')]);_0x40c07f[_0x4a21('0x2c')]=_[_0x4a21('0x2d')](_0x51bdfa[_0x4a21('0x2c')]);_0x40c07f[_0x4a21('0x2e')]=_['intersection'](_0x40c07f[_0x4a21('0x30')],_0x40c07f['query']);_0xceef01[_0x4a21('0x32')]=_[_0x4a21('0x2f')](_0x40c07f[_0x4a21('0x30')],qs[_0x4a21('0x31')](_0x51bdfa['query'][_0x4a21('0x31')]));_0xceef01[_0x4a21('0x32')]=_0xceef01['attributes'][_0x4a21('0x33')]?_0xceef01[_0x4a21('0x32')]:_0x40c07f['model'];if(_0x51bdfa[_0x4a21('0x2c')][_0x4a21('0x3d')]){_0xceef01[_0x4a21('0x3e')]=[{'all':!![]}];}_0xceef01=_[_0x4a21('0x3b')]({},_0xceef01,_0x51bdfa['options']);return db[_0x4a21('0x3c')][_0x4a21('0x43')](_0xceef01)['then'](handleEntityNotFound(_0xd922a1,null))[_0x4a21('0x20')](respondWithResult(_0xd922a1,null))['catch'](handleError(_0xd922a1,null));};exports[_0x4a21('0x44')]=function(_0x249be5,_0x1a97d7,_0x540cba){return db[_0x4a21('0x3c')][_0x4a21('0x43')]({'where':{'id':_0x249be5['params']['id']},'attributes':[_0x4a21('0x25'),_0x4a21('0x45'),_0x4a21('0x46')],'raw':!![]})['then'](handleEntityNotFound(_0x1a97d7,null))[_0x4a21('0x20')](function(_0x4de80a){if(_0x4de80a){if(!fs[_0x4a21('0x47')](path[_0x4a21('0x48')](config[_0x4a21('0x49')],_0x4a21('0x4a'),_0x4de80a[_0x4a21('0x45')]+'.'+_0x4de80a[_0x4a21('0x46')]))){throw new db[(_0x4a21('0x4b'))][(_0x4a21('0x4c'))](_0x4a21('0x4d'));}return _0x1a97d7[_0x4a21('0x44')](path[_0x4a21('0x48')](config[_0x4a21('0x49')],_0x4a21('0x4a'),util[_0x4a21('0x4e')]('%s.%s',_0x4de80a[_0x4a21('0x45')],_0x4de80a['converted_format'])),util[_0x4a21('0x4e')](_0x4a21('0x4f'),_0x4de80a['name'],_0x4de80a[_0x4a21('0x46')]));}return null;})[_0x4a21('0x41')](handleError(_0x1a97d7,null));};exports['create']=function(_0xd0b0e4,_0x4ac97f,_0x316130){var _0x4fe8e4={'name':path['basename'](_0xd0b0e4[_0x4a21('0x50')][_0x4a21('0x51')],path[_0x4a21('0x52')](_0xd0b0e4[_0x4a21('0x50')][_0x4a21('0x51')])),'save_name':path['basename'](_0xd0b0e4['file'][_0x4a21('0x53')],path[_0x4a21('0x52')](_0xd0b0e4[_0x4a21('0x50')]['filename'])),'original_format':path[_0x4a21('0x52')](_0xd0b0e4[_0x4a21('0x50')][_0x4a21('0x51')])[_0x4a21('0x54')](0x1),'converted_format':'wav'};var _0x336cde=path[_0x4a21('0x48')](config[_0x4a21('0x49')],_0x4a21('0x55'),_0xd0b0e4[_0x4a21('0x50')][_0x4a21('0x53')]);var _0x29bf13=path[_0x4a21('0x48')](config[_0x4a21('0x49')],_0x4a21('0x4a'),util[_0x4a21('0x4e')](_0x4a21('0x4f'),path[_0x4a21('0x56')](_0xd0b0e4[_0x4a21('0x50')]['filename'],path['extname'](_0xd0b0e4[_0x4a21('0x50')][_0x4a21('0x53')])),_0x4fe8e4[_0x4a21('0x46')]));logger[_0x4a21('0x57')](_0x4a21('0x58'),_0x336cde);logger[_0x4a21('0x57')](_0x4a21('0x59'),_0x29bf13);try{fs[_0x4a21('0x5a')](_0x336cde,parseInt('0777',0x8));var _0x44b644=sox[_0x4a21('0x5b')](_0x336cde,_0x29bf13,{'sampleRate':0x1f40,'format':_0x4a21('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x44b644['on'](_0x4a21('0x24'),function(_0x5a250d){fs[_0x4a21('0x5d')](_0x336cde);_0x4ac97f[_0x4a21('0x16')](0x1f4)[_0x4a21('0x26')](_0x5a250d);});_0x44b644['on']('src',function(_0x286a0e){_0x4fe8e4[_0x4a21('0x5e')]=isNaN(_0x286a0e[_0x4a21('0x5f')])?null:_0x286a0e[_0x4a21('0x5f')]*0x3e8;_0x4fe8e4[_0x4a21('0x60')]=isNaN(_0x286a0e['sampleCount'])?null:_0x286a0e[_0x4a21('0x61')];_0x4fe8e4[_0x4a21('0x62')]=isNaN(_0x286a0e[_0x4a21('0x63')])?null:_0x286a0e['channelCount'];_0x4fe8e4['original_bitRate']=isNaN(_0x286a0e[_0x4a21('0x64')])?null:_0x286a0e[_0x4a21('0x64')];_0x4fe8e4[_0x4a21('0x65')]=isNaN(_0x286a0e[_0x4a21('0x66')])?null:_0x286a0e[_0x4a21('0x66')];});_0x44b644['on'](_0x4a21('0x67'),function(_0x283990){_0x4fe8e4[_0x4a21('0x68')]=isNaN(_0x283990[_0x4a21('0x5f')])?null:_0x283990[_0x4a21('0x5f')]*0x3e8;_0x4fe8e4[_0x4a21('0x69')]=isNaN(_0x283990[_0x4a21('0x61')])?null:_0x283990[_0x4a21('0x61')];_0x4fe8e4[_0x4a21('0x6a')]=isNaN(_0x283990[_0x4a21('0x63')])?null:_0x283990[_0x4a21('0x63')];_0x4fe8e4[_0x4a21('0x6b')]=isNaN(_0x283990[_0x4a21('0x64')])?null:_0x283990['bitRate'];_0x4fe8e4['converted_sampleRate']=isNaN(_0x283990[_0x4a21('0x66')])?null:_0x283990[_0x4a21('0x66')];});_0x44b644['on'](_0x4a21('0x15'),function(){fs[_0x4a21('0x5a')](_0x29bf13,parseInt(_0x4a21('0x6c'),0x8));return db[_0x4a21('0x3c')][_0x4a21('0x6d')](_0x4fe8e4)[_0x4a21('0x20')](function(_0x1277fb){var _0x19ad15={'role':_0xd0b0e4[_0x4a21('0x6e')]['role'],'userProfileId':_0xd0b0e4[_0x4a21('0x6e')]['userProfileId']};if(!_0x19ad15)throw new Error(_0x4a21('0x6f'));if(_0x19ad15[_0x4a21('0x70')]===_0x4a21('0x71')){var _0x340c97=_0x1277fb[_0x4a21('0x72')]({'plain':!![]});return db[_0x4a21('0x73')]['find']({'where':{'name':'Sounds','userProfileId':_0x19ad15['userProfileId']},'raw':!![]})[_0x4a21('0x20')](function(_0x3b542e){if(_0x3b542e&&_0x3b542e[_0x4a21('0x74')]===0x0){return db[_0x4a21('0x75')][_0x4a21('0x6d')]({'name':_0x340c97['name'],'resourceId':_0x340c97['id'],'type':_0x3b542e[_0x4a21('0x25')],'sectionId':_0x3b542e['id']},{})[_0x4a21('0x20')](function(){return _0x1277fb;});}else{return _0x1277fb;}})[_0x4a21('0x41')](function(_0x7a877c){logger[_0x4a21('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7a877c);throw _0x7a877c;});}return _0x1277fb;})[_0x4a21('0x20')](respondWithResult(_0x4ac97f,null))[_0x4a21('0x41')](handleError(_0x4ac97f,null));});_0x44b644['start']();}catch(_0x5be778){_0x4ac97f[_0x4a21('0x16')](0x1f4)[_0x4a21('0x26')](_0x5be778);}};exports[_0x4a21('0x1f')]=function(_0x2a08a6,_0x9e5ac0,_0x10cd7f){return db['Sound'][_0x4a21('0x43')]({'where':{'id':_0x2a08a6[_0x4a21('0x76')]['id']}})[_0x4a21('0x20')](handleEntityNotFound(_0x9e5ac0,null))[_0x4a21('0x20')](saveUpdates(_[_0x4a21('0x37')](_0x2a08a6['body'],['name',_0x4a21('0x77')]),null))[_0x4a21('0x20')](respondWithResult(_0x9e5ac0,null))[_0x4a21('0x41')](handleError(_0x9e5ac0,null));};exports[_0x4a21('0x78')]=function(_0x387ed4,_0x11c091,_0x310fe7){return db[_0x4a21('0x3c')][_0x4a21('0x43')]({'where':{'id':_0x387ed4[_0x4a21('0x76')]['id']}})[_0x4a21('0x20')](function(_0x5ca90b){if(_0x5ca90b){return _0x5ca90b[_0x4a21('0x22')]();}})[_0x4a21('0x20')](function(_0xe5deb6){var _0x5040fe=path['join'](config['root'],_0x4a21('0x55'),util[_0x4a21('0x4e')](_0x4a21('0x4f'),_0xe5deb6['save_name'],_0xe5deb6[_0x4a21('0x79')]));var _0xc68cc=path['join'](config[_0x4a21('0x49')],_0x4a21('0x4a'),util[_0x4a21('0x4e')]('%s.%s',_0xe5deb6[_0x4a21('0x45')],_0xe5deb6[_0x4a21('0x46')]));fs['unlinkSync'](_0x5040fe);fs[_0x4a21('0x5d')](_0xc68cc);return _0xe5deb6;})[_0x4a21('0x20')](function(_0x37bc3c){if(_0x37bc3c){return _0x11c091[_0x4a21('0x16')](0xcc)[_0x4a21('0x15')]();}})[_0x4a21('0x20')](handleEntityNotFound(_0x11c091,null))[_0x4a21('0x41')](handleError(_0x11c091,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 3f92328..5d97b19 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 _0xe978=['moment','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','../../config/logger','api'];(function(_0x297b2b,_0x11eb85){var _0x14754b=function(_0x377d2f){while(--_0x377d2f){_0x297b2b['push'](_0x297b2b['shift']());}};_0x14754b(++_0x11eb85);}(_0xe978,0x10e));var _0x8e97=function(_0x215f55,_0x47f7b3){_0x215f55=_0x215f55-0x0;var _0x2b66f3=_0xe978[_0x215f55];return _0x2b66f3;};'use strict';var _=require(_0x8e97('0x0'));var util=require('util');var logger=require(_0x8e97('0x1'))(_0x8e97('0x2'));var moment=require(_0x8e97('0x3'));var BPromise=require(_0x8e97('0x4'));var rp=require(_0x8e97('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e97('0x6'));var config=require(_0x8e97('0x7'));var attributes=require(_0x8e97('0x8'));module[_0x8e97('0x9')]=function(_0x16afff,_0x1bed91){return _0x16afff[_0x8e97('0xa')](_0x8e97('0xb'),attributes,{'tableName':_0x8e97('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2c8=['Sound','lodash','util','moment','bluebird','request-promise','../../config/environment','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf2c8,0x159));var _0x8f2c=function(_0x1ed5e4,_0x5df81a){_0x1ed5e4=_0x1ed5e4-0x0;var _0x2d0276=_0xf2c8[_0x1ed5e4];return _0x2d0276;};'use strict';var _=require(_0x8f2c('0x0'));var util=require(_0x8f2c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8f2c('0x2'));var BPromise=require(_0x8f2c('0x3'));var rp=require(_0x8f2c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8f2c('0x5'));var attributes=require('./sound.attributes');module['exports']=function(_0x56357d,_0x106647){return _0x56357d[_0x8f2c('0x6')](_0x8f2c('0x7'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index b5932d9..367cc6b 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 _0xb3d3=['debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSound','Sound','find','options','raw','include','map','model','attributes','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent'];(function(_0x5839c0,_0x4476f2){var _0x2704ec=function(_0x540d95){while(--_0x540d95){_0x5839c0['push'](_0x5839c0['shift']());}};_0x2704ec(++_0x4476f2);}(_0xb3d3,0x78));var _0x3b3d=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0xb3d3[_0x4ea413];return _0x51cf25;};'use strict';var _=require(_0x3b3d('0x0'));var util=require(_0x3b3d('0x1'));var moment=require(_0x3b3d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b3d('0x3'));var db=require(_0x3b3d('0x4'))['db'];var utils=require(_0x3b3d('0x5'));var logger=require(_0x3b3d('0x6'))(_0x3b3d('0x7'));var config=require(_0x3b3d('0x8'));var jayson=require(_0x3b3d('0x9'));var client=jayson[_0x3b3d('0xa')][_0x3b3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x594cb6,_0x34fd95,_0x55c2ed){return new BPromise(function(_0xaf7cfd,_0x41a94f){return client[_0x3b3d('0xc')](_0x594cb6,_0x55c2ed)[_0x3b3d('0xd')](function(_0x4d5d2f){logger['info'](_0x3b3d('0xe'),_0x34fd95,_0x3b3d('0xf'));logger[_0x3b3d('0x10')](_0x3b3d('0x11'),_0x34fd95,_0x3b3d('0xf'),JSON[_0x3b3d('0x12')](_0x4d5d2f));if(_0x4d5d2f[_0x3b3d('0x13')]){if(_0x4d5d2f[_0x3b3d('0x13')][_0x3b3d('0x14')]===0x1f4){logger[_0x3b3d('0x13')]('Sound,\x20%s,\x20%s',_0x34fd95,_0x4d5d2f['error'][_0x3b3d('0x15')]);return _0x41a94f(_0x4d5d2f[_0x3b3d('0x13')][_0x3b3d('0x15')]);}logger[_0x3b3d('0x13')](_0x3b3d('0xe'),_0x34fd95,_0x4d5d2f[_0x3b3d('0x13')][_0x3b3d('0x15')]);return _0xaf7cfd(_0x4d5d2f[_0x3b3d('0x13')]['message']);}else{logger[_0x3b3d('0x16')](_0x3b3d('0xe'),_0x34fd95,_0x3b3d('0xf'));_0xaf7cfd(_0x4d5d2f[_0x3b3d('0x17')][_0x3b3d('0x15')]);}})[_0x3b3d('0x18')](function(_0x1da761){logger[_0x3b3d('0x13')](_0x3b3d('0xe'),_0x34fd95,_0x1da761);_0x41a94f(_0x1da761);});});}exports[_0x3b3d('0x19')]=function(_0x4c37ca){var _0x46a383=this;return new Promise(function(_0x362f3f,_0x4fd857){return db[_0x3b3d('0x1a')][_0x3b3d('0x1b')]({'raw':_0x4c37ca['options']?_0x4c37ca[_0x3b3d('0x1c')][_0x3b3d('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c37ca[_0x3b3d('0x1c')]?_0x4c37ca[_0x3b3d('0x1c')]['where']||null:null,'attributes':_0x4c37ca[_0x3b3d('0x1c')]?_0x4c37ca[_0x3b3d('0x1c')]['attributes']||null:null,'include':_0x4c37ca[_0x3b3d('0x1c')]?_0x4c37ca['options'][_0x3b3d('0x1e')]?_[_0x3b3d('0x1f')](_0x4c37ca[_0x3b3d('0x1c')][_0x3b3d('0x1e')],function(_0x7807cd){return{'model':db[_0x7807cd[_0x3b3d('0x20')]],'as':_0x7807cd['as'],'attributes':_0x7807cd[_0x3b3d('0x21')],'include':_0x7807cd['include']?_[_0x3b3d('0x1f')](_0x7807cd[_0x3b3d('0x1e')],function(_0x174c44){return{'model':db[_0x174c44[_0x3b3d('0x20')]],'as':_0x174c44['as'],'attributes':_0x174c44[_0x3b3d('0x21')],'include':_0x174c44[_0x3b3d('0x1e')]?_['map'](_0x174c44[_0x3b3d('0x1e')],function(_0x4c19ee){return{'model':db[_0x4c19ee[_0x3b3d('0x20')]],'as':_0x4c19ee['as'],'attributes':_0x4c19ee[_0x3b3d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3b3d('0xd')](function(_0x1aeffe){logger['info'](_0x3b3d('0x19'),_0x4c37ca);logger[_0x3b3d('0x10')](_0x3b3d('0x19'),_0x4c37ca,JSON[_0x3b3d('0x12')](_0x1aeffe));_0x362f3f(_0x1aeffe);})['catch'](function(_0x19e64e){logger[_0x3b3d('0x13')](_0x3b3d('0x19'),_0x19e64e[_0x3b3d('0x15')],_0x4c37ca);_0x4fd857(_0x46a383[_0x3b3d('0x13')](0x1f4,_0x19e64e['message']));});});}; \ No newline at end of file +var _0xa48d=['model','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','ShowSound','Sound','options','raw','where','attributes','include','map'];(function(_0xf94618,_0x114c5e){var _0x3b550f=function(_0xb2f0a1){while(--_0xb2f0a1){_0xf94618['push'](_0xf94618['shift']());}};_0x3b550f(++_0x114c5e);}(_0xa48d,0x113));var _0xda48=function(_0x87311b,_0x4fb29c){_0x87311b=_0x87311b-0x0;var _0x295adf=_0xa48d[_0x87311b];return _0x295adf;};'use strict';var _=require(_0xda48('0x0'));var util=require(_0xda48('0x1'));var moment=require(_0xda48('0x2'));var BPromise=require(_0xda48('0x3'));var rs=require(_0xda48('0x4'));var fs=require('fs');var Redis=require(_0xda48('0x5'));var db=require(_0xda48('0x6'))['db'];var utils=require(_0xda48('0x7'));var logger=require(_0xda48('0x8'))(_0xda48('0x9'));var config=require(_0xda48('0xa'));var jayson=require(_0xda48('0xb'));var client=jayson[_0xda48('0xc')][_0xda48('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x523ab1,_0x19314b,_0x4fa864){return new BPromise(function(_0x39f710,_0x24fd32){return client[_0xda48('0xe')](_0x523ab1,_0x4fa864)['then'](function(_0x56137c){logger[_0xda48('0xf')](_0xda48('0x10'),_0x19314b,_0xda48('0x11'));logger[_0xda48('0x12')]('Sound,\x20%s,\x20%s,\x20%s',_0x19314b,_0xda48('0x11'),JSON[_0xda48('0x13')](_0x56137c));if(_0x56137c[_0xda48('0x14')]){if(_0x56137c[_0xda48('0x14')][_0xda48('0x15')]===0x1f4){logger[_0xda48('0x14')](_0xda48('0x10'),_0x19314b,_0x56137c['error']['message']);return _0x24fd32(_0x56137c[_0xda48('0x14')][_0xda48('0x16')]);}logger['error'](_0xda48('0x10'),_0x19314b,_0x56137c[_0xda48('0x14')]['message']);return _0x39f710(_0x56137c[_0xda48('0x14')][_0xda48('0x16')]);}else{logger[_0xda48('0xf')](_0xda48('0x10'),_0x19314b,_0xda48('0x11'));_0x39f710(_0x56137c['result'][_0xda48('0x16')]);}})['catch'](function(_0x1021ec){logger[_0xda48('0x14')]('Sound,\x20%s,\x20%s',_0x19314b,_0x1021ec);_0x24fd32(_0x1021ec);});});}exports[_0xda48('0x17')]=function(_0x13f822){var _0x41372a=this;return new Promise(function(_0x529e90,_0x5b2053){return db[_0xda48('0x18')]['find']({'raw':_0x13f822[_0xda48('0x19')]?_0x13f822[_0xda48('0x19')][_0xda48('0x1a')]===undefined?!![]:![]:!![],'where':_0x13f822[_0xda48('0x19')]?_0x13f822[_0xda48('0x19')][_0xda48('0x1b')]||null:null,'attributes':_0x13f822[_0xda48('0x19')]?_0x13f822[_0xda48('0x19')][_0xda48('0x1c')]||null:null,'include':_0x13f822[_0xda48('0x19')]?_0x13f822[_0xda48('0x19')][_0xda48('0x1d')]?_[_0xda48('0x1e')](_0x13f822[_0xda48('0x19')][_0xda48('0x1d')],function(_0xe1f1e1){return{'model':db[_0xe1f1e1['model']],'as':_0xe1f1e1['as'],'attributes':_0xe1f1e1[_0xda48('0x1c')],'include':_0xe1f1e1[_0xda48('0x1d')]?_[_0xda48('0x1e')](_0xe1f1e1[_0xda48('0x1d')],function(_0x1f78f3){return{'model':db[_0x1f78f3[_0xda48('0x1f')]],'as':_0x1f78f3['as'],'attributes':_0x1f78f3[_0xda48('0x1c')],'include':_0x1f78f3[_0xda48('0x1d')]?_[_0xda48('0x1e')](_0x1f78f3[_0xda48('0x1d')],function(_0x1fef4e){return{'model':db[_0x1fef4e[_0xda48('0x1f')]],'as':_0x1fef4e['as'],'attributes':_0x1fef4e[_0xda48('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xda48('0x20')](function(_0x23b12a){logger[_0xda48('0xf')](_0xda48('0x17'),_0x13f822);logger['debug']('ShowSound',_0x13f822,JSON[_0xda48('0x13')](_0x23b12a));_0x529e90(_0x23b12a);})[_0xda48('0x21')](function(_0x1bdd7e){logger[_0xda48('0x14')]('ShowSound',_0x1bdd7e[_0xda48('0x16')],_0x13f822);_0x5b2053(_0x41372a[_0xda48('0x14')](0x1f4,_0x1bdd7e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ae11d93..417c970 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 _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1a4a09,_0x1a6484){_0x1a4a09=_0x1a4a09-0x0;var _0x54c92c=_0x9ffd[_0x1a4a09];return _0x54c92c;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file +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(_0x43217e,_0x57b23f){var _0x41e042=function(_0x443f0b){while(--_0x443f0b){_0x43217e['push'](_0x43217e['shift']());}};_0x41e042(++_0x57b23f);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e78db,_0x5ab8a1){_0x2e78db=_0x2e78db-0x0;var _0x195fb4=_0xb10b[_0x2e78db];return _0x195fb4;};'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 diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 88d234c..a70f93c 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 _0xfb09=['STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x3c4e27,_0x481e0c){var _0x724fe7=function(_0x2c4920){while(--_0x2c4920){_0x3c4e27['push'](_0x3c4e27['shift']());}};_0x724fe7(++_0x481e0c);}(_0xfb09,0x19d));var _0x9fb0=function(_0x3fedc9,_0x7c2b77){_0x3fedc9=_0x3fedc9-0x0;var _0x22513f=_0xfb09[_0x3fedc9];return _0x22513f;};'use strict';var Sequelize=require(_0x9fb0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9fb0('0x1')]},'body':{'type':Sequelize[_0x9fb0('0x2')](_0x9fb0('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x9fb0('0x4')]('in',_0x9fb0('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9fb0('0x2')]}}; \ No newline at end of file +var _0xb0c2=['exports','STRING','TEXT','ENUM','out','sequelize'];(function(_0xe5f035,_0x25d156){var _0x8b1de9=function(_0x484db4){while(--_0x484db4){_0xe5f035['push'](_0xe5f035['shift']());}};_0x8b1de9(++_0x25d156);}(_0xb0c2,0x15b));var _0x2b0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb0c2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2b0c('0x0'));module[_0x2b0c('0x1')]={'uniqueid':{'type':Sequelize[_0x2b0c('0x2')]},'body':{'type':Sequelize[_0x2b0c('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x2b0c('0x4')]('in',_0x2b0c('0x5')),'defaultValue':_0x2b0c('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x2b0c('0x2')]},'providerResponse':{'type':Sequelize[_0x2b0c('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 1d2e29d..8bec866 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 _0x5c13=['json','apply','reject','save','update','then','error','name','index','map','SquareMessage','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','length','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x14bebd,_0x2d7427){var _0xf1c499=function(_0x47eab4){while(--_0x47eab4){_0x14bebd['push'](_0x14bebd['shift']());}};_0xf1c499(++_0x2d7427);}(_0x5c13,0x103));var _0x35c1=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x5c13[_0x338f73];return _0x163fdf;};'use strict';var emlformat=require(_0x35c1('0x0'));var rimraf=require(_0x35c1('0x1'));var zipdir=require(_0x35c1('0x2'));var jsonpatch=require(_0x35c1('0x3'));var rp=require(_0x35c1('0x4'));var moment=require(_0x35c1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x35c1('0x6'));var util=require(_0x35c1('0x7'));var path=require('path');var sox=require(_0x35c1('0x8'));var csv=require(_0x35c1('0x9'));var ejs=require(_0x35c1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35c1('0xb'));var squel=require(_0x35c1('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x35c1('0xd'));var toCsv=require(_0x35c1('0x9'));var querystring=require(_0x35c1('0xe'));var Papa=require(_0x35c1('0xf'));var Redis=require(_0x35c1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35c1('0x11'));var as=require(_0x35c1('0x12'));var hardwareService=require(_0x35c1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x35c1('0x14'));var config=require(_0x35c1('0x15'));var licenseUtil=require(_0x35c1('0x16'));var db=require(_0x35c1('0x17'))['db'];function respondWithStatusCode(_0x1deaed,_0x5e28ad){_0x5e28ad=_0x5e28ad||0xcc;return function(_0x525cf6){if(_0x525cf6){return _0x1deaed[_0x35c1('0x18')](_0x5e28ad);}return _0x1deaed[_0x35c1('0x19')](_0x5e28ad)[_0x35c1('0x1a')]();};}function respondWithResult(_0x1189c0,_0xa1ebb9){_0xa1ebb9=_0xa1ebb9||0xc8;return function(_0x1dc4e3){if(_0x1dc4e3){return _0x1189c0['status'](_0xa1ebb9)['json'](_0x1dc4e3);}};}function respondWithFilteredResult(_0x416746,_0x555b3d){return function(_0x4a0d73){if(_0x4a0d73){var _0xb8f1=typeof _0x555b3d[_0x35c1('0x1b')]===_0x35c1('0x1c')&&typeof _0x555b3d[_0x35c1('0x1d')]===_0x35c1('0x1c');var _0x506c3d=_0x4a0d73[_0x35c1('0x1e')];var _0x5b954c=_0xb8f1?0x0:_0x555b3d[_0x35c1('0x1b')];var _0x3e5375=_0xb8f1?_0x4a0d73[_0x35c1('0x1e')]:_0x555b3d['offset']+_0x555b3d[_0x35c1('0x1d')];var _0x32cd12;if(_0x3e5375>=_0x506c3d){_0x3e5375=_0x506c3d;_0x32cd12=0xc8;}else{_0x32cd12=0xce;}_0x416746[_0x35c1('0x19')](_0x32cd12);return _0x416746[_0x35c1('0x1f')](_0x35c1('0x20'),_0x5b954c+'-'+_0x3e5375+'/'+_0x506c3d)[_0x35c1('0x21')](_0x4a0d73);}return null;};}function patchUpdates(_0x3ea6ad){return function(_0x1d513f){try{jsonpatch[_0x35c1('0x22')](_0x1d513f,_0x3ea6ad,!![]);}catch(_0x130809){return BPromise[_0x35c1('0x23')](_0x130809);}return _0x1d513f[_0x35c1('0x24')]();};}function saveUpdates(_0x38fffd,_0x2c6427){return function(_0xdbaea3){if(_0xdbaea3){return _0xdbaea3[_0x35c1('0x25')](_0x38fffd)['then'](function(_0x40ef4c){return _0x40ef4c;});}return null;};}function removeEntity(_0x1e1a9f,_0x113ffb){return function(_0xde0cea){if(_0xde0cea){return _0xde0cea['destroy']()[_0x35c1('0x26')](function(){_0x1e1a9f[_0x35c1('0x19')](0xcc)[_0x35c1('0x1a')]();});}};}function handleEntityNotFound(_0x438103,_0x36f56b){return function(_0x28b497){if(!_0x28b497){_0x438103[_0x35c1('0x18')](0x194);}return _0x28b497;};}function handleError(_0x447f74,_0x187eb5){_0x187eb5=_0x187eb5||0x1f4;return function(_0x5eed3d){logger[_0x35c1('0x27')](_0x5eed3d['stack']);if(_0x5eed3d[_0x35c1('0x28')]){delete _0x5eed3d[_0x35c1('0x28')];}_0x447f74[_0x35c1('0x19')](_0x187eb5)['send'](_0x5eed3d);};}exports[_0x35c1('0x29')]=function(_0x2f9683,_0x31cee3){var _0x5ee0a6={},_0x3af9d8={},_0x146fd5={'count':0x0,'rows':[]};var _0x18b5c5=_[_0x35c1('0x2a')](db[_0x35c1('0x2b')]['rawAttributes'],function(_0x44ae72){return{'name':_0x44ae72[_0x35c1('0x2c')],'type':_0x44ae72['type']['key']};});_0x3af9d8[_0x35c1('0x2d')]=_[_0x35c1('0x2a')](_0x18b5c5,_0x35c1('0x28'));_0x3af9d8['query']=_['keys'](_0x2f9683[_0x35c1('0x2e')]);_0x3af9d8[_0x35c1('0x2f')]=_[_0x35c1('0x30')](_0x3af9d8[_0x35c1('0x2d')],_0x3af9d8['query']);_0x5ee0a6[_0x35c1('0x31')]=_[_0x35c1('0x30')](_0x3af9d8[_0x35c1('0x2d')],qs['fields'](_0x2f9683[_0x35c1('0x2e')][_0x35c1('0x32')]));_0x5ee0a6[_0x35c1('0x31')]=_0x5ee0a6[_0x35c1('0x31')]['length']?_0x5ee0a6[_0x35c1('0x31')]:_0x3af9d8['model'];if(!_0x2f9683['query'][_0x35c1('0x33')](_0x35c1('0x34'))){_0x5ee0a6[_0x35c1('0x1d')]=qs['limit'](_0x2f9683['query']['limit']);_0x5ee0a6['offset']=qs[_0x35c1('0x1b')](_0x2f9683['query'][_0x35c1('0x1b')]);}_0x5ee0a6[_0x35c1('0x35')]=qs[_0x35c1('0x36')](_0x2f9683[_0x35c1('0x2e')][_0x35c1('0x36')]);_0x5ee0a6[_0x35c1('0x37')]=qs[_0x35c1('0x2f')](_['pick'](_0x2f9683['query'],_0x3af9d8['filters']),_0x18b5c5);if(_0x2f9683[_0x35c1('0x2e')][_0x35c1('0x38')]){_0x5ee0a6[_0x35c1('0x37')]=_[_0x35c1('0x39')](_0x5ee0a6[_0x35c1('0x37')],{'$or':_[_0x35c1('0x2a')](_0x18b5c5,function(_0x414b8c){if(_0x414b8c['type']!=='VIRTUAL'){var _0x49354d={};_0x49354d[_0x414b8c[_0x35c1('0x28')]]={'$like':'%'+_0x2f9683['query']['filter']+'%'};return _0x49354d;}})});}_0x5ee0a6=_['merge']({},_0x5ee0a6,_0x2f9683[_0x35c1('0x3a')]);var _0x4f5110={'where':_0x5ee0a6[_0x35c1('0x37')]};return db['SquareMessage'][_0x35c1('0x1e')](_0x4f5110)['then'](function(_0x4a3ba7){_0x146fd5['count']=_0x4a3ba7;if(_0x2f9683[_0x35c1('0x2e')][_0x35c1('0x3b')]){_0x5ee0a6[_0x35c1('0x3c')]=[{'all':!![]}];}return db[_0x35c1('0x2b')][_0x35c1('0x3d')](_0x5ee0a6);})[_0x35c1('0x26')](function(_0x278500){_0x146fd5[_0x35c1('0x3e')]=_0x278500;return _0x146fd5;})[_0x35c1('0x26')](respondWithFilteredResult(_0x31cee3,_0x5ee0a6))[_0x35c1('0x3f')](handleError(_0x31cee3,null));};exports[_0x35c1('0x40')]=function(_0x2949f4,_0x40a601){var _0x492ac6={'raw':!![],'where':{'id':_0x2949f4[_0x35c1('0x41')]['id']}},_0x4166fc={};_0x4166fc[_0x35c1('0x2d')]=_['keys'](db[_0x35c1('0x2b')][_0x35c1('0x42')]);_0x4166fc[_0x35c1('0x2e')]=_[_0x35c1('0x43')](_0x2949f4[_0x35c1('0x2e')]);_0x4166fc[_0x35c1('0x2f')]=_[_0x35c1('0x30')](_0x4166fc[_0x35c1('0x2d')],_0x4166fc[_0x35c1('0x2e')]);_0x492ac6[_0x35c1('0x31')]=_[_0x35c1('0x30')](_0x4166fc[_0x35c1('0x2d')],qs[_0x35c1('0x32')](_0x2949f4[_0x35c1('0x2e')][_0x35c1('0x32')]));_0x492ac6[_0x35c1('0x31')]=_0x492ac6['attributes'][_0x35c1('0x44')]?_0x492ac6['attributes']:_0x4166fc[_0x35c1('0x2d')];if(_0x2949f4[_0x35c1('0x2e')][_0x35c1('0x3b')]){_0x492ac6['include']=[{'all':!![]}];}_0x492ac6=_[_0x35c1('0x39')]({},_0x492ac6,_0x2949f4['options']);return db[_0x35c1('0x2b')]['find'](_0x492ac6)[_0x35c1('0x26')](handleEntityNotFound(_0x40a601,null))['then'](respondWithResult(_0x40a601,null))[_0x35c1('0x3f')](handleError(_0x40a601,null));};exports[_0x35c1('0x45')]=function(_0x38d0a1,_0x180a5f){return db[_0x35c1('0x2b')][_0x35c1('0x45')](_0x38d0a1['body'],{})['then'](respondWithResult(_0x180a5f,0xc9))[_0x35c1('0x3f')](handleError(_0x180a5f,null));};exports['update']=function(_0x41e27b,_0x37c550){if(_0x41e27b[_0x35c1('0x46')]['id']){delete _0x41e27b[_0x35c1('0x46')]['id'];}return db[_0x35c1('0x2b')][_0x35c1('0x47')]({'where':{'id':_0x41e27b[_0x35c1('0x41')]['id']}})[_0x35c1('0x26')](handleEntityNotFound(_0x37c550,null))['then'](saveUpdates(_0x41e27b['body'],null))[_0x35c1('0x26')](respondWithResult(_0x37c550,null))[_0x35c1('0x3f')](handleError(_0x37c550,null));};exports[_0x35c1('0x48')]=function(_0x3bce8c,_0x472467){return db[_0x35c1('0x2b')][_0x35c1('0x47')]({'where':{'id':_0x3bce8c[_0x35c1('0x41')]['id']}})['then'](handleEntityNotFound(_0x472467,null))['then'](removeEntity(_0x472467,null))[_0x35c1('0x3f')](handleError(_0x472467,null));}; \ No newline at end of file +var _0x790c=['body','find','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','error','name','send','map','SquareMessage','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','params','rawAttributes','catch','create'];(function(_0xf5516a,_0x31af5d){var _0x509be9=function(_0x34caaa){while(--_0x34caaa){_0xf5516a['push'](_0xf5516a['shift']());}};_0x509be9(++_0x31af5d);}(_0x790c,0x106));var _0xc790=function(_0x27b1f2,_0xb89783){_0x27b1f2=_0x27b1f2-0x0;var _0x224069=_0x790c[_0x27b1f2];return _0x224069;};'use strict';var emlformat=require(_0xc790('0x0'));var rimraf=require(_0xc790('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc790('0x2'));var BPromise=require(_0xc790('0x3'));var Mustache=require(_0xc790('0x4'));var util=require(_0xc790('0x5'));var path=require(_0xc790('0x6'));var sox=require('sox');var csv=require(_0xc790('0x7'));var ejs=require(_0xc790('0x8'));var fs=require('fs');var fs_extra=require(_0xc790('0x9'));var _=require('lodash');var squel=require(_0xc790('0xa'));var crypto=require(_0xc790('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc790('0x7'));var querystring=require(_0xc790('0xc'));var Papa=require(_0xc790('0xd'));var Redis=require(_0xc790('0xe'));var authService=require(_0xc790('0xf'));var qs=require(_0xc790('0x10'));var as=require(_0xc790('0x11'));var hardwareService=require(_0xc790('0x12'));var logger=require(_0xc790('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc790('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ce8b5,_0x1e8055){_0x1e8055=_0x1e8055||0xcc;return function(_0x43924a){if(_0x43924a){return _0x1ce8b5[_0xc790('0x15')](_0x1e8055);}return _0x1ce8b5[_0xc790('0x16')](_0x1e8055)[_0xc790('0x17')]();};}function respondWithResult(_0x47ef15,_0x24a5e5){_0x24a5e5=_0x24a5e5||0xc8;return function(_0x13dc93){if(_0x13dc93){return _0x47ef15[_0xc790('0x16')](_0x24a5e5)['json'](_0x13dc93);}};}function respondWithFilteredResult(_0x39c88c,_0x82a629){return function(_0x5f56d1){if(_0x5f56d1){var _0x184649=typeof _0x82a629[_0xc790('0x18')]===_0xc790('0x19')&&typeof _0x82a629[_0xc790('0x1a')]==='undefined';var _0xe6c169=_0x5f56d1[_0xc790('0x1b')];var _0xfb5191=_0x184649?0x0:_0x82a629[_0xc790('0x18')];var _0x2898a9=_0x184649?_0x5f56d1[_0xc790('0x1b')]:_0x82a629[_0xc790('0x18')]+_0x82a629[_0xc790('0x1a')];var _0x542650;if(_0x2898a9>=_0xe6c169){_0x2898a9=_0xe6c169;_0x542650=0xc8;}else{_0x542650=0xce;}_0x39c88c[_0xc790('0x16')](_0x542650);return _0x39c88c['set'](_0xc790('0x1c'),_0xfb5191+'-'+_0x2898a9+'/'+_0xe6c169)[_0xc790('0x1d')](_0x5f56d1);}return null;};}function patchUpdates(_0x4898ff){return function(_0x3e5df5){try{jsonpatch[_0xc790('0x1e')](_0x3e5df5,_0x4898ff,!![]);}catch(_0x2dcee1){return BPromise[_0xc790('0x1f')](_0x2dcee1);}return _0x3e5df5['save']();};}function saveUpdates(_0x1eaab6,_0x5bc1e3){return function(_0x461b08){if(_0x461b08){return _0x461b08[_0xc790('0x20')](_0x1eaab6)['then'](function(_0x251a83){return _0x251a83;});}return null;};}function removeEntity(_0x18a6ea,_0x28f5ad){return function(_0x4c855e){if(_0x4c855e){return _0x4c855e['destroy']()[_0xc790('0x21')](function(){_0x18a6ea[_0xc790('0x16')](0xcc)[_0xc790('0x17')]();});}};}function handleEntityNotFound(_0x406ccb,_0x275fc2){return function(_0x467747){if(!_0x467747){_0x406ccb[_0xc790('0x15')](0x194);}return _0x467747;};}function handleError(_0x31c7ab,_0x4ea07c){_0x4ea07c=_0x4ea07c||0x1f4;return function(_0x15c3a7){logger[_0xc790('0x22')](_0x15c3a7['stack']);if(_0x15c3a7[_0xc790('0x23')]){delete _0x15c3a7['name'];}_0x31c7ab['status'](_0x4ea07c)[_0xc790('0x24')](_0x15c3a7);};}exports['index']=function(_0x47a8c5,_0x4cbbac){var _0x232517={},_0x29dda9={},_0x505657={'count':0x0,'rows':[]};var _0x31c4b4=_[_0xc790('0x25')](db[_0xc790('0x26')]['rawAttributes'],function(_0x4649e8){return{'name':_0x4649e8[_0xc790('0x27')],'type':_0x4649e8[_0xc790('0x28')]['key']};});_0x29dda9[_0xc790('0x29')]=_[_0xc790('0x25')](_0x31c4b4,'name');_0x29dda9['query']=_[_0xc790('0x2a')](_0x47a8c5[_0xc790('0x2b')]);_0x29dda9[_0xc790('0x2c')]=_['intersection'](_0x29dda9[_0xc790('0x29')],_0x29dda9['query']);_0x232517[_0xc790('0x2d')]=_[_0xc790('0x2e')](_0x29dda9[_0xc790('0x29')],qs[_0xc790('0x2f')](_0x47a8c5['query'][_0xc790('0x2f')]));_0x232517[_0xc790('0x2d')]=_0x232517[_0xc790('0x2d')][_0xc790('0x30')]?_0x232517['attributes']:_0x29dda9['model'];if(!_0x47a8c5['query']['hasOwnProperty'](_0xc790('0x31'))){_0x232517[_0xc790('0x1a')]=qs[_0xc790('0x1a')](_0x47a8c5[_0xc790('0x2b')]['limit']);_0x232517['offset']=qs[_0xc790('0x18')](_0x47a8c5[_0xc790('0x2b')]['offset']);}_0x232517[_0xc790('0x32')]=qs['sort'](_0x47a8c5[_0xc790('0x2b')][_0xc790('0x33')]);_0x232517[_0xc790('0x34')]=qs[_0xc790('0x2c')](_[_0xc790('0x35')](_0x47a8c5[_0xc790('0x2b')],_0x29dda9[_0xc790('0x2c')]),_0x31c4b4);if(_0x47a8c5[_0xc790('0x2b')][_0xc790('0x36')]){_0x232517[_0xc790('0x34')]=_[_0xc790('0x37')](_0x232517[_0xc790('0x34')],{'$or':_[_0xc790('0x25')](_0x31c4b4,function(_0x33d0e1){if(_0x33d0e1[_0xc790('0x28')]!=='VIRTUAL'){var _0x416175={};_0x416175[_0x33d0e1['name']]={'$like':'%'+_0x47a8c5['query'][_0xc790('0x36')]+'%'};return _0x416175;}})});}_0x232517=_['merge']({},_0x232517,_0x47a8c5[_0xc790('0x38')]);var _0x3f5750={'where':_0x232517[_0xc790('0x34')]};return db[_0xc790('0x26')][_0xc790('0x1b')](_0x3f5750)[_0xc790('0x21')](function(_0x3e4c71){_0x505657['count']=_0x3e4c71;if(_0x47a8c5['query'][_0xc790('0x39')]){_0x232517['include']=[{'all':!![]}];}return db[_0xc790('0x26')]['findAll'](_0x232517);})['then'](function(_0x5004ce){_0x505657[_0xc790('0x3a')]=_0x5004ce;return _0x505657;})[_0xc790('0x21')](respondWithFilteredResult(_0x4cbbac,_0x232517))['catch'](handleError(_0x4cbbac,null));};exports['show']=function(_0x513717,_0xc7624b){var _0xd7ae96={'raw':!![],'where':{'id':_0x513717[_0xc790('0x3b')]['id']}},_0x368972={};_0x368972[_0xc790('0x29')]=_[_0xc790('0x2a')](db[_0xc790('0x26')][_0xc790('0x3c')]);_0x368972[_0xc790('0x2b')]=_['keys'](_0x513717[_0xc790('0x2b')]);_0x368972[_0xc790('0x2c')]=_['intersection'](_0x368972[_0xc790('0x29')],_0x368972['query']);_0xd7ae96[_0xc790('0x2d')]=_['intersection'](_0x368972[_0xc790('0x29')],qs[_0xc790('0x2f')](_0x513717[_0xc790('0x2b')]['fields']));_0xd7ae96[_0xc790('0x2d')]=_0xd7ae96[_0xc790('0x2d')][_0xc790('0x30')]?_0xd7ae96['attributes']:_0x368972[_0xc790('0x29')];if(_0x513717[_0xc790('0x2b')][_0xc790('0x39')]){_0xd7ae96['include']=[{'all':!![]}];}_0xd7ae96=_[_0xc790('0x37')]({},_0xd7ae96,_0x513717[_0xc790('0x38')]);return db[_0xc790('0x26')]['find'](_0xd7ae96)[_0xc790('0x21')](handleEntityNotFound(_0xc7624b,null))['then'](respondWithResult(_0xc7624b,null))[_0xc790('0x3d')](handleError(_0xc7624b,null));};exports[_0xc790('0x3e')]=function(_0x1de7fe,_0x5b8676){return db[_0xc790('0x26')][_0xc790('0x3e')](_0x1de7fe[_0xc790('0x3f')],{})[_0xc790('0x21')](respondWithResult(_0x5b8676,0xc9))['catch'](handleError(_0x5b8676,null));};exports[_0xc790('0x20')]=function(_0x5117aa,_0xee5c32){if(_0x5117aa['body']['id']){delete _0x5117aa[_0xc790('0x3f')]['id'];}return db[_0xc790('0x26')][_0xc790('0x40')]({'where':{'id':_0x5117aa[_0xc790('0x3b')]['id']}})[_0xc790('0x21')](handleEntityNotFound(_0xee5c32,null))['then'](saveUpdates(_0x5117aa['body'],null))[_0xc790('0x21')](respondWithResult(_0xee5c32,null))[_0xc790('0x3d')](handleError(_0xee5c32,null));};exports['destroy']=function(_0x5247a1,_0x467a36){return db[_0xc790('0x26')][_0xc790('0x40')]({'where':{'id':_0x5247a1['params']['id']}})['then'](handleEntityNotFound(_0x467a36,null))[_0xc790('0x21')](removeEntity(_0x467a36,null))[_0xc790('0x3d')](handleError(_0x467a36,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index b766649..af745ea 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 _0xf3f3=['exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xf3f3,0x12f));var _0x3f3f=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0xf3f3[_0x21b359];return _0x57b8e7;};'use strict';var _=require(_0x3f3f('0x0'));var util=require(_0x3f3f('0x1'));var logger=require(_0x3f3f('0x2'))(_0x3f3f('0x3'));var moment=require(_0x3f3f('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f3f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f3f('0x6'));var config=require(_0x3f3f('0x7'));var attributes=require(_0x3f3f('0x8'));module[_0x3f3f('0x9')]=function(_0x588521,_0x30d9d6){return _0x588521[_0x3f3f('0xa')](_0x3f3f('0xb'),attributes,{'tableName':_0x3f3f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5f8=['util','../../config/logger','moment','bluebird','rimraf','exports','SquareMessage'];(function(_0x553fd6,_0x5bca1a){var _0x2aaa22=function(_0x1f5f72){while(--_0x1f5f72){_0x553fd6['push'](_0x553fd6['shift']());}};_0x2aaa22(++_0x5bca1a);}(_0xe5f8,0x157));var _0x8e5f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe5f8[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x8e5f('0x0'));var logger=require(_0x8e5f('0x1'))('api');var moment=require(_0x8e5f('0x2'));var BPromise=require(_0x8e5f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8e5f('0x4'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x8e5f('0x5')]=function(_0x42f578,_0x306ee6){return _0x42f578['define'](_0x8e5f('0x6'),attributes,{'tableName':'square_messages','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 72d36e0..68472f7 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 _0x481c=['CreateSquareMessage','SquareMessage','body','options','raw','stringify','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x40a4a9,_0x393129){var _0x37268f=function(_0xf04248){while(--_0xf04248){_0x40a4a9['push'](_0x40a4a9['shift']());}};_0x37268f(++_0x393129);}(_0x481c,0x1d1));var _0xc481=function(_0x31befd,_0x4ff14d){_0x31befd=_0x31befd-0x0;var _0x5295eb=_0x481c[_0x31befd];return _0x5295eb;};'use strict';var _=require(_0xc481('0x0'));var util=require('util');var moment=require(_0xc481('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc481('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc481('0x3'));var logger=require(_0xc481('0x4'))('rpc');var config=require(_0xc481('0x5'));var jayson=require(_0xc481('0x6'));var client=jayson[_0xc481('0x7')][_0xc481('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40eb03,_0xd9eb81,_0x2d7139){return new BPromise(function(_0x1a59df,_0x5edf63){return client[_0xc481('0x9')](_0x40eb03,_0x2d7139)[_0xc481('0xa')](function(_0x481eb1){logger['info'](_0xc481('0xb'),_0xd9eb81,'request\x20sent');logger[_0xc481('0xc')](_0xc481('0xd'),_0xd9eb81,_0xc481('0xe'),JSON['stringify'](_0x481eb1));if(_0x481eb1[_0xc481('0xf')]){if(_0x481eb1['error'][_0xc481('0x10')]===0x1f4){logger['error'](_0xc481('0xb'),_0xd9eb81,_0x481eb1[_0xc481('0xf')][_0xc481('0x11')]);return _0x5edf63(_0x481eb1[_0xc481('0xf')][_0xc481('0x11')]);}logger[_0xc481('0xf')](_0xc481('0xb'),_0xd9eb81,_0x481eb1[_0xc481('0xf')][_0xc481('0x11')]);return _0x1a59df(_0x481eb1[_0xc481('0xf')][_0xc481('0x11')]);}else{logger[_0xc481('0x12')]('SquareMessage,\x20%s,\x20%s',_0xd9eb81,_0xc481('0xe'));_0x1a59df(_0x481eb1[_0xc481('0x13')]['message']);}})[_0xc481('0x14')](function(_0x5093d1){logger[_0xc481('0xf')](_0xc481('0xb'),_0xd9eb81,_0x5093d1);_0x5edf63(_0x5093d1);});});}exports[_0xc481('0x15')]=function(_0x51bc49){var _0x2b0117=this;return new Promise(function(_0xa11c12,_0x147460){return db[_0xc481('0x16')]['create'](_0x51bc49[_0xc481('0x17')],{'raw':_0x51bc49[_0xc481('0x18')]?_0x51bc49[_0xc481('0x18')][_0xc481('0x19')]===undefined?!![]:![]:!![]})[_0xc481('0xa')](function(_0x425183){logger[_0xc481('0x12')]('CreateSquareMessage',_0x51bc49);logger[_0xc481('0xc')](_0xc481('0x15'),_0x51bc49,JSON[_0xc481('0x1a')](_0x425183));_0xa11c12(_0x425183);})['catch'](function(_0x35b37c){logger[_0xc481('0xf')](_0xc481('0x15'),_0x35b37c[_0xc481('0x11')],_0x51bc49);_0x147460(_0x2b0117[_0xc481('0xf')](0x1f4,_0x35b37c[_0xc481('0x11')]));});});}; \ No newline at end of file +var _0x9c40=['request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','SquareMessage,\x20%s,\x20%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9c40,0x11c));var _0x09c4=function(_0x5767f9,_0x38ea6a){_0x5767f9=_0x5767f9-0x0;var _0x58c7b3=_0x9c40[_0x5767f9];return _0x58c7b3;};'use strict';var _=require(_0x09c4('0x0'));var util=require(_0x09c4('0x1'));var moment=require(_0x09c4('0x2'));var BPromise=require(_0x09c4('0x3'));var rs=require(_0x09c4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x09c4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x09c4('0x6'))('rpc');var config=require(_0x09c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x09c4('0x8')][_0x09c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x124288,_0x49fafa,_0x57aae9){return new BPromise(function(_0x294a52,_0x5a6403){return client[_0x09c4('0xa')](_0x124288,_0x57aae9)[_0x09c4('0xb')](function(_0x293138){logger['info'](_0x09c4('0xc'),_0x49fafa,_0x09c4('0xd'));logger[_0x09c4('0xe')](_0x09c4('0xf'),_0x49fafa,_0x09c4('0xd'),JSON[_0x09c4('0x10')](_0x293138));if(_0x293138['error']){if(_0x293138[_0x09c4('0x11')][_0x09c4('0x12')]===0x1f4){logger[_0x09c4('0x11')](_0x09c4('0xc'),_0x49fafa,_0x293138[_0x09c4('0x11')][_0x09c4('0x13')]);return _0x5a6403(_0x293138[_0x09c4('0x11')]['message']);}logger['error'](_0x09c4('0xc'),_0x49fafa,_0x293138[_0x09c4('0x11')]['message']);return _0x294a52(_0x293138[_0x09c4('0x11')]['message']);}else{logger['info'](_0x09c4('0xc'),_0x49fafa,_0x09c4('0xd'));_0x294a52(_0x293138[_0x09c4('0x14')][_0x09c4('0x13')]);}})[_0x09c4('0x15')](function(_0x46d873){logger[_0x09c4('0x11')]('SquareMessage,\x20%s,\x20%s',_0x49fafa,_0x46d873);_0x5a6403(_0x46d873);});});}exports[_0x09c4('0x16')]=function(_0x39215e){var _0x39488=this;return new Promise(function(_0x24ca23,_0x4e9dc2){return db[_0x09c4('0x17')][_0x09c4('0x18')](_0x39215e[_0x09c4('0x19')],{'raw':_0x39215e[_0x09c4('0x1a')]?_0x39215e[_0x09c4('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x15ea10){logger['info'](_0x09c4('0x16'),_0x39215e);logger[_0x09c4('0xe')](_0x09c4('0x16'),_0x39215e,JSON[_0x09c4('0x10')](_0x15ea10));_0x24ca23(_0x15ea10);})[_0x09c4('0x15')](function(_0x4713ec){logger[_0x09c4('0x11')](_0x09c4('0x16'),_0x4713ec[_0x09c4('0x13')],_0x39215e);_0x4e9dc2(_0x39488[_0x09c4('0x11')](0x1f4,_0x4713ec[_0x09c4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 7988d30..25fb069 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 _0x2dfe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','/:id/test','15s','post','put','update','path','connect-timeout'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x2dfe,0x18a));var _0xe2df=function(_0x39cdd9,_0x1f8b80){_0x39cdd9=_0x39cdd9-0x0;var _0x59a06e=_0x2dfe[_0x39cdd9];return _0x59a06e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe2df('0x0'));var timeout=require(_0xe2df('0x1'));var express=require('express');var router=express[_0xe2df('0x2')]();var fs_extra=require(_0xe2df('0x3'));var auth=require(_0xe2df('0x4'));var interaction=require(_0xe2df('0x5'));var config=require(_0xe2df('0x6'));var controller=require(_0xe2df('0x7'));router[_0xe2df('0x8')]('/',auth['isAuthenticated'](),controller[_0xe2df('0x9')]);router[_0xe2df('0x8')](_0xe2df('0xa'),auth[_0xe2df('0xb')](),controller[_0xe2df('0xc')]);router['get'](_0xe2df('0xd'),auth[_0xe2df('0xb')](),timeout(_0xe2df('0xe')),controller['test']);router[_0xe2df('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe2df('0x10')](_0xe2df('0xa'),auth[_0xe2df('0xb')](),controller[_0xe2df('0x11')]);router['delete'](_0xe2df('0xa'),auth[_0xe2df('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4dc3=['put','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','/:id/test','15s','test','post','create'];(function(_0x13485b,_0x29fb3e){var _0x4ae5e8=function(_0x229799){while(--_0x229799){_0x13485b['push'](_0x13485b['shift']());}};_0x4ae5e8(++_0x29fb3e);}(_0x4dc3,0x122));var _0x34dc=function(_0x32cf96,_0x7502d5){_0x32cf96=_0x32cf96-0x0;var _0x125cc1=_0x4dc3[_0x32cf96];return _0x125cc1;};'use strict';var multer=require(_0x34dc('0x0'));var util=require('util');var path=require(_0x34dc('0x1'));var timeout=require('connect-timeout');var express=require(_0x34dc('0x2'));var router=express[_0x34dc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x34dc('0x4'));var interaction=require(_0x34dc('0x5'));var config=require(_0x34dc('0x6'));var controller=require(_0x34dc('0x7'));router[_0x34dc('0x8')]('/',auth['isAuthenticated'](),controller[_0x34dc('0x9')]);router[_0x34dc('0x8')](_0x34dc('0xa'),auth[_0x34dc('0xb')](),controller[_0x34dc('0xc')]);router[_0x34dc('0x8')](_0x34dc('0xd'),auth['isAuthenticated'](),timeout(_0x34dc('0xe')),controller[_0x34dc('0xf')]);router[_0x34dc('0x10')]('/',auth[_0x34dc('0xb')](),controller[_0x34dc('0x11')]);router[_0x34dc('0x12')](_0x34dc('0xa'),auth[_0x34dc('0xb')](),controller['update']);router[_0x34dc('0x13')](_0x34dc('0xa'),auth[_0x34dc('0xb')](),controller[_0x34dc('0x14')]);module[_0x34dc('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index b446ac3..d9c47d3 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 _0x3d18=['exports','STRING','sequelize'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x3d18,0x1d0));var _0x83d1=function(_0x4ae202,_0x16a768){_0x4ae202=_0x4ae202-0x0;var _0x2b362f=_0x3d18[_0x4ae202];return _0x2b362f;};'use strict';var Sequelize=require(_0x83d1('0x0'));module[_0x83d1('0x1')]={'name':{'type':Sequelize[_0x83d1('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x83d1('0x2')]},'description':{'type':Sequelize[_0x83d1('0x2')]}}; \ No newline at end of file +var _0x3327=['name','STRING','sequelize','exports'];(function(_0x4f4679,_0x713087){var _0x2f7cd0=function(_0x8eaf53){while(--_0x8eaf53){_0x4f4679['push'](_0x4f4679['shift']());}};_0x2f7cd0(++_0x713087);}(_0x3327,0x92));var _0x7332=function(_0x336e1f,_0x4984aa){_0x336e1f=_0x336e1f-0x0;var _0x472f74=_0x3327[_0x336e1f];return _0x472f74;};'use strict';var Sequelize=require(_0x7332('0x0'));module[_0x7332('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7332('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x7332('0x3')]},'description':{'type':Sequelize[_0x7332('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e1b06e3..723099d 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 _0x9a3f=['order','sort','where','merge','VIRTUAL','filter','options','SquareOdbc','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','test','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','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','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x34a84b,_0x503fad){var _0xae9f3a=function(_0x885a51){while(--_0x885a51){_0x34a84b['push'](_0x34a84b['shift']());}};_0xae9f3a(++_0x503fad);}(_0x9a3f,0x72));var _0xf9a3=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x9a3f[_0xd67723];return _0x53b62b;};'use strict';var emlformat=require(_0xf9a3('0x0'));var rimraf=require(_0xf9a3('0x1'));var zipdir=require(_0xf9a3('0x2'));var jsonpatch=require(_0xf9a3('0x3'));var rp=require(_0xf9a3('0x4'));var moment=require(_0xf9a3('0x5'));var BPromise=require(_0xf9a3('0x6'));var Mustache=require(_0xf9a3('0x7'));var util=require('util');var path=require(_0xf9a3('0x8'));var sox=require('sox');var csv=require(_0xf9a3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf9a3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf9a3('0xb'));var jsforce=require(_0xf9a3('0xc'));var deskjs=require(_0xf9a3('0xd'));var toCsv=require(_0xf9a3('0x9'));var querystring=require(_0xf9a3('0xe'));var Papa=require(_0xf9a3('0xf'));var Redis=require(_0xf9a3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf9a3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf9a3('0x12'));var logger=require(_0xf9a3('0x13'))(_0xf9a3('0x14'));var utils=require(_0xf9a3('0x15'));var config=require(_0xf9a3('0x16'));var licenseUtil=require(_0xf9a3('0x17'));var db=require(_0xf9a3('0x18'))['db'];function respondWithStatusCode(_0x535a40,_0x3a0086){_0x3a0086=_0x3a0086||0xcc;return function(_0x484122){if(_0x484122){return _0x535a40[_0xf9a3('0x19')](_0x3a0086);}return _0x535a40[_0xf9a3('0x1a')](_0x3a0086)['end']();};}function respondWithResult(_0x1c022d,_0x1d44dd){_0x1d44dd=_0x1d44dd||0xc8;return function(_0x13ccfd){if(_0x13ccfd){return _0x1c022d['status'](_0x1d44dd)[_0xf9a3('0x1b')](_0x13ccfd);}};}function respondWithFilteredResult(_0x517367,_0x671fbd){return function(_0x456cb5){if(_0x456cb5){var _0x2589db=typeof _0x671fbd['offset']===_0xf9a3('0x1c')&&typeof _0x671fbd[_0xf9a3('0x1d')]===_0xf9a3('0x1c');var _0x35b907=_0x456cb5['count'];var _0x3a1802=_0x2589db?0x0:_0x671fbd['offset'];var _0x3a9a54=_0x2589db?_0x456cb5[_0xf9a3('0x1e')]:_0x671fbd[_0xf9a3('0x1f')]+_0x671fbd[_0xf9a3('0x1d')];var _0x36d365;if(_0x3a9a54>=_0x35b907){_0x3a9a54=_0x35b907;_0x36d365=0xc8;}else{_0x36d365=0xce;}_0x517367['status'](_0x36d365);return _0x517367[_0xf9a3('0x20')]('Content-Range',_0x3a1802+'-'+_0x3a9a54+'/'+_0x35b907)[_0xf9a3('0x1b')](_0x456cb5);}return null;};}function patchUpdates(_0x4c39c8){return function(_0x20570a){try{jsonpatch[_0xf9a3('0x21')](_0x20570a,_0x4c39c8,!![]);}catch(_0x4fe2d1){return BPromise[_0xf9a3('0x22')](_0x4fe2d1);}return _0x20570a[_0xf9a3('0x23')]();};}function saveUpdates(_0x16a785,_0x252143){return function(_0x14534b){if(_0x14534b){return _0x14534b[_0xf9a3('0x24')](_0x16a785)[_0xf9a3('0x25')](function(_0x1b1576){return _0x1b1576;});}return null;};}function removeEntity(_0x5730bb,_0xd8c6ef){return function(_0x20124a){if(_0x20124a){return _0x20124a[_0xf9a3('0x26')]()[_0xf9a3('0x25')](function(){var _0x1e8e87=_0x20124a[_0xf9a3('0x27')]({'plain':!![]});var _0x48fc4a=_0xf9a3('0x28');return db[_0xf9a3('0x29')][_0xf9a3('0x26')]({'where':{'type':_0x48fc4a,'resourceId':_0x1e8e87['id']}})['then'](function(){return _0x20124a;});})[_0xf9a3('0x25')](function(){_0x5730bb['status'](0xcc)[_0xf9a3('0x2a')]();});}};}function handleEntityNotFound(_0xa05c36,_0x3bc1be){return function(_0x3967fc){if(!_0x3967fc){_0xa05c36[_0xf9a3('0x19')](0x194);}return _0x3967fc;};}function handleError(_0x5a1e0b,_0x268162){_0x268162=_0x268162||0x1f4;return function(_0x50a39f){logger[_0xf9a3('0x2b')](_0x50a39f[_0xf9a3('0x2c')]);if(_0x50a39f['name']){delete _0x50a39f[_0xf9a3('0x2d')];}_0x5a1e0b[_0xf9a3('0x1a')](_0x268162)[_0xf9a3('0x2e')](_0x50a39f);};}exports[_0xf9a3('0x2f')]=function(_0x49099d,_0x42e8b6){var _0x55251f={},_0x555385={},_0xdc9c49={'count':0x0,'rows':[]};var _0x5cf5b0=_[_0xf9a3('0x30')](db['SquareOdbc'][_0xf9a3('0x31')],function(_0x113afd){return{'name':_0x113afd[_0xf9a3('0x32')],'type':_0x113afd[_0xf9a3('0x33')][_0xf9a3('0x34')]};});_0x555385[_0xf9a3('0x35')]=_['map'](_0x5cf5b0,_0xf9a3('0x2d'));_0x555385[_0xf9a3('0x36')]=_[_0xf9a3('0x37')](_0x49099d[_0xf9a3('0x36')]);_0x555385[_0xf9a3('0x38')]=_['intersection'](_0x555385[_0xf9a3('0x35')],_0x555385[_0xf9a3('0x36')]);_0x55251f['attributes']=_['intersection'](_0x555385[_0xf9a3('0x35')],qs['fields'](_0x49099d[_0xf9a3('0x36')][_0xf9a3('0x39')]));_0x55251f[_0xf9a3('0x3a')]=_0x55251f[_0xf9a3('0x3a')][_0xf9a3('0x3b')]?_0x55251f[_0xf9a3('0x3a')]:_0x555385[_0xf9a3('0x35')];if(!_0x49099d[_0xf9a3('0x36')][_0xf9a3('0x3c')](_0xf9a3('0x3d'))){_0x55251f[_0xf9a3('0x1d')]=qs['limit'](_0x49099d[_0xf9a3('0x36')]['limit']);_0x55251f[_0xf9a3('0x1f')]=qs['offset'](_0x49099d['query'][_0xf9a3('0x1f')]);}_0x55251f[_0xf9a3('0x3e')]=qs['sort'](_0x49099d[_0xf9a3('0x36')][_0xf9a3('0x3f')]);_0x55251f[_0xf9a3('0x40')]=qs[_0xf9a3('0x38')](_['pick'](_0x49099d['query'],_0x555385['filters']),_0x5cf5b0);if(_0x49099d[_0xf9a3('0x36')]['filter']){_0x55251f[_0xf9a3('0x40')]=_[_0xf9a3('0x41')](_0x55251f[_0xf9a3('0x40')],{'$or':_[_0xf9a3('0x30')](_0x5cf5b0,function(_0xe9c818){if(_0xe9c818[_0xf9a3('0x33')]!==_0xf9a3('0x42')){var _0x1a5637={};_0x1a5637[_0xe9c818[_0xf9a3('0x2d')]]={'$like':'%'+_0x49099d[_0xf9a3('0x36')][_0xf9a3('0x43')]+'%'};return _0x1a5637;}})});}_0x55251f=_[_0xf9a3('0x41')]({},_0x55251f,_0x49099d[_0xf9a3('0x44')]);var _0x209beb={'where':_0x55251f[_0xf9a3('0x40')]};return db[_0xf9a3('0x45')]['count'](_0x209beb)[_0xf9a3('0x25')](function(_0x3d3502){_0xdc9c49[_0xf9a3('0x1e')]=_0x3d3502;if(_0x49099d['query']['includeAll']){_0x55251f[_0xf9a3('0x46')]=[{'all':!![]}];}return db['SquareOdbc'][_0xf9a3('0x47')](_0x55251f);})[_0xf9a3('0x25')](function(_0x12ec69){_0xdc9c49[_0xf9a3('0x48')]=_0x12ec69;return _0xdc9c49;})[_0xf9a3('0x25')](respondWithFilteredResult(_0x42e8b6,_0x55251f))[_0xf9a3('0x49')](handleError(_0x42e8b6,null));};exports[_0xf9a3('0x4a')]=function(_0x3b407a,_0x34f9ae){var _0x51c36e={'raw':!![],'where':{'id':_0x3b407a[_0xf9a3('0x4b')]['id']}},_0x3ff5d4={};_0x3ff5d4[_0xf9a3('0x35')]=_[_0xf9a3('0x37')](db[_0xf9a3('0x45')][_0xf9a3('0x31')]);_0x3ff5d4['query']=_[_0xf9a3('0x37')](_0x3b407a[_0xf9a3('0x36')]);_0x3ff5d4['filters']=_[_0xf9a3('0x4c')](_0x3ff5d4[_0xf9a3('0x35')],_0x3ff5d4['query']);_0x51c36e[_0xf9a3('0x3a')]=_[_0xf9a3('0x4c')](_0x3ff5d4[_0xf9a3('0x35')],qs[_0xf9a3('0x39')](_0x3b407a[_0xf9a3('0x36')][_0xf9a3('0x39')]));_0x51c36e['attributes']=_0x51c36e['attributes'][_0xf9a3('0x3b')]?_0x51c36e[_0xf9a3('0x3a')]:_0x3ff5d4[_0xf9a3('0x35')];if(_0x3b407a['query'][_0xf9a3('0x4d')]){_0x51c36e['include']=[{'all':!![]}];}_0x51c36e=_[_0xf9a3('0x41')]({},_0x51c36e,_0x3b407a[_0xf9a3('0x44')]);return db[_0xf9a3('0x45')][_0xf9a3('0x4e')](_0x51c36e)[_0xf9a3('0x25')](handleEntityNotFound(_0x34f9ae,null))[_0xf9a3('0x25')](respondWithResult(_0x34f9ae,null))[_0xf9a3('0x49')](handleError(_0x34f9ae,null));};exports[_0xf9a3('0x4f')]=function(_0x381648,_0x3ca967){return db[_0xf9a3('0x45')][_0xf9a3('0x4f')](_0x381648[_0xf9a3('0x50')],{})[_0xf9a3('0x25')](function(_0x5c033f){var _0x61becb=_0x381648[_0xf9a3('0x51')][_0xf9a3('0x27')]({'plain':!![]});if(!_0x61becb)throw new Error(_0xf9a3('0x52'));if(_0x61becb[_0xf9a3('0x53')]==='user'){var _0x319074=_0x5c033f[_0xf9a3('0x27')]({'plain':!![]});var _0x41fa02=_0xf9a3('0x28');return db['UserProfileSection'][_0xf9a3('0x4e')]({'where':{'name':_0x41fa02,'userProfileId':_0x61becb['userProfileId']},'raw':!![]})[_0xf9a3('0x25')](function(_0x123374){if(_0x123374&&_0x123374[_0xf9a3('0x54')]===0x0){return db[_0xf9a3('0x29')][_0xf9a3('0x4f')]({'name':_0x319074[_0xf9a3('0x2d')],'resourceId':_0x319074['id'],'type':_0x123374[_0xf9a3('0x2d')],'sectionId':_0x123374['id']},{})[_0xf9a3('0x25')](function(){return _0x5c033f;});}else{return _0x5c033f;}})[_0xf9a3('0x49')](function(_0x3d6a43){logger[_0xf9a3('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d6a43);throw _0x3d6a43;});}return _0x5c033f;})[_0xf9a3('0x25')](respondWithResult(_0x3ca967,0xc9))[_0xf9a3('0x49')](handleError(_0x3ca967,null));};exports[_0xf9a3('0x24')]=function(_0x3c552a,_0x3f6d7a){if(_0x3c552a[_0xf9a3('0x50')]['id']){delete _0x3c552a[_0xf9a3('0x50')]['id'];}return db[_0xf9a3('0x45')][_0xf9a3('0x4e')]({'where':{'id':_0x3c552a[_0xf9a3('0x4b')]['id']}})[_0xf9a3('0x25')](handleEntityNotFound(_0x3f6d7a,null))[_0xf9a3('0x25')](saveUpdates(_0x3c552a[_0xf9a3('0x50')],null))[_0xf9a3('0x25')](respondWithResult(_0x3f6d7a,null))[_0xf9a3('0x49')](handleError(_0x3f6d7a,null));};exports['destroy']=function(_0x311d75,_0x2b3ed8){return db[_0xf9a3('0x45')][_0xf9a3('0x4e')]({'where':{'id':_0x311d75[_0xf9a3('0x4b')]['id']}})[_0xf9a3('0x25')](handleEntityNotFound(_0x2b3ed8,null))['then'](removeEntity(_0x2b3ed8,null))[_0xf9a3('0x49')](handleError(_0x2b3ed8,null));};exports[_0xf9a3('0x55')]=function(_0x3fff7a,_0x5b301b,_0x45df3f){var _0x1e4f19;return db[_0xf9a3('0x45')][_0xf9a3('0x4e')]({'where':{'id':_0x3fff7a[_0xf9a3('0x4b')]['id']},'attributes':['id',_0xf9a3('0x56')]})[_0xf9a3('0x25')](handleEntityNotFound(_0x5b301b,null))[_0xf9a3('0x25')](function(_0x3a864c){if(_0x3a864c){var _0x1118e5=require('odbc')();_0x1118e5['openSync'](_0x3a864c[_0xf9a3('0x56')]);_0x1118e5[_0xf9a3('0x57')]();return _0x3a864c;}})[_0xf9a3('0x25')](respondWithResult(_0x5b301b,null))[_0xf9a3('0x49')](handleError(_0x5b301b,null));}; \ No newline at end of file +var _0x0eb5=['catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows'];(function(_0x2f2972,_0x5b421e){var _0x5324dc=function(_0x131323){while(--_0x131323){_0x2f2972['push'](_0x2f2972['shift']());}};_0x5324dc(++_0x5b421e);}(_0x0eb5,0x15b));var _0x50eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0eb5[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50eb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x50eb('0x1'));var BPromise=require(_0x50eb('0x2'));var Mustache=require(_0x50eb('0x3'));var util=require(_0x50eb('0x4'));var path=require(_0x50eb('0x5'));var sox=require(_0x50eb('0x6'));var csv=require(_0x50eb('0x7'));var ejs=require(_0x50eb('0x8'));var fs=require('fs');var fs_extra=require(_0x50eb('0x9'));var _=require('lodash');var squel=require(_0x50eb('0xa'));var crypto=require(_0x50eb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x50eb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x50eb('0xd'));var Papa=require(_0x50eb('0xe'));var Redis=require(_0x50eb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x50eb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50eb('0x11'));var logger=require('../../config/logger')(_0x50eb('0x12'));var utils=require(_0x50eb('0x13'));var config=require(_0x50eb('0x14'));var licenseUtil=require(_0x50eb('0x15'));var db=require(_0x50eb('0x16'))['db'];function respondWithStatusCode(_0x5dd609,_0x2404b5){_0x2404b5=_0x2404b5||0xcc;return function(_0x1f6b98){if(_0x1f6b98){return _0x5dd609['sendStatus'](_0x2404b5);}return _0x5dd609[_0x50eb('0x17')](_0x2404b5)['end']();};}function respondWithResult(_0x3b54b,_0x315a38){_0x315a38=_0x315a38||0xc8;return function(_0x53e5c8){if(_0x53e5c8){return _0x3b54b[_0x50eb('0x17')](_0x315a38)[_0x50eb('0x18')](_0x53e5c8);}};}function respondWithFilteredResult(_0x4215c8,_0x2926c5){return function(_0x39e9bc){if(_0x39e9bc){var _0xc6a36d=typeof _0x2926c5[_0x50eb('0x19')]===_0x50eb('0x1a')&&typeof _0x2926c5[_0x50eb('0x1b')]===_0x50eb('0x1a');var _0x2354a4=_0x39e9bc['count'];var _0x41bedd=_0xc6a36d?0x0:_0x2926c5['offset'];var _0x43716d=_0xc6a36d?_0x39e9bc[_0x50eb('0x1c')]:_0x2926c5[_0x50eb('0x19')]+_0x2926c5['limit'];var _0x118973;if(_0x43716d>=_0x2354a4){_0x43716d=_0x2354a4;_0x118973=0xc8;}else{_0x118973=0xce;}_0x4215c8[_0x50eb('0x17')](_0x118973);return _0x4215c8[_0x50eb('0x1d')](_0x50eb('0x1e'),_0x41bedd+'-'+_0x43716d+'/'+_0x2354a4)[_0x50eb('0x18')](_0x39e9bc);}return null;};}function patchUpdates(_0x4327f2){return function(_0x3a228d){try{jsonpatch[_0x50eb('0x1f')](_0x3a228d,_0x4327f2,!![]);}catch(_0x4d12a2){return BPromise[_0x50eb('0x20')](_0x4d12a2);}return _0x3a228d[_0x50eb('0x21')]();};}function saveUpdates(_0x1bc05d,_0x5858b9){return function(_0x1cbb04){if(_0x1cbb04){return _0x1cbb04[_0x50eb('0x22')](_0x1bc05d)[_0x50eb('0x23')](function(_0x5f281a){return _0x5f281a;});}return null;};}function removeEntity(_0x5262b9,_0x1f311f){return function(_0x280b38){if(_0x280b38){return _0x280b38[_0x50eb('0x24')]()[_0x50eb('0x23')](function(){var _0x2d5c81=_0x280b38[_0x50eb('0x25')]({'plain':!![]});var _0xe9bd3='ODBC';return db[_0x50eb('0x26')]['destroy']({'where':{'type':_0xe9bd3,'resourceId':_0x2d5c81['id']}})[_0x50eb('0x23')](function(){return _0x280b38;});})[_0x50eb('0x23')](function(){_0x5262b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x223c4f,_0x249322){return function(_0x44ebd6){if(!_0x44ebd6){_0x223c4f['sendStatus'](0x194);}return _0x44ebd6;};}function handleError(_0x553f7a,_0x8bc403){_0x8bc403=_0x8bc403||0x1f4;return function(_0x579bbd){logger['error'](_0x579bbd[_0x50eb('0x27')]);if(_0x579bbd[_0x50eb('0x28')]){delete _0x579bbd[_0x50eb('0x28')];}_0x553f7a[_0x50eb('0x17')](_0x8bc403)[_0x50eb('0x29')](_0x579bbd);};}exports['index']=function(_0x3907ce,_0x3604f9){var _0x42c250={},_0x2a33d9={},_0x5807ee={'count':0x0,'rows':[]};var _0x5b1177=_[_0x50eb('0x2a')](db[_0x50eb('0x2b')][_0x50eb('0x2c')],function(_0x41766b){return{'name':_0x41766b[_0x50eb('0x2d')],'type':_0x41766b[_0x50eb('0x2e')]['key']};});_0x2a33d9['model']=_[_0x50eb('0x2a')](_0x5b1177,_0x50eb('0x28'));_0x2a33d9['query']=_['keys'](_0x3907ce[_0x50eb('0x2f')]);_0x2a33d9[_0x50eb('0x30')]=_[_0x50eb('0x31')](_0x2a33d9['model'],_0x2a33d9[_0x50eb('0x2f')]);_0x42c250[_0x50eb('0x32')]=_[_0x50eb('0x31')](_0x2a33d9['model'],qs['fields'](_0x3907ce[_0x50eb('0x2f')][_0x50eb('0x33')]));_0x42c250['attributes']=_0x42c250[_0x50eb('0x32')][_0x50eb('0x34')]?_0x42c250[_0x50eb('0x32')]:_0x2a33d9[_0x50eb('0x35')];if(!_0x3907ce[_0x50eb('0x2f')][_0x50eb('0x36')](_0x50eb('0x37'))){_0x42c250[_0x50eb('0x1b')]=qs['limit'](_0x3907ce['query']['limit']);_0x42c250[_0x50eb('0x19')]=qs[_0x50eb('0x19')](_0x3907ce['query'][_0x50eb('0x19')]);}_0x42c250[_0x50eb('0x38')]=qs[_0x50eb('0x39')](_0x3907ce[_0x50eb('0x2f')][_0x50eb('0x39')]);_0x42c250[_0x50eb('0x3a')]=qs['filters'](_[_0x50eb('0x3b')](_0x3907ce[_0x50eb('0x2f')],_0x2a33d9[_0x50eb('0x30')]),_0x5b1177);if(_0x3907ce['query']['filter']){_0x42c250[_0x50eb('0x3a')]=_[_0x50eb('0x3c')](_0x42c250[_0x50eb('0x3a')],{'$or':_[_0x50eb('0x2a')](_0x5b1177,function(_0x24c022){if(_0x24c022[_0x50eb('0x2e')]!==_0x50eb('0x3d')){var _0x25e302={};_0x25e302[_0x24c022[_0x50eb('0x28')]]={'$like':'%'+_0x3907ce[_0x50eb('0x2f')][_0x50eb('0x3e')]+'%'};return _0x25e302;}})});}_0x42c250=_[_0x50eb('0x3c')]({},_0x42c250,_0x3907ce[_0x50eb('0x3f')]);var _0x37593b={'where':_0x42c250[_0x50eb('0x3a')]};return db[_0x50eb('0x2b')][_0x50eb('0x1c')](_0x37593b)[_0x50eb('0x23')](function(_0x4eebb6){_0x5807ee[_0x50eb('0x1c')]=_0x4eebb6;if(_0x3907ce['query'][_0x50eb('0x40')]){_0x42c250[_0x50eb('0x41')]=[{'all':!![]}];}return db[_0x50eb('0x2b')][_0x50eb('0x42')](_0x42c250);})['then'](function(_0x2e24e4){_0x5807ee[_0x50eb('0x43')]=_0x2e24e4;return _0x5807ee;})[_0x50eb('0x23')](respondWithFilteredResult(_0x3604f9,_0x42c250))[_0x50eb('0x44')](handleError(_0x3604f9,null));};exports['show']=function(_0x48d432,_0x178653){var _0x31eb63={'raw':!![],'where':{'id':_0x48d432[_0x50eb('0x45')]['id']}},_0x50dd88={};_0x50dd88[_0x50eb('0x35')]=_[_0x50eb('0x46')](db[_0x50eb('0x2b')]['rawAttributes']);_0x50dd88[_0x50eb('0x2f')]=_['keys'](_0x48d432[_0x50eb('0x2f')]);_0x50dd88[_0x50eb('0x30')]=_['intersection'](_0x50dd88['model'],_0x50dd88[_0x50eb('0x2f')]);_0x31eb63[_0x50eb('0x32')]=_[_0x50eb('0x31')](_0x50dd88[_0x50eb('0x35')],qs[_0x50eb('0x33')](_0x48d432[_0x50eb('0x2f')][_0x50eb('0x33')]));_0x31eb63[_0x50eb('0x32')]=_0x31eb63[_0x50eb('0x32')][_0x50eb('0x34')]?_0x31eb63['attributes']:_0x50dd88[_0x50eb('0x35')];if(_0x48d432[_0x50eb('0x2f')][_0x50eb('0x40')]){_0x31eb63[_0x50eb('0x41')]=[{'all':!![]}];}_0x31eb63=_[_0x50eb('0x3c')]({},_0x31eb63,_0x48d432[_0x50eb('0x3f')]);return db[_0x50eb('0x2b')][_0x50eb('0x47')](_0x31eb63)[_0x50eb('0x23')](handleEntityNotFound(_0x178653,null))[_0x50eb('0x23')](respondWithResult(_0x178653,null))[_0x50eb('0x44')](handleError(_0x178653,null));};exports[_0x50eb('0x48')]=function(_0x19476f,_0x1c8f50){return db['SquareOdbc']['create'](_0x19476f[_0x50eb('0x49')],{})[_0x50eb('0x23')](function(_0x4df57e){var _0x33b9e2=_0x19476f[_0x50eb('0x4a')][_0x50eb('0x25')]({'plain':!![]});if(!_0x33b9e2)throw new Error(_0x50eb('0x4b'));if(_0x33b9e2['role']===_0x50eb('0x4a')){var _0x107045=_0x4df57e['get']({'plain':!![]});var _0x475892='ODBC';return db[_0x50eb('0x4c')][_0x50eb('0x47')]({'where':{'name':_0x475892,'userProfileId':_0x33b9e2[_0x50eb('0x4d')]},'raw':!![]})[_0x50eb('0x23')](function(_0x5c2a65){if(_0x5c2a65&&_0x5c2a65['autoAssociation']===0x0){return db['UserProfileResource'][_0x50eb('0x48')]({'name':_0x107045[_0x50eb('0x28')],'resourceId':_0x107045['id'],'type':_0x5c2a65[_0x50eb('0x28')],'sectionId':_0x5c2a65['id']},{})[_0x50eb('0x23')](function(){return _0x4df57e;});}else{return _0x4df57e;}})[_0x50eb('0x44')](function(_0x12f05c){logger[_0x50eb('0x4e')](_0x50eb('0x4f'),_0x12f05c);throw _0x12f05c;});}return _0x4df57e;})[_0x50eb('0x23')](respondWithResult(_0x1c8f50,0xc9))[_0x50eb('0x44')](handleError(_0x1c8f50,null));};exports[_0x50eb('0x22')]=function(_0x1ed273,_0x255697){if(_0x1ed273[_0x50eb('0x49')]['id']){delete _0x1ed273[_0x50eb('0x49')]['id'];}return db['SquareOdbc'][_0x50eb('0x47')]({'where':{'id':_0x1ed273[_0x50eb('0x45')]['id']}})[_0x50eb('0x23')](handleEntityNotFound(_0x255697,null))['then'](saveUpdates(_0x1ed273[_0x50eb('0x49')],null))[_0x50eb('0x23')](respondWithResult(_0x255697,null))[_0x50eb('0x44')](handleError(_0x255697,null));};exports[_0x50eb('0x24')]=function(_0x35f492,_0x385c60){return db[_0x50eb('0x2b')][_0x50eb('0x47')]({'where':{'id':_0x35f492[_0x50eb('0x45')]['id']}})['then'](handleEntityNotFound(_0x385c60,null))[_0x50eb('0x23')](removeEntity(_0x385c60,null))[_0x50eb('0x44')](handleError(_0x385c60,null));};exports['test']=function(_0x443281,_0x500f8e,_0xb40084){var _0x5a17f4;return db[_0x50eb('0x2b')][_0x50eb('0x47')]({'where':{'id':_0x443281['params']['id']},'attributes':['id',_0x50eb('0x50')]})[_0x50eb('0x23')](handleEntityNotFound(_0x500f8e,null))[_0x50eb('0x23')](function(_0x64b372){if(_0x64b372){var _0x2b83d3=require(_0x50eb('0x51'))();_0x2b83d3[_0x50eb('0x52')](_0x64b372[_0x50eb('0x50')]);_0x2b83d3['closeSync']();return _0x64b372;}})[_0x50eb('0x23')](respondWithResult(_0x500f8e,null))[_0x50eb('0x44')](handleError(_0x500f8e,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 6979ee4..07d147b 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 _0xb728=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0xb728,0xe2));var _0x8b72=function(_0x11eb02,_0x5805c9){_0x11eb02=_0x11eb02-0x0;var _0x13245d=_0xb728[_0x11eb02];return _0x13245d;};'use strict';var _=require(_0x8b72('0x0'));var util=require(_0x8b72('0x1'));var logger=require(_0x8b72('0x2'))(_0x8b72('0x3'));var moment=require('moment');var BPromise=require(_0x8b72('0x4'));var rp=require(_0x8b72('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b72('0x6'));var config=require(_0x8b72('0x7'));var attributes=require(_0x8b72('0x8'));module[_0x8b72('0x9')]=function(_0x462703,_0x425832){return _0x462703[_0x8b72('0xa')](_0x8b72('0xb'),attributes,{'tableName':_0x8b72('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe335=['./squareOdbc.attributes','define','square_odbc','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0xe335,0x12c));var _0x5e33=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe335[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x5e33('0x0'));var util=require('util');var logger=require(_0x5e33('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5e33('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e33('0x3'));var rimraf=require(_0x5e33('0x4'));var config=require(_0x5e33('0x5'));var attributes=require(_0x5e33('0x6'));module['exports']=function(_0x30a9fa,_0x161ff0){return _0x30a9fa[_0x5e33('0x7')]('SquareOdbc',attributes,{'tableName':_0x5e33('0x8'),'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 629bdee..2268ca1 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 _0x65be=['include','map','model','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','find','options','raw','where','attributes'];(function(_0x331af1,_0x5cdcba){var _0x4c2c09=function(_0x4967fb){while(--_0x4967fb){_0x331af1['push'](_0x331af1['shift']());}};_0x4c2c09(++_0x5cdcba);}(_0x65be,0x130));var _0xe65b=function(_0x48b632,_0x2760dd){_0x48b632=_0x48b632-0x0;var _0x3a89a1=_0x65be[_0x48b632];return _0x3a89a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe65b('0x0'));var BPromise=require(_0xe65b('0x1'));var rs=require(_0xe65b('0x2'));var fs=require('fs');var Redis=require(_0xe65b('0x3'));var db=require(_0xe65b('0x4'))['db'];var utils=require(_0xe65b('0x5'));var logger=require(_0xe65b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe65b('0x7'));var client=jayson['client'][_0xe65b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5050b7,_0x4f1f69,_0x2eee63){return new BPromise(function(_0x4d2c11,_0x17ce4f){return client['request'](_0x5050b7,_0x2eee63)[_0xe65b('0x9')](function(_0x3aa67c){logger[_0xe65b('0xa')](_0xe65b('0xb'),_0x4f1f69,_0xe65b('0xc'));logger['debug'](_0xe65b('0xd'),_0x4f1f69,_0xe65b('0xc'),JSON[_0xe65b('0xe')](_0x3aa67c));if(_0x3aa67c[_0xe65b('0xf')]){if(_0x3aa67c[_0xe65b('0xf')][_0xe65b('0x10')]===0x1f4){logger[_0xe65b('0xf')](_0xe65b('0xb'),_0x4f1f69,_0x3aa67c['error'][_0xe65b('0x11')]);return _0x17ce4f(_0x3aa67c[_0xe65b('0xf')][_0xe65b('0x11')]);}logger['error'](_0xe65b('0xb'),_0x4f1f69,_0x3aa67c[_0xe65b('0xf')][_0xe65b('0x11')]);return _0x4d2c11(_0x3aa67c['error'][_0xe65b('0x11')]);}else{logger[_0xe65b('0xa')](_0xe65b('0xb'),_0x4f1f69,_0xe65b('0xc'));_0x4d2c11(_0x3aa67c[_0xe65b('0x12')][_0xe65b('0x11')]);}})[_0xe65b('0x13')](function(_0x3bb355){logger[_0xe65b('0xf')](_0xe65b('0xb'),_0x4f1f69,_0x3bb355);_0x17ce4f(_0x3bb355);});});}exports[_0xe65b('0x14')]=function(_0x5f32e9){var _0x12c32b=this;return new Promise(function(_0x287a17,_0x411301){return db['SquareOdbc'][_0xe65b('0x15')]({'raw':_0x5f32e9[_0xe65b('0x16')]?_0x5f32e9[_0xe65b('0x16')][_0xe65b('0x17')]===undefined?!![]:![]:!![],'where':_0x5f32e9[_0xe65b('0x16')]?_0x5f32e9[_0xe65b('0x16')][_0xe65b('0x18')]||null:null,'attributes':_0x5f32e9['options']?_0x5f32e9[_0xe65b('0x16')][_0xe65b('0x19')]||null:null,'include':_0x5f32e9['options']?_0x5f32e9[_0xe65b('0x16')][_0xe65b('0x1a')]?_[_0xe65b('0x1b')](_0x5f32e9[_0xe65b('0x16')][_0xe65b('0x1a')],function(_0x59d2a7){return{'model':db[_0x59d2a7[_0xe65b('0x1c')]],'as':_0x59d2a7['as'],'attributes':_0x59d2a7[_0xe65b('0x19')],'include':_0x59d2a7[_0xe65b('0x1a')]?_[_0xe65b('0x1b')](_0x59d2a7['include'],function(_0x4c5322){return{'model':db[_0x4c5322[_0xe65b('0x1c')]],'as':_0x4c5322['as'],'attributes':_0x4c5322[_0xe65b('0x19')],'include':_0x4c5322[_0xe65b('0x1a')]?_[_0xe65b('0x1b')](_0x4c5322[_0xe65b('0x1a')],function(_0x134ba8){return{'model':db[_0x134ba8[_0xe65b('0x1c')]],'as':_0x134ba8['as'],'attributes':_0x134ba8[_0xe65b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe65b('0x9')](function(_0x35c360){logger[_0xe65b('0xa')]('ShowSquareOdbc',_0x5f32e9);logger[_0xe65b('0x1d')]('ShowSquareOdbc',_0x5f32e9,JSON['stringify'](_0x35c360));_0x287a17(_0x35c360);})[_0xe65b('0x13')](function(_0x5d98a3){logger[_0xe65b('0xf')](_0xe65b('0x14'),_0x5d98a3[_0xe65b('0x11')],_0x5f32e9);_0x411301(_0x12c32b[_0xe65b('0xf')](0x1f4,_0x5d98a3[_0xe65b('0x11')]));});});}; \ No newline at end of file +var _0xbdd2=['ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','SquareOdbc,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','find','options','where','attributes','map','include','model'];(function(_0x4c7d8b,_0x572388){var _0x187158=function(_0x5e956d){while(--_0x5e956d){_0x4c7d8b['push'](_0x4c7d8b['shift']());}};_0x187158(++_0x572388);}(_0xbdd2,0xa9));var _0x2bdd=function(_0x125e9a,_0x1a9fa5){_0x125e9a=_0x125e9a-0x0;var _0x4f2f79=_0xbdd2[_0x125e9a];return _0x4f2f79;};'use strict';var _=require(_0x2bdd('0x0'));var util=require('util');var moment=require(_0x2bdd('0x1'));var BPromise=require(_0x2bdd('0x2'));var rs=require(_0x2bdd('0x3'));var fs=require('fs');var Redis=require(_0x2bdd('0x4'));var db=require(_0x2bdd('0x5'))['db'];var utils=require(_0x2bdd('0x6'));var logger=require(_0x2bdd('0x7'))(_0x2bdd('0x8'));var config=require(_0x2bdd('0x9'));var jayson=require(_0x2bdd('0xa'));var client=jayson['client'][_0x2bdd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ecf3d,_0x2ca2c3,_0x43b8d9){return new BPromise(function(_0x4daf99,_0x3670c9){return client['request'](_0x1ecf3d,_0x43b8d9)['then'](function(_0x5320e2){logger['info'](_0x2bdd('0xc'),_0x2ca2c3,'request\x20sent');logger[_0x2bdd('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x2ca2c3,'request\x20sent',JSON[_0x2bdd('0xe')](_0x5320e2));if(_0x5320e2[_0x2bdd('0xf')]){if(_0x5320e2[_0x2bdd('0xf')][_0x2bdd('0x10')]===0x1f4){logger[_0x2bdd('0xf')](_0x2bdd('0xc'),_0x2ca2c3,_0x5320e2['error'][_0x2bdd('0x11')]);return _0x3670c9(_0x5320e2[_0x2bdd('0xf')][_0x2bdd('0x11')]);}logger[_0x2bdd('0xf')](_0x2bdd('0xc'),_0x2ca2c3,_0x5320e2[_0x2bdd('0xf')][_0x2bdd('0x11')]);return _0x4daf99(_0x5320e2[_0x2bdd('0xf')][_0x2bdd('0x11')]);}else{logger['info'](_0x2bdd('0xc'),_0x2ca2c3,_0x2bdd('0x12'));_0x4daf99(_0x5320e2[_0x2bdd('0x13')][_0x2bdd('0x11')]);}})['catch'](function(_0x35e372){logger[_0x2bdd('0xf')](_0x2bdd('0xc'),_0x2ca2c3,_0x35e372);_0x3670c9(_0x35e372);});});}exports['ShowSquareOdbc']=function(_0x2a2a5d){var _0x30c294=this;return new Promise(function(_0x2c3597,_0x1881f6){return db['SquareOdbc'][_0x2bdd('0x14')]({'raw':_0x2a2a5d[_0x2bdd('0x15')]?_0x2a2a5d[_0x2bdd('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2a2a5d[_0x2bdd('0x15')]?_0x2a2a5d['options'][_0x2bdd('0x16')]||null:null,'attributes':_0x2a2a5d[_0x2bdd('0x15')]?_0x2a2a5d[_0x2bdd('0x15')][_0x2bdd('0x17')]||null:null,'include':_0x2a2a5d['options']?_0x2a2a5d['options']['include']?_[_0x2bdd('0x18')](_0x2a2a5d['options'][_0x2bdd('0x19')],function(_0x49df98){return{'model':db[_0x49df98['model']],'as':_0x49df98['as'],'attributes':_0x49df98[_0x2bdd('0x17')],'include':_0x49df98['include']?_[_0x2bdd('0x18')](_0x49df98[_0x2bdd('0x19')],function(_0x5aa9e8){return{'model':db[_0x5aa9e8[_0x2bdd('0x1a')]],'as':_0x5aa9e8['as'],'attributes':_0x5aa9e8['attributes'],'include':_0x5aa9e8[_0x2bdd('0x19')]?_['map'](_0x5aa9e8[_0x2bdd('0x19')],function(_0x5624a4){return{'model':db[_0x5624a4['model']],'as':_0x5624a4['as'],'attributes':_0x5624a4[_0x2bdd('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x549b1b){logger['info']('ShowSquareOdbc',_0x2a2a5d);logger[_0x2bdd('0xd')](_0x2bdd('0x1b'),_0x2a2a5d,JSON[_0x2bdd('0xe')](_0x549b1b));_0x2c3597(_0x549b1b);})['catch'](function(_0x31e268){logger[_0x2bdd('0xf')](_0x2bdd('0x1b'),_0x31e268[_0x2bdd('0x11')],_0x2a2a5d);_0x1881f6(_0x30c294[_0x2bdd('0xf')](0x1f4,_0x31e268[_0x2bdd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d0a2124..f1a6557 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 _0xada9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x3e17a9,_0x39afdc){var _0x402e91=function(_0x1a07b1){while(--_0x1a07b1){_0x3e17a9['push'](_0x3e17a9['shift']());}};_0x402e91(++_0x39afdc);}(_0xada9,0x1c9));var _0x9ada=function(_0x4c72f2,_0x42aba8){_0x4c72f2=_0x4c72f2-0x0;var _0xd26d61=_0xada9[_0x4c72f2];return _0xd26d61;};'use strict';var multer=require('multer');var util=require(_0x9ada('0x0'));var path=require(_0x9ada('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ada('0x2'));var router=express[_0x9ada('0x3')]();var fs_extra=require(_0x9ada('0x4'));var auth=require(_0x9ada('0x5'));var interaction=require(_0x9ada('0x6'));var config=require(_0x9ada('0x7'));var controller=require(_0x9ada('0x8'));router[_0x9ada('0x9')]('/',auth[_0x9ada('0xa')](),controller[_0x9ada('0xb')]);router[_0x9ada('0x9')](_0x9ada('0xc'),auth[_0x9ada('0xa')](),controller[_0x9ada('0xd')]);router[_0x9ada('0xe')]('/',auth[_0x9ada('0xa')](),controller[_0x9ada('0xf')]);router[_0x9ada('0x10')]('/:id',auth[_0x9ada('0xa')](),controller[_0x9ada('0x11')]);router[_0x9ada('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9ada('0x13')]);module[_0x9ada('0x14')]=router; \ No newline at end of file +var _0xb822=['post','create','put','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show'];(function(_0x2ac08b,_0x5cfd00){var _0x1e1150=function(_0x542d03){while(--_0x542d03){_0x2ac08b['push'](_0x2ac08b['shift']());}};_0x1e1150(++_0x5cfd00);}(_0xb822,0xe9));var _0x2b82=function(_0x3b433d,_0x1c2324){_0x3b433d=_0x3b433d-0x0;var _0x565741=_0xb822[_0x3b433d];return _0x565741;};'use strict';var multer=require(_0x2b82('0x0'));var util=require('util');var path=require(_0x2b82('0x1'));var timeout=require(_0x2b82('0x2'));var express=require('express');var router=express[_0x2b82('0x3')]();var fs_extra=require(_0x2b82('0x4'));var auth=require(_0x2b82('0x5'));var interaction=require(_0x2b82('0x6'));var config=require(_0x2b82('0x7'));var controller=require(_0x2b82('0x8'));router['get']('/',auth[_0x2b82('0x9')](),controller[_0x2b82('0xa')]);router[_0x2b82('0xb')](_0x2b82('0xc'),auth[_0x2b82('0x9')](),controller[_0x2b82('0xd')]);router[_0x2b82('0xe')]('/',auth['isAuthenticated'](),controller[_0x2b82('0xf')]);router[_0x2b82('0x10')](_0x2b82('0xc'),auth[_0x2b82('0x9')](),controller['update']);router[_0x2b82('0x11')](_0x2b82('0xc'),auth[_0x2b82('0x9')](),controller['destroy']);module[_0x2b82('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index b679e7e..188659e 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 _0x2e6d=['sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE'];(function(_0x5bb877,_0x2bf73e){var _0x59598d=function(_0x24605c){while(--_0x24605c){_0x5bb877['push'](_0x5bb877['shift']());}};_0x59598d(++_0x2bf73e);}(_0x2e6d,0x12b));var _0xd2e6=function(_0x9f6e7,_0x21c299){_0x9f6e7=_0x9f6e7-0x0;var _0x568fd6=_0x2e6d[_0x9f6e7];return _0x568fd6;};'use strict';var Sequelize=require(_0xd2e6('0x0'));module[_0xd2e6('0x1')]={'name':{'type':Sequelize[_0xd2e6('0x2')],'unique':_0xd2e6('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd2e6('0x2')]},'notes':{'type':Sequelize[_0xd2e6('0x4')]},'preproduction':{'type':Sequelize[_0xd2e6('0x5')](_0xd2e6('0x6')),'get':function(){if(this[_0xd2e6('0x7')](_0xd2e6('0x8'))){return this[_0xd2e6('0x7')](_0xd2e6('0x8'))[_0xd2e6('0x9')](_0xd2e6('0xa'));}}},'production':{'type':Sequelize[_0xd2e6('0x5')]('long'),'get':function(){if(this[_0xd2e6('0x7')](_0xd2e6('0xb'))){return this[_0xd2e6('0x7')](_0xd2e6('0xb'))[_0xd2e6('0x9')]('utf8');}}},'savedAt':{'type':Sequelize[_0xd2e6('0xc')]},'publishedAt':{'type':Sequelize[_0xd2e6('0xc')]}}; \ No newline at end of file +var _0xf9fb=['DATE','sequelize','exports','STRING','name','BLOB','long','getDataValue','preproduction','utf8','production'];(function(_0x5e7b6c,_0x4916d0){var _0x3afdbd=function(_0x648ee6){while(--_0x648ee6){_0x5e7b6c['push'](_0x5e7b6c['shift']());}};_0x3afdbd(++_0x4916d0);}(_0xf9fb,0x177));var _0xbf9f=function(_0xb6631d,_0xae4d23){_0xb6631d=_0xb6631d-0x0;var _0x30c4ca=_0xf9fb[_0xb6631d];return _0x30c4ca;};'use strict';var Sequelize=require(_0xbf9f('0x0'));module[_0xbf9f('0x1')]={'name':{'type':Sequelize[_0xbf9f('0x2')],'unique':_0xbf9f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xbf9f('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xbf9f('0x4')](_0xbf9f('0x5')),'get':function(){if(this[_0xbf9f('0x6')](_0xbf9f('0x7'))){return this[_0xbf9f('0x6')](_0xbf9f('0x7'))['toString'](_0xbf9f('0x8'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue']('production')){return this[_0xbf9f('0x6')](_0xbf9f('0x9'))['toString'](_0xbf9f('0x8'));}}},'savedAt':{'type':Sequelize[_0xbf9f('0xa')]},'publishedAt':{'type':Sequelize[_0xbf9f('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index e49e055..a8c7389 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 _0x2d4b=['undefined','limit','count','offset','set','then','destroy','get','SquareProjects','UserProfileResource','publish','stringify','end','sendStatus','name','send','index','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','agi','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','./squareProject.socket','register','status','json'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x2d4b,0xc4));var _0xb2d4=function(_0x4ffafb,_0x20171a){_0x4ffafb=_0x4ffafb-0x0;var _0x4ab472=_0x2d4b[_0x4ffafb];return _0x4ab472;};'use strict';var _=require('lodash');var Redis=require(_0xb2d4('0x0'));var qs=require(_0xb2d4('0x1'));var logger=require('../../config/logger')(_0xb2d4('0x2'));var config=require(_0xb2d4('0x3'));var db=require(_0xb2d4('0x4'))['db'];config[_0xb2d4('0x5')]=_[_0xb2d4('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb2d4('0x7'))[_0xb2d4('0x8')](socket);function respondWithResult(_0x2e137c,_0x8ddc05){_0x8ddc05=_0x8ddc05||0xc8;return function(_0x538f4e){if(_0x538f4e){return _0x2e137c[_0xb2d4('0x9')](_0x8ddc05)[_0xb2d4('0xa')](_0x538f4e);}};}function respondWithFilteredResult(_0x31f98a,_0x280e52){return function(_0x481e18){if(_0x481e18){var _0x481781=typeof _0x280e52['offset']===_0xb2d4('0xb')&&typeof _0x280e52[_0xb2d4('0xc')]===_0xb2d4('0xb');var _0x8a9537=_0x481e18[_0xb2d4('0xd')];var _0x52f39b=_0x481781?0x0:_0x280e52[_0xb2d4('0xe')];var _0x214615=_0x481781?_0x481e18[_0xb2d4('0xd')]:_0x280e52['offset']+_0x280e52[_0xb2d4('0xc')];var _0x5f37ff;if(_0x214615>=_0x8a9537){_0x214615=_0x8a9537;_0x5f37ff=0xc8;}else{_0x5f37ff=0xce;}_0x31f98a[_0xb2d4('0x9')](_0x5f37ff);return _0x31f98a[_0xb2d4('0xf')]('Content-Range',_0x52f39b+'-'+_0x214615+'/'+_0x8a9537)[_0xb2d4('0xa')](_0x481e18);}return null;};}function saveUpdates(_0x33d89b){return function(_0xc197da){if(_0xc197da){return _0xc197da['update'](_0x33d89b)[_0xb2d4('0x10')](function(_0x285f1b){return _0x285f1b;});}return null;};}function removeEntity(_0x3d4cb5){return function(_0x3dde16){if(_0x3dde16){return _0x3dde16[_0xb2d4('0x11')]()[_0xb2d4('0x10')](function(){var _0x4362e8=_0x3dde16[_0xb2d4('0x12')]({'plain':!![]});var _0x4d9a4f=_0xb2d4('0x13');return db[_0xb2d4('0x14')][_0xb2d4('0x11')]({'where':{'type':_0x4d9a4f,'resourceId':_0x4362e8['id']}})[_0xb2d4('0x10')](function(){return _0x3dde16;});})[_0xb2d4('0x10')](function(){var _0x4d59c9=new Redis(config[_0xb2d4('0x5')]);_0x4d59c9[_0xb2d4('0x15')]('agi',JSON[_0xb2d4('0x16')]({'id':_0x3dde16['id'],'deleted':!![]}));})[_0xb2d4('0x10')](function(){_0x3d4cb5[_0xb2d4('0x9')](0xcc)[_0xb2d4('0x17')]();});}};}function handleEntityNotFound(_0x44b2a4){return function(_0x48c317){if(!_0x48c317){_0x44b2a4[_0xb2d4('0x18')](0x194);}return _0x48c317;};}function handleError(_0x422241,_0x58be38){_0x58be38=_0x58be38||0x1f4;return function(_0x29edd1){logger['error'](_0x29edd1['stack']);if(_0x29edd1[_0xb2d4('0x19')]){delete _0x29edd1[_0xb2d4('0x19')];}_0x422241['status'](_0x58be38)[_0xb2d4('0x1a')](_0x29edd1);};}exports[_0xb2d4('0x1b')]=function(_0x21e68f,_0x268528){var _0x1b319d={},_0x1aa2d7={},_0x3aa696={'count':0x0,'rows':[]};var _0x2f8b02=_[_0xb2d4('0x1c')](db[_0xb2d4('0x1d')][_0xb2d4('0x1e')],function(_0x237a3b){return{'name':_0x237a3b[_0xb2d4('0x1f')],'type':_0x237a3b[_0xb2d4('0x20')]['key']};});_0x1aa2d7[_0xb2d4('0x21')]=_[_0xb2d4('0x1c')](_0x2f8b02,_0xb2d4('0x19'));_0x1aa2d7[_0xb2d4('0x22')]=_[_0xb2d4('0x23')](_0x21e68f[_0xb2d4('0x22')]);_0x1aa2d7[_0xb2d4('0x24')]=_[_0xb2d4('0x25')](_0x1aa2d7[_0xb2d4('0x21')],_0x1aa2d7[_0xb2d4('0x22')]);_0x1b319d[_0xb2d4('0x26')]=_[_0xb2d4('0x25')](_0x1aa2d7[_0xb2d4('0x21')],qs[_0xb2d4('0x27')](_0x21e68f[_0xb2d4('0x22')]['fields']));_0x1b319d[_0xb2d4('0x26')]=_0x1b319d[_0xb2d4('0x26')][_0xb2d4('0x28')]?_0x1b319d[_0xb2d4('0x26')]:_0x1aa2d7[_0xb2d4('0x21')];if(!_0x21e68f['query'][_0xb2d4('0x29')](_0xb2d4('0x2a'))){_0x1b319d[_0xb2d4('0xc')]=qs['limit'](_0x21e68f['query'][_0xb2d4('0xc')]);_0x1b319d[_0xb2d4('0xe')]=qs[_0xb2d4('0xe')](_0x21e68f[_0xb2d4('0x22')][_0xb2d4('0xe')]);}_0x1b319d['order']=qs['sort'](_0x21e68f[_0xb2d4('0x22')][_0xb2d4('0x2b')]);_0x1b319d[_0xb2d4('0x2c')]=qs[_0xb2d4('0x24')](_[_0xb2d4('0x2d')](_0x21e68f[_0xb2d4('0x22')],_0x1aa2d7[_0xb2d4('0x24')]),_0x2f8b02);if(_0x21e68f[_0xb2d4('0x22')][_0xb2d4('0x2e')]){_0x1b319d[_0xb2d4('0x2c')]=_['merge'](_0x1b319d['where'],{'$or':_[_0xb2d4('0x1c')](_0x2f8b02,function(_0x2ed088){if(_0x2ed088[_0xb2d4('0x20')]!=='VIRTUAL'){var _0x4f040e={};_0x4f040e[_0x2ed088[_0xb2d4('0x19')]]={'$like':'%'+_0x21e68f[_0xb2d4('0x22')][_0xb2d4('0x2e')]+'%'};return _0x4f040e;}})});}_0x1b319d=_[_0xb2d4('0x2f')]({},_0x1b319d,_0x21e68f['options']);var _0x4c4ecb={'where':_0x1b319d[_0xb2d4('0x2c')]};return db[_0xb2d4('0x1d')][_0xb2d4('0xd')](_0x4c4ecb)['then'](function(_0x59a713){_0x3aa696[_0xb2d4('0xd')]=_0x59a713;if(_0x21e68f['query'][_0xb2d4('0x30')]){_0x1b319d[_0xb2d4('0x31')]=[{'all':!![]}];}return db['SquareProject'][_0xb2d4('0x32')](_0x1b319d);})[_0xb2d4('0x10')](function(_0x16d62e){_0x3aa696[_0xb2d4('0x33')]=_0x16d62e;return _0x3aa696;})[_0xb2d4('0x10')](respondWithFilteredResult(_0x268528,_0x1b319d))[_0xb2d4('0x34')](handleError(_0x268528,null));};exports[_0xb2d4('0x35')]=function(_0x46d0b5,_0x1d54db){var _0x1bbed1={'raw':![],'where':{'id':_0x46d0b5['params']['id']}},_0xa42c66={};_0xa42c66[_0xb2d4('0x21')]=_[_0xb2d4('0x23')](db['SquareProject'][_0xb2d4('0x1e')]);_0xa42c66[_0xb2d4('0x22')]=_[_0xb2d4('0x23')](_0x46d0b5['query']);_0xa42c66[_0xb2d4('0x24')]=_[_0xb2d4('0x25')](_0xa42c66[_0xb2d4('0x21')],_0xa42c66[_0xb2d4('0x22')]);_0x1bbed1[_0xb2d4('0x26')]=_[_0xb2d4('0x25')](_0xa42c66[_0xb2d4('0x21')],qs[_0xb2d4('0x27')](_0x46d0b5[_0xb2d4('0x22')][_0xb2d4('0x27')]));_0x1bbed1['attributes']=_0x1bbed1[_0xb2d4('0x26')][_0xb2d4('0x28')]?_0x1bbed1[_0xb2d4('0x26')]:_0xa42c66[_0xb2d4('0x21')];if(_0x46d0b5[_0xb2d4('0x22')][_0xb2d4('0x30')]){_0x1bbed1[_0xb2d4('0x31')]=[{'all':!![]}];}_0x1bbed1=_[_0xb2d4('0x2f')]({},_0x1bbed1,_0x46d0b5[_0xb2d4('0x36')]);return db[_0xb2d4('0x1d')]['find'](_0x1bbed1)[_0xb2d4('0x10')](handleEntityNotFound(_0x1d54db,null))[_0xb2d4('0x10')](respondWithResult(_0x1d54db,null))['catch'](handleError(_0x1d54db,null));};exports['create']=function(_0x2c120f,_0x431911){return db['SquareProject'][_0xb2d4('0x37')](_0x2c120f[_0xb2d4('0x38')],{})[_0xb2d4('0x10')](function(_0x4d8a3e){var _0x3ad297=_0x2c120f[_0xb2d4('0x39')][_0xb2d4('0x12')]({'plain':!![]});if(!_0x3ad297)throw new Error(_0xb2d4('0x3a'));if(_0x3ad297[_0xb2d4('0x3b')]===_0xb2d4('0x39')){var _0x62dffb=_0x4d8a3e[_0xb2d4('0x12')]({'plain':!![]});var _0x30edb0=_0xb2d4('0x13');return db[_0xb2d4('0x3c')][_0xb2d4('0x3d')]({'where':{'name':_0x30edb0,'userProfileId':_0x3ad297[_0xb2d4('0x3e')]},'raw':!![]})[_0xb2d4('0x10')](function(_0x5df452){if(_0x5df452&&_0x5df452[_0xb2d4('0x3f')]===0x0){return db[_0xb2d4('0x14')][_0xb2d4('0x37')]({'name':_0x62dffb[_0xb2d4('0x19')],'resourceId':_0x62dffb['id'],'type':_0x5df452[_0xb2d4('0x19')],'sectionId':_0x5df452['id']},{})['then'](function(){return _0x4d8a3e;});}else{return _0x4d8a3e;}})[_0xb2d4('0x34')](function(_0x26f044){logger[_0xb2d4('0x40')](_0xb2d4('0x41'),_0x26f044);throw _0x26f044;});}return _0x4d8a3e;})[_0xb2d4('0x10')](respondWithResult(_0x431911,0xc9))['catch'](handleError(_0x431911,null));};exports[_0xb2d4('0x42')]=function(_0x4b021a,_0x2cc28e){if(_0x4b021a[_0xb2d4('0x38')]['id']){delete _0x4b021a['body']['id'];}return db[_0xb2d4('0x1d')]['find']({'where':{'id':_0x4b021a[_0xb2d4('0x43')]['id']}})['then'](handleEntityNotFound(_0x2cc28e,null))[_0xb2d4('0x10')](saveUpdates(_0x4b021a[_0xb2d4('0x38')],null))['then'](function(_0x7ab70e){if(!_0x7ab70e)return;var _0x5c5613=_0x7ab70e[_0xb2d4('0x12')]({'plain':!![]});return _0x5c5613;})[_0xb2d4('0x10')](function(_0x5159f6){var _0x288459=new Redis(config[_0xb2d4('0x5')]);_0x288459[_0xb2d4('0x15')](_0xb2d4('0x44'),JSON[_0xb2d4('0x16')](_[_0xb2d4('0x2d')](_0x5159f6,['id',_0xb2d4('0x19'),'production'])));return _0x5159f6;})[_0xb2d4('0x10')](respondWithResult(_0x2cc28e,null))[_0xb2d4('0x34')](handleError(_0x2cc28e,null));};exports[_0xb2d4('0x11')]=function(_0x2e7d4e,_0xd693ab){return db[_0xb2d4('0x1d')]['find']({'where':{'id':_0x2e7d4e['params']['id']}})[_0xb2d4('0x10')](handleEntityNotFound(_0xd693ab,null))[_0xb2d4('0x10')](removeEntity(_0xd693ab,null))[_0xb2d4('0x34')](handleError(_0xd693ab,null));}; \ No newline at end of file +var _0x237b=['model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','filter','merge','map','VIRTUAL','options','where','includeAll','include','rows','catch','show','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','pick','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./squareProject.socket','register','status','json','offset','limit','undefined','count','Content-Range','then','destroy','SquareProjects','UserProfileResource','publish','agi','stringify','end','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key'];(function(_0x4a3c3a,_0x328558){var _0x34e1e5=function(_0x3b1327){while(--_0x3b1327){_0x4a3c3a['push'](_0x4a3c3a['shift']());}};_0x34e1e5(++_0x328558);}(_0x237b,0xa7));var _0xb237=function(_0x2297cb,_0x4fcb82){_0x2297cb=_0x2297cb-0x0;var _0x5cc5b2=_0x237b[_0x2297cb];return _0x5cc5b2;};'use strict';var _=require('lodash');var Redis=require(_0xb237('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xb237('0x1'))(_0xb237('0x2'));var config=require(_0xb237('0x3'));var db=require(_0xb237('0x4'))['db'];config[_0xb237('0x5')]=_['defaults'](config[_0xb237('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xb237('0x6'))(new Redis(config['redis']));require(_0xb237('0x7'))[_0xb237('0x8')](socket);function respondWithResult(_0x5439dc,_0x183471){_0x183471=_0x183471||0xc8;return function(_0x48b957){if(_0x48b957){return _0x5439dc[_0xb237('0x9')](_0x183471)[_0xb237('0xa')](_0x48b957);}};}function respondWithFilteredResult(_0x593841,_0x44fad5){return function(_0x2439de){if(_0x2439de){var _0x2bb1c0=typeof _0x44fad5[_0xb237('0xb')]==='undefined'&&typeof _0x44fad5[_0xb237('0xc')]===_0xb237('0xd');var _0x19081f=_0x2439de[_0xb237('0xe')];var _0x257153=_0x2bb1c0?0x0:_0x44fad5[_0xb237('0xb')];var _0x5d6c81=_0x2bb1c0?_0x2439de[_0xb237('0xe')]:_0x44fad5[_0xb237('0xb')]+_0x44fad5[_0xb237('0xc')];var _0x1b4d49;if(_0x5d6c81>=_0x19081f){_0x5d6c81=_0x19081f;_0x1b4d49=0xc8;}else{_0x1b4d49=0xce;}_0x593841['status'](_0x1b4d49);return _0x593841['set'](_0xb237('0xf'),_0x257153+'-'+_0x5d6c81+'/'+_0x19081f)[_0xb237('0xa')](_0x2439de);}return null;};}function saveUpdates(_0x418911){return function(_0x4555a9){if(_0x4555a9){return _0x4555a9['update'](_0x418911)[_0xb237('0x10')](function(_0x455e39){return _0x455e39;});}return null;};}function removeEntity(_0x29d7a3){return function(_0xcbb9e5){if(_0xcbb9e5){return _0xcbb9e5[_0xb237('0x11')]()[_0xb237('0x10')](function(){var _0x51e12c=_0xcbb9e5['get']({'plain':!![]});var _0x308268=_0xb237('0x12');return db[_0xb237('0x13')][_0xb237('0x11')]({'where':{'type':_0x308268,'resourceId':_0x51e12c['id']}})[_0xb237('0x10')](function(){return _0xcbb9e5;});})[_0xb237('0x10')](function(){var _0x11fb41=new Redis(config[_0xb237('0x5')]);_0x11fb41[_0xb237('0x14')](_0xb237('0x15'),JSON[_0xb237('0x16')]({'id':_0xcbb9e5['id'],'deleted':!![]}));})[_0xb237('0x10')](function(){_0x29d7a3[_0xb237('0x9')](0xcc)[_0xb237('0x17')]();});}};}function handleEntityNotFound(_0xfc499){return function(_0x4f7bd1){if(!_0x4f7bd1){_0xfc499['sendStatus'](0x194);}return _0x4f7bd1;};}function handleError(_0x1851e6,_0x5a3b19){_0x5a3b19=_0x5a3b19||0x1f4;return function(_0x516352){logger[_0xb237('0x18')](_0x516352[_0xb237('0x19')]);if(_0x516352[_0xb237('0x1a')]){delete _0x516352[_0xb237('0x1a')];}_0x1851e6['status'](_0x5a3b19)[_0xb237('0x1b')](_0x516352);};}exports[_0xb237('0x1c')]=function(_0x21bfc1,_0x4f7303){var _0x2fc3c1={},_0x101689={},_0x9438f1={'count':0x0,'rows':[]};var _0x75c7f4=_['map'](db[_0xb237('0x1d')][_0xb237('0x1e')],function(_0x8a59a5){return{'name':_0x8a59a5[_0xb237('0x1f')],'type':_0x8a59a5[_0xb237('0x20')][_0xb237('0x21')]};});_0x101689[_0xb237('0x22')]=_['map'](_0x75c7f4,_0xb237('0x1a'));_0x101689['query']=_['keys'](_0x21bfc1[_0xb237('0x23')]);_0x101689['filters']=_[_0xb237('0x24')](_0x101689[_0xb237('0x22')],_0x101689[_0xb237('0x23')]);_0x2fc3c1['attributes']=_[_0xb237('0x24')](_0x101689[_0xb237('0x22')],qs[_0xb237('0x25')](_0x21bfc1[_0xb237('0x23')][_0xb237('0x25')]));_0x2fc3c1[_0xb237('0x26')]=_0x2fc3c1['attributes']['length']?_0x2fc3c1['attributes']:_0x101689[_0xb237('0x22')];if(!_0x21bfc1[_0xb237('0x23')][_0xb237('0x27')](_0xb237('0x28'))){_0x2fc3c1[_0xb237('0xc')]=qs[_0xb237('0xc')](_0x21bfc1[_0xb237('0x23')][_0xb237('0xc')]);_0x2fc3c1['offset']=qs[_0xb237('0xb')](_0x21bfc1[_0xb237('0x23')][_0xb237('0xb')]);}_0x2fc3c1['order']=qs[_0xb237('0x29')](_0x21bfc1[_0xb237('0x23')]['sort']);_0x2fc3c1['where']=qs[_0xb237('0x2a')](_['pick'](_0x21bfc1[_0xb237('0x23')],_0x101689[_0xb237('0x2a')]),_0x75c7f4);if(_0x21bfc1[_0xb237('0x23')][_0xb237('0x2b')]){_0x2fc3c1['where']=_[_0xb237('0x2c')](_0x2fc3c1['where'],{'$or':_[_0xb237('0x2d')](_0x75c7f4,function(_0x2e45c9){if(_0x2e45c9[_0xb237('0x20')]!==_0xb237('0x2e')){var _0xc829d9={};_0xc829d9[_0x2e45c9['name']]={'$like':'%'+_0x21bfc1[_0xb237('0x23')]['filter']+'%'};return _0xc829d9;}})});}_0x2fc3c1=_[_0xb237('0x2c')]({},_0x2fc3c1,_0x21bfc1[_0xb237('0x2f')]);var _0x1894dc={'where':_0x2fc3c1[_0xb237('0x30')]};return db['SquareProject']['count'](_0x1894dc)[_0xb237('0x10')](function(_0x2f4659){_0x9438f1[_0xb237('0xe')]=_0x2f4659;if(_0x21bfc1['query'][_0xb237('0x31')]){_0x2fc3c1[_0xb237('0x32')]=[{'all':!![]}];}return db[_0xb237('0x1d')]['findAll'](_0x2fc3c1);})[_0xb237('0x10')](function(_0x3508b2){_0x9438f1[_0xb237('0x33')]=_0x3508b2;return _0x9438f1;})[_0xb237('0x10')](respondWithFilteredResult(_0x4f7303,_0x2fc3c1))[_0xb237('0x34')](handleError(_0x4f7303,null));};exports[_0xb237('0x35')]=function(_0x4a1d19,_0xfde31e){var _0x6e1849={'raw':![],'where':{'id':_0x4a1d19[_0xb237('0x36')]['id']}},_0x155010={};_0x155010[_0xb237('0x22')]=_[_0xb237('0x37')](db[_0xb237('0x1d')][_0xb237('0x1e')]);_0x155010[_0xb237('0x23')]=_[_0xb237('0x37')](_0x4a1d19['query']);_0x155010[_0xb237('0x2a')]=_[_0xb237('0x24')](_0x155010['model'],_0x155010['query']);_0x6e1849[_0xb237('0x26')]=_['intersection'](_0x155010[_0xb237('0x22')],qs[_0xb237('0x25')](_0x4a1d19[_0xb237('0x23')]['fields']));_0x6e1849['attributes']=_0x6e1849[_0xb237('0x26')][_0xb237('0x38')]?_0x6e1849[_0xb237('0x26')]:_0x155010[_0xb237('0x22')];if(_0x4a1d19[_0xb237('0x23')]['includeAll']){_0x6e1849['include']=[{'all':!![]}];}_0x6e1849=_[_0xb237('0x2c')]({},_0x6e1849,_0x4a1d19[_0xb237('0x2f')]);return db[_0xb237('0x1d')][_0xb237('0x39')](_0x6e1849)[_0xb237('0x10')](handleEntityNotFound(_0xfde31e,null))[_0xb237('0x10')](respondWithResult(_0xfde31e,null))[_0xb237('0x34')](handleError(_0xfde31e,null));};exports[_0xb237('0x3a')]=function(_0x39fbc6,_0x4b2a3a){return db[_0xb237('0x1d')][_0xb237('0x3a')](_0x39fbc6[_0xb237('0x3b')],{})[_0xb237('0x10')](function(_0x3e1aef){var _0x2eb333=_0x39fbc6['user']['get']({'plain':!![]});if(!_0x2eb333)throw new Error(_0xb237('0x3c'));if(_0x2eb333['role']===_0xb237('0x3d')){var _0xb46b8f=_0x3e1aef[_0xb237('0x3e')]({'plain':!![]});var _0x41dd2f=_0xb237('0x12');return db[_0xb237('0x3f')][_0xb237('0x39')]({'where':{'name':_0x41dd2f,'userProfileId':_0x2eb333[_0xb237('0x40')]},'raw':!![]})[_0xb237('0x10')](function(_0xc20c7e){if(_0xc20c7e&&_0xc20c7e[_0xb237('0x41')]===0x0){return db[_0xb237('0x13')][_0xb237('0x3a')]({'name':_0xb46b8f['name'],'resourceId':_0xb46b8f['id'],'type':_0xc20c7e[_0xb237('0x1a')],'sectionId':_0xc20c7e['id']},{})[_0xb237('0x10')](function(){return _0x3e1aef;});}else{return _0x3e1aef;}})[_0xb237('0x34')](function(_0x2e19c5){logger[_0xb237('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e19c5);throw _0x2e19c5;});}return _0x3e1aef;})[_0xb237('0x10')](respondWithResult(_0x4b2a3a,0xc9))[_0xb237('0x34')](handleError(_0x4b2a3a,null));};exports['update']=function(_0x993804,_0x4b6856){if(_0x993804[_0xb237('0x3b')]['id']){delete _0x993804[_0xb237('0x3b')]['id'];}return db[_0xb237('0x1d')]['find']({'where':{'id':_0x993804['params']['id']}})[_0xb237('0x10')](handleEntityNotFound(_0x4b6856,null))[_0xb237('0x10')](saveUpdates(_0x993804['body'],null))[_0xb237('0x10')](function(_0x5b452a){if(!_0x5b452a)return;var _0x34cbd1=_0x5b452a[_0xb237('0x3e')]({'plain':!![]});return _0x34cbd1;})[_0xb237('0x10')](function(_0x3ea5fb){var _0xdc631=new Redis(config[_0xb237('0x5')]);_0xdc631['publish']('agi',JSON[_0xb237('0x16')](_[_0xb237('0x42')](_0x3ea5fb,['id','name','production'])));return _0x3ea5fb;})[_0xb237('0x10')](respondWithResult(_0x4b6856,null))[_0xb237('0x34')](handleError(_0x4b6856,null));};exports[_0xb237('0x11')]=function(_0x59d32c,_0x4d1b54){return db['SquareProject'][_0xb237('0x39')]({'where':{'id':_0x59d32c['params']['id']}})[_0xb237('0x10')](handleEntityNotFound(_0x4d1b54,null))[_0xb237('0x10')](removeEntity(_0x4d1b54,null))['catch'](handleError(_0x4d1b54,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 89018b7..9bf97a9 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 _0x56d6=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x56d6,0x167));var _0x656d=function(_0x43d53b,_0x330712){_0x43d53b=_0x43d53b-0x0;var _0x38d869=_0x56d6[_0x43d53b];return _0x38d869;};'use strict';var EventEmitter=require(_0x656d('0x0'));var SquareProject=require(_0x656d('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x656d('0x2')](0x0);var events={'afterCreate':_0x656d('0x3'),'afterUpdate':'update','afterDestroy':_0x656d('0x4')};function emitEvent(_0x237700){return function(_0x6010d7,_0x4b6590,_0x51faf2){SquareProjectEvents[_0x656d('0x5')](_0x237700+':'+_0x6010d7['id'],_0x6010d7);SquareProjectEvents[_0x656d('0x5')](_0x237700,_0x6010d7);_0x51faf2(null);};}for(var e in events){if(events[_0x656d('0x6')](e)){var event=events[e];SquareProject[_0x656d('0x7')](e,emitEvent(event));}}module[_0x656d('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x338b=['SquareProject','setMaxListeners','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x17973c,_0x2a3b9b){var _0x2f7b0e=function(_0x520d77){while(--_0x520d77){_0x17973c['push'](_0x17973c['shift']());}};_0x2f7b0e(++_0x2a3b9b);}(_0x338b,0xce));var _0xb338=function(_0x2cf15a,_0x3ef3da){_0x2cf15a=_0x2cf15a-0x0;var _0x266488=_0x338b[_0x2cf15a];return _0x266488;};'use strict';var EventEmitter=require(_0xb338('0x0'));var SquareProject=require(_0xb338('0x1'))['db'][_0xb338('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb338('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb338('0x4')};function emitEvent(_0x4a05a7){return function(_0x312fb2,_0x4ad1fe,_0x5b59b9){SquareProjectEvents[_0xb338('0x5')](_0x4a05a7+':'+_0x312fb2['id'],_0x312fb2);SquareProjectEvents[_0xb338('0x5')](_0x4a05a7,_0x312fb2);_0x5b59b9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xb338('0x6')](e,emitEvent(event));}}module[_0xb338('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index a23826f..0fe778c 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 _0xbd25=['../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','moment','bluebird','request-promise','path'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0xbd25,0x1d7));var _0x5bd2=function(_0x2bcc87,_0x937b46){_0x2bcc87=_0x2bcc87-0x0;var _0x42e86e=_0xbd25[_0x2bcc87];return _0x42e86e;};'use strict';var _=require('lodash');var util=require(_0x5bd2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5bd2('0x1'));var BPromise=require(_0x5bd2('0x2'));var rp=require(_0x5bd2('0x3'));var fs=require('fs');var path=require(_0x5bd2('0x4'));var rimraf=require('rimraf');var config=require(_0x5bd2('0x5'));var attributes=require(_0x5bd2('0x6'));module[_0x5bd2('0x7')]=function(_0x5c9a78,_0x56dc0e){return _0x5c9a78[_0x5bd2('0x8')](_0x5bd2('0x9'),attributes,{'tableName':_0x5bd2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11d5ef,_0x5eb279,_0x36289b){if(_0x11d5ef[_0x5bd2('0xb')](_0x5bd2('0xc'))){_0x11d5ef['savedAt']=moment()[_0x5bd2('0xd')](_0x5bd2('0xe'));}if(_0x11d5ef[_0x5bd2('0xb')](_0x5bd2('0xf'))){_0x11d5ef[_0x5bd2('0x10')]=moment()[_0x5bd2('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x36289b(null,_0x11d5ef);}}});}; \ No newline at end of file +var _0x8080=['../../config/environment','define','SquareProject','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x42da69,_0x36aa3a){var _0x3e4198=function(_0x58882f){while(--_0x58882f){_0x42da69['push'](_0x42da69['shift']());}};_0x3e4198(++_0x36aa3a);}(_0x8080,0x12b));var _0x0808=function(_0x17ef88,_0x581af4){_0x17ef88=_0x17ef88-0x0;var _0x1dc0fc=_0x8080[_0x17ef88];return _0x1dc0fc;};'use strict';var _=require(_0x0808('0x0'));var util=require(_0x0808('0x1'));var logger=require(_0x0808('0x2'))(_0x0808('0x3'));var moment=require(_0x0808('0x4'));var BPromise=require('bluebird');var rp=require(_0x0808('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0808('0x6'));var config=require(_0x0808('0x7'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x2fee02,_0xf8003a){return _0x2fee02[_0x0808('0x8')](_0x0808('0x9'),attributes,{'tableName':_0x0808('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4cd588,_0x570d63,_0x46207b){if(_0x4cd588[_0x0808('0xb')](_0x0808('0xc'))){_0x4cd588[_0x0808('0xd')]=moment()['format'](_0x0808('0xe'));}if(_0x4cd588['changed'](_0x0808('0xf'))){_0x4cd588[_0x0808('0x10')]=moment()[_0x0808('0x11')](_0x0808('0xe'));}_0x46207b(null,_0x4cd588);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index d4db511..300c835 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 _0xa18d=['ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','where','attributes','map','model','include','then','info','debug','stringify','catch','error','message','SquareProject','find','raw','ShowSquareProject'];(function(_0x577b92,_0xb672f9){var _0x430d28=function(_0x2509c4){while(--_0x2509c4){_0x577b92['push'](_0x577b92['shift']());}};_0x430d28(++_0xb672f9);}(_0xa18d,0xc4));var _0xda18=function(_0x1a99e0,_0x38f839){_0x1a99e0=_0x1a99e0-0x0;var _0xb02bcf=_0xa18d[_0x1a99e0];return _0xb02bcf;};'use strict';var _=require('lodash');var Redis=require(_0xda18('0x0'));var db=require('../../mysqldb')['db'];var logger=require(_0xda18('0x1'))('rpc');var config=require(_0xda18('0x2'));config[_0xda18('0x3')]=_[_0xda18('0x4')](config['redis'],{'host':_0xda18('0x5'),'port':0x18eb});var socket=require(_0xda18('0x6'))(new Redis(config[_0xda18('0x3')]));require(_0xda18('0x7'))[_0xda18('0x8')](socket);exports[_0xda18('0x9')]=function(_0x2be53e){var _0x32ea4e=this;return new Promise(function(_0x2d2f55,_0x4e39fd){return db['SquareProject'][_0xda18('0xa')]({'raw':_0x2be53e[_0xda18('0xb')]?_0x2be53e['options']['raw']===undefined?!![]:![]:!![],'where':_0x2be53e[_0xda18('0xb')]?_0x2be53e[_0xda18('0xb')][_0xda18('0xc')]||null:null,'attributes':_0x2be53e[_0xda18('0xb')]?_0x2be53e[_0xda18('0xb')][_0xda18('0xd')]||null:null,'limit':_0x2be53e['options']?_0x2be53e[_0xda18('0xb')]['limit']||null:null,'include':_0x2be53e[_0xda18('0xb')]?_0x2be53e['options']['include']?_[_0xda18('0xe')](_0x2be53e['options']['include'],function(_0xd28b8){return{'model':db[_0xd28b8[_0xda18('0xf')]],'as':_0xd28b8['as'],'attributes':_0xd28b8[_0xda18('0xd')],'include':_0xd28b8[_0xda18('0x10')]?_[_0xda18('0xe')](_0xd28b8[_0xda18('0x10')],function(_0x140399){return{'model':db[_0x140399[_0xda18('0xf')]],'as':_0x140399['as'],'attributes':_0x140399[_0xda18('0xd')],'include':_0x140399[_0xda18('0x10')]?_['map'](_0x140399[_0xda18('0x10')],function(_0x3ab2a6){return{'model':db[_0x3ab2a6[_0xda18('0xf')]],'as':_0x3ab2a6['as'],'attributes':_0x3ab2a6[_0xda18('0xd')]};}):[]};}):[]};}):[]:[]})[_0xda18('0x11')](function(_0x200d23){logger[_0xda18('0x12')]('GetSquareProjects',_0x2be53e);logger[_0xda18('0x13')]('GetSquareProjects',_0x2be53e,JSON[_0xda18('0x14')](_0x200d23));_0x2d2f55(_0x200d23);})[_0xda18('0x15')](function(_0x499d3f){logger[_0xda18('0x16')](_0xda18('0x9'),_0x499d3f[_0xda18('0x17')],_0x2be53e);_0x4e39fd(_0x32ea4e[_0xda18('0x16')](0x1f4,_0x499d3f[_0xda18('0x17')]));});});};exports['ShowSquareProject']=function(_0xbae20){var _0x3c9241=this;return new Promise(function(_0x24ddbc,_0x2b72a5){return db[_0xda18('0x18')][_0xda18('0x19')]({'raw':_0xbae20[_0xda18('0xb')]?_0xbae20[_0xda18('0xb')][_0xda18('0x1a')]===undefined?!![]:![]:!![],'where':_0xbae20[_0xda18('0xb')]?_0xbae20[_0xda18('0xb')][_0xda18('0xc')]||null:null,'attributes':_0xbae20[_0xda18('0xb')]?_0xbae20[_0xda18('0xb')][_0xda18('0xd')]||null:null,'include':_0xbae20[_0xda18('0xb')]?_0xbae20[_0xda18('0xb')][_0xda18('0x10')]?_[_0xda18('0xe')](_0xbae20['options']['include'],function(_0x1f509a){return{'model':db[_0x1f509a[_0xda18('0xf')]],'as':_0x1f509a['as'],'attributes':_0x1f509a['attributes'],'include':_0x1f509a['include']?_[_0xda18('0xe')](_0x1f509a[_0xda18('0x10')],function(_0x20f81a){return{'model':db[_0x20f81a[_0xda18('0xf')]],'as':_0x20f81a['as'],'attributes':_0x20f81a['attributes'],'include':_0x20f81a[_0xda18('0x10')]?_[_0xda18('0xe')](_0x20f81a['include'],function(_0x5c85a6){return{'model':db[_0x5c85a6[_0xda18('0xf')]],'as':_0x5c85a6['as'],'attributes':_0x5c85a6[_0xda18('0xd')]};}):[]};}):[]};}):[]:[]})[_0xda18('0x11')](function(_0x845acf){logger['info'](_0xda18('0x1b'),_0xbae20);logger['debug'](_0xda18('0x1b'),_0xbae20,JSON[_0xda18('0x14')](_0x845acf));_0x24ddbc(_0x845acf);})[_0xda18('0x15')](function(_0x464186){logger[_0xda18('0x16')](_0xda18('0x1b'),_0x464186['message'],_0xbae20);_0x2b72a5(_0x3c9241[_0xda18('0x16')](0x1f4,_0x464186[_0xda18('0x17')]));});});}; \ No newline at end of file +var _0x32d9=['options','raw','limit','include','model','attributes','map','info','debug','error','message','find','then','ShowSquareProject','stringify','lodash','ioredis','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll'];(function(_0xa0ec91,_0x1735d3){var _0x2b546a=function(_0x125039){while(--_0x125039){_0xa0ec91['push'](_0xa0ec91['shift']());}};_0x2b546a(++_0x1735d3);}(_0x32d9,0x131));var _0x932d=function(_0x4cbf33,_0xa7cdf){_0x4cbf33=_0x4cbf33-0x0;var _0x45b028=_0x32d9[_0x4cbf33];return _0x45b028;};'use strict';var _=require(_0x932d('0x0'));var Redis=require(_0x932d('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x932d('0x2'))(_0x932d('0x3'));var config=require(_0x932d('0x4'));config['redis']=_[_0x932d('0x5')](config[_0x932d('0x6')],{'host':_0x932d('0x7'),'port':0x18eb});var socket=require(_0x932d('0x8'))(new Redis(config[_0x932d('0x6')]));require(_0x932d('0x9'))[_0x932d('0xa')](socket);exports[_0x932d('0xb')]=function(_0x53eea3){var _0x34985a=this;return new Promise(function(_0x2af52b,_0x25ed42){return db[_0x932d('0xc')][_0x932d('0xd')]({'raw':_0x53eea3[_0x932d('0xe')]?_0x53eea3[_0x932d('0xe')][_0x932d('0xf')]===undefined?!![]:![]:!![],'where':_0x53eea3['options']?_0x53eea3['options']['where']||null:null,'attributes':_0x53eea3[_0x932d('0xe')]?_0x53eea3[_0x932d('0xe')]['attributes']||null:null,'limit':_0x53eea3[_0x932d('0xe')]?_0x53eea3['options'][_0x932d('0x10')]||null:null,'include':_0x53eea3[_0x932d('0xe')]?_0x53eea3['options'][_0x932d('0x11')]?_['map'](_0x53eea3['options']['include'],function(_0x553327){return{'model':db[_0x553327[_0x932d('0x12')]],'as':_0x553327['as'],'attributes':_0x553327[_0x932d('0x13')],'include':_0x553327['include']?_[_0x932d('0x14')](_0x553327[_0x932d('0x11')],function(_0x3184d1){return{'model':db[_0x3184d1[_0x932d('0x12')]],'as':_0x3184d1['as'],'attributes':_0x3184d1[_0x932d('0x13')],'include':_0x3184d1[_0x932d('0x11')]?_[_0x932d('0x14')](_0x3184d1[_0x932d('0x11')],function(_0x2c7f24){return{'model':db[_0x2c7f24[_0x932d('0x12')]],'as':_0x2c7f24['as'],'attributes':_0x2c7f24[_0x932d('0x13')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ebca9){logger[_0x932d('0x15')]('GetSquareProjects',_0x53eea3);logger[_0x932d('0x16')](_0x932d('0xb'),_0x53eea3,JSON['stringify'](_0x2ebca9));_0x2af52b(_0x2ebca9);})['catch'](function(_0x3870e0){logger[_0x932d('0x17')]('GetSquareProjects',_0x3870e0[_0x932d('0x18')],_0x53eea3);_0x25ed42(_0x34985a[_0x932d('0x17')](0x1f4,_0x3870e0['message']));});});};exports['ShowSquareProject']=function(_0x38b20d){var _0xc457a0=this;return new Promise(function(_0x505bb6,_0x1d331a){return db[_0x932d('0xc')][_0x932d('0x19')]({'raw':_0x38b20d[_0x932d('0xe')]?_0x38b20d[_0x932d('0xe')][_0x932d('0xf')]===undefined?!![]:![]:!![],'where':_0x38b20d['options']?_0x38b20d[_0x932d('0xe')]['where']||null:null,'attributes':_0x38b20d['options']?_0x38b20d[_0x932d('0xe')]['attributes']||null:null,'include':_0x38b20d['options']?_0x38b20d[_0x932d('0xe')][_0x932d('0x11')]?_['map'](_0x38b20d['options'][_0x932d('0x11')],function(_0x3545e6){return{'model':db[_0x3545e6[_0x932d('0x12')]],'as':_0x3545e6['as'],'attributes':_0x3545e6[_0x932d('0x13')],'include':_0x3545e6[_0x932d('0x11')]?_[_0x932d('0x14')](_0x3545e6[_0x932d('0x11')],function(_0x2b2517){return{'model':db[_0x2b2517['model']],'as':_0x2b2517['as'],'attributes':_0x2b2517[_0x932d('0x13')],'include':_0x2b2517[_0x932d('0x11')]?_[_0x932d('0x14')](_0x2b2517[_0x932d('0x11')],function(_0x5f4bf6){return{'model':db[_0x5f4bf6['model']],'as':_0x5f4bf6['as'],'attributes':_0x5f4bf6[_0x932d('0x13')]};}):[]};}):[]};}):[]:[]})[_0x932d('0x1a')](function(_0xd55421){logger[_0x932d('0x15')](_0x932d('0x1b'),_0x38b20d);logger[_0x932d('0x16')](_0x932d('0x1b'),_0x38b20d,JSON[_0x932d('0x1c')](_0xd55421));_0x505bb6(_0xd55421);})['catch'](function(_0x1c0e26){logger[_0x932d('0x17')](_0x932d('0x1b'),_0x1c0e26[_0x932d('0x18')],_0x38b20d);_0x1d331a(_0xc457a0[_0x932d('0x17')](0x1f4,_0x1c0e26[_0x932d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 69f273e..8e75ff1 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 _0xf966=['emit','register','save','remove','update'];(function(_0x424292,_0x580796){var _0x2909fa=function(_0x35e52e){while(--_0x35e52e){_0x424292['push'](_0x424292['shift']());}};_0x2909fa(++_0x580796);}(_0xf966,0x101));var _0x6f96=function(_0x55d50e,_0x67fa72){_0x55d50e=_0x55d50e-0x0;var _0xcd9855=_0xf966[_0x55d50e];return _0xcd9855;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x6f96('0x0'),_0x6f96('0x1'),_0x6f96('0x2')];function createListener(_0x1a19c0,_0x3252c5){return function(_0x221fe3){_0x3252c5[_0x6f96('0x3')](_0x1a19c0,_0x221fe3);};}function removeListener(_0x4b996c,_0x572395){return function(){SquareProjectEvents['removeListener'](_0x4b996c,_0x572395);};}exports[_0x6f96('0x4')]=function(_0x505e36){for(var _0x243ebc=0x0,_0x3e3684=events['length'];_0x243ebc<_0x3e3684;_0x243ebc++){var _0x332c91=events[_0x243ebc];var _0x140b43=createListener('squareProject:'+_0x332c91,_0x505e36);SquareProjectEvents['on'](_0x332c91,_0x140b43);}}; \ No newline at end of file +var _0xc8b4=['remove','emit','removeListener','length','save'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xc8b4,0x130));var _0x4c8b=function(_0xb9d548,_0x234336){_0xb9d548=_0xb9d548-0x0;var _0x15b12c=_0xc8b4[_0xb9d548];return _0x15b12c;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x4c8b('0x0'),_0x4c8b('0x1'),'update'];function createListener(_0x3f1195,_0x480509){return function(_0x4aeac7){_0x480509[_0x4c8b('0x2')](_0x3f1195,_0x4aeac7);};}function removeListener(_0x2751b0,_0x261979){return function(){SquareProjectEvents[_0x4c8b('0x3')](_0x2751b0,_0x261979);};}exports['register']=function(_0x392cea){for(var _0x4ca78a=0x0,_0x496d17=events[_0x4c8b('0x4')];_0x4ca78a<_0x496d17;_0x4ca78a++){var _0x289578=events[_0x4ca78a];var _0x448a8f=createListener('squareProject:'+_0x289578,_0x392cea);SquareProjectEvents['on'](_0x289578,_0x448a8f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 51d7588..2eead9e 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 _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x4c5b1e,_0x53f68e){var _0x1fe3a6=function(_0x4dc81d){while(--_0x4dc81d){_0x4c5b1e['push'](_0x4c5b1e['shift']());}};_0x1fe3a6(++_0x53f68e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x25ff60,_0x2c91f7){_0x25ff60=_0x25ff60-0x0;var _0x3daebc=_0x1cb9[_0x25ff60];return _0x3daebc;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file +var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x3a8d60,_0xdf2b13){var _0xacf927=function(_0x16541a){while(--_0x16541a){_0x3a8d60['push'](_0x3a8d60['shift']());}};_0xacf927(++_0xdf2b13);}(_0x53ec,0x192));var _0xc53e=function(_0x553ac2,_0x156cf0){_0x553ac2=_0x553ac2-0x0;var _0x2182d8=_0x53ec[_0x553ac2];return _0x2182d8;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 8eeb4e9..d4ab0d5 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 _0x6f47=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue'];(function(_0x4e1de7,_0x4e85e8){var _0xeeda46=function(_0x577c47){while(--_0x577c47){_0x4e1de7['push'](_0x4e1de7['shift']());}};_0xeeda46(++_0x4e85e8);}(_0x6f47,0xc7));var _0x76f4=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x6f47[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'uniqueid':{'type':Sequelize[_0x76f4('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76f4('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x76f4('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x76f4('0x1')]},'dnid':{'type':Sequelize[_0x76f4('0x1')]},'projectName':{'type':Sequelize[_0x76f4('0x1')]},'saveName':{'type':Sequelize[_0x76f4('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x76f4('0x1')]},'format':{'type':Sequelize[_0x76f4('0x2')],'get':function(){var _0x2176a7='';var _0x497f99=this[_0x76f4('0x3')](_0x76f4('0x4'));if(_0x497f99){_0x2176a7=_0x497f99[_0x76f4('0x5')](_0x497f99[_0x76f4('0x6')]('.'));}return _0x2176a7;}}}; \ No newline at end of file +var _0x6aa7=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x2b7fe1,_0x278871){var _0x4232ca=function(_0x449d14){while(--_0x449d14){_0x2b7fe1['push'](_0x2b7fe1['shift']());}};_0x4232ca(++_0x278871);}(_0x6aa7,0x178));var _0x76aa=function(_0x14f0d2,_0x49979c){_0x14f0d2=_0x14f0d2-0x0;var _0x29a6cd=_0x6aa7[_0x14f0d2];return _0x29a6cd;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'callerid':{'type':Sequelize[_0x76aa('0x1')]},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'context':{'type':Sequelize[_0x76aa('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x1')]},'accountcode':{'type':Sequelize[_0x76aa('0x1')]},'dnid':{'type':Sequelize[_0x76aa('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x76aa('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x76aa('0x2')],'get':function(){var _0x36d12b='';var _0xa9b695=this['getDataValue'](_0x76aa('0x3'));if(_0xa9b695){_0x36d12b=_0xa9b695[_0x76aa('0x4')](_0xa9b695[_0x76aa('0x5')]('.'));}return _0x36d12b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b529820..8a30854 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 _0x8d86=['merge','VIRTUAL','includeAll','rows','catch','show','options','find','create','body','params','download','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','File:\x20\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','filters','filter','where'];(function(_0x51f855,_0x1afe8a){var _0x958f34=function(_0x40426e){while(--_0x40426e){_0x51f855['push'](_0x51f855['shift']());}};_0x958f34(++_0x1afe8a);}(_0x8d86,0x138));var _0x68d8=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x8d86[_0x4b7895];return _0x264180;};'use strict';var emlformat=require(_0x68d8('0x0'));var rimraf=require(_0x68d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x68d8('0x2'));var rp=require(_0x68d8('0x3'));var moment=require(_0x68d8('0x4'));var BPromise=require(_0x68d8('0x5'));var Mustache=require(_0x68d8('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x68d8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68d8('0x8'));var _=require(_0x68d8('0x9'));var squel=require(_0x68d8('0xa'));var crypto=require(_0x68d8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x68d8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x68d8('0xd'));var Papa=require(_0x68d8('0xe'));var Redis=require('ioredis');var authService=require(_0x68d8('0xf'));var qs=require(_0x68d8('0x10'));var as=require(_0x68d8('0x11'));var hardwareService=require(_0x68d8('0x12'));var logger=require('../../config/logger')(_0x68d8('0x13'));var utils=require(_0x68d8('0x14'));var config=require(_0x68d8('0x15'));var licenseUtil=require(_0x68d8('0x16'));var db=require(_0x68d8('0x17'))['db'];function respondWithStatusCode(_0x5ac3b3,_0x431014){_0x431014=_0x431014||0xcc;return function(_0x3f6671){if(_0x3f6671){return _0x5ac3b3[_0x68d8('0x18')](_0x431014);}return _0x5ac3b3[_0x68d8('0x19')](_0x431014)[_0x68d8('0x1a')]();};}function respondWithResult(_0x455f13,_0xf7f84a){_0xf7f84a=_0xf7f84a||0xc8;return function(_0x41293f){if(_0x41293f){return _0x455f13[_0x68d8('0x19')](_0xf7f84a)[_0x68d8('0x1b')](_0x41293f);}};}function respondWithFilteredResult(_0x2a2f2b,_0x1b29df){return function(_0x6ddb17){if(_0x6ddb17){var _0x311c13=typeof _0x1b29df['offset']===_0x68d8('0x1c')&&typeof _0x1b29df[_0x68d8('0x1d')]===_0x68d8('0x1c');var _0x3ee083=_0x6ddb17[_0x68d8('0x1e')];var _0x5d58b5=_0x311c13?0x0:_0x1b29df['offset'];var _0x7ce455=_0x311c13?_0x6ddb17[_0x68d8('0x1e')]:_0x1b29df[_0x68d8('0x1f')]+_0x1b29df['limit'];var _0x5668a7;if(_0x7ce455>=_0x3ee083){_0x7ce455=_0x3ee083;_0x5668a7=0xc8;}else{_0x5668a7=0xce;}_0x2a2f2b[_0x68d8('0x19')](_0x5668a7);return _0x2a2f2b[_0x68d8('0x20')](_0x68d8('0x21'),_0x5d58b5+'-'+_0x7ce455+'/'+_0x3ee083)['json'](_0x6ddb17);}return null;};}function patchUpdates(_0x362059){return function(_0x1e00f0){try{jsonpatch['apply'](_0x1e00f0,_0x362059,!![]);}catch(_0x511ec4){return BPromise[_0x68d8('0x22')](_0x511ec4);}return _0x1e00f0[_0x68d8('0x23')]();};}function saveUpdates(_0x1a786f,_0x406130){return function(_0x43fc50){if(_0x43fc50){return _0x43fc50[_0x68d8('0x24')](_0x1a786f)[_0x68d8('0x25')](function(_0x1ff290){return _0x1ff290;});}return null;};}function removeEntity(_0x3f37d1,_0x185f8f){return function(_0x20201a){if(_0x20201a){return _0x20201a[_0x68d8('0x26')]()[_0x68d8('0x25')](function(){_0x3f37d1[_0x68d8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4373f7,_0xc86778){return function(_0x5c0506){if(!_0x5c0506){_0x4373f7[_0x68d8('0x18')](0x194);}return _0x5c0506;};}function handleError(_0x5196fb,_0x407dcb){_0x407dcb=_0x407dcb||0x1f4;return function(_0xe8716b){logger[_0x68d8('0x27')](_0xe8716b[_0x68d8('0x28')]);if(_0xe8716b[_0x68d8('0x29')]){delete _0xe8716b['name'];}_0x5196fb[_0x68d8('0x19')](_0x407dcb)[_0x68d8('0x2a')](_0xe8716b);};}exports[_0x68d8('0x2b')]=function(_0x290693,_0x3892f6){var _0x283861={},_0x395cf0={},_0x54281c={'count':0x0,'rows':[]};var _0x9fb259=_[_0x68d8('0x2c')](db[_0x68d8('0x2d')]['rawAttributes'],function(_0x4ca470){return{'name':_0x4ca470[_0x68d8('0x2e')],'type':_0x4ca470[_0x68d8('0x2f')]['key']};});_0x395cf0[_0x68d8('0x30')]=_[_0x68d8('0x2c')](_0x9fb259,_0x68d8('0x29'));_0x395cf0[_0x68d8('0x31')]=_[_0x68d8('0x32')](_0x290693['query']);_0x395cf0['filters']=_[_0x68d8('0x33')](_0x395cf0['model'],_0x395cf0[_0x68d8('0x31')]);_0x283861[_0x68d8('0x34')]=_[_0x68d8('0x33')](_0x395cf0[_0x68d8('0x30')],qs['fields'](_0x290693[_0x68d8('0x31')][_0x68d8('0x35')]));_0x283861[_0x68d8('0x34')]=_0x283861[_0x68d8('0x34')][_0x68d8('0x36')]?_0x283861['attributes']:_0x395cf0[_0x68d8('0x30')];if(!_0x290693[_0x68d8('0x31')][_0x68d8('0x37')](_0x68d8('0x38'))){_0x283861[_0x68d8('0x1d')]=qs['limit'](_0x290693['query'][_0x68d8('0x1d')]);_0x283861[_0x68d8('0x1f')]=qs[_0x68d8('0x1f')](_0x290693[_0x68d8('0x31')]['offset']);}_0x283861['order']=qs['sort'](_0x290693[_0x68d8('0x31')]['sort']);_0x283861['where']=qs[_0x68d8('0x39')](_['pick'](_0x290693[_0x68d8('0x31')],_0x395cf0[_0x68d8('0x39')]),_0x9fb259);if(_0x290693[_0x68d8('0x31')][_0x68d8('0x3a')]){_0x283861[_0x68d8('0x3b')]=_[_0x68d8('0x3c')](_0x283861[_0x68d8('0x3b')],{'$or':_[_0x68d8('0x2c')](_0x9fb259,function(_0x5e1b66){if(_0x5e1b66['type']!==_0x68d8('0x3d')){var _0x56747c={};_0x56747c[_0x5e1b66[_0x68d8('0x29')]]={'$like':'%'+_0x290693[_0x68d8('0x31')][_0x68d8('0x3a')]+'%'};return _0x56747c;}})});}_0x283861=_['merge']({},_0x283861,_0x290693['options']);var _0x34e7ac={'where':_0x283861['where']};return db[_0x68d8('0x2d')][_0x68d8('0x1e')](_0x34e7ac)['then'](function(_0x2193f2){_0x54281c[_0x68d8('0x1e')]=_0x2193f2;if(_0x290693[_0x68d8('0x31')][_0x68d8('0x3e')]){_0x283861['include']=[{'all':!![]}];}return db[_0x68d8('0x2d')]['findAll'](_0x283861);})[_0x68d8('0x25')](function(_0x23b95a){_0x54281c[_0x68d8('0x3f')]=_0x23b95a;return _0x54281c;})[_0x68d8('0x25')](respondWithFilteredResult(_0x3892f6,_0x283861))[_0x68d8('0x40')](handleError(_0x3892f6,null));};exports[_0x68d8('0x41')]=function(_0x159a85,_0x5d7b7d){var _0xc87e61={'raw':!![],'where':{'id':_0x159a85['params']['id']}},_0x47f262={};_0x47f262[_0x68d8('0x30')]=_[_0x68d8('0x32')](db[_0x68d8('0x2d')]['rawAttributes']);_0x47f262[_0x68d8('0x31')]=_[_0x68d8('0x32')](_0x159a85['query']);_0x47f262['filters']=_[_0x68d8('0x33')](_0x47f262[_0x68d8('0x30')],_0x47f262['query']);_0xc87e61['attributes']=_[_0x68d8('0x33')](_0x47f262[_0x68d8('0x30')],qs['fields'](_0x159a85[_0x68d8('0x31')][_0x68d8('0x35')]));_0xc87e61['attributes']=_0xc87e61['attributes'][_0x68d8('0x36')]?_0xc87e61[_0x68d8('0x34')]:_0x47f262['model'];if(_0x159a85['query'][_0x68d8('0x3e')]){_0xc87e61['include']=[{'all':!![]}];}_0xc87e61=_[_0x68d8('0x3c')]({},_0xc87e61,_0x159a85[_0x68d8('0x42')]);return db[_0x68d8('0x2d')][_0x68d8('0x43')](_0xc87e61)['then'](handleEntityNotFound(_0x5d7b7d,null))['then'](respondWithResult(_0x5d7b7d,null))[_0x68d8('0x40')](handleError(_0x5d7b7d,null));};exports[_0x68d8('0x44')]=function(_0x59ba8d,_0x54a252){return db[_0x68d8('0x2d')]['create'](_0x59ba8d[_0x68d8('0x45')],{})['then'](respondWithResult(_0x54a252,0xc9))[_0x68d8('0x40')](handleError(_0x54a252,null));};exports['update']=function(_0xc3181b,_0x432929){if(_0xc3181b['body']['id']){delete _0xc3181b[_0x68d8('0x45')]['id'];}return db[_0x68d8('0x2d')][_0x68d8('0x43')]({'where':{'id':_0xc3181b[_0x68d8('0x46')]['id']}})[_0x68d8('0x25')](handleEntityNotFound(_0x432929,null))['then'](saveUpdates(_0xc3181b['body'],null))[_0x68d8('0x25')](respondWithResult(_0x432929,null))[_0x68d8('0x40')](handleError(_0x432929,null));};exports[_0x68d8('0x47')]=function(_0x4d86f0,_0x426e64,_0x2a031b){var _0x2793c2=require('../../components/encryptor');var _0x3e6a29=![];var _0x40a278={};if(_0x4d86f0['query'][_0x68d8('0x2f')]&&_0x4d86f0['query']['type']===_0x68d8('0x48')){_0x40a278['uniqueid']=_0x4d86f0[_0x68d8('0x46')]['id'];}else{_0x40a278['id']=_0x4d86f0[_0x68d8('0x46')]['id'];}return db[_0x68d8('0x2d')][_0x68d8('0x43')]({'where':_0x40a278,'attributes':['id','savePath',_0x68d8('0x49')],'raw':!![]})[_0x68d8('0x25')](handleEntityNotFound(_0x426e64,null))[_0x68d8('0x25')](function(_0x40fd7d){if(_0x40fd7d){var _0x4fb21b=_0x40fd7d[_0x68d8('0x4a')];var _0x1867c7=util[_0x68d8('0x4b')](_0x68d8('0x4c'),_0x4fb21b);if(fs[_0x68d8('0x4d')](_0x1867c7)){_0x3e6a29=!![];return _0x2793c2[_0x68d8('0x4e')](_0x1867c7,_0x4fb21b,config[_0x68d8('0x4f')][_0x68d8('0x50')])[_0x68d8('0x25')](function(){return _0x40fd7d;});}return _0x40fd7d;}})[_0x68d8('0x25')](function(_0x5e077f){if(_0x5e077f){var _0xb2cd45=_0x5e077f[_0x68d8('0x4a')];if(!fs[_0x68d8('0x4d')](_0xb2cd45)){throw new db[(_0x68d8('0x51'))]['ValidationError'](_0x68d8('0x52'));}if(_0x5e077f[_0x68d8('0x49')]){return _0x426e64[_0x68d8('0x47')](_0xb2cd45,_0x5e077f[_0x68d8('0x49')]+path[_0x68d8('0x53')](_0xb2cd45),function(){if(_0x3e6a29){fs['unlink'](_0xb2cd45);}});}else{return _0x426e64[_0x68d8('0x47')](_0xb2cd45,function(_0x36e46b){if(_0x3e6a29){fs[_0x68d8('0x54')](_0xb2cd45);}});}}})[_0x68d8('0x40')](function(_0x43ab92){if(_0x43ab92[_0x68d8('0x55')]===_0x68d8('0x52')){_0x426e64[_0x68d8('0x19')](0x194)[_0x68d8('0x2a')](_0x68d8('0x56'));}else{return handleError(_0x426e64,null);}});};exports['destroy']=function(_0x36e1ef,_0x143043){return db[_0x68d8('0x2d')][_0x68d8('0x43')]({'where':{'id':_0x36e1ef[_0x68d8('0x46')]['id']}})[_0x68d8('0x25')](function(_0x54c669){if(_['isNil'](_0x54c669)){throw new ReferenceError(_0x68d8('0x57'));}return _0x54c669;})[_0x68d8('0x25')](function(_0x43c3bf){var _0x367178=_0x43c3bf[_0x68d8('0x4a')];logger['info'](_0x68d8('0x58'),_0x367178);if(!_['isNil'](_0x43c3bf[_0x68d8('0x4a')])&&fs[_0x68d8('0x4d')](_0x367178)){logger['info']('File:\x20\x22'+_0x367178+_0x68d8('0x59'));fs[_0x68d8('0x5a')](_0x367178);}_0x367178=_0x367178+'.cypher';if(!_[_0x68d8('0x5b')](_0x43c3bf[_0x68d8('0x4a')])&&fs[_0x68d8('0x4d')](_0x367178)){logger['info'](_0x68d8('0x5c')+_0x367178+_0x68d8('0x59'));fs[_0x68d8('0x5a')](_0x367178);}return _0x43c3bf;})['then'](function(_0x2fdd91){if(!_0x2fdd91)throw new InternalError();return _0x2fdd91[_0x68d8('0x26')]();})[_0x68d8('0x25')](function(){_0x143043[_0x68d8('0x19')](0xcc)[_0x68d8('0x1a')]();})[_0x68d8('0x40')](handleError(_0x143043,null));}; \ No newline at end of file +var _0x5705=['params','find','create','body','download','../../components/encryptor','uniqueid','format','%s.cypher','existsSync','recording','ValidationError','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','savePath','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','SquareRecording','includeAll','include','findAll','catch','show'];(function(_0x22bc31,_0x301efc){var _0x42b9ce=function(_0x160f59){while(--_0x160f59){_0x22bc31['push'](_0x22bc31['shift']());}};_0x42b9ce(++_0x301efc);}(_0x5705,0x136));var _0x5570=function(_0x1728d1,_0x1994e3){_0x1728d1=_0x1728d1-0x0;var _0x3ca811=_0x5705[_0x1728d1];return _0x3ca811;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5570('0x0'));var moment=require('moment');var BPromise=require(_0x5570('0x1'));var Mustache=require(_0x5570('0x2'));var util=require(_0x5570('0x3'));var path=require(_0x5570('0x4'));var sox=require(_0x5570('0x5'));var csv=require(_0x5570('0x6'));var ejs=require(_0x5570('0x7'));var fs=require('fs');var fs_extra=require(_0x5570('0x8'));var _=require(_0x5570('0x9'));var squel=require('squel');var crypto=require(_0x5570('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5570('0x6'));var querystring=require(_0x5570('0xb'));var Papa=require(_0x5570('0xc'));var Redis=require(_0x5570('0xd'));var authService=require(_0x5570('0xe'));var qs=require(_0x5570('0xf'));var as=require(_0x5570('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5570('0x11'));var utils=require(_0x5570('0x12'));var config=require(_0x5570('0x13'));var licenseUtil=require(_0x5570('0x14'));var db=require(_0x5570('0x15'))['db'];function respondWithStatusCode(_0x3d98d6,_0x4f939a){_0x4f939a=_0x4f939a||0xcc;return function(_0x20ce56){if(_0x20ce56){return _0x3d98d6[_0x5570('0x16')](_0x4f939a);}return _0x3d98d6[_0x5570('0x17')](_0x4f939a)[_0x5570('0x18')]();};}function respondWithResult(_0x2ef72c,_0x162390){_0x162390=_0x162390||0xc8;return function(_0x2b75f0){if(_0x2b75f0){return _0x2ef72c[_0x5570('0x17')](_0x162390)[_0x5570('0x19')](_0x2b75f0);}};}function respondWithFilteredResult(_0x529926,_0x334d66){return function(_0x4cfb26){if(_0x4cfb26){var _0x31e164=typeof _0x334d66[_0x5570('0x1a')]===_0x5570('0x1b')&&typeof _0x334d66['limit']===_0x5570('0x1b');var _0x4964f8=_0x4cfb26[_0x5570('0x1c')];var _0x5223c4=_0x31e164?0x0:_0x334d66[_0x5570('0x1a')];var _0x2ada93=_0x31e164?_0x4cfb26[_0x5570('0x1c')]:_0x334d66[_0x5570('0x1a')]+_0x334d66[_0x5570('0x1d')];var _0x456c91;if(_0x2ada93>=_0x4964f8){_0x2ada93=_0x4964f8;_0x456c91=0xc8;}else{_0x456c91=0xce;}_0x529926[_0x5570('0x17')](_0x456c91);return _0x529926[_0x5570('0x1e')](_0x5570('0x1f'),_0x5223c4+'-'+_0x2ada93+'/'+_0x4964f8)[_0x5570('0x19')](_0x4cfb26);}return null;};}function patchUpdates(_0x4e5449){return function(_0x137443){try{jsonpatch[_0x5570('0x20')](_0x137443,_0x4e5449,!![]);}catch(_0x411eb8){return BPromise['reject'](_0x411eb8);}return _0x137443[_0x5570('0x21')]();};}function saveUpdates(_0x1201c7,_0xf166b8){return function(_0x35e577){if(_0x35e577){return _0x35e577[_0x5570('0x22')](_0x1201c7)[_0x5570('0x23')](function(_0x46a77d){return _0x46a77d;});}return null;};}function removeEntity(_0x214bff,_0x4ee64d){return function(_0x2cf548){if(_0x2cf548){return _0x2cf548[_0x5570('0x24')]()[_0x5570('0x23')](function(){_0x214bff[_0x5570('0x17')](0xcc)[_0x5570('0x18')]();});}};}function handleEntityNotFound(_0x5f5c3a,_0x3fc230){return function(_0x243d24){if(!_0x243d24){_0x5f5c3a['sendStatus'](0x194);}return _0x243d24;};}function handleError(_0x507a16,_0x62ef97){_0x62ef97=_0x62ef97||0x1f4;return function(_0x5e1fe6){logger[_0x5570('0x25')](_0x5e1fe6[_0x5570('0x26')]);if(_0x5e1fe6[_0x5570('0x27')]){delete _0x5e1fe6[_0x5570('0x27')];}_0x507a16[_0x5570('0x17')](_0x62ef97)[_0x5570('0x28')](_0x5e1fe6);};}exports[_0x5570('0x29')]=function(_0x40cfb3,_0x3fc12c){var _0x981659={},_0x330d16={},_0x2426d7={'count':0x0,'rows':[]};var _0x134731=_[_0x5570('0x2a')](db['SquareRecording'][_0x5570('0x2b')],function(_0x4ac482){return{'name':_0x4ac482[_0x5570('0x2c')],'type':_0x4ac482[_0x5570('0x2d')][_0x5570('0x2e')]};});_0x330d16[_0x5570('0x2f')]=_[_0x5570('0x2a')](_0x134731,'name');_0x330d16[_0x5570('0x30')]=_[_0x5570('0x31')](_0x40cfb3[_0x5570('0x30')]);_0x330d16[_0x5570('0x32')]=_[_0x5570('0x33')](_0x330d16[_0x5570('0x2f')],_0x330d16[_0x5570('0x30')]);_0x981659[_0x5570('0x34')]=_[_0x5570('0x33')](_0x330d16[_0x5570('0x2f')],qs['fields'](_0x40cfb3[_0x5570('0x30')][_0x5570('0x35')]));_0x981659[_0x5570('0x34')]=_0x981659['attributes'][_0x5570('0x36')]?_0x981659['attributes']:_0x330d16[_0x5570('0x2f')];if(!_0x40cfb3['query'][_0x5570('0x37')](_0x5570('0x38'))){_0x981659['limit']=qs[_0x5570('0x1d')](_0x40cfb3['query'][_0x5570('0x1d')]);_0x981659[_0x5570('0x1a')]=qs[_0x5570('0x1a')](_0x40cfb3[_0x5570('0x30')][_0x5570('0x1a')]);}_0x981659['order']=qs[_0x5570('0x39')](_0x40cfb3[_0x5570('0x30')][_0x5570('0x39')]);_0x981659[_0x5570('0x3a')]=qs[_0x5570('0x32')](_[_0x5570('0x3b')](_0x40cfb3[_0x5570('0x30')],_0x330d16[_0x5570('0x32')]),_0x134731);if(_0x40cfb3[_0x5570('0x30')][_0x5570('0x3c')]){_0x981659[_0x5570('0x3a')]=_['merge'](_0x981659[_0x5570('0x3a')],{'$or':_[_0x5570('0x2a')](_0x134731,function(_0x459b54){if(_0x459b54[_0x5570('0x2d')]!==_0x5570('0x3d')){var _0x1cd387={};_0x1cd387[_0x459b54[_0x5570('0x27')]]={'$like':'%'+_0x40cfb3[_0x5570('0x30')]['filter']+'%'};return _0x1cd387;}})});}_0x981659=_[_0x5570('0x3e')]({},_0x981659,_0x40cfb3[_0x5570('0x3f')]);var _0x145d0e={'where':_0x981659[_0x5570('0x3a')]};return db[_0x5570('0x40')]['count'](_0x145d0e)[_0x5570('0x23')](function(_0x365d51){_0x2426d7[_0x5570('0x1c')]=_0x365d51;if(_0x40cfb3['query'][_0x5570('0x41')]){_0x981659[_0x5570('0x42')]=[{'all':!![]}];}return db[_0x5570('0x40')][_0x5570('0x43')](_0x981659);})['then'](function(_0x5c7abc){_0x2426d7['rows']=_0x5c7abc;return _0x2426d7;})[_0x5570('0x23')](respondWithFilteredResult(_0x3fc12c,_0x981659))[_0x5570('0x44')](handleError(_0x3fc12c,null));};exports[_0x5570('0x45')]=function(_0x765721,_0x4d66e9){var _0xd4ba13={'raw':!![],'where':{'id':_0x765721[_0x5570('0x46')]['id']}},_0x4299a0={};_0x4299a0[_0x5570('0x2f')]=_[_0x5570('0x31')](db['SquareRecording'][_0x5570('0x2b')]);_0x4299a0[_0x5570('0x30')]=_['keys'](_0x765721[_0x5570('0x30')]);_0x4299a0[_0x5570('0x32')]=_[_0x5570('0x33')](_0x4299a0[_0x5570('0x2f')],_0x4299a0['query']);_0xd4ba13['attributes']=_[_0x5570('0x33')](_0x4299a0[_0x5570('0x2f')],qs[_0x5570('0x35')](_0x765721[_0x5570('0x30')][_0x5570('0x35')]));_0xd4ba13[_0x5570('0x34')]=_0xd4ba13[_0x5570('0x34')][_0x5570('0x36')]?_0xd4ba13[_0x5570('0x34')]:_0x4299a0['model'];if(_0x765721[_0x5570('0x30')][_0x5570('0x41')]){_0xd4ba13[_0x5570('0x42')]=[{'all':!![]}];}_0xd4ba13=_[_0x5570('0x3e')]({},_0xd4ba13,_0x765721['options']);return db[_0x5570('0x40')][_0x5570('0x47')](_0xd4ba13)[_0x5570('0x23')](handleEntityNotFound(_0x4d66e9,null))['then'](respondWithResult(_0x4d66e9,null))['catch'](handleError(_0x4d66e9,null));};exports[_0x5570('0x48')]=function(_0x4c0b59,_0x28f59c){return db[_0x5570('0x40')][_0x5570('0x48')](_0x4c0b59[_0x5570('0x49')],{})['then'](respondWithResult(_0x28f59c,0xc9))['catch'](handleError(_0x28f59c,null));};exports[_0x5570('0x22')]=function(_0x21cf3d,_0x47bd3b){if(_0x21cf3d[_0x5570('0x49')]['id']){delete _0x21cf3d['body']['id'];}return db[_0x5570('0x40')][_0x5570('0x47')]({'where':{'id':_0x21cf3d[_0x5570('0x46')]['id']}})['then'](handleEntityNotFound(_0x47bd3b,null))['then'](saveUpdates(_0x21cf3d[_0x5570('0x49')],null))[_0x5570('0x23')](respondWithResult(_0x47bd3b,null))['catch'](handleError(_0x47bd3b,null));};exports[_0x5570('0x4a')]=function(_0x3dce82,_0xfee522,_0x2d2f2f){var _0x59c656=require(_0x5570('0x4b'));var _0x1a9148=![];var _0x16cc59={};if(_0x3dce82[_0x5570('0x30')][_0x5570('0x2d')]&&_0x3dce82['query']['type']===_0x5570('0x4c')){_0x16cc59[_0x5570('0x4c')]=_0x3dce82[_0x5570('0x46')]['id'];}else{_0x16cc59['id']=_0x3dce82[_0x5570('0x46')]['id'];}return db[_0x5570('0x40')]['find']({'where':_0x16cc59,'attributes':['id','savePath','filename'],'raw':!![]})['then'](handleEntityNotFound(_0xfee522,null))[_0x5570('0x23')](function(_0x2a2fc2){if(_0x2a2fc2){var _0x2a0187=_0x2a2fc2['savePath'];var _0x2dc99b=util[_0x5570('0x4d')](_0x5570('0x4e'),_0x2a0187);if(fs[_0x5570('0x4f')](_0x2dc99b)){_0x1a9148=!![];return _0x59c656['decryptFile'](_0x2dc99b,_0x2a0187,config['secrets'][_0x5570('0x50')])[_0x5570('0x23')](function(){return _0x2a2fc2;});}return _0x2a2fc2;}})['then'](function(_0x39f3eb){if(_0x39f3eb){var _0x4b3e97=_0x39f3eb['savePath'];if(!fs[_0x5570('0x4f')](_0x4b3e97)){throw new db['Sequelize'][(_0x5570('0x51'))]('SquareRecording\x20not\x20found');}if(_0x39f3eb[_0x5570('0x52')]){return _0xfee522[_0x5570('0x4a')](_0x4b3e97,_0x39f3eb['filename']+path[_0x5570('0x53')](_0x4b3e97),function(){if(_0x1a9148){fs['unlink'](_0x4b3e97);}});}else{return _0xfee522['download'](_0x4b3e97,function(_0x59c084){if(_0x1a9148){fs[_0x5570('0x54')](_0x4b3e97);}});}}})[_0x5570('0x44')](function(_0x5d9c6f){if(_0x5d9c6f[_0x5570('0x55')]==='SquareRecording\x20not\x20found'){_0xfee522[_0x5570('0x17')](0x194)[_0x5570('0x28')](_0x5570('0x56'));}else{return handleError(_0xfee522,null);}});};exports[_0x5570('0x24')]=function(_0x49ba6b,_0x1349cd){return db[_0x5570('0x40')][_0x5570('0x47')]({'where':{'id':_0x49ba6b[_0x5570('0x46')]['id']}})[_0x5570('0x23')](function(_0x610437){if(_['isNil'](_0x610437)){throw new ReferenceError('Entity\x20not\x20found');}return _0x610437;})[_0x5570('0x23')](function(_0x9d37ae){var _0x1a3e03=_0x9d37ae['savePath'];logger[_0x5570('0x57')](_0x5570('0x58'),_0x1a3e03);if(!_[_0x5570('0x59')](_0x9d37ae[_0x5570('0x5a')])&&fs['existsSync'](_0x1a3e03)){logger[_0x5570('0x57')](_0x5570('0x5b')+_0x1a3e03+_0x5570('0x5c'));fs[_0x5570('0x5d')](_0x1a3e03);}_0x1a3e03=_0x1a3e03+_0x5570('0x5e');if(!_[_0x5570('0x59')](_0x9d37ae[_0x5570('0x5a')])&&fs['existsSync'](_0x1a3e03)){logger[_0x5570('0x57')](_0x5570('0x5b')+_0x1a3e03+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5570('0x5d')](_0x1a3e03);}return _0x9d37ae;})[_0x5570('0x23')](function(_0x13d33e){if(!_0x13d33e)throw new InternalError();return _0x13d33e['destroy']();})[_0x5570('0x23')](function(){_0x1349cd[_0x5570('0x17')](0xcc)[_0x5570('0x18')]();})[_0x5570('0x44')](handleError(_0x1349cd,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index eade622..38281de 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 _0x714c=['define','util','../../config/logger','api','moment','bluebird','path','rimraf','exports'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x714c,0x18d));var _0xc714=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0x714c[_0xb875ee];return _0x4c7f3a;};'use strict';var _=require('lodash');var util=require(_0xc714('0x0'));var logger=require(_0xc714('0x1'))(_0xc714('0x2'));var moment=require(_0xc714('0x3'));var BPromise=require(_0xc714('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc714('0x5'));var rimraf=require(_0xc714('0x6'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0xc714('0x7')]=function(_0xf624fc,_0x1c4a3b){return _0xf624fc[_0xc714('0x8')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2a2=['./squareRecording.attributes','exports','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x49579b,_0x528f4e){var _0x1a2d45=function(_0x38e9ab){while(--_0x38e9ab){_0x49579b['push'](_0x49579b['shift']());}};_0x1a2d45(++_0x528f4e);}(_0xc2a2,0x84));var _0x2c2a=function(_0x229ba9,_0x312117){_0x229ba9=_0x229ba9-0x0;var _0x133813=_0xc2a2[_0x229ba9];return _0x133813;};'use strict';var _=require(_0x2c2a('0x0'));var util=require(_0x2c2a('0x1'));var logger=require(_0x2c2a('0x2'))(_0x2c2a('0x3'));var moment=require('moment');var BPromise=require(_0x2c2a('0x4'));var rp=require(_0x2c2a('0x5'));var fs=require('fs');var path=require(_0x2c2a('0x6'));var rimraf=require('rimraf');var config=require(_0x2c2a('0x7'));var attributes=require(_0x2c2a('0x8'));module[_0x2c2a('0x9')]=function(_0x17db27,_0x51c919){return _0x17db27['define']('SquareRecording',attributes,{'tableName':'square_recordings','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 9e08e15..beaeab0 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 _0x1daa=['CreateSquareRecording','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','SquareRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SquareRecording','body','options','raw'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0x1daa,0x139));var _0xa1da=function(_0x7bff4f,_0x45ce80){_0x7bff4f=_0x7bff4f-0x0;var _0x3c6a26=_0x1daa[_0x7bff4f];return _0x3c6a26;};'use strict';var _=require(_0xa1da('0x0'));var util=require('util');var moment=require(_0xa1da('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1da('0x2'));var fs=require('fs');var Redis=require(_0xa1da('0x3'));var db=require(_0xa1da('0x4'))['db'];var utils=require(_0xa1da('0x5'));var logger=require('../../config/logger')(_0xa1da('0x6'));var config=require(_0xa1da('0x7'));var jayson=require(_0xa1da('0x8'));var client=jayson[_0xa1da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d0c37,_0x23cfb1,_0xd504da){return new BPromise(function(_0x2ea2d9,_0x160b51){return client['request'](_0x4d0c37,_0xd504da)[_0xa1da('0xa')](function(_0x20d995){logger[_0xa1da('0xb')](_0xa1da('0xc'),_0x23cfb1,'request\x20sent');logger[_0xa1da('0xd')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x23cfb1,_0xa1da('0xe'),JSON[_0xa1da('0xf')](_0x20d995));if(_0x20d995[_0xa1da('0x10')]){if(_0x20d995[_0xa1da('0x10')][_0xa1da('0x11')]===0x1f4){logger[_0xa1da('0x10')](_0xa1da('0xc'),_0x23cfb1,_0x20d995[_0xa1da('0x10')][_0xa1da('0x12')]);return _0x160b51(_0x20d995['error'][_0xa1da('0x12')]);}logger[_0xa1da('0x10')]('SquareRecording,\x20%s,\x20%s',_0x23cfb1,_0x20d995['error'][_0xa1da('0x12')]);return _0x2ea2d9(_0x20d995[_0xa1da('0x10')][_0xa1da('0x12')]);}else{logger[_0xa1da('0xb')](_0xa1da('0xc'),_0x23cfb1,'request\x20sent');_0x2ea2d9(_0x20d995[_0xa1da('0x13')][_0xa1da('0x12')]);}})[_0xa1da('0x14')](function(_0x2ed2c0){logger['error'](_0xa1da('0xc'),_0x23cfb1,_0x2ed2c0);_0x160b51(_0x2ed2c0);});});}exports['CreateSquareRecording']=function(_0x22ba38){var _0x491173=this;return new Promise(function(_0x13c066,_0x350403){return db[_0xa1da('0x15')]['create'](_0x22ba38[_0xa1da('0x16')],{'raw':_0x22ba38['options']?_0x22ba38[_0xa1da('0x17')][_0xa1da('0x18')]===undefined?!![]:![]:!![]})[_0xa1da('0xa')](function(_0x47ef24){logger[_0xa1da('0xb')](_0xa1da('0x19'),_0x22ba38);logger['debug'](_0xa1da('0x19'),_0x22ba38,JSON[_0xa1da('0xf')](_0x47ef24));_0x13c066(_0x47ef24);})[_0xa1da('0x14')](function(_0x352917){logger[_0xa1da('0x10')](_0xa1da('0x19'),_0x352917[_0xa1da('0x12')],_0x22ba38);_0x350403(_0x491173[_0xa1da('0x10')](0x1f4,_0x352917['message']));});});}; \ No newline at end of file +var _0x8646=['error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8646,0x136));var _0x6864=function(_0x52a512,_0x327ac9){_0x52a512=_0x52a512-0x0;var _0x41f34d=_0x8646[_0x52a512];return _0x41f34d;};'use strict';var _=require(_0x6864('0x0'));var util=require(_0x6864('0x1'));var moment=require(_0x6864('0x2'));var BPromise=require(_0x6864('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6864('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6864('0x5'));var logger=require(_0x6864('0x6'))(_0x6864('0x7'));var config=require(_0x6864('0x8'));var jayson=require(_0x6864('0x9'));var client=jayson[_0x6864('0xa')][_0x6864('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ff04c,_0x50ef31,_0x42c615){return new BPromise(function(_0x14ba39,_0x418a0b){return client[_0x6864('0xc')](_0x3ff04c,_0x42c615)[_0x6864('0xd')](function(_0xb35310){logger[_0x6864('0xe')](_0x6864('0xf'),_0x50ef31,_0x6864('0x10'));logger[_0x6864('0x11')](_0x6864('0x12'),_0x50ef31,_0x6864('0x10'),JSON[_0x6864('0x13')](_0xb35310));if(_0xb35310[_0x6864('0x14')]){if(_0xb35310[_0x6864('0x14')][_0x6864('0x15')]===0x1f4){logger[_0x6864('0x14')](_0x6864('0xf'),_0x50ef31,_0xb35310['error'][_0x6864('0x16')]);return _0x418a0b(_0xb35310[_0x6864('0x14')][_0x6864('0x16')]);}logger[_0x6864('0x14')]('SquareRecording,\x20%s,\x20%s',_0x50ef31,_0xb35310['error'][_0x6864('0x16')]);return _0x14ba39(_0xb35310[_0x6864('0x14')]['message']);}else{logger[_0x6864('0xe')](_0x6864('0xf'),_0x50ef31,_0x6864('0x10'));_0x14ba39(_0xb35310[_0x6864('0x17')]['message']);}})[_0x6864('0x18')](function(_0x63c710){logger['error'](_0x6864('0xf'),_0x50ef31,_0x63c710);_0x418a0b(_0x63c710);});});}exports[_0x6864('0x19')]=function(_0x42d25a){var _0xfd1132=this;return new Promise(function(_0x42fe36,_0x580395){return db[_0x6864('0x1a')][_0x6864('0x1b')](_0x42d25a['body'],{'raw':_0x42d25a[_0x6864('0x1c')]?_0x42d25a['options'][_0x6864('0x1d')]===undefined?!![]:![]:!![]})[_0x6864('0xd')](function(_0x1b2055){logger['info']('CreateSquareRecording',_0x42d25a);logger[_0x6864('0x11')](_0x6864('0x19'),_0x42d25a,JSON[_0x6864('0x13')](_0x1b2055));_0x42fe36(_0x1b2055);})[_0x6864('0x18')](function(_0xd49404){logger[_0x6864('0x14')](_0x6864('0x19'),_0xd49404[_0x6864('0x16')],_0x42d25a);_0x580395(_0xfd1132[_0x6864('0x14')](0x1f4,_0xd49404[_0x6864('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 0d753ec..b5a9345 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x497f80,_0x4fe573){var _0x4235d3=function(_0x26e89e){while(--_0x26e89e){_0x497f80['push'](_0x497f80['shift']());}};_0x4235d3(++_0x4fe573);}(_0xe706,0xa3));var _0x6e70=function(_0x24d1c1,_0x365bf3){_0x24d1c1=_0x24d1c1-0x0;var _0x908781=_0xe706[_0x24d1c1];return _0x908781;};'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'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index edf333a..2679a68 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 _0xb9f0=['DATE','exports','STRING'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xb9f0,0x181));var _0x0b9f=function(_0x5be46a,_0x2fb035){_0x5be46a=_0x5be46a-0x0;var _0x1ce3b8=_0xb9f0[_0x5be46a];return _0x1ce3b8;};'use strict';var Sequelize=require('sequelize');module[_0x0b9f('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0b9f('0x1')]},'language':{'type':Sequelize[_0x0b9f('0x1')]},'type':{'type':Sequelize[_0x0b9f('0x1')]},'uniqueid':{'type':Sequelize[_0x0b9f('0x1')]},'version':{'type':Sequelize[_0x0b9f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0b9f('0x1')]},'callingpres':{'type':Sequelize[_0x0b9f('0x1')]},'callingani2':{'type':Sequelize[_0x0b9f('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x0b9f('0x1')]},'dnid':{'type':Sequelize[_0x0b9f('0x1')]},'rdnis':{'type':Sequelize[_0x0b9f('0x1')]},'context':{'type':Sequelize[_0x0b9f('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x0b9f('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0b9f('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x83c0=['exports','STRING','BOOLEAN'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x83c0,0xa5));var _0x083c=function(_0x1d0e76,_0x337717){_0x1d0e76=_0x1d0e76-0x0;var _0x57d206=_0x83c0[_0x1d0e76];return _0x57d206;};'use strict';var Sequelize=require('sequelize');module[_0x083c('0x0')]={'network':{'type':Sequelize[_0x083c('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x083c('0x1')]},'channel':{'type':Sequelize[_0x083c('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x083c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x083c('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x083c('0x1')]},'callingpres':{'type':Sequelize[_0x083c('0x1')]},'callingani2':{'type':Sequelize[_0x083c('0x1')]},'callington':{'type':Sequelize[_0x083c('0x1')]},'callingtns':{'type':Sequelize[_0x083c('0x1')]},'dnid':{'type':Sequelize[_0x083c('0x1')]},'rdnis':{'type':Sequelize[_0x083c('0x1')]},'context':{'type':Sequelize[_0x083c('0x1')]},'extension':{'type':Sequelize[_0x083c('0x1')]},'priority':{'type':Sequelize[_0x083c('0x1')]},'enhanced':{'type':Sequelize[_0x083c('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x083c('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x083c('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 72504d4..2dbb5dc 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 _0x6a12=['filter','options','where','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','then','end','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','merge','type','VIRTUAL'];(function(_0x3032e2,_0x26a4e8){var _0x427aef=function(_0x4b9281){while(--_0x4b9281){_0x3032e2['push'](_0x3032e2['shift']());}};_0x427aef(++_0x26a4e8);}(_0x6a12,0xa6));var _0x26a1=function(_0x5de91e,_0x31cefd){_0x5de91e=_0x5de91e-0x0;var _0x3e409a=_0x6a12[_0x5de91e];return _0x3e409a;};'use strict';var emlformat=require(_0x26a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x26a1('0x1'));var jsonpatch=require(_0x26a1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x26a1('0x3'));var Mustache=require(_0x26a1('0x4'));var util=require('util');var path=require(_0x26a1('0x5'));var sox=require(_0x26a1('0x6'));var csv=require(_0x26a1('0x7'));var ejs=require(_0x26a1('0x8'));var fs=require('fs');var fs_extra=require(_0x26a1('0x9'));var _=require(_0x26a1('0xa'));var squel=require(_0x26a1('0xb'));var crypto=require(_0x26a1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x26a1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x26a1('0xe'));var Papa=require(_0x26a1('0xf'));var Redis=require(_0x26a1('0x10'));var authService=require(_0x26a1('0x11'));var qs=require(_0x26a1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26a1('0x13'));var logger=require('../../config/logger')(_0x26a1('0x14'));var utils=require(_0x26a1('0x15'));var config=require(_0x26a1('0x16'));var licenseUtil=require(_0x26a1('0x17'));var db=require(_0x26a1('0x18'))['db'];function respondWithStatusCode(_0x29024d,_0x86c6e2){_0x86c6e2=_0x86c6e2||0xcc;return function(_0xdcadfa){if(_0xdcadfa){return _0x29024d[_0x26a1('0x19')](_0x86c6e2);}return _0x29024d['status'](_0x86c6e2)['end']();};}function respondWithResult(_0x11ac59,_0x4057c6){_0x4057c6=_0x4057c6||0xc8;return function(_0x323efa){if(_0x323efa){return _0x11ac59[_0x26a1('0x1a')](_0x4057c6)['json'](_0x323efa);}};}function respondWithFilteredResult(_0x168843,_0x5703be){return function(_0x42ab53){if(_0x42ab53){var _0x317772=typeof _0x5703be[_0x26a1('0x1b')]==='undefined'&&typeof _0x5703be[_0x26a1('0x1c')]===_0x26a1('0x1d');var _0x33262b=_0x42ab53[_0x26a1('0x1e')];var _0x451660=_0x317772?0x0:_0x5703be[_0x26a1('0x1b')];var _0x32a1e6=_0x317772?_0x42ab53[_0x26a1('0x1e')]:_0x5703be[_0x26a1('0x1b')]+_0x5703be[_0x26a1('0x1c')];var _0x48d289;if(_0x32a1e6>=_0x33262b){_0x32a1e6=_0x33262b;_0x48d289=0xc8;}else{_0x48d289=0xce;}_0x168843[_0x26a1('0x1a')](_0x48d289);return _0x168843[_0x26a1('0x1f')](_0x26a1('0x20'),_0x451660+'-'+_0x32a1e6+'/'+_0x33262b)['json'](_0x42ab53);}return null;};}function patchUpdates(_0x31e176){return function(_0x276095){try{jsonpatch[_0x26a1('0x21')](_0x276095,_0x31e176,!![]);}catch(_0x45c13e){return BPromise[_0x26a1('0x22')](_0x45c13e);}return _0x276095['save']();};}function saveUpdates(_0xe1a05b,_0x25417a){return function(_0x284cd3){if(_0x284cd3){return _0x284cd3['update'](_0xe1a05b)[_0x26a1('0x23')](function(_0x4baac7){return _0x4baac7;});}return null;};}function removeEntity(_0x3dcb4f,_0x1f8e6f){return function(_0x32f8aa){if(_0x32f8aa){return _0x32f8aa['destroy']()['then'](function(){_0x3dcb4f[_0x26a1('0x1a')](0xcc)[_0x26a1('0x24')]();});}};}function handleEntityNotFound(_0xb1f2e7,_0x2d78d2){return function(_0x5b05d0){if(!_0x5b05d0){_0xb1f2e7['sendStatus'](0x194);}return _0x5b05d0;};}function handleError(_0x49b3df,_0x2f9be9){_0x2f9be9=_0x2f9be9||0x1f4;return function(_0x4227af){logger['error'](_0x4227af[_0x26a1('0x25')]);if(_0x4227af['name']){delete _0x4227af[_0x26a1('0x26')];}_0x49b3df[_0x26a1('0x1a')](_0x2f9be9)[_0x26a1('0x27')](_0x4227af);};}exports[_0x26a1('0x28')]=function(_0x1e1ac2,_0x6f3532){var _0x59948c={},_0x454870={},_0x1524a5={'count':0x0,'rows':[]};var _0x3f0752=_[_0x26a1('0x29')](db[_0x26a1('0x2a')][_0x26a1('0x2b')],function(_0x5926a1){return{'name':_0x5926a1[_0x26a1('0x2c')],'type':_0x5926a1['type']['key']};});_0x454870['model']=_['map'](_0x3f0752,_0x26a1('0x26'));_0x454870['query']=_['keys'](_0x1e1ac2[_0x26a1('0x2d')]);_0x454870[_0x26a1('0x2e')]=_[_0x26a1('0x2f')](_0x454870[_0x26a1('0x30')],_0x454870[_0x26a1('0x2d')]);_0x59948c[_0x26a1('0x31')]=_[_0x26a1('0x2f')](_0x454870['model'],qs[_0x26a1('0x32')](_0x1e1ac2[_0x26a1('0x2d')][_0x26a1('0x32')]));_0x59948c['attributes']=_0x59948c[_0x26a1('0x31')][_0x26a1('0x33')]?_0x59948c[_0x26a1('0x31')]:_0x454870[_0x26a1('0x30')];if(!_0x1e1ac2[_0x26a1('0x2d')]['hasOwnProperty'](_0x26a1('0x34'))){_0x59948c['limit']=qs[_0x26a1('0x1c')](_0x1e1ac2[_0x26a1('0x2d')][_0x26a1('0x1c')]);_0x59948c[_0x26a1('0x1b')]=qs['offset'](_0x1e1ac2['query'][_0x26a1('0x1b')]);}_0x59948c[_0x26a1('0x35')]=qs[_0x26a1('0x36')](_0x1e1ac2[_0x26a1('0x2d')][_0x26a1('0x36')]);_0x59948c['where']=qs[_0x26a1('0x2e')](_[_0x26a1('0x37')](_0x1e1ac2[_0x26a1('0x2d')],_0x454870[_0x26a1('0x2e')]),_0x3f0752);if(_0x1e1ac2[_0x26a1('0x2d')]['filter']){_0x59948c['where']=_[_0x26a1('0x38')](_0x59948c['where'],{'$or':_['map'](_0x3f0752,function(_0x3de1dd){if(_0x3de1dd[_0x26a1('0x39')]!==_0x26a1('0x3a')){var _0xe9bd3f={};_0xe9bd3f[_0x3de1dd[_0x26a1('0x26')]]={'$like':'%'+_0x1e1ac2[_0x26a1('0x2d')][_0x26a1('0x3b')]+'%'};return _0xe9bd3f;}})});}_0x59948c=_[_0x26a1('0x38')]({},_0x59948c,_0x1e1ac2[_0x26a1('0x3c')]);var _0x1e85c5={'where':_0x59948c[_0x26a1('0x3d')]};return db[_0x26a1('0x2a')][_0x26a1('0x1e')](_0x1e85c5)[_0x26a1('0x23')](function(_0x4be69c){_0x1524a5[_0x26a1('0x1e')]=_0x4be69c;if(_0x1e1ac2[_0x26a1('0x2d')][_0x26a1('0x3e')]){_0x59948c[_0x26a1('0x3f')]=[{'all':!![]}];}return db['SquareReport'][_0x26a1('0x40')](_0x59948c);})[_0x26a1('0x23')](function(_0x41b281){_0x1524a5['rows']=_0x41b281;return _0x1524a5;})['then'](respondWithFilteredResult(_0x6f3532,_0x59948c))[_0x26a1('0x41')](handleError(_0x6f3532,null));};exports[_0x26a1('0x42')]=function(_0x3c8152,_0x536833){var _0x322d93={'raw':!![],'where':{'id':_0x3c8152[_0x26a1('0x43')]['id']}},_0x4e2a74={};_0x4e2a74['model']=_[_0x26a1('0x44')](db[_0x26a1('0x2a')][_0x26a1('0x2b')]);_0x4e2a74['query']=_[_0x26a1('0x44')](_0x3c8152[_0x26a1('0x2d')]);_0x4e2a74[_0x26a1('0x2e')]=_[_0x26a1('0x2f')](_0x4e2a74[_0x26a1('0x30')],_0x4e2a74[_0x26a1('0x2d')]);_0x322d93[_0x26a1('0x31')]=_['intersection'](_0x4e2a74['model'],qs['fields'](_0x3c8152[_0x26a1('0x2d')][_0x26a1('0x32')]));_0x322d93[_0x26a1('0x31')]=_0x322d93[_0x26a1('0x31')]['length']?_0x322d93[_0x26a1('0x31')]:_0x4e2a74['model'];if(_0x3c8152[_0x26a1('0x2d')][_0x26a1('0x3e')]){_0x322d93['include']=[{'all':!![]}];}_0x322d93=_[_0x26a1('0x38')]({},_0x322d93,_0x3c8152[_0x26a1('0x3c')]);return db[_0x26a1('0x2a')][_0x26a1('0x45')](_0x322d93)[_0x26a1('0x23')](handleEntityNotFound(_0x536833,null))['then'](respondWithResult(_0x536833,null))['catch'](handleError(_0x536833,null));};exports[_0x26a1('0x46')]=function(_0x3cef10,_0x2bc514){return db[_0x26a1('0x2a')][_0x26a1('0x46')](_0x3cef10[_0x26a1('0x47')],{})[_0x26a1('0x23')](respondWithResult(_0x2bc514,0xc9))[_0x26a1('0x41')](handleError(_0x2bc514,null));};exports[_0x26a1('0x48')]=function(_0x23346d,_0x30513a){if(_0x23346d[_0x26a1('0x47')]['id']){delete _0x23346d[_0x26a1('0x47')]['id'];}return db[_0x26a1('0x2a')][_0x26a1('0x45')]({'where':{'id':_0x23346d[_0x26a1('0x43')]['id']}})[_0x26a1('0x23')](handleEntityNotFound(_0x30513a,null))[_0x26a1('0x23')](saveUpdates(_0x23346d[_0x26a1('0x47')],null))['then'](respondWithResult(_0x30513a,null))[_0x26a1('0x41')](handleError(_0x30513a,null));};exports[_0x26a1('0x49')]=function(_0x442a43,_0x2347ae){return db[_0x26a1('0x2a')]['find']({'where':{'id':_0x442a43[_0x26a1('0x43')]['id']}})[_0x26a1('0x23')](handleEntityNotFound(_0x2347ae,null))['then'](removeEntity(_0x2347ae,null))[_0x26a1('0x41')](handleError(_0x2347ae,null));};exports[_0x26a1('0x4a')]=function(_0x1f8abd,_0x46f3f6){return db['SquareReport'][_0x26a1('0x4a')]()[_0x26a1('0x23')](respondWithResult(_0x46f3f6,null))[_0x26a1('0x41')](handleError(_0x46f3f6,null));}; \ No newline at end of file +var _0xf3e8=['crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','apply','reject','then','sendStatus','name','index','map','SquareReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','rows','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash'];(function(_0xc39761,_0x1ace98){var _0x389974=function(_0x5a2a01){while(--_0x5a2a01){_0xc39761['push'](_0xc39761['shift']());}};_0x389974(++_0x1ace98);}(_0xf3e8,0x187));var _0x8f3e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf3e8[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x8f3e('0x0'));var rimraf=require(_0x8f3e('0x1'));var zipdir=require(_0x8f3e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f3e('0x3'));var moment=require(_0x8f3e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8f3e('0x5'));var util=require(_0x8f3e('0x6'));var path=require('path');var sox=require(_0x8f3e('0x7'));var csv=require(_0x8f3e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f3e('0x9'));var _=require(_0x8f3e('0xa'));var squel=require('squel');var crypto=require(_0x8f3e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8f3e('0xc'));var toCsv=require(_0x8f3e('0x8'));var querystring=require(_0x8f3e('0xd'));var Papa=require('papaparse');var Redis=require(_0x8f3e('0xe'));var authService=require(_0x8f3e('0xf'));var qs=require(_0x8f3e('0x10'));var as=require(_0x8f3e('0x11'));var hardwareService=require(_0x8f3e('0x12'));var logger=require('../../config/logger')(_0x8f3e('0x13'));var utils=require('../../config/utils');var config=require(_0x8f3e('0x14'));var licenseUtil=require(_0x8f3e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x374bc8,_0x699426){_0x699426=_0x699426||0xcc;return function(_0x2d7e61){if(_0x2d7e61){return _0x374bc8['sendStatus'](_0x699426);}return _0x374bc8[_0x8f3e('0x16')](_0x699426)[_0x8f3e('0x17')]();};}function respondWithResult(_0x14ab52,_0x12f16d){_0x12f16d=_0x12f16d||0xc8;return function(_0x9a3ad6){if(_0x9a3ad6){return _0x14ab52['status'](_0x12f16d)[_0x8f3e('0x18')](_0x9a3ad6);}};}function respondWithFilteredResult(_0x5edbd8,_0x3c2b88){return function(_0x25b817){if(_0x25b817){var _0xb242cc=typeof _0x3c2b88[_0x8f3e('0x19')]===_0x8f3e('0x1a')&&typeof _0x3c2b88['limit']==='undefined';var _0xd696fd=_0x25b817[_0x8f3e('0x1b')];var _0xe99074=_0xb242cc?0x0:_0x3c2b88[_0x8f3e('0x19')];var _0x41c733=_0xb242cc?_0x25b817[_0x8f3e('0x1b')]:_0x3c2b88[_0x8f3e('0x19')]+_0x3c2b88[_0x8f3e('0x1c')];var _0x5a1d2a;if(_0x41c733>=_0xd696fd){_0x41c733=_0xd696fd;_0x5a1d2a=0xc8;}else{_0x5a1d2a=0xce;}_0x5edbd8['status'](_0x5a1d2a);return _0x5edbd8[_0x8f3e('0x1d')]('Content-Range',_0xe99074+'-'+_0x41c733+'/'+_0xd696fd)[_0x8f3e('0x18')](_0x25b817);}return null;};}function patchUpdates(_0x2d6d3f){return function(_0x2e23cd){try{jsonpatch[_0x8f3e('0x1e')](_0x2e23cd,_0x2d6d3f,!![]);}catch(_0x275b99){return BPromise[_0x8f3e('0x1f')](_0x275b99);}return _0x2e23cd['save']();};}function saveUpdates(_0x1787e0,_0x51f24d){return function(_0x409e91){if(_0x409e91){return _0x409e91['update'](_0x1787e0)[_0x8f3e('0x20')](function(_0x5042ca){return _0x5042ca;});}return null;};}function removeEntity(_0x559984,_0xaee060){return function(_0xebe9fb){if(_0xebe9fb){return _0xebe9fb['destroy']()[_0x8f3e('0x20')](function(){_0x559984[_0x8f3e('0x16')](0xcc)[_0x8f3e('0x17')]();});}};}function handleEntityNotFound(_0x15f9a9,_0x5093b9){return function(_0x242f41){if(!_0x242f41){_0x15f9a9[_0x8f3e('0x21')](0x194);}return _0x242f41;};}function handleError(_0x10874d,_0x5cf3e5){_0x5cf3e5=_0x5cf3e5||0x1f4;return function(_0x3952ee){logger['error'](_0x3952ee['stack']);if(_0x3952ee[_0x8f3e('0x22')]){delete _0x3952ee['name'];}_0x10874d[_0x8f3e('0x16')](_0x5cf3e5)['send'](_0x3952ee);};}exports[_0x8f3e('0x23')]=function(_0x415999,_0xbd2037){var _0x43a1f8={},_0x2c6987={},_0x3faea1={'count':0x0,'rows':[]};var _0x110ead=_[_0x8f3e('0x24')](db[_0x8f3e('0x25')][_0x8f3e('0x26')],function(_0x395d45){return{'name':_0x395d45[_0x8f3e('0x27')],'type':_0x395d45['type'][_0x8f3e('0x28')]};});_0x2c6987[_0x8f3e('0x29')]=_[_0x8f3e('0x24')](_0x110ead,_0x8f3e('0x22'));_0x2c6987[_0x8f3e('0x2a')]=_['keys'](_0x415999[_0x8f3e('0x2a')]);_0x2c6987[_0x8f3e('0x2b')]=_[_0x8f3e('0x2c')](_0x2c6987['model'],_0x2c6987['query']);_0x43a1f8[_0x8f3e('0x2d')]=_[_0x8f3e('0x2c')](_0x2c6987['model'],qs[_0x8f3e('0x2e')](_0x415999[_0x8f3e('0x2a')][_0x8f3e('0x2e')]));_0x43a1f8[_0x8f3e('0x2d')]=_0x43a1f8[_0x8f3e('0x2d')]['length']?_0x43a1f8[_0x8f3e('0x2d')]:_0x2c6987[_0x8f3e('0x29')];if(!_0x415999[_0x8f3e('0x2a')][_0x8f3e('0x2f')]('nolimit')){_0x43a1f8[_0x8f3e('0x1c')]=qs[_0x8f3e('0x1c')](_0x415999[_0x8f3e('0x2a')][_0x8f3e('0x1c')]);_0x43a1f8['offset']=qs[_0x8f3e('0x19')](_0x415999[_0x8f3e('0x2a')][_0x8f3e('0x19')]);}_0x43a1f8[_0x8f3e('0x30')]=qs[_0x8f3e('0x31')](_0x415999['query'][_0x8f3e('0x31')]);_0x43a1f8['where']=qs['filters'](_[_0x8f3e('0x32')](_0x415999[_0x8f3e('0x2a')],_0x2c6987[_0x8f3e('0x2b')]),_0x110ead);if(_0x415999[_0x8f3e('0x2a')][_0x8f3e('0x33')]){_0x43a1f8['where']=_[_0x8f3e('0x34')](_0x43a1f8[_0x8f3e('0x35')],{'$or':_[_0x8f3e('0x24')](_0x110ead,function(_0xaf0e21){if(_0xaf0e21[_0x8f3e('0x36')]!==_0x8f3e('0x37')){var _0x1e9042={};_0x1e9042[_0xaf0e21[_0x8f3e('0x22')]]={'$like':'%'+_0x415999['query'][_0x8f3e('0x33')]+'%'};return _0x1e9042;}})});}_0x43a1f8=_[_0x8f3e('0x34')]({},_0x43a1f8,_0x415999['options']);var _0x2a52a3={'where':_0x43a1f8[_0x8f3e('0x35')]};return db[_0x8f3e('0x25')][_0x8f3e('0x1b')](_0x2a52a3)[_0x8f3e('0x20')](function(_0x307696){_0x3faea1[_0x8f3e('0x1b')]=_0x307696;if(_0x415999[_0x8f3e('0x2a')][_0x8f3e('0x38')]){_0x43a1f8['include']=[{'all':!![]}];}return db[_0x8f3e('0x25')]['findAll'](_0x43a1f8);})[_0x8f3e('0x20')](function(_0x5ac3c6){_0x3faea1[_0x8f3e('0x39')]=_0x5ac3c6;return _0x3faea1;})[_0x8f3e('0x20')](respondWithFilteredResult(_0xbd2037,_0x43a1f8))[_0x8f3e('0x3a')](handleError(_0xbd2037,null));};exports[_0x8f3e('0x3b')]=function(_0x4b6e37,_0x108c45){var _0x362206={'raw':!![],'where':{'id':_0x4b6e37[_0x8f3e('0x3c')]['id']}},_0x4be0fe={};_0x4be0fe[_0x8f3e('0x29')]=_[_0x8f3e('0x3d')](db[_0x8f3e('0x25')]['rawAttributes']);_0x4be0fe['query']=_[_0x8f3e('0x3d')](_0x4b6e37[_0x8f3e('0x2a')]);_0x4be0fe[_0x8f3e('0x2b')]=_[_0x8f3e('0x2c')](_0x4be0fe['model'],_0x4be0fe[_0x8f3e('0x2a')]);_0x362206[_0x8f3e('0x2d')]=_[_0x8f3e('0x2c')](_0x4be0fe['model'],qs[_0x8f3e('0x2e')](_0x4b6e37['query']['fields']));_0x362206['attributes']=_0x362206[_0x8f3e('0x2d')]['length']?_0x362206['attributes']:_0x4be0fe[_0x8f3e('0x29')];if(_0x4b6e37['query']['includeAll']){_0x362206['include']=[{'all':!![]}];}_0x362206=_[_0x8f3e('0x34')]({},_0x362206,_0x4b6e37[_0x8f3e('0x3e')]);return db[_0x8f3e('0x25')][_0x8f3e('0x3f')](_0x362206)['then'](handleEntityNotFound(_0x108c45,null))[_0x8f3e('0x20')](respondWithResult(_0x108c45,null))[_0x8f3e('0x3a')](handleError(_0x108c45,null));};exports[_0x8f3e('0x40')]=function(_0x1be947,_0x279e6d){return db[_0x8f3e('0x25')][_0x8f3e('0x40')](_0x1be947['body'],{})[_0x8f3e('0x20')](respondWithResult(_0x279e6d,0xc9))[_0x8f3e('0x3a')](handleError(_0x279e6d,null));};exports['update']=function(_0x400c22,_0x4f6b0a){if(_0x400c22[_0x8f3e('0x41')]['id']){delete _0x400c22[_0x8f3e('0x41')]['id'];}return db[_0x8f3e('0x25')][_0x8f3e('0x3f')]({'where':{'id':_0x400c22[_0x8f3e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4f6b0a,null))[_0x8f3e('0x20')](saveUpdates(_0x400c22[_0x8f3e('0x41')],null))[_0x8f3e('0x20')](respondWithResult(_0x4f6b0a,null))[_0x8f3e('0x3a')](handleError(_0x4f6b0a,null));};exports['destroy']=function(_0x3aeb64,_0x97caa){return db[_0x8f3e('0x25')][_0x8f3e('0x3f')]({'where':{'id':_0x3aeb64[_0x8f3e('0x3c')]['id']}})[_0x8f3e('0x20')](handleEntityNotFound(_0x97caa,null))[_0x8f3e('0x20')](removeEntity(_0x97caa,null))[_0x8f3e('0x3a')](handleError(_0x97caa,null));};exports[_0x8f3e('0x42')]=function(_0xe581b8,_0x4d29af){return db[_0x8f3e('0x25')]['describe']()[_0x8f3e('0x20')](respondWithResult(_0x4d29af,null))['catch'](handleError(_0x4d29af,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e887768..300e8e7 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 _0xf052=['api','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','uid_pname','uniqueid','project_name','leaveAt','lodash'];(function(_0x3fdfa0,_0x582bb1){var _0x12d70a=function(_0x9d33e8){while(--_0x9d33e8){_0x3fdfa0['push'](_0x3fdfa0['shift']());}};_0x12d70a(++_0x582bb1);}(_0xf052,0x12b));var _0x2f05=function(_0xea81a1,_0xb28e9e){_0xea81a1=_0xea81a1-0x0;var _0x2cd030=_0xf052[_0xea81a1];return _0x2cd030;};'use strict';var _=require(_0x2f05('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2f05('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f05('0x2'));var fs=require('fs');var path=require(_0x2f05('0x3'));var rimraf=require('rimraf');var config=require(_0x2f05('0x4'));var attributes=require(_0x2f05('0x5'));module[_0x2f05('0x6')]=function(_0x36b2be,_0x3b3e39){return _0x36b2be[_0x2f05('0x7')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x2f05('0x8'),'fields':[_0x2f05('0x9'),_0x2f05('0xa')]},{'name':'leaveAt','fields':[_0x2f05('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x482e=['leaveAt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','project_name'];(function(_0x249e33,_0x4e7c60){var _0x377c66=function(_0x5e7124){while(--_0x5e7124){_0x249e33['push'](_0x249e33['shift']());}};_0x377c66(++_0x4e7c60);}(_0x482e,0x191));var _0xe482=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x482e[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0xe482('0x0'));var util=require(_0xe482('0x1'));var logger=require(_0xe482('0x2'))(_0xe482('0x3'));var moment=require(_0xe482('0x4'));var BPromise=require('bluebird');var rp=require(_0xe482('0x5'));var fs=require('fs');var path=require(_0xe482('0x6'));var rimraf=require(_0xe482('0x7'));var config=require(_0xe482('0x8'));var attributes=require(_0xe482('0x9'));module[_0xe482('0xa')]=function(_0x5f5851,_0xf91c62){return _0x5f5851[_0xe482('0xb')]('SquareReport',attributes,{'tableName':_0xe482('0xc'),'paranoid':![],'indexes':[{'name':_0xe482('0xd'),'fields':['uniqueid',_0xe482('0xe')]},{'name':'leaveAt','fields':[_0xe482('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 67ca264..ee3eea1 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 _0x35fa=['options','UpdateSquareReport','update','body','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','CreateSquareReport','SquareReport','create'];(function(_0x2d4a6f,_0x3ff15c){var _0x4344d7=function(_0x1e5b28){while(--_0x1e5b28){_0x2d4a6f['push'](_0x2d4a6f['shift']());}};_0x4344d7(++_0x3ff15c);}(_0x35fa,0x128));var _0xa35f=function(_0x453178,_0x4171d4){_0x453178=_0x453178-0x0;var _0x7a2475=_0x35fa[_0x453178];return _0x7a2475;};'use strict';var _=require(_0xa35f('0x0'));var util=require(_0xa35f('0x1'));var moment=require(_0xa35f('0x2'));var BPromise=require(_0xa35f('0x3'));var rs=require(_0xa35f('0x4'));var fs=require('fs');var Redis=require(_0xa35f('0x5'));var db=require(_0xa35f('0x6'))['db'];var utils=require(_0xa35f('0x7'));var logger=require(_0xa35f('0x8'))('rpc');var config=require(_0xa35f('0x9'));var jayson=require(_0xa35f('0xa'));var client=jayson[_0xa35f('0xb')][_0xa35f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x520f3c,_0x502c17,_0x9d0797){return new BPromise(function(_0x1a4418,_0x33050d){return client[_0xa35f('0xd')](_0x520f3c,_0x9d0797)[_0xa35f('0xe')](function(_0x19842f){logger['info'](_0xa35f('0xf'),_0x502c17,'request\x20sent');logger[_0xa35f('0x10')](_0xa35f('0x11'),_0x502c17,_0xa35f('0x12'),JSON[_0xa35f('0x13')](_0x19842f));if(_0x19842f[_0xa35f('0x14')]){if(_0x19842f[_0xa35f('0x14')]['code']===0x1f4){logger[_0xa35f('0x14')](_0xa35f('0xf'),_0x502c17,_0x19842f[_0xa35f('0x14')][_0xa35f('0x15')]);return _0x33050d(_0x19842f[_0xa35f('0x14')][_0xa35f('0x15')]);}logger[_0xa35f('0x14')](_0xa35f('0xf'),_0x502c17,_0x19842f['error'][_0xa35f('0x15')]);return _0x1a4418(_0x19842f[_0xa35f('0x14')][_0xa35f('0x15')]);}else{logger[_0xa35f('0x16')](_0xa35f('0xf'),_0x502c17,_0xa35f('0x12'));_0x1a4418(_0x19842f[_0xa35f('0x17')][_0xa35f('0x15')]);}})[_0xa35f('0x18')](function(_0x563974){logger[_0xa35f('0x14')](_0xa35f('0xf'),_0x502c17,_0x563974);_0x33050d(_0x563974);});});}exports[_0xa35f('0x19')]=function(_0x44f423){var _0xc5bb91=this;return new Promise(function(_0x2b4214,_0xae6339){return db[_0xa35f('0x1a')][_0xa35f('0x1b')](_0x44f423['body'],{'raw':_0x44f423[_0xa35f('0x1c')]?_0x44f423[_0xa35f('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xa35f('0xe')](function(_0x4d1144){logger[_0xa35f('0x16')]('CreateSquareReport',_0x44f423);logger['debug'](_0xa35f('0x19'),_0x44f423,JSON['stringify'](_0x4d1144));_0x2b4214(_0x4d1144);})[_0xa35f('0x18')](function(_0x86367b){logger[_0xa35f('0x14')]('CreateSquareReport',_0x86367b[_0xa35f('0x15')],_0x44f423);_0xae6339(_0xc5bb91[_0xa35f('0x14')](0x1f4,_0x86367b['message']));});});};exports[_0xa35f('0x1d')]=function(_0x54f4ad){var _0x53abbe=this;return new Promise(function(_0x239904,_0x1cdd72){return db[_0xa35f('0x1a')][_0xa35f('0x1e')](_0x54f4ad[_0xa35f('0x1f')],{'raw':_0x54f4ad[_0xa35f('0x1c')]?_0x54f4ad[_0xa35f('0x1c')][_0xa35f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54f4ad['options']?_0x54f4ad['options'][_0xa35f('0x21')]||null:null,'attributes':_0x54f4ad[_0xa35f('0x1c')]?_0x54f4ad[_0xa35f('0x1c')][_0xa35f('0x22')]||null:null,'limit':_0x54f4ad[_0xa35f('0x1c')]?_0x54f4ad[_0xa35f('0x1c')][_0xa35f('0x23')]||null:null})[_0xa35f('0xe')](function(_0x430fd1){logger[_0xa35f('0x16')](_0xa35f('0x1d'),_0x54f4ad);logger[_0xa35f('0x10')](_0xa35f('0x1d'),_0x54f4ad,JSON[_0xa35f('0x13')](_0x430fd1));_0x239904(_0x430fd1);})['catch'](function(_0x373f87){logger['error'](_0xa35f('0x1d'),_0x373f87['message'],_0x54f4ad);_0x1cdd72(_0x53abbe['error'](0x1f4,_0x373f87['message']));});});}; \ No newline at end of file +var _0x4952=['request\x20sent','stringify','error','code','info','catch','CreateSquareReport','SquareReport','create','body','options','raw','message','update','where','limit','UpdateSquareReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x6942a1,_0x269e31){var _0x991417=function(_0x35b9cf){while(--_0x35b9cf){_0x6942a1['push'](_0x6942a1['shift']());}};_0x991417(++_0x269e31);}(_0x4952,0x95));var _0x2495=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0x4952[_0x4991d6];return _0x50faf7;};'use strict';var _=require(_0x2495('0x0'));var util=require(_0x2495('0x1'));var moment=require(_0x2495('0x2'));var BPromise=require('bluebird');var rs=require(_0x2495('0x3'));var fs=require('fs');var Redis=require(_0x2495('0x4'));var db=require(_0x2495('0x5'))['db'];var utils=require(_0x2495('0x6'));var logger=require(_0x2495('0x7'))(_0x2495('0x8'));var config=require(_0x2495('0x9'));var jayson=require(_0x2495('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a2d0,_0x48f9c6,_0x114c18){return new BPromise(function(_0x22eb91,_0x274305){return client[_0x2495('0xb')](_0x19a2d0,_0x114c18)[_0x2495('0xc')](function(_0xe53e8b){logger['info'](_0x2495('0xd'),_0x48f9c6,'request\x20sent');logger[_0x2495('0xe')](_0x2495('0xf'),_0x48f9c6,_0x2495('0x10'),JSON[_0x2495('0x11')](_0xe53e8b));if(_0xe53e8b[_0x2495('0x12')]){if(_0xe53e8b[_0x2495('0x12')][_0x2495('0x13')]===0x1f4){logger[_0x2495('0x12')](_0x2495('0xd'),_0x48f9c6,_0xe53e8b[_0x2495('0x12')]['message']);return _0x274305(_0xe53e8b[_0x2495('0x12')]['message']);}logger['error'](_0x2495('0xd'),_0x48f9c6,_0xe53e8b['error']['message']);return _0x22eb91(_0xe53e8b[_0x2495('0x12')]['message']);}else{logger[_0x2495('0x14')](_0x2495('0xd'),_0x48f9c6,_0x2495('0x10'));_0x22eb91(_0xe53e8b['result']['message']);}})[_0x2495('0x15')](function(_0x5f34f6){logger['error']('SquareReport,\x20%s,\x20%s',_0x48f9c6,_0x5f34f6);_0x274305(_0x5f34f6);});});}exports[_0x2495('0x16')]=function(_0x3b3761){var _0x327897=this;return new Promise(function(_0x3f7d64,_0x18151a){return db[_0x2495('0x17')][_0x2495('0x18')](_0x3b3761[_0x2495('0x19')],{'raw':_0x3b3761[_0x2495('0x1a')]?_0x3b3761[_0x2495('0x1a')][_0x2495('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x20b27b){logger[_0x2495('0x14')](_0x2495('0x16'),_0x3b3761);logger['debug']('CreateSquareReport',_0x3b3761,JSON[_0x2495('0x11')](_0x20b27b));_0x3f7d64(_0x20b27b);})[_0x2495('0x15')](function(_0x5c594a){logger[_0x2495('0x12')](_0x2495('0x16'),_0x5c594a[_0x2495('0x1c')],_0x3b3761);_0x18151a(_0x327897[_0x2495('0x12')](0x1f4,_0x5c594a[_0x2495('0x1c')]));});});};exports['UpdateSquareReport']=function(_0x5d042c){var _0x1624e8=this;return new Promise(function(_0xc6433a,_0x536f8a){return db[_0x2495('0x17')][_0x2495('0x1d')](_0x5d042c[_0x2495('0x19')],{'raw':_0x5d042c[_0x2495('0x1a')]?_0x5d042c[_0x2495('0x1a')][_0x2495('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d042c[_0x2495('0x1a')]?_0x5d042c[_0x2495('0x1a')][_0x2495('0x1e')]||null:null,'attributes':_0x5d042c[_0x2495('0x1a')]?_0x5d042c[_0x2495('0x1a')]['attributes']||null:null,'limit':_0x5d042c['options']?_0x5d042c[_0x2495('0x1a')][_0x2495('0x1f')]||null:null})[_0x2495('0xc')](function(_0x559545){logger[_0x2495('0x14')](_0x2495('0x20'),_0x5d042c);logger['debug'](_0x2495('0x20'),_0x5d042c,JSON[_0x2495('0x11')](_0x559545));_0xc6433a(_0x559545);})[_0x2495('0x15')](function(_0x2869f4){logger[_0x2495('0x12')]('UpdateSquareReport',_0x2869f4[_0x2495('0x1c')],_0x5d042c);_0x536f8a(_0x1624e8['error'](0x1f4,_0x2869f4[_0x2495('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 023c6c3..7a81bf5 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 _0x7507=['../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2a337c,_0x2d32dd){var _0x4a7639=function(_0x236755){while(--_0x236755){_0x2a337c['push'](_0x2a337c['shift']());}};_0x4a7639(++_0x2d32dd);}(_0x7507,0x1f0));var _0x7750=function(_0x3f9e2c,_0x400d08){_0x3f9e2c=_0x3f9e2c-0x0;var _0x1d6c3b=_0x7507[_0x3f9e2c];return _0x1d6c3b;};'use strict';var multer=require(_0x7750('0x0'));var util=require(_0x7750('0x1'));var path=require(_0x7750('0x2'));var timeout=require(_0x7750('0x3'));var express=require(_0x7750('0x4'));var router=express[_0x7750('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7750('0x6'));var interaction=require(_0x7750('0x7'));var config=require(_0x7750('0x8'));var controller=require(_0x7750('0x9'));router[_0x7750('0xa')]('/',auth[_0x7750('0xb')](),controller[_0x7750('0xc')]);router['get'](_0x7750('0xd'),auth[_0x7750('0xb')](),controller[_0x7750('0xe')]);router[_0x7750('0xa')](_0x7750('0xf'),auth[_0x7750('0xb')](),controller['show']);router['post']('/',auth[_0x7750('0xb')](),controller[_0x7750('0x10')]);router[_0x7750('0x11')](_0x7750('0xf'),auth[_0x7750('0xb')](),controller['update']);router[_0x7750('0x12')](_0x7750('0xf'),auth[_0x7750('0xb')](),controller[_0x7750('0x13')]);module[_0x7750('0x14')]=router; \ No newline at end of file +var _0x0ae6=['../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0xbfc4f1,_0x13a332){var _0x21c719=function(_0x5cf047){while(--_0x5cf047){_0xbfc4f1['push'](_0xbfc4f1['shift']());}};_0x21c719(++_0x13a332);}(_0x0ae6,0xa2));var _0x60ae=function(_0x582bc5,_0x318018){_0x582bc5=_0x582bc5-0x0;var _0x519a1a=_0x0ae6[_0x582bc5];return _0x519a1a;};'use strict';var multer=require(_0x60ae('0x0'));var util=require(_0x60ae('0x1'));var path=require('path');var timeout=require(_0x60ae('0x2'));var express=require(_0x60ae('0x3'));var router=express[_0x60ae('0x4')]();var fs_extra=require(_0x60ae('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x60ae('0x6'));var config=require(_0x60ae('0x7'));var controller=require(_0x60ae('0x8'));router[_0x60ae('0x9')]('/',auth[_0x60ae('0xa')](),controller[_0x60ae('0xb')]);router[_0x60ae('0x9')](_0x60ae('0xc'),auth[_0x60ae('0xa')](),controller[_0x60ae('0xd')]);router[_0x60ae('0x9')](_0x60ae('0xe'),auth[_0x60ae('0xa')](),controller[_0x60ae('0xf')]);router[_0x60ae('0x10')]('/',auth[_0x60ae('0xa')](),controller[_0x60ae('0x11')]);router[_0x60ae('0x12')](_0x60ae('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x60ae('0x13')]('/:id',auth[_0x60ae('0xa')](),controller['destroy']);module[_0x60ae('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 8395ff9..004bdc0 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 _0x1abb=['TEXT','sequelize','STRING'];(function(_0x1c0b45,_0x1df578){var _0x115f1c=function(_0x1696d0){while(--_0x1696d0){_0x1c0b45['push'](_0x1c0b45['shift']());}};_0x115f1c(++_0x1df578);}(_0x1abb,0x6d));var _0xb1ab=function(_0x4401b7,_0x98b2f1){_0x4401b7=_0x4401b7-0x0;var _0x458b00=_0x1abb[_0x4401b7];return _0x458b00;};'use strict';var Sequelize=require(_0xb1ab('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb1ab('0x1')]},'node':{'type':Sequelize[_0xb1ab('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xb1ab('0x2')]},'project_name':{'type':Sequelize[_0xb1ab('0x1')]},'callerid':{'type':Sequelize[_0xb1ab('0x1')]}}; \ No newline at end of file +var _0x8ed6=['TEXT','STRING'];(function(_0x4f9da9,_0x2624a0){var _0x3255ef=function(_0x32f213){while(--_0x32f213){_0x4f9da9['push'](_0x4f9da9['shift']());}};_0x3255ef(++_0x2624a0);}(_0x8ed6,0x151));var _0x68ed=function(_0x51e7a5,_0x22d4a0){_0x51e7a5=_0x51e7a5-0x0;var _0x2c130e=_0x8ed6[_0x51e7a5];return _0x2c130e;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x68ed('0x0')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x68ed('0x1')]},'project_name':{'type':Sequelize[_0x68ed('0x0')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 341c0ed..d3185d8 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 _0x15b0=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x4a71b4,_0x3a4e06){var _0x202ce2=function(_0x4e74c8){while(--_0x4e74c8){_0x4a71b4['push'](_0x4a71b4['shift']());}};_0x202ce2(++_0x3a4e06);}(_0x15b0,0x146));var _0x015b=function(_0x40244d,_0x54cfeb){_0x40244d=_0x40244d-0x0;var _0x28917f=_0x15b0[_0x40244d];return _0x28917f;};'use strict';var emlformat=require(_0x015b('0x0'));var rimraf=require(_0x015b('0x1'));var zipdir=require(_0x015b('0x2'));var jsonpatch=require(_0x015b('0x3'));var rp=require('request-promise');var moment=require(_0x015b('0x4'));var BPromise=require(_0x015b('0x5'));var Mustache=require(_0x015b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x015b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x015b('0x8'));var squel=require(_0x015b('0x9'));var crypto=require('crypto');var jsforce=require(_0x015b('0xa'));var deskjs=require(_0x015b('0xb'));var toCsv=require(_0x015b('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x015b('0xc'));var qs=require(_0x015b('0xd'));var as=require(_0x015b('0xe'));var hardwareService=require(_0x015b('0xf'));var logger=require(_0x015b('0x10'))(_0x015b('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x015b('0x12'));var db=require(_0x015b('0x13'))['db'];function respondWithStatusCode(_0xc9bd83,_0x113f13){_0x113f13=_0x113f13||0xcc;return function(_0x5349f1){if(_0x5349f1){return _0xc9bd83['sendStatus'](_0x113f13);}return _0xc9bd83[_0x015b('0x14')](_0x113f13)[_0x015b('0x15')]();};}function respondWithResult(_0x5c0303,_0x535ede){_0x535ede=_0x535ede||0xc8;return function(_0x53718e){if(_0x53718e){return _0x5c0303[_0x015b('0x14')](_0x535ede)[_0x015b('0x16')](_0x53718e);}};}function respondWithFilteredResult(_0x2e721a,_0x2b07fd){return function(_0x35d7b6){if(_0x35d7b6){var _0xb1dbdd=typeof _0x2b07fd[_0x015b('0x17')]===_0x015b('0x18')&&typeof _0x2b07fd[_0x015b('0x19')]===_0x015b('0x18');var _0x4e1eca=_0x35d7b6['count'];var _0x3d1ea1=_0xb1dbdd?0x0:_0x2b07fd[_0x015b('0x17')];var _0x267325=_0xb1dbdd?_0x35d7b6[_0x015b('0x1a')]:_0x2b07fd[_0x015b('0x17')]+_0x2b07fd[_0x015b('0x19')];var _0x56ef06;if(_0x267325>=_0x4e1eca){_0x267325=_0x4e1eca;_0x56ef06=0xc8;}else{_0x56ef06=0xce;}_0x2e721a[_0x015b('0x14')](_0x56ef06);return _0x2e721a[_0x015b('0x1b')](_0x015b('0x1c'),_0x3d1ea1+'-'+_0x267325+'/'+_0x4e1eca)[_0x015b('0x16')](_0x35d7b6);}return null;};}function patchUpdates(_0x4d6334){return function(_0xc86756){try{jsonpatch[_0x015b('0x1d')](_0xc86756,_0x4d6334,!![]);}catch(_0x208fac){return BPromise[_0x015b('0x1e')](_0x208fac);}return _0xc86756[_0x015b('0x1f')]();};}function saveUpdates(_0x1b3061,_0x4e7631){return function(_0x4bfbf4){if(_0x4bfbf4){return _0x4bfbf4[_0x015b('0x20')](_0x1b3061)[_0x015b('0x21')](function(_0x3f76c5){return _0x3f76c5;});}return null;};}function removeEntity(_0x149f8a,_0x4ada75){return function(_0x48fa0e){if(_0x48fa0e){return _0x48fa0e[_0x015b('0x22')]()['then'](function(){_0x149f8a[_0x015b('0x14')](0xcc)[_0x015b('0x15')]();});}};}function handleEntityNotFound(_0x34742f,_0x59bda0){return function(_0x3dc70f){if(!_0x3dc70f){_0x34742f['sendStatus'](0x194);}return _0x3dc70f;};}function handleError(_0x2b283d,_0x2f6ce5){_0x2f6ce5=_0x2f6ce5||0x1f4;return function(_0x3c3dfc){logger['error'](_0x3c3dfc[_0x015b('0x23')]);if(_0x3c3dfc['name']){delete _0x3c3dfc[_0x015b('0x24')];}_0x2b283d[_0x015b('0x14')](_0x2f6ce5)[_0x015b('0x25')](_0x3c3dfc);};}exports[_0x015b('0x26')]=function(_0x4a9dde,_0x3d3690){var _0x4f5109={},_0xc091d5={},_0x190013={'count':0x0,'rows':[]};var _0x5bd262=_[_0x015b('0x27')](db[_0x015b('0x28')][_0x015b('0x29')],function(_0x23a304){return{'name':_0x23a304['fieldName'],'type':_0x23a304[_0x015b('0x2a')]['key']};});_0xc091d5[_0x015b('0x2b')]=_[_0x015b('0x27')](_0x5bd262,_0x015b('0x24'));_0xc091d5[_0x015b('0x2c')]=_[_0x015b('0x2d')](_0x4a9dde[_0x015b('0x2c')]);_0xc091d5[_0x015b('0x2e')]=_[_0x015b('0x2f')](_0xc091d5[_0x015b('0x2b')],_0xc091d5[_0x015b('0x2c')]);_0x4f5109[_0x015b('0x30')]=_[_0x015b('0x2f')](_0xc091d5[_0x015b('0x2b')],qs[_0x015b('0x31')](_0x4a9dde['query'][_0x015b('0x31')]));_0x4f5109[_0x015b('0x30')]=_0x4f5109['attributes']['length']?_0x4f5109['attributes']:_0xc091d5[_0x015b('0x2b')];if(!_0x4a9dde[_0x015b('0x2c')]['hasOwnProperty'](_0x015b('0x32'))){_0x4f5109[_0x015b('0x19')]=qs[_0x015b('0x19')](_0x4a9dde[_0x015b('0x2c')][_0x015b('0x19')]);_0x4f5109['offset']=qs[_0x015b('0x17')](_0x4a9dde['query'][_0x015b('0x17')]);}_0x4f5109[_0x015b('0x33')]=qs['sort'](_0x4a9dde[_0x015b('0x2c')][_0x015b('0x34')]);_0x4f5109[_0x015b('0x35')]=qs[_0x015b('0x2e')](_[_0x015b('0x36')](_0x4a9dde[_0x015b('0x2c')],_0xc091d5[_0x015b('0x2e')]),_0x5bd262);if(_0x4a9dde[_0x015b('0x2c')][_0x015b('0x37')]){_0x4f5109[_0x015b('0x35')]=_['merge'](_0x4f5109['where'],{'$or':_[_0x015b('0x27')](_0x5bd262,function(_0x3e84c5){if(_0x3e84c5['type']!=='VIRTUAL'){var _0x42f187={};_0x42f187[_0x3e84c5[_0x015b('0x24')]]={'$like':'%'+_0x4a9dde[_0x015b('0x2c')]['filter']+'%'};return _0x42f187;}})});}_0x4f5109=_[_0x015b('0x38')]({},_0x4f5109,_0x4a9dde[_0x015b('0x39')]);var _0x48c954={'where':_0x4f5109[_0x015b('0x35')]};return db[_0x015b('0x28')][_0x015b('0x1a')](_0x48c954)[_0x015b('0x21')](function(_0x1fad7a){_0x190013[_0x015b('0x1a')]=_0x1fad7a;if(_0x4a9dde[_0x015b('0x2c')][_0x015b('0x3a')]){_0x4f5109['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0x015b('0x3b')](_0x4f5109);})['then'](function(_0xe7489a){_0x190013[_0x015b('0x3c')]=_0xe7489a;return _0x190013;})[_0x015b('0x21')](respondWithFilteredResult(_0x3d3690,_0x4f5109))[_0x015b('0x3d')](handleError(_0x3d3690,null));};exports[_0x015b('0x3e')]=function(_0x898cb1,_0x380d0e){var _0x398056={'raw':!![],'where':{'id':_0x898cb1[_0x015b('0x3f')]['id']}},_0x410d21={};_0x410d21['model']=_[_0x015b('0x2d')](db[_0x015b('0x28')]['rawAttributes']);_0x410d21['query']=_[_0x015b('0x2d')](_0x898cb1[_0x015b('0x2c')]);_0x410d21['filters']=_['intersection'](_0x410d21[_0x015b('0x2b')],_0x410d21[_0x015b('0x2c')]);_0x398056[_0x015b('0x30')]=_['intersection'](_0x410d21['model'],qs[_0x015b('0x31')](_0x898cb1['query'][_0x015b('0x31')]));_0x398056['attributes']=_0x398056['attributes'][_0x015b('0x40')]?_0x398056[_0x015b('0x30')]:_0x410d21[_0x015b('0x2b')];if(_0x898cb1[_0x015b('0x2c')][_0x015b('0x3a')]){_0x398056[_0x015b('0x41')]=[{'all':!![]}];}_0x398056=_[_0x015b('0x38')]({},_0x398056,_0x898cb1[_0x015b('0x39')]);return db['SquareDetailsReport'][_0x015b('0x42')](_0x398056)[_0x015b('0x21')](handleEntityNotFound(_0x380d0e,null))[_0x015b('0x21')](respondWithResult(_0x380d0e,null))['catch'](handleError(_0x380d0e,null));};exports[_0x015b('0x43')]=function(_0x4fb6ba,_0x1ba55b){return db['SquareDetailsReport'][_0x015b('0x43')](_0x4fb6ba[_0x015b('0x44')],{})[_0x015b('0x21')](respondWithResult(_0x1ba55b,0xc9))['catch'](handleError(_0x1ba55b,null));};exports[_0x015b('0x20')]=function(_0x15c0f5,_0x3b9b58){if(_0x15c0f5[_0x015b('0x44')]['id']){delete _0x15c0f5[_0x015b('0x44')]['id'];}return db[_0x015b('0x28')][_0x015b('0x42')]({'where':{'id':_0x15c0f5[_0x015b('0x3f')]['id']}})[_0x015b('0x21')](handleEntityNotFound(_0x3b9b58,null))['then'](saveUpdates(_0x15c0f5[_0x015b('0x44')],null))[_0x015b('0x21')](respondWithResult(_0x3b9b58,null))[_0x015b('0x3d')](handleError(_0x3b9b58,null));};exports[_0x015b('0x22')]=function(_0xb436ce,_0x38f27e){return db[_0x015b('0x28')][_0x015b('0x42')]({'where':{'id':_0xb436ce[_0x015b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x38f27e,null))[_0x015b('0x21')](removeEntity(_0x38f27e,null))[_0x015b('0x3d')](handleError(_0x38f27e,null));};exports[_0x015b('0x45')]=function(_0x44af12,_0x38abbe){return db[_0x015b('0x28')][_0x015b('0x45')]()[_0x015b('0x21')](respondWithResult(_0x38abbe,null))[_0x015b('0x3d')](handleError(_0x38abbe,null));}; \ No newline at end of file +var _0xe8bb=['then','destroy','error','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','catch','show','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','ejs','fs-extra','squel','to-csv','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','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update'];(function(_0x2720a5,_0x35f964){var _0x1e9096=function(_0x501782){while(--_0x501782){_0x2720a5['push'](_0x2720a5['shift']());}};_0x1e9096(++_0x35f964);}(_0xe8bb,0x199));var _0xbe8b=function(_0x208961,_0x5e6cf6){_0x208961=_0x208961-0x0;var _0x4236f5=_0xe8bb[_0x208961];return _0x4236f5;};'use strict';var emlformat=require(_0xbe8b('0x0'));var rimraf=require(_0xbe8b('0x1'));var zipdir=require(_0xbe8b('0x2'));var jsonpatch=require(_0xbe8b('0x3'));var rp=require('request-promise');var moment=require(_0xbe8b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbe8b('0x5'));var util=require(_0xbe8b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbe8b('0x7'));var fs=require('fs');var fs_extra=require(_0xbe8b('0x8'));var _=require('lodash');var squel=require(_0xbe8b('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbe8b('0xa'));var querystring=require(_0xbe8b('0xb'));var Papa=require('papaparse');var Redis=require(_0xbe8b('0xc'));var authService=require(_0xbe8b('0xd'));var qs=require(_0xbe8b('0xe'));var as=require(_0xbe8b('0xf'));var hardwareService=require(_0xbe8b('0x10'));var logger=require(_0xbe8b('0x11'))('api');var utils=require(_0xbe8b('0x12'));var config=require(_0xbe8b('0x13'));var licenseUtil=require(_0xbe8b('0x14'));var db=require(_0xbe8b('0x15'))['db'];function respondWithStatusCode(_0x237980,_0x573826){_0x573826=_0x573826||0xcc;return function(_0x1b5cab){if(_0x1b5cab){return _0x237980[_0xbe8b('0x16')](_0x573826);}return _0x237980[_0xbe8b('0x17')](_0x573826)[_0xbe8b('0x18')]();};}function respondWithResult(_0x368a15,_0x136862){_0x136862=_0x136862||0xc8;return function(_0x325fcf){if(_0x325fcf){return _0x368a15[_0xbe8b('0x17')](_0x136862)[_0xbe8b('0x19')](_0x325fcf);}};}function respondWithFilteredResult(_0x49345d,_0x12e6e1){return function(_0x563dab){if(_0x563dab){var _0x484135=typeof _0x12e6e1['offset']===_0xbe8b('0x1a')&&typeof _0x12e6e1[_0xbe8b('0x1b')]===_0xbe8b('0x1a');var _0xa63862=_0x563dab[_0xbe8b('0x1c')];var _0xe0f44b=_0x484135?0x0:_0x12e6e1[_0xbe8b('0x1d')];var _0x46728b=_0x484135?_0x563dab[_0xbe8b('0x1c')]:_0x12e6e1[_0xbe8b('0x1d')]+_0x12e6e1[_0xbe8b('0x1b')];var _0x43e8e8;if(_0x46728b>=_0xa63862){_0x46728b=_0xa63862;_0x43e8e8=0xc8;}else{_0x43e8e8=0xce;}_0x49345d[_0xbe8b('0x17')](_0x43e8e8);return _0x49345d['set'](_0xbe8b('0x1e'),_0xe0f44b+'-'+_0x46728b+'/'+_0xa63862)[_0xbe8b('0x19')](_0x563dab);}return null;};}function patchUpdates(_0x565a69){return function(_0xb190ae){try{jsonpatch[_0xbe8b('0x1f')](_0xb190ae,_0x565a69,!![]);}catch(_0x597f20){return BPromise[_0xbe8b('0x20')](_0x597f20);}return _0xb190ae[_0xbe8b('0x21')]();};}function saveUpdates(_0x33c9b6,_0x2ac245){return function(_0x412a44){if(_0x412a44){return _0x412a44[_0xbe8b('0x22')](_0x33c9b6)[_0xbe8b('0x23')](function(_0x3a7844){return _0x3a7844;});}return null;};}function removeEntity(_0x2426e2,_0x581c4e){return function(_0x21d81f){if(_0x21d81f){return _0x21d81f[_0xbe8b('0x24')]()[_0xbe8b('0x23')](function(){_0x2426e2['status'](0xcc)[_0xbe8b('0x18')]();});}};}function handleEntityNotFound(_0xe247d0,_0x2355ff){return function(_0x280795){if(!_0x280795){_0xe247d0['sendStatus'](0x194);}return _0x280795;};}function handleError(_0x378145,_0x2edd1d){_0x2edd1d=_0x2edd1d||0x1f4;return function(_0x1bd18e){logger[_0xbe8b('0x25')](_0x1bd18e['stack']);if(_0x1bd18e[_0xbe8b('0x26')]){delete _0x1bd18e[_0xbe8b('0x26')];}_0x378145[_0xbe8b('0x17')](_0x2edd1d)[_0xbe8b('0x27')](_0x1bd18e);};}exports[_0xbe8b('0x28')]=function(_0x1e0feb,_0x20af86){var _0x31500f={},_0xbc124f={},_0x3e1e0c={'count':0x0,'rows':[]};var _0x3d97fc=_['map'](db[_0xbe8b('0x29')][_0xbe8b('0x2a')],function(_0x33dff1){return{'name':_0x33dff1[_0xbe8b('0x2b')],'type':_0x33dff1[_0xbe8b('0x2c')][_0xbe8b('0x2d')]};});_0xbc124f[_0xbe8b('0x2e')]=_[_0xbe8b('0x2f')](_0x3d97fc,'name');_0xbc124f['query']=_[_0xbe8b('0x30')](_0x1e0feb[_0xbe8b('0x31')]);_0xbc124f[_0xbe8b('0x32')]=_[_0xbe8b('0x33')](_0xbc124f[_0xbe8b('0x2e')],_0xbc124f[_0xbe8b('0x31')]);_0x31500f[_0xbe8b('0x34')]=_[_0xbe8b('0x33')](_0xbc124f[_0xbe8b('0x2e')],qs[_0xbe8b('0x35')](_0x1e0feb[_0xbe8b('0x31')][_0xbe8b('0x35')]));_0x31500f['attributes']=_0x31500f[_0xbe8b('0x34')][_0xbe8b('0x36')]?_0x31500f['attributes']:_0xbc124f[_0xbe8b('0x2e')];if(!_0x1e0feb[_0xbe8b('0x31')][_0xbe8b('0x37')](_0xbe8b('0x38'))){_0x31500f['limit']=qs[_0xbe8b('0x1b')](_0x1e0feb['query'][_0xbe8b('0x1b')]);_0x31500f[_0xbe8b('0x1d')]=qs[_0xbe8b('0x1d')](_0x1e0feb[_0xbe8b('0x31')][_0xbe8b('0x1d')]);}_0x31500f[_0xbe8b('0x39')]=qs[_0xbe8b('0x3a')](_0x1e0feb[_0xbe8b('0x31')]['sort']);_0x31500f[_0xbe8b('0x3b')]=qs[_0xbe8b('0x32')](_[_0xbe8b('0x3c')](_0x1e0feb['query'],_0xbc124f[_0xbe8b('0x32')]),_0x3d97fc);if(_0x1e0feb[_0xbe8b('0x31')][_0xbe8b('0x3d')]){_0x31500f[_0xbe8b('0x3b')]=_[_0xbe8b('0x3e')](_0x31500f[_0xbe8b('0x3b')],{'$or':_[_0xbe8b('0x2f')](_0x3d97fc,function(_0x1f6f75){if(_0x1f6f75[_0xbe8b('0x2c')]!==_0xbe8b('0x3f')){var _0x37774f={};_0x37774f[_0x1f6f75['name']]={'$like':'%'+_0x1e0feb['query'][_0xbe8b('0x3d')]+'%'};return _0x37774f;}})});}_0x31500f=_[_0xbe8b('0x3e')]({},_0x31500f,_0x1e0feb['options']);var _0x12a1f2={'where':_0x31500f[_0xbe8b('0x3b')]};return db[_0xbe8b('0x29')][_0xbe8b('0x1c')](_0x12a1f2)[_0xbe8b('0x23')](function(_0x4c1cba){_0x3e1e0c[_0xbe8b('0x1c')]=_0x4c1cba;if(_0x1e0feb[_0xbe8b('0x31')]['includeAll']){_0x31500f[_0xbe8b('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x31500f);})['then'](function(_0x3e1c69){_0x3e1e0c['rows']=_0x3e1c69;return _0x3e1e0c;})[_0xbe8b('0x23')](respondWithFilteredResult(_0x20af86,_0x31500f))[_0xbe8b('0x41')](handleError(_0x20af86,null));};exports[_0xbe8b('0x42')]=function(_0x18294d,_0x1536a6){var _0xcadd76={'raw':!![],'where':{'id':_0x18294d[_0xbe8b('0x43')]['id']}},_0x48de93={};_0x48de93[_0xbe8b('0x2e')]=_[_0xbe8b('0x30')](db[_0xbe8b('0x29')][_0xbe8b('0x2a')]);_0x48de93[_0xbe8b('0x31')]=_[_0xbe8b('0x30')](_0x18294d[_0xbe8b('0x31')]);_0x48de93[_0xbe8b('0x32')]=_[_0xbe8b('0x33')](_0x48de93[_0xbe8b('0x2e')],_0x48de93['query']);_0xcadd76[_0xbe8b('0x34')]=_[_0xbe8b('0x33')](_0x48de93[_0xbe8b('0x2e')],qs[_0xbe8b('0x35')](_0x18294d[_0xbe8b('0x31')]['fields']));_0xcadd76['attributes']=_0xcadd76[_0xbe8b('0x34')][_0xbe8b('0x36')]?_0xcadd76[_0xbe8b('0x34')]:_0x48de93[_0xbe8b('0x2e')];if(_0x18294d['query'][_0xbe8b('0x44')]){_0xcadd76[_0xbe8b('0x40')]=[{'all':!![]}];}_0xcadd76=_[_0xbe8b('0x3e')]({},_0xcadd76,_0x18294d[_0xbe8b('0x45')]);return db[_0xbe8b('0x29')][_0xbe8b('0x46')](_0xcadd76)[_0xbe8b('0x23')](handleEntityNotFound(_0x1536a6,null))[_0xbe8b('0x23')](respondWithResult(_0x1536a6,null))[_0xbe8b('0x41')](handleError(_0x1536a6,null));};exports[_0xbe8b('0x47')]=function(_0x4d923a,_0x29be57){return db[_0xbe8b('0x29')][_0xbe8b('0x47')](_0x4d923a[_0xbe8b('0x48')],{})[_0xbe8b('0x23')](respondWithResult(_0x29be57,0xc9))[_0xbe8b('0x41')](handleError(_0x29be57,null));};exports[_0xbe8b('0x22')]=function(_0x5be31a,_0xf525e5){if(_0x5be31a[_0xbe8b('0x48')]['id']){delete _0x5be31a[_0xbe8b('0x48')]['id'];}return db[_0xbe8b('0x29')][_0xbe8b('0x46')]({'where':{'id':_0x5be31a[_0xbe8b('0x43')]['id']}})[_0xbe8b('0x23')](handleEntityNotFound(_0xf525e5,null))[_0xbe8b('0x23')](saveUpdates(_0x5be31a['body'],null))['then'](respondWithResult(_0xf525e5,null))[_0xbe8b('0x41')](handleError(_0xf525e5,null));};exports['destroy']=function(_0x1d4375,_0x333e3f){return db['SquareDetailsReport'][_0xbe8b('0x46')]({'where':{'id':_0x1d4375['params']['id']}})[_0xbe8b('0x23')](handleEntityNotFound(_0x333e3f,null))['then'](removeEntity(_0x333e3f,null))[_0xbe8b('0x41')](handleError(_0x333e3f,null));};exports[_0xbe8b('0x49')]=function(_0x4c192a,_0x16eba3){return db['SquareDetailsReport'][_0xbe8b('0x49')]()[_0xbe8b('0x23')](respondWithResult(_0x16eba3,null))[_0xbe8b('0x41')](handleError(_0x16eba3,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 71cf0d3..9bf8700 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 _0x3228=['exports','define','report_square_details','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0x3228,0x9f));var _0x8322=function(_0x4ced8e,_0x55d00e){_0x4ced8e=_0x4ced8e-0x0;var _0x41a988=_0x3228[_0x4ced8e];return _0x41a988;};'use strict';var _=require('lodash');var util=require(_0x8322('0x0'));var logger=require(_0x8322('0x1'))(_0x8322('0x2'));var moment=require(_0x8322('0x3'));var BPromise=require(_0x8322('0x4'));var rp=require(_0x8322('0x5'));var fs=require('fs');var path=require(_0x8322('0x6'));var rimraf=require(_0x8322('0x7'));var config=require(_0x8322('0x8'));var attributes=require(_0x8322('0x9'));module[_0x8322('0xa')]=function(_0x5e2991,_0x339610){return _0x5e2991[_0x8322('0xb')]('SquareDetailsReport',attributes,{'tableName':_0x8322('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3422=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','util','../../config/logger'];(function(_0x123251,_0x12da20){var _0x27deb3=function(_0x2b6a1f){while(--_0x2b6a1f){_0x123251['push'](_0x123251['shift']());}};_0x27deb3(++_0x12da20);}(_0x3422,0x1b6));var _0x2342=function(_0x907c3d,_0x1e8850){_0x907c3d=_0x907c3d-0x0;var _0x16684c=_0x3422[_0x907c3d];return _0x16684c;};'use strict';var _=require('lodash');var util=require(_0x2342('0x0'));var logger=require(_0x2342('0x1'))(_0x2342('0x2'));var moment=require(_0x2342('0x3'));var BPromise=require('bluebird');var rp=require(_0x2342('0x4'));var fs=require('fs');var path=require(_0x2342('0x5'));var rimraf=require(_0x2342('0x6'));var config=require(_0x2342('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0x2342('0x8')]=function(_0x1f4ee6,_0x321f85){return _0x1f4ee6[_0x2342('0x9')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 7afff80..2fc486e 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 _0x4bde=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','stringify','lodash','util'];(function(_0x4bf27a,_0x435cc2){var _0x22a0ba=function(_0x4b442e){while(--_0x4b442e){_0x4bf27a['push'](_0x4bf27a['shift']());}};_0x22a0ba(++_0x435cc2);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x3308fa,_0x1b7c4a){_0x3308fa=_0x3308fa-0x0;var _0x148fbc=_0x4bde[_0x3308fa];return _0x148fbc;};'use strict';var _=require(_0xe4bd('0x0'));var util=require(_0xe4bd('0x1'));var moment=require(_0xe4bd('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4bd('0x3'));var fs=require('fs');var Redis=require(_0xe4bd('0x4'));var db=require(_0xe4bd('0x5'))['db'];var utils=require(_0xe4bd('0x6'));var logger=require('../../config/logger')(_0xe4bd('0x7'));var config=require(_0xe4bd('0x8'));var jayson=require(_0xe4bd('0x9'));var client=jayson[_0xe4bd('0xa')][_0xe4bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4008eb,_0x4c933b,_0x2cf33d){return new BPromise(function(_0xbd04ce,_0x262295){return client[_0xe4bd('0xc')](_0x4008eb,_0x2cf33d)[_0xe4bd('0xd')](function(_0x3ef7e7){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x4c933b,'request\x20sent');logger[_0xe4bd('0xe')](_0xe4bd('0xf'),_0x4c933b,_0xe4bd('0x10'),JSON['stringify'](_0x3ef7e7));if(_0x3ef7e7[_0xe4bd('0x11')]){if(_0x3ef7e7[_0xe4bd('0x11')][_0xe4bd('0x12')]===0x1f4){logger[_0xe4bd('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x4c933b,_0x3ef7e7[_0xe4bd('0x11')]['message']);return _0x262295(_0x3ef7e7[_0xe4bd('0x11')]['message']);}logger[_0xe4bd('0x11')](_0xe4bd('0x13'),_0x4c933b,_0x3ef7e7[_0xe4bd('0x11')][_0xe4bd('0x14')]);return _0xbd04ce(_0x3ef7e7[_0xe4bd('0x11')][_0xe4bd('0x14')]);}else{logger[_0xe4bd('0x15')](_0xe4bd('0x13'),_0x4c933b,_0xe4bd('0x10'));_0xbd04ce(_0x3ef7e7[_0xe4bd('0x16')][_0xe4bd('0x14')]);}})[_0xe4bd('0x17')](function(_0x470cd1){logger['error'](_0xe4bd('0x13'),_0x4c933b,_0x470cd1);_0x262295(_0x470cd1);});});}exports[_0xe4bd('0x18')]=function(_0x5982f4){var _0x1731a1=this;return new Promise(function(_0x3dccd4,_0x544b3c){return db[_0xe4bd('0x19')]['create'](_0x5982f4['body'],{'raw':_0x5982f4[_0xe4bd('0x1a')]?_0x5982f4[_0xe4bd('0x1a')][_0xe4bd('0x1b')]===undefined?!![]:![]:!![]})[_0xe4bd('0xd')](function(_0x10a234){logger[_0xe4bd('0x15')](_0xe4bd('0x18'),_0x5982f4);logger['debug'](_0xe4bd('0x18'),_0x5982f4,JSON[_0xe4bd('0x1c')](_0x10a234));_0x3dccd4(_0x10a234);})['catch'](function(_0x2a5f40){logger[_0xe4bd('0x11')](_0xe4bd('0x18'),_0x2a5f40[_0xe4bd('0x14')],_0x5982f4);_0x544b3c(_0x1731a1[_0xe4bd('0x11')](0x1f4,_0x2a5f40[_0xe4bd('0x14')]));});});}; \ No newline at end of file +var _0x94d4=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','SquareDetailsReport,\x20%s,\x20%s','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','then','stringify','lodash','util','bluebird'];(function(_0x24ea54,_0x24acf6){var _0x188041=function(_0x24e0f3){while(--_0x24e0f3){_0x24ea54['push'](_0x24ea54['shift']());}};_0x188041(++_0x24acf6);}(_0x94d4,0xa5));var _0x494d=function(_0x26747e,_0x434240){_0x26747e=_0x26747e-0x0;var _0x39966a=_0x94d4[_0x26747e];return _0x39966a;};'use strict';var _=require(_0x494d('0x0'));var util=require(_0x494d('0x1'));var moment=require('moment');var BPromise=require(_0x494d('0x2'));var rs=require(_0x494d('0x3'));var fs=require('fs');var Redis=require(_0x494d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x494d('0x5'));var logger=require(_0x494d('0x6'))(_0x494d('0x7'));var config=require(_0x494d('0x8'));var jayson=require(_0x494d('0x9'));var client=jayson[_0x494d('0xa')][_0x494d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c53d7,_0x4f4576,_0x5269db){return new BPromise(function(_0x396280,_0x3f6b68){return client['request'](_0x4c53d7,_0x5269db)['then'](function(_0x456fe8){logger[_0x494d('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x4f4576,_0x494d('0xd'));logger[_0x494d('0xe')](_0x494d('0xf'),_0x4f4576,_0x494d('0xd'),JSON['stringify'](_0x456fe8));if(_0x456fe8[_0x494d('0x10')]){if(_0x456fe8[_0x494d('0x10')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4f4576,_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);return _0x3f6b68(_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);}logger[_0x494d('0x10')](_0x494d('0x12'),_0x4f4576,_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);return _0x396280(_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);}else{logger[_0x494d('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x4f4576,_0x494d('0xd'));_0x396280(_0x456fe8[_0x494d('0x13')][_0x494d('0x11')]);}})[_0x494d('0x14')](function(_0x120488){logger[_0x494d('0x10')](_0x494d('0x12'),_0x4f4576,_0x120488);_0x3f6b68(_0x120488);});});}exports[_0x494d('0x15')]=function(_0x4301fc){var _0x1552bb=this;return new Promise(function(_0x12a484,_0xd67ea4){return db[_0x494d('0x16')][_0x494d('0x17')](_0x4301fc[_0x494d('0x18')],{'raw':_0x4301fc[_0x494d('0x19')]?_0x4301fc[_0x494d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x494d('0x1a')](function(_0x172763){logger[_0x494d('0xc')](_0x494d('0x15'),_0x4301fc);logger['debug']('CreateSquareDetailsReport',_0x4301fc,JSON[_0x494d('0x1b')](_0x172763));_0x12a484(_0x172763);})[_0x494d('0x14')](function(_0x56e992){logger['error'](_0x494d('0x15'),_0x56e992['message'],_0x4301fc);_0xd67ea4(_0x1552bb[_0x494d('0x10')](0x1f4,_0x56e992['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 576d2bb..f6f4331 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 _0xb7ff=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports','express'];(function(_0x5e5b6c,_0x3cef7b){var _0x21ac4f=function(_0x3520e7){while(--_0x3520e7){_0x5e5b6c['push'](_0x5e5b6c['shift']());}};_0x21ac4f(++_0x3cef7b);}(_0xb7ff,0x1d7));var _0xfb7f=function(_0xd51ad,_0xb8a953){_0xd51ad=_0xd51ad-0x0;var _0x53c197=_0xb7ff[_0xd51ad];return _0x53c197;};'use strict';var express=require(_0xfb7f('0x0'));var router=express['Router']();var auth=require(_0xfb7f('0x1'));var controller=require(_0xfb7f('0x2'));router[_0xfb7f('0x3')]('/',auth[_0xfb7f('0x4')](),controller[_0xfb7f('0x5')]);router['get'](_0xfb7f('0x6'),auth['isAuthenticated'](),controller['killProcess']);module[_0xfb7f('0x7')]=router; \ No newline at end of file +var _0xa3df=['isAuthenticated','killProcess','exports','express','Router','../../components/auth/service','./system.controller','index','get'];(function(_0x2d1bf0,_0x29a52e){var _0x54e646=function(_0x5a85b4){while(--_0x5a85b4){_0x2d1bf0['push'](_0x2d1bf0['shift']());}};_0x54e646(++_0x29a52e);}(_0xa3df,0x1bc));var _0xfa3d=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa3df[_0x9df060];return _0x338dfe;};'use strict';var express=require(_0xfa3d('0x0'));var router=express[_0xfa3d('0x1')]();var auth=require(_0xfa3d('0x2'));var controller=require(_0xfa3d('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa3d('0x4')]);router[_0xfa3d('0x5')]('/process/:pid/kill',auth[_0xfa3d('0x6')](),controller[_0xfa3d('0x7')]);module[_0xfa3d('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index df8bffb..1432141 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 _0x300c=['systeminformation','exec','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x251ae7,_0xa8af83){var _0x38aed7=function(_0x1518c9){while(--_0x1518c9){_0x251ae7['push'](_0x251ae7['shift']());}};_0x38aed7(++_0xa8af83);}(_0x300c,0x1b0));var _0xc300=function(_0x543c3a,_0x239efb){_0x543c3a=_0x543c3a-0x0;var _0x19108e=_0x300c[_0x543c3a];return _0x19108e;};'use strict';var info=require(_0xc300('0x0'));var exec=require('child_process')[_0xc300('0x1')];var logger=require(_0xc300('0x2'))('api');var util=require(_0xc300('0x3'));var BPromise=require(_0xc300('0x4'));var _=require(_0xc300('0x5'));function handleError(_0x45babe,_0x4affd8,_0x31b899){_0x4affd8=_0x4affd8||0x1f4;return function(_0x48a44b){logger[_0xc300('0x6')](_0xc300('0x7'),_0x31b899,_0x4affd8,util[_0xc300('0x8')](_0x48a44b,{'showHidden':![],'depth':null}));delete _0x48a44b['name'];_0x45babe[_0xc300('0x9')](_0x4affd8)['send'](_0x48a44b);};}exports[_0xc300('0xa')]=function(_0x4cf368,_0x55e4f7){return info[_0xc300('0xb')]()[_0xc300('0xc')](function(_0x50c457){return _0x55e4f7[_0xc300('0x9')](0xc8)[_0xc300('0xd')](_0x50c457);})[_0xc300('0xe')](function(_0x3476ac){return _0x55e4f7['status'](0x1f4)[_0xc300('0xd')](_0x3476ac);});};exports[_0xc300('0xf')]=function(_0x4f52d8,_0x571ddd){var _0x3369c6=[_0xc300('0x10')];return new BPromise(function(_0x16b422,_0x2b1787){return exec(util[_0xc300('0x11')](_0xc300('0x12'),_0x4f52d8['params'][_0xc300('0x13')]),function(_0x1cf5d9,_0x3d0954,_0x3282f4){if(_0x1cf5d9){return _0x2b1787(_0x1cf5d9);}return _0x16b422(_0x3d0954);});})['then'](function(_0x4a41b3){var _0x8cad57=![];var _0x5e1dfe=_0x4a41b3[_0xc300('0x14')](/\n/);for(var _0x4fee30=0x0,_0x125e53=_0x3369c6[_0xc300('0x15')];_0x4fee30<_0x125e53,_0x8cad57===![];_0x4fee30+=0x1){if(_0x4a41b3[_0xc300('0x16')](_0x3369c6[_0x4fee30])>=0x0){_0x8cad57=!![];}}if(!_0x8cad57){throw new Error(util[_0xc300('0x11')](_0xc300('0x17'),_0x4f52d8['params']['pid']));}process['kill'](_0x4f52d8[_0xc300('0x18')][_0xc300('0x13')],_0xc300('0x19'));return _0x571ddd[_0xc300('0x9')](0xc8)['json']({'message':util[_0xc300('0x11')](_0xc300('0x1a'),_0x4f52d8[_0xc300('0x18')]['pid'])});})['catch'](handleError(_0x571ddd,null,_0xc300('0xf')));}; \ No newline at end of file +var _0x975a=['pid','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params'];(function(_0x36f4e8,_0x308a03){var _0x4e399d=function(_0x16a1cc){while(--_0x16a1cc){_0x36f4e8['push'](_0x36f4e8['shift']());}};_0x4e399d(++_0x308a03);}(_0x975a,0x78));var _0xa975=function(_0x3200c9,_0x49f422){_0x3200c9=_0x3200c9-0x0;var _0x562901=_0x975a[_0x3200c9];return _0x562901;};'use strict';var info=require('systeminformation');var exec=require(_0xa975('0x0'))[_0xa975('0x1')];var logger=require(_0xa975('0x2'))(_0xa975('0x3'));var util=require(_0xa975('0x4'));var BPromise=require(_0xa975('0x5'));var _=require(_0xa975('0x6'));function handleError(_0x48e638,_0x1bd592,_0xb5e147){_0x1bd592=_0x1bd592||0x1f4;return function(_0x56b647){logger['error'](_0xa975('0x7'),_0xb5e147,_0x1bd592,util[_0xa975('0x8')](_0x56b647,{'showHidden':![],'depth':null}));delete _0x56b647[_0xa975('0x9')];_0x48e638[_0xa975('0xa')](_0x1bd592)[_0xa975('0xb')](_0x56b647);};}exports[_0xa975('0xc')]=function(_0xc523e8,_0x252c0e){return info[_0xa975('0xd')]()[_0xa975('0xe')](function(_0x5ac411){return _0x252c0e[_0xa975('0xa')](0xc8)[_0xa975('0xf')](_0x5ac411);})['catch'](function(_0x59dc4b){return _0x252c0e[_0xa975('0xa')](0x1f4)[_0xa975('0xf')](_0x59dc4b);});};exports[_0xa975('0x10')]=function(_0x4be766,_0x1ea4ae){var _0x2aea7d=[_0xa975('0x11')];return new BPromise(function(_0x268c53,_0x2f3540){return exec(util['format'](_0xa975('0x12'),_0x4be766[_0xa975('0x13')][_0xa975('0x14')]),function(_0x3af97e,_0x2d1add,_0x499503){if(_0x3af97e){return _0x2f3540(_0x3af97e);}return _0x268c53(_0x2d1add);});})[_0xa975('0xe')](function(_0x2ae8c1){var _0x2839a9=![];var _0x45db1b=_0x2ae8c1['split'](/\n/);for(var _0x4caa64=0x0,_0x4b1ab0=_0x2aea7d[_0xa975('0x15')];_0x4caa64<_0x4b1ab0,_0x2839a9===![];_0x4caa64+=0x1){if(_0x2ae8c1[_0xa975('0x16')](_0x2aea7d[_0x4caa64])>=0x0){_0x2839a9=!![];}}if(!_0x2839a9){throw new Error(util[_0xa975('0x17')](_0xa975('0x18'),_0x4be766[_0xa975('0x13')][_0xa975('0x14')]));}process[_0xa975('0x19')](_0x4be766['params'][_0xa975('0x14')],_0xa975('0x1a'));return _0x1ea4ae[_0xa975('0xa')](0xc8)['json']({'message':util[_0xa975('0x17')](_0xa975('0x1b'),_0x4be766[_0xa975('0x13')][_0xa975('0x14')])});})['catch'](handleError(_0x1ea4ae,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 3a46b81..4e3cfca 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 _0xf3cd=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0x484994,_0x5e054c){var _0x273643=function(_0x5f0113){while(--_0x5f0113){_0x484994['push'](_0x484994['shift']());}};_0x273643(++_0x5e054c);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0xf3cd[_0x3da832];return _0xe602f2;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf3c('0x6'));var interaction=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var controller=require('./tag.controller');router[_0xdf3c('0x9')]('/',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0xb')]);router[_0xdf3c('0x9')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller['describe']);router[_0xdf3c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0xe')]('/',auth['isAuthenticated'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x10')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x12')]);router[_0xdf3c('0x13')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller['destroy']);module[_0xdf3c('0x14')]=router; \ No newline at end of file +var _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17ba,0xab));var _0xa17b=function(_0x115768,_0x119e1f){_0x115768=_0x115768-0x0;var _0x133998=_0x17ba[_0x115768];return _0x133998;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9ff4281..c3be9c8 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['STRING','sequelize','exports','#0091EA'];(function(_0x5259f7,_0xdcdc61){var _0x11e597=function(_0x390f89){while(--_0x390f89){_0x5259f7['push'](_0x5259f7['shift']());}};_0x11e597(++_0xdcdc61);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x2')},'description':{'type':Sequelize[_0x0d8b('0x3')]}}; \ No newline at end of file +var _0x7269=['STRING','#0091EA','sequelize','exports'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0x7269,0x76));var _0x9726=function(_0x4cb647,_0x3078a7){_0x4cb647=_0x4cb647-0x0;var _0x2c33b9=_0x7269[_0x4cb647];return _0x2c33b9;};'use strict';var Sequelize=require(_0x9726('0x0'));module[_0x9726('0x1')]={'name':{'type':Sequelize[_0x9726('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x9726('0x3')},'description':{'type':Sequelize[_0x9726('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 000c17f..7b2aeac 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 _0xd9e5=['length','includeAll','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','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','params','keys','fields'];(function(_0x5d880e,_0x52fb62){var _0x2dc29d=function(_0x31c082){while(--_0x31c082){_0x5d880e['push'](_0x5d880e['shift']());}};_0x2dc29d(++_0x52fb62);}(_0xd9e5,0x19d));var _0x5d9e=function(_0x19f978,_0x413fe1){_0x19f978=_0x19f978-0x0;var _0x531180=_0xd9e5[_0x19f978];return _0x531180;};'use strict';var emlformat=require(_0x5d9e('0x0'));var rimraf=require(_0x5d9e('0x1'));var zipdir=require(_0x5d9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d9e('0x3'));var moment=require(_0x5d9e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5d9e('0x5'));var util=require(_0x5d9e('0x6'));var path=require(_0x5d9e('0x7'));var sox=require(_0x5d9e('0x8'));var csv=require('to-csv');var ejs=require(_0x5d9e('0x9'));var fs=require('fs');var fs_extra=require(_0x5d9e('0xa'));var _=require('lodash');var squel=require(_0x5d9e('0xb'));var crypto=require('crypto');var jsforce=require(_0x5d9e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5d9e('0xd'));var Redis=require(_0x5d9e('0xe'));var authService=require(_0x5d9e('0xf'));var qs=require(_0x5d9e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d9e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5d9e('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x68a111,_0x10ec7c){_0x10ec7c=_0x10ec7c||0xcc;return function(_0x44c74a){if(_0x44c74a){return _0x68a111[_0x5d9e('0x13')](_0x10ec7c);}return _0x68a111[_0x5d9e('0x14')](_0x10ec7c)['end']();};}function respondWithResult(_0x5962ef,_0x247be3){_0x247be3=_0x247be3||0xc8;return function(_0x322e58){if(_0x322e58){return _0x5962ef[_0x5d9e('0x14')](_0x247be3)['json'](_0x322e58);}};}function respondWithFilteredResult(_0x82ad55,_0x501960){return function(_0x1c99ef){if(_0x1c99ef){var _0x54436a=typeof _0x501960[_0x5d9e('0x15')]===_0x5d9e('0x16')&&typeof _0x501960[_0x5d9e('0x17')]===_0x5d9e('0x16');var _0x1ce5a9=_0x1c99ef['count'];var _0x11bb96=_0x54436a?0x0:_0x501960['offset'];var _0x303f07=_0x54436a?_0x1c99ef[_0x5d9e('0x18')]:_0x501960[_0x5d9e('0x15')]+_0x501960['limit'];var _0x69d066;if(_0x303f07>=_0x1ce5a9){_0x303f07=_0x1ce5a9;_0x69d066=0xc8;}else{_0x69d066=0xce;}_0x82ad55['status'](_0x69d066);return _0x82ad55[_0x5d9e('0x19')]('Content-Range',_0x11bb96+'-'+_0x303f07+'/'+_0x1ce5a9)['json'](_0x1c99ef);}return null;};}function patchUpdates(_0x219e29){return function(_0x337dd6){try{jsonpatch[_0x5d9e('0x1a')](_0x337dd6,_0x219e29,!![]);}catch(_0x1cfe2a){return BPromise[_0x5d9e('0x1b')](_0x1cfe2a);}return _0x337dd6[_0x5d9e('0x1c')]();};}function saveUpdates(_0x506c44,_0x465b1a){return function(_0x5b1320){if(_0x5b1320){return _0x5b1320[_0x5d9e('0x1d')](_0x506c44)[_0x5d9e('0x1e')](function(_0x65f1b){return _0x65f1b;});}return null;};}function removeEntity(_0x1cfa5b,_0x508cac){return function(_0x8c602c){if(_0x8c602c){return _0x8c602c[_0x5d9e('0x1f')]()[_0x5d9e('0x1e')](function(){var _0x39a741=_0x8c602c[_0x5d9e('0x20')]({'plain':!![]});var _0x1ffcfb=_0x5d9e('0x21');return db[_0x5d9e('0x22')][_0x5d9e('0x1f')]({'where':{'type':_0x1ffcfb,'resourceId':_0x39a741['id']}})[_0x5d9e('0x1e')](function(){return _0x8c602c;});})[_0x5d9e('0x1e')](function(){_0x1cfa5b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23c9ad,_0x364cda){return function(_0x3fd601){if(!_0x3fd601){_0x23c9ad[_0x5d9e('0x13')](0x194);}return _0x3fd601;};}function handleError(_0x4789e8,_0x210eb0){_0x210eb0=_0x210eb0||0x1f4;return function(_0x111531){logger[_0x5d9e('0x23')](_0x111531[_0x5d9e('0x24')]);if(_0x111531[_0x5d9e('0x25')]){delete _0x111531[_0x5d9e('0x25')];}_0x4789e8[_0x5d9e('0x14')](_0x210eb0)[_0x5d9e('0x26')](_0x111531);};}exports[_0x5d9e('0x27')]=function(_0x4dd55c,_0x590396){var _0x1c4ee1={},_0x517262={},_0x237924={'count':0x0,'rows':[]};var _0x521bf4=_[_0x5d9e('0x28')](db[_0x5d9e('0x29')][_0x5d9e('0x2a')],function(_0x2e9e9a){return{'name':_0x2e9e9a[_0x5d9e('0x2b')],'type':_0x2e9e9a[_0x5d9e('0x2c')][_0x5d9e('0x2d')]};});_0x517262[_0x5d9e('0x2e')]=_[_0x5d9e('0x28')](_0x521bf4,_0x5d9e('0x25'));_0x517262[_0x5d9e('0x2f')]=_['keys'](_0x4dd55c['query']);_0x517262[_0x5d9e('0x30')]=_[_0x5d9e('0x31')](_0x517262[_0x5d9e('0x2e')],_0x517262[_0x5d9e('0x2f')]);_0x1c4ee1[_0x5d9e('0x32')]=_[_0x5d9e('0x31')](_0x517262[_0x5d9e('0x2e')],qs['fields'](_0x4dd55c[_0x5d9e('0x2f')]['fields']));_0x1c4ee1[_0x5d9e('0x32')]=_0x1c4ee1['attributes']['length']?_0x1c4ee1[_0x5d9e('0x32')]:_0x517262['model'];if(!_0x4dd55c[_0x5d9e('0x2f')][_0x5d9e('0x33')]('nolimit')){_0x1c4ee1[_0x5d9e('0x17')]=qs['limit'](_0x4dd55c[_0x5d9e('0x2f')][_0x5d9e('0x17')]);_0x1c4ee1[_0x5d9e('0x15')]=qs[_0x5d9e('0x15')](_0x4dd55c[_0x5d9e('0x2f')]['offset']);}_0x1c4ee1[_0x5d9e('0x34')]=qs[_0x5d9e('0x35')](_0x4dd55c['query']['sort']);_0x1c4ee1['where']=qs[_0x5d9e('0x30')](_[_0x5d9e('0x36')](_0x4dd55c[_0x5d9e('0x2f')],_0x517262[_0x5d9e('0x30')]),_0x521bf4);if(_0x4dd55c[_0x5d9e('0x2f')][_0x5d9e('0x37')]){_0x1c4ee1['where']=_[_0x5d9e('0x38')](_0x1c4ee1[_0x5d9e('0x39')],{'$or':_[_0x5d9e('0x28')](_0x521bf4,function(_0x21797c){if(_0x21797c['type']!==_0x5d9e('0x3a')){var _0x29869d={};_0x29869d[_0x21797c[_0x5d9e('0x25')]]={'$like':'%'+_0x4dd55c[_0x5d9e('0x2f')][_0x5d9e('0x37')]+'%'};return _0x29869d;}})});}_0x1c4ee1=_[_0x5d9e('0x38')]({},_0x1c4ee1,_0x4dd55c[_0x5d9e('0x3b')]);var _0x4bc318={'where':_0x1c4ee1[_0x5d9e('0x39')]};return db[_0x5d9e('0x29')][_0x5d9e('0x18')](_0x4bc318)[_0x5d9e('0x1e')](function(_0x5705c1){_0x237924[_0x5d9e('0x18')]=_0x5705c1;if(_0x4dd55c[_0x5d9e('0x2f')]['includeAll']){_0x1c4ee1[_0x5d9e('0x3c')]=[{'all':!![]}];}return db[_0x5d9e('0x29')][_0x5d9e('0x3d')](_0x1c4ee1);})['then'](function(_0x3b47a0){_0x237924[_0x5d9e('0x3e')]=_0x3b47a0;return _0x237924;})[_0x5d9e('0x1e')](respondWithFilteredResult(_0x590396,_0x1c4ee1))[_0x5d9e('0x3f')](handleError(_0x590396,null));};exports['show']=function(_0x322a55,_0x42b2bd){var _0x55d233={'raw':!![],'where':{'id':_0x322a55[_0x5d9e('0x40')]['id']}},_0x1dfdbb={};_0x1dfdbb[_0x5d9e('0x2e')]=_[_0x5d9e('0x41')](db[_0x5d9e('0x29')][_0x5d9e('0x2a')]);_0x1dfdbb['query']=_[_0x5d9e('0x41')](_0x322a55['query']);_0x1dfdbb[_0x5d9e('0x30')]=_['intersection'](_0x1dfdbb[_0x5d9e('0x2e')],_0x1dfdbb[_0x5d9e('0x2f')]);_0x55d233[_0x5d9e('0x32')]=_[_0x5d9e('0x31')](_0x1dfdbb['model'],qs[_0x5d9e('0x42')](_0x322a55[_0x5d9e('0x2f')][_0x5d9e('0x42')]));_0x55d233[_0x5d9e('0x32')]=_0x55d233[_0x5d9e('0x32')][_0x5d9e('0x43')]?_0x55d233[_0x5d9e('0x32')]:_0x1dfdbb['model'];if(_0x322a55['query'][_0x5d9e('0x44')]){_0x55d233[_0x5d9e('0x3c')]=[{'all':!![]}];}_0x55d233=_[_0x5d9e('0x38')]({},_0x55d233,_0x322a55['options']);return db['Tag'][_0x5d9e('0x45')](_0x55d233)['then'](handleEntityNotFound(_0x42b2bd,null))[_0x5d9e('0x1e')](respondWithResult(_0x42b2bd,null))['catch'](handleError(_0x42b2bd,null));};exports[_0x5d9e('0x46')]=function(_0x104cbd,_0x186af1){return db[_0x5d9e('0x29')][_0x5d9e('0x46')](_0x104cbd[_0x5d9e('0x47')],{})[_0x5d9e('0x1e')](function(_0x5e8092){var _0x16bada=_0x104cbd[_0x5d9e('0x48')][_0x5d9e('0x20')]({'plain':!![]});if(!_0x16bada)throw new Error(_0x5d9e('0x49'));if(_0x16bada[_0x5d9e('0x4a')]===_0x5d9e('0x48')){var _0x349ce4=_0x5e8092['get']({'plain':!![]});var _0x2f423b='Tags';return db[_0x5d9e('0x4b')]['find']({'where':{'name':_0x2f423b,'userProfileId':_0x16bada[_0x5d9e('0x4c')]},'raw':!![]})[_0x5d9e('0x1e')](function(_0x3f6ad8){if(_0x3f6ad8&&_0x3f6ad8[_0x5d9e('0x4d')]===0x0){return db[_0x5d9e('0x22')][_0x5d9e('0x46')]({'name':_0x349ce4[_0x5d9e('0x25')],'resourceId':_0x349ce4['id'],'type':_0x3f6ad8['name'],'sectionId':_0x3f6ad8['id']},{})[_0x5d9e('0x1e')](function(){return _0x5e8092;});}else{return _0x5e8092;}})[_0x5d9e('0x3f')](function(_0x28f188){logger['error'](_0x5d9e('0x4e'),_0x28f188);throw _0x28f188;});}return _0x5e8092;})[_0x5d9e('0x1e')](respondWithResult(_0x186af1,0xc9))[_0x5d9e('0x3f')](handleError(_0x186af1,null));};exports[_0x5d9e('0x1d')]=function(_0x3fbd98,_0xed3262){if(_0x3fbd98[_0x5d9e('0x47')]['id']){delete _0x3fbd98[_0x5d9e('0x47')]['id'];}return db[_0x5d9e('0x29')][_0x5d9e('0x45')]({'where':{'id':_0x3fbd98[_0x5d9e('0x40')]['id']}})[_0x5d9e('0x1e')](handleEntityNotFound(_0xed3262,null))[_0x5d9e('0x1e')](saveUpdates(_0x3fbd98[_0x5d9e('0x47')],null))['then'](respondWithResult(_0xed3262,null))[_0x5d9e('0x3f')](handleError(_0xed3262,null));};exports[_0x5d9e('0x1f')]=function(_0x2d8de5,_0x29a402){return db['Tag'][_0x5d9e('0x45')]({'where':{'id':_0x2d8de5[_0x5d9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x29a402,null))['then'](removeEntity(_0x29a402,null))['catch'](handleError(_0x29a402,null));};exports[_0x5d9e('0x4f')]=function(_0x3e563b,_0x32d8bf){return db[_0x5d9e('0x29')][_0x5d9e('0x4f')]()[_0x5d9e('0x1e')](respondWithResult(_0x32d8bf,null))[_0x5d9e('0x3f')](handleError(_0x32d8bf,null));}; \ No newline at end of file +var _0x8f53=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','get','UserProfileResource','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','eml-format','rimraf','zip-dir','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x14a9a4,_0x43c5f6){var _0x192d88=function(_0x353a93){while(--_0x353a93){_0x14a9a4['push'](_0x14a9a4['shift']());}};_0x192d88(++_0x43c5f6);}(_0x8f53,0x128));var _0x38f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f53[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x38f5('0x0'));var rimraf=require(_0x38f5('0x1'));var zipdir=require(_0x38f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x38f5('0x3'));var BPromise=require(_0x38f5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x38f5('0x5'));var csv=require(_0x38f5('0x6'));var ejs=require(_0x38f5('0x7'));var fs=require('fs');var fs_extra=require(_0x38f5('0x8'));var _=require(_0x38f5('0x9'));var squel=require(_0x38f5('0xa'));var crypto=require(_0x38f5('0xb'));var jsforce=require(_0x38f5('0xc'));var deskjs=require(_0x38f5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x38f5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x38f5('0xf'));var qs=require(_0x38f5('0x10'));var as=require(_0x38f5('0x11'));var hardwareService=require(_0x38f5('0x12'));var logger=require(_0x38f5('0x13'))(_0x38f5('0x14'));var utils=require('../../config/utils');var config=require(_0x38f5('0x15'));var licenseUtil=require(_0x38f5('0x16'));var db=require(_0x38f5('0x17'))['db'];function respondWithStatusCode(_0x4b9404,_0x1e9878){_0x1e9878=_0x1e9878||0xcc;return function(_0x21abed){if(_0x21abed){return _0x4b9404[_0x38f5('0x18')](_0x1e9878);}return _0x4b9404[_0x38f5('0x19')](_0x1e9878)['end']();};}function respondWithResult(_0x1b400f,_0x473006){_0x473006=_0x473006||0xc8;return function(_0x5d18d0){if(_0x5d18d0){return _0x1b400f[_0x38f5('0x19')](_0x473006)['json'](_0x5d18d0);}};}function respondWithFilteredResult(_0x5d1396,_0x549c28){return function(_0x53facd){if(_0x53facd){var _0x13fd23=typeof _0x549c28[_0x38f5('0x1a')]===_0x38f5('0x1b')&&typeof _0x549c28[_0x38f5('0x1c')]===_0x38f5('0x1b');var _0x6e2b67=_0x53facd[_0x38f5('0x1d')];var _0xf707f=_0x13fd23?0x0:_0x549c28[_0x38f5('0x1a')];var _0x5a6447=_0x13fd23?_0x53facd[_0x38f5('0x1d')]:_0x549c28['offset']+_0x549c28[_0x38f5('0x1c')];var _0x5dc1df;if(_0x5a6447>=_0x6e2b67){_0x5a6447=_0x6e2b67;_0x5dc1df=0xc8;}else{_0x5dc1df=0xce;}_0x5d1396[_0x38f5('0x19')](_0x5dc1df);return _0x5d1396[_0x38f5('0x1e')](_0x38f5('0x1f'),_0xf707f+'-'+_0x5a6447+'/'+_0x6e2b67)[_0x38f5('0x20')](_0x53facd);}return null;};}function patchUpdates(_0x4c29cd){return function(_0x187273){try{jsonpatch[_0x38f5('0x21')](_0x187273,_0x4c29cd,!![]);}catch(_0x1d70b0){return BPromise['reject'](_0x1d70b0);}return _0x187273['save']();};}function saveUpdates(_0x18d6af,_0x7b0a3d){return function(_0x1df39d){if(_0x1df39d){return _0x1df39d['update'](_0x18d6af)[_0x38f5('0x22')](function(_0x2e3e98){return _0x2e3e98;});}return null;};}function removeEntity(_0x29811b,_0x5f08a3){return function(_0x5c5b01){if(_0x5c5b01){return _0x5c5b01[_0x38f5('0x23')]()[_0x38f5('0x22')](function(){var _0x1eb378=_0x5c5b01[_0x38f5('0x24')]({'plain':!![]});var _0x455168='Tags';return db[_0x38f5('0x25')][_0x38f5('0x23')]({'where':{'type':_0x455168,'resourceId':_0x1eb378['id']}})[_0x38f5('0x22')](function(){return _0x5c5b01;});})[_0x38f5('0x22')](function(){_0x29811b[_0x38f5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3610f3,_0x38e271){return function(_0x88a08e){if(!_0x88a08e){_0x3610f3[_0x38f5('0x18')](0x194);}return _0x88a08e;};}function handleError(_0x366e48,_0x260d00){_0x260d00=_0x260d00||0x1f4;return function(_0xc96ef7){logger[_0x38f5('0x26')](_0xc96ef7[_0x38f5('0x27')]);if(_0xc96ef7[_0x38f5('0x28')]){delete _0xc96ef7[_0x38f5('0x28')];}_0x366e48[_0x38f5('0x19')](_0x260d00)[_0x38f5('0x29')](_0xc96ef7);};}exports['index']=function(_0x37fd03,_0x341e30){var _0x2bdc4c={},_0x5895ab={},_0x3f8841={'count':0x0,'rows':[]};var _0x18cbfa=_[_0x38f5('0x2a')](db[_0x38f5('0x2b')][_0x38f5('0x2c')],function(_0x469e95){return{'name':_0x469e95[_0x38f5('0x2d')],'type':_0x469e95[_0x38f5('0x2e')]['key']};});_0x5895ab[_0x38f5('0x2f')]=_[_0x38f5('0x2a')](_0x18cbfa,_0x38f5('0x28'));_0x5895ab['query']=_[_0x38f5('0x30')](_0x37fd03[_0x38f5('0x31')]);_0x5895ab['filters']=_[_0x38f5('0x32')](_0x5895ab[_0x38f5('0x2f')],_0x5895ab[_0x38f5('0x31')]);_0x2bdc4c[_0x38f5('0x33')]=_[_0x38f5('0x32')](_0x5895ab[_0x38f5('0x2f')],qs[_0x38f5('0x34')](_0x37fd03[_0x38f5('0x31')][_0x38f5('0x34')]));_0x2bdc4c['attributes']=_0x2bdc4c['attributes'][_0x38f5('0x35')]?_0x2bdc4c[_0x38f5('0x33')]:_0x5895ab[_0x38f5('0x2f')];if(!_0x37fd03[_0x38f5('0x31')]['hasOwnProperty']('nolimit')){_0x2bdc4c['limit']=qs[_0x38f5('0x1c')](_0x37fd03['query']['limit']);_0x2bdc4c[_0x38f5('0x1a')]=qs[_0x38f5('0x1a')](_0x37fd03[_0x38f5('0x31')]['offset']);}_0x2bdc4c[_0x38f5('0x36')]=qs[_0x38f5('0x37')](_0x37fd03[_0x38f5('0x31')][_0x38f5('0x37')]);_0x2bdc4c[_0x38f5('0x38')]=qs['filters'](_['pick'](_0x37fd03[_0x38f5('0x31')],_0x5895ab[_0x38f5('0x39')]),_0x18cbfa);if(_0x37fd03['query'][_0x38f5('0x3a')]){_0x2bdc4c[_0x38f5('0x38')]=_[_0x38f5('0x3b')](_0x2bdc4c[_0x38f5('0x38')],{'$or':_[_0x38f5('0x2a')](_0x18cbfa,function(_0x3e2382){if(_0x3e2382['type']!=='VIRTUAL'){var _0x11a956={};_0x11a956[_0x3e2382[_0x38f5('0x28')]]={'$like':'%'+_0x37fd03[_0x38f5('0x31')]['filter']+'%'};return _0x11a956;}})});}_0x2bdc4c=_[_0x38f5('0x3b')]({},_0x2bdc4c,_0x37fd03[_0x38f5('0x3c')]);var _0x5711ed={'where':_0x2bdc4c['where']};return db[_0x38f5('0x2b')][_0x38f5('0x1d')](_0x5711ed)[_0x38f5('0x22')](function(_0xedc34e){_0x3f8841[_0x38f5('0x1d')]=_0xedc34e;if(_0x37fd03[_0x38f5('0x31')][_0x38f5('0x3d')]){_0x2bdc4c[_0x38f5('0x3e')]=[{'all':!![]}];}return db[_0x38f5('0x2b')][_0x38f5('0x3f')](_0x2bdc4c);})[_0x38f5('0x22')](function(_0x40a94c){_0x3f8841[_0x38f5('0x40')]=_0x40a94c;return _0x3f8841;})[_0x38f5('0x22')](respondWithFilteredResult(_0x341e30,_0x2bdc4c))[_0x38f5('0x41')](handleError(_0x341e30,null));};exports[_0x38f5('0x42')]=function(_0x5546aa,_0x1e7653){var _0x118daf={'raw':!![],'where':{'id':_0x5546aa[_0x38f5('0x43')]['id']}},_0x1a5775={};_0x1a5775[_0x38f5('0x2f')]=_[_0x38f5('0x30')](db[_0x38f5('0x2b')][_0x38f5('0x2c')]);_0x1a5775[_0x38f5('0x31')]=_[_0x38f5('0x30')](_0x5546aa[_0x38f5('0x31')]);_0x1a5775['filters']=_[_0x38f5('0x32')](_0x1a5775[_0x38f5('0x2f')],_0x1a5775[_0x38f5('0x31')]);_0x118daf[_0x38f5('0x33')]=_[_0x38f5('0x32')](_0x1a5775[_0x38f5('0x2f')],qs[_0x38f5('0x34')](_0x5546aa[_0x38f5('0x31')][_0x38f5('0x34')]));_0x118daf[_0x38f5('0x33')]=_0x118daf[_0x38f5('0x33')]['length']?_0x118daf[_0x38f5('0x33')]:_0x1a5775[_0x38f5('0x2f')];if(_0x5546aa[_0x38f5('0x31')][_0x38f5('0x3d')]){_0x118daf[_0x38f5('0x3e')]=[{'all':!![]}];}_0x118daf=_['merge']({},_0x118daf,_0x5546aa[_0x38f5('0x3c')]);return db[_0x38f5('0x2b')]['find'](_0x118daf)['then'](handleEntityNotFound(_0x1e7653,null))[_0x38f5('0x22')](respondWithResult(_0x1e7653,null))[_0x38f5('0x41')](handleError(_0x1e7653,null));};exports[_0x38f5('0x44')]=function(_0x3dd7a6,_0x1a5b1b){return db[_0x38f5('0x2b')][_0x38f5('0x44')](_0x3dd7a6[_0x38f5('0x45')],{})['then'](function(_0x5b61a7){var _0x42a89f=_0x3dd7a6[_0x38f5('0x46')][_0x38f5('0x24')]({'plain':!![]});if(!_0x42a89f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42a89f['role']===_0x38f5('0x46')){var _0x6c6ae7=_0x5b61a7[_0x38f5('0x24')]({'plain':!![]});var _0x2132e2='Tags';return db[_0x38f5('0x47')][_0x38f5('0x48')]({'where':{'name':_0x2132e2,'userProfileId':_0x42a89f[_0x38f5('0x49')]},'raw':!![]})[_0x38f5('0x22')](function(_0x12b626){if(_0x12b626&&_0x12b626[_0x38f5('0x4a')]===0x0){return db['UserProfileResource'][_0x38f5('0x44')]({'name':_0x6c6ae7['name'],'resourceId':_0x6c6ae7['id'],'type':_0x12b626[_0x38f5('0x28')],'sectionId':_0x12b626['id']},{})[_0x38f5('0x22')](function(){return _0x5b61a7;});}else{return _0x5b61a7;}})[_0x38f5('0x41')](function(_0x48a86c){logger[_0x38f5('0x26')](_0x38f5('0x4b'),_0x48a86c);throw _0x48a86c;});}return _0x5b61a7;})[_0x38f5('0x22')](respondWithResult(_0x1a5b1b,0xc9))['catch'](handleError(_0x1a5b1b,null));};exports[_0x38f5('0x4c')]=function(_0x564f97,_0x35ecde){if(_0x564f97[_0x38f5('0x45')]['id']){delete _0x564f97[_0x38f5('0x45')]['id'];}return db['Tag'][_0x38f5('0x48')]({'where':{'id':_0x564f97[_0x38f5('0x43')]['id']}})['then'](handleEntityNotFound(_0x35ecde,null))[_0x38f5('0x22')](saveUpdates(_0x564f97[_0x38f5('0x45')],null))[_0x38f5('0x22')](respondWithResult(_0x35ecde,null))['catch'](handleError(_0x35ecde,null));};exports[_0x38f5('0x23')]=function(_0x11756d,_0x2d65be){return db[_0x38f5('0x2b')]['find']({'where':{'id':_0x11756d[_0x38f5('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d65be,null))[_0x38f5('0x22')](removeEntity(_0x2d65be,null))[_0x38f5('0x41')](handleError(_0x2d65be,null));};exports[_0x38f5('0x4d')]=function(_0x1a92bf,_0x51a922){return db['Tag'][_0x38f5('0x4d')]()[_0x38f5('0x22')](respondWithResult(_0x51a922,null))[_0x38f5('0x41')](handleError(_0x51a922,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 7f6d649..4012f9d 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 _0x1781=['exports','define','Tag','tools_tags','util','api','moment','bluebird','path','rimraf','./tag.attributes'];(function(_0x50939f,_0xf70ad4){var _0x425425=function(_0x59a853){while(--_0x59a853){_0x50939f['push'](_0x50939f['shift']());}};_0x425425(++_0xf70ad4);}(_0x1781,0x67));var _0x1178=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1781[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x1178('0x0'));var logger=require('../../config/logger')(_0x1178('0x1'));var moment=require(_0x1178('0x2'));var BPromise=require(_0x1178('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1178('0x4'));var rimraf=require(_0x1178('0x5'));var config=require('../../config/environment');var attributes=require(_0x1178('0x6'));module[_0x1178('0x7')]=function(_0x96aa80,_0x1d76a8){return _0x96aa80[_0x1178('0x8')](_0x1178('0x9'),attributes,{'tableName':_0x1178('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10db=['../../config/environment','./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10db,0x6d));var _0xb10d=function(_0x1cadf9,_0x1cfe93){_0x1cadf9=_0x1cadf9-0x0;var _0x3f230b=_0x10db[_0x1cadf9];return _0x3f230b;};'use strict';var _=require(_0xb10d('0x0'));var util=require(_0xb10d('0x1'));var logger=require(_0xb10d('0x2'))(_0xb10d('0x3'));var moment=require(_0xb10d('0x4'));var BPromise=require(_0xb10d('0x5'));var rp=require(_0xb10d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb10d('0x7'));var config=require(_0xb10d('0x8'));var attributes=require(_0xb10d('0x9'));module[_0xb10d('0xa')]=function(_0x3f1739,_0x3549f7){return _0x3f1739[_0xb10d('0xb')]('Tag',attributes,{'tableName':_0xb10d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index df35d35..70a7d44 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ab390,_0x47966e){var _0x2dd153=function(_0x2a4c8b){while(--_0x2a4c8b){_0x4ab390['push'](_0x4ab390['shift']());}};_0x2dd153(++_0x47966e);}(_0xa41a,0x6b));var _0xaa41=function(_0x32ebf8,_0x257eda){_0x32ebf8=_0x32ebf8-0x0;var _0x3942bd=_0xa41a[_0x32ebf8];return _0x3942bd;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x99e9,0xb4));var _0x999e=function(_0x57db49,_0x288094){_0x57db49=_0x57db49-0x0;var _0xd0636f=_0x99e9[_0x57db49];return _0xd0636f;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('Tag,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 03fb73f..ce2dbd6 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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 4035eab..3a4479e 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 _0x2032=['name','exports','STRING'];(function(_0x59556c,_0x133924){var _0x140a77=function(_0x258658){while(--_0x258658){_0x59556c['push'](_0x59556c['shift']());}};_0x140a77(++_0x133924);}(_0x2032,0xd9));var _0x2203=function(_0x5cbb1b,_0x3174ae){_0x5cbb1b=_0x5cbb1b-0x0;var _0x33c24=_0x2032[_0x5cbb1b];return _0x33c24;};'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 +var _0xb7e7=['STRING','sequelize'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xb7e7[_0x1b828b];return _0x98da1a;};'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/team/team.controller.js b/server/api/team/team.controller.js index 1d97402..0b532ef 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 _0xaee0=['User','Queue','emit','Queue:save','findAll','voicePause','upsert','interface','SIP/%s','all','TeamVoicePrefix','spread','removeAgents','Whatsapp','UserVoiceQueueRt','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','sendStatus','error','stack','name','map','Team','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','catch','show','params','length','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','send','getQueues','findOne','channel','ValidationError','capitalize','toLowerCase','Queues','isValidChannel','add','removeQueues','Unknown\x20channel','ids','addAgents','isArray','Voice','Chat','Mail','Sms','transaction','through','penalty','QueueId','TeamVoiceQueue'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0xaee0,0x1db));var _0x0aee=function(_0x187499,_0x5e416a){_0x187499=_0x187499-0x0;var _0x2965fe=_0xaee0[_0x187499];return _0x2965fe;};'use strict';var emlformat=require(_0x0aee('0x0'));var rimraf=require(_0x0aee('0x1'));var zipdir=require(_0x0aee('0x2'));var jsonpatch=require(_0x0aee('0x3'));var rp=require(_0x0aee('0x4'));var moment=require(_0x0aee('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0aee('0x6'));var util=require('util');var path=require(_0x0aee('0x7'));var sox=require(_0x0aee('0x8'));var csv=require('to-csv');var ejs=require(_0x0aee('0x9'));var fs=require('fs');var fs_extra=require(_0x0aee('0xa'));var _=require(_0x0aee('0xb'));var squel=require(_0x0aee('0xc'));var crypto=require(_0x0aee('0xd'));var jsforce=require(_0x0aee('0xe'));var deskjs=require(_0x0aee('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0aee('0x10'));var Papa=require(_0x0aee('0x11'));var Redis=require(_0x0aee('0x12'));var authService=require(_0x0aee('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0aee('0x14'));var hardwareService=require(_0x0aee('0x15'));var logger=require(_0x0aee('0x16'))(_0x0aee('0x17'));var utils=require('../../config/utils');var config=require(_0x0aee('0x18'));var licenseUtil=require(_0x0aee('0x19'));var db=require(_0x0aee('0x1a'))['db'];config['redis']=_[_0x0aee('0x1b')](config[_0x0aee('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x0aee('0x1d'))(new Redis(config['redis']));require('./team.socket')[_0x0aee('0x1e')](socket);function respondWithStatusCode(_0x4e16de,_0x2bd60d){_0x2bd60d=_0x2bd60d||0xcc;return function(_0x3df991){if(_0x3df991){return _0x4e16de['sendStatus'](_0x2bd60d);}return _0x4e16de[_0x0aee('0x1f')](_0x2bd60d)[_0x0aee('0x20')]();};}function respondWithResult(_0x2418db,_0x536062){_0x536062=_0x536062||0xc8;return function(_0x312784){if(_0x312784){return _0x2418db[_0x0aee('0x1f')](_0x536062)[_0x0aee('0x21')](_0x312784);}};}function respondWithFilteredResult(_0x553ed3,_0x498005){return function(_0x26a640){if(_0x26a640){var _0x19bf37=typeof _0x498005[_0x0aee('0x22')]===_0x0aee('0x23')&&typeof _0x498005[_0x0aee('0x24')]===_0x0aee('0x23');var _0x41952d=_0x26a640[_0x0aee('0x25')];var _0x394820=_0x19bf37?0x0:_0x498005['offset'];var _0x187681=_0x19bf37?_0x26a640[_0x0aee('0x25')]:_0x498005[_0x0aee('0x22')]+_0x498005[_0x0aee('0x24')];var _0x55f4e9;if(_0x187681>=_0x41952d){_0x187681=_0x41952d;_0x55f4e9=0xc8;}else{_0x55f4e9=0xce;}_0x553ed3[_0x0aee('0x1f')](_0x55f4e9);return _0x553ed3[_0x0aee('0x26')]('Content-Range',_0x394820+'-'+_0x187681+'/'+_0x41952d)['json'](_0x26a640);}return null;};}function patchUpdates(_0x3fdbe0){return function(_0x30dc39){try{jsonpatch[_0x0aee('0x27')](_0x30dc39,_0x3fdbe0,!![]);}catch(_0x3150a9){return BPromise[_0x0aee('0x28')](_0x3150a9);}return _0x30dc39[_0x0aee('0x29')]();};}function saveUpdates(_0x445f87,_0x18fd02){return function(_0xcb0f3c){if(_0xcb0f3c){return _0xcb0f3c['update'](_0x445f87)['then'](function(_0x52daac){return _0x52daac;});}return null;};}function handleEntityNotFound(_0x189385,_0x245c07){return function(_0x40463c){if(!_0x40463c){_0x189385[_0x0aee('0x2a')](0x194);}return _0x40463c;};}function handleError(_0x180525,_0x55c5b9){_0x55c5b9=_0x55c5b9||0x1f4;return function(_0x1f4f20){logger[_0x0aee('0x2b')](_0x1f4f20[_0x0aee('0x2c')]);if(_0x1f4f20['name']){delete _0x1f4f20[_0x0aee('0x2d')];}_0x180525[_0x0aee('0x1f')](_0x55c5b9)['send'](_0x1f4f20);};}exports['index']=function(_0x48fa9d,_0x15da12){var _0x2ecb0f={},_0x1d2be3={},_0x30216f={'count':0x0,'rows':[]};var _0x17d335=_[_0x0aee('0x2e')](db[_0x0aee('0x2f')][_0x0aee('0x30')],function(_0x27e02a){return{'name':_0x27e02a[_0x0aee('0x31')],'type':_0x27e02a[_0x0aee('0x32')][_0x0aee('0x33')]};});_0x1d2be3[_0x0aee('0x34')]=_[_0x0aee('0x2e')](_0x17d335,_0x0aee('0x2d'));_0x1d2be3['query']=_[_0x0aee('0x35')](_0x48fa9d[_0x0aee('0x36')]);_0x1d2be3[_0x0aee('0x37')]=_[_0x0aee('0x38')](_0x1d2be3[_0x0aee('0x34')],_0x1d2be3['query']);_0x2ecb0f[_0x0aee('0x39')]=_[_0x0aee('0x38')](_0x1d2be3[_0x0aee('0x34')],qs[_0x0aee('0x3a')](_0x48fa9d['query']['fields']));_0x2ecb0f[_0x0aee('0x39')]=_0x2ecb0f['attributes']['length']?_0x2ecb0f[_0x0aee('0x39')]:_0x1d2be3[_0x0aee('0x34')];if(!_0x48fa9d[_0x0aee('0x36')][_0x0aee('0x3b')](_0x0aee('0x3c'))){_0x2ecb0f[_0x0aee('0x24')]=qs[_0x0aee('0x24')](_0x48fa9d[_0x0aee('0x36')][_0x0aee('0x24')]);_0x2ecb0f[_0x0aee('0x22')]=qs[_0x0aee('0x22')](_0x48fa9d[_0x0aee('0x36')][_0x0aee('0x22')]);}_0x2ecb0f[_0x0aee('0x3d')]=qs[_0x0aee('0x3e')](_0x48fa9d['query'][_0x0aee('0x3e')]);_0x2ecb0f[_0x0aee('0x3f')]=qs[_0x0aee('0x37')](_[_0x0aee('0x40')](_0x48fa9d[_0x0aee('0x36')],_0x1d2be3[_0x0aee('0x37')]),_0x17d335);if(_0x48fa9d[_0x0aee('0x36')][_0x0aee('0x41')]){_0x2ecb0f['where']=_[_0x0aee('0x42')](_0x2ecb0f[_0x0aee('0x3f')],{'$or':_[_0x0aee('0x2e')](_0x17d335,function(_0x16cc26){if(_0x16cc26[_0x0aee('0x32')]!==_0x0aee('0x43')){var _0x31537e={};_0x31537e[_0x16cc26[_0x0aee('0x2d')]]={'$like':'%'+_0x48fa9d[_0x0aee('0x36')][_0x0aee('0x41')]+'%'};return _0x31537e;}})});}_0x2ecb0f=_['merge']({},_0x2ecb0f,_0x48fa9d[_0x0aee('0x44')]);var _0xbdb713={'where':_0x2ecb0f['where']};return db[_0x0aee('0x2f')][_0x0aee('0x25')](_0xbdb713)[_0x0aee('0x45')](function(_0x4e4008){_0x30216f['count']=_0x4e4008;if(_0x48fa9d['query']['includeAll']){_0x2ecb0f[_0x0aee('0x46')]=[{'all':!![]}];}return db['Team']['findAll'](_0x2ecb0f);})['then'](function(_0x587137){_0x30216f['rows']=_0x587137;return _0x30216f;})[_0x0aee('0x45')](respondWithFilteredResult(_0x15da12,_0x2ecb0f))[_0x0aee('0x47')](handleError(_0x15da12,null));};exports[_0x0aee('0x48')]=function(_0x2410ad,_0x3e4e4e){var _0x211baa={'raw':![],'where':{'id':_0x2410ad[_0x0aee('0x49')]['id']}},_0x573df9={};_0x573df9['model']=_['keys'](db[_0x0aee('0x2f')]['rawAttributes']);_0x573df9[_0x0aee('0x36')]=_['keys'](_0x2410ad[_0x0aee('0x36')]);_0x573df9[_0x0aee('0x37')]=_[_0x0aee('0x38')](_0x573df9[_0x0aee('0x34')],_0x573df9[_0x0aee('0x36')]);_0x211baa['attributes']=_[_0x0aee('0x38')](_0x573df9[_0x0aee('0x34')],qs[_0x0aee('0x3a')](_0x2410ad['query'][_0x0aee('0x3a')]));_0x211baa[_0x0aee('0x39')]=_0x211baa[_0x0aee('0x39')][_0x0aee('0x4a')]?_0x211baa['attributes']:_0x573df9[_0x0aee('0x34')];if(_0x2410ad[_0x0aee('0x36')][_0x0aee('0x4b')]){_0x211baa['include']=[{'all':!![]}];}_0x211baa=_[_0x0aee('0x42')]({},_0x211baa,_0x2410ad[_0x0aee('0x44')]);return db[_0x0aee('0x2f')]['find'](_0x211baa)[_0x0aee('0x45')](handleEntityNotFound(_0x3e4e4e,null))[_0x0aee('0x45')](respondWithResult(_0x3e4e4e,null))['catch'](handleError(_0x3e4e4e,null));};exports[_0x0aee('0x4c')]=function(_0xfe6c19,_0x427f6d){return db[_0x0aee('0x2f')][_0x0aee('0x4c')](_0xfe6c19[_0x0aee('0x4d')],{})[_0x0aee('0x45')](function(_0x17aa13){var _0x314314=_0xfe6c19[_0x0aee('0x4e')][_0x0aee('0x4f')]({'plain':!![]});if(!_0x314314)throw new Error(_0x0aee('0x50'));if(_0x314314[_0x0aee('0x51')]===_0x0aee('0x4e')){var _0x2a9eee=_0x17aa13['get']({'plain':!![]});var _0x1f214a=_0x0aee('0x52');return db['UserProfileSection'][_0x0aee('0x53')]({'where':{'name':_0x1f214a,'userProfileId':_0x314314[_0x0aee('0x54')]},'raw':!![]})[_0x0aee('0x45')](function(_0x1f7e10){if(_0x1f7e10&&_0x1f7e10[_0x0aee('0x55')]===0x0){return db[_0x0aee('0x56')]['create']({'name':_0x2a9eee['name'],'resourceId':_0x2a9eee['id'],'type':_0x1f7e10['name'],'sectionId':_0x1f7e10['id']},{})['then'](function(){return _0x17aa13;});}else{return _0x17aa13;}})[_0x0aee('0x47')](function(_0x2ee0af){logger[_0x0aee('0x2b')](_0x0aee('0x57'),_0x2ee0af);throw _0x2ee0af;});}return _0x17aa13;})[_0x0aee('0x45')](respondWithResult(_0x427f6d,0xc9))[_0x0aee('0x47')](handleError(_0x427f6d,null));};exports[_0x0aee('0x58')]=function(_0xbbcc51,_0x1b7876){if(_0xbbcc51['body']['id']){delete _0xbbcc51['body']['id'];}return db[_0x0aee('0x2f')][_0x0aee('0x53')]({'where':{'id':_0xbbcc51[_0x0aee('0x49')]['id']}})[_0x0aee('0x45')](handleEntityNotFound(_0x1b7876,null))['then'](saveUpdates(_0xbbcc51['body'],null))[_0x0aee('0x45')](respondWithResult(_0x1b7876,null))['catch'](handleError(_0x1b7876,null));};exports[_0x0aee('0x59')]=function(_0x1a9a96,_0x30f2b1){var _0x1df5f0=_0x1a9a96[_0x0aee('0x49')]['id'];var _0x43ae1c=[];return db[_0x0aee('0x5a')]['transaction'](function(_0x42a546){var _0x352b55='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1df5f0;return db[_0x0aee('0x5a')][_0x0aee('0x36')](_0x352b55,{'type':db[_0x0aee('0x5b')][_0x0aee('0x5c')][_0x0aee('0x5d')],'raw':!![],'transaction':_0x42a546})[_0x0aee('0x45')](function(_0x457d1){_0x43ae1c=_[_0x0aee('0x2e')](_0x457d1,function(_0x382ef1){return Number(_0x382ef1[_0x0aee('0x5e')]);});})[_0x0aee('0x45')](function(){var _0x4b4633=_0x0aee('0x5f')+_0x1df5f0;return db['sequelize'][_0x0aee('0x36')](_0x4b4633,{'type':db[_0x0aee('0x5b')][_0x0aee('0x5c')]['SELECT'],'raw':!![],'transaction':_0x42a546});})[_0x0aee('0x45')](function(_0x3aa2f5){var _0x5f3340=_[_0x0aee('0x2e')](_0x3aa2f5,function(_0x126428){return Number(_0x126428['VoiceQueueId']);});return db[_0x0aee('0x60')][_0x0aee('0x59')]({'where':{'UserId':{'$in':_0x43ae1c},'VoiceQueueId':{'$in':_0x5f3340}},'transaction':_0x42a546});})[_0x0aee('0x45')](function(){var _0x1c6138=_0x0aee('0x61')+_0x1df5f0;return db[_0x0aee('0x5a')][_0x0aee('0x36')](_0x1c6138,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x42a546});})['then'](function(_0x3d5199){var _0x276a0b=_[_0x0aee('0x2e')](_0x3d5199,function(_0x5766b9){return Number(_0x5766b9[_0x0aee('0x62')]);});return db['UserMailQueue'][_0x0aee('0x59')]({'where':{'UserId':{'$in':_0x43ae1c},'MailQueueId':{'$in':_0x276a0b}},'transaction':_0x42a546});})[_0x0aee('0x45')](function(){var _0xf129a1='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1df5f0;return db[_0x0aee('0x5a')][_0x0aee('0x36')](_0xf129a1,{'type':db[_0x0aee('0x5b')][_0x0aee('0x5c')][_0x0aee('0x5d')],'raw':!![],'transaction':_0x42a546});})['then'](function(_0x469eb){var _0x2282a1=_[_0x0aee('0x2e')](_0x469eb,function(_0x5a7968){return Number(_0x5a7968[_0x0aee('0x63')]);});return db['UserSmsQueue'][_0x0aee('0x59')]({'where':{'UserId':{'$in':_0x43ae1c},'SmsQueueId':{'$in':_0x2282a1}},'transaction':_0x42a546});})['then'](function(){var _0x250f6d=_0x0aee('0x64')+_0x1df5f0;return db[_0x0aee('0x5a')][_0x0aee('0x36')](_0x250f6d,{'type':db[_0x0aee('0x5b')][_0x0aee('0x5c')][_0x0aee('0x5d')],'raw':!![],'transaction':_0x42a546});})[_0x0aee('0x45')](function(_0x2e141b){var _0x422caa=_['map'](_0x2e141b,function(_0x2a3bfa){return Number(_0x2a3bfa[_0x0aee('0x65')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x43ae1c},'ChatQueueId':{'$in':_0x422caa}},'transaction':_0x42a546});})[_0x0aee('0x45')](function(){var _0x228177=_0x0aee('0x66')+_0x1df5f0;return db[_0x0aee('0x5a')]['query'](_0x228177,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x42a546});})[_0x0aee('0x45')](function(_0x2973f3){var _0x498b60=_[_0x0aee('0x2e')](_0x2973f3,function(_0x22ea9f){return Number(_0x22ea9f[_0x0aee('0x67')]);});return db[_0x0aee('0x68')][_0x0aee('0x59')]({'where':{'UserId':{'$in':_0x43ae1c},'FaxQueueId':{'$in':_0x498b60}},'transaction':_0x42a546});})[_0x0aee('0x45')](function(){var _0x554a36=_0x0aee('0x69')+_0x1df5f0;return db['sequelize'][_0x0aee('0x36')](_0x554a36,{'type':db['Sequelize'][_0x0aee('0x5c')][_0x0aee('0x5d')],'raw':!![],'transaction':_0x42a546});})[_0x0aee('0x45')](function(_0x498d30){var _0x3c9020=_[_0x0aee('0x2e')](_0x498d30,function(_0x523d00){return Number(_0x523d00[_0x0aee('0x6a')]);});return db[_0x0aee('0x6b')][_0x0aee('0x59')]({'where':{'UserId':{'$in':_0x43ae1c},'OpenchannelQueueId':{'$in':_0x3c9020}},'transaction':_0x42a546});})[_0x0aee('0x45')](function(){var _0x24bf07=_0x0aee('0x6c')+_0x1df5f0;return db[_0x0aee('0x5a')][_0x0aee('0x36')](_0x24bf07,{'type':db[_0x0aee('0x5b')][_0x0aee('0x5c')][_0x0aee('0x5d')],'raw':!![],'transaction':_0x42a546});})[_0x0aee('0x45')](function(_0xd64393){var _0x3d8929=_[_0x0aee('0x2e')](_0xd64393,function(_0x344eb7){return Number(_0x344eb7[_0x0aee('0x6d')]);});return db[_0x0aee('0x6e')]['destroy']({'where':{'UserId':{'$in':_0x43ae1c},'WhatsappQueueId':{'$in':_0x3d8929}},'transaction':_0x42a546});})[_0x0aee('0x45')](function(){return db['TeamVoicePrefix'][_0x0aee('0x53')]({'where':{'TeamId':_0x1df5f0}});})['then'](function(_0x1dfecf){if(_0x1dfecf===null){return;}return db[_0x0aee('0x6f')][_0x0aee('0x59')]({'where':{'UserId':{'$in':_0x43ae1c},'VoicePrefixId':_0x1dfecf[_0x0aee('0x70')]},'transaction':_0x42a546});})['then'](function(){return db[_0x0aee('0x2f')]['destroy']({'where':{'id':_0x1df5f0},'cascade':!![],'transaction':_0x42a546});})[_0x0aee('0x45')](function(_0x19d509){if(_0x19d509===0x0){_0x30f2b1[_0x0aee('0x2a')](0x194);}else{return db[_0x0aee('0x56')][_0x0aee('0x59')]({'where':{'type':_0x0aee('0x52'),'resourceId':_0x1df5f0},'cascade':!![],'transaction':_0x42a546})[_0x0aee('0x45')](function(){_0x30f2b1['status'](0xcc)[_0x0aee('0x20')]();});}})[_0x0aee('0x47')](function(_0x8b4d46){_0x30f2b1[_0x0aee('0x1f')](0x1f4)[_0x0aee('0x71')](_0x8b4d46);});});};exports[_0x0aee('0x72')]=function(_0x5d5823,_0x190bb1,_0x3572d0){return db['Team'][_0x0aee('0x73')]({'where':{'id':_0x5d5823[_0x0aee('0x49')]['id']}})[_0x0aee('0x45')](handleEntityNotFound(_0x190bb1,null))[_0x0aee('0x45')](function(_0x6f3e83){if(!_0x5d5823[_0x0aee('0x36')][_0x0aee('0x74')]||!utils['isValidChannel'](_0x5d5823[_0x0aee('0x36')][_0x0aee('0x74')])){throw new db['Sequelize'][(_0x0aee('0x75'))]('Unknown\x20channel');}var _0x2b5c34={};var _0x25a7e2={};_0x25a7e2[_0x0aee('0x34')]=_[_0x0aee('0x35')](db[_[_0x0aee('0x76')](_0x5d5823['query'][_0x0aee('0x74')]['toLowerCase']())+'Queue'][_0x0aee('0x30')]);_0x25a7e2[_0x0aee('0x36')]=_[_0x0aee('0x35')](_0x5d5823[_0x0aee('0x36')]);_0x25a7e2[_0x0aee('0x37')]=_[_0x0aee('0x38')](_0x25a7e2[_0x0aee('0x34')],_0x25a7e2[_0x0aee('0x36')]);_0x2b5c34[_0x0aee('0x39')]=_[_0x0aee('0x38')](_0x25a7e2['model'],qs[_0x0aee('0x3a')](_0x5d5823['query'][_0x0aee('0x3a')]));_0x2b5c34['attributes']=_0x2b5c34[_0x0aee('0x39')][_0x0aee('0x4a')]?_0x2b5c34['attributes']:_0x25a7e2['model'];_0x2b5c34[_0x0aee('0x24')]=qs[_0x0aee('0x24')](_0x5d5823[_0x0aee('0x36')][_0x0aee('0x24')]);_0x2b5c34[_0x0aee('0x22')]=qs[_0x0aee('0x22')](_0x5d5823[_0x0aee('0x36')][_0x0aee('0x22')]);_0x2b5c34['order']=qs[_0x0aee('0x3e')](_0x5d5823[_0x0aee('0x36')][_0x0aee('0x3e')]);_0x2b5c34[_0x0aee('0x3f')]=qs[_0x0aee('0x37')](_['pick'](_0x5d5823['query'],_0x25a7e2[_0x0aee('0x37')]));_0x2b5c34=_[_0x0aee('0x42')]({},_0x2b5c34,_0x5d5823[_0x0aee('0x44')]);return _0x6f3e83[_0x0aee('0x4f')+_[_0x0aee('0x76')](_0x5d5823[_0x0aee('0x36')][_0x0aee('0x74')][_0x0aee('0x77')]())+_0x0aee('0x78')](_0x2b5c34);})[_0x0aee('0x45')](respondWithResult(_0x190bb1,null))[_0x0aee('0x47')](handleError(_0x190bb1,null));};exports['addQueues']=function(_0x5659a6,_0x854e2a,_0x43a041){return db['Team'][_0x0aee('0x73')]({'where':{'id':_0x5659a6[_0x0aee('0x49')]['id']}})['then'](function(_0x41a438){if(_0x41a438){if(!_0x5659a6[_0x0aee('0x4d')][_0x0aee('0x74')]||!utils[_0x0aee('0x79')](_0x5659a6[_0x0aee('0x4d')][_0x0aee('0x74')])){throw new db[(_0x0aee('0x5b'))]['ValidationError']('Unknown\x20channel');}return _0x41a438[_0x0aee('0x7a')+_[_0x0aee('0x76')](_0x5659a6[_0x0aee('0x4d')][_0x0aee('0x74')][_0x0aee('0x77')]())+_0x0aee('0x78')](_0x5659a6[_0x0aee('0x4d')]['ids']);}return null;})['then'](handleEntityNotFound(_0x854e2a,null))[_0x0aee('0x45')](respondWithStatusCode(_0x854e2a,null))[_0x0aee('0x47')](handleError(_0x854e2a,null));};exports[_0x0aee('0x7b')]=function(_0xa7e815,_0x1f9bb8,_0x22f22a){return db[_0x0aee('0x2f')][_0x0aee('0x73')]({'where':{'id':_0xa7e815['params']['id']}})[_0x0aee('0x45')](function(_0xca61fc){if(_0xca61fc){if(!_0xa7e815['query']['channel']||!utils['isValidChannel'](_0xa7e815[_0x0aee('0x36')][_0x0aee('0x74')])){throw new db['Sequelize'][(_0x0aee('0x75'))](_0x0aee('0x7c'));}return _0xca61fc['remove'+_[_0x0aee('0x76')](_0xa7e815[_0x0aee('0x36')][_0x0aee('0x74')]['toLowerCase']())+_0x0aee('0x78')](_0xa7e815[_0x0aee('0x36')][_0x0aee('0x7d')]);}return null;})[_0x0aee('0x45')](handleEntityNotFound(_0x1f9bb8,null))[_0x0aee('0x45')](respondWithStatusCode(_0x1f9bb8,null))[_0x0aee('0x47')](handleError(_0x1f9bb8,null));};exports[_0x0aee('0x7e')]=function(_0x2cdeac,_0x342745){var _0x337c84=_[_0x0aee('0x7f')](_0x2cdeac[_0x0aee('0x4d')]['ids'])?_0x2cdeac[_0x0aee('0x4d')]['ids']:[_0x2cdeac[_0x0aee('0x4d')][_0x0aee('0x7d')]];var _0x32e4a7=_0x2cdeac['params']['id'];return db[_0x0aee('0x2f')][_0x0aee('0x53')]({'where':{'id':_0x32e4a7}})[_0x0aee('0x45')](handleEntityNotFound(_0x342745,null))[_0x0aee('0x45')](function(_0x2af604){if(_0x2af604){var _0x2d07e8=[_0x0aee('0x80'),_0x0aee('0x81'),_0x0aee('0x82'),_0x0aee('0x83'),'Fax','Openchannel','Whatsapp'];return db['sequelize'][_0x0aee('0x84')](function(_0x1f38b6){var _0x31b7c2=_[_0x0aee('0x2e')](_0x2d07e8,function(_0x4f7f57){var _0x2598d0={'attributes':['id',_0x0aee('0x2d')]};if(_0x4f7f57==='Voice'){_0x2598d0[_0x0aee('0x85')]={'attributes':[_0x0aee('0x86')]};}return _0x2af604[_0x0aee('0x4f')+_0x4f7f57+'Queues'](_0x2598d0)[_0x0aee('0x45')](function(_0x11c593){var _0x456d7d=_['map'](_0x11c593,function(_0x58d88f){var _0xc4ae8c=_[_0x0aee('0x2e')](_0x337c84,function(_0x45a750){var _0x85bca2={'where':{'UserId':_0x45a750,[_0x4f7f57+_0x0aee('0x87')]:_0x58d88f['id']},'transaction':_0x1f38b6};if(_0x4f7f57===_0x0aee('0x80')){_0x85bca2[_0x0aee('0x1b')]={'penalty':_0x58d88f[_0x0aee('0x88')]['penalty']};}return db[_0x0aee('0x89')+_0x4f7f57+_0x0aee('0x8a')]['findOrCreate'](_0x85bca2)['then'](function(){socket[_0x0aee('0x8b')](_0x0aee('0x4e')+_0x4f7f57+_0x0aee('0x8c'),{'UserId':_0x45a750,[_0x4f7f57+_0x0aee('0x87')]:_0x58d88f['id']});if(_0x4f7f57!==_0x0aee('0x80')){return;}return db[_0x0aee('0x89')][_0x0aee('0x8d')]({'where':{'id':_0x337c84,'online':0x1},'attributes':['id',_0x0aee('0x2d'),'online',_0x0aee('0x8e'),'interface'],'raw':!![]})[_0x0aee('0x45')](function(_0x5be4be){var _0x52be60=_[_0x0aee('0x2e')](_0x5be4be,function(_0x502858){return db['UserVoiceQueueRt'][_0x0aee('0x8f')]({'membername':_0x502858['name'],'UserId':_0x502858['id'],'queue_name':_0x58d88f[_0x0aee('0x2d')],'VoiceQueueId':_0x58d88f['id'],'interface':_['isNil'](_0x502858[_0x0aee('0x90')])?util['format'](_0x0aee('0x91'),_0x502858[_0x0aee('0x2d')]):_0x502858[_0x0aee('0x90')],'paused':_0x502858[_0x0aee('0x8e')]||![],'penalty':_0x58d88f[_0x0aee('0x88')][_0x0aee('0x86')]},{'transaction':_0x1f38b6});});return Promise[_0x0aee('0x92')](_0x52be60);});});});return Promise[_0x0aee('0x92')](_0xc4ae8c);});return Promise[_0x0aee('0x92')](_0x456d7d);})[_0x0aee('0x45')](function(){return db[_0x0aee('0x93')][_0x0aee('0x73')]({'where':{'teamId':_0x32e4a7}})[_0x0aee('0x45')](function(_0xe4c1ef){if(_0xe4c1ef){var _0x577f99=_[_0x0aee('0x2e')](_0x337c84,function(_0x4f21d9){db[_0x0aee('0x6f')][_0x0aee('0x8f')]({'UserId':_0x4f21d9,'VoicePrefixId':_0xe4c1ef[_0x0aee('0x70')]});});return Promise['all'](_0x577f99);}});});});return Promise[_0x0aee('0x92')](_0x31b7c2)[_0x0aee('0x45')](function(){return _0x2af604[_0x0aee('0x7e')](_0x337c84,{'transaction':_0x1f38b6})[_0x0aee('0x94')](function(_0x3c8994){return _0x3c8994;});});});}})['then'](respondWithResult(_0x342745,null))['catch'](handleError(_0x342745,null));};exports[_0x0aee('0x95')]=function(_0xccee64,_0x12ece0){var _0x5577c8=_['isArray'](_0xccee64[_0x0aee('0x36')]['ids'])?_0xccee64[_0x0aee('0x36')][_0x0aee('0x7d')]:[_0xccee64[_0x0aee('0x36')][_0x0aee('0x7d')]];var _0x9b4d44=_0xccee64[_0x0aee('0x49')]['id'];return db[_0x0aee('0x2f')][_0x0aee('0x53')]({'where':{'id':_0x9b4d44}})[_0x0aee('0x45')](handleEntityNotFound(_0x12ece0,null))[_0x0aee('0x45')](function(_0x1aab2d){if(_0x1aab2d){var _0x3a0d0d=[_0x0aee('0x80'),_0x0aee('0x81'),_0x0aee('0x82'),_0x0aee('0x83'),'Fax','Openchannel',_0x0aee('0x96')];return db[_0x0aee('0x5a')][_0x0aee('0x84')](function(_0x5c7e68){var _0x124d90=_[_0x0aee('0x2e')](_0x3a0d0d,function(_0x22161a){var _0x8e1eeb={'attributes':['id',_0x0aee('0x2d')]};return _0x1aab2d['get'+_0x22161a+_0x0aee('0x78')](_0x8e1eeb)[_0x0aee('0x45')](function(_0x2e4cd4){var _0x54bad5=_['map'](_0x2e4cd4,function(_0x193ff9){return _0x193ff9[_0x0aee('0x95')](_0x5577c8,{'transaction':_0x5c7e68})[_0x0aee('0x45')](function(){var _0x23c122=_[_0x0aee('0x2e')](_0x5577c8,function(_0x2125bd){socket[_0x0aee('0x8b')](_0x0aee('0x4e')+_0x22161a+'Queue:remove',{'UserId':Number(_0x2125bd),[_0x22161a+'QueueId']:_0x193ff9['id']});if(_0x22161a!==_0x0aee('0x80')){return;}return db[_0x0aee('0x97')][_0x0aee('0x59')]({'where':{'VoiceQueueId':_0x193ff9['id'],'UserId':_0x2125bd},'transaction':_0x5c7e68});});return Promise[_0x0aee('0x92')](_0x23c122);});});return Promise[_0x0aee('0x92')](_0x54bad5);});});return Promise[_0x0aee('0x92')](_0x124d90)[_0x0aee('0x45')](function(){return _0x1aab2d['removeAgents'](_0x5577c8,{'transaction':_0x5c7e68});})[_0x0aee('0x45')](function(){return db[_0x0aee('0x93')][_0x0aee('0x73')]({'where':{'teamId':_0x9b4d44}})[_0x0aee('0x45')](function(_0x361659){if(_0x361659){var _0x30b3d3=_[_0x0aee('0x2e')](_0x5577c8,function(_0x8f3a6c){db['UserVoicePrefix'][_0x0aee('0x59')]({'where':{'UserId':_0x8f3a6c,'VoicePrefixId':_0x361659[_0x0aee('0x70')]}});});return Promise['all'](_0x30b3d3);}});});});}})[_0x0aee('0x45')](respondWithStatusCode(_0x12ece0,null))[_0x0aee('0x47')](handleError(_0x12ece0,null));};exports[_0x0aee('0x98')]=function(_0xc3f6ba,_0x1ddf20,_0x4dea3d){var _0xa31aa9={};var _0x24ed5f={};var _0x1f406b;var _0x9161e3;return db[_0x0aee('0x2f')]['findOne']({'where':{'id':_0xc3f6ba[_0x0aee('0x49')]['id']}})['then'](handleEntityNotFound(_0x1ddf20,null))[_0x0aee('0x45')](function(_0x401fc1){if(_0x401fc1){_0x1f406b=_0x401fc1;_0x24ed5f['model']=_['keys'](db[_0x0aee('0x89')][_0x0aee('0x30')]);_0x24ed5f[_0x0aee('0x36')]=_[_0x0aee('0x35')](_0xc3f6ba[_0x0aee('0x36')]);_0x24ed5f[_0x0aee('0x37')]=_[_0x0aee('0x38')](_0x24ed5f['model'],_0x24ed5f[_0x0aee('0x36')]);_0xa31aa9[_0x0aee('0x39')]=_[_0x0aee('0x38')](_0x24ed5f['model'],qs[_0x0aee('0x3a')](_0xc3f6ba['query'][_0x0aee('0x3a')]));_0xa31aa9[_0x0aee('0x39')]=_0xa31aa9[_0x0aee('0x39')]['length']?_0xa31aa9[_0x0aee('0x39')]:_0x24ed5f[_0x0aee('0x34')];_0xa31aa9[_0x0aee('0x3d')]=qs[_0x0aee('0x3e')](_0xc3f6ba[_0x0aee('0x36')][_0x0aee('0x3e')]);_0xa31aa9[_0x0aee('0x3f')]=qs['filters'](_['pick'](_0xc3f6ba[_0x0aee('0x36')],_0x24ed5f['filters']));if(_0xc3f6ba['query'][_0x0aee('0x41')]){_0xa31aa9[_0x0aee('0x3f')]=_[_0x0aee('0x42')](_0xa31aa9[_0x0aee('0x3f')],{'$or':_[_0x0aee('0x2e')](_0xa31aa9['attributes'],function(_0x4bba8c){var _0x182cd6={};_0x182cd6[_0x4bba8c]={'$like':'%'+_0xc3f6ba['query'][_0x0aee('0x41')]+'%'};return _0x182cd6;})});}_0xa31aa9=_[_0x0aee('0x42')]({},_0xa31aa9,_0xc3f6ba[_0x0aee('0x44')]);return _0x1f406b[_0x0aee('0x98')](_0xa31aa9);}})['then'](function(_0x253e13){if(_0x253e13){_0x9161e3=_0x253e13[_0x0aee('0x4a')];if(!_0xc3f6ba[_0x0aee('0x36')]['hasOwnProperty'](_0x0aee('0x3c'))){_0xa31aa9['limit']=qs[_0x0aee('0x24')](_0xc3f6ba[_0x0aee('0x36')][_0x0aee('0x24')]);_0xa31aa9[_0x0aee('0x22')]=qs[_0x0aee('0x22')](_0xc3f6ba[_0x0aee('0x36')][_0x0aee('0x22')]);}return _0x1f406b[_0x0aee('0x98')](_0xa31aa9);}})[_0x0aee('0x45')](function(_0x47c2b3){if(_0x47c2b3){return _0x47c2b3?{'count':_0x9161e3,'rows':_0x47c2b3}:null;}})['then'](respondWithResult(_0x1ddf20,null))['catch'](handleError(_0x1ddf20,null));}; \ No newline at end of file +var _0x1595=['set','Content-Range','apply','save','update','error','stack','name','send','index','Team','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','options','then','includeAll','include','findAll','rows','show','merge','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','destroy','transaction','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','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','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','ValidationError','Unknown\x20channel','keys','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','add','ids','removeQueues','remove','addAgents','isArray','Voice','Fax','Whatsapp','through','QueueId','defaults','penalty','emit','Queue:save','online','voicePause','interface','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','spread','Chat','Mail','Sms','Openchannel','Queue:remove','UserVoiceQueueRt','removeAgents','getAgents','User','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1595,0x11c));var _0x5159=function(_0x3da96f,_0x5d34fb){_0x3da96f=_0x3da96f-0x0;var _0x5de201=_0x1595[_0x3da96f];return _0x5de201;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5159('0x0'));var jsonpatch=require(_0x5159('0x1'));var rp=require(_0x5159('0x2'));var moment=require(_0x5159('0x3'));var BPromise=require(_0x5159('0x4'));var Mustache=require('mustache');var util=require(_0x5159('0x5'));var path=require(_0x5159('0x6'));var sox=require('sox');var csv=require(_0x5159('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5159('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5159('0x9'));var deskjs=require(_0x5159('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5159('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5159('0xc'));var hardwareService=require(_0x5159('0xd'));var logger=require(_0x5159('0xe'))(_0x5159('0xf'));var utils=require(_0x5159('0x10'));var config=require(_0x5159('0x11'));var licenseUtil=require(_0x5159('0x12'));var db=require(_0x5159('0x13'))['db'];config[_0x5159('0x14')]=_['defaults'](config['redis'],{'host':_0x5159('0x15'),'port':0x18eb});var socket=require(_0x5159('0x16'))(new Redis(config[_0x5159('0x14')]));require(_0x5159('0x17'))[_0x5159('0x18')](socket);function respondWithStatusCode(_0x5b0493,_0x182251){_0x182251=_0x182251||0xcc;return function(_0x23f5d7){if(_0x23f5d7){return _0x5b0493[_0x5159('0x19')](_0x182251);}return _0x5b0493['status'](_0x182251)['end']();};}function respondWithResult(_0x256afa,_0x36320b){_0x36320b=_0x36320b||0xc8;return function(_0x30e2c7){if(_0x30e2c7){return _0x256afa[_0x5159('0x1a')](_0x36320b)[_0x5159('0x1b')](_0x30e2c7);}};}function respondWithFilteredResult(_0x408de9,_0x41a8cb){return function(_0x297198){if(_0x297198){var _0x49a80a=typeof _0x41a8cb[_0x5159('0x1c')]===_0x5159('0x1d')&&typeof _0x41a8cb[_0x5159('0x1e')]===_0x5159('0x1d');var _0x51d239=_0x297198['count'];var _0x53cae4=_0x49a80a?0x0:_0x41a8cb[_0x5159('0x1c')];var _0x130f94=_0x49a80a?_0x297198[_0x5159('0x1f')]:_0x41a8cb[_0x5159('0x1c')]+_0x41a8cb[_0x5159('0x1e')];var _0x5d83c5;if(_0x130f94>=_0x51d239){_0x130f94=_0x51d239;_0x5d83c5=0xc8;}else{_0x5d83c5=0xce;}_0x408de9[_0x5159('0x1a')](_0x5d83c5);return _0x408de9[_0x5159('0x20')](_0x5159('0x21'),_0x53cae4+'-'+_0x130f94+'/'+_0x51d239)[_0x5159('0x1b')](_0x297198);}return null;};}function patchUpdates(_0x333f70){return function(_0x30c9c8){try{jsonpatch[_0x5159('0x22')](_0x30c9c8,_0x333f70,!![]);}catch(_0x4d4ebb){return BPromise['reject'](_0x4d4ebb);}return _0x30c9c8[_0x5159('0x23')]();};}function saveUpdates(_0x29bc81,_0x218d8a){return function(_0x58cdcb){if(_0x58cdcb){return _0x58cdcb[_0x5159('0x24')](_0x29bc81)['then'](function(_0x53b628){return _0x53b628;});}return null;};}function handleEntityNotFound(_0x108f83,_0x12b18b){return function(_0x1b4756){if(!_0x1b4756){_0x108f83['sendStatus'](0x194);}return _0x1b4756;};}function handleError(_0x563444,_0x16726a){_0x16726a=_0x16726a||0x1f4;return function(_0x1071e3){logger[_0x5159('0x25')](_0x1071e3[_0x5159('0x26')]);if(_0x1071e3[_0x5159('0x27')]){delete _0x1071e3['name'];}_0x563444['status'](_0x16726a)[_0x5159('0x28')](_0x1071e3);};}exports[_0x5159('0x29')]=function(_0xa1e43f,_0x272b33){var _0x3d6d2d={},_0x3191b6={},_0x45ddff={'count':0x0,'rows':[]};var _0x45ee52=_['map'](db[_0x5159('0x2a')][_0x5159('0x2b')],function(_0x34a702){return{'name':_0x34a702['fieldName'],'type':_0x34a702[_0x5159('0x2c')][_0x5159('0x2d')]};});_0x3191b6[_0x5159('0x2e')]=_['map'](_0x45ee52,_0x5159('0x27'));_0x3191b6[_0x5159('0x2f')]=_['keys'](_0xa1e43f['query']);_0x3191b6[_0x5159('0x30')]=_[_0x5159('0x31')](_0x3191b6[_0x5159('0x2e')],_0x3191b6[_0x5159('0x2f')]);_0x3d6d2d[_0x5159('0x32')]=_['intersection'](_0x3191b6['model'],qs[_0x5159('0x33')](_0xa1e43f[_0x5159('0x2f')]['fields']));_0x3d6d2d['attributes']=_0x3d6d2d[_0x5159('0x32')][_0x5159('0x34')]?_0x3d6d2d[_0x5159('0x32')]:_0x3191b6[_0x5159('0x2e')];if(!_0xa1e43f[_0x5159('0x2f')][_0x5159('0x35')](_0x5159('0x36'))){_0x3d6d2d[_0x5159('0x1e')]=qs[_0x5159('0x1e')](_0xa1e43f['query'][_0x5159('0x1e')]);_0x3d6d2d['offset']=qs['offset'](_0xa1e43f['query'][_0x5159('0x1c')]);}_0x3d6d2d[_0x5159('0x37')]=qs[_0x5159('0x38')](_0xa1e43f[_0x5159('0x2f')][_0x5159('0x38')]);_0x3d6d2d[_0x5159('0x39')]=qs[_0x5159('0x30')](_[_0x5159('0x3a')](_0xa1e43f[_0x5159('0x2f')],_0x3191b6[_0x5159('0x30')]),_0x45ee52);if(_0xa1e43f[_0x5159('0x2f')][_0x5159('0x3b')]){_0x3d6d2d[_0x5159('0x39')]=_['merge'](_0x3d6d2d[_0x5159('0x39')],{'$or':_[_0x5159('0x3c')](_0x45ee52,function(_0x3c7215){if(_0x3c7215[_0x5159('0x2c')]!==_0x5159('0x3d')){var _0x4ffbc0={};_0x4ffbc0[_0x3c7215[_0x5159('0x27')]]={'$like':'%'+_0xa1e43f[_0x5159('0x2f')][_0x5159('0x3b')]+'%'};return _0x4ffbc0;}})});}_0x3d6d2d=_['merge']({},_0x3d6d2d,_0xa1e43f[_0x5159('0x3e')]);var _0x35ce4e={'where':_0x3d6d2d[_0x5159('0x39')]};return db[_0x5159('0x2a')][_0x5159('0x1f')](_0x35ce4e)[_0x5159('0x3f')](function(_0x904c89){_0x45ddff['count']=_0x904c89;if(_0xa1e43f[_0x5159('0x2f')][_0x5159('0x40')]){_0x3d6d2d[_0x5159('0x41')]=[{'all':!![]}];}return db[_0x5159('0x2a')][_0x5159('0x42')](_0x3d6d2d);})[_0x5159('0x3f')](function(_0x2f302e){_0x45ddff[_0x5159('0x43')]=_0x2f302e;return _0x45ddff;})[_0x5159('0x3f')](respondWithFilteredResult(_0x272b33,_0x3d6d2d))['catch'](handleError(_0x272b33,null));};exports[_0x5159('0x44')]=function(_0x1d1908,_0x3a8c20){var _0x45814e={'raw':![],'where':{'id':_0x1d1908['params']['id']}},_0x122e63={};_0x122e63[_0x5159('0x2e')]=_['keys'](db[_0x5159('0x2a')][_0x5159('0x2b')]);_0x122e63[_0x5159('0x2f')]=_['keys'](_0x1d1908[_0x5159('0x2f')]);_0x122e63[_0x5159('0x30')]=_[_0x5159('0x31')](_0x122e63[_0x5159('0x2e')],_0x122e63[_0x5159('0x2f')]);_0x45814e[_0x5159('0x32')]=_[_0x5159('0x31')](_0x122e63[_0x5159('0x2e')],qs[_0x5159('0x33')](_0x1d1908[_0x5159('0x2f')][_0x5159('0x33')]));_0x45814e[_0x5159('0x32')]=_0x45814e[_0x5159('0x32')][_0x5159('0x34')]?_0x45814e['attributes']:_0x122e63[_0x5159('0x2e')];if(_0x1d1908[_0x5159('0x2f')]['includeAll']){_0x45814e[_0x5159('0x41')]=[{'all':!![]}];}_0x45814e=_[_0x5159('0x45')]({},_0x45814e,_0x1d1908[_0x5159('0x3e')]);return db[_0x5159('0x2a')]['find'](_0x45814e)[_0x5159('0x3f')](handleEntityNotFound(_0x3a8c20,null))[_0x5159('0x3f')](respondWithResult(_0x3a8c20,null))[_0x5159('0x46')](handleError(_0x3a8c20,null));};exports['create']=function(_0x1e1eeb,_0x3672ca){return db[_0x5159('0x2a')]['create'](_0x1e1eeb[_0x5159('0x47')],{})[_0x5159('0x3f')](function(_0xbe281){var _0x4d00a9=_0x1e1eeb[_0x5159('0x48')][_0x5159('0x49')]({'plain':!![]});if(!_0x4d00a9)throw new Error(_0x5159('0x4a'));if(_0x4d00a9[_0x5159('0x4b')]===_0x5159('0x48')){var _0x50da42=_0xbe281[_0x5159('0x49')]({'plain':!![]});var _0x526f8d=_0x5159('0x4c');return db[_0x5159('0x4d')]['find']({'where':{'name':_0x526f8d,'userProfileId':_0x4d00a9['userProfileId']},'raw':!![]})[_0x5159('0x3f')](function(_0x279447){if(_0x279447&&_0x279447[_0x5159('0x4e')]===0x0){return db[_0x5159('0x4f')][_0x5159('0x50')]({'name':_0x50da42['name'],'resourceId':_0x50da42['id'],'type':_0x279447[_0x5159('0x27')],'sectionId':_0x279447['id']},{})[_0x5159('0x3f')](function(){return _0xbe281;});}else{return _0xbe281;}})[_0x5159('0x46')](function(_0x106f79){logger[_0x5159('0x25')](_0x5159('0x51'),_0x106f79);throw _0x106f79;});}return _0xbe281;})[_0x5159('0x3f')](respondWithResult(_0x3672ca,0xc9))[_0x5159('0x46')](handleError(_0x3672ca,null));};exports[_0x5159('0x24')]=function(_0x1b4955,_0x26c867){if(_0x1b4955[_0x5159('0x47')]['id']){delete _0x1b4955[_0x5159('0x47')]['id'];}return db[_0x5159('0x2a')][_0x5159('0x52')]({'where':{'id':_0x1b4955[_0x5159('0x53')]['id']}})[_0x5159('0x3f')](handleEntityNotFound(_0x26c867,null))[_0x5159('0x3f')](saveUpdates(_0x1b4955['body'],null))[_0x5159('0x3f')](respondWithResult(_0x26c867,null))[_0x5159('0x46')](handleError(_0x26c867,null));};exports[_0x5159('0x54')]=function(_0x54157e,_0x11c394){var _0x45625c=_0x54157e[_0x5159('0x53')]['id'];var _0x5c6a42=[];return db['sequelize'][_0x5159('0x55')](function(_0x33420d){var _0x3dc24c='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x45625c;return db[_0x5159('0x56')]['query'](_0x3dc24c,{'type':db[_0x5159('0x57')][_0x5159('0x58')][_0x5159('0x59')],'raw':!![],'transaction':_0x33420d})['then'](function(_0x54e1c7){_0x5c6a42=_[_0x5159('0x3c')](_0x54e1c7,function(_0x3e4669){return Number(_0x3e4669[_0x5159('0x5a')]);});})['then'](function(){var _0x455b51=_0x5159('0x5b')+_0x45625c;return db[_0x5159('0x56')][_0x5159('0x2f')](_0x455b51,{'type':db[_0x5159('0x57')][_0x5159('0x58')][_0x5159('0x59')],'raw':!![],'transaction':_0x33420d});})[_0x5159('0x3f')](function(_0x306116){var _0x556b55=_['map'](_0x306116,function(_0xc36459){return Number(_0xc36459[_0x5159('0x5c')]);});return db['UserVoiceQueue'][_0x5159('0x54')]({'where':{'UserId':{'$in':_0x5c6a42},'VoiceQueueId':{'$in':_0x556b55}},'transaction':_0x33420d});})[_0x5159('0x3f')](function(){var _0x40ada2=_0x5159('0x5d')+_0x45625c;return db[_0x5159('0x56')][_0x5159('0x2f')](_0x40ada2,{'type':db[_0x5159('0x57')][_0x5159('0x58')][_0x5159('0x59')],'raw':!![],'transaction':_0x33420d});})[_0x5159('0x3f')](function(_0x784260){var _0x5217ef=_['map'](_0x784260,function(_0x468202){return Number(_0x468202[_0x5159('0x5e')]);});return db[_0x5159('0x5f')][_0x5159('0x54')]({'where':{'UserId':{'$in':_0x5c6a42},'MailQueueId':{'$in':_0x5217ef}},'transaction':_0x33420d});})[_0x5159('0x3f')](function(){var _0x81958d='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x45625c;return db[_0x5159('0x56')]['query'](_0x81958d,{'type':db['Sequelize'][_0x5159('0x58')][_0x5159('0x59')],'raw':!![],'transaction':_0x33420d});})[_0x5159('0x3f')](function(_0x7cb65e){var _0x17cadd=_[_0x5159('0x3c')](_0x7cb65e,function(_0x4efb81){return Number(_0x4efb81[_0x5159('0x60')]);});return db[_0x5159('0x61')][_0x5159('0x54')]({'where':{'UserId':{'$in':_0x5c6a42},'SmsQueueId':{'$in':_0x17cadd}},'transaction':_0x33420d});})[_0x5159('0x3f')](function(){var _0x2679eb=_0x5159('0x62')+_0x45625c;return db[_0x5159('0x56')][_0x5159('0x2f')](_0x2679eb,{'type':db[_0x5159('0x57')]['QueryTypes'][_0x5159('0x59')],'raw':!![],'transaction':_0x33420d});})[_0x5159('0x3f')](function(_0x176bc0){var _0x1ae89e=_[_0x5159('0x3c')](_0x176bc0,function(_0x114709){return Number(_0x114709[_0x5159('0x63')]);});return db[_0x5159('0x64')][_0x5159('0x54')]({'where':{'UserId':{'$in':_0x5c6a42},'ChatQueueId':{'$in':_0x1ae89e}},'transaction':_0x33420d});})[_0x5159('0x3f')](function(){var _0x38a63a=_0x5159('0x65')+_0x45625c;return db[_0x5159('0x56')][_0x5159('0x2f')](_0x38a63a,{'type':db['Sequelize']['QueryTypes'][_0x5159('0x59')],'raw':!![],'transaction':_0x33420d});})[_0x5159('0x3f')](function(_0x320032){var _0x192e8e=_[_0x5159('0x3c')](_0x320032,function(_0x4ac604){return Number(_0x4ac604[_0x5159('0x66')]);});return db[_0x5159('0x67')][_0x5159('0x54')]({'where':{'UserId':{'$in':_0x5c6a42},'FaxQueueId':{'$in':_0x192e8e}},'transaction':_0x33420d});})[_0x5159('0x3f')](function(){var _0x335d41=_0x5159('0x68')+_0x45625c;return db[_0x5159('0x56')]['query'](_0x335d41,{'type':db[_0x5159('0x57')][_0x5159('0x58')][_0x5159('0x59')],'raw':!![],'transaction':_0x33420d});})['then'](function(_0x36ffa6){var _0x424e46=_[_0x5159('0x3c')](_0x36ffa6,function(_0x56db27){return Number(_0x56db27[_0x5159('0x69')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x5c6a42},'OpenchannelQueueId':{'$in':_0x424e46}},'transaction':_0x33420d});})[_0x5159('0x3f')](function(){var _0x3a6664=_0x5159('0x6a')+_0x45625c;return db[_0x5159('0x56')][_0x5159('0x2f')](_0x3a6664,{'type':db[_0x5159('0x57')][_0x5159('0x58')]['SELECT'],'raw':!![],'transaction':_0x33420d});})[_0x5159('0x3f')](function(_0x51fad2){var _0x191b88=_[_0x5159('0x3c')](_0x51fad2,function(_0x1e8a64){return Number(_0x1e8a64[_0x5159('0x6b')]);});return db[_0x5159('0x6c')][_0x5159('0x54')]({'where':{'UserId':{'$in':_0x5c6a42},'WhatsappQueueId':{'$in':_0x191b88}},'transaction':_0x33420d});})['then'](function(){return db[_0x5159('0x6d')]['find']({'where':{'TeamId':_0x45625c}});})[_0x5159('0x3f')](function(_0x5d4fe5){if(_0x5d4fe5===null){return;}return db[_0x5159('0x6e')]['destroy']({'where':{'UserId':{'$in':_0x5c6a42},'VoicePrefixId':_0x5d4fe5[_0x5159('0x6f')]},'transaction':_0x33420d});})[_0x5159('0x3f')](function(){return db['Team']['destroy']({'where':{'id':_0x45625c},'cascade':!![],'transaction':_0x33420d});})[_0x5159('0x3f')](function(_0x2bc845){if(_0x2bc845===0x0){_0x11c394[_0x5159('0x19')](0x194);}else{return db[_0x5159('0x4f')][_0x5159('0x54')]({'where':{'type':'Teams','resourceId':_0x45625c},'cascade':!![],'transaction':_0x33420d})[_0x5159('0x3f')](function(){_0x11c394[_0x5159('0x1a')](0xcc)['end']();});}})[_0x5159('0x46')](function(_0x1960fe){_0x11c394[_0x5159('0x1a')](0x1f4)[_0x5159('0x28')](_0x1960fe);});});};exports[_0x5159('0x70')]=function(_0x4859c0,_0x4b3b62,_0x124e29){return db[_0x5159('0x2a')][_0x5159('0x71')]({'where':{'id':_0x4859c0[_0x5159('0x53')]['id']}})['then'](handleEntityNotFound(_0x4b3b62,null))['then'](function(_0x3747b6){if(!_0x4859c0[_0x5159('0x2f')][_0x5159('0x72')]||!utils['isValidChannel'](_0x4859c0[_0x5159('0x2f')][_0x5159('0x72')])){throw new db[(_0x5159('0x57'))][(_0x5159('0x73'))](_0x5159('0x74'));}var _0x145f8b={};var _0x5a42a4={};_0x5a42a4['model']=_[_0x5159('0x75')](db[_[_0x5159('0x76')](_0x4859c0['query'][_0x5159('0x72')][_0x5159('0x77')]())+_0x5159('0x78')][_0x5159('0x2b')]);_0x5a42a4[_0x5159('0x2f')]=_[_0x5159('0x75')](_0x4859c0['query']);_0x5a42a4[_0x5159('0x30')]=_['intersection'](_0x5a42a4[_0x5159('0x2e')],_0x5a42a4[_0x5159('0x2f')]);_0x145f8b[_0x5159('0x32')]=_[_0x5159('0x31')](_0x5a42a4[_0x5159('0x2e')],qs[_0x5159('0x33')](_0x4859c0[_0x5159('0x2f')][_0x5159('0x33')]));_0x145f8b['attributes']=_0x145f8b[_0x5159('0x32')][_0x5159('0x34')]?_0x145f8b[_0x5159('0x32')]:_0x5a42a4[_0x5159('0x2e')];_0x145f8b[_0x5159('0x1e')]=qs['limit'](_0x4859c0['query']['limit']);_0x145f8b[_0x5159('0x1c')]=qs['offset'](_0x4859c0[_0x5159('0x2f')][_0x5159('0x1c')]);_0x145f8b['order']=qs[_0x5159('0x38')](_0x4859c0[_0x5159('0x2f')][_0x5159('0x38')]);_0x145f8b[_0x5159('0x39')]=qs[_0x5159('0x30')](_['pick'](_0x4859c0[_0x5159('0x2f')],_0x5a42a4[_0x5159('0x30')]));_0x145f8b=_[_0x5159('0x45')]({},_0x145f8b,_0x4859c0['options']);return _0x3747b6[_0x5159('0x49')+_[_0x5159('0x76')](_0x4859c0['query'][_0x5159('0x72')][_0x5159('0x77')]())+_0x5159('0x79')](_0x145f8b);})[_0x5159('0x3f')](respondWithResult(_0x4b3b62,null))[_0x5159('0x46')](handleError(_0x4b3b62,null));};exports[_0x5159('0x7a')]=function(_0x36c5dd,_0x3a8d83,_0x38e6fd){return db[_0x5159('0x2a')][_0x5159('0x71')]({'where':{'id':_0x36c5dd['params']['id']}})[_0x5159('0x3f')](function(_0x187fa0){if(_0x187fa0){if(!_0x36c5dd[_0x5159('0x47')]['channel']||!utils[_0x5159('0x7b')](_0x36c5dd[_0x5159('0x47')][_0x5159('0x72')])){throw new db[(_0x5159('0x57'))][(_0x5159('0x73'))](_0x5159('0x74'));}return _0x187fa0[_0x5159('0x7c')+_[_0x5159('0x76')](_0x36c5dd[_0x5159('0x47')][_0x5159('0x72')]['toLowerCase']())+_0x5159('0x79')](_0x36c5dd[_0x5159('0x47')][_0x5159('0x7d')]);}return null;})[_0x5159('0x3f')](handleEntityNotFound(_0x3a8d83,null))['then'](respondWithStatusCode(_0x3a8d83,null))['catch'](handleError(_0x3a8d83,null));};exports[_0x5159('0x7e')]=function(_0x109fe7,_0x515215,_0x40d425){return db['Team']['findOne']({'where':{'id':_0x109fe7[_0x5159('0x53')]['id']}})[_0x5159('0x3f')](function(_0xde3a5d){if(_0xde3a5d){if(!_0x109fe7[_0x5159('0x2f')][_0x5159('0x72')]||!utils['isValidChannel'](_0x109fe7[_0x5159('0x2f')]['channel'])){throw new db[(_0x5159('0x57'))][(_0x5159('0x73'))]('Unknown\x20channel');}return _0xde3a5d[_0x5159('0x7f')+_[_0x5159('0x76')](_0x109fe7[_0x5159('0x2f')]['channel']['toLowerCase']())+_0x5159('0x79')](_0x109fe7[_0x5159('0x2f')][_0x5159('0x7d')]);}return null;})[_0x5159('0x3f')](handleEntityNotFound(_0x515215,null))[_0x5159('0x3f')](respondWithStatusCode(_0x515215,null))[_0x5159('0x46')](handleError(_0x515215,null));};exports[_0x5159('0x80')]=function(_0x282f60,_0x3ca477){var _0xca9a37=_[_0x5159('0x81')](_0x282f60[_0x5159('0x47')][_0x5159('0x7d')])?_0x282f60[_0x5159('0x47')][_0x5159('0x7d')]:[_0x282f60['body'][_0x5159('0x7d')]];var _0x40ba88=_0x282f60['params']['id'];return db[_0x5159('0x2a')][_0x5159('0x52')]({'where':{'id':_0x40ba88}})[_0x5159('0x3f')](handleEntityNotFound(_0x3ca477,null))[_0x5159('0x3f')](function(_0x4f43d3){if(_0x4f43d3){var _0x1ce698=[_0x5159('0x82'),'Chat','Mail','Sms',_0x5159('0x83'),'Openchannel',_0x5159('0x84')];return db[_0x5159('0x56')][_0x5159('0x55')](function(_0x2f696c){var _0x1b9b7f=_[_0x5159('0x3c')](_0x1ce698,function(_0x11943f){var _0x36f427={'attributes':['id','name']};if(_0x11943f===_0x5159('0x82')){_0x36f427[_0x5159('0x85')]={'attributes':['penalty']};}return _0x4f43d3[_0x5159('0x49')+_0x11943f+_0x5159('0x79')](_0x36f427)['then'](function(_0x251558){var _0x5bee9e=_[_0x5159('0x3c')](_0x251558,function(_0x42afcc){var _0x23c234=_[_0x5159('0x3c')](_0xca9a37,function(_0x56061c){var _0x49cc6b={'where':{'UserId':_0x56061c,[_0x11943f+_0x5159('0x86')]:_0x42afcc['id']},'transaction':_0x2f696c};if(_0x11943f===_0x5159('0x82')){_0x49cc6b[_0x5159('0x87')]={'penalty':_0x42afcc['TeamVoiceQueue'][_0x5159('0x88')]};}return db['User'+_0x11943f+'Queue']['findOrCreate'](_0x49cc6b)['then'](function(){socket[_0x5159('0x89')]('user'+_0x11943f+_0x5159('0x8a'),{'UserId':_0x56061c,[_0x11943f+'QueueId']:_0x42afcc['id']});if(_0x11943f!=='Voice'){return;}return db['User'][_0x5159('0x42')]({'where':{'id':_0xca9a37,'online':0x1},'attributes':['id','name',_0x5159('0x8b'),_0x5159('0x8c'),_0x5159('0x8d')],'raw':!![]})[_0x5159('0x3f')](function(_0x2cb813){var _0x36d50f=_[_0x5159('0x3c')](_0x2cb813,function(_0x5e2dd0){return db['UserVoiceQueueRt'][_0x5159('0x8e')]({'membername':_0x5e2dd0[_0x5159('0x27')],'UserId':_0x5e2dd0['id'],'queue_name':_0x42afcc[_0x5159('0x27')],'VoiceQueueId':_0x42afcc['id'],'interface':_[_0x5159('0x8f')](_0x5e2dd0[_0x5159('0x8d')])?util[_0x5159('0x90')](_0x5159('0x91'),_0x5e2dd0[_0x5159('0x27')]):_0x5e2dd0[_0x5159('0x8d')],'paused':_0x5e2dd0[_0x5159('0x8c')]||![],'penalty':_0x42afcc[_0x5159('0x92')][_0x5159('0x88')]},{'transaction':_0x2f696c});});return Promise[_0x5159('0x93')](_0x36d50f);});});});return Promise[_0x5159('0x93')](_0x23c234);});return Promise['all'](_0x5bee9e);})[_0x5159('0x3f')](function(){return db['TeamVoicePrefix'][_0x5159('0x71')]({'where':{'teamId':_0x40ba88}})[_0x5159('0x3f')](function(_0x191200){if(_0x191200){var _0x5b3f4b=_[_0x5159('0x3c')](_0xca9a37,function(_0x3f7434){db[_0x5159('0x6e')]['upsert']({'UserId':_0x3f7434,'VoicePrefixId':_0x191200[_0x5159('0x6f')]});});return Promise[_0x5159('0x93')](_0x5b3f4b);}});});});return Promise[_0x5159('0x93')](_0x1b9b7f)['then'](function(){return _0x4f43d3['addAgents'](_0xca9a37,{'transaction':_0x2f696c})[_0x5159('0x94')](function(_0x32beea){return _0x32beea;});});});}})[_0x5159('0x3f')](respondWithResult(_0x3ca477,null))[_0x5159('0x46')](handleError(_0x3ca477,null));};exports['removeAgents']=function(_0x1ff168,_0x4a4c7e){var _0x1c97b0=_['isArray'](_0x1ff168[_0x5159('0x2f')][_0x5159('0x7d')])?_0x1ff168[_0x5159('0x2f')][_0x5159('0x7d')]:[_0x1ff168[_0x5159('0x2f')][_0x5159('0x7d')]];var _0x3a602c=_0x1ff168[_0x5159('0x53')]['id'];return db[_0x5159('0x2a')][_0x5159('0x52')]({'where':{'id':_0x3a602c}})[_0x5159('0x3f')](handleEntityNotFound(_0x4a4c7e,null))[_0x5159('0x3f')](function(_0x13b2af){if(_0x13b2af){var _0x49ab2a=[_0x5159('0x82'),_0x5159('0x95'),_0x5159('0x96'),_0x5159('0x97'),_0x5159('0x83'),_0x5159('0x98'),_0x5159('0x84')];return db[_0x5159('0x56')][_0x5159('0x55')](function(_0x3a638c){var _0x310a0e=_[_0x5159('0x3c')](_0x49ab2a,function(_0x12adb0){var _0x28ca55={'attributes':['id','name']};return _0x13b2af[_0x5159('0x49')+_0x12adb0+_0x5159('0x79')](_0x28ca55)['then'](function(_0x917efa){var _0xc9ac4c=_['map'](_0x917efa,function(_0x7deb37){return _0x7deb37['removeAgents'](_0x1c97b0,{'transaction':_0x3a638c})[_0x5159('0x3f')](function(){var _0x5a5f33=_[_0x5159('0x3c')](_0x1c97b0,function(_0x142d28){socket['emit'](_0x5159('0x48')+_0x12adb0+_0x5159('0x99'),{'UserId':Number(_0x142d28),[_0x12adb0+_0x5159('0x86')]:_0x7deb37['id']});if(_0x12adb0!=='Voice'){return;}return db[_0x5159('0x9a')][_0x5159('0x54')]({'where':{'VoiceQueueId':_0x7deb37['id'],'UserId':_0x142d28},'transaction':_0x3a638c});});return Promise['all'](_0x5a5f33);});});return Promise[_0x5159('0x93')](_0xc9ac4c);});});return Promise[_0x5159('0x93')](_0x310a0e)['then'](function(){return _0x13b2af[_0x5159('0x9b')](_0x1c97b0,{'transaction':_0x3a638c});})[_0x5159('0x3f')](function(){return db[_0x5159('0x6d')][_0x5159('0x71')]({'where':{'teamId':_0x3a602c}})['then'](function(_0x159754){if(_0x159754){var _0x410ef6=_[_0x5159('0x3c')](_0x1c97b0,function(_0x11f3cc){db['UserVoicePrefix'][_0x5159('0x54')]({'where':{'UserId':_0x11f3cc,'VoicePrefixId':_0x159754[_0x5159('0x6f')]}});});return Promise[_0x5159('0x93')](_0x410ef6);}});});});}})[_0x5159('0x3f')](respondWithStatusCode(_0x4a4c7e,null))[_0x5159('0x46')](handleError(_0x4a4c7e,null));};exports[_0x5159('0x9c')]=function(_0x5b24c8,_0x13040e,_0x30220c){var _0x270975={};var _0x288337={};var _0x5e3855;var _0x41942a;return db['Team'][_0x5159('0x71')]({'where':{'id':_0x5b24c8[_0x5159('0x53')]['id']}})[_0x5159('0x3f')](handleEntityNotFound(_0x13040e,null))['then'](function(_0x55e752){if(_0x55e752){_0x5e3855=_0x55e752;_0x288337[_0x5159('0x2e')]=_[_0x5159('0x75')](db[_0x5159('0x9d')][_0x5159('0x2b')]);_0x288337[_0x5159('0x2f')]=_[_0x5159('0x75')](_0x5b24c8[_0x5159('0x2f')]);_0x288337[_0x5159('0x30')]=_[_0x5159('0x31')](_0x288337['model'],_0x288337[_0x5159('0x2f')]);_0x270975[_0x5159('0x32')]=_[_0x5159('0x31')](_0x288337[_0x5159('0x2e')],qs[_0x5159('0x33')](_0x5b24c8[_0x5159('0x2f')]['fields']));_0x270975['attributes']=_0x270975[_0x5159('0x32')][_0x5159('0x34')]?_0x270975[_0x5159('0x32')]:_0x288337[_0x5159('0x2e')];_0x270975[_0x5159('0x37')]=qs['sort'](_0x5b24c8[_0x5159('0x2f')]['sort']);_0x270975[_0x5159('0x39')]=qs[_0x5159('0x30')](_[_0x5159('0x3a')](_0x5b24c8[_0x5159('0x2f')],_0x288337['filters']));if(_0x5b24c8[_0x5159('0x2f')]['filter']){_0x270975[_0x5159('0x39')]=_['merge'](_0x270975[_0x5159('0x39')],{'$or':_['map'](_0x270975[_0x5159('0x32')],function(_0x23b772){var _0x7529db={};_0x7529db[_0x23b772]={'$like':'%'+_0x5b24c8[_0x5159('0x2f')]['filter']+'%'};return _0x7529db;})});}_0x270975=_[_0x5159('0x45')]({},_0x270975,_0x5b24c8[_0x5159('0x3e')]);return _0x5e3855['getAgents'](_0x270975);}})['then'](function(_0x243004){if(_0x243004){_0x41942a=_0x243004[_0x5159('0x34')];if(!_0x5b24c8[_0x5159('0x2f')]['hasOwnProperty'](_0x5159('0x36'))){_0x270975[_0x5159('0x1e')]=qs[_0x5159('0x1e')](_0x5b24c8[_0x5159('0x2f')]['limit']);_0x270975['offset']=qs['offset'](_0x5b24c8['query'][_0x5159('0x1c')]);}return _0x5e3855[_0x5159('0x9c')](_0x270975);}})[_0x5159('0x3f')](function(_0x3d204f){if(_0x3d204f){return _0x3d204f?{'count':_0x41942a,'rows':_0x3d204f}:null;}})[_0x5159('0x3f')](respondWithResult(_0x13040e,null))[_0x5159('0x46')](handleError(_0x13040e,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 840ccbc..295eac1 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 _0xdcf1=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x52ce3b,_0x2d4e1d){var _0x4332ba=function(_0x3c4947){while(--_0x3c4947){_0x52ce3b['push'](_0x52ce3b['shift']());}};_0x4332ba(++_0x2d4e1d);}(_0xdcf1,0x73));var _0x1dcf=function(_0xa62163,_0x4a26fb){_0xa62163=_0xa62163-0x0;var _0x46b4fb=_0xdcf1[_0xa62163];return _0x46b4fb;};'use strict';var EventEmitter=require('events');var Team=require(_0x1dcf('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x1dcf('0x1')](0x0);var events={'afterCreate':_0x1dcf('0x2'),'afterUpdate':_0x1dcf('0x3'),'afterDestroy':_0x1dcf('0x4')};function emitEvent(_0x1a2ec9){return function(_0x5a1969,_0x21d8be,_0x437da7){TeamEvents['emit'](_0x1a2ec9+':'+_0x5a1969['id'],_0x5a1969);TeamEvents['emit'](_0x1a2ec9,_0x5a1969);_0x437da7(null);};}for(var e in events){if(events[_0x1dcf('0x5')](e)){var event=events[e];Team[_0x1dcf('0x6')](e,emitEvent(event));}}module[_0x1dcf('0x7')]=TeamEvents; \ No newline at end of file +var _0xc136=['Team','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2ff35a,_0x498908){var _0xd8ca94=function(_0x487fb2){while(--_0x487fb2){_0x2ff35a['push'](_0x2ff35a['shift']());}};_0xd8ca94(++_0x498908);}(_0xc136,0x8a));var _0x6c13=function(_0x5b1d47,_0x33f575){_0x5b1d47=_0x5b1d47-0x0;var _0x2194cc=_0xc136[_0x5b1d47];return _0x2194cc;};'use strict';var EventEmitter=require(_0x6c13('0x0'));var Team=require(_0x6c13('0x1'))['db'][_0x6c13('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x6c13('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6c13('0x4'),'afterDestroy':_0x6c13('0x5')};function emitEvent(_0x2038b3){return function(_0x26ee54,_0x1697c9,_0x6f915){TeamEvents[_0x6c13('0x6')](_0x2038b3+':'+_0x26ee54['id'],_0x26ee54);TeamEvents['emit'](_0x2038b3,_0x26ee54);_0x6f915(null);};}for(var e in events){if(events[_0x6c13('0x7')](e)){var event=events[e];Team[_0x6c13('0x8')](e,emitEvent(event));}}module[_0x6c13('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c0c51cf..c07477c 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 _0xbf2f=['Queues','then','setDataValue','exports','define','Chat','Fax','Mail','Sms','Voice','resolve','map','catch','lodash','./team.attributes'];(function(_0x1545d9,_0x58519d){var _0x5ec577=function(_0x67f707){while(--_0x67f707){_0x1545d9['push'](_0x1545d9['shift']());}};_0x5ec577(++_0x58519d);}(_0xbf2f,0x85));var _0xfbf2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbf2f[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xfbf2('0x0'));var attributes=require(_0xfbf2('0x1'));function getQueuesByChannel(_0x1c008b,_0x2d846d){var _0x36ab71='get'+_0x2d846d+_0xfbf2('0x2');return _0x1c008b[_0x36ab71]()[_0xfbf2('0x3')](function(_0x4021de){return _['map'](_0x4021de,function(_0x128c93){_0x128c93[_0xfbf2('0x4')]('channel',_0x2d846d);return _0x128c93;});})['catch'](function(_0x416397){throw _0x416397;});}module[_0xfbf2('0x5')]=function(_0x3e6056){return _0x3e6056[_0xfbf2('0x6')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xbae545=this;var _0x1f3a4f=[_0xfbf2('0x7'),_0xfbf2('0x8'),_0xfbf2('0x9'),'Openchannel',_0xfbf2('0xa'),_0xfbf2('0xb'),'Whatsapp'];return Promise[_0xfbf2('0xc')]()[_0xfbf2('0x3')](function(){var _0x2568d9=_[_0xfbf2('0xd')](_0x1f3a4f,function(_0x56dbb3){return getQueuesByChannel(_0xbae545,_0x56dbb3);});return Promise['all'](_0x2568d9);})[_0xfbf2('0xe')](function(_0x274816){throw _0x274816;});}}});}; \ No newline at end of file +var _0x2943=['Sms','Voice','catch','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','exports','define','Team','teams','Chat','Fax','Mail'];(function(_0x555132,_0x1b2e95){var _0x2c9499=function(_0x1214ad){while(--_0x1214ad){_0x555132['push'](_0x555132['shift']());}};_0x2c9499(++_0x1b2e95);}(_0x2943,0xed));var _0x3294=function(_0xd07e81,_0x1ccacd){_0xd07e81=_0xd07e81-0x0;var _0x379364=_0x2943[_0xd07e81];return _0x379364;};'use strict';var _=require(_0x3294('0x0'));var attributes=require(_0x3294('0x1'));function getQueuesByChannel(_0x2a3ef0,_0x63bfe2){var _0x37c8bc=_0x3294('0x2')+_0x63bfe2+_0x3294('0x3');return _0x2a3ef0[_0x37c8bc]()[_0x3294('0x4')](function(_0x10f7ed){return _[_0x3294('0x5')](_0x10f7ed,function(_0x5503a6){_0x5503a6[_0x3294('0x6')](_0x3294('0x7'),_0x63bfe2);return _0x5503a6;});})['catch'](function(_0x58c133){throw _0x58c133;});}module[_0x3294('0x8')]=function(_0x5f3e5e){return _0x5f3e5e[_0x3294('0x9')](_0x3294('0xa'),attributes,{'tableName':_0x3294('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x242842=this;var _0x21c1d3=[_0x3294('0xc'),_0x3294('0xd'),_0x3294('0xe'),'Openchannel',_0x3294('0xf'),_0x3294('0x10'),'Whatsapp'];return Promise['resolve']()[_0x3294('0x4')](function(){var _0x258777=_[_0x3294('0x5')](_0x21c1d3,function(_0x1226d8){return getQueuesByChannel(_0x242842,_0x1226d8);});return Promise['all'](_0x258777);})[_0x3294('0x11')](function(_0x46c0b7){throw _0x46c0b7;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 8b8c652..0161585 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 _0x5d8e=['socket.io-emitter','./team.socket','then','info','request\x20sent','debug','error','code','Team,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x5d8e,0x140));var _0xe5d8=function(_0x765b02,_0x1c6234){_0x765b02=_0x765b02-0x0;var _0x317a79=_0x5d8e[_0x765b02];return _0x317a79;};'use strict';var _=require('lodash');var util=require(_0xe5d8('0x0'));var moment=require(_0xe5d8('0x1'));var BPromise=require(_0xe5d8('0x2'));var rs=require(_0xe5d8('0x3'));var fs=require('fs');var Redis=require(_0xe5d8('0x4'));var db=require(_0xe5d8('0x5'))['db'];var utils=require(_0xe5d8('0x6'));var logger=require(_0xe5d8('0x7'))(_0xe5d8('0x8'));var config=require(_0xe5d8('0x9'));var jayson=require(_0xe5d8('0xa'));var client=jayson[_0xe5d8('0xb')][_0xe5d8('0xc')]({'port':0x232a});config[_0xe5d8('0xd')]=_[_0xe5d8('0xe')](config[_0xe5d8('0xd')],{'host':_0xe5d8('0xf'),'port':0x18eb});var socket=require(_0xe5d8('0x10'))(new Redis(config[_0xe5d8('0xd')]));require(_0xe5d8('0x11'))['register'](socket);function respondWithRpcPromise(_0xfaac99,_0x5953ea,_0x2f56ef){return new BPromise(function(_0x5a74fd,_0x48c4c6){return client['request'](_0xfaac99,_0x2f56ef)[_0xe5d8('0x12')](function(_0x1a064d){logger[_0xe5d8('0x13')]('Team,\x20%s,\x20%s',_0x5953ea,_0xe5d8('0x14'));logger[_0xe5d8('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x5953ea,_0xe5d8('0x14'),JSON['stringify'](_0x1a064d));if(_0x1a064d[_0xe5d8('0x16')]){if(_0x1a064d['error'][_0xe5d8('0x17')]===0x1f4){logger[_0xe5d8('0x16')](_0xe5d8('0x18'),_0x5953ea,_0x1a064d[_0xe5d8('0x16')][_0xe5d8('0x19')]);return _0x48c4c6(_0x1a064d[_0xe5d8('0x16')][_0xe5d8('0x19')]);}logger[_0xe5d8('0x16')](_0xe5d8('0x18'),_0x5953ea,_0x1a064d[_0xe5d8('0x16')][_0xe5d8('0x19')]);return _0x5a74fd(_0x1a064d[_0xe5d8('0x16')][_0xe5d8('0x19')]);}else{logger[_0xe5d8('0x13')](_0xe5d8('0x18'),_0x5953ea,_0xe5d8('0x14'));_0x5a74fd(_0x1a064d[_0xe5d8('0x1a')][_0xe5d8('0x19')]);}})[_0xe5d8('0x1b')](function(_0x1b50b1){logger[_0xe5d8('0x16')](_0xe5d8('0x18'),_0x5953ea,_0x1b50b1);_0x48c4c6(_0x1b50b1);});});} \ No newline at end of file +var _0x6f13=['info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./team.socket','register','then'];(function(_0x3878e9,_0x14fcf2){var _0x2ad526=function(_0x1bd76b){while(--_0x1bd76b){_0x3878e9['push'](_0x3878e9['shift']());}};_0x2ad526(++_0x14fcf2);}(_0x6f13,0x1f1));var _0x36f1=function(_0x45a3d2,_0x3e3c8a){_0x45a3d2=_0x45a3d2-0x0;var _0x2cf7d1=_0x6f13[_0x45a3d2];return _0x2cf7d1;};'use strict';var _=require(_0x36f1('0x0'));var util=require('util');var moment=require(_0x36f1('0x1'));var BPromise=require(_0x36f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36f1('0x3'))['db'];var utils=require(_0x36f1('0x4'));var logger=require(_0x36f1('0x5'))(_0x36f1('0x6'));var config=require(_0x36f1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x36f1('0x8')]['http']({'port':0x232a});config['redis']=_[_0x36f1('0x9')](config[_0x36f1('0xa')],{'host':_0x36f1('0xb'),'port':0x18eb});var socket=require(_0x36f1('0xc'))(new Redis(config[_0x36f1('0xa')]));require(_0x36f1('0xd'))[_0x36f1('0xe')](socket);function respondWithRpcPromise(_0x163425,_0x4463df,_0x5d9162){return new BPromise(function(_0x2a1e59,_0xe7f126){return client['request'](_0x163425,_0x5d9162)[_0x36f1('0xf')](function(_0x494f4b){logger[_0x36f1('0x10')](_0x36f1('0x11'),_0x4463df,_0x36f1('0x12'));logger[_0x36f1('0x13')](_0x36f1('0x14'),_0x4463df,_0x36f1('0x12'),JSON[_0x36f1('0x15')](_0x494f4b));if(_0x494f4b['error']){if(_0x494f4b[_0x36f1('0x16')][_0x36f1('0x17')]===0x1f4){logger['error'](_0x36f1('0x11'),_0x4463df,_0x494f4b[_0x36f1('0x16')]['message']);return _0xe7f126(_0x494f4b[_0x36f1('0x16')][_0x36f1('0x18')]);}logger[_0x36f1('0x16')](_0x36f1('0x11'),_0x4463df,_0x494f4b[_0x36f1('0x16')][_0x36f1('0x18')]);return _0x2a1e59(_0x494f4b[_0x36f1('0x16')][_0x36f1('0x18')]);}else{logger['info'](_0x36f1('0x11'),_0x4463df,_0x36f1('0x12'));_0x2a1e59(_0x494f4b[_0x36f1('0x19')][_0x36f1('0x18')]);}})[_0x36f1('0x1a')](function(_0x1262c9){logger[_0x36f1('0x16')](_0x36f1('0x11'),_0x4463df,_0x1262c9);_0xe7f126(_0x1262c9);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 7d6d707..919e245 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 _0x287b=['register','length','team:','./team.events','remove','update','emit'];(function(_0x51d105,_0x2cbd1b){var _0x132946=function(_0x14a28b){while(--_0x14a28b){_0x51d105['push'](_0x51d105['shift']());}};_0x132946(++_0x2cbd1b);}(_0x287b,0x96));var _0xb287=function(_0x3cfb0d,_0x4df584){_0x3cfb0d=_0x3cfb0d-0x0;var _0x3486b4=_0x287b[_0x3cfb0d];return _0x3486b4;};'use strict';var TeamEvents=require(_0xb287('0x0'));var events=['save',_0xb287('0x1'),_0xb287('0x2')];function createListener(_0xd029b9,_0x5bd0fc){return function(_0x485a03){_0x5bd0fc[_0xb287('0x3')](_0xd029b9,_0x485a03);};}function removeListener(_0x5a5711,_0x37b46a){return function(){TeamEvents['removeListener'](_0x5a5711,_0x37b46a);};}exports[_0xb287('0x4')]=function(_0xc6c172){for(var _0x130648=0x0,_0x3b442a=events[_0xb287('0x5')];_0x130648<_0x3b442a;_0x130648++){var _0x1fcbd7=events[_0x130648];var _0x2a5111=createListener(_0xb287('0x6')+_0x1fcbd7,_0xc6c172);TeamEvents['on'](_0x1fcbd7,_0x2a5111);}}; \ No newline at end of file +var _0xfd07=['./team.events','save','emit','register','team:'];(function(_0x261488,_0x399cdd){var _0x104998=function(_0x4f7a0a){while(--_0x4f7a0a){_0x261488['push'](_0x261488['shift']());}};_0x104998(++_0x399cdd);}(_0xfd07,0x104));var _0x7fd0=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0xfd07[_0x402c8f];return _0x11e809;};'use strict';var TeamEvents=require(_0x7fd0('0x0'));var events=[_0x7fd0('0x1'),'remove','update'];function createListener(_0x4da5d2,_0x50895a){return function(_0x1eaaf3){_0x50895a[_0x7fd0('0x2')](_0x4da5d2,_0x1eaaf3);};}function removeListener(_0x4240ef,_0x52de97){return function(){TeamEvents['removeListener'](_0x4240ef,_0x52de97);};}exports[_0x7fd0('0x3')]=function(_0x245329){for(var _0x40d823=0x0,_0x34eca6=events['length'];_0x40d823<_0x34eca6;_0x40d823++){var _0x288561=events[_0x40d823];var _0x3407b6=createListener(_0x7fd0('0x4')+_0x288561,_0x245329);TeamEvents['on'](_0x288561,_0x3407b6);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 1030b29..8d8587a 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 _0x7914=['exports','INTEGER','sequelize'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x7914,0x107));var _0x4791=function(_0x4cda9f,_0x1c4b00){_0x4cda9f=_0x4cda9f-0x0;var _0x3c5b24=_0x7914[_0x4cda9f];return _0x3c5b24;};'use strict';var Sequelize=require(_0x4791('0x0'));module[_0x4791('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x4791('0x2')]}}; \ No newline at end of file +var _0x3238=['sequelize','INTEGER'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x3238,0x13e));var _0x8323=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3238[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8323('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x8323('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x8323('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 65ac2e0..d94fa43 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 _0x5269=['lodash','bluebird','request-promise','path','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x53fc2f,_0x409dad){var _0x17f3b5=function(_0x18626e){while(--_0x18626e){_0x53fc2f['push'](_0x53fc2f['shift']());}};_0x17f3b5(++_0x409dad);}(_0x5269,0x150));var _0x9526=function(_0x49c153,_0x1d7985){_0x49c153=_0x49c153-0x0;var _0x34b8b9=_0x5269[_0x49c153];return _0x34b8b9;};'use strict';var _=require(_0x9526('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9526('0x1'));var rp=require(_0x9526('0x2'));var fs=require('fs');var path=require(_0x9526('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9526('0x4'));module['exports']=function(_0x15d394,_0x9cf5eb){return _0x15d394[_0x9526('0x5')](_0x9526('0x6'),attributes,{'tableName':_0x9526('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9861=['TeamVoicePrefix','team_has_voice_prefixes','lodash','api','moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','exports','define'];(function(_0x599f13,_0x1c0140){var _0x1ebd6a=function(_0x598f23){while(--_0x598f23){_0x599f13['push'](_0x599f13['shift']());}};_0x1ebd6a(++_0x1c0140);}(_0x9861,0x176));var _0x1986=function(_0x503429,_0x3a335a){_0x503429=_0x503429-0x0;var _0x4bd146=_0x9861[_0x503429];return _0x4bd146;};'use strict';var _=require(_0x1986('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1986('0x1'));var moment=require(_0x1986('0x2'));var BPromise=require(_0x1986('0x3'));var rp=require(_0x1986('0x4'));var fs=require('fs');var path=require(_0x1986('0x5'));var rimraf=require(_0x1986('0x6'));var config=require('../../config/environment');var attributes=require(_0x1986('0x7'));module[_0x1986('0x8')]=function(_0x1b56d6,_0x17ccbf){return _0x1b56d6[_0x1986('0x9')](_0x1986('0xa'),attributes,{'tableName':_0x1986('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 8c023d5..b664769 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x366cd5,_0x10f6ae){var _0x164df6=function(_0x4c9f25){while(--_0x4c9f25){_0x366cd5['push'](_0x366cd5['shift']());}};_0x164df6(++_0x10f6ae);}(_0xe706,0xa3));var _0x6e70=function(_0x3592ab,_0x4f669a){_0x3592ab=_0x3592ab-0x0;var _0x13298a=_0xe706[_0x3592ab];return _0x13298a;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x215cbe,_0x2036a3){var _0x6b217c=function(_0x3f822b){while(--_0x3f822b){_0x215cbe['push'](_0x215cbe['shift']());}};_0x6b217c(++_0x2036a3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xcb91[_0x5e6ea3];return _0x4048b5;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 93eda30..6d031a0 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 _0xf696=['exports','INTEGER'];(function(_0x1d15fc,_0x4b6ce4){var _0x550924=function(_0x436e0c){while(--_0x436e0c){_0x1d15fc['push'](_0x1d15fc['shift']());}};_0x550924(++_0x4b6ce4);}(_0xf696,0x110));var _0x6f69=function(_0x405d8c,_0x38045a){_0x405d8c=_0x405d8c-0x0;var _0x2c7d48=_0xf696[_0x405d8c];return _0x2c7d48;};'use strict';var Sequelize=require('sequelize');module[_0x6f69('0x0')]={'penalty':{'type':Sequelize[_0x6f69('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0d23=['INTEGER','sequelize','exports'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x0d23,0xe8));var _0x30d2=function(_0x48ffd0,_0x2cbdd0){_0x48ffd0=_0x48ffd0-0x0;var _0x226298=_0x0d23[_0x48ffd0];return _0x226298;};'use strict';var Sequelize=require(_0x30d2('0x0'));module[_0x30d2('0x1')]={'penalty':{'type':Sequelize[_0x30d2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index d80b868..07c284d 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 _0xb201=['team_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue'];(function(_0x5cddc0,_0x435d92){var _0x367d53=function(_0x479e03){while(--_0x479e03){_0x5cddc0['push'](_0x5cddc0['shift']());}};_0x367d53(++_0x435d92);}(_0xb201,0x1b1));var _0x1b20=function(_0x547b54,_0x33b195){_0x547b54=_0x547b54-0x0;var _0x190a92=_0xb201[_0x547b54];return _0x190a92;};'use strict';var _=require(_0x1b20('0x0'));var util=require('util');var logger=require(_0x1b20('0x1'))(_0x1b20('0x2'));var moment=require(_0x1b20('0x3'));var BPromise=require(_0x1b20('0x4'));var rp=require(_0x1b20('0x5'));var fs=require('fs');var path=require(_0x1b20('0x6'));var rimraf=require('rimraf');var config=require(_0x1b20('0x7'));var attributes=require(_0x1b20('0x8'));module[_0x1b20('0x9')]=function(_0x4da5a7,_0x29fbc1){return _0x4da5a7['define'](_0x1b20('0xa'),attributes,{'tableName':_0x1b20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1928=['exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0x1928,0x138));var _0x8192=function(_0x254756,_0x2128c2){_0x254756=_0x254756-0x0;var _0x4dd33e=_0x1928[_0x254756];return _0x4dd33e;};'use strict';var _=require(_0x8192('0x0'));var util=require(_0x8192('0x1'));var logger=require(_0x8192('0x2'))('api');var moment=require(_0x8192('0x3'));var BPromise=require(_0x8192('0x4'));var rp=require(_0x8192('0x5'));var fs=require('fs');var path=require(_0x8192('0x6'));var rimraf=require(_0x8192('0x7'));var config=require(_0x8192('0x8'));var attributes=require(_0x8192('0x9'));module[_0x8192('0xa')]=function(_0x426163,_0x25f90e){return _0x426163[_0x8192('0xb')](_0x8192('0xc'),attributes,{'tableName':_0x8192('0xd'),'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 32b5409..d8e5a99 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 _0x2ec0=['jayson/promise','client','request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2e63bb,_0x4a045b){var _0x655792=function(_0x2319bd){while(--_0x2319bd){_0x2e63bb['push'](_0x2e63bb['shift']());}};_0x655792(++_0x4a045b);}(_0x2ec0,0x69));var _0x02ec=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x2ec0[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require(_0x02ec('0x0'));var util=require(_0x02ec('0x1'));var moment=require(_0x02ec('0x2'));var BPromise=require(_0x02ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02ec('0x4'));var db=require(_0x02ec('0x5'))['db'];var utils=require(_0x02ec('0x6'));var logger=require(_0x02ec('0x7'))(_0x02ec('0x8'));var config=require(_0x02ec('0x9'));var jayson=require(_0x02ec('0xa'));var client=jayson[_0x02ec('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3da01f,_0x33ab31,_0x4898d2){return new BPromise(function(_0xbb651d,_0x3f34a2){return client[_0x02ec('0xc')](_0x3da01f,_0x4898d2)['then'](function(_0x1180b9){logger['info'](_0x02ec('0xd'),_0x33ab31,_0x02ec('0xe'));logger[_0x02ec('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x33ab31,_0x02ec('0xe'),JSON[_0x02ec('0x10')](_0x1180b9));if(_0x1180b9[_0x02ec('0x11')]){if(_0x1180b9[_0x02ec('0x11')][_0x02ec('0x12')]===0x1f4){logger[_0x02ec('0x11')](_0x02ec('0xd'),_0x33ab31,_0x1180b9['error'][_0x02ec('0x13')]);return _0x3f34a2(_0x1180b9['error'][_0x02ec('0x13')]);}logger[_0x02ec('0x11')](_0x02ec('0xd'),_0x33ab31,_0x1180b9['error'][_0x02ec('0x13')]);return _0xbb651d(_0x1180b9[_0x02ec('0x11')][_0x02ec('0x13')]);}else{logger[_0x02ec('0x14')]('TeamVoiceQueue,\x20%s,\x20%s',_0x33ab31,_0x02ec('0xe'));_0xbb651d(_0x1180b9[_0x02ec('0x15')][_0x02ec('0x13')]);}})[_0x02ec('0x16')](function(_0x2747c7){logger[_0x02ec('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x33ab31,_0x2747c7);_0x3f34a2(_0x2747c7);});});} \ No newline at end of file +var _0x98d3=['client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise'];(function(_0x14dd93,_0x24cd9a){var _0x56c548=function(_0x45afa2){while(--_0x45afa2){_0x14dd93['push'](_0x14dd93['shift']());}};_0x56c548(++_0x24cd9a);}(_0x98d3,0x173));var _0x398d=function(_0x2d1489,_0x3ace0f){_0x2d1489=_0x2d1489-0x0;var _0x594de9=_0x98d3[_0x2d1489];return _0x594de9;};'use strict';var _=require(_0x398d('0x0'));var util=require(_0x398d('0x1'));var moment=require('moment');var BPromise=require(_0x398d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x398d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x398d('0x4'));var logger=require(_0x398d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x398d('0x6'));var client=jayson[_0x398d('0x7')][_0x398d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x502652,_0x4ba1a3,_0x391d99){return new BPromise(function(_0x3029f3,_0x399598){return client[_0x398d('0x9')](_0x502652,_0x391d99)['then'](function(_0x3a1934){logger[_0x398d('0xa')](_0x398d('0xb'),_0x4ba1a3,_0x398d('0xc'));logger[_0x398d('0xd')](_0x398d('0xe'),_0x4ba1a3,_0x398d('0xc'),JSON[_0x398d('0xf')](_0x3a1934));if(_0x3a1934['error']){if(_0x3a1934[_0x398d('0x10')][_0x398d('0x11')]===0x1f4){logger[_0x398d('0x10')](_0x398d('0xb'),_0x4ba1a3,_0x3a1934[_0x398d('0x10')][_0x398d('0x12')]);return _0x399598(_0x3a1934[_0x398d('0x10')][_0x398d('0x12')]);}logger[_0x398d('0x10')](_0x398d('0xb'),_0x4ba1a3,_0x3a1934[_0x398d('0x10')]['message']);return _0x3029f3(_0x3a1934['error'][_0x398d('0x12')]);}else{logger[_0x398d('0xa')](_0x398d('0xb'),_0x4ba1a3,_0x398d('0xc'));_0x3029f3(_0x3a1934[_0x398d('0x13')][_0x398d('0x12')]);}})[_0x398d('0x14')](function(_0x3c151a){logger['error'](_0x398d('0xb'),_0x4ba1a3,_0x3c151a);_0x399598(_0x3c151a);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 733c8a2..d677c8c 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 _0x556a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x9341df,_0x5e689a){var _0x30f5df=function(_0x5c30ca){while(--_0x5c30ca){_0x9341df['push'](_0x9341df['shift']());}};_0x30f5df(++_0x5e689a);}(_0x556a,0x1dd));var _0xa556=function(_0xcdf752,_0x51b609){_0xcdf752=_0xcdf752-0x0;var _0x21448e=_0x556a[_0xcdf752];return _0x21448e;};'use strict';var multer=require(_0xa556('0x0'));var util=require(_0xa556('0x1'));var path=require(_0xa556('0x2'));var timeout=require(_0xa556('0x3'));var express=require(_0xa556('0x4'));var router=express[_0xa556('0x5')]();var fs_extra=require(_0xa556('0x6'));var auth=require(_0xa556('0x7'));var interaction=require(_0xa556('0x8'));var config=require('../../config/environment');var controller=require(_0xa556('0x9'));router[_0xa556('0xa')]('/',auth[_0xa556('0xb')](),controller[_0xa556('0xc')]);router[_0xa556('0xa')]('/:id',auth[_0xa556('0xb')](),controller[_0xa556('0xd')]);router[_0xa556('0xe')]('/',auth[_0xa556('0xb')](),controller['create']);router[_0xa556('0xf')](_0xa556('0x10'),auth[_0xa556('0xb')](),controller[_0xa556('0x11')]);router[_0xa556('0x12')](_0xa556('0x10'),auth[_0xa556('0xb')](),controller[_0xa556('0x13')]);module['exports']=router; \ No newline at end of file +var _0xcaef=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','put','update','delete','/:id','destroy','exports','util','path'];(function(_0x1ed555,_0x163bb2){var _0x2ade3d=function(_0x26cea2){while(--_0x26cea2){_0x1ed555['push'](_0x1ed555['shift']());}};_0x2ade3d(++_0x163bb2);}(_0xcaef,0x1c9));var _0xfcae=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xcaef[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require(_0xfcae('0x0'));var path=require(_0xfcae('0x1'));var timeout=require(_0xfcae('0x2'));var express=require(_0xfcae('0x3'));var router=express['Router']();var fs_extra=require(_0xfcae('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfcae('0x5'));var config=require(_0xfcae('0x6'));var controller=require('./template.controller');router[_0xfcae('0x7')]('/',auth[_0xfcae('0x8')](),controller['index']);router[_0xfcae('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xfcae('0x9')]);router[_0xfcae('0xa')]('/',auth[_0xfcae('0x8')](),controller['create']);router[_0xfcae('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xfcae('0xc')]);router[_0xfcae('0xd')](_0xfcae('0xe'),auth[_0xfcae('0x8')](),controller[_0xfcae('0xf')]);module[_0xfcae('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index bf9197f..6e8c205 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 _0xcf5a=['exports','STRING','TEXT'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcf5a,0xa5));var _0xacf5=function(_0x40b6cc,_0xefdcc5){_0x40b6cc=_0x40b6cc-0x0;var _0x566d9d=_0xcf5a[_0x40b6cc];return _0x566d9d;};'use strict';var Sequelize=require('sequelize');module[_0xacf5('0x0')]={'name':{'type':Sequelize[_0xacf5('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xacf5('0x2')]}}; \ No newline at end of file +var _0x5da1=['TEXT','exports','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5da1,0x1db));var _0x15da=function(_0x283247,_0x13d744){_0x283247=_0x283247-0x0;var _0x3be30=_0x5da1[_0x283247];return _0x3be30;};'use strict';var Sequelize=require('sequelize');module[_0x15da('0x0')]={'name':{'type':Sequelize[_0x15da('0x1')]},'description':{'type':Sequelize[_0x15da('0x1')]},'html':{'type':Sequelize[_0x15da('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 87cb1f9..5659f50 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 _0x29e9=['Template','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Templates','UserProfileSection','userProfileId','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map'];(function(_0x1f8c74,_0x484f95){var _0x1daf66=function(_0x4a21e1){while(--_0x4a21e1){_0x1f8c74['push'](_0x1f8c74['shift']());}};_0x1daf66(++_0x484f95);}(_0x29e9,0x1ba));var _0x929e=function(_0x3acd36,_0x31a9c5){_0x3acd36=_0x3acd36-0x0;var _0x463cf4=_0x29e9[_0x3acd36];return _0x463cf4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x929e('0x0'));var zipdir=require(_0x929e('0x1'));var jsonpatch=require(_0x929e('0x2'));var rp=require(_0x929e('0x3'));var moment=require(_0x929e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x929e('0x5'));var util=require('util');var path=require(_0x929e('0x6'));var sox=require(_0x929e('0x7'));var csv=require('to-csv');var ejs=require(_0x929e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x929e('0x9'));var crypto=require(_0x929e('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x929e('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x929e('0xc'));var as=require(_0x929e('0xd'));var hardwareService=require(_0x929e('0xe'));var logger=require(_0x929e('0xf'))(_0x929e('0x10'));var utils=require(_0x929e('0x11'));var config=require(_0x929e('0x12'));var licenseUtil=require(_0x929e('0x13'));var db=require(_0x929e('0x14'))['db'];function respondWithStatusCode(_0x12ecd5,_0x27b4ad){_0x27b4ad=_0x27b4ad||0xcc;return function(_0x6cc478){if(_0x6cc478){return _0x12ecd5[_0x929e('0x15')](_0x27b4ad);}return _0x12ecd5[_0x929e('0x16')](_0x27b4ad)[_0x929e('0x17')]();};}function respondWithResult(_0x12de2c,_0x195d0a){_0x195d0a=_0x195d0a||0xc8;return function(_0x5b85b2){if(_0x5b85b2){return _0x12de2c[_0x929e('0x16')](_0x195d0a)[_0x929e('0x18')](_0x5b85b2);}};}function respondWithFilteredResult(_0x47262b,_0x4acc4f){return function(_0x540e94){if(_0x540e94){var _0x18b56d=typeof _0x4acc4f[_0x929e('0x19')]==='undefined'&&typeof _0x4acc4f[_0x929e('0x1a')]===_0x929e('0x1b');var _0x4c2608=_0x540e94['count'];var _0x577391=_0x18b56d?0x0:_0x4acc4f[_0x929e('0x19')];var _0x2e43ea=_0x18b56d?_0x540e94[_0x929e('0x1c')]:_0x4acc4f['offset']+_0x4acc4f['limit'];var _0xbed77d;if(_0x2e43ea>=_0x4c2608){_0x2e43ea=_0x4c2608;_0xbed77d=0xc8;}else{_0xbed77d=0xce;}_0x47262b[_0x929e('0x16')](_0xbed77d);return _0x47262b[_0x929e('0x1d')](_0x929e('0x1e'),_0x577391+'-'+_0x2e43ea+'/'+_0x4c2608)['json'](_0x540e94);}return null;};}function patchUpdates(_0x4d9d3c){return function(_0x5d5d75){try{jsonpatch['apply'](_0x5d5d75,_0x4d9d3c,!![]);}catch(_0x4ba2ac){return BPromise[_0x929e('0x1f')](_0x4ba2ac);}return _0x5d5d75[_0x929e('0x20')]();};}function saveUpdates(_0x44ab56,_0x22d7be){return function(_0x594773){if(_0x594773){return _0x594773[_0x929e('0x21')](_0x44ab56)[_0x929e('0x22')](function(_0x38355c){return _0x38355c;});}return null;};}function removeEntity(_0x41b15b,_0x30bcff){return function(_0x1b05b7){if(_0x1b05b7){return _0x1b05b7[_0x929e('0x23')]()[_0x929e('0x22')](function(){var _0x286c17=_0x1b05b7[_0x929e('0x24')]({'plain':!![]});var _0x59d037='Templates';return db[_0x929e('0x25')][_0x929e('0x23')]({'where':{'type':_0x59d037,'resourceId':_0x286c17['id']}})[_0x929e('0x22')](function(){return _0x1b05b7;});})[_0x929e('0x22')](function(){_0x41b15b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f0bd,_0x46b624){return function(_0x4cd37e){if(!_0x4cd37e){_0x21f0bd['sendStatus'](0x194);}return _0x4cd37e;};}function handleError(_0x6d588c,_0x2fdae5){_0x2fdae5=_0x2fdae5||0x1f4;return function(_0x41dab5){logger[_0x929e('0x26')](_0x41dab5[_0x929e('0x27')]);if(_0x41dab5['name']){delete _0x41dab5[_0x929e('0x28')];}_0x6d588c['status'](_0x2fdae5)[_0x929e('0x29')](_0x41dab5);};}exports[_0x929e('0x2a')]=function(_0x719f79,_0x462a89){var _0x4e8783={},_0x3d89ad={},_0x464bb7={'count':0x0,'rows':[]};var _0x23ddef=_[_0x929e('0x2b')](db[_0x929e('0x2c')][_0x929e('0x2d')],function(_0x2cc1cd){return{'name':_0x2cc1cd[_0x929e('0x2e')],'type':_0x2cc1cd['type'][_0x929e('0x2f')]};});_0x3d89ad[_0x929e('0x30')]=_[_0x929e('0x2b')](_0x23ddef,_0x929e('0x28'));_0x3d89ad[_0x929e('0x31')]=_[_0x929e('0x32')](_0x719f79[_0x929e('0x31')]);_0x3d89ad['filters']=_[_0x929e('0x33')](_0x3d89ad[_0x929e('0x30')],_0x3d89ad[_0x929e('0x31')]);_0x4e8783['attributes']=_[_0x929e('0x33')](_0x3d89ad[_0x929e('0x30')],qs[_0x929e('0x34')](_0x719f79[_0x929e('0x31')]['fields']));_0x4e8783[_0x929e('0x35')]=_0x4e8783[_0x929e('0x35')][_0x929e('0x36')]?_0x4e8783[_0x929e('0x35')]:_0x3d89ad[_0x929e('0x30')];if(!_0x719f79['query'][_0x929e('0x37')]('nolimit')){_0x4e8783['limit']=qs['limit'](_0x719f79[_0x929e('0x31')][_0x929e('0x1a')]);_0x4e8783[_0x929e('0x19')]=qs[_0x929e('0x19')](_0x719f79[_0x929e('0x31')][_0x929e('0x19')]);}_0x4e8783['order']=qs['sort'](_0x719f79['query']['sort']);_0x4e8783[_0x929e('0x38')]=qs[_0x929e('0x39')](_[_0x929e('0x3a')](_0x719f79[_0x929e('0x31')],_0x3d89ad[_0x929e('0x39')]),_0x23ddef);if(_0x719f79[_0x929e('0x31')][_0x929e('0x3b')]){_0x4e8783['where']=_[_0x929e('0x3c')](_0x4e8783[_0x929e('0x38')],{'$or':_[_0x929e('0x2b')](_0x23ddef,function(_0x3118d0){if(_0x3118d0[_0x929e('0x3d')]!==_0x929e('0x3e')){var _0x524e27={};_0x524e27[_0x3118d0[_0x929e('0x28')]]={'$like':'%'+_0x719f79[_0x929e('0x31')]['filter']+'%'};return _0x524e27;}})});}_0x4e8783=_[_0x929e('0x3c')]({},_0x4e8783,_0x719f79[_0x929e('0x3f')]);var _0x861dec={'where':_0x4e8783['where']};return db['Template'][_0x929e('0x1c')](_0x861dec)[_0x929e('0x22')](function(_0x321534){_0x464bb7[_0x929e('0x1c')]=_0x321534;if(_0x719f79[_0x929e('0x31')]['includeAll']){_0x4e8783[_0x929e('0x40')]=[{'all':!![]}];}return db['Template'][_0x929e('0x41')](_0x4e8783);})[_0x929e('0x22')](function(_0x311e5b){_0x464bb7[_0x929e('0x42')]=_0x311e5b;return _0x464bb7;})[_0x929e('0x22')](respondWithFilteredResult(_0x462a89,_0x4e8783))['catch'](handleError(_0x462a89,null));};exports[_0x929e('0x43')]=function(_0x46dc90,_0xc5ed59){var _0x324592={'raw':!![],'where':{'id':_0x46dc90[_0x929e('0x44')]['id']}},_0x3f40a6={};_0x3f40a6[_0x929e('0x30')]=_[_0x929e('0x32')](db[_0x929e('0x2c')][_0x929e('0x2d')]);_0x3f40a6[_0x929e('0x31')]=_['keys'](_0x46dc90[_0x929e('0x31')]);_0x3f40a6['filters']=_[_0x929e('0x33')](_0x3f40a6[_0x929e('0x30')],_0x3f40a6[_0x929e('0x31')]);_0x324592[_0x929e('0x35')]=_[_0x929e('0x33')](_0x3f40a6[_0x929e('0x30')],qs[_0x929e('0x34')](_0x46dc90['query'][_0x929e('0x34')]));_0x324592[_0x929e('0x35')]=_0x324592[_0x929e('0x35')][_0x929e('0x36')]?_0x324592['attributes']:_0x3f40a6[_0x929e('0x30')];if(_0x46dc90[_0x929e('0x31')][_0x929e('0x45')]){_0x324592['include']=[{'all':!![]}];}_0x324592=_['merge']({},_0x324592,_0x46dc90['options']);return db[_0x929e('0x2c')][_0x929e('0x46')](_0x324592)[_0x929e('0x22')](handleEntityNotFound(_0xc5ed59,null))[_0x929e('0x22')](respondWithResult(_0xc5ed59,null))[_0x929e('0x47')](handleError(_0xc5ed59,null));};exports[_0x929e('0x48')]=function(_0x287913,_0x5c6cdd){return db[_0x929e('0x2c')][_0x929e('0x48')](_0x287913[_0x929e('0x49')],{})['then'](function(_0x5a05f5){var _0x6916c7=_0x287913['user']['get']({'plain':!![]});if(!_0x6916c7)throw new Error(_0x929e('0x4a'));if(_0x6916c7[_0x929e('0x4b')]===_0x929e('0x4c')){var _0x4b47e9=_0x5a05f5[_0x929e('0x24')]({'plain':!![]});var _0x1ddcec=_0x929e('0x4d');return db[_0x929e('0x4e')]['find']({'where':{'name':_0x1ddcec,'userProfileId':_0x6916c7[_0x929e('0x4f')]},'raw':!![]})['then'](function(_0x246de4){if(_0x246de4&&_0x246de4[_0x929e('0x50')]===0x0){return db[_0x929e('0x25')][_0x929e('0x48')]({'name':_0x4b47e9[_0x929e('0x28')],'resourceId':_0x4b47e9['id'],'type':_0x246de4[_0x929e('0x28')],'sectionId':_0x246de4['id']},{})[_0x929e('0x22')](function(){return _0x5a05f5;});}else{return _0x5a05f5;}})['catch'](function(_0xadc8e5){logger[_0x929e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xadc8e5);throw _0xadc8e5;});}return _0x5a05f5;})[_0x929e('0x22')](respondWithResult(_0x5c6cdd,0xc9))['catch'](handleError(_0x5c6cdd,null));};exports[_0x929e('0x21')]=function(_0x2420ec,_0x5fea20){if(_0x2420ec[_0x929e('0x49')]['id']){delete _0x2420ec[_0x929e('0x49')]['id'];}return db[_0x929e('0x2c')][_0x929e('0x46')]({'where':{'id':_0x2420ec['params']['id']}})[_0x929e('0x22')](handleEntityNotFound(_0x5fea20,null))[_0x929e('0x22')](saveUpdates(_0x2420ec[_0x929e('0x49')],null))['then'](respondWithResult(_0x5fea20,null))[_0x929e('0x47')](handleError(_0x5fea20,null));};exports[_0x929e('0x23')]=function(_0xe8beb1,_0x2f0a36){return db[_0x929e('0x2c')][_0x929e('0x46')]({'where':{'id':_0xe8beb1[_0x929e('0x44')]['id']}})[_0x929e('0x22')](handleEntityNotFound(_0x2f0a36,null))[_0x929e('0x22')](removeEntity(_0x2f0a36,null))['catch'](handleError(_0x2f0a36,null));}; \ No newline at end of file +var _0x5721=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','apply','reject','update','then','get','Templates','UserProfileResource','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','Template','includeAll','include','findAll','rows','catch','show','params','create','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5721,0xe0));var _0x1572=function(_0x25819f,_0x400f96){_0x25819f=_0x25819f-0x0;var _0x140283=_0x5721[_0x25819f];return _0x140283;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1572('0x0'));var zipdir=require(_0x1572('0x1'));var jsonpatch=require(_0x1572('0x2'));var rp=require(_0x1572('0x3'));var moment=require(_0x1572('0x4'));var BPromise=require(_0x1572('0x5'));var Mustache=require(_0x1572('0x6'));var util=require(_0x1572('0x7'));var path=require(_0x1572('0x8'));var sox=require(_0x1572('0x9'));var csv=require(_0x1572('0xa'));var ejs=require(_0x1572('0xb'));var fs=require('fs');var fs_extra=require(_0x1572('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1572('0xd'));var jsforce=require(_0x1572('0xe'));var deskjs=require(_0x1572('0xf'));var toCsv=require(_0x1572('0xa'));var querystring=require(_0x1572('0x10'));var Papa=require(_0x1572('0x11'));var Redis=require(_0x1572('0x12'));var authService=require(_0x1572('0x13'));var qs=require(_0x1572('0x14'));var as=require(_0x1572('0x15'));var hardwareService=require(_0x1572('0x16'));var logger=require(_0x1572('0x17'))('api');var utils=require(_0x1572('0x18'));var config=require(_0x1572('0x19'));var licenseUtil=require(_0x1572('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x162863,_0x3dd056){_0x3dd056=_0x3dd056||0xcc;return function(_0x4212d5){if(_0x4212d5){return _0x162863[_0x1572('0x1b')](_0x3dd056);}return _0x162863[_0x1572('0x1c')](_0x3dd056)[_0x1572('0x1d')]();};}function respondWithResult(_0xa990aa,_0x44fb9b){_0x44fb9b=_0x44fb9b||0xc8;return function(_0x16c65c){if(_0x16c65c){return _0xa990aa['status'](_0x44fb9b)[_0x1572('0x1e')](_0x16c65c);}};}function respondWithFilteredResult(_0x144fd5,_0x31d788){return function(_0x1c21ce){if(_0x1c21ce){var _0x3e612b=typeof _0x31d788[_0x1572('0x1f')]==='undefined'&&typeof _0x31d788[_0x1572('0x20')]==='undefined';var _0x1bc265=_0x1c21ce[_0x1572('0x21')];var _0x5f5341=_0x3e612b?0x0:_0x31d788[_0x1572('0x1f')];var _0x4260bf=_0x3e612b?_0x1c21ce[_0x1572('0x21')]:_0x31d788['offset']+_0x31d788[_0x1572('0x20')];var _0x4cd5a6;if(_0x4260bf>=_0x1bc265){_0x4260bf=_0x1bc265;_0x4cd5a6=0xc8;}else{_0x4cd5a6=0xce;}_0x144fd5['status'](_0x4cd5a6);return _0x144fd5[_0x1572('0x22')]('Content-Range',_0x5f5341+'-'+_0x4260bf+'/'+_0x1bc265)[_0x1572('0x1e')](_0x1c21ce);}return null;};}function patchUpdates(_0x406559){return function(_0x1db825){try{jsonpatch[_0x1572('0x23')](_0x1db825,_0x406559,!![]);}catch(_0x25747a){return BPromise[_0x1572('0x24')](_0x25747a);}return _0x1db825['save']();};}function saveUpdates(_0x4976fe,_0x5a5503){return function(_0x4e3bdd){if(_0x4e3bdd){return _0x4e3bdd[_0x1572('0x25')](_0x4976fe)[_0x1572('0x26')](function(_0x5f068f){return _0x5f068f;});}return null;};}function removeEntity(_0x2ba9c3,_0x2911c6){return function(_0x1d1bb7){if(_0x1d1bb7){return _0x1d1bb7['destroy']()['then'](function(){var _0x28b12b=_0x1d1bb7[_0x1572('0x27')]({'plain':!![]});var _0x3a01ef=_0x1572('0x28');return db[_0x1572('0x29')]['destroy']({'where':{'type':_0x3a01ef,'resourceId':_0x28b12b['id']}})[_0x1572('0x26')](function(){return _0x1d1bb7;});})[_0x1572('0x26')](function(){_0x2ba9c3[_0x1572('0x1c')](0xcc)[_0x1572('0x1d')]();});}};}function handleEntityNotFound(_0x2933ff,_0x18a07f){return function(_0x5e03eb){if(!_0x5e03eb){_0x2933ff[_0x1572('0x1b')](0x194);}return _0x5e03eb;};}function handleError(_0x23dcc4,_0x41f609){_0x41f609=_0x41f609||0x1f4;return function(_0x37f88c){logger['error'](_0x37f88c[_0x1572('0x2a')]);if(_0x37f88c[_0x1572('0x2b')]){delete _0x37f88c['name'];}_0x23dcc4[_0x1572('0x1c')](_0x41f609)[_0x1572('0x2c')](_0x37f88c);};}exports['index']=function(_0x50997c,_0x5973fa){var _0x548243={},_0x4c2053={},_0x1afdbc={'count':0x0,'rows':[]};var _0x57cb27=_['map'](db['Template'][_0x1572('0x2d')],function(_0x4953c0){return{'name':_0x4953c0[_0x1572('0x2e')],'type':_0x4953c0[_0x1572('0x2f')][_0x1572('0x30')]};});_0x4c2053[_0x1572('0x31')]=_[_0x1572('0x32')](_0x57cb27,_0x1572('0x2b'));_0x4c2053[_0x1572('0x33')]=_[_0x1572('0x34')](_0x50997c[_0x1572('0x33')]);_0x4c2053['filters']=_[_0x1572('0x35')](_0x4c2053[_0x1572('0x31')],_0x4c2053[_0x1572('0x33')]);_0x548243['attributes']=_[_0x1572('0x35')](_0x4c2053['model'],qs[_0x1572('0x36')](_0x50997c['query'][_0x1572('0x36')]));_0x548243[_0x1572('0x37')]=_0x548243['attributes'][_0x1572('0x38')]?_0x548243['attributes']:_0x4c2053['model'];if(!_0x50997c['query']['hasOwnProperty'](_0x1572('0x39'))){_0x548243[_0x1572('0x20')]=qs[_0x1572('0x20')](_0x50997c[_0x1572('0x33')][_0x1572('0x20')]);_0x548243[_0x1572('0x1f')]=qs[_0x1572('0x1f')](_0x50997c['query'][_0x1572('0x1f')]);}_0x548243[_0x1572('0x3a')]=qs[_0x1572('0x3b')](_0x50997c[_0x1572('0x33')][_0x1572('0x3b')]);_0x548243['where']=qs[_0x1572('0x3c')](_[_0x1572('0x3d')](_0x50997c[_0x1572('0x33')],_0x4c2053[_0x1572('0x3c')]),_0x57cb27);if(_0x50997c[_0x1572('0x33')][_0x1572('0x3e')]){_0x548243[_0x1572('0x3f')]=_[_0x1572('0x40')](_0x548243[_0x1572('0x3f')],{'$or':_[_0x1572('0x32')](_0x57cb27,function(_0x26e73c){if(_0x26e73c[_0x1572('0x2f')]!==_0x1572('0x41')){var _0x44f376={};_0x44f376[_0x26e73c[_0x1572('0x2b')]]={'$like':'%'+_0x50997c[_0x1572('0x33')][_0x1572('0x3e')]+'%'};return _0x44f376;}})});}_0x548243=_[_0x1572('0x40')]({},_0x548243,_0x50997c[_0x1572('0x42')]);var _0x4b0b34={'where':_0x548243['where']};return db[_0x1572('0x43')][_0x1572('0x21')](_0x4b0b34)[_0x1572('0x26')](function(_0x56b053){_0x1afdbc['count']=_0x56b053;if(_0x50997c['query'][_0x1572('0x44')]){_0x548243[_0x1572('0x45')]=[{'all':!![]}];}return db[_0x1572('0x43')][_0x1572('0x46')](_0x548243);})[_0x1572('0x26')](function(_0x4ed1ad){_0x1afdbc[_0x1572('0x47')]=_0x4ed1ad;return _0x1afdbc;})[_0x1572('0x26')](respondWithFilteredResult(_0x5973fa,_0x548243))[_0x1572('0x48')](handleError(_0x5973fa,null));};exports[_0x1572('0x49')]=function(_0x5eba92,_0xbba6f8){var _0x5b394e={'raw':!![],'where':{'id':_0x5eba92[_0x1572('0x4a')]['id']}},_0x26d5c7={};_0x26d5c7['model']=_[_0x1572('0x34')](db['Template'][_0x1572('0x2d')]);_0x26d5c7[_0x1572('0x33')]=_[_0x1572('0x34')](_0x5eba92[_0x1572('0x33')]);_0x26d5c7['filters']=_[_0x1572('0x35')](_0x26d5c7[_0x1572('0x31')],_0x26d5c7[_0x1572('0x33')]);_0x5b394e[_0x1572('0x37')]=_[_0x1572('0x35')](_0x26d5c7[_0x1572('0x31')],qs[_0x1572('0x36')](_0x5eba92[_0x1572('0x33')][_0x1572('0x36')]));_0x5b394e[_0x1572('0x37')]=_0x5b394e[_0x1572('0x37')]['length']?_0x5b394e[_0x1572('0x37')]:_0x26d5c7[_0x1572('0x31')];if(_0x5eba92[_0x1572('0x33')][_0x1572('0x44')]){_0x5b394e[_0x1572('0x45')]=[{'all':!![]}];}_0x5b394e=_[_0x1572('0x40')]({},_0x5b394e,_0x5eba92[_0x1572('0x42')]);return db[_0x1572('0x43')]['find'](_0x5b394e)[_0x1572('0x26')](handleEntityNotFound(_0xbba6f8,null))['then'](respondWithResult(_0xbba6f8,null))[_0x1572('0x48')](handleError(_0xbba6f8,null));};exports['create']=function(_0xfd0cc4,_0x26e2ff){return db['Template'][_0x1572('0x4b')](_0xfd0cc4['body'],{})['then'](function(_0x20d9cd){var _0x908b7e=_0xfd0cc4[_0x1572('0x4c')][_0x1572('0x27')]({'plain':!![]});if(!_0x908b7e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x908b7e[_0x1572('0x4d')]===_0x1572('0x4c')){var _0xb1743b=_0x20d9cd[_0x1572('0x27')]({'plain':!![]});var _0x342d0e=_0x1572('0x28');return db[_0x1572('0x4e')]['find']({'where':{'name':_0x342d0e,'userProfileId':_0x908b7e['userProfileId']},'raw':!![]})[_0x1572('0x26')](function(_0x242a76){if(_0x242a76&&_0x242a76['autoAssociation']===0x0){return db[_0x1572('0x29')]['create']({'name':_0xb1743b['name'],'resourceId':_0xb1743b['id'],'type':_0x242a76[_0x1572('0x2b')],'sectionId':_0x242a76['id']},{})['then'](function(){return _0x20d9cd;});}else{return _0x20d9cd;}})[_0x1572('0x48')](function(_0x180b97){logger['error'](_0x1572('0x4f'),_0x180b97);throw _0x180b97;});}return _0x20d9cd;})[_0x1572('0x26')](respondWithResult(_0x26e2ff,0xc9))[_0x1572('0x48')](handleError(_0x26e2ff,null));};exports['update']=function(_0x229f63,_0x1829c1){if(_0x229f63['body']['id']){delete _0x229f63[_0x1572('0x50')]['id'];}return db['Template'][_0x1572('0x51')]({'where':{'id':_0x229f63[_0x1572('0x4a')]['id']}})[_0x1572('0x26')](handleEntityNotFound(_0x1829c1,null))[_0x1572('0x26')](saveUpdates(_0x229f63[_0x1572('0x50')],null))[_0x1572('0x26')](respondWithResult(_0x1829c1,null))[_0x1572('0x48')](handleError(_0x1829c1,null));};exports['destroy']=function(_0x15ab0a,_0x58c8be){return db[_0x1572('0x43')][_0x1572('0x51')]({'where':{'id':_0x15ab0a['params']['id']}})['then'](handleEntityNotFound(_0x58c8be,null))[_0x1572('0x26')](removeEntity(_0x58c8be,null))[_0x1572('0x48')](handleError(_0x58c8be,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 6c09fd7..628e39d 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 _0x34cd=['tools_templates','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./template.attributes','exports','Template'];(function(_0x23f6e2,_0x5ee063){var _0x255a5e=function(_0x329460){while(--_0x329460){_0x23f6e2['push'](_0x23f6e2['shift']());}};_0x255a5e(++_0x5ee063);}(_0x34cd,0x182));var _0xd34c=function(_0x23d57e,_0x510f80){_0x23d57e=_0x23d57e-0x0;var _0x5b4034=_0x34cd[_0x23d57e];return _0x5b4034;};'use strict';var _=require(_0xd34c('0x0'));var util=require(_0xd34c('0x1'));var logger=require('../../config/logger')(_0xd34c('0x2'));var moment=require(_0xd34c('0x3'));var BPromise=require(_0xd34c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd34c('0x5'));var config=require(_0xd34c('0x6'));var attributes=require(_0xd34c('0x7'));module[_0xd34c('0x8')]=function(_0x2a36ce,_0x18ddea){return _0x2a36ce['define'](_0xd34c('0x9'),attributes,{'tableName':_0xd34c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x887c=['Template','tools_templates','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports'];(function(_0x1975cb,_0x41b361){var _0x5d6802=function(_0x1fc112){while(--_0x1fc112){_0x1975cb['push'](_0x1975cb['shift']());}};_0x5d6802(++_0x41b361);}(_0x887c,0x1d6));var _0xc887=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x887c[_0x146a97];return _0x259d5c;};'use strict';var _=require(_0xc887('0x0'));var util=require(_0xc887('0x1'));var logger=require(_0xc887('0x2'))(_0xc887('0x3'));var moment=require(_0xc887('0x4'));var BPromise=require('bluebird');var rp=require(_0xc887('0x5'));var fs=require('fs');var path=require(_0xc887('0x6'));var rimraf=require(_0xc887('0x7'));var config=require(_0xc887('0x8'));var attributes=require(_0xc887('0x9'));module[_0xc887('0xa')]=function(_0x208fed,_0x44f465){return _0x208fed['define'](_0xc887('0xb'),attributes,{'tableName':_0xc887('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 56a33ca..c42fb63 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 _0x132a=['options','where','attributes','limit','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','raw'];(function(_0x516b8b,_0x52d1bc){var _0x162b73=function(_0x5036c7){while(--_0x5036c7){_0x516b8b['push'](_0x516b8b['shift']());}};_0x162b73(++_0x52d1bc);}(_0x132a,0xe7));var _0xa132=function(_0x573094,_0x2b6658){_0x573094=_0x573094-0x0;var _0x25f8c6=_0x132a[_0x573094];return _0x25f8c6;};'use strict';var _=require('lodash');var util=require(_0xa132('0x0'));var moment=require(_0xa132('0x1'));var BPromise=require(_0xa132('0x2'));var rs=require(_0xa132('0x3'));var fs=require('fs');var Redis=require(_0xa132('0x4'));var db=require(_0xa132('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa132('0x6'))(_0xa132('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa132('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58eda0,_0x4f94a6,_0x522d70){return new BPromise(function(_0xebba4e,_0x1b0d37){return client['request'](_0x58eda0,_0x522d70)[_0xa132('0x9')](function(_0x1b1ff6){logger[_0xa132('0xa')]('Template,\x20%s,\x20%s',_0x4f94a6,_0xa132('0xb'));logger[_0xa132('0xc')](_0xa132('0xd'),_0x4f94a6,'request\x20sent',JSON[_0xa132('0xe')](_0x1b1ff6));if(_0x1b1ff6[_0xa132('0xf')]){if(_0x1b1ff6[_0xa132('0xf')][_0xa132('0x10')]===0x1f4){logger[_0xa132('0xf')](_0xa132('0x11'),_0x4f94a6,_0x1b1ff6[_0xa132('0xf')][_0xa132('0x12')]);return _0x1b0d37(_0x1b1ff6[_0xa132('0xf')][_0xa132('0x12')]);}logger[_0xa132('0xf')](_0xa132('0x11'),_0x4f94a6,_0x1b1ff6[_0xa132('0xf')]['message']);return _0xebba4e(_0x1b1ff6[_0xa132('0xf')][_0xa132('0x12')]);}else{logger['info'](_0xa132('0x11'),_0x4f94a6,_0xa132('0xb'));_0xebba4e(_0x1b1ff6[_0xa132('0x13')]['message']);}})[_0xa132('0x14')](function(_0x158fa9){logger[_0xa132('0xf')](_0xa132('0x11'),_0x4f94a6,_0x158fa9);_0x1b0d37(_0x158fa9);});});}exports[_0xa132('0x15')]=function(_0x3c4b9e){var _0x4a28df=this;return new Promise(function(_0x235a01,_0x2f7072){return db[_0xa132('0x16')][_0xa132('0x17')]({'raw':_0x3c4b9e['options']?_0x3c4b9e['options'][_0xa132('0x18')]===undefined?!![]:![]:!![],'where':_0x3c4b9e[_0xa132('0x19')]?_0x3c4b9e[_0xa132('0x19')][_0xa132('0x1a')]||null:null,'attributes':_0x3c4b9e[_0xa132('0x19')]?_0x3c4b9e[_0xa132('0x19')][_0xa132('0x1b')]||null:null,'limit':_0x3c4b9e[_0xa132('0x19')]?_0x3c4b9e[_0xa132('0x19')][_0xa132('0x1c')]||null:null,'include':_0x3c4b9e[_0xa132('0x19')]?_0x3c4b9e[_0xa132('0x19')][_0xa132('0x1d')]?_[_0xa132('0x1e')](_0x3c4b9e[_0xa132('0x19')]['include'],function(_0x2a3c25){return{'model':db[_0x2a3c25[_0xa132('0x1f')]],'as':_0x2a3c25['as'],'attributes':_0x2a3c25[_0xa132('0x1b')],'include':_0x2a3c25[_0xa132('0x1d')]?_['map'](_0x2a3c25['include'],function(_0x4c8140){return{'model':db[_0x4c8140[_0xa132('0x1f')]],'as':_0x4c8140['as'],'attributes':_0x4c8140[_0xa132('0x1b')],'include':_0x4c8140[_0xa132('0x1d')]?_[_0xa132('0x1e')](_0x4c8140[_0xa132('0x1d')],function(_0x4661f9){return{'model':db[_0x4661f9[_0xa132('0x1f')]],'as':_0x4661f9['as'],'attributes':_0x4661f9[_0xa132('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48dad5){logger[_0xa132('0xa')](_0xa132('0x15'),_0x3c4b9e);logger[_0xa132('0xc')]('GetTemplate',_0x3c4b9e,JSON[_0xa132('0xe')](_0x48dad5));_0x235a01(_0x48dad5);})['catch'](function(_0x20c3d6){logger['error'](_0xa132('0x15'),_0x20c3d6[_0xa132('0x12')],_0x3c4b9e);_0x2f7072(_0x4a28df[_0xa132('0xf')](0x1f4,_0x20c3d6[_0xa132('0x12')]));});});}; \ No newline at end of file +var _0xc5c4=['../../config/logger','rpc','jayson/promise','client','then','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Template','findAll','options','raw','where','attributes','limit','include','map','model','GetTemplate','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1db79e,_0x56e320){var _0x3bc43c=function(_0x4a16a2){while(--_0x4a16a2){_0x1db79e['push'](_0x1db79e['shift']());}};_0x3bc43c(++_0x56e320);}(_0xc5c4,0x9e));var _0x4c5c=function(_0x3fbb44,_0x2db285){_0x3fbb44=_0x3fbb44-0x0;var _0x26881f=_0xc5c4[_0x3fbb44];return _0x26881f;};'use strict';var _=require(_0x4c5c('0x0'));var util=require(_0x4c5c('0x1'));var moment=require(_0x4c5c('0x2'));var BPromise=require(_0x4c5c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c5c('0x4'));var db=require(_0x4c5c('0x5'))['db'];var utils=require(_0x4c5c('0x6'));var logger=require(_0x4c5c('0x7'))(_0x4c5c('0x8'));var config=require('../../config/environment');var jayson=require(_0x4c5c('0x9'));var client=jayson[_0x4c5c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45b8b2,_0x1c7fb2,_0x83a031){return new BPromise(function(_0x17ba22,_0x58e12f){return client['request'](_0x45b8b2,_0x83a031)[_0x4c5c('0xb')](function(_0x4f033b){logger[_0x4c5c('0xc')](_0x4c5c('0xd'),_0x1c7fb2,_0x4c5c('0xe'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x1c7fb2,'request\x20sent',JSON[_0x4c5c('0xf')](_0x4f033b));if(_0x4f033b[_0x4c5c('0x10')]){if(_0x4f033b[_0x4c5c('0x10')][_0x4c5c('0x11')]===0x1f4){logger[_0x4c5c('0x10')]('Template,\x20%s,\x20%s',_0x1c7fb2,_0x4f033b['error'][_0x4c5c('0x12')]);return _0x58e12f(_0x4f033b['error'][_0x4c5c('0x12')]);}logger['error']('Template,\x20%s,\x20%s',_0x1c7fb2,_0x4f033b[_0x4c5c('0x10')]['message']);return _0x17ba22(_0x4f033b[_0x4c5c('0x10')][_0x4c5c('0x12')]);}else{logger[_0x4c5c('0xc')](_0x4c5c('0xd'),_0x1c7fb2,_0x4c5c('0xe'));_0x17ba22(_0x4f033b[_0x4c5c('0x13')]['message']);}})[_0x4c5c('0x14')](function(_0x1b9af5){logger[_0x4c5c('0x10')](_0x4c5c('0xd'),_0x1c7fb2,_0x1b9af5);_0x58e12f(_0x1b9af5);});});}exports['GetTemplate']=function(_0x4dc753){var _0x3148bf=this;return new Promise(function(_0x521f0d,_0x2bcf89){return db[_0x4c5c('0x15')][_0x4c5c('0x16')]({'raw':_0x4dc753[_0x4c5c('0x17')]?_0x4dc753[_0x4c5c('0x17')][_0x4c5c('0x18')]===undefined?!![]:![]:!![],'where':_0x4dc753['options']?_0x4dc753[_0x4c5c('0x17')][_0x4c5c('0x19')]||null:null,'attributes':_0x4dc753[_0x4c5c('0x17')]?_0x4dc753[_0x4c5c('0x17')][_0x4c5c('0x1a')]||null:null,'limit':_0x4dc753['options']?_0x4dc753[_0x4c5c('0x17')][_0x4c5c('0x1b')]||null:null,'include':_0x4dc753[_0x4c5c('0x17')]?_0x4dc753[_0x4c5c('0x17')][_0x4c5c('0x1c')]?_[_0x4c5c('0x1d')](_0x4dc753[_0x4c5c('0x17')][_0x4c5c('0x1c')],function(_0x2b47a2){return{'model':db[_0x2b47a2[_0x4c5c('0x1e')]],'as':_0x2b47a2['as'],'attributes':_0x2b47a2[_0x4c5c('0x1a')],'include':_0x2b47a2[_0x4c5c('0x1c')]?_['map'](_0x2b47a2[_0x4c5c('0x1c')],function(_0x26a4b4){return{'model':db[_0x26a4b4[_0x4c5c('0x1e')]],'as':_0x26a4b4['as'],'attributes':_0x26a4b4[_0x4c5c('0x1a')],'include':_0x26a4b4['include']?_['map'](_0x26a4b4['include'],function(_0x17a1c7){return{'model':db[_0x17a1c7[_0x4c5c('0x1e')]],'as':_0x17a1c7['as'],'attributes':_0x17a1c7[_0x4c5c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4c5c('0xb')](function(_0x2e65f3){logger[_0x4c5c('0xc')](_0x4c5c('0x1f'),_0x4dc753);logger[_0x4c5c('0x20')](_0x4c5c('0x1f'),_0x4dc753,JSON[_0x4c5c('0xf')](_0x2e65f3));_0x521f0d(_0x2e65f3);})[_0x4c5c('0x14')](function(_0x173d0e){logger[_0x4c5c('0x10')](_0x4c5c('0x1f'),_0x173d0e[_0x4c5c('0x12')],_0x4dc753);_0x2bcf89(_0x3148bf[_0x4c5c('0x10')](0x1f4,_0x173d0e[_0x4c5c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 7034dbb..0d4d24b 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 _0x0033=['index','/:id','show','getAllConditions','getAnyConditions','getActions','post','/:id/all_conditions','addAllCondition','addAnyCondition','/:id/actions','addAction','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0xd79494,_0x1fcda7){var _0x1c1698=function(_0x15e012){while(--_0x15e012){_0xd79494['push'](_0xd79494['shift']());}};_0x1c1698(++_0x1fcda7);}(_0x0033,0x1c0));var _0x3003=function(_0x1d94d1,_0x347bb8){_0x1d94d1=_0x1d94d1-0x0;var _0x23c397=_0x0033[_0x1d94d1];return _0x23c397;};'use strict';var multer=require(_0x3003('0x0'));var util=require(_0x3003('0x1'));var path=require(_0x3003('0x2'));var timeout=require(_0x3003('0x3'));var express=require(_0x3003('0x4'));var router=express[_0x3003('0x5')]();var fs_extra=require(_0x3003('0x6'));var auth=require(_0x3003('0x7'));var interaction=require(_0x3003('0x8'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x3003('0x9')]('/',auth[_0x3003('0xa')](),controller[_0x3003('0xb')]);router[_0x3003('0x9')](_0x3003('0xc'),auth[_0x3003('0xa')](),controller[_0x3003('0xd')]);router[_0x3003('0x9')]('/:id/all_conditions',auth[_0x3003('0xa')](),controller[_0x3003('0xe')]);router[_0x3003('0x9')]('/:id/any_conditions',auth[_0x3003('0xa')](),controller[_0x3003('0xf')]);router[_0x3003('0x9')]('/:id/actions',auth[_0x3003('0xa')](),controller[_0x3003('0x10')]);router[_0x3003('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3003('0x11')](_0x3003('0x12'),auth[_0x3003('0xa')](),controller[_0x3003('0x13')]);router[_0x3003('0x11')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x3003('0x14')]);router[_0x3003('0x11')](_0x3003('0x15'),auth['isAuthenticated'](),controller[_0x3003('0x16')]);router[_0x3003('0x17')](_0x3003('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3003('0x18')](_0x3003('0xc'),auth[_0x3003('0xa')](),controller[_0x3003('0x19')]);module[_0x3003('0x1a')]=router; \ No newline at end of file +var _0x268d=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','put','/:id','update','destroy','exports'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0x268d,0x1cc));var _0xd268=function(_0x43d0cf,_0x4cee77){_0x43d0cf=_0x43d0cf-0x0;var _0x149c52=_0x268d[_0x43d0cf];return _0x149c52;};'use strict';var multer=require(_0xd268('0x0'));var util=require(_0xd268('0x1'));var path=require(_0xd268('0x2'));var timeout=require('connect-timeout');var express=require(_0xd268('0x3'));var router=express[_0xd268('0x4')]();var fs_extra=require(_0xd268('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd268('0x6'));var config=require(_0xd268('0x7'));var controller=require(_0xd268('0x8'));router[_0xd268('0x9')]('/',auth[_0xd268('0xa')](),controller['index']);router['get']('/:id',auth[_0xd268('0xa')](),controller['show']);router[_0xd268('0x9')](_0xd268('0xb'),auth[_0xd268('0xa')](),controller[_0xd268('0xc')]);router[_0xd268('0x9')](_0xd268('0xd'),auth[_0xd268('0xa')](),controller[_0xd268('0xe')]);router[_0xd268('0x9')](_0xd268('0xf'),auth[_0xd268('0xa')](),controller['getActions']);router[_0xd268('0x10')]('/',auth[_0xd268('0xa')](),controller[_0xd268('0x11')]);router['post'](_0xd268('0xb'),auth[_0xd268('0xa')](),controller['addAllCondition']);router[_0xd268('0x10')](_0xd268('0xd'),auth[_0xd268('0xa')](),controller['addAnyCondition']);router[_0xd268('0x10')](_0xd268('0xf'),auth['isAuthenticated'](),controller['addAction']);router[_0xd268('0x12')](_0xd268('0x13'),auth[_0xd268('0xa')](),controller[_0xd268('0x14')]);router['delete'](_0xd268('0x13'),auth['isAuthenticated'](),controller[_0xd268('0x15')]);module[_0xd268('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 12ef6ed..d7215fc 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 _0x0679=['BOOLEAN','exports','STRING'];(function(_0x3089a1,_0x594203){var _0x35d4d6=function(_0x577dac){while(--_0x577dac){_0x3089a1['push'](_0x3089a1['shift']());}};_0x35d4d6(++_0x594203);}(_0x0679,0x1d8));var _0x9067=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x0679[_0x166742];return _0xb7814a;};'use strict';var Sequelize=require('sequelize');module[_0x9067('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9067('0x1')]},'description':{'type':Sequelize[_0x9067('0x1')]},'status':{'type':Sequelize[_0x9067('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x88e9=['STRING','sequelize','exports'];(function(_0x457549,_0x3e0f46){var _0x3c1d6f=function(_0xa15abe){while(--_0xa15abe){_0x457549['push'](_0x457549['shift']());}};_0x3c1d6f(++_0x3e0f46);}(_0x88e9,0xb8));var _0x988e=function(_0x27c7d9,_0x5c1340){_0x27c7d9=_0x27c7d9-0x0;var _0x4ad93b=_0x88e9[_0x27c7d9];return _0x4ad93b;};'use strict';var Sequelize=require(_0x988e('0x0'));module[_0x988e('0x1')]={'name':{'type':Sequelize[_0x988e('0x2')]},'channel':{'type':Sequelize[_0x988e('0x2')]},'description':{'type':Sequelize[_0x988e('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 2e223f3..1c69d92 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 _0xf044=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Condition','addAnyCondition','TriggerAnyId','findOne','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','map','Trigger','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','user','get','Triggers','UserProfileSection','autoAssociation','catch'];(function(_0x3bbfea,_0x4b49e3){var _0x1d789c=function(_0x95bef0){while(--_0x95bef0){_0x3bbfea['push'](_0x3bbfea['shift']());}};_0x1d789c(++_0x4b49e3);}(_0xf044,0x11b));var _0x4f04=function(_0x25041c,_0x54a4a1){_0x25041c=_0x25041c-0x0;var _0x4a7939=_0xf044[_0x25041c];return _0x4a7939;};'use strict';var emlformat=require(_0x4f04('0x0'));var rimraf=require(_0x4f04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f04('0x2'));var rp=require(_0x4f04('0x3'));var moment=require('moment');var BPromise=require(_0x4f04('0x4'));var Mustache=require(_0x4f04('0x5'));var util=require(_0x4f04('0x6'));var path=require('path');var sox=require(_0x4f04('0x7'));var csv=require(_0x4f04('0x8'));var ejs=require(_0x4f04('0x9'));var fs=require('fs');var fs_extra=require(_0x4f04('0xa'));var _=require('lodash');var squel=require(_0x4f04('0xb'));var crypto=require('crypto');var jsforce=require(_0x4f04('0xc'));var deskjs=require(_0x4f04('0xd'));var toCsv=require(_0x4f04('0x8'));var querystring=require(_0x4f04('0xe'));var Papa=require('papaparse');var Redis=require(_0x4f04('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4f04('0x10'));var hardwareService=require(_0x4f04('0x11'));var logger=require(_0x4f04('0x12'))(_0x4f04('0x13'));var utils=require(_0x4f04('0x14'));var config=require(_0x4f04('0x15'));var licenseUtil=require(_0x4f04('0x16'));var db=require(_0x4f04('0x17'))['db'];function respondWithStatusCode(_0x4c2169,_0x1d4383){_0x1d4383=_0x1d4383||0xcc;return function(_0x101229){if(_0x101229){return _0x4c2169['sendStatus'](_0x1d4383);}return _0x4c2169['status'](_0x1d4383)[_0x4f04('0x18')]();};}function respondWithResult(_0x74bb85,_0x316286){_0x316286=_0x316286||0xc8;return function(_0x309e78){if(_0x309e78){return _0x74bb85[_0x4f04('0x19')](_0x316286)['json'](_0x309e78);}};}function respondWithFilteredResult(_0x136992,_0x3b6ee9){return function(_0x19e319){if(_0x19e319){var _0x33803c=typeof _0x3b6ee9['offset']===_0x4f04('0x1a')&&typeof _0x3b6ee9[_0x4f04('0x1b')]===_0x4f04('0x1a');var _0x5000b7=_0x19e319['count'];var _0x54bdc7=_0x33803c?0x0:_0x3b6ee9['offset'];var _0x2ae738=_0x33803c?_0x19e319[_0x4f04('0x1c')]:_0x3b6ee9['offset']+_0x3b6ee9['limit'];var _0x4279c1;if(_0x2ae738>=_0x5000b7){_0x2ae738=_0x5000b7;_0x4279c1=0xc8;}else{_0x4279c1=0xce;}_0x136992['status'](_0x4279c1);return _0x136992['set'](_0x4f04('0x1d'),_0x54bdc7+'-'+_0x2ae738+'/'+_0x5000b7)[_0x4f04('0x1e')](_0x19e319);}return null;};}function patchUpdates(_0x5725e5){return function(_0x4a6ec8){try{jsonpatch[_0x4f04('0x1f')](_0x4a6ec8,_0x5725e5,!![]);}catch(_0x498c80){return BPromise[_0x4f04('0x20')](_0x498c80);}return _0x4a6ec8[_0x4f04('0x21')]();};}function saveUpdates(_0x3b967c,_0x355d23){return function(_0x443581){if(_0x443581){return _0x443581[_0x4f04('0x22')](_0x3b967c)[_0x4f04('0x23')](function(_0x1b05e4){return _0x1b05e4;});}return null;};}function removeEntity(_0x439f6d,_0x36e3c0){return function(_0x3a807f){if(_0x3a807f){return _0x3a807f[_0x4f04('0x24')]()['then'](function(){var _0x3bdf97=_0x3a807f['get']({'plain':!![]});var _0x79fb52='Triggers';return db[_0x4f04('0x25')][_0x4f04('0x24')]({'where':{'type':_0x79fb52,'resourceId':_0x3bdf97['id']}})['then'](function(){return _0x3a807f;});})[_0x4f04('0x23')](function(){_0x439f6d[_0x4f04('0x19')](0xcc)[_0x4f04('0x18')]();});}};}function handleEntityNotFound(_0x463a50,_0x39e4c9){return function(_0x38af88){if(!_0x38af88){_0x463a50['sendStatus'](0x194);}return _0x38af88;};}function handleError(_0x514aa3,_0x58a510){_0x58a510=_0x58a510||0x1f4;return function(_0x5cef22){logger[_0x4f04('0x26')](_0x5cef22[_0x4f04('0x27')]);if(_0x5cef22[_0x4f04('0x28')]){delete _0x5cef22[_0x4f04('0x28')];}_0x514aa3['status'](_0x58a510)[_0x4f04('0x29')](_0x5cef22);};}exports['index']=function(_0x3227a5,_0x3730fb){var _0x5e919a={},_0x5998fe={},_0xb6d91f={'count':0x0,'rows':[]};var _0x4f7f5d=_[_0x4f04('0x2a')](db[_0x4f04('0x2b')]['rawAttributes'],function(_0x9eda30){return{'name':_0x9eda30[_0x4f04('0x2c')],'type':_0x9eda30['type'][_0x4f04('0x2d')]};});_0x5998fe[_0x4f04('0x2e')]=_[_0x4f04('0x2a')](_0x4f7f5d,'name');_0x5998fe[_0x4f04('0x2f')]=_[_0x4f04('0x30')](_0x3227a5['query']);_0x5998fe[_0x4f04('0x31')]=_[_0x4f04('0x32')](_0x5998fe[_0x4f04('0x2e')],_0x5998fe[_0x4f04('0x2f')]);_0x5e919a[_0x4f04('0x33')]=_[_0x4f04('0x32')](_0x5998fe['model'],qs['fields'](_0x3227a5['query'][_0x4f04('0x34')]));_0x5e919a[_0x4f04('0x33')]=_0x5e919a['attributes'][_0x4f04('0x35')]?_0x5e919a[_0x4f04('0x33')]:_0x5998fe[_0x4f04('0x2e')];if(!_0x3227a5[_0x4f04('0x2f')][_0x4f04('0x36')](_0x4f04('0x37'))){_0x5e919a['limit']=qs[_0x4f04('0x1b')](_0x3227a5['query'][_0x4f04('0x1b')]);_0x5e919a[_0x4f04('0x38')]=qs[_0x4f04('0x38')](_0x3227a5[_0x4f04('0x2f')][_0x4f04('0x38')]);}_0x5e919a[_0x4f04('0x39')]=qs[_0x4f04('0x3a')](_0x3227a5['query'][_0x4f04('0x3a')]);_0x5e919a[_0x4f04('0x3b')]=qs['filters'](_[_0x4f04('0x3c')](_0x3227a5[_0x4f04('0x2f')],_0x5998fe[_0x4f04('0x31')]),_0x4f7f5d);if(_0x3227a5['query'][_0x4f04('0x3d')]){_0x5e919a[_0x4f04('0x3b')]=_[_0x4f04('0x3e')](_0x5e919a[_0x4f04('0x3b')],{'$or':_[_0x4f04('0x2a')](_0x4f7f5d,function(_0xb31759){if(_0xb31759[_0x4f04('0x3f')]!==_0x4f04('0x40')){var _0x388e17={};_0x388e17[_0xb31759[_0x4f04('0x28')]]={'$like':'%'+_0x3227a5[_0x4f04('0x2f')]['filter']+'%'};return _0x388e17;}})});}_0x5e919a=_['merge']({},_0x5e919a,_0x3227a5[_0x4f04('0x41')]);var _0x765b9={'where':_0x5e919a[_0x4f04('0x3b')]};return db[_0x4f04('0x2b')][_0x4f04('0x1c')](_0x765b9)['then'](function(_0x730672){_0xb6d91f[_0x4f04('0x1c')]=_0x730672;if(_0x3227a5[_0x4f04('0x2f')]['includeAll']){_0x5e919a[_0x4f04('0x42')]=[{'all':!![]}];}return db[_0x4f04('0x2b')][_0x4f04('0x43')](_0x5e919a);})[_0x4f04('0x23')](function(_0x4e4988){_0xb6d91f[_0x4f04('0x44')]=_0x4e4988;return _0xb6d91f;})[_0x4f04('0x23')](respondWithFilteredResult(_0x3730fb,_0x5e919a))['catch'](handleError(_0x3730fb,null));};exports[_0x4f04('0x45')]=function(_0x525e4e,_0xf91c96){var _0xb5932a={'raw':![],'where':{'id':_0x525e4e[_0x4f04('0x46')]['id']}},_0xee0cd={};_0xee0cd[_0x4f04('0x2e')]=_[_0x4f04('0x30')](db['Trigger'][_0x4f04('0x47')]);_0xee0cd['query']=_['keys'](_0x525e4e[_0x4f04('0x2f')]);_0xee0cd[_0x4f04('0x31')]=_[_0x4f04('0x32')](_0xee0cd[_0x4f04('0x2e')],_0xee0cd[_0x4f04('0x2f')]);_0xb5932a[_0x4f04('0x33')]=_[_0x4f04('0x32')](_0xee0cd[_0x4f04('0x2e')],qs[_0x4f04('0x34')](_0x525e4e['query']['fields']));_0xb5932a[_0x4f04('0x33')]=_0xb5932a['attributes'][_0x4f04('0x35')]?_0xb5932a[_0x4f04('0x33')]:_0xee0cd[_0x4f04('0x2e')];if(_0x525e4e[_0x4f04('0x2f')][_0x4f04('0x48')]){_0xb5932a[_0x4f04('0x42')]=[{'all':!![]}];}_0xb5932a=_[_0x4f04('0x3e')]({},_0xb5932a,_0x525e4e[_0x4f04('0x41')]);return db['Trigger'][_0x4f04('0x49')](_0xb5932a)[_0x4f04('0x23')](handleEntityNotFound(_0xf91c96,null))[_0x4f04('0x23')](respondWithResult(_0xf91c96,null))['catch'](handleError(_0xf91c96,null));};exports[_0x4f04('0x4a')]=function(_0x5b7568,_0x4df2b4){return db[_0x4f04('0x2b')][_0x4f04('0x4a')](_0x5b7568['body'],{})[_0x4f04('0x23')](function(_0x4deca4){var _0x562ca7=_0x5b7568[_0x4f04('0x4b')][_0x4f04('0x4c')]({'plain':!![]});if(!_0x562ca7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x562ca7['role']===_0x4f04('0x4b')){var _0x45fa61=_0x4deca4['get']({'plain':!![]});var _0x27167f=_0x4f04('0x4d');return db[_0x4f04('0x4e')][_0x4f04('0x49')]({'where':{'name':_0x27167f,'userProfileId':_0x562ca7['userProfileId']},'raw':!![]})[_0x4f04('0x23')](function(_0x248e3d){if(_0x248e3d&&_0x248e3d[_0x4f04('0x4f')]===0x0){return db[_0x4f04('0x25')]['create']({'name':_0x45fa61[_0x4f04('0x28')],'resourceId':_0x45fa61['id'],'type':_0x248e3d['name'],'sectionId':_0x248e3d['id']},{})[_0x4f04('0x23')](function(){return _0x4deca4;});}else{return _0x4deca4;}})[_0x4f04('0x50')](function(_0x10d7f2){logger[_0x4f04('0x26')](_0x4f04('0x51'),_0x10d7f2);throw _0x10d7f2;});}return _0x4deca4;})[_0x4f04('0x23')](respondWithResult(_0x4df2b4,0xc9))[_0x4f04('0x50')](handleError(_0x4df2b4,null));};exports[_0x4f04('0x22')]=function(_0x4a2dbc,_0x527d9d){if(_0x4a2dbc['body']['id']){delete _0x4a2dbc[_0x4f04('0x52')]['id'];}return db[_0x4f04('0x2b')][_0x4f04('0x49')]({'where':{'id':_0x4a2dbc[_0x4f04('0x46')]['id']}})[_0x4f04('0x23')](handleEntityNotFound(_0x527d9d,null))[_0x4f04('0x23')](saveUpdates(_0x4a2dbc[_0x4f04('0x52')],null))[_0x4f04('0x23')](respondWithResult(_0x527d9d,null))['catch'](handleError(_0x527d9d,null));};exports['destroy']=function(_0x4a66fe,_0x88fd84){return db[_0x4f04('0x2b')]['find']({'where':{'id':_0x4a66fe[_0x4f04('0x46')]['id']}})[_0x4f04('0x23')](handleEntityNotFound(_0x88fd84,null))[_0x4f04('0x23')](removeEntity(_0x88fd84,null))[_0x4f04('0x50')](handleError(_0x88fd84,null));};exports['addAllCondition']=function(_0x46150a,_0x30b51a,_0x1a74d4){if(_0x46150a['body']['id']){delete _0x46150a[_0x4f04('0x52')]['id'];}return db[_0x4f04('0x2b')][_0x4f04('0x49')]({'where':{'id':_0x46150a[_0x4f04('0x46')]['id']}})[_0x4f04('0x23')](handleEntityNotFound(_0x30b51a,null))[_0x4f04('0x23')](function(_0xcbba90){if(_0xcbba90){_0x46150a[_0x4f04('0x52')]['TriggerAllId']=_0xcbba90['id'];return db[_0x4f04('0x53')][_0x4f04('0x4a')](_0x46150a[_0x4f04('0x52')]);}})['then'](respondWithResult(_0x30b51a,null))['catch'](handleError(_0x30b51a,null));};exports[_0x4f04('0x54')]=function(_0x441283,_0x2c9521,_0x1e4864){if(_0x441283[_0x4f04('0x52')]['id']){delete _0x441283[_0x4f04('0x52')]['id'];}return db['Trigger']['find']({'where':{'id':_0x441283['params']['id']}})['then'](handleEntityNotFound(_0x2c9521,null))[_0x4f04('0x23')](function(_0x2948eb){if(_0x2948eb){_0x441283[_0x4f04('0x52')][_0x4f04('0x55')]=_0x2948eb['id'];return db[_0x4f04('0x53')]['create'](_0x441283[_0x4f04('0x52')]);}})['then'](respondWithResult(_0x2c9521,null))[_0x4f04('0x50')](handleError(_0x2c9521,null));};exports['getAllConditions']=function(_0x32877d,_0x2f14d7,_0x1b9dad){var _0x3f2599={};var _0x2bf1af={};var _0x308f4f;var _0x356c0d;return db['Trigger'][_0x4f04('0x56')]({'where':{'id':_0x32877d[_0x4f04('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f14d7,null))['then'](function(_0x4afd18){if(_0x4afd18){_0x308f4f=_0x4afd18;_0x2bf1af['model']=_[_0x4f04('0x30')](db[_0x4f04('0x53')][_0x4f04('0x47')]);_0x2bf1af[_0x4f04('0x2f')]=_[_0x4f04('0x30')](_0x32877d[_0x4f04('0x2f')]);_0x2bf1af['filters']=_['intersection'](_0x2bf1af[_0x4f04('0x2e')],_0x2bf1af[_0x4f04('0x2f')]);_0x3f2599[_0x4f04('0x33')]=_[_0x4f04('0x32')](_0x2bf1af[_0x4f04('0x2e')],qs['fields'](_0x32877d[_0x4f04('0x2f')][_0x4f04('0x34')]));_0x3f2599[_0x4f04('0x33')]=_0x3f2599[_0x4f04('0x33')][_0x4f04('0x35')]?_0x3f2599[_0x4f04('0x33')]:_0x2bf1af[_0x4f04('0x2e')];_0x3f2599['order']=qs['sort'](_0x32877d[_0x4f04('0x2f')]['sort']);_0x3f2599[_0x4f04('0x3b')]=qs[_0x4f04('0x31')](_['pick'](_0x32877d[_0x4f04('0x2f')],_0x2bf1af[_0x4f04('0x31')]));if(_0x32877d['query'][_0x4f04('0x3d')]){_0x3f2599['where']=_['merge'](_0x3f2599['where'],{'$or':_[_0x4f04('0x2a')](_0x3f2599['attributes'],function(_0x1aadb2){var _0x36d01f={};_0x36d01f[_0x1aadb2]={'$like':'%'+_0x32877d[_0x4f04('0x2f')][_0x4f04('0x3d')]+'%'};return _0x36d01f;})});}_0x3f2599=_[_0x4f04('0x3e')]({},_0x3f2599,_0x32877d['options']);return _0x308f4f['getAllConditions'](_0x3f2599);}})[_0x4f04('0x23')](function(_0x2dcd84){if(_0x2dcd84){_0x356c0d=_0x2dcd84[_0x4f04('0x35')];if(!_0x32877d[_0x4f04('0x2f')]['hasOwnProperty'](_0x4f04('0x37'))){_0x3f2599['limit']=qs[_0x4f04('0x1b')](_0x32877d[_0x4f04('0x2f')][_0x4f04('0x1b')]);_0x3f2599[_0x4f04('0x38')]=qs[_0x4f04('0x38')](_0x32877d['query'][_0x4f04('0x38')]);}return _0x308f4f['getAllConditions'](_0x3f2599);}})[_0x4f04('0x23')](function(_0x406d80){if(_0x406d80){return _0x406d80?{'count':_0x356c0d,'rows':_0x406d80}:null;}})[_0x4f04('0x23')](respondWithResult(_0x2f14d7,null))[_0x4f04('0x50')](handleError(_0x2f14d7,null));};exports['getAnyConditions']=function(_0x1663fa,_0x43a1ce,_0x4ef397){var _0x2ab65e={};var _0x46f8fa={};var _0x3e7160;var _0x52663e;return db[_0x4f04('0x2b')][_0x4f04('0x56')]({'where':{'id':_0x1663fa['params']['id']}})[_0x4f04('0x23')](handleEntityNotFound(_0x43a1ce,null))[_0x4f04('0x23')](function(_0x221c7a){if(_0x221c7a){_0x3e7160=_0x221c7a;_0x46f8fa[_0x4f04('0x2e')]=_['keys'](db[_0x4f04('0x53')][_0x4f04('0x47')]);_0x46f8fa[_0x4f04('0x2f')]=_[_0x4f04('0x30')](_0x1663fa['query']);_0x46f8fa[_0x4f04('0x31')]=_[_0x4f04('0x32')](_0x46f8fa[_0x4f04('0x2e')],_0x46f8fa['query']);_0x2ab65e['attributes']=_[_0x4f04('0x32')](_0x46f8fa[_0x4f04('0x2e')],qs['fields'](_0x1663fa[_0x4f04('0x2f')]['fields']));_0x2ab65e[_0x4f04('0x33')]=_0x2ab65e[_0x4f04('0x33')][_0x4f04('0x35')]?_0x2ab65e[_0x4f04('0x33')]:_0x46f8fa[_0x4f04('0x2e')];_0x2ab65e[_0x4f04('0x39')]=qs[_0x4f04('0x3a')](_0x1663fa[_0x4f04('0x2f')]['sort']);_0x2ab65e['where']=qs[_0x4f04('0x31')](_[_0x4f04('0x3c')](_0x1663fa['query'],_0x46f8fa[_0x4f04('0x31')]));if(_0x1663fa[_0x4f04('0x2f')][_0x4f04('0x3d')]){_0x2ab65e[_0x4f04('0x3b')]=_[_0x4f04('0x3e')](_0x2ab65e['where'],{'$or':_[_0x4f04('0x2a')](_0x2ab65e[_0x4f04('0x33')],function(_0x1a21dc){var _0x58f9ca={};_0x58f9ca[_0x1a21dc]={'$like':'%'+_0x1663fa[_0x4f04('0x2f')]['filter']+'%'};return _0x58f9ca;})});}_0x2ab65e=_['merge']({},_0x2ab65e,_0x1663fa[_0x4f04('0x41')]);return _0x3e7160[_0x4f04('0x57')](_0x2ab65e);}})[_0x4f04('0x23')](function(_0x3d3944){if(_0x3d3944){_0x52663e=_0x3d3944[_0x4f04('0x35')];if(!_0x1663fa['query'][_0x4f04('0x36')]('nolimit')){_0x2ab65e[_0x4f04('0x1b')]=qs[_0x4f04('0x1b')](_0x1663fa['query']['limit']);_0x2ab65e[_0x4f04('0x38')]=qs['offset'](_0x1663fa[_0x4f04('0x2f')][_0x4f04('0x38')]);}return _0x3e7160[_0x4f04('0x57')](_0x2ab65e);}})[_0x4f04('0x23')](function(_0x3fcf17){if(_0x3fcf17){return _0x3fcf17?{'count':_0x52663e,'rows':_0x3fcf17}:null;}})[_0x4f04('0x23')](respondWithResult(_0x43a1ce,null))[_0x4f04('0x50')](handleError(_0x43a1ce,null));};exports['addAction']=function(_0x315529,_0x47f65a,_0x1e8270){if(_0x315529[_0x4f04('0x52')]['id']){delete _0x315529[_0x4f04('0x52')]['id'];}return db[_0x4f04('0x2b')][_0x4f04('0x49')]({'where':{'id':_0x315529[_0x4f04('0x46')]['id']}})['then'](handleEntityNotFound(_0x47f65a,null))[_0x4f04('0x23')](function(_0x1f5e31){if(_0x1f5e31){_0x315529['body'][_0x4f04('0x58')]=_0x1f5e31['id'];return db[_0x4f04('0x59')][_0x4f04('0x4a')](_0x315529[_0x4f04('0x52')]);}})['then'](respondWithResult(_0x47f65a,null))[_0x4f04('0x50')](handleError(_0x47f65a,null));};exports[_0x4f04('0x5a')]=function(_0x571bbf,_0x42b0a1,_0x4238a0){var _0x298b5d={};var _0x49d13e={};var _0x5941d0;var _0x39cf67;return db[_0x4f04('0x2b')]['findOne']({'where':{'id':_0x571bbf[_0x4f04('0x46')]['id']}})[_0x4f04('0x23')](handleEntityNotFound(_0x42b0a1,null))[_0x4f04('0x23')](function(_0xcf9f0c){if(_0xcf9f0c){_0x5941d0=_0xcf9f0c;_0x49d13e[_0x4f04('0x2e')]=_[_0x4f04('0x30')](db[_0x4f04('0x59')]['rawAttributes']);_0x49d13e[_0x4f04('0x2f')]=_[_0x4f04('0x30')](_0x571bbf[_0x4f04('0x2f')]);_0x49d13e[_0x4f04('0x31')]=_[_0x4f04('0x32')](_0x49d13e[_0x4f04('0x2e')],_0x49d13e[_0x4f04('0x2f')]);_0x298b5d['attributes']=_['intersection'](_0x49d13e[_0x4f04('0x2e')],qs['fields'](_0x571bbf[_0x4f04('0x2f')][_0x4f04('0x34')]));_0x298b5d[_0x4f04('0x33')]=_0x298b5d[_0x4f04('0x33')][_0x4f04('0x35')]?_0x298b5d[_0x4f04('0x33')]:_0x49d13e[_0x4f04('0x2e')];_0x298b5d[_0x4f04('0x39')]=qs['sort'](_0x571bbf[_0x4f04('0x2f')]['sort']);_0x298b5d[_0x4f04('0x3b')]=qs['filters'](_[_0x4f04('0x3c')](_0x571bbf[_0x4f04('0x2f')],_0x49d13e[_0x4f04('0x31')]));if(_0x571bbf[_0x4f04('0x2f')][_0x4f04('0x3d')]){_0x298b5d[_0x4f04('0x3b')]=_[_0x4f04('0x3e')](_0x298b5d['where'],{'$or':_['map'](_0x298b5d[_0x4f04('0x33')],function(_0x5ceeb){var _0x2b8b5d={};_0x2b8b5d[_0x5ceeb]={'$like':'%'+_0x571bbf['query'][_0x4f04('0x3d')]+'%'};return _0x2b8b5d;})});}_0x298b5d=_[_0x4f04('0x3e')]({},_0x298b5d,_0x571bbf[_0x4f04('0x41')]);return _0x5941d0[_0x4f04('0x5a')](_0x298b5d);}})[_0x4f04('0x23')](function(_0x4d4593){if(_0x4d4593){_0x39cf67=_0x4d4593['length'];if(!_0x571bbf[_0x4f04('0x2f')][_0x4f04('0x36')]('nolimit')){_0x298b5d[_0x4f04('0x1b')]=qs['limit'](_0x571bbf[_0x4f04('0x2f')][_0x4f04('0x1b')]);_0x298b5d['offset']=qs[_0x4f04('0x38')](_0x571bbf[_0x4f04('0x2f')][_0x4f04('0x38')]);}return _0x5941d0['getActions'](_0x298b5d);}})['then'](function(_0x4b6400){if(_0x4b6400){return _0x4b6400?{'count':_0x39cf67,'rows':_0x4b6400}:null;}})[_0x4f04('0x23')](respondWithResult(_0x42b0a1,null))[_0x4f04('0x50')](handleError(_0x42b0a1,null));}; \ No newline at end of file +var _0x3e35=['body','TriggerAllId','Condition','TriggerAnyId','findOne','order','getAllConditions','getAnyConditions','addAction','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','Trigger','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','options','count','rows','catch','rawAttributes','includeAll','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Triggers','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params'];(function(_0x1c017b,_0x114e7f){var _0x49ce0f=function(_0x4e787f){while(--_0x4e787f){_0x1c017b['push'](_0x1c017b['shift']());}};_0x49ce0f(++_0x114e7f);}(_0x3e35,0x12b));var _0x53e3=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x3e35[_0x3e531a];return _0x3c2574;};'use strict';var emlformat=require(_0x53e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x53e3('0x1'));var jsonpatch=require(_0x53e3('0x2'));var rp=require(_0x53e3('0x3'));var moment=require(_0x53e3('0x4'));var BPromise=require(_0x53e3('0x5'));var Mustache=require(_0x53e3('0x6'));var util=require('util');var path=require(_0x53e3('0x7'));var sox=require(_0x53e3('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53e3('0x9'));var _=require(_0x53e3('0xa'));var squel=require(_0x53e3('0xb'));var crypto=require(_0x53e3('0xc'));var jsforce=require(_0x53e3('0xd'));var deskjs=require(_0x53e3('0xe'));var toCsv=require(_0x53e3('0xf'));var querystring=require(_0x53e3('0x10'));var Papa=require(_0x53e3('0x11'));var Redis=require(_0x53e3('0x12'));var authService=require(_0x53e3('0x13'));var qs=require(_0x53e3('0x14'));var as=require(_0x53e3('0x15'));var hardwareService=require(_0x53e3('0x16'));var logger=require(_0x53e3('0x17'))(_0x53e3('0x18'));var utils=require(_0x53e3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x53e3('0x1a'));var db=require(_0x53e3('0x1b'))['db'];function respondWithStatusCode(_0x144f9d,_0xbb23fc){_0xbb23fc=_0xbb23fc||0xcc;return function(_0xef848b){if(_0xef848b){return _0x144f9d['sendStatus'](_0xbb23fc);}return _0x144f9d['status'](_0xbb23fc)[_0x53e3('0x1c')]();};}function respondWithResult(_0x46d3f7,_0x559acd){_0x559acd=_0x559acd||0xc8;return function(_0x4afe6f){if(_0x4afe6f){return _0x46d3f7[_0x53e3('0x1d')](_0x559acd)[_0x53e3('0x1e')](_0x4afe6f);}};}function respondWithFilteredResult(_0x372f8a,_0x300efc){return function(_0x61405b){if(_0x61405b){var _0x3ac014=typeof _0x300efc['offset']===_0x53e3('0x1f')&&typeof _0x300efc['limit']===_0x53e3('0x1f');var _0x43b99d=_0x61405b['count'];var _0xf3ff54=_0x3ac014?0x0:_0x300efc[_0x53e3('0x20')];var _0x36ea30=_0x3ac014?_0x61405b['count']:_0x300efc['offset']+_0x300efc[_0x53e3('0x21')];var _0x17d773;if(_0x36ea30>=_0x43b99d){_0x36ea30=_0x43b99d;_0x17d773=0xc8;}else{_0x17d773=0xce;}_0x372f8a[_0x53e3('0x1d')](_0x17d773);return _0x372f8a[_0x53e3('0x22')](_0x53e3('0x23'),_0xf3ff54+'-'+_0x36ea30+'/'+_0x43b99d)['json'](_0x61405b);}return null;};}function patchUpdates(_0xafede2){return function(_0x3c682d){try{jsonpatch[_0x53e3('0x24')](_0x3c682d,_0xafede2,!![]);}catch(_0x2ba931){return BPromise[_0x53e3('0x25')](_0x2ba931);}return _0x3c682d[_0x53e3('0x26')]();};}function saveUpdates(_0x404b60,_0x4cd11b){return function(_0xb6e820){if(_0xb6e820){return _0xb6e820[_0x53e3('0x27')](_0x404b60)[_0x53e3('0x28')](function(_0x165ae5){return _0x165ae5;});}return null;};}function removeEntity(_0xe2ed48,_0x162f33){return function(_0x2cc6f3){if(_0x2cc6f3){return _0x2cc6f3[_0x53e3('0x29')]()['then'](function(){var _0x4db165=_0x2cc6f3[_0x53e3('0x2a')]({'plain':!![]});var _0x41deb4='Triggers';return db[_0x53e3('0x2b')][_0x53e3('0x29')]({'where':{'type':_0x41deb4,'resourceId':_0x4db165['id']}})['then'](function(){return _0x2cc6f3;});})[_0x53e3('0x28')](function(){_0xe2ed48[_0x53e3('0x1d')](0xcc)[_0x53e3('0x1c')]();});}};}function handleEntityNotFound(_0x1068ae,_0x17e60b){return function(_0x44d87f){if(!_0x44d87f){_0x1068ae[_0x53e3('0x2c')](0x194);}return _0x44d87f;};}function handleError(_0x57c225,_0x1694fd){_0x1694fd=_0x1694fd||0x1f4;return function(_0x416fe6){logger[_0x53e3('0x2d')](_0x416fe6[_0x53e3('0x2e')]);if(_0x416fe6[_0x53e3('0x2f')]){delete _0x416fe6[_0x53e3('0x2f')];}_0x57c225[_0x53e3('0x1d')](_0x1694fd)['send'](_0x416fe6);};}exports[_0x53e3('0x30')]=function(_0x1ecaf9,_0x578d48){var _0x40dc9a={},_0x43b08f={},_0x48d568={'count':0x0,'rows':[]};var _0xf851cd=_['map'](db[_0x53e3('0x31')]['rawAttributes'],function(_0x21325e){return{'name':_0x21325e[_0x53e3('0x32')],'type':_0x21325e[_0x53e3('0x33')][_0x53e3('0x34')]};});_0x43b08f['model']=_['map'](_0xf851cd,'name');_0x43b08f[_0x53e3('0x35')]=_[_0x53e3('0x36')](_0x1ecaf9[_0x53e3('0x35')]);_0x43b08f[_0x53e3('0x37')]=_[_0x53e3('0x38')](_0x43b08f[_0x53e3('0x39')],_0x43b08f[_0x53e3('0x35')]);_0x40dc9a[_0x53e3('0x3a')]=_['intersection'](_0x43b08f[_0x53e3('0x39')],qs[_0x53e3('0x3b')](_0x1ecaf9[_0x53e3('0x35')][_0x53e3('0x3b')]));_0x40dc9a[_0x53e3('0x3a')]=_0x40dc9a['attributes'][_0x53e3('0x3c')]?_0x40dc9a[_0x53e3('0x3a')]:_0x43b08f[_0x53e3('0x39')];if(!_0x1ecaf9[_0x53e3('0x35')][_0x53e3('0x3d')](_0x53e3('0x3e'))){_0x40dc9a[_0x53e3('0x21')]=qs[_0x53e3('0x21')](_0x1ecaf9[_0x53e3('0x35')][_0x53e3('0x21')]);_0x40dc9a['offset']=qs[_0x53e3('0x20')](_0x1ecaf9['query'][_0x53e3('0x20')]);}_0x40dc9a['order']=qs['sort'](_0x1ecaf9[_0x53e3('0x35')][_0x53e3('0x3f')]);_0x40dc9a['where']=qs[_0x53e3('0x37')](_[_0x53e3('0x40')](_0x1ecaf9[_0x53e3('0x35')],_0x43b08f[_0x53e3('0x37')]),_0xf851cd);if(_0x1ecaf9[_0x53e3('0x35')][_0x53e3('0x41')]){_0x40dc9a[_0x53e3('0x42')]=_[_0x53e3('0x43')](_0x40dc9a[_0x53e3('0x42')],{'$or':_[_0x53e3('0x44')](_0xf851cd,function(_0x4d8248){if(_0x4d8248[_0x53e3('0x33')]!=='VIRTUAL'){var _0x195d4e={};_0x195d4e[_0x4d8248[_0x53e3('0x2f')]]={'$like':'%'+_0x1ecaf9['query'][_0x53e3('0x41')]+'%'};return _0x195d4e;}})});}_0x40dc9a=_['merge']({},_0x40dc9a,_0x1ecaf9[_0x53e3('0x45')]);var _0x7c7cec={'where':_0x40dc9a[_0x53e3('0x42')]};return db[_0x53e3('0x31')][_0x53e3('0x46')](_0x7c7cec)[_0x53e3('0x28')](function(_0xae9365){_0x48d568['count']=_0xae9365;if(_0x1ecaf9['query']['includeAll']){_0x40dc9a['include']=[{'all':!![]}];}return db[_0x53e3('0x31')]['findAll'](_0x40dc9a);})[_0x53e3('0x28')](function(_0x3d26d5){_0x48d568[_0x53e3('0x47')]=_0x3d26d5;return _0x48d568;})[_0x53e3('0x28')](respondWithFilteredResult(_0x578d48,_0x40dc9a))[_0x53e3('0x48')](handleError(_0x578d48,null));};exports['show']=function(_0x4c2fb3,_0x29033e){var _0x1ea6c9={'raw':![],'where':{'id':_0x4c2fb3['params']['id']}},_0x31ca4e={};_0x31ca4e[_0x53e3('0x39')]=_[_0x53e3('0x36')](db[_0x53e3('0x31')][_0x53e3('0x49')]);_0x31ca4e[_0x53e3('0x35')]=_[_0x53e3('0x36')](_0x4c2fb3[_0x53e3('0x35')]);_0x31ca4e[_0x53e3('0x37')]=_[_0x53e3('0x38')](_0x31ca4e[_0x53e3('0x39')],_0x31ca4e[_0x53e3('0x35')]);_0x1ea6c9['attributes']=_[_0x53e3('0x38')](_0x31ca4e['model'],qs[_0x53e3('0x3b')](_0x4c2fb3[_0x53e3('0x35')]['fields']));_0x1ea6c9[_0x53e3('0x3a')]=_0x1ea6c9[_0x53e3('0x3a')][_0x53e3('0x3c')]?_0x1ea6c9[_0x53e3('0x3a')]:_0x31ca4e[_0x53e3('0x39')];if(_0x4c2fb3[_0x53e3('0x35')][_0x53e3('0x4a')]){_0x1ea6c9[_0x53e3('0x4b')]=[{'all':!![]}];}_0x1ea6c9=_[_0x53e3('0x43')]({},_0x1ea6c9,_0x4c2fb3[_0x53e3('0x45')]);return db['Trigger']['find'](_0x1ea6c9)[_0x53e3('0x28')](handleEntityNotFound(_0x29033e,null))['then'](respondWithResult(_0x29033e,null))[_0x53e3('0x48')](handleError(_0x29033e,null));};exports[_0x53e3('0x4c')]=function(_0x419be1,_0x42ec85){return db[_0x53e3('0x31')][_0x53e3('0x4c')](_0x419be1['body'],{})[_0x53e3('0x28')](function(_0x228e2c){var _0x5ae43d=_0x419be1['user'][_0x53e3('0x2a')]({'plain':!![]});if(!_0x5ae43d)throw new Error(_0x53e3('0x4d'));if(_0x5ae43d[_0x53e3('0x4e')]===_0x53e3('0x4f')){var _0x4b7317=_0x228e2c[_0x53e3('0x2a')]({'plain':!![]});var _0x4ec039=_0x53e3('0x50');return db['UserProfileSection'][_0x53e3('0x51')]({'where':{'name':_0x4ec039,'userProfileId':_0x5ae43d['userProfileId']},'raw':!![]})['then'](function(_0x3b2a87){if(_0x3b2a87&&_0x3b2a87[_0x53e3('0x52')]===0x0){return db['UserProfileResource'][_0x53e3('0x4c')]({'name':_0x4b7317['name'],'resourceId':_0x4b7317['id'],'type':_0x3b2a87[_0x53e3('0x2f')],'sectionId':_0x3b2a87['id']},{})['then'](function(){return _0x228e2c;});}else{return _0x228e2c;}})[_0x53e3('0x48')](function(_0x27f761){logger[_0x53e3('0x2d')](_0x53e3('0x53'),_0x27f761);throw _0x27f761;});}return _0x228e2c;})['then'](respondWithResult(_0x42ec85,0xc9))[_0x53e3('0x48')](handleError(_0x42ec85,null));};exports['update']=function(_0x172e0b,_0x74a3b4){if(_0x172e0b['body']['id']){delete _0x172e0b['body']['id'];}return db[_0x53e3('0x31')]['find']({'where':{'id':_0x172e0b[_0x53e3('0x54')]['id']}})['then'](handleEntityNotFound(_0x74a3b4,null))[_0x53e3('0x28')](saveUpdates(_0x172e0b[_0x53e3('0x55')],null))[_0x53e3('0x28')](respondWithResult(_0x74a3b4,null))[_0x53e3('0x48')](handleError(_0x74a3b4,null));};exports[_0x53e3('0x29')]=function(_0x3dc0fa,_0x331c74){return db[_0x53e3('0x31')][_0x53e3('0x51')]({'where':{'id':_0x3dc0fa['params']['id']}})[_0x53e3('0x28')](handleEntityNotFound(_0x331c74,null))[_0x53e3('0x28')](removeEntity(_0x331c74,null))['catch'](handleError(_0x331c74,null));};exports['addAllCondition']=function(_0x31fd0f,_0x187ae5,_0x4d5615){if(_0x31fd0f[_0x53e3('0x55')]['id']){delete _0x31fd0f[_0x53e3('0x55')]['id'];}return db[_0x53e3('0x31')][_0x53e3('0x51')]({'where':{'id':_0x31fd0f[_0x53e3('0x54')]['id']}})[_0x53e3('0x28')](handleEntityNotFound(_0x187ae5,null))[_0x53e3('0x28')](function(_0x4d88b8){if(_0x4d88b8){_0x31fd0f[_0x53e3('0x55')][_0x53e3('0x56')]=_0x4d88b8['id'];return db[_0x53e3('0x57')][_0x53e3('0x4c')](_0x31fd0f[_0x53e3('0x55')]);}})['then'](respondWithResult(_0x187ae5,null))['catch'](handleError(_0x187ae5,null));};exports['addAnyCondition']=function(_0x3813d1,_0x2c1d4a,_0x3ab268){if(_0x3813d1[_0x53e3('0x55')]['id']){delete _0x3813d1['body']['id'];}return db[_0x53e3('0x31')][_0x53e3('0x51')]({'where':{'id':_0x3813d1[_0x53e3('0x54')]['id']}})['then'](handleEntityNotFound(_0x2c1d4a,null))[_0x53e3('0x28')](function(_0x541838){if(_0x541838){_0x3813d1[_0x53e3('0x55')][_0x53e3('0x58')]=_0x541838['id'];return db[_0x53e3('0x57')][_0x53e3('0x4c')](_0x3813d1[_0x53e3('0x55')]);}})[_0x53e3('0x28')](respondWithResult(_0x2c1d4a,null))['catch'](handleError(_0x2c1d4a,null));};exports['getAllConditions']=function(_0xcfd74c,_0x25aa4d,_0x4278ac){var _0x16ff14={};var _0xf4aae9={};var _0x188af8;var _0x4b1589;return db[_0x53e3('0x31')][_0x53e3('0x59')]({'where':{'id':_0xcfd74c[_0x53e3('0x54')]['id']}})[_0x53e3('0x28')](handleEntityNotFound(_0x25aa4d,null))[_0x53e3('0x28')](function(_0x33fccc){if(_0x33fccc){_0x188af8=_0x33fccc;_0xf4aae9[_0x53e3('0x39')]=_['keys'](db[_0x53e3('0x57')]['rawAttributes']);_0xf4aae9[_0x53e3('0x35')]=_[_0x53e3('0x36')](_0xcfd74c['query']);_0xf4aae9[_0x53e3('0x37')]=_['intersection'](_0xf4aae9[_0x53e3('0x39')],_0xf4aae9[_0x53e3('0x35')]);_0x16ff14['attributes']=_[_0x53e3('0x38')](_0xf4aae9['model'],qs['fields'](_0xcfd74c[_0x53e3('0x35')]['fields']));_0x16ff14[_0x53e3('0x3a')]=_0x16ff14[_0x53e3('0x3a')][_0x53e3('0x3c')]?_0x16ff14[_0x53e3('0x3a')]:_0xf4aae9['model'];_0x16ff14[_0x53e3('0x5a')]=qs[_0x53e3('0x3f')](_0xcfd74c[_0x53e3('0x35')]['sort']);_0x16ff14[_0x53e3('0x42')]=qs['filters'](_[_0x53e3('0x40')](_0xcfd74c[_0x53e3('0x35')],_0xf4aae9[_0x53e3('0x37')]));if(_0xcfd74c[_0x53e3('0x35')]['filter']){_0x16ff14[_0x53e3('0x42')]=_[_0x53e3('0x43')](_0x16ff14[_0x53e3('0x42')],{'$or':_[_0x53e3('0x44')](_0x16ff14[_0x53e3('0x3a')],function(_0x4bd146){var _0x5c6265={};_0x5c6265[_0x4bd146]={'$like':'%'+_0xcfd74c['query']['filter']+'%'};return _0x5c6265;})});}_0x16ff14=_[_0x53e3('0x43')]({},_0x16ff14,_0xcfd74c['options']);return _0x188af8[_0x53e3('0x5b')](_0x16ff14);}})[_0x53e3('0x28')](function(_0x46b935){if(_0x46b935){_0x4b1589=_0x46b935['length'];if(!_0xcfd74c['query']['hasOwnProperty'](_0x53e3('0x3e'))){_0x16ff14[_0x53e3('0x21')]=qs[_0x53e3('0x21')](_0xcfd74c[_0x53e3('0x35')][_0x53e3('0x21')]);_0x16ff14[_0x53e3('0x20')]=qs['offset'](_0xcfd74c[_0x53e3('0x35')][_0x53e3('0x20')]);}return _0x188af8['getAllConditions'](_0x16ff14);}})[_0x53e3('0x28')](function(_0x169319){if(_0x169319){return _0x169319?{'count':_0x4b1589,'rows':_0x169319}:null;}})[_0x53e3('0x28')](respondWithResult(_0x25aa4d,null))[_0x53e3('0x48')](handleError(_0x25aa4d,null));};exports['getAnyConditions']=function(_0x192db2,_0x3a7f86,_0xa8d87a){var _0x50f96b={};var _0x5cbe1a={};var _0x5955fd;var _0x44113b;return db[_0x53e3('0x31')]['findOne']({'where':{'id':_0x192db2[_0x53e3('0x54')]['id']}})[_0x53e3('0x28')](handleEntityNotFound(_0x3a7f86,null))[_0x53e3('0x28')](function(_0x1db487){if(_0x1db487){_0x5955fd=_0x1db487;_0x5cbe1a[_0x53e3('0x39')]=_[_0x53e3('0x36')](db[_0x53e3('0x57')]['rawAttributes']);_0x5cbe1a['query']=_[_0x53e3('0x36')](_0x192db2[_0x53e3('0x35')]);_0x5cbe1a[_0x53e3('0x37')]=_[_0x53e3('0x38')](_0x5cbe1a[_0x53e3('0x39')],_0x5cbe1a[_0x53e3('0x35')]);_0x50f96b[_0x53e3('0x3a')]=_['intersection'](_0x5cbe1a[_0x53e3('0x39')],qs['fields'](_0x192db2[_0x53e3('0x35')][_0x53e3('0x3b')]));_0x50f96b[_0x53e3('0x3a')]=_0x50f96b[_0x53e3('0x3a')][_0x53e3('0x3c')]?_0x50f96b['attributes']:_0x5cbe1a[_0x53e3('0x39')];_0x50f96b[_0x53e3('0x5a')]=qs[_0x53e3('0x3f')](_0x192db2[_0x53e3('0x35')]['sort']);_0x50f96b[_0x53e3('0x42')]=qs[_0x53e3('0x37')](_[_0x53e3('0x40')](_0x192db2['query'],_0x5cbe1a[_0x53e3('0x37')]));if(_0x192db2[_0x53e3('0x35')][_0x53e3('0x41')]){_0x50f96b[_0x53e3('0x42')]=_[_0x53e3('0x43')](_0x50f96b[_0x53e3('0x42')],{'$or':_[_0x53e3('0x44')](_0x50f96b[_0x53e3('0x3a')],function(_0xb9f589){var _0x5c0fb9={};_0x5c0fb9[_0xb9f589]={'$like':'%'+_0x192db2[_0x53e3('0x35')][_0x53e3('0x41')]+'%'};return _0x5c0fb9;})});}_0x50f96b=_['merge']({},_0x50f96b,_0x192db2[_0x53e3('0x45')]);return _0x5955fd[_0x53e3('0x5c')](_0x50f96b);}})[_0x53e3('0x28')](function(_0x24136c){if(_0x24136c){_0x44113b=_0x24136c[_0x53e3('0x3c')];if(!_0x192db2[_0x53e3('0x35')][_0x53e3('0x3d')](_0x53e3('0x3e'))){_0x50f96b[_0x53e3('0x21')]=qs[_0x53e3('0x21')](_0x192db2['query']['limit']);_0x50f96b[_0x53e3('0x20')]=qs[_0x53e3('0x20')](_0x192db2[_0x53e3('0x35')][_0x53e3('0x20')]);}return _0x5955fd[_0x53e3('0x5c')](_0x50f96b);}})[_0x53e3('0x28')](function(_0x3d11ce){if(_0x3d11ce){return _0x3d11ce?{'count':_0x44113b,'rows':_0x3d11ce}:null;}})[_0x53e3('0x28')](respondWithResult(_0x3a7f86,null))[_0x53e3('0x48')](handleError(_0x3a7f86,null));};exports[_0x53e3('0x5d')]=function(_0x28ab0c,_0x332829,_0x2fd4be){if(_0x28ab0c[_0x53e3('0x55')]['id']){delete _0x28ab0c[_0x53e3('0x55')]['id'];}return db[_0x53e3('0x31')][_0x53e3('0x51')]({'where':{'id':_0x28ab0c[_0x53e3('0x54')]['id']}})[_0x53e3('0x28')](handleEntityNotFound(_0x332829,null))['then'](function(_0xcc61d4){if(_0xcc61d4){_0x28ab0c[_0x53e3('0x55')]['TriggerId']=_0xcc61d4['id'];return db[_0x53e3('0x5e')][_0x53e3('0x4c')](_0x28ab0c[_0x53e3('0x55')]);}})['then'](respondWithResult(_0x332829,null))[_0x53e3('0x48')](handleError(_0x332829,null));};exports[_0x53e3('0x5f')]=function(_0x46e84e,_0x4a2598,_0x4dde4b){var _0x5825d8={};var _0x244f2b={};var _0x28ee52;var _0x553481;return db['Trigger'][_0x53e3('0x59')]({'where':{'id':_0x46e84e[_0x53e3('0x54')]['id']}})['then'](handleEntityNotFound(_0x4a2598,null))['then'](function(_0xad61d1){if(_0xad61d1){_0x28ee52=_0xad61d1;_0x244f2b[_0x53e3('0x39')]=_[_0x53e3('0x36')](db['Action'][_0x53e3('0x49')]);_0x244f2b[_0x53e3('0x35')]=_['keys'](_0x46e84e[_0x53e3('0x35')]);_0x244f2b[_0x53e3('0x37')]=_[_0x53e3('0x38')](_0x244f2b[_0x53e3('0x39')],_0x244f2b[_0x53e3('0x35')]);_0x5825d8[_0x53e3('0x3a')]=_['intersection'](_0x244f2b[_0x53e3('0x39')],qs['fields'](_0x46e84e[_0x53e3('0x35')]['fields']));_0x5825d8[_0x53e3('0x3a')]=_0x5825d8[_0x53e3('0x3a')][_0x53e3('0x3c')]?_0x5825d8['attributes']:_0x244f2b[_0x53e3('0x39')];_0x5825d8['order']=qs[_0x53e3('0x3f')](_0x46e84e[_0x53e3('0x35')][_0x53e3('0x3f')]);_0x5825d8[_0x53e3('0x42')]=qs[_0x53e3('0x37')](_[_0x53e3('0x40')](_0x46e84e[_0x53e3('0x35')],_0x244f2b['filters']));if(_0x46e84e[_0x53e3('0x35')][_0x53e3('0x41')]){_0x5825d8[_0x53e3('0x42')]=_[_0x53e3('0x43')](_0x5825d8[_0x53e3('0x42')],{'$or':_[_0x53e3('0x44')](_0x5825d8[_0x53e3('0x3a')],function(_0x28808a){var _0x473e39={};_0x473e39[_0x28808a]={'$like':'%'+_0x46e84e[_0x53e3('0x35')][_0x53e3('0x41')]+'%'};return _0x473e39;})});}_0x5825d8=_[_0x53e3('0x43')]({},_0x5825d8,_0x46e84e['options']);return _0x28ee52['getActions'](_0x5825d8);}})['then'](function(_0x5e47bd){if(_0x5e47bd){_0x553481=_0x5e47bd[_0x53e3('0x3c')];if(!_0x46e84e[_0x53e3('0x35')][_0x53e3('0x3d')](_0x53e3('0x3e'))){_0x5825d8[_0x53e3('0x21')]=qs[_0x53e3('0x21')](_0x46e84e[_0x53e3('0x35')][_0x53e3('0x21')]);_0x5825d8[_0x53e3('0x20')]=qs[_0x53e3('0x20')](_0x46e84e[_0x53e3('0x35')][_0x53e3('0x20')]);}return _0x28ee52['getActions'](_0x5825d8);}})['then'](function(_0x1f3600){if(_0x1f3600){return _0x1f3600?{'count':_0x553481,'rows':_0x1f3600}:null;}})[_0x53e3('0x28')](respondWithResult(_0x4a2598,null))[_0x53e3('0x48')](handleError(_0x4a2598,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index a13f55d..f6da4c9 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 _0x238f=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Trigger'];(function(_0x87de13,_0x4bbd67){var _0x187249=function(_0x29b83e){while(--_0x29b83e){_0x87de13['push'](_0x87de13['shift']());}};_0x187249(++_0x4bbd67);}(_0x238f,0xa5));var _0xf238=function(_0x547af1,_0x435140){_0x547af1=_0x547af1-0x0;var _0x2efe83=_0x238f[_0x547af1];return _0x2efe83;};'use strict';var _=require(_0xf238('0x0'));var util=require(_0xf238('0x1'));var logger=require(_0xf238('0x2'))('api');var moment=require(_0xf238('0x3'));var BPromise=require(_0xf238('0x4'));var rp=require(_0xf238('0x5'));var fs=require('fs');var path=require(_0xf238('0x6'));var rimraf=require(_0xf238('0x7'));var config=require(_0xf238('0x8'));var attributes=require('./trigger.attributes');module[_0xf238('0x9')]=function(_0x2b9e9f,_0x4e4685){return _0x2b9e9f['define'](_0xf238('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0eec=['exports','define','Trigger','tools_triggers','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x372b43,_0x388f06){var _0x8d5aca=function(_0x566b14){while(--_0x566b14){_0x372b43['push'](_0x372b43['shift']());}};_0x8d5aca(++_0x388f06);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc0ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc0ee('0x1'));var moment=require(_0xc0ee('0x2'));var BPromise=require(_0xc0ee('0x3'));var rp=require(_0xc0ee('0x4'));var fs=require('fs');var path=require(_0xc0ee('0x5'));var rimraf=require(_0xc0ee('0x6'));var config=require(_0xc0ee('0x7'));var attributes=require('./trigger.attributes');module[_0xc0ee('0x8')]=function(_0x4db3d6,_0x218797){return _0x4db3d6[_0xc0ee('0x9')](_0xc0ee('0xa'),attributes,{'tableName':_0xc0ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 52eb087..c5eb019 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 _0x9012=['request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','Trigger','options','raw','where','attributes','limit','include','map','model','debug','GetTrigger','ShowTrigger','find','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5adcb0,_0x11ecb8){var _0x90afed=function(_0x504873){while(--_0x504873){_0x5adcb0['push'](_0x5adcb0['shift']());}};_0x90afed(++_0x11ecb8);}(_0x9012,0x135));var _0x2901=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x9012[_0x59ae8f];return _0x3900b5;};'use strict';var _=require(_0x2901('0x0'));var util=require(_0x2901('0x1'));var moment=require('moment');var BPromise=require(_0x2901('0x2'));var rs=require(_0x2901('0x3'));var fs=require('fs');var Redis=require(_0x2901('0x4'));var db=require(_0x2901('0x5'))['db'];var utils=require(_0x2901('0x6'));var logger=require('../../config/logger')(_0x2901('0x7'));var config=require(_0x2901('0x8'));var jayson=require(_0x2901('0x9'));var client=jayson[_0x2901('0xa')][_0x2901('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b67fe,_0x1bdd6b,_0x2187b1){return new BPromise(function(_0x13a3d9,_0x52ecba){return client[_0x2901('0xc')](_0x1b67fe,_0x2187b1)[_0x2901('0xd')](function(_0x592a8a){logger[_0x2901('0xe')]('Trigger,\x20%s,\x20%s',_0x1bdd6b,_0x2901('0xf'));logger['debug'](_0x2901('0x10'),_0x1bdd6b,_0x2901('0xf'),JSON[_0x2901('0x11')](_0x592a8a));if(_0x592a8a[_0x2901('0x12')]){if(_0x592a8a[_0x2901('0x12')]['code']===0x1f4){logger[_0x2901('0x12')](_0x2901('0x13'),_0x1bdd6b,_0x592a8a[_0x2901('0x12')][_0x2901('0x14')]);return _0x52ecba(_0x592a8a['error']['message']);}logger['error'](_0x2901('0x13'),_0x1bdd6b,_0x592a8a[_0x2901('0x12')][_0x2901('0x14')]);return _0x13a3d9(_0x592a8a['error']['message']);}else{logger['info'](_0x2901('0x13'),_0x1bdd6b,_0x2901('0xf'));_0x13a3d9(_0x592a8a[_0x2901('0x15')][_0x2901('0x14')]);}})['catch'](function(_0x321b7f){logger[_0x2901('0x12')](_0x2901('0x13'),_0x1bdd6b,_0x321b7f);_0x52ecba(_0x321b7f);});});}exports['GetTrigger']=function(_0x249586){var _0x731925=this;return new Promise(function(_0x45a4d0,_0x41779b){return db[_0x2901('0x16')]['findAll']({'raw':_0x249586[_0x2901('0x17')]?_0x249586['options'][_0x2901('0x18')]===undefined?!![]:![]:!![],'where':_0x249586[_0x2901('0x17')]?_0x249586[_0x2901('0x17')][_0x2901('0x19')]||null:null,'attributes':_0x249586['options']?_0x249586[_0x2901('0x17')][_0x2901('0x1a')]||null:null,'limit':_0x249586[_0x2901('0x17')]?_0x249586['options'][_0x2901('0x1b')]||null:null,'include':_0x249586['options']?_0x249586[_0x2901('0x17')][_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x249586[_0x2901('0x17')][_0x2901('0x1c')],function(_0x3c0d22){return{'model':db[_0x3c0d22[_0x2901('0x1e')]],'as':_0x3c0d22['as'],'attributes':_0x3c0d22['attributes'],'include':_0x3c0d22[_0x2901('0x1c')]?_['map'](_0x3c0d22[_0x2901('0x1c')],function(_0x5903db){return{'model':db[_0x5903db[_0x2901('0x1e')]],'as':_0x5903db['as'],'attributes':_0x5903db[_0x2901('0x1a')],'include':_0x5903db[_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x5903db[_0x2901('0x1c')],function(_0xb6e83d){return{'model':db[_0xb6e83d[_0x2901('0x1e')]],'as':_0xb6e83d['as'],'attributes':_0xb6e83d[_0x2901('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2901('0xd')](function(_0x4706bb){logger[_0x2901('0xe')]('GetTrigger',_0x249586);logger[_0x2901('0x1f')](_0x2901('0x20'),_0x249586,JSON[_0x2901('0x11')](_0x4706bb));_0x45a4d0(_0x4706bb);})['catch'](function(_0x1189e9){logger[_0x2901('0x12')]('GetTrigger',_0x1189e9[_0x2901('0x14')],_0x249586);_0x41779b(_0x731925[_0x2901('0x12')](0x1f4,_0x1189e9[_0x2901('0x14')]));});});};exports[_0x2901('0x21')]=function(_0x187c37){var _0x476772=this;return new Promise(function(_0x47f3f3,_0x363099){return db[_0x2901('0x16')][_0x2901('0x22')]({'raw':_0x187c37['options']?_0x187c37['options'][_0x2901('0x18')]===undefined?!![]:![]:!![],'where':_0x187c37[_0x2901('0x17')]?_0x187c37[_0x2901('0x17')]['where']||null:null,'attributes':_0x187c37['options']?_0x187c37['options'][_0x2901('0x1a')]||null:null,'include':_0x187c37[_0x2901('0x17')]?_0x187c37[_0x2901('0x17')][_0x2901('0x1c')]?_[_0x2901('0x1d')](_0x187c37[_0x2901('0x17')]['include'],function(_0x41eba0){return{'model':db[_0x41eba0[_0x2901('0x1e')]],'as':_0x41eba0['as'],'attributes':_0x41eba0[_0x2901('0x1a')],'include':_0x41eba0[_0x2901('0x1c')]?_['map'](_0x41eba0[_0x2901('0x1c')],function(_0x5c97c0){return{'model':db[_0x5c97c0['model']],'as':_0x5c97c0['as'],'attributes':_0x5c97c0[_0x2901('0x1a')],'include':_0x5c97c0['include']?_[_0x2901('0x1d')](_0x5c97c0['include'],function(_0x4ef7f3){return{'model':db[_0x4ef7f3[_0x2901('0x1e')]],'as':_0x4ef7f3['as'],'attributes':_0x4ef7f3[_0x2901('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x588873){logger['info'](_0x2901('0x21'),_0x187c37);logger[_0x2901('0x1f')](_0x2901('0x21'),_0x187c37,JSON['stringify'](_0x588873));_0x47f3f3(_0x588873);})[_0x2901('0x23')](function(_0x221704){logger['error'](_0x2901('0x21'),_0x221704['message'],_0x187c37);_0x363099(_0x476772[_0x2901('0x12')](0x1f4,_0x221704['message']));});});}; \ No newline at end of file +var _0x566a=['../../config/utils','../../config/logger','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowTrigger','find','lodash','util','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x566a,0x1ca));var _0xa566=function(_0x517505,_0x24fb99){_0x517505=_0x517505-0x0;var _0x266134=_0x566a[_0x517505];return _0x266134;};'use strict';var _=require(_0xa566('0x0'));var util=require(_0xa566('0x1'));var moment=require(_0xa566('0x2'));var BPromise=require('bluebird');var rs=require(_0xa566('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa566('0x4'));var logger=require(_0xa566('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa566('0x6'));var client=jayson[_0xa566('0x7')][_0xa566('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4726c5,_0x2d6d0d,_0x4a1459){return new BPromise(function(_0x120890,_0x42c5fb){return client[_0xa566('0x9')](_0x4726c5,_0x4a1459)['then'](function(_0x308076){logger[_0xa566('0xa')](_0xa566('0xb'),_0x2d6d0d,_0xa566('0xc'));logger[_0xa566('0xd')](_0xa566('0xe'),_0x2d6d0d,'request\x20sent',JSON[_0xa566('0xf')](_0x308076));if(_0x308076[_0xa566('0x10')]){if(_0x308076[_0xa566('0x10')]['code']===0x1f4){logger[_0xa566('0x10')](_0xa566('0xb'),_0x2d6d0d,_0x308076[_0xa566('0x10')][_0xa566('0x11')]);return _0x42c5fb(_0x308076[_0xa566('0x10')][_0xa566('0x11')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x2d6d0d,_0x308076[_0xa566('0x10')][_0xa566('0x11')]);return _0x120890(_0x308076[_0xa566('0x10')][_0xa566('0x11')]);}else{logger[_0xa566('0xa')](_0xa566('0xb'),_0x2d6d0d,_0xa566('0xc'));_0x120890(_0x308076[_0xa566('0x12')][_0xa566('0x11')]);}})['catch'](function(_0x506325){logger[_0xa566('0x10')]('Trigger,\x20%s,\x20%s',_0x2d6d0d,_0x506325);_0x42c5fb(_0x506325);});});}exports[_0xa566('0x13')]=function(_0x549839){var _0x4dd396=this;return new Promise(function(_0x37bf50,_0x2df6d8){return db[_0xa566('0x14')][_0xa566('0x15')]({'raw':_0x549839[_0xa566('0x16')]?_0x549839[_0xa566('0x16')][_0xa566('0x17')]===undefined?!![]:![]:!![],'where':_0x549839[_0xa566('0x16')]?_0x549839['options'][_0xa566('0x18')]||null:null,'attributes':_0x549839[_0xa566('0x16')]?_0x549839['options']['attributes']||null:null,'limit':_0x549839[_0xa566('0x16')]?_0x549839['options'][_0xa566('0x19')]||null:null,'include':_0x549839['options']?_0x549839[_0xa566('0x16')][_0xa566('0x1a')]?_[_0xa566('0x1b')](_0x549839[_0xa566('0x16')][_0xa566('0x1a')],function(_0x38ef78){return{'model':db[_0x38ef78[_0xa566('0x1c')]],'as':_0x38ef78['as'],'attributes':_0x38ef78[_0xa566('0x1d')],'include':_0x38ef78[_0xa566('0x1a')]?_[_0xa566('0x1b')](_0x38ef78[_0xa566('0x1a')],function(_0x56b8d9){return{'model':db[_0x56b8d9[_0xa566('0x1c')]],'as':_0x56b8d9['as'],'attributes':_0x56b8d9['attributes'],'include':_0x56b8d9[_0xa566('0x1a')]?_['map'](_0x56b8d9['include'],function(_0x16db9d){return{'model':db[_0x16db9d['model']],'as':_0x16db9d['as'],'attributes':_0x16db9d[_0xa566('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa566('0x1e')](function(_0x54f02a){logger[_0xa566('0xa')](_0xa566('0x13'),_0x549839);logger[_0xa566('0xd')]('GetTrigger',_0x549839,JSON[_0xa566('0xf')](_0x54f02a));_0x37bf50(_0x54f02a);})['catch'](function(_0x15e7b9){logger[_0xa566('0x10')](_0xa566('0x13'),_0x15e7b9[_0xa566('0x11')],_0x549839);_0x2df6d8(_0x4dd396['error'](0x1f4,_0x15e7b9[_0xa566('0x11')]));});});};exports[_0xa566('0x1f')]=function(_0x2cd3d3){var _0x2278e3=this;return new Promise(function(_0x17b516,_0x530291){return db[_0xa566('0x14')][_0xa566('0x20')]({'raw':_0x2cd3d3[_0xa566('0x16')]?_0x2cd3d3[_0xa566('0x16')][_0xa566('0x17')]===undefined?!![]:![]:!![],'where':_0x2cd3d3[_0xa566('0x16')]?_0x2cd3d3['options'][_0xa566('0x18')]||null:null,'attributes':_0x2cd3d3[_0xa566('0x16')]?_0x2cd3d3[_0xa566('0x16')][_0xa566('0x1d')]||null:null,'include':_0x2cd3d3[_0xa566('0x16')]?_0x2cd3d3[_0xa566('0x16')][_0xa566('0x1a')]?_[_0xa566('0x1b')](_0x2cd3d3[_0xa566('0x16')][_0xa566('0x1a')],function(_0x1f4d99){return{'model':db[_0x1f4d99[_0xa566('0x1c')]],'as':_0x1f4d99['as'],'attributes':_0x1f4d99['attributes'],'include':_0x1f4d99[_0xa566('0x1a')]?_[_0xa566('0x1b')](_0x1f4d99['include'],function(_0x4268ab){return{'model':db[_0x4268ab[_0xa566('0x1c')]],'as':_0x4268ab['as'],'attributes':_0x4268ab[_0xa566('0x1d')],'include':_0x4268ab['include']?_['map'](_0x4268ab['include'],function(_0x50bf76){return{'model':db[_0x50bf76[_0xa566('0x1c')]],'as':_0x50bf76['as'],'attributes':_0x50bf76[_0xa566('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa566('0x1e')](function(_0x4f5c0f){logger[_0xa566('0xa')](_0xa566('0x1f'),_0x2cd3d3);logger['debug'](_0xa566('0x1f'),_0x2cd3d3,JSON['stringify'](_0x4f5c0f));_0x17b516(_0x4f5c0f);})['catch'](function(_0x423900){logger[_0xa566('0x10')](_0xa566('0x1f'),_0x423900['message'],_0x2cd3d3);_0x530291(_0x2278e3[_0xa566('0x10')](0x1f4,_0x423900[_0xa566('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 7d6411d..4bb79e1 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 _0xe666=['../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','util','connect-timeout','express','fs-extra'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xe666,0x183));var _0x6e66=function(_0x298e16,_0x2c4521){_0x298e16=_0x298e16-0x0;var _0x11262e=_0xe666[_0x298e16];return _0x11262e;};'use strict';var multer=require('multer');var util=require(_0x6e66('0x0'));var path=require('path');var timeout=require(_0x6e66('0x1'));var express=require(_0x6e66('0x2'));var router=express['Router']();var fs_extra=require(_0x6e66('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6e66('0x4'));var config=require(_0x6e66('0x5'));var controller=require(_0x6e66('0x6'));router[_0x6e66('0x7')]('/',auth[_0x6e66('0x8')](),controller[_0x6e66('0x9')]);router[_0x6e66('0x7')](_0x6e66('0xa'),auth['isAuthenticated'](),controller[_0x6e66('0xb')]);router['post']('/:id/clone',auth[_0x6e66('0x8')](),controller['clone']);router['post']('/',auth['isAuthenticated'](),controller[_0x6e66('0xc')]);router[_0x6e66('0xd')](_0x6e66('0xa'),auth[_0x6e66('0x8')](),controller[_0x6e66('0xe')]);router[_0x6e66('0xf')]('/:id',auth[_0x6e66('0x8')](),controller['destroy']);module[_0x6e66('0x10')]=router; \ No newline at end of file +var _0x1106=['show','/:id/clone','post','create','put','update','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x4eda15,_0x28fa8c){var _0x292fe7=function(_0x2474f4){while(--_0x2474f4){_0x4eda15['push'](_0x4eda15['shift']());}};_0x292fe7(++_0x28fa8c);}(_0x1106,0x128));var _0x6110=function(_0x2d1ff8,_0xf72038){_0x2d1ff8=_0x2d1ff8-0x0;var _0x175754=_0x1106[_0x2d1ff8];return _0x175754;};'use strict';var multer=require(_0x6110('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6110('0x1'));var express=require(_0x6110('0x2'));var router=express[_0x6110('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6110('0x4'));var interaction=require(_0x6110('0x5'));var config=require(_0x6110('0x6'));var controller=require('./trunk.controller');router[_0x6110('0x7')]('/',auth[_0x6110('0x8')](),controller['index']);router[_0x6110('0x7')](_0x6110('0x9'),auth['isAuthenticated'](),controller[_0x6110('0xa')]);router['post'](_0x6110('0xb'),auth[_0x6110('0x8')](),controller['clone']);router[_0x6110('0xc')]('/',auth[_0x6110('0x8')](),controller[_0x6110('0xd')]);router[_0x6110('0xe')](_0x6110('0x9'),auth['isAuthenticated'](),controller[_0x6110('0xf')]);router['delete'](_0x6110('0x9'),auth[_0x6110('0x8')](),controller['destroy']);module[_0x6110('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 0e7fc6a..6787579 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 _0x6f2d=['getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','active','actpass','dynamic','BOOLEAN','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','transport','join'];(function(_0x53bef4,_0x3faddf){var _0xc5c4f0=function(_0x48b61d){while(--_0x48b61d){_0x53bef4['push'](_0x53bef4['shift']());}};_0xc5c4f0(++_0x3faddf);}(_0x6f2d,0xa3));var _0xd6f2=function(_0x56dc77,_0x509aa5){_0x56dc77=_0x56dc77-0x0;var _0x1a03ff=_0x6f2d[_0x56dc77];return _0x1a03ff;};'use strict';var Sequelize=require('sequelize');module[_0xd6f2('0x0')]={'name':{'type':Sequelize[_0xd6f2('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x3'),_0xd6f2('0x4'),_0xd6f2('0x5')),'allowNull':![],'defaultValue':_0xd6f2('0x3')},'context':{'type':Sequelize[_0xd6f2('0x1')],'allowNull':![],'defaultValue':_0xd6f2('0x6')},'callingpres':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x7'),_0xd6f2('0x8'),'ALLOWED_FAILED_SCREEN',_0xd6f2('0x9'),'PROHIB_NOT_SCREENED',_0xd6f2('0xa'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0xd6f2('0x1')]},'permit':{'type':Sequelize[_0xd6f2('0x1')]},'secret':{'type':Sequelize[_0xd6f2('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xd6f2('0x1')]},'transport':{'type':Sequelize[_0xd6f2('0x1')],'defaultValue':'udp','set':function(_0x2bdf29){this['setDataValue'](_0xd6f2('0xb'),_0x2bdf29?_0x2bdf29[_0xd6f2('0xc')](','):null);},'get':function(){return this[_0xd6f2('0xd')]('transport')?this[_0xd6f2('0xd')]('transport')[_0xd6f2('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xd6f2('0xf'),_0xd6f2('0x10'),_0xd6f2('0x11'),_0xd6f2('0x12'),_0xd6f2('0x13')),'defaultValue':_0xd6f2('0xf')},'directmedia':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no',_0xd6f2('0x15'),_0xd6f2('0x16'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xd6f2('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd6f2('0x1')]},'directmediadeny':{'type':Sequelize[_0xd6f2('0x1')]},'nat':{'type':Sequelize[_0xd6f2('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x27a7a2){this['setDataValue'](_0xd6f2('0x17'),_0x27a7a2?_0x27a7a2[_0xd6f2('0xc')](','):null);},'get':function(){return this['getDataValue'](_0xd6f2('0x17'))?this[_0xd6f2('0xd')]('nat')['split'](','):null;},'comment':_0xd6f2('0x18')},'callgroup':{'type':Sequelize[_0xd6f2('0x1')]},'namedcallgroup':{'type':Sequelize[_0xd6f2('0x1')]},'pickupgroup':{'type':Sequelize[_0xd6f2('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xd6f2('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd6f2('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd6f2('0x1')],'defaultValue':_0xd6f2('0x19')},'allow':{'type':Sequelize[_0xd6f2('0x1')],'allowNull':![],'defaultValue':_0xd6f2('0x1a'),'set':function(_0x2207fb){this[_0xd6f2('0x1b')](_0xd6f2('0x1c'),_0x2207fb?_0x2207fb['join'](';'):_0xd6f2('0x1a'));},'get':function(){return this[_0xd6f2('0xd')](_0xd6f2('0x1c'))?this['getDataValue'](_0xd6f2('0x1c'))[_0xd6f2('0xe')](';'):null;},'comment':_0xd6f2('0x1d')},'autoframing':{'type':Sequelize['ENUM'](_0xd6f2('0x14'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x4ab94d){this[_0xd6f2('0x1b')]('insecure',_0x4ab94d?_0x4ab94d[_0xd6f2('0xc')](','):null);},'get':function(){return this['getDataValue'](_0xd6f2('0x1e'))?this[_0xd6f2('0xd')](_0xd6f2('0x1e'))[_0xd6f2('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd6f2('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no',_0xd6f2('0x1f'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0xd6f2('0x14'),'no')},'accountcode':{'type':Sequelize[_0xd6f2('0x20')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xd6f2('0x21')},'amaflags':{'type':Sequelize[_0xd6f2('0x1')]},'callcounter':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no'),'defaultValue':_0xd6f2('0x14')},'busylevel':{'type':Sequelize[_0xd6f2('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0xd6f2('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no',_0xd6f2('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd6f2('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no')},'mailbox':{'type':Sequelize[_0xd6f2('0x1')]},'session_timers':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x23'),_0xd6f2('0x24'),_0xd6f2('0x25'))},'session_expires':{'type':Sequelize[_0xd6f2('0x20')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xd6f2('0x2')]('uac',_0xd6f2('0x26')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xd6f2('0x1')]},'regexten':{'type':Sequelize[_0xd6f2('0x1')]},'fromdomain':{'type':Sequelize[_0xd6f2('0x1')]},'fromuser':{'type':Sequelize[_0xd6f2('0x1')]},'port':{'type':Sequelize[_0xd6f2('0x20')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xd6f2('0x14'),'no'),'defaultValue':_0xd6f2('0x14')},'keepalive':{'type':Sequelize[_0xd6f2('0x20')](0xb)},'defaultip':{'type':Sequelize[_0xd6f2('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xd6f2('0x20')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd6f2('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd6f2('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xd6f2('0x20')](0xb)},'timerb':{'type':Sequelize[_0xd6f2('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd6f2('0x20')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xd6f2('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no')},'force_avp':{'type':Sequelize[_0xd6f2('0x2')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0xd6f2('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no',_0xd6f2('0x27'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xd6f2('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd6f2('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xd6f2('0x1')]},'dtlscafile':{'type':Sequelize[_0xd6f2('0x1')]},'dtlscapath':{'type':Sequelize[_0xd6f2('0x1')]},'dtlssetup':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x28'),'passive',_0xd6f2('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd6f2('0x1')]},'usereqphone':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd6f2('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xd6f2('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no')},'vmexten':{'type':Sequelize[_0xd6f2('0x1')]},'mohinterpret':{'type':Sequelize[_0xd6f2('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xd6f2('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0xd6f2('0x2a')},'canreinvite':{'type':Sequelize[_0xd6f2('0x2')](_0xd6f2('0x14'),'no',_0xd6f2('0x15'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd6f2('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xd6f2('0x2b')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd6f2('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x2dd8=['update','outgoing','setDataValue','nat','all','allow','ulaw;alaw;gsm','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<>','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat'];(function(_0x3f09a9,_0x2a1758){var _0x854a6d=function(_0x3eff89){while(--_0x3eff89){_0x3f09a9['push'](_0x3f09a9['shift']());}};_0x854a6d(++_0x2a1758);}(_0x2dd8,0x83));var _0x82dd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dd8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x82dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82dd('0x1')],'allowNull':![],'unique':_0x82dd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x4'),_0x82dd('0x5'),'peer'),'allowNull':![],'defaultValue':_0x82dd('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x82dd('0x6')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x82dd('0x7'),_0x82dd('0x8'),_0x82dd('0x9'),_0x82dd('0xa'),_0x82dd('0xb'),_0x82dd('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0x82dd('0x1')]},'permit':{'type':Sequelize[_0x82dd('0x1')]},'secret':{'type':Sequelize[_0x82dd('0x1')]},'md5secret':{'type':Sequelize[_0x82dd('0x1')]},'remotesecret':{'type':Sequelize[_0x82dd('0x1')]},'transport':{'type':Sequelize[_0x82dd('0x1')],'defaultValue':_0x82dd('0xd'),'set':function(_0x24333e){this['setDataValue'](_0x82dd('0xe'),_0x24333e?_0x24333e[_0x82dd('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x82dd('0xe'))?this[_0x82dd('0x10')](_0x82dd('0xe'))[_0x82dd('0x11')](','):null;},'comment':_0x82dd('0x12')},'dtmfmode':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x13'),'info',_0x82dd('0x14'),_0x82dd('0x15'),_0x82dd('0x16')),'defaultValue':_0x82dd('0x13')},'directmedia':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no',_0x82dd('0x18'),_0x82dd('0x19'),_0x82dd('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x82dd('0x1')]},'directmediadeny':{'type':Sequelize[_0x82dd('0x1')]},'nat':{'type':Sequelize[_0x82dd('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x237abd){this[_0x82dd('0x1b')](_0x82dd('0x1c'),_0x237abd?_0x237abd['join'](','):null);},'get':function(){return this[_0x82dd('0x10')](_0x82dd('0x1c'))?this[_0x82dd('0x10')](_0x82dd('0x1c'))[_0x82dd('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x82dd('0x1')]},'namedcallgroup':{'type':Sequelize[_0x82dd('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x82dd('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x82dd('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x82dd('0x1')],'defaultValue':_0x82dd('0x1d')},'allow':{'type':Sequelize[_0x82dd('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x567bf9){this['setDataValue'](_0x82dd('0x1e'),_0x567bf9?_0x567bf9[_0x82dd('0xf')](';'):_0x82dd('0x1f'));},'get':function(){return this[_0x82dd('0x10')](_0x82dd('0x1e'))?this[_0x82dd('0x10')]('allow')[_0x82dd('0x11')](';'):null;},'comment':_0x82dd('0x20')},'autoframing':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no')},'insecure':{'type':Sequelize[_0x82dd('0x1')],'defaultValue':_0x82dd('0x21'),'set':function(_0x3702d2){this[_0x82dd('0x1b')](_0x82dd('0x22'),_0x3702d2?_0x3702d2['join'](','):null);},'get':function(){return this[_0x82dd('0x10')](_0x82dd('0x22'))?this[_0x82dd('0x10')](_0x82dd('0x22'))[_0x82dd('0x11')](','):null;},'comment':_0x82dd('0x23')},'trustrpid':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x82dd('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no',_0x82dd('0x24'))},'promiscredir':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0x82dd('0x25')](0xb)},'setvar':{'type':Sequelize[_0x82dd('0x1')]},'callerid':{'type':Sequelize[_0x82dd('0x1')],'defaultValue':_0x82dd('0x26')},'amaflags':{'type':Sequelize[_0x82dd('0x1')]},'callcounter':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no'),'defaultValue':_0x82dd('0x17')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x82dd('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x82dd('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x82dd('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x82dd('0x1')]},'template':{'type':Sequelize[_0x82dd('0x1')]},'videosupport':{'type':Sequelize[_0x82dd('0x3')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x82dd('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x82dd('0x17'),'no')},'mailbox':{'type':Sequelize[_0x82dd('0x1')]},'session_timers':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x27'),_0x82dd('0x28'),_0x82dd('0x29'))},'session_expires':{'type':Sequelize[_0x82dd('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x82dd('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x2a'),_0x82dd('0x2b')),'defaultValue':_0x82dd('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x82dd('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x82dd('0x1')]},'fromuser':{'type':Sequelize[_0x82dd('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x82dd('0x1')]},'defaultuser':{'type':Sequelize[_0x82dd('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x82dd('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no',_0x82dd('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x82dd('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x82dd('0x25')](0xb)},'timerb':{'type':Sequelize[_0x82dd('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x82dd('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x82dd('0x1')]},'contactacl':{'type':Sequelize[_0x82dd('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x82dd('0x1')]},'use_q850_reason':{'type':Sequelize[_0x82dd('0x1')]},'maxforwards':{'type':Sequelize[_0x82dd('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x82dd('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x82dd('0x17'),'no')},'force_avp':{'type':Sequelize[_0x82dd('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x82dd('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x82dd('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no',_0x82dd('0x2d'),_0x82dd('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x82dd('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x82dd('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x82dd('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x82dd('0x1')]},'dtlscapath':{'type':Sequelize[_0x82dd('0x1')]},'dtlssetup':{'type':Sequelize[_0x82dd('0x3')]('active',_0x82dd('0x2f'),_0x82dd('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x82dd('0x1')]},'usereqphone':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x82dd('0x1')]},'recordofffeature':{'type':Sequelize[_0x82dd('0x1')]},'call_limit':{'type':Sequelize[_0x82dd('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x82dd('0x17'),'no')},'vmexten':{'type':Sequelize[_0x82dd('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x82dd('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x82dd('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x82dd('0x31')},'canreinvite':{'type':Sequelize[_0x82dd('0x3')](_0x82dd('0x17'),'no',_0x82dd('0x18'),'update',_0x82dd('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x82dd('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x82dd('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x82dd('0x1')],'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 7759a50..62f8ef6 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 _0x8d0e=['omit','updatedAt','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','get','Trunks','stack','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','createdAt','body'];(function(_0x38aa04,_0x2c8039){var _0x39bb22=function(_0x5b4e9a){while(--_0x5b4e9a){_0x38aa04['push'](_0x38aa04['shift']());}};_0x39bb22(++_0x2c8039);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x9ad14,_0x582138){_0x9ad14=_0x9ad14-0x0;var _0x1abec7=_0x8d0e[_0x9ad14];return _0x1abec7;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('Trunk,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){var _0x4547b6=_0x402e90[_0xe8d0('0x33')]({'plain':!![]});var _0x4c1347=_0xe8d0('0x34');return db['UserProfileResource'][_0xe8d0('0x32')]({'where':{'type':_0x4c1347,'resourceId':_0x4547b6['id']}})['then'](function(){return _0x402e90;});})[_0xe8d0('0x1e')](function(){_0x1bee61['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0xb2cdbf,_0x1e2430){return function(_0x320565){if(!_0x320565){_0xb2cdbf['sendStatus'](0x194);}return _0x320565;};}function handleError(_0x36a650,_0x354e19){_0x354e19=_0x354e19||0x1f4;return function(_0x20eec5){logger['error'](_0x20eec5[_0xe8d0('0x35')]);if(_0x20eec5[_0xe8d0('0x36')]){delete _0x20eec5[_0xe8d0('0x36')];}_0x36a650[_0xe8d0('0x2a')](_0x354e19)[_0xe8d0('0x37')](_0x20eec5);};}exports['index']=function(_0x5a969a,_0x1828c5){var _0x10970d={},_0x3d76d5={},_0x318106={'count':0x0,'rows':[]};var _0x23d72e=_[_0xe8d0('0x38')](db[_0xe8d0('0x39')]['rawAttributes'],function(_0x5dff14){return{'name':_0x5dff14[_0xe8d0('0x3a')],'type':_0x5dff14[_0xe8d0('0x3b')][_0xe8d0('0x3c')]};});_0x3d76d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x38')](_0x23d72e,'name');_0x3d76d5[_0xe8d0('0x3e')]=_['keys'](_0x5a969a[_0xe8d0('0x3e')]);_0x3d76d5[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x3d76d5['model'],_0x3d76d5[_0xe8d0('0x3e')]);_0x10970d[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x3d76d5[_0xe8d0('0x3d')],qs[_0xe8d0('0x42')](_0x5a969a['query']['fields']));_0x10970d['attributes']=_0x10970d['attributes'][_0xe8d0('0x43')]?_0x10970d['attributes']:_0x3d76d5[_0xe8d0('0x3d')];if(!_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x44')](_0xe8d0('0x45'))){_0x10970d[_0xe8d0('0x46')]=qs[_0xe8d0('0x46')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x46')]);_0x10970d['offset']=qs[_0xe8d0('0x2d')](_0x5a969a[_0xe8d0('0x3e')]['offset']);}_0x10970d['order']=qs[_0xe8d0('0x47')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x47')]);_0x10970d['where']=qs[_0xe8d0('0x3f')](_[_0xe8d0('0x48')](_0x5a969a['query'],_0x3d76d5[_0xe8d0('0x3f')]),_0x23d72e);if(_0x5a969a[_0xe8d0('0x3e')]['filter']){_0x10970d[_0xe8d0('0x49')]=_[_0xe8d0('0x4a')](_0x10970d[_0xe8d0('0x49')],{'$or':_[_0xe8d0('0x38')](_0x23d72e,function(_0x1d5815){if(_0x1d5815[_0xe8d0('0x3b')]!==_0xe8d0('0x4b')){var _0x1ce97d={};_0x1ce97d[_0x1d5815['name']]={'$like':'%'+_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x4c')]+'%'};return _0x1ce97d;}})});}_0x10970d=_[_0xe8d0('0x4a')]({},_0x10970d,_0x5a969a[_0xe8d0('0x4d')]);var _0x28d38b={'where':_0x10970d[_0xe8d0('0x49')]};return db[_0xe8d0('0x39')][_0xe8d0('0x2f')](_0x28d38b)[_0xe8d0('0x1e')](function(_0x2e2c05){_0x318106[_0xe8d0('0x2f')]=_0x2e2c05;if(_0x5a969a[_0xe8d0('0x3e')]['includeAll']){_0x10970d[_0xe8d0('0x4e')]=[{'all':!![]}];}return db[_0xe8d0('0x39')][_0xe8d0('0x4f')](_0x10970d);})[_0xe8d0('0x1e')](function(_0x34047c){_0x318106[_0xe8d0('0x50')]=_0x34047c;return _0x318106;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x1828c5,_0x10970d))['catch'](handleError(_0x1828c5,null));};exports[_0xe8d0('0x51')]=function(_0x424764,_0x151cf4){var _0x205933={'raw':![],'where':{'id':_0x424764[_0xe8d0('0x52')]['id']}},_0x4ed47f={};_0x4ed47f['model']=_[_0xe8d0('0x53')](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x4ed47f[_0xe8d0('0x3e')]=_[_0xe8d0('0x53')](_0x424764[_0xe8d0('0x3e')]);_0x4ed47f[_0xe8d0('0x3f')]=_['intersection'](_0x4ed47f[_0xe8d0('0x3d')],_0x4ed47f['query']);_0x205933['attributes']=_[_0xe8d0('0x40')](_0x4ed47f['model'],qs[_0xe8d0('0x42')](_0x424764['query'][_0xe8d0('0x42')]));_0x205933[_0xe8d0('0x41')]=_0x205933[_0xe8d0('0x41')][_0xe8d0('0x43')]?_0x205933['attributes']:_0x4ed47f[_0xe8d0('0x3d')];if(_0x424764[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x205933[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x205933=_[_0xe8d0('0x4a')]({},_0x205933,_0x424764['options']);return db[_0xe8d0('0x39')][_0xe8d0('0x56')](_0x205933)[_0xe8d0('0x1e')](handleEntityNotFound(_0x151cf4,null))['then'](respondWithResult(_0x151cf4,null))[_0xe8d0('0x28')](handleError(_0x151cf4,null));};exports['clone']=function(_0x56b4fa,_0x1bd329){var _0x37040a={'where':{'id':_0x56b4fa[_0xe8d0('0x52')]['id']}},_0x4e7b49={};_0x4e7b49[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x37040a[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x4e7b49['model'],qs[_0xe8d0('0x42')](_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x42')]));_0x37040a[_0xe8d0('0x41')]=_0x37040a['attributes'][_0xe8d0('0x43')]?_0x37040a[_0xe8d0('0x41')]:_0x4e7b49[_0xe8d0('0x3d')];if(_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x37040a[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x37040a=_['merge']({},_0x37040a,_0x56b4fa['options']);return db[_0xe8d0('0x39')]['find'](_0x37040a)[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](function(_0x4c0d4c){if(_0x4c0d4c){var _0x5ac1ae=_0x4c0d4c[_0xe8d0('0x33')]({'plain':!![]});_0x5ac1ae=qs['omit'](_0x5ac1ae,['id',_0xe8d0('0x57'),'updatedAt']);_0x56b4fa[_0xe8d0('0x58')]=_[_0xe8d0('0x59')](_0x56b4fa[_0xe8d0('0x58')],['id','createdAt',_0xe8d0('0x5a')]);return db[_0xe8d0('0x39')]['create'](_[_0xe8d0('0x4a')](_0x5ac1ae,_0x56b4fa['body']),{'include':_0x56b4fa[_0xe8d0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xe8d0('0x1e')](function(_0x17afc2){var _0x29467d=_0x56b4fa[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x29467d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29467d['role']===_0xe8d0('0x5b')){var _0x55a2df=_0x17afc2[_0xe8d0('0x33')]({'plain':!![]});var _0x18b655=_0xe8d0('0x34');return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':_0x18b655,'userProfileId':_0x29467d[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0x20647d){if(_0x20647d&&_0x20647d[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')][_0xe8d0('0x60')]({'name':_0x55a2df[_0xe8d0('0x36')],'resourceId':_0x55a2df['id'],'type':_0x20647d[_0xe8d0('0x36')],'sectionId':_0x20647d['id']},{})[_0xe8d0('0x1e')](function(){return _0x17afc2;});}else{return _0x17afc2;}})[_0xe8d0('0x28')](function(_0x4a68d5){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x4a68d5);throw _0x4a68d5;});}return _0x17afc2;});}})[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,0xc9))[_0xe8d0('0x28')](handleError(_0x1bd329,null));};exports[_0xe8d0('0x60')]=function(_0x4848d4,_0x2eeb92,_0x1d30c0){var _0x45b42b;return db[_0xe8d0('0x39')][_0xe8d0('0x60')](_0x4848d4[_0xe8d0('0x58')],{'raw':!![]})[_0xe8d0('0x1e')](function(_0x13ceb4){_0x45b42b=_0x13ceb4;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})[_0xe8d0('0x1e')](function(_0xdb3e53){var _0x556d7e=fs['readFileSync'](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x56761c=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x1b5df8=ejs[_0xe8d0('0x68')](_0x556d7e,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x1b5df8);if(_0x45b42b[_0xe8d0('0x6b')]){var _0xb078d8=ejs[_0xe8d0('0x68')](_0x56761c,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0xb078d8);}})[_0xe8d0('0x1e')](function(){return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x60'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x1e')](function(){var _0x500fb0=_0x4848d4[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x500fb0)throw new Error(_0xe8d0('0x6f'));if(_0x500fb0['role']===_0xe8d0('0x5b')){var _0x4c54c4=_0x45b42b[_0xe8d0('0x33')]({'plain':!![]});return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':'Trunks','userProfileId':_0x500fb0[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0xc94cd3){if(_0xc94cd3&&_0xc94cd3[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')]['create']({'name':_0x4c54c4[_0xe8d0('0x36')],'resourceId':_0x4c54c4['id'],'type':_0xc94cd3[_0xe8d0('0x36')],'sectionId':_0xc94cd3['id']},{})[_0xe8d0('0x1e')](function(){return _0x45b42b;});}else{return _0x45b42b;}})[_0xe8d0('0x28')](function(_0x252f0e){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x252f0e);throw _0x252f0e;});}return _0x45b42b;})[_0xe8d0('0x1e')](respondWithResult(_0x2eeb92,0xc9))['catch'](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x31')]=function(_0x31b9d3,_0x14d722,_0x2aa6fc){var _0x4d5997;return db[_0xe8d0('0x39')][_0xe8d0('0x56')]({'where':{'id':_0x31b9d3[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d722,null))[_0xe8d0('0x1e')](saveUpdates(_0x31b9d3['body'],null))[_0xe8d0('0x1e')](function(_0x478eb2){if(_0x478eb2){_0x4d5997=_0x478eb2;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});}})[_0xe8d0('0x1e')](function(_0xa90bdc){if(_0xa90bdc){var _0x87aa04=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2eaf2f=fs[_0xe8d0('0x65')](path['join'](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x761e97=ejs[_0xe8d0('0x68')](_0x87aa04,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x761e97);var _0x605b5f=ejs[_0xe8d0('0x68')](_0x2eaf2f,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x605b5f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x31'),{'module':_0xe8d0('0x6e')});}return null;})[_0xe8d0('0x1e')](function(_0x255e4b){if(_0x255e4b){return _0x4d5997;}})['then'](respondWithResult(_0x14d722,null))['catch'](handleError(_0x14d722,null));};exports[_0xe8d0('0x32')]=function(_0x5c8c7d,_0x3fb7c8,_0x16098b){var _0x363b3a;return db['Trunk'][_0xe8d0('0x56')]({'where':{'id':_0x5c8c7d['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x3fb7c8,null))[_0xe8d0('0x1e')](removeEntity(_0x3fb7c8,null))[_0xe8d0('0x1e')](function(){return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})['then'](function(_0x58034d){var _0xfbacce=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2790f=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x142db4=ejs[_0xe8d0('0x68')](_0xfbacce,{'trunks':_0x58034d});var _0x4a568f=ejs['render'](_0x2790f,{'trunks':_0x58034d});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x142db4);fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0x4a568f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x32'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x28')](handleError(_0x3fb7c8,null));}; \ No newline at end of file +var _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x4e8657,_0x1a341d){var _0x10feaf=function(_0x1e26b6){while(--_0x1e26b6){_0x4e8657['push'](_0x4e8657['shift']());}};_0x10feaf(++_0x1a341d);}(_0x98a8,0x12c));var _0x898a=function(_0x19d315,_0x813740){_0x19d315=_0x19d315-0x0;var _0x3a34dd=_0x98a8[_0x19d315];return _0x3a34dd;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1caee24..d8ef493 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 _0x633d=['api','bluebird','request-promise','path','rimraf','exports','define','Trunk','tools_trunks'];(function(_0x2af71e,_0x1b1ef4){var _0x243300=function(_0x46b740){while(--_0x46b740){_0x2af71e['push'](_0x2af71e['shift']());}};_0x243300(++_0x1b1ef4);}(_0x633d,0x99));var _0xd633=function(_0x3997be,_0x3e8a1d){_0x3997be=_0x3997be-0x0;var _0x1c4093=_0x633d[_0x3997be];return _0x1c4093;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd633('0x0'));var moment=require('moment');var BPromise=require(_0xd633('0x1'));var rp=require(_0xd633('0x2'));var fs=require('fs');var path=require(_0xd633('0x3'));var rimraf=require(_0xd633('0x4'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0xd633('0x5')]=function(_0x32bcc0,_0x58eeca){return _0x32bcc0[_0xd633('0x6')](_0xd633('0x7'),attributes,{'tableName':_0xd633('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6d2=['define','Trunk','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b5491,_0xe23e49){var _0x233aca=function(_0x5b8269){while(--_0x5b8269){_0x4b5491['push'](_0x4b5491['shift']());}};_0x233aca(++_0xe23e49);}(_0xc6d2,0x7a));var _0x2c6d=function(_0xf85b3f,_0x44cfc0){_0xf85b3f=_0xf85b3f-0x0;var _0xaf6616=_0xc6d2[_0xf85b3f];return _0xaf6616;};'use strict';var _=require(_0x2c6d('0x0'));var util=require('util');var logger=require(_0x2c6d('0x1'))(_0x2c6d('0x2'));var moment=require('moment');var BPromise=require(_0x2c6d('0x3'));var rp=require(_0x2c6d('0x4'));var fs=require('fs');var path=require(_0x2c6d('0x5'));var rimraf=require(_0x2c6d('0x6'));var config=require(_0x2c6d('0x7'));var attributes=require('./trunk.attributes');module['exports']=function(_0xe399a,_0x36c025){return _0xe399a[_0x2c6d('0x8')](_0x2c6d('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 6b077e1..06ce182 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 _0x3fe7=['debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','Trunk,\x20%s,\x20%s','message','result','catch','Trunk','findAll','options','raw','where','limit','include','model','attributes','GetTrunk','stringify','ShowTrunk','find','map','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x14785c,_0x306ce7){var _0x5a4ecf=function(_0x11c83d){while(--_0x11c83d){_0x14785c['push'](_0x14785c['shift']());}};_0x5a4ecf(++_0x306ce7);}(_0x3fe7,0xee));var _0x73fe=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0x3fe7[_0x4c98b9];return _0x3a257a;};'use strict';var _=require(_0x73fe('0x0'));var util=require(_0x73fe('0x1'));var moment=require(_0x73fe('0x2'));var BPromise=require('bluebird');var rs=require(_0x73fe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x73fe('0x5'));var config=require(_0x73fe('0x6'));var jayson=require(_0x73fe('0x7'));var client=jayson[_0x73fe('0x8')][_0x73fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36bb60,_0x3d5c0c,_0x39693b){return new BPromise(function(_0x17194c,_0x5e5a8a){return client[_0x73fe('0xa')](_0x36bb60,_0x39693b)[_0x73fe('0xb')](function(_0x322145){logger[_0x73fe('0xc')]('Trunk,\x20%s,\x20%s',_0x3d5c0c,_0x73fe('0xd'));logger[_0x73fe('0xe')](_0x73fe('0xf'),_0x3d5c0c,'request\x20sent',JSON['stringify'](_0x322145));if(_0x322145[_0x73fe('0x10')]){if(_0x322145[_0x73fe('0x10')][_0x73fe('0x11')]===0x1f4){logger[_0x73fe('0x10')](_0x73fe('0x12'),_0x3d5c0c,_0x322145[_0x73fe('0x10')]['message']);return _0x5e5a8a(_0x322145[_0x73fe('0x10')][_0x73fe('0x13')]);}logger['error'](_0x73fe('0x12'),_0x3d5c0c,_0x322145[_0x73fe('0x10')][_0x73fe('0x13')]);return _0x17194c(_0x322145[_0x73fe('0x10')][_0x73fe('0x13')]);}else{logger[_0x73fe('0xc')]('Trunk,\x20%s,\x20%s',_0x3d5c0c,_0x73fe('0xd'));_0x17194c(_0x322145[_0x73fe('0x14')]['message']);}})[_0x73fe('0x15')](function(_0x3d7f89){logger[_0x73fe('0x10')]('Trunk,\x20%s,\x20%s',_0x3d5c0c,_0x3d7f89);_0x5e5a8a(_0x3d7f89);});});}exports['GetTrunk']=function(_0x339943){var _0x34fb80=this;return new Promise(function(_0x22339c,_0x2a919f){return db[_0x73fe('0x16')][_0x73fe('0x17')]({'raw':_0x339943['options']?_0x339943[_0x73fe('0x18')][_0x73fe('0x19')]===undefined?!![]:![]:!![],'where':_0x339943[_0x73fe('0x18')]?_0x339943[_0x73fe('0x18')][_0x73fe('0x1a')]||null:null,'attributes':_0x339943[_0x73fe('0x18')]?_0x339943[_0x73fe('0x18')]['attributes']||null:null,'limit':_0x339943['options']?_0x339943[_0x73fe('0x18')][_0x73fe('0x1b')]||null:null,'include':_0x339943[_0x73fe('0x18')]?_0x339943[_0x73fe('0x18')][_0x73fe('0x1c')]?_['map'](_0x339943[_0x73fe('0x18')][_0x73fe('0x1c')],function(_0x10e526){return{'model':db[_0x10e526[_0x73fe('0x1d')]],'as':_0x10e526['as'],'attributes':_0x10e526[_0x73fe('0x1e')],'include':_0x10e526[_0x73fe('0x1c')]?_['map'](_0x10e526[_0x73fe('0x1c')],function(_0xf82133){return{'model':db[_0xf82133[_0x73fe('0x1d')]],'as':_0xf82133['as'],'attributes':_0xf82133[_0x73fe('0x1e')],'include':_0xf82133[_0x73fe('0x1c')]?_['map'](_0xf82133[_0x73fe('0x1c')],function(_0xca333){return{'model':db[_0xca333[_0x73fe('0x1d')]],'as':_0xca333['as'],'attributes':_0xca333[_0x73fe('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19d331){logger[_0x73fe('0xc')](_0x73fe('0x1f'),_0x339943);logger[_0x73fe('0xe')]('GetTrunk',_0x339943,JSON[_0x73fe('0x20')](_0x19d331));_0x22339c(_0x19d331);})['catch'](function(_0x350963){logger[_0x73fe('0x10')](_0x73fe('0x1f'),_0x350963[_0x73fe('0x13')],_0x339943);_0x2a919f(_0x34fb80[_0x73fe('0x10')](0x1f4,_0x350963[_0x73fe('0x13')]));});});};exports[_0x73fe('0x21')]=function(_0x20aebf){var _0x3cef58=this;return new Promise(function(_0x1a14e4,_0x8c9039){return db[_0x73fe('0x16')][_0x73fe('0x22')]({'raw':_0x20aebf[_0x73fe('0x18')]?_0x20aebf[_0x73fe('0x18')][_0x73fe('0x19')]===undefined?!![]:![]:!![],'where':_0x20aebf[_0x73fe('0x18')]?_0x20aebf[_0x73fe('0x18')][_0x73fe('0x1a')]||null:null,'attributes':_0x20aebf['options']?_0x20aebf['options'][_0x73fe('0x1e')]||null:null,'include':_0x20aebf['options']?_0x20aebf[_0x73fe('0x18')][_0x73fe('0x1c')]?_[_0x73fe('0x23')](_0x20aebf['options'][_0x73fe('0x1c')],function(_0x9f732e){return{'model':db[_0x9f732e[_0x73fe('0x1d')]],'as':_0x9f732e['as'],'attributes':_0x9f732e['attributes'],'include':_0x9f732e[_0x73fe('0x1c')]?_[_0x73fe('0x23')](_0x9f732e['include'],function(_0x3faceb){return{'model':db[_0x3faceb[_0x73fe('0x1d')]],'as':_0x3faceb['as'],'attributes':_0x3faceb[_0x73fe('0x1e')],'include':_0x3faceb[_0x73fe('0x1c')]?_['map'](_0x3faceb['include'],function(_0x4f1022){return{'model':db[_0x4f1022[_0x73fe('0x1d')]],'as':_0x4f1022['as'],'attributes':_0x4f1022[_0x73fe('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e4499){logger[_0x73fe('0xc')]('ShowTrunk',_0x20aebf);logger[_0x73fe('0xe')](_0x73fe('0x21'),_0x20aebf,JSON[_0x73fe('0x20')](_0x5e4499));_0x1a14e4(_0x5e4499);})['catch'](function(_0x3f1a02){logger[_0x73fe('0x10')](_0x73fe('0x21'),_0x3f1a02[_0x73fe('0x13')],_0x20aebf);_0x8c9039(_0x3cef58['error'](0x1f4,_0x3f1a02['message']));});});}; \ No newline at end of file +var _0xffd4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','map','model','then','debug','message','ShowTrunk','find','lodash','util','moment','bluebird'];(function(_0x3c60bf,_0x38c9e6){var _0x3b14a2=function(_0x224665){while(--_0x224665){_0x3c60bf['push'](_0x3c60bf['shift']());}};_0x3b14a2(++_0x38c9e6);}(_0xffd4,0x172));var _0x4ffd=function(_0x397b36,_0x1c682c){_0x397b36=_0x397b36-0x0;var _0x2e63b6=_0xffd4[_0x397b36];return _0x2e63b6;};'use strict';var _=require(_0x4ffd('0x0'));var util=require(_0x4ffd('0x1'));var moment=require(_0x4ffd('0x2'));var BPromise=require(_0x4ffd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ffd('0x4'));var db=require(_0x4ffd('0x5'))['db'];var utils=require(_0x4ffd('0x6'));var logger=require(_0x4ffd('0x7'))('rpc');var config=require(_0x4ffd('0x8'));var jayson=require(_0x4ffd('0x9'));var client=jayson[_0x4ffd('0xa')][_0x4ffd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1361c3,_0x362acd,_0x1ca928){return new BPromise(function(_0x343843,_0x4e2f22){return client[_0x4ffd('0xc')](_0x1361c3,_0x1ca928)['then'](function(_0x23cfb5){logger[_0x4ffd('0xd')](_0x4ffd('0xe'),_0x362acd,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x362acd,_0x4ffd('0xf'),JSON[_0x4ffd('0x10')](_0x23cfb5));if(_0x23cfb5[_0x4ffd('0x11')]){if(_0x23cfb5['error']['code']===0x1f4){logger['error'](_0x4ffd('0xe'),_0x362acd,_0x23cfb5[_0x4ffd('0x11')]['message']);return _0x4e2f22(_0x23cfb5[_0x4ffd('0x11')]['message']);}logger[_0x4ffd('0x11')](_0x4ffd('0xe'),_0x362acd,_0x23cfb5['error']['message']);return _0x343843(_0x23cfb5[_0x4ffd('0x11')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x362acd,_0x4ffd('0xf'));_0x343843(_0x23cfb5['result']['message']);}})[_0x4ffd('0x12')](function(_0x451ba4){logger[_0x4ffd('0x11')]('Trunk,\x20%s,\x20%s',_0x362acd,_0x451ba4);_0x4e2f22(_0x451ba4);});});}exports[_0x4ffd('0x13')]=function(_0x54133a){var _0xcb3c30=this;return new Promise(function(_0x4e0e98,_0xa1e5a7){return db[_0x4ffd('0x14')]['findAll']({'raw':_0x54133a[_0x4ffd('0x15')]?_0x54133a[_0x4ffd('0x15')][_0x4ffd('0x16')]===undefined?!![]:![]:!![],'where':_0x54133a[_0x4ffd('0x15')]?_0x54133a['options'][_0x4ffd('0x17')]||null:null,'attributes':_0x54133a['options']?_0x54133a[_0x4ffd('0x15')][_0x4ffd('0x18')]||null:null,'limit':_0x54133a[_0x4ffd('0x15')]?_0x54133a[_0x4ffd('0x15')][_0x4ffd('0x19')]||null:null,'include':_0x54133a[_0x4ffd('0x15')]?_0x54133a[_0x4ffd('0x15')][_0x4ffd('0x1a')]?_[_0x4ffd('0x1b')](_0x54133a['options'][_0x4ffd('0x1a')],function(_0x23f8a7){return{'model':db[_0x23f8a7[_0x4ffd('0x1c')]],'as':_0x23f8a7['as'],'attributes':_0x23f8a7[_0x4ffd('0x18')],'include':_0x23f8a7['include']?_[_0x4ffd('0x1b')](_0x23f8a7['include'],function(_0x4921bd){return{'model':db[_0x4921bd[_0x4ffd('0x1c')]],'as':_0x4921bd['as'],'attributes':_0x4921bd[_0x4ffd('0x18')],'include':_0x4921bd[_0x4ffd('0x1a')]?_['map'](_0x4921bd[_0x4ffd('0x1a')],function(_0x2d6d34){return{'model':db[_0x2d6d34['model']],'as':_0x2d6d34['as'],'attributes':_0x2d6d34['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ffd('0x1d')](function(_0x2501e8){logger[_0x4ffd('0xd')](_0x4ffd('0x13'),_0x54133a);logger[_0x4ffd('0x1e')](_0x4ffd('0x13'),_0x54133a,JSON[_0x4ffd('0x10')](_0x2501e8));_0x4e0e98(_0x2501e8);})[_0x4ffd('0x12')](function(_0x5efa08){logger[_0x4ffd('0x11')]('GetTrunk',_0x5efa08[_0x4ffd('0x1f')],_0x54133a);_0xa1e5a7(_0xcb3c30[_0x4ffd('0x11')](0x1f4,_0x5efa08[_0x4ffd('0x1f')]));});});};exports[_0x4ffd('0x20')]=function(_0x4348e5){var _0x47c154=this;return new Promise(function(_0xd3daeb,_0x4a588e){return db['Trunk'][_0x4ffd('0x21')]({'raw':_0x4348e5[_0x4ffd('0x15')]?_0x4348e5[_0x4ffd('0x15')][_0x4ffd('0x16')]===undefined?!![]:![]:!![],'where':_0x4348e5[_0x4ffd('0x15')]?_0x4348e5[_0x4ffd('0x15')][_0x4ffd('0x17')]||null:null,'attributes':_0x4348e5[_0x4ffd('0x15')]?_0x4348e5[_0x4ffd('0x15')][_0x4ffd('0x18')]||null:null,'include':_0x4348e5[_0x4ffd('0x15')]?_0x4348e5[_0x4ffd('0x15')][_0x4ffd('0x1a')]?_[_0x4ffd('0x1b')](_0x4348e5['options'][_0x4ffd('0x1a')],function(_0x24aea2){return{'model':db[_0x24aea2['model']],'as':_0x24aea2['as'],'attributes':_0x24aea2[_0x4ffd('0x18')],'include':_0x24aea2[_0x4ffd('0x1a')]?_[_0x4ffd('0x1b')](_0x24aea2[_0x4ffd('0x1a')],function(_0x5f2261){return{'model':db[_0x5f2261[_0x4ffd('0x1c')]],'as':_0x5f2261['as'],'attributes':_0x5f2261[_0x4ffd('0x18')],'include':_0x5f2261[_0x4ffd('0x1a')]?_[_0x4ffd('0x1b')](_0x5f2261['include'],function(_0x495d2c){return{'model':db[_0x495d2c[_0x4ffd('0x1c')]],'as':_0x495d2c['as'],'attributes':_0x495d2c[_0x4ffd('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb7c537){logger['info']('ShowTrunk',_0x4348e5);logger['debug'](_0x4ffd('0x20'),_0x4348e5,JSON[_0x4ffd('0x10')](_0xb7c537));_0xd3daeb(_0xb7c537);})[_0x4ffd('0x12')](function(_0x358cda){logger[_0x4ffd('0x11')](_0x4ffd('0x20'),_0x358cda[_0x4ffd('0x1f')],_0x4348e5);_0x4a588e(_0x47c154['error'](0x1f4,_0x358cda['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 65b3ffb..9b6118e 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 _0xd8ff=['isAuthenticated','update','exports','express','Router','./user-setting.controller','put','/:id'];(function(_0x5784e9,_0x9e893d){var _0x319a92=function(_0xaaec53){while(--_0xaaec53){_0x5784e9['push'](_0x5784e9['shift']());}};_0x319a92(++_0x9e893d);}(_0xd8ff,0x7b));var _0xfd8f=function(_0x2d239f,_0x167856){_0x2d239f=_0x2d239f-0x0;var _0x1ca993=_0xd8ff[_0x2d239f];return _0x1ca993;};'use strict';var express=require(_0xfd8f('0x0'));var router=express[_0xfd8f('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xfd8f('0x2'));router[_0xfd8f('0x3')](_0xfd8f('0x4'),auth[_0xfd8f('0x5')](),controller[_0xfd8f('0x6')]);module[_0xfd8f('0x7')]=router; \ No newline at end of file +var _0x8d64=['../../components/auth/service','put','isAuthenticated','update','exports','express'];(function(_0x238f61,_0x467ca1){var _0xdeb882=function(_0x325584){while(--_0x325584){_0x238f61['push'](_0x238f61['shift']());}};_0xdeb882(++_0x467ca1);}(_0x8d64,0xb3));var _0x48d6=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x8d64[_0xf50820];return _0x2a9b10;};'use strict';var express=require(_0x48d6('0x0'));var router=express['Router']();var auth=require(_0x48d6('0x1'));var controller=require('./user-setting.controller');router[_0x48d6('0x2')]('/:id',auth[_0x48d6('0x3')](),controller[_0x48d6('0x4')]);module[_0x48d6('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 b8c0b49..4d9314b 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 _0x14ab=['error','warning','info','BOOLEAN','TEXT','INTEGER','sequelize'];(function(_0x52ae63,_0x53d149){var _0x52c628=function(_0x334291){while(--_0x334291){_0x52ae63['push'](_0x52ae63['shift']());}};_0x52c628(++_0x53d149);}(_0x14ab,0x1aa));var _0xb14a=function(_0xecf62a,_0x4e26dc){_0xecf62a=_0xecf62a-0x0;var _0x46be49=_0x14ab[_0xecf62a];return _0x46be49;};'use strict';var Sequelize=require(_0xb14a('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xb14a('0x1'),_0xb14a('0x2'),_0xb14a('0x3'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb14a('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb14a('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb14a('0x6')],'unique':'UserId'}}; \ No newline at end of file +var _0x9fd5=['exports','ENUM','BOOLEAN','TEXT','DATE','error','info'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x9fd5,0xc9));var _0x59fd=function(_0x4b09bc,_0x19cbf0){_0x4b09bc=_0x4b09bc-0x0;var _0x1e32a4=_0x9fd5[_0x4b09bc];return _0x1e32a4;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x59fd('0x0'),'warning',_0x59fd('0x1'),'debug'];module[_0x59fd('0x2')]={'clientSideLoggingLevel':{'type':Sequelize[_0x59fd('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x59fd('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x59fd('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x59fd('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x59fd('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ 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 8829f61..613fbed 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 _0xc874=['stack','name','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','catch','lodash','../../config/logger','api','socket.io-emitter','redis','./user-setting.socket','defaults','localhost','status','update','then','error'];(function(_0x5a7ef1,_0x45d744){var _0x16fbfe=function(_0x20be2f){while(--_0x20be2f){_0x5a7ef1['push'](_0x5a7ef1['shift']());}};_0x16fbfe(++_0x45d744);}(_0xc874,0x154));var _0x4c87=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xc874[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x4c87('0x0'));var Redis=require('ioredis');var logger=require(_0x4c87('0x1'))(_0x4c87('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x4c87('0x3'))(new Redis(config[_0x4c87('0x4')]));require(_0x4c87('0x5'))['register'](socket);config[_0x4c87('0x4')]=_[_0x4c87('0x6')](config['redis'],{'host':_0x4c87('0x7'),'port':0x18eb});function respondWithResult(_0x3dafe0,_0x30c939){_0x30c939=_0x30c939||0xc8;return function(_0xdc4a29){if(_0xdc4a29){return _0x3dafe0[_0x4c87('0x8')](_0x30c939)['json'](_0xdc4a29);}};}function saveUpdates(_0x1e0897){return function(_0x492d32){if(_0x492d32){return _0x492d32[_0x4c87('0x9')](_0x1e0897)[_0x4c87('0xa')](function(_0x30e64f){return _0x30e64f;});}return null;};}function handleEntityNotFound(_0x1a15a2){return function(_0x46c0bc){if(!_0x46c0bc){_0x1a15a2['sendStatus'](0x194);}return _0x46c0bc;};}function handleError(_0x1fcc99,_0x2b82cb){_0x2b82cb=_0x2b82cb||0x1f4;return function(_0x527917){logger[_0x4c87('0xb')](_0x527917[_0x4c87('0xc')]);if(_0x527917[_0x4c87('0xd')]){delete _0x527917[_0x4c87('0xd')];}_0x1fcc99[_0x4c87('0x8')](_0x2b82cb)['send'](_0x527917);};}exports['update']=function(_0x4826cb,_0x7026cc){if(_0x4826cb[_0x4c87('0xe')][_0x4c87('0xf')]!==_0x4c87('0x10'))throw new Error(_0x4c87('0x11'));if(isNaN(Number(_0x4826cb[_0x4c87('0x12')]['id'])))throw new Error(_0x4c87('0x13'));return db[_0x4c87('0x14')]['find']({'where':{'id':_0x4826cb[_0x4c87('0x12')]['id']}})[_0x4c87('0xa')](handleEntityNotFound(_0x7026cc,null))['then'](saveUpdates(_0x4826cb['body'],null))[_0x4c87('0xa')](respondWithResult(_0x7026cc,null))[_0x4c87('0x15')](handleError(_0x7026cc,null));}; \ No newline at end of file +var _0xc5c7=['stack','name','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','then','body','catch','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','status','sendStatus','error'];(function(_0x5a43e4,_0x4975f2){var _0x413e3d=function(_0x4bbb9a){while(--_0x4bbb9a){_0x5a43e4['push'](_0x5a43e4['shift']());}};_0x413e3d(++_0x4975f2);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x41219f,_0x28ba53){_0x41219f=_0x41219f-0x0;var _0x484034=_0xc5c7[_0x41219f];return _0x484034;};'use strict';var _=require('lodash');var Redis=require(_0x7c5c('0x0'));var logger=require(_0x7c5c('0x1'))(_0x7c5c('0x2'));var config=require(_0x7c5c('0x3'));var db=require(_0x7c5c('0x4'))['db'];var socket=require(_0x7c5c('0x5'))(new Redis(config['redis']));require(_0x7c5c('0x6'))[_0x7c5c('0x7')](socket);config[_0x7c5c('0x8')]=_[_0x7c5c('0x9')](config[_0x7c5c('0x8')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x5ec99e,_0xdbfbeb){_0xdbfbeb=_0xdbfbeb||0xc8;return function(_0x5895b5){if(_0x5895b5){return _0x5ec99e[_0x7c5c('0xa')](_0xdbfbeb)['json'](_0x5895b5);}};}function saveUpdates(_0x2b27d0){return function(_0x15f4c1){if(_0x15f4c1){return _0x15f4c1['update'](_0x2b27d0)['then'](function(_0x17597c){return _0x17597c;});}return null;};}function handleEntityNotFound(_0x1cd540){return function(_0x5c7073){if(!_0x5c7073){_0x1cd540[_0x7c5c('0xb')](0x194);}return _0x5c7073;};}function handleError(_0x58ef28,_0x1f5e0b){_0x1f5e0b=_0x1f5e0b||0x1f4;return function(_0x5bb950){logger[_0x7c5c('0xc')](_0x5bb950[_0x7c5c('0xd')]);if(_0x5bb950['name']){delete _0x5bb950[_0x7c5c('0xe')];}_0x58ef28[_0x7c5c('0xa')](_0x1f5e0b)[_0x7c5c('0xf')](_0x5bb950);};}exports[_0x7c5c('0x10')]=function(_0x3d5a9d,_0x113c0b){if(_0x3d5a9d[_0x7c5c('0x11')][_0x7c5c('0x12')]!==_0x7c5c('0x13'))throw new Error(_0x7c5c('0x14'));if(isNaN(Number(_0x3d5a9d[_0x7c5c('0x15')]['id'])))throw new Error(_0x7c5c('0x16'));return db[_0x7c5c('0x17')][_0x7c5c('0x18')]({'where':{'id':_0x3d5a9d['params']['id']}})['then'](handleEntityNotFound(_0x113c0b,null))[_0x7c5c('0x19')](saveUpdates(_0x3d5a9d[_0x7c5c('0x1a')],null))[_0x7c5c('0x19')](respondWithResult(_0x113c0b,null))[_0x7c5c('0x1b')](handleError(_0x113c0b,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 a8c7494..3711aca 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 _0x9d59=['UserSetting','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x90cae9,_0x448507){var _0x3db802=function(_0x1525aa){while(--_0x1525aa){_0x90cae9['push'](_0x90cae9['shift']());}};_0x3db802(++_0x448507);}(_0x9d59,0x18e));var _0x99d5=function(_0x211b69,_0x2ff49f){_0x211b69=_0x211b69-0x0;var _0x4fa9bd=_0x9d59[_0x211b69];return _0x4fa9bd;};'use strict';var EventEmitter=require(_0x99d5('0x0'));var UserSetting=require(_0x99d5('0x1'))['db'][_0x99d5('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x99d5('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ce319){return function(_0x174d31,_0x130d9f,_0x5aca27){UserSettingEvents[_0x99d5('0x4')](_0x4ce319+':'+_0x174d31['id'],_0x174d31);UserSettingEvents[_0x99d5('0x4')](_0x4ce319,_0x174d31);_0x5aca27(null);};}for(var e in events){if(events[_0x99d5('0x5')](e)){var event=events[e];UserSetting[_0x99d5('0x6')](e,emitEvent(event));}}module[_0x99d5('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x9094=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserSetting','setMaxListeners','save'];(function(_0x51412e,_0x43c707){var _0x1e4815=function(_0x4cce2f){while(--_0x4cce2f){_0x51412e['push'](_0x51412e['shift']());}};_0x1e4815(++_0x43c707);}(_0x9094,0x69));var _0x4909=function(_0x5c2d0a,_0x1c8550){_0x5c2d0a=_0x5c2d0a-0x0;var _0x457cb3=_0x9094[_0x5c2d0a];return _0x457cb3;};'use strict';var EventEmitter=require(_0x4909('0x0'));var UserSetting=require(_0x4909('0x1'))['db'][_0x4909('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x4909('0x3')](0x0);var events={'afterCreate':_0x4909('0x4'),'afterUpdate':_0x4909('0x5'),'afterDestroy':_0x4909('0x6')};function emitEvent(_0x479243){return function(_0x2496b5,_0x41a7ae,_0x49d9b7){UserSettingEvents[_0x4909('0x7')](_0x479243+':'+_0x2496b5['id'],_0x2496b5);UserSettingEvents[_0x4909('0x7')](_0x479243,_0x2496b5);_0x49d9b7(null);};}for(var e in events){if(events[_0x4909('0x8')](e)){var event=events[e];UserSetting[_0x4909('0x9')](e,emitEvent(event));}}module['exports']=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 b3e8be7..5bc5472 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 _0x3609=['exports','define','UserSetting','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3609,0x101));var _0x9360=function(_0x38e925,_0x4929fb){_0x38e925=_0x38e925-0x0;var _0x1fea76=_0x3609[_0x38e925];return _0x1fea76;};'use strict';var attributes=require(_0x9360('0x0'));module[_0x9360('0x1')]=function(_0x224249){return _0x224249[_0x9360('0x2')](_0x9360('0x3'),attributes,{'tableName':_0x9360('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x133b7c){if(!_0x133b7c['clientSideLoggingEnabled'])_0x133b7c[_0x9360('0x5')]=null;else if(_0x133b7c[_0x9360('0x5')]===null)_0x133b7c[_0x9360('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x063c=['clientSideLoggingEnabledSince','exports','define','UserSetting','user_settings'];(function(_0xbf5269,_0x23ccb4){var _0x1b79fa=function(_0x286998){while(--_0x286998){_0xbf5269['push'](_0xbf5269['shift']());}};_0x1b79fa(++_0x23ccb4);}(_0x063c,0xba));var _0xc063=function(_0x35edde,_0x49d061){_0x35edde=_0x35edde-0x0;var _0x455f28=_0x063c[_0x35edde];return _0x455f28;};'use strict';var attributes=require('./user-setting.attributes');module[_0xc063('0x0')]=function(_0x3e8b5f){return _0x3e8b5f[_0xc063('0x1')](_0xc063('0x2'),attributes,{'tableName':_0xc063('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33d075){if(!_0x33d075['clientSideLoggingEnabled'])_0x33d075[_0xc063('0x4')]=null;else if(_0x33d075['clientSideLoggingEnabledSince']===null)_0x33d075['clientSideLoggingEnabledSince']=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 051a9c4..ce226f0 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 _0x5ab9=['emit','user-setting:update','user-setting:update:user-','UserId','register','user-setting:','save','remove','update'];(function(_0x44b362,_0x1b5fd9){var _0x38b45c=function(_0x163919){while(--_0x163919){_0x44b362['push'](_0x44b362['shift']());}};_0x38b45c(++_0x1b5fd9);}(_0x5ab9,0xe7));var _0x95ab=function(_0x5cfdd8,_0x27555c){_0x5cfdd8=_0x5cfdd8-0x0;var _0x4fd729=_0x5ab9[_0x5cfdd8];return _0x4fd729;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x95ab('0x0'),_0x95ab('0x1'),_0x95ab('0x2')];function createListener(_0x652913,_0x56ea15){return function(_0x15927b){_0x56ea15[_0x95ab('0x3')](_0x652913,_0x15927b);if(_0x652913===_0x95ab('0x4')){_0x56ea15[_0x95ab('0x3')](_0x95ab('0x5')+_0x15927b[_0x95ab('0x6')],_0x15927b);}};}exports[_0x95ab('0x7')]=function(_0x352f60){for(var _0x5c19f8=0x0,_0x26f2dd=events['length'];_0x5c19f8<_0x26f2dd;_0x5c19f8++){var _0x3bba0a=events[_0x5c19f8];var _0x55b787=createListener(_0x95ab('0x8')+_0x3bba0a,_0x352f60);UserSettingEvents['on'](_0x3bba0a,_0x55b787);}}; \ No newline at end of file +var _0x5c53=['remove','update','emit','user-setting:update:user-','UserId','register','length','./user-setting.events','save'];(function(_0x10e850,_0x4b8408){var _0x3d8629=function(_0x4f9a80){while(--_0x4f9a80){_0x10e850['push'](_0x10e850['shift']());}};_0x3d8629(++_0x4b8408);}(_0x5c53,0xd6));var _0x35c5=function(_0xd692fc,_0xdc3122){_0xd692fc=_0xd692fc-0x0;var _0x40a450=_0x5c53[_0xd692fc];return _0x40a450;};'use strict';var UserSettingEvents=require(_0x35c5('0x0'));var events=[_0x35c5('0x1'),_0x35c5('0x2'),_0x35c5('0x3')];function createListener(_0x1516b9,_0x12931e){return function(_0x19d34b){_0x12931e['emit'](_0x1516b9,_0x19d34b);if(_0x1516b9==='user-setting:update'){_0x12931e[_0x35c5('0x4')](_0x35c5('0x5')+_0x19d34b[_0x35c5('0x6')],_0x19d34b);}};}exports[_0x35c5('0x7')]=function(_0xa25749){for(var _0x12bf1a=0x0,_0x2a81c4=events[_0x35c5('0x8')];_0x12bf1a<_0x2a81c4;_0x12bf1a++){var _0x46fbb6=events[_0x12bf1a];var _0x3c812a=createListener('user-setting:'+_0x46fbb6,_0xa25749);UserSettingEvents['on'](_0x46fbb6,_0x3c812a);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 03f9817..3d2c57a 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 _0x3c36=['addContacts','create','bulkCreate','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','file','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addWhatsappAccounts','createApiKey','put','update','changePassword','delete','removeQueues','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','/:id/mail_accounts','removeMailAccounts','removeSmsAccounts','/:id/chat_websites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','/describe','describe','/whoami','isAuthenticated','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post'];(function(_0x510aa6,_0x5984cc){var _0x5d7c19=function(_0x16b218){while(--_0x16b218){_0x510aa6['push'](_0x510aa6['shift']());}};_0x5d7c19(++_0x5984cc);}(_0x3c36,0x10c));var _0x63c3=function(_0x34b79b,_0x406583){_0x34b79b=_0x34b79b-0x0;var _0x2c2925=_0x3c36[_0x34b79b];return _0x2c2925;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x63c3('0x0'));var timeout=require(_0x63c3('0x1'));var express=require(_0x63c3('0x2'));var router=express['Router']();var fs_extra=require(_0x63c3('0x3'));var auth=require(_0x63c3('0x4'));var interaction=require(_0x63c3('0x5'));var config=require('../../config/environment');var controller=require(_0x63c3('0x6'));router[_0x63c3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x63c3('0x8'),auth['isAuthenticated'](),controller[_0x63c3('0x9')]);router['get'](_0x63c3('0xa'),auth[_0x63c3('0xb')](),controller[_0x63c3('0xc')]);router[_0x63c3('0x7')]('/presence',auth[_0x63c3('0xb')](),controller['getPresence']);router['get'](_0x63c3('0xd'),auth[_0x63c3('0xb')](),controller[_0x63c3('0xe')]);router[_0x63c3('0x7')](_0x63c3('0xf'),controller[_0x63c3('0x10')]);router['get']('/:id/open_tabs',auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x63c3('0x7')](_0x63c3('0x11'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x12')]);router[_0x63c3('0x7')](_0x63c3('0x13'),auth['isAuthenticated'](),controller[_0x63c3('0x14')]);router[_0x63c3('0x7')](_0x63c3('0x15'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x16')]);router[_0x63c3('0x7')](_0x63c3('0x17'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x18')]);router[_0x63c3('0x7')]('/:id/recordings',auth[_0x63c3('0xb')](),controller['getRecordings']);router[_0x63c3('0x7')](_0x63c3('0x19'),auth['isAuthenticated'](),controller[_0x63c3('0x1a')]);router[_0x63c3('0x7')](_0x63c3('0x1b'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x1c')]);router['get'](_0x63c3('0x1d'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x1e')]);router['get'](_0x63c3('0x1f'),auth[_0x63c3('0xb')](),controller['getMailInteractions']);router['get']('/:id/sms/interactions',auth[_0x63c3('0xb')](),controller[_0x63c3('0x20')]);router[_0x63c3('0x7')](_0x63c3('0x21'),auth[_0x63c3('0xb')](),controller['getFaxInteractions']);router[_0x63c3('0x7')](_0x63c3('0x22'),auth['isAuthenticated'](),controller[_0x63c3('0x23')]);router[_0x63c3('0x7')](_0x63c3('0x24'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x25')]);router[_0x63c3('0x7')](_0x63c3('0x26'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x27')]);router[_0x63c3('0x7')]('/:id/agents',auth[_0x63c3('0xb')](),controller[_0x63c3('0x28')]);router[_0x63c3('0x7')](_0x63c3('0x29'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x2a')]);router[_0x63c3('0x7')](_0x63c3('0x2b'),auth['isAuthenticated'](),controller[_0x63c3('0x2c')]);router[_0x63c3('0x7')]('/:id/mail_accounts',auth[_0x63c3('0xb')](),controller[_0x63c3('0x2d')]);router[_0x63c3('0x7')](_0x63c3('0x2e'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x2f')]);router[_0x63c3('0x7')](_0x63c3('0x30'),auth[_0x63c3('0xb')](),controller['getSmsAccounts']);router[_0x63c3('0x7')]('/:id/chat_websites',auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x63c3('0x7')](_0x63c3('0x31'),auth['isAuthenticated'](),controller[_0x63c3('0x32')]);router[_0x63c3('0x7')](_0x63c3('0x33'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x34')]);router[_0x63c3('0x7')](_0x63c3('0x35'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x36')]);router[_0x63c3('0x37')](_0x63c3('0x11'),auth['isAuthenticated'](),controller[_0x63c3('0x38')]);router[_0x63c3('0x37')]('/',auth[_0x63c3('0xb')](),controller[_0x63c3('0x39')]);router[_0x63c3('0x37')]('/create_many',auth[_0x63c3('0xb')](),controller[_0x63c3('0x3a')]);router['post'](_0x63c3('0x13'),auth[_0x63c3('0xb')](),controller['addQueues']);var upload=multer({'storage':multer[_0x63c3('0x3b')]({'destination':function(_0x149d0e,_0x54f070,_0x312d64){_0x312d64(null,path[_0x63c3('0x3c')](config['root'],_0x63c3('0x3d')));},'filename':function(_0x53d084,_0x2f7912,_0x34ba89){_0x34ba89(null,util[_0x63c3('0x3e')](_0x63c3('0x3f'),Date[_0x63c3('0x40')](),_0x2f7912[_0x63c3('0x41')]));}})});router[_0x63c3('0x37')](_0x63c3('0xf'),upload['single'](_0x63c3('0x42')),controller['addAvatar']);router[_0x63c3('0x37')](_0x63c3('0x43'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x44')]);router[_0x63c3('0x37')]('/:id/logout',auth['isAuthenticated'](),controller[_0x63c3('0x45')]);router[_0x63c3('0x37')](_0x63c3('0x46'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x47')]);router['post'](_0x63c3('0x48'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x49')]);router[_0x63c3('0x37')](_0x63c3('0x24'),auth[_0x63c3('0xb')](),controller['addTeams']);router['post'](_0x63c3('0x4a'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x4b')]);router[_0x63c3('0x37')](_0x63c3('0x4c'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x4d')]);router['post'](_0x63c3('0x4e'),auth[_0x63c3('0xb')](),controller['addFaxInteractions']);router[_0x63c3('0x37')](_0x63c3('0x4f'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x50')]);router['post'](_0x63c3('0x51'),auth[_0x63c3('0xb')](),controller['addOpenchannelInteractions']);router[_0x63c3('0x37')](_0x63c3('0x52'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x53')]);router[_0x63c3('0x37')](_0x63c3('0x2b'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x54')]);router[_0x63c3('0x37')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x63c3('0x55')]);router[_0x63c3('0x37')](_0x63c3('0x2e'),auth[_0x63c3('0xb')](),controller['addOpenchannelAccounts']);router[_0x63c3('0x37')](_0x63c3('0x30'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x56')]);router[_0x63c3('0x37')]('/:id/chat_websites',auth['isAuthenticated'](),controller['addChatWebsites']);router[_0x63c3('0x37')](_0x63c3('0x31'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x57')]);router[_0x63c3('0x37')](_0x63c3('0x35'),auth['isAuthenticated'](),controller[_0x63c3('0x58')]);router[_0x63c3('0x59')](_0x63c3('0xd'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x5a')]);router[_0x63c3('0x59')]('/:id/password',auth['isAuthenticated'](),controller[_0x63c3('0x5b')]);router[_0x63c3('0x5c')]('/:id/queues',auth['isAuthenticated'](),controller[_0x63c3('0x5d')]);router['delete'](_0x63c3('0x24'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x5e')]);router[_0x63c3('0x5c')](_0x63c3('0xd'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x5f')]);router[_0x63c3('0x5c')](_0x63c3('0x4a'),auth[_0x63c3('0xb')](),controller['removeChatInteractions']);router[_0x63c3('0x5c')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x63c3('0x60')]);router['delete'](_0x63c3('0x4e'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x61')]);router[_0x63c3('0x5c')](_0x63c3('0x4f'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x62')]);router[_0x63c3('0x5c')](_0x63c3('0x51'),auth[_0x63c3('0xb')](),controller['removeOpenchannelInteractions']);router[_0x63c3('0x5c')](_0x63c3('0x52'),auth['isAuthenticated'](),controller[_0x63c3('0x63')]);router[_0x63c3('0x5c')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x63c3('0x5c')](_0x63c3('0x64'),auth['isAuthenticated'](),controller[_0x63c3('0x65')]);router[_0x63c3('0x5c')](_0x63c3('0x2e'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x63c3('0x5c')](_0x63c3('0x30'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x66')]);router[_0x63c3('0x5c')](_0x63c3('0x67'),auth[_0x63c3('0xb')](),controller['removeChatWebsites']);router[_0x63c3('0x5c')](_0x63c3('0x31'),auth[_0x63c3('0xb')](),controller['removeWhatsappAccounts']);router[_0x63c3('0x5c')](_0x63c3('0x35'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x68')]);router[_0x63c3('0x37')](_0x63c3('0x69'),auth[_0x63c3('0xb')](),controller[_0x63c3('0x6a')]);module[_0x63c3('0x6b')]=router; \ No newline at end of file +var _0x407c=['/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getScheduledCalls','post','addContacts','create','bulkCreate','/:id/queues','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','put','/:id','update','delete','removeQueues','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/fax_accounts','removeFaxAccounts','/:id/mail_accounts','removeMailAccounts','removeOpenchannelAccounts','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','get','/describe','describe','/whoami','whoami','/presence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings'];(function(_0x1a9e7e,_0x35a0ef){var _0x40c0e7=function(_0x55db39){while(--_0x55db39){_0x1a9e7e['push'](_0x1a9e7e['shift']());}};_0x40c0e7(++_0x35a0ef);}(_0x407c,0xce));var _0xc407=function(_0x23d5c9,_0x51be1b){_0x23d5c9=_0x23d5c9-0x0;var _0x1b23a1=_0x407c[_0x23d5c9];return _0x1b23a1;};'use strict';var multer=require(_0xc407('0x0'));var util=require(_0xc407('0x1'));var path=require(_0xc407('0x2'));var timeout=require(_0xc407('0x3'));var express=require(_0xc407('0x4'));var router=express[_0xc407('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc407('0x6'));var interaction=require(_0xc407('0x7'));var config=require(_0xc407('0x8'));var controller=require(_0xc407('0x9'));router['get']('/',auth[_0xc407('0xa')](),controller['index']);router[_0xc407('0xb')](_0xc407('0xc'),auth[_0xc407('0xa')](),controller[_0xc407('0xd')]);router[_0xc407('0xb')](_0xc407('0xe'),auth[_0xc407('0xa')](),controller[_0xc407('0xf')]);router[_0xc407('0xb')](_0xc407('0x10'),auth[_0xc407('0xa')](),controller['getPresence']);router[_0xc407('0xb')]('/:id',auth[_0xc407('0xa')](),controller[_0xc407('0x11')]);router['get'](_0xc407('0x12'),controller[_0xc407('0x13')]);router[_0xc407('0xb')](_0xc407('0x14'),auth[_0xc407('0xa')](),controller[_0xc407('0x15')]);router[_0xc407('0xb')](_0xc407('0x16'),auth[_0xc407('0xa')](),controller[_0xc407('0x17')]);router['get']('/:id/queues',auth[_0xc407('0xa')](),controller['getQueues']);router[_0xc407('0xb')](_0xc407('0x18'),auth[_0xc407('0xa')](),controller['getVoiceQueuesRt']);router['get'](_0xc407('0x19'),auth[_0xc407('0xa')](),controller[_0xc407('0x1a')]);router[_0xc407('0xb')](_0xc407('0x1b'),auth['isAuthenticated'](),controller[_0xc407('0x1c')]);router[_0xc407('0xb')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xc407('0x1d')]);router['get'](_0xc407('0x1e'),auth[_0xc407('0xa')](),controller[_0xc407('0x1f')]);router['get'](_0xc407('0x20'),auth[_0xc407('0xa')](),controller[_0xc407('0x21')]);router[_0xc407('0xb')](_0xc407('0x22'),auth[_0xc407('0xa')](),controller[_0xc407('0x23')]);router[_0xc407('0xb')](_0xc407('0x24'),auth[_0xc407('0xa')](),controller[_0xc407('0x25')]);router[_0xc407('0xb')](_0xc407('0x26'),auth['isAuthenticated'](),controller[_0xc407('0x27')]);router[_0xc407('0xb')](_0xc407('0x28'),auth['isAuthenticated'](),controller[_0xc407('0x29')]);router[_0xc407('0xb')](_0xc407('0x2a'),auth[_0xc407('0xa')](),controller[_0xc407('0x2b')]);router[_0xc407('0xb')](_0xc407('0x2c'),auth['isAuthenticated'](),controller['getLists']);router[_0xc407('0xb')](_0xc407('0x2d'),auth[_0xc407('0xa')](),controller['getAgents']);router['get'](_0xc407('0x2e'),auth[_0xc407('0xa')](),controller[_0xc407('0x2f')]);router[_0xc407('0xb')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xc407('0x30')]);router['get']('/:id/mail_accounts',auth[_0xc407('0xa')](),controller['getMailAccounts']);router['get'](_0xc407('0x31'),auth[_0xc407('0xa')](),controller[_0xc407('0x32')]);router[_0xc407('0xb')](_0xc407('0x33'),auth['isAuthenticated'](),controller[_0xc407('0x34')]);router[_0xc407('0xb')](_0xc407('0x35'),auth[_0xc407('0xa')](),controller[_0xc407('0x36')]);router[_0xc407('0xb')](_0xc407('0x37'),auth[_0xc407('0xa')](),controller['getWhatsappAccounts']);router[_0xc407('0xb')]('/:id/scheduled_calls',auth[_0xc407('0xa')](),controller[_0xc407('0x38')]);router[_0xc407('0xb')]('/:id/api_key',auth['isAuthenticated'](),controller['getApiKey']);router[_0xc407('0x39')](_0xc407('0x16'),auth[_0xc407('0xa')](),controller[_0xc407('0x3a')]);router[_0xc407('0x39')]('/',auth[_0xc407('0xa')](),controller[_0xc407('0x3b')]);router[_0xc407('0x39')]('/create_many',auth[_0xc407('0xa')](),controller[_0xc407('0x3c')]);router[_0xc407('0x39')](_0xc407('0x3d'),auth['isAuthenticated'](),controller[_0xc407('0x3e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29e96d,_0xf027c9,_0x564cd9){_0x564cd9(null,path[_0xc407('0x3f')](config[_0xc407('0x40')],_0xc407('0x41')));},'filename':function(_0x2deab6,_0x2c562c,_0x290827){_0x290827(null,util[_0xc407('0x42')](_0xc407('0x43'),Date[_0xc407('0x44')](),_0x2c562c[_0xc407('0x45')]));}})});router[_0xc407('0x39')]('/:id/avatar',upload[_0xc407('0x46')](_0xc407('0x47')),controller[_0xc407('0x48')]);router[_0xc407('0x39')](_0xc407('0x49'),auth[_0xc407('0xa')](),controller['login']);router[_0xc407('0x39')](_0xc407('0x4a'),auth[_0xc407('0xa')](),controller[_0xc407('0x4b')]);router[_0xc407('0x39')](_0xc407('0x4c'),auth['isAuthenticated'](),controller[_0xc407('0x4d')]);router[_0xc407('0x39')]('/:id/unpause',auth[_0xc407('0xa')](),controller[_0xc407('0x4e')]);router['post']('/:id/teams',auth[_0xc407('0xa')](),controller['addTeams']);router[_0xc407('0x39')](_0xc407('0x4f'),auth[_0xc407('0xa')](),controller[_0xc407('0x50')]);router[_0xc407('0x39')](_0xc407('0x51'),auth[_0xc407('0xa')](),controller[_0xc407('0x52')]);router[_0xc407('0x39')](_0xc407('0x53'),auth['isAuthenticated'](),controller[_0xc407('0x54')]);router['post'](_0xc407('0x55'),auth[_0xc407('0xa')](),controller[_0xc407('0x56')]);router[_0xc407('0x39')](_0xc407('0x57'),auth[_0xc407('0xa')](),controller[_0xc407('0x58')]);router[_0xc407('0x39')](_0xc407('0x59'),auth['isAuthenticated'](),controller[_0xc407('0x5a')]);router[_0xc407('0x39')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xc407('0x5b')]);router['post']('/:id/mail_accounts',auth[_0xc407('0xa')](),controller[_0xc407('0x5c')]);router[_0xc407('0x39')]('/:id/openchannel_accounts',auth[_0xc407('0xa')](),controller[_0xc407('0x5d')]);router[_0xc407('0x39')](_0xc407('0x33'),auth['isAuthenticated'](),controller[_0xc407('0x5e')]);router[_0xc407('0x39')](_0xc407('0x35'),auth['isAuthenticated'](),controller[_0xc407('0x5f')]);router[_0xc407('0x39')](_0xc407('0x37'),auth[_0xc407('0xa')](),controller[_0xc407('0x60')]);router['post'](_0xc407('0x61'),auth['isAuthenticated'](),controller['createApiKey']);router[_0xc407('0x62')](_0xc407('0x63'),auth['isAuthenticated'](),controller[_0xc407('0x64')]);router[_0xc407('0x62')]('/:id/password',auth[_0xc407('0xa')](),controller['changePassword']);router[_0xc407('0x65')](_0xc407('0x3d'),auth[_0xc407('0xa')](),controller[_0xc407('0x66')]);router[_0xc407('0x65')]('/:id/teams',auth[_0xc407('0xa')](),controller[_0xc407('0x67')]);router[_0xc407('0x65')](_0xc407('0x63'),auth[_0xc407('0xa')](),controller[_0xc407('0x68')]);router[_0xc407('0x65')](_0xc407('0x4f'),auth[_0xc407('0xa')](),controller['removeChatInteractions']);router[_0xc407('0x65')]('/:id/mail_interactions',auth[_0xc407('0xa')](),controller[_0xc407('0x69')]);router['delete'](_0xc407('0x53'),auth['isAuthenticated'](),controller[_0xc407('0x6a')]);router[_0xc407('0x65')]('/:id/sms_interactions',auth[_0xc407('0xa')](),controller[_0xc407('0x6b')]);router['delete'](_0xc407('0x57'),auth['isAuthenticated'](),controller[_0xc407('0x6c')]);router[_0xc407('0x65')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xc407('0x65')](_0xc407('0x6d'),auth[_0xc407('0xa')](),controller[_0xc407('0x6e')]);router[_0xc407('0x65')](_0xc407('0x6f'),auth[_0xc407('0xa')](),controller[_0xc407('0x70')]);router['delete'](_0xc407('0x31'),auth[_0xc407('0xa')](),controller[_0xc407('0x71')]);router['delete'](_0xc407('0x33'),auth[_0xc407('0xa')](),controller['removeSmsAccounts']);router[_0xc407('0x65')]('/:id/chat_websites',auth[_0xc407('0xa')](),controller['removeChatWebsites']);router[_0xc407('0x65')](_0xc407('0x37'),auth[_0xc407('0xa')](),controller[_0xc407('0x72')]);router[_0xc407('0x65')](_0xc407('0x61'),auth[_0xc407('0xa')](),controller[_0xc407('0x73')]);router[_0xc407('0x39')]('/:id/messengerSoundNotification',auth[_0xc407('0xa')](),controller[_0xc407('0x74')]);module[_0xc407('0x75')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 13ef12d..b9ddd5f 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 _0xd1f1=['uas','fingerprint','certificate','active','update,nonat','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','UNSIGNED','moment','util','exports','setDataValue','name','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','friend','user','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','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','accept','refuse','originate','uac'];(function(_0x34b831,_0x44b82f){var _0x25dedb=function(_0x559f5e){while(--_0x559f5e){_0x34b831['push'](_0x34b831['shift']());}};_0x25dedb(++_0x44b82f);}(_0xd1f1,0x72));var _0x1d1f=function(_0x4030d4,_0x336ab2){_0x4030d4=_0x4030d4-0x0;var _0x342e02=_0xd1f1[_0x4030d4];return _0x342e02;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1d1f('0x0'));var util=require(_0x1d1f('0x1'));var _=require('lodash');module[_0x1d1f('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x17d1ca){this[_0x1d1f('0x3')](_0x1d1f('0x4'),_0x17d1ca);this[_0x1d1f('0x3')]('defaultuser',_0x17d1ca);},'comment':_0x1d1f('0x5')},'fullname':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':![],'set':function(_0x3d97b0){this[_0x1d1f('0x3')](_0x1d1f('0x7'),_0x3d97b0);this[_0x1d1f('0x3')](_0x1d1f('0x8'),util[_0x1d1f('0x9')](_0x1d1f('0xa'),_0x3d97b0,this[_0x1d1f('0xb')](_0x1d1f('0xc'))));}},'alias':{'type':Sequelize[_0x1d1f('0x6')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1d1f('0xd'),'validate':{'isEmail':!![]},'set':function(_0x18b996){if(_0x18b996){this[_0x1d1f('0x3')](_0x1d1f('0xd'),_0x18b996[_0x1d1f('0xe')]());}}},'role':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x10'),'user',_0x1d1f('0x11'),_0x1d1f('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1d1f('0x6')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x1d1f('0xc'),'set':function(_0x509313){this[_0x1d1f('0x3')](_0x1d1f('0xc'),_0x509313);this[_0x1d1f('0x3')](_0x1d1f('0x13'),_0x509313);this[_0x1d1f('0x3')](_0x1d1f('0x8'),util[_0x1d1f('0x9')](_0x1d1f('0xa'),this[_0x1d1f('0xb')](_0x1d1f('0x7')),_0x509313));}},'salt':{'type':Sequelize[_0x1d1f('0x6')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x1d1f('0x6')]},'address':{'type':Sequelize[_0x1d1f('0x6')]},'zipcode':{'type':Sequelize[_0x1d1f('0x6')]},'userpic':{'type':Sequelize[_0x1d1f('0x6')]},'city':{'type':Sequelize[_0x1d1f('0x6')]},'country':{'type':Sequelize[_0x1d1f('0x6')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1d1f('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x1d1f('0x16')},'lastPauseAt':{'type':Sequelize[_0x1d1f('0x14')]},'chatCapacity':{'type':Sequelize[_0x1d1f('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1d1f('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1d1f('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1d1f('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1d1f('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1d1f('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1d1f('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1d1f('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1d1f('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x1d1f('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1d1f('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1d1f('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x18'),_0x1d1f('0x19'),'peer'),'allowNull':!![],'defaultValue':_0x1d1f('0x18')},'context':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x1d1f('0xf')]('ALLOWED_NOT_SCREENED',_0x1d1f('0x1a'),_0x1d1f('0x1b'),_0x1d1f('0x1c'),_0x1d1f('0x1d'),_0x1d1f('0x1e'),_0x1d1f('0x1f'),_0x1d1f('0x20')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![],'defaultValue':_0x1d1f('0x21'),'set':function(_0x14d424){this[_0x1d1f('0x3')](_0x1d1f('0x22'),_0x14d424?_0x14d424[_0x1d1f('0x23')](','):null);},'get':function(){return this[_0x1d1f('0xb')](_0x1d1f('0x22'))?this['getDataValue'](_0x1d1f('0x22'))[_0x1d1f('0x24')](','):null;},'comment':_0x1d1f('0x25')},'dtmfmode':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x26'),_0x1d1f('0x27'),_0x1d1f('0x28'),_0x1d1f('0x29'),_0x1d1f('0x2a')),'allowNull':!![],'defaultValue':_0x1d1f('0x26')},'directmedia':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no',_0x1d1f('0x2c'),_0x1d1f('0x2d'),_0x1d1f('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x1d1f('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1d1f('0x2f'),'set':function(_0x5364d1){this[_0x1d1f('0x3')](_0x1d1f('0x30'),_0x5364d1?_0x5364d1[_0x1d1f('0x23')](','):null);},'get':function(){return this[_0x1d1f('0xb')](_0x1d1f('0x30'))?this[_0x1d1f('0xb')]('nat')[_0x1d1f('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x1d1f('0x6')]},'namedcallgroup':{'type':Sequelize[_0x1d1f('0x6')]},'pickupgroup':{'type':Sequelize[_0x1d1f('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x1d1f('0x6')]},'language':{'type':Sequelize[_0x1d1f('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1d1f('0x6')]},'disallow':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':![],'defaultValue':_0x1d1f('0x31'),'set':function(_0x3512f0){this[_0x1d1f('0x3')](_0x1d1f('0x32'),_0x3512f0?_0x3512f0[_0x1d1f('0x23')](';'):_0x1d1f('0x31'));},'get':function(){return this['getDataValue'](_0x1d1f('0x32'))?this[_0x1d1f('0xb')](_0x1d1f('0x32'))['split'](';'):null;},'comment':_0x1d1f('0x33')},'autoframing':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![],'set':function(_0x21a02c){this[_0x1d1f('0x3')](_0x1d1f('0x34'),_0x21a02c?_0x21a02c['join'](','):null);},'get':function(){return this[_0x1d1f('0xb')](_0x1d1f('0x34'))?this['getDataValue'](_0x1d1f('0x34'))[_0x1d1f('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no',_0x1d1f('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1d1f('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1d1f('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![],'defaultValue':_0x1d1f('0x36')},'amaflags':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x1d1f('0x2b')},'busylevel':{'type':Sequelize[_0x1d1f('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1d1f('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no',_0x1d1f('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1d1f('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x1d1f('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x38'),_0x1d1f('0x39'),_0x1d1f('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1d1f('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x3b'),_0x1d1f('0x3c')),'allowNull':!![],'defaultValue':_0x1d1f('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1d1f('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1d1f('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x1d1f('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1d1f('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1d1f('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1d1f('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x1d1f('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no',_0x1d1f('0x3d'),_0x1d1f('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x1d1f('0x3f'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1d1f('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x1d1f('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x1d1f('0x2b'),'no',_0x1d1f('0x2c'),_0x1d1f('0x2d'),_0x1d1f('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1d1f('0x6')]},'resetPasswordExpires':{'type':Sequelize[_0x1d1f('0x14')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0xde930b){this[_0x1d1f('0x3')](_0x1d1f('0x41'),_0xde930b);var _0x226f7c=this['get']({'plain':!![]});switch(_0xde930b){case 0x0:case 0x1:var _0x5c27b2=_0x226f7c[_0x1d1f('0x22')]?_['isArray'](_0x226f7c[_0x1d1f('0x22')])?_0x226f7c['transport']['join']():_0x226f7c[_0x1d1f('0x22')]:_0x1d1f('0x21');if(_0x5c27b2===_0x1d1f('0x42')){_0x5c27b2=_0x1d1f('0x21');}this[_0x1d1f('0x3')](_0x1d1f('0x22'),_0x5c27b2);this['setDataValue'](_0x1d1f('0x43'),'no');this[_0x1d1f('0x3')]('avpf',null);this[_0x1d1f('0x3')](_0x1d1f('0x44'),null);this[_0x1d1f('0x3')](_0x1d1f('0x45'),null);this[_0x1d1f('0x3')](_0x1d1f('0x46'),null);this[_0x1d1f('0x3')](_0x1d1f('0x47'),null);this[_0x1d1f('0x3')](_0x1d1f('0x48'),null);this[_0x1d1f('0x3')](_0x1d1f('0x49'),null);this[_0x1d1f('0x3')]('dtlsprivatekey',null);this[_0x1d1f('0x3')](_0x1d1f('0x4a'),'no');break;case 0x2:this[_0x1d1f('0x3')]('transport',_0x1d1f('0x42'));this[_0x1d1f('0x3')](_0x1d1f('0x43'),_0x1d1f('0x2b'));this[_0x1d1f('0x3')]('avpf',_0x1d1f('0x2b'));this[_0x1d1f('0x3')](_0x1d1f('0x44'),_0x1d1f('0x2b'));this[_0x1d1f('0x3')](_0x1d1f('0x45'),_0x1d1f('0x2b'));this['setDataValue'](_0x1d1f('0x46'),_0x1d1f('0x2b'));this[_0x1d1f('0x3')]('dtlsverify','no');this[_0x1d1f('0x3')]('dtlssetup','actpass');this[_0x1d1f('0x3')](_0x1d1f('0x49'),_0x226f7c['dtlscertfile']||_0x1d1f('0x4b'));this[_0x1d1f('0x3')](_0x1d1f('0x4c'),_0x226f7c['dtlsprivatekey']||_0x1d1f('0x4d'));this[_0x1d1f('0x3')](_0x1d1f('0x4a'),_0x1d1f('0x2b'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x149a73){this['setDataValue'](_0x1d1f('0x4e'),_0x149a73?_0x149a73[_0x1d1f('0x23')](','):[]);},'get':function(){return this[_0x1d1f('0xb')]('permissions')?_[_0x1d1f('0x4f')](this[_0x1d1f('0xb')](_0x1d1f('0x4e'))[_0x1d1f('0x24')](','),function(_0x4b1284){return parseInt(_0x4b1284,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1d1f('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1d1f('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1d1f('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1d1f('0xf')](_0x1d1f('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1d1f('0x6')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x1d1f('0xb')](_0x1d1f('0x50'))?this[_0x1d1f('0xb')](_0x1d1f('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x1d1f('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1d1f('0x6')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![],'set':function(_0x546773){if(typeof _0x546773===_0x1d1f('0x51')){var _0x35c367=_0x546773==='1'?!![]:_0x546773==='0'?![]:_0x546773==='true'?!![]:_0x546773===_0x1d1f('0x52')?![]:![];this['setDataValue'](_0x1d1f('0x53'),_0x35c367);}else{this[_0x1d1f('0x3')](_0x1d1f('0x53'),_0x546773);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5e1a93){this['setDataValue'](_0x1d1f('0x54'),_0x5e1a93);if(_0x5e1a93===!![]){this['setDataValue'](_0x1d1f('0x55'),moment());this[_0x1d1f('0x3')]('loginAttempts',0x0);}else{this[_0x1d1f('0x3')](_0x1d1f('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x1d1f('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1d1f('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1d1f('0x17')](0x5)[_0x1d1f('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x1d1f('0x17')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1d1f('0x17')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x1d1f('0x17')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x1d1f('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x43d8=['transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','yes','nonat','update','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uas','certificate','active','passive','update,nonat','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp','dtlsenable','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','permissions','map','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','name','setDataValue','STRING','fullname','format','getDataValue','internal','email','toLowerCase','ENUM','agent','telephone','INTEGER','accountcode','callerid','\x22%s\x22\x20<%s>','BOOLEAN','DEFAULT\x20PAUSE','DATE','user','peer','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_FAILED_SCREEN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x43d8,0x1e6));var _0x843d=function(_0x543412,_0x4d2bea){_0x543412=_0x543412-0x0;var _0x4cab53=_0x43d8[_0x543412];return _0x4cab53;};'use strict';var Sequelize=require(_0x843d('0x0'));var moment=require(_0x843d('0x1'));var util=require(_0x843d('0x2'));var _=require('lodash');module[_0x843d('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x843d('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1f9d2a){this['setDataValue'](_0x843d('0x4'),_0x1f9d2a);this[_0x843d('0x5')]('defaultuser',_0x1f9d2a);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x843d('0x6')],'allowNull':![],'set':function(_0x247f74){this[_0x843d('0x5')](_0x843d('0x7'),_0x247f74);this[_0x843d('0x5')]('callerid',util[_0x843d('0x8')]('\x22%s\x22\x20<%s>',_0x247f74,this[_0x843d('0x9')](_0x843d('0xa'))));}},'alias':{'type':Sequelize[_0x843d('0x6')]},'email':{'type':Sequelize[_0x843d('0x6')],'allowNull':![],'unique':_0x843d('0xb'),'validate':{'isEmail':!![]},'set':function(_0x44d67d){if(_0x44d67d){this[_0x843d('0x5')]('email',_0x44d67d[_0x843d('0xc')]());}}},'role':{'type':Sequelize[_0x843d('0xd')]('admin','user',_0x843d('0xe'),_0x843d('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x843d('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x843d('0x6')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':![],'unique':_0x843d('0xa'),'set':function(_0x5e736e){this['setDataValue'](_0x843d('0xa'),_0x5e736e);this['setDataValue'](_0x843d('0x11'),_0x5e736e);this[_0x843d('0x5')](_0x843d('0x12'),util['format'](_0x843d('0x13'),this[_0x843d('0x9')](_0x843d('0x7')),_0x5e736e));}},'salt':{'type':Sequelize[_0x843d('0x6')]},'phone':{'type':Sequelize[_0x843d('0x6')]},'mobile':{'type':Sequelize[_0x843d('0x6')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x843d('0x6')]},'userpic':{'type':Sequelize[_0x843d('0x6')]},'city':{'type':Sequelize[_0x843d('0x6')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x843d('0x15')},'lastPauseAt':{'type':Sequelize[_0x843d('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x843d('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x843d('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x843d('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x843d('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x843d('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x843d('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x843d('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x843d('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'port':{'type':Sequelize[_0x843d('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x843d('0xd')]('friend',_0x843d('0x17'),_0x843d('0x18')),'allowNull':!![],'defaultValue':_0x843d('0x19')},'context':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![],'defaultValue':_0x843d('0x1a')},'callingpres':{'type':Sequelize[_0x843d('0xd')]('ALLOWED_NOT_SCREENED',_0x843d('0x1b'),_0x843d('0x1c'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x843d('0x1d'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x2a360a){this['setDataValue'](_0x843d('0x1e'),_0x2a360a?_0x2a360a[_0x843d('0x1f')](','):null);},'get':function(){return this[_0x843d('0x9')](_0x843d('0x1e'))?this[_0x843d('0x9')](_0x843d('0x1e'))[_0x843d('0x20')](','):null;},'comment':_0x843d('0x21')},'dtmfmode':{'type':Sequelize[_0x843d('0xd')]('rfc2833',_0x843d('0x22'),_0x843d('0x23'),'inband',_0x843d('0x24')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no',_0x843d('0x26'),_0x843d('0x27'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x385009){this[_0x843d('0x5')](_0x843d('0x28'),_0x385009?_0x385009['join'](','):null);},'get':function(){return this['getDataValue'](_0x843d('0x28'))?this['getDataValue'](_0x843d('0x28'))['split'](','):null;},'comment':_0x843d('0x29')},'callgroup':{'type':Sequelize[_0x843d('0x6')]},'namedcallgroup':{'type':Sequelize[_0x843d('0x6')]},'pickupgroup':{'type':Sequelize[_0x843d('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x843d('0x6')]},'language':{'type':Sequelize[_0x843d('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x843d('0x6')]},'disallow':{'type':Sequelize[_0x843d('0x6')],'allowNull':![],'defaultValue':_0x843d('0x2a')},'allow':{'type':Sequelize[_0x843d('0x6')],'allowNull':![],'defaultValue':_0x843d('0x2b'),'set':function(_0x2329df){this[_0x843d('0x5')](_0x843d('0x2c'),_0x2329df?_0x2329df[_0x843d('0x1f')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x843d('0x9')](_0x843d('0x2c'))?this[_0x843d('0x9')](_0x843d('0x2c'))['split'](';'):null;},'comment':_0x843d('0x2d')},'autoframing':{'type':Sequelize[_0x843d('0xd')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![],'set':function(_0x2f7551){this['setDataValue'](_0x843d('0x2e'),_0x2f7551?_0x2f7551[_0x843d('0x1f')](','):null);},'get':function(){return this['getDataValue'](_0x843d('0x2e'))?this[_0x843d('0x9')](_0x843d('0x2e'))[_0x843d('0x20')](','):null;},'comment':_0x843d('0x2f')},'trustrpid':{'type':Sequelize[_0x843d('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no',_0x843d('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x843d('0x25'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![],'defaultValue':_0x843d('0x31')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x843d('0x25'),'no'),'allowNull':!![],'defaultValue':_0x843d('0x25')},'busylevel':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x843d('0x25'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x843d('0x25'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x843d('0x25'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x843d('0x25'),'no',_0x843d('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x33'),_0x843d('0x34'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x843d('0xd')]('uac',_0x843d('0x35')),'allowNull':!![],'defaultValue':_0x843d('0x35')},'t38pt_usertpsource':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x843d('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x843d('0xd')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no','fingerprint',_0x843d('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x843d('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x37'),_0x843d('0x38'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x843d('0xd')](_0x843d('0x25'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x843d('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x843d('0x25'),'no','nonat','update',_0x843d('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x843d('0x16')]},'passwordResetAt':{'type':Sequelize[_0x843d('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x843d('0x3a')]},'showWebBar':{'type':Sequelize[_0x843d('0x10')],'defaultValue':0x0,'set':function(_0x443d6a){this['setDataValue'](_0x843d('0x3b'),_0x443d6a);var _0x37b4dd=this[_0x843d('0x3c')]({'plain':!![]});switch(_0x443d6a){case 0x0:case 0x1:var _0x519b40=_0x37b4dd[_0x843d('0x1e')]?_[_0x843d('0x3d')](_0x37b4dd[_0x843d('0x1e')])?_0x37b4dd[_0x843d('0x1e')][_0x843d('0x1f')]():_0x37b4dd[_0x843d('0x1e')]:_0x843d('0x3e');if(_0x519b40===_0x843d('0x3f')){_0x519b40=_0x843d('0x3e');}this[_0x843d('0x5')](_0x843d('0x1e'),_0x519b40);this[_0x843d('0x5')](_0x843d('0x40'),'no');this[_0x843d('0x5')](_0x843d('0x41'),null);this[_0x843d('0x5')](_0x843d('0x42'),null);this[_0x843d('0x5')]('icesupport',null);this[_0x843d('0x5')](_0x843d('0x43'),null);this[_0x843d('0x5')]('dtlsverify',null);this[_0x843d('0x5')]('dtlssetup',null);this[_0x843d('0x5')](_0x843d('0x44'),null);this['setDataValue'](_0x843d('0x45'),null);this[_0x843d('0x5')](_0x843d('0x46'),'no');break;case 0x2:this[_0x843d('0x5')]('transport',_0x843d('0x3f'));this[_0x843d('0x5')]('encryption',_0x843d('0x25'));this[_0x843d('0x5')](_0x843d('0x41'),_0x843d('0x25'));this['setDataValue'](_0x843d('0x42'),_0x843d('0x25'));this[_0x843d('0x5')](_0x843d('0x47'),'yes');this[_0x843d('0x5')](_0x843d('0x43'),_0x843d('0x25'));this[_0x843d('0x5')](_0x843d('0x48'),'no');this[_0x843d('0x5')](_0x843d('0x49'),_0x843d('0x4a'));this[_0x843d('0x5')](_0x843d('0x44'),_0x37b4dd['dtlscertfile']||_0x843d('0x4b'));this[_0x843d('0x5')](_0x843d('0x45'),_0x37b4dd['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x843d('0x5')](_0x843d('0x46'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x843d('0x3a')],'set':function(_0x29bdcf){this[_0x843d('0x5')](_0x843d('0x4c'),_0x29bdcf?_0x29bdcf['join'](','):[]);},'get':function(){return this['getDataValue'](_0x843d('0x4c'))?_[_0x843d('0x4d')](this[_0x843d('0x9')](_0x843d('0x4c'))[_0x843d('0x20')](','),function(_0x17acb8){return parseInt(_0x17acb8,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x843d('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x843d('0x6')]},'phoneBarBusyNumber':{'type':Sequelize[_0x843d('0x6')]},'phoneBarUnconditional':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x843d('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x843d('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x843d('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x843d('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x843d('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x843d('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x843d('0x6')]},'phoneBarEnableJaws':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x843d('0x9')]('phoneBarEnableScreenRecordingByAgent')?this[_0x843d('0x9')](_0x843d('0x4e')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x843d('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![],'set':function(_0x2307a5){if(typeof _0x2307a5==='string'){var _0x53ee4a=_0x2307a5==='1'?!![]:_0x2307a5==='0'?![]:_0x2307a5===_0x843d('0x4f')?!![]:_0x2307a5===_0x843d('0x50')?![]:![];this[_0x843d('0x5')](_0x843d('0x51'),_0x53ee4a);}else{this[_0x843d('0x5')](_0x843d('0x51'),_0x2307a5);}}},'blocked':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![],'set':function(_0x78a60c){this['setDataValue'](_0x843d('0x52'),_0x78a60c);if(_0x78a60c===!![]){this[_0x843d('0x5')](_0x843d('0x53'),moment());this[_0x843d('0x5')](_0x843d('0x54'),0x0);}else{this['setDataValue'](_0x843d('0x53'),null);}}},'blockedAt':{'type':Sequelize[_0x843d('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x843d('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x843d('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x843d('0x10')](0x5)[_0x843d('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x843d('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x843d('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x843d('0x10')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x843d('0x10')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x843d('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 49d39bc..0c08b66 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 _0x7212=['getPresence','idle','unknown','teams','queues','inbound','flatten','toString','lower','col','asc','desc','uniqBy','orderBy','getRealtimeAgents','voiceStatus','unavailable','slice','toUpperCase','select','field','ui.createdAt','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','util','lodash','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/realtime/agents','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','update','then','role','emit','userNotification:recalc:','get','admin','Users','Agents','agent','ignore','map','value','includes','find','UserProfileResource','stack','name','send','User','rawAttributes','fieldName','key','filter','password','salt','resetPasswordToken','resetPasswordExpires','index','getOptions','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','openTabs','rows','chat','dataValues','sms','fax','mail','all','catch','params','merge','openchannel','whatsapp','body','describe','addContacts','ids','omit','internal','Setting','findById','validatePasswordPattern','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','SELECT','length','from','voicemail','mailbox','VoiceMail','email','permissions','101','102','113','110','104','105','106','107','108','109','100','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','checkUserLimits','settingsEnabled','UserProfileSection','Telephones','autoAssociation','error','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','telephone','isEmpty','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','addQueues','channel','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','upsert','remove','isArray','Queue:remove','userpic','file','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','model','keys','filters','intersection','fields','sort','pick','where','options','Queue','Queues','Unknown\x20role','nolimit','getVoiceQueuesRt','order','getGroups','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','mobile','LOCAL/%s@from-sip/n','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','destroy','pause','updateAttributes','DEFAULT\x20PAUSE','type','unpause','chatPause','openchannelPause','smsPause','pauseType','lastPauseAt','getTeams','addTeams','transaction','Team','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$or','$gt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getUserSetting'];(function(_0x32e2c6,_0x285891){var _0x5c203f=function(_0x2a7cfe){while(--_0x2a7cfe){_0x32e2c6['push'](_0x32e2c6['shift']());}};_0x5c203f(++_0x285891);}(_0x7212,0x1aa));var _0x2721=function(_0x3f504b,_0x2e41b7){_0x3f504b=_0x3f504b-0x0;var _0x420bf2=_0x7212[_0x3f504b];return _0x420bf2;};'use strict';var moment=require('moment');var util=require(_0x2721('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x2721('0x1'));var squel=require(_0x2721('0x2'));var Redis=require(_0x2721('0x3'));var authService=require(_0x2721('0x4'));var contacts=require(_0x2721('0x5'));var qs=require('../../components/parsers/qs');var rta=require(_0x2721('0x6'));var logger=require('../../config/logger')('api');var utils=require(_0x2721('0x7'));var config=require(_0x2721('0x8'));var licenseUtil=require(_0x2721('0x9'));var APIBadRequestError=require(_0x2721('0xa'))[_0x2721('0xb')];var APINotFoundError=require(_0x2721('0xa'))[_0x2721('0xc')];var APIForbiddenError=require(_0x2721('0xa'))[_0x2721('0xd')];var APIHandleError=require('../../errors/api')[_0x2721('0xe')];var db=require(_0x2721('0xf'))['db'];var socket=require(_0x2721('0x10'))(new Redis(config[_0x2721('0x11')]));require(_0x2721('0x12'))[_0x2721('0x13')](socket);config[_0x2721('0x11')]=_[_0x2721('0x14')](config[_0x2721('0x11')],{'host':_0x2721('0x15'),'port':0x18eb});var values;function respondWithStatusCode(_0x3361de,_0x114419){_0x114419=_0x114419||0xcc;return function(_0x23e132){if(_0x23e132){return _0x3361de[_0x2721('0x16')](_0x114419);}return _0x3361de['status'](_0x114419)['end']();};}function respondWithResult(_0x3f8066,_0x578ce6){_0x578ce6=_0x578ce6||0xc8;return function(_0xd0e6d6){if(_0xd0e6d6){return _0x3f8066['status'](_0x578ce6)[_0x2721('0x17')](_0xd0e6d6);}};}function respondWithFilteredResult(_0x53205b,_0x250b73){return function(_0xada36f){if(_0xada36f){var _0x55198b=typeof _0x250b73[_0x2721('0x18')]===_0x2721('0x19')&&typeof _0x250b73['limit']===_0x2721('0x19');var _0x4b4bb2=_0xada36f[_0x2721('0x1a')];var _0x57a62d=_0x55198b?0x0:_0x250b73['offset'];var _0x5c6fa3=_0x55198b?_0xada36f[_0x2721('0x1a')]:_0x250b73[_0x2721('0x18')]+_0x250b73[_0x2721('0x1b')];var _0x2a6617;if(_0x5c6fa3>=_0x4b4bb2){_0x5c6fa3=_0x4b4bb2;_0x2a6617=0xc8;}else{_0x2a6617=0xce;}_0x53205b[_0x2721('0x1c')](_0x2a6617);return _0x53205b[_0x2721('0x1d')](_0x2721('0x1e'),_0x57a62d+'-'+_0x5c6fa3+'/'+_0x4b4bb2)[_0x2721('0x17')](_0xada36f);}return null;};}function saveUpdates(_0x4038de){return function(_0x479ae6){if(_0x479ae6){return _0x479ae6[_0x2721('0x1f')](_0x4038de)[_0x2721('0x20')](function(_0x8fafe3){if(_0x8fafe3[_0x2721('0x21')]==='agent'){socket[_0x2721('0x22')](_0x2721('0x23')+_0x8fafe3['id'],_0x8fafe3);}return _0x8fafe3;});}return null;};}function removeEntity(_0xbcde6c,_0x38af59){return function(_0x32547f){if(_0x32547f){return _0x32547f['destroy']({'transaction':_0x38af59})[_0x2721('0x20')](function(){var _0x81e8c6=_0x32547f[_0x2721('0x24')]({'plain':!![]});if(_0x81e8c6[_0x2721('0x21')]===_0x2721('0x25'))return;var _0x7c4b51=[{'name':_0x2721('0x26'),'value':'user','ignore':!![]},{'name':_0x2721('0x27'),'value':_0x2721('0x28'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x307b53=_(_0x7c4b51)['filter'](_0x2721('0x29'))[_0x2721('0x2a')](_0x2721('0x2b'))[_0x2721('0x2b')]();if(_[_0x2721('0x2c')](_0x307b53,_0x81e8c6[_0x2721('0x21')])){return;}var _0x5f4e21=_[_0x2721('0x2d')](_0x7c4b51,[_0x2721('0x2b'),_0x81e8c6[_0x2721('0x21')]])['name'];return db[_0x2721('0x2e')]['destroy']({'where':{'type':_0x5f4e21,'resourceId':_0x81e8c6['id']},'transaction':_0x38af59})[_0x2721('0x20')](function(){return _0x32547f;});})['then'](function(){_0xbcde6c[_0x2721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x443f66){return function(_0x279386){if(!_0x279386){_0x443f66['sendStatus'](0x194);}return _0x279386;};}function handleError(_0x2751c0,_0x37adf0){_0x37adf0=_0x37adf0||0x1f4;return function(_0xc58d44){logger['error'](_0xc58d44[_0x2721('0x2f')]);if(_0xc58d44[_0x2721('0x30')]){delete _0xc58d44['name'];}_0x2751c0[_0x2721('0x1c')](_0x37adf0)[_0x2721('0x31')](_0xc58d44);};}function getUserAttributes(){return _(db[_0x2721('0x32')][_0x2721('0x33')])[_0x2721('0x2a')](function(_0x4489a4){return{'name':_0x4489a4[_0x2721('0x34')],'type':_0x4489a4['type'][_0x2721('0x35')]};})[_0x2721('0x36')](function(_0x2b738b){return![_0x2721('0x37'),_0x2721('0x38'),'previousPasswords',_0x2721('0x39'),_0x2721('0x3a'),'md5secret']['includes'](_0x2b738b[_0x2721('0x30')]);})['value']();}exports[_0x2721('0x3b')]=function(_0x598013,_0x4c0a14){var _0x36d0a9={},_0x25cb22={'count':0x0,'rows':[]};var _0x527d2c=getUserAttributes();_0x36d0a9=qs[_0x2721('0x3c')](_0x527d2c,_0x598013);var _0x1633f4={'where':_0x36d0a9['where']};return db[_0x2721('0x32')][_0x2721('0x1a')](_0x1633f4)[_0x2721('0x20')](function(_0x3dd28f){_0x25cb22[_0x2721('0x1a')]=_0x3dd28f;if(_0x598013[_0x2721('0x3d')][_0x2721('0x3e')]){_0x36d0a9[_0x2721('0x3f')]=[{'all':!![]}];}if(_0x598013['query'][_0x2721('0x40')]===_0x2721('0x41')){_0x36d0a9[_0x2721('0x3f')]=[{'model':db[_0x2721('0x42')],'as':_0x2721('0x40')}];}if(!_[_0x2721('0x2c')](_0x36d0a9['attributes'],'id')){_0x36d0a9[_0x2721('0x43')][_0x2721('0x44')]('id');}return db[_0x2721('0x32')][_0x2721('0x45')](_0x36d0a9);})['then'](function(_0x4fd09b){_0x25cb22['rows']=_0x4fd09b;if(_0x598013[_0x2721('0x3d')][_0x2721('0x46')]==='true'){var _0x18cfcd=[];for(var _0x5f4ffb=0x0;_0x5f4ffb<_0x25cb22[_0x2721('0x47')]['length'];_0x5f4ffb++){_0x18cfcd[_0x2721('0x44')](get_open_tabs(_0x2721('0x48'),_0x25cb22[_0x2721('0x47')][_0x5f4ffb][_0x2721('0x49')]));_0x18cfcd['push'](get_open_tabs(_0x2721('0x4a'),_0x25cb22[_0x2721('0x47')][_0x5f4ffb][_0x2721('0x49')]));_0x18cfcd[_0x2721('0x44')](get_open_tabs(_0x2721('0x4b'),_0x25cb22[_0x2721('0x47')][_0x5f4ffb][_0x2721('0x49')]));_0x18cfcd[_0x2721('0x44')](get_open_tabs(_0x2721('0x4c'),_0x25cb22[_0x2721('0x47')][_0x5f4ffb][_0x2721('0x49')]));_0x18cfcd[_0x2721('0x44')](get_open_tabs('openchannel',_0x25cb22[_0x2721('0x47')][_0x5f4ffb][_0x2721('0x49')]));_0x18cfcd[_0x2721('0x44')](get_open_tabs('whatsapp',_0x25cb22[_0x2721('0x47')][_0x5f4ffb][_0x2721('0x49')]));}return Promise[_0x2721('0x4d')](_0x18cfcd)[_0x2721('0x20')](function(){return _0x25cb22;});}else{return _0x25cb22;}})[_0x2721('0x20')](respondWithFilteredResult(_0x4c0a14,_0x36d0a9))[_0x2721('0x4e')](handleError(_0x4c0a14,null));};exports['show']=function(_0x2d284a,_0x233c4e){var _0x4696d3=getUserAttributes();_0x2d284a['query']['id']=_0x2d284a[_0x2721('0x4f')]['id'];var _0x5ad426=qs[_0x2721('0x3c')](_0x4696d3,_0x2d284a);if(_0x2d284a[_0x2721('0x3d')][_0x2721('0x3e')]){_0x5ad426[_0x2721('0x3f')]=[{'all':!![]}];}if(_0x2d284a['query'][_0x2721('0x40')]===_0x2721('0x41')){_0x5ad426[_0x2721('0x3f')]=[{'model':db[_0x2721('0x42')],'as':_0x2721('0x40')}];}_0x5ad426=_[_0x2721('0x50')]({},_0x5ad426,_0x2d284a['options']);if(!_['includes'](_0x5ad426[_0x2721('0x43')],'id')){_0x5ad426['attributes'][_0x2721('0x44')]('id');}return db[_0x2721('0x32')]['find'](_0x5ad426)[_0x2721('0x20')](handleEntityNotFound(_0x233c4e,null))['then'](function(_0x229ff8){var _0x275a97=[];values=_0x229ff8;if(_0x2d284a[_0x2721('0x3d')][_0x2721('0x46')]===_0x2721('0x41')){_0x275a97['push'](get_open_tabs(_0x2721('0x48'),_0x229ff8[_0x2721('0x49')]));_0x275a97[_0x2721('0x44')](get_open_tabs(_0x2721('0x4a'),_0x229ff8[_0x2721('0x49')]));_0x275a97[_0x2721('0x44')](get_open_tabs(_0x2721('0x51'),_0x229ff8['dataValues']));_0x275a97[_0x2721('0x44')](get_open_tabs(_0x2721('0x52'),_0x229ff8[_0x2721('0x49')]));_0x275a97[_0x2721('0x44')](get_open_tabs('fax',_0x229ff8[_0x2721('0x49')]));_0x275a97[_0x2721('0x44')](get_open_tabs('mail',_0x229ff8[_0x2721('0x49')]));return Promise[_0x2721('0x4d')](_0x275a97);}else{return values;}})[_0x2721('0x20')](function(){return values;})[_0x2721('0x20')](respondWithResult(_0x233c4e,null))[_0x2721('0x4e')](handleError(_0x233c4e,null));};exports['update']=function(_0x3017fc,_0x3f5ec8){if(_0x3017fc[_0x2721('0x53')]['id']){delete _0x3017fc[_0x2721('0x53')]['id'];}delete _0x3017fc[_0x2721('0x53')][_0x2721('0x21')];return db[_0x2721('0x32')][_0x2721('0x2d')]({'where':{'id':_0x3017fc[_0x2721('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3f5ec8,null))['then'](saveUpdates(_0x3017fc['body'],null))[_0x2721('0x20')](respondWithResult(_0x3f5ec8,null))[_0x2721('0x4e')](handleError(_0x3f5ec8,null));};exports['describe']=function(_0x367cd6,_0x5c79f0){return db['User'][_0x2721('0x54')]()['then'](respondWithResult(_0x5c79f0,null))[_0x2721('0x4e')](handleError(_0x5c79f0,null));};exports['addContacts']=function(_0x2a0e27,_0x478551){return db['User']['find']({'where':{'id':_0x2a0e27[_0x2721('0x4f')]['id']}})[_0x2721('0x20')](handleEntityNotFound(_0x478551,null))['then'](function(_0x5c15e2){if(_0x5c15e2){return _0x5c15e2[_0x2721('0x55')](_0x2a0e27[_0x2721('0x53')][_0x2721('0x56')],_[_0x2721('0x57')](_0x2a0e27['body'],[_0x2721('0x56'),'id'])||{});}})[_0x2721('0x20')](respondWithResult(_0x478551,null))[_0x2721('0x4e')](handleError(_0x478551,null));};function validateUser(_0x12ea7e){return new Promise(function(_0x42dd94,_0x1d97ce){if(_0x12ea7e[_0x2721('0x58')])return _0x42dd94(_0x12ea7e);return db[_0x2721('0x59')][_0x2721('0x5a')](0x1)[_0x2721('0x20')](function(_0x2b5e84){if(_0x2b5e84['securePassword'])authService[_0x2721('0x5b')](_0x12ea7e['password']);db[_0x2721('0x32')][_0x2721('0x5c')](_0x2721('0x58'))[_0x2721('0x20')](function(_0x5acfba){if(_[_0x2721('0x5d')](_0x5acfba)){_0x12ea7e[_0x2721('0x58')]=_0x2b5e84['min_internal']||0x1;return;}if(_['isNil'](_0x2b5e84[_0x2721('0x5e')])||_0x2b5e84[_0x2721('0x5e')]===_0x5acfba){_0x12ea7e[_0x2721('0x58')]=_0x5acfba+0x1;return;}if(_0x2b5e84[_0x2721('0x5e')]>_0x5acfba){_0x12ea7e[_0x2721('0x58')]=_0x2b5e84['min_internal'];return;}return db[_0x2721('0x5f')][_0x2721('0x3d')](_0x2721('0x60'),{'type':db[_0x2721('0x5f')][_0x2721('0x61')][_0x2721('0x62')]})[_0x2721('0x20')](function(_0x39644d){if(_0x39644d&&_0x39644d[_0x2721('0x63')]){for(var _0x290f34=0x0,_0x3145f3=_0x39644d[_0x2721('0x63')];_0x290f34<_0x3145f3&&_['isNil'](_0x12ea7e[_0x2721('0x58')]);_0x290f34++){if(_0x2b5e84['min_internal']<=_0x39644d[_0x290f34][_0x2721('0x64')]){_0x12ea7e[_0x2721('0x58')]=_0x39644d[_0x290f34][_0x2721('0x64')];}else if(_0x2b5e84[_0x2721('0x5e')]>_0x39644d[_0x290f34][_0x2721('0x64')]&&_0x2b5e84['min_internal']<=_0x39644d[_0x290f34]['to']){_0x12ea7e[_0x2721('0x58')]=_0x2b5e84[_0x2721('0x5e')];}}}if(_[_0x2721('0x5d')](_0x12ea7e[_0x2721('0x58')])){_0x12ea7e['internal']=_0x5acfba+0x1;}return _0x42dd94(_0x12ea7e);});});})['catch'](function(_0x549536){_0x1d97ce(_0x549536);});});}function updateUser(_0x486aab){return new Promise(function(_0x1d7874,_0x22d53f){try{if(_0x486aab[_0x2721('0x65')]){_0x486aab[_0x2721('0x66')]=_0x486aab['internal'];_0x486aab[_0x2721('0x67')]={'mailbox':_0x486aab[_0x2721('0x58')],'password':_0x486aab['password'],'fullname':_0x486aab['fullname'],'email':_0x486aab[_0x2721('0x68')]};}if(_0x486aab[_0x2721('0x21')]===_0x2721('0x28')){if(!_0x486aab['permissions'])_0x486aab[_0x2721('0x69')]=[_0x2721('0x6a'),_0x2721('0x6b'),'103',_0x2721('0x6c'),_0x2721('0x6d'),_0x2721('0x6e'),_0x2721('0x6f'),_0x2721('0x70'),_0x2721('0x71'),_0x2721('0x72'),_0x2721('0x73'),_0x2721('0x74'),'111',_0x2721('0x75'),_0x2721('0x76')];}_0x1d7874(_0x486aab);}catch(_0x4e7d82){_0x22d53f(_0x4e7d82);}});}exports[_0x2721('0x77')]=function(_0x4451de,_0xf9c737){if(_0x4451de[_0x2721('0x78')][_0x2721('0x21')]===_0x2721('0x28'))throw new Error(_0x2721('0x79'));if(_0x4451de['body']['role']===_0x2721('0x78')&&_0x4451de[_0x2721('0x78')][_0x2721('0x21')]!==_0x2721('0x25')){throw new Error(_0x2721('0x7a'));}if(_0x4451de['body'][_0x2721('0x21')]===_0x2721('0x25')&&_0x4451de[_0x2721('0x78')][_0x2721('0x21')]!==_0x2721('0x25')){throw new Error(_0x2721('0x7b'));}return licenseUtil[_0x2721('0x7c')]([_0x4451de[_0x2721('0x53')]])[_0x2721('0x20')](function(){return validateUser(_0x4451de[_0x2721('0x53')]);})['then'](function(_0x5d8b7b){return updateUser(_0x5d8b7b)[_0x2721('0x20')](function(_0x321eb0){if(_0x321eb0['role']===_0x2721('0x25')){_0x321eb0[_0x2721('0x7d')]=_0x4451de[_0x2721('0x78')][_0x2721('0x7d')];delete _0x321eb0['userProfileId'];}return _0x321eb0;});})[_0x2721('0x20')](function(_0x4dd513){return db[_0x2721('0x32')][_0x2721('0x77')](_0x4dd513,{'include':[{'model':db[_0x2721('0x67')],'as':'VoiceMail'}]});})[_0x2721('0x20')](function(_0x836c2){if(_0x4451de['body'][_0x2721('0x21')]===_0x2721('0x78'))return _0x836c2;if(_0x4451de['user'][_0x2721('0x21')]!==_0x2721('0x78'))return _0x836c2;return db[_0x2721('0x7e')][_0x2721('0x2d')]({'where':{'name':_0x836c2['role']===_0x2721('0x28')?_0x2721('0x27'):_0x2721('0x7f'),'userProfileId':_0x4451de[_0x2721('0x78')]['userProfileId']},'raw':!![]})[_0x2721('0x20')](function(_0x22f839){if(!_0x22f839||_0x22f839[_0x2721('0x80')]!=0x0)return _0x836c2;return db[_0x2721('0x2e')][_0x2721('0x77')]({'name':_0x836c2[_0x2721('0x30')],'resourceId':_0x836c2['id'],'type':_0x22f839[_0x2721('0x30')],'sectionId':_0x22f839['id']},{})['then'](function(){return _0x836c2;});})[_0x2721('0x4e')](function(_0x5079c0){logger[_0x2721('0x81')](_0x2721('0x82'),_0x5079c0);throw _0x5079c0;});})['then'](respondWithResult(_0xf9c737,0xc9))[_0x2721('0x4e')](handleError(_0xf9c737,null));};exports[_0x2721('0x83')]=function(_0x28443f,_0x5c03aa){var _0x22d04c=_0x28443f[_0x2721('0x53')];var _0x5d2843=[];if(_0x28443f[_0x2721('0x78')][_0x2721('0x21')]===_0x2721('0x28'))throw new Error(_0x2721('0x79'));if(_[_0x2721('0x84')](_0x22d04c,[_0x2721('0x21'),_0x2721('0x78')])&&_0x28443f[_0x2721('0x78')]['role']!==_0x2721('0x25')){throw new Error(_0x2721('0x7a'));}if(_[_0x2721('0x84')](_0x22d04c,[_0x2721('0x21'),_0x2721('0x25')])&&_0x28443f[_0x2721('0x78')]['role']!=='admin'){throw new Error(_0x2721('0x85'));}return licenseUtil[_0x2721('0x7c')](_0x22d04c)[_0x2721('0x20')](function(){return validateUser(_0x22d04c[0x0]);})[_0x2721('0x20')](function(){for(var _0x32c4fe=0x1;_0x32c4fe<_0x22d04c[_0x2721('0x63')];_0x32c4fe++){var _0x4bf183=_0x22d04c[_0x32c4fe-0x1]['internal'];if(!_0x22d04c[_0x32c4fe][_0x2721('0x58')])_0x22d04c[_0x32c4fe][_0x2721('0x58')]=_0x4bf183+0x1;_0x5d2843[_0x2721('0x44')](validateUser(_0x22d04c[_0x32c4fe]));}return Promise['all'](_0x5d2843);})[_0x2721('0x20')](function(){_0x5d2843=[];for(var _0x3da6a7=0x0;_0x3da6a7<_0x22d04c[_0x2721('0x63')];_0x3da6a7++){_0x5d2843[_0x2721('0x44')](updateUser(_0x22d04c[_0x3da6a7]));}return Promise[_0x2721('0x4d')](_0x5d2843);})['then'](function(){_0x5d2843=_0x22d04c[_0x2721('0x2a')](function(_0x266f35){return db[_0x2721('0x32')][_0x2721('0x77')](_0x266f35,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})['then'](function(_0x4a8f83){_0x266f35['id']=_0x4a8f83['id'];return _0x266f35;});});return Promise[_0x2721('0x4d')](_0x5d2843);})[_0x2721('0x20')](function(_0xbc2f1f){if(_0x28443f['body'][_0x2721('0x21')]===_0x2721('0x78'))return _0xbc2f1f;if(_0x28443f[_0x2721('0x78')][_0x2721('0x21')]!==_0x2721('0x78'))return _0xbc2f1f;var _0x35359c=_['some'](_0xbc2f1f,function(_0xc04734){return _0xc04734[_0x2721('0x21')]===_0x2721('0x28')||_0xc04734[_0x2721('0x21')]===_0x2721('0x86');});if(!_0x35359c)return _0xbc2f1f;return db[_0x2721('0x7e')][_0x2721('0x45')]({'where':{'name':{'$or':[_0x2721('0x27'),'Telephones']},'userProfileId':_0x28443f[_0x2721('0x78')]['userProfileId']},'raw':!![]})[_0x2721('0x20')](function(_0x39a880){if(_[_0x2721('0x87')](_0x39a880)||!_[_0x2721('0x84')](_0x39a880,[_0x2721('0x80'),0x0]))return _0xbc2f1f;_0x5d2843=[];var _0x26ce7d=_(_0x39a880)[_0x2721('0x2a')](function(_0x1a8e05){if(_0x1a8e05['autoAssociation']===0x1)return;return _0x1a8e05['name']===_0x2721('0x27')?_0x2721('0x28'):_0x2721('0x86');})['compact']()[_0x2721('0x2b')]();for(var _0x4f8ca6=0x0;_0x4f8ca6<_0xbc2f1f[_0x2721('0x63')];_0x4f8ca6++){if(!_[_0x2721('0x2c')](_0x26ce7d,_0xbc2f1f[_0x4f8ca6]['role']))return;var _0x3fc1fc=_0xbc2f1f[_0x4f8ca6][_0x2721('0x21')]===_0x2721('0x28')?_0x2721('0x27'):_0x2721('0x7f');_0x5d2843[_0x2721('0x44')](db[_0x2721('0x2e')][_0x2721('0x77')]({'name':_0xbc2f1f[_0x4f8ca6]['name'],'resourceId':_0xbc2f1f[_0x4f8ca6]['id'],'type':_0x3fc1fc,'sectionId':_[_0x2721('0x2d')](_0x39a880,[_0x2721('0x30'),_0x3fc1fc])['id']},{}));}return Promise[_0x2721('0x4d')](_0x5d2843);});})[_0x2721('0x20')](respondWithResult(_0x5c03aa,0xc9))[_0x2721('0x4e')](handleError(_0x5c03aa,null));};exports[_0x2721('0x88')]=function(_0xdbd2cd,_0x4b93fd){if(_0xdbd2cd['body']['id']){delete _0xdbd2cd['body']['id'];}return db[_0x2721('0x32')]['find']({'where':{'id':_0xdbd2cd[_0x2721('0x4f')]['id']}})[_0x2721('0x20')](function(_0x2fdc40){if(!_0x2fdc40)return null;if(_0x2fdc40['id']===_0xdbd2cd[_0x2721('0x78')]['id']){if(!_0xdbd2cd['body']['oldPassword']||!_0xdbd2cd[_0x2721('0x53')][_0x2721('0x89')]){throw new db[(_0x2721('0x8a'))][(_0x2721('0x8b'))](_0x2721('0x8c'));}if(!_0x2fdc40[_0x2721('0x8d')](_0xdbd2cd[_0x2721('0x53')]['oldPassword'])){throw new db[(_0x2721('0x8a'))][(_0x2721('0x8b'))](_0x2721('0x8e'));}if(_0xdbd2cd[_0x2721('0x53')][_0x2721('0x8f')]===_0xdbd2cd[_0x2721('0x53')]['newPassword']){throw new db['Sequelize'][(_0x2721('0x8b'))](_0x2721('0x90'));}}else if(_0xdbd2cd['user'][_0x2721('0x21')]==='admin'){if(!_0xdbd2cd[_0x2721('0x53')][_0x2721('0x89')]){throw new db['Sequelize']['ValidationError'](_0x2721('0x91'));}}else if(_0xdbd2cd[_0x2721('0x78')][_0x2721('0x21')]===_0x2721('0x78')){if(!_0xdbd2cd[_0x2721('0x53')][_0x2721('0x89')]){throw new db[(_0x2721('0x8a'))][(_0x2721('0x8b'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x2fdc40[_0x2721('0x21')]!=='agent'){throw new db[(_0x2721('0x8a'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0x2721('0x8a'))][(_0x2721('0x8b'))](_0x2721('0x79'));}return _0x2fdc40;})[_0x2721('0x20')](handleEntityNotFound(_0x4b93fd,null))['then'](function(_0x2df322){return db[_0x2721('0x59')][_0x2721('0x92')]({'attributes':['id','securePassword',_0x2721('0x93'),'passwordHistoryLimit']})[_0x2721('0x20')](function(_0x36c8f8){if(_0x36c8f8['securePassword'])authService[_0x2721('0x5b')](_0xdbd2cd[_0x2721('0x53')][_0x2721('0x89')]);if(!_0x36c8f8[_0x2721('0x93')]||!_0x2df322[_0x2721('0x94')])return _0x2df322;authService[_0x2721('0x95')](_0xdbd2cd[_0x2721('0x53')]['newPassword'],_0x2df322[_0x2721('0x94')],_0x36c8f8[_0x2721('0x96')]);return _0x2df322;})[_0x2721('0x20')](saveUpdates({'password':_0xdbd2cd['body'][_0x2721('0x89')],'passwordResetAt':_0xdbd2cd[_0x2721('0x78')]['id']==_0xdbd2cd[_0x2721('0x4f')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xdbd2cd[_0x2721('0x53')][_0x2721('0x89')],_0x2df322[_0x2721('0x94')])},null));})[_0x2721('0x20')](respondWithResult(_0x4b93fd,null))[_0x2721('0x4e')](handleError(_0x4b93fd,null));};exports[_0x2721('0x97')]=function(_0x1bd318,_0x1c01b3){var _0x3ee1e4=_0x1bd318[_0x2721('0x53')][_0x2721('0x98')];return db[_0x2721('0x32')][_0x2721('0x2d')]({'where':{'id':_0x1bd318[_0x2721('0x4f')]['id']},'attributes':['id',_0x2721('0x30'),_0x2721('0x21'),_0x2721('0x99'),'loginInPause',_0x2721('0x9a'),_0x2721('0x9b')]})[_0x2721('0x20')](handleEntityNotFound(_0x1c01b3,null))['then'](function(_0x2d7ca8){if(_0x2d7ca8){if(!utils[_0x2721('0x9c')](_0x3ee1e4)){throw new db[(_0x2721('0x8a'))][(_0x2721('0x8b'))](_0x2721('0x9d'));}return _0x2d7ca8[_0x2721('0x9e')+_[_0x2721('0x9f')](_0x3ee1e4[_0x2721('0xa0')]())+'Queues'](_0x1bd318[_0x2721('0x53')]['ids'],{'penalty':_0x1bd318[_0x2721('0x53')][_0x2721('0xa1')]||0x0})[_0x2721('0xa2')](function(_0x2e0f38){for(var _0x4a3264=0x0;_0x4a3264<_0x1bd318['body'][_0x2721('0x56')][_0x2721('0x63')];_0x4a3264+=0x1){var _0x2eb4b8={'UserId':Number(_0x1bd318['params']['id'])};_0x2eb4b8[_[_0x2721('0x9f')](_0x3ee1e4[_0x2721('0xa0')]())+_0x2721('0xa3')]=Number(_0x1bd318[_0x2721('0x53')][_0x2721('0x56')][_0x4a3264]);socket[_0x2721('0x22')]('user'+_[_0x2721('0x9f')](_0x3ee1e4[_0x2721('0xa0')]())+_0x2721('0xa4'),_0x2eb4b8);}return _0x2e0f38;})[_0x2721('0x20')](function(){if(_0x3ee1e4===_0x2721('0xa5')){return db[_0x2721('0xa6')]['findAll']({'where':{'id':_0x1bd318[_0x2721('0x53')][_0x2721('0x56')]||[]},'raw':!![],'attributes':['id',_0x2721('0x30')]});}})[_0x2721('0x20')](function(_0x32a81f){var _0x88c5a8=_0x2d7ca8['get']({'plain':!![]});var _0xb3d6f1=[];if(_0x3ee1e4===_0x2721('0xa5')&&_0x88c5a8[_0x2721('0x21')]==='agent'&&_0x88c5a8[_0x2721('0x99')]){for(let _0x3714d0=0x0;_0x3714d0<_0x32a81f[_0x2721('0x63')];_0x3714d0+=0x1){_0xb3d6f1['push']({'membername':_0x88c5a8[_0x2721('0x30')],'UserId':_0x88c5a8['id'],'queue_name':_0x32a81f[_0x3714d0]['name'],'VoiceQueueId':_0x32a81f[_0x3714d0]['id'],'interface':_['isNil'](_0x88c5a8[_0x2721('0x9b')])?util[_0x2721('0xa7')](_0x2721('0xa8'),_0x88c5a8['name']):_0x88c5a8[_0x2721('0x9b')],'paused':_0x88c5a8[_0x2721('0x9a')]||![],'penalty':_0x1bd318[_0x2721('0x53')]['penalty']||0x0});}return Promise[_0x2721('0x4d')](_0xb3d6f1[_0x2721('0x2a')](function(_0x552733){return db[_0x2721('0xa9')][_0x2721('0xaa')](_0x552733);}));}return _0x2d7ca8;});}})[_0x2721('0x20')](respondWithStatusCode(_0x1c01b3,null))[_0x2721('0x4e')](handleError(_0x1c01b3,null));};exports['removeQueues']=function(_0x2450ed,_0x4fa10b){var _0x159185,_0x4f84f6;return db[_0x2721('0x32')][_0x2721('0x2d')]({'where':{'id':_0x2450ed[_0x2721('0x4f')]['id']},'attributes':['id',_0x2721('0x30'),'role']})[_0x2721('0x20')](handleEntityNotFound(_0x4fa10b,null))[_0x2721('0x20')](function(_0x22077f){if(_0x22077f){_0x159185=_0x22077f;if(!_0x2450ed['query'][_0x2721('0x98')]||!utils[_0x2721('0x9c')](_0x2450ed[_0x2721('0x3d')][_0x2721('0x98')])){throw new db[(_0x2721('0x8a'))][(_0x2721('0x8b'))](_0x2721('0x9d'));}return _0x22077f[_0x2721('0xab')+_[_0x2721('0x9f')](_0x2450ed[_0x2721('0x3d')][_0x2721('0x98')][_0x2721('0xa0')]())+'Queues'](_0x2450ed[_0x2721('0x3d')][_0x2721('0x56')]);}})[_0x2721('0x20')](function(_0x50a166){if(_[_0x2721('0xac')](_0x2450ed[_0x2721('0x3d')]['ids'])){for(var _0x332049=0x0;_0x332049<_0x2450ed['query'][_0x2721('0x56')][_0x2721('0x63')];_0x332049+=0x1){_0x4f84f6={'UserId':Number(_0x2450ed[_0x2721('0x4f')]['id'])};_0x4f84f6[_[_0x2721('0x9f')](_0x2450ed[_0x2721('0x3d')]['channel'][_0x2721('0xa0')]())+_0x2721('0xa3')]=Number(_0x2450ed[_0x2721('0x3d')][_0x2721('0x56')][_0x332049]);socket[_0x2721('0x22')](_0x2721('0x78')+_[_0x2721('0x9f')](_0x2450ed['query'][_0x2721('0x98')]['toLowerCase']())+_0x2721('0xad'),_0x4f84f6);}}else{_0x4f84f6={'UserId':Number(_0x2450ed[_0x2721('0x4f')]['id'])};_0x4f84f6[_[_0x2721('0x9f')](_0x2450ed[_0x2721('0x3d')][_0x2721('0x98')]['toLowerCase']())+'QueueId']=Number(_0x2450ed['query'][_0x2721('0x56')]);socket[_0x2721('0x22')](_0x2721('0x78')+_[_0x2721('0x9f')](_0x2450ed[_0x2721('0x3d')][_0x2721('0x98')][_0x2721('0xa0')]())+_0x2721('0xad'),_0x4f84f6);}return _0x50a166;})[_0x2721('0x20')](function(){if(_0x2450ed[_0x2721('0x3d')][_0x2721('0x98')]===_0x2721('0xa5')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x2450ed[_0x2721('0x4f')]['id'],'VoiceQueueId':_0x2450ed[_0x2721('0x3d')][_0x2721('0x56')]},'individualHooks':!![]})[_0x2721('0x20')](function(){return _0x159185;});}return _0x159185;})['then'](respondWithStatusCode(_0x4fa10b,null))[_0x2721('0x4e')](handleError(_0x4fa10b,null));};exports['addAvatar']=function(_0x207d21,_0x1658a0){_0x207d21[_0x2721('0x53')][_0x2721('0xae')]=_0x207d21[_0x2721('0xaf')]['filename'];return db[_0x2721('0x32')][_0x2721('0x2d')]({'where':{'id':_0x207d21[_0x2721('0x4f')]['id']}})[_0x2721('0x20')](handleEntityNotFound(_0x1658a0,null))[_0x2721('0x20')](saveUpdates(_0x207d21[_0x2721('0x53')],null))[_0x2721('0x20')](respondWithResult(_0x1658a0,null))[_0x2721('0x4e')](handleError(_0x1658a0,null));};exports[_0x2721('0xb0')]=function(_0x4c5f9e,_0x4430dc){var _0x450023=path['join'](config[_0x2721('0xb1')],_0x2721('0xb2'));return db[_0x2721('0x32')]['find']({'where':{'id':_0x4c5f9e[_0x2721('0x4f')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x4430dc,null))[_0x2721('0x20')](function(_0x406323){if(_0x406323){if(_[_0x2721('0x5d')](_0x406323[_0x2721('0xae')])){return _0x4430dc[_0x2721('0xb3')](_0x450023);}else{if(!fs[_0x2721('0xb4')](path[_0x2721('0xb5')](config[_0x2721('0xb1')],_0x2721('0xb6'),_0x406323['userpic']))){return _0x4430dc['download'](_0x450023);}return _0x4430dc[_0x2721('0xb3')](path['join'](config[_0x2721('0xb1')],_0x2721('0xb6'),_0x406323['userpic']));}}})[_0x2721('0x4e')](handleError(_0x4430dc,null));};exports[_0x2721('0xb7')]=function(_0x4df513,_0x17a7e6){return db[_0x2721('0x32')][_0x2721('0x2d')]({'where':{'id':_0x4df513['params']['id']},'attributes':['id']})[_0x2721('0x20')](handleEntityNotFound(_0x17a7e6,null))[_0x2721('0x20')](function(_0x36593d){var _0x4f2d66=[];values=_0x36593d[_0x2721('0x49')];_0x4f2d66['push'](get_open_tabs(_0x2721('0x48'),_0x36593d[_0x2721('0x49')]));_0x4f2d66[_0x2721('0x44')](get_open_tabs(_0x2721('0x4a'),_0x36593d[_0x2721('0x49')]));_0x4f2d66['push'](get_open_tabs(_0x2721('0x51'),_0x36593d['dataValues']));_0x4f2d66['push'](get_open_tabs(_0x2721('0x52'),_0x36593d[_0x2721('0x49')]));_0x4f2d66[_0x2721('0x44')](get_open_tabs(_0x2721('0x4b'),_0x36593d[_0x2721('0x49')]));_0x4f2d66[_0x2721('0x44')](get_open_tabs(_0x2721('0x4c'),_0x36593d['dataValues']));return Promise[_0x2721('0x4d')](_0x4f2d66);})[_0x2721('0x20')](function(_0x5815bb){if(_0x5815bb){var _0x450778=_['map'](values[_0x2721('0xb8')],function(_0x5992e4){return{'channel':_0x2721('0xb9'),'id':_0x5992e4['id'],'createdAt':_0x5992e4[_0x2721('0xba')]};});var _0x1c1cdd=_[_0x2721('0x2a')](values[_0x2721('0xbb')],function(_0x511316){return{'channel':_0x2721('0xbc'),'id':_0x511316['id'],'createdAt':_0x511316[_0x2721('0xba')]};});var _0x1a8b74=_[_0x2721('0x2a')](values[_0x2721('0xbd')],function(_0x164b56){return{'channel':_0x2721('0xbe'),'id':_0x164b56['id'],'createdAt':_0x164b56[_0x2721('0xba')]};});var _0x2a1e93=_[_0x2721('0x2a')](values[_0x2721('0xbf')],function(_0x14c979){return{'channel':'MAIL','id':_0x14c979['id'],'createdAt':_0x14c979[_0x2721('0xba')]};});var _0x160e7b=_[_0x2721('0x2a')](values[_0x2721('0xc0')],function(_0x5bc675){return{'channel':_0x2721('0xc1'),'id':_0x5bc675['id'],'createdAt':_0x5bc675['createdAt']};});var _0x67d784=_[_0x2721('0x2a')](values[_0x2721('0xc2')],function(_0x557976){return{'channel':'WHATSAPP','id':_0x557976['id'],'createdAt':_0x557976[_0x2721('0xba')]};});var _0x164256=_[_0x2721('0xc3')](_0x450778,_0x1c1cdd,_0x1a8b74,_0x2a1e93,_0x160e7b,_0x67d784);var _0x4f13f6={'count':_0x164256[_0x2721('0x63')],'rows':_0x164256};return _0x4f13f6;}else return null;})['then'](respondWithResult(_0x17a7e6,null))[_0x2721('0x4e')](handleError(_0x17a7e6,null));};exports[_0x2721('0xc4')]=function(_0x1d180a,_0x4997c6){var _0x3e5291={};return db['User'][_0x2721('0x92')]({'where':{'id':_0x1d180a[_0x2721('0x4f')]['id']}})[_0x2721('0x20')](function(_0x291555){if(!_0x291555){throw new APINotFoundError(util[_0x2721('0xa7')](_0x2721('0xc5'),_0x1d180a[_0x2721('0x4f')]['id']));}return contacts['describe']();})[_0x2721('0x20')](function(_0x4ef395){_0x1d180a[_0x2721('0x3d')][_0x2721('0x32')]=_0x1d180a[_0x2721('0x4f')]['id'];_0x3e5291=qs['getOptions'](_0x4ef395,_0x1d180a);if(_0x1d180a[_0x2721('0x3d')][_0x2721('0xc6')]('includeAll')){_0x3e5291[_0x2721('0x3f')]=[{'model':db[_0x2721('0xc7')],'as':_0x2721('0xc8'),'required':![]},{'model':db[_0x2721('0xc9')],'as':_0x2721('0xca'),'attributes':['id',_0x2721('0x30'),_0x2721('0xcb')],'where':_0x1d180a[_0x2721('0x3d')]['tag']?{'id':_0x1d180a[_0x2721('0x3d')]['tag']}:undefined,'required':_0x1d180a['query'][_0x2721('0xcc')]?!![]:![]}];}return contacts[_0x2721('0x45')](_0x1d180a[_0x2721('0x3d')],_0x1d180a[_0x2721('0x78')],_0x3e5291,_0x4ef395);})['then'](respondWithFilteredResult(_0x4997c6,_0x3e5291))[_0x2721('0x4e')](APIHandleError(_0x4997c6));};exports[_0x2721('0xcd')]=function(_0x20718a,_0x58ba51){var _0x3ff2e8;var _0x576cb8={};var _0x494714;return db['User'][_0x2721('0x92')]({'where':{'id':_0x20718a[_0x2721('0x4f')]['id']},'attributes':['id',_0x2721('0x30'),_0x2721('0x21')]})['then'](handleEntityNotFound(_0x58ba51,null))[_0x2721('0x20')](function(_0x395526){if(!utils['isValidChannel'](_0x20718a[_0x2721('0x3d')][_0x2721('0x98')])){throw new db['Sequelize'][(_0x2721('0x8b'))](_0x2721('0x9d'));}_0x3ff2e8=_0x395526;var _0xcf9713={};_0xcf9713[_0x2721('0xce')]=_[_0x2721('0xcf')](db[_[_0x2721('0x9f')](_0x20718a[_0x2721('0x3d')][_0x2721('0x98')])+'Queue'][_0x2721('0x33')]);_0xcf9713[_0x2721('0x3d')]=_[_0x2721('0xcf')](_0x20718a[_0x2721('0x3d')]);_0xcf9713[_0x2721('0xd0')]=_['intersection'](_0xcf9713['model'],_0xcf9713[_0x2721('0x3d')]);_0x576cb8[_0x2721('0x43')]=_[_0x2721('0xd1')](_0xcf9713['model'],qs[_0x2721('0xd2')](_0x20718a[_0x2721('0x3d')][_0x2721('0xd2')]));_0x576cb8['attributes']=_0x576cb8[_0x2721('0x43')][_0x2721('0x63')]?_0x576cb8[_0x2721('0x43')]:_0xcf9713[_0x2721('0xce')];_0x576cb8['order']=qs[_0x2721('0xd3')](_0x20718a[_0x2721('0x3d')][_0x2721('0xd3')]);_0x576cb8['where']=qs[_0x2721('0xd0')](_[_0x2721('0xd4')](_0x20718a[_0x2721('0x3d')],_0xcf9713[_0x2721('0xd0')]));if(_0x20718a[_0x2721('0x3d')][_0x2721('0x36')]){_0x576cb8[_0x2721('0xd5')]=_[_0x2721('0x50')](_0x576cb8[_0x2721('0xd5')],{'$or':_[_0x2721('0x2a')](_0x576cb8[_0x2721('0x43')],function(_0x37ad22){var _0x1cf7f4={};_0x1cf7f4[_0x37ad22]={'$like':'%'+_0x20718a[_0x2721('0x3d')][_0x2721('0x36')]+'%'};return _0x1cf7f4;})});}_0x576cb8=_[_0x2721('0x50')]({},_0x576cb8,_0x20718a[_0x2721('0xd6')]);switch(_0x3ff2e8[_0x2721('0x21')]){case _0x2721('0x25'):return db[_[_0x2721('0x9f')](_0x20718a[_0x2721('0x3d')][_0x2721('0x98')])+_0x2721('0xd7')]['findAll'](_0x576cb8);case'user':case _0x2721('0x28'):return _0x3ff2e8[_0x2721('0x24')+_[_0x2721('0x9f')](_0x20718a[_0x2721('0x3d')][_0x2721('0x98')])+_0x2721('0xd8')](_0x576cb8);default:throw new db[(_0x2721('0x8a'))][(_0x2721('0x8b'))](_0x2721('0xd9'));}})[_0x2721('0x20')](function(_0x2fccba){_0x494714=_0x2fccba[_0x2721('0x63')];if(!_0x20718a[_0x2721('0x3d')][_0x2721('0xc6')](_0x2721('0xda'))){_0x576cb8['limit']=qs[_0x2721('0x1b')](_0x20718a[_0x2721('0x3d')][_0x2721('0x1b')]);_0x576cb8[_0x2721('0x18')]=qs[_0x2721('0x18')](_0x20718a[_0x2721('0x3d')][_0x2721('0x18')]);}switch(_0x3ff2e8['role']){case _0x2721('0x25'):return db[_['capitalize'](_0x20718a[_0x2721('0x3d')][_0x2721('0x98')])+_0x2721('0xd7')][_0x2721('0x45')](_0x576cb8);case'user':case _0x2721('0x28'):return _0x3ff2e8[_0x2721('0x24')+_[_0x2721('0x9f')](_0x20718a[_0x2721('0x3d')][_0x2721('0x98')])+_0x2721('0xd8')](_0x576cb8);}})[_0x2721('0x20')](function(_0x3c13b3){return{'count':_0x494714,'rows':_0x3c13b3};})['then'](respondWithResult(_0x58ba51,null))[_0x2721('0x4e')](handleError(_0x58ba51,null));};exports[_0x2721('0xdb')]=function(_0x42c6a3,_0x4126a0){var _0x221c7f={};var _0x3c04e6={};var _0x129c59;var _0x1d27a2;return db[_0x2721('0x32')]['findOne']({'where':{'id':_0x42c6a3['params']['id']}})['then'](handleEntityNotFound(_0x4126a0,null))['then'](function(_0x3c0c81){if(_0x3c0c81){_0x129c59=_0x3c0c81;_0x3c04e6[_0x2721('0xce')]=_[_0x2721('0xcf')](db['UserVoiceQueueRt'][_0x2721('0x33')]);_0x3c04e6[_0x2721('0x3d')]=_[_0x2721('0xcf')](_0x42c6a3['query']);_0x3c04e6[_0x2721('0xd0')]=_['intersection'](_0x3c04e6['model'],_0x3c04e6[_0x2721('0x3d')]);_0x221c7f['attributes']=_[_0x2721('0xd1')](_0x3c04e6['model'],qs[_0x2721('0xd2')](_0x42c6a3['query']['fields']));_0x221c7f[_0x2721('0x43')]=_0x221c7f[_0x2721('0x43')][_0x2721('0x63')]?_0x221c7f[_0x2721('0x43')]:_0x3c04e6['model'];_0x221c7f['order']=qs[_0x2721('0xd3')](_0x42c6a3[_0x2721('0x3d')][_0x2721('0xd3')]);_0x221c7f['where']=qs[_0x2721('0xd0')](_[_0x2721('0xd4')](_0x42c6a3[_0x2721('0x3d')],_0x3c04e6[_0x2721('0xd0')]));if(_0x42c6a3[_0x2721('0x3d')][_0x2721('0x36')]){_0x221c7f['where']=_[_0x2721('0x50')](_0x221c7f['where'],{'$or':_[_0x2721('0x2a')](_0x221c7f[_0x2721('0x43')],function(_0x466532){var _0x1f94ab={};_0x1f94ab[_0x466532]={'$like':'%'+_0x42c6a3[_0x2721('0x3d')][_0x2721('0x36')]+'%'};return _0x1f94ab;})});}_0x221c7f=_[_0x2721('0x50')]({},_0x221c7f,_0x42c6a3['options']);return _0x129c59[_0x2721('0xdb')](_0x221c7f);}})['then'](function(_0x267951){if(_0x267951){_0x1d27a2=_0x267951[_0x2721('0x63')];if(!_0x42c6a3[_0x2721('0x3d')][_0x2721('0xc6')]('nolimit')){_0x221c7f[_0x2721('0x1b')]=qs[_0x2721('0x1b')](_0x42c6a3[_0x2721('0x3d')][_0x2721('0x1b')]);_0x221c7f[_0x2721('0x18')]=qs[_0x2721('0x18')](_0x42c6a3[_0x2721('0x3d')][_0x2721('0x18')]);}return _0x129c59[_0x2721('0xdb')](_0x221c7f);}})[_0x2721('0x20')](function(_0x242022){if(_0x242022){return _0x242022?{'count':_0x1d27a2,'rows':_0x242022}:null;}})[_0x2721('0x20')](respondWithResult(_0x4126a0,null))[_0x2721('0x4e')](handleError(_0x4126a0,null));};exports['getGroups']=function(_0x1d3920,_0x395d9c){var _0x5473b8={};var _0x1459d9={};var _0x12359;var _0x42f7e3;return db[_0x2721('0x32')]['findOne']({'where':{'id':_0x1d3920[_0x2721('0x4f')]['id']}})['then'](handleEntityNotFound(_0x395d9c,null))[_0x2721('0x20')](function(_0x21f33f){if(_0x21f33f){_0x12359=_0x21f33f;_0x1459d9[_0x2721('0xce')]=_[_0x2721('0xcf')](db['ChatGroup'][_0x2721('0x33')]);_0x1459d9[_0x2721('0x3d')]=_[_0x2721('0xcf')](_0x1d3920[_0x2721('0x3d')]);_0x1459d9[_0x2721('0xd0')]=_[_0x2721('0xd1')](_0x1459d9[_0x2721('0xce')],_0x1459d9[_0x2721('0x3d')]);_0x5473b8[_0x2721('0x43')]=_[_0x2721('0xd1')](_0x1459d9[_0x2721('0xce')],qs[_0x2721('0xd2')](_0x1d3920[_0x2721('0x3d')][_0x2721('0xd2')]));_0x5473b8['attributes']=_0x5473b8[_0x2721('0x43')][_0x2721('0x63')]?_0x5473b8[_0x2721('0x43')]:_0x1459d9[_0x2721('0xce')];_0x5473b8[_0x2721('0xdc')]=qs[_0x2721('0xd3')](_0x1d3920[_0x2721('0x3d')][_0x2721('0xd3')]);_0x5473b8[_0x2721('0xd5')]=qs[_0x2721('0xd0')](_['pick'](_0x1d3920[_0x2721('0x3d')],_0x1459d9[_0x2721('0xd0')]));if(_0x1d3920['query'][_0x2721('0x36')]){_0x5473b8[_0x2721('0xd5')]=_[_0x2721('0x50')](_0x5473b8[_0x2721('0xd5')],{'$or':_[_0x2721('0x2a')](_0x5473b8[_0x2721('0x43')],function(_0x1e589f){var _0x3ffea3={};_0x3ffea3[_0x1e589f]={'$like':'%'+_0x1d3920['query']['filter']+'%'};return _0x3ffea3;})});}_0x5473b8=_[_0x2721('0x50')]({},_0x5473b8,_0x1d3920[_0x2721('0xd6')]);return _0x12359['getGroups'](_0x5473b8);}})['then'](function(_0x5f4981){if(_0x5f4981){_0x42f7e3=_0x5f4981[_0x2721('0x63')];if(!_0x1d3920[_0x2721('0x3d')][_0x2721('0xc6')](_0x2721('0xda'))){_0x5473b8[_0x2721('0x1b')]=qs['limit'](_0x1d3920[_0x2721('0x3d')][_0x2721('0x1b')]);_0x5473b8['offset']=qs[_0x2721('0x18')](_0x1d3920[_0x2721('0x3d')][_0x2721('0x18')]);}return _0x12359[_0x2721('0xdd')](_0x5473b8);}})[_0x2721('0x20')](function(_0x4722ef){if(_0x4722ef){return _0x4722ef?{'count':_0x42f7e3,'rows':_0x4722ef}:null;}})['then'](respondWithResult(_0x395d9c,null))[_0x2721('0x4e')](handleError(_0x395d9c,null));};exports[_0x2721('0xde')]=function(_0x3382fe,_0x1146c7){var _0x2549be={'raw':!![],'where':{}};var _0x14459e={};var _0x54a590={'count':0x0,'rows':[]};return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0x3382fe[_0x2721('0x4f')]['id']}})[_0x2721('0x20')](handleEntityNotFound(_0x1146c7,null))[_0x2721('0x20')](function(_0x5cb212){if(_0x5cb212){_0x14459e[_0x2721('0xce')]=_[_0x2721('0xcf')](db['VoiceRecording'][_0x2721('0x33')]);_0x14459e['query']=_[_0x2721('0xcf')](_0x3382fe[_0x2721('0x3d')]);_0x14459e[_0x2721('0xd0')]=_[_0x2721('0xd1')](_0x14459e[_0x2721('0xce')],_0x14459e[_0x2721('0x3d')]);_0x2549be[_0x2721('0x43')]=_['intersection'](_0x14459e[_0x2721('0xce')],qs[_0x2721('0xd2')](_0x3382fe[_0x2721('0x3d')][_0x2721('0xd2')]));_0x2549be[_0x2721('0x43')]=_0x2549be['attributes']['length']?_0x2549be[_0x2721('0x43')]:_0x14459e[_0x2721('0xce')];if(!_0x3382fe['query']['hasOwnProperty']('nolimit')){_0x2549be['limit']=qs[_0x2721('0x1b')](_0x3382fe['query'][_0x2721('0x1b')]);_0x2549be['offset']=qs['offset'](_0x3382fe[_0x2721('0x3d')]['offset']);}_0x2549be['order']=qs[_0x2721('0xd3')](_0x3382fe['query']['sort']);_0x2549be[_0x2721('0xd5')]=qs[_0x2721('0xd0')](_[_0x2721('0xd4')](_0x3382fe[_0x2721('0x3d')],_0x14459e['filters']));_0x2549be[_0x2721('0xd5')][_0x2721('0xdf')]=_0x5cb212['id'];if(_0x3382fe[_0x2721('0x3d')]['filter']){_0x2549be[_0x2721('0xd5')]=_['merge'](_0x2549be['where'],{'$or':_[_0x2721('0x2a')](_0x2549be[_0x2721('0x43')],function(_0x375e60){var _0x254f23={};_0x254f23[_0x375e60]={'$like':'%'+_0x3382fe[_0x2721('0x3d')]['filter']+'%'};return _0x254f23;})});}_0x2549be=_[_0x2721('0x50')]({},_0x2549be,_0x3382fe['options']);return db[_0x2721('0xe0')]['count']({'where':_0x2549be[_0x2721('0xd5')]})['then'](function(_0x3ea8ff){_0x54a590['count']=_0x3ea8ff;if(_0x3382fe[_0x2721('0x3d')]['includeAll']){_0x2549be['include']=[{'all':!![]}];}return db[_0x2721('0xe0')][_0x2721('0x45')](_0x2549be);})[_0x2721('0x20')](function(_0x269251){_0x54a590[_0x2721('0x47')]=_0x269251;return _0x54a590;});}})[_0x2721('0x20')](respondWithFilteredResult(_0x1146c7,_0x2549be))[_0x2721('0x4e')](handleError(_0x1146c7,null));};exports[_0x2721('0xe1')]=function(_0x4e39c5,_0x2fdbba){var _0x5db000={'raw':!![],'where':{}};var _0x2e991e={};var _0x387531={'count':0x0,'rows':[]};return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0x4e39c5['params']['id']}})[_0x2721('0x20')](handleEntityNotFound(_0x2fdbba,null))[_0x2721('0x20')](function(_0x529664){if(_0x529664){_0x2e991e['model']=_[_0x2721('0xcf')](db[_0x2721('0xe2')][_0x2721('0x33')]);_0x2e991e[_0x2721('0x3d')]=_['keys'](_0x4e39c5[_0x2721('0x3d')]);_0x2e991e['filters']=_[_0x2721('0xd1')](_0x2e991e['model'],_0x2e991e[_0x2721('0x3d')]);_0x5db000['attributes']=_[_0x2721('0xd1')](_0x2e991e[_0x2721('0xce')],qs[_0x2721('0xd2')](_0x4e39c5[_0x2721('0x3d')][_0x2721('0xd2')]));_0x5db000['attributes']=_0x5db000['attributes'][_0x2721('0x63')]?_0x5db000[_0x2721('0x43')]:_0x2e991e[_0x2721('0xce')];if(!_0x4e39c5[_0x2721('0x3d')][_0x2721('0xc6')](_0x2721('0xda'))){_0x5db000[_0x2721('0x1b')]=qs[_0x2721('0x1b')](_0x4e39c5[_0x2721('0x3d')]['limit']);_0x5db000[_0x2721('0x18')]=qs[_0x2721('0x18')](_0x4e39c5['query'][_0x2721('0x18')]);}_0x5db000[_0x2721('0xdc')]=qs['sort'](_0x4e39c5['query'][_0x2721('0xd3')]);_0x5db000['where']=qs[_0x2721('0xd0')](_[_0x2721('0xd4')](_0x4e39c5[_0x2721('0x3d')],_0x2e991e['filters']));_0x5db000['where'][_0x2721('0xdf')]=_0x529664['id'];if(_0x4e39c5[_0x2721('0x3d')]['filter']){_0x5db000[_0x2721('0xd5')]=_[_0x2721('0x50')](_0x5db000[_0x2721('0xd5')],{'$or':_[_0x2721('0x2a')](_0x5db000[_0x2721('0x43')],function(_0x334ba0){var _0x27ff7c={};_0x27ff7c[_0x334ba0]={'$like':'%'+_0x4e39c5[_0x2721('0x3d')][_0x2721('0x36')]+'%'};return _0x27ff7c;})});}_0x5db000=_['merge']({},_0x5db000,_0x4e39c5[_0x2721('0xd6')]);return db[_0x2721('0xe2')][_0x2721('0x1a')]({'where':_0x5db000['where']})['then'](function(_0x34e803){_0x387531['count']=_0x34e803;if(_0x4e39c5[_0x2721('0x3d')]['includeAll']){_0x5db000[_0x2721('0x3f')]=[{'all':!![]}];}return db[_0x2721('0xe2')][_0x2721('0x45')](_0x5db000);})[_0x2721('0x20')](function(_0x962ee3){_0x387531[_0x2721('0x47')]=_0x962ee3;return _0x387531;});}})[_0x2721('0x20')](respondWithFilteredResult(_0x2fdbba,_0x5db000))[_0x2721('0x4e')](handleError(_0x2fdbba,null));};exports[_0x2721('0xe3')]=function(_0xda577f,_0x30e4cf){var _0x3e5f67={};var _0x1aeba2={};var _0x2c73ba;var _0x20b25c;return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0xda577f[_0x2721('0x4f')]['id']}})['then'](handleEntityNotFound(_0x30e4cf,null))[_0x2721('0x20')](function(_0x470070){if(_0x470070){_0x2c73ba=_0x470070;_0x1aeba2[_0x2721('0xce')]=_[_0x2721('0xcf')](db['ChatInteraction'][_0x2721('0x33')]);_0x1aeba2[_0x2721('0x3d')]=_[_0x2721('0xcf')](_0xda577f['query']);_0x1aeba2[_0x2721('0xd0')]=_[_0x2721('0xd1')](_0x1aeba2[_0x2721('0xce')],_0x1aeba2['query']);_0x3e5f67[_0x2721('0x43')]=_[_0x2721('0xd1')](_0x1aeba2['model'],qs[_0x2721('0xd2')](_0xda577f[_0x2721('0x3d')][_0x2721('0xd2')]));_0x3e5f67[_0x2721('0x43')]=_0x3e5f67[_0x2721('0x43')][_0x2721('0x63')]?_0x3e5f67[_0x2721('0x43')]:_0x1aeba2[_0x2721('0xce')];_0x3e5f67[_0x2721('0xdc')]=qs[_0x2721('0xd3')](_0xda577f[_0x2721('0x3d')]['sort']);_0x3e5f67[_0x2721('0xd5')]=qs[_0x2721('0xd0')](_[_0x2721('0xd4')](_0xda577f['query'],_0x1aeba2[_0x2721('0xd0')]));if(_0xda577f[_0x2721('0x3d')][_0x2721('0x36')]){_0x3e5f67[_0x2721('0xd5')]=_[_0x2721('0x50')](_0x3e5f67[_0x2721('0xd5')],{'$or':_[_0x2721('0x2a')](_0x3e5f67[_0x2721('0x43')],function(_0x4da702){var _0x354908={};_0x354908[_0x4da702]={'$like':'%'+_0xda577f[_0x2721('0x3d')]['filter']+'%'};return _0x354908;})});}_0x3e5f67=_[_0x2721('0x50')]({},_0x3e5f67,_0xda577f[_0x2721('0xd6')]);return _0x2c73ba['getChatInteractions'](_0x3e5f67);}})[_0x2721('0x20')](function(_0x109da8){if(_0x109da8){_0x20b25c=_0x109da8[_0x2721('0x63')];if(!_0xda577f[_0x2721('0x3d')][_0x2721('0xc6')](_0x2721('0xda'))){_0x3e5f67['limit']=qs['limit'](_0xda577f['query'][_0x2721('0x1b')]);_0x3e5f67[_0x2721('0x18')]=qs[_0x2721('0x18')](_0xda577f[_0x2721('0x3d')]['offset']);}return _0x2c73ba[_0x2721('0xe3')](_0x3e5f67);}})['then'](function(_0x866ada){if(_0x866ada){return _0x866ada?{'count':_0x20b25c,'rows':_0x866ada}:null;}})['then'](respondWithResult(_0x30e4cf,null))[_0x2721('0x4e')](handleError(_0x30e4cf,null));};exports[_0x2721('0xe4')]=function(_0x114821,_0x30e179){var _0x14c135={};var _0x4b7ca6={};var _0x3deae8;var _0x5e33fe;return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0x114821[_0x2721('0x4f')]['id']}})[_0x2721('0x20')](handleEntityNotFound(_0x30e179,null))[_0x2721('0x20')](function(_0x52e07c){if(_0x52e07c){_0x3deae8=_0x52e07c;_0x4b7ca6['model']=_[_0x2721('0xcf')](db['OpenchannelInteraction'][_0x2721('0x33')]);_0x4b7ca6[_0x2721('0x3d')]=_[_0x2721('0xcf')](_0x114821[_0x2721('0x3d')]);_0x4b7ca6[_0x2721('0xd0')]=_[_0x2721('0xd1')](_0x4b7ca6['model'],_0x4b7ca6[_0x2721('0x3d')]);_0x14c135[_0x2721('0x43')]=_[_0x2721('0xd1')](_0x4b7ca6[_0x2721('0xce')],qs[_0x2721('0xd2')](_0x114821['query'][_0x2721('0xd2')]));_0x14c135[_0x2721('0x43')]=_0x14c135[_0x2721('0x43')][_0x2721('0x63')]?_0x14c135[_0x2721('0x43')]:_0x4b7ca6['model'];_0x14c135['order']=qs[_0x2721('0xd3')](_0x114821[_0x2721('0x3d')][_0x2721('0xd3')]);_0x14c135[_0x2721('0xd5')]=qs[_0x2721('0xd0')](_[_0x2721('0xd4')](_0x114821[_0x2721('0x3d')],_0x4b7ca6[_0x2721('0xd0')]));if(_0x114821[_0x2721('0x3d')]['filter']){_0x14c135['where']=_['merge'](_0x14c135['where'],{'$or':_[_0x2721('0x2a')](_0x14c135[_0x2721('0x43')],function(_0x2a91d8){var _0x16d43f={};_0x16d43f[_0x2a91d8]={'$like':'%'+_0x114821[_0x2721('0x3d')][_0x2721('0x36')]+'%'};return _0x16d43f;})});}_0x14c135=_[_0x2721('0x50')]({},_0x14c135,_0x114821[_0x2721('0xd6')]);return _0x3deae8[_0x2721('0xe4')](_0x14c135);}})[_0x2721('0x20')](function(_0x111074){if(_0x111074){_0x5e33fe=_0x111074[_0x2721('0x63')];if(!_0x114821['query'][_0x2721('0xc6')]('nolimit')){_0x14c135[_0x2721('0x1b')]=qs[_0x2721('0x1b')](_0x114821[_0x2721('0x3d')][_0x2721('0x1b')]);_0x14c135[_0x2721('0x18')]=qs[_0x2721('0x18')](_0x114821[_0x2721('0x3d')][_0x2721('0x18')]);}return _0x3deae8['getOpenchannelInteractions'](_0x14c135);}})[_0x2721('0x20')](function(_0x4800a1){if(_0x4800a1){return _0x4800a1?{'count':_0x5e33fe,'rows':_0x4800a1}:null;}})['then'](respondWithResult(_0x30e179,null))['catch'](handleError(_0x30e179,null));};exports[_0x2721('0xe5')]=function(_0x3d2e80,_0x547ab0){var _0x3cb91c={'raw':!![],'where':{}};var _0x173d84={};var _0x1ea0bc={'count':0x0,'rows':[]};return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0x3d2e80[_0x2721('0x4f')]['id']}})[_0x2721('0x20')](handleEntityNotFound(_0x547ab0,null))[_0x2721('0x20')](function(_0x539a71){if(_0x539a71){_0x173d84[_0x2721('0xce')]=_['keys'](db['MailInteraction'][_0x2721('0x33')]);_0x173d84['query']=_[_0x2721('0xcf')](_0x3d2e80['query']);_0x173d84[_0x2721('0xd0')]=_['intersection'](_0x173d84[_0x2721('0xce')],_0x173d84['query']);_0x3cb91c[_0x2721('0x43')]=_['intersection'](_0x173d84[_0x2721('0xce')],qs[_0x2721('0xd2')](_0x3d2e80[_0x2721('0x3d')][_0x2721('0xd2')]));_0x3cb91c[_0x2721('0x43')]=_0x3cb91c['attributes'][_0x2721('0x63')]?_0x3cb91c[_0x2721('0x43')]:_0x173d84[_0x2721('0xce')];if(!_0x3d2e80['query'][_0x2721('0xc6')](_0x2721('0xda'))){_0x3cb91c[_0x2721('0x1b')]=qs[_0x2721('0x1b')](_0x3d2e80['query'][_0x2721('0x1b')]);_0x3cb91c[_0x2721('0x18')]=qs[_0x2721('0x18')](_0x3d2e80[_0x2721('0x3d')][_0x2721('0x18')]);}_0x3cb91c[_0x2721('0xdc')]=qs['sort'](_0x3d2e80[_0x2721('0x3d')][_0x2721('0xd3')]);_0x3cb91c[_0x2721('0xd5')]=qs[_0x2721('0xd0')](_[_0x2721('0xd4')](_0x3d2e80[_0x2721('0x3d')],_0x173d84['filters']));_0x3cb91c[_0x2721('0xd5')][_0x2721('0xdf')]=_0x539a71['id'];if(_0x3d2e80[_0x2721('0x3d')][_0x2721('0x36')]){_0x3cb91c[_0x2721('0xd5')]=_[_0x2721('0x50')](_0x3cb91c['where'],{'$or':_[_0x2721('0x2a')](_0x3cb91c[_0x2721('0x43')],function(_0x1bfd98){var _0x12b60d={};_0x12b60d[_0x1bfd98]={'$like':'%'+_0x3d2e80['query']['filter']+'%'};return _0x12b60d;})});}_0x3cb91c=_[_0x2721('0x50')]({},_0x3cb91c,_0x3d2e80[_0x2721('0xd6')]);return db[_0x2721('0xe6')]['count']({'where':_0x3cb91c[_0x2721('0xd5')]})[_0x2721('0x20')](function(_0x2cb65b){_0x1ea0bc[_0x2721('0x1a')]=_0x2cb65b;if(_0x3d2e80['query'][_0x2721('0x3e')]){_0x3cb91c[_0x2721('0x3f')]=[{'all':!![]}];}return db[_0x2721('0xe6')][_0x2721('0x45')](_0x3cb91c);})[_0x2721('0x20')](function(_0x3e3f86){_0x1ea0bc['rows']=_0x3e3f86;return _0x1ea0bc;});}})['then'](respondWithFilteredResult(_0x547ab0,_0x3cb91c))[_0x2721('0x4e')](handleError(_0x547ab0,null));};exports[_0x2721('0xe7')]=function(_0x9a2b4d,_0x5e5996){var _0x3295c7={};var _0x276867={};var _0x47548b;var _0x9a4783;return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0x9a2b4d[_0x2721('0x4f')]['id']}})[_0x2721('0x20')](handleEntityNotFound(_0x5e5996,null))['then'](function(_0x92b0e5){if(_0x92b0e5){_0x47548b=_0x92b0e5;_0x276867[_0x2721('0xce')]=_[_0x2721('0xcf')](db[_0x2721('0xe8')]['rawAttributes']);_0x276867[_0x2721('0x3d')]=_[_0x2721('0xcf')](_0x9a2b4d['query']);_0x276867[_0x2721('0xd0')]=_[_0x2721('0xd1')](_0x276867[_0x2721('0xce')],_0x276867[_0x2721('0x3d')]);_0x3295c7['attributes']=_[_0x2721('0xd1')](_0x276867[_0x2721('0xce')],qs[_0x2721('0xd2')](_0x9a2b4d[_0x2721('0x3d')][_0x2721('0xd2')]));_0x3295c7['attributes']=_0x3295c7['attributes'][_0x2721('0x63')]?_0x3295c7[_0x2721('0x43')]:_0x276867['model'];_0x3295c7[_0x2721('0xdc')]=qs[_0x2721('0xd3')](_0x9a2b4d[_0x2721('0x3d')]['sort']);_0x3295c7[_0x2721('0xd5')]=qs[_0x2721('0xd0')](_['pick'](_0x9a2b4d[_0x2721('0x3d')],_0x276867[_0x2721('0xd0')]));if(_0x9a2b4d['query'][_0x2721('0x36')]){_0x3295c7[_0x2721('0xd5')]=_[_0x2721('0x50')](_0x3295c7[_0x2721('0xd5')],{'$or':_[_0x2721('0x2a')](_0x3295c7[_0x2721('0x43')],function(_0x3c3708){var _0x13f964={};_0x13f964[_0x3c3708]={'$like':'%'+_0x9a2b4d[_0x2721('0x3d')][_0x2721('0x36')]+'%'};return _0x13f964;})});}_0x3295c7=_[_0x2721('0x50')]({},_0x3295c7,_0x9a2b4d[_0x2721('0xd6')]);return _0x47548b['getSmsInteractions'](_0x3295c7);}})['then'](function(_0x511f57){if(_0x511f57){_0x9a4783=_0x511f57[_0x2721('0x63')];if(!_0x9a2b4d[_0x2721('0x3d')][_0x2721('0xc6')](_0x2721('0xda'))){_0x3295c7[_0x2721('0x1b')]=qs[_0x2721('0x1b')](_0x9a2b4d[_0x2721('0x3d')]['limit']);_0x3295c7[_0x2721('0x18')]=qs[_0x2721('0x18')](_0x9a2b4d[_0x2721('0x3d')][_0x2721('0x18')]);}return _0x47548b[_0x2721('0xe7')](_0x3295c7);}})['then'](function(_0xa7ddab){if(_0xa7ddab){return _0xa7ddab?{'count':_0x9a4783,'rows':_0xa7ddab}:null;}})[_0x2721('0x20')](respondWithResult(_0x5e5996,null))[_0x2721('0x4e')](handleError(_0x5e5996,null));};exports[_0x2721('0xe9')]=function(_0x54d7c6,_0x12bfaa){var _0x1275da={};var _0x5c7091={};var _0x996360;var _0x361aca;return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0x54d7c6[_0x2721('0x4f')]['id']}})[_0x2721('0x20')](handleEntityNotFound(_0x12bfaa,null))[_0x2721('0x20')](function(_0x51e82e){if(_0x51e82e){_0x996360=_0x51e82e;_0x5c7091['model']=_[_0x2721('0xcf')](db['FaxInteraction'][_0x2721('0x33')]);_0x5c7091['query']=_[_0x2721('0xcf')](_0x54d7c6[_0x2721('0x3d')]);_0x5c7091[_0x2721('0xd0')]=_['intersection'](_0x5c7091[_0x2721('0xce')],_0x5c7091['query']);_0x1275da['attributes']=_['intersection'](_0x5c7091[_0x2721('0xce')],qs[_0x2721('0xd2')](_0x54d7c6['query'][_0x2721('0xd2')]));_0x1275da[_0x2721('0x43')]=_0x1275da[_0x2721('0x43')][_0x2721('0x63')]?_0x1275da[_0x2721('0x43')]:_0x5c7091[_0x2721('0xce')];_0x1275da[_0x2721('0xdc')]=qs[_0x2721('0xd3')](_0x54d7c6['query'][_0x2721('0xd3')]);_0x1275da[_0x2721('0xd5')]=qs['filters'](_['pick'](_0x54d7c6[_0x2721('0x3d')],_0x5c7091[_0x2721('0xd0')]));if(_0x54d7c6[_0x2721('0x3d')]['filter']){_0x1275da[_0x2721('0xd5')]=_[_0x2721('0x50')](_0x1275da[_0x2721('0xd5')],{'$or':_[_0x2721('0x2a')](_0x1275da[_0x2721('0x43')],function(_0x1e0c13){var _0x4af21d={};_0x4af21d[_0x1e0c13]={'$like':'%'+_0x54d7c6[_0x2721('0x3d')][_0x2721('0x36')]+'%'};return _0x4af21d;})});}_0x1275da=_[_0x2721('0x50')]({},_0x1275da,_0x54d7c6[_0x2721('0xd6')]);return _0x996360[_0x2721('0xe9')](_0x1275da);}})[_0x2721('0x20')](function(_0x451a2d){if(_0x451a2d){_0x361aca=_0x451a2d['length'];if(!_0x54d7c6[_0x2721('0x3d')]['hasOwnProperty'](_0x2721('0xda'))){_0x1275da[_0x2721('0x1b')]=qs[_0x2721('0x1b')](_0x54d7c6[_0x2721('0x3d')][_0x2721('0x1b')]);_0x1275da[_0x2721('0x18')]=qs['offset'](_0x54d7c6[_0x2721('0x3d')][_0x2721('0x18')]);}return _0x996360[_0x2721('0xe9')](_0x1275da);}})[_0x2721('0x20')](function(_0x4db2da){if(_0x4db2da){return _0x4db2da?{'count':_0x361aca,'rows':_0x4db2da}:null;}})[_0x2721('0x20')](respondWithResult(_0x12bfaa,null))[_0x2721('0x4e')](handleError(_0x12bfaa,null));};exports['getWhatsappInteractions']=function(_0x420a04,_0xe14a55){var _0x522c7b={};var _0x13cda6={};var _0x551f83;var _0x431dd5;return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0x420a04[_0x2721('0x4f')]['id']}})['then'](handleEntityNotFound(_0xe14a55,null))[_0x2721('0x20')](function(_0x45affa){if(_0x45affa){_0x551f83=_0x45affa;_0x13cda6[_0x2721('0xce')]=_[_0x2721('0xcf')](db[_0x2721('0xea')][_0x2721('0x33')]);_0x13cda6[_0x2721('0x3d')]=_[_0x2721('0xcf')](_0x420a04['query']);_0x13cda6['filters']=_[_0x2721('0xd1')](_0x13cda6[_0x2721('0xce')],_0x13cda6['query']);_0x522c7b[_0x2721('0x43')]=_['intersection'](_0x13cda6[_0x2721('0xce')],qs[_0x2721('0xd2')](_0x420a04[_0x2721('0x3d')]['fields']));_0x522c7b[_0x2721('0x43')]=_0x522c7b[_0x2721('0x43')][_0x2721('0x63')]?_0x522c7b[_0x2721('0x43')]:_0x13cda6['model'];_0x522c7b['order']=qs['sort'](_0x420a04[_0x2721('0x3d')][_0x2721('0xd3')]);_0x522c7b['where']=qs[_0x2721('0xd0')](_[_0x2721('0xd4')](_0x420a04[_0x2721('0x3d')],_0x13cda6[_0x2721('0xd0')]));if(_0x420a04[_0x2721('0x3d')][_0x2721('0x36')]){_0x522c7b[_0x2721('0xd5')]=_[_0x2721('0x50')](_0x522c7b[_0x2721('0xd5')],{'$or':_['map'](_0x522c7b[_0x2721('0x43')],function(_0x57502d){var _0x197d3f={};_0x197d3f[_0x57502d]={'$like':'%'+_0x420a04['query'][_0x2721('0x36')]+'%'};return _0x197d3f;})});}_0x522c7b=_[_0x2721('0x50')]({},_0x522c7b,_0x420a04['options']);return _0x551f83[_0x2721('0xeb')](_0x522c7b);}})[_0x2721('0x20')](function(_0x26c131){if(_0x26c131){_0x431dd5=_0x26c131[_0x2721('0x63')];if(!_0x420a04[_0x2721('0x3d')][_0x2721('0xc6')](_0x2721('0xda'))){_0x522c7b['limit']=qs['limit'](_0x420a04['query'][_0x2721('0x1b')]);_0x522c7b[_0x2721('0x18')]=qs[_0x2721('0x18')](_0x420a04['query'][_0x2721('0x18')]);}return _0x551f83[_0x2721('0xeb')](_0x522c7b);}})['then'](function(_0x55ab77){if(_0x55ab77){return _0x55ab77?{'count':_0x431dd5,'rows':_0x55ab77}:null;}})[_0x2721('0x20')](respondWithResult(_0xe14a55,null))[_0x2721('0x4e')](handleError(_0xe14a55,null));};exports[_0x2721('0xec')]=function(_0x83ec22,_0x548f13,_0x313965){var _0x5d4a4d;var _0xa53f22;var _0x5ce4e0;var _0x221df7=!_['isNil'](_0x83ec22[_0x2721('0x4f')]['id'])?_0x83ec22['params']['id']:!_[_0x2721('0x5d')](_0x83ec22[_0x2721('0x78')]['id'])?_0x83ec22[_0x2721('0x78')]['id']:null;return db[_0x2721('0x32')][_0x2721('0x2d')]({'where':{'id':_0x221df7,'role':{'$or':[_0x2721('0x25'),_0x2721('0x78'),'agent']}},'attributes':['id',_0x2721('0x30'),'phone',_0x2721('0xed'),_0x2721('0x21'),_0x2721('0x58'),'loginInPause']})['then'](function(_0x48a282){if(_0x48a282){if(_0x48a282[_0x2721('0x21')]===_0x2721('0x28')){_0x5d4a4d=_0x48a282;if(_0x83ec22['body']['interface']){_0x5ce4e0=util[_0x2721('0xa7')](_0x2721('0xee'),_0x5d4a4d[_0x83ec22[_0x2721('0x53')][_0x2721('0x9b')]]);}else if(_0x83ec22[_0x2721('0x53')]['intrf']){_0x5ce4e0=util[_0x2721('0xa7')](_0x2721('0xa8'),_0x83ec22['body']['intrf']);}else{_0x5ce4e0=util[_0x2721('0xa7')](_0x2721('0xa8'),_0x5d4a4d['name']);}socket['to'](util[_0x2721('0xa7')](_0x2721('0xef'),_0x5d4a4d[_0x2721('0x30')]))['emit'](_0x2721('0xf0'),{'user':{'id':_0x5d4a4d['id'],'name':_0x5d4a4d['name']},'ip':_0x83ec22[_0x2721('0xf1')][_0x2721('0xf2')]||_0x83ec22[_0x2721('0xf3')]['remoteAddress']||_0x83ec22[_0x2721('0xf4')][_0x2721('0xf5')]||_0x83ec22[_0x2721('0xf3')]['socket'][_0x2721('0xf5')]});return db[_0x2721('0xa9')]['destroy']({'where':{'membername':_0x5d4a4d[_0x2721('0x30')]},'individualHooks':!![]});}}else{throw new db[(_0x2721('0x8a'))]['ValidationError'](_0x2721('0xf6'));}})[_0x2721('0x20')](function(){if(_0x5d4a4d){return _0x5d4a4d[_0x2721('0xf7')]({'raw':!![]});}})['then'](function(_0x341cee){if(_0x5d4a4d){if(_0x341cee){_0xa53f22=_0x341cee;if(_0xa53f22[_0x2721('0x63')]){var _0x39416d=_0xa53f22[_0x2721('0x2a')](function(_0x178dc5){var _0x2168ac={'membername':_0x5d4a4d[_0x2721('0x30')],'UserId':_0x5d4a4d['id'],'queue_name':_0x178dc5[_0x2721('0x30')],'VoiceQueueId':_0x178dc5['id'],'interface':_0x5ce4e0,'paused':_0x5d4a4d[_0x2721('0xf8')]||![],'penalty':_0x178dc5[_0x2721('0xf9')]||0x0};return db[_0x2721('0xa9')][_0x2721('0xaa')](_0x2168ac);});return Promise['all'](_0x39416d);}}}})[_0x2721('0x20')](function(){if(_0x5d4a4d){return db[_0x2721('0xfa')][_0x2721('0x45')]({'where':{'membername':_0x5d4a4d[_0x2721('0x30')],'exitAt':null}});}})[_0x2721('0x20')](function(_0x406fa8){if(_0x5d4a4d){var _0xc41a56=[];_0x406fa8[_0x2721('0xfb')](function(_0xfb65c1){_0xc41a56[_0x2721('0x44')](_0xfb65c1[_0x2721('0x1f')]({'exitAt':moment()[_0x2721('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x2721('0x4d')](_0xc41a56);}})[_0x2721('0x20')](function(){if(_0x5d4a4d){var _0x1eb13b=[];var _0x4e551b=[];var _0x2e5fa0=utils[_0x2721('0xfc')]();var _0x51f93a={'membername':_0x5d4a4d[_0x2721('0x30')],'interface':_0x5ce4e0,'enterAt':moment()['format'](_0x2721('0xfd')),'role':_0x5d4a4d[_0x2721('0x21')],'internal':_0x5d4a4d[_0x2721('0x58')]};_0x2e5fa0[_0x2721('0xfb')](function(_0x5723f9){_0x1eb13b[_0x2721('0x44')](_[_0x2721('0x50')]({'channel':_0x5723f9,'type':_0x2721('0xfe'),'data1':_0x83ec22[_0x2721('0x53')]['device'],'data2':_0x5ce4e0},_0x51f93a));if(_0x5d4a4d[_0x2721('0xf8')]){_0x4e551b[_0x2721('0x44')](_[_0x2721('0x50')]({'channel':_0x5723f9,'type':_0x2721('0xff'),'data1':_0x2721('0x100')},_0x51f93a));}});return db[_0x2721('0xfa')][_0x2721('0x83')](_0x1eb13b[_0x2721('0xc3')](_0x4e551b),{'individualHooks':!![]});}})[_0x2721('0x20')](function(){if(_0x5d4a4d){return _0x5d4a4d['update']({'online':!![],'lastLoginAt':moment()[_0x2721('0xa7')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5d4a4d[_0x2721('0xf8')]||![],'mailPause':_0x5d4a4d[_0x2721('0xf8')]||![],'chatPause':_0x5d4a4d[_0x2721('0xf8')]||![],'faxPause':_0x5d4a4d['loginInPause']||![],'smsPause':_0x5d4a4d[_0x2721('0xf8')]||![],'openchannelPause':_0x5d4a4d[_0x2721('0xf8')]||![],'whatsappPause':_0x5d4a4d['loginInPause']||![],'pauseType':_0x5d4a4d[_0x2721('0xf8')]?_0x2721('0x100'):null,'interface':_0x5ce4e0,'lastPauseAt':moment()['format'](_0x2721('0xfd'))});}})[_0x2721('0x20')](function(_0x207142){if(_0x83ec22[_0x2721('0x101')]){return _0x313965();}else{return Promise[_0x2721('0x102')](_0x207142)[_0x2721('0x20')](respondWithResult(_0x548f13,null));}})[_0x2721('0x4e')](handleError(_0x548f13,null));};exports[_0x2721('0x103')]=function(_0x3c08c2,_0x235e72){var _0x427f86;return db[_0x2721('0x32')][_0x2721('0x2d')]({'where':{'id':_0x3c08c2[_0x2721('0x4f')]['id'],'role':_0x2721('0x28')},'attributes':['id','name',_0x2721('0x21')]})[_0x2721('0x20')](handleEntityNotFound(_0x235e72,null))[_0x2721('0x20')](function(_0x2ae10e){if(_0x2ae10e){_0x427f86=_0x2ae10e;return db[_0x2721('0xa9')][_0x2721('0x104')]({'where':{'membername':_0x427f86[_0x2721('0x30')]},'individualHooks':!![]});}})[_0x2721('0x20')](function(){return db[_0x2721('0xfa')][_0x2721('0x45')]({'where':{'membername':_0x427f86[_0x2721('0x30')],'exitAt':null}});})[_0x2721('0x20')](function(_0x45f049){var _0x214d85=[];_0x45f049[_0x2721('0xfb')](function(_0x136ebe){_0x214d85[_0x2721('0x44')](_0x136ebe[_0x2721('0x1f')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x2721('0x4d')](_0x214d85);})['then'](function(){return _0x427f86[_0x2721('0x1f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2721('0x20')](respondWithResult(_0x235e72,null))[_0x2721('0x4e')](handleError(_0x235e72,null));};exports[_0x2721('0x105')]=function(_0x5a77b4,_0x345b17){var _0x549b48;return db[_0x2721('0xa9')][_0x2721('0x1f')]({'paused':0x1},{'where':{'UserId':_0x5a77b4[_0x2721('0x4f')]['id']},'individualHooks':!![]})[_0x2721('0x20')](function(){return db[_0x2721('0x32')][_0x2721('0x2d')]({'where':{'id':_0x5a77b4[_0x2721('0x4f')]['id'],'role':'agent'},'attributes':['id',_0x2721('0x30'),_0x2721('0x21'),'internal',_0x2721('0x9b'),_0x2721('0x99')]});})['then'](handleEntityNotFound(_0x345b17,null))[_0x2721('0x20')](function(_0x19b35b){if(_0x19b35b){_0x549b48=_0x19b35b;return db['MemberReport']['findAll']({'where':{'membername':_0x549b48[_0x2721('0x30')],'type':_0x2721('0xff'),'exitAt':null}});}})['then'](function(_0x2b183e){if(_0x2b183e['length']){var _0x2a1cb1=moment()[_0x2721('0xa7')](_0x2721('0xfd'));for(var _0x170855=0x0,_0x3ec4e3=_0x2b183e[_0x2721('0x63')];_0x170855<_0x3ec4e3;_0x170855++){_0x2b183e[_0x170855][_0x2721('0x106')]({'exitAt':_0x2a1cb1});}}})['then'](function(){var _0x4dddb2=[];var _0x107ee6=utils[_0x2721('0xfc')]();_0x107ee6[_0x2721('0xfb')](function(_0x2e863c){_0x4dddb2['push']({'channel':_0x2e863c,'membername':_0x549b48['name'],'interface':_[_0x2721('0x5d')](_0x549b48[_0x2721('0x9b')])?util[_0x2721('0xa7')](_0x2721('0xa8'),_0x549b48['name']):_0x549b48[_0x2721('0x9b')],'type':_0x2721('0xff'),'enterAt':moment()[_0x2721('0xa7')](_0x2721('0xfd')),'data1':_0x5a77b4[_0x2721('0x53')]['type']||_0x2721('0x107'),'role':_0x549b48[_0x2721('0x21')],'internal':_0x549b48[_0x2721('0x58')]});});return db[_0x2721('0xfa')][_0x2721('0x83')](_0x4dddb2,{'individualHooks':!![]});})['then'](function(){return _0x549b48['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5a77b4[_0x2721('0x53')][_0x2721('0x108')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x2721('0xfd'))});})['then'](respondWithResult(_0x345b17,null))[_0x2721('0x4e')](handleError(_0x345b17,null));};exports[_0x2721('0x109')]=function(_0xe7be0,_0x57bd51){if(_0xe7be0[_0x2721('0x53')][_0x2721('0x98')]&&!utils[_0x2721('0x9c')](_0xe7be0[_0x2721('0x53')][_0x2721('0x98')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0xe7be0[_0x2721('0x53')][_0x2721('0x98')]));}return db[_0x2721('0x32')][_0x2721('0x2d')]({'where':{'id':_0xe7be0[_0x2721('0x4f')]['id']},'attributes':['id',_0x2721('0x30'),_0x2721('0x21'),_0x2721('0x58'),_0x2721('0x9b'),_0x2721('0x99'),'voicePause','mailPause',_0x2721('0x10a'),'faxPause',_0x2721('0x10b'),_0x2721('0x10c'),'whatsappPause',_0x2721('0x10d'),_0x2721('0x10e')]})[_0x2721('0x20')](function(_0x59366f){if(!_0x59366f){throw new APINotFoundError(util['format'](_0x2721('0xc5'),_0xe7be0['params']['id']));}return _0x59366f['unpause'](_0xe7be0[_0x2721('0x53')][_0x2721('0x98')]);})['then'](respondWithResult(_0x57bd51,null))[_0x2721('0x4e')](APIHandleError(_0x57bd51));};exports['getTeams']=function(_0x37d9ab,_0x24fcd8){var _0x57844b={};var _0xce5266={};var _0x5600f7;var _0x1ac42f;return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0x37d9ab['params']['id']}})[_0x2721('0x20')](handleEntityNotFound(_0x24fcd8,null))[_0x2721('0x20')](function(_0x2aa554){if(_0x2aa554){_0x5600f7=_0x2aa554;_0xce5266[_0x2721('0xce')]=_[_0x2721('0xcf')](db['Team'][_0x2721('0x33')]);_0xce5266[_0x2721('0x3d')]=_[_0x2721('0xcf')](_0x37d9ab['query']);_0xce5266['filters']=_[_0x2721('0xd1')](_0xce5266[_0x2721('0xce')],_0xce5266[_0x2721('0x3d')]);_0x57844b['attributes']=_[_0x2721('0xd1')](_0xce5266[_0x2721('0xce')],qs['fields'](_0x37d9ab[_0x2721('0x3d')][_0x2721('0xd2')]));_0x57844b[_0x2721('0x43')]=_0x57844b[_0x2721('0x43')]['length']?_0x57844b[_0x2721('0x43')]:_0xce5266['model'];_0x57844b[_0x2721('0xdc')]=qs['sort'](_0x37d9ab[_0x2721('0x3d')][_0x2721('0xd3')]);_0x57844b[_0x2721('0xd5')]=qs[_0x2721('0xd0')](_['pick'](_0x37d9ab['query'],_0xce5266[_0x2721('0xd0')]));if(_0x37d9ab['query'][_0x2721('0x36')]){_0x57844b[_0x2721('0xd5')]=_[_0x2721('0x50')](_0x57844b[_0x2721('0xd5')],{'$or':_[_0x2721('0x2a')](_0x57844b[_0x2721('0x43')],function(_0x47537e){var _0x1d9766={};_0x1d9766[_0x47537e]={'$like':'%'+_0x37d9ab[_0x2721('0x3d')][_0x2721('0x36')]+'%'};return _0x1d9766;})});}_0x57844b=_[_0x2721('0x50')]({},_0x57844b,_0x37d9ab[_0x2721('0xd6')]);return _0x5600f7[_0x2721('0x10f')](_0x57844b);}})[_0x2721('0x20')](function(_0x3cdbd4){if(_0x3cdbd4){_0x1ac42f=_0x3cdbd4[_0x2721('0x63')];if(!_0x37d9ab['query']['hasOwnProperty'](_0x2721('0xda'))){_0x57844b[_0x2721('0x1b')]=qs[_0x2721('0x1b')](_0x37d9ab[_0x2721('0x3d')][_0x2721('0x1b')]);_0x57844b[_0x2721('0x18')]=qs['offset'](_0x37d9ab['query'][_0x2721('0x18')]);}return _0x5600f7[_0x2721('0x10f')](_0x57844b);}})['then'](function(_0x314b22){if(_0x314b22){return _0x314b22?{'count':_0x1ac42f,'rows':_0x314b22}:null;}})[_0x2721('0x20')](respondWithResult(_0x24fcd8,null))['catch'](handleError(_0x24fcd8,null));};exports[_0x2721('0x110')]=function(_0x4145e1,_0x562a15){var _0x2ac9ee=_0x4145e1[_0x2721('0x4f')]['id'];var _0x441ebd=_0x4145e1[_0x2721('0x53')]?_0x4145e1[_0x2721('0x53')][_0x2721('0x56')]:null;var _0x5395fa=[];return Promise[_0x2721('0x102')]()['then'](function(){if(!_0x441ebd)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x2721('0x20')](function(){return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0x2ac9ee}});})[_0x2721('0x20')](function(_0x5b1a68){if(!_0x5b1a68)throw new APINotFoundError(util[_0x2721('0xa7')](_0x2721('0xc5'),_0x4145e1[_0x2721('0x4f')]['id']));return db[_0x2721('0x5f')][_0x2721('0x111')](function(_0x42feec){return _0x5b1a68['addTeams'](_0x441ebd,{'transaction':_0x42feec})[_0x2721('0x20')](function(){return db[_0x2721('0x112')][_0x2721('0x45')]({'where':{'id':{'$in':_0x441ebd}}});})[_0x2721('0x20')](function(_0xffc69e){var _0x3f0e34=_['map'](_0xffc69e,function(_0x5a6c0a){return _0x5a6c0a[_0x2721('0x113')]();});return Promise[_0x2721('0x4d')](_0x3f0e34);})[_0x2721('0x20')](function(_0x532115){_0x5395fa=_[_0x2721('0x114')](_0x532115);var _0x4473f2=_[_0x2721('0x2a')](_0x5395fa,function(_0x2ff95d){return _0x2ff95d[_0x2721('0x115')](_0x5b1a68['id'],{'transaction':_0x42feec});});return Promise['all'](_0x4473f2);})[_0x2721('0x20')](function(){if(!_0x5b1a68[_0x2721('0x99')])return;var _0x25bfa9=_['filter'](_0x5395fa,function(_0x298be6){return _0x298be6[_0x2721('0x116')](_0x2721('0x98'))===_0x2721('0x117');});var _0x397c3e=_[_0x2721('0x2a')](_0x25bfa9,function(_0x632941){return db[_0x2721('0xa9')]['upsert']({'membername':_0x5b1a68[_0x2721('0x30')],'UserId':_0x5b1a68['id'],'queue_name':_0x632941[_0x2721('0x30')],'VoiceQueueId':_0x632941['id'],'interface':_[_0x2721('0x5d')](_0x5b1a68[_0x2721('0x9b')])?util['format']('SIP/%s',_0x5b1a68['name']):_0x5b1a68[_0x2721('0x9b')],'paused':_0x5b1a68['voicePause']||![],'penalty':_0x5b1a68[_0x2721('0xa1')]},{'transaction':_0x42feec});});return Promise[_0x2721('0x4d')](_0x397c3e);})[_0x2721('0x20')](function(){return db[_0x2721('0x118')][_0x2721('0x45')]({'where':{'teamId':{'$in':_0x441ebd}}});})['then'](function(_0x284607){var _0x48396d=_[_0x2721('0x2a')](_0x284607,function(_0x2f0cb4){return db[_0x2721('0x119')][_0x2721('0x77')]({'UserId':_0x5b1a68['id'],'VoicePrefixId':_0x2f0cb4[_0x2721('0x11a')]},{'transaction':_0x42feec});});return Promise[_0x2721('0x4d')](_0x48396d);});});})[_0x2721('0x20')](function(){for(var _0x3feb97=0x0;_0x3feb97<_0x5395fa[_0x2721('0x63')];_0x3feb97++){var _0x32d134=_0x5395fa[_0x3feb97]['getDataValue'](_0x2721('0x98'));var _0x3059fb=_0x32d134+_0x2721('0xa3');socket['emit'](_0x2721('0x78')+_0x32d134+_0x2721('0xa4'),{'UserId':_0x2ac9ee,['queueField']:_0x5395fa[_0x3feb97]['id']});}})[_0x2721('0x20')](respondWithStatusCode(_0x562a15,null))[_0x2721('0x4e')](APIHandleError(_0x562a15));};exports[_0x2721('0x11b')]=function(_0xe975e4,_0x2aab05){var _0x199fa7=_0xe975e4[_0x2721('0x4f')]['id'];var _0x3da200=null;if(_0xe975e4['query'][_0x2721('0x56')]){_0x3da200=_[_0x2721('0xac')](_0xe975e4[_0x2721('0x3d')][_0x2721('0x56')])?_0xe975e4[_0x2721('0x3d')]['ids']:[_0xe975e4[_0x2721('0x3d')]['ids']];}var _0x54c4f4=[];return Promise[_0x2721('0x102')]()[_0x2721('0x20')](function(){if(!_0x3da200)throw new APIBadRequestError(_0x2721('0x11c'));})['then'](function(){return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0x199fa7}});})[_0x2721('0x20')](function(_0x1f0861){if(!_0x1f0861)throw new APINotFoundError(util[_0x2721('0xa7')]('User\x20with\x20id\x20%s\x20not\x20found',_0xe975e4[_0x2721('0x4f')]['id']));return db[_0x2721('0x5f')][_0x2721('0x111')](function(_0xa93c29){return _0x1f0861['removeTeams'](_0x3da200,{'transaction':_0xa93c29})[_0x2721('0x20')](function(){return db[_0x2721('0x112')][_0x2721('0x45')]({'where':{'id':{'$in':_0x3da200}}});})['then'](function(_0x43f4b5){var _0x3d7401=_[_0x2721('0x2a')](_0x43f4b5,function(_0x5d4c04){return _0x5d4c04[_0x2721('0x113')]();});return Promise['all'](_0x3d7401);})['then'](function(_0x7125c0){_0x54c4f4=_[_0x2721('0x114')](_0x7125c0);var _0x4fb951=_[_0x2721('0x2a')](_0x54c4f4,function(_0x5d02c1){return _0x5d02c1[_0x2721('0x11d')](_0x1f0861['id'],{'transaction':_0xa93c29});});return Promise[_0x2721('0x4d')](_0x4fb951);})[_0x2721('0x20')](function(){if(!_0x1f0861['online'])return;var _0x4c064b=_['filter'](_0x54c4f4,function(_0x3c1628){return _0x3c1628[_0x2721('0x116')]('channel')===_0x2721('0x117');});var _0x4c2034=_[_0x2721('0x2a')](_0x4c064b,function(_0x1cc2f2){return db[_0x2721('0xa9')][_0x2721('0x104')]({'where':{'VoiceQueueId':_0x1cc2f2['id'],'UserId':_0x1f0861['id']},'transaction':_0xa93c29});});return Promise[_0x2721('0x4d')](_0x4c2034);})[_0x2721('0x20')](function(){return db[_0x2721('0x118')][_0x2721('0x45')]({'where':{'teamId':{'$in':_0x3da200}}});})[_0x2721('0x20')](function(_0x4660d6){var _0x40e62c=_[_0x2721('0x2a')](_0x4660d6,function(_0x1d9594){return db[_0x2721('0x119')]['destroy']({'where':{'UserId':_0x1f0861['id'],'VoicePrefixId':_0x1d9594[_0x2721('0x11a')]}},{'transaction':_0xa93c29});});return Promise[_0x2721('0x4d')](_0x40e62c);});});})[_0x2721('0x20')](function(){for(var _0x1623ec=0x0;_0x1623ec<_0x54c4f4[_0x2721('0x63')];_0x1623ec++){var _0x2b0634=_0x54c4f4[_0x1623ec]['getDataValue']('channel');var _0x251296=_0x2b0634+'QueueId';socket[_0x2721('0x22')](_0x2721('0x78')+_0x2b0634+_0x2721('0xad'),{'UserId':_0x199fa7,['queueField']:_0x54c4f4[_0x1623ec]['id']});}})['then'](respondWithStatusCode(_0x2aab05,null))[_0x2721('0x4e')](APIHandleError(_0x2aab05));};exports[_0x2721('0x11e')]=function(_0x397bee,_0x11b083){var _0x218152={};var _0x10b5f8={};var _0x42c889;var _0x56ec00;return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0x397bee[_0x2721('0x4f')]['id']}})['then'](handleEntityNotFound(_0x11b083,null))['then'](function(_0x438d6b){if(_0x438d6b){_0x42c889=_0x438d6b;_0x10b5f8['model']=_[_0x2721('0xcf')](db[_0x2721('0xc7')][_0x2721('0x33')]);_0x10b5f8[_0x2721('0x3d')]=_[_0x2721('0xcf')](_0x397bee[_0x2721('0x3d')]);_0x10b5f8[_0x2721('0xd0')]=_[_0x2721('0xd1')](_0x10b5f8[_0x2721('0xce')],_0x10b5f8[_0x2721('0x3d')]);_0x218152['attributes']=_[_0x2721('0xd1')](_0x10b5f8[_0x2721('0xce')],qs['fields'](_0x397bee[_0x2721('0x3d')][_0x2721('0xd2')]));_0x218152[_0x2721('0x43')]=_0x218152[_0x2721('0x43')]['length']?_0x218152[_0x2721('0x43')]:_0x10b5f8['model'];_0x218152[_0x2721('0xdc')]=qs[_0x2721('0xd3')](_0x397bee['query'][_0x2721('0xd3')]);_0x218152[_0x2721('0xd5')]=qs['filters'](_['pick'](_0x397bee[_0x2721('0x3d')],_0x10b5f8[_0x2721('0xd0')]));if(_0x397bee[_0x2721('0x3d')][_0x2721('0x36')]){_0x218152[_0x2721('0xd5')]=_[_0x2721('0x50')](_0x218152[_0x2721('0xd5')],{'$or':_[_0x2721('0x2a')](_0x218152['attributes'],function(_0x296a9c){var _0x53488d={};_0x53488d[_0x296a9c]={'$like':'%'+_0x397bee[_0x2721('0x3d')][_0x2721('0x36')]+'%'};return _0x53488d;})});}_0x218152=_[_0x2721('0x50')]({},_0x218152,_0x397bee[_0x2721('0xd6')]);return _0x42c889[_0x2721('0x11e')](_0x218152);}})[_0x2721('0x20')](function(_0x215395){if(_0x215395){_0x56ec00=_0x215395['length'];if(!_0x397bee[_0x2721('0x3d')][_0x2721('0xc6')]('nolimit')){_0x218152[_0x2721('0x1b')]=qs[_0x2721('0x1b')](_0x397bee[_0x2721('0x3d')][_0x2721('0x1b')]);_0x218152[_0x2721('0x18')]=qs[_0x2721('0x18')](_0x397bee[_0x2721('0x3d')][_0x2721('0x18')]);}return _0x42c889[_0x2721('0x11e')](_0x218152);}})[_0x2721('0x20')](function(_0x7b527b){if(_0x7b527b){return _0x7b527b?{'count':_0x56ec00,'rows':_0x7b527b}:null;}})[_0x2721('0x20')](respondWithResult(_0x11b083,null))[_0x2721('0x4e')](handleError(_0x11b083,null));};exports[_0x2721('0x11f')]=function(_0x1b4285,_0x1f05f0){var _0x30f16f={};var _0x5f306b={};var _0x316472;return db[_0x2721('0x32')][_0x2721('0x92')]({'where':{'id':_0x1b4285[_0x2721('0x4f')]['id']}})[_0x2721('0x20')](handleEntityNotFound(_0x1f05f0,null))[_0x2721('0x20')](function(_0x4ed80e){if(_0x4ed80e){_0x316472=_0x4ed80e;_0x5f306b[_0x2721('0xce')]=_['keys'](db[_0x2721('0x32')][_0x2721('0x33')]);_0x5f306b[_0x2721('0x3d')]=_['keys'](_0x1b4285[_0x2721('0x3d')]);_0x5f306b['filters']=_[_0x2721('0xd1')](_0x5f306b[_0x2721('0xce')],_0x5f306b[_0x2721('0x3d')]);_0x30f16f[_0x2721('0x43')]=_[_0x2721('0xd1')](_0x5f306b[_0x2721('0xce')],qs['fields'](_0x1b4285[_0x2721('0x3d')][_0x2721('0xd2')]));_0x30f16f[_0x2721('0x43')]=_0x30f16f[_0x2721('0x43')][_0x2721('0x63')]?_0x30f16f[_0x2721('0x43')]:_0x5f306b[_0x2721('0xce')];_0x30f16f['order']=qs['sort'](_0x1b4285[_0x2721('0x3d')][_0x2721('0xd3')]);_0x30f16f['where']=qs[_0x2721('0xd0')](_[_0x2721('0xd4')](_0x1b4285['query'],_0x5f306b[_0x2721('0xd0')]));if(_0x1b4285[_0x2721('0x3d')][_0x2721('0x36')]){_0x30f16f[_0x2721('0xd5')]=_['merge'](_0x30f16f['where'],{'$or':_[_0x2721('0x2a')](_0x30f16f['attributes'],function(_0x25f6d4){var _0x5ad928={};_0x5ad928[_0x25f6d4]={'$like':'%'+_0x1b4285['query'][_0x2721('0x36')]+'%'};return _0x5ad928;})});}_0x30f16f[_0x2721('0xce')]=db[_0x2721('0x32')];_0x30f16f['as']=_0x2721('0x27');_0x30f16f=_[_0x2721('0x50')]({},_0x30f16f,_0x1b4285[_0x2721('0xd6')]);return _0x316472[_0x2721('0xf7')]({'include':[_0x30f16f]});}})[_0x2721('0x20')](function(_0x33f86a){if(_0x33f86a){var _0x7aac26={},_0x20bd86=[];for(var _0x558720=0x0;_0x558720<_0x33f86a[_0x2721('0x63')];_0x558720+=0x1){for(var _0x4ff388=0x0,_0x5105dc;_0x4ff388<_0x33f86a[_0x558720][_0x2721('0x27')][_0x2721('0x63')];_0x4ff388+=0x1){_0x5105dc=_0x33f86a[_0x558720][_0x2721('0x27')][_0x4ff388][_0x2721('0x24')]({'plain':!![]});_0x7aac26[_0x5105dc['id']]=_0x5105dc;}}_0x7aac26=_[_0x2721('0x120')](_0x7aac26);for(var _0x467e50=qs[_0x2721('0x18')](_0x1b4285[_0x2721('0x3d')][_0x2721('0x18')]);_0x467e50<_0x7aac26['length']&&_0x20bd86[_0x2721('0x63')]=_0x5e4011){_0x1f86c2=_0x5e4011;_0x4ef275=0xc8;}else{_0x4ef275=0xce;}_0x18d43c['status'](_0x4ef275);return _0x18d43c[_0xd67d('0x19')]('Content-Range',_0x5e611f+'-'+_0x1f86c2+'/'+_0x5e4011)[_0xd67d('0x1a')](_0x23b0a2);}return null;};}function saveUpdates(_0x477cd9){return function(_0x3ae27c){if(_0x3ae27c){return _0x3ae27c['update'](_0x477cd9)[_0xd67d('0x1b')](function(_0x3089ee){if(_0x3089ee[_0xd67d('0x1c')]===_0xd67d('0x1d')){socket[_0xd67d('0x1e')](_0xd67d('0x1f')+_0x3089ee['id'],_0x3089ee);}return _0x3089ee;});}return null;};}function removeEntity(_0x2c3506,_0x334ce6){return function(_0x421f40){if(_0x421f40){return _0x421f40['destroy']({'transaction':_0x334ce6})[_0xd67d('0x1b')](function(){var _0xa4bcd4=_0x421f40[_0xd67d('0x20')]({'plain':!![]});if(_0xa4bcd4[_0xd67d('0x1c')]===_0xd67d('0x21'))return;var _0x4376d3=[{'name':_0xd67d('0x22'),'value':_0xd67d('0x23'),'ignore':!![]},{'name':_0xd67d('0x24'),'value':_0xd67d('0x1d'),'ignore':![]},{'name':_0xd67d('0x25'),'value':'telephone','ignore':![]}];var _0x2fad33=_(_0x4376d3)['filter'](_0xd67d('0x26'))['map']('value')['value']();if(_[_0xd67d('0x27')](_0x2fad33,_0xa4bcd4[_0xd67d('0x1c')])){return;}var _0x10f207=_[_0xd67d('0x28')](_0x4376d3,[_0xd67d('0x29'),_0xa4bcd4[_0xd67d('0x1c')]])[_0xd67d('0x2a')];return db[_0xd67d('0x2b')][_0xd67d('0x2c')]({'where':{'type':_0x10f207,'resourceId':_0xa4bcd4['id']},'transaction':_0x334ce6})[_0xd67d('0x1b')](function(){return _0x421f40;});})[_0xd67d('0x1b')](function(){_0x2c3506['status'](0xcc)[_0xd67d('0x13')]();});}};}function handleEntityNotFound(_0x2b639b){return function(_0x3814ff){if(!_0x3814ff){_0x2b639b[_0xd67d('0x12')](0x194);}return _0x3814ff;};}function handleError(_0x33f6d7,_0x16c704){_0x16c704=_0x16c704||0x1f4;return function(_0x515433){logger[_0xd67d('0x2d')](_0x515433[_0xd67d('0x2e')]);if(_0x515433[_0xd67d('0x2a')]){delete _0x515433[_0xd67d('0x2a')];}_0x33f6d7[_0xd67d('0x14')](_0x16c704)[_0xd67d('0x2f')](_0x515433);};}function getUserAttributes(){return _(db[_0xd67d('0x30')]['rawAttributes'])['map'](function(_0x28047a){return{'name':_0x28047a[_0xd67d('0x31')],'type':_0x28047a[_0xd67d('0x32')][_0xd67d('0x33')]};})['filter'](function(_0x46c29c){return!['password',_0xd67d('0x34'),'previousPasswords',_0xd67d('0x35'),'resetPasswordExpires',_0xd67d('0x36')][_0xd67d('0x27')](_0x46c29c[_0xd67d('0x2a')]);})[_0xd67d('0x29')]();}exports['index']=function(_0x4e2281,_0x18a077){var _0x22149a={},_0x55b59e={'count':0x0,'rows':[]};var _0x4d1944=getUserAttributes();_0x22149a=qs[_0xd67d('0x37')](_0x4d1944,_0x4e2281);var _0x40d207={'where':_0x22149a[_0xd67d('0x38')]};return db['User'][_0xd67d('0x18')](_0x40d207)[_0xd67d('0x1b')](function(_0x4ba363){_0x55b59e[_0xd67d('0x18')]=_0x4ba363;if(_0x4e2281[_0xd67d('0x39')][_0xd67d('0x3a')]){_0x22149a[_0xd67d('0x3b')]=[{'all':!![]}];}if(_0x4e2281[_0xd67d('0x39')][_0xd67d('0x3c')]===_0xd67d('0x3d')){_0x22149a['include']=[{'model':db[_0xd67d('0x3e')],'as':_0xd67d('0x3c')}];}if(!_['includes'](_0x22149a[_0xd67d('0x3f')],'id')){_0x22149a['attributes'][_0xd67d('0x40')]('id');}return db[_0xd67d('0x30')]['findAll'](_0x22149a);})['then'](function(_0x14a2a9){_0x55b59e[_0xd67d('0x41')]=_0x14a2a9;if(_0x4e2281['query']['openTabs']==='true'){var _0x2ae101=[];for(var _0x5dc646=0x0;_0x5dc646<_0x55b59e[_0xd67d('0x41')][_0xd67d('0x42')];_0x5dc646++){_0x2ae101[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x43'),_0x55b59e[_0xd67d('0x41')][_0x5dc646][_0xd67d('0x44')]));_0x2ae101[_0xd67d('0x40')](get_open_tabs('sms',_0x55b59e['rows'][_0x5dc646][_0xd67d('0x44')]));_0x2ae101[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x45'),_0x55b59e['rows'][_0x5dc646][_0xd67d('0x44')]));_0x2ae101['push'](get_open_tabs(_0xd67d('0x46'),_0x55b59e[_0xd67d('0x41')][_0x5dc646][_0xd67d('0x44')]));_0x2ae101['push'](get_open_tabs('openchannel',_0x55b59e['rows'][_0x5dc646][_0xd67d('0x44')]));_0x2ae101[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x47'),_0x55b59e[_0xd67d('0x41')][_0x5dc646]['dataValues']));}return Promise[_0xd67d('0x48')](_0x2ae101)['then'](function(){return _0x55b59e;});}else{return _0x55b59e;}})[_0xd67d('0x1b')](respondWithFilteredResult(_0x18a077,_0x22149a))[_0xd67d('0x49')](handleError(_0x18a077,null));};exports['show']=function(_0x462c0b,_0x3a3e41){var _0x411dbf=getUserAttributes();_0x462c0b[_0xd67d('0x39')]['id']=_0x462c0b[_0xd67d('0x4a')]['id'];var _0x3bb32c=qs[_0xd67d('0x37')](_0x411dbf,_0x462c0b);if(_0x462c0b[_0xd67d('0x39')]['includeAll']){_0x3bb32c[_0xd67d('0x3b')]=[{'all':!![]}];}if(_0x462c0b[_0xd67d('0x39')][_0xd67d('0x3c')]===_0xd67d('0x3d')){_0x3bb32c[_0xd67d('0x3b')]=[{'model':db['UserSetting'],'as':_0xd67d('0x3c')}];}_0x3bb32c=_[_0xd67d('0x4b')]({},_0x3bb32c,_0x462c0b['options']);if(!_[_0xd67d('0x27')](_0x3bb32c[_0xd67d('0x3f')],'id')){_0x3bb32c['attributes'][_0xd67d('0x40')]('id');}return db[_0xd67d('0x30')][_0xd67d('0x28')](_0x3bb32c)[_0xd67d('0x1b')](handleEntityNotFound(_0x3a3e41,null))[_0xd67d('0x1b')](function(_0x44c117){var _0x4e145b=[];values=_0x44c117;if(_0x462c0b[_0xd67d('0x39')][_0xd67d('0x4c')]==='true'){_0x4e145b[_0xd67d('0x40')](get_open_tabs('chat',_0x44c117[_0xd67d('0x44')]));_0x4e145b[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x4d'),_0x44c117[_0xd67d('0x44')]));_0x4e145b[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x4e'),_0x44c117[_0xd67d('0x44')]));_0x4e145b[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x47'),_0x44c117[_0xd67d('0x44')]));_0x4e145b[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x45'),_0x44c117[_0xd67d('0x44')]));_0x4e145b[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x46'),_0x44c117[_0xd67d('0x44')]));return Promise[_0xd67d('0x48')](_0x4e145b);}else{return values;}})[_0xd67d('0x1b')](function(){return values;})[_0xd67d('0x1b')](respondWithResult(_0x3a3e41,null))[_0xd67d('0x49')](handleError(_0x3a3e41,null));};exports[_0xd67d('0x4f')]=function(_0x5739f4,_0x1c9025){if(_0x5739f4['body']['id']){delete _0x5739f4['body']['id'];}delete _0x5739f4[_0xd67d('0x50')]['role'];return db[_0xd67d('0x30')]['find']({'where':{'id':_0x5739f4[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x1c9025,null))[_0xd67d('0x1b')](saveUpdates(_0x5739f4[_0xd67d('0x50')],null))[_0xd67d('0x1b')](respondWithResult(_0x1c9025,null))[_0xd67d('0x49')](handleError(_0x1c9025,null));};exports[_0xd67d('0x51')]=function(_0x2edac4,_0x429a59){return db[_0xd67d('0x30')][_0xd67d('0x51')]()['then'](respondWithResult(_0x429a59,null))['catch'](handleError(_0x429a59,null));};exports[_0xd67d('0x52')]=function(_0x3db020,_0x4dfe9b){return db[_0xd67d('0x30')]['find']({'where':{'id':_0x3db020[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x4dfe9b,null))[_0xd67d('0x1b')](function(_0x11b6e0){if(_0x11b6e0){return _0x11b6e0[_0xd67d('0x52')](_0x3db020[_0xd67d('0x50')][_0xd67d('0x53')],_[_0xd67d('0x54')](_0x3db020['body'],[_0xd67d('0x53'),'id'])||{});}})[_0xd67d('0x1b')](respondWithResult(_0x4dfe9b,null))[_0xd67d('0x49')](handleError(_0x4dfe9b,null));};function validateUser(_0x281b52){return new Promise(function(_0x136f94,_0x1a3630){if(_0x281b52['internal'])return _0x136f94(_0x281b52);return db[_0xd67d('0x55')][_0xd67d('0x56')](0x1)[_0xd67d('0x1b')](function(_0x1ba6ed){if(_0x1ba6ed['securePassword'])authService[_0xd67d('0x57')](_0x281b52[_0xd67d('0x58')]);db['User'][_0xd67d('0x59')]('internal')['then'](function(_0x452283){if(_[_0xd67d('0x5a')](_0x452283)){_0x281b52[_0xd67d('0x5b')]=_0x1ba6ed[_0xd67d('0x5c')]||0x1;return;}if(_[_0xd67d('0x5a')](_0x1ba6ed[_0xd67d('0x5c')])||_0x1ba6ed[_0xd67d('0x5c')]===_0x452283){_0x281b52['internal']=_0x452283+0x1;return;}if(_0x1ba6ed[_0xd67d('0x5c')]>_0x452283){_0x281b52['internal']=_0x1ba6ed[_0xd67d('0x5c')];return;}return db[_0xd67d('0x5d')][_0xd67d('0x39')]('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['sequelize'][_0xd67d('0x5e')]['SELECT']})[_0xd67d('0x1b')](function(_0x32d143){if(_0x32d143&&_0x32d143[_0xd67d('0x42')]){for(var _0x447984=0x0,_0x2681a0=_0x32d143[_0xd67d('0x42')];_0x447984<_0x2681a0&&_[_0xd67d('0x5a')](_0x281b52[_0xd67d('0x5b')]);_0x447984++){if(_0x1ba6ed[_0xd67d('0x5c')]<=_0x32d143[_0x447984][_0xd67d('0x5f')]){_0x281b52[_0xd67d('0x5b')]=_0x32d143[_0x447984][_0xd67d('0x5f')];}else if(_0x1ba6ed['min_internal']>_0x32d143[_0x447984][_0xd67d('0x5f')]&&_0x1ba6ed['min_internal']<=_0x32d143[_0x447984]['to']){_0x281b52[_0xd67d('0x5b')]=_0x1ba6ed[_0xd67d('0x5c')];}}}if(_[_0xd67d('0x5a')](_0x281b52[_0xd67d('0x5b')])){_0x281b52[_0xd67d('0x5b')]=_0x452283+0x1;}return _0x136f94(_0x281b52);});});})[_0xd67d('0x49')](function(_0xf02bcc){_0x1a3630(_0xf02bcc);});});}function updateUser(_0x272c17){return new Promise(function(_0xabc95b,_0x8a4aa7){try{if(_0x272c17[_0xd67d('0x60')]){_0x272c17[_0xd67d('0x61')]=_0x272c17[_0xd67d('0x5b')];_0x272c17[_0xd67d('0x62')]={'mailbox':_0x272c17[_0xd67d('0x5b')],'password':_0x272c17[_0xd67d('0x58')],'fullname':_0x272c17[_0xd67d('0x63')],'email':_0x272c17[_0xd67d('0x64')]};}if(_0x272c17[_0xd67d('0x1c')]===_0xd67d('0x1d')){if(!_0x272c17[_0xd67d('0x65')])_0x272c17[_0xd67d('0x65')]=[_0xd67d('0x66'),'102',_0xd67d('0x67'),_0xd67d('0x68'),_0xd67d('0x69'),'104',_0xd67d('0x6a'),'106',_0xd67d('0x6b'),_0xd67d('0x6c'),'109',_0xd67d('0x6d'),_0xd67d('0x6e'),_0xd67d('0x6f'),_0xd67d('0x70')];}_0xabc95b(_0x272c17);}catch(_0x4fb4c7){_0x8a4aa7(_0x4fb4c7);}});}exports[_0xd67d('0x71')]=function(_0x2b11ca,_0x59e587){if(_0x2b11ca['user']['role']===_0xd67d('0x1d'))throw new Error(_0xd67d('0x72'));if(_0x2b11ca[_0xd67d('0x50')][_0xd67d('0x1c')]===_0xd67d('0x23')&&_0x2b11ca[_0xd67d('0x23')][_0xd67d('0x1c')]!==_0xd67d('0x21')){throw new Error(_0xd67d('0x73'));}if(_0x2b11ca['body'][_0xd67d('0x1c')]===_0xd67d('0x21')&&_0x2b11ca[_0xd67d('0x23')]['role']!==_0xd67d('0x21')){throw new Error(_0xd67d('0x74'));}return licenseUtil[_0xd67d('0x75')]([_0x2b11ca['body']])[_0xd67d('0x1b')](function(){return validateUser(_0x2b11ca[_0xd67d('0x50')]);})[_0xd67d('0x1b')](function(_0x136319){return updateUser(_0x136319)[_0xd67d('0x1b')](function(_0x403ae2){if(_0x403ae2[_0xd67d('0x1c')]===_0xd67d('0x21')){_0x403ae2[_0xd67d('0x76')]=_0x2b11ca[_0xd67d('0x23')][_0xd67d('0x76')];delete _0x403ae2[_0xd67d('0x77')];}return _0x403ae2;});})[_0xd67d('0x1b')](function(_0x2b1ecf){return db[_0xd67d('0x30')]['create'](_0x2b1ecf,{'include':[{'model':db[_0xd67d('0x62')],'as':_0xd67d('0x62')}]});})[_0xd67d('0x1b')](function(_0x3d549c){if(_0x2b11ca['body'][_0xd67d('0x1c')]===_0xd67d('0x23'))return _0x3d549c;if(_0x2b11ca[_0xd67d('0x23')][_0xd67d('0x1c')]!==_0xd67d('0x23'))return _0x3d549c;return db[_0xd67d('0x78')][_0xd67d('0x28')]({'where':{'name':_0x3d549c[_0xd67d('0x1c')]===_0xd67d('0x1d')?_0xd67d('0x24'):_0xd67d('0x25'),'userProfileId':_0x2b11ca[_0xd67d('0x23')][_0xd67d('0x77')]},'raw':!![]})[_0xd67d('0x1b')](function(_0x3249d7){if(!_0x3249d7||_0x3249d7[_0xd67d('0x79')]!=0x0)return _0x3d549c;return db[_0xd67d('0x2b')]['create']({'name':_0x3d549c[_0xd67d('0x2a')],'resourceId':_0x3d549c['id'],'type':_0x3249d7[_0xd67d('0x2a')],'sectionId':_0x3249d7['id']},{})[_0xd67d('0x1b')](function(){return _0x3d549c;});})['catch'](function(_0xc68512){logger[_0xd67d('0x2d')](_0xd67d('0x7a'),_0xc68512);throw _0xc68512;});})[_0xd67d('0x1b')](respondWithResult(_0x59e587,0xc9))[_0xd67d('0x49')](handleError(_0x59e587,null));};exports[_0xd67d('0x7b')]=function(_0x47d59e,_0x540e09){var _0x3af8c7=_0x47d59e['body'];var _0x47c9ee=[];if(_0x47d59e[_0xd67d('0x23')][_0xd67d('0x1c')]===_0xd67d('0x1d'))throw new Error('Unauthorized');if(_[_0xd67d('0x7c')](_0x3af8c7,[_0xd67d('0x1c'),_0xd67d('0x23')])&&_0x47d59e[_0xd67d('0x23')][_0xd67d('0x1c')]!==_0xd67d('0x21')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xd67d('0x7c')](_0x3af8c7,[_0xd67d('0x1c'),'admin'])&&_0x47d59e[_0xd67d('0x23')][_0xd67d('0x1c')]!==_0xd67d('0x21')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x3af8c7)['then'](function(){return validateUser(_0x3af8c7[0x0]);})[_0xd67d('0x1b')](function(){for(var _0x1e0e48=0x1;_0x1e0e48<_0x3af8c7[_0xd67d('0x42')];_0x1e0e48++){var _0x2a82c4=_0x3af8c7[_0x1e0e48-0x1][_0xd67d('0x5b')];if(!_0x3af8c7[_0x1e0e48]['internal'])_0x3af8c7[_0x1e0e48][_0xd67d('0x5b')]=_0x2a82c4+0x1;_0x47c9ee[_0xd67d('0x40')](validateUser(_0x3af8c7[_0x1e0e48]));}return Promise[_0xd67d('0x48')](_0x47c9ee);})[_0xd67d('0x1b')](function(){_0x47c9ee=[];for(var _0x2301d1=0x0;_0x2301d1<_0x3af8c7[_0xd67d('0x42')];_0x2301d1++){_0x47c9ee[_0xd67d('0x40')](updateUser(_0x3af8c7[_0x2301d1]));}return Promise[_0xd67d('0x48')](_0x47c9ee);})[_0xd67d('0x1b')](function(){_0x47c9ee=_0x3af8c7[_0xd67d('0x7d')](function(_0x42ad67){return db['User'][_0xd67d('0x71')](_0x42ad67,{'include':[{'model':db['VoiceMail'],'as':_0xd67d('0x62')}]})[_0xd67d('0x1b')](function(_0x4b5f6c){_0x42ad67['id']=_0x4b5f6c['id'];return _0x42ad67;});});return Promise['all'](_0x47c9ee);})[_0xd67d('0x1b')](function(_0x8ec1bc){if(_0x47d59e[_0xd67d('0x50')]['role']==='user')return _0x8ec1bc;if(_0x47d59e[_0xd67d('0x23')][_0xd67d('0x1c')]!==_0xd67d('0x23'))return _0x8ec1bc;var _0x391afb=_['some'](_0x8ec1bc,function(_0x2978e7){return _0x2978e7[_0xd67d('0x1c')]===_0xd67d('0x1d')||_0x2978e7[_0xd67d('0x1c')]===_0xd67d('0x7e');});if(!_0x391afb)return _0x8ec1bc;return db[_0xd67d('0x78')][_0xd67d('0x7f')]({'where':{'name':{'$or':[_0xd67d('0x24'),_0xd67d('0x25')]},'userProfileId':_0x47d59e['user'][_0xd67d('0x77')]},'raw':!![]})[_0xd67d('0x1b')](function(_0x24a7f1){if(_[_0xd67d('0x80')](_0x24a7f1)||!_[_0xd67d('0x7c')](_0x24a7f1,[_0xd67d('0x79'),0x0]))return _0x8ec1bc;_0x47c9ee=[];var _0x4c54fa=_(_0x24a7f1)[_0xd67d('0x7d')](function(_0x4a4b7b){if(_0x4a4b7b['autoAssociation']===0x1)return;return _0x4a4b7b[_0xd67d('0x2a')]==='Agents'?_0xd67d('0x1d'):'telephone';})['compact']()[_0xd67d('0x29')]();for(var _0x3bdc6f=0x0;_0x3bdc6f<_0x8ec1bc[_0xd67d('0x42')];_0x3bdc6f++){if(!_[_0xd67d('0x27')](_0x4c54fa,_0x8ec1bc[_0x3bdc6f]['role']))return;var _0x519af7=_0x8ec1bc[_0x3bdc6f]['role']===_0xd67d('0x1d')?_0xd67d('0x24'):_0xd67d('0x25');_0x47c9ee[_0xd67d('0x40')](db['UserProfileResource'][_0xd67d('0x71')]({'name':_0x8ec1bc[_0x3bdc6f][_0xd67d('0x2a')],'resourceId':_0x8ec1bc[_0x3bdc6f]['id'],'type':_0x519af7,'sectionId':_[_0xd67d('0x28')](_0x24a7f1,['name',_0x519af7])['id']},{}));}return Promise['all'](_0x47c9ee);});})[_0xd67d('0x1b')](respondWithResult(_0x540e09,0xc9))[_0xd67d('0x49')](handleError(_0x540e09,null));};exports[_0xd67d('0x81')]=function(_0x2190f8,_0xe30149){if(_0x2190f8[_0xd67d('0x50')]['id']){delete _0x2190f8[_0xd67d('0x50')]['id'];}return db['User'][_0xd67d('0x28')]({'where':{'id':_0x2190f8[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](function(_0x492765){if(!_0x492765)return null;if(_0x492765['id']===_0x2190f8['user']['id']){if(!_0x2190f8[_0xd67d('0x50')]['oldPassword']||!_0x2190f8[_0xd67d('0x50')][_0xd67d('0x82')]){throw new db[(_0xd67d('0x83'))][(_0xd67d('0x84'))](_0xd67d('0x85'));}if(!_0x492765[_0xd67d('0x86')](_0x2190f8[_0xd67d('0x50')][_0xd67d('0x87')])){throw new db[(_0xd67d('0x83'))][(_0xd67d('0x84'))]('Wrong\x20credentials');}if(_0x2190f8['body']['oldPassword']===_0x2190f8[_0xd67d('0x50')][_0xd67d('0x82')]){throw new db['Sequelize'][(_0xd67d('0x84'))](_0xd67d('0x88'));}}else if(_0x2190f8[_0xd67d('0x23')][_0xd67d('0x1c')]==='admin'){if(!_0x2190f8[_0xd67d('0x50')][_0xd67d('0x82')]){throw new db[(_0xd67d('0x83'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x2190f8[_0xd67d('0x23')][_0xd67d('0x1c')]===_0xd67d('0x23')){if(!_0x2190f8['body'][_0xd67d('0x82')]){throw new db[(_0xd67d('0x83'))][(_0xd67d('0x84'))](_0xd67d('0x89'));}if(_0x492765[_0xd67d('0x1c')]!==_0xd67d('0x1d')){throw new db['Sequelize'][(_0xd67d('0x84'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0xd67d('0x84'))](_0xd67d('0x72'));}return _0x492765;})['then'](handleEntityNotFound(_0xe30149,null))[_0xd67d('0x1b')](function(_0x104afa){return db['Setting'][_0xd67d('0x8a')]({'attributes':['id',_0xd67d('0x8b'),_0xd67d('0x8c'),'passwordHistoryLimit']})['then'](function(_0x50aab0){if(_0x50aab0[_0xd67d('0x8b')])authService[_0xd67d('0x57')](_0x2190f8[_0xd67d('0x50')][_0xd67d('0x82')]);if(!_0x50aab0[_0xd67d('0x8c')]||!_0x104afa['previousPasswords'])return _0x104afa;authService['validatePasswordHistory'](_0x2190f8[_0xd67d('0x50')][_0xd67d('0x82')],_0x104afa[_0xd67d('0x8d')],_0x50aab0[_0xd67d('0x8e')]);return _0x104afa;})[_0xd67d('0x1b')](saveUpdates({'password':_0x2190f8[_0xd67d('0x50')][_0xd67d('0x82')],'passwordResetAt':_0x2190f8[_0xd67d('0x23')]['id']==_0x2190f8['params']['id']?moment():null,'previousPasswords':authService[_0xd67d('0x8f')](_0x2190f8[_0xd67d('0x50')][_0xd67d('0x82')],_0x104afa[_0xd67d('0x8d')])},null));})[_0xd67d('0x1b')](respondWithResult(_0xe30149,null))[_0xd67d('0x49')](handleError(_0xe30149,null));};exports['addQueues']=function(_0x2f2865,_0x371e50){var _0x372877=_0x2f2865[_0xd67d('0x50')][_0xd67d('0x90')];return db[_0xd67d('0x30')][_0xd67d('0x28')]({'where':{'id':_0x2f2865[_0xd67d('0x4a')]['id']},'attributes':['id',_0xd67d('0x2a'),'role',_0xd67d('0x91'),_0xd67d('0x92'),'voicePause',_0xd67d('0x93')]})[_0xd67d('0x1b')](handleEntityNotFound(_0x371e50,null))[_0xd67d('0x1b')](function(_0x5902bc){if(_0x5902bc){if(!utils[_0xd67d('0x94')](_0x372877)){throw new db[(_0xd67d('0x83'))]['ValidationError'](_0xd67d('0x95'));}return _0x5902bc[_0xd67d('0x96')+_['capitalize'](_0x372877[_0xd67d('0x97')]())+_0xd67d('0x98')](_0x2f2865[_0xd67d('0x50')][_0xd67d('0x53')],{'penalty':_0x2f2865[_0xd67d('0x50')][_0xd67d('0x99')]||0x0})[_0xd67d('0x9a')](function(_0x21b28b){for(var _0x293814=0x0;_0x293814<_0x2f2865['body'][_0xd67d('0x53')][_0xd67d('0x42')];_0x293814+=0x1){var _0x494595={'UserId':Number(_0x2f2865['params']['id'])};_0x494595[_[_0xd67d('0x9b')](_0x372877['toLowerCase']())+_0xd67d('0x9c')]=Number(_0x2f2865[_0xd67d('0x50')][_0xd67d('0x53')][_0x293814]);socket[_0xd67d('0x1e')]('user'+_[_0xd67d('0x9b')](_0x372877['toLowerCase']())+_0xd67d('0x9d'),_0x494595);}return _0x21b28b;})[_0xd67d('0x1b')](function(){if(_0x372877===_0xd67d('0x9e')){return db[_0xd67d('0x9f')][_0xd67d('0x7f')]({'where':{'id':_0x2f2865[_0xd67d('0x50')][_0xd67d('0x53')]||[]},'raw':!![],'attributes':['id',_0xd67d('0x2a')]});}})[_0xd67d('0x1b')](function(_0x9251d2){var _0x2e4596=_0x5902bc[_0xd67d('0x20')]({'plain':!![]});var _0x45cb90=[];if(_0x372877===_0xd67d('0x9e')&&_0x2e4596[_0xd67d('0x1c')]==='agent'&&_0x2e4596['online']){for(let _0x1b6631=0x0;_0x1b6631<_0x9251d2[_0xd67d('0x42')];_0x1b6631+=0x1){_0x45cb90['push']({'membername':_0x2e4596[_0xd67d('0x2a')],'UserId':_0x2e4596['id'],'queue_name':_0x9251d2[_0x1b6631]['name'],'VoiceQueueId':_0x9251d2[_0x1b6631]['id'],'interface':_[_0xd67d('0x5a')](_0x2e4596[_0xd67d('0x93')])?util[_0xd67d('0xa0')](_0xd67d('0xa1'),_0x2e4596[_0xd67d('0x2a')]):_0x2e4596[_0xd67d('0x93')],'paused':_0x2e4596[_0xd67d('0xa2')]||![],'penalty':_0x2f2865[_0xd67d('0x50')][_0xd67d('0x99')]||0x0});}return Promise[_0xd67d('0x48')](_0x45cb90[_0xd67d('0x7d')](function(_0x1d9d1e){return db[_0xd67d('0xa3')][_0xd67d('0xa4')](_0x1d9d1e);}));}return _0x5902bc;});}})[_0xd67d('0x1b')](respondWithStatusCode(_0x371e50,null))[_0xd67d('0x49')](handleError(_0x371e50,null));};exports[_0xd67d('0xa5')]=function(_0x4708d7,_0x45971d){var _0x316ca5,_0x49cdfa;return db[_0xd67d('0x30')][_0xd67d('0x28')]({'where':{'id':_0x4708d7[_0xd67d('0x4a')]['id']},'attributes':['id','name','role']})[_0xd67d('0x1b')](handleEntityNotFound(_0x45971d,null))['then'](function(_0x4322a8){if(_0x4322a8){_0x316ca5=_0x4322a8;if(!_0x4708d7[_0xd67d('0x39')][_0xd67d('0x90')]||!utils['isValidChannel'](_0x4708d7['query'][_0xd67d('0x90')])){throw new db['Sequelize']['ValidationError'](_0xd67d('0x95'));}return _0x4322a8[_0xd67d('0xa6')+_[_0xd67d('0x9b')](_0x4708d7['query'][_0xd67d('0x90')][_0xd67d('0x97')]())+_0xd67d('0x98')](_0x4708d7[_0xd67d('0x39')][_0xd67d('0x53')]);}})[_0xd67d('0x1b')](function(_0x32db21){if(_['isArray'](_0x4708d7[_0xd67d('0x39')]['ids'])){for(var _0x3b27d1=0x0;_0x3b27d1<_0x4708d7['query'][_0xd67d('0x53')][_0xd67d('0x42')];_0x3b27d1+=0x1){_0x49cdfa={'UserId':Number(_0x4708d7['params']['id'])};_0x49cdfa[_[_0xd67d('0x9b')](_0x4708d7['query'][_0xd67d('0x90')][_0xd67d('0x97')]())+_0xd67d('0x9c')]=Number(_0x4708d7[_0xd67d('0x39')][_0xd67d('0x53')][_0x3b27d1]);socket[_0xd67d('0x1e')](_0xd67d('0x23')+_[_0xd67d('0x9b')](_0x4708d7[_0xd67d('0x39')]['channel']['toLowerCase']())+'Queue:remove',_0x49cdfa);}}else{_0x49cdfa={'UserId':Number(_0x4708d7[_0xd67d('0x4a')]['id'])};_0x49cdfa[_['capitalize'](_0x4708d7['query']['channel'][_0xd67d('0x97')]())+_0xd67d('0x9c')]=Number(_0x4708d7['query'][_0xd67d('0x53')]);socket[_0xd67d('0x1e')](_0xd67d('0x23')+_[_0xd67d('0x9b')](_0x4708d7[_0xd67d('0x39')][_0xd67d('0x90')][_0xd67d('0x97')]())+'Queue:remove',_0x49cdfa);}return _0x32db21;})['then'](function(){if(_0x4708d7[_0xd67d('0x39')][_0xd67d('0x90')]==='voice'){return db[_0xd67d('0xa3')]['destroy']({'where':{'UserId':_0x4708d7['params']['id'],'VoiceQueueId':_0x4708d7[_0xd67d('0x39')][_0xd67d('0x53')]},'individualHooks':!![]})[_0xd67d('0x1b')](function(){return _0x316ca5;});}return _0x316ca5;})[_0xd67d('0x1b')](respondWithStatusCode(_0x45971d,null))[_0xd67d('0x49')](handleError(_0x45971d,null));};exports[_0xd67d('0xa7')]=function(_0x384f19,_0x351384){_0x384f19[_0xd67d('0x50')]['userpic']=_0x384f19[_0xd67d('0xa8')][_0xd67d('0xa9')];return db[_0xd67d('0x30')]['find']({'where':{'id':_0x384f19['params']['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x351384,null))['then'](saveUpdates(_0x384f19[_0xd67d('0x50')],null))[_0xd67d('0x1b')](respondWithResult(_0x351384,null))[_0xd67d('0x49')](handleError(_0x351384,null));};exports['getAvatar']=function(_0x35cbc6,_0x2b8471){var _0x5522dc=path[_0xd67d('0xaa')](config[_0xd67d('0xab')],_0xd67d('0xac'));return db[_0xd67d('0x30')][_0xd67d('0x28')]({'where':{'id':_0x35cbc6[_0xd67d('0x4a')]['id']},'attributes':['id',_0xd67d('0xad')],'raw':!![]})[_0xd67d('0x1b')](handleEntityNotFound(_0x2b8471,null))['then'](function(_0x1e2f3){if(_0x1e2f3){if(_['isNil'](_0x1e2f3['userpic'])){return _0x2b8471['download'](_0x5522dc);}else{if(!fs['existsSync'](path[_0xd67d('0xaa')](config[_0xd67d('0xab')],_0xd67d('0xae'),_0x1e2f3['userpic']))){return _0x2b8471[_0xd67d('0xaf')](_0x5522dc);}return _0x2b8471[_0xd67d('0xaf')](path[_0xd67d('0xaa')](config[_0xd67d('0xab')],'server/files/images/',_0x1e2f3[_0xd67d('0xad')]));}}})[_0xd67d('0x49')](handleError(_0x2b8471,null));};exports[_0xd67d('0xb0')]=function(_0x597d45,_0x35f436){return db[_0xd67d('0x30')][_0xd67d('0x28')]({'where':{'id':_0x597d45[_0xd67d('0x4a')]['id']},'attributes':['id']})[_0xd67d('0x1b')](handleEntityNotFound(_0x35f436,null))['then'](function(_0x3ea2cb){var _0x1adbcd=[];values=_0x3ea2cb[_0xd67d('0x44')];_0x1adbcd[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x43'),_0x3ea2cb[_0xd67d('0x44')]));_0x1adbcd[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x4d'),_0x3ea2cb['dataValues']));_0x1adbcd[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x4e'),_0x3ea2cb[_0xd67d('0x44')]));_0x1adbcd[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x47'),_0x3ea2cb[_0xd67d('0x44')]));_0x1adbcd[_0xd67d('0x40')](get_open_tabs(_0xd67d('0x45'),_0x3ea2cb[_0xd67d('0x44')]));_0x1adbcd[_0xd67d('0x40')](get_open_tabs('mail',_0x3ea2cb[_0xd67d('0x44')]));return Promise[_0xd67d('0x48')](_0x1adbcd);})[_0xd67d('0x1b')](function(_0x22dbc2){if(_0x22dbc2){var _0x2bac4a=_[_0xd67d('0x7d')](values[_0xd67d('0xb1')],function(_0x1d5319){return{'channel':_0xd67d('0xb2'),'id':_0x1d5319['id'],'createdAt':_0x1d5319[_0xd67d('0xb3')]};});var _0x13e377=_[_0xd67d('0x7d')](values[_0xd67d('0xb4')],function(_0x1af878){return{'channel':_0xd67d('0xb5'),'id':_0x1af878['id'],'createdAt':_0x1af878[_0xd67d('0xb3')]};});var _0x20dc63=_[_0xd67d('0x7d')](values[_0xd67d('0xb6')],function(_0x7b2f43){return{'channel':'OPENCHANNEL','id':_0x7b2f43['id'],'createdAt':_0x7b2f43['createdAt']};});var _0x2147a5=_[_0xd67d('0x7d')](values[_0xd67d('0xb7')],function(_0x17b40e){return{'channel':_0xd67d('0xb8'),'id':_0x17b40e['id'],'createdAt':_0x17b40e[_0xd67d('0xb3')]};});var _0x2e0c99=_[_0xd67d('0x7d')](values['SmsOpenTabs'],function(_0x49049f){return{'channel':'SMS','id':_0x49049f['id'],'createdAt':_0x49049f['createdAt']};});var _0x5abb0a=_[_0xd67d('0x7d')](values[_0xd67d('0xb9')],function(_0x431822){return{'channel':_0xd67d('0xba'),'id':_0x431822['id'],'createdAt':_0x431822[_0xd67d('0xb3')]};});var _0x5ed30f=_[_0xd67d('0xbb')](_0x2bac4a,_0x13e377,_0x20dc63,_0x2147a5,_0x2e0c99,_0x5abb0a);var _0x1762be={'count':_0x5ed30f[_0xd67d('0x42')],'rows':_0x5ed30f};return _0x1762be;}else return null;})['then'](respondWithResult(_0x35f436,null))[_0xd67d('0x49')](handleError(_0x35f436,null));};exports[_0xd67d('0xbc')]=function(_0xb589d8,_0x2904d5){var _0x19aac0={};return db['User'][_0xd67d('0x8a')]({'where':{'id':_0xb589d8[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](function(_0x14a029){if(!_0x14a029){throw new APINotFoundError(util[_0xd67d('0xa0')](_0xd67d('0xbd'),_0xb589d8['params']['id']));}return contacts['describe']();})[_0xd67d('0x1b')](function(_0x5a49aa){_0xb589d8[_0xd67d('0x39')][_0xd67d('0x30')]=_0xb589d8[_0xd67d('0x4a')]['id'];_0x19aac0=qs[_0xd67d('0x37')](_0x5a49aa,_0xb589d8);if(_0xb589d8[_0xd67d('0x39')][_0xd67d('0xbe')](_0xd67d('0x3a'))){_0x19aac0['include']=[{'model':db[_0xd67d('0xbf')],'as':_0xd67d('0xc0'),'required':![]},{'model':db[_0xd67d('0xc1')],'as':'Tags','attributes':['id',_0xd67d('0x2a'),_0xd67d('0xc2')],'where':_0xb589d8[_0xd67d('0x39')]['tag']?{'id':_0xb589d8[_0xd67d('0x39')][_0xd67d('0xc3')]}:undefined,'required':_0xb589d8[_0xd67d('0x39')][_0xd67d('0xc3')]?!![]:![]}];}return contacts['findAll'](_0xb589d8[_0xd67d('0x39')],_0xb589d8[_0xd67d('0x23')],_0x19aac0,_0x5a49aa);})[_0xd67d('0x1b')](respondWithFilteredResult(_0x2904d5,_0x19aac0))['catch'](APIHandleError(_0x2904d5));};exports[_0xd67d('0xc4')]=function(_0x49111a,_0x1da095){var _0x2f1bce;var _0x5816e2={};var _0x2b5db0;return db[_0xd67d('0x30')][_0xd67d('0x8a')]({'where':{'id':_0x49111a[_0xd67d('0x4a')]['id']},'attributes':['id',_0xd67d('0x2a'),_0xd67d('0x1c')]})['then'](handleEntityNotFound(_0x1da095,null))['then'](function(_0x100d8e){if(!utils[_0xd67d('0x94')](_0x49111a['query'][_0xd67d('0x90')])){throw new db['Sequelize'][(_0xd67d('0x84'))](_0xd67d('0x95'));}_0x2f1bce=_0x100d8e;var _0x1ce965={};_0x1ce965[_0xd67d('0xc5')]=_['keys'](db[_[_0xd67d('0x9b')](_0x49111a[_0xd67d('0x39')][_0xd67d('0x90')])+_0xd67d('0xc6')][_0xd67d('0xc7')]);_0x1ce965[_0xd67d('0x39')]=_[_0xd67d('0xc8')](_0x49111a[_0xd67d('0x39')]);_0x1ce965['filters']=_[_0xd67d('0xc9')](_0x1ce965[_0xd67d('0xc5')],_0x1ce965[_0xd67d('0x39')]);_0x5816e2[_0xd67d('0x3f')]=_['intersection'](_0x1ce965[_0xd67d('0xc5')],qs['fields'](_0x49111a[_0xd67d('0x39')]['fields']));_0x5816e2[_0xd67d('0x3f')]=_0x5816e2[_0xd67d('0x3f')][_0xd67d('0x42')]?_0x5816e2['attributes']:_0x1ce965[_0xd67d('0xc5')];_0x5816e2[_0xd67d('0xca')]=qs[_0xd67d('0xcb')](_0x49111a['query'][_0xd67d('0xcb')]);_0x5816e2['where']=qs[_0xd67d('0xcc')](_['pick'](_0x49111a[_0xd67d('0x39')],_0x1ce965['filters']));if(_0x49111a[_0xd67d('0x39')][_0xd67d('0xcd')]){_0x5816e2[_0xd67d('0x38')]=_[_0xd67d('0x4b')](_0x5816e2[_0xd67d('0x38')],{'$or':_[_0xd67d('0x7d')](_0x5816e2[_0xd67d('0x3f')],function(_0x425479){var _0x363cd8={};_0x363cd8[_0x425479]={'$like':'%'+_0x49111a[_0xd67d('0x39')][_0xd67d('0xcd')]+'%'};return _0x363cd8;})});}_0x5816e2=_[_0xd67d('0x4b')]({},_0x5816e2,_0x49111a[_0xd67d('0xce')]);switch(_0x2f1bce[_0xd67d('0x1c')]){case'admin':return db[_[_0xd67d('0x9b')](_0x49111a['query']['channel'])+'Queue'][_0xd67d('0x7f')](_0x5816e2);case _0xd67d('0x23'):case _0xd67d('0x1d'):return _0x2f1bce[_0xd67d('0x20')+_['capitalize'](_0x49111a[_0xd67d('0x39')][_0xd67d('0x90')])+_0xd67d('0x98')](_0x5816e2);default:throw new db[(_0xd67d('0x83'))]['ValidationError'](_0xd67d('0xcf'));}})['then'](function(_0x105f38){_0x2b5db0=_0x105f38[_0xd67d('0x42')];if(!_0x49111a[_0xd67d('0x39')][_0xd67d('0xbe')](_0xd67d('0xd0'))){_0x5816e2[_0xd67d('0x16')]=qs['limit'](_0x49111a['query'][_0xd67d('0x16')]);_0x5816e2[_0xd67d('0x15')]=qs[_0xd67d('0x15')](_0x49111a[_0xd67d('0x39')]['offset']);}switch(_0x2f1bce[_0xd67d('0x1c')]){case _0xd67d('0x21'):return db[_['capitalize'](_0x49111a[_0xd67d('0x39')][_0xd67d('0x90')])+_0xd67d('0xc6')][_0xd67d('0x7f')](_0x5816e2);case _0xd67d('0x23'):case _0xd67d('0x1d'):return _0x2f1bce[_0xd67d('0x20')+_[_0xd67d('0x9b')](_0x49111a[_0xd67d('0x39')][_0xd67d('0x90')])+_0xd67d('0x98')](_0x5816e2);}})['then'](function(_0x4e746f){return{'count':_0x2b5db0,'rows':_0x4e746f};})[_0xd67d('0x1b')](respondWithResult(_0x1da095,null))[_0xd67d('0x49')](handleError(_0x1da095,null));};exports['getVoiceQueuesRt']=function(_0x342697,_0x4c0c11){var _0x1ab5ba={};var _0x2a663a={};var _0x5d05d8;var _0x575237;return db[_0xd67d('0x30')][_0xd67d('0x8a')]({'where':{'id':_0x342697[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x4c0c11,null))[_0xd67d('0x1b')](function(_0x356960){if(_0x356960){_0x5d05d8=_0x356960;_0x2a663a[_0xd67d('0xc5')]=_['keys'](db['UserVoiceQueueRt'][_0xd67d('0xc7')]);_0x2a663a[_0xd67d('0x39')]=_[_0xd67d('0xc8')](_0x342697['query']);_0x2a663a[_0xd67d('0xcc')]=_[_0xd67d('0xc9')](_0x2a663a[_0xd67d('0xc5')],_0x2a663a[_0xd67d('0x39')]);_0x1ab5ba[_0xd67d('0x3f')]=_['intersection'](_0x2a663a['model'],qs['fields'](_0x342697[_0xd67d('0x39')][_0xd67d('0xd1')]));_0x1ab5ba[_0xd67d('0x3f')]=_0x1ab5ba[_0xd67d('0x3f')][_0xd67d('0x42')]?_0x1ab5ba[_0xd67d('0x3f')]:_0x2a663a[_0xd67d('0xc5')];_0x1ab5ba[_0xd67d('0xca')]=qs[_0xd67d('0xcb')](_0x342697['query'][_0xd67d('0xcb')]);_0x1ab5ba[_0xd67d('0x38')]=qs[_0xd67d('0xcc')](_[_0xd67d('0xd2')](_0x342697[_0xd67d('0x39')],_0x2a663a['filters']));if(_0x342697['query'][_0xd67d('0xcd')]){_0x1ab5ba[_0xd67d('0x38')]=_[_0xd67d('0x4b')](_0x1ab5ba['where'],{'$or':_[_0xd67d('0x7d')](_0x1ab5ba[_0xd67d('0x3f')],function(_0x4651a6){var _0x1ebb10={};_0x1ebb10[_0x4651a6]={'$like':'%'+_0x342697[_0xd67d('0x39')]['filter']+'%'};return _0x1ebb10;})});}_0x1ab5ba=_[_0xd67d('0x4b')]({},_0x1ab5ba,_0x342697['options']);return _0x5d05d8[_0xd67d('0xd3')](_0x1ab5ba);}})[_0xd67d('0x1b')](function(_0x338760){if(_0x338760){_0x575237=_0x338760[_0xd67d('0x42')];if(!_0x342697[_0xd67d('0x39')][_0xd67d('0xbe')](_0xd67d('0xd0'))){_0x1ab5ba[_0xd67d('0x16')]=qs[_0xd67d('0x16')](_0x342697['query'][_0xd67d('0x16')]);_0x1ab5ba[_0xd67d('0x15')]=qs[_0xd67d('0x15')](_0x342697[_0xd67d('0x39')][_0xd67d('0x15')]);}return _0x5d05d8[_0xd67d('0xd3')](_0x1ab5ba);}})[_0xd67d('0x1b')](function(_0x3dcab6){if(_0x3dcab6){return _0x3dcab6?{'count':_0x575237,'rows':_0x3dcab6}:null;}})['then'](respondWithResult(_0x4c0c11,null))[_0xd67d('0x49')](handleError(_0x4c0c11,null));};exports['getGroups']=function(_0x1c6b6d,_0x5eea9f){var _0x1ca263={};var _0x1806e4={};var _0x7fd452;var _0x3fcfc3;return db['User']['findOne']({'where':{'id':_0x1c6b6d[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x5eea9f,null))['then'](function(_0x34891c){if(_0x34891c){_0x7fd452=_0x34891c;_0x1806e4['model']=_[_0xd67d('0xc8')](db['ChatGroup'][_0xd67d('0xc7')]);_0x1806e4['query']=_[_0xd67d('0xc8')](_0x1c6b6d['query']);_0x1806e4['filters']=_[_0xd67d('0xc9')](_0x1806e4[_0xd67d('0xc5')],_0x1806e4[_0xd67d('0x39')]);_0x1ca263[_0xd67d('0x3f')]=_['intersection'](_0x1806e4[_0xd67d('0xc5')],qs[_0xd67d('0xd1')](_0x1c6b6d[_0xd67d('0x39')]['fields']));_0x1ca263['attributes']=_0x1ca263[_0xd67d('0x3f')][_0xd67d('0x42')]?_0x1ca263['attributes']:_0x1806e4[_0xd67d('0xc5')];_0x1ca263[_0xd67d('0xca')]=qs[_0xd67d('0xcb')](_0x1c6b6d['query']['sort']);_0x1ca263[_0xd67d('0x38')]=qs[_0xd67d('0xcc')](_[_0xd67d('0xd2')](_0x1c6b6d[_0xd67d('0x39')],_0x1806e4['filters']));if(_0x1c6b6d[_0xd67d('0x39')][_0xd67d('0xcd')]){_0x1ca263[_0xd67d('0x38')]=_[_0xd67d('0x4b')](_0x1ca263['where'],{'$or':_['map'](_0x1ca263['attributes'],function(_0x120c09){var _0x567f97={};_0x567f97[_0x120c09]={'$like':'%'+_0x1c6b6d[_0xd67d('0x39')][_0xd67d('0xcd')]+'%'};return _0x567f97;})});}_0x1ca263=_[_0xd67d('0x4b')]({},_0x1ca263,_0x1c6b6d[_0xd67d('0xce')]);return _0x7fd452[_0xd67d('0xd4')](_0x1ca263);}})[_0xd67d('0x1b')](function(_0x49d230){if(_0x49d230){_0x3fcfc3=_0x49d230['length'];if(!_0x1c6b6d[_0xd67d('0x39')][_0xd67d('0xbe')](_0xd67d('0xd0'))){_0x1ca263[_0xd67d('0x16')]=qs[_0xd67d('0x16')](_0x1c6b6d[_0xd67d('0x39')][_0xd67d('0x16')]);_0x1ca263[_0xd67d('0x15')]=qs[_0xd67d('0x15')](_0x1c6b6d['query']['offset']);}return _0x7fd452['getGroups'](_0x1ca263);}})[_0xd67d('0x1b')](function(_0x564b55){if(_0x564b55){return _0x564b55?{'count':_0x3fcfc3,'rows':_0x564b55}:null;}})[_0xd67d('0x1b')](respondWithResult(_0x5eea9f,null))['catch'](handleError(_0x5eea9f,null));};exports[_0xd67d('0xd5')]=function(_0x445f05,_0x4f9349){var _0xcc455b={'raw':!![],'where':{}};var _0x35ad38={};var _0x48bd8a={'count':0x0,'rows':[]};return db[_0xd67d('0x30')]['findOne']({'where':{'id':_0x445f05[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x4f9349,null))[_0xd67d('0x1b')](function(_0x45b668){if(_0x45b668){_0x35ad38['model']=_[_0xd67d('0xc8')](db[_0xd67d('0xd6')][_0xd67d('0xc7')]);_0x35ad38[_0xd67d('0x39')]=_[_0xd67d('0xc8')](_0x445f05[_0xd67d('0x39')]);_0x35ad38[_0xd67d('0xcc')]=_[_0xd67d('0xc9')](_0x35ad38['model'],_0x35ad38[_0xd67d('0x39')]);_0xcc455b[_0xd67d('0x3f')]=_[_0xd67d('0xc9')](_0x35ad38['model'],qs['fields'](_0x445f05[_0xd67d('0x39')]['fields']));_0xcc455b[_0xd67d('0x3f')]=_0xcc455b['attributes']['length']?_0xcc455b['attributes']:_0x35ad38[_0xd67d('0xc5')];if(!_0x445f05[_0xd67d('0x39')][_0xd67d('0xbe')](_0xd67d('0xd0'))){_0xcc455b['limit']=qs[_0xd67d('0x16')](_0x445f05[_0xd67d('0x39')][_0xd67d('0x16')]);_0xcc455b['offset']=qs[_0xd67d('0x15')](_0x445f05[_0xd67d('0x39')][_0xd67d('0x15')]);}_0xcc455b['order']=qs['sort'](_0x445f05[_0xd67d('0x39')][_0xd67d('0xcb')]);_0xcc455b[_0xd67d('0x38')]=qs[_0xd67d('0xcc')](_[_0xd67d('0xd2')](_0x445f05['query'],_0x35ad38[_0xd67d('0xcc')]));_0xcc455b[_0xd67d('0x38')][_0xd67d('0xd7')]=_0x45b668['id'];if(_0x445f05['query']['filter']){_0xcc455b['where']=_[_0xd67d('0x4b')](_0xcc455b[_0xd67d('0x38')],{'$or':_['map'](_0xcc455b[_0xd67d('0x3f')],function(_0x195dd5){var _0x4032ad={};_0x4032ad[_0x195dd5]={'$like':'%'+_0x445f05['query'][_0xd67d('0xcd')]+'%'};return _0x4032ad;})});}_0xcc455b=_[_0xd67d('0x4b')]({},_0xcc455b,_0x445f05[_0xd67d('0xce')]);return db[_0xd67d('0xd6')][_0xd67d('0x18')]({'where':_0xcc455b[_0xd67d('0x38')]})['then'](function(_0x478f16){_0x48bd8a['count']=_0x478f16;if(_0x445f05[_0xd67d('0x39')][_0xd67d('0x3a')]){_0xcc455b['include']=[{'all':!![]}];}return db[_0xd67d('0xd6')][_0xd67d('0x7f')](_0xcc455b);})[_0xd67d('0x1b')](function(_0xfde616){_0x48bd8a['rows']=_0xfde616;return _0x48bd8a;});}})[_0xd67d('0x1b')](respondWithFilteredResult(_0x4f9349,_0xcc455b))[_0xd67d('0x49')](handleError(_0x4f9349,null));};exports[_0xd67d('0xd8')]=function(_0x40cb1f,_0x562b8a){var _0x4ec793={'raw':!![],'where':{}};var _0x2c9a76={};var _0x2a1cdb={'count':0x0,'rows':[]};return db['User'][_0xd67d('0x8a')]({'where':{'id':_0x40cb1f['params']['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x562b8a,null))[_0xd67d('0x1b')](function(_0x3141a5){if(_0x3141a5){_0x2c9a76[_0xd67d('0xc5')]=_['keys'](db[_0xd67d('0xd9')][_0xd67d('0xc7')]);_0x2c9a76[_0xd67d('0x39')]=_[_0xd67d('0xc8')](_0x40cb1f[_0xd67d('0x39')]);_0x2c9a76[_0xd67d('0xcc')]=_[_0xd67d('0xc9')](_0x2c9a76['model'],_0x2c9a76[_0xd67d('0x39')]);_0x4ec793[_0xd67d('0x3f')]=_[_0xd67d('0xc9')](_0x2c9a76[_0xd67d('0xc5')],qs[_0xd67d('0xd1')](_0x40cb1f[_0xd67d('0x39')]['fields']));_0x4ec793['attributes']=_0x4ec793['attributes']['length']?_0x4ec793[_0xd67d('0x3f')]:_0x2c9a76[_0xd67d('0xc5')];if(!_0x40cb1f[_0xd67d('0x39')][_0xd67d('0xbe')](_0xd67d('0xd0'))){_0x4ec793[_0xd67d('0x16')]=qs[_0xd67d('0x16')](_0x40cb1f['query'][_0xd67d('0x16')]);_0x4ec793[_0xd67d('0x15')]=qs['offset'](_0x40cb1f[_0xd67d('0x39')][_0xd67d('0x15')]);}_0x4ec793[_0xd67d('0xca')]=qs['sort'](_0x40cb1f[_0xd67d('0x39')][_0xd67d('0xcb')]);_0x4ec793[_0xd67d('0x38')]=qs[_0xd67d('0xcc')](_['pick'](_0x40cb1f['query'],_0x2c9a76['filters']));_0x4ec793['where']['UserId']=_0x3141a5['id'];if(_0x40cb1f[_0xd67d('0x39')][_0xd67d('0xcd')]){_0x4ec793[_0xd67d('0x38')]=_[_0xd67d('0x4b')](_0x4ec793['where'],{'$or':_[_0xd67d('0x7d')](_0x4ec793[_0xd67d('0x3f')],function(_0x3b9029){var _0x55f64a={};_0x55f64a[_0x3b9029]={'$like':'%'+_0x40cb1f[_0xd67d('0x39')][_0xd67d('0xcd')]+'%'};return _0x55f64a;})});}_0x4ec793=_[_0xd67d('0x4b')]({},_0x4ec793,_0x40cb1f[_0xd67d('0xce')]);return db[_0xd67d('0xd9')][_0xd67d('0x18')]({'where':_0x4ec793[_0xd67d('0x38')]})[_0xd67d('0x1b')](function(_0x35669e){_0x2a1cdb[_0xd67d('0x18')]=_0x35669e;if(_0x40cb1f[_0xd67d('0x39')][_0xd67d('0x3a')]){_0x4ec793[_0xd67d('0x3b')]=[{'all':!![]}];}return db['ScreenRecording'][_0xd67d('0x7f')](_0x4ec793);})[_0xd67d('0x1b')](function(_0x1d69f3){_0x2a1cdb['rows']=_0x1d69f3;return _0x2a1cdb;});}})['then'](respondWithFilteredResult(_0x562b8a,_0x4ec793))[_0xd67d('0x49')](handleError(_0x562b8a,null));};exports[_0xd67d('0xda')]=function(_0x4d95c3,_0x5e9d45){var _0x142578={};var _0x4c648b={};var _0x42b7b8;var _0x1f71c4;return db[_0xd67d('0x30')][_0xd67d('0x8a')]({'where':{'id':_0x4d95c3[_0xd67d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5e9d45,null))[_0xd67d('0x1b')](function(_0x3a18ed){if(_0x3a18ed){_0x42b7b8=_0x3a18ed;_0x4c648b[_0xd67d('0xc5')]=_[_0xd67d('0xc8')](db[_0xd67d('0xdb')]['rawAttributes']);_0x4c648b['query']=_[_0xd67d('0xc8')](_0x4d95c3['query']);_0x4c648b[_0xd67d('0xcc')]=_[_0xd67d('0xc9')](_0x4c648b[_0xd67d('0xc5')],_0x4c648b[_0xd67d('0x39')]);_0x142578[_0xd67d('0x3f')]=_[_0xd67d('0xc9')](_0x4c648b[_0xd67d('0xc5')],qs[_0xd67d('0xd1')](_0x4d95c3[_0xd67d('0x39')][_0xd67d('0xd1')]));_0x142578[_0xd67d('0x3f')]=_0x142578[_0xd67d('0x3f')][_0xd67d('0x42')]?_0x142578[_0xd67d('0x3f')]:_0x4c648b['model'];_0x142578[_0xd67d('0xca')]=qs['sort'](_0x4d95c3[_0xd67d('0x39')][_0xd67d('0xcb')]);_0x142578[_0xd67d('0x38')]=qs[_0xd67d('0xcc')](_[_0xd67d('0xd2')](_0x4d95c3['query'],_0x4c648b[_0xd67d('0xcc')]));if(_0x4d95c3[_0xd67d('0x39')][_0xd67d('0xcd')]){_0x142578[_0xd67d('0x38')]=_[_0xd67d('0x4b')](_0x142578['where'],{'$or':_['map'](_0x142578[_0xd67d('0x3f')],function(_0x227b89){var _0x89ff46={};_0x89ff46[_0x227b89]={'$like':'%'+_0x4d95c3['query']['filter']+'%'};return _0x89ff46;})});}_0x142578=_[_0xd67d('0x4b')]({},_0x142578,_0x4d95c3[_0xd67d('0xce')]);return _0x42b7b8[_0xd67d('0xda')](_0x142578);}})[_0xd67d('0x1b')](function(_0x512996){if(_0x512996){_0x1f71c4=_0x512996['length'];if(!_0x4d95c3['query'][_0xd67d('0xbe')]('nolimit')){_0x142578[_0xd67d('0x16')]=qs['limit'](_0x4d95c3[_0xd67d('0x39')][_0xd67d('0x16')]);_0x142578['offset']=qs[_0xd67d('0x15')](_0x4d95c3[_0xd67d('0x39')][_0xd67d('0x15')]);}return _0x42b7b8[_0xd67d('0xda')](_0x142578);}})[_0xd67d('0x1b')](function(_0x551a20){if(_0x551a20){return _0x551a20?{'count':_0x1f71c4,'rows':_0x551a20}:null;}})[_0xd67d('0x1b')](respondWithResult(_0x5e9d45,null))['catch'](handleError(_0x5e9d45,null));};exports[_0xd67d('0xdc')]=function(_0x16b3db,_0x353f91){var _0x555b1c={};var _0x43d032={};var _0x5079ec;var _0x24b1ba;return db[_0xd67d('0x30')][_0xd67d('0x8a')]({'where':{'id':_0x16b3db[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x353f91,null))[_0xd67d('0x1b')](function(_0x77ed53){if(_0x77ed53){_0x5079ec=_0x77ed53;_0x43d032[_0xd67d('0xc5')]=_[_0xd67d('0xc8')](db['OpenchannelInteraction'][_0xd67d('0xc7')]);_0x43d032[_0xd67d('0x39')]=_[_0xd67d('0xc8')](_0x16b3db[_0xd67d('0x39')]);_0x43d032[_0xd67d('0xcc')]=_[_0xd67d('0xc9')](_0x43d032['model'],_0x43d032[_0xd67d('0x39')]);_0x555b1c[_0xd67d('0x3f')]=_[_0xd67d('0xc9')](_0x43d032['model'],qs[_0xd67d('0xd1')](_0x16b3db[_0xd67d('0x39')][_0xd67d('0xd1')]));_0x555b1c[_0xd67d('0x3f')]=_0x555b1c['attributes'][_0xd67d('0x42')]?_0x555b1c[_0xd67d('0x3f')]:_0x43d032[_0xd67d('0xc5')];_0x555b1c[_0xd67d('0xca')]=qs[_0xd67d('0xcb')](_0x16b3db[_0xd67d('0x39')][_0xd67d('0xcb')]);_0x555b1c[_0xd67d('0x38')]=qs[_0xd67d('0xcc')](_[_0xd67d('0xd2')](_0x16b3db['query'],_0x43d032['filters']));if(_0x16b3db[_0xd67d('0x39')]['filter']){_0x555b1c[_0xd67d('0x38')]=_['merge'](_0x555b1c['where'],{'$or':_[_0xd67d('0x7d')](_0x555b1c[_0xd67d('0x3f')],function(_0xae315a){var _0x528a88={};_0x528a88[_0xae315a]={'$like':'%'+_0x16b3db['query'][_0xd67d('0xcd')]+'%'};return _0x528a88;})});}_0x555b1c=_[_0xd67d('0x4b')]({},_0x555b1c,_0x16b3db['options']);return _0x5079ec[_0xd67d('0xdc')](_0x555b1c);}})[_0xd67d('0x1b')](function(_0x974480){if(_0x974480){_0x24b1ba=_0x974480[_0xd67d('0x42')];if(!_0x16b3db['query'][_0xd67d('0xbe')](_0xd67d('0xd0'))){_0x555b1c['limit']=qs[_0xd67d('0x16')](_0x16b3db['query'][_0xd67d('0x16')]);_0x555b1c[_0xd67d('0x15')]=qs['offset'](_0x16b3db['query'][_0xd67d('0x15')]);}return _0x5079ec[_0xd67d('0xdc')](_0x555b1c);}})['then'](function(_0x3de29c){if(_0x3de29c){return _0x3de29c?{'count':_0x24b1ba,'rows':_0x3de29c}:null;}})[_0xd67d('0x1b')](respondWithResult(_0x353f91,null))[_0xd67d('0x49')](handleError(_0x353f91,null));};exports['getMailInteractions']=function(_0x164c3d,_0x56c2ec){var _0x5ed7ea={'raw':!![],'where':{}};var _0x581aec={};var _0x584cfe={'count':0x0,'rows':[]};return db[_0xd67d('0x30')][_0xd67d('0x8a')]({'where':{'id':_0x164c3d[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x56c2ec,null))[_0xd67d('0x1b')](function(_0x146426){if(_0x146426){_0x581aec[_0xd67d('0xc5')]=_[_0xd67d('0xc8')](db[_0xd67d('0xdd')][_0xd67d('0xc7')]);_0x581aec[_0xd67d('0x39')]=_[_0xd67d('0xc8')](_0x164c3d[_0xd67d('0x39')]);_0x581aec[_0xd67d('0xcc')]=_[_0xd67d('0xc9')](_0x581aec[_0xd67d('0xc5')],_0x581aec[_0xd67d('0x39')]);_0x5ed7ea['attributes']=_[_0xd67d('0xc9')](_0x581aec[_0xd67d('0xc5')],qs[_0xd67d('0xd1')](_0x164c3d[_0xd67d('0x39')]['fields']));_0x5ed7ea['attributes']=_0x5ed7ea[_0xd67d('0x3f')][_0xd67d('0x42')]?_0x5ed7ea[_0xd67d('0x3f')]:_0x581aec['model'];if(!_0x164c3d[_0xd67d('0x39')][_0xd67d('0xbe')]('nolimit')){_0x5ed7ea[_0xd67d('0x16')]=qs['limit'](_0x164c3d[_0xd67d('0x39')][_0xd67d('0x16')]);_0x5ed7ea['offset']=qs[_0xd67d('0x15')](_0x164c3d[_0xd67d('0x39')]['offset']);}_0x5ed7ea[_0xd67d('0xca')]=qs[_0xd67d('0xcb')](_0x164c3d[_0xd67d('0x39')][_0xd67d('0xcb')]);_0x5ed7ea[_0xd67d('0x38')]=qs[_0xd67d('0xcc')](_['pick'](_0x164c3d[_0xd67d('0x39')],_0x581aec[_0xd67d('0xcc')]));_0x5ed7ea['where'][_0xd67d('0xd7')]=_0x146426['id'];if(_0x164c3d[_0xd67d('0x39')][_0xd67d('0xcd')]){_0x5ed7ea[_0xd67d('0x38')]=_[_0xd67d('0x4b')](_0x5ed7ea[_0xd67d('0x38')],{'$or':_[_0xd67d('0x7d')](_0x5ed7ea[_0xd67d('0x3f')],function(_0x382f85){var _0x41c0f5={};_0x41c0f5[_0x382f85]={'$like':'%'+_0x164c3d[_0xd67d('0x39')][_0xd67d('0xcd')]+'%'};return _0x41c0f5;})});}_0x5ed7ea=_[_0xd67d('0x4b')]({},_0x5ed7ea,_0x164c3d[_0xd67d('0xce')]);return db['MailInteraction'][_0xd67d('0x18')]({'where':_0x5ed7ea[_0xd67d('0x38')]})[_0xd67d('0x1b')](function(_0x509a29){_0x584cfe[_0xd67d('0x18')]=_0x509a29;if(_0x164c3d[_0xd67d('0x39')]['includeAll']){_0x5ed7ea[_0xd67d('0x3b')]=[{'all':!![]}];}return db[_0xd67d('0xdd')]['findAll'](_0x5ed7ea);})[_0xd67d('0x1b')](function(_0x205f44){_0x584cfe[_0xd67d('0x41')]=_0x205f44;return _0x584cfe;});}})[_0xd67d('0x1b')](respondWithFilteredResult(_0x56c2ec,_0x5ed7ea))['catch'](handleError(_0x56c2ec,null));};exports[_0xd67d('0xde')]=function(_0x3f1584,_0x36f8c0){var _0x4a7b2b={};var _0x332cdb={};var _0x3a79e6;var _0x384a58;return db[_0xd67d('0x30')][_0xd67d('0x8a')]({'where':{'id':_0x3f1584[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x36f8c0,null))['then'](function(_0x24e81c){if(_0x24e81c){_0x3a79e6=_0x24e81c;_0x332cdb[_0xd67d('0xc5')]=_[_0xd67d('0xc8')](db[_0xd67d('0xdf')][_0xd67d('0xc7')]);_0x332cdb[_0xd67d('0x39')]=_[_0xd67d('0xc8')](_0x3f1584[_0xd67d('0x39')]);_0x332cdb[_0xd67d('0xcc')]=_['intersection'](_0x332cdb['model'],_0x332cdb[_0xd67d('0x39')]);_0x4a7b2b[_0xd67d('0x3f')]=_[_0xd67d('0xc9')](_0x332cdb['model'],qs[_0xd67d('0xd1')](_0x3f1584[_0xd67d('0x39')][_0xd67d('0xd1')]));_0x4a7b2b['attributes']=_0x4a7b2b[_0xd67d('0x3f')][_0xd67d('0x42')]?_0x4a7b2b[_0xd67d('0x3f')]:_0x332cdb[_0xd67d('0xc5')];_0x4a7b2b[_0xd67d('0xca')]=qs[_0xd67d('0xcb')](_0x3f1584[_0xd67d('0x39')]['sort']);_0x4a7b2b[_0xd67d('0x38')]=qs[_0xd67d('0xcc')](_[_0xd67d('0xd2')](_0x3f1584[_0xd67d('0x39')],_0x332cdb[_0xd67d('0xcc')]));if(_0x3f1584['query'][_0xd67d('0xcd')]){_0x4a7b2b[_0xd67d('0x38')]=_[_0xd67d('0x4b')](_0x4a7b2b[_0xd67d('0x38')],{'$or':_['map'](_0x4a7b2b[_0xd67d('0x3f')],function(_0x2080f9){var _0x48a657={};_0x48a657[_0x2080f9]={'$like':'%'+_0x3f1584['query'][_0xd67d('0xcd')]+'%'};return _0x48a657;})});}_0x4a7b2b=_['merge']({},_0x4a7b2b,_0x3f1584['options']);return _0x3a79e6['getSmsInteractions'](_0x4a7b2b);}})[_0xd67d('0x1b')](function(_0x501455){if(_0x501455){_0x384a58=_0x501455[_0xd67d('0x42')];if(!_0x3f1584['query'][_0xd67d('0xbe')](_0xd67d('0xd0'))){_0x4a7b2b[_0xd67d('0x16')]=qs[_0xd67d('0x16')](_0x3f1584[_0xd67d('0x39')][_0xd67d('0x16')]);_0x4a7b2b[_0xd67d('0x15')]=qs[_0xd67d('0x15')](_0x3f1584[_0xd67d('0x39')][_0xd67d('0x15')]);}return _0x3a79e6['getSmsInteractions'](_0x4a7b2b);}})[_0xd67d('0x1b')](function(_0x5eb0e1){if(_0x5eb0e1){return _0x5eb0e1?{'count':_0x384a58,'rows':_0x5eb0e1}:null;}})[_0xd67d('0x1b')](respondWithResult(_0x36f8c0,null))[_0xd67d('0x49')](handleError(_0x36f8c0,null));};exports[_0xd67d('0xe0')]=function(_0x54510c,_0x2a9943){var _0x1d44fe={};var _0x9783f0={};var _0x44e6a0;var _0x588f75;return db[_0xd67d('0x30')]['findOne']({'where':{'id':_0x54510c[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x2a9943,null))[_0xd67d('0x1b')](function(_0x21bff1){if(_0x21bff1){_0x44e6a0=_0x21bff1;_0x9783f0['model']=_[_0xd67d('0xc8')](db[_0xd67d('0xe1')]['rawAttributes']);_0x9783f0[_0xd67d('0x39')]=_[_0xd67d('0xc8')](_0x54510c[_0xd67d('0x39')]);_0x9783f0[_0xd67d('0xcc')]=_[_0xd67d('0xc9')](_0x9783f0[_0xd67d('0xc5')],_0x9783f0['query']);_0x1d44fe['attributes']=_[_0xd67d('0xc9')](_0x9783f0[_0xd67d('0xc5')],qs[_0xd67d('0xd1')](_0x54510c['query']['fields']));_0x1d44fe[_0xd67d('0x3f')]=_0x1d44fe['attributes'][_0xd67d('0x42')]?_0x1d44fe['attributes']:_0x9783f0[_0xd67d('0xc5')];_0x1d44fe[_0xd67d('0xca')]=qs[_0xd67d('0xcb')](_0x54510c[_0xd67d('0x39')][_0xd67d('0xcb')]);_0x1d44fe[_0xd67d('0x38')]=qs['filters'](_[_0xd67d('0xd2')](_0x54510c[_0xd67d('0x39')],_0x9783f0[_0xd67d('0xcc')]));if(_0x54510c[_0xd67d('0x39')][_0xd67d('0xcd')]){_0x1d44fe[_0xd67d('0x38')]=_[_0xd67d('0x4b')](_0x1d44fe['where'],{'$or':_[_0xd67d('0x7d')](_0x1d44fe[_0xd67d('0x3f')],function(_0x5c65fe){var _0x4dff55={};_0x4dff55[_0x5c65fe]={'$like':'%'+_0x54510c[_0xd67d('0x39')]['filter']+'%'};return _0x4dff55;})});}_0x1d44fe=_[_0xd67d('0x4b')]({},_0x1d44fe,_0x54510c[_0xd67d('0xce')]);return _0x44e6a0[_0xd67d('0xe0')](_0x1d44fe);}})[_0xd67d('0x1b')](function(_0x4c0afc){if(_0x4c0afc){_0x588f75=_0x4c0afc[_0xd67d('0x42')];if(!_0x54510c[_0xd67d('0x39')][_0xd67d('0xbe')]('nolimit')){_0x1d44fe[_0xd67d('0x16')]=qs[_0xd67d('0x16')](_0x54510c[_0xd67d('0x39')][_0xd67d('0x16')]);_0x1d44fe[_0xd67d('0x15')]=qs[_0xd67d('0x15')](_0x54510c[_0xd67d('0x39')][_0xd67d('0x15')]);}return _0x44e6a0[_0xd67d('0xe0')](_0x1d44fe);}})[_0xd67d('0x1b')](function(_0x3df351){if(_0x3df351){return _0x3df351?{'count':_0x588f75,'rows':_0x3df351}:null;}})['then'](respondWithResult(_0x2a9943,null))[_0xd67d('0x49')](handleError(_0x2a9943,null));};exports[_0xd67d('0xe2')]=function(_0x2da5af,_0x542c7b){var _0x49d68d={};var _0x5a735e={};var _0x5e217b;var _0x179bed;return db[_0xd67d('0x30')][_0xd67d('0x8a')]({'where':{'id':_0x2da5af[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x542c7b,null))['then'](function(_0x37da15){if(_0x37da15){_0x5e217b=_0x37da15;_0x5a735e[_0xd67d('0xc5')]=_[_0xd67d('0xc8')](db['WhatsappInteraction'][_0xd67d('0xc7')]);_0x5a735e['query']=_[_0xd67d('0xc8')](_0x2da5af[_0xd67d('0x39')]);_0x5a735e['filters']=_['intersection'](_0x5a735e[_0xd67d('0xc5')],_0x5a735e[_0xd67d('0x39')]);_0x49d68d[_0xd67d('0x3f')]=_[_0xd67d('0xc9')](_0x5a735e[_0xd67d('0xc5')],qs[_0xd67d('0xd1')](_0x2da5af[_0xd67d('0x39')][_0xd67d('0xd1')]));_0x49d68d[_0xd67d('0x3f')]=_0x49d68d[_0xd67d('0x3f')][_0xd67d('0x42')]?_0x49d68d['attributes']:_0x5a735e[_0xd67d('0xc5')];_0x49d68d[_0xd67d('0xca')]=qs[_0xd67d('0xcb')](_0x2da5af['query'][_0xd67d('0xcb')]);_0x49d68d[_0xd67d('0x38')]=qs[_0xd67d('0xcc')](_['pick'](_0x2da5af[_0xd67d('0x39')],_0x5a735e[_0xd67d('0xcc')]));if(_0x2da5af[_0xd67d('0x39')][_0xd67d('0xcd')]){_0x49d68d[_0xd67d('0x38')]=_[_0xd67d('0x4b')](_0x49d68d[_0xd67d('0x38')],{'$or':_[_0xd67d('0x7d')](_0x49d68d['attributes'],function(_0x511897){var _0x3c80fd={};_0x3c80fd[_0x511897]={'$like':'%'+_0x2da5af[_0xd67d('0x39')][_0xd67d('0xcd')]+'%'};return _0x3c80fd;})});}_0x49d68d=_[_0xd67d('0x4b')]({},_0x49d68d,_0x2da5af['options']);return _0x5e217b['getWhatsappInteractions'](_0x49d68d);}})['then'](function(_0x105027){if(_0x105027){_0x179bed=_0x105027['length'];if(!_0x2da5af[_0xd67d('0x39')][_0xd67d('0xbe')](_0xd67d('0xd0'))){_0x49d68d[_0xd67d('0x16')]=qs[_0xd67d('0x16')](_0x2da5af[_0xd67d('0x39')][_0xd67d('0x16')]);_0x49d68d[_0xd67d('0x15')]=qs[_0xd67d('0x15')](_0x2da5af['query'][_0xd67d('0x15')]);}return _0x5e217b[_0xd67d('0xe2')](_0x49d68d);}})['then'](function(_0x1c2fd0){if(_0x1c2fd0){return _0x1c2fd0?{'count':_0x179bed,'rows':_0x1c2fd0}:null;}})[_0xd67d('0x1b')](respondWithResult(_0x542c7b,null))[_0xd67d('0x49')](handleError(_0x542c7b,null));};exports['login']=function(_0x1365f1,_0x20b7bb,_0x13b4c1){var _0x50df43;var _0x3aee4e;var _0x82b15a;var _0x7b71c1=!_[_0xd67d('0x5a')](_0x1365f1['params']['id'])?_0x1365f1[_0xd67d('0x4a')]['id']:!_[_0xd67d('0x5a')](_0x1365f1[_0xd67d('0x23')]['id'])?_0x1365f1[_0xd67d('0x23')]['id']:null;return db['User']['find']({'where':{'id':_0x7b71c1,'role':{'$or':[_0xd67d('0x21'),'user',_0xd67d('0x1d')]}},'attributes':['id',_0xd67d('0x2a'),'phone',_0xd67d('0xe3'),'role',_0xd67d('0x5b'),_0xd67d('0x92')]})[_0xd67d('0x1b')](function(_0x4e2b3d){if(_0x4e2b3d){if(_0x4e2b3d[_0xd67d('0x1c')]===_0xd67d('0x1d')){_0x50df43=_0x4e2b3d;if(_0x1365f1[_0xd67d('0x50')][_0xd67d('0x93')]){_0x82b15a=util[_0xd67d('0xa0')](_0xd67d('0xe4'),_0x50df43[_0x1365f1[_0xd67d('0x50')][_0xd67d('0x93')]]);}else if(_0x1365f1[_0xd67d('0x50')]['intrf']){_0x82b15a=util[_0xd67d('0xa0')](_0xd67d('0xa1'),_0x1365f1[_0xd67d('0x50')]['intrf']);}else{_0x82b15a=util[_0xd67d('0xa0')](_0xd67d('0xa1'),_0x50df43[_0xd67d('0x2a')]);}socket['to'](util[_0xd67d('0xa0')](_0xd67d('0xe5'),_0x50df43[_0xd67d('0x2a')]))['emit'](_0xd67d('0xe6'),{'user':{'id':_0x50df43['id'],'name':_0x50df43[_0xd67d('0x2a')]},'ip':_0x1365f1[_0xd67d('0xe7')][_0xd67d('0xe8')]||_0x1365f1[_0xd67d('0xe9')][_0xd67d('0xea')]||_0x1365f1[_0xd67d('0xeb')][_0xd67d('0xea')]||_0x1365f1['connection']['socket']['remoteAddress']});return db['UserVoiceQueueRt'][_0xd67d('0x2c')]({'where':{'membername':_0x50df43['name']},'individualHooks':!![]});}}else{throw new db[(_0xd67d('0x83'))][(_0xd67d('0x84'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x50df43){return _0x50df43[_0xd67d('0xec')]({'raw':!![]});}})['then'](function(_0x52fb32){if(_0x50df43){if(_0x52fb32){_0x3aee4e=_0x52fb32;if(_0x3aee4e[_0xd67d('0x42')]){var _0x1d96a3=_0x3aee4e[_0xd67d('0x7d')](function(_0x5e4d0f){var _0x522cb3={'membername':_0x50df43[_0xd67d('0x2a')],'UserId':_0x50df43['id'],'queue_name':_0x5e4d0f[_0xd67d('0x2a')],'VoiceQueueId':_0x5e4d0f['id'],'interface':_0x82b15a,'paused':_0x50df43[_0xd67d('0x92')]||![],'penalty':_0x5e4d0f[_0xd67d('0xed')]||0x0};return db[_0xd67d('0xa3')]['upsert'](_0x522cb3);});return Promise['all'](_0x1d96a3);}}}})[_0xd67d('0x1b')](function(){if(_0x50df43){return db[_0xd67d('0xee')]['findAll']({'where':{'membername':_0x50df43[_0xd67d('0x2a')],'exitAt':null}});}})[_0xd67d('0x1b')](function(_0x548b14){if(_0x50df43){var _0x102c03=[];_0x548b14[_0xd67d('0xef')](function(_0x219ebb){_0x102c03['push'](_0x219ebb[_0xd67d('0x4f')]({'exitAt':moment()[_0xd67d('0xa0')](_0xd67d('0xf0'))}));});return Promise[_0xd67d('0x48')](_0x102c03);}})[_0xd67d('0x1b')](function(){if(_0x50df43){var _0x1b28a1=[];var _0x28e04b=[];var _0x4d2865=utils[_0xd67d('0xf1')]();var _0x530e27={'membername':_0x50df43[_0xd67d('0x2a')],'interface':_0x82b15a,'enterAt':moment()[_0xd67d('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x50df43[_0xd67d('0x1c')],'internal':_0x50df43[_0xd67d('0x5b')]};_0x4d2865[_0xd67d('0xef')](function(_0x569f63){_0x1b28a1[_0xd67d('0x40')](_[_0xd67d('0x4b')]({'channel':_0x569f63,'type':_0xd67d('0xf2'),'data1':_0x1365f1[_0xd67d('0x50')][_0xd67d('0xf3')],'data2':_0x82b15a},_0x530e27));if(_0x50df43[_0xd67d('0x92')]){_0x28e04b[_0xd67d('0x40')](_[_0xd67d('0x4b')]({'channel':_0x569f63,'type':_0xd67d('0xf4'),'data1':_0xd67d('0xf5')},_0x530e27));}});return db[_0xd67d('0xee')][_0xd67d('0x7b')](_0x1b28a1[_0xd67d('0xbb')](_0x28e04b),{'individualHooks':!![]});}})['then'](function(){if(_0x50df43){return _0x50df43[_0xd67d('0x4f')]({'online':!![],'lastLoginAt':moment()[_0xd67d('0xa0')](_0xd67d('0xf0')),'voicePause':_0x50df43[_0xd67d('0x92')]||![],'mailPause':_0x50df43[_0xd67d('0x92')]||![],'chatPause':_0x50df43[_0xd67d('0x92')]||![],'faxPause':_0x50df43['loginInPause']||![],'smsPause':_0x50df43['loginInPause']||![],'openchannelPause':_0x50df43[_0xd67d('0x92')]||![],'whatsappPause':_0x50df43[_0xd67d('0x92')]||![],'pauseType':_0x50df43[_0xd67d('0x92')]?_0xd67d('0xf5'):null,'interface':_0x82b15a,'lastPauseAt':moment()['format'](_0xd67d('0xf0'))});}})[_0xd67d('0x1b')](function(_0x483eaa){if(_0x1365f1[_0xd67d('0xf6')]){return _0x13b4c1();}else{return Promise[_0xd67d('0xf7')](_0x483eaa)['then'](respondWithResult(_0x20b7bb,null));}})[_0xd67d('0x49')](handleError(_0x20b7bb,null));};exports['logout']=function(_0x4da616,_0x3cafb1){var _0x3198d4;return db[_0xd67d('0x30')][_0xd67d('0x28')]({'where':{'id':_0x4da616[_0xd67d('0x4a')]['id'],'role':_0xd67d('0x1d')},'attributes':['id','name',_0xd67d('0x1c')]})[_0xd67d('0x1b')](handleEntityNotFound(_0x3cafb1,null))[_0xd67d('0x1b')](function(_0x3c27af){if(_0x3c27af){_0x3198d4=_0x3c27af;return db[_0xd67d('0xa3')][_0xd67d('0x2c')]({'where':{'membername':_0x3198d4[_0xd67d('0x2a')]},'individualHooks':!![]});}})[_0xd67d('0x1b')](function(){return db[_0xd67d('0xee')][_0xd67d('0x7f')]({'where':{'membername':_0x3198d4[_0xd67d('0x2a')],'exitAt':null}});})[_0xd67d('0x1b')](function(_0x15eae6){var _0x2c6090=[];_0x15eae6[_0xd67d('0xef')](function(_0x5bc71c){_0x2c6090['push'](_0x5bc71c[_0xd67d('0x4f')]({'exitAt':moment()['format'](_0xd67d('0xf0'))}));});return Promise[_0xd67d('0x48')](_0x2c6090);})[_0xd67d('0x1b')](function(){return _0x3198d4[_0xd67d('0x4f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd67d('0x1b')](respondWithResult(_0x3cafb1,null))[_0xd67d('0x49')](handleError(_0x3cafb1,null));};exports[_0xd67d('0xf8')]=function(_0x191948,_0x43dfb6){var _0x42fa14;return db[_0xd67d('0xa3')][_0xd67d('0x4f')]({'paused':0x1},{'where':{'UserId':_0x191948['params']['id']},'individualHooks':!![]})[_0xd67d('0x1b')](function(){return db[_0xd67d('0x30')][_0xd67d('0x28')]({'where':{'id':_0x191948[_0xd67d('0x4a')]['id'],'role':_0xd67d('0x1d')},'attributes':['id',_0xd67d('0x2a'),_0xd67d('0x1c'),_0xd67d('0x5b'),_0xd67d('0x93'),_0xd67d('0x91')]});})['then'](handleEntityNotFound(_0x43dfb6,null))['then'](function(_0x5c5c84){if(_0x5c5c84){_0x42fa14=_0x5c5c84;return db['MemberReport'][_0xd67d('0x7f')]({'where':{'membername':_0x42fa14[_0xd67d('0x2a')],'type':_0xd67d('0xf4'),'exitAt':null}});}})['then'](function(_0x55176f){if(_0x55176f[_0xd67d('0x42')]){var _0x2a748e=moment()[_0xd67d('0xa0')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x462126=0x0,_0x36741d=_0x55176f[_0xd67d('0x42')];_0x462126<_0x36741d;_0x462126++){_0x55176f[_0x462126][_0xd67d('0xf9')]({'exitAt':_0x2a748e});}}})[_0xd67d('0x1b')](function(){var _0xcc31e9=[];var _0x215fcb=utils['getChannels']();_0x215fcb[_0xd67d('0xef')](function(_0x21eaf0){_0xcc31e9['push']({'channel':_0x21eaf0,'membername':_0x42fa14[_0xd67d('0x2a')],'interface':_['isNil'](_0x42fa14[_0xd67d('0x93')])?util[_0xd67d('0xa0')](_0xd67d('0xa1'),_0x42fa14['name']):_0x42fa14['interface'],'type':_0xd67d('0xf4'),'enterAt':moment()[_0xd67d('0xa0')](_0xd67d('0xf0')),'data1':_0x191948[_0xd67d('0x50')][_0xd67d('0x32')]||_0xd67d('0xfa'),'role':_0x42fa14['role'],'internal':_0x42fa14[_0xd67d('0x5b')]});});return db[_0xd67d('0xee')][_0xd67d('0x7b')](_0xcc31e9,{'individualHooks':!![]});})['then'](function(){return _0x42fa14['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x191948['body'][_0xd67d('0x32')]||_0xd67d('0xfa'),'lastPauseAt':moment()[_0xd67d('0xa0')](_0xd67d('0xf0'))});})[_0xd67d('0x1b')](respondWithResult(_0x43dfb6,null))[_0xd67d('0x49')](handleError(_0x43dfb6,null));};exports[_0xd67d('0xfb')]=function(_0x404345,_0x3e9e14){if(_0x404345[_0xd67d('0x50')][_0xd67d('0x90')]&&!utils[_0xd67d('0x94')](_0x404345[_0xd67d('0x50')][_0xd67d('0x90')])){throw new APIBadRequestError(util['format'](_0xd67d('0xfc'),_0x404345[_0xd67d('0x50')][_0xd67d('0x90')]));}return db[_0xd67d('0x30')]['find']({'where':{'id':_0x404345['params']['id']},'attributes':['id',_0xd67d('0x2a'),_0xd67d('0x1c'),'internal',_0xd67d('0x93'),_0xd67d('0x91'),_0xd67d('0xa2'),_0xd67d('0xfd'),_0xd67d('0xfe'),'faxPause','openchannelPause',_0xd67d('0xff'),_0xd67d('0x100'),_0xd67d('0x101'),'lastPauseAt']})[_0xd67d('0x1b')](function(_0x444daa){if(!_0x444daa){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x404345['params']['id']));}return _0x444daa[_0xd67d('0xfb')](_0x404345[_0xd67d('0x50')][_0xd67d('0x90')]);})['then'](respondWithResult(_0x3e9e14,null))[_0xd67d('0x49')](APIHandleError(_0x3e9e14));};exports['getTeams']=function(_0x168955,_0x516e7a){var _0x50d584={};var _0x581169={};var _0x36c743;var _0x90e16b;return db[_0xd67d('0x30')]['findOne']({'where':{'id':_0x168955[_0xd67d('0x4a')]['id']}})[_0xd67d('0x1b')](handleEntityNotFound(_0x516e7a,null))[_0xd67d('0x1b')](function(_0x4cf483){if(_0x4cf483){_0x36c743=_0x4cf483;_0x581169['model']=_[_0xd67d('0xc8')](db[_0xd67d('0x102')]['rawAttributes']);_0x581169[_0xd67d('0x39')]=_[_0xd67d('0xc8')](_0x168955['query']);_0x581169['filters']=_[_0xd67d('0xc9')](_0x581169[_0xd67d('0xc5')],_0x581169[_0xd67d('0x39')]);_0x50d584['attributes']=_[_0xd67d('0xc9')](_0x581169[_0xd67d('0xc5')],qs[_0xd67d('0xd1')](_0x168955[_0xd67d('0x39')]['fields']));_0x50d584[_0xd67d('0x3f')]=_0x50d584['attributes'][_0xd67d('0x42')]?_0x50d584[_0xd67d('0x3f')]:_0x581169[_0xd67d('0xc5')];_0x50d584[_0xd67d('0xca')]=qs[_0xd67d('0xcb')](_0x168955[_0xd67d('0x39')]['sort']);_0x50d584[_0xd67d('0x38')]=qs[_0xd67d('0xcc')](_[_0xd67d('0xd2')](_0x168955[_0xd67d('0x39')],_0x581169['filters']));if(_0x168955[_0xd67d('0x39')][_0xd67d('0xcd')]){_0x50d584[_0xd67d('0x38')]=_[_0xd67d('0x4b')](_0x50d584['where'],{'$or':_[_0xd67d('0x7d')](_0x50d584['attributes'],function(_0x4ad969){var _0x284584={};_0x284584[_0x4ad969]={'$like':'%'+_0x168955[_0xd67d('0x39')][_0xd67d('0xcd')]+'%'};return _0x284584;})});}_0x50d584=_[_0xd67d('0x4b')]({},_0x50d584,_0x168955[_0xd67d('0xce')]);return _0x36c743[_0xd67d('0x103')](_0x50d584);}})[_0xd67d('0x1b')](function(_0x40956d){if(_0x40956d){_0x90e16b=_0x40956d[_0xd67d('0x42')];if(!_0x168955['query'][_0xd67d('0xbe')](_0xd67d('0xd0'))){_0x50d584[_0xd67d('0x16')]=qs[_0xd67d('0x16')](_0x168955[_0xd67d('0x39')]['limit']);_0x50d584['offset']=qs[_0xd67d('0x15')](_0x168955[_0xd67d('0x39')][_0xd67d('0x15')]);}return _0x36c743[_0xd67d('0x103')](_0x50d584);}})['then'](function(_0x8f2f2){if(_0x8f2f2){return _0x8f2f2?{'count':_0x90e16b,'rows':_0x8f2f2}:null;}})[_0xd67d('0x1b')](respondWithResult(_0x516e7a,null))[_0xd67d('0x49')](handleError(_0x516e7a,null));};exports[_0xd67d('0x104')]=function(_0x381eea,_0x2c757e){var _0x1cc248=_0x381eea['params']['id'];var _0x9151aa=_0x381eea[_0xd67d('0x50')]?_0x381eea[_0xd67d('0x50')][_0xd67d('0x53')]:null;var _0x25adfd=[];return Promise[_0xd67d('0xf7')]()[_0xd67d('0x1b')](function(){if(!_0x9151aa)throw new APIBadRequestError(_0xd67d('0x105'));})[_0xd67d('0x1b')](function(){return db[_0xd67d('0x30')][_0xd67d('0x8a')]({'where':{'id':_0x1cc248}});})[_0xd67d('0x1b')](function(_0x168551){if(!_0x168551)throw new APINotFoundError(util[_0xd67d('0xa0')](_0xd67d('0xbd'),_0x381eea['params']['id']));return db[_0xd67d('0x5d')][_0xd67d('0x106')](function(_0x557568){return _0x168551[_0xd67d('0x104')](_0x9151aa,{'transaction':_0x557568})['then'](function(){return db[_0xd67d('0x102')][_0xd67d('0x7f')]({'where':{'id':{'$in':_0x9151aa}}});})[_0xd67d('0x1b')](function(_0x10467e){var _0x5df24d=_['map'](_0x10467e,function(_0x4a708a){return _0x4a708a[_0xd67d('0x107')]();});return Promise[_0xd67d('0x48')](_0x5df24d);})[_0xd67d('0x1b')](function(_0x4de50f){_0x25adfd=_['flattenDeep'](_0x4de50f);var _0x53dce6=_['map'](_0x25adfd,function(_0x5489c5){return _0x5489c5[_0xd67d('0x108')](_0x168551['id'],{'transaction':_0x557568});});return Promise[_0xd67d('0x48')](_0x53dce6);})[_0xd67d('0x1b')](function(){if(!_0x168551[_0xd67d('0x91')])return;var _0x1a7b9f=_[_0xd67d('0xcd')](_0x25adfd,function(_0x328180){return _0x328180[_0xd67d('0x109')](_0xd67d('0x90'))===_0xd67d('0x10a');});var _0x36c7ce=_[_0xd67d('0x7d')](_0x1a7b9f,function(_0xb23c75){return db[_0xd67d('0xa3')]['upsert']({'membername':_0x168551[_0xd67d('0x2a')],'UserId':_0x168551['id'],'queue_name':_0xb23c75[_0xd67d('0x2a')],'VoiceQueueId':_0xb23c75['id'],'interface':_[_0xd67d('0x5a')](_0x168551['interface'])?util[_0xd67d('0xa0')](_0xd67d('0xa1'),_0x168551['name']):_0x168551[_0xd67d('0x93')],'paused':_0x168551[_0xd67d('0xa2')]||![],'penalty':_0x168551[_0xd67d('0x99')]},{'transaction':_0x557568});});return Promise[_0xd67d('0x48')](_0x36c7ce);})[_0xd67d('0x1b')](function(){return db[_0xd67d('0x10b')][_0xd67d('0x7f')]({'where':{'teamId':{'$in':_0x9151aa}}});})[_0xd67d('0x1b')](function(_0x3d1f49){var _0x34957c=_[_0xd67d('0x7d')](_0x3d1f49,function(_0x3b6580){return db[_0xd67d('0x10c')][_0xd67d('0x71')]({'UserId':_0x168551['id'],'VoicePrefixId':_0x3b6580[_0xd67d('0x10d')]},{'transaction':_0x557568});});return Promise[_0xd67d('0x48')](_0x34957c);});});})[_0xd67d('0x1b')](function(){for(var _0x537aab=0x0;_0x537aab<_0x25adfd[_0xd67d('0x42')];_0x537aab++){var _0x33c691=_0x25adfd[_0x537aab][_0xd67d('0x109')](_0xd67d('0x90'));var _0x42d891=_0x33c691+'QueueId';socket['emit']('user'+_0x33c691+_0xd67d('0x9d'),{'UserId':_0x1cc248,['queueField']:_0x25adfd[_0x537aab]['id']});}})[_0xd67d('0x1b')](respondWithStatusCode(_0x2c757e,null))[_0xd67d('0x49')](APIHandleError(_0x2c757e));};exports[_0xd67d('0x10e')]=function(_0x2fb7f9,_0x13ab8a){var _0x5c9afa=_0x2fb7f9[_0xd67d('0x4a')]['id'];var _0x3e05a0=null;if(_0x2fb7f9[_0xd67d('0x39')][_0xd67d('0x53')]){_0x3e05a0=_[_0xd67d('0x10f')](_0x2fb7f9[_0xd67d('0x39')][_0xd67d('0x53')])?_0x2fb7f9['query'][_0xd67d('0x53')]:[_0x2fb7f9[_0xd67d('0x39')][_0xd67d('0x53')]];}var _0x46c244=[];return Promise['resolve']()['then'](function(){if(!_0x3e05a0)throw new APIBadRequestError(_0xd67d('0x110'));})['then'](function(){return db[_0xd67d('0x30')][_0xd67d('0x8a')]({'where':{'id':_0x5c9afa}});})['then'](function(_0x2ed226){if(!_0x2ed226)throw new APINotFoundError(util['format'](_0xd67d('0xbd'),_0x2fb7f9[_0xd67d('0x4a')]['id']));return db[_0xd67d('0x5d')]['transaction'](function(_0x20fa50){return _0x2ed226[_0xd67d('0x10e')](_0x3e05a0,{'transaction':_0x20fa50})[_0xd67d('0x1b')](function(){return db[_0xd67d('0x102')][_0xd67d('0x7f')]({'where':{'id':{'$in':_0x3e05a0}}});})[_0xd67d('0x1b')](function(_0x3462c0){var _0x4c70ac=_[_0xd67d('0x7d')](_0x3462c0,function(_0x304ec6){return _0x304ec6[_0xd67d('0x107')]();});return Promise[_0xd67d('0x48')](_0x4c70ac);})[_0xd67d('0x1b')](function(_0x4514a4){_0x46c244=_[_0xd67d('0x111')](_0x4514a4);var _0x4c675c=_[_0xd67d('0x7d')](_0x46c244,function(_0x36f905){return _0x36f905[_0xd67d('0x112')](_0x2ed226['id'],{'transaction':_0x20fa50});});return Promise[_0xd67d('0x48')](_0x4c675c);})['then'](function(){if(!_0x2ed226[_0xd67d('0x91')])return;var _0x528118=_['filter'](_0x46c244,function(_0xce7b53){return _0xce7b53[_0xd67d('0x109')]('channel')==='Voice';});var _0x21ef65=_['map'](_0x528118,function(_0x17c3e0){return db[_0xd67d('0xa3')][_0xd67d('0x2c')]({'where':{'VoiceQueueId':_0x17c3e0['id'],'UserId':_0x2ed226['id']},'transaction':_0x20fa50});});return Promise[_0xd67d('0x48')](_0x21ef65);})['then'](function(){return db['TeamVoicePrefix'][_0xd67d('0x7f')]({'where':{'teamId':{'$in':_0x3e05a0}}});})['then'](function(_0x2444f5){var _0x282001=_[_0xd67d('0x7d')](_0x2444f5,function(_0x565a06){return db['UserVoicePrefix'][_0xd67d('0x2c')]({'where':{'UserId':_0x2ed226['id'],'VoicePrefixId':_0x565a06[_0xd67d('0x10d')]}},{'transaction':_0x20fa50});});return Promise[_0xd67d('0x48')](_0x282001);});});})[_0xd67d('0x1b')](function(){for(var _0xe5957b=0x0;_0xe5957b<_0x46c244[_0xd67d('0x42')];_0xe5957b++){var _0x220c2a=_0x46c244[_0xe5957b][_0xd67d('0x109')](_0xd67d('0x90'));var _0x451d89=_0x220c2a+_0xd67d('0x9c');socket[_0xd67d('0x1e')](_0xd67d('0x23')+_0x220c2a+_0xd67d('0x113'),{'UserId':_0x5c9afa,['queueField']:_0x46c244[_0xe5957b]['id']});}})['then'](respondWithStatusCode(_0x13ab8a,null))['catch'](APIHandleError(_0x13ab8a));};exports['getLists']=function(_0x14b527,_0x9902b0){var _0x50fec9={};var _0x108536={};var _0x3d89b9;var _0x3f8a31;return db[_0xd67d('0x30')][_0xd67d('0x8a')]({'where':{'id':_0x14b527[_0xd67d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x9902b0,null))[_0xd67d('0x1b')](function(_0x429012){if(_0x429012){_0x3d89b9=_0x429012;_0x108536[_0xd67d('0xc5')]=_[_0xd67d('0xc8')](db['CmList'][_0xd67d('0xc7')]);_0x108536[_0xd67d('0x39')]=_[_0xd67d('0xc8')](_0x14b527[_0xd67d('0x39')]);_0x108536[_0xd67d('0xcc')]=_[_0xd67d('0xc9')](_0x108536['model'],_0x108536['query']);_0x50fec9[_0xd67d('0x3f')]=_['intersection'](_0x108536[_0xd67d('0xc5')],qs[_0xd67d('0xd1')](_0x14b527[_0xd67d('0x39')][_0xd67d('0xd1')]));_0x50fec9[_0xd67d('0x3f')]=_0x50fec9[_0xd67d('0x3f')]['length']?_0x50fec9['attributes']:_0x108536['model'];_0x50fec9['order']=qs['sort'](_0x14b527['query'][_0xd67d('0xcb')]);_0x50fec9['where']=qs['filters'](_['pick'](_0x14b527['query'],_0x108536[_0xd67d('0xcc')]));if(_0x14b527[_0xd67d('0x39')]['filter']){_0x50fec9[_0xd67d('0x38')]=_[_0xd67d('0x4b')](_0x50fec9[_0xd67d('0x38')],{'$or':_[_0xd67d('0x7d')](_0x50fec9[_0xd67d('0x3f')],function(_0x48e260){var _0x1f62df={};_0x1f62df[_0x48e260]={'$like':'%'+_0x14b527[_0xd67d('0x39')][_0xd67d('0xcd')]+'%'};return _0x1f62df;})});}_0x50fec9=_[_0xd67d('0x4b')]({},_0x50fec9,_0x14b527[_0xd67d('0xce')]);return _0x3d89b9['getLists'](_0x50fec9);}})['then'](function(_0x518844){if(_0x518844){_0x3f8a31=_0x518844[_0xd67d('0x42')];if(!_0x14b527[_0xd67d('0x39')][_0xd67d('0xbe')](_0xd67d('0xd0'))){_0x50fec9[_0xd67d('0x16')]=qs[_0xd67d('0x16')](_0x14b527[_0xd67d('0x39')][_0xd67d('0x16')]);_0x50fec9[_0xd67d('0x15')]=qs[_0xd67d('0x15')](_0x14b527[_0xd67d('0x39')][_0xd67d('0x15')]);}return _0x3d89b9[_0xd67d('0x114')](_0x50fec9);}})[_0xd67d('0x1b')](function(_0x40172d){if(_0x40172d){return _0x40172d?{'count':_0x3f8a31,'rows':_0x40172d}:null;}})['then'](respondWithResult(_0x9902b0,null))[_0xd67d('0x49')](handleError(_0x9902b0,null));};exports['getAgents']=function(_0x4b96c4,_0x2fb9a6){var _0x33daed={};var _0x1d1b99={};var _0x24b7bc;return db[_0xd67d('0x30')][_0xd67d('0x8a')]({'where':{'id':_0x4b96c4[_0xd67d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2fb9a6,null))[_0xd67d('0x1b')](function(_0x7f8d72){if(_0x7f8d72){_0x24b7bc=_0x7f8d72;_0x1d1b99[_0xd67d('0xc5')]=_[_0xd67d('0xc8')](db[_0xd67d('0x30')][_0xd67d('0xc7')]);_0x1d1b99[_0xd67d('0x39')]=_[_0xd67d('0xc8')](_0x4b96c4[_0xd67d('0x39')]);_0x1d1b99[_0xd67d('0xcc')]=_['intersection'](_0x1d1b99['model'],_0x1d1b99[_0xd67d('0x39')]);_0x33daed['attributes']=_[_0xd67d('0xc9')](_0x1d1b99['model'],qs[_0xd67d('0xd1')](_0x4b96c4[_0xd67d('0x39')]['fields']));_0x33daed[_0xd67d('0x3f')]=_0x33daed[_0xd67d('0x3f')][_0xd67d('0x42')]?_0x33daed[_0xd67d('0x3f')]:_0x1d1b99[_0xd67d('0xc5')];_0x33daed[_0xd67d('0xca')]=qs['sort'](_0x4b96c4[_0xd67d('0x39')][_0xd67d('0xcb')]);_0x33daed[_0xd67d('0x38')]=qs[_0xd67d('0xcc')](_[_0xd67d('0xd2')](_0x4b96c4[_0xd67d('0x39')],_0x1d1b99['filters']));if(_0x4b96c4[_0xd67d('0x39')][_0xd67d('0xcd')]){_0x33daed[_0xd67d('0x38')]=_[_0xd67d('0x4b')](_0x33daed['where'],{'$or':_[_0xd67d('0x7d')](_0x33daed[_0xd67d('0x3f')],function(_0x3a994a){var _0x3f9aed={};_0x3f9aed[_0x3a994a]={'$like':'%'+_0x4b96c4[_0xd67d('0x39')][_0xd67d('0xcd')]+'%'};return _0x3f9aed;})});}_0x33daed[_0xd67d('0xc5')]=db[_0xd67d('0x30')];_0x33daed['as']=_0xd67d('0x24');_0x33daed=_[_0xd67d('0x4b')]({},_0x33daed,_0x4b96c4[_0xd67d('0xce')]);return _0x24b7bc[_0xd67d('0xec')]({'include':[_0x33daed]});}})[_0xd67d('0x1b')](function(_0x199870){if(_0x199870){var _0xa08dce={},_0x2c98da=[];for(var _0x25f7bd=0x0;_0x25f7bd<_0x199870[_0xd67d('0x42')];_0x25f7bd+=0x1){for(var _0x5a8091=0x0,_0xe8f23a;_0x5a8091<_0x199870[_0x25f7bd][_0xd67d('0x24')]['length'];_0x5a8091+=0x1){_0xe8f23a=_0x199870[_0x25f7bd]['Agents'][_0x5a8091][_0xd67d('0x20')]({'plain':!![]});_0xa08dce[_0xe8f23a['id']]=_0xe8f23a;}}_0xa08dce=_[_0xd67d('0x115')](_0xa08dce);for(var _0x3ab4ae=qs[_0xd67d('0x15')](_0x4b96c4[_0xd67d('0x39')][_0xd67d('0x15')]);_0x3ab4ae<_0xa08dce[_0xd67d('0x42')]&&_0x2c98da[_0xd67d('0x42')]=_0x29de95[_0x7ed7('0x50')]){throw new Error(_0x7ed7('0x51'));}})[_0x7ed7('0x15')](function(){if(_0x573e5c){return db[_0x7ed7('0x27')][_0x7ed7('0x47')]({'where':{'membername':_0x573e5c[_0x7ed7('0x2a')]},'individualHooks':!![]});}})[_0x7ed7('0x15')](function(){if(_0x573e5c){return _0x573e5c[_0x7ed7('0x52')]({'raw':!![]});}})[_0x7ed7('0x15')](function(_0x46ef21){if(_0x573e5c){if(_0x46ef21){var _0x39bc5a=[];_0x1925dd=_0x46ef21;if(_0x1925dd['length']){for(var _0x3f5627=0x0;_0x3f5627<_0x1925dd['length'];_0x3f5627++){_0x39bc5a[_0x7ed7('0x2f')](db[_0x7ed7('0x27')][_0x7ed7('0x53')]({'membername':_0x573e5c[_0x7ed7('0x2a')],'UserId':_0x573e5c['id'],'queue_name':_0x1925dd[_0x3f5627][_0x7ed7('0x2a')],'VoiceQueueId':_0x1925dd[_0x3f5627]['id'],'interface':_0x50f6eb,'paused':_0x573e5c[_0x7ed7('0x4c')]||![],'penalty':_0x1925dd[_0x3f5627][_0x7ed7('0x54')]||0x0}));}return BPromise[_0x7ed7('0x49')](_0x39bc5a);}}}})[_0x7ed7('0x15')](function(){if(_0x573e5c){return db[_0x7ed7('0x29')][_0x7ed7('0x48')]({'where':{'membername':_0x573e5c[_0x7ed7('0x2a')],'exitAt':null}});}})[_0x7ed7('0x15')](function(_0x60a65e){if(_0x573e5c){if(_0x60a65e&&_0x60a65e[_0x7ed7('0x2b')]){var _0x5b6a15=[];_0x60a65e['forEach'](function(_0x5348dc){_0x5b6a15[_0x7ed7('0x2f')](_0x5348dc[_0x7ed7('0x28')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x7ed7('0x49')](_0x5b6a15);}}})[_0x7ed7('0x15')](function(){if(_0x573e5c){var _0x123fd3=[];var _0x2c8333=[];var _0x177ff3=utils[_0x7ed7('0x2d')]();var _0x1d9eb2={'membername':_0x573e5c[_0x7ed7('0x2a')],'interface':_0x50f6eb,'enterAt':moment()[_0x7ed7('0x24')](_0x7ed7('0x36')),'role':_0x573e5c['role'],'internal':_0x573e5c[_0x7ed7('0x22')]};_0x177ff3[_0x7ed7('0x2e')](function(_0x1049f2){_0x123fd3[_0x7ed7('0x2f')](_['merge']({'channel':_0x1049f2,'type':_0x7ed7('0x55'),'data1':_0x7ed7('0x56'),'data2':_0x50f6eb},_0x1d9eb2));if(_0x573e5c[_0x7ed7('0x4c')]){_0x2c8333[_0x7ed7('0x2f')](_['merge']({'channel':_0x1049f2,'type':_0x7ed7('0x31'),'data1':_0x7ed7('0x57')},_0x1d9eb2));}});return db[_0x7ed7('0x29')]['bulkCreate'](_0x123fd3[_0x7ed7('0x58')](_0x2c8333),{'individualHooks':!![]});}})[_0x7ed7('0x15')](function(){if(_0x573e5c){return _0x573e5c[_0x7ed7('0x28')]({'online':!![],'lastLoginAt':moment()[_0x7ed7('0x24')](_0x7ed7('0x36')),'voicePause':_0x573e5c[_0x7ed7('0x4c')]||![],'mailPause':_0x573e5c['loginInPause']||![],'chatPause':_0x573e5c[_0x7ed7('0x4c')]||![],'faxPause':_0x573e5c[_0x7ed7('0x4c')]||![],'smsPause':_0x573e5c[_0x7ed7('0x4c')]||![],'openchannelPause':_0x573e5c[_0x7ed7('0x4c')]||![],'pauseType':_0x573e5c[_0x7ed7('0x4c')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x7ed7('0x24')](_0x7ed7('0x36')),'interface':_0x50f6eb});}})['then'](function(_0x543d1b){_0x45161d(_0x543d1b);})['catch'](function(_0x2345b6){_0x3f1280(_0x4350b1[_0x7ed7('0x1b')](0x1f4,_0x2345b6['message']));});});}; \ No newline at end of file +var _0x7fd5=['ShowUser','find','PauseUser','where','internal','interface','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','MemberReport','name','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','push','isNil','SIP/%s','type','DEFAULT\x20PAUSE','role','body','bulkCreate','update','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','destroy','forEach','all','LoginUser','mobile','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','UserVoiceQueue.penalty','merge','LOGIN','callysquare','PAUSE','LOGININPAUSE','concat','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','register','GetUser','User','findAll','options','raw','attributes','include','map','model','then','info','stringify','catch','error','message'];(function(_0x4e6694,_0xe7ce98){var _0x9c2376=function(_0x3b253f){while(--_0x3b253f){_0x4e6694['push'](_0x4e6694['shift']());}};_0x9c2376(++_0xe7ce98);}(_0x7fd5,0xe7));var _0x57fd=function(_0x5b4d06,_0x3edc8d){_0x5b4d06=_0x5b4d06-0x0;var _0xad4053=_0x7fd5[_0x5b4d06];return _0xad4053;};'use strict';var _=require(_0x57fd('0x0'));var util=require('util');var moment=require(_0x57fd('0x1'));var BPromise=require(_0x57fd('0x2'));var Redis=require('ioredis');var db=require(_0x57fd('0x3'))['db'];var utils=require(_0x57fd('0x4'));var logger=require(_0x57fd('0x5'))(_0x57fd('0x6'));var config=require(_0x57fd('0x7'));config[_0x57fd('0x8')]=_['defaults'](config[_0x57fd('0x8')],{'host':_0x57fd('0x9'),'port':0x18eb});var socket=require(_0x57fd('0xa'))(new Redis(config[_0x57fd('0x8')]));require('./user.socket')[_0x57fd('0xb')](socket);exports[_0x57fd('0xc')]=function(_0x1e0d99){var _0x2a6f75=this;return new Promise(function(_0x33bf55,_0x36dce4){return db[_0x57fd('0xd')][_0x57fd('0xe')]({'raw':_0x1e0d99[_0x57fd('0xf')]?_0x1e0d99[_0x57fd('0xf')][_0x57fd('0x10')]===undefined?!![]:![]:!![],'where':_0x1e0d99[_0x57fd('0xf')]?_0x1e0d99[_0x57fd('0xf')]['where']||null:null,'attributes':_0x1e0d99['options']?_0x1e0d99[_0x57fd('0xf')][_0x57fd('0x11')]||null:null,'limit':_0x1e0d99[_0x57fd('0xf')]?_0x1e0d99[_0x57fd('0xf')]['limit']||null:null,'include':_0x1e0d99[_0x57fd('0xf')]?_0x1e0d99['options'][_0x57fd('0x12')]?_[_0x57fd('0x13')](_0x1e0d99['options']['include'],function(_0x529e8f){return{'model':db[_0x529e8f['model']],'as':_0x529e8f['as'],'attributes':_0x529e8f['attributes'],'include':_0x529e8f[_0x57fd('0x12')]?_[_0x57fd('0x13')](_0x529e8f['include'],function(_0x573c0d){return{'model':db[_0x573c0d[_0x57fd('0x14')]],'as':_0x573c0d['as'],'attributes':_0x573c0d[_0x57fd('0x11')],'include':_0x573c0d['include']?_[_0x57fd('0x13')](_0x573c0d[_0x57fd('0x12')],function(_0x343251){return{'model':db[_0x343251[_0x57fd('0x14')]],'as':_0x343251['as'],'attributes':_0x343251[_0x57fd('0x11')]};}):[]};}):[]};}):[]:[]})[_0x57fd('0x15')](function(_0x20f40){logger[_0x57fd('0x16')](_0x57fd('0xc'),_0x1e0d99);logger['debug'](_0x57fd('0xc'),_0x1e0d99,JSON[_0x57fd('0x17')](_0x20f40));_0x33bf55(_0x20f40);})[_0x57fd('0x18')](function(_0x447f2e){logger[_0x57fd('0x19')](_0x57fd('0xc'),_0x447f2e[_0x57fd('0x1a')],_0x1e0d99);_0x36dce4(_0x2a6f75[_0x57fd('0x19')](0x1f4,_0x447f2e[_0x57fd('0x1a')]));});});};exports[_0x57fd('0x1b')]=function(_0x2735a0){var _0x49f4b2=this;return new Promise(function(_0x1d56f1,_0x45d85f){return db[_0x57fd('0xd')][_0x57fd('0x1c')]({'raw':_0x2735a0[_0x57fd('0xf')]?_0x2735a0['options']['raw']===undefined?!![]:![]:!![],'where':_0x2735a0[_0x57fd('0xf')]?_0x2735a0[_0x57fd('0xf')]['where']||null:null,'attributes':_0x2735a0[_0x57fd('0xf')]?_0x2735a0['options'][_0x57fd('0x11')]||null:null,'include':_0x2735a0[_0x57fd('0xf')]?_0x2735a0[_0x57fd('0xf')]['include']?_[_0x57fd('0x13')](_0x2735a0[_0x57fd('0xf')][_0x57fd('0x12')],function(_0x117c76){return{'model':db[_0x117c76[_0x57fd('0x14')]],'as':_0x117c76['as'],'attributes':_0x117c76[_0x57fd('0x11')],'include':_0x117c76['include']?_['map'](_0x117c76['include'],function(_0x12d243){return{'model':db[_0x12d243['model']],'as':_0x12d243['as'],'attributes':_0x12d243[_0x57fd('0x11')],'include':_0x12d243[_0x57fd('0x12')]?_['map'](_0x12d243[_0x57fd('0x12')],function(_0x77e0d2){return{'model':db[_0x77e0d2[_0x57fd('0x14')]],'as':_0x77e0d2['as'],'attributes':_0x77e0d2[_0x57fd('0x11')]};}):[]};}):[]};}):[]:[]})[_0x57fd('0x15')](function(_0x1868d9){logger[_0x57fd('0x16')](_0x57fd('0x1b'),_0x2735a0);logger['debug'](_0x57fd('0x1b'),_0x2735a0,JSON[_0x57fd('0x17')](_0x1868d9));_0x1d56f1(_0x1868d9);})[_0x57fd('0x18')](function(_0x1323dc){logger[_0x57fd('0x19')](_0x57fd('0x1b'),_0x1323dc['message'],_0x2735a0);_0x45d85f(_0x49f4b2['error'](0x1f4,_0x1323dc[_0x57fd('0x1a')]));});});};exports[_0x57fd('0x1d')]=function(_0x5ecb7c){var _0x3c84fa;return db['User']['find']({'where':_0x5ecb7c['options'][_0x57fd('0x1e')]||{},'attributes':['id','name','role',_0x57fd('0x1f'),_0x57fd('0x20')]})['then'](function(_0x59bd29){if(!_0x59bd29){throw new Error(util['format'](_0x57fd('0x21'),_0x5ecb7c[_0x57fd('0x22')]['id']));}_0x3c84fa=_0x59bd29;return db[_0x57fd('0x23')]['update']({'paused':0x1},{'where':{'UserId':_0x3c84fa['id']},'individualHooks':!![]});})[_0x57fd('0x15')](function(){return db[_0x57fd('0x24')]['findAll']({'where':{'membername':_0x3c84fa[_0x57fd('0x25')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x16e802){if(_0x16e802&&_0x16e802[_0x57fd('0x26')]){var _0x2adc94=moment()[_0x57fd('0x27')](_0x57fd('0x28'));for(var _0x14574e=0x0,_0x77d1b8=_0x16e802[_0x57fd('0x26')];_0x14574e<_0x77d1b8;_0x14574e++){_0x16e802[_0x14574e][_0x57fd('0x29')]({'exitAt':_0x2adc94});}}})['then'](function(){var _0x553173=[];var _0x162156=utils['getChannels']();_0x162156['forEach'](function(_0x720c72){_0x553173[_0x57fd('0x2a')]({'channel':_0x720c72,'membername':_0x3c84fa[_0x57fd('0x25')],'interface':_[_0x57fd('0x2b')](_0x3c84fa[_0x57fd('0x20')])?util[_0x57fd('0x27')](_0x57fd('0x2c'),_0x3c84fa[_0x57fd('0x25')]):_0x3c84fa['interface'],'type':'PAUSE','enterAt':moment()[_0x57fd('0x27')](_0x57fd('0x28')),'data1':_0x5ecb7c['body'][_0x57fd('0x2d')]||_0x57fd('0x2e'),'role':_0x3c84fa[_0x57fd('0x2f')],'internal':_0x3c84fa['internal'],'uniqueid':_0x5ecb7c[_0x57fd('0x30')]['uniqueid']||null});});return db['MemberReport'][_0x57fd('0x31')](_0x553173,{'individualHooks':!![]});})['then'](function(){return _0x3c84fa[_0x57fd('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5ecb7c[_0x57fd('0x30')][_0x57fd('0x2d')]||_0x57fd('0x2e'),'lastPauseAt':moment()[_0x57fd('0x27')](_0x57fd('0x28'))});})[_0x57fd('0x18')](function(_0x59381f){throw _0x59381f;});};exports[_0x57fd('0x33')]=function(_0x40eae2){return Promise[_0x57fd('0x34')]()[_0x57fd('0x15')](function(){if(_0x40eae2[_0x57fd('0x30')][_0x57fd('0x35')]&&!utils[_0x57fd('0x36')](_0x40eae2['body']['channel'])){throw new Error(util[_0x57fd('0x27')](_0x57fd('0x37'),_0x40eae2[_0x57fd('0x30')][_0x57fd('0x35')]));}return db[_0x57fd('0xd')][_0x57fd('0x38')]({'where':_0x40eae2[_0x57fd('0xf')][_0x57fd('0x1e')]||{},'attributes':['id','name',_0x57fd('0x2f'),_0x57fd('0x1f'),'interface',_0x57fd('0x39'),_0x57fd('0x3a'),_0x57fd('0x3b'),_0x57fd('0x3c'),'faxPause',_0x57fd('0x3d'),_0x57fd('0x3e'),_0x57fd('0x3f'),_0x57fd('0x40'),_0x57fd('0x41')]});})[_0x57fd('0x15')](function(_0x530be4){if(!_0x530be4){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x40eae2[_0x57fd('0x22')]['id']));}return _0x530be4[_0x57fd('0x42')](_0x40eae2[_0x57fd('0x30')][_0x57fd('0x35')],_0x57fd('0x43'));})[_0x57fd('0x18')](function(_0x10f206){throw _0x10f206;});};exports['LogoutUser']=function(_0x28957e){var _0xb74504=this;return new Promise(function(_0x9a6859,_0x14fef4){var _0x1a5391;return db[_0x57fd('0xd')]['findOne']({'where':_0x28957e['options'][_0x57fd('0x1e')]||{},'attributes':['id',_0x57fd('0x25')]})[_0x57fd('0x15')](function(_0x489887){if(_0x489887){_0x1a5391=_0x489887;return db[_0x57fd('0x23')][_0x57fd('0x44')]({'where':{'membername':_0x1a5391['name']},'individualHooks':!![]});}})[_0x57fd('0x15')](function(){if(_0x1a5391){return db[_0x57fd('0x24')]['findAll']({'where':{'membername':_0x1a5391[_0x57fd('0x25')],'exitAt':null}});}})[_0x57fd('0x15')](function(_0x31c34f){if(_0x1a5391){if(_0x31c34f&&_0x31c34f[_0x57fd('0x26')]){var _0x336d3d=[];_0x31c34f[_0x57fd('0x45')](function(_0x1be623){_0x336d3d['push'](_0x1be623[_0x57fd('0x32')]({'exitAt':moment()['format'](_0x57fd('0x28'))}));});return BPromise[_0x57fd('0x46')](_0x336d3d);}}})[_0x57fd('0x15')](function(){if(_0x1a5391){return _0x1a5391['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x57fd('0x15')](function(_0xf487b6){_0x9a6859(_0xf487b6);})[_0x57fd('0x18')](function(_0xfa9bf2){_0x14fef4(_0xb74504[_0x57fd('0x19')](0x1f4,_0xfa9bf2['message']));});});};exports[_0x57fd('0x47')]=function(_0x4be7a7){var _0x54fd05=this;return new Promise(function(_0x58a751,_0x2335fa){var _0x4b4f6b;var _0x541e5b;var _0x4d81df;var _0x57e627;return db[_0x57fd('0xd')][_0x57fd('0x38')]({'where':_0x4be7a7[_0x57fd('0xf')][_0x57fd('0x1e')]||{},'attributes':['id',_0x57fd('0x25'),'role',_0x57fd('0x48'),'phone','internal',_0x57fd('0x49'),_0x57fd('0x20')]})[_0x57fd('0x15')](function(_0x3821dd){if(_0x3821dd){_0x4b4f6b=_0x3821dd;_0x57e627=_0x4be7a7[_0x57fd('0x30')]['interface']?_0x4be7a7['body'][_0x57fd('0x20')]:util['format'](_0x57fd('0x2c'),_0x4b4f6b[_0x57fd('0x25')]);return db[_0x57fd('0xd')][_0x57fd('0x4a')]({'where':{'role':_0x57fd('0x4b'),'online':!![],'id':{'$ne':_0x4b4f6b['id']}}});}})['then'](function(_0x4e68ad){if(_0x4e68ad){_0x4d81df=_0x4e68ad;return require('../../config/license/util')[_0x57fd('0x4c')]();}})[_0x57fd('0x15')](function(_0x41ea88){if(_0x41ea88&&_0x41ea88[_0x57fd('0x4d')]&&_0x4d81df>=_0x41ea88['agents']){throw new Error(_0x57fd('0x4e'));}})[_0x57fd('0x15')](function(){if(_0x4b4f6b){return db['UserVoiceQueueRt'][_0x57fd('0x44')]({'where':{'membername':_0x4b4f6b['name']},'individualHooks':!![]});}})[_0x57fd('0x15')](function(){if(_0x4b4f6b){return _0x4b4f6b['getVoiceQueues']({'raw':!![]});}})[_0x57fd('0x15')](function(_0x2ba146){if(_0x4b4f6b){if(_0x2ba146){var _0x31217a=[];_0x541e5b=_0x2ba146;if(_0x541e5b['length']){for(var _0x2875d0=0x0;_0x2875d0<_0x541e5b[_0x57fd('0x26')];_0x2875d0++){_0x31217a['push'](db[_0x57fd('0x23')]['upsert']({'membername':_0x4b4f6b['name'],'UserId':_0x4b4f6b['id'],'queue_name':_0x541e5b[_0x2875d0][_0x57fd('0x25')],'VoiceQueueId':_0x541e5b[_0x2875d0]['id'],'interface':_0x57e627,'paused':_0x4b4f6b[_0x57fd('0x49')]||![],'penalty':_0x541e5b[_0x2875d0][_0x57fd('0x4f')]||0x0}));}return BPromise[_0x57fd('0x46')](_0x31217a);}}}})[_0x57fd('0x15')](function(){if(_0x4b4f6b){return db[_0x57fd('0x24')]['findAll']({'where':{'membername':_0x4b4f6b[_0x57fd('0x25')],'exitAt':null}});}})[_0x57fd('0x15')](function(_0x2cc7f8){if(_0x4b4f6b){if(_0x2cc7f8&&_0x2cc7f8[_0x57fd('0x26')]){var _0x35990f=[];_0x2cc7f8['forEach'](function(_0x1ca0f9){_0x35990f['push'](_0x1ca0f9['update']({'exitAt':moment()[_0x57fd('0x27')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x35990f);}}})[_0x57fd('0x15')](function(){if(_0x4b4f6b){var _0x1a8fb5=[];var _0xfe2379=[];var _0x52845f=utils['getChannels']();var _0x363874={'membername':_0x4b4f6b[_0x57fd('0x25')],'interface':_0x57e627,'enterAt':moment()[_0x57fd('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4b4f6b[_0x57fd('0x2f')],'internal':_0x4b4f6b['internal']};_0x52845f[_0x57fd('0x45')](function(_0xa939f7){_0x1a8fb5['push'](_[_0x57fd('0x50')]({'channel':_0xa939f7,'type':_0x57fd('0x51'),'data1':_0x57fd('0x52'),'data2':_0x57e627},_0x363874));if(_0x4b4f6b[_0x57fd('0x49')]){_0xfe2379[_0x57fd('0x2a')](_['merge']({'channel':_0xa939f7,'type':_0x57fd('0x53'),'data1':_0x57fd('0x54')},_0x363874));}});return db['MemberReport'][_0x57fd('0x31')](_0x1a8fb5[_0x57fd('0x55')](_0xfe2379),{'individualHooks':!![]});}})[_0x57fd('0x15')](function(){if(_0x4b4f6b){return _0x4b4f6b[_0x57fd('0x32')]({'online':!![],'lastLoginAt':moment()[_0x57fd('0x27')](_0x57fd('0x28')),'voicePause':_0x4b4f6b[_0x57fd('0x49')]||![],'mailPause':_0x4b4f6b[_0x57fd('0x49')]||![],'chatPause':_0x4b4f6b[_0x57fd('0x49')]||![],'faxPause':_0x4b4f6b[_0x57fd('0x49')]||![],'smsPause':_0x4b4f6b['loginInPause']||![],'openchannelPause':_0x4b4f6b[_0x57fd('0x49')]||![],'pauseType':_0x4b4f6b[_0x57fd('0x49')]?_0x57fd('0x54'):null,'lastPauseAt':moment()[_0x57fd('0x27')](_0x57fd('0x28')),'interface':_0x57e627});}})[_0x57fd('0x15')](function(_0x2cff19){_0x58a751(_0x2cff19);})[_0x57fd('0x18')](function(_0x472919){_0x2335fa(_0x54fd05['error'](0x1f4,_0x472919[_0x57fd('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 30ef52f..90b6628 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 _0x0ed1=['user:','./user.events','remove','update','emit','removeListener','length'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x0ed1,0x6a));var _0x10ed=function(_0x49c851,_0x2a79b0){_0x49c851=_0x49c851-0x0;var _0x598351=_0x0ed1[_0x49c851];return _0x598351;};'use strict';var UserEvents=require(_0x10ed('0x0'));var events=['save',_0x10ed('0x1'),_0x10ed('0x2')];function createListener(_0x186aef,_0x1b74f8){return function(_0xd005f6){_0x1b74f8[_0x10ed('0x3')](_0x186aef,_0xd005f6);};}function removeListener(_0x4528d3,_0x54ba40){return function(){UserEvents[_0x10ed('0x4')](_0x4528d3,_0x54ba40);};}exports['register']=function(_0x40626e){for(var _0x53d523=0x0,_0x44cdde=events[_0x10ed('0x5')];_0x53d523<_0x44cdde;_0x53d523++){var _0x1ff5b6=events[_0x53d523];var _0x17de4f=createListener(_0x10ed('0x6')+_0x1ff5b6,_0x40626e);UserEvents['on'](_0x1ff5b6,_0x17de4f);}}; \ No newline at end of file +var _0xdaba=['save','remove','update','emit','removeListener','register','user:','./user.events'];(function(_0x48af7a,_0x3cfea9){var _0x359483=function(_0x681641){while(--_0x681641){_0x48af7a['push'](_0x48af7a['shift']());}};_0x359483(++_0x3cfea9);}(_0xdaba,0x6f));var _0xadab=function(_0x152c32,_0x5a1235){_0x152c32=_0x152c32-0x0;var _0xbdb0a=_0xdaba[_0x152c32];return _0xbdb0a;};'use strict';var UserEvents=require(_0xadab('0x0'));var events=[_0xadab('0x1'),_0xadab('0x2'),_0xadab('0x3')];function createListener(_0x2969ec,_0x1a639c){return function(_0x4eaae1){_0x1a639c[_0xadab('0x4')](_0x2969ec,_0x4eaae1);};}function removeListener(_0x508c75,_0xa39cf4){return function(){UserEvents[_0xadab('0x5')](_0x508c75,_0xa39cf4);};}exports[_0xadab('0x6')]=function(_0x3c3348){for(var _0x481851=0x0,_0x1aa077=events['length'];_0x481851<_0x1aa077;_0x481851++){var _0xba8105=events[_0x481851];var _0x3cc2fc=createListener(_0xadab('0x7')+_0xba8105,_0x3c3348);UserEvents['on'](_0xba8105,_0x3cc2fc);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index d3163ac..3203cf8 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x27c71f,_0xcfc791){var _0x244214=function(_0x436eac){while(--_0x436eac){_0x27c71f['push'](_0x27c71f['shift']());}};_0x244214(++_0xcfc791);}(_0xe706,0xa3));var _0x6e70=function(_0x134b6e,_0x21b5ca){_0x134b6e=_0x134b6e-0x0;var _0x2229a9=_0xe706[_0x134b6e];return _0x2229a9;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x38ae4f,_0x1d3180){var _0x1e92db=function(_0x1a1cb9){while(--_0x1a1cb9){_0x38ae4f['push'](_0x38ae4f['shift']());}};_0x1e92db(++_0x1d3180);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 8c47c9f..690942e 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 _0x7ca5=['INTEGER','exports'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x7ca5,0x11d));var _0x57ca=function(_0x47b52d,_0x4c4ffe){_0x47b52d=_0x47b52d-0x0;var _0x42d925=_0x7ca5[_0x47b52d];return _0x42d925;};'use strict';var Sequelize=require('sequelize');module[_0x57ca('0x0')]={'penalty':{'type':Sequelize[_0x57ca('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xea0c=['sequelize','INTEGER'];(function(_0x234bb1,_0xab473e){var _0x570b3c=function(_0x128d8d){while(--_0x128d8d){_0x234bb1['push'](_0x234bb1['shift']());}};_0x570b3c(++_0xab473e);}(_0xea0c,0x100));var _0xcea0=function(_0x8104e9,_0x1820d1){_0x8104e9=_0x8104e9-0x0;var _0x316db6=_0xea0c[_0x8104e9];return _0x316db6;};'use strict';var Sequelize=require(_0xcea0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xcea0('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 5cf7c93..0586948 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 _0xaa6d=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util','api','moment','rimraf'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xaa6d,0x1e6));var _0xdaa6=function(_0x2295c0,_0x41320b){_0x2295c0=_0x2295c0-0x0;var _0x39cc13=_0xaa6d[_0x2295c0];return _0x39cc13;};'use strict';var _=require('lodash');var util=require(_0xdaa6('0x0'));var logger=require('../../config/logger')(_0xdaa6('0x1'));var moment=require(_0xdaa6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdaa6('0x3'));var config=require(_0xdaa6('0x4'));var attributes=require(_0xdaa6('0x5'));module[_0xdaa6('0x6')]=function(_0x3fa606,_0x24b194){return _0x3fa606[_0xdaa6('0x7')](_0xdaa6('0x8'),attributes,{'tableName':_0xdaa6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1544=['user_has_chat_queues','lodash','util','moment','bluebird','request-promise','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue'];(function(_0x21c290,_0x579f54){var _0x3986f4=function(_0xc405b0){while(--_0xc405b0){_0x21c290['push'](_0x21c290['shift']());}};_0x3986f4(++_0x579f54);}(_0x1544,0x140));var _0x4154=function(_0x73c130,_0x5f532f){_0x73c130=_0x73c130-0x0;var _0x3bd9b4=_0x1544[_0x73c130];return _0x3bd9b4;};'use strict';var _=require(_0x4154('0x0'));var util=require(_0x4154('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4154('0x2'));var BPromise=require(_0x4154('0x3'));var rp=require(_0x4154('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4154('0x5'));var attributes=require(_0x4154('0x6'));module[_0x4154('0x7')]=function(_0x3dd22f,_0x1380dc){return _0x3dd22f[_0x4154('0x8')](_0x4154('0x9'),attributes,{'tableName':_0x4154('0xa'),'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 40b170f..d8a8246 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 _0xedf8=['message','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserChatQueue,\x20%s,\x20%s','result'];(function(_0xa822a0,_0x38e2cc){var _0xaf7e66=function(_0x349fce){while(--_0x349fce){_0xa822a0['push'](_0xa822a0['shift']());}};_0xaf7e66(++_0x38e2cc);}(_0xedf8,0x133));var _0x8edf=function(_0x801aa1,_0x3bf51f){_0x801aa1=_0x801aa1-0x0;var _0xa142c1=_0xedf8[_0x801aa1];return _0xa142c1;};'use strict';var _=require(_0x8edf('0x0'));var util=require('util');var moment=require(_0x8edf('0x1'));var BPromise=require(_0x8edf('0x2'));var rs=require(_0x8edf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8edf('0x4'));var logger=require(_0x8edf('0x5'))(_0x8edf('0x6'));var config=require(_0x8edf('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x442951,_0x5df678,_0x396afe){return new BPromise(function(_0xc542e6,_0x7b483a){return client[_0x8edf('0x8')](_0x442951,_0x396afe)['then'](function(_0x4775bc){logger[_0x8edf('0x9')]('UserChatQueue,\x20%s,\x20%s',_0x5df678,_0x8edf('0xa'));logger[_0x8edf('0xb')](_0x8edf('0xc'),_0x5df678,'request\x20sent',JSON[_0x8edf('0xd')](_0x4775bc));if(_0x4775bc[_0x8edf('0xe')]){if(_0x4775bc[_0x8edf('0xe')]['code']===0x1f4){logger['error'](_0x8edf('0xf'),_0x5df678,_0x4775bc[_0x8edf('0xe')]['message']);return _0x7b483a(_0x4775bc[_0x8edf('0xe')]['message']);}logger[_0x8edf('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x5df678,_0x4775bc[_0x8edf('0xe')]['message']);return _0xc542e6(_0x4775bc['error']['message']);}else{logger[_0x8edf('0x9')](_0x8edf('0xf'),_0x5df678,_0x8edf('0xa'));_0xc542e6(_0x4775bc[_0x8edf('0x10')][_0x8edf('0x11')]);}})['catch'](function(_0x3c6e8f){logger[_0x8edf('0xe')](_0x8edf('0xf'),_0x5df678,_0x3c6e8f);_0x7b483a(_0x3c6e8f);});});} \ No newline at end of file +var _0x3e48=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x44bcda,_0x55f3af){var _0x5972d8=function(_0x50500b){while(--_0x50500b){_0x44bcda['push'](_0x44bcda['shift']());}};_0x5972d8(++_0x55f3af);}(_0x3e48,0x11e));var _0x83e4=function(_0x18b23d,_0x1f3223){_0x18b23d=_0x18b23d-0x0;var _0x9c2d04=_0x3e48[_0x18b23d];return _0x9c2d04;};'use strict';var _=require(_0x83e4('0x0'));var util=require(_0x83e4('0x1'));var moment=require(_0x83e4('0x2'));var BPromise=require(_0x83e4('0x3'));var rs=require(_0x83e4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x83e4('0x5'))['db'];var utils=require(_0x83e4('0x6'));var logger=require(_0x83e4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x83e4('0x8'));var client=jayson[_0x83e4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x65ccee,_0x42b7d7,_0x40e18b){return new BPromise(function(_0x2679d6,_0x394a94){return client[_0x83e4('0xa')](_0x65ccee,_0x40e18b)[_0x83e4('0xb')](function(_0x544eea){logger[_0x83e4('0xc')](_0x83e4('0xd'),_0x42b7d7,_0x83e4('0xe'));logger[_0x83e4('0xf')](_0x83e4('0x10'),_0x42b7d7,'request\x20sent',JSON[_0x83e4('0x11')](_0x544eea));if(_0x544eea[_0x83e4('0x12')]){if(_0x544eea['error']['code']===0x1f4){logger[_0x83e4('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x42b7d7,_0x544eea[_0x83e4('0x12')][_0x83e4('0x13')]);return _0x394a94(_0x544eea[_0x83e4('0x12')][_0x83e4('0x13')]);}logger[_0x83e4('0x12')](_0x83e4('0xd'),_0x42b7d7,_0x544eea[_0x83e4('0x12')][_0x83e4('0x13')]);return _0x2679d6(_0x544eea[_0x83e4('0x12')][_0x83e4('0x13')]);}else{logger[_0x83e4('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x42b7d7,_0x83e4('0xe'));_0x2679d6(_0x544eea[_0x83e4('0x14')][_0x83e4('0x13')]);}})[_0x83e4('0x15')](function(_0x3f0d43){logger['error'](_0x83e4('0xd'),_0x42b7d7,_0x3f0d43);_0x394a94(_0x3f0d43);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 16080bd..ce45b9b 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x11522a,_0x597470){var _0x4890de=function(_0x1a3411){while(--_0x1a3411){_0x11522a['push'](_0x11522a['shift']());}};_0x4890de(++_0x597470);}(_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(_0x41cf07,_0x18b087){var _0x54e273=function(_0x99ae37){while(--_0x99ae37){_0x41cf07['push'](_0x41cf07['shift']());}};_0x54e273(++_0x18b087);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 486e0bf..09b2b0f 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 _0xcaef=['STRING','exports','INTEGER'];(function(_0x141609,_0x18557b){var _0x283526=function(_0xa81165){while(--_0xa81165){_0x141609['push'](_0x141609['shift']());}};_0x283526(++_0x18557b);}(_0xcaef,0x91));var _0xfcae=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xcaef[_0x20a558];return _0x53d3f7;};'use strict';var Sequelize=require('sequelize');module[_0xfcae('0x0')]={'penalty':{'type':Sequelize[_0xfcae('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xfcae('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfcae('0x2')]}}; \ No newline at end of file +var _0x06cc=['STRING','INTEGER'];(function(_0x5f08a4,_0x4c4d6b){var _0x150acb=function(_0x44cbec){while(--_0x44cbec){_0x5f08a4['push'](_0x5f08a4['shift']());}};_0x150acb(++_0x4c4d6b);}(_0x06cc,0xb9));var _0xc06c=function(_0x102ebd,_0x2049cf){_0x102ebd=_0x102ebd-0x0;var _0x407217=_0x06cc[_0x102ebd];return _0x407217;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xc06c('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc06c('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc06c('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 66e60bd..03c4932 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 _0x55de=['rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x55de,0x1ab));var _0xe55d=function(_0x431f0f,_0x263b3c){_0x431f0f=_0x431f0f-0x0;var _0x334a40=_0x55de[_0x431f0f];return _0x334a40;};'use strict';var _=require(_0xe55d('0x0'));var util=require(_0xe55d('0x1'));var logger=require(_0xe55d('0x2'))(_0xe55d('0x3'));var moment=require('moment');var BPromise=require(_0xe55d('0x4'));var rp=require(_0xe55d('0x5'));var fs=require('fs');var path=require(_0xe55d('0x6'));var rimraf=require(_0xe55d('0x7'));var config=require(_0xe55d('0x8'));var attributes=require(_0xe55d('0x9'));module[_0xe55d('0xa')]=function(_0x4afc3a,_0x558a15){return _0x4afc3a[_0xe55d('0xb')](_0xe55d('0xc'),attributes,{'tableName':_0xe55d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7a9=['define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3e5e82,_0x1c7b67){var _0x5d029=function(_0x55abf7){while(--_0x55abf7){_0x3e5e82['push'](_0x3e5e82['shift']());}};_0x5d029(++_0x1c7b67);}(_0xf7a9,0x6f));var _0x9f7a=function(_0x234c06,_0x456032){_0x234c06=_0x234c06-0x0;var _0x49ba76=_0xf7a9[_0x234c06];return _0x49ba76;};'use strict';var _=require(_0x9f7a('0x0'));var util=require(_0x9f7a('0x1'));var logger=require(_0x9f7a('0x2'))(_0x9f7a('0x3'));var moment=require('moment');var BPromise=require(_0x9f7a('0x4'));var rp=require(_0x9f7a('0x5'));var fs=require('fs');var path=require(_0x9f7a('0x6'));var rimraf=require(_0x9f7a('0x7'));var config=require(_0x9f7a('0x8'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x5903ae,_0x4a93af){return _0x5903ae[_0x9f7a('0x9')](_0x9f7a('0xa'),attributes,{'tableName':_0x9f7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 4762228..22a6801 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 _0xa6b5=['jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x507c4b,_0x36cc1a){var _0x1b8bb6=function(_0x5aa094){while(--_0x5aa094){_0x507c4b['push'](_0x507c4b['shift']());}};_0x1b8bb6(++_0x36cc1a);}(_0xa6b5,0x87));var _0x5a6b=function(_0xbe0d57,_0x18baa6){_0xbe0d57=_0xbe0d57-0x0;var _0x2c7ae4=_0xa6b5[_0xbe0d57];return _0x2c7ae4;};'use strict';var _=require(_0x5a6b('0x0'));var util=require(_0x5a6b('0x1'));var moment=require(_0x5a6b('0x2'));var BPromise=require(_0x5a6b('0x3'));var rs=require(_0x5a6b('0x4'));var fs=require('fs');var Redis=require(_0x5a6b('0x5'));var db=require(_0x5a6b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a6b('0x7'))('rpc');var config=require(_0x5a6b('0x8'));var jayson=require(_0x5a6b('0x9'));var client=jayson[_0x5a6b('0xa')][_0x5a6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44a0c8,_0x17237d,_0x377309){return new BPromise(function(_0x2d3188,_0x4ccc08){return client[_0x5a6b('0xc')](_0x44a0c8,_0x377309)[_0x5a6b('0xd')](function(_0xf9eb6a){logger[_0x5a6b('0xe')](_0x5a6b('0xf'),_0x17237d,_0x5a6b('0x10'));logger[_0x5a6b('0x11')](_0x5a6b('0x12'),_0x17237d,_0x5a6b('0x10'),JSON[_0x5a6b('0x13')](_0xf9eb6a));if(_0xf9eb6a[_0x5a6b('0x14')]){if(_0xf9eb6a[_0x5a6b('0x14')]['code']===0x1f4){logger[_0x5a6b('0x14')](_0x5a6b('0xf'),_0x17237d,_0xf9eb6a[_0x5a6b('0x14')][_0x5a6b('0x15')]);return _0x4ccc08(_0xf9eb6a[_0x5a6b('0x14')][_0x5a6b('0x15')]);}logger[_0x5a6b('0x14')](_0x5a6b('0xf'),_0x17237d,_0xf9eb6a[_0x5a6b('0x14')]['message']);return _0x2d3188(_0xf9eb6a[_0x5a6b('0x14')][_0x5a6b('0x15')]);}else{logger[_0x5a6b('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x17237d,_0x5a6b('0x10'));_0x2d3188(_0xf9eb6a[_0x5a6b('0x16')][_0x5a6b('0x15')]);}})[_0x5a6b('0x17')](function(_0x2ca2ba){logger[_0x5a6b('0x14')](_0x5a6b('0xf'),_0x17237d,_0x2ca2ba);_0x4ccc08(_0x2ca2ba);});});} \ No newline at end of file +var _0xb2ed=['message','result','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserFaxQueue,\x20%s,\x20%s'];(function(_0x2b70f1,_0x329fe0){var _0x577ce8=function(_0x56b395){while(--_0x56b395){_0x2b70f1['push'](_0x2b70f1['shift']());}};_0x577ce8(++_0x329fe0);}(_0xb2ed,0xc0));var _0xdb2e=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0xb2ed[_0x135904];return _0x1ce7d5;};'use strict';var _=require(_0xdb2e('0x0'));var util=require(_0xdb2e('0x1'));var moment=require(_0xdb2e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb2e('0x3'));var db=require(_0xdb2e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdb2e('0x5'));var config=require(_0xdb2e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdb2e('0x7')][_0xdb2e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2da6bd,_0x43861e,_0x48cc13){return new BPromise(function(_0x6bc29e,_0x1d5975){return client[_0xdb2e('0x9')](_0x2da6bd,_0x48cc13)['then'](function(_0x5180a7){logger[_0xdb2e('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x43861e,_0xdb2e('0xb'));logger[_0xdb2e('0xc')](_0xdb2e('0xd'),_0x43861e,'request\x20sent',JSON[_0xdb2e('0xe')](_0x5180a7));if(_0x5180a7[_0xdb2e('0xf')]){if(_0x5180a7[_0xdb2e('0xf')]['code']===0x1f4){logger[_0xdb2e('0xf')](_0xdb2e('0x10'),_0x43861e,_0x5180a7[_0xdb2e('0xf')]['message']);return _0x1d5975(_0x5180a7[_0xdb2e('0xf')][_0xdb2e('0x11')]);}logger[_0xdb2e('0xf')](_0xdb2e('0x10'),_0x43861e,_0x5180a7['error'][_0xdb2e('0x11')]);return _0x6bc29e(_0x5180a7[_0xdb2e('0xf')][_0xdb2e('0x11')]);}else{logger[_0xdb2e('0xa')](_0xdb2e('0x10'),_0x43861e,_0xdb2e('0xb'));_0x6bc29e(_0x5180a7[_0xdb2e('0x12')]['message']);}})['catch'](function(_0x2341f6){logger[_0xdb2e('0xf')](_0xdb2e('0x10'),_0x43861e,_0x2341f6);_0x1d5975(_0x2341f6);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index fb9cd60..3e127c7 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x28d6c2,_0x274201){var _0x11d770=function(_0x5a636c){while(--_0x5a636c){_0x28d6c2['push'](_0x28d6c2['shift']());}};_0x11d770(++_0x274201);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5dcd95,_0x1e72d4){var _0x271b17=function(_0x57b81b){while(--_0x57b81b){_0x5dcd95['push'](_0x5dcd95['shift']());}};_0x271b17(++_0x1e72d4);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 271f848..1a8550c 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 _0x5d01=['INTEGER','sequelize'];(function(_0x5c9983,_0x21b64b){var _0x19e1bd=function(_0x34dff7){while(--_0x34dff7){_0x5c9983['push'](_0x5c9983['shift']());}};_0x19e1bd(++_0x21b64b);}(_0x5d01,0xe5));var _0x15d0=function(_0x14ccbb,_0x46308e){_0x14ccbb=_0x14ccbb-0x0;var _0x36b134=_0x5d01[_0x14ccbb];return _0x36b134;};'use strict';var Sequelize=require(_0x15d0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x15d0('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd4c1=['INTEGER','exports'];(function(_0x3cc24b,_0x5a928c){var _0x3370cc=function(_0x3f295b){while(--_0x3f295b){_0x3cc24b['push'](_0x3cc24b['shift']());}};_0x3370cc(++_0x5a928c);}(_0xd4c1,0x165));var _0x1d4c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4c1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x1d4c('0x0')]={'penalty':{'type':Sequelize[_0x1d4c('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 21e3750..fe7c98e 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 _0xa400=['UserMailQueue','user_has_mail_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define'];(function(_0x586805,_0x1ead6c){var _0x2f29f5=function(_0x708eb4){while(--_0x708eb4){_0x586805['push'](_0x586805['shift']());}};_0x2f29f5(++_0x1ead6c);}(_0xa400,0x11a));var _0x0a40=function(_0x58f113,_0x252744){_0x58f113=_0x58f113-0x0;var _0x4fcc6a=_0xa400[_0x58f113];return _0x4fcc6a;};'use strict';var _=require(_0x0a40('0x0'));var util=require(_0x0a40('0x1'));var logger=require('../../config/logger')(_0x0a40('0x2'));var moment=require(_0x0a40('0x3'));var BPromise=require(_0x0a40('0x4'));var rp=require(_0x0a40('0x5'));var fs=require('fs');var path=require(_0x0a40('0x6'));var rimraf=require(_0x0a40('0x7'));var config=require(_0x0a40('0x8'));var attributes=require(_0x0a40('0x9'));module[_0x0a40('0xa')]=function(_0x25b53c,_0x331bd4){return _0x25b53c[_0x0a40('0xb')](_0x0a40('0xc'),attributes,{'tableName':_0x0a40('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25e3=['rimraf','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api','moment','bluebird','path'];(function(_0x20baf2,_0x6115b4){var _0x570438=function(_0x330202){while(--_0x330202){_0x20baf2['push'](_0x20baf2['shift']());}};_0x570438(++_0x6115b4);}(_0x25e3,0x124));var _0x325e=function(_0x1e52be,_0x321925){_0x1e52be=_0x1e52be-0x0;var _0x4f687d=_0x25e3[_0x1e52be];return _0x4f687d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x325e('0x0'))(_0x325e('0x1'));var moment=require(_0x325e('0x2'));var BPromise=require(_0x325e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x325e('0x4'));var rimraf=require(_0x325e('0x5'));var config=require(_0x325e('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x325e('0x7')]=function(_0x5803a4,_0x4bf26b){return _0x5803a4[_0x325e('0x8')](_0x325e('0x9'),attributes,{'tableName':_0x325e('0xa'),'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 e6f2ca2..5f64366 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x36ebfc,_0x52766f){var _0x729269=function(_0xffb1b9){while(--_0xffb1b9){_0x36ebfc['push'](_0x36ebfc['shift']());}};_0x729269(++_0x52766f);}(_0xa41a,0x6b));var _0xaa41=function(_0x1fd723,_0x1811b0){_0x1fd723=_0x1fd723-0x0;var _0x72bb0f=_0xa41a[_0x1fd723];return _0x72bb0f;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x457c67,_0x94938a){var _0x191f74=function(_0x2da536){while(--_0x2da536){_0x457c67['push'](_0x457c67['shift']());}};_0x191f74(++_0x94938a);}(_0x34e8,0x12c));var _0x834e=function(_0x5d0e21,_0x5a6412){_0x5d0e21=_0x5d0e21-0x0;var _0x4415f1=_0x34e8[_0x5d0e21];return _0x4415f1;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index a77d2a9..3dee208 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 _0x1808=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x1808,0xf1));var _0x8180=function(_0x23b946,_0x2653e1){_0x23b946=_0x23b946-0x0;var _0xcfad4f=_0x1808[_0x23b946];return _0xcfad4f;};'use strict';var multer=require('multer');var util=require(_0x8180('0x0'));var path=require('path');var timeout=require(_0x8180('0x1'));var express=require(_0x8180('0x2'));var router=express[_0x8180('0x3')]();var fs_extra=require(_0x8180('0x4'));var auth=require(_0x8180('0x5'));var interaction=require(_0x8180('0x6'));var config=require(_0x8180('0x7'));var controller=require(_0x8180('0x8'));router[_0x8180('0x9')]('/',auth[_0x8180('0xa')](),controller['sendUserNotification']);module[_0x8180('0xb')]=router; \ No newline at end of file +var _0x15f0=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','exports','util'];(function(_0x14db06,_0x1e5256){var _0x4c0eca=function(_0x2fe577){while(--_0x2fe577){_0x14db06['push'](_0x14db06['shift']());}};_0x4c0eca(++_0x1e5256);}(_0x15f0,0x135));var _0x015f=function(_0x5cafe3,_0x57c15f){_0x5cafe3=_0x5cafe3-0x0;var _0x2464d6=_0x15f0[_0x5cafe3];return _0x2464d6;};'use strict';var multer=require('multer');var util=require(_0x015f('0x0'));var path=require(_0x015f('0x1'));var timeout=require(_0x015f('0x2'));var express=require(_0x015f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x015f('0x4'));var interaction=require(_0x015f('0x5'));var config=require(_0x015f('0x6'));var controller=require('./userNotification.controller');router[_0x015f('0x7')]('/',auth[_0x015f('0x8')](),controller['sendUserNotification']);module[_0x015f('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index e6bc857..23dddf4 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 _0x46ba=['sequelize','exports','STRING','TEXT'];(function(_0x6dbd7e,_0x541122){var _0x2cb261=function(_0x58f1ee){while(--_0x58f1ee){_0x6dbd7e['push'](_0x6dbd7e['shift']());}};_0x2cb261(++_0x541122);}(_0x46ba,0x118));var _0xa46b=function(_0x504760,_0x263cf5){_0x504760=_0x504760-0x0;var _0x5b132c=_0x46ba[_0x504760];return _0x5b132c;};'use strict';var Sequelize=require(_0xa46b('0x0'));module[_0xa46b('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xa46b('0x2')]},'recipientsId':{'type':Sequelize[_0xa46b('0x3')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xbc8b=['TEXT','STRING','sequelize','exports'];(function(_0x2be517,_0x31d9d5){var _0x20105a=function(_0x3d5b07){while(--_0x3d5b07){_0x2be517['push'](_0x2be517['shift']());}};_0x20105a(++_0x31d9d5);}(_0xbc8b,0x8a));var _0xbbc8=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xbc8b[_0x18b5e8];return _0x25baed;};'use strict';var Sequelize=require(_0xbbc8('0x0'));module[_0xbbc8('0x1')]={'body':{'type':Sequelize[_0xbbc8('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xbbc8('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 7bc6ec3..655be15 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 _0xb8cc=['map','eml-format','rimraf','fast-json-patch','moment','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','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','create','forEach','emit','userNotification:send','Template','html','render','startCase','toLowerCase','User','ids','queue','Queue','push','all','union','flatten','catch','findOne','getAgents'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xb8cc,0xcd));var _0xcb8c=function(_0x129a36,_0x5add80){_0x129a36=_0x129a36-0x0;var _0x58a5a1=_0xb8cc[_0x129a36];return _0x58a5a1;};'use strict';var emlformat=require(_0xcb8c('0x0'));var rimraf=require(_0xcb8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb8c('0x2'));var rp=require('request-promise');var moment=require(_0xcb8c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcb8c('0x4'));var util=require(_0xcb8c('0x5'));var path=require(_0xcb8c('0x6'));var sox=require(_0xcb8c('0x7'));var csv=require(_0xcb8c('0x8'));var ejs=require(_0xcb8c('0x9'));var fs=require('fs');var fs_extra=require(_0xcb8c('0xa'));var _=require(_0xcb8c('0xb'));var squel=require(_0xcb8c('0xc'));var crypto=require(_0xcb8c('0xd'));var jsforce=require(_0xcb8c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcb8c('0xf'));var Papa=require(_0xcb8c('0x10'));var Redis=require(_0xcb8c('0x11'));var authService=require(_0xcb8c('0x12'));var qs=require(_0xcb8c('0x13'));var as=require(_0xcb8c('0x14'));var hardwareService=require(_0xcb8c('0x15'));var logger=require(_0xcb8c('0x16'))(_0xcb8c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcb8c('0x18'));var db=require(_0xcb8c('0x19'))['db'];config[_0xcb8c('0x1a')]=_[_0xcb8c('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcb8c('0x1c'))(new Redis(config[_0xcb8c('0x1a')]));require(_0xcb8c('0x1d'))[_0xcb8c('0x1e')](socket);function respondWithStatusCode(_0xc0cf85,_0x30165c){_0x30165c=_0x30165c||0xcc;return function(_0x18b101){if(_0x18b101){return _0xc0cf85['sendStatus'](_0x30165c);}return _0xc0cf85[_0xcb8c('0x1f')](_0x30165c)[_0xcb8c('0x20')]();};}function respondWithResult(_0x30c519,_0x4d1383){_0x4d1383=_0x4d1383||0xc8;return function(_0x34a960){if(_0x34a960){return _0x30c519['status'](_0x4d1383)[_0xcb8c('0x21')](_0x34a960);}};}function respondWithFilteredResult(_0x264a7c,_0x196f6e){return function(_0x514746){if(_0x514746){var _0x11a5e6=typeof _0x196f6e[_0xcb8c('0x22')]===_0xcb8c('0x23')&&typeof _0x196f6e[_0xcb8c('0x24')]===_0xcb8c('0x23');var _0x468d71=_0x514746[_0xcb8c('0x25')];var _0x528d6e=_0x11a5e6?0x0:_0x196f6e[_0xcb8c('0x22')];var _0x2f5cd0=_0x11a5e6?_0x514746[_0xcb8c('0x25')]:_0x196f6e[_0xcb8c('0x22')]+_0x196f6e[_0xcb8c('0x24')];var _0x5e9552;if(_0x2f5cd0>=_0x468d71){_0x2f5cd0=_0x468d71;_0x5e9552=0xc8;}else{_0x5e9552=0xce;}_0x264a7c[_0xcb8c('0x1f')](_0x5e9552);return _0x264a7c[_0xcb8c('0x26')](_0xcb8c('0x27'),_0x528d6e+'-'+_0x2f5cd0+'/'+_0x468d71)[_0xcb8c('0x21')](_0x514746);}return null;};}function patchUpdates(_0x539d03){return function(_0x2dfdf3){try{jsonpatch['apply'](_0x2dfdf3,_0x539d03,!![]);}catch(_0x2ec52a){return BPromise[_0xcb8c('0x28')](_0x2ec52a);}return _0x2dfdf3[_0xcb8c('0x29')]();};}function saveUpdates(_0x52fdb8,_0x31bc28){return function(_0xc19e24){if(_0xc19e24){return _0xc19e24['update'](_0x52fdb8)[_0xcb8c('0x2a')](function(_0xe20e36){return _0xe20e36;});}return null;};}function removeEntity(_0x427e8b,_0x33bdab){return function(_0xa474c8){if(_0xa474c8){return _0xa474c8['destroy']()[_0xcb8c('0x2a')](function(){_0x427e8b[_0xcb8c('0x1f')](0xcc)[_0xcb8c('0x20')]();});}};}function handleEntityNotFound(_0x382c9c,_0x253145){return function(_0x1a1cd4){if(!_0x1a1cd4){_0x382c9c[_0xcb8c('0x2b')](0x194);}return _0x1a1cd4;};}function handleError(_0x36ab17,_0x325ece){_0x325ece=_0x325ece||0x1f4;return function(_0x3720bb){logger['error'](_0x3720bb[_0xcb8c('0x2c')]);if(_0x3720bb[_0xcb8c('0x2d')]){delete _0x3720bb[_0xcb8c('0x2d')];}_0x36ab17[_0xcb8c('0x1f')](_0x325ece)[_0xcb8c('0x2e')](_0x3720bb);};}exports[_0xcb8c('0x2f')]=function(_0x5490ad,_0x5524b1,_0x382bb8){if(!_0x5490ad[_0xcb8c('0x30')]['hasOwnProperty'](_0xcb8c('0x31'))&&!_0x5490ad[_0xcb8c('0x30')][_0xcb8c('0x32')](_0xcb8c('0x33'))){throw new db[(_0xcb8c('0x34'))][(_0xcb8c('0x35'))](_0xcb8c('0x36'));}else{if(_0x5490ad[_0xcb8c('0x30')][_0xcb8c('0x32')](_0xcb8c('0x33'))&&!_0x5490ad['body'][_0xcb8c('0x32')](_0xcb8c('0x37'))){throw new db[(_0xcb8c('0x34'))][(_0xcb8c('0x35'))](_0xcb8c('0x38'));}if(!_0x5490ad['body'][_0xcb8c('0x32')](_0xcb8c('0x39'))){throw new db[(_0xcb8c('0x34'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x36389b=JSON[_0xcb8c('0x3a')](_0x5490ad[_0xcb8c('0x30')][_0xcb8c('0x39')]);}catch(_0x164003){logger[_0xcb8c('0x3b')](_0x164003);throw new db['Sequelize'][(_0xcb8c('0x35'))](_0xcb8c('0x3c'));}var _0x2ddc94=[_0xcb8c('0x3d'),_0xcb8c('0x3e'),_0xcb8c('0x3f'),'openchannelqueue',_0xcb8c('0x40'),_0xcb8c('0x41'),_0xcb8c('0x42'),_0xcb8c('0x43'),_0xcb8c('0x44')];if(_[_0xcb8c('0x45')](_0x36389b,function(_0x17de50){return!_[_0xcb8c('0x46')](_0x2ddc94,_0x17de50[_0xcb8c('0x47')]['toLowerCase']());})){throw new db['Sequelize'][(_0xcb8c('0x35'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x249f4f={};_0x249f4f[_0xcb8c('0x48')]=_0x5490ad[_0xcb8c('0x30')][_0xcb8c('0x32')](_0xcb8c('0x48'))?_0x5490ad[_0xcb8c('0x30')][_0xcb8c('0x48')]:_0x5490ad['user'][_0xcb8c('0x49')];_0x249f4f[_0xcb8c('0x4a')]=_[_0xcb8c('0x4b')](_0x5490ad['body']['recipientsDescription'])?null:_0x5490ad[_0xcb8c('0x30')]['recipientsDescription'];_0x249f4f[_0xcb8c('0x4c')]=_0x5490ad[_0xcb8c('0x30')]['beep']||![];_0x249f4f['SenderId']=_0x5490ad[_0xcb8c('0x44')]['id'];return getContent(_0x5490ad[_0xcb8c('0x30')])[_0xcb8c('0x2a')](function(_0x142548){_0x249f4f[_0xcb8c('0x30')]=_0x142548;return getRecipients(_0x36389b);})[_0xcb8c('0x2a')](function(_0x1ce6dd){_0x249f4f[_0xcb8c('0x4d')]=_[_0xcb8c('0x4e')](_0x1ce6dd)[_0xcb8c('0x4f')](',');return db[_0xcb8c('0x50')]['transaction'](function(_0xbe75e2){return db['UserNotification'][_0xcb8c('0x51')](_0x249f4f,{'raw':!![],'transaction':_0xbe75e2})[_0xcb8c('0x2a')](function(_0x4a1407){var _0x5a2e36={'sender':_0x249f4f[_0xcb8c('0x48')],'description':_0x249f4f[_0xcb8c('0x4a')],'content':_0x249f4f[_0xcb8c('0x30')],'beep':_0x249f4f[_0xcb8c('0x4c')]};_0x1ce6dd[_0xcb8c('0x52')](function(_0x5baf82){_0x5a2e36['recipient']=_0x5baf82;socket[_0xcb8c('0x53')](_0xcb8c('0x54'),_0x5a2e36);});return _0x4a1407;});});})[_0xcb8c('0x2a')](respondWithResult(_0x5524b1,0xc9))['catch'](handleError(_0x5524b1,null));};function getContent(_0x380315){return new BPromise(function(_0x422d2c,_0x2ee72d){if(_0x380315[_0xcb8c('0x31')]){_0x422d2c(_0x380315[_0xcb8c('0x31')]);return;}return db[_0xcb8c('0x55')]['findOne']({'attributes':[_0xcb8c('0x56')],'where':{'id':_0x380315['TemplateId']},'raw':!![]})['then'](function(_0x3c8753){if(!_0x3c8753)throw new db['Sequelize'][(_0xcb8c('0x35'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3fdf5d=Mustache[_0xcb8c('0x57')](_0x3c8753['html'],_0x380315[_0xcb8c('0x37')]);_0x422d2c(_0x3fdf5d);})['catch'](function(_0x2a9b3){_0x2ee72d(_0x2a9b3);});});}function getRecipients(_0x17bd25){return new BPromise(function(_0x41b951,_0x633125){var _0x41cf58=[];var _0xc2b28f=[];_0x17bd25[_0xcb8c('0x52')](function(_0x26d5e8){var _0x70c32c=_[_0xcb8c('0x58')](_0x26d5e8[_0xcb8c('0x47')][_0xcb8c('0x59')]());if(_0x70c32c===_0xcb8c('0x5a')){_0x41cf58=_['union'](_0x41cf58,_0x26d5e8[_0xcb8c('0x5b')]);}else{if(_[_0xcb8c('0x46')](_0x70c32c,_0xcb8c('0x5c')))_0x70c32c=_0x70c32c['replace'](_0xcb8c('0x5c'),_0xcb8c('0x5d'));_0x26d5e8[_0xcb8c('0x5b')]['forEach'](function(_0x375a98){_0xc2b28f[_0xcb8c('0x5e')](getAgents(_0x70c32c,_0x375a98));});}});return BPromise[_0xcb8c('0x5f')](_0xc2b28f)[_0xcb8c('0x2a')](function(_0x3950ac){_0x41cf58=_[_0xcb8c('0x60')](_0x41cf58,_[_0xcb8c('0x61')](_0x3950ac));_0x41b951(_0x41cf58);})[_0xcb8c('0x62')](function(_0x13b095){_0x633125(_0x13b095);});});}function getAgents(_0x54c397,_0x579f6){return new BPromise(function(_0x493cec,_0x3f8f1b){return db[_0x54c397][_0xcb8c('0x63')]({'where':{'id':_0x579f6}})[_0xcb8c('0x2a')](function(_0x4bae12){return _0x4bae12[_0xcb8c('0x64')]({'attributes':['id'],'raw':!![]})[_0xcb8c('0x2a')](function(_0x5334cf){var _0x8c9ee6=_[_0xcb8c('0x65')](_0x5334cf,'id');_0x493cec(_0x8c9ee6);});})[_0xcb8c('0x62')](function(_0x2c746a){_0x3f8f1b(_0x2c746a);});});} \ No newline at end of file +var _0x74f4=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','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','whatsappqueue','user','some','includes','model','toLowerCase','senderName','recipientsDescription','isEmpty','beep','SenderId','then','recipientsId','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','text','Template','findOne','html','startCase','User','ids','replace','push','all','union','catch','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x74f4,0x1e6));var _0x474f=function(_0x20ee12,_0x3a4e68){_0x20ee12=_0x20ee12-0x0;var _0x2de947=_0x74f4[_0x20ee12];return _0x2de947;};'use strict';var emlformat=require(_0x474f('0x0'));var rimraf=require(_0x474f('0x1'));var zipdir=require(_0x474f('0x2'));var jsonpatch=require(_0x474f('0x3'));var rp=require('request-promise');var moment=require(_0x474f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x474f('0x5'));var util=require(_0x474f('0x6'));var path=require(_0x474f('0x7'));var sox=require(_0x474f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x474f('0x9'));var _=require(_0x474f('0xa'));var squel=require(_0x474f('0xb'));var crypto=require(_0x474f('0xc'));var jsforce=require(_0x474f('0xd'));var deskjs=require(_0x474f('0xe'));var toCsv=require(_0x474f('0xf'));var querystring=require(_0x474f('0x10'));var Papa=require('papaparse');var Redis=require(_0x474f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x474f('0x12'));var as=require(_0x474f('0x13'));var hardwareService=require(_0x474f('0x14'));var logger=require(_0x474f('0x15'))('api');var utils=require(_0x474f('0x16'));var config=require(_0x474f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x474f('0x18'))['db'];config[_0x474f('0x19')]=_[_0x474f('0x1a')](config['redis'],{'host':_0x474f('0x1b'),'port':0x18eb});var socket=require(_0x474f('0x1c'))(new Redis(config[_0x474f('0x19')]));require(_0x474f('0x1d'))[_0x474f('0x1e')](socket);function respondWithStatusCode(_0x2ee016,_0x2136ff){_0x2136ff=_0x2136ff||0xcc;return function(_0x5cfe71){if(_0x5cfe71){return _0x2ee016[_0x474f('0x1f')](_0x2136ff);}return _0x2ee016[_0x474f('0x20')](_0x2136ff)[_0x474f('0x21')]();};}function respondWithResult(_0x200802,_0x30da7f){_0x30da7f=_0x30da7f||0xc8;return function(_0x3cb19b){if(_0x3cb19b){return _0x200802[_0x474f('0x20')](_0x30da7f)['json'](_0x3cb19b);}};}function respondWithFilteredResult(_0x467783,_0x27fac6){return function(_0x27afd9){if(_0x27afd9){var _0x3bec03=typeof _0x27fac6[_0x474f('0x22')]===_0x474f('0x23')&&typeof _0x27fac6[_0x474f('0x24')]==='undefined';var _0x55f0d1=_0x27afd9[_0x474f('0x25')];var _0x25af99=_0x3bec03?0x0:_0x27fac6[_0x474f('0x22')];var _0x3f7691=_0x3bec03?_0x27afd9['count']:_0x27fac6[_0x474f('0x22')]+_0x27fac6['limit'];var _0x195d76;if(_0x3f7691>=_0x55f0d1){_0x3f7691=_0x55f0d1;_0x195d76=0xc8;}else{_0x195d76=0xce;}_0x467783[_0x474f('0x20')](_0x195d76);return _0x467783[_0x474f('0x26')](_0x474f('0x27'),_0x25af99+'-'+_0x3f7691+'/'+_0x55f0d1)[_0x474f('0x28')](_0x27afd9);}return null;};}function patchUpdates(_0x341c9c){return function(_0xae41b9){try{jsonpatch[_0x474f('0x29')](_0xae41b9,_0x341c9c,!![]);}catch(_0x140fde){return BPromise[_0x474f('0x2a')](_0x140fde);}return _0xae41b9[_0x474f('0x2b')]();};}function saveUpdates(_0x22da5b,_0x4baee4){return function(_0xe5893d){if(_0xe5893d){return _0xe5893d[_0x474f('0x2c')](_0x22da5b)['then'](function(_0x4be7b2){return _0x4be7b2;});}return null;};}function removeEntity(_0x580b64,_0x8e232b){return function(_0x46e5b1){if(_0x46e5b1){return _0x46e5b1[_0x474f('0x2d')]()['then'](function(){_0x580b64[_0x474f('0x20')](0xcc)[_0x474f('0x21')]();});}};}function handleEntityNotFound(_0x566fb7,_0x2da029){return function(_0x51d50c){if(!_0x51d50c){_0x566fb7[_0x474f('0x1f')](0x194);}return _0x51d50c;};}function handleError(_0x544dab,_0x32cd31){_0x32cd31=_0x32cd31||0x1f4;return function(_0x425a49){logger[_0x474f('0x2e')](_0x425a49[_0x474f('0x2f')]);if(_0x425a49[_0x474f('0x30')]){delete _0x425a49['name'];}_0x544dab['status'](_0x32cd31)[_0x474f('0x31')](_0x425a49);};}exports[_0x474f('0x32')]=function(_0x567c29,_0xd51c48,_0x13e615){if(!_0x567c29[_0x474f('0x33')][_0x474f('0x34')]('text')&&!_0x567c29[_0x474f('0x33')]['hasOwnProperty'](_0x474f('0x35'))){throw new db['Sequelize'][(_0x474f('0x36'))](_0x474f('0x37'));}else{if(_0x567c29[_0x474f('0x33')][_0x474f('0x34')]('TemplateId')&&!_0x567c29[_0x474f('0x33')]['hasOwnProperty'](_0x474f('0x38'))){throw new db[(_0x474f('0x39'))]['ValidationError'](_0x474f('0x3a'));}if(!_0x567c29[_0x474f('0x33')][_0x474f('0x34')](_0x474f('0x3b'))){throw new db[(_0x474f('0x39'))]['ValidationError'](_0x474f('0x3c'));}else{try{var _0x323f40=JSON[_0x474f('0x3d')](_0x567c29[_0x474f('0x33')][_0x474f('0x3b')]);}catch(_0x129dca){logger[_0x474f('0x2e')](_0x129dca);throw new db[(_0x474f('0x39'))]['ValidationError'](_0x474f('0x3e'));}var _0x3b85a6=['chatqueue',_0x474f('0x3f'),_0x474f('0x40'),_0x474f('0x41'),_0x474f('0x42'),_0x474f('0x43'),_0x474f('0x44'),'team',_0x474f('0x45')];if(_[_0x474f('0x46')](_0x323f40,function(_0x35acb5){return!_[_0x474f('0x47')](_0x3b85a6,_0x35acb5[_0x474f('0x48')][_0x474f('0x49')]());})){throw new db[(_0x474f('0x39'))][(_0x474f('0x36'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x12eedd={};_0x12eedd[_0x474f('0x4a')]=_0x567c29[_0x474f('0x33')][_0x474f('0x34')]('senderName')?_0x567c29[_0x474f('0x33')][_0x474f('0x4a')]:_0x567c29['user']['fullname'];_0x12eedd[_0x474f('0x4b')]=_[_0x474f('0x4c')](_0x567c29[_0x474f('0x33')][_0x474f('0x4b')])?null:_0x567c29[_0x474f('0x33')][_0x474f('0x4b')];_0x12eedd[_0x474f('0x4d')]=_0x567c29[_0x474f('0x33')][_0x474f('0x4d')]||![];_0x12eedd[_0x474f('0x4e')]=_0x567c29['user']['id'];return getContent(_0x567c29[_0x474f('0x33')])['then'](function(_0x1be973){_0x12eedd[_0x474f('0x33')]=_0x1be973;return getRecipients(_0x323f40);})[_0x474f('0x4f')](function(_0x534479){_0x12eedd[_0x474f('0x50')]=_['sortBy'](_0x534479)[_0x474f('0x51')](',');return db[_0x474f('0x52')][_0x474f('0x53')](function(_0x162472){return db[_0x474f('0x54')][_0x474f('0x55')](_0x12eedd,{'raw':!![],'transaction':_0x162472})[_0x474f('0x4f')](function(_0x1dea5d){var _0x17bd85={'sender':_0x12eedd['senderName'],'description':_0x12eedd['recipientsDescription'],'content':_0x12eedd[_0x474f('0x33')],'beep':_0x12eedd[_0x474f('0x4d')]};_0x534479[_0x474f('0x56')](function(_0x5cd034){_0x17bd85[_0x474f('0x57')]=_0x5cd034;socket[_0x474f('0x58')](_0x474f('0x59'),_0x17bd85);});return _0x1dea5d;});});})[_0x474f('0x4f')](respondWithResult(_0xd51c48,0xc9))['catch'](handleError(_0xd51c48,null));};function getContent(_0x4fd858){return new BPromise(function(_0x425885,_0x3d62f0){if(_0x4fd858[_0x474f('0x5a')]){_0x425885(_0x4fd858['text']);return;}return db[_0x474f('0x5b')][_0x474f('0x5c')]({'attributes':[_0x474f('0x5d')],'where':{'id':_0x4fd858[_0x474f('0x35')]},'raw':!![]})['then'](function(_0xbd56b8){if(!_0xbd56b8)throw new db['Sequelize'][(_0x474f('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x571c16=Mustache['render'](_0xbd56b8['html'],_0x4fd858['view']);_0x425885(_0x571c16);})['catch'](function(_0x34d720){_0x3d62f0(_0x34d720);});});}function getRecipients(_0x2166d9){return new BPromise(function(_0x28c434,_0x58bb69){var _0x367628=[];var _0x45b089=[];_0x2166d9['forEach'](function(_0x360a65){var _0x54acdb=_[_0x474f('0x5e')](_0x360a65[_0x474f('0x48')][_0x474f('0x49')]());if(_0x54acdb===_0x474f('0x5f')){_0x367628=_['union'](_0x367628,_0x360a65[_0x474f('0x60')]);}else{if(_['includes'](_0x54acdb,'queue'))_0x54acdb=_0x54acdb[_0x474f('0x61')]('queue','Queue');_0x360a65[_0x474f('0x60')]['forEach'](function(_0x4367cc){_0x45b089[_0x474f('0x62')](getAgents(_0x54acdb,_0x4367cc));});}});return BPromise[_0x474f('0x63')](_0x45b089)[_0x474f('0x4f')](function(_0x178611){_0x367628=_[_0x474f('0x64')](_0x367628,_['flatten'](_0x178611));_0x28c434(_0x367628);})[_0x474f('0x65')](function(_0x541d5f){_0x58bb69(_0x541d5f);});});}function getAgents(_0x1f3c6f,_0x4baece){return new BPromise(function(_0x54db3b,_0x4f0e26){return db[_0x1f3c6f][_0x474f('0x5c')]({'where':{'id':_0x4baece}})[_0x474f('0x4f')](function(_0x90f9b4){return _0x90f9b4[_0x474f('0x66')]({'attributes':['id'],'raw':!![]})[_0x474f('0x4f')](function(_0x24a983){var _0x5117a8=_[_0x474f('0x67')](_0x24a983,'id');_0x54db3b(_0x5117a8);});})['catch'](function(_0x2fcb3b){_0x4f0e26(_0x2fcb3b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index bf1e0c4..4c9dad1 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 _0x3cb7=['exports','events','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x1f782d,_0x5906b8){var _0x228cce=function(_0x3036cc){while(--_0x3036cc){_0x1f782d['push'](_0x1f782d['shift']());}};_0x228cce(++_0x5906b8);}(_0x3cb7,0x119));var _0x73cb=function(_0x42f687,_0x558724){_0x42f687=_0x42f687-0x0;var _0x108838=_0x3cb7[_0x42f687];return _0x108838;};'use strict';var EventEmitter=require(_0x73cb('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x73cb('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x73cb('0x2'),'afterDestroy':_0x73cb('0x3')};function emitEvent(_0x140d8b){return function(_0xe7b0e6,_0x39584a,_0xfdbd39){UserNotificationEvents[_0x73cb('0x4')](_0x140d8b+':'+_0xe7b0e6['id'],_0xe7b0e6);UserNotificationEvents['emit'](_0x140d8b,_0xe7b0e6);_0xfdbd39(null);};}for(var e in events){if(events[_0x73cb('0x5')](e)){var event=events[e];UserNotification[_0x73cb('0x6')](e,emitEvent(event));}}module[_0x73cb('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x509e=['emit','hook','exports','../../mysqldb','UserNotification','save','update','remove'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x509e,0x163));var _0xe509=function(_0x5bf5c3,_0x46a702){_0x5bf5c3=_0x5bf5c3-0x0;var _0x4e2983=_0x509e[_0x5bf5c3];return _0x4e2983;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xe509('0x0'))['db'][_0xe509('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe509('0x2'),'afterUpdate':_0xe509('0x3'),'afterDestroy':_0xe509('0x4')};function emitEvent(_0x162645){return function(_0xe7b597,_0x35cb8d,_0x758c28){UserNotificationEvents[_0xe509('0x5')](_0x162645+':'+_0xe7b597['id'],_0xe7b597);UserNotificationEvents['emit'](_0x162645,_0xe7b597);_0x758c28(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xe509('0x6')](e,emitEvent(event));}}module[_0xe509('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 4c4b5e5..826137c 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 _0xe9cb=['lodash','util','../../config/logger','api','bluebird','rimraf','./userNotification.attributes','define','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0xa6ab54,_0x69c129){var _0x27f9b3=function(_0x2c58c2){while(--_0x2c58c2){_0xa6ab54['push'](_0xa6ab54['shift']());}};_0x27f9b3(++_0x69c129);}(_0xe9cb,0x160));var _0xbe9c=function(_0x4349cd,_0xc9bf81){_0x4349cd=_0x4349cd-0x0;var _0x3df0ef=_0xe9cb[_0x4349cd];return _0x3df0ef;};'use strict';var _=require(_0xbe9c('0x0'));var util=require(_0xbe9c('0x1'));var logger=require(_0xbe9c('0x2'))(_0xbe9c('0x3'));var moment=require('moment');var BPromise=require(_0xbe9c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbe9c('0x5'));var config=require('../../config/environment');var attributes=require(_0xbe9c('0x6'));module['exports']=function(_0x545cfd,_0x30ba4a){return _0x545cfd[_0xbe9c('0x7')]('UserNotification',attributes,{'tableName':_0xbe9c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe9c('0x9'),'collate':_0xbe9c('0xa')});}; \ No newline at end of file +var _0x8dd7=['UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','./userNotification.attributes','exports','define'];(function(_0x2d76fd,_0x37fdbf){var _0x194ffd=function(_0x18a849){while(--_0x18a849){_0x2d76fd['push'](_0x2d76fd['shift']());}};_0x194ffd(++_0x37fdbf);}(_0x8dd7,0x164));var _0x78dd=function(_0x10d3c2,_0x1f5142){_0x10d3c2=_0x10d3c2-0x0;var _0x4208aa=_0x8dd7[_0x10d3c2];return _0x4208aa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x78dd('0x0'))(_0x78dd('0x1'));var moment=require('moment');var BPromise=require(_0x78dd('0x2'));var rp=require(_0x78dd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x78dd('0x4'));module[_0x78dd('0x5')]=function(_0x3dfaa5,_0x3ba06a){return _0x3dfaa5[_0x78dd('0x6')](_0x78dd('0x7'),attributes,{'tableName':_0x78dd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x78dd('0x9'),'collate':_0x78dd('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 0b65ce9..7164ca5 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 _0xea3e=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','catch','util','moment'];(function(_0x165300,_0x7b6a39){var _0x4b3560=function(_0x2741c){while(--_0x2741c){_0x165300['push'](_0x165300['shift']());}};_0x4b3560(++_0x7b6a39);}(_0xea3e,0x1c0));var _0xeea3=function(_0x1b9f87,_0x55d160){_0x1b9f87=_0x1b9f87-0x0;var _0x4d1ad9=_0xea3e[_0x1b9f87];return _0x4d1ad9;};'use strict';var _=require('lodash');var util=require(_0xeea3('0x0'));var moment=require(_0xeea3('0x1'));var BPromise=require(_0xeea3('0x2'));var rs=require(_0xeea3('0x3'));var fs=require('fs');var Redis=require(_0xeea3('0x4'));var db=require(_0xeea3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeea3('0x6'));var config=require('../../config/environment');var jayson=require(_0xeea3('0x7'));var client=jayson[_0xeea3('0x8')]['http']({'port':0x232a});config['redis']=_[_0xeea3('0x9')](config[_0xeea3('0xa')],{'host':_0xeea3('0xb'),'port':0x18eb});var socket=require(_0xeea3('0xc'))(new Redis(config[_0xeea3('0xa')]));require(_0xeea3('0xd'))['register'](socket);function respondWithRpcPromise(_0x704268,_0x11ef7d,_0x37a0aa){return new BPromise(function(_0x3a4479,_0x22a516){return client[_0xeea3('0xe')](_0x704268,_0x37a0aa)[_0xeea3('0xf')](function(_0x37c8a1){logger[_0xeea3('0x10')]('UserNotification,\x20%s,\x20%s',_0x11ef7d,_0xeea3('0x11'));logger['debug'](_0xeea3('0x12'),_0x11ef7d,'request\x20sent',JSON[_0xeea3('0x13')](_0x37c8a1));if(_0x37c8a1[_0xeea3('0x14')]){if(_0x37c8a1[_0xeea3('0x14')][_0xeea3('0x15')]===0x1f4){logger['error'](_0xeea3('0x16'),_0x11ef7d,_0x37c8a1[_0xeea3('0x14')][_0xeea3('0x17')]);return _0x22a516(_0x37c8a1[_0xeea3('0x14')][_0xeea3('0x17')]);}logger[_0xeea3('0x14')]('UserNotification,\x20%s,\x20%s',_0x11ef7d,_0x37c8a1[_0xeea3('0x14')]['message']);return _0x3a4479(_0x37c8a1[_0xeea3('0x14')][_0xeea3('0x17')]);}else{logger[_0xeea3('0x10')](_0xeea3('0x16'),_0x11ef7d,_0xeea3('0x11'));_0x3a4479(_0x37c8a1['result']['message']);}})[_0xeea3('0x18')](function(_0x1e9c9e){logger[_0xeea3('0x14')]('UserNotification,\x20%s,\x20%s',_0x11ef7d,_0x1e9c9e);_0x22a516(_0x1e9c9e);});});} \ No newline at end of file +var _0x9fde=['error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1f5477,_0x31ed78){var _0x401b14=function(_0x59eaf0){while(--_0x59eaf0){_0x1f5477['push'](_0x1f5477['shift']());}};_0x401b14(++_0x31ed78);}(_0x9fde,0x150));var _0xe9fd=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x9fde[_0x261522];return _0x98a25a;};'use strict';var _=require(_0xe9fd('0x0'));var util=require(_0xe9fd('0x1'));var moment=require(_0xe9fd('0x2'));var BPromise=require(_0xe9fd('0x3'));var rs=require(_0xe9fd('0x4'));var fs=require('fs');var Redis=require(_0xe9fd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9fd('0x6'));var logger=require(_0xe9fd('0x7'))(_0xe9fd('0x8'));var config=require('../../config/environment');var jayson=require(_0xe9fd('0x9'));var client=jayson[_0xe9fd('0xa')][_0xe9fd('0xb')]({'port':0x232a});config[_0xe9fd('0xc')]=_[_0xe9fd('0xd')](config[_0xe9fd('0xc')],{'host':_0xe9fd('0xe'),'port':0x18eb});var socket=require(_0xe9fd('0xf'))(new Redis(config['redis']));require(_0xe9fd('0x10'))[_0xe9fd('0x11')](socket);function respondWithRpcPromise(_0x1e5ca0,_0x414a3a,_0x1b9509){return new BPromise(function(_0x5acca7,_0x39d44c){return client['request'](_0x1e5ca0,_0x1b9509)[_0xe9fd('0x12')](function(_0x269778){logger[_0xe9fd('0x13')]('UserNotification,\x20%s,\x20%s',_0x414a3a,_0xe9fd('0x14'));logger[_0xe9fd('0x15')](_0xe9fd('0x16'),_0x414a3a,_0xe9fd('0x14'),JSON[_0xe9fd('0x17')](_0x269778));if(_0x269778['error']){if(_0x269778[_0xe9fd('0x18')][_0xe9fd('0x19')]===0x1f4){logger[_0xe9fd('0x18')](_0xe9fd('0x1a'),_0x414a3a,_0x269778[_0xe9fd('0x18')][_0xe9fd('0x1b')]);return _0x39d44c(_0x269778[_0xe9fd('0x18')][_0xe9fd('0x1b')]);}logger[_0xe9fd('0x18')](_0xe9fd('0x1a'),_0x414a3a,_0x269778[_0xe9fd('0x18')][_0xe9fd('0x1b')]);return _0x5acca7(_0x269778[_0xe9fd('0x18')][_0xe9fd('0x1b')]);}else{logger[_0xe9fd('0x13')](_0xe9fd('0x1a'),_0x414a3a,_0xe9fd('0x14'));_0x5acca7(_0x269778[_0xe9fd('0x1c')][_0xe9fd('0x1b')]);}})[_0xe9fd('0x1d')](function(_0x4518fb){logger[_0xe9fd('0x18')]('UserNotification,\x20%s,\x20%s',_0x414a3a,_0x4518fb);_0x39d44c(_0x4518fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index c0c6abe..721c402 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 _0x9d38=['emit','register','length','./userNotification.events','save','remove','update'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x9d38,0x16f));var _0x89d3=function(_0x3632a9,_0x34a9dc){_0x3632a9=_0x3632a9-0x0;var _0x171036=_0x9d38[_0x3632a9];return _0x171036;};'use strict';var UserNotificationEvents=require(_0x89d3('0x0'));var events=[_0x89d3('0x1'),_0x89d3('0x2'),_0x89d3('0x3')];function createListener(_0x52c31a,_0x4cd05a){return function(_0x253522){_0x4cd05a[_0x89d3('0x4')](_0x52c31a,_0x253522);};}function removeListener(_0x5c0134,_0x139ea5){return function(){UserNotificationEvents['removeListener'](_0x5c0134,_0x139ea5);};}exports[_0x89d3('0x5')]=function(_0x3298c9){for(var _0x4db46e=0x0,_0x598ab5=events[_0x89d3('0x6')];_0x4db46e<_0x598ab5;_0x4db46e++){var _0x5413cd=events[_0x4db46e];var _0x8573a5=createListener('userNotification:'+_0x5413cd,_0x3298c9);UserNotificationEvents['on'](_0x5413cd,_0x8573a5);}}; \ No newline at end of file +var _0x0667=['userNotification:','./userNotification.events','remove','update','register'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x0667,0x191));var _0x7066=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0667[_0x2c91e9];return _0x13f0ff;};'use strict';var UserNotificationEvents=require(_0x7066('0x0'));var events=['save',_0x7066('0x1'),_0x7066('0x2')];function createListener(_0x290403,_0x12ad30){return function(_0x546cce){_0x12ad30['emit'](_0x290403,_0x546cce);};}function removeListener(_0x25e639,_0x4c47f8){return function(){UserNotificationEvents['removeListener'](_0x25e639,_0x4c47f8);};}exports[_0x7066('0x3')]=function(_0x50b807){for(var _0x202254=0x0,_0x355fda=events['length'];_0x202254<_0x355fda;_0x202254++){var _0x502632=events[_0x202254];var _0x5ea48a=createListener(_0x7066('0x4')+_0x502632,_0x50b807);UserNotificationEvents['on'](_0x502632,_0x5ea48a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 1a4a591..e633903 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x310831,_0x40b71a){var _0x252af3=function(_0x597f08){while(--_0x597f08){_0x310831['push'](_0x310831['shift']());}};_0x252af3(++_0x40b71a);}(_0x70e0,0x17b));var _0x070e=function(_0x5e24f7,_0x246d19){_0x5e24f7=_0x5e24f7-0x0;var _0x4fa03f=_0x70e0[_0x5e24f7];return _0x4fa03f;};'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(_0x13dc57,_0x1136b7){var _0x4b5dca=function(_0x1cf314){while(--_0x1cf314){_0x13dc57['push'](_0x13dc57['shift']());}};_0x4b5dca(++_0x1136b7);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 43abcbb..238214a 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 _0xc00c=['sequelize','INTEGER'];(function(_0x41da22,_0x2d02f4){var _0x27b255=function(_0x3ac6a0){while(--_0x3ac6a0){_0x41da22['push'](_0x41da22['shift']());}};_0x27b255(++_0x2d02f4);}(_0xc00c,0x92));var _0xcc00=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xc00c[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require(_0xcc00('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xcc00('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd1e2=['exports'];(function(_0x3ccbc7,_0x3093c8){var _0x50c97a=function(_0x4af44d){while(--_0x4af44d){_0x3ccbc7['push'](_0x3ccbc7['shift']());}};_0x50c97a(++_0x3093c8);}(_0xd1e2,0x1c2));var _0x2d1e=function(_0x38a1e5,_0x272e02){_0x38a1e5=_0x38a1e5-0x0;var _0x5f4632=_0xd1e2[_0x38a1e5];return _0x5f4632;};'use strict';var Sequelize=require('sequelize');module[_0x2d1e('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 2b09962..4e7e806 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 _0x74a0=['user_has_openchannel_queues','lodash','util','api','moment','bluebird','../../config/environment','./userOpenchannelQueue.attributes','exports','define'];(function(_0x4fda3d,_0x3686c5){var _0x5e7c72=function(_0xe10694){while(--_0xe10694){_0x4fda3d['push'](_0x4fda3d['shift']());}};_0x5e7c72(++_0x3686c5);}(_0x74a0,0x17d));var _0x074a=function(_0x419859,_0x3766e4){_0x419859=_0x419859-0x0;var _0x21fc52=_0x74a0[_0x419859];return _0x21fc52;};'use strict';var _=require(_0x074a('0x0'));var util=require(_0x074a('0x1'));var logger=require('../../config/logger')(_0x074a('0x2'));var moment=require(_0x074a('0x3'));var BPromise=require(_0x074a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x074a('0x5'));var attributes=require(_0x074a('0x6'));module[_0x074a('0x7')]=function(_0x312d9a,_0x4182ad){return _0x312d9a[_0x074a('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0x074a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a90=['moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api'];(function(_0x29d1e2,_0x12fbd2){var _0x151c43=function(_0x550b6d){while(--_0x550b6d){_0x29d1e2['push'](_0x29d1e2['shift']());}};_0x151c43(++_0x12fbd2);}(_0x2a90,0xed));var _0x02a9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2a90[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x02a9('0x0'));var logger=require(_0x02a9('0x1'))(_0x02a9('0x2'));var moment=require(_0x02a9('0x3'));var BPromise=require(_0x02a9('0x4'));var rp=require(_0x02a9('0x5'));var fs=require('fs');var path=require(_0x02a9('0x6'));var rimraf=require(_0x02a9('0x7'));var config=require('../../config/environment');var attributes=require(_0x02a9('0x8'));module['exports']=function(_0x272239,_0x27fe64){return _0x272239[_0x02a9('0x9')](_0x02a9('0xa'),attributes,{'tableName':_0x02a9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 450f2e6..c9e361c 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 _0xf9e0=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xf9e0,0x106));var _0x0f9e=function(_0x50bbb4,_0x50fa46){_0x50bbb4=_0x50bbb4-0x0;var _0x25e426=_0xf9e0[_0x50bbb4];return _0x25e426;};'use strict';var _=require('lodash');var util=require(_0x0f9e('0x0'));var moment=require('moment');var BPromise=require(_0x0f9e('0x1'));var rs=require(_0x0f9e('0x2'));var fs=require('fs');var Redis=require(_0x0f9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f9e('0x4'));var logger=require(_0x0f9e('0x5'))(_0x0f9e('0x6'));var config=require(_0x0f9e('0x7'));var jayson=require(_0x0f9e('0x8'));var client=jayson[_0x0f9e('0x9')][_0x0f9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x69b53e,_0x20396d,_0x2757d9){return new BPromise(function(_0x199e78,_0x16f6fc){return client[_0x0f9e('0xb')](_0x69b53e,_0x2757d9)[_0x0f9e('0xc')](function(_0x4e4296){logger[_0x0f9e('0xd')](_0x0f9e('0xe'),_0x20396d,_0x0f9e('0xf'));logger['debug'](_0x0f9e('0x10'),_0x20396d,_0x0f9e('0xf'),JSON[_0x0f9e('0x11')](_0x4e4296));if(_0x4e4296[_0x0f9e('0x12')]){if(_0x4e4296[_0x0f9e('0x12')][_0x0f9e('0x13')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x20396d,_0x4e4296[_0x0f9e('0x12')][_0x0f9e('0x14')]);return _0x16f6fc(_0x4e4296[_0x0f9e('0x12')][_0x0f9e('0x14')]);}logger[_0x0f9e('0x12')](_0x0f9e('0xe'),_0x20396d,_0x4e4296['error'][_0x0f9e('0x14')]);return _0x199e78(_0x4e4296['error'][_0x0f9e('0x14')]);}else{logger['info'](_0x0f9e('0xe'),_0x20396d,_0x0f9e('0xf'));_0x199e78(_0x4e4296[_0x0f9e('0x15')][_0x0f9e('0x14')]);}})['catch'](function(_0x1dc6b1){logger[_0x0f9e('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x20396d,_0x1dc6b1);_0x16f6fc(_0x1dc6b1);});});} \ No newline at end of file +var _0x0746=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','bluebird'];(function(_0x511d15,_0x4c95ae){var _0x1dfcb8=function(_0x2a3c56){while(--_0x2a3c56){_0x511d15['push'](_0x511d15['shift']());}};_0x1dfcb8(++_0x4c95ae);}(_0x0746,0x173));var _0x6074=function(_0x388765,_0x7d5fe2){_0x388765=_0x388765-0x0;var _0xd14a10=_0x0746[_0x388765];return _0xd14a10;};'use strict';var _=require('lodash');var util=require(_0x6074('0x0'));var moment=require(_0x6074('0x1'));var BPromise=require(_0x6074('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6074('0x3'));var db=require(_0x6074('0x4'))['db'];var utils=require(_0x6074('0x5'));var logger=require(_0x6074('0x6'))(_0x6074('0x7'));var config=require(_0x6074('0x8'));var jayson=require(_0x6074('0x9'));var client=jayson[_0x6074('0xa')][_0x6074('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5913,_0x137523,_0x1ed3a3){return new BPromise(function(_0xdab97e,_0x1de809){return client['request'](_0x5b5913,_0x1ed3a3)[_0x6074('0xc')](function(_0x847d3a){logger[_0x6074('0xd')](_0x6074('0xe'),_0x137523,'request\x20sent');logger[_0x6074('0xf')](_0x6074('0x10'),_0x137523,_0x6074('0x11'),JSON['stringify'](_0x847d3a));if(_0x847d3a[_0x6074('0x12')]){if(_0x847d3a['error'][_0x6074('0x13')]===0x1f4){logger['error'](_0x6074('0xe'),_0x137523,_0x847d3a[_0x6074('0x12')][_0x6074('0x14')]);return _0x1de809(_0x847d3a['error'][_0x6074('0x14')]);}logger[_0x6074('0x12')](_0x6074('0xe'),_0x137523,_0x847d3a[_0x6074('0x12')][_0x6074('0x14')]);return _0xdab97e(_0x847d3a[_0x6074('0x12')][_0x6074('0x14')]);}else{logger[_0x6074('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x137523,_0x6074('0x11'));_0xdab97e(_0x847d3a['result']['message']);}})[_0x6074('0x15')](function(_0x2a7893){logger[_0x6074('0x12')](_0x6074('0xe'),_0x137523,_0x2a7893);_0x1de809(_0x2a7893);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index b034548..94789bd 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 _0x11b2=['../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','getSections','/:id/resources','getResources','post','/:id/clone','clone','/:id/sections','addResources','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11b2,0xd2));var _0x211b=function(_0x34b7e0,_0x4f759b){_0x34b7e0=_0x34b7e0-0x0;var _0x3a4657=_0x11b2[_0x34b7e0];return _0x3a4657;};'use strict';var multer=require(_0x211b('0x0'));var util=require('util');var path=require(_0x211b('0x1'));var timeout=require('connect-timeout');var express=require(_0x211b('0x2'));var router=express[_0x211b('0x3')]();var fs_extra=require(_0x211b('0x4'));var auth=require(_0x211b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x211b('0x6'));var controller=require(_0x211b('0x7'));router[_0x211b('0x8')]('/',auth['isAuthenticated'](),controller[_0x211b('0x9')]);router['get'](_0x211b('0xa'),auth[_0x211b('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x211b('0x8')]('/:id/sections',auth[_0x211b('0xb')](),controller[_0x211b('0xc')]);router[_0x211b('0x8')](_0x211b('0xd'),auth['isAuthenticated'](),controller[_0x211b('0xe')]);router[_0x211b('0xf')]('/',auth[_0x211b('0xb')](),controller['create']);router['post'](_0x211b('0x10'),auth[_0x211b('0xb')](),controller[_0x211b('0x11')]);router['post'](_0x211b('0x12'),auth[_0x211b('0xb')](),controller['addSections']);router[_0x211b('0xf')](_0x211b('0xd'),auth['isAuthenticated'](),controller[_0x211b('0x13')]);router['put'](_0x211b('0x14'),auth[_0x211b('0xb')](),controller[_0x211b('0x15')]);router[_0x211b('0x16')](_0x211b('0x14'),auth[_0x211b('0xb')](),controller[_0x211b('0x17')]);router[_0x211b('0x16')](_0x211b('0x12'),auth['isAuthenticated'](),controller[_0x211b('0x18')]);router[_0x211b('0x16')](_0x211b('0xd'),auth[_0x211b('0xb')](),controller[_0x211b('0x19')]);module[_0x211b('0x1a')]=router; \ No newline at end of file +var _0x25ea=['post','/:id/clone','addSections','addResources','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources'];(function(_0xfbc285,_0xcc4151){var _0x2d8870=function(_0x5ec9e5){while(--_0x5ec9e5){_0xfbc285['push'](_0xfbc285['shift']());}};_0x2d8870(++_0xcc4151);}(_0x25ea,0xc4));var _0xa25e=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x25ea[_0x2afbb0];return _0x411ff2;};'use strict';var multer=require(_0xa25e('0x0'));var util=require(_0xa25e('0x1'));var path=require(_0xa25e('0x2'));var timeout=require(_0xa25e('0x3'));var express=require(_0xa25e('0x4'));var router=express['Router']();var fs_extra=require(_0xa25e('0x5'));var auth=require(_0xa25e('0x6'));var interaction=require(_0xa25e('0x7'));var config=require(_0xa25e('0x8'));var controller=require(_0xa25e('0x9'));router[_0xa25e('0xa')]('/',auth[_0xa25e('0xb')](),controller[_0xa25e('0xc')]);router['get'](_0xa25e('0xd'),auth[_0xa25e('0xb')](),controller[_0xa25e('0xe')]);router['get'](_0xa25e('0xf'),auth[_0xa25e('0xb')](),controller[_0xa25e('0x10')]);router[_0xa25e('0xa')](_0xa25e('0x11'),auth[_0xa25e('0xb')](),controller[_0xa25e('0x12')]);router[_0xa25e('0xa')](_0xa25e('0x13'),auth[_0xa25e('0xb')](),controller[_0xa25e('0x14')]);router[_0xa25e('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa25e('0x15')](_0xa25e('0x16'),auth[_0xa25e('0xb')](),controller['clone']);router[_0xa25e('0x15')](_0xa25e('0x11'),auth[_0xa25e('0xb')](),controller[_0xa25e('0x17')]);router[_0xa25e('0x15')]('/:id/resources',auth[_0xa25e('0xb')](),controller[_0xa25e('0x18')]);router['put'](_0xa25e('0xf'),auth[_0xa25e('0xb')](),controller[_0xa25e('0x19')]);router[_0xa25e('0x1a')](_0xa25e('0xf'),auth['isAuthenticated'](),controller[_0xa25e('0x1b')]);router[_0xa25e('0x1a')](_0xa25e('0x11'),auth[_0xa25e('0xb')](),controller[_0xa25e('0x1c')]);router[_0xa25e('0x1a')](_0xa25e('0x13'),auth['isAuthenticated'](),controller[_0xa25e('0x1d')]);module[_0xa25e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 0d7ec4d..b9f0020 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 _0x2c0d=['getDataValue','BOOLEAN','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x15de11,_0x3cd20d){var _0x4f1c07=function(_0xf74624){while(--_0xf74624){_0x15de11['push'](_0x15de11['shift']());}};_0x4f1c07(++_0x3cd20d);}(_0x2c0d,0x16e));var _0xd2c0=function(_0x5c3b5c,_0x1d193a){_0x5c3b5c=_0x5c3b5c-0x0;var _0x3951e3=_0x2c0d[_0x5c3b5c];return _0x3951e3;};'use strict';var Sequelize=require('sequelize');module[_0xd2c0('0x0')]={'name':{'type':Sequelize[_0xd2c0('0x1')],'allowNull':![],'unique':_0xd2c0('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x3237b1){this[_0xd2c0('0x3')](_0xd2c0('0x4'),_0x3237b1?_0x3237b1['join'](''):[]);},'get':function(){return this[_0xd2c0('0x5')](_0xd2c0('0x4'))?this[_0xd2c0('0x5')](_0xd2c0('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xd2c0('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xd2c0('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xd2c0('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xd2c0('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xd2c0('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x737f=['getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions'];(function(_0x1b09fe,_0x1fdd84){var _0x184858=function(_0x1a5d62){while(--_0x1a5d62){_0x1b09fe['push'](_0x1b09fe['shift']());}};_0x184858(++_0x1fdd84);}(_0x737f,0x1c3));var _0xf737=function(_0x734ac5,_0x4e2063){_0x734ac5=_0x734ac5-0x0;var _0x14e9df=_0x737f[_0x734ac5];return _0x14e9df;};'use strict';var Sequelize=require(_0xf737('0x0'));module['exports']={'name':{'type':Sequelize[_0xf737('0x1')],'allowNull':![],'unique':_0xf737('0x2')},'crudPermissions':{'type':Sequelize[_0xf737('0x1')],'set':function(_0x2030ad){this[_0xf737('0x3')]('crudPermissions',_0x2030ad?_0x2030ad['join'](''):[]);},'get':function(){return this['getDataValue'](_0xf737('0x4'))?this[_0xf737('0x5')](_0xf737('0x4'))[_0xf737('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xf737('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf737('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf737('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf737('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf737('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf737('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf737('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 9d4a05b..6f2faa7 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 _0x38d2=['removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','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','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','clone','get','createdAt','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','omit','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','push'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x38d2,0x86));var _0x238d=function(_0x1ff20d,_0x2c7796){_0x1ff20d=_0x1ff20d-0x0;var _0x18be6a=_0x38d2[_0x1ff20d];return _0x18be6a;};'use strict';var emlformat=require(_0x238d('0x0'));var rimraf=require(_0x238d('0x1'));var zipdir=require(_0x238d('0x2'));var jsonpatch=require(_0x238d('0x3'));var rp=require(_0x238d('0x4'));var moment=require(_0x238d('0x5'));var BPromise=require(_0x238d('0x6'));var Mustache=require(_0x238d('0x7'));var util=require(_0x238d('0x8'));var path=require(_0x238d('0x9'));var sox=require(_0x238d('0xa'));var csv=require('to-csv');var ejs=require(_0x238d('0xb'));var fs=require('fs');var fs_extra=require(_0x238d('0xc'));var _=require(_0x238d('0xd'));var squel=require(_0x238d('0xe'));var crypto=require(_0x238d('0xf'));var jsforce=require(_0x238d('0x10'));var deskjs=require(_0x238d('0x11'));var toCsv=require('to-csv');var querystring=require(_0x238d('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x238d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x238d('0x14'));var logger=require(_0x238d('0x15'))(_0x238d('0x16'));var utils=require(_0x238d('0x17'));var config=require(_0x238d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x238d('0x19'))['db'];config[_0x238d('0x1a')]=_['defaults'](config[_0x238d('0x1a')],{'host':_0x238d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x238d('0x1a')]));require('./userProfile.socket')[_0x238d('0x1c')](socket);function respondWithStatusCode(_0x2eabf1,_0xd49479){_0xd49479=_0xd49479||0xcc;return function(_0x1975c0){if(_0x1975c0){return _0x2eabf1[_0x238d('0x1d')](_0xd49479);}return _0x2eabf1['status'](_0xd49479)[_0x238d('0x1e')]();};}function respondWithResult(_0x4abf9a,_0xa9b50b){_0xa9b50b=_0xa9b50b||0xc8;return function(_0x1d34f5){if(_0x1d34f5){return _0x4abf9a[_0x238d('0x1f')](_0xa9b50b)[_0x238d('0x20')](_0x1d34f5);}};}function respondWithFilteredResult(_0x587bbd,_0x2bb7a2){return function(_0x5aaa57){if(_0x5aaa57){var _0x23e0f0=typeof _0x2bb7a2[_0x238d('0x21')]===_0x238d('0x22')&&typeof _0x2bb7a2[_0x238d('0x23')]==='undefined';var _0x14b07a=_0x5aaa57[_0x238d('0x24')];var _0x33d6fd=_0x23e0f0?0x0:_0x2bb7a2[_0x238d('0x21')];var _0x2977df=_0x23e0f0?_0x5aaa57[_0x238d('0x24')]:_0x2bb7a2['offset']+_0x2bb7a2[_0x238d('0x23')];var _0x49c51c;if(_0x2977df>=_0x14b07a){_0x2977df=_0x14b07a;_0x49c51c=0xc8;}else{_0x49c51c=0xce;}_0x587bbd['status'](_0x49c51c);return _0x587bbd[_0x238d('0x25')](_0x238d('0x26'),_0x33d6fd+'-'+_0x2977df+'/'+_0x14b07a)['json'](_0x5aaa57);}return null;};}function patchUpdates(_0x5de17f){return function(_0x23d136){try{jsonpatch[_0x238d('0x27')](_0x23d136,_0x5de17f,!![]);}catch(_0x130c15){return BPromise[_0x238d('0x28')](_0x130c15);}return _0x23d136[_0x238d('0x29')]();};}function saveUpdates(_0x435ad7,_0x3f1676){return function(_0x50d162){if(_0x50d162){return _0x50d162[_0x238d('0x2a')](_0x435ad7)[_0x238d('0x2b')](function(_0x533747){return _0x533747;});}return null;};}function removeEntity(_0x5571a5,_0x5cb130){return function(_0x14f43c){if(_0x14f43c){return _0x14f43c[_0x238d('0x2c')]()[_0x238d('0x2b')](function(){_0x5571a5[_0x238d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d86c8,_0x49bc5a){return function(_0x90ef99){if(!_0x90ef99){_0x2d86c8[_0x238d('0x1d')](0x194);}return _0x90ef99;};}function handleError(_0x453aa6,_0x5ce68b){_0x5ce68b=_0x5ce68b||0x1f4;return function(_0x34ff84){logger[_0x238d('0x2d')](_0x34ff84[_0x238d('0x2e')]);if(_0x34ff84[_0x238d('0x2f')]){delete _0x34ff84['name'];}_0x453aa6[_0x238d('0x1f')](_0x5ce68b)[_0x238d('0x30')](_0x34ff84);};}exports[_0x238d('0x31')]=function(_0x3ddfaa,_0x42bb97){var _0x5c2457={},_0x4ff398={},_0x29d115={'count':0x0,'rows':[]};var _0x439435=_['map'](db[_0x238d('0x32')][_0x238d('0x33')],function(_0x31e9b5){return{'name':_0x31e9b5[_0x238d('0x34')],'type':_0x31e9b5[_0x238d('0x35')]['key']};});_0x4ff398[_0x238d('0x36')]=_[_0x238d('0x37')](_0x439435,_0x238d('0x2f'));_0x4ff398[_0x238d('0x38')]=_[_0x238d('0x39')](_0x3ddfaa[_0x238d('0x38')]);_0x4ff398[_0x238d('0x3a')]=_[_0x238d('0x3b')](_0x4ff398[_0x238d('0x36')],_0x4ff398['query']);_0x5c2457[_0x238d('0x3c')]=_[_0x238d('0x3b')](_0x4ff398['model'],qs[_0x238d('0x3d')](_0x3ddfaa[_0x238d('0x38')][_0x238d('0x3d')]));_0x5c2457[_0x238d('0x3c')]=_0x5c2457[_0x238d('0x3c')]['length']?_0x5c2457[_0x238d('0x3c')]:_0x4ff398[_0x238d('0x36')];if(!_0x3ddfaa[_0x238d('0x38')][_0x238d('0x3e')](_0x238d('0x3f'))){_0x5c2457['limit']=qs['limit'](_0x3ddfaa[_0x238d('0x38')]['limit']);_0x5c2457[_0x238d('0x21')]=qs[_0x238d('0x21')](_0x3ddfaa[_0x238d('0x38')][_0x238d('0x21')]);}_0x5c2457[_0x238d('0x40')]=qs[_0x238d('0x41')](_0x3ddfaa['query'][_0x238d('0x41')]);_0x5c2457[_0x238d('0x42')]=qs[_0x238d('0x3a')](_[_0x238d('0x43')](_0x3ddfaa[_0x238d('0x38')],_0x4ff398[_0x238d('0x3a')]),_0x439435);if(_0x3ddfaa[_0x238d('0x38')]['filter']){_0x5c2457['where']=_[_0x238d('0x44')](_0x5c2457[_0x238d('0x42')],{'$or':_[_0x238d('0x37')](_0x439435,function(_0x36cb33){if(_0x36cb33[_0x238d('0x35')]!==_0x238d('0x45')){var _0x1b8043={};_0x1b8043[_0x36cb33['name']]={'$like':'%'+_0x3ddfaa[_0x238d('0x38')][_0x238d('0x46')]+'%'};return _0x1b8043;}})});}_0x5c2457=_[_0x238d('0x44')]({},_0x5c2457,_0x3ddfaa['options']);var _0x484eac={'where':_0x5c2457[_0x238d('0x42')]};return db[_0x238d('0x32')]['count'](_0x484eac)['then'](function(_0x1e9695){_0x29d115[_0x238d('0x24')]=_0x1e9695;if(_0x3ddfaa[_0x238d('0x38')][_0x238d('0x47')]){_0x5c2457[_0x238d('0x48')]=[{'all':!![]}];}return db[_0x238d('0x32')][_0x238d('0x49')](_0x5c2457);})[_0x238d('0x2b')](function(_0x151376){_0x29d115[_0x238d('0x4a')]=_0x151376;return _0x29d115;})[_0x238d('0x2b')](respondWithFilteredResult(_0x42bb97,_0x5c2457))[_0x238d('0x4b')](handleError(_0x42bb97,null));};exports[_0x238d('0x4c')]=function(_0x1a7743,_0x496ad2){var _0x3a26b1={'raw':![],'where':{'id':_0x1a7743[_0x238d('0x4d')]['id']}},_0x2d767d={};_0x2d767d[_0x238d('0x36')]=_['keys'](db[_0x238d('0x32')]['rawAttributes']);_0x2d767d[_0x238d('0x38')]=_['keys'](_0x1a7743[_0x238d('0x38')]);_0x2d767d['filters']=_['intersection'](_0x2d767d['model'],_0x2d767d[_0x238d('0x38')]);_0x3a26b1[_0x238d('0x3c')]=_[_0x238d('0x3b')](_0x2d767d[_0x238d('0x36')],qs['fields'](_0x1a7743[_0x238d('0x38')][_0x238d('0x3d')]));_0x3a26b1['attributes']=_0x3a26b1[_0x238d('0x3c')][_0x238d('0x4e')]?_0x3a26b1[_0x238d('0x3c')]:_0x2d767d[_0x238d('0x36')];if(_0x1a7743[_0x238d('0x38')][_0x238d('0x47')]){_0x3a26b1[_0x238d('0x48')]=[{'all':!![]}];}_0x3a26b1=_[_0x238d('0x44')]({},_0x3a26b1,_0x1a7743[_0x238d('0x4f')]);return db[_0x238d('0x32')][_0x238d('0x50')](_0x3a26b1)[_0x238d('0x2b')](handleEntityNotFound(_0x496ad2,null))[_0x238d('0x2b')](respondWithResult(_0x496ad2,null))[_0x238d('0x4b')](handleError(_0x496ad2,null));};exports[_0x238d('0x51')]=function(_0x381cbc,_0x26bec1){return db[_0x238d('0x32')]['create'](_0x381cbc[_0x238d('0x52')],{})[_0x238d('0x2b')](respondWithResult(_0x26bec1,0xc9))[_0x238d('0x4b')](handleError(_0x26bec1,null));};exports[_0x238d('0x53')]=function(_0x1cb678,_0x3dbb24){var _0x20e684={'where':{'id':_0x1cb678[_0x238d('0x4d')]['id']}},_0x5f3e37={};_0x5f3e37['model']=_[_0x238d('0x39')](db['UserProfile']['rawAttributes']);_0x20e684['attributes']=_[_0x238d('0x3b')](_0x5f3e37[_0x238d('0x36')],qs[_0x238d('0x3d')](_0x1cb678[_0x238d('0x38')][_0x238d('0x3d')]));_0x20e684[_0x238d('0x3c')]=_0x20e684[_0x238d('0x3c')]['length']?_0x20e684['attributes']:_0x5f3e37[_0x238d('0x36')];if(_0x1cb678[_0x238d('0x38')][_0x238d('0x47')]){_0x20e684['include']=[{'all':!![]}];}_0x20e684=_[_0x238d('0x44')]({},_0x20e684,_0x1cb678['options']);return db['UserProfile'][_0x238d('0x50')](_0x20e684)[_0x238d('0x2b')](handleEntityNotFound(_0x3dbb24,null))[_0x238d('0x2b')](function(_0x423e80){if(_0x423e80){var _0x3ecaf7=_0x423e80[_0x238d('0x54')]({'plain':!![]});_0x3ecaf7=qs['omit'](_0x3ecaf7,['id',_0x238d('0x55'),_0x238d('0x56'),'crudPermissions']);_0x1cb678[_0x238d('0x52')]=_['omit'](_0x1cb678[_0x238d('0x52')],['id',_0x238d('0x55'),'updatedAt']);return db[_0x238d('0x57')][_0x238d('0x58')](function(_0xdfc4b8){return db['UserProfile'][_0x238d('0x51')](_['merge'](_0x3ecaf7,_0x1cb678[_0x238d('0x52')]),{'include':_0x1cb678[_0x238d('0x38')][_0x238d('0x47')]?[{'all':!![]}]:undefined,'transaction':_0xdfc4b8})[_0x238d('0x2b')](function(_0x4c9e91){var _0x284865=_0x4c9e91['get']({'plain':!![]});return db[_0x238d('0x59')][_0x238d('0x49')]({'where':{'userProfileId':_0x1cb678['params']['id']},'raw':!![]})[_0x238d('0x2b')](function(_0x16510e){if(_0x16510e){return BPromise[_0x238d('0x5a')](_0x16510e,function(_0x43f9a2){return new BPromise(function(_0x121409,_0x2e9141){if(_0x43f9a2[_0x238d('0x5b')]===null||_0x43f9a2[_0x238d('0x5b')]===0x1)_0x121409(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x43f9a2['id']},'raw':!![]})[_0x238d('0x2b')](function(_0x5b6de9){var _0x20e405=_[_0x238d('0x37')](_0x5b6de9,function(_0x371c3a){return qs[_0x238d('0x5c')](_0x371c3a,['id',_0x238d('0x55'),_0x238d('0x56'),_0x238d('0x5d')]);});_0x121409(_0x20e405);})[_0x238d('0x4b')](function(_0x49c31d){_0x2e9141(_0x49c31d);});})[_0x238d('0x2b')](function(_0x497832){var _0x29723e=qs['omit'](_0x43f9a2,['id',_0x238d('0x55'),'updatedAt']);_0x29723e[_0x238d('0x5e')]=_0x284865['id'];if(_0x497832)_0x29723e[_0x238d('0x5f')]=_0x497832;return _0x29723e;})['then'](function(_0x44561d){return db[_0x238d('0x59')][_0x238d('0x51')](_0x44561d,{'include':[{'model':db[_0x238d('0x60')],'as':_0x238d('0x5f')}],'raw':!![],'transaction':_0xdfc4b8});});})[_0x238d('0x2b')](function(){return _0x284865;});}});});});}})[_0x238d('0x2b')](respondWithResult(_0x3dbb24,0xc9))[_0x238d('0x4b')](handleError(_0x3dbb24,null));};exports[_0x238d('0x2a')]=function(_0x3b7257,_0x1848cb){if(_0x3b7257[_0x238d('0x52')]['id']){delete _0x3b7257[_0x238d('0x52')]['id'];}return db[_0x238d('0x32')][_0x238d('0x50')]({'where':{'id':_0x3b7257[_0x238d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1848cb,null))[_0x238d('0x2b')](saveUpdates(_0x3b7257[_0x238d('0x52')],null))[_0x238d('0x2b')](respondWithResult(_0x1848cb,null))['catch'](handleError(_0x1848cb,null));};exports[_0x238d('0x2c')]=function(_0x46330f,_0x2d07c3){return db[_0x238d('0x32')]['find']({'where':{'id':_0x46330f['params']['id']}})[_0x238d('0x2b')](handleEntityNotFound(_0x2d07c3,null))['then'](removeEntity(_0x2d07c3,null))[_0x238d('0x4b')](handleError(_0x2d07c3,null));};exports[_0x238d('0x61')]=function(_0x9ec470,_0x4cced4){return db[_0x238d('0x32')][_0x238d('0x61')]()[_0x238d('0x2b')](respondWithResult(_0x4cced4,null))['catch'](handleError(_0x4cced4,null));};exports[_0x238d('0x62')]=function(_0x5e1393,_0x8c29d9){var _0x1368d5=_0x5e1393[_0x238d('0x52')];return db[_0x238d('0x32')][_0x238d('0x50')]({'where':{'id':_0x5e1393['params']['id']}})[_0x238d('0x2b')](handleEntityNotFound(_0x8c29d9,null))['then'](function(_0x10cebb){if(_0x10cebb){return db['sequelize']['transaction'](function(_0x2ecde6){return db[_0x238d('0x59')][_0x238d('0x2c')]({'where':{'userProfileId':_0x5e1393[_0x238d('0x4d')]['id'],'sectionId':_['map'](_0x1368d5,function(_0x3ae2aa){return _0x3ae2aa['sectionId'];})},'transaction':_0x2ecde6})['then'](function(){var _0x56c7c0=_[_0x238d('0x37')](_0x1368d5,function(_0x4fb5f7){_0x4fb5f7['userProfileId']=_0x5e1393['params']['id'];return _0x4fb5f7;});var _0x557089=[];return BPromise['each'](_0x56c7c0,function(_0x43dd5a){return db[_0x238d('0x59')]['create'](_0x43dd5a,{'include':[{'model':db['UserProfileResource'],'as':_0x238d('0x5f')}],'raw':!![],'transaction':_0x2ecde6})[_0x238d('0x2b')](function(_0xea9e27){_0x557089[_0x238d('0x63')](_0xea9e27[_0x238d('0x54')]({'plain':!![]}));});})['then'](function(){return _0x557089;});});});}})[_0x238d('0x2b')](function(_0x5e49cb){return _0x5e49cb;})[_0x238d('0x2b')](respondWithResult(_0x8c29d9,null))['catch'](handleError(_0x8c29d9,null));};exports[_0x238d('0x64')]=function(_0x3ddf11,_0xbd6240){var _0x2c9308;return db['UserProfile'][_0x238d('0x50')]({'where':{'id':_0x3ddf11[_0x238d('0x4d')]['id']},'attributes':['id','name']})[_0x238d('0x2b')](handleEntityNotFound(_0xbd6240,null))['then'](function(_0xaebd00){if(_0xaebd00){_0x2c9308=_0xaebd00;return db[_0x238d('0x59')]['destroy']({'where':{'userProfileId':_0x3ddf11[_0x238d('0x4d')]['id'],'sectionId':_0x3ddf11[_0x238d('0x38')][_0x238d('0x65')]}});}})[_0x238d('0x2b')](function(){return _0x2c9308;})['then'](respondWithStatusCode(_0xbd6240,null))['catch'](handleError(_0xbd6240,null));};exports[_0x238d('0x66')]=function(_0x370148,_0x43b866){var _0xd770b3=[];var _0x1a58eb=[];return db[_0x238d('0x59')][_0x238d('0x49')]({'where':{'userProfileId':_0x370148['params']['id']},'raw':!![]})[_0x238d('0x2b')](function(_0x312dea){_0xd770b3=_['filter'](_0x312dea,function(_0x58bce3){return _0x58bce3[_0x238d('0x67')]===0x1||_['includes']([0x3eb,0x709],_0x58bce3[_0x238d('0x5d')]);});if(!_[_0x238d('0x68')](_0xd770b3)){return _[_0x238d('0x37')](_0xd770b3,function(_0x47abc1){return _0x47abc1['sectionId'];});}else{return;}})[_0x238d('0x2b')](function(_0x34f1ba){if(_0x34f1ba)_0x1a58eb=_0x34f1ba;if(_['includes'](_0x1a58eb,0x64)){var _0x8ffbd8=_[_0x238d('0x50')](_0xd770b3,{'sectionId':0x64});return hasDefaultDashboard(_0x8ffbd8)[_0x238d('0x2b')](function(_0x175890){return _[_0x238d('0x37')](_0xd770b3,function(_0x35443f){if(_0x35443f[_0x238d('0x5d')]===0x64){_0x35443f['subsections']=_0x175890;}return _0x35443f;});});}else{return;}})[_0x238d('0x2b')](function(_0x6c3684){if(_0x6c3684)_0xd770b3=_0x6c3684;if(_[_0x238d('0x69')](_0x1a58eb,0x3eb)){var _0x45ef2d=_[_0x238d('0x50')](_0xd770b3,{'sectionId':0x3eb});return getCustomDashboards(_0x45ef2d)[_0x238d('0x2b')](function(_0x1ea228){return _[_0x238d('0x37')](_0xd770b3,function(_0x4a4cb1){if(_0x45ef2d[_0x238d('0x67')]){if(_0x4a4cb1['sectionId']===0x3eb){_0x4a4cb1[_0x238d('0x6a')]=_0x1ea228;}}else{if(_0x4a4cb1[_0x238d('0x5d')]===0x64){if(!_0x4a4cb1[_0x238d('0x6a')]){_0x4a4cb1[_0x238d('0x6a')]=[];}_0x4a4cb1[_0x238d('0x6a')]=_0x4a4cb1[_0x238d('0x6a')][_0x238d('0x6b')](_0x1ea228);}}return _0x4a4cb1;});});}else{return;}})[_0x238d('0x2b')](function(_0x2b645a){if(_0x2b645a)_0xd770b3=_0x2b645a;if(_[_0x238d('0x69')](_0x1a58eb,0x709)){var _0xe4785f=_['find'](_0xd770b3,{'sectionId':0x709});return getPlugins(_0xe4785f)['then'](function(_0x1164b1){if(_0xe4785f[_0x238d('0x67')]){return _[_0x238d('0x37')](_0xd770b3,function(_0x262f66){if(_0x262f66[_0x238d('0x5d')]===0x709){_0x262f66[_0x238d('0x6a')]=_0x1164b1;}return _0x262f66;});}else{var _0x40639c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1164b1};var _0x21048a=_[_0x238d('0x37')](_0xd770b3);_0x21048a[_0x238d('0x63')](_0x40639c);return _0x21048a;}});}else{return;}})[_0x238d('0x2b')](function(_0x509029){if(_0x509029)_0xd770b3=_0x509029;return _[_0x238d('0x46')](_0xd770b3,[_0x238d('0x67'),0x1]);})[_0x238d('0x2b')](respondWithResult(_0x43b866,null))[_0x238d('0x4b')](handleError(_0x43b866,null));};function hasDefaultDashboard(_0x5b135b){var _0x5c95d8=[0x65];return new BPromise(function(_0x47b785,_0x5bdc6c){try{if(_0x5b135b[_0x238d('0x5b')]){_0x47b785(_0x5c95d8);}else{return db[_0x238d('0x60')]['findOne']({'where':{'sectionId':_0x5b135b['id']},'raw':!![]})[_0x238d('0x2b')](function(_0x5984d7){_0x5984d7?_0x47b785(_0x5c95d8):_0x47b785();});}}catch(_0x511f5f){_0x5bdc6c(_0x511f5f);}});}function getCustomDashboards(_0x973a21){var _0x5c30b7=[];return new BPromise(function(_0x17ce40,_0x1e7797){try{if(_0x973a21[_0x238d('0x5b')]){return db['Dashboard'][_0x238d('0x49')]({'raw':!![]})[_0x238d('0x2b')](function(_0x31dc69){_0x31dc69[_0x238d('0x6c')](function(_0x4729bc){_0x5c30b7['push'](_0x4729bc['id']+0x1869f);});_0x17ce40(_0x5c30b7);});}else{return db[_0x238d('0x60')][_0x238d('0x49')]({'where':{'sectionId':_0x973a21['id']},'raw':!![]})[_0x238d('0x2b')](function(_0x310ae2){_0x310ae2['forEach'](function(_0x1008e4){_0x5c30b7[_0x238d('0x63')](_0x1008e4['resourceId']+0x1869f);});_0x17ce40(_0x5c30b7);});}}catch(_0xce9380){_0x1e7797(_0xce9380);}});}function getPlugins(_0x4609c1){var _0x16a594=[];return new BPromise(function(_0x727743,_0x42dcd7){try{if(_0x4609c1[_0x238d('0x5b')]){return db[_0x238d('0x6d')][_0x238d('0x49')]({'raw':!![]})['then'](function(_0x3cb4a6){_0x3cb4a6['forEach'](function(_0x51a8e9){_0x16a594[_0x238d('0x63')](_0x51a8e9['id']+0x15b38);});_0x727743(_0x16a594);});}else{return db[_0x238d('0x60')]['findAll']({'where':{'sectionId':_0x4609c1['id']},'raw':!![]})[_0x238d('0x2b')](function(_0x28e9ff){_0x28e9ff[_0x238d('0x6c')](function(_0x168c58){_0x16a594[_0x238d('0x63')](_0x168c58[_0x238d('0x6e')]+0x15b38);});_0x727743(_0x16a594);});}}catch(_0x4923cc){_0x42dcd7(_0x4923cc);}});}exports[_0x238d('0x6f')]=function(_0x307f64,_0x26a94f){return db[_0x238d('0x32')][_0x238d('0x50')]({'where':{'id':_0x307f64[_0x238d('0x4d')]['id']}})[_0x238d('0x2b')](handleEntityNotFound(_0x26a94f,null))['then'](function(_0x2c6d86){if(_0x2c6d86){return db[_0x238d('0x57')]['transaction'](function(_0x39bcaa){return db[_0x238d('0x59')][_0x238d('0x49')]({'where':{'userProfileId':_0x307f64['params']['id']},'attributes':['id'],'raw':!![]})[_0x238d('0x2b')](function(_0x4ded8b){if(_0x4ded8b){return db[_0x238d('0x59')]['destroy']({'where':{'userProfileId':_0x307f64[_0x238d('0x4d')]['id'],'id':_[_0x238d('0x37')](_0x4ded8b,function(_0x41794a){return _0x41794a['id'];})},'transaction':_0x39bcaa});}})[_0x238d('0x2b')](function(_0x1def13){var _0x519437=_[_0x238d('0x37')](_0x307f64[_0x238d('0x52')],function(_0x3fecfd){_0x3fecfd['userProfileId']=_0x307f64['params']['id'];return _0x3fecfd;});return db['UserProfileSection'][_0x238d('0x70')](_0x519437,{'raw':!![],'transaction':_0x39bcaa});})['then'](function(_0x203710){var _0x347044=_[_0x238d('0x46')](_['map'](_0x203710,function(_0x471859){return _0x471859[_0x238d('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x347044){return db[_0x238d('0x59')][_0x238d('0x49')]({'where':{'userProfileId':_0x307f64[_0x238d('0x4d')]['id'],'sectionId':_['map'](_0x347044,function(_0x554ffc){return _0x554ffc[_0x238d('0x5d')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x238d('0x2b')](function(_0x28ed81){var _0x227e78=_['map'](_0x307f64[_0x238d('0x52')],function(_0x1e16d6){_0x1e16d6[_0x238d('0x5e')]=_0x307f64['params']['id'];return _0x1e16d6;});return db[_0x238d('0x60')][_0x238d('0x70')](_0x227e78,{'raw':!![],'transaction':_0x39bcaa});});}})[_0x238d('0x4b')](handleError(_0x26a94f,null));});}})['then'](function(_0x4d29c9){var _0x2b3595=_['map'](_0x4d29c9,function(_0x2c4079){return _0x2c4079[_0x238d('0x54')]({'plain':!![]});});})[_0x238d('0x2b')](respondWithResult(_0x26a94f,null))[_0x238d('0x4b')](handleError(_0x26a94f,null));};exports['removeResources']=function(_0xcd1880,_0x5d3b0d,_0x3098e5){return db[_0x238d('0x32')][_0x238d('0x50')]({'where':{'id':_0xcd1880[_0x238d('0x4d')]['id']}})[_0x238d('0x2b')](handleEntityNotFound(_0x5d3b0d,null))[_0x238d('0x2b')](function(_0xe483a1){if(_0xe483a1){return _0xe483a1[_0x238d('0x71')](_0xcd1880[_0x238d('0x38')][_0x238d('0x65')]);}})['then'](respondWithStatusCode(_0x5d3b0d,null))[_0x238d('0x4b')](handleError(_0x5d3b0d,null));};exports[_0x238d('0x72')]=function(_0x1ee6ea,_0x4cb571){var _0x173790={};if(!_0x1ee6ea['query'][_0x238d('0x73')])throw new Error('Missing\x20section\x20parameter');if(!_0x1ee6ea['query'][_0x238d('0x3e')](_0x238d('0x3f'))){_0x173790[_0x238d('0x23')]=qs['limit'](_0x1ee6ea[_0x238d('0x38')]['limit']);_0x173790[_0x238d('0x21')]=qs['offset'](_0x1ee6ea[_0x238d('0x38')][_0x238d('0x21')]);}return db[_0x238d('0x32')][_0x238d('0x50')]({'where':{'id':_0x1ee6ea[_0x238d('0x4d')]['id']}})['then'](function(_0x1ab7b7){if(!_0x1ab7b7)throw new Error(_0x238d('0x74')+_0x1ee6ea[_0x238d('0x4d')]['id']);return db[_0x238d('0x32')][_0x238d('0x72')](_0x1ee6ea);})[_0x238d('0x2b')](respondWithFilteredResult(_0x4cb571,_0x173790))[_0x238d('0x4b')](handleError(_0x4cb571,null));}; \ No newline at end of file +var _0x36af=['includeAll','include','findAll','rows','catch','show','length','create','clone','find','get','omit','crudPermissions','body','createdAt','updatedAt','sequelize','transaction','params','each','autoAssociation','userProfileId','Resources','UserProfileResource','describe','UserProfileSection','sectionId','push','removeSections','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','section','Missing\x20section\x20parameter','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options'];(function(_0x3ba00e,_0xbd1c3d){var _0x33cb79=function(_0xdcb570){while(--_0xdcb570){_0x3ba00e['push'](_0x3ba00e['shift']());}};_0x33cb79(++_0xbd1c3d);}(_0x36af,0x1ed));var _0xf36a=function(_0x40181c,_0x18159a){_0x40181c=_0x40181c-0x0;var _0x2f28af=_0x36af[_0x40181c];return _0x2f28af;};'use strict';var emlformat=require(_0xf36a('0x0'));var rimraf=require(_0xf36a('0x1'));var zipdir=require(_0xf36a('0x2'));var jsonpatch=require(_0xf36a('0x3'));var rp=require(_0xf36a('0x4'));var moment=require(_0xf36a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf36a('0x6'));var util=require(_0xf36a('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf36a('0x8'));var _=require(_0xf36a('0x9'));var squel=require(_0xf36a('0xa'));var crypto=require(_0xf36a('0xb'));var jsforce=require(_0xf36a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf36a('0xd'));var querystring=require(_0xf36a('0xe'));var Papa=require(_0xf36a('0xf'));var Redis=require(_0xf36a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf36a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf36a('0x12'));var logger=require(_0xf36a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf36a('0x14'));var licenseUtil=require(_0xf36a('0x15'));var db=require(_0xf36a('0x16'))['db'];config[_0xf36a('0x17')]=_[_0xf36a('0x18')](config[_0xf36a('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf36a('0x19'))[_0xf36a('0x1a')](socket);function respondWithStatusCode(_0x205026,_0x31dc5f){_0x31dc5f=_0x31dc5f||0xcc;return function(_0xc38e3e){if(_0xc38e3e){return _0x205026[_0xf36a('0x1b')](_0x31dc5f);}return _0x205026['status'](_0x31dc5f)[_0xf36a('0x1c')]();};}function respondWithResult(_0x3d21dc,_0x154dcb){_0x154dcb=_0x154dcb||0xc8;return function(_0x59f26e){if(_0x59f26e){return _0x3d21dc[_0xf36a('0x1d')](_0x154dcb)[_0xf36a('0x1e')](_0x59f26e);}};}function respondWithFilteredResult(_0x1b4192,_0x24e19c){return function(_0x2d80ee){if(_0x2d80ee){var _0x338161=typeof _0x24e19c[_0xf36a('0x1f')]===_0xf36a('0x20')&&typeof _0x24e19c[_0xf36a('0x21')]===_0xf36a('0x20');var _0x3d60f9=_0x2d80ee[_0xf36a('0x22')];var _0x33ff1f=_0x338161?0x0:_0x24e19c[_0xf36a('0x1f')];var _0x2177cb=_0x338161?_0x2d80ee['count']:_0x24e19c['offset']+_0x24e19c['limit'];var _0x118724;if(_0x2177cb>=_0x3d60f9){_0x2177cb=_0x3d60f9;_0x118724=0xc8;}else{_0x118724=0xce;}_0x1b4192['status'](_0x118724);return _0x1b4192['set']('Content-Range',_0x33ff1f+'-'+_0x2177cb+'/'+_0x3d60f9)['json'](_0x2d80ee);}return null;};}function patchUpdates(_0x1a6069){return function(_0x55cfa0){try{jsonpatch[_0xf36a('0x23')](_0x55cfa0,_0x1a6069,!![]);}catch(_0x6a4829){return BPromise['reject'](_0x6a4829);}return _0x55cfa0[_0xf36a('0x24')]();};}function saveUpdates(_0x1c1895,_0x257df3){return function(_0x3e5310){if(_0x3e5310){return _0x3e5310[_0xf36a('0x25')](_0x1c1895)[_0xf36a('0x26')](function(_0x5aea0e){return _0x5aea0e;});}return null;};}function removeEntity(_0xa51601,_0x320f39){return function(_0x75aee2){if(_0x75aee2){return _0x75aee2[_0xf36a('0x27')]()[_0xf36a('0x26')](function(){_0xa51601['status'](0xcc)[_0xf36a('0x1c')]();});}};}function handleEntityNotFound(_0x2ba279,_0x57a81b){return function(_0x4c9ecf){if(!_0x4c9ecf){_0x2ba279[_0xf36a('0x1b')](0x194);}return _0x4c9ecf;};}function handleError(_0x3ad4db,_0x5498b7){_0x5498b7=_0x5498b7||0x1f4;return function(_0x3e25d3){logger[_0xf36a('0x28')](_0x3e25d3[_0xf36a('0x29')]);if(_0x3e25d3[_0xf36a('0x2a')]){delete _0x3e25d3[_0xf36a('0x2a')];}_0x3ad4db['status'](_0x5498b7)[_0xf36a('0x2b')](_0x3e25d3);};}exports[_0xf36a('0x2c')]=function(_0x48dee3,_0x1b21e3){var _0x2e5d6d={},_0x320ff8={},_0x5b8768={'count':0x0,'rows':[]};var _0x1889af=_[_0xf36a('0x2d')](db[_0xf36a('0x2e')][_0xf36a('0x2f')],function(_0x3e506e){return{'name':_0x3e506e['fieldName'],'type':_0x3e506e[_0xf36a('0x30')][_0xf36a('0x31')]};});_0x320ff8[_0xf36a('0x32')]=_[_0xf36a('0x2d')](_0x1889af,_0xf36a('0x2a'));_0x320ff8[_0xf36a('0x33')]=_[_0xf36a('0x34')](_0x48dee3[_0xf36a('0x33')]);_0x320ff8['filters']=_['intersection'](_0x320ff8['model'],_0x320ff8[_0xf36a('0x33')]);_0x2e5d6d[_0xf36a('0x35')]=_[_0xf36a('0x36')](_0x320ff8[_0xf36a('0x32')],qs[_0xf36a('0x37')](_0x48dee3[_0xf36a('0x33')][_0xf36a('0x37')]));_0x2e5d6d['attributes']=_0x2e5d6d[_0xf36a('0x35')]['length']?_0x2e5d6d[_0xf36a('0x35')]:_0x320ff8[_0xf36a('0x32')];if(!_0x48dee3['query'][_0xf36a('0x38')](_0xf36a('0x39'))){_0x2e5d6d[_0xf36a('0x21')]=qs[_0xf36a('0x21')](_0x48dee3[_0xf36a('0x33')][_0xf36a('0x21')]);_0x2e5d6d[_0xf36a('0x1f')]=qs[_0xf36a('0x1f')](_0x48dee3[_0xf36a('0x33')]['offset']);}_0x2e5d6d[_0xf36a('0x3a')]=qs[_0xf36a('0x3b')](_0x48dee3[_0xf36a('0x33')]['sort']);_0x2e5d6d[_0xf36a('0x3c')]=qs['filters'](_[_0xf36a('0x3d')](_0x48dee3[_0xf36a('0x33')],_0x320ff8[_0xf36a('0x3e')]),_0x1889af);if(_0x48dee3[_0xf36a('0x33')][_0xf36a('0x3f')]){_0x2e5d6d[_0xf36a('0x3c')]=_[_0xf36a('0x40')](_0x2e5d6d['where'],{'$or':_[_0xf36a('0x2d')](_0x1889af,function(_0x59b811){if(_0x59b811['type']!==_0xf36a('0x41')){var _0x54e90d={};_0x54e90d[_0x59b811['name']]={'$like':'%'+_0x48dee3['query']['filter']+'%'};return _0x54e90d;}})});}_0x2e5d6d=_[_0xf36a('0x40')]({},_0x2e5d6d,_0x48dee3[_0xf36a('0x42')]);var _0x57bca0={'where':_0x2e5d6d['where']};return db['UserProfile'][_0xf36a('0x22')](_0x57bca0)[_0xf36a('0x26')](function(_0x21a74c){_0x5b8768[_0xf36a('0x22')]=_0x21a74c;if(_0x48dee3['query'][_0xf36a('0x43')]){_0x2e5d6d[_0xf36a('0x44')]=[{'all':!![]}];}return db[_0xf36a('0x2e')][_0xf36a('0x45')](_0x2e5d6d);})['then'](function(_0x208c7a){_0x5b8768[_0xf36a('0x46')]=_0x208c7a;return _0x5b8768;})[_0xf36a('0x26')](respondWithFilteredResult(_0x1b21e3,_0x2e5d6d))[_0xf36a('0x47')](handleError(_0x1b21e3,null));};exports[_0xf36a('0x48')]=function(_0x46cc88,_0x213100){var _0x337eea={'raw':![],'where':{'id':_0x46cc88['params']['id']}},_0x15c9af={};_0x15c9af[_0xf36a('0x32')]=_[_0xf36a('0x34')](db['UserProfile'][_0xf36a('0x2f')]);_0x15c9af['query']=_[_0xf36a('0x34')](_0x46cc88[_0xf36a('0x33')]);_0x15c9af[_0xf36a('0x3e')]=_[_0xf36a('0x36')](_0x15c9af[_0xf36a('0x32')],_0x15c9af[_0xf36a('0x33')]);_0x337eea[_0xf36a('0x35')]=_['intersection'](_0x15c9af[_0xf36a('0x32')],qs[_0xf36a('0x37')](_0x46cc88[_0xf36a('0x33')]['fields']));_0x337eea['attributes']=_0x337eea[_0xf36a('0x35')][_0xf36a('0x49')]?_0x337eea[_0xf36a('0x35')]:_0x15c9af['model'];if(_0x46cc88[_0xf36a('0x33')][_0xf36a('0x43')]){_0x337eea[_0xf36a('0x44')]=[{'all':!![]}];}_0x337eea=_[_0xf36a('0x40')]({},_0x337eea,_0x46cc88[_0xf36a('0x42')]);return db['UserProfile']['find'](_0x337eea)[_0xf36a('0x26')](handleEntityNotFound(_0x213100,null))[_0xf36a('0x26')](respondWithResult(_0x213100,null))[_0xf36a('0x47')](handleError(_0x213100,null));};exports[_0xf36a('0x4a')]=function(_0x56e625,_0x297d38){return db[_0xf36a('0x2e')]['create'](_0x56e625['body'],{})['then'](respondWithResult(_0x297d38,0xc9))['catch'](handleError(_0x297d38,null));};exports[_0xf36a('0x4b')]=function(_0x19a0de,_0x4a5adc){var _0x4df076={'where':{'id':_0x19a0de['params']['id']}},_0x49de36={};_0x49de36[_0xf36a('0x32')]=_[_0xf36a('0x34')](db[_0xf36a('0x2e')][_0xf36a('0x2f')]);_0x4df076[_0xf36a('0x35')]=_[_0xf36a('0x36')](_0x49de36[_0xf36a('0x32')],qs[_0xf36a('0x37')](_0x19a0de['query']['fields']));_0x4df076['attributes']=_0x4df076[_0xf36a('0x35')]['length']?_0x4df076[_0xf36a('0x35')]:_0x49de36[_0xf36a('0x32')];if(_0x19a0de['query'][_0xf36a('0x43')]){_0x4df076[_0xf36a('0x44')]=[{'all':!![]}];}_0x4df076=_[_0xf36a('0x40')]({},_0x4df076,_0x19a0de[_0xf36a('0x42')]);return db[_0xf36a('0x2e')][_0xf36a('0x4c')](_0x4df076)['then'](handleEntityNotFound(_0x4a5adc,null))[_0xf36a('0x26')](function(_0x4efdbc){if(_0x4efdbc){var _0x5558b1=_0x4efdbc[_0xf36a('0x4d')]({'plain':!![]});_0x5558b1=qs[_0xf36a('0x4e')](_0x5558b1,['id','createdAt','updatedAt',_0xf36a('0x4f')]);_0x19a0de['body']=_[_0xf36a('0x4e')](_0x19a0de[_0xf36a('0x50')],['id',_0xf36a('0x51'),_0xf36a('0x52')]);return db[_0xf36a('0x53')][_0xf36a('0x54')](function(_0x15d59e){return db['UserProfile']['create'](_[_0xf36a('0x40')](_0x5558b1,_0x19a0de[_0xf36a('0x50')]),{'include':_0x19a0de[_0xf36a('0x33')][_0xf36a('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x15d59e})[_0xf36a('0x26')](function(_0x261e83){var _0x5365fd=_0x261e83[_0xf36a('0x4d')]({'plain':!![]});return db['UserProfileSection'][_0xf36a('0x45')]({'where':{'userProfileId':_0x19a0de[_0xf36a('0x55')]['id']},'raw':!![]})[_0xf36a('0x26')](function(_0x20ff5c){if(_0x20ff5c){return BPromise[_0xf36a('0x56')](_0x20ff5c,function(_0x42e9e7){return new BPromise(function(_0x33483f,_0x58c62c){if(_0x42e9e7[_0xf36a('0x57')]===null||_0x42e9e7[_0xf36a('0x57')]===0x1)_0x33483f(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x42e9e7['id']},'raw':!![]})['then'](function(_0x42eddf){var _0x431bb3=_[_0xf36a('0x2d')](_0x42eddf,function(_0x32063b){return qs[_0xf36a('0x4e')](_0x32063b,['id','createdAt',_0xf36a('0x52'),'sectionId']);});_0x33483f(_0x431bb3);})[_0xf36a('0x47')](function(_0x466e24){_0x58c62c(_0x466e24);});})[_0xf36a('0x26')](function(_0x6b13f5){var _0x329734=qs[_0xf36a('0x4e')](_0x42e9e7,['id','createdAt',_0xf36a('0x52')]);_0x329734[_0xf36a('0x58')]=_0x5365fd['id'];if(_0x6b13f5)_0x329734[_0xf36a('0x59')]=_0x6b13f5;return _0x329734;})[_0xf36a('0x26')](function(_0x3ea0a4){return db['UserProfileSection']['create'](_0x3ea0a4,{'include':[{'model':db[_0xf36a('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x15d59e});});})[_0xf36a('0x26')](function(){return _0x5365fd;});}});});});}})[_0xf36a('0x26')](respondWithResult(_0x4a5adc,0xc9))[_0xf36a('0x47')](handleError(_0x4a5adc,null));};exports[_0xf36a('0x25')]=function(_0x39cc64,_0x3f5360){if(_0x39cc64['body']['id']){delete _0x39cc64[_0xf36a('0x50')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x39cc64[_0xf36a('0x55')]['id']}})[_0xf36a('0x26')](handleEntityNotFound(_0x3f5360,null))[_0xf36a('0x26')](saveUpdates(_0x39cc64[_0xf36a('0x50')],null))['then'](respondWithResult(_0x3f5360,null))[_0xf36a('0x47')](handleError(_0x3f5360,null));};exports[_0xf36a('0x27')]=function(_0x1368a7,_0x5172f6){return db[_0xf36a('0x2e')]['find']({'where':{'id':_0x1368a7[_0xf36a('0x55')]['id']}})['then'](handleEntityNotFound(_0x5172f6,null))[_0xf36a('0x26')](removeEntity(_0x5172f6,null))[_0xf36a('0x47')](handleError(_0x5172f6,null));};exports[_0xf36a('0x5b')]=function(_0x979d87,_0x1fbafd){return db[_0xf36a('0x2e')][_0xf36a('0x5b')]()[_0xf36a('0x26')](respondWithResult(_0x1fbafd,null))[_0xf36a('0x47')](handleError(_0x1fbafd,null));};exports['addSections']=function(_0x67acf3,_0xd61de0){var _0xeb252c=_0x67acf3[_0xf36a('0x50')];return db[_0xf36a('0x2e')][_0xf36a('0x4c')]({'where':{'id':_0x67acf3['params']['id']}})[_0xf36a('0x26')](handleEntityNotFound(_0xd61de0,null))[_0xf36a('0x26')](function(_0x36c56e){if(_0x36c56e){return db['sequelize'][_0xf36a('0x54')](function(_0x563b34){return db[_0xf36a('0x5c')][_0xf36a('0x27')]({'where':{'userProfileId':_0x67acf3[_0xf36a('0x55')]['id'],'sectionId':_[_0xf36a('0x2d')](_0xeb252c,function(_0x1cf39b){return _0x1cf39b[_0xf36a('0x5d')];})},'transaction':_0x563b34})[_0xf36a('0x26')](function(){var _0x14eca8=_[_0xf36a('0x2d')](_0xeb252c,function(_0x1967e7){_0x1967e7[_0xf36a('0x58')]=_0x67acf3[_0xf36a('0x55')]['id'];return _0x1967e7;});var _0x58bc3c=[];return BPromise[_0xf36a('0x56')](_0x14eca8,function(_0x56dce8){return db[_0xf36a('0x5c')]['create'](_0x56dce8,{'include':[{'model':db[_0xf36a('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x563b34})[_0xf36a('0x26')](function(_0x4a1726){_0x58bc3c[_0xf36a('0x5e')](_0x4a1726[_0xf36a('0x4d')]({'plain':!![]}));});})[_0xf36a('0x26')](function(){return _0x58bc3c;});});});}})['then'](function(_0x4aca80){return _0x4aca80;})[_0xf36a('0x26')](respondWithResult(_0xd61de0,null))[_0xf36a('0x47')](handleError(_0xd61de0,null));};exports[_0xf36a('0x5f')]=function(_0x1e4658,_0x2f5898){var _0x3b51b8;return db['UserProfile']['find']({'where':{'id':_0x1e4658[_0xf36a('0x55')]['id']},'attributes':['id',_0xf36a('0x2a')]})[_0xf36a('0x26')](handleEntityNotFound(_0x2f5898,null))[_0xf36a('0x26')](function(_0x18f46c){if(_0x18f46c){_0x3b51b8=_0x18f46c;return db[_0xf36a('0x5c')][_0xf36a('0x27')]({'where':{'userProfileId':_0x1e4658[_0xf36a('0x55')]['id'],'sectionId':_0x1e4658[_0xf36a('0x33')][_0xf36a('0x60')]}});}})[_0xf36a('0x26')](function(){return _0x3b51b8;})['then'](respondWithStatusCode(_0x2f5898,null))[_0xf36a('0x47')](handleError(_0x2f5898,null));};exports[_0xf36a('0x61')]=function(_0x1ed8d5,_0xb80131){var _0x1ec388=[];var _0x2ce32d=[];return db['UserProfileSection'][_0xf36a('0x45')]({'where':{'userProfileId':_0x1ed8d5[_0xf36a('0x55')]['id']},'raw':!![]})[_0xf36a('0x26')](function(_0x1263ce){_0x1ec388=_['filter'](_0x1263ce,function(_0x5b7f7b){return _0x5b7f7b[_0xf36a('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x5b7f7b[_0xf36a('0x5d')]);});if(!_['isEmpty'](_0x1ec388)){return _[_0xf36a('0x2d')](_0x1ec388,function(_0x40c2b5){return _0x40c2b5[_0xf36a('0x5d')];});}else{return;}})[_0xf36a('0x26')](function(_0x17bdec){if(_0x17bdec)_0x2ce32d=_0x17bdec;if(_[_0xf36a('0x63')](_0x2ce32d,0x64)){var _0x2fc0f2=_[_0xf36a('0x4c')](_0x1ec388,{'sectionId':0x64});return hasDefaultDashboard(_0x2fc0f2)[_0xf36a('0x26')](function(_0x3537e1){return _[_0xf36a('0x2d')](_0x1ec388,function(_0x1dc436){if(_0x1dc436[_0xf36a('0x5d')]===0x64){_0x1dc436['subsections']=_0x3537e1;}return _0x1dc436;});});}else{return;}})[_0xf36a('0x26')](function(_0x55edda){if(_0x55edda)_0x1ec388=_0x55edda;if(_[_0xf36a('0x63')](_0x2ce32d,0x3eb)){var _0x3e1781=_[_0xf36a('0x4c')](_0x1ec388,{'sectionId':0x3eb});return getCustomDashboards(_0x3e1781)[_0xf36a('0x26')](function(_0x4630a6){return _[_0xf36a('0x2d')](_0x1ec388,function(_0x168686){if(_0x3e1781[_0xf36a('0x62')]){if(_0x168686['sectionId']===0x3eb){_0x168686['subsections']=_0x4630a6;}}else{if(_0x168686[_0xf36a('0x5d')]===0x64){if(!_0x168686[_0xf36a('0x64')]){_0x168686['subsections']=[];}_0x168686['subsections']=_0x168686[_0xf36a('0x64')][_0xf36a('0x65')](_0x4630a6);}}return _0x168686;});});}else{return;}})[_0xf36a('0x26')](function(_0x42d1a9){if(_0x42d1a9)_0x1ec388=_0x42d1a9;if(_[_0xf36a('0x63')](_0x2ce32d,0x709)){var _0x24c0c0=_[_0xf36a('0x4c')](_0x1ec388,{'sectionId':0x709});return getPlugins(_0x24c0c0)[_0xf36a('0x26')](function(_0x1a37aa){if(_0x24c0c0['enabled']){return _[_0xf36a('0x2d')](_0x1ec388,function(_0x30a117){if(_0x30a117[_0xf36a('0x5d')]===0x709){_0x30a117[_0xf36a('0x64')]=_0x1a37aa;}return _0x30a117;});}else{var _0x47d54c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1a37aa};var _0x379c46=_[_0xf36a('0x2d')](_0x1ec388);_0x379c46[_0xf36a('0x5e')](_0x47d54c);return _0x379c46;}});}else{return;}})[_0xf36a('0x26')](function(_0x28ebba){if(_0x28ebba)_0x1ec388=_0x28ebba;return _[_0xf36a('0x3f')](_0x1ec388,[_0xf36a('0x62'),0x1]);})[_0xf36a('0x26')](respondWithResult(_0xb80131,null))[_0xf36a('0x47')](handleError(_0xb80131,null));};function hasDefaultDashboard(_0x52ccfb){var _0x2891b1=[0x65];return new BPromise(function(_0x4706b9,_0x3c74e2){try{if(_0x52ccfb['autoAssociation']){_0x4706b9(_0x2891b1);}else{return db['UserProfileResource'][_0xf36a('0x66')]({'where':{'sectionId':_0x52ccfb['id']},'raw':!![]})[_0xf36a('0x26')](function(_0x49756e){_0x49756e?_0x4706b9(_0x2891b1):_0x4706b9();});}}catch(_0x1a7ba9){_0x3c74e2(_0x1a7ba9);}});}function getCustomDashboards(_0x5d1bf7){var _0x4b34a9=[];return new BPromise(function(_0x577237,_0x3875cc){try{if(_0x5d1bf7[_0xf36a('0x57')]){return db[_0xf36a('0x67')][_0xf36a('0x45')]({'raw':!![]})[_0xf36a('0x26')](function(_0x46e5df){_0x46e5df[_0xf36a('0x68')](function(_0x2fef78){_0x4b34a9['push'](_0x2fef78['id']+0x1869f);});_0x577237(_0x4b34a9);});}else{return db[_0xf36a('0x5a')][_0xf36a('0x45')]({'where':{'sectionId':_0x5d1bf7['id']},'raw':!![]})['then'](function(_0x17607f){_0x17607f[_0xf36a('0x68')](function(_0x55346d){_0x4b34a9[_0xf36a('0x5e')](_0x55346d[_0xf36a('0x69')]+0x1869f);});_0x577237(_0x4b34a9);});}}catch(_0x254830){_0x3875cc(_0x254830);}});}function getPlugins(_0x20def3){var _0x58b60c=[];return new BPromise(function(_0xe2070c,_0x4c40ce){try{if(_0x20def3[_0xf36a('0x57')]){return db[_0xf36a('0x6a')][_0xf36a('0x45')]({'raw':!![]})[_0xf36a('0x26')](function(_0x53ac7e){_0x53ac7e[_0xf36a('0x68')](function(_0x406e25){_0x58b60c['push'](_0x406e25['id']+0x15b38);});_0xe2070c(_0x58b60c);});}else{return db[_0xf36a('0x5a')][_0xf36a('0x45')]({'where':{'sectionId':_0x20def3['id']},'raw':!![]})[_0xf36a('0x26')](function(_0x2a329a){_0x2a329a[_0xf36a('0x68')](function(_0x3b496d){_0x58b60c['push'](_0x3b496d['resourceId']+0x15b38);});_0xe2070c(_0x58b60c);});}}catch(_0x12aa8b){_0x4c40ce(_0x12aa8b);}});}exports['addResources']=function(_0x4602f2,_0x3a8624){return db[_0xf36a('0x2e')][_0xf36a('0x4c')]({'where':{'id':_0x4602f2[_0xf36a('0x55')]['id']}})[_0xf36a('0x26')](handleEntityNotFound(_0x3a8624,null))[_0xf36a('0x26')](function(_0x4dc692){if(_0x4dc692){return db[_0xf36a('0x53')][_0xf36a('0x54')](function(_0x21ad94){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4602f2[_0xf36a('0x55')]['id']},'attributes':['id'],'raw':!![]})[_0xf36a('0x26')](function(_0x1e9888){if(_0x1e9888){return db['UserProfileSection'][_0xf36a('0x27')]({'where':{'userProfileId':_0x4602f2[_0xf36a('0x55')]['id'],'id':_[_0xf36a('0x2d')](_0x1e9888,function(_0x23aac9){return _0x23aac9['id'];})},'transaction':_0x21ad94});}})[_0xf36a('0x26')](function(_0xede692){var _0x41f1ea=_[_0xf36a('0x2d')](_0x4602f2[_0xf36a('0x50')],function(_0x32dec4){_0x32dec4[_0xf36a('0x58')]=_0x4602f2['params']['id'];return _0x32dec4;});return db[_0xf36a('0x5c')][_0xf36a('0x6b')](_0x41f1ea,{'raw':!![],'transaction':_0x21ad94});})[_0xf36a('0x26')](function(_0x7c29e){var _0x43638f=_[_0xf36a('0x3f')](_[_0xf36a('0x2d')](_0x7c29e,function(_0x191a9c){return _0x191a9c[_0xf36a('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x43638f){return db['UserProfileSection'][_0xf36a('0x45')]({'where':{'userProfileId':_0x4602f2[_0xf36a('0x55')]['id'],'sectionId':_['map'](_0x43638f,function(_0x13905c){return _0x13905c['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xf36a('0x26')](function(_0x4d627c){var _0x20470c=_[_0xf36a('0x2d')](_0x4602f2[_0xf36a('0x50')],function(_0x42f83d){_0x42f83d[_0xf36a('0x58')]=_0x4602f2[_0xf36a('0x55')]['id'];return _0x42f83d;});return db['UserProfileResource'][_0xf36a('0x6b')](_0x20470c,{'raw':!![],'transaction':_0x21ad94});});}})['catch'](handleError(_0x3a8624,null));});}})['then'](function(_0x23656d){var _0x5d5a2a=_[_0xf36a('0x2d')](_0x23656d,function(_0x2035c5){return _0x2035c5[_0xf36a('0x4d')]({'plain':!![]});});})[_0xf36a('0x26')](respondWithResult(_0x3a8624,null))[_0xf36a('0x47')](handleError(_0x3a8624,null));};exports['removeResources']=function(_0x42b63e,_0x2229da,_0x35beaf){return db['UserProfile']['find']({'where':{'id':_0x42b63e[_0xf36a('0x55')]['id']}})[_0xf36a('0x26')](handleEntityNotFound(_0x2229da,null))['then'](function(_0x4f5d93){if(_0x4f5d93){return _0x4f5d93[_0xf36a('0x6c')](_0x42b63e[_0xf36a('0x33')][_0xf36a('0x60')]);}})[_0xf36a('0x26')](respondWithStatusCode(_0x2229da,null))['catch'](handleError(_0x2229da,null));};exports['getResources']=function(_0x2614c,_0x1f44f2){var _0x325429={};if(!_0x2614c['query'][_0xf36a('0x6d')])throw new Error(_0xf36a('0x6e'));if(!_0x2614c[_0xf36a('0x33')]['hasOwnProperty']('nolimit')){_0x325429['limit']=qs[_0xf36a('0x21')](_0x2614c['query'][_0xf36a('0x21')]);_0x325429[_0xf36a('0x1f')]=qs[_0xf36a('0x1f')](_0x2614c[_0xf36a('0x33')][_0xf36a('0x1f')]);}return db[_0xf36a('0x2e')][_0xf36a('0x4c')]({'where':{'id':_0x2614c[_0xf36a('0x55')]['id']}})[_0xf36a('0x26')](function(_0x10a648){if(!_0x10a648)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x2614c[_0xf36a('0x55')]['id']);return db[_0xf36a('0x2e')][_0xf36a('0x6f')](_0x2614c);})[_0xf36a('0x26')](respondWithFilteredResult(_0x1f44f2,_0x325429))['catch'](handleError(_0x1f44f2,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 28791ea..2baf006 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 _0x002d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','update','remove'];(function(_0xeb0d44,_0x3ad8a2){var _0x1ef4db=function(_0x4e5946){while(--_0x4e5946){_0xeb0d44['push'](_0xeb0d44['shift']());}};_0x1ef4db(++_0x3ad8a2);}(_0x002d,0xca));var _0xd002=function(_0x182108,_0x315890){_0x182108=_0x182108-0x0;var _0x48612f=_0x002d[_0x182108];return _0x48612f;};'use strict';var EventEmitter=require(_0xd002('0x0'));var UserProfile=require(_0xd002('0x1'))['db'][_0xd002('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd002('0x3'),'afterDestroy':_0xd002('0x4')};function emitEvent(_0x1c0d0a){return function(_0x24ff42,_0x1323f0,_0x179915){UserProfileEvents[_0xd002('0x5')](_0x1c0d0a+':'+_0x24ff42['id'],_0x24ff42);UserProfileEvents[_0xd002('0x5')](_0x1c0d0a,_0x24ff42);_0x179915(null);};}for(var e in events){if(events[_0xd002('0x6')](e)){var event=events[e];UserProfile[_0xd002('0x7')](e,emitEvent(event));}}module[_0xd002('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x5b47=['events','../../mysqldb','emit','exports'];(function(_0x40fa00,_0x1fbb3f){var _0x2f2426=function(_0x18e6ee){while(--_0x18e6ee){_0x40fa00['push'](_0x40fa00['shift']());}};_0x2f2426(++_0x1fbb3f);}(_0x5b47,0x120));var _0x75b4=function(_0xf2c323,_0x577889){_0xf2c323=_0xf2c323-0x0;var _0x4f82c4=_0x5b47[_0xf2c323];return _0x4f82c4;};'use strict';var EventEmitter=require(_0x75b4('0x0'));var UserProfile=require(_0x75b4('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17831a){return function(_0x42359f,_0x37497c,_0x1fa445){UserProfileEvents[_0x75b4('0x2')](_0x17831a+':'+_0x42359f['id'],_0x42359f);UserProfileEvents['emit'](_0x17831a,_0x42359f);_0x1fa445(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x75b4('0x3')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index ef0b55c..44741d7 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 _0x2eea=['Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','parentSections','agents','Users','admin','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','Dashboard','intervals','Interval','scheduler','Sound','tags','Tag','templates','Template','triggers','Trunk','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','define','section','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','params','all','ignore','union','push','autoAssociation','model','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','options','includeAll','include','forEach','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','color','ThroughTags','tag','openTabs','true','sms','fax','dataValues','mail','openchannel','./userProfile.attributes','squel','models','filter','value','findAll','then','map','catch','field','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','projectName','projects','JscriptyProject','contacts','lists','CmList','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','inboundroutes','outboundroutes','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns'];(function(_0x1c1a3b,_0x1c9f1){var _0x21da40=function(_0x8f1783){while(--_0x8f1783){_0x1c1a3b['push'](_0x1c1a3b['shift']());}};_0x21da40(++_0x1c9f1);}(_0x2eea,0x135));var _0xa2ee=function(_0x3e0d95,_0x3609ed){_0x3e0d95=_0x3e0d95-0x0;var _0x367b62=_0x2eea[_0x3e0d95];return _0x367b62;};'use strict';var _=require('lodash');var attributes=require(_0xa2ee('0x0'));var squel=require(_0xa2ee('0x1'));module['exports']=function(_0x293f78){var _0x127bb5=_0x293f78[_0xa2ee('0x2')];function _0xb3a101(_0x48729f,_0x10fb56){return new Promise(function(_0x59f461,_0x453720){if(!_0x10fb56)return _0x59f461(null);var _0x14eb76=_0x10fb56[_0xa2ee('0x3')]?{[_0x10fb56[_0xa2ee('0x3')]['field']]:_0x10fb56[_0xa2ee('0x3')][_0xa2ee('0x4')]}:undefined;return _0x127bb5[_0x48729f][_0xa2ee('0x5')]({'where':_0x14eb76,'raw':!![]})[_0xa2ee('0x6')](function(_0x21d054){_0x10fb56['associatedResources']=_[_0xa2ee('0x7')](_0x21d054,'id');_0x59f461(_0x10fb56);})[_0xa2ee('0x8')](function(_0x53cd45){_0x453720(_0x53cd45);});});}function _0x21e854(_0x37b651,_0x47b1c0){return new Promise(function(_0x2e3aff,_0x6eb3e5){var _0x3a7400=_0x37b651['filter']?{[_0x37b651['filter'][_0xa2ee('0x9')]]:_0x37b651[_0xa2ee('0x3')]['value']}:undefined;return _0x127bb5[_0x37b651['model']][_0xa2ee('0x5')]({'where':_0x3a7400,'raw':!![]})[_0xa2ee('0x6')](function(_0x54278d){_0x47b1c0[_0xa2ee('0xa')]=_[_0xa2ee('0x7')](_0x54278d,function(_0x1796a3){return _0x1796a3[_0xa2ee('0xb')];});_0x2e3aff(_0x47b1c0);})[_0xa2ee('0x8')](function(_0x2f4150){_0x6eb3e5(_0x2f4150);});});}function _0xec17d0(_0x237ce4,_0x34e8e6,_0x3b8c2c){if(!_0x34e8e6)return Promise[_0xa2ee('0xc')](null);return new Promise(function(_0x223167,_0xe780e0){return _0x127bb5[_0xa2ee('0xd')][_0xa2ee('0x5')]({'where':{'sectionId':_0x34e8e6['id']},'raw':!![]})[_0xa2ee('0x6')](function(_0x2a0632){if(_0x237ce4['field']&&_0x237ce4[_0xa2ee('0x9')]!=='id'){_0x34e8e6[_0xa2ee('0xa')]=_[_0xa2ee('0x7')](_0x2a0632,function(_0x3d6471){return _0x3d6471[_0x237ce4[_0xa2ee('0x9')]];});}else{if(_0x3b8c2c===_0xa2ee('0xe')){_0x34e8e6[_0xa2ee('0xa')]=_[_0xa2ee('0x7')](_0x2a0632,function(_0x3518b1){return{'id':_0x3518b1[_0xa2ee('0xf')],'type':_0x3518b1[_0xa2ee('0x10')]};});}else{_0x34e8e6[_0xa2ee('0xa')]=_[_0xa2ee('0x7')](_0x2a0632,function(_0x4f42be){return _0x4f42be['resourceId'];});}}_0x223167(_0x34e8e6);})[_0xa2ee('0x8')](function(_0x8ccffc){_0xe780e0(_0x8ccffc);});});}function _0x3c6bd5(_0x1fb101,_0x4de6ae){var _0xdc417a={'parentSections':[]};switch(_0x1fb101[_0xa2ee('0x11')]()){case _0xa2ee('0x12'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x14');break;case _0xa2ee('0x15'):_0xdc417a['childModel']=_0xa2ee('0x16');break;case'squarerecordings':_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x17');_0xdc417a['parentSections']=[{'name':'SquareProjects','field':'name','foreignKey':_0xa2ee('0x18')}];break;case _0xa2ee('0x19'):_0xdc417a['childModel']=_0xa2ee('0x1a');break;case _0xa2ee('0x1b'):_0xdc417a[_0xa2ee('0x13')]='CmContact';_0xdc417a['parentSections']=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0xa2ee('0x1c'):_0xdc417a['childModel']=_0xa2ee('0x1d');break;case'companies':_0xdc417a[_0xa2ee('0x13')]='CmCompany';break;case'globalcustomfields':_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x1e');break;case _0xa2ee('0x1f'):_0xdc417a['childModel']=_0xa2ee('0x20');break;case _0xa2ee('0x21'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x22');break;case _0xa2ee('0x23'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x24');break;case'faxaccounts':_0xdc417a[_0xa2ee('0x13')]='FaxAccount';break;case _0xa2ee('0x25'):case'internalroutes':case _0xa2ee('0x26'):_0xdc417a['childModel']='VoiceExtension';break;case _0xa2ee('0x27'):_0xdc417a['childModel']='VoiceContext';break;case _0xa2ee('0x28'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x29');break;case _0xa2ee('0x2a'):_0xdc417a['childModel']=_0xa2ee('0x2b');_0xdc417a['parentSections']=[{'name':'Agents','field':_0xa2ee('0xb'),'foreignKey':'membername','model':_0xa2ee('0x2c'),'filter':{'field':_0xa2ee('0x2d'),'value':[_0xa2ee('0x2e')]}},{'name':_0xa2ee('0x2f'),'field':_0xa2ee('0xb'),'foreignKey':_0xa2ee('0x30'),'model':_0xa2ee('0x2c'),'filter':{'field':_0xa2ee('0x2d'),'value':[_0xa2ee('0x31')]}},{'name':_0xa2ee('0x32'),'field':_0xa2ee('0xb'),'foreignKey':_0xa2ee('0x33'),'model':_0xa2ee('0x34'),'filter':{'field':'type','value':[_0xa2ee('0x35')]}},{'name':_0xa2ee('0x36'),'field':'name','foreignKey':'queue','model':_0xa2ee('0x34'),'filter':{'field':_0xa2ee('0x10'),'value':[_0xa2ee('0x37')]}}];break;case _0xa2ee('0x38'):_0xdc417a[_0xa2ee('0x13')]='VoiceMusicOnHold';break;case _0xa2ee('0x39'):_0xdc417a['childModel']=_0xa2ee('0x3a');break;case'voiceprefixes':_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x3b');break;case _0xa2ee('0x3c'):_0xdc417a['childModel']=_0xa2ee('0x3d');break;case _0xa2ee('0x3e'):_0xdc417a['childModel']=_0xa2ee('0x3f');break;case _0xa2ee('0x40'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x41');break;case _0xa2ee('0x42'):_0xdc417a[_0xa2ee('0x13')]='MailSubstatus';break;case _0xa2ee('0x43'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x44');break;case _0xa2ee('0x45'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x46');break;case'smsqueues':_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x47');break;case _0xa2ee('0x48'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x49');break;case _0xa2ee('0x4a'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x4b');break;case _0xa2ee('0x4c'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x4d');break;case _0xa2ee('0x4e'):_0xdc417a['childModel']=_0xa2ee('0x4f');break;case'voicequeues':case'queuecampaigns':_0xdc417a['childModel']=_0xa2ee('0x34');if(_0x4de6ae){_0xdc417a[_0xa2ee('0x50')]=[{'name':_0xa2ee('0x32')},{'name':'QueueCampaigns'}];}break;case'users':case _0xa2ee('0x51'):case'telephones':_0xdc417a['childModel']=_0xa2ee('0x2c');if(_0x4de6ae){_0xdc417a[_0xa2ee('0x50')]=[{'name':_0xa2ee('0x52'),'filter':{'field':_0xa2ee('0x2d'),'value':[_0xa2ee('0x53'),'user']},'ignore':!![]},{'name':_0xa2ee('0x54')},{'name':_0xa2ee('0x2f')}];}break;case _0xa2ee('0x55'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x56');break;case _0xa2ee('0x57'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x58');break;case _0xa2ee('0x59'):_0xdc417a[_0xa2ee('0x13')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x5a');break;case _0xa2ee('0x5b'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x5c');break;case _0xa2ee('0x5d'):_0xdc417a[_0xa2ee('0x13')]='ZohoAccount';break;case _0xa2ee('0x5e'):_0xdc417a['childModel']='User';break;case _0xa2ee('0x5f'):_0xdc417a['childModel']='CannedAnswer';break;case'dispositions':_0xdc417a['childModel']='Disposition';break;case'customdashboards':_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x60');break;case _0xa2ee('0x61'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x62');break;case'pauses':_0xdc417a[_0xa2ee('0x13')]='Pause';break;case _0xa2ee('0x63'):_0xdc417a['childModel']='Schedule';break;case'sounds':_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x64');break;case _0xa2ee('0x65'):_0xdc417a['childModel']=_0xa2ee('0x66');break;case _0xa2ee('0x67'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x68');break;case _0xa2ee('0x69'):_0xdc417a[_0xa2ee('0x13')]='Trigger';break;case'trunks':_0xdc417a['childModel']=_0xa2ee('0x6a');break;case'variables':_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x6b');break;case _0xa2ee('0x6c'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x6d');break;case _0xa2ee('0x6e'):_0xdc417a['childModel']=_0xa2ee('0xe');_0xdc417a['parentSections']=[{'name':_0xa2ee('0x6f'),'field':'id','foreignKey':_0xa2ee('0x70')}];break;case _0xa2ee('0x71'):_0xdc417a[_0xa2ee('0x13')]=_0xa2ee('0x72');break;}return _0xdc417a;}function _0x258887(_0x31c3b0,_0x1fc363){var _0x2123b4=_0x31c3b0[_0xa2ee('0x73')](0x0)[_0xa2ee('0x74')]()+_0x31c3b0[_0xa2ee('0x75')](0x1);var _0x3cd22c={'type':_0x127bb5[_0xa2ee('0x76')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x55fb45,_0x429858){var _0x169170=squel[_0xa2ee('0x77')]()['field'](_0xa2ee('0x78')+_0x2123b4+_0xa2ee('0x79'),'id')[_0xa2ee('0x9')](_0xa2ee('0x7a'))[_0xa2ee('0x7b')](_0xa2ee('0x7c')+_0x31c3b0+_0xa2ee('0x7d'),'ui')[_0xa2ee('0x7e')]('ui.UserId\x20=\x20?',_0x1fc363['id']);return _0x127bb5[_0xa2ee('0x7f')][_0xa2ee('0x80')](_0x169170[_0xa2ee('0x81')](),_0x3cd22c)['then'](function(_0x415b44){_0x1fc363[_0x2123b4+_0xa2ee('0x82')]=_0x415b44;_0x55fb45(_0x415b44);})['catch'](function(_0x5651bd){_0x429858(_0x5651bd);});});}return _0x293f78[_0xa2ee('0x83')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x32462d){var _0x341615=require('../../components/parsers/qs');var _0x535c38={'raw':_0x32462d[_0xa2ee('0x80')]['raw'],'where':{}};var _0x48ad22={};var _0x2c4e02={'count':0x0,'rows':[]};var _0x274b1b=_0x32462d[_0xa2ee('0x80')][_0xa2ee('0x84')];var _0x1f66bd=_0x32462d[_0xa2ee('0x80')]['mergeResources']||![];var _0x323ab7=_0x3c6bd5(_0x274b1b,_0x1f66bd);if(!_0x323ab7['childModel'])throw new Error(_0xa2ee('0x85')+_0x274b1b+'\x27');var _0xccb236=[{'name':_0x274b1b}];if(!_[_0xa2ee('0x86')](_0x323ab7['parentSections']))_0xccb236=_0x323ab7[_0xa2ee('0x50')];var _0xb7a7c6=[];for(var _0xbf58cc=0x0;_0xbf58cc<_0xccb236[_0xa2ee('0x87')];_0xbf58cc++){_0xb7a7c6['push'](_0x127bb5[_0xa2ee('0x88')][_0xa2ee('0x89')]({'where':{'userProfileId':_0x32462d[_0xa2ee('0x8a')]['id'],'name':_0xccb236[_0xbf58cc][_0xa2ee('0xb')]},'raw':!![]}));}return Promise[_0xa2ee('0x8b')](_0xb7a7c6)[_0xa2ee('0x6')](function(_0x3c8d20){var _0x5a6892=_[_0xa2ee('0x3')](_0x3c8d20,function(_0x269627){return _0x269627?_0x269627:undefined;});var _0x144696=_[_0xa2ee('0x3')](_0xccb236,[_0xa2ee('0x8c'),!![]]);var _0x402ca4=_['isEmpty'](_0x5a6892)&&_[_0xa2ee('0x86')](_0x144696)?null:_[_0xa2ee('0x8d')](_0x144696,_0x5a6892);if(!_0x402ca4)return null;var _0xcc2550=[];for(var _0x3373c0=0x0;_0x3373c0<_0x402ca4[_0xa2ee('0x87')];_0x3373c0++){var _0x4d9409=_[_0xa2ee('0x89')](_0xccb236,function(_0x58b796){return _0x402ca4[_0x3373c0]?_0x58b796[_0xa2ee('0xb')]===_0x402ca4[_0x3373c0][_0xa2ee('0xb')]:null;});if(_0x4d9409){if(_0x402ca4[_0x3373c0][_0xa2ee('0x8c')]){_0xcc2550[_0xa2ee('0x8e')](_0xb3a101(_0x323ab7[_0xa2ee('0x13')],_0x402ca4[_0x3373c0]));}else{if(!_0x402ca4[_0x3373c0][_0xa2ee('0x8f')]){_0xcc2550[_0xa2ee('0x8e')](_0xec17d0(_0x4d9409,_0x402ca4[_0x3373c0],_0x323ab7[_0xa2ee('0x13')]));}else{if(_0x4d9409[_0xa2ee('0x90')]){_0xcc2550[_0xa2ee('0x8e')](_0x21e854(_0x4d9409,_0x402ca4[_0x3373c0]));}}}}}return Promise[_0xa2ee('0x8b')](_0xcc2550);})[_0xa2ee('0x6')](function(_0x49c543){var _0x146e94=_0x49c543;var _0x5700ee=null;if(_0x146e94){_0x5700ee=_0x146e94[_0xa2ee('0x87')]===0x1?_0x146e94[0x0]:null;}if(!_0x5700ee&&!_0x146e94)return _0x2c4e02;var _0x5f4939=_0x127bb5[_0x323ab7[_0xa2ee('0x13')]][_0xa2ee('0x91')];_0x48ad22['model']=_[_0xa2ee('0x92')](_0x5f4939);_0x48ad22['query']=_[_0xa2ee('0x92')](_0x32462d[_0xa2ee('0x80')]);_0x48ad22['filters']=_[_0xa2ee('0x93')](_0x48ad22[_0xa2ee('0x90')],_0x48ad22['query']);_0x535c38[_0xa2ee('0x94')]=_['intersection'](_0x48ad22['model'],_0x341615[_0xa2ee('0x95')](_0x32462d['query'][_0xa2ee('0x95')]));_0x535c38[_0xa2ee('0x94')]=_0x535c38[_0xa2ee('0x94')][_0xa2ee('0x87')]?_0x535c38['attributes']:_0x48ad22['model'];if(!_0x32462d['query'][_0xa2ee('0x96')](_0xa2ee('0x97'))){_0x535c38[_0xa2ee('0x98')]=_0x341615['limit'](_0x32462d[_0xa2ee('0x80')][_0xa2ee('0x98')]);_0x535c38[_0xa2ee('0x99')]=_0x341615[_0xa2ee('0x99')](_0x32462d['query'][_0xa2ee('0x99')]);}_0x535c38[_0xa2ee('0x9a')]=_0x341615[_0xa2ee('0x9b')](_0x32462d['query'][_0xa2ee('0x9b')]);_0x535c38[_0xa2ee('0x7e')]=_0x341615[_0xa2ee('0x9c')](_[_0xa2ee('0x9d')](_0x32462d['query'],_0x48ad22[_0xa2ee('0x9c')]));if(_0x32462d[_0xa2ee('0x80')][_0xa2ee('0x3')]){_0x535c38['where']=_[_0xa2ee('0x9e')](_0x535c38[_0xa2ee('0x7e')],{'$or':_['map'](_0x5f4939,function(_0x58979f){if(_0x58979f[_0xa2ee('0x10')][_0xa2ee('0x9f')]!==_0xa2ee('0xa0')){var _0x172c08={};_0x172c08[_0x58979f[_0xa2ee('0x9')]]={'$like':'%'+_0x32462d[_0xa2ee('0x80')]['filter']+'%'};return _0x172c08;}})});}var _0x22f414=[];var _0x70cb42=null;var _0x17d017={};if(_0x5700ee){_0x70cb42=_['find'](_0xccb236,[_0xa2ee('0xb'),_0x5700ee[_0xa2ee('0xb')]]);if(_0x70cb42[_0xa2ee('0x9')]){_0x17d017={};if(_0x323ab7[_0xa2ee('0x13')]===_0xa2ee('0xe')){_0x17d017[_0x70cb42['foreignKey']]=_[_0xa2ee('0x7')](_0x5700ee[_0xa2ee('0xa')],'id');}else{_0x17d017[_0x70cb42[_0xa2ee('0xa1')]]=_0x5700ee[_0xa2ee('0xa')];}_0x22f414['push'](_0x17d017);}else{_0x535c38[_0xa2ee('0x7e')]['id']=_0x5700ee[_0xa2ee('0xa')];}}else{for(var _0x4668c8=0x0;_0x4668c8<_0x146e94[_0xa2ee('0x87')];_0x4668c8++){_0x70cb42=_[_0xa2ee('0x89')](_0xccb236,['name',_0x146e94[_0x4668c8][_0xa2ee('0xb')]]);if(_0x70cb42['field']){_0x17d017={};_0x17d017[_0x70cb42[_0xa2ee('0xa1')]]=_0x146e94[_0x4668c8]['associatedResources'];_0x22f414[_0xa2ee('0x8e')](_0x17d017);}else{if(!_0x535c38[_0xa2ee('0x7e')]['id'])_0x535c38[_0xa2ee('0x7e')]['id']=[];_0x146e94[_0x4668c8][_0xa2ee('0xa')]['forEach'](function(_0x4c2823){_0x535c38[_0xa2ee('0x7e')]['id'][_0xa2ee('0x8e')](_0x4c2823);});}}}if(!_[_0xa2ee('0x86')](_0x22f414)){_0x535c38[_0xa2ee('0x7e')]=_[_0xa2ee('0x9e')](_0x535c38[_0xa2ee('0x7e')],{'$and':{'$or':_0x22f414}});}_0x535c38=_[_0xa2ee('0x9e')]({},_0x535c38,_0x32462d[_0xa2ee('0xa2')]);if(_0x5700ee&&!_0x5700ee['autoAssociation']&&_0x323ab7[_0xa2ee('0x13')]===_0xa2ee('0xe')){if(_0x32462d[_0xa2ee('0x80')][_0xa2ee('0xa3')]){_0x535c38[_0xa2ee('0xa4')]=[{'all':!![]}];}return _0x127bb5[_0x323ab7[_0xa2ee('0x13')]][_0xa2ee('0x5')](_0x535c38)[_0xa2ee('0x6')](function(_0x5a2ac0){var _0x2ac1c7=[];_0x5a2ac0[_0xa2ee('0xa5')](function(_0x30bbed){var _0x5ae3a6;switch(_0x30bbed['reportType']){case _0xa2ee('0xa6'):_0x5ae3a6=_[_0xa2ee('0x89')](_0x5700ee['associatedResources'],function(_0x56c9a2){return _0x56c9a2['id']===_0x30bbed[_0xa2ee('0x70')]&&_0x56c9a2[_0xa2ee('0x10')]===_0xa2ee('0xa7');});break;case _0xa2ee('0xa8'):_0x5ae3a6=_[_0xa2ee('0x89')](_0x5700ee['associatedResources'],function(_0x35b415){return _0x35b415['id']===_0x30bbed[_0xa2ee('0x70')]&&_0x35b415['type']===_0xa2ee('0xa9');});break;}if(_0x5ae3a6)_0x2ac1c7[_0xa2ee('0x8e')](_0x30bbed);});_0x2c4e02[_0xa2ee('0xaa')]=_0x2ac1c7['length'];_0x2c4e02[_0xa2ee('0xab')]=_0x2ac1c7;return _0x2c4e02;});}else{if(!_[_0xa2ee('0x86')](_0x32462d[_0xa2ee('0x80')]['ids'])){_0x535c38[_0xa2ee('0x7e')]['id']=_0x535c38[_0xa2ee('0x7e')]['id']?_[_0xa2ee('0x93')](_0x535c38[_0xa2ee('0x7e')]['id'],_0x32462d[_0xa2ee('0x80')]['ids']):_0x32462d['query'][_0xa2ee('0xac')];if(_0x32462d[_0xa2ee('0x80')][_0xa2ee('0xad')]){_0x535c38['order']=_0x32462d['query']['customSorting'];}}if(_0x32462d['query'][_0xa2ee('0xae')]){_0x535c38[_0xa2ee('0x7e')]=_[_0xa2ee('0x9e')](_0x535c38[_0xa2ee('0x7e')],{'$and':_0x32462d[_0xa2ee('0x80')][_0xa2ee('0xae')]});}return _0x127bb5[_0x323ab7[_0xa2ee('0x13')]][_0xa2ee('0xaa')]({'where':_0x535c38[_0xa2ee('0x7e')]})[_0xa2ee('0x6')](function(_0x4896b9){_0x2c4e02[_0xa2ee('0xaa')]=_0x4896b9;if(_0x32462d[_0xa2ee('0x80')]['includeAll']){if(_0x323ab7[_0xa2ee('0x13')]==='CmContact'){_0x535c38[_0xa2ee('0xa4')]=[{'model':_0x127bb5[_0xa2ee('0x66')],'as':'Tags','attributes':['id','name',_0xa2ee('0xaf')],'required':_0x32462d[_0xa2ee('0x80')]['tag']?!![]:![]},{'model':_0x127bb5['Tag'],'as':_0xa2ee('0xb0'),'attributes':['id',_0xa2ee('0xb'),_0xa2ee('0xaf')],'through':_0x32462d[_0xa2ee('0x80')][_0xa2ee('0xb1')]?{'attributes':[],'where':{'TagId':_0x32462d['query'][_0xa2ee('0xb1')]||undefined}}:{},'required':_0x32462d['query'][_0xa2ee('0xb1')]?!![]:![]}];}else{_0x535c38[_0xa2ee('0xa4')]=[{'all':!![]}];}}return _0x127bb5[_0x323ab7['childModel']][_0xa2ee('0x5')](_0x535c38);})[_0xa2ee('0x6')](function(_0x4d31d3){_0x2c4e02[_0xa2ee('0xab')]=_0x4d31d3;if(_0x274b1b==='Agents'&&_0x32462d[_0xa2ee('0x80')][_0xa2ee('0xb2')]===_0xa2ee('0xb3')){var _0x2a4733=[];for(var _0x2cbec0=0x0;_0x2cbec0<_0x2c4e02['rows'][_0xa2ee('0x87')];_0x2cbec0++){_0x2a4733[_0xa2ee('0x8e')](_0x258887('chat',_0x2c4e02[_0xa2ee('0xab')][_0x2cbec0]['dataValues']));_0x2a4733[_0xa2ee('0x8e')](_0x258887(_0xa2ee('0xb4'),_0x2c4e02[_0xa2ee('0xab')][_0x2cbec0]['dataValues']));_0x2a4733[_0xa2ee('0x8e')](_0x258887(_0xa2ee('0xb5'),_0x2c4e02[_0xa2ee('0xab')][_0x2cbec0][_0xa2ee('0xb6')]));_0x2a4733[_0xa2ee('0x8e')](_0x258887(_0xa2ee('0xb7'),_0x2c4e02[_0xa2ee('0xab')][_0x2cbec0]['dataValues']));_0x2a4733['push'](_0x258887(_0xa2ee('0xb8'),_0x2c4e02[_0xa2ee('0xab')][_0x2cbec0][_0xa2ee('0xb6')]));_0x2a4733[_0xa2ee('0x8e')](_0x258887('whatsapp',_0x2c4e02['rows'][_0x2cbec0][_0xa2ee('0xb6')]));}return Promise[_0xa2ee('0x8b')](_0x2a4733)[_0xa2ee('0x6')](function(){return _0x2c4e02;});}return _0x2c4e02;});}});}}});}; \ No newline at end of file +var _0xdbc5=['AnalyticMetric','charAt','slice','Sequelize','QueryTypes','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','mergeResources','Invalid\x20section\x20\x27','length','push','all','union','find','ignore','autoAssociation','rawAttributes','keys','filters','attributes','intersection','fields','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','DefaultReports','custom','CustomReports','count','rows','isEmpty','ids','customSorting','extraQueryConditions','Tag','Tags','color','tag','chat','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','squel','exports','models','field','filter','value','findAll','then','map','catch','model','associatedResources','name','resolve','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','projects','JscriptyProject','CmContact','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','Telephones','User','telephone','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','VoiceQueues','users','telephones','Users','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','plugins','extractedreports','AnalyticExtractedReport','reportId'];(function(_0x5eaffc,_0x3c55ee){var _0x2b2aba=function(_0x244df4){while(--_0x244df4){_0x5eaffc['push'](_0x5eaffc['shift']());}};_0x2b2aba(++_0x3c55ee);}(_0xdbc5,0x107));var _0x5dbc=function(_0x3e8742,_0x3ab1c){_0x3e8742=_0x3e8742-0x0;var _0x43dafd=_0xdbc5[_0x3e8742];return _0x43dafd;};'use strict';var _=require(_0x5dbc('0x0'));var attributes=require(_0x5dbc('0x1'));var squel=require(_0x5dbc('0x2'));module[_0x5dbc('0x3')]=function(_0x10b30b){var _0x317020=_0x10b30b[_0x5dbc('0x4')];function _0x5f1922(_0xaae64f,_0x557c8d){return new Promise(function(_0x3f72ae,_0x18c79d){if(!_0x557c8d)return _0x3f72ae(null);var _0x368563=_0x557c8d['filter']?{[_0x557c8d['filter'][_0x5dbc('0x5')]]:_0x557c8d[_0x5dbc('0x6')][_0x5dbc('0x7')]}:undefined;return _0x317020[_0xaae64f][_0x5dbc('0x8')]({'where':_0x368563,'raw':!![]})[_0x5dbc('0x9')](function(_0x5d3845){_0x557c8d['associatedResources']=_[_0x5dbc('0xa')](_0x5d3845,'id');_0x3f72ae(_0x557c8d);})[_0x5dbc('0xb')](function(_0x60072f){_0x18c79d(_0x60072f);});});}function _0x494309(_0x56d2e3,_0x5be487){return new Promise(function(_0x3d8ae1,_0x3724b5){var _0x29b6bd=_0x56d2e3[_0x5dbc('0x6')]?{[_0x56d2e3[_0x5dbc('0x6')][_0x5dbc('0x5')]]:_0x56d2e3[_0x5dbc('0x6')][_0x5dbc('0x7')]}:undefined;return _0x317020[_0x56d2e3[_0x5dbc('0xc')]]['findAll']({'where':_0x29b6bd,'raw':!![]})[_0x5dbc('0x9')](function(_0x40e9d0){_0x5be487[_0x5dbc('0xd')]=_[_0x5dbc('0xa')](_0x40e9d0,function(_0x14a9a5){return _0x14a9a5[_0x5dbc('0xe')];});_0x3d8ae1(_0x5be487);})[_0x5dbc('0xb')](function(_0x150842){_0x3724b5(_0x150842);});});}function _0x4da657(_0x144f27,_0xb2fbef,_0x5eb459){if(!_0xb2fbef)return Promise[_0x5dbc('0xf')](null);return new Promise(function(_0x2f6673,_0x338c61){return _0x317020[_0x5dbc('0x10')][_0x5dbc('0x8')]({'where':{'sectionId':_0xb2fbef['id']},'raw':!![]})[_0x5dbc('0x9')](function(_0x2ec357){if(_0x144f27[_0x5dbc('0x5')]&&_0x144f27[_0x5dbc('0x5')]!=='id'){_0xb2fbef[_0x5dbc('0xd')]=_['map'](_0x2ec357,function(_0x2a1724){return _0x2a1724[_0x144f27[_0x5dbc('0x5')]];});}else{if(_0x5eb459==='AnalyticExtractedReport'){_0xb2fbef[_0x5dbc('0xd')]=_[_0x5dbc('0xa')](_0x2ec357,function(_0x512804){return{'id':_0x512804[_0x5dbc('0x11')],'type':_0x512804[_0x5dbc('0x12')]};});}else{_0xb2fbef['associatedResources']=_[_0x5dbc('0xa')](_0x2ec357,function(_0x8ad1de){return _0x8ad1de[_0x5dbc('0x11')];});}}_0x2f6673(_0xb2fbef);})['catch'](function(_0x4ada9b){_0x338c61(_0x4ada9b);});});}function _0x20c837(_0x1ff9f2,_0x3f1d40){var _0x24236e={'parentSections':[]};switch(_0x1ff9f2[_0x5dbc('0x13')]()){case _0x5dbc('0x14'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x16');break;case _0x5dbc('0x17'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x18');break;case _0x5dbc('0x19'):_0x24236e[_0x5dbc('0x15')]='SquareRecording';_0x24236e[_0x5dbc('0x1a')]=[{'name':_0x5dbc('0x1b'),'field':_0x5dbc('0xe'),'foreignKey':'projectName'}];break;case _0x5dbc('0x1c'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x1d');break;case'contacts':_0x24236e['childModel']=_0x5dbc('0x1e');_0x24236e[_0x5dbc('0x1a')]=[{'name':'Lists','field':'id','foreignKey':_0x5dbc('0x1f')}];break;case _0x5dbc('0x20'):_0x24236e['childModel']=_0x5dbc('0x21');break;case _0x5dbc('0x22'):_0x24236e['childModel']=_0x5dbc('0x23');break;case'globalcustomfields':_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x24');break;case _0x5dbc('0x25'):_0x24236e['childModel']=_0x5dbc('0x26');break;case'chatwebsites':_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x27');break;case _0x5dbc('0x28'):_0x24236e[_0x5dbc('0x15')]='FaxQueue';break;case _0x5dbc('0x29'):_0x24236e['childModel']=_0x5dbc('0x2a');break;case _0x5dbc('0x2b'):case _0x5dbc('0x2c'):case _0x5dbc('0x2d'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x2e');break;case _0x5dbc('0x2f'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x30');break;case _0x5dbc('0x31'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x32');break;case _0x5dbc('0x33'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x34');_0x24236e['parentSections']=[{'name':_0x5dbc('0x35'),'field':_0x5dbc('0xe'),'foreignKey':_0x5dbc('0x36'),'model':'User','filter':{'field':_0x5dbc('0x37'),'value':['agent']}},{'name':_0x5dbc('0x38'),'field':_0x5dbc('0xe'),'foreignKey':_0x5dbc('0x36'),'model':_0x5dbc('0x39'),'filter':{'field':'role','value':[_0x5dbc('0x3a')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x5dbc('0x3b'),'model':_0x5dbc('0x3c'),'filter':{'field':_0x5dbc('0x12'),'value':[_0x5dbc('0x3d')]}},{'name':_0x5dbc('0x3e'),'field':_0x5dbc('0xe'),'foreignKey':_0x5dbc('0x3b'),'model':_0x5dbc('0x3c'),'filter':{'field':'type','value':['outbound']}}];break;case _0x5dbc('0x3f'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x40');break;case _0x5dbc('0x41'):_0x24236e[_0x5dbc('0x15')]='VoiceChanSpy';break;case'voiceprefixes':_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x42');break;case _0x5dbc('0x43'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x44');break;case'mailqueues':_0x24236e['childModel']=_0x5dbc('0x45');break;case _0x5dbc('0x46'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x47');break;case'mailsubstatuses':_0x24236e['childModel']=_0x5dbc('0x48');break;case _0x5dbc('0x49'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x4a');break;case _0x5dbc('0x4b'):_0x24236e[_0x5dbc('0x15')]='OpenchannelAccount';break;case _0x5dbc('0x4c'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x4d');break;case _0x5dbc('0x4e'):_0x24236e['childModel']='SmsAccount';break;case _0x5dbc('0x4f'):_0x24236e[_0x5dbc('0x15')]='WhatsappQueue';break;case _0x5dbc('0x50'):_0x24236e['childModel']=_0x5dbc('0x51');break;case _0x5dbc('0x52'):_0x24236e[_0x5dbc('0x15')]='Team';break;case _0x5dbc('0x53'):case _0x5dbc('0x54'):_0x24236e['childModel']=_0x5dbc('0x3c');if(_0x3f1d40){_0x24236e['parentSections']=[{'name':_0x5dbc('0x55')},{'name':'QueueCampaigns'}];}break;case _0x5dbc('0x56'):case'agents':case _0x5dbc('0x57'):_0x24236e['childModel']=_0x5dbc('0x39');if(_0x3f1d40){_0x24236e[_0x5dbc('0x1a')]=[{'name':_0x5dbc('0x58'),'filter':{'field':_0x5dbc('0x37'),'value':['admin',_0x5dbc('0x59')]},'ignore':!![]},{'name':_0x5dbc('0x35')},{'name':_0x5dbc('0x38')}];}break;case'zendeskaccounts':_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x5a');break;case _0x5dbc('0x5b'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x5c');break;case _0x5dbc('0x5d'):_0x24236e[_0x5dbc('0x15')]='FreshdeskAccount';break;case _0x5dbc('0x5e'):_0x24236e[_0x5dbc('0x15')]='SugarcrmAccount';break;case _0x5dbc('0x5f'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x60');break;case'zohoaccounts':_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x61');break;case _0x5dbc('0x62'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x39');break;case _0x5dbc('0x63'):_0x24236e['childModel']=_0x5dbc('0x64');break;case _0x5dbc('0x65'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x66');break;case _0x5dbc('0x67'):_0x24236e['childModel']=_0x5dbc('0x68');break;case _0x5dbc('0x69'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x6a');break;case _0x5dbc('0x6b'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x6c');break;case _0x5dbc('0x6d'):_0x24236e['childModel']=_0x5dbc('0x6e');break;case _0x5dbc('0x6f'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x70');break;case _0x5dbc('0x71'):_0x24236e['childModel']='Tag';break;case _0x5dbc('0x72'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x73');break;case _0x5dbc('0x74'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x75');break;case _0x5dbc('0x76'):_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x77');break;case _0x5dbc('0x78'):_0x24236e['childModel']='Variable';break;case _0x5dbc('0x79'):_0x24236e[_0x5dbc('0x15')]='Plugin';break;case _0x5dbc('0x7a'):_0x24236e['childModel']=_0x5dbc('0x7b');_0x24236e[_0x5dbc('0x1a')]=[{'name':'Reports','field':'id','foreignKey':_0x5dbc('0x7c')}];break;case'metrics':_0x24236e[_0x5dbc('0x15')]=_0x5dbc('0x7d');break;}return _0x24236e;}function _0x282375(_0x12a822,_0x39cb73){var _0x3705fd=_0x12a822[_0x5dbc('0x7e')](0x0)['toUpperCase']()+_0x12a822[_0x5dbc('0x7f')](0x1);var _0x51d65f={'type':_0x317020[_0x5dbc('0x80')][_0x5dbc('0x81')]['SELECT'],'raw':!![]};return new Promise(function(_0x376726,_0x2459ed){var _0x468d25=squel[_0x5dbc('0x82')]()[_0x5dbc('0x5')]('ui.'+_0x3705fd+_0x5dbc('0x83'),'id')[_0x5dbc('0x5')](_0x5dbc('0x84'))[_0x5dbc('0x85')](_0x5dbc('0x86')+_0x12a822+_0x5dbc('0x87'),'ui')[_0x5dbc('0x88')]('ui.UserId\x20=\x20?',_0x39cb73['id']);return _0x317020[_0x5dbc('0x89')][_0x5dbc('0x8a')](_0x468d25[_0x5dbc('0x8b')](),_0x51d65f)[_0x5dbc('0x9')](function(_0x43b716){_0x39cb73[_0x3705fd+_0x5dbc('0x8c')]=_0x43b716;_0x376726(_0x43b716);})['catch'](function(_0x457abf){_0x2459ed(_0x457abf);});});}return _0x10b30b[_0x5dbc('0x8d')](_0x5dbc('0x8e'),attributes,{'tableName':_0x5dbc('0x8f'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1631db){var _0x4f811c=require(_0x5dbc('0x90'));var _0x4bfca2={'raw':_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0x91')],'where':{}};var _0x112b37={};var _0x513f91={'count':0x0,'rows':[]};var _0xdf5847=_0x1631db[_0x5dbc('0x8a')]['section'];var _0x2a9319=_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0x92')]||![];var _0x4b3f7d=_0x20c837(_0xdf5847,_0x2a9319);if(!_0x4b3f7d['childModel'])throw new Error(_0x5dbc('0x93')+_0xdf5847+'\x27');var _0x1224f7=[{'name':_0xdf5847}];if(!_['isEmpty'](_0x4b3f7d['parentSections']))_0x1224f7=_0x4b3f7d[_0x5dbc('0x1a')];var _0xea0eda=[];for(var _0x238f57=0x0;_0x238f57<_0x1224f7[_0x5dbc('0x94')];_0x238f57++){_0xea0eda[_0x5dbc('0x95')](_0x317020['UserProfileSection']['find']({'where':{'userProfileId':_0x1631db['params']['id'],'name':_0x1224f7[_0x238f57][_0x5dbc('0xe')]},'raw':!![]}));}return Promise[_0x5dbc('0x96')](_0xea0eda)[_0x5dbc('0x9')](function(_0xe98074){var _0x556fe1=_[_0x5dbc('0x6')](_0xe98074,function(_0xad1077){return _0xad1077?_0xad1077:undefined;});var _0x36520f=_[_0x5dbc('0x6')](_0x1224f7,['ignore',!![]]);var _0xc0c08f=_['isEmpty'](_0x556fe1)&&_['isEmpty'](_0x36520f)?null:_[_0x5dbc('0x97')](_0x36520f,_0x556fe1);if(!_0xc0c08f)return null;var _0x10dfa4=[];for(var _0x32b9b9=0x0;_0x32b9b9<_0xc0c08f[_0x5dbc('0x94')];_0x32b9b9++){var _0x13db4c=_[_0x5dbc('0x98')](_0x1224f7,function(_0x3dc764){return _0xc0c08f[_0x32b9b9]?_0x3dc764[_0x5dbc('0xe')]===_0xc0c08f[_0x32b9b9]['name']:null;});if(_0x13db4c){if(_0xc0c08f[_0x32b9b9][_0x5dbc('0x99')]){_0x10dfa4['push'](_0x5f1922(_0x4b3f7d[_0x5dbc('0x15')],_0xc0c08f[_0x32b9b9]));}else{if(!_0xc0c08f[_0x32b9b9][_0x5dbc('0x9a')]){_0x10dfa4[_0x5dbc('0x95')](_0x4da657(_0x13db4c,_0xc0c08f[_0x32b9b9],_0x4b3f7d[_0x5dbc('0x15')]));}else{if(_0x13db4c[_0x5dbc('0xc')]){_0x10dfa4[_0x5dbc('0x95')](_0x494309(_0x13db4c,_0xc0c08f[_0x32b9b9]));}}}}}return Promise[_0x5dbc('0x96')](_0x10dfa4);})[_0x5dbc('0x9')](function(_0x102167){var _0x25dd75=_0x102167;var _0xabb0cb=null;if(_0x25dd75){_0xabb0cb=_0x25dd75[_0x5dbc('0x94')]===0x1?_0x25dd75[0x0]:null;}if(!_0xabb0cb&&!_0x25dd75)return _0x513f91;var _0x3f6bd3=_0x317020[_0x4b3f7d[_0x5dbc('0x15')]][_0x5dbc('0x9b')];_0x112b37[_0x5dbc('0xc')]=_[_0x5dbc('0x9c')](_0x3f6bd3);_0x112b37['query']=_['keys'](_0x1631db[_0x5dbc('0x8a')]);_0x112b37[_0x5dbc('0x9d')]=_['intersection'](_0x112b37['model'],_0x112b37[_0x5dbc('0x8a')]);_0x4bfca2[_0x5dbc('0x9e')]=_[_0x5dbc('0x9f')](_0x112b37[_0x5dbc('0xc')],_0x4f811c[_0x5dbc('0xa0')](_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0xa0')]));_0x4bfca2[_0x5dbc('0x9e')]=_0x4bfca2['attributes'][_0x5dbc('0x94')]?_0x4bfca2[_0x5dbc('0x9e')]:_0x112b37['model'];if(!_0x1631db[_0x5dbc('0x8a')]['hasOwnProperty'](_0x5dbc('0xa1'))){_0x4bfca2[_0x5dbc('0xa2')]=_0x4f811c[_0x5dbc('0xa2')](_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0xa2')]);_0x4bfca2[_0x5dbc('0xa3')]=_0x4f811c[_0x5dbc('0xa3')](_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0xa3')]);}_0x4bfca2[_0x5dbc('0xa4')]=_0x4f811c[_0x5dbc('0xa5')](_0x1631db[_0x5dbc('0x8a')]['sort']);_0x4bfca2[_0x5dbc('0x88')]=_0x4f811c[_0x5dbc('0x9d')](_['pick'](_0x1631db['query'],_0x112b37[_0x5dbc('0x9d')]));if(_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0x6')]){_0x4bfca2[_0x5dbc('0x88')]=_[_0x5dbc('0xa6')](_0x4bfca2[_0x5dbc('0x88')],{'$or':_[_0x5dbc('0xa')](_0x3f6bd3,function(_0x378ebc){if(_0x378ebc[_0x5dbc('0x12')][_0x5dbc('0xa7')]!==_0x5dbc('0xa8')){var _0x322009={};_0x322009[_0x378ebc[_0x5dbc('0x5')]]={'$like':'%'+_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0x6')]+'%'};return _0x322009;}})});}var _0x3b5001=[];var _0x3edeac=null;var _0x2351a9={};if(_0xabb0cb){_0x3edeac=_[_0x5dbc('0x98')](_0x1224f7,['name',_0xabb0cb['name']]);if(_0x3edeac['field']){_0x2351a9={};if(_0x4b3f7d[_0x5dbc('0x15')]==='AnalyticExtractedReport'){_0x2351a9[_0x3edeac[_0x5dbc('0xa9')]]=_[_0x5dbc('0xa')](_0xabb0cb[_0x5dbc('0xd')],'id');}else{_0x2351a9[_0x3edeac[_0x5dbc('0xa9')]]=_0xabb0cb['associatedResources'];}_0x3b5001[_0x5dbc('0x95')](_0x2351a9);}else{_0x4bfca2[_0x5dbc('0x88')]['id']=_0xabb0cb[_0x5dbc('0xd')];}}else{for(var _0x31cb89=0x0;_0x31cb89<_0x25dd75['length'];_0x31cb89++){_0x3edeac=_[_0x5dbc('0x98')](_0x1224f7,[_0x5dbc('0xe'),_0x25dd75[_0x31cb89][_0x5dbc('0xe')]]);if(_0x3edeac[_0x5dbc('0x5')]){_0x2351a9={};_0x2351a9[_0x3edeac[_0x5dbc('0xa9')]]=_0x25dd75[_0x31cb89][_0x5dbc('0xd')];_0x3b5001[_0x5dbc('0x95')](_0x2351a9);}else{if(!_0x4bfca2[_0x5dbc('0x88')]['id'])_0x4bfca2[_0x5dbc('0x88')]['id']=[];_0x25dd75[_0x31cb89][_0x5dbc('0xd')][_0x5dbc('0xaa')](function(_0x270ba1){_0x4bfca2[_0x5dbc('0x88')]['id'][_0x5dbc('0x95')](_0x270ba1);});}}}if(!_['isEmpty'](_0x3b5001)){_0x4bfca2[_0x5dbc('0x88')]=_[_0x5dbc('0xa6')](_0x4bfca2[_0x5dbc('0x88')],{'$and':{'$or':_0x3b5001}});}_0x4bfca2=_[_0x5dbc('0xa6')]({},_0x4bfca2,_0x1631db[_0x5dbc('0xab')]);if(_0xabb0cb&&!_0xabb0cb[_0x5dbc('0x9a')]&&_0x4b3f7d[_0x5dbc('0x15')]===_0x5dbc('0x7b')){if(_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0xac')]){_0x4bfca2[_0x5dbc('0xad')]=[{'all':!![]}];}return _0x317020[_0x4b3f7d[_0x5dbc('0x15')]][_0x5dbc('0x8')](_0x4bfca2)[_0x5dbc('0x9')](function(_0x49195f){var _0x3d19ea=[];_0x49195f[_0x5dbc('0xaa')](function(_0x25fcba){var _0x1d48be;switch(_0x25fcba[_0x5dbc('0xae')]){case'default':_0x1d48be=_[_0x5dbc('0x98')](_0xabb0cb[_0x5dbc('0xd')],function(_0x1e5ef9){return _0x1e5ef9['id']===_0x25fcba[_0x5dbc('0x7c')]&&_0x1e5ef9[_0x5dbc('0x12')]===_0x5dbc('0xaf');});break;case _0x5dbc('0xb0'):_0x1d48be=_[_0x5dbc('0x98')](_0xabb0cb[_0x5dbc('0xd')],function(_0xd28570){return _0xd28570['id']===_0x25fcba[_0x5dbc('0x7c')]&&_0xd28570[_0x5dbc('0x12')]===_0x5dbc('0xb1');});break;}if(_0x1d48be)_0x3d19ea[_0x5dbc('0x95')](_0x25fcba);});_0x513f91[_0x5dbc('0xb2')]=_0x3d19ea[_0x5dbc('0x94')];_0x513f91[_0x5dbc('0xb3')]=_0x3d19ea;return _0x513f91;});}else{if(!_[_0x5dbc('0xb4')](_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0xb5')])){_0x4bfca2[_0x5dbc('0x88')]['id']=_0x4bfca2['where']['id']?_[_0x5dbc('0x9f')](_0x4bfca2[_0x5dbc('0x88')]['id'],_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0xb5')]):_0x1631db['query']['ids'];if(_0x1631db['query'][_0x5dbc('0xb6')]){_0x4bfca2[_0x5dbc('0xa4')]=_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0xb6')];}}if(_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0xb7')]){_0x4bfca2[_0x5dbc('0x88')]=_[_0x5dbc('0xa6')](_0x4bfca2[_0x5dbc('0x88')],{'$and':_0x1631db['query'][_0x5dbc('0xb7')]});}return _0x317020[_0x4b3f7d['childModel']][_0x5dbc('0xb2')]({'where':_0x4bfca2[_0x5dbc('0x88')]})[_0x5dbc('0x9')](function(_0xf4183c){_0x513f91['count']=_0xf4183c;if(_0x1631db['query'][_0x5dbc('0xac')]){if(_0x4b3f7d[_0x5dbc('0x15')]===_0x5dbc('0x1e')){_0x4bfca2[_0x5dbc('0xad')]=[{'model':_0x317020[_0x5dbc('0xb8')],'as':_0x5dbc('0xb9'),'attributes':['id',_0x5dbc('0xe'),_0x5dbc('0xba')],'required':_0x1631db['query'][_0x5dbc('0xbb')]?!![]:![]},{'model':_0x317020[_0x5dbc('0xb8')],'as':'ThroughTags','attributes':['id',_0x5dbc('0xe'),_0x5dbc('0xba')],'through':_0x1631db[_0x5dbc('0x8a')]['tag']?{'attributes':[],'where':{'TagId':_0x1631db[_0x5dbc('0x8a')][_0x5dbc('0xbb')]||undefined}}:{},'required':_0x1631db['query'][_0x5dbc('0xbb')]?!![]:![]}];}else{_0x4bfca2[_0x5dbc('0xad')]=[{'all':!![]}];}}return _0x317020[_0x4b3f7d[_0x5dbc('0x15')]][_0x5dbc('0x8')](_0x4bfca2);})[_0x5dbc('0x9')](function(_0x26d2fa){_0x513f91['rows']=_0x26d2fa;if(_0xdf5847===_0x5dbc('0x35')&&_0x1631db[_0x5dbc('0x8a')]['openTabs']==='true'){var _0x58aa73=[];for(var _0x8aedfc=0x0;_0x8aedfc<_0x513f91['rows'][_0x5dbc('0x94')];_0x8aedfc++){_0x58aa73[_0x5dbc('0x95')](_0x282375(_0x5dbc('0xbc'),_0x513f91[_0x5dbc('0xb3')][_0x8aedfc][_0x5dbc('0xbd')]));_0x58aa73[_0x5dbc('0x95')](_0x282375(_0x5dbc('0xbe'),_0x513f91[_0x5dbc('0xb3')][_0x8aedfc]['dataValues']));_0x58aa73[_0x5dbc('0x95')](_0x282375(_0x5dbc('0xbf'),_0x513f91['rows'][_0x8aedfc][_0x5dbc('0xbd')]));_0x58aa73[_0x5dbc('0x95')](_0x282375(_0x5dbc('0xc0'),_0x513f91[_0x5dbc('0xb3')][_0x8aedfc][_0x5dbc('0xbd')]));_0x58aa73[_0x5dbc('0x95')](_0x282375(_0x5dbc('0xc1'),_0x513f91[_0x5dbc('0xb3')][_0x8aedfc][_0x5dbc('0xbd')]));_0x58aa73[_0x5dbc('0x95')](_0x282375('whatsapp',_0x513f91[_0x5dbc('0xb3')][_0x8aedfc]['dataValues']));}return Promise[_0x5dbc('0x96')](_0x58aa73)[_0x5dbc('0x9')](function(){return _0x513f91;});}return _0x513f91;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 4e8d015..edf8358 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 _0x0c23=['stringify','error','code','UserProfile,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xa7e345,_0x37979a){var _0x59e4e3=function(_0x3bfcb7){while(--_0x3bfcb7){_0xa7e345['push'](_0xa7e345['shift']());}};_0x59e4e3(++_0x37979a);}(_0x0c23,0x13e));var _0x30c2=function(_0x4ac872,_0x40d2fb){_0x4ac872=_0x4ac872-0x0;var _0x377939=_0x0c23[_0x4ac872];return _0x377939;};'use strict';var _=require(_0x30c2('0x0'));var util=require(_0x30c2('0x1'));var moment=require(_0x30c2('0x2'));var BPromise=require(_0x30c2('0x3'));var rs=require(_0x30c2('0x4'));var fs=require('fs');var Redis=require(_0x30c2('0x5'));var db=require(_0x30c2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x30c2('0x7'))(_0x30c2('0x8'));var config=require(_0x30c2('0x9'));var jayson=require(_0x30c2('0xa'));var client=jayson[_0x30c2('0xb')][_0x30c2('0xc')]({'port':0x232a});config['redis']=_[_0x30c2('0xd')](config[_0x30c2('0xe')],{'host':_0x30c2('0xf'),'port':0x18eb});var socket=require(_0x30c2('0x10'))(new Redis(config[_0x30c2('0xe')]));require('./userProfile.socket')[_0x30c2('0x11')](socket);function respondWithRpcPromise(_0x2b6595,_0x4bd5be,_0x3365c5){return new BPromise(function(_0x44e778,_0x40f639){return client[_0x30c2('0x12')](_0x2b6595,_0x3365c5)[_0x30c2('0x13')](function(_0x17eb67){logger['info']('UserProfile,\x20%s,\x20%s',_0x4bd5be,'request\x20sent');logger[_0x30c2('0x14')](_0x30c2('0x15'),_0x4bd5be,_0x30c2('0x16'),JSON[_0x30c2('0x17')](_0x17eb67));if(_0x17eb67[_0x30c2('0x18')]){if(_0x17eb67[_0x30c2('0x18')][_0x30c2('0x19')]===0x1f4){logger['error'](_0x30c2('0x1a'),_0x4bd5be,_0x17eb67[_0x30c2('0x18')]['message']);return _0x40f639(_0x17eb67[_0x30c2('0x18')][_0x30c2('0x1b')]);}logger[_0x30c2('0x18')](_0x30c2('0x1a'),_0x4bd5be,_0x17eb67[_0x30c2('0x18')][_0x30c2('0x1b')]);return _0x44e778(_0x17eb67[_0x30c2('0x18')][_0x30c2('0x1b')]);}else{logger[_0x30c2('0x1c')](_0x30c2('0x1a'),_0x4bd5be,_0x30c2('0x16'));_0x44e778(_0x17eb67[_0x30c2('0x1d')]['message']);}})[_0x30c2('0x1e')](function(_0x48697c){logger['error'](_0x30c2('0x1a'),_0x4bd5be,_0x48697c);_0x40f639(_0x48697c);});});} \ No newline at end of file +var _0xb2ad=['socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x2012ba,_0x143dc2){var _0x48e437=function(_0x2bd7fa){while(--_0x2bd7fa){_0x2012ba['push'](_0x2012ba['shift']());}};_0x48e437(++_0x143dc2);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x2e2cbe,_0x1cf4d6){_0x2e2cbe=_0x2e2cbe-0x0;var _0x3ac1b8=_0xb2ad[_0x2e2cbe];return _0x3ac1b8;};'use strict';var _=require('lodash');var util=require(_0xdb2a('0x0'));var moment=require('moment');var BPromise=require(_0xdb2a('0x1'));var rs=require(_0xdb2a('0x2'));var fs=require('fs');var Redis=require(_0xdb2a('0x3'));var db=require(_0xdb2a('0x4'))['db'];var utils=require(_0xdb2a('0x5'));var logger=require('../../config/logger')(_0xdb2a('0x6'));var config=require(_0xdb2a('0x7'));var jayson=require(_0xdb2a('0x8'));var client=jayson[_0xdb2a('0x9')][_0xdb2a('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdb2a('0xb')],{'host':_0xdb2a('0xc'),'port':0x18eb});var socket=require(_0xdb2a('0xd'))(new Redis(config['redis']));require(_0xdb2a('0xe'))[_0xdb2a('0xf')](socket);function respondWithRpcPromise(_0x5d2a87,_0x3b1bbe,_0x39f48e){return new BPromise(function(_0x4bdf25,_0x591114){return client[_0xdb2a('0x10')](_0x5d2a87,_0x39f48e)[_0xdb2a('0x11')](function(_0x134425){logger['info'](_0xdb2a('0x12'),_0x3b1bbe,_0xdb2a('0x13'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x3b1bbe,'request\x20sent',JSON[_0xdb2a('0x14')](_0x134425));if(_0x134425['error']){if(_0x134425[_0xdb2a('0x15')][_0xdb2a('0x16')]===0x1f4){logger['error'](_0xdb2a('0x12'),_0x3b1bbe,_0x134425['error']['message']);return _0x591114(_0x134425['error']['message']);}logger[_0xdb2a('0x15')](_0xdb2a('0x12'),_0x3b1bbe,_0x134425['error']['message']);return _0x4bdf25(_0x134425[_0xdb2a('0x15')][_0xdb2a('0x17')]);}else{logger[_0xdb2a('0x18')](_0xdb2a('0x12'),_0x3b1bbe,'request\x20sent');_0x4bdf25(_0x134425[_0xdb2a('0x19')][_0xdb2a('0x17')]);}})[_0xdb2a('0x1a')](function(_0x584981){logger['error'](_0xdb2a('0x12'),_0x3b1bbe,_0x584981);_0x591114(_0x584981);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 7b87880..d124e61 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 _0x04ff=['emit','removeListener','length','save','remove'];(function(_0x5e0c7e,_0x831d41){var _0x46af2c=function(_0x1e9989){while(--_0x1e9989){_0x5e0c7e['push'](_0x5e0c7e['shift']());}};_0x46af2c(++_0x831d41);}(_0x04ff,0xa8));var _0xf04f=function(_0x1e524e,_0x5531e2){_0x1e524e=_0x1e524e-0x0;var _0x496883=_0x04ff[_0x1e524e];return _0x496883;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xf04f('0x0'),_0xf04f('0x1'),'update'];function createListener(_0x56e69f,_0x617b27){return function(_0x5b2c4f){_0x617b27[_0xf04f('0x2')](_0x56e69f,_0x5b2c4f);};}function removeListener(_0x543c4d,_0x5b0d42){return function(){UserProfileEvents[_0xf04f('0x3')](_0x543c4d,_0x5b0d42);};}exports['register']=function(_0x272f71){for(var _0x15c4aa=0x0,_0x73672a=events[_0xf04f('0x4')];_0x15c4aa<_0x73672a;_0x15c4aa++){var _0x2ee678=events[_0x15c4aa];var _0x3819ae=createListener('userProfile:'+_0x2ee678,_0x272f71);UserProfileEvents['on'](_0x2ee678,_0x3819ae);}}; \ No newline at end of file +var _0xba61=['register','length','userProfile:','./userProfile.events','remove','emit'];(function(_0x1233a0,_0x315e3b){var _0x33fb22=function(_0x6f66eb){while(--_0x6f66eb){_0x1233a0['push'](_0x1233a0['shift']());}};_0x33fb22(++_0x315e3b);}(_0xba61,0x189));var _0x1ba6=function(_0x43d1f9,_0x5cc383){_0x43d1f9=_0x43d1f9-0x0;var _0x1b9ed9=_0xba61[_0x43d1f9];return _0x1b9ed9;};'use strict';var UserProfileEvents=require(_0x1ba6('0x0'));var events=['save',_0x1ba6('0x1'),'update'];function createListener(_0xe11fd4,_0x1328d1){return function(_0x14925a){_0x1328d1[_0x1ba6('0x2')](_0xe11fd4,_0x14925a);};}function removeListener(_0x4d5b1a,_0xbbfa9d){return function(){UserProfileEvents['removeListener'](_0x4d5b1a,_0xbbfa9d);};}exports[_0x1ba6('0x3')]=function(_0x573d59){for(var _0x15a608=0x0,_0x3e6e97=events[_0x1ba6('0x4')];_0x15a608<_0x3e6e97;_0x15a608++){var _0xad5a94=events[_0x15a608];var _0x358ad8=createListener(_0x1ba6('0x5')+_0xad5a94,_0x573d59);UserProfileEvents['on'](_0xad5a94,_0x358ad8);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 4b82177..6ec09c1 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 _0x0ddc=['../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','post','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x19c718,_0xfbc00b){var _0x1af074=function(_0xd4e852){while(--_0xd4e852){_0x19c718['push'](_0x19c718['shift']());}};_0x1af074(++_0xfbc00b);}(_0x0ddc,0xa3));var _0xc0dd=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x0ddc[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0xc0dd('0x0'));var util=require(_0xc0dd('0x1'));var path=require('path');var timeout=require(_0xc0dd('0x2'));var express=require(_0xc0dd('0x3'));var router=express[_0xc0dd('0x4')]();var fs_extra=require(_0xc0dd('0x5'));var auth=require(_0xc0dd('0x6'));var interaction=require(_0xc0dd('0x7'));var config=require(_0xc0dd('0x8'));var controller=require(_0xc0dd('0x9'));router[_0xc0dd('0xa')]('/',auth[_0xc0dd('0xb')](),controller[_0xc0dd('0xc')]);router[_0xc0dd('0xa')](_0xc0dd('0xd'),auth['isAuthenticated'](),controller[_0xc0dd('0xe')]);router['get'](_0xc0dd('0xf'),auth[_0xc0dd('0xb')](),controller['show']);router[_0xc0dd('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc0dd('0xf'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xc0dd('0xb')](),controller[_0xc0dd('0x11')]);module[_0xc0dd('0x12')]=router; \ No newline at end of file +var _0x91d1=['put','update','delete','/:id','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','post','create'];(function(_0xf71d98,_0x51e619){var _0x3fec71=function(_0x87fb35){while(--_0x87fb35){_0xf71d98['push'](_0xf71d98['shift']());}};_0x3fec71(++_0x51e619);}(_0x91d1,0x17a));var _0x191d=function(_0x1ed619,_0xef04cb){_0x1ed619=_0x1ed619-0x0;var _0x245b60=_0x91d1[_0x1ed619];return _0x245b60;};'use strict';var multer=require('multer');var util=require(_0x191d('0x0'));var path=require(_0x191d('0x1'));var timeout=require(_0x191d('0x2'));var express=require(_0x191d('0x3'));var router=express['Router']();var fs_extra=require(_0x191d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x191d('0x5'));var config=require(_0x191d('0x6'));var controller=require('./userProfileResource.controller');router[_0x191d('0x7')]('/',auth[_0x191d('0x8')](),controller['index']);router[_0x191d('0x7')](_0x191d('0x9'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x191d('0xa')]);router[_0x191d('0xb')]('/',auth[_0x191d('0x8')](),controller[_0x191d('0xc')]);router[_0x191d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x191d('0xe')]);router[_0x191d('0xf')](_0x191d('0x10'),auth[_0x191d('0x8')](),controller['destroy']);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 7c0a174..5cc84fe 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 _0x8a80=['INTEGER','STRING'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x8a80,0x105));var _0x08a8=function(_0x4c1758,_0x2dae92){_0x4c1758=_0x4c1758-0x0;var _0x2f353e=_0x8a80[_0x4c1758];return _0x2f353e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x08a8('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x08a8('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x08a8('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xe3de=['sequelize','INTEGER'];(function(_0x2396c0,_0x5d771f){var _0x3a9104=function(_0x4d3f7a){while(--_0x4d3f7a){_0x2396c0['push'](_0x2396c0['shift']());}};_0x3a9104(++_0x5d771f);}(_0xe3de,0x152));var _0xee3d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe3de[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0xee3d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xee3d('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index ebab702..6250b20 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 _0x4975=['to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','UserProfileResource','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x29646e,_0x4f2abf){var _0x17a1f6=function(_0x3352e2){while(--_0x3352e2){_0x29646e['push'](_0x29646e['shift']());}};_0x17a1f6(++_0x4f2abf);}(_0x4975,0x86));var _0x5497=function(_0x3c16b8,_0x1e5341){_0x3c16b8=_0x3c16b8-0x0;var _0x290538=_0x4975[_0x3c16b8];return _0x290538;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['UserProfileResource'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['UserProfileResource'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file +var _0xe3da=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x360883,_0x216f2b){var _0x35c590=function(_0x10832e){while(--_0x10832e){_0x360883['push'](_0x360883['shift']());}};_0x35c590(++_0x216f2b);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));};exports['describe']=function(_0x4f4694,_0x4c6dab){return db[_0xae3d('0x2f')][_0xae3d('0x50')]()['then'](respondWithResult(_0x4c6dab,null))[_0xae3d('0x48')](handleError(_0x4c6dab,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index d3d2554..8f9481c 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 _0x5b44=['define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xd6a74,_0x3b878a){var _0x4ed128=function(_0x15cc95){while(--_0x15cc95){_0xd6a74['push'](_0xd6a74['shift']());}};_0x4ed128(++_0x3b878a);}(_0x5b44,0xbb));var _0x45b4=function(_0x259b16,_0x4641b9){_0x259b16=_0x259b16-0x0;var _0x388e7b=_0x5b44[_0x259b16];return _0x388e7b;};'use strict';var _=require(_0x45b4('0x0'));var util=require(_0x45b4('0x1'));var logger=require(_0x45b4('0x2'))(_0x45b4('0x3'));var moment=require('moment');var BPromise=require(_0x45b4('0x4'));var rp=require(_0x45b4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45b4('0x6'));var config=require(_0x45b4('0x7'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x463659,_0x2c4c2a){return _0x463659[_0x45b4('0x8')](_0x45b4('0x9'),attributes,{'tableName':_0x45b4('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x45b4('0xb'),_0x45b4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c47=['../../config/logger','api','moment','path','../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources','compositeIndex','sectionId','lodash','util'];(function(_0x15680e,_0x4dbf16){var _0x539714=function(_0x5c9259){while(--_0x5c9259){_0x15680e['push'](_0x15680e['shift']());}};_0x539714(++_0x4dbf16);}(_0x7c47,0xa6));var _0x77c4=function(_0x565827,_0x2344ed){_0x565827=_0x565827-0x0;var _0x428e44=_0x7c47[_0x565827];return _0x428e44;};'use strict';var _=require(_0x77c4('0x0'));var util=require(_0x77c4('0x1'));var logger=require(_0x77c4('0x2'))(_0x77c4('0x3'));var moment=require(_0x77c4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x77c4('0x5'));var rimraf=require('rimraf');var config=require(_0x77c4('0x6'));var attributes=require(_0x77c4('0x7'));module[_0x77c4('0x8')]=function(_0x421b02,_0x55e6e9){return _0x421b02['define']('UserProfileResource',attributes,{'tableName':_0x77c4('0x9'),'paranoid':![],'indexes':[{'name':_0x77c4('0xa'),'fields':['resourceId',_0x77c4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 20d7fc3..3f17605 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 _0x1b68=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','error','message','result','util','bluebird'];(function(_0xa78639,_0x3717f0){var _0x2d3b4d=function(_0x58e019){while(--_0x58e019){_0xa78639['push'](_0xa78639['shift']());}};_0x2d3b4d(++_0x3717f0);}(_0x1b68,0xa0));var _0x81b6=function(_0x46b26c,_0x4e42a0){_0x46b26c=_0x46b26c-0x0;var _0xbba68b=_0x1b68[_0x46b26c];return _0xbba68b;};'use strict';var _=require('lodash');var util=require(_0x81b6('0x0'));var moment=require('moment');var BPromise=require(_0x81b6('0x1'));var rs=require(_0x81b6('0x2'));var fs=require('fs');var Redis=require(_0x81b6('0x3'));var db=require(_0x81b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x81b6('0x5'));var config=require(_0x81b6('0x6'));var jayson=require(_0x81b6('0x7'));var client=jayson['client'][_0x81b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21f2e5,_0x4c6e95,_0x2f1c51){return new BPromise(function(_0x29200b,_0x2812eb){return client[_0x81b6('0x9')](_0x21f2e5,_0x2f1c51)[_0x81b6('0xa')](function(_0x4acb74){logger[_0x81b6('0xb')](_0x81b6('0xc'),_0x4c6e95,'request\x20sent');logger[_0x81b6('0xd')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x4c6e95,_0x81b6('0xe'),JSON['stringify'](_0x4acb74));if(_0x4acb74[_0x81b6('0xf')]){if(_0x4acb74[_0x81b6('0xf')]['code']===0x1f4){logger[_0x81b6('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x4c6e95,_0x4acb74[_0x81b6('0xf')]['message']);return _0x2812eb(_0x4acb74[_0x81b6('0xf')][_0x81b6('0x10')]);}logger[_0x81b6('0xf')](_0x81b6('0xc'),_0x4c6e95,_0x4acb74[_0x81b6('0xf')][_0x81b6('0x10')]);return _0x29200b(_0x4acb74['error'][_0x81b6('0x10')]);}else{logger['info'](_0x81b6('0xc'),_0x4c6e95,_0x81b6('0xe'));_0x29200b(_0x4acb74[_0x81b6('0x11')][_0x81b6('0x10')]);}})['catch'](function(_0x556fb2){logger[_0x81b6('0xf')](_0x81b6('0xc'),_0x4c6e95,_0x556fb2);_0x2812eb(_0x556fb2);});});} \ No newline at end of file +var _0x70f0=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x87eee5,_0x581852){var _0x17e2dc=function(_0x1122d2){while(--_0x1122d2){_0x87eee5['push'](_0x87eee5['shift']());}};_0x17e2dc(++_0x581852);}(_0x70f0,0xb4));var _0x070f=function(_0x11309c,_0xe18a74){_0x11309c=_0x11309c-0x0;var _0x3fea9c=_0x70f0[_0x11309c];return _0x3fea9c;};'use strict';var _=require(_0x070f('0x0'));var util=require(_0x070f('0x1'));var moment=require(_0x070f('0x2'));var BPromise=require(_0x070f('0x3'));var rs=require(_0x070f('0x4'));var fs=require('fs');var Redis=require(_0x070f('0x5'));var db=require(_0x070f('0x6'))['db'];var utils=require(_0x070f('0x7'));var logger=require(_0x070f('0x8'))('rpc');var config=require(_0x070f('0x9'));var jayson=require(_0x070f('0xa'));var client=jayson[_0x070f('0xb')][_0x070f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59e069,_0x97e3c2,_0x10331e){return new BPromise(function(_0xeb5cea,_0x5e629f){return client[_0x070f('0xd')](_0x59e069,_0x10331e)[_0x070f('0xe')](function(_0x2d9891){logger[_0x070f('0xf')](_0x070f('0x10'),_0x97e3c2,_0x070f('0x11'));logger[_0x070f('0x12')](_0x070f('0x13'),_0x97e3c2,'request\x20sent',JSON[_0x070f('0x14')](_0x2d9891));if(_0x2d9891[_0x070f('0x15')]){if(_0x2d9891[_0x070f('0x15')]['code']===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x97e3c2,_0x2d9891[_0x070f('0x15')]['message']);return _0x5e629f(_0x2d9891[_0x070f('0x15')]['message']);}logger[_0x070f('0x15')]('UserProfileResource,\x20%s,\x20%s',_0x97e3c2,_0x2d9891[_0x070f('0x15')][_0x070f('0x16')]);return _0xeb5cea(_0x2d9891[_0x070f('0x15')][_0x070f('0x16')]);}else{logger[_0x070f('0xf')](_0x070f('0x10'),_0x97e3c2,_0x070f('0x11'));_0xeb5cea(_0x2d9891[_0x070f('0x17')][_0x070f('0x16')]);}})[_0x070f('0x18')](function(_0x52fddf){logger[_0x070f('0x15')](_0x070f('0x10'),_0x97e3c2,_0x52fddf);_0x5e629f(_0x52fddf);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b6928e7..4d6346a 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 _0xce62=['isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get'];(function(_0x5e186e,_0x379091){var _0x49998b=function(_0x53fb5b){while(--_0x53fb5b){_0x5e186e['push'](_0x5e186e['shift']());}};_0x49998b(++_0x379091);}(_0xce62,0x79));var _0x2ce6=function(_0x5e2471,_0x4279b7){_0x5e2471=_0x5e2471-0x0;var _0x329410=_0xce62[_0x5e2471];return _0x329410;};'use strict';var multer=require(_0x2ce6('0x0'));var util=require(_0x2ce6('0x1'));var path=require(_0x2ce6('0x2'));var timeout=require(_0x2ce6('0x3'));var express=require(_0x2ce6('0x4'));var router=express[_0x2ce6('0x5')]();var fs_extra=require(_0x2ce6('0x6'));var auth=require(_0x2ce6('0x7'));var interaction=require(_0x2ce6('0x8'));var config=require('../../config/environment');var controller=require(_0x2ce6('0x9'));router[_0x2ce6('0xa')]('/',auth[_0x2ce6('0xb')](),controller[_0x2ce6('0xc')]);router['get'](_0x2ce6('0xd'),auth[_0x2ce6('0xb')](),controller[_0x2ce6('0xe')]);router[_0x2ce6('0xa')]('/:id',auth[_0x2ce6('0xb')](),controller['show']);router[_0x2ce6('0xf')]('/',auth[_0x2ce6('0xb')](),controller['create']);router[_0x2ce6('0x10')](_0x2ce6('0x11'),auth[_0x2ce6('0xb')](),controller[_0x2ce6('0x12')]);router[_0x2ce6('0x13')](_0x2ce6('0x11'),auth[_0x2ce6('0xb')](),controller[_0x2ce6('0x14')]);module[_0x2ce6('0x15')]=router; \ No newline at end of file +var _0x00b3=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','update','delete','destroy','exports','multer','path','express'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0x00b3,0xcf));var _0x300b=function(_0x123c12,_0x4acb4d){_0x123c12=_0x123c12-0x0;var _0xe0d744=_0x00b3[_0x123c12];return _0xe0d744;};'use strict';var multer=require(_0x300b('0x0'));var util=require('util');var path=require(_0x300b('0x1'));var timeout=require('connect-timeout');var express=require(_0x300b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x300b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x300b('0x4'));var controller=require('./userProfileSection.controller');router[_0x300b('0x5')]('/',auth[_0x300b('0x6')](),controller[_0x300b('0x7')]);router[_0x300b('0x5')]('/describe',auth[_0x300b('0x6')](),controller[_0x300b('0x8')]);router[_0x300b('0x5')](_0x300b('0x9'),auth['isAuthenticated'](),controller[_0x300b('0xa')]);router['post']('/',auth[_0x300b('0x6')](),controller['create']);router['put'](_0x300b('0x9'),auth[_0x300b('0x6')](),controller[_0x300b('0xb')]);router[_0x300b('0xc')](_0x300b('0x9'),auth[_0x300b('0x6')](),controller[_0x300b('0xd')]);module[_0x300b('0xe')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 1da3044..3759cb3 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 _0xfef3=['sequelize','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split'];(function(_0x3cec3e,_0xd9c0a1){var _0x1beeda=function(_0x93549f){while(--_0x93549f){_0x3cec3e['push'](_0x3cec3e['shift']());}};_0x1beeda(++_0xd9c0a1);}(_0xfef3,0x118));var _0x3fef=function(_0x515099,_0x46bdbd){_0x515099=_0x515099-0x0;var _0x26e0a7=_0xfef3[_0x515099];return _0x26e0a7;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3fef('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3fef('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3fef('0x1')],'set':function(_0x3b71e5){this['setDataValue'](_0x3fef('0x4'),_0x3b71e5?_0x3b71e5[_0x3fef('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x3fef('0x4'))?this[_0x3fef('0x6')](_0x3fef('0x4'))[_0x3fef('0x7')](''):[];}}}; \ No newline at end of file +var _0x7d25=['INTEGER','BOOLEAN','getDataValue','crudPermissions','split','exports','STRING'];(function(_0x50daa4,_0x3c336d){var _0x389935=function(_0x292d12){while(--_0x292d12){_0x50daa4['push'](_0x50daa4['shift']());}};_0x389935(++_0x3c336d);}(_0x7d25,0x8a));var _0x57d2=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x7d25[_0xe73080];return _0x12cbc4;};'use strict';var Sequelize=require('sequelize');module[_0x57d2('0x0')]={'name':{'type':Sequelize[_0x57d2('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x57d2('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x57d2('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x57d2('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x57d2('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x57d2('0x1')],'set':function(_0x5c1baa){this['setDataValue']('crudPermissions',_0x5c1baa?_0x5c1baa['join'](''):[]);},'get':function(){return this[_0x57d2('0x4')]('crudPermissions')?this[_0x57d2('0x4')](_0x57d2('0x5'))[_0x57d2('0x6')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 7381943..352d05c 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 _0x17e0=['offset','undefined','limit','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','json'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x17e0,0x118));var _0x017e=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x17e0[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x017e('0x0'));var zipdir=require(_0x017e('0x1'));var jsonpatch=require(_0x017e('0x2'));var rp=require(_0x017e('0x3'));var moment=require('moment');var BPromise=require(_0x017e('0x4'));var Mustache=require(_0x017e('0x5'));var util=require(_0x017e('0x6'));var path=require(_0x017e('0x7'));var sox=require(_0x017e('0x8'));var csv=require(_0x017e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x017e('0xa'));var _=require(_0x017e('0xb'));var squel=require(_0x017e('0xc'));var crypto=require('crypto');var jsforce=require(_0x017e('0xd'));var deskjs=require(_0x017e('0xe'));var toCsv=require(_0x017e('0x9'));var querystring=require(_0x017e('0xf'));var Papa=require('papaparse');var Redis=require(_0x017e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x017e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x017e('0x12'));var logger=require('../../config/logger')(_0x017e('0x13'));var utils=require(_0x017e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x017e('0x15'))['db'];function respondWithStatusCode(_0x4796fe,_0x235332){_0x235332=_0x235332||0xcc;return function(_0x38c436){if(_0x38c436){return _0x4796fe['sendStatus'](_0x235332);}return _0x4796fe['status'](_0x235332)[_0x017e('0x16')]();};}function respondWithResult(_0x183095,_0x4bbbfa){_0x4bbbfa=_0x4bbbfa||0xc8;return function(_0x57895c){if(_0x57895c){return _0x183095['status'](_0x4bbbfa)[_0x017e('0x17')](_0x57895c);}};}function respondWithFilteredResult(_0x2ca456,_0x40f07e){return function(_0x3674c7){if(_0x3674c7){var _0x449b5a=typeof _0x40f07e[_0x017e('0x18')]===_0x017e('0x19')&&typeof _0x40f07e[_0x017e('0x1a')]===_0x017e('0x19');var _0x58c3d0=_0x3674c7['count'];var _0x1836c4=_0x449b5a?0x0:_0x40f07e['offset'];var _0x33dd82=_0x449b5a?_0x3674c7['count']:_0x40f07e['offset']+_0x40f07e[_0x017e('0x1a')];var _0x3cc4cf;if(_0x33dd82>=_0x58c3d0){_0x33dd82=_0x58c3d0;_0x3cc4cf=0xc8;}else{_0x3cc4cf=0xce;}_0x2ca456[_0x017e('0x1b')](_0x3cc4cf);return _0x2ca456[_0x017e('0x1c')](_0x017e('0x1d'),_0x1836c4+'-'+_0x33dd82+'/'+_0x58c3d0)[_0x017e('0x17')](_0x3674c7);}return null;};}function patchUpdates(_0xa4131f){return function(_0x772f2d){try{jsonpatch[_0x017e('0x1e')](_0x772f2d,_0xa4131f,!![]);}catch(_0x240364){return BPromise['reject'](_0x240364);}return _0x772f2d[_0x017e('0x1f')]();};}function saveUpdates(_0x5a15a9,_0x37b016){return function(_0x468546){if(_0x468546){return _0x468546[_0x017e('0x20')](_0x5a15a9)[_0x017e('0x21')](function(_0x8167fb){return _0x8167fb;});}return null;};}function removeEntity(_0x1183a8,_0x23eac6){return function(_0x21ee21){if(_0x21ee21){return _0x21ee21[_0x017e('0x22')]()[_0x017e('0x21')](function(){_0x1183a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38bf85,_0x5cd67b){return function(_0xb8130d){if(!_0xb8130d){_0x38bf85[_0x017e('0x23')](0x194);}return _0xb8130d;};}function handleError(_0x341ceb,_0x707738){_0x707738=_0x707738||0x1f4;return function(_0x1f4568){logger[_0x017e('0x24')](_0x1f4568[_0x017e('0x25')]);if(_0x1f4568['name']){delete _0x1f4568[_0x017e('0x26')];}_0x341ceb[_0x017e('0x1b')](_0x707738)[_0x017e('0x27')](_0x1f4568);};}exports[_0x017e('0x28')]=function(_0x9f95b7,_0x3da4c5){var _0x185b74={},_0x225f04={},_0x53d059={'count':0x0,'rows':[]};var _0x231bdd=_[_0x017e('0x29')](db[_0x017e('0x2a')][_0x017e('0x2b')],function(_0x2b1a44){return{'name':_0x2b1a44[_0x017e('0x2c')],'type':_0x2b1a44[_0x017e('0x2d')][_0x017e('0x2e')]};});_0x225f04[_0x017e('0x2f')]=_['map'](_0x231bdd,_0x017e('0x26'));_0x225f04[_0x017e('0x30')]=_[_0x017e('0x31')](_0x9f95b7[_0x017e('0x30')]);_0x225f04['filters']=_[_0x017e('0x32')](_0x225f04[_0x017e('0x2f')],_0x225f04['query']);_0x185b74['attributes']=_[_0x017e('0x32')](_0x225f04['model'],qs[_0x017e('0x33')](_0x9f95b7[_0x017e('0x30')]['fields']));_0x185b74[_0x017e('0x34')]=_0x185b74['attributes'][_0x017e('0x35')]?_0x185b74[_0x017e('0x34')]:_0x225f04[_0x017e('0x2f')];if(!_0x9f95b7[_0x017e('0x30')][_0x017e('0x36')](_0x017e('0x37'))){_0x185b74[_0x017e('0x1a')]=qs['limit'](_0x9f95b7[_0x017e('0x30')][_0x017e('0x1a')]);_0x185b74[_0x017e('0x18')]=qs[_0x017e('0x18')](_0x9f95b7[_0x017e('0x30')][_0x017e('0x18')]);}_0x185b74[_0x017e('0x38')]=qs[_0x017e('0x39')](_0x9f95b7[_0x017e('0x30')]['sort']);_0x185b74[_0x017e('0x3a')]=qs[_0x017e('0x3b')](_[_0x017e('0x3c')](_0x9f95b7[_0x017e('0x30')],_0x225f04[_0x017e('0x3b')]),_0x231bdd);if(_0x9f95b7[_0x017e('0x30')]['filter']){_0x185b74['where']=_['merge'](_0x185b74[_0x017e('0x3a')],{'$or':_[_0x017e('0x29')](_0x231bdd,function(_0x13e8fe){if(_0x13e8fe[_0x017e('0x2d')]!=='VIRTUAL'){var _0x131542={};_0x131542[_0x13e8fe[_0x017e('0x26')]]={'$like':'%'+_0x9f95b7[_0x017e('0x30')][_0x017e('0x3d')]+'%'};return _0x131542;}})});}_0x185b74=_[_0x017e('0x3e')]({},_0x185b74,_0x9f95b7[_0x017e('0x3f')]);var _0x56c95f={'where':_0x185b74['where']};return db[_0x017e('0x2a')][_0x017e('0x40')](_0x56c95f)['then'](function(_0x39680b){_0x53d059[_0x017e('0x40')]=_0x39680b;if(_0x9f95b7[_0x017e('0x30')][_0x017e('0x41')]){_0x185b74[_0x017e('0x42')]=[{'all':!![]}];}return db[_0x017e('0x2a')][_0x017e('0x43')](_0x185b74);})[_0x017e('0x21')](function(_0x57f301){_0x53d059[_0x017e('0x44')]=_0x57f301;return _0x53d059;})[_0x017e('0x21')](respondWithFilteredResult(_0x3da4c5,_0x185b74))[_0x017e('0x45')](handleError(_0x3da4c5,null));};exports[_0x017e('0x46')]=function(_0x2b3d9e,_0x2b101e){var _0x406930={'raw':![],'where':{'id':_0x2b3d9e['params']['id']}},_0x1e6fdf={};_0x1e6fdf[_0x017e('0x2f')]=_[_0x017e('0x31')](db[_0x017e('0x2a')][_0x017e('0x2b')]);_0x1e6fdf[_0x017e('0x30')]=_[_0x017e('0x31')](_0x2b3d9e[_0x017e('0x30')]);_0x1e6fdf['filters']=_[_0x017e('0x32')](_0x1e6fdf[_0x017e('0x2f')],_0x1e6fdf[_0x017e('0x30')]);_0x406930[_0x017e('0x34')]=_['intersection'](_0x1e6fdf[_0x017e('0x2f')],qs[_0x017e('0x33')](_0x2b3d9e[_0x017e('0x30')][_0x017e('0x33')]));_0x406930['attributes']=_0x406930[_0x017e('0x34')][_0x017e('0x35')]?_0x406930[_0x017e('0x34')]:_0x1e6fdf[_0x017e('0x2f')];if(_0x2b3d9e[_0x017e('0x30')]['includeAll']){_0x406930['include']=[{'all':!![]}];}_0x406930=_[_0x017e('0x3e')]({},_0x406930,_0x2b3d9e[_0x017e('0x3f')]);return db['UserProfileSection'][_0x017e('0x47')](_0x406930)['then'](handleEntityNotFound(_0x2b101e,null))[_0x017e('0x21')](respondWithResult(_0x2b101e,null))[_0x017e('0x45')](handleError(_0x2b101e,null));};exports[_0x017e('0x48')]=function(_0x8fc0fe,_0x5d9fb6){return db['UserProfileSection'][_0x017e('0x48')](_0x8fc0fe[_0x017e('0x49')],{})['then'](respondWithResult(_0x5d9fb6,0xc9))[_0x017e('0x45')](handleError(_0x5d9fb6,null));};exports['update']=function(_0x1b81ca,_0x493b9d){if(_0x1b81ca[_0x017e('0x49')]['id']){delete _0x1b81ca[_0x017e('0x49')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x1b81ca[_0x017e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x493b9d,null))['then'](saveUpdates(_0x1b81ca[_0x017e('0x49')],null))[_0x017e('0x21')](respondWithResult(_0x493b9d,null))[_0x017e('0x45')](handleError(_0x493b9d,null));};exports[_0x017e('0x22')]=function(_0x5c96f6,_0x4f6006){return db['UserProfileSection'][_0x017e('0x47')]({'where':{'id':_0x5c96f6['params']['id']}})[_0x017e('0x21')](handleEntityNotFound(_0x4f6006,null))['then'](removeEntity(_0x4f6006,null))['catch'](handleError(_0x4f6006,null));};exports[_0x017e('0x4b')]=function(_0x19c5ee,_0x49b9f2){return db[_0x017e('0x2a')][_0x017e('0x4b')]()[_0x017e('0x21')](respondWithResult(_0x49b9f2,null))[_0x017e('0x45')](handleError(_0x49b9f2,null));}; \ No newline at end of file +var _0xc8cd=['filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','include','findAll','rows','catch','show','intersection','length','includeAll','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','UserProfileSection','rawAttributes','key','model','map','query','keys'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xc8cd,0x6b));var _0xdc8c=function(_0x292343,_0x305760){_0x292343=_0x292343-0x0;var _0x2e5b30=_0xc8cd[_0x292343];return _0x2e5b30;};'use strict';var emlformat=require(_0xdc8c('0x0'));var rimraf=require(_0xdc8c('0x1'));var zipdir=require(_0xdc8c('0x2'));var jsonpatch=require(_0xdc8c('0x3'));var rp=require(_0xdc8c('0x4'));var moment=require(_0xdc8c('0x5'));var BPromise=require(_0xdc8c('0x6'));var Mustache=require(_0xdc8c('0x7'));var util=require(_0xdc8c('0x8'));var path=require(_0xdc8c('0x9'));var sox=require(_0xdc8c('0xa'));var csv=require(_0xdc8c('0xb'));var ejs=require(_0xdc8c('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc8c('0xd'));var squel=require(_0xdc8c('0xe'));var crypto=require('crypto');var jsforce=require(_0xdc8c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdc8c('0xb'));var querystring=require('querystring');var Papa=require(_0xdc8c('0x10'));var Redis=require(_0xdc8c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc8c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc8c('0x13'));var logger=require(_0xdc8c('0x14'))(_0xdc8c('0x15'));var utils=require('../../config/utils');var config=require(_0xdc8c('0x16'));var licenseUtil=require(_0xdc8c('0x17'));var db=require(_0xdc8c('0x18'))['db'];function respondWithStatusCode(_0x487bed,_0x236e87){_0x236e87=_0x236e87||0xcc;return function(_0x25b2d1){if(_0x25b2d1){return _0x487bed['sendStatus'](_0x236e87);}return _0x487bed[_0xdc8c('0x19')](_0x236e87)[_0xdc8c('0x1a')]();};}function respondWithResult(_0x576c24,_0x23fa47){_0x23fa47=_0x23fa47||0xc8;return function(_0x3f16a2){if(_0x3f16a2){return _0x576c24[_0xdc8c('0x19')](_0x23fa47)['json'](_0x3f16a2);}};}function respondWithFilteredResult(_0x26e872,_0x3a4566){return function(_0x130393){if(_0x130393){var _0x544af8=typeof _0x3a4566[_0xdc8c('0x1b')]===_0xdc8c('0x1c')&&typeof _0x3a4566['limit']===_0xdc8c('0x1c');var _0x46a8be=_0x130393[_0xdc8c('0x1d')];var _0x9be78=_0x544af8?0x0:_0x3a4566[_0xdc8c('0x1b')];var _0x1f46de=_0x544af8?_0x130393[_0xdc8c('0x1d')]:_0x3a4566[_0xdc8c('0x1b')]+_0x3a4566[_0xdc8c('0x1e')];var _0x49a69b;if(_0x1f46de>=_0x46a8be){_0x1f46de=_0x46a8be;_0x49a69b=0xc8;}else{_0x49a69b=0xce;}_0x26e872['status'](_0x49a69b);return _0x26e872[_0xdc8c('0x1f')](_0xdc8c('0x20'),_0x9be78+'-'+_0x1f46de+'/'+_0x46a8be)[_0xdc8c('0x21')](_0x130393);}return null;};}function patchUpdates(_0x33d9a0){return function(_0x3d7409){try{jsonpatch[_0xdc8c('0x22')](_0x3d7409,_0x33d9a0,!![]);}catch(_0x4edab3){return BPromise[_0xdc8c('0x23')](_0x4edab3);}return _0x3d7409[_0xdc8c('0x24')]();};}function saveUpdates(_0xa8c611,_0x32d496){return function(_0x450d2c){if(_0x450d2c){return _0x450d2c[_0xdc8c('0x25')](_0xa8c611)['then'](function(_0x226d60){return _0x226d60;});}return null;};}function removeEntity(_0x27191b,_0x41846d){return function(_0x4967b1){if(_0x4967b1){return _0x4967b1[_0xdc8c('0x26')]()[_0xdc8c('0x27')](function(){_0x27191b[_0xdc8c('0x19')](0xcc)[_0xdc8c('0x1a')]();});}};}function handleEntityNotFound(_0x36bf62,_0x29339e){return function(_0x39fc50){if(!_0x39fc50){_0x36bf62[_0xdc8c('0x28')](0x194);}return _0x39fc50;};}function handleError(_0x49e611,_0x1e75bb){_0x1e75bb=_0x1e75bb||0x1f4;return function(_0x4b49a4){logger[_0xdc8c('0x29')](_0x4b49a4[_0xdc8c('0x2a')]);if(_0x4b49a4[_0xdc8c('0x2b')]){delete _0x4b49a4[_0xdc8c('0x2b')];}_0x49e611[_0xdc8c('0x19')](_0x1e75bb)[_0xdc8c('0x2c')](_0x4b49a4);};}exports[_0xdc8c('0x2d')]=function(_0x3feb39,_0x2fc6bb){var _0x34ae49={},_0x333dc4={},_0x300880={'count':0x0,'rows':[]};var _0x54bb4e=_['map'](db[_0xdc8c('0x2e')][_0xdc8c('0x2f')],function(_0x554748){return{'name':_0x554748['fieldName'],'type':_0x554748['type'][_0xdc8c('0x30')]};});_0x333dc4[_0xdc8c('0x31')]=_[_0xdc8c('0x32')](_0x54bb4e,_0xdc8c('0x2b'));_0x333dc4[_0xdc8c('0x33')]=_[_0xdc8c('0x34')](_0x3feb39['query']);_0x333dc4[_0xdc8c('0x35')]=_['intersection'](_0x333dc4[_0xdc8c('0x31')],_0x333dc4['query']);_0x34ae49[_0xdc8c('0x36')]=_['intersection'](_0x333dc4['model'],qs[_0xdc8c('0x37')](_0x3feb39['query']['fields']));_0x34ae49[_0xdc8c('0x36')]=_0x34ae49['attributes']['length']?_0x34ae49[_0xdc8c('0x36')]:_0x333dc4[_0xdc8c('0x31')];if(!_0x3feb39[_0xdc8c('0x33')][_0xdc8c('0x38')](_0xdc8c('0x39'))){_0x34ae49['limit']=qs['limit'](_0x3feb39[_0xdc8c('0x33')][_0xdc8c('0x1e')]);_0x34ae49[_0xdc8c('0x1b')]=qs[_0xdc8c('0x1b')](_0x3feb39[_0xdc8c('0x33')][_0xdc8c('0x1b')]);}_0x34ae49[_0xdc8c('0x3a')]=qs[_0xdc8c('0x3b')](_0x3feb39['query'][_0xdc8c('0x3b')]);_0x34ae49[_0xdc8c('0x3c')]=qs[_0xdc8c('0x35')](_[_0xdc8c('0x3d')](_0x3feb39[_0xdc8c('0x33')],_0x333dc4[_0xdc8c('0x35')]),_0x54bb4e);if(_0x3feb39['query']['filter']){_0x34ae49[_0xdc8c('0x3c')]=_[_0xdc8c('0x3e')](_0x34ae49[_0xdc8c('0x3c')],{'$or':_[_0xdc8c('0x32')](_0x54bb4e,function(_0x14dbbc){if(_0x14dbbc[_0xdc8c('0x3f')]!==_0xdc8c('0x40')){var _0x12f1c7={};_0x12f1c7[_0x14dbbc[_0xdc8c('0x2b')]]={'$like':'%'+_0x3feb39[_0xdc8c('0x33')][_0xdc8c('0x41')]+'%'};return _0x12f1c7;}})});}_0x34ae49=_['merge']({},_0x34ae49,_0x3feb39['options']);var _0x16e010={'where':_0x34ae49[_0xdc8c('0x3c')]};return db['UserProfileSection'][_0xdc8c('0x1d')](_0x16e010)[_0xdc8c('0x27')](function(_0x459a8b){_0x300880['count']=_0x459a8b;if(_0x3feb39[_0xdc8c('0x33')]['includeAll']){_0x34ae49[_0xdc8c('0x42')]=[{'all':!![]}];}return db[_0xdc8c('0x2e')][_0xdc8c('0x43')](_0x34ae49);})['then'](function(_0x42baf5){_0x300880[_0xdc8c('0x44')]=_0x42baf5;return _0x300880;})[_0xdc8c('0x27')](respondWithFilteredResult(_0x2fc6bb,_0x34ae49))[_0xdc8c('0x45')](handleError(_0x2fc6bb,null));};exports[_0xdc8c('0x46')]=function(_0x76823b,_0x5dde20){var _0x2df8d5={'raw':![],'where':{'id':_0x76823b['params']['id']}},_0x5f3c36={};_0x5f3c36[_0xdc8c('0x31')]=_[_0xdc8c('0x34')](db[_0xdc8c('0x2e')][_0xdc8c('0x2f')]);_0x5f3c36[_0xdc8c('0x33')]=_['keys'](_0x76823b[_0xdc8c('0x33')]);_0x5f3c36[_0xdc8c('0x35')]=_[_0xdc8c('0x47')](_0x5f3c36[_0xdc8c('0x31')],_0x5f3c36['query']);_0x2df8d5[_0xdc8c('0x36')]=_[_0xdc8c('0x47')](_0x5f3c36[_0xdc8c('0x31')],qs[_0xdc8c('0x37')](_0x76823b[_0xdc8c('0x33')]['fields']));_0x2df8d5[_0xdc8c('0x36')]=_0x2df8d5[_0xdc8c('0x36')][_0xdc8c('0x48')]?_0x2df8d5[_0xdc8c('0x36')]:_0x5f3c36['model'];if(_0x76823b[_0xdc8c('0x33')][_0xdc8c('0x49')]){_0x2df8d5[_0xdc8c('0x42')]=[{'all':!![]}];}_0x2df8d5=_['merge']({},_0x2df8d5,_0x76823b[_0xdc8c('0x4a')]);return db[_0xdc8c('0x2e')][_0xdc8c('0x4b')](_0x2df8d5)['then'](handleEntityNotFound(_0x5dde20,null))['then'](respondWithResult(_0x5dde20,null))[_0xdc8c('0x45')](handleError(_0x5dde20,null));};exports[_0xdc8c('0x4c')]=function(_0x2fee50,_0x4bf202){return db[_0xdc8c('0x2e')][_0xdc8c('0x4c')](_0x2fee50['body'],{})[_0xdc8c('0x27')](respondWithResult(_0x4bf202,0xc9))[_0xdc8c('0x45')](handleError(_0x4bf202,null));};exports['update']=function(_0x1d67bb,_0x2d2f00){if(_0x1d67bb[_0xdc8c('0x4d')]['id']){delete _0x1d67bb[_0xdc8c('0x4d')]['id'];}return db['UserProfileSection'][_0xdc8c('0x4b')]({'where':{'id':_0x1d67bb[_0xdc8c('0x4e')]['id']}})[_0xdc8c('0x27')](handleEntityNotFound(_0x2d2f00,null))[_0xdc8c('0x27')](saveUpdates(_0x1d67bb[_0xdc8c('0x4d')],null))[_0xdc8c('0x27')](respondWithResult(_0x2d2f00,null))[_0xdc8c('0x45')](handleError(_0x2d2f00,null));};exports[_0xdc8c('0x26')]=function(_0x45ee8b,_0x1f4e65){return db['UserProfileSection'][_0xdc8c('0x4b')]({'where':{'id':_0x45ee8b['params']['id']}})['then'](handleEntityNotFound(_0x1f4e65,null))[_0xdc8c('0x27')](removeEntity(_0x1f4e65,null))[_0xdc8c('0x45')](handleError(_0x1f4e65,null));};exports[_0xdc8c('0x4f')]=function(_0xd5a268,_0x43a45a){return db['UserProfileSection'][_0xdc8c('0x4f')]()[_0xdc8c('0x27')](respondWithResult(_0x43a45a,null))['catch'](handleError(_0x43a45a,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 89f9f04..1dfc18f 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 _0x56ad=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','compositeIndex','userProfileId'];(function(_0x49b59f,_0x1f3a28){var _0x46f0de=function(_0x3841f1){while(--_0x3841f1){_0x49b59f['push'](_0x49b59f['shift']());}};_0x46f0de(++_0x1f3a28);}(_0x56ad,0xb4));var _0xd56a=function(_0x3a81a6,_0x56b5d3){_0x3a81a6=_0x3a81a6-0x0;var _0x544ed6=_0x56ad[_0x3a81a6];return _0x544ed6;};'use strict';var _=require('lodash');var util=require(_0xd56a('0x0'));var logger=require(_0xd56a('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd56a('0x2'));var rp=require(_0xd56a('0x3'));var fs=require('fs');var path=require(_0xd56a('0x4'));var rimraf=require(_0xd56a('0x5'));var config=require(_0xd56a('0x6'));var attributes=require(_0xd56a('0x7'));module[_0xd56a('0x8')]=function(_0x3d01ee,_0x1acaf2){return _0x3d01ee[_0xd56a('0x9')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xd56a('0xa'),'fields':['sectionId',_0xd56a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d5e=['exports','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0x11a514,_0x2a0118){var _0x4ab9=function(_0x1bc23a){while(--_0x1bc23a){_0x11a514['push'](_0x11a514['shift']());}};_0x4ab9(++_0x2a0118);}(_0x8d5e,0xf6));var _0xe8d5=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x8d5e[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xe8d5('0x0'));var util=require(_0xe8d5('0x1'));var logger=require(_0xe8d5('0x2'))(_0xe8d5('0x3'));var moment=require(_0xe8d5('0x4'));var BPromise=require(_0xe8d5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe8d5('0x6'));var config=require(_0xe8d5('0x7'));var attributes=require(_0xe8d5('0x8'));module[_0xe8d5('0x9')]=function(_0x4cfc92,_0x4a77cb){return _0x4cfc92[_0xe8d5('0xa')](_0xe8d5('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xe8d5('0xc'),'fields':[_0xe8d5('0xd'),_0xe8d5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index c3c94e9..66c6fa3 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 _0xdf4e=['error','UserProfileSection,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x359fad,_0xbe6068){var _0x38e3f3=function(_0x4fa37d){while(--_0x4fa37d){_0x359fad['push'](_0x359fad['shift']());}};_0x38e3f3(++_0xbe6068);}(_0xdf4e,0x17a));var _0xedf4=function(_0x3b2244,_0x54873f){_0x3b2244=_0x3b2244-0x0;var _0x2dcc14=_0xdf4e[_0x3b2244];return _0x2dcc14;};'use strict';var _=require(_0xedf4('0x0'));var util=require(_0xedf4('0x1'));var moment=require(_0xedf4('0x2'));var BPromise=require(_0xedf4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedf4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xedf4('0x5'));var logger=require(_0xedf4('0x6'))(_0xedf4('0x7'));var config=require(_0xedf4('0x8'));var jayson=require(_0xedf4('0x9'));var client=jayson[_0xedf4('0xa')][_0xedf4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f6eb1,_0x5765fc,_0x36c1b4){return new BPromise(function(_0x57a83e,_0x488a55){return client[_0xedf4('0xc')](_0x2f6eb1,_0x36c1b4)[_0xedf4('0xd')](function(_0x536b28){logger[_0xedf4('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x5765fc,_0xedf4('0xf'));logger['debug'](_0xedf4('0x10'),_0x5765fc,_0xedf4('0xf'),JSON[_0xedf4('0x11')](_0x536b28));if(_0x536b28[_0xedf4('0x12')]){if(_0x536b28['error']['code']===0x1f4){logger['error'](_0xedf4('0x13'),_0x5765fc,_0x536b28[_0xedf4('0x12')][_0xedf4('0x14')]);return _0x488a55(_0x536b28['error'][_0xedf4('0x14')]);}logger[_0xedf4('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x5765fc,_0x536b28[_0xedf4('0x12')][_0xedf4('0x14')]);return _0x57a83e(_0x536b28[_0xedf4('0x12')][_0xedf4('0x14')]);}else{logger[_0xedf4('0xe')](_0xedf4('0x13'),_0x5765fc,_0xedf4('0xf'));_0x57a83e(_0x536b28[_0xedf4('0x15')]['message']);}})['catch'](function(_0x10efdb){logger[_0xedf4('0x12')](_0xedf4('0x13'),_0x5765fc,_0x10efdb);_0x488a55(_0x10efdb);});});} \ No newline at end of file +var _0xed52=['UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','UserProfileSection,\x20%s,\x20%s','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xed52,0x16e));var _0x2ed5=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xed52[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require(_0x2ed5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2ed5('0x1'));var fs=require('fs');var Redis=require(_0x2ed5('0x2'));var db=require(_0x2ed5('0x3'))['db'];var utils=require(_0x2ed5('0x4'));var logger=require(_0x2ed5('0x5'))(_0x2ed5('0x6'));var config=require(_0x2ed5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2ed5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7e3abc,_0x53df04,_0x17b22d){return new BPromise(function(_0x5ce7a1,_0x2c274b){return client[_0x2ed5('0x9')](_0x7e3abc,_0x17b22d)[_0x2ed5('0xa')](function(_0x830a32){logger[_0x2ed5('0xb')](_0x2ed5('0xc'),_0x53df04,'request\x20sent');logger[_0x2ed5('0xd')](_0x2ed5('0xe'),_0x53df04,_0x2ed5('0xf'),JSON['stringify'](_0x830a32));if(_0x830a32['error']){if(_0x830a32['error']['code']===0x1f4){logger[_0x2ed5('0x10')](_0x2ed5('0xc'),_0x53df04,_0x830a32[_0x2ed5('0x10')][_0x2ed5('0x11')]);return _0x2c274b(_0x830a32[_0x2ed5('0x10')][_0x2ed5('0x11')]);}logger[_0x2ed5('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x53df04,_0x830a32[_0x2ed5('0x10')][_0x2ed5('0x11')]);return _0x5ce7a1(_0x830a32[_0x2ed5('0x10')][_0x2ed5('0x11')]);}else{logger[_0x2ed5('0xb')](_0x2ed5('0xc'),_0x53df04,_0x2ed5('0xf'));_0x5ce7a1(_0x830a32[_0x2ed5('0x12')][_0x2ed5('0x11')]);}})[_0x2ed5('0x13')](function(_0x328836){logger['error'](_0x2ed5('0xc'),_0x53df04,_0x328836);_0x2c274b(_0x328836);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 0294587..aa3e7f6 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(_0x1342d7,_0x18e439){var _0x30a883=function(_0x429a55){while(--_0x429a55){_0x1342d7['push'](_0x1342d7['shift']());}};_0x30a883(++_0x18e439);}(_0xe706,0xa3));var _0x6e70=function(_0x1cdabe,_0x286194){_0x1cdabe=_0x1cdabe-0x0;var _0x3dcc9c=_0xe706[_0x1cdabe];return _0x3dcc9c;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x40e83f,_0x4f467a){var _0x17207f=function(_0xbeb1f0){while(--_0xbeb1f0){_0x40e83f['push'](_0x40e83f['shift']());}};_0x17207f(++_0x4f467a);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 715006b..51ed1cc 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 _0x7f24=['sequelize','INTEGER'];(function(_0x4c06cc,_0x506d79){var _0x19350a=function(_0x23b92c){while(--_0x23b92c){_0x4c06cc['push'](_0x4c06cc['shift']());}};_0x19350a(++_0x506d79);}(_0x7f24,0x16a));var _0x47f2=function(_0x8a2dae,_0x2a21a7){_0x8a2dae=_0x8a2dae-0x0;var _0x308f20=_0x7f24[_0x8a2dae];return _0x308f20;};'use strict';var Sequelize=require(_0x47f2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x47f2('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbcc3=['exports'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xbcc3,0xab));var _0x3bcc=function(_0x4d3d50,_0x50f156){_0x4d3d50=_0x4d3d50-0x0;var _0x175e6d=_0xbcc3[_0x4d3d50];return _0x175e6d;};'use strict';var Sequelize=require('sequelize');module[_0x3bcc('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 9afe5bd..c92874a 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 _0x50e5=['user_has_sms_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define'];(function(_0x2805cb,_0x449d53){var _0x1a1724=function(_0x732635){while(--_0x732635){_0x2805cb['push'](_0x2805cb['shift']());}};_0x1a1724(++_0x449d53);}(_0x50e5,0xb7));var _0x550e=function(_0x43ed19,_0x537ea4){_0x43ed19=_0x43ed19-0x0;var _0x2126f6=_0x50e5[_0x43ed19];return _0x2126f6;};'use strict';var _=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var logger=require('../../config/logger')(_0x550e('0x2'));var moment=require(_0x550e('0x3'));var BPromise=require(_0x550e('0x4'));var rp=require(_0x550e('0x5'));var fs=require('fs');var path=require(_0x550e('0x6'));var rimraf=require(_0x550e('0x7'));var config=require(_0x550e('0x8'));var attributes=require(_0x550e('0x9'));module[_0x550e('0xa')]=function(_0x3d8c9b,_0x863e3b){return _0x3d8c9b[_0x550e('0xb')]('UserSmsQueue',attributes,{'tableName':_0x550e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36c3=['define','UserSmsQueue','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1a67f5,_0x4ddb60){var _0x38cf1c=function(_0x2fa54c){while(--_0x2fa54c){_0x1a67f5['push'](_0x1a67f5['shift']());}};_0x38cf1c(++_0x4ddb60);}(_0x36c3,0x1a6));var _0x336c=function(_0x325507,_0x1968ab){_0x325507=_0x325507-0x0;var _0x1a5253=_0x36c3[_0x325507];return _0x1a5253;};'use strict';var _=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var logger=require('../../config/logger')(_0x336c('0x2'));var moment=require(_0x336c('0x3'));var BPromise=require(_0x336c('0x4'));var rp=require(_0x336c('0x5'));var fs=require('fs');var path=require(_0x336c('0x6'));var rimraf=require(_0x336c('0x7'));var config=require(_0x336c('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x336c('0x9')]=function(_0x2e0016,_0x2097a8){return _0x2e0016[_0x336c('0xa')](_0x336c('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 1497477..e29b435 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 _0x9bf9=['moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x3c3530,_0x374b49){var _0x1e3374=function(_0x31fe72){while(--_0x31fe72){_0x3c3530['push'](_0x3c3530['shift']());}};_0x1e3374(++_0x374b49);}(_0x9bf9,0x1a3));var _0x99bf=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x9bf9[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x99bf('0x0'));var util=require('util');var moment=require(_0x99bf('0x1'));var BPromise=require('bluebird');var rs=require(_0x99bf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x99bf('0x3'))(_0x99bf('0x4'));var config=require(_0x99bf('0x5'));var jayson=require(_0x99bf('0x6'));var client=jayson[_0x99bf('0x7')][_0x99bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x188537,_0x2ec35f,_0xfef775){return new BPromise(function(_0x49efa6,_0x157bed){return client[_0x99bf('0x9')](_0x188537,_0xfef775)[_0x99bf('0xa')](function(_0x377e0b){logger[_0x99bf('0xb')](_0x99bf('0xc'),_0x2ec35f,_0x99bf('0xd'));logger[_0x99bf('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2ec35f,_0x99bf('0xd'),JSON[_0x99bf('0xf')](_0x377e0b));if(_0x377e0b['error']){if(_0x377e0b['error']['code']===0x1f4){logger[_0x99bf('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x2ec35f,_0x377e0b[_0x99bf('0x10')][_0x99bf('0x11')]);return _0x157bed(_0x377e0b[_0x99bf('0x10')][_0x99bf('0x11')]);}logger[_0x99bf('0x10')](_0x99bf('0xc'),_0x2ec35f,_0x377e0b[_0x99bf('0x10')][_0x99bf('0x11')]);return _0x49efa6(_0x377e0b[_0x99bf('0x10')]['message']);}else{logger[_0x99bf('0xb')](_0x99bf('0xc'),_0x2ec35f,_0x99bf('0xd'));_0x49efa6(_0x377e0b[_0x99bf('0x12')][_0x99bf('0x11')]);}})[_0x99bf('0x13')](function(_0x133251){logger[_0x99bf('0x10')](_0x99bf('0xc'),_0x2ec35f,_0x133251);_0x157bed(_0x133251);});});} \ No newline at end of file +var _0xe2f8=['code','message','result','catch','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x42a5e4,_0x2ccfb6){var _0xd56657=function(_0x528265){while(--_0x528265){_0x42a5e4['push'](_0x42a5e4['shift']());}};_0xd56657(++_0x2ccfb6);}(_0xe2f8,0x16c));var _0x8e2f=function(_0x211374,_0x1fe87e){_0x211374=_0x211374-0x0;var _0x7fa2c3=_0xe2f8[_0x211374];return _0x7fa2c3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8e2f('0x0'));var BPromise=require('bluebird');var rs=require(_0x8e2f('0x1'));var fs=require('fs');var Redis=require(_0x8e2f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e2f('0x3'));var logger=require('../../config/logger')(_0x8e2f('0x4'));var config=require(_0x8e2f('0x5'));var jayson=require(_0x8e2f('0x6'));var client=jayson['client'][_0x8e2f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xdb958b,_0x4298f9,_0x35ef66){return new BPromise(function(_0x105cc4,_0x3ba4d2){return client[_0x8e2f('0x8')](_0xdb958b,_0x35ef66)['then'](function(_0x228e19){logger[_0x8e2f('0x9')](_0x8e2f('0xa'),_0x4298f9,_0x8e2f('0xb'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4298f9,_0x8e2f('0xb'),JSON[_0x8e2f('0xc')](_0x228e19));if(_0x228e19[_0x8e2f('0xd')]){if(_0x228e19[_0x8e2f('0xd')][_0x8e2f('0xe')]===0x1f4){logger[_0x8e2f('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x4298f9,_0x228e19[_0x8e2f('0xd')]['message']);return _0x3ba4d2(_0x228e19[_0x8e2f('0xd')][_0x8e2f('0xf')]);}logger[_0x8e2f('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x4298f9,_0x228e19[_0x8e2f('0xd')][_0x8e2f('0xf')]);return _0x105cc4(_0x228e19[_0x8e2f('0xd')][_0x8e2f('0xf')]);}else{logger[_0x8e2f('0x9')]('UserSmsQueue,\x20%s,\x20%s',_0x4298f9,_0x8e2f('0xb'));_0x105cc4(_0x228e19[_0x8e2f('0x10')]['message']);}})[_0x8e2f('0x11')](function(_0x24c331){logger[_0x8e2f('0xd')](_0x8e2f('0xa'),_0x4298f9,_0x24c331);_0x3ba4d2(_0x24c331);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 107a0b7..87b6959 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 _0x9da6=['exports','INTEGER','sequelize'];(function(_0x4b1fe2,_0x57d65f){var _0x1f438e=function(_0x24c689){while(--_0x24c689){_0x4b1fe2['push'](_0x4b1fe2['shift']());}};_0x1f438e(++_0x57d65f);}(_0x9da6,0x1e5));var _0x69da=function(_0x53faa2,_0x4e3c94){_0x53faa2=_0x53faa2-0x0;var _0x5e33c8=_0x9da6[_0x53faa2];return _0x5e33c8;};'use strict';var Sequelize=require(_0x69da('0x0'));module[_0x69da('0x1')]={'UserId':{'type':Sequelize[_0x69da('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x69da('0x2')]}}; \ No newline at end of file +var _0xf882=['INTEGER','sequelize','exports'];(function(_0x23d77b,_0x4e95af){var _0x4e15d5=function(_0x3da02b){while(--_0x3da02b){_0x23d77b['push'](_0x23d77b['shift']());}};_0x4e15d5(++_0x4e95af);}(_0xf882,0x7c));var _0x2f88=function(_0x179afa,_0x47cde1){_0x179afa=_0x179afa-0x0;var _0x17f148=_0xf882[_0x179afa];return _0x17f148;};'use strict';var Sequelize=require(_0x2f88('0x0'));module[_0x2f88('0x1')]={'UserId':{'type':Sequelize[_0x2f88('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x2f88('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 01c07a7..b2f836d 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(_0x25c2ba,_0x429385){var _0x5aa947=function(_0x215aeb){while(--_0x215aeb){_0x25c2ba['push'](_0x25c2ba['shift']());}};_0x5aa947(++_0x429385);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x595959,_0x5ae18b){var _0x4ab3b5=function(_0x3b5075){while(--_0x3b5075){_0x595959['push'](_0x595959['shift']());}};_0x4ab3b5(++_0x5ae18b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 4725327..288cb47 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(_0x54ba9d,_0x3adcce){var _0x37c24e=function(_0x49f896){while(--_0x49f896){_0x54ba9d['push'](_0x54ba9d['shift']());}};_0x37c24e(++_0x3adcce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x429b04,_0x17e6e0){var _0x5d333b=function(_0x1b6d66){while(--_0x1b6d66){_0x429b04['push'](_0x429b04['shift']());}};_0x5d333b(++_0x17e6e0);}(_0xedd9,0xfc));var _0x9edd=function(_0x1f3508,_0x32f494){_0x1f3508=_0x1f3508-0x0;var _0x1b602c=_0xedd9[_0x1f3508];return _0x1b602c;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 47eb289..0c49758 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 _0x4f8f=['exports'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x4f8f,0x90));var _0xf4f8=function(_0x49aba9,_0x429e1e){_0x49aba9=_0x49aba9-0x0;var _0x987361=_0x4f8f[_0x49aba9];return _0x987361;};'use strict';var Sequelize=require('sequelize');module[_0xf4f8('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7c84=['INTEGER'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0x7c84,0xce));var _0x47c8=function(_0x64fa44,_0x3ba83f){_0x64fa44=_0x64fa44-0x0;var _0x4faca4=_0x7c84[_0x64fa44];return _0x4faca4;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x47c8('0x0')],'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 da26f41..3dccc6a 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 _0x999c=['../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','util','../../config/logger','api','path','rimraf'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x999c,0x16c));var _0xc999=function(_0x3bb00e,_0x825c75){_0x3bb00e=_0x3bb00e-0x0;var _0x1e17fe=_0x999c[_0x3bb00e];return _0x1e17fe;};'use strict';var _=require('lodash');var util=require(_0xc999('0x0'));var logger=require(_0xc999('0x1'))(_0xc999('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc999('0x3'));var rimraf=require(_0xc999('0x4'));var config=require(_0xc999('0x5'));var attributes=require(_0xc999('0x6'));module['exports']=function(_0x4e2659,_0x5987a0){return _0x4e2659[_0xc999('0x7')](_0xc999('0x8'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0de=['rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','bluebird','request-promise'];(function(_0x3de502,_0xb4e3b3){var _0x1ab93f=function(_0x2a0497){while(--_0x2a0497){_0x3de502['push'](_0x3de502['shift']());}};_0x1ab93f(++_0xb4e3b3);}(_0xd0de,0xd8));var _0xed0d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd0de[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xed0d('0x0'));var util=require(_0xed0d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xed0d('0x2'));var rp=require(_0xed0d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed0d('0x4'));var config=require(_0xed0d('0x5'));var attributes=require('./userVoiceQueue.attributes');module[_0xed0d('0x6')]=function(_0x592621,_0x2e2304){return _0x592621[_0xed0d('0x7')](_0xed0d('0x8'),attributes,{'tableName':_0xed0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 87283d5..a78c9e5 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 _0x29f2=['error','code','message','request\x20sent','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x29f2,0x102));var _0x229f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x229f('0x0'));var util=require(_0x229f('0x1'));var moment=require('moment');var BPromise=require(_0x229f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x229f('0x3'))['db'];var utils=require(_0x229f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x229f('0x5'));var jayson=require(_0x229f('0x6'));var client=jayson[_0x229f('0x7')][_0x229f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a6fec,_0xda2bf0,_0x23b4ab){return new BPromise(function(_0x54a835,_0x4cdb3c){return client['request'](_0x4a6fec,_0x23b4ab)[_0x229f('0x9')](function(_0x43a525){logger[_0x229f('0xa')](_0x229f('0xb'),_0xda2bf0,'request\x20sent');logger[_0x229f('0xc')](_0x229f('0xd'),_0xda2bf0,'request\x20sent',JSON[_0x229f('0xe')](_0x43a525));if(_0x43a525[_0x229f('0xf')]){if(_0x43a525[_0x229f('0xf')][_0x229f('0x10')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0xda2bf0,_0x43a525['error'][_0x229f('0x11')]);return _0x4cdb3c(_0x43a525['error'][_0x229f('0x11')]);}logger['error'](_0x229f('0xb'),_0xda2bf0,_0x43a525['error']['message']);return _0x54a835(_0x43a525['error'][_0x229f('0x11')]);}else{logger[_0x229f('0xa')](_0x229f('0xb'),_0xda2bf0,_0x229f('0x12'));_0x54a835(_0x43a525[_0x229f('0x13')][_0x229f('0x11')]);}})[_0x229f('0x14')](function(_0x23d6d3){logger[_0x229f('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0xda2bf0,_0x23d6d3);_0x4cdb3c(_0x23d6d3);});});} \ No newline at end of file +var _0xa9ba=['http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','client'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0xa9ba,0x161));var _0xaa9b=function(_0x59f0ee,_0x2eff89){_0x59f0ee=_0x59f0ee-0x0;var _0x2ff76a=_0xa9ba[_0x59f0ee];return _0x2ff76a;};'use strict';var _=require(_0xaa9b('0x0'));var util=require(_0xaa9b('0x1'));var moment=require(_0xaa9b('0x2'));var BPromise=require(_0xaa9b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaa9b('0x4'))(_0xaa9b('0x5'));var config=require(_0xaa9b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaa9b('0x7')][_0xaa9b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x402ffb,_0x48f8a1,_0x1f5d61){return new BPromise(function(_0x4778f7,_0x12b9ab){return client[_0xaa9b('0x9')](_0x402ffb,_0x1f5d61)[_0xaa9b('0xa')](function(_0x1ff335){logger['info'](_0xaa9b('0xb'),_0x48f8a1,_0xaa9b('0xc'));logger[_0xaa9b('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x48f8a1,_0xaa9b('0xc'),JSON['stringify'](_0x1ff335));if(_0x1ff335[_0xaa9b('0xe')]){if(_0x1ff335['error'][_0xaa9b('0xf')]===0x1f4){logger[_0xaa9b('0xe')](_0xaa9b('0xb'),_0x48f8a1,_0x1ff335[_0xaa9b('0xe')]['message']);return _0x12b9ab(_0x1ff335[_0xaa9b('0xe')][_0xaa9b('0x10')]);}logger[_0xaa9b('0xe')](_0xaa9b('0xb'),_0x48f8a1,_0x1ff335[_0xaa9b('0xe')][_0xaa9b('0x10')]);return _0x4778f7(_0x1ff335[_0xaa9b('0xe')][_0xaa9b('0x10')]);}else{logger[_0xaa9b('0x11')](_0xaa9b('0xb'),_0x48f8a1,_0xaa9b('0xc'));_0x4778f7(_0x1ff335['result'][_0xaa9b('0x10')]);}})[_0xaa9b('0x12')](function(_0x33bc6a){logger[_0xaa9b('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x48f8a1,_0x33bc6a);_0x12b9ab(_0x33bc6a);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f04082c..6c845a8 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4f4715,_0x3cb040){var _0x471eb3=function(_0x2dc636){while(--_0x2dc636){_0x4f4715['push'](_0x4f4715['shift']());}};_0x471eb3(++_0x3cb040);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x3ebd04,_0x180d45){var _0x391527=function(_0x18a821){while(--_0x18a821){_0x3ebd04['push'](_0x3ebd04['shift']());}};_0x391527(++_0x180d45);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 54fbafe..d8a9550 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 _0x8d88=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x1ee10a,_0x1ecc44){var _0x4bb4b4=function(_0x4b28ef){while(--_0x4b28ef){_0x1ee10a['push'](_0x1ee10a['shift']());}};_0x4bb4b4(++_0x1ecc44);}(_0x8d88,0x1be));var _0x88d8=function(_0x1bfec9,_0x2a863a){_0x1bfec9=_0x1bfec9-0x0;var _0x35cb18=_0x8d88[_0x1bfec9];return _0x35cb18;};'use strict';var Sequelize=require(_0x88d8('0x0'));module[_0x88d8('0x1')]={'uniqueid':{'type':Sequelize[_0x88d8('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x88d8('0x3')},'membername':{'type':Sequelize[_0x88d8('0x4')],'allowNull':![],'comment':_0x88d8('0x3')},'UserId':{'type':Sequelize[_0x88d8('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x88d8('0x4')],'allowNull':![],'unique':_0x88d8('0x5'),'comment':_0x88d8('0x3')},'VoiceQueueId':{'type':Sequelize[_0x88d8('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x88d8('0x4')],'allowNull':![],'unique':_0x88d8('0x5'),'comment':_0x88d8('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x88d8('0x3')}}; \ No newline at end of file +var _0xb0f2=['STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','INTEGER'];(function(_0x17c489,_0x4ddbd4){var _0x2c67d0=function(_0x33392a){while(--_0x33392a){_0x17c489['push'](_0x17c489['shift']());}};_0x2c67d0(++_0x4ddbd4);}(_0xb0f2,0xcb));var _0x2b0f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb0f2[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x2b0f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x2b0f('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x2b0f('0x2')],'allowNull':![],'comment':_0x2b0f('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2b0f('0x2')],'allowNull':![],'unique':_0x2b0f('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x2b0f('0x2')],'allowNull':![],'unique':_0x2b0f('0x4'),'comment':_0x2b0f('0x3')},'penalty':{'type':Sequelize[_0x2b0f('0x1')](0xb),'defaultValue':0x0,'comment':_0x2b0f('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index c08c414..dfb9535 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 _0x4e22=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x554296,_0x404cc5){var _0x5d9fe7=function(_0x255627){while(--_0x255627){_0x554296['push'](_0x554296['shift']());}};_0x5d9fe7(++_0x404cc5);}(_0x4e22,0x11f));var _0x24e2=function(_0x1a78b4,_0x22e8f4){_0x1a78b4=_0x1a78b4-0x0;var _0x55a28a=_0x4e22[_0x1a78b4];return _0x55a28a;};'use strict';var EventEmitter=require(_0x24e2('0x0'));var UserVoiceQueueRt=require(_0x24e2('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x24e2('0x2')](0x0);var events={'afterCreate':_0x24e2('0x3'),'afterUpdate':_0x24e2('0x4'),'afterDestroy':_0x24e2('0x5')};function emitEvent(_0x594a6c){return function(_0x20d841,_0x262273,_0x3740c9){UserVoiceQueueRtEvents[_0x24e2('0x6')](_0x594a6c+':'+_0x20d841['id'],_0x20d841);UserVoiceQueueRtEvents[_0x24e2('0x6')](_0x594a6c,_0x20d841);_0x3740c9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x24e2('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xe153=['update','remove','emit','hook','exports','../../mysqldb','UserVoiceQueueRt','save'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xe153,0x165));var _0x3e15=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xe153[_0x1e4360];return _0x31e6b4;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x3e15('0x0'))['db'][_0x3e15('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3e15('0x2'),'afterUpdate':_0x3e15('0x3'),'afterDestroy':_0x3e15('0x4')};function emitEvent(_0x331f21){return function(_0x4a031e,_0x10f807,_0x23ce9e){UserVoiceQueueRtEvents[_0x3e15('0x5')](_0x331f21+':'+_0x4a031e['id'],_0x4a031e);UserVoiceQueueRtEvents['emit'](_0x331f21,_0x4a031e);_0x23ce9e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x3e15('0x6')](e,emitEvent(event));}}module[_0x3e15('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 994c617..cebb841 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 _0xa231=['./userVoiceQueueRt.attributes','define','user_has_voice_queues_rt','util','api','moment','request-promise','../../config/environment'];(function(_0x550575,_0x3d19da){var _0x1f148f=function(_0xedc217){while(--_0xedc217){_0x550575['push'](_0x550575['shift']());}};_0x1f148f(++_0x3d19da);}(_0xa231,0x6b));var _0x1a23=function(_0x13fe35,_0x537cee){_0x13fe35=_0x13fe35-0x0;var _0x4875a8=_0xa231[_0x13fe35];return _0x4875a8;};'use strict';var _=require('lodash');var util=require(_0x1a23('0x0'));var logger=require('../../config/logger')(_0x1a23('0x1'));var moment=require(_0x1a23('0x2'));var BPromise=require('bluebird');var rp=require(_0x1a23('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a23('0x4'));var attributes=require(_0x1a23('0x5'));module['exports']=function(_0x341c97,_0x5639f5){return _0x341c97[_0x1a23('0x6')]('UserVoiceQueueRt',attributes,{'tableName':_0x1a23('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a8c=['./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x305272,_0x19a527){var _0x43fdf1=function(_0x4ed1d4){while(--_0x4ed1d4){_0x305272['push'](_0x305272['shift']());}};_0x43fdf1(++_0x19a527);}(_0x2a8c,0x1d7));var _0xc2a8=function(_0x4d2f92,_0x4cd25d){_0x4d2f92=_0x4d2f92-0x0;var _0x2640b8=_0x2a8c[_0x4d2f92];return _0x2640b8;};'use strict';var _=require(_0xc2a8('0x0'));var util=require(_0xc2a8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc2a8('0x2'));var rp=require(_0xc2a8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc2a8('0x4'));var config=require(_0xc2a8('0x5'));var attributes=require(_0xc2a8('0x6'));module['exports']=function(_0x53d45a,_0x5af502){return _0x53d45a[_0xc2a8('0x7')](_0xc2a8('0x8'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 78b1c7b..b23c314 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 _0x1d8b=['GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message'];(function(_0x2dda1a,_0x1d9ba8){var _0x33dacb=function(_0x333139){while(--_0x333139){_0x2dda1a['push'](_0x2dda1a['shift']());}};_0x33dacb(++_0x1d9ba8);}(_0x1d8b,0x1b0));var _0xb1d8=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x1d8b[_0x934425];return _0x31d596;};'use strict';var _=require('lodash');var util=require(_0xb1d8('0x0'));var moment=require('moment');var BPromise=require(_0xb1d8('0x1'));var rs=require(_0xb1d8('0x2'));var fs=require('fs');var Redis=require(_0xb1d8('0x3'));var db=require(_0xb1d8('0x4'))['db'];var utils=require(_0xb1d8('0x5'));var logger=require(_0xb1d8('0x6'))(_0xb1d8('0x7'));var config=require('../../config/environment');var jayson=require(_0xb1d8('0x8'));var client=jayson[_0xb1d8('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xb1d8('0xa'),'port':0x18eb});var socket=require(_0xb1d8('0xb'))(new Redis(config['redis']));require(_0xb1d8('0xc'))[_0xb1d8('0xd')](socket);function respondWithRpcPromise(_0x34b54b,_0x378f41,_0x57b7bc){return new BPromise(function(_0x295485,_0x2d9f6f){return client['request'](_0x34b54b,_0x57b7bc)[_0xb1d8('0xe')](function(_0x516d8d){logger[_0xb1d8('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x378f41,_0xb1d8('0x10'));logger['debug'](_0xb1d8('0x11'),_0x378f41,_0xb1d8('0x10'),JSON[_0xb1d8('0x12')](_0x516d8d));if(_0x516d8d['error']){if(_0x516d8d[_0xb1d8('0x13')][_0xb1d8('0x14')]===0x1f4){logger[_0xb1d8('0x13')](_0xb1d8('0x15'),_0x378f41,_0x516d8d[_0xb1d8('0x13')][_0xb1d8('0x16')]);return _0x2d9f6f(_0x516d8d['error'][_0xb1d8('0x16')]);}logger[_0xb1d8('0x13')](_0xb1d8('0x15'),_0x378f41,_0x516d8d[_0xb1d8('0x13')][_0xb1d8('0x16')]);return _0x295485(_0x516d8d[_0xb1d8('0x13')]['message']);}else{logger[_0xb1d8('0xf')](_0xb1d8('0x15'),_0x378f41,_0xb1d8('0x10'));_0x295485(_0x516d8d['result'][_0xb1d8('0x16')]);}})['catch'](function(_0x351cb8){logger[_0xb1d8('0x13')](_0xb1d8('0x15'),_0x378f41,_0x351cb8);_0x2d9f6f(_0x351cb8);});});}exports[_0xb1d8('0x17')]=function(_0x3fef88){var _0x554c4f=this;return new Promise(function(_0x56bd60,_0x56ebaf){return db[_0xb1d8('0x18')][_0xb1d8('0x19')]({'raw':_0x3fef88[_0xb1d8('0x1a')]?_0x3fef88[_0xb1d8('0x1a')][_0xb1d8('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fef88['options']?_0x3fef88[_0xb1d8('0x1a')][_0xb1d8('0x1c')]||null:null,'attributes':[[db[_0xb1d8('0x1d')]['fn'](_0xb1d8('0x1e'),db['sequelize']['fn']('IF',db[_0xb1d8('0x1d')]['literal'](_0xb1d8('0x1f')))),_0xb1d8('0x20')]]})[_0xb1d8('0xe')](function(_0x4ff1d1){logger[_0xb1d8('0xf')](_0xb1d8('0x17'),_0x3fef88);logger[_0xb1d8('0x21')](_0xb1d8('0x17'),_0x3fef88,JSON[_0xb1d8('0x12')](_0x4ff1d1));_0x56bd60(_0x4ff1d1);})[_0xb1d8('0x22')](function(_0x457957){logger[_0xb1d8('0x13')](_0xb1d8('0x17'),_0x457957[_0xb1d8('0x16')],_0x3fef88);_0x56ebaf(_0x554c4f[_0xb1d8('0x13')](0x1f4,_0x457957[_0xb1d8('0x16')]));});});}; \ No newline at end of file +var _0x09e3=['result','catch','UserVoiceQueueRt','options','raw','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','request\x20sent'];(function(_0x1bdc8a,_0x53ddd8){var _0x26b420=function(_0x14045f){while(--_0x14045f){_0x1bdc8a['push'](_0x1bdc8a['shift']());}};_0x26b420(++_0x53ddd8);}(_0x09e3,0x181));var _0x309e=function(_0x11e26c,_0x1a95b2){_0x11e26c=_0x11e26c-0x0;var _0x383636=_0x09e3[_0x11e26c];return _0x383636;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x309e('0x0'));var BPromise=require('bluebird');var rs=require(_0x309e('0x1'));var fs=require('fs');var Redis=require(_0x309e('0x2'));var db=require(_0x309e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x309e('0x4'));var config=require(_0x309e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x309e('0x6')][_0x309e('0x7')]({'port':0x232a});config[_0x309e('0x8')]=_['defaults'](config[_0x309e('0x8')],{'host':_0x309e('0x9'),'port':0x18eb});var socket=require(_0x309e('0xa'))(new Redis(config[_0x309e('0x8')]));require(_0x309e('0xb'))[_0x309e('0xc')](socket);function respondWithRpcPromise(_0x31698b,_0x15009b,_0x31c64f){return new BPromise(function(_0x5d7c15,_0x365069){return client[_0x309e('0xd')](_0x31698b,_0x31c64f)['then'](function(_0x2a5b83){logger[_0x309e('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x15009b,'request\x20sent');logger[_0x309e('0xf')](_0x309e('0x10'),_0x15009b,'request\x20sent',JSON[_0x309e('0x11')](_0x2a5b83));if(_0x2a5b83[_0x309e('0x12')]){if(_0x2a5b83['error'][_0x309e('0x13')]===0x1f4){logger[_0x309e('0x12')](_0x309e('0x14'),_0x15009b,_0x2a5b83[_0x309e('0x12')][_0x309e('0x15')]);return _0x365069(_0x2a5b83[_0x309e('0x12')][_0x309e('0x15')]);}logger[_0x309e('0x12')](_0x309e('0x14'),_0x15009b,_0x2a5b83[_0x309e('0x12')][_0x309e('0x15')]);return _0x5d7c15(_0x2a5b83[_0x309e('0x12')][_0x309e('0x15')]);}else{logger[_0x309e('0xe')](_0x309e('0x14'),_0x15009b,_0x309e('0x16'));_0x5d7c15(_0x2a5b83[_0x309e('0x17')]['message']);}})[_0x309e('0x18')](function(_0x159a4f){logger[_0x309e('0x12')](_0x309e('0x14'),_0x15009b,_0x159a4f);_0x365069(_0x159a4f);});});}exports['GetVoiceQueueRtPauses']=function(_0x119d93){var _0x48f991=this;return new Promise(function(_0x2fefad,_0x24c9c6){return db[_0x309e('0x19')]['findAll']({'raw':_0x119d93[_0x309e('0x1a')]?_0x119d93[_0x309e('0x1a')][_0x309e('0x1b')]===undefined?!![]:![]:!![],'where':_0x119d93[_0x309e('0x1a')]?_0x119d93[_0x309e('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x309e('0x1c'),db[_0x309e('0x1d')]['fn']('IF',db[_0x309e('0x1d')]['literal'](_0x309e('0x1e')))),_0x309e('0x1f')]]})[_0x309e('0x20')](function(_0x26d4d0){logger[_0x309e('0xe')](_0x309e('0x21'),_0x119d93);logger[_0x309e('0xf')](_0x309e('0x21'),_0x119d93,JSON[_0x309e('0x11')](_0x26d4d0));_0x2fefad(_0x26d4d0);})[_0x309e('0x18')](function(_0x4c7be3){logger['error'](_0x309e('0x21'),_0x4c7be3[_0x309e('0x15')],_0x119d93);_0x24c9c6(_0x48f991[_0x309e('0x12')](0x1f4,_0x4c7be3[_0x309e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 1e37df8..7a20d3f 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 _0x88d5=['remove','update','emit','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x88d5,0x76));var _0x588d=function(_0x410344,_0x11c039){_0x410344=_0x410344-0x0;var _0x210ff4=_0x88d5[_0x410344];return _0x210ff4;};'use strict';var UserVoiceQueueRtEvents=require(_0x588d('0x0'));var events=[_0x588d('0x1'),_0x588d('0x2'),_0x588d('0x3')];function createListener(_0x315178,_0x5372b1){return function(_0xe46c98){_0x5372b1[_0x588d('0x4')](_0x315178,_0xe46c98);};}function removeListener(_0x504b52,_0x474e79){return function(){UserVoiceQueueRtEvents[_0x588d('0x5')](_0x504b52,_0x474e79);};}exports[_0x588d('0x6')]=function(_0x1b193f){for(var _0xecfb11=0x0,_0x413748=events['length'];_0xecfb11<_0x413748;_0xecfb11++){var _0x57699a=events[_0xecfb11];var _0x41ddf3=createListener(_0x588d('0x7')+_0x57699a,_0x1b193f);UserVoiceQueueRtEvents['on'](_0x57699a,_0x41ddf3);}}; \ No newline at end of file +var _0x6bac=['./userVoiceQueueRt.events','remove','update','removeListener','length'];(function(_0x5d9eaa,_0x167a02){var _0x15db37=function(_0x1d0f6a){while(--_0x1d0f6a){_0x5d9eaa['push'](_0x5d9eaa['shift']());}};_0x15db37(++_0x167a02);}(_0x6bac,0xa5));var _0xc6ba=function(_0x229ec4,_0xe0dbf0){_0x229ec4=_0x229ec4-0x0;var _0x52c0cc=_0x6bac[_0x229ec4];return _0x52c0cc;};'use strict';var UserVoiceQueueRtEvents=require(_0xc6ba('0x0'));var events=['save',_0xc6ba('0x1'),_0xc6ba('0x2')];function createListener(_0xf479c,_0x1869a3){return function(_0x489037){_0x1869a3['emit'](_0xf479c,_0x489037);};}function removeListener(_0x487ef1,_0x378f3d){return function(){UserVoiceQueueRtEvents[_0xc6ba('0x3')](_0x487ef1,_0x378f3d);};}exports['register']=function(_0x222f20){for(var _0x2a16af=0x0,_0x33167e=events[_0xc6ba('0x4')];_0x2a16af<_0x33167e;_0x2a16af++){var _0x12d6e9=events[_0x2a16af];var _0x1fa2a8=createListener('userVoiceQueueRt:'+_0x12d6e9,_0x222f20);UserVoiceQueueRtEvents['on'](_0x12d6e9,_0x1fa2a8);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index b9bdd51..c162b9a 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x973ad9,_0x57e9c1){var _0x5d2daf=function(_0x4594b0){while(--_0x4594b0){_0x973ad9['push'](_0x973ad9['shift']());}};_0x5d2daf(++_0x57e9c1);}(_0x70e0,0x17b));var _0x070e=function(_0x1d38de,_0x38c0ed){_0x1d38de=_0x1d38de-0x0;var _0xafbac8=_0x70e0[_0x1d38de];return _0xafbac8;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x36f396,_0x46e3f5){var _0x10e3bb=function(_0x42904f){while(--_0x42904f){_0x36f396['push'](_0x36f396['shift']());}};_0x10e3bb(++_0x46e3f5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0xcb91[_0x3a6e4b];return _0x36572d;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index e9184dc..fb6b4b1 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 _0x3383=['INTEGER','sequelize'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x3383,0x1b5));var _0x3338=function(_0x40e5a1,_0x13a13a){_0x40e5a1=_0x40e5a1-0x0;var _0x1d52e4=_0x3383[_0x40e5a1];return _0x1d52e4;};'use strict';var Sequelize=require(_0x3338('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3338('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0967=['sequelize'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0967,0x173));var _0x7096=function(_0x3583c1,_0x313ec5){_0x3583c1=_0x3583c1-0x0;var _0x1f45c0=_0x0967[_0x3583c1];return _0x1f45c0;};'use strict';var Sequelize=require(_0x7096('0x0'));module['exports']={'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 f70bd08..90cc94f 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 _0xede1=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x339425,_0xe27955){var _0x3e8102=function(_0x1f0fa1){while(--_0x1f0fa1){_0x339425['push'](_0x339425['shift']());}};_0x3e8102(++_0xe27955);}(_0xede1,0x1b4));var _0x1ede=function(_0x3b002c,_0x4547d6){_0x3b002c=_0x3b002c-0x0;var _0x294519=_0xede1[_0x3b002c];return _0x294519;};'use strict';var _=require(_0x1ede('0x0'));var util=require('util');var logger=require(_0x1ede('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1ede('0x2'));var rp=require(_0x1ede('0x3'));var fs=require('fs');var path=require(_0x1ede('0x4'));var rimraf=require(_0x1ede('0x5'));var config=require(_0x1ede('0x6'));var attributes=require(_0x1ede('0x7'));module[_0x1ede('0x8')]=function(_0xf8d62c,_0x3c5c87){return _0xf8d62c[_0x1ede('0x9')](_0x1ede('0xa'),attributes,{'tableName':_0x1ede('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc005=['api','moment','bluebird','path','rimraf','exports','define','UserWhatsappQueue','../../config/logger'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0xc005,0x170));var _0x5c00=function(_0x2c18a8,_0x24eaa5){_0x2c18a8=_0x2c18a8-0x0;var _0x1e009a=_0xc005[_0x2c18a8];return _0x1e009a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5c00('0x0'))(_0x5c00('0x1'));var moment=require(_0x5c00('0x2'));var BPromise=require(_0x5c00('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c00('0x4'));var rimraf=require(_0x5c00('0x5'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x5c00('0x6')]=function(_0x39fad0,_0x4e3571){return _0x39fad0[_0x5c00('0x7')](_0x5c00('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','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 397e31e..3e5843f 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 _0x42aa=['request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug'];(function(_0x2adc7c,_0x4c526b){var _0x167879=function(_0x38aca9){while(--_0x38aca9){_0x2adc7c['push'](_0x2adc7c['shift']());}};_0x167879(++_0x4c526b);}(_0x42aa,0x1a8));var _0xa42a=function(_0x245d1a,_0x133b59){_0x245d1a=_0x245d1a-0x0;var _0x40c189=_0x42aa[_0x245d1a];return _0x40c189;};'use strict';var _=require(_0xa42a('0x0'));var util=require('util');var moment=require(_0xa42a('0x1'));var BPromise=require(_0xa42a('0x2'));var rs=require(_0xa42a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa42a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa42a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa42a('0x6')][_0xa42a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c9709,_0x52feba,_0x231fdd){return new BPromise(function(_0xd33970,_0x3a2c74){return client[_0xa42a('0x8')](_0x3c9709,_0x231fdd)[_0xa42a('0x9')](function(_0x31b51b){logger[_0xa42a('0xa')](_0xa42a('0xb'),_0x52feba,'request\x20sent');logger[_0xa42a('0xc')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x52feba,_0xa42a('0xd'),JSON[_0xa42a('0xe')](_0x31b51b));if(_0x31b51b[_0xa42a('0xf')]){if(_0x31b51b[_0xa42a('0xf')]['code']===0x1f4){logger[_0xa42a('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x52feba,_0x31b51b[_0xa42a('0xf')][_0xa42a('0x10')]);return _0x3a2c74(_0x31b51b[_0xa42a('0xf')]['message']);}logger['error'](_0xa42a('0xb'),_0x52feba,_0x31b51b[_0xa42a('0xf')][_0xa42a('0x10')]);return _0xd33970(_0x31b51b[_0xa42a('0xf')]['message']);}else{logger[_0xa42a('0xa')](_0xa42a('0xb'),_0x52feba,_0xa42a('0xd'));_0xd33970(_0x31b51b[_0xa42a('0x11')][_0xa42a('0x10')]);}})[_0xa42a('0x12')](function(_0x407e58){logger[_0xa42a('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x52feba,_0x407e58);_0x3a2c74(_0x407e58);});});} \ No newline at end of file +var _0xef81=['info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserWhatsappQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xef81,0x172));var _0x1ef8=function(_0xa4cf49,_0x3b1d1e){_0xa4cf49=_0xa4cf49-0x0;var _0x2d1920=_0xef81[_0xa4cf49];return _0x2d1920;};'use strict';var _=require(_0x1ef8('0x0'));var util=require(_0x1ef8('0x1'));var moment=require(_0x1ef8('0x2'));var BPromise=require('bluebird');var rs=require(_0x1ef8('0x3'));var fs=require('fs');var Redis=require(_0x1ef8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ef8('0x5'));var logger=require(_0x1ef8('0x6'))(_0x1ef8('0x7'));var config=require(_0x1ef8('0x8'));var jayson=require(_0x1ef8('0x9'));var client=jayson[_0x1ef8('0xa')][_0x1ef8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c5eab,_0x3537ae,_0x645e2f){return new BPromise(function(_0x80c40,_0x5ed7b9){return client[_0x1ef8('0xc')](_0x1c5eab,_0x645e2f)[_0x1ef8('0xd')](function(_0x1682fb){logger[_0x1ef8('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3537ae,_0x1ef8('0xf'));logger[_0x1ef8('0x10')](_0x1ef8('0x11'),_0x3537ae,'request\x20sent',JSON['stringify'](_0x1682fb));if(_0x1682fb[_0x1ef8('0x12')]){if(_0x1682fb[_0x1ef8('0x12')][_0x1ef8('0x13')]===0x1f4){logger[_0x1ef8('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3537ae,_0x1682fb[_0x1ef8('0x12')][_0x1ef8('0x14')]);return _0x5ed7b9(_0x1682fb[_0x1ef8('0x12')][_0x1ef8('0x14')]);}logger['error'](_0x1ef8('0x15'),_0x3537ae,_0x1682fb[_0x1ef8('0x12')]['message']);return _0x80c40(_0x1682fb[_0x1ef8('0x12')][_0x1ef8('0x14')]);}else{logger[_0x1ef8('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3537ae,'request\x20sent');_0x80c40(_0x1682fb[_0x1ef8('0x16')][_0x1ef8('0x14')]);}})[_0x1ef8('0x17')](function(_0x245fcf){logger[_0x1ef8('0x12')](_0x1ef8('0x15'),_0x3537ae,_0x245fcf);_0x5ed7b9(_0x245fcf);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 2be1ba3..e85ab95 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 _0x6c84=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x113045,_0x15fe51){var _0x5d1ded=function(_0x125532){while(--_0x125532){_0x113045['push'](_0x113045['shift']());}};_0x5d1ded(++_0x15fe51);}(_0x6c84,0x112));var _0x46c8=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x6c84[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x46c8('0x0'));var util=require(_0x46c8('0x1'));var path=require(_0x46c8('0x2'));var timeout=require(_0x46c8('0x3'));var express=require(_0x46c8('0x4'));var router=express['Router']();var fs_extra=require(_0x46c8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x46c8('0x6'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0x46c8('0x7')]('/',auth[_0x46c8('0x8')](),controller[_0x46c8('0x9')]);router[_0x46c8('0x7')](_0x46c8('0xa'),auth[_0x46c8('0x8')](),controller[_0x46c8('0xb')]);router[_0x46c8('0xc')]('/',auth['isAuthenticated'](),controller[_0x46c8('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x46c8('0xe')]);router['delete'](_0x46c8('0xa'),auth[_0x46c8('0x8')](),controller[_0x46c8('0xf')]);module[_0x46c8('0x10')]=router; \ No newline at end of file +var _0x740a=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x20cf8a,_0x44cd6b){var _0x54e165=function(_0xcce1d0){while(--_0xcce1d0){_0x20cf8a['push'](_0x20cf8a['shift']());}};_0x54e165(++_0x44cd6b);}(_0x740a,0x175));var _0xa740=function(_0x51335c,_0x4950ea){_0x51335c=_0x51335c-0x0;var _0x3a4360=_0x740a[_0x51335c];return _0x3a4360;};'use strict';var multer=require(_0xa740('0x0'));var util=require(_0xa740('0x1'));var path=require(_0xa740('0x2'));var timeout=require(_0xa740('0x3'));var express=require(_0xa740('0x4'));var router=express[_0xa740('0x5')]();var fs_extra=require(_0xa740('0x6'));var auth=require(_0xa740('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa740('0x8'));var controller=require('./variable.controller');router['get']('/',auth[_0xa740('0x9')](),controller[_0xa740('0xa')]);router[_0xa740('0xb')](_0xa740('0xc'),auth[_0xa740('0x9')](),controller[_0xa740('0xd')]);router[_0xa740('0xe')]('/',auth['isAuthenticated'](),controller[_0xa740('0xf')]);router[_0xa740('0x10')](_0xa740('0xc'),auth[_0xa740('0x9')](),controller[_0xa740('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa740('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 80e0071..f8a7e8e 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 _0x4a81=['exports','STRING','name','sequelize'];(function(_0x4ecdda,_0x3b092d){var _0x397020=function(_0x42bc44){while(--_0x42bc44){_0x4ecdda['push'](_0x4ecdda['shift']());}};_0x397020(++_0x3b092d);}(_0x4a81,0x1b7));var _0x14a8=function(_0x3fb73b,_0x2cd34a){_0x3fb73b=_0x3fb73b-0x0;var _0x48cf16=_0x4a81[_0x3fb73b];return _0x48cf16;};'use strict';var Sequelize=require(_0x14a8('0x0'));module[_0x14a8('0x1')]={'name':{'type':Sequelize[_0x14a8('0x2')],'unique':_0x14a8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5cd5=['exports','STRING','name','sequelize'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0x5cd5,0x10b));var _0x55cd=function(_0x41b404,_0x3d2c4c){_0x41b404=_0x41b404-0x0;var _0xe0c121=_0x5cd5[_0x41b404];return _0xe0c121;};'use strict';var Sequelize=require(_0x55cd('0x0'));module[_0x55cd('0x1')]={'name':{'type':Sequelize[_0x55cd('0x2')],'unique':_0x55cd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x55cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 07e4590..8a51dd8 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 _0x422b=['util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','stack','name','send','map','Variable','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Variables','UserProfileSection','find','userProfileId','autoAssociation','catch','error','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x51ce14,_0x5cd58b){var _0x301a2d=function(_0x85fdf){while(--_0x85fdf){_0x51ce14['push'](_0x51ce14['shift']());}};_0x301a2d(++_0x5cd58b);}(_0x422b,0x1c1));var _0xb422=function(_0x5278b9,_0x392ae5){_0x5278b9=_0x5278b9-0x0;var _0x1c5a52=_0x422b[_0x5278b9];return _0x1c5a52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb422('0x0'));var zipdir=require(_0xb422('0x1'));var jsonpatch=require(_0xb422('0x2'));var rp=require(_0xb422('0x3'));var moment=require(_0xb422('0x4'));var BPromise=require(_0xb422('0x5'));var Mustache=require(_0xb422('0x6'));var util=require(_0xb422('0x7'));var path=require(_0xb422('0x8'));var sox=require(_0xb422('0x9'));var csv=require(_0xb422('0xa'));var ejs=require(_0xb422('0xb'));var fs=require('fs');var fs_extra=require(_0xb422('0xc'));var _=require(_0xb422('0xd'));var squel=require('squel');var crypto=require(_0xb422('0xe'));var jsforce=require(_0xb422('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb422('0xa'));var querystring=require(_0xb422('0x10'));var Papa=require(_0xb422('0x11'));var Redis=require(_0xb422('0x12'));var authService=require(_0xb422('0x13'));var qs=require(_0xb422('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb422('0x15'));var config=require(_0xb422('0x16'));var licenseUtil=require(_0xb422('0x17'));var db=require(_0xb422('0x18'))['db'];function respondWithStatusCode(_0x2e22e1,_0x4e4f8e){_0x4e4f8e=_0x4e4f8e||0xcc;return function(_0x1282ef){if(_0x1282ef){return _0x2e22e1[_0xb422('0x19')](_0x4e4f8e);}return _0x2e22e1['status'](_0x4e4f8e)['end']();};}function respondWithResult(_0x5c171b,_0x18e806){_0x18e806=_0x18e806||0xc8;return function(_0x3c7bb1){if(_0x3c7bb1){return _0x5c171b[_0xb422('0x1a')](_0x18e806)[_0xb422('0x1b')](_0x3c7bb1);}};}function respondWithFilteredResult(_0x2bf60d,_0x55a0bd){return function(_0x1feaf0){if(_0x1feaf0){var _0x9f469c=typeof _0x55a0bd[_0xb422('0x1c')]===_0xb422('0x1d')&&typeof _0x55a0bd['limit']===_0xb422('0x1d');var _0x2889b6=_0x1feaf0[_0xb422('0x1e')];var _0x2a1f86=_0x9f469c?0x0:_0x55a0bd[_0xb422('0x1c')];var _0x33ee05=_0x9f469c?_0x1feaf0[_0xb422('0x1e')]:_0x55a0bd['offset']+_0x55a0bd['limit'];var _0x16102c;if(_0x33ee05>=_0x2889b6){_0x33ee05=_0x2889b6;_0x16102c=0xc8;}else{_0x16102c=0xce;}_0x2bf60d[_0xb422('0x1a')](_0x16102c);return _0x2bf60d[_0xb422('0x1f')](_0xb422('0x20'),_0x2a1f86+'-'+_0x33ee05+'/'+_0x2889b6)[_0xb422('0x1b')](_0x1feaf0);}return null;};}function patchUpdates(_0x112404){return function(_0x4b77fe){try{jsonpatch['apply'](_0x4b77fe,_0x112404,!![]);}catch(_0x375d4b){return BPromise['reject'](_0x375d4b);}return _0x4b77fe['save']();};}function saveUpdates(_0x3abc7c,_0x47018f){return function(_0x53cec3){if(_0x53cec3){return _0x53cec3[_0xb422('0x21')](_0x3abc7c)['then'](function(_0x226f44){return _0x226f44;});}return null;};}function removeEntity(_0xa6646f,_0x5966ec){return function(_0x5aa743){if(_0x5aa743){return _0x5aa743[_0xb422('0x22')]()[_0xb422('0x23')](function(){var _0x2f620b=_0x5aa743[_0xb422('0x24')]({'plain':!![]});var _0x545ffa='Variables';return db['UserProfileResource'][_0xb422('0x22')]({'where':{'type':_0x545ffa,'resourceId':_0x2f620b['id']}})[_0xb422('0x23')](function(){return _0x5aa743;});})['then'](function(){_0xa6646f[_0xb422('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b541,_0x2fe131){return function(_0x3e21b2){if(!_0x3e21b2){_0x52b541[_0xb422('0x19')](0x194);}return _0x3e21b2;};}function handleError(_0x4cea17,_0x4f33b3){_0x4f33b3=_0x4f33b3||0x1f4;return function(_0x3d0c99){logger['error'](_0x3d0c99[_0xb422('0x25')]);if(_0x3d0c99['name']){delete _0x3d0c99[_0xb422('0x26')];}_0x4cea17[_0xb422('0x1a')](_0x4f33b3)[_0xb422('0x27')](_0x3d0c99);};}exports['index']=function(_0x2a8140,_0x638b5e){var _0x237352={},_0x8777cf={},_0x42aa24={'count':0x0,'rows':[]};var _0x196e1b=_[_0xb422('0x28')](db[_0xb422('0x29')][_0xb422('0x2a')],function(_0x52d529){return{'name':_0x52d529['fieldName'],'type':_0x52d529[_0xb422('0x2b')][_0xb422('0x2c')]};});_0x8777cf[_0xb422('0x2d')]=_[_0xb422('0x28')](_0x196e1b,_0xb422('0x26'));_0x8777cf[_0xb422('0x2e')]=_[_0xb422('0x2f')](_0x2a8140[_0xb422('0x2e')]);_0x8777cf['filters']=_[_0xb422('0x30')](_0x8777cf[_0xb422('0x2d')],_0x8777cf['query']);_0x237352['attributes']=_[_0xb422('0x30')](_0x8777cf[_0xb422('0x2d')],qs['fields'](_0x2a8140[_0xb422('0x2e')][_0xb422('0x31')]));_0x237352[_0xb422('0x32')]=_0x237352['attributes']['length']?_0x237352[_0xb422('0x32')]:_0x8777cf[_0xb422('0x2d')];if(!_0x2a8140[_0xb422('0x2e')][_0xb422('0x33')]('nolimit')){_0x237352[_0xb422('0x34')]=qs['limit'](_0x2a8140[_0xb422('0x2e')][_0xb422('0x34')]);_0x237352[_0xb422('0x1c')]=qs[_0xb422('0x1c')](_0x2a8140[_0xb422('0x2e')]['offset']);}_0x237352['order']=qs[_0xb422('0x35')](_0x2a8140[_0xb422('0x2e')][_0xb422('0x35')]);_0x237352[_0xb422('0x36')]=qs[_0xb422('0x37')](_[_0xb422('0x38')](_0x2a8140[_0xb422('0x2e')],_0x8777cf['filters']),_0x196e1b);if(_0x2a8140[_0xb422('0x2e')][_0xb422('0x39')]){_0x237352['where']=_[_0xb422('0x3a')](_0x237352[_0xb422('0x36')],{'$or':_['map'](_0x196e1b,function(_0x8c3ee1){if(_0x8c3ee1['type']!=='VIRTUAL'){var _0x267fd7={};_0x267fd7[_0x8c3ee1[_0xb422('0x26')]]={'$like':'%'+_0x2a8140[_0xb422('0x2e')]['filter']+'%'};return _0x267fd7;}})});}_0x237352=_[_0xb422('0x3a')]({},_0x237352,_0x2a8140[_0xb422('0x3b')]);var _0x4d03f2={'where':_0x237352[_0xb422('0x36')]};return db['Variable'][_0xb422('0x1e')](_0x4d03f2)[_0xb422('0x23')](function(_0xd8a813){_0x42aa24[_0xb422('0x1e')]=_0xd8a813;if(_0x2a8140[_0xb422('0x2e')][_0xb422('0x3c')]){_0x237352[_0xb422('0x3d')]=[{'all':!![]}];}return db['Variable'][_0xb422('0x3e')](_0x237352);})[_0xb422('0x23')](function(_0x2783e0){_0x42aa24['rows']=_0x2783e0;return _0x42aa24;})['then'](respondWithFilteredResult(_0x638b5e,_0x237352))['catch'](handleError(_0x638b5e,null));};exports[_0xb422('0x3f')]=function(_0x1c506c,_0x564e72){var _0x44c961={'raw':!![],'where':{'id':_0x1c506c['params']['id']}},_0x4b8ec5={};_0x4b8ec5[_0xb422('0x2d')]=_[_0xb422('0x2f')](db[_0xb422('0x29')][_0xb422('0x2a')]);_0x4b8ec5[_0xb422('0x2e')]=_['keys'](_0x1c506c[_0xb422('0x2e')]);_0x4b8ec5[_0xb422('0x37')]=_['intersection'](_0x4b8ec5[_0xb422('0x2d')],_0x4b8ec5[_0xb422('0x2e')]);_0x44c961[_0xb422('0x32')]=_[_0xb422('0x30')](_0x4b8ec5[_0xb422('0x2d')],qs[_0xb422('0x31')](_0x1c506c[_0xb422('0x2e')][_0xb422('0x31')]));_0x44c961[_0xb422('0x32')]=_0x44c961[_0xb422('0x32')]['length']?_0x44c961[_0xb422('0x32')]:_0x4b8ec5[_0xb422('0x2d')];if(_0x1c506c[_0xb422('0x2e')][_0xb422('0x3c')]){_0x44c961[_0xb422('0x3d')]=[{'all':!![]}];}_0x44c961=_['merge']({},_0x44c961,_0x1c506c[_0xb422('0x3b')]);return db[_0xb422('0x29')]['find'](_0x44c961)[_0xb422('0x23')](handleEntityNotFound(_0x564e72,null))[_0xb422('0x23')](respondWithResult(_0x564e72,null))['catch'](handleError(_0x564e72,null));};exports[_0xb422('0x40')]=function(_0x712f7,_0x3f72d5){return db[_0xb422('0x29')][_0xb422('0x40')](_0x712f7['body'],{})[_0xb422('0x23')](function(_0x4b8cfd){var _0x331af4=_0x712f7[_0xb422('0x41')][_0xb422('0x24')]({'plain':!![]});if(!_0x331af4)throw new Error(_0xb422('0x42'));if(_0x331af4['role']===_0xb422('0x41')){var _0x3de4b2=_0x4b8cfd[_0xb422('0x24')]({'plain':!![]});var _0x51e6cf=_0xb422('0x43');return db[_0xb422('0x44')][_0xb422('0x45')]({'where':{'name':_0x51e6cf,'userProfileId':_0x331af4[_0xb422('0x46')]},'raw':!![]})[_0xb422('0x23')](function(_0x382fbc){if(_0x382fbc&&_0x382fbc[_0xb422('0x47')]===0x0){return db['UserProfileResource'][_0xb422('0x40')]({'name':_0x3de4b2[_0xb422('0x26')],'resourceId':_0x3de4b2['id'],'type':_0x382fbc[_0xb422('0x26')],'sectionId':_0x382fbc['id']},{})['then'](function(){return _0x4b8cfd;});}else{return _0x4b8cfd;}})[_0xb422('0x48')](function(_0x81a82){logger[_0xb422('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x81a82);throw _0x81a82;});}return _0x4b8cfd;})[_0xb422('0x23')](respondWithResult(_0x3f72d5,0xc9))[_0xb422('0x48')](handleError(_0x3f72d5,null));};exports[_0xb422('0x21')]=function(_0x2b0778,_0x283e32){if(_0x2b0778[_0xb422('0x4a')]['id']){delete _0x2b0778[_0xb422('0x4a')]['id'];}return db[_0xb422('0x29')][_0xb422('0x45')]({'where':{'id':_0x2b0778[_0xb422('0x4b')]['id']}})[_0xb422('0x23')](handleEntityNotFound(_0x283e32,null))[_0xb422('0x23')](saveUpdates(_0x2b0778[_0xb422('0x4a')],null))[_0xb422('0x23')](respondWithResult(_0x283e32,null))[_0xb422('0x48')](handleError(_0x283e32,null));};exports[_0xb422('0x22')]=function(_0x3796f1,_0x7b48b3){return db['Variable'][_0xb422('0x45')]({'where':{'id':_0x3796f1[_0xb422('0x4b')]['id']}})[_0xb422('0x23')](handleEntityNotFound(_0x7b48b3,null))[_0xb422('0x23')](removeEntity(_0x7b48b3,null))[_0xb422('0x48')](handleError(_0x7b48b3,null));}; \ No newline at end of file +var _0xac92=['get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Variables','end','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x21eb4e,_0x3345fe){var _0x42fabc=function(_0x4f6f63){while(--_0x4f6f63){_0x21eb4e['push'](_0x21eb4e['shift']());}};_0x42fabc(++_0x3345fe);}(_0xac92,0x1aa));var _0x2ac9=function(_0x1dddb0,_0x41f1b1){_0x1dddb0=_0x1dddb0-0x0;var _0x2d1c4f=_0xac92[_0x1dddb0];return _0x2d1c4f;};'use strict';var emlformat=require(_0x2ac9('0x0'));var rimraf=require(_0x2ac9('0x1'));var zipdir=require(_0x2ac9('0x2'));var jsonpatch=require(_0x2ac9('0x3'));var rp=require(_0x2ac9('0x4'));var moment=require(_0x2ac9('0x5'));var BPromise=require(_0x2ac9('0x6'));var Mustache=require('mustache');var util=require(_0x2ac9('0x7'));var path=require('path');var sox=require(_0x2ac9('0x8'));var csv=require(_0x2ac9('0x9'));var ejs=require(_0x2ac9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ac9('0xb'));var squel=require(_0x2ac9('0xc'));var crypto=require(_0x2ac9('0xd'));var jsforce=require(_0x2ac9('0xe'));var deskjs=require(_0x2ac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2ac9('0x10'));var Papa=require(_0x2ac9('0x11'));var Redis=require('ioredis');var authService=require(_0x2ac9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2ac9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ac9('0x14'))(_0x2ac9('0x15'));var utils=require('../../config/utils');var config=require(_0x2ac9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ac9('0x17'))['db'];function respondWithStatusCode(_0x26be69,_0x5d1b73){_0x5d1b73=_0x5d1b73||0xcc;return function(_0x22748d){if(_0x22748d){return _0x26be69[_0x2ac9('0x18')](_0x5d1b73);}return _0x26be69[_0x2ac9('0x19')](_0x5d1b73)['end']();};}function respondWithResult(_0x2a0bfc,_0x4e681e){_0x4e681e=_0x4e681e||0xc8;return function(_0x38bbac){if(_0x38bbac){return _0x2a0bfc['status'](_0x4e681e)[_0x2ac9('0x1a')](_0x38bbac);}};}function respondWithFilteredResult(_0x1efce3,_0x10e81c){return function(_0x567f29){if(_0x567f29){var _0x3d616a=typeof _0x10e81c['offset']===_0x2ac9('0x1b')&&typeof _0x10e81c[_0x2ac9('0x1c')]===_0x2ac9('0x1b');var _0x23c398=_0x567f29['count'];var _0x2c6bee=_0x3d616a?0x0:_0x10e81c['offset'];var _0x27515f=_0x3d616a?_0x567f29[_0x2ac9('0x1d')]:_0x10e81c[_0x2ac9('0x1e')]+_0x10e81c['limit'];var _0xfad8da;if(_0x27515f>=_0x23c398){_0x27515f=_0x23c398;_0xfad8da=0xc8;}else{_0xfad8da=0xce;}_0x1efce3[_0x2ac9('0x19')](_0xfad8da);return _0x1efce3[_0x2ac9('0x1f')](_0x2ac9('0x20'),_0x2c6bee+'-'+_0x27515f+'/'+_0x23c398)['json'](_0x567f29);}return null;};}function patchUpdates(_0x198b38){return function(_0x27aba5){try{jsonpatch[_0x2ac9('0x21')](_0x27aba5,_0x198b38,!![]);}catch(_0x2896e2){return BPromise[_0x2ac9('0x22')](_0x2896e2);}return _0x27aba5[_0x2ac9('0x23')]();};}function saveUpdates(_0x4aac45,_0x31ae60){return function(_0x271496){if(_0x271496){return _0x271496[_0x2ac9('0x24')](_0x4aac45)[_0x2ac9('0x25')](function(_0x4fa511){return _0x4fa511;});}return null;};}function removeEntity(_0x301455,_0x57171f){return function(_0xd2e745){if(_0xd2e745){return _0xd2e745[_0x2ac9('0x26')]()[_0x2ac9('0x25')](function(){var _0x2e69f9=_0xd2e745['get']({'plain':!![]});var _0x4b898b=_0x2ac9('0x27');return db['UserProfileResource'][_0x2ac9('0x26')]({'where':{'type':_0x4b898b,'resourceId':_0x2e69f9['id']}})[_0x2ac9('0x25')](function(){return _0xd2e745;});})[_0x2ac9('0x25')](function(){_0x301455[_0x2ac9('0x19')](0xcc)[_0x2ac9('0x28')]();});}};}function handleEntityNotFound(_0x5e4897,_0x51454f){return function(_0x9c6d6c){if(!_0x9c6d6c){_0x5e4897[_0x2ac9('0x18')](0x194);}return _0x9c6d6c;};}function handleError(_0x119783,_0x470fa9){_0x470fa9=_0x470fa9||0x1f4;return function(_0x394cfc){logger[_0x2ac9('0x29')](_0x394cfc[_0x2ac9('0x2a')]);if(_0x394cfc[_0x2ac9('0x2b')]){delete _0x394cfc[_0x2ac9('0x2b')];}_0x119783['status'](_0x470fa9)[_0x2ac9('0x2c')](_0x394cfc);};}exports[_0x2ac9('0x2d')]=function(_0x472b48,_0x350185){var _0x2a8048={},_0x5845f7={},_0x35ad81={'count':0x0,'rows':[]};var _0x1ec7be=_[_0x2ac9('0x2e')](db[_0x2ac9('0x2f')][_0x2ac9('0x30')],function(_0x3a17f6){return{'name':_0x3a17f6[_0x2ac9('0x31')],'type':_0x3a17f6[_0x2ac9('0x32')][_0x2ac9('0x33')]};});_0x5845f7[_0x2ac9('0x34')]=_[_0x2ac9('0x2e')](_0x1ec7be,'name');_0x5845f7[_0x2ac9('0x35')]=_[_0x2ac9('0x36')](_0x472b48[_0x2ac9('0x35')]);_0x5845f7[_0x2ac9('0x37')]=_[_0x2ac9('0x38')](_0x5845f7[_0x2ac9('0x34')],_0x5845f7['query']);_0x2a8048[_0x2ac9('0x39')]=_[_0x2ac9('0x38')](_0x5845f7['model'],qs[_0x2ac9('0x3a')](_0x472b48[_0x2ac9('0x35')][_0x2ac9('0x3a')]));_0x2a8048[_0x2ac9('0x39')]=_0x2a8048['attributes']['length']?_0x2a8048['attributes']:_0x5845f7[_0x2ac9('0x34')];if(!_0x472b48[_0x2ac9('0x35')]['hasOwnProperty']('nolimit')){_0x2a8048[_0x2ac9('0x1c')]=qs[_0x2ac9('0x1c')](_0x472b48['query'][_0x2ac9('0x1c')]);_0x2a8048[_0x2ac9('0x1e')]=qs['offset'](_0x472b48['query'][_0x2ac9('0x1e')]);}_0x2a8048[_0x2ac9('0x3b')]=qs[_0x2ac9('0x3c')](_0x472b48[_0x2ac9('0x35')]['sort']);_0x2a8048[_0x2ac9('0x3d')]=qs['filters'](_[_0x2ac9('0x3e')](_0x472b48['query'],_0x5845f7[_0x2ac9('0x37')]),_0x1ec7be);if(_0x472b48['query']['filter']){_0x2a8048[_0x2ac9('0x3d')]=_['merge'](_0x2a8048[_0x2ac9('0x3d')],{'$or':_[_0x2ac9('0x2e')](_0x1ec7be,function(_0x1373a9){if(_0x1373a9[_0x2ac9('0x32')]!==_0x2ac9('0x3f')){var _0x33a77f={};_0x33a77f[_0x1373a9[_0x2ac9('0x2b')]]={'$like':'%'+_0x472b48[_0x2ac9('0x35')][_0x2ac9('0x40')]+'%'};return _0x33a77f;}})});}_0x2a8048=_[_0x2ac9('0x41')]({},_0x2a8048,_0x472b48[_0x2ac9('0x42')]);var _0x78cca={'where':_0x2a8048['where']};return db[_0x2ac9('0x2f')][_0x2ac9('0x1d')](_0x78cca)[_0x2ac9('0x25')](function(_0x39bbcb){_0x35ad81['count']=_0x39bbcb;if(_0x472b48[_0x2ac9('0x35')][_0x2ac9('0x43')]){_0x2a8048[_0x2ac9('0x44')]=[{'all':!![]}];}return db[_0x2ac9('0x2f')]['findAll'](_0x2a8048);})[_0x2ac9('0x25')](function(_0x462a7d){_0x35ad81[_0x2ac9('0x45')]=_0x462a7d;return _0x35ad81;})[_0x2ac9('0x25')](respondWithFilteredResult(_0x350185,_0x2a8048))[_0x2ac9('0x46')](handleError(_0x350185,null));};exports[_0x2ac9('0x47')]=function(_0x42e950,_0x3e2ed9){var _0x23a5cc={'raw':!![],'where':{'id':_0x42e950[_0x2ac9('0x48')]['id']}},_0x41b78e={};_0x41b78e[_0x2ac9('0x34')]=_[_0x2ac9('0x36')](db[_0x2ac9('0x2f')][_0x2ac9('0x30')]);_0x41b78e[_0x2ac9('0x35')]=_[_0x2ac9('0x36')](_0x42e950[_0x2ac9('0x35')]);_0x41b78e['filters']=_[_0x2ac9('0x38')](_0x41b78e[_0x2ac9('0x34')],_0x41b78e[_0x2ac9('0x35')]);_0x23a5cc[_0x2ac9('0x39')]=_[_0x2ac9('0x38')](_0x41b78e[_0x2ac9('0x34')],qs['fields'](_0x42e950[_0x2ac9('0x35')][_0x2ac9('0x3a')]));_0x23a5cc['attributes']=_0x23a5cc[_0x2ac9('0x39')]['length']?_0x23a5cc[_0x2ac9('0x39')]:_0x41b78e[_0x2ac9('0x34')];if(_0x42e950[_0x2ac9('0x35')][_0x2ac9('0x43')]){_0x23a5cc[_0x2ac9('0x44')]=[{'all':!![]}];}_0x23a5cc=_['merge']({},_0x23a5cc,_0x42e950['options']);return db[_0x2ac9('0x2f')][_0x2ac9('0x49')](_0x23a5cc)['then'](handleEntityNotFound(_0x3e2ed9,null))[_0x2ac9('0x25')](respondWithResult(_0x3e2ed9,null))['catch'](handleError(_0x3e2ed9,null));};exports[_0x2ac9('0x4a')]=function(_0x3bc9a1,_0x5ac95c){return db[_0x2ac9('0x2f')][_0x2ac9('0x4a')](_0x3bc9a1['body'],{})[_0x2ac9('0x25')](function(_0x19375d){var _0x4d9085=_0x3bc9a1[_0x2ac9('0x4b')]['get']({'plain':!![]});if(!_0x4d9085)throw new Error(_0x2ac9('0x4c'));if(_0x4d9085[_0x2ac9('0x4d')]===_0x2ac9('0x4b')){var _0x33e79e=_0x19375d[_0x2ac9('0x4e')]({'plain':!![]});var _0x47d5f0=_0x2ac9('0x27');return db[_0x2ac9('0x4f')]['find']({'where':{'name':_0x47d5f0,'userProfileId':_0x4d9085[_0x2ac9('0x50')]},'raw':!![]})[_0x2ac9('0x25')](function(_0x47309e){if(_0x47309e&&_0x47309e[_0x2ac9('0x51')]===0x0){return db['UserProfileResource'][_0x2ac9('0x4a')]({'name':_0x33e79e[_0x2ac9('0x2b')],'resourceId':_0x33e79e['id'],'type':_0x47309e[_0x2ac9('0x2b')],'sectionId':_0x47309e['id']},{})[_0x2ac9('0x25')](function(){return _0x19375d;});}else{return _0x19375d;}})[_0x2ac9('0x46')](function(_0x5e13cf){logger[_0x2ac9('0x29')](_0x2ac9('0x52'),_0x5e13cf);throw _0x5e13cf;});}return _0x19375d;})['then'](respondWithResult(_0x5ac95c,0xc9))['catch'](handleError(_0x5ac95c,null));};exports['update']=function(_0x23bbcd,_0x2f74cd){if(_0x23bbcd[_0x2ac9('0x53')]['id']){delete _0x23bbcd['body']['id'];}return db['Variable'][_0x2ac9('0x49')]({'where':{'id':_0x23bbcd[_0x2ac9('0x48')]['id']}})[_0x2ac9('0x25')](handleEntityNotFound(_0x2f74cd,null))[_0x2ac9('0x25')](saveUpdates(_0x23bbcd[_0x2ac9('0x53')],null))[_0x2ac9('0x25')](respondWithResult(_0x2f74cd,null))[_0x2ac9('0x46')](handleError(_0x2f74cd,null));};exports[_0x2ac9('0x26')]=function(_0x1e0944,_0x394dff){return db['Variable'][_0x2ac9('0x49')]({'where':{'id':_0x1e0944[_0x2ac9('0x48')]['id']}})[_0x2ac9('0x25')](handleEntityNotFound(_0x394dff,null))[_0x2ac9('0x25')](removeEntity(_0x394dff,null))[_0x2ac9('0x46')](handleError(_0x394dff,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2ba25f8..3245ab0 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 _0xf2ca=['rimraf','exports','define','Variable','tools_variables','util','api','moment','request-promise','path'];(function(_0x26daf6,_0x149fdf){var _0x45c206=function(_0x823851){while(--_0x823851){_0x26daf6['push'](_0x26daf6['shift']());}};_0x45c206(++_0x149fdf);}(_0xf2ca,0xaf));var _0xaf2c=function(_0x111494,_0x1d73da){_0x111494=_0x111494-0x0;var _0x1d0d8b=_0xf2ca[_0x111494];return _0x1d0d8b;};'use strict';var _=require('lodash');var util=require(_0xaf2c('0x0'));var logger=require('../../config/logger')(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rp=require(_0xaf2c('0x3'));var fs=require('fs');var path=require(_0xaf2c('0x4'));var rimraf=require(_0xaf2c('0x5'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xaf2c('0x6')]=function(_0x4b5eba,_0x10c2c0){return _0x4b5eba[_0xaf2c('0x7')](_0xaf2c('0x8'),attributes,{'tableName':_0xaf2c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0143=['exports','define','Variable','tools_variables','lodash','util','moment','path','../../config/environment','./variable.attributes'];(function(_0x3a9c08,_0x4b3995){var _0x1ad32e=function(_0x57e972){while(--_0x57e972){_0x3a9c08['push'](_0x3a9c08['shift']());}};_0x1ad32e(++_0x4b3995);}(_0x0143,0x130));var _0x3014=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0143[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x3014('0x0'));var util=require(_0x3014('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3014('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3014('0x3'));var rimraf=require('rimraf');var config=require(_0x3014('0x4'));var attributes=require(_0x3014('0x5'));module[_0x3014('0x6')]=function(_0x42e8e4,_0x97c07f){return _0x42e8e4[_0x3014('0x7')](_0x3014('0x8'),attributes,{'tableName':_0x3014('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index f5ae40b..6b4a181 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 _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x3066f8,_0x41b414){var _0x3e9f08=function(_0x5d8969){while(--_0x5d8969){_0x3066f8['push'](_0x3066f8['shift']());}};_0x3e9f08(++_0x41b414);}(_0x7217,0x19e));var _0x7721=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x7217[_0x298ed3];return _0x5aad28;};'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')]('Variable,\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']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x2fc687,_0x21405d){var _0x4a1df2=function(_0x3f33ba){while(--_0x3f33ba){_0x2fc687['push'](_0x2fc687['shift']());}};_0x4a1df2(++_0x21405d);}(_0x6aa7,0x178));var _0x76aa=function(_0x1b3691,_0x33676e){_0x1b3691=_0x1b3691-0x0;var _0x4c6201=_0x6aa7[_0x1b3691];return _0x4c6201;};'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);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index d9e73c6..081f02a 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 _0x938e=['../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','/reset','canUpdate','/pull','pull','/restart','restart','/migrations','express','Router'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x938e,0x132));var _0xe938=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x938e[_0x15cbce];return _0x257f29;};'use strict';var express=require(_0xe938('0x0'));var router=express[_0xe938('0x1')]();var auth=require(_0xe938('0x2'));var controller=require(_0xe938('0x3'));router[_0xe938('0x4')]('/',controller['index']);router['get'](_0xe938('0x5'),auth[_0xe938('0x6')](),auth['canUpdate'](),controller['fetch']);router[_0xe938('0x4')](_0xe938('0x7'),auth[_0xe938('0x6')](),auth[_0xe938('0x8')](),controller['reset']);router[_0xe938('0x4')](_0xe938('0x9'),auth['isAuthenticated'](),auth[_0xe938('0x8')](),controller[_0xe938('0xa')]);router[_0xe938('0x4')](_0xe938('0xb'),auth['isAuthenticated'](),controller[_0xe938('0xc')]);router[_0xe938('0x4')](_0xe938('0xd'),controller['migrations']);module['exports']=router; \ No newline at end of file +var _0x8b6c=['../../components/auth/service','./version.controller','index','get','/fetch','isAuthenticated','/reset','/restart','restart','/migrations','migrations','exports','express'];(function(_0x59b137,_0x42bb1b){var _0x3900a8=function(_0x27deff){while(--_0x27deff){_0x59b137['push'](_0x59b137['shift']());}};_0x3900a8(++_0x42bb1b);}(_0x8b6c,0x137));var _0xc8b6=function(_0x323158,_0xe212e5){_0x323158=_0x323158-0x0;var _0x5164b3=_0x8b6c[_0x323158];return _0x5164b3;};'use strict';var express=require(_0xc8b6('0x0'));var router=express['Router']();var auth=require(_0xc8b6('0x1'));var controller=require(_0xc8b6('0x2'));router['get']('/',controller[_0xc8b6('0x3')]);router[_0xc8b6('0x4')](_0xc8b6('0x5'),auth[_0xc8b6('0x6')](),auth['canUpdate'](),controller['fetch']);router[_0xc8b6('0x4')](_0xc8b6('0x7'),auth[_0xc8b6('0x6')](),auth['canUpdate'](),controller['reset']);router[_0xc8b6('0x4')]('/pull',auth[_0xc8b6('0x6')](),auth['canUpdate'](),controller['pull']);router['get'](_0xc8b6('0x8'),auth['isAuthenticated'](),controller[_0xc8b6('0x9')]);router[_0xc8b6('0x4')](_0xc8b6('0xa'),controller[_0xc8b6('0xb')]);module[_0xc8b6('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index dbba27d..dafe6d9 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 _0x6a7e=['pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','index','exports','fetch','tags','latest','2.0.0','status','json','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6a7e,0x170));var _0xe6a7=function(_0x27821d,_0x56d1b8){_0x27821d=_0x27821d-0x0;var _0x173437=_0x6a7e[_0x27821d];return _0x173437;};'use strict';var Umzug=require(_0xe6a7('0x0'));var path=require(_0xe6a7('0x1'));var fs=require('fs');var _=require(_0xe6a7('0x2'));var pkginfo=require(_0xe6a7('0x3'))(module,_0xe6a7('0x4'));var compareVersions=require('compare-versions');var exec=require(_0xe6a7('0x5'))[_0xe6a7('0x6')];var db=require(_0xe6a7('0x7'))['db'];var config=require(_0xe6a7('0x8'));var pm2=require(_0xe6a7('0x9'));var logger=require(_0xe6a7('0xa'))('update');var git=require(_0xe6a7('0xb'))(config['root']);exports[_0xe6a7('0xc')]=function(_0x5abbef,_0x29ac35){var _0x544af8={'current':module[_0xe6a7('0xd')][_0xe6a7('0x4')],'phonebar':0x2};if(_0x5abbef['query']&&_0x5abbef['query']['latest']){return git[_0xe6a7('0xe')]()[_0xe6a7('0xf')](function(_0x5b1066,_0x33f17e){_0x544af8[_0xe6a7('0x10')]=(_0x5b1066?module['exports'][_0xe6a7('0x4')]:_0x33f17e[_0xe6a7('0x10')])||_0xe6a7('0x11');return _0x29ac35[_0xe6a7('0x12')](0xc8)[_0xe6a7('0x13')](_0x544af8);});}else{return _0x29ac35[_0xe6a7('0x12')](0xc8)[_0xe6a7('0x13')](_0x544af8);}};exports[_0xe6a7('0xe')]=function(_0x4e43d3,_0x18d6ae){return git[_0xe6a7('0xe')](['origin','master'],function(_0x31d926){if(_0x31d926){logger[_0xe6a7('0x14')](_0x31d926);return _0x18d6ae[_0xe6a7('0x12')](0x1f4)[_0xe6a7('0x13')](_0x31d926);}logger[_0xe6a7('0x15')]('git\x20fetch');return _0x18d6ae[_0xe6a7('0x12')](0xc8)[_0xe6a7('0x13')]({'output':_0xe6a7('0x16')});});};exports[_0xe6a7('0x17')]=function(_0x535049,_0x44a338){return git[_0xe6a7('0x17')]([_0xe6a7('0x18'),_0xe6a7('0x19')],function(_0x1114e9){if(_0x1114e9){logger['error'](_0x1114e9);return _0x44a338['status'](0x1f4)[_0xe6a7('0x13')](_0x1114e9);}logger[_0xe6a7('0x15')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x44a338[_0xe6a7('0x12')](0xc8)[_0xe6a7('0x13')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x4b8575,_0x2cc242){exec(_0xe6a7('0x1a'),function(_0x219403,_0x98fd1e,_0x7e28a3){logger[_0xe6a7('0x15')](_0x98fd1e);logger[_0xe6a7('0x15')](_0x7e28a3);if(_0x219403){logger[_0xe6a7('0x14')](_0x219403);return _0x2cc242[_0xe6a7('0x12')](0x1f4)[_0xe6a7('0x13')](_0x219403);}return _0x2cc242['status'](0xc8)[_0xe6a7('0x13')]({'output':_0x98fd1e});});};exports[_0xe6a7('0x1b')]=function(_0x5a858d,_0xb5694b){return pm2[_0xe6a7('0x1b')](_0xe6a7('0x1c'))[_0xe6a7('0x1d')](function(_0x5d852c){logger['info'](_0xe6a7('0x1e'),_0x5d852c);return _0xb5694b[_0xe6a7('0x12')](0xc8)[_0xe6a7('0x13')]({'output':_0xe6a7('0x1f')});})[_0xe6a7('0x20')](function(_0x5ee0c2){logger[_0xe6a7('0x14')](_0x5ee0c2);return _0xb5694b['status'](0x1f4)[_0xe6a7('0x13')](_0x5ee0c2);});};exports[_0xe6a7('0x21')]=function(_0x40463e,_0x5c1720){var _0x3bf98c=fs[_0xe6a7('0x22')](path[_0xe6a7('0x23')](config[_0xe6a7('0x24')],_0xe6a7('0x25'),'migrations'));var _0x2be714=[];for(var _0x195748=0x0;_0x195748<_0x3bf98c[_0xe6a7('0x26')];_0x195748++){var _0x8a22d=_0x3bf98c[_0x195748][_0xe6a7('0x27')](_0xe6a7('0x28'),'');if(compareVersions(module[_0xe6a7('0xd')][_0xe6a7('0x4')],_0x8a22d)===-0x1){_0x2be714[_0xe6a7('0x29')](_0x8a22d);}}if(_0x2be714[_0xe6a7('0x26')]){var _0x5e9825=_0x2be714[_0xe6a7('0x2a')](compareVersions);var _0x4110c6=new Umzug({'storage':_0xe6a7('0x2b'),'storageOptions':{'model':db[_0xe6a7('0x2c')],'modelName':_0xe6a7('0x2c'),'columnName':_0xe6a7('0x4')},'migrations':{'params':[db[_0xe6a7('0x2b')][_0xe6a7('0x2d')](),db[_0xe6a7('0x2b')][_0xe6a7('0x2e')],function(){throw new Error(_0xe6a7('0x2f'));}],'path':path[_0xe6a7('0x23')](config[_0xe6a7('0x24')],_0xe6a7('0x25'),'migrations'),'pattern':/\.js$/}});_0x4110c6['up']({'migrations':_[_0xe6a7('0x30')](_0x5e9825,function(_0x2e79cb){return _0x2e79cb+_0xe6a7('0x28');})})['then'](function(){return _0x5c1720[_0xe6a7('0x12')](0xc8)[_0xe6a7('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xe6a7('0xd')][_0xe6a7('0x4')]+_0xe6a7('0x31')+_[_0xe6a7('0x32')](_0x5e9825),'migrations':_[_0xe6a7('0x23')](_0x5e9825)});})[_0xe6a7('0x20')](function(_0x27f35b){if(_0x27f35b instanceof db[_0xe6a7('0x2b')][_0xe6a7('0x33')]){return _0x5c1720[_0xe6a7('0x12')](0xc8)[_0xe6a7('0x13')]({'output':_0xe6a7('0x34')});}else{return _0x5c1720[_0xe6a7('0x12')](0x1f4)['json'](_0x27f35b);}});}else{return _0x5c1720[_0xe6a7('0x12')](0xc8)[_0xe6a7('0x13')]({'output':_0xe6a7('0x34')});}}; \ No newline at end of file +var _0x48d2=['latest','2.0.0','status','json','master','error','info','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','catch','migrations','readdirSync','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','root','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','fetch','tags'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0x48d2,0xc0));var _0x248d=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x48d2[_0x5608a3];return _0x1ed50a;};'use strict';var Umzug=require('umzug');var path=require(_0x248d('0x0'));var fs=require('fs');var _=require(_0x248d('0x1'));var pkginfo=require(_0x248d('0x2'))(module,_0x248d('0x3'));var compareVersions=require(_0x248d('0x4'));var exec=require(_0x248d('0x5'))[_0x248d('0x6')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x248d('0x7'));var logger=require(_0x248d('0x8'))(_0x248d('0x9'));var git=require(_0x248d('0xa'))(config['root']);exports[_0x248d('0xb')]=function(_0x56f5f0,_0xe5eed3){var _0xcf6ed7={'current':module[_0x248d('0xc')]['version'],'phonebar':0x2};if(_0x56f5f0['query']&&_0x56f5f0[_0x248d('0xd')]['latest']){return git[_0x248d('0xe')]()[_0x248d('0xf')](function(_0x46e14e,_0x1f6565){_0xcf6ed7['latest']=(_0x46e14e?module[_0x248d('0xc')]['version']:_0x1f6565[_0x248d('0x10')])||_0x248d('0x11');return _0xe5eed3[_0x248d('0x12')](0xc8)[_0x248d('0x13')](_0xcf6ed7);});}else{return _0xe5eed3[_0x248d('0x12')](0xc8)[_0x248d('0x13')](_0xcf6ed7);}};exports[_0x248d('0xe')]=function(_0xccb194,_0x4dca5f){return git[_0x248d('0xe')](['origin',_0x248d('0x14')],function(_0xc3617a){if(_0xc3617a){logger[_0x248d('0x15')](_0xc3617a);return _0x4dca5f[_0x248d('0x12')](0x1f4)[_0x248d('0x13')](_0xc3617a);}logger[_0x248d('0x16')]('git\x20fetch');return _0x4dca5f[_0x248d('0x12')](0xc8)[_0x248d('0x13')]({'output':_0x248d('0x17')});});};exports[_0x248d('0x18')]=function(_0x5e5b6b,_0x4c145f){return git[_0x248d('0x18')](['--hard','FETCH_HEAD'],function(_0x25fbf4){if(_0x25fbf4){logger[_0x248d('0x15')](_0x25fbf4);return _0x4c145f[_0x248d('0x12')](0x1f4)[_0x248d('0x13')](_0x25fbf4);}logger[_0x248d('0x16')](_0x248d('0x19'));return _0x4c145f[_0x248d('0x12')](0xc8)[_0x248d('0x13')]({'output':_0x248d('0x1a')});});};exports[_0x248d('0x1b')]=function(_0x1e2c06,_0x1992e8){exec(_0x248d('0x1c'),function(_0x27e4b4,_0x363ec4,_0x2f70ee){logger[_0x248d('0x16')](_0x363ec4);logger[_0x248d('0x16')](_0x2f70ee);if(_0x27e4b4){logger['error'](_0x27e4b4);return _0x1992e8[_0x248d('0x12')](0x1f4)[_0x248d('0x13')](_0x27e4b4);}return _0x1992e8['status'](0xc8)[_0x248d('0x13')]({'output':_0x363ec4});});};exports[_0x248d('0x1d')]=function(_0x20b063,_0x4e6b26){return pm2[_0x248d('0x1d')](_0x248d('0x1e'))[_0x248d('0x1f')](function(_0x147262){logger['info']('pm2\x20restart\x20motion\x20%s',_0x147262);return _0x4e6b26[_0x248d('0x12')](0xc8)[_0x248d('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x248d('0x20')](function(_0x288919){logger[_0x248d('0x15')](_0x288919);return _0x4e6b26[_0x248d('0x12')](0x1f4)[_0x248d('0x13')](_0x288919);});};exports[_0x248d('0x21')]=function(_0x309392,_0x118270){var _0x1cd56c=fs[_0x248d('0x22')](path['join'](config['root'],'server',_0x248d('0x21')));var _0xe064d0=[];for(var _0x175d5c=0x0;_0x175d5c<_0x1cd56c['length'];_0x175d5c++){var _0xa0f991=_0x1cd56c[_0x175d5c]['replace'](_0x248d('0x23'),'');if(compareVersions(module[_0x248d('0xc')][_0x248d('0x3')],_0xa0f991)===-0x1){_0xe064d0[_0x248d('0x24')](_0xa0f991);}}if(_0xe064d0[_0x248d('0x25')]){var _0x15e0e3=_0xe064d0[_0x248d('0x26')](compareVersions);var _0x4ce9cd=new Umzug({'storage':_0x248d('0x27'),'storageOptions':{'model':db[_0x248d('0x28')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x248d('0x27')][_0x248d('0x29')](),db[_0x248d('0x27')][_0x248d('0x2a')],function(){throw new Error(_0x248d('0x2b'));}],'path':path[_0x248d('0x2c')](config[_0x248d('0x2d')],_0x248d('0x2e'),'migrations'),'pattern':/\.js$/}});_0x4ce9cd['up']({'migrations':_[_0x248d('0x2f')](_0x15e0e3,function(_0x14cc98){return _0x14cc98+_0x248d('0x23');})})[_0x248d('0x1f')](function(){return _0x118270['status'](0xc8)[_0x248d('0x13')]({'output':_0x248d('0x30')+module['exports'][_0x248d('0x3')]+_0x248d('0x31')+_[_0x248d('0x32')](_0x15e0e3),'migrations':_['join'](_0x15e0e3)});})[_0x248d('0x20')](function(_0x5eda90){if(_0x5eda90 instanceof db[_0x248d('0x27')]['UniqueConstraintError']){return _0x118270[_0x248d('0x12')](0xc8)[_0x248d('0x13')]({'output':_0x248d('0x33')});}else{return _0x118270[_0x248d('0x12')](0x1f4)[_0x248d('0x13')](_0x5eda90);}});}else{return _0x118270[_0x248d('0x12')](0xc8)['json']({'output':_0x248d('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index cdc0adc..e513699 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 _0x9d77=['create','put','update','/:id','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','show','post'];(function(_0x594e9d,_0x883433){var _0x2f4839=function(_0x28e1d4){while(--_0x28e1d4){_0x594e9d['push'](_0x594e9d['shift']());}};_0x2f4839(++_0x883433);}(_0x9d77,0x1ce));var _0x79d7=function(_0x261f3e,_0x12c296){_0x261f3e=_0x261f3e-0x0;var _0x193e98=_0x9d77[_0x261f3e];return _0x193e98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x79d7('0x0'));var timeout=require(_0x79d7('0x1'));var express=require('express');var router=express[_0x79d7('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x79d7('0x3'));var config=require(_0x79d7('0x4'));var controller=require(_0x79d7('0x5'));router['get']('/',auth[_0x79d7('0x6')](),controller[_0x79d7('0x7')]);router[_0x79d7('0x8')](_0x79d7('0x9'),auth[_0x79d7('0x6')](),controller[_0x79d7('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x79d7('0xb')]);router[_0x79d7('0xc')]('/',auth[_0x79d7('0x6')](),controller[_0x79d7('0xd')]);router[_0x79d7('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x79d7('0xf')]);router['delete'](_0x79d7('0x10'),auth['isAuthenticated'](),controller[_0x79d7('0x11')]);module[_0x79d7('0x12')]=router; \ No newline at end of file +var _0xd1d3=['get','describe','/:id','show','put','destroy','util','path','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index'];(function(_0x9bc1b5,_0x2a0313){var _0x35e68e=function(_0x58dbc6){while(--_0x58dbc6){_0x9bc1b5['push'](_0x9bc1b5['shift']());}};_0x35e68e(++_0x2a0313);}(_0xd1d3,0x68));var _0x3d1d=function(_0x18ebf7,_0x571503){_0x18ebf7=_0x18ebf7-0x0;var _0x9cd215=_0xd1d3[_0x18ebf7];return _0x9cd215;};'use strict';var multer=require('multer');var util=require(_0x3d1d('0x0'));var path=require(_0x3d1d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3d1d('0x2'));var auth=require(_0x3d1d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3d1d('0x4'));var controller=require(_0x3d1d('0x5'));router['get']('/',auth[_0x3d1d('0x6')](),controller[_0x3d1d('0x7')]);router[_0x3d1d('0x8')]('/describe',auth[_0x3d1d('0x6')](),controller[_0x3d1d('0x9')]);router['get'](_0x3d1d('0xa'),auth['isAuthenticated'](),controller[_0x3d1d('0xb')]);router['post']('/',auth[_0x3d1d('0x6')](),controller['create']);router[_0x3d1d('0xc')](_0x3d1d('0xa'),auth[_0x3d1d('0x6')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3d1d('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 6cee3c4..852ae01 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 _0x02a7=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','BOOLEAN'];(function(_0x57e554,_0x22d31d){var _0x5b5906=function(_0x4ee66b){while(--_0x4ee66b){_0x57e554['push'](_0x57e554['shift']());}};_0x5b5906(++_0x22d31d);}(_0x02a7,0x1a6));var _0x702a=function(_0x5c3072,_0x13dc1e){_0x5c3072=_0x5c3072-0x0;var _0x507c29=_0x02a7[_0x5c3072];return _0x507c29;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'type':{'type':Sequelize[_0x702a('0x1')]},'uniqueid':{'type':Sequelize[_0x702a('0x1')]},'calleridnum':{'type':Sequelize[_0x702a('0x1')]},'calleridname':{'type':Sequelize[_0x702a('0x1')]},'queue':{'type':Sequelize[_0x702a('0x1')]},'interface':{'type':Sequelize[_0x702a('0x1')]},'membername':{'type':Sequelize[_0x702a('0x1')]},'agentcalledAt':{'type':Sequelize[_0x702a('0x2')]},'agentconnectAt':{'type':Sequelize[_0x702a('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x702a('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x702a('0x1')]},'lastevent':{'type':Sequelize[_0x702a('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x702a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x702a('0x1')]},'connectedlinenum':{'type':Sequelize[_0x702a('0x1')]},'connectedlinename':{'type':Sequelize[_0x702a('0x1')]},'language':{'type':Sequelize[_0x702a('0x1')]},'accountcode':{'type':Sequelize[_0x702a('0x1')]},'context':{'type':Sequelize[_0x702a('0x1')]},'exten':{'type':Sequelize[_0x702a('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x702a('0x1')]},'destchannelstate':{'type':Sequelize[_0x702a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x702a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x702a('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x702a('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x702a('0x1')]},'destlanguage':{'type':Sequelize[_0x702a('0x1')]},'destaccountcode':{'type':Sequelize[_0x702a('0x1')]},'destcontext':{'type':Sequelize[_0x702a('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x702a('0x1')]},'destuniqueid':{'type':Sequelize[_0x702a('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x702a('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x702a('0x1')]},'transfer':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x702a('0x1')],'comment':_0x702a('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x702a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x55f1=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x1f6a84,_0x44a188){var _0x14da8a=function(_0x4033b9){while(--_0x4033b9){_0x1f6a84['push'](_0x1f6a84['shift']());}};_0x14da8a(++_0x44a188);}(_0x55f1,0x9b));var _0x155f=function(_0x38d5fb,_0x4032b7){_0x38d5fb=_0x38d5fb-0x0;var _0x266b61=_0x55f1[_0x38d5fb];return _0x266b61;};'use strict';var Sequelize=require(_0x155f('0x0'));module['exports']={'type':{'type':Sequelize[_0x155f('0x1')]},'uniqueid':{'type':Sequelize[_0x155f('0x1')]},'calleridnum':{'type':Sequelize[_0x155f('0x1')]},'calleridname':{'type':Sequelize[_0x155f('0x1')]},'queue':{'type':Sequelize[_0x155f('0x1')]},'interface':{'type':Sequelize[_0x155f('0x1')]},'membername':{'type':Sequelize[_0x155f('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x155f('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x155f('0x2')]},'holdtime':{'type':Sequelize[_0x155f('0x3')]},'agentcomplete':{'type':Sequelize[_0x155f('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x155f('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x155f('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x155f('0x3')]},'agentacw':{'type':Sequelize[_0x155f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x155f('0x3')]},'reason':{'type':Sequelize[_0x155f('0x1')]},'lastevent':{'type':Sequelize[_0x155f('0x1')]},'channel':{'type':Sequelize[_0x155f('0x1')]},'channelstate':{'type':Sequelize[_0x155f('0x3')]},'channelstatedesc':{'type':Sequelize[_0x155f('0x1')]},'connectedlinenum':{'type':Sequelize[_0x155f('0x1')]},'connectedlinename':{'type':Sequelize[_0x155f('0x1')]},'language':{'type':Sequelize[_0x155f('0x1')]},'accountcode':{'type':Sequelize[_0x155f('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x155f('0x1')]},'priority':{'type':Sequelize[_0x155f('0x1')]},'destchannel':{'type':Sequelize[_0x155f('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x155f('0x1')]},'destcalleridname':{'type':Sequelize[_0x155f('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x155f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x155f('0x1')]},'destlanguage':{'type':Sequelize[_0x155f('0x1')]},'destaccountcode':{'type':Sequelize[_0x155f('0x1')]},'destcontext':{'type':Sequelize[_0x155f('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x155f('0x1')]},'destuniqueid':{'type':Sequelize[_0x155f('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x155f('0x1')]},'transfer':{'type':Sequelize[_0x155f('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x155f('0x1')],'comment':_0x155f('0x5')},'transferexten':{'type':Sequelize[_0x155f('0x1')]},'transferuniqueid':{'type':Sequelize[_0x155f('0x1')]},'agententerreason':{'type':Sequelize[_0x155f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index a68d479..e3e2864 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(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 a712958..22543e7 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 _0x46ed=['bluebird','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','api','moment'];(function(_0x190478,_0x5c634a){var _0x2f18ae=function(_0x3213d6){while(--_0x3213d6){_0x190478['push'](_0x190478['shift']());}};_0x2f18ae(++_0x5c634a);}(_0x46ed,0x168));var _0xd46e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x46ed[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[{'fields':[_0xd46e('0xc'),_0xd46e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb57=['define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','api','bluebird','path','rimraf','./voiceAgentReport.attributes','exports'];(function(_0x24c178,_0x2e588b){var _0x35a2d8=function(_0xfe775c){while(--_0xfe775c){_0x24c178['push'](_0x24c178['shift']());}};_0x35a2d8(++_0x2e588b);}(_0xcb57,0xa1));var _0x7cb5=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xcb57[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x7cb5('0x0'));var util=require(_0x7cb5('0x1'));var logger=require('../../config/logger')(_0x7cb5('0x2'));var moment=require('moment');var BPromise=require(_0x7cb5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cb5('0x4'));var rimraf=require(_0x7cb5('0x5'));var config=require('../../config/environment');var attributes=require(_0x7cb5('0x6'));module[_0x7cb5('0x7')]=function(_0x1aafb5,_0x4e036d){return _0x1aafb5[_0x7cb5('0x8')](_0x7cb5('0x9'),attributes,{'tableName':_0x7cb5('0xa'),'paranoid':![],'indexes':[{'fields':[_0x7cb5('0xb'),_0x7cb5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 9983a95..bc98867 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 _0x6645=['client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','UpdateVoiceAgentReport','update','where','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x261631,_0x4749d8){var _0x4067ad=function(_0x5a3d6c){while(--_0x5a3d6c){_0x261631['push'](_0x261631['shift']());}};_0x4067ad(++_0x4749d8);}(_0x6645,0xe0));var _0x5664=function(_0x5835df,_0x4a82af){_0x5835df=_0x5835df-0x0;var _0xa0b1d6=_0x6645[_0x5835df];return _0xa0b1d6;};'use strict';var _=require(_0x5664('0x0'));var util=require(_0x5664('0x1'));var moment=require(_0x5664('0x2'));var BPromise=require('bluebird');var rs=require(_0x5664('0x3'));var fs=require('fs');var Redis=require(_0x5664('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5664('0x5'));var logger=require(_0x5664('0x6'))(_0x5664('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5664('0x8')][_0x5664('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d3163,_0x12b7e1,_0x5bf0e5){return new BPromise(function(_0x9e7a4b,_0x2d8dec){return client[_0x5664('0xa')](_0x4d3163,_0x5bf0e5)[_0x5664('0xb')](function(_0x4a0562){logger[_0x5664('0xc')](_0x5664('0xd'),_0x12b7e1,_0x5664('0xe'));logger['debug'](_0x5664('0xf'),_0x12b7e1,'request\x20sent',JSON['stringify'](_0x4a0562));if(_0x4a0562[_0x5664('0x10')]){if(_0x4a0562[_0x5664('0x10')][_0x5664('0x11')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x12b7e1,_0x4a0562[_0x5664('0x10')][_0x5664('0x12')]);return _0x2d8dec(_0x4a0562['error'][_0x5664('0x12')]);}logger[_0x5664('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x12b7e1,_0x4a0562[_0x5664('0x10')][_0x5664('0x12')]);return _0x9e7a4b(_0x4a0562[_0x5664('0x10')][_0x5664('0x12')]);}else{logger[_0x5664('0xc')](_0x5664('0xd'),_0x12b7e1,_0x5664('0xe'));_0x9e7a4b(_0x4a0562['result'][_0x5664('0x12')]);}})[_0x5664('0x13')](function(_0x2289c8){logger[_0x5664('0x10')](_0x5664('0xd'),_0x12b7e1,_0x2289c8);_0x2d8dec(_0x2289c8);});});}exports[_0x5664('0x14')]=function(_0x444b1b){var _0x168b23=this;return new Promise(function(_0x1eabcd,_0x232718){return db[_0x5664('0x15')]['create'](_0x444b1b[_0x5664('0x16')],{'raw':_0x444b1b['options']?_0x444b1b[_0x5664('0x17')][_0x5664('0x18')]===undefined?!![]:![]:!![]})[_0x5664('0xb')](function(_0xc4b8c0){logger[_0x5664('0xc')]('CreateVoiceAgentReport',_0x444b1b);logger['debug']('CreateVoiceAgentReport',_0x444b1b,JSON['stringify'](_0xc4b8c0));_0x1eabcd(_0xc4b8c0);})[_0x5664('0x13')](function(_0x3640d9){logger[_0x5664('0x10')](_0x5664('0x14'),_0x3640d9[_0x5664('0x12')],_0x444b1b);_0x232718(_0x168b23['error'](0x1f4,_0x3640d9[_0x5664('0x12')]));});});};exports[_0x5664('0x19')]=function(_0x5d6eaf){var _0x5a382a=this;return new Promise(function(_0x5b44b0,_0x3e3b00){return db[_0x5664('0x15')][_0x5664('0x1a')](_0x5d6eaf['body'],{'raw':_0x5d6eaf[_0x5664('0x17')]?_0x5d6eaf[_0x5664('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d6eaf[_0x5664('0x17')]?_0x5d6eaf[_0x5664('0x17')][_0x5664('0x1b')]||null:null,'attributes':_0x5d6eaf['options']?_0x5d6eaf[_0x5664('0x17')]['attributes']||null:null,'limit':_0x5d6eaf[_0x5664('0x17')]?_0x5d6eaf[_0x5664('0x17')]['limit']||null:null})[_0x5664('0xb')](function(_0x300b1d){logger[_0x5664('0xc')](_0x5664('0x19'),_0x5d6eaf);logger['debug'](_0x5664('0x19'),_0x5d6eaf,JSON[_0x5664('0x1c')](_0x300b1d));_0x5b44b0(_0x300b1d);})['catch'](function(_0x39e7f3){logger[_0x5664('0x10')](_0x5664('0x19'),_0x39e7f3['message'],_0x5d6eaf);_0x3e3b00(_0x5a382a[_0x5664('0x10')](0x1f4,_0x39e7f3[_0x5664('0x12')]));});});}; \ No newline at end of file +var _0x15ed=['attributes','limit','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateVoiceAgentReport','create','body','options','raw','debug','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','where'];(function(_0x378487,_0x1fdc2c){var _0x3bb63b=function(_0x38c2e0){while(--_0x38c2e0){_0x378487['push'](_0x378487['shift']());}};_0x3bb63b(++_0x1fdc2c);}(_0x15ed,0x8b));var _0xd15e=function(_0x2067e9,_0x5e6a97){_0x2067e9=_0x2067e9-0x0;var _0x280ce4=_0x15ed[_0x2067e9];return _0x280ce4;};'use strict';var _=require(_0xd15e('0x0'));var util=require(_0xd15e('0x1'));var moment=require('moment');var BPromise=require(_0xd15e('0x2'));var rs=require(_0xd15e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd15e('0x4'))['db'];var utils=require(_0xd15e('0x5'));var logger=require(_0xd15e('0x6'))(_0xd15e('0x7'));var config=require(_0xd15e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd15e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xca0c9,_0x582a32,_0x405935){return new BPromise(function(_0x26c0d6,_0x253788){return client[_0xd15e('0xa')](_0xca0c9,_0x405935)[_0xd15e('0xb')](function(_0x51bc2d){logger[_0xd15e('0xc')](_0xd15e('0xd'),_0x582a32,'request\x20sent');logger['debug'](_0xd15e('0xe'),_0x582a32,_0xd15e('0xf'),JSON['stringify'](_0x51bc2d));if(_0x51bc2d[_0xd15e('0x10')]){if(_0x51bc2d[_0xd15e('0x10')][_0xd15e('0x11')]===0x1f4){logger[_0xd15e('0x10')](_0xd15e('0xd'),_0x582a32,_0x51bc2d[_0xd15e('0x10')]['message']);return _0x253788(_0x51bc2d[_0xd15e('0x10')]['message']);}logger[_0xd15e('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x582a32,_0x51bc2d[_0xd15e('0x10')][_0xd15e('0x12')]);return _0x26c0d6(_0x51bc2d[_0xd15e('0x10')]['message']);}else{logger[_0xd15e('0xc')](_0xd15e('0xd'),_0x582a32,'request\x20sent');_0x26c0d6(_0x51bc2d[_0xd15e('0x13')][_0xd15e('0x12')]);}})['catch'](function(_0x190a62){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x582a32,_0x190a62);_0x253788(_0x190a62);});});}exports[_0xd15e('0x14')]=function(_0x4d43c4){var _0x1ac2f5=this;return new Promise(function(_0x46e54a,_0x13f649){return db['VoiceAgentReport'][_0xd15e('0x15')](_0x4d43c4[_0xd15e('0x16')],{'raw':_0x4d43c4[_0xd15e('0x17')]?_0x4d43c4['options'][_0xd15e('0x18')]===undefined?!![]:![]:!![]})[_0xd15e('0xb')](function(_0x49faf){logger['info'](_0xd15e('0x14'),_0x4d43c4);logger[_0xd15e('0x19')](_0xd15e('0x14'),_0x4d43c4,JSON['stringify'](_0x49faf));_0x46e54a(_0x49faf);})[_0xd15e('0x1a')](function(_0x27ab57){logger[_0xd15e('0x10')]('CreateVoiceAgentReport',_0x27ab57[_0xd15e('0x12')],_0x4d43c4);_0x13f649(_0x1ac2f5[_0xd15e('0x10')](0x1f4,_0x27ab57[_0xd15e('0x12')]));});});};exports[_0xd15e('0x1b')]=function(_0x3cc983){var _0x201013=this;return new Promise(function(_0x225ae6,_0x10ecbf){return db[_0xd15e('0x1c')][_0xd15e('0x1d')](_0x3cc983[_0xd15e('0x16')],{'raw':_0x3cc983[_0xd15e('0x17')]?_0x3cc983[_0xd15e('0x17')][_0xd15e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cc983[_0xd15e('0x17')]?_0x3cc983['options'][_0xd15e('0x1e')]||null:null,'attributes':_0x3cc983[_0xd15e('0x17')]?_0x3cc983[_0xd15e('0x17')][_0xd15e('0x1f')]||null:null,'limit':_0x3cc983[_0xd15e('0x17')]?_0x3cc983[_0xd15e('0x17')][_0xd15e('0x20')]||null:null})['then'](function(_0x44e833){logger[_0xd15e('0xc')](_0xd15e('0x1b'),_0x3cc983);logger[_0xd15e('0x19')]('UpdateVoiceAgentReport',_0x3cc983,JSON[_0xd15e('0x21')](_0x44e833));_0x225ae6(_0x44e833);})['catch'](function(_0x4d4d45){logger[_0xd15e('0x10')]('UpdateVoiceAgentReport',_0x4d4d45['message'],_0x3cc983);_0x10ecbf(_0x201013[_0xd15e('0x10')](0x1f4,_0x4d4d45[_0xd15e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 2c6b60b..4dac9b6 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 _0x9b67=['../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x36184b,_0x58bc1c){var _0x2d7246=function(_0x5557a2){while(--_0x5557a2){_0x36184b['push'](_0x36184b['shift']());}};_0x2d7246(++_0x58bc1c);}(_0x9b67,0xf6));var _0x79b6=function(_0x54f22a,_0x100ac9){_0x54f22a=_0x54f22a-0x0;var _0x5503bd=_0x9b67[_0x54f22a];return _0x5503bd;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var fs_extra=require(_0x79b6('0x5'));var auth=require(_0x79b6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79b6('0x7'));router[_0x79b6('0x8')]('/',auth[_0x79b6('0x9')](),controller[_0x79b6('0xa')]);router[_0x79b6('0x8')](_0x79b6('0xb'),auth[_0x79b6('0x9')](),controller['describe']);router[_0x79b6('0x8')](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller[_0x79b6('0xd')]);router[_0x79b6('0xe')]('/',auth['isAuthenticated'](),controller[_0x79b6('0xf')]);router[_0x79b6('0x10')](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller['update']);router['delete'](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller[_0x79b6('0x11')]);module['exports']=router; \ No newline at end of file +var _0x98a8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports'];(function(_0x2ccf59,_0x196b84){var _0x3c4cb2=function(_0x22d8d7){while(--_0x22d8d7){_0x2ccf59['push'](_0x2ccf59['shift']());}};_0x3c4cb2(++_0x196b84);}(_0x98a8,0x12c));var _0x898a=function(_0x2332f9,_0x301391){_0x2332f9=_0x2332f9-0x0;var _0x58f5f9=_0x98a8[_0x2332f9];return _0x58f5f9;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')]('/',auth[_0x898a('0xb')](),controller['index']);router[_0x898a('0xa')]('/describe',auth[_0x898a('0xb')](),controller['describe']);router[_0x898a('0xa')](_0x898a('0xc'),auth[_0x898a('0xb')](),controller[_0x898a('0xd')]);router[_0x898a('0xe')]('/',auth[_0x898a('0xb')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x11')]);router['delete'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x12')]);module[_0x898a('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 de9e904..09c1256 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 _0xe59f=['TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','internal','outbound'];(function(_0x515a35,_0x4f9db5){var _0x895530=function(_0x46c590){while(--_0x46c590){_0x515a35['push'](_0x515a35['shift']());}};_0x895530(++_0x4f9db5);}(_0xe59f,0x1c5));var _0xfe59=function(_0x55cc83,_0x492a0b){_0x55cc83=_0x55cc83-0x0;var _0x39880e=_0xe59f[_0x55cc83];return _0x39880e;};'use strict';var Sequelize=require(_0xfe59('0x0'));module[_0xfe59('0x1')]={'uniqueid':{'type':Sequelize[_0xfe59('0x2')]},'type':{'type':Sequelize[_0xfe59('0x3')]('inbound',_0xfe59('0x4'),_0xfe59('0x5'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize[_0xfe59('0x2')]},'accountcode':{'type':Sequelize[_0xfe59('0x2')]},'source':{'type':Sequelize[_0xfe59('0x2')]},'destination':{'type':Sequelize[_0xfe59('0x2')]},'destinationcontext':{'type':Sequelize[_0xfe59('0x2')]},'callerid':{'type':Sequelize[_0xfe59('0x2')]},'channel':{'type':Sequelize[_0xfe59('0x2')]},'destinationchannel':{'type':Sequelize[_0xfe59('0x2')]},'lastapplication':{'type':Sequelize[_0xfe59('0x2')]},'lastdata':{'type':Sequelize[_0xfe59('0x6')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xfe59('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xfe59('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xfe59('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xfe59('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xfe59('0x2')]},'userDisposition':{'type':Sequelize[_0xfe59('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xfe59('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xfe59('0x2')]},'note':{'type':Sequelize[_0xfe59('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xfe59('0x2')]}}; \ No newline at end of file +var _0xfc37=['ENUM','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x2998b4,_0x22b607){var _0x50ed62=function(_0x3678f5){while(--_0x3678f5){_0x2998b4['push'](_0x2998b4['shift']());}};_0x50ed62(++_0x22b607);}(_0xfc37,0x17d));var _0x7fc3=function(_0x33f795,_0xa86dea){_0x33f795=_0x33f795-0x0;var _0x334470=_0xfc37[_0x33f795];return _0x334470;};'use strict';var Sequelize=require(_0x7fc3('0x0'));module[_0x7fc3('0x1')]={'uniqueid':{'type':Sequelize[_0x7fc3('0x2')]},'type':{'type':Sequelize[_0x7fc3('0x3')]('inbound',_0x7fc3('0x4'),_0x7fc3('0x5'),_0x7fc3('0x6'),_0x7fc3('0x7'),_0x7fc3('0x8'))},'tag':{'type':Sequelize[_0x7fc3('0x2')]},'accountcode':{'type':Sequelize[_0x7fc3('0x2')]},'source':{'type':Sequelize[_0x7fc3('0x2')]},'destination':{'type':Sequelize[_0x7fc3('0x2')]},'destinationcontext':{'type':Sequelize[_0x7fc3('0x2')]},'callerid':{'type':Sequelize[_0x7fc3('0x2')]},'channel':{'type':Sequelize[_0x7fc3('0x2')]},'destinationchannel':{'type':Sequelize[_0x7fc3('0x2')]},'lastapplication':{'type':Sequelize[_0x7fc3('0x2')]},'lastdata':{'type':Sequelize[_0x7fc3('0x9')]},'starttime':{'type':Sequelize[_0x7fc3('0xa')]},'systemanswertime':{'type':Sequelize[_0x7fc3('0xa')]},'answertime':{'type':Sequelize[_0x7fc3('0xa')]},'endtime':{'type':Sequelize[_0x7fc3('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x7fc3('0xb')]},'mohtime':{'type':Sequelize[_0x7fc3('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7fc3('0x2')]},'userfield':{'type':Sequelize[_0x7fc3('0x2')]},'userDisposition':{'type':Sequelize[_0x7fc3('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x7fc3('0x2')]},'note':{'type':Sequelize[_0x7fc3('0x2')]},'prefix':{'type':Sequelize[_0x7fc3('0x2')]},'routeid':{'type':Sequelize[_0x7fc3('0xb')]},'sipcallid':{'type':Sequelize[_0x7fc3('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 9e020c8..25ac797 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0xadb5,0xad));var _0x5adb=function(_0x993451,_0x1c5da8){_0x993451=_0x993451-0x0;var _0x5df1cf=_0xadb5[_0x993451];return _0x5df1cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x431952,_0x291145){var _0x351a7c=function(_0x1c8f39){while(--_0x1c8f39){_0x431952['push'](_0x431952['shift']());}};_0x351a7c(++_0x291145);}(_0xdb28,0x106));var _0x8db2=function(_0x2d5c51,_0x407aee){_0x2d5c51=_0x2d5c51-0x0;var _0x458abc=_0xdb28[_0x2d5c51];return _0x458abc;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 8e1d698..2f06691 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 _0x4d23=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x217154,_0x2c85a9){var _0x4a0702=function(_0x42a05c){while(--_0x42a05c){_0x217154['push'](_0x217154['shift']());}};_0x4a0702(++_0x2c85a9);}(_0x4d23,0x12c));var _0x34d2=function(_0x1182b2,_0x51f6bb){_0x1182b2=_0x1182b2-0x0;var _0x4364dc=_0x4d23[_0x1182b2];return _0x4364dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x34d2('0x0'))(_0x34d2('0x1'));var moment=require(_0x34d2('0x2'));var BPromise=require(_0x34d2('0x3'));var rp=require(_0x34d2('0x4'));var fs=require('fs');var path=require(_0x34d2('0x5'));var rimraf=require(_0x34d2('0x6'));var config=require(_0x34d2('0x7'));var attributes=require(_0x34d2('0x8'));module[_0x34d2('0x9')]=function(_0x401beb,_0x56cf21){return _0x401beb[_0x34d2('0xa')](_0x34d2('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2141=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x48f62f,_0x585cf7){var _0x158dfb=function(_0x2df350){while(--_0x2df350){_0x48f62f['push'](_0x48f62f['shift']());}};_0x158dfb(++_0x585cf7);}(_0x2141,0x1ba));var _0x1214=function(_0x20db8d,_0x39a561){_0x20db8d=_0x20db8d-0x0;var _0x57ef96=_0x2141[_0x20db8d];return _0x57ef96;};'use strict';var _=require(_0x1214('0x0'));var util=require(_0x1214('0x1'));var logger=require(_0x1214('0x2'))(_0x1214('0x3'));var moment=require(_0x1214('0x4'));var BPromise=require(_0x1214('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1214('0x6'));var config=require(_0x1214('0x7'));var attributes=require(_0x1214('0x8'));module[_0x1214('0x9')]=function(_0xf2eb34,_0x2c8a69){return _0xf2eb34[_0x1214('0xa')](_0x1214('0xb'),attributes,{'tableName':_0x1214('0xc'),'paranoid':![],'indexes':[{'fields':[_0x1214('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 03b4e67..3d05a20 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 _0xd0a8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceCallReport','findAll','options','raw','attributes','include','model','map','CreateVoiceCallReport','VoiceCallReport','body','UpdateVoiceCallReport','where','limit','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x437f5a,_0x21a929){var _0x1d6636=function(_0x4e48ca){while(--_0x4e48ca){_0x437f5a['push'](_0x437f5a['shift']());}};_0x1d6636(++_0x21a929);}(_0xd0a8,0x148));var _0x8d0a=function(_0x422654,_0x44cfd4){_0x422654=_0x422654-0x0;var _0x466d2d=_0xd0a8[_0x422654];return _0x466d2d;};'use strict';var _=require('lodash');var util=require(_0x8d0a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8d0a('0x1'));var fs=require('fs');var Redis=require(_0x8d0a('0x2'));var db=require(_0x8d0a('0x3'))['db'];var utils=require(_0x8d0a('0x4'));var logger=require(_0x8d0a('0x5'))(_0x8d0a('0x6'));var config=require(_0x8d0a('0x7'));var jayson=require(_0x8d0a('0x8'));var client=jayson[_0x8d0a('0x9')][_0x8d0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57dda8,_0x4a635e,_0x45ee64){return new BPromise(function(_0x10d9c2,_0x3f19aa){return client['request'](_0x57dda8,_0x45ee64)[_0x8d0a('0xb')](function(_0x56cb7d){logger['info'](_0x8d0a('0xc'),_0x4a635e,'request\x20sent');logger[_0x8d0a('0xd')](_0x8d0a('0xe'),_0x4a635e,_0x8d0a('0xf'),JSON[_0x8d0a('0x10')](_0x56cb7d));if(_0x56cb7d['error']){if(_0x56cb7d[_0x8d0a('0x11')][_0x8d0a('0x12')]===0x1f4){logger['error'](_0x8d0a('0xc'),_0x4a635e,_0x56cb7d[_0x8d0a('0x11')][_0x8d0a('0x13')]);return _0x3f19aa(_0x56cb7d[_0x8d0a('0x11')][_0x8d0a('0x13')]);}logger[_0x8d0a('0x11')](_0x8d0a('0xc'),_0x4a635e,_0x56cb7d[_0x8d0a('0x11')][_0x8d0a('0x13')]);return _0x10d9c2(_0x56cb7d['error'][_0x8d0a('0x13')]);}else{logger[_0x8d0a('0x14')](_0x8d0a('0xc'),_0x4a635e,'request\x20sent');_0x10d9c2(_0x56cb7d[_0x8d0a('0x15')]['message']);}})[_0x8d0a('0x16')](function(_0x2b1547){logger[_0x8d0a('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x4a635e,_0x2b1547);_0x3f19aa(_0x2b1547);});});}exports[_0x8d0a('0x17')]=function(_0x376941){var _0xf9396c=this;return new Promise(function(_0x771ca4,_0x35afe5){return db['VoiceCallReport'][_0x8d0a('0x18')]({'raw':_0x376941[_0x8d0a('0x19')]?_0x376941[_0x8d0a('0x19')][_0x8d0a('0x1a')]===undefined?!![]:![]:!![],'where':_0x376941[_0x8d0a('0x19')]?_0x376941[_0x8d0a('0x19')]['where']||null:null,'attributes':_0x376941[_0x8d0a('0x19')]?_0x376941[_0x8d0a('0x19')][_0x8d0a('0x1b')]||null:null,'limit':_0x376941[_0x8d0a('0x19')]?_0x376941[_0x8d0a('0x19')]['limit']||null:null,'include':_0x376941[_0x8d0a('0x19')]?_0x376941['options'][_0x8d0a('0x1c')]?_['map'](_0x376941[_0x8d0a('0x19')][_0x8d0a('0x1c')],function(_0x432cd2){return{'model':db[_0x432cd2[_0x8d0a('0x1d')]],'as':_0x432cd2['as'],'attributes':_0x432cd2[_0x8d0a('0x1b')],'include':_0x432cd2[_0x8d0a('0x1c')]?_['map'](_0x432cd2[_0x8d0a('0x1c')],function(_0x407900){return{'model':db[_0x407900['model']],'as':_0x407900['as'],'attributes':_0x407900[_0x8d0a('0x1b')],'include':_0x407900['include']?_[_0x8d0a('0x1e')](_0x407900[_0x8d0a('0x1c')],function(_0x37a9c7){return{'model':db[_0x37a9c7['model']],'as':_0x37a9c7['as'],'attributes':_0x37a9c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x8d0a('0xb')](function(_0x27f171){logger[_0x8d0a('0x14')](_0x8d0a('0x17'),_0x376941);logger['debug'](_0x8d0a('0x17'),_0x376941,JSON[_0x8d0a('0x10')](_0x27f171));_0x771ca4(_0x27f171);})[_0x8d0a('0x16')](function(_0x14a25d){logger[_0x8d0a('0x11')](_0x8d0a('0x17'),_0x14a25d['message'],_0x376941);_0x35afe5(_0xf9396c[_0x8d0a('0x11')](0x1f4,_0x14a25d['message']));});});};exports[_0x8d0a('0x1f')]=function(_0x3c9f70){var _0x7bb5a8=this;return new Promise(function(_0x5bd96d,_0x2c0f9f){return db[_0x8d0a('0x20')]['create'](_0x3c9f70[_0x8d0a('0x21')],{'raw':_0x3c9f70[_0x8d0a('0x19')]?_0x3c9f70['options'][_0x8d0a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1969fe){logger[_0x8d0a('0x14')](_0x8d0a('0x1f'),_0x3c9f70);logger['debug'](_0x8d0a('0x1f'),_0x3c9f70,JSON[_0x8d0a('0x10')](_0x1969fe));_0x5bd96d(_0x1969fe);})[_0x8d0a('0x16')](function(_0x3b414c){logger['error']('CreateVoiceCallReport',_0x3b414c[_0x8d0a('0x13')],_0x3c9f70);_0x2c0f9f(_0x7bb5a8[_0x8d0a('0x11')](0x1f4,_0x3b414c['message']));});});};exports[_0x8d0a('0x22')]=function(_0x208969){var _0x18d781=this;return new Promise(function(_0x37ed61,_0x3584f6){return db[_0x8d0a('0x20')]['update'](_0x208969[_0x8d0a('0x21')],{'raw':_0x208969['options']?_0x208969[_0x8d0a('0x19')][_0x8d0a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x208969[_0x8d0a('0x19')]?_0x208969[_0x8d0a('0x19')][_0x8d0a('0x23')]||null:null,'attributes':_0x208969[_0x8d0a('0x19')]?_0x208969['options'][_0x8d0a('0x1b')]||null:null,'limit':_0x208969[_0x8d0a('0x19')]?_0x208969[_0x8d0a('0x19')][_0x8d0a('0x24')]||null:null})['then'](function(_0x405e95){logger[_0x8d0a('0x14')]('UpdateVoiceCallReport',_0x208969);logger[_0x8d0a('0xd')](_0x8d0a('0x22'),_0x208969,JSON[_0x8d0a('0x10')](_0x405e95));_0x37ed61(_0x405e95);})[_0x8d0a('0x16')](function(_0x4ed3df){logger['error'](_0x8d0a('0x22'),_0x4ed3df['message'],_0x208969);_0x3584f6(_0x18d781[_0x8d0a('0x11')](0x1f4,_0x4ed3df[_0x8d0a('0x13')]));});});}; \ No newline at end of file +var _0x9d1b=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVoiceCallReport','options','raw','where','attributes','limit','include','model','map','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash'];(function(_0x51df6d,_0x4dec2b){var _0x2a6d8b=function(_0x2bdbbe){while(--_0x2bdbbe){_0x51df6d['push'](_0x51df6d['shift']());}};_0x2a6d8b(++_0x4dec2b);}(_0x9d1b,0x137));var _0xb9d1=function(_0x42dd53,_0xec94a){_0x42dd53=_0x42dd53-0x0;var _0x3d77cb=_0x9d1b[_0x42dd53];return _0x3d77cb;};'use strict';var _=require(_0xb9d1('0x0'));var util=require(_0xb9d1('0x1'));var moment=require(_0xb9d1('0x2'));var BPromise=require('bluebird');var rs=require(_0xb9d1('0x3'));var fs=require('fs');var Redis=require(_0xb9d1('0x4'));var db=require(_0xb9d1('0x5'))['db'];var utils=require(_0xb9d1('0x6'));var logger=require('../../config/logger')(_0xb9d1('0x7'));var config=require(_0xb9d1('0x8'));var jayson=require(_0xb9d1('0x9'));var client=jayson[_0xb9d1('0xa')][_0xb9d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf808d2,_0x3f0505,_0x47a065){return new BPromise(function(_0x309b56,_0xac26ef){return client[_0xb9d1('0xc')](_0xf808d2,_0x47a065)[_0xb9d1('0xd')](function(_0x448767){logger['info'](_0xb9d1('0xe'),_0x3f0505,_0xb9d1('0xf'));logger[_0xb9d1('0x10')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x3f0505,_0xb9d1('0xf'),JSON[_0xb9d1('0x11')](_0x448767));if(_0x448767[_0xb9d1('0x12')]){if(_0x448767[_0xb9d1('0x12')][_0xb9d1('0x13')]===0x1f4){logger[_0xb9d1('0x12')](_0xb9d1('0xe'),_0x3f0505,_0x448767['error'][_0xb9d1('0x14')]);return _0xac26ef(_0x448767[_0xb9d1('0x12')]['message']);}logger[_0xb9d1('0x12')](_0xb9d1('0xe'),_0x3f0505,_0x448767[_0xb9d1('0x12')][_0xb9d1('0x14')]);return _0x309b56(_0x448767['error'][_0xb9d1('0x14')]);}else{logger[_0xb9d1('0x15')](_0xb9d1('0xe'),_0x3f0505,_0xb9d1('0xf'));_0x309b56(_0x448767[_0xb9d1('0x16')][_0xb9d1('0x14')]);}})[_0xb9d1('0x17')](function(_0x209ea3){logger[_0xb9d1('0x12')](_0xb9d1('0xe'),_0x3f0505,_0x209ea3);_0xac26ef(_0x209ea3);});});}exports[_0xb9d1('0x18')]=function(_0x283b7b){var _0x11de9b=this;return new Promise(function(_0x5130a6,_0x33b40e){return db['VoiceCallReport']['findAll']({'raw':_0x283b7b[_0xb9d1('0x19')]?_0x283b7b['options'][_0xb9d1('0x1a')]===undefined?!![]:![]:!![],'where':_0x283b7b[_0xb9d1('0x19')]?_0x283b7b['options'][_0xb9d1('0x1b')]||null:null,'attributes':_0x283b7b[_0xb9d1('0x19')]?_0x283b7b['options'][_0xb9d1('0x1c')]||null:null,'limit':_0x283b7b[_0xb9d1('0x19')]?_0x283b7b['options'][_0xb9d1('0x1d')]||null:null,'include':_0x283b7b[_0xb9d1('0x19')]?_0x283b7b[_0xb9d1('0x19')][_0xb9d1('0x1e')]?_['map'](_0x283b7b[_0xb9d1('0x19')][_0xb9d1('0x1e')],function(_0x31a9bf){return{'model':db[_0x31a9bf[_0xb9d1('0x1f')]],'as':_0x31a9bf['as'],'attributes':_0x31a9bf['attributes'],'include':_0x31a9bf['include']?_[_0xb9d1('0x20')](_0x31a9bf[_0xb9d1('0x1e')],function(_0x47ce14){return{'model':db[_0x47ce14['model']],'as':_0x47ce14['as'],'attributes':_0x47ce14[_0xb9d1('0x1c')],'include':_0x47ce14[_0xb9d1('0x1e')]?_[_0xb9d1('0x20')](_0x47ce14['include'],function(_0x58e08e){return{'model':db[_0x58e08e['model']],'as':_0x58e08e['as'],'attributes':_0x58e08e[_0xb9d1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb9d1('0xd')](function(_0x40f13b){logger['info']('GetVoiceCallReport',_0x283b7b);logger[_0xb9d1('0x10')](_0xb9d1('0x18'),_0x283b7b,JSON[_0xb9d1('0x11')](_0x40f13b));_0x5130a6(_0x40f13b);})[_0xb9d1('0x17')](function(_0x37a8b5){logger[_0xb9d1('0x12')]('GetVoiceCallReport',_0x37a8b5['message'],_0x283b7b);_0x33b40e(_0x11de9b[_0xb9d1('0x12')](0x1f4,_0x37a8b5[_0xb9d1('0x14')]));});});};exports[_0xb9d1('0x21')]=function(_0xab3810){var _0x4ce6fd=this;return new Promise(function(_0xbe5c9f,_0x4c2a09){return db[_0xb9d1('0x22')][_0xb9d1('0x23')](_0xab3810[_0xb9d1('0x24')],{'raw':_0xab3810[_0xb9d1('0x19')]?_0xab3810[_0xb9d1('0x19')][_0xb9d1('0x1a')]===undefined?!![]:![]:!![]})[_0xb9d1('0xd')](function(_0x3b8895){logger[_0xb9d1('0x15')](_0xb9d1('0x21'),_0xab3810);logger[_0xb9d1('0x10')]('CreateVoiceCallReport',_0xab3810,JSON[_0xb9d1('0x11')](_0x3b8895));_0xbe5c9f(_0x3b8895);})[_0xb9d1('0x17')](function(_0x4c36a2){logger[_0xb9d1('0x12')]('CreateVoiceCallReport',_0x4c36a2[_0xb9d1('0x14')],_0xab3810);_0x4c2a09(_0x4ce6fd[_0xb9d1('0x12')](0x1f4,_0x4c36a2[_0xb9d1('0x14')]));});});};exports[_0xb9d1('0x25')]=function(_0x126d58){var _0x3f5566=this;return new Promise(function(_0x5f3dae,_0x585dce){return db[_0xb9d1('0x22')][_0xb9d1('0x26')](_0x126d58[_0xb9d1('0x24')],{'raw':_0x126d58['options']?_0x126d58[_0xb9d1('0x19')][_0xb9d1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x126d58[_0xb9d1('0x19')]?_0x126d58[_0xb9d1('0x19')]['where']||null:null,'attributes':_0x126d58[_0xb9d1('0x19')]?_0x126d58[_0xb9d1('0x19')][_0xb9d1('0x1c')]||null:null,'limit':_0x126d58['options']?_0x126d58[_0xb9d1('0x19')][_0xb9d1('0x1d')]||null:null})[_0xb9d1('0xd')](function(_0x40940a){logger[_0xb9d1('0x15')](_0xb9d1('0x25'),_0x126d58);logger['debug'](_0xb9d1('0x25'),_0x126d58,JSON['stringify'](_0x40940a));_0x5f3dae(_0x40940a);})['catch'](function(_0x29832d){logger[_0xb9d1('0x12')]('UpdateVoiceCallReport',_0x29832d['message'],_0x126d58);_0x585dce(_0x3f5566[_0xb9d1('0x12')](0x1f4,_0x29832d[_0xb9d1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index da89300..7ee1725 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 _0x4667=['./voiceChanSpy.controller','get','isAuthenticated','index','show','post','create','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x586436,_0x450595){var _0x5cb030=function(_0x58a0d3){while(--_0x58a0d3){_0x586436['push'](_0x586436['shift']());}};_0x5cb030(++_0x450595);}(_0x4667,0x13b));var _0x7466=function(_0x475727,_0x413c17){_0x475727=_0x475727-0x0;var _0x37903c=_0x4667[_0x475727];return _0x37903c;};'use strict';var multer=require(_0x7466('0x0'));var util=require('util');var path=require(_0x7466('0x1'));var timeout=require(_0x7466('0x2'));var express=require(_0x7466('0x3'));var router=express[_0x7466('0x4')]();var fs_extra=require(_0x7466('0x5'));var auth=require(_0x7466('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7466('0x7'));var controller=require(_0x7466('0x8'));router[_0x7466('0x9')]('/',auth[_0x7466('0xa')](),controller[_0x7466('0xb')]);router['get']('/:id',auth[_0x7466('0xa')](),controller[_0x7466('0xc')]);router[_0x7466('0xd')]('/',auth['isAuthenticated'](),controller[_0x7466('0xe')]);router['put']('/:id',auth[_0x7466('0xa')](),controller['update']);router[_0x7466('0xf')](_0x7466('0x10'),auth[_0x7466('0xa')](),controller[_0x7466('0x11')]);module[_0x7466('0x12')]=router; \ No newline at end of file +var _0x9ecb=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','put','update','delete','exports','multer'];(function(_0x5bfccc,_0x4d58cb){var _0x4afdc8=function(_0x4c7a2){while(--_0x4c7a2){_0x5bfccc['push'](_0x5bfccc['shift']());}};_0x4afdc8(++_0x4d58cb);}(_0x9ecb,0xbd));var _0xb9ec=function(_0x4ef608,_0x170af5){_0x4ef608=_0x4ef608-0x0;var _0x9dd9d3=_0x9ecb[_0x4ef608];return _0x9dd9d3;};'use strict';var multer=require(_0xb9ec('0x0'));var util=require(_0xb9ec('0x1'));var path=require(_0xb9ec('0x2'));var timeout=require(_0xb9ec('0x3'));var express=require('express');var router=express[_0xb9ec('0x4')]();var fs_extra=require(_0xb9ec('0x5'));var auth=require(_0xb9ec('0x6'));var interaction=require(_0xb9ec('0x7'));var config=require(_0xb9ec('0x8'));var controller=require(_0xb9ec('0x9'));router[_0xb9ec('0xa')]('/',auth[_0xb9ec('0xb')](),controller['index']);router[_0xb9ec('0xa')](_0xb9ec('0xc'),auth['isAuthenticated'](),controller[_0xb9ec('0xd')]);router[_0xb9ec('0xe')]('/',auth[_0xb9ec('0xb')](),controller['create']);router[_0xb9ec('0xf')](_0xb9ec('0xc'),auth[_0xb9ec('0xb')](),controller[_0xb9ec('0x10')]);router[_0xb9ec('0x11')](_0xb9ec('0xc'),auth[_0xb9ec('0xb')](),controller['destroy']);module[_0xb9ec('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1986a1a..9f15f9b 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 _0xea32=['split','BOOLEAN','sequelize','STRING','name','setDataValue','getDataValue','options'];(function(_0x5b7e3c,_0x1e7bc0){var _0x21dd67=function(_0x3f1b3e){while(--_0x3f1b3e){_0x5b7e3c['push'](_0x5b7e3c['shift']());}};_0x21dd67(++_0x1e7bc0);}(_0xea32,0x82));var _0x2ea3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea32[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x2ea3('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x2ea3('0x1')],'unique':_0x2ea3('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x2ea3('0x1')],'set':function(_0x1d892b){this[_0x2ea3('0x3')]('options',_0x1d892b?_0x1d892b['join'](''):[]);},'get':function(){return this[_0x2ea3('0x4')](_0x2ea3('0x5'))?this[_0x2ea3('0x4')](_0x2ea3('0x5'))[_0x2ea3('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x2ea3('0x1')]},'record':{'type':Sequelize[_0x2ea3('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2ea3('0x1')]}}; \ No newline at end of file +var _0x76cd=['options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x127153,_0x3f2e4d){var _0x407edf=function(_0x1d481b){while(--_0x1d481b){_0x127153['push'](_0x127153['shift']());}};_0x407edf(++_0x3f2e4d);}(_0x76cd,0x187));var _0xd76c=function(_0x3744c8,_0x28429d){_0x3744c8=_0x3744c8-0x0;var _0x59af7a=_0x76cd[_0x3744c8];return _0x59af7a;};'use strict';var Sequelize=require(_0xd76c('0x0'));module[_0xd76c('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xd76c('0x2')],'unique':_0xd76c('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xd76c('0x2')],'set':function(_0x5bb9c0){this[_0xd76c('0x4')](_0xd76c('0x5'),_0x5bb9c0?_0x5bb9c0['join'](''):[]);},'get':function(){return this[_0xd76c('0x6')](_0xd76c('0x5'))?this[_0xd76c('0x6')](_0xd76c('0x5'))[_0xd76c('0x7')](''):[];}},'auth':{'type':Sequelize[_0xd76c('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xd76c('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd76c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 0374346..508cb62 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 _0xc36d=['error','stack','name','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','ChanSpies','UserProfileResource'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xc36d,0x7d));var _0xdc36=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0xc36d[_0x11e30d];return _0x2d4e29;};'use strict';var emlformat=require(_0xdc36('0x0'));var rimraf=require(_0xdc36('0x1'));var zipdir=require(_0xdc36('0x2'));var jsonpatch=require(_0xdc36('0x3'));var rp=require(_0xdc36('0x4'));var moment=require(_0xdc36('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc36('0x6'));var util=require(_0xdc36('0x7'));var path=require('path');var sox=require(_0xdc36('0x8'));var csv=require(_0xdc36('0x9'));var ejs=require(_0xdc36('0xa'));var fs=require('fs');var fs_extra=require(_0xdc36('0xb'));var _=require(_0xdc36('0xc'));var squel=require('squel');var crypto=require(_0xdc36('0xd'));var jsforce=require(_0xdc36('0xe'));var deskjs=require(_0xdc36('0xf'));var toCsv=require(_0xdc36('0x9'));var querystring=require('querystring');var Papa=require(_0xdc36('0x10'));var Redis=require(_0xdc36('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc36('0x12'));var as=require(_0xdc36('0x13'));var hardwareService=require(_0xdc36('0x14'));var logger=require('../../config/logger')(_0xdc36('0x15'));var utils=require(_0xdc36('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdc36('0x17'))['db'];function respondWithStatusCode(_0x276692,_0x519fa5){_0x519fa5=_0x519fa5||0xcc;return function(_0x5d62ee){if(_0x5d62ee){return _0x276692['sendStatus'](_0x519fa5);}return _0x276692[_0xdc36('0x18')](_0x519fa5)[_0xdc36('0x19')]();};}function respondWithResult(_0x243d54,_0xae6ad3){_0xae6ad3=_0xae6ad3||0xc8;return function(_0x30803d){if(_0x30803d){return _0x243d54[_0xdc36('0x18')](_0xae6ad3)[_0xdc36('0x1a')](_0x30803d);}};}function respondWithFilteredResult(_0x809cf0,_0x57ebde){return function(_0x155cce){if(_0x155cce){var _0x526ac8=typeof _0x57ebde['offset']==='undefined'&&typeof _0x57ebde[_0xdc36('0x1b')]===_0xdc36('0x1c');var _0x5a498f=_0x155cce[_0xdc36('0x1d')];var _0x219a73=_0x526ac8?0x0:_0x57ebde[_0xdc36('0x1e')];var _0x225878=_0x526ac8?_0x155cce[_0xdc36('0x1d')]:_0x57ebde[_0xdc36('0x1e')]+_0x57ebde['limit'];var _0x3d4c4c;if(_0x225878>=_0x5a498f){_0x225878=_0x5a498f;_0x3d4c4c=0xc8;}else{_0x3d4c4c=0xce;}_0x809cf0[_0xdc36('0x18')](_0x3d4c4c);return _0x809cf0['set'](_0xdc36('0x1f'),_0x219a73+'-'+_0x225878+'/'+_0x5a498f)[_0xdc36('0x1a')](_0x155cce);}return null;};}function patchUpdates(_0x3f25f0){return function(_0x5f15ef){try{jsonpatch[_0xdc36('0x20')](_0x5f15ef,_0x3f25f0,!![]);}catch(_0x235a39){return BPromise['reject'](_0x235a39);}return _0x5f15ef[_0xdc36('0x21')]();};}function saveUpdates(_0x480277,_0x5a6e35){return function(_0x12f9d8){if(_0x12f9d8){return _0x12f9d8[_0xdc36('0x22')](_0x480277)[_0xdc36('0x23')](function(_0xda916b){return _0xda916b;});}return null;};}function removeEntity(_0x2d83c0,_0x34d261){return function(_0x14b595){if(_0x14b595){return _0x14b595[_0xdc36('0x24')]()['then'](function(){var _0x34057e=_0x14b595['get']({'plain':!![]});var _0x2338d7=_0xdc36('0x25');return db[_0xdc36('0x26')]['destroy']({'where':{'type':_0x2338d7,'resourceId':_0x34057e['id']}})[_0xdc36('0x23')](function(){return _0x14b595;});})[_0xdc36('0x23')](function(){_0x2d83c0[_0xdc36('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a005,_0x2f3b6a){return function(_0x2a596d){if(!_0x2a596d){_0x28a005['sendStatus'](0x194);}return _0x2a596d;};}function handleError(_0x3c39e3,_0x2dcef7){_0x2dcef7=_0x2dcef7||0x1f4;return function(_0x4b15b4){logger[_0xdc36('0x27')](_0x4b15b4[_0xdc36('0x28')]);if(_0x4b15b4['name']){delete _0x4b15b4[_0xdc36('0x29')];}_0x3c39e3['status'](_0x2dcef7)['send'](_0x4b15b4);};}exports['index']=function(_0x3b0839,_0x2f2bb4){var _0x4f57aa={},_0x13bf82={},_0x983eab={'count':0x0,'rows':[]};var _0x336447=_['map'](db[_0xdc36('0x2a')][_0xdc36('0x2b')],function(_0x1d010c){return{'name':_0x1d010c[_0xdc36('0x2c')],'type':_0x1d010c[_0xdc36('0x2d')][_0xdc36('0x2e')]};});_0x13bf82[_0xdc36('0x2f')]=_['map'](_0x336447,_0xdc36('0x29'));_0x13bf82[_0xdc36('0x30')]=_['keys'](_0x3b0839['query']);_0x13bf82[_0xdc36('0x31')]=_[_0xdc36('0x32')](_0x13bf82[_0xdc36('0x2f')],_0x13bf82['query']);_0x4f57aa['attributes']=_[_0xdc36('0x32')](_0x13bf82[_0xdc36('0x2f')],qs[_0xdc36('0x33')](_0x3b0839[_0xdc36('0x30')][_0xdc36('0x33')]));_0x4f57aa[_0xdc36('0x34')]=_0x4f57aa[_0xdc36('0x34')][_0xdc36('0x35')]?_0x4f57aa[_0xdc36('0x34')]:_0x13bf82[_0xdc36('0x2f')];if(!_0x3b0839[_0xdc36('0x30')]['hasOwnProperty'](_0xdc36('0x36'))){_0x4f57aa[_0xdc36('0x1b')]=qs[_0xdc36('0x1b')](_0x3b0839[_0xdc36('0x30')]['limit']);_0x4f57aa[_0xdc36('0x1e')]=qs[_0xdc36('0x1e')](_0x3b0839[_0xdc36('0x30')][_0xdc36('0x1e')]);}_0x4f57aa['order']=qs[_0xdc36('0x37')](_0x3b0839['query']['sort']);_0x4f57aa[_0xdc36('0x38')]=qs[_0xdc36('0x31')](_[_0xdc36('0x39')](_0x3b0839['query'],_0x13bf82[_0xdc36('0x31')]),_0x336447);if(_0x3b0839['query'][_0xdc36('0x3a')]){_0x4f57aa[_0xdc36('0x38')]=_[_0xdc36('0x3b')](_0x4f57aa['where'],{'$or':_[_0xdc36('0x3c')](_0x336447,function(_0x3394ca){if(_0x3394ca[_0xdc36('0x2d')]!==_0xdc36('0x3d')){var _0x50cf7b={};_0x50cf7b[_0x3394ca[_0xdc36('0x29')]]={'$like':'%'+_0x3b0839[_0xdc36('0x30')][_0xdc36('0x3a')]+'%'};return _0x50cf7b;}})});}_0x4f57aa=_['merge']({},_0x4f57aa,_0x3b0839['options']);var _0x2cefcf={'where':_0x4f57aa[_0xdc36('0x38')]};return db['VoiceChanSpy']['count'](_0x2cefcf)[_0xdc36('0x23')](function(_0x8f4c80){_0x983eab[_0xdc36('0x1d')]=_0x8f4c80;if(_0x3b0839[_0xdc36('0x30')][_0xdc36('0x3e')]){_0x4f57aa[_0xdc36('0x3f')]=[{'all':!![]}];}return db[_0xdc36('0x2a')][_0xdc36('0x40')](_0x4f57aa);})[_0xdc36('0x23')](function(_0x125f0e){_0x983eab[_0xdc36('0x41')]=_0x125f0e;return _0x983eab;})[_0xdc36('0x23')](respondWithFilteredResult(_0x2f2bb4,_0x4f57aa))[_0xdc36('0x42')](handleError(_0x2f2bb4,null));};exports[_0xdc36('0x43')]=function(_0x1f2604,_0x133166){var _0xc8cb3d={'raw':![],'where':{'id':_0x1f2604[_0xdc36('0x44')]['id']}},_0x16dcb7={};_0x16dcb7[_0xdc36('0x2f')]=_[_0xdc36('0x45')](db[_0xdc36('0x2a')][_0xdc36('0x2b')]);_0x16dcb7[_0xdc36('0x30')]=_[_0xdc36('0x45')](_0x1f2604[_0xdc36('0x30')]);_0x16dcb7['filters']=_[_0xdc36('0x32')](_0x16dcb7[_0xdc36('0x2f')],_0x16dcb7['query']);_0xc8cb3d['attributes']=_[_0xdc36('0x32')](_0x16dcb7['model'],qs[_0xdc36('0x33')](_0x1f2604['query'][_0xdc36('0x33')]));_0xc8cb3d[_0xdc36('0x34')]=_0xc8cb3d[_0xdc36('0x34')][_0xdc36('0x35')]?_0xc8cb3d[_0xdc36('0x34')]:_0x16dcb7[_0xdc36('0x2f')];if(_0x1f2604[_0xdc36('0x30')][_0xdc36('0x3e')]){_0xc8cb3d[_0xdc36('0x3f')]=[{'all':!![]}];}_0xc8cb3d=_[_0xdc36('0x3b')]({},_0xc8cb3d,_0x1f2604[_0xdc36('0x46')]);return db[_0xdc36('0x2a')][_0xdc36('0x47')](_0xc8cb3d)[_0xdc36('0x23')](handleEntityNotFound(_0x133166,null))[_0xdc36('0x23')](respondWithResult(_0x133166,null))[_0xdc36('0x42')](handleError(_0x133166,null));};exports[_0xdc36('0x48')]=function(_0x3399cc,_0x562c86){return db['VoiceChanSpy'][_0xdc36('0x48')](_0x3399cc[_0xdc36('0x49')],{})[_0xdc36('0x23')](function(_0x45dd51){var _0x205f76=_0x3399cc[_0xdc36('0x4a')]['get']({'plain':!![]});if(!_0x205f76)throw new Error(_0xdc36('0x4b'));if(_0x205f76[_0xdc36('0x4c')]===_0xdc36('0x4a')){var _0x49f456=_0x45dd51[_0xdc36('0x4d')]({'plain':!![]});var _0x53ed42=_0xdc36('0x25');return db[_0xdc36('0x4e')][_0xdc36('0x47')]({'where':{'name':_0x53ed42,'userProfileId':_0x205f76[_0xdc36('0x4f')]},'raw':!![]})['then'](function(_0x2f1707){if(_0x2f1707&&_0x2f1707[_0xdc36('0x50')]===0x0){return db[_0xdc36('0x26')][_0xdc36('0x48')]({'name':_0x49f456[_0xdc36('0x29')],'resourceId':_0x49f456['id'],'type':_0x2f1707[_0xdc36('0x29')],'sectionId':_0x2f1707['id']},{})[_0xdc36('0x23')](function(){return _0x45dd51;});}else{return _0x45dd51;}})[_0xdc36('0x42')](function(_0x4abeaf){logger[_0xdc36('0x27')](_0xdc36('0x51'),_0x4abeaf);throw _0x4abeaf;});}return _0x45dd51;})[_0xdc36('0x23')](respondWithResult(_0x562c86,0xc9))[_0xdc36('0x42')](handleError(_0x562c86,null));};exports[_0xdc36('0x22')]=function(_0x187b00,_0x1e7332){if(_0x187b00[_0xdc36('0x49')]['id']){delete _0x187b00['body']['id'];}return db['VoiceChanSpy'][_0xdc36('0x47')]({'where':{'id':_0x187b00[_0xdc36('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e7332,null))[_0xdc36('0x23')](saveUpdates(_0x187b00[_0xdc36('0x49')],null))['then'](respondWithResult(_0x1e7332,null))['catch'](handleError(_0x1e7332,null));};exports[_0xdc36('0x24')]=function(_0x5cf2ee,_0x4277b4){return db['VoiceChanSpy'][_0xdc36('0x47')]({'where':{'id':_0x5cf2ee['params']['id']}})['then'](handleEntityNotFound(_0x4277b4,null))[_0xdc36('0x23')](removeEntity(_0x4277b4,null))['catch'](handleError(_0x4277b4,null));}; \ No newline at end of file +var _0x5bbd=['../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','where','filter','VIRTUAL','merge','VoiceChanSpy','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd5bb('0x0'));var rimraf=require(_0xd5bb('0x1'));var zipdir=require(_0xd5bb('0x2'));var jsonpatch=require(_0xd5bb('0x3'));var rp=require(_0xd5bb('0x4'));var moment=require(_0xd5bb('0x5'));var BPromise=require(_0xd5bb('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd5bb('0x7'));var csv=require(_0xd5bb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5bb('0x9'));var squel=require('squel');var crypto=require(_0xd5bb('0xa'));var jsforce=require(_0xd5bb('0xb'));var deskjs=require(_0xd5bb('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd5bb('0xd'));var Redis=require(_0xd5bb('0xe'));var authService=require(_0xd5bb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd5bb('0x10'));var hardwareService=require(_0xd5bb('0x11'));var logger=require(_0xd5bb('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd5bb('0x13'));var licenseUtil=require(_0xd5bb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1df75a,_0x4b1f1b){_0x4b1f1b=_0x4b1f1b||0xcc;return function(_0x16b13f){if(_0x16b13f){return _0x1df75a['sendStatus'](_0x4b1f1b);}return _0x1df75a[_0xd5bb('0x15')](_0x4b1f1b)[_0xd5bb('0x16')]();};}function respondWithResult(_0x57cdb0,_0x37bb78){_0x37bb78=_0x37bb78||0xc8;return function(_0x1f54eb){if(_0x1f54eb){return _0x57cdb0[_0xd5bb('0x15')](_0x37bb78)['json'](_0x1f54eb);}};}function respondWithFilteredResult(_0x48c60a,_0x7d2333){return function(_0xa014fe){if(_0xa014fe){var _0x516418=typeof _0x7d2333[_0xd5bb('0x17')]===_0xd5bb('0x18')&&typeof _0x7d2333[_0xd5bb('0x19')]===_0xd5bb('0x18');var _0x510d9b=_0xa014fe[_0xd5bb('0x1a')];var _0x41bc89=_0x516418?0x0:_0x7d2333[_0xd5bb('0x17')];var _0x3d312f=_0x516418?_0xa014fe[_0xd5bb('0x1a')]:_0x7d2333[_0xd5bb('0x17')]+_0x7d2333['limit'];var _0x3bb5ae;if(_0x3d312f>=_0x510d9b){_0x3d312f=_0x510d9b;_0x3bb5ae=0xc8;}else{_0x3bb5ae=0xce;}_0x48c60a[_0xd5bb('0x15')](_0x3bb5ae);return _0x48c60a[_0xd5bb('0x1b')](_0xd5bb('0x1c'),_0x41bc89+'-'+_0x3d312f+'/'+_0x510d9b)[_0xd5bb('0x1d')](_0xa014fe);}return null;};}function patchUpdates(_0x40112f){return function(_0x56a68c){try{jsonpatch[_0xd5bb('0x1e')](_0x56a68c,_0x40112f,!![]);}catch(_0x53b6fc){return BPromise['reject'](_0x53b6fc);}return _0x56a68c[_0xd5bb('0x1f')]();};}function saveUpdates(_0x4c82d3,_0x53f959){return function(_0x118e3d){if(_0x118e3d){return _0x118e3d[_0xd5bb('0x20')](_0x4c82d3)[_0xd5bb('0x21')](function(_0x44551e){return _0x44551e;});}return null;};}function removeEntity(_0x285609,_0x52383c){return function(_0x2685ad){if(_0x2685ad){return _0x2685ad[_0xd5bb('0x22')]()[_0xd5bb('0x21')](function(){var _0x6155c=_0x2685ad[_0xd5bb('0x23')]({'plain':!![]});var _0x48f15d='ChanSpies';return db[_0xd5bb('0x24')][_0xd5bb('0x22')]({'where':{'type':_0x48f15d,'resourceId':_0x6155c['id']}})[_0xd5bb('0x21')](function(){return _0x2685ad;});})[_0xd5bb('0x21')](function(){_0x285609[_0xd5bb('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11428a,_0x4f6ec6){return function(_0x30fa6d){if(!_0x30fa6d){_0x11428a[_0xd5bb('0x25')](0x194);}return _0x30fa6d;};}function handleError(_0x4698a8,_0x32a83e){_0x32a83e=_0x32a83e||0x1f4;return function(_0x10e5a6){logger[_0xd5bb('0x26')](_0x10e5a6[_0xd5bb('0x27')]);if(_0x10e5a6[_0xd5bb('0x28')]){delete _0x10e5a6[_0xd5bb('0x28')];}_0x4698a8[_0xd5bb('0x15')](_0x32a83e)[_0xd5bb('0x29')](_0x10e5a6);};}exports[_0xd5bb('0x2a')]=function(_0x408ada,_0x965a7f){var _0x12aeea={},_0x2a6a4a={},_0x4db50b={'count':0x0,'rows':[]};var _0x12fa21=_[_0xd5bb('0x2b')](db['VoiceChanSpy'][_0xd5bb('0x2c')],function(_0x425e8a){return{'name':_0x425e8a['fieldName'],'type':_0x425e8a[_0xd5bb('0x2d')][_0xd5bb('0x2e')]};});_0x2a6a4a[_0xd5bb('0x2f')]=_['map'](_0x12fa21,_0xd5bb('0x28'));_0x2a6a4a[_0xd5bb('0x30')]=_['keys'](_0x408ada['query']);_0x2a6a4a[_0xd5bb('0x31')]=_[_0xd5bb('0x32')](_0x2a6a4a['model'],_0x2a6a4a[_0xd5bb('0x30')]);_0x12aeea['attributes']=_[_0xd5bb('0x32')](_0x2a6a4a[_0xd5bb('0x2f')],qs['fields'](_0x408ada[_0xd5bb('0x30')][_0xd5bb('0x33')]));_0x12aeea[_0xd5bb('0x34')]=_0x12aeea[_0xd5bb('0x34')][_0xd5bb('0x35')]?_0x12aeea[_0xd5bb('0x34')]:_0x2a6a4a['model'];if(!_0x408ada[_0xd5bb('0x30')][_0xd5bb('0x36')]('nolimit')){_0x12aeea[_0xd5bb('0x19')]=qs[_0xd5bb('0x19')](_0x408ada[_0xd5bb('0x30')][_0xd5bb('0x19')]);_0x12aeea[_0xd5bb('0x17')]=qs[_0xd5bb('0x17')](_0x408ada[_0xd5bb('0x30')][_0xd5bb('0x17')]);}_0x12aeea['order']=qs['sort'](_0x408ada[_0xd5bb('0x30')]['sort']);_0x12aeea[_0xd5bb('0x37')]=qs['filters'](_['pick'](_0x408ada[_0xd5bb('0x30')],_0x2a6a4a[_0xd5bb('0x31')]),_0x12fa21);if(_0x408ada[_0xd5bb('0x30')][_0xd5bb('0x38')]){_0x12aeea[_0xd5bb('0x37')]=_['merge'](_0x12aeea['where'],{'$or':_['map'](_0x12fa21,function(_0x278954){if(_0x278954[_0xd5bb('0x2d')]!==_0xd5bb('0x39')){var _0xb9eb13={};_0xb9eb13[_0x278954['name']]={'$like':'%'+_0x408ada[_0xd5bb('0x30')][_0xd5bb('0x38')]+'%'};return _0xb9eb13;}})});}_0x12aeea=_[_0xd5bb('0x3a')]({},_0x12aeea,_0x408ada['options']);var _0x3d11c9={'where':_0x12aeea['where']};return db[_0xd5bb('0x3b')]['count'](_0x3d11c9)['then'](function(_0x2e0e59){_0x4db50b['count']=_0x2e0e59;if(_0x408ada['query'][_0xd5bb('0x3c')]){_0x12aeea['include']=[{'all':!![]}];}return db[_0xd5bb('0x3b')][_0xd5bb('0x3d')](_0x12aeea);})[_0xd5bb('0x21')](function(_0x51d020){_0x4db50b[_0xd5bb('0x3e')]=_0x51d020;return _0x4db50b;})[_0xd5bb('0x21')](respondWithFilteredResult(_0x965a7f,_0x12aeea))[_0xd5bb('0x3f')](handleError(_0x965a7f,null));};exports[_0xd5bb('0x40')]=function(_0x4d392f,_0x56a1ba){var _0x47d1ee={'raw':![],'where':{'id':_0x4d392f[_0xd5bb('0x41')]['id']}},_0x30c47e={};_0x30c47e[_0xd5bb('0x2f')]=_[_0xd5bb('0x42')](db[_0xd5bb('0x3b')][_0xd5bb('0x2c')]);_0x30c47e[_0xd5bb('0x30')]=_['keys'](_0x4d392f[_0xd5bb('0x30')]);_0x30c47e[_0xd5bb('0x31')]=_[_0xd5bb('0x32')](_0x30c47e[_0xd5bb('0x2f')],_0x30c47e[_0xd5bb('0x30')]);_0x47d1ee[_0xd5bb('0x34')]=_['intersection'](_0x30c47e[_0xd5bb('0x2f')],qs[_0xd5bb('0x33')](_0x4d392f[_0xd5bb('0x30')][_0xd5bb('0x33')]));_0x47d1ee[_0xd5bb('0x34')]=_0x47d1ee['attributes']['length']?_0x47d1ee[_0xd5bb('0x34')]:_0x30c47e[_0xd5bb('0x2f')];if(_0x4d392f['query'][_0xd5bb('0x3c')]){_0x47d1ee[_0xd5bb('0x43')]=[{'all':!![]}];}_0x47d1ee=_['merge']({},_0x47d1ee,_0x4d392f[_0xd5bb('0x44')]);return db['VoiceChanSpy'][_0xd5bb('0x45')](_0x47d1ee)[_0xd5bb('0x21')](handleEntityNotFound(_0x56a1ba,null))[_0xd5bb('0x21')](respondWithResult(_0x56a1ba,null))[_0xd5bb('0x3f')](handleError(_0x56a1ba,null));};exports[_0xd5bb('0x46')]=function(_0x58553c,_0x1cbb68){return db['VoiceChanSpy'][_0xd5bb('0x46')](_0x58553c['body'],{})[_0xd5bb('0x21')](function(_0x505db8){var _0x4ea20b=_0x58553c[_0xd5bb('0x47')][_0xd5bb('0x23')]({'plain':!![]});if(!_0x4ea20b)throw new Error(_0xd5bb('0x48'));if(_0x4ea20b['role']===_0xd5bb('0x47')){var _0x26c882=_0x505db8[_0xd5bb('0x23')]({'plain':!![]});var _0x96e91e=_0xd5bb('0x49');return db[_0xd5bb('0x4a')][_0xd5bb('0x45')]({'where':{'name':_0x96e91e,'userProfileId':_0x4ea20b[_0xd5bb('0x4b')]},'raw':!![]})[_0xd5bb('0x21')](function(_0x2d8d82){if(_0x2d8d82&&_0x2d8d82[_0xd5bb('0x4c')]===0x0){return db['UserProfileResource'][_0xd5bb('0x46')]({'name':_0x26c882[_0xd5bb('0x28')],'resourceId':_0x26c882['id'],'type':_0x2d8d82[_0xd5bb('0x28')],'sectionId':_0x2d8d82['id']},{})[_0xd5bb('0x21')](function(){return _0x505db8;});}else{return _0x505db8;}})[_0xd5bb('0x3f')](function(_0x4d1dd4){logger['error'](_0xd5bb('0x4d'),_0x4d1dd4);throw _0x4d1dd4;});}return _0x505db8;})[_0xd5bb('0x21')](respondWithResult(_0x1cbb68,0xc9))[_0xd5bb('0x3f')](handleError(_0x1cbb68,null));};exports[_0xd5bb('0x20')]=function(_0x566322,_0x1abe56){if(_0x566322['body']['id']){delete _0x566322[_0xd5bb('0x4e')]['id'];}return db[_0xd5bb('0x3b')]['find']({'where':{'id':_0x566322[_0xd5bb('0x41')]['id']}})['then'](handleEntityNotFound(_0x1abe56,null))['then'](saveUpdates(_0x566322[_0xd5bb('0x4e')],null))[_0xd5bb('0x21')](respondWithResult(_0x1abe56,null))[_0xd5bb('0x3f')](handleError(_0x1abe56,null));};exports[_0xd5bb('0x22')]=function(_0x11cc95,_0x1f7f76){return db[_0xd5bb('0x3b')][_0xd5bb('0x45')]({'where':{'id':_0x11cc95[_0xd5bb('0x41')]['id']}})[_0xd5bb('0x21')](handleEntityNotFound(_0x1f7f76,null))[_0xd5bb('0x21')](removeEntity(_0x1f7f76,null))[_0xd5bb('0x3f')](handleError(_0x1f7f76,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 8da1423..1e6e39d 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 _0xabf0=['VoiceChanSpy','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','then','exports','models','define'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xabf0,0x98));var _0x0abf=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xabf0[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x0abf('0x0'));var util=require(_0x0abf('0x1'));var BPromise=require(_0x0abf('0x2'));var attributes=require(_0x0abf('0x3'));var getUserApplications=function(_0x1df615,_0x3aafa8,_0x532456){var _0x4fbcf4=0x1;var _0x27cdda=[];var _0x57527e={'context':_0x3aafa8[_0x0abf('0x4')]||_0x0abf('0x5'),'exten':util[_0x0abf('0x6')]('%s%s',_0x1df615[_0x0abf('0x7')],_0x532456),'type':_0x0abf('0x8'),'isApp':![],'ChanSpyId':_0x1df615['id'],'UserId':_0x3aafa8['id']};_0x27cdda[_0x0abf('0x9')](_[_0x0abf('0xa')]({'app':_0x0abf('0xb'),'appdata':util['format']('CDR(type)=%s',_0x0abf('0xc')),'priority':_0x4fbcf4++},_0x57527e));if(_0x1df615[_0x0abf('0xd')]){_0x27cdda['push'](_[_0x0abf('0xa')]({'app':_0x0abf('0xe'),'appdata':util[_0x0abf('0x6')](_0x0abf('0xf'),_0x1df615['recordingFormat']),'priority':_0x4fbcf4++},_0x57527e));}if(_0x1df615[_0x0abf('0x10')]){_0x27cdda['push'](_['merge']({'app':_0x0abf('0x11'),'appdata':_0x1df615[_0x0abf('0x12')],'priority':_0x4fbcf4++},_0x57527e));}_0x27cdda[_0x0abf('0x9')](_['merge']({'app':_0x0abf('0x13'),'appdata':util['format'](_0x0abf('0x14'),_0x3aafa8[_0x0abf('0x15')],_0x1df615[_0x0abf('0x16')]?_0x1df615[_0x0abf('0x16')][_0x0abf('0x17')](''):''),'priority':_0x4fbcf4++},_0x57527e));if(_0x1df615[_0x0abf('0xd')]){_0x27cdda[_0x0abf('0x9')](_[_0x0abf('0xa')]({'app':'StopMixMonitor','priority':_0x4fbcf4++},_0x57527e));}return _0x27cdda;};var getChanSpyApplications=function(_0x59c991,_0x571053){var _0x49a34b=[];for(var _0x22120a=0x0,_0x4c9fab=0x1;_0x22120a<_0x571053[_0x0abf('0x18')];_0x22120a++,_0x4c9fab=0x1){_0x49a34b=_0x49a34b[_0x0abf('0x19')](getUserApplications(_0x59c991,_0x571053[_0x22120a],_0x571053[_0x22120a][_0x0abf('0x1a')]));if(_0x571053[_0x22120a][_0x0abf('0x1a')]!=_0x571053[_0x22120a][_0x0abf('0x15')]){_0x49a34b=_0x49a34b[_0x0abf('0x19')](getUserApplications(_0x59c991,_0x571053[_0x22120a],_0x571053[_0x22120a][_0x0abf('0x15')]));}}return _0x49a34b;};var getChanSpyPromise=function(_0x473c3d,_0x4c05b6){return new BPromise(function(_0x394c84,_0x456fe5){return _0x473c3d[_0x0abf('0x1b')][_0x0abf('0x1c')]({'attributes':['id','name',_0x0abf('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x0abf('0x1d')](function(_0x4dc28a){if(_0x4dc28a){return _0x394c84(getChanSpyApplications(_0x4c05b6,_0x4dc28a));}return _0x394c84([]);})['catch'](function(_0x2b8be1){_0x456fe5(_0x2b8be1);});});};module[_0x0abf('0x1e')]=function(_0x56b088,_0x2b5bd4){var _0x3159a9=_0x56b088[_0x0abf('0x1f')];return _0x56b088[_0x0abf('0x20')](_0x0abf('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e434d,_0xda6ea0,_0x2c74fb){return getChanSpyPromise(_0x3159a9,_0x5e434d)[_0x0abf('0x1d')](function(_0x45ebd6){if(_0x45ebd6&&_0x45ebd6[_0x0abf('0x18')]){return _0x3159a9[_0x0abf('0x22')]['bulkCreate'](_0x45ebd6);}})[_0x0abf('0x1d')](function(){_0x2c74fb();})['catch'](function(_0x27d503){_0x2c74fb(_0x27d503);});},'afterUpdate':function(_0x1d163a,_0x53d2e7,_0x41fcbb){return _0x3159a9[_0x0abf('0x22')][_0x0abf('0x23')]({'where':{'ChanSpyId':_0x1d163a['id']}})['then'](function(){return getChanSpyPromise(_0x3159a9,_0x1d163a);})['then'](function(_0x548e7e){if(_0x548e7e&&_0x548e7e[_0x0abf('0x18')]){return _0x3159a9[_0x0abf('0x22')][_0x0abf('0x24')](_0x548e7e);}})[_0x0abf('0x1d')](function(){_0x41fcbb();})['catch'](function(_0x20091a){_0x41fcbb(_0x20091a);});},'afterDestroy':function(_0x43da34,_0x2694b8,_0x24c1aa){return _0x3159a9['VoiceExtension'][_0x0abf('0x23')]({'where':{'ChanSpyId':_0x43da34['id']}})[_0x0abf('0x1d')](function(){_0x24c1aa();})['catch'](function(_0x23cde2){_0x24c1aa(_0x23cde2);});}}});}; \ No newline at end of file +var _0xcfba=['bluebird','from-sip','format','prefix','record','push','merge','MixMonitor','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','concat','internal','name','User','findAll','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util'];(function(_0x17091b,_0x169adc){var _0x1aa1c1=function(_0x596ca6){while(--_0x596ca6){_0x17091b['push'](_0x17091b['shift']());}};_0x1aa1c1(++_0x169adc);}(_0xcfba,0x10e));var _0xacfb=function(_0x327328,_0x40cc8b){_0x327328=_0x327328-0x0;var _0x28ad09=_0xcfba[_0x327328];return _0x28ad09;};'use strict';var _=require(_0xacfb('0x0'));var util=require(_0xacfb('0x1'));var BPromise=require(_0xacfb('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x437453,_0x2e816b,_0x2fcfca){var _0x5b8140=0x1;var _0x390ca1=[];var _0x3b7061={'context':_0x2e816b['context']||_0xacfb('0x3'),'exten':util[_0xacfb('0x4')]('%s%s',_0x437453[_0xacfb('0x5')],_0x2fcfca),'type':'system','isApp':![],'ChanSpyId':_0x437453['id'],'UserId':_0x2e816b['id']};_0x390ca1['push'](_['merge']({'app':'Set','appdata':util['format']('CDR(type)=%s','chanspy'),'priority':_0x5b8140++},_0x3b7061));if(_0x437453[_0xacfb('0x6')]){_0x390ca1[_0xacfb('0x7')](_[_0xacfb('0x8')]({'app':_0xacfb('0x9'),'appdata':util[_0xacfb('0x4')]('${UNIQUEID}.%s,a',_0x437453['recordingFormat']),'priority':_0x5b8140++},_0x3b7061));}if(_0x437453[_0xacfb('0xa')]){_0x390ca1[_0xacfb('0x7')](_[_0xacfb('0x8')]({'app':_0xacfb('0xb'),'appdata':_0x437453[_0xacfb('0xc')],'priority':_0x5b8140++},_0x3b7061));}_0x390ca1[_0xacfb('0x7')](_[_0xacfb('0x8')]({'app':_0xacfb('0xd'),'appdata':util[_0xacfb('0x4')](_0xacfb('0xe'),_0x2e816b['name'],_0x437453[_0xacfb('0xf')]?_0x437453[_0xacfb('0xf')][_0xacfb('0x10')](''):''),'priority':_0x5b8140++},_0x3b7061));if(_0x437453[_0xacfb('0x6')]){_0x390ca1['push'](_[_0xacfb('0x8')]({'app':_0xacfb('0x11'),'priority':_0x5b8140++},_0x3b7061));}return _0x390ca1;};var getChanSpyApplications=function(_0x48b82a,_0x2c4f08){var _0x40a634=[];for(var _0x371ac9=0x0,_0x437b26=0x1;_0x371ac9<_0x2c4f08['length'];_0x371ac9++,_0x437b26=0x1){_0x40a634=_0x40a634[_0xacfb('0x12')](getUserApplications(_0x48b82a,_0x2c4f08[_0x371ac9],_0x2c4f08[_0x371ac9][_0xacfb('0x13')]));if(_0x2c4f08[_0x371ac9][_0xacfb('0x13')]!=_0x2c4f08[_0x371ac9][_0xacfb('0x14')]){_0x40a634=_0x40a634[_0xacfb('0x12')](getUserApplications(_0x48b82a,_0x2c4f08[_0x371ac9],_0x2c4f08[_0x371ac9][_0xacfb('0x14')]));}}return _0x40a634;};var getChanSpyPromise=function(_0x426c73,_0x120200){return new BPromise(function(_0x4fdec1,_0x137bde){return _0x426c73[_0xacfb('0x15')][_0xacfb('0x16')]({'attributes':['id',_0xacfb('0x14'),_0xacfb('0x13')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xacfb('0x17')](function(_0x233b28){if(_0x233b28){return _0x4fdec1(getChanSpyApplications(_0x120200,_0x233b28));}return _0x4fdec1([]);})[_0xacfb('0x18')](function(_0x21be8c){_0x137bde(_0x21be8c);});});};module[_0xacfb('0x19')]=function(_0xc20940,_0x3059bf){var _0x29b120=_0xc20940[_0xacfb('0x1a')];return _0xc20940[_0xacfb('0x1b')](_0xacfb('0x1c'),attributes,{'tableName':_0xacfb('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x389095,_0x2e03ab,_0xe80fbd){return getChanSpyPromise(_0x29b120,_0x389095)[_0xacfb('0x17')](function(_0x57e306){if(_0x57e306&&_0x57e306[_0xacfb('0x1e')]){return _0x29b120[_0xacfb('0x1f')][_0xacfb('0x20')](_0x57e306);}})[_0xacfb('0x17')](function(){_0xe80fbd();})[_0xacfb('0x18')](function(_0x330c7e){_0xe80fbd(_0x330c7e);});},'afterUpdate':function(_0xf74982,_0x5058e2,_0x44ad19){return _0x29b120['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0xf74982['id']}})[_0xacfb('0x17')](function(){return getChanSpyPromise(_0x29b120,_0xf74982);})[_0xacfb('0x17')](function(_0x44077f){if(_0x44077f&&_0x44077f['length']){return _0x29b120[_0xacfb('0x1f')][_0xacfb('0x20')](_0x44077f);}})[_0xacfb('0x17')](function(){_0x44ad19();})[_0xacfb('0x18')](function(_0x34cbed){_0x44ad19(_0x34cbed);});},'afterDestroy':function(_0x9ba414,_0x41852a,_0x4dcf5a){return _0x29b120[_0xacfb('0x1f')][_0xacfb('0x21')]({'where':{'ChanSpyId':_0x9ba414['id']}})['then'](function(){_0x4dcf5a();})['catch'](function(_0x125c81){_0x4dcf5a(_0x125c81);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 1365683..a31bb38 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 _0xac4a=['VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xac4a,0x13f));var _0xaac4=function(_0x1d74d5,_0x3fa150){_0x1d74d5=_0x1d74d5-0x0;var _0x3631bb=_0xac4a[_0x1d74d5];return _0x3631bb;};'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')]('VoiceChanSpy,\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')]('VoiceChanSpy,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x7af2=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','message','VoiceChanSpy,\x20%s,\x20%s','result'];(function(_0x4d4d2c,_0x51dae0){var _0x37e9e6=function(_0x4e0bb3){while(--_0x4e0bb3){_0x4d4d2c['push'](_0x4d4d2c['shift']());}};_0x37e9e6(++_0x51dae0);}(_0x7af2,0x119));var _0x27af=function(_0x5976ed,_0x882b44){_0x5976ed=_0x5976ed-0x0;var _0x1a8f3b=_0x7af2[_0x5976ed];return _0x1a8f3b;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var moment=require(_0x27af('0x1'));var BPromise=require(_0x27af('0x2'));var rs=require(_0x27af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27af('0x4'))['db'];var utils=require(_0x27af('0x5'));var logger=require(_0x27af('0x6'))(_0x27af('0x7'));var config=require(_0x27af('0x8'));var jayson=require(_0x27af('0x9'));var client=jayson[_0x27af('0xa')][_0x27af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2193c6,_0x572219,_0x1e2509){return new BPromise(function(_0x366868,_0x389e97){return client['request'](_0x2193c6,_0x1e2509)[_0x27af('0xc')](function(_0xfa1882){logger[_0x27af('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x572219,_0x27af('0xe'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x572219,_0x27af('0xe'),JSON['stringify'](_0xfa1882));if(_0xfa1882['error']){if(_0xfa1882[_0x27af('0xf')]['code']===0x1f4){logger[_0x27af('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x389e97(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}logger[_0x27af('0xf')](_0x27af('0x11'),_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x366868(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}else{logger[_0x27af('0xd')](_0x27af('0x11'),_0x572219,_0x27af('0xe'));_0x366868(_0xfa1882[_0x27af('0x12')][_0x27af('0x10')]);}})[_0x27af('0x13')](function(_0x13f8ed){logger[_0x27af('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x572219,_0x13f8ed);_0x389e97(_0x13f8ed);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index de447a6..668d6f7 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 _0x6618=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x282853,_0x410fe9){var _0xf163ac=function(_0x5c4a27){while(--_0x5c4a27){_0x282853['push'](_0x282853['shift']());}};_0xf163ac(++_0x410fe9);}(_0x6618,0x9d));var _0x8661=function(_0x55a3a8,_0x55f54f){_0x55a3a8=_0x55a3a8-0x0;var _0x45b597=_0x6618[_0x55a3a8];return _0x45b597;};'use strict';var multer=require(_0x8661('0x0'));var util=require('util');var path=require(_0x8661('0x1'));var timeout=require(_0x8661('0x2'));var express=require('express');var router=express[_0x8661('0x3')]();var fs_extra=require(_0x8661('0x4'));var auth=require(_0x8661('0x5'));var interaction=require(_0x8661('0x6'));var config=require(_0x8661('0x7'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0x8661('0x8')](),controller[_0x8661('0x9')]);router[_0x8661('0xa')]('/:id',auth[_0x8661('0x8')](),controller['show']);router[_0x8661('0xb')]('/',auth[_0x8661('0x8')](),controller['create']);router[_0x8661('0xc')](_0x8661('0xd'),auth[_0x8661('0x8')](),controller[_0x8661('0xe')]);router[_0x8661('0xf')]('/:id',auth[_0x8661('0x8')](),controller[_0x8661('0x10')]);module[_0x8661('0x11')]=router; \ No newline at end of file +var _0x8c22=['util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x356e2c,_0xb32e2e){var _0x4f9121=function(_0x463d08){while(--_0x463d08){_0x356e2c['push'](_0x356e2c['shift']());}};_0x4f9121(++_0xb32e2e);}(_0x8c22,0xa9));var _0x28c2=function(_0x2e2eab,_0x2e609a){_0x2e2eab=_0x2e2eab-0x0;var _0x2357bc=_0x8c22[_0x2e2eab];return _0x2357bc;};'use strict';var multer=require(_0x28c2('0x0'));var util=require(_0x28c2('0x1'));var path=require('path');var timeout=require(_0x28c2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x28c2('0x3'));var auth=require(_0x28c2('0x4'));var interaction=require(_0x28c2('0x5'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x28c2('0x6')]('/',auth[_0x28c2('0x7')](),controller[_0x28c2('0x8')]);router['get'](_0x28c2('0x9'),auth[_0x28c2('0x7')](),controller[_0x28c2('0xa')]);router[_0x28c2('0xb')]('/',auth['isAuthenticated'](),controller[_0x28c2('0xc')]);router['put'](_0x28c2('0x9'),auth[_0x28c2('0x7')](),controller[_0x28c2('0xd')]);router[_0x28c2('0xe')](_0x28c2('0x9'),auth['isAuthenticated'](),controller[_0x28c2('0xf')]);module[_0x28c2('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 0e4b18f..1b74b9e 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 _0x72fa=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x35f1de,_0x4dda19){var _0x4b66d6=function(_0x4ff6c5){while(--_0x4ff6c5){_0x35f1de['push'](_0x35f1de['shift']());}};_0x4b66d6(++_0x4dda19);}(_0x72fa,0x120));var _0xa72f=function(_0x11c1a1,_0x17ba8c){_0x11c1a1=_0x11c1a1-0x0;var _0x483746=_0x72fa[_0x11c1a1];return _0x483746;};'use strict';var Sequelize=require(_0xa72f('0x0'));module[_0xa72f('0x1')]={'name':{'type':Sequelize[_0xa72f('0x2')],'unique':_0xa72f('0x3')},'description':{'type':Sequelize[_0xa72f('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa72f('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc386=['name','STRING','sequelize','exports'];(function(_0x3e10c0,_0x385bdc){var _0x2fb415=function(_0x2bfb7b){while(--_0x2bfb7b){_0x3e10c0['push'](_0x3e10c0['shift']());}};_0x2fb415(++_0x385bdc);}(_0xc386,0x17e));var _0x6c38=function(_0x32fcd5,_0x5dd0ac){_0x32fcd5=_0x32fcd5-0x0;var _0x360c0e=_0xc386[_0x32fcd5];return _0x360c0e;};'use strict';var Sequelize=require(_0x6c38('0x0'));module[_0x6c38('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6c38('0x2')},'description':{'type':Sequelize[_0x6c38('0x3')],'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 17745bb..56d1381 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 _0x3f8a=['map','VoiceContext','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','include','rows','show','params','keys','find','create','body','findAll','readFileSync','join','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','render','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','offset','undefined','limit','count','json','apply','reject','save','update','destroy','get','Contexts','end','sendStatus','stack','name','send'];(function(_0x2fc20d,_0x28357f){var _0x3c1824=function(_0x248334){while(--_0x248334){_0x2fc20d['push'](_0x2fc20d['shift']());}};_0x3c1824(++_0x28357f);}(_0x3f8a,0x8e));var _0xa3f8=function(_0x4609a1,_0x482de8){_0x4609a1=_0x4609a1-0x0;var _0x27f7b1=_0x3f8a[_0x4609a1];return _0x27f7b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3f8('0x0'));var zipdir=require(_0xa3f8('0x1'));var jsonpatch=require(_0xa3f8('0x2'));var rp=require('request-promise');var moment=require(_0xa3f8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa3f8('0x4'));var util=require(_0xa3f8('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa3f8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa3f8('0x7'));var _=require('lodash');var squel=require(_0xa3f8('0x8'));var crypto=require(_0xa3f8('0x9'));var jsforce=require(_0xa3f8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa3f8('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa3f8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xa3f8('0xc'));var as=require(_0xa3f8('0xd'));var hardwareService=require(_0xa3f8('0xe'));var logger=require(_0xa3f8('0xf'))(_0xa3f8('0x10'));var utils=require(_0xa3f8('0x11'));var config=require(_0xa3f8('0x12'));var licenseUtil=require(_0xa3f8('0x13'));var db=require(_0xa3f8('0x14'))['db'];var jayson=require(_0xa3f8('0x15'));var client=jayson[_0xa3f8('0x16')][_0xa3f8('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x22e312,_0x1946e7,_0x505e24,_0x32b2e4){return new BPromise(function(_0x51d1dd,_0x25e3d7){var _0x2e4392=_0x32b2e4||client;return _0x2e4392[_0xa3f8('0x18')](_0x22e312,_0x505e24)[_0xa3f8('0x19')](function(_0x5388e9){logger[_0xa3f8('0x1a')](_0xa3f8('0x1b'),_0x1946e7,'request\x20sent');logger['debug'](_0xa3f8('0x1c'),_0x1946e7,'request\x20sent',JSON[_0xa3f8('0x1d')](_0x5388e9));if(_0x5388e9[_0xa3f8('0x1e')]){if(_0x5388e9[_0xa3f8('0x1e')][_0xa3f8('0x1f')]===0x1f4){logger[_0xa3f8('0x1e')](_0xa3f8('0x1b'),_0x1946e7,_0x5388e9[_0xa3f8('0x1e')][_0xa3f8('0x20')]);return _0x25e3d7(_0x5388e9[_0xa3f8('0x1e')][_0xa3f8('0x20')]);}logger[_0xa3f8('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x1946e7,_0x5388e9['error'][_0xa3f8('0x20')]);return _0x51d1dd(_0x5388e9['error'][_0xa3f8('0x20')]);}else{logger[_0xa3f8('0x1a')](_0xa3f8('0x1b'),_0x1946e7,'request\x20sent');_0x51d1dd(_0x5388e9['result']['message']);}})[_0xa3f8('0x21')](function(_0x4e21c0){logger[_0xa3f8('0x1e')](_0xa3f8('0x1b'),_0x1946e7,_0x4e21c0);_0x25e3d7(_0x4e21c0);});});}function respondWithStatusCode(_0x9a1457,_0x5e90fd){_0x5e90fd=_0x5e90fd||0xcc;return function(_0x484a83){if(_0x484a83){return _0x9a1457['sendStatus'](_0x5e90fd);}return _0x9a1457['status'](_0x5e90fd)['end']();};}function respondWithResult(_0x60a32,_0x2daebe){_0x2daebe=_0x2daebe||0xc8;return function(_0x1e52ab){if(_0x1e52ab){return _0x60a32[_0xa3f8('0x22')](_0x2daebe)['json'](_0x1e52ab);}};}function respondWithFilteredResult(_0x4b49ee,_0xdea477){return function(_0x68d804){if(_0x68d804){var _0x527491=typeof _0xdea477[_0xa3f8('0x23')]===_0xa3f8('0x24')&&typeof _0xdea477[_0xa3f8('0x25')]===_0xa3f8('0x24');var _0x268d10=_0x68d804[_0xa3f8('0x26')];var _0x428c91=_0x527491?0x0:_0xdea477[_0xa3f8('0x23')];var _0x2b4cdf=_0x527491?_0x68d804['count']:_0xdea477[_0xa3f8('0x23')]+_0xdea477['limit'];var _0x173bb6;if(_0x2b4cdf>=_0x268d10){_0x2b4cdf=_0x268d10;_0x173bb6=0xc8;}else{_0x173bb6=0xce;}_0x4b49ee[_0xa3f8('0x22')](_0x173bb6);return _0x4b49ee['set']('Content-Range',_0x428c91+'-'+_0x2b4cdf+'/'+_0x268d10)[_0xa3f8('0x27')](_0x68d804);}return null;};}function patchUpdates(_0x45843f){return function(_0xf6e78f){try{jsonpatch[_0xa3f8('0x28')](_0xf6e78f,_0x45843f,!![]);}catch(_0x34d059){return BPromise[_0xa3f8('0x29')](_0x34d059);}return _0xf6e78f[_0xa3f8('0x2a')]();};}function saveUpdates(_0x14c7e6,_0x34e6a1){return function(_0x421fe0){if(_0x421fe0){return _0x421fe0[_0xa3f8('0x2b')](_0x14c7e6)[_0xa3f8('0x19')](function(_0x4e82d4){return _0x4e82d4;});}return null;};}function removeEntity(_0x53eb81,_0xfc07fd){return function(_0x2d5ce2){if(_0x2d5ce2){return _0x2d5ce2[_0xa3f8('0x2c')]()[_0xa3f8('0x19')](function(){var _0x2d33c4=_0x2d5ce2[_0xa3f8('0x2d')]({'plain':!![]});var _0x5ae314=_0xa3f8('0x2e');return db['UserProfileResource'][_0xa3f8('0x2c')]({'where':{'type':_0x5ae314,'resourceId':_0x2d33c4['id']}})[_0xa3f8('0x19')](function(){return _0x2d5ce2;});})[_0xa3f8('0x19')](function(){_0x53eb81[_0xa3f8('0x22')](0xcc)[_0xa3f8('0x2f')]();});}};}function handleEntityNotFound(_0x10ca15,_0x28cc2c){return function(_0x3ee1a1){if(!_0x3ee1a1){_0x10ca15[_0xa3f8('0x30')](0x194);}return _0x3ee1a1;};}function handleError(_0x2de5c4,_0x514d68){_0x514d68=_0x514d68||0x1f4;return function(_0x167fe7){logger[_0xa3f8('0x1e')](_0x167fe7[_0xa3f8('0x31')]);if(_0x167fe7[_0xa3f8('0x32')]){delete _0x167fe7['name'];}_0x2de5c4[_0xa3f8('0x22')](_0x514d68)[_0xa3f8('0x33')](_0x167fe7);};}exports['index']=function(_0x2da9f7,_0x49281e){var _0x1f189e={},_0x495bca={},_0x1394ce={'count':0x0,'rows':[]};var _0x57ce53=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x2fb604){return{'name':_0x2fb604[_0xa3f8('0x37')],'type':_0x2fb604[_0xa3f8('0x38')]['key']};});_0x495bca[_0xa3f8('0x39')]=_[_0xa3f8('0x34')](_0x57ce53,_0xa3f8('0x32'));_0x495bca['query']=_['keys'](_0x2da9f7['query']);_0x495bca[_0xa3f8('0x3a')]=_[_0xa3f8('0x3b')](_0x495bca[_0xa3f8('0x39')],_0x495bca[_0xa3f8('0x3c')]);_0x1f189e[_0xa3f8('0x3d')]=_['intersection'](_0x495bca[_0xa3f8('0x39')],qs[_0xa3f8('0x3e')](_0x2da9f7['query'][_0xa3f8('0x3e')]));_0x1f189e[_0xa3f8('0x3d')]=_0x1f189e['attributes'][_0xa3f8('0x3f')]?_0x1f189e[_0xa3f8('0x3d')]:_0x495bca[_0xa3f8('0x39')];if(!_0x2da9f7[_0xa3f8('0x3c')][_0xa3f8('0x40')](_0xa3f8('0x41'))){_0x1f189e['limit']=qs[_0xa3f8('0x25')](_0x2da9f7[_0xa3f8('0x3c')][_0xa3f8('0x25')]);_0x1f189e['offset']=qs[_0xa3f8('0x23')](_0x2da9f7[_0xa3f8('0x3c')][_0xa3f8('0x23')]);}_0x1f189e['order']=qs[_0xa3f8('0x42')](_0x2da9f7[_0xa3f8('0x3c')][_0xa3f8('0x42')]);_0x1f189e['where']=qs[_0xa3f8('0x3a')](_[_0xa3f8('0x43')](_0x2da9f7[_0xa3f8('0x3c')],_0x495bca[_0xa3f8('0x3a')]),_0x57ce53);if(_0x2da9f7[_0xa3f8('0x3c')][_0xa3f8('0x44')]){_0x1f189e[_0xa3f8('0x45')]=_[_0xa3f8('0x46')](_0x1f189e[_0xa3f8('0x45')],{'$or':_[_0xa3f8('0x34')](_0x57ce53,function(_0x38f3d5){if(_0x38f3d5[_0xa3f8('0x38')]!=='VIRTUAL'){var _0x34e643={};_0x34e643[_0x38f3d5[_0xa3f8('0x32')]]={'$like':'%'+_0x2da9f7[_0xa3f8('0x3c')][_0xa3f8('0x44')]+'%'};return _0x34e643;}})});}_0x1f189e=_['merge']({},_0x1f189e,_0x2da9f7[_0xa3f8('0x47')]);var _0x4a2114={'where':_0x1f189e[_0xa3f8('0x45')]};return db[_0xa3f8('0x35')][_0xa3f8('0x26')](_0x4a2114)['then'](function(_0x5a2168){_0x1394ce[_0xa3f8('0x26')]=_0x5a2168;if(_0x2da9f7[_0xa3f8('0x3c')]['includeAll']){_0x1f189e[_0xa3f8('0x48')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x1f189e);})[_0xa3f8('0x19')](function(_0x24ab99){_0x1394ce[_0xa3f8('0x49')]=_0x24ab99;return _0x1394ce;})[_0xa3f8('0x19')](respondWithFilteredResult(_0x49281e,_0x1f189e))['catch'](handleError(_0x49281e,null));};exports[_0xa3f8('0x4a')]=function(_0x41d3c4,_0x211cce){var _0x1db19d={'raw':![],'where':{'id':_0x41d3c4[_0xa3f8('0x4b')]['id']}},_0x40c4fc={};_0x40c4fc[_0xa3f8('0x39')]=_[_0xa3f8('0x4c')](db['VoiceContext'][_0xa3f8('0x36')]);_0x40c4fc[_0xa3f8('0x3c')]=_['keys'](_0x41d3c4[_0xa3f8('0x3c')]);_0x40c4fc[_0xa3f8('0x3a')]=_[_0xa3f8('0x3b')](_0x40c4fc['model'],_0x40c4fc[_0xa3f8('0x3c')]);_0x1db19d[_0xa3f8('0x3d')]=_['intersection'](_0x40c4fc[_0xa3f8('0x39')],qs[_0xa3f8('0x3e')](_0x41d3c4['query'][_0xa3f8('0x3e')]));_0x1db19d[_0xa3f8('0x3d')]=_0x1db19d[_0xa3f8('0x3d')][_0xa3f8('0x3f')]?_0x1db19d[_0xa3f8('0x3d')]:_0x40c4fc['model'];if(_0x41d3c4[_0xa3f8('0x3c')]['includeAll']){_0x1db19d[_0xa3f8('0x48')]=[{'all':!![]}];}_0x1db19d=_['merge']({},_0x1db19d,_0x41d3c4[_0xa3f8('0x47')]);return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x1db19d)[_0xa3f8('0x19')](handleEntityNotFound(_0x211cce,null))[_0xa3f8('0x19')](respondWithResult(_0x211cce,null))['catch'](handleError(_0x211cce,null));};exports['create']=function(_0x5972d4,_0x543fd8,_0x267750){var _0x55d84f;return db['VoiceContext'][_0xa3f8('0x4e')](_0x5972d4[_0xa3f8('0x4f')],{'raw':!![]})[_0xa3f8('0x19')](function(_0x540b39){_0x55d84f=_0x540b39;return db[_0xa3f8('0x35')][_0xa3f8('0x50')]({'raw':!![]});})[_0xa3f8('0x19')](function(_0x2dc06d){var _0x3c9652=fs[_0xa3f8('0x51')](path[_0xa3f8('0x52')](config['root'],_0xa3f8('0x53')),_0xa3f8('0x54'));var _0x985f05=ejs['render'](_0x3c9652,{'contexts':_0x2dc06d||[]});fs[_0xa3f8('0x55')](_0xa3f8('0x56'),_0x985f05);})['then'](function(){return respondWithRpcPromise(_0xa3f8('0x57'),_0xa3f8('0x4e'),{'module':_0xa3f8('0x58')});})[_0xa3f8('0x19')](function(){var _0x2bd8fc=_0x5972d4[_0xa3f8('0x59')][_0xa3f8('0x2d')]({'plain':!![]});if(!_0x2bd8fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bd8fc[_0xa3f8('0x5a')]==='user'){var _0x108d75=_0x55d84f['get']({'plain':!![]});return db[_0xa3f8('0x5b')]['find']({'where':{'name':_0xa3f8('0x2e'),'userProfileId':_0x2bd8fc[_0xa3f8('0x5c')]},'raw':!![]})['then'](function(_0x567fae){if(_0x567fae&&_0x567fae['autoAssociation']===0x0){return db[_0xa3f8('0x5d')][_0xa3f8('0x4e')]({'name':_0x108d75[_0xa3f8('0x32')],'resourceId':_0x108d75['id'],'type':_0x567fae['name'],'sectionId':_0x567fae['id']},{})['then'](function(){return _0x55d84f;});}else{return _0x55d84f;}})[_0xa3f8('0x21')](function(_0x138421){logger['error'](_0xa3f8('0x5e'),_0x138421);throw _0x138421;});}return _0x55d84f;})[_0xa3f8('0x19')](respondWithResult(_0x543fd8,0xc9))[_0xa3f8('0x21')](handleError(_0x543fd8,null));};exports[_0xa3f8('0x2b')]=function(_0x5aa0e7,_0x2af785,_0x169661){var _0x322a61;return db[_0xa3f8('0x35')]['find']({'where':{'id':_0x5aa0e7[_0xa3f8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2af785,null))[_0xa3f8('0x19')](saveUpdates(_0x5aa0e7['body'],null))['then'](function(_0x30474d){if(_0x30474d){_0x322a61=_0x30474d;return db['VoiceContext'][_0xa3f8('0x50')]({'raw':!![]});}})[_0xa3f8('0x19')](function(_0x239f26){var _0x9ae03c=fs[_0xa3f8('0x51')](path[_0xa3f8('0x52')](config[_0xa3f8('0x5f')],_0xa3f8('0x53')),'utf8');var _0xe083cb=ejs[_0xa3f8('0x60')](_0x9ae03c,{'contexts':_0x239f26||[]});fs[_0xa3f8('0x55')](_0xa3f8('0x56'),_0xe083cb);})[_0xa3f8('0x19')](function(){return respondWithRpcPromise('Reload','update',{'module':_0xa3f8('0x58')});})['then'](function(){return _0x322a61;})[_0xa3f8('0x19')](respondWithResult(_0x2af785,null))[_0xa3f8('0x21')](handleError(_0x2af785,null));};exports[_0xa3f8('0x2c')]=function(_0xfb6546,_0x2c804b,_0x283442){var _0x4d958b;return db[_0xa3f8('0x35')]['find']({'where':{'id':_0xfb6546[_0xa3f8('0x4b')]['id']}})[_0xa3f8('0x19')](handleEntityNotFound(_0x2c804b,null))[_0xa3f8('0x19')](removeEntity(_0x2c804b,null))[_0xa3f8('0x19')](function(){return db[_0xa3f8('0x35')][_0xa3f8('0x50')]({'raw':!![]});})[_0xa3f8('0x19')](function(_0x58b80c){var _0x12cc5a=fs[_0xa3f8('0x51')](path[_0xa3f8('0x52')](config[_0xa3f8('0x5f')],_0xa3f8('0x53')),_0xa3f8('0x54'));var _0x26970a=ejs[_0xa3f8('0x60')](_0x12cc5a,{'contexts':_0x58b80c});fs[_0xa3f8('0x55')](_0xa3f8('0x56'),_0x26970a);return respondWithRpcPromise(_0xa3f8('0x57'),_0xa3f8('0x2c'),{'module':'chan_sip.so'});})[_0xa3f8('0x21')](handleError(_0x2c804b,null));}; \ No newline at end of file +var _0x5ba1=['../../config/environment','../../config/license/util','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','show','create','body','join','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Contexts','userProfileId','autoAssociation','update','params','utf8','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x59e0d9,_0x5bf997){var _0x54dd4b=function(_0x5c2b0a){while(--_0x5c2b0a){_0x59e0d9['push'](_0x59e0d9['shift']());}};_0x54dd4b(++_0x5bf997);}(_0x5ba1,0x17e));var _0x15ba=function(_0x5d18b7,_0x2ddebc){_0x5d18b7=_0x5d18b7-0x0;var _0x4073f8=_0x5ba1[_0x5d18b7];return _0x4073f8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x15ba('0x0'));var jsonpatch=require(_0x15ba('0x1'));var rp=require(_0x15ba('0x2'));var moment=require(_0x15ba('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x15ba('0x4'));var util=require(_0x15ba('0x5'));var path=require('path');var sox=require(_0x15ba('0x6'));var csv=require(_0x15ba('0x7'));var ejs=require(_0x15ba('0x8'));var fs=require('fs');var fs_extra=require(_0x15ba('0x9'));var _=require(_0x15ba('0xa'));var squel=require(_0x15ba('0xb'));var crypto=require(_0x15ba('0xc'));var jsforce=require(_0x15ba('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x15ba('0x7'));var querystring=require(_0x15ba('0xe'));var Papa=require(_0x15ba('0xf'));var Redis=require(_0x15ba('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x15ba('0x11'));var as=require(_0x15ba('0x12'));var hardwareService=require(_0x15ba('0x13'));var logger=require('../../config/logger')(_0x15ba('0x14'));var utils=require(_0x15ba('0x15'));var config=require(_0x15ba('0x16'));var licenseUtil=require(_0x15ba('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x15ba('0x18'));var client=jayson[_0x15ba('0x19')][_0x15ba('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2b42c0,_0x4af34b,_0x1083a8,_0x2f337c){return new BPromise(function(_0x2a9a3c,_0x4c35ad){var _0x391254=_0x2f337c||client;return _0x391254['request'](_0x2b42c0,_0x1083a8)[_0x15ba('0x1b')](function(_0x3eb9ac){logger[_0x15ba('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x4af34b,_0x15ba('0x1d'));logger[_0x15ba('0x1e')](_0x15ba('0x1f'),_0x4af34b,_0x15ba('0x1d'),JSON['stringify'](_0x3eb9ac));if(_0x3eb9ac['error']){if(_0x3eb9ac[_0x15ba('0x20')]['code']===0x1f4){logger[_0x15ba('0x20')](_0x15ba('0x21'),_0x4af34b,_0x3eb9ac[_0x15ba('0x20')][_0x15ba('0x22')]);return _0x4c35ad(_0x3eb9ac[_0x15ba('0x20')]['message']);}logger['error'](_0x15ba('0x21'),_0x4af34b,_0x3eb9ac['error'][_0x15ba('0x22')]);return _0x2a9a3c(_0x3eb9ac[_0x15ba('0x20')][_0x15ba('0x22')]);}else{logger[_0x15ba('0x1c')](_0x15ba('0x21'),_0x4af34b,_0x15ba('0x1d'));_0x2a9a3c(_0x3eb9ac[_0x15ba('0x23')]['message']);}})[_0x15ba('0x24')](function(_0x5be037){logger[_0x15ba('0x20')](_0x15ba('0x21'),_0x4af34b,_0x5be037);_0x4c35ad(_0x5be037);});});}function respondWithStatusCode(_0x406eca,_0x56e375){_0x56e375=_0x56e375||0xcc;return function(_0x49976f){if(_0x49976f){return _0x406eca[_0x15ba('0x25')](_0x56e375);}return _0x406eca[_0x15ba('0x26')](_0x56e375)[_0x15ba('0x27')]();};}function respondWithResult(_0x318db0,_0x45bcb6){_0x45bcb6=_0x45bcb6||0xc8;return function(_0x3d3cdd){if(_0x3d3cdd){return _0x318db0[_0x15ba('0x26')](_0x45bcb6)[_0x15ba('0x28')](_0x3d3cdd);}};}function respondWithFilteredResult(_0x3f1887,_0x47e2e9){return function(_0x1460a1){if(_0x1460a1){var _0x416815=typeof _0x47e2e9[_0x15ba('0x29')]==='undefined'&&typeof _0x47e2e9['limit']==='undefined';var _0x51418d=_0x1460a1[_0x15ba('0x2a')];var _0x55f517=_0x416815?0x0:_0x47e2e9['offset'];var _0x58d35b=_0x416815?_0x1460a1[_0x15ba('0x2a')]:_0x47e2e9['offset']+_0x47e2e9[_0x15ba('0x2b')];var _0x2fd67c;if(_0x58d35b>=_0x51418d){_0x58d35b=_0x51418d;_0x2fd67c=0xc8;}else{_0x2fd67c=0xce;}_0x3f1887[_0x15ba('0x26')](_0x2fd67c);return _0x3f1887['set'](_0x15ba('0x2c'),_0x55f517+'-'+_0x58d35b+'/'+_0x51418d)['json'](_0x1460a1);}return null;};}function patchUpdates(_0x4df9fb){return function(_0x33c9a4){try{jsonpatch[_0x15ba('0x2d')](_0x33c9a4,_0x4df9fb,!![]);}catch(_0x57b755){return BPromise[_0x15ba('0x2e')](_0x57b755);}return _0x33c9a4[_0x15ba('0x2f')]();};}function saveUpdates(_0x547188,_0x3679f5){return function(_0x8ce6b1){if(_0x8ce6b1){return _0x8ce6b1['update'](_0x547188)[_0x15ba('0x1b')](function(_0x7f7398){return _0x7f7398;});}return null;};}function removeEntity(_0x2e151d,_0x377173){return function(_0x19b2f0){if(_0x19b2f0){return _0x19b2f0[_0x15ba('0x30')]()[_0x15ba('0x1b')](function(){var _0x3a7263=_0x19b2f0[_0x15ba('0x31')]({'plain':!![]});var _0xec6340='Contexts';return db[_0x15ba('0x32')][_0x15ba('0x30')]({'where':{'type':_0xec6340,'resourceId':_0x3a7263['id']}})['then'](function(){return _0x19b2f0;});})[_0x15ba('0x1b')](function(){_0x2e151d[_0x15ba('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdd154b,_0x5102ac){return function(_0xe5b59d){if(!_0xe5b59d){_0xdd154b['sendStatus'](0x194);}return _0xe5b59d;};}function handleError(_0x1f3307,_0xdb9c53){_0xdb9c53=_0xdb9c53||0x1f4;return function(_0x5872ca){logger[_0x15ba('0x20')](_0x5872ca[_0x15ba('0x33')]);if(_0x5872ca['name']){delete _0x5872ca[_0x15ba('0x34')];}_0x1f3307['status'](_0xdb9c53)[_0x15ba('0x35')](_0x5872ca);};}exports[_0x15ba('0x36')]=function(_0x51da43,_0x170786){var _0x438cd2={},_0x498038={},_0x2ecac9={'count':0x0,'rows':[]};var _0xa78adc=_[_0x15ba('0x37')](db['VoiceContext'][_0x15ba('0x38')],function(_0x175a31){return{'name':_0x175a31[_0x15ba('0x39')],'type':_0x175a31[_0x15ba('0x3a')][_0x15ba('0x3b')]};});_0x498038['model']=_[_0x15ba('0x37')](_0xa78adc,_0x15ba('0x34'));_0x498038['query']=_[_0x15ba('0x3c')](_0x51da43[_0x15ba('0x3d')]);_0x498038['filters']=_[_0x15ba('0x3e')](_0x498038[_0x15ba('0x3f')],_0x498038[_0x15ba('0x3d')]);_0x438cd2[_0x15ba('0x40')]=_['intersection'](_0x498038[_0x15ba('0x3f')],qs[_0x15ba('0x41')](_0x51da43['query'][_0x15ba('0x41')]));_0x438cd2[_0x15ba('0x40')]=_0x438cd2[_0x15ba('0x40')][_0x15ba('0x42')]?_0x438cd2[_0x15ba('0x40')]:_0x498038[_0x15ba('0x3f')];if(!_0x51da43[_0x15ba('0x3d')]['hasOwnProperty'](_0x15ba('0x43'))){_0x438cd2[_0x15ba('0x2b')]=qs[_0x15ba('0x2b')](_0x51da43[_0x15ba('0x3d')][_0x15ba('0x2b')]);_0x438cd2[_0x15ba('0x29')]=qs['offset'](_0x51da43[_0x15ba('0x3d')][_0x15ba('0x29')]);}_0x438cd2['order']=qs[_0x15ba('0x44')](_0x51da43[_0x15ba('0x3d')][_0x15ba('0x44')]);_0x438cd2[_0x15ba('0x45')]=qs[_0x15ba('0x46')](_[_0x15ba('0x47')](_0x51da43[_0x15ba('0x3d')],_0x498038[_0x15ba('0x46')]),_0xa78adc);if(_0x51da43[_0x15ba('0x3d')]['filter']){_0x438cd2[_0x15ba('0x45')]=_[_0x15ba('0x48')](_0x438cd2['where'],{'$or':_[_0x15ba('0x37')](_0xa78adc,function(_0x242bb0){if(_0x242bb0[_0x15ba('0x3a')]!==_0x15ba('0x49')){var _0x4c1bba={};_0x4c1bba[_0x242bb0['name']]={'$like':'%'+_0x51da43[_0x15ba('0x3d')]['filter']+'%'};return _0x4c1bba;}})});}_0x438cd2=_[_0x15ba('0x48')]({},_0x438cd2,_0x51da43[_0x15ba('0x4a')]);var _0x48eb03={'where':_0x438cd2[_0x15ba('0x45')]};return db[_0x15ba('0x4b')][_0x15ba('0x2a')](_0x48eb03)['then'](function(_0x299263){_0x2ecac9[_0x15ba('0x2a')]=_0x299263;if(_0x51da43[_0x15ba('0x3d')][_0x15ba('0x4c')]){_0x438cd2[_0x15ba('0x4d')]=[{'all':!![]}];}return db[_0x15ba('0x4b')][_0x15ba('0x4e')](_0x438cd2);})[_0x15ba('0x1b')](function(_0x5f12a1){_0x2ecac9[_0x15ba('0x4f')]=_0x5f12a1;return _0x2ecac9;})['then'](respondWithFilteredResult(_0x170786,_0x438cd2))[_0x15ba('0x24')](handleError(_0x170786,null));};exports[_0x15ba('0x50')]=function(_0x46c9db,_0x41dfd4){var _0xedc8fd={'raw':![],'where':{'id':_0x46c9db['params']['id']}},_0x598eca={};_0x598eca[_0x15ba('0x3f')]=_[_0x15ba('0x3c')](db[_0x15ba('0x4b')][_0x15ba('0x38')]);_0x598eca[_0x15ba('0x3d')]=_[_0x15ba('0x3c')](_0x46c9db[_0x15ba('0x3d')]);_0x598eca[_0x15ba('0x46')]=_[_0x15ba('0x3e')](_0x598eca[_0x15ba('0x3f')],_0x598eca[_0x15ba('0x3d')]);_0xedc8fd[_0x15ba('0x40')]=_[_0x15ba('0x3e')](_0x598eca[_0x15ba('0x3f')],qs[_0x15ba('0x41')](_0x46c9db[_0x15ba('0x3d')][_0x15ba('0x41')]));_0xedc8fd[_0x15ba('0x40')]=_0xedc8fd[_0x15ba('0x40')][_0x15ba('0x42')]?_0xedc8fd['attributes']:_0x598eca[_0x15ba('0x3f')];if(_0x46c9db[_0x15ba('0x3d')][_0x15ba('0x4c')]){_0xedc8fd['include']=[{'all':!![]}];}_0xedc8fd=_['merge']({},_0xedc8fd,_0x46c9db[_0x15ba('0x4a')]);return db[_0x15ba('0x4b')]['find'](_0xedc8fd)[_0x15ba('0x1b')](handleEntityNotFound(_0x41dfd4,null))[_0x15ba('0x1b')](respondWithResult(_0x41dfd4,null))[_0x15ba('0x24')](handleError(_0x41dfd4,null));};exports[_0x15ba('0x51')]=function(_0xd400a7,_0x1050fe,_0xa80c3d){var _0x37011a;return db['VoiceContext']['create'](_0xd400a7[_0x15ba('0x52')],{'raw':!![]})[_0x15ba('0x1b')](function(_0x4585f0){_0x37011a=_0x4585f0;return db[_0x15ba('0x4b')][_0x15ba('0x4e')]({'raw':!![]});})[_0x15ba('0x1b')](function(_0x4f8f46){var _0x24ddc5=fs['readFileSync'](path[_0x15ba('0x53')](config[_0x15ba('0x54')],_0x15ba('0x55')),'utf8');var _0x52328e=ejs[_0x15ba('0x56')](_0x24ddc5,{'contexts':_0x4f8f46||[]});fs['writeFileSync'](_0x15ba('0x57'),_0x52328e);})[_0x15ba('0x1b')](function(){return respondWithRpcPromise(_0x15ba('0x58'),_0x15ba('0x51'),{'module':_0x15ba('0x59')});})[_0x15ba('0x1b')](function(){var _0x16482c=_0xd400a7[_0x15ba('0x5a')]['get']({'plain':!![]});if(!_0x16482c)throw new Error(_0x15ba('0x5b'));if(_0x16482c[_0x15ba('0x5c')]===_0x15ba('0x5a')){var _0x267b7e=_0x37011a[_0x15ba('0x31')]({'plain':!![]});return db[_0x15ba('0x5d')][_0x15ba('0x5e')]({'where':{'name':_0x15ba('0x5f'),'userProfileId':_0x16482c[_0x15ba('0x60')]},'raw':!![]})[_0x15ba('0x1b')](function(_0x577ec1){if(_0x577ec1&&_0x577ec1[_0x15ba('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x267b7e[_0x15ba('0x34')],'resourceId':_0x267b7e['id'],'type':_0x577ec1[_0x15ba('0x34')],'sectionId':_0x577ec1['id']},{})[_0x15ba('0x1b')](function(){return _0x37011a;});}else{return _0x37011a;}})[_0x15ba('0x24')](function(_0x5db3d2){logger[_0x15ba('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5db3d2);throw _0x5db3d2;});}return _0x37011a;})['then'](respondWithResult(_0x1050fe,0xc9))[_0x15ba('0x24')](handleError(_0x1050fe,null));};exports[_0x15ba('0x62')]=function(_0x1f6f85,_0x4a20ce,_0x2bdd96){var _0x3de15b;return db['VoiceContext'][_0x15ba('0x5e')]({'where':{'id':_0x1f6f85[_0x15ba('0x63')]['id']}})[_0x15ba('0x1b')](handleEntityNotFound(_0x4a20ce,null))[_0x15ba('0x1b')](saveUpdates(_0x1f6f85['body'],null))[_0x15ba('0x1b')](function(_0x501127){if(_0x501127){_0x3de15b=_0x501127;return db['VoiceContext'][_0x15ba('0x4e')]({'raw':!![]});}})[_0x15ba('0x1b')](function(_0x2ab3d0){var _0x36a794=fs['readFileSync'](path[_0x15ba('0x53')](config[_0x15ba('0x54')],_0x15ba('0x55')),_0x15ba('0x64'));var _0xb25579=ejs['render'](_0x36a794,{'contexts':_0x2ab3d0||[]});fs['writeFileSync'](_0x15ba('0x57'),_0xb25579);})[_0x15ba('0x1b')](function(){return respondWithRpcPromise(_0x15ba('0x58'),_0x15ba('0x62'),{'module':'chan_sip.so'});})[_0x15ba('0x1b')](function(){return _0x3de15b;})[_0x15ba('0x1b')](respondWithResult(_0x4a20ce,null))['catch'](handleError(_0x4a20ce,null));};exports['destroy']=function(_0x4a4e49,_0x4aebd0,_0x480c93){var _0x2f09c3;return db[_0x15ba('0x4b')][_0x15ba('0x5e')]({'where':{'id':_0x4a4e49[_0x15ba('0x63')]['id']}})[_0x15ba('0x1b')](handleEntityNotFound(_0x4aebd0,null))[_0x15ba('0x1b')](removeEntity(_0x4aebd0,null))[_0x15ba('0x1b')](function(){return db[_0x15ba('0x4b')][_0x15ba('0x4e')]({'raw':!![]});})[_0x15ba('0x1b')](function(_0x105f83){var _0x5a52f7=fs['readFileSync'](path[_0x15ba('0x53')](config[_0x15ba('0x54')],_0x15ba('0x55')),_0x15ba('0x64'));var _0x272f4a=ejs['render'](_0x5a52f7,{'contexts':_0x105f83});fs['writeFileSync'](_0x15ba('0x57'),_0x272f4a);return respondWithRpcPromise(_0x15ba('0x58'),_0x15ba('0x30'),{'module':_0x15ba('0x59')});})[_0x15ba('0x24')](handleError(_0x4aebd0,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 8ba5d82..3c9fef6 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 _0x6ec8=['moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','util','api'];(function(_0x479dce,_0x4dce8b){var _0x320557=function(_0x130d44){while(--_0x130d44){_0x479dce['push'](_0x479dce['shift']());}};_0x320557(++_0x4dce8b);}(_0x6ec8,0x18a));var _0x86ec=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x6ec8[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require('lodash');var util=require(_0x86ec('0x0'));var logger=require('../../config/logger')(_0x86ec('0x1'));var moment=require(_0x86ec('0x2'));var BPromise=require(_0x86ec('0x3'));var rp=require(_0x86ec('0x4'));var fs=require('fs');var path=require(_0x86ec('0x5'));var rimraf=require(_0x86ec('0x6'));var config=require('../../config/environment');var attributes=require(_0x86ec('0x7'));module[_0x86ec('0x8')]=function(_0x1091da,_0x2c4e9d){return _0x1091da['define']('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfbb=['VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','define'];(function(_0x430b24,_0x2e654a){var _0x1258ac=function(_0x492a5e){while(--_0x492a5e){_0x430b24['push'](_0x430b24['shift']());}};_0x1258ac(++_0x2e654a);}(_0xcfbb,0xf9));var _0xbcfb=function(_0x1f43f4,_0x16d500){_0x1f43f4=_0x1f43f4-0x0;var _0x5435b7=_0xcfbb[_0x1f43f4];return _0x5435b7;};'use strict';var _=require(_0xbcfb('0x0'));var util=require(_0xbcfb('0x1'));var logger=require(_0xbcfb('0x2'))(_0xbcfb('0x3'));var moment=require(_0xbcfb('0x4'));var BPromise=require(_0xbcfb('0x5'));var rp=require(_0xbcfb('0x6'));var fs=require('fs');var path=require(_0xbcfb('0x7'));var rimraf=require(_0xbcfb('0x8'));var config=require('../../config/environment');var attributes=require(_0xbcfb('0x9'));module['exports']=function(_0x404df8,_0x321a91){return _0x404df8[_0xbcfb('0xa')](_0xbcfb('0xb'),attributes,{'tableName':_0xbcfb('0xc'),'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 d1551cf..e818d42 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 _0xb627=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xb627,0x144));var _0x7b62=function(_0x55e28f,_0x20cedb){_0x55e28f=_0x55e28f-0x0;var _0xee48e9=_0xb627[_0x55e28f];return _0xee48e9;};'use strict';var _=require(_0x7b62('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7b62('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b62('0x2'));var db=require(_0x7b62('0x3'))['db'];var utils=require(_0x7b62('0x4'));var logger=require(_0x7b62('0x5'))(_0x7b62('0x6'));var config=require(_0x7b62('0x7'));var jayson=require(_0x7b62('0x8'));var client=jayson['client'][_0x7b62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x547533,_0x387d76,_0x264cfa){return new BPromise(function(_0x4ae3ef,_0x30652e){return client['request'](_0x547533,_0x264cfa)[_0x7b62('0xa')](function(_0x379d07){logger[_0x7b62('0xb')]('VoiceContext,\x20%s,\x20%s',_0x387d76,_0x7b62('0xc'));logger[_0x7b62('0xd')](_0x7b62('0xe'),_0x387d76,_0x7b62('0xc'),JSON[_0x7b62('0xf')](_0x379d07));if(_0x379d07[_0x7b62('0x10')]){if(_0x379d07[_0x7b62('0x10')][_0x7b62('0x11')]===0x1f4){logger[_0x7b62('0x10')](_0x7b62('0x12'),_0x387d76,_0x379d07[_0x7b62('0x10')][_0x7b62('0x13')]);return _0x30652e(_0x379d07[_0x7b62('0x10')]['message']);}logger[_0x7b62('0x10')]('VoiceContext,\x20%s,\x20%s',_0x387d76,_0x379d07[_0x7b62('0x10')]['message']);return _0x4ae3ef(_0x379d07[_0x7b62('0x10')]['message']);}else{logger['info'](_0x7b62('0x12'),_0x387d76,'request\x20sent');_0x4ae3ef(_0x379d07[_0x7b62('0x14')][_0x7b62('0x13')]);}})[_0x7b62('0x15')](function(_0x4ebaa2){logger[_0x7b62('0x10')]('VoiceContext,\x20%s,\x20%s',_0x387d76,_0x4ebaa2);_0x30652e(_0x4ebaa2);});});} \ No newline at end of file +var _0x3c1a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x5bbb5a,_0xb5f0d6){var _0x3b38c7=function(_0x48845a){while(--_0x48845a){_0x5bbb5a['push'](_0x5bbb5a['shift']());}};_0x3b38c7(++_0xb5f0d6);}(_0x3c1a,0xda));var _0xa3c1=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0x3c1a[_0x5a4400];return _0xf9b532;};'use strict';var _=require(_0xa3c1('0x0'));var util=require(_0xa3c1('0x1'));var moment=require(_0xa3c1('0x2'));var BPromise=require(_0xa3c1('0x3'));var rs=require(_0xa3c1('0x4'));var fs=require('fs');var Redis=require(_0xa3c1('0x5'));var db=require(_0xa3c1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3c1('0x7'))('rpc');var config=require(_0xa3c1('0x8'));var jayson=require(_0xa3c1('0x9'));var client=jayson[_0xa3c1('0xa')][_0xa3c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x546253,_0x549d7d,_0x3a42ed){return new BPromise(function(_0x1aa471,_0x3a4718){return client[_0xa3c1('0xc')](_0x546253,_0x3a42ed)[_0xa3c1('0xd')](function(_0x4fac66){logger[_0xa3c1('0xe')]('VoiceContext,\x20%s,\x20%s',_0x549d7d,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x549d7d,_0xa3c1('0xf'),JSON[_0xa3c1('0x10')](_0x4fac66));if(_0x4fac66[_0xa3c1('0x11')]){if(_0x4fac66[_0xa3c1('0x11')][_0xa3c1('0x12')]===0x1f4){logger[_0xa3c1('0x11')](_0xa3c1('0x13'),_0x549d7d,_0x4fac66['error'][_0xa3c1('0x14')]);return _0x3a4718(_0x4fac66[_0xa3c1('0x11')][_0xa3c1('0x14')]);}logger[_0xa3c1('0x11')](_0xa3c1('0x13'),_0x549d7d,_0x4fac66[_0xa3c1('0x11')][_0xa3c1('0x14')]);return _0x1aa471(_0x4fac66['error'][_0xa3c1('0x14')]);}else{logger[_0xa3c1('0xe')]('VoiceContext,\x20%s,\x20%s',_0x549d7d,_0xa3c1('0xf'));_0x1aa471(_0x4fac66[_0xa3c1('0x15')]['message']);}})['catch'](function(_0x37d3a6){logger['error'](_0xa3c1('0x13'),_0x549d7d,_0x37d3a6);_0x3a4718(_0x37d3a6);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4f57258..5b011e8 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 _0x0404=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','/:id','isAuthenticated','post','create','delete','destroy','exports','util','path','connect-timeout'];(function(_0x1953a0,_0x26009c){var _0x285391=function(_0x5771aa){while(--_0x5771aa){_0x1953a0['push'](_0x1953a0['shift']());}};_0x285391(++_0x26009c);}(_0x0404,0xf4));var _0x4040=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0x0404[_0x50e40b];return _0x2608b7;};'use strict';var multer=require('multer');var util=require(_0x4040('0x0'));var path=require(_0x4040('0x1'));var timeout=require(_0x4040('0x2'));var express=require(_0x4040('0x3'));var router=express[_0x4040('0x4')]();var fs_extra=require(_0x4040('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4040('0x6'));var config=require(_0x4040('0x7'));var controller=require(_0x4040('0x8'));router[_0x4040('0x9')]('/',auth['isAuthenticated'](),controller[_0x4040('0xa')]);router['get'](_0x4040('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x4040('0x9')](_0x4040('0xc'),auth[_0x4040('0xd')](),controller['show']);router[_0x4040('0xe')]('/',auth[_0x4040('0xd')](),controller[_0x4040('0xf')]);router['put'](_0x4040('0xc'),auth[_0x4040('0xd')](),controller['update']);router[_0x4040('0x10')](_0x4040('0xc'),auth['isAuthenticated'](),controller[_0x4040('0x11')]);module[_0x4040('0x12')]=router; \ No newline at end of file +var _0x5c58=['../../config/environment','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x964d73,_0x1d2e12){var _0x22e7cc=function(_0x1aa62f){while(--_0x1aa62f){_0x964d73['push'](_0x964d73['shift']());}};_0x22e7cc(++_0x1d2e12);}(_0x5c58,0x154));var _0x85c5=function(_0x1ef3bf,_0x3bb311){_0x1ef3bf=_0x1ef3bf-0x0;var _0x2c99b2=_0x5c58[_0x1ef3bf];return _0x2c99b2;};'use strict';var multer=require('multer');var util=require(_0x85c5('0x0'));var path=require(_0x85c5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85c5('0x2')]();var fs_extra=require(_0x85c5('0x3'));var auth=require(_0x85c5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x85c5('0x5'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0x85c5('0x6')](),controller['index']);router[_0x85c5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x85c5('0x7')](_0x85c5('0x8'),auth['isAuthenticated'](),controller[_0x85c5('0x9')]);router['post']('/',auth[_0x85c5('0x6')](),controller[_0x85c5('0xa')]);router[_0x85c5('0xb')](_0x85c5('0x8'),auth['isAuthenticated'](),controller[_0x85c5('0xc')]);router[_0x85c5('0xd')](_0x85c5('0x8'),auth[_0x85c5('0x6')](),controller[_0x85c5('0xe')]);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 e4d813a..796c730 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 _0x00bb=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x144313,_0x3f7fdc){var _0xc90cf=function(_0xc80fe8){while(--_0xc80fe8){_0x144313['push'](_0x144313['shift']());}};_0xc90cf(++_0x3f7fdc);}(_0x00bb,0x1d8));var _0xb00b=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x00bb[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'privilege':{'type':Sequelize[_0xb00b('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb00b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb00b('0x2')]},'calleridname':{'type':Sequelize[_0xb00b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'language':{'type':Sequelize[_0xb00b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb00b('0x3')]},'uniqueid':{'type':Sequelize[_0xb00b('0x2')]},'linkedid':{'type':Sequelize[_0xb00b('0x2')]},'destchannel':{'type':Sequelize[_0xb00b('0x2')]},'destchannelstate':{'type':Sequelize[_0xb00b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb00b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb00b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'destlanguage':{'type':Sequelize[_0xb00b('0x2')]},'destaccountcode':{'type':Sequelize[_0xb00b('0x2')]},'destcontext':{'type':Sequelize[_0xb00b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb00b('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb00b('0x2')]},'starttime':{'type':Sequelize[_0xb00b('0x4')]},'answertime':{'type':Sequelize[_0xb00b('0x4')]},'endtime':{'type':Sequelize[_0xb00b('0x4')]},'lastevent':{'type':Sequelize[_0xb00b('0x2')],'comment':_0xb00b('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xb00b('0x3')]},'holdtime':{'type':Sequelize[_0xb00b('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x008c=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x3269c1,_0x14f322){var _0xda0b8c=function(_0x4ead46){while(--_0x4ead46){_0x3269c1['push'](_0x3269c1['shift']());}};_0xda0b8c(++_0x14f322);}(_0x008c,0x188));var _0xc008=function(_0x294aef,_0x378f98){_0x294aef=_0x294aef-0x0;var _0x4d235d=_0x008c[_0x294aef];return _0x4d235d;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'privilege':{'type':Sequelize[_0xc008('0x2')]},'channel':{'type':Sequelize[_0xc008('0x2')]},'channelstate':{'type':Sequelize[_0xc008('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc008('0x2')]},'calleridname':{'type':Sequelize[_0xc008('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'connectedlinename':{'type':Sequelize[_0xc008('0x2')]},'language':{'type':Sequelize[_0xc008('0x2')]},'accountcode':{'type':Sequelize[_0xc008('0x2')]},'context':{'type':Sequelize[_0xc008('0x2')]},'exten':{'type':Sequelize[_0xc008('0x2')]},'priority':{'type':Sequelize[_0xc008('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xc008('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc008('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc008('0x2')]},'destexten':{'type':Sequelize[_0xc008('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xc008('0x2')]},'destlinkedid':{'type':Sequelize[_0xc008('0x2')]},'dialstring':{'type':Sequelize[_0xc008('0x2')]},'dialstatus':{'type':Sequelize[_0xc008('0x2')]},'starttime':{'type':Sequelize[_0xc008('0x4')]},'answertime':{'type':Sequelize[_0xc008('0x4')]},'endtime':{'type':Sequelize[_0xc008('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xc008('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xc008('0x3')]},'billableseconds':{'type':Sequelize[_0xc008('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index fa39fd3..91b6460 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 _0xd7d3=['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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','VoiceDialReport','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xd7d3,0x97));var _0x3d7d=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xd7d3[_0x1f71d8];return _0x10b045;};'use strict';var emlformat=require(_0x3d7d('0x0'));var rimraf=require(_0x3d7d('0x1'));var zipdir=require(_0x3d7d('0x2'));var jsonpatch=require(_0x3d7d('0x3'));var rp=require(_0x3d7d('0x4'));var moment=require(_0x3d7d('0x5'));var BPromise=require(_0x3d7d('0x6'));var Mustache=require(_0x3d7d('0x7'));var util=require(_0x3d7d('0x8'));var path=require(_0x3d7d('0x9'));var sox=require(_0x3d7d('0xa'));var csv=require(_0x3d7d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d7d('0xc'));var _=require(_0x3d7d('0xd'));var squel=require(_0x3d7d('0xe'));var crypto=require('crypto');var jsforce=require(_0x3d7d('0xf'));var deskjs=require(_0x3d7d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3d7d('0x11'));var Papa=require(_0x3d7d('0x12'));var Redis=require(_0x3d7d('0x13'));var authService=require(_0x3d7d('0x14'));var qs=require(_0x3d7d('0x15'));var as=require(_0x3d7d('0x16'));var hardwareService=require(_0x3d7d('0x17'));var logger=require(_0x3d7d('0x18'))('api');var utils=require(_0x3d7d('0x19'));var config=require(_0x3d7d('0x1a'));var licenseUtil=require(_0x3d7d('0x1b'));var db=require(_0x3d7d('0x1c'))['db'];function respondWithStatusCode(_0x22c8b4,_0x5cb24a){_0x5cb24a=_0x5cb24a||0xcc;return function(_0xc5e2d0){if(_0xc5e2d0){return _0x22c8b4[_0x3d7d('0x1d')](_0x5cb24a);}return _0x22c8b4['status'](_0x5cb24a)[_0x3d7d('0x1e')]();};}function respondWithResult(_0x5e0dba,_0x5c9d2e){_0x5c9d2e=_0x5c9d2e||0xc8;return function(_0x5b42c6){if(_0x5b42c6){return _0x5e0dba['status'](_0x5c9d2e)[_0x3d7d('0x1f')](_0x5b42c6);}};}function respondWithFilteredResult(_0x4a299b,_0x1e0064){return function(_0x502c45){if(_0x502c45){var _0x1d00d8=typeof _0x1e0064[_0x3d7d('0x20')]===_0x3d7d('0x21')&&typeof _0x1e0064[_0x3d7d('0x22')]===_0x3d7d('0x21');var _0x38acd7=_0x502c45[_0x3d7d('0x23')];var _0x422b81=_0x1d00d8?0x0:_0x1e0064[_0x3d7d('0x20')];var _0x308781=_0x1d00d8?_0x502c45['count']:_0x1e0064[_0x3d7d('0x20')]+_0x1e0064[_0x3d7d('0x22')];var _0xf1cb10;if(_0x308781>=_0x38acd7){_0x308781=_0x38acd7;_0xf1cb10=0xc8;}else{_0xf1cb10=0xce;}_0x4a299b[_0x3d7d('0x24')](_0xf1cb10);return _0x4a299b[_0x3d7d('0x25')](_0x3d7d('0x26'),_0x422b81+'-'+_0x308781+'/'+_0x38acd7)['json'](_0x502c45);}return null;};}function patchUpdates(_0x238ba9){return function(_0x717aa6){try{jsonpatch[_0x3d7d('0x27')](_0x717aa6,_0x238ba9,!![]);}catch(_0x54c55f){return BPromise[_0x3d7d('0x28')](_0x54c55f);}return _0x717aa6[_0x3d7d('0x29')]();};}function saveUpdates(_0x19679f,_0xb3c7b2){return function(_0xf03302){if(_0xf03302){return _0xf03302[_0x3d7d('0x2a')](_0x19679f)[_0x3d7d('0x2b')](function(_0x1c7c69){return _0x1c7c69;});}return null;};}function removeEntity(_0x4bf8f7,_0x1e310d){return function(_0x456995){if(_0x456995){return _0x456995['destroy']()[_0x3d7d('0x2b')](function(){_0x4bf8f7[_0x3d7d('0x24')](0xcc)[_0x3d7d('0x1e')]();});}};}function handleEntityNotFound(_0x2fd9e8,_0x459ae4){return function(_0x20fb08){if(!_0x20fb08){_0x2fd9e8[_0x3d7d('0x1d')](0x194);}return _0x20fb08;};}function handleError(_0x2e8603,_0x328237){_0x328237=_0x328237||0x1f4;return function(_0x104af5){logger[_0x3d7d('0x2c')](_0x104af5['stack']);if(_0x104af5[_0x3d7d('0x2d')]){delete _0x104af5['name'];}_0x2e8603[_0x3d7d('0x24')](_0x328237)[_0x3d7d('0x2e')](_0x104af5);};}exports[_0x3d7d('0x2f')]=function(_0x452316,_0x455549){var _0xf332a2={},_0x409bb9={},_0x7cd9ba={'count':0x0,'rows':[]};var _0x55fe08=_[_0x3d7d('0x30')](db[_0x3d7d('0x31')]['rawAttributes'],function(_0x237e08){return{'name':_0x237e08['fieldName'],'type':_0x237e08[_0x3d7d('0x32')]['key']};});_0x409bb9[_0x3d7d('0x33')]=_[_0x3d7d('0x30')](_0x55fe08,_0x3d7d('0x2d'));_0x409bb9[_0x3d7d('0x34')]=_[_0x3d7d('0x35')](_0x452316[_0x3d7d('0x34')]);_0x409bb9['filters']=_[_0x3d7d('0x36')](_0x409bb9[_0x3d7d('0x33')],_0x409bb9[_0x3d7d('0x34')]);_0xf332a2[_0x3d7d('0x37')]=_[_0x3d7d('0x36')](_0x409bb9[_0x3d7d('0x33')],qs['fields'](_0x452316['query'][_0x3d7d('0x38')]));_0xf332a2[_0x3d7d('0x37')]=_0xf332a2[_0x3d7d('0x37')]['length']?_0xf332a2['attributes']:_0x409bb9[_0x3d7d('0x33')];if(!_0x452316[_0x3d7d('0x34')][_0x3d7d('0x39')]('nolimit')){_0xf332a2[_0x3d7d('0x22')]=qs[_0x3d7d('0x22')](_0x452316[_0x3d7d('0x34')]['limit']);_0xf332a2[_0x3d7d('0x20')]=qs['offset'](_0x452316[_0x3d7d('0x34')][_0x3d7d('0x20')]);}_0xf332a2[_0x3d7d('0x3a')]=qs[_0x3d7d('0x3b')](_0x452316['query'][_0x3d7d('0x3b')]);_0xf332a2[_0x3d7d('0x3c')]=qs[_0x3d7d('0x3d')](_['pick'](_0x452316[_0x3d7d('0x34')],_0x409bb9[_0x3d7d('0x3d')]),_0x55fe08);if(_0x452316[_0x3d7d('0x34')][_0x3d7d('0x3e')]){_0xf332a2[_0x3d7d('0x3c')]=_[_0x3d7d('0x3f')](_0xf332a2['where'],{'$or':_[_0x3d7d('0x30')](_0x55fe08,function(_0x5a640b){if(_0x5a640b[_0x3d7d('0x32')]!==_0x3d7d('0x40')){var _0x4e1481={};_0x4e1481[_0x5a640b[_0x3d7d('0x2d')]]={'$like':'%'+_0x452316[_0x3d7d('0x34')]['filter']+'%'};return _0x4e1481;}})});}_0xf332a2=_[_0x3d7d('0x3f')]({},_0xf332a2,_0x452316['options']);var _0x286e21={'where':_0xf332a2['where']};return db['VoiceDialReport'][_0x3d7d('0x23')](_0x286e21)['then'](function(_0x4b728e){_0x7cd9ba[_0x3d7d('0x23')]=_0x4b728e;if(_0x452316[_0x3d7d('0x34')][_0x3d7d('0x41')]){_0xf332a2[_0x3d7d('0x42')]=[{'all':!![]}];}return db[_0x3d7d('0x31')][_0x3d7d('0x43')](_0xf332a2);})['then'](function(_0x268bb5){_0x7cd9ba[_0x3d7d('0x44')]=_0x268bb5;return _0x7cd9ba;})[_0x3d7d('0x2b')](respondWithFilteredResult(_0x455549,_0xf332a2))[_0x3d7d('0x45')](handleError(_0x455549,null));};exports[_0x3d7d('0x46')]=function(_0x30d72c,_0x4bdd09){var _0x28e614={'raw':!![],'where':{'id':_0x30d72c[_0x3d7d('0x47')]['id']}},_0x523013={};_0x523013[_0x3d7d('0x33')]=_[_0x3d7d('0x35')](db[_0x3d7d('0x31')]['rawAttributes']);_0x523013[_0x3d7d('0x34')]=_['keys'](_0x30d72c[_0x3d7d('0x34')]);_0x523013[_0x3d7d('0x3d')]=_[_0x3d7d('0x36')](_0x523013[_0x3d7d('0x33')],_0x523013['query']);_0x28e614[_0x3d7d('0x37')]=_[_0x3d7d('0x36')](_0x523013[_0x3d7d('0x33')],qs[_0x3d7d('0x38')](_0x30d72c['query'][_0x3d7d('0x38')]));_0x28e614[_0x3d7d('0x37')]=_0x28e614[_0x3d7d('0x37')]['length']?_0x28e614[_0x3d7d('0x37')]:_0x523013[_0x3d7d('0x33')];if(_0x30d72c[_0x3d7d('0x34')][_0x3d7d('0x41')]){_0x28e614['include']=[{'all':!![]}];}_0x28e614=_[_0x3d7d('0x3f')]({},_0x28e614,_0x30d72c[_0x3d7d('0x48')]);return db[_0x3d7d('0x31')]['find'](_0x28e614)[_0x3d7d('0x2b')](handleEntityNotFound(_0x4bdd09,null))['then'](respondWithResult(_0x4bdd09,null))[_0x3d7d('0x45')](handleError(_0x4bdd09,null));};exports[_0x3d7d('0x49')]=function(_0x23369d,_0xc17ecc){return db[_0x3d7d('0x31')]['create'](_0x23369d[_0x3d7d('0x4a')],{})[_0x3d7d('0x2b')](respondWithResult(_0xc17ecc,0xc9))[_0x3d7d('0x45')](handleError(_0xc17ecc,null));};exports['update']=function(_0x598d60,_0x5db59a){if(_0x598d60['body']['id']){delete _0x598d60[_0x3d7d('0x4a')]['id'];}return db[_0x3d7d('0x31')]['find']({'where':{'id':_0x598d60[_0x3d7d('0x47')]['id']}})[_0x3d7d('0x2b')](handleEntityNotFound(_0x5db59a,null))[_0x3d7d('0x2b')](saveUpdates(_0x598d60['body'],null))[_0x3d7d('0x2b')](respondWithResult(_0x5db59a,null))[_0x3d7d('0x45')](handleError(_0x5db59a,null));};exports[_0x3d7d('0x4b')]=function(_0x1c54c9,_0x5011f2){return db[_0x3d7d('0x31')][_0x3d7d('0x4c')]({'where':{'id':_0x1c54c9['params']['id']}})['then'](handleEntityNotFound(_0x5011f2,null))[_0x3d7d('0x2b')](removeEntity(_0x5011f2,null))[_0x3d7d('0x45')](handleError(_0x5011f2,null));};exports[_0x3d7d('0x4d')]=function(_0x5e81b3,_0x5528af){return db[_0x3d7d('0x31')][_0x3d7d('0x4d')]()[_0x3d7d('0x2b')](respondWithResult(_0x5528af,null))['catch'](handleError(_0x5528af,null));}; \ No newline at end of file +var _0x464a=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','options','find','create','body','params','describe','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x1913fe,_0x313618){var _0x3a09b3=function(_0x4d822f){while(--_0x4d822f){_0x1913fe['push'](_0x1913fe['shift']());}};_0x3a09b3(++_0x313618);}(_0x464a,0x80));var _0xa464=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x464a[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xa464('0x0'));var rimraf=require(_0xa464('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa464('0x2'));var BPromise=require(_0xa464('0x3'));var Mustache=require(_0xa464('0x4'));var util=require('util');var path=require(_0xa464('0x5'));var sox=require(_0xa464('0x6'));var csv=require(_0xa464('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa464('0x8'));var squel=require(_0xa464('0x9'));var crypto=require(_0xa464('0xa'));var jsforce=require(_0xa464('0xb'));var deskjs=require(_0xa464('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa464('0xd'));var Papa=require(_0xa464('0xe'));var Redis=require(_0xa464('0xf'));var authService=require(_0xa464('0x10'));var qs=require(_0xa464('0x11'));var as=require(_0xa464('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa464('0x13'))(_0xa464('0x14'));var utils=require(_0xa464('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa464('0x16'));var db=require(_0xa464('0x17'))['db'];function respondWithStatusCode(_0x5afdc0,_0x541c93){_0x541c93=_0x541c93||0xcc;return function(_0x504bf8){if(_0x504bf8){return _0x5afdc0[_0xa464('0x18')](_0x541c93);}return _0x5afdc0['status'](_0x541c93)['end']();};}function respondWithResult(_0x42aa74,_0x24cd1e){_0x24cd1e=_0x24cd1e||0xc8;return function(_0x2d9262){if(_0x2d9262){return _0x42aa74[_0xa464('0x19')](_0x24cd1e)[_0xa464('0x1a')](_0x2d9262);}};}function respondWithFilteredResult(_0x1e9bda,_0x5eab4b){return function(_0x2be0fd){if(_0x2be0fd){var _0x2240ff=typeof _0x5eab4b[_0xa464('0x1b')]===_0xa464('0x1c')&&typeof _0x5eab4b['limit']===_0xa464('0x1c');var _0xdc2a0b=_0x2be0fd[_0xa464('0x1d')];var _0x512050=_0x2240ff?0x0:_0x5eab4b['offset'];var _0x42a7ab=_0x2240ff?_0x2be0fd[_0xa464('0x1d')]:_0x5eab4b[_0xa464('0x1b')]+_0x5eab4b[_0xa464('0x1e')];var _0x4f4160;if(_0x42a7ab>=_0xdc2a0b){_0x42a7ab=_0xdc2a0b;_0x4f4160=0xc8;}else{_0x4f4160=0xce;}_0x1e9bda['status'](_0x4f4160);return _0x1e9bda[_0xa464('0x1f')](_0xa464('0x20'),_0x512050+'-'+_0x42a7ab+'/'+_0xdc2a0b)[_0xa464('0x1a')](_0x2be0fd);}return null;};}function patchUpdates(_0x53440d){return function(_0x4237d3){try{jsonpatch[_0xa464('0x21')](_0x4237d3,_0x53440d,!![]);}catch(_0x2b45be){return BPromise[_0xa464('0x22')](_0x2b45be);}return _0x4237d3[_0xa464('0x23')]();};}function saveUpdates(_0x36f521,_0x2d5265){return function(_0x480ef8){if(_0x480ef8){return _0x480ef8[_0xa464('0x24')](_0x36f521)[_0xa464('0x25')](function(_0x3211e8){return _0x3211e8;});}return null;};}function removeEntity(_0x344bed,_0x4a2f0b){return function(_0x3ffc14){if(_0x3ffc14){return _0x3ffc14[_0xa464('0x26')]()['then'](function(){_0x344bed[_0xa464('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8f6534,_0x4e1ec8){return function(_0x97a173){if(!_0x97a173){_0x8f6534[_0xa464('0x18')](0x194);}return _0x97a173;};}function handleError(_0x236e70,_0x82c26c){_0x82c26c=_0x82c26c||0x1f4;return function(_0x673dfe){logger[_0xa464('0x27')](_0x673dfe[_0xa464('0x28')]);if(_0x673dfe[_0xa464('0x29')]){delete _0x673dfe['name'];}_0x236e70[_0xa464('0x19')](_0x82c26c)[_0xa464('0x2a')](_0x673dfe);};}exports[_0xa464('0x2b')]=function(_0x521eb6,_0x275dca){var _0xaa708c={},_0xa89e8f={},_0x2de193={'count':0x0,'rows':[]};var _0xdaf572=_[_0xa464('0x2c')](db[_0xa464('0x2d')]['rawAttributes'],function(_0xd3d012){return{'name':_0xd3d012[_0xa464('0x2e')],'type':_0xd3d012[_0xa464('0x2f')][_0xa464('0x30')]};});_0xa89e8f[_0xa464('0x31')]=_[_0xa464('0x2c')](_0xdaf572,_0xa464('0x29'));_0xa89e8f[_0xa464('0x32')]=_['keys'](_0x521eb6[_0xa464('0x32')]);_0xa89e8f[_0xa464('0x33')]=_[_0xa464('0x34')](_0xa89e8f[_0xa464('0x31')],_0xa89e8f[_0xa464('0x32')]);_0xaa708c[_0xa464('0x35')]=_[_0xa464('0x34')](_0xa89e8f['model'],qs[_0xa464('0x36')](_0x521eb6[_0xa464('0x32')][_0xa464('0x36')]));_0xaa708c[_0xa464('0x35')]=_0xaa708c['attributes'][_0xa464('0x37')]?_0xaa708c[_0xa464('0x35')]:_0xa89e8f[_0xa464('0x31')];if(!_0x521eb6[_0xa464('0x32')]['hasOwnProperty'](_0xa464('0x38'))){_0xaa708c[_0xa464('0x1e')]=qs['limit'](_0x521eb6[_0xa464('0x32')][_0xa464('0x1e')]);_0xaa708c[_0xa464('0x1b')]=qs['offset'](_0x521eb6['query'][_0xa464('0x1b')]);}_0xaa708c[_0xa464('0x39')]=qs[_0xa464('0x3a')](_0x521eb6['query'][_0xa464('0x3a')]);_0xaa708c[_0xa464('0x3b')]=qs[_0xa464('0x33')](_[_0xa464('0x3c')](_0x521eb6[_0xa464('0x32')],_0xa89e8f[_0xa464('0x33')]),_0xdaf572);if(_0x521eb6[_0xa464('0x32')][_0xa464('0x3d')]){_0xaa708c['where']=_['merge'](_0xaa708c['where'],{'$or':_['map'](_0xdaf572,function(_0x2ebe49){if(_0x2ebe49['type']!==_0xa464('0x3e')){var _0x44730c={};_0x44730c[_0x2ebe49[_0xa464('0x29')]]={'$like':'%'+_0x521eb6[_0xa464('0x32')]['filter']+'%'};return _0x44730c;}})});}_0xaa708c=_[_0xa464('0x3f')]({},_0xaa708c,_0x521eb6['options']);var _0x3439a9={'where':_0xaa708c[_0xa464('0x3b')]};return db[_0xa464('0x2d')]['count'](_0x3439a9)['then'](function(_0x3c1857){_0x2de193[_0xa464('0x1d')]=_0x3c1857;if(_0x521eb6[_0xa464('0x32')][_0xa464('0x40')]){_0xaa708c[_0xa464('0x41')]=[{'all':!![]}];}return db[_0xa464('0x2d')][_0xa464('0x42')](_0xaa708c);})['then'](function(_0x4d4d7a){_0x2de193[_0xa464('0x43')]=_0x4d4d7a;return _0x2de193;})['then'](respondWithFilteredResult(_0x275dca,_0xaa708c))[_0xa464('0x44')](handleError(_0x275dca,null));};exports[_0xa464('0x45')]=function(_0x504100,_0x15d5d3){var _0x26e369={'raw':!![],'where':{'id':_0x504100['params']['id']}},_0x2a956e={};_0x2a956e['model']=_[_0xa464('0x46')](db[_0xa464('0x2d')][_0xa464('0x47')]);_0x2a956e[_0xa464('0x32')]=_[_0xa464('0x46')](_0x504100['query']);_0x2a956e[_0xa464('0x33')]=_[_0xa464('0x34')](_0x2a956e['model'],_0x2a956e['query']);_0x26e369[_0xa464('0x35')]=_[_0xa464('0x34')](_0x2a956e[_0xa464('0x31')],qs[_0xa464('0x36')](_0x504100[_0xa464('0x32')][_0xa464('0x36')]));_0x26e369[_0xa464('0x35')]=_0x26e369[_0xa464('0x35')][_0xa464('0x37')]?_0x26e369[_0xa464('0x35')]:_0x2a956e[_0xa464('0x31')];if(_0x504100[_0xa464('0x32')]['includeAll']){_0x26e369[_0xa464('0x41')]=[{'all':!![]}];}_0x26e369=_[_0xa464('0x3f')]({},_0x26e369,_0x504100[_0xa464('0x48')]);return db[_0xa464('0x2d')][_0xa464('0x49')](_0x26e369)[_0xa464('0x25')](handleEntityNotFound(_0x15d5d3,null))[_0xa464('0x25')](respondWithResult(_0x15d5d3,null))[_0xa464('0x44')](handleError(_0x15d5d3,null));};exports[_0xa464('0x4a')]=function(_0x2f3e31,_0x26121a){return db['VoiceDialReport']['create'](_0x2f3e31[_0xa464('0x4b')],{})[_0xa464('0x25')](respondWithResult(_0x26121a,0xc9))[_0xa464('0x44')](handleError(_0x26121a,null));};exports['update']=function(_0x35ed29,_0x372248){if(_0x35ed29[_0xa464('0x4b')]['id']){delete _0x35ed29[_0xa464('0x4b')]['id'];}return db[_0xa464('0x2d')][_0xa464('0x49')]({'where':{'id':_0x35ed29[_0xa464('0x4c')]['id']}})[_0xa464('0x25')](handleEntityNotFound(_0x372248,null))['then'](saveUpdates(_0x35ed29[_0xa464('0x4b')],null))[_0xa464('0x25')](respondWithResult(_0x372248,null))[_0xa464('0x44')](handleError(_0x372248,null));};exports['destroy']=function(_0x5e7aab,_0x5585a8){return db[_0xa464('0x2d')]['find']({'where':{'id':_0x5e7aab['params']['id']}})['then'](handleEntityNotFound(_0x5585a8,null))[_0xa464('0x25')](removeEntity(_0x5585a8,null))[_0xa464('0x44')](handleError(_0x5585a8,null));};exports[_0xa464('0x4d')]=function(_0x1f984c,_0x3747a9){return db[_0xa464('0x2d')][_0xa464('0x4d')]()[_0xa464('0x25')](respondWithResult(_0x3747a9,null))[_0xa464('0x44')](handleError(_0x3747a9,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 6ff91a8..a2b3bd6 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 _0x474f=['exports','define','VoiceDialReport','report_dial','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x4fe5b9,_0xfaf7fb){var _0x3dfa89=function(_0x2c4931){while(--_0x2c4931){_0x4fe5b9['push'](_0x4fe5b9['shift']());}};_0x3dfa89(++_0xfaf7fb);}(_0x474f,0xac));var _0xf474=function(_0x362e36,_0x22a49b){_0x362e36=_0x362e36-0x0;var _0xb31147=_0x474f[_0x362e36];return _0xb31147;};'use strict';var _=require(_0xf474('0x0'));var util=require('util');var logger=require(_0xf474('0x1'))(_0xf474('0x2'));var moment=require(_0xf474('0x3'));var BPromise=require(_0xf474('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf474('0x5'));var config=require(_0xf474('0x6'));var attributes=require(_0xf474('0x7'));module[_0xf474('0x8')]=function(_0x346d31,_0x2e2d5d){return _0x346d31[_0xf474('0x9')](_0xf474('0xa'),attributes,{'tableName':_0xf474('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb95=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','define','report_dial','uniqueid','util','../../config/logger','api'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0xdb95,0x1d1));var _0x5db9=function(_0x3ba9b1,_0x448b98){_0x3ba9b1=_0x3ba9b1-0x0;var _0x4dc9ad=_0xdb95[_0x3ba9b1];return _0x4dc9ad;};'use strict';var _=require('lodash');var util=require(_0x5db9('0x0'));var logger=require(_0x5db9('0x1'))(_0x5db9('0x2'));var moment=require(_0x5db9('0x3'));var BPromise=require(_0x5db9('0x4'));var rp=require(_0x5db9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5db9('0x6'));var config=require(_0x5db9('0x7'));var attributes=require(_0x5db9('0x8'));module['exports']=function(_0x9bcc70,_0x28d12b){return _0x9bcc70[_0x5db9('0x9')]('VoiceDialReport',attributes,{'tableName':_0x5db9('0xa'),'paranoid':![],'indexes':[{'fields':[_0x5db9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a030dc8..d8ad259 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 _0xa7c8=['catch','CreateVoiceDialReport','body','options','stringify','VoiceDialReport','update','raw','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','VoiceDialReport,\x20%s,\x20%s','message','result'];(function(_0x3ba857,_0x44b549){var _0x466c57=function(_0x5e2151){while(--_0x5e2151){_0x3ba857['push'](_0x3ba857['shift']());}};_0x466c57(++_0x44b549);}(_0xa7c8,0xeb));var _0x8a7c=function(_0x2af13c,_0x58e9bb){_0x2af13c=_0x2af13c-0x0;var _0x3e004d=_0xa7c8[_0x2af13c];return _0x3e004d;};'use strict';var _=require(_0x8a7c('0x0'));var util=require(_0x8a7c('0x1'));var moment=require(_0x8a7c('0x2'));var BPromise=require(_0x8a7c('0x3'));var rs=require(_0x8a7c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a7c('0x5'));var logger=require(_0x8a7c('0x6'))(_0x8a7c('0x7'));var config=require(_0x8a7c('0x8'));var jayson=require(_0x8a7c('0x9'));var client=jayson[_0x8a7c('0xa')][_0x8a7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9fc9da,_0x3a9bd9,_0x334959){return new BPromise(function(_0x3b4b2c,_0x3c35b0){return client['request'](_0x9fc9da,_0x334959)[_0x8a7c('0xc')](function(_0x1a0c53){logger[_0x8a7c('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x3a9bd9,'request\x20sent');logger[_0x8a7c('0xe')](_0x8a7c('0xf'),_0x3a9bd9,'request\x20sent',JSON['stringify'](_0x1a0c53));if(_0x1a0c53[_0x8a7c('0x10')]){if(_0x1a0c53['error'][_0x8a7c('0x11')]===0x1f4){logger[_0x8a7c('0x10')](_0x8a7c('0x12'),_0x3a9bd9,_0x1a0c53['error'][_0x8a7c('0x13')]);return _0x3c35b0(_0x1a0c53['error']['message']);}logger[_0x8a7c('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x3a9bd9,_0x1a0c53[_0x8a7c('0x10')][_0x8a7c('0x13')]);return _0x3b4b2c(_0x1a0c53[_0x8a7c('0x10')][_0x8a7c('0x13')]);}else{logger[_0x8a7c('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x3a9bd9,'request\x20sent');_0x3b4b2c(_0x1a0c53[_0x8a7c('0x14')][_0x8a7c('0x13')]);}})[_0x8a7c('0x15')](function(_0x1a148b){logger[_0x8a7c('0x10')](_0x8a7c('0x12'),_0x3a9bd9,_0x1a148b);_0x3c35b0(_0x1a148b);});});}exports[_0x8a7c('0x16')]=function(_0x37b023){var _0x448d64=this;return new Promise(function(_0x23de5f,_0x7b698f){return db['VoiceDialReport']['create'](_0x37b023[_0x8a7c('0x17')],{'raw':_0x37b023[_0x8a7c('0x18')]?_0x37b023['options']['raw']===undefined?!![]:![]:!![]})[_0x8a7c('0xc')](function(_0x2d5535){logger['info']('CreateVoiceDialReport',_0x37b023);logger[_0x8a7c('0xe')]('CreateVoiceDialReport',_0x37b023,JSON[_0x8a7c('0x19')](_0x2d5535));_0x23de5f(_0x2d5535);})[_0x8a7c('0x15')](function(_0x3fe063){logger[_0x8a7c('0x10')](_0x8a7c('0x16'),_0x3fe063['message'],_0x37b023);_0x7b698f(_0x448d64[_0x8a7c('0x10')](0x1f4,_0x3fe063['message']));});});};exports['UpdateVoiceDialReport']=function(_0xd39bd4){var _0x25ac24=this;return new Promise(function(_0xf3259c,_0x1cc16e){return db[_0x8a7c('0x1a')][_0x8a7c('0x1b')](_0xd39bd4[_0x8a7c('0x17')],{'raw':_0xd39bd4[_0x8a7c('0x18')]?_0xd39bd4[_0x8a7c('0x18')][_0x8a7c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd39bd4['options']?_0xd39bd4[_0x8a7c('0x18')]['where']||null:null,'attributes':_0xd39bd4[_0x8a7c('0x18')]?_0xd39bd4['options'][_0x8a7c('0x1d')]||null:null,'limit':_0xd39bd4[_0x8a7c('0x18')]?_0xd39bd4[_0x8a7c('0x18')][_0x8a7c('0x1e')]||null:null})[_0x8a7c('0xc')](function(_0x575f98){logger[_0x8a7c('0xd')](_0x8a7c('0x1f'),_0xd39bd4);logger[_0x8a7c('0xe')](_0x8a7c('0x1f'),_0xd39bd4,JSON[_0x8a7c('0x19')](_0x575f98));_0xf3259c(_0x575f98);})['catch'](function(_0x4766e6){logger[_0x8a7c('0x10')](_0x8a7c('0x1f'),_0x4766e6['message'],_0xd39bd4);_0x1cc16e(_0x25ac24[_0x8a7c('0x10')](0x1f4,_0x4766e6['message']));});});}; \ No newline at end of file +var _0x3570=['UpdateVoiceDialReport','update','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','debug'];(function(_0x5da13,_0x3cada7){var _0x595d06=function(_0x35d884){while(--_0x35d884){_0x5da13['push'](_0x5da13['shift']());}};_0x595d06(++_0x3cada7);}(_0x3570,0x164));var _0x0357=function(_0x1199a9,_0x3712d1){_0x1199a9=_0x1199a9-0x0;var _0x2fdb64=_0x3570[_0x1199a9];return _0x2fdb64;};'use strict';var _=require(_0x0357('0x0'));var util=require(_0x0357('0x1'));var moment=require(_0x0357('0x2'));var BPromise=require(_0x0357('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0357('0x4'));var db=require(_0x0357('0x5'))['db'];var utils=require(_0x0357('0x6'));var logger=require('../../config/logger')(_0x0357('0x7'));var config=require(_0x0357('0x8'));var jayson=require(_0x0357('0x9'));var client=jayson[_0x0357('0xa')][_0x0357('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c824f,_0x1854dd,_0x5127c){return new BPromise(function(_0x592d88,_0x297bfb){return client[_0x0357('0xc')](_0x1c824f,_0x5127c)[_0x0357('0xd')](function(_0x294e9d){logger[_0x0357('0xe')](_0x0357('0xf'),_0x1854dd,_0x0357('0x10'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x1854dd,_0x0357('0x10'),JSON[_0x0357('0x11')](_0x294e9d));if(_0x294e9d[_0x0357('0x12')]){if(_0x294e9d['error']['code']===0x1f4){logger[_0x0357('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x1854dd,_0x294e9d[_0x0357('0x12')]['message']);return _0x297bfb(_0x294e9d[_0x0357('0x12')][_0x0357('0x13')]);}logger[_0x0357('0x12')](_0x0357('0xf'),_0x1854dd,_0x294e9d[_0x0357('0x12')][_0x0357('0x13')]);return _0x592d88(_0x294e9d['error'][_0x0357('0x13')]);}else{logger[_0x0357('0xe')](_0x0357('0xf'),_0x1854dd,_0x0357('0x10'));_0x592d88(_0x294e9d['result'][_0x0357('0x13')]);}})[_0x0357('0x14')](function(_0x103ce2){logger[_0x0357('0x12')](_0x0357('0xf'),_0x1854dd,_0x103ce2);_0x297bfb(_0x103ce2);});});}exports[_0x0357('0x15')]=function(_0x5caff9){var _0x3375b9=this;return new Promise(function(_0x4cdd03,_0x37f4a3){return db[_0x0357('0x16')][_0x0357('0x17')](_0x5caff9[_0x0357('0x18')],{'raw':_0x5caff9[_0x0357('0x19')]?_0x5caff9['options'][_0x0357('0x1a')]===undefined?!![]:![]:!![]})[_0x0357('0xd')](function(_0x1a48d0){logger['info'](_0x0357('0x15'),_0x5caff9);logger[_0x0357('0x1b')]('CreateVoiceDialReport',_0x5caff9,JSON[_0x0357('0x11')](_0x1a48d0));_0x4cdd03(_0x1a48d0);})[_0x0357('0x14')](function(_0x441289){logger['error'](_0x0357('0x15'),_0x441289[_0x0357('0x13')],_0x5caff9);_0x37f4a3(_0x3375b9[_0x0357('0x12')](0x1f4,_0x441289[_0x0357('0x13')]));});});};exports[_0x0357('0x1c')]=function(_0x15f02c){var _0x136a90=this;return new Promise(function(_0x4eceae,_0x3a7bb2){return db[_0x0357('0x16')][_0x0357('0x1d')](_0x15f02c['body'],{'raw':_0x15f02c[_0x0357('0x19')]?_0x15f02c[_0x0357('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15f02c[_0x0357('0x19')]?_0x15f02c[_0x0357('0x19')][_0x0357('0x1e')]||null:null,'attributes':_0x15f02c[_0x0357('0x19')]?_0x15f02c[_0x0357('0x19')][_0x0357('0x1f')]||null:null,'limit':_0x15f02c[_0x0357('0x19')]?_0x15f02c[_0x0357('0x19')]['limit']||null:null})[_0x0357('0xd')](function(_0xe326b7){logger[_0x0357('0xe')](_0x0357('0x1c'),_0x15f02c);logger[_0x0357('0x1b')]('UpdateVoiceDialReport',_0x15f02c,JSON[_0x0357('0x11')](_0xe326b7));_0x4eceae(_0xe326b7);})[_0x0357('0x14')](function(_0x2a97a9){logger[_0x0357('0x12')](_0x0357('0x1c'),_0x2a97a9[_0x0357('0x13')],_0x15f02c);_0x3a7bb2(_0x136a90[_0x0357('0x12')](0x1f4,_0x2a97a9[_0x0357('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 21bd516..015cf90 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 _0xe88e=['destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create','post','/:id/applications','put','update','delete'];(function(_0x34277d,_0x6a654){var _0x1975bb=function(_0x24ede0){while(--_0x24ede0){_0x34277d['push'](_0x34277d['shift']());}};_0x1975bb(++_0x6a654);}(_0xe88e,0xd4));var _0xee88=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xe88e[_0x220f3f];return _0x1f170e;};'use strict';var multer=require(_0xee88('0x0'));var util=require('util');var path=require(_0xee88('0x1'));var timeout=require('connect-timeout');var express=require(_0xee88('0x2'));var router=express['Router']();var fs_extra=require(_0xee88('0x3'));var auth=require(_0xee88('0x4'));var interaction=require(_0xee88('0x5'));var config=require(_0xee88('0x6'));var controller=require(_0xee88('0x7'));router[_0xee88('0x8')]('/',auth[_0xee88('0x9')](),controller[_0xee88('0xa')]);router[_0xee88('0x8')](_0xee88('0xb'),auth[_0xee88('0x9')](),controller[_0xee88('0xc')]);router['post']('/',auth[_0xee88('0x9')](),controller[_0xee88('0xd')]);router[_0xee88('0xe')](_0xee88('0xf'),auth[_0xee88('0x9')](),controller['addApplications']);router[_0xee88('0x10')](_0xee88('0xb'),auth[_0xee88('0x9')](),controller[_0xee88('0x11')]);router[_0xee88('0x12')](_0xee88('0xb'),auth['isAuthenticated'](),controller[_0xee88('0x13')]);module[_0xee88('0x14')]=router; \ No newline at end of file +var _0xb8fd=['addApplications','put','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','create','post'];(function(_0x58f0ac,_0x3d65a2){var _0x36e0bd=function(_0x376b00){while(--_0x376b00){_0x58f0ac['push'](_0x58f0ac['shift']());}};_0x36e0bd(++_0x3d65a2);}(_0xb8fd,0xe7));var _0xdb8f=function(_0x45f1ce,_0x11f9ef){_0x45f1ce=_0x45f1ce-0x0;var _0x46d531=_0xb8fd[_0x45f1ce];return _0x46d531;};'use strict';var multer=require(_0xdb8f('0x0'));var util=require(_0xdb8f('0x1'));var path=require(_0xdb8f('0x2'));var timeout=require('connect-timeout');var express=require(_0xdb8f('0x3'));var router=express[_0xdb8f('0x4')]();var fs_extra=require(_0xdb8f('0x5'));var auth=require(_0xdb8f('0x6'));var interaction=require(_0xdb8f('0x7'));var config=require(_0xdb8f('0x8'));var controller=require(_0xdb8f('0x9'));router[_0xdb8f('0xa')]('/',auth[_0xdb8f('0xb')](),controller['index']);router['get'](_0xdb8f('0xc'),auth[_0xdb8f('0xb')](),controller[_0xdb8f('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdb8f('0xe')]);router[_0xdb8f('0xf')]('/:id/applications',auth[_0xdb8f('0xb')](),controller[_0xdb8f('0x10')]);router[_0xdb8f('0x11')](_0xdb8f('0xc'),auth[_0xdb8f('0xb')](),controller['update']);router[_0xdb8f('0x12')](_0xdb8f('0xc'),auth[_0xdb8f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 49a1014..0124f78 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 _0xafec=['INTEGER','BOOLEAN','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*'];(function(_0x240786,_0x1fcb4a){var _0x3968c6=function(_0x125b7d){while(--_0x125b7d){_0x240786['push'](_0x240786['shift']());}};_0x3968c6(++_0x1fcb4a);}(_0xafec,0x144));var _0xcafe=function(_0x2bc6c1,_0x4dd131){_0x2bc6c1=_0x2bc6c1-0x0;var _0x2f29a2=_0xafec[_0x2bc6c1];return _0x2f29a2;};'use strict';var Sequelize=require(_0xcafe('0x0'));module[_0xcafe('0x1')]={'context':{'type':Sequelize[_0xcafe('0x2')],'allowNull':![],'unique':_0xcafe('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcafe('0x3')},'priority':{'type':Sequelize[_0xcafe('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xcafe('0x3')},'tag':{'type':Sequelize[_0xcafe('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcafe('0x4')},'appdata':{'type':Sequelize[_0xcafe('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xcafe('0x5'),_0xcafe('0x6'),_0xcafe('0x7'),'inbound-fax',_0xcafe('0x8'),_0xcafe('0x9'),_0xcafe('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xcafe('0x2')]},'interval':{'type':Sequelize[_0xcafe('0x2')],'allowNull':![],'defaultValue':_0xcafe('0xb')},'IntervalId':{'type':Sequelize[_0xcafe('0xc')]},'isApp':{'type':Sequelize[_0xcafe('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xcafe('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xcafe('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xcafe('0xc')]},'recordingFormat':{'type':Sequelize[_0xcafe('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xcafe('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xcafe('0xe')],'get':function(_0x6213c){return this['getDataValue'](_0xcafe('0xf'));}},'alias':{'type':Sequelize[_0xcafe('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x35ef=['sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','VIRTUAL','getDataValue','exten'];(function(_0x4b24fb,_0x27a43e){var _0x2e798f=function(_0x5c2138){while(--_0x5c2138){_0x4b24fb['push'](_0x4b24fb['shift']());}};_0x2e798f(++_0x27a43e);}(_0x35ef,0x198));var _0xf35e=function(_0x1b1a44,_0x5c5a1e){_0x1b1a44=_0x1b1a44-0x0;var _0x64d428=_0x35ef[_0x1b1a44];return _0x64d428;};'use strict';var Sequelize=require(_0xf35e('0x0'));module[_0xf35e('0x1')]={'context':{'type':Sequelize[_0xf35e('0x2')],'allowNull':![],'unique':_0xf35e('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf35e('0x2')],'allowNull':![],'unique':_0xf35e('0x3')},'priority':{'type':Sequelize[_0xf35e('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xf35e('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf35e('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xf35e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf35e('0x4')](_0xf35e('0x5'),_0xf35e('0x6'),_0xf35e('0x7'),'inbound-fax',_0xf35e('0x8'),_0xf35e('0x9'),_0xf35e('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xf35e('0x2')]},'interval':{'type':Sequelize[_0xf35e('0x2')],'allowNull':![],'defaultValue':_0xf35e('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xf35e('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xf35e('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xf35e('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf35e('0xd')]},'recordingFormat':{'type':Sequelize[_0xf35e('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xf35e('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xf35e('0xe')],'get':function(_0x206b49){return this[_0xf35e('0xf')](_0xf35e('0x10'));}},'alias':{'type':Sequelize[_0xf35e('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index b3dcd9f..5a7208c 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 _0x1099=['OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','find','name','UserProfileResource','then','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','intersection','params','create','body','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/environment','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','InboundRoutes','inbound'];(function(_0x3dd9b0,_0x28a54a){var _0x4af95d=function(_0x2e908e){while(--_0x2e908e){_0x3dd9b0['push'](_0x3dd9b0['shift']());}};_0x4af95d(++_0x28a54a);}(_0x1099,0xa8));var _0x9109=function(_0x10e505,_0x39f6a4){_0x10e505=_0x10e505-0x0;var _0x4ad775=_0x1099[_0x10e505];return _0x4ad775;};'use strict';var _=require(_0x9109('0x0'));var Redis=require(_0x9109('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x9109('0x2'));var db=require('../../mysqldb')['db'];config[_0x9109('0x3')]=_['defaults'](config['redis'],{'host':_0x9109('0x4'),'port':0x18eb});var socket=require(_0x9109('0x5'))(new Redis(config[_0x9109('0x3')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x31dd2d,_0x4eff66){_0x4eff66=_0x4eff66||0xcc;return function(_0x44553d){if(_0x44553d){return _0x31dd2d[_0x9109('0x6')](_0x4eff66);}return _0x31dd2d[_0x9109('0x7')](_0x4eff66)[_0x9109('0x8')]();};}function respondWithResult(_0x20fd45,_0x164d86){_0x164d86=_0x164d86||0xc8;return function(_0x21f10c){if(_0x21f10c){return _0x20fd45[_0x9109('0x7')](_0x164d86)[_0x9109('0x9')](_0x21f10c);}};}function respondWithFilteredResult(_0x50936e,_0x5d311f){return function(_0x172e00){if(_0x172e00){var _0x52a011=typeof _0x5d311f[_0x9109('0xa')]===_0x9109('0xb')&&typeof _0x5d311f[_0x9109('0xc')]===_0x9109('0xb');var _0x373fdd=_0x172e00[_0x9109('0xd')];var _0x206892=_0x52a011?0x0:_0x5d311f[_0x9109('0xa')];var _0x5adf9b=_0x52a011?_0x172e00[_0x9109('0xd')]:_0x5d311f[_0x9109('0xa')]+_0x5d311f[_0x9109('0xc')];var _0x57d3c3;if(_0x5adf9b>=_0x373fdd){_0x5adf9b=_0x373fdd;_0x57d3c3=0xc8;}else{_0x57d3c3=0xce;}_0x50936e[_0x9109('0x7')](_0x57d3c3);return _0x50936e[_0x9109('0xe')]('Content-Range',_0x206892+'-'+_0x5adf9b+'/'+_0x373fdd)[_0x9109('0x9')](_0x172e00);}return null;};}function removeEntity(_0x455d55){return function(_0x2f6d67){if(_0x2f6d67){return _0x2f6d67[_0x9109('0xf')]()['then'](function(){var _0x54009b=_0x2f6d67['get']({'plain':!![]});var _0x2a739f=[{'name':_0x9109('0x10'),'value':_0x9109('0x11'),'ignore':![]},{'name':_0x9109('0x12'),'value':_0x9109('0x13'),'ignore':![]},{'name':_0x9109('0x14'),'value':_0x9109('0x15'),'ignore':![]}];var _0x52a5e3=_(_0x2a739f)['filter'](_0x9109('0x16'))[_0x9109('0x17')](_0x9109('0x18'))[_0x9109('0x18')]();if(_[_0x9109('0x19')](_0x52a5e3,_0x54009b['type'])){return;}var _0x80a9c9=_[_0x9109('0x1a')](_0x2a739f,['value',_0x54009b['type']])[_0x9109('0x1b')];return db[_0x9109('0x1c')][_0x9109('0xf')]({'where':{'type':_0x80a9c9,'resourceId':_0x54009b['id']}})[_0x9109('0x1d')](function(){return _0x2f6d67;});})[_0x9109('0x1d')](function(){_0x455d55['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x345eee){return function(_0x54d158){if(!_0x54d158){_0x345eee['sendStatus'](0x194);}return _0x54d158;};}function handleError(_0x3f1013,_0x3ca7e3){_0x3ca7e3=_0x3ca7e3||0x1f4;return function(_0x19f0de){logger[_0x9109('0x1e')](_0x19f0de[_0x9109('0x1f')]);if(_0x19f0de[_0x9109('0x1b')]){delete _0x19f0de[_0x9109('0x1b')];}_0x3f1013[_0x9109('0x7')](_0x3ca7e3)[_0x9109('0x20')](_0x19f0de);};}exports[_0x9109('0x21')]=function(_0x2381d6,_0x1e1339){var _0xef5791={},_0x1e0986={},_0x46d860={'count':0x0,'rows':[]};var _0x5d3697=_['map'](db[_0x9109('0x22')][_0x9109('0x23')],function(_0x314ae5){return{'name':_0x314ae5[_0x9109('0x24')],'type':_0x314ae5[_0x9109('0x25')][_0x9109('0x26')]};});_0x1e0986[_0x9109('0x27')]=_['map'](_0x5d3697,_0x9109('0x1b'));_0x1e0986[_0x9109('0x28')]=_[_0x9109('0x29')](_0x2381d6[_0x9109('0x28')]);_0x1e0986[_0x9109('0x2a')]=_['intersection'](_0x1e0986[_0x9109('0x27')],_0x1e0986[_0x9109('0x28')]);_0xef5791[_0x9109('0x2b')]=_['intersection'](_0x1e0986['model'],qs[_0x9109('0x2c')](_0x2381d6[_0x9109('0x28')]['fields']));_0xef5791['attributes']=_0xef5791[_0x9109('0x2b')][_0x9109('0x2d')]?_0xef5791[_0x9109('0x2b')]:_0x1e0986[_0x9109('0x27')];if(!_0x2381d6['query'][_0x9109('0x2e')](_0x9109('0x2f'))){_0xef5791[_0x9109('0xc')]=qs[_0x9109('0xc')](_0x2381d6[_0x9109('0x28')][_0x9109('0xc')]);_0xef5791[_0x9109('0xa')]=qs[_0x9109('0xa')](_0x2381d6['query'][_0x9109('0xa')]);}_0xef5791[_0x9109('0x30')]=qs[_0x9109('0x31')](_0x2381d6[_0x9109('0x28')][_0x9109('0x31')]);_0xef5791['where']=qs[_0x9109('0x2a')](_[_0x9109('0x32')](_0x2381d6[_0x9109('0x28')],_0x1e0986[_0x9109('0x2a')]),_0x5d3697);if(_0x2381d6['query'][_0x9109('0x33')]){_0xef5791['where']=_[_0x9109('0x34')](_0xef5791['where'],{'$or':_[_0x9109('0x17')](_0x5d3697,function(_0xe25eb4){if(_0xe25eb4[_0x9109('0x25')]!==_0x9109('0x35')){var _0x4ab374={};_0x4ab374[_0xe25eb4[_0x9109('0x1b')]]={'$like':'%'+_0x2381d6[_0x9109('0x28')]['filter']+'%'};return _0x4ab374;}})});}_0xef5791=_['merge']({},_0xef5791,_0x2381d6[_0x9109('0x36')]);var _0x33941b={'where':_0xef5791['where']};return db[_0x9109('0x22')][_0x9109('0xd')](_0x33941b)[_0x9109('0x1d')](function(_0x2bad20){_0x46d860[_0x9109('0xd')]=_0x2bad20;if(_0x2381d6[_0x9109('0x28')][_0x9109('0x37')]){_0xef5791[_0x9109('0x38')]=[{'all':!![]}];}return db[_0x9109('0x22')][_0x9109('0x39')](_0xef5791);})[_0x9109('0x1d')](function(_0x5c6781){_0x46d860[_0x9109('0x3a')]=_0x5c6781;return _0x46d860;})[_0x9109('0x1d')](respondWithFilteredResult(_0x1e1339,_0xef5791))[_0x9109('0x3b')](handleError(_0x1e1339,null));};exports['show']=function(_0x440a60,_0x368ab1){var _0x41f6de={'raw':![],'where':{'id':_0x440a60['params']['id']}},_0xfe021e={};_0xfe021e[_0x9109('0x27')]=_['keys'](db[_0x9109('0x22')]['rawAttributes']);_0xfe021e[_0x9109('0x28')]=_[_0x9109('0x29')](_0x440a60[_0x9109('0x28')]);_0xfe021e[_0x9109('0x2a')]=_[_0x9109('0x3c')](_0xfe021e['model'],_0xfe021e['query']);_0x41f6de[_0x9109('0x2b')]=_[_0x9109('0x3c')](_0xfe021e[_0x9109('0x27')],qs[_0x9109('0x2c')](_0x440a60[_0x9109('0x28')]['fields']));_0x41f6de[_0x9109('0x2b')]=_0x41f6de['attributes']['length']?_0x41f6de['attributes']:_0xfe021e[_0x9109('0x27')];if(_0x440a60[_0x9109('0x28')][_0x9109('0x37')]){_0x41f6de['include']=[{'all':!![]}];}_0x41f6de=_['merge']({},_0x41f6de,_0x440a60[_0x9109('0x36')]);return db['VoiceExtension'][_0x9109('0x1a')](_0x41f6de)[_0x9109('0x1d')](handleEntityNotFound(_0x368ab1,null))[_0x9109('0x1d')](respondWithResult(_0x368ab1,null))[_0x9109('0x3b')](handleError(_0x368ab1,null));};exports[_0x9109('0xf')]=function(_0x414a57,_0x3637e2){return db[_0x9109('0x22')][_0x9109('0x1a')]({'where':{'id':_0x414a57[_0x9109('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3637e2,null))[_0x9109('0x1d')](removeEntity(_0x3637e2,null))[_0x9109('0x3b')](handleError(_0x3637e2,null));};exports[_0x9109('0x3e')]=function(_0xd7c4a6,_0x3cb04d){if(_0xd7c4a6[_0x9109('0x3f')]['type']===_0x9109('0x13')&&!_[_0x9109('0x40')](_0xd7c4a6[_0x9109('0x3f')][_0x9109('0x41')],'_')){_0xd7c4a6[_0x9109('0x3f')]['exten']='_'[_0x9109('0x42')](_0xd7c4a6[_0x9109('0x3f')]['exten']);}return db[_0x9109('0x22')][_0x9109('0x3e')](_0xd7c4a6[_0x9109('0x3f')],{'raw':![]})[_0x9109('0x1d')](function(_0x29294d){var _0x56eeb5=_0xd7c4a6[_0x9109('0x43')][_0x9109('0x44')]({'plain':!![]});if(!_0x56eeb5)throw new Error(_0x9109('0x45'));if(_0x56eeb5[_0x9109('0x46')]===_0x9109('0x43')){var _0x5de045=_0x29294d[_0x9109('0x44')]({'plain':!![]});var _0x5623bd=[{'name':_0x9109('0x10'),'value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0x191750=_['find'](_0x5623bd,[_0x9109('0x18'),_0x5de045[_0x9109('0x25')]])[_0x9109('0x1b')];return db[_0x9109('0x47')][_0x9109('0x1a')]({'where':{'name':_0x191750,'userProfileId':_0x56eeb5[_0x9109('0x48')]},'raw':!![]})[_0x9109('0x1d')](function(_0x2b727b){if(_0x2b727b&&_0x2b727b[_0x9109('0x49')]===0x0){return db[_0x9109('0x1c')][_0x9109('0x3e')]({'name':_0x5de045[_0x9109('0x1b')],'resourceId':_0x5de045['id'],'type':_0x2b727b['name'],'sectionId':_0x2b727b['id']},{})[_0x9109('0x1d')](function(){return _0x29294d;});}else{return _0x29294d;}})[_0x9109('0x3b')](function(_0x212c06){logger['error'](_0x9109('0x4a'),_0x212c06);throw _0x212c06;});}return _0x29294d;})[_0x9109('0x1d')](respondWithResult(_0x3cb04d,0xc9))[_0x9109('0x3b')](handleError(_0x3cb04d,null));};exports[_0x9109('0x4b')]=function(_0x241cce,_0x224882){if(_0x241cce[_0x9109('0x3f')]['id']){delete _0x241cce[_0x9109('0x3f')]['id'];}return db[_0x9109('0x22')][_0x9109('0x1a')]({'where':{'id':_0x241cce[_0x9109('0x3d')]['id']}})[_0x9109('0x1d')](handleEntityNotFound(_0x224882,null))[_0x9109('0x1d')](function(_0x22d01a){if(_0x22d01a){return db['VoiceExtension'][_0x9109('0x4b')](_[_0x9109('0x32')](_0x241cce['body'],[_0x9109('0x41'),'context',_0x9109('0x4c'),_0x9109('0x4d'),_0x9109('0x4e'),_0x9109('0x4f'),'alias']),{'where':{'context':_0x22d01a[_0x9109('0x50')],'exten':_0x22d01a[_0x9109('0x41')]},'individualHooks':!![]})[_0x9109('0x1d')](function(_0x1dc652){return _0x1dc652;});}return null;})[_0x9109('0x1d')](respondWithStatusCode(_0x224882,null))['catch'](handleError(_0x224882,null));};exports[_0x9109('0x51')]=function(_0x17295f,_0x4a4151){var _0x5b6a4c=_0x17295f[_0x9109('0x3d')]['id'];var _0x1ec9fd=_0x17295f['body'];var _0x445edb=0xc8;var _0x349556=null;return db[_0x9109('0x52')][_0x9109('0x53')]({'isolationLevel':db[_0x9109('0x52')]['Transaction'][_0x9109('0x54')][_0x9109('0x55')]},function(_0x10be52){return db[_0x9109('0x22')][_0x9109('0x56')]({'where':{'id':_0x5b6a4c},'transaction':_0x10be52})[_0x9109('0x1d')](function(_0x3270a9){if(_0x3270a9){return db[_0x9109('0x22')]['destroy']({'where':{'VoiceExtensionId':_0x5b6a4c},'transaction':_0x10be52})[_0x9109('0x1d')](function(){var _0x4af65a=_[_0x9109('0x17')](_0x1ec9fd,function(_0x130695){_0x130695[_0x9109('0x57')]=_0x5b6a4c;_0x130695['isApp']=!![];return _0x130695;});return _0x3270a9[_0x9109('0x58')](_0x4af65a);})[_0x9109('0x1d')](function(_0x14d5f5){return db[_0x9109('0x22')][_0x9109('0x59')](_0x14d5f5,{'transaction':_0x10be52});});}else{_0x445edb=0x194;_0x349556=[];}});})[_0x9109('0x1d')](function(){if(_0x445edb!==0x194){return db[_0x9109('0x22')][_0x9109('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5b6a4c},'order':_0x9109('0x5b')})[_0x9109('0x1d')](function(_0x5544b7){_0x349556=_0x5544b7;});}})[_0x9109('0x3b')](function(_0x418ad1){_0x445edb=0x1f4;logger[_0x9109('0x1e')](_0x418ad1['stack']);if(_0x418ad1[_0x9109('0x1b')]){delete _0x418ad1[_0x9109('0x1b')];}_0x349556=_0x418ad1;})[_0x9109('0x5c')](function(){if(_0x349556===null){_0x4a4151['sendStatus'](_0x445edb);}else{if(_0x445edb===0x1f4){_0x4a4151[_0x9109('0x7')](_0x445edb)['send'](_0x349556);}else{_0x4a4151[_0x9109('0x7')](_0x445edb)[_0x9109('0x9')](_0x349556);}}});}; \ No newline at end of file +var _0xe9a0=['catch','show','params','keys','fields','include','options','destroy','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','context','recordingFormat','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','error','stack','send','VoiceExtension','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','rows'];(function(_0x313304,_0x583ce6){var _0x49b8c4=function(_0x24eff6){while(--_0x24eff6){_0x313304['push'](_0x313304['shift']());}};_0x49b8c4(++_0x583ce6);}(_0xe9a0,0x86));var _0x0e9a=function(_0x55e738,_0x46f761){_0x55e738=_0x55e738-0x0;var _0x20f5ba=_0xe9a0[_0x55e738];return _0x20f5ba;};'use strict';var _=require(_0x0e9a('0x0'));var Redis=require(_0x0e9a('0x1'));var qs=require(_0x0e9a('0x2'));var logger=require(_0x0e9a('0x3'))(_0x0e9a('0x4'));var config=require('../../config/environment');var db=require(_0x0e9a('0x5'))['db'];config[_0x0e9a('0x6')]=_[_0x0e9a('0x7')](config['redis'],{'host':_0x0e9a('0x8'),'port':0x18eb});var socket=require(_0x0e9a('0x9'))(new Redis(config['redis']));require(_0x0e9a('0xa'))[_0x0e9a('0xb')](socket);function respondWithStatusCode(_0x29413d,_0x3143b5){_0x3143b5=_0x3143b5||0xcc;return function(_0x4f1f7a){if(_0x4f1f7a){return _0x29413d[_0x0e9a('0xc')](_0x3143b5);}return _0x29413d['status'](_0x3143b5)[_0x0e9a('0xd')]();};}function respondWithResult(_0x51116c,_0x413057){_0x413057=_0x413057||0xc8;return function(_0x2e89ee){if(_0x2e89ee){return _0x51116c[_0x0e9a('0xe')](_0x413057)[_0x0e9a('0xf')](_0x2e89ee);}};}function respondWithFilteredResult(_0x533f75,_0x38ba9d){return function(_0x4ad5b0){if(_0x4ad5b0){var _0x601610=typeof _0x38ba9d[_0x0e9a('0x10')]==='undefined'&&typeof _0x38ba9d[_0x0e9a('0x11')]===_0x0e9a('0x12');var _0x32c57b=_0x4ad5b0[_0x0e9a('0x13')];var _0x1c818b=_0x601610?0x0:_0x38ba9d[_0x0e9a('0x10')];var _0x39f314=_0x601610?_0x4ad5b0[_0x0e9a('0x13')]:_0x38ba9d[_0x0e9a('0x10')]+_0x38ba9d[_0x0e9a('0x11')];var _0x9ee655;if(_0x39f314>=_0x32c57b){_0x39f314=_0x32c57b;_0x9ee655=0xc8;}else{_0x9ee655=0xce;}_0x533f75[_0x0e9a('0xe')](_0x9ee655);return _0x533f75['set']('Content-Range',_0x1c818b+'-'+_0x39f314+'/'+_0x32c57b)[_0x0e9a('0xf')](_0x4ad5b0);}return null;};}function removeEntity(_0x25cccc){return function(_0x3d46ad){if(_0x3d46ad){return _0x3d46ad['destroy']()[_0x0e9a('0x14')](function(){var _0x6a9611=_0x3d46ad[_0x0e9a('0x15')]({'plain':!![]});var _0x4b0c2d=[{'name':_0x0e9a('0x16'),'value':_0x0e9a('0x17'),'ignore':![]},{'name':_0x0e9a('0x18'),'value':_0x0e9a('0x19'),'ignore':![]},{'name':_0x0e9a('0x1a'),'value':_0x0e9a('0x1b'),'ignore':![]}];var _0xb20a7=_(_0x4b0c2d)['filter'](_0x0e9a('0x1c'))[_0x0e9a('0x1d')](_0x0e9a('0x1e'))[_0x0e9a('0x1e')]();if(_[_0x0e9a('0x1f')](_0xb20a7,_0x6a9611[_0x0e9a('0x20')])){return;}var _0x984fdd=_[_0x0e9a('0x21')](_0x4b0c2d,[_0x0e9a('0x1e'),_0x6a9611[_0x0e9a('0x20')]])[_0x0e9a('0x22')];return db['UserProfileResource']['destroy']({'where':{'type':_0x984fdd,'resourceId':_0x6a9611['id']}})[_0x0e9a('0x14')](function(){return _0x3d46ad;});})[_0x0e9a('0x14')](function(){_0x25cccc[_0x0e9a('0xe')](0xcc)[_0x0e9a('0xd')]();});}};}function handleEntityNotFound(_0x1d791b){return function(_0xa9576a){if(!_0xa9576a){_0x1d791b[_0x0e9a('0xc')](0x194);}return _0xa9576a;};}function handleError(_0x4d73a5,_0xb18e95){_0xb18e95=_0xb18e95||0x1f4;return function(_0x77dbdf){logger[_0x0e9a('0x23')](_0x77dbdf[_0x0e9a('0x24')]);if(_0x77dbdf[_0x0e9a('0x22')]){delete _0x77dbdf['name'];}_0x4d73a5[_0x0e9a('0xe')](_0xb18e95)[_0x0e9a('0x25')](_0x77dbdf);};}exports['index']=function(_0x5f2b8b,_0xa786ec){var _0x23c0dd={},_0x5ecfaf={},_0xa51cdf={'count':0x0,'rows':[]};var _0x54d9f9=_['map'](db[_0x0e9a('0x26')][_0x0e9a('0x27')],function(_0x3f6341){return{'name':_0x3f6341[_0x0e9a('0x28')],'type':_0x3f6341[_0x0e9a('0x20')][_0x0e9a('0x29')]};});_0x5ecfaf['model']=_['map'](_0x54d9f9,_0x0e9a('0x22'));_0x5ecfaf[_0x0e9a('0x2a')]=_['keys'](_0x5f2b8b[_0x0e9a('0x2a')]);_0x5ecfaf[_0x0e9a('0x2b')]=_[_0x0e9a('0x2c')](_0x5ecfaf[_0x0e9a('0x2d')],_0x5ecfaf['query']);_0x23c0dd[_0x0e9a('0x2e')]=_[_0x0e9a('0x2c')](_0x5ecfaf[_0x0e9a('0x2d')],qs['fields'](_0x5f2b8b[_0x0e9a('0x2a')]['fields']));_0x23c0dd['attributes']=_0x23c0dd[_0x0e9a('0x2e')][_0x0e9a('0x2f')]?_0x23c0dd['attributes']:_0x5ecfaf[_0x0e9a('0x2d')];if(!_0x5f2b8b[_0x0e9a('0x2a')]['hasOwnProperty'](_0x0e9a('0x30'))){_0x23c0dd[_0x0e9a('0x11')]=qs['limit'](_0x5f2b8b[_0x0e9a('0x2a')][_0x0e9a('0x11')]);_0x23c0dd[_0x0e9a('0x10')]=qs[_0x0e9a('0x10')](_0x5f2b8b[_0x0e9a('0x2a')]['offset']);}_0x23c0dd[_0x0e9a('0x31')]=qs[_0x0e9a('0x32')](_0x5f2b8b[_0x0e9a('0x2a')][_0x0e9a('0x32')]);_0x23c0dd[_0x0e9a('0x33')]=qs[_0x0e9a('0x2b')](_[_0x0e9a('0x34')](_0x5f2b8b['query'],_0x5ecfaf[_0x0e9a('0x2b')]),_0x54d9f9);if(_0x5f2b8b['query']['filter']){_0x23c0dd['where']=_['merge'](_0x23c0dd['where'],{'$or':_[_0x0e9a('0x1d')](_0x54d9f9,function(_0x238d1e){if(_0x238d1e['type']!==_0x0e9a('0x35')){var _0x35921a={};_0x35921a[_0x238d1e[_0x0e9a('0x22')]]={'$like':'%'+_0x5f2b8b[_0x0e9a('0x2a')][_0x0e9a('0x36')]+'%'};return _0x35921a;}})});}_0x23c0dd=_[_0x0e9a('0x37')]({},_0x23c0dd,_0x5f2b8b['options']);var _0x2bc6be={'where':_0x23c0dd[_0x0e9a('0x33')]};return db[_0x0e9a('0x26')][_0x0e9a('0x13')](_0x2bc6be)[_0x0e9a('0x14')](function(_0x242873){_0xa51cdf[_0x0e9a('0x13')]=_0x242873;if(_0x5f2b8b['query'][_0x0e9a('0x38')]){_0x23c0dd['include']=[{'all':!![]}];}return db[_0x0e9a('0x26')]['findAll'](_0x23c0dd);})[_0x0e9a('0x14')](function(_0x45f5e5){_0xa51cdf[_0x0e9a('0x39')]=_0x45f5e5;return _0xa51cdf;})[_0x0e9a('0x14')](respondWithFilteredResult(_0xa786ec,_0x23c0dd))[_0x0e9a('0x3a')](handleError(_0xa786ec,null));};exports[_0x0e9a('0x3b')]=function(_0x1fd060,_0x4eb8a0){var _0x122466={'raw':![],'where':{'id':_0x1fd060[_0x0e9a('0x3c')]['id']}},_0x2eeda2={};_0x2eeda2[_0x0e9a('0x2d')]=_[_0x0e9a('0x3d')](db[_0x0e9a('0x26')]['rawAttributes']);_0x2eeda2[_0x0e9a('0x2a')]=_[_0x0e9a('0x3d')](_0x1fd060[_0x0e9a('0x2a')]);_0x2eeda2[_0x0e9a('0x2b')]=_['intersection'](_0x2eeda2[_0x0e9a('0x2d')],_0x2eeda2[_0x0e9a('0x2a')]);_0x122466['attributes']=_[_0x0e9a('0x2c')](_0x2eeda2[_0x0e9a('0x2d')],qs[_0x0e9a('0x3e')](_0x1fd060[_0x0e9a('0x2a')][_0x0e9a('0x3e')]));_0x122466[_0x0e9a('0x2e')]=_0x122466[_0x0e9a('0x2e')]['length']?_0x122466[_0x0e9a('0x2e')]:_0x2eeda2[_0x0e9a('0x2d')];if(_0x1fd060[_0x0e9a('0x2a')][_0x0e9a('0x38')]){_0x122466[_0x0e9a('0x3f')]=[{'all':!![]}];}_0x122466=_['merge']({},_0x122466,_0x1fd060[_0x0e9a('0x40')]);return db[_0x0e9a('0x26')][_0x0e9a('0x21')](_0x122466)[_0x0e9a('0x14')](handleEntityNotFound(_0x4eb8a0,null))[_0x0e9a('0x14')](respondWithResult(_0x4eb8a0,null))[_0x0e9a('0x3a')](handleError(_0x4eb8a0,null));};exports[_0x0e9a('0x41')]=function(_0x4eadd6,_0x24700d){return db[_0x0e9a('0x26')][_0x0e9a('0x21')]({'where':{'id':_0x4eadd6[_0x0e9a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x24700d,null))[_0x0e9a('0x14')](removeEntity(_0x24700d,null))[_0x0e9a('0x3a')](handleError(_0x24700d,null));};exports[_0x0e9a('0x42')]=function(_0x2f8c7b,_0x5eb55c){if(_0x2f8c7b['body'][_0x0e9a('0x20')]==='outbound'&&!_[_0x0e9a('0x43')](_0x2f8c7b[_0x0e9a('0x44')][_0x0e9a('0x45')],'_')){_0x2f8c7b[_0x0e9a('0x44')][_0x0e9a('0x45')]='_'[_0x0e9a('0x46')](_0x2f8c7b['body']['exten']);}return db[_0x0e9a('0x26')][_0x0e9a('0x42')](_0x2f8c7b[_0x0e9a('0x44')],{'raw':![]})['then'](function(_0x555b95){var _0x115f1e=_0x2f8c7b[_0x0e9a('0x47')][_0x0e9a('0x15')]({'plain':!![]});if(!_0x115f1e)throw new Error(_0x0e9a('0x48'));if(_0x115f1e[_0x0e9a('0x49')]===_0x0e9a('0x47')){var _0x52e174=_0x555b95[_0x0e9a('0x15')]({'plain':!![]});var _0x17bad9=[{'name':_0x0e9a('0x16'),'value':_0x0e9a('0x17')},{'name':_0x0e9a('0x18'),'value':_0x0e9a('0x19')},{'name':_0x0e9a('0x1a'),'value':_0x0e9a('0x1b')}];var _0x99decc=_['find'](_0x17bad9,[_0x0e9a('0x1e'),_0x52e174['type']])['name'];return db[_0x0e9a('0x4a')]['find']({'where':{'name':_0x99decc,'userProfileId':_0x115f1e[_0x0e9a('0x4b')]},'raw':!![]})[_0x0e9a('0x14')](function(_0x28df05){if(_0x28df05&&_0x28df05[_0x0e9a('0x4c')]===0x0){return db[_0x0e9a('0x4d')][_0x0e9a('0x42')]({'name':_0x52e174[_0x0e9a('0x22')],'resourceId':_0x52e174['id'],'type':_0x28df05[_0x0e9a('0x22')],'sectionId':_0x28df05['id']},{})[_0x0e9a('0x14')](function(){return _0x555b95;});}else{return _0x555b95;}})[_0x0e9a('0x3a')](function(_0x172326){logger[_0x0e9a('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x172326);throw _0x172326;});}return _0x555b95;})['then'](respondWithResult(_0x5eb55c,0xc9))[_0x0e9a('0x3a')](handleError(_0x5eb55c,null));};exports[_0x0e9a('0x4e')]=function(_0x30adbb,_0x3c905e){if(_0x30adbb[_0x0e9a('0x44')]['id']){delete _0x30adbb[_0x0e9a('0x44')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x30adbb[_0x0e9a('0x3c')]['id']}})[_0x0e9a('0x14')](handleEntityNotFound(_0x3c905e,null))['then'](function(_0x1df833){if(_0x1df833){return db[_0x0e9a('0x26')]['update'](_['pick'](_0x30adbb[_0x0e9a('0x44')],[_0x0e9a('0x45'),_0x0e9a('0x4f'),'description',_0x0e9a('0x50'),'cutdigits','mandatoryDisposition',_0x0e9a('0x51')]),{'where':{'context':_0x1df833[_0x0e9a('0x4f')],'exten':_0x1df833[_0x0e9a('0x45')]},'individualHooks':!![]})['then'](function(_0x2eae77){return _0x2eae77;});}return null;})[_0x0e9a('0x14')](respondWithStatusCode(_0x3c905e,null))[_0x0e9a('0x3a')](handleError(_0x3c905e,null));};exports[_0x0e9a('0x52')]=function(_0x497536,_0x305943){var _0x58a913=_0x497536['params']['id'];var _0x592c45=_0x497536[_0x0e9a('0x44')];var _0x55b215=0xc8;var _0x140c36=null;return db[_0x0e9a('0x53')][_0x0e9a('0x54')]({'isolationLevel':db[_0x0e9a('0x53')][_0x0e9a('0x55')][_0x0e9a('0x56')][_0x0e9a('0x57')]},function(_0x19e6db){return db[_0x0e9a('0x26')][_0x0e9a('0x58')]({'where':{'id':_0x58a913},'transaction':_0x19e6db})['then'](function(_0x491316){if(_0x491316){return db[_0x0e9a('0x26')][_0x0e9a('0x41')]({'where':{'VoiceExtensionId':_0x58a913},'transaction':_0x19e6db})[_0x0e9a('0x14')](function(){var _0x4dc4a1=_[_0x0e9a('0x1d')](_0x592c45,function(_0x56b4d7){_0x56b4d7[_0x0e9a('0x59')]=_0x58a913;_0x56b4d7[_0x0e9a('0x5a')]=!![];return _0x56b4d7;});return _0x491316[_0x0e9a('0x5b')](_0x4dc4a1);})[_0x0e9a('0x14')](function(_0x4958bb){return db[_0x0e9a('0x26')][_0x0e9a('0x5c')](_0x4958bb,{'transaction':_0x19e6db});});}else{_0x55b215=0x194;_0x140c36=[];}});})[_0x0e9a('0x14')](function(){if(_0x55b215!==0x194){return db[_0x0e9a('0x26')][_0x0e9a('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x58a913},'order':_0x0e9a('0x5e')})[_0x0e9a('0x14')](function(_0x465c24){_0x140c36=_0x465c24;});}})['catch'](function(_0x43c4d0){_0x55b215=0x1f4;logger[_0x0e9a('0x23')](_0x43c4d0[_0x0e9a('0x24')]);if(_0x43c4d0['name']){delete _0x43c4d0[_0x0e9a('0x22')];}_0x140c36=_0x43c4d0;})[_0x0e9a('0x5f')](function(){if(_0x140c36===null){_0x305943[_0x0e9a('0xc')](_0x55b215);}else{if(_0x55b215===0x1f4){_0x305943[_0x0e9a('0xe')](_0x55b215)[_0x0e9a('0x25')](_0x140c36);}else{_0x305943[_0x0e9a('0xe')](_0x55b215)[_0x0e9a('0xf')](_0x140c36);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 49fc605..86ec5c4 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 _0xcc78=['VoiceExtension','setMaxListeners','save','update','remove','hasOwnProperty','hook','events'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0xcc78,0x187));var _0x8cc7=function(_0x30d70d,_0x4d942f){_0x30d70d=_0x30d70d-0x0;var _0x27c089=_0xcc78[_0x30d70d];return _0x27c089;};'use strict';var EventEmitter=require(_0x8cc7('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x8cc7('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x8cc7('0x2')](0x0);var events={'afterCreate':_0x8cc7('0x3'),'afterUpdate':_0x8cc7('0x4'),'afterDestroy':_0x8cc7('0x5')};function emitEvent(_0x45465d){return function(_0x487846,_0x48ae1f,_0x2ff7c6){VoiceExtensionEvents['emit'](_0x45465d+':'+_0x487846['id'],_0x487846);VoiceExtensionEvents['emit'](_0x45465d,_0x487846);_0x2ff7c6(null);};}for(var e in events){if(events[_0x8cc7('0x6')](e)){var event=events[e];VoiceExtension[_0x8cc7('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xfda3=['remove','emit','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x4dc356,_0x12d112){var _0x4d3585=function(_0x39391e){while(--_0x39391e){_0x4dc356['push'](_0x4dc356['shift']());}};_0x4d3585(++_0x12d112);}(_0xfda3,0x130));var _0x3fda=function(_0x197aee,_0x55f0eb){_0x197aee=_0x197aee-0x0;var _0x453a1b=_0xfda3[_0x197aee];return _0x453a1b;};'use strict';var EventEmitter=require(_0x3fda('0x0'));var VoiceExtension=require(_0x3fda('0x1'))['db'][_0x3fda('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x3fda('0x3')](0x0);var events={'afterCreate':_0x3fda('0x4'),'afterUpdate':_0x3fda('0x5'),'afterDestroy':_0x3fda('0x6')};function emitEvent(_0x422929){return function(_0x91cadd,_0x276926,_0xc2f82d){VoiceExtensionEvents['emit'](_0x422929+':'+_0x91cadd['id'],_0x91cadd);VoiceExtensionEvents[_0x3fda('0x7')](_0x422929,_0x91cadd);_0xc2f82d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x3fda('0x8')](e,emitEvent(event));}}module[_0x3fda('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 0e7327a..c8878c1 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 _0x5dd1=['lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','split','length','name','trunk','param','phone','prefix','${EXTEN}','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','filter','toLowerCase','tag','CDR(tag)=','intervals','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','playback','includes','app','appType','answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','VoiceExtension','voice_extensions','get','Hangup'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x5dd1,0xed));var _0x15dd=function(_0x43dbe9,_0xf43a4a){_0x43dbe9=_0x43dbe9-0x0;var _0x11a746=_0x5dd1[_0x43dbe9];return _0x11a746;};'use strict';var _=require(_0x15dd('0x0'));var attributes=require(_0x15dd('0x1'));module['exports']=function(_0x4282d9){var _0x3e5b75=_0x4282d9[_0x15dd('0x2')];function _0x3247f3(_0x3fd855){var _0x1572e5=0x2;var _0x1e4d7e=[{'type':_0x3fd855[_0x15dd('0x3')],'app':_0x15dd('0x4'),'appdata':_0x15dd('0x5')+_0x3fd855[_0x15dd('0x3')],'context':_0x3fd855[_0x15dd('0x6')],'exten':_0x3fd855[_0x15dd('0x7')],'priority':_0x1572e5++,'VoiceExtensionId':_0x3fd855['id']},{'type':_0x3fd855['type'],'app':_0x3fd855[_0x15dd('0x8')]?_0x15dd('0x4'):'NoOp','appdata':_0x3fd855['alias']?_0x15dd('0x9')+_0x3fd855[_0x15dd('0x8')]:_0x15dd('0xa'),'context':_0x3fd855[_0x15dd('0x6')],'exten':_0x3fd855[_0x15dd('0x7')],'priority':_0x1572e5++,'VoiceExtensionId':_0x3fd855['id']}];if(_0x3fd855[_0x15dd('0x3')]===_0x15dd('0xb')){_0x1e4d7e['push']({'type':_0x15dd('0xb'),'app':'Set','appdata':'CDR(routeid)='+_0x3fd855['id'],'context':_0x3fd855[_0x15dd('0x6')],'exten':_0x3fd855[_0x15dd('0x7')],'priority':_0x1572e5++,'VoiceExtensionId':_0x3fd855['id']});}_0x1e4d7e[_0x15dd('0xc')]({'type':_0x3fd855[_0x15dd('0x3')],'app':'Set','appdata':_0x15dd('0xd'),'context':_0x3fd855[_0x15dd('0x6')],'exten':_0x3fd855[_0x15dd('0x7')],'priority':_0x1572e5++,'VoiceExtensionId':_0x3fd855['id']},{'type':_0x3fd855[_0x15dd('0x3')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3fd855[_0x15dd('0x6')],'exten':_0x3fd855[_0x15dd('0x7')],'priority':_0x1572e5++,'VoiceExtensionId':_0x3fd855['id']},{'type':_0x3fd855['type'],'app':_0x15dd('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3fd855[_0x15dd('0x6')],'exten':_0x3fd855[_0x15dd('0x7')],'priority':_0x1572e5++,'VoiceExtensionId':_0x3fd855['id']});return _0x1e4d7e;}function _0x2c6610(_0x2583fe){var _0x3938ea=0x2;var _0x4f65ec=[{'type':_0x15dd('0xe'),'app':'Set','appdata':_0x15dd('0xf'),'context':_0x2583fe[_0x15dd('0x6')],'exten':_0x2583fe[_0x15dd('0x7')],'priority':_0x3938ea++,'VoiceExtensionId':_0x2583fe['id']},{'type':'outbound','app':_0x2583fe[_0x15dd('0x8')]?'Set':_0x15dd('0x10'),'appdata':_0x2583fe[_0x15dd('0x8')]?'CDR(routeAlias)='+_0x2583fe[_0x15dd('0x8')]:_0x15dd('0xa'),'context':_0x2583fe[_0x15dd('0x6')],'exten':_0x2583fe['exten'],'priority':_0x3938ea++,'VoiceExtensionId':_0x2583fe['id']},{'type':'outbound','app':_0x15dd('0x4'),'appdata':_0x15dd('0x11')+(_0x2583fe[_0x15dd('0x12')]?_0x15dd('0x13')+_0x2583fe[_0x15dd('0x12')]+'}':'${EXTEN}'),'context':_0x2583fe[_0x15dd('0x6')],'exten':_0x2583fe['exten'],'priority':_0x3938ea++,'VoiceExtensionId':_0x2583fe['id']},{'type':_0x15dd('0xe'),'app':_0x15dd('0x4'),'appdata':'CDR(routeid)='+_0x2583fe['id'],'context':_0x2583fe['context'],'exten':_0x2583fe[_0x15dd('0x7')],'priority':_0x3938ea++,'VoiceExtensionId':_0x2583fe['id']},{'type':_0x15dd('0xe'),'app':_0x15dd('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3938ea+0x2)+_0x15dd('0x15')+(_0x3938ea+0x1)+')','context':_0x2583fe[_0x15dd('0x6')],'exten':_0x2583fe[_0x15dd('0x7')],'priority':_0x3938ea++,'VoiceExtensionId':_0x2583fe['id']},{'type':_0x15dd('0xe'),'app':_0x15dd('0x4'),'appdata':_0x2583fe['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x2583fe['cutdigits']+'}':_0x15dd('0x16'),'context':_0x2583fe[_0x15dd('0x6')],'exten':_0x2583fe['exten'],'priority':_0x3938ea++,'VoiceExtensionId':_0x2583fe['id']},{'type':'outbound','app':_0x15dd('0x4'),'appdata':_0x15dd('0xd'),'context':_0x2583fe['context'],'exten':_0x2583fe[_0x15dd('0x7')],'priority':_0x3938ea++,'VoiceExtensionId':_0x2583fe['id']},{'type':_0x15dd('0xe'),'app':_0x15dd('0x4'),'appdata':_0x15dd('0x17'),'context':_0x2583fe[_0x15dd('0x6')],'exten':_0x2583fe[_0x15dd('0x7')],'priority':_0x3938ea++,'VoiceExtensionId':_0x2583fe['id']},{'type':_0x15dd('0xe'),'app':'Set','appdata':_0x15dd('0x18'),'context':_0x2583fe[_0x15dd('0x6')],'exten':_0x2583fe['exten'],'priority':_0x3938ea++,'VoiceExtensionId':_0x2583fe['id']},{'type':_0x15dd('0xe'),'app':'Set','appdata':_0x15dd('0x19')+_0x2583fe['id'],'context':_0x2583fe['context'],'exten':_0x2583fe['exten'],'priority':_0x3938ea++,'VoiceExtensionId':_0x2583fe['id']}];if(_0x2583fe[_0x15dd('0x1a')](_0x15dd('0x1b'))&&_0x2583fe[_0x15dd('0x1b')]!==_0x15dd('0x1c')){_0x4f65ec[_0x15dd('0xc')]({'type':_0x15dd('0xe'),'app':_0x15dd('0x4'),'appdata':_0x15dd('0x1d'),'context':_0x2583fe[_0x15dd('0x6')],'exten':_0x2583fe[_0x15dd('0x7')],'priority':_0x3938ea++,'VoiceExtensionId':_0x2583fe['id']},{'type':_0x15dd('0xe'),'app':_0x15dd('0x4'),'appdata':_0x15dd('0x1e')+_0x2583fe[_0x15dd('0x1b')]||_0x15dd('0x1f'),'context':_0x2583fe[_0x15dd('0x6')],'exten':_0x2583fe[_0x15dd('0x7')],'priority':_0x3938ea++,'VoiceExtensionId':_0x2583fe['id']});}return _0x4f65ec;}function _0x479261(_0x2d9424,_0xf61328){var _0x5d1273=[{'name':'trunk','param':0x0},{'name':_0x15dd('0x20'),'param':0x1},{'name':_0x15dd('0x21'),'param':0x2},{'name':'url','param':0x3}];var _0x5ad09e={};var _0x2e02fa=_0xf61328[_0x15dd('0x22')](',');var _0x565041=[];for(var _0x2e92ca=0x0;_0x2e92ca<_0x5d1273[_0x15dd('0x23')];_0x2e92ca++){switch(_0x5d1273[_0x2e92ca][_0x15dd('0x24')]){case _0x15dd('0x25'):_0x5ad09e[_0x15dd('0x25')]=_0x2e02fa[_0x5d1273[_0x2e92ca][_0x15dd('0x26')]][_0x15dd('0x22')]('/')[0x1];_0x5ad09e[_0x15dd('0x27')]=_0x2e02fa[_0x5d1273[_0x2e92ca][_0x15dd('0x26')]]['split']('/')[0x2];_0x5ad09e[_0x15dd('0x28')]=_0x5ad09e['phone']?_0x5ad09e[_0x15dd('0x27')][_0x15dd('0x22')]('$')[0x0]:undefined;_0x5ad09e[_0x15dd('0x27')]=_0x2d9424['cutdigits']?(_0x5ad09e[_0x15dd('0x28')]||'')+_0x15dd('0x13')+_0x2d9424['cutdigits']+'}':(_0x5ad09e['prefix']||'')+_0x15dd('0x29');_0x565041[_0x5d1273[_0x2e92ca][_0x15dd('0x26')]]=[_0x15dd('0x2a'),_0x5ad09e[_0x15dd('0x25')],_0x5ad09e[_0x15dd('0x27')]][_0x15dd('0x2b')]('/');break;case _0x15dd('0x21'):_0x5ad09e[_0x15dd('0x21')]=_0x2e02fa[_0x5d1273[_0x2e92ca][_0x15dd('0x26')]];if(_0x2d9424['recordingFormat']!==_0x15dd('0x1c')){if(_0x5ad09e[_0x15dd('0x21')][_0x15dd('0x2c')]('U(xcally-mixmonitor-context)')<0x0){_0x5ad09e[_0x15dd('0x21')]+=_0x15dd('0x2d');}}else{_0x5ad09e[_0x15dd('0x21')]=_0x5ad09e[_0x15dd('0x21')][_0x15dd('0x2e')](_0x15dd('0x2d'),'');}_0x565041[_0x5d1273[_0x2e92ca][_0x15dd('0x26')]]=_0x5ad09e[_0x15dd('0x21')];break;default:_0x565041[_0x5d1273[_0x2e92ca][_0x15dd('0x26')]]=_0x2e02fa[_0x5d1273[_0x2e92ca]['param']];}}return _0x565041[_0x15dd('0x2b')](',');}function _0x315223(_0x2a05d7,_0x50d182,_0x995fde){return new Promise(function(_0x476566,_0x57e1cb){var _0x24bed0=[];if(_[_0x15dd('0x2f')](_0x50d182))return _0x476566(_0x24bed0);_0x3e5b75[_0x15dd('0x30')]['findAll']({'attributes':['id',_0x15dd('0x31'),_0x15dd('0x32')],'raw':!![]})[_0x15dd('0x33')](function(_0xdfd42d){for(var _0x27e4d1=0x0,_0x179e64=0x0;_0x27e4d1<_0x50d182[_0x15dd('0x23')];_0x27e4d1++,_0x179e64=0x0){var _0x53f567=_0x50d182[_0x27e4d1];var _0xdae672=[];var _0x5f2f74=[];delete _0x53f567['id'];if(_0x53f567['interval']!=='*,*,*,*'){_0x53f567['intervals']=[_0x53f567['interval']];}else{_0x53f567['intervals']=_0x53f567[_0x15dd('0x32')]?_['map'](_[_0x15dd('0x34')](_0xdfd42d,{'IntervalId':_0x53f567['IntervalId']}),'interval'):[];}_0x53f567[_0x15dd('0x6')]=_0x2a05d7[_0x15dd('0x6')];_0x53f567[_0x15dd('0x7')]=_0x2a05d7[_0x15dd('0x7')];if(_0x53f567[_0x15dd('0x3')])_0x53f567[_0x15dd('0x3')]=_0x53f567['type'][_0x15dd('0x35')]();if(_0x2a05d7[_0x15dd('0x3')]===_0x15dd('0xe')){if(_0x53f567[_0x15dd('0x1a')](_0x15dd('0x36'))&&_0x53f567[_0x15dd('0x36')]&&_0x53f567['tag']!=='--'){_0xdae672[_0x15dd('0xc')]({'type':_0x53f567[_0x15dd('0x3')][_0x15dd('0x35')](),'app':'Set','appdata':_0x15dd('0x37')+_0x53f567['tag'],'context':_0x2a05d7[_0x15dd('0x6')],'exten':_0x2a05d7[_0x15dd('0x7')],'priority':_0x53f567[_0x15dd('0x38')][_0x15dd('0x23')]+_0x995fde+_0x179e64++,'VoiceExtensionId':_0x2a05d7['id']});}_0xdae672['push']({'type':_0x53f567[_0x15dd('0x3')][_0x15dd('0x35')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x53f567[_0x15dd('0x39')]?_0x15dd('0x3a')+_0x53f567[_0x15dd('0x39')]+')':_0x15dd('0x3b')),'context':_0x2a05d7[_0x15dd('0x6')],'exten':_0x2a05d7[_0x15dd('0x7')],'priority':_0x53f567[_0x15dd('0x38')][_0x15dd('0x23')]+_0x995fde+_0x179e64++,'VoiceExtensionId':_0x2a05d7['id']});}else{if(_0x53f567['hasOwnProperty']('answer')){if(['queue',_0x15dd('0x3c')][_0x15dd('0x3d')](_0x53f567[_0x15dd('0x3e')][_0x15dd('0x35')]())&&_0x53f567[_0x15dd('0x3f')]!=='custom'){if(_0x53f567[_0x15dd('0x40')]){_0xdae672[_0x15dd('0xc')]({'type':_0x53f567['type'][_0x15dd('0x35')](),'app':_0x15dd('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2a05d7[_0x15dd('0x6')],'exten':_0x2a05d7[_0x15dd('0x7')],'priority':_0x53f567[_0x15dd('0x38')][_0x15dd('0x23')]+_0x995fde+_0x179e64++,'VoiceExtensionId':_0x2a05d7['id']});_0xdae672[_0x15dd('0xc')]({'type':_0x53f567['type'][_0x15dd('0x35')](),'app':_0x15dd('0x4'),'appdata':_0x15dd('0x41'),'context':_0x2a05d7['context'],'exten':_0x2a05d7[_0x15dd('0x7')],'priority':_0x53f567[_0x15dd('0x38')][_0x15dd('0x23')]+_0x995fde+_0x179e64++,'VoiceExtensionId':_0x2a05d7['id']});}else{_0xdae672[_0x15dd('0xc')]({'type':_0x53f567[_0x15dd('0x3')][_0x15dd('0x35')](),'app':_0x15dd('0x14'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2a05d7[_0x15dd('0x6')],'exten':_0x2a05d7['exten'],'priority':_0x53f567[_0x15dd('0x38')]['length']+_0x995fde+_0x179e64++,'VoiceExtensionId':_0x2a05d7['id']});_0xdae672[_0x15dd('0xc')]({'type':_0x53f567[_0x15dd('0x3')][_0x15dd('0x35')](),'app':'Set','appdata':_0x15dd('0x42'),'context':_0x2a05d7[_0x15dd('0x6')],'exten':_0x2a05d7[_0x15dd('0x7')],'priority':_0x53f567[_0x15dd('0x38')][_0x15dd('0x23')]+_0x995fde+_0x179e64++,'VoiceExtensionId':_0x2a05d7['id']});}}}}for(var _0x128312=0x0;_0x128312<_0x53f567['intervals'][_0x15dd('0x23')];_0x128312++){var _0x8e5a6e=_0x995fde+_0x53f567[_0x15dd('0x38')][_0x15dd('0x23')];var _0x30cdfc=_0x128312===_0x53f567[_0x15dd('0x38')]['length']-0x1?_0x995fde+_0xdae672[_0x15dd('0x23')]+_0x5f2f74[_0x15dd('0x23')]+0x2:_0x995fde+_0x128312+0x1;_0xdae672[_0x15dd('0x43')](_0x128312,0x0,{'type':_0x2a05d7[_0x15dd('0x3')],'app':_0x15dd('0x44'),'appdata':_0x53f567[_0x15dd('0x38')][_0x128312]+'?'+_0x2a05d7[_0x15dd('0x6')]+',${EXTEN},'+_0x8e5a6e+':'+_0x2a05d7[_0x15dd('0x6')]+',${EXTEN},'+_0x30cdfc,'exten':_0x2a05d7[_0x15dd('0x7')],'context':_0x2a05d7['context'],'priority':_0x995fde+_0x128312,'VoiceExtensionId':_0x2a05d7['id']});}if(_0x53f567[_0x15dd('0x3f')]==='outboundDial'){_0x53f567[_0x15dd('0x45')]=_0x479261(_0x2a05d7,_0x53f567['appdata']);}if(_0x53f567[_0x15dd('0x3f')]==='agi'){_0xdae672['push']({'type':_0x53f567[_0x15dd('0x3')][_0x15dd('0x35')](),'app':_0x15dd('0x4'),'appdata':_0x15dd('0x46'),'context':_0x2a05d7[_0x15dd('0x6')],'exten':_0x2a05d7[_0x15dd('0x7')],'priority':_0x53f567[_0x15dd('0x38')][_0x15dd('0x23')]+_0x995fde+_0x179e64++,'VoiceExtensionId':_0x2a05d7['id']});}_0x53f567[_0x15dd('0x47')]=_0xdae672[_0x15dd('0x23')]?_[_0x15dd('0x48')](_0xdae672)[_0x15dd('0x47')]+0x1:_0x995fde;_0x24bed0=_[_0x15dd('0x49')](_0x24bed0,_0xdae672,[_0x53f567],_0x5f2f74);_0x995fde=_[_0x15dd('0x48')](_0x24bed0)['priority']+0x1;}return _0x476566(_0x24bed0);})[_0x15dd('0x4a')](function(_0x133acd){_0x57e1cb(_0x133acd);});});}return _0x4282d9['define'](_0x15dd('0x4b'),attributes,{'tableName':_0x15dd('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x23f916){var _0x4f98ea=this[_0x15dd('0x4d')]({'plain':!![]});var _0x61dc66=_0x4f98ea[_0x15dd('0x3')]===_0x15dd('0xe')?_0x2c6610(_0x4f98ea):_0x3247f3(_0x4f98ea);return _0x315223(_0x4f98ea,_0x23f916,_[_0x15dd('0x48')](_0x61dc66)[_0x15dd('0x47')]+0x1)['then'](function(_0xc129fc){var _0xc24378=_[_0x15dd('0x49')](_0x61dc66,_0xc129fc);_0xc24378[_0x15dd('0xc')]({'type':_0x4f98ea[_0x15dd('0x3')],'app':_0x15dd('0x4e'),'exten':_0x4f98ea[_0x15dd('0x7')],'context':_0x4f98ea[_0x15dd('0x6')],'priority':_[_0x15dd('0x48')](_0xc24378)[_0x15dd('0x47')]+0x1,'VoiceExtensionId':_0x4f98ea['id']});return _0xc24378;});}}});}; \ No newline at end of file +var _0x29f7=['_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','length','trunk','split','phone','param','prefix','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','interval','IntervalId','*,*,*,*','intervals','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','answer','queue','playback','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','define','VoiceExtension','voice_extensions','get','then','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','exten','alias','NoOp','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat'];(function(_0x411f61,_0x49ca11){var _0x18f397=function(_0x145ef5){while(--_0x145ef5){_0x411f61['push'](_0x411f61['shift']());}};_0x18f397(++_0x49ca11);}(_0x29f7,0xca));var _0x729f=function(_0x2a9b56,_0x29afaa){_0x2a9b56=_0x2a9b56-0x0;var _0x172fab=_0x29f7[_0x2a9b56];return _0x172fab;};'use strict';var _=require(_0x729f('0x0'));var attributes=require(_0x729f('0x1'));module[_0x729f('0x2')]=function(_0x5dab37){var _0x5d2872=_0x5dab37['models'];function _0x2e74e3(_0x33cd55){var _0x174265=0x2;var _0x83b46b=[{'type':_0x33cd55[_0x729f('0x3')],'app':_0x729f('0x4'),'appdata':_0x729f('0x5')+_0x33cd55[_0x729f('0x3')],'context':_0x33cd55[_0x729f('0x6')],'exten':_0x33cd55[_0x729f('0x7')],'priority':_0x174265++,'VoiceExtensionId':_0x33cd55['id']},{'type':_0x33cd55[_0x729f('0x3')],'app':_0x33cd55[_0x729f('0x8')]?_0x729f('0x4'):_0x729f('0x9'),'appdata':_0x33cd55['alias']?'CDR(routeAlias)='+_0x33cd55[_0x729f('0x8')]:'No\x20alias\x20set','context':_0x33cd55['context'],'exten':_0x33cd55['exten'],'priority':_0x174265++,'VoiceExtensionId':_0x33cd55['id']}];if(_0x33cd55[_0x729f('0x3')]===_0x729f('0xa')){_0x83b46b[_0x729f('0xb')]({'type':'inbound','app':'Set','appdata':_0x729f('0xc')+_0x33cd55['id'],'context':_0x33cd55[_0x729f('0x6')],'exten':_0x33cd55[_0x729f('0x7')],'priority':_0x174265++,'VoiceExtensionId':_0x33cd55['id']});}_0x83b46b[_0x729f('0xb')]({'type':_0x33cd55[_0x729f('0x3')],'app':'Set','appdata':_0x729f('0xd'),'context':_0x33cd55[_0x729f('0x6')],'exten':_0x33cd55[_0x729f('0x7')],'priority':_0x174265++,'VoiceExtensionId':_0x33cd55['id']},{'type':_0x33cd55[_0x729f('0x3')],'app':_0x729f('0x4'),'appdata':_0x729f('0xe'),'context':_0x33cd55[_0x729f('0x6')],'exten':_0x33cd55[_0x729f('0x7')],'priority':_0x174265++,'VoiceExtensionId':_0x33cd55['id']},{'type':_0x33cd55[_0x729f('0x3')],'app':_0x729f('0x4'),'appdata':_0x729f('0xf'),'context':_0x33cd55[_0x729f('0x6')],'exten':_0x33cd55[_0x729f('0x7')],'priority':_0x174265++,'VoiceExtensionId':_0x33cd55['id']});return _0x83b46b;}function _0x63d841(_0x8fcfd9){var _0x581676=0x2;var _0xf002a2=[{'type':_0x729f('0x10'),'app':'Set','appdata':_0x729f('0x11'),'context':_0x8fcfd9[_0x729f('0x6')],'exten':_0x8fcfd9[_0x729f('0x7')],'priority':_0x581676++,'VoiceExtensionId':_0x8fcfd9['id']},{'type':'outbound','app':_0x8fcfd9[_0x729f('0x8')]?'Set':_0x729f('0x9'),'appdata':_0x8fcfd9[_0x729f('0x8')]?_0x729f('0x12')+_0x8fcfd9[_0x729f('0x8')]:'No\x20alias\x20set','context':_0x8fcfd9[_0x729f('0x6')],'exten':_0x8fcfd9[_0x729f('0x7')],'priority':_0x581676++,'VoiceExtensionId':_0x8fcfd9['id']},{'type':'outbound','app':'Set','appdata':_0x729f('0x13')+(_0x8fcfd9[_0x729f('0x14')]?_0x729f('0x15')+_0x8fcfd9[_0x729f('0x14')]+'}':_0x729f('0x16')),'context':_0x8fcfd9['context'],'exten':_0x8fcfd9['exten'],'priority':_0x581676++,'VoiceExtensionId':_0x8fcfd9['id']},{'type':_0x729f('0x10'),'app':_0x729f('0x4'),'appdata':_0x729f('0xc')+_0x8fcfd9['id'],'context':_0x8fcfd9['context'],'exten':_0x8fcfd9[_0x729f('0x7')],'priority':_0x581676++,'VoiceExtensionId':_0x8fcfd9['id']},{'type':_0x729f('0x10'),'app':_0x729f('0x17'),'appdata':_0x729f('0x18')+(_0x581676+0x2)+_0x729f('0x19')+(_0x581676+0x1)+')','context':_0x8fcfd9[_0x729f('0x6')],'exten':_0x8fcfd9[_0x729f('0x7')],'priority':_0x581676++,'VoiceExtensionId':_0x8fcfd9['id']},{'type':_0x729f('0x10'),'app':_0x729f('0x4'),'appdata':_0x8fcfd9['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x8fcfd9[_0x729f('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x8fcfd9['context'],'exten':_0x8fcfd9[_0x729f('0x7')],'priority':_0x581676++,'VoiceExtensionId':_0x8fcfd9['id']},{'type':_0x729f('0x10'),'app':'Set','appdata':_0x729f('0xd'),'context':_0x8fcfd9['context'],'exten':_0x8fcfd9['exten'],'priority':_0x581676++,'VoiceExtensionId':_0x8fcfd9['id']},{'type':_0x729f('0x10'),'app':_0x729f('0x4'),'appdata':_0x729f('0xe'),'context':_0x8fcfd9['context'],'exten':_0x8fcfd9[_0x729f('0x7')],'priority':_0x581676++,'VoiceExtensionId':_0x8fcfd9['id']},{'type':'outbound','app':'Set','appdata':_0x729f('0xf'),'context':_0x8fcfd9[_0x729f('0x6')],'exten':_0x8fcfd9[_0x729f('0x7')],'priority':_0x581676++,'VoiceExtensionId':_0x8fcfd9['id']},{'type':_0x729f('0x10'),'app':_0x729f('0x4'),'appdata':_0x729f('0x1a')+_0x8fcfd9['id'],'context':_0x8fcfd9[_0x729f('0x6')],'exten':_0x8fcfd9[_0x729f('0x7')],'priority':_0x581676++,'VoiceExtensionId':_0x8fcfd9['id']}];if(_0x8fcfd9[_0x729f('0x1b')](_0x729f('0x1c'))&&_0x8fcfd9[_0x729f('0x1c')]!=='none'){_0xf002a2['push']({'type':'outbound','app':'Set','appdata':_0x729f('0x1d'),'context':_0x8fcfd9[_0x729f('0x6')],'exten':_0x8fcfd9[_0x729f('0x7')],'priority':_0x581676++,'VoiceExtensionId':_0x8fcfd9['id']},{'type':_0x729f('0x10'),'app':_0x729f('0x4'),'appdata':_0x729f('0x1e')+_0x8fcfd9[_0x729f('0x1c')]||_0x729f('0x1f'),'context':_0x8fcfd9[_0x729f('0x6')],'exten':_0x8fcfd9['exten'],'priority':_0x581676++,'VoiceExtensionId':_0x8fcfd9['id']});}return _0xf002a2;}function _0x57bdf1(_0x54b663,_0x174c8e){var _0x718099=[{'name':'trunk','param':0x0},{'name':_0x729f('0x20'),'param':0x1},{'name':_0x729f('0x21'),'param':0x2},{'name':'url','param':0x3}];var _0x3e835c={};var _0x544e36=_0x174c8e['split'](',');var _0x209cb0=[];for(var _0x5c7628=0x0;_0x5c7628<_0x718099[_0x729f('0x22')];_0x5c7628++){switch(_0x718099[_0x5c7628]['name']){case _0x729f('0x23'):_0x3e835c[_0x729f('0x23')]=_0x544e36[_0x718099[_0x5c7628]['param']][_0x729f('0x24')]('/')[0x1];_0x3e835c[_0x729f('0x25')]=_0x544e36[_0x718099[_0x5c7628][_0x729f('0x26')]][_0x729f('0x24')]('/')[0x2];_0x3e835c[_0x729f('0x27')]=_0x3e835c[_0x729f('0x25')]?_0x3e835c['phone']['split']('$')[0x0]:undefined;_0x3e835c[_0x729f('0x25')]=_0x54b663[_0x729f('0x14')]?(_0x3e835c[_0x729f('0x27')]||'')+'${EXTEN:'+_0x54b663[_0x729f('0x14')]+'}':(_0x3e835c[_0x729f('0x27')]||'')+'${EXTEN}';_0x209cb0[_0x718099[_0x5c7628][_0x729f('0x26')]]=[_0x729f('0x28'),_0x3e835c[_0x729f('0x23')],_0x3e835c['phone']][_0x729f('0x29')]('/');break;case _0x729f('0x21'):_0x3e835c[_0x729f('0x21')]=_0x544e36[_0x718099[_0x5c7628][_0x729f('0x26')]];if(_0x54b663[_0x729f('0x1c')]!==_0x729f('0x2a')){if(_0x3e835c[_0x729f('0x21')][_0x729f('0x2b')](_0x729f('0x2c'))<0x0){_0x3e835c['options']+='U(xcally-mixmonitor-context)';}}else{_0x3e835c[_0x729f('0x21')]=_0x3e835c['options'][_0x729f('0x2d')](_0x729f('0x2c'),'');}_0x209cb0[_0x718099[_0x5c7628][_0x729f('0x26')]]=_0x3e835c[_0x729f('0x21')];break;default:_0x209cb0[_0x718099[_0x5c7628][_0x729f('0x26')]]=_0x544e36[_0x718099[_0x5c7628]['param']];}}return _0x209cb0[_0x729f('0x29')](',');}function _0x363b2f(_0x1e9adb,_0x43c4f5,_0x290e97){return new Promise(function(_0x74ca51,_0xbed94a){var _0x5dd077=[];if(_[_0x729f('0x2e')](_0x43c4f5))return _0x74ca51(_0x5dd077);_0x5d2872['Interval']['findAll']({'attributes':['id',_0x729f('0x2f'),_0x729f('0x30')],'raw':!![]})['then'](function(_0x1c00b6){for(var _0x18de2d=0x0,_0x425068=0x0;_0x18de2d<_0x43c4f5[_0x729f('0x22')];_0x18de2d++,_0x425068=0x0){var _0x343f7f=_0x43c4f5[_0x18de2d];var _0x3156b5=[];var _0x5b7486=[];delete _0x343f7f['id'];if(_0x343f7f[_0x729f('0x2f')]!==_0x729f('0x31')){_0x343f7f[_0x729f('0x32')]=[_0x343f7f[_0x729f('0x2f')]];}else{_0x343f7f['intervals']=_0x343f7f[_0x729f('0x30')]?_['map'](_[_0x729f('0x33')](_0x1c00b6,{'IntervalId':_0x343f7f[_0x729f('0x30')]}),_0x729f('0x2f')):[];}_0x343f7f[_0x729f('0x6')]=_0x1e9adb[_0x729f('0x6')];_0x343f7f['exten']=_0x1e9adb['exten'];if(_0x343f7f['type'])_0x343f7f[_0x729f('0x3')]=_0x343f7f[_0x729f('0x3')][_0x729f('0x34')]();if(_0x1e9adb[_0x729f('0x3')]===_0x729f('0x10')){if(_0x343f7f[_0x729f('0x1b')]('tag')&&_0x343f7f[_0x729f('0x35')]&&_0x343f7f[_0x729f('0x35')]!=='--'){_0x3156b5[_0x729f('0xb')]({'type':_0x343f7f[_0x729f('0x3')][_0x729f('0x34')](),'app':'Set','appdata':_0x729f('0x36')+_0x343f7f['tag'],'context':_0x1e9adb[_0x729f('0x6')],'exten':_0x1e9adb[_0x729f('0x7')],'priority':_0x343f7f['intervals']['length']+_0x290e97+_0x425068++,'VoiceExtensionId':_0x1e9adb['id']});}_0x3156b5[_0x729f('0xb')]({'type':_0x343f7f[_0x729f('0x3')][_0x729f('0x34')](),'app':_0x729f('0x17'),'appdata':_0x729f('0x37')+(_0x343f7f['callerID']?'Set(CALLERID(all)='+_0x343f7f['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x1e9adb[_0x729f('0x6')],'exten':_0x1e9adb[_0x729f('0x7')],'priority':_0x343f7f['intervals'][_0x729f('0x22')]+_0x290e97+_0x425068++,'VoiceExtensionId':_0x1e9adb['id']});}else{if(_0x343f7f[_0x729f('0x1b')](_0x729f('0x38'))){if([_0x729f('0x39'),_0x729f('0x3a')]['includes'](_0x343f7f['app']['toLowerCase']())&&_0x343f7f['appType']!==_0x729f('0x3b')){if(_0x343f7f[_0x729f('0x38')]){_0x3156b5[_0x729f('0xb')]({'type':_0x343f7f[_0x729f('0x3')][_0x729f('0x34')](),'app':_0x729f('0x17'),'appdata':_0x729f('0x3c'),'context':_0x1e9adb['context'],'exten':_0x1e9adb[_0x729f('0x7')],'priority':_0x343f7f[_0x729f('0x32')][_0x729f('0x22')]+_0x290e97+_0x425068++,'VoiceExtensionId':_0x1e9adb['id']});_0x3156b5[_0x729f('0xb')]({'type':_0x343f7f[_0x729f('0x3')]['toLowerCase'](),'app':_0x729f('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x1e9adb[_0x729f('0x6')],'exten':_0x1e9adb['exten'],'priority':_0x343f7f[_0x729f('0x32')][_0x729f('0x22')]+_0x290e97+_0x425068++,'VoiceExtensionId':_0x1e9adb['id']});}else{_0x3156b5[_0x729f('0xb')]({'type':_0x343f7f[_0x729f('0x3')]['toLowerCase'](),'app':_0x729f('0x17'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1e9adb[_0x729f('0x6')],'exten':_0x1e9adb[_0x729f('0x7')],'priority':_0x343f7f['intervals'][_0x729f('0x22')]+_0x290e97+_0x425068++,'VoiceExtensionId':_0x1e9adb['id']});_0x3156b5[_0x729f('0xb')]({'type':_0x343f7f[_0x729f('0x3')][_0x729f('0x34')](),'app':'Set','appdata':_0x729f('0x3d'),'context':_0x1e9adb[_0x729f('0x6')],'exten':_0x1e9adb[_0x729f('0x7')],'priority':_0x343f7f[_0x729f('0x32')][_0x729f('0x22')]+_0x290e97+_0x425068++,'VoiceExtensionId':_0x1e9adb['id']});}}}}for(var _0x597ff5=0x0;_0x597ff5<_0x343f7f[_0x729f('0x32')][_0x729f('0x22')];_0x597ff5++){var _0x31a9c3=_0x290e97+_0x343f7f[_0x729f('0x32')]['length'];var _0x3da4ac=_0x597ff5===_0x343f7f[_0x729f('0x32')]['length']-0x1?_0x290e97+_0x3156b5[_0x729f('0x22')]+_0x5b7486[_0x729f('0x22')]+0x2:_0x290e97+_0x597ff5+0x1;_0x3156b5['splice'](_0x597ff5,0x0,{'type':_0x1e9adb[_0x729f('0x3')],'app':_0x729f('0x3e'),'appdata':_0x343f7f[_0x729f('0x32')][_0x597ff5]+'?'+_0x1e9adb[_0x729f('0x6')]+_0x729f('0x3f')+_0x31a9c3+':'+_0x1e9adb[_0x729f('0x6')]+',${EXTEN},'+_0x3da4ac,'exten':_0x1e9adb[_0x729f('0x7')],'context':_0x1e9adb['context'],'priority':_0x290e97+_0x597ff5,'VoiceExtensionId':_0x1e9adb['id']});}if(_0x343f7f[_0x729f('0x40')]==='outboundDial'){_0x343f7f[_0x729f('0x41')]=_0x57bdf1(_0x1e9adb,_0x343f7f[_0x729f('0x41')]);}if(_0x343f7f[_0x729f('0x40')]===_0x729f('0x42')){_0x3156b5[_0x729f('0xb')]({'type':_0x343f7f[_0x729f('0x3')]['toLowerCase'](),'app':_0x729f('0x4'),'appdata':_0x729f('0x43'),'context':_0x1e9adb[_0x729f('0x6')],'exten':_0x1e9adb[_0x729f('0x7')],'priority':_0x343f7f[_0x729f('0x32')][_0x729f('0x22')]+_0x290e97+_0x425068++,'VoiceExtensionId':_0x1e9adb['id']});}_0x343f7f[_0x729f('0x44')]=_0x3156b5[_0x729f('0x22')]?_[_0x729f('0x45')](_0x3156b5)[_0x729f('0x44')]+0x1:_0x290e97;_0x5dd077=_[_0x729f('0x46')](_0x5dd077,_0x3156b5,[_0x343f7f],_0x5b7486);_0x290e97=_[_0x729f('0x45')](_0x5dd077)['priority']+0x1;}return _0x74ca51(_0x5dd077);})['catch'](function(_0x33fa40){_0xbed94a(_0x33fa40);});});}return _0x5dab37[_0x729f('0x47')](_0x729f('0x48'),attributes,{'tableName':_0x729f('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1d2951){var _0x108077=this[_0x729f('0x4a')]({'plain':!![]});var _0x43fee5=_0x108077[_0x729f('0x3')]===_0x729f('0x10')?_0x63d841(_0x108077):_0x2e74e3(_0x108077);return _0x363b2f(_0x108077,_0x1d2951,_[_0x729f('0x45')](_0x43fee5)[_0x729f('0x44')]+0x1)[_0x729f('0x4b')](function(_0x47c688){var _0x3a5cc3=_['concat'](_0x43fee5,_0x47c688);_0x3a5cc3[_0x729f('0xb')]({'type':_0x108077[_0x729f('0x3')],'app':_0x729f('0x4c'),'exten':_0x108077['exten'],'context':_0x108077['context'],'priority':_['last'](_0x3a5cc3)['priority']+0x1,'VoiceExtensionId':_0x108077['id']});return _0x3a5cc3;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 7f39b33..cbc5fa8 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 _0xd6d2=['findAll','options','raw','where','include','map','attributes','model','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension'];(function(_0x11df9b,_0x14619b){var _0x3c4400=function(_0x3de933){while(--_0x3de933){_0x11df9b['push'](_0x11df9b['shift']());}};_0x3c4400(++_0x14619b);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x169c24,_0x31eeea){_0x169c24=_0x169c24-0x0;var _0x2b9692=_0xd6d2[_0x169c24];return _0x2b9692;};'use strict';var _=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var moment=require('moment');var BPromise=require(_0x2d6d('0x2'));var rs=require(_0x2d6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d6d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d6d('0x5'))(_0x2d6d('0x6'));var config=require(_0x2d6d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2d6d('0x8')][_0x2d6d('0x9')]({'port':0x232a});config[_0x2d6d('0xa')]=_[_0x2d6d('0xb')](config[_0x2d6d('0xa')],{'host':_0x2d6d('0xc'),'port':0x18eb});var socket=require(_0x2d6d('0xd'))(new Redis(config[_0x2d6d('0xa')]));require(_0x2d6d('0xe'))[_0x2d6d('0xf')](socket);function respondWithRpcPromise(_0x1a1f60,_0x4bf440,_0x25fc41){return new BPromise(function(_0x32a9c3,_0x3ea447){return client[_0x2d6d('0x10')](_0x1a1f60,_0x25fc41)[_0x2d6d('0x11')](function(_0x4f1a98){logger[_0x2d6d('0x12')](_0x2d6d('0x13'),_0x4bf440,_0x2d6d('0x14'));logger[_0x2d6d('0x15')](_0x2d6d('0x16'),_0x4bf440,'request\x20sent',JSON[_0x2d6d('0x17')](_0x4f1a98));if(_0x4f1a98[_0x2d6d('0x18')]){if(_0x4f1a98[_0x2d6d('0x18')][_0x2d6d('0x19')]===0x1f4){logger['error'](_0x2d6d('0x13'),_0x4bf440,_0x4f1a98[_0x2d6d('0x18')]['message']);return _0x3ea447(_0x4f1a98['error'][_0x2d6d('0x1a')]);}logger[_0x2d6d('0x18')](_0x2d6d('0x13'),_0x4bf440,_0x4f1a98['error'][_0x2d6d('0x1a')]);return _0x32a9c3(_0x4f1a98['error']['message']);}else{logger['info'](_0x2d6d('0x13'),_0x4bf440,_0x2d6d('0x14'));_0x32a9c3(_0x4f1a98[_0x2d6d('0x1b')][_0x2d6d('0x1a')]);}})[_0x2d6d('0x1c')](function(_0x1bb4db){logger[_0x2d6d('0x18')](_0x2d6d('0x13'),_0x4bf440,_0x1bb4db);_0x3ea447(_0x1bb4db);});});}exports[_0x2d6d('0x1d')]=function(_0x4898a7){var _0x315d13=this;return new Promise(function(_0x41d287,_0x5b0c61){return db[_0x2d6d('0x1e')][_0x2d6d('0x1f')]({'raw':_0x4898a7[_0x2d6d('0x20')]?_0x4898a7[_0x2d6d('0x20')][_0x2d6d('0x21')]===undefined?!![]:![]:!![],'where':_0x4898a7[_0x2d6d('0x20')]?_0x4898a7['options'][_0x2d6d('0x22')]||null:null,'attributes':_0x4898a7[_0x2d6d('0x20')]?_0x4898a7[_0x2d6d('0x20')]['attributes']||null:null,'limit':_0x4898a7['options']?_0x4898a7[_0x2d6d('0x20')]['limit']||null:null,'include':_0x4898a7['options']?_0x4898a7['options'][_0x2d6d('0x23')]?_[_0x2d6d('0x24')](_0x4898a7[_0x2d6d('0x20')][_0x2d6d('0x23')],function(_0x3e5a92){return{'model':db[_0x3e5a92['model']],'as':_0x3e5a92['as'],'attributes':_0x3e5a92[_0x2d6d('0x25')],'include':_0x3e5a92[_0x2d6d('0x23')]?_[_0x2d6d('0x24')](_0x3e5a92[_0x2d6d('0x23')],function(_0x33817d){return{'model':db[_0x33817d[_0x2d6d('0x26')]],'as':_0x33817d['as'],'attributes':_0x33817d[_0x2d6d('0x25')],'include':_0x33817d[_0x2d6d('0x23')]?_[_0x2d6d('0x24')](_0x33817d['include'],function(_0x1016e1){return{'model':db[_0x1016e1[_0x2d6d('0x26')]],'as':_0x1016e1['as'],'attributes':_0x1016e1[_0x2d6d('0x25')]};}):[]};}):[]};}):[]:[]})[_0x2d6d('0x11')](function(_0x486963){logger[_0x2d6d('0x12')]('GetVoiceExtension',_0x4898a7);logger[_0x2d6d('0x15')]('GetVoiceExtension',_0x4898a7,JSON['stringify'](_0x486963));_0x41d287(_0x486963);})[_0x2d6d('0x1c')](function(_0x557ad8){logger[_0x2d6d('0x18')](_0x2d6d('0x1d'),_0x557ad8['message'],_0x4898a7);_0x5b0c61(_0x315d13[_0x2d6d('0x18')](0x1f4,_0x557ad8['message']));});});}; \ No newline at end of file +var _0xd046=['util','moment','bluebird','ioredis','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','attributes','limit','include','map','model'];(function(_0x40c6cc,_0x219e42){var _0x472f37=function(_0x4798cd){while(--_0x4798cd){_0x40c6cc['push'](_0x40c6cc['shift']());}};_0x472f37(++_0x219e42);}(_0xd046,0x129));var _0x6d04=function(_0x5a90d5,_0x1160ab){_0x5a90d5=_0x5a90d5-0x0;var _0xd7a2f3=_0xd046[_0x5a90d5];return _0xd7a2f3;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});config[_0x6d04('0x7')]=_['defaults'](config['redis'],{'host':_0x6d04('0x8'),'port':0x18eb});var socket=require(_0x6d04('0x9'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x6d04('0xa')](socket);function respondWithRpcPromise(_0x4b5aae,_0x38bce9,_0x5876b8){return new BPromise(function(_0x5a2dbb,_0x4d3a31){return client[_0x6d04('0xb')](_0x4b5aae,_0x5876b8)[_0x6d04('0xc')](function(_0x3397ea){logger[_0x6d04('0xd')]('VoiceExtension,\x20%s,\x20%s',_0x38bce9,_0x6d04('0xe'));logger[_0x6d04('0xf')](_0x6d04('0x10'),_0x38bce9,_0x6d04('0xe'),JSON[_0x6d04('0x11')](_0x3397ea));if(_0x3397ea[_0x6d04('0x12')]){if(_0x3397ea[_0x6d04('0x12')][_0x6d04('0x13')]===0x1f4){logger[_0x6d04('0x12')](_0x6d04('0x14'),_0x38bce9,_0x3397ea[_0x6d04('0x12')][_0x6d04('0x15')]);return _0x4d3a31(_0x3397ea[_0x6d04('0x12')][_0x6d04('0x15')]);}logger[_0x6d04('0x12')](_0x6d04('0x14'),_0x38bce9,_0x3397ea[_0x6d04('0x12')][_0x6d04('0x15')]);return _0x5a2dbb(_0x3397ea[_0x6d04('0x12')][_0x6d04('0x15')]);}else{logger[_0x6d04('0xd')](_0x6d04('0x14'),_0x38bce9,_0x6d04('0xe'));_0x5a2dbb(_0x3397ea[_0x6d04('0x16')]['message']);}})[_0x6d04('0x17')](function(_0x1dcd3d){logger[_0x6d04('0x12')](_0x6d04('0x14'),_0x38bce9,_0x1dcd3d);_0x4d3a31(_0x1dcd3d);});});}exports[_0x6d04('0x18')]=function(_0x2c6bb4){var _0x32531b=this;return new Promise(function(_0x260135,_0x2e9d6e){return db[_0x6d04('0x19')][_0x6d04('0x1a')]({'raw':_0x2c6bb4[_0x6d04('0x1b')]?_0x2c6bb4[_0x6d04('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2c6bb4[_0x6d04('0x1b')]?_0x2c6bb4[_0x6d04('0x1b')]['where']||null:null,'attributes':_0x2c6bb4['options']?_0x2c6bb4[_0x6d04('0x1b')][_0x6d04('0x1c')]||null:null,'limit':_0x2c6bb4[_0x6d04('0x1b')]?_0x2c6bb4[_0x6d04('0x1b')][_0x6d04('0x1d')]||null:null,'include':_0x2c6bb4[_0x6d04('0x1b')]?_0x2c6bb4[_0x6d04('0x1b')][_0x6d04('0x1e')]?_[_0x6d04('0x1f')](_0x2c6bb4[_0x6d04('0x1b')][_0x6d04('0x1e')],function(_0x23d78a){return{'model':db[_0x23d78a[_0x6d04('0x20')]],'as':_0x23d78a['as'],'attributes':_0x23d78a[_0x6d04('0x1c')],'include':_0x23d78a['include']?_[_0x6d04('0x1f')](_0x23d78a[_0x6d04('0x1e')],function(_0x6104a2){return{'model':db[_0x6104a2[_0x6d04('0x20')]],'as':_0x6104a2['as'],'attributes':_0x6104a2[_0x6d04('0x1c')],'include':_0x6104a2[_0x6d04('0x1e')]?_['map'](_0x6104a2[_0x6d04('0x1e')],function(_0x3a7f68){return{'model':db[_0x3a7f68[_0x6d04('0x20')]],'as':_0x3a7f68['as'],'attributes':_0x3a7f68[_0x6d04('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6d04('0xc')](function(_0x5d2b7e){logger['info']('GetVoiceExtension',_0x2c6bb4);logger['debug'](_0x6d04('0x18'),_0x2c6bb4,JSON['stringify'](_0x5d2b7e));_0x260135(_0x5d2b7e);})[_0x6d04('0x17')](function(_0x4ed123){logger[_0x6d04('0x12')](_0x6d04('0x18'),_0x4ed123[_0x6d04('0x15')],_0x2c6bb4);_0x2e9d6e(_0x32531b[_0x6d04('0x12')](0x1f4,_0x4ed123[_0x6d04('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index b9f3259..ae04385 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 _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x344928,_0x213937){var _0x329b36=function(_0x5a5b5f){while(--_0x5a5b5f){_0x344928['push'](_0x344928['shift']());}};_0x329b36(++_0x213937);}(_0x4975,0x86));var _0x5497=function(_0x24dd9,_0x33428a){_0x24dd9=_0x24dd9-0x0;var _0x5c308c=_0x4975[_0x24dd9];return _0x5c308c;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0xeffb1f,_0x1a7b48){var _0xba351c=function(_0x15d527){while(--_0x15d527){_0xeffb1f['push'](_0xeffb1f['shift']());}};_0xba351c(++_0x1a7b48);}(_0x1261,0x144));var _0x1126=function(_0x57ec1a,_0x2b7624){_0x57ec1a=_0x57ec1a-0x0;var _0x2159ad=_0x1261[_0x57ec1a];return _0x2159ad;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f79746f..b26a879 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 _0xba34=['getMessages','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages'];(function(_0x267a92,_0x144bb1){var _0x41c589=function(_0x4ceae2){while(--_0x4ceae2){_0x267a92['push'](_0x267a92['shift']());}};_0x41c589(++_0x144bb1);}(_0xba34,0x119));var _0x4ba3=function(_0x449758,_0x3ca803){_0x449758=_0x449758-0x0;var _0x3fdfe6=_0xba34[_0x449758];return _0x3fdfe6;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/:id',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);router[_0x4ba3('0x13')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x14')]=router; \ No newline at end of file +var _0x6050=['/:id/messages','isAuthenticated','getMessages','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','show','get'];(function(_0x83451a,_0x4ed239){var _0x22027e=function(_0xa8bcb1){while(--_0xa8bcb1){_0x83451a['push'](_0x83451a['shift']());}};_0x22027e(++_0x4ed239);}(_0x6050,0x196));var _0x0605=function(_0x2c65d0,_0x50c25d){_0x2c65d0=_0x2c65d0-0x0;var _0x23636b=_0x6050[_0x2c65d0];return _0x23636b;};'use strict';var multer=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var path=require(_0x0605('0x2'));var timeout=require(_0x0605('0x3'));var express=require(_0x0605('0x4'));var router=express[_0x0605('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0605('0x6'));var interaction=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var controller=require('./voiceMail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0605('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0605('0xa')]);router[_0x0605('0xb')](_0x0605('0xc'),auth[_0x0605('0xd')](),controller[_0x0605('0xe')]);router['post']('/',auth[_0x0605('0xd')](),controller[_0x0605('0xf')]);router[_0x0605('0x10')](_0x0605('0x11'),auth[_0x0605('0xd')](),controller[_0x0605('0x12')]);router[_0x0605('0x13')](_0x0605('0x11'),auth[_0x0605('0xd')](),controller[_0x0605('0x14')]);module[_0x0605('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 96a294d..d735413 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 _0x4fe6=['TIMESTAMP','INTEGER','VIRTUAL','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','yes','ENUM'];(function(_0x35fd27,_0x3dc2cd){var _0x5733c7=function(_0x2c836e){while(--_0x2c836e){_0x35fd27['push'](_0x35fd27['shift']());}};_0x5733c7(++_0x3dc2cd);}(_0x4fe6,0xc1));var _0x64fe=function(_0x3669bd,_0x4bcb4c){_0x3669bd=_0x3669bd-0x0;var _0x7a401e=_0x4fe6[_0x3669bd];return _0x7a401e;};'use strict';var Sequelize=require(_0x64fe('0x0'));module[_0x64fe('0x1')]={'customer_id':{'type':Sequelize[_0x64fe('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x64fe('0x3'),'unique':_0x64fe('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x64fe('0x4')},'password':{'type':Sequelize[_0x64fe('0x2')]},'fullname':{'type':Sequelize[_0x64fe('0x2')]},'email':{'type':Sequelize[_0x64fe('0x2')],'validate':{'isEmail':!![]},'set':function(_0x59a26a){this[_0x64fe('0x5')]('email',typeof _0x59a26a===_0x64fe('0x6')&&_0x59a26a[_0x64fe('0x7')]()?_0x59a26a['trim']():null);}},'pager':{'type':Sequelize[_0x64fe('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x64fe('0x8')},'attach':{'type':Sequelize['ENUM'](_0x64fe('0x9'),'no'),'defaultValue':_0x64fe('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x64fe('0xa')](_0x64fe('0x9'),'no'),'defaultValue':_0x64fe('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x64fe('0x2')]},'callback':{'type':Sequelize[_0x64fe('0x2')]},'review':{'type':Sequelize[_0x64fe('0xa')](_0x64fe('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x64fe('0xa')](_0x64fe('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x64fe('0xa')](_0x64fe('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x64fe('0xa')](_0x64fe('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x64fe('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x64fe('0xa')](_0x64fe('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x64fe('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x64fe('0xa')](_0x64fe('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x64fe('0xa')](_0x64fe('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x64fe('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x64fe('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x64fe('0xd')],'get':function(){return this['getDataValue']('fullname')+_0x64fe('0xe')+this[_0x64fe('0xf')](_0x64fe('0x10'));}}}; \ No newline at end of file +var _0xf494=['TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','exports','STRING','from-voicemail','contest_mailbox','email','string','ENUM','yes'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0xf494,0xca));var _0x4f49=function(_0x406618,_0xef5e1){_0x406618=_0x406618-0x0;var _0x58d993=_0xf494[_0x406618];return _0x58d993;};'use strict';var Sequelize=require('sequelize');module[_0x4f49('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4f49('0x1')],'defaultValue':_0x4f49('0x2'),'unique':_0x4f49('0x3')},'mailbox':{'type':Sequelize[_0x4f49('0x1')],'defaultValue':'','allowNull':![],'unique':_0x4f49('0x3')},'password':{'type':Sequelize[_0x4f49('0x1')]},'fullname':{'type':Sequelize[_0x4f49('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x8c1c23){this['setDataValue'](_0x4f49('0x4'),typeof _0x8c1c23===_0x4f49('0x5')&&_0x8c1c23['trim']()?_0x8c1c23['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x4f49('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x4f49('0x6')](_0x4f49('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x4f49('0x6')](_0x4f49('0x7'),'no'),'defaultValue':_0x4f49('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4f49('0x1')]},'callback':{'type':Sequelize[_0x4f49('0x1')]},'review':{'type':Sequelize[_0x4f49('0x6')](_0x4f49('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4f49('0x6')](_0x4f49('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4f49('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4f49('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4f49('0x6')](_0x4f49('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4f49('0x6')](_0x4f49('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x4f49('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4f49('0x6')](_0x4f49('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4f49('0x6')](_0x4f49('0x7'),'no'),'defaultValue':_0x4f49('0x7'),'allowNull':![]},'stamp':{'type':_0x4f49('0x9')},'emailsubject':{'type':Sequelize[_0x4f49('0x1')]},'emailbody':{'type':Sequelize[_0x4f49('0x1')]},'maxsecs':{'type':Sequelize[_0x4f49('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4f49('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4f49('0xb')],'get':function(){return this[_0x4f49('0xc')](_0x4f49('0xd'))+_0x4f49('0xe')+this[_0x4f49('0xc')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 049b41a..9799e36 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 _0xe5b5=['stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','filter','where','merge','options','VoiceMail','includeAll','include','findAll','catch','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMessages','VoiceMailMessage','pick','mailbox','findAndCountAll','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','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xe5b5[_0x2e2681];return _0x368a64;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310f71,_0x18434e){_0x18434e=_0x18434e||0xcc;return function(_0x4559a0){if(_0x4559a0){return _0x310f71[_0x5e5b('0x1b')](_0x18434e);}return _0x310f71[_0x5e5b('0x1c')](_0x18434e)[_0x5e5b('0x1d')]();};}function respondWithResult(_0x2e331d,_0x49edd0){_0x49edd0=_0x49edd0||0xc8;return function(_0x2b37fa){if(_0x2b37fa){return _0x2e331d[_0x5e5b('0x1c')](_0x49edd0)['json'](_0x2b37fa);}};}function respondWithFilteredResult(_0x227417,_0x578c14){return function(_0x4e9509){if(_0x4e9509){var _0x13a1cb=typeof _0x578c14[_0x5e5b('0x1e')]===_0x5e5b('0x1f')&&typeof _0x578c14['limit']===_0x5e5b('0x1f');var _0x4d490c=_0x4e9509[_0x5e5b('0x20')];var _0x45a091=_0x13a1cb?0x0:_0x578c14['offset'];var _0xe5aa6b=_0x13a1cb?_0x4e9509[_0x5e5b('0x20')]:_0x578c14[_0x5e5b('0x1e')]+_0x578c14['limit'];var _0x2bf0b7;if(_0xe5aa6b>=_0x4d490c){_0xe5aa6b=_0x4d490c;_0x2bf0b7=0xc8;}else{_0x2bf0b7=0xce;}_0x227417[_0x5e5b('0x1c')](_0x2bf0b7);return _0x227417['set'](_0x5e5b('0x21'),_0x45a091+'-'+_0xe5aa6b+'/'+_0x4d490c)[_0x5e5b('0x22')](_0x4e9509);}return null;};}function patchUpdates(_0x3c488e){return function(_0x2d8252){try{jsonpatch[_0x5e5b('0x23')](_0x2d8252,_0x3c488e,!![]);}catch(_0x33d61b){return BPromise[_0x5e5b('0x24')](_0x33d61b);}return _0x2d8252[_0x5e5b('0x25')]();};}function saveUpdates(_0x4a78e3,_0x512e46){return function(_0x256a00){if(_0x256a00){return _0x256a00[_0x5e5b('0x26')](_0x4a78e3)[_0x5e5b('0x27')](function(_0xe1c268){return _0xe1c268;});}return null;};}function removeEntity(_0x2e38ed,_0x28cd95){return function(_0x135c6c){if(_0x135c6c){return _0x135c6c[_0x5e5b('0x28')]()[_0x5e5b('0x27')](function(){var _0x26bc02=_0x135c6c[_0x5e5b('0x29')]({'plain':!![]});var _0x4da321=_0x5e5b('0x2a');return db[_0x5e5b('0x2b')][_0x5e5b('0x28')]({'where':{'type':_0x4da321,'resourceId':_0x26bc02['id']}})['then'](function(){return _0x135c6c;});})[_0x5e5b('0x27')](function(){_0x2e38ed[_0x5e5b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ff91,_0x21c74b){return function(_0x39ce16){if(!_0x39ce16){_0x13ff91[_0x5e5b('0x1b')](0x194);}return _0x39ce16;};}function handleError(_0x31af09,_0x250fbd){_0x250fbd=_0x250fbd||0x1f4;return function(_0x2cb695){logger[_0x5e5b('0x2c')](_0x2cb695[_0x5e5b('0x2d')]);if(_0x2cb695[_0x5e5b('0x2e')]){delete _0x2cb695[_0x5e5b('0x2e')];}_0x31af09[_0x5e5b('0x1c')](_0x250fbd)['send'](_0x2cb695);};}exports['index']=function(_0x365f6f,_0x289f54){var _0xb68419={},_0x3dcdab={},_0x12f1ee={'count':0x0,'rows':[]};var _0x4b9be8=_[_0x5e5b('0x2f')](db['VoiceMail'][_0x5e5b('0x30')],function(_0x384d8f){return{'name':_0x384d8f[_0x5e5b('0x31')],'type':_0x384d8f[_0x5e5b('0x32')]['key']};});_0x3dcdab[_0x5e5b('0x33')]=_[_0x5e5b('0x2f')](_0x4b9be8,'name');_0x3dcdab[_0x5e5b('0x34')]=_[_0x5e5b('0x35')](_0x365f6f[_0x5e5b('0x34')]);_0x3dcdab[_0x5e5b('0x36')]=_[_0x5e5b('0x37')](_0x3dcdab[_0x5e5b('0x33')],_0x3dcdab[_0x5e5b('0x34')]);_0xb68419[_0x5e5b('0x38')]=_['intersection'](_0x3dcdab[_0x5e5b('0x33')],qs[_0x5e5b('0x39')](_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x39')]));_0xb68419[_0x5e5b('0x38')]=_0xb68419[_0x5e5b('0x38')]['length']?_0xb68419['attributes']:_0x3dcdab[_0x5e5b('0x33')];if(!_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3a')]('nolimit')){_0xb68419[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3b')](_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3b')]);_0xb68419['offset']=qs[_0x5e5b('0x1e')](_0x365f6f[_0x5e5b('0x34')]['offset']);}_0xb68419['order']=qs[_0x5e5b('0x3c')](_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3c')]);_0xb68419['where']=qs[_0x5e5b('0x36')](_['pick'](_0x365f6f['query'],_0x3dcdab[_0x5e5b('0x36')]),_0x4b9be8);if(_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3d')]){_0xb68419[_0x5e5b('0x3e')]=_[_0x5e5b('0x3f')](_0xb68419[_0x5e5b('0x3e')],{'$or':_[_0x5e5b('0x2f')](_0x4b9be8,function(_0x14ac35){if(_0x14ac35[_0x5e5b('0x32')]!=='VIRTUAL'){var _0x1f1907={};_0x1f1907[_0x14ac35[_0x5e5b('0x2e')]]={'$like':'%'+_0x365f6f['query'][_0x5e5b('0x3d')]+'%'};return _0x1f1907;}})});}_0xb68419=_['merge']({},_0xb68419,_0x365f6f[_0x5e5b('0x40')]);var _0x14b152={'where':_0xb68419[_0x5e5b('0x3e')]};return db[_0x5e5b('0x41')][_0x5e5b('0x20')](_0x14b152)[_0x5e5b('0x27')](function(_0x371550){_0x12f1ee[_0x5e5b('0x20')]=_0x371550;if(_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x42')]){_0xb68419[_0x5e5b('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x5e5b('0x44')](_0xb68419);})[_0x5e5b('0x27')](function(_0x46fec9){_0x12f1ee['rows']=_0x46fec9;return _0x12f1ee;})[_0x5e5b('0x27')](respondWithFilteredResult(_0x289f54,_0xb68419))[_0x5e5b('0x45')](handleError(_0x289f54,null));};exports['show']=function(_0x6672d9,_0x44b7be){var _0x5d3135={'raw':!![],'where':{'id':_0x6672d9['params']['id']}},_0x257bb7={};_0x257bb7['model']=_['keys'](db[_0x5e5b('0x41')]['rawAttributes']);_0x257bb7[_0x5e5b('0x34')]=_['keys'](_0x6672d9[_0x5e5b('0x34')]);_0x257bb7[_0x5e5b('0x36')]=_[_0x5e5b('0x37')](_0x257bb7[_0x5e5b('0x33')],_0x257bb7[_0x5e5b('0x34')]);_0x5d3135[_0x5e5b('0x38')]=_[_0x5e5b('0x37')](_0x257bb7['model'],qs['fields'](_0x6672d9[_0x5e5b('0x34')]['fields']));_0x5d3135['attributes']=_0x5d3135['attributes'][_0x5e5b('0x46')]?_0x5d3135['attributes']:_0x257bb7[_0x5e5b('0x33')];if(_0x6672d9[_0x5e5b('0x34')][_0x5e5b('0x42')]){_0x5d3135[_0x5e5b('0x43')]=[{'all':!![]}];}_0x5d3135=_[_0x5e5b('0x3f')]({},_0x5d3135,_0x6672d9[_0x5e5b('0x40')]);return db['VoiceMail'][_0x5e5b('0x47')](_0x5d3135)[_0x5e5b('0x27')](handleEntityNotFound(_0x44b7be,null))['then'](respondWithResult(_0x44b7be,null))[_0x5e5b('0x45')](handleError(_0x44b7be,null));};exports['create']=function(_0x41e4b3,_0x36d8fa){return db[_0x5e5b('0x41')][_0x5e5b('0x48')](_0x41e4b3['body'],{})[_0x5e5b('0x27')](function(_0x1c4efe){var _0x4f4ea3=_0x41e4b3[_0x5e5b('0x49')][_0x5e5b('0x29')]({'plain':!![]});if(!_0x4f4ea3)throw new Error(_0x5e5b('0x4a'));if(_0x4f4ea3[_0x5e5b('0x4b')]===_0x5e5b('0x49')){var _0x5ae8d0=_0x1c4efe['get']({'plain':!![]});var _0x690f8c=_0x5e5b('0x2a');return db['UserProfileSection'][_0x5e5b('0x47')]({'where':{'name':_0x690f8c,'userProfileId':_0x4f4ea3[_0x5e5b('0x4c')]},'raw':!![]})[_0x5e5b('0x27')](function(_0x5a9eae){if(_0x5a9eae&&_0x5a9eae[_0x5e5b('0x4d')]===0x0){return db[_0x5e5b('0x2b')][_0x5e5b('0x48')]({'name':_0x5ae8d0['name'],'resourceId':_0x5ae8d0['id'],'type':_0x5a9eae[_0x5e5b('0x2e')],'sectionId':_0x5a9eae['id']},{})[_0x5e5b('0x27')](function(){return _0x1c4efe;});}else{return _0x1c4efe;}})[_0x5e5b('0x45')](function(_0x4a4e0f){logger['error'](_0x5e5b('0x4e'),_0x4a4e0f);throw _0x4a4e0f;});}return _0x1c4efe;})['then'](respondWithResult(_0x36d8fa,0xc9))['catch'](handleError(_0x36d8fa,null));};exports[_0x5e5b('0x26')]=function(_0x13eee9,_0x4774ee){if(_0x13eee9['body']['id']){delete _0x13eee9[_0x5e5b('0x4f')]['id'];}return db[_0x5e5b('0x41')][_0x5e5b('0x47')]({'where':{'id':_0x13eee9[_0x5e5b('0x50')]['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x4774ee,null))[_0x5e5b('0x27')](saveUpdates(_0x13eee9['body'],null))['then'](respondWithResult(_0x4774ee,null))[_0x5e5b('0x45')](handleError(_0x4774ee,null));};exports[_0x5e5b('0x28')]=function(_0x1cc741,_0x357e55){return db['VoiceMail'][_0x5e5b('0x47')]({'where':{'id':_0x1cc741['params']['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x357e55,null))[_0x5e5b('0x27')](removeEntity(_0x357e55,null))[_0x5e5b('0x45')](handleError(_0x357e55,null));};exports[_0x5e5b('0x51')]=function(_0x2d17b0,_0x30b010,_0x275930){return db[_0x5e5b('0x41')]['findOne']({'where':{'id':_0x2d17b0[_0x5e5b('0x50')]['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x30b010,null))[_0x5e5b('0x27')](function(_0x1aea38){var _0x129026;var _0x5543eb={},_0x2ccee2={};_0x2ccee2[_0x5e5b('0x33')]=_[_0x5e5b('0x35')](db[_0x5e5b('0x52')][_0x5e5b('0x30')]);_0x2ccee2['query']=_[_0x5e5b('0x35')](_0x2d17b0['query']);_0x2ccee2[_0x5e5b('0x36')]=_['intersection'](_0x2ccee2[_0x5e5b('0x33')],_0x2ccee2[_0x5e5b('0x34')]);_0x5543eb[_0x5e5b('0x38')]=_[_0x5e5b('0x37')](_0x2ccee2[_0x5e5b('0x33')],qs[_0x5e5b('0x39')](_0x2d17b0['query'][_0x5e5b('0x39')]));_0x5543eb[_0x5e5b('0x38')]=_0x5543eb[_0x5e5b('0x38')][_0x5e5b('0x46')]?_0x5543eb['attributes']:_0x2ccee2['model'];if(!_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3a')]('nolimit')){_0x5543eb[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3b')](_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3b')]);_0x5543eb[_0x5e5b('0x1e')]=qs['offset'](_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x1e')]);}_0x5543eb['order']=qs['sort'](_0x2d17b0['query'][_0x5e5b('0x3c')]);_0x5543eb[_0x5e5b('0x3e')]=qs[_0x5e5b('0x36')](_[_0x5e5b('0x53')](_0x2d17b0[_0x5e5b('0x34')],_0x2ccee2['filters']));if(_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3d')]){_0x5543eb['where']=_[_0x5e5b('0x3f')](_0x5543eb['where'],{'$or':_['map'](_0x5543eb[_0x5e5b('0x38')],function(_0x4fa0db){var _0x454026={};_0x454026[_0x4fa0db]={'$like':'%'+_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3d')]+'%'};return _0x454026;})});}_0x5543eb[_0x5e5b('0x3e')]=_[_0x5e5b('0x3f')](_0x5543eb['where'],{'mailboxuser':_0x1aea38[_0x5e5b('0x54')]});_0x5543eb=_[_0x5e5b('0x3f')]({},_0x5543eb,_0x2d17b0[_0x5e5b('0x40')]);return db[_0x5e5b('0x52')][_0x5e5b('0x55')](_0x5543eb)[_0x5e5b('0x27')](respondWithFilteredResult(_0x30b010,_0x5543eb));})[_0x5e5b('0x45')](handleError(_0x30b010,null));}; \ No newline at end of file +var _0x7af2=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','getMessages','findOne','VoiceMailMessage','rawAttributes','mailbox','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','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'];(function(_0x3b2f63,_0x4b4a19){var _0x448db6=function(_0x9a6539){while(--_0x9a6539){_0x3b2f63['push'](_0x3b2f63['shift']());}};_0x448db6(++_0x4b4a19);}(_0x7af2,0x119));var _0x27af=function(_0x41ccf3,_0x94b2fc){_0x41ccf3=_0x41ccf3-0x0;var _0x5152e0=_0x7af2[_0x41ccf3];return _0x5152e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];function respondWithStatusCode(_0x49a883,_0x406340){_0x406340=_0x406340||0xcc;return function(_0x203501){if(_0x203501){return _0x49a883[_0x27af('0x17')](_0x406340);}return _0x49a883[_0x27af('0x18')](_0x406340)[_0x27af('0x19')]();};}function respondWithResult(_0x1edb50,_0x234825){_0x234825=_0x234825||0xc8;return function(_0x3da435){if(_0x3da435){return _0x1edb50[_0x27af('0x18')](_0x234825)[_0x27af('0x1a')](_0x3da435);}};}function respondWithFilteredResult(_0x30f675,_0x9c2d4b){return function(_0x2d7800){if(_0x2d7800){var _0x3102c4=typeof _0x9c2d4b[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x9c2d4b[_0x27af('0x1d')]===_0x27af('0x1c');var _0x58583a=_0x2d7800[_0x27af('0x1e')];var _0x31d702=_0x3102c4?0x0:_0x9c2d4b['offset'];var _0x4e6e2f=_0x3102c4?_0x2d7800[_0x27af('0x1e')]:_0x9c2d4b[_0x27af('0x1b')]+_0x9c2d4b[_0x27af('0x1d')];var _0x31573a;if(_0x4e6e2f>=_0x58583a){_0x4e6e2f=_0x58583a;_0x31573a=0xc8;}else{_0x31573a=0xce;}_0x30f675[_0x27af('0x18')](_0x31573a);return _0x30f675['set'](_0x27af('0x1f'),_0x31d702+'-'+_0x4e6e2f+'/'+_0x58583a)[_0x27af('0x1a')](_0x2d7800);}return null;};}function patchUpdates(_0xcb4b90){return function(_0x5e7c19){try{jsonpatch[_0x27af('0x20')](_0x5e7c19,_0xcb4b90,!![]);}catch(_0x2eec5f){return BPromise[_0x27af('0x21')](_0x2eec5f);}return _0x5e7c19['save']();};}function saveUpdates(_0x2dce2b,_0x2460f4){return function(_0x30720b){if(_0x30720b){return _0x30720b[_0x27af('0x22')](_0x2dce2b)[_0x27af('0x23')](function(_0x396156){return _0x396156;});}return null;};}function removeEntity(_0x43dd9e,_0x35b36d){return function(_0x2e1bb0){if(_0x2e1bb0){return _0x2e1bb0['destroy']()['then'](function(){var _0x4b8fe6=_0x2e1bb0[_0x27af('0x24')]({'plain':!![]});var _0x4feaf1=_0x27af('0x25');return db[_0x27af('0x26')]['destroy']({'where':{'type':_0x4feaf1,'resourceId':_0x4b8fe6['id']}})[_0x27af('0x23')](function(){return _0x2e1bb0;});})[_0x27af('0x23')](function(){_0x43dd9e[_0x27af('0x18')](0xcc)[_0x27af('0x19')]();});}};}function handleEntityNotFound(_0x39b8ee,_0x3ca40e){return function(_0x775d4e){if(!_0x775d4e){_0x39b8ee['sendStatus'](0x194);}return _0x775d4e;};}function handleError(_0x14d5fc,_0x250d5b){_0x250d5b=_0x250d5b||0x1f4;return function(_0xadd38e){logger[_0x27af('0x27')](_0xadd38e[_0x27af('0x28')]);if(_0xadd38e[_0x27af('0x29')]){delete _0xadd38e[_0x27af('0x29')];}_0x14d5fc[_0x27af('0x18')](_0x250d5b)[_0x27af('0x2a')](_0xadd38e);};}exports[_0x27af('0x2b')]=function(_0x205e41,_0x4f4955){var _0x15e867={},_0x14b2e7={},_0x3800a1={'count':0x0,'rows':[]};var _0x575887=_[_0x27af('0x2c')](db[_0x27af('0x2d')]['rawAttributes'],function(_0x51bc97){return{'name':_0x51bc97[_0x27af('0x2e')],'type':_0x51bc97[_0x27af('0x2f')]['key']};});_0x14b2e7[_0x27af('0x30')]=_[_0x27af('0x2c')](_0x575887,_0x27af('0x29'));_0x14b2e7[_0x27af('0x31')]=_[_0x27af('0x32')](_0x205e41[_0x27af('0x31')]);_0x14b2e7[_0x27af('0x33')]=_[_0x27af('0x34')](_0x14b2e7[_0x27af('0x30')],_0x14b2e7[_0x27af('0x31')]);_0x15e867[_0x27af('0x35')]=_['intersection'](_0x14b2e7['model'],qs[_0x27af('0x36')](_0x205e41[_0x27af('0x31')]['fields']));_0x15e867[_0x27af('0x35')]=_0x15e867[_0x27af('0x35')]['length']?_0x15e867[_0x27af('0x35')]:_0x14b2e7[_0x27af('0x30')];if(!_0x205e41[_0x27af('0x31')][_0x27af('0x37')](_0x27af('0x38'))){_0x15e867['limit']=qs[_0x27af('0x1d')](_0x205e41[_0x27af('0x31')]['limit']);_0x15e867['offset']=qs[_0x27af('0x1b')](_0x205e41[_0x27af('0x31')][_0x27af('0x1b')]);}_0x15e867[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x205e41[_0x27af('0x31')]['sort']);_0x15e867[_0x27af('0x3b')]=qs['filters'](_[_0x27af('0x3c')](_0x205e41[_0x27af('0x31')],_0x14b2e7[_0x27af('0x33')]),_0x575887);if(_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]){_0x15e867['where']=_[_0x27af('0x3e')](_0x15e867[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x575887,function(_0x3faebd){if(_0x3faebd[_0x27af('0x2f')]!==_0x27af('0x3f')){var _0x415d9f={};_0x415d9f[_0x3faebd[_0x27af('0x29')]]={'$like':'%'+_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x415d9f;}})});}_0x15e867=_[_0x27af('0x3e')]({},_0x15e867,_0x205e41[_0x27af('0x40')]);var _0x24ee9b={'where':_0x15e867[_0x27af('0x3b')]};return db['VoiceMail'][_0x27af('0x1e')](_0x24ee9b)[_0x27af('0x23')](function(_0x44534b){_0x3800a1[_0x27af('0x1e')]=_0x44534b;if(_0x205e41['query'][_0x27af('0x41')]){_0x15e867['include']=[{'all':!![]}];}return db['VoiceMail'][_0x27af('0x42')](_0x15e867);})[_0x27af('0x23')](function(_0x279f99){_0x3800a1[_0x27af('0x43')]=_0x279f99;return _0x3800a1;})[_0x27af('0x23')](respondWithFilteredResult(_0x4f4955,_0x15e867))[_0x27af('0x44')](handleError(_0x4f4955,null));};exports[_0x27af('0x45')]=function(_0x26eb28,_0x2269e8){var _0x100fcb={'raw':!![],'where':{'id':_0x26eb28[_0x27af('0x46')]['id']}},_0x1e3c35={};_0x1e3c35['model']=_[_0x27af('0x32')](db[_0x27af('0x2d')]['rawAttributes']);_0x1e3c35['query']=_[_0x27af('0x32')](_0x26eb28[_0x27af('0x31')]);_0x1e3c35[_0x27af('0x33')]=_[_0x27af('0x34')](_0x1e3c35[_0x27af('0x30')],_0x1e3c35['query']);_0x100fcb[_0x27af('0x35')]=_['intersection'](_0x1e3c35[_0x27af('0x30')],qs[_0x27af('0x36')](_0x26eb28[_0x27af('0x31')][_0x27af('0x36')]));_0x100fcb[_0x27af('0x35')]=_0x100fcb[_0x27af('0x35')][_0x27af('0x47')]?_0x100fcb['attributes']:_0x1e3c35['model'];if(_0x26eb28[_0x27af('0x31')]['includeAll']){_0x100fcb[_0x27af('0x48')]=[{'all':!![]}];}_0x100fcb=_[_0x27af('0x3e')]({},_0x100fcb,_0x26eb28[_0x27af('0x40')]);return db[_0x27af('0x2d')][_0x27af('0x49')](_0x100fcb)[_0x27af('0x23')](handleEntityNotFound(_0x2269e8,null))[_0x27af('0x23')](respondWithResult(_0x2269e8,null))['catch'](handleError(_0x2269e8,null));};exports[_0x27af('0x4a')]=function(_0xc7e2a8,_0x20e180){return db[_0x27af('0x2d')][_0x27af('0x4a')](_0xc7e2a8['body'],{})[_0x27af('0x23')](function(_0x25f960){var _0x28ba64=_0xc7e2a8['user']['get']({'plain':!![]});if(!_0x28ba64)throw new Error(_0x27af('0x4b'));if(_0x28ba64[_0x27af('0x4c')]===_0x27af('0x4d')){var _0x5be44f=_0x25f960['get']({'plain':!![]});var _0x2fad23='Voicemails';return db[_0x27af('0x4e')][_0x27af('0x49')]({'where':{'name':_0x2fad23,'userProfileId':_0x28ba64[_0x27af('0x4f')]},'raw':!![]})[_0x27af('0x23')](function(_0x38aa14){if(_0x38aa14&&_0x38aa14[_0x27af('0x50')]===0x0){return db[_0x27af('0x26')][_0x27af('0x4a')]({'name':_0x5be44f[_0x27af('0x29')],'resourceId':_0x5be44f['id'],'type':_0x38aa14[_0x27af('0x29')],'sectionId':_0x38aa14['id']},{})[_0x27af('0x23')](function(){return _0x25f960;});}else{return _0x25f960;}})['catch'](function(_0x76ed78){logger[_0x27af('0x27')](_0x27af('0x51'),_0x76ed78);throw _0x76ed78;});}return _0x25f960;})[_0x27af('0x23')](respondWithResult(_0x20e180,0xc9))[_0x27af('0x44')](handleError(_0x20e180,null));};exports[_0x27af('0x22')]=function(_0x20c155,_0x31eaa9){if(_0x20c155['body']['id']){delete _0x20c155[_0x27af('0x52')]['id'];}return db['VoiceMail'][_0x27af('0x49')]({'where':{'id':_0x20c155[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x31eaa9,null))['then'](saveUpdates(_0x20c155[_0x27af('0x52')],null))['then'](respondWithResult(_0x31eaa9,null))[_0x27af('0x44')](handleError(_0x31eaa9,null));};exports[_0x27af('0x53')]=function(_0x4769ff,_0x5bf8b0){return db[_0x27af('0x2d')]['find']({'where':{'id':_0x4769ff[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bf8b0,null))[_0x27af('0x23')](removeEntity(_0x5bf8b0,null))[_0x27af('0x44')](handleError(_0x5bf8b0,null));};exports[_0x27af('0x54')]=function(_0x571064,_0x4bc851,_0x5eab7d){return db[_0x27af('0x2d')][_0x27af('0x55')]({'where':{'id':_0x571064[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bc851,null))[_0x27af('0x23')](function(_0x306c56){var _0x6761d4;var _0x34c855={},_0x299f63={};_0x299f63[_0x27af('0x30')]=_['keys'](db[_0x27af('0x56')][_0x27af('0x57')]);_0x299f63[_0x27af('0x31')]=_[_0x27af('0x32')](_0x571064['query']);_0x299f63[_0x27af('0x33')]=_['intersection'](_0x299f63[_0x27af('0x30')],_0x299f63[_0x27af('0x31')]);_0x34c855['attributes']=_[_0x27af('0x34')](_0x299f63[_0x27af('0x30')],qs['fields'](_0x571064['query'][_0x27af('0x36')]));_0x34c855[_0x27af('0x35')]=_0x34c855[_0x27af('0x35')]['length']?_0x34c855[_0x27af('0x35')]:_0x299f63[_0x27af('0x30')];if(!_0x571064['query'][_0x27af('0x37')](_0x27af('0x38'))){_0x34c855['limit']=qs['limit'](_0x571064[_0x27af('0x31')][_0x27af('0x1d')]);_0x34c855['offset']=qs['offset'](_0x571064[_0x27af('0x31')][_0x27af('0x1b')]);}_0x34c855[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x571064[_0x27af('0x31')][_0x27af('0x3a')]);_0x34c855[_0x27af('0x3b')]=qs['filters'](_['pick'](_0x571064[_0x27af('0x31')],_0x299f63[_0x27af('0x33')]));if(_0x571064[_0x27af('0x31')][_0x27af('0x3d')]){_0x34c855[_0x27af('0x3b')]=_[_0x27af('0x3e')](_0x34c855[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x34c855[_0x27af('0x35')],function(_0x13c9ff){var _0x444f21={};_0x444f21[_0x13c9ff]={'$like':'%'+_0x571064[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x444f21;})});}_0x34c855[_0x27af('0x3b')]=_[_0x27af('0x3e')](_0x34c855[_0x27af('0x3b')],{'mailboxuser':_0x306c56[_0x27af('0x58')]});_0x34c855=_['merge']({},_0x34c855,_0x571064[_0x27af('0x40')]);return db[_0x27af('0x56')]['findAndCountAll'](_0x34c855)[_0x27af('0x23')](respondWithFilteredResult(_0x4bc851,_0x34c855));})[_0x27af('0x44')](handleError(_0x4bc851,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index e9942ea..55b0d19 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 _0x3ee8=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context'];(function(_0x40e4e2,_0x4ed936){var _0x1242dc=function(_0x3cabf3){while(--_0x3cabf3){_0x40e4e2['push'](_0x40e4e2['shift']());}};_0x1242dc(++_0x4ed936);}(_0x3ee8,0x14a));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x83ee('0x0'));var util=require('util');var logger=require(_0x83ee('0x1'))('api');var moment=require(_0x83ee('0x2'));var BPromise=require(_0x83ee('0x3'));var rp=require(_0x83ee('0x4'));var fs=require('fs');var path=require(_0x83ee('0x5'));var rimraf=require(_0x83ee('0x6'));var config=require(_0x83ee('0x7'));var attributes=require(_0x83ee('0x8'));module[_0x83ee('0x9')]=function(_0x9f795a,_0x15880f){return _0x9f795a[_0x83ee('0xa')](_0x83ee('0xb'),attributes,{'tableName':_0x83ee('0xc'),'paranoid':![],'indexes':[{'name':_0x83ee('0xd'),'fields':['mailbox',_0x83ee('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x48af=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2582e5,_0x442302){var _0x19fda8=function(_0x52f948){while(--_0x52f948){_0x2582e5['push'](_0x2582e5['shift']());}};_0x19fda8(++_0x442302);}(_0x48af,0xe6));var _0xf48a=function(_0x1c1913,_0x1d1b59){_0x1c1913=_0x1c1913-0x0;var _0x3b352a=_0x48af[_0x1c1913];return _0x3b352a;};'use strict';var _=require(_0xf48a('0x0'));var util=require(_0xf48a('0x1'));var logger=require(_0xf48a('0x2'))(_0xf48a('0x3'));var moment=require('moment');var BPromise=require(_0xf48a('0x4'));var rp=require(_0xf48a('0x5'));var fs=require('fs');var path=require(_0xf48a('0x6'));var rimraf=require(_0xf48a('0x7'));var config=require(_0xf48a('0x8'));var attributes=require(_0xf48a('0x9'));module[_0xf48a('0xa')]=function(_0x26910e,_0x1fb3f5){return _0x26910e[_0xf48a('0xb')](_0xf48a('0xc'),attributes,{'tableName':_0xf48a('0xd'),'paranoid':![],'indexes':[{'name':_0xf48a('0xe'),'fields':[_0xf48a('0xf'),_0xf48a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 9343177..948645b 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 _0x40fd=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1061c4,_0x4039f5){var _0xd25154=function(_0x911022){while(--_0x911022){_0x1061c4['push'](_0x1061c4['shift']());}};_0xd25154(++_0x4039f5);}(_0x40fd,0x103));var _0xd40f=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0x40fd[_0x2af053];return _0x4b4001;};'use strict';var _=require(_0xd40f('0x0'));var util=require(_0xd40f('0x1'));var moment=require('moment');var BPromise=require(_0xd40f('0x2'));var rs=require(_0xd40f('0x3'));var fs=require('fs');var Redis=require(_0xd40f('0x4'));var db=require(_0xd40f('0x5'))['db'];var utils=require(_0xd40f('0x6'));var logger=require('../../config/logger')(_0xd40f('0x7'));var config=require('../../config/environment');var jayson=require(_0xd40f('0x8'));var client=jayson[_0xd40f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f4b77,_0x50d7f8,_0x30e85d){return new BPromise(function(_0x18642e,_0x3af68d){return client[_0xd40f('0xa')](_0x2f4b77,_0x30e85d)[_0xd40f('0xb')](function(_0x31a155){logger[_0xd40f('0xc')]('VoiceMail,\x20%s,\x20%s',_0x50d7f8,_0xd40f('0xd'));logger[_0xd40f('0xe')](_0xd40f('0xf'),_0x50d7f8,_0xd40f('0xd'),JSON[_0xd40f('0x10')](_0x31a155));if(_0x31a155[_0xd40f('0x11')]){if(_0x31a155[_0xd40f('0x11')][_0xd40f('0x12')]===0x1f4){logger['error'](_0xd40f('0x13'),_0x50d7f8,_0x31a155[_0xd40f('0x11')]['message']);return _0x3af68d(_0x31a155['error']['message']);}logger['error'](_0xd40f('0x13'),_0x50d7f8,_0x31a155['error'][_0xd40f('0x14')]);return _0x18642e(_0x31a155['error']['message']);}else{logger[_0xd40f('0xc')]('VoiceMail,\x20%s,\x20%s',_0x50d7f8,_0xd40f('0xd'));_0x18642e(_0x31a155[_0xd40f('0x15')]['message']);}})['catch'](function(_0x18f6c4){logger[_0xd40f('0x11')](_0xd40f('0x13'),_0x50d7f8,_0x18f6c4);_0x3af68d(_0x18f6c4);});});} \ No newline at end of file +var _0x5ded=['then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ded,0x7f));var _0xd5de=function(_0x2b0bb4,_0x19adb6){_0x2b0bb4=_0x2b0bb4-0x0;var _0x262b70=_0x5ded[_0x2b0bb4];return _0x262b70;};'use strict';var _=require(_0xd5de('0x0'));var util=require('util');var moment=require(_0xd5de('0x1'));var BPromise=require(_0xd5de('0x2'));var rs=require(_0xd5de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd5de('0x4'));var logger=require(_0xd5de('0x5'))(_0xd5de('0x6'));var config=require('../../config/environment');var jayson=require(_0xd5de('0x7'));var client=jayson[_0xd5de('0x8')][_0xd5de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50bf89,_0x45c297,_0x468f07){return new BPromise(function(_0x25c4ba,_0x4e9244){return client[_0xd5de('0xa')](_0x50bf89,_0x468f07)[_0xd5de('0xb')](function(_0xf966c1){logger[_0xd5de('0xc')]('VoiceMail,\x20%s,\x20%s',_0x45c297,'request\x20sent');logger[_0xd5de('0xd')](_0xd5de('0xe'),_0x45c297,_0xd5de('0xf'),JSON[_0xd5de('0x10')](_0xf966c1));if(_0xf966c1[_0xd5de('0x11')]){if(_0xf966c1[_0xd5de('0x11')][_0xd5de('0x12')]===0x1f4){logger['error'](_0xd5de('0x13'),_0x45c297,_0xf966c1[_0xd5de('0x11')][_0xd5de('0x14')]);return _0x4e9244(_0xf966c1[_0xd5de('0x11')][_0xd5de('0x14')]);}logger[_0xd5de('0x11')](_0xd5de('0x13'),_0x45c297,_0xf966c1['error'][_0xd5de('0x14')]);return _0x25c4ba(_0xf966c1['error'][_0xd5de('0x14')]);}else{logger[_0xd5de('0xc')](_0xd5de('0x13'),_0x45c297,_0xd5de('0xf'));_0x25c4ba(_0xf966c1[_0xd5de('0x15')][_0xd5de('0x14')]);}})[_0xd5de('0x16')](function(_0x3cfbfc){logger[_0xd5de('0x11')](_0xd5de('0x13'),_0x45c297,_0x3cfbfc);_0x4e9244(_0x3cfbfc);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f31fec7..7554e0a 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 _0xcf7d=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xcf7d,0xdf));var _0xdcf7=function(_0x46fda1,_0x2af91e){_0x46fda1=_0x46fda1-0x0;var _0x45254e=_0xcf7d[_0x46fda1];return _0x45254e;};'use strict';var multer=require(_0xdcf7('0x0'));var util=require(_0xdcf7('0x1'));var path=require(_0xdcf7('0x2'));var timeout=require(_0xdcf7('0x3'));var express=require(_0xdcf7('0x4'));var router=express[_0xdcf7('0x5')]();var fs_extra=require(_0xdcf7('0x6'));var auth=require(_0xdcf7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdcf7('0x8'));var controller=require(_0xdcf7('0x9'));router[_0xdcf7('0xa')]('/',auth[_0xdcf7('0xb')](),controller[_0xdcf7('0xc')]);router['get']('/:id',auth[_0xdcf7('0xb')](),controller[_0xdcf7('0xd')]);router[_0xdcf7('0xa')](_0xdcf7('0xe'),auth[_0xdcf7('0xb')](),controller[_0xdcf7('0xf')]);router[_0xdcf7('0x10')]('/',auth[_0xdcf7('0xb')](),controller[_0xdcf7('0x11')]);router['put'](_0xdcf7('0x12'),auth[_0xdcf7('0xb')](),controller[_0xdcf7('0x13')]);router['delete'](_0xdcf7('0x12'),auth[_0xdcf7('0xb')](),controller[_0xdcf7('0x14')]);module[_0xdcf7('0x15')]=router; \ No newline at end of file +var _0x521d=['/:id','show','/:id/download','download','create','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get'];(function(_0x282999,_0x4df660){var _0x30681f=function(_0x50e926){while(--_0x50e926){_0x282999['push'](_0x282999['shift']());}};_0x30681f(++_0x4df660);}(_0x521d,0x198));var _0xd521=function(_0x24f703,_0x1ecf70){_0x24f703=_0x24f703-0x0;var _0x359158=_0x521d[_0x24f703];return _0x359158;};'use strict';var multer=require(_0xd521('0x0'));var util=require(_0xd521('0x1'));var path=require(_0xd521('0x2'));var timeout=require(_0xd521('0x3'));var express=require(_0xd521('0x4'));var router=express['Router']();var fs_extra=require(_0xd521('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd521('0x6'));var config=require(_0xd521('0x7'));var controller=require(_0xd521('0x8'));router['get']('/',auth[_0xd521('0x9')](),controller[_0xd521('0xa')]);router[_0xd521('0xb')](_0xd521('0xc'),auth[_0xd521('0x9')](),controller[_0xd521('0xd')]);router[_0xd521('0xb')](_0xd521('0xe'),auth[_0xd521('0x9')](),controller[_0xd521('0xf')]);router['post']('/',auth[_0xd521('0x9')](),controller[_0xd521('0x10')]);router['put'](_0xd521('0xc'),auth[_0xd521('0x9')](),controller[_0xd521('0x11')]);router[_0xd521('0x12')](_0xd521('0xc'),auth[_0xd521('0x9')](),controller['destroy']);module[_0xd521('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 3430438..c1b3c34 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 _0xddcb=['STRING','BLOB','long','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xddcb,0x193));var _0xbddc=function(_0x1baae7,_0x57f8f3){_0x1baae7=_0x1baae7-0x0;var _0x3ddc1e=_0xddcb[_0x1baae7];return _0x3ddc1e;};'use strict';var Sequelize=require(_0xbddc('0x0'));module[_0xbddc('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x19a6c5){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xbddc('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xbddc('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xbddc('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xbddc('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xbddc('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xbddc('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xbddc('0x4')](_0xbddc('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xbddc('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0xbddc('0x6'))}}; \ No newline at end of file +var _0xfc82=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xfc82,0x1c3));var _0x2fc8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfc82[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x2fc8('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x469aa6){return this[_0x2fc8('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x2fc8('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x2fc8('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x2fc8('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x2fc8('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x2fc8('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x2fc8('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x2fc8('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x2fc8('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x2fc8('0x4')](_0x2fc8('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x2fc8('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x2fc8('0x3')],'defaultValue':''},'stamp':{'type':_0x2fc8('0x6'),'defaultValue':Sequelize[_0x2fc8('0x7')](_0x2fc8('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 75485a0..cbcd348 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 _0xb0e6=['Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','VoiceMailMessage','rows','catch','show','params','intersection','find','create','body','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set'];(function(_0x2787ba,_0x21b7c2){var _0x46e5ec=function(_0x32529f){while(--_0x32529f){_0x2787ba['push'](_0x2787ba['shift']());}};_0x46e5ec(++_0x21b7c2);}(_0xb0e6,0x1ee));var _0x6b0e=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xb0e6[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0x6b0e('0x0'));var rimraf=require(_0x6b0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b0e('0x2'));var rp=require(_0x6b0e('0x3'));var moment=require('moment');var BPromise=require(_0x6b0e('0x4'));var Mustache=require(_0x6b0e('0x5'));var util=require(_0x6b0e('0x6'));var path=require(_0x6b0e('0x7'));var sox=require(_0x6b0e('0x8'));var csv=require(_0x6b0e('0x9'));var ejs=require(_0x6b0e('0xa'));var fs=require('fs');var fs_extra=require(_0x6b0e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b0e('0xc'));var jsforce=require(_0x6b0e('0xd'));var deskjs=require(_0x6b0e('0xe'));var toCsv=require(_0x6b0e('0x9'));var querystring=require(_0x6b0e('0xf'));var Papa=require(_0x6b0e('0x10'));var Redis=require(_0x6b0e('0x11'));var authService=require(_0x6b0e('0x12'));var qs=require(_0x6b0e('0x13'));var as=require(_0x6b0e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b0e('0x15'))(_0x6b0e('0x16'));var utils=require('../../config/utils');var config=require(_0x6b0e('0x17'));var licenseUtil=require(_0x6b0e('0x18'));var db=require(_0x6b0e('0x19'))['db'];function respondWithStatusCode(_0x1eeb96,_0x242c7e){_0x242c7e=_0x242c7e||0xcc;return function(_0x48ce1e){if(_0x48ce1e){return _0x1eeb96[_0x6b0e('0x1a')](_0x242c7e);}return _0x1eeb96[_0x6b0e('0x1b')](_0x242c7e)[_0x6b0e('0x1c')]();};}function respondWithResult(_0x5d68f5,_0x175cb4){_0x175cb4=_0x175cb4||0xc8;return function(_0x2124f9){if(_0x2124f9){return _0x5d68f5[_0x6b0e('0x1b')](_0x175cb4)[_0x6b0e('0x1d')](_0x2124f9);}};}function respondWithFilteredResult(_0x4aaf3f,_0x2230e9){return function(_0x2ce156){if(_0x2ce156){var _0xc12596=typeof _0x2230e9[_0x6b0e('0x1e')]===_0x6b0e('0x1f')&&typeof _0x2230e9[_0x6b0e('0x20')]===_0x6b0e('0x1f');var _0x5b4f13=_0x2ce156['count'];var _0x111f07=_0xc12596?0x0:_0x2230e9['offset'];var _0x543d2e=_0xc12596?_0x2ce156['count']:_0x2230e9[_0x6b0e('0x1e')]+_0x2230e9[_0x6b0e('0x20')];var _0x3de1dd;if(_0x543d2e>=_0x5b4f13){_0x543d2e=_0x5b4f13;_0x3de1dd=0xc8;}else{_0x3de1dd=0xce;}_0x4aaf3f['status'](_0x3de1dd);return _0x4aaf3f[_0x6b0e('0x21')](_0x6b0e('0x22'),_0x111f07+'-'+_0x543d2e+'/'+_0x5b4f13)[_0x6b0e('0x1d')](_0x2ce156);}return null;};}function patchUpdates(_0x1ce428){return function(_0x5290f0){try{jsonpatch['apply'](_0x5290f0,_0x1ce428,!![]);}catch(_0x351478){return BPromise[_0x6b0e('0x23')](_0x351478);}return _0x5290f0[_0x6b0e('0x24')]();};}function saveUpdates(_0x2d8512,_0xea210){return function(_0x164c34){if(_0x164c34){return _0x164c34[_0x6b0e('0x25')](_0x2d8512)[_0x6b0e('0x26')](function(_0x3ebf1e){return _0x3ebf1e;});}return null;};}function removeEntity(_0x46c450,_0x428a37){return function(_0x4ba25e){if(_0x4ba25e){return _0x4ba25e[_0x6b0e('0x27')]()[_0x6b0e('0x26')](function(){_0x46c450[_0x6b0e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x190ff0,_0x533bc8){return function(_0x373502){if(!_0x373502){_0x190ff0[_0x6b0e('0x1a')](0x194);}return _0x373502;};}function handleError(_0x52ac40,_0x1a8389){_0x1a8389=_0x1a8389||0x1f4;return function(_0x1f9d56){logger[_0x6b0e('0x28')](_0x1f9d56[_0x6b0e('0x29')]);if(_0x1f9d56['name']){delete _0x1f9d56[_0x6b0e('0x2a')];}_0x52ac40['status'](_0x1a8389)['send'](_0x1f9d56);};}exports[_0x6b0e('0x2b')]=function(_0x382214,_0x19f060){var _0x530c03={},_0x337533={},_0x2dc146={'count':0x0,'rows':[]};var _0x5d5eae=_[_0x6b0e('0x2c')](db['VoiceMailMessage'][_0x6b0e('0x2d')],function(_0x2ff950){return{'name':_0x2ff950[_0x6b0e('0x2e')],'type':_0x2ff950['type'][_0x6b0e('0x2f')]};});_0x337533[_0x6b0e('0x30')]=_[_0x6b0e('0x31')](_[_0x6b0e('0x2c')](_0x5d5eae,_0x6b0e('0x2a')),[_0x6b0e('0x2a')]);_0x337533[_0x6b0e('0x32')]=_[_0x6b0e('0x33')](_0x382214[_0x6b0e('0x32')]);_0x337533[_0x6b0e('0x34')]=_['intersection'](_0x337533['model'],_0x337533[_0x6b0e('0x32')]);_0x530c03[_0x6b0e('0x35')]=_['intersection'](_0x337533[_0x6b0e('0x30')],qs[_0x6b0e('0x36')](_0x382214[_0x6b0e('0x32')][_0x6b0e('0x36')]));_0x530c03[_0x6b0e('0x35')]=_0x530c03['attributes'][_0x6b0e('0x37')]?_0x530c03[_0x6b0e('0x35')]:_0x337533[_0x6b0e('0x30')];if(!_0x382214[_0x6b0e('0x32')][_0x6b0e('0x38')](_0x6b0e('0x39'))){_0x530c03[_0x6b0e('0x20')]=qs[_0x6b0e('0x20')](_0x382214[_0x6b0e('0x32')][_0x6b0e('0x20')]);_0x530c03[_0x6b0e('0x1e')]=qs['offset'](_0x382214['query'][_0x6b0e('0x1e')]);}_0x530c03[_0x6b0e('0x3a')]=qs['sort'](_0x382214['query']['sort']);_0x530c03[_0x6b0e('0x3b')]=qs['filters'](_['pick'](_0x382214[_0x6b0e('0x32')],_0x337533['filters']),_0x5d5eae);if(_0x382214[_0x6b0e('0x32')][_0x6b0e('0x3c')]){_0x530c03[_0x6b0e('0x3b')]=_[_0x6b0e('0x3d')](_0x530c03[_0x6b0e('0x3b')],{'$or':_['map'](_0x5d5eae,function(_0xe7d7c2){if(_0xe7d7c2[_0x6b0e('0x3e')]!==_0x6b0e('0x3f')){var _0x24a396={};_0x24a396[_0xe7d7c2[_0x6b0e('0x2a')]]={'$like':'%'+_0x382214[_0x6b0e('0x32')][_0x6b0e('0x3c')]+'%'};return _0x24a396;}})});}_0x530c03=_[_0x6b0e('0x3d')]({},_0x530c03,_0x382214[_0x6b0e('0x40')]);var _0x25ee49={'where':_0x530c03[_0x6b0e('0x3b')]};return db['VoiceMailMessage'][_0x6b0e('0x41')](_0x25ee49)[_0x6b0e('0x26')](function(_0x3f3719){_0x2dc146['count']=_0x3f3719;if(_0x382214[_0x6b0e('0x32')][_0x6b0e('0x42')]){_0x530c03[_0x6b0e('0x43')]=[{'all':!![]}];}return db[_0x6b0e('0x44')]['findAll'](_0x530c03);})[_0x6b0e('0x26')](function(_0x496c53){_0x2dc146[_0x6b0e('0x45')]=_0x496c53;return _0x2dc146;})[_0x6b0e('0x26')](respondWithFilteredResult(_0x19f060,_0x530c03))[_0x6b0e('0x46')](handleError(_0x19f060,null));};exports[_0x6b0e('0x47')]=function(_0x3773c2,_0x408a6f){var _0x1dd4f9={'raw':!![],'where':{'id':_0x3773c2[_0x6b0e('0x48')]['id']}},_0x5a1221={};_0x5a1221[_0x6b0e('0x30')]=_[_0x6b0e('0x33')](db[_0x6b0e('0x44')][_0x6b0e('0x2d')]);_0x5a1221['query']=_[_0x6b0e('0x33')](_0x3773c2[_0x6b0e('0x32')]);_0x5a1221[_0x6b0e('0x34')]=_[_0x6b0e('0x49')](_0x5a1221['model'],_0x5a1221[_0x6b0e('0x32')]);_0x1dd4f9[_0x6b0e('0x35')]=_[_0x6b0e('0x49')](_0x5a1221[_0x6b0e('0x30')],qs[_0x6b0e('0x36')](_0x3773c2['query'][_0x6b0e('0x36')]));_0x1dd4f9[_0x6b0e('0x35')]=_0x1dd4f9[_0x6b0e('0x35')][_0x6b0e('0x37')]?_0x1dd4f9['attributes']:_0x5a1221['model'];if(_0x3773c2[_0x6b0e('0x32')][_0x6b0e('0x42')]){_0x1dd4f9[_0x6b0e('0x43')]=[{'all':!![]}];}_0x1dd4f9=_[_0x6b0e('0x3d')]({},_0x1dd4f9,_0x3773c2[_0x6b0e('0x40')]);return db['VoiceMailMessage'][_0x6b0e('0x4a')](_0x1dd4f9)[_0x6b0e('0x26')](handleEntityNotFound(_0x408a6f,null))[_0x6b0e('0x26')](respondWithResult(_0x408a6f,null))[_0x6b0e('0x46')](handleError(_0x408a6f,null));};exports[_0x6b0e('0x4b')]=function(_0x251908,_0x1f1589){return db['VoiceMailMessage']['create'](_0x251908[_0x6b0e('0x4c')],{})[_0x6b0e('0x26')](respondWithResult(_0x1f1589,0xc9))['catch'](handleError(_0x1f1589,null));};exports[_0x6b0e('0x25')]=function(_0x30358d,_0x630fef){if(_0x30358d['body']['id']){delete _0x30358d['body']['id'];}return db['VoiceMailMessage'][_0x6b0e('0x4a')]({'where':{'id':_0x30358d[_0x6b0e('0x48')]['id']}})[_0x6b0e('0x26')](handleEntityNotFound(_0x630fef,null))[_0x6b0e('0x26')](saveUpdates(_0x30358d['body'],null))[_0x6b0e('0x26')](respondWithResult(_0x630fef,null))[_0x6b0e('0x46')](handleError(_0x630fef,null));};exports[_0x6b0e('0x27')]=function(_0x4185c9,_0x5721f1){return db['VoiceMailMessage'][_0x6b0e('0x4a')]({'where':{'id':_0x4185c9['params']['id']}})[_0x6b0e('0x26')](handleEntityNotFound(_0x5721f1,null))['then'](removeEntity(_0x5721f1,null))[_0x6b0e('0x46')](handleError(_0x5721f1,null));};exports[_0x6b0e('0x4d')]=function(_0x14bafb,_0x15c091,_0x20ad3c){return db[_0x6b0e('0x44')]['find']({'where':{'id':_0x14bafb[_0x6b0e('0x48')]['id']},'attributes':['id','recording',_0x6b0e('0x4e')]})[_0x6b0e('0x26')](handleEntityNotFound(_0x15c091,null))[_0x6b0e('0x26')](function(_0x44749d){if(_0x44749d){if(!_0x44749d[_0x6b0e('0x4f')]){throw new db[(_0x6b0e('0x50'))][(_0x6b0e('0x51'))](_0x6b0e('0x52'));}var _0x1fa0c={'Content-Type':_0x6b0e('0x53'),'Content-Disposition':_0x6b0e('0x54')};if(_0x44749d[_0x6b0e('0x4e')]){_0x1fa0c[_0x6b0e('0x55')]=_0x6b0e('0x56')+_0x44749d[_0x6b0e('0x4e')]+_0x6b0e('0x57');}_0x15c091['set'](_0x1fa0c);return _0x15c091['send'](new Buffer(_0x44749d[_0x6b0e('0x4f')]));}})[_0x6b0e('0x46')](handleError(_0x15c091,null));}; \ No newline at end of file +var _0x3f53=['where','merge','options','include','rows','catch','show','params','includeAll','create','body','find','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','index','VoiceMailMessage','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort'];(function(_0xf3cb83,_0x57bf9e){var _0x44acc3=function(_0x52377c){while(--_0x52377c){_0xf3cb83['push'](_0xf3cb83['shift']());}};_0x44acc3(++_0x57bf9e);}(_0x3f53,0x68));var _0x33f5=function(_0x1fd56f,_0x1dcc57){_0x1fd56f=_0x1fd56f-0x0;var _0x30bdba=_0x3f53[_0x1fd56f];return _0x30bdba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x33f5('0x0'));var zipdir=require(_0x33f5('0x1'));var jsonpatch=require(_0x33f5('0x2'));var rp=require(_0x33f5('0x3'));var moment=require(_0x33f5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x33f5('0x5'));var util=require(_0x33f5('0x6'));var path=require(_0x33f5('0x7'));var sox=require(_0x33f5('0x8'));var csv=require('to-csv');var ejs=require(_0x33f5('0x9'));var fs=require('fs');var fs_extra=require(_0x33f5('0xa'));var _=require(_0x33f5('0xb'));var squel=require('squel');var crypto=require(_0x33f5('0xc'));var jsforce=require(_0x33f5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x33f5('0xe'));var querystring=require('querystring');var Papa=require(_0x33f5('0xf'));var Redis=require(_0x33f5('0x10'));var authService=require(_0x33f5('0x11'));var qs=require(_0x33f5('0x12'));var as=require(_0x33f5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33f5('0x14'))(_0x33f5('0x15'));var utils=require('../../config/utils');var config=require(_0x33f5('0x16'));var licenseUtil=require(_0x33f5('0x17'));var db=require(_0x33f5('0x18'))['db'];function respondWithStatusCode(_0x5afedc,_0x4c13af){_0x4c13af=_0x4c13af||0xcc;return function(_0x5e8435){if(_0x5e8435){return _0x5afedc[_0x33f5('0x19')](_0x4c13af);}return _0x5afedc[_0x33f5('0x1a')](_0x4c13af)[_0x33f5('0x1b')]();};}function respondWithResult(_0x1d8c2b,_0xd44f4d){_0xd44f4d=_0xd44f4d||0xc8;return function(_0x550cd5){if(_0x550cd5){return _0x1d8c2b[_0x33f5('0x1a')](_0xd44f4d)[_0x33f5('0x1c')](_0x550cd5);}};}function respondWithFilteredResult(_0x4e568a,_0x258922){return function(_0x1141ca){if(_0x1141ca){var _0x130f3c=typeof _0x258922[_0x33f5('0x1d')]===_0x33f5('0x1e')&&typeof _0x258922[_0x33f5('0x1f')]===_0x33f5('0x1e');var _0x4148f1=_0x1141ca['count'];var _0x3317b1=_0x130f3c?0x0:_0x258922['offset'];var _0x19fb93=_0x130f3c?_0x1141ca[_0x33f5('0x20')]:_0x258922[_0x33f5('0x1d')]+_0x258922[_0x33f5('0x1f')];var _0x519364;if(_0x19fb93>=_0x4148f1){_0x19fb93=_0x4148f1;_0x519364=0xc8;}else{_0x519364=0xce;}_0x4e568a[_0x33f5('0x1a')](_0x519364);return _0x4e568a['set'](_0x33f5('0x21'),_0x3317b1+'-'+_0x19fb93+'/'+_0x4148f1)[_0x33f5('0x1c')](_0x1141ca);}return null;};}function patchUpdates(_0x53ff7a){return function(_0x66af27){try{jsonpatch[_0x33f5('0x22')](_0x66af27,_0x53ff7a,!![]);}catch(_0x208e2e){return BPromise[_0x33f5('0x23')](_0x208e2e);}return _0x66af27['save']();};}function saveUpdates(_0xca8a4,_0x2eb7c5){return function(_0x20dc60){if(_0x20dc60){return _0x20dc60[_0x33f5('0x24')](_0xca8a4)[_0x33f5('0x25')](function(_0x17d0bf){return _0x17d0bf;});}return null;};}function removeEntity(_0x5c452c,_0x5a7e8c){return function(_0x4dec9d){if(_0x4dec9d){return _0x4dec9d[_0x33f5('0x26')]()[_0x33f5('0x25')](function(){_0x5c452c[_0x33f5('0x1a')](0xcc)[_0x33f5('0x1b')]();});}};}function handleEntityNotFound(_0xf60780,_0x35272d){return function(_0x3cc8d9){if(!_0x3cc8d9){_0xf60780[_0x33f5('0x19')](0x194);}return _0x3cc8d9;};}function handleError(_0x1dc955,_0x15ece9){_0x15ece9=_0x15ece9||0x1f4;return function(_0x1c898c){logger[_0x33f5('0x27')](_0x1c898c['stack']);if(_0x1c898c[_0x33f5('0x28')]){delete _0x1c898c[_0x33f5('0x28')];}_0x1dc955[_0x33f5('0x1a')](_0x15ece9)['send'](_0x1c898c);};}exports[_0x33f5('0x29')]=function(_0x3f5b01,_0x32cf47){var _0x3e468d={},_0x497bf9={},_0x2a87db={'count':0x0,'rows':[]};var _0x4c6912=_['map'](db[_0x33f5('0x2a')][_0x33f5('0x2b')],function(_0x315fb2){return{'name':_0x315fb2['fieldName'],'type':_0x315fb2[_0x33f5('0x2c')][_0x33f5('0x2d')]};});_0x497bf9[_0x33f5('0x2e')]=_['differenceBy'](_[_0x33f5('0x2f')](_0x4c6912,'name'),[_0x33f5('0x28')]);_0x497bf9['query']=_[_0x33f5('0x30')](_0x3f5b01[_0x33f5('0x31')]);_0x497bf9[_0x33f5('0x32')]=_[_0x33f5('0x33')](_0x497bf9[_0x33f5('0x2e')],_0x497bf9['query']);_0x3e468d['attributes']=_['intersection'](_0x497bf9[_0x33f5('0x2e')],qs['fields'](_0x3f5b01['query'][_0x33f5('0x34')]));_0x3e468d[_0x33f5('0x35')]=_0x3e468d[_0x33f5('0x35')]['length']?_0x3e468d[_0x33f5('0x35')]:_0x497bf9[_0x33f5('0x2e')];if(!_0x3f5b01[_0x33f5('0x31')][_0x33f5('0x36')](_0x33f5('0x37'))){_0x3e468d[_0x33f5('0x1f')]=qs['limit'](_0x3f5b01[_0x33f5('0x31')][_0x33f5('0x1f')]);_0x3e468d[_0x33f5('0x1d')]=qs[_0x33f5('0x1d')](_0x3f5b01['query']['offset']);}_0x3e468d[_0x33f5('0x38')]=qs['sort'](_0x3f5b01[_0x33f5('0x31')][_0x33f5('0x39')]);_0x3e468d[_0x33f5('0x3a')]=qs[_0x33f5('0x32')](_['pick'](_0x3f5b01[_0x33f5('0x31')],_0x497bf9['filters']),_0x4c6912);if(_0x3f5b01[_0x33f5('0x31')]['filter']){_0x3e468d['where']=_[_0x33f5('0x3b')](_0x3e468d['where'],{'$or':_[_0x33f5('0x2f')](_0x4c6912,function(_0x25295b){if(_0x25295b[_0x33f5('0x2c')]!=='VIRTUAL'){var _0x278e14={};_0x278e14[_0x25295b[_0x33f5('0x28')]]={'$like':'%'+_0x3f5b01['query']['filter']+'%'};return _0x278e14;}})});}_0x3e468d=_[_0x33f5('0x3b')]({},_0x3e468d,_0x3f5b01[_0x33f5('0x3c')]);var _0x45f83e={'where':_0x3e468d[_0x33f5('0x3a')]};return db[_0x33f5('0x2a')][_0x33f5('0x20')](_0x45f83e)[_0x33f5('0x25')](function(_0x20a6a7){_0x2a87db[_0x33f5('0x20')]=_0x20a6a7;if(_0x3f5b01['query']['includeAll']){_0x3e468d[_0x33f5('0x3d')]=[{'all':!![]}];}return db[_0x33f5('0x2a')]['findAll'](_0x3e468d);})[_0x33f5('0x25')](function(_0x320f7d){_0x2a87db[_0x33f5('0x3e')]=_0x320f7d;return _0x2a87db;})[_0x33f5('0x25')](respondWithFilteredResult(_0x32cf47,_0x3e468d))[_0x33f5('0x3f')](handleError(_0x32cf47,null));};exports[_0x33f5('0x40')]=function(_0x187126,_0x37f988){var _0x19e786={'raw':!![],'where':{'id':_0x187126[_0x33f5('0x41')]['id']}},_0x1d3401={};_0x1d3401['model']=_['keys'](db[_0x33f5('0x2a')]['rawAttributes']);_0x1d3401[_0x33f5('0x31')]=_[_0x33f5('0x30')](_0x187126[_0x33f5('0x31')]);_0x1d3401['filters']=_[_0x33f5('0x33')](_0x1d3401[_0x33f5('0x2e')],_0x1d3401[_0x33f5('0x31')]);_0x19e786[_0x33f5('0x35')]=_[_0x33f5('0x33')](_0x1d3401[_0x33f5('0x2e')],qs[_0x33f5('0x34')](_0x187126['query'][_0x33f5('0x34')]));_0x19e786[_0x33f5('0x35')]=_0x19e786[_0x33f5('0x35')]['length']?_0x19e786[_0x33f5('0x35')]:_0x1d3401[_0x33f5('0x2e')];if(_0x187126[_0x33f5('0x31')][_0x33f5('0x42')]){_0x19e786[_0x33f5('0x3d')]=[{'all':!![]}];}_0x19e786=_[_0x33f5('0x3b')]({},_0x19e786,_0x187126[_0x33f5('0x3c')]);return db[_0x33f5('0x2a')]['find'](_0x19e786)[_0x33f5('0x25')](handleEntityNotFound(_0x37f988,null))['then'](respondWithResult(_0x37f988,null))[_0x33f5('0x3f')](handleError(_0x37f988,null));};exports[_0x33f5('0x43')]=function(_0x58ca1f,_0x15e3d6){return db[_0x33f5('0x2a')][_0x33f5('0x43')](_0x58ca1f[_0x33f5('0x44')],{})[_0x33f5('0x25')](respondWithResult(_0x15e3d6,0xc9))[_0x33f5('0x3f')](handleError(_0x15e3d6,null));};exports['update']=function(_0x474d0c,_0x330cf7){if(_0x474d0c[_0x33f5('0x44')]['id']){delete _0x474d0c[_0x33f5('0x44')]['id'];}return db['VoiceMailMessage'][_0x33f5('0x45')]({'where':{'id':_0x474d0c[_0x33f5('0x41')]['id']}})['then'](handleEntityNotFound(_0x330cf7,null))[_0x33f5('0x25')](saveUpdates(_0x474d0c[_0x33f5('0x44')],null))['then'](respondWithResult(_0x330cf7,null))[_0x33f5('0x3f')](handleError(_0x330cf7,null));};exports[_0x33f5('0x26')]=function(_0x1a2586,_0x4563f9){return db['VoiceMailMessage'][_0x33f5('0x45')]({'where':{'id':_0x1a2586['params']['id']}})[_0x33f5('0x25')](handleEntityNotFound(_0x4563f9,null))[_0x33f5('0x25')](removeEntity(_0x4563f9,null))[_0x33f5('0x3f')](handleError(_0x4563f9,null));};exports[_0x33f5('0x46')]=function(_0x48d4ac,_0x28e2e5,_0x1b3660){return db['VoiceMailMessage'][_0x33f5('0x45')]({'where':{'id':_0x48d4ac[_0x33f5('0x41')]['id']},'attributes':['id',_0x33f5('0x47'),'msg_id']})[_0x33f5('0x25')](handleEntityNotFound(_0x28e2e5,null))['then'](function(_0x397f75){if(_0x397f75){if(!_0x397f75['recording']){throw new db[(_0x33f5('0x48'))][(_0x33f5('0x49'))](_0x33f5('0x4a'));}var _0x138400={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x397f75[_0x33f5('0x4b')]){_0x138400[_0x33f5('0x4c')]=_0x33f5('0x4d')+_0x397f75[_0x33f5('0x4b')]+_0x33f5('0x4e');}_0x28e2e5[_0x33f5('0x4f')](_0x138400);return _0x28e2e5[_0x33f5('0x50')](new Buffer(_0x397f75[_0x33f5('0x47')]));}})[_0x33f5('0x3f')](handleError(_0x28e2e5,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 19bcd55..766f1ce 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 _0xcd9f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','lodash','../../config/logger','api'];(function(_0x4f9352,_0x40ce43){var _0xbc9624=function(_0x12cd73){while(--_0x12cd73){_0x4f9352['push'](_0x4f9352['shift']());}};_0xbc9624(++_0x40ce43);}(_0xcd9f,0x11b));var _0xfcd9=function(_0xb893ef,_0x4cf0a5){_0xb893ef=_0xb893ef-0x0;var _0x1bc015=_0xcd9f[_0xb893ef];return _0x1bc015;};'use strict';var _=require(_0xfcd9('0x0'));var util=require('util');var logger=require(_0xfcd9('0x1'))(_0xfcd9('0x2'));var moment=require(_0xfcd9('0x3'));var BPromise=require(_0xfcd9('0x4'));var rp=require(_0xfcd9('0x5'));var fs=require('fs');var path=require(_0xfcd9('0x6'));var rimraf=require(_0xfcd9('0x7'));var config=require(_0xfcd9('0x8'));var attributes=require(_0xfcd9('0x9'));module['exports']=function(_0x2b6708,_0x5a4942){return _0x2b6708[_0xfcd9('0xa')]('VoiceMailMessage',attributes,{'tableName':_0xfcd9('0xb'),'paranoid':![],'indexes':[{'name':_0xfcd9('0xc'),'fields':[_0xfcd9('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xe41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe41a,0x83));var _0xae41=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xe41a[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xae41('0x0'));var util=require(_0xae41('0x1'));var logger=require(_0xae41('0x2'))(_0xae41('0x3'));var moment=require(_0xae41('0x4'));var BPromise=require(_0xae41('0x5'));var rp=require(_0xae41('0x6'));var fs=require('fs');var path=require(_0xae41('0x7'));var rimraf=require(_0xae41('0x8'));var config=require(_0xae41('0x9'));var attributes=require(_0xae41('0xa'));module[_0xae41('0xb')]=function(_0x3e84f2,_0x81352d){return _0x3e84f2[_0xae41('0xc')](_0xae41('0xd'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0xae41('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index ac0607c..dccd4e8 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 _0x7aaf=['then','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x7aaf,0x75));var _0xf7aa=function(_0x201aca,_0x596130){_0x201aca=_0x201aca-0x0;var _0x336800=_0x7aaf[_0x201aca];return _0x336800;};'use strict';var _=require(_0xf7aa('0x0'));var util=require('util');var moment=require(_0xf7aa('0x1'));var BPromise=require('bluebird');var rs=require(_0xf7aa('0x2'));var fs=require('fs');var Redis=require(_0xf7aa('0x3'));var db=require(_0xf7aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf7aa('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf7aa('0x6'));var client=jayson[_0xf7aa('0x7')][_0xf7aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x270465,_0x320338,_0x1ec1df){return new BPromise(function(_0x328a74,_0x2b91f7){return client['request'](_0x270465,_0x1ec1df)[_0xf7aa('0x9')](function(_0x717b9c){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x320338,_0xf7aa('0xa'));logger[_0xf7aa('0xb')](_0xf7aa('0xc'),_0x320338,'request\x20sent',JSON[_0xf7aa('0xd')](_0x717b9c));if(_0x717b9c[_0xf7aa('0xe')]){if(_0x717b9c[_0xf7aa('0xe')][_0xf7aa('0xf')]===0x1f4){logger['error'](_0xf7aa('0x10'),_0x320338,_0x717b9c[_0xf7aa('0xe')][_0xf7aa('0x11')]);return _0x2b91f7(_0x717b9c[_0xf7aa('0xe')][_0xf7aa('0x11')]);}logger[_0xf7aa('0xe')](_0xf7aa('0x10'),_0x320338,_0x717b9c[_0xf7aa('0xe')][_0xf7aa('0x11')]);return _0x328a74(_0x717b9c[_0xf7aa('0xe')]['message']);}else{logger[_0xf7aa('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x320338,_0xf7aa('0xa'));_0x328a74(_0x717b9c[_0xf7aa('0x13')][_0xf7aa('0x11')]);}})[_0xf7aa('0x14')](function(_0x36e17b){logger['error'](_0xf7aa('0x10'),_0x320338,_0x36e17b);_0x2b91f7(_0x36e17b);});});} \ No newline at end of file +var _0x5192=['jayson/promise','client','http','request','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xac84ed,_0x537064){var _0x521d6a=function(_0x321bce){while(--_0x321bce){_0xac84ed['push'](_0xac84ed['shift']());}};_0x521d6a(++_0x537064);}(_0x5192,0xac));var _0x2519=function(_0x5ee638,_0x4a6789){_0x5ee638=_0x5ee638-0x0;var _0x523c82=_0x5192[_0x5ee638];return _0x523c82;};'use strict';var _=require(_0x2519('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2519('0x1'));var rs=require(_0x2519('0x2'));var fs=require('fs');var Redis=require(_0x2519('0x3'));var db=require(_0x2519('0x4'))['db'];var utils=require(_0x2519('0x5'));var logger=require(_0x2519('0x6'))(_0x2519('0x7'));var config=require('../../config/environment');var jayson=require(_0x2519('0x8'));var client=jayson[_0x2519('0x9')][_0x2519('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a29c3,_0x5d4cc5,_0x1cea1a){return new BPromise(function(_0x52b518,_0x4b7a2e){return client[_0x2519('0xb')](_0x1a29c3,_0x1cea1a)['then'](function(_0x1ceb12){logger['info'](_0x2519('0xc'),_0x5d4cc5,_0x2519('0xd'));logger['debug'](_0x2519('0xe'),_0x5d4cc5,'request\x20sent',JSON['stringify'](_0x1ceb12));if(_0x1ceb12[_0x2519('0xf')]){if(_0x1ceb12[_0x2519('0xf')]['code']===0x1f4){logger[_0x2519('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x5d4cc5,_0x1ceb12[_0x2519('0xf')][_0x2519('0x10')]);return _0x4b7a2e(_0x1ceb12[_0x2519('0xf')][_0x2519('0x10')]);}logger[_0x2519('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x5d4cc5,_0x1ceb12[_0x2519('0xf')][_0x2519('0x10')]);return _0x52b518(_0x1ceb12[_0x2519('0xf')][_0x2519('0x10')]);}else{logger[_0x2519('0x11')](_0x2519('0xc'),_0x5d4cc5,_0x2519('0xd'));_0x52b518(_0x1ceb12[_0x2519('0x12')][_0x2519('0x10')]);}})[_0x2519('0x13')](function(_0x15a0a7){logger[_0x2519('0xf')](_0x2519('0xc'),_0x5d4cc5,_0x15a0a7);_0x4b7a2e(_0x15a0a7);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index dcc0b7c..d8f5ae0 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 _0xc83c=['isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x103af2,_0x54ef67){var _0x377945=function(_0x1e988c){while(--_0x1e988c){_0x103af2['push'](_0x103af2['shift']());}};_0x377945(++_0x54ef67);}(_0xc83c,0x98));var _0xcc83=function(_0x2338fa,_0x80579a){_0x2338fa=_0x2338fa-0x0;var _0x42df9b=_0xc83c[_0x2338fa];return _0x42df9b;};'use strict';var multer=require(_0xcc83('0x0'));var util=require(_0xcc83('0x1'));var path=require('path');var timeout=require(_0xcc83('0x2'));var express=require(_0xcc83('0x3'));var router=express[_0xcc83('0x4')]();var fs_extra=require(_0xcc83('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcc83('0x6'));var config=require(_0xcc83('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0xcc83('0x8')]('/',auth[_0xcc83('0x9')](),controller[_0xcc83('0xa')]);router[_0xcc83('0x8')](_0xcc83('0xb'),auth[_0xcc83('0x9')](),controller[_0xcc83('0xc')]);router[_0xcc83('0x8')](_0xcc83('0xd'),auth['isAuthenticated'](),controller[_0xcc83('0xe')]);router['post']('/',auth[_0xcc83('0x9')](),controller['create']);router[_0xcc83('0xf')](_0xcc83('0xd'),auth[_0xcc83('0x9')](),controller[_0xcc83('0x10')]);router['put'](_0xcc83('0xb'),auth[_0xcc83('0x9')](),controller[_0xcc83('0x11')]);router[_0xcc83('0x12')]('/:id',auth[_0xcc83('0x9')](),controller[_0xcc83('0x13')]);router['delete'](_0xcc83('0x14'),auth[_0xcc83('0x9')](),controller[_0xcc83('0x15')]);module[_0xcc83('0x16')]=router; \ No newline at end of file +var _0x103f=['/:id/sounds','getSounds','post','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0xcfc659,_0x4e5255){var _0x3ac112=function(_0xff5ef5){while(--_0xff5ef5){_0xcfc659['push'](_0xcfc659['shift']());}};_0x3ac112(++_0x4e5255);}(_0x103f,0xd2));var _0xf103=function(_0x33973c,_0x54dde8){_0x33973c=_0x33973c-0x0;var _0x16442a=_0x103f[_0x33973c];return _0x16442a;};'use strict';var multer=require(_0xf103('0x0'));var util=require('util');var path=require(_0xf103('0x1'));var timeout=require('connect-timeout');var express=require(_0xf103('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf103('0x3'));var interaction=require(_0xf103('0x4'));var config=require(_0xf103('0x5'));var controller=require('./voiceMusicOnHold.controller');router[_0xf103('0x6')]('/',auth[_0xf103('0x7')](),controller[_0xf103('0x8')]);router[_0xf103('0x6')](_0xf103('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xf103('0x6')](_0xf103('0xa'),auth[_0xf103('0x7')](),controller[_0xf103('0xb')]);router[_0xf103('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf103('0xc')]('/:id/sounds',auth[_0xf103('0x7')](),controller['addSound']);router[_0xf103('0xd')](_0xf103('0x9'),auth[_0xf103('0x7')](),controller[_0xf103('0xe')]);router[_0xf103('0xf')](_0xf103('0x9'),auth[_0xf103('0x7')](),controller[_0xf103('0x10')]);router[_0xf103('0xf')](_0xf103('0x11'),auth[_0xf103('0x7')](),controller[_0xf103('0x12')]);module[_0xf103('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 5e611b2..9baaeb1 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 _0x6a7a=['files','mp3nb','mp3','TIMESTAMP','BOOLEAN','exports','STRING','name','ENUM','custom'];(function(_0x4855bf,_0x10758e){var _0x32e91b=function(_0x2ae296){while(--_0x2ae296){_0x4855bf['push'](_0x4855bf['shift']());}};_0x32e91b(++_0x10758e);}(_0x6a7a,0xb9));var _0xa6a7=function(_0x4f144c,_0xc554bc){_0x4f144c=_0x4f144c-0x0;var _0x3b8fda=_0x6a7a[_0x4f144c];return _0x3b8fda;};'use strict';var Sequelize=require('sequelize');module[_0xa6a7('0x0')]={'name':{'type':Sequelize[_0xa6a7('0x1')],'allowNull':![],'unique':_0xa6a7('0x2')},'mode':{'type':Sequelize[_0xa6a7('0x3')](_0xa6a7('0x4'),_0xa6a7('0x5'),_0xa6a7('0x6'),'quietmp3nb','quietmp3',_0xa6a7('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xa6a7('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa6a7('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa6a7('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xa6a7('0x1')],'allowNull':!![]},'stamp':{'type':_0xa6a7('0x8')},'defaultEntry':{'type':Sequelize[_0xa6a7('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7dd3=['exports','STRING','ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha'];(function(_0x5e7473,_0x436e26){var _0x3588ed=function(_0x569896){while(--_0x569896){_0x5e7473['push'](_0x5e7473['shift']());}};_0x3588ed(++_0x436e26);}(_0x7dd3,0xfc));var _0x37dd=function(_0x1f0714,_0xde0530){_0x1f0714=_0x1f0714-0x0;var _0x33669d=_0x7dd3[_0x1f0714];return _0x33669d;};'use strict';var Sequelize=require('sequelize');module[_0x37dd('0x0')]={'name':{'type':Sequelize[_0x37dd('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x37dd('0x2')]('custom',_0x37dd('0x3'),_0x37dd('0x4'),_0x37dd('0x5'),_0x37dd('0x6'),_0x37dd('0x7')),'allowNull':!![],'defaultValue':_0x37dd('0x3')},'directory':{'type':Sequelize[_0x37dd('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x37dd('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x37dd('0x1')],'allowNull':!![],'defaultValue':_0x37dd('0x8')},'format':{'type':Sequelize[_0x37dd('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 294770f..91233bc 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 _0x73d4=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','VoiceMusicOnHold','findAll','rows','catch','show','params','body','find','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','format','%s.%s','basename','symlinkSync','removeSound','id2','ValidationError','getSounds','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','Content-Range','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack'];(function(_0x3eb958,_0x249551){var _0x34efca=function(_0x1a3981){while(--_0x1a3981){_0x3eb958['push'](_0x3eb958['shift']());}};_0x34efca(++_0x249551);}(_0x73d4,0x1a0));var _0x473d=function(_0xe6beba,_0x3f15d1){_0xe6beba=_0xe6beba-0x0;var _0x2f1c08=_0x73d4[_0xe6beba];return _0x2f1c08;};'use strict';var emlformat=require(_0x473d('0x0'));var rimraf=require(_0x473d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x473d('0x2'));var rp=require(_0x473d('0x3'));var moment=require(_0x473d('0x4'));var BPromise=require(_0x473d('0x5'));var Mustache=require(_0x473d('0x6'));var util=require('util');var path=require(_0x473d('0x7'));var sox=require(_0x473d('0x8'));var csv=require(_0x473d('0x9'));var ejs=require(_0x473d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x473d('0xb'));var squel=require('squel');var crypto=require(_0x473d('0xc'));var jsforce=require(_0x473d('0xd'));var deskjs=require(_0x473d('0xe'));var toCsv=require(_0x473d('0x9'));var querystring=require(_0x473d('0xf'));var Papa=require(_0x473d('0x10'));var Redis=require(_0x473d('0x11'));var authService=require(_0x473d('0x12'));var qs=require(_0x473d('0x13'));var as=require(_0x473d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x473d('0x15'));var utils=require('../../config/utils');var config=require(_0x473d('0x16'));var licenseUtil=require(_0x473d('0x17'));var db=require(_0x473d('0x18'))['db'];function respondWithStatusCode(_0x4c46f2,_0xde5e21){_0xde5e21=_0xde5e21||0xcc;return function(_0x2b26b3){if(_0x2b26b3){return _0x4c46f2[_0x473d('0x19')](_0xde5e21);}return _0x4c46f2['status'](_0xde5e21)[_0x473d('0x1a')]();};}function respondWithResult(_0x591295,_0x5c9fc6){_0x5c9fc6=_0x5c9fc6||0xc8;return function(_0xd495b6){if(_0xd495b6){return _0x591295['status'](_0x5c9fc6)[_0x473d('0x1b')](_0xd495b6);}};}function respondWithFilteredResult(_0xeff95f,_0x1578e2){return function(_0x1d54b1){if(_0x1d54b1){var _0x2fcbc1=typeof _0x1578e2[_0x473d('0x1c')]==='undefined'&&typeof _0x1578e2[_0x473d('0x1d')]===_0x473d('0x1e');var _0xb25a8c=_0x1d54b1[_0x473d('0x1f')];var _0x3bcfa1=_0x2fcbc1?0x0:_0x1578e2[_0x473d('0x1c')];var _0x25c3de=_0x2fcbc1?_0x1d54b1[_0x473d('0x1f')]:_0x1578e2['offset']+_0x1578e2[_0x473d('0x1d')];var _0x55e7c1;if(_0x25c3de>=_0xb25a8c){_0x25c3de=_0xb25a8c;_0x55e7c1=0xc8;}else{_0x55e7c1=0xce;}_0xeff95f[_0x473d('0x20')](_0x55e7c1);return _0xeff95f['set'](_0x473d('0x21'),_0x3bcfa1+'-'+_0x25c3de+'/'+_0xb25a8c)[_0x473d('0x1b')](_0x1d54b1);}return null;};}function patchUpdates(_0x970c8c){return function(_0x4f5cc1){try{jsonpatch['apply'](_0x4f5cc1,_0x970c8c,!![]);}catch(_0x2b02ec){return BPromise[_0x473d('0x22')](_0x2b02ec);}return _0x4f5cc1[_0x473d('0x23')]();};}function saveUpdates(_0x58de02,_0x317ad8){return function(_0x340a48){if(_0x340a48){return _0x340a48[_0x473d('0x24')](_0x58de02)[_0x473d('0x25')](function(_0x216dea){return _0x216dea;});}return null;};}function removeEntity(_0xb92ad8,_0x18d8ca){return function(_0x47c7d3){if(_0x47c7d3){return _0x47c7d3[_0x473d('0x26')]()[_0x473d('0x25')](function(){var _0x135ad6=_0x47c7d3[_0x473d('0x27')]({'plain':!![]});var _0x47e8ad=_0x473d('0x28');return db[_0x473d('0x29')][_0x473d('0x26')]({'where':{'type':_0x47e8ad,'resourceId':_0x135ad6['id']}})[_0x473d('0x25')](function(){return _0x47c7d3;});})[_0x473d('0x25')](function(){_0xb92ad8[_0x473d('0x20')](0xcc)[_0x473d('0x1a')]();});}};}function handleEntityNotFound(_0x125ff9,_0x5e3c8f){return function(_0x5da127){if(!_0x5da127){_0x125ff9[_0x473d('0x19')](0x194);}return _0x5da127;};}function handleError(_0x3a870c,_0x1111e1){_0x1111e1=_0x1111e1||0x1f4;return function(_0x26319f){logger[_0x473d('0x2a')](_0x26319f[_0x473d('0x2b')]);if(_0x26319f['name']){delete _0x26319f[_0x473d('0x2c')];}_0x3a870c[_0x473d('0x20')](_0x1111e1)[_0x473d('0x2d')](_0x26319f);};}exports[_0x473d('0x2e')]=function(_0xd23d94,_0x46f128){var _0x409e1a={},_0x106c36={},_0xcc6692={'count':0x0,'rows':[]};var _0x3031cc=_[_0x473d('0x2f')](db['VoiceMusicOnHold'][_0x473d('0x30')],function(_0x2dcfb5){return{'name':_0x2dcfb5[_0x473d('0x31')],'type':_0x2dcfb5[_0x473d('0x32')][_0x473d('0x33')]};});_0x106c36['model']=_[_0x473d('0x2f')](_0x3031cc,_0x473d('0x2c'));_0x106c36[_0x473d('0x34')]=_[_0x473d('0x35')](_0xd23d94['query']);_0x106c36['filters']=_[_0x473d('0x36')](_0x106c36[_0x473d('0x37')],_0x106c36[_0x473d('0x34')]);_0x409e1a[_0x473d('0x38')]=_['intersection'](_0x106c36[_0x473d('0x37')],qs['fields'](_0xd23d94[_0x473d('0x34')][_0x473d('0x39')]));_0x409e1a[_0x473d('0x38')]=_0x409e1a[_0x473d('0x38')][_0x473d('0x3a')]?_0x409e1a[_0x473d('0x38')]:_0x106c36[_0x473d('0x37')];if(!_0xd23d94[_0x473d('0x34')]['hasOwnProperty'](_0x473d('0x3b'))){_0x409e1a[_0x473d('0x1d')]=qs[_0x473d('0x1d')](_0xd23d94[_0x473d('0x34')][_0x473d('0x1d')]);_0x409e1a[_0x473d('0x1c')]=qs['offset'](_0xd23d94[_0x473d('0x34')]['offset']);}_0x409e1a['order']=qs[_0x473d('0x3c')](_0xd23d94[_0x473d('0x34')][_0x473d('0x3c')]);delete _0xd23d94['query'][_0x473d('0x3c')];_0x409e1a['where']=qs[_0x473d('0x3d')](_['pick'](_0xd23d94[_0x473d('0x34')],_0x106c36['filters']),_0x3031cc);if(_0xd23d94['query'][_0x473d('0x3e')]){_0x409e1a[_0x473d('0x3f')]=_[_0x473d('0x40')](_0x409e1a[_0x473d('0x3f')],{'$or':_[_0x473d('0x2f')](_0x3031cc,function(_0x2f0684){if(_0x2f0684[_0x473d('0x32')]!==_0x473d('0x41')){var _0xdf698e={};_0xdf698e[_0x2f0684[_0x473d('0x2c')]]={'$like':'%'+_0xd23d94[_0x473d('0x34')][_0x473d('0x3e')]+'%'};return _0xdf698e;}})});}_0x409e1a=_['merge']({},_0x409e1a,_0xd23d94[_0x473d('0x42')]);var _0x5704d7={'where':_0x409e1a['where']};return db['VoiceMusicOnHold'][_0x473d('0x1f')](_0x5704d7)[_0x473d('0x25')](function(_0x1f43b6){_0xcc6692[_0x473d('0x1f')]=_0x1f43b6;if(_0xd23d94['query'][_0x473d('0x43')]){_0x409e1a[_0x473d('0x44')]=[{'all':!![]}];}return db[_0x473d('0x45')][_0x473d('0x46')](_0x409e1a);})[_0x473d('0x25')](function(_0x3dbc5f){_0xcc6692[_0x473d('0x47')]=_0x3dbc5f;return _0xcc6692;})[_0x473d('0x25')](respondWithFilteredResult(_0x46f128,_0x409e1a))[_0x473d('0x48')](handleError(_0x46f128,null));};exports[_0x473d('0x49')]=function(_0x4cac24,_0x57b2bb){var _0x340632={'raw':![],'where':{'id':_0x4cac24[_0x473d('0x4a')]['id']}},_0x15d635={};_0x15d635[_0x473d('0x37')]=_[_0x473d('0x35')](db['VoiceMusicOnHold']['rawAttributes']);_0x15d635[_0x473d('0x34')]=_[_0x473d('0x35')](_0x4cac24[_0x473d('0x34')]);_0x15d635[_0x473d('0x3d')]=_[_0x473d('0x36')](_0x15d635[_0x473d('0x37')],_0x15d635[_0x473d('0x34')]);_0x340632[_0x473d('0x38')]=_[_0x473d('0x36')](_0x15d635[_0x473d('0x37')],qs[_0x473d('0x39')](_0x4cac24['query']['fields']));_0x340632[_0x473d('0x38')]=_0x340632[_0x473d('0x38')][_0x473d('0x3a')]?_0x340632['attributes']:_0x15d635[_0x473d('0x37')];if(_0x4cac24[_0x473d('0x34')][_0x473d('0x43')]){_0x340632[_0x473d('0x44')]=[{'all':!![]}];}_0x340632=_[_0x473d('0x40')]({},_0x340632,_0x4cac24[_0x473d('0x42')]);return db['VoiceMusicOnHold']['find'](_0x340632)['then'](handleEntityNotFound(_0x57b2bb,null))['then'](respondWithResult(_0x57b2bb,null))['catch'](handleError(_0x57b2bb,null));};exports[_0x473d('0x24')]=function(_0x2813e0,_0x18ab96){if(_0x2813e0[_0x473d('0x4b')]['id']){delete _0x2813e0['body']['id'];}return db[_0x473d('0x45')][_0x473d('0x4c')]({'where':{'id':_0x2813e0['params']['id']}})[_0x473d('0x25')](handleEntityNotFound(_0x18ab96,null))[_0x473d('0x25')](saveUpdates(_0x2813e0['body'],null))['then'](respondWithResult(_0x18ab96,null))[_0x473d('0x48')](handleError(_0x18ab96,null));};exports[_0x473d('0x4d')]=function(_0x33c39c,_0x5966d4,_0x2e1cf1){return db[_0x473d('0x4e')][_0x473d('0x4f')](function(_0x31e998){if(_0x33c39c[_0x473d('0x4b')][_0x473d('0x50')]===_0x473d('0x51')){_0x33c39c[_0x473d('0x4b')][_0x473d('0x52')]=path[_0x473d('0x53')](config[_0x473d('0x54')],_0x473d('0x55'),_0x33c39c[_0x473d('0x4b')]['name']);}return db[_0x473d('0x45')][_0x473d('0x4d')](_0x33c39c['body'],{'transaction':_0x31e998})[_0x473d('0x25')](function(_0x353d7d){if(_0x33c39c['body'][_0x473d('0x50')]==='files'){fs[_0x473d('0x56')](_0x353d7d[_0x473d('0x52')],parseInt(_0x473d('0x57'),0x8));}var _0x56c1e4=_0x33c39c[_0x473d('0x58')][_0x473d('0x27')]({'plain':!![]});if(!_0x56c1e4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56c1e4[_0x473d('0x59')]===_0x473d('0x58')){var _0x10dddb=_0x353d7d['get']({'plain':!![]});return db[_0x473d('0x5a')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x56c1e4[_0x473d('0x5b')]},'raw':!![]})['then'](function(_0x579a8f){if(_0x579a8f&&_0x579a8f[_0x473d('0x5c')]===0x0){return db['UserProfileResource'][_0x473d('0x4d')]({'name':_0x10dddb[_0x473d('0x2c')],'resourceId':_0x10dddb['id'],'type':_0x579a8f[_0x473d('0x2c')],'sectionId':_0x579a8f['id']},{})[_0x473d('0x25')](function(){return _0x353d7d;});}else{return _0x353d7d;}})[_0x473d('0x48')](function(_0xe9f03b){logger[_0x473d('0x2a')](_0x473d('0x5d'),_0xe9f03b);});}return _0x353d7d;});})[_0x473d('0x25')](respondWithResult(_0x5966d4,0xc9))[_0x473d('0x48')](handleError(_0x5966d4,null));};exports[_0x473d('0x26')]=function(_0x1bc910,_0x57309b,_0x394e39){var _0x1d89c4;return db[_0x473d('0x45')][_0x473d('0x4c')]({'where':{'id':_0x1bc910[_0x473d('0x4a')]['id']}})[_0x473d('0x25')](function(_0x21c845){if(_0x21c845){return db[_0x473d('0x4e')][_0x473d('0x4f')](function(_0x52bd62){return _0x21c845[_0x473d('0x26')]({'transaction':_0x52bd62,'raw':!![]})[_0x473d('0x25')](function(_0x5ad02e){if(_0x5ad02e['directory']){fs[_0x473d('0x5e')](_0x5ad02e['directory'])[_0x473d('0x5f')](function(_0xa68f4f){fs[_0x473d('0x60')](path[_0x473d('0x53')](_0x5ad02e[_0x473d('0x52')],_0xa68f4f));});fs[_0x473d('0x61')](_0x5ad02e[_0x473d('0x52')]);}return _0x5ad02e;});})[_0x473d('0x48')](function(_0xc3c90d){throw new db[(_0x473d('0x62'))]['ValidationError'](_0xc3c90d[_0x473d('0x63')]);});}})['then'](handleEntityNotFound(_0x57309b,null))[_0x473d('0x25')](removeEntity(_0x57309b,null))[_0x473d('0x48')](handleError(_0x57309b,null));};exports[_0x473d('0x64')]=function(_0x1fbac3,_0x46ba8e,_0x49672f){return db[_0x473d('0x4e')][_0x473d('0x4f')](function(_0x11d19e){var _0x334ad8;return db[_0x473d('0x45')][_0x473d('0x4c')]({'where':{'id':_0x1fbac3[_0x473d('0x4a')]['id']}})[_0x473d('0x25')](function(_0xc550d8){if(_0xc550d8){_0x334ad8=_0xc550d8;return _0xc550d8[_0x473d('0x64')](_0x1fbac3['body']['id'],{'transaction':_0x11d19e});}})[_0x473d('0x25')](function(_0x48edbf){if(_0x48edbf){return db[_0x473d('0x65')][_0x473d('0x66')]({'where':{'id':_0x1fbac3['body']['id']},'attributes':['id',_0x473d('0x2c'),_0x473d('0x67'),_0x473d('0x68'),_0x473d('0x69')],'raw':!![]});}})[_0x473d('0x25')](function(_0x206ccf){if(_0x206ccf){var _0x5d2baa=path[_0x473d('0x53')](config[_0x473d('0x54')],'server/files/sounds/converted',util[_0x473d('0x6a')](_0x473d('0x6b'),path[_0x473d('0x6c')](_0x206ccf[_0x473d('0x67')],path['extname'](_0x206ccf[_0x473d('0x67')])),_0x206ccf[_0x473d('0x68')]));var _0x42571a=path['join'](config['root'],_0x473d('0x55'),_0x334ad8[_0x473d('0x2c')],util['format'](_0x473d('0x6b'),_0x206ccf[_0x473d('0x2c')],_0x206ccf['converted_format']));fs[_0x473d('0x6d')](_0x5d2baa,_0x42571a);return _0x206ccf;}})[_0x473d('0x48')](function(_0x41955b){throw new db[(_0x473d('0x62'))]['ValidationError'](_0x41955b['message']);});})[_0x473d('0x25')](handleEntityNotFound(_0x46ba8e,null))[_0x473d('0x25')](respondWithResult(_0x46ba8e,0xc9))[_0x473d('0x48')](handleError(_0x46ba8e,null));};exports[_0x473d('0x6e')]=function(_0x2b48d4,_0x5bd4d3,_0xface47){return db[_0x473d('0x4e')][_0x473d('0x4f')](function(_0x459aa3){var _0xd88d;return db[_0x473d('0x45')][_0x473d('0x66')]({'where':{'id':_0x2b48d4[_0x473d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5bd4d3,null))[_0x473d('0x25')](function(_0x51ec99){if(_0x51ec99){_0xd88d=_0x51ec99;return _0x51ec99[_0x473d('0x6e')](_0x2b48d4[_0x473d('0x4a')][_0x473d('0x6f')]);}})['then'](function(_0x5d2443){if(_0x5d2443){return db[_0x473d('0x65')][_0x473d('0x66')]({'where':{'id':_0x2b48d4[_0x473d('0x4a')][_0x473d('0x6f')]},'attributes':['id','name',_0x473d('0x67'),_0x473d('0x68'),_0x473d('0x69')],'raw':!![]});}})[_0x473d('0x25')](function(_0x111ad9){if(_0x111ad9){fs[_0x473d('0x60')](path[_0x473d('0x53')](_0xd88d['directory'],util[_0x473d('0x6a')](_0x473d('0x6b'),_0x111ad9['name'],_0x111ad9[_0x473d('0x68')])));return _0x111ad9;}})['catch'](function(_0x462146){throw new db['Sequelize'][(_0x473d('0x70'))](_0x462146[_0x473d('0x63')]);});})['then'](handleEntityNotFound(_0x5bd4d3,null))[_0x473d('0x25')](respondWithStatusCode(_0x5bd4d3,0xcc))[_0x473d('0x48')](handleError(_0x5bd4d3,null));};exports['getSounds']=function(_0x10bac7,_0x186758,_0xfd4729){var _0x56f736={};var _0x4aa8c4={};var _0x130dea;var _0x35d8e5;return db['VoiceMusicOnHold'][_0x473d('0x66')]({'where':{'id':_0x10bac7[_0x473d('0x4a')]['id']}})[_0x473d('0x25')](handleEntityNotFound(_0x186758,null))[_0x473d('0x25')](function(_0x10e9c9){if(_0x10e9c9){_0x130dea=_0x10e9c9;_0x4aa8c4['model']=_[_0x473d('0x35')](db['Sound'][_0x473d('0x30')]);_0x4aa8c4[_0x473d('0x34')]=_['keys'](_0x10bac7[_0x473d('0x34')]);_0x4aa8c4[_0x473d('0x3d')]=_[_0x473d('0x36')](_0x4aa8c4[_0x473d('0x37')],_0x4aa8c4['query']);_0x56f736[_0x473d('0x38')]=_[_0x473d('0x36')](_0x4aa8c4[_0x473d('0x37')],qs[_0x473d('0x39')](_0x10bac7[_0x473d('0x34')][_0x473d('0x39')]));_0x56f736[_0x473d('0x38')]=_0x56f736[_0x473d('0x38')]['length']?_0x56f736['attributes']:_0x4aa8c4[_0x473d('0x37')];_0x56f736['order']=qs['sort'](_0x10bac7[_0x473d('0x34')][_0x473d('0x3c')]);_0x56f736[_0x473d('0x3f')]=qs['filters'](_['pick'](_0x10bac7[_0x473d('0x34')],_0x4aa8c4[_0x473d('0x3d')]));if(_0x10bac7[_0x473d('0x34')][_0x473d('0x3e')]){_0x56f736['where']=_[_0x473d('0x40')](_0x56f736[_0x473d('0x3f')],{'$or':_[_0x473d('0x2f')](_0x56f736[_0x473d('0x38')],function(_0x46cc04){var _0x49ff92={};_0x49ff92[_0x46cc04]={'$like':'%'+_0x10bac7['query'][_0x473d('0x3e')]+'%'};return _0x49ff92;})});}_0x56f736=_[_0x473d('0x40')]({},_0x56f736,_0x10bac7[_0x473d('0x42')]);return _0x130dea[_0x473d('0x71')](_0x56f736);}})[_0x473d('0x25')](function(_0x2af893){if(_0x2af893){_0x35d8e5=_0x2af893['length'];if(!_0x10bac7['query'][_0x473d('0x72')](_0x473d('0x3b'))){_0x56f736[_0x473d('0x1d')]=qs[_0x473d('0x1d')](_0x10bac7['query'][_0x473d('0x1d')]);_0x56f736[_0x473d('0x1c')]=qs[_0x473d('0x1c')](_0x10bac7[_0x473d('0x34')][_0x473d('0x1c')]);}return _0x130dea[_0x473d('0x71')](_0x56f736);}})[_0x473d('0x25')](function(_0x39552b){if(_0x39552b){return _0x39552b?{'count':_0x35d8e5,'rows':_0x39552b}:null;}})[_0x473d('0x25')](respondWithResult(_0x186758,null))[_0x473d('0x48')](handleError(_0x186758,null));}; \ No newline at end of file +var _0x99ac=['createdAt','format','basename','extname','%s.%s','removeSound','id2','getSounds','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','destroy','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','body','create','mode','directory','join','root','server/files/moh','files','mkdirSync','0777','user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format'];(function(_0x53ac91,_0x257d51){var _0x122633=function(_0x49b3f6){while(--_0x49b3f6){_0x53ac91['push'](_0x53ac91['shift']());}};_0x122633(++_0x257d51);}(_0x99ac,0x159));var _0xc99a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x99ac[_0x565ed7];return _0x183ad7;};'use strict';var emlformat=require(_0xc99a('0x0'));var rimraf=require(_0xc99a('0x1'));var zipdir=require(_0xc99a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc99a('0x3'));var moment=require(_0xc99a('0x4'));var BPromise=require(_0xc99a('0x5'));var Mustache=require(_0xc99a('0x6'));var util=require(_0xc99a('0x7'));var path=require('path');var sox=require(_0xc99a('0x8'));var csv=require(_0xc99a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc99a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc99a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc99a('0x9'));var querystring=require(_0xc99a('0xc'));var Papa=require(_0xc99a('0xd'));var Redis=require('ioredis');var authService=require(_0xc99a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc99a('0xf'));var hardwareService=require(_0xc99a('0x10'));var logger=require(_0xc99a('0x11'))(_0xc99a('0x12'));var utils=require(_0xc99a('0x13'));var config=require(_0xc99a('0x14'));var licenseUtil=require(_0xc99a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fa810,_0x79112e){_0x79112e=_0x79112e||0xcc;return function(_0x4d7b8f){if(_0x4d7b8f){return _0x3fa810[_0xc99a('0x16')](_0x79112e);}return _0x3fa810[_0xc99a('0x17')](_0x79112e)[_0xc99a('0x18')]();};}function respondWithResult(_0x3d44f1,_0x5db0dd){_0x5db0dd=_0x5db0dd||0xc8;return function(_0x24e6ab){if(_0x24e6ab){return _0x3d44f1[_0xc99a('0x17')](_0x5db0dd)[_0xc99a('0x19')](_0x24e6ab);}};}function respondWithFilteredResult(_0x3f659c,_0x31a802){return function(_0x127558){if(_0x127558){var _0x49d8e9=typeof _0x31a802[_0xc99a('0x1a')]===_0xc99a('0x1b')&&typeof _0x31a802[_0xc99a('0x1c')]===_0xc99a('0x1b');var _0x2a75e5=_0x127558[_0xc99a('0x1d')];var _0x541768=_0x49d8e9?0x0:_0x31a802['offset'];var _0x4091ad=_0x49d8e9?_0x127558['count']:_0x31a802[_0xc99a('0x1a')]+_0x31a802['limit'];var _0x5923be;if(_0x4091ad>=_0x2a75e5){_0x4091ad=_0x2a75e5;_0x5923be=0xc8;}else{_0x5923be=0xce;}_0x3f659c[_0xc99a('0x17')](_0x5923be);return _0x3f659c[_0xc99a('0x1e')](_0xc99a('0x1f'),_0x541768+'-'+_0x4091ad+'/'+_0x2a75e5)[_0xc99a('0x19')](_0x127558);}return null;};}function patchUpdates(_0x1bcfbd){return function(_0x1f3c7d){try{jsonpatch[_0xc99a('0x20')](_0x1f3c7d,_0x1bcfbd,!![]);}catch(_0x109e13){return BPromise[_0xc99a('0x21')](_0x109e13);}return _0x1f3c7d[_0xc99a('0x22')]();};}function saveUpdates(_0xebd8f2,_0x5bdcd3){return function(_0x36246e){if(_0x36246e){return _0x36246e[_0xc99a('0x23')](_0xebd8f2)[_0xc99a('0x24')](function(_0x823341){return _0x823341;});}return null;};}function removeEntity(_0x5b5d5e,_0x1cbadf){return function(_0x15d53a){if(_0x15d53a){return _0x15d53a['destroy']()[_0xc99a('0x24')](function(){var _0x4372aa=_0x15d53a[_0xc99a('0x25')]({'plain':!![]});var _0x557b9b=_0xc99a('0x26');return db['UserProfileResource'][_0xc99a('0x27')]({'where':{'type':_0x557b9b,'resourceId':_0x4372aa['id']}})[_0xc99a('0x24')](function(){return _0x15d53a;});})[_0xc99a('0x24')](function(){_0x5b5d5e[_0xc99a('0x17')](0xcc)[_0xc99a('0x18')]();});}};}function handleEntityNotFound(_0x1c53f8,_0x4cf302){return function(_0x508d4b){if(!_0x508d4b){_0x1c53f8[_0xc99a('0x16')](0x194);}return _0x508d4b;};}function handleError(_0x865b0a,_0x57ff63){_0x57ff63=_0x57ff63||0x1f4;return function(_0x366510){logger[_0xc99a('0x28')](_0x366510[_0xc99a('0x29')]);if(_0x366510[_0xc99a('0x2a')]){delete _0x366510[_0xc99a('0x2a')];}_0x865b0a[_0xc99a('0x17')](_0x57ff63)[_0xc99a('0x2b')](_0x366510);};}exports[_0xc99a('0x2c')]=function(_0x4df193,_0x55575e){var _0x352521={},_0x11b3be={},_0x4f3ed2={'count':0x0,'rows':[]};var _0x10fb3b=_['map'](db[_0xc99a('0x2d')][_0xc99a('0x2e')],function(_0x2f0609){return{'name':_0x2f0609[_0xc99a('0x2f')],'type':_0x2f0609[_0xc99a('0x30')][_0xc99a('0x31')]};});_0x11b3be['model']=_[_0xc99a('0x32')](_0x10fb3b,_0xc99a('0x2a'));_0x11b3be[_0xc99a('0x33')]=_[_0xc99a('0x34')](_0x4df193[_0xc99a('0x33')]);_0x11b3be[_0xc99a('0x35')]=_['intersection'](_0x11b3be[_0xc99a('0x36')],_0x11b3be[_0xc99a('0x33')]);_0x352521[_0xc99a('0x37')]=_['intersection'](_0x11b3be['model'],qs[_0xc99a('0x38')](_0x4df193['query'][_0xc99a('0x38')]));_0x352521[_0xc99a('0x37')]=_0x352521[_0xc99a('0x37')][_0xc99a('0x39')]?_0x352521[_0xc99a('0x37')]:_0x11b3be[_0xc99a('0x36')];if(!_0x4df193['query'][_0xc99a('0x3a')]('nolimit')){_0x352521[_0xc99a('0x1c')]=qs[_0xc99a('0x1c')](_0x4df193['query'][_0xc99a('0x1c')]);_0x352521[_0xc99a('0x1a')]=qs['offset'](_0x4df193['query'][_0xc99a('0x1a')]);}_0x352521[_0xc99a('0x3b')]=qs[_0xc99a('0x3c')](_0x4df193[_0xc99a('0x33')][_0xc99a('0x3c')]);delete _0x4df193[_0xc99a('0x33')][_0xc99a('0x3c')];_0x352521['where']=qs['filters'](_[_0xc99a('0x3d')](_0x4df193[_0xc99a('0x33')],_0x11b3be[_0xc99a('0x35')]),_0x10fb3b);if(_0x4df193[_0xc99a('0x33')][_0xc99a('0x3e')]){_0x352521[_0xc99a('0x3f')]=_[_0xc99a('0x40')](_0x352521['where'],{'$or':_['map'](_0x10fb3b,function(_0x39c0ed){if(_0x39c0ed[_0xc99a('0x30')]!==_0xc99a('0x41')){var _0xde9ab8={};_0xde9ab8[_0x39c0ed[_0xc99a('0x2a')]]={'$like':'%'+_0x4df193[_0xc99a('0x33')][_0xc99a('0x3e')]+'%'};return _0xde9ab8;}})});}_0x352521=_[_0xc99a('0x40')]({},_0x352521,_0x4df193[_0xc99a('0x42')]);var _0x14a7e8={'where':_0x352521['where']};return db[_0xc99a('0x2d')][_0xc99a('0x1d')](_0x14a7e8)[_0xc99a('0x24')](function(_0x3dcdef){_0x4f3ed2[_0xc99a('0x1d')]=_0x3dcdef;if(_0x4df193[_0xc99a('0x33')][_0xc99a('0x43')]){_0x352521[_0xc99a('0x44')]=[{'all':!![]}];}return db[_0xc99a('0x2d')]['findAll'](_0x352521);})['then'](function(_0x1ae861){_0x4f3ed2[_0xc99a('0x45')]=_0x1ae861;return _0x4f3ed2;})[_0xc99a('0x24')](respondWithFilteredResult(_0x55575e,_0x352521))[_0xc99a('0x46')](handleError(_0x55575e,null));};exports['show']=function(_0x7b3ad7,_0x57da8f){var _0xcbd0cc={'raw':![],'where':{'id':_0x7b3ad7[_0xc99a('0x47')]['id']}},_0x3ba843={};_0x3ba843['model']=_[_0xc99a('0x34')](db['VoiceMusicOnHold']['rawAttributes']);_0x3ba843[_0xc99a('0x33')]=_[_0xc99a('0x34')](_0x7b3ad7[_0xc99a('0x33')]);_0x3ba843[_0xc99a('0x35')]=_[_0xc99a('0x48')](_0x3ba843['model'],_0x3ba843[_0xc99a('0x33')]);_0xcbd0cc[_0xc99a('0x37')]=_[_0xc99a('0x48')](_0x3ba843[_0xc99a('0x36')],qs[_0xc99a('0x38')](_0x7b3ad7[_0xc99a('0x33')]['fields']));_0xcbd0cc[_0xc99a('0x37')]=_0xcbd0cc[_0xc99a('0x37')][_0xc99a('0x39')]?_0xcbd0cc['attributes']:_0x3ba843[_0xc99a('0x36')];if(_0x7b3ad7[_0xc99a('0x33')][_0xc99a('0x43')]){_0xcbd0cc[_0xc99a('0x44')]=[{'all':!![]}];}_0xcbd0cc=_[_0xc99a('0x40')]({},_0xcbd0cc,_0x7b3ad7[_0xc99a('0x42')]);return db['VoiceMusicOnHold']['find'](_0xcbd0cc)[_0xc99a('0x24')](handleEntityNotFound(_0x57da8f,null))[_0xc99a('0x24')](respondWithResult(_0x57da8f,null))['catch'](handleError(_0x57da8f,null));};exports['update']=function(_0x33b72f,_0x430a26){if(_0x33b72f[_0xc99a('0x49')]['id']){delete _0x33b72f[_0xc99a('0x49')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x33b72f['params']['id']}})[_0xc99a('0x24')](handleEntityNotFound(_0x430a26,null))[_0xc99a('0x24')](saveUpdates(_0x33b72f['body'],null))[_0xc99a('0x24')](respondWithResult(_0x430a26,null))[_0xc99a('0x46')](handleError(_0x430a26,null));};exports[_0xc99a('0x4a')]=function(_0x5b7e37,_0x499748,_0x133299){return db['sequelize']['transaction'](function(_0x84ea75){if(_0x5b7e37[_0xc99a('0x49')][_0xc99a('0x4b')]==='files'){_0x5b7e37[_0xc99a('0x49')][_0xc99a('0x4c')]=path[_0xc99a('0x4d')](config[_0xc99a('0x4e')],_0xc99a('0x4f'),_0x5b7e37[_0xc99a('0x49')][_0xc99a('0x2a')]);}return db['VoiceMusicOnHold'][_0xc99a('0x4a')](_0x5b7e37[_0xc99a('0x49')],{'transaction':_0x84ea75})[_0xc99a('0x24')](function(_0x18c396){if(_0x5b7e37[_0xc99a('0x49')][_0xc99a('0x4b')]===_0xc99a('0x50')){fs[_0xc99a('0x51')](_0x18c396[_0xc99a('0x4c')],parseInt(_0xc99a('0x52'),0x8));}var _0x346d22=_0x5b7e37[_0xc99a('0x53')][_0xc99a('0x25')]({'plain':!![]});if(!_0x346d22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x346d22[_0xc99a('0x54')]==='user'){var _0xc5abb=_0x18c396[_0xc99a('0x25')]({'plain':!![]});return db[_0xc99a('0x55')][_0xc99a('0x56')]({'where':{'name':_0xc99a('0x26'),'userProfileId':_0x346d22[_0xc99a('0x57')]},'raw':!![]})['then'](function(_0x18c5e4){if(_0x18c5e4&&_0x18c5e4['autoAssociation']===0x0){return db[_0xc99a('0x58')][_0xc99a('0x4a')]({'name':_0xc5abb[_0xc99a('0x2a')],'resourceId':_0xc5abb['id'],'type':_0x18c5e4[_0xc99a('0x2a')],'sectionId':_0x18c5e4['id']},{})[_0xc99a('0x24')](function(){return _0x18c396;});}else{return _0x18c396;}})[_0xc99a('0x46')](function(_0x5e0e95){logger[_0xc99a('0x28')](_0xc99a('0x59'),_0x5e0e95);});}return _0x18c396;});})['then'](respondWithResult(_0x499748,0xc9))['catch'](handleError(_0x499748,null));};exports[_0xc99a('0x27')]=function(_0x3346d2,_0x18ce3d,_0x464e67){var _0x45cf5f;return db[_0xc99a('0x2d')][_0xc99a('0x56')]({'where':{'id':_0x3346d2[_0xc99a('0x47')]['id']}})[_0xc99a('0x24')](function(_0x4a5547){if(_0x4a5547){return db[_0xc99a('0x5a')][_0xc99a('0x5b')](function(_0x784901){return _0x4a5547[_0xc99a('0x27')]({'transaction':_0x784901,'raw':!![]})[_0xc99a('0x24')](function(_0x526a07){if(_0x526a07[_0xc99a('0x4c')]){fs['readdirSync'](_0x526a07[_0xc99a('0x4c')])[_0xc99a('0x5c')](function(_0x5b3fc0){fs[_0xc99a('0x5d')](path['join'](_0x526a07[_0xc99a('0x4c')],_0x5b3fc0));});fs[_0xc99a('0x5e')](_0x526a07['directory']);}return _0x526a07;});})[_0xc99a('0x46')](function(_0x2c13ba){throw new db[(_0xc99a('0x5f'))][(_0xc99a('0x60'))](_0x2c13ba[_0xc99a('0x61')]);});}})[_0xc99a('0x24')](handleEntityNotFound(_0x18ce3d,null))['then'](removeEntity(_0x18ce3d,null))[_0xc99a('0x46')](handleError(_0x18ce3d,null));};exports['addSound']=function(_0x56d3a3,_0x1b4c5f,_0x3ed391){return db[_0xc99a('0x5a')][_0xc99a('0x5b')](function(_0x553312){var _0x43fbc1;return db[_0xc99a('0x2d')][_0xc99a('0x56')]({'where':{'id':_0x56d3a3['params']['id']}})[_0xc99a('0x24')](function(_0x339e79){if(_0x339e79){_0x43fbc1=_0x339e79;return _0x339e79[_0xc99a('0x62')](_0x56d3a3[_0xc99a('0x49')]['id'],{'transaction':_0x553312});}})[_0xc99a('0x24')](function(_0x3936f9){if(_0x3936f9){return db[_0xc99a('0x63')][_0xc99a('0x64')]({'where':{'id':_0x56d3a3['body']['id']},'attributes':['id',_0xc99a('0x2a'),_0xc99a('0x65'),_0xc99a('0x66'),_0xc99a('0x67')],'raw':!![]});}})[_0xc99a('0x24')](function(_0x2e876c){if(_0x2e876c){var _0x4b080b=path[_0xc99a('0x4d')](config[_0xc99a('0x4e')],'server/files/sounds/converted',util[_0xc99a('0x68')]('%s.%s',path[_0xc99a('0x69')](_0x2e876c[_0xc99a('0x65')],path[_0xc99a('0x6a')](_0x2e876c[_0xc99a('0x65')])),_0x2e876c[_0xc99a('0x66')]));var _0x200b87=path[_0xc99a('0x4d')](config[_0xc99a('0x4e')],'server/files/moh',_0x43fbc1[_0xc99a('0x2a')],util['format'](_0xc99a('0x6b'),_0x2e876c[_0xc99a('0x2a')],_0x2e876c[_0xc99a('0x66')]));fs['symlinkSync'](_0x4b080b,_0x200b87);return _0x2e876c;}})[_0xc99a('0x46')](function(_0x2cf129){throw new db[(_0xc99a('0x5f'))]['ValidationError'](_0x2cf129[_0xc99a('0x61')]);});})[_0xc99a('0x24')](handleEntityNotFound(_0x1b4c5f,null))[_0xc99a('0x24')](respondWithResult(_0x1b4c5f,0xc9))[_0xc99a('0x46')](handleError(_0x1b4c5f,null));};exports[_0xc99a('0x6c')]=function(_0x423891,_0x52fe17,_0x44db7d){return db[_0xc99a('0x5a')][_0xc99a('0x5b')](function(_0x548ee1){var _0x20f5cb;return db[_0xc99a('0x2d')]['findOne']({'where':{'id':_0x423891['params']['id']}})[_0xc99a('0x24')](handleEntityNotFound(_0x52fe17,null))[_0xc99a('0x24')](function(_0x5b13aa){if(_0x5b13aa){_0x20f5cb=_0x5b13aa;return _0x5b13aa[_0xc99a('0x6c')](_0x423891[_0xc99a('0x47')][_0xc99a('0x6d')]);}})[_0xc99a('0x24')](function(_0x574e3f){if(_0x574e3f){return db[_0xc99a('0x63')]['findOne']({'where':{'id':_0x423891[_0xc99a('0x47')][_0xc99a('0x6d')]},'attributes':['id',_0xc99a('0x2a'),'save_name','converted_format',_0xc99a('0x67')],'raw':!![]});}})[_0xc99a('0x24')](function(_0x35a26c){if(_0x35a26c){fs[_0xc99a('0x5d')](path[_0xc99a('0x4d')](_0x20f5cb[_0xc99a('0x4c')],util[_0xc99a('0x68')]('%s.%s',_0x35a26c[_0xc99a('0x2a')],_0x35a26c[_0xc99a('0x66')])));return _0x35a26c;}})[_0xc99a('0x46')](function(_0x3ebbcc){throw new db['Sequelize'][(_0xc99a('0x60'))](_0x3ebbcc[_0xc99a('0x61')]);});})[_0xc99a('0x24')](handleEntityNotFound(_0x52fe17,null))['then'](respondWithStatusCode(_0x52fe17,0xcc))['catch'](handleError(_0x52fe17,null));};exports[_0xc99a('0x6e')]=function(_0x485b0b,_0x16717e,_0x152854){var _0x26442d={};var _0xecc717={};var _0x48a29f;var _0x54a5cc;return db[_0xc99a('0x2d')]['findOne']({'where':{'id':_0x485b0b['params']['id']}})[_0xc99a('0x24')](handleEntityNotFound(_0x16717e,null))[_0xc99a('0x24')](function(_0x594f9a){if(_0x594f9a){_0x48a29f=_0x594f9a;_0xecc717[_0xc99a('0x36')]=_[_0xc99a('0x34')](db[_0xc99a('0x63')][_0xc99a('0x2e')]);_0xecc717['query']=_['keys'](_0x485b0b[_0xc99a('0x33')]);_0xecc717[_0xc99a('0x35')]=_[_0xc99a('0x48')](_0xecc717[_0xc99a('0x36')],_0xecc717[_0xc99a('0x33')]);_0x26442d[_0xc99a('0x37')]=_[_0xc99a('0x48')](_0xecc717[_0xc99a('0x36')],qs['fields'](_0x485b0b[_0xc99a('0x33')][_0xc99a('0x38')]));_0x26442d[_0xc99a('0x37')]=_0x26442d[_0xc99a('0x37')][_0xc99a('0x39')]?_0x26442d[_0xc99a('0x37')]:_0xecc717[_0xc99a('0x36')];_0x26442d['order']=qs[_0xc99a('0x3c')](_0x485b0b[_0xc99a('0x33')][_0xc99a('0x3c')]);_0x26442d[_0xc99a('0x3f')]=qs[_0xc99a('0x35')](_[_0xc99a('0x3d')](_0x485b0b[_0xc99a('0x33')],_0xecc717[_0xc99a('0x35')]));if(_0x485b0b['query'][_0xc99a('0x3e')]){_0x26442d[_0xc99a('0x3f')]=_[_0xc99a('0x40')](_0x26442d['where'],{'$or':_[_0xc99a('0x32')](_0x26442d[_0xc99a('0x37')],function(_0x19af0d){var _0x29bb6f={};_0x29bb6f[_0x19af0d]={'$like':'%'+_0x485b0b[_0xc99a('0x33')]['filter']+'%'};return _0x29bb6f;})});}_0x26442d=_[_0xc99a('0x40')]({},_0x26442d,_0x485b0b[_0xc99a('0x42')]);return _0x48a29f[_0xc99a('0x6e')](_0x26442d);}})['then'](function(_0x3ca9d5){if(_0x3ca9d5){_0x54a5cc=_0x3ca9d5[_0xc99a('0x39')];if(!_0x485b0b[_0xc99a('0x33')][_0xc99a('0x3a')](_0xc99a('0x6f'))){_0x26442d['limit']=qs[_0xc99a('0x1c')](_0x485b0b[_0xc99a('0x33')][_0xc99a('0x1c')]);_0x26442d['offset']=qs['offset'](_0x485b0b['query'][_0xc99a('0x1a')]);}return _0x48a29f[_0xc99a('0x6e')](_0x26442d);}})[_0xc99a('0x24')](function(_0xfb8e90){if(_0xfb8e90){return _0xfb8e90?{'count':_0x54a5cc,'rows':_0xfb8e90}:null;}})['then'](respondWithResult(_0x16717e,null))[_0xc99a('0x46')](handleError(_0x16717e,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 14a845f..79e68fb 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 _0x4596=['../../config/logger','bluebird','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','lodash','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4596,0x193));var _0x6459=function(_0x3151d2,_0x297560){_0x3151d2=_0x3151d2-0x0;var _0x31a8e8=_0x4596[_0x3151d2];return _0x31a8e8;};'use strict';var _=require(_0x6459('0x0'));var util=require(_0x6459('0x1'));var logger=require(_0x6459('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6459('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6459('0x4'));var config=require(_0x6459('0x5'));var attributes=require(_0x6459('0x6'));module[_0x6459('0x7')]=function(_0x4334e6,_0x5ec9b2){return _0x4334e6['define'](_0x6459('0x8'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e9=['rimraf','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','api','moment','bluebird','request-promise','path'];(function(_0xc62bf2,_0x501bc8){var _0x32ff5a=function(_0x5485c9){while(--_0x5485c9){_0xc62bf2['push'](_0xc62bf2['shift']());}};_0x32ff5a(++_0x501bc8);}(_0x34e9,0x102));var _0x934e=function(_0x3a2272,_0x369778){_0x3a2272=_0x3a2272-0x0;var _0x3e29f6=_0x34e9[_0x3a2272];return _0x3e29f6;};'use strict';var _=require(_0x934e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x934e('0x1'));var moment=require(_0x934e('0x2'));var BPromise=require(_0x934e('0x3'));var rp=require(_0x934e('0x4'));var fs=require('fs');var path=require(_0x934e('0x5'));var rimraf=require(_0x934e('0x6'));var config=require('../../config/environment');var attributes=require(_0x934e('0x7'));module['exports']=function(_0x24e20b,_0x546fbe){return _0x24e20b[_0x934e('0x8')](_0x934e('0x9'),attributes,{'tableName':_0x934e('0xa'),'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 f1d65d6..dbf2c12 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4d1d47,_0x3e8362){var _0x936764=function(_0x5f597a){while(--_0x5f597a){_0x4d1d47['push'](_0x4d1d47['shift']());}};_0x936764(++_0x3e8362);}(_0xe706,0xa3));var _0x6e70=function(_0x44799d,_0x26c23a){_0x44799d=_0x44799d-0x0;var _0x4f4a20=_0xe706[_0x44799d];return _0x4f4a20;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x3676c1,_0x33401f){var _0x28de24=function(_0x539c9d){while(--_0x539c9d){_0x3676c1['push'](_0x3676c1['shift']());}};_0x28de24(++_0x33401f);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index ef05bb2..61b2a55 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 _0x2392=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getAgents','/:id/teams','getTeams','post','/:id/users','addAgents','put','update','delete','destroy','exports'];(function(_0x746a99,_0x55ef7a){var _0x33444e=function(_0x4dda3c){while(--_0x4dda3c){_0x746a99['push'](_0x746a99['shift']());}};_0x33444e(++_0x55ef7a);}(_0x2392,0xd0));var _0x2239=function(_0xbf201d,_0x6bfda8){_0xbf201d=_0xbf201d-0x0;var _0x24430e=_0x2392[_0xbf201d];return _0x24430e;};'use strict';var multer=require(_0x2239('0x0'));var util=require(_0x2239('0x1'));var path=require('path');var timeout=require(_0x2239('0x2'));var express=require(_0x2239('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2239('0x4'));var interaction=require(_0x2239('0x5'));var config=require(_0x2239('0x6'));var controller=require(_0x2239('0x7'));router[_0x2239('0x8')]('/',auth[_0x2239('0x9')](),controller[_0x2239('0xa')]);router[_0x2239('0x8')](_0x2239('0xb'),auth[_0x2239('0x9')](),controller[_0x2239('0xc')]);router[_0x2239('0x8')](_0x2239('0xd'),auth['isAuthenticated'](),controller[_0x2239('0xe')]);router[_0x2239('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x2239('0xf')]);router[_0x2239('0x8')](_0x2239('0x10'),auth[_0x2239('0x9')](),controller[_0x2239('0x11')]);router[_0x2239('0x12')]('/',auth[_0x2239('0x9')](),controller['create']);router[_0x2239('0x12')](_0x2239('0x13'),auth['isAuthenticated'](),controller[_0x2239('0x14')]);router[_0x2239('0x12')](_0x2239('0x10'),auth[_0x2239('0x9')](),controller['addTeams']);router[_0x2239('0x15')]('/:id',auth[_0x2239('0x9')](),controller[_0x2239('0x16')]);router[_0x2239('0x17')](_0x2239('0xd'),auth['isAuthenticated'](),controller[_0x2239('0x18')]);router[_0x2239('0x17')]('/:id/users',auth[_0x2239('0x9')](),controller['removeAgents']);router[_0x2239('0x17')]('/:id/teams',auth[_0x2239('0x9')](),controller['removeTeams']);module[_0x2239('0x19')]=router; \ No newline at end of file +var _0xd217=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','/:id/teams','getTeams','post','create','addTeams','put','delete','util'];(function(_0x249ff,_0x399e5d){var _0x492a70=function(_0x54b1b5){while(--_0x54b1b5){_0x249ff['push'](_0x249ff['shift']());}};_0x492a70(++_0x399e5d);}(_0xd217,0x141));var _0x7d21=function(_0x175c12,_0x36c1fe){_0x175c12=_0x175c12-0x0;var _0x536416=_0xd217[_0x175c12];return _0x536416;};'use strict';var multer=require('multer');var util=require(_0x7d21('0x0'));var path=require(_0x7d21('0x1'));var timeout=require('connect-timeout');var express=require(_0x7d21('0x2'));var router=express[_0x7d21('0x3')]();var fs_extra=require(_0x7d21('0x4'));var auth=require(_0x7d21('0x5'));var interaction=require(_0x7d21('0x6'));var config=require(_0x7d21('0x7'));var controller=require(_0x7d21('0x8'));router[_0x7d21('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7d21('0x9')](_0x7d21('0xa'),auth[_0x7d21('0xb')](),controller[_0x7d21('0xc')]);router[_0x7d21('0x9')](_0x7d21('0xd'),auth[_0x7d21('0xb')](),controller[_0x7d21('0xe')]);router[_0x7d21('0x9')](_0x7d21('0xf'),auth[_0x7d21('0xb')](),controller['getAgents']);router['get'](_0x7d21('0x10'),auth['isAuthenticated'](),controller[_0x7d21('0x11')]);router[_0x7d21('0x12')]('/',auth['isAuthenticated'](),controller[_0x7d21('0x13')]);router[_0x7d21('0x12')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x7d21('0x12')]('/:id/teams',auth[_0x7d21('0xb')](),controller[_0x7d21('0x14')]);router[_0x7d21('0x15')](_0x7d21('0xd'),auth[_0x7d21('0xb')](),controller['update']);router[_0x7d21('0x16')](_0x7d21('0xd'),auth[_0x7d21('0xb')](),controller['destroy']);router[_0x7d21('0x16')](_0x7d21('0xf'),auth[_0x7d21('0xb')](),controller['removeAgents']);router[_0x7d21('0x16')](_0x7d21('0x10'),auth[_0x7d21('0xb')](),controller['removeTeams']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 59ec887..dcff6dd 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 _0x67d0=['name','VIRTUAL','system-','getDataValue','INTEGER','STRING'];(function(_0x12c60c,_0x12cfde){var _0x2b2d52=function(_0x1f2d38){while(--_0x1f2d38){_0x12c60c['push'](_0x12c60c['shift']());}};_0x2b2d52(++_0x12cfde);}(_0x67d0,0xbf));var _0x067d=function(_0x7b963e,_0x1ad7a6){_0x7b963e=_0x7b963e-0x0;var _0x42b65f=_0x67d0[_0x7b963e];return _0x42b65f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x067d('0x0')],'allowNull':![],'unique':_0x067d('0x1')},'prefix':{'type':Sequelize[_0x067d('0x2')],'get':function(_0x10243e){return _0x067d('0x3')+this[_0x067d('0x4')](_0x067d('0x1'))+'-';}},'description':{'type':Sequelize[_0x067d('0x0')]},'callerIdAll':{'type':Sequelize[_0x067d('0x0')]},'VoiceExtensionId':{'type':Sequelize[_0x067d('0x5')]}}; \ No newline at end of file +var _0x4e2c=['exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize'];(function(_0xd2b635,_0x67a08e){var _0x363403=function(_0x11ee33){while(--_0x11ee33){_0xd2b635['push'](_0xd2b635['shift']());}};_0x363403(++_0x67a08e);}(_0x4e2c,0x167));var _0xc4e2=function(_0x5584d3,_0xb3cf83){_0x5584d3=_0x5584d3-0x0;var _0x3166ef=_0x4e2c[_0x5584d3];return _0x3166ef;};'use strict';var Sequelize=require(_0xc4e2('0x0'));module[_0xc4e2('0x1')]={'name':{'type':Sequelize[_0xc4e2('0x2')],'allowNull':![],'unique':_0xc4e2('0x3')},'prefix':{'type':Sequelize[_0xc4e2('0x4')],'get':function(_0x40de8d){return _0xc4e2('0x5')+this[_0xc4e2('0x6')](_0xc4e2('0x3'))+'-';}},'description':{'type':Sequelize[_0xc4e2('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xc4e2('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index d1e804e..d93d5d9 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 _0x1c7c=['isArray','userVoicePrefix:remove','getAgents','findOne','keys','User','order','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','value','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoicePrefix','includeAll','findAll','rows','catch','show','include','find','describe','sequelize','transaction','create','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','addAgents','params','omit','ids','emit','userVoicePrefix:save','removeAgents'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1c7c,0x164));var _0xc1c7=function(_0x106c66,_0x418ee1){_0x106c66=_0x106c66-0x0;var _0x3240f1=_0x1c7c[_0x106c66];return _0x3240f1;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];config[_0xc1c7('0x1b')]=_[_0xc1c7('0x1c')](config[_0xc1c7('0x1b')],{'host':_0xc1c7('0x1d'),'port':0x18eb});var socket=require(_0xc1c7('0x1e'))(new Redis(config[_0xc1c7('0x1b')]));require(_0xc1c7('0x1f'))[_0xc1c7('0x20')](socket);function respondWithStatusCode(_0x1b6905,_0x99b874){_0x99b874=_0x99b874||0xcc;return function(_0x34d392){if(_0x34d392){return _0x1b6905['sendStatus'](_0x99b874);}return _0x1b6905[_0xc1c7('0x21')](_0x99b874)[_0xc1c7('0x22')]();};}function respondWithResult(_0x21911c,_0x555b59){_0x555b59=_0x555b59||0xc8;return function(_0x94678a){if(_0x94678a){return _0x21911c[_0xc1c7('0x21')](_0x555b59)[_0xc1c7('0x23')](_0x94678a);}};}function respondWithFilteredResult(_0x39ac54,_0x20439e){return function(_0xb42702){if(_0xb42702){var _0x21758a=typeof _0x20439e[_0xc1c7('0x24')]==='undefined'&&typeof _0x20439e[_0xc1c7('0x25')]===_0xc1c7('0x26');var _0x3ec66a=_0xb42702[_0xc1c7('0x27')];var _0x4b706e=_0x21758a?0x0:_0x20439e[_0xc1c7('0x24')];var _0x4d6171=_0x21758a?_0xb42702[_0xc1c7('0x27')]:_0x20439e[_0xc1c7('0x24')]+_0x20439e['limit'];var _0x5846f0;if(_0x4d6171>=_0x3ec66a){_0x4d6171=_0x3ec66a;_0x5846f0=0xc8;}else{_0x5846f0=0xce;}_0x39ac54[_0xc1c7('0x21')](_0x5846f0);return _0x39ac54[_0xc1c7('0x28')](_0xc1c7('0x29'),_0x4b706e+'-'+_0x4d6171+'/'+_0x3ec66a)['json'](_0xb42702);}return null;};}function patchUpdates(_0x813853){return function(_0x341b41){try{jsonpatch[_0xc1c7('0x2a')](_0x341b41,_0x813853,!![]);}catch(_0x31a0e0){return BPromise[_0xc1c7('0x2b')](_0x31a0e0);}return _0x341b41[_0xc1c7('0x2c')]();};}function saveUpdates(_0x3180fd,_0x120168){return function(_0x22b654){if(_0x22b654){return _0x22b654[_0xc1c7('0x2d')](_0x3180fd)[_0xc1c7('0x2e')](function(_0x363fbc){return _0x363fbc;});}return null;};}function removeEntity(_0x33aac7,_0x260a3f){return function(_0xf1c405){if(_0xf1c405){return _0xf1c405[_0xc1c7('0x2f')]()['then'](function(){var _0xf0ab9c=_0xf1c405[_0xc1c7('0x30')]({'plain':!![]});var _0x4e1721='VoicePrefixes';return db[_0xc1c7('0x31')]['destroy']({'where':{'type':_0x4e1721,'resourceId':_0xf0ab9c['id']}})['then'](function(){return _0xf1c405;});})[_0xc1c7('0x2e')](function(){_0x33aac7[_0xc1c7('0x21')](0xcc)[_0xc1c7('0x22')]();});}};}function handleEntityNotFound(_0x243450,_0x461360){return function(_0x4adb81){if(!_0x4adb81){_0x243450['sendStatus'](0x194);}return _0x4adb81;};}function handleError(_0x1b6f97,_0x4275f9){_0x4275f9=_0x4275f9||0x1f4;return function(_0x9a0ab3){logger[_0xc1c7('0x32')](_0x9a0ab3[_0xc1c7('0x33')]);if(_0x9a0ab3['name']){delete _0x9a0ab3['name'];}_0x1b6f97[_0xc1c7('0x21')](_0x4275f9)[_0xc1c7('0x34')](_0x9a0ab3);};}exports['index']=function(_0x41b154,_0x3cf425){var _0x39b68c={},_0x1f9708={},_0x74b523={'count':0x0,'rows':[]};var _0x2d69d3=_[_0xc1c7('0x35')](db['VoicePrefix'][_0xc1c7('0x36')],function(_0xeac123){return{'name':_0xeac123[_0xc1c7('0x37')],'type':_0xeac123[_0xc1c7('0x38')][_0xc1c7('0x39')]};});_0x1f9708[_0xc1c7('0x3a')]=_[_0xc1c7('0x35')](_0x2d69d3,_0xc1c7('0x3b'));_0x1f9708[_0xc1c7('0x3c')]=_['keys'](_0x41b154['query']);_0x1f9708[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x1f9708[_0xc1c7('0x3a')],_0x1f9708[_0xc1c7('0x3c')]);_0x39b68c[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x1f9708[_0xc1c7('0x3a')],qs[_0xc1c7('0x40')](_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x40')]));_0x39b68c[_0xc1c7('0x3f')]=_0x39b68c[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x39b68c[_0xc1c7('0x3f')]:_0x1f9708[_0xc1c7('0x3a')];if(!_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x39b68c[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x41b154[_0xc1c7('0x3c')]['limit']);_0x39b68c['offset']=qs['offset'](_0x41b154[_0xc1c7('0x3c')]['offset']);}_0x39b68c['order']=qs[_0xc1c7('0x44')](_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x44')]);_0x39b68c[_0xc1c7('0x45')]=qs['filters'](_[_0xc1c7('0x46')](_0x41b154[_0xc1c7('0x3c')],_0x1f9708[_0xc1c7('0x3d')]),_0x2d69d3);if(_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x47')]){_0x39b68c[_0xc1c7('0x45')]=_[_0xc1c7('0x48')](_0x39b68c[_0xc1c7('0x45')],{'$or':_[_0xc1c7('0x35')](_0x2d69d3,function(_0x1810c7){if(_0x1810c7[_0xc1c7('0x38')]!==_0xc1c7('0x49')){var _0x23d0b2={};_0x23d0b2[_0x1810c7['name']]={'$like':'%'+_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x47')]+'%'};return _0x23d0b2;}})});}_0x39b68c=_['merge']({},_0x39b68c,_0x41b154[_0xc1c7('0x4a')]);var _0x23b10b={'where':_0x39b68c[_0xc1c7('0x45')]};return db[_0xc1c7('0x4b')][_0xc1c7('0x27')](_0x23b10b)[_0xc1c7('0x2e')](function(_0xd5e06a){_0x74b523[_0xc1c7('0x27')]=_0xd5e06a;if(_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x4c')]){_0x39b68c['include']=[{'all':!![]}];}return db[_0xc1c7('0x4b')][_0xc1c7('0x4d')](_0x39b68c);})['then'](function(_0x4c6834){_0x74b523[_0xc1c7('0x4e')]=_0x4c6834;return _0x74b523;})[_0xc1c7('0x2e')](respondWithFilteredResult(_0x3cf425,_0x39b68c))[_0xc1c7('0x4f')](handleError(_0x3cf425,null));};exports[_0xc1c7('0x50')]=function(_0x429221,_0x51a33f){var _0x1eca39={'raw':![],'where':{'id':_0x429221['params']['id']}},_0x805dac={};_0x805dac['model']=_['keys'](db[_0xc1c7('0x4b')][_0xc1c7('0x36')]);_0x805dac[_0xc1c7('0x3c')]=_['keys'](_0x429221[_0xc1c7('0x3c')]);_0x805dac[_0xc1c7('0x3d')]=_['intersection'](_0x805dac[_0xc1c7('0x3a')],_0x805dac[_0xc1c7('0x3c')]);_0x1eca39[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x805dac[_0xc1c7('0x3a')],qs[_0xc1c7('0x40')](_0x429221[_0xc1c7('0x3c')][_0xc1c7('0x40')]));_0x1eca39[_0xc1c7('0x3f')]=_0x1eca39[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x1eca39[_0xc1c7('0x3f')]:_0x805dac[_0xc1c7('0x3a')];if(_0x429221[_0xc1c7('0x3c')][_0xc1c7('0x4c')]){_0x1eca39[_0xc1c7('0x51')]=[{'all':!![]}];}_0x1eca39=_[_0xc1c7('0x48')]({},_0x1eca39,_0x429221[_0xc1c7('0x4a')]);return db['VoicePrefix'][_0xc1c7('0x52')](_0x1eca39)['then'](handleEntityNotFound(_0x51a33f,null))[_0xc1c7('0x2e')](respondWithResult(_0x51a33f,null))[_0xc1c7('0x4f')](handleError(_0x51a33f,null));};exports[_0xc1c7('0x2f')]=function(_0x524088,_0x473e8d){return db[_0xc1c7('0x4b')]['find']({'where':{'id':_0x524088['params']['id']}})['then'](handleEntityNotFound(_0x473e8d,null))[_0xc1c7('0x2e')](removeEntity(_0x473e8d,null))[_0xc1c7('0x4f')](handleError(_0x473e8d,null));};exports['describe']=function(_0x49542,_0x12a1d2){return db[_0xc1c7('0x4b')][_0xc1c7('0x53')]()[_0xc1c7('0x2e')](respondWithResult(_0x12a1d2,null))[_0xc1c7('0x4f')](handleError(_0x12a1d2,null));};exports['create']=function(_0x259e55,_0x568377){var _0x307b5e;return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0x557cb6){return db[_0xc1c7('0x4b')][_0xc1c7('0x56')](_0x259e55[_0xc1c7('0x57')],{'transaction':_0x557cb6})[_0xc1c7('0x2e')](function(_0x1679c5){_0x307b5e=_0x1679c5[_0xc1c7('0x30')]({'plain':!![]});return db[_0xc1c7('0x58')][_0xc1c7('0x52')]({'where':{'id':_0x307b5e['VoiceExtensionId']},'raw':!![]})[_0xc1c7('0x2e')](function(_0x2a8664){return createVoicePrefixExtensions(_0x307b5e,_0x2a8664,_0x557cb6);});});})[_0xc1c7('0x2e')](function(){var _0x575fc5=_0x259e55['user'][_0xc1c7('0x30')]({'plain':!![]});if(!_0x575fc5)throw new Error(_0xc1c7('0x59'));if(_0x575fc5[_0xc1c7('0x5a')]==='user'){var _0x1c636c=_0x307b5e;return db['UserProfileSection'][_0xc1c7('0x52')]({'where':{'name':_0xc1c7('0x5b'),'userProfileId':_0x575fc5[_0xc1c7('0x5c')]},'raw':!![]})[_0xc1c7('0x2e')](function(_0x345a46){if(_0x345a46&&_0x345a46[_0xc1c7('0x5d')]===0x0){return db[_0xc1c7('0x31')]['create']({'name':_0x1c636c[_0xc1c7('0x3b')],'resourceId':_0x1c636c['id'],'type':_0x345a46[_0xc1c7('0x3b')],'sectionId':_0x345a46['id']},{})[_0xc1c7('0x2e')](function(){return _0x307b5e;});}else{return _0x307b5e;}})['catch'](function(_0x24fa71){logger['error'](_0xc1c7('0x5e'),_0x24fa71);throw _0x24fa71;});}return _0x307b5e;})['then'](respondWithResult(_0x568377,null))[_0xc1c7('0x4f')](handleError(_0x568377,null));};function Extension(_0x212d53,_0x314232,_0x3a94fb,_0x156d51){this['context']='from-sip';this['exten']=_0x212d53;this[_0xc1c7('0x5f')]=_0x3a94fb;this[_0xc1c7('0x38')]=_0xc1c7('0x60');this[_0xc1c7('0x61')]=_0xc1c7('0x62');this[_0xc1c7('0x63')]=_0x314232;this['appdata']=_0x156d51;}function createVoicePrefixExtensions(_0x19b8d7,_0xe5882,_0x1c010a){return new BPromise(function(_0x6e300e,_0x5f4f7a){var _0x2e4673=new Extension(formatPrefixName(_0x19b8d7[_0xc1c7('0x64')]),0x1,_0xc1c7('0x65'),'Voice\x20Prefix');_0x2e4673[_0xc1c7('0x66')]=_0x19b8d7['id'];return db[_0xc1c7('0x58')][_0xc1c7('0x56')](_0x2e4673,{'transaction':_0x1c010a})[_0xc1c7('0x2e')](function(_0x58b08b){var _0x552691=_0x58b08b[_0xc1c7('0x30')]({'plain':!![]});var _0x203790=_['map'](addVoicePrefixExtensions(_0x19b8d7,_0xe5882),function(_0x46dc1e){_0x46dc1e[_0xc1c7('0x67')]=_0x552691['id'];_0x46dc1e['VoicePrefixId']=_0x19b8d7['id'];return _0x46dc1e;});return db[_0xc1c7('0x58')][_0xc1c7('0x68')](_0x203790,{'transaction':_0x1c010a})['then'](function(_0x6b9337){if(!_0x6b9337){return _0x5f4f7a(_0xc1c7('0x69'));}else{return _0x6e300e(_0x6b9337);}})[_0xc1c7('0x4f')](function(_0x2b4db2){return _0x5f4f7a(_0x2b4db2);});});;});};function addVoicePrefixExtensions(_0x1087b2,_0x11c9d8){var _0x1ed9fc=[];var _0x33104e=formatPrefixName(_0x1087b2[_0xc1c7('0x64')]);_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x2,_0xc1c7('0x6b'),_0xc1c7('0x6c')+_0x1087b2[_0xc1c7('0x3b')]));if(_0x1087b2[_0xc1c7('0x6d')]){_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x3,_0xc1c7('0x6b'),_0xc1c7('0x6e')+_0x1087b2[_0xc1c7('0x6d')]));}else{_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x3,_0xc1c7('0x65'),_0xc1c7('0x6f')));}_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x4,_0xc1c7('0x70'),_0x11c9d8[_0xc1c7('0x71')]+','+_0xc1c7('0x72')+(0x8+_0x1087b2[_0xc1c7('0x3b')][_0xc1c7('0x41')])+'}'+','+0x1));return _0x1ed9fc;}function formatPrefixName(_0x1448d8){var _0x47d58e='_';for(var _0x8c88c0=0x0;_0x8c88c0<_0x1448d8[_0xc1c7('0x41')];_0x8c88c0++){if(_0x1448d8[_0xc1c7('0x73')](_0x8c88c0)=='-'){_0x47d58e+=_0x1448d8[_0xc1c7('0x73')](_0x8c88c0);}else{_0x47d58e+='['+_0x1448d8[_0xc1c7('0x73')](_0x8c88c0)+']';}}_0x47d58e+='.';return _0x47d58e;}exports[_0xc1c7('0x2d')]=function(_0x1ccd7d,_0x29181f,_0x5f4f50){var _0xbbd4e3=_0x1ccd7d[_0xc1c7('0x57')];_0xbbd4e3[_0xc1c7('0x64')]=_0xc1c7('0x74')+_0xbbd4e3[_0xc1c7('0x3b')]+'-';return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0xa00af6){return db['VoicePrefix'][_0xc1c7('0x2d')](_0xbbd4e3,{'where':{'id':_0xbbd4e3['id']},'transaction':_0xa00af6})[_0xc1c7('0x2e')](function(){return db[_0xc1c7('0x58')][_0xc1c7('0x2f')]({'where':{'VoicePrefixId':_0xbbd4e3['id']},'transaction':_0xa00af6})[_0xc1c7('0x2e')](function(){return db[_0xc1c7('0x58')][_0xc1c7('0x52')]({'where':{'id':_0xbbd4e3[_0xc1c7('0x67')]},'raw':!![]})[_0xc1c7('0x2e')](function(_0x125270){return createVoicePrefixExtensions(_0xbbd4e3,_0x125270,_0xa00af6);});});});})[_0xc1c7('0x2e')](function(){return db[_0xc1c7('0x4b')]['findById'](_0xbbd4e3['id']);})['then'](respondWithResult(_0x29181f,null))[_0xc1c7('0x4f')](handleError(_0x29181f,null));};exports[_0xc1c7('0x75')]=function(_0xc16f09,_0x11fd01,_0x44a24b){return db[_0xc1c7('0x4b')][_0xc1c7('0x52')]({'where':{'id':_0xc16f09[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x11fd01,null))[_0xc1c7('0x2e')](function(_0x180607){if(_0x180607){return _0x180607[_0xc1c7('0x75')](_0xc16f09[_0xc1c7('0x57')]['ids'],_[_0xc1c7('0x77')](_0xc16f09[_0xc1c7('0x57')],[_0xc1c7('0x78'),'id'])||{})['spread'](function(_0x4de022){for(var _0x550c4a=0x0;_0x550c4a<_0xc16f09[_0xc1c7('0x57')][_0xc1c7('0x78')]['length'];_0x550c4a+=0x1){socket[_0xc1c7('0x79')](_0xc1c7('0x7a'),{'UserId':Number(_0xc16f09['body']['ids'][_0x550c4a]),'VoicePrefixId':Number(_0xc16f09['params']['id'])});}return _0x4de022;});}})[_0xc1c7('0x2e')](respondWithResult(_0x11fd01,null))['catch'](handleError(_0x11fd01,null));};exports[_0xc1c7('0x7b')]=function(_0x3bc3aa,_0xf899a,_0x4b7a34){return db[_0xc1c7('0x4b')]['find']({'where':{'id':_0x3bc3aa[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0xf899a,null))['then'](function(_0xf7b22e){if(_0xf7b22e){return _0xf7b22e[_0xc1c7('0x7b')](_0x3bc3aa[_0xc1c7('0x3c')][_0xc1c7('0x78')])[_0xc1c7('0x2e')](function(){if(_[_0xc1c7('0x7c')](_0x3bc3aa[_0xc1c7('0x3c')][_0xc1c7('0x78')])){for(var _0x425f3d=0x0;_0x425f3d<_0x3bc3aa[_0xc1c7('0x3c')]['ids'][_0xc1c7('0x41')];_0x425f3d+=0x1){socket[_0xc1c7('0x79')](_0xc1c7('0x7d'),{'UserId':Number(_0x3bc3aa[_0xc1c7('0x3c')]['ids'][_0x425f3d]),'VoicePrefixId':Number(_0x3bc3aa[_0xc1c7('0x76')]['id'])});}}else{socket[_0xc1c7('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x3bc3aa['query'][_0xc1c7('0x78')]),'VoicePrefixId':Number(_0x3bc3aa[_0xc1c7('0x76')]['id'])});}});}})[_0xc1c7('0x2e')](respondWithStatusCode(_0xf899a,null))[_0xc1c7('0x4f')](handleError(_0xf899a,null));};exports[_0xc1c7('0x7e')]=function(_0x176603,_0x48309e,_0x1f0c3f){var _0x2ad4f5={};var _0x5698e9={};var _0x65161e;var _0x32c26e;return db[_0xc1c7('0x4b')][_0xc1c7('0x7f')]({'where':{'id':_0x176603[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x48309e,null))[_0xc1c7('0x2e')](function(_0x175bba){if(_0x175bba){_0x65161e=_0x175bba;_0x5698e9[_0xc1c7('0x3a')]=_[_0xc1c7('0x80')](db[_0xc1c7('0x81')][_0xc1c7('0x36')]);_0x5698e9[_0xc1c7('0x3c')]=_[_0xc1c7('0x80')](_0x176603['query']);_0x5698e9[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x5698e9[_0xc1c7('0x3a')],_0x5698e9[_0xc1c7('0x3c')]);_0x2ad4f5[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x5698e9['model'],qs[_0xc1c7('0x40')](_0x176603[_0xc1c7('0x3c')]['fields']));_0x2ad4f5['attributes']=_0x2ad4f5[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x2ad4f5[_0xc1c7('0x3f')]:_0x5698e9[_0xc1c7('0x3a')];_0x2ad4f5[_0xc1c7('0x82')]=qs[_0xc1c7('0x44')](_0x176603['query'][_0xc1c7('0x44')]);_0x2ad4f5[_0xc1c7('0x45')]=qs[_0xc1c7('0x3d')](_[_0xc1c7('0x46')](_0x176603['query'],_0x5698e9[_0xc1c7('0x3d')]));if(_0x176603['query'][_0xc1c7('0x47')]){_0x2ad4f5['where']=_[_0xc1c7('0x48')](_0x2ad4f5[_0xc1c7('0x45')],{'$or':_['map'](_0x2ad4f5[_0xc1c7('0x3f')],function(_0x30e6ca){var _0x44aee1={};_0x44aee1[_0x30e6ca]={'$like':'%'+_0x176603[_0xc1c7('0x3c')][_0xc1c7('0x47')]+'%'};return _0x44aee1;})});}_0x2ad4f5=_[_0xc1c7('0x48')]({},_0x2ad4f5,_0x176603[_0xc1c7('0x4a')]);return _0x65161e[_0xc1c7('0x7e')](_0x2ad4f5);}})[_0xc1c7('0x2e')](function(_0xe1e5dd){if(_0xe1e5dd){_0x32c26e=_0xe1e5dd[_0xc1c7('0x41')];if(!_0x176603[_0xc1c7('0x3c')][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x2ad4f5[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x176603[_0xc1c7('0x3c')][_0xc1c7('0x25')]);_0x2ad4f5[_0xc1c7('0x24')]=qs['offset'](_0x176603['query']['offset']);}return _0x65161e[_0xc1c7('0x7e')](_0x2ad4f5);}})['then'](function(_0x49c29b){if(_0x49c29b){return _0x49c29b?{'count':_0x32c26e,'rows':_0x49c29b}:null;}})['then'](respondWithResult(_0x48309e,null))[_0xc1c7('0x4f')](handleError(_0x48309e,null));};exports[_0xc1c7('0x83')]=function(_0x56cd17,_0x5d60e8,_0x57b04b){var _0x238077={};var _0x454b0d={};var _0x20a948;var _0x18b20f;return db[_0xc1c7('0x4b')][_0xc1c7('0x7f')]({'where':{'id':_0x56cd17['params']['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x5d60e8,null))[_0xc1c7('0x2e')](function(_0x2b9cff){if(_0x2b9cff){_0x20a948=_0x2b9cff;_0x454b0d['model']=_[_0xc1c7('0x80')](db[_0xc1c7('0x84')][_0xc1c7('0x36')]);_0x454b0d['query']=_[_0xc1c7('0x80')](_0x56cd17[_0xc1c7('0x3c')]);_0x454b0d[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x454b0d[_0xc1c7('0x3a')],_0x454b0d[_0xc1c7('0x3c')]);_0x238077[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x454b0d['model'],qs['fields'](_0x56cd17[_0xc1c7('0x3c')][_0xc1c7('0x40')]));_0x238077[_0xc1c7('0x3f')]=_0x238077['attributes'][_0xc1c7('0x41')]?_0x238077[_0xc1c7('0x3f')]:_0x454b0d[_0xc1c7('0x3a')];_0x238077[_0xc1c7('0x82')]=qs[_0xc1c7('0x44')](_0x56cd17['query'][_0xc1c7('0x44')]);_0x238077[_0xc1c7('0x45')]=qs[_0xc1c7('0x3d')](_[_0xc1c7('0x46')](_0x56cd17[_0xc1c7('0x3c')],_0x454b0d[_0xc1c7('0x3d')]));if(_0x56cd17[_0xc1c7('0x3c')][_0xc1c7('0x47')]){_0x238077[_0xc1c7('0x45')]=_[_0xc1c7('0x48')](_0x238077[_0xc1c7('0x45')],{'$or':_[_0xc1c7('0x35')](_0x238077[_0xc1c7('0x3f')],function(_0x38e932){var _0x265a7a={};_0x265a7a[_0x38e932]={'$like':'%'+_0x56cd17['query'][_0xc1c7('0x47')]+'%'};return _0x265a7a;})});}_0x238077=_[_0xc1c7('0x48')]({},_0x238077,_0x56cd17[_0xc1c7('0x4a')]);return _0x20a948[_0xc1c7('0x83')](_0x238077);}})[_0xc1c7('0x2e')](function(_0x4855ba){if(_0x4855ba){_0x18b20f=_0x4855ba[_0xc1c7('0x41')];if(!_0x56cd17['query'][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x238077[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x56cd17['query'][_0xc1c7('0x25')]);_0x238077['offset']=qs[_0xc1c7('0x24')](_0x56cd17[_0xc1c7('0x3c')]['offset']);}return _0x20a948[_0xc1c7('0x83')](_0x238077);}})[_0xc1c7('0x2e')](function(_0x324a87){if(_0x324a87){return _0x324a87?{'count':_0x18b20f,'rows':_0x324a87}:null;}})['then'](respondWithResult(_0x5d60e8,null))[_0xc1c7('0x4f')](handleError(_0x5d60e8,null));};exports[_0xc1c7('0x85')]=function(_0x2b4a14,_0x18e4c4,_0x27edc3){var _0x4bae45=_0x2b4a14[_0xc1c7('0x57')]['ids'];var _0x183c59;return db['Team'][_0xc1c7('0x4d')]({'where':{'id':_0x4bae45},'attributes':['id'],'include':[{'model':db[_0xc1c7('0x81')],'as':_0xc1c7('0x86'),'attributes':['id','name',_0xc1c7('0x87'),_0xc1c7('0x88'),_0xc1c7('0x89')],'raw':!![]}]})[_0xc1c7('0x2e')](function(_0x4ccff5){if(_0x4ccff5){_0x183c59=_0x4ccff5;var _0x287d57=_[_0xc1c7('0x8a')](_0x4ccff5,function(_0x1732a5){var _0x20dccd=_0x1732a5[_0xc1c7('0x30')]({'plain':!![]});return _0x20dccd[_0xc1c7('0x86')];});return db[_0xc1c7('0x4b')][_0xc1c7('0x52')]({'where':{'id':_0x2b4a14[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](function(_0x45e974){return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0x4d78b8){return _0x45e974[_0xc1c7('0x85')](_0x4bae45,{'transaction':_0x4d78b8})[_0xc1c7('0x2e')](function(){return BPromise['each'](_0x183c59,function(_0x125085){return db[_0xc1c7('0x8b')][_0xc1c7('0x8c')]({'TeamId':_0x125085['id'],'VoicePrefixId':_0x2b4a14[_0xc1c7('0x76')]['id']},{'transaction':_0x4d78b8});});})[_0xc1c7('0x2e')](function(){return BPromise[_0xc1c7('0x8d')](_0x287d57,function(_0x846c80){return db['UserVoicePrefix'][_0xc1c7('0x8e')]({'where':{'UserId':_0x846c80['id'],'VoicePrefixId':_0x2b4a14[_0xc1c7('0x76')]['id']},'transaction':_0x4d78b8});});})[_0xc1c7('0x2e')](function(){_0x287d57[_0xc1c7('0x8f')](function(_0x2a5267){socket['emit'](_0xc1c7('0x7a'),{'UserId':_0x2a5267['id'],'VoicePrefixId':_0x45e974['id']});});});});});}})[_0xc1c7('0x2e')](respondWithStatusCode(_0x18e4c4,null))[_0xc1c7('0x4f')](handleError(_0x18e4c4,null));};exports[_0xc1c7('0x90')]=function(_0x1bed9e,_0x39997a,_0x1273ae){return db['Team'][_0xc1c7('0x4d')]({'where':{'id':_0x1bed9e[_0xc1c7('0x3c')][_0xc1c7('0x78')]},'attributes':['id'],'include':[{'model':db[_0xc1c7('0x81')],'as':_0xc1c7('0x86'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x39997a,null))[_0xc1c7('0x2e')](function(_0x1e7149){var _0x23d84c=_[_0xc1c7('0x35')](_0x1e7149,'id');var _0x22052c=[];var _0x2ca2c1=[];var _0x1f926a=squel[_0xc1c7('0x91')]();_0x1f926a['field'](_0xc1c7('0x92'))[_0xc1c7('0x93')](_0xc1c7('0x94'),'tq')['join'](_0xc1c7('0x95'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc1c7('0x45')](_0xc1c7('0x96'),_0x1bed9e[_0xc1c7('0x76')]['id']);for(var _0x146e74=0x0;_0x146e74<_0x1e7149[_0xc1c7('0x41')];_0x146e74+=0x1){let _0x3f10ac=_0x1e7149[_0x146e74];for(var _0x3a5abd=0x0;_0x3a5abd<_0x3f10ac[_0xc1c7('0x86')][_0xc1c7('0x41')];_0x3a5abd+=0x1){let _0x494ba4=_0x3f10ac[_0xc1c7('0x86')][_0x3a5abd];var _0x4fead5=_0x1f926a[_0xc1c7('0x97')]();_0x4fead5[_0xc1c7('0x45')](_0xc1c7('0x98'),_0x494ba4['id']);_0x2ca2c1[_0xc1c7('0x6a')](db[_0xc1c7('0x54')][_0xc1c7('0x3c')](_0x4fead5[_0xc1c7('0x99')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xc1c7('0x2e')](function(_0x198e78){if(_0x198e78[_0xc1c7('0x41')]===0x1){return _0x494ba4['id'];}else{var _0xde9a91=_[_0xc1c7('0x9a')](_['map'](_0x198e78,_0xc1c7('0x9b')),function(_0x3d6078){return _[_0xc1c7('0x9c')](_0x23d84c,_0x3d6078);});if(_0xde9a91){return _0x494ba4['id'];}}}));}}return BPromise[_0xc1c7('0x9d')](_0x2ca2c1)[_0xc1c7('0x2e')](function(_0x3f0e2c){_0x22052c=_(_0x22052c)[_0xc1c7('0x9e')](_0x3f0e2c)['compact']()[_0xc1c7('0x9f')]();return db[_0xc1c7('0x4b')]['find']({'where':{'id':_0x1bed9e['params']['id']}})[_0xc1c7('0x2e')](function(_0x2801fb){return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0x43c3c3){return _0x2801fb[_0xc1c7('0x90')](_0x1bed9e[_0xc1c7('0x3c')][_0xc1c7('0x78')],{'transaction':_0x43c3c3})[_0xc1c7('0x2e')](function(){if(!_['isEmpty'](_0x22052c)){return _0x2801fb['removeAgents'](_0x22052c,{'transaction':_0x43c3c3});}})[_0xc1c7('0x2e')](function(){_0x22052c['forEach'](function(_0x479d8a){socket[_0xc1c7('0x79')](_0xc1c7('0x7d'),{'UserId':_0x479d8a,'VoicePrefixId':_0x2801fb['id']});});});});});});})[_0xc1c7('0x2e')](respondWithStatusCode(_0x39997a,null))[_0xc1c7('0x4f')](handleError(_0x39997a,null));}; \ No newline at end of file +var _0x58a4=['addAgents','omit','ids','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','getTeams','Team','User','Agents','online','voicePause','interface','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','keys','include','find','catch','describe','create','sequelize','transaction','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','body','system-','findById'];(function(_0x27f7b2,_0x432964){var _0x22454f=function(_0x37408d){while(--_0x37408d){_0x27f7b2['push'](_0x27f7b2['shift']());}};_0x22454f(++_0x432964);}(_0x58a4,0xbf));var _0x458a=function(_0x358125,_0x45326f){_0x358125=_0x358125-0x0;var _0x118f28=_0x58a4[_0x358125];return _0x118f28;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];config[_0x458a('0x1a')]=_[_0x458a('0x1b')](config[_0x458a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x458a('0x1a')]));require('./voicePrefix.socket')[_0x458a('0x1c')](socket);function respondWithStatusCode(_0x44f683,_0x10133b){_0x10133b=_0x10133b||0xcc;return function(_0x3b74f9){if(_0x3b74f9){return _0x44f683[_0x458a('0x1d')](_0x10133b);}return _0x44f683[_0x458a('0x1e')](_0x10133b)['end']();};}function respondWithResult(_0x4b26be,_0x5c7993){_0x5c7993=_0x5c7993||0xc8;return function(_0x2faf6a){if(_0x2faf6a){return _0x4b26be[_0x458a('0x1e')](_0x5c7993)[_0x458a('0x1f')](_0x2faf6a);}};}function respondWithFilteredResult(_0x5c5b41,_0x310569){return function(_0x260c87){if(_0x260c87){var _0x18504d=typeof _0x310569[_0x458a('0x20')]===_0x458a('0x21')&&typeof _0x310569['limit']==='undefined';var _0x178db9=_0x260c87['count'];var _0x3302b7=_0x18504d?0x0:_0x310569[_0x458a('0x20')];var _0x47a202=_0x18504d?_0x260c87[_0x458a('0x22')]:_0x310569['offset']+_0x310569[_0x458a('0x23')];var _0x1c79cb;if(_0x47a202>=_0x178db9){_0x47a202=_0x178db9;_0x1c79cb=0xc8;}else{_0x1c79cb=0xce;}_0x5c5b41['status'](_0x1c79cb);return _0x5c5b41[_0x458a('0x24')](_0x458a('0x25'),_0x3302b7+'-'+_0x47a202+'/'+_0x178db9)['json'](_0x260c87);}return null;};}function patchUpdates(_0xa6b8ff){return function(_0x5ad95a){try{jsonpatch[_0x458a('0x26')](_0x5ad95a,_0xa6b8ff,!![]);}catch(_0x5bca42){return BPromise[_0x458a('0x27')](_0x5bca42);}return _0x5ad95a['save']();};}function saveUpdates(_0x36b08e,_0x911eaf){return function(_0xcb0756){if(_0xcb0756){return _0xcb0756[_0x458a('0x28')](_0x36b08e)[_0x458a('0x29')](function(_0x19bd5){return _0x19bd5;});}return null;};}function removeEntity(_0x340375,_0x3012c7){return function(_0x1f2d0){if(_0x1f2d0){return _0x1f2d0[_0x458a('0x2a')]()[_0x458a('0x29')](function(){var _0x327fcb=_0x1f2d0[_0x458a('0x2b')]({'plain':!![]});var _0x5a55b7=_0x458a('0x2c');return db[_0x458a('0x2d')]['destroy']({'where':{'type':_0x5a55b7,'resourceId':_0x327fcb['id']}})['then'](function(){return _0x1f2d0;});})[_0x458a('0x29')](function(){_0x340375['status'](0xcc)[_0x458a('0x2e')]();});}};}function handleEntityNotFound(_0x29f9b5,_0x223f73){return function(_0x4a49e4){if(!_0x4a49e4){_0x29f9b5[_0x458a('0x1d')](0x194);}return _0x4a49e4;};}function handleError(_0x2531f7,_0x1426a8){_0x1426a8=_0x1426a8||0x1f4;return function(_0x562c36){logger['error'](_0x562c36[_0x458a('0x2f')]);if(_0x562c36['name']){delete _0x562c36[_0x458a('0x30')];}_0x2531f7['status'](_0x1426a8)[_0x458a('0x31')](_0x562c36);};}exports[_0x458a('0x32')]=function(_0x492843,_0x309a6a){var _0x269f53={},_0x625ae3={},_0x525caf={'count':0x0,'rows':[]};var _0x3371c3=_[_0x458a('0x33')](db[_0x458a('0x34')][_0x458a('0x35')],function(_0x5267fe){return{'name':_0x5267fe['fieldName'],'type':_0x5267fe[_0x458a('0x36')][_0x458a('0x37')]};});_0x625ae3[_0x458a('0x38')]=_[_0x458a('0x33')](_0x3371c3,_0x458a('0x30'));_0x625ae3[_0x458a('0x39')]=_['keys'](_0x492843[_0x458a('0x39')]);_0x625ae3[_0x458a('0x3a')]=_[_0x458a('0x3b')](_0x625ae3[_0x458a('0x38')],_0x625ae3[_0x458a('0x39')]);_0x269f53[_0x458a('0x3c')]=_[_0x458a('0x3b')](_0x625ae3[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x492843['query'][_0x458a('0x3d')]));_0x269f53[_0x458a('0x3c')]=_0x269f53[_0x458a('0x3c')][_0x458a('0x3e')]?_0x269f53[_0x458a('0x3c')]:_0x625ae3[_0x458a('0x38')];if(!_0x492843[_0x458a('0x39')][_0x458a('0x3f')](_0x458a('0x40'))){_0x269f53[_0x458a('0x23')]=qs[_0x458a('0x23')](_0x492843[_0x458a('0x39')][_0x458a('0x23')]);_0x269f53[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x492843['query'][_0x458a('0x20')]);}_0x269f53[_0x458a('0x41')]=qs[_0x458a('0x42')](_0x492843[_0x458a('0x39')][_0x458a('0x42')]);_0x269f53[_0x458a('0x43')]=qs[_0x458a('0x3a')](_[_0x458a('0x44')](_0x492843[_0x458a('0x39')],_0x625ae3[_0x458a('0x3a')]),_0x3371c3);if(_0x492843[_0x458a('0x39')]['filter']){_0x269f53[_0x458a('0x43')]=_[_0x458a('0x45')](_0x269f53['where'],{'$or':_[_0x458a('0x33')](_0x3371c3,function(_0x422b45){if(_0x422b45[_0x458a('0x36')]!=='VIRTUAL'){var _0x406312={};_0x406312[_0x422b45[_0x458a('0x30')]]={'$like':'%'+_0x492843[_0x458a('0x39')][_0x458a('0x46')]+'%'};return _0x406312;}})});}_0x269f53=_[_0x458a('0x45')]({},_0x269f53,_0x492843[_0x458a('0x47')]);var _0x21d2d4={'where':_0x269f53[_0x458a('0x43')]};return db['VoicePrefix'][_0x458a('0x22')](_0x21d2d4)[_0x458a('0x29')](function(_0x2b9030){_0x525caf['count']=_0x2b9030;if(_0x492843[_0x458a('0x39')][_0x458a('0x48')]){_0x269f53['include']=[{'all':!![]}];}return db[_0x458a('0x34')][_0x458a('0x49')](_0x269f53);})[_0x458a('0x29')](function(_0x36c391){_0x525caf[_0x458a('0x4a')]=_0x36c391;return _0x525caf;})['then'](respondWithFilteredResult(_0x309a6a,_0x269f53))['catch'](handleError(_0x309a6a,null));};exports[_0x458a('0x4b')]=function(_0x301e61,_0x33a31d){var _0x18e4e2={'raw':![],'where':{'id':_0x301e61[_0x458a('0x4c')]['id']}},_0x5afd24={};_0x5afd24[_0x458a('0x38')]=_['keys'](db[_0x458a('0x34')]['rawAttributes']);_0x5afd24[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x301e61[_0x458a('0x39')]);_0x5afd24['filters']=_[_0x458a('0x3b')](_0x5afd24[_0x458a('0x38')],_0x5afd24[_0x458a('0x39')]);_0x18e4e2['attributes']=_['intersection'](_0x5afd24[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x301e61[_0x458a('0x39')]['fields']));_0x18e4e2['attributes']=_0x18e4e2[_0x458a('0x3c')][_0x458a('0x3e')]?_0x18e4e2[_0x458a('0x3c')]:_0x5afd24[_0x458a('0x38')];if(_0x301e61[_0x458a('0x39')][_0x458a('0x48')]){_0x18e4e2[_0x458a('0x4e')]=[{'all':!![]}];}_0x18e4e2=_[_0x458a('0x45')]({},_0x18e4e2,_0x301e61[_0x458a('0x47')]);return db[_0x458a('0x34')][_0x458a('0x4f')](_0x18e4e2)[_0x458a('0x29')](handleEntityNotFound(_0x33a31d,null))[_0x458a('0x29')](respondWithResult(_0x33a31d,null))[_0x458a('0x50')](handleError(_0x33a31d,null));};exports[_0x458a('0x2a')]=function(_0x25b44c,_0x51669b){return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x25b44c[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x51669b,null))[_0x458a('0x29')](removeEntity(_0x51669b,null))['catch'](handleError(_0x51669b,null));};exports['describe']=function(_0x514d82,_0x2abf75){return db['VoicePrefix'][_0x458a('0x51')]()[_0x458a('0x29')](respondWithResult(_0x2abf75,null))[_0x458a('0x50')](handleError(_0x2abf75,null));};exports[_0x458a('0x52')]=function(_0xfa6e65,_0x5f0151){var _0x48f68e;return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x2587a1){return db[_0x458a('0x34')][_0x458a('0x52')](_0xfa6e65['body'],{'transaction':_0x2587a1})[_0x458a('0x29')](function(_0x4eed01){_0x48f68e=_0x4eed01[_0x458a('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x458a('0x4f')]({'where':{'id':_0x48f68e['VoiceExtensionId']},'raw':!![]})['then'](function(_0x4b9928){return createVoicePrefixExtensions(_0x48f68e,_0x4b9928,_0x2587a1);});});})[_0x458a('0x29')](function(){var _0x3eb267=_0xfa6e65['user'][_0x458a('0x2b')]({'plain':!![]});if(!_0x3eb267)throw new Error(_0x458a('0x55'));if(_0x3eb267[_0x458a('0x56')]==='user'){var _0x2c1230=_0x48f68e;return db[_0x458a('0x57')][_0x458a('0x4f')]({'where':{'name':_0x458a('0x2c'),'userProfileId':_0x3eb267[_0x458a('0x58')]},'raw':!![]})[_0x458a('0x29')](function(_0x597e74){if(_0x597e74&&_0x597e74[_0x458a('0x59')]===0x0){return db[_0x458a('0x2d')][_0x458a('0x52')]({'name':_0x2c1230[_0x458a('0x30')],'resourceId':_0x2c1230['id'],'type':_0x597e74[_0x458a('0x30')],'sectionId':_0x597e74['id']},{})[_0x458a('0x29')](function(){return _0x48f68e;});}else{return _0x48f68e;}})[_0x458a('0x50')](function(_0x3b6cf9){logger['error'](_0x458a('0x5a'),_0x3b6cf9);throw _0x3b6cf9;});}return _0x48f68e;})['then'](respondWithResult(_0x5f0151,null))[_0x458a('0x50')](handleError(_0x5f0151,null));};function Extension(_0x2921ba,_0x222aa4,_0x42b748,_0x4da240){this['context']=_0x458a('0x5b');this[_0x458a('0x5c')]=_0x2921ba;this[_0x458a('0x5d')]=_0x42b748;this[_0x458a('0x36')]=_0x458a('0x5e');this[_0x458a('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x458a('0x60')]=_0x222aa4;this[_0x458a('0x61')]=_0x4da240;}function createVoicePrefixExtensions(_0x4f6913,_0x18d83a,_0x47b334){return new BPromise(function(_0x425a0f,_0x338127){var _0xa37d44=new Extension(formatPrefixName(_0x4f6913[_0x458a('0x62')]),0x1,_0x458a('0x63'),_0x458a('0x64'));_0xa37d44[_0x458a('0x65')]=_0x4f6913['id'];return db[_0x458a('0x66')]['create'](_0xa37d44,{'transaction':_0x47b334})[_0x458a('0x29')](function(_0x3ed05d){var _0x5d41a2=_0x3ed05d[_0x458a('0x2b')]({'plain':!![]});var _0x3da617=_['map'](addVoicePrefixExtensions(_0x4f6913,_0x18d83a),function(_0xaf7b50){_0xaf7b50[_0x458a('0x67')]=_0x5d41a2['id'];_0xaf7b50['VoicePrefixId']=_0x4f6913['id'];return _0xaf7b50;});return db[_0x458a('0x66')][_0x458a('0x68')](_0x3da617,{'transaction':_0x47b334})['then'](function(_0x16f82f){if(!_0x16f82f){return _0x338127(_0x458a('0x69'));}else{return _0x425a0f(_0x16f82f);}})[_0x458a('0x50')](function(_0x404d93){return _0x338127(_0x404d93);});});;});};function addVoicePrefixExtensions(_0x541375,_0x27d1f2){var _0x4199a7=[];var _0x397595=formatPrefixName(_0x541375['prefix']);_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x2,_0x458a('0x6b'),_0x458a('0x6c')+_0x541375[_0x458a('0x30')]));if(_0x541375[_0x458a('0x6d')]){_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x3,_0x458a('0x6b'),_0x458a('0x6e')+_0x541375[_0x458a('0x6d')]));}else{_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x3,'NoOp',_0x458a('0x6f')));}_0x4199a7['push'](new Extension(_0x397595,0x4,_0x458a('0x70'),_0x27d1f2[_0x458a('0x71')]+','+_0x458a('0x72')+(0x8+_0x541375[_0x458a('0x30')][_0x458a('0x3e')])+'}'+','+0x1));return _0x4199a7;}function formatPrefixName(_0x3d1d37){var _0x2c6a00='_';for(var _0x3745d5=0x0;_0x3745d5<_0x3d1d37[_0x458a('0x3e')];_0x3745d5++){if(_0x3d1d37[_0x458a('0x73')](_0x3745d5)=='-'){_0x2c6a00+=_0x3d1d37[_0x458a('0x73')](_0x3745d5);}else{_0x2c6a00+='['+_0x3d1d37[_0x458a('0x73')](_0x3745d5)+']';}}_0x2c6a00+='.';return _0x2c6a00;}exports[_0x458a('0x28')]=function(_0x435884,_0x3948aa,_0x2c131b){var _0x4c426a=_0x435884[_0x458a('0x74')];_0x4c426a['prefix']=_0x458a('0x75')+_0x4c426a[_0x458a('0x30')]+'-';return db['sequelize'][_0x458a('0x54')](function(_0xb028b3){return db[_0x458a('0x34')]['update'](_0x4c426a,{'where':{'id':_0x4c426a['id']},'transaction':_0xb028b3})[_0x458a('0x29')](function(){return db[_0x458a('0x66')][_0x458a('0x2a')]({'where':{'VoicePrefixId':_0x4c426a['id']},'transaction':_0xb028b3})[_0x458a('0x29')](function(){return db[_0x458a('0x66')][_0x458a('0x4f')]({'where':{'id':_0x4c426a['VoiceExtensionId']},'raw':!![]})[_0x458a('0x29')](function(_0x54abb1){return createVoicePrefixExtensions(_0x4c426a,_0x54abb1,_0xb028b3);});});});})['then'](function(){return db[_0x458a('0x34')][_0x458a('0x76')](_0x4c426a['id']);})[_0x458a('0x29')](respondWithResult(_0x3948aa,null))[_0x458a('0x50')](handleError(_0x3948aa,null));};exports[_0x458a('0x77')]=function(_0x434d04,_0x42eae7,_0x5aee0d){return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x434d04[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x42eae7,null))[_0x458a('0x29')](function(_0x17398f){if(_0x17398f){return _0x17398f['addAgents'](_0x434d04['body']['ids'],_[_0x458a('0x78')](_0x434d04['body'],[_0x458a('0x79'),'id'])||{})[_0x458a('0x7a')](function(_0x46ef02){for(var _0x3d73d1=0x0;_0x3d73d1<_0x434d04[_0x458a('0x74')][_0x458a('0x79')][_0x458a('0x3e')];_0x3d73d1+=0x1){socket['emit'](_0x458a('0x7b'),{'UserId':Number(_0x434d04[_0x458a('0x74')]['ids'][_0x3d73d1]),'VoicePrefixId':Number(_0x434d04[_0x458a('0x4c')]['id'])});}return _0x46ef02;});}})['then'](respondWithResult(_0x42eae7,null))[_0x458a('0x50')](handleError(_0x42eae7,null));};exports['removeAgents']=function(_0x26b3f7,_0x177457,_0xce45b5){return db[_0x458a('0x34')]['find']({'where':{'id':_0x26b3f7[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x177457,null))[_0x458a('0x29')](function(_0x239e2f){if(_0x239e2f){return _0x239e2f[_0x458a('0x7c')](_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')])[_0x458a('0x29')](function(){if(_['isArray'](_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')])){for(var _0x12e367=0x0;_0x12e367<_0x26b3f7[_0x458a('0x39')]['ids'][_0x458a('0x3e')];_0x12e367+=0x1){socket[_0x458a('0x7d')]('userVoicePrefix:remove',{'UserId':Number(_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')][_0x12e367]),'VoicePrefixId':Number(_0x26b3f7[_0x458a('0x4c')]['id'])});}}else{socket[_0x458a('0x7d')](_0x458a('0x7e'),{'UserId':Number(_0x26b3f7['query'][_0x458a('0x79')]),'VoicePrefixId':Number(_0x26b3f7[_0x458a('0x4c')]['id'])});}});}})[_0x458a('0x29')](respondWithStatusCode(_0x177457,null))[_0x458a('0x50')](handleError(_0x177457,null));};exports[_0x458a('0x7f')]=function(_0x46ac5c,_0x2eecf0,_0x573f46){var _0x1f9925={};var _0x4d3790={};var _0x396af9;var _0x36e650;return db[_0x458a('0x34')]['findOne']({'where':{'id':_0x46ac5c[_0x458a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2eecf0,null))['then'](function(_0x2574a3){if(_0x2574a3){_0x396af9=_0x2574a3;_0x4d3790[_0x458a('0x38')]=_['keys'](db['User'][_0x458a('0x35')]);_0x4d3790[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x46ac5c[_0x458a('0x39')]);_0x4d3790[_0x458a('0x3a')]=_['intersection'](_0x4d3790[_0x458a('0x38')],_0x4d3790['query']);_0x1f9925[_0x458a('0x3c')]=_[_0x458a('0x3b')](_0x4d3790[_0x458a('0x38')],qs['fields'](_0x46ac5c[_0x458a('0x39')][_0x458a('0x3d')]));_0x1f9925['attributes']=_0x1f9925[_0x458a('0x3c')]['length']?_0x1f9925[_0x458a('0x3c')]:_0x4d3790[_0x458a('0x38')];_0x1f9925[_0x458a('0x41')]=qs[_0x458a('0x42')](_0x46ac5c['query'][_0x458a('0x42')]);_0x1f9925['where']=qs['filters'](_[_0x458a('0x44')](_0x46ac5c[_0x458a('0x39')],_0x4d3790[_0x458a('0x3a')]));if(_0x46ac5c[_0x458a('0x39')][_0x458a('0x46')]){_0x1f9925[_0x458a('0x43')]=_['merge'](_0x1f9925[_0x458a('0x43')],{'$or':_[_0x458a('0x33')](_0x1f9925[_0x458a('0x3c')],function(_0x222dcb){var _0x17099e={};_0x17099e[_0x222dcb]={'$like':'%'+_0x46ac5c[_0x458a('0x39')]['filter']+'%'};return _0x17099e;})});}_0x1f9925=_[_0x458a('0x45')]({},_0x1f9925,_0x46ac5c[_0x458a('0x47')]);return _0x396af9[_0x458a('0x7f')](_0x1f9925);}})['then'](function(_0x2903c2){if(_0x2903c2){_0x36e650=_0x2903c2[_0x458a('0x3e')];if(!_0x46ac5c[_0x458a('0x39')]['hasOwnProperty']('nolimit')){_0x1f9925[_0x458a('0x23')]=qs['limit'](_0x46ac5c['query']['limit']);_0x1f9925['offset']=qs['offset'](_0x46ac5c[_0x458a('0x39')]['offset']);}return _0x396af9[_0x458a('0x7f')](_0x1f9925);}})[_0x458a('0x29')](function(_0x2adefe){if(_0x2adefe){return _0x2adefe?{'count':_0x36e650,'rows':_0x2adefe}:null;}})[_0x458a('0x29')](respondWithResult(_0x2eecf0,null))[_0x458a('0x50')](handleError(_0x2eecf0,null));};exports[_0x458a('0x80')]=function(_0x555190,_0x11ebe7,_0x59ad9c){var _0x24b1ee={};var _0x4e1d44={};var _0x23428c;var _0x333d74;return db['VoicePrefix']['findOne']({'where':{'id':_0x555190['params']['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x11ebe7,null))[_0x458a('0x29')](function(_0x21d8a9){if(_0x21d8a9){_0x23428c=_0x21d8a9;_0x4e1d44[_0x458a('0x38')]=_[_0x458a('0x4d')](db['Team'][_0x458a('0x35')]);_0x4e1d44[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x555190[_0x458a('0x39')]);_0x4e1d44[_0x458a('0x3a')]=_[_0x458a('0x3b')](_0x4e1d44[_0x458a('0x38')],_0x4e1d44[_0x458a('0x39')]);_0x24b1ee['attributes']=_[_0x458a('0x3b')](_0x4e1d44[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x555190[_0x458a('0x39')][_0x458a('0x3d')]));_0x24b1ee[_0x458a('0x3c')]=_0x24b1ee[_0x458a('0x3c')]['length']?_0x24b1ee['attributes']:_0x4e1d44['model'];_0x24b1ee['order']=qs[_0x458a('0x42')](_0x555190[_0x458a('0x39')][_0x458a('0x42')]);_0x24b1ee[_0x458a('0x43')]=qs['filters'](_[_0x458a('0x44')](_0x555190[_0x458a('0x39')],_0x4e1d44[_0x458a('0x3a')]));if(_0x555190[_0x458a('0x39')]['filter']){_0x24b1ee['where']=_[_0x458a('0x45')](_0x24b1ee[_0x458a('0x43')],{'$or':_[_0x458a('0x33')](_0x24b1ee[_0x458a('0x3c')],function(_0x4ff826){var _0xbb80ab={};_0xbb80ab[_0x4ff826]={'$like':'%'+_0x555190[_0x458a('0x39')][_0x458a('0x46')]+'%'};return _0xbb80ab;})});}_0x24b1ee=_[_0x458a('0x45')]({},_0x24b1ee,_0x555190[_0x458a('0x47')]);return _0x23428c[_0x458a('0x80')](_0x24b1ee);}})[_0x458a('0x29')](function(_0xd05241){if(_0xd05241){_0x333d74=_0xd05241[_0x458a('0x3e')];if(!_0x555190[_0x458a('0x39')]['hasOwnProperty']('nolimit')){_0x24b1ee[_0x458a('0x23')]=qs[_0x458a('0x23')](_0x555190[_0x458a('0x39')][_0x458a('0x23')]);_0x24b1ee[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x555190[_0x458a('0x39')]['offset']);}return _0x23428c[_0x458a('0x80')](_0x24b1ee);}})['then'](function(_0x165b0d){if(_0x165b0d){return _0x165b0d?{'count':_0x333d74,'rows':_0x165b0d}:null;}})[_0x458a('0x29')](respondWithResult(_0x11ebe7,null))[_0x458a('0x50')](handleError(_0x11ebe7,null));};exports['addTeams']=function(_0x589496,_0x4ee34,_0x1c9f4c){var _0x241c72=_0x589496[_0x458a('0x74')][_0x458a('0x79')];var _0x53d065;return db[_0x458a('0x81')][_0x458a('0x49')]({'where':{'id':_0x241c72},'attributes':['id'],'include':[{'model':db[_0x458a('0x82')],'as':_0x458a('0x83'),'attributes':['id',_0x458a('0x30'),_0x458a('0x84'),_0x458a('0x85'),_0x458a('0x86')],'raw':!![]}]})[_0x458a('0x29')](function(_0x52b844){if(_0x52b844){_0x53d065=_0x52b844;var _0x3051d2=_['flatMap'](_0x52b844,function(_0x2e496b){var _0x442b4a=_0x2e496b[_0x458a('0x2b')]({'plain':!![]});return _0x442b4a['Agents'];});return db['VoicePrefix'][_0x458a('0x4f')]({'where':{'id':_0x589496['params']['id']}})[_0x458a('0x29')](function(_0x5d97cc){return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x1b8558){return _0x5d97cc['addTeams'](_0x241c72,{'transaction':_0x1b8558})[_0x458a('0x29')](function(){return BPromise[_0x458a('0x87')](_0x53d065,function(_0x5dbeed){return db[_0x458a('0x88')]['upsert']({'TeamId':_0x5dbeed['id'],'VoicePrefixId':_0x589496[_0x458a('0x4c')]['id']},{'transaction':_0x1b8558});});})[_0x458a('0x29')](function(){return BPromise[_0x458a('0x87')](_0x3051d2,function(_0x49bdfc){return db[_0x458a('0x89')][_0x458a('0x8a')]({'where':{'UserId':_0x49bdfc['id'],'VoicePrefixId':_0x589496[_0x458a('0x4c')]['id']},'transaction':_0x1b8558});});})[_0x458a('0x29')](function(){_0x3051d2[_0x458a('0x8b')](function(_0x477402){socket['emit'](_0x458a('0x7b'),{'UserId':_0x477402['id'],'VoicePrefixId':_0x5d97cc['id']});});});});});}})[_0x458a('0x29')](respondWithStatusCode(_0x4ee34,null))['catch'](handleError(_0x4ee34,null));};exports[_0x458a('0x8c')]=function(_0x187bc8,_0x197858,_0x48622f){return db[_0x458a('0x81')][_0x458a('0x49')]({'where':{'id':_0x187bc8[_0x458a('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x458a('0x82')],'as':_0x458a('0x83'),'attributes':['id'],'raw':!![]}]})[_0x458a('0x29')](handleEntityNotFound(_0x197858,null))[_0x458a('0x29')](function(_0x2334f3){var _0x46bfc7=_[_0x458a('0x33')](_0x2334f3,'id');var _0x43cb92=[];var _0x5c42a4=[];var _0x3c3c7b=squel['select']();_0x3c3c7b['field'](_0x458a('0x8d'))[_0x458a('0x8e')]('team_has_voice_prefixes','tq')[_0x458a('0x8f')]('user_has_teams','ut',_0x458a('0x90'))['where'](_0x458a('0x91'),_0x187bc8[_0x458a('0x4c')]['id']);for(var _0x20ad0b=0x0;_0x20ad0b<_0x2334f3[_0x458a('0x3e')];_0x20ad0b+=0x1){let _0x55eab3=_0x2334f3[_0x20ad0b];for(var _0x4677a6=0x0;_0x4677a6<_0x55eab3[_0x458a('0x83')][_0x458a('0x3e')];_0x4677a6+=0x1){let _0x4df0b4=_0x55eab3[_0x458a('0x83')][_0x4677a6];var _0xfd1b68=_0x3c3c7b[_0x458a('0x92')]();_0xfd1b68[_0x458a('0x43')]('ut.UserId\x20=\x20?',_0x4df0b4['id']);_0x5c42a4[_0x458a('0x6a')](db['sequelize']['query'](_0xfd1b68['toString'](),{'type':db[_0x458a('0x53')][_0x458a('0x93')]['SELECT']})[_0x458a('0x29')](function(_0x49297c){if(_0x49297c[_0x458a('0x3e')]===0x1){return _0x4df0b4['id'];}else{var _0x4bfd6b=_[_0x458a('0x94')](_['map'](_0x49297c,_0x458a('0x95')),function(_0x3c9685){return _[_0x458a('0x96')](_0x46bfc7,_0x3c9685);});if(_0x4bfd6b){return _0x4df0b4['id'];}}}));}}return BPromise[_0x458a('0x97')](_0x5c42a4)[_0x458a('0x29')](function(_0x2e24aa){_0x43cb92=_(_0x43cb92)[_0x458a('0x98')](_0x2e24aa)['compact']()[_0x458a('0x99')]();return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x187bc8['params']['id']}})['then'](function(_0x334129){return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x330330){return _0x334129[_0x458a('0x8c')](_0x187bc8['query'][_0x458a('0x79')],{'transaction':_0x330330})[_0x458a('0x29')](function(){if(!_[_0x458a('0x9a')](_0x43cb92)){return _0x334129[_0x458a('0x7c')](_0x43cb92,{'transaction':_0x330330});}})[_0x458a('0x29')](function(){_0x43cb92['forEach'](function(_0x16a747){socket[_0x458a('0x7d')](_0x458a('0x7e'),{'UserId':_0x16a747,'VoicePrefixId':_0x334129['id']});});});});});});})[_0x458a('0x29')](respondWithStatusCode(_0x197858,null))[_0x458a('0x50')](handleError(_0x197858,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index f37993a..546c10c 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 _0x457f=['hook','exports','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x27ddf5,_0x5a3e18){var _0x26e74a=function(_0x5f24ac){while(--_0x5f24ac){_0x27ddf5['push'](_0x27ddf5['shift']());}};_0x26e74a(++_0x5a3e18);}(_0x457f,0xca));var _0xf457=function(_0x1dabc1,_0x59a781){_0x1dabc1=_0x1dabc1-0x0;var _0x24322d=_0x457f[_0x1dabc1];return _0x24322d;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xf457('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf457('0x1'),'afterUpdate':_0xf457('0x2'),'afterDestroy':_0xf457('0x3')};function emitEvent(_0x3e76e8){return function(_0x1a3a4c,_0x4ca3ae,_0x4e6314){VoicePrefixEvents['emit'](_0x3e76e8+':'+_0x1a3a4c['id'],_0x1a3a4c);VoicePrefixEvents[_0xf457('0x4')](_0x3e76e8,_0x1a3a4c);_0x4e6314(null);};}for(var e in events){if(events[_0xf457('0x5')](e)){var event=events[e];VoicePrefix[_0xf457('0x6')](e,emitEvent(event));}}module[_0xf457('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xb61d=['events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0xb61d,0xa1));var _0xdb61=function(_0x55ca02,_0x18f34c){_0x55ca02=_0x55ca02-0x0;var _0x46e1fd=_0xb61d[_0x55ca02];return _0x46e1fd;};'use strict';var EventEmitter=require(_0xdb61('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xdb61('0x1')](0x0);var events={'afterCreate':_0xdb61('0x2'),'afterUpdate':_0xdb61('0x3'),'afterDestroy':_0xdb61('0x4')};function emitEvent(_0x1c9d73){return function(_0x7d939b,_0x1e1532,_0x4456d6){VoicePrefixEvents[_0xdb61('0x5')](_0x1c9d73+':'+_0x7d939b['id'],_0x7d939b);VoicePrefixEvents['emit'](_0x1c9d73,_0x7d939b);_0x4456d6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xdb61('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 8cac3e1..52ccaf8 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 _0x7665=['./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x373b82,_0xc66d54){var _0x3e134b=function(_0x197179){while(--_0x197179){_0x373b82['push'](_0x373b82['shift']());}};_0x3e134b(++_0xc66d54);}(_0x7665,0x18b));var _0x5766=function(_0xb7c727,_0x3ffc79){_0xb7c727=_0xb7c727-0x0;var _0x6c27c8=_0x7665[_0xb7c727];return _0x6c27c8;};'use strict';var _=require(_0x5766('0x0'));var util=require(_0x5766('0x1'));var logger=require(_0x5766('0x2'))(_0x5766('0x3'));var moment=require('moment');var BPromise=require(_0x5766('0x4'));var rp=require(_0x5766('0x5'));var fs=require('fs');var path=require(_0x5766('0x6'));var rimraf=require('rimraf');var config=require(_0x5766('0x7'));var attributes=require(_0x5766('0x8'));module[_0x5766('0x9')]=function(_0x85a12,_0x131d53){return _0x85a12[_0x5766('0xa')](_0x5766('0xb'),attributes,{'tableName':_0x5766('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3aa4=['voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0x5a5276,_0x262d69){var _0x3e8ee2=function(_0x151ce3){while(--_0x151ce3){_0x5a5276['push'](_0x5a5276['shift']());}};_0x3e8ee2(++_0x262d69);}(_0x3aa4,0x69));var _0x43aa=function(_0x25f51a,_0xa4639d){_0x25f51a=_0x25f51a-0x0;var _0x537703=_0x3aa4[_0x25f51a];return _0x537703;};'use strict';var _=require('lodash');var util=require(_0x43aa('0x0'));var logger=require(_0x43aa('0x1'))(_0x43aa('0x2'));var moment=require(_0x43aa('0x3'));var BPromise=require(_0x43aa('0x4'));var rp=require(_0x43aa('0x5'));var fs=require('fs');var path=require(_0x43aa('0x6'));var rimraf=require(_0x43aa('0x7'));var config=require('../../config/environment');var attributes=require(_0x43aa('0x8'));module[_0x43aa('0x9')]=function(_0x144fd9,_0x235ce4){return _0x144fd9[_0x43aa('0xa')](_0x43aa('0xb'),attributes,{'tableName':_0x43aa('0xc'),'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 9dc03c4..a777e16 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 _0x8b52=['http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x37974a,_0x2804cf){var _0x45fd4e=function(_0x33559d){while(--_0x33559d){_0x37974a['push'](_0x37974a['shift']());}};_0x45fd4e(++_0x2804cf);}(_0x8b52,0x151));var _0x28b5=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8b52[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x28b5('0x0'));var util=require(_0x28b5('0x1'));var moment=require(_0x28b5('0x2'));var BPromise=require('bluebird');var rs=require(_0x28b5('0x3'));var fs=require('fs');var Redis=require(_0x28b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x28b5('0x5'));var logger=require(_0x28b5('0x6'))(_0x28b5('0x7'));var config=require(_0x28b5('0x8'));var jayson=require(_0x28b5('0x9'));var client=jayson[_0x28b5('0xa')][_0x28b5('0xb')]({'port':0x232a});config[_0x28b5('0xc')]=_[_0x28b5('0xd')](config['redis'],{'host':_0x28b5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x28b5('0xf'))[_0x28b5('0x10')](socket);function respondWithRpcPromise(_0x4f2a41,_0xd8f394,_0x315ed6){return new BPromise(function(_0x4d3d4e,_0x10d2b5){return client[_0x28b5('0x11')](_0x4f2a41,_0x315ed6)[_0x28b5('0x12')](function(_0x6b22a8){logger['info'](_0x28b5('0x13'),_0xd8f394,'request\x20sent');logger[_0x28b5('0x14')](_0x28b5('0x15'),_0xd8f394,'request\x20sent',JSON[_0x28b5('0x16')](_0x6b22a8));if(_0x6b22a8['error']){if(_0x6b22a8[_0x28b5('0x17')]['code']===0x1f4){logger['error'](_0x28b5('0x13'),_0xd8f394,_0x6b22a8[_0x28b5('0x17')]['message']);return _0x10d2b5(_0x6b22a8[_0x28b5('0x17')][_0x28b5('0x18')]);}logger[_0x28b5('0x17')](_0x28b5('0x13'),_0xd8f394,_0x6b22a8[_0x28b5('0x17')]['message']);return _0x4d3d4e(_0x6b22a8[_0x28b5('0x17')]['message']);}else{logger[_0x28b5('0x19')](_0x28b5('0x13'),_0xd8f394,_0x28b5('0x1a'));_0x4d3d4e(_0x6b22a8[_0x28b5('0x1b')]['message']);}})[_0x28b5('0x1c')](function(_0x1396cf){logger[_0x28b5('0x17')]('VoicePrefix,\x20%s,\x20%s',_0xd8f394,_0x1396cf);_0x10d2b5(_0x1396cf);});});} \ No newline at end of file +var _0x9120=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x583054,_0x69beba){var _0x2f50e=function(_0x5cff5a){while(--_0x5cff5a){_0x583054['push'](_0x583054['shift']());}};_0x2f50e(++_0x69beba);}(_0x9120,0x1b3));var _0x0912=function(_0x272a19,_0x2284e0){_0x272a19=_0x272a19-0x0;var _0x58c6fe=_0x9120[_0x272a19];return _0x58c6fe;};'use strict';var _=require(_0x0912('0x0'));var util=require(_0x0912('0x1'));var moment=require(_0x0912('0x2'));var BPromise=require(_0x0912('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0912('0x4'))['db'];var utils=require(_0x0912('0x5'));var logger=require(_0x0912('0x6'))(_0x0912('0x7'));var config=require(_0x0912('0x8'));var jayson=require(_0x0912('0x9'));var client=jayson['client'][_0x0912('0xa')]({'port':0x232a});config[_0x0912('0xb')]=_[_0x0912('0xc')](config['redis'],{'host':_0x0912('0xd'),'port':0x18eb});var socket=require(_0x0912('0xe'))(new Redis(config[_0x0912('0xb')]));require(_0x0912('0xf'))[_0x0912('0x10')](socket);function respondWithRpcPromise(_0x5468d4,_0x1aa7d2,_0x6581e6){return new BPromise(function(_0x1141a5,_0x32af1a){return client['request'](_0x5468d4,_0x6581e6)[_0x0912('0x11')](function(_0x50448d){logger[_0x0912('0x12')](_0x0912('0x13'),_0x1aa7d2,_0x0912('0x14'));logger[_0x0912('0x15')](_0x0912('0x16'),_0x1aa7d2,_0x0912('0x14'),JSON[_0x0912('0x17')](_0x50448d));if(_0x50448d[_0x0912('0x18')]){if(_0x50448d[_0x0912('0x18')][_0x0912('0x19')]===0x1f4){logger[_0x0912('0x18')](_0x0912('0x13'),_0x1aa7d2,_0x50448d[_0x0912('0x18')][_0x0912('0x1a')]);return _0x32af1a(_0x50448d[_0x0912('0x18')]['message']);}logger['error'](_0x0912('0x13'),_0x1aa7d2,_0x50448d['error'][_0x0912('0x1a')]);return _0x1141a5(_0x50448d['error'][_0x0912('0x1a')]);}else{logger['info'](_0x0912('0x13'),_0x1aa7d2,'request\x20sent');_0x1141a5(_0x50448d[_0x0912('0x1b')]['message']);}})[_0x0912('0x1c')](function(_0x56e6e2){logger['error'](_0x0912('0x13'),_0x1aa7d2,_0x56e6e2);_0x32af1a(_0x56e6e2);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 56f6a23..eed8fe6 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 _0x97f5=['length','voicePrefix:','./voicePrefix.events','save','remove','emit','removeListener','register'];(function(_0x34e798,_0x1ef981){var _0xed3d6e=function(_0x343e15){while(--_0x343e15){_0x34e798['push'](_0x34e798['shift']());}};_0xed3d6e(++_0x1ef981);}(_0x97f5,0x72));var _0x597f=function(_0x436615,_0x3aa6f8){_0x436615=_0x436615-0x0;var _0x2dc60d=_0x97f5[_0x436615];return _0x2dc60d;};'use strict';var VoicePrefixEvents=require(_0x597f('0x0'));var events=[_0x597f('0x1'),_0x597f('0x2'),'update'];function createListener(_0x5c0754,_0xae9eeb){return function(_0x4058fa){_0xae9eeb[_0x597f('0x3')](_0x5c0754,_0x4058fa);};}function removeListener(_0xa1eb97,_0x3e3c7e){return function(){VoicePrefixEvents[_0x597f('0x4')](_0xa1eb97,_0x3e3c7e);};}exports[_0x597f('0x5')]=function(_0x1abf16){for(var _0x89d13a=0x0,_0x5f4eb9=events[_0x597f('0x6')];_0x89d13a<_0x5f4eb9;_0x89d13a++){var _0x20f0fc=events[_0x89d13a];var _0x1098e6=createListener(_0x597f('0x7')+_0x20f0fc,_0x1abf16);VoicePrefixEvents['on'](_0x20f0fc,_0x1098e6);}}; \ No newline at end of file +var _0x44d4=['length','./voicePrefix.events','removeListener','register'];(function(_0x41f0e2,_0x12173d){var _0x3dcdfe=function(_0x1ba779){while(--_0x1ba779){_0x41f0e2['push'](_0x41f0e2['shift']());}};_0x3dcdfe(++_0x12173d);}(_0x44d4,0x161));var _0x444d=function(_0x46531,_0x4fc16f){_0x46531=_0x46531-0x0;var _0x58617b=_0x44d4[_0x46531];return _0x58617b;};'use strict';var VoicePrefixEvents=require(_0x444d('0x0'));var events=['save','remove','update'];function createListener(_0x1c1a07,_0x409499){return function(_0x5a77ed){_0x409499['emit'](_0x1c1a07,_0x5a77ed);};}function removeListener(_0x51377d,_0x1c3432){return function(){VoicePrefixEvents[_0x444d('0x1')](_0x51377d,_0x1c3432);};}exports[_0x444d('0x2')]=function(_0x24f601){for(var _0x45dfdb=0x0,_0x33fe8c=events[_0x444d('0x3')];_0x45dfdb<_0x33fe8c;_0x45dfdb++){var _0x58e34d=events[_0x45dfdb];var _0x38938a=createListener('voicePrefix:'+_0x58e34d,_0x24f601);VoicePrefixEvents['on'](_0x58e34d,_0x38938a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d9193cc..ff133a9 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 _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(_0x5c08cb,_0x456960){var _0x147907=function(_0x1da1be){while(--_0x1da1be){_0x5c08cb['push'](_0x5c08cb['shift']());}};_0x147907(++_0x456960);}(_0xb10b,0x12a));var _0xbb10=function(_0x598408,_0x5e6f74){_0x598408=_0x598408-0x0;var _0x560720=_0xb10b[_0x598408];return _0x560720;};'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 +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(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0xb10b,0x12a));var _0xbb10=function(_0x47e92b,_0x29e3b5){_0x47e92b=_0x47e92b-0x0;var _0x2da694=_0xb10b[_0x47e92b];return _0x2da694;};'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 075e71e..945b005 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 _0x8612=['join','getDataValue','split','joinempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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)','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,*,*,*','onlyIfOpen','always','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','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)','#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','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','ringall','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','setDataValue','type','dialMethod','strategy','preview','booked','roundrobin','INTEGER','yes','TEXT','periodic_announce'];(function(_0x39e509,_0x1645a6){var _0x202468=function(_0x5c4dff){while(--_0x5c4dff){_0x39e509['push'](_0x39e509['shift']());}};_0x202468(++_0x1645a6);}(_0x8612,0x1c2));var _0x2861=function(_0x13fb77,_0x24e81a){_0x13fb77=_0x13fb77-0x0;var _0xfbdd17=_0x8612[_0x13fb77];return _0xfbdd17;};'use strict';var Sequelize=require(_0x2861('0x0'));module[_0x2861('0x1')]={'name':{'type':Sequelize[_0x2861('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x4'),_0x2861('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x2861('0x6'),_0x2861('0x7'),_0x2861('0x8'),_0x2861('0x9'),_0x2861('0xa'),_0x2861('0xb'),'wrandom',_0x2861('0xc')),'allowNull':![],'defaultValue':_0x2861('0x6'),'set':function(_0x201ccd){this[_0x2861('0xd')]('strategy',_0x201ccd?_0x201ccd:'rrmemory');},'get':function(){var _0x26095a=this['getDataValue'](_0x2861('0xe'));var _0x1dc3fc=this['getDataValue'](_0x2861('0xf'));var _0x2f3a13=this['getDataValue'](_0x2861('0x10'));if(_0x26095a===_0x2861('0x5')){if(_0x1dc3fc===_0x2861('0x11')){return null;}if(_0x1dc3fc===_0x2861('0x12')&&![_0x2861('0xa'),_0x2861('0x13')]['includes'](_0x2f3a13)){this['setDataValue'](_0x2861('0x10'),_0x2861('0xa'));}}return _0x2f3a13;}},'servicelevel':{'type':Sequelize[_0x2861('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x2861('0x14')](0xb)},'timeout':{'type':Sequelize[_0x2861('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2861('0x2')]},'weight':{'type':Sequelize[_0x2861('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x2861('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x2861('0x3')]('yes','no'),'defaultValue':_0x2861('0x15')},'autopause':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x2861('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x2861('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x2861('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x2861('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x2861('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2861('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2861('0x3')]('yes','no'),'defaultValue':_0x2861('0x15')},'announce_holdtime':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x2861('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2861('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x2861('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2861('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2861('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2861('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2861('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x2861('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2861('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2861('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2861('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2861('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x2861('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x2861('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x2861('0x2')]},'queue_less_than':{'type':Sequelize[_0x2861('0x2')]},'periodic_announce':{'type':Sequelize[_0x2861('0x16')],'set':function(_0x9148df){this[_0x2861('0xd')](_0x2861('0x17'),_0x9148df?_0x9148df[_0x2861('0x18')](','):[]);},'get':function(){return this[_0x2861('0x19')](_0x2861('0x17'))?this['getDataValue'](_0x2861('0x17'))[_0x2861('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x2861('0x2')],'defaultValue':_0x2861('0x15'),'set':function(_0x2e2207){this[_0x2861('0xd')]('joinempty',_0x2e2207?_0x2e2207[_0x2861('0x18')](','):undefined);},'get':function(){return this[_0x2861('0x19')](_0x2861('0x1b'))?this[_0x2861('0x19')](_0x2861('0x1b'))[_0x2861('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x2861('0x2')],'defaultValue':'no','set':function(_0x523ac6){this[_0x2861('0xd')]('leavewhenempty',_0x523ac6?_0x523ac6[_0x2861('0x18')](','):undefined);},'get':function(){return this[_0x2861('0x19')]('leavewhenempty')?this[_0x2861('0x19')]('leavewhenempty')[_0x2861('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x2861('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2861('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x2861('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x2861('0x2')]},'description':{'type':Sequelize[_0x2861('0x2')]},'acw':{'type':Sequelize[_0x2861('0x1c')],'defaultValue':0x0,'set':function(_0x3ebf3e){this[_0x2861('0xd')](_0x2861('0x1d'),_0x3ebf3e);if(_0x3ebf3e){if(this[_0x2861('0x19')](_0x2861('0x1e'))<0x2){this['setDataValue'](_0x2861('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2861('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2861('0x1f')},'dialMethod':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x11'),'progressive',_0x2861('0x20'),'predictive',_0x2861('0x12')),'defaultValue':'progressive','comment':_0x2861('0x21')},'dialLimitChannel':{'type':Sequelize[_0x2861('0x14')](0x4)[_0x2861('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2861('0x23')},'dialLimitQueue':{'type':Sequelize[_0x2861('0x14')](0x4)[_0x2861('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2861('0x24')},'dialPowerLevel':{'type':Sequelize[_0x2861('0x25')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x2861('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x27'),_0x2861('0x28')),'defaultValue':_0x2861('0x28'),'comment':_0x2861('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2861('0x25')](0x2)[_0x2861('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2861('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x2861('0x14')](0x3)[_0x2861('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2861('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2861('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2861('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x2861('0x14')](0x3)[_0x2861('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2861('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x2861('0x2')],'defaultValue':_0x2861('0x2d'),'comment':_0x2861('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x2861('0x14')](0x3)[_0x2861('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2861('0x2f')},'dialQueueProject':{'type':Sequelize[_0x2861('0x2')],'comment':_0x2861('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2861('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2861('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2861('0x14')](0x5)[_0x2861('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2861('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x2861('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2861('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2861('0x14')](0x5)[_0x2861('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2861('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2861('0x22')],'defaultValue':0x3,'comment':_0x2861('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2861('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2861('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2861('0x14')](0x3)[_0x2861('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2861('0x37')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2861('0x2')],'defaultValue':_0x2861('0x38')},'dialPrefix':{'type':Sequelize[_0x2861('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never',_0x2861('0x39')),'defaultValue':_0x2861('0x3a')},'dialAMDActive':{'type':Sequelize[_0x2861('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x2861('0x14')](0x9)[_0x2861('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x2861('0x14')](0x9)[_0x2861('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2861('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2861('0x14')](0x9)[_0x2861('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2861('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x2861('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x2861('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2861('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2861('0x14')](0x9)[_0x2861('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2861('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2861('0x14')](0x9)[_0x2861('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2861('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2861('0x14')](0x5)[_0x2861('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2861('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2861('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x2861('0x14')](0x5)[_0x2861('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x2861('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x2861('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x2861('0x3')](_0x2861('0x42'),_0x2861('0x43')),'defaultValue':_0x2861('0x42')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x2861('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x2861('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2861('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2861('0x14')](0x3)[_0x2861('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2861('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x2861('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2861('0x14')](0x3)[_0x2861('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2861('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2861('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2861('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x2861('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2861('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x2861('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2861('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2861('0x14')](0x3)[_0x2861('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x2861('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x2861('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2861('0x14')](0x3)[_0x2861('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2861('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2861('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2861('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2861('0x14')],'allowNull':!![],'comment':_0x2861('0x4b')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2861('0x4c'),'set':function(_0x9f8804){if(!_0x9f8804)this[_0x2861('0xd')](_0x2861('0x4d'),null);this[_0x2861('0xd')](_0x2861('0x4e'),_0x9f8804);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x2861('0x14')](0x3)[_0x2861('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2861('0x14')](0x3)[_0x2861('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x2861('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x2861('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x2861('0x1c')],'defaultValue':![]}}; \ No newline at end of file +var _0x55c9=['linear','setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','INTEGER','yes','all','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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)','#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\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\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','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\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','name','ENUM','inbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory'];(function(_0x598d27,_0x5dc882){var _0xba9a7f=function(_0x42b99f){while(--_0x42b99f){_0x598d27['push'](_0x598d27['shift']());}};_0xba9a7f(++_0x5dc882);}(_0x55c9,0x144));var _0x955c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x55c9[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x955c('0x0'));module[_0x955c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x955c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x955c('0x3')]('inbound','outbound'),'allowNull':![],'defaultValue':_0x955c('0x4')},'musiconhold':{'type':Sequelize[_0x955c('0x5')],'defaultValue':_0x955c('0x6')},'announce':{'type':Sequelize[_0x955c('0x5')],'defaultValue':''},'strategy':{'type':Sequelize[_0x955c('0x3')]('rr',_0x955c('0x7'),_0x955c('0x8'),_0x955c('0x9'),_0x955c('0xa'),_0x955c('0xb'),_0x955c('0xc'),'wrandom','rrordered'),'allowNull':![],'defaultValue':_0x955c('0x7'),'set':function(_0xa11e7e){this[_0x955c('0xd')](_0x955c('0xe'),_0xa11e7e?_0xa11e7e:_0x955c('0xb'));},'get':function(){var _0x27402b=this[_0x955c('0xf')](_0x955c('0x10'));var _0x4ba11d=this[_0x955c('0xf')](_0x955c('0x11'));var _0x4c4512=this[_0x955c('0xf')](_0x955c('0xe'));if(_0x27402b==='outbound'){if(_0x4ba11d===_0x955c('0x12')){return null;}if(_0x4ba11d===_0x955c('0x13')&&![_0x955c('0xb'),_0x955c('0x14')]['includes'](_0x4c4512)){this[_0x955c('0xd')]('strategy',_0x955c('0xb'));}}return _0x4c4512;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x955c('0x15')](0xb)},'timeout':{'type':Sequelize[_0x955c('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x955c('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x955c('0x5')]},'weight':{'type':Sequelize[_0x955c('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x955c('0x3')]('yes','no'),'defaultValue':_0x955c('0x16')},'autopause':{'type':Sequelize[_0x955c('0x3')](_0x955c('0x16'),'no',_0x955c('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x955c('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x955c('0x3')](_0x955c('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x955c('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x955c('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x955c('0x3')](_0x955c('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x955c('0x3')](_0x955c('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x955c('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x955c('0x3')](_0x955c('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x955c('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x955c('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x955c('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x955c('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x955c('0x3')](_0x955c('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x955c('0x3')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0x955c('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x955c('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x955c('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x955c('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x955c('0x5')]},'queue_youarenext':{'type':Sequelize[_0x955c('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x955c('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x955c('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x955c('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x955c('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x955c('0x5')]},'queue_quantity2':{'type':Sequelize[_0x955c('0x5')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x955c('0x5')]},'periodic_announce':{'type':Sequelize[_0x955c('0x18')],'set':function(_0x15fd04){this['setDataValue'](_0x955c('0x19'),_0x15fd04?_0x15fd04[_0x955c('0x1a')](','):[]);},'get':function(){return this[_0x955c('0xf')]('periodic_announce')?this[_0x955c('0xf')](_0x955c('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x955c('0x5')],'defaultValue':'yes','set':function(_0x55e23b){this[_0x955c('0xd')](_0x955c('0x1b'),_0x55e23b?_0x55e23b[_0x955c('0x1a')](','):undefined);},'get':function(){return this[_0x955c('0xf')](_0x955c('0x1b'))?this[_0x955c('0xf')]('joinempty')[_0x955c('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x2c7579){this['setDataValue']('leavewhenempty',_0x2c7579?_0x2c7579['join'](','):undefined);},'get':function(){return this[_0x955c('0xf')](_0x955c('0x1d'))?this[_0x955c('0xf')]('leavewhenempty')[_0x955c('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x955c('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x955c('0x3')](_0x955c('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x955c('0x5')]},'description':{'type':Sequelize[_0x955c('0x5')]},'acw':{'type':Sequelize[_0x955c('0x1e')],'defaultValue':0x0,'set':function(_0x832825){this[_0x955c('0xd')](_0x955c('0x1f'),_0x832825);if(_0x832825){if(this[_0x955c('0xf')](_0x955c('0x20'))<0x2){this[_0x955c('0xd')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x955c('0x1e')],'defaultValue':0x0,'comment':_0x955c('0x21')},'dialMethod':{'type':Sequelize[_0x955c('0x3')](_0x955c('0x12'),'progressive','power',_0x955c('0x22'),_0x955c('0x13')),'defaultValue':_0x955c('0x23'),'comment':_0x955c('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x955c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x955c('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x955c('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x955c('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x955c('0x3')](_0x955c('0x28'),_0x955c('0x29')),'defaultValue':_0x955c('0x29'),'comment':_0x955c('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x955c('0x2b')](0x2)[_0x955c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x955c('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x955c('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x955c('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x955c('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x955c('0x5')],'defaultValue':_0x955c('0x2f'),'comment':_0x955c('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x955c('0x31')},'dialQueueProject':{'type':Sequelize[_0x955c('0x5')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x955c('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x955c('0x15')](0x5)[_0x955c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x955c('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x955c('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x955c('0x15')](0x5)[_0x955c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x955c('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x955c('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x955c('0x15')](0x5)[_0x955c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x955c('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x955c('0x37')},'dialTimezone':{'type':Sequelize[_0x955c('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x955c('0x5')],'defaultValue':_0x955c('0x38')},'dialPrefix':{'type':Sequelize[_0x955c('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x955c('0x3')](_0x955c('0x39'),_0x955c('0x3a'),_0x955c('0x3b')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x955c('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x955c('0x15')](0x9)[_0x955c('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x955c('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x955c('0x15')](0x9)[_0x955c('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x955c('0x15')](0x9)[_0x955c('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x955c('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x955c('0x15')](0x9)[_0x955c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x955c('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0x955c('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x955c('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x955c('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x955c('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x955c('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x955c('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x955c('0x15')](0x5)[_0x955c('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x955c('0x15')](0x9)[_0x955c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x955c('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x955c('0x15')](0x5)[_0x955c('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x955c('0x43')},'dialRecallInQueue':{'type':Sequelize[_0x955c('0x1e')],'defaultValue':0x0,'comment':_0x955c('0x44')},'dialOrderByScheduledAt':{'type':Sequelize[_0x955c('0x3')](_0x955c('0x45'),_0x955c('0x46')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x955c('0x5')],'comment':_0x955c('0x47')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x955c('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x955c('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x955c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x955c('0x48')},'dialCutDigit':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x955c('0x49')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x955c('0x4a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x955c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x955c('0x4b')},'dialDropMaxRetry':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x955c('0x4c')},'dialDropRetryFrequency':{'type':Sequelize[_0x955c('0x15')](0x5)[_0x955c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x955c('0x4d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x955c('0x4e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x955c('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x955c('0x4f')},'dialMachineMaxRetry':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x955c('0x15')](0x5)[_0x955c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x955c('0x50')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x955c('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x955c('0x15')],'allowNull':!![],'comment':_0x955c('0x51')},'mandatoryDisposition':{'type':Sequelize[_0x955c('0x1e')],'defaultValue':![],'comment':_0x955c('0x52'),'set':function(_0x3f631d){if(!_0x3f631d)this[_0x955c('0xd')](_0x955c('0x53'),null);this[_0x955c('0xd')]('mandatoryDisposition',_0x3f631d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x955c('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x955c('0x15')](0x3)[_0x955c('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index abed904..11c8b3f 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 _0x3e74=['phone\x20NOT\x20IN\x20(?)','cm_hopper','onlyIfOpen','insert','into','fromQuery','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','util','lodash','squel','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','end','json','offset','undefined','count','limit','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','UserProfileResource','sendStatus','stack','name','status','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','catch','show','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','clone','params','keys','omit','updatedAt','createdAt','outbound','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','hasOwnProperty','nolimit','sort','filters','pick','VoiceQueueId','options','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','order','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','addTeams','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','User','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','QueryTypes','every','all','union','compact','isEmpty','userVoiceQueue:remove','addAgents','removeAgents','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','phone','scheduledAt','field','ContactId','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_0x780d36,_0x285189){var _0x4ac128=function(_0x1b157f){while(--_0x1b157f){_0x780d36['push'](_0x780d36['shift']());}};_0x4ac128(++_0x285189);}(_0x3e74,0x175));var _0x43e7=function(_0x1aefb6,_0x5891a3){_0x1aefb6=_0x1aefb6-0x0;var _0x3d1e01=_0x3e74[_0x1aefb6];return _0x3d1e01;};'use strict';var moment=require(_0x43e7('0x0'));var BPromise=require('bluebird');var util=require(_0x43e7('0x1'));var _=require(_0x43e7('0x2'));var squel=require(_0x43e7('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x43e7('0x4'))('api');var config=require(_0x43e7('0x5'));var db=require(_0x43e7('0x6'))['db'];config[_0x43e7('0x7')]=_[_0x43e7('0x8')](config[_0x43e7('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x43e7('0x9'))(new Redis(config[_0x43e7('0x7')]));require(_0x43e7('0xa'))[_0x43e7('0xb')](socket);function respondWithStatusCode(_0x21f491,_0x516b4d){_0x516b4d=_0x516b4d||0xcc;return function(_0x212c6c){if(_0x212c6c){return _0x21f491['sendStatus'](_0x516b4d);}return _0x21f491['status'](_0x516b4d)[_0x43e7('0xc')]();};}function respondWithResult(_0x4139c9,_0x5c34f4){_0x5c34f4=_0x5c34f4||0xc8;return function(_0x2803d9){if(_0x2803d9){return _0x4139c9['status'](_0x5c34f4)[_0x43e7('0xd')](_0x2803d9);}};}function respondWithFilteredResult(_0x37302c,_0x4ebc8e){return function(_0x3eb206){if(_0x3eb206){var _0xc960ea=typeof _0x4ebc8e[_0x43e7('0xe')]===_0x43e7('0xf')&&typeof _0x4ebc8e['limit']==='undefined';var _0x2fcb36=_0x3eb206[_0x43e7('0x10')];var _0x44b0bd=_0xc960ea?0x0:_0x4ebc8e['offset'];var _0x5e641c=_0xc960ea?_0x3eb206[_0x43e7('0x10')]:_0x4ebc8e[_0x43e7('0xe')]+_0x4ebc8e[_0x43e7('0x11')];var _0x328445;if(_0x5e641c>=_0x2fcb36){_0x5e641c=_0x2fcb36;_0x328445=0xc8;}else{_0x328445=0xce;}_0x37302c['status'](_0x328445);return _0x37302c['set'](_0x43e7('0x12'),_0x44b0bd+'-'+_0x5e641c+'/'+_0x2fcb36)[_0x43e7('0xd')](_0x3eb206);}return null;};}function saveUpdates(_0x273a32){return function(_0x5d346f){if(_0x5d346f){return _0x5d346f['update'](_0x273a32)[_0x43e7('0x13')](function(_0x1ca758){return _0x1ca758;});}return null;};}function removeEntity(_0x9037d3){return function(_0x140657){if(_0x140657){return _0x140657[_0x43e7('0x14')]()[_0x43e7('0x13')](function(){var _0x619236=_0x140657[_0x43e7('0x15')]({'plain':!![]});var _0x2377a3=[{'name':_0x43e7('0x16'),'value':_0x43e7('0x17'),'ignore':![]},{'name':_0x43e7('0x18'),'value':'outbound','ignore':![]}];var _0xef1a5a=_(_0x2377a3)[_0x43e7('0x19')]('ignore')[_0x43e7('0x1a')](_0x43e7('0x1b'))[_0x43e7('0x1b')]();if(_[_0x43e7('0x1c')](_0xef1a5a,_0x619236[_0x43e7('0x1d')])){return;}var _0x2f4cb4=_['find'](_0x2377a3,[_0x43e7('0x1b'),_0x619236['type']])['name'];return db[_0x43e7('0x1e')][_0x43e7('0x14')]({'where':{'type':_0x2f4cb4,'resourceId':_0x619236['id']}})['then'](function(){return _0x140657;});})[_0x43e7('0x13')](function(){_0x9037d3['status'](0xcc)[_0x43e7('0xc')]();});}};}function handleEntityNotFound(_0x5c5e67){return function(_0x1af208){if(!_0x1af208){_0x5c5e67[_0x43e7('0x1f')](0x194);}return _0x1af208;};}function handleError(_0x20888b,_0x405f85){_0x405f85=_0x405f85||0x1f4;return function(_0x51f4d7){logger['error'](_0x51f4d7[_0x43e7('0x20')]);if(_0x51f4d7['name']){delete _0x51f4d7[_0x43e7('0x21')];}_0x20888b[_0x43e7('0x22')](_0x405f85)[_0x43e7('0x23')](_0x51f4d7);};}exports[_0x43e7('0x24')]=function(_0x5087d7,_0x33a1a5){var _0x4690a6={};var _0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x1a')](db[_0x43e7('0x25')][_0x43e7('0x26')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x27')],'type':_0x31b2a6[_0x43e7('0x1d')][_0x43e7('0x28')]};});_0x4690a6=qs[_0x43e7('0x29')](_0x50f9f5,_0x5087d7);var _0x2bde44={'where':_0x4690a6[_0x43e7('0x2a')]};return db['VoiceQueue'][_0x43e7('0x10')](_0x2bde44)[_0x43e7('0x13')](function(_0x3b8f78){_0x45b675[_0x43e7('0x10')]=_0x3b8f78;_0x4690a6[_0x43e7('0x2b')]=qs['include'](_0x5087d7[_0x43e7('0x2c')]);return db[_0x43e7('0x25')][_0x43e7('0x2d')](_0x4690a6);})[_0x43e7('0x13')](function(_0x4c61b9){_0x45b675['rows']=_0x4c61b9;return _0x45b675;})['then'](respondWithFilteredResult(_0x33a1a5,_0x4690a6))[_0x43e7('0x2e')](handleError(_0x33a1a5,null));};exports[_0x43e7('0x2f')]=function(_0x117c07,_0x234fe6){var _0x108313={'raw':![],'where':{'id':_0x117c07['params']['id']}},_0xde7ed={};_0xde7ed['model']=_['keys'](db['VoiceQueue']['rawAttributes']);_0xde7ed['query']=_['keys'](_0x117c07[_0x43e7('0x2c')]);_0xde7ed['filters']=_[_0x43e7('0x30')](_0xde7ed[_0x43e7('0x31')],_0xde7ed[_0x43e7('0x2c')]);_0x108313[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0xde7ed[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x117c07['query']['fields']));_0x108313['attributes']=_0x108313[_0x43e7('0x32')][_0x43e7('0x34')]?_0x108313[_0x43e7('0x32')]:_0xde7ed[_0x43e7('0x31')];if(_0x117c07[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x108313[_0x43e7('0x2b')]=[{'all':!![]}];}_0x108313=_[_0x43e7('0x36')]({},_0x108313,_0x117c07['options']);return db[_0x43e7('0x25')][_0x43e7('0x37')](_0x108313)['then'](handleEntityNotFound(_0x234fe6,null))[_0x43e7('0x13')](respondWithResult(_0x234fe6,null))['catch'](handleError(_0x234fe6,null));};exports[_0x43e7('0x38')]=function(_0x2ad008,_0x1c6f45){return db[_0x43e7('0x25')][_0x43e7('0x38')](_0x2ad008[_0x43e7('0x39')],{})['then'](function(_0x574a93){var _0x30dfa9=_0x2ad008[_0x43e7('0x3a')][_0x43e7('0x15')]({'plain':!![]});if(!_0x30dfa9)throw new Error(_0x43e7('0x3b'));if(_0x30dfa9[_0x43e7('0x3c')]==='user'){var _0x32a451=_0x574a93[_0x43e7('0x15')]({'plain':!![]});var _0x575439=[{'name':_0x43e7('0x16'),'value':'inbound'},{'name':_0x43e7('0x18'),'value':'outbound'}];var _0x3d81ae=_[_0x43e7('0x37')](_0x575439,[_0x43e7('0x1b'),_0x32a451[_0x43e7('0x1d')]])['name'];return db['UserProfileSection'][_0x43e7('0x37')]({'where':{'name':_0x3d81ae,'userProfileId':_0x30dfa9[_0x43e7('0x3d')]},'raw':!![]})[_0x43e7('0x13')](function(_0x36b770){if(_0x36b770&&_0x36b770['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x32a451[_0x43e7('0x21')],'resourceId':_0x32a451['id'],'type':_0x36b770['name'],'sectionId':_0x36b770['id']},{})[_0x43e7('0x13')](function(){return _0x574a93;});}else{return _0x574a93;}})['catch'](function(_0x5b28db){logger[_0x43e7('0x3e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b28db);throw _0x5b28db;});}return _0x574a93;})[_0x43e7('0x13')](respondWithResult(_0x1c6f45,0xc9))[_0x43e7('0x2e')](handleError(_0x1c6f45,null));};exports[_0x43e7('0x3f')]=function(_0x99b9e1,_0x4fc5e8){var _0x91f1e4={'where':{'id':_0x99b9e1[_0x43e7('0x40')]['id']}},_0x2b9046={};_0x2b9046[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x25')]['rawAttributes']);_0x91f1e4['attributes']=_[_0x43e7('0x30')](_0x2b9046[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x99b9e1['query']['fields']));_0x91f1e4['attributes']=_0x91f1e4[_0x43e7('0x32')][_0x43e7('0x34')]?_0x91f1e4['attributes']:_0x2b9046[_0x43e7('0x31')];if(_0x99b9e1[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x91f1e4['include']=[{'all':!![]}];}_0x91f1e4=_['merge']({},_0x91f1e4,_0x99b9e1['options']);return db['VoiceQueue'][_0x43e7('0x37')](_0x91f1e4)[_0x43e7('0x13')](handleEntityNotFound(_0x4fc5e8,null))['then'](function(_0x23e7cb){if(_0x23e7cb){var _0x82d32f=_0x23e7cb[_0x43e7('0x15')]({'plain':!![]});_0x82d32f=qs[_0x43e7('0x42')](_0x82d32f,['id','createdAt',_0x43e7('0x43')]);_0x99b9e1['body']=_['omit'](_0x99b9e1[_0x43e7('0x39')],['id',_0x43e7('0x44'),_0x43e7('0x43')]);return db[_0x43e7('0x25')][_0x43e7('0x38')](_[_0x43e7('0x36')](_0x82d32f,_0x99b9e1[_0x43e7('0x39')]),{'include':_0x99b9e1[_0x43e7('0x2c')][_0x43e7('0x35')]?[{'all':!![]}]:undefined})[_0x43e7('0x13')](function(_0x58dfd0){var _0x119d34=_0x99b9e1[_0x43e7('0x3a')]['get']({'plain':!![]});if(!_0x119d34)throw new Error(_0x43e7('0x3b'));if(_0x119d34['role']===_0x43e7('0x3a')){var _0x520857=_0x58dfd0[_0x43e7('0x15')]({'plain':!![]});var _0x1f561f=[{'name':_0x43e7('0x16'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x43e7('0x45')}];var _0x2ab7ee=_[_0x43e7('0x37')](_0x1f561f,[_0x43e7('0x1b'),_0x520857[_0x43e7('0x1d')]])[_0x43e7('0x21')];return db[_0x43e7('0x46')][_0x43e7('0x37')]({'where':{'name':_0x2ab7ee,'userProfileId':_0x119d34[_0x43e7('0x3d')]},'raw':!![]})[_0x43e7('0x13')](function(_0x312306){if(_0x312306&&_0x312306['autoAssociation']===0x0){return db[_0x43e7('0x1e')][_0x43e7('0x38')]({'name':_0x520857['name'],'resourceId':_0x520857['id'],'type':_0x312306[_0x43e7('0x21')],'sectionId':_0x312306['id']},{})[_0x43e7('0x13')](function(){return _0x58dfd0;});}else{return _0x58dfd0;}})[_0x43e7('0x2e')](function(_0x558d54){logger['error'](_0x43e7('0x47'),_0x558d54);throw _0x558d54;});}return _0x58dfd0;});}})[_0x43e7('0x13')](respondWithResult(_0x4fc5e8,0xc9))['catch'](handleError(_0x4fc5e8,null));};exports[_0x43e7('0x48')]=function(_0x54506d,_0x49a6ce){if(_0x54506d[_0x43e7('0x39')]['id']){delete _0x54506d[_0x43e7('0x39')]['id'];}return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x54506d[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x49a6ce,null))[_0x43e7('0x13')](saveUpdates(_0x54506d[_0x43e7('0x39')],null))['then'](respondWithResult(_0x49a6ce,null))[_0x43e7('0x2e')](handleError(_0x49a6ce,null));};exports[_0x43e7('0x14')]=function(_0x296a0d,_0x5bb536){return db['VoiceQueue']['find']({'where':{'id':_0x296a0d[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x5bb536,null))[_0x43e7('0x13')](removeEntity(_0x5bb536,null))[_0x43e7('0x2e')](handleError(_0x5bb536,null));};exports['getHoppers']=function(_0x5a50fc,_0x1b27da){var _0x8b50bb={'raw':![],'where':{}};var _0x140438={};var _0x5dd349={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x5a50fc[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x1b27da,null))[_0x43e7('0x13')](function(_0x3369b8){if(_0x3369b8){_0x140438[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x4a')][_0x43e7('0x26')]);_0x140438[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x5a50fc['query']);_0x140438['filters']=_[_0x43e7('0x30')](_0x140438['model'],_0x140438['query']);_0x8b50bb['attributes']=_[_0x43e7('0x30')](_0x140438[_0x43e7('0x31')],qs['fields'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x8b50bb[_0x43e7('0x32')]=_0x8b50bb['attributes'][_0x43e7('0x34')]?_0x8b50bb[_0x43e7('0x32')]:_0x140438[_0x43e7('0x31')];if(!_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x8b50bb[_0x43e7('0x11')]=qs['limit'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x8b50bb[_0x43e7('0xe')]=qs['offset'](_0x5a50fc['query'][_0x43e7('0xe')]);}_0x8b50bb['order']=qs['sort'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x8b50bb['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x5a50fc[_0x43e7('0x2c')],_0x140438[_0x43e7('0x4e')]));_0x8b50bb[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x3369b8['id'];if(_0x5a50fc[_0x43e7('0x2c')]['filter']){_0x8b50bb[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x8b50bb['where'],{'$or':_[_0x43e7('0x1a')](_0x8b50bb['attributes'],function(_0x26ee52){var _0x248936={};_0x248936[_0x26ee52]={'$like':'%'+_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x248936;})});}_0x8b50bb=_['merge']({},_0x8b50bb,_0x5a50fc[_0x43e7('0x51')]);return db[_0x43e7('0x4a')][_0x43e7('0x10')]({'where':_0x8b50bb['where']})[_0x43e7('0x13')](function(_0x38fa5b){_0x5dd349[_0x43e7('0x10')]=_0x38fa5b;if(_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x8b50bb['include']=[{'all':!![]}];}return db[_0x43e7('0x4a')][_0x43e7('0x2d')](_0x8b50bb);})[_0x43e7('0x13')](function(_0x2499ef){_0x5dd349[_0x43e7('0x52')]=_0x2499ef;return _0x5dd349;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x1b27da,_0x8b50bb))[_0x43e7('0x2e')](handleError(_0x1b27da,null));};exports['getHopperHistories']=function(_0x499ee9,_0x405faa){var _0x536477={'raw':!![],'where':{}};var _0x550036={};var _0x5b98bf={'count':0x0,'rows':[]};return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x499ee9[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x405faa,null))[_0x43e7('0x13')](function(_0x1ae0c8){if(_0x1ae0c8){_0x550036['model']=_[_0x43e7('0x41')](db[_0x43e7('0x53')][_0x43e7('0x26')]);_0x550036['query']=_[_0x43e7('0x41')](_0x499ee9[_0x43e7('0x2c')]);_0x550036[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x550036[_0x43e7('0x31')],_0x550036[_0x43e7('0x2c')]);_0x536477[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x550036['model'],qs['fields'](_0x499ee9['query'][_0x43e7('0x33')]));_0x536477[_0x43e7('0x32')]=_0x536477['attributes'][_0x43e7('0x34')]?_0x536477[_0x43e7('0x32')]:_0x550036[_0x43e7('0x31')];if(!_0x499ee9[_0x43e7('0x2c')]['hasOwnProperty']('nolimit')){_0x536477['limit']=qs[_0x43e7('0x11')](_0x499ee9[_0x43e7('0x2c')]['limit']);_0x536477['offset']=qs[_0x43e7('0xe')](_0x499ee9[_0x43e7('0x2c')][_0x43e7('0xe')]);}_0x536477['order']=qs[_0x43e7('0x4d')](_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x536477[_0x43e7('0x2a')]=qs['filters'](_[_0x43e7('0x4f')](_0x499ee9['query'],_0x550036[_0x43e7('0x4e')]));_0x536477[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x1ae0c8['id'];if(_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x536477[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x536477['where'],{'$or':_[_0x43e7('0x1a')](_0x536477[_0x43e7('0x32')],function(_0x1aea4e){var _0x6fb694={};_0x6fb694[_0x1aea4e]={'$like':'%'+_0x499ee9['query']['filter']+'%'};return _0x6fb694;})});}_0x536477=_['merge']({},_0x536477,_0x499ee9[_0x43e7('0x51')]);return db['CmHopperHistory'][_0x43e7('0x10')]({'where':_0x536477[_0x43e7('0x2a')]})[_0x43e7('0x13')](function(_0x7387f6){_0x5b98bf[_0x43e7('0x10')]=_0x7387f6;if(_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x536477[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x53')][_0x43e7('0x2d')](_0x536477);})[_0x43e7('0x13')](function(_0x5b3565){_0x5b98bf[_0x43e7('0x52')]=_0x5b3565;return _0x5b98bf;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x405faa,_0x536477))[_0x43e7('0x2e')](handleError(_0x405faa,null));};exports[_0x43e7('0x54')]=function(_0x206e54,_0x4ea4a9){var _0x5e04ec={'raw':!![],'where':{}};var _0x162a27={};var _0x3e3c82={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x206e54[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ea4a9,null))['then'](function(_0x1e869a){if(_0x1e869a){_0x162a27[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x55')][_0x43e7('0x26')]);_0x162a27['query']=_['keys'](_0x206e54[_0x43e7('0x2c')]);_0x162a27[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x162a27[_0x43e7('0x31')],_0x162a27['query']);_0x5e04ec[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x162a27[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x206e54['query'][_0x43e7('0x33')]));_0x5e04ec[_0x43e7('0x32')]=_0x5e04ec[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5e04ec[_0x43e7('0x32')]:_0x162a27['model'];if(!_0x206e54[_0x43e7('0x2c')][_0x43e7('0x4b')]('nolimit')){_0x5e04ec[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0x206e54[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x5e04ec['offset']=qs[_0x43e7('0xe')](_0x206e54['query'][_0x43e7('0xe')]);}_0x5e04ec[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x206e54[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x5e04ec[_0x43e7('0x2a')]=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x206e54[_0x43e7('0x2c')],_0x162a27['filters']));_0x5e04ec[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x1e869a['id'];if(_0x206e54[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x5e04ec['where']=_['merge'](_0x5e04ec[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x5e04ec[_0x43e7('0x32')],function(_0x4d30f7){var _0x12e7a8={};_0x12e7a8[_0x4d30f7]={'$like':'%'+_0x206e54['query']['filter']+'%'};return _0x12e7a8;})});}_0x5e04ec=_['merge']({},_0x5e04ec,_0x206e54[_0x43e7('0x51')]);return db['CmHopperFinal'][_0x43e7('0x10')]({'where':_0x5e04ec[_0x43e7('0x2a')]})[_0x43e7('0x13')](function(_0x2fea54){_0x3e3c82[_0x43e7('0x10')]=_0x2fea54;if(_0x206e54['query']['includeAll']){_0x5e04ec[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x55')]['findAll'](_0x5e04ec);})[_0x43e7('0x13')](function(_0x10fd28){_0x3e3c82[_0x43e7('0x52')]=_0x10fd28;return _0x3e3c82;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x4ea4a9,_0x5e04ec))[_0x43e7('0x2e')](handleError(_0x4ea4a9,null));};exports[_0x43e7('0x57')]=function(_0x399253,_0x32e698){var _0x39ce5e={'raw':!![],'where':{}};var _0x284617={};var _0x610819={'count':0x0,'rows':[]};return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x399253[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x32e698,null))[_0x43e7('0x13')](function(_0x3286b1){if(_0x3286b1){_0x284617[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x58')][_0x43e7('0x26')]);_0x284617[_0x43e7('0x2c')]=_['keys'](_0x399253[_0x43e7('0x2c')]);_0x284617[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x284617[_0x43e7('0x31')],_0x284617['query']);_0x39ce5e[_0x43e7('0x32')]=_['intersection'](_0x284617[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x399253[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x39ce5e[_0x43e7('0x32')]=_0x39ce5e[_0x43e7('0x32')]['length']?_0x39ce5e[_0x43e7('0x32')]:_0x284617[_0x43e7('0x31')];if(!_0x399253[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x39ce5e['limit']=qs['limit'](_0x399253[_0x43e7('0x2c')]['limit']);_0x39ce5e[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x399253[_0x43e7('0x2c')][_0x43e7('0xe')]);}_0x39ce5e['order']=qs['sort'](_0x399253['query'][_0x43e7('0x4d')]);_0x39ce5e['where']=qs['filters'](_['pick'](_0x399253[_0x43e7('0x2c')],_0x284617[_0x43e7('0x4e')]));_0x39ce5e['where'][_0x43e7('0x50')]=_0x3286b1['id'];if(_0x399253['query'][_0x43e7('0x19')]){_0x39ce5e[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x39ce5e[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x39ce5e['attributes'],function(_0x1f4162){var _0x449cb4={};_0x449cb4[_0x1f4162]={'$like':'%'+_0x399253[_0x43e7('0x2c')]['filter']+'%'};return _0x449cb4;})});}_0x39ce5e=_['merge']({},_0x39ce5e,_0x399253[_0x43e7('0x51')]);return db[_0x43e7('0x58')][_0x43e7('0x10')]({'where':_0x39ce5e[_0x43e7('0x2a')]})['then'](function(_0x385cc1){_0x610819[_0x43e7('0x10')]=_0x385cc1;if(_0x399253[_0x43e7('0x2c')]['includeAll']){_0x39ce5e[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x58')][_0x43e7('0x2d')](_0x39ce5e);})[_0x43e7('0x13')](function(_0x541ce8){_0x610819[_0x43e7('0x52')]=_0x541ce8;return _0x610819;});}})['then'](respondWithFilteredResult(_0x32e698,_0x39ce5e))[_0x43e7('0x2e')](handleError(_0x32e698,null));};exports[_0x43e7('0x59')]=function(_0x47f29f,_0x4e5484){var _0xc62dc9={};var _0x1480c6={};var _0x21d001;var _0x4600e5;return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x47f29f[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x4e5484,null))[_0x43e7('0x13')](function(_0xfc577b){if(_0xfc577b){_0x21d001=_0xfc577b;_0x1480c6[_0x43e7('0x31')]=_['keys'](db[_0x43e7('0x5a')]['rawAttributes']);_0x1480c6[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x47f29f[_0x43e7('0x2c')]);_0x1480c6['filters']=_[_0x43e7('0x30')](_0x1480c6[_0x43e7('0x31')],_0x1480c6[_0x43e7('0x2c')]);_0xc62dc9[_0x43e7('0x32')]=_['intersection'](_0x1480c6[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x47f29f['query']['fields']));_0xc62dc9['attributes']=_0xc62dc9[_0x43e7('0x32')][_0x43e7('0x34')]?_0xc62dc9[_0x43e7('0x32')]:_0x1480c6[_0x43e7('0x31')];_0xc62dc9[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0xc62dc9['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x47f29f[_0x43e7('0x2c')],_0x1480c6[_0x43e7('0x4e')]));if(_0x47f29f['query']['filter']){_0xc62dc9[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0xc62dc9[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0xc62dc9['attributes'],function(_0x2f529b){var _0x427cec={};_0x427cec[_0x2f529b]={'$like':'%'+_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x427cec;})});}_0xc62dc9=_[_0x43e7('0x36')]({},_0xc62dc9,_0x47f29f[_0x43e7('0x51')]);return _0x21d001['getTeams'](_0xc62dc9);}})[_0x43e7('0x13')](function(_0x52c974){if(_0x52c974){_0x4600e5=_0x52c974['length'];if(!_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x4b')]('nolimit')){_0xc62dc9['limit']=qs[_0x43e7('0x11')](_0x47f29f[_0x43e7('0x2c')]['limit']);_0xc62dc9[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x47f29f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x21d001['getTeams'](_0xc62dc9);}})['then'](function(_0x2a084b){if(_0x2a084b){return _0x2a084b?{'count':_0x4600e5,'rows':_0x2a084b}:null;}})[_0x43e7('0x13')](respondWithResult(_0x4e5484,null))[_0x43e7('0x2e')](handleError(_0x4e5484,null));};exports['addTeams']=function(_0x49de67,_0x298239){var _0xf682ec=_0x49de67[_0x43e7('0x39')][_0x43e7('0x5b')];var _0x1e247f=_[_0x43e7('0x1a')](_0xf682ec,'id');return db[_0x43e7('0x5a')][_0x43e7('0x2d')]({'where':{'id':_0x1e247f},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x43e7('0x5c'),'voicePause',_0x43e7('0x5d')],'raw':!![]}]})[_0x43e7('0x13')](function(_0x44fee0){if(_0x44fee0){var _0x41d130=_[_0x43e7('0x5e')](_0x44fee0,function(_0x5e87d6){var _0x21039a=_0x5e87d6[_0x43e7('0x15')]({'plain':!![]});_0x21039a[_0x43e7('0x5f')][_0x43e7('0x60')](function(_0x59f68a){_0x59f68a[_0x43e7('0x61')]=_[_0x43e7('0x37')](_0xf682ec,{'id':_0x21039a['id']})[_0x43e7('0x61')];});return _0x21039a[_0x43e7('0x5f')];});return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x49de67[_0x43e7('0x40')]['id']}})['then'](function(_0xc9356c){return db[_0x43e7('0x62')][_0x43e7('0x63')](function(_0x3637d9){return _0xc9356c[_0x43e7('0x64')](_0x1e247f,{'transaction':_0x3637d9})['then'](function(){return BPromise[_0x43e7('0x65')](_0xf682ec,function(_0x25ddf8){return db['TeamVoiceQueue'][_0x43e7('0x66')]({'TeamId':_0x25ddf8['id'],'VoiceQueueId':_0x49de67[_0x43e7('0x40')]['id'],'penalty':_0x25ddf8['penalty']},{'transaction':_0x3637d9});});})[_0x43e7('0x13')](function(){return BPromise[_0x43e7('0x65')](_0x41d130,function(_0x110154){return db[_0x43e7('0x67')][_0x43e7('0x68')]({'where':{'UserId':_0x110154['id'],'VoiceQueueId':_0x49de67['params']['id']},'defaults':{'penalty':_0x110154[_0x43e7('0x61')]},'transaction':_0x3637d9});});})[_0x43e7('0x13')](function(){return BPromise[_0x43e7('0x65')](_['filter'](_0x41d130,{'online':!![]}),function(_0x32b788){return db[_0x43e7('0x69')]['upsert']({'membername':_0x32b788[_0x43e7('0x21')],'UserId':_0x32b788['id'],'queue_name':_0xc9356c[_0x43e7('0x21')],'VoiceQueueId':_0xc9356c['id'],'interface':_[_0x43e7('0x6a')](_0x32b788[_0x43e7('0x5d')])?util[_0x43e7('0x6b')](_0x43e7('0x6c'),_0x32b788['name']):_0x32b788[_0x43e7('0x5d')],'paused':_0x32b788[_0x43e7('0x6d')]||![],'penalty':_0x32b788[_0x43e7('0x61')]},{'transaction':_0x3637d9});});})['then'](function(){_0x41d130[_0x43e7('0x60')](function(_0x21901c){socket[_0x43e7('0x6e')](_0x43e7('0x6f'),{'UserId':_0x21901c['id'],'VoiceQueueId':_0xc9356c['id']});});});});});}})[_0x43e7('0x13')](respondWithStatusCode(_0x298239,null))[_0x43e7('0x2e')](handleError(_0x298239,null));};exports[_0x43e7('0x70')]=function(_0x1896b3,_0x4345a5){return db['Team'][_0x43e7('0x2d')]({'where':{'id':_0x1896b3[_0x43e7('0x2c')][_0x43e7('0x71')]},'attributes':['id'],'include':[{'model':db[_0x43e7('0x72')],'as':_0x43e7('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x43e7('0x13')](handleEntityNotFound(_0x4345a5,null))[_0x43e7('0x13')](function(_0x3e8631){var _0x51e17c=_[_0x43e7('0x1a')](_0x3e8631,'id');var _0x6246c4=[];var _0xd0dca2=[];var _0xa721ba=squel[_0x43e7('0x73')]();_0xa721ba['field'](_0x43e7('0x74'))[_0x43e7('0x75')](_0x43e7('0x76'),'tq')[_0x43e7('0x77')](_0x43e7('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x43e7('0x2a')]('VoiceQueueId\x20=\x20?',_0x1896b3[_0x43e7('0x40')]['id']);for(var _0x339826=0x0;_0x339826<_0x3e8631[_0x43e7('0x34')];_0x339826+=0x1){let _0xc28ac6=_0x3e8631[_0x339826];for(var _0x4b0abd=0x0;_0x4b0abd<_0xc28ac6[_0x43e7('0x5f')][_0x43e7('0x34')];_0x4b0abd+=0x1){let _0x41d636=_0xc28ac6[_0x43e7('0x5f')][_0x4b0abd];var _0x19bdf7=_0xa721ba[_0x43e7('0x3f')]();_0x19bdf7[_0x43e7('0x2a')](_0x43e7('0x79'),_0x41d636['id']);_0xd0dca2[_0x43e7('0x7a')](db[_0x43e7('0x62')][_0x43e7('0x2c')](_0x19bdf7['toString'](),{'type':db['sequelize'][_0x43e7('0x7b')]['SELECT']})['then'](function(_0x4a0d5d){if(_0x4a0d5d[_0x43e7('0x34')]===0x1){return _0x41d636['id'];}else{var _0x5eae45=_[_0x43e7('0x7c')](_['map'](_0x4a0d5d,'TeamId'),function(_0x55f1df){return _[_0x43e7('0x1c')](_0x51e17c,_0x55f1df);});if(_0x5eae45){return _0x41d636['id'];}}}));}}return BPromise[_0x43e7('0x7d')](_0xd0dca2)[_0x43e7('0x13')](function(_0xd6ebb0){_0x6246c4=_(_0x6246c4)[_0x43e7('0x7e')](_0xd6ebb0)[_0x43e7('0x7f')]()[_0x43e7('0x1b')]();return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1896b3[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](function(_0x2a1218){return db[_0x43e7('0x62')][_0x43e7('0x63')](function(_0xe14e67){return _0x2a1218[_0x43e7('0x70')](_0x1896b3[_0x43e7('0x2c')][_0x43e7('0x71')],{'transaction':_0xe14e67})[_0x43e7('0x13')](function(){if(!_[_0x43e7('0x80')](_0x6246c4)){return _0x2a1218['removeAgents'](_0x6246c4,{'transaction':_0xe14e67})[_0x43e7('0x13')](function(){return db[_0x43e7('0x69')]['destroy']({'where':{'VoiceQueueId':_0x1896b3[_0x43e7('0x40')]['id'],'UserId':_0x6246c4},'transaction':_0xe14e67});});}})[_0x43e7('0x13')](function(){_0x6246c4[_0x43e7('0x60')](function(_0x32b33c){socket['emit'](_0x43e7('0x81'),{'UserId':_0x32b33c,'VoiceQueueId':_0x2a1218['id']});});});});});});})[_0x43e7('0x13')](respondWithStatusCode(_0x4345a5,null))['catch'](handleError(_0x4345a5,null));};exports[_0x43e7('0x82')]=function(_0x1a520e,_0xb4cf23){var _0x559145,_0x22b824;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1a520e[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0xb4cf23,null))['then'](function(_0x33b63b){if(_0x33b63b){_0x22b824=_0x33b63b;return _0x33b63b[_0x43e7('0x82')](_0x1a520e['body'][_0x43e7('0x71')],_['omit'](_0x1a520e['body'],['ids','id'])||{})['spread'](function(_0x255113){for(var _0x451fb5=0x0;_0x451fb5<_0x1a520e[_0x43e7('0x39')][_0x43e7('0x71')]['length'];_0x451fb5+=0x1){socket['emit'](_0x43e7('0x6f'),{'UserId':Number(_0x1a520e['body'][_0x43e7('0x71')][_0x451fb5]),'VoiceQueueId':Number(_0x1a520e['params']['id'])});}return _0x255113;});}})[_0x43e7('0x13')](function(_0x4cf7e9){_0x559145=_0x4cf7e9||[];if(_0x22b824){return db['User']['findAll']({'where':{'id':_0x1a520e['body'][_0x43e7('0x71')]},'attributes':['id',_0x43e7('0x21'),_0x43e7('0x5c'),'voicePause',_0x43e7('0x5d')],'raw':!![]});}})[_0x43e7('0x13')](function(_0x517289){if(!_['isEmpty'](_0x517289)){var _0x25fd39=[];for(var _0xb2aca0=0x0;_0xb2aca0<_0x517289[_0x43e7('0x34')];_0xb2aca0++){if(_0x517289[_0xb2aca0][_0x43e7('0x5c')]){_0x25fd39['push'](db[_0x43e7('0x69')]['upsert']({'membername':_0x517289[_0xb2aca0][_0x43e7('0x21')],'UserId':_0x517289[_0xb2aca0]['id'],'queue_name':_0x22b824[_0x43e7('0x21')],'VoiceQueueId':_0x22b824['id'],'interface':_[_0x43e7('0x6a')](_0x517289[_0xb2aca0][_0x43e7('0x5d')])?util[_0x43e7('0x6b')](_0x43e7('0x6c'),_0x517289[_0xb2aca0][_0x43e7('0x21')]):_0x517289[_0xb2aca0]['interface'],'paused':_0x517289[_0xb2aca0][_0x43e7('0x6d')]||![],'penalty':_0x1a520e[_0x43e7('0x39')]['penalty']||0x0}));}}return BPromise[_0x43e7('0x7d')](_0x25fd39);}})[_0x43e7('0x13')](function(){return _0x559145;})[_0x43e7('0x13')](respondWithResult(_0xb4cf23,null))[_0x43e7('0x2e')](handleError(_0xb4cf23,null));};exports[_0x43e7('0x83')]=function(_0x4fd17e,_0x3fd573){return db['VoiceQueue'][_0x43e7('0x37')]({'where':{'id':_0x4fd17e['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x3fd573,null))[_0x43e7('0x13')](function(_0x4446cb){if(_0x4446cb){return _0x4446cb[_0x43e7('0x83')](_0x4fd17e[_0x43e7('0x2c')]['ids'])[_0x43e7('0x13')](function(){if(_['isArray'](_0x4fd17e[_0x43e7('0x2c')][_0x43e7('0x71')])){for(var _0x34d476=0x0;_0x34d476<_0x4fd17e['query'][_0x43e7('0x71')][_0x43e7('0x34')];_0x34d476+=0x1){socket[_0x43e7('0x6e')](_0x43e7('0x81'),{'UserId':Number(_0x4fd17e[_0x43e7('0x2c')]['ids'][_0x34d476]),'VoiceQueueId':Number(_0x4fd17e[_0x43e7('0x40')]['id'])});}}else{socket['emit'](_0x43e7('0x81'),{'UserId':Number(_0x4fd17e[_0x43e7('0x2c')][_0x43e7('0x71')]),'VoiceQueueId':Number(_0x4fd17e[_0x43e7('0x40')]['id'])});}});}})[_0x43e7('0x13')](function(_0x34ed9e){return db[_0x43e7('0x69')]['destroy']({'where':{'VoiceQueueId':_0x4fd17e[_0x43e7('0x40')]['id'],'UserId':_0x4fd17e['query'][_0x43e7('0x71')]}})[_0x43e7('0x13')](function(){return _0x34ed9e;});})[_0x43e7('0x13')](respondWithStatusCode(_0x3fd573,null))[_0x43e7('0x2e')](handleError(_0x3fd573,null));};exports[_0x43e7('0x84')]=function(_0xf9178f,_0x3bb7ab){var _0x2be8c7={};var _0x2bb14d={};var _0x57f7ea;var _0x240478;return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0xf9178f[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x3bb7ab,null))[_0x43e7('0x13')](function(_0x381e47){if(_0x381e47){_0x57f7ea=_0x381e47;_0x2bb14d['model']=_[_0x43e7('0x41')](db[_0x43e7('0x72')][_0x43e7('0x26')]);_0x2bb14d[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0xf9178f[_0x43e7('0x2c')]);_0x2bb14d[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x2bb14d['model'],_0x2bb14d[_0x43e7('0x2c')]);_0x2be8c7[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x2bb14d['model'],qs[_0x43e7('0x33')](_0xf9178f[_0x43e7('0x2c')]['fields']));_0x2be8c7[_0x43e7('0x32')]=_0x2be8c7[_0x43e7('0x32')]['length']?_0x2be8c7[_0x43e7('0x32')]:_0x2bb14d[_0x43e7('0x31')];_0x2be8c7[_0x43e7('0x56')]=qs['sort'](_0xf9178f[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x2be8c7['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0xf9178f[_0x43e7('0x2c')],_0x2bb14d[_0x43e7('0x4e')]));if(_0xf9178f['query']['filter']){_0x2be8c7[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x2be8c7[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x2be8c7['attributes'],function(_0x1e6245){var _0x36860d={};_0x36860d[_0x1e6245]={'$like':'%'+_0xf9178f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x36860d;})});}_0x2be8c7=_['merge']({},_0x2be8c7,_0xf9178f[_0x43e7('0x51')]);return _0x57f7ea[_0x43e7('0x84')](_0x2be8c7);}})[_0x43e7('0x13')](function(_0x3ff5d6){if(_0x3ff5d6){_0x240478=_0x3ff5d6[_0x43e7('0x34')];if(!_0xf9178f['query']['hasOwnProperty']('nolimit')){_0x2be8c7[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0xf9178f[_0x43e7('0x2c')]['limit']);_0x2be8c7[_0x43e7('0xe')]=qs['offset'](_0xf9178f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x57f7ea[_0x43e7('0x84')](_0x2be8c7);}})[_0x43e7('0x13')](function(_0x249a8d){if(_0x249a8d){return _0x249a8d?{'count':_0x240478,'rows':_0x249a8d}:null;}})[_0x43e7('0x13')](respondWithResult(_0x3bb7ab,null))['catch'](handleError(_0x3bb7ab,null));};exports[_0x43e7('0x85')]=function(_0x202421,_0x12e4a3){var _0x16ca0e={};var _0x2f467b={};var _0x7f43b5;var _0x4637f6;return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x202421[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x12e4a3,null))[_0x43e7('0x13')](function(_0x24e9a7){if(_0x24e9a7){_0x7f43b5=_0x24e9a7;_0x2f467b['model']=_[_0x43e7('0x41')](db[_0x43e7('0x69')]['rawAttributes']);_0x2f467b[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x202421['query']);_0x2f467b[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x2f467b[_0x43e7('0x31')],_0x2f467b['query']);_0x16ca0e['attributes']=_[_0x43e7('0x30')](_0x2f467b[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x16ca0e[_0x43e7('0x32')]=_0x16ca0e[_0x43e7('0x32')][_0x43e7('0x34')]?_0x16ca0e['attributes']:_0x2f467b[_0x43e7('0x31')];_0x16ca0e[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x16ca0e[_0x43e7('0x2a')]=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x202421[_0x43e7('0x2c')],_0x2f467b[_0x43e7('0x4e')]));if(_0x202421[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x16ca0e['where']=_[_0x43e7('0x36')](_0x16ca0e[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x16ca0e[_0x43e7('0x32')],function(_0x49f43c){var _0xad02f6={};_0xad02f6[_0x49f43c]={'$like':'%'+_0x202421['query'][_0x43e7('0x19')]+'%'};return _0xad02f6;})});}_0x16ca0e=_['merge']({},_0x16ca0e,_0x202421[_0x43e7('0x51')]);return _0x7f43b5[_0x43e7('0x85')](_0x16ca0e);}})[_0x43e7('0x13')](function(_0x4a500c){if(_0x4a500c){_0x4637f6=_0x4a500c[_0x43e7('0x34')];if(!_0x202421[_0x43e7('0x2c')]['hasOwnProperty'](_0x43e7('0x4c'))){_0x16ca0e['limit']=qs[_0x43e7('0x11')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x16ca0e[_0x43e7('0xe')]=qs['offset'](_0x202421[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x7f43b5[_0x43e7('0x85')](_0x16ca0e);}})['then'](function(_0x12c4f9){return _0x12c4f9?{'count':_0x4637f6,'rows':_0x12c4f9}:null;})[_0x43e7('0x13')](respondWithResult(_0x12e4a3,null))[_0x43e7('0x2e')](handleError(_0x12e4a3,null));};exports[_0x43e7('0x86')]=function(_0x77c2f,_0x1e4a25){var _0x5790b5={};var _0x3f057e={};var _0x505287;var _0x221938;return db[_0x43e7('0x25')]['findOne']({'where':{'id':_0x77c2f[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x1e4a25,null))['then'](function(_0x46aa47){if(_0x46aa47){_0x505287=_0x46aa47;_0x3f057e[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x87')]['rawAttributes']);_0x3f057e['query']=_[_0x43e7('0x41')](_0x77c2f[_0x43e7('0x2c')]);_0x3f057e[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x3f057e[_0x43e7('0x31')],_0x3f057e[_0x43e7('0x2c')]);_0x5790b5[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x3f057e['model'],qs[_0x43e7('0x33')](_0x77c2f[_0x43e7('0x2c')]['fields']));_0x5790b5[_0x43e7('0x32')]=_0x5790b5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5790b5[_0x43e7('0x32')]:_0x3f057e[_0x43e7('0x31')];_0x5790b5[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x77c2f['query'][_0x43e7('0x4d')]);_0x5790b5['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x77c2f['query'],_0x3f057e[_0x43e7('0x4e')]));if(_0x77c2f['query'][_0x43e7('0x19')]){_0x5790b5[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x5790b5['where'],{'$or':_['map'](_0x5790b5[_0x43e7('0x32')],function(_0xcfecd2){var _0x4cd879={};_0x4cd879[_0xcfecd2]={'$like':'%'+_0x77c2f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x4cd879;})});}_0x5790b5=_[_0x43e7('0x36')]({},_0x5790b5,_0x77c2f['options']);return _0x505287[_0x43e7('0x86')](_0x5790b5);}})[_0x43e7('0x13')](function(_0xb2eb62){if(_0xb2eb62){_0x221938=_0xb2eb62['length'];if(!_0x77c2f[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x5790b5[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0x77c2f[_0x43e7('0x2c')]['limit']);_0x5790b5[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x77c2f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x505287[_0x43e7('0x86')](_0x5790b5);}})[_0x43e7('0x13')](function(_0x34ab5a){if(_0x34ab5a){return _0x34ab5a?{'count':_0x221938,'rows':_0x34ab5a}:null;}})[_0x43e7('0x13')](respondWithResult(_0x1e4a25,null))[_0x43e7('0x2e')](handleError(_0x1e4a25,null));};exports[_0x43e7('0x88')]=function(_0x13133c,_0x288d6a){var _0x47ef9d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x56598f,_0x280668;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x13133c[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x288d6a,null))[_0x43e7('0x13')](function(_0x51dc07){if(_0x51dc07){_0x280668=_0x51dc07;return _0x51dc07['addLists'](_0x13133c[_0x43e7('0x39')][_0x43e7('0x71')],_['omit'](_0x13133c['body'],[_0x43e7('0x71'),'id'])||{});}return null;})[_0x43e7('0x89')](function(_0x58a783){var _0x3d6659;_0x56598f=_0x58a783||[];var _0x57bcab=[];if(_0x58a783){for(var _0x5f4023=0x0;_0x5f4023<_0x58a783[_0x43e7('0x34')];_0x5f4023+=0x1){var _0x2be66d=_0x58a783[_0x5f4023]['get']({'plain':!![]});_0x280668['dialCheckDuplicateType']=_0x13133c[_0x43e7('0x39')][_0x43e7('0x8a')]?_0x13133c[_0x43e7('0x39')][_0x43e7('0x8a')]:_0x280668['dialCheckDuplicateType'];switch(_0x280668[_0x43e7('0x8a')]){case _0x43e7('0x8b'):_0x3d6659=squel['insert']()['into']('cm_hopper')['fromQuery']([_0x43e7('0x8c'),_0x43e7('0x8d'),'ContactId','ListId',_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')]('phone',_0x43e7('0x8c'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))[_0x43e7('0x8e')]('id',_0x43e7('0x8f'))['field'](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),_0x43e7('0x92'))[_0x43e7('0x8e')](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x44'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0x93'))[_0x43e7('0x2a')](_0x43e7('0x94'))[_0x43e7('0x2a')]('ListId\x20=\x20?',_0x2be66d[_0x43e7('0x90')]['toString']())[_0x43e7('0x2a')]('phone\x20IS\x20NOT\x20NULL')[_0x43e7('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x43e7('0x73')]()['field'](_0x43e7('0x95'))[_0x43e7('0x75')](_0x43e7('0x96'))[_0x43e7('0x2a')](_0x43e7('0x97'),_0x13133c[_0x43e7('0x40')]['id'][_0x43e7('0x91')]()))[_0x43e7('0x2a')](_0x43e7('0x98'),squel[_0x43e7('0x73')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x43e7('0x99'))['where']('VoiceQueueId\x20=\x20?',_0x13133c[_0x43e7('0x40')]['id'][_0x43e7('0x91')]())))[_0x43e7('0x91')]();break;case _0x43e7('0x9a'):_0x3d6659=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')](_0x43e7('0x99'))[_0x43e7('0x9d')]([_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8f'),'ListId',_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel['select']()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))[_0x43e7('0x8e')]('id',_0x43e7('0x8f'))[_0x43e7('0x8e')](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),_0x43e7('0x92'))['field'](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27','createdAt')['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0x93'))['where'](_0x43e7('0x94'))[_0x43e7('0x2a')]('ListId\x20=\x20?',_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e'))['where'](_0x43e7('0x98'),squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x9f'))['from']('cm_hopper')[_0x43e7('0x2a')]('VoiceQueueId\x20=\x20?',_0x13133c['params']['id'][_0x43e7('0x91')]())))[_0x43e7('0x91')]();break;default:_0x3d6659=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')]('cm_hopper')[_0x43e7('0x9d')]([_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8f'),_0x43e7('0x92'),_0x43e7('0x50'),'createdAt','updatedAt'],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))['field']('id',_0x43e7('0x8f'))[_0x43e7('0x8e')](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),'ListId')[_0x43e7('0x8e')](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x44'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))[_0x43e7('0x75')]('cm_contacts')[_0x43e7('0x2a')](_0x43e7('0x94'))[_0x43e7('0x2a')](_0x43e7('0xa0'),_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e')))[_0x43e7('0x91')]();}_0x57bcab['push'](db['sequelize'][_0x43e7('0x2c')](_0x3d6659));}return BPromise[_0x43e7('0x7d')](_0x57bcab);}})[_0x43e7('0x13')](function(){var _0x3ac223=[];var _0x486780=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')](_0x43e7('0xa1'))[_0x43e7('0x9d')]([_0x43e7('0xa2'),_0x43e7('0x8c'),_0x43e7('0xa3'),'createdAt',_0x43e7('0x43')],squel['select']()['field']('h.id')[_0x43e7('0x8e')](_0x43e7('0xa4'))[_0x43e7('0x8e')](_0x43e7('0xa5'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27','createdAt')['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0xa6'),'ci')['join'](_0x43e7('0x99'),'h',_0x43e7('0xa7'))[_0x43e7('0x2a')](_0x43e7('0xa8'),_0x47ef9d)['where']('ci.ItemClass=?',_0x43e7('0xa9')))[_0x43e7('0x91')]();_0x3ac223['push'](db['sequelize'][_0x43e7('0x2c')](_0x486780));return BPromise[_0x43e7('0x7d')](_0x3ac223);})[_0x43e7('0x13')](function(){return _0x56598f;})[_0x43e7('0x13')](respondWithResult(_0x288d6a,null))[_0x43e7('0x2e')](handleError(_0x288d6a,null));};exports[_0x43e7('0xaa')]=function(_0x71807e,_0x314259){return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x71807e['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x314259,null))[_0x43e7('0x13')](function(_0x2613fc){if(_0x2613fc){return _0x2613fc[_0x43e7('0xaa')](_0x71807e['query'][_0x43e7('0x71')]);}})['then'](function(_0x17b298){if(_0x17b298){return db[_0x43e7('0x4a')][_0x43e7('0x14')]({'where':{'ListId':_0x71807e[_0x43e7('0x2c')]['ids'],'VoiceQueueId':_0x71807e['params']['id']}})[_0x43e7('0x13')](function(){return _0x17b298;});}})['then'](respondWithStatusCode(_0x314259,null))[_0x43e7('0x2e')](handleError(_0x314259,null));};exports[_0x43e7('0xab')]=function(_0x44c536,_0x3a9550){var _0x5dcd3f={};var _0x2e7f00={};var _0x2627e2;var _0x591517;return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x44c536[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x3a9550,null))[_0x43e7('0x13')](function(_0x5e042f){if(_0x5e042f){_0x2627e2=_0x5e042f;_0x2e7f00['model']=_[_0x43e7('0x41')](db[_0x43e7('0x87')][_0x43e7('0x26')]);_0x2e7f00[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x44c536[_0x43e7('0x2c')]);_0x2e7f00[_0x43e7('0x4e')]=_['intersection'](_0x2e7f00[_0x43e7('0x31')],_0x2e7f00[_0x43e7('0x2c')]);_0x5dcd3f[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x2e7f00[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x5dcd3f[_0x43e7('0x32')]=_0x5dcd3f[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5dcd3f[_0x43e7('0x32')]:_0x2e7f00[_0x43e7('0x31')];_0x5dcd3f[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x5dcd3f['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x44c536[_0x43e7('0x2c')],_0x2e7f00[_0x43e7('0x4e')]));if(_0x44c536[_0x43e7('0x2c')]['filter']){_0x5dcd3f[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x5dcd3f[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x5dcd3f[_0x43e7('0x32')],function(_0x5278fd){var _0x84b4f4={};_0x84b4f4[_0x5278fd]={'$like':'%'+_0x44c536['query']['filter']+'%'};return _0x84b4f4;})});}_0x5dcd3f=_['merge']({},_0x5dcd3f,_0x44c536[_0x43e7('0x51')]);return _0x2627e2[_0x43e7('0xab')](_0x5dcd3f);}})[_0x43e7('0x13')](function(_0x4ee587){if(_0x4ee587){_0x591517=_0x4ee587[_0x43e7('0x34')];if(!_0x44c536[_0x43e7('0x2c')]['hasOwnProperty'](_0x43e7('0x4c'))){_0x5dcd3f[_0x43e7('0x11')]=qs['limit'](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x5dcd3f[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x44c536[_0x43e7('0x2c')]['offset']);}return _0x2627e2[_0x43e7('0xab')](_0x5dcd3f);}})[_0x43e7('0x13')](function(_0x3b641e){if(_0x3b641e){return _0x3b641e?{'count':_0x591517,'rows':_0x3b641e}:null;}})[_0x43e7('0x13')](respondWithResult(_0x3a9550,null))[_0x43e7('0x2e')](handleError(_0x3a9550,null));};exports['addBlackLists']=function(_0x5b046d,_0x4a0427){var _0xc3460c;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x5b046d[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x4a0427,null))[_0x43e7('0x13')](function(_0x19c1d2){if(_0x19c1d2){return _0x19c1d2[_0x43e7('0xac')](_0x5b046d['body'][_0x43e7('0x71')],_['omit'](_0x5b046d[_0x43e7('0x39')],[_0x43e7('0x71'),'id'])||{});}return null;})[_0x43e7('0x89')](function(_0x40cc83){var _0x148d72;_0xc3460c=_0x40cc83||[];var _0x1ceb94=[];if(_0x40cc83){for(var _0x19c29b=0x0;_0x19c29b<_0x40cc83[_0x43e7('0x34')];_0x19c29b+=0x1){var _0x38a8db=_0x40cc83[_0x19c29b]['get']({'plain':!![]});_0x148d72=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')]('cm_hopper_black')['fromQuery']([_0x43e7('0x8c'),_0x43e7('0x8f'),_0x43e7('0x92'),_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))[_0x43e7('0x8e')]('id','ContactId')[_0x43e7('0x8e')](_0x38a8db['CmListId'][_0x43e7('0x91')](),_0x43e7('0x92'))[_0x43e7('0x8e')](_0x5b046d[_0x43e7('0x40')]['id']['toString'](),_0x43e7('0x50'))[_0x43e7('0x8e')]('NOW()',_0x43e7('0x44'))[_0x43e7('0x8e')](_0x43e7('0xad'),_0x43e7('0x43'))[_0x43e7('0x75')](_0x43e7('0x93'))[_0x43e7('0x2a')]('deletedAt\x20IS\x20NULL')[_0x43e7('0x2a')](_0x43e7('0xa0'),_0x38a8db[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e')))[_0x43e7('0x91')]();_0x1ceb94[_0x43e7('0x7a')](db[_0x43e7('0x62')]['query'](_0x148d72));}return BPromise[_0x43e7('0x7d')](_0x1ceb94);}})['then'](function(){return _0xc3460c;})[_0x43e7('0x13')](respondWithResult(_0x4a0427,null))[_0x43e7('0x2e')](handleError(_0x4a0427,null));};exports[_0x43e7('0xae')]=function(_0x1dc579,_0x6d9fb){return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1dc579['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x6d9fb,null))['then'](function(_0x59ca95){if(_0x59ca95){return _0x59ca95[_0x43e7('0xae')](_0x1dc579['query']['ids']);}})[_0x43e7('0x13')](function(_0x759eb5){if(_0x759eb5){return db[_0x43e7('0x58')][_0x43e7('0x14')]({'where':{'ListId':_0x1dc579['query'][_0x43e7('0x71')],'VoiceQueueId':_0x1dc579['params']['id']}})[_0x43e7('0x13')](function(){return _0x759eb5;});}})[_0x43e7('0x13')](respondWithStatusCode(_0x6d9fb,null))[_0x43e7('0x2e')](handleError(_0x6d9fb,null));}; \ No newline at end of file +var _0x7217=['toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','emit','userVoiceQueue:remove','addAgents','isEmpty','removeAgents','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','fromQuery','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','type','find','name','UserProfileResource','end','error','send','index','VoiceQueue','fieldName','getOptions','where','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','options','create','user','role','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','body','merge','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','pick','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','online','flatMap','penalty','sequelize','transaction','addTeams','upsert','each','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','forEach','userVoiceQueue:save','removeTeams','Agents','select','field','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push'];(function(_0xfec4f2,_0x27b2aa){var _0x4ee052=function(_0x195ba5){while(--_0x195ba5){_0xfec4f2['push'](_0xfec4f2['shift']());}};_0x4ee052(++_0x27b2aa);}(_0x7217,0x19e));var _0x7721=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x7217[_0x2bf141];return _0x48277b;};'use strict';var moment=require(_0x7721('0x0'));var BPromise=require('bluebird');var util=require(_0x7721('0x1'));var _=require(_0x7721('0x2'));var squel=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var qs=require(_0x7721('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x7721('0x6'));var db=require(_0x7721('0x7'))['db'];config[_0x7721('0x8')]=_[_0x7721('0x9')](config[_0x7721('0x8')],{'host':_0x7721('0xa'),'port':0x18eb});var socket=require(_0x7721('0xb'))(new Redis(config[_0x7721('0x8')]));require(_0x7721('0xc'))[_0x7721('0xd')](socket);function respondWithStatusCode(_0x3e6368,_0x2a66cb){_0x2a66cb=_0x2a66cb||0xcc;return function(_0xfa8835){if(_0xfa8835){return _0x3e6368[_0x7721('0xe')](_0x2a66cb);}return _0x3e6368[_0x7721('0xf')](_0x2a66cb)['end']();};}function respondWithResult(_0x461d1a,_0x29bc8f){_0x29bc8f=_0x29bc8f||0xc8;return function(_0x8729a6){if(_0x8729a6){return _0x461d1a[_0x7721('0xf')](_0x29bc8f)[_0x7721('0x10')](_0x8729a6);}};}function respondWithFilteredResult(_0x409b37,_0x1e7fd7){return function(_0x27b36b){if(_0x27b36b){var _0x55b4ca=typeof _0x1e7fd7[_0x7721('0x11')]===_0x7721('0x12')&&typeof _0x1e7fd7['limit']===_0x7721('0x12');var _0x30da54=_0x27b36b[_0x7721('0x13')];var _0x2e9752=_0x55b4ca?0x0:_0x1e7fd7['offset'];var _0x3cbce8=_0x55b4ca?_0x27b36b[_0x7721('0x13')]:_0x1e7fd7['offset']+_0x1e7fd7['limit'];var _0x4b183e;if(_0x3cbce8>=_0x30da54){_0x3cbce8=_0x30da54;_0x4b183e=0xc8;}else{_0x4b183e=0xce;}_0x409b37[_0x7721('0xf')](_0x4b183e);return _0x409b37[_0x7721('0x14')](_0x7721('0x15'),_0x2e9752+'-'+_0x3cbce8+'/'+_0x30da54)[_0x7721('0x10')](_0x27b36b);}return null;};}function saveUpdates(_0x5ed94b){return function(_0x20f669){if(_0x20f669){return _0x20f669['update'](_0x5ed94b)[_0x7721('0x16')](function(_0x5cb0e6){return _0x5cb0e6;});}return null;};}function removeEntity(_0xfec626){return function(_0x4e96fb){if(_0x4e96fb){return _0x4e96fb[_0x7721('0x17')]()[_0x7721('0x16')](function(){var _0x2286e5=_0x4e96fb[_0x7721('0x18')]({'plain':!![]});var _0x402820=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a'),'ignore':![]},{'name':_0x7721('0x1b'),'value':'outbound','ignore':![]}];var _0x288f7e=_(_0x402820)[_0x7721('0x1c')](_0x7721('0x1d'))[_0x7721('0x1e')]('value')[_0x7721('0x1f')]();if(_['includes'](_0x288f7e,_0x2286e5[_0x7721('0x20')])){return;}var _0x288e3a=_[_0x7721('0x21')](_0x402820,[_0x7721('0x1f'),_0x2286e5[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x23')]['destroy']({'where':{'type':_0x288e3a,'resourceId':_0x2286e5['id']}})[_0x7721('0x16')](function(){return _0x4e96fb;});})[_0x7721('0x16')](function(){_0xfec626[_0x7721('0xf')](0xcc)[_0x7721('0x24')]();});}};}function handleEntityNotFound(_0x40d550){return function(_0x16355a){if(!_0x16355a){_0x40d550[_0x7721('0xe')](0x194);}return _0x16355a;};}function handleError(_0xf753f1,_0x40f367){_0x40f367=_0x40f367||0x1f4;return function(_0x52316e){logger[_0x7721('0x25')](_0x52316e['stack']);if(_0x52316e['name']){delete _0x52316e[_0x7721('0x22')];}_0xf753f1[_0x7721('0xf')](_0x40f367)[_0x7721('0x26')](_0x52316e);};}exports[_0x7721('0x27')]=function(_0x1ea4d,_0x37b9f0){var _0xd7d703={};var _0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x1e')](db[_0x7721('0x28')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x29')],'type':_0x4a25c9[_0x7721('0x20')]['key']};});_0xd7d703=qs[_0x7721('0x2a')](_0x5c54f0,_0x1ea4d);var _0x4651b5={'where':_0xd7d703[_0x7721('0x2b')]};return db['VoiceQueue'][_0x7721('0x13')](_0x4651b5)[_0x7721('0x16')](function(_0x1492d4){_0x1da2d8[_0x7721('0x13')]=_0x1492d4;_0xd7d703[_0x7721('0x2c')]=qs['include'](_0x1ea4d[_0x7721('0x2d')]);return db[_0x7721('0x28')][_0x7721('0x2e')](_0xd7d703);})['then'](function(_0x35de7a){_0x1da2d8[_0x7721('0x2f')]=_0x35de7a;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x37b9f0,_0xd7d703))[_0x7721('0x30')](handleError(_0x37b9f0,null));};exports['show']=function(_0x2d6ba0,_0x326c50){var _0x19d082={'raw':![],'where':{'id':_0x2d6ba0[_0x7721('0x31')]['id']}},_0x1d894b={};_0x1d894b[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x28')][_0x7721('0x34')]);_0x1d894b[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x2d6ba0['query']);_0x1d894b[_0x7721('0x35')]=_['intersection'](_0x1d894b[_0x7721('0x32')],_0x1d894b[_0x7721('0x2d')]);_0x19d082[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1d894b[_0x7721('0x32')],qs[_0x7721('0x38')](_0x2d6ba0['query']['fields']));_0x19d082['attributes']=_0x19d082['attributes'][_0x7721('0x39')]?_0x19d082[_0x7721('0x36')]:_0x1d894b[_0x7721('0x32')];if(_0x2d6ba0[_0x7721('0x2d')]['includeAll']){_0x19d082[_0x7721('0x2c')]=[{'all':!![]}];}_0x19d082=_['merge']({},_0x19d082,_0x2d6ba0[_0x7721('0x3a')]);return db[_0x7721('0x28')]['find'](_0x19d082)[_0x7721('0x16')](handleEntityNotFound(_0x326c50,null))[_0x7721('0x16')](respondWithResult(_0x326c50,null))['catch'](handleError(_0x326c50,null));};exports['create']=function(_0x3d84d3,_0xfc4dc4){return db[_0x7721('0x28')][_0x7721('0x3b')](_0x3d84d3['body'],{})[_0x7721('0x16')](function(_0x120de9){var _0x40ce8c=_0x3d84d3[_0x7721('0x3c')][_0x7721('0x18')]({'plain':!![]});if(!_0x40ce8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40ce8c[_0x7721('0x3d')]==='user'){var _0xaa3216=_0x120de9['get']({'plain':!![]});var _0x2333b8=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':'QueueCampaigns','value':_0x7721('0x3e')}];var _0x11d853=_[_0x7721('0x21')](_0x2333b8,['value',_0xaa3216[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x11d853,'userProfileId':_0x40ce8c[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x463ccc){if(_0x463ccc&&_0x463ccc['autoAssociation']===0x0){return db['UserProfileResource'][_0x7721('0x3b')]({'name':_0xaa3216[_0x7721('0x22')],'resourceId':_0xaa3216['id'],'type':_0x463ccc[_0x7721('0x22')],'sectionId':_0x463ccc['id']},{})[_0x7721('0x16')](function(){return _0x120de9;});}else{return _0x120de9;}})[_0x7721('0x30')](function(_0x15181b){logger[_0x7721('0x25')](_0x7721('0x41'),_0x15181b);throw _0x15181b;});}return _0x120de9;})[_0x7721('0x16')](respondWithResult(_0xfc4dc4,0xc9))[_0x7721('0x30')](handleError(_0xfc4dc4,null));};exports['clone']=function(_0x578867,_0x5ed70d){var _0x6a4664={'where':{'id':_0x578867[_0x7721('0x31')]['id']}},_0x151f69={};_0x151f69['model']=_[_0x7721('0x33')](db[_0x7721('0x28')]['rawAttributes']);_0x6a4664[_0x7721('0x36')]=_['intersection'](_0x151f69[_0x7721('0x32')],qs['fields'](_0x578867[_0x7721('0x2d')][_0x7721('0x38')]));_0x6a4664[_0x7721('0x36')]=_0x6a4664['attributes'][_0x7721('0x39')]?_0x6a4664[_0x7721('0x36')]:_0x151f69['model'];if(_0x578867[_0x7721('0x2d')][_0x7721('0x42')]){_0x6a4664[_0x7721('0x2c')]=[{'all':!![]}];}_0x6a4664=_['merge']({},_0x6a4664,_0x578867[_0x7721('0x3a')]);return db['VoiceQueue'][_0x7721('0x21')](_0x6a4664)[_0x7721('0x16')](handleEntityNotFound(_0x5ed70d,null))[_0x7721('0x16')](function(_0x443503){if(_0x443503){var _0x1c95d8=_0x443503[_0x7721('0x18')]({'plain':!![]});_0x1c95d8=qs[_0x7721('0x43')](_0x1c95d8,['id',_0x7721('0x44'),_0x7721('0x45')]);_0x578867[_0x7721('0x46')]=_[_0x7721('0x43')](_0x578867[_0x7721('0x46')],['id',_0x7721('0x44'),_0x7721('0x45')]);return db[_0x7721('0x28')]['create'](_[_0x7721('0x47')](_0x1c95d8,_0x578867[_0x7721('0x46')]),{'include':_0x578867[_0x7721('0x2d')][_0x7721('0x42')]?[{'all':!![]}]:undefined})[_0x7721('0x16')](function(_0x315127){var _0x267f5e=_0x578867['user'][_0x7721('0x18')]({'plain':!![]});if(!_0x267f5e)throw new Error(_0x7721('0x48'));if(_0x267f5e[_0x7721('0x3d')]===_0x7721('0x3c')){var _0x1f1e84=_0x315127[_0x7721('0x18')]({'plain':!![]});var _0x7fbd6c=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':_0x7721('0x1b'),'value':_0x7721('0x3e')}];var _0x52e870=_[_0x7721('0x21')](_0x7fbd6c,[_0x7721('0x1f'),_0x1f1e84[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x52e870,'userProfileId':_0x267f5e[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x360882){if(_0x360882&&_0x360882[_0x7721('0x49')]===0x0){return db[_0x7721('0x23')][_0x7721('0x3b')]({'name':_0x1f1e84[_0x7721('0x22')],'resourceId':_0x1f1e84['id'],'type':_0x360882[_0x7721('0x22')],'sectionId':_0x360882['id']},{})[_0x7721('0x16')](function(){return _0x315127;});}else{return _0x315127;}})['catch'](function(_0x50e9e9){logger['error'](_0x7721('0x41'),_0x50e9e9);throw _0x50e9e9;});}return _0x315127;});}})['then'](respondWithResult(_0x5ed70d,0xc9))['catch'](handleError(_0x5ed70d,null));};exports['update']=function(_0x5d7036,_0x47925a){if(_0x5d7036[_0x7721('0x46')]['id']){delete _0x5d7036[_0x7721('0x46')]['id'];}return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x5d7036['params']['id']}})['then'](handleEntityNotFound(_0x47925a,null))['then'](saveUpdates(_0x5d7036[_0x7721('0x46')],null))['then'](respondWithResult(_0x47925a,null))['catch'](handleError(_0x47925a,null));};exports['destroy']=function(_0x160292,_0x2e9155){return db[_0x7721('0x28')]['find']({'where':{'id':_0x160292[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x2e9155,null))[_0x7721('0x16')](removeEntity(_0x2e9155,null))[_0x7721('0x30')](handleError(_0x2e9155,null));};exports[_0x7721('0x4a')]=function(_0x16e80b,_0xad43ce){var _0x3e3301={'raw':![],'where':{}};var _0x127f46={};var _0x197b73={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16e80b[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0xad43ce,null))[_0x7721('0x16')](function(_0x4cbd28){if(_0x4cbd28){_0x127f46[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x4c')][_0x7721('0x34')]);_0x127f46['query']=_[_0x7721('0x33')](_0x16e80b[_0x7721('0x2d')]);_0x127f46['filters']=_[_0x7721('0x37')](_0x127f46['model'],_0x127f46[_0x7721('0x2d')]);_0x3e3301[_0x7721('0x36')]=_[_0x7721('0x37')](_0x127f46[_0x7721('0x32')],qs[_0x7721('0x38')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x38')]));_0x3e3301[_0x7721('0x36')]=_0x3e3301[_0x7721('0x36')]['length']?_0x3e3301[_0x7721('0x36')]:_0x127f46[_0x7721('0x32')];if(!_0x16e80b[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x3e3301[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16e80b['query'][_0x7721('0x4f')]);_0x3e3301[_0x7721('0x11')]=qs['offset'](_0x16e80b[_0x7721('0x2d')]['offset']);}_0x3e3301[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x51')]);_0x3e3301[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x16e80b['query'],_0x127f46[_0x7721('0x35')]));_0x3e3301[_0x7721('0x2b')][_0x7721('0x53')]=_0x4cbd28['id'];if(_0x16e80b['query']['filter']){_0x3e3301['where']=_['merge'](_0x3e3301['where'],{'$or':_[_0x7721('0x1e')](_0x3e3301[_0x7721('0x36')],function(_0x580473){var _0x2d4b3a={};_0x2d4b3a[_0x580473]={'$like':'%'+_0x16e80b[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x2d4b3a;})});}_0x3e3301=_[_0x7721('0x47')]({},_0x3e3301,_0x16e80b['options']);return db[_0x7721('0x4c')][_0x7721('0x13')]({'where':_0x3e3301[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0x3cf3fd){_0x197b73['count']=_0x3cf3fd;if(_0x16e80b[_0x7721('0x2d')][_0x7721('0x42')]){_0x3e3301[_0x7721('0x2c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3e3301);})[_0x7721('0x16')](function(_0x752564){_0x197b73[_0x7721('0x2f')]=_0x752564;return _0x197b73;});}})[_0x7721('0x16')](respondWithFilteredResult(_0xad43ce,_0x3e3301))[_0x7721('0x30')](handleError(_0xad43ce,null));};exports['getHopperHistories']=function(_0x4ba35e,_0x263070){var _0x1bd97e={'raw':!![],'where':{}};var _0x68de4={};var _0x3c66b3={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x4ba35e[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x263070,null))[_0x7721('0x16')](function(_0x413185){if(_0x413185){_0x68de4[_0x7721('0x32')]=_['keys'](db[_0x7721('0x54')][_0x7721('0x34')]);_0x68de4[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x4ba35e['query']);_0x68de4['filters']=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],_0x68de4[_0x7721('0x2d')]);_0x1bd97e[_0x7721('0x36')]=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],qs['fields'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x38')]));_0x1bd97e[_0x7721('0x36')]=_0x1bd97e['attributes'][_0x7721('0x39')]?_0x1bd97e[_0x7721('0x36')]:_0x68de4[_0x7721('0x32')];if(!_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x1bd97e[_0x7721('0x4f')]=qs['limit'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1bd97e[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x11')]);}_0x1bd97e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x51')]);_0x1bd97e[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0x4ba35e[_0x7721('0x2d')],_0x68de4[_0x7721('0x35')]));_0x1bd97e['where'][_0x7721('0x53')]=_0x413185['id'];if(_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1bd97e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x1bd97e['where'],{'$or':_[_0x7721('0x1e')](_0x1bd97e[_0x7721('0x36')],function(_0x44326d){var _0x21b365={};_0x21b365[_0x44326d]={'$like':'%'+_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x21b365;})});}_0x1bd97e=_['merge']({},_0x1bd97e,_0x4ba35e[_0x7721('0x3a')]);return db[_0x7721('0x54')]['count']({'where':_0x1bd97e[_0x7721('0x2b')]})['then'](function(_0x453792){_0x3c66b3[_0x7721('0x13')]=_0x453792;if(_0x4ba35e['query'][_0x7721('0x42')]){_0x1bd97e['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1bd97e);})[_0x7721('0x16')](function(_0x20f12e){_0x3c66b3[_0x7721('0x2f')]=_0x20f12e;return _0x3c66b3;});}})['then'](respondWithFilteredResult(_0x263070,_0x1bd97e))['catch'](handleError(_0x263070,null));};exports['getHopperFinals']=function(_0x355aa8,_0x3f7923){var _0x3c9334={'raw':!![],'where':{}};var _0x4220cf={};var _0x3b02d7={'count':0x0,'rows':[]};return db[_0x7721('0x28')]['findOne']({'where':{'id':_0x355aa8[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3f7923,null))[_0x7721('0x16')](function(_0xcf5304){if(_0xcf5304){_0x4220cf[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x55')][_0x7721('0x34')]);_0x4220cf[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x355aa8[_0x7721('0x2d')]);_0x4220cf[_0x7721('0x35')]=_['intersection'](_0x4220cf['model'],_0x4220cf[_0x7721('0x2d')]);_0x3c9334[_0x7721('0x36')]=_['intersection'](_0x4220cf[_0x7721('0x32')],qs['fields'](_0x355aa8['query'][_0x7721('0x38')]));_0x3c9334['attributes']=_0x3c9334['attributes'][_0x7721('0x39')]?_0x3c9334[_0x7721('0x36')]:_0x4220cf[_0x7721('0x32')];if(!_0x355aa8[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x3c9334[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x355aa8[_0x7721('0x2d')][_0x7721('0x4f')]);_0x3c9334['offset']=qs['offset'](_0x355aa8[_0x7721('0x2d')][_0x7721('0x11')]);}_0x3c9334['order']=qs[_0x7721('0x51')](_0x355aa8[_0x7721('0x2d')]['sort']);_0x3c9334['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x355aa8[_0x7721('0x2d')],_0x4220cf[_0x7721('0x35')]));_0x3c9334[_0x7721('0x2b')][_0x7721('0x53')]=_0xcf5304['id'];if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x1c')]){_0x3c9334['where']=_[_0x7721('0x47')](_0x3c9334[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x3c9334[_0x7721('0x36')],function(_0xe1c795){var _0x9b5f60={};_0x9b5f60[_0xe1c795]={'$like':'%'+_0x355aa8[_0x7721('0x2d')]['filter']+'%'};return _0x9b5f60;})});}_0x3c9334=_[_0x7721('0x47')]({},_0x3c9334,_0x355aa8[_0x7721('0x3a')]);return db['CmHopperFinal'][_0x7721('0x13')]({'where':_0x3c9334[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0xb8547a){_0x3b02d7[_0x7721('0x13')]=_0xb8547a;if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x42')]){_0x3c9334[_0x7721('0x2c')]=[{'all':!![]}];}return db[_0x7721('0x55')][_0x7721('0x2e')](_0x3c9334);})['then'](function(_0x418954){_0x3b02d7[_0x7721('0x2f')]=_0x418954;return _0x3b02d7;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x3f7923,_0x3c9334))[_0x7721('0x30')](handleError(_0x3f7923,null));};exports[_0x7721('0x56')]=function(_0x47653d,_0x12869b){var _0x1cfee2={'raw':!![],'where':{}};var _0x425327={};var _0x42ee11={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x47653d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12869b,null))[_0x7721('0x16')](function(_0x461938){if(_0x461938){_0x425327[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x57')][_0x7721('0x34')]);_0x425327['query']=_[_0x7721('0x33')](_0x47653d['query']);_0x425327[_0x7721('0x35')]=_[_0x7721('0x37')](_0x425327[_0x7721('0x32')],_0x425327[_0x7721('0x2d')]);_0x1cfee2[_0x7721('0x36')]=_['intersection'](_0x425327['model'],qs['fields'](_0x47653d['query'][_0x7721('0x38')]));_0x1cfee2[_0x7721('0x36')]=_0x1cfee2[_0x7721('0x36')][_0x7721('0x39')]?_0x1cfee2[_0x7721('0x36')]:_0x425327['model'];if(!_0x47653d[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x1cfee2[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x47653d[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1cfee2[_0x7721('0x11')]=qs['offset'](_0x47653d[_0x7721('0x2d')]['offset']);}_0x1cfee2['order']=qs[_0x7721('0x51')](_0x47653d[_0x7721('0x2d')][_0x7721('0x51')]);_0x1cfee2[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x47653d[_0x7721('0x2d')],_0x425327[_0x7721('0x35')]));_0x1cfee2[_0x7721('0x2b')][_0x7721('0x53')]=_0x461938['id'];if(_0x47653d[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1cfee2[_0x7721('0x2b')]=_['merge'](_0x1cfee2[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x1cfee2[_0x7721('0x36')],function(_0x193326){var _0x1dbf47={};_0x1dbf47[_0x193326]={'$like':'%'+_0x47653d['query'][_0x7721('0x1c')]+'%'};return _0x1dbf47;})});}_0x1cfee2=_[_0x7721('0x47')]({},_0x1cfee2,_0x47653d[_0x7721('0x3a')]);return db['CmHopperBlack'][_0x7721('0x13')]({'where':_0x1cfee2[_0x7721('0x2b')]})['then'](function(_0x29403d){_0x42ee11[_0x7721('0x13')]=_0x29403d;if(_0x47653d[_0x7721('0x2d')][_0x7721('0x42')]){_0x1cfee2['include']=[{'all':!![]}];}return db[_0x7721('0x57')]['findAll'](_0x1cfee2);})[_0x7721('0x16')](function(_0x1c50c2){_0x42ee11['rows']=_0x1c50c2;return _0x42ee11;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x12869b,_0x1cfee2))[_0x7721('0x30')](handleError(_0x12869b,null));};exports['getTeams']=function(_0x29968c,_0x11733f){var _0x5e3816={};var _0x7fd3e8={};var _0x52e8b1;var _0x240b0a;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x29968c['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x11733f,null))['then'](function(_0x5a00be){if(_0x5a00be){_0x52e8b1=_0x5a00be;_0x7fd3e8[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x58')][_0x7721('0x34')]);_0x7fd3e8[_0x7721('0x2d')]=_['keys'](_0x29968c[_0x7721('0x2d')]);_0x7fd3e8[_0x7721('0x35')]=_[_0x7721('0x37')](_0x7fd3e8[_0x7721('0x32')],_0x7fd3e8[_0x7721('0x2d')]);_0x5e3816['attributes']=_[_0x7721('0x37')](_0x7fd3e8['model'],qs[_0x7721('0x38')](_0x29968c['query']['fields']));_0x5e3816[_0x7721('0x36')]=_0x5e3816['attributes']['length']?_0x5e3816[_0x7721('0x36')]:_0x7fd3e8[_0x7721('0x32')];_0x5e3816[_0x7721('0x50')]=qs['sort'](_0x29968c[_0x7721('0x2d')]['sort']);_0x5e3816['where']=qs['filters'](_[_0x7721('0x52')](_0x29968c[_0x7721('0x2d')],_0x7fd3e8[_0x7721('0x35')]));if(_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]){_0x5e3816[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x5e3816[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x5e3816[_0x7721('0x36')],function(_0x25bf32){var _0x4ec3c6={};_0x4ec3c6[_0x25bf32]={'$like':'%'+_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x4ec3c6;})});}_0x5e3816=_[_0x7721('0x47')]({},_0x5e3816,_0x29968c[_0x7721('0x3a')]);return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0xc7e4e9){if(_0xc7e4e9){_0x240b0a=_0xc7e4e9['length'];if(!_0x29968c['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x5e3816[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x29968c['query'][_0x7721('0x4f')]);_0x5e3816['offset']=qs[_0x7721('0x11')](_0x29968c['query'][_0x7721('0x11')]);}return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0x249a5b){if(_0x249a5b){return _0x249a5b?{'count':_0x240b0a,'rows':_0x249a5b}:null;}})[_0x7721('0x16')](respondWithResult(_0x11733f,null))[_0x7721('0x30')](handleError(_0x11733f,null));};exports['addTeams']=function(_0x509f2d,_0x4d2644){var _0x2b0968=_0x509f2d['body'][_0x7721('0x5a')];var _0x186ada=_['map'](_0x2b0968,'id');return db[_0x7721('0x58')][_0x7721('0x2e')]({'where':{'id':_0x186ada},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':'Agents','attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),'voicePause','interface'],'raw':!![]}]})[_0x7721('0x16')](function(_0xc85b9){if(_0xc85b9){var _0x58be49=_[_0x7721('0x5d')](_0xc85b9,function(_0x283716){var _0x4cd26e=_0x283716['get']({'plain':!![]});_0x4cd26e['Agents']['forEach'](function(_0x19be6b){_0x19be6b[_0x7721('0x5e')]=_[_0x7721('0x21')](_0x2b0968,{'id':_0x4cd26e['id']})['penalty'];});return _0x4cd26e['Agents'];});return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x509f2d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x14711c){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0x435455){return _0x14711c[_0x7721('0x61')](_0x186ada,{'transaction':_0x435455})['then'](function(){return BPromise['each'](_0x2b0968,function(_0x415445){return db['TeamVoiceQueue'][_0x7721('0x62')]({'TeamId':_0x415445['id'],'VoiceQueueId':_0x509f2d['params']['id'],'penalty':_0x415445[_0x7721('0x5e')]},{'transaction':_0x435455});});})['then'](function(){return BPromise[_0x7721('0x63')](_0x58be49,function(_0x14341e){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x14341e['id'],'VoiceQueueId':_0x509f2d[_0x7721('0x31')]['id']},'defaults':{'penalty':_0x14341e[_0x7721('0x5e')]},'transaction':_0x435455});});})[_0x7721('0x16')](function(){return BPromise[_0x7721('0x63')](_[_0x7721('0x1c')](_0x58be49,{'online':!![]}),function(_0x5e69d7){return db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x5e69d7[_0x7721('0x22')],'UserId':_0x5e69d7['id'],'queue_name':_0x14711c['name'],'VoiceQueueId':_0x14711c['id'],'interface':_[_0x7721('0x65')](_0x5e69d7[_0x7721('0x66')])?util[_0x7721('0x67')](_0x7721('0x68'),_0x5e69d7[_0x7721('0x22')]):_0x5e69d7[_0x7721('0x66')],'paused':_0x5e69d7[_0x7721('0x69')]||![],'penalty':_0x5e69d7[_0x7721('0x5e')]},{'transaction':_0x435455});});})[_0x7721('0x16')](function(){_0x58be49[_0x7721('0x6a')](function(_0x2a2d8a){socket['emit'](_0x7721('0x6b'),{'UserId':_0x2a2d8a['id'],'VoiceQueueId':_0x14711c['id']});});});});});}})[_0x7721('0x16')](respondWithStatusCode(_0x4d2644,null))[_0x7721('0x30')](handleError(_0x4d2644,null));};exports[_0x7721('0x6c')]=function(_0xcb843e,_0x35d3f1){return db[_0x7721('0x58')]['findAll']({'where':{'id':_0xcb843e[_0x7721('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':_0x7721('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x7721('0x16')](handleEntityNotFound(_0x35d3f1,null))[_0x7721('0x16')](function(_0x37b607){var _0x3d6d41=_['map'](_0x37b607,'id');var _0xbce1b=[];var _0x4d3ad1=[];var _0x4028fa=squel[_0x7721('0x6e')]();_0x4028fa[_0x7721('0x6f')]('tq.TeamId')[_0x7721('0x70')](_0x7721('0x71'),'tq')[_0x7721('0x72')](_0x7721('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7721('0x2b')](_0x7721('0x74'),_0xcb843e[_0x7721('0x31')]['id']);for(var _0x980f26=0x0;_0x980f26<_0x37b607['length'];_0x980f26+=0x1){let _0x40dd5e=_0x37b607[_0x980f26];for(var _0x3d143a=0x0;_0x3d143a<_0x40dd5e[_0x7721('0x6d')][_0x7721('0x39')];_0x3d143a+=0x1){let _0x53fa66=_0x40dd5e[_0x7721('0x6d')][_0x3d143a];var _0x1a95e6=_0x4028fa[_0x7721('0x75')]();_0x1a95e6[_0x7721('0x2b')](_0x7721('0x76'),_0x53fa66['id']);_0x4d3ad1[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x1a95e6[_0x7721('0x78')](),{'type':db['sequelize'][_0x7721('0x79')][_0x7721('0x7a')]})[_0x7721('0x16')](function(_0x1c246b){if(_0x1c246b[_0x7721('0x39')]===0x1){return _0x53fa66['id'];}else{var _0x31447d=_[_0x7721('0x7b')](_[_0x7721('0x1e')](_0x1c246b,_0x7721('0x7c')),function(_0x14fd97){return _[_0x7721('0x7d')](_0x3d6d41,_0x14fd97);});if(_0x31447d){return _0x53fa66['id'];}}}));}}return BPromise[_0x7721('0x7e')](_0x4d3ad1)[_0x7721('0x16')](function(_0x18ccdf){_0xbce1b=_(_0xbce1b)[_0x7721('0x7f')](_0x18ccdf)[_0x7721('0x80')]()['value']();return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xcb843e[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x157310){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0xdd0e7a){return _0x157310[_0x7721('0x6c')](_0xcb843e[_0x7721('0x2d')][_0x7721('0x81')],{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){if(!_['isEmpty'](_0xbce1b)){return _0x157310['removeAgents'](_0xbce1b,{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0xcb843e[_0x7721('0x31')]['id'],'UserId':_0xbce1b},'transaction':_0xdd0e7a});});}})[_0x7721('0x16')](function(){_0xbce1b['forEach'](function(_0x1ebc86){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':_0x1ebc86,'VoiceQueueId':_0x157310['id']});});});});});});})[_0x7721('0x16')](respondWithStatusCode(_0x35d3f1,null))[_0x7721('0x30')](handleError(_0x35d3f1,null));};exports[_0x7721('0x84')]=function(_0xc0f448,_0x3dc688){var _0x298aca,_0x45b430;return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xc0f448['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3dc688,null))[_0x7721('0x16')](function(_0x16e0cd){if(_0x16e0cd){_0x45b430=_0x16e0cd;return _0x16e0cd['addAgents'](_0xc0f448[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xc0f448['body'],[_0x7721('0x81'),'id'])||{})['spread'](function(_0x5f3dd2){for(var _0xa73193=0x0;_0xa73193<_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0x7721('0x39')];_0xa73193+=0x1){socket['emit'](_0x7721('0x6b'),{'UserId':Number(_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0xa73193]),'VoiceQueueId':Number(_0xc0f448[_0x7721('0x31')]['id'])});}return _0x5f3dd2;});}})[_0x7721('0x16')](function(_0x5b12c7){_0x298aca=_0x5b12c7||[];if(_0x45b430){return db[_0x7721('0x5b')][_0x7721('0x2e')]({'where':{'id':_0xc0f448[_0x7721('0x46')][_0x7721('0x81')]},'attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),_0x7721('0x69'),_0x7721('0x66')],'raw':!![]});}})[_0x7721('0x16')](function(_0x385c86){if(!_[_0x7721('0x85')](_0x385c86)){var _0xc18d1a=[];for(var _0x9575b3=0x0;_0x9575b3<_0x385c86[_0x7721('0x39')];_0x9575b3++){if(_0x385c86[_0x9575b3][_0x7721('0x5c')]){_0xc18d1a[_0x7721('0x77')](db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x385c86[_0x9575b3][_0x7721('0x22')],'UserId':_0x385c86[_0x9575b3]['id'],'queue_name':_0x45b430[_0x7721('0x22')],'VoiceQueueId':_0x45b430['id'],'interface':_[_0x7721('0x65')](_0x385c86[_0x9575b3][_0x7721('0x66')])?util['format'](_0x7721('0x68'),_0x385c86[_0x9575b3]['name']):_0x385c86[_0x9575b3][_0x7721('0x66')],'paused':_0x385c86[_0x9575b3][_0x7721('0x69')]||![],'penalty':_0xc0f448[_0x7721('0x46')][_0x7721('0x5e')]||0x0}));}}return BPromise['all'](_0xc18d1a);}})[_0x7721('0x16')](function(){return _0x298aca;})[_0x7721('0x16')](respondWithResult(_0x3dc688,null))['catch'](handleError(_0x3dc688,null));};exports[_0x7721('0x86')]=function(_0x3a8f89,_0x52aae1){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x3a8f89[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x52aae1,null))[_0x7721('0x16')](function(_0x55c43c){if(_0x55c43c){return _0x55c43c['removeAgents'](_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')])['then'](function(){if(_['isArray'](_0x3a8f89[_0x7721('0x2d')]['ids'])){for(var _0x1c23e3=0x0;_0x1c23e3<_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]['length'];_0x1c23e3+=0x1){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')][_0x1c23e3]),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}}else{socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')]['ids']),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}});}})[_0x7721('0x16')](function(_0x3c3c7e){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0x3a8f89['params']['id'],'UserId':_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]}})[_0x7721('0x16')](function(){return _0x3c3c7e;});})[_0x7721('0x16')](respondWithStatusCode(_0x52aae1,null))[_0x7721('0x30')](handleError(_0x52aae1,null));};exports[_0x7721('0x87')]=function(_0x16b110,_0x366323){var _0x14b49e={};var _0x12f568={};var _0x259640;var _0x4a0e50;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16b110[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x366323,null))[_0x7721('0x16')](function(_0x25e4db){if(_0x25e4db){_0x259640=_0x25e4db;_0x12f568[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x5b')][_0x7721('0x34')]);_0x12f568[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x16b110[_0x7721('0x2d')]);_0x12f568[_0x7721('0x35')]=_[_0x7721('0x37')](_0x12f568['model'],_0x12f568[_0x7721('0x2d')]);_0x14b49e['attributes']=_['intersection'](_0x12f568[_0x7721('0x32')],qs['fields'](_0x16b110[_0x7721('0x2d')][_0x7721('0x38')]));_0x14b49e[_0x7721('0x36')]=_0x14b49e[_0x7721('0x36')]['length']?_0x14b49e['attributes']:_0x12f568[_0x7721('0x32')];_0x14b49e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16b110[_0x7721('0x2d')][_0x7721('0x51')]);_0x14b49e[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x16b110[_0x7721('0x2d')],_0x12f568['filters']));if(_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]){_0x14b49e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x14b49e[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x14b49e[_0x7721('0x36')],function(_0x184f1b){var _0xa257a0={};_0xa257a0[_0x184f1b]={'$like':'%'+_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0xa257a0;})});}_0x14b49e=_[_0x7721('0x47')]({},_0x14b49e,_0x16b110[_0x7721('0x3a')]);return _0x259640[_0x7721('0x87')](_0x14b49e);}})[_0x7721('0x16')](function(_0x1ee0c1){if(_0x1ee0c1){_0x4a0e50=_0x1ee0c1[_0x7721('0x39')];if(!_0x16b110[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x14b49e[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16b110[_0x7721('0x2d')][_0x7721('0x4f')]);_0x14b49e[_0x7721('0x11')]=qs['offset'](_0x16b110[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x259640[_0x7721('0x87')](_0x14b49e);}})['then'](function(_0x1bdadb){if(_0x1bdadb){return _0x1bdadb?{'count':_0x4a0e50,'rows':_0x1bdadb}:null;}})['then'](respondWithResult(_0x366323,null))[_0x7721('0x30')](handleError(_0x366323,null));};exports['getMembers']=function(_0xe5e55f,_0x17ce3b){var _0xbc0a80={};var _0xf2dc08={};var _0x5b493a;var _0x45024c;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0xe5e55f[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x17ce3b,null))['then'](function(_0x12b255){if(_0x12b255){_0x5b493a=_0x12b255;_0xf2dc08['model']=_[_0x7721('0x33')](db[_0x7721('0x64')][_0x7721('0x34')]);_0xf2dc08[_0x7721('0x2d')]=_[_0x7721('0x33')](_0xe5e55f[_0x7721('0x2d')]);_0xf2dc08[_0x7721('0x35')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],_0xf2dc08['query']);_0xbc0a80[_0x7721('0x36')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],qs['fields'](_0xe5e55f['query'][_0x7721('0x38')]));_0xbc0a80[_0x7721('0x36')]=_0xbc0a80[_0x7721('0x36')][_0x7721('0x39')]?_0xbc0a80[_0x7721('0x36')]:_0xf2dc08[_0x7721('0x32')];_0xbc0a80['order']=qs[_0x7721('0x51')](_0xe5e55f[_0x7721('0x2d')]['sort']);_0xbc0a80[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0xe5e55f['query'],_0xf2dc08[_0x7721('0x35')]));if(_0xe5e55f['query']['filter']){_0xbc0a80['where']=_[_0x7721('0x47')](_0xbc0a80['where'],{'$or':_['map'](_0xbc0a80['attributes'],function(_0x52a1ee){var _0x41c991={};_0x41c991[_0x52a1ee]={'$like':'%'+_0xe5e55f[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x41c991;})});}_0xbc0a80=_[_0x7721('0x47')]({},_0xbc0a80,_0xe5e55f[_0x7721('0x3a')]);return _0x5b493a['getMembers'](_0xbc0a80);}})[_0x7721('0x16')](function(_0x22d4e0){if(_0x22d4e0){_0x45024c=_0x22d4e0['length'];if(!_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0xbc0a80[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4f')]);_0xbc0a80[_0x7721('0x11')]=qs['offset'](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x5b493a[_0x7721('0x88')](_0xbc0a80);}})[_0x7721('0x16')](function(_0x2fbb00){return _0x2fbb00?{'count':_0x45024c,'rows':_0x2fbb00}:null;})[_0x7721('0x16')](respondWithResult(_0x17ce3b,null))[_0x7721('0x30')](handleError(_0x17ce3b,null));};exports[_0x7721('0x89')]=function(_0x561235,_0x12ad4d){var _0x226081={};var _0x17c3e7={};var _0x250cbf;var _0x255b22;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x561235[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12ad4d,null))[_0x7721('0x16')](function(_0x396880){if(_0x396880){_0x250cbf=_0x396880;_0x17c3e7['model']=_[_0x7721('0x33')](db[_0x7721('0x8a')]['rawAttributes']);_0x17c3e7[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x561235[_0x7721('0x2d')]);_0x17c3e7[_0x7721('0x35')]=_[_0x7721('0x37')](_0x17c3e7['model'],_0x17c3e7[_0x7721('0x2d')]);_0x226081[_0x7721('0x36')]=_['intersection'](_0x17c3e7['model'],qs[_0x7721('0x38')](_0x561235[_0x7721('0x2d')][_0x7721('0x38')]));_0x226081['attributes']=_0x226081[_0x7721('0x36')]['length']?_0x226081['attributes']:_0x17c3e7[_0x7721('0x32')];_0x226081[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x561235[_0x7721('0x2d')][_0x7721('0x51')]);_0x226081['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x561235[_0x7721('0x2d')],_0x17c3e7[_0x7721('0x35')]));if(_0x561235[_0x7721('0x2d')]['filter']){_0x226081[_0x7721('0x2b')]=_['merge'](_0x226081[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x226081[_0x7721('0x36')],function(_0x5209ff){var _0x2583c1={};_0x2583c1[_0x5209ff]={'$like':'%'+_0x561235['query'][_0x7721('0x1c')]+'%'};return _0x2583c1;})});}_0x226081=_[_0x7721('0x47')]({},_0x226081,_0x561235[_0x7721('0x3a')]);return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x3235d8){if(_0x3235d8){_0x255b22=_0x3235d8[_0x7721('0x39')];if(!_0x561235[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x226081['limit']=qs[_0x7721('0x4f')](_0x561235[_0x7721('0x2d')][_0x7721('0x4f')]);_0x226081[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x561235['query'][_0x7721('0x11')]);}return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x501e31){if(_0x501e31){return _0x501e31?{'count':_0x255b22,'rows':_0x501e31}:null;}})[_0x7721('0x16')](respondWithResult(_0x12ad4d,null))[_0x7721('0x30')](handleError(_0x12ad4d,null));};exports[_0x7721('0x8b')]=function(_0xe325e1,_0x1aa1fc){var _0x560be6=moment()[_0x7721('0x67')](_0x7721('0x8c'));var _0x1bd066,_0xaa15c5;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xe325e1[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x1aa1fc,null))[_0x7721('0x16')](function(_0x42ffff){if(_0x42ffff){_0xaa15c5=_0x42ffff;return _0x42ffff[_0x7721('0x8b')](_0xe325e1[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xe325e1[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x3f19f5){var _0x28f11a;_0x1bd066=_0x3f19f5||[];var _0x3bc8f3=[];if(_0x3f19f5){for(var _0x26cea3=0x0;_0x26cea3<_0x3f19f5[_0x7721('0x39')];_0x26cea3+=0x1){var _0x57e928=_0x3f19f5[_0x26cea3]['get']({'plain':!![]});_0xaa15c5[_0x7721('0x8e')]=_0xe325e1[_0x7721('0x46')][_0x7721('0x8e')]?_0xe325e1[_0x7721('0x46')]['dialCheckDuplicateType']:_0xaa15c5[_0x7721('0x8e')];switch(_0xaa15c5['dialCheckDuplicateType']){case _0x7721('0x8f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')['fromQuery'](['phone',_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),'updatedAt'],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),'ListId')[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','updatedAt')['from'](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928['CmListId'][_0x7721('0x78')]())[_0x7721('0x2b')](_0x7721('0x9a'))[_0x7721('0x2b')](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9c'))[_0x7721('0x70')](_0x7721('0x9d'))['where'](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id']['toString']()))[_0x7721('0x2b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7721('0x6e')]()['field'](_0x7721('0x9e'))['from']('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0xe325e1[_0x7721('0x31')]['id']['toString']())))[_0x7721('0x78')]();break;case _0x7721('0x9f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')](_0x7721('0xa0'))[_0x7721('0xa1')](['phone',_0x7721('0x92'),_0x7721('0x93'),'ListId','VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field']('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))['from'](_0x7721('0x97'))['where']('deletedAt\x20IS\x20NULL')[_0x7721('0x2b')]('ListId\x20=\x20?',_0x57e928[_0x7721('0x96')]['toString']())[_0x7721('0x2b')](_0x7721('0x9a'))['where'](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9e'))[_0x7721('0x70')]('cm_hopper')[_0x7721('0x2b')](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')]())))[_0x7721('0x78')]();break;default:_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')[_0x7721('0xa1')]([_0x7721('0x95'),_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),'VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id',_0x7721('0x93'))['field'](_0x57e928['CmListId'][_0x7721('0x78')](),'ListId')['field'](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x44'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928[_0x7721('0x96')][_0x7721('0x78')]())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();}_0x3bc8f3[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x28f11a));}return BPromise[_0x7721('0x7e')](_0x3bc8f3);}})[_0x7721('0x16')](function(){var _0x5f53b3=[];var _0x8fc283=squel[_0x7721('0x90')]()['into'](_0x7721('0xa2'))['fromQuery']([_0x7721('0xa3'),_0x7721('0x95'),_0x7721('0xa4'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0xa5'))[_0x7721('0x6f')](_0x7721('0xa6'))[_0x7721('0x6f')](_0x7721('0xa7'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0xa8'),'ci')[_0x7721('0x72')](_0x7721('0xa0'),'h',_0x7721('0xa9'))['where'](_0x7721('0xaa'),_0x560be6)[_0x7721('0x2b')](_0x7721('0xab'),'PHONE'))[_0x7721('0x78')]();_0x5f53b3['push'](db['sequelize'][_0x7721('0x2d')](_0x8fc283));return BPromise[_0x7721('0x7e')](_0x5f53b3);})['then'](function(){return _0x1bd066;})[_0x7721('0x16')](respondWithResult(_0x1aa1fc,null))[_0x7721('0x30')](handleError(_0x1aa1fc,null));};exports[_0x7721('0xac')]=function(_0xbc4f13,_0x50f4bd){return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xbc4f13['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x50f4bd,null))[_0x7721('0x16')](function(_0x537831){if(_0x537831){return _0x537831[_0x7721('0xac')](_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')]);}})[_0x7721('0x16')](function(_0x49548e){if(_0x49548e){return db['CmHopper'][_0x7721('0x17')]({'where':{'ListId':_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0xbc4f13[_0x7721('0x31')]['id']}})['then'](function(){return _0x49548e;});}})['then'](respondWithStatusCode(_0x50f4bd,null))[_0x7721('0x30')](handleError(_0x50f4bd,null));};exports[_0x7721('0xad')]=function(_0x4ea8ac,_0x226556){var _0x4bd023={};var _0x50de45={};var _0x51ac8f;var _0x27ed5e;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x4ea8ac[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x226556,null))['then'](function(_0x4893c0){if(_0x4893c0){_0x51ac8f=_0x4893c0;_0x50de45[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x8a')][_0x7721('0x34')]);_0x50de45[_0x7721('0x2d')]=_['keys'](_0x4ea8ac[_0x7721('0x2d')]);_0x50de45[_0x7721('0x35')]=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],_0x50de45[_0x7721('0x2d')]);_0x4bd023['attributes']=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],qs[_0x7721('0x38')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x38')]));_0x4bd023[_0x7721('0x36')]=_0x4bd023['attributes']['length']?_0x4bd023[_0x7721('0x36')]:_0x50de45[_0x7721('0x32')];_0x4bd023[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x51')]);_0x4bd023[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x4ea8ac[_0x7721('0x2d')],_0x50de45[_0x7721('0x35')]));if(_0x4ea8ac['query'][_0x7721('0x1c')]){_0x4bd023[_0x7721('0x2b')]=_['merge'](_0x4bd023[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x4bd023[_0x7721('0x36')],function(_0x400273){var _0x42c438={};_0x42c438[_0x400273]={'$like':'%'+_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x42c438;})});}_0x4bd023=_[_0x7721('0x47')]({},_0x4bd023,_0x4ea8ac[_0x7721('0x3a')]);return _0x51ac8f[_0x7721('0xad')](_0x4bd023);}})[_0x7721('0x16')](function(_0x1192a8){if(_0x1192a8){_0x27ed5e=_0x1192a8[_0x7721('0x39')];if(!_0x4ea8ac['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x4bd023['limit']=qs[_0x7721('0x4f')](_0x4ea8ac['query'][_0x7721('0x4f')]);_0x4bd023[_0x7721('0x11')]=qs['offset'](_0x4ea8ac['query'][_0x7721('0x11')]);}return _0x51ac8f['getBlackLists'](_0x4bd023);}})[_0x7721('0x16')](function(_0x2f7067){if(_0x2f7067){return _0x2f7067?{'count':_0x27ed5e,'rows':_0x2f7067}:null;}})[_0x7721('0x16')](respondWithResult(_0x226556,null))[_0x7721('0x30')](handleError(_0x226556,null));};exports[_0x7721('0xae')]=function(_0x376f37,_0x5b157e){var _0x4b84b9;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x376f37[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x5b157e,null))[_0x7721('0x16')](function(_0x39d43b){if(_0x39d43b){return _0x39d43b['addBlackLists'](_0x376f37['body'][_0x7721('0x81')],_[_0x7721('0x43')](_0x376f37[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x430304){var _0x469b6b;_0x4b84b9=_0x430304||[];var _0x6766c6=[];if(_0x430304){for(var _0x37877c=0x0;_0x37877c<_0x430304['length'];_0x37877c+=0x1){var _0x259eaa=_0x430304[_0x37877c][_0x7721('0x18')]({'plain':!![]});_0x469b6b=squel['insert']()['into'](_0x7721('0xaf'))[_0x7721('0xa1')]([_0x7721('0x95'),'ContactId',_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x259eaa['CmListId'][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0x376f37[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field'](_0x7721('0xb0'),_0x7721('0x44'))[_0x7721('0x6f')](_0x7721('0xb0'),'updatedAt')[_0x7721('0x70')](_0x7721('0x97'))['where'](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x259eaa['CmListId']['toString']())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();_0x6766c6[_0x7721('0x77')](db['sequelize'][_0x7721('0x2d')](_0x469b6b));}return BPromise[_0x7721('0x7e')](_0x6766c6);}})['then'](function(){return _0x4b84b9;})[_0x7721('0x16')](respondWithResult(_0x5b157e,null))[_0x7721('0x30')](handleError(_0x5b157e,null));};exports[_0x7721('0xb1')]=function(_0x37da70,_0x54616a){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x37da70[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x54616a,null))[_0x7721('0x16')](function(_0x174e79){if(_0x174e79){return _0x174e79['removeBlackLists'](_0x37da70[_0x7721('0x2d')]['ids']);}})[_0x7721('0x16')](function(_0x4c1b63){if(_0x4c1b63){return db[_0x7721('0x57')][_0x7721('0x17')]({'where':{'ListId':_0x37da70[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0x37da70[_0x7721('0x31')]['id']}})['then'](function(){return _0x4c1b63;});}})[_0x7721('0x16')](respondWithStatusCode(_0x54616a,null))[_0x7721('0x30')](handleError(_0x54616a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index b1d7b43..7bc606a 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 _0xdd1d=['setMaxListeners','update','remove','emit','hook','exports','events','VoiceQueue'];(function(_0x1d1855,_0x4a4d2f){var _0x495672=function(_0x122a21){while(--_0x122a21){_0x1d1855['push'](_0x1d1855['shift']());}};_0x495672(++_0x4a4d2f);}(_0xdd1d,0x66));var _0xddd1=function(_0x2f8a7c,_0x3f65fd){_0x2f8a7c=_0x2f8a7c-0x0;var _0x257e01=_0xdd1d[_0x2f8a7c];return _0x257e01;};'use strict';var EventEmitter=require(_0xddd1('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xddd1('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xddd1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xddd1('0x3'),'afterDestroy':_0xddd1('0x4')};function emitEvent(_0x5dd485){return function(_0x170550,_0x583359,_0x371146){VoiceQueueEvents[_0xddd1('0x5')](_0x5dd485+':'+_0x170550['id'],_0x170550);VoiceQueueEvents[_0xddd1('0x5')](_0x5dd485,_0x170550);_0x371146(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xddd1('0x6')](e,emitEvent(event));}}module[_0xddd1('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x1d94=['update','remove','emit','hasOwnProperty','exports','save'];(function(_0x4ffb7e,_0x2735e3){var _0x2d5bab=function(_0x773310){while(--_0x773310){_0x4ffb7e['push'](_0x4ffb7e['shift']());}};_0x2d5bab(++_0x2735e3);}(_0x1d94,0x1df));var _0x41d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d94[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x41d9('0x0'),'afterUpdate':_0x41d9('0x1'),'afterDestroy':_0x41d9('0x2')};function emitEvent(_0x4d740c){return function(_0x491671,_0x5a11f4,_0x2c8a9e){VoiceQueueEvents[_0x41d9('0x3')](_0x4d740c+':'+_0x491671['id'],_0x491671);VoiceQueueEvents[_0x41d9('0x3')](_0x4d740c,_0x491671);_0x2c8a9e(null);};}for(var e in events){if(events[_0x41d9('0x4')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x41d9('0x5')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 952b92f..c123007 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x31d98a,_0x292465){var _0x56e10e=function(_0x54a82f){while(--_0x54a82f){_0x31d98a['push'](_0x31d98a['shift']());}};_0x56e10e(++_0x292465);}(_0x008c,0x188));var _0xc008=function(_0x42540c,_0x27ca3b){_0x42540c=_0x42540c-0x0;var _0x1a27dc=_0x008c[_0x42540c];return _0x1a27dc;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x5a2a22,_0x1f3dc8){var _0xf9f942=function(_0xa0aad2){while(--_0xa0aad2){_0x5a2a22['push'](_0x5a2a22['shift']());}};_0xf9f942(++_0x1f3dc8);}(_0x3e74,0x175));var _0x43e7=function(_0x1da956,_0x3b59dc){_0x1da956=_0x1da956-0x0;var _0x4a8f35=_0x3e74[_0x1da956];return _0x4a8f35;};'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/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 08fe0e3..a749ea5 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 _0x7c30=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetVoiceQueue','options','where','attributes','limit','include','model','map','stringify','ShowVoiceQueue','find'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x7c30,0x17d));var _0x07c3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7c30[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x07c3('0x0'));var util=require(_0x07c3('0x1'));var moment=require(_0x07c3('0x2'));var BPromise=require(_0x07c3('0x3'));var rs=require(_0x07c3('0x4'));var fs=require('fs');var Redis=require(_0x07c3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x07c3('0x6'));var logger=require(_0x07c3('0x7'))(_0x07c3('0x8'));var config=require('../../config/environment');var jayson=require(_0x07c3('0x9'));var client=jayson[_0x07c3('0xa')][_0x07c3('0xb')]({'port':0x232a});config[_0x07c3('0xc')]=_['defaults'](config[_0x07c3('0xc')],{'host':_0x07c3('0xd'),'port':0x18eb});var socket=require(_0x07c3('0xe'))(new Redis(config[_0x07c3('0xc')]));require(_0x07c3('0xf'))['register'](socket);function respondWithRpcPromise(_0x4fbe6c,_0x59fe79,_0xd6012b){return new BPromise(function(_0x4360f4,_0x2cd8ba){return client['request'](_0x4fbe6c,_0xd6012b)[_0x07c3('0x10')](function(_0x43d106){logger['info'](_0x07c3('0x11'),_0x59fe79,_0x07c3('0x12'));logger[_0x07c3('0x13')](_0x07c3('0x14'),_0x59fe79,_0x07c3('0x12'),JSON['stringify'](_0x43d106));if(_0x43d106['error']){if(_0x43d106[_0x07c3('0x15')][_0x07c3('0x16')]===0x1f4){logger[_0x07c3('0x15')](_0x07c3('0x11'),_0x59fe79,_0x43d106['error']['message']);return _0x2cd8ba(_0x43d106[_0x07c3('0x15')]['message']);}logger[_0x07c3('0x15')](_0x07c3('0x11'),_0x59fe79,_0x43d106['error']['message']);return _0x4360f4(_0x43d106['error'][_0x07c3('0x17')]);}else{logger[_0x07c3('0x18')](_0x07c3('0x11'),_0x59fe79,_0x07c3('0x12'));_0x4360f4(_0x43d106[_0x07c3('0x19')][_0x07c3('0x17')]);}})['catch'](function(_0x5e801f){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x59fe79,_0x5e801f);_0x2cd8ba(_0x5e801f);});});}exports[_0x07c3('0x1a')]=function(_0x5979cb){var _0x4eeff5=this;return new Promise(function(_0x4782fe,_0xc6ee8d){return db['VoiceQueue']['findAll']({'raw':_0x5979cb[_0x07c3('0x1b')]?_0x5979cb[_0x07c3('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5979cb[_0x07c3('0x1b')]?_0x5979cb[_0x07c3('0x1b')][_0x07c3('0x1c')]||null:null,'attributes':_0x5979cb[_0x07c3('0x1b')]?_0x5979cb[_0x07c3('0x1b')][_0x07c3('0x1d')]||null:null,'limit':_0x5979cb['options']?_0x5979cb[_0x07c3('0x1b')][_0x07c3('0x1e')]||null:null,'include':_0x5979cb['options']?_0x5979cb['options'][_0x07c3('0x1f')]?_['map'](_0x5979cb[_0x07c3('0x1b')][_0x07c3('0x1f')],function(_0x4b2ac4){return{'model':db[_0x4b2ac4[_0x07c3('0x20')]],'as':_0x4b2ac4['as'],'attributes':_0x4b2ac4[_0x07c3('0x1d')],'include':_0x4b2ac4[_0x07c3('0x1f')]?_[_0x07c3('0x21')](_0x4b2ac4[_0x07c3('0x1f')],function(_0x2d9092){return{'model':db[_0x2d9092[_0x07c3('0x20')]],'as':_0x2d9092['as'],'attributes':_0x2d9092['attributes'],'include':_0x2d9092[_0x07c3('0x1f')]?_[_0x07c3('0x21')](_0x2d9092[_0x07c3('0x1f')],function(_0x878e68){return{'model':db[_0x878e68['model']],'as':_0x878e68['as'],'attributes':_0x878e68[_0x07c3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x07c3('0x10')](function(_0x36c687){logger[_0x07c3('0x18')]('GetVoiceQueue',_0x5979cb);logger[_0x07c3('0x13')]('GetVoiceQueue',_0x5979cb,JSON[_0x07c3('0x22')](_0x36c687));_0x4782fe(_0x36c687);})['catch'](function(_0x101463){logger[_0x07c3('0x15')]('GetVoiceQueue',_0x101463[_0x07c3('0x17')],_0x5979cb);_0xc6ee8d(_0x4eeff5[_0x07c3('0x15')](0x1f4,_0x101463['message']));});});};exports[_0x07c3('0x23')]=function(_0x580a37){var _0x1c8c4b=this;return new Promise(function(_0x4cf33b,_0x546c77){return db['VoiceQueue'][_0x07c3('0x24')]({'raw':_0x580a37['options']?_0x580a37[_0x07c3('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x580a37[_0x07c3('0x1b')]?_0x580a37[_0x07c3('0x1b')]['where']||null:null,'attributes':_0x580a37[_0x07c3('0x1b')]?_0x580a37[_0x07c3('0x1b')][_0x07c3('0x1d')]||null:null,'include':_0x580a37[_0x07c3('0x1b')]?_0x580a37[_0x07c3('0x1b')][_0x07c3('0x1f')]?_['map'](_0x580a37[_0x07c3('0x1b')][_0x07c3('0x1f')],function(_0x5285b5){return{'model':db[_0x5285b5['model']],'as':_0x5285b5['as'],'attributes':_0x5285b5[_0x07c3('0x1d')],'include':_0x5285b5[_0x07c3('0x1f')]?_[_0x07c3('0x21')](_0x5285b5[_0x07c3('0x1f')],function(_0x1d7fec){return{'model':db[_0x1d7fec[_0x07c3('0x20')]],'as':_0x1d7fec['as'],'attributes':_0x1d7fec[_0x07c3('0x1d')],'include':_0x1d7fec[_0x07c3('0x1f')]?_['map'](_0x1d7fec[_0x07c3('0x1f')],function(_0x1edadb){return{'model':db[_0x1edadb[_0x07c3('0x20')]],'as':_0x1edadb['as'],'attributes':_0x1edadb[_0x07c3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x07c3('0x10')](function(_0x91bc75){logger['info'](_0x07c3('0x23'),_0x580a37);logger[_0x07c3('0x13')](_0x07c3('0x23'),_0x580a37,JSON['stringify'](_0x91bc75));_0x4cf33b(_0x91bc75);})[_0x07c3('0x25')](function(_0x119cbd){logger[_0x07c3('0x15')](_0x07c3('0x23'),_0x119cbd[_0x07c3('0x17')],_0x580a37);_0x546c77(_0x1c8c4b[_0x07c3('0x15')](0x1f4,_0x119cbd[_0x07c3('0x17')]));});});}; \ No newline at end of file +var _0x641f=['raw','where','include','map','model','attributes','debug','find','ShowVoiceQueue','util','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','redis','defaults','localhost','./voiceQueue.socket','then','info','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','findAll','options'];(function(_0x4153b6,_0x57a24b){var _0x189f55=function(_0x528003){while(--_0x528003){_0x4153b6['push'](_0x4153b6['shift']());}};_0x189f55(++_0x57a24b);}(_0x641f,0x95));var _0xf641=function(_0x338259,_0x3015e9){_0x338259=_0x338259-0x0;var _0x4725d6=_0x641f[_0x338259];return _0x4725d6;};'use strict';var _=require('lodash');var util=require(_0xf641('0x0'));var moment=require('moment');var BPromise=require(_0xf641('0x1'));var rs=require(_0xf641('0x2'));var fs=require('fs');var Redis=require(_0xf641('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf641('0x4'));var logger=require('../../config/logger')(_0xf641('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf641('0x6')][_0xf641('0x7')]({'port':0x232a});config[_0xf641('0x8')]=_[_0xf641('0x9')](config[_0xf641('0x8')],{'host':_0xf641('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf641('0x8')]));require(_0xf641('0xb'))['register'](socket);function respondWithRpcPromise(_0x1d611f,_0x313268,_0x2a423c){return new BPromise(function(_0x51f85e,_0x33b6f1){return client['request'](_0x1d611f,_0x2a423c)[_0xf641('0xc')](function(_0x266f73){logger[_0xf641('0xd')]('VoiceQueue,\x20%s,\x20%s',_0x313268,_0xf641('0xe'));logger['debug'](_0xf641('0xf'),_0x313268,_0xf641('0xe'),JSON[_0xf641('0x10')](_0x266f73));if(_0x266f73[_0xf641('0x11')]){if(_0x266f73[_0xf641('0x11')][_0xf641('0x12')]===0x1f4){logger[_0xf641('0x11')](_0xf641('0x13'),_0x313268,_0x266f73[_0xf641('0x11')][_0xf641('0x14')]);return _0x33b6f1(_0x266f73['error'][_0xf641('0x14')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x313268,_0x266f73[_0xf641('0x11')][_0xf641('0x14')]);return _0x51f85e(_0x266f73[_0xf641('0x11')]['message']);}else{logger['info'](_0xf641('0x13'),_0x313268,_0xf641('0xe'));_0x51f85e(_0x266f73[_0xf641('0x15')][_0xf641('0x14')]);}})[_0xf641('0x16')](function(_0x3c9970){logger[_0xf641('0x11')](_0xf641('0x13'),_0x313268,_0x3c9970);_0x33b6f1(_0x3c9970);});});}exports[_0xf641('0x17')]=function(_0x33ee80){var _0x5acd71=this;return new Promise(function(_0x2a8fe3,_0x282da6){return db['VoiceQueue'][_0xf641('0x18')]({'raw':_0x33ee80['options']?_0x33ee80[_0xf641('0x19')][_0xf641('0x1a')]===undefined?!![]:![]:!![],'where':_0x33ee80[_0xf641('0x19')]?_0x33ee80[_0xf641('0x19')][_0xf641('0x1b')]||null:null,'attributes':_0x33ee80['options']?_0x33ee80[_0xf641('0x19')]['attributes']||null:null,'limit':_0x33ee80[_0xf641('0x19')]?_0x33ee80[_0xf641('0x19')]['limit']||null:null,'include':_0x33ee80[_0xf641('0x19')]?_0x33ee80[_0xf641('0x19')][_0xf641('0x1c')]?_[_0xf641('0x1d')](_0x33ee80[_0xf641('0x19')]['include'],function(_0x5e6fb3){return{'model':db[_0x5e6fb3[_0xf641('0x1e')]],'as':_0x5e6fb3['as'],'attributes':_0x5e6fb3[_0xf641('0x1f')],'include':_0x5e6fb3[_0xf641('0x1c')]?_[_0xf641('0x1d')](_0x5e6fb3[_0xf641('0x1c')],function(_0x26fddf){return{'model':db[_0x26fddf[_0xf641('0x1e')]],'as':_0x26fddf['as'],'attributes':_0x26fddf['attributes'],'include':_0x26fddf['include']?_['map'](_0x26fddf[_0xf641('0x1c')],function(_0x5b2056){return{'model':db[_0x5b2056[_0xf641('0x1e')]],'as':_0x5b2056['as'],'attributes':_0x5b2056[_0xf641('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf641('0xc')](function(_0x4b8e1a){logger[_0xf641('0xd')](_0xf641('0x17'),_0x33ee80);logger[_0xf641('0x20')](_0xf641('0x17'),_0x33ee80,JSON[_0xf641('0x10')](_0x4b8e1a));_0x2a8fe3(_0x4b8e1a);})['catch'](function(_0x31332f){logger[_0xf641('0x11')](_0xf641('0x17'),_0x31332f[_0xf641('0x14')],_0x33ee80);_0x282da6(_0x5acd71[_0xf641('0x11')](0x1f4,_0x31332f[_0xf641('0x14')]));});});};exports['ShowVoiceQueue']=function(_0x5314ef){var _0xef8911=this;return new Promise(function(_0xed22c7,_0x344335){return db['VoiceQueue'][_0xf641('0x21')]({'raw':_0x5314ef[_0xf641('0x19')]?_0x5314ef[_0xf641('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5314ef[_0xf641('0x19')]?_0x5314ef[_0xf641('0x19')][_0xf641('0x1b')]||null:null,'attributes':_0x5314ef[_0xf641('0x19')]?_0x5314ef[_0xf641('0x19')][_0xf641('0x1f')]||null:null,'include':_0x5314ef[_0xf641('0x19')]?_0x5314ef[_0xf641('0x19')][_0xf641('0x1c')]?_['map'](_0x5314ef[_0xf641('0x19')][_0xf641('0x1c')],function(_0x39b674){return{'model':db[_0x39b674[_0xf641('0x1e')]],'as':_0x39b674['as'],'attributes':_0x39b674[_0xf641('0x1f')],'include':_0x39b674[_0xf641('0x1c')]?_[_0xf641('0x1d')](_0x39b674[_0xf641('0x1c')],function(_0x25ed08){return{'model':db[_0x25ed08[_0xf641('0x1e')]],'as':_0x25ed08['as'],'attributes':_0x25ed08[_0xf641('0x1f')],'include':_0x25ed08[_0xf641('0x1c')]?_[_0xf641('0x1d')](_0x25ed08[_0xf641('0x1c')],function(_0x4520d4){return{'model':db[_0x4520d4['model']],'as':_0x4520d4['as'],'attributes':_0x4520d4[_0xf641('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf641('0xc')](function(_0x4b83d4){logger[_0xf641('0xd')](_0xf641('0x22'),_0x5314ef);logger[_0xf641('0x20')](_0xf641('0x22'),_0x5314ef,JSON[_0xf641('0x10')](_0x4b83d4));_0xed22c7(_0x4b83d4);})[_0xf641('0x16')](function(_0x567691){logger['error']('ShowVoiceQueue',_0x567691[_0xf641('0x14')],_0x5314ef);_0x344335(_0xef8911[_0xf641('0x11')](0x1f4,_0x567691[_0xf641('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index cb9bddc..37b3d16 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 _0x2309=['removeListener','register','voiceQueue:','save','update','emit'];(function(_0x5c0b80,_0x2712d1){var _0x366dd7=function(_0x444473){while(--_0x444473){_0x5c0b80['push'](_0x5c0b80['shift']());}};_0x366dd7(++_0x2712d1);}(_0x2309,0x147));var _0x9230=function(_0x238688,_0x390848){_0x238688=_0x238688-0x0;var _0x2efa6f=_0x2309[_0x238688];return _0x2efa6f;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x9230('0x0'),'remove',_0x9230('0x1')];function createListener(_0x2ca1d4,_0x21f927){return function(_0x40cc9f){_0x21f927[_0x9230('0x2')](_0x2ca1d4,_0x40cc9f);};}function removeListener(_0x5787bb,_0x289d1a){return function(){VoiceQueueEvents[_0x9230('0x3')](_0x5787bb,_0x289d1a);};}exports[_0x9230('0x4')]=function(_0x31c1b2){for(var _0x3f1a9d=0x0,_0x84ea91=events['length'];_0x3f1a9d<_0x84ea91;_0x3f1a9d++){var _0xb4a1dc=events[_0x3f1a9d];var _0x548210=createListener(_0x9230('0x5')+_0xb4a1dc,_0x31c1b2);VoiceQueueEvents['on'](_0xb4a1dc,_0x548210);}}; \ No newline at end of file +var _0x5a05=['voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener','length'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5a05,0x94));var _0x55a0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5a05[_0x321bb2];return _0x9c12ed;};'use strict';var VoiceQueueEvents=require(_0x55a0('0x0'));var events=[_0x55a0('0x1'),_0x55a0('0x2'),'update'];function createListener(_0x217372,_0x5aee00){return function(_0x41feea){_0x5aee00[_0x55a0('0x3')](_0x217372,_0x41feea);};}function removeListener(_0x46a9ea,_0x93f466){return function(){VoiceQueueEvents[_0x55a0('0x4')](_0x46a9ea,_0x93f466);};}exports['register']=function(_0x54f57f){for(var _0x50b576=0x0,_0xdc04b5=events[_0x55a0('0x5')];_0x50b576<_0xdc04b5;_0x50b576++){var _0x58cede=events[_0x50b576];var _0x13afb2=createListener(_0x55a0('0x6')+_0x58cede,_0x54f57f);VoiceQueueEvents['on'](_0x58cede,_0x13afb2);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 836854c..251cd08 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 _0x29d4=['../../config/environment','get','isAuthenticated','index','/describe','describe','/index','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x155aec,_0x353a91){var _0x56cba8=function(_0x22f191){while(--_0x22f191){_0x155aec['push'](_0x155aec['shift']());}};_0x56cba8(++_0x353a91);}(_0x29d4,0x1c7));var _0x429d=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x29d4[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x429d('0x0'));var util=require(_0x429d('0x1'));var path=require(_0x429d('0x2'));var timeout=require(_0x429d('0x3'));var express=require(_0x429d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x429d('0x5'));var interaction=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x429d('0x8')]('/',auth[_0x429d('0x9')](),controller[_0x429d('0xa')]);router[_0x429d('0x8')](_0x429d('0xb'),auth[_0x429d('0x9')](),controller[_0x429d('0xc')]);router[_0x429d('0x8')](_0x429d('0xd'),auth[_0x429d('0x9')](),controller['getVoiceQueuesReport']);router[_0x429d('0x8')](_0x429d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x429d('0xf')]('/',auth[_0x429d('0x9')](),controller[_0x429d('0x10')]);router[_0x429d('0x11')]('/:id',auth[_0x429d('0x9')](),controller[_0x429d('0x12')]);router['delete'](_0x429d('0xe'),auth['isAuthenticated'](),controller[_0x429d('0x13')]);module[_0x429d('0x14')]=router; \ No newline at end of file +var _0x4228=['/index','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index'];(function(_0x2af9f4,_0x3121c0){var _0xc69f8=function(_0x4695df){while(--_0x4695df){_0x2af9f4['push'](_0x2af9f4['shift']());}};_0xc69f8(++_0x3121c0);}(_0x4228,0xa8));var _0x8422=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4228[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x8422('0x0'));var util=require('util');var path=require(_0x8422('0x1'));var timeout=require(_0x8422('0x2'));var express=require(_0x8422('0x3'));var router=express[_0x8422('0x4')]();var fs_extra=require(_0x8422('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8422('0x6'));var config=require(_0x8422('0x7'));var controller=require(_0x8422('0x8'));router[_0x8422('0x9')]('/',auth[_0x8422('0xa')](),controller[_0x8422('0xb')]);router[_0x8422('0x9')]('/describe',auth[_0x8422('0xa')](),controller['describe']);router[_0x8422('0x9')](_0x8422('0xc'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router['get']('/:id',auth[_0x8422('0xa')](),controller['show']);router['post']('/',auth[_0x8422('0xa')](),controller[_0x8422('0xd')]);router[_0x8422('0xe')](_0x8422('0xf'),auth[_0x8422('0xa')](),controller[_0x8422('0x10')]);router[_0x8422('0x11')](_0x8422('0xf'),auth[_0x8422('0xa')](),controller[_0x8422('0x12')]);module[_0x8422('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 2fa0dd1..dec7f6f 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 _0xe517=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x1620b3,_0x2c34f4){var _0x380fb1=function(_0x2a5722){while(--_0x2a5722){_0x1620b3['push'](_0x1620b3['shift']());}};_0x380fb1(++_0x2c34f4);}(_0xe517,0xee));var _0x7e51=function(_0x7938fe,_0x38fc44){_0x7938fe=_0x7938fe-0x0;var _0x30cc3e=_0xe517[_0x7938fe];return _0x30cc3e;};'use strict';var Sequelize=require(_0x7e51('0x0'));var moment=require(_0x7e51('0x1'));module[_0x7e51('0x2')]={'type':{'type':Sequelize[_0x7e51('0x3')]},'uniqueid':{'type':Sequelize[_0x7e51('0x3')]},'calleridnum':{'type':Sequelize[_0x7e51('0x3')]},'calleridname':{'type':Sequelize[_0x7e51('0x3')]},'queue':{'type':Sequelize[_0x7e51('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x7e51('0x4')],'set':function(_0x3cfd98){var _0x55e366=moment(_0x3cfd98);var _0x195068=moment(this[_0x7e51('0x5')](_0x7e51('0x6')))[_0x7e51('0x7')](_0x7e51('0x8'));var _0x13856b=_0x55e366[_0x7e51('0x9')](_0x195068,_0x7e51('0xa'));this['setDataValue']('queuecallerleaveAt',_0x3cfd98);this['setDataValue'](_0x7e51('0xb'),_0x13856b||null);}},'position':{'type':Sequelize[_0x7e51('0xc')]},'count':{'type':Sequelize[_0x7e51('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7e51('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7e51('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x7e51('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7e51('0x4')]},'queuecallerexit':{'type':Sequelize[_0x7e51('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7e51('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x7e51('0xe')},'originalposition':{'type':Sequelize[_0x7e51('0xc')]},'channel':{'type':Sequelize[_0x7e51('0x3')]},'connectedlinenum':{'type':Sequelize[_0x7e51('0x3')]},'connectedlinename':{'type':Sequelize[_0x7e51('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7e51('0x3')]},'exten':{'type':Sequelize[_0x7e51('0x3')]},'priority':{'type':Sequelize[_0x7e51('0x3')]},'holdtime':{'type':Sequelize[_0x7e51('0xc')]},'mohtime':{'type':Sequelize[_0x7e51('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7e51('0x3')],'comment':_0x7e51('0xf')},'transferexten':{'type':Sequelize[_0x7e51('0x3')]},'transferuniqueid':{'type':Sequelize[_0x7e51('0x3')]},'disposition':{'type':Sequelize[_0x7e51('0x3')]},'secondDisposition':{'type':Sequelize[_0x7e51('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7e51('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x7e51('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x7e51('0x3')]}}; \ No newline at end of file +var _0x09c5=['diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x09c5,0xa8));var _0x509c=function(_0x490a99,_0x385d34){_0x490a99=_0x490a99-0x0;var _0x5b6a4e=_0x09c5[_0x490a99];return _0x5b6a4e;};'use strict';var Sequelize=require(_0x509c('0x0'));var moment=require('moment');module[_0x509c('0x1')]={'type':{'type':Sequelize[_0x509c('0x2')]},'uniqueid':{'type':Sequelize[_0x509c('0x2')]},'calleridnum':{'type':Sequelize[_0x509c('0x2')]},'calleridname':{'type':Sequelize[_0x509c('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x509c('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x509c('0x3')],'set':function(_0x4fc82c){var _0x49c34b=moment(_0x4fc82c);var _0x44bd69=moment(this[_0x509c('0x4')](_0x509c('0x5')))[_0x509c('0x6')](_0x509c('0x7'));var _0x2589cc=_0x49c34b[_0x509c('0x8')](_0x44bd69,_0x509c('0x9'));this[_0x509c('0xa')](_0x509c('0xb'),_0x4fc82c);this[_0x509c('0xa')]('holdtime',_0x2589cc||null);}},'position':{'type':Sequelize[_0x509c('0xc')]},'count':{'type':Sequelize[_0x509c('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x509c('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x509c('0x3')]},'queuecallerexit':{'type':Sequelize[_0x509c('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x509c('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x509c('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x509c('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x509c('0x2')]},'accountcode':{'type':Sequelize[_0x509c('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x509c('0x2')]},'priority':{'type':Sequelize[_0x509c('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x509c('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x509c('0x2')]},'transfer':{'type':Sequelize[_0x509c('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x509c('0x2')],'comment':_0x509c('0xf')},'transferexten':{'type':Sequelize[_0x509c('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x509c('0x2')]},'secondDisposition':{'type':Sequelize[_0x509c('0x2')]},'thirdDisposition':{'type':Sequelize[_0x509c('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x509c('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x509c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 98c3e7a..d80570a 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 _0x92d5=['set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','find','describe','getVoiceQueuesReport','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','offset','undefined','limit','count'];(function(_0x8e889a,_0x4a9814){var _0x742950=function(_0x142753){while(--_0x142753){_0x8e889a['push'](_0x8e889a['shift']());}};_0x742950(++_0x4a9814);}(_0x92d5,0x7f));var _0x592d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x92d5[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x592d('0x0'));var rimraf=require(_0x592d('0x1'));var zipdir=require(_0x592d('0x2'));var jsonpatch=require(_0x592d('0x3'));var rp=require(_0x592d('0x4'));var moment=require(_0x592d('0x5'));var BPromise=require(_0x592d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x592d('0x7'));var sox=require(_0x592d('0x8'));var csv=require(_0x592d('0x9'));var ejs=require(_0x592d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x592d('0xb'));var squel=require(_0x592d('0xc'));var crypto=require(_0x592d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x592d('0xe'));var toCsv=require(_0x592d('0x9'));var querystring=require('querystring');var Papa=require(_0x592d('0xf'));var Redis=require(_0x592d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x592d('0x11'));var as=require(_0x592d('0x12'));var hardwareService=require(_0x592d('0x13'));var logger=require(_0x592d('0x14'))(_0x592d('0x15'));var utils=require('../../config/utils');var config=require(_0x592d('0x16'));var licenseUtil=require(_0x592d('0x17'));var db=require(_0x592d('0x18'))['db'];config[_0x592d('0x19')]=_[_0x592d('0x1a')](config[_0x592d('0x19')],{'host':_0x592d('0x1b'),'port':0x18eb});var socket=require(_0x592d('0x1c'))(new Redis(config[_0x592d('0x19')]));require(_0x592d('0x1d'))[_0x592d('0x1e')](socket);function respondWithStatusCode(_0x5aad72,_0x3051bf){_0x3051bf=_0x3051bf||0xcc;return function(_0xe62884){if(_0xe62884){return _0x5aad72[_0x592d('0x1f')](_0x3051bf);}return _0x5aad72['status'](_0x3051bf)['end']();};}function respondWithResult(_0x35b44d,_0x4c21e2){_0x4c21e2=_0x4c21e2||0xc8;return function(_0x365a9e){if(_0x365a9e){return _0x35b44d[_0x592d('0x20')](_0x4c21e2)['json'](_0x365a9e);}};}function respondWithFilteredResult(_0x5541a0,_0x1595ab){return function(_0x2dfb37){if(_0x2dfb37){var _0x2a3863=typeof _0x1595ab[_0x592d('0x21')]===_0x592d('0x22')&&typeof _0x1595ab[_0x592d('0x23')]===_0x592d('0x22');var _0x5e48db=_0x2dfb37[_0x592d('0x24')];var _0x2ee0e9=_0x2a3863?0x0:_0x1595ab[_0x592d('0x21')];var _0x31f9b9=_0x2a3863?_0x2dfb37[_0x592d('0x24')]:_0x1595ab[_0x592d('0x21')]+_0x1595ab['limit'];var _0x427e17;if(_0x31f9b9>=_0x5e48db){_0x31f9b9=_0x5e48db;_0x427e17=0xc8;}else{_0x427e17=0xce;}_0x5541a0['status'](_0x427e17);return _0x5541a0[_0x592d('0x25')](_0x592d('0x26'),_0x2ee0e9+'-'+_0x31f9b9+'/'+_0x5e48db)['json'](_0x2dfb37);}return null;};}function patchUpdates(_0xa9b227){return function(_0x22a7d3){try{jsonpatch[_0x592d('0x27')](_0x22a7d3,_0xa9b227,!![]);}catch(_0x209761){return BPromise[_0x592d('0x28')](_0x209761);}return _0x22a7d3['save']();};}function saveUpdates(_0x2aff31,_0x2b1cb5){return function(_0x5e8012){if(_0x5e8012){return _0x5e8012['update'](_0x2aff31)[_0x592d('0x29')](function(_0xc06670){return _0xc06670;});}return null;};}function removeEntity(_0x155649,_0x4b9609){return function(_0x5514cd){if(_0x5514cd){return _0x5514cd[_0x592d('0x2a')]()[_0x592d('0x29')](function(){_0x155649[_0x592d('0x20')](0xcc)[_0x592d('0x2b')]();});}};}function handleEntityNotFound(_0x3bc2df,_0x5e7f7a){return function(_0x568e05){if(!_0x568e05){_0x3bc2df[_0x592d('0x1f')](0x194);}return _0x568e05;};}function handleError(_0x3a137e,_0x3a27f0){_0x3a27f0=_0x3a27f0||0x1f4;return function(_0x1cab57){logger[_0x592d('0x2c')](_0x1cab57[_0x592d('0x2d')]);if(_0x1cab57['name']){delete _0x1cab57[_0x592d('0x2e')];}_0x3a137e[_0x592d('0x20')](_0x3a27f0)[_0x592d('0x2f')](_0x1cab57);};}exports[_0x592d('0x30')]=function(_0x4942fa,_0x2f2ad0){var _0x524dd1={},_0x218188={},_0x381201={'count':0x0,'rows':[]};var _0xa72183=_[_0x592d('0x31')](db[_0x592d('0x32')][_0x592d('0x33')],function(_0x3b70ed){return{'name':_0x3b70ed['fieldName'],'type':_0x3b70ed[_0x592d('0x34')][_0x592d('0x35')]};});_0x218188[_0x592d('0x36')]=_[_0x592d('0x31')](_0xa72183,'name');_0x218188[_0x592d('0x37')]=_[_0x592d('0x38')](_0x4942fa[_0x592d('0x37')]);_0x218188[_0x592d('0x39')]=_['intersection'](_0x218188[_0x592d('0x36')],_0x218188[_0x592d('0x37')]);_0x524dd1[_0x592d('0x3a')]=_['intersection'](_0x218188[_0x592d('0x36')],qs[_0x592d('0x3b')](_0x4942fa['query'][_0x592d('0x3b')]));_0x524dd1[_0x592d('0x3a')]=_0x524dd1[_0x592d('0x3a')][_0x592d('0x3c')]?_0x524dd1[_0x592d('0x3a')]:_0x218188[_0x592d('0x36')];if(!_0x4942fa[_0x592d('0x37')][_0x592d('0x3d')]('nolimit')){_0x524dd1[_0x592d('0x23')]=qs[_0x592d('0x23')](_0x4942fa['query'][_0x592d('0x23')]);_0x524dd1[_0x592d('0x21')]=qs[_0x592d('0x21')](_0x4942fa['query']['offset']);}_0x524dd1[_0x592d('0x3e')]=qs['sort'](_0x4942fa[_0x592d('0x37')][_0x592d('0x3f')]);_0x524dd1['where']=qs[_0x592d('0x39')](_['pick'](_0x4942fa[_0x592d('0x37')],_0x218188[_0x592d('0x39')]),_0xa72183);if(_0x4942fa[_0x592d('0x37')][_0x592d('0x40')]){_0x524dd1[_0x592d('0x41')]=_[_0x592d('0x42')](_0x524dd1[_0x592d('0x41')],{'$or':_['map'](_0xa72183,function(_0x347b0a){if(_0x347b0a['type']!=='VIRTUAL'){var _0x4ba9aa={};_0x4ba9aa[_0x347b0a[_0x592d('0x2e')]]={'$like':'%'+_0x4942fa[_0x592d('0x37')]['filter']+'%'};return _0x4ba9aa;}})});}_0x524dd1=_[_0x592d('0x42')]({},_0x524dd1,_0x4942fa[_0x592d('0x43')]);var _0x4bb3ce={'where':_0x524dd1[_0x592d('0x41')]};return db['VoiceQueueReport'][_0x592d('0x24')](_0x4bb3ce)[_0x592d('0x29')](function(_0x5a8f8e){_0x381201[_0x592d('0x24')]=_0x5a8f8e;if(_0x4942fa[_0x592d('0x37')][_0x592d('0x44')]){_0x524dd1[_0x592d('0x45')]=[{'all':!![]}];}return db[_0x592d('0x32')][_0x592d('0x46')](_0x524dd1);})['then'](function(_0x2e48d2){_0x381201[_0x592d('0x47')]=_0x2e48d2;return _0x381201;})['then'](respondWithFilteredResult(_0x2f2ad0,_0x524dd1))[_0x592d('0x48')](handleError(_0x2f2ad0,null));};exports[_0x592d('0x49')]=function(_0x10e207,_0x36c0e5){var _0x59145e={'raw':![],'where':{'id':_0x10e207[_0x592d('0x4a')]['id']}},_0x3104d0={};_0x3104d0[_0x592d('0x36')]=_[_0x592d('0x38')](db[_0x592d('0x32')][_0x592d('0x33')]);_0x3104d0['query']=_[_0x592d('0x38')](_0x10e207[_0x592d('0x37')]);_0x3104d0['filters']=_[_0x592d('0x4b')](_0x3104d0[_0x592d('0x36')],_0x3104d0[_0x592d('0x37')]);_0x59145e['attributes']=_[_0x592d('0x4b')](_0x3104d0['model'],qs[_0x592d('0x3b')](_0x10e207[_0x592d('0x37')][_0x592d('0x3b')]));_0x59145e[_0x592d('0x3a')]=_0x59145e[_0x592d('0x3a')][_0x592d('0x3c')]?_0x59145e[_0x592d('0x3a')]:_0x3104d0['model'];if(_0x10e207['query'][_0x592d('0x44')]){_0x59145e[_0x592d('0x45')]=[{'all':!![]}];}_0x59145e=_['merge']({},_0x59145e,_0x10e207['options']);return db[_0x592d('0x32')]['find'](_0x59145e)[_0x592d('0x29')](handleEntityNotFound(_0x36c0e5,null))[_0x592d('0x29')](respondWithResult(_0x36c0e5,null))[_0x592d('0x48')](handleError(_0x36c0e5,null));};exports[_0x592d('0x4c')]=function(_0x2e7075,_0x29feba){return db['VoiceQueueReport'][_0x592d('0x4c')](_0x2e7075[_0x592d('0x4d')],{})['then'](respondWithResult(_0x29feba,0xc9))[_0x592d('0x48')](handleError(_0x29feba,null));};exports['update']=function(_0x246641,_0x597816){if(_0x246641['body']['id']){delete _0x246641[_0x592d('0x4d')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x246641[_0x592d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x597816,null))[_0x592d('0x29')](saveUpdates(_0x246641['body'],null))[_0x592d('0x29')](respondWithResult(_0x597816,null))[_0x592d('0x48')](handleError(_0x597816,null));};exports[_0x592d('0x2a')]=function(_0x2ff51e,_0x2627ab){return db['VoiceQueueReport'][_0x592d('0x4e')]({'where':{'id':_0x2ff51e[_0x592d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2627ab,null))[_0x592d('0x29')](removeEntity(_0x2627ab,null))[_0x592d('0x48')](handleError(_0x2627ab,null));};exports[_0x592d('0x4f')]=function(_0x28e35e,_0x5b874e){return db[_0x592d('0x32')][_0x592d('0x4f')]()['then'](respondWithResult(_0x5b874e,null))[_0x592d('0x48')](handleError(_0x5b874e,null));};exports[_0x592d('0x50')]=function(_0x10c5ad,_0x3745c8){var _0x3f1638={},_0x39d24c={},_0x2ad502={'count':0x0,'rows':[]};_0x39d24c[_0x592d('0x36')]=_['keys'](db[_0x592d('0x32')][_0x592d('0x33')]);_0x39d24c[_0x592d('0x37')]=_[_0x592d('0x38')](_0x10c5ad[_0x592d('0x37')]);_0x39d24c[_0x592d('0x39')]=_[_0x592d('0x4b')](_0x39d24c[_0x592d('0x36')],_0x39d24c[_0x592d('0x37')]);_0x3f1638[_0x592d('0x3a')]=_[_0x592d('0x4b')](_0x39d24c[_0x592d('0x36')],qs[_0x592d('0x3b')](_0x10c5ad[_0x592d('0x37')][_0x592d('0x3b')]));_0x3f1638[_0x592d('0x3a')]=_0x3f1638[_0x592d('0x3a')]['length']?_0x3f1638[_0x592d('0x3a')]:_0x39d24c[_0x592d('0x36')];if(!_0x10c5ad[_0x592d('0x37')]['hasOwnProperty']('nolimit')){_0x3f1638['limit']=qs[_0x592d('0x23')](_0x10c5ad['query']['limit']);_0x3f1638['offset']=qs[_0x592d('0x21')](_0x10c5ad['query'][_0x592d('0x21')]);}_0x3f1638[_0x592d('0x3e')]=qs['sort'](_0x10c5ad[_0x592d('0x37')][_0x592d('0x3f')]);_0x3f1638['where']=qs['filters'](_[_0x592d('0x51')](_0x10c5ad[_0x592d('0x37')],_0x39d24c[_0x592d('0x39')]));if(_0x10c5ad['query'][_0x592d('0x40')]){_0x3f1638[_0x592d('0x41')]=_[_0x592d('0x42')](_0x3f1638[_0x592d('0x41')],{'$or':_[_0x592d('0x31')](_0x3f1638[_0x592d('0x3a')],function(_0x4991c5){var _0x56bb1c={};_0x56bb1c[_0x4991c5]={'$like':'%'+_0x10c5ad['query']['filter']+'%'};return _0x56bb1c;})});}_0x3f1638=_['merge']({},_0x3f1638,_0x10c5ad['options']);var _0x262c5a={'where':_0x3f1638['where']};return db[_0x592d('0x32')]['count'](_0x262c5a)[_0x592d('0x29')](function(_0x49a6df){_0x2ad502['count']=_0x49a6df;if(_0x10c5ad['query'][_0x592d('0x44')]){_0x3f1638[_0x592d('0x45')]=[{'all':!![]}];}return db[_0x592d('0x32')][_0x592d('0x46')](_0x3f1638);})[_0x592d('0x29')](function(_0xf4d292){_0x2ad502[_0x592d('0x47')]=_0xf4d292;return _0x2ad502;})[_0x592d('0x29')](respondWithFilteredResult(_0x3745c8,_0x3f1638,_0x592d('0x50')))[_0x592d('0x48')](handleError(_0x3745c8,null,_0x592d('0x50')));}; \ No newline at end of file +var _0x91a8=['save','then','destroy','end','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','includeAll','include','findAll','catch','show','keys','length','find','create','body','update','params','describe','getVoiceQueuesReport','where','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x27c872,_0x5069f5){var _0x3c1214=function(_0x108351){while(--_0x108351){_0x27c872['push'](_0x27c872['shift']());}};_0x3c1214(++_0x5069f5);}(_0x91a8,0x7e));var _0x891a=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x91a8[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require(_0x891a('0x0'));var rimraf=require(_0x891a('0x1'));var zipdir=require(_0x891a('0x2'));var jsonpatch=require(_0x891a('0x3'));var rp=require(_0x891a('0x4'));var moment=require(_0x891a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x891a('0x6'));var util=require('util');var path=require(_0x891a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x891a('0x8'));var fs=require('fs');var fs_extra=require(_0x891a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x891a('0xa'));var jsforce=require(_0x891a('0xb'));var deskjs=require(_0x891a('0xc'));var toCsv=require(_0x891a('0xd'));var querystring=require(_0x891a('0xe'));var Papa=require(_0x891a('0xf'));var Redis=require(_0x891a('0x10'));var authService=require(_0x891a('0x11'));var qs=require(_0x891a('0x12'));var as=require(_0x891a('0x13'));var hardwareService=require(_0x891a('0x14'));var logger=require(_0x891a('0x15'))('api');var utils=require(_0x891a('0x16'));var config=require(_0x891a('0x17'));var licenseUtil=require(_0x891a('0x18'));var db=require(_0x891a('0x19'))['db'];config['redis']=_[_0x891a('0x1a')](config['redis'],{'host':_0x891a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x891a('0x1c')]));require('./voiceQueueReport.socket')[_0x891a('0x1d')](socket);function respondWithStatusCode(_0x6e5d38,_0x1a6294){_0x1a6294=_0x1a6294||0xcc;return function(_0x2d7035){if(_0x2d7035){return _0x6e5d38['sendStatus'](_0x1a6294);}return _0x6e5d38[_0x891a('0x1e')](_0x1a6294)['end']();};}function respondWithResult(_0x3cdb8b,_0x147c84){_0x147c84=_0x147c84||0xc8;return function(_0x470c60){if(_0x470c60){return _0x3cdb8b[_0x891a('0x1e')](_0x147c84)[_0x891a('0x1f')](_0x470c60);}};}function respondWithFilteredResult(_0x4422be,_0x6a91e7){return function(_0x85207d){if(_0x85207d){var _0x5239b7=typeof _0x6a91e7[_0x891a('0x20')]===_0x891a('0x21')&&typeof _0x6a91e7['limit']===_0x891a('0x21');var _0x4a7fc5=_0x85207d[_0x891a('0x22')];var _0x5c4bbc=_0x5239b7?0x0:_0x6a91e7['offset'];var _0x479855=_0x5239b7?_0x85207d['count']:_0x6a91e7[_0x891a('0x20')]+_0x6a91e7[_0x891a('0x23')];var _0x2ee12c;if(_0x479855>=_0x4a7fc5){_0x479855=_0x4a7fc5;_0x2ee12c=0xc8;}else{_0x2ee12c=0xce;}_0x4422be[_0x891a('0x1e')](_0x2ee12c);return _0x4422be[_0x891a('0x24')](_0x891a('0x25'),_0x5c4bbc+'-'+_0x479855+'/'+_0x4a7fc5)['json'](_0x85207d);}return null;};}function patchUpdates(_0x15fd24){return function(_0x199595){try{jsonpatch[_0x891a('0x26')](_0x199595,_0x15fd24,!![]);}catch(_0x26d51e){return BPromise[_0x891a('0x27')](_0x26d51e);}return _0x199595[_0x891a('0x28')]();};}function saveUpdates(_0x49dfd7,_0x57139c){return function(_0x2f0d04){if(_0x2f0d04){return _0x2f0d04['update'](_0x49dfd7)[_0x891a('0x29')](function(_0x575af0){return _0x575af0;});}return null;};}function removeEntity(_0x50a260,_0x37ca41){return function(_0x2697f0){if(_0x2697f0){return _0x2697f0[_0x891a('0x2a')]()['then'](function(){_0x50a260[_0x891a('0x1e')](0xcc)[_0x891a('0x2b')]();});}};}function handleEntityNotFound(_0x5b982f,_0x44c6e5){return function(_0x325010){if(!_0x325010){_0x5b982f['sendStatus'](0x194);}return _0x325010;};}function handleError(_0x4ecb2d,_0x253adb){_0x253adb=_0x253adb||0x1f4;return function(_0x39fb89){logger['error'](_0x39fb89[_0x891a('0x2c')]);if(_0x39fb89[_0x891a('0x2d')]){delete _0x39fb89[_0x891a('0x2d')];}_0x4ecb2d['status'](_0x253adb)[_0x891a('0x2e')](_0x39fb89);};}exports[_0x891a('0x2f')]=function(_0x4d196e,_0x5d7390){var _0x10766a={},_0x23cceb={},_0x1f88e1={'count':0x0,'rows':[]};var _0x21f0cd=_[_0x891a('0x30')](db[_0x891a('0x31')][_0x891a('0x32')],function(_0x579ed4){return{'name':_0x579ed4[_0x891a('0x33')],'type':_0x579ed4[_0x891a('0x34')][_0x891a('0x35')]};});_0x23cceb[_0x891a('0x36')]=_[_0x891a('0x30')](_0x21f0cd,_0x891a('0x2d'));_0x23cceb[_0x891a('0x37')]=_['keys'](_0x4d196e['query']);_0x23cceb[_0x891a('0x38')]=_[_0x891a('0x39')](_0x23cceb['model'],_0x23cceb['query']);_0x10766a[_0x891a('0x3a')]=_[_0x891a('0x39')](_0x23cceb['model'],qs[_0x891a('0x3b')](_0x4d196e[_0x891a('0x37')][_0x891a('0x3b')]));_0x10766a[_0x891a('0x3a')]=_0x10766a[_0x891a('0x3a')]['length']?_0x10766a[_0x891a('0x3a')]:_0x23cceb[_0x891a('0x36')];if(!_0x4d196e[_0x891a('0x37')][_0x891a('0x3c')](_0x891a('0x3d'))){_0x10766a[_0x891a('0x23')]=qs['limit'](_0x4d196e['query'][_0x891a('0x23')]);_0x10766a[_0x891a('0x20')]=qs[_0x891a('0x20')](_0x4d196e[_0x891a('0x37')]['offset']);}_0x10766a[_0x891a('0x3e')]=qs[_0x891a('0x3f')](_0x4d196e[_0x891a('0x37')][_0x891a('0x3f')]);_0x10766a['where']=qs[_0x891a('0x38')](_[_0x891a('0x40')](_0x4d196e['query'],_0x23cceb['filters']),_0x21f0cd);if(_0x4d196e[_0x891a('0x37')][_0x891a('0x41')]){_0x10766a['where']=_[_0x891a('0x42')](_0x10766a['where'],{'$or':_[_0x891a('0x30')](_0x21f0cd,function(_0x4b6587){if(_0x4b6587[_0x891a('0x34')]!=='VIRTUAL'){var _0x1c5ecc={};_0x1c5ecc[_0x4b6587['name']]={'$like':'%'+_0x4d196e[_0x891a('0x37')][_0x891a('0x41')]+'%'};return _0x1c5ecc;}})});}_0x10766a=_['merge']({},_0x10766a,_0x4d196e[_0x891a('0x43')]);var _0xca923a={'where':_0x10766a['where']};return db[_0x891a('0x31')][_0x891a('0x22')](_0xca923a)['then'](function(_0x4b6c69){_0x1f88e1['count']=_0x4b6c69;if(_0x4d196e[_0x891a('0x37')][_0x891a('0x44')]){_0x10766a[_0x891a('0x45')]=[{'all':!![]}];}return db[_0x891a('0x31')][_0x891a('0x46')](_0x10766a);})[_0x891a('0x29')](function(_0x2d5bca){_0x1f88e1['rows']=_0x2d5bca;return _0x1f88e1;})[_0x891a('0x29')](respondWithFilteredResult(_0x5d7390,_0x10766a))[_0x891a('0x47')](handleError(_0x5d7390,null));};exports[_0x891a('0x48')]=function(_0x3978bf,_0x575927){var _0x1158d5={'raw':![],'where':{'id':_0x3978bf['params']['id']}},_0x569bc4={};_0x569bc4[_0x891a('0x36')]=_[_0x891a('0x49')](db[_0x891a('0x31')][_0x891a('0x32')]);_0x569bc4[_0x891a('0x37')]=_['keys'](_0x3978bf[_0x891a('0x37')]);_0x569bc4[_0x891a('0x38')]=_['intersection'](_0x569bc4[_0x891a('0x36')],_0x569bc4[_0x891a('0x37')]);_0x1158d5[_0x891a('0x3a')]=_[_0x891a('0x39')](_0x569bc4['model'],qs[_0x891a('0x3b')](_0x3978bf[_0x891a('0x37')][_0x891a('0x3b')]));_0x1158d5[_0x891a('0x3a')]=_0x1158d5[_0x891a('0x3a')][_0x891a('0x4a')]?_0x1158d5['attributes']:_0x569bc4[_0x891a('0x36')];if(_0x3978bf['query'][_0x891a('0x44')]){_0x1158d5[_0x891a('0x45')]=[{'all':!![]}];}_0x1158d5=_[_0x891a('0x42')]({},_0x1158d5,_0x3978bf[_0x891a('0x43')]);return db['VoiceQueueReport'][_0x891a('0x4b')](_0x1158d5)[_0x891a('0x29')](handleEntityNotFound(_0x575927,null))['then'](respondWithResult(_0x575927,null))[_0x891a('0x47')](handleError(_0x575927,null));};exports[_0x891a('0x4c')]=function(_0x468f29,_0x4e1480){return db[_0x891a('0x31')][_0x891a('0x4c')](_0x468f29[_0x891a('0x4d')],{})[_0x891a('0x29')](respondWithResult(_0x4e1480,0xc9))[_0x891a('0x47')](handleError(_0x4e1480,null));};exports[_0x891a('0x4e')]=function(_0x18e851,_0x39daca){if(_0x18e851['body']['id']){delete _0x18e851[_0x891a('0x4d')]['id'];}return db[_0x891a('0x31')][_0x891a('0x4b')]({'where':{'id':_0x18e851[_0x891a('0x4f')]['id']}})[_0x891a('0x29')](handleEntityNotFound(_0x39daca,null))[_0x891a('0x29')](saveUpdates(_0x18e851[_0x891a('0x4d')],null))[_0x891a('0x29')](respondWithResult(_0x39daca,null))['catch'](handleError(_0x39daca,null));};exports['destroy']=function(_0x1aa66f,_0x415d16){return db[_0x891a('0x31')][_0x891a('0x4b')]({'where':{'id':_0x1aa66f[_0x891a('0x4f')]['id']}})[_0x891a('0x29')](handleEntityNotFound(_0x415d16,null))[_0x891a('0x29')](removeEntity(_0x415d16,null))[_0x891a('0x47')](handleError(_0x415d16,null));};exports[_0x891a('0x50')]=function(_0x20c37c,_0x568c22){return db[_0x891a('0x31')][_0x891a('0x50')]()['then'](respondWithResult(_0x568c22,null))['catch'](handleError(_0x568c22,null));};exports[_0x891a('0x51')]=function(_0x1251a2,_0x26e1a7){var _0x1d3ab4={},_0x1e62ff={},_0x49db36={'count':0x0,'rows':[]};_0x1e62ff[_0x891a('0x36')]=_[_0x891a('0x49')](db[_0x891a('0x31')][_0x891a('0x32')]);_0x1e62ff['query']=_[_0x891a('0x49')](_0x1251a2[_0x891a('0x37')]);_0x1e62ff[_0x891a('0x38')]=_[_0x891a('0x39')](_0x1e62ff['model'],_0x1e62ff[_0x891a('0x37')]);_0x1d3ab4[_0x891a('0x3a')]=_[_0x891a('0x39')](_0x1e62ff['model'],qs[_0x891a('0x3b')](_0x1251a2[_0x891a('0x37')][_0x891a('0x3b')]));_0x1d3ab4[_0x891a('0x3a')]=_0x1d3ab4['attributes'][_0x891a('0x4a')]?_0x1d3ab4['attributes']:_0x1e62ff[_0x891a('0x36')];if(!_0x1251a2[_0x891a('0x37')][_0x891a('0x3c')](_0x891a('0x3d'))){_0x1d3ab4[_0x891a('0x23')]=qs[_0x891a('0x23')](_0x1251a2['query'][_0x891a('0x23')]);_0x1d3ab4[_0x891a('0x20')]=qs[_0x891a('0x20')](_0x1251a2[_0x891a('0x37')]['offset']);}_0x1d3ab4[_0x891a('0x3e')]=qs[_0x891a('0x3f')](_0x1251a2[_0x891a('0x37')]['sort']);_0x1d3ab4[_0x891a('0x52')]=qs['filters'](_['pick'](_0x1251a2[_0x891a('0x37')],_0x1e62ff[_0x891a('0x38')]));if(_0x1251a2[_0x891a('0x37')][_0x891a('0x41')]){_0x1d3ab4[_0x891a('0x52')]=_[_0x891a('0x42')](_0x1d3ab4[_0x891a('0x52')],{'$or':_['map'](_0x1d3ab4['attributes'],function(_0xbe9279){var _0x137ab6={};_0x137ab6[_0xbe9279]={'$like':'%'+_0x1251a2[_0x891a('0x37')][_0x891a('0x41')]+'%'};return _0x137ab6;})});}_0x1d3ab4=_['merge']({},_0x1d3ab4,_0x1251a2[_0x891a('0x43')]);var _0x2d2b21={'where':_0x1d3ab4[_0x891a('0x52')]};return db[_0x891a('0x31')][_0x891a('0x22')](_0x2d2b21)['then'](function(_0x3450da){_0x49db36['count']=_0x3450da;if(_0x1251a2[_0x891a('0x37')][_0x891a('0x44')]){_0x1d3ab4[_0x891a('0x45')]=[{'all':!![]}];}return db[_0x891a('0x31')][_0x891a('0x46')](_0x1d3ab4);})[_0x891a('0x29')](function(_0x45ce3e){_0x49db36['rows']=_0x45ce3e;return _0x49db36;})[_0x891a('0x29')](respondWithFilteredResult(_0x26e1a7,_0x1d3ab4,_0x891a('0x51')))['catch'](handleError(_0x26e1a7,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 ec56596..dde7fbb 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 _0xce96=['hasOwnProperty','hook','exports','VoiceQueueReport','setMaxListeners','save','update','remove','emit'];(function(_0x4c1a81,_0x3221ed){var _0x1957ba=function(_0x5760b3){while(--_0x5760b3){_0x4c1a81['push'](_0x4c1a81['shift']());}};_0x1957ba(++_0x3221ed);}(_0xce96,0x1e9));var _0x6ce9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xce96[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x6ce9('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6ce9('0x1')](0x0);var events={'afterCreate':_0x6ce9('0x2'),'afterUpdate':_0x6ce9('0x3'),'afterDestroy':_0x6ce9('0x4')};function emitEvent(_0x2174db){return function(_0x8d0d44,_0x14aebd,_0x493b66){VoiceQueueReportEvents[_0x6ce9('0x5')](_0x2174db+':'+_0x8d0d44['id'],_0x8d0d44);VoiceQueueReportEvents[_0x6ce9('0x5')](_0x2174db,_0x8d0d44);_0x493b66(null);};}for(var e in events){if(events[_0x6ce9('0x6')](e)){var event=events[e];VoiceQueueReport[_0x6ce9('0x7')](e,emitEvent(event));}}module[_0x6ce9('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xae41=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x32bb12,_0x1baa09){var _0x1af866=function(_0x173d13){while(--_0x173d13){_0x32bb12['push'](_0x32bb12['shift']());}};_0x1af866(++_0x1baa09);}(_0xae41,0xbe));var _0x1ae4=function(_0xc28679,_0x1c8ae1){_0xc28679=_0xc28679-0x0;var _0x4a6093=_0xae41[_0xc28679];return _0x4a6093;};'use strict';var EventEmitter=require(_0x1ae4('0x0'));var VoiceQueueReport=require(_0x1ae4('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1ae4('0x2')](0x0);var events={'afterCreate':_0x1ae4('0x3'),'afterUpdate':_0x1ae4('0x4'),'afterDestroy':_0x1ae4('0x5')};function emitEvent(_0x43a68e){return function(_0x1603b0,_0x372775,_0x51b1bc){VoiceQueueReportEvents['emit'](_0x43a68e+':'+_0x1603b0['id'],_0x1603b0);VoiceQueueReportEvents[_0x1ae4('0x6')](_0x43a68e,_0x1603b0);_0x51b1bc(null);};}for(var e in events){if(events[_0x1ae4('0x7')](e)){var event=events[e];VoiceQueueReport[_0x1ae4('0x8')](e,emitEvent(event));}}module[_0x1ae4('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index ea32217..af4ac87 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 _0x0773=['define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x5e01c5,_0x58c317){var _0xfab2f8=function(_0xbc1fb5){while(--_0xbc1fb5){_0x5e01c5['push'](_0x5e01c5['shift']());}};_0xfab2f8(++_0x58c317);}(_0x0773,0xa1));var _0x3077=function(_0x1f9074,_0x1444d6){_0x1f9074=_0x1f9074-0x0;var _0x4fac7c=_0x0773[_0x1f9074];return _0x4fac7c;};'use strict';var _=require('lodash');var util=require(_0x3077('0x0'));var logger=require('../../config/logger')(_0x3077('0x1'));var moment=require(_0x3077('0x2'));var BPromise=require('bluebird');var rp=require(_0x3077('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3077('0x4'));var config=require(_0x3077('0x5'));var attributes=require(_0x3077('0x6'));module[_0x3077('0x7')]=function(_0x2a15b1,_0x4cb8fc){return _0x2a15b1[_0x3077('0x8')](_0x3077('0x9'),attributes,{'tableName':_0x3077('0xa'),'paranoid':![],'indexes':[{'fields':[_0x3077('0xb')]},{'fields':[_0x3077('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84ad=['bluebird','request-promise','path','rimraf','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','moment'];(function(_0x3fb523,_0x11c9cd){var _0x4fd0e6=function(_0x578e50){while(--_0x578e50){_0x3fb523['push'](_0x3fb523['shift']());}};_0x4fd0e6(++_0x11c9cd);}(_0x84ad,0xcd));var _0xd84a=function(_0x5ed5e4,_0x15d7fc){_0x5ed5e4=_0x5ed5e4-0x0;var _0xcc956a=_0x84ad[_0x5ed5e4];return _0xcc956a;};'use strict';var _=require('lodash');var util=require(_0xd84a('0x0'));var logger=require(_0xd84a('0x1'))('api');var moment=require(_0xd84a('0x2'));var BPromise=require(_0xd84a('0x3'));var rp=require(_0xd84a('0x4'));var fs=require('fs');var path=require(_0xd84a('0x5'));var rimraf=require(_0xd84a('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xd84a('0x7')]=function(_0x415320,_0x14d046){return _0x415320[_0xd84a('0x8')](_0xd84a('0x9'),attributes,{'tableName':_0xd84a('0xa'),'paranoid':![],'indexes':[{'fields':[_0xd84a('0xb')]},{'fields':[_0xd84a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index ace20e9..8b7ee8f 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 _0xdd75=['result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','include','map','model','debug','catch','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message'];(function(_0x37d5ff,_0x5ee83b){var _0x146b37=function(_0x596170){while(--_0x596170){_0x37d5ff['push'](_0x37d5ff['shift']());}};_0x146b37(++_0x5ee83b);}(_0xdd75,0xf9));var _0x5dd7=function(_0x12c076,_0x5bef17){_0x12c076=_0x12c076-0x0;var _0x2ddd18=_0xdd75[_0x12c076];return _0x2ddd18;};'use strict';var _=require(_0x5dd7('0x0'));var util=require(_0x5dd7('0x1'));var moment=require('moment');var BPromise=require(_0x5dd7('0x2'));var rs=require(_0x5dd7('0x3'));var fs=require('fs');var Redis=require(_0x5dd7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5dd7('0x5'));var logger=require(_0x5dd7('0x6'))(_0x5dd7('0x7'));var config=require(_0x5dd7('0x8'));var jayson=require(_0x5dd7('0x9'));var client=jayson[_0x5dd7('0xa')][_0x5dd7('0xb')]({'port':0x232a});config[_0x5dd7('0xc')]=_[_0x5dd7('0xd')](config[_0x5dd7('0xc')],{'host':_0x5dd7('0xe'),'port':0x18eb});var socket=require(_0x5dd7('0xf'))(new Redis(config['redis']));require(_0x5dd7('0x10'))[_0x5dd7('0x11')](socket);function respondWithRpcPromise(_0xc0e400,_0x21182b,_0x3ff9ee){return new BPromise(function(_0x3ea30f,_0x45c32c){return client[_0x5dd7('0x12')](_0xc0e400,_0x3ff9ee)[_0x5dd7('0x13')](function(_0x4e243e){logger[_0x5dd7('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x21182b,_0x5dd7('0x15'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x21182b,_0x5dd7('0x15'),JSON[_0x5dd7('0x16')](_0x4e243e));if(_0x4e243e['error']){if(_0x4e243e[_0x5dd7('0x17')][_0x5dd7('0x18')]===0x1f4){logger[_0x5dd7('0x17')](_0x5dd7('0x19'),_0x21182b,_0x4e243e[_0x5dd7('0x17')][_0x5dd7('0x1a')]);return _0x45c32c(_0x4e243e['error']['message']);}logger[_0x5dd7('0x17')](_0x5dd7('0x19'),_0x21182b,_0x4e243e['error'][_0x5dd7('0x1a')]);return _0x3ea30f(_0x4e243e[_0x5dd7('0x17')][_0x5dd7('0x1a')]);}else{logger[_0x5dd7('0x14')](_0x5dd7('0x19'),_0x21182b,_0x5dd7('0x15'));_0x3ea30f(_0x4e243e[_0x5dd7('0x1b')]['message']);}})['catch'](function(_0x57f1ca){logger[_0x5dd7('0x17')](_0x5dd7('0x19'),_0x21182b,_0x57f1ca);_0x45c32c(_0x57f1ca);});});}exports[_0x5dd7('0x1c')]=function(_0x12be1d){var _0x31f5a9=this;return new Promise(function(_0x54c95e,_0xa943db){return db[_0x5dd7('0x1d')][_0x5dd7('0x1e')]({'raw':_0x12be1d[_0x5dd7('0x1f')]?_0x12be1d[_0x5dd7('0x1f')][_0x5dd7('0x20')]===undefined?!![]:![]:!![],'where':_0x12be1d[_0x5dd7('0x1f')]?_0x12be1d['options']['where']||null:null,'attributes':_0x12be1d[_0x5dd7('0x1f')]?_0x12be1d['options'][_0x5dd7('0x21')]||null:null,'limit':_0x12be1d[_0x5dd7('0x1f')]?_0x12be1d[_0x5dd7('0x1f')]['limit']||null:null,'include':_0x12be1d[_0x5dd7('0x1f')]?_0x12be1d[_0x5dd7('0x1f')][_0x5dd7('0x22')]?_[_0x5dd7('0x23')](_0x12be1d[_0x5dd7('0x1f')]['include'],function(_0x2c61cf){return{'model':db[_0x2c61cf[_0x5dd7('0x24')]],'as':_0x2c61cf['as'],'attributes':_0x2c61cf[_0x5dd7('0x21')],'include':_0x2c61cf['include']?_[_0x5dd7('0x23')](_0x2c61cf[_0x5dd7('0x22')],function(_0x3c9597){return{'model':db[_0x3c9597[_0x5dd7('0x24')]],'as':_0x3c9597['as'],'attributes':_0x3c9597[_0x5dd7('0x21')],'include':_0x3c9597[_0x5dd7('0x22')]?_[_0x5dd7('0x23')](_0x3c9597[_0x5dd7('0x22')],function(_0x2f8b7e){return{'model':db[_0x2f8b7e['model']],'as':_0x2f8b7e['as'],'attributes':_0x2f8b7e[_0x5dd7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5dd7('0x13')](function(_0x5e6cb9){logger['info']('GetVoiceQueueReport',_0x12be1d);logger[_0x5dd7('0x25')](_0x5dd7('0x1c'),_0x12be1d,JSON['stringify'](_0x5e6cb9));_0x54c95e(_0x5e6cb9);})[_0x5dd7('0x26')](function(_0x36b203){logger['error'](_0x5dd7('0x1c'),_0x36b203['message'],_0x12be1d);_0xa943db(_0x31f5a9[_0x5dd7('0x17')](0x1f4,_0x36b203[_0x5dd7('0x1a')]));});});};exports['CreateVoiceQueueReport']=function(_0x3bc476){var _0xa06ce3=this;return new Promise(function(_0x4d1999,_0x198a10){return db[_0x5dd7('0x1d')][_0x5dd7('0x27')](_0x3bc476[_0x5dd7('0x28')],{'raw':_0x3bc476[_0x5dd7('0x1f')]?_0x3bc476[_0x5dd7('0x1f')][_0x5dd7('0x20')]===undefined?!![]:![]:!![]})[_0x5dd7('0x13')](function(_0x133550){logger[_0x5dd7('0x14')](_0x5dd7('0x29'),_0x3bc476);logger[_0x5dd7('0x25')](_0x5dd7('0x29'),_0x3bc476,JSON[_0x5dd7('0x16')](_0x133550));_0x4d1999(_0x133550);})['catch'](function(_0x7544dc){logger[_0x5dd7('0x17')](_0x5dd7('0x29'),_0x7544dc[_0x5dd7('0x1a')],_0x3bc476);_0x198a10(_0xa06ce3[_0x5dd7('0x17')](0x1f4,_0x7544dc[_0x5dd7('0x1a')]));});});};exports[_0x5dd7('0x2a')]=function(_0x15d7b2){var _0x45dc1f=this;return new Promise(function(_0x3c9cfc,_0x50d311){return db[_0x5dd7('0x1d')][_0x5dd7('0x2b')](_0x15d7b2[_0x5dd7('0x28')],{'raw':_0x15d7b2[_0x5dd7('0x1f')]?_0x15d7b2[_0x5dd7('0x1f')][_0x5dd7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15d7b2[_0x5dd7('0x1f')]?_0x15d7b2[_0x5dd7('0x1f')][_0x5dd7('0x2c')]||null:null,'attributes':_0x15d7b2[_0x5dd7('0x1f')]?_0x15d7b2[_0x5dd7('0x1f')][_0x5dd7('0x21')]||null:null,'limit':_0x15d7b2['options']?_0x15d7b2[_0x5dd7('0x1f')][_0x5dd7('0x2d')]||null:null})[_0x5dd7('0x13')](function(_0x2ae1e8){logger[_0x5dd7('0x14')](_0x5dd7('0x2a'),_0x15d7b2);logger[_0x5dd7('0x25')](_0x5dd7('0x2a'),_0x15d7b2,JSON[_0x5dd7('0x16')](_0x2ae1e8));_0x3c9cfc(_0x2ae1e8);})[_0x5dd7('0x26')](function(_0xd8b763){logger['error']('UpdateVoiceQueueReport',_0xd8b763['message'],_0x15d7b2);_0x50d311(_0x45dc1f[_0x5dd7('0x17')](0x1f4,_0xd8b763[_0x5dd7('0x1a')]));});});}; \ No newline at end of file +var _0x8ce2=['stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','then','CreateVoiceQueueReport','create','body','update','UpdateVoiceQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3cff4c,_0x40feb0){var _0x3b6687=function(_0x3fdf2c){while(--_0x3fdf2c){_0x3cff4c['push'](_0x3cff4c['shift']());}};_0x3b6687(++_0x40feb0);}(_0x8ce2,0x1a2));var _0x28ce=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x8ce2[_0x10004e];return _0x5af990;};'use strict';var _=require(_0x28ce('0x0'));var util=require(_0x28ce('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x28ce('0x2'));var fs=require('fs');var Redis=require(_0x28ce('0x3'));var db=require(_0x28ce('0x4'))['db'];var utils=require(_0x28ce('0x5'));var logger=require(_0x28ce('0x6'))(_0x28ce('0x7'));var config=require(_0x28ce('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x28ce('0x9')]({'port':0x232a});config[_0x28ce('0xa')]=_[_0x28ce('0xb')](config[_0x28ce('0xa')],{'host':_0x28ce('0xc'),'port':0x18eb});var socket=require(_0x28ce('0xd'))(new Redis(config[_0x28ce('0xa')]));require(_0x28ce('0xe'))[_0x28ce('0xf')](socket);function respondWithRpcPromise(_0xd7216f,_0x5c0926,_0x47ec22){return new BPromise(function(_0x4655b3,_0x509419){return client[_0x28ce('0x10')](_0xd7216f,_0x47ec22)['then'](function(_0x3b9a6a){logger[_0x28ce('0x11')](_0x28ce('0x12'),_0x5c0926,'request\x20sent');logger[_0x28ce('0x13')](_0x28ce('0x14'),_0x5c0926,_0x28ce('0x15'),JSON[_0x28ce('0x16')](_0x3b9a6a));if(_0x3b9a6a[_0x28ce('0x17')]){if(_0x3b9a6a['error'][_0x28ce('0x18')]===0x1f4){logger[_0x28ce('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x5c0926,_0x3b9a6a[_0x28ce('0x17')][_0x28ce('0x19')]);return _0x509419(_0x3b9a6a['error']['message']);}logger[_0x28ce('0x17')](_0x28ce('0x12'),_0x5c0926,_0x3b9a6a[_0x28ce('0x17')]['message']);return _0x4655b3(_0x3b9a6a[_0x28ce('0x17')]['message']);}else{logger[_0x28ce('0x11')](_0x28ce('0x12'),_0x5c0926,'request\x20sent');_0x4655b3(_0x3b9a6a[_0x28ce('0x1a')][_0x28ce('0x19')]);}})[_0x28ce('0x1b')](function(_0x5bc470){logger[_0x28ce('0x17')](_0x28ce('0x12'),_0x5c0926,_0x5bc470);_0x509419(_0x5bc470);});});}exports[_0x28ce('0x1c')]=function(_0xa4e8fb){var _0x10f732=this;return new Promise(function(_0x552409,_0x1262da){return db[_0x28ce('0x1d')][_0x28ce('0x1e')]({'raw':_0xa4e8fb['options']?_0xa4e8fb[_0x28ce('0x1f')][_0x28ce('0x20')]===undefined?!![]:![]:!![],'where':_0xa4e8fb[_0x28ce('0x1f')]?_0xa4e8fb['options']['where']||null:null,'attributes':_0xa4e8fb[_0x28ce('0x1f')]?_0xa4e8fb['options'][_0x28ce('0x21')]||null:null,'limit':_0xa4e8fb[_0x28ce('0x1f')]?_0xa4e8fb[_0x28ce('0x1f')][_0x28ce('0x22')]||null:null,'include':_0xa4e8fb['options']?_0xa4e8fb[_0x28ce('0x1f')][_0x28ce('0x23')]?_[_0x28ce('0x24')](_0xa4e8fb['options'][_0x28ce('0x23')],function(_0x161b91){return{'model':db[_0x161b91[_0x28ce('0x25')]],'as':_0x161b91['as'],'attributes':_0x161b91[_0x28ce('0x21')],'include':_0x161b91[_0x28ce('0x23')]?_[_0x28ce('0x24')](_0x161b91['include'],function(_0x360c48){return{'model':db[_0x360c48[_0x28ce('0x25')]],'as':_0x360c48['as'],'attributes':_0x360c48[_0x28ce('0x21')],'include':_0x360c48[_0x28ce('0x23')]?_['map'](_0x360c48[_0x28ce('0x23')],function(_0x290c7a){return{'model':db[_0x290c7a['model']],'as':_0x290c7a['as'],'attributes':_0x290c7a['attributes']};}):[]};}):[]};}):[]:[]})[_0x28ce('0x26')](function(_0x404adb){logger['info'](_0x28ce('0x1c'),_0xa4e8fb);logger[_0x28ce('0x13')](_0x28ce('0x1c'),_0xa4e8fb,JSON[_0x28ce('0x16')](_0x404adb));_0x552409(_0x404adb);})[_0x28ce('0x1b')](function(_0x43632c){logger[_0x28ce('0x17')]('GetVoiceQueueReport',_0x43632c['message'],_0xa4e8fb);_0x1262da(_0x10f732[_0x28ce('0x17')](0x1f4,_0x43632c['message']));});});};exports[_0x28ce('0x27')]=function(_0x3a017e){var _0x3bdb34=this;return new Promise(function(_0xac6b83,_0x5a288f){return db[_0x28ce('0x1d')][_0x28ce('0x28')](_0x3a017e[_0x28ce('0x29')],{'raw':_0x3a017e[_0x28ce('0x1f')]?_0x3a017e[_0x28ce('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xeebdca){logger[_0x28ce('0x11')](_0x28ce('0x27'),_0x3a017e);logger['debug'](_0x28ce('0x27'),_0x3a017e,JSON['stringify'](_0xeebdca));_0xac6b83(_0xeebdca);})[_0x28ce('0x1b')](function(_0x53dd4f){logger[_0x28ce('0x17')](_0x28ce('0x27'),_0x53dd4f[_0x28ce('0x19')],_0x3a017e);_0x5a288f(_0x3bdb34[_0x28ce('0x17')](0x1f4,_0x53dd4f['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x133c2a){var _0x2b5848=this;return new Promise(function(_0x163667,_0x5792b9){return db['VoiceQueueReport'][_0x28ce('0x2a')](_0x133c2a[_0x28ce('0x29')],{'raw':_0x133c2a[_0x28ce('0x1f')]?_0x133c2a['options'][_0x28ce('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x133c2a[_0x28ce('0x1f')]?_0x133c2a[_0x28ce('0x1f')]['where']||null:null,'attributes':_0x133c2a[_0x28ce('0x1f')]?_0x133c2a[_0x28ce('0x1f')][_0x28ce('0x21')]||null:null,'limit':_0x133c2a[_0x28ce('0x1f')]?_0x133c2a[_0x28ce('0x1f')][_0x28ce('0x22')]||null:null})[_0x28ce('0x26')](function(_0x10144c){logger[_0x28ce('0x11')](_0x28ce('0x2b'),_0x133c2a);logger[_0x28ce('0x13')](_0x28ce('0x2b'),_0x133c2a,JSON[_0x28ce('0x16')](_0x10144c));_0x163667(_0x10144c);})[_0x28ce('0x1b')](function(_0x7ff67d){logger[_0x28ce('0x17')](_0x28ce('0x2b'),_0x7ff67d[_0x28ce('0x19')],_0x133c2a);_0x5792b9(_0x2b5848[_0x28ce('0x17')](0x1f4,_0x7ff67d[_0x28ce('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ae60cc2..a56fb5f 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 _0xcff4=['remove','update','emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x36d221,_0x268765){var _0x15cb44=function(_0x317c54){while(--_0x317c54){_0x36d221['push'](_0x36d221['shift']());}};_0x15cb44(++_0x268765);}(_0xcff4,0x11e));var _0x4cff=function(_0x29db36,_0x3c512f){_0x29db36=_0x29db36-0x0;var _0x71bd1f=_0xcff4[_0x29db36];return _0x71bd1f;};'use strict';var VoiceQueueReportEvents=require(_0x4cff('0x0'));var events=[_0x4cff('0x1'),_0x4cff('0x2'),_0x4cff('0x3')];function createListener(_0x3c4650,_0x627b49){return function(_0x59febf){_0x627b49[_0x4cff('0x4')](_0x3c4650,_0x59febf);};}function removeListener(_0x47a41f,_0x34a2f1){return function(){VoiceQueueReportEvents[_0x4cff('0x5')](_0x47a41f,_0x34a2f1);};}exports[_0x4cff('0x6')]=function(_0x46dfc1){for(var _0x355206=0x0,_0x3c486a=events['length'];_0x355206<_0x3c486a;_0x355206++){var _0x1af778=events[_0x355206];var _0x85a634=createListener(_0x4cff('0x7')+_0x1af778,_0x46dfc1);VoiceQueueReportEvents['on'](_0x1af778,_0x85a634);}}; \ No newline at end of file +var _0x1e19=['voiceQueueReport:','./voiceQueueReport.events','save','remove','update','removeListener','register','length'];(function(_0x54b672,_0x57824f){var _0x587419=function(_0x43431f){while(--_0x43431f){_0x54b672['push'](_0x54b672['shift']());}};_0x587419(++_0x57824f);}(_0x1e19,0x1c9));var _0x91e1=function(_0x2f81ed,_0x518ceb){_0x2f81ed=_0x2f81ed-0x0;var _0x4774c9=_0x1e19[_0x2f81ed];return _0x4774c9;};'use strict';var VoiceQueueReportEvents=require(_0x91e1('0x0'));var events=[_0x91e1('0x1'),_0x91e1('0x2'),_0x91e1('0x3')];function createListener(_0x3ebfdb,_0x569e03){return function(_0x5e25dd){_0x569e03['emit'](_0x3ebfdb,_0x5e25dd);};}function removeListener(_0x5e4bdc,_0x169cdf){return function(){VoiceQueueReportEvents[_0x91e1('0x4')](_0x5e4bdc,_0x169cdf);};}exports[_0x91e1('0x5')]=function(_0x45d13a){for(var _0x38c2c0=0x0,_0x54c3ce=events[_0x91e1('0x6')];_0x38c2c0<_0x54c3ce;_0x38c2c0++){var _0x5b3df7=events[_0x38c2c0];var _0x15f4c8=createListener(_0x91e1('0x7')+_0x5b3df7,_0x45d13a);VoiceQueueReportEvents['on'](_0x5b3df7,_0x15f4c8);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 86a2c4f..7a6b43a 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 _0xbeed=['../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router'];(function(_0x39de7e,_0xfa5402){var _0x1d43a8=function(_0x574953){while(--_0x574953){_0x39de7e['push'](_0x39de7e['shift']());}};_0x1d43a8(++_0xfa5402);}(_0xbeed,0xad));var _0xdbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeed[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xdbee('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdbee('0x1'));var express=require('express');var router=express[_0xdbee('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbee('0x3'));var config=require(_0xdbee('0x4'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0xdbee('0x5')](),controller[_0xdbee('0x6')]);router['get'](_0xdbee('0x7'),auth[_0xdbee('0x5')](),controller[_0xdbee('0x8')]);router[_0xdbee('0x9')]('/',auth[_0xdbee('0x5')](),controller[_0xdbee('0xa')]);router[_0xdbee('0xb')](_0xdbee('0x7'),auth['isAuthenticated'](),controller[_0xdbee('0xc')]);router[_0xdbee('0xd')](_0xdbee('0x7'),auth[_0xdbee('0x5')](),controller[_0xdbee('0xe')]);module[_0xdbee('0xf')]=router; \ No newline at end of file +var _0xb8b2=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./voiceQueuesLog.controller','index','isAuthenticated','show','post','create','/:id','update'];(function(_0x511236,_0x4222d1){var _0x14facd=function(_0x1762f6){while(--_0x1762f6){_0x511236['push'](_0x511236['shift']());}};_0x14facd(++_0x4222d1);}(_0xb8b2,0xb7));var _0x2b8b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb8b2[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x2b8b('0x0'));var util=require(_0x2b8b('0x1'));var path=require(_0x2b8b('0x2'));var timeout=require(_0x2b8b('0x3'));var express=require(_0x2b8b('0x4'));var router=express[_0x2b8b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2b8b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2b8b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2b8b('0x8')]);router['get']('/:id',auth[_0x2b8b('0x9')](),controller[_0x2b8b('0xa')]);router[_0x2b8b('0xb')]('/',auth['isAuthenticated'](),controller[_0x2b8b('0xc')]);router['put'](_0x2b8b('0xd'),auth[_0x2b8b('0x9')](),controller[_0x2b8b('0xe')]);router[_0x2b8b('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2b8b('0x10')]);module[_0x2b8b('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 88d818f..6769ce2 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 _0x49d9=['moment','STRING','DATE','sequelize'];(function(_0x4582e9,_0x2aee96){var _0x24ca51=function(_0x343bdf){while(--_0x343bdf){_0x4582e9['push'](_0x4582e9['shift']());}};_0x24ca51(++_0x2aee96);}(_0x49d9,0xfb));var _0x949d=function(_0x21198c,_0x10c7ff){_0x21198c=_0x21198c-0x0;var _0x113d00=_0x49d9[_0x21198c];return _0x113d00;};'use strict';var Sequelize=require(_0x949d('0x0'));var moment=require(_0x949d('0x1'));module['exports']={'time':{'type':Sequelize[_0x949d('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x949d('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x949d('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x949d('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x949d('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x949d('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x949d('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x949d('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x949d('0x3')],'allowNull':![],'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x3128=['sequelize','moment','STRING'];(function(_0x9f59a0,_0x5599a8){var _0xe2ee6=function(_0x5e87b7){while(--_0x5e87b7){_0x9f59a0['push'](_0x9f59a0['shift']());}};_0xe2ee6(++_0x5599a8);}(_0x3128,0x18c));var _0x8312=function(_0x227150,_0x2126af){_0x227150=_0x227150-0x0;var _0x4251e8=_0x3128[_0x227150];return _0x4251e8;};'use strict';var Sequelize=require(_0x8312('0x0'));var moment=require(_0x8312('0x1'));module['exports']={'time':{'type':Sequelize[_0x8312('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x8312('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x8312('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x8312('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x8312('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 9311a93..f06f9e0 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 _0xdfb0=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','model','intersection','query','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','keys','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x15a805,_0x1f0bc5){var _0xf861be=function(_0x3764fa){while(--_0x3764fa){_0x15a805['push'](_0x15a805['shift']());}};_0xf861be(++_0x1f0bc5);}(_0xdfb0,0x167));var _0x0dfb=function(_0x1b9e50,_0x23bb05){_0x1b9e50=_0x1b9e50-0x0;var _0x36ad0f=_0xdfb0[_0x1b9e50];return _0x36ad0f;};'use strict';var emlformat=require(_0x0dfb('0x0'));var rimraf=require(_0x0dfb('0x1'));var zipdir=require(_0x0dfb('0x2'));var jsonpatch=require(_0x0dfb('0x3'));var rp=require('request-promise');var moment=require(_0x0dfb('0x4'));var BPromise=require(_0x0dfb('0x5'));var Mustache=require(_0x0dfb('0x6'));var util=require(_0x0dfb('0x7'));var path=require(_0x0dfb('0x8'));var sox=require('sox');var csv=require(_0x0dfb('0x9'));var ejs=require(_0x0dfb('0xa'));var fs=require('fs');var fs_extra=require(_0x0dfb('0xb'));var _=require(_0x0dfb('0xc'));var squel=require(_0x0dfb('0xd'));var crypto=require(_0x0dfb('0xe'));var jsforce=require(_0x0dfb('0xf'));var deskjs=require(_0x0dfb('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0dfb('0x11'));var Redis=require(_0x0dfb('0x12'));var authService=require(_0x0dfb('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0dfb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0dfb('0x15'))(_0x0dfb('0x16'));var utils=require(_0x0dfb('0x17'));var config=require(_0x0dfb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dfb('0x19'))['db'];function respondWithStatusCode(_0x4cfedf,_0x5541db){_0x5541db=_0x5541db||0xcc;return function(_0x269daf){if(_0x269daf){return _0x4cfedf[_0x0dfb('0x1a')](_0x5541db);}return _0x4cfedf['status'](_0x5541db)[_0x0dfb('0x1b')]();};}function respondWithResult(_0x4f32fd,_0x2429b6){_0x2429b6=_0x2429b6||0xc8;return function(_0x83e432){if(_0x83e432){return _0x4f32fd[_0x0dfb('0x1c')](_0x2429b6)[_0x0dfb('0x1d')](_0x83e432);}};}function respondWithFilteredResult(_0x499c29,_0x5a1714){return function(_0x61ea1){if(_0x61ea1){var _0x544d28=typeof _0x5a1714[_0x0dfb('0x1e')]===_0x0dfb('0x1f')&&typeof _0x5a1714[_0x0dfb('0x20')]===_0x0dfb('0x1f');var _0x5e1d16=_0x61ea1[_0x0dfb('0x21')];var _0x31045c=_0x544d28?0x0:_0x5a1714[_0x0dfb('0x1e')];var _0x420045=_0x544d28?_0x61ea1[_0x0dfb('0x21')]:_0x5a1714['offset']+_0x5a1714[_0x0dfb('0x20')];var _0x547835;if(_0x420045>=_0x5e1d16){_0x420045=_0x5e1d16;_0x547835=0xc8;}else{_0x547835=0xce;}_0x499c29['status'](_0x547835);return _0x499c29['set'](_0x0dfb('0x22'),_0x31045c+'-'+_0x420045+'/'+_0x5e1d16)[_0x0dfb('0x1d')](_0x61ea1);}return null;};}function patchUpdates(_0x203367){return function(_0x165ffe){try{jsonpatch[_0x0dfb('0x23')](_0x165ffe,_0x203367,!![]);}catch(_0x204ae3){return BPromise['reject'](_0x204ae3);}return _0x165ffe[_0x0dfb('0x24')]();};}function saveUpdates(_0x54045,_0x42bf3f){return function(_0x3426c7){if(_0x3426c7){return _0x3426c7[_0x0dfb('0x25')](_0x54045)[_0x0dfb('0x26')](function(_0xe39c5f){return _0xe39c5f;});}return null;};}function removeEntity(_0x51cc29,_0x2e2533){return function(_0x5932a2){if(_0x5932a2){return _0x5932a2[_0x0dfb('0x27')]()[_0x0dfb('0x26')](function(){_0x51cc29['status'](0xcc)[_0x0dfb('0x1b')]();});}};}function handleEntityNotFound(_0x8b5b2f,_0x15606a){return function(_0x10d301){if(!_0x10d301){_0x8b5b2f[_0x0dfb('0x1a')](0x194);}return _0x10d301;};}function handleError(_0x547dd6,_0x500c72){_0x500c72=_0x500c72||0x1f4;return function(_0x158ecd){logger[_0x0dfb('0x28')](_0x158ecd[_0x0dfb('0x29')]);if(_0x158ecd[_0x0dfb('0x2a')]){delete _0x158ecd[_0x0dfb('0x2a')];}_0x547dd6[_0x0dfb('0x1c')](_0x500c72)[_0x0dfb('0x2b')](_0x158ecd);};}exports[_0x0dfb('0x2c')]=function(_0x510d6,_0x11975e){var _0xdf461c={},_0xc6a645={},_0x4b6e4e={'count':0x0,'rows':[]};var _0x571d0d=_[_0x0dfb('0x2d')](db[_0x0dfb('0x2e')][_0x0dfb('0x2f')],function(_0x1cf700){return{'name':_0x1cf700['fieldName'],'type':_0x1cf700[_0x0dfb('0x30')][_0x0dfb('0x31')]};});_0xc6a645[_0x0dfb('0x32')]=_[_0x0dfb('0x2d')](_0x571d0d,_0x0dfb('0x2a'));_0xc6a645['query']=_['keys'](_0x510d6['query']);_0xc6a645['filters']=_[_0x0dfb('0x33')](_0xc6a645['model'],_0xc6a645[_0x0dfb('0x34')]);_0xdf461c[_0x0dfb('0x35')]=_[_0x0dfb('0x33')](_0xc6a645[_0x0dfb('0x32')],qs[_0x0dfb('0x36')](_0x510d6[_0x0dfb('0x34')][_0x0dfb('0x36')]));_0xdf461c[_0x0dfb('0x35')]=_0xdf461c[_0x0dfb('0x35')][_0x0dfb('0x37')]?_0xdf461c[_0x0dfb('0x35')]:_0xc6a645[_0x0dfb('0x32')];if(!_0x510d6[_0x0dfb('0x34')]['hasOwnProperty'](_0x0dfb('0x38'))){_0xdf461c[_0x0dfb('0x20')]=qs[_0x0dfb('0x20')](_0x510d6[_0x0dfb('0x34')][_0x0dfb('0x20')]);_0xdf461c[_0x0dfb('0x1e')]=qs[_0x0dfb('0x1e')](_0x510d6['query'][_0x0dfb('0x1e')]);}_0xdf461c[_0x0dfb('0x39')]=qs[_0x0dfb('0x3a')](_0x510d6[_0x0dfb('0x34')][_0x0dfb('0x3a')]);_0xdf461c[_0x0dfb('0x3b')]=qs[_0x0dfb('0x3c')](_[_0x0dfb('0x3d')](_0x510d6[_0x0dfb('0x34')],_0xc6a645[_0x0dfb('0x3c')]),_0x571d0d);if(_0x510d6[_0x0dfb('0x34')][_0x0dfb('0x3e')]){_0xdf461c[_0x0dfb('0x3b')]=_[_0x0dfb('0x3f')](_0xdf461c[_0x0dfb('0x3b')],{'$or':_[_0x0dfb('0x2d')](_0x571d0d,function(_0x440dd5){if(_0x440dd5[_0x0dfb('0x30')]!==_0x0dfb('0x40')){var _0xa0746={};_0xa0746[_0x440dd5[_0x0dfb('0x2a')]]={'$like':'%'+_0x510d6['query'][_0x0dfb('0x3e')]+'%'};return _0xa0746;}})});}_0xdf461c=_[_0x0dfb('0x3f')]({},_0xdf461c,_0x510d6['options']);var _0x50b2ef={'where':_0xdf461c[_0x0dfb('0x3b')]};return db[_0x0dfb('0x2e')][_0x0dfb('0x21')](_0x50b2ef)[_0x0dfb('0x26')](function(_0x6f4aaf){_0x4b6e4e[_0x0dfb('0x21')]=_0x6f4aaf;if(_0x510d6[_0x0dfb('0x34')][_0x0dfb('0x41')]){_0xdf461c[_0x0dfb('0x42')]=[{'all':!![]}];}return db[_0x0dfb('0x2e')]['findAll'](_0xdf461c);})[_0x0dfb('0x26')](function(_0x345edf){_0x4b6e4e[_0x0dfb('0x43')]=_0x345edf;return _0x4b6e4e;})[_0x0dfb('0x26')](respondWithFilteredResult(_0x11975e,_0xdf461c))[_0x0dfb('0x44')](handleError(_0x11975e,null));};exports[_0x0dfb('0x45')]=function(_0x8bfa14,_0x110b8a){var _0x3707d9={'raw':!![],'where':{'id':_0x8bfa14['params']['id']}},_0x269e4f={};_0x269e4f[_0x0dfb('0x32')]=_[_0x0dfb('0x46')](db[_0x0dfb('0x2e')]['rawAttributes']);_0x269e4f['query']=_[_0x0dfb('0x46')](_0x8bfa14[_0x0dfb('0x34')]);_0x269e4f['filters']=_[_0x0dfb('0x33')](_0x269e4f[_0x0dfb('0x32')],_0x269e4f[_0x0dfb('0x34')]);_0x3707d9[_0x0dfb('0x35')]=_['intersection'](_0x269e4f[_0x0dfb('0x32')],qs[_0x0dfb('0x36')](_0x8bfa14['query'][_0x0dfb('0x36')]));_0x3707d9[_0x0dfb('0x35')]=_0x3707d9['attributes'][_0x0dfb('0x37')]?_0x3707d9[_0x0dfb('0x35')]:_0x269e4f[_0x0dfb('0x32')];if(_0x8bfa14['query'][_0x0dfb('0x41')]){_0x3707d9['include']=[{'all':!![]}];}_0x3707d9=_[_0x0dfb('0x3f')]({},_0x3707d9,_0x8bfa14[_0x0dfb('0x47')]);return db[_0x0dfb('0x2e')][_0x0dfb('0x48')](_0x3707d9)[_0x0dfb('0x26')](handleEntityNotFound(_0x110b8a,null))[_0x0dfb('0x26')](respondWithResult(_0x110b8a,null))[_0x0dfb('0x44')](handleError(_0x110b8a,null));};exports[_0x0dfb('0x49')]=function(_0x2d4a5d,_0x1e187f){return db[_0x0dfb('0x2e')]['create'](_0x2d4a5d[_0x0dfb('0x4a')],{})[_0x0dfb('0x26')](respondWithResult(_0x1e187f,0xc9))[_0x0dfb('0x44')](handleError(_0x1e187f,null));};exports['update']=function(_0x32ccfb,_0x2645d9){if(_0x32ccfb[_0x0dfb('0x4a')]['id']){delete _0x32ccfb[_0x0dfb('0x4a')]['id'];}return db[_0x0dfb('0x2e')][_0x0dfb('0x48')]({'where':{'id':_0x32ccfb[_0x0dfb('0x4b')]['id']}})[_0x0dfb('0x26')](handleEntityNotFound(_0x2645d9,null))[_0x0dfb('0x26')](saveUpdates(_0x32ccfb[_0x0dfb('0x4a')],null))['then'](respondWithResult(_0x2645d9,null))[_0x0dfb('0x44')](handleError(_0x2645d9,null));};exports[_0x0dfb('0x27')]=function(_0x30118c,_0x51f4b0){return db[_0x0dfb('0x2e')][_0x0dfb('0x48')]({'where':{'id':_0x30118c['params']['id']}})[_0x0dfb('0x26')](handleEntityNotFound(_0x51f4b0,null))[_0x0dfb('0x26')](removeEntity(_0x51f4b0,null))[_0x0dfb('0x44')](handleError(_0x51f4b0,null));}; \ No newline at end of file +var _0xcb5b=['body','update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create'];(function(_0x22f91e,_0x4d60ac){var _0x16337b=function(_0x48d11a){while(--_0x48d11a){_0x22f91e['push'](_0x22f91e['shift']());}};_0x16337b(++_0x4d60ac);}(_0xcb5b,0x132));var _0xbcb5=function(_0x406543,_0x331a1e){_0x406543=_0x406543-0x0;var _0x567498=_0xcb5b[_0x406543];return _0x567498;};'use strict';var emlformat=require(_0xbcb5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcb5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbcb5('0x2'));var moment=require(_0xbcb5('0x3'));var BPromise=require(_0xbcb5('0x4'));var Mustache=require(_0xbcb5('0x5'));var util=require(_0xbcb5('0x6'));var path=require(_0xbcb5('0x7'));var sox=require(_0xbcb5('0x8'));var csv=require(_0xbcb5('0x9'));var ejs=require(_0xbcb5('0xa'));var fs=require('fs');var fs_extra=require(_0xbcb5('0xb'));var _=require(_0xbcb5('0xc'));var squel=require(_0xbcb5('0xd'));var crypto=require('crypto');var jsforce=require(_0xbcb5('0xe'));var deskjs=require(_0xbcb5('0xf'));var toCsv=require(_0xbcb5('0x9'));var querystring=require(_0xbcb5('0x10'));var Papa=require('papaparse');var Redis=require(_0xbcb5('0x11'));var authService=require(_0xbcb5('0x12'));var qs=require(_0xbcb5('0x13'));var as=require(_0xbcb5('0x14'));var hardwareService=require(_0xbcb5('0x15'));var logger=require(_0xbcb5('0x16'))(_0xbcb5('0x17'));var utils=require('../../config/utils');var config=require(_0xbcb5('0x18'));var licenseUtil=require(_0xbcb5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x231749,_0x2cf1c8){_0x2cf1c8=_0x2cf1c8||0xcc;return function(_0x55ce68){if(_0x55ce68){return _0x231749[_0xbcb5('0x1a')](_0x2cf1c8);}return _0x231749[_0xbcb5('0x1b')](_0x2cf1c8)['end']();};}function respondWithResult(_0x451aac,_0x4c07a7){_0x4c07a7=_0x4c07a7||0xc8;return function(_0x3e94e0){if(_0x3e94e0){return _0x451aac[_0xbcb5('0x1b')](_0x4c07a7)[_0xbcb5('0x1c')](_0x3e94e0);}};}function respondWithFilteredResult(_0x2e18bf,_0x3745fb){return function(_0x4e9496){if(_0x4e9496){var _0x4d0bf2=typeof _0x3745fb['offset']===_0xbcb5('0x1d')&&typeof _0x3745fb['limit']===_0xbcb5('0x1d');var _0x4310b9=_0x4e9496[_0xbcb5('0x1e')];var _0x3b8578=_0x4d0bf2?0x0:_0x3745fb[_0xbcb5('0x1f')];var _0x104acf=_0x4d0bf2?_0x4e9496[_0xbcb5('0x1e')]:_0x3745fb[_0xbcb5('0x1f')]+_0x3745fb[_0xbcb5('0x20')];var _0x1e0e0b;if(_0x104acf>=_0x4310b9){_0x104acf=_0x4310b9;_0x1e0e0b=0xc8;}else{_0x1e0e0b=0xce;}_0x2e18bf[_0xbcb5('0x1b')](_0x1e0e0b);return _0x2e18bf[_0xbcb5('0x21')](_0xbcb5('0x22'),_0x3b8578+'-'+_0x104acf+'/'+_0x4310b9)['json'](_0x4e9496);}return null;};}function patchUpdates(_0x4fd3bf){return function(_0x3ac60c){try{jsonpatch[_0xbcb5('0x23')](_0x3ac60c,_0x4fd3bf,!![]);}catch(_0x1c94b6){return BPromise[_0xbcb5('0x24')](_0x1c94b6);}return _0x3ac60c[_0xbcb5('0x25')]();};}function saveUpdates(_0x5a1aeb,_0x15750d){return function(_0x4c1fab){if(_0x4c1fab){return _0x4c1fab['update'](_0x5a1aeb)[_0xbcb5('0x26')](function(_0x1d9f3c){return _0x1d9f3c;});}return null;};}function removeEntity(_0xef5032,_0xd61af2){return function(_0x52f4d2){if(_0x52f4d2){return _0x52f4d2['destroy']()[_0xbcb5('0x26')](function(){_0xef5032[_0xbcb5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x407c79,_0xebbb76){return function(_0x1b7475){if(!_0x1b7475){_0x407c79[_0xbcb5('0x1a')](0x194);}return _0x1b7475;};}function handleError(_0x414187,_0x491edf){_0x491edf=_0x491edf||0x1f4;return function(_0x54fbf8){logger[_0xbcb5('0x27')](_0x54fbf8[_0xbcb5('0x28')]);if(_0x54fbf8[_0xbcb5('0x29')]){delete _0x54fbf8[_0xbcb5('0x29')];}_0x414187[_0xbcb5('0x1b')](_0x491edf)[_0xbcb5('0x2a')](_0x54fbf8);};}exports[_0xbcb5('0x2b')]=function(_0x42db27,_0x29371f){var _0x4c0194={},_0x45f210={},_0x583a21={'count':0x0,'rows':[]};var _0x1420db=_[_0xbcb5('0x2c')](db[_0xbcb5('0x2d')]['rawAttributes'],function(_0x22030a){return{'name':_0x22030a[_0xbcb5('0x2e')],'type':_0x22030a['type'][_0xbcb5('0x2f')]};});_0x45f210[_0xbcb5('0x30')]=_[_0xbcb5('0x2c')](_0x1420db,_0xbcb5('0x29'));_0x45f210['query']=_[_0xbcb5('0x31')](_0x42db27['query']);_0x45f210[_0xbcb5('0x32')]=_[_0xbcb5('0x33')](_0x45f210[_0xbcb5('0x30')],_0x45f210[_0xbcb5('0x34')]);_0x4c0194[_0xbcb5('0x35')]=_[_0xbcb5('0x33')](_0x45f210[_0xbcb5('0x30')],qs[_0xbcb5('0x36')](_0x42db27[_0xbcb5('0x34')][_0xbcb5('0x36')]));_0x4c0194[_0xbcb5('0x35')]=_0x4c0194[_0xbcb5('0x35')][_0xbcb5('0x37')]?_0x4c0194[_0xbcb5('0x35')]:_0x45f210[_0xbcb5('0x30')];if(!_0x42db27['query'][_0xbcb5('0x38')]('nolimit')){_0x4c0194[_0xbcb5('0x20')]=qs[_0xbcb5('0x20')](_0x42db27[_0xbcb5('0x34')][_0xbcb5('0x20')]);_0x4c0194[_0xbcb5('0x1f')]=qs['offset'](_0x42db27['query']['offset']);}_0x4c0194[_0xbcb5('0x39')]=qs[_0xbcb5('0x3a')](_0x42db27[_0xbcb5('0x34')][_0xbcb5('0x3a')]);_0x4c0194[_0xbcb5('0x3b')]=qs['filters'](_[_0xbcb5('0x3c')](_0x42db27[_0xbcb5('0x34')],_0x45f210[_0xbcb5('0x32')]),_0x1420db);if(_0x42db27[_0xbcb5('0x34')][_0xbcb5('0x3d')]){_0x4c0194['where']=_[_0xbcb5('0x3e')](_0x4c0194[_0xbcb5('0x3b')],{'$or':_[_0xbcb5('0x2c')](_0x1420db,function(_0x1be25b){if(_0x1be25b[_0xbcb5('0x3f')]!=='VIRTUAL'){var _0x5e7e7b={};_0x5e7e7b[_0x1be25b['name']]={'$like':'%'+_0x42db27[_0xbcb5('0x34')][_0xbcb5('0x3d')]+'%'};return _0x5e7e7b;}})});}_0x4c0194=_['merge']({},_0x4c0194,_0x42db27[_0xbcb5('0x40')]);var _0x2b539f={'where':_0x4c0194[_0xbcb5('0x3b')]};return db[_0xbcb5('0x2d')][_0xbcb5('0x1e')](_0x2b539f)[_0xbcb5('0x26')](function(_0x58c2f2){_0x583a21[_0xbcb5('0x1e')]=_0x58c2f2;if(_0x42db27[_0xbcb5('0x34')]['includeAll']){_0x4c0194[_0xbcb5('0x41')]=[{'all':!![]}];}return db[_0xbcb5('0x2d')][_0xbcb5('0x42')](_0x4c0194);})[_0xbcb5('0x26')](function(_0x3fca44){_0x583a21['rows']=_0x3fca44;return _0x583a21;})[_0xbcb5('0x26')](respondWithFilteredResult(_0x29371f,_0x4c0194))[_0xbcb5('0x43')](handleError(_0x29371f,null));};exports[_0xbcb5('0x44')]=function(_0x210077,_0x358b95){var _0x1b8bd7={'raw':!![],'where':{'id':_0x210077[_0xbcb5('0x45')]['id']}},_0x20e027={};_0x20e027[_0xbcb5('0x30')]=_['keys'](db[_0xbcb5('0x2d')][_0xbcb5('0x46')]);_0x20e027[_0xbcb5('0x34')]=_[_0xbcb5('0x31')](_0x210077['query']);_0x20e027[_0xbcb5('0x32')]=_[_0xbcb5('0x33')](_0x20e027[_0xbcb5('0x30')],_0x20e027[_0xbcb5('0x34')]);_0x1b8bd7[_0xbcb5('0x35')]=_[_0xbcb5('0x33')](_0x20e027[_0xbcb5('0x30')],qs[_0xbcb5('0x36')](_0x210077['query'][_0xbcb5('0x36')]));_0x1b8bd7[_0xbcb5('0x35')]=_0x1b8bd7[_0xbcb5('0x35')][_0xbcb5('0x37')]?_0x1b8bd7[_0xbcb5('0x35')]:_0x20e027[_0xbcb5('0x30')];if(_0x210077[_0xbcb5('0x34')][_0xbcb5('0x47')]){_0x1b8bd7['include']=[{'all':!![]}];}_0x1b8bd7=_[_0xbcb5('0x3e')]({},_0x1b8bd7,_0x210077[_0xbcb5('0x40')]);return db['VoiceQueuesLog'][_0xbcb5('0x48')](_0x1b8bd7)[_0xbcb5('0x26')](handleEntityNotFound(_0x358b95,null))[_0xbcb5('0x26')](respondWithResult(_0x358b95,null))['catch'](handleError(_0x358b95,null));};exports[_0xbcb5('0x49')]=function(_0x2f409c,_0x16eb70){return db[_0xbcb5('0x2d')][_0xbcb5('0x49')](_0x2f409c[_0xbcb5('0x4a')],{})[_0xbcb5('0x26')](respondWithResult(_0x16eb70,0xc9))[_0xbcb5('0x43')](handleError(_0x16eb70,null));};exports[_0xbcb5('0x4b')]=function(_0x3ba9f7,_0x43c6b4){if(_0x3ba9f7[_0xbcb5('0x4a')]['id']){delete _0x3ba9f7[_0xbcb5('0x4a')]['id'];}return db[_0xbcb5('0x2d')][_0xbcb5('0x48')]({'where':{'id':_0x3ba9f7[_0xbcb5('0x45')]['id']}})[_0xbcb5('0x26')](handleEntityNotFound(_0x43c6b4,null))[_0xbcb5('0x26')](saveUpdates(_0x3ba9f7[_0xbcb5('0x4a')],null))['then'](respondWithResult(_0x43c6b4,null))[_0xbcb5('0x43')](handleError(_0x43c6b4,null));};exports['destroy']=function(_0x4e1047,_0x143241){return db[_0xbcb5('0x2d')]['find']({'where':{'id':_0x4e1047[_0xbcb5('0x45')]['id']}})['then'](handleEntityNotFound(_0x143241,null))[_0xbcb5('0x26')](removeEntity(_0x143241,null))[_0xbcb5('0x43')](handleError(_0x143241,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 7dc2b5e..0cd4027 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 _0xe65d=['event','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm'];(function(_0x1ec41f,_0xee9fa4){var _0x477a91=function(_0x501543){while(--_0x501543){_0x1ec41f['push'](_0x1ec41f['shift']());}};_0x477a91(++_0xee9fa4);}(_0xe65d,0x1dd));var _0xde65=function(_0x27d978,_0x36f778){_0x27d978=_0x27d978-0x0;var _0x3aa092=_0xe65d[_0x27d978];return _0x3aa092;};'use strict';var _=require(_0xde65('0x0'));var util=require(_0xde65('0x1'));var logger=require(_0xde65('0x2'))('api');var moment=require(_0xde65('0x3'));var BPromise=require(_0xde65('0x4'));var rp=require(_0xde65('0x5'));var fs=require('fs');var path=require(_0xde65('0x6'));var rimraf=require(_0xde65('0x7'));var config=require('../../config/environment');var attributes=require(_0xde65('0x8'));module[_0xde65('0x9')]=function(_0x178138,_0x22e32b){return _0x178138[_0xde65('0xa')](_0xde65('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xde65('0xc'),'fields':[_0xde65('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x9cbf=['path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x84a844,_0x3bbda1){var _0x3b61ea=function(_0x4fb445){while(--_0x4fb445){_0x84a844['push'](_0x84a844['shift']());}};_0x3b61ea(++_0x3bbda1);}(_0x9cbf,0xad));var _0xf9cb=function(_0x314dce,_0x472ce6){_0x314dce=_0x314dce-0x0;var _0x3e0e27=_0x9cbf[_0x314dce];return _0x3e0e27;};'use strict';var _=require(_0xf9cb('0x0'));var util=require(_0xf9cb('0x1'));var logger=require(_0xf9cb('0x2'))(_0xf9cb('0x3'));var moment=require(_0xf9cb('0x4'));var BPromise=require(_0xf9cb('0x5'));var rp=require(_0xf9cb('0x6'));var fs=require('fs');var path=require(_0xf9cb('0x7'));var rimraf=require(_0xf9cb('0x8'));var config=require(_0xf9cb('0x9'));var attributes=require(_0xf9cb('0xa'));module[_0xf9cb('0xb')]=function(_0x2e0647,_0x5072d8){return _0x2e0647[_0xf9cb('0xc')](_0xf9cb('0xd'),attributes,{'tableName':_0xf9cb('0xe'),'paranoid':![],'indexes':[{'name':_0xf9cb('0xf'),'fields':[_0xf9cb('0x10'),_0xf9cb('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 394d58d..76612da 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 _0x6b40=['stringify','error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x24eb2f,_0x361426){var _0x231c1b=function(_0x49cc7d){while(--_0x49cc7d){_0x24eb2f['push'](_0x24eb2f['shift']());}};_0x231c1b(++_0x361426);}(_0x6b40,0xcb));var _0x06b4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6b40[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x06b4('0x0'));var util=require(_0x06b4('0x1'));var moment=require(_0x06b4('0x2'));var BPromise=require(_0x06b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b4('0x4'));var db=require(_0x06b4('0x5'))['db'];var utils=require(_0x06b4('0x6'));var logger=require(_0x06b4('0x7'))('rpc');var config=require(_0x06b4('0x8'));var jayson=require(_0x06b4('0x9'));var client=jayson[_0x06b4('0xa')][_0x06b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x267d17,_0x26cd84,_0x11b5c9){return new BPromise(function(_0x5083e4,_0xe3a08a){return client[_0x06b4('0xc')](_0x267d17,_0x11b5c9)['then'](function(_0x1e974e){logger['info'](_0x06b4('0xd'),_0x26cd84,'request\x20sent');logger[_0x06b4('0xe')](_0x06b4('0xf'),_0x26cd84,_0x06b4('0x10'),JSON[_0x06b4('0x11')](_0x1e974e));if(_0x1e974e['error']){if(_0x1e974e[_0x06b4('0x12')]['code']===0x1f4){logger[_0x06b4('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x26cd84,_0x1e974e[_0x06b4('0x12')][_0x06b4('0x13')]);return _0xe3a08a(_0x1e974e['error'][_0x06b4('0x13')]);}logger[_0x06b4('0x12')](_0x06b4('0xd'),_0x26cd84,_0x1e974e['error']['message']);return _0x5083e4(_0x1e974e[_0x06b4('0x12')]['message']);}else{logger[_0x06b4('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x26cd84,_0x06b4('0x10'));_0x5083e4(_0x1e974e['result']['message']);}})[_0x06b4('0x15')](function(_0x3290ee){logger[_0x06b4('0x12')](_0x06b4('0xd'),_0x26cd84,_0x3290ee);_0xe3a08a(_0x3290ee);});});} \ No newline at end of file +var _0xa4db=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','bluebird','randomstring'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa4db,0x139));var _0xba4d=function(_0x3253ce,_0x22aff7){_0x3253ce=_0x3253ce-0x0;var _0x3d195c=_0xa4db[_0x3253ce];return _0x3d195c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xba4d('0x0'));var rs=require(_0xba4d('0x1'));var fs=require('fs');var Redis=require(_0xba4d('0x2'));var db=require(_0xba4d('0x3'))['db'];var utils=require(_0xba4d('0x4'));var logger=require(_0xba4d('0x5'))('rpc');var config=require(_0xba4d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xba4d('0x7')][_0xba4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x325531,_0x14b2fd,_0x2c8823){return new BPromise(function(_0xdfc6bf,_0x2171f4){return client[_0xba4d('0x9')](_0x325531,_0x2c8823)[_0xba4d('0xa')](function(_0x4823a9){logger[_0xba4d('0xb')](_0xba4d('0xc'),_0x14b2fd,_0xba4d('0xd'));logger[_0xba4d('0xe')](_0xba4d('0xf'),_0x14b2fd,_0xba4d('0xd'),JSON[_0xba4d('0x10')](_0x4823a9));if(_0x4823a9[_0xba4d('0x11')]){if(_0x4823a9[_0xba4d('0x11')][_0xba4d('0x12')]===0x1f4){logger[_0xba4d('0x11')](_0xba4d('0xc'),_0x14b2fd,_0x4823a9['error']['message']);return _0x2171f4(_0x4823a9['error'][_0xba4d('0x13')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x14b2fd,_0x4823a9[_0xba4d('0x11')][_0xba4d('0x13')]);return _0xdfc6bf(_0x4823a9[_0xba4d('0x11')]['message']);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x14b2fd,_0xba4d('0xd'));_0xdfc6bf(_0x4823a9[_0xba4d('0x14')][_0xba4d('0x13')]);}})['catch'](function(_0x4ef915){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x14b2fd,_0x4ef915);_0x2171f4(_0x4ef915);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 0ab5450..99e6761 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 _0x1b91=['/describe','describe','/:id','isAuthenticated','show','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x136365,_0x206b1d){var _0x2d2152=function(_0x1b9400){while(--_0x1b9400){_0x136365['push'](_0x136365['shift']());}};_0x2d2152(++_0x206b1d);}(_0x1b91,0x14a));var _0x11b9=function(_0x2083b8,_0x464a42){_0x2083b8=_0x2083b8-0x0;var _0x4643ba=_0x1b91[_0x2083b8];return _0x4643ba;};'use strict';var multer=require(_0x11b9('0x0'));var util=require(_0x11b9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x11b9('0x2'));var router=express[_0x11b9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x11b9('0x4'));var config=require(_0x11b9('0x5'));var controller=require('./voiceRecording.controller');router[_0x11b9('0x6')]('/',auth['isAuthenticated'](),controller[_0x11b9('0x7')]);router[_0x11b9('0x6')](_0x11b9('0x8'),auth['isAuthenticated'](),controller[_0x11b9('0x9')]);router[_0x11b9('0x6')](_0x11b9('0xa'),auth[_0x11b9('0xb')](),controller[_0x11b9('0xc')]);router[_0x11b9('0x6')](_0x11b9('0xd'),auth[_0x11b9('0xb')](),controller[_0x11b9('0xe')]);router[_0x11b9('0x6')](_0x11b9('0xf'),controller[_0x11b9('0x10')]);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x11b9('0x11')]);router[_0x11b9('0x12')]('/',auth[_0x11b9('0xb')](),controller[_0x11b9('0x13')]);router[_0x11b9('0x12')](_0x11b9('0x14'),auth[_0x11b9('0xb')](),controller[_0x11b9('0x15')]);router['put'](_0x11b9('0xa'),auth[_0x11b9('0xb')](),controller[_0x11b9('0x16')]);router[_0x11b9('0x17')](_0x11b9('0xa'),auth[_0x11b9('0xb')](),controller[_0x11b9('0x18')]);module[_0x11b9('0x19')]=router; \ No newline at end of file +var _0xe634=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','/:id','delete'];(function(_0x1f0981,_0xcceb3e){var _0x46ee8a=function(_0x269759){while(--_0x269759){_0x1f0981['push'](_0x1f0981['shift']());}};_0x46ee8a(++_0xcceb3e);}(_0xe634,0x1b2));var _0x4e63=function(_0x128721,_0x9792de){_0x128721=_0x128721-0x0;var _0xaf4f28=_0xe634[_0x128721];return _0xaf4f28;};'use strict';var multer=require(_0x4e63('0x0'));var util=require(_0x4e63('0x1'));var path=require(_0x4e63('0x2'));var timeout=require(_0x4e63('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4e63('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4e63('0x5'));var config=require(_0x4e63('0x6'));var controller=require('./voiceRecording.controller');router[_0x4e63('0x7')]('/',auth[_0x4e63('0x8')](),controller[_0x4e63('0x9')]);router[_0x4e63('0x7')](_0x4e63('0xa'),auth[_0x4e63('0x8')](),controller[_0x4e63('0xb')]);router[_0x4e63('0x7')]('/:id',auth[_0x4e63('0x8')](),controller[_0x4e63('0xc')]);router[_0x4e63('0x7')](_0x4e63('0xd'),auth[_0x4e63('0x8')](),controller[_0x4e63('0xe')]);router['get']('/:id/downloads',controller['downloads']);router[_0x4e63('0x7')](_0x4e63('0xf'),auth[_0x4e63('0x8')](),controller[_0x4e63('0x10')]);router[_0x4e63('0x11')]('/',auth[_0x4e63('0x8')](),controller['create']);router[_0x4e63('0x11')](_0x4e63('0xf'),auth[_0x4e63('0x8')](),controller[_0x4e63('0x12')]);router[_0x4e63('0x13')](_0x4e63('0x14'),auth[_0x4e63('0x8')](),controller['update']);router[_0x4e63('0x15')](_0x4e63('0x14'),auth[_0x4e63('0x8')](),controller[_0x4e63('0x16')]);module[_0x4e63('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index d48ec07..02f4158 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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 3424a77..2dbdcc2 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 _0xfc59=['filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','secrets','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','unlinkSync','.cypher','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','end','listBuckets','createBucket','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then','destroy','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','query','keys','intersection','attributes','fields','length','nolimit','sort','where','pick'];(function(_0xa20194,_0x4b1f24){var _0x202cd2=function(_0x509099){while(--_0x509099){_0xa20194['push'](_0xa20194['shift']());}};_0x202cd2(++_0x4b1f24);}(_0xfc59,0x195));var _0x9fc5=function(_0x150762,_0x18475e){_0x150762=_0x150762-0x0;var _0x3f4cb5=_0xfc59[_0x150762];return _0x3f4cb5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9fc5('0x0'));var zipdir=require(_0x9fc5('0x1'));var jsonpatch=require(_0x9fc5('0x2'));var rp=require(_0x9fc5('0x3'));var moment=require(_0x9fc5('0x4'));var BPromise=require(_0x9fc5('0x5'));var Mustache=require(_0x9fc5('0x6'));var util=require(_0x9fc5('0x7'));var path=require(_0x9fc5('0x8'));var sox=require(_0x9fc5('0x9'));var csv=require(_0x9fc5('0xa'));var ejs=require(_0x9fc5('0xb'));var fs=require('fs');var fs_extra=require(_0x9fc5('0xc'));var _=require(_0x9fc5('0xd'));var squel=require(_0x9fc5('0xe'));var crypto=require('crypto');var jsforce=require(_0x9fc5('0xf'));var deskjs=require(_0x9fc5('0x10'));var toCsv=require(_0x9fc5('0xa'));var querystring=require(_0x9fc5('0x11'));var Papa=require(_0x9fc5('0x12'));var AWS=require(_0x9fc5('0x13'));var uuidv4=require(_0x9fc5('0x14'));var Redis=require(_0x9fc5('0x15'));var authService=require(_0x9fc5('0x16'));var qs=require(_0x9fc5('0x17'));var as=require(_0x9fc5('0x18'));var hardwareService=require(_0x9fc5('0x19'));var logger=require(_0x9fc5('0x1a'))(_0x9fc5('0x1b'));var utils=require(_0x9fc5('0x1c'));var config=require('../../config/environment');var licenseUtil=require(_0x9fc5('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a2cda,_0xdcfd5e){_0xdcfd5e=_0xdcfd5e||0xcc;return function(_0x16cec4){if(_0x16cec4){return _0x5a2cda[_0x9fc5('0x1e')](_0xdcfd5e);}return _0x5a2cda[_0x9fc5('0x1f')](_0xdcfd5e)['end']();};}function respondWithResult(_0x1656d9,_0xf5f691){_0xf5f691=_0xf5f691||0xc8;return function(_0x44f806){if(_0x44f806){return _0x1656d9[_0x9fc5('0x1f')](_0xf5f691)['json'](_0x44f806);}};}function respondWithFilteredResult(_0x5992e8,_0x45cbeb){return function(_0x1675c0){if(_0x1675c0){var _0x11c27e=typeof _0x45cbeb[_0x9fc5('0x20')]===_0x9fc5('0x21')&&typeof _0x45cbeb['limit']===_0x9fc5('0x21');var _0x5cf191=_0x1675c0['count'];var _0x36465a=_0x11c27e?0x0:_0x45cbeb['offset'];var _0x10fd90=_0x11c27e?_0x1675c0[_0x9fc5('0x22')]:_0x45cbeb[_0x9fc5('0x20')]+_0x45cbeb[_0x9fc5('0x23')];var _0x333dcf;if(_0x10fd90>=_0x5cf191){_0x10fd90=_0x5cf191;_0x333dcf=0xc8;}else{_0x333dcf=0xce;}_0x5992e8[_0x9fc5('0x1f')](_0x333dcf);return _0x5992e8['set'](_0x9fc5('0x24'),_0x36465a+'-'+_0x10fd90+'/'+_0x5cf191)[_0x9fc5('0x25')](_0x1675c0);}return null;};}function patchUpdates(_0x7dd8f0){return function(_0x168692){try{jsonpatch[_0x9fc5('0x26')](_0x168692,_0x7dd8f0,!![]);}catch(_0x5785aa){return BPromise[_0x9fc5('0x27')](_0x5785aa);}return _0x168692['save']();};}function saveUpdates(_0x2d4815,_0x111a5e){return function(_0x13cab7){if(_0x13cab7){return _0x13cab7[_0x9fc5('0x28')](_0x2d4815)[_0x9fc5('0x29')](function(_0x4dda56){return _0x4dda56;});}return null;};}function removeEntity(_0x318066,_0x45a4b1){return function(_0x147437){if(_0x147437){return _0x147437[_0x9fc5('0x2a')]()[_0x9fc5('0x29')](function(){_0x318066[_0x9fc5('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ab1e3,_0x30dbbd){return function(_0x24195c){if(!_0x24195c){_0x2ab1e3['sendStatus'](0x194);}return _0x24195c;};}function handleError(_0xeed638,_0x1ce6a9){_0x1ce6a9=_0x1ce6a9||0x1f4;return function(_0x4f7c84){logger['error'](_0x4f7c84['stack']);if(_0x4f7c84[_0x9fc5('0x2b')]){delete _0x4f7c84[_0x9fc5('0x2b')];}_0xeed638[_0x9fc5('0x1f')](_0x1ce6a9)[_0x9fc5('0x2c')](_0x4f7c84);};}exports[_0x9fc5('0x2d')]=function(_0x3b9d85,_0x395355){var _0x4f755f={},_0x5f2549={},_0x5455c4={'count':0x0,'rows':[]};var _0x5edc17=_[_0x9fc5('0x2e')](db[_0x9fc5('0x2f')][_0x9fc5('0x30')],function(_0x946166){return{'name':_0x946166[_0x9fc5('0x31')],'type':_0x946166['type'][_0x9fc5('0x32')]};});_0x5f2549[_0x9fc5('0x33')]=_[_0x9fc5('0x34')](_[_0x9fc5('0x2e')](_0x5edc17,_0x9fc5('0x2b')),['format']);_0x5f2549[_0x9fc5('0x35')]=_[_0x9fc5('0x36')](_0x3b9d85[_0x9fc5('0x35')]);_0x5f2549['filters']=_[_0x9fc5('0x37')](_0x5f2549['model'],_0x5f2549[_0x9fc5('0x35')]);_0x4f755f[_0x9fc5('0x38')]=_[_0x9fc5('0x37')](_0x5f2549['model'],qs[_0x9fc5('0x39')](_0x3b9d85['query']['fields']));_0x4f755f[_0x9fc5('0x38')]=_0x4f755f[_0x9fc5('0x38')][_0x9fc5('0x3a')]?_0x4f755f['attributes']:_0x5f2549['model'];if(!_0x3b9d85['query']['hasOwnProperty'](_0x9fc5('0x3b'))){_0x4f755f[_0x9fc5('0x23')]=qs['limit'](_0x3b9d85['query'][_0x9fc5('0x23')]);_0x4f755f[_0x9fc5('0x20')]=qs[_0x9fc5('0x20')](_0x3b9d85[_0x9fc5('0x35')][_0x9fc5('0x20')]);}_0x4f755f['order']=qs[_0x9fc5('0x3c')](_0x3b9d85[_0x9fc5('0x35')]['sort']);_0x4f755f[_0x9fc5('0x3d')]=qs['filters'](_[_0x9fc5('0x3e')](_0x3b9d85['query'],_0x5f2549[_0x9fc5('0x3f')]),_0x5edc17);if(_0x3b9d85['query'][_0x9fc5('0x40')]){_0x4f755f['where']=_[_0x9fc5('0x41')](_0x4f755f[_0x9fc5('0x3d')],{'$or':_['map'](_0x5edc17,function(_0x543ea2){if(_0x543ea2[_0x9fc5('0x42')]!==_0x9fc5('0x43')){var _0x2060d6={};_0x2060d6[_0x543ea2[_0x9fc5('0x2b')]]={'$like':'%'+_0x3b9d85[_0x9fc5('0x35')]['filter']+'%'};return _0x2060d6;}})});}_0x4f755f=_['merge']({},_0x4f755f,_0x3b9d85[_0x9fc5('0x44')]);var _0x12b222={'where':_0x4f755f['where']};return db[_0x9fc5('0x2f')][_0x9fc5('0x22')](_0x12b222)['then'](function(_0x3a32f7){_0x5455c4['count']=_0x3a32f7;if(_0x3b9d85[_0x9fc5('0x35')][_0x9fc5('0x45')]){_0x4f755f[_0x9fc5('0x46')]=[{'all':!![]}];}return db[_0x9fc5('0x2f')][_0x9fc5('0x47')](_0x4f755f);})['then'](function(_0x3da5df){_0x5455c4[_0x9fc5('0x48')]=_0x3da5df;return _0x5455c4;})[_0x9fc5('0x29')](respondWithFilteredResult(_0x395355,_0x4f755f))[_0x9fc5('0x49')](handleError(_0x395355,null));};exports['show']=function(_0x518e15,_0x49ccf1){var _0x29cb79={'raw':![],'where':{'id':_0x518e15[_0x9fc5('0x4a')]['id']}},_0x43dc7a={};_0x43dc7a[_0x9fc5('0x33')]=_[_0x9fc5('0x36')](db['VoiceRecording'][_0x9fc5('0x30')]);_0x43dc7a[_0x9fc5('0x35')]=_[_0x9fc5('0x36')](_0x518e15[_0x9fc5('0x35')]);_0x43dc7a[_0x9fc5('0x3f')]=_[_0x9fc5('0x37')](_0x43dc7a[_0x9fc5('0x33')],_0x43dc7a[_0x9fc5('0x35')]);_0x29cb79[_0x9fc5('0x38')]=_[_0x9fc5('0x37')](_0x43dc7a[_0x9fc5('0x33')],qs[_0x9fc5('0x39')](_0x518e15[_0x9fc5('0x35')][_0x9fc5('0x39')]));_0x29cb79[_0x9fc5('0x38')]=_0x29cb79['attributes'][_0x9fc5('0x3a')]?_0x29cb79[_0x9fc5('0x38')]:_0x43dc7a[_0x9fc5('0x33')];if(_0x518e15[_0x9fc5('0x35')]['includeAll']){_0x29cb79['include']=[{'all':!![]}];}_0x29cb79=_[_0x9fc5('0x41')]({},_0x29cb79,_0x518e15[_0x9fc5('0x44')]);return db[_0x9fc5('0x2f')]['find'](_0x29cb79)[_0x9fc5('0x29')](handleEntityNotFound(_0x49ccf1,null))[_0x9fc5('0x29')](respondWithResult(_0x49ccf1,null))[_0x9fc5('0x49')](handleError(_0x49ccf1,null));};exports['create']=function(_0x5f0ed5,_0x3d84c1){return db['VoiceRecording'][_0x9fc5('0x4b')](_0x5f0ed5[_0x9fc5('0x4c')],{})[_0x9fc5('0x29')](respondWithResult(_0x3d84c1,0xc9))[_0x9fc5('0x49')](handleError(_0x3d84c1,null));};exports[_0x9fc5('0x28')]=function(_0xa81b0e,_0x3b9228){if(_0xa81b0e[_0x9fc5('0x4c')]['id']){delete _0xa81b0e[_0x9fc5('0x4c')]['id'];}return db[_0x9fc5('0x2f')][_0x9fc5('0x4d')]({'where':{'id':_0xa81b0e[_0x9fc5('0x4a')]['id']}})[_0x9fc5('0x29')](handleEntityNotFound(_0x3b9228,null))[_0x9fc5('0x29')](saveUpdates(_0xa81b0e[_0x9fc5('0x4c')],null))[_0x9fc5('0x29')](respondWithResult(_0x3b9228,null))[_0x9fc5('0x49')](handleError(_0x3b9228,null));};exports[_0x9fc5('0x4e')]=function(_0x501a26,_0x40e1d3){return db['VoiceRecording'][_0x9fc5('0x4e')]()[_0x9fc5('0x29')](respondWithResult(_0x40e1d3,null))[_0x9fc5('0x49')](handleError(_0x40e1d3,null));};exports[_0x9fc5('0x4f')]=function(_0x3dbb9d,_0x4e1b11,_0xfc6346){var _0x1d102a=require(_0x9fc5('0x50'));var _0x570f2b=![];var _0x44b568={};if(_0x3dbb9d[_0x9fc5('0x35')]['type']&&_0x3dbb9d[_0x9fc5('0x35')][_0x9fc5('0x42')]===_0x9fc5('0x51')){_0x44b568[_0x9fc5('0x51')]=_0x3dbb9d[_0x9fc5('0x4a')]['id'];}else{_0x44b568['id']=_0x3dbb9d[_0x9fc5('0x4a')]['id'];}return db[_0x9fc5('0x2f')]['find']({'where':_0x44b568,'attributes':['id','value'],'raw':!![]})[_0x9fc5('0x29')](handleEntityNotFound(_0x4e1b11,null))['then'](function(_0x3f9fce){if(_0x3f9fce){var _0x305b90=_0x3f9fce[_0x9fc5('0x52')];var _0x3f4eda=util[_0x9fc5('0x53')](_0x9fc5('0x54'),_0x305b90);if(fs[_0x9fc5('0x55')](_0x3f4eda)){_0x570f2b=!![];return _0x1d102a[_0x9fc5('0x56')](_0x3f4eda,_0x305b90,config['secrets'][_0x9fc5('0x57')])[_0x9fc5('0x29')](function(){return _0x3f9fce;});}return _0x3f9fce;}})[_0x9fc5('0x29')](function(_0x786045){if(_0x786045){var _0x44a182=_0x786045[_0x9fc5('0x52')];if(!fs['existsSync'](_0x44a182)){throw new db[(_0x9fc5('0x58'))][(_0x9fc5('0x59'))](_0x9fc5('0x5a'));}if(_0x786045[_0x9fc5('0x5b')]){return _0x4e1b11[_0x9fc5('0x4f')](_0x44a182,_0x786045[_0x9fc5('0x5b')]+path[_0x9fc5('0x5c')](_0x44a182),function(){if(_0x570f2b){fs[_0x9fc5('0x5d')](_0x44a182);}});}else{return _0x4e1b11[_0x9fc5('0x4f')](_0x44a182,function(_0x1ffcf6){if(_0x570f2b){fs[_0x9fc5('0x5d')](_0x44a182);}});}}})['catch'](function(_0x31221e){if(_0x31221e[_0x9fc5('0x5e')]===_0x9fc5('0x5a')){_0x4e1b11[_0x9fc5('0x1f')](0x194)[_0x9fc5('0x2c')](_0x9fc5('0x5f'));}else{return handleError(_0x4e1b11,null);}});};exports[_0x9fc5('0x60')]=function(_0x56acf,_0x4569bd,_0xb0030){var _0x501ca6=require('../../components/encryptor');var _0x3c2b3a=![];var _0x5143fe={'$and':[db[_0x9fc5('0x61')][_0x9fc5('0x3d')](db[_0x9fc5('0x61')]['fn'](_0x9fc5('0x62'),db[_0x9fc5('0x61')][_0x9fc5('0x63')](_0x9fc5('0x51'))),_0x56acf[_0x9fc5('0x35')][_0x9fc5('0x64')])]};if(_0x56acf[_0x9fc5('0x35')][_0x9fc5('0x42')]&&_0x56acf[_0x9fc5('0x35')][_0x9fc5('0x42')]===_0x9fc5('0x51')){_0x5143fe[_0x9fc5('0x65')]['push']({'uniqueid':_0x56acf[_0x9fc5('0x4a')]['id']});}else{_0x5143fe[_0x9fc5('0x65')][_0x9fc5('0x66')]({'id':_0x56acf[_0x9fc5('0x4a')]['id']});}return db[_0x9fc5('0x2f')][_0x9fc5('0x4d')]({'where':_0x5143fe,'attributes':['id',_0x9fc5('0x52')],'raw':!![]})[_0x9fc5('0x29')](handleEntityNotFound(_0x4569bd,null))[_0x9fc5('0x29')](function(_0x194320){if(_0x194320){var _0x380ad0=util[_0x9fc5('0x53')]('%s.cypher',_0x194320['value']);if(fs['existsSync'](_0x380ad0)){_0x3c2b3a=!![];return _0x501ca6['decryptFile'](_0x380ad0,_0x194320[_0x9fc5('0x52')],config[_0x9fc5('0x67')]['recording'])[_0x9fc5('0x29')](function(){return _0x194320;});}return _0x194320;}})[_0x9fc5('0x29')](function(_0x43cec3){if(_0x43cec3){if(!fs[_0x9fc5('0x55')](_0x43cec3['value'])){throw new db[(_0x9fc5('0x58'))]['ValidationError'](_0x9fc5('0x5a'));}if(_0x43cec3[_0x9fc5('0x5b')]){return _0x4569bd[_0x9fc5('0x4f')](_0x43cec3[_0x9fc5('0x52')],_0x43cec3[_0x9fc5('0x5b')]+path[_0x9fc5('0x5c')](_0x43cec3[_0x9fc5('0x52')]),function(){if(_0x3c2b3a){fs[_0x9fc5('0x5d')](_0x43cec3[_0x9fc5('0x52')]);}});}else{return _0x4569bd[_0x9fc5('0x4f')](_0x43cec3[_0x9fc5('0x52')],function(_0x402df1){if(_0x3c2b3a){fs[_0x9fc5('0x5d')](_0x43cec3[_0x9fc5('0x52')]);}});}}})[_0x9fc5('0x49')](handleError(_0x4569bd,null));};exports[_0x9fc5('0x2a')]=function(_0x232f55,_0x5b8350){return db[_0x9fc5('0x2f')][_0x9fc5('0x4d')]({'where':{'id':_0x232f55[_0x9fc5('0x4a')]['id']}})[_0x9fc5('0x29')](function(_0x1e1186){if(_['isNil'](_0x1e1186)){throw new ReferenceError(_0x9fc5('0x68'));}return _0x1e1186;})[_0x9fc5('0x29')](function(_0x519874){var _0x2db3d1=_0x519874[_0x9fc5('0x52')];logger['info'](_0x9fc5('0x69'),_0x2db3d1);if(!_[_0x9fc5('0x6a')](_0x519874[_0x9fc5('0x52')])&&fs['existsSync'](_0x2db3d1)){logger['info']('File:\x20\x22'+_0x2db3d1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9fc5('0x6b')](_0x2db3d1);}_0x2db3d1=_0x2db3d1+_0x9fc5('0x6c');if(!_[_0x9fc5('0x6a')](_0x519874[_0x9fc5('0x52')])&&fs[_0x9fc5('0x55')](_0x2db3d1)){logger[_0x9fc5('0x6d')]('File:\x20\x22'+_0x2db3d1+_0x9fc5('0x6e'));fs[_0x9fc5('0x6b')](_0x2db3d1);}return _0x519874;})[_0x9fc5('0x29')](function(_0x37783c){if(!_0x37783c)throw new InternalError();return _0x37783c['destroy']();})[_0x9fc5('0x29')](function(){_0x5b8350['status'](0xcc)[_0x9fc5('0x6f')]();})[_0x9fc5('0x49')](handleError(_0x5b8350,null));};function getBucketslist(_0x1657dc,_0x39aba8,_0x58974c){return new Promise(function(_0x5e7bbb,_0x17064d){var _0x220ac8=new AWS['S3']({'accessKeyId':_0x39aba8,'secretAccessKey':_0x1657dc,'region':_0x58974c});_0x220ac8[_0x9fc5('0x70')]({},function(_0x1e25dc,_0x1ad4b9){if(_0x1e25dc){return _0x17064d(_0x1e25dc);}else{return _0x5e7bbb(_0x1ad4b9);}});});}function createBucket(_0x30d855,_0x493d9c,_0xa6a10,_0x28f115){return new Promise(function(_0x3fdfb4,_0x3ea7d1){var _0x4b3eb6=new AWS['S3']({'accessKeyId':_0x493d9c,'secretAccessKey':_0x30d855,'region':_0xa6a10});_0x4b3eb6[_0x9fc5('0x71')]({'Bucket':_0x28f115},function(_0x145af0,_0x41346f){if(_0x145af0){return _0x3ea7d1(_0x145af0);}else{return _0x3fdfb4(_0x41346f);}});});}function uploadFile(_0xa922fc,_0x427641,_0x3db9b7,_0x5e012e,_0x268fb4,_0x3dce29){return new Promise(function(_0x35deeb,_0x11668a){var _0x92b2c2=new AWS['S3']({'accessKeyId':_0x427641,'secretAccessKey':_0xa922fc,'region':_0x3db9b7});_0x92b2c2[_0x9fc5('0x72')]({'Bucket':_0x5e012e,'Key':_0x268fb4,'Body':_0x3dce29},function(_0x66db47,_0x25597b){if(_0x66db47){return _0x11668a(_0x66db47);}else{return _0x35deeb(_0x25597b);}});});}function startTranscribe(_0x22d95b,_0x2ea429,_0x5d17fa,_0x506def,_0x435e4b,_0x24053d){return new Promise(function(_0x44a765,_0x4e8533){var _0x3bd494=new AWS[(_0x9fc5('0x73'))]({'accessKeyId':_0x2ea429,'secretAccessKey':_0x22d95b,'region':_0x5d17fa});_0x3bd494['startTranscriptionJob']({'TranscriptionJobName':_0x506def,'LanguageCode':_0x435e4b,'Media':{'MediaFileUri':_0x24053d}},function(_0x113393,_0x310352){if(_0x113393){return _0x4e8533(_0x113393);}else{return _0x44a765(_0x310352);}});});}function transcribe(_0x4cb234,_0x450e6f,_0x2736e2,_0x41148f,_0x2d0e2f,_0x3b3a88,_0x25e6f9){return new Promise(function(_0x3c6786,_0x33ed70){var _0x349862={};logger[_0x9fc5('0x6d')](util[_0x9fc5('0x53')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4cb234,_0x2d0e2f));return uploadFile(_0x450e6f,_0x2736e2,_0x41148f,_0x2d0e2f,path[_0x9fc5('0x74')](_0x3b3a88),fs[_0x9fc5('0x75')](_0x3b3a88))[_0x9fc5('0x29')](function(_0x5e542e){logger['info'](util[_0x9fc5('0x53')](_0x9fc5('0x76'),_0x4cb234,_0x2d0e2f,_0x5e542e[_0x9fc5('0x77')]));_0x349862[_0x9fc5('0x78')]=_0x5e542e[_0x9fc5('0x79')];_0x349862[_0x9fc5('0x7a')]=_0x5e542e['Location'];logger[_0x9fc5('0x6d')](util[_0x9fc5('0x53')](_0x9fc5('0x7b'),_0x4cb234));return startTranscribe(_0x450e6f,_0x2736e2,_0x41148f,uuidv4(),_0x25e6f9,_0x5e542e[_0x9fc5('0x77')]);})['then'](function(_0x49d413){logger['info'](util[_0x9fc5('0x53')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4cb234,_0x49d413[_0x9fc5('0x7c')]['TranscriptionJobName']));_0x349862['transcribeName']=_0x49d413['TranscriptionJob']['TranscriptionJobName'];_0x349862['transcribeStatus']=_0x49d413[_0x9fc5('0x7c')][_0x9fc5('0x7d')];return _0x3c6786(_0x349862);})['catch'](function(_0x3fb8c4){return _0x33ed70(_0x3fb8c4);});});}exports[_0x9fc5('0x7e')]=function(_0xeb5e0b,_0x454620,_0x7ce4c6){var _0x5cd190;var _0x214bce;var _0x5e57bb;var _0x24544b=require(_0x9fc5('0x50'));return db[_0x9fc5('0x2f')][_0x9fc5('0x7f')]({'where':{'id':_0xeb5e0b[_0x9fc5('0x4a')]['id']}})[_0x9fc5('0x29')](function(_0x4c6cf1){if(_0x4c6cf1){var _0x42cd50=util[_0x9fc5('0x53')](_0x9fc5('0x54'),_0x4c6cf1[_0x9fc5('0x52')]);if(fs['existsSync'](_0x42cd50)){cypher=!![];return _0x24544b[_0x9fc5('0x56')](_0x42cd50,_0x4c6cf1[_0x9fc5('0x52')],config[_0x9fc5('0x67')][_0x9fc5('0x57')])['then'](function(){return _0x4c6cf1;});}return _0x4c6cf1;}})['then'](function(_0x1423bc){if(!_0x1423bc){throw new db[(_0x9fc5('0x58'))][(_0x9fc5('0x59'))]('Voice\x20Recording\x20not\x20found');}_0x214bce=_0x1423bc;return db[_0x9fc5('0x80')][_0x9fc5('0x7f')]({'where':{'id':0x1}});})[_0x9fc5('0x29')](handleEntityNotFound(_0x454620,null))[_0x9fc5('0x29')](function(_0x4d4e54){if(_0x4d4e54){_0x5cd190=_0x4d4e54;if(!_0x5cd190[_0x9fc5('0x81')]||!_0x5cd190[_0x9fc5('0x82')]||!_0x5cd190[_0x9fc5('0x83')]||!_0x5cd190[_0x9fc5('0x84')]||!_0x5cd190[_0x9fc5('0x78')]){throw new db[(_0x9fc5('0x58'))][(_0x9fc5('0x59'))](_0x9fc5('0x85'));}if(_0xeb5e0b[_0x9fc5('0x4c')][_0x9fc5('0x86')]&&(!_0x5cd190['sentiment']||!_0x5cd190[_0x9fc5('0x87')]||!_0x5cd190[_0x9fc5('0x88')]||!_0x5cd190[_0x9fc5('0x84')]||!_0x5cd190[_0x9fc5('0x78')])){throw new db['Sequelize'][(_0x9fc5('0x59'))](_0x9fc5('0x89'));}return db['CloudProvider'][_0x9fc5('0x7f')]({'where':{'id':_0x5cd190[_0x9fc5('0x82')]}});}})[_0x9fc5('0x29')](function(_0x1b2a06){if(!_0x1b2a06){throw new db[(_0x9fc5('0x58'))][(_0x9fc5('0x59'))](_0x9fc5('0x8a'));}if(!_0x1b2a06[_0x9fc5('0x8b')]||!_0x1b2a06[_0x9fc5('0x8c')]){throw new db['Sequelize'][(_0x9fc5('0x59'))](_0x9fc5('0x8d'));}_0x5e57bb=_0x1b2a06;return getBucketslist(_0x5e57bb[_0x9fc5('0x8b')],_0x5e57bb[_0x9fc5('0x8c')],_0x5cd190['transcribeRegion']);})[_0x9fc5('0x29')](function(_0x51ff97){if(_0x51ff97&&_0x51ff97[_0x9fc5('0x8e')]){var _0x179365=_[_0x9fc5('0x4d')](_0x51ff97['Buckets'],function(_0x56f08e){return _0x56f08e[_0x9fc5('0x8f')]===_0x5cd190['bucket'];});if(!_0x179365){logger[_0x9fc5('0x6d')](util['format'](_0x9fc5('0x90'),_0xeb5e0b['params']['id'],_0x5cd190[_0x9fc5('0x78')]));return createBucket(_0x5e57bb[_0x9fc5('0x8b')],_0x5e57bb['data2'],_0x5cd190['transcribeRegion'],_0x5cd190[_0x9fc5('0x78')]);}logger[_0x9fc5('0x6d')](util[_0x9fc5('0x53')](_0x9fc5('0x91'),_0xeb5e0b['params']['id'],_0x5cd190[_0x9fc5('0x78')]));return;}})[_0x9fc5('0x29')](function(_0xdc0237){if(_0x214bce['transcribeStatus']===_0x9fc5('0x92')){return transcribe(_0xeb5e0b[_0x9fc5('0x4a')]['id'],_0x5e57bb[_0x9fc5('0x8b')],_0x5e57bb['data2'],_0x5cd190[_0x9fc5('0x83')],_0x5cd190[_0x9fc5('0x78')],_0x214bce[_0x9fc5('0x52')],_0x5cd190[_0x9fc5('0x84')]);}else{logger[_0x9fc5('0x6d')](util[_0x9fc5('0x53')](_0x9fc5('0x93'),_0xeb5e0b[_0x9fc5('0x4a')]['id']));return{'transcribeStatus':_0x9fc5('0x94')};}})[_0x9fc5('0x29')](function(_0x3a0d4f){if(_0x3a0d4f){_0x3a0d4f[_0x9fc5('0x95')]=_0xeb5e0b[_0x9fc5('0x4c')][_0x9fc5('0x86')];return _0x214bce[_0x9fc5('0x96')](_0x3a0d4f);}})['then'](respondWithResult(_0x454620,null))[_0x9fc5('0x49')](handleError(_0x454620,null));};function writeFile(_0x3f4b84,_0x33c983){return new Promise(function(_0x205231,_0x5bafde){fs[_0x9fc5('0x97')](_0x33c983,_0x3f4b84,function(_0x23389f,_0x2fdad4){if(_0x23389f){return _0x5bafde(_0x23389f);}else{return _0x205231(_0x2fdad4);}});});}exports['downloadTranscribe']=function(_0x409ce5,_0x504e95,_0x1996a7){return db[_0x9fc5('0x2f')][_0x9fc5('0x7f')]({'where':{'id':_0x409ce5[_0x9fc5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x504e95))[_0x9fc5('0x29')](function(_0x3b407d){if(_0x3b407d&&_0x3b407d[_0x9fc5('0x98')]){var _0x4d483c=_0x3b407d[_0x9fc5('0x98')];var _0xd3ac8=config[_0x9fc5('0x99')]+_0x9fc5('0x9a')+_0x3b407d['id']+'.txt';if(fs[_0x9fc5('0x55')](_0xd3ac8)){return _0xd3ac8;}return writeFile(_0x4d483c,_0xd3ac8)[_0x9fc5('0x29')](function(){return _0xd3ac8;});}else{throw new db[(_0x9fc5('0x58'))]['ValidationError'](_0x9fc5('0x9b'));}})['then'](function(_0x69d5f0){return _0x504e95[_0x9fc5('0x4f')](_0x69d5f0);})[_0x9fc5('0x49')](handleError(_0x504e95));}; \ No newline at end of file +var _0x81a4=['secrets','Setting','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Name','bucket','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','writeFile','findOne','fileText','root','/server/files/transcribes/transcribe_','.txt','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','differenceBy','format','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','describe','download','../../components/encryptor','type','uniqueid','find','value','existsSync','decryptFile','recording','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','push','$and','%s.cypher','ValidationError','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe'];(function(_0x20f60f,_0x1548a7){var _0x7e5daa=function(_0x238024){while(--_0x238024){_0x20f60f['push'](_0x20f60f['shift']());}};_0x7e5daa(++_0x1548a7);}(_0x81a4,0x1f2));var _0x481a=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x81a4[_0x138f59];return _0x3d114d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x481a('0x0'));var jsonpatch=require(_0x481a('0x1'));var rp=require(_0x481a('0x2'));var moment=require(_0x481a('0x3'));var BPromise=require(_0x481a('0x4'));var Mustache=require(_0x481a('0x5'));var util=require(_0x481a('0x6'));var path=require(_0x481a('0x7'));var sox=require('sox');var csv=require(_0x481a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x481a('0x9'));var _=require(_0x481a('0xa'));var squel=require(_0x481a('0xb'));var crypto=require(_0x481a('0xc'));var jsforce=require(_0x481a('0xd'));var deskjs=require(_0x481a('0xe'));var toCsv=require(_0x481a('0x8'));var querystring=require(_0x481a('0xf'));var Papa=require(_0x481a('0x10'));var AWS=require(_0x481a('0x11'));var uuidv4=require(_0x481a('0x12'));var Redis=require(_0x481a('0x13'));var authService=require(_0x481a('0x14'));var qs=require(_0x481a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x481a('0x16'));var logger=require('../../config/logger')(_0x481a('0x17'));var utils=require(_0x481a('0x18'));var config=require(_0x481a('0x19'));var licenseUtil=require(_0x481a('0x1a'));var db=require(_0x481a('0x1b'))['db'];function respondWithStatusCode(_0x4e4fbc,_0x30ac1c){_0x30ac1c=_0x30ac1c||0xcc;return function(_0x321b5e){if(_0x321b5e){return _0x4e4fbc[_0x481a('0x1c')](_0x30ac1c);}return _0x4e4fbc[_0x481a('0x1d')](_0x30ac1c)[_0x481a('0x1e')]();};}function respondWithResult(_0x288850,_0x266671){_0x266671=_0x266671||0xc8;return function(_0x3a6bca){if(_0x3a6bca){return _0x288850[_0x481a('0x1d')](_0x266671)['json'](_0x3a6bca);}};}function respondWithFilteredResult(_0x14d36b,_0xff12db){return function(_0x30b28b){if(_0x30b28b){var _0x1391e1=typeof _0xff12db[_0x481a('0x1f')]==='undefined'&&typeof _0xff12db[_0x481a('0x20')]===_0x481a('0x21');var _0xc46252=_0x30b28b[_0x481a('0x22')];var _0x483950=_0x1391e1?0x0:_0xff12db[_0x481a('0x1f')];var _0x2fb0e6=_0x1391e1?_0x30b28b[_0x481a('0x22')]:_0xff12db[_0x481a('0x1f')]+_0xff12db[_0x481a('0x20')];var _0x5bcab9;if(_0x2fb0e6>=_0xc46252){_0x2fb0e6=_0xc46252;_0x5bcab9=0xc8;}else{_0x5bcab9=0xce;}_0x14d36b[_0x481a('0x1d')](_0x5bcab9);return _0x14d36b[_0x481a('0x23')](_0x481a('0x24'),_0x483950+'-'+_0x2fb0e6+'/'+_0xc46252)[_0x481a('0x25')](_0x30b28b);}return null;};}function patchUpdates(_0x64c21c){return function(_0x1a84c6){try{jsonpatch[_0x481a('0x26')](_0x1a84c6,_0x64c21c,!![]);}catch(_0x10f7dc){return BPromise[_0x481a('0x27')](_0x10f7dc);}return _0x1a84c6[_0x481a('0x28')]();};}function saveUpdates(_0x40ea1e,_0x5a0394){return function(_0x3774c6){if(_0x3774c6){return _0x3774c6[_0x481a('0x29')](_0x40ea1e)[_0x481a('0x2a')](function(_0x88b55d){return _0x88b55d;});}return null;};}function removeEntity(_0x3b7a2f,_0xc0e848){return function(_0x2cc31d){if(_0x2cc31d){return _0x2cc31d[_0x481a('0x2b')]()[_0x481a('0x2a')](function(){_0x3b7a2f['status'](0xcc)[_0x481a('0x1e')]();});}};}function handleEntityNotFound(_0x409aa8,_0xad34d3){return function(_0xcd5b61){if(!_0xcd5b61){_0x409aa8[_0x481a('0x1c')](0x194);}return _0xcd5b61;};}function handleError(_0x53fd47,_0xac5bc9){_0xac5bc9=_0xac5bc9||0x1f4;return function(_0x289033){logger[_0x481a('0x2c')](_0x289033[_0x481a('0x2d')]);if(_0x289033[_0x481a('0x2e')]){delete _0x289033[_0x481a('0x2e')];}_0x53fd47['status'](_0xac5bc9)[_0x481a('0x2f')](_0x289033);};}exports[_0x481a('0x30')]=function(_0xe58f2c,_0x55a729){var _0x441901={},_0x55a13a={},_0x35097e={'count':0x0,'rows':[]};var _0x2078f8=_[_0x481a('0x31')](db[_0x481a('0x32')][_0x481a('0x33')],function(_0x3abe6c){return{'name':_0x3abe6c[_0x481a('0x34')],'type':_0x3abe6c['type'][_0x481a('0x35')]};});_0x55a13a['model']=_[_0x481a('0x36')](_[_0x481a('0x31')](_0x2078f8,_0x481a('0x2e')),[_0x481a('0x37')]);_0x55a13a[_0x481a('0x38')]=_['keys'](_0xe58f2c['query']);_0x55a13a[_0x481a('0x39')]=_[_0x481a('0x3a')](_0x55a13a[_0x481a('0x3b')],_0x55a13a[_0x481a('0x38')]);_0x441901[_0x481a('0x3c')]=_[_0x481a('0x3a')](_0x55a13a[_0x481a('0x3b')],qs['fields'](_0xe58f2c[_0x481a('0x38')][_0x481a('0x3d')]));_0x441901[_0x481a('0x3c')]=_0x441901['attributes'][_0x481a('0x3e')]?_0x441901['attributes']:_0x55a13a[_0x481a('0x3b')];if(!_0xe58f2c['query'][_0x481a('0x3f')](_0x481a('0x40'))){_0x441901['limit']=qs[_0x481a('0x20')](_0xe58f2c['query'][_0x481a('0x20')]);_0x441901[_0x481a('0x1f')]=qs[_0x481a('0x1f')](_0xe58f2c[_0x481a('0x38')][_0x481a('0x1f')]);}_0x441901['order']=qs[_0x481a('0x41')](_0xe58f2c[_0x481a('0x38')]['sort']);_0x441901['where']=qs[_0x481a('0x39')](_[_0x481a('0x42')](_0xe58f2c[_0x481a('0x38')],_0x55a13a[_0x481a('0x39')]),_0x2078f8);if(_0xe58f2c[_0x481a('0x38')][_0x481a('0x43')]){_0x441901[_0x481a('0x44')]=_[_0x481a('0x45')](_0x441901[_0x481a('0x44')],{'$or':_[_0x481a('0x31')](_0x2078f8,function(_0x3c5d02){if(_0x3c5d02['type']!==_0x481a('0x46')){var _0x34a61c={};_0x34a61c[_0x3c5d02['name']]={'$like':'%'+_0xe58f2c[_0x481a('0x38')][_0x481a('0x43')]+'%'};return _0x34a61c;}})});}_0x441901=_[_0x481a('0x45')]({},_0x441901,_0xe58f2c[_0x481a('0x47')]);var _0x1a1b53={'where':_0x441901[_0x481a('0x44')]};return db[_0x481a('0x32')]['count'](_0x1a1b53)[_0x481a('0x2a')](function(_0x3b3309){_0x35097e[_0x481a('0x22')]=_0x3b3309;if(_0xe58f2c['query'][_0x481a('0x48')]){_0x441901[_0x481a('0x49')]=[{'all':!![]}];}return db[_0x481a('0x32')][_0x481a('0x4a')](_0x441901);})[_0x481a('0x2a')](function(_0x5ba488){_0x35097e[_0x481a('0x4b')]=_0x5ba488;return _0x35097e;})['then'](respondWithFilteredResult(_0x55a729,_0x441901))[_0x481a('0x4c')](handleError(_0x55a729,null));};exports[_0x481a('0x4d')]=function(_0x246b13,_0x5010b6){var _0x17b87f={'raw':![],'where':{'id':_0x246b13[_0x481a('0x4e')]['id']}},_0x111d43={};_0x111d43['model']=_[_0x481a('0x4f')](db[_0x481a('0x32')][_0x481a('0x33')]);_0x111d43[_0x481a('0x38')]=_[_0x481a('0x4f')](_0x246b13['query']);_0x111d43[_0x481a('0x39')]=_[_0x481a('0x3a')](_0x111d43[_0x481a('0x3b')],_0x111d43[_0x481a('0x38')]);_0x17b87f[_0x481a('0x3c')]=_[_0x481a('0x3a')](_0x111d43['model'],qs[_0x481a('0x3d')](_0x246b13[_0x481a('0x38')][_0x481a('0x3d')]));_0x17b87f[_0x481a('0x3c')]=_0x17b87f[_0x481a('0x3c')][_0x481a('0x3e')]?_0x17b87f['attributes']:_0x111d43['model'];if(_0x246b13[_0x481a('0x38')][_0x481a('0x48')]){_0x17b87f['include']=[{'all':!![]}];}_0x17b87f=_[_0x481a('0x45')]({},_0x17b87f,_0x246b13[_0x481a('0x47')]);return db[_0x481a('0x32')]['find'](_0x17b87f)['then'](handleEntityNotFound(_0x5010b6,null))['then'](respondWithResult(_0x5010b6,null))[_0x481a('0x4c')](handleError(_0x5010b6,null));};exports['create']=function(_0x16aa72,_0x71ec6c){return db['VoiceRecording'][_0x481a('0x50')](_0x16aa72[_0x481a('0x51')],{})['then'](respondWithResult(_0x71ec6c,0xc9))[_0x481a('0x4c')](handleError(_0x71ec6c,null));};exports[_0x481a('0x29')]=function(_0x1d3c6d,_0x46abe9){if(_0x1d3c6d[_0x481a('0x51')]['id']){delete _0x1d3c6d[_0x481a('0x51')]['id'];}return db[_0x481a('0x32')]['find']({'where':{'id':_0x1d3c6d[_0x481a('0x4e')]['id']}})[_0x481a('0x2a')](handleEntityNotFound(_0x46abe9,null))[_0x481a('0x2a')](saveUpdates(_0x1d3c6d[_0x481a('0x51')],null))[_0x481a('0x2a')](respondWithResult(_0x46abe9,null))['catch'](handleError(_0x46abe9,null));};exports['describe']=function(_0x43229e,_0x10f992){return db[_0x481a('0x32')][_0x481a('0x52')]()['then'](respondWithResult(_0x10f992,null))[_0x481a('0x4c')](handleError(_0x10f992,null));};exports[_0x481a('0x53')]=function(_0x571dcb,_0x4bed79,_0x35cef0){var _0x40e61b=require(_0x481a('0x54'));var _0x1920af=![];var _0x3ceefd={};if(_0x571dcb[_0x481a('0x38')][_0x481a('0x55')]&&_0x571dcb[_0x481a('0x38')][_0x481a('0x55')]==='uniqueid'){_0x3ceefd[_0x481a('0x56')]=_0x571dcb[_0x481a('0x4e')]['id'];}else{_0x3ceefd['id']=_0x571dcb[_0x481a('0x4e')]['id'];}return db[_0x481a('0x32')][_0x481a('0x57')]({'where':_0x3ceefd,'attributes':['id',_0x481a('0x58')],'raw':!![]})['then'](handleEntityNotFound(_0x4bed79,null))[_0x481a('0x2a')](function(_0x5f4d8d){if(_0x5f4d8d){var _0x243a64=_0x5f4d8d[_0x481a('0x58')];var _0x289564=util[_0x481a('0x37')]('%s.cypher',_0x243a64);if(fs[_0x481a('0x59')](_0x289564)){_0x1920af=!![];return _0x40e61b[_0x481a('0x5a')](_0x289564,_0x243a64,config['secrets'][_0x481a('0x5b')])[_0x481a('0x2a')](function(){return _0x5f4d8d;});}return _0x5f4d8d;}})[_0x481a('0x2a')](function(_0x5ad70b){if(_0x5ad70b){var _0x1f432e=_0x5ad70b[_0x481a('0x58')];if(!fs[_0x481a('0x59')](_0x1f432e)){throw new db[(_0x481a('0x5c'))]['ValidationError'](_0x481a('0x5d'));}if(_0x5ad70b['filename']){return _0x4bed79[_0x481a('0x53')](_0x1f432e,_0x5ad70b[_0x481a('0x5e')]+path['extname'](_0x1f432e),function(){if(_0x1920af){fs[_0x481a('0x5f')](_0x1f432e);}});}else{return _0x4bed79[_0x481a('0x53')](_0x1f432e,function(_0x595b9c){if(_0x1920af){fs[_0x481a('0x5f')](_0x1f432e);}});}}})[_0x481a('0x4c')](function(_0x573643){if(_0x573643[_0x481a('0x60')]==='VoiceRecording\x20not\x20found'){_0x4bed79[_0x481a('0x1d')](0x194)[_0x481a('0x2f')](_0x481a('0x61'));}else{return handleError(_0x4bed79,null);}});};exports[_0x481a('0x62')]=function(_0x1fd26c,_0x379ad4,_0xf60f91){var _0x277cb8=require(_0x481a('0x54'));var _0x98cbaf=![];var _0x1cbf16={'$and':[db[_0x481a('0x63')]['where'](db[_0x481a('0x63')]['fn'](_0x481a('0x64'),db['sequelize'][_0x481a('0x65')](_0x481a('0x56'))),_0x1fd26c[_0x481a('0x38')][_0x481a('0x66')])]};if(_0x1fd26c[_0x481a('0x38')][_0x481a('0x55')]&&_0x1fd26c[_0x481a('0x38')][_0x481a('0x55')]===_0x481a('0x56')){_0x1cbf16['$and'][_0x481a('0x67')]({'uniqueid':_0x1fd26c[_0x481a('0x4e')]['id']});}else{_0x1cbf16[_0x481a('0x68')][_0x481a('0x67')]({'id':_0x1fd26c[_0x481a('0x4e')]['id']});}return db[_0x481a('0x32')][_0x481a('0x57')]({'where':_0x1cbf16,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x379ad4,null))[_0x481a('0x2a')](function(_0x2d4ef7){if(_0x2d4ef7){var _0x5179b0=util[_0x481a('0x37')](_0x481a('0x69'),_0x2d4ef7[_0x481a('0x58')]);if(fs['existsSync'](_0x5179b0)){_0x98cbaf=!![];return _0x277cb8['decryptFile'](_0x5179b0,_0x2d4ef7[_0x481a('0x58')],config['secrets'][_0x481a('0x5b')])[_0x481a('0x2a')](function(){return _0x2d4ef7;});}return _0x2d4ef7;}})[_0x481a('0x2a')](function(_0x25f0f3){if(_0x25f0f3){if(!fs['existsSync'](_0x25f0f3[_0x481a('0x58')])){throw new db[(_0x481a('0x5c'))][(_0x481a('0x6a'))]('VoiceRecording\x20not\x20found');}if(_0x25f0f3[_0x481a('0x5e')]){return _0x379ad4[_0x481a('0x53')](_0x25f0f3['value'],_0x25f0f3[_0x481a('0x5e')]+path[_0x481a('0x6b')](_0x25f0f3[_0x481a('0x58')]),function(){if(_0x98cbaf){fs[_0x481a('0x5f')](_0x25f0f3[_0x481a('0x58')]);}});}else{return _0x379ad4[_0x481a('0x53')](_0x25f0f3[_0x481a('0x58')],function(_0xa80597){if(_0x98cbaf){fs[_0x481a('0x5f')](_0x25f0f3[_0x481a('0x58')]);}});}}})['catch'](handleError(_0x379ad4,null));};exports[_0x481a('0x2b')]=function(_0x146dfd,_0x41be7f){return db[_0x481a('0x32')][_0x481a('0x57')]({'where':{'id':_0x146dfd[_0x481a('0x4e')]['id']}})[_0x481a('0x2a')](function(_0x31b620){if(_[_0x481a('0x6c')](_0x31b620)){throw new ReferenceError(_0x481a('0x6d'));}return _0x31b620;})[_0x481a('0x2a')](function(_0x5ea8b7){var _0x559b0f=_0x5ea8b7[_0x481a('0x58')];logger[_0x481a('0x6e')](_0x481a('0x6f'),_0x559b0f);if(!_[_0x481a('0x6c')](_0x5ea8b7[_0x481a('0x58')])&&fs[_0x481a('0x59')](_0x559b0f)){logger[_0x481a('0x6e')](_0x481a('0x70')+_0x559b0f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x481a('0x71')](_0x559b0f);}_0x559b0f=_0x559b0f+_0x481a('0x72');if(!_[_0x481a('0x6c')](_0x5ea8b7[_0x481a('0x58')])&&fs[_0x481a('0x59')](_0x559b0f)){logger[_0x481a('0x6e')](_0x481a('0x70')+_0x559b0f+_0x481a('0x73'));fs[_0x481a('0x71')](_0x559b0f);}return _0x5ea8b7;})[_0x481a('0x2a')](function(_0x50e390){if(!_0x50e390)throw new InternalError();return _0x50e390[_0x481a('0x2b')]();})[_0x481a('0x2a')](function(){_0x41be7f[_0x481a('0x1d')](0xcc)[_0x481a('0x1e')]();})['catch'](handleError(_0x41be7f,null));};function getBucketslist(_0x4525f6,_0x45fef5,_0x1a5d69){return new Promise(function(_0x4414c9,_0x7baaae){var _0x2f6e3e=new AWS['S3']({'accessKeyId':_0x45fef5,'secretAccessKey':_0x4525f6,'region':_0x1a5d69});_0x2f6e3e[_0x481a('0x74')]({},function(_0x1c4fd4,_0x121181){if(_0x1c4fd4){return _0x7baaae(_0x1c4fd4);}else{return _0x4414c9(_0x121181);}});});}function createBucket(_0x17ef11,_0x21f2b3,_0x2c65a2,_0x17216e){return new Promise(function(_0xced118,_0x1e8448){var _0xbd7fd4=new AWS['S3']({'accessKeyId':_0x21f2b3,'secretAccessKey':_0x17ef11,'region':_0x2c65a2});_0xbd7fd4['createBucket']({'Bucket':_0x17216e},function(_0xd910b9,_0x323c6a){if(_0xd910b9){return _0x1e8448(_0xd910b9);}else{return _0xced118(_0x323c6a);}});});}function uploadFile(_0x15eb2b,_0x491558,_0x384aa5,_0x27a1e2,_0x472f3f,_0xcf859c){return new Promise(function(_0x410e9a,_0x5a744e){var _0x59ec2f=new AWS['S3']({'accessKeyId':_0x491558,'secretAccessKey':_0x15eb2b,'region':_0x384aa5});_0x59ec2f[_0x481a('0x75')]({'Bucket':_0x27a1e2,'Key':_0x472f3f,'Body':_0xcf859c},function(_0x40cfb6,_0x367973){if(_0x40cfb6){return _0x5a744e(_0x40cfb6);}else{return _0x410e9a(_0x367973);}});});}function startTranscribe(_0x317826,_0x4d239d,_0x229640,_0x30ed2e,_0x24384a,_0x892e0){return new Promise(function(_0x2f7cd8,_0xd72472){var _0x37bdd5=new AWS[(_0x481a('0x76'))]({'accessKeyId':_0x4d239d,'secretAccessKey':_0x317826,'region':_0x229640});_0x37bdd5[_0x481a('0x77')]({'TranscriptionJobName':_0x30ed2e,'LanguageCode':_0x24384a,'Media':{'MediaFileUri':_0x892e0}},function(_0x17a37a,_0x28a12e){if(_0x17a37a){return _0xd72472(_0x17a37a);}else{return _0x2f7cd8(_0x28a12e);}});});}function transcribe(_0x120808,_0x2e08c0,_0x34a059,_0x2104ad,_0x3773a8,_0x375493,_0x471f91){return new Promise(function(_0x202189,_0x5dfcb1){var _0x40a1cc={};logger['info'](util[_0x481a('0x37')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x120808,_0x3773a8));return uploadFile(_0x2e08c0,_0x34a059,_0x2104ad,_0x3773a8,path[_0x481a('0x78')](_0x375493),fs['readFileSync'](_0x375493))[_0x481a('0x2a')](function(_0x18ac04){logger[_0x481a('0x6e')](util[_0x481a('0x37')](_0x481a('0x79'),_0x120808,_0x3773a8,_0x18ac04[_0x481a('0x7a')]));_0x40a1cc['bucket']=_0x18ac04[_0x481a('0x7b')];_0x40a1cc['location']=_0x18ac04['Location'];logger['info'](util[_0x481a('0x37')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x120808));return startTranscribe(_0x2e08c0,_0x34a059,_0x2104ad,uuidv4(),_0x471f91,_0x18ac04[_0x481a('0x7a')]);})[_0x481a('0x2a')](function(_0x5e4bd1){logger[_0x481a('0x6e')](util[_0x481a('0x37')](_0x481a('0x7c'),_0x120808,_0x5e4bd1[_0x481a('0x7d')][_0x481a('0x7e')]));_0x40a1cc[_0x481a('0x7f')]=_0x5e4bd1[_0x481a('0x7d')][_0x481a('0x7e')];_0x40a1cc[_0x481a('0x80')]=_0x5e4bd1[_0x481a('0x7d')]['TranscriptionJobStatus'];return _0x202189(_0x40a1cc);})[_0x481a('0x4c')](function(_0x37105a){return _0x5dfcb1(_0x37105a);});});}exports[_0x481a('0x81')]=function(_0x8b1470,_0x91df60,_0x1aed7f){var _0x491ff8;var _0x37a751;var _0x2c2428;var _0x28da3b=require(_0x481a('0x54'));return db[_0x481a('0x32')]['findOne']({'where':{'id':_0x8b1470['params']['id']}})[_0x481a('0x2a')](function(_0x3b7c46){if(_0x3b7c46){var _0x585c45=util[_0x481a('0x37')]('%s.cypher',_0x3b7c46[_0x481a('0x58')]);if(fs[_0x481a('0x59')](_0x585c45)){cypher=!![];return _0x28da3b[_0x481a('0x5a')](_0x585c45,_0x3b7c46['value'],config[_0x481a('0x82')][_0x481a('0x5b')])['then'](function(){return _0x3b7c46;});}return _0x3b7c46;}})[_0x481a('0x2a')](function(_0x5b0cc5){if(!_0x5b0cc5){throw new db[(_0x481a('0x5c'))][(_0x481a('0x6a'))]('Voice\x20Recording\x20not\x20found');}_0x37a751=_0x5b0cc5;return db[_0x481a('0x83')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x91df60,null))[_0x481a('0x2a')](function(_0x3e3fcc){if(_0x3e3fcc){_0x491ff8=_0x3e3fcc;if(!_0x491ff8['transcribe']||!_0x491ff8['transcribeAccountId']||!_0x491ff8[_0x481a('0x84')]||!_0x491ff8[_0x481a('0x85')]||!_0x491ff8['bucket']){throw new db['Sequelize'][(_0x481a('0x6a'))]('Transcribe\x20not\x20configured');}if(_0x8b1470['body'][_0x481a('0x86')]&&(!_0x491ff8[_0x481a('0x87')]||!_0x491ff8[_0x481a('0x88')]||!_0x491ff8[_0x481a('0x89')]||!_0x491ff8[_0x481a('0x85')]||!_0x491ff8['bucket'])){throw new db[(_0x481a('0x5c'))][(_0x481a('0x6a'))](_0x481a('0x8a'));}return db[_0x481a('0x8b')]['findOne']({'where':{'id':_0x491ff8[_0x481a('0x8c')]}});}})[_0x481a('0x2a')](function(_0x485f4c){if(!_0x485f4c){throw new db[(_0x481a('0x5c'))][(_0x481a('0x6a'))](_0x481a('0x8d'));}if(!_0x485f4c[_0x481a('0x8e')]||!_0x485f4c[_0x481a('0x8f')]){throw new db[(_0x481a('0x5c'))][(_0x481a('0x6a'))](_0x481a('0x90'));}_0x2c2428=_0x485f4c;return getBucketslist(_0x2c2428[_0x481a('0x8e')],_0x2c2428['data2'],_0x491ff8[_0x481a('0x84')]);})[_0x481a('0x2a')](function(_0x44e7b1){if(_0x44e7b1&&_0x44e7b1['Buckets']){var _0x5b496d=_['find'](_0x44e7b1['Buckets'],function(_0x519b38){return _0x519b38[_0x481a('0x91')]===_0x491ff8[_0x481a('0x92')];});if(!_0x5b496d){logger['info'](util[_0x481a('0x37')](_0x481a('0x93'),_0x8b1470[_0x481a('0x4e')]['id'],_0x491ff8[_0x481a('0x92')]));return createBucket(_0x2c2428[_0x481a('0x8e')],_0x2c2428[_0x481a('0x8f')],_0x491ff8[_0x481a('0x84')],_0x491ff8[_0x481a('0x92')]);}logger[_0x481a('0x6e')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x8b1470[_0x481a('0x4e')]['id'],_0x491ff8['bucket']));return;}})[_0x481a('0x2a')](function(_0x185e85){if(_0x37a751[_0x481a('0x80')]===_0x481a('0x94')){return transcribe(_0x8b1470[_0x481a('0x4e')]['id'],_0x2c2428[_0x481a('0x8e')],_0x2c2428[_0x481a('0x8f')],_0x491ff8[_0x481a('0x84')],_0x491ff8[_0x481a('0x92')],_0x37a751[_0x481a('0x58')],_0x491ff8[_0x481a('0x85')]);}else{logger[_0x481a('0x6e')](util[_0x481a('0x37')](_0x481a('0x95'),_0x8b1470[_0x481a('0x4e')]['id']));return{'transcribeStatus':_0x481a('0x96')};}})['then'](function(_0x3b26f8){if(_0x3b26f8){_0x3b26f8['tempSentiment']=_0x8b1470[_0x481a('0x51')][_0x481a('0x86')];return _0x37a751['updateAttributes'](_0x3b26f8);}})['then'](respondWithResult(_0x91df60,null))[_0x481a('0x4c')](handleError(_0x91df60,null));};function writeFile(_0x1a79c4,_0x3efdc8){return new Promise(function(_0x2ec2d2,_0x14612f){fs[_0x481a('0x97')](_0x3efdc8,_0x1a79c4,function(_0x25c476,_0x4c6fb8){if(_0x25c476){return _0x14612f(_0x25c476);}else{return _0x2ec2d2(_0x4c6fb8);}});});}exports['downloadTranscribe']=function(_0x1874ab,_0x4608c0,_0xd3a25){return db['VoiceRecording'][_0x481a('0x98')]({'where':{'id':_0x1874ab[_0x481a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4608c0))[_0x481a('0x2a')](function(_0x5ae028){if(_0x5ae028&&_0x5ae028[_0x481a('0x99')]){var _0x5846f5=_0x5ae028[_0x481a('0x99')];var _0x2d8ce5=config[_0x481a('0x9a')]+_0x481a('0x9b')+_0x5ae028['id']+_0x481a('0x9c');if(fs['existsSync'](_0x2d8ce5)){return _0x2d8ce5;}return writeFile(_0x5846f5,_0x2d8ce5)[_0x481a('0x2a')](function(){return _0x2d8ce5;});}else{throw new db[(_0x481a('0x5c'))][(_0x481a('0x6a'))]('Transcript\x20not\x20available');}})['then'](function(_0x4c4d16){return _0x4608c0[_0x481a('0x53')](_0x4c4d16);})[_0x481a('0x4c')](handleError(_0x4608c0));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 95f642a..affd465 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 _0x0c2b=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings'];(function(_0xaaa123,_0x4c23e3){var _0x44d6d7=function(_0x5c92e4){while(--_0x5c92e4){_0xaaa123['push'](_0xaaa123['shift']());}};_0x44d6d7(++_0x4c23e3);}(_0x0c2b,0x134));var _0xb0c2=function(_0x1fdc8c,_0x9d6526){_0x1fdc8c=_0x1fdc8c-0x0;var _0x2a095d=_0x0c2b[_0x1fdc8c];return _0x2a095d;};'use strict';var attributes=require(_0xb0c2('0x0'));module[_0xb0c2('0x1')]=function(_0x4fbd93,_0x5e4432){return _0x4fbd93[_0xb0c2('0x2')]('VoiceRecording',attributes,{'tableName':_0xb0c2('0x3'),'paranoid':![],'indexes':[{'name':_0xb0c2('0x4'),'fields':[_0xb0c2('0x4')]},{'name':_0xb0c2('0x5'),'fields':[_0xb0c2('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6c6f=['./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x2ceb56,_0x1c9061){var _0x2d1d77=function(_0x6a880f){while(--_0x6a880f){_0x2ceb56['push'](_0x2ceb56['shift']());}};_0x2d1d77(++_0x1c9061);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x3c5ac9,_0x1546e7){_0x3c5ac9=_0x3c5ac9-0x0;var _0x3107eb=_0x6c6f[_0x3c5ac9];return _0x3107eb;};'use strict';var attributes=require(_0xf6c6('0x0'));module[_0xf6c6('0x1')]=function(_0x312daa,_0x1215b6){return _0x312daa[_0xf6c6('0x2')](_0xf6c6('0x3'),attributes,{'tableName':_0xf6c6('0x4'),'paranoid':![],'indexes':[{'name':_0xf6c6('0x5'),'fields':[_0xf6c6('0x5')]},{'name':_0xf6c6('0x6'),'fields':[_0xf6c6('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 7f20d3d..c6b9e97 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 _0xa46e=['then','request\x20sent','debug','stringify','error','code','message','VoiceRecording,\x20%s,\x20%s','info','result','catch','VoiceRecording','update','options','raw','where','attributes','findOne','callRecordingEncryption','create','value','format','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request'];(function(_0x23f8c8,_0xb536b9){var _0x3dc718=function(_0x25d719){while(--_0x25d719){_0x23f8c8['push'](_0x23f8c8['shift']());}};_0x3dc718(++_0xb536b9);}(_0xa46e,0x8a));var _0xea46=function(_0x1196bd,_0xba4aea){_0x1196bd=_0x1196bd-0x0;var _0x26014f=_0xa46e[_0x1196bd];return _0x26014f;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});}exports['UpdateVoiceRecording']=function(_0x19d5c1){var _0x3f463d=this;return new Promise(function(_0x5cf5dd,_0x4b6745){return db[_0xea46('0x15')][_0xea46('0x16')](_0x19d5c1['body'],{'raw':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1['options'][_0xea46('0x19')]||null:null,'attributes':_0x19d5c1['options']?_0x19d5c1['options'][_0xea46('0x1a')]||null:null,'limit':_0x19d5c1['options']?_0x19d5c1['options']['limit']||null:null})[_0xea46('0xa')](function(_0x36f982){logger[_0xea46('0x12')]('UpdateVoiceRecording',_0x19d5c1);logger[_0xea46('0xc')]('UpdateVoiceRecording',_0x19d5c1,JSON[_0xea46('0xd')](_0x36f982));_0x5cf5dd(_0x36f982);})[_0xea46('0x14')](function(_0x528eae){logger[_0xea46('0xe')]('UpdateVoiceRecording',_0x528eae[_0xea46('0x10')],_0x19d5c1);_0x4b6745(_0x3f463d[_0xea46('0xe')](0x1f4,_0x528eae[_0xea46('0x10')]));});});};exports['CreateVoiceRecording']=function(_0x5d2de1){var _0x44e797=this;return new Promise(function(_0x38ac07,_0x4b369c){var _0x3b3928=require('../../components/encryptor');var _0x11129d;return db['Setting'][_0xea46('0x1b')]({'attributes':['id',_0xea46('0x1c')],'where':{'id':0x1},'raw':!![]})[_0xea46('0xa')](function(_0x44517d){_0x11129d=_0x44517d;return db[_0xea46('0x15')][_0xea46('0x1d')](_0x5d2de1['body']);})[_0xea46('0xa')](function(_0x338e96){if(_0x11129d[_0xea46('0x1c')]&&fs['existsSync'](_0x338e96[_0xea46('0x1e')])){var _0x3cdf96=util[_0xea46('0x1f')]('%s.cypher',_0x338e96['value']);return _0x3b3928['encryptFile'](_0x338e96[_0xea46('0x1e')],_0x3cdf96,config[_0xea46('0x20')][_0xea46('0x21')])[_0xea46('0xa')](function(){fs[_0xea46('0x22')](_0x338e96[_0xea46('0x1e')]);logger[_0xea46('0x12')](_0xea46('0x23'));return _0x338e96;});}return _0x338e96;})[_0xea46('0xa')](function(_0x1c7201){logger[_0xea46('0x12')]('CreateVoiceRecording',_0x5d2de1);logger[_0xea46('0xc')](_0xea46('0x24'),_0x5d2de1,JSON[_0xea46('0xd')](_0x1c7201));_0x38ac07(_0x1c7201);})[_0xea46('0x14')](function(_0x1472c0){logger[_0xea46('0xe')](_0xea46('0x24'),_0x1472c0['message'],_0x5d2de1);_0x4b369c(_0x44e797[_0xea46('0xe')](0x1f4,_0x1472c0[_0xea46('0x10')]));});});}; \ No newline at end of file +var _0xa456=['UpdateVoiceRecording','options','attributes','stringify','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','body','existsSync','value','%s.cypher','encryptFile','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0xdc4ef4,_0x48ffd4){var _0x136eeb=function(_0x471d9f){while(--_0x471d9f){_0xdc4ef4['push'](_0xdc4ef4['shift']());}};_0x136eeb(++_0x48ffd4);}(_0xa456,0x142));var _0x6a45=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xa456[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));var BPromise=require(_0x6a45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a45('0x4'));var db=require(_0x6a45('0x5'))['db'];var utils=require(_0x6a45('0x6'));var logger=require('../../config/logger')(_0x6a45('0x7'));var config=require(_0x6a45('0x8'));var jayson=require(_0x6a45('0x9'));var client=jayson[_0x6a45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cf8d,_0x26bfc0,_0x214514){return new BPromise(function(_0x19e67c,_0x3deb09){return client['request'](_0x25cf8d,_0x214514)[_0x6a45('0xb')](function(_0x517040){logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));logger[_0x6a45('0xf')](_0x6a45('0x10'),_0x26bfc0,'request\x20sent',JSON['stringify'](_0x517040));if(_0x517040[_0x6a45('0x11')]){if(_0x517040[_0x6a45('0x11')]['code']===0x1f4){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x26bfc0,_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);return _0x3deb09(_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);}logger[_0x6a45('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x26bfc0,_0x517040['error'][_0x6a45('0x12')]);return _0x19e67c(_0x517040[_0x6a45('0x11')]['message']);}else{logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));_0x19e67c(_0x517040[_0x6a45('0x13')]['message']);}})['catch'](function(_0x49023f){logger[_0x6a45('0x11')](_0x6a45('0xd'),_0x26bfc0,_0x49023f);_0x3deb09(_0x49023f);});});}exports[_0x6a45('0x14')]=function(_0x52a055){var _0x379c22=this;return new Promise(function(_0x102981,_0x3439c8){return db['VoiceRecording']['update'](_0x52a055['body'],{'raw':_0x52a055[_0x6a45('0x15')]?_0x52a055[_0x6a45('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52a055[_0x6a45('0x15')]?_0x52a055[_0x6a45('0x15')]['where']||null:null,'attributes':_0x52a055[_0x6a45('0x15')]?_0x52a055[_0x6a45('0x15')][_0x6a45('0x16')]||null:null,'limit':_0x52a055[_0x6a45('0x15')]?_0x52a055[_0x6a45('0x15')]['limit']||null:null})['then'](function(_0x3faae5){logger[_0x6a45('0xc')](_0x6a45('0x14'),_0x52a055);logger[_0x6a45('0xf')](_0x6a45('0x14'),_0x52a055,JSON[_0x6a45('0x17')](_0x3faae5));_0x102981(_0x3faae5);})[_0x6a45('0x18')](function(_0x4692f5){logger[_0x6a45('0x11')](_0x6a45('0x14'),_0x4692f5[_0x6a45('0x12')],_0x52a055);_0x3439c8(_0x379c22[_0x6a45('0x11')](0x1f4,_0x4692f5['message']));});});};exports[_0x6a45('0x19')]=function(_0x5a0389){var _0x1b83fa=this;return new Promise(function(_0x25467d,_0x28bdf0){var _0x2c7315=require(_0x6a45('0x1a'));var _0x526062;return db[_0x6a45('0x1b')][_0x6a45('0x1c')]({'attributes':['id',_0x6a45('0x1d')],'where':{'id':0x1},'raw':!![]})[_0x6a45('0xb')](function(_0x8265d9){_0x526062=_0x8265d9;return db[_0x6a45('0x1e')][_0x6a45('0x1f')](_0x5a0389[_0x6a45('0x20')]);})['then'](function(_0x14adb5){if(_0x526062[_0x6a45('0x1d')]&&fs[_0x6a45('0x21')](_0x14adb5[_0x6a45('0x22')])){var _0x3b07a1=util['format'](_0x6a45('0x23'),_0x14adb5[_0x6a45('0x22')]);return _0x2c7315[_0x6a45('0x24')](_0x14adb5[_0x6a45('0x22')],_0x3b07a1,config['secrets']['recording'])[_0x6a45('0xb')](function(){fs['unlink'](_0x14adb5[_0x6a45('0x22')]);logger['info'](_0x6a45('0x25'));return _0x14adb5;});}return _0x14adb5;})[_0x6a45('0xb')](function(_0x429900){logger[_0x6a45('0xc')](_0x6a45('0x19'),_0x5a0389);logger[_0x6a45('0xf')](_0x6a45('0x19'),_0x5a0389,JSON[_0x6a45('0x17')](_0x429900));_0x25467d(_0x429900);})[_0x6a45('0x18')](function(_0x36f4a4){logger[_0x6a45('0x11')](_0x6a45('0x19'),_0x36f4a4[_0x6a45('0x12')],_0x5a0389);_0x28bdf0(_0x1b83fa['error'](0x1f4,_0x36f4a4[_0x6a45('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index e794e94..bf4e825 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 _0x0fda=['update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post'];(function(_0x5d4ca7,_0x19113b){var _0x3efc03=function(_0x59675b){while(--_0x59675b){_0x5d4ca7['push'](_0x5d4ca7['shift']());}};_0x3efc03(++_0x19113b);}(_0x0fda,0x153));var _0xa0fd=function(_0x594347,_0x5555ff){_0x594347=_0x594347-0x0;var _0x2ba654=_0x0fda[_0x594347];return _0x2ba654;};'use strict';var multer=require(_0xa0fd('0x0'));var util=require(_0xa0fd('0x1'));var path=require(_0xa0fd('0x2'));var timeout=require(_0xa0fd('0x3'));var express=require('express');var router=express[_0xa0fd('0x4')]();var fs_extra=require(_0xa0fd('0x5'));var auth=require(_0xa0fd('0x6'));var interaction=require(_0xa0fd('0x7'));var config=require(_0xa0fd('0x8'));var controller=require(_0xa0fd('0x9'));router[_0xa0fd('0xa')]('/',auth['isAuthenticated'](),controller[_0xa0fd('0xb')]);router[_0xa0fd('0xa')](_0xa0fd('0xc'),auth['isAuthenticated'](),controller[_0xa0fd('0xd')]);router['get'](_0xa0fd('0xe'),auth[_0xa0fd('0xf')](),controller[_0xa0fd('0x10')]);router[_0xa0fd('0x11')]('/',auth[_0xa0fd('0xf')](),controller['create']);router['put'](_0xa0fd('0xe'),auth['isAuthenticated'](),controller[_0xa0fd('0x12')]);router[_0xa0fd('0x13')](_0xa0fd('0xe'),auth[_0xa0fd('0xf')](),controller['destroy']);module[_0xa0fd('0x14')]=router; \ No newline at end of file +var _0x5520=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5520,0x154));var _0x0552=function(_0x14a187,_0x18d4ac){_0x14a187=_0x14a187-0x0;var _0x4dfbad=_0x5520[_0x14a187];return _0x4dfbad;};'use strict';var multer=require(_0x0552('0x0'));var util=require(_0x0552('0x1'));var path=require(_0x0552('0x2'));var timeout=require(_0x0552('0x3'));var express=require(_0x0552('0x4'));var router=express[_0x0552('0x5')]();var fs_extra=require(_0x0552('0x6'));var auth=require(_0x0552('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0552('0x8'));var controller=require(_0x0552('0x9'));router[_0x0552('0xa')]('/',auth[_0x0552('0xb')](),controller[_0x0552('0xc')]);router[_0x0552('0xa')](_0x0552('0xd'),auth[_0x0552('0xb')](),controller[_0x0552('0xe')]);router[_0x0552('0xa')](_0x0552('0xf'),auth[_0x0552('0xb')](),controller[_0x0552('0x10')]);router[_0x0552('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0552('0x12')](_0x0552('0xf'),auth[_0x0552('0xb')](),controller['update']);router['delete'](_0x0552('0xf'),auth[_0x0552('0xb')](),controller['destroy']);module[_0x0552('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 078b518..96fc711 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 _0xc90c=['ENUM','Yes','sequelize','moment','exports','STRING'];(function(_0x2ee223,_0x4d7078){var _0x421eaf=function(_0x4b8074){while(--_0x4b8074){_0x2ee223['push'](_0x2ee223['shift']());}};_0x421eaf(++_0x4d7078);}(_0xc90c,0xec));var _0xcc90=function(_0x3ac281,_0x2cf959){_0x3ac281=_0x3ac281-0x0;var _0x274faf=_0xc90c[_0x3ac281];return _0x274faf;};'use strict';var Sequelize=require(_0xcc90('0x0'));var moment=require(_0xcc90('0x1'));module[_0xcc90('0x2')]={'type':{'type':Sequelize['ENUM']('blind','attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xcc90('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xcc90('0x3')]},'transferercalleridname':{'type':Sequelize[_0xcc90('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xcc90('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xcc90('0x3')]},'transferercontext':{'type':Sequelize[_0xcc90('0x3')]},'transfererexten':{'type':Sequelize[_0xcc90('0x3')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xcc90('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xcc90('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xcc90('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xcc90('0x3')]},'transfereecontext':{'type':Sequelize[_0xcc90('0x3')]},'transfereeexten':{'type':Sequelize[_0xcc90('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xcc90('0x3')]},'isexternal':{'type':Sequelize[_0xcc90('0x4')](_0xcc90('0x5'),'No')},'context':{'type':Sequelize[_0xcc90('0x3')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x787a=['exports','blind','attended','STRING','ENUM','Yes','sequelize','moment'];(function(_0x54b8ad,_0x150d6b){var _0x5ef480=function(_0x14be10){while(--_0x14be10){_0x54b8ad['push'](_0x54b8ad['shift']());}};_0x5ef480(++_0x150d6b);}(_0x787a,0x136));var _0xa787=function(_0x376300,_0x1471bc){_0x376300=_0x376300-0x0;var _0x1be8fa=_0x787a[_0x376300];return _0x1be8fa;};'use strict';var Sequelize=require(_0xa787('0x0'));var moment=require(_0xa787('0x1'));module[_0xa787('0x2')]={'type':{'type':Sequelize['ENUM'](_0xa787('0x3'),_0xa787('0x4'))},'result':{'type':Sequelize[_0xa787('0x5')]},'transfererchannel':{'type':Sequelize[_0xa787('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xa787('0x5')]},'transferercalleridname':{'type':Sequelize[_0xa787('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xa787('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xa787('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xa787('0x5')]},'transfererexten':{'type':Sequelize[_0xa787('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xa787('0x5')]},'transfereechannel':{'type':Sequelize[_0xa787('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xa787('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xa787('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xa787('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa787('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xa787('0x5')]},'transfereecontext':{'type':Sequelize[_0xa787('0x5')]},'transfereeexten':{'type':Sequelize[_0xa787('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xa787('0x5')]},'isexternal':{'type':Sequelize[_0xa787('0x6')](_0xa787('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa787('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e8c91bc..2f7d7cf 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 _0x03f6=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VoiceTransferReport','includeAll','include','findAll','rows','params','keys','fields','options','find','create','catch','body','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x409480,_0x5ebc62){var _0xb49dee=function(_0x352bf4){while(--_0x352bf4){_0x409480['push'](_0x409480['shift']());}};_0xb49dee(++_0x5ebc62);}(_0x03f6,0x90));var _0x603f=function(_0x4c227b,_0x5b5a0e){_0x4c227b=_0x4c227b-0x0;var _0xdf15ac=_0x03f6[_0x4c227b];return _0xdf15ac;};'use strict';var emlformat=require(_0x603f('0x0'));var rimraf=require(_0x603f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x603f('0x2'));var rp=require(_0x603f('0x3'));var moment=require(_0x603f('0x4'));var BPromise=require(_0x603f('0x5'));var Mustache=require(_0x603f('0x6'));var util=require(_0x603f('0x7'));var path=require('path');var sox=require(_0x603f('0x8'));var csv=require(_0x603f('0x9'));var ejs=require(_0x603f('0xa'));var fs=require('fs');var fs_extra=require(_0x603f('0xb'));var _=require(_0x603f('0xc'));var squel=require(_0x603f('0xd'));var crypto=require(_0x603f('0xe'));var jsforce=require(_0x603f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x603f('0x10'));var Papa=require(_0x603f('0x11'));var Redis=require(_0x603f('0x12'));var authService=require(_0x603f('0x13'));var qs=require(_0x603f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x603f('0x15'));var logger=require(_0x603f('0x16'))('api');var utils=require(_0x603f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x603f('0x18'))['db'];function respondWithStatusCode(_0x33b5b4,_0x47ea0e){_0x47ea0e=_0x47ea0e||0xcc;return function(_0x27d865){if(_0x27d865){return _0x33b5b4[_0x603f('0x19')](_0x47ea0e);}return _0x33b5b4[_0x603f('0x1a')](_0x47ea0e)[_0x603f('0x1b')]();};}function respondWithResult(_0xffae5d,_0x505fac){_0x505fac=_0x505fac||0xc8;return function(_0x25c80f){if(_0x25c80f){return _0xffae5d[_0x603f('0x1a')](_0x505fac)[_0x603f('0x1c')](_0x25c80f);}};}function respondWithFilteredResult(_0x2e0318,_0xab4f17){return function(_0x5b24a7){if(_0x5b24a7){var _0x531ac6=typeof _0xab4f17[_0x603f('0x1d')]===_0x603f('0x1e')&&typeof _0xab4f17[_0x603f('0x1f')]==='undefined';var _0x58539c=_0x5b24a7[_0x603f('0x20')];var _0xf7b0f7=_0x531ac6?0x0:_0xab4f17[_0x603f('0x1d')];var _0x1170a8=_0x531ac6?_0x5b24a7[_0x603f('0x20')]:_0xab4f17[_0x603f('0x1d')]+_0xab4f17[_0x603f('0x1f')];var _0x108d12;if(_0x1170a8>=_0x58539c){_0x1170a8=_0x58539c;_0x108d12=0xc8;}else{_0x108d12=0xce;}_0x2e0318[_0x603f('0x1a')](_0x108d12);return _0x2e0318[_0x603f('0x21')]('Content-Range',_0xf7b0f7+'-'+_0x1170a8+'/'+_0x58539c)['json'](_0x5b24a7);}return null;};}function patchUpdates(_0x158bb9){return function(_0x574989){try{jsonpatch['apply'](_0x574989,_0x158bb9,!![]);}catch(_0x426cd8){return BPromise[_0x603f('0x22')](_0x426cd8);}return _0x574989[_0x603f('0x23')]();};}function saveUpdates(_0x243223,_0x2f5893){return function(_0x2083aa){if(_0x2083aa){return _0x2083aa[_0x603f('0x24')](_0x243223)[_0x603f('0x25')](function(_0x307846){return _0x307846;});}return null;};}function removeEntity(_0x5d2d3b,_0x282cc4){return function(_0x4b4ced){if(_0x4b4ced){return _0x4b4ced[_0x603f('0x26')]()[_0x603f('0x25')](function(){_0x5d2d3b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44bde9,_0x15e905){return function(_0x47815b){if(!_0x47815b){_0x44bde9[_0x603f('0x19')](0x194);}return _0x47815b;};}function handleError(_0x406344,_0x8e6b31){_0x8e6b31=_0x8e6b31||0x1f4;return function(_0x335715){logger['error'](_0x335715[_0x603f('0x27')]);if(_0x335715['name']){delete _0x335715[_0x603f('0x28')];}_0x406344['status'](_0x8e6b31)['send'](_0x335715);};}exports[_0x603f('0x29')]=function(_0x252ab3,_0x244b78){var _0x27d6ef={},_0x1fed4a={},_0x5d6d45={'count':0x0,'rows':[]};var _0x3f3171=_['map'](db['VoiceTransferReport'][_0x603f('0x2a')],function(_0x10fc7b){return{'name':_0x10fc7b[_0x603f('0x2b')],'type':_0x10fc7b[_0x603f('0x2c')][_0x603f('0x2d')]};});_0x1fed4a[_0x603f('0x2e')]=_['map'](_0x3f3171,_0x603f('0x28'));_0x1fed4a[_0x603f('0x2f')]=_['keys'](_0x252ab3[_0x603f('0x2f')]);_0x1fed4a[_0x603f('0x30')]=_[_0x603f('0x31')](_0x1fed4a[_0x603f('0x2e')],_0x1fed4a[_0x603f('0x2f')]);_0x27d6ef[_0x603f('0x32')]=_[_0x603f('0x31')](_0x1fed4a[_0x603f('0x2e')],qs['fields'](_0x252ab3[_0x603f('0x2f')]['fields']));_0x27d6ef[_0x603f('0x32')]=_0x27d6ef[_0x603f('0x32')][_0x603f('0x33')]?_0x27d6ef['attributes']:_0x1fed4a[_0x603f('0x2e')];if(!_0x252ab3[_0x603f('0x2f')][_0x603f('0x34')](_0x603f('0x35'))){_0x27d6ef['limit']=qs['limit'](_0x252ab3[_0x603f('0x2f')][_0x603f('0x1f')]);_0x27d6ef[_0x603f('0x1d')]=qs['offset'](_0x252ab3[_0x603f('0x2f')][_0x603f('0x1d')]);}_0x27d6ef[_0x603f('0x36')]=qs[_0x603f('0x37')](_0x252ab3[_0x603f('0x2f')][_0x603f('0x37')]);_0x27d6ef[_0x603f('0x38')]=qs[_0x603f('0x30')](_['pick'](_0x252ab3[_0x603f('0x2f')],_0x1fed4a[_0x603f('0x30')]),_0x3f3171);if(_0x252ab3[_0x603f('0x2f')][_0x603f('0x39')]){_0x27d6ef[_0x603f('0x38')]=_[_0x603f('0x3a')](_0x27d6ef['where'],{'$or':_[_0x603f('0x3b')](_0x3f3171,function(_0x245ac8){if(_0x245ac8[_0x603f('0x2c')]!=='VIRTUAL'){var _0x271a3a={};_0x271a3a[_0x245ac8[_0x603f('0x28')]]={'$like':'%'+_0x252ab3[_0x603f('0x2f')][_0x603f('0x39')]+'%'};return _0x271a3a;}})});}_0x27d6ef=_[_0x603f('0x3a')]({},_0x27d6ef,_0x252ab3['options']);var _0xa7503={'where':_0x27d6ef['where']};return db[_0x603f('0x3c')][_0x603f('0x20')](_0xa7503)[_0x603f('0x25')](function(_0x52864e){_0x5d6d45[_0x603f('0x20')]=_0x52864e;if(_0x252ab3[_0x603f('0x2f')][_0x603f('0x3d')]){_0x27d6ef[_0x603f('0x3e')]=[{'all':!![]}];}return db[_0x603f('0x3c')][_0x603f('0x3f')](_0x27d6ef);})[_0x603f('0x25')](function(_0x306f5e){_0x5d6d45[_0x603f('0x40')]=_0x306f5e;return _0x5d6d45;})[_0x603f('0x25')](respondWithFilteredResult(_0x244b78,_0x27d6ef))['catch'](handleError(_0x244b78,null));};exports['show']=function(_0x26cd1d,_0x23180f){var _0x57ed28={'raw':!![],'where':{'id':_0x26cd1d[_0x603f('0x41')]['id']}},_0x15af18={};_0x15af18[_0x603f('0x2e')]=_[_0x603f('0x42')](db[_0x603f('0x3c')]['rawAttributes']);_0x15af18['query']=_[_0x603f('0x42')](_0x26cd1d[_0x603f('0x2f')]);_0x15af18['filters']=_[_0x603f('0x31')](_0x15af18[_0x603f('0x2e')],_0x15af18['query']);_0x57ed28['attributes']=_[_0x603f('0x31')](_0x15af18[_0x603f('0x2e')],qs[_0x603f('0x43')](_0x26cd1d[_0x603f('0x2f')][_0x603f('0x43')]));_0x57ed28[_0x603f('0x32')]=_0x57ed28[_0x603f('0x32')][_0x603f('0x33')]?_0x57ed28[_0x603f('0x32')]:_0x15af18['model'];if(_0x26cd1d['query'][_0x603f('0x3d')]){_0x57ed28[_0x603f('0x3e')]=[{'all':!![]}];}_0x57ed28=_['merge']({},_0x57ed28,_0x26cd1d[_0x603f('0x44')]);return db[_0x603f('0x3c')][_0x603f('0x45')](_0x57ed28)['then'](handleEntityNotFound(_0x23180f,null))[_0x603f('0x25')](respondWithResult(_0x23180f,null))['catch'](handleError(_0x23180f,null));};exports[_0x603f('0x46')]=function(_0xebe2e8,_0x43a97e){return db[_0x603f('0x3c')][_0x603f('0x46')](_0xebe2e8['body'],{})[_0x603f('0x25')](respondWithResult(_0x43a97e,0xc9))[_0x603f('0x47')](handleError(_0x43a97e,null));};exports[_0x603f('0x24')]=function(_0xb1b385,_0x170a61){if(_0xb1b385[_0x603f('0x48')]['id']){delete _0xb1b385[_0x603f('0x48')]['id'];}return db[_0x603f('0x3c')][_0x603f('0x45')]({'where':{'id':_0xb1b385[_0x603f('0x41')]['id']}})[_0x603f('0x25')](handleEntityNotFound(_0x170a61,null))[_0x603f('0x25')](saveUpdates(_0xb1b385[_0x603f('0x48')],null))[_0x603f('0x25')](respondWithResult(_0x170a61,null))['catch'](handleError(_0x170a61,null));};exports['destroy']=function(_0x59ad25,_0x23bc6a){return db[_0x603f('0x3c')][_0x603f('0x45')]({'where':{'id':_0x59ad25[_0x603f('0x41')]['id']}})[_0x603f('0x25')](handleEntityNotFound(_0x23bc6a,null))[_0x603f('0x25')](removeEntity(_0x23bc6a,null))[_0x603f('0x47')](handleError(_0x23bc6a,null));};exports[_0x603f('0x49')]=function(_0x3a7c81,_0x4d1a7b){return db[_0x603f('0x3c')][_0x603f('0x49')]()[_0x603f('0x25')](respondWithResult(_0x4d1a7b,null))[_0x603f('0x47')](handleError(_0x4d1a7b,null));}; \ No newline at end of file +var _0x712b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','update','body','find','describe','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'];(function(_0x13306e,_0x11eb05){var _0x1f37d6=function(_0x564807){while(--_0x564807){_0x13306e['push'](_0x13306e['shift']());}};_0x1f37d6(++_0x11eb05);}(_0x712b,0x12d));var _0xb712=function(_0x574ffc,_0x44572f){_0x574ffc=_0x574ffc-0x0;var _0x4e3de8=_0x712b[_0x574ffc];return _0x4e3de8;};'use strict';var emlformat=require(_0xb712('0x0'));var rimraf=require(_0xb712('0x1'));var zipdir=require(_0xb712('0x2'));var jsonpatch=require(_0xb712('0x3'));var rp=require(_0xb712('0x4'));var moment=require(_0xb712('0x5'));var BPromise=require(_0xb712('0x6'));var Mustache=require(_0xb712('0x7'));var util=require('util');var path=require(_0xb712('0x8'));var sox=require(_0xb712('0x9'));var csv=require(_0xb712('0xa'));var ejs=require(_0xb712('0xb'));var fs=require('fs');var fs_extra=require(_0xb712('0xc'));var _=require(_0xb712('0xd'));var squel=require(_0xb712('0xe'));var crypto=require(_0xb712('0xf'));var jsforce=require(_0xb712('0x10'));var deskjs=require(_0xb712('0x11'));var toCsv=require('to-csv');var querystring=require(_0xb712('0x12'));var Papa=require(_0xb712('0x13'));var Redis=require(_0xb712('0x14'));var authService=require(_0xb712('0x15'));var qs=require(_0xb712('0x16'));var as=require(_0xb712('0x17'));var hardwareService=require(_0xb712('0x18'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb712('0x19'));var db=require(_0xb712('0x1a'))['db'];function respondWithStatusCode(_0x5a76c9,_0x55a372){_0x55a372=_0x55a372||0xcc;return function(_0xba593f){if(_0xba593f){return _0x5a76c9[_0xb712('0x1b')](_0x55a372);}return _0x5a76c9[_0xb712('0x1c')](_0x55a372)['end']();};}function respondWithResult(_0x2ddf4b,_0x27548b){_0x27548b=_0x27548b||0xc8;return function(_0x2b2d5e){if(_0x2b2d5e){return _0x2ddf4b[_0xb712('0x1c')](_0x27548b)[_0xb712('0x1d')](_0x2b2d5e);}};}function respondWithFilteredResult(_0x16822d,_0x2ac052){return function(_0x2544b3){if(_0x2544b3){var _0x8b8897=typeof _0x2ac052[_0xb712('0x1e')]===_0xb712('0x1f')&&typeof _0x2ac052['limit']==='undefined';var _0x3dfe81=_0x2544b3['count'];var _0x1eb8b6=_0x8b8897?0x0:_0x2ac052[_0xb712('0x1e')];var _0x50840b=_0x8b8897?_0x2544b3[_0xb712('0x20')]:_0x2ac052[_0xb712('0x1e')]+_0x2ac052[_0xb712('0x21')];var _0x177948;if(_0x50840b>=_0x3dfe81){_0x50840b=_0x3dfe81;_0x177948=0xc8;}else{_0x177948=0xce;}_0x16822d[_0xb712('0x1c')](_0x177948);return _0x16822d[_0xb712('0x22')](_0xb712('0x23'),_0x1eb8b6+'-'+_0x50840b+'/'+_0x3dfe81)[_0xb712('0x1d')](_0x2544b3);}return null;};}function patchUpdates(_0x4a14cd){return function(_0x2821f7){try{jsonpatch[_0xb712('0x24')](_0x2821f7,_0x4a14cd,!![]);}catch(_0x1637ef){return BPromise[_0xb712('0x25')](_0x1637ef);}return _0x2821f7[_0xb712('0x26')]();};}function saveUpdates(_0x4e7646,_0x268307){return function(_0x363c5d){if(_0x363c5d){return _0x363c5d['update'](_0x4e7646)[_0xb712('0x27')](function(_0x1749f8){return _0x1749f8;});}return null;};}function removeEntity(_0x238afa,_0x57706d){return function(_0x55f29c){if(_0x55f29c){return _0x55f29c[_0xb712('0x28')]()[_0xb712('0x27')](function(){_0x238afa[_0xb712('0x1c')](0xcc)[_0xb712('0x29')]();});}};}function handleEntityNotFound(_0x872d4f,_0x31cc3f){return function(_0x34fa9f){if(!_0x34fa9f){_0x872d4f[_0xb712('0x1b')](0x194);}return _0x34fa9f;};}function handleError(_0x1b0989,_0x3b41a7){_0x3b41a7=_0x3b41a7||0x1f4;return function(_0x1335ae){logger[_0xb712('0x2a')](_0x1335ae['stack']);if(_0x1335ae[_0xb712('0x2b')]){delete _0x1335ae[_0xb712('0x2b')];}_0x1b0989[_0xb712('0x1c')](_0x3b41a7)[_0xb712('0x2c')](_0x1335ae);};}exports[_0xb712('0x2d')]=function(_0x42305c,_0x1021f9){var _0x33793a={},_0x6eb33d={},_0x38e3c1={'count':0x0,'rows':[]};var _0x358c61=_[_0xb712('0x2e')](db[_0xb712('0x2f')]['rawAttributes'],function(_0x5c628a){return{'name':_0x5c628a[_0xb712('0x30')],'type':_0x5c628a[_0xb712('0x31')][_0xb712('0x32')]};});_0x6eb33d[_0xb712('0x33')]=_[_0xb712('0x2e')](_0x358c61,_0xb712('0x2b'));_0x6eb33d[_0xb712('0x34')]=_[_0xb712('0x35')](_0x42305c[_0xb712('0x34')]);_0x6eb33d[_0xb712('0x36')]=_[_0xb712('0x37')](_0x6eb33d[_0xb712('0x33')],_0x6eb33d[_0xb712('0x34')]);_0x33793a[_0xb712('0x38')]=_[_0xb712('0x37')](_0x6eb33d[_0xb712('0x33')],qs['fields'](_0x42305c[_0xb712('0x34')][_0xb712('0x39')]));_0x33793a[_0xb712('0x38')]=_0x33793a[_0xb712('0x38')][_0xb712('0x3a')]?_0x33793a[_0xb712('0x38')]:_0x6eb33d['model'];if(!_0x42305c['query']['hasOwnProperty']('nolimit')){_0x33793a[_0xb712('0x21')]=qs['limit'](_0x42305c['query'][_0xb712('0x21')]);_0x33793a[_0xb712('0x1e')]=qs[_0xb712('0x1e')](_0x42305c[_0xb712('0x34')][_0xb712('0x1e')]);}_0x33793a[_0xb712('0x3b')]=qs[_0xb712('0x3c')](_0x42305c['query']['sort']);_0x33793a['where']=qs[_0xb712('0x36')](_[_0xb712('0x3d')](_0x42305c[_0xb712('0x34')],_0x6eb33d[_0xb712('0x36')]),_0x358c61);if(_0x42305c[_0xb712('0x34')][_0xb712('0x3e')]){_0x33793a[_0xb712('0x3f')]=_[_0xb712('0x40')](_0x33793a['where'],{'$or':_[_0xb712('0x2e')](_0x358c61,function(_0x313882){if(_0x313882[_0xb712('0x31')]!==_0xb712('0x41')){var _0x12c6db={};_0x12c6db[_0x313882[_0xb712('0x2b')]]={'$like':'%'+_0x42305c[_0xb712('0x34')][_0xb712('0x3e')]+'%'};return _0x12c6db;}})});}_0x33793a=_['merge']({},_0x33793a,_0x42305c[_0xb712('0x42')]);var _0x36d89e={'where':_0x33793a[_0xb712('0x3f')]};return db[_0xb712('0x2f')]['count'](_0x36d89e)['then'](function(_0x1d3b59){_0x38e3c1[_0xb712('0x20')]=_0x1d3b59;if(_0x42305c['query'][_0xb712('0x43')]){_0x33793a[_0xb712('0x44')]=[{'all':!![]}];}return db[_0xb712('0x2f')][_0xb712('0x45')](_0x33793a);})[_0xb712('0x27')](function(_0xb0fc88){_0x38e3c1[_0xb712('0x46')]=_0xb0fc88;return _0x38e3c1;})['then'](respondWithFilteredResult(_0x1021f9,_0x33793a))['catch'](handleError(_0x1021f9,null));};exports[_0xb712('0x47')]=function(_0x506f59,_0x4cca8a){var _0x4a5495={'raw':!![],'where':{'id':_0x506f59[_0xb712('0x48')]['id']}},_0x3352b0={};_0x3352b0[_0xb712('0x33')]=_[_0xb712('0x35')](db[_0xb712('0x2f')][_0xb712('0x49')]);_0x3352b0[_0xb712('0x34')]=_[_0xb712('0x35')](_0x506f59['query']);_0x3352b0[_0xb712('0x36')]=_['intersection'](_0x3352b0[_0xb712('0x33')],_0x3352b0[_0xb712('0x34')]);_0x4a5495[_0xb712('0x38')]=_[_0xb712('0x37')](_0x3352b0[_0xb712('0x33')],qs[_0xb712('0x39')](_0x506f59[_0xb712('0x34')][_0xb712('0x39')]));_0x4a5495['attributes']=_0x4a5495[_0xb712('0x38')][_0xb712('0x3a')]?_0x4a5495['attributes']:_0x3352b0[_0xb712('0x33')];if(_0x506f59['query'][_0xb712('0x43')]){_0x4a5495[_0xb712('0x44')]=[{'all':!![]}];}_0x4a5495=_[_0xb712('0x40')]({},_0x4a5495,_0x506f59['options']);return db['VoiceTransferReport']['find'](_0x4a5495)[_0xb712('0x27')](handleEntityNotFound(_0x4cca8a,null))[_0xb712('0x27')](respondWithResult(_0x4cca8a,null))[_0xb712('0x4a')](handleError(_0x4cca8a,null));};exports[_0xb712('0x4b')]=function(_0x29e9ce,_0x43983a){return db[_0xb712('0x2f')][_0xb712('0x4b')](_0x29e9ce['body'],{})[_0xb712('0x27')](respondWithResult(_0x43983a,0xc9))[_0xb712('0x4a')](handleError(_0x43983a,null));};exports[_0xb712('0x4c')]=function(_0x2cf40f,_0x54f576){if(_0x2cf40f[_0xb712('0x4d')]['id']){delete _0x2cf40f[_0xb712('0x4d')]['id'];}return db[_0xb712('0x2f')][_0xb712('0x4e')]({'where':{'id':_0x2cf40f[_0xb712('0x48')]['id']}})[_0xb712('0x27')](handleEntityNotFound(_0x54f576,null))[_0xb712('0x27')](saveUpdates(_0x2cf40f[_0xb712('0x4d')],null))[_0xb712('0x27')](respondWithResult(_0x54f576,null))[_0xb712('0x4a')](handleError(_0x54f576,null));};exports['destroy']=function(_0x2268c1,_0x281906){return db[_0xb712('0x2f')][_0xb712('0x4e')]({'where':{'id':_0x2268c1[_0xb712('0x48')]['id']}})['then'](handleEntityNotFound(_0x281906,null))['then'](removeEntity(_0x281906,null))[_0xb712('0x4a')](handleError(_0x281906,null));};exports[_0xb712('0x4f')]=function(_0x2f4c98,_0xac9281){return db[_0xb712('0x2f')]['describe']()[_0xb712('0x27')](respondWithResult(_0xac9281,null))['catch'](handleError(_0xac9281,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index e807a16..79d7aaf 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 _0xbf3f=['request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','api'];(function(_0x180dda,_0x577ad9){var _0x5d003c=function(_0x2cdfd6){while(--_0x2cdfd6){_0x180dda['push'](_0x180dda['shift']());}};_0x5d003c(++_0x577ad9);}(_0xbf3f,0x1ed));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfbf3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfbf3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfbf3('0x2'));var fs=require('fs');var path=require(_0xfbf3('0x3'));var rimraf=require('rimraf');var config=require(_0xfbf3('0x4'));var attributes=require(_0xfbf3('0x5'));module[_0xfbf3('0x6')]=function(_0x1ffdba,_0x35b557){return _0x1ffdba[_0xfbf3('0x7')]('VoiceTransferReport',attributes,{'tableName':_0xfbf3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8abf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0xd191f,_0x2d61ca){var _0xc5bbc1=function(_0x4b949e){while(--_0x4b949e){_0xd191f['push'](_0xd191f['shift']());}};_0xc5bbc1(++_0x2d61ca);}(_0x8abf,0xb6));var _0xf8ab=function(_0xb8e0b,_0xfa96cf){_0xb8e0b=_0xb8e0b-0x0;var _0xf1e2d=_0x8abf[_0xb8e0b];return _0xf1e2d;};'use strict';var _=require(_0xf8ab('0x0'));var util=require(_0xf8ab('0x1'));var logger=require(_0xf8ab('0x2'))(_0xf8ab('0x3'));var moment=require(_0xf8ab('0x4'));var BPromise=require(_0xf8ab('0x5'));var rp=require(_0xf8ab('0x6'));var fs=require('fs');var path=require(_0xf8ab('0x7'));var rimraf=require('rimraf');var config=require(_0xf8ab('0x8'));var attributes=require('./voiceTransferReport.attributes');module[_0xf8ab('0x9')]=function(_0x3e4839,_0x43dc6d){return _0x3e4839[_0xf8ab('0xa')](_0xf8ab('0xb'),attributes,{'tableName':_0xf8ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index cc5f06c..bf5f578 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 _0x3704=['stringify','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceTransferReport','create','body','options','raw'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x3704,0x88));var _0x4370=function(_0x3e70a0,_0x55bd37){_0x3e70a0=_0x3e70a0-0x0;var _0x1df417=_0x3704[_0x3e70a0];return _0x1df417;};'use strict';var _=require('lodash');var util=require(_0x4370('0x0'));var moment=require(_0x4370('0x1'));var BPromise=require(_0x4370('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4370('0x3'));var logger=require(_0x4370('0x4'))(_0x4370('0x5'));var config=require(_0x4370('0x6'));var jayson=require(_0x4370('0x7'));var client=jayson[_0x4370('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22a9d9,_0x507909,_0x34348b){return new BPromise(function(_0x47d481,_0x2abfe5){return client[_0x4370('0x9')](_0x22a9d9,_0x34348b)[_0x4370('0xa')](function(_0x3622f5){logger['info'](_0x4370('0xb'),_0x507909,_0x4370('0xc'));logger[_0x4370('0xd')](_0x4370('0xe'),_0x507909,_0x4370('0xc'),JSON['stringify'](_0x3622f5));if(_0x3622f5[_0x4370('0xf')]){if(_0x3622f5[_0x4370('0xf')][_0x4370('0x10')]===0x1f4){logger[_0x4370('0xf')](_0x4370('0xb'),_0x507909,_0x3622f5[_0x4370('0xf')][_0x4370('0x11')]);return _0x2abfe5(_0x3622f5[_0x4370('0xf')][_0x4370('0x11')]);}logger[_0x4370('0xf')](_0x4370('0xb'),_0x507909,_0x3622f5['error'][_0x4370('0x11')]);return _0x47d481(_0x3622f5['error'][_0x4370('0x11')]);}else{logger[_0x4370('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x507909,_0x4370('0xc'));_0x47d481(_0x3622f5[_0x4370('0x13')][_0x4370('0x11')]);}})[_0x4370('0x14')](function(_0x3444b5){logger[_0x4370('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x507909,_0x3444b5);_0x2abfe5(_0x3444b5);});});}exports[_0x4370('0x15')]=function(_0x12dfea){var _0x263c16=this;return new Promise(function(_0x2164aa,_0x337364){return db['VoiceTransferReport'][_0x4370('0x16')](_0x12dfea[_0x4370('0x17')],{'raw':_0x12dfea[_0x4370('0x18')]?_0x12dfea[_0x4370('0x18')][_0x4370('0x19')]===undefined?!![]:![]:!![]})[_0x4370('0xa')](function(_0x130d78){logger[_0x4370('0x12')](_0x4370('0x15'),_0x12dfea);logger[_0x4370('0xd')](_0x4370('0x15'),_0x12dfea,JSON[_0x4370('0x1a')](_0x130d78));_0x2164aa(_0x130d78);})[_0x4370('0x14')](function(_0x4877c9){logger[_0x4370('0xf')](_0x4370('0x15'),_0x4877c9[_0x4370('0x11')],_0x12dfea);_0x337364(_0x263c16[_0x4370('0xf')](0x1f4,_0x4877c9[_0x4370('0x11')]));});});}; \ No newline at end of file +var _0x33ed=['then','info','request\x20sent','debug','stringify','error','message','VoiceTransferReport,\x20%s,\x20%s','result','catch','VoiceTransferReport','create','options','raw','CreateVoiceTransferReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x2417b1,_0x5b6b72){var _0x5f4658=function(_0x5e53d3){while(--_0x5e53d3){_0x2417b1['push'](_0x2417b1['shift']());}};_0x5f4658(++_0x5b6b72);}(_0x33ed,0x8c));var _0xd33e=function(_0x2179f1,_0x21c653){_0x2179f1=_0x2179f1-0x0;var _0x176ec9=_0x33ed[_0x2179f1];return _0x176ec9;};'use strict';var _=require(_0xd33e('0x0'));var util=require('util');var moment=require(_0xd33e('0x1'));var BPromise=require(_0xd33e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd33e('0x3'));var db=require(_0xd33e('0x4'))['db'];var utils=require(_0xd33e('0x5'));var logger=require(_0xd33e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd33e('0x7'));var client=jayson[_0xd33e('0x8')][_0xd33e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58e936,_0x1d8ebd,_0x481cc5){return new BPromise(function(_0x30649b,_0x3a19b9){return client['request'](_0x58e936,_0x481cc5)[_0xd33e('0xa')](function(_0x37f344){logger[_0xd33e('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x1d8ebd,_0xd33e('0xc'));logger[_0xd33e('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1d8ebd,_0xd33e('0xc'),JSON[_0xd33e('0xe')](_0x37f344));if(_0x37f344['error']){if(_0x37f344['error']['code']===0x1f4){logger[_0xd33e('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x1d8ebd,_0x37f344['error'][_0xd33e('0x10')]);return _0x3a19b9(_0x37f344[_0xd33e('0xf')][_0xd33e('0x10')]);}logger['error'](_0xd33e('0x11'),_0x1d8ebd,_0x37f344[_0xd33e('0xf')][_0xd33e('0x10')]);return _0x30649b(_0x37f344[_0xd33e('0xf')][_0xd33e('0x10')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x1d8ebd,'request\x20sent');_0x30649b(_0x37f344[_0xd33e('0x12')][_0xd33e('0x10')]);}})[_0xd33e('0x13')](function(_0x12a5a2){logger[_0xd33e('0xf')](_0xd33e('0x11'),_0x1d8ebd,_0x12a5a2);_0x3a19b9(_0x12a5a2);});});}exports['CreateVoiceTransferReport']=function(_0x29fc50){var _0x3546bc=this;return new Promise(function(_0xf86143,_0x120080){return db[_0xd33e('0x14')][_0xd33e('0x15')](_0x29fc50['body'],{'raw':_0x29fc50[_0xd33e('0x16')]?_0x29fc50[_0xd33e('0x16')][_0xd33e('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4f7325){logger[_0xd33e('0xb')](_0xd33e('0x18'),_0x29fc50);logger[_0xd33e('0xd')](_0xd33e('0x18'),_0x29fc50,JSON[_0xd33e('0xe')](_0x4f7325));_0xf86143(_0x4f7325);})[_0xd33e('0x13')](function(_0x59391b){logger[_0xd33e('0xf')](_0xd33e('0x18'),_0x59391b[_0xd33e('0x10')],_0x29fc50);_0x120080(_0x3546bc[_0xd33e('0xf')](0x1f4,_0x59391b[_0xd33e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 99c9f50..6ba37f3 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 _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0xcb91[_0x20aadb];return _0x520018;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0x9c44=['/answer','answer','/hold','/unhold','unhold','/transfer','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x49c4('0x0'));var controller=require(_0x49c4('0x1'));router[_0x49c4('0x2')](_0x49c4('0x3'),auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['originate']);router['post'](_0x49c4('0x6'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0x7')]);router[_0x49c4('0x2')](_0x49c4('0x8'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller[_0x49c4('0x9')]);router[_0x49c4('0x2')](_0x49c4('0xa'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0x49c4('0x2')](_0x49c4('0xb'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xc')]);router['post']('/calls',auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['calls']);router[_0x49c4('0x2')](_0x49c4('0xd'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index bc1f5a2..34b2b08 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 _0x0eaa=['transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','defaults','socket.io-emitter','redis','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','info','stringify','emit','error','stack','name','status','send','request','code','message','catch','User','findOne','agent','then','all','filter','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','userId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','validate','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer'];(function(_0x5e62b0,_0x289456){var _0x3ffbc6=function(_0x56ff51){while(--_0x56ff51){_0x5e62b0['push'](_0x5e62b0['shift']());}};_0x3ffbc6(++_0x289456);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x203338,_0x251a5f){_0x203338=_0x203338-0x0;var _0x11adad=_0x0eaa[_0x203338];return _0x11adad;};'use strict';var path=require(_0xa0ea('0x0'));var fs=require('fs');var _=require(_0xa0ea('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0xa0ea('0x2'));var BPromise=require(_0xa0ea('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa0ea('0x4')][_0xa0ea('0x5')]({'port':0x232a});var logger=require(_0xa0ea('0x6'))(_0xa0ea('0x7'));var Redis=require(_0xa0ea('0x8'));config['redis']=_[_0xa0ea('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa0ea('0xa'))(new Redis(config[_0xa0ea('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa0ea('0xc')]},'callNumber':{'type':_0xa0ea('0xd'),'required':[!![],_0xa0ea('0xe')]},'callerId':{'type':_0xa0ea('0xd')},'callbackUrl':{'type':_0xa0ea('0xd')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa0ea('0xc')]},'sessionId':{'type':_0xa0ea('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa0ea('0xf'),'required':[!![],_0xa0ea('0xc')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa0ea('0xf'),'required':[!![],_0xa0ea('0xc')]},'sessionId':{'type':_0xa0ea('0xd'),'required':[!![],_0xa0ea('0x10')]},'transferNumber':{'type':_0xa0ea('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xa0ea('0xf'),'required':[!![],_0xa0ea('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa0ea('0xf'),'required':[!![],_0xa0ea('0xc')]},'sessionId':{'type':_0xa0ea('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa0ea('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xa0ea('0xf'),'required':[!![],_0xa0ea('0xc')]}});function emit(_0x4274c2,_0x130156,_0x10d8f9){logger[_0xa0ea('0x11')](_0x4274c2,_0x130156,JSON[_0xa0ea('0x12')](_0x10d8f9));io['to'](_0x4274c2)[_0xa0ea('0x13')](_0x130156,_0x10d8f9);}function handleError(_0x345fb6){return function(_0x405f7f){console['log']('handleError:',_0x405f7f,_0x405f7f instanceof RangeError);logger[_0xa0ea('0x14')](_0x405f7f[_0xa0ea('0x15')]);if(_0x405f7f instanceof RangeError){if(_0x405f7f[_0xa0ea('0x16')]){delete _0x405f7f[_0xa0ea('0x16')];}_0x345fb6[_0xa0ea('0x17')](0x194)[_0xa0ea('0x18')](_0x405f7f);}else{if(_0x405f7f[_0xa0ea('0x16')]){delete _0x405f7f['name'];}_0x345fb6[_0xa0ea('0x17')](0x1f4)[_0xa0ea('0x18')](_0x405f7f);}};}function checkError(){return function(_0x94806e){if(!_0x94806e){throw new RangeError('NotFound');}return _0x94806e;};}function respondWithRpcPromise(_0x103e4f,_0x345d27){return new BPromise(function(_0x45fda4,_0x12cda2){var _0x2b5af5=amiClient;return _0x2b5af5[_0xa0ea('0x19')](_0x103e4f,_0x345d27)['then'](function(_0x35faa4){if(_0x35faa4['error']){if(_0x35faa4['error'][_0xa0ea('0x1a')]===0x1f4){return _0x12cda2(_0x35faa4[_0xa0ea('0x14')][_0xa0ea('0x1b')]);}return _0x45fda4(_0x35faa4['error'][_0xa0ea('0x1b')]);}else{_0x45fda4(_0x35faa4['result']);}})[_0xa0ea('0x1c')](function(_0x51cfbd){_0x12cda2(_0x51cfbd);});});}function getAgent(_0xcf155b){return db[_0xa0ea('0x1d')][_0xa0ea('0x1e')]({'where':{'id':_0xcf155b,'role':_0xa0ea('0x1f')}})[_0xa0ea('0x20')](checkError());}function getAgentCheckSession(_0x287728,_0x380e09){return new BPromise(function(_0x208c8,_0x4b6541){var _0x15534e=respondWithRpcPromise('VoiceChannels');var _0x21640c=getAgent(_0x287728);Promise[_0xa0ea('0x21')]([_0x15534e,_0x21640c])[_0xa0ea('0x20')](function(_0x705022){var _0x389050=_0x705022[0x0];var _0x129130=_0x705022[0x1];var _0x4e9748=_[_0xa0ea('0x22')](_0x389050['rows'],function(_0x210ce3){return _0x210ce3['UserId']==_0x129130['id']&&_0x210ce3[_0xa0ea('0x23')]==_0x380e09;});if(_0x4e9748[_0xa0ea('0x24')]==0x1){_0x208c8(_0x129130);}else{_0x4b6541(new RangeError(_0xa0ea('0x25')+_0x380e09+'\x20not\x20found!'));}});});}exports[_0xa0ea('0x26')]=function(_0x37a5b3,_0x502df5){logger[_0xa0ea('0x11')](_0xa0ea('0x27'),_0x37a5b3[_0xa0ea('0x28')]);var _0x4e8975=originateValidation['validate'](_0x37a5b3[_0xa0ea('0x28')]);if(_0x4e8975[_0xa0ea('0x24')]>0x0){return _0x502df5[_0xa0ea('0x17')](0x190)['json'](_0x4e8975);}var _0x610345=_0x37a5b3[_0xa0ea('0x28')][_0xa0ea('0x29')];var _0x41be34=_0x37a5b3[_0xa0ea('0x28')]['callNumber'];var _0x49a7fa=_0x37a5b3[_0xa0ea('0x28')]['callerId'];var _0x272dca=_0x37a5b3[_0xa0ea('0x28')][_0xa0ea('0x2a')];return getAgent(_0x610345)[_0xa0ea('0x20')](function(_0x628464){logger['info'](_0xa0ea('0x2b'),_0x628464[_0xa0ea('0x16')]);emit(util[_0xa0ea('0x2c')](_0xa0ea('0x2d'),_0x628464[_0xa0ea('0x16')]),_0xa0ea('0x2e'),{'callNumber':_0x41be34,'callerId':_0x49a7fa,'callbackUrl':_0x272dca});return _0x502df5[_0xa0ea('0x17')](0xc8)[_0xa0ea('0x2f')]({'error':![],'message':_0xa0ea('0x30')});})[_0xa0ea('0x1c')](handleError(_0x502df5));};exports['hangup']=function(_0x412364,_0x479008){logger[_0xa0ea('0x11')]('hangup\x20fired:',_0x412364[_0xa0ea('0x28')]);var _0x5b8159=hangupValidation[_0xa0ea('0x31')](_0x412364[_0xa0ea('0x28')]);if(_0x5b8159[_0xa0ea('0x24')]>0x0){return _0x479008[_0xa0ea('0x17')](0x190)['json'](_0x5b8159);}var _0x26f8aa=_0x412364[_0xa0ea('0x28')][_0xa0ea('0x29')];var _0x139496=_0x412364[_0xa0ea('0x28')][_0xa0ea('0x23')];return getAgent(_0x26f8aa)[_0xa0ea('0x20')](function(_0x24ac13){logger[_0xa0ea('0x11')]('entityFound:',_0x24ac13[_0xa0ea('0x16')]);emit(util['format'](_0xa0ea('0x2d'),_0x24ac13[_0xa0ea('0x16')]),_0xa0ea('0x32'),{'sessionId':_0x139496});return _0x479008[_0xa0ea('0x17')](0xc8)[_0xa0ea('0x2f')]({'error':![],'message':_0xa0ea('0x33')});})[_0xa0ea('0x1c')](handleError(_0x479008));};exports[_0xa0ea('0x34')]=function(_0x15d3ab,_0x21a2d5){logger[_0xa0ea('0x11')](_0xa0ea('0x35'),_0x15d3ab[_0xa0ea('0x28')]);var _0x37e38b=answerValidation[_0xa0ea('0x31')](_0x15d3ab['body']);if(_0x37e38b[_0xa0ea('0x24')]>0x0){return _0x21a2d5['status'](0x190)[_0xa0ea('0x2f')](_0x37e38b);}var _0x59e305=_0x15d3ab['body']['userId'];var _0x53606e=_0x15d3ab[_0xa0ea('0x28')][_0xa0ea('0x23')];return getAgent(_0x59e305)['then'](function(_0x3e17be){logger[_0xa0ea('0x11')](_0xa0ea('0x2b'),_0x3e17be['name']);emit(util['format']('user:%s',_0x3e17be[_0xa0ea('0x16')]),_0xa0ea('0x36'),{'sessionId':_0x53606e});return _0x21a2d5[_0xa0ea('0x17')](0xc8)[_0xa0ea('0x2f')]({'error':![],'message':_0xa0ea('0x37')});})[_0xa0ea('0x1c')](handleError(_0x21a2d5));};exports[_0xa0ea('0x38')]=function(_0xf7d20f,_0x541463){logger[_0xa0ea('0x11')](_0xa0ea('0x39'),_0xf7d20f[_0xa0ea('0x28')]);var _0x54161d=holdValidation[_0xa0ea('0x31')](_0xf7d20f[_0xa0ea('0x28')]);if(_0x54161d[_0xa0ea('0x24')]>0x0){return _0x541463[_0xa0ea('0x17')](0x190)['json'](_0x54161d);}var _0x482601=_0xf7d20f[_0xa0ea('0x28')][_0xa0ea('0x29')];var _0x1b841a=_0xf7d20f[_0xa0ea('0x28')][_0xa0ea('0x23')];return getAgent(_0x482601)[_0xa0ea('0x20')](function(_0x219540){logger[_0xa0ea('0x11')](_0xa0ea('0x2b'),_0x219540[_0xa0ea('0x16')]);emit(util['format'](_0xa0ea('0x2d'),_0x219540[_0xa0ea('0x16')]),_0xa0ea('0x3a'),{'sessionId':_0x1b841a});return _0x541463[_0xa0ea('0x17')](0xc8)[_0xa0ea('0x2f')]({'error':![],'message':_0xa0ea('0x3b')});})[_0xa0ea('0x1c')](handleError(_0x541463));};exports['unhold']=function(_0x140155,_0x176f68){logger['info'](_0xa0ea('0x3c'),_0x140155['body']);var _0x3feeb0=unholdValidation[_0xa0ea('0x31')](_0x140155[_0xa0ea('0x28')]);if(_0x3feeb0[_0xa0ea('0x24')]>0x0){return _0x176f68[_0xa0ea('0x17')](0x190)['json'](_0x3feeb0);}var _0x3b5861=_0x140155['body'][_0xa0ea('0x29')];var _0x4afa03=_0x140155[_0xa0ea('0x28')][_0xa0ea('0x23')];return getAgent(_0x3b5861)['then'](function(_0x2fbc9b){logger[_0xa0ea('0x11')](_0xa0ea('0x2b'),_0x2fbc9b['name']);emit(util[_0xa0ea('0x2c')]('user:%s',_0x2fbc9b[_0xa0ea('0x16')]),_0xa0ea('0x3d'),{'sessionId':_0x4afa03});return _0x176f68[_0xa0ea('0x17')](0xc8)[_0xa0ea('0x2f')]({'error':![],'message':_0xa0ea('0x3e')});})['catch'](handleError(_0x176f68));};exports[_0xa0ea('0x3f')]=function(_0x4ea7d1,_0x493676){logger[_0xa0ea('0x11')](_0xa0ea('0x40'),_0x493676[_0xa0ea('0x28')]);var _0x4c8aa7=callsValidation[_0xa0ea('0x31')](_0x4ea7d1[_0xa0ea('0x28')]);if(_0x4c8aa7[_0xa0ea('0x24')]>0x0){return _0x493676[_0xa0ea('0x17')](0x190)[_0xa0ea('0x2f')](_0x4c8aa7);}var _0xf4bf41=_0x4ea7d1[_0xa0ea('0x28')][_0xa0ea('0x29')];var _0x4e5a3f=respondWithRpcPromise(_0xa0ea('0x41'));var _0x3c79d0=getAgent(_0xf4bf41);return Promise[_0xa0ea('0x21')]([_0x4e5a3f,_0x3c79d0])['then'](function(_0x1ae398){var _0x545ad7=_0x1ae398[0x0];var _0x16026b=_0x1ae398[0x1];var _0x406586=_[_0xa0ea('0x22')](_0x545ad7[_0xa0ea('0x42')],function(_0x293de2){return _0x293de2['UserId']==_0x16026b['id'];});return _0x493676[_0xa0ea('0x17')](0xc8)[_0xa0ea('0x2f')]({'count':_0x406586[_0xa0ea('0x24')],'rows':_0x406586});})[_0xa0ea('0x1c')](handleError(_0x493676));};exports[_0xa0ea('0x43')]=function(_0x422b93,_0x4d2ec3){logger[_0xa0ea('0x11')](_0xa0ea('0x44'),_0x422b93[_0xa0ea('0x28')]);var _0x4abb20=conferenceValidation[_0xa0ea('0x31')](_0x422b93[_0xa0ea('0x28')]);if(_0x4abb20[_0xa0ea('0x24')]>0x0){return _0x4d2ec3[_0xa0ea('0x17')](0x190)[_0xa0ea('0x2f')](_0x4abb20);}var _0x2f94a5=_0x422b93[_0xa0ea('0x28')][_0xa0ea('0x29')];return getAgent(_0x2f94a5)['then'](function(_0x4cb062){logger['info'](_0xa0ea('0x2b'),_0x4cb062['name']);emit(util[_0xa0ea('0x2c')](_0xa0ea('0x2d'),_0x4cb062[_0xa0ea('0x16')]),_0xa0ea('0x45'));return _0x4d2ec3[_0xa0ea('0x17')](0xc8)['json']({'error':![],'message':_0xa0ea('0x46')});})[_0xa0ea('0x1c')](handleError(_0x4d2ec3));};exports[_0xa0ea('0x47')]=function(_0x1f792a,_0x532a29){logger[_0xa0ea('0x11')](_0xa0ea('0x48'),_0x1f792a['body']);var _0x145630=transferValidation['validate'](_0x1f792a['body']);if(_0x145630[_0xa0ea('0x24')]>0x0){return _0x532a29['status'](0x190)[_0xa0ea('0x2f')](_0x145630);}var _0x6f5039=_0x1f792a['body'][_0xa0ea('0x29')];var _0x1d57e8=_0x1f792a[_0xa0ea('0x28')][_0xa0ea('0x23')];var _0x4ca3fd=_0x1f792a[_0xa0ea('0x28')]['transferNumber'];return getAgent(_0x6f5039)[_0xa0ea('0x20')](function(_0x4052ed){logger[_0xa0ea('0x11')](_0xa0ea('0x2b'),_0x4052ed[_0xa0ea('0x16')]);emit(util[_0xa0ea('0x2c')]('user:%s',_0x4052ed['name']),_0xa0ea('0x49'),{'sessionId':_0x1d57e8,'transferNumber':_0x4ca3fd});return _0x532a29['status'](0xc8)[_0xa0ea('0x2f')]({'error':![],'message':_0xa0ea('0x4a')});})[_0xa0ea('0x1c')](handleError(_0x532a29));}; \ No newline at end of file +var _0x4b1f=['originate','info','originate\x20fired:','body','validate','userId','callNumber','callerId','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','json','hangup\x20executed!','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','path','lodash','../../config/environment','util','bluebird','client','http','../../config/logger','redis','defaults','localhost','socket.io-emitter','userId\x20is\x20required','callNumber\x20is\x20required','number','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','result','catch','User','agent','all','UserId','sessionId','length','sessionId\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b1f,0x195));var _0xf4b1=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4b1f[_0x1cc8fe];return _0x230054;};'use strict';var path=require(_0xf4b1('0x0'));var fs=require('fs');var _=require(_0xf4b1('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xf4b1('0x2'));var util=require(_0xf4b1('0x3'));var BPromise=require(_0xf4b1('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xf4b1('0x5')][_0xf4b1('0x6')]({'port':0x232a});var logger=require(_0xf4b1('0x7'))('webbarapi');var Redis=require('ioredis');config[_0xf4b1('0x8')]=_[_0xf4b1('0x9')](config[_0xf4b1('0x8')],{'host':_0xf4b1('0xa'),'port':0x18eb});var io=require(_0xf4b1('0xb'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf4b1('0xc')]},'callNumber':{'type':'string','required':[!![],_0xf4b1('0xd')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xf4b1('0xe'),'required':[!![],_0xf4b1('0xc')]},'sessionId':{'type':_0xf4b1('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf4b1('0xe'),'required':[!![],_0xf4b1('0xc')]},'sessionId':{'type':_0xf4b1('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf4b1('0xe'),'required':[!![],_0xf4b1('0xc')]},'sessionId':{'type':_0xf4b1('0xf'),'required':[!![],_0xf4b1('0x10')]},'transferNumber':{'type':_0xf4b1('0xf'),'required':[!![],_0xf4b1('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xf4b1('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf4b1('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf4b1('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf4b1('0xc')]}});function emit(_0x4968f4,_0x5e7206,_0x554517){logger['info'](_0x4968f4,_0x5e7206,JSON[_0xf4b1('0x12')](_0x554517));io['to'](_0x4968f4)[_0xf4b1('0x13')](_0x5e7206,_0x554517);}function handleError(_0x534fd8){return function(_0x3b378e){console[_0xf4b1('0x14')](_0xf4b1('0x15'),_0x3b378e,_0x3b378e instanceof RangeError);logger[_0xf4b1('0x16')](_0x3b378e[_0xf4b1('0x17')]);if(_0x3b378e instanceof RangeError){if(_0x3b378e[_0xf4b1('0x18')]){delete _0x3b378e['name'];}_0x534fd8[_0xf4b1('0x19')](0x194)[_0xf4b1('0x1a')](_0x3b378e);}else{if(_0x3b378e['name']){delete _0x3b378e[_0xf4b1('0x18')];}_0x534fd8[_0xf4b1('0x19')](0x1f4)['send'](_0x3b378e);}};}function checkError(){return function(_0x13892d){if(!_0x13892d){throw new RangeError(_0xf4b1('0x1b'));}return _0x13892d;};}function respondWithRpcPromise(_0xbfab1e,_0x466739){return new BPromise(function(_0x5c50e8,_0x20013c){var _0x29b8c1=amiClient;return _0x29b8c1[_0xf4b1('0x1c')](_0xbfab1e,_0x466739)[_0xf4b1('0x1d')](function(_0x58376d){if(_0x58376d[_0xf4b1('0x16')]){if(_0x58376d[_0xf4b1('0x16')]['code']===0x1f4){return _0x20013c(_0x58376d[_0xf4b1('0x16')]['message']);}return _0x5c50e8(_0x58376d[_0xf4b1('0x16')]['message']);}else{_0x5c50e8(_0x58376d[_0xf4b1('0x1e')]);}})[_0xf4b1('0x1f')](function(_0x2e803d){_0x20013c(_0x2e803d);});});}function getAgent(_0x5a0285){return db[_0xf4b1('0x20')]['findOne']({'where':{'id':_0x5a0285,'role':_0xf4b1('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x29493b,_0x447ae7){return new BPromise(function(_0x5d28af,_0x22353e){var _0x23693b=respondWithRpcPromise('VoiceChannels');var _0x125bf4=getAgent(_0x29493b);Promise[_0xf4b1('0x22')]([_0x23693b,_0x125bf4])[_0xf4b1('0x1d')](function(_0x11ffb3){var _0x3046dc=_0x11ffb3[0x0];var _0x36243e=_0x11ffb3[0x1];var _0x2f830c=_['filter'](_0x3046dc['rows'],function(_0x31c13c){return _0x31c13c[_0xf4b1('0x23')]==_0x36243e['id']&&_0x31c13c[_0xf4b1('0x24')]==_0x447ae7;});if(_0x2f830c[_0xf4b1('0x25')]==0x1){_0x5d28af(_0x36243e);}else{_0x22353e(new RangeError(_0xf4b1('0x26')+_0x447ae7+'\x20not\x20found!'));}});});}exports[_0xf4b1('0x27')]=function(_0xa08452,_0xa6bdd7){logger[_0xf4b1('0x28')](_0xf4b1('0x29'),_0xa08452[_0xf4b1('0x2a')]);var _0x186dd3=originateValidation[_0xf4b1('0x2b')](_0xa08452['body']);if(_0x186dd3[_0xf4b1('0x25')]>0x0){return _0xa6bdd7['status'](0x190)['json'](_0x186dd3);}var _0x48f672=_0xa08452[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x75f753=_0xa08452[_0xf4b1('0x2a')][_0xf4b1('0x2d')];var _0x2ddbc8=_0xa08452[_0xf4b1('0x2a')][_0xf4b1('0x2e')];var _0x55a5a6=_0xa08452[_0xf4b1('0x2a')]['callbackUrl'];return getAgent(_0x48f672)[_0xf4b1('0x1d')](function(_0x303290){logger['info'](_0xf4b1('0x2f'),_0x303290[_0xf4b1('0x18')]);emit(util[_0xf4b1('0x30')](_0xf4b1('0x31'),_0x303290[_0xf4b1('0x18')]),'webbar:originate',{'callNumber':_0x75f753,'callerId':_0x2ddbc8,'callbackUrl':_0x55a5a6});return _0xa6bdd7[_0xf4b1('0x19')](0xc8)['json']({'error':![],'message':_0xf4b1('0x32')});})['catch'](handleError(_0xa6bdd7));};exports[_0xf4b1('0x33')]=function(_0x366621,_0xfe587f){logger['info'](_0xf4b1('0x34'),_0x366621[_0xf4b1('0x2a')]);var _0x207020=hangupValidation[_0xf4b1('0x2b')](_0x366621[_0xf4b1('0x2a')]);if(_0x207020[_0xf4b1('0x25')]>0x0){return _0xfe587f[_0xf4b1('0x19')](0x190)['json'](_0x207020);}var _0x393da0=_0x366621[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x3553c3=_0x366621[_0xf4b1('0x2a')][_0xf4b1('0x24')];return getAgent(_0x393da0)['then'](function(_0x33879b){logger[_0xf4b1('0x28')]('entityFound:',_0x33879b['name']);emit(util[_0xf4b1('0x30')](_0xf4b1('0x31'),_0x33879b[_0xf4b1('0x18')]),_0xf4b1('0x35'),{'sessionId':_0x3553c3});return _0xfe587f[_0xf4b1('0x19')](0xc8)[_0xf4b1('0x36')]({'error':![],'message':_0xf4b1('0x37')});})[_0xf4b1('0x1f')](handleError(_0xfe587f));};exports['answer']=function(_0x3a4383,_0x5e9da4){logger['info']('answer\x20fired:',_0x3a4383[_0xf4b1('0x2a')]);var _0x3feed5=answerValidation[_0xf4b1('0x2b')](_0x3a4383['body']);if(_0x3feed5[_0xf4b1('0x25')]>0x0){return _0x5e9da4[_0xf4b1('0x19')](0x190)[_0xf4b1('0x36')](_0x3feed5);}var _0x5597d5=_0x3a4383[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x1f856c=_0x3a4383['body'][_0xf4b1('0x24')];return getAgent(_0x5597d5)['then'](function(_0x2e4f2a){logger[_0xf4b1('0x28')](_0xf4b1('0x2f'),_0x2e4f2a['name']);emit(util[_0xf4b1('0x30')](_0xf4b1('0x31'),_0x2e4f2a['name']),_0xf4b1('0x38'),{'sessionId':_0x1f856c});return _0x5e9da4[_0xf4b1('0x19')](0xc8)[_0xf4b1('0x36')]({'error':![],'message':_0xf4b1('0x39')});})['catch'](handleError(_0x5e9da4));};exports['hold']=function(_0x14cdc6,_0x1638a6){logger['info'](_0xf4b1('0x3a'),_0x14cdc6['body']);var _0x202381=holdValidation['validate'](_0x14cdc6[_0xf4b1('0x2a')]);if(_0x202381[_0xf4b1('0x25')]>0x0){return _0x1638a6['status'](0x190)[_0xf4b1('0x36')](_0x202381);}var _0x104819=_0x14cdc6[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x2f4c27=_0x14cdc6[_0xf4b1('0x2a')][_0xf4b1('0x24')];return getAgent(_0x104819)[_0xf4b1('0x1d')](function(_0x4e6e04){logger['info'](_0xf4b1('0x2f'),_0x4e6e04[_0xf4b1('0x18')]);emit(util['format'](_0xf4b1('0x31'),_0x4e6e04[_0xf4b1('0x18')]),_0xf4b1('0x3b'),{'sessionId':_0x2f4c27});return _0x1638a6[_0xf4b1('0x19')](0xc8)[_0xf4b1('0x36')]({'error':![],'message':_0xf4b1('0x3c')});})[_0xf4b1('0x1f')](handleError(_0x1638a6));};exports[_0xf4b1('0x3d')]=function(_0x29c3c1,_0x2bca13){logger[_0xf4b1('0x28')](_0xf4b1('0x3e'),_0x29c3c1[_0xf4b1('0x2a')]);var _0x1bf70f=unholdValidation[_0xf4b1('0x2b')](_0x29c3c1[_0xf4b1('0x2a')]);if(_0x1bf70f[_0xf4b1('0x25')]>0x0){return _0x2bca13[_0xf4b1('0x19')](0x190)[_0xf4b1('0x36')](_0x1bf70f);}var _0x3a1362=_0x29c3c1[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x38efcd=_0x29c3c1[_0xf4b1('0x2a')][_0xf4b1('0x24')];return getAgent(_0x3a1362)[_0xf4b1('0x1d')](function(_0x755ecb){logger[_0xf4b1('0x28')]('entityFound:',_0x755ecb[_0xf4b1('0x18')]);emit(util['format']('user:%s',_0x755ecb[_0xf4b1('0x18')]),_0xf4b1('0x3f'),{'sessionId':_0x38efcd});return _0x2bca13['status'](0xc8)[_0xf4b1('0x36')]({'error':![],'message':_0xf4b1('0x40')});})[_0xf4b1('0x1f')](handleError(_0x2bca13));};exports['calls']=function(_0x59b8e8,_0x1fc659){logger[_0xf4b1('0x28')](_0xf4b1('0x41'),_0x1fc659[_0xf4b1('0x2a')]);var _0x402e6c=callsValidation[_0xf4b1('0x2b')](_0x59b8e8[_0xf4b1('0x2a')]);if(_0x402e6c[_0xf4b1('0x25')]>0x0){return _0x1fc659[_0xf4b1('0x19')](0x190)[_0xf4b1('0x36')](_0x402e6c);}var _0x1fec6d=_0x59b8e8[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x24d0a6=respondWithRpcPromise('VoiceChannels');var _0x193bab=getAgent(_0x1fec6d);return Promise[_0xf4b1('0x22')]([_0x24d0a6,_0x193bab])[_0xf4b1('0x1d')](function(_0x427126){var _0xb53593=_0x427126[0x0];var _0x43d373=_0x427126[0x1];var _0xe7b6a3=_[_0xf4b1('0x42')](_0xb53593[_0xf4b1('0x43')],function(_0x47abe5){return _0x47abe5[_0xf4b1('0x23')]==_0x43d373['id'];});return _0x1fc659[_0xf4b1('0x19')](0xc8)[_0xf4b1('0x36')]({'count':_0xe7b6a3['length'],'rows':_0xe7b6a3});})['catch'](handleError(_0x1fc659));};exports[_0xf4b1('0x44')]=function(_0x1cc591,_0x4db29b){logger[_0xf4b1('0x28')](_0xf4b1('0x45'),_0x1cc591[_0xf4b1('0x2a')]);var _0x22d27f=conferenceValidation[_0xf4b1('0x2b')](_0x1cc591[_0xf4b1('0x2a')]);if(_0x22d27f[_0xf4b1('0x25')]>0x0){return _0x4db29b[_0xf4b1('0x19')](0x190)[_0xf4b1('0x36')](_0x22d27f);}var _0x36cf63=_0x1cc591[_0xf4b1('0x2a')]['userId'];return getAgent(_0x36cf63)[_0xf4b1('0x1d')](function(_0x350d07){logger['info'](_0xf4b1('0x2f'),_0x350d07[_0xf4b1('0x18')]);emit(util[_0xf4b1('0x30')]('user:%s',_0x350d07[_0xf4b1('0x18')]),_0xf4b1('0x46'));return _0x4db29b['status'](0xc8)['json']({'error':![],'message':_0xf4b1('0x47')});})['catch'](handleError(_0x4db29b));};exports['transfer']=function(_0x2de44d,_0x844121){logger['info']('transfer\x20fired:',_0x2de44d[_0xf4b1('0x2a')]);var _0x17eb9e=transferValidation['validate'](_0x2de44d[_0xf4b1('0x2a')]);if(_0x17eb9e[_0xf4b1('0x25')]>0x0){return _0x844121[_0xf4b1('0x19')](0x190)[_0xf4b1('0x36')](_0x17eb9e);}var _0xe82df1=_0x2de44d[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x55341b=_0x2de44d[_0xf4b1('0x2a')][_0xf4b1('0x24')];var _0xca5281=_0x2de44d[_0xf4b1('0x2a')][_0xf4b1('0x48')];return getAgent(_0xe82df1)[_0xf4b1('0x1d')](function(_0xe9ac5){logger['info']('entityFound:',_0xe9ac5[_0xf4b1('0x18')]);emit(util[_0xf4b1('0x30')]('user:%s',_0xe9ac5[_0xf4b1('0x18')]),_0xf4b1('0x49'),{'sessionId':_0x55341b,'transferNumber':_0xca5281});return _0x844121[_0xf4b1('0x19')](0xc8)[_0xf4b1('0x36')]({'error':![],'message':'transfer\x20executed!'});})[_0xf4b1('0x1f')](handleError(_0x844121));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 8f63029..bb04a75 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 _0xea39=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','index','get','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','create','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','/:id','destroy','removeDispositions','removeAgents'];(function(_0x3bfc6b,_0x504f37){var _0x1d4018=function(_0x4a8746){while(--_0x4a8746){_0x3bfc6b['push'](_0x3bfc6b['shift']());}};_0x1d4018(++_0x504f37);}(_0xea39,0x9d));var _0x9ea3=function(_0x398348,_0x219eac){_0x398348=_0x398348-0x0;var _0x514e5a=_0xea39[_0x398348];return _0x514e5a;};'use strict';var multer=require(_0x9ea3('0x0'));var util=require(_0x9ea3('0x1'));var path=require('path');var timeout=require(_0x9ea3('0x2'));var express=require('express');var router=express[_0x9ea3('0x3')]();var fs_extra=require(_0x9ea3('0x4'));var auth=require(_0x9ea3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9ea3('0x6'));var controller=require(_0x9ea3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9ea3('0x8')]);router[_0x9ea3('0x9')](_0x9ea3('0xa'),auth[_0x9ea3('0xb')](),controller[_0x9ea3('0xc')]);router['get']('/:id',auth[_0x9ea3('0xb')](),controller[_0x9ea3('0xd')]);router[_0x9ea3('0x9')](_0x9ea3('0xe'),auth[_0x9ea3('0xb')](),controller[_0x9ea3('0xf')]);router[_0x9ea3('0x9')](_0x9ea3('0x10'),auth['isAuthenticated'](),controller[_0x9ea3('0x11')]);router[_0x9ea3('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x9ea3('0x12')]);router[_0x9ea3('0x9')](_0x9ea3('0x13'),auth[_0x9ea3('0xb')](),controller[_0x9ea3('0x14')]);router[_0x9ea3('0x15')]('/',auth[_0x9ea3('0xb')](),controller[_0x9ea3('0x16')]);router['post'](_0x9ea3('0xe'),auth[_0x9ea3('0xb')](),controller['addDisposition']);router['post'](_0x9ea3('0x10'),auth[_0x9ea3('0xb')](),controller[_0x9ea3('0x17')]);router[_0x9ea3('0x15')](_0x9ea3('0x18'),auth['isAuthenticated'](),controller[_0x9ea3('0x19')]);router[_0x9ea3('0x15')](_0x9ea3('0x13'),auth['isAuthenticated'](),controller[_0x9ea3('0x1a')]);router[_0x9ea3('0x15')](_0x9ea3('0x1b'),controller[_0x9ea3('0x1c')]);router[_0x9ea3('0x15')](_0x9ea3('0x1d'),auth['isAuthenticated'](),controller[_0x9ea3('0x1e')]);router[_0x9ea3('0x1f')]('/:id',auth[_0x9ea3('0xb')](),controller[_0x9ea3('0x20')]);router[_0x9ea3('0x21')](_0x9ea3('0x22'),auth['isAuthenticated'](),controller[_0x9ea3('0x23')]);router[_0x9ea3('0x21')](_0x9ea3('0xe'),auth[_0x9ea3('0xb')](),controller[_0x9ea3('0x24')]);router[_0x9ea3('0x21')]('/:id/canned_answers',auth[_0x9ea3('0xb')](),controller['removeAnswers']);router[_0x9ea3('0x21')](_0x9ea3('0x18'),auth[_0x9ea3('0xb')](),controller[_0x9ea3('0x25')]);module[_0x9ea3('0x26')]=router; \ No newline at end of file +var _0x2e24=['/:id/notify','/:id/send','send','put','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','create','/:id/dispositions','addDisposition','addAgents'];(function(_0x98c915,_0x5202f4){var _0x3f6e7b=function(_0x3079f7){while(--_0x3079f7){_0x98c915['push'](_0x98c915['shift']());}};_0x3f6e7b(++_0x5202f4);}(_0x2e24,0x10c));var _0x42e2=function(_0x58fd36,_0x8b13d8){_0x58fd36=_0x58fd36-0x0;var _0x1ed91b=_0x2e24[_0x58fd36];return _0x1ed91b;};'use strict';var multer=require(_0x42e2('0x0'));var util=require(_0x42e2('0x1'));var path=require('path');var timeout=require(_0x42e2('0x2'));var express=require(_0x42e2('0x3'));var router=express[_0x42e2('0x4')]();var fs_extra=require(_0x42e2('0x5'));var auth=require(_0x42e2('0x6'));var interaction=require(_0x42e2('0x7'));var config=require(_0x42e2('0x8'));var controller=require(_0x42e2('0x9'));router[_0x42e2('0xa')]('/',auth['isAuthenticated'](),controller[_0x42e2('0xb')]);router[_0x42e2('0xa')](_0x42e2('0xc'),auth[_0x42e2('0xd')](),controller[_0x42e2('0xe')]);router[_0x42e2('0xa')](_0x42e2('0xf'),auth[_0x42e2('0xd')](),controller[_0x42e2('0x10')]);router['get']('/:id/dispositions',auth[_0x42e2('0xd')](),controller[_0x42e2('0x11')]);router[_0x42e2('0xa')](_0x42e2('0x12'),auth[_0x42e2('0xd')](),controller[_0x42e2('0x13')]);router['get'](_0x42e2('0x14'),auth[_0x42e2('0xd')](),controller[_0x42e2('0x15')]);router[_0x42e2('0xa')](_0x42e2('0x16'),auth[_0x42e2('0xd')](),controller['getApplications']);router[_0x42e2('0x17')]('/',auth[_0x42e2('0xd')](),controller[_0x42e2('0x18')]);router[_0x42e2('0x17')](_0x42e2('0x19'),auth[_0x42e2('0xd')](),controller[_0x42e2('0x1a')]);router[_0x42e2('0x17')](_0x42e2('0x12'),auth[_0x42e2('0xd')](),controller['addAnswer']);router[_0x42e2('0x17')](_0x42e2('0x14'),auth[_0x42e2('0xd')](),controller[_0x42e2('0x1b')]);router[_0x42e2('0x17')]('/:id/applications',auth[_0x42e2('0xd')](),controller['addApplications']);router[_0x42e2('0x17')](_0x42e2('0x1c'),controller['notify']);router[_0x42e2('0x17')](_0x42e2('0x1d'),auth[_0x42e2('0xd')](),controller[_0x42e2('0x1e')]);router[_0x42e2('0x1f')]('/:id',auth[_0x42e2('0xd')](),controller[_0x42e2('0x20')]);router[_0x42e2('0x21')](_0x42e2('0xf'),auth[_0x42e2('0xd')](),controller[_0x42e2('0x22')]);router[_0x42e2('0x21')](_0x42e2('0x19'),auth[_0x42e2('0xd')](),controller['removeDispositions']);router[_0x42e2('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x42e2('0x14'),auth['isAuthenticated'](),controller[_0x42e2('0x23')]);module[_0x42e2('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index bebdbe5..89e911c 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 _0x15c5=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','name','STRING','ENUM','TEXT'];(function(_0x161aed,_0x572367){var _0x313caf=function(_0x3f5538){while(--_0x3f5538){_0x161aed['push'](_0x161aed['shift']());}};_0x313caf(++_0x572367);}(_0x15c5,0x192));var _0x515c=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0x15c5[_0x154cb5];return _0x3f574f;};'use strict';var Sequelize=require(_0x515c('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x515c('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x515c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x515c('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x515c('0x3')]('twilio','sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x515c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x515c('0x4')],'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[_0x515c('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x515c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x515c('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x515c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x515c('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x515c('0x6')],'comment':_0x515c('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x515c('0x5')],'defaultValue':![],'comment':_0x515c('0x8'),'set':function(_0x1173f7){if(!_0x1173f7){this[_0x515c('0x9')](_0x515c('0xa'),null);}this[_0x515c('0x9')]('mandatoryDisposition',_0x1173f7);}},'description':{'type':Sequelize[_0x515c('0x2')]}}; \ No newline at end of file +var _0xe50f=['generate','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','STRING','name'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xe50f,0x1b9));var _0xfe50=function(_0x480ee3,_0x4ce5b6){_0x480ee3=_0x480ee3-0x0;var _0x378987=_0xe50f[_0x480ee3];return _0x378987;};'use strict';var Sequelize=require(_0xfe50('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xfe50('0x1')],'unique':_0xfe50('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xfe50('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xfe50('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xfe50('0x1')],'defaultValue':function(){return rs[_0xfe50('0x3')]();}},'phone':{'type':Sequelize[_0xfe50('0x1')]},'type':{'type':Sequelize[_0xfe50('0x4')](_0xfe50('0x5'),_0xfe50('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xfe50('0x1')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xfe50('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xfe50('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfe50('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfe50('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfe50('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfe50('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfe50('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfe50('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfe50('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xfe50('0x8')],'defaultValue':![],'comment':_0xfe50('0xa'),'set':function(_0x3ae2ae){if(!_0x3ae2ae){this['setDataValue']('mandatoryDispositionPauseId',null);}this['setDataValue'](_0xfe50('0xb'),_0x3ae2ae);}},'description':{'type':Sequelize[_0xfe50('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index e9baebb..003981a 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 _0x21fe=['findAll','rows','show','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','WhatsappAccountId','getDispositions','Disposition','pick','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addAgents','omit','emit','removeAgents','userWhatsappAccount:remove','getAgents','User','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','stack','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','ListId','twilio','from','replace','messageId','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','DESC','contact','WhatsappInteraction','spread','interaction','autoclose','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','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','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','WhatsappAccounts','sendStatus','name','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','WhatsappAccount','include'];(function(_0x1c646f,_0x368292){var _0xa49e97=function(_0x239af7){while(--_0x239af7){_0x1c646f['push'](_0x1c646f['shift']());}};_0xa49e97(++_0x368292);}(_0x21fe,0x136));var _0xe21f=function(_0x5e84b4,_0x13dcec){_0x5e84b4=_0x5e84b4-0x0;var _0x4beaa2=_0x21fe[_0x5e84b4];return _0x4beaa2;};'use strict';var emlformat=require(_0xe21f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe21f('0x1'));var jsonpatch=require(_0xe21f('0x2'));var rp=require(_0xe21f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe21f('0x4'));var util=require(_0xe21f('0x5'));var path=require(_0xe21f('0x6'));var sox=require(_0xe21f('0x7'));var csv=require(_0xe21f('0x8'));var ejs=require(_0xe21f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe21f('0xa'));var squel=require(_0xe21f('0xb'));var crypto=require(_0xe21f('0xc'));var jsforce=require(_0xe21f('0xd'));var deskjs=require(_0xe21f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe21f('0xf'));var Papa=require(_0xe21f('0x10'));var Redis=require(_0xe21f('0x11'));var authService=require(_0xe21f('0x12'));var qs=require(_0xe21f('0x13'));var as=require(_0xe21f('0x14'));var hardwareService=require(_0xe21f('0x15'));var logger=require(_0xe21f('0x16'))(_0xe21f('0x17'));var utils=require(_0xe21f('0x18'));var config=require(_0xe21f('0x19'));var licenseUtil=require(_0xe21f('0x1a'));var db=require(_0xe21f('0x1b'))['db'];config[_0xe21f('0x1c')]=_[_0xe21f('0x1d')](config[_0xe21f('0x1c')],{'host':_0xe21f('0x1e'),'port':0x18eb});var socket=require(_0xe21f('0x1f'))(new Redis(config[_0xe21f('0x1c')]));require(_0xe21f('0x20'))[_0xe21f('0x21')](socket);var jayson=require(_0xe21f('0x22'));var client=jayson[_0xe21f('0x23')][_0xe21f('0x24')]({'port':0x232c});function respondWithRpcPromise(_0x3b6b91,_0x3eceb4,_0xae0fb5,_0x274734){return new BPromise(function(_0x9d4e10,_0x5270d5){var _0x2b6714=_0x274734||client;return _0x2b6714[_0xe21f('0x25')](_0x3b6b91,_0xae0fb5)[_0xe21f('0x26')](function(_0x4b3394){logger[_0xe21f('0x27')](_0xe21f('0x28'),_0x3eceb4,_0xe21f('0x29'));logger[_0xe21f('0x2a')](_0xe21f('0x2b'),_0x3eceb4,_0xe21f('0x29'),JSON[_0xe21f('0x2c')](_0x4b3394));if(_0x4b3394[_0xe21f('0x2d')]){if(_0x4b3394[_0xe21f('0x2d')][_0xe21f('0x2e')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3eceb4,_0x4b3394[_0xe21f('0x2d')][_0xe21f('0x2f')]);return _0x5270d5(_0x4b3394['error']['message']);}logger[_0xe21f('0x2d')]('WhatsappAccount,\x20%s,\x20%s',_0x3eceb4,_0x4b3394[_0xe21f('0x2d')][_0xe21f('0x2f')]);return _0x9d4e10(_0x4b3394['error'][_0xe21f('0x2f')]);}else{logger[_0xe21f('0x27')](_0xe21f('0x28'),_0x3eceb4,'request\x20sent');_0x9d4e10(_0x4b3394[_0xe21f('0x30')][_0xe21f('0x2f')]);}})[_0xe21f('0x31')](function(_0x594ce0){logger[_0xe21f('0x2d')](_0xe21f('0x28'),_0x3eceb4,_0x594ce0);_0x5270d5(_0x594ce0);});});}function respondWithStatusCode(_0x35c280,_0x885c04){_0x885c04=_0x885c04||0xcc;return function(_0x1bd111){if(_0x1bd111){return _0x35c280['sendStatus'](_0x885c04);}return _0x35c280[_0xe21f('0x32')](_0x885c04)[_0xe21f('0x33')]();};}function respondWithResult(_0xe38963,_0x5b9ab7){_0x5b9ab7=_0x5b9ab7||0xc8;return function(_0xf8c0f8){if(_0xf8c0f8){return _0xe38963[_0xe21f('0x32')](_0x5b9ab7)[_0xe21f('0x34')](_0xf8c0f8);}};}function respondWithFilteredResult(_0x18e797,_0x331313){return function(_0x523705){if(_0x523705){var _0x2f6be0=typeof _0x331313[_0xe21f('0x35')]==='undefined'&&typeof _0x331313[_0xe21f('0x36')]==='undefined';var _0x2c9267=_0x523705[_0xe21f('0x37')];var _0x3c42d8=_0x2f6be0?0x0:_0x331313[_0xe21f('0x35')];var _0x28b6a7=_0x2f6be0?_0x523705[_0xe21f('0x37')]:_0x331313['offset']+_0x331313[_0xe21f('0x36')];var _0x54db62;if(_0x28b6a7>=_0x2c9267){_0x28b6a7=_0x2c9267;_0x54db62=0xc8;}else{_0x54db62=0xce;}_0x18e797[_0xe21f('0x32')](_0x54db62);return _0x18e797[_0xe21f('0x38')](_0xe21f('0x39'),_0x3c42d8+'-'+_0x28b6a7+'/'+_0x2c9267)['json'](_0x523705);}return null;};}function patchUpdates(_0x57a011){return function(_0x5b0140){try{jsonpatch[_0xe21f('0x3a')](_0x5b0140,_0x57a011,!![]);}catch(_0x1e0575){return BPromise[_0xe21f('0x3b')](_0x1e0575);}return _0x5b0140[_0xe21f('0x3c')]();};}function saveUpdates(_0xc470c6,_0x350a9c){return function(_0xbea198){if(_0xbea198){return _0xbea198[_0xe21f('0x3d')](_0xc470c6)['then'](function(_0x48c431){return _0x48c431;});}return null;};}function removeEntity(_0x5274e7,_0x32fb7f){return function(_0x4c7766){if(_0x4c7766){return _0x4c7766[_0xe21f('0x3e')]()[_0xe21f('0x26')](function(){var _0x3391e9=_0x4c7766['get']({'plain':!![]});var _0x1347fb=_0xe21f('0x3f');return db['UserProfileResource'][_0xe21f('0x3e')]({'where':{'type':_0x1347fb,'resourceId':_0x3391e9['id']}})[_0xe21f('0x26')](function(){return _0x4c7766;});})[_0xe21f('0x26')](function(){_0x5274e7[_0xe21f('0x32')](0xcc)[_0xe21f('0x33')]();});}};}function handleEntityNotFound(_0x4c5974,_0x59b628){return function(_0x2a5bca){if(!_0x2a5bca){_0x4c5974[_0xe21f('0x40')](0x194);}return _0x2a5bca;};}function handleError(_0x3c9450,_0x9f373a){_0x9f373a=_0x9f373a||0x1f4;return function(_0x3896d5){logger['error'](_0x3896d5['stack']);if(_0x3896d5[_0xe21f('0x41')]){delete _0x3896d5[_0xe21f('0x41')];}_0x3c9450[_0xe21f('0x32')](_0x9f373a)['send'](_0x3896d5);};}exports['index']=function(_0x16fc8d,_0x725552){var _0x5a52c1={'include':[{'model':db[_0xe21f('0x42')],'as':_0xe21f('0x43')}]},_0x1a3695={},_0x2e74cf={'count':0x0,'rows':[]};var _0x12dedd=_['map'](db['WhatsappAccount'][_0xe21f('0x44')],function(_0x635a9f){return{'name':_0x635a9f[_0xe21f('0x45')],'type':_0x635a9f[_0xe21f('0x46')][_0xe21f('0x47')]};});_0x1a3695['model']=_[_0xe21f('0x48')](_0x12dedd,'name');_0x1a3695[_0xe21f('0x49')]=_[_0xe21f('0x4a')](_0x16fc8d[_0xe21f('0x49')]);_0x1a3695['filters']=_[_0xe21f('0x4b')](_0x1a3695[_0xe21f('0x4c')],_0x1a3695[_0xe21f('0x49')]);_0x5a52c1[_0xe21f('0x4d')]=_[_0xe21f('0x4b')](_0x1a3695['model'],qs[_0xe21f('0x4e')](_0x16fc8d['query'][_0xe21f('0x4e')]));_0x5a52c1[_0xe21f('0x4d')]=_0x5a52c1['attributes'][_0xe21f('0x4f')]?_0x5a52c1[_0xe21f('0x4d')]:_0x1a3695[_0xe21f('0x4c')];if(!_0x16fc8d['query'][_0xe21f('0x50')](_0xe21f('0x51'))){_0x5a52c1[_0xe21f('0x36')]=qs[_0xe21f('0x36')](_0x16fc8d[_0xe21f('0x49')]['limit']);_0x5a52c1[_0xe21f('0x35')]=qs['offset'](_0x16fc8d[_0xe21f('0x49')]['offset']);}_0x5a52c1[_0xe21f('0x52')]=qs[_0xe21f('0x53')](_0x16fc8d['query'][_0xe21f('0x53')]);_0x5a52c1[_0xe21f('0x54')]=qs[_0xe21f('0x55')](_['pick'](_0x16fc8d['query'],_0x1a3695[_0xe21f('0x55')]),_0x12dedd);if(_0x16fc8d[_0xe21f('0x49')][_0xe21f('0x56')]){_0x5a52c1['where']=_[_0xe21f('0x57')](_0x5a52c1[_0xe21f('0x54')],{'$or':_[_0xe21f('0x48')](_0x12dedd,function(_0x496adc){if(_0x496adc[_0xe21f('0x46')]!==_0xe21f('0x58')){var _0xa15088={};_0xa15088[_0x496adc[_0xe21f('0x41')]]={'$like':'%'+_0x16fc8d[_0xe21f('0x49')][_0xe21f('0x56')]+'%'};return _0xa15088;}})});}_0x5a52c1=_[_0xe21f('0x57')]({},_0x5a52c1,_0x16fc8d[_0xe21f('0x59')]);var _0x1e6284={'where':_0x5a52c1[_0xe21f('0x54')]};return db[_0xe21f('0x5a')][_0xe21f('0x37')](_0x1e6284)[_0xe21f('0x26')](function(_0x33ce50){_0x2e74cf['count']=_0x33ce50;if(_0x16fc8d[_0xe21f('0x49')]['includeAll']){_0x5a52c1[_0xe21f('0x5b')]=[{'all':!![]}];}return db[_0xe21f('0x5a')][_0xe21f('0x5c')](_0x5a52c1);})[_0xe21f('0x26')](function(_0x5688b9){_0x2e74cf[_0xe21f('0x5d')]=_0x5688b9;return _0x2e74cf;})[_0xe21f('0x26')](respondWithFilteredResult(_0x725552,_0x5a52c1))[_0xe21f('0x31')](handleError(_0x725552,null));};exports[_0xe21f('0x5e')]=function(_0x394310,_0x1fa522){var _0x8ae616={'raw':![],'where':{'id':_0x394310['params']['id']},'include':[{'model':db[_0xe21f('0x42')],'as':'mandatoryDispositionPause'}]},_0x4a7ebc={};_0x4a7ebc['model']=_[_0xe21f('0x4a')](db['WhatsappAccount']['rawAttributes']);_0x4a7ebc[_0xe21f('0x49')]=_[_0xe21f('0x4a')](_0x394310['query']);_0x4a7ebc[_0xe21f('0x55')]=_[_0xe21f('0x4b')](_0x4a7ebc['model'],_0x4a7ebc[_0xe21f('0x49')]);_0x8ae616['attributes']=_['intersection'](_0x4a7ebc['model'],qs[_0xe21f('0x4e')](_0x394310[_0xe21f('0x49')]['fields']));_0x8ae616[_0xe21f('0x4d')]=_0x8ae616[_0xe21f('0x4d')]['length']?_0x8ae616['attributes']:_0x4a7ebc['model'];if(_0x394310[_0xe21f('0x49')]['includeAll']){_0x8ae616[_0xe21f('0x5b')]=[{'all':!![]}];}_0x8ae616=_[_0xe21f('0x57')]({},_0x8ae616,_0x394310[_0xe21f('0x59')]);return db['WhatsappAccount']['find'](_0x8ae616)[_0xe21f('0x26')](handleEntityNotFound(_0x1fa522,null))['then'](respondWithResult(_0x1fa522,null))[_0xe21f('0x31')](handleError(_0x1fa522,null));};exports[_0xe21f('0x5f')]=function(_0x255058,_0x229494){return db['WhatsappAccount'][_0xe21f('0x5f')](_0x255058['body'],{})[_0xe21f('0x26')](function(_0x16c80e){var _0x1896dd=_0x255058[_0xe21f('0x60')][_0xe21f('0x61')]({'plain':!![]});if(!_0x1896dd)throw new Error(_0xe21f('0x62'));if(_0x1896dd['role']===_0xe21f('0x60')){var _0x5a3851=_0x16c80e[_0xe21f('0x61')]({'plain':!![]});var _0x427c9e='WhatsappAccounts';return db[_0xe21f('0x63')][_0xe21f('0x64')]({'where':{'name':_0x427c9e,'userProfileId':_0x1896dd[_0xe21f('0x65')]},'raw':!![]})['then'](function(_0x2f657c){if(_0x2f657c&&_0x2f657c['autoAssociation']===0x0){return db[_0xe21f('0x66')][_0xe21f('0x5f')]({'name':_0x5a3851[_0xe21f('0x41')],'resourceId':_0x5a3851['id'],'type':_0x2f657c['name'],'sectionId':_0x2f657c['id']},{})['then'](function(){return _0x16c80e;});}else{return _0x16c80e;}})[_0xe21f('0x31')](function(_0x470093){logger[_0xe21f('0x2d')](_0xe21f('0x67'),_0x470093);throw _0x470093;});}return _0x16c80e;})['then'](respondWithResult(_0x229494,0xc9))[_0xe21f('0x31')](handleError(_0x229494,null));};exports[_0xe21f('0x3d')]=function(_0x481f83,_0x5e739){if(_0x481f83[_0xe21f('0x68')]['id']){delete _0x481f83[_0xe21f('0x68')]['id'];}return db[_0xe21f('0x5a')][_0xe21f('0x64')]({'where':{'id':_0x481f83['params']['id']},'include':[{'model':db[_0xe21f('0x42')],'as':_0xe21f('0x43')}]})[_0xe21f('0x26')](handleEntityNotFound(_0x5e739,null))['then'](saveUpdates(_0x481f83[_0xe21f('0x68')],null))[_0xe21f('0x26')](respondWithResult(_0x5e739,null))[_0xe21f('0x31')](handleError(_0x5e739,null));};exports['destroy']=function(_0x205a43,_0x5e475c){return db[_0xe21f('0x5a')][_0xe21f('0x64')]({'where':{'id':_0x205a43[_0xe21f('0x69')]['id']}})[_0xe21f('0x26')](handleEntityNotFound(_0x5e475c,null))['then'](removeEntity(_0x5e475c,null))[_0xe21f('0x31')](handleError(_0x5e475c,null));};exports['describe']=function(_0x48f252,_0x3eb3e7){return db[_0xe21f('0x5a')][_0xe21f('0x6a')]()[_0xe21f('0x26')](respondWithResult(_0x3eb3e7,null))[_0xe21f('0x31')](handleError(_0x3eb3e7,null));};exports[_0xe21f('0x6b')]=function(_0x27bc51,_0xb602ef,_0x1a03d3){if(_0x27bc51[_0xe21f('0x68')]['id']){delete _0x27bc51[_0xe21f('0x68')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x27bc51[_0xe21f('0x69')]['id']}})[_0xe21f('0x26')](handleEntityNotFound(_0xb602ef,null))['then'](function(_0x39fc47){if(_0x39fc47){_0x27bc51[_0xe21f('0x68')][_0xe21f('0x6c')]=_0x39fc47['id'];return db['Disposition'][_0xe21f('0x5f')](_0x27bc51[_0xe21f('0x68')]);}})[_0xe21f('0x26')](respondWithResult(_0xb602ef,null))[_0xe21f('0x31')](handleError(_0xb602ef,null));};exports[_0xe21f('0x6d')]=function(_0x4cfa3a,_0x19ba8e,_0x55e316){var _0x19f3b6={'raw':![],'where':{}};var _0x151e26={};var _0x4a91a0={'count':0x0,'rows':[]};return db[_0xe21f('0x5a')]['findOne']({'where':{'id':_0x4cfa3a[_0xe21f('0x69')]['id']}})[_0xe21f('0x26')](handleEntityNotFound(_0x19ba8e,null))[_0xe21f('0x26')](function(_0x3d1618){if(_0x3d1618){_0x151e26[_0xe21f('0x4c')]=_[_0xe21f('0x4a')](db[_0xe21f('0x6e')][_0xe21f('0x44')]);_0x151e26['query']=_['keys'](_0x4cfa3a[_0xe21f('0x49')]);_0x151e26[_0xe21f('0x55')]=_['intersection'](_0x151e26[_0xe21f('0x4c')],_0x151e26[_0xe21f('0x49')]);_0x19f3b6[_0xe21f('0x4d')]=_[_0xe21f('0x4b')](_0x151e26[_0xe21f('0x4c')],qs[_0xe21f('0x4e')](_0x4cfa3a['query'][_0xe21f('0x4e')]));_0x19f3b6[_0xe21f('0x4d')]=_0x19f3b6[_0xe21f('0x4d')][_0xe21f('0x4f')]?_0x19f3b6['attributes']:_0x151e26[_0xe21f('0x4c')];if(!_0x4cfa3a['query'][_0xe21f('0x50')](_0xe21f('0x51'))){_0x19f3b6[_0xe21f('0x36')]=qs[_0xe21f('0x36')](_0x4cfa3a[_0xe21f('0x49')][_0xe21f('0x36')]);_0x19f3b6[_0xe21f('0x35')]=qs[_0xe21f('0x35')](_0x4cfa3a[_0xe21f('0x49')][_0xe21f('0x35')]);}_0x19f3b6['order']=qs[_0xe21f('0x53')](_0x4cfa3a[_0xe21f('0x49')][_0xe21f('0x53')]);_0x19f3b6[_0xe21f('0x54')]=qs[_0xe21f('0x55')](_[_0xe21f('0x6f')](_0x4cfa3a[_0xe21f('0x49')],_0x151e26[_0xe21f('0x55')]));_0x19f3b6[_0xe21f('0x54')][_0xe21f('0x6c')]=_0x3d1618['id'];if(_0x4cfa3a[_0xe21f('0x49')][_0xe21f('0x56')]){_0x19f3b6[_0xe21f('0x54')]=_[_0xe21f('0x57')](_0x19f3b6[_0xe21f('0x54')],{'$or':_['map'](_0x19f3b6['attributes'],function(_0x2a6f62){var _0x396a55={};_0x396a55[_0x2a6f62]={'$like':'%'+_0x4cfa3a[_0xe21f('0x49')][_0xe21f('0x56')]+'%'};return _0x396a55;})});}_0x19f3b6=_['merge']({},_0x19f3b6,_0x4cfa3a['options']);return db[_0xe21f('0x6e')]['count']({'where':_0x19f3b6['where']})[_0xe21f('0x26')](function(_0x90c914){_0x4a91a0[_0xe21f('0x37')]=_0x90c914;if(_0x4cfa3a[_0xe21f('0x49')][_0xe21f('0x70')]){_0x19f3b6[_0xe21f('0x5b')]=[{'all':!![]}];}return db[_0xe21f('0x6e')][_0xe21f('0x5c')](_0x19f3b6);})[_0xe21f('0x26')](function(_0x3b8c2d){_0x4a91a0[_0xe21f('0x5d')]=_0x3b8c2d;return _0x4a91a0;});}})[_0xe21f('0x26')](respondWithFilteredResult(_0x19ba8e,_0x19f3b6))['catch'](handleError(_0x19ba8e,null));};exports[_0xe21f('0x71')]=function(_0x190303,_0x456fed,_0x1ee16e){return db[_0xe21f('0x5a')][_0xe21f('0x64')]({'where':{'id':_0x190303[_0xe21f('0x69')]['id']}})[_0xe21f('0x26')](handleEntityNotFound(_0x456fed,null))['then'](function(_0x2f7bdc){if(_0x2f7bdc){return _0x2f7bdc[_0xe21f('0x71')](_0x190303['query']['ids']);}})[_0xe21f('0x26')](respondWithStatusCode(_0x456fed,null))['catch'](handleError(_0x456fed,null));};exports[_0xe21f('0x72')]=function(_0x16b29d,_0x587550,_0x18a121){if(_0x16b29d['body']['id']){delete _0x16b29d[_0xe21f('0x68')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x16b29d[_0xe21f('0x69')]['id']}})[_0xe21f('0x26')](handleEntityNotFound(_0x587550,null))[_0xe21f('0x26')](function(_0x5a6fa1){if(_0x5a6fa1){_0x16b29d[_0xe21f('0x68')][_0xe21f('0x6c')]=_0x5a6fa1['id'];return db[_0xe21f('0x73')][_0xe21f('0x5f')](_0x16b29d['body']);}})['then'](respondWithResult(_0x587550,null))[_0xe21f('0x31')](handleError(_0x587550,null));};exports[_0xe21f('0x74')]=function(_0x22639f,_0x4ee33c,_0x280eb2){var _0xe3ae4a={'raw':![],'where':{}};var _0x5eb7be={};var _0x4ee6de={'count':0x0,'rows':[]};return db[_0xe21f('0x5a')][_0xe21f('0x75')]({'where':{'id':_0x22639f[_0xe21f('0x69')]['id']}})['then'](handleEntityNotFound(_0x4ee33c,null))[_0xe21f('0x26')](function(_0x17a042){if(_0x17a042){_0x5eb7be[_0xe21f('0x4c')]=_[_0xe21f('0x4a')](db[_0xe21f('0x73')][_0xe21f('0x44')]);_0x5eb7be[_0xe21f('0x49')]=_[_0xe21f('0x4a')](_0x22639f[_0xe21f('0x49')]);_0x5eb7be[_0xe21f('0x55')]=_['intersection'](_0x5eb7be['model'],_0x5eb7be['query']);_0xe3ae4a['attributes']=_[_0xe21f('0x4b')](_0x5eb7be['model'],qs['fields'](_0x22639f[_0xe21f('0x49')][_0xe21f('0x4e')]));_0xe3ae4a[_0xe21f('0x4d')]=_0xe3ae4a['attributes'][_0xe21f('0x4f')]?_0xe3ae4a[_0xe21f('0x4d')]:_0x5eb7be[_0xe21f('0x4c')];if(!_0x22639f[_0xe21f('0x49')][_0xe21f('0x50')](_0xe21f('0x51'))){_0xe3ae4a['limit']=qs['limit'](_0x22639f[_0xe21f('0x49')][_0xe21f('0x36')]);_0xe3ae4a[_0xe21f('0x35')]=qs[_0xe21f('0x35')](_0x22639f[_0xe21f('0x49')][_0xe21f('0x35')]);}_0xe3ae4a[_0xe21f('0x52')]=qs[_0xe21f('0x53')](_0x22639f['query'][_0xe21f('0x53')]);_0xe3ae4a[_0xe21f('0x54')]=qs[_0xe21f('0x55')](_[_0xe21f('0x6f')](_0x22639f[_0xe21f('0x49')],_0x5eb7be[_0xe21f('0x55')]));_0xe3ae4a[_0xe21f('0x54')][_0xe21f('0x6c')]=_0x17a042['id'];if(_0x22639f[_0xe21f('0x49')][_0xe21f('0x56')]){_0xe3ae4a[_0xe21f('0x54')]=_['merge'](_0xe3ae4a[_0xe21f('0x54')],{'$or':_['map'](_0xe3ae4a[_0xe21f('0x4d')],function(_0x3933ca){var _0x3b6d82={};_0x3b6d82[_0x3933ca]={'$like':'%'+_0x22639f[_0xe21f('0x49')][_0xe21f('0x56')]+'%'};return _0x3b6d82;})});}_0xe3ae4a=_[_0xe21f('0x57')]({},_0xe3ae4a,_0x22639f[_0xe21f('0x59')]);return db[_0xe21f('0x73')][_0xe21f('0x37')]({'where':_0xe3ae4a['where']})[_0xe21f('0x26')](function(_0x452da7){_0x4ee6de[_0xe21f('0x37')]=_0x452da7;if(_0x22639f[_0xe21f('0x49')][_0xe21f('0x70')]){_0xe3ae4a[_0xe21f('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe21f('0x5c')](_0xe3ae4a);})[_0xe21f('0x26')](function(_0x285fe3){_0x4ee6de['rows']=_0x285fe3;return _0x4ee6de;});}})[_0xe21f('0x26')](respondWithFilteredResult(_0x4ee33c,_0xe3ae4a))[_0xe21f('0x31')](handleError(_0x4ee33c,null));};exports[_0xe21f('0x76')]=function(_0x42cc47,_0x3f441e,_0x4d2366){return db[_0xe21f('0x5a')][_0xe21f('0x64')]({'where':{'id':_0x42cc47[_0xe21f('0x69')]['id']}})['then'](handleEntityNotFound(_0x3f441e,null))[_0xe21f('0x26')](function(_0x1ccf1d){if(_0x1ccf1d){return _0x1ccf1d['removeAnswers'](_0x42cc47[_0xe21f('0x49')][_0xe21f('0x77')]);}})['then'](respondWithStatusCode(_0x3f441e,null))[_0xe21f('0x31')](handleError(_0x3f441e,null));};exports[_0xe21f('0x78')]=function(_0x55090c,_0x198a4f,_0x1cba8d){return db['WhatsappAccount'][_0xe21f('0x64')]({'where':{'id':_0x55090c[_0xe21f('0x69')]['id']}})['then'](handleEntityNotFound(_0x198a4f,null))[_0xe21f('0x26')](function(_0x49722e){if(_0x49722e){return _0x49722e[_0xe21f('0x78')](_0x55090c[_0xe21f('0x68')]['ids'],_[_0xe21f('0x79')](_0x55090c[_0xe21f('0x68')],['ids','id'])||{})['spread'](function(_0x3b53f3){for(var _0x1f84c4=0x0;_0x1f84c4<_0x55090c[_0xe21f('0x68')][_0xe21f('0x77')]['length'];_0x1f84c4+=0x1){socket[_0xe21f('0x7a')]('userWhatsappAccount:save',{'UserId':Number(_0x55090c['body']['ids'][_0x1f84c4]),'WhatsappAccountId':Number(_0x55090c[_0xe21f('0x69')]['id'])});}return _0x3b53f3;});}})[_0xe21f('0x26')](respondWithResult(_0x198a4f,null))[_0xe21f('0x31')](handleError(_0x198a4f,null));};exports['removeAgents']=function(_0x5078c8,_0xec96df,_0xf9d381){return db[_0xe21f('0x5a')][_0xe21f('0x64')]({'where':{'id':_0x5078c8[_0xe21f('0x69')]['id']}})['then'](handleEntityNotFound(_0xec96df,null))[_0xe21f('0x26')](function(_0x359e41){if(_0x359e41){return _0x359e41[_0xe21f('0x7b')](_0x5078c8[_0xe21f('0x49')][_0xe21f('0x77')])['then'](function(){if(_['isArray'](_0x5078c8[_0xe21f('0x49')][_0xe21f('0x77')])){for(var _0x33851e=0x0;_0x33851e<_0x5078c8[_0xe21f('0x49')][_0xe21f('0x77')]['length'];_0x33851e+=0x1){socket[_0xe21f('0x7a')]('userWhatsappAccount:remove',{'UserId':Number(_0x5078c8['query'][_0xe21f('0x77')][_0x33851e]),'WhatsappAccountId':Number(_0x5078c8[_0xe21f('0x69')]['id'])});}}else{socket[_0xe21f('0x7a')](_0xe21f('0x7c'),{'UserId':Number(_0x5078c8[_0xe21f('0x49')]['ids']),'WhatsappAccountId':Number(_0x5078c8[_0xe21f('0x69')]['id'])});}});}})['then'](respondWithStatusCode(_0xec96df,null))[_0xe21f('0x31')](handleError(_0xec96df,null));};exports[_0xe21f('0x7d')]=function(_0xe9973f,_0x34b7cc,_0x3bb4e8){var _0x4aad2b={};var _0x5808bb={};var _0x261bfc;var _0x47efab;return db[_0xe21f('0x5a')][_0xe21f('0x75')]({'where':{'id':_0xe9973f[_0xe21f('0x69')]['id']}})[_0xe21f('0x26')](handleEntityNotFound(_0x34b7cc,null))[_0xe21f('0x26')](function(_0x296b14){if(_0x296b14){_0x261bfc=_0x296b14;_0x5808bb['model']=_[_0xe21f('0x4a')](db[_0xe21f('0x7e')][_0xe21f('0x44')]);_0x5808bb[_0xe21f('0x49')]=_['keys'](_0xe9973f[_0xe21f('0x49')]);_0x5808bb['filters']=_[_0xe21f('0x4b')](_0x5808bb[_0xe21f('0x4c')],_0x5808bb[_0xe21f('0x49')]);_0x4aad2b[_0xe21f('0x4d')]=_[_0xe21f('0x4b')](_0x5808bb[_0xe21f('0x4c')],qs[_0xe21f('0x4e')](_0xe9973f['query'][_0xe21f('0x4e')]));_0x4aad2b['attributes']=_0x4aad2b['attributes'][_0xe21f('0x4f')]?_0x4aad2b[_0xe21f('0x4d')]:_0x5808bb[_0xe21f('0x4c')];_0x4aad2b[_0xe21f('0x52')]=qs[_0xe21f('0x53')](_0xe9973f[_0xe21f('0x49')][_0xe21f('0x53')]);_0x4aad2b[_0xe21f('0x54')]=qs[_0xe21f('0x55')](_[_0xe21f('0x6f')](_0xe9973f[_0xe21f('0x49')],_0x5808bb[_0xe21f('0x55')]));if(_0xe9973f[_0xe21f('0x49')][_0xe21f('0x56')]){_0x4aad2b[_0xe21f('0x54')]=_[_0xe21f('0x57')](_0x4aad2b[_0xe21f('0x54')],{'$or':_['map'](_0x4aad2b[_0xe21f('0x4d')],function(_0x241e1a){var _0x1a3505={};_0x1a3505[_0x241e1a]={'$like':'%'+_0xe9973f[_0xe21f('0x49')][_0xe21f('0x56')]+'%'};return _0x1a3505;})});}_0x4aad2b=_[_0xe21f('0x57')]({},_0x4aad2b,_0xe9973f[_0xe21f('0x59')]);return _0x261bfc['getAgents'](_0x4aad2b);}})['then'](function(_0x117a94){if(_0x117a94){_0x47efab=_0x117a94['length'];if(!_0xe9973f[_0xe21f('0x49')][_0xe21f('0x50')]('nolimit')){_0x4aad2b[_0xe21f('0x36')]=qs['limit'](_0xe9973f[_0xe21f('0x49')][_0xe21f('0x36')]);_0x4aad2b[_0xe21f('0x35')]=qs[_0xe21f('0x35')](_0xe9973f[_0xe21f('0x49')][_0xe21f('0x35')]);}return _0x261bfc[_0xe21f('0x7d')](_0x4aad2b);}})[_0xe21f('0x26')](function(_0x524260){if(_0x524260){return _0x524260?{'count':_0x47efab,'rows':_0x524260}:null;}})[_0xe21f('0x26')](respondWithResult(_0x34b7cc,null))[_0xe21f('0x31')](handleError(_0x34b7cc,null));};exports['addApplications']=function(_0x2f2a4e,_0x48b66d){var _0x29c9df=_0x2f2a4e[_0xe21f('0x69')]['id'];var _0x16d1cd=_0x2f2a4e[_0xe21f('0x68')];var _0xacb149=0xc8;var _0x59facc=null;return db[_0xe21f('0x7f')]['transaction']({'isolationLevel':db['sequelize'][_0xe21f('0x80')][_0xe21f('0x81')]['READ_COMMITTED']},function(_0x141515){return db[_0xe21f('0x5a')][_0xe21f('0x75')]({'where':{'id':_0x29c9df},'transaction':_0x141515})[_0xe21f('0x26')](function(_0x4526e4){if(_0x4526e4){return db[_0xe21f('0x82')][_0xe21f('0x3e')]({'where':{'WhatsappAccountId':_0x29c9df},'transaction':_0x141515})[_0xe21f('0x26')](function(){var _0x45a4cc=_['map'](_0x16d1cd,function(_0x2c5c53){_0x2c5c53[_0xe21f('0x6c')]=_0x29c9df;return _0x2c5c53;});return db[_0xe21f('0x82')]['bulkCreate'](_0x45a4cc,{'transaction':_0x141515});});}else{_0xacb149=0x194;_0x59facc=[];}});})[_0xe21f('0x26')](function(){if(_0xacb149!==0x194){return db[_0xe21f('0x82')][_0xe21f('0x83')]({'where':{'WhatsappAccountId':_0x29c9df},'order':_0xe21f('0x84')})[_0xe21f('0x26')](function(_0x28b8a8){_0x59facc=_0x28b8a8;});}})[_0xe21f('0x31')](function(_0x2aa1a7){_0xacb149=0x1f4;logger[_0xe21f('0x2d')](_0x2aa1a7[_0xe21f('0x85')]);if(_0x2aa1a7[_0xe21f('0x41')]){delete _0x2aa1a7[_0xe21f('0x41')];}_0x59facc=_0x2aa1a7;})[_0xe21f('0x86')](function(){if(_0x59facc===null){_0x48b66d['sendStatus'](_0xacb149);}else{if(_0xacb149===0x1f4){_0x48b66d[_0xe21f('0x32')](_0xacb149)[_0xe21f('0x87')](_0x59facc);}else{_0x48b66d['status'](_0xacb149)['json'](_0x59facc);}}});};exports[_0xe21f('0x88')]=function(_0x10bc74,_0x2e8a40,_0x1abb60){var _0x382579={};var _0x4d1e95={};var _0x419ca7;var _0x40450a;return db['WhatsappAccount'][_0xe21f('0x75')]({'where':{'id':_0x10bc74[_0xe21f('0x69')]['id']}})[_0xe21f('0x26')](handleEntityNotFound(_0x2e8a40,null))[_0xe21f('0x26')](function(_0x48f533){if(_0x48f533){_0x419ca7=_0x48f533;_0x4d1e95[_0xe21f('0x4c')]=_[_0xe21f('0x4a')](db[_0xe21f('0x82')][_0xe21f('0x44')]);_0x4d1e95[_0xe21f('0x49')]=_[_0xe21f('0x4a')](_0x10bc74[_0xe21f('0x49')]);_0x4d1e95[_0xe21f('0x55')]=_[_0xe21f('0x4b')](_0x4d1e95['model'],_0x4d1e95[_0xe21f('0x49')]);_0x382579[_0xe21f('0x4d')]=_[_0xe21f('0x4b')](_0x4d1e95['model'],qs['fields'](_0x10bc74['query'][_0xe21f('0x4e')]));_0x382579[_0xe21f('0x4d')]=_0x382579['attributes'][_0xe21f('0x4f')]?_0x382579[_0xe21f('0x4d')]:_0x4d1e95[_0xe21f('0x4c')];_0x382579['order']=qs[_0xe21f('0x53')](_0x10bc74['query'][_0xe21f('0x53')]);_0x382579[_0xe21f('0x54')]=qs[_0xe21f('0x55')](_['pick'](_0x10bc74[_0xe21f('0x49')],_0x4d1e95['filters']));if(_0x10bc74[_0xe21f('0x49')]['filter']){_0x382579[_0xe21f('0x54')]=_[_0xe21f('0x57')](_0x382579[_0xe21f('0x54')],{'$or':_[_0xe21f('0x48')](_0x382579[_0xe21f('0x4d')],function(_0x595a18){var _0x43ccbc={};_0x43ccbc[_0x595a18]={'$like':'%'+_0x10bc74[_0xe21f('0x49')]['filter']+'%'};return _0x43ccbc;})});}_0x382579=_[_0xe21f('0x57')]({},_0x382579,_0x10bc74['options']);return _0x419ca7['getApplications'](_0x382579);}})[_0xe21f('0x26')](function(_0x4cf054){if(_0x4cf054){_0x40450a=_0x4cf054[_0xe21f('0x4f')];if(!_0x10bc74[_0xe21f('0x49')][_0xe21f('0x50')](_0xe21f('0x51'))){_0x382579['limit']=qs[_0xe21f('0x36')](_0x10bc74['query'][_0xe21f('0x36')]);_0x382579[_0xe21f('0x35')]=qs[_0xe21f('0x35')](_0x10bc74[_0xe21f('0x49')][_0xe21f('0x35')]);}return _0x419ca7[_0xe21f('0x88')](_0x382579);}})[_0xe21f('0x26')](function(_0x3f686f){if(_0x3f686f){return _0x3f686f?{'count':_0x40450a,'rows':_0x3f686f}:null;}})['then'](respondWithResult(_0x2e8a40,null))['catch'](handleError(_0x2e8a40,null));};exports[_0xe21f('0x89')]=function(_0x361ffd,_0x1518bd,_0x44244f){var _0x24e433={'channel':_0xe21f('0x8a')};var _0x5a84f7=[];var _0x3aae92=[];var _0x2d3a2a={};return db[_0xe21f('0x5a')][_0xe21f('0x64')]({'where':{'id':_0x361ffd[_0xe21f('0x69')]['id']},'include':[{'model':db[_0xe21f('0x82')],'as':_0xe21f('0x8b')}]})[_0xe21f('0x26')](handleEntityNotFound(_0x1518bd,null))[_0xe21f('0x26')](function(_0x42e5e6){_0x24e433[_0xe21f('0x8c')]=_0x42e5e6;if(_0x24e433[_0xe21f('0x8c')]&&_0x24e433[_0xe21f('0x8c')]['type']===_0xe21f('0x8d')&&_0x361ffd[_0xe21f('0x68')][_0xe21f('0x8e')]){if(_0x361ffd[_0xe21f('0x68')][_0xe21f('0x8e')][_0xe21f('0x4f')]===0x0)return;if(_0x361ffd[_0xe21f('0x68')][_0xe21f('0x8e')][0x0][_0xe21f('0x8f')]!=='read')return;return db['WhatsappMessage'][_0xe21f('0x3d')]({'read':!![],'readAt':_0x361ffd[_0xe21f('0x68')][_0xe21f('0x8e')][0x0][_0xe21f('0x90')]},{'where':{'messageId':_0x361ffd['body'][_0xe21f('0x8e')][0x0][_0xe21f('0x91')]},'individualHooks':!![]})[_0xe21f('0x26')](function(_0x2bd865){return _0x1518bd['status'](0xc8)[_0xe21f('0x34')](_0x2bd865);});}_0x24e433[_0xe21f('0x92')]=_[_0xe21f('0x93')](_0x42e5e6[_0xe21f('0x8b')],['priority'],[_0xe21f('0x94')]);if(_0x24e433[_0xe21f('0x8c')][_0xe21f('0x8b')]){delete _0x24e433[_0xe21f('0x8c')][_0xe21f('0x8b')];}return db[_0xe21f('0x95')][_0xe21f('0x6a')]()[_0xe21f('0x26')](function(_0x2713b6){if(!_0x2713b6){throw new db[(_0xe21f('0x96'))][(_0xe21f('0x97'))](_0xe21f('0x98'));}_0x5a84f7=_[_0xe21f('0x99')](_[_0xe21f('0x4a')](_0x2713b6),[_0xe21f('0x9a'),'updatedAt']);_0x3aae92=_[_0xe21f('0x99')](_[_0xe21f('0x4a')](_0x2713b6),[_0xe21f('0x9a'),'updatedAt','CompanyId',_0xe21f('0x9b')]);_0x24e433[_0xe21f('0x68')]={'mapKey':'mobile'};if(_0x24e433[_0xe21f('0x8c')]&&_0x24e433[_0xe21f('0x8c')][_0xe21f('0x46')]===_0xe21f('0x9c')){_0x24e433[_0xe21f('0x68')][_0xe21f('0x9d')]=_0x361ffd[_0xe21f('0x68')]['From'][_0xe21f('0x9e')]('whatsapp:','');_0x24e433[_0xe21f('0x68')]['body']=_0x361ffd[_0xe21f('0x68')]['Body'];_0x24e433['body'][_0xe21f('0x9f')]=_0x361ffd['body']['MessageSid'];}if(_0x24e433[_0xe21f('0x8c')]&&_0x24e433[_0xe21f('0x8c')][_0xe21f('0x46')]===_0xe21f('0x8d')){_0x24e433[_0xe21f('0x68')][_0xe21f('0x9d')]=_0x361ffd[_0xe21f('0x68')][_0xe21f('0xa0')][0x0][_0xe21f('0x9d')];_0x24e433[_0xe21f('0x68')]['body']=_0x361ffd['body'][_0xe21f('0xa0')][0x0]['message']['body'];_0x24e433[_0xe21f('0x68')][_0xe21f('0x9f')]=_0x361ffd[_0xe21f('0x68')][_0xe21f('0xa0')][0x0]['message_id'];}if(_0x24e433[_0xe21f('0x68')]['id']){delete _0x24e433[_0xe21f('0x68')]['id'];}if(_[_0xe21f('0xa1')](_0x24e433[_0xe21f('0x68')][_0xe21f('0x9d')])){throw new db[(_0xe21f('0x96'))][(_0xe21f('0x97'))]('from\x20is\x20mandatory');}if(_[_0xe21f('0xa1')](_0x24e433[_0xe21f('0x68')][_0xe21f('0x68')])||_0x24e433[_0xe21f('0x68')][_0xe21f('0x68')]===''){throw new db[(_0xe21f('0x96'))]['ValidationError'](_0xe21f('0xa2'));}if(_['isNil'](_0x24e433[_0xe21f('0x68')][_0xe21f('0xa3')])){throw new db['Sequelize'][(_0xe21f('0x97'))](_0xe21f('0xa4')+_0x3aae92);}if(!_[_0xe21f('0xa5')](_0x3aae92,_0x24e433[_0xe21f('0x68')][_0xe21f('0xa3')])){throw new db[(_0xe21f('0x96'))][(_0xe21f('0x97'))](_0xe21f('0xa6')+_0x3aae92);}_0x2d3a2a[_0x24e433[_0xe21f('0x68')][_0xe21f('0xa3')]]=_0x24e433[_0xe21f('0x68')]['from'];return db[_0xe21f('0xa7')][_0xe21f('0x64')]({'where':{'id':_0x24e433[_0xe21f('0x8c')][_0xe21f('0x9b')]},'include':[{'model':db['CmContact'],'as':_0xe21f('0xa8'),'where':_0x2d3a2a,'limit':0x1,'order':[[_0xe21f('0xa9'),_0xe21f('0xaa')]]}]});})[_0xe21f('0x26')](handleEntityNotFound(_0x1518bd,null))['then'](function(_0x4376ee){if(_0x4376ee){_0x24e433['list']=_[_0xe21f('0x79')](_0x4376ee,[_0xe21f('0xa8')]);if(_0x4376ee[_0xe21f('0xa8')][_0xe21f('0x4f')]){return _0x4376ee['Contacts'][0x0];}var _0x930dd9=_[_0xe21f('0x1d')](_0x24e433[_0xe21f('0x68')],{'firstName':_0x24e433['body'][_0xe21f('0x9d')],'ListId':_0x4376ee['id']});_0x930dd9[_0x24e433[_0xe21f('0x68')][_0xe21f('0xa3')]]=_0x24e433[_0xe21f('0x68')][_0xe21f('0x9d')];return db[_0xe21f('0x95')][_0xe21f('0x5f')](_0x930dd9,{'fields':_0x5a84f7,'raw':!![]});}})['then'](handleEntityNotFound(_0x1518bd,null))['then'](function(_0x5c1d2b){if(_0x5c1d2b){_0x24e433[_0xe21f('0xab')]=_0x5c1d2b;var _0xc48c78={'ContactId':_0x5c1d2b['id'],'phone':_0x24e433[_0xe21f('0x68')][_0xe21f('0x9d')],'WhatsappAccountId':_0x361ffd[_0xe21f('0x69')]['id']};var _0x1b7fcd={'ContactId':_0x5c1d2b['id'],'WhatsappAccountId':_0x361ffd[_0xe21f('0x69')]['id'],'closed':![]};return db[_0xe21f('0xac')][_0xe21f('0x64')]({'where':_0x1b7fcd})[_0xe21f('0x26')](function(_0x1681af){if(_0x1681af){return[_0x1681af,![]];}return db[_0xe21f('0xac')]['create'](_0xc48c78)[_0xe21f('0x26')](function(_0x35bee1){return[_0x35bee1,!![]];});});}})[_0xe21f('0xad')](function(_0x2ffccc,_0x4fc6ce){_0x24e433[_0xe21f('0xae')]=_0x2ffccc['get']({'plain':!![]});_0x24e433[_0xe21f('0xae')]['created']=![];if(_0x4fc6ce){if(_0x24e433[_0xe21f('0x8c')][_0xe21f('0xaf')]){_0x24e433[_0xe21f('0x92')]['push']({'id':0x0,'priority':_0x24e433['applications']['length']+0x1,'app':_0xe21f('0xb0'),'appdata':'unmanaged','interval':_0xe21f('0xb1')});}_0x24e433['interaction']['created']=!![];}return db[_0xe21f('0xb2')][_0xe21f('0x5f')]({'phone':_0x24e433['body'][_0xe21f('0x9d')],'messageId':_0x24e433[_0xe21f('0x68')]['messageId'],'body':_0x24e433[_0xe21f('0x68')]['body'],'WhatsappAccountId':_0x361ffd[_0xe21f('0x69')]['id'],'WhatsappInteractionId':_0x2ffccc['id'],'direction':'in','ContactId':_0x2ffccc[_0xe21f('0xb3')],'AttachmentId':_0x24e433[_0xe21f('0x68')][_0xe21f('0xb4')]});})[_0xe21f('0x26')](function(_0x2bd4c0){_0x24e433[_0xe21f('0x2f')]=_0x2bd4c0;if(!_0x24e433['interaction'][_0xe21f('0xb5')])return;return db[_0xe21f('0x7e')]['find']({'attributes':['id',_0xe21f('0x41')],'where':{'id':_0x24e433[_0xe21f('0xae')][_0xe21f('0xb5')]}});})[_0xe21f('0x26')](function(_0x5b2616){if(_0x5b2616){_0x24e433['applications'][_0xe21f('0xb6')]({'id':0x0,'priority':0x0,'app':_0xe21f('0xb7'),'appdata':_0x5b2616[_0xe21f('0x41')]+','+(_0x24e433[_0xe21f('0x8c')][_0xe21f('0xb8')]||0xa),'interval':_0xe21f('0xb1')});}if(!_0x24e433[_0xe21f('0xae')][_0xe21f('0xb9')])return;return db[_0xe21f('0xba')][_0xe21f('0x64')]({'attributes':['id',_0xe21f('0x41')],'where':{'id':_0x24e433[_0xe21f('0xae')][_0xe21f('0xb9')]}});})['then'](function(_0x14e5ce){if(_0x14e5ce){_0x24e433['applications'][_0xe21f('0xb6')]({'id':0x0,'priority':0x1,'app':_0xe21f('0xbb'),'appdata':_0x14e5ce['name']+','+(_0x24e433[_0xe21f('0x8c')][_0xe21f('0xbc')]||0x12c),'interval':_0xe21f('0xb1')});}return respondWithRpcPromise(_0xe21f('0xbd'),_0xe21f('0xbe'),_0x24e433);})['then'](function(_0x51fe8c){if(_0x51fe8c){var _0x18c598=0xc8;var _0x5bb3c5=_0xe21f('0xbf');logger['info'](_0xe21f('0x2b'),_0x5bb3c5,_0x18c598,_0xe21f('0xc0'));logger[_0xe21f('0x2a')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5bb3c5,_0x18c598,_0xe21f('0xc0'),JSON[_0xe21f('0x2c')](_0x51fe8c));if(_0x24e433[_0xe21f('0x8c')][_0xe21f('0x46')]==='twilio'){return _0x1518bd['status'](_0x18c598)['set'](_0xe21f('0xc1'),_0xe21f('0xc2'))['send'](_0xe21f('0xc3'));}else{return _0x1518bd[_0xe21f('0x32')](_0x18c598)['json'](_0x51fe8c);}}});})[_0xe21f('0x31')](handleError(_0x1518bd,null));};exports['send']=function(_0x3e6d16,_0xaf1dba,_0x265bc8){var _0x5d7807,_0x22b05b,_0x44fda0;if(_[_0xe21f('0xa1')](_0x3e6d16['body']['body'])||_0x3e6d16['body']['body']===''){throw new db[(_0xe21f('0x96'))][(_0xe21f('0x97'))](_0xe21f('0xa2'));}if(_[_0xe21f('0xa1')](_0x3e6d16[_0xe21f('0x68')]['to'])){throw new db[(_0xe21f('0x96'))][(_0xe21f('0x97'))](_0xe21f('0xc4'));}_0x5d7807=_0x3e6d16['body']['to'];return db[_0xe21f('0x5a')][_0xe21f('0x64')]({'where':{'id':_0x3e6d16[_0xe21f('0x69')]['id']},'include':[{'model':db[_0xe21f('0xa7')],'as':_0xe21f('0xc5'),'include':[{'model':db[_0xe21f('0x95')],'as':_0xe21f('0xa8'),'where':{'mobile':_0x5d7807},'limit':0x1,'order':[[_0xe21f('0xa9'),_0xe21f('0xaa')]]}]}]})['then'](handleEntityNotFound(_0xaf1dba,null))['then'](function(_0x2f1364){if(_0x2f1364&&_0x2f1364['List']){_0x22b05b=_0x2f1364['get']({'plain':!![]});if(_0x22b05b['List']&&_0x22b05b['List']['Contacts'][_0xe21f('0x4f')]){return _0x22b05b[_0xe21f('0xc5')][_0xe21f('0xa8')][0x0];}return db['CmContact'][_0xe21f('0x5f')](_['defaults'](_0x3e6d16['body'],{'firstName':_0x5d7807,'mobile':_0x5d7807,'phone':_0x5d7807,'ListId':_0x22b05b[_0xe21f('0x9b')]}));}})[_0xe21f('0x26')](handleEntityNotFound(_0xaf1dba,null))[_0xe21f('0x26')](function(_0x8464c4){if(_0x8464c4){_0x44fda0=_0x8464c4;return db[_0xe21f('0xac')][_0xe21f('0x64')]({'where':{'ContactId':_0x44fda0['id'],'closed':![],'WhatsappAccountId':_0x22b05b['id']}})[_0xe21f('0x26')](function(_0x50fc7b){if(_0x50fc7b){return[_0x50fc7b,![]];}return db[_0xe21f('0xac')][_0xe21f('0x5f')]({'UserId':_0x3e6d16[_0xe21f('0x60')]['id'],'ContactId':_0x44fda0['id'],'WhatsappAccountId':_0x22b05b['id'],'phone':_0x5d7807,'firstMsgDirection':_0xe21f('0xc6'),'Messages':[_[_0xe21f('0x57')](_0x3e6d16['body'],{'read':![],'body':_0x3e6d16[_0xe21f('0x68')]['body'],'phone':_0x5d7807,'WhatsappAccountId':_0x22b05b['id'],'UserId':_0x3e6d16['user']['id'],'ContactId':_0x44fda0['id']})]},{'include':[{'model':db[_0xe21f('0xb2')],'as':'Messages'}]})[_0xe21f('0x26')](function(_0x23f67b){return[_0x23f67b,!![]];});});}})[_0xe21f('0xad')](function(_0x5d1827,_0xf3221d){if(_0xf3221d){return _0x5d1827;}return db[_0xe21f('0xb2')]['create'](_['merge'](_0x3e6d16[_0xe21f('0x68')],{'read':![],'body':_0x3e6d16[_0xe21f('0x68')][_0xe21f('0x68')],'phone':_0x5d7807,'WhatsappAccountId':_0x22b05b['id'],'WhatsappInteractionId':_0x5d1827['id'],'UserId':_0x3e6d16['user']['id'],'ContactId':_0x44fda0['id']}))[_0xe21f('0x26')](function(_0x7d91ac){_0x5d1827['dataValues'][_0xe21f('0xc7')]=[];_0x5d1827[_0xe21f('0xc8')]['Messages']['push'](_0x7d91ac['dataValues']);return _0x5d1827;});})[_0xe21f('0x26')](respondWithResult(_0xaf1dba,null))[_0xe21f('0x31')](handleError(_0xaf1dba,null));}; \ No newline at end of file +var _0xbbe3=['Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','create','body','user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','message_id','orderBy','priority','asc','Sequelize','ValidationError','difference','createdAt','ListId','mobile','twilio','from','replace','whatsapp:','Body','MessageSid','notifications','messageId','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','CmContact','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC'];(function(_0x2de0cb,_0x572968){var _0xa3367c=function(_0x5935ea){while(--_0x5935ea){_0x2de0cb['push'](_0x2de0cb['shift']());}};_0xa3367c(++_0x572968);}(_0xbbe3,0x19c));var _0x3bbe=function(_0x146734,_0xa4f5fd){_0x146734=_0x146734-0x0;var _0x10d7c4=_0xbbe3[_0x146734];return _0x10d7c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bbe('0x0'));var zipdir=require(_0x3bbe('0x1'));var jsonpatch=require(_0x3bbe('0x2'));var rp=require(_0x3bbe('0x3'));var moment=require(_0x3bbe('0x4'));var BPromise=require(_0x3bbe('0x5'));var Mustache=require(_0x3bbe('0x6'));var util=require(_0x3bbe('0x7'));var path=require(_0x3bbe('0x8'));var sox=require(_0x3bbe('0x9'));var csv=require(_0x3bbe('0xa'));var ejs=require(_0x3bbe('0xb'));var fs=require('fs');var fs_extra=require(_0x3bbe('0xc'));var _=require(_0x3bbe('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3bbe('0xe'));var deskjs=require(_0x3bbe('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3bbe('0x10'));var Redis=require(_0x3bbe('0x11'));var authService=require(_0x3bbe('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3bbe('0x13'));var hardwareService=require(_0x3bbe('0x14'));var logger=require(_0x3bbe('0x15'))(_0x3bbe('0x16'));var utils=require(_0x3bbe('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3bbe('0x18'))['db'];config[_0x3bbe('0x19')]=_[_0x3bbe('0x1a')](config[_0x3bbe('0x19')],{'host':_0x3bbe('0x1b'),'port':0x18eb});var socket=require(_0x3bbe('0x1c'))(new Redis(config[_0x3bbe('0x19')]));require('./whatsappAccount.socket')[_0x3bbe('0x1d')](socket);var jayson=require(_0x3bbe('0x1e'));var client=jayson[_0x3bbe('0x1f')][_0x3bbe('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x7d3a2c,_0x1e2d3e,_0x20ff5c,_0x334cbf){return new BPromise(function(_0x17993e,_0xe8fbeb){var _0x25c567=_0x334cbf||client;return _0x25c567[_0x3bbe('0x21')](_0x7d3a2c,_0x20ff5c)[_0x3bbe('0x22')](function(_0x59674a){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1e2d3e,'request\x20sent');logger[_0x3bbe('0x23')](_0x3bbe('0x24'),_0x1e2d3e,_0x3bbe('0x25'),JSON[_0x3bbe('0x26')](_0x59674a));if(_0x59674a['error']){if(_0x59674a[_0x3bbe('0x27')][_0x3bbe('0x28')]===0x1f4){logger[_0x3bbe('0x27')](_0x3bbe('0x29'),_0x1e2d3e,_0x59674a[_0x3bbe('0x27')][_0x3bbe('0x2a')]);return _0xe8fbeb(_0x59674a[_0x3bbe('0x27')]['message']);}logger[_0x3bbe('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x1e2d3e,_0x59674a['error'][_0x3bbe('0x2a')]);return _0x17993e(_0x59674a[_0x3bbe('0x27')][_0x3bbe('0x2a')]);}else{logger[_0x3bbe('0x2b')](_0x3bbe('0x29'),_0x1e2d3e,_0x3bbe('0x25'));_0x17993e(_0x59674a[_0x3bbe('0x2c')][_0x3bbe('0x2a')]);}})[_0x3bbe('0x2d')](function(_0x583c81){logger['error'](_0x3bbe('0x29'),_0x1e2d3e,_0x583c81);_0xe8fbeb(_0x583c81);});});}function respondWithStatusCode(_0x504ae9,_0x2e6beb){_0x2e6beb=_0x2e6beb||0xcc;return function(_0x17ab50){if(_0x17ab50){return _0x504ae9[_0x3bbe('0x2e')](_0x2e6beb);}return _0x504ae9[_0x3bbe('0x2f')](_0x2e6beb)[_0x3bbe('0x30')]();};}function respondWithResult(_0x52aa7a,_0x30dc57){_0x30dc57=_0x30dc57||0xc8;return function(_0x40f3b1){if(_0x40f3b1){return _0x52aa7a[_0x3bbe('0x2f')](_0x30dc57)['json'](_0x40f3b1);}};}function respondWithFilteredResult(_0xd6f874,_0xca27fe){return function(_0x5e95d3){if(_0x5e95d3){var _0x45d2be=typeof _0xca27fe['offset']===_0x3bbe('0x31')&&typeof _0xca27fe[_0x3bbe('0x32')]===_0x3bbe('0x31');var _0x20fc6a=_0x5e95d3['count'];var _0x3e0ad4=_0x45d2be?0x0:_0xca27fe['offset'];var _0x433983=_0x45d2be?_0x5e95d3[_0x3bbe('0x33')]:_0xca27fe[_0x3bbe('0x34')]+_0xca27fe[_0x3bbe('0x32')];var _0x1e6960;if(_0x433983>=_0x20fc6a){_0x433983=_0x20fc6a;_0x1e6960=0xc8;}else{_0x1e6960=0xce;}_0xd6f874[_0x3bbe('0x2f')](_0x1e6960);return _0xd6f874[_0x3bbe('0x35')](_0x3bbe('0x36'),_0x3e0ad4+'-'+_0x433983+'/'+_0x20fc6a)[_0x3bbe('0x37')](_0x5e95d3);}return null;};}function patchUpdates(_0x55571b){return function(_0x13db7d){try{jsonpatch[_0x3bbe('0x38')](_0x13db7d,_0x55571b,!![]);}catch(_0x1aac96){return BPromise[_0x3bbe('0x39')](_0x1aac96);}return _0x13db7d[_0x3bbe('0x3a')]();};}function saveUpdates(_0x3dd503,_0x2bc09b){return function(_0x549f51){if(_0x549f51){return _0x549f51[_0x3bbe('0x3b')](_0x3dd503)[_0x3bbe('0x22')](function(_0x6c32a1){return _0x6c32a1;});}return null;};}function removeEntity(_0x27256f,_0x3e77dc){return function(_0x9780e7){if(_0x9780e7){return _0x9780e7[_0x3bbe('0x3c')]()[_0x3bbe('0x22')](function(){var _0x552ab9=_0x9780e7[_0x3bbe('0x3d')]({'plain':!![]});var _0x552f6d=_0x3bbe('0x3e');return db[_0x3bbe('0x3f')][_0x3bbe('0x3c')]({'where':{'type':_0x552f6d,'resourceId':_0x552ab9['id']}})[_0x3bbe('0x22')](function(){return _0x9780e7;});})['then'](function(){_0x27256f[_0x3bbe('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4880fe,_0x347135){return function(_0x2b75a6){if(!_0x2b75a6){_0x4880fe['sendStatus'](0x194);}return _0x2b75a6;};}function handleError(_0xe7da47,_0x5982f6){_0x5982f6=_0x5982f6||0x1f4;return function(_0x566b11){logger[_0x3bbe('0x27')](_0x566b11[_0x3bbe('0x40')]);if(_0x566b11[_0x3bbe('0x41')]){delete _0x566b11[_0x3bbe('0x41')];}_0xe7da47[_0x3bbe('0x2f')](_0x5982f6)[_0x3bbe('0x42')](_0x566b11);};}exports['index']=function(_0x2c5173,_0x3fca90){var _0x1b5012={'include':[{'model':db[_0x3bbe('0x43')],'as':_0x3bbe('0x44')}]},_0x20f132={},_0x44c307={'count':0x0,'rows':[]};var _0x4d19c8=_['map'](db[_0x3bbe('0x45')][_0x3bbe('0x46')],function(_0x32180a){return{'name':_0x32180a[_0x3bbe('0x47')],'type':_0x32180a['type'][_0x3bbe('0x48')]};});_0x20f132[_0x3bbe('0x49')]=_[_0x3bbe('0x4a')](_0x4d19c8,'name');_0x20f132[_0x3bbe('0x4b')]=_[_0x3bbe('0x4c')](_0x2c5173['query']);_0x20f132[_0x3bbe('0x4d')]=_[_0x3bbe('0x4e')](_0x20f132['model'],_0x20f132['query']);_0x1b5012[_0x3bbe('0x4f')]=_[_0x3bbe('0x4e')](_0x20f132[_0x3bbe('0x49')],qs[_0x3bbe('0x50')](_0x2c5173['query'][_0x3bbe('0x50')]));_0x1b5012['attributes']=_0x1b5012[_0x3bbe('0x4f')][_0x3bbe('0x51')]?_0x1b5012[_0x3bbe('0x4f')]:_0x20f132[_0x3bbe('0x49')];if(!_0x2c5173[_0x3bbe('0x4b')]['hasOwnProperty'](_0x3bbe('0x52'))){_0x1b5012['limit']=qs[_0x3bbe('0x32')](_0x2c5173[_0x3bbe('0x4b')][_0x3bbe('0x32')]);_0x1b5012['offset']=qs[_0x3bbe('0x34')](_0x2c5173[_0x3bbe('0x4b')]['offset']);}_0x1b5012[_0x3bbe('0x53')]=qs[_0x3bbe('0x54')](_0x2c5173[_0x3bbe('0x4b')][_0x3bbe('0x54')]);_0x1b5012['where']=qs[_0x3bbe('0x4d')](_[_0x3bbe('0x55')](_0x2c5173['query'],_0x20f132[_0x3bbe('0x4d')]),_0x4d19c8);if(_0x2c5173[_0x3bbe('0x4b')][_0x3bbe('0x56')]){_0x1b5012[_0x3bbe('0x57')]=_[_0x3bbe('0x58')](_0x1b5012[_0x3bbe('0x57')],{'$or':_[_0x3bbe('0x4a')](_0x4d19c8,function(_0x2a5791){if(_0x2a5791[_0x3bbe('0x59')]!==_0x3bbe('0x5a')){var _0x527048={};_0x527048[_0x2a5791['name']]={'$like':'%'+_0x2c5173['query'][_0x3bbe('0x56')]+'%'};return _0x527048;}})});}_0x1b5012=_[_0x3bbe('0x58')]({},_0x1b5012,_0x2c5173[_0x3bbe('0x5b')]);var _0xa9ff16={'where':_0x1b5012['where']};return db[_0x3bbe('0x45')][_0x3bbe('0x33')](_0xa9ff16)[_0x3bbe('0x22')](function(_0xcb2d4){_0x44c307[_0x3bbe('0x33')]=_0xcb2d4;if(_0x2c5173[_0x3bbe('0x4b')][_0x3bbe('0x5c')]){_0x1b5012[_0x3bbe('0x5d')]=[{'all':!![]}];}return db[_0x3bbe('0x45')]['findAll'](_0x1b5012);})[_0x3bbe('0x22')](function(_0x3ef1a0){_0x44c307[_0x3bbe('0x5e')]=_0x3ef1a0;return _0x44c307;})[_0x3bbe('0x22')](respondWithFilteredResult(_0x3fca90,_0x1b5012))[_0x3bbe('0x2d')](handleError(_0x3fca90,null));};exports[_0x3bbe('0x5f')]=function(_0x58e2e0,_0x42e3ea){var _0x19320a={'raw':![],'where':{'id':_0x58e2e0[_0x3bbe('0x60')]['id']},'include':[{'model':db[_0x3bbe('0x43')],'as':_0x3bbe('0x44')}]},_0x348c41={};_0x348c41[_0x3bbe('0x49')]=_[_0x3bbe('0x4c')](db[_0x3bbe('0x45')]['rawAttributes']);_0x348c41[_0x3bbe('0x4b')]=_[_0x3bbe('0x4c')](_0x58e2e0[_0x3bbe('0x4b')]);_0x348c41[_0x3bbe('0x4d')]=_[_0x3bbe('0x4e')](_0x348c41['model'],_0x348c41[_0x3bbe('0x4b')]);_0x19320a[_0x3bbe('0x4f')]=_[_0x3bbe('0x4e')](_0x348c41[_0x3bbe('0x49')],qs[_0x3bbe('0x50')](_0x58e2e0['query']['fields']));_0x19320a[_0x3bbe('0x4f')]=_0x19320a[_0x3bbe('0x4f')][_0x3bbe('0x51')]?_0x19320a[_0x3bbe('0x4f')]:_0x348c41[_0x3bbe('0x49')];if(_0x58e2e0['query']['includeAll']){_0x19320a[_0x3bbe('0x5d')]=[{'all':!![]}];}_0x19320a=_[_0x3bbe('0x58')]({},_0x19320a,_0x58e2e0[_0x3bbe('0x5b')]);return db[_0x3bbe('0x45')]['find'](_0x19320a)[_0x3bbe('0x22')](handleEntityNotFound(_0x42e3ea,null))[_0x3bbe('0x22')](respondWithResult(_0x42e3ea,null))[_0x3bbe('0x2d')](handleError(_0x42e3ea,null));};exports[_0x3bbe('0x61')]=function(_0x2e9532,_0x133e27){return db[_0x3bbe('0x45')][_0x3bbe('0x61')](_0x2e9532[_0x3bbe('0x62')],{})[_0x3bbe('0x22')](function(_0x59cb06){var _0x2a9fb5=_0x2e9532[_0x3bbe('0x63')][_0x3bbe('0x3d')]({'plain':!![]});if(!_0x2a9fb5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a9fb5[_0x3bbe('0x64')]===_0x3bbe('0x63')){var _0x41f0e=_0x59cb06[_0x3bbe('0x3d')]({'plain':!![]});var _0x2c8271=_0x3bbe('0x3e');return db['UserProfileSection'][_0x3bbe('0x65')]({'where':{'name':_0x2c8271,'userProfileId':_0x2a9fb5[_0x3bbe('0x66')]},'raw':!![]})['then'](function(_0x514c2f){if(_0x514c2f&&_0x514c2f['autoAssociation']===0x0){return db[_0x3bbe('0x3f')][_0x3bbe('0x61')]({'name':_0x41f0e[_0x3bbe('0x41')],'resourceId':_0x41f0e['id'],'type':_0x514c2f[_0x3bbe('0x41')],'sectionId':_0x514c2f['id']},{})[_0x3bbe('0x22')](function(){return _0x59cb06;});}else{return _0x59cb06;}})[_0x3bbe('0x2d')](function(_0x2fbb27){logger[_0x3bbe('0x27')](_0x3bbe('0x67'),_0x2fbb27);throw _0x2fbb27;});}return _0x59cb06;})['then'](respondWithResult(_0x133e27,0xc9))[_0x3bbe('0x2d')](handleError(_0x133e27,null));};exports[_0x3bbe('0x3b')]=function(_0x34eb46,_0x56e86a){if(_0x34eb46[_0x3bbe('0x62')]['id']){delete _0x34eb46[_0x3bbe('0x62')]['id'];}return db[_0x3bbe('0x45')][_0x3bbe('0x65')]({'where':{'id':_0x34eb46['params']['id']},'include':[{'model':db['Pause'],'as':_0x3bbe('0x44')}]})[_0x3bbe('0x22')](handleEntityNotFound(_0x56e86a,null))[_0x3bbe('0x22')](saveUpdates(_0x34eb46[_0x3bbe('0x62')],null))['then'](respondWithResult(_0x56e86a,null))[_0x3bbe('0x2d')](handleError(_0x56e86a,null));};exports[_0x3bbe('0x3c')]=function(_0x5dee28,_0x335db1){return db['WhatsappAccount'][_0x3bbe('0x65')]({'where':{'id':_0x5dee28[_0x3bbe('0x60')]['id']}})[_0x3bbe('0x22')](handleEntityNotFound(_0x335db1,null))[_0x3bbe('0x22')](removeEntity(_0x335db1,null))[_0x3bbe('0x2d')](handleError(_0x335db1,null));};exports['describe']=function(_0x281706,_0x117238){return db[_0x3bbe('0x45')][_0x3bbe('0x68')]()[_0x3bbe('0x22')](respondWithResult(_0x117238,null))[_0x3bbe('0x2d')](handleError(_0x117238,null));};exports[_0x3bbe('0x69')]=function(_0xa789ac,_0x28e3d2,_0x41dcb9){if(_0xa789ac['body']['id']){delete _0xa789ac[_0x3bbe('0x62')]['id'];}return db[_0x3bbe('0x45')][_0x3bbe('0x65')]({'where':{'id':_0xa789ac[_0x3bbe('0x60')]['id']}})['then'](handleEntityNotFound(_0x28e3d2,null))[_0x3bbe('0x22')](function(_0x164b3a){if(_0x164b3a){_0xa789ac[_0x3bbe('0x62')][_0x3bbe('0x6a')]=_0x164b3a['id'];return db[_0x3bbe('0x6b')][_0x3bbe('0x61')](_0xa789ac[_0x3bbe('0x62')]);}})['then'](respondWithResult(_0x28e3d2,null))[_0x3bbe('0x2d')](handleError(_0x28e3d2,null));};exports[_0x3bbe('0x6c')]=function(_0x40c5a3,_0x4f372f,_0x262daa){var _0x3ea0b1={'raw':![],'where':{}};var _0x1d1fb4={};var _0x4a661b={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3bbe('0x6d')]({'where':{'id':_0x40c5a3['params']['id']}})['then'](handleEntityNotFound(_0x4f372f,null))[_0x3bbe('0x22')](function(_0x1156b2){if(_0x1156b2){_0x1d1fb4[_0x3bbe('0x49')]=_[_0x3bbe('0x4c')](db[_0x3bbe('0x6b')][_0x3bbe('0x46')]);_0x1d1fb4[_0x3bbe('0x4b')]=_[_0x3bbe('0x4c')](_0x40c5a3[_0x3bbe('0x4b')]);_0x1d1fb4['filters']=_[_0x3bbe('0x4e')](_0x1d1fb4[_0x3bbe('0x49')],_0x1d1fb4[_0x3bbe('0x4b')]);_0x3ea0b1['attributes']=_[_0x3bbe('0x4e')](_0x1d1fb4['model'],qs[_0x3bbe('0x50')](_0x40c5a3[_0x3bbe('0x4b')][_0x3bbe('0x50')]));_0x3ea0b1['attributes']=_0x3ea0b1['attributes']['length']?_0x3ea0b1[_0x3bbe('0x4f')]:_0x1d1fb4[_0x3bbe('0x49')];if(!_0x40c5a3[_0x3bbe('0x4b')][_0x3bbe('0x6e')](_0x3bbe('0x52'))){_0x3ea0b1[_0x3bbe('0x32')]=qs[_0x3bbe('0x32')](_0x40c5a3[_0x3bbe('0x4b')][_0x3bbe('0x32')]);_0x3ea0b1['offset']=qs['offset'](_0x40c5a3[_0x3bbe('0x4b')][_0x3bbe('0x34')]);}_0x3ea0b1[_0x3bbe('0x53')]=qs['sort'](_0x40c5a3[_0x3bbe('0x4b')]['sort']);_0x3ea0b1['where']=qs[_0x3bbe('0x4d')](_[_0x3bbe('0x55')](_0x40c5a3[_0x3bbe('0x4b')],_0x1d1fb4[_0x3bbe('0x4d')]));_0x3ea0b1[_0x3bbe('0x57')][_0x3bbe('0x6a')]=_0x1156b2['id'];if(_0x40c5a3['query'][_0x3bbe('0x56')]){_0x3ea0b1[_0x3bbe('0x57')]=_[_0x3bbe('0x58')](_0x3ea0b1[_0x3bbe('0x57')],{'$or':_['map'](_0x3ea0b1[_0x3bbe('0x4f')],function(_0x101110){var _0x40a9db={};_0x40a9db[_0x101110]={'$like':'%'+_0x40c5a3['query']['filter']+'%'};return _0x40a9db;})});}_0x3ea0b1=_['merge']({},_0x3ea0b1,_0x40c5a3['options']);return db[_0x3bbe('0x6b')][_0x3bbe('0x33')]({'where':_0x3ea0b1[_0x3bbe('0x57')]})[_0x3bbe('0x22')](function(_0x4e5829){_0x4a661b[_0x3bbe('0x33')]=_0x4e5829;if(_0x40c5a3[_0x3bbe('0x4b')][_0x3bbe('0x5c')]){_0x3ea0b1[_0x3bbe('0x5d')]=[{'all':!![]}];}return db[_0x3bbe('0x6b')][_0x3bbe('0x6f')](_0x3ea0b1);})[_0x3bbe('0x22')](function(_0x162165){_0x4a661b[_0x3bbe('0x5e')]=_0x162165;return _0x4a661b;});}})[_0x3bbe('0x22')](respondWithFilteredResult(_0x4f372f,_0x3ea0b1))[_0x3bbe('0x2d')](handleError(_0x4f372f,null));};exports[_0x3bbe('0x70')]=function(_0x3f0455,_0x4d5c6f,_0x246aee){return db[_0x3bbe('0x45')][_0x3bbe('0x65')]({'where':{'id':_0x3f0455[_0x3bbe('0x60')]['id']}})[_0x3bbe('0x22')](handleEntityNotFound(_0x4d5c6f,null))[_0x3bbe('0x22')](function(_0x4aca9d){if(_0x4aca9d){return _0x4aca9d['removeDispositions'](_0x3f0455[_0x3bbe('0x4b')][_0x3bbe('0x71')]);}})[_0x3bbe('0x22')](respondWithStatusCode(_0x4d5c6f,null))[_0x3bbe('0x2d')](handleError(_0x4d5c6f,null));};exports[_0x3bbe('0x72')]=function(_0x2c7d,_0x12899a,_0x307c5c){if(_0x2c7d[_0x3bbe('0x62')]['id']){delete _0x2c7d[_0x3bbe('0x62')]['id'];}return db[_0x3bbe('0x45')]['find']({'where':{'id':_0x2c7d[_0x3bbe('0x60')]['id']}})[_0x3bbe('0x22')](handleEntityNotFound(_0x12899a,null))['then'](function(_0x5ec30e){if(_0x5ec30e){_0x2c7d[_0x3bbe('0x62')][_0x3bbe('0x6a')]=_0x5ec30e['id'];return db['CannedAnswer'][_0x3bbe('0x61')](_0x2c7d[_0x3bbe('0x62')]);}})['then'](respondWithResult(_0x12899a,null))[_0x3bbe('0x2d')](handleError(_0x12899a,null));};exports[_0x3bbe('0x73')]=function(_0x487019,_0x29ba4d,_0x812813){var _0x20d2f6={'raw':![],'where':{}};var _0x3933dc={};var _0x2bfb78={'count':0x0,'rows':[]};return db[_0x3bbe('0x45')][_0x3bbe('0x6d')]({'where':{'id':_0x487019[_0x3bbe('0x60')]['id']}})[_0x3bbe('0x22')](handleEntityNotFound(_0x29ba4d,null))[_0x3bbe('0x22')](function(_0xaf83dc){if(_0xaf83dc){_0x3933dc['model']=_[_0x3bbe('0x4c')](db[_0x3bbe('0x74')][_0x3bbe('0x46')]);_0x3933dc['query']=_[_0x3bbe('0x4c')](_0x487019[_0x3bbe('0x4b')]);_0x3933dc[_0x3bbe('0x4d')]=_[_0x3bbe('0x4e')](_0x3933dc[_0x3bbe('0x49')],_0x3933dc['query']);_0x20d2f6[_0x3bbe('0x4f')]=_[_0x3bbe('0x4e')](_0x3933dc[_0x3bbe('0x49')],qs[_0x3bbe('0x50')](_0x487019[_0x3bbe('0x4b')][_0x3bbe('0x50')]));_0x20d2f6['attributes']=_0x20d2f6[_0x3bbe('0x4f')][_0x3bbe('0x51')]?_0x20d2f6['attributes']:_0x3933dc['model'];if(!_0x487019[_0x3bbe('0x4b')]['hasOwnProperty'](_0x3bbe('0x52'))){_0x20d2f6[_0x3bbe('0x32')]=qs['limit'](_0x487019[_0x3bbe('0x4b')][_0x3bbe('0x32')]);_0x20d2f6[_0x3bbe('0x34')]=qs[_0x3bbe('0x34')](_0x487019['query'][_0x3bbe('0x34')]);}_0x20d2f6['order']=qs[_0x3bbe('0x54')](_0x487019[_0x3bbe('0x4b')]['sort']);_0x20d2f6[_0x3bbe('0x57')]=qs[_0x3bbe('0x4d')](_[_0x3bbe('0x55')](_0x487019[_0x3bbe('0x4b')],_0x3933dc[_0x3bbe('0x4d')]));_0x20d2f6[_0x3bbe('0x57')][_0x3bbe('0x6a')]=_0xaf83dc['id'];if(_0x487019[_0x3bbe('0x4b')][_0x3bbe('0x56')]){_0x20d2f6[_0x3bbe('0x57')]=_[_0x3bbe('0x58')](_0x20d2f6[_0x3bbe('0x57')],{'$or':_['map'](_0x20d2f6[_0x3bbe('0x4f')],function(_0x43fdae){var _0x407cb7={};_0x407cb7[_0x43fdae]={'$like':'%'+_0x487019[_0x3bbe('0x4b')][_0x3bbe('0x56')]+'%'};return _0x407cb7;})});}_0x20d2f6=_['merge']({},_0x20d2f6,_0x487019[_0x3bbe('0x5b')]);return db[_0x3bbe('0x74')]['count']({'where':_0x20d2f6['where']})['then'](function(_0x509d5f){_0x2bfb78[_0x3bbe('0x33')]=_0x509d5f;if(_0x487019[_0x3bbe('0x4b')][_0x3bbe('0x5c')]){_0x20d2f6['include']=[{'all':!![]}];}return db[_0x3bbe('0x74')]['findAll'](_0x20d2f6);})[_0x3bbe('0x22')](function(_0x48f224){_0x2bfb78[_0x3bbe('0x5e')]=_0x48f224;return _0x2bfb78;});}})[_0x3bbe('0x22')](respondWithFilteredResult(_0x29ba4d,_0x20d2f6))[_0x3bbe('0x2d')](handleError(_0x29ba4d,null));};exports[_0x3bbe('0x75')]=function(_0x730484,_0x55a4de,_0xf53929){return db[_0x3bbe('0x45')][_0x3bbe('0x65')]({'where':{'id':_0x730484[_0x3bbe('0x60')]['id']}})[_0x3bbe('0x22')](handleEntityNotFound(_0x55a4de,null))['then'](function(_0x4b078d){if(_0x4b078d){return _0x4b078d[_0x3bbe('0x75')](_0x730484[_0x3bbe('0x4b')][_0x3bbe('0x71')]);}})[_0x3bbe('0x22')](respondWithStatusCode(_0x55a4de,null))[_0x3bbe('0x2d')](handleError(_0x55a4de,null));};exports['addAgents']=function(_0x368f1d,_0x10a4e1,_0x34b24b){return db[_0x3bbe('0x45')][_0x3bbe('0x65')]({'where':{'id':_0x368f1d['params']['id']}})[_0x3bbe('0x22')](handleEntityNotFound(_0x10a4e1,null))[_0x3bbe('0x22')](function(_0x2c3b33){if(_0x2c3b33){return _0x2c3b33[_0x3bbe('0x76')](_0x368f1d[_0x3bbe('0x62')][_0x3bbe('0x71')],_[_0x3bbe('0x77')](_0x368f1d[_0x3bbe('0x62')],[_0x3bbe('0x71'),'id'])||{})[_0x3bbe('0x78')](function(_0x1ed093){for(var _0x2130ca=0x0;_0x2130ca<_0x368f1d[_0x3bbe('0x62')][_0x3bbe('0x71')][_0x3bbe('0x51')];_0x2130ca+=0x1){socket[_0x3bbe('0x79')]('userWhatsappAccount:save',{'UserId':Number(_0x368f1d[_0x3bbe('0x62')]['ids'][_0x2130ca]),'WhatsappAccountId':Number(_0x368f1d[_0x3bbe('0x60')]['id'])});}return _0x1ed093;});}})[_0x3bbe('0x22')](respondWithResult(_0x10a4e1,null))['catch'](handleError(_0x10a4e1,null));};exports[_0x3bbe('0x7a')]=function(_0x5e22b7,_0x258889,_0x11b3d0){return db['WhatsappAccount'][_0x3bbe('0x65')]({'where':{'id':_0x5e22b7[_0x3bbe('0x60')]['id']}})[_0x3bbe('0x22')](handleEntityNotFound(_0x258889,null))[_0x3bbe('0x22')](function(_0x1d87bd){if(_0x1d87bd){return _0x1d87bd['removeAgents'](_0x5e22b7['query'][_0x3bbe('0x71')])['then'](function(){if(_[_0x3bbe('0x7b')](_0x5e22b7[_0x3bbe('0x4b')][_0x3bbe('0x71')])){for(var _0x12dfe7=0x0;_0x12dfe7<_0x5e22b7[_0x3bbe('0x4b')]['ids'][_0x3bbe('0x51')];_0x12dfe7+=0x1){socket[_0x3bbe('0x79')](_0x3bbe('0x7c'),{'UserId':Number(_0x5e22b7['query'][_0x3bbe('0x71')][_0x12dfe7]),'WhatsappAccountId':Number(_0x5e22b7[_0x3bbe('0x60')]['id'])});}}else{socket[_0x3bbe('0x79')](_0x3bbe('0x7c'),{'UserId':Number(_0x5e22b7['query']['ids']),'WhatsappAccountId':Number(_0x5e22b7[_0x3bbe('0x60')]['id'])});}});}})[_0x3bbe('0x22')](respondWithStatusCode(_0x258889,null))['catch'](handleError(_0x258889,null));};exports['getAgents']=function(_0x2a60df,_0x3ffc19,_0x31c1bc){var _0xfab9c5={};var _0x5a709d={};var _0x7d2e91;var _0x2ad0ce;return db[_0x3bbe('0x45')]['findOne']({'where':{'id':_0x2a60df[_0x3bbe('0x60')]['id']}})[_0x3bbe('0x22')](handleEntityNotFound(_0x3ffc19,null))[_0x3bbe('0x22')](function(_0x514426){if(_0x514426){_0x7d2e91=_0x514426;_0x5a709d['model']=_['keys'](db['User'][_0x3bbe('0x46')]);_0x5a709d[_0x3bbe('0x4b')]=_[_0x3bbe('0x4c')](_0x2a60df[_0x3bbe('0x4b')]);_0x5a709d['filters']=_[_0x3bbe('0x4e')](_0x5a709d[_0x3bbe('0x49')],_0x5a709d[_0x3bbe('0x4b')]);_0xfab9c5['attributes']=_['intersection'](_0x5a709d[_0x3bbe('0x49')],qs[_0x3bbe('0x50')](_0x2a60df[_0x3bbe('0x4b')][_0x3bbe('0x50')]));_0xfab9c5[_0x3bbe('0x4f')]=_0xfab9c5[_0x3bbe('0x4f')]['length']?_0xfab9c5[_0x3bbe('0x4f')]:_0x5a709d['model'];_0xfab9c5['order']=qs[_0x3bbe('0x54')](_0x2a60df[_0x3bbe('0x4b')][_0x3bbe('0x54')]);_0xfab9c5[_0x3bbe('0x57')]=qs[_0x3bbe('0x4d')](_[_0x3bbe('0x55')](_0x2a60df['query'],_0x5a709d[_0x3bbe('0x4d')]));if(_0x2a60df[_0x3bbe('0x4b')][_0x3bbe('0x56')]){_0xfab9c5[_0x3bbe('0x57')]=_[_0x3bbe('0x58')](_0xfab9c5['where'],{'$or':_[_0x3bbe('0x4a')](_0xfab9c5[_0x3bbe('0x4f')],function(_0xaf1825){var _0x2d8569={};_0x2d8569[_0xaf1825]={'$like':'%'+_0x2a60df[_0x3bbe('0x4b')][_0x3bbe('0x56')]+'%'};return _0x2d8569;})});}_0xfab9c5=_[_0x3bbe('0x58')]({},_0xfab9c5,_0x2a60df[_0x3bbe('0x5b')]);return _0x7d2e91[_0x3bbe('0x7d')](_0xfab9c5);}})['then'](function(_0x496dfc){if(_0x496dfc){_0x2ad0ce=_0x496dfc[_0x3bbe('0x51')];if(!_0x2a60df['query'][_0x3bbe('0x6e')](_0x3bbe('0x52'))){_0xfab9c5[_0x3bbe('0x32')]=qs[_0x3bbe('0x32')](_0x2a60df['query'][_0x3bbe('0x32')]);_0xfab9c5[_0x3bbe('0x34')]=qs[_0x3bbe('0x34')](_0x2a60df[_0x3bbe('0x4b')]['offset']);}return _0x7d2e91[_0x3bbe('0x7d')](_0xfab9c5);}})[_0x3bbe('0x22')](function(_0x5d59d5){if(_0x5d59d5){return _0x5d59d5?{'count':_0x2ad0ce,'rows':_0x5d59d5}:null;}})[_0x3bbe('0x22')](respondWithResult(_0x3ffc19,null))[_0x3bbe('0x2d')](handleError(_0x3ffc19,null));};exports[_0x3bbe('0x7e')]=function(_0x4208cb,_0x354321){var _0x168b71=_0x4208cb[_0x3bbe('0x60')]['id'];var _0x56e6fa=_0x4208cb[_0x3bbe('0x62')];var _0x2034b3=0xc8;var _0x1b54d1=null;return db[_0x3bbe('0x7f')]['transaction']({'isolationLevel':db[_0x3bbe('0x7f')]['Transaction'][_0x3bbe('0x80')][_0x3bbe('0x81')]},function(_0x482cb8){return db[_0x3bbe('0x45')]['findOne']({'where':{'id':_0x168b71},'transaction':_0x482cb8})[_0x3bbe('0x22')](function(_0x470c05){if(_0x470c05){return db[_0x3bbe('0x82')][_0x3bbe('0x3c')]({'where':{'WhatsappAccountId':_0x168b71},'transaction':_0x482cb8})['then'](function(){var _0x486f03=_[_0x3bbe('0x4a')](_0x56e6fa,function(_0x3876a4){_0x3876a4['WhatsappAccountId']=_0x168b71;return _0x3876a4;});return db[_0x3bbe('0x82')][_0x3bbe('0x83')](_0x486f03,{'transaction':_0x482cb8});});}else{_0x2034b3=0x194;_0x1b54d1=[];}});})[_0x3bbe('0x22')](function(){if(_0x2034b3!==0x194){return db[_0x3bbe('0x82')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x168b71},'order':'priority'})['then'](function(_0x401dcc){_0x1b54d1=_0x401dcc;});}})['catch'](function(_0x598874){_0x2034b3=0x1f4;logger[_0x3bbe('0x27')](_0x598874['stack']);if(_0x598874[_0x3bbe('0x41')]){delete _0x598874['name'];}_0x1b54d1=_0x598874;})[_0x3bbe('0x84')](function(){if(_0x1b54d1===null){_0x354321[_0x3bbe('0x2e')](_0x2034b3);}else{if(_0x2034b3===0x1f4){_0x354321[_0x3bbe('0x2f')](_0x2034b3)['send'](_0x1b54d1);}else{_0x354321['status'](_0x2034b3)[_0x3bbe('0x37')](_0x1b54d1);}}});};exports['getApplications']=function(_0x1783fe,_0x126b82,_0x16bcb5){var _0x41c09f={};var _0x4049d5={};var _0xa7d743;var _0x31e600;return db[_0x3bbe('0x45')]['findOne']({'where':{'id':_0x1783fe[_0x3bbe('0x60')]['id']}})[_0x3bbe('0x22')](handleEntityNotFound(_0x126b82,null))[_0x3bbe('0x22')](function(_0x29cea0){if(_0x29cea0){_0xa7d743=_0x29cea0;_0x4049d5['model']=_[_0x3bbe('0x4c')](db[_0x3bbe('0x82')][_0x3bbe('0x46')]);_0x4049d5[_0x3bbe('0x4b')]=_['keys'](_0x1783fe[_0x3bbe('0x4b')]);_0x4049d5[_0x3bbe('0x4d')]=_[_0x3bbe('0x4e')](_0x4049d5[_0x3bbe('0x49')],_0x4049d5[_0x3bbe('0x4b')]);_0x41c09f[_0x3bbe('0x4f')]=_[_0x3bbe('0x4e')](_0x4049d5[_0x3bbe('0x49')],qs[_0x3bbe('0x50')](_0x1783fe[_0x3bbe('0x4b')][_0x3bbe('0x50')]));_0x41c09f[_0x3bbe('0x4f')]=_0x41c09f['attributes'][_0x3bbe('0x51')]?_0x41c09f[_0x3bbe('0x4f')]:_0x4049d5[_0x3bbe('0x49')];_0x41c09f['order']=qs['sort'](_0x1783fe[_0x3bbe('0x4b')]['sort']);_0x41c09f[_0x3bbe('0x57')]=qs[_0x3bbe('0x4d')](_[_0x3bbe('0x55')](_0x1783fe[_0x3bbe('0x4b')],_0x4049d5[_0x3bbe('0x4d')]));if(_0x1783fe[_0x3bbe('0x4b')][_0x3bbe('0x56')]){_0x41c09f[_0x3bbe('0x57')]=_[_0x3bbe('0x58')](_0x41c09f[_0x3bbe('0x57')],{'$or':_['map'](_0x41c09f[_0x3bbe('0x4f')],function(_0x2685b7){var _0x173480={};_0x173480[_0x2685b7]={'$like':'%'+_0x1783fe[_0x3bbe('0x4b')]['filter']+'%'};return _0x173480;})});}_0x41c09f=_[_0x3bbe('0x58')]({},_0x41c09f,_0x1783fe['options']);return _0xa7d743[_0x3bbe('0x85')](_0x41c09f);}})[_0x3bbe('0x22')](function(_0x409360){if(_0x409360){_0x31e600=_0x409360[_0x3bbe('0x51')];if(!_0x1783fe['query'][_0x3bbe('0x6e')](_0x3bbe('0x52'))){_0x41c09f[_0x3bbe('0x32')]=qs[_0x3bbe('0x32')](_0x1783fe[_0x3bbe('0x4b')][_0x3bbe('0x32')]);_0x41c09f[_0x3bbe('0x34')]=qs[_0x3bbe('0x34')](_0x1783fe['query'][_0x3bbe('0x34')]);}return _0xa7d743[_0x3bbe('0x85')](_0x41c09f);}})[_0x3bbe('0x22')](function(_0x256c71){if(_0x256c71){return _0x256c71?{'count':_0x31e600,'rows':_0x256c71}:null;}})[_0x3bbe('0x22')](respondWithResult(_0x126b82,null))[_0x3bbe('0x2d')](handleError(_0x126b82,null));};exports[_0x3bbe('0x86')]=function(_0x55361b,_0x4843fc,_0x4de9aa){var _0x14f8a4={'channel':_0x3bbe('0x87')};var _0x16d30f=[];var _0x418e1a=[];var _0x70a623={};return db[_0x3bbe('0x45')][_0x3bbe('0x65')]({'where':{'id':_0x55361b[_0x3bbe('0x60')]['id']},'include':[{'model':db[_0x3bbe('0x82')],'as':_0x3bbe('0x88')}]})[_0x3bbe('0x22')](handleEntityNotFound(_0x4843fc,null))['then'](function(_0x45ddb4){_0x14f8a4[_0x3bbe('0x89')]=_0x45ddb4;if(_0x14f8a4[_0x3bbe('0x89')]&&_0x14f8a4[_0x3bbe('0x89')][_0x3bbe('0x59')]===_0x3bbe('0x8a')&&_0x55361b[_0x3bbe('0x62')]['statuses']){if(_0x55361b[_0x3bbe('0x62')][_0x3bbe('0x8b')]['length']===0x0)return;if(_0x55361b[_0x3bbe('0x62')][_0x3bbe('0x8b')][0x0][_0x3bbe('0x8c')]!==_0x3bbe('0x8d'))return;return db['WhatsappMessage'][_0x3bbe('0x3b')]({'read':!![],'readAt':_0x55361b[_0x3bbe('0x62')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x55361b[_0x3bbe('0x62')]['statuses'][0x0][_0x3bbe('0x8e')]},'individualHooks':!![]})[_0x3bbe('0x22')](function(_0x189530){return _0x4843fc[_0x3bbe('0x2f')](0xc8)['json'](_0x189530);});}_0x14f8a4['applications']=_[_0x3bbe('0x8f')](_0x45ddb4[_0x3bbe('0x88')],[_0x3bbe('0x90')],[_0x3bbe('0x91')]);if(_0x14f8a4['account'][_0x3bbe('0x88')]){delete _0x14f8a4[_0x3bbe('0x89')][_0x3bbe('0x88')];}return db['CmContact']['describe']()['then'](function(_0x2a52b0){if(!_0x2a52b0){throw new db[(_0x3bbe('0x92'))][(_0x3bbe('0x93'))]('no\x20available\x20attributes');}_0x16d30f=_[_0x3bbe('0x94')](_['keys'](_0x2a52b0),[_0x3bbe('0x95'),'updatedAt']);_0x418e1a=_[_0x3bbe('0x94')](_[_0x3bbe('0x4c')](_0x2a52b0),[_0x3bbe('0x95'),'updatedAt','CompanyId',_0x3bbe('0x96')]);_0x14f8a4[_0x3bbe('0x62')]={'mapKey':_0x3bbe('0x97')};if(_0x14f8a4['account']&&_0x14f8a4['account']['type']===_0x3bbe('0x98')){_0x14f8a4[_0x3bbe('0x62')][_0x3bbe('0x99')]=_0x55361b[_0x3bbe('0x62')]['From'][_0x3bbe('0x9a')](_0x3bbe('0x9b'),'');_0x14f8a4['body'][_0x3bbe('0x62')]=_0x55361b[_0x3bbe('0x62')][_0x3bbe('0x9c')];_0x14f8a4[_0x3bbe('0x62')]['messageId']=_0x55361b['body'][_0x3bbe('0x9d')];}if(_0x14f8a4['account']&&_0x14f8a4[_0x3bbe('0x89')][_0x3bbe('0x59')]===_0x3bbe('0x8a')){_0x14f8a4[_0x3bbe('0x62')][_0x3bbe('0x99')]=_0x55361b[_0x3bbe('0x62')][_0x3bbe('0x9e')][0x0][_0x3bbe('0x99')];_0x14f8a4[_0x3bbe('0x62')]['body']=_0x55361b[_0x3bbe('0x62')][_0x3bbe('0x9e')][0x0][_0x3bbe('0x2a')][_0x3bbe('0x62')];_0x14f8a4['body'][_0x3bbe('0x9f')]=_0x55361b[_0x3bbe('0x62')][_0x3bbe('0x9e')][0x0][_0x3bbe('0x8e')];}if(_0x14f8a4['body']['id']){delete _0x14f8a4['body']['id'];}if(_['isNil'](_0x14f8a4[_0x3bbe('0x62')][_0x3bbe('0x99')])){throw new db[(_0x3bbe('0x92'))][(_0x3bbe('0x93'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x14f8a4['body']['body'])||_0x14f8a4[_0x3bbe('0x62')][_0x3bbe('0x62')]===''){throw new db[(_0x3bbe('0x92'))][(_0x3bbe('0x93'))](_0x3bbe('0xa0'));}if(_[_0x3bbe('0xa1')](_0x14f8a4[_0x3bbe('0x62')]['mapKey'])){throw new db[(_0x3bbe('0x92'))][(_0x3bbe('0x93'))](_0x3bbe('0xa2')+_0x418e1a);}if(!_[_0x3bbe('0xa3')](_0x418e1a,_0x14f8a4[_0x3bbe('0x62')][_0x3bbe('0xa4')])){throw new db[(_0x3bbe('0x92'))][(_0x3bbe('0x93'))](_0x3bbe('0xa5')+_0x418e1a);}_0x70a623[_0x14f8a4[_0x3bbe('0x62')][_0x3bbe('0xa4')]]=_0x14f8a4[_0x3bbe('0x62')][_0x3bbe('0x99')];return db[_0x3bbe('0xa6')][_0x3bbe('0x65')]({'where':{'id':_0x14f8a4['account'][_0x3bbe('0x96')]},'include':[{'model':db['CmContact'],'as':_0x3bbe('0xa7'),'where':_0x70a623,'limit':0x1,'order':[[_0x3bbe('0xa8'),'DESC']]}]});})[_0x3bbe('0x22')](handleEntityNotFound(_0x4843fc,null))[_0x3bbe('0x22')](function(_0x4362a0){if(_0x4362a0){_0x14f8a4[_0x3bbe('0xa9')]=_[_0x3bbe('0x77')](_0x4362a0,[_0x3bbe('0xa7')]);if(_0x4362a0[_0x3bbe('0xa7')][_0x3bbe('0x51')]){return _0x4362a0['Contacts'][0x0];}var _0x47809a=_[_0x3bbe('0x1a')](_0x14f8a4[_0x3bbe('0x62')],{'firstName':_0x14f8a4[_0x3bbe('0x62')][_0x3bbe('0x99')],'ListId':_0x4362a0['id']});_0x47809a[_0x14f8a4['body'][_0x3bbe('0xa4')]]=_0x14f8a4[_0x3bbe('0x62')]['from'];return db[_0x3bbe('0xaa')]['create'](_0x47809a,{'fields':_0x16d30f,'raw':!![]});}})[_0x3bbe('0x22')](handleEntityNotFound(_0x4843fc,null))[_0x3bbe('0x22')](function(_0x5eeb53){if(_0x5eeb53){_0x14f8a4[_0x3bbe('0xab')]=_0x5eeb53;var _0xbd7470={'ContactId':_0x5eeb53['id'],'phone':_0x14f8a4['body']['from'],'WhatsappAccountId':_0x55361b['params']['id']};var _0x3accf5={'ContactId':_0x5eeb53['id'],'WhatsappAccountId':_0x55361b[_0x3bbe('0x60')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x3bbe('0x65')]({'where':_0x3accf5})['then'](function(_0x230240){if(_0x230240){return[_0x230240,![]];}return db[_0x3bbe('0xac')]['create'](_0xbd7470)[_0x3bbe('0x22')](function(_0x5c31fd){return[_0x5c31fd,!![]];});});}})[_0x3bbe('0x78')](function(_0x3108ed,_0x2b1029){_0x14f8a4[_0x3bbe('0xad')]=_0x3108ed[_0x3bbe('0x3d')]({'plain':!![]});_0x14f8a4[_0x3bbe('0xad')][_0x3bbe('0xae')]=![];if(_0x2b1029){if(_0x14f8a4[_0x3bbe('0x89')][_0x3bbe('0xaf')]){_0x14f8a4[_0x3bbe('0xb0')][_0x3bbe('0xb1')]({'id':0x0,'priority':_0x14f8a4[_0x3bbe('0xb0')][_0x3bbe('0x51')]+0x1,'app':_0x3bbe('0xb2'),'appdata':_0x3bbe('0xb3'),'interval':_0x3bbe('0xb4')});}_0x14f8a4[_0x3bbe('0xad')][_0x3bbe('0xae')]=!![];}return db[_0x3bbe('0xb5')][_0x3bbe('0x61')]({'phone':_0x14f8a4['body'][_0x3bbe('0x99')],'messageId':_0x14f8a4['body'][_0x3bbe('0x9f')],'body':_0x14f8a4[_0x3bbe('0x62')][_0x3bbe('0x62')],'WhatsappAccountId':_0x55361b[_0x3bbe('0x60')]['id'],'WhatsappInteractionId':_0x3108ed['id'],'direction':'in','ContactId':_0x3108ed[_0x3bbe('0xb6')],'AttachmentId':_0x14f8a4[_0x3bbe('0x62')][_0x3bbe('0xb7')]});})[_0x3bbe('0x22')](function(_0x5c6b3a){_0x14f8a4[_0x3bbe('0x2a')]=_0x5c6b3a;if(!_0x14f8a4['interaction'][_0x3bbe('0xb8')])return;return db[_0x3bbe('0xb9')][_0x3bbe('0x65')]({'attributes':['id',_0x3bbe('0x41')],'where':{'id':_0x14f8a4['interaction'][_0x3bbe('0xb8')]}});})[_0x3bbe('0x22')](function(_0x2c93c9){if(_0x2c93c9){_0x14f8a4[_0x3bbe('0xb0')][_0x3bbe('0xba')]({'id':0x0,'priority':0x0,'app':_0x3bbe('0xbb'),'appdata':_0x2c93c9[_0x3bbe('0x41')]+','+(_0x14f8a4[_0x3bbe('0x89')][_0x3bbe('0xbc')]||0xa),'interval':_0x3bbe('0xb4')});}if(!_0x14f8a4[_0x3bbe('0xad')][_0x3bbe('0xbd')])return;return db[_0x3bbe('0xbe')][_0x3bbe('0x65')]({'attributes':['id',_0x3bbe('0x41')],'where':{'id':_0x14f8a4[_0x3bbe('0xad')][_0x3bbe('0xbd')]}});})['then'](function(_0x822b55){if(_0x822b55){_0x14f8a4[_0x3bbe('0xb0')][_0x3bbe('0xba')]({'id':0x0,'priority':0x1,'app':_0x3bbe('0xbf'),'appdata':_0x822b55[_0x3bbe('0x41')]+','+(_0x14f8a4[_0x3bbe('0x89')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3bbe('0xc0'),_0x3bbe('0xc1'),_0x14f8a4);})[_0x3bbe('0x22')](function(_0x4e55ed){if(_0x4e55ed){var _0x307d81=0xc8;var _0x1d5cc9=_0x3bbe('0xc2');logger[_0x3bbe('0x2b')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1d5cc9,_0x307d81,'entity\x20found');logger[_0x3bbe('0x23')](_0x3bbe('0xc3'),_0x1d5cc9,_0x307d81,_0x3bbe('0xc4'),JSON[_0x3bbe('0x26')](_0x4e55ed));if(_0x14f8a4[_0x3bbe('0x89')]['type']==='twilio'){return _0x4843fc[_0x3bbe('0x2f')](_0x307d81)[_0x3bbe('0x35')](_0x3bbe('0xc5'),_0x3bbe('0xc6'))[_0x3bbe('0x42')](_0x3bbe('0xc7'));}else{return _0x4843fc[_0x3bbe('0x2f')](_0x307d81)['json'](_0x4e55ed);}}});})[_0x3bbe('0x2d')](handleError(_0x4843fc,null));};exports[_0x3bbe('0x42')]=function(_0x1c89d8,_0x51cfaf,_0xf80d4a){var _0x316d2b,_0x309f8d,_0x23f8d2;if(_[_0x3bbe('0xa1')](_0x1c89d8[_0x3bbe('0x62')]['body'])||_0x1c89d8[_0x3bbe('0x62')][_0x3bbe('0x62')]===''){throw new db[(_0x3bbe('0x92'))][(_0x3bbe('0x93'))](_0x3bbe('0xa0'));}if(_[_0x3bbe('0xa1')](_0x1c89d8[_0x3bbe('0x62')]['to'])){throw new db['Sequelize'][(_0x3bbe('0x93'))](_0x3bbe('0xc8'));}_0x316d2b=_0x1c89d8[_0x3bbe('0x62')]['to'];return db[_0x3bbe('0x45')][_0x3bbe('0x65')]({'where':{'id':_0x1c89d8[_0x3bbe('0x60')]['id']},'include':[{'model':db[_0x3bbe('0xa6')],'as':_0x3bbe('0xc9'),'include':[{'model':db[_0x3bbe('0xaa')],'as':'Contacts','where':{'mobile':_0x316d2b},'limit':0x1,'order':[[_0x3bbe('0xa8'),_0x3bbe('0xca')]]}]}]})['then'](handleEntityNotFound(_0x51cfaf,null))[_0x3bbe('0x22')](function(_0x77ba5d){if(_0x77ba5d&&_0x77ba5d[_0x3bbe('0xc9')]){_0x309f8d=_0x77ba5d[_0x3bbe('0x3d')]({'plain':!![]});if(_0x309f8d[_0x3bbe('0xc9')]&&_0x309f8d[_0x3bbe('0xc9')][_0x3bbe('0xa7')][_0x3bbe('0x51')]){return _0x309f8d['List'][_0x3bbe('0xa7')][0x0];}return db[_0x3bbe('0xaa')][_0x3bbe('0x61')](_['defaults'](_0x1c89d8['body'],{'firstName':_0x316d2b,'mobile':_0x316d2b,'phone':_0x316d2b,'ListId':_0x309f8d[_0x3bbe('0x96')]}));}})[_0x3bbe('0x22')](handleEntityNotFound(_0x51cfaf,null))[_0x3bbe('0x22')](function(_0x4fb050){if(_0x4fb050){_0x23f8d2=_0x4fb050;return db[_0x3bbe('0xac')][_0x3bbe('0x65')]({'where':{'ContactId':_0x23f8d2['id'],'closed':![],'WhatsappAccountId':_0x309f8d['id']}})[_0x3bbe('0x22')](function(_0x4089ce){if(_0x4089ce){return[_0x4089ce,![]];}return db[_0x3bbe('0xac')][_0x3bbe('0x61')]({'UserId':_0x1c89d8[_0x3bbe('0x63')]['id'],'ContactId':_0x23f8d2['id'],'WhatsappAccountId':_0x309f8d['id'],'phone':_0x316d2b,'firstMsgDirection':'out','Messages':[_[_0x3bbe('0x58')](_0x1c89d8[_0x3bbe('0x62')],{'read':![],'body':_0x1c89d8['body'][_0x3bbe('0x62')],'phone':_0x316d2b,'WhatsappAccountId':_0x309f8d['id'],'UserId':_0x1c89d8['user']['id'],'ContactId':_0x23f8d2['id']})]},{'include':[{'model':db[_0x3bbe('0xb5')],'as':_0x3bbe('0xcb')}]})[_0x3bbe('0x22')](function(_0x329fb8){return[_0x329fb8,!![]];});});}})[_0x3bbe('0x78')](function(_0x21e657,_0x462199){if(_0x462199){return _0x21e657;}return db['WhatsappMessage']['create'](_[_0x3bbe('0x58')](_0x1c89d8[_0x3bbe('0x62')],{'read':![],'body':_0x1c89d8[_0x3bbe('0x62')]['body'],'phone':_0x316d2b,'WhatsappAccountId':_0x309f8d['id'],'WhatsappInteractionId':_0x21e657['id'],'UserId':_0x1c89d8['user']['id'],'ContactId':_0x23f8d2['id']}))[_0x3bbe('0x22')](function(_0x74c1e0){_0x21e657[_0x3bbe('0xcc')][_0x3bbe('0xcb')]=[];_0x21e657[_0x3bbe('0xcc')]['Messages'][_0x3bbe('0xb1')](_0x74c1e0[_0x3bbe('0xcc')]);return _0x21e657;});})[_0x3bbe('0x22')](respondWithResult(_0x51cfaf,null))['catch'](handleError(_0x51cfaf,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 208e849..6c933e9 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 _0x9b84=['hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit'];(function(_0x570627,_0x3aaf2e){var _0x575a20=function(_0x220880){while(--_0x220880){_0x570627['push'](_0x570627['shift']());}};_0x575a20(++_0x3aaf2e);}(_0x9b84,0x12a));var _0x49b8=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0x9b84[_0x28407a];return _0x8bd6ef;};'use strict';var EventEmitter=require(_0x49b8('0x0'));var WhatsappAccount=require(_0x49b8('0x1'))['db'][_0x49b8('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x49b8('0x3')](0x0);var events={'afterCreate':_0x49b8('0x4'),'afterUpdate':_0x49b8('0x5'),'afterDestroy':_0x49b8('0x6')};function emitEvent(_0x115c45){return function(_0x1523c0,_0xbe2a64,_0x9dd791){WhatsappAccountEvents['emit'](_0x115c45+':'+_0x1523c0['id'],_0x1523c0);WhatsappAccountEvents[_0x49b8('0x7')](_0x115c45,_0x1523c0);_0x9dd791(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x49b8('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x0d59=['WhatsappAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x42acd0,_0x1ac887){var _0x2fed2e=function(_0x134b12){while(--_0x134b12){_0x42acd0['push'](_0x42acd0['shift']());}};_0x2fed2e(++_0x1ac887);}(_0x0d59,0x94));var _0x90d5=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x0d59[_0x11e30d];return _0x2d4e29;};'use strict';var EventEmitter=require(_0x90d5('0x0'));var WhatsappAccount=require(_0x90d5('0x1'))['db'][_0x90d5('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x90d5('0x3'),'afterUpdate':_0x90d5('0x4'),'afterDestroy':_0x90d5('0x5')};function emitEvent(_0x370d8f){return function(_0x247621,_0x1a2d68,_0x4f19d9){WhatsappAccountEvents[_0x90d5('0x6')](_0x370d8f+':'+_0x247621['id'],_0x247621);WhatsappAccountEvents[_0x90d5('0x6')](_0x370d8f,_0x247621);_0x4f19d9(null);};}for(var e in events){if(events[_0x90d5('0x7')](e)){var event=events[e];WhatsappAccount[_0x90d5('0x8')](e,emitEvent(event));}}module[_0x90d5('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 24a1ac6..2d906a1 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 _0x563e=['define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x335209,_0x2b983b){var _0x115ed9=function(_0x1d23c7){while(--_0x1d23c7){_0x335209['push'](_0x335209['shift']());}};_0x115ed9(++_0x2b983b);}(_0x563e,0xc3));var _0xe563=function(_0x219fa0,_0x18b239){_0x219fa0=_0x219fa0-0x0;var _0xc603fb=_0x563e[_0x219fa0];return _0xc603fb;};'use strict';var _=require(_0xe563('0x0'));var util=require('util');var logger=require(_0xe563('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe563('0x2'));var rp=require(_0xe563('0x3'));var fs=require('fs');var path=require(_0xe563('0x4'));var rimraf=require(_0xe563('0x5'));var config=require(_0xe563('0x6'));var attributes=require(_0xe563('0x7'));module[_0xe563('0x8')]=function(_0x5cdbb8,_0x18558c){return _0x5cdbb8[_0xe563('0x9')](_0xe563('0xa'),attributes,{'tableName':_0xe563('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7709=['define','WhatsappAccount','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x384375,_0x1204f7){var _0x380e2d=function(_0x41116){while(--_0x41116){_0x384375['push'](_0x384375['shift']());}};_0x380e2d(++_0x1204f7);}(_0x7709,0x1ba));var _0x9770=function(_0x26f45a,_0x1ae736){_0x26f45a=_0x26f45a-0x0;var _0x2e7da8=_0x7709[_0x26f45a];return _0x2e7da8;};'use strict';var _=require(_0x9770('0x0'));var util=require(_0x9770('0x1'));var logger=require(_0x9770('0x2'))(_0x9770('0x3'));var moment=require(_0x9770('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9770('0x5'));var rimraf=require(_0x9770('0x6'));var config=require(_0x9770('0x7'));var attributes=require(_0x9770('0x8'));module['exports']=function(_0x2c7c84,_0x16d814){return _0x2c7c84[_0x9770('0x9')](_0x9770('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 60488ae..cd26661 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 _0x3f18=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','result','WhatsappAccount','find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','stringify','catch','bluebird','randomstring','ioredis'];(function(_0x465b38,_0x148cd9){var _0x198fb5=function(_0x4746c1){while(--_0x4746c1){_0x465b38['push'](_0x465b38['shift']());}};_0x198fb5(++_0x148cd9);}(_0x3f18,0xc9));var _0x83f1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3f18[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x83f1('0x0'));var rs=require(_0x83f1('0x1'));var fs=require('fs');var Redis=require(_0x83f1('0x2'));var db=require(_0x83f1('0x3'))['db'];var utils=require(_0x83f1('0x4'));var logger=require(_0x83f1('0x5'))(_0x83f1('0x6'));var config=require(_0x83f1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x83f1('0x8')]({'port':0x232a});config[_0x83f1('0x9')]=_['defaults'](config[_0x83f1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x83f1('0xa'))(new Redis(config[_0x83f1('0x9')]));require(_0x83f1('0xb'))[_0x83f1('0xc')](socket);function respondWithRpcPromise(_0xa1ea80,_0x649fbe,_0x5ab419){return new BPromise(function(_0x2f72cc,_0x4a62b4){return client[_0x83f1('0xd')](_0xa1ea80,_0x5ab419)[_0x83f1('0xe')](function(_0x259ac8){logger[_0x83f1('0xf')](_0x83f1('0x10'),_0x649fbe,'request\x20sent');logger[_0x83f1('0x11')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x649fbe,_0x83f1('0x12'),JSON['stringify'](_0x259ac8));if(_0x259ac8[_0x83f1('0x13')]){if(_0x259ac8[_0x83f1('0x13')]['code']===0x1f4){logger[_0x83f1('0x13')](_0x83f1('0x10'),_0x649fbe,_0x259ac8[_0x83f1('0x13')][_0x83f1('0x14')]);return _0x4a62b4(_0x259ac8[_0x83f1('0x13')]['message']);}logger['error'](_0x83f1('0x10'),_0x649fbe,_0x259ac8[_0x83f1('0x13')]['message']);return _0x2f72cc(_0x259ac8['error'][_0x83f1('0x14')]);}else{logger[_0x83f1('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x649fbe,_0x83f1('0x12'));_0x2f72cc(_0x259ac8[_0x83f1('0x15')][_0x83f1('0x14')]);}})['catch'](function(_0x295e13){logger[_0x83f1('0x13')](_0x83f1('0x10'),_0x649fbe,_0x295e13);_0x4a62b4(_0x295e13);});});}exports['ShowWhatsappAccount']=function(_0x3aa4d8){var _0x5a891b=this;return new Promise(function(_0x141b19,_0x29bf82){return db[_0x83f1('0x16')][_0x83f1('0x17')]({'raw':_0x3aa4d8[_0x83f1('0x18')]?_0x3aa4d8['options'][_0x83f1('0x19')]===undefined?!![]:![]:!![],'where':_0x3aa4d8[_0x83f1('0x18')]?_0x3aa4d8[_0x83f1('0x18')][_0x83f1('0x1a')]||null:null,'attributes':_0x3aa4d8['options']?_0x3aa4d8['options'][_0x83f1('0x1b')]||null:null,'include':_0x3aa4d8[_0x83f1('0x18')]?_0x3aa4d8[_0x83f1('0x18')][_0x83f1('0x1c')]?_[_0x83f1('0x1d')](_0x3aa4d8['options']['include'],function(_0x5b26b7){return{'model':db[_0x5b26b7['model']],'as':_0x5b26b7['as'],'attributes':_0x5b26b7[_0x83f1('0x1b')],'include':_0x5b26b7['include']?_[_0x83f1('0x1d')](_0x5b26b7[_0x83f1('0x1c')],function(_0x1abb23){return{'model':db[_0x1abb23['model']],'as':_0x1abb23['as'],'attributes':_0x1abb23[_0x83f1('0x1b')],'include':_0x1abb23['include']?_[_0x83f1('0x1d')](_0x1abb23['include'],function(_0x4cec8a){return{'model':db[_0x4cec8a[_0x83f1('0x1e')]],'as':_0x4cec8a['as'],'attributes':_0x4cec8a[_0x83f1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x83f1('0xe')](function(_0x3913a9){logger[_0x83f1('0xf')](_0x83f1('0x1f'),_0x3aa4d8);logger[_0x83f1('0x11')](_0x83f1('0x1f'),_0x3aa4d8,JSON[_0x83f1('0x20')](_0x3913a9));_0x141b19(_0x3913a9);})[_0x83f1('0x21')](function(_0xcff679){logger[_0x83f1('0x13')](_0x83f1('0x1f'),_0xcff679['message'],_0x3aa4d8);_0x29bf82(_0x5a891b[_0x83f1('0x13')](0x1f4,_0xcff679['message']));});});}; \ No newline at end of file +var _0xd3d3=['info','stringify','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','include','model','map'];(function(_0x4915ac,_0x109893){var _0x1ffb99=function(_0x23cd8e){while(--_0x23cd8e){_0x4915ac['push'](_0x4915ac['shift']());}};_0x1ffb99(++_0x109893);}(_0xd3d3,0x19a));var _0x3d3d=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xd3d3[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3d3d('0x0'));var BPromise=require(_0x3d3d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d3d('0x2'));var logger=require(_0x3d3d('0x3'))(_0x3d3d('0x4'));var config=require('../../config/environment');var jayson=require(_0x3d3d('0x5'));var client=jayson['client'][_0x3d3d('0x6')]({'port':0x232a});config[_0x3d3d('0x7')]=_[_0x3d3d('0x8')](config[_0x3d3d('0x7')],{'host':_0x3d3d('0x9'),'port':0x18eb});var socket=require(_0x3d3d('0xa'))(new Redis(config[_0x3d3d('0x7')]));require('./whatsappAccount.socket')[_0x3d3d('0xb')](socket);function respondWithRpcPromise(_0x46aeb7,_0x5d804b,_0x2d3734){return new BPromise(function(_0xc19309,_0x353300){return client[_0x3d3d('0xc')](_0x46aeb7,_0x2d3734)[_0x3d3d('0xd')](function(_0x18b9d0){logger['info'](_0x3d3d('0xe'),_0x5d804b,'request\x20sent');logger[_0x3d3d('0xf')](_0x3d3d('0x10'),_0x5d804b,_0x3d3d('0x11'),JSON['stringify'](_0x18b9d0));if(_0x18b9d0[_0x3d3d('0x12')]){if(_0x18b9d0[_0x3d3d('0x12')][_0x3d3d('0x13')]===0x1f4){logger['error'](_0x3d3d('0xe'),_0x5d804b,_0x18b9d0[_0x3d3d('0x12')][_0x3d3d('0x14')]);return _0x353300(_0x18b9d0[_0x3d3d('0x12')][_0x3d3d('0x14')]);}logger[_0x3d3d('0x12')](_0x3d3d('0xe'),_0x5d804b,_0x18b9d0['error'][_0x3d3d('0x14')]);return _0xc19309(_0x18b9d0[_0x3d3d('0x12')][_0x3d3d('0x14')]);}else{logger['info'](_0x3d3d('0xe'),_0x5d804b,_0x3d3d('0x11'));_0xc19309(_0x18b9d0[_0x3d3d('0x15')][_0x3d3d('0x14')]);}})[_0x3d3d('0x16')](function(_0x219ceb){logger[_0x3d3d('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x5d804b,_0x219ceb);_0x353300(_0x219ceb);});});}exports[_0x3d3d('0x17')]=function(_0x591721){var _0x16cc8c=this;return new Promise(function(_0x18ae8c,_0x5691d9){return db['WhatsappAccount'][_0x3d3d('0x18')]({'raw':_0x591721[_0x3d3d('0x19')]?_0x591721[_0x3d3d('0x19')][_0x3d3d('0x1a')]===undefined?!![]:![]:!![],'where':_0x591721['options']?_0x591721[_0x3d3d('0x19')][_0x3d3d('0x1b')]||null:null,'attributes':_0x591721[_0x3d3d('0x19')]?_0x591721['options'][_0x3d3d('0x1c')]||null:null,'include':_0x591721[_0x3d3d('0x19')]?_0x591721[_0x3d3d('0x19')]['include']?_['map'](_0x591721[_0x3d3d('0x19')][_0x3d3d('0x1d')],function(_0x43b40b){return{'model':db[_0x43b40b[_0x3d3d('0x1e')]],'as':_0x43b40b['as'],'attributes':_0x43b40b['attributes'],'include':_0x43b40b[_0x3d3d('0x1d')]?_[_0x3d3d('0x1f')](_0x43b40b[_0x3d3d('0x1d')],function(_0x16d8af){return{'model':db[_0x16d8af[_0x3d3d('0x1e')]],'as':_0x16d8af['as'],'attributes':_0x16d8af[_0x3d3d('0x1c')],'include':_0x16d8af[_0x3d3d('0x1d')]?_['map'](_0x16d8af['include'],function(_0x4b4e04){return{'model':db[_0x4b4e04['model']],'as':_0x4b4e04['as'],'attributes':_0x4b4e04['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfda534){logger[_0x3d3d('0x20')](_0x3d3d('0x17'),_0x591721);logger[_0x3d3d('0xf')](_0x3d3d('0x17'),_0x591721,JSON[_0x3d3d('0x21')](_0xfda534));_0x18ae8c(_0xfda534);})[_0x3d3d('0x16')](function(_0x5c1e3c){logger[_0x3d3d('0x12')](_0x3d3d('0x17'),_0x5c1e3c[_0x3d3d('0x14')],_0x591721);_0x5691d9(_0x16cc8c[_0x3d3d('0x12')](0x1f4,_0x5c1e3c[_0x3d3d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 42cd934..d027746 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 _0xa505=['whatsappAccount:','./whatsappAccount.events','remove','update','emit','removeListener'];(function(_0x374235,_0x242c26){var _0x67630d=function(_0x4fc722){while(--_0x4fc722){_0x374235['push'](_0x374235['shift']());}};_0x67630d(++_0x242c26);}(_0xa505,0x199));var _0x5a50=function(_0x4d8511,_0x14f75f){_0x4d8511=_0x4d8511-0x0;var _0x47a898=_0xa505[_0x4d8511];return _0x47a898;};'use strict';var WhatsappAccountEvents=require(_0x5a50('0x0'));var events=['save',_0x5a50('0x1'),_0x5a50('0x2')];function createListener(_0x234d8d,_0xb1d9aa){return function(_0x2ee974){_0xb1d9aa[_0x5a50('0x3')](_0x234d8d,_0x2ee974);};}function removeListener(_0x2eded0,_0x39c318){return function(){WhatsappAccountEvents[_0x5a50('0x4')](_0x2eded0,_0x39c318);};}exports['register']=function(_0x4149af){for(var _0x59e9ad=0x0,_0x15e129=events['length'];_0x59e9ad<_0x15e129;_0x59e9ad++){var _0x378905=events[_0x59e9ad];var _0x158fd7=createListener(_0x5a50('0x5')+_0x378905,_0x4149af);WhatsappAccountEvents['on'](_0x378905,_0x158fd7);}}; \ No newline at end of file +var _0x88b3=['emit','removeListener','register','length','whatsappAccount:','save','remove'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0x88b3,0xf3));var _0x388b=function(_0x52753e,_0x1718bc){_0x52753e=_0x52753e-0x0;var _0x5b2cd5=_0x88b3[_0x52753e];return _0x5b2cd5;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x388b('0x0'),_0x388b('0x1'),'update'];function createListener(_0x21aa88,_0x33b7ac){return function(_0x33b520){_0x33b7ac[_0x388b('0x2')](_0x21aa88,_0x33b520);};}function removeListener(_0xcb3cb9,_0x40f58e){return function(){WhatsappAccountEvents[_0x388b('0x3')](_0xcb3cb9,_0x40f58e);};}exports[_0x388b('0x4')]=function(_0x48b091){for(var _0x1f7454=0x0,_0x2e7390=events[_0x388b('0x5')];_0x1f7454<_0x2e7390;_0x1f7454++){var _0x2b8b58=events[_0x1f7454];var _0xf0e683=createListener(_0x388b('0x6')+_0x2b8b58,_0x48b091);WhatsappAccountEvents['on'](_0x2b8b58,_0xf0e683);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index d21700b..dc3b76d 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 _0x9c08=['util','path','express','Router','fs-extra','../../components/auth/service','./whatsappApplication.controller','get','isAuthenticated','show','create','put','/:id','update','delete','destroy'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0x9c08,0x1c0));var _0x89c0=function(_0x2c9cf9,_0x2bed45){_0x2c9cf9=_0x2c9cf9-0x0;var _0x560d6d=_0x9c08[_0x2c9cf9];return _0x560d6d;};'use strict';var multer=require('multer');var util=require(_0x89c0('0x0'));var path=require(_0x89c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x89c0('0x2'));var router=express[_0x89c0('0x3')]();var fs_extra=require(_0x89c0('0x4'));var auth=require(_0x89c0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89c0('0x6'));router[_0x89c0('0x7')]('/',auth[_0x89c0('0x8')](),controller['index']);router[_0x89c0('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x89c0('0x9')]);router['post']('/',auth[_0x89c0('0x8')](),controller[_0x89c0('0xa')]);router[_0x89c0('0xb')](_0x89c0('0xc'),auth['isAuthenticated'](),controller[_0x89c0('0xd')]);router[_0x89c0('0xe')](_0x89c0('0xc'),auth[_0x89c0('0x8')](),controller[_0x89c0('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2707=['multer','path','connect-timeout','express','fs-extra','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports'];(function(_0x41f04d,_0x18f501){var _0x2591b2=function(_0x1c9a2e){while(--_0x1c9a2e){_0x41f04d['push'](_0x41f04d['shift']());}};_0x2591b2(++_0x18f501);}(_0x2707,0x120));var _0x7270=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x2707[_0x5a776b];return _0xbbef59;};'use strict';var multer=require(_0x7270('0x0'));var util=require('util');var path=require(_0x7270('0x1'));var timeout=require(_0x7270('0x2'));var express=require(_0x7270('0x3'));var router=express['Router']();var fs_extra=require(_0x7270('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7270('0x5'));var controller=require(_0x7270('0x6'));router[_0x7270('0x7')]('/',auth['isAuthenticated'](),controller[_0x7270('0x8')]);router[_0x7270('0x7')](_0x7270('0x9'),auth[_0x7270('0xa')](),controller[_0x7270('0xb')]);router[_0x7270('0xc')]('/',auth[_0x7270('0xa')](),controller['create']);router[_0x7270('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7270('0xe')]);router[_0x7270('0xf')](_0x7270('0x9'),auth['isAuthenticated'](),controller[_0x7270('0x10')]);module[_0x7270('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ed0a1f6..b88bc08 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 _0xa548=['exports','INTEGER','noop','STRING','*,*,*,*','sequelize'];(function(_0x1c841d,_0x376f78){var _0x123d8d=function(_0x4009e7){while(--_0x4009e7){_0x1c841d['push'](_0x1c841d['shift']());}};_0x123d8d(++_0x376f78);}(_0xa548,0x191));var _0x8a54=function(_0x3a3bae,_0x5c64d7){_0x3a3bae=_0x3a3bae-0x0;var _0x58cf6d=_0xa548[_0x3a3bae];return _0x58cf6d;};'use strict';var Sequelize=require(_0x8a54('0x0'));module[_0x8a54('0x1')]={'priority':{'type':Sequelize[_0x8a54('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8a54('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8a54('0x4')],'defaultValue':_0x8a54('0x5')}}; \ No newline at end of file +var _0xc143=['TEXT','*,*,*,*','exports','STRING','noop'];(function(_0x2c9e2a,_0x50ebd6){var _0x1f95a4=function(_0xa5c954){while(--_0xa5c954){_0x2c9e2a['push'](_0x2c9e2a['shift']());}};_0x1f95a4(++_0x50ebd6);}(_0xc143,0x147));var _0x3c14=function(_0x4c7a17,_0x5a1aeb){_0x4c7a17=_0x4c7a17-0x0;var _0x5ac72c=_0xc143[_0x4c7a17];return _0x5ac72c;};'use strict';var Sequelize=require('sequelize');module[_0x3c14('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3c14('0x1')],'allowNull':![],'defaultValue':_0x3c14('0x2')},'appdata':{'type':Sequelize[_0x3c14('0x3')]()},'description':{'type':Sequelize[_0x3c14('0x1')]},'interval':{'type':Sequelize[_0x3c14('0x1')],'defaultValue':_0x3c14('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 5f346cf..bb6fea2 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 _0x1f2d=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','error','stack','name','send','index','WhatsappApplication','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','then','include','findAll','catch','show','params','rawAttributes','create','update','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','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'];(function(_0x9a87a8,_0x46fc68){var _0x25be63=function(_0x3c9e09){while(--_0x3c9e09){_0x9a87a8['push'](_0x9a87a8['shift']());}};_0x25be63(++_0x46fc68);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0x5b1c50,_0x56e694){_0x5b1c50=_0x5b1c50-0x0;var _0x2d379b=_0x1f2d[_0x5b1c50];return _0x2d379b;};'use strict';var emlformat=require(_0xd1f2('0x0'));var rimraf=require(_0xd1f2('0x1'));var zipdir=require(_0xd1f2('0x2'));var jsonpatch=require(_0xd1f2('0x3'));var rp=require('request-promise');var moment=require(_0xd1f2('0x4'));var BPromise=require(_0xd1f2('0x5'));var Mustache=require(_0xd1f2('0x6'));var util=require(_0xd1f2('0x7'));var path=require(_0xd1f2('0x8'));var sox=require(_0xd1f2('0x9'));var csv=require(_0xd1f2('0xa'));var ejs=require(_0xd1f2('0xb'));var fs=require('fs');var fs_extra=require(_0xd1f2('0xc'));var _=require(_0xd1f2('0xd'));var squel=require(_0xd1f2('0xe'));var crypto=require(_0xd1f2('0xf'));var jsforce=require(_0xd1f2('0x10'));var deskjs=require(_0xd1f2('0x11'));var toCsv=require(_0xd1f2('0xa'));var querystring=require(_0xd1f2('0x12'));var Papa=require(_0xd1f2('0x13'));var Redis=require('ioredis');var authService=require(_0xd1f2('0x14'));var qs=require(_0xd1f2('0x15'));var as=require(_0xd1f2('0x16'));var hardwareService=require(_0xd1f2('0x17'));var logger=require('../../config/logger')(_0xd1f2('0x18'));var utils=require(_0xd1f2('0x19'));var config=require(_0xd1f2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd1f2('0x1b'))['db'];function respondWithStatusCode(_0x347eba,_0x2ef331){_0x2ef331=_0x2ef331||0xcc;return function(_0x1d09f6){if(_0x1d09f6){return _0x347eba[_0xd1f2('0x1c')](_0x2ef331);}return _0x347eba[_0xd1f2('0x1d')](_0x2ef331)[_0xd1f2('0x1e')]();};}function respondWithResult(_0x596a54,_0x4d71d1){_0x4d71d1=_0x4d71d1||0xc8;return function(_0x5a3c44){if(_0x5a3c44){return _0x596a54['status'](_0x4d71d1)['json'](_0x5a3c44);}};}function respondWithFilteredResult(_0x19eb09,_0x1e0226){return function(_0x20d25d){if(_0x20d25d){var _0x1bd6ac=typeof _0x1e0226[_0xd1f2('0x1f')]===_0xd1f2('0x20')&&typeof _0x1e0226[_0xd1f2('0x21')]==='undefined';var _0x2af2d8=_0x20d25d[_0xd1f2('0x22')];var _0x2cd4fa=_0x1bd6ac?0x0:_0x1e0226[_0xd1f2('0x1f')];var _0x1f05f4=_0x1bd6ac?_0x20d25d[_0xd1f2('0x22')]:_0x1e0226[_0xd1f2('0x1f')]+_0x1e0226['limit'];var _0x12343a;if(_0x1f05f4>=_0x2af2d8){_0x1f05f4=_0x2af2d8;_0x12343a=0xc8;}else{_0x12343a=0xce;}_0x19eb09[_0xd1f2('0x1d')](_0x12343a);return _0x19eb09[_0xd1f2('0x23')](_0xd1f2('0x24'),_0x2cd4fa+'-'+_0x1f05f4+'/'+_0x2af2d8)[_0xd1f2('0x25')](_0x20d25d);}return null;};}function patchUpdates(_0x40b992){return function(_0x2a666f){try{jsonpatch[_0xd1f2('0x26')](_0x2a666f,_0x40b992,!![]);}catch(_0x23250f){return BPromise[_0xd1f2('0x27')](_0x23250f);}return _0x2a666f[_0xd1f2('0x28')]();};}function saveUpdates(_0x4b74ff,_0x3ccd12){return function(_0x779022){if(_0x779022){return _0x779022['update'](_0x4b74ff)['then'](function(_0x36c147){return _0x36c147;});}return null;};}function removeEntity(_0x824485,_0x5a5278){return function(_0x527471){if(_0x527471){return _0x527471['destroy']()['then'](function(){_0x824485['status'](0xcc)[_0xd1f2('0x1e')]();});}};}function handleEntityNotFound(_0x3f181b,_0x2557d0){return function(_0x2c0bbb){if(!_0x2c0bbb){_0x3f181b[_0xd1f2('0x1c')](0x194);}return _0x2c0bbb;};}function handleError(_0x493870,_0xf935fc){_0xf935fc=_0xf935fc||0x1f4;return function(_0x3a99b2){logger[_0xd1f2('0x29')](_0x3a99b2[_0xd1f2('0x2a')]);if(_0x3a99b2[_0xd1f2('0x2b')]){delete _0x3a99b2[_0xd1f2('0x2b')];}_0x493870[_0xd1f2('0x1d')](_0xf935fc)[_0xd1f2('0x2c')](_0x3a99b2);};}exports[_0xd1f2('0x2d')]=function(_0x2c1d0e,_0x3e5e6c){var _0x58dd7c={},_0x4ef315={},_0x174306={'count':0x0,'rows':[]};var _0x409640=_['map'](db[_0xd1f2('0x2e')]['rawAttributes'],function(_0x1b9c0f){return{'name':_0x1b9c0f[_0xd1f2('0x2f')],'type':_0x1b9c0f[_0xd1f2('0x30')]['key']};});_0x4ef315[_0xd1f2('0x31')]=_['map'](_0x409640,'name');_0x4ef315[_0xd1f2('0x32')]=_[_0xd1f2('0x33')](_0x2c1d0e[_0xd1f2('0x32')]);_0x4ef315[_0xd1f2('0x34')]=_['intersection'](_0x4ef315[_0xd1f2('0x31')],_0x4ef315['query']);_0x58dd7c[_0xd1f2('0x35')]=_[_0xd1f2('0x36')](_0x4ef315['model'],qs[_0xd1f2('0x37')](_0x2c1d0e['query'][_0xd1f2('0x37')]));_0x58dd7c[_0xd1f2('0x35')]=_0x58dd7c[_0xd1f2('0x35')][_0xd1f2('0x38')]?_0x58dd7c[_0xd1f2('0x35')]:_0x4ef315[_0xd1f2('0x31')];if(!_0x2c1d0e['query'][_0xd1f2('0x39')](_0xd1f2('0x3a'))){_0x58dd7c[_0xd1f2('0x21')]=qs[_0xd1f2('0x21')](_0x2c1d0e[_0xd1f2('0x32')]['limit']);_0x58dd7c[_0xd1f2('0x1f')]=qs[_0xd1f2('0x1f')](_0x2c1d0e['query'][_0xd1f2('0x1f')]);}_0x58dd7c['order']=qs[_0xd1f2('0x3b')](_0x2c1d0e[_0xd1f2('0x32')][_0xd1f2('0x3b')]);_0x58dd7c[_0xd1f2('0x3c')]=qs['filters'](_[_0xd1f2('0x3d')](_0x2c1d0e[_0xd1f2('0x32')],_0x4ef315[_0xd1f2('0x34')]),_0x409640);if(_0x2c1d0e[_0xd1f2('0x32')][_0xd1f2('0x3e')]){_0x58dd7c[_0xd1f2('0x3c')]=_[_0xd1f2('0x3f')](_0x58dd7c['where'],{'$or':_[_0xd1f2('0x40')](_0x409640,function(_0x5db7f0){if(_0x5db7f0[_0xd1f2('0x30')]!==_0xd1f2('0x41')){var _0x1edc3d={};_0x1edc3d[_0x5db7f0['name']]={'$like':'%'+_0x2c1d0e[_0xd1f2('0x32')]['filter']+'%'};return _0x1edc3d;}})});}_0x58dd7c=_[_0xd1f2('0x3f')]({},_0x58dd7c,_0x2c1d0e[_0xd1f2('0x42')]);var _0x3c4cc1={'where':_0x58dd7c[_0xd1f2('0x3c')]};return db[_0xd1f2('0x2e')]['count'](_0x3c4cc1)[_0xd1f2('0x43')](function(_0x468311){_0x174306['count']=_0x468311;if(_0x2c1d0e[_0xd1f2('0x32')]['includeAll']){_0x58dd7c[_0xd1f2('0x44')]=[{'all':!![]}];}return db[_0xd1f2('0x2e')][_0xd1f2('0x45')](_0x58dd7c);})['then'](function(_0x3af39d){_0x174306['rows']=_0x3af39d;return _0x174306;})[_0xd1f2('0x43')](respondWithFilteredResult(_0x3e5e6c,_0x58dd7c))[_0xd1f2('0x46')](handleError(_0x3e5e6c,null));};exports[_0xd1f2('0x47')]=function(_0x6c46f8,_0x4256b6){var _0x1cca88={'raw':!![],'where':{'id':_0x6c46f8[_0xd1f2('0x48')]['id']}},_0x436b8b={};_0x436b8b['model']=_[_0xd1f2('0x33')](db[_0xd1f2('0x2e')][_0xd1f2('0x49')]);_0x436b8b[_0xd1f2('0x32')]=_[_0xd1f2('0x33')](_0x6c46f8[_0xd1f2('0x32')]);_0x436b8b['filters']=_[_0xd1f2('0x36')](_0x436b8b[_0xd1f2('0x31')],_0x436b8b[_0xd1f2('0x32')]);_0x1cca88['attributes']=_[_0xd1f2('0x36')](_0x436b8b[_0xd1f2('0x31')],qs[_0xd1f2('0x37')](_0x6c46f8[_0xd1f2('0x32')][_0xd1f2('0x37')]));_0x1cca88[_0xd1f2('0x35')]=_0x1cca88['attributes'][_0xd1f2('0x38')]?_0x1cca88[_0xd1f2('0x35')]:_0x436b8b[_0xd1f2('0x31')];if(_0x6c46f8[_0xd1f2('0x32')]['includeAll']){_0x1cca88[_0xd1f2('0x44')]=[{'all':!![]}];}_0x1cca88=_[_0xd1f2('0x3f')]({},_0x1cca88,_0x6c46f8['options']);return db[_0xd1f2('0x2e')]['find'](_0x1cca88)[_0xd1f2('0x43')](handleEntityNotFound(_0x4256b6,null))['then'](respondWithResult(_0x4256b6,null))[_0xd1f2('0x46')](handleError(_0x4256b6,null));};exports[_0xd1f2('0x4a')]=function(_0x45b0c6,_0x1b7b47){return db[_0xd1f2('0x2e')][_0xd1f2('0x4a')](_0x45b0c6['body'],{})[_0xd1f2('0x43')](respondWithResult(_0x1b7b47,0xc9))[_0xd1f2('0x46')](handleError(_0x1b7b47,null));};exports[_0xd1f2('0x4b')]=function(_0x83734e,_0xc33ad5){if(_0x83734e['body']['id']){delete _0x83734e[_0xd1f2('0x4c')]['id'];}return db[_0xd1f2('0x2e')][_0xd1f2('0x4d')]({'where':{'id':_0x83734e[_0xd1f2('0x48')]['id']}})[_0xd1f2('0x43')](handleEntityNotFound(_0xc33ad5,null))['then'](saveUpdates(_0x83734e[_0xd1f2('0x4c')],null))[_0xd1f2('0x43')](respondWithResult(_0xc33ad5,null))[_0xd1f2('0x46')](handleError(_0xc33ad5,null));};exports[_0xd1f2('0x4e')]=function(_0x23b429,_0x1f7d4c){return db[_0xd1f2('0x2e')][_0xd1f2('0x4d')]({'where':{'id':_0x23b429[_0xd1f2('0x48')]['id']}})[_0xd1f2('0x43')](handleEntityNotFound(_0x1f7d4c,null))['then'](removeEntity(_0x1f7d4c,null))['catch'](handleError(_0x1f7d4c,null));}; \ No newline at end of file +var _0x67d1=['query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','count','set','Content-Range','json','save','update','then','destroy','sendStatus','stack','name','send','index','map','WhatsappApplication','type','key','model','keys'];(function(_0x5136db,_0x39a4fb){var _0x4af8ca=function(_0x541c3a){while(--_0x541c3a){_0x5136db['push'](_0x5136db['shift']());}};_0x4af8ca(++_0x39a4fb);}(_0x67d1,0xf1));var _0x167d=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x67d1[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x167d('0x0'));var zipdir=require(_0x167d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x167d('0x2'));var moment=require(_0x167d('0x3'));var BPromise=require(_0x167d('0x4'));var Mustache=require(_0x167d('0x5'));var util=require('util');var path=require(_0x167d('0x6'));var sox=require(_0x167d('0x7'));var csv=require(_0x167d('0x8'));var ejs=require(_0x167d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x167d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x167d('0xb'));var deskjs=require(_0x167d('0xc'));var toCsv=require(_0x167d('0x8'));var querystring=require(_0x167d('0xd'));var Papa=require(_0x167d('0xe'));var Redis=require(_0x167d('0xf'));var authService=require(_0x167d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x167d('0x11'));var hardwareService=require(_0x167d('0x12'));var logger=require(_0x167d('0x13'))(_0x167d('0x14'));var utils=require(_0x167d('0x15'));var config=require(_0x167d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x167d('0x17'))['db'];function respondWithStatusCode(_0x506499,_0x267aee){_0x267aee=_0x267aee||0xcc;return function(_0x24184c){if(_0x24184c){return _0x506499['sendStatus'](_0x267aee);}return _0x506499[_0x167d('0x18')](_0x267aee)[_0x167d('0x19')]();};}function respondWithResult(_0x47e5db,_0x174d37){_0x174d37=_0x174d37||0xc8;return function(_0x260b9c){if(_0x260b9c){return _0x47e5db['status'](_0x174d37)['json'](_0x260b9c);}};}function respondWithFilteredResult(_0x22c668,_0x29399a){return function(_0x9752ed){if(_0x9752ed){var _0x5191bc=typeof _0x29399a[_0x167d('0x1a')]==='undefined'&&typeof _0x29399a[_0x167d('0x1b')]==='undefined';var _0xc35ee9=_0x9752ed[_0x167d('0x1c')];var _0x1e1611=_0x5191bc?0x0:_0x29399a['offset'];var _0x6db64f=_0x5191bc?_0x9752ed[_0x167d('0x1c')]:_0x29399a[_0x167d('0x1a')]+_0x29399a['limit'];var _0x2fbab6;if(_0x6db64f>=_0xc35ee9){_0x6db64f=_0xc35ee9;_0x2fbab6=0xc8;}else{_0x2fbab6=0xce;}_0x22c668[_0x167d('0x18')](_0x2fbab6);return _0x22c668[_0x167d('0x1d')](_0x167d('0x1e'),_0x1e1611+'-'+_0x6db64f+'/'+_0xc35ee9)[_0x167d('0x1f')](_0x9752ed);}return null;};}function patchUpdates(_0x2b2794){return function(_0x4d5ef4){try{jsonpatch['apply'](_0x4d5ef4,_0x2b2794,!![]);}catch(_0x366c8b){return BPromise['reject'](_0x366c8b);}return _0x4d5ef4[_0x167d('0x20')]();};}function saveUpdates(_0x41e8d6,_0x4f70d6){return function(_0x595516){if(_0x595516){return _0x595516[_0x167d('0x21')](_0x41e8d6)[_0x167d('0x22')](function(_0x160677){return _0x160677;});}return null;};}function removeEntity(_0x2210a6,_0x53a29f){return function(_0x1bbe44){if(_0x1bbe44){return _0x1bbe44[_0x167d('0x23')]()[_0x167d('0x22')](function(){_0x2210a6[_0x167d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36fda8,_0x279fa1){return function(_0x387bcc){if(!_0x387bcc){_0x36fda8[_0x167d('0x24')](0x194);}return _0x387bcc;};}function handleError(_0x4530eb,_0x4f09ab){_0x4f09ab=_0x4f09ab||0x1f4;return function(_0xbc5f2b){logger['error'](_0xbc5f2b[_0x167d('0x25')]);if(_0xbc5f2b[_0x167d('0x26')]){delete _0xbc5f2b[_0x167d('0x26')];}_0x4530eb[_0x167d('0x18')](_0x4f09ab)[_0x167d('0x27')](_0xbc5f2b);};}exports[_0x167d('0x28')]=function(_0x581fea,_0x276e1d){var _0x481e18={},_0x382851={},_0x4cb4bf={'count':0x0,'rows':[]};var _0x526b8e=_[_0x167d('0x29')](db[_0x167d('0x2a')]['rawAttributes'],function(_0xe9e561){return{'name':_0xe9e561['fieldName'],'type':_0xe9e561[_0x167d('0x2b')][_0x167d('0x2c')]};});_0x382851[_0x167d('0x2d')]=_[_0x167d('0x29')](_0x526b8e,'name');_0x382851['query']=_[_0x167d('0x2e')](_0x581fea[_0x167d('0x2f')]);_0x382851[_0x167d('0x30')]=_[_0x167d('0x31')](_0x382851['model'],_0x382851['query']);_0x481e18['attributes']=_[_0x167d('0x31')](_0x382851[_0x167d('0x2d')],qs['fields'](_0x581fea[_0x167d('0x2f')]['fields']));_0x481e18[_0x167d('0x32')]=_0x481e18[_0x167d('0x32')][_0x167d('0x33')]?_0x481e18['attributes']:_0x382851[_0x167d('0x2d')];if(!_0x581fea[_0x167d('0x2f')][_0x167d('0x34')](_0x167d('0x35'))){_0x481e18['limit']=qs[_0x167d('0x1b')](_0x581fea['query'][_0x167d('0x1b')]);_0x481e18[_0x167d('0x1a')]=qs[_0x167d('0x1a')](_0x581fea[_0x167d('0x2f')][_0x167d('0x1a')]);}_0x481e18['order']=qs['sort'](_0x581fea['query'][_0x167d('0x36')]);_0x481e18[_0x167d('0x37')]=qs[_0x167d('0x30')](_[_0x167d('0x38')](_0x581fea[_0x167d('0x2f')],_0x382851[_0x167d('0x30')]),_0x526b8e);if(_0x581fea[_0x167d('0x2f')][_0x167d('0x39')]){_0x481e18[_0x167d('0x37')]=_[_0x167d('0x3a')](_0x481e18['where'],{'$or':_[_0x167d('0x29')](_0x526b8e,function(_0x5cf3d2){if(_0x5cf3d2[_0x167d('0x2b')]!==_0x167d('0x3b')){var _0x183a4e={};_0x183a4e[_0x5cf3d2[_0x167d('0x26')]]={'$like':'%'+_0x581fea[_0x167d('0x2f')][_0x167d('0x39')]+'%'};return _0x183a4e;}})});}_0x481e18=_['merge']({},_0x481e18,_0x581fea[_0x167d('0x3c')]);var _0xee6f7a={'where':_0x481e18[_0x167d('0x37')]};return db[_0x167d('0x2a')][_0x167d('0x1c')](_0xee6f7a)[_0x167d('0x22')](function(_0x13f340){_0x4cb4bf[_0x167d('0x1c')]=_0x13f340;if(_0x581fea['query'][_0x167d('0x3d')]){_0x481e18[_0x167d('0x3e')]=[{'all':!![]}];}return db[_0x167d('0x2a')][_0x167d('0x3f')](_0x481e18);})['then'](function(_0x4160da){_0x4cb4bf[_0x167d('0x40')]=_0x4160da;return _0x4cb4bf;})['then'](respondWithFilteredResult(_0x276e1d,_0x481e18))['catch'](handleError(_0x276e1d,null));};exports[_0x167d('0x41')]=function(_0x46e0ed,_0x47cf69){var _0x173f7c={'raw':!![],'where':{'id':_0x46e0ed[_0x167d('0x42')]['id']}},_0x483f45={};_0x483f45[_0x167d('0x2d')]=_['keys'](db[_0x167d('0x2a')]['rawAttributes']);_0x483f45[_0x167d('0x2f')]=_[_0x167d('0x2e')](_0x46e0ed[_0x167d('0x2f')]);_0x483f45[_0x167d('0x30')]=_[_0x167d('0x31')](_0x483f45[_0x167d('0x2d')],_0x483f45[_0x167d('0x2f')]);_0x173f7c[_0x167d('0x32')]=_[_0x167d('0x31')](_0x483f45[_0x167d('0x2d')],qs['fields'](_0x46e0ed[_0x167d('0x2f')][_0x167d('0x43')]));_0x173f7c[_0x167d('0x32')]=_0x173f7c[_0x167d('0x32')][_0x167d('0x33')]?_0x173f7c[_0x167d('0x32')]:_0x483f45[_0x167d('0x2d')];if(_0x46e0ed[_0x167d('0x2f')][_0x167d('0x3d')]){_0x173f7c[_0x167d('0x3e')]=[{'all':!![]}];}_0x173f7c=_[_0x167d('0x3a')]({},_0x173f7c,_0x46e0ed[_0x167d('0x3c')]);return db[_0x167d('0x2a')]['find'](_0x173f7c)[_0x167d('0x22')](handleEntityNotFound(_0x47cf69,null))[_0x167d('0x22')](respondWithResult(_0x47cf69,null))[_0x167d('0x44')](handleError(_0x47cf69,null));};exports[_0x167d('0x45')]=function(_0x1ab900,_0x1375fb){return db['WhatsappApplication']['create'](_0x1ab900[_0x167d('0x46')],{})['then'](respondWithResult(_0x1375fb,0xc9))[_0x167d('0x44')](handleError(_0x1375fb,null));};exports['update']=function(_0x10e1b9,_0x462061){if(_0x10e1b9[_0x167d('0x46')]['id']){delete _0x10e1b9[_0x167d('0x46')]['id'];}return db[_0x167d('0x2a')][_0x167d('0x47')]({'where':{'id':_0x10e1b9[_0x167d('0x42')]['id']}})['then'](handleEntityNotFound(_0x462061,null))[_0x167d('0x22')](saveUpdates(_0x10e1b9[_0x167d('0x46')],null))[_0x167d('0x22')](respondWithResult(_0x462061,null))[_0x167d('0x44')](handleError(_0x462061,null));};exports['destroy']=function(_0x3b5797,_0xfe1f84){return db[_0x167d('0x2a')][_0x167d('0x47')]({'where':{'id':_0x3b5797[_0x167d('0x42')]['id']}})[_0x167d('0x22')](handleEntityNotFound(_0xfe1f84,null))[_0x167d('0x22')](removeEntity(_0xfe1f84,null))[_0x167d('0x44')](handleError(_0xfe1f84,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index f9ccc70..8694bc4 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 _0xf0ba=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','WhatsappApplication'];(function(_0x1e3f11,_0x5d000a){var _0x268233=function(_0x5137d1){while(--_0x5137d1){_0x1e3f11['push'](_0x1e3f11['shift']());}};_0x268233(++_0x5d000a);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var logger=require(_0xaf0b('0x2'))(_0xaf0b('0x3'));var moment=require(_0xaf0b('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf0b('0x5'));var fs=require('fs');var path=require(_0xaf0b('0x6'));var rimraf=require('rimraf');var config=require(_0xaf0b('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0xaf0b('0x8')]=function(_0x4b3b85,_0x4d1479){return _0x4b3b85[_0xaf0b('0x9')](_0xaf0b('0xa'),attributes,{'tableName':_0xaf0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaf0b('0xc'),'collate':_0xaf0b('0xd')});}; \ No newline at end of file +var _0x3c17=['bluebird','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','../../config/logger','moment'];(function(_0x3d51cb,_0x22d892){var _0xf91ea2=function(_0x2ba32b){while(--_0x2ba32b){_0x3d51cb['push'](_0x3d51cb['shift']());}};_0xf91ea2(++_0x22d892);}(_0x3c17,0x1a1));var _0x73c1=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x3c17[_0x34021d];return _0x16597b;};'use strict';var _=require(_0x73c1('0x0'));var util=require('util');var logger=require(_0x73c1('0x1'))('api');var moment=require(_0x73c1('0x2'));var BPromise=require(_0x73c1('0x3'));var rp=require(_0x73c1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73c1('0x5'));var config=require(_0x73c1('0x6'));var attributes=require(_0x73c1('0x7'));module[_0x73c1('0x8')]=function(_0x48c943,_0x382f82){return _0x48c943['define'](_0x73c1('0x9'),attributes,{'tableName':_0x73c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x73c1('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 3c19bcc..0034687 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 _0x98a8=['request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1d5a5b,_0x4482dc){var _0x245785=function(_0x80b9e5){while(--_0x80b9e5){_0x1d5a5b['push'](_0x1d5a5b['shift']());}};_0x245785(++_0x4482dc);}(_0x98a8,0x12c));var _0x898a=function(_0x395054,_0x3cada4){_0x395054=_0x395054-0x0;var _0x274ee2=_0x98a8[_0x395054];return _0x274ee2;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file +var _0x24ca=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x2b7723,_0x4d112e){var _0x5d2b02=function(_0x238e65){while(--_0x238e65){_0x2b7723['push'](_0x2b7723['shift']());}};_0x5d2b02(++_0x4d112e);}(_0x24ca,0x1bc));var _0xa24c=function(_0x467cb0,_0x303070){_0x467cb0=_0x467cb0-0x0;var _0x2153f7=_0x24ca[_0x467cb0];return _0x2153f7;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){return client[_0xa24c('0xc')](_0x2dd348,_0x9a5013)[_0xa24c('0xd')](function(_0x5eac78){logger[_0xa24c('0xe')](_0xa24c('0xf'),_0x257264,_0xa24c('0x10'));logger[_0xa24c('0x11')](_0xa24c('0x12'),_0x257264,_0xa24c('0x10'),JSON[_0xa24c('0x13')](_0x5eac78));if(_0x5eac78[_0xa24c('0x14')]){if(_0x5eac78[_0xa24c('0x14')]['code']===0x1f4){logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x42d89c(_0x5eac78['error'][_0xa24c('0x15')]);}logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x481196(_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0xa24c('0x10'));_0x481196(_0x5eac78[_0xa24c('0x16')]['message']);}})['catch'](function(_0x221d21){logger[_0xa24c('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0x221d21);_0x42d89c(_0x221d21);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e438a4b..7d74899 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 _0xf9d5=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','getMessages','download','post','create','/:id/messages','/:id/tags','whatsapp','whatsappinteraction:addtags','tracked','whatsappinteraction:update','destroy','delete','removeTags','exports'];(function(_0x165ec4,_0x1d0f75){var _0x352800=function(_0x52fd3f){while(--_0x52fd3f){_0x165ec4['push'](_0x165ec4['shift']());}};_0x352800(++_0x1d0f75);}(_0xf9d5,0x122));var _0x5f9d=function(_0x46c9a5,_0x1cb9e7){_0x46c9a5=_0x46c9a5-0x0;var _0x5e3eec=_0xf9d5[_0x46c9a5];return _0x5e3eec;};'use strict';var multer=require('multer');var util=require(_0x5f9d('0x0'));var path=require(_0x5f9d('0x1'));var timeout=require('connect-timeout');var express=require(_0x5f9d('0x2'));var router=express[_0x5f9d('0x3')]();var fs_extra=require(_0x5f9d('0x4'));var auth=require(_0x5f9d('0x5'));var interaction=require(_0x5f9d('0x6'));var config=require(_0x5f9d('0x7'));var controller=require(_0x5f9d('0x8'));router['get']('/',auth[_0x5f9d('0x9')](),controller['index']);router[_0x5f9d('0xa')](_0x5f9d('0xb'),auth['isAuthenticated'](),controller[_0x5f9d('0xc')]);router[_0x5f9d('0xa')](_0x5f9d('0xd'),auth[_0x5f9d('0x9')](),controller[_0x5f9d('0xe')]);router[_0x5f9d('0xa')]('/:id/messages',auth[_0x5f9d('0x9')](),controller[_0x5f9d('0xf')]);router['get']('/:id/download',auth[_0x5f9d('0x9')](),controller[_0x5f9d('0x10')]);router[_0x5f9d('0x11')]('/',auth['isAuthenticated'](),controller[_0x5f9d('0x12')]);router[_0x5f9d('0x11')](_0x5f9d('0x13'),auth[_0x5f9d('0x9')](),controller['addMessage']);router[_0x5f9d('0x11')](_0x5f9d('0x14'),auth[_0x5f9d('0x9')](),interaction['tracked'](_0x5f9d('0x15'),_0x5f9d('0x16')),controller['addTags']);router['put'](_0x5f9d('0xd'),auth[_0x5f9d('0x9')](),interaction[_0x5f9d('0x17')](_0x5f9d('0x15'),_0x5f9d('0x18')),controller['update']);router['delete']('/:id',auth[_0x5f9d('0x9')](),interaction['tracked'](_0x5f9d('0x15'),'whatsappinteraction:destroy'),controller[_0x5f9d('0x19')]);router[_0x5f9d('0x1a')](_0x5f9d('0x14'),auth['isAuthenticated'](),controller[_0x5f9d('0x1b')]);module[_0x5f9d('0x1c')]=router; \ No newline at end of file +var _0xf494=['isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get'];(function(_0x1ce417,_0xb8969){var _0x448c78=function(_0x69e66f){while(--_0x69e66f){_0x1ce417['push'](_0x1ce417['shift']());}};_0x448c78(++_0xb8969);}(_0xf494,0x1c6));var _0x4f49=function(_0x42bedd,_0x157a71){_0x42bedd=_0x42bedd-0x0;var _0x1a2b17=_0xf494[_0x42bedd];return _0x1a2b17;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getMessages']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f49('0x13')]);router[_0x4f49('0x14')]('/:id/messages',auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0x14')](_0x4f49('0x16'),auth[_0x4f49('0xb')](),interaction[_0x4f49('0x17')](_0x4f49('0x18'),'whatsappinteraction:addtags'),controller[_0x4f49('0x19')]);router[_0x4f49('0x1a')](_0x4f49('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0x4f49('0x18'),_0x4f49('0x1b')),controller[_0x4f49('0x1c')]);router['delete'](_0x4f49('0xe'),auth[_0x4f49('0xb')](),interaction[_0x4f49('0x17')]('whatsapp','whatsappinteraction:destroy'),controller['destroy']);router['delete'](_0x4f49('0x16'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);module[_0x4f49('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index b1464b0..fcc2984 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 _0xc224=['moment','exports','DATE','STRING','ENUM','out','BOOLEAN','INTEGER','sequelize'];(function(_0x49eaed,_0x38b981){var _0x262b66=function(_0x1bc243){while(--_0x1bc243){_0x49eaed['push'](_0x49eaed['shift']());}};_0x262b66(++_0x38b981);}(_0xc224,0x1af));var _0x4c22=function(_0x123038,_0x3f4470){_0x123038=_0x123038-0x0;var _0x3be01a=_0xc224[_0x123038];return _0x3be01a;};'use strict';var Sequelize=require(_0x4c22('0x0'));var moment=require(_0x4c22('0x1'));module[_0x4c22('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4c22('0x3')]},'disposition':{'type':Sequelize[_0x4c22('0x4')]},'secondDisposition':{'type':Sequelize[_0x4c22('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4c22('0x4')]},'note':{'type':Sequelize[_0x4c22('0x4')]},'phone':{'type':Sequelize[_0x4c22('0x4')]},'read1stAt':{'type':Sequelize[_0x4c22('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4c22('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4c22('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4c22('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4c22('0x8')]}}; \ No newline at end of file +var _0x46c1=['BOOLEAN','DATE','STRING','ENUM','out','moment','exports'];(function(_0xde6c02,_0xd1d9e){var _0x4cf437=function(_0x49f5fd){while(--_0x49f5fd){_0xde6c02['push'](_0xde6c02['shift']());}};_0x4cf437(++_0xd1d9e);}(_0x46c1,0x7c));var _0x146c=function(_0x1fbb56,_0x22b4f8){_0x1fbb56=_0x1fbb56-0x0;var _0x562df4=_0x46c1[_0x1fbb56];return _0x562df4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x146c('0x0'));module[_0x146c('0x1')]={'closed':{'type':Sequelize[_0x146c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x146c('0x3')]},'disposition':{'type':Sequelize[_0x146c('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x146c('0x4')]},'note':{'type':Sequelize[_0x146c('0x4')]},'phone':{'type':Sequelize[_0x146c('0x4')]},'read1stAt':{'type':Sequelize[_0x146c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x146c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x146c('0x5')]('in',_0x146c('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x146c('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index c1e7afd..edf87fa 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 _0x77cb=['then','destroy','end','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','whatsapp','query','catch','show','params','model','keys','WhatsappInteraction','intersection','attributes','length','include','merge','create','body','update','find','describe','WhatsappMessage','ids','omit','getMessages','findOne','fields','nolimit','order','sort','where','filters','pick','WhatsappInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','rows','addTags','setTags','spread','color','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closedAt','disposition','filter','basename','existsSync','createWriteStream','out','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','status','json','offset','undefined','limit','count'];(function(_0x3ec501,_0x1d035a){var _0x5a3037=function(_0x383d66){while(--_0x383d66){_0x3ec501['push'](_0x3ec501['shift']());}};_0x5a3037(++_0x1d035a);}(_0x77cb,0x1e1));var _0xb77c=function(_0x1e7812,_0x4a0b31){_0x1e7812=_0x1e7812-0x0;var _0x22c229=_0x77cb[_0x1e7812];return _0x22c229;};'use strict';var rimraf=require(_0xb77c('0x0'));var zipdir=require(_0xb77c('0x1'));var moment=require(_0xb77c('0x2'));var BPromise=require(_0xb77c('0x3'));var util=require('util');var path=require('path');var ejs=require(_0xb77c('0x4'));var fs=require('fs');var _=require(_0xb77c('0x5'));var Redis=require('ioredis');var interaction=require(_0xb77c('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xb77c('0x7'));var logger=require(_0xb77c('0x8'))(_0xb77c('0x9'));var config=require(_0xb77c('0xa'));var db=require(_0xb77c('0xb'))['db'];config[_0xb77c('0xc')]=_[_0xb77c('0xd')](config[_0xb77c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb77c('0xe'))(new Redis(config[_0xb77c('0xc')]));require(_0xb77c('0xf'))[_0xb77c('0x10')](socket);function respondWithStatusCode(_0x262607,_0x4066db){_0x4066db=_0x4066db||0xcc;return function(_0x49e90e){if(_0x49e90e){return _0x262607['sendStatus'](_0x4066db);}return _0x262607[_0xb77c('0x11')](_0x4066db)['end']();};}function respondWithResult(_0x532b65,_0x56d169){_0x56d169=_0x56d169||0xc8;return function(_0x33c2b1){if(_0x33c2b1){return _0x532b65[_0xb77c('0x11')](_0x56d169)[_0xb77c('0x12')](_0x33c2b1);}};}function respondWithFilteredResult(_0x3c42f5,_0x8f164d){return function(_0x52dbcf){if(_0x52dbcf){var _0x9c82d=typeof _0x8f164d[_0xb77c('0x13')]===_0xb77c('0x14')&&typeof _0x8f164d[_0xb77c('0x15')]===_0xb77c('0x14');var _0x2f1e1a=_0x52dbcf[_0xb77c('0x16')];var _0x40bfa0=_0x9c82d?0x0:_0x8f164d[_0xb77c('0x13')];var _0x1985c1=_0x9c82d?_0x52dbcf[_0xb77c('0x16')]:_0x8f164d[_0xb77c('0x13')]+_0x8f164d[_0xb77c('0x15')];var _0x39f94a;if(_0x1985c1>=_0x2f1e1a){_0x1985c1=_0x2f1e1a;_0x39f94a=0xc8;}else{_0x39f94a=0xce;}_0x3c42f5[_0xb77c('0x11')](_0x39f94a);return _0x3c42f5['set']('Content-Range',_0x40bfa0+'-'+_0x1985c1+'/'+_0x2f1e1a)[_0xb77c('0x12')](_0x52dbcf);}return null;};}function saveUpdates(_0x7317e7){return function(_0x529f61){if(_0x529f61){return _0x529f61['update'](_0x7317e7)[_0xb77c('0x17')](function(_0x526b01){return _0x526b01;});}return null;};}function removeEntity(_0x2923f2){return function(_0x4c14d7){if(_0x4c14d7){return _0x4c14d7[_0xb77c('0x18')]()['then'](function(){_0x2923f2[_0xb77c('0x11')](0xcc)[_0xb77c('0x19')]();});}};}function handleEntityNotFound(_0x4cca2e){return function(_0x570204){if(!_0x570204){_0x4cca2e[_0xb77c('0x1a')](0x194);}return _0x570204;};}function handleError(_0x387610,_0x52edca){_0x52edca=_0x52edca||0x1f4;return function(_0x322a24){logger['error'](_0x322a24[_0xb77c('0x1b')]);if(_0x322a24[_0xb77c('0x1c')]){delete _0x322a24['name'];}_0x387610['status'](_0x52edca)['send'](_0x322a24);};}exports[_0xb77c('0x1d')]=function(_0x3ef83b,_0x559e60){var _0x391496={};var _0x38eb5d=_[_0xb77c('0x1e')](db['WhatsappInteraction'][_0xb77c('0x1f')],function(_0x3bab6c){return{'name':_0x3bab6c[_0xb77c('0x20')],'type':_0x3bab6c[_0xb77c('0x21')][_0xb77c('0x22')]};});_0x391496=qs[_0xb77c('0x23')](_0x38eb5d,_0x3ef83b);return interaction['findAll'](_0xb77c('0x24'),_0x3ef83b[_0xb77c('0x25')],_0x3ef83b['user'],_0x391496,_0x38eb5d)[_0xb77c('0x17')](respondWithFilteredResult(_0x559e60,_0x391496))[_0xb77c('0x26')](handleError(_0x559e60,null));};exports[_0xb77c('0x27')]=function(_0x3f5601,_0x3a98d3){var _0x4d7612={'raw':![],'where':{'id':_0x3f5601[_0xb77c('0x28')]['id']}},_0x11935f={};_0x11935f[_0xb77c('0x29')]=_[_0xb77c('0x2a')](db[_0xb77c('0x2b')][_0xb77c('0x1f')]);_0x11935f[_0xb77c('0x25')]=_[_0xb77c('0x2a')](_0x3f5601[_0xb77c('0x25')]);_0x11935f['filters']=_[_0xb77c('0x2c')](_0x11935f[_0xb77c('0x29')],_0x11935f[_0xb77c('0x25')]);_0x4d7612[_0xb77c('0x2d')]=_[_0xb77c('0x2c')](_0x11935f[_0xb77c('0x29')],qs['fields'](_0x3f5601['query']['fields']));_0x4d7612[_0xb77c('0x2d')]=_0x4d7612[_0xb77c('0x2d')][_0xb77c('0x2e')]?_0x4d7612[_0xb77c('0x2d')]:_0x11935f['model'];if(_0x3f5601[_0xb77c('0x25')]['includeAll']){_0x4d7612[_0xb77c('0x2f')]=[{'all':!![]}];}_0x4d7612=_[_0xb77c('0x30')]({},_0x4d7612,_0x3f5601['options']);return db['WhatsappInteraction']['find'](_0x4d7612)[_0xb77c('0x17')](handleEntityNotFound(_0x3a98d3,null))[_0xb77c('0x17')](respondWithResult(_0x3a98d3,null))[_0xb77c('0x26')](handleError(_0x3a98d3,null));};exports['create']=function(_0x3887b1,_0x1ffd4c){return db[_0xb77c('0x2b')][_0xb77c('0x31')](_0x3887b1[_0xb77c('0x32')],{})['then'](respondWithResult(_0x1ffd4c,0xc9))[_0xb77c('0x26')](handleError(_0x1ffd4c,null));};exports[_0xb77c('0x33')]=function(_0x421b3a,_0x3d24e9){if(_0x421b3a['body']['id']){delete _0x421b3a[_0xb77c('0x32')]['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x421b3a['params']['id']}})[_0xb77c('0x17')](handleEntityNotFound(_0x3d24e9,null))[_0xb77c('0x17')](saveUpdates(_0x421b3a[_0xb77c('0x32')],null))[_0xb77c('0x17')](respondWithResult(_0x3d24e9,null))['catch'](handleError(_0x3d24e9,null));};exports[_0xb77c('0x18')]=function(_0x58e885,_0x252959){return db[_0xb77c('0x2b')][_0xb77c('0x34')]({'where':{'id':_0x58e885[_0xb77c('0x28')]['id']}})[_0xb77c('0x17')](handleEntityNotFound(_0x252959,null))[_0xb77c('0x17')](removeEntity(_0x252959,null))[_0xb77c('0x26')](handleError(_0x252959,null));};exports[_0xb77c('0x35')]=function(_0x4297ed,_0x182176){return db[_0xb77c('0x2b')]['describe']()[_0xb77c('0x17')](respondWithResult(_0x182176,null))[_0xb77c('0x26')](handleError(_0x182176,null));};exports['addMessage']=function(_0x45c56d,_0x52f7bf){return db[_0xb77c('0x36')][_0xb77c('0x34')]({'where':{'id':_0x45c56d[_0xb77c('0x28')]['id']}})['then'](handleEntityNotFound(_0x52f7bf,null))[_0xb77c('0x17')](function(_0x620681){if(_0x620681){return _0x620681['addMessage'](_0x45c56d[_0xb77c('0x32')][_0xb77c('0x37')],_[_0xb77c('0x38')](_0x45c56d[_0xb77c('0x32')],[_0xb77c('0x37'),'id'])||{});}})['then'](respondWithResult(_0x52f7bf,null))['catch'](handleError(_0x52f7bf,null));};exports[_0xb77c('0x39')]=function(_0x200f85,_0x5ef373){var _0x1985c4={'raw':![],'where':{}};var _0x4d21d8={};var _0x1d805f={'count':0x0,'rows':[]};return db[_0xb77c('0x2b')][_0xb77c('0x3a')]({'where':{'id':_0x200f85['params']['id']}})[_0xb77c('0x17')](handleEntityNotFound(_0x5ef373,null))['then'](function(_0x45d7fd){if(_0x45d7fd){_0x4d21d8[_0xb77c('0x29')]=_['keys'](db[_0xb77c('0x36')][_0xb77c('0x1f')]);_0x4d21d8[_0xb77c('0x25')]=_[_0xb77c('0x2a')](_0x200f85[_0xb77c('0x25')]);_0x4d21d8['filters']=_['intersection'](_0x4d21d8[_0xb77c('0x29')],_0x4d21d8[_0xb77c('0x25')]);_0x1985c4['attributes']=_[_0xb77c('0x2c')](_0x4d21d8[_0xb77c('0x29')],qs['fields'](_0x200f85[_0xb77c('0x25')][_0xb77c('0x3b')]));_0x1985c4[_0xb77c('0x2d')]=_0x1985c4[_0xb77c('0x2d')][_0xb77c('0x2e')]?_0x1985c4[_0xb77c('0x2d')]:_0x4d21d8[_0xb77c('0x29')];if(!_0x200f85['query']['hasOwnProperty'](_0xb77c('0x3c'))){_0x1985c4['limit']=qs[_0xb77c('0x15')](_0x200f85['query']['limit']);_0x1985c4[_0xb77c('0x13')]=qs[_0xb77c('0x13')](_0x200f85[_0xb77c('0x25')][_0xb77c('0x13')]);}_0x1985c4[_0xb77c('0x3d')]=qs[_0xb77c('0x3e')](_0x200f85[_0xb77c('0x25')][_0xb77c('0x3e')]);_0x1985c4[_0xb77c('0x3f')]=qs[_0xb77c('0x40')](_[_0xb77c('0x41')](_0x200f85['query'],_0x4d21d8[_0xb77c('0x40')]));_0x1985c4[_0xb77c('0x3f')][_0xb77c('0x42')]=_0x45d7fd['id'];if(_0x200f85[_0xb77c('0x25')]['filter']){_0x1985c4[_0xb77c('0x3f')]=_[_0xb77c('0x30')](_0x1985c4[_0xb77c('0x3f')],{'$or':_[_0xb77c('0x1e')](_0x1985c4[_0xb77c('0x2d')],function(_0xe7c1f1){var _0x1c4be4={};_0x1c4be4[_0xe7c1f1]={'$like':'%'+_0x200f85['query']['filter']+'%'};return _0x1c4be4;})});}if(_0x200f85[_0xb77c('0x25')][_0xb77c('0x43')]){var _0x4b38a3=_0x200f85['query'][_0xb77c('0x43')][_0xb77c('0x44')](',');var _0x1cb9f2={};_0x1cb9f2[_0x4b38a3[0x0]]={'$gte':moment(_0x4b38a3[0x1])['format'](_0xb77c('0x45'))};_0x1985c4[_0xb77c('0x3f')]=_[_0xb77c('0x30')](_0x1985c4[_0xb77c('0x3f')],_0x1cb9f2);}_0x1985c4=_[_0xb77c('0x30')]({},_0x1985c4,_0x200f85[_0xb77c('0x46')]);return db[_0xb77c('0x36')][_0xb77c('0x16')]({'where':_0x1985c4[_0xb77c('0x3f')]})[_0xb77c('0x17')](function(_0x5ae6e9){_0x1d805f[_0xb77c('0x16')]=_0x5ae6e9;if(_0x200f85['query'][_0xb77c('0x47')]){_0x1985c4[_0xb77c('0x2f')]=[{'all':!![]}];}return db[_0xb77c('0x36')][_0xb77c('0x48')](_0x1985c4);})[_0xb77c('0x17')](function(_0xe4a462){_0x1d805f[_0xb77c('0x49')]=_0xe4a462;return _0x1d805f;});}})['then'](respondWithFilteredResult(_0x5ef373,_0x1985c4))['catch'](handleError(_0x5ef373,null));};exports[_0xb77c('0x4a')]=function(_0x471c70,_0x3221bc){return db['WhatsappInteraction']['find']({'where':{'id':_0x471c70['params']['id']}})[_0xb77c('0x17')](handleEntityNotFound(_0x3221bc,null))[_0xb77c('0x17')](function(_0x41ad7d){if(_0x41ad7d){return _0x41ad7d[_0xb77c('0x4b')](_0x471c70[_0xb77c('0x32')]['ids'],_[_0xb77c('0x38')](_0x471c70[_0xb77c('0x32')],[_0xb77c('0x37'),'id'])||{})[_0xb77c('0x4c')](function(){return db['Tag'][_0xb77c('0x48')]({'attributes':['id',_0xb77c('0x1c'),_0xb77c('0x4d')],'where':{'id':_0x471c70[_0xb77c('0x32')]['ids']}});})[_0xb77c('0x17')](function(_0x286ed8){socket['emit'](_0xb77c('0x4e'),{'id':Number(_0x471c70[_0xb77c('0x28')]['id']),'tags':_0x286ed8||[]});return{'id':Number(_0x471c70[_0xb77c('0x28')]['id']),'tags':_0x286ed8||[]};});}})[_0xb77c('0x17')](respondWithResult(_0x3221bc,null))[_0xb77c('0x26')](handleError(_0x3221bc,null));};exports['removeTags']=function(_0x330a40,_0x42446e){return db[_0xb77c('0x2b')][_0xb77c('0x34')]({'where':{'id':_0x330a40[_0xb77c('0x28')]['id']}})['then'](handleEntityNotFound(_0x42446e,null))[_0xb77c('0x17')](function(_0x38fa19){if(_0x38fa19){return _0x38fa19[_0xb77c('0x4f')](_0x330a40[_0xb77c('0x25')][_0xb77c('0x37')]);}})['then'](respondWithStatusCode(_0x42446e,null))[_0xb77c('0x26')](handleError(_0x42446e,null));};exports[_0xb77c('0x50')]=function(_0x24b308,_0x4a8bad){var _0x579c6b=moment()[_0xb77c('0x51')]()[_0xb77c('0x52')]();var _0x396129=path[_0xb77c('0x53')](config[_0xb77c('0x54')],_0xb77c('0x55'),_0xb77c('0x56'),_0xb77c('0x57'));var _0x47238e=path[_0xb77c('0x53')](config[_0xb77c('0x54')],_0xb77c('0x55'),_0xb77c('0x56'),_0xb77c('0x58'));var _0x305624=path[_0xb77c('0x53')](_0x396129,_0x579c6b);var _0x490f28=util[_0xb77c('0x59')]('transcript-%d-%s.zip',_0x24b308['params']['id'],_0x579c6b);var _0x44a977=path[_0xb77c('0x53')](_0x396129,_0x490f28);var _0x52bed5=[];_0x52bed5[_0xb77c('0x5a')]({'model':db[_0xb77c('0x5b')],'as':_0xb77c('0x5b'),'attributes':['id',_0xb77c('0x5c')],'raw':!![]});_0x52bed5['push']({'model':db[_0xb77c('0x5d')],'as':_0xb77c('0x5e'),'attributes':['id',_0xb77c('0x5f'),_0xb77c('0x60')],'raw':!![]});if(_0x24b308['query']['attachments']){_0x52bed5[_0xb77c('0x5a')]({'model':db[_0xb77c('0x61')],'as':_0xb77c('0x61'),'raw':!![]});}var _0x124c35=[{'model':db[_0xb77c('0x36')],'as':'Messages','attributes':['id',_0xb77c('0x32'),_0xb77c('0x62'),_0xb77c('0x63'),_0xb77c('0x64'),'read'],'include':_0x52bed5}];_0x124c35[_0xb77c('0x5a')]({'model':db[_0xb77c('0x65')],'as':_0xb77c('0x66'),'attributes':['id',_0xb77c('0x1c')]});_0x124c35[_0xb77c('0x5a')]({'model':db[_0xb77c('0x5b')],'as':'Owner','attributes':['id',_0xb77c('0x5c')]});return db[_0xb77c('0x2b')][_0xb77c('0x34')]({'where':{'id':_0x24b308[_0xb77c('0x28')]['id']},'include':_0x124c35})['then'](handleEntityNotFound(_0x4a8bad,null))[_0xb77c('0x17')](function(_0x2198df){if(_0x2198df){var _0x419436=_0x2198df[_0xb77c('0x67')]({'plain':!![]});fs[_0xb77c('0x68')](_0x305624);var _0x1cf821={'channel':_0xb77c('0x69'),'account':_0x419436[_0xb77c('0x66')][_0xb77c('0x1c')],'agent':_0x419436['Owner']?_0x419436[_0xb77c('0x6a')][_0xb77c('0x5c')]:_0xb77c('0x6b'),'createdAt':moment(_0x419436[_0xb77c('0x62')])[_0xb77c('0x59')](_0xb77c('0x45'))[_0xb77c('0x52')](),'closedAt':_0x419436['closed']?moment(_0x419436[_0xb77c('0x6c')])[_0xb77c('0x59')](_0xb77c('0x45'))['toString']():'','disposition':_0x419436[_0xb77c('0x6d')],'messages':_(_0x419436['Messages'])[_0xb77c('0x6e')]({'secret':![]})[_0xb77c('0x1e')](function(_0x2fb9ac){if(_0x2fb9ac[_0xb77c('0x61')]){var _0xac5661=path['join'](_0x47238e,_0x2fb9ac[_0xb77c('0x61')][_0xb77c('0x6f')]);if(fs[_0xb77c('0x70')](_0xac5661)){fs['createReadStream'](_0xac5661)['pipe'](fs[_0xb77c('0x71')](path['join'](_0x305624,_0x2fb9ac[_0xb77c('0x61')][_0xb77c('0x6f')])));}}return{'date':moment(_0x2fb9ac[_0xb77c('0x62')])[_0xb77c('0x59')](_0xb77c('0x45'))[_0xb77c('0x52')](),'sender':_0x2fb9ac[_0xb77c('0x63')]===_0xb77c('0x72')?_0x2fb9ac[_0xb77c('0x5b')]?_0x2fb9ac[_0xb77c('0x5b')][_0xb77c('0x5c')]:_0xb77c('0x73'):_0x2fb9ac[_0xb77c('0x5e')][_0xb77c('0x5f')]+(_0x2fb9ac[_0xb77c('0x5e')][_0xb77c('0x60')]?'\x20'+_0x2fb9ac['Contact'][_0xb77c('0x60')]:''),'body':_0x2fb9ac[_0xb77c('0x61')]?_0x2fb9ac[_0xb77c('0x61')]['basename']:_0x2fb9ac['body'],'direction':_0x2fb9ac[_0xb77c('0x63')]===_0xb77c('0x72')?'A':'C','secret':_0x2fb9ac[_0xb77c('0x64')],'read':_0x2fb9ac[_0xb77c('0x74')],'attachment':_0x2fb9ac[_0xb77c('0x61')]};})[_0xb77c('0x75')]()};return ejs[_0xb77c('0x76')](path[_0xb77c('0x53')](config['root'],_0xb77c('0x55'),_0xb77c('0x77'),_0xb77c('0x78')),{'interaction':_0x1cf821})[_0xb77c('0x17')](function(_0x39ddbc){var _0x344ce0=path['join'](_0x305624,_0xb77c('0x79')+_0x419436['id']+'-'+_0x579c6b+_0xb77c('0x7a'));var _0x3f93b7={'path':_0x344ce0,'channel':_0xb77c('0x69'),'interactionId':_0x419436['id']};return pdf['createPdfFromHTML'](_0x39ddbc,_0x3f93b7);})[_0xb77c('0x17')](function(){return new BPromise(function(_0x436a9d,_0x5427f5){zipdir(_0x305624,{'saveTo':_0x44a977},function(_0x16cdd3,_0x2c05bb){if(_0x16cdd3)return _0x5427f5(_0x16cdd3);return _0x436a9d(_0x2c05bb);});})[_0xb77c('0x17')](function(){return new BPromise(function(_0xa8c239,_0x226a3e){rimraf(_0x305624,function(_0x59fb2e){if(_0x59fb2e)_0x226a3e(_0x59fb2e);return _0xa8c239();});});})[_0xb77c('0x17')](function(){return _0x4a8bad[_0xb77c('0x50')](_0x44a977,_0x490f28,function(_0x3a86f7){if(_0x3a86f7){console[_0xb77c('0x7b')](_0xb77c('0x7c'),_0x3a86f7);}else{fs[_0xb77c('0x7d')](_0x44a977);}});});});}else{return _0x4a8bad['sendStatus'](0xc8);}})['catch'](handleError(_0x4a8bad,null));}; \ No newline at end of file +var _0xa24a=['fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','N.A.','closed','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value','renderFile','downloadInteraction.ejs','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','WhatsappInteraction','fieldName','key','findAll','whatsapp','user','catch','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','find','create','body','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','order','sort','pick','WhatsappInteractionId','filter','where','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','options','includeAll','rows','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','User'];(function(_0x5e5e36,_0x4d6b08){var _0x43b449=function(_0x321e71){while(--_0x321e71){_0x5e5e36['push'](_0x5e5e36['shift']());}};_0x43b449(++_0x4d6b08);}(_0xa24a,0x1a2));var _0xaa24=function(_0x53da02,_0x20ebb8){_0x53da02=_0x53da02-0x0;var _0x63292e=_0xa24a[_0x53da02];return _0x63292e;};'use strict';var rimraf=require(_0xaa24('0x0'));var zipdir=require(_0xaa24('0x1'));var moment=require(_0xaa24('0x2'));var BPromise=require(_0xaa24('0x3'));var util=require(_0xaa24('0x4'));var path=require(_0xaa24('0x5'));var ejs=require(_0xaa24('0x6'));var fs=require('fs');var _=require(_0xaa24('0x7'));var Redis=require(_0xaa24('0x8'));var interaction=require(_0xaa24('0x9'));var qs=require('../../components/parsers/qs');var pdf=require(_0xaa24('0xa'));var logger=require(_0xaa24('0xb'))('api');var config=require(_0xaa24('0xc'));var db=require(_0xaa24('0xd'))['db'];config['redis']=_[_0xaa24('0xe')](config[_0xaa24('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa24('0xf')]));require(_0xaa24('0x10'))[_0xaa24('0x11')](socket);function respondWithStatusCode(_0x325ffb,_0x16a029){_0x16a029=_0x16a029||0xcc;return function(_0x3667ee){if(_0x3667ee){return _0x325ffb[_0xaa24('0x12')](_0x16a029);}return _0x325ffb[_0xaa24('0x13')](_0x16a029)[_0xaa24('0x14')]();};}function respondWithResult(_0x5c5bff,_0x5b3205){_0x5b3205=_0x5b3205||0xc8;return function(_0x161de6){if(_0x161de6){return _0x5c5bff['status'](_0x5b3205)[_0xaa24('0x15')](_0x161de6);}};}function respondWithFilteredResult(_0x2c44ac,_0x15eded){return function(_0xaba4b7){if(_0xaba4b7){var _0x488ed1=typeof _0x15eded[_0xaa24('0x16')]===_0xaa24('0x17')&&typeof _0x15eded[_0xaa24('0x18')]===_0xaa24('0x17');var _0xcb99dd=_0xaba4b7['count'];var _0x2db740=_0x488ed1?0x0:_0x15eded['offset'];var _0xe6baa0=_0x488ed1?_0xaba4b7[_0xaa24('0x19')]:_0x15eded[_0xaa24('0x16')]+_0x15eded[_0xaa24('0x18')];var _0x39b785;if(_0xe6baa0>=_0xcb99dd){_0xe6baa0=_0xcb99dd;_0x39b785=0xc8;}else{_0x39b785=0xce;}_0x2c44ac[_0xaa24('0x13')](_0x39b785);return _0x2c44ac['set'](_0xaa24('0x1a'),_0x2db740+'-'+_0xe6baa0+'/'+_0xcb99dd)[_0xaa24('0x15')](_0xaba4b7);}return null;};}function saveUpdates(_0x4e1712){return function(_0x3e1be8){if(_0x3e1be8){return _0x3e1be8[_0xaa24('0x1b')](_0x4e1712)[_0xaa24('0x1c')](function(_0x17b573){return _0x17b573;});}return null;};}function removeEntity(_0x26f2cf){return function(_0xfd43c9){if(_0xfd43c9){return _0xfd43c9[_0xaa24('0x1d')]()[_0xaa24('0x1c')](function(){_0x26f2cf[_0xaa24('0x13')](0xcc)[_0xaa24('0x14')]();});}};}function handleEntityNotFound(_0x2f2018){return function(_0x3da691){if(!_0x3da691){_0x2f2018[_0xaa24('0x12')](0x194);}return _0x3da691;};}function handleError(_0x49fe1c,_0x3bdf56){_0x3bdf56=_0x3bdf56||0x1f4;return function(_0x5bac34){logger[_0xaa24('0x1e')](_0x5bac34[_0xaa24('0x1f')]);if(_0x5bac34[_0xaa24('0x20')]){delete _0x5bac34[_0xaa24('0x20')];}_0x49fe1c['status'](_0x3bdf56)['send'](_0x5bac34);};}exports['index']=function(_0x4ac052,_0x32d545){var _0x2a3d2b={};var _0xd52e15=_['map'](db[_0xaa24('0x21')]['rawAttributes'],function(_0x547181){return{'name':_0x547181[_0xaa24('0x22')],'type':_0x547181['type'][_0xaa24('0x23')]};});_0x2a3d2b=qs['getOptions'](_0xd52e15,_0x4ac052);return interaction[_0xaa24('0x24')](_0xaa24('0x25'),_0x4ac052['query'],_0x4ac052[_0xaa24('0x26')],_0x2a3d2b,_0xd52e15)[_0xaa24('0x1c')](respondWithFilteredResult(_0x32d545,_0x2a3d2b))[_0xaa24('0x27')](handleError(_0x32d545,null));};exports[_0xaa24('0x28')]=function(_0x3d90b9,_0x1b7016){var _0x16abb1={'raw':![],'where':{'id':_0x3d90b9['params']['id']}},_0x5b8539={};_0x5b8539[_0xaa24('0x29')]=_[_0xaa24('0x2a')](db['WhatsappInteraction'][_0xaa24('0x2b')]);_0x5b8539[_0xaa24('0x2c')]=_['keys'](_0x3d90b9[_0xaa24('0x2c')]);_0x5b8539[_0xaa24('0x2d')]=_[_0xaa24('0x2e')](_0x5b8539[_0xaa24('0x29')],_0x5b8539[_0xaa24('0x2c')]);_0x16abb1[_0xaa24('0x2f')]=_[_0xaa24('0x2e')](_0x5b8539[_0xaa24('0x29')],qs[_0xaa24('0x30')](_0x3d90b9[_0xaa24('0x2c')][_0xaa24('0x30')]));_0x16abb1['attributes']=_0x16abb1[_0xaa24('0x2f')][_0xaa24('0x31')]?_0x16abb1[_0xaa24('0x2f')]:_0x5b8539[_0xaa24('0x29')];if(_0x3d90b9[_0xaa24('0x2c')]['includeAll']){_0x16abb1[_0xaa24('0x32')]=[{'all':!![]}];}_0x16abb1=_['merge']({},_0x16abb1,_0x3d90b9['options']);return db[_0xaa24('0x21')][_0xaa24('0x33')](_0x16abb1)['then'](handleEntityNotFound(_0x1b7016,null))[_0xaa24('0x1c')](respondWithResult(_0x1b7016,null))[_0xaa24('0x27')](handleError(_0x1b7016,null));};exports[_0xaa24('0x34')]=function(_0xe1e920,_0x323a08){return db[_0xaa24('0x21')]['create'](_0xe1e920[_0xaa24('0x35')],{})[_0xaa24('0x1c')](respondWithResult(_0x323a08,0xc9))[_0xaa24('0x27')](handleError(_0x323a08,null));};exports[_0xaa24('0x1b')]=function(_0x4d96d3,_0xc01853){if(_0x4d96d3[_0xaa24('0x35')]['id']){delete _0x4d96d3[_0xaa24('0x35')]['id'];}return db[_0xaa24('0x21')][_0xaa24('0x33')]({'where':{'id':_0x4d96d3[_0xaa24('0x36')]['id']}})['then'](handleEntityNotFound(_0xc01853,null))[_0xaa24('0x1c')](saveUpdates(_0x4d96d3[_0xaa24('0x35')],null))[_0xaa24('0x1c')](respondWithResult(_0xc01853,null))[_0xaa24('0x27')](handleError(_0xc01853,null));};exports[_0xaa24('0x1d')]=function(_0x11b4c1,_0xa6fe3c){return db[_0xaa24('0x21')]['find']({'where':{'id':_0x11b4c1[_0xaa24('0x36')]['id']}})[_0xaa24('0x1c')](handleEntityNotFound(_0xa6fe3c,null))[_0xaa24('0x1c')](removeEntity(_0xa6fe3c,null))[_0xaa24('0x27')](handleError(_0xa6fe3c,null));};exports['describe']=function(_0x31f92e,_0x22f732){return db[_0xaa24('0x21')][_0xaa24('0x37')]()[_0xaa24('0x1c')](respondWithResult(_0x22f732,null))['catch'](handleError(_0x22f732,null));};exports[_0xaa24('0x38')]=function(_0x31bb53,_0xb9cd52){return db[_0xaa24('0x39')]['find']({'where':{'id':_0x31bb53[_0xaa24('0x36')]['id']}})[_0xaa24('0x1c')](handleEntityNotFound(_0xb9cd52,null))[_0xaa24('0x1c')](function(_0x1ea150){if(_0x1ea150){return _0x1ea150['addMessage'](_0x31bb53[_0xaa24('0x35')][_0xaa24('0x3a')],_[_0xaa24('0x3b')](_0x31bb53['body'],[_0xaa24('0x3a'),'id'])||{});}})[_0xaa24('0x1c')](respondWithResult(_0xb9cd52,null))[_0xaa24('0x27')](handleError(_0xb9cd52,null));};exports[_0xaa24('0x3c')]=function(_0x4fdf51,_0xe464f8){var _0x1311eb={'raw':![],'where':{}};var _0x4448c0={};var _0x3b02e2={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x4fdf51[_0xaa24('0x36')]['id']}})[_0xaa24('0x1c')](handleEntityNotFound(_0xe464f8,null))[_0xaa24('0x1c')](function(_0x5d0418){if(_0x5d0418){_0x4448c0[_0xaa24('0x29')]=_[_0xaa24('0x2a')](db[_0xaa24('0x39')][_0xaa24('0x2b')]);_0x4448c0[_0xaa24('0x2c')]=_['keys'](_0x4fdf51[_0xaa24('0x2c')]);_0x4448c0[_0xaa24('0x2d')]=_[_0xaa24('0x2e')](_0x4448c0['model'],_0x4448c0[_0xaa24('0x2c')]);_0x1311eb['attributes']=_[_0xaa24('0x2e')](_0x4448c0[_0xaa24('0x29')],qs[_0xaa24('0x30')](_0x4fdf51['query'][_0xaa24('0x30')]));_0x1311eb['attributes']=_0x1311eb[_0xaa24('0x2f')]['length']?_0x1311eb[_0xaa24('0x2f')]:_0x4448c0[_0xaa24('0x29')];if(!_0x4fdf51['query'][_0xaa24('0x3d')]('nolimit')){_0x1311eb['limit']=qs[_0xaa24('0x18')](_0x4fdf51['query'][_0xaa24('0x18')]);_0x1311eb[_0xaa24('0x16')]=qs[_0xaa24('0x16')](_0x4fdf51[_0xaa24('0x2c')][_0xaa24('0x16')]);}_0x1311eb[_0xaa24('0x3e')]=qs['sort'](_0x4fdf51[_0xaa24('0x2c')][_0xaa24('0x3f')]);_0x1311eb['where']=qs[_0xaa24('0x2d')](_[_0xaa24('0x40')](_0x4fdf51[_0xaa24('0x2c')],_0x4448c0[_0xaa24('0x2d')]));_0x1311eb['where'][_0xaa24('0x41')]=_0x5d0418['id'];if(_0x4fdf51[_0xaa24('0x2c')][_0xaa24('0x42')]){_0x1311eb[_0xaa24('0x43')]=_['merge'](_0x1311eb['where'],{'$or':_['map'](_0x1311eb[_0xaa24('0x2f')],function(_0x30eac7){var _0x2d39df={};_0x2d39df[_0x30eac7]={'$like':'%'+_0x4fdf51[_0xaa24('0x2c')]['filter']+'%'};return _0x2d39df;})});}if(_0x4fdf51['query'][_0xaa24('0x44')]){var _0x1bc2f2=_0x4fdf51[_0xaa24('0x2c')][_0xaa24('0x44')][_0xaa24('0x45')](',');var _0x40e4f6={};_0x40e4f6[_0x1bc2f2[0x0]]={'$gte':moment(_0x1bc2f2[0x1])[_0xaa24('0x46')](_0xaa24('0x47'))};_0x1311eb[_0xaa24('0x43')]=_[_0xaa24('0x48')](_0x1311eb[_0xaa24('0x43')],_0x40e4f6);}_0x1311eb=_['merge']({},_0x1311eb,_0x4fdf51[_0xaa24('0x49')]);return db[_0xaa24('0x39')]['count']({'where':_0x1311eb['where']})[_0xaa24('0x1c')](function(_0x48a120){_0x3b02e2[_0xaa24('0x19')]=_0x48a120;if(_0x4fdf51[_0xaa24('0x2c')][_0xaa24('0x4a')]){_0x1311eb[_0xaa24('0x32')]=[{'all':!![]}];}return db[_0xaa24('0x39')][_0xaa24('0x24')](_0x1311eb);})[_0xaa24('0x1c')](function(_0xcf2e7b){_0x3b02e2[_0xaa24('0x4b')]=_0xcf2e7b;return _0x3b02e2;});}})['then'](respondWithFilteredResult(_0xe464f8,_0x1311eb))[_0xaa24('0x27')](handleError(_0xe464f8,null));};exports['addTags']=function(_0x4b577f,_0x405744){return db['WhatsappInteraction']['find']({'where':{'id':_0x4b577f[_0xaa24('0x36')]['id']}})[_0xaa24('0x1c')](handleEntityNotFound(_0x405744,null))[_0xaa24('0x1c')](function(_0x126350){if(_0x126350){return _0x126350[_0xaa24('0x4c')](_0x4b577f['body'][_0xaa24('0x3a')],_[_0xaa24('0x3b')](_0x4b577f[_0xaa24('0x35')],['ids','id'])||{})[_0xaa24('0x4d')](function(){return db[_0xaa24('0x4e')][_0xaa24('0x24')]({'attributes':['id',_0xaa24('0x20'),_0xaa24('0x4f')],'where':{'id':_0x4b577f[_0xaa24('0x35')][_0xaa24('0x3a')]}});})['then'](function(_0x4cad98){socket[_0xaa24('0x50')](_0xaa24('0x51'),{'id':Number(_0x4b577f[_0xaa24('0x36')]['id']),'tags':_0x4cad98||[]});return{'id':Number(_0x4b577f['params']['id']),'tags':_0x4cad98||[]};});}})[_0xaa24('0x1c')](respondWithResult(_0x405744,null))['catch'](handleError(_0x405744,null));};exports[_0xaa24('0x52')]=function(_0x48bd73,_0x5bf6aa){return db[_0xaa24('0x21')]['find']({'where':{'id':_0x48bd73[_0xaa24('0x36')]['id']}})[_0xaa24('0x1c')](handleEntityNotFound(_0x5bf6aa,null))[_0xaa24('0x1c')](function(_0x4878e5){if(_0x4878e5){return _0x4878e5['removeTags'](_0x48bd73['query'][_0xaa24('0x3a')]);}})[_0xaa24('0x1c')](respondWithStatusCode(_0x5bf6aa,null))[_0xaa24('0x27')](handleError(_0x5bf6aa,null));};exports[_0xaa24('0x53')]=function(_0xf30c1d,_0x1c2f4){var _0x1b0a25=moment()[_0xaa24('0x54')]()[_0xaa24('0x55')]();var _0x7e7ac2=path[_0xaa24('0x56')](config[_0xaa24('0x57')],_0xaa24('0x58'),_0xaa24('0x59'),_0xaa24('0x5a'));var _0x419150=path[_0xaa24('0x56')](config[_0xaa24('0x57')],'server',_0xaa24('0x59'),_0xaa24('0x5b'));var _0x2fe802=path['join'](_0x7e7ac2,_0x1b0a25);var _0x460e92=util[_0xaa24('0x46')]('transcript-%d-%s.zip',_0xf30c1d[_0xaa24('0x36')]['id'],_0x1b0a25);var _0x583932=path[_0xaa24('0x56')](_0x7e7ac2,_0x460e92);var _0x272155=[];_0x272155[_0xaa24('0x5c')]({'model':db[_0xaa24('0x5d')],'as':_0xaa24('0x5d'),'attributes':['id',_0xaa24('0x5e')],'raw':!![]});_0x272155[_0xaa24('0x5c')]({'model':db[_0xaa24('0x5f')],'as':_0xaa24('0x60'),'attributes':['id',_0xaa24('0x61'),_0xaa24('0x62')],'raw':!![]});if(_0xf30c1d[_0xaa24('0x2c')][_0xaa24('0x5b')]){_0x272155[_0xaa24('0x5c')]({'model':db[_0xaa24('0x63')],'as':_0xaa24('0x63'),'raw':!![]});}var _0x3b3cdf=[{'model':db[_0xaa24('0x39')],'as':_0xaa24('0x64'),'attributes':['id','body',_0xaa24('0x65'),_0xaa24('0x66'),_0xaa24('0x67'),_0xaa24('0x68')],'include':_0x272155}];_0x3b3cdf[_0xaa24('0x5c')]({'model':db['WhatsappAccount'],'as':_0xaa24('0x69'),'attributes':['id','name']});_0x3b3cdf[_0xaa24('0x5c')]({'model':db[_0xaa24('0x5d')],'as':_0xaa24('0x6a'),'attributes':['id',_0xaa24('0x5e')]});return db[_0xaa24('0x21')][_0xaa24('0x33')]({'where':{'id':_0xf30c1d[_0xaa24('0x36')]['id']},'include':_0x3b3cdf})['then'](handleEntityNotFound(_0x1c2f4,null))[_0xaa24('0x1c')](function(_0x3b1c27){if(_0x3b1c27){var _0x1b3d66=_0x3b1c27[_0xaa24('0x6b')]({'plain':!![]});fs[_0xaa24('0x6c')](_0x2fe802);var _0x3811a4={'channel':'Whatsapp','account':_0x1b3d66[_0xaa24('0x69')][_0xaa24('0x20')],'agent':_0x1b3d66['Owner']?_0x1b3d66[_0xaa24('0x6a')][_0xaa24('0x5e')]:_0xaa24('0x6d'),'createdAt':moment(_0x1b3d66[_0xaa24('0x65')])[_0xaa24('0x46')](_0xaa24('0x47'))[_0xaa24('0x55')](),'closedAt':_0x1b3d66[_0xaa24('0x6e')]?moment(_0x1b3d66['closedAt'])[_0xaa24('0x46')](_0xaa24('0x47'))[_0xaa24('0x55')]():'','disposition':_0x1b3d66[_0xaa24('0x6f')],'messages':_(_0x1b3d66[_0xaa24('0x64')])[_0xaa24('0x42')]({'secret':![]})['map'](function(_0x63d157){if(_0x63d157['Attachment']){var _0x265221=path[_0xaa24('0x56')](_0x419150,_0x63d157['Attachment'][_0xaa24('0x70')]);if(fs[_0xaa24('0x71')](_0x265221)){fs[_0xaa24('0x72')](_0x265221)[_0xaa24('0x73')](fs[_0xaa24('0x74')](path[_0xaa24('0x56')](_0x2fe802,_0x63d157[_0xaa24('0x63')][_0xaa24('0x70')])));}}return{'date':moment(_0x63d157['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xaa24('0x55')](),'sender':_0x63d157[_0xaa24('0x66')]===_0xaa24('0x75')?_0x63d157[_0xaa24('0x5d')]?_0x63d157[_0xaa24('0x5d')]['fullname']:_0xaa24('0x76'):_0x63d157['Contact']['firstName']+(_0x63d157[_0xaa24('0x60')][_0xaa24('0x62')]?'\x20'+_0x63d157[_0xaa24('0x60')][_0xaa24('0x62')]:''),'body':_0x63d157['Attachment']?_0x63d157[_0xaa24('0x63')][_0xaa24('0x70')]:_0x63d157[_0xaa24('0x35')],'direction':_0x63d157[_0xaa24('0x66')]===_0xaa24('0x75')?'A':'C','secret':_0x63d157['secret'],'read':_0x63d157[_0xaa24('0x68')],'attachment':_0x63d157[_0xaa24('0x63')]};})[_0xaa24('0x77')]()};return ejs[_0xaa24('0x78')](path[_0xaa24('0x56')](config[_0xaa24('0x57')],'server','views',_0xaa24('0x79')),{'interaction':_0x3811a4})['then'](function(_0x2791d2){var _0x5682eb=path[_0xaa24('0x56')](_0x2fe802,'transcript-'+_0x1b3d66['id']+'-'+_0x1b0a25+_0xaa24('0x7a'));var _0xc2dcb4={'path':_0x5682eb,'channel':_0xaa24('0x7b'),'interactionId':_0x1b3d66['id']};return pdf[_0xaa24('0x7c')](_0x2791d2,_0xc2dcb4);})['then'](function(){return new BPromise(function(_0x5b42bb,_0x1e9fb3){zipdir(_0x2fe802,{'saveTo':_0x583932},function(_0x517460,_0x3a03d7){if(_0x517460)return _0x1e9fb3(_0x517460);return _0x5b42bb(_0x3a03d7);});})[_0xaa24('0x1c')](function(){return new BPromise(function(_0x43fbd9,_0x48f2a5){rimraf(_0x2fe802,function(_0x227dde){if(_0x227dde)_0x48f2a5(_0x227dde);return _0x43fbd9();});});})['then'](function(){return _0x1c2f4['download'](_0x583932,_0x460e92,function(_0x246817){if(_0x246817){console[_0xaa24('0x7d')](_0xaa24('0x7e'),_0x246817);}else{fs[_0xaa24('0x7f')](_0x583932);}});});});}else{return _0x1c2f4[_0xaa24('0x12')](0xc8);}})[_0xaa24('0x27')](handleError(_0x1c2f4,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 4f6bd71..1b7fff4 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 _0x01d3=['WhatsappMessage','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','WhatsappInteraction','../../mysqldb'];(function(_0x502e60,_0x217700){var _0x124fcd=function(_0xd42dbe){while(--_0xd42dbe){_0x502e60['push'](_0x502e60['shift']());}};_0x124fcd(++_0x217700);}(_0x01d3,0xdb));var _0x301d=function(_0x1e77ed,_0x5720c1){_0x1e77ed=_0x1e77ed-0x0;var _0x32ed55=_0x01d3[_0x1e77ed];return _0x32ed55;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x301d('0x0')];var WhatsappMessage=require(_0x301d('0x1'))['db'][_0x301d('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x301d('0x3'),'afterUpdate':_0x301d('0x4'),'afterDestroy':_0x301d('0x5')};function emitEvent(_0x11ba0e){return function(_0x13cd36,_0x4f3b25,_0x44f428){_0x13cd36[_0x301d('0x6')]({'attributes':['id'],'raw':!![]})[_0x301d('0x7')](function(_0x30e89e){_0x13cd36[_0x301d('0x8')]('Users',_0x30e89e[_0x301d('0x9')](function(_0x1d8e83){return{'id':_0x1d8e83['id']};}));return WhatsappMessage[_0x301d('0xa')]({'where':{'WhatsappInteractionId':_0x13cd36['id'],'direction':'in','read':![]},'raw':!![]});})[_0x301d('0x7')](function(_0xc54235){_0x13cd36[_0x301d('0x8')](_0x301d('0xb'),_0xc54235[_0x301d('0xc')]);WhatsappInteractionEvents[_0x301d('0xd')](_0x11ba0e+':'+_0x13cd36['id'],_0x13cd36);WhatsappInteractionEvents['emit'](_0x11ba0e,_0x13cd36);_0x44f428(null);})[_0x301d('0xe')](_0x44f428(null));};}for(var e in events){if(events[_0x301d('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x301d('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xdeb7=['remove','getUsers','then','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update'];(function(_0x53945c,_0x299fb9){var _0x5ea64f=function(_0x54e107){while(--_0x54e107){_0x53945c['push'](_0x53945c['shift']());}};_0x5ea64f(++_0x299fb9);}(_0xdeb7,0x77));var _0x7deb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdeb7[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x7deb('0x0'));var WhatsappInteraction=require(_0x7deb('0x1'))['db'][_0x7deb('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x7deb('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7deb('0x4')](0x0);var events={'afterCreate':_0x7deb('0x5'),'afterUpdate':_0x7deb('0x6'),'afterDestroy':_0x7deb('0x7')};function emitEvent(_0x5b89a9){return function(_0x370d71,_0x39505e,_0x9283e7){_0x370d71[_0x7deb('0x8')]({'attributes':['id'],'raw':!![]})[_0x7deb('0x9')](function(_0x1a5058){_0x370d71['setDataValue'](_0x7deb('0xa'),_0x1a5058[_0x7deb('0xb')](function(_0x3cb5d4){return{'id':_0x3cb5d4['id']};}));return WhatsappMessage[_0x7deb('0xc')]({'where':{'WhatsappInteractionId':_0x370d71['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1c771d){_0x370d71['setDataValue']('unreadMessages',_0x1c771d[_0x7deb('0xd')]);WhatsappInteractionEvents['emit'](_0x5b89a9+':'+_0x370d71['id'],_0x370d71);WhatsappInteractionEvents[_0x7deb('0xe')](_0x5b89a9,_0x370d71);_0x9283e7(null);})[_0x7deb('0xf')](_0x9283e7(null));};}for(var e in events){if(events[_0x7deb('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x7deb('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 0bd48fa..b71dc42 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 _0x022b=['moment','bluebird','request-promise','path','rimraf','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','format','util','../../config/logger','api'];(function(_0x338a58,_0x2d5ac5){var _0x92bd1d=function(_0x1e9cb5){while(--_0x1e9cb5){_0x338a58['push'](_0x338a58['shift']());}};_0x92bd1d(++_0x2d5ac5);}(_0x022b,0x1cb));var _0xb022=function(_0x1bf471,_0x378f16){_0x1bf471=_0x1bf471-0x0;var _0x8a2d4=_0x022b[_0x1bf471];return _0x8a2d4;};'use strict';var _=require('lodash');var util=require(_0xb022('0x0'));var logger=require(_0xb022('0x1'))(_0xb022('0x2'));var moment=require(_0xb022('0x3'));var BPromise=require(_0xb022('0x4'));var rp=require(_0xb022('0x5'));var fs=require('fs');var path=require(_0xb022('0x6'));var rimraf=require(_0xb022('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0xb022('0x8')]=function(_0x4e0280,_0x5ed4d0){return _0x4e0280['define'](_0xb022('0x9'),attributes,{'tableName':_0xb022('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x216672,_0x3c00e7,_0x149de3){if(_0x216672[_0xb022('0xb')](_0xb022('0xc'))){_0x216672['closedAt']=moment()[_0xb022('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x149de3(null,_0x216672);}}});}; \ No newline at end of file +var _0x4964=['whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird','request-promise','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x27ca14,_0x26b5ba){var _0x1114fc=function(_0x4157c2){while(--_0x4157c2){_0x27ca14['push'](_0x27ca14['shift']());}};_0x1114fc(++_0x26b5ba);}(_0x4964,0xe5));var _0x4496=function(_0x1f5320,_0x4a74c3){_0x1f5320=_0x1f5320-0x0;var _0x5a75cf=_0x4964[_0x1f5320];return _0x5a75cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4496('0x0'));var moment=require(_0x4496('0x1'));var BPromise=require(_0x4496('0x2'));var rp=require(_0x4496('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4496('0x4'));var attributes=require(_0x4496('0x5'));module[_0x4496('0x6')]=function(_0x27f86f,_0x2ec6fa){return _0x27f86f[_0x4496('0x7')](_0x4496('0x8'),attributes,{'tableName':_0x4496('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16eff9,_0x5c4bc5,_0x1045e7){if(_0x16eff9[_0x4496('0xa')](_0x4496('0xb'))){_0x16eff9['closedAt']=moment()[_0x4496('0xc')](_0x4496('0xd'));}_0x1045e7(null,_0x16eff9);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index fdbe816..e05d157 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 _0x5408=['socket.io-emitter','redis','./whatsappInteraction.socket','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','body','options','attributes','limit','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','then','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4cc90a,_0x524121){var _0x2fb216=function(_0x3541ba){while(--_0x3541ba){_0x4cc90a['push'](_0x4cc90a['shift']());}};_0x2fb216(++_0x524121);}(_0x5408,0x14a));var _0x8540=function(_0x5676fc,_0x1507e4){_0x5676fc=_0x5676fc-0x0;var _0x13999b=_0x5408[_0x5676fc];return _0x13999b;};'use strict';var _=require(_0x8540('0x0'));var util=require(_0x8540('0x1'));var moment=require(_0x8540('0x2'));var BPromise=require(_0x8540('0x3'));var rs=require(_0x8540('0x4'));var fs=require('fs');var Redis=require(_0x8540('0x5'));var db=require(_0x8540('0x6'))['db'];var utils=require(_0x8540('0x7'));var logger=require(_0x8540('0x8'))(_0x8540('0x9'));var config=require(_0x8540('0xa'));var jayson=require(_0x8540('0xb'));var client=jayson[_0x8540('0xc')][_0x8540('0xd')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8540('0xe'))(new Redis(config[_0x8540('0xf')]));require(_0x8540('0x10'))['register'](socket);function respondWithRpcPromise(_0x355e8e,_0x57e3c4,_0x5403e7){return new BPromise(function(_0x1213fd,_0x12ba83){return client['request'](_0x355e8e,_0x5403e7)['then'](function(_0xafa493){logger[_0x8540('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x57e3c4,_0x8540('0x12'));logger['debug'](_0x8540('0x13'),_0x57e3c4,'request\x20sent',JSON[_0x8540('0x14')](_0xafa493));if(_0xafa493['error']){if(_0xafa493[_0x8540('0x15')][_0x8540('0x16')]===0x1f4){logger[_0x8540('0x15')](_0x8540('0x17'),_0x57e3c4,_0xafa493['error']['message']);return _0x12ba83(_0xafa493[_0x8540('0x15')]['message']);}logger[_0x8540('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x57e3c4,_0xafa493[_0x8540('0x15')][_0x8540('0x18')]);return _0x1213fd(_0xafa493['error']['message']);}else{logger[_0x8540('0x11')](_0x8540('0x17'),_0x57e3c4,_0x8540('0x12'));_0x1213fd(_0xafa493[_0x8540('0x19')]['message']);}})[_0x8540('0x1a')](function(_0x5576bc){logger[_0x8540('0x15')](_0x8540('0x17'),_0x57e3c4,_0x5576bc);_0x12ba83(_0x5576bc);});});}exports['UpdateWhatsappInteraction']=function(_0x427f17){var _0x1914eb=this;return new Promise(function(_0x3df99e,_0x41b73c){return db['WhatsappInteraction']['update'](_0x427f17[_0x8540('0x1b')],{'raw':_0x427f17[_0x8540('0x1c')]?_0x427f17[_0x8540('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x427f17[_0x8540('0x1c')]?_0x427f17[_0x8540('0x1c')]['where']||null:null,'attributes':_0x427f17['options']?_0x427f17[_0x8540('0x1c')][_0x8540('0x1d')]||null:null,'limit':_0x427f17[_0x8540('0x1c')]?_0x427f17[_0x8540('0x1c')][_0x8540('0x1e')]||null:null})['then'](function(_0x26bb18){logger[_0x8540('0x11')](_0x8540('0x1f'),_0x427f17);logger[_0x8540('0x20')](_0x8540('0x1f'),_0x427f17,JSON[_0x8540('0x14')](_0x26bb18));_0x3df99e(_0x26bb18);})[_0x8540('0x1a')](function(_0x221852){logger[_0x8540('0x15')](_0x8540('0x1f'),_0x221852['message'],_0x427f17);_0x41b73c(_0x1914eb[_0x8540('0x15')](0x1f4,_0x221852[_0x8540('0x18')]));});});};exports[_0x8540('0x21')]=function(_0x155a66){return new Promise(function(_0xd4c275,_0x1a2890){return db[_0x8540('0x22')][_0x8540('0x23')]({'where':_0x155a66[_0x8540('0x1c')]?_0x155a66[_0x8540('0x1c')][_0x8540('0x24')]||null:null})[_0x8540('0x25')](function(_0x4a62b1){if(_0x4a62b1){return _0x4a62b1[_0x8540('0x26')](_0x155a66[_0x8540('0x1b')]['ids'],_[_0x8540('0x27')](_0x155a66[_0x8540('0x1b')],[_0x8540('0x28'),'id'])||{});}})[_0x8540('0x29')](function(_0x4db6c8){logger[_0x8540('0x11')](_0x8540('0x2a'),_0x155a66);logger[_0x8540('0x20')](_0x8540('0x2a'),_0x155a66,JSON[_0x8540('0x14')](_0x4db6c8));_0xd4c275(_0x4db6c8);})['catch'](function(_0x5c922b){logger[_0x8540('0x15')]('AddTags',_0x5c922b['message'],_0x155a66);_0x1a2890(_this[_0x8540('0x15')](0x1f4,_0x5c922b[_0x8540('0x18')]));});});}; \ No newline at end of file +var _0x2ee4=['omit','body','ids','spread','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','register','then','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','WhatsappInteraction,\x20%s,\x20%s','info','request\x20sent','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','where','attributes','limit','find','addTags'];(function(_0x2c6e59,_0x20c5d4){var _0x57bc5f=function(_0x2830c8){while(--_0x2830c8){_0x2c6e59['push'](_0x2c6e59['shift']());}};_0x57bc5f(++_0x20c5d4);}(_0x2ee4,0xd7));var _0x42ee=function(_0x3588ba,_0x5c49f3){_0x3588ba=_0x3588ba-0x0;var _0x3695a2=_0x2ee4[_0x3588ba];return _0x3695a2;};'use strict';var _=require(_0x42ee('0x0'));var util=require('util');var moment=require(_0x42ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x42ee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42ee('0x3'))['db'];var utils=require(_0x42ee('0x4'));var logger=require(_0x42ee('0x5'))(_0x42ee('0x6'));var config=require(_0x42ee('0x7'));var jayson=require(_0x42ee('0x8'));var client=jayson[_0x42ee('0x9')][_0x42ee('0xa')]({'port':0x232a});config['redis']=_[_0x42ee('0xb')](config[_0x42ee('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x42ee('0xd'))(new Redis(config['redis']));require(_0x42ee('0xe'))[_0x42ee('0xf')](socket);function respondWithRpcPromise(_0x1c133f,_0x3c2d61,_0x9c7f74){return new BPromise(function(_0x3df758,_0x13d589){return client['request'](_0x1c133f,_0x9c7f74)[_0x42ee('0x10')](function(_0x1f620f){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x3c2d61,'request\x20sent');logger[_0x42ee('0x11')](_0x42ee('0x12'),_0x3c2d61,'request\x20sent',JSON[_0x42ee('0x13')](_0x1f620f));if(_0x1f620f['error']){if(_0x1f620f['error'][_0x42ee('0x14')]===0x1f4){logger[_0x42ee('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c2d61,_0x1f620f[_0x42ee('0x15')][_0x42ee('0x16')]);return _0x13d589(_0x1f620f[_0x42ee('0x15')][_0x42ee('0x16')]);}logger[_0x42ee('0x15')](_0x42ee('0x17'),_0x3c2d61,_0x1f620f[_0x42ee('0x15')][_0x42ee('0x16')]);return _0x3df758(_0x1f620f[_0x42ee('0x15')][_0x42ee('0x16')]);}else{logger[_0x42ee('0x18')](_0x42ee('0x17'),_0x3c2d61,_0x42ee('0x19'));_0x3df758(_0x1f620f[_0x42ee('0x1a')]['message']);}})[_0x42ee('0x1b')](function(_0x5d34a4){logger['error'](_0x42ee('0x17'),_0x3c2d61,_0x5d34a4);_0x13d589(_0x5d34a4);});});}exports[_0x42ee('0x1c')]=function(_0x221121){var _0x3d1f2e=this;return new Promise(function(_0x34d7e3,_0x46cfab){return db[_0x42ee('0x1d')][_0x42ee('0x1e')](_0x221121['body'],{'raw':_0x221121[_0x42ee('0x1f')]?_0x221121[_0x42ee('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x221121[_0x42ee('0x1f')]?_0x221121[_0x42ee('0x1f')][_0x42ee('0x20')]||null:null,'attributes':_0x221121[_0x42ee('0x1f')]?_0x221121[_0x42ee('0x1f')][_0x42ee('0x21')]||null:null,'limit':_0x221121['options']?_0x221121[_0x42ee('0x1f')][_0x42ee('0x22')]||null:null})[_0x42ee('0x10')](function(_0x5e7f73){logger[_0x42ee('0x18')](_0x42ee('0x1c'),_0x221121);logger[_0x42ee('0x11')]('UpdateWhatsappInteraction',_0x221121,JSON[_0x42ee('0x13')](_0x5e7f73));_0x34d7e3(_0x5e7f73);})[_0x42ee('0x1b')](function(_0x529885){logger[_0x42ee('0x15')](_0x42ee('0x1c'),_0x529885['message'],_0x221121);_0x46cfab(_0x3d1f2e[_0x42ee('0x15')](0x1f4,_0x529885[_0x42ee('0x16')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x46260e){return new Promise(function(_0x3b2b8f,_0x4f8205){return db['WhatsappInteraction'][_0x42ee('0x23')]({'where':_0x46260e[_0x42ee('0x1f')]?_0x46260e[_0x42ee('0x1f')]['where']||null:null})[_0x42ee('0x10')](function(_0x25e8a9){if(_0x25e8a9){return _0x25e8a9[_0x42ee('0x24')](_0x46260e['body']['ids'],_[_0x42ee('0x25')](_0x46260e[_0x42ee('0x26')],[_0x42ee('0x27'),'id'])||{});}})[_0x42ee('0x28')](function(_0x53d4a1){logger[_0x42ee('0x18')](_0x42ee('0x29'),_0x46260e);logger[_0x42ee('0x11')](_0x42ee('0x29'),_0x46260e,JSON[_0x42ee('0x13')](_0x53d4a1));_0x3b2b8f(_0x53d4a1);})[_0x42ee('0x1b')](function(_0x46cec9){logger[_0x42ee('0x15')]('AddTags',_0x46cec9[_0x42ee('0x16')],_0x46260e);_0x4f8205(_this[_0x42ee('0x15')](0x1f4,_0x46cec9[_0x42ee('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 07185b8..d5d6853 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 _0xf766=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x3a6b78,_0x2d62be){var _0x4943d4=function(_0x33ab64){while(--_0x33ab64){_0x3a6b78['push'](_0x3a6b78['shift']());}};_0x4943d4(++_0x2d62be);}(_0xf766,0x14f));var _0x6f76=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0xf766[_0x22c684];return _0x39fcbb;};'use strict';var WhatsappInteractionEvents=require(_0x6f76('0x0'));var events=[_0x6f76('0x1'),_0x6f76('0x2'),_0x6f76('0x3')];function createListener(_0x54808a,_0x39ed01){return function(_0x37b09b){_0x39ed01[_0x6f76('0x4')](_0x54808a,_0x37b09b);};}function removeListener(_0x7e327a,_0x2c9573){return function(){WhatsappInteractionEvents[_0x6f76('0x5')](_0x7e327a,_0x2c9573);};}exports[_0x6f76('0x6')]=function(_0x454294){for(var _0x55c14d=0x0,_0x28cc33=events[_0x6f76('0x7')];_0x55c14d<_0x28cc33;_0x55c14d++){var _0x11fc97=events[_0x55c14d];var _0xbd69c3=createListener(_0x6f76('0x8')+_0x11fc97,_0x454294);WhatsappInteractionEvents['on'](_0x11fc97,_0xbd69c3);}}; \ No newline at end of file +var _0x779b=['register','length','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x3f147e,_0x251ea9){var _0x4bc67c=function(_0xc9c673){while(--_0xc9c673){_0x3f147e['push'](_0x3f147e['shift']());}};_0x4bc67c(++_0x251ea9);}(_0x779b,0x11a));var _0xb779=function(_0xbea7c2,_0x48dc2e){_0xbea7c2=_0xbea7c2-0x0;var _0xb6fdb2=_0x779b[_0xbea7c2];return _0xb6fdb2;};'use strict';var WhatsappInteractionEvents=require(_0xb779('0x0'));var events=[_0xb779('0x1'),_0xb779('0x2'),_0xb779('0x3')];function createListener(_0x4a3190,_0x4035c2){return function(_0x71457b){_0x4035c2[_0xb779('0x4')](_0x4a3190,_0x71457b);};}function removeListener(_0x317208,_0x1c3fbd){return function(){WhatsappInteractionEvents[_0xb779('0x5')](_0x317208,_0x1c3fbd);};}exports[_0xb779('0x6')]=function(_0x116592){for(var _0x2b4e93=0x0,_0x3a80f9=events[_0xb779('0x7')];_0x2b4e93<_0x3a80f9;_0x2b4e93++){var _0xcd6c1=events[_0x2b4e93];var _0x2c4bd0=createListener('whatsappInteraction:'+_0xcd6c1,_0x116592);WhatsappInteractionEvents['on'](_0xcd6c1,_0x2c4bd0);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5dde764..77dff44 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 _0x4ddd=['/:id/reject','reject','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','./whatsappMessage.controller','get','index','/describe','describe','isAuthenticated','show','post','whatsappmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x4ddd,0x86));var _0xd4dd=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x4ddd[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0xd4dd('0x0'));var util=require(_0xd4dd('0x1'));var path=require(_0xd4dd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd4dd('0x3'));var auth=require(_0xd4dd('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd4dd('0x5'));router[_0xd4dd('0x6')]('/',auth['isAuthenticated'](),controller[_0xd4dd('0x7')]);router[_0xd4dd('0x6')](_0xd4dd('0x8'),auth['isAuthenticated'](),controller[_0xd4dd('0x9')]);router[_0xd4dd('0x6')]('/:id',auth[_0xd4dd('0xa')](),controller[_0xd4dd('0xb')]);router[_0xd4dd('0xc')]('/',auth[_0xd4dd('0xa')](),interaction['tracked']('whatsapp',_0xd4dd('0xd')),controller[_0xd4dd('0xe')]);router[_0xd4dd('0xc')](_0xd4dd('0xf'),controller[_0xd4dd('0x10')]);router[_0xd4dd('0x11')](_0xd4dd('0x12'),auth[_0xd4dd('0xa')](),controller[_0xd4dd('0x13')]);router[_0xd4dd('0x11')](_0xd4dd('0x14'),auth[_0xd4dd('0xa')](),controller[_0xd4dd('0x15')]);router[_0xd4dd('0x11')](_0xd4dd('0x16'),auth['isAuthenticated'](),controller[_0xd4dd('0x17')]);router[_0xd4dd('0x18')](_0xd4dd('0x12'),auth[_0xd4dd('0xa')](),controller[_0xd4dd('0x19')]);module['exports']=router; \ No newline at end of file +var _0x097b=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject'];(function(_0x250119,_0x221c37){var _0x201b20=function(_0x5bf84a){while(--_0x5bf84a){_0x250119['push'](_0x250119['shift']());}};_0x201b20(++_0x221c37);}(_0x097b,0x7b));var _0xb097=function(_0x2696f1,_0x7de5e4){_0x2696f1=_0x2696f1-0x0;var _0x3e5706=_0x097b[_0x2696f1];return _0x3e5706;};'use strict';var multer=require('multer');var util=require(_0xb097('0x0'));var path=require(_0xb097('0x1'));var timeout=require(_0xb097('0x2'));var express=require(_0xb097('0x3'));var router=express[_0xb097('0x4')]();var fs_extra=require(_0xb097('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb097('0x6'));var config=require(_0xb097('0x7'));var controller=require(_0xb097('0x8'));router[_0xb097('0x9')]('/',auth[_0xb097('0xa')](),controller[_0xb097('0xb')]);router[_0xb097('0x9')](_0xb097('0xc'),auth[_0xb097('0xa')](),controller[_0xb097('0xd')]);router['get'](_0xb097('0xe'),auth[_0xb097('0xa')](),controller[_0xb097('0xf')]);router[_0xb097('0x10')]('/',auth[_0xb097('0xa')](),interaction['tracked']('whatsapp',_0xb097('0x11')),controller[_0xb097('0x12')]);router['post'](_0xb097('0x13'),controller[_0xb097('0x14')]);router[_0xb097('0x15')]('/:id',auth[_0xb097('0xa')](),controller[_0xb097('0x16')]);router[_0xb097('0x15')](_0xb097('0x17'),auth['isAuthenticated'](),controller[_0xb097('0x18')]);router[_0xb097('0x15')](_0xb097('0x19'),auth[_0xb097('0xa')](),controller[_0xb097('0x1a')]);router[_0xb097('0x1b')](_0xb097('0xe'),auth[_0xb097('0xa')](),controller[_0xb097('0x1c')]);module[_0xb097('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 6dd5928..22c1059 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 _0xcf7a=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0xcf7a,0x159));var _0xacf7=function(_0x2ea709,_0x1679e4){_0x2ea709=_0x2ea709-0x0;var _0x573672=_0xcf7a[_0x2ea709];return _0x573672;};'use strict';var Sequelize=require(_0xacf7('0x0'));module[_0xacf7('0x1')]={'body':{'type':Sequelize[_0xacf7('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xacf7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xacf7('0x4')]('in',_0xacf7('0x5')),'defaultValue':_0xacf7('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xacf7('0x6')]},'readAt':{'type':Sequelize[_0xacf7('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xacf7('0x6')]},'providerResponse':{'type':Sequelize[_0xacf7('0x2')]}}; \ No newline at end of file +var _0x174e=['out','DATE','BOOLEAN','STRING','sequelize','exports','TEXT','medium'];(function(_0x16eb11,_0x1a2251){var _0x3ae7ef=function(_0x575a01){while(--_0x575a01){_0x16eb11['push'](_0x16eb11['shift']());}};_0x3ae7ef(++_0x1a2251);}(_0x174e,0x19c));var _0xe174=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x174e[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xe174('0x0'));module[_0xe174('0x1')]={'body':{'type':Sequelize[_0xe174('0x2')](_0xe174('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe174('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xe174('0x5')]},'secret':{'type':Sequelize[_0xe174('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe174('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 7d2d8d2..ebae5b0 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 _0x7dbf=['http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','WhatsappMessage','includeAll','findAll','rows','catch','intersection','options','find','create','body','params','describe','whatsapp-interactions','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','format','interaction','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','QueryTypes','internal','motionChannel','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','localhost','redis','./whatsappMessage.socket','register','client'];(function(_0x3d3b2d,_0x2e9821){var _0x5a00f7=function(_0x3de0bc){while(--_0x3de0bc){_0x3d3b2d['push'](_0x3d3b2d['shift']());}};_0x5a00f7(++_0x2e9821);}(_0x7dbf,0x66));var _0xf7db=function(_0x634673,_0x27a672){_0x634673=_0x634673-0x0;var _0xe9916e=_0x7dbf[_0x634673];return _0xe9916e;};'use strict';var emlformat=require(_0xf7db('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7db('0x1'));var jsonpatch=require(_0xf7db('0x2'));var rp=require(_0xf7db('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf7db('0x4'));var util=require(_0xf7db('0x5'));var path=require(_0xf7db('0x6'));var sox=require(_0xf7db('0x7'));var csv=require(_0xf7db('0x8'));var ejs=require(_0xf7db('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf7db('0xa'));var crypto=require(_0xf7db('0xb'));var jsforce=require(_0xf7db('0xc'));var deskjs=require(_0xf7db('0xd'));var toCsv=require(_0xf7db('0x8'));var querystring=require(_0xf7db('0xe'));var Papa=require('papaparse');var Redis=require(_0xf7db('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf7db('0x10'));var as=require(_0xf7db('0x11'));var hardwareService=require(_0xf7db('0x12'));var logger=require(_0xf7db('0x13'))(_0xf7db('0x14'));var utils=require(_0xf7db('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xf7db('0x16')](config['redis'],{'host':_0xf7db('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf7db('0x18')]));require(_0xf7db('0x19'))[_0xf7db('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf7db('0x1b')][_0xf7db('0x1c')]({'port':0x232c});var client9002=jayson[_0xf7db('0x1b')][_0xf7db('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3f1321,_0x3a74c2,_0x5c694d,_0x339662){return new BPromise(function(_0x291a36,_0x546b73){var _0x660c39=_0x339662||client;return _0x660c39[_0xf7db('0x1d')](_0x3f1321,_0x5c694d)['then'](function(_0xcae621){logger[_0xf7db('0x1e')](_0xf7db('0x1f'),_0x3a74c2,_0xf7db('0x20'));logger[_0xf7db('0x21')](_0xf7db('0x22'),_0x3a74c2,'request\x20sent',JSON[_0xf7db('0x23')](_0xcae621));if(_0xcae621[_0xf7db('0x24')]){if(_0xcae621[_0xf7db('0x24')]['code']===0x1f4){logger[_0xf7db('0x24')](_0xf7db('0x1f'),_0x3a74c2,_0xcae621['error'][_0xf7db('0x25')]);return _0x546b73(_0xcae621[_0xf7db('0x24')]['message']);}logger[_0xf7db('0x24')](_0xf7db('0x1f'),_0x3a74c2,_0xcae621[_0xf7db('0x24')][_0xf7db('0x25')]);return _0x291a36(_0xcae621[_0xf7db('0x24')][_0xf7db('0x25')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3a74c2,_0xf7db('0x20'));_0x291a36(_0xcae621[_0xf7db('0x26')][_0xf7db('0x25')]);}})['catch'](function(_0x976464){logger['error'](_0xf7db('0x1f'),_0x3a74c2,_0x976464);_0x546b73(_0x976464);});});}function respondWithStatusCode(_0x52ec8d,_0x213b04){_0x213b04=_0x213b04||0xcc;return function(_0x50c7b5){if(_0x50c7b5){return _0x52ec8d[_0xf7db('0x27')](_0x213b04);}return _0x52ec8d[_0xf7db('0x28')](_0x213b04)[_0xf7db('0x29')]();};}function respondWithResult(_0x16d86f,_0x44c04c){_0x44c04c=_0x44c04c||0xc8;return function(_0x21e3f6){if(_0x21e3f6){return _0x16d86f[_0xf7db('0x28')](_0x44c04c)[_0xf7db('0x2a')](_0x21e3f6);}};}function respondWithFilteredResult(_0x3dd711,_0x5bb903){return function(_0x147e11){if(_0x147e11){var _0x5bf9ca=typeof _0x5bb903[_0xf7db('0x2b')]==='undefined'&&typeof _0x5bb903['limit']==='undefined';var _0x3325e0=_0x147e11[_0xf7db('0x2c')];var _0x158d64=_0x5bf9ca?0x0:_0x5bb903[_0xf7db('0x2b')];var _0x198996=_0x5bf9ca?_0x147e11['count']:_0x5bb903[_0xf7db('0x2b')]+_0x5bb903[_0xf7db('0x2d')];var _0x3c1777;if(_0x198996>=_0x3325e0){_0x198996=_0x3325e0;_0x3c1777=0xc8;}else{_0x3c1777=0xce;}_0x3dd711[_0xf7db('0x28')](_0x3c1777);return _0x3dd711['set'](_0xf7db('0x2e'),_0x158d64+'-'+_0x198996+'/'+_0x3325e0)[_0xf7db('0x2a')](_0x147e11);}return null;};}function patchUpdates(_0x3db41e){return function(_0xe14cbf){try{jsonpatch[_0xf7db('0x2f')](_0xe14cbf,_0x3db41e,!![]);}catch(_0x1548fb){return BPromise['reject'](_0x1548fb);}return _0xe14cbf[_0xf7db('0x30')]();};}function saveUpdates(_0x562a34,_0x492e97){return function(_0x482665){if(_0x482665){return _0x482665[_0xf7db('0x31')](_0x562a34)[_0xf7db('0x32')](function(_0x34c47c){return _0x34c47c;});}return null;};}function removeEntity(_0x49a0cf,_0xbe0551){return function(_0x258008){if(_0x258008){return _0x258008[_0xf7db('0x33')]()[_0xf7db('0x32')](function(){_0x49a0cf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x80d19f,_0x11d9a2){return function(_0xddb640){if(!_0xddb640){_0x80d19f[_0xf7db('0x27')](0x194);}return _0xddb640;};}function handleError(_0x3d310a,_0x3e19e6){_0x3e19e6=_0x3e19e6||0x1f4;return function(_0x444331){logger[_0xf7db('0x24')](_0x444331[_0xf7db('0x34')]);if(_0x444331[_0xf7db('0x35')]){delete _0x444331[_0xf7db('0x35')];}_0x3d310a[_0xf7db('0x28')](_0x3e19e6)[_0xf7db('0x36')](_0x444331);};}exports['index']=function(_0x3e0902,_0x5ed245){var _0x45f9ff={},_0x49ca46={},_0x106ad0={'count':0x0,'rows':[]};var _0x2c0b35=_[_0xf7db('0x37')](db['WhatsappMessage'][_0xf7db('0x38')],function(_0x4976ee){return{'name':_0x4976ee[_0xf7db('0x39')],'type':_0x4976ee[_0xf7db('0x3a')]['key']};});_0x49ca46['model']=_[_0xf7db('0x37')](_0x2c0b35,_0xf7db('0x35'));_0x49ca46[_0xf7db('0x3b')]=_[_0xf7db('0x3c')](_0x3e0902[_0xf7db('0x3b')]);_0x49ca46[_0xf7db('0x3d')]=_['intersection'](_0x49ca46[_0xf7db('0x3e')],_0x49ca46[_0xf7db('0x3b')]);_0x45f9ff[_0xf7db('0x3f')]=_['intersection'](_0x49ca46[_0xf7db('0x3e')],qs[_0xf7db('0x40')](_0x3e0902[_0xf7db('0x3b')][_0xf7db('0x40')]));_0x45f9ff[_0xf7db('0x3f')]=_0x45f9ff['attributes'][_0xf7db('0x41')]?_0x45f9ff[_0xf7db('0x3f')]:_0x49ca46[_0xf7db('0x3e')];if(!_0x3e0902[_0xf7db('0x3b')]['hasOwnProperty'](_0xf7db('0x42'))){_0x45f9ff[_0xf7db('0x2d')]=qs[_0xf7db('0x2d')](_0x3e0902['query']['limit']);_0x45f9ff[_0xf7db('0x2b')]=qs[_0xf7db('0x2b')](_0x3e0902[_0xf7db('0x3b')]['offset']);}_0x45f9ff[_0xf7db('0x43')]=qs['sort'](_0x3e0902[_0xf7db('0x3b')]['sort']);_0x45f9ff[_0xf7db('0x44')]=qs['filters'](_[_0xf7db('0x45')](_0x3e0902['query'],_0x49ca46[_0xf7db('0x3d')]),_0x2c0b35);if(_0x3e0902['query'][_0xf7db('0x46')]){_0x45f9ff[_0xf7db('0x44')]=_[_0xf7db('0x47')](_0x45f9ff['where'],{'$or':_[_0xf7db('0x37')](_0x2c0b35,function(_0x1bef9b){if(_0x1bef9b['type']!==_0xf7db('0x48')){var _0x321cbd={};_0x321cbd[_0x1bef9b[_0xf7db('0x35')]]={'$like':'%'+_0x3e0902['query'][_0xf7db('0x46')]+'%'};return _0x321cbd;}})});}_0x45f9ff=_[_0xf7db('0x47')]({},_0x45f9ff,_0x3e0902['options']);var _0xe1f281={'where':_0x45f9ff[_0xf7db('0x44')]};return db[_0xf7db('0x49')][_0xf7db('0x2c')](_0xe1f281)['then'](function(_0x3ec679){_0x106ad0[_0xf7db('0x2c')]=_0x3ec679;if(_0x3e0902[_0xf7db('0x3b')][_0xf7db('0x4a')]){_0x45f9ff['include']=[{'all':!![]}];}return db[_0xf7db('0x49')][_0xf7db('0x4b')](_0x45f9ff);})[_0xf7db('0x32')](function(_0x434fd5){_0x106ad0[_0xf7db('0x4c')]=_0x434fd5;return _0x106ad0;})['then'](respondWithFilteredResult(_0x5ed245,_0x45f9ff))[_0xf7db('0x4d')](handleError(_0x5ed245,null));};exports['show']=function(_0x3c8b9c,_0x1a1493){var _0x4d988d={'raw':!![],'where':{'id':_0x3c8b9c['params']['id']}},_0x45612f={};_0x45612f['model']=_[_0xf7db('0x3c')](db[_0xf7db('0x49')]['rawAttributes']);_0x45612f[_0xf7db('0x3b')]=_[_0xf7db('0x3c')](_0x3c8b9c[_0xf7db('0x3b')]);_0x45612f[_0xf7db('0x3d')]=_[_0xf7db('0x4e')](_0x45612f['model'],_0x45612f['query']);_0x4d988d['attributes']=_[_0xf7db('0x4e')](_0x45612f['model'],qs[_0xf7db('0x40')](_0x3c8b9c[_0xf7db('0x3b')][_0xf7db('0x40')]));_0x4d988d[_0xf7db('0x3f')]=_0x4d988d[_0xf7db('0x3f')][_0xf7db('0x41')]?_0x4d988d[_0xf7db('0x3f')]:_0x45612f[_0xf7db('0x3e')];if(_0x3c8b9c['query'][_0xf7db('0x4a')]){_0x4d988d['include']=[{'all':!![]}];}_0x4d988d=_[_0xf7db('0x47')]({},_0x4d988d,_0x3c8b9c[_0xf7db('0x4f')]);return db[_0xf7db('0x49')][_0xf7db('0x50')](_0x4d988d)[_0xf7db('0x32')](handleEntityNotFound(_0x1a1493,null))[_0xf7db('0x32')](respondWithResult(_0x1a1493,null))[_0xf7db('0x4d')](handleError(_0x1a1493,null));};exports[_0xf7db('0x51')]=function(_0xca3d86,_0x192cba){return db[_0xf7db('0x49')]['create'](_0xca3d86[_0xf7db('0x52')],{})['then'](respondWithResult(_0x192cba,0xc9))[_0xf7db('0x4d')](handleError(_0x192cba,null));};exports['update']=function(_0x94fc15,_0x5c565f){if(_0x94fc15[_0xf7db('0x52')]['id']){delete _0x94fc15[_0xf7db('0x52')]['id'];}return db['WhatsappMessage'][_0xf7db('0x50')]({'where':{'id':_0x94fc15[_0xf7db('0x53')]['id']}})[_0xf7db('0x32')](handleEntityNotFound(_0x5c565f,null))[_0xf7db('0x32')](saveUpdates(_0x94fc15['body'],null))['then'](respondWithResult(_0x5c565f,null))['catch'](handleError(_0x5c565f,null));};exports[_0xf7db('0x33')]=function(_0x38d63e,_0x35e199){return db[_0xf7db('0x49')][_0xf7db('0x50')]({'where':{'id':_0x38d63e[_0xf7db('0x53')]['id']}})['then'](handleEntityNotFound(_0x35e199,null))['then'](removeEntity(_0x35e199,null))['catch'](handleError(_0x35e199,null));};exports[_0xf7db('0x54')]=function(_0xf224d1,_0x504bec){return db[_0xf7db('0x49')][_0xf7db('0x54')]()[_0xf7db('0x32')](respondWithResult(_0x504bec,null))[_0xf7db('0x4d')](handleError(_0x504bec,null));};var interaction_log=require('../../config/logger')(_0xf7db('0x55'));exports[_0xf7db('0x56')]=function(_0x232f39,_0x213745,_0x1be560){var _0x5a883d={'agent':{},'channel':'whatsapp'};if(_0x232f39[_0xf7db('0x52')]['id']){delete _0x232f39[_0xf7db('0x52')]['id'];}_0x232f39[_0xf7db('0x52')][_0xf7db('0x57')]=!![];_0x232f39['body']['readAt']=moment()['format'](_0xf7db('0x58'));_0x232f39[_0xf7db('0x52')][_0xf7db('0x59')]=_0x232f39[_0xf7db('0x52')]['UserId']||_0x232f39['user']['id'];_0x5a883d[_0xf7db('0x5a')]['id']=_0x232f39[_0xf7db('0x52')][_0xf7db('0x59')];return db[_0xf7db('0x49')][_0xf7db('0x50')]({'where':{'id':_0x232f39['params']['id'],'UserId':null}})[_0xf7db('0x32')](handleEntityNotFound(_0x213745,null))[_0xf7db('0x32')](saveUpdates(_0x232f39[_0xf7db('0x52')],null))[_0xf7db('0x32')](function(_0x3194f6){if(_0x3194f6){_0x5a883d['message']=_0x3194f6[_0xf7db('0x5b')]({'plain':!![]});return db[_0xf7db('0x5c')][_0xf7db('0x50')]({'where':{'id':_0x3194f6[_0xf7db('0x5d')]}});}return null;})[_0xf7db('0x32')](handleEntityNotFound(_0x213745,null))['then'](function(_0x1fa693){if(_0x1fa693){return _0x1fa693['update']({'UserId':_0x232f39[_0xf7db('0x52')][_0xf7db('0x59')],'read1stAt':_[_0xf7db('0x5e')](_0x1fa693['read1stAt'])?moment()[_0xf7db('0x5f')](_0xf7db('0x58')):undefined});}return null;})[_0xf7db('0x32')](function(_0x54ce25){if(_0x54ce25){_0x5a883d[_0xf7db('0x60')]=_0x54ce25['get']({'plain':!![]});interaction_log[_0xf7db('0x1e')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x232f39[_0xf7db('0x61')]['id'],_0x232f39['user'][_0xf7db('0x35')],_0x232f39[_0xf7db('0x61')]['role'],_0x5a883d[_0xf7db('0x60')]['id'],_0x232f39[_0xf7db('0x52')]?JSON[_0xf7db('0x23')](_0x232f39[_0xf7db('0x52')]):_0xf7db('0x62'));return respondWithRpcPromise(_0xf7db('0x63'),_0xf7db('0x64'),_0x5a883d);}return null;})['then'](function(_0x26b5cf){var _0x7b0317=_0xf7db('0x65')+_0x26b5cf[_0xf7db('0x25')]['ContactId'];return db[_0xf7db('0x66')][_0xf7db('0x3b')](_0x7b0317,{'type':db[_0xf7db('0x67')]['QueryTypes'][_0xf7db('0x68')],'raw':!![]})[_0xf7db('0x32')](function(_0xb8b88b){return _0xb8b88b;});})['then'](function(_0x123b90){if(_0x123b90){_0x5a883d['message'][_0xf7db('0x69')]=_0x123b90[0x0];if(!_0x232f39[_0xf7db('0x52')][_0xf7db('0x59')])return;return db[_0xf7db('0x6a')]['find']({'where':{'id':_0x232f39['body'][_0xf7db('0x59')],'role':_0xf7db('0x5a')},'attributes':['id','name',_0xf7db('0x6b'),_0xf7db('0x6c'),'internal'],'raw':!![]});}return null;})['then'](function(_0x19f915){if(!_0x19f915)return null;_0x5a883d['message']['agent']=_0x19f915;return _0x5a883d;})[_0xf7db('0x32')](function(_0x3211da){if(_0x3211da){if(_0x232f39[_0xf7db('0x52')]['manual']){_0x5a883d[_0xf7db('0x25')][_0xf7db('0x6d')]=util[_0xf7db('0x5f')](_0xf7db('0x6e'),_0x232f39[_0xf7db('0x61')][_0xf7db('0x35')]);_0x5a883d['message']['channel']=_0x5a883d[_0xf7db('0x6f')];_0x5a883d[_0xf7db('0x25')]['motionChannel']=_0x5a883d[_0xf7db('0x6f')];_0x5a883d[_0xf7db('0x25')][_0xf7db('0x70')]=_0xf7db('0x56');return respondWithRpcPromise(_0xf7db('0x71'),_0xf7db('0x71'),{'event':_0xf7db('0x72'),'message':_0x5a883d[_0xf7db('0x25')]},client9002)['then'](function(){return _0x5a883d;});}return _0x5a883d;}return null;})['then'](respondWithResult(_0x213745,null))['catch'](handleError(_0x213745,null));};var interaction_log=require(_0xf7db('0x13'))(_0xf7db('0x55'));exports[_0xf7db('0x73')]=function(_0x1c416d,_0x5c3ce3,_0x43cd4b){var _0x32fa50={'agent':{},'channel':_0xf7db('0x74')};if(_0x1c416d[_0xf7db('0x52')]['id']){delete _0x1c416d[_0xf7db('0x52')]['id'];}_0x1c416d[_0xf7db('0x52')][_0xf7db('0x59')]=_0x1c416d[_0xf7db('0x52')][_0xf7db('0x59')]||_0x1c416d[_0xf7db('0x61')]['id'];_0x32fa50[_0xf7db('0x5a')]['id']=_0x1c416d[_0xf7db('0x52')][_0xf7db('0x59')];return db[_0xf7db('0x49')]['find']({'where':{'id':_0x1c416d[_0xf7db('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5c3ce3,null))[_0xf7db('0x32')](function(_0x4b1840){if(_0x4b1840){_0x32fa50[_0xf7db('0x25')]=_0x4b1840[_0xf7db('0x5b')]({'plain':!![]});return db[_0xf7db('0x5c')]['find']({'where':{'id':_0x4b1840[_0xf7db('0x5d')]}});}return null;})['then'](handleEntityNotFound(_0x5c3ce3,null))[_0xf7db('0x32')](function(_0x3ba09c){if(_0x3ba09c){_0x32fa50[_0xf7db('0x60')]=_0x3ba09c[_0xf7db('0x5b')]({'plain':!![]});interaction_log[_0xf7db('0x1e')](_0xf7db('0x75'),_0x1c416d['user']['id'],_0x1c416d[_0xf7db('0x61')][_0xf7db('0x35')],_0x1c416d[_0xf7db('0x61')][_0xf7db('0x76')],_0x32fa50['interaction']['id'],_0x1c416d[_0xf7db('0x52')]?JSON[_0xf7db('0x23')](_0x1c416d[_0xf7db('0x52')]):_0xf7db('0x62'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x32fa50);}return null;})[_0xf7db('0x32')](function(_0x3aaa36){var _0x297ab3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3aaa36['message']['ContactId'];return db[_0xf7db('0x66')][_0xf7db('0x3b')](_0x297ab3,{'type':db[_0xf7db('0x67')][_0xf7db('0x77')]['SELECT'],'raw':!![]})[_0xf7db('0x32')](function(_0x3e1c0f){return _0x3e1c0f;});})[_0xf7db('0x32')](function(_0x26d221){if(_0x26d221){_0x32fa50['message']['contact']=_0x26d221[0x0];if(!_0x1c416d[_0xf7db('0x52')]['UserId'])return;return db[_0xf7db('0x6a')][_0xf7db('0x50')]({'where':{'id':_0x1c416d['body']['UserId'],'role':'agent'},'attributes':['id',_0xf7db('0x35'),_0xf7db('0x6b'),_0xf7db('0x6c'),_0xf7db('0x78')],'raw':!![]});}return null;})[_0xf7db('0x32')](function(_0x4b8090){if(!_0x4b8090)return null;_0x32fa50[_0xf7db('0x25')][_0xf7db('0x5a')]=_0x4b8090;return _0x32fa50;})['then'](function(_0x3926a0){if(_0x3926a0){_0x3926a0[_0xf7db('0x25')][_0xf7db('0x6d')]=util['format'](_0xf7db('0x6e'),_0x1c416d[_0xf7db('0x61')][_0xf7db('0x35')]);_0x3926a0['message'][_0xf7db('0x6f')]=_0x32fa50[_0xf7db('0x6f')];_0x3926a0['message'][_0xf7db('0x79')]=_0x32fa50['channel'];_0x3926a0[_0xf7db('0x25')][_0xf7db('0x70')]=_0xf7db('0x73');respondWithRpcPromise(_0xf7db('0x71'),_0xf7db('0x71'),{'event':_0xf7db('0x7a'),'message':_0x3926a0[_0xf7db('0x25')]},client9002);return _0x32fa50;}return null;})[_0xf7db('0x32')](respondWithResult(_0x5c3ce3,null))[_0xf7db('0x4d')](handleError(_0x5c3ce3,null));};exports[_0xf7db('0x28')]=function(_0x4a04b8,_0x566740,_0xa080fb){if(_0x4a04b8[_0xf7db('0x52')]['id']){delete _0x4a04b8[_0xf7db('0x52')]['id'];}var _0xac834f;return db['WhatsappMessage'][_0xf7db('0x50')]({'where':{'id':_0x4a04b8[_0xf7db('0x53')]['id']}})['then'](handleEntityNotFound(_0x566740,null))[_0xf7db('0x32')](function(_0xd13b79){if(_0xd13b79){_0xac834f=_0xd13b79;return db[_0xf7db('0x7b')][_0xf7db('0x50')]({'where':{'id':_0xd13b79['WhatsappAccountId']}});}})[_0xf7db('0x32')](handleEntityNotFound(_0x566740,null))[_0xf7db('0x32')](function(_0x5ddadd){if(_0x5ddadd){logger['debug'](_0xf7db('0x7c'),_0xf7db('0x28'),_0xf7db('0x7d'),_0x5ddadd[_0xf7db('0x3a')],util[_0xf7db('0x7e')](_0x4a04b8[_0xf7db('0x52')],{'showHidden':![],'depth':null}));switch(_0x5ddadd[_0xf7db('0x3a')]){case _0xf7db('0x7f'):if(_0x4a04b8[_0xf7db('0x52')]['MessageSid']&&_0x4a04b8[_0xf7db('0x52')]['MessageSid']===_0xac834f[_0xf7db('0x80')]&&_0x4a04b8[_0xf7db('0x52')][_0xf7db('0x81')]&&_0x4a04b8['body'][_0xf7db('0x81')]===_0xf7db('0x57')){return _0xac834f[_0xf7db('0x31')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0xf7db('0x7f'),util['inspect'](_0x4a04b8[_0xf7db('0x52')],{'showHidden':![],'depth':null}));}break;}return _0xac834f;}})['then'](respondWithResult(_0x566740,null))[_0xf7db('0x4d')](handleError(_0x566740,null));}; \ No newline at end of file +var _0xdfca=['register','http','client','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','name','send','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE: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','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','event','acceptmessage','RejectMessage','Sequelize','QueryTypes','email','interface','motionChannel','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x3ff8c3,_0x31b094){var _0x4b9d47=function(_0x4e6f9d){while(--_0x4e6f9d){_0x3ff8c3['push'](_0x3ff8c3['shift']());}};_0x4b9d47(++_0x31b094);}(_0xdfca,0x180));var _0xadfc=function(_0x51bdb9,_0x334ff9){_0x51bdb9=_0x51bdb9-0x0;var _0x2b959f=_0xdfca[_0x51bdb9];return _0x2b959f;};'use strict';var emlformat=require(_0xadfc('0x0'));var rimraf=require(_0xadfc('0x1'));var zipdir=require(_0xadfc('0x2'));var jsonpatch=require(_0xadfc('0x3'));var rp=require(_0xadfc('0x4'));var moment=require('moment');var BPromise=require(_0xadfc('0x5'));var Mustache=require(_0xadfc('0x6'));var util=require('util');var path=require(_0xadfc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xadfc('0x8'));var fs=require('fs');var fs_extra=require(_0xadfc('0x9'));var _=require('lodash');var squel=require(_0xadfc('0xa'));var crypto=require('crypto');var jsforce=require(_0xadfc('0xb'));var deskjs=require(_0xadfc('0xc'));var toCsv=require(_0xadfc('0xd'));var querystring=require('querystring');var Papa=require(_0xadfc('0xe'));var Redis=require('ioredis');var authService=require(_0xadfc('0xf'));var qs=require(_0xadfc('0x10'));var as=require(_0xadfc('0x11'));var hardwareService=require(_0xadfc('0x12'));var logger=require(_0xadfc('0x13'))('api');var utils=require(_0xadfc('0x14'));var config=require(_0xadfc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xadfc('0x16'))['db'];config[_0xadfc('0x17')]=_[_0xadfc('0x18')](config[_0xadfc('0x17')],{'host':_0xadfc('0x19'),'port':0x18eb});var socket=require(_0xadfc('0x1a'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xadfc('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xadfc('0x1c')]({'port':0x232c});var client9002=jayson[_0xadfc('0x1d')][_0xadfc('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4cb9f6,_0x5c7f2c,_0x5d59bb,_0x7d86d9){return new BPromise(function(_0x3de7ca,_0x4413ee){var _0x262a72=_0x7d86d9||client;return _0x262a72['request'](_0x4cb9f6,_0x5d59bb)[_0xadfc('0x1e')](function(_0x1782b1){logger['info'](_0xadfc('0x1f'),_0x5c7f2c,'request\x20sent');logger[_0xadfc('0x20')](_0xadfc('0x21'),_0x5c7f2c,'request\x20sent',JSON['stringify'](_0x1782b1));if(_0x1782b1[_0xadfc('0x22')]){if(_0x1782b1[_0xadfc('0x22')]['code']===0x1f4){logger[_0xadfc('0x22')](_0xadfc('0x1f'),_0x5c7f2c,_0x1782b1['error'][_0xadfc('0x23')]);return _0x4413ee(_0x1782b1[_0xadfc('0x22')][_0xadfc('0x23')]);}logger['error'](_0xadfc('0x1f'),_0x5c7f2c,_0x1782b1['error']['message']);return _0x3de7ca(_0x1782b1[_0xadfc('0x22')][_0xadfc('0x23')]);}else{logger[_0xadfc('0x24')](_0xadfc('0x1f'),_0x5c7f2c,_0xadfc('0x25'));_0x3de7ca(_0x1782b1['result']['message']);}})['catch'](function(_0x100f69){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5c7f2c,_0x100f69);_0x4413ee(_0x100f69);});});}function respondWithStatusCode(_0x1aed3c,_0x13f05b){_0x13f05b=_0x13f05b||0xcc;return function(_0x49c2a1){if(_0x49c2a1){return _0x1aed3c[_0xadfc('0x26')](_0x13f05b);}return _0x1aed3c['status'](_0x13f05b)['end']();};}function respondWithResult(_0x440319,_0x116ed2){_0x116ed2=_0x116ed2||0xc8;return function(_0x420fc3){if(_0x420fc3){return _0x440319[_0xadfc('0x27')](_0x116ed2)[_0xadfc('0x28')](_0x420fc3);}};}function respondWithFilteredResult(_0x20cefc,_0x448ed3){return function(_0x530a8f){if(_0x530a8f){var _0x133138=typeof _0x448ed3['offset']===_0xadfc('0x29')&&typeof _0x448ed3['limit']==='undefined';var _0x1320f9=_0x530a8f[_0xadfc('0x2a')];var _0xc1d57a=_0x133138?0x0:_0x448ed3['offset'];var _0xaac207=_0x133138?_0x530a8f[_0xadfc('0x2a')]:_0x448ed3[_0xadfc('0x2b')]+_0x448ed3['limit'];var _0x8220d;if(_0xaac207>=_0x1320f9){_0xaac207=_0x1320f9;_0x8220d=0xc8;}else{_0x8220d=0xce;}_0x20cefc[_0xadfc('0x27')](_0x8220d);return _0x20cefc[_0xadfc('0x2c')](_0xadfc('0x2d'),_0xc1d57a+'-'+_0xaac207+'/'+_0x1320f9)['json'](_0x530a8f);}return null;};}function patchUpdates(_0x2f7142){return function(_0x5eaa4a){try{jsonpatch[_0xadfc('0x2e')](_0x5eaa4a,_0x2f7142,!![]);}catch(_0x4df9f3){return BPromise[_0xadfc('0x2f')](_0x4df9f3);}return _0x5eaa4a['save']();};}function saveUpdates(_0xbcef72,_0xfc2155){return function(_0x5e9d17){if(_0x5e9d17){return _0x5e9d17[_0xadfc('0x30')](_0xbcef72)[_0xadfc('0x1e')](function(_0xb3a919){return _0xb3a919;});}return null;};}function removeEntity(_0x17d099,_0x2eeb8f){return function(_0x46298c){if(_0x46298c){return _0x46298c[_0xadfc('0x31')]()['then'](function(){_0x17d099[_0xadfc('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f9384,_0x2e73d3){return function(_0x46195){if(!_0x46195){_0x2f9384[_0xadfc('0x26')](0x194);}return _0x46195;};}function handleError(_0x2fca08,_0x45a2a3){_0x45a2a3=_0x45a2a3||0x1f4;return function(_0x4587f0){logger[_0xadfc('0x22')](_0x4587f0['stack']);if(_0x4587f0[_0xadfc('0x32')]){delete _0x4587f0[_0xadfc('0x32')];}_0x2fca08[_0xadfc('0x27')](_0x45a2a3)[_0xadfc('0x33')](_0x4587f0);};}exports['index']=function(_0x299b80,_0x131ec5){var _0x254bc1={},_0x34aed1={},_0x559a4f={'count':0x0,'rows':[]};var _0x25a406=_['map'](db[_0xadfc('0x34')][_0xadfc('0x35')],function(_0x5083ce){return{'name':_0x5083ce[_0xadfc('0x36')],'type':_0x5083ce[_0xadfc('0x37')]['key']};});_0x34aed1[_0xadfc('0x38')]=_['map'](_0x25a406,_0xadfc('0x32'));_0x34aed1[_0xadfc('0x39')]=_[_0xadfc('0x3a')](_0x299b80['query']);_0x34aed1['filters']=_['intersection'](_0x34aed1[_0xadfc('0x38')],_0x34aed1[_0xadfc('0x39')]);_0x254bc1['attributes']=_['intersection'](_0x34aed1['model'],qs[_0xadfc('0x3b')](_0x299b80[_0xadfc('0x39')][_0xadfc('0x3b')]));_0x254bc1['attributes']=_0x254bc1[_0xadfc('0x3c')][_0xadfc('0x3d')]?_0x254bc1[_0xadfc('0x3c')]:_0x34aed1[_0xadfc('0x38')];if(!_0x299b80[_0xadfc('0x39')][_0xadfc('0x3e')](_0xadfc('0x3f'))){_0x254bc1[_0xadfc('0x40')]=qs[_0xadfc('0x40')](_0x299b80[_0xadfc('0x39')]['limit']);_0x254bc1[_0xadfc('0x2b')]=qs['offset'](_0x299b80['query'][_0xadfc('0x2b')]);}_0x254bc1[_0xadfc('0x41')]=qs[_0xadfc('0x42')](_0x299b80[_0xadfc('0x39')][_0xadfc('0x42')]);_0x254bc1[_0xadfc('0x43')]=qs[_0xadfc('0x44')](_['pick'](_0x299b80[_0xadfc('0x39')],_0x34aed1[_0xadfc('0x44')]),_0x25a406);if(_0x299b80[_0xadfc('0x39')][_0xadfc('0x45')]){_0x254bc1[_0xadfc('0x43')]=_[_0xadfc('0x46')](_0x254bc1[_0xadfc('0x43')],{'$or':_['map'](_0x25a406,function(_0xbe8ff2){if(_0xbe8ff2[_0xadfc('0x37')]!==_0xadfc('0x47')){var _0x51a813={};_0x51a813[_0xbe8ff2[_0xadfc('0x32')]]={'$like':'%'+_0x299b80[_0xadfc('0x39')][_0xadfc('0x45')]+'%'};return _0x51a813;}})});}_0x254bc1=_[_0xadfc('0x46')]({},_0x254bc1,_0x299b80[_0xadfc('0x48')]);var _0x5754e2={'where':_0x254bc1[_0xadfc('0x43')]};return db[_0xadfc('0x34')][_0xadfc('0x2a')](_0x5754e2)['then'](function(_0x4e689a){_0x559a4f[_0xadfc('0x2a')]=_0x4e689a;if(_0x299b80[_0xadfc('0x39')][_0xadfc('0x49')]){_0x254bc1[_0xadfc('0x4a')]=[{'all':!![]}];}return db[_0xadfc('0x34')][_0xadfc('0x4b')](_0x254bc1);})[_0xadfc('0x1e')](function(_0x246db5){_0x559a4f[_0xadfc('0x4c')]=_0x246db5;return _0x559a4f;})['then'](respondWithFilteredResult(_0x131ec5,_0x254bc1))[_0xadfc('0x4d')](handleError(_0x131ec5,null));};exports[_0xadfc('0x4e')]=function(_0x9da2fd,_0x583109){var _0x1bdd0e={'raw':!![],'where':{'id':_0x9da2fd[_0xadfc('0x4f')]['id']}},_0x47ca22={};_0x47ca22[_0xadfc('0x38')]=_[_0xadfc('0x3a')](db[_0xadfc('0x34')][_0xadfc('0x35')]);_0x47ca22[_0xadfc('0x39')]=_[_0xadfc('0x3a')](_0x9da2fd[_0xadfc('0x39')]);_0x47ca22['filters']=_[_0xadfc('0x50')](_0x47ca22[_0xadfc('0x38')],_0x47ca22['query']);_0x1bdd0e[_0xadfc('0x3c')]=_[_0xadfc('0x50')](_0x47ca22['model'],qs[_0xadfc('0x3b')](_0x9da2fd['query'][_0xadfc('0x3b')]));_0x1bdd0e['attributes']=_0x1bdd0e[_0xadfc('0x3c')][_0xadfc('0x3d')]?_0x1bdd0e[_0xadfc('0x3c')]:_0x47ca22[_0xadfc('0x38')];if(_0x9da2fd['query'][_0xadfc('0x49')]){_0x1bdd0e[_0xadfc('0x4a')]=[{'all':!![]}];}_0x1bdd0e=_['merge']({},_0x1bdd0e,_0x9da2fd[_0xadfc('0x48')]);return db[_0xadfc('0x34')][_0xadfc('0x51')](_0x1bdd0e)[_0xadfc('0x1e')](handleEntityNotFound(_0x583109,null))[_0xadfc('0x1e')](respondWithResult(_0x583109,null))['catch'](handleError(_0x583109,null));};exports[_0xadfc('0x52')]=function(_0xb3e5c0,_0x499167){return db['WhatsappMessage']['create'](_0xb3e5c0[_0xadfc('0x53')],{})['then'](respondWithResult(_0x499167,0xc9))[_0xadfc('0x4d')](handleError(_0x499167,null));};exports[_0xadfc('0x30')]=function(_0x517f13,_0x892f01){if(_0x517f13[_0xadfc('0x53')]['id']){delete _0x517f13['body']['id'];}return db['WhatsappMessage'][_0xadfc('0x51')]({'where':{'id':_0x517f13[_0xadfc('0x4f')]['id']}})[_0xadfc('0x1e')](handleEntityNotFound(_0x892f01,null))[_0xadfc('0x1e')](saveUpdates(_0x517f13[_0xadfc('0x53')],null))['then'](respondWithResult(_0x892f01,null))[_0xadfc('0x4d')](handleError(_0x892f01,null));};exports['destroy']=function(_0x2f2e61,_0x1ecedf){return db[_0xadfc('0x34')]['find']({'where':{'id':_0x2f2e61['params']['id']}})['then'](handleEntityNotFound(_0x1ecedf,null))['then'](removeEntity(_0x1ecedf,null))[_0xadfc('0x4d')](handleError(_0x1ecedf,null));};exports[_0xadfc('0x54')]=function(_0x3bf0b8,_0x9d0950){return db[_0xadfc('0x34')]['describe']()[_0xadfc('0x1e')](respondWithResult(_0x9d0950,null))['catch'](handleError(_0x9d0950,null));};var interaction_log=require('../../config/logger')(_0xadfc('0x55'));exports[_0xadfc('0x56')]=function(_0x4a84f6,_0x22a654,_0x4201d3){var _0x18c45a={'agent':{},'channel':_0xadfc('0x57')};if(_0x4a84f6[_0xadfc('0x53')]['id']){delete _0x4a84f6[_0xadfc('0x53')]['id'];}_0x4a84f6['body'][_0xadfc('0x58')]=!![];_0x4a84f6[_0xadfc('0x53')][_0xadfc('0x59')]=moment()[_0xadfc('0x5a')](_0xadfc('0x5b'));_0x4a84f6[_0xadfc('0x53')][_0xadfc('0x5c')]=_0x4a84f6[_0xadfc('0x53')][_0xadfc('0x5c')]||_0x4a84f6[_0xadfc('0x5d')]['id'];_0x18c45a[_0xadfc('0x5e')]['id']=_0x4a84f6[_0xadfc('0x53')][_0xadfc('0x5c')];return db[_0xadfc('0x34')]['find']({'where':{'id':_0x4a84f6[_0xadfc('0x4f')]['id'],'UserId':null}})[_0xadfc('0x1e')](handleEntityNotFound(_0x22a654,null))[_0xadfc('0x1e')](saveUpdates(_0x4a84f6[_0xadfc('0x53')],null))[_0xadfc('0x1e')](function(_0x5bd2c6){if(_0x5bd2c6){_0x18c45a[_0xadfc('0x23')]=_0x5bd2c6[_0xadfc('0x5f')]({'plain':!![]});return db[_0xadfc('0x60')][_0xadfc('0x51')]({'where':{'id':_0x5bd2c6[_0xadfc('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x22a654,null))[_0xadfc('0x1e')](function(_0x32788a){if(_0x32788a){return _0x32788a[_0xadfc('0x30')]({'UserId':_0x4a84f6['body'][_0xadfc('0x5c')],'read1stAt':_[_0xadfc('0x62')](_0x32788a[_0xadfc('0x63')])?moment()['format'](_0xadfc('0x5b')):undefined});}return null;})[_0xadfc('0x1e')](function(_0x57e5f8){if(_0x57e5f8){_0x18c45a[_0xadfc('0x64')]=_0x57e5f8[_0xadfc('0x5f')]({'plain':!![]});interaction_log[_0xadfc('0x24')](_0xadfc('0x65'),_0x4a84f6['user']['id'],_0x4a84f6[_0xadfc('0x5d')][_0xadfc('0x32')],_0x4a84f6[_0xadfc('0x5d')][_0xadfc('0x66')],_0x18c45a[_0xadfc('0x64')]['id'],_0x4a84f6['body']?JSON[_0xadfc('0x67')](_0x4a84f6['body']):_0xadfc('0x68'));return respondWithRpcPromise(_0xadfc('0x69'),_0xadfc('0x6a'),_0x18c45a);}return null;})[_0xadfc('0x1e')](function(_0x1e5eea){var _0x3ac35c=_0xadfc('0x6b')+_0x1e5eea[_0xadfc('0x23')][_0xadfc('0x6c')];return db[_0xadfc('0x6d')]['query'](_0x3ac35c,{'type':db['Sequelize']['QueryTypes'][_0xadfc('0x6e')],'raw':!![]})[_0xadfc('0x1e')](function(_0x328f32){return _0x328f32;});})[_0xadfc('0x1e')](function(_0x5b180d){if(_0x5b180d){_0x18c45a[_0xadfc('0x23')][_0xadfc('0x6f')]=_0x5b180d[0x0];if(!_0x4a84f6[_0xadfc('0x53')][_0xadfc('0x5c')])return;return db[_0xadfc('0x70')][_0xadfc('0x51')]({'where':{'id':_0x4a84f6[_0xadfc('0x53')][_0xadfc('0x5c')],'role':_0xadfc('0x5e')},'attributes':['id','name',_0xadfc('0x71'),'email',_0xadfc('0x72')],'raw':!![]});}return null;})['then'](function(_0x2b0f6e){if(!_0x2b0f6e)return null;_0x18c45a[_0xadfc('0x23')][_0xadfc('0x5e')]=_0x2b0f6e;return _0x18c45a;})['then'](function(_0x5eff0c){if(_0x5eff0c){if(_0x4a84f6[_0xadfc('0x53')][_0xadfc('0x73')]){_0x18c45a['message']['interface']=util[_0xadfc('0x5a')](_0xadfc('0x74'),_0x4a84f6[_0xadfc('0x5d')][_0xadfc('0x32')]);_0x18c45a['message'][_0xadfc('0x75')]=_0x18c45a[_0xadfc('0x75')];_0x18c45a[_0xadfc('0x23')]['motionChannel']=_0x18c45a[_0xadfc('0x75')];_0x18c45a[_0xadfc('0x23')][_0xadfc('0x76')]=_0xadfc('0x56');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xadfc('0x77'),'message':_0x18c45a[_0xadfc('0x23')]},client9002)[_0xadfc('0x1e')](function(){return _0x18c45a;});}return _0x18c45a;}return null;})[_0xadfc('0x1e')](respondWithResult(_0x22a654,null))['catch'](handleError(_0x22a654,null));};var interaction_log=require(_0xadfc('0x13'))('whatsapp-interactions');exports['reject']=function(_0x46eb24,_0x59a30d,_0x5390f3){var _0x4d1055={'agent':{},'channel':_0xadfc('0x57')};if(_0x46eb24[_0xadfc('0x53')]['id']){delete _0x46eb24['body']['id'];}_0x46eb24[_0xadfc('0x53')][_0xadfc('0x5c')]=_0x46eb24[_0xadfc('0x53')][_0xadfc('0x5c')]||_0x46eb24[_0xadfc('0x5d')]['id'];_0x4d1055[_0xadfc('0x5e')]['id']=_0x46eb24[_0xadfc('0x53')][_0xadfc('0x5c')];return db[_0xadfc('0x34')][_0xadfc('0x51')]({'where':{'id':_0x46eb24[_0xadfc('0x4f')]['id'],'UserId':null}})[_0xadfc('0x1e')](handleEntityNotFound(_0x59a30d,null))[_0xadfc('0x1e')](function(_0x471cd5){if(_0x471cd5){_0x4d1055[_0xadfc('0x23')]=_0x471cd5['get']({'plain':!![]});return db[_0xadfc('0x60')][_0xadfc('0x51')]({'where':{'id':_0x471cd5[_0xadfc('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x59a30d,null))['then'](function(_0x307f2a){if(_0x307f2a){_0x4d1055[_0xadfc('0x64')]=_0x307f2a[_0xadfc('0x5f')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46eb24['user']['id'],_0x46eb24[_0xadfc('0x5d')][_0xadfc('0x32')],_0x46eb24[_0xadfc('0x5d')]['role'],_0x4d1055[_0xadfc('0x64')]['id'],_0x46eb24[_0xadfc('0x53')]?JSON[_0xadfc('0x67')](_0x46eb24[_0xadfc('0x53')]):'null');return respondWithRpcPromise(_0xadfc('0x78'),'rejectMessage',_0x4d1055);}return null;})['then'](function(_0x4c6dfd){var _0x55c017='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4c6dfd['message']['ContactId'];return db[_0xadfc('0x6d')][_0xadfc('0x39')](_0x55c017,{'type':db[_0xadfc('0x79')][_0xadfc('0x7a')][_0xadfc('0x6e')],'raw':!![]})['then'](function(_0x49a65c){return _0x49a65c;});})['then'](function(_0xeaa5f7){if(_0xeaa5f7){_0x4d1055['message'][_0xadfc('0x6f')]=_0xeaa5f7[0x0];if(!_0x46eb24[_0xadfc('0x53')]['UserId'])return;return db['User'][_0xadfc('0x51')]({'where':{'id':_0x46eb24[_0xadfc('0x53')][_0xadfc('0x5c')],'role':_0xadfc('0x5e')},'attributes':['id',_0xadfc('0x32'),_0xadfc('0x71'),_0xadfc('0x7b'),'internal'],'raw':!![]});}return null;})[_0xadfc('0x1e')](function(_0x2b12ec){if(!_0x2b12ec)return null;_0x4d1055[_0xadfc('0x23')][_0xadfc('0x5e')]=_0x2b12ec;return _0x4d1055;})[_0xadfc('0x1e')](function(_0x7133d8){if(_0x7133d8){_0x7133d8[_0xadfc('0x23')][_0xadfc('0x7c')]=util[_0xadfc('0x5a')](_0xadfc('0x74'),_0x46eb24[_0xadfc('0x5d')]['name']);_0x7133d8[_0xadfc('0x23')]['channel']=_0x4d1055[_0xadfc('0x75')];_0x7133d8[_0xadfc('0x23')][_0xadfc('0x7d')]=_0x4d1055['channel'];_0x7133d8[_0xadfc('0x23')][_0xadfc('0x76')]=_0xadfc('0x2f');respondWithRpcPromise(_0xadfc('0x7e'),'EventManager',{'event':_0xadfc('0x7f'),'message':_0x7133d8[_0xadfc('0x23')]},client9002);return _0x4d1055;}return null;})['then'](respondWithResult(_0x59a30d,null))[_0xadfc('0x4d')](handleError(_0x59a30d,null));};exports[_0xadfc('0x27')]=function(_0x398568,_0xc31969,_0x4c795d){if(_0x398568[_0xadfc('0x53')]['id']){delete _0x398568['body']['id'];}var _0x30affb;return db[_0xadfc('0x34')][_0xadfc('0x51')]({'where':{'id':_0x398568[_0xadfc('0x4f')]['id']}})[_0xadfc('0x1e')](handleEntityNotFound(_0xc31969,null))[_0xadfc('0x1e')](function(_0x262a39){if(_0x262a39){_0x30affb=_0x262a39;return db[_0xadfc('0x80')][_0xadfc('0x51')]({'where':{'id':_0x262a39[_0xadfc('0x81')]}});}})[_0xadfc('0x1e')](handleEntityNotFound(_0xc31969,null))[_0xadfc('0x1e')](function(_0x58ae82){if(_0x58ae82){logger[_0xadfc('0x20')](_0xadfc('0x82'),_0xadfc('0x27'),_0xadfc('0x83'),_0x58ae82[_0xadfc('0x37')],util[_0xadfc('0x84')](_0x398568[_0xadfc('0x53')],{'showHidden':![],'depth':null}));switch(_0x58ae82['type']){case _0xadfc('0x85'):if(_0x398568['body'][_0xadfc('0x86')]&&_0x398568[_0xadfc('0x53')][_0xadfc('0x86')]===_0x30affb['messageId']&&_0x398568['body'][_0xadfc('0x87')]&&_0x398568[_0xadfc('0x53')]['MessageStatus']===_0xadfc('0x58')){return _0x30affb['update']({'read':!![]});}else{logger['error'](_0xadfc('0x88'),'status','twilio',util[_0xadfc('0x84')](_0x398568['body'],{'showHidden':![],'depth':null}));}break;}return _0x30affb;}})[_0xadfc('0x1e')](respondWithResult(_0xc31969,null))[_0xadfc('0x4d')](handleError(_0xc31969,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index fbae8d4..3b4c6b3 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 _0x087b=['hook','exports','events','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x087b,0x11a));var _0xb087=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x087b[_0x500419];return _0x241c1a;};'use strict';var EventEmitter=require(_0xb087('0x0'));var WhatsappMessage=require(_0xb087('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb087('0x2'),'afterUpdate':'update','afterDestroy':_0xb087('0x3')};function emitEvent(_0x2020b7){return function(_0x1d3299,_0xf1cf84,_0x183efd){WhatsappMessageEvents[_0xb087('0x4')](_0x2020b7+':'+_0x1d3299['id'],_0x1d3299);WhatsappMessageEvents[_0xb087('0x4')](_0x2020b7,_0x1d3299);_0x183efd(null);};}for(var e in events){if(events[_0xb087('0x5')](e)){var event=events[e];WhatsappMessage[_0xb087('0x6')](e,emitEvent(event));}}module[_0xb087('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x80df=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update'];(function(_0x131fe9,_0x53ca07){var _0x55f3d7=function(_0x4a02d5){while(--_0x4a02d5){_0x131fe9['push'](_0x131fe9['shift']());}};_0x55f3d7(++_0x53ca07);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xf80d('0x0'));var WhatsappMessage=require(_0xf80d('0x1'))['db'][_0xf80d('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf80d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf80d('0x4'),'afterDestroy':_0xf80d('0x5')};function emitEvent(_0xfd239e){return function(_0x21365c,_0x15d302,_0xa6b1bb){WhatsappMessageEvents[_0xf80d('0x6')](_0xfd239e+':'+_0x21365c['id'],_0x21365c);WhatsappMessageEvents[_0xf80d('0x6')](_0xfd239e,_0x21365c);_0xa6b1bb(null);};}for(var e in events){if(events[_0xf80d('0x7')](e)){var event=events[e];WhatsappMessage[_0xf80d('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index fb77169..0a358f8 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 _0x0605=['finally','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','define','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','update','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','then','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','accountSid','baseUrl','/whatsapp/v1/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s'];(function(_0x5e93be,_0xf4e717){var _0x44bf05=function(_0x7fb1a2){while(--_0x7fb1a2){_0x5e93be['push'](_0x5e93be['shift']());}};_0x44bf05(++_0xf4e717);}(_0x0605,0x1c2));var _0x5060=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x0605[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x5060('0x0'));var util=require(_0x5060('0x1'));var logger=require('../../config/logger')(_0x5060('0x2'));var moment=require(_0x5060('0x3'));var BPromise=require(_0x5060('0x4'));var rp=require(_0x5060('0x5'));var fetch=require(_0x5060('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5060('0x7'));var config=require(_0x5060('0x8'));var attributes=require(_0x5060('0x9'));module['exports']=function(_0x27aae3,_0x5e752c){return _0x27aae3[_0x5060('0xa')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0x5060('0xb')],'type':_0x5060('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2edd61,_0x3ef9de,_0x12412f){var _0x5097d9=_0x27aae3[_0x5060('0xd')];var _0x1a3285=_0x2edd61[_0x5060('0xe')]({'plain':!![]});if(_0x1a3285[_0x5060('0xf')][_0x5060('0x10')]()==='in'||_0x1a3285[_0x5060('0xf')][_0x5060('0x10')]()===_0x5060('0x11')&&!_0x1a3285[_0x5060('0x12')]&&!_[_0x5060('0x13')](_0x1a3285[_0x5060('0x14')])){_0x5097d9[_0x5060('0x15')][_0x5060('0x16')]({'where':{'id':_0x1a3285['WhatsappInteractionId']}})['then'](function(_0x3605e0){if(_0x3605e0){_0x3605e0[_0x5060('0x17')]({'lastMsgAt':_0x1a3285[_0x5060('0x18')],'lastMsgDirection':_0x1a3285[_0x5060('0xf')][_0x5060('0x10')]()});}})['catch'](function(_0x33bd5b){console[_0x5060('0x19')](_0x33bd5b);});}if(_0x1a3285[_0x5060('0xf')]===_0x5060('0x11')&&!_0x1a3285[_0x5060('0x12')]){var _0x1f25f5;_0x5097d9[_0x5060('0x1a')][_0x5060('0x1b')]({'where':{'id':_0x1a3285[_0x5060('0x1c')]},'raw':!![]})['then'](function(_0x16925b){_0x1f25f5=_0x16925b;if(_0x1f25f5&&_0x1f25f5['type']){switch(_0x1f25f5[_0x5060('0x1d')]){case _0x5060('0x1e'):var _0x191879=require(_0x5060('0x1e'));if(_0x1f25f5['accountSid']&&_0x1f25f5[_0x5060('0x1f')]&&_0x1f25f5[_0x5060('0x20')]){var _0x46f00a=new _0x191879(_0x1f25f5['accountSid'],_0x1f25f5[_0x5060('0x1f')]);_0x46f00a['messages']['create']({'body':_0x1a3285[_0x5060('0xb')],'to':_0x5060('0x21')+_0x1a3285['phone'],'from':'whatsapp:'+_0x1f25f5[_0x5060('0x20')],'statusCallback':_0x1f25f5[_0x5060('0x22')]+_0x5060('0x23')+_0x1a3285['id']+_0x5060('0x24')+_0x1f25f5[_0x5060('0x25')]})[_0x5060('0x26')](function(_0x48a1aa){if(_0x48a1aa['sid']){return _0x2edd61[_0x5060('0x17')]({'messageId':_0x48a1aa['sid']});}})[_0x5060('0x27')](function(_0x5b4852){logger[_0x5060('0x19')](_0x5060('0x28'),_0x5060('0x29'),_0x5060('0x1e'),util[_0x5060('0x2a')](_0x5b4852,{'showHidden':![],'depth':null}));});}else{logger[_0x5060('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5060('0x29'),_0x5060('0x1e'),_0x5060('0x2b'));}break;case'sinch':var _0x471aee=_0x1f25f5[_0x5060('0x2c')];var _0x4996ce=_0x1f25f5[_0x5060('0x1f')];var _0x8a094a=_0x1f25f5[_0x5060('0x2d')]+_0x5060('0x2e')+_0x471aee+'/messages/';var _0x342845={'to':[_0x1a3285['phone']],'message':{'type':_0x5060('0x2f'),'text':_0x1a3285[_0x5060('0xb')]}};var _0x435529={'method':_0x5060('0x30'),'uri':_0x8a094a,'headers':{'Authorization':'Bearer\x20'+_0x4996ce,'Content-Type':_0x5060('0x31')},'body':_0x342845,'json':!![]};rp(_0x435529)[_0x5060('0x26')](function(_0x2005a5){if(_0x2005a5[_0x5060('0x32')][0x0]['message_id']){return _0x2edd61['update']({'messageId':_0x2005a5['statuses'][0x0][_0x5060('0x33')]});}})[_0x5060('0x27')](function(_0x2be9c2){logger[_0x5060('0x34')](_0x5060('0x35'),_0x2be9c2);});break;}}})[_0x5060('0x36')](function(){_0x12412f();});}else{_0x12412f();}}},'charset':'utf8mb4','collate':_0x5060('0x37')});}; \ No newline at end of file +var _0x221a=['WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','message_id','statuses','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','isNil','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','secret'];(function(_0x4a5b3a,_0x35d9b0){var _0x23fa60=function(_0x22d631){while(--_0x22d631){_0x4a5b3a['push'](_0x4a5b3a['shift']());}};_0x23fa60(++_0x35d9b0);}(_0x221a,0xd9));var _0xa221=function(_0x410ef9,_0x14b2a0){_0x410ef9=_0x410ef9-0x0;var _0x1e6cdd=_0x221a[_0x410ef9];return _0x1e6cdd;};'use strict';var _=require(_0xa221('0x0'));var util=require(_0xa221('0x1'));var logger=require(_0xa221('0x2'))(_0xa221('0x3'));var moment=require(_0xa221('0x4'));var BPromise=require(_0xa221('0x5'));var rp=require(_0xa221('0x6'));var fetch=require(_0xa221('0x7'));var fs=require('fs');var path=require(_0xa221('0x8'));var rimraf=require(_0xa221('0x9'));var config=require(_0xa221('0xa'));var attributes=require(_0xa221('0xb'));module['exports']=function(_0x7459e2,_0x233aff){return _0x7459e2['define']('WhatsappMessage',attributes,{'tableName':_0xa221('0xc'),'paranoid':![],'indexes':[{'name':_0xa221('0xd'),'fields':[_0xa221('0xd')]},{'name':_0xa221('0xe'),'fields':[_0xa221('0xf')],'type':_0xa221('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a1bd7,_0x151c41,_0x33bec7){var _0x27a8c2=_0x7459e2[_0xa221('0x11')];var _0x3ba58e=_0x4a1bd7[_0xa221('0x12')]({'plain':!![]});if(_0x3ba58e['direction'][_0xa221('0x13')]()==='in'||_0x3ba58e[_0xa221('0x14')][_0xa221('0x13')]()==='out'&&!_0x3ba58e['secret']&&!_[_0xa221('0x15')](_0x3ba58e['UserId'])){_0x27a8c2['WhatsappInteraction'][_0xa221('0x16')]({'where':{'id':_0x3ba58e[_0xa221('0x17')]}})[_0xa221('0x18')](function(_0x21f591){if(_0x21f591){_0x21f591[_0xa221('0x19')]({'lastMsgAt':_0x3ba58e[_0xa221('0x1a')],'lastMsgDirection':_0x3ba58e[_0xa221('0x14')]['toLowerCase']()});}})[_0xa221('0x1b')](function(_0x17d6be){console[_0xa221('0x1c')](_0x17d6be);});}if(_0x3ba58e['direction']===_0xa221('0x1d')&&!_0x3ba58e[_0xa221('0x1e')]){var _0x39d68e;_0x27a8c2[_0xa221('0x1f')][_0xa221('0x20')]({'where':{'id':_0x3ba58e[_0xa221('0x21')]},'raw':!![]})[_0xa221('0x18')](function(_0x5e0d1c){_0x39d68e=_0x5e0d1c;if(_0x39d68e&&_0x39d68e[_0xa221('0x22')]){switch(_0x39d68e['type']){case _0xa221('0x23'):var _0x12309f=require('twilio');if(_0x39d68e[_0xa221('0x24')]&&_0x39d68e[_0xa221('0x25')]&&_0x39d68e[_0xa221('0x26')]){var _0x3d161e=new _0x12309f(_0x39d68e[_0xa221('0x24')],_0x39d68e[_0xa221('0x25')]);_0x3d161e[_0xa221('0x27')][_0xa221('0x28')]({'body':_0x3ba58e[_0xa221('0xf')],'to':'whatsapp:'+_0x3ba58e[_0xa221('0x26')],'from':_0xa221('0x29')+_0x39d68e['phone'],'statusCallback':_0x39d68e[_0xa221('0x2a')]+'/api/whatsapp/messages/'+_0x3ba58e['id']+_0xa221('0x2b')+_0x39d68e[_0xa221('0x2c')]})[_0xa221('0x18')](function(_0x4dd919){if(_0x4dd919['sid']){return _0x4a1bd7[_0xa221('0x19')]({'messageId':_0x4dd919[_0xa221('0x2d')]});}})[_0xa221('0x1b')](function(_0x36ad1c){logger[_0xa221('0x1c')](_0xa221('0x2e'),'afterCreate',_0xa221('0x23'),util[_0xa221('0x2f')](_0x36ad1c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa221('0x2e'),_0xa221('0x30'),_0xa221('0x23'),_0xa221('0x31'));}break;case _0xa221('0x32'):var _0x3f7455=_0x39d68e[_0xa221('0x24')];var _0x2ef081=_0x39d68e['authToken'];var _0x255855=_0x39d68e['baseUrl']+_0xa221('0x33')+_0x3f7455+_0xa221('0x34');var _0x3f304e={'to':[_0x3ba58e['phone']],'message':{'type':_0xa221('0x35'),'text':_0x3ba58e[_0xa221('0xf')]}};var _0x3ec03f={'method':_0xa221('0x36'),'uri':_0x255855,'headers':{'Authorization':_0xa221('0x37')+_0x2ef081,'Content-Type':'application/json'},'body':_0x3f304e,'json':!![]};rp(_0x3ec03f)[_0xa221('0x18')](function(_0x20b561){if(_0x20b561['statuses'][0x0][_0xa221('0x38')]){return _0x4a1bd7['update']({'messageId':_0x20b561[_0xa221('0x39')][0x0][_0xa221('0x38')]});}})[_0xa221('0x1b')](function(_0x31470e){logger[_0xa221('0x3a')]('WhatsappMessage,\x20%s',_0x31470e);});break;}}})[_0xa221('0x3b')](function(){_0x33bec7();});}else{_0x33bec7();}}},'charset':_0xa221('0x3c'),'collate':_0xa221('0x3d')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index bcd5f49..0b5e683 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 _0x0c95=['http','defaults','redis','localhost','./whatsappMessage.socket','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','bluebird','randomstring','../../config/utils','rpc','jayson/promise'];(function(_0x16e82d,_0x1c05fd){var _0x293da2=function(_0xaa9bcd){while(--_0xaa9bcd){_0x16e82d['push'](_0x16e82d['shift']());}};_0x293da2(++_0x1c05fd);}(_0x0c95,0x1da));var _0x50c9=function(_0x1ae975,_0x70b40e){_0x1ae975=_0x1ae975-0x0;var _0x2576ca=_0x0c95[_0x1ae975];return _0x2576ca;};'use strict';var _=require(_0x50c9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x50c9('0x1'));var rs=require(_0x50c9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x50c9('0x3'));var logger=require('../../config/logger')(_0x50c9('0x4'));var config=require('../../config/environment');var jayson=require(_0x50c9('0x5'));var client=jayson['client'][_0x50c9('0x6')]({'port':0x232a});config['redis']=_[_0x50c9('0x7')](config[_0x50c9('0x8')],{'host':_0x50c9('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x50c9('0xa'))['register'](socket);function respondWithRpcPromise(_0xd3e9b6,_0x442e4c,_0x2c7ae2){return new BPromise(function(_0x3c664a,_0x292a03){return client[_0x50c9('0xb')](_0xd3e9b6,_0x2c7ae2)[_0x50c9('0xc')](function(_0x5d2613){logger[_0x50c9('0xd')]('WhatsappMessage,\x20%s,\x20%s',_0x442e4c,_0x50c9('0xe'));logger[_0x50c9('0xf')](_0x50c9('0x10'),_0x442e4c,_0x50c9('0xe'),JSON[_0x50c9('0x11')](_0x5d2613));if(_0x5d2613['error']){if(_0x5d2613[_0x50c9('0x12')][_0x50c9('0x13')]===0x1f4){logger['error'](_0x50c9('0x14'),_0x442e4c,_0x5d2613[_0x50c9('0x12')][_0x50c9('0x15')]);return _0x292a03(_0x5d2613[_0x50c9('0x12')]['message']);}logger[_0x50c9('0x12')](_0x50c9('0x14'),_0x442e4c,_0x5d2613['error'][_0x50c9('0x15')]);return _0x3c664a(_0x5d2613[_0x50c9('0x12')][_0x50c9('0x15')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x442e4c,_0x50c9('0xe'));_0x3c664a(_0x5d2613[_0x50c9('0x16')]['message']);}})[_0x50c9('0x17')](function(_0x1f4d9b){logger[_0x50c9('0x12')](_0x50c9('0x14'),_0x442e4c,_0x1f4d9b);_0x292a03(_0x1f4d9b);});});}exports[_0x50c9('0x18')]=function(_0x3af853){var _0x1824af=this;return new Promise(function(_0x2e332a,_0x5a671d){return db[_0x50c9('0x19')][_0x50c9('0x1a')](_0x3af853[_0x50c9('0x1b')],{'raw':_0x3af853[_0x50c9('0x1c')]?_0x3af853[_0x50c9('0x1c')][_0x50c9('0x1d')]===undefined?!![]:![]:!![]})[_0x50c9('0xc')](function(_0x492c9b){logger[_0x50c9('0xd')](_0x50c9('0x18'),_0x3af853);logger[_0x50c9('0xf')](_0x50c9('0x18'),_0x3af853,JSON['stringify'](_0x492c9b));_0x2e332a(_0x492c9b);})['catch'](function(_0x2ed31b){logger['error'](_0x50c9('0x18'),_0x2ed31b['message'],_0x3af853);_0x5a671d(_0x1824af[_0x50c9('0x12')](0x1f4,_0x2ed31b[_0x50c9('0x15')]));});});}; \ No newline at end of file +var _0xb0c4=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','WhatsappMessage','create','options','CreateWhatsappMessage','stringify'];(function(_0x399d26,_0x590562){var _0x10da47=function(_0x5edf5b){while(--_0x5edf5b){_0x399d26['push'](_0x399d26['shift']());}};_0x10da47(++_0x590562);}(_0xb0c4,0x96));var _0x4b0c=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0xb0c4[_0x2ff4bd];return _0x28edc6;};'use strict';var _=require(_0x4b0c('0x0'));var util=require('util');var moment=require(_0x4b0c('0x1'));var BPromise=require(_0x4b0c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b0c('0x3'));var db=require(_0x4b0c('0x4'))['db'];var utils=require(_0x4b0c('0x5'));var logger=require(_0x4b0c('0x6'))(_0x4b0c('0x7'));var config=require('../../config/environment');var jayson=require(_0x4b0c('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x4b0c('0x9')]=_[_0x4b0c('0xa')](config[_0x4b0c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b0c('0xb'))(new Redis(config[_0x4b0c('0x9')]));require(_0x4b0c('0xc'))[_0x4b0c('0xd')](socket);function respondWithRpcPromise(_0x17083a,_0x2aea3f,_0x52227e){return new BPromise(function(_0x30fd52,_0x3b8076){return client[_0x4b0c('0xe')](_0x17083a,_0x52227e)[_0x4b0c('0xf')](function(_0x4014e5){logger[_0x4b0c('0x10')](_0x4b0c('0x11'),_0x2aea3f,_0x4b0c('0x12'));logger[_0x4b0c('0x13')](_0x4b0c('0x14'),_0x2aea3f,'request\x20sent',JSON['stringify'](_0x4014e5));if(_0x4014e5[_0x4b0c('0x15')]){if(_0x4014e5[_0x4b0c('0x15')][_0x4b0c('0x16')]===0x1f4){logger['error'](_0x4b0c('0x11'),_0x2aea3f,_0x4014e5[_0x4b0c('0x15')]['message']);return _0x3b8076(_0x4014e5[_0x4b0c('0x15')][_0x4b0c('0x17')]);}logger[_0x4b0c('0x15')](_0x4b0c('0x11'),_0x2aea3f,_0x4014e5[_0x4b0c('0x15')][_0x4b0c('0x17')]);return _0x30fd52(_0x4014e5['error'][_0x4b0c('0x17')]);}else{logger[_0x4b0c('0x10')](_0x4b0c('0x11'),_0x2aea3f,_0x4b0c('0x12'));_0x30fd52(_0x4014e5['result']['message']);}})[_0x4b0c('0x18')](function(_0x4a4d40){logger['error'](_0x4b0c('0x11'),_0x2aea3f,_0x4a4d40);_0x3b8076(_0x4a4d40);});});}exports['CreateWhatsappMessage']=function(_0x24b22b){var _0x3e6273=this;return new Promise(function(_0x303293,_0xefe41){return db[_0x4b0c('0x19')][_0x4b0c('0x1a')](_0x24b22b['body'],{'raw':_0x24b22b[_0x4b0c('0x1b')]?_0x24b22b[_0x4b0c('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1520e3){logger[_0x4b0c('0x10')]('CreateWhatsappMessage',_0x24b22b);logger[_0x4b0c('0x13')](_0x4b0c('0x1c'),_0x24b22b,JSON[_0x4b0c('0x1d')](_0x1520e3));_0x303293(_0x1520e3);})[_0x4b0c('0x18')](function(_0x4c5900){logger['error'](_0x4b0c('0x1c'),_0x4c5900['message'],_0x24b22b);_0xefe41(_0x3e6273[_0x4b0c('0x15')](0x1f4,_0x4c5900['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index b5ccd46..c732287 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 _0x73bc=['register','whatsappMessage:','save','remove','emit','removeListener'];(function(_0x5e9f06,_0x3dd75c){var _0x4c9dd5=function(_0x5dc2e1){while(--_0x5dc2e1){_0x5e9f06['push'](_0x5e9f06['shift']());}};_0x4c9dd5(++_0x3dd75c);}(_0x73bc,0xb0));var _0xc73b=function(_0xec11e3,_0x56b091){_0xec11e3=_0xec11e3-0x0;var _0x42e7d5=_0x73bc[_0xec11e3];return _0x42e7d5;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xc73b('0x0'),_0xc73b('0x1'),'update'];function createListener(_0x43b3f1,_0x3c4db8){return function(_0x4c840d){_0x3c4db8[_0xc73b('0x2')](_0x43b3f1,_0x4c840d);};}function removeListener(_0x163f98,_0x1fb62e){return function(){WhatsappMessageEvents[_0xc73b('0x3')](_0x163f98,_0x1fb62e);};}exports[_0xc73b('0x4')]=function(_0x1de9d8){for(var _0x4f18c7=0x0,_0x156691=events['length'];_0x4f18c7<_0x156691;_0x4f18c7++){var _0x16661f=events[_0x4f18c7];var _0x2b0fe6=createListener(_0xc73b('0x5')+_0x16661f,_0x1de9d8);WhatsappMessageEvents['on'](_0x16661f,_0x2b0fe6);}}; \ No newline at end of file +var _0xbfc7=['save','remove','update','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events'];(function(_0x63fd1f,_0x1e7f1b){var _0x5686f0=function(_0x151eb2){while(--_0x151eb2){_0x63fd1f['push'](_0x63fd1f['shift']());}};_0x5686f0(++_0x1e7f1b);}(_0xbfc7,0x14f));var _0x7bfc=function(_0xdb50ce,_0x4db606){_0xdb50ce=_0xdb50ce-0x0;var _0x296bc2=_0xbfc7[_0xdb50ce];return _0x296bc2;};'use strict';var WhatsappMessageEvents=require(_0x7bfc('0x0'));var events=[_0x7bfc('0x1'),_0x7bfc('0x2'),_0x7bfc('0x3')];function createListener(_0x29a262,_0x217ea1){return function(_0x55bc0a){_0x217ea1[_0x7bfc('0x4')](_0x29a262,_0x55bc0a);};}function removeListener(_0x572036,_0x427f9f){return function(){WhatsappMessageEvents[_0x7bfc('0x5')](_0x572036,_0x427f9f);};}exports[_0x7bfc('0x6')]=function(_0xad5cbd){for(var _0x3f2aab=0x0,_0x278727=events['length'];_0x3f2aab<_0x278727;_0x3f2aab++){var _0x3493bd=events[_0x3f2aab];var _0x55318b=createListener(_0x7bfc('0x7')+_0x3493bd,_0xad5cbd);WhatsappMessageEvents['on'](_0x3493bd,_0x55318b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6a3414e..05799be 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 _0xd829=['getAgents','post','create','put','update','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','describe','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x4c41f6,_0x127768){var _0xe8c09f=function(_0x3701fc){while(--_0x3701fc){_0x4c41f6['push'](_0x4c41f6['shift']());}};_0xe8c09f(++_0x127768);}(_0xd829,0x167));var _0x9d82=function(_0x3c5325,_0x3f4553){_0x3c5325=_0x3c5325-0x0;var _0x5391cd=_0xd829[_0x3c5325];return _0x5391cd;};'use strict';var multer=require(_0x9d82('0x0'));var util=require(_0x9d82('0x1'));var path=require(_0x9d82('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d82('0x3'));var router=express[_0x9d82('0x4')]();var fs_extra=require(_0x9d82('0x5'));var auth=require(_0x9d82('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9d82('0x7'));var controller=require(_0x9d82('0x8'));router['get']('/',auth[_0x9d82('0x9')](),controller['index']);router['get']('/describe',auth[_0x9d82('0x9')](),controller[_0x9d82('0xa')]);router[_0x9d82('0xb')](_0x9d82('0xc'),auth['isAuthenticated'](),controller[_0x9d82('0xd')]);router[_0x9d82('0xb')](_0x9d82('0xe'),auth[_0x9d82('0x9')](),controller[_0x9d82('0xf')]);router[_0x9d82('0xb')](_0x9d82('0x10'),auth[_0x9d82('0x9')](),controller[_0x9d82('0x11')]);router['get'](_0x9d82('0x12'),auth[_0x9d82('0x9')](),controller[_0x9d82('0x13')]);router[_0x9d82('0x14')]('/',auth[_0x9d82('0x9')](),controller[_0x9d82('0x15')]);router[_0x9d82('0x14')](_0x9d82('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x9d82('0x14')](_0x9d82('0x12'),auth[_0x9d82('0x9')](),controller['addAgents']);router[_0x9d82('0x16')](_0x9d82('0xc'),auth['isAuthenticated'](),controller[_0x9d82('0x17')]);router['delete'](_0x9d82('0xc'),auth[_0x9d82('0x9')](),controller[_0x9d82('0x18')]);router['delete'](_0x9d82('0x10'),auth[_0x9d82('0x9')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x9d82('0x9')](),controller[_0x9d82('0x19')]);module[_0x9d82('0x1a')]=router; \ No newline at end of file +var _0xb495=['put','/:id','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','index','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents'];(function(_0x51412b,_0x331bb6){var _0x69032b=function(_0x195995){while(--_0x195995){_0x51412b['push'](_0x51412b['shift']());}};_0x69032b(++_0x331bb6);}(_0xb495,0xc1));var _0x5b49=function(_0xe92a5f,_0x3084b3){_0xe92a5f=_0xe92a5f-0x0;var _0x2dbbd7=_0xb495[_0xe92a5f];return _0x2dbbd7;};'use strict';var multer=require(_0x5b49('0x0'));var util=require(_0x5b49('0x1'));var path=require(_0x5b49('0x2'));var timeout=require(_0x5b49('0x3'));var express=require(_0x5b49('0x4'));var router=express[_0x5b49('0x5')]();var fs_extra=require(_0x5b49('0x6'));var auth=require(_0x5b49('0x7'));var interaction=require(_0x5b49('0x8'));var config=require('../../config/environment');var controller=require(_0x5b49('0x9'));router[_0x5b49('0xa')]('/',auth['isAuthenticated'](),controller[_0x5b49('0xb')]);router[_0x5b49('0xa')]('/describe',auth[_0x5b49('0xc')](),controller[_0x5b49('0xd')]);router[_0x5b49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5b49('0xe')]);router[_0x5b49('0xa')](_0x5b49('0xf'),auth['isAuthenticated'](),controller[_0x5b49('0x10')]);router[_0x5b49('0xa')](_0x5b49('0x11'),auth[_0x5b49('0xc')](),controller[_0x5b49('0x12')]);router[_0x5b49('0xa')](_0x5b49('0x13'),auth[_0x5b49('0xc')](),controller[_0x5b49('0x14')]);router[_0x5b49('0x15')]('/',auth[_0x5b49('0xc')](),controller[_0x5b49('0x16')]);router[_0x5b49('0x15')](_0x5b49('0x11'),auth[_0x5b49('0xc')](),controller['addTeams']);router[_0x5b49('0x15')](_0x5b49('0x13'),auth[_0x5b49('0xc')](),controller[_0x5b49('0x17')]);router[_0x5b49('0x18')](_0x5b49('0x19'),auth[_0x5b49('0xc')](),controller[_0x5b49('0x1a')]);router[_0x5b49('0x1b')](_0x5b49('0x19'),auth['isAuthenticated'](),controller[_0x5b49('0x1c')]);router[_0x5b49('0x1b')](_0x5b49('0x11'),auth[_0x5b49('0xc')](),controller['removeTeams']);router[_0x5b49('0x1b')]('/:id/users',auth[_0x5b49('0xc')](),controller[_0x5b49('0x1d')]);module[_0x5b49('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 372ef1e..b2f3214 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 _0x50c1=['ENUM','rrmemory','beepall','roundrobin','STRING','sequelize','name','INTEGER'];(function(_0x171b8e,_0x119493){var _0x46447f=function(_0x512b79){while(--_0x512b79){_0x171b8e['push'](_0x171b8e['shift']());}};_0x46447f(++_0x119493);}(_0x50c1,0x1a5));var _0x150c=function(_0x9c90d,_0x3da89e){_0x9c90d=_0x9c90d-0x0;var _0x259eb6=_0x50c1[_0x9c90d];return _0x259eb6;};'use strict';var Sequelize=require(_0x150c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x150c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x150c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x150c('0x3')](_0x150c('0x4'),_0x150c('0x5'),_0x150c('0x6'))},'description':{'type':Sequelize[_0x150c('0x7')]}}; \ No newline at end of file +var _0xffaa=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','ENUM'];(function(_0x5426f4,_0x21217c){var _0x486b18=function(_0x42fa6f){while(--_0x42fa6f){_0x5426f4['push'](_0x5426f4['shift']());}};_0x486b18(++_0x21217c);}(_0xffaa,0x130));var _0xaffa=function(_0x1ca425,_0x7198ca){_0x1ca425=_0x1ca425-0x0;var _0x74b86e=_0xffaa[_0x1ca425];return _0x74b86e;};'use strict';var Sequelize=require(_0xaffa('0x0'));module[_0xaffa('0x1')]={'name':{'type':Sequelize[_0xaffa('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaffa('0x3')](_0xaffa('0x4'),_0xaffa('0x5'),_0xaffa('0x6'))},'description':{'type':Sequelize[_0xaffa('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 6099297..a3433af 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 _0x4b7c=['nolimit','order','sort','pick','WhatsappQueueId','filter','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','filters','getTeams','ids','Agents','online','voicePause','sequelize','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','all','union','compact','value','transaction','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','emit','isArray','User','getAgents','util','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','sendStatus','end','status','offset','undefined','limit','count','set','json','UserProfileResource','destroy','then','error','stack','name','send','index','map','WhatsappQueue','fieldName','type','key','getOptions','where','include','findAll','rows','show','params','query','keys','intersection','fields','attributes','length','model','includeAll','merge','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','catch','body','describe','getMembers','UserWhatsappQueue','rawAttributes','hasOwnProperty'];(function(_0x2cbba4,_0x5e8cd2){var _0x4d26ea=function(_0x2f74e5){while(--_0x2f74e5){_0x2cbba4['push'](_0x2cbba4['shift']());}};_0x4d26ea(++_0x5e8cd2);}(_0x4b7c,0x12b));var _0xc4b7=function(_0x2a4242,_0x333864){_0x2a4242=_0x2a4242-0x0;var _0x1eba07=_0x4b7c[_0x2a4242];return _0x1eba07;};'use strict';var BPromise=require('bluebird');var util=require(_0xc4b7('0x0'));var _=require('lodash');var squel=require(_0xc4b7('0x1'));var Redis=require(_0xc4b7('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xc4b7('0x3'))(_0xc4b7('0x4'));var config=require(_0xc4b7('0x5'));var db=require(_0xc4b7('0x6'))['db'];config[_0xc4b7('0x7')]=_[_0xc4b7('0x8')](config[_0xc4b7('0x7')],{'host':_0xc4b7('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc4b7('0xa'))['register'](socket);function respondWithStatusCode(_0x1dea03,_0x24a82d){_0x24a82d=_0x24a82d||0xcc;return function(_0x1c257e){if(_0x1c257e){return _0x1dea03[_0xc4b7('0xb')](_0x24a82d);}return _0x1dea03['status'](_0x24a82d)[_0xc4b7('0xc')]();};}function respondWithResult(_0x4a23eb,_0x897ee6){_0x897ee6=_0x897ee6||0xc8;return function(_0x155cf7){if(_0x155cf7){return _0x4a23eb[_0xc4b7('0xd')](_0x897ee6)['json'](_0x155cf7);}};}function respondWithFilteredResult(_0x4695d2,_0x2b2f77){return function(_0x4cc42a){if(_0x4cc42a){var _0x4f477c=typeof _0x2b2f77[_0xc4b7('0xe')]===_0xc4b7('0xf')&&typeof _0x2b2f77[_0xc4b7('0x10')]===_0xc4b7('0xf');var _0x139f36=_0x4cc42a[_0xc4b7('0x11')];var _0x1a6363=_0x4f477c?0x0:_0x2b2f77[_0xc4b7('0xe')];var _0x53765c=_0x4f477c?_0x4cc42a[_0xc4b7('0x11')]:_0x2b2f77[_0xc4b7('0xe')]+_0x2b2f77[_0xc4b7('0x10')];var _0x570338;if(_0x53765c>=_0x139f36){_0x53765c=_0x139f36;_0x570338=0xc8;}else{_0x570338=0xce;}_0x4695d2['status'](_0x570338);return _0x4695d2[_0xc4b7('0x12')]('Content-Range',_0x1a6363+'-'+_0x53765c+'/'+_0x139f36)[_0xc4b7('0x13')](_0x4cc42a);}return null;};}function saveUpdates(_0x5f1db9){return function(_0x1ed7f7){if(_0x1ed7f7){return _0x1ed7f7['update'](_0x5f1db9)['then'](function(_0x16fed5){return _0x16fed5;});}return null;};}function removeEntity(_0x3448a7){return function(_0x489067){if(_0x489067){return _0x489067['destroy']()['then'](function(){var _0x5b306d=_0x489067['get']({'plain':!![]});var _0x282bbe='WhatsappQueues';return db[_0xc4b7('0x14')][_0xc4b7('0x15')]({'where':{'type':_0x282bbe,'resourceId':_0x5b306d['id']}})[_0xc4b7('0x16')](function(){return _0x489067;});})['then'](function(){_0x3448a7[_0xc4b7('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ec12){return function(_0x24a8cc){if(!_0x24a8cc){_0x13ec12[_0xc4b7('0xb')](0x194);}return _0x24a8cc;};}function handleError(_0x3d9bac,_0x5174f6){_0x5174f6=_0x5174f6||0x1f4;return function(_0x2a4b93){logger[_0xc4b7('0x17')](_0x2a4b93[_0xc4b7('0x18')]);if(_0x2a4b93[_0xc4b7('0x19')]){delete _0x2a4b93['name'];}_0x3d9bac[_0xc4b7('0xd')](_0x5174f6)[_0xc4b7('0x1a')](_0x2a4b93);};}exports[_0xc4b7('0x1b')]=function(_0xf56e05,_0x391511){var _0x14ceb2={};var _0x52104a={'count':0x0,'rows':[]};var _0x185a33=_[_0xc4b7('0x1c')](db[_0xc4b7('0x1d')]['rawAttributes'],function(_0x52fae7){return{'name':_0x52fae7[_0xc4b7('0x1e')],'type':_0x52fae7[_0xc4b7('0x1f')][_0xc4b7('0x20')]};});_0x14ceb2=qs[_0xc4b7('0x21')](_0x185a33,_0xf56e05);var _0x15ac0d={'where':_0x14ceb2[_0xc4b7('0x22')]};return db[_0xc4b7('0x1d')][_0xc4b7('0x11')](_0x15ac0d)[_0xc4b7('0x16')](function(_0x1a26ff){_0x52104a[_0xc4b7('0x11')]=_0x1a26ff;_0x14ceb2[_0xc4b7('0x23')]=qs[_0xc4b7('0x23')](_0xf56e05['query']);return db['WhatsappQueue'][_0xc4b7('0x24')](_0x14ceb2);})['then'](function(_0x38350d){_0x52104a[_0xc4b7('0x25')]=_0x38350d;return _0x52104a;})[_0xc4b7('0x16')](respondWithFilteredResult(_0x391511,_0x14ceb2))['catch'](handleError(_0x391511,null));};exports[_0xc4b7('0x26')]=function(_0x468d2a,_0x59d816){var _0x1fa81f={'raw':!![],'where':{'id':_0x468d2a[_0xc4b7('0x27')]['id']}},_0x1aac19={};_0x1aac19['model']=_['keys'](db[_0xc4b7('0x1d')]['rawAttributes']);_0x1aac19[_0xc4b7('0x28')]=_[_0xc4b7('0x29')](_0x468d2a[_0xc4b7('0x28')]);_0x1aac19['filters']=_[_0xc4b7('0x2a')](_0x1aac19['model'],_0x1aac19[_0xc4b7('0x28')]);_0x1fa81f['attributes']=_['intersection'](_0x1aac19['model'],qs[_0xc4b7('0x2b')](_0x468d2a[_0xc4b7('0x28')]['fields']));_0x1fa81f[_0xc4b7('0x2c')]=_0x1fa81f[_0xc4b7('0x2c')][_0xc4b7('0x2d')]?_0x1fa81f[_0xc4b7('0x2c')]:_0x1aac19[_0xc4b7('0x2e')];if(_0x468d2a[_0xc4b7('0x28')][_0xc4b7('0x2f')]){_0x1fa81f['include']=[{'all':!![]}];}_0x1fa81f=_[_0xc4b7('0x30')]({},_0x1fa81f,_0x468d2a[_0xc4b7('0x31')]);return db[_0xc4b7('0x1d')][_0xc4b7('0x32')](_0x1fa81f)['then'](handleEntityNotFound(_0x59d816,null))[_0xc4b7('0x16')](respondWithResult(_0x59d816,null))['catch'](handleError(_0x59d816,null));};exports[_0xc4b7('0x33')]=function(_0xf09691,_0x31bef9){return db[_0xc4b7('0x1d')]['create'](_0xf09691['body'],{})['then'](function(_0x5a75bd){var _0x1b88ec=_0xf09691['user'][_0xc4b7('0x34')]({'plain':!![]});if(!_0x1b88ec)throw new Error(_0xc4b7('0x35'));if(_0x1b88ec[_0xc4b7('0x36')]===_0xc4b7('0x37')){var _0x45cff4=_0x5a75bd[_0xc4b7('0x34')]({'plain':!![]});var _0xafeff8=_0xc4b7('0x38');return db[_0xc4b7('0x39')]['find']({'where':{'name':_0xafeff8,'userProfileId':_0x1b88ec[_0xc4b7('0x3a')]},'raw':!![]})[_0xc4b7('0x16')](function(_0x495267){if(_0x495267&&_0x495267[_0xc4b7('0x3b')]===0x0){return db[_0xc4b7('0x14')][_0xc4b7('0x33')]({'name':_0x45cff4[_0xc4b7('0x19')],'resourceId':_0x45cff4['id'],'type':_0x495267['name'],'sectionId':_0x495267['id']},{})['then'](function(){return _0x5a75bd;});}else{return _0x5a75bd;}})['catch'](function(_0x11e075){logger[_0xc4b7('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11e075);throw _0x11e075;});}return _0x5a75bd;})['then'](respondWithResult(_0x31bef9,0xc9))[_0xc4b7('0x3c')](handleError(_0x31bef9,null));};exports['update']=function(_0x1322ba,_0x12b1f7){if(_0x1322ba['body']['id']){delete _0x1322ba['body']['id'];}return db['WhatsappQueue'][_0xc4b7('0x32')]({'where':{'id':_0x1322ba[_0xc4b7('0x27')]['id']}})[_0xc4b7('0x16')](handleEntityNotFound(_0x12b1f7,null))['then'](saveUpdates(_0x1322ba[_0xc4b7('0x3d')],null))[_0xc4b7('0x16')](respondWithResult(_0x12b1f7,null))['catch'](handleError(_0x12b1f7,null));};exports[_0xc4b7('0x15')]=function(_0x3416f5,_0x76e49f){return db[_0xc4b7('0x1d')][_0xc4b7('0x32')]({'where':{'id':_0x3416f5[_0xc4b7('0x27')]['id']}})[_0xc4b7('0x16')](handleEntityNotFound(_0x76e49f,null))[_0xc4b7('0x16')](removeEntity(_0x76e49f,null))['catch'](handleError(_0x76e49f,null));};exports[_0xc4b7('0x3e')]=function(_0x1a0838,_0x47795c){return db['WhatsappQueue'][_0xc4b7('0x3e')]()[_0xc4b7('0x16')](respondWithResult(_0x47795c,null))[_0xc4b7('0x3c')](handleError(_0x47795c,null));};exports[_0xc4b7('0x3f')]=function(_0x2da72f,_0x4eaf35){var _0x276792={'raw':!![],'where':{}},_0x5c0764={},_0x3d7323;return db['WhatsappQueue']['findOne']({'where':{'id':_0x2da72f[_0xc4b7('0x27')]['id']}})[_0xc4b7('0x16')](handleEntityNotFound(_0x4eaf35,null))[_0xc4b7('0x16')](function(_0x215c33){if(_0x215c33){_0x3d7323=_0x215c33[_0xc4b7('0x34')]({'plain':!![]});_0x5c0764['model']=_['keys'](db[_0xc4b7('0x40')][_0xc4b7('0x41')]);_0x5c0764[_0xc4b7('0x28')]=_[_0xc4b7('0x29')](_0x2da72f[_0xc4b7('0x28')]);_0x5c0764['filters']=_[_0xc4b7('0x2a')](_0x5c0764['model'],_0x5c0764[_0xc4b7('0x28')]);_0x276792[_0xc4b7('0x2c')]=_[_0xc4b7('0x2a')](_0x5c0764[_0xc4b7('0x2e')],qs[_0xc4b7('0x2b')](_0x2da72f[_0xc4b7('0x28')][_0xc4b7('0x2b')]));_0x276792[_0xc4b7('0x2c')]=_0x276792['attributes'][_0xc4b7('0x2d')]?_0x276792[_0xc4b7('0x2c')]:_0x5c0764[_0xc4b7('0x2e')];if(!_0x2da72f['query'][_0xc4b7('0x42')](_0xc4b7('0x43'))){_0x276792[_0xc4b7('0x10')]=qs[_0xc4b7('0x10')](_0x2da72f[_0xc4b7('0x28')][_0xc4b7('0x10')]);_0x276792[_0xc4b7('0xe')]=qs['offset'](_0x2da72f['query'][_0xc4b7('0xe')]);}_0x276792[_0xc4b7('0x44')]=qs[_0xc4b7('0x45')](_0x2da72f[_0xc4b7('0x28')]['sort']);_0x276792['where']=qs['filters'](_[_0xc4b7('0x46')](_0x2da72f[_0xc4b7('0x28')],_0x5c0764['filters']));_0x276792[_0xc4b7('0x22')][_0xc4b7('0x47')]=_0x215c33['id'];if(_0x2da72f[_0xc4b7('0x28')][_0xc4b7('0x48')]){_0x276792[_0xc4b7('0x22')]=_[_0xc4b7('0x30')](_0x276792[_0xc4b7('0x22')],{'$or':_[_0xc4b7('0x1c')](_0x276792[_0xc4b7('0x2c')],function(_0x428034){var _0x1a8e91={};_0x1a8e91[_0x428034]={'$like':'%'+_0x2da72f[_0xc4b7('0x28')][_0xc4b7('0x48')]+'%'};return _0x1a8e91;})});}_0x276792=_['merge']({},_0x276792,_0x2da72f[_0xc4b7('0x31')]);return db[_0xc4b7('0x40')]['findAll'](_0x276792);}})[_0xc4b7('0x16')](function(_0x4b4490){if(_0x4b4490){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x4b4490,_0xc4b7('0x49')),'role':_0xc4b7('0x4a')},'attributes':['id',_0xc4b7('0x19'),'whatsappPause',_0xc4b7('0x4b'),_0xc4b7('0x4c')]});}})['then'](function(_0x38d62e){if(_0x38d62e){return{'count':_0x38d62e[_0xc4b7('0x11')],'rows':_[_0xc4b7('0x1c')](_0x38d62e['rows'],function(_0x413055){return{'membername':_0x413055[_0xc4b7('0x19')],'UserId':_0x413055['id'],'queue_name':_0x3d7323[_0xc4b7('0x19')],'WhatsappQueueId':_0x3d7323['id'],'interface':util[_0xc4b7('0x4d')](_0xc4b7('0x4e'),_0xc4b7('0x4f'),_0x413055['name']),'penalty':0x0,'paused':_0x413055['whatsappPause'],'createdAt':_0x413055[_0xc4b7('0x4c')],'updatedAt':_0x413055[_0xc4b7('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc4b7('0x16')](respondWithFilteredResult(_0x4eaf35,_0x276792))[_0xc4b7('0x3c')](handleError(_0x4eaf35,null));};exports['getTeams']=function(_0x204d9b,_0x3e878c){var _0x16bcd3={};var _0x11e4d7={};var _0x1acf28;var _0x25c15;return db[_0xc4b7('0x1d')][_0xc4b7('0x50')]({'where':{'id':_0x204d9b['params']['id']}})['then'](handleEntityNotFound(_0x3e878c,null))['then'](function(_0x1cb9cc){if(_0x1cb9cc){_0x1acf28=_0x1cb9cc;_0x11e4d7['model']=_[_0xc4b7('0x29')](db[_0xc4b7('0x51')]['rawAttributes']);_0x11e4d7[_0xc4b7('0x28')]=_['keys'](_0x204d9b[_0xc4b7('0x28')]);_0x11e4d7[_0xc4b7('0x52')]=_[_0xc4b7('0x2a')](_0x11e4d7['model'],_0x11e4d7[_0xc4b7('0x28')]);_0x16bcd3['attributes']=_['intersection'](_0x11e4d7[_0xc4b7('0x2e')],qs[_0xc4b7('0x2b')](_0x204d9b[_0xc4b7('0x28')][_0xc4b7('0x2b')]));_0x16bcd3[_0xc4b7('0x2c')]=_0x16bcd3[_0xc4b7('0x2c')][_0xc4b7('0x2d')]?_0x16bcd3[_0xc4b7('0x2c')]:_0x11e4d7[_0xc4b7('0x2e')];_0x16bcd3[_0xc4b7('0x44')]=qs[_0xc4b7('0x45')](_0x204d9b[_0xc4b7('0x28')][_0xc4b7('0x45')]);_0x16bcd3[_0xc4b7('0x22')]=qs[_0xc4b7('0x52')](_[_0xc4b7('0x46')](_0x204d9b[_0xc4b7('0x28')],_0x11e4d7[_0xc4b7('0x52')]));if(_0x204d9b[_0xc4b7('0x28')]['filter']){_0x16bcd3[_0xc4b7('0x22')]=_['merge'](_0x16bcd3[_0xc4b7('0x22')],{'$or':_['map'](_0x16bcd3[_0xc4b7('0x2c')],function(_0xb029e1){var _0x4ddd9f={};_0x4ddd9f[_0xb029e1]={'$like':'%'+_0x204d9b[_0xc4b7('0x28')]['filter']+'%'};return _0x4ddd9f;})});}_0x16bcd3=_[_0xc4b7('0x30')]({},_0x16bcd3,_0x204d9b[_0xc4b7('0x31')]);return _0x1acf28[_0xc4b7('0x53')](_0x16bcd3);}})[_0xc4b7('0x16')](function(_0xf08a2a){if(_0xf08a2a){_0x25c15=_0xf08a2a[_0xc4b7('0x2d')];if(!_0x204d9b[_0xc4b7('0x28')][_0xc4b7('0x42')](_0xc4b7('0x43'))){_0x16bcd3[_0xc4b7('0x10')]=qs['limit'](_0x204d9b[_0xc4b7('0x28')]['limit']);_0x16bcd3['offset']=qs[_0xc4b7('0xe')](_0x204d9b[_0xc4b7('0x28')][_0xc4b7('0xe')]);}return _0x1acf28[_0xc4b7('0x53')](_0x16bcd3);}})[_0xc4b7('0x16')](function(_0x22a2ad){if(_0x22a2ad){return _0x22a2ad?{'count':_0x25c15,'rows':_0x22a2ad}:null;}})[_0xc4b7('0x16')](respondWithResult(_0x3e878c,null))[_0xc4b7('0x3c')](handleError(_0x3e878c,null));};exports['addTeams']=function(_0x289a89,_0x2edcd4){var _0x47ca20=_0x289a89['body'][_0xc4b7('0x54')];return db[_0xc4b7('0x51')][_0xc4b7('0x24')]({'where':{'id':_0x47ca20},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc4b7('0x55'),'attributes':['id',_0xc4b7('0x19'),_0xc4b7('0x56'),_0xc4b7('0x57'),'interface'],'raw':!![]}]})[_0xc4b7('0x16')](function(_0x1e8eaa){if(_0x1e8eaa){var _0x5e09f0=_['flatMap'](_0x1e8eaa,function(_0x57ad0f){var _0x36490d=_0x57ad0f[_0xc4b7('0x34')]({'plain':!![]});return _0x36490d[_0xc4b7('0x55')];});return db[_0xc4b7('0x1d')][_0xc4b7('0x32')]({'where':{'id':_0x289a89[_0xc4b7('0x27')]['id']}})[_0xc4b7('0x16')](function(_0x148a0e){return db[_0xc4b7('0x58')]['transaction'](function(_0x260b1d){return _0x148a0e['addTeams'](_0x47ca20,{'transaction':_0x260b1d})[_0xc4b7('0x16')](function(){return BPromise[_0xc4b7('0x59')](_0x5e09f0,function(_0x2a2f70){return db[_0xc4b7('0x40')][_0xc4b7('0x5a')]({'where':{'UserId':_0x2a2f70['id'],'WhatsappQueueId':_0x289a89[_0xc4b7('0x27')]['id']},'transaction':_0x260b1d});});})[_0xc4b7('0x16')](function(){_0x5e09f0[_0xc4b7('0x5b')](function(_0x1c4347){socket['emit'](_0xc4b7('0x5c'),{'UserId':_0x1c4347['id'],'WhatsappQueueId':_0x148a0e['id']});});});});});}})[_0xc4b7('0x16')](respondWithStatusCode(_0x2edcd4,null))['catch'](handleError(_0x2edcd4,null));};exports[_0xc4b7('0x5d')]=function(_0x38fbd6,_0x578dde){return db['Team'][_0xc4b7('0x24')]({'where':{'id':_0x38fbd6[_0xc4b7('0x28')][_0xc4b7('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc4b7('0x16')](handleEntityNotFound(_0x578dde,null))[_0xc4b7('0x16')](function(_0x9fa774){var _0x44dc4e=_['map'](_0x9fa774,'id');var _0x115c04=[];var _0x2fa0d5=[];var _0x104b93=squel[_0xc4b7('0x5e')]();_0x104b93[_0xc4b7('0x5f')](_0xc4b7('0x60'))[_0xc4b7('0x61')]('team_has_whatsapp_queues','tq')[_0xc4b7('0x62')](_0xc4b7('0x63'),'ut',_0xc4b7('0x64'))['where'](_0xc4b7('0x65'),_0x38fbd6[_0xc4b7('0x27')]['id']);for(var _0x414651=0x0;_0x414651<_0x9fa774[_0xc4b7('0x2d')];_0x414651+=0x1){let _0x2d1226=_0x9fa774[_0x414651];for(var _0x121f7b=0x0;_0x121f7b<_0x2d1226['Agents']['length'];_0x121f7b+=0x1){let _0x296618=_0x2d1226['Agents'][_0x121f7b];var _0x5458ab=_0x104b93[_0xc4b7('0x66')]();_0x5458ab['where'](_0xc4b7('0x67'),_0x296618['id']);_0x2fa0d5[_0xc4b7('0x68')](db[_0xc4b7('0x58')][_0xc4b7('0x28')](_0x5458ab[_0xc4b7('0x69')](),{'type':db[_0xc4b7('0x58')][_0xc4b7('0x6a')]['SELECT']})[_0xc4b7('0x16')](function(_0x1d7512){if(_0x1d7512[_0xc4b7('0x2d')]===0x1){return _0x296618['id'];}else{var _0x214ea0=_['every'](_[_0xc4b7('0x1c')](_0x1d7512,'TeamId'),function(_0x1529d3){return _[_0xc4b7('0x6b')](_0x44dc4e,_0x1529d3);});if(_0x214ea0){return _0x296618['id'];}}}));}}return BPromise[_0xc4b7('0x6c')](_0x2fa0d5)[_0xc4b7('0x16')](function(_0x296830){_0x115c04=_(_0x115c04)[_0xc4b7('0x6d')](_0x296830)[_0xc4b7('0x6e')]()[_0xc4b7('0x6f')]();return db[_0xc4b7('0x1d')]['find']({'where':{'id':_0x38fbd6[_0xc4b7('0x27')]['id']}})[_0xc4b7('0x16')](function(_0x49c761){return db['sequelize'][_0xc4b7('0x70')](function(_0x148d3a){return _0x49c761['removeTeams'](_0x38fbd6[_0xc4b7('0x28')]['ids'],{'transaction':_0x148d3a})[_0xc4b7('0x16')](function(){if(!_['isEmpty'](_0x115c04)){return _0x49c761[_0xc4b7('0x71')](_0x115c04,{'transaction':_0x148d3a});}})[_0xc4b7('0x16')](function(){_0x115c04[_0xc4b7('0x5b')](function(_0xde7b7d){socket['emit'](_0xc4b7('0x72'),{'UserId':_0xde7b7d,'WhatsappQueueId':_0x49c761['id']});});});});});});})[_0xc4b7('0x16')](respondWithStatusCode(_0x578dde,null))[_0xc4b7('0x3c')](handleError(_0x578dde,null));};exports[_0xc4b7('0x73')]=function(_0xe96fd9,_0x18a484){return db[_0xc4b7('0x1d')][_0xc4b7('0x32')]({'where':{'id':_0xe96fd9[_0xc4b7('0x27')]['id']}})[_0xc4b7('0x16')](handleEntityNotFound(_0x18a484,null))[_0xc4b7('0x16')](function(_0x58dfb4){if(_0x58dfb4){return _0x58dfb4[_0xc4b7('0x73')](_0xe96fd9['body']['ids'],_[_0xc4b7('0x74')](_0xe96fd9[_0xc4b7('0x3d')],[_0xc4b7('0x54'),'id'])||{})[_0xc4b7('0x75')](function(_0xd81f64){for(var _0xac7b93=0x0;_0xac7b93<_0xe96fd9[_0xc4b7('0x3d')]['ids'][_0xc4b7('0x2d')];_0xac7b93+=0x1){socket[_0xc4b7('0x76')](_0xc4b7('0x5c'),{'UserId':Number(_0xe96fd9[_0xc4b7('0x3d')][_0xc4b7('0x54')][_0xac7b93]),'WhatsappQueueId':Number(_0xe96fd9[_0xc4b7('0x27')]['id'])});}return _0xd81f64;});}})[_0xc4b7('0x16')](respondWithResult(_0x18a484,null))[_0xc4b7('0x3c')](handleError(_0x18a484,null));};exports[_0xc4b7('0x71')]=function(_0x133044,_0x2025a6){return db[_0xc4b7('0x1d')][_0xc4b7('0x32')]({'where':{'id':_0x133044['params']['id']}})[_0xc4b7('0x16')](handleEntityNotFound(_0x2025a6,null))['then'](function(_0x1a8208){if(_0x1a8208){return _0x1a8208['removeAgents'](_0x133044[_0xc4b7('0x28')]['ids'])['then'](function(){if(_[_0xc4b7('0x77')](_0x133044[_0xc4b7('0x28')][_0xc4b7('0x54')])){for(var _0x3afdb1=0x0;_0x3afdb1<_0x133044[_0xc4b7('0x28')][_0xc4b7('0x54')]['length'];_0x3afdb1+=0x1){socket[_0xc4b7('0x76')](_0xc4b7('0x72'),{'UserId':Number(_0x133044[_0xc4b7('0x28')][_0xc4b7('0x54')][_0x3afdb1]),'WhatsappQueueId':Number(_0x133044[_0xc4b7('0x27')]['id'])});}}else{socket[_0xc4b7('0x76')](_0xc4b7('0x72'),{'UserId':Number(_0x133044[_0xc4b7('0x28')][_0xc4b7('0x54')]),'WhatsappQueueId':Number(_0x133044[_0xc4b7('0x27')]['id'])});}});}})[_0xc4b7('0x16')](respondWithStatusCode(_0x2025a6,null))['catch'](handleError(_0x2025a6,null));};exports['getAgents']=function(_0x1dc952,_0x510539){var _0x4fad72={};var _0x23913c={};var _0x206857;var _0x525f63;return db['WhatsappQueue'][_0xc4b7('0x50')]({'where':{'id':_0x1dc952[_0xc4b7('0x27')]['id']}})['then'](handleEntityNotFound(_0x510539,null))[_0xc4b7('0x16')](function(_0x51a499){if(_0x51a499){_0x206857=_0x51a499;_0x23913c['model']=_['keys'](db[_0xc4b7('0x78')]['rawAttributes']);_0x23913c['query']=_['keys'](_0x1dc952['query']);_0x23913c[_0xc4b7('0x52')]=_['intersection'](_0x23913c['model'],_0x23913c[_0xc4b7('0x28')]);_0x4fad72[_0xc4b7('0x2c')]=_[_0xc4b7('0x2a')](_0x23913c['model'],qs[_0xc4b7('0x2b')](_0x1dc952[_0xc4b7('0x28')]['fields']));_0x4fad72['attributes']=_0x4fad72[_0xc4b7('0x2c')][_0xc4b7('0x2d')]?_0x4fad72[_0xc4b7('0x2c')]:_0x23913c[_0xc4b7('0x2e')];_0x4fad72['order']=qs[_0xc4b7('0x45')](_0x1dc952[_0xc4b7('0x28')][_0xc4b7('0x45')]);_0x4fad72[_0xc4b7('0x22')]=qs['filters'](_[_0xc4b7('0x46')](_0x1dc952[_0xc4b7('0x28')],_0x23913c[_0xc4b7('0x52')]));if(_0x1dc952[_0xc4b7('0x28')]['filter']){_0x4fad72[_0xc4b7('0x22')]=_[_0xc4b7('0x30')](_0x4fad72[_0xc4b7('0x22')],{'$or':_['map'](_0x4fad72[_0xc4b7('0x2c')],function(_0x157905){var _0x432618={};_0x432618[_0x157905]={'$like':'%'+_0x1dc952['query'][_0xc4b7('0x48')]+'%'};return _0x432618;})});}_0x4fad72=_[_0xc4b7('0x30')]({},_0x4fad72,_0x1dc952[_0xc4b7('0x31')]);return _0x206857[_0xc4b7('0x79')](_0x4fad72);}})[_0xc4b7('0x16')](function(_0x2e5cd2){if(_0x2e5cd2){_0x525f63=_0x2e5cd2[_0xc4b7('0x2d')];if(!_0x1dc952['query'][_0xc4b7('0x42')](_0xc4b7('0x43'))){_0x4fad72[_0xc4b7('0x10')]=qs[_0xc4b7('0x10')](_0x1dc952[_0xc4b7('0x28')][_0xc4b7('0x10')]);_0x4fad72[_0xc4b7('0xe')]=qs[_0xc4b7('0xe')](_0x1dc952[_0xc4b7('0x28')][_0xc4b7('0xe')]);}return _0x206857['getAgents'](_0x4fad72);}})['then'](function(_0x10d9de){if(_0x10d9de){return _0x10d9de?{'count':_0x525f63,'rows':_0x10d9de}:null;}})[_0xc4b7('0x16')](respondWithResult(_0x510539,null))[_0xc4b7('0x3c')](handleError(_0x510539,null));}; \ No newline at end of file +var _0xb56c=['sort','pick','WhatsappQueueId','filter','findAndCountAll','UserId','updatedAt','createdAt','rows','format','%s/%s','SIP','whatsappPause','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','User','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','getOptions','where','WhatsappQueue','include','query','findAll','show','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','nolimit','order'];(function(_0x58e811,_0x57ea86){var _0x56681b=function(_0x53dd9a){while(--_0x53dd9a){_0x58e811['push'](_0x58e811['shift']());}};_0x56681b(++_0x57ea86);}(_0xb56c,0xb5));var _0xcb56=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0xb56c[_0x2a67fe];return _0x57e726;};'use strict';var BPromise=require('bluebird');var util=require(_0xcb56('0x0'));var _=require('lodash');var squel=require(_0xcb56('0x1'));var Redis=require('ioredis');var qs=require(_0xcb56('0x2'));var logger=require(_0xcb56('0x3'))('api');var config=require(_0xcb56('0x4'));var db=require(_0xcb56('0x5'))['db'];config[_0xcb56('0x6')]=_[_0xcb56('0x7')](config[_0xcb56('0x6')],{'host':_0xcb56('0x8'),'port':0x18eb});var socket=require(_0xcb56('0x9'))(new Redis(config[_0xcb56('0x6')]));require(_0xcb56('0xa'))[_0xcb56('0xb')](socket);function respondWithStatusCode(_0x389418,_0x17156f){_0x17156f=_0x17156f||0xcc;return function(_0x59635e){if(_0x59635e){return _0x389418[_0xcb56('0xc')](_0x17156f);}return _0x389418[_0xcb56('0xd')](_0x17156f)[_0xcb56('0xe')]();};}function respondWithResult(_0x1c60f2,_0x55ae57){_0x55ae57=_0x55ae57||0xc8;return function(_0x103717){if(_0x103717){return _0x1c60f2[_0xcb56('0xd')](_0x55ae57)[_0xcb56('0xf')](_0x103717);}};}function respondWithFilteredResult(_0x369393,_0x199b15){return function(_0x31ba5e){if(_0x31ba5e){var _0x1ad3e4=typeof _0x199b15[_0xcb56('0x10')]==='undefined'&&typeof _0x199b15[_0xcb56('0x11')]===_0xcb56('0x12');var _0x5daa45=_0x31ba5e[_0xcb56('0x13')];var _0x4d58b8=_0x1ad3e4?0x0:_0x199b15[_0xcb56('0x10')];var _0x297842=_0x1ad3e4?_0x31ba5e['count']:_0x199b15[_0xcb56('0x10')]+_0x199b15[_0xcb56('0x11')];var _0x495f7f;if(_0x297842>=_0x5daa45){_0x297842=_0x5daa45;_0x495f7f=0xc8;}else{_0x495f7f=0xce;}_0x369393[_0xcb56('0xd')](_0x495f7f);return _0x369393[_0xcb56('0x14')](_0xcb56('0x15'),_0x4d58b8+'-'+_0x297842+'/'+_0x5daa45)[_0xcb56('0xf')](_0x31ba5e);}return null;};}function saveUpdates(_0x2a47cd){return function(_0x2f6336){if(_0x2f6336){return _0x2f6336[_0xcb56('0x16')](_0x2a47cd)[_0xcb56('0x17')](function(_0x86d519){return _0x86d519;});}return null;};}function removeEntity(_0x17599d){return function(_0x4c30f1){if(_0x4c30f1){return _0x4c30f1[_0xcb56('0x18')]()[_0xcb56('0x17')](function(){var _0x39efe3=_0x4c30f1['get']({'plain':!![]});var _0x483a23=_0xcb56('0x19');return db[_0xcb56('0x1a')][_0xcb56('0x18')]({'where':{'type':_0x483a23,'resourceId':_0x39efe3['id']}})['then'](function(){return _0x4c30f1;});})[_0xcb56('0x17')](function(){_0x17599d['status'](0xcc)[_0xcb56('0xe')]();});}};}function handleEntityNotFound(_0x8e78b0){return function(_0x4b24bc){if(!_0x4b24bc){_0x8e78b0[_0xcb56('0xc')](0x194);}return _0x4b24bc;};}function handleError(_0x50f0c4,_0x47df8){_0x47df8=_0x47df8||0x1f4;return function(_0x56024c){logger[_0xcb56('0x1b')](_0x56024c[_0xcb56('0x1c')]);if(_0x56024c[_0xcb56('0x1d')]){delete _0x56024c[_0xcb56('0x1d')];}_0x50f0c4['status'](_0x47df8)[_0xcb56('0x1e')](_0x56024c);};}exports[_0xcb56('0x1f')]=function(_0x607629,_0x15eada){var _0x51c0d6={};var _0x25019a={'count':0x0,'rows':[]};var _0xc7b634=_[_0xcb56('0x20')](db['WhatsappQueue'][_0xcb56('0x21')],function(_0x22b352){return{'name':_0x22b352[_0xcb56('0x22')],'type':_0x22b352['type']['key']};});_0x51c0d6=qs[_0xcb56('0x23')](_0xc7b634,_0x607629);var _0x59571c={'where':_0x51c0d6[_0xcb56('0x24')]};return db[_0xcb56('0x25')][_0xcb56('0x13')](_0x59571c)[_0xcb56('0x17')](function(_0x476f62){_0x25019a[_0xcb56('0x13')]=_0x476f62;_0x51c0d6[_0xcb56('0x26')]=qs['include'](_0x607629[_0xcb56('0x27')]);return db[_0xcb56('0x25')][_0xcb56('0x28')](_0x51c0d6);})[_0xcb56('0x17')](function(_0x1be4b0){_0x25019a['rows']=_0x1be4b0;return _0x25019a;})['then'](respondWithFilteredResult(_0x15eada,_0x51c0d6))['catch'](handleError(_0x15eada,null));};exports[_0xcb56('0x29')]=function(_0x4cec4f,_0xc03cef){var _0x10a3a0={'raw':!![],'where':{'id':_0x4cec4f['params']['id']}},_0x5d6dd4={};_0x5d6dd4['model']=_['keys'](db['WhatsappQueue'][_0xcb56('0x21')]);_0x5d6dd4[_0xcb56('0x27')]=_[_0xcb56('0x2a')](_0x4cec4f[_0xcb56('0x27')]);_0x5d6dd4[_0xcb56('0x2b')]=_[_0xcb56('0x2c')](_0x5d6dd4[_0xcb56('0x2d')],_0x5d6dd4['query']);_0x10a3a0[_0xcb56('0x2e')]=_[_0xcb56('0x2c')](_0x5d6dd4[_0xcb56('0x2d')],qs[_0xcb56('0x2f')](_0x4cec4f['query'][_0xcb56('0x2f')]));_0x10a3a0[_0xcb56('0x2e')]=_0x10a3a0[_0xcb56('0x2e')][_0xcb56('0x30')]?_0x10a3a0[_0xcb56('0x2e')]:_0x5d6dd4[_0xcb56('0x2d')];if(_0x4cec4f[_0xcb56('0x27')][_0xcb56('0x31')]){_0x10a3a0[_0xcb56('0x26')]=[{'all':!![]}];}_0x10a3a0=_[_0xcb56('0x32')]({},_0x10a3a0,_0x4cec4f[_0xcb56('0x33')]);return db[_0xcb56('0x25')][_0xcb56('0x34')](_0x10a3a0)[_0xcb56('0x17')](handleEntityNotFound(_0xc03cef,null))[_0xcb56('0x17')](respondWithResult(_0xc03cef,null))[_0xcb56('0x35')](handleError(_0xc03cef,null));};exports['create']=function(_0x1d1cb2,_0x4d044b){return db[_0xcb56('0x25')][_0xcb56('0x36')](_0x1d1cb2[_0xcb56('0x37')],{})[_0xcb56('0x17')](function(_0x2fee3a){var _0x16f672=_0x1d1cb2['user']['get']({'plain':!![]});if(!_0x16f672)throw new Error(_0xcb56('0x38'));if(_0x16f672[_0xcb56('0x39')]==='user'){var _0x22a742=_0x2fee3a[_0xcb56('0x3a')]({'plain':!![]});var _0xa26562=_0xcb56('0x19');return db['UserProfileSection'][_0xcb56('0x34')]({'where':{'name':_0xa26562,'userProfileId':_0x16f672[_0xcb56('0x3b')]},'raw':!![]})[_0xcb56('0x17')](function(_0x503359){if(_0x503359&&_0x503359[_0xcb56('0x3c')]===0x0){return db['UserProfileResource']['create']({'name':_0x22a742[_0xcb56('0x1d')],'resourceId':_0x22a742['id'],'type':_0x503359[_0xcb56('0x1d')],'sectionId':_0x503359['id']},{})['then'](function(){return _0x2fee3a;});}else{return _0x2fee3a;}})[_0xcb56('0x35')](function(_0x18ee8b){logger['error'](_0xcb56('0x3d'),_0x18ee8b);throw _0x18ee8b;});}return _0x2fee3a;})[_0xcb56('0x17')](respondWithResult(_0x4d044b,0xc9))[_0xcb56('0x35')](handleError(_0x4d044b,null));};exports[_0xcb56('0x16')]=function(_0x5e7c73,_0x5db969){if(_0x5e7c73['body']['id']){delete _0x5e7c73[_0xcb56('0x37')]['id'];}return db['WhatsappQueue'][_0xcb56('0x34')]({'where':{'id':_0x5e7c73[_0xcb56('0x3e')]['id']}})[_0xcb56('0x17')](handleEntityNotFound(_0x5db969,null))[_0xcb56('0x17')](saveUpdates(_0x5e7c73[_0xcb56('0x37')],null))[_0xcb56('0x17')](respondWithResult(_0x5db969,null))[_0xcb56('0x35')](handleError(_0x5db969,null));};exports[_0xcb56('0x18')]=function(_0x359b1f,_0x43991d){return db['WhatsappQueue'][_0xcb56('0x34')]({'where':{'id':_0x359b1f[_0xcb56('0x3e')]['id']}})[_0xcb56('0x17')](handleEntityNotFound(_0x43991d,null))[_0xcb56('0x17')](removeEntity(_0x43991d,null))['catch'](handleError(_0x43991d,null));};exports[_0xcb56('0x3f')]=function(_0x1902a2,_0x504be3){return db[_0xcb56('0x25')][_0xcb56('0x3f')]()[_0xcb56('0x17')](respondWithResult(_0x504be3,null))['catch'](handleError(_0x504be3,null));};exports[_0xcb56('0x40')]=function(_0x241bd4,_0x2cd9c6){var _0x7e2629={'raw':!![],'where':{}},_0x2a76e6={},_0x41b570;return db[_0xcb56('0x25')][_0xcb56('0x41')]({'where':{'id':_0x241bd4[_0xcb56('0x3e')]['id']}})[_0xcb56('0x17')](handleEntityNotFound(_0x2cd9c6,null))[_0xcb56('0x17')](function(_0x106ee5){if(_0x106ee5){_0x41b570=_0x106ee5['get']({'plain':!![]});_0x2a76e6[_0xcb56('0x2d')]=_['keys'](db[_0xcb56('0x42')][_0xcb56('0x21')]);_0x2a76e6[_0xcb56('0x27')]=_[_0xcb56('0x2a')](_0x241bd4['query']);_0x2a76e6['filters']=_[_0xcb56('0x2c')](_0x2a76e6[_0xcb56('0x2d')],_0x2a76e6[_0xcb56('0x27')]);_0x7e2629[_0xcb56('0x2e')]=_[_0xcb56('0x2c')](_0x2a76e6[_0xcb56('0x2d')],qs['fields'](_0x241bd4[_0xcb56('0x27')]['fields']));_0x7e2629[_0xcb56('0x2e')]=_0x7e2629['attributes'][_0xcb56('0x30')]?_0x7e2629['attributes']:_0x2a76e6[_0xcb56('0x2d')];if(!_0x241bd4['query']['hasOwnProperty'](_0xcb56('0x43'))){_0x7e2629['limit']=qs[_0xcb56('0x11')](_0x241bd4[_0xcb56('0x27')][_0xcb56('0x11')]);_0x7e2629['offset']=qs[_0xcb56('0x10')](_0x241bd4['query'][_0xcb56('0x10')]);}_0x7e2629[_0xcb56('0x44')]=qs[_0xcb56('0x45')](_0x241bd4[_0xcb56('0x27')]['sort']);_0x7e2629[_0xcb56('0x24')]=qs[_0xcb56('0x2b')](_[_0xcb56('0x46')](_0x241bd4['query'],_0x2a76e6[_0xcb56('0x2b')]));_0x7e2629[_0xcb56('0x24')][_0xcb56('0x47')]=_0x106ee5['id'];if(_0x241bd4[_0xcb56('0x27')][_0xcb56('0x48')]){_0x7e2629[_0xcb56('0x24')]=_[_0xcb56('0x32')](_0x7e2629[_0xcb56('0x24')],{'$or':_[_0xcb56('0x20')](_0x7e2629['attributes'],function(_0x21decc){var _0x2cdeae={};_0x2cdeae[_0x21decc]={'$like':'%'+_0x241bd4[_0xcb56('0x27')][_0xcb56('0x48')]+'%'};return _0x2cdeae;})});}_0x7e2629=_[_0xcb56('0x32')]({},_0x7e2629,_0x241bd4[_0xcb56('0x33')]);return db[_0xcb56('0x42')][_0xcb56('0x28')](_0x7e2629);}})[_0xcb56('0x17')](function(_0x5714b3){if(_0x5714b3){return db['User'][_0xcb56('0x49')]({'where':{'id':_[_0xcb56('0x20')](_0x5714b3,_0xcb56('0x4a')),'role':'agent'},'attributes':['id',_0xcb56('0x1d'),'whatsappPause',_0xcb56('0x4b'),_0xcb56('0x4c')]});}})[_0xcb56('0x17')](function(_0x289d64){if(_0x289d64){return{'count':_0x289d64[_0xcb56('0x13')],'rows':_['map'](_0x289d64[_0xcb56('0x4d')],function(_0x4dbb0a){return{'membername':_0x4dbb0a[_0xcb56('0x1d')],'UserId':_0x4dbb0a['id'],'queue_name':_0x41b570[_0xcb56('0x1d')],'WhatsappQueueId':_0x41b570['id'],'interface':util[_0xcb56('0x4e')](_0xcb56('0x4f'),_0xcb56('0x50'),_0x4dbb0a['name']),'penalty':0x0,'paused':_0x4dbb0a[_0xcb56('0x51')],'createdAt':_0x4dbb0a[_0xcb56('0x4c')],'updatedAt':_0x4dbb0a[_0xcb56('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcb56('0x17')](respondWithFilteredResult(_0x2cd9c6,_0x7e2629))[_0xcb56('0x35')](handleError(_0x2cd9c6,null));};exports[_0xcb56('0x52')]=function(_0x128688,_0x432eab){var _0x2c1a70={};var _0x37279d={};var _0x43643c;var _0xdb0dca;return db[_0xcb56('0x25')][_0xcb56('0x41')]({'where':{'id':_0x128688[_0xcb56('0x3e')]['id']}})[_0xcb56('0x17')](handleEntityNotFound(_0x432eab,null))[_0xcb56('0x17')](function(_0x5a8a0b){if(_0x5a8a0b){_0x43643c=_0x5a8a0b;_0x37279d['model']=_[_0xcb56('0x2a')](db[_0xcb56('0x53')][_0xcb56('0x21')]);_0x37279d[_0xcb56('0x27')]=_[_0xcb56('0x2a')](_0x128688[_0xcb56('0x27')]);_0x37279d[_0xcb56('0x2b')]=_[_0xcb56('0x2c')](_0x37279d['model'],_0x37279d[_0xcb56('0x27')]);_0x2c1a70[_0xcb56('0x2e')]=_[_0xcb56('0x2c')](_0x37279d[_0xcb56('0x2d')],qs['fields'](_0x128688[_0xcb56('0x27')][_0xcb56('0x2f')]));_0x2c1a70[_0xcb56('0x2e')]=_0x2c1a70[_0xcb56('0x2e')][_0xcb56('0x30')]?_0x2c1a70[_0xcb56('0x2e')]:_0x37279d['model'];_0x2c1a70['order']=qs[_0xcb56('0x45')](_0x128688[_0xcb56('0x27')][_0xcb56('0x45')]);_0x2c1a70['where']=qs[_0xcb56('0x2b')](_[_0xcb56('0x46')](_0x128688['query'],_0x37279d[_0xcb56('0x2b')]));if(_0x128688[_0xcb56('0x27')][_0xcb56('0x48')]){_0x2c1a70['where']=_[_0xcb56('0x32')](_0x2c1a70[_0xcb56('0x24')],{'$or':_[_0xcb56('0x20')](_0x2c1a70[_0xcb56('0x2e')],function(_0x38d9a3){var _0x58c0a6={};_0x58c0a6[_0x38d9a3]={'$like':'%'+_0x128688[_0xcb56('0x27')][_0xcb56('0x48')]+'%'};return _0x58c0a6;})});}_0x2c1a70=_[_0xcb56('0x32')]({},_0x2c1a70,_0x128688[_0xcb56('0x33')]);return _0x43643c[_0xcb56('0x52')](_0x2c1a70);}})[_0xcb56('0x17')](function(_0x571c32){if(_0x571c32){_0xdb0dca=_0x571c32[_0xcb56('0x30')];if(!_0x128688[_0xcb56('0x27')][_0xcb56('0x54')](_0xcb56('0x43'))){_0x2c1a70[_0xcb56('0x11')]=qs[_0xcb56('0x11')](_0x128688[_0xcb56('0x27')]['limit']);_0x2c1a70['offset']=qs[_0xcb56('0x10')](_0x128688[_0xcb56('0x27')][_0xcb56('0x10')]);}return _0x43643c['getTeams'](_0x2c1a70);}})[_0xcb56('0x17')](function(_0x3e6034){if(_0x3e6034){return _0x3e6034?{'count':_0xdb0dca,'rows':_0x3e6034}:null;}})[_0xcb56('0x17')](respondWithResult(_0x432eab,null))[_0xcb56('0x35')](handleError(_0x432eab,null));};exports[_0xcb56('0x55')]=function(_0xc627d4,_0x52c8d5){var _0x286f39=_0xc627d4['body'][_0xcb56('0x56')];return db[_0xcb56('0x53')]['findAll']({'where':{'id':_0x286f39},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcb56('0x57'),'attributes':['id',_0xcb56('0x1d'),_0xcb56('0x58'),'voicePause','interface'],'raw':!![]}]})[_0xcb56('0x17')](function(_0x4a87f0){if(_0x4a87f0){var _0x3470cb=_['flatMap'](_0x4a87f0,function(_0x3ff1ba){var _0x56382d=_0x3ff1ba[_0xcb56('0x3a')]({'plain':!![]});return _0x56382d[_0xcb56('0x57')];});return db['WhatsappQueue']['find']({'where':{'id':_0xc627d4[_0xcb56('0x3e')]['id']}})[_0xcb56('0x17')](function(_0x1cd3b7){return db[_0xcb56('0x59')][_0xcb56('0x5a')](function(_0x26389c){return _0x1cd3b7['addTeams'](_0x286f39,{'transaction':_0x26389c})[_0xcb56('0x17')](function(){return BPromise[_0xcb56('0x5b')](_0x3470cb,function(_0x191c5e){return db[_0xcb56('0x42')][_0xcb56('0x5c')]({'where':{'UserId':_0x191c5e['id'],'WhatsappQueueId':_0xc627d4['params']['id']},'transaction':_0x26389c});});})[_0xcb56('0x17')](function(){_0x3470cb[_0xcb56('0x5d')](function(_0x5e994b){socket['emit'](_0xcb56('0x5e'),{'UserId':_0x5e994b['id'],'WhatsappQueueId':_0x1cd3b7['id']});});});});});}})['then'](respondWithStatusCode(_0x52c8d5,null))[_0xcb56('0x35')](handleError(_0x52c8d5,null));};exports[_0xcb56('0x5f')]=function(_0x294daf,_0x2f169b){return db[_0xcb56('0x53')][_0xcb56('0x28')]({'where':{'id':_0x294daf[_0xcb56('0x27')][_0xcb56('0x56')]},'attributes':['id'],'include':[{'model':db[_0xcb56('0x60')],'as':_0xcb56('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f169b,null))['then'](function(_0x405bf8){var _0x8aace3=_[_0xcb56('0x20')](_0x405bf8,'id');var _0x2b2549=[];var _0x1fce0b=[];var _0x315471=squel[_0xcb56('0x61')]();_0x315471[_0xcb56('0x62')](_0xcb56('0x63'))[_0xcb56('0x64')](_0xcb56('0x65'),'tq')[_0xcb56('0x66')](_0xcb56('0x67'),'ut',_0xcb56('0x68'))[_0xcb56('0x24')](_0xcb56('0x69'),_0x294daf['params']['id']);for(var _0x1e7bbc=0x0;_0x1e7bbc<_0x405bf8[_0xcb56('0x30')];_0x1e7bbc+=0x1){let _0x36b410=_0x405bf8[_0x1e7bbc];for(var _0x167c2d=0x0;_0x167c2d<_0x36b410[_0xcb56('0x57')]['length'];_0x167c2d+=0x1){let _0x4ce30b=_0x36b410[_0xcb56('0x57')][_0x167c2d];var _0x3edeee=_0x315471['clone']();_0x3edeee[_0xcb56('0x24')](_0xcb56('0x6a'),_0x4ce30b['id']);_0x1fce0b[_0xcb56('0x6b')](db['sequelize'][_0xcb56('0x27')](_0x3edeee[_0xcb56('0x6c')](),{'type':db[_0xcb56('0x59')][_0xcb56('0x6d')]['SELECT']})[_0xcb56('0x17')](function(_0x517a7a){if(_0x517a7a[_0xcb56('0x30')]===0x1){return _0x4ce30b['id'];}else{var _0x3dfbdb=_[_0xcb56('0x6e')](_['map'](_0x517a7a,_0xcb56('0x6f')),function(_0x18cffe){return _['includes'](_0x8aace3,_0x18cffe);});if(_0x3dfbdb){return _0x4ce30b['id'];}}}));}}return BPromise[_0xcb56('0x70')](_0x1fce0b)['then'](function(_0xa1e0ca){_0x2b2549=_(_0x2b2549)[_0xcb56('0x71')](_0xa1e0ca)[_0xcb56('0x72')]()[_0xcb56('0x73')]();return db[_0xcb56('0x25')][_0xcb56('0x34')]({'where':{'id':_0x294daf[_0xcb56('0x3e')]['id']}})[_0xcb56('0x17')](function(_0x4ccf09){return db['sequelize'][_0xcb56('0x5a')](function(_0x54de9b){return _0x4ccf09[_0xcb56('0x5f')](_0x294daf[_0xcb56('0x27')][_0xcb56('0x56')],{'transaction':_0x54de9b})[_0xcb56('0x17')](function(){if(!_[_0xcb56('0x74')](_0x2b2549)){return _0x4ccf09[_0xcb56('0x75')](_0x2b2549,{'transaction':_0x54de9b});}})[_0xcb56('0x17')](function(){_0x2b2549[_0xcb56('0x5d')](function(_0x49cd91){socket['emit'](_0xcb56('0x76'),{'UserId':_0x49cd91,'WhatsappQueueId':_0x4ccf09['id']});});});});});});})[_0xcb56('0x17')](respondWithStatusCode(_0x2f169b,null))[_0xcb56('0x35')](handleError(_0x2f169b,null));};exports[_0xcb56('0x77')]=function(_0x22db7b,_0x1f5dee){return db['WhatsappQueue'][_0xcb56('0x34')]({'where':{'id':_0x22db7b['params']['id']}})['then'](handleEntityNotFound(_0x1f5dee,null))[_0xcb56('0x17')](function(_0x49a985){if(_0x49a985){return _0x49a985[_0xcb56('0x77')](_0x22db7b[_0xcb56('0x37')][_0xcb56('0x56')],_[_0xcb56('0x78')](_0x22db7b['body'],[_0xcb56('0x56'),'id'])||{})[_0xcb56('0x79')](function(_0x332b19){for(var _0x520db7=0x0;_0x520db7<_0x22db7b[_0xcb56('0x37')][_0xcb56('0x56')][_0xcb56('0x30')];_0x520db7+=0x1){socket[_0xcb56('0x7a')](_0xcb56('0x5e'),{'UserId':Number(_0x22db7b[_0xcb56('0x37')]['ids'][_0x520db7]),'WhatsappQueueId':Number(_0x22db7b['params']['id'])});}return _0x332b19;});}})[_0xcb56('0x17')](respondWithResult(_0x1f5dee,null))[_0xcb56('0x35')](handleError(_0x1f5dee,null));};exports[_0xcb56('0x75')]=function(_0x5c20a,_0x34147b){return db[_0xcb56('0x25')][_0xcb56('0x34')]({'where':{'id':_0x5c20a[_0xcb56('0x3e')]['id']}})['then'](handleEntityNotFound(_0x34147b,null))[_0xcb56('0x17')](function(_0x3ec2b2){if(_0x3ec2b2){return _0x3ec2b2[_0xcb56('0x75')](_0x5c20a[_0xcb56('0x27')]['ids'])[_0xcb56('0x17')](function(){if(_[_0xcb56('0x7b')](_0x5c20a['query']['ids'])){for(var _0x4bb191=0x0;_0x4bb191<_0x5c20a[_0xcb56('0x27')][_0xcb56('0x56')][_0xcb56('0x30')];_0x4bb191+=0x1){socket['emit'](_0xcb56('0x76'),{'UserId':Number(_0x5c20a['query'][_0xcb56('0x56')][_0x4bb191]),'WhatsappQueueId':Number(_0x5c20a['params']['id'])});}}else{socket[_0xcb56('0x7a')](_0xcb56('0x76'),{'UserId':Number(_0x5c20a['query'][_0xcb56('0x56')]),'WhatsappQueueId':Number(_0x5c20a[_0xcb56('0x3e')]['id'])});}});}})['then'](respondWithStatusCode(_0x34147b,null))[_0xcb56('0x35')](handleError(_0x34147b,null));};exports[_0xcb56('0x7c')]=function(_0xff4c0b,_0x13d921){var _0x57f17e={};var _0x3b3ca6={};var _0xffb50b;var _0x4cd744;return db['WhatsappQueue']['findOne']({'where':{'id':_0xff4c0b['params']['id']}})[_0xcb56('0x17')](handleEntityNotFound(_0x13d921,null))[_0xcb56('0x17')](function(_0x177e8e){if(_0x177e8e){_0xffb50b=_0x177e8e;_0x3b3ca6[_0xcb56('0x2d')]=_[_0xcb56('0x2a')](db['User'][_0xcb56('0x21')]);_0x3b3ca6[_0xcb56('0x27')]=_['keys'](_0xff4c0b[_0xcb56('0x27')]);_0x3b3ca6['filters']=_[_0xcb56('0x2c')](_0x3b3ca6[_0xcb56('0x2d')],_0x3b3ca6[_0xcb56('0x27')]);_0x57f17e['attributes']=_[_0xcb56('0x2c')](_0x3b3ca6[_0xcb56('0x2d')],qs[_0xcb56('0x2f')](_0xff4c0b['query'][_0xcb56('0x2f')]));_0x57f17e['attributes']=_0x57f17e[_0xcb56('0x2e')][_0xcb56('0x30')]?_0x57f17e[_0xcb56('0x2e')]:_0x3b3ca6[_0xcb56('0x2d')];_0x57f17e[_0xcb56('0x44')]=qs['sort'](_0xff4c0b[_0xcb56('0x27')][_0xcb56('0x45')]);_0x57f17e[_0xcb56('0x24')]=qs[_0xcb56('0x2b')](_[_0xcb56('0x46')](_0xff4c0b[_0xcb56('0x27')],_0x3b3ca6[_0xcb56('0x2b')]));if(_0xff4c0b[_0xcb56('0x27')][_0xcb56('0x48')]){_0x57f17e[_0xcb56('0x24')]=_['merge'](_0x57f17e[_0xcb56('0x24')],{'$or':_[_0xcb56('0x20')](_0x57f17e[_0xcb56('0x2e')],function(_0x27612c){var _0x4aa06a={};_0x4aa06a[_0x27612c]={'$like':'%'+_0xff4c0b[_0xcb56('0x27')]['filter']+'%'};return _0x4aa06a;})});}_0x57f17e=_[_0xcb56('0x32')]({},_0x57f17e,_0xff4c0b[_0xcb56('0x33')]);return _0xffb50b[_0xcb56('0x7c')](_0x57f17e);}})[_0xcb56('0x17')](function(_0x56a692){if(_0x56a692){_0x4cd744=_0x56a692[_0xcb56('0x30')];if(!_0xff4c0b[_0xcb56('0x27')]['hasOwnProperty']('nolimit')){_0x57f17e['limit']=qs[_0xcb56('0x11')](_0xff4c0b[_0xcb56('0x27')][_0xcb56('0x11')]);_0x57f17e[_0xcb56('0x10')]=qs['offset'](_0xff4c0b[_0xcb56('0x27')][_0xcb56('0x10')]);}return _0xffb50b[_0xcb56('0x7c')](_0x57f17e);}})[_0xcb56('0x17')](function(_0x4f8bc6){if(_0x4f8bc6){return _0x4f8bc6?{'count':_0x4cd744,'rows':_0x4f8bc6}:null;}})[_0xcb56('0x17')](respondWithResult(_0x13d921,null))[_0xcb56('0x35')](handleError(_0x13d921,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 172e03e..69cba29 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 _0xb66a=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','save'];(function(_0x15fc87,_0x6bc691){var _0x1e4d93=function(_0x4b1d65){while(--_0x4b1d65){_0x15fc87['push'](_0x15fc87['shift']());}};_0x1e4d93(++_0x6bc691);}(_0xb66a,0xe2));var _0xab66=function(_0x41b600,_0x576374){_0x41b600=_0x41b600-0x0;var _0x26114f=_0xb66a[_0x41b600];return _0x26114f;};'use strict';var EventEmitter=require(_0xab66('0x0'));var WhatsappQueue=require(_0xab66('0x1'))['db'][_0xab66('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xab66('0x3'),'afterUpdate':_0xab66('0x4'),'afterDestroy':_0xab66('0x5')};function emitEvent(_0x5dbe3d){return function(_0xdbfd83,_0x27e01b,_0x5cd9f3){WhatsappQueueEvents[_0xab66('0x6')](_0x5dbe3d+':'+_0xdbfd83['id'],_0xdbfd83);WhatsappQueueEvents['emit'](_0x5dbe3d,_0xdbfd83);_0x5cd9f3(null);};}for(var e in events){if(events[_0xab66('0x7')](e)){var event=events[e];WhatsappQueue[_0xab66('0x8')](e,emitEvent(event));}}module[_0xab66('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x67d0=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x1657b7,_0x536b01){var _0x5a6f11=function(_0x4ee36c){while(--_0x4ee36c){_0x1657b7['push'](_0x1657b7['shift']());}};_0x5a6f11(++_0x536b01);}(_0x67d0,0x83));var _0x067d=function(_0x26606b,_0xa0bfca){_0x26606b=_0x26606b-0x0;var _0x48f39e=_0x67d0[_0x26606b];return _0x48f39e;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x067d('0x0'))['db'][_0x067d('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x067d('0x2')](0x0);var events={'afterCreate':_0x067d('0x3'),'afterUpdate':'update','afterDestroy':_0x067d('0x4')};function emitEvent(_0x7edf){return function(_0x23231c,_0x2c0dc3,_0x29fe15){WhatsappQueueEvents[_0x067d('0x5')](_0x7edf+':'+_0x23231c['id'],_0x23231c);WhatsappQueueEvents[_0x067d('0x5')](_0x7edf,_0x23231c);_0x29fe15(null);};}for(var e in events){if(events[_0x067d('0x6')](e)){var event=events[e];WhatsappQueue[_0x067d('0x7')](e,emitEvent(event));}}module[_0x067d('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 cc9f0da..fe8f573 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 _0x350b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x2f37bd,_0x295e9f){var _0x33362b=function(_0x51264e){while(--_0x51264e){_0x2f37bd['push'](_0x2f37bd['shift']());}};_0x33362b(++_0x295e9f);}(_0x350b,0x1a2));var _0xb350=function(_0x2882ca,_0x2b3d00){_0x2882ca=_0x2882ca-0x0;var _0x26fcba=_0x350b[_0x2882ca];return _0x26fcba;};'use strict';var _=require(_0xb350('0x0'));var util=require(_0xb350('0x1'));var logger=require(_0xb350('0x2'))(_0xb350('0x3'));var moment=require(_0xb350('0x4'));var BPromise=require(_0xb350('0x5'));var rp=require(_0xb350('0x6'));var fs=require('fs');var path=require(_0xb350('0x7'));var rimraf=require(_0xb350('0x8'));var config=require(_0xb350('0x9'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x121537,_0x21ad85){return _0x121537['define'](_0xb350('0xa'),attributes,{'tableName':_0xb350('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9414=['rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','bluebird','path'];(function(_0x47f7f5,_0xa5caf){var _0x52fe6b=function(_0x7ee9cf){while(--_0x7ee9cf){_0x47f7f5['push'](_0x47f7f5['shift']());}};_0x52fe6b(++_0xa5caf);}(_0x9414,0x13a));var _0x4941=function(_0x4e11d5,_0x1ce514){_0x4e11d5=_0x4e11d5-0x0;var _0x5e4e4c=_0x9414[_0x4e11d5];return _0x5e4e4c;};'use strict';var _=require(_0x4941('0x0'));var util=require(_0x4941('0x1'));var logger=require(_0x4941('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4941('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4941('0x4'));var rimraf=require(_0x4941('0x5'));var config=require(_0x4941('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x4941('0x7')]=function(_0x56f1bc,_0x2e37d3){return _0x56f1bc[_0x4941('0x8')](_0x4941('0x9'),attributes,{'tableName':_0x4941('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 ad03d21..fecccad 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 _0x73f7=['info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappQueue.socket','then'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x73f7,0x89));var _0x773f=function(_0x2e453f,_0x30e481){_0x2e453f=_0x2e453f-0x0;var _0x3ae32f=_0x73f7[_0x2e453f];return _0x3ae32f;};'use strict';var _=require(_0x773f('0x0'));var util=require(_0x773f('0x1'));var moment=require(_0x773f('0x2'));var BPromise=require(_0x773f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x773f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x773f('0x5'))('rpc');var config=require(_0x773f('0x6'));var jayson=require(_0x773f('0x7'));var client=jayson[_0x773f('0x8')][_0x773f('0x9')]({'port':0x232a});config['redis']=_[_0x773f('0xa')](config[_0x773f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x773f('0xc'))(new Redis(config[_0x773f('0xb')]));require(_0x773f('0xd'))['register'](socket);function respondWithRpcPromise(_0x235a44,_0x4c638f,_0x1b63e1){return new BPromise(function(_0x2f2b59,_0x56a2c5){return client['request'](_0x235a44,_0x1b63e1)[_0x773f('0xe')](function(_0x2e1bd5){logger[_0x773f('0xf')](_0x773f('0x10'),_0x4c638f,_0x773f('0x11'));logger[_0x773f('0x12')](_0x773f('0x13'),_0x4c638f,'request\x20sent',JSON[_0x773f('0x14')](_0x2e1bd5));if(_0x2e1bd5[_0x773f('0x15')]){if(_0x2e1bd5[_0x773f('0x15')][_0x773f('0x16')]===0x1f4){logger[_0x773f('0x15')](_0x773f('0x10'),_0x4c638f,_0x2e1bd5['error']['message']);return _0x56a2c5(_0x2e1bd5[_0x773f('0x15')][_0x773f('0x17')]);}logger[_0x773f('0x15')](_0x773f('0x10'),_0x4c638f,_0x2e1bd5['error']['message']);return _0x2f2b59(_0x2e1bd5[_0x773f('0x15')][_0x773f('0x17')]);}else{logger[_0x773f('0xf')](_0x773f('0x10'),_0x4c638f,'request\x20sent');_0x2f2b59(_0x2e1bd5[_0x773f('0x18')][_0x773f('0x17')]);}})[_0x773f('0x19')](function(_0x495dfe){logger[_0x773f('0x15')](_0x773f('0x10'),_0x4c638f,_0x495dfe);_0x56a2c5(_0x495dfe);});});}exports[_0x773f('0x1a')]=function(_0x5c2e0b){var _0x345355=this;return new Promise(function(_0xb2952f,_0x58a75e){return db[_0x773f('0x1b')][_0x773f('0x1c')]({'raw':_0x5c2e0b['options']?_0x5c2e0b[_0x773f('0x1d')][_0x773f('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c2e0b['options']?_0x5c2e0b[_0x773f('0x1d')][_0x773f('0x1f')]||null:null,'attributes':_0x5c2e0b['options']?_0x5c2e0b['options'][_0x773f('0x20')]||null:null,'limit':_0x5c2e0b[_0x773f('0x1d')]?_0x5c2e0b['options'][_0x773f('0x21')]||null:null,'include':_0x5c2e0b[_0x773f('0x1d')]?_0x5c2e0b[_0x773f('0x1d')][_0x773f('0x22')]?_[_0x773f('0x23')](_0x5c2e0b[_0x773f('0x1d')]['include'],function(_0x3d0f33){return{'model':db[_0x3d0f33[_0x773f('0x24')]],'as':_0x3d0f33['as'],'attributes':_0x3d0f33[_0x773f('0x20')],'include':_0x3d0f33[_0x773f('0x22')]?_['map'](_0x3d0f33['include'],function(_0x31631d){return{'model':db[_0x31631d[_0x773f('0x24')]],'as':_0x31631d['as'],'attributes':_0x31631d[_0x773f('0x20')],'include':_0x31631d['include']?_['map'](_0x31631d[_0x773f('0x22')],function(_0x59e4d3){return{'model':db[_0x59e4d3[_0x773f('0x24')]],'as':_0x59e4d3['as'],'attributes':_0x59e4d3['attributes']};}):[]};}):[]};}):[]:[]})[_0x773f('0xe')](function(_0x104a90){logger[_0x773f('0xf')](_0x773f('0x1a'),_0x5c2e0b);logger[_0x773f('0x12')](_0x773f('0x1a'),_0x5c2e0b,JSON[_0x773f('0x14')](_0x104a90));_0xb2952f(_0x104a90);})[_0x773f('0x19')](function(_0x518562){logger[_0x773f('0x15')](_0x773f('0x1a'),_0x518562[_0x773f('0x17')],_0x5c2e0b);_0x58a75e(_0x345355[_0x773f('0x15')](0x1f4,_0x518562[_0x773f('0x17')]));});});};exports['ShowWhatsappQueue']=function(_0x3759d6){var _0x452456=this;return new Promise(function(_0x459915,_0x29240d){return db[_0x773f('0x1b')]['find']({'raw':_0x3759d6['options']?_0x3759d6['options'][_0x773f('0x1e')]===undefined?!![]:![]:!![],'where':_0x3759d6[_0x773f('0x1d')]?_0x3759d6[_0x773f('0x1d')][_0x773f('0x1f')]||null:null,'attributes':_0x3759d6[_0x773f('0x1d')]?_0x3759d6[_0x773f('0x1d')][_0x773f('0x20')]||null:null,'include':_0x3759d6[_0x773f('0x1d')]?_0x3759d6[_0x773f('0x1d')][_0x773f('0x22')]?_['map'](_0x3759d6[_0x773f('0x1d')][_0x773f('0x22')],function(_0x4187fe){return{'model':db[_0x4187fe[_0x773f('0x24')]],'as':_0x4187fe['as'],'attributes':_0x4187fe[_0x773f('0x20')],'include':_0x4187fe[_0x773f('0x22')]?_[_0x773f('0x23')](_0x4187fe[_0x773f('0x22')],function(_0x2f023e){return{'model':db[_0x2f023e['model']],'as':_0x2f023e['as'],'attributes':_0x2f023e[_0x773f('0x20')],'include':_0x2f023e[_0x773f('0x22')]?_[_0x773f('0x23')](_0x2f023e[_0x773f('0x22')],function(_0x1228cd){return{'model':db[_0x1228cd[_0x773f('0x24')]],'as':_0x1228cd['as'],'attributes':_0x1228cd[_0x773f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x773f('0xe')](function(_0x2060cb){logger[_0x773f('0xf')]('ShowWhatsappQueue',_0x3759d6);logger[_0x773f('0x12')](_0x773f('0x25'),_0x3759d6,JSON[_0x773f('0x14')](_0x2060cb));_0x459915(_0x2060cb);})[_0x773f('0x19')](function(_0x2bad8f){logger[_0x773f('0x15')](_0x773f('0x25'),_0x2bad8f[_0x773f('0x17')],_0x3759d6);_0x29240d(_0x452456[_0x773f('0x15')](0x1f4,_0x2bad8f[_0x773f('0x17')]));});});}; \ No newline at end of file +var _0xd9d6=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','WhatsappQueue','findAll','options','limit','include','model','attributes','map','GetWhatsappQueue','stringify','find','raw','where','ShowWhatsappQueue','lodash'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xd9d6,0x179));var _0x6d9d=function(_0x2df413,_0x5303ae){_0x2df413=_0x2df413-0x0;var _0x1f5133=_0xd9d6[_0x2df413];return _0x1f5133;};'use strict';var _=require(_0x6d9d('0x0'));var util=require(_0x6d9d('0x1'));var moment=require(_0x6d9d('0x2'));var BPromise=require(_0x6d9d('0x3'));var rs=require(_0x6d9d('0x4'));var fs=require('fs');var Redis=require(_0x6d9d('0x5'));var db=require(_0x6d9d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d9d('0x7'))('rpc');var config=require(_0x6d9d('0x8'));var jayson=require(_0x6d9d('0x9'));var client=jayson[_0x6d9d('0xa')][_0x6d9d('0xb')]({'port':0x232a});config[_0x6d9d('0xc')]=_[_0x6d9d('0xd')](config['redis'],{'host':_0x6d9d('0xe'),'port':0x18eb});var socket=require(_0x6d9d('0xf'))(new Redis(config[_0x6d9d('0xc')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x317e47,_0x35f175,_0x5a4600){return new BPromise(function(_0x590002,_0xf70538){return client[_0x6d9d('0x10')](_0x317e47,_0x5a4600)[_0x6d9d('0x11')](function(_0x183862){logger[_0x6d9d('0x12')](_0x6d9d('0x13'),_0x35f175,'request\x20sent');logger[_0x6d9d('0x14')](_0x6d9d('0x15'),_0x35f175,'request\x20sent',JSON['stringify'](_0x183862));if(_0x183862[_0x6d9d('0x16')]){if(_0x183862[_0x6d9d('0x16')][_0x6d9d('0x17')]===0x1f4){logger['error'](_0x6d9d('0x13'),_0x35f175,_0x183862[_0x6d9d('0x16')]['message']);return _0xf70538(_0x183862[_0x6d9d('0x16')][_0x6d9d('0x18')]);}logger[_0x6d9d('0x16')](_0x6d9d('0x13'),_0x35f175,_0x183862[_0x6d9d('0x16')][_0x6d9d('0x18')]);return _0x590002(_0x183862[_0x6d9d('0x16')]['message']);}else{logger[_0x6d9d('0x12')](_0x6d9d('0x13'),_0x35f175,_0x6d9d('0x19'));_0x590002(_0x183862[_0x6d9d('0x1a')][_0x6d9d('0x18')]);}})[_0x6d9d('0x1b')](function(_0x20f404){logger[_0x6d9d('0x16')](_0x6d9d('0x13'),_0x35f175,_0x20f404);_0xf70538(_0x20f404);});});}exports['GetWhatsappQueue']=function(_0x5b8c94){var _0x516a19=this;return new Promise(function(_0xf7a77d,_0x4ecc04){return db[_0x6d9d('0x1c')][_0x6d9d('0x1d')]({'raw':_0x5b8c94[_0x6d9d('0x1e')]?_0x5b8c94[_0x6d9d('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5b8c94[_0x6d9d('0x1e')]?_0x5b8c94[_0x6d9d('0x1e')]['where']||null:null,'attributes':_0x5b8c94[_0x6d9d('0x1e')]?_0x5b8c94[_0x6d9d('0x1e')]['attributes']||null:null,'limit':_0x5b8c94['options']?_0x5b8c94[_0x6d9d('0x1e')][_0x6d9d('0x1f')]||null:null,'include':_0x5b8c94[_0x6d9d('0x1e')]?_0x5b8c94[_0x6d9d('0x1e')]['include']?_['map'](_0x5b8c94['options'][_0x6d9d('0x20')],function(_0x3c2fbc){return{'model':db[_0x3c2fbc[_0x6d9d('0x21')]],'as':_0x3c2fbc['as'],'attributes':_0x3c2fbc[_0x6d9d('0x22')],'include':_0x3c2fbc['include']?_[_0x6d9d('0x23')](_0x3c2fbc[_0x6d9d('0x20')],function(_0x1671db){return{'model':db[_0x1671db[_0x6d9d('0x21')]],'as':_0x1671db['as'],'attributes':_0x1671db[_0x6d9d('0x22')],'include':_0x1671db['include']?_[_0x6d9d('0x23')](_0x1671db[_0x6d9d('0x20')],function(_0xea768b){return{'model':db[_0xea768b[_0x6d9d('0x21')]],'as':_0xea768b['as'],'attributes':_0xea768b['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d9d('0x11')](function(_0xfc58c4){logger[_0x6d9d('0x12')]('GetWhatsappQueue',_0x5b8c94);logger[_0x6d9d('0x14')](_0x6d9d('0x24'),_0x5b8c94,JSON[_0x6d9d('0x25')](_0xfc58c4));_0xf7a77d(_0xfc58c4);})[_0x6d9d('0x1b')](function(_0x23e9a6){logger[_0x6d9d('0x16')](_0x6d9d('0x24'),_0x23e9a6[_0x6d9d('0x18')],_0x5b8c94);_0x4ecc04(_0x516a19[_0x6d9d('0x16')](0x1f4,_0x23e9a6[_0x6d9d('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0xf98e1a){var _0x592301=this;return new Promise(function(_0x286f45,_0x4b6a3d){return db[_0x6d9d('0x1c')][_0x6d9d('0x26')]({'raw':_0xf98e1a[_0x6d9d('0x1e')]?_0xf98e1a[_0x6d9d('0x1e')][_0x6d9d('0x27')]===undefined?!![]:![]:!![],'where':_0xf98e1a[_0x6d9d('0x1e')]?_0xf98e1a[_0x6d9d('0x1e')][_0x6d9d('0x28')]||null:null,'attributes':_0xf98e1a['options']?_0xf98e1a[_0x6d9d('0x1e')]['attributes']||null:null,'include':_0xf98e1a[_0x6d9d('0x1e')]?_0xf98e1a[_0x6d9d('0x1e')][_0x6d9d('0x20')]?_[_0x6d9d('0x23')](_0xf98e1a['options'][_0x6d9d('0x20')],function(_0x36959f){return{'model':db[_0x36959f[_0x6d9d('0x21')]],'as':_0x36959f['as'],'attributes':_0x36959f['attributes'],'include':_0x36959f['include']?_[_0x6d9d('0x23')](_0x36959f['include'],function(_0x2c86f2){return{'model':db[_0x2c86f2[_0x6d9d('0x21')]],'as':_0x2c86f2['as'],'attributes':_0x2c86f2[_0x6d9d('0x22')],'include':_0x2c86f2[_0x6d9d('0x20')]?_[_0x6d9d('0x23')](_0x2c86f2[_0x6d9d('0x20')],function(_0xeed523){return{'model':db[_0xeed523['model']],'as':_0xeed523['as'],'attributes':_0xeed523[_0x6d9d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6d9d('0x11')](function(_0x1f5778){logger[_0x6d9d('0x12')](_0x6d9d('0x29'),_0xf98e1a);logger['debug'](_0x6d9d('0x29'),_0xf98e1a,JSON[_0x6d9d('0x25')](_0x1f5778));_0x286f45(_0x1f5778);})[_0x6d9d('0x1b')](function(_0x2c3390){logger[_0x6d9d('0x16')](_0x6d9d('0x29'),_0x2c3390[_0x6d9d('0x18')],_0xf98e1a);_0x4b6a3d(_0x592301['error'](0x1f4,_0x2c3390['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index a79dcd5..e79a1d1 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 _0x986a=['remove','update','emit','register','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x986a,0x132));var _0xa986=function(_0x44c0c0,_0x45e95b){_0x44c0c0=_0x44c0c0-0x0;var _0xdb53cc=_0x986a[_0x44c0c0];return _0xdb53cc;};'use strict';var WhatsappQueueEvents=require(_0xa986('0x0'));var events=[_0xa986('0x1'),_0xa986('0x2'),_0xa986('0x3')];function createListener(_0x4ab3d6,_0x5c8660){return function(_0x3e7c64){_0x5c8660[_0xa986('0x4')](_0x4ab3d6,_0x3e7c64);};}function removeListener(_0x56b013,_0x411cd4){return function(){WhatsappQueueEvents['removeListener'](_0x56b013,_0x411cd4);};}exports[_0xa986('0x5')]=function(_0xe7fe37){for(var _0x4f35e2=0x0,_0x5bd9a4=events['length'];_0x4f35e2<_0x5bd9a4;_0x4f35e2++){var _0x4d3793=events[_0x4f35e2];var _0x1b607d=createListener(_0xa986('0x6')+_0x4d3793,_0xe7fe37);WhatsappQueueEvents['on'](_0x4d3793,_0x1b607d);}}; \ No newline at end of file +var _0x9e10=['save','remove','update','removeListener','register','length'];(function(_0x4a7f91,_0x193fe9){var _0x16ea44=function(_0x3bd95b){while(--_0x3bd95b){_0x4a7f91['push'](_0x4a7f91['shift']());}};_0x16ea44(++_0x193fe9);}(_0x9e10,0x138));var _0x09e1=function(_0x376a14,_0x517d68){_0x376a14=_0x376a14-0x0;var _0xef25d7=_0x9e10[_0x376a14];return _0xef25d7;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x09e1('0x0'),_0x09e1('0x1'),_0x09e1('0x2')];function createListener(_0x2be0d3,_0x3de91f){return function(_0x7c47dc){_0x3de91f['emit'](_0x2be0d3,_0x7c47dc);};}function removeListener(_0x5892aa,_0x22b88a){return function(){WhatsappQueueEvents[_0x09e1('0x3')](_0x5892aa,_0x22b88a);};}exports[_0x09e1('0x4')]=function(_0x220d1c){for(var _0x74fff9=0x0,_0xe909f8=events[_0x09e1('0x5')];_0x74fff9<_0xe909f8;_0x74fff9++){var _0x38c30a=events[_0x74fff9];var _0x11444e=createListener('whatsappQueue:'+_0x38c30a,_0x220d1c);WhatsappQueueEvents['on'](_0x38c30a,_0x11444e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 3bd2f81..2ca6b38 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 _0xf300=['./whatsappQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0xf300,0x16c));var _0x0f30=function(_0x3f6c29,_0x370d86){_0x3f6c29=_0x3f6c29-0x0;var _0x4af959=_0xf300[_0x3f6c29];return _0x4af959;};'use strict';var multer=require(_0x0f30('0x0'));var util=require(_0x0f30('0x1'));var path=require(_0x0f30('0x2'));var timeout=require(_0x0f30('0x3'));var express=require(_0x0f30('0x4'));var router=express[_0x0f30('0x5')]();var fs_extra=require(_0x0f30('0x6'));var auth=require(_0x0f30('0x7'));var interaction=require(_0x0f30('0x8'));var config=require(_0x0f30('0x9'));var controller=require(_0x0f30('0xa'));router['get']('/',auth[_0x0f30('0xb')](),controller[_0x0f30('0xc')]);router[_0x0f30('0xd')]('/describe',auth[_0x0f30('0xb')](),controller[_0x0f30('0xe')]);router[_0x0f30('0xd')](_0x0f30('0xf'),auth['isAuthenticated'](),controller[_0x0f30('0x10')]);router[_0x0f30('0x11')]('/',auth[_0x0f30('0xb')](),controller[_0x0f30('0x12')]);router['put'](_0x0f30('0xf'),auth[_0x0f30('0xb')](),controller[_0x0f30('0x13')]);router[_0x0f30('0x14')]('/:id',auth[_0x0f30('0xb')](),controller[_0x0f30('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd74b=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0xd74b,0x191));var _0xbd74=function(_0x32af76,_0x25b99c){_0x32af76=_0x32af76-0x0;var _0x5193b9=_0xd74b[_0x32af76];return _0x5193b9;};'use strict';var multer=require(_0xbd74('0x0'));var util=require(_0xbd74('0x1'));var path=require(_0xbd74('0x2'));var timeout=require(_0xbd74('0x3'));var express=require(_0xbd74('0x4'));var router=express[_0xbd74('0x5')]();var fs_extra=require(_0xbd74('0x6'));var auth=require(_0xbd74('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbd74('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0xbd74('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xbd74('0xa')](),controller[_0xbd74('0xb')]);router[_0xbd74('0x9')](_0xbd74('0xc'),auth['isAuthenticated'](),controller[_0xbd74('0xd')]);router[_0xbd74('0xe')]('/',auth[_0xbd74('0xa')](),controller[_0xbd74('0xf')]);router[_0xbd74('0x10')]('/:id',auth[_0xbd74('0xa')](),controller[_0xbd74('0x11')]);router[_0xbd74('0x12')](_0xbd74('0xc'),auth[_0xbd74('0xa')](),controller[_0xbd74('0x13')]);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 db94cf2..f1e6352 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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x19477d,_0x1c4259){var _0x3cb9ba=function(_0x228fa3){while(--_0x228fa3){_0x19477d['push'](_0x19477d['shift']());}};_0x3cb9ba(++_0x1c4259);}(_0x7a54,0x106));var _0x47a5=function(_0x252221,_0x2f6150){_0x252221=_0x252221-0x0;var _0x588e04=_0x7a54[_0x252221];return _0x588e04;};'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 +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3992af,_0x23a173){var _0x45cf2b=function(_0x522f20){while(--_0x522f20){_0x3992af['push'](_0x3992af['shift']());}};_0x45cf2b(++_0x23a173);}(_0x7a54,0x106));var _0x47a5=function(_0x101c18,_0x360765){_0x101c18=_0x101c18-0x0;var _0x4d9b8f=_0x7a54[_0x101c18];return _0x4d9b8f;};'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 b165a47..5610abf 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 _0x9ffd=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../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','update','then','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1f2916,_0x597f5a){_0x1f2916=_0x1f2916-0x0;var _0x56436f=_0x9ffd[_0x1f2916];return _0x56436f;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];function respondWithStatusCode(_0x47d842,_0x47b0d7){_0x47b0d7=_0x47b0d7||0xcc;return function(_0xaaf7af){if(_0xaaf7af){return _0x47d842[_0xd9ff('0x1a')](_0x47b0d7);}return _0x47d842[_0xd9ff('0x1b')](_0x47b0d7)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x12c39a,_0x556aa4){_0x556aa4=_0x556aa4||0xc8;return function(_0x2f78c1){if(_0x2f78c1){return _0x12c39a[_0xd9ff('0x1b')](_0x556aa4)['json'](_0x2f78c1);}};}function respondWithFilteredResult(_0xf14c9f,_0x5db010){return function(_0x4ffe54){if(_0x4ffe54){var _0x547e28=typeof _0x5db010['offset']===_0xd9ff('0x1d')&&typeof _0x5db010['limit']===_0xd9ff('0x1d');var _0xa30fd2=_0x4ffe54[_0xd9ff('0x1e')];var _0x3afd19=_0x547e28?0x0:_0x5db010[_0xd9ff('0x1f')];var _0x2d4df1=_0x547e28?_0x4ffe54[_0xd9ff('0x1e')]:_0x5db010[_0xd9ff('0x1f')]+_0x5db010[_0xd9ff('0x20')];var _0x1f028f;if(_0x2d4df1>=_0xa30fd2){_0x2d4df1=_0xa30fd2;_0x1f028f=0xc8;}else{_0x1f028f=0xce;}_0xf14c9f[_0xd9ff('0x1b')](_0x1f028f);return _0xf14c9f[_0xd9ff('0x21')](_0xd9ff('0x22'),_0x3afd19+'-'+_0x2d4df1+'/'+_0xa30fd2)['json'](_0x4ffe54);}return null;};}function patchUpdates(_0x4cf8ec){return function(_0x264a3d){try{jsonpatch[_0xd9ff('0x23')](_0x264a3d,_0x4cf8ec,!![]);}catch(_0x4eea4d){return BPromise['reject'](_0x4eea4d);}return _0x264a3d['save']();};}function saveUpdates(_0x4b1477,_0x1f4d9e){return function(_0x58eb5f){if(_0x58eb5f){return _0x58eb5f[_0xd9ff('0x24')](_0x4b1477)[_0xd9ff('0x25')](function(_0x291f52){return _0x291f52;});}return null;};}function removeEntity(_0x9f074e,_0x278b66){return function(_0x42a828){if(_0x42a828){return _0x42a828['destroy']()['then'](function(){_0x9f074e[_0xd9ff('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ca906,_0x4d86fe){return function(_0x285002){if(!_0x285002){_0x3ca906['sendStatus'](0x194);}return _0x285002;};}function handleError(_0x10cbdd,_0x159e56){_0x159e56=_0x159e56||0x1f4;return function(_0x2138b4){logger[_0xd9ff('0x26')](_0x2138b4['stack']);if(_0x2138b4[_0xd9ff('0x27')]){delete _0x2138b4[_0xd9ff('0x27')];}_0x10cbdd[_0xd9ff('0x1b')](_0x159e56)[_0xd9ff('0x28')](_0x2138b4);};}exports['index']=function(_0x1d3684,_0x3792d9){var _0x44b5a7={},_0x45fb63={},_0x263d3a={'count':0x0,'rows':[]};var _0xe516e2=_[_0xd9ff('0x29')](db[_0xd9ff('0x2a')][_0xd9ff('0x2b')],function(_0x5706cf){return{'name':_0x5706cf[_0xd9ff('0x2c')],'type':_0x5706cf['type'][_0xd9ff('0x2d')]};});_0x45fb63[_0xd9ff('0x2e')]=_[_0xd9ff('0x29')](_0xe516e2,'name');_0x45fb63[_0xd9ff('0x2f')]=_[_0xd9ff('0x30')](_0x1d3684[_0xd9ff('0x2f')]);_0x45fb63[_0xd9ff('0x31')]=_['intersection'](_0x45fb63[_0xd9ff('0x2e')],_0x45fb63['query']);_0x44b5a7[_0xd9ff('0x32')]=_[_0xd9ff('0x33')](_0x45fb63[_0xd9ff('0x2e')],qs[_0xd9ff('0x34')](_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x34')]));_0x44b5a7[_0xd9ff('0x32')]=_0x44b5a7[_0xd9ff('0x32')][_0xd9ff('0x35')]?_0x44b5a7[_0xd9ff('0x32')]:_0x45fb63[_0xd9ff('0x2e')];if(!_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x36')](_0xd9ff('0x37'))){_0x44b5a7['limit']=qs[_0xd9ff('0x20')](_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x20')]);_0x44b5a7['offset']=qs[_0xd9ff('0x1f')](_0x1d3684['query'][_0xd9ff('0x1f')]);}_0x44b5a7['order']=qs[_0xd9ff('0x38')](_0x1d3684['query'][_0xd9ff('0x38')]);_0x44b5a7[_0xd9ff('0x39')]=qs[_0xd9ff('0x31')](_['pick'](_0x1d3684['query'],_0x45fb63['filters']),_0xe516e2);if(_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x3a')]){_0x44b5a7[_0xd9ff('0x39')]=_[_0xd9ff('0x3b')](_0x44b5a7[_0xd9ff('0x39')],{'$or':_[_0xd9ff('0x29')](_0xe516e2,function(_0x596d29){if(_0x596d29['type']!=='VIRTUAL'){var _0x316d93={};_0x316d93[_0x596d29[_0xd9ff('0x27')]]={'$like':'%'+_0x1d3684[_0xd9ff('0x2f')][_0xd9ff('0x3a')]+'%'};return _0x316d93;}})});}_0x44b5a7=_['merge']({},_0x44b5a7,_0x1d3684[_0xd9ff('0x3c')]);var _0x5b8e17={'where':_0x44b5a7[_0xd9ff('0x39')]};return db[_0xd9ff('0x2a')][_0xd9ff('0x1e')](_0x5b8e17)[_0xd9ff('0x25')](function(_0x59fc07){_0x263d3a[_0xd9ff('0x1e')]=_0x59fc07;if(_0x1d3684[_0xd9ff('0x2f')]['includeAll']){_0x44b5a7[_0xd9ff('0x3d')]=[{'all':!![]}];}return db[_0xd9ff('0x2a')][_0xd9ff('0x3e')](_0x44b5a7);})[_0xd9ff('0x25')](function(_0x1fe44d){_0x263d3a[_0xd9ff('0x3f')]=_0x1fe44d;return _0x263d3a;})['then'](respondWithFilteredResult(_0x3792d9,_0x44b5a7))[_0xd9ff('0x40')](handleError(_0x3792d9,null));};exports[_0xd9ff('0x41')]=function(_0x10533a,_0x39fbbb){var _0x472724={'raw':!![],'where':{'id':_0x10533a[_0xd9ff('0x42')]['id']}},_0x52aab8={};_0x52aab8[_0xd9ff('0x2e')]=_[_0xd9ff('0x30')](db['WhatsappQueueReport']['rawAttributes']);_0x52aab8[_0xd9ff('0x2f')]=_[_0xd9ff('0x30')](_0x10533a[_0xd9ff('0x2f')]);_0x52aab8[_0xd9ff('0x31')]=_[_0xd9ff('0x33')](_0x52aab8[_0xd9ff('0x2e')],_0x52aab8['query']);_0x472724[_0xd9ff('0x32')]=_[_0xd9ff('0x33')](_0x52aab8['model'],qs[_0xd9ff('0x34')](_0x10533a[_0xd9ff('0x2f')][_0xd9ff('0x34')]));_0x472724[_0xd9ff('0x32')]=_0x472724[_0xd9ff('0x32')]['length']?_0x472724['attributes']:_0x52aab8['model'];if(_0x10533a[_0xd9ff('0x2f')]['includeAll']){_0x472724[_0xd9ff('0x3d')]=[{'all':!![]}];}_0x472724=_[_0xd9ff('0x3b')]({},_0x472724,_0x10533a[_0xd9ff('0x3c')]);return db['WhatsappQueueReport'][_0xd9ff('0x43')](_0x472724)[_0xd9ff('0x25')](handleEntityNotFound(_0x39fbbb,null))['then'](respondWithResult(_0x39fbbb,null))[_0xd9ff('0x40')](handleError(_0x39fbbb,null));};exports[_0xd9ff('0x44')]=function(_0x23b224,_0x316854){return db['WhatsappQueueReport'][_0xd9ff('0x44')](_0x23b224['body'],{})[_0xd9ff('0x25')](respondWithResult(_0x316854,0xc9))['catch'](handleError(_0x316854,null));};exports[_0xd9ff('0x24')]=function(_0x3d91e6,_0x2bf37a){if(_0x3d91e6[_0xd9ff('0x45')]['id']){delete _0x3d91e6[_0xd9ff('0x45')]['id'];}return db['WhatsappQueueReport'][_0xd9ff('0x43')]({'where':{'id':_0x3d91e6[_0xd9ff('0x42')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x2bf37a,null))[_0xd9ff('0x25')](saveUpdates(_0x3d91e6['body'],null))['then'](respondWithResult(_0x2bf37a,null))['catch'](handleError(_0x2bf37a,null));};exports[_0xd9ff('0x46')]=function(_0x40be56,_0x29c6bd){return db['WhatsappQueueReport'][_0xd9ff('0x43')]({'where':{'id':_0x40be56[_0xd9ff('0x42')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x29c6bd,null))[_0xd9ff('0x25')](removeEntity(_0x29c6bd,null))[_0xd9ff('0x40')](handleError(_0x29c6bd,null));};exports[_0xd9ff('0x47')]=function(_0x43a8ae,_0x1e1364){return db[_0xd9ff('0x2a')][_0xd9ff('0x47')]()[_0xd9ff('0x25')](respondWithResult(_0x1e1364,null))[_0xd9ff('0x40')](handleError(_0x1e1364,null));}; \ No newline at end of file +var _0x2032=['body','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','rows','show','params','keys','rawAttributes','includeAll','find','catch'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0x2032,0xd9));var _0x2203=function(_0x52cfe2,_0x55c331){_0x52cfe2=_0x52cfe2-0x0;var _0x524544=_0x2032[_0x52cfe2];return _0x524544;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'all':!![]}];}return db[_0x2203('0x2c')]['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x446209){_0x34b8ba[_0x2203('0x3f')]=_0x446209;return _0x34b8ba;})['then'](respondWithFilteredResult(_0x1df508,_0x9c53f))['catch'](handleError(_0x1df508,null));};exports[_0x2203('0x40')]=function(_0x3739f6,_0x368444){var _0x1e09f3={'raw':!![],'where':{'id':_0x3739f6[_0x2203('0x41')]['id']}},_0x372709={};_0x372709['model']=_[_0x2203('0x42')](db[_0x2203('0x2c')][_0x2203('0x43')]);_0x372709[_0x2203('0x30')]=_[_0x2203('0x42')](_0x3739f6[_0x2203('0x30')]);_0x372709[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x372709[_0x2203('0x31')],_0x372709[_0x2203('0x30')]);_0x1e09f3['attributes']=_[_0x2203('0x33')](_0x372709[_0x2203('0x31')],qs[_0x2203('0x34')](_0x3739f6[_0x2203('0x30')]['fields']));_0x1e09f3['attributes']=_0x1e09f3[_0x2203('0x32')]['length']?_0x1e09f3[_0x2203('0x32')]:_0x372709[_0x2203('0x31')];if(_0x3739f6[_0x2203('0x30')][_0x2203('0x44')]){_0x1e09f3['include']=[{'all':!![]}];}_0x1e09f3=_[_0x2203('0x3c')]({},_0x1e09f3,_0x3739f6[_0x2203('0x3e')]);return db['WhatsappQueueReport'][_0x2203('0x45')](_0x1e09f3)[_0x2203('0x23')](handleEntityNotFound(_0x368444,null))[_0x2203('0x23')](respondWithResult(_0x368444,null))[_0x2203('0x46')](handleError(_0x368444,null));};exports['create']=function(_0x4c1a29,_0x21b8ab){return db['WhatsappQueueReport']['create'](_0x4c1a29[_0x2203('0x47')],{})[_0x2203('0x23')](respondWithResult(_0x21b8ab,0xc9))[_0x2203('0x46')](handleError(_0x21b8ab,null));};exports['update']=function(_0x4c1496,_0x131aec){if(_0x4c1496[_0x2203('0x47')]['id']){delete _0x4c1496[_0x2203('0x47')]['id'];}return db[_0x2203('0x2c')][_0x2203('0x45')]({'where':{'id':_0x4c1496[_0x2203('0x41')]['id']}})['then'](handleEntityNotFound(_0x131aec,null))[_0x2203('0x23')](saveUpdates(_0x4c1496['body'],null))[_0x2203('0x23')](respondWithResult(_0x131aec,null))[_0x2203('0x46')](handleError(_0x131aec,null));};exports[_0x2203('0x24')]=function(_0x1e49dd,_0x58b9bb){return db['WhatsappQueueReport'][_0x2203('0x45')]({'where':{'id':_0x1e49dd[_0x2203('0x41')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x58b9bb,null))[_0x2203('0x23')](removeEntity(_0x58b9bb,null))['catch'](handleError(_0x58b9bb,null));};exports['describe']=function(_0x49999a,_0x4064d5){return db[_0x2203('0x2c')]['describe']()[_0x2203('0x23')](respondWithResult(_0x4064d5,null))[_0x2203('0x46')](handleError(_0x4064d5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 45ed1d1..442a0b4 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 _0xcd7e=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','api','bluebird','path','rimraf'];(function(_0x28496e,_0x1c5e82){var _0x1e5334=function(_0x4965c8){while(--_0x4965c8){_0x28496e['push'](_0x28496e['shift']());}};_0x1e5334(++_0x1c5e82);}(_0xcd7e,0x150));var _0xecd7=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0xcd7e[_0x2cc8bb];return _0x140e40;};'use strict';var _=require('lodash');var util=require(_0xecd7('0x0'));var logger=require('../../config/logger')(_0xecd7('0x1'));var moment=require('moment');var BPromise=require(_0xecd7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xecd7('0x3'));var rimraf=require(_0xecd7('0x4'));var config=require('../../config/environment');var attributes=require(_0xecd7('0x5'));module[_0xecd7('0x6')]=function(_0x1fb0b5,_0x2dd6d4){return _0x1fb0b5[_0xecd7('0x7')](_0xecd7('0x8'),attributes,{'tableName':_0xecd7('0x9'),'paranoid':![],'indexes':[{'name':_0xecd7('0xa'),'fields':[_0xecd7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43e0=['rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','../../config/logger','api','request-promise','path'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x43e0,0xbc));var _0x043e=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x43e0[_0x2112d4];return _0x434972;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x043e('0x0'))(_0x043e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x043e('0x2'));var fs=require('fs');var path=require(_0x043e('0x3'));var rimraf=require(_0x043e('0x4'));var config=require(_0x043e('0x5'));var attributes=require(_0x043e('0x6'));module[_0x043e('0x7')]=function(_0x15cb42,_0x251535){return _0x15cb42[_0x043e('0x8')](_0x043e('0x9'),attributes,{'tableName':_0x043e('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x043e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 4fd9c24..47eb583 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 _0x7882=['stringify','UpdateWhatsappQueueReport','where','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then'];(function(_0x7fac60,_0x2cb009){var _0x5bcfac=function(_0x15da63){while(--_0x15da63){_0x7fac60['push'](_0x7fac60['shift']());}};_0x5bcfac(++_0x2cb009);}(_0x7882,0x184));var _0x2788=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x7882[_0x1db831];return _0x39ba56;};'use strict';var _=require(_0x2788('0x0'));var util=require(_0x2788('0x1'));var moment=require(_0x2788('0x2'));var BPromise=require(_0x2788('0x3'));var rs=require(_0x2788('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2788('0x5'));var logger=require(_0x2788('0x6'))(_0x2788('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2788('0x8')][_0x2788('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x547f3a,_0xf53f4c,_0x56da91){return new BPromise(function(_0x2162c0,_0x3f858e){return client[_0x2788('0xa')](_0x547f3a,_0x56da91)['then'](function(_0x59974c){logger[_0x2788('0xb')](_0x2788('0xc'),_0xf53f4c,_0x2788('0xd'));logger[_0x2788('0xe')](_0x2788('0xf'),_0xf53f4c,'request\x20sent',JSON['stringify'](_0x59974c));if(_0x59974c[_0x2788('0x10')]){if(_0x59974c['error'][_0x2788('0x11')]===0x1f4){logger['error'](_0x2788('0xc'),_0xf53f4c,_0x59974c[_0x2788('0x10')][_0x2788('0x12')]);return _0x3f858e(_0x59974c['error'][_0x2788('0x12')]);}logger['error'](_0x2788('0xc'),_0xf53f4c,_0x59974c[_0x2788('0x10')]['message']);return _0x2162c0(_0x59974c[_0x2788('0x10')][_0x2788('0x12')]);}else{logger[_0x2788('0xb')](_0x2788('0xc'),_0xf53f4c,'request\x20sent');_0x2162c0(_0x59974c[_0x2788('0x13')][_0x2788('0x12')]);}})[_0x2788('0x14')](function(_0x1731cd){logger['error'](_0x2788('0xc'),_0xf53f4c,_0x1731cd);_0x3f858e(_0x1731cd);});});}exports[_0x2788('0x15')]=function(_0x2b749f){var _0x4c3e3a=this;return new Promise(function(_0x10fb0b,_0x237c37){return db[_0x2788('0x16')][_0x2788('0x17')](_0x2b749f[_0x2788('0x18')],{'raw':_0x2b749f[_0x2788('0x19')]?_0x2b749f['options'][_0x2788('0x1a')]===undefined?!![]:![]:!![]})[_0x2788('0x1b')](function(_0x29ad92){logger[_0x2788('0xb')](_0x2788('0x15'),_0x2b749f);logger['debug']('CreateWhatsappQueueReport',_0x2b749f,JSON[_0x2788('0x1c')](_0x29ad92));_0x10fb0b(_0x29ad92);})[_0x2788('0x14')](function(_0x3ffb43){logger[_0x2788('0x10')](_0x2788('0x15'),_0x3ffb43[_0x2788('0x12')],_0x2b749f);_0x237c37(_0x4c3e3a['error'](0x1f4,_0x3ffb43[_0x2788('0x12')]));});});};exports[_0x2788('0x1d')]=function(_0x22a14a){var _0x259b27=this;return new Promise(function(_0x278884,_0x52df05){return db['WhatsappQueueReport']['update'](_0x22a14a[_0x2788('0x18')],{'raw':_0x22a14a['options']?_0x22a14a[_0x2788('0x19')][_0x2788('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22a14a[_0x2788('0x19')]?_0x22a14a[_0x2788('0x19')][_0x2788('0x1e')]||null:null,'attributes':_0x22a14a[_0x2788('0x19')]?_0x22a14a['options']['attributes']||null:null,'limit':_0x22a14a['options']?_0x22a14a[_0x2788('0x19')][_0x2788('0x1f')]||null:null})['then'](function(_0x4889d1){logger['info'](_0x2788('0x1d'),_0x22a14a);logger[_0x2788('0xe')](_0x2788('0x1d'),_0x22a14a,JSON['stringify'](_0x4889d1));_0x278884(_0x4889d1);})[_0x2788('0x14')](function(_0x5d660d){logger[_0x2788('0x10')](_0x2788('0x1d'),_0x5d660d[_0x2788('0x12')],_0x22a14a);_0x52df05(_0x259b27[_0x2788('0x10')](0x1f4,_0x5d660d[_0x2788('0x12')]));});});}; \ No newline at end of file +var _0xe8f8=['options','raw','stringify','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','WhatsappQueueReport,\x20%s,\x20%s','message','info','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body'];(function(_0x127675,_0x38abf6){var _0x13a8df=function(_0x53103a){while(--_0x53103a){_0x127675['push'](_0x127675['shift']());}};_0x13a8df(++_0x38abf6);}(_0xe8f8,0x17c));var _0x8e8f=function(_0xb2649e,_0x2871de){_0xb2649e=_0xb2649e-0x0;var _0x1d4c48=_0xe8f8[_0xb2649e];return _0x1d4c48;};'use strict';var _=require(_0x8e8f('0x0'));var util=require('util');var moment=require(_0x8e8f('0x1'));var BPromise=require(_0x8e8f('0x2'));var rs=require(_0x8e8f('0x3'));var fs=require('fs');var Redis=require(_0x8e8f('0x4'));var db=require(_0x8e8f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8e8f('0x6'));var config=require(_0x8e8f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8e8f('0x8')][_0x8e8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53b4bc,_0xa02284,_0x2c8f22){return new BPromise(function(_0x288834,_0x5b6a17){return client['request'](_0x53b4bc,_0x2c8f22)[_0x8e8f('0xa')](function(_0x129cf3){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0xa02284,_0x8e8f('0xb'));logger[_0x8e8f('0xc')](_0x8e8f('0xd'),_0xa02284,_0x8e8f('0xb'),JSON['stringify'](_0x129cf3));if(_0x129cf3[_0x8e8f('0xe')]){if(_0x129cf3['error']['code']===0x1f4){logger['error'](_0x8e8f('0xf'),_0xa02284,_0x129cf3['error'][_0x8e8f('0x10')]);return _0x5b6a17(_0x129cf3[_0x8e8f('0xe')][_0x8e8f('0x10')]);}logger[_0x8e8f('0xe')](_0x8e8f('0xf'),_0xa02284,_0x129cf3['error'][_0x8e8f('0x10')]);return _0x288834(_0x129cf3[_0x8e8f('0xe')][_0x8e8f('0x10')]);}else{logger[_0x8e8f('0x11')](_0x8e8f('0xf'),_0xa02284,_0x8e8f('0xb'));_0x288834(_0x129cf3['result'][_0x8e8f('0x10')]);}})[_0x8e8f('0x12')](function(_0x4f91ac){logger['error'](_0x8e8f('0xf'),_0xa02284,_0x4f91ac);_0x5b6a17(_0x4f91ac);});});}exports[_0x8e8f('0x13')]=function(_0x28a16b){var _0x54851e=this;return new Promise(function(_0x5af4c8,_0x5019ec){return db[_0x8e8f('0x14')][_0x8e8f('0x15')](_0x28a16b[_0x8e8f('0x16')],{'raw':_0x28a16b[_0x8e8f('0x17')]?_0x28a16b[_0x8e8f('0x17')][_0x8e8f('0x18')]===undefined?!![]:![]:!![]})[_0x8e8f('0xa')](function(_0x3fea24){logger[_0x8e8f('0x11')](_0x8e8f('0x13'),_0x28a16b);logger['debug'](_0x8e8f('0x13'),_0x28a16b,JSON[_0x8e8f('0x19')](_0x3fea24));_0x5af4c8(_0x3fea24);})[_0x8e8f('0x12')](function(_0x21e463){logger[_0x8e8f('0xe')](_0x8e8f('0x13'),_0x21e463[_0x8e8f('0x10')],_0x28a16b);_0x5019ec(_0x54851e[_0x8e8f('0xe')](0x1f4,_0x21e463['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x49e2fc){var _0x575d2e=this;return new Promise(function(_0x1c9e0e,_0xbb2106){return db['WhatsappQueueReport'][_0x8e8f('0x1a')](_0x49e2fc[_0x8e8f('0x16')],{'raw':_0x49e2fc[_0x8e8f('0x17')]?_0x49e2fc[_0x8e8f('0x17')][_0x8e8f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49e2fc[_0x8e8f('0x17')]?_0x49e2fc[_0x8e8f('0x17')][_0x8e8f('0x1b')]||null:null,'attributes':_0x49e2fc[_0x8e8f('0x17')]?_0x49e2fc[_0x8e8f('0x17')][_0x8e8f('0x1c')]||null:null,'limit':_0x49e2fc['options']?_0x49e2fc['options'][_0x8e8f('0x1d')]||null:null})[_0x8e8f('0xa')](function(_0x44d514){logger[_0x8e8f('0x11')]('UpdateWhatsappQueueReport',_0x49e2fc);logger[_0x8e8f('0xc')](_0x8e8f('0x1e'),_0x49e2fc,JSON[_0x8e8f('0x19')](_0x44d514));_0x1c9e0e(_0x44d514);})[_0x8e8f('0x12')](function(_0x38939a){logger['error'](_0x8e8f('0x1e'),_0x38939a[_0x8e8f('0x10')],_0x49e2fc);_0xbb2106(_0x575d2e[_0x8e8f('0xe')](0x1f4,_0x38939a[_0x8e8f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 444b1bc..64ff619 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 _0x9e1a=['fs-extra','../../components/interaction/service','./whatsappTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x9e1a,0x1c8));var _0xa9e1=function(_0x38deb8,_0x572466){_0x38deb8=_0x38deb8-0x0;var _0xae0a3b=_0x9e1a[_0x38deb8];return _0xae0a3b;};'use strict';var multer=require(_0xa9e1('0x0'));var util=require(_0xa9e1('0x1'));var path=require('path');var timeout=require(_0xa9e1('0x2'));var express=require(_0xa9e1('0x3'));var router=express['Router']();var fs_extra=require(_0xa9e1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa9e1('0x5'));var config=require('../../config/environment');var controller=require(_0xa9e1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa9e1('0x7')]);router[_0xa9e1('0x8')](_0xa9e1('0x9'),auth[_0xa9e1('0xa')](),controller[_0xa9e1('0xb')]);router[_0xa9e1('0x8')](_0xa9e1('0xc'),auth[_0xa9e1('0xa')](),controller[_0xa9e1('0xd')]);router[_0xa9e1('0xe')]('/',auth['isAuthenticated'](),controller[_0xa9e1('0xf')]);router[_0xa9e1('0x10')](_0xa9e1('0xc'),auth[_0xa9e1('0xa')](),controller[_0xa9e1('0x11')]);router['delete'](_0xa9e1('0xc'),auth[_0xa9e1('0xa')](),controller[_0xa9e1('0x12')]);module[_0xa9e1('0x13')]=router; \ No newline at end of file +var _0xa132=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','post','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa132,0x141));var _0x2a13=function(_0x18369d,_0x4792cd){_0x18369d=_0x18369d-0x0;var _0x1940ef=_0xa132[_0x18369d];return _0x1940ef;};'use strict';var multer=require(_0x2a13('0x0'));var util=require(_0x2a13('0x1'));var path=require('path');var timeout=require(_0x2a13('0x2'));var express=require(_0x2a13('0x3'));var router=express['Router']();var fs_extra=require(_0x2a13('0x4'));var auth=require(_0x2a13('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2a13('0x6'));var controller=require(_0x2a13('0x7'));router[_0x2a13('0x8')]('/',auth[_0x2a13('0x9')](),controller['index']);router[_0x2a13('0x8')](_0x2a13('0xa'),auth[_0x2a13('0x9')](),controller[_0x2a13('0xb')]);router['get']('/:id',auth[_0x2a13('0x9')](),controller['show']);router[_0x2a13('0xc')]('/',auth[_0x2a13('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2a13('0xd')]('/:id',auth[_0x2a13('0x9')](),controller[_0x2a13('0xe')]);module[_0x2a13('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index bfc278e..806d55b 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 _0x4959=['STRING','ENUM','account','queue','DATE'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x4959,0x9b));var _0x9495=function(_0x335575,_0x47fe74){_0x335575=_0x335575-0x0;var _0x8ac286=_0x4959[_0x335575];return _0x8ac286;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x9495('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x9495('0x1')](_0x9495('0x2'),'agent',_0x9495('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x9495('0x4')]}}; \ No newline at end of file +var _0x0e0f=['DATE','sequelize','ENUM','account','agent','queue'];(function(_0x3e5c53,_0x51c619){var _0x548c5f=function(_0x1bf593){while(--_0x1bf593){_0x3e5c53['push'](_0x3e5c53['shift']());}};_0x548c5f(++_0x51c619);}(_0x0e0f,0xe5));var _0xf0e0=function(_0x43291b,_0x447377){_0x43291b=_0x43291b-0x0;var _0x145239=_0x0e0f[_0x43291b];return _0x145239;};'use strict';var Sequelize=require(_0xf0e0('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf0e0('0x1')](_0xf0e0('0x2'),_0xf0e0('0x3'),_0xf0e0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf0e0('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index efb74c3..538b578 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 _0xdeff=['status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','index','WhatsappTransferReport','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','length','find','create','body','describe','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x25adba,_0x4d7fe6){var _0x34fd87=function(_0x44df43){while(--_0x44df43){_0x25adba['push'](_0x25adba['shift']());}};_0x34fd87(++_0x4d7fe6);}(_0xdeff,0x151));var _0xfdef=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0xdeff[_0x4605dc];return _0x5d3e81;};'use strict';var emlformat=require(_0xfdef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfdef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfdef('0x2'));var moment=require('moment');var BPromise=require(_0xfdef('0x3'));var Mustache=require('mustache');var util=require(_0xfdef('0x4'));var path=require(_0xfdef('0x5'));var sox=require(_0xfdef('0x6'));var csv=require(_0xfdef('0x7'));var ejs=require(_0xfdef('0x8'));var fs=require('fs');var fs_extra=require(_0xfdef('0x9'));var _=require('lodash');var squel=require(_0xfdef('0xa'));var crypto=require(_0xfdef('0xb'));var jsforce=require(_0xfdef('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfdef('0x7'));var querystring=require('querystring');var Papa=require(_0xfdef('0xd'));var Redis=require(_0xfdef('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfdef('0xf'));var as=require(_0xfdef('0x10'));var hardwareService=require(_0xfdef('0x11'));var logger=require(_0xfdef('0x12'))(_0xfdef('0x13'));var utils=require('../../config/utils');var config=require(_0xfdef('0x14'));var licenseUtil=require(_0xfdef('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e3f21,_0x1b012a){_0x1b012a=_0x1b012a||0xcc;return function(_0x40e629){if(_0x40e629){return _0x5e3f21[_0xfdef('0x16')](_0x1b012a);}return _0x5e3f21[_0xfdef('0x17')](_0x1b012a)[_0xfdef('0x18')]();};}function respondWithResult(_0x3e521d,_0x3ec5e2){_0x3ec5e2=_0x3ec5e2||0xc8;return function(_0x1dcf30){if(_0x1dcf30){return _0x3e521d[_0xfdef('0x17')](_0x3ec5e2)[_0xfdef('0x19')](_0x1dcf30);}};}function respondWithFilteredResult(_0x2baf5c,_0x1c8ec2){return function(_0x228344){if(_0x228344){var _0x2c90a6=typeof _0x1c8ec2['offset']===_0xfdef('0x1a')&&typeof _0x1c8ec2[_0xfdef('0x1b')]==='undefined';var _0x2c5c7c=_0x228344[_0xfdef('0x1c')];var _0x546ee9=_0x2c90a6?0x0:_0x1c8ec2[_0xfdef('0x1d')];var _0x4d27cb=_0x2c90a6?_0x228344[_0xfdef('0x1c')]:_0x1c8ec2[_0xfdef('0x1d')]+_0x1c8ec2[_0xfdef('0x1b')];var _0x30f5a9;if(_0x4d27cb>=_0x2c5c7c){_0x4d27cb=_0x2c5c7c;_0x30f5a9=0xc8;}else{_0x30f5a9=0xce;}_0x2baf5c[_0xfdef('0x17')](_0x30f5a9);return _0x2baf5c[_0xfdef('0x1e')](_0xfdef('0x1f'),_0x546ee9+'-'+_0x4d27cb+'/'+_0x2c5c7c)[_0xfdef('0x19')](_0x228344);}return null;};}function patchUpdates(_0x10bfe8){return function(_0x1abbdf){try{jsonpatch[_0xfdef('0x20')](_0x1abbdf,_0x10bfe8,!![]);}catch(_0x22d56c){return BPromise['reject'](_0x22d56c);}return _0x1abbdf['save']();};}function saveUpdates(_0x3f8b17,_0x3c5279){return function(_0x1804ed){if(_0x1804ed){return _0x1804ed[_0xfdef('0x21')](_0x3f8b17)[_0xfdef('0x22')](function(_0x5f2402){return _0x5f2402;});}return null;};}function removeEntity(_0xe009be,_0x467b58){return function(_0x511340){if(_0x511340){return _0x511340[_0xfdef('0x23')]()['then'](function(){_0xe009be['status'](0xcc)[_0xfdef('0x18')]();});}};}function handleEntityNotFound(_0x5a9f4c,_0x40361f){return function(_0x1fdca3){if(!_0x1fdca3){_0x5a9f4c[_0xfdef('0x16')](0x194);}return _0x1fdca3;};}function handleError(_0x355fec,_0x4fd454){_0x4fd454=_0x4fd454||0x1f4;return function(_0xfe4a40){logger[_0xfdef('0x24')](_0xfe4a40[_0xfdef('0x25')]);if(_0xfe4a40[_0xfdef('0x26')]){delete _0xfe4a40[_0xfdef('0x26')];}_0x355fec[_0xfdef('0x17')](_0x4fd454)['send'](_0xfe4a40);};}exports[_0xfdef('0x27')]=function(_0x5ed5c0,_0x59f831){var _0x4dbcf7={},_0x2f90c5={},_0x3448a1={'count':0x0,'rows':[]};var _0xace958=_['map'](db[_0xfdef('0x28')][_0xfdef('0x29')],function(_0x1d852d){return{'name':_0x1d852d['fieldName'],'type':_0x1d852d[_0xfdef('0x2a')][_0xfdef('0x2b')]};});_0x2f90c5[_0xfdef('0x2c')]=_[_0xfdef('0x2d')](_0xace958,_0xfdef('0x26'));_0x2f90c5['query']=_[_0xfdef('0x2e')](_0x5ed5c0['query']);_0x2f90c5[_0xfdef('0x2f')]=_[_0xfdef('0x30')](_0x2f90c5[_0xfdef('0x2c')],_0x2f90c5[_0xfdef('0x31')]);_0x4dbcf7[_0xfdef('0x32')]=_[_0xfdef('0x30')](_0x2f90c5['model'],qs['fields'](_0x5ed5c0[_0xfdef('0x31')][_0xfdef('0x33')]));_0x4dbcf7[_0xfdef('0x32')]=_0x4dbcf7[_0xfdef('0x32')]['length']?_0x4dbcf7['attributes']:_0x2f90c5['model'];if(!_0x5ed5c0[_0xfdef('0x31')][_0xfdef('0x34')](_0xfdef('0x35'))){_0x4dbcf7[_0xfdef('0x1b')]=qs[_0xfdef('0x1b')](_0x5ed5c0[_0xfdef('0x31')][_0xfdef('0x1b')]);_0x4dbcf7[_0xfdef('0x1d')]=qs['offset'](_0x5ed5c0[_0xfdef('0x31')][_0xfdef('0x1d')]);}_0x4dbcf7[_0xfdef('0x36')]=qs[_0xfdef('0x37')](_0x5ed5c0[_0xfdef('0x31')][_0xfdef('0x37')]);_0x4dbcf7[_0xfdef('0x38')]=qs[_0xfdef('0x2f')](_[_0xfdef('0x39')](_0x5ed5c0[_0xfdef('0x31')],_0x2f90c5[_0xfdef('0x2f')]),_0xace958);if(_0x5ed5c0[_0xfdef('0x31')][_0xfdef('0x3a')]){_0x4dbcf7[_0xfdef('0x38')]=_['merge'](_0x4dbcf7[_0xfdef('0x38')],{'$or':_[_0xfdef('0x2d')](_0xace958,function(_0x1dc801){if(_0x1dc801[_0xfdef('0x2a')]!==_0xfdef('0x3b')){var _0x4eb1aa={};_0x4eb1aa[_0x1dc801[_0xfdef('0x26')]]={'$like':'%'+_0x5ed5c0[_0xfdef('0x31')][_0xfdef('0x3a')]+'%'};return _0x4eb1aa;}})});}_0x4dbcf7=_[_0xfdef('0x3c')]({},_0x4dbcf7,_0x5ed5c0[_0xfdef('0x3d')]);var _0x316a61={'where':_0x4dbcf7[_0xfdef('0x38')]};return db['WhatsappTransferReport']['count'](_0x316a61)['then'](function(_0x5814ee){_0x3448a1['count']=_0x5814ee;if(_0x5ed5c0[_0xfdef('0x31')][_0xfdef('0x3e')]){_0x4dbcf7[_0xfdef('0x3f')]=[{'all':!![]}];}return db[_0xfdef('0x28')]['findAll'](_0x4dbcf7);})[_0xfdef('0x22')](function(_0x2aaef4){_0x3448a1['rows']=_0x2aaef4;return _0x3448a1;})['then'](respondWithFilteredResult(_0x59f831,_0x4dbcf7))[_0xfdef('0x40')](handleError(_0x59f831,null));};exports[_0xfdef('0x41')]=function(_0x1ac690,_0x2e0e15){var _0x3c5e37={'raw':!![],'where':{'id':_0x1ac690[_0xfdef('0x42')]['id']}},_0x1fd5bc={};_0x1fd5bc['model']=_[_0xfdef('0x2e')](db[_0xfdef('0x28')][_0xfdef('0x29')]);_0x1fd5bc[_0xfdef('0x31')]=_[_0xfdef('0x2e')](_0x1ac690[_0xfdef('0x31')]);_0x1fd5bc[_0xfdef('0x2f')]=_[_0xfdef('0x30')](_0x1fd5bc['model'],_0x1fd5bc[_0xfdef('0x31')]);_0x3c5e37[_0xfdef('0x32')]=_[_0xfdef('0x30')](_0x1fd5bc[_0xfdef('0x2c')],qs[_0xfdef('0x33')](_0x1ac690[_0xfdef('0x31')]['fields']));_0x3c5e37['attributes']=_0x3c5e37[_0xfdef('0x32')][_0xfdef('0x43')]?_0x3c5e37['attributes']:_0x1fd5bc[_0xfdef('0x2c')];if(_0x1ac690[_0xfdef('0x31')]['includeAll']){_0x3c5e37[_0xfdef('0x3f')]=[{'all':!![]}];}_0x3c5e37=_[_0xfdef('0x3c')]({},_0x3c5e37,_0x1ac690['options']);return db[_0xfdef('0x28')][_0xfdef('0x44')](_0x3c5e37)[_0xfdef('0x22')](handleEntityNotFound(_0x2e0e15,null))[_0xfdef('0x22')](respondWithResult(_0x2e0e15,null))['catch'](handleError(_0x2e0e15,null));};exports[_0xfdef('0x45')]=function(_0x20338a,_0x2369fb){return db['WhatsappTransferReport']['create'](_0x20338a['body'],{})[_0xfdef('0x22')](respondWithResult(_0x2369fb,0xc9))[_0xfdef('0x40')](handleError(_0x2369fb,null));};exports[_0xfdef('0x21')]=function(_0x4e8dfe,_0x2f8a28){if(_0x4e8dfe[_0xfdef('0x46')]['id']){delete _0x4e8dfe[_0xfdef('0x46')]['id'];}return db['WhatsappTransferReport'][_0xfdef('0x44')]({'where':{'id':_0x4e8dfe[_0xfdef('0x42')]['id']}})[_0xfdef('0x22')](handleEntityNotFound(_0x2f8a28,null))[_0xfdef('0x22')](saveUpdates(_0x4e8dfe['body'],null))[_0xfdef('0x22')](respondWithResult(_0x2f8a28,null))[_0xfdef('0x40')](handleError(_0x2f8a28,null));};exports[_0xfdef('0x23')]=function(_0x188414,_0x394dff){return db[_0xfdef('0x28')]['find']({'where':{'id':_0x188414['params']['id']}})[_0xfdef('0x22')](handleEntityNotFound(_0x394dff,null))[_0xfdef('0x22')](removeEntity(_0x394dff,null))[_0xfdef('0x40')](handleError(_0x394dff,null));};exports[_0xfdef('0x47')]=function(_0x1e53be,_0x586f78){return db[_0xfdef('0x28')][_0xfdef('0x47')]()[_0xfdef('0x22')](respondWithResult(_0x586f78,null))[_0xfdef('0x40')](handleError(_0x586f78,null));}; \ No newline at end of file +var _0x0551=['nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','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','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x26930f,_0x2d582e){var _0x22ec6e=function(_0x128073){while(--_0x128073){_0x26930f['push'](_0x26930f['shift']());}};_0x22ec6e(++_0x2d582e);}(_0x0551,0x191));var _0x1055=function(_0x2937ea,_0x43a2a9){_0x2937ea=_0x2937ea-0x0;var _0x40b81b=_0x0551[_0x2937ea];return _0x40b81b;};'use strict';var emlformat=require(_0x1055('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1055('0x1'));var jsonpatch=require(_0x1055('0x2'));var rp=require(_0x1055('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1055('0x4'));var path=require(_0x1055('0x5'));var sox=require(_0x1055('0x6'));var csv=require(_0x1055('0x7'));var ejs=require(_0x1055('0x8'));var fs=require('fs');var fs_extra=require(_0x1055('0x9'));var _=require(_0x1055('0xa'));var squel=require(_0x1055('0xb'));var crypto=require(_0x1055('0xc'));var jsforce=require(_0x1055('0xd'));var deskjs=require(_0x1055('0xe'));var toCsv=require(_0x1055('0x7'));var querystring=require(_0x1055('0xf'));var Papa=require(_0x1055('0x10'));var Redis=require(_0x1055('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1055('0x12'));var hardwareService=require(_0x1055('0x13'));var logger=require(_0x1055('0x14'))(_0x1055('0x15'));var utils=require(_0x1055('0x16'));var config=require(_0x1055('0x17'));var licenseUtil=require(_0x1055('0x18'));var db=require(_0x1055('0x19'))['db'];function respondWithStatusCode(_0x2c6a11,_0x2504cc){_0x2504cc=_0x2504cc||0xcc;return function(_0xdbc707){if(_0xdbc707){return _0x2c6a11['sendStatus'](_0x2504cc);}return _0x2c6a11[_0x1055('0x1a')](_0x2504cc)[_0x1055('0x1b')]();};}function respondWithResult(_0x54047c,_0x5ce599){_0x5ce599=_0x5ce599||0xc8;return function(_0x57bb24){if(_0x57bb24){return _0x54047c[_0x1055('0x1a')](_0x5ce599)[_0x1055('0x1c')](_0x57bb24);}};}function respondWithFilteredResult(_0x1f80dd,_0x1c1aa1){return function(_0xbec1cb){if(_0xbec1cb){var _0x5be15d=typeof _0x1c1aa1[_0x1055('0x1d')]===_0x1055('0x1e')&&typeof _0x1c1aa1[_0x1055('0x1f')]===_0x1055('0x1e');var _0x269f21=_0xbec1cb[_0x1055('0x20')];var _0x438e05=_0x5be15d?0x0:_0x1c1aa1['offset'];var _0x250ce4=_0x5be15d?_0xbec1cb[_0x1055('0x20')]:_0x1c1aa1[_0x1055('0x1d')]+_0x1c1aa1[_0x1055('0x1f')];var _0x27d83c;if(_0x250ce4>=_0x269f21){_0x250ce4=_0x269f21;_0x27d83c=0xc8;}else{_0x27d83c=0xce;}_0x1f80dd[_0x1055('0x1a')](_0x27d83c);return _0x1f80dd[_0x1055('0x21')](_0x1055('0x22'),_0x438e05+'-'+_0x250ce4+'/'+_0x269f21)['json'](_0xbec1cb);}return null;};}function patchUpdates(_0x11338a){return function(_0x238262){try{jsonpatch['apply'](_0x238262,_0x11338a,!![]);}catch(_0x275d39){return BPromise[_0x1055('0x23')](_0x275d39);}return _0x238262[_0x1055('0x24')]();};}function saveUpdates(_0x5e577f,_0x466ae0){return function(_0x4d8319){if(_0x4d8319){return _0x4d8319[_0x1055('0x25')](_0x5e577f)[_0x1055('0x26')](function(_0x50daa2){return _0x50daa2;});}return null;};}function removeEntity(_0x80da24,_0x258e1e){return function(_0x36c9ed){if(_0x36c9ed){return _0x36c9ed[_0x1055('0x27')]()[_0x1055('0x26')](function(){_0x80da24[_0x1055('0x1a')](0xcc)[_0x1055('0x1b')]();});}};}function handleEntityNotFound(_0x5cac2d,_0x4eb893){return function(_0x4107ce){if(!_0x4107ce){_0x5cac2d[_0x1055('0x28')](0x194);}return _0x4107ce;};}function handleError(_0x40d25b,_0x12dc0a){_0x12dc0a=_0x12dc0a||0x1f4;return function(_0x362ce1){logger['error'](_0x362ce1[_0x1055('0x29')]);if(_0x362ce1['name']){delete _0x362ce1[_0x1055('0x2a')];}_0x40d25b[_0x1055('0x1a')](_0x12dc0a)['send'](_0x362ce1);};}exports['index']=function(_0x2aa7f7,_0x431093){var _0x4743c6={},_0x131cae={},_0x13500a={'count':0x0,'rows':[]};var _0x2af14f=_[_0x1055('0x2b')](db[_0x1055('0x2c')][_0x1055('0x2d')],function(_0x36887d){return{'name':_0x36887d[_0x1055('0x2e')],'type':_0x36887d[_0x1055('0x2f')]['key']};});_0x131cae[_0x1055('0x30')]=_[_0x1055('0x2b')](_0x2af14f,_0x1055('0x2a'));_0x131cae['query']=_['keys'](_0x2aa7f7[_0x1055('0x31')]);_0x131cae['filters']=_[_0x1055('0x32')](_0x131cae[_0x1055('0x30')],_0x131cae['query']);_0x4743c6[_0x1055('0x33')]=_[_0x1055('0x32')](_0x131cae[_0x1055('0x30')],qs[_0x1055('0x34')](_0x2aa7f7[_0x1055('0x31')][_0x1055('0x34')]));_0x4743c6[_0x1055('0x33')]=_0x4743c6[_0x1055('0x33')][_0x1055('0x35')]?_0x4743c6[_0x1055('0x33')]:_0x131cae[_0x1055('0x30')];if(!_0x2aa7f7[_0x1055('0x31')][_0x1055('0x36')](_0x1055('0x37'))){_0x4743c6[_0x1055('0x1f')]=qs['limit'](_0x2aa7f7['query'][_0x1055('0x1f')]);_0x4743c6[_0x1055('0x1d')]=qs[_0x1055('0x1d')](_0x2aa7f7['query']['offset']);}_0x4743c6[_0x1055('0x38')]=qs[_0x1055('0x39')](_0x2aa7f7['query'][_0x1055('0x39')]);_0x4743c6[_0x1055('0x3a')]=qs[_0x1055('0x3b')](_[_0x1055('0x3c')](_0x2aa7f7[_0x1055('0x31')],_0x131cae['filters']),_0x2af14f);if(_0x2aa7f7[_0x1055('0x31')]['filter']){_0x4743c6[_0x1055('0x3a')]=_[_0x1055('0x3d')](_0x4743c6['where'],{'$or':_[_0x1055('0x2b')](_0x2af14f,function(_0x2fdf67){if(_0x2fdf67[_0x1055('0x2f')]!==_0x1055('0x3e')){var _0x32827b={};_0x32827b[_0x2fdf67[_0x1055('0x2a')]]={'$like':'%'+_0x2aa7f7[_0x1055('0x31')][_0x1055('0x3f')]+'%'};return _0x32827b;}})});}_0x4743c6=_[_0x1055('0x3d')]({},_0x4743c6,_0x2aa7f7['options']);var _0x181414={'where':_0x4743c6[_0x1055('0x3a')]};return db[_0x1055('0x2c')][_0x1055('0x20')](_0x181414)[_0x1055('0x26')](function(_0x5696fd){_0x13500a[_0x1055('0x20')]=_0x5696fd;if(_0x2aa7f7[_0x1055('0x31')][_0x1055('0x40')]){_0x4743c6[_0x1055('0x41')]=[{'all':!![]}];}return db[_0x1055('0x2c')][_0x1055('0x42')](_0x4743c6);})[_0x1055('0x26')](function(_0x15e6f9){_0x13500a[_0x1055('0x43')]=_0x15e6f9;return _0x13500a;})['then'](respondWithFilteredResult(_0x431093,_0x4743c6))[_0x1055('0x44')](handleError(_0x431093,null));};exports[_0x1055('0x45')]=function(_0x3a7506,_0x5716c4){var _0x2f347f={'raw':!![],'where':{'id':_0x3a7506[_0x1055('0x46')]['id']}},_0x642ea8={};_0x642ea8[_0x1055('0x30')]=_[_0x1055('0x47')](db[_0x1055('0x2c')][_0x1055('0x2d')]);_0x642ea8[_0x1055('0x31')]=_['keys'](_0x3a7506['query']);_0x642ea8[_0x1055('0x3b')]=_[_0x1055('0x32')](_0x642ea8['model'],_0x642ea8[_0x1055('0x31')]);_0x2f347f[_0x1055('0x33')]=_['intersection'](_0x642ea8[_0x1055('0x30')],qs[_0x1055('0x34')](_0x3a7506['query']['fields']));_0x2f347f[_0x1055('0x33')]=_0x2f347f[_0x1055('0x33')][_0x1055('0x35')]?_0x2f347f['attributes']:_0x642ea8[_0x1055('0x30')];if(_0x3a7506[_0x1055('0x31')]['includeAll']){_0x2f347f['include']=[{'all':!![]}];}_0x2f347f=_[_0x1055('0x3d')]({},_0x2f347f,_0x3a7506[_0x1055('0x48')]);return db[_0x1055('0x2c')][_0x1055('0x49')](_0x2f347f)['then'](handleEntityNotFound(_0x5716c4,null))[_0x1055('0x26')](respondWithResult(_0x5716c4,null))['catch'](handleError(_0x5716c4,null));};exports[_0x1055('0x4a')]=function(_0x364420,_0x4d53fd){return db[_0x1055('0x2c')][_0x1055('0x4a')](_0x364420[_0x1055('0x4b')],{})[_0x1055('0x26')](respondWithResult(_0x4d53fd,0xc9))['catch'](handleError(_0x4d53fd,null));};exports[_0x1055('0x25')]=function(_0x587272,_0x5790c2){if(_0x587272[_0x1055('0x4b')]['id']){delete _0x587272['body']['id'];}return db[_0x1055('0x2c')]['find']({'where':{'id':_0x587272[_0x1055('0x46')]['id']}})[_0x1055('0x26')](handleEntityNotFound(_0x5790c2,null))[_0x1055('0x26')](saveUpdates(_0x587272[_0x1055('0x4b')],null))['then'](respondWithResult(_0x5790c2,null))['catch'](handleError(_0x5790c2,null));};exports[_0x1055('0x27')]=function(_0x911a67,_0x254173){return db[_0x1055('0x2c')][_0x1055('0x49')]({'where':{'id':_0x911a67[_0x1055('0x46')]['id']}})[_0x1055('0x26')](handleEntityNotFound(_0x254173,null))['then'](removeEntity(_0x254173,null))[_0x1055('0x44')](handleError(_0x254173,null));};exports['describe']=function(_0x15d8c5,_0x2f9535){return db[_0x1055('0x2c')]['describe']()['then'](respondWithResult(_0x2f9535,null))[_0x1055('0x44')](handleError(_0x2f9535,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 55665f4..a0f6957 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 _0x49d3=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','exports'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x49d3,0x153));var _0x349d=function(_0x347503,_0x10238c){_0x347503=_0x347503-0x0;var _0x3b2ebd=_0x49d3[_0x347503];return _0x3b2ebd;};'use strict';var _=require(_0x349d('0x0'));var util=require('util');var logger=require(_0x349d('0x1'))(_0x349d('0x2'));var moment=require(_0x349d('0x3'));var BPromise=require(_0x349d('0x4'));var rp=require(_0x349d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x349d('0x6'));var attributes=require(_0x349d('0x7'));module[_0x349d('0x8')]=function(_0x3d9924,_0x478e28){return _0x3d9924['define'](_0x349d('0x9'),attributes,{'tableName':_0x349d('0xa'),'paranoid':![],'indexes':[{'name':_0x349d('0xb'),'fields':[_0x349d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6e69=['rimraf','../../config/environment','./whatsappTransferReport.attributes','define','report_whatsapp_transfer','uniqueid','lodash','api','request-promise','path'];(function(_0x1b43af,_0x501993){var _0x363e42=function(_0x25ae42){while(--_0x25ae42){_0x1b43af['push'](_0x1b43af['shift']());}};_0x363e42(++_0x501993);}(_0x6e69,0x132));var _0x96e6=function(_0x5a4919,_0xa2eb04){_0x5a4919=_0x5a4919-0x0;var _0x44a57b=_0x6e69[_0x5a4919];return _0x44a57b;};'use strict';var _=require(_0x96e6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x96e6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x96e6('0x2'));var fs=require('fs');var path=require(_0x96e6('0x3'));var rimraf=require(_0x96e6('0x4'));var config=require(_0x96e6('0x5'));var attributes=require(_0x96e6('0x6'));module['exports']=function(_0x58ea31,_0x59fd27){return _0x58ea31[_0x96e6('0x7')]('WhatsappTransferReport',attributes,{'tableName':_0x96e6('0x8'),'paranoid':![],'indexes':[{'name':_0x96e6('0x9'),'fields':[_0x96e6('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index be46d10..a3a17f6 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 _0x37ec=['client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4d6fc9,_0x5b472a){var _0x2e906b=function(_0x7c1eb2){while(--_0x7c1eb2){_0x4d6fc9['push'](_0x4d6fc9['shift']());}};_0x2e906b(++_0x5b472a);}(_0x37ec,0x1ed));var _0xc37e=function(_0x4e9211,_0x4d707f){_0x4e9211=_0x4e9211-0x0;var _0xf35ab6=_0x37ec[_0x4e9211];return _0xf35ab6;};'use strict';var _=require(_0xc37e('0x0'));var util=require(_0xc37e('0x1'));var moment=require(_0xc37e('0x2'));var BPromise=require(_0xc37e('0x3'));var rs=require(_0xc37e('0x4'));var fs=require('fs');var Redis=require(_0xc37e('0x5'));var db=require(_0xc37e('0x6'))['db'];var utils=require(_0xc37e('0x7'));var logger=require(_0xc37e('0x8'))(_0xc37e('0x9'));var config=require('../../config/environment');var jayson=require(_0xc37e('0xa'));var client=jayson[_0xc37e('0xb')][_0xc37e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x241824,_0x5f5263,_0x554df4){return new BPromise(function(_0x2c670f,_0xa40f12){return client[_0xc37e('0xd')](_0x241824,_0x554df4)[_0xc37e('0xe')](function(_0x57879a){logger[_0xc37e('0xf')](_0xc37e('0x10'),_0x5f5263,_0xc37e('0x11'));logger[_0xc37e('0x12')](_0xc37e('0x13'),_0x5f5263,_0xc37e('0x11'),JSON[_0xc37e('0x14')](_0x57879a));if(_0x57879a['error']){if(_0x57879a[_0xc37e('0x15')][_0xc37e('0x16')]===0x1f4){logger[_0xc37e('0x15')](_0xc37e('0x10'),_0x5f5263,_0x57879a[_0xc37e('0x15')][_0xc37e('0x17')]);return _0xa40f12(_0x57879a['error'][_0xc37e('0x17')]);}logger[_0xc37e('0x15')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5f5263,_0x57879a['error'][_0xc37e('0x17')]);return _0x2c670f(_0x57879a[_0xc37e('0x15')]['message']);}else{logger[_0xc37e('0xf')](_0xc37e('0x10'),_0x5f5263,'request\x20sent');_0x2c670f(_0x57879a['result'][_0xc37e('0x17')]);}})['catch'](function(_0x210bbe){logger[_0xc37e('0x15')](_0xc37e('0x10'),_0x5f5263,_0x210bbe);_0xa40f12(_0x210bbe);});});} \ No newline at end of file +var _0x37f8=['http','request','info','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x1ef547,_0x31bfdb){var _0x1d697b=function(_0x57fbdc){while(--_0x57fbdc){_0x1ef547['push'](_0x1ef547['shift']());}};_0x1d697b(++_0x31bfdb);}(_0x37f8,0x88));var _0x837f=function(_0x3f0fad,_0x3eaea0){_0x3f0fad=_0x3f0fad-0x0;var _0x1015c8=_0x37f8[_0x3f0fad];return _0x1015c8;};'use strict';var _=require(_0x837f('0x0'));var util=require(_0x837f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x837f('0x2'));var fs=require('fs');var Redis=require(_0x837f('0x3'));var db=require(_0x837f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x837f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x837f('0x6'));var client=jayson[_0x837f('0x7')][_0x837f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34f89a,_0x5a58b1,_0x39d904){return new BPromise(function(_0x59fff5,_0x378872){return client[_0x837f('0x9')](_0x34f89a,_0x39d904)['then'](function(_0x58efc7){logger[_0x837f('0xa')](_0x837f('0xb'),_0x5a58b1,'request\x20sent');logger[_0x837f('0xc')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x5a58b1,_0x837f('0xd'),JSON[_0x837f('0xe')](_0x58efc7));if(_0x58efc7['error']){if(_0x58efc7[_0x837f('0xf')]['code']===0x1f4){logger[_0x837f('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5a58b1,_0x58efc7['error'][_0x837f('0x10')]);return _0x378872(_0x58efc7[_0x837f('0xf')][_0x837f('0x10')]);}logger[_0x837f('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5a58b1,_0x58efc7['error'][_0x837f('0x10')]);return _0x59fff5(_0x58efc7[_0x837f('0xf')]['message']);}else{logger[_0x837f('0xa')](_0x837f('0xb'),_0x5a58b1,'request\x20sent');_0x59fff5(_0x58efc7['result'][_0x837f('0x10')]);}})[_0x837f('0x11')](function(_0x46885a){logger[_0x837f('0xf')](_0x837f('0xb'),_0x5a58b1,_0x46885a);_0x378872(_0x46885a);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 83c8dec..6852c5e 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbcba=['App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','default','then','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','None','log'];(function(_0x552660,_0x220535){var _0x4d3a54=function(_0x1212a2){while(--_0x1212a2){_0x552660['push'](_0x552660['shift']());}};_0x4d3a54(++_0x220535);}(_0xbcba,0x6d));var _0xabcb=function(_0x3ac536,_0x5a3d21){_0x3ac536=_0x3ac536-0x0;var _0x237843=_0xbcba[_0x3ac536];return _0x237843;};'use strict';var _=require(_0xabcb('0x0'));var db=require(_0xabcb('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xabcb('0x2'));var rpc=require(_0xabcb('0x3'));var config=require(_0xabcb('0x4'));var logger=require(_0xabcb('0x5'))(_0xabcb('0x6'));var pm2=require(_0xabcb('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0xabcb('0x8'));var whatsapp=require(_0xabcb('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xabcb('0xa')][_0xabcb('0xb')]()['then'](function(){if(config['seedDB']){return seedDb[_0xabcb('0xc')]();}})['then'](function(){return checkLicense[_0xabcb('0xc')]();})[_0xabcb('0xd')](function(){return rpc[_0xabcb('0xe')]();})[_0xabcb('0xd')](function(_0x4d2585){logger[_0xabcb('0xf')](_0x4d2585);return chat[_0xabcb('0x10')]();})[_0xabcb('0xd')](function(){return whatsapp[_0xabcb('0x10')]();})[_0xabcb('0xd')](function(){return schedule[_0xabcb('0x10')]();})[_0xabcb('0xd')](function(){return transcribe[_0xabcb('0x10')]();})['then'](function(){return provider[_0xabcb('0x10')]();})[_0xabcb('0xd')](function(_0x3fb92d){logger[_0xabcb('0xf')](_0x3fb92d);return pm2[_0xabcb('0x10')](pm2Config);})[_0xabcb('0xd')](function(_0x5672c1){var _0x1790c6=_0x5672c1[_0xabcb('0x11')](function(_0x18d526){return typeof _0x18d526[_0xabcb('0x12')]===_0xabcb('0x13')&&_0x18d526[_0xabcb('0x12')]>=0x0;});if(_0x1790c6[_0xabcb('0x14')]>0x0){throw new Error(_0x1790c6[_0xabcb('0x14')]+_0xabcb('0x15')+_[_0xabcb('0x16')](_0x1790c6,function(_0x48dd27){return'\x22'+_0x48dd27[_0xabcb('0x17')][_0xabcb('0x18')]+'\x22';}));}logger[_0xabcb('0xf')](_0xabcb('0x19'),_[_0xabcb('0x16')](_[_0xabcb('0x11')](_0x5672c1,{'status':_0xabcb('0x1a')}),_0xabcb('0x18'))[_0xabcb('0x1b')]());logger[_0xabcb('0xf')](_0xabcb('0x1c'),_[_0xabcb('0x16')](_[_0xabcb('0x11')](_0x5672c1,function(_0x850a6e){return _0x850a6e['status']!=='online';}),'name')[_0xabcb('0x1b')]()||_0xabcb('0x1d'));console[_0xabcb('0x1e')](_0xabcb('0x1f'));})[_0xabcb('0x20')](function(_0x495d3c){console[_0xabcb('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x495d3c);logger['error'](_0xabcb('0x21'),_0x495d3c);process[_0xabcb('0x22')](0x1);});}main(); \ No newline at end of file +var _0x1c3b=['exit','lodash','./mysqldb','./config/seedDB','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','default','then','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s'];(function(_0x3970b5,_0x579fbd){var _0x4d06fb=function(_0xe140dd){while(--_0xe140dd){_0x3970b5['push'](_0x3970b5['shift']());}};_0x4d06fb(++_0x579fbd);}(_0x1c3b,0xab));var _0xb1c3=function(_0x55da1a,_0x23af5b){_0x55da1a=_0x55da1a-0x0;var _0x30d23e=_0x1c3b[_0x55da1a];return _0x30d23e;};'use strict';var _=require(_0xb1c3('0x0'));var db=require(_0xb1c3('0x1'))['db'];var seedDb=require(_0xb1c3('0x2'));var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require(_0xb1c3('0x3'));var logger=require(_0xb1c3('0x4'))(_0xb1c3('0x5'));var pm2=require(_0xb1c3('0x6'));var pm2Config=require(_0xb1c3('0x7'));var schedule=require(_0xb1c3('0x8'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xb1c3('0x9'));var transcribe=require(_0xb1c3('0xa'));var provider=require(_0xb1c3('0xb'));function main(){return db['sequelize']['sync']()['then'](function(){if(config['seedDB']){return seedDb[_0xb1c3('0xc')]();}})['then'](function(){return checkLicense[_0xb1c3('0xc')]();})[_0xb1c3('0xd')](function(){return rpc[_0xb1c3('0xe')]();})['then'](function(_0x226a88){logger[_0xb1c3('0xf')](_0x226a88);return chat[_0xb1c3('0x10')]();})['then'](function(){return whatsapp[_0xb1c3('0x10')]();})[_0xb1c3('0xd')](function(){return schedule[_0xb1c3('0x10')]();})[_0xb1c3('0xd')](function(){return transcribe['start']();})[_0xb1c3('0xd')](function(){return provider[_0xb1c3('0x10')]();})[_0xb1c3('0xd')](function(_0x4ddc03){logger[_0xb1c3('0xf')](_0x4ddc03);return pm2[_0xb1c3('0x10')](pm2Config);})['then'](function(_0x1eb0fa){var _0x1e9620=_0x1eb0fa[_0xb1c3('0x11')](function(_0x378d7a){return typeof _0x378d7a[_0xb1c3('0x12')]==='number'&&_0x378d7a[_0xb1c3('0x12')]>=0x0;});if(_0x1e9620[_0xb1c3('0x13')]>0x0){throw new Error(_0x1e9620[_0xb1c3('0x13')]+_0xb1c3('0x14')+_[_0xb1c3('0x15')](_0x1e9620,function(_0x599810){return'\x22'+_0x599810[_0xb1c3('0x16')][_0xb1c3('0x17')]+'\x22';}));}logger[_0xb1c3('0xf')](_0xb1c3('0x18'),_[_0xb1c3('0x15')](_[_0xb1c3('0x11')](_0x1eb0fa,{'status':_0xb1c3('0x19')}),_0xb1c3('0x17'))[_0xb1c3('0x1a')]());logger[_0xb1c3('0xf')](_0xb1c3('0x1b'),_[_0xb1c3('0x15')](_[_0xb1c3('0x11')](_0x1eb0fa,function(_0x5a0950){return _0x5a0950[_0xb1c3('0x1c')]!==_0xb1c3('0x19');}),_0xb1c3('0x17'))[_0xb1c3('0x1a')]()||_0xb1c3('0x1d'));console[_0xb1c3('0x1e')]('App\x20Ready!');})['catch'](function(_0x328cfb){console[_0xb1c3('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x328cfb);logger[_0xb1c3('0x1f')](_0xb1c3('0x20'),_0x328cfb);process[_0xb1c3('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index af2078c..d96d235 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 _0xf430=['findOne','params','closed','disposition','then','forceDownload','status','json','unmanaged','Unmanaged.','Forbidden.','use','headers','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','query','getUuid','apikey','Setting','allowedLoginAttempts','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','user','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','encryptString','join','sign','secret','options','promisify','randomBytes','hex','now','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','name','internal','email','userpic','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','ChatInteraction'];(function(_0x5ed865,_0x540964){var _0x2d8d23=function(_0x1f9cda){while(--_0x1f9cda){_0x5ed865['push'](_0x5ed865['shift']());}};_0x2d8d23(++_0x540964);}(_0xf430,0xd6));var _0x0f43=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0xf430[_0x448f8];return _0xa73126;};'use strict';var db=require(_0x0f43('0x0'))['db'];var config=require(_0x0f43('0x1'));var hardwareConf=require(_0x0f43('0x2'));var licenseUtil=require(_0x0f43('0x3'));var encryptor=require(_0x0f43('0x4'));var _=require(_0x0f43('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0x0f43('0x6'));var basicAuth=require(_0x0f43('0x7'));var crypto=require(_0x0f43('0x8'));var BPromise=require(_0x0f43('0x9'));var util=require(_0x0f43('0xa'));var moment=require(_0x0f43('0xb'));var validateJwt=expressJwt({'secret':config[_0x0f43('0xc')][_0x0f43('0xd')]});var userAttributes=['id',_0x0f43('0xe'),'fullname',_0x0f43('0xf'),_0x0f43('0x10'),_0x0f43('0x11'),_0x0f43('0x12'),'permissions',_0x0f43('0x13'),_0x0f43('0x14'),_0x0f43('0x15'),_0x0f43('0x16'),_0x0f43('0x17'),_0x0f43('0x18'),_0x0f43('0x19'),'pauseType',_0x0f43('0x1a'),_0x0f43('0x1b'),_0x0f43('0x1c'),_0x0f43('0x1d'),'allowmessenger',_0x0f43('0x1e'),_0x0f43('0x1f'),_0x0f43('0x20'),_0x0f43('0x21'),_0x0f43('0x22'),_0x0f43('0x23'),_0x0f43('0x24'),'phoneBarEnableSettings','phoneBarExpires',_0x0f43('0x25'),_0x0f43('0x26'),_0x0f43('0x27'),'hotdesk',_0x0f43('0x28'),'userProfileId',_0x0f43('0x29'),'settingsEnabled',_0x0f43('0x2a'),_0x0f43('0x2b'),_0x0f43('0x2c'),_0x0f43('0x2d'),_0x0f43('0x2e'),_0x0f43('0x2f'),_0x0f43('0x30'),_0x0f43('0x31'),'emailAutoanswer',_0x0f43('0x32'),_0x0f43('0x33'),_0x0f43('0x34'),_0x0f43('0x35'),_0x0f43('0x36'),_0x0f43('0x37'),_0x0f43('0x38'),_0x0f43('0x39'),_0x0f43('0x3a'),'messengerSoundNotification'];exports[_0x0f43('0x3b')]=function(){return this[_0x0f43('0x3c')](!![])['use'](function(_0xe63ef6,_0x371fbb,_0x22fa17){if(_0xe63ef6['user']){_0x22fa17();}else{return db[_0x0f43('0x3d')][_0x0f43('0x3e')]({'where':{'id':_0xe63ef6[_0x0f43('0x3f')]['id']},'attributes':['id',_0x0f43('0x40'),_0x0f43('0x41')],'raw':!![]})[_0x0f43('0x42')](function(_0x12a750){if(_0x12a750&&_0x12a750[_0x0f43('0x40')]&&!_0xe63ef6['query'][_0x0f43('0x43')]){return _0x371fbb[_0x0f43('0x44')](_0x12a750['disposition']==='unmanaged'?0x195:0x193)[_0x0f43('0x45')]({'message':_0x12a750['disposition']===_0x0f43('0x46')?_0x0f43('0x47'):_0x0f43('0x48')});}else{_0x22fa17();}})['catch'](function(_0x5031ac){_0x22fa17(_0x5031ac);});}});};exports[_0x0f43('0x3c')]=function isAuthenticated(_0x34d1b8){return compose()[_0x0f43('0x49')](function(_0x4bdfbe,_0x1f7ecf,_0x37fc80){var _0x25f81b;if(_0x4bdfbe[_0x0f43('0x4a')]['authorization']){if(_[_0x0f43('0x4b')](_0x4bdfbe[_0x0f43('0x4a')]['authorization'],_0x0f43('0x4c'))){var _0x17b168=basicAuth(_0x4bdfbe);db[_0x0f43('0x4d')][_0x0f43('0x4e')]({'where':{'name':_0x17b168[_0x0f43('0xf')]}})[_0x0f43('0x42')](function(_0x555654){if(!_0x555654||!_0x555654[_0x0f43('0x4f')](_0x17b168[_0x0f43('0x50')])){return _0x1f7ecf['status'](0x191)[_0x0f43('0x45')]({'message':_0x0f43('0x51')});}_0x4bdfbe['user']={'id':_0x555654['id']};_0x37fc80();})[_0x0f43('0x52')](function(_0x50db8d){_0x37fc80(_0x50db8d);});}else if(_[_0x0f43('0x4b')](_0x4bdfbe['headers']['authorization'],'Bearer')){validateJwt(_0x4bdfbe,_0x1f7ecf,_0x37fc80);}else{if(_0x34d1b8){_0x37fc80();}else{return _0x1f7ecf[_0x0f43('0x44')](0x193)[_0x0f43('0x45')]({'message':_0x0f43('0x53')});}}}else if(_0x4bdfbe[_0x0f43('0x54')]['apikey']){try{var _0x55eda4={'audience':hardwareConf[_0x0f43('0x55')](),'issuer':hardwareConf[_0x0f43('0x55')]()};verifyJwt(_0x4bdfbe['query'][_0x0f43('0x56')],_0x55eda4)[_0x0f43('0x42')](function(_0x2a6a53){return db[_0x0f43('0x4d')][_0x0f43('0x4e')]({'where':{'id':_0x2a6a53['sub']}})['then'](function(_0x15308f){_0x25f81b=_0x15308f;return db[_0x0f43('0x57')][_0x0f43('0x3e')]({'where':{'id':0x1},'attributes':[_0x0f43('0x58'),'blockDuration'],'raw':!![]});})['then'](function(_0x21774d){if(!_0x25f81b||!_['isEqual'](_0x25f81b[_0x0f43('0x59')],_0x2a6a53[_0x0f43('0x5a')])){return _0x1f7ecf[_0x0f43('0x44')](0x191)[_0x0f43('0x45')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x25f81b[_0x0f43('0x5b')]){return _0x1f7ecf[_0x0f43('0x44')](0x191)[_0x0f43('0x45')]({'message':_0x0f43('0x5c')});}if(_0x25f81b[_0x0f43('0x5d')]){if(_0x21774d[_0x0f43('0x5e')]>0x0){if(moment(_0x25f81b[_0x0f43('0x5f')])[_0x0f43('0x60')](_0x21774d['blockDuration'],_0x0f43('0x61'))>moment()){return _0x1f7ecf[_0x0f43('0x44')](0x191)[_0x0f43('0x45')]({'message':_0x0f43('0x5c')});}}else{return _0x1f7ecf[_0x0f43('0x44')](0x191)[_0x0f43('0x45')]({'message':_0x0f43('0x5c')});}}_0x4bdfbe[_0x0f43('0x62')]={'id':_0x25f81b['id']};_0x37fc80();});})[_0x0f43('0x52')](function(){return _0x1f7ecf[_0x0f43('0x44')](0x191)[_0x0f43('0x45')]({'message':_0x0f43('0x5c')});});}catch(_0x1fe5fd){_0x37fc80(_0x1fe5fd);}}else if(_0x34d1b8){_0x37fc80();}else{return _0x1f7ecf[_0x0f43('0x44')](0x193)[_0x0f43('0x45')]({'message':_0x0f43('0x53')});}})[_0x0f43('0x49')](function(_0x2d2d71,_0x4f3eab,_0x380f04){if(_0x2d2d71[_0x0f43('0x62')]){db[_0x0f43('0x4d')]['find']({'where':{'id':_0x2d2d71['user']['id']},'attributes':userAttributes})[_0x0f43('0x42')](function(_0xf6c5ae){if(!_0xf6c5ae){return _0x4f3eab['status'](0x194)[_0x0f43('0x45')]({'message':_0x0f43('0x63')});}_0x2d2d71[_0x0f43('0x62')]=_0xf6c5ae;_0x380f04();})['catch'](function(_0x52a858){_0x380f04(_0x52a858);});}else if(_0x34d1b8){_0x380f04();}else{return _0x4f3eab[_0x0f43('0x44')](0x194)[_0x0f43('0x45')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x0f43('0x64')]=function canUpdate(){return compose()['use'](function(_0x12db70,_0xd6ac41,_0x5ccc76){return licenseUtil[_0x0f43('0x65')]()[_0x0f43('0x42')](function(_0x4623e0){if(_0x4623e0[_0x0f43('0x66')]){_0x5ccc76();}else{return _0xd6ac41[_0x0f43('0x44')](0x193)['json']({'message':_0x0f43('0x67')});}})['catch'](function(_0x4d325c){_0x5ccc76(_0x4d325c);});});};exports[_0x0f43('0x68')]=function isWebrtcLicence(){return compose()[_0x0f43('0x49')](function(_0x28316d,_0xd555e6,_0x20ea25){return licenseUtil[_0x0f43('0x65')]()['then'](function(_0x2ff125){if(_0x2ff125[_0x0f43('0x69')]){_0x20ea25();}else{return _0xd555e6[_0x0f43('0x44')](0x193)[_0x0f43('0x45')]({'message':_0x0f43('0x67')});}})[_0x0f43('0x52')](function(_0x2c0790){_0x20ea25(_0x2c0790);});});};exports['isMiddleware']=function(_0x40f21d,_0x23bba8,_0x25f93a){_0x40f21d[_0x0f43('0x6a')]=!![];return _0x25f93a();};exports[_0x0f43('0x6b')]=function signToken(_0x158eff){return signJwt(_0x158eff);};exports['setTokenCookie']=function(_0x4174f2,_0xe981ad){if(!_0x4174f2[_0x0f43('0x62')]){return _0xe981ad[_0x0f43('0x44')](0x194)[_0x0f43('0x45')]({'message':_0x0f43('0x6c')});}var _0x3c20dd={'payload':{'id':_0x4174f2[_0x0f43('0x62')]['id'],'role':_0x4174f2['user'][_0x0f43('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3c20dd)[_0x0f43('0x42')](function(_0x439504){_0xe981ad['cookie'](_0x0f43('0x6d'),_0x439504);_0xe981ad[_0x0f43('0x6e')]('/dashboards/general');})['catch'](function(_0x20c5b0){return _0xe981ad[_0x0f43('0x44')](0x1f4)[_0x0f43('0x6f')](_0x20c5b0);});};exports['retrieveApiKey']=function(_0xb94d81){if(_['isNil'](_0xb94d81[_0x0f43('0x59')])||_[_0x0f43('0x70')](_0xb94d81[_0x0f43('0x71')])){return null;}else{return createJwt(_0xb94d81);}};exports[_0x0f43('0x72')]=function(_0x5f4e0d){_0x5f4e0d[_0x0f43('0x59')]=generateNonce();_0x5f4e0d[_0x0f43('0x71')]=generateIssuedAt();return createJwt(_0x5f4e0d);};exports[_0x0f43('0x73')]=function(_0x29b981,_0x42a52c){var _0x2a598a=_0x29b981['query'][_0x0f43('0x56')];if(_0x2a598a){var _0xc78266={'nonce':_0x42a52c[_0x0f43('0x59')],'iat':_0x42a52c[_0x0f43('0x71')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x0f43('0x55')]()};return verifyJwt(_0x2a598a,_0xc78266)['then'](function(){return generateApiKey(_0x42a52c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x0f43('0x74')]=function(_0x9b0c80){var _0x44bad0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x44bad0[_0x0f43('0x75')](_0x9b0c80))throw new db[(_0x0f43('0x76'))][(_0x0f43('0x77'))](_0x0f43('0x78'));return;};exports[_0x0f43('0x79')]=function(_0x5815b6,_0x57b6f6,_0x4b489b){var _0x5e2c51=encryptor[_0x0f43('0x7a')](_0x57b6f6)[_0x0f43('0x7b')](',');for(var _0x3f36dc=0x0;_0x3f36dc<_0x4b489b;_0x3f36dc++){if(!_0x5e2c51[_0x3f36dc])break;if(_0x5815b6['toLowerCase']()===_0x5e2c51[_0x3f36dc]['toLowerCase']()){var _0x309aaf=util[_0x0f43('0x7c')](_0x0f43('0x7d'),_0x4b489b);if(_0x4b489b===0x1){_0x309aaf=_0x0f43('0x7e');}throw new db[(_0x0f43('0x76'))][(_0x0f43('0x77'))](_0x309aaf);}}return;};exports[_0x0f43('0x7f')]=function(_0x2da1f9,_0x4f52b3){var _0x45fe2c=_0x4f52b3?encryptor[_0x0f43('0x7a')](_0x4f52b3)[_0x0f43('0x7b')](','):[];if(_0x45fe2c['length']===0x5){_0x45fe2c['splice'](-0x1,0x1);}_0x45fe2c['unshift'](_0x2da1f9);return encryptor[_0x0f43('0x80')](_0x45fe2c[_0x0f43('0x81')](','));};function signJwt(_0xcf44f){var _0x3228a0=BPromise['promisify'](jwt[_0x0f43('0x82')],{'context':jwt});var _0x47e7b0=_0xcf44f[_0x0f43('0x83')]||config[_0x0f43('0xc')]['session'];return new BPromise(function(_0x4fad5f,_0x548201){_0x3228a0(_0xcf44f['payload'],_0x47e7b0,_0xcf44f[_0x0f43('0x84')])[_0x0f43('0x42')](function(_0x2a4d47){_0x4fad5f(_0x2a4d47);})[_0x0f43('0x52')](function(_0x44a0e4){_0x548201(_0x44a0e4);});});}function verifyJwt(_0x4e305f,_0x3403c7,_0x5c18c8){var _0x50780e=BPromise[_0x0f43('0x85')](jwt['verify'],{'context':jwt});var _0x539af9=_0x5c18c8||config[_0x0f43('0xc')]['session'];return new BPromise(function(_0x1b2600,_0x5544b3){_0x50780e(_0x4e305f,_0x539af9,_0x3403c7)[_0x0f43('0x42')](function(_0x3257b6){_0x1b2600(_0x3257b6);})[_0x0f43('0x52')](function(_0x50f0c7){_0x5544b3(_0x50f0c7);});});}function generateNonce(){return crypto[_0x0f43('0x86')](0x10)['toString'](_0x0f43('0x87'));}function generateIssuedAt(){return Math['floor'](Date[_0x0f43('0x88')]()/0x3e8)[_0x0f43('0x89')]();}function createJwt(_0x5a8098){var _0x4a1d82={'payload':{'iat':_0x5a8098['apiKeyIat'],'nonce':_0x5a8098[_0x0f43('0x59')]},'options':{'algorithm':'HS512','subject':_0x5a8098['id'][_0x0f43('0x89')](),'issuer':hardwareConf[_0x0f43('0x55')](),'audience':hardwareConf[_0x0f43('0x55')]()}};return signJwt(_0x4a1d82)['then'](function(_0x11c98a){return{'iat':_0x5a8098[_0x0f43('0x71')],'nonce':_0x5a8098[_0x0f43('0x59')],'token':_0x11c98a};});} \ No newline at end of file +var _0x538a=['find','name','then','authenticate','pass','user','catch','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','unshift','encryptString','join','secret','session','payload','options','verify','randomBytes','floor','now','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','crypto','util','role','fullname','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','findOne','params','closed','disposition','query','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User'];(function(_0x595b9b,_0xa58ff){var _0x3be4c6=function(_0x324f94){while(--_0x324f94){_0x595b9b['push'](_0x595b9b['shift']());}};_0x3be4c6(++_0xa58ff);}(_0x538a,0x148));var _0xa538=function(_0x441205,_0x2e4055){_0x441205=_0x441205-0x0;var _0x5d2f0d=_0x538a[_0x441205];return _0x5d2f0d;};'use strict';var db=require(_0xa538('0x0'))['db'];var config=require(_0xa538('0x1'));var hardwareConf=require(_0xa538('0x2'));var licenseUtil=require(_0xa538('0x3'));var encryptor=require(_0xa538('0x4'));var _=require(_0xa538('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0xa538('0x6'));var BPromise=require('bluebird');var util=require(_0xa538('0x7'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xa538('0x8'),_0xa538('0x9'),'name',_0xa538('0xa'),_0xa538('0xb'),_0xa538('0xc'),_0xa538('0xd'),_0xa538('0xe'),'voicePause',_0xa538('0xf'),_0xa538('0x10'),_0xa538('0x11'),_0xa538('0x12'),_0xa538('0x13'),_0xa538('0x14'),_0xa538('0x15'),_0xa538('0x16'),_0xa538('0x17'),_0xa538('0x18'),'allowmessenger',_0xa538('0x19'),_0xa538('0x1a'),_0xa538('0x1b'),'phoneBarAutoAnswerDelay',_0xa538('0x1c'),'phoneBarEnableRecording',_0xa538('0x1d'),_0xa538('0x1e'),'phoneBarExpires',_0xa538('0x1f'),'phoneBarRemoteControl',_0xa538('0x20'),_0xa538('0x21'),_0xa538('0x22'),_0xa538('0x23'),'privacyEnabled','settingsEnabled',_0xa538('0x24'),_0xa538('0x25'),'downloadOmnichannelInteractions',_0xa538('0x26'),_0xa538('0x27'),_0xa538('0x28'),'chatAutoanswer',_0xa538('0x29'),'emailAutoanswer',_0xa538('0x2a'),_0xa538('0x2b'),_0xa538('0x2c'),_0xa538('0x2d'),'openchannelAutoanswerDelay',_0xa538('0x2e'),_0xa538('0x2f'),'whatsappAutoanswer','whatsappAutoanswerDelay',_0xa538('0x30')];exports[_0xa538('0x31')]=function(){return this[_0xa538('0x32')](!![])[_0xa538('0x33')](function(_0x313277,_0x17a291,_0x353b10){if(_0x313277['user']){_0x353b10();}else{return db['ChatInteraction'][_0xa538('0x34')]({'where':{'id':_0x313277[_0xa538('0x35')]['id']},'attributes':['id',_0xa538('0x36'),_0xa538('0x37')],'raw':!![]})['then'](function(_0x5824cf){if(_0x5824cf&&_0x5824cf['closed']&&!_0x313277[_0xa538('0x38')][_0xa538('0x39')]){return _0x17a291[_0xa538('0x3a')](_0x5824cf[_0xa538('0x37')]===_0xa538('0x3b')?0x195:0x193)[_0xa538('0x3c')]({'message':_0x5824cf['disposition']===_0xa538('0x3b')?_0xa538('0x3d'):_0xa538('0x3e')});}else{_0x353b10();}})['catch'](function(_0x32b3f5){_0x353b10(_0x32b3f5);});}});};exports[_0xa538('0x32')]=function isAuthenticated(_0x5410df){return compose()['use'](function(_0x3e7d9d,_0x55ac6d,_0x1097e2){var _0x44a310;if(_0x3e7d9d[_0xa538('0x3f')][_0xa538('0x40')]){if(_[_0xa538('0x41')](_0x3e7d9d['headers'][_0xa538('0x40')],_0xa538('0x42'))){var _0x592ad6=basicAuth(_0x3e7d9d);db[_0xa538('0x43')][_0xa538('0x44')]({'where':{'name':_0x592ad6[_0xa538('0x45')]}})[_0xa538('0x46')](function(_0x2bd324){if(!_0x2bd324||!_0x2bd324[_0xa538('0x47')](_0x592ad6[_0xa538('0x48')])){return _0x55ac6d[_0xa538('0x3a')](0x191)[_0xa538('0x3c')]({'message':'Wrong\x20credentials.'});}_0x3e7d9d[_0xa538('0x49')]={'id':_0x2bd324['id']};_0x1097e2();})[_0xa538('0x4a')](function(_0x58cf02){_0x1097e2(_0x58cf02);});}else if(_['startsWith'](_0x3e7d9d[_0xa538('0x3f')]['authorization'],_0xa538('0x4b'))){validateJwt(_0x3e7d9d,_0x55ac6d,_0x1097e2);}else{if(_0x5410df){_0x1097e2();}else{return _0x55ac6d[_0xa538('0x3a')](0x193)['json']({'message':_0xa538('0x4c')});}}}else if(_0x3e7d9d[_0xa538('0x38')][_0xa538('0x4d')]){try{var _0x34bf05={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa538('0x4e')]()};verifyJwt(_0x3e7d9d[_0xa538('0x38')][_0xa538('0x4d')],_0x34bf05)['then'](function(_0x16e275){return db[_0xa538('0x43')][_0xa538('0x44')]({'where':{'id':_0x16e275[_0xa538('0x4f')]}})[_0xa538('0x46')](function(_0x6d8ed5){_0x44a310=_0x6d8ed5;return db[_0xa538('0x50')][_0xa538('0x34')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa538('0x51')],'raw':!![]});})[_0xa538('0x46')](function(_0x3c8680){if(!_0x44a310||!_[_0xa538('0x52')](_0x44a310[_0xa538('0x53')],_0x16e275[_0xa538('0x54')])){return _0x55ac6d[_0xa538('0x3a')](0x191)[_0xa538('0x3c')]({'message':_0xa538('0x55')});}if(_0x44a310['disabled']){return _0x55ac6d[_0xa538('0x3a')](0x191)[_0xa538('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x44a310[_0xa538('0x56')]){if(_0x3c8680[_0xa538('0x51')]>0x0){if(moment(_0x44a310[_0xa538('0x57')])[_0xa538('0x58')](_0x3c8680[_0xa538('0x51')],_0xa538('0x59'))>moment()){return _0x55ac6d[_0xa538('0x3a')](0x191)[_0xa538('0x3c')]({'message':_0xa538('0x5a')});}}else{return _0x55ac6d[_0xa538('0x3a')](0x191)[_0xa538('0x3c')]({'message':_0xa538('0x5a')});}}_0x3e7d9d[_0xa538('0x49')]={'id':_0x44a310['id']};_0x1097e2();});})[_0xa538('0x4a')](function(){return _0x55ac6d[_0xa538('0x3a')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x2013c4){_0x1097e2(_0x2013c4);}}else if(_0x5410df){_0x1097e2();}else{return _0x55ac6d[_0xa538('0x3a')](0x193)[_0xa538('0x3c')]({'message':_0xa538('0x4c')});}})['use'](function(_0x2e13e1,_0x579000,_0x3bd7ea){if(_0x2e13e1[_0xa538('0x49')]){db[_0xa538('0x43')][_0xa538('0x44')]({'where':{'id':_0x2e13e1[_0xa538('0x49')]['id']},'attributes':userAttributes})[_0xa538('0x46')](function(_0x23948a){if(!_0x23948a){return _0x579000['status'](0x194)[_0xa538('0x3c')]({'message':_0xa538('0x5b')});}_0x2e13e1[_0xa538('0x49')]=_0x23948a;_0x3bd7ea();})[_0xa538('0x4a')](function(_0x22e1fe){_0x3bd7ea(_0x22e1fe);});}else if(_0x5410df){_0x3bd7ea();}else{return _0x579000[_0xa538('0x3a')](0x194)[_0xa538('0x3c')]({'message':_0xa538('0x5c')});}});};exports[_0xa538('0x5d')]=function canUpdate(){return compose()['use'](function(_0xb0af0f,_0x15da5d,_0x43083e){return licenseUtil['getLicense']()[_0xa538('0x46')](function(_0x32017e){if(_0x32017e[_0xa538('0x5e')]){_0x43083e();}else{return _0x15da5d[_0xa538('0x3a')](0x193)['json']({'message':_0xa538('0x5f')});}})['catch'](function(_0x2d7372){_0x43083e(_0x2d7372);});});};exports[_0xa538('0x60')]=function isWebrtcLicence(){return compose()[_0xa538('0x33')](function(_0x2c8d8d,_0x582762,_0x37e1ea){return licenseUtil[_0xa538('0x61')]()[_0xa538('0x46')](function(_0x2493d2){if(_0x2493d2['webrtc']){_0x37e1ea();}else{return _0x582762[_0xa538('0x3a')](0x193)[_0xa538('0x3c')]({'message':_0xa538('0x5f')});}})[_0xa538('0x4a')](function(_0x54241b){_0x37e1ea(_0x54241b);});});};exports[_0xa538('0x62')]=function(_0x585efe,_0x2ca0c6,_0x1ca492){_0x585efe[_0xa538('0x62')]=!![];return _0x1ca492();};exports[_0xa538('0x63')]=function signToken(_0x1a33f6){return signJwt(_0x1a33f6);};exports[_0xa538('0x64')]=function(_0x28bd8a,_0x5b8de5){if(!_0x28bd8a[_0xa538('0x49')]){return _0x5b8de5[_0xa538('0x3a')](0x194)['json']({'message':_0xa538('0x65')});}var _0x46ec00={'payload':{'id':_0x28bd8a[_0xa538('0x49')]['id'],'role':_0x28bd8a[_0xa538('0x49')][_0xa538('0x8')]},'options':{'expiresIn':0x15180}};return signJwt(_0x46ec00)['then'](function(_0x1f0653){_0x5b8de5[_0xa538('0x66')]('motion.token',_0x1f0653);_0x5b8de5[_0xa538('0x67')](_0xa538('0x68'));})[_0xa538('0x4a')](function(_0x4fadfe){return _0x5b8de5[_0xa538('0x3a')](0x1f4)[_0xa538('0x69')](_0x4fadfe);});};exports[_0xa538('0x6a')]=function(_0x4a83f1){if(_['isNil'](_0x4a83f1[_0xa538('0x53')])||_[_0xa538('0x6b')](_0x4a83f1[_0xa538('0x6c')])){return null;}else{return createJwt(_0x4a83f1);}};exports[_0xa538('0x6d')]=function(_0x43e275){_0x43e275[_0xa538('0x53')]=generateNonce();_0x43e275['apiKeyIat']=generateIssuedAt();return createJwt(_0x43e275);};exports['regenerateApiKey']=function(_0x8e01d6,_0x4c740f){var _0x5d0516=_0x8e01d6['query'][_0xa538('0x4d')];if(_0x5d0516){var _0x2178ff={'nonce':_0x4c740f[_0xa538('0x53')],'iat':_0x4c740f[_0xa538('0x6c')],'audience':hardwareConf[_0xa538('0x4e')](),'issuer':hardwareConf[_0xa538('0x4e')]()};return verifyJwt(_0x5d0516,_0x2178ff)['then'](function(){return generateApiKey(_0x4c740f);});}else{throw{'message':_0xa538('0x6e')};}};exports[_0xa538('0x6f')]=function(_0x19fffc){var _0x385fcf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x385fcf['test'](_0x19fffc))throw new db['Sequelize']['ValidationError'](_0xa538('0x70'));return;};exports[_0xa538('0x71')]=function(_0x26dab1,_0x552d21,_0x41d153){var _0x1527c9=encryptor[_0xa538('0x72')](_0x552d21)[_0xa538('0x73')](',');for(var _0x467d03=0x0;_0x467d03<_0x41d153;_0x467d03++){if(!_0x1527c9[_0x467d03])break;if(_0x26dab1[_0xa538('0x74')]()===_0x1527c9[_0x467d03][_0xa538('0x74')]()){var _0x14c464=util['format'](_0xa538('0x75'),_0x41d153);if(_0x41d153===0x1){_0x14c464='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xa538('0x76'))]['ValidationError'](_0x14c464);}}return;};exports[_0xa538('0x77')]=function(_0x16cfbd,_0x36f8f9){var _0x9fc78e=_0x36f8f9?encryptor[_0xa538('0x72')](_0x36f8f9)[_0xa538('0x73')](','):[];if(_0x9fc78e['length']===0x5){_0x9fc78e['splice'](-0x1,0x1);}_0x9fc78e[_0xa538('0x78')](_0x16cfbd);return encryptor[_0xa538('0x79')](_0x9fc78e[_0xa538('0x7a')](','));};function signJwt(_0x1a19af){var _0x210378=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x5c7db8=_0x1a19af[_0xa538('0x7b')]||config['secrets'][_0xa538('0x7c')];return new BPromise(function(_0x36c68b,_0x4d722a){_0x210378(_0x1a19af[_0xa538('0x7d')],_0x5c7db8,_0x1a19af[_0xa538('0x7e')])[_0xa538('0x46')](function(_0x4763fb){_0x36c68b(_0x4763fb);})[_0xa538('0x4a')](function(_0x1e91a6){_0x4d722a(_0x1e91a6);});});}function verifyJwt(_0x529f1c,_0x434eb0,_0x1f8dc3){var _0x1cd53a=BPromise['promisify'](jwt[_0xa538('0x7f')],{'context':jwt});var _0x586298=_0x1f8dc3||config['secrets'][_0xa538('0x7c')];return new BPromise(function(_0x35ddcd,_0x158d9e){_0x1cd53a(_0x529f1c,_0x586298,_0x434eb0)[_0xa538('0x46')](function(_0x28c702){_0x35ddcd(_0x28c702);})['catch'](function(_0x3e4a7f){_0x158d9e(_0x3e4a7f);});});}function generateNonce(){return crypto[_0xa538('0x80')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0xa538('0x81')](Date[_0xa538('0x82')]()/0x3e8)[_0xa538('0x83')]();}function createJwt(_0x48bea6){var _0x104a6c={'payload':{'iat':_0x48bea6['apiKeyIat'],'nonce':_0x48bea6[_0xa538('0x53')]},'options':{'algorithm':'HS512','subject':_0x48bea6['id'][_0xa538('0x83')](),'issuer':hardwareConf[_0xa538('0x4e')](),'audience':hardwareConf[_0xa538('0x4e')]()}};return signJwt(_0x104a6c)[_0xa538('0x46')](function(_0x4d8282){return{'iat':_0x48bea6[_0xa538('0x6c')],'nonce':_0x48bea6[_0xa538('0x53')],'token':_0x4d8282};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 174ebb5..8af95b8 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 _0xca7c=['filter','cf_','map','CmCustomField','findOne','slice','all','length','type','lodash','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','default','fields','where','user','clause','tags','skip','checkListsRestrictions','ids','count','buildContactsQuery','rows','catch','describe','keys'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xca7c,0x69));var _0xcca7=function(_0x473fd2,_0x21c4f6){_0x473fd2=_0x473fd2-0x0;var _0x3b3561=_0xca7c[_0x473fd2];return _0x3b3561;};'use strict';var _=require(_0xcca7('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xcca7('0x1'))['db'];exports['findAll']=function(_0x46bb1c,_0x55d810,_0xa32706,_0x2aa242){var _0x27963d={'count':0x0,'rows':[]};var _0x5e2000=sqlUtils[_0xcca7('0x2')](_0x55d810,_0x46bb1c);if(_0x5e2000){return Promise[_0xcca7('0x3')](_0x27963d);}var _0x1d8a72=sqlUtils[_0xcca7('0x4')]();var _0xaff90f={};var _0x3504bf=![];var _0x20c61b=![];return Promise[_0xcca7('0x3')]()[_0xcca7('0x5')](function(){if(_0x46bb1c['search']){return sqlUtils[_0xcca7('0x6')](_0x46bb1c[_0xcca7('0x7')],_0x2aa242);}else{return sqlUtils['parseQueryParameters'](_0x46bb1c,_0x2aa242);}})[_0xcca7('0x5')](function(_0x4c852f){_0x1d8a72['where'](_0x4c852f[_0xcca7('0x8')]);_0x1d8a72['where'](_0x4c852f[_0xcca7('0x9')]);_0x1d8a72[_0xcca7('0xa')](_0x4c852f['filter']);_0x1d8a72[_0xcca7('0xa')](_0x4c852f[_0xcca7('0xb')][_0xcca7('0xc')]);_0xaff90f=_0x4c852f[_0xcca7('0xd')];_0x20c61b=_0x4c852f[_0xcca7('0xb')][_0xcca7('0xe')];return sqlUtils[_0xcca7('0xf')](_0x55d810,_0x46bb1c,_0x20c61b);})[_0xcca7('0x5')](function(_0x31cc50){_0x1d8a72[_0xcca7('0xa')](_0x31cc50);var _0x1fc487=_0x46bb1c[_0xcca7('0x7')]?_0xaff90f[_0xcca7('0x10')]:_0x46bb1c['tag'];_0x3504bf=_0x1fc487?!![]:![];return sqlUtils['countFilteredContacts'](_0x1d8a72,_0x1fc487);})[_0xcca7('0x5')](function(_0x45d6f9){_0x27963d[_0xcca7('0x11')]=_0x45d6f9;if(_0x27963d[_0xcca7('0x11')]===0x0){return;}if(_0x46bb1c['User']){_0x20c61b=!![];}return sqlUtils[_0xcca7('0x12')](_0x1d8a72,_0x46bb1c['fields'],_0xa32706,_0x3504bf,_0xaff90f['clause'],_0x20c61b);})[_0xcca7('0x5')](function(_0x1b7680){if(!_0x1b7680){return[];}return sqlUtils['getFilteredContacts'](_0x1b7680,_0x46bb1c,_0xa32706);})[_0xcca7('0x5')](function(_0x59401e){_0x27963d[_0xcca7('0x13')]=_0x59401e;return _0x27963d;})[_0xcca7('0x14')](function(_0x360574){throw _0x360574;});};exports[_0xcca7('0x15')]=function(){var _0x2e5f0f={};var _0x496a0c=[];return db['CmContact'][_0xcca7('0x15')]()['then'](function(_0x1a974e){_0x2e5f0f=_0x1a974e;var _0x5bc7fe=Object[_0xcca7('0x16')](_0x2e5f0f)[_0xcca7('0x17')](function(_0x3bddf6){return _['startsWith'](_0x3bddf6,_0xcca7('0x18'))?_0x3bddf6:undefined;});var _0x3bf9d9=_0x5bc7fe[_0xcca7('0x19')](function(_0x2044c0){return db[_0xcca7('0x1a')][_0xcca7('0x1b')]({'where':{'id':_0x2044c0[_0xcca7('0x1c')](0x3)},'raw':!![]});});return Promise[_0xcca7('0x1d')](_0x3bf9d9);})[_0xcca7('0x5')](function(_0x1a39ef){for(var _0xfef0da=0x0;_0xfef0da<_0x1a39ef[_0xcca7('0x1e')];_0xfef0da++){if(_0x1a39ef[_0xfef0da]){var _0x1808ff='cf_'+_0x1a39ef[_0xfef0da]['id'];_0x2e5f0f[_0x1808ff]['fieldType']=_0x1a39ef[_0xfef0da][_0xcca7('0x1f')];}}_0x496a0c=_[_0xcca7('0x19')](Object[_0xcca7('0x16')](_0x2e5f0f),function(_0x18f06c){return{'name':_0x18f06c,'type':_0x2e5f0f[_0x18f06c][_0xcca7('0x1f')]};});return _0x496a0c;})[_0xcca7('0x14')](function(_0x5f1242){throw _0x5f1242;});}; \ No newline at end of file +var _0x7f78=['count','User','buildContactsQuery','getFilteredContacts','catch','describe','CmContact','startsWith','map','CmCustomField','findOne','slice','all','cf_','type','keys','lodash','./sql-utils','../../mysqldb','findAll','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter','default','where','fields','filter','user','clause','tags','checkListsRestrictions','ids','tag','countFilteredContacts'];(function(_0x1be07e,_0x8e9930){var _0x52b7e5=function(_0x48289d){while(--_0x48289d){_0x1be07e['push'](_0x1be07e['shift']());}};_0x52b7e5(++_0x8e9930);}(_0x7f78,0xa0));var _0x87f7=function(_0xc6b53,_0x2d67b8){_0xc6b53=_0xc6b53-0x0;var _0x54f795=_0x7f78[_0xc6b53];return _0x54f795;};'use strict';var _=require(_0x87f7('0x0'));var sqlUtils=require(_0x87f7('0x1'));var db=require(_0x87f7('0x2'))['db'];exports[_0x87f7('0x3')]=function(_0xb880c8,_0x2d286e,_0x5ccbdc,_0x1a8586){var _0x34f7f4={'count':0x0,'rows':[]};var _0x47fcce=sqlUtils['skipContactsQuery'](_0x2d286e,_0xb880c8);if(_0x47fcce){return Promise['resolve'](_0x34f7f4);}var _0x1a0867=sqlUtils[_0x87f7('0x4')]();var _0x2a4f45={};var _0x5a2a11=![];var _0x2396cf=![];return Promise[_0x87f7('0x5')]()[_0x87f7('0x6')](function(){if(_0xb880c8[_0x87f7('0x7')]){return sqlUtils[_0x87f7('0x8')](_0xb880c8['search'],_0x1a8586);}else{return sqlUtils['parseQueryParameters'](_0xb880c8,_0x1a8586);}})[_0x87f7('0x6')](function(_0x81f454){_0x1a0867['where'](_0x81f454[_0x87f7('0x9')]);_0x1a0867[_0x87f7('0xa')](_0x81f454[_0x87f7('0xb')]);_0x1a0867[_0x87f7('0xa')](_0x81f454[_0x87f7('0xc')]);_0x1a0867['where'](_0x81f454[_0x87f7('0xd')][_0x87f7('0xe')]);_0x2a4f45=_0x81f454[_0x87f7('0xf')];_0x2396cf=_0x81f454[_0x87f7('0xd')]['skip'];return sqlUtils[_0x87f7('0x10')](_0x2d286e,_0xb880c8,_0x2396cf);})['then'](function(_0x55e52a){_0x1a0867[_0x87f7('0xa')](_0x55e52a);var _0x428aeb=_0xb880c8['search']?_0x2a4f45[_0x87f7('0x11')]:_0xb880c8[_0x87f7('0x12')];_0x5a2a11=_0x428aeb?!![]:![];return sqlUtils[_0x87f7('0x13')](_0x1a0867,_0x428aeb);})['then'](function(_0xfffe8b){_0x34f7f4[_0x87f7('0x14')]=_0xfffe8b;if(_0x34f7f4[_0x87f7('0x14')]===0x0){return;}if(_0xb880c8[_0x87f7('0x15')]){_0x2396cf=!![];}return sqlUtils[_0x87f7('0x16')](_0x1a0867,_0xb880c8[_0x87f7('0xb')],_0x5ccbdc,_0x5a2a11,_0x2a4f45[_0x87f7('0xe')],_0x2396cf);})[_0x87f7('0x6')](function(_0x349885){if(!_0x349885){return[];}return sqlUtils[_0x87f7('0x17')](_0x349885,_0xb880c8,_0x5ccbdc);})[_0x87f7('0x6')](function(_0x43c864){_0x34f7f4['rows']=_0x43c864;return _0x34f7f4;})[_0x87f7('0x18')](function(_0x284d9){throw _0x284d9;});};exports[_0x87f7('0x19')]=function(){var _0x57c74f={};var _0x4c242d=[];return db[_0x87f7('0x1a')]['describe']()['then'](function(_0x2a97cb){_0x57c74f=_0x2a97cb;var _0x387927=Object['keys'](_0x57c74f)[_0x87f7('0xc')](function(_0x3981c3){return _[_0x87f7('0x1b')](_0x3981c3,'cf_')?_0x3981c3:undefined;});var _0x465f87=_0x387927[_0x87f7('0x1c')](function(_0x2cabc1){return db[_0x87f7('0x1d')][_0x87f7('0x1e')]({'where':{'id':_0x2cabc1[_0x87f7('0x1f')](0x3)},'raw':!![]});});return Promise[_0x87f7('0x20')](_0x465f87);})[_0x87f7('0x6')](function(_0x4be18a){for(var _0x1d1ad7=0x0;_0x1d1ad7<_0x4be18a['length'];_0x1d1ad7++){if(_0x4be18a[_0x1d1ad7]){var _0x56d98c=_0x87f7('0x21')+_0x4be18a[_0x1d1ad7]['id'];_0x57c74f[_0x56d98c]['fieldType']=_0x4be18a[_0x1d1ad7][_0x87f7('0x22')];}}_0x4c242d=_['map'](Object[_0x87f7('0x23')](_0x57c74f),function(_0x38a420){return{'name':_0x38a420,'type':_0x57c74f[_0x38a420][_0x87f7('0x22')]};});return _0x4c242d;})[_0x87f7('0x18')](function(_0x5b4dc0){throw _0x5b4dc0;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 8a58259..ab8ab5d 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 _0x825d=['keyBy','QueryTypes','SELECT','CmContact','query','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','sequelize','toString','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','fax','email','CompanyId','updatedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','name','dateOfBirth','fieldType','datetime','castTo','buildExpression','value','start','end','Tag','map','tags','and','ids','User','clause','keys','compact','concat','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','fields','tag','filter','role','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','group','limit','offset','subqry.id','order','DESC','subqry.','findAll','color'];(function(_0x171d07,_0x59c974){var _0x135563=function(_0x2aea19){while(--_0x2aea19){_0x171d07['push'](_0x171d07['shift']());}};_0x135563(++_0x59c974);}(_0x825d,0x13f));var _0xd825=function(_0x4ddfb1,_0x3c2f40){_0x4ddfb1=_0x4ddfb1-0x0;var _0x2c44f5=_0x825d[_0x4ddfb1];return _0x2c44f5;};'use strict';var _=require('lodash');var squel=require(_0xd825('0x0'));var as=require(_0xd825('0x1'));var qs=require(_0xd825('0x2'));var utils=require(_0xd825('0x3'));var db=require(_0xd825('0x4'))['db'];function skipContactsQuery(_0x7656a,_0x178a53){var _0x190eb9=![];if(_0x7656a['role']===_0xd825('0x5')&&!_0x178a53[_0xd825('0x6')]&&!_0x178a53[_0xd825('0x7')]&&_0x178a53[_0xd825('0x8')]!==_0xd825('0x9')){_0x190eb9=!![];}return _0x190eb9;}function getContactsSubquery(){return squel[_0xd825('0xa')]()[_0xd825('0xb')](_0xd825('0xc'),'c')[_0xd825('0xd')](_0xd825('0xe'));}function applyJoinClauses(_0x1a9214,_0x5f5c0f){var _0x3523c9=_0x5f5c0f?'c':_0xd825('0xf');_0x1a9214[_0xd825('0x10')]('cm_user_has_contacts','uc','uc.CmContactId\x20=\x20'+_0x3523c9+_0xd825('0x11'))[_0xd825('0x10')](_0xd825('0x12'),'ct',_0xd825('0x13')+_0x3523c9+_0xd825('0x11'))[_0xd825('0x10')](_0xd825('0x14'),'t',_0xd825('0x15'));return _0x1a9214;}function addFieldsToQuery(_0x3c8c20,_0x51bc52,_0x4b6115,_0x5d514e,_0x28fd73){var _0x1a7551=_0x28fd73?'c':_0xd825('0xf');if(!_0x51bc52){_0x51bc52=['id',_0xd825('0x16'),'lastName',_0xd825('0x17'),'mobile',_0xd825('0x18'),_0xd825('0x19'),_0xd825('0x7'),_0xd825('0x1a'),'createdAt',_0xd825('0x1b'),'deletedAt',_0xd825('0x1c')];}else if(!_0x51bc52['includes']('id')){_0x51bc52['push']('id');}var _0x22e452=_0x4b6115&&_0x28fd73||!_0x4b6115&&!_0x28fd73;if(_0x5d514e){_0x22e452=_0x5d514e&&_0x28fd73||!_0x5d514e&&!_0x28fd73;}_0x51bc52[_0xd825('0x1d')](function(_0x1fe73f){if(_0x1fe73f===_0xd825('0x1c')){if(_0x22e452){_0x3c8c20[_0xd825('0x1e')](_0xd825('0x1f'),_0x1fe73f);}else if(_0x4b6115||_0x5d514e){_0x3c8c20[_0xd825('0x1e')](_0x1a7551+'.'+_0x1fe73f);}}else{_0x3c8c20[_0xd825('0x1e')](_0x1a7551+'.'+_0x1fe73f);}});return _0x3c8c20;}function getSqlClauses(){var _0x5a2871={'default':squel[_0xd825('0x20')](),'fields':squel[_0xd825('0x20')](),'filter':squel[_0xd825('0x20')](),'tags':{'clause':squel[_0xd825('0x20')](),'ids':null},'user':{'clause':squel[_0xd825('0x20')](),'skip':![]}};return _0x5a2871;}function parseTagParameter(_0x1b6043){var _0x2005f9=squel[_0xd825('0x20')]();if(_0x1b6043){var _0x21d62f=utils[_0xd825('0x21')](_0x1b6043);_0x21d62f[_0xd825('0x1d')](function(_0x1a1d52){_0x2005f9['or'](_0xd825('0x22'),'%,'+_0x1a1d52+',%');});}return _0x2005f9;}function parseSearchFilter(_0x363dcf){var _0x527da1=squel['expr']();if(_0x363dcf){var _0x44eb64=_0x363dcf[_0xd825('0x23')]('\x5c','\x5c\x5c')[_0xd825('0x23')](/'/g,'\x27\x27');if(_0x44eb64[_0xd825('0x24')]('\x20')['length']>0x1){_0x527da1['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd825('0x25')](_0x44eb64,!![]),null);}else{if(qs[_0xd825('0x26')](_0x44eb64)){_0x527da1['or'](_0xd825('0x27'),_0x44eb64+'%');_0x527da1['or'](_0xd825('0x28'),_0x44eb64+'%');_0x527da1['or'](_0xd825('0x29'),_0x44eb64+'%');_0x527da1['or'](_0xd825('0x2a'),_0x44eb64+'%');}else if(qs['isEmail'](_0x44eb64)){_0x527da1['or']('c.email\x20LIKE\x20?',_0x44eb64+'%');}else{_0x527da1['or']('c.firstName\x20LIKE\x20?','%'+_0x44eb64+'%');_0x527da1['or']('c.lastName\x20LIKE\x20?','%'+_0x44eb64+'%');_0x527da1['or'](_0xd825('0x2b'),'%'+_0x44eb64+'%');}}}return _0x527da1;}function parseAdvancedSearchFilter(_0x267cf1,_0x3026a3){var _0x4e7b52=getSqlClauses();var _0x1a20ba=as[_0xd825('0x2c')](_0x267cf1);var _0x225357=_0x1a20ba[_0xd825('0x2d')];for(var _0x1db48f=0x0;_0x1db48f<_0x1a20ba[_0xd825('0x2e')][_0xd825('0x2f')];_0x1db48f++){var _0x3907c3=_0x1a20ba[_0xd825('0x2e')][_0x1db48f];var _0x1d4a2b='c';var _0x577d05=_[_0xd825('0x30')](_0x3026a3,[_0xd825('0x31'),_0x3907c3[_0xd825('0x1e')]]);if(_0x577d05){if(_0x3907c3[_0xd825('0x1e')]===_0xd825('0x32')||_0x577d05[_0xd825('0x33')]===_0xd825('0x34')){_0x3907c3[_0xd825('0x35')]='DATE';}var _0x54aad9=as[_0xd825('0x36')](_0x1d4a2b,_0x577d05['type'],_0x3907c3);_0x4e7b52['default'][_0x225357](_0x54aad9['text'],_0x54aad9[_0xd825('0x37')][_0xd825('0x38')],_0x54aad9[_0xd825('0x37')][_0xd825('0x39')]);}else{if(_0x3907c3[_0xd825('0x1e')]===_0xd825('0x3a')){var _0x1dcbf9=_0x3907c3[_0xd825('0x37')][_0xd825('0x24')](',')[_0xd825('0x3b')](function(_0x39da90){return Number(_0x39da90);});var _0x2cc901=parseTagParameter(_0x1dcbf9);_0x4e7b52[_0xd825('0x3c')]['clause'][_0xd825('0x3d')](_0x2cc901);_0x4e7b52[_0xd825('0x3c')][_0xd825('0x3e')]=_0x1dcbf9;}else if(_0x3907c3[_0xd825('0x1e')]===_0xd825('0x3f')){_0x4e7b52['user'][_0xd825('0x40')]['and']('uc.UserId\x20=\x20?',_0x3907c3[_0xd825('0x37')]);_0x4e7b52['user']['skip']=!![];}}}return _0x4e7b52;}function parseModelFields(_0x16389c,_0x47ef53){var _0x4fa6a6=squel['expr']();var _0x4e37a2=_(_0x16389c)[_0xd825('0x41')]()[_0xd825('0x3b')](function(_0x3b9c7f){return _['some'](_0x47ef53,[_0xd825('0x31'),_0x3b9c7f])?_0x3b9c7f:undefined;})[_0xd825('0x42')]()[_0xd825('0x37')]();if(_0x16389c['Contact']){_0x4e37a2['push']('Contact');}if(_0x16389c[_0xd825('0x3f')]){_0x4e37a2['push'](_0xd825('0x3f'));}if(_0x4e37a2[_0xd825('0x2f')]>0x0){_0x4e37a2[_0xd825('0x1d')](function(_0x5bd354){if(_0x5bd354===_0xd825('0x7')){_0x4fa6a6[_0xd825('0x3d')]('c.ListId\x20IN\x20?',[][_0xd825('0x43')](_0x16389c[_0x5bd354]));}else if(_0x5bd354===_0xd825('0x44')){var _0x5083bb='%'+_0x16389c[_0x5bd354]+'%';_0x4fa6a6[_0xd825('0x3d')](_0xd825('0x45'),_0x5083bb);}else if(_0x5bd354===_0xd825('0x3f')){_0x4fa6a6[_0xd825('0x3d')](_0xd825('0x46'),_0x16389c[_0x5bd354]);}else{_0x4fa6a6[_0xd825('0x3d')]('c.'+_0x5bd354+_0xd825('0x47'),_0x16389c[_0x5bd354]);}});}return _0x4fa6a6;}function parseQueryParameters(_0x21bdd8,_0x1ba197){var _0x74d21f=getSqlClauses();return Promise[_0xd825('0x48')]()[_0xd825('0x49')](function(){return parseModelFields(_0x21bdd8,_0x1ba197);})[_0xd825('0x49')](function(_0x31b670){_0x74d21f[_0xd825('0x4a')][_0xd825('0x3d')](_0x31b670);return parseTagParameter(_0x21bdd8[_0xd825('0x4b')]);})[_0xd825('0x49')](function(_0x22c322){_0x74d21f[_0xd825('0x3c')][_0xd825('0x40')][_0xd825('0x3d')](_0x22c322);return parseSearchFilter(_0x21bdd8[_0xd825('0x4c')]);})[_0xd825('0x49')](function(_0x35e76e){_0x74d21f['filter']=_0x35e76e;return _0x74d21f;});}function checkListsRestrictions(_0x56b964,_0xa01863,_0x19fa69){var _0x5f138a=squel[_0xd825('0x20')]();return Promise['resolve']()[_0xd825('0x49')](function(){if(_0xa01863[_0xd825('0x6')]&&_0x56b964[_0xd825('0x4d')]===_0xd825('0x5')&&!_0x19fa69){return _0x56b964['getLists']({'attributes':['id'],'raw':!![]});}})[_0xd825('0x49')](function(_0x578168){if(_0x578168){if(_0x578168[_0xd825('0x2f')]===0x0){_0x5f138a[_0xd825('0x3d')](_0xd825('0x4e'));}else{_0x5f138a[_0xd825('0x3d')](_0xd825('0x4f'),_[_0xd825('0x3b')](_0x578168,'id'));}}})[_0xd825('0x49')](function(){return _0x5f138a;});}function buildContactsQuery(_0x53a9d3,_0x2c2824,_0x1746b5,_0x1a6dc2,_0x8f47e,_0x56080f){if(_0x2c2824){_0x2c2824=_0x1746b5['attributes'];}_0x53a9d3=addFieldsToQuery(_0x53a9d3,_0x2c2824,_0x1a6dc2,_0x56080f,!![]);var _0x27d091=squel[_0xd825('0xa')]();_0x27d091=addFieldsToQuery(_0x27d091,_0x2c2824,_0x1a6dc2,_0x56080f,![]);if(_0x1a6dc2||_0x56080f){_0x53a9d3=applyJoinClauses(_0x53a9d3,!![]);_0x53a9d3[_0xd825('0x50')]('c.id');if(_0x1746b5[_0xd825('0x51')]){_0x27d091[_0xd825('0x51')](_0x1746b5[_0xd825('0x51')]);}if(_0x1746b5[_0xd825('0x52')]){_0x27d091['offset'](_0x1746b5[_0xd825('0x52')]);}}else{_0x27d091=applyJoinClauses(_0x27d091,![]);_0x27d091[_0xd825('0x50')](_0xd825('0x53'));if(_0x1746b5['limit']){_0x53a9d3['limit'](_0x1746b5['limit']);}if(_0x1746b5['offset']){_0x53a9d3[_0xd825('0x52')](_0x1746b5[_0xd825('0x52')]);}}_0x27d091['having'](_0x8f47e);if(_0x1746b5[_0xd825('0x54')]){_0x1746b5[_0xd825('0x54')][_0xd825('0x1d')](function(_0x648a2e){_0x53a9d3[_0xd825('0x54')]('c.'+_0x648a2e[0x0],_0x648a2e[0x1]===_0xd825('0x55')?![]:!![]);_0x27d091[_0xd825('0x54')](_0xd825('0x56')+_0x648a2e[0x0],_0x648a2e[0x1]===_0xd825('0x55')?![]:!![]);});}_0x27d091[_0xd825('0xb')](_0x53a9d3,_0xd825('0xf'));return _0x27d091;}function getFilteredContacts(_0xb3e16a){var _0x3f4e79=[];return db['Tag'][_0xd825('0x57')]({'attributes':['id',_0xd825('0x31'),_0xd825('0x58')],'raw':!![]})[_0xd825('0x49')](function(_0x282345){_0x3f4e79=_[_0xd825('0x59')](_0x282345,'id');var _0x2c1ac1={'type':db['Sequelize'][_0xd825('0x5a')][_0xd825('0x5b')],'model':db[_0xd825('0x5c')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xd825('0x5d')](_0xb3e16a['toString'](),_0x2c1ac1);})[_0xd825('0x49')](function(_0x31ba10){_0x31ba10[_0xd825('0x1d')](function(_0x4445e3){if(_0x4445e3[_0xd825('0x1c')]){_0x4445e3[_0xd825('0x5e')]=[];_0x4445e3[_0xd825('0x1c')][_0xd825('0x24')](',')['forEach'](function(_0x57f17f){_0x4445e3[_0xd825('0x5e')]['push'](_0x3f4e79[_0x57f17f]);});}delete _0x4445e3[_0xd825('0x1c')];});return _0x31ba10;});}function countFilteredContacts(_0x40912c,_0x4e4b72){var _0x5be873=_0x40912c['clone']();_0x5be873[_0xd825('0x1e')](_0xd825('0x5f'));_0x5be873=applyJoinClauses(_0x5be873,!![]);_0x40912c[_0xd825('0x50')]('c.id');var _0x4aca77=utils['getSelectedTags'](_0x4e4b72);if(!_[_0xd825('0x60')](_0x4aca77)){_0x5be873['where'](_0xd825('0x61'),_0x4aca77);}var _0x2be867={'type':db[_0xd825('0x62')][_0xd825('0x5a')][_0xd825('0x5b')],'raw':!![]};return db[_0xd825('0x63')][_0xd825('0x5d')](_0x5be873[_0xd825('0x64')](),_0x2be867)[_0xd825('0x49')](function(_0x3fd873){return _0x3fd873[0x0][_0xd825('0x5f')];});}module[_0xd825('0x65')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x4f4c=['keyBy','Sequelize','QueryTypes','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','sequelize','exports','lodash','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','ListId','autocomplete','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','email','updatedAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','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.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','end','Tag','clause','and','tags','ids','User','user','uc.UserId\x20=\x20?','keys','some','name','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','search','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','having','order','subqry.','color'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0x4f4c,0x76));var _0xc4f4=function(_0x4b731b,_0x17a00b){_0x4b731b=_0x4b731b-0x0;var _0x1c9a96=_0x4f4c[_0x4b731b];return _0x1c9a96;};'use strict';var _=require(_0xc4f4('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0xc4f4('0x1'));var utils=require(_0xc4f4('0x2'));var db=require(_0xc4f4('0x3'))['db'];function skipContactsQuery(_0xb39023,_0x26f3a2){var _0x1da5e9=![];if(_0xb39023[_0xc4f4('0x4')]===_0xc4f4('0x5')&&!_0x26f3a2['search']&&!_0x26f3a2[_0xc4f4('0x6')]&&_0x26f3a2[_0xc4f4('0x7')]!=='true'){_0x1da5e9=!![];}return _0x1da5e9;}function getContactsSubquery(){return squel[_0xc4f4('0x8')]()[_0xc4f4('0x9')](_0xc4f4('0xa'),'c')[_0xc4f4('0xb')](_0xc4f4('0xc'));}function applyJoinClauses(_0x4219fe,_0x3ecd29){var _0x406114=_0x3ecd29?'c':_0xc4f4('0xd');_0x4219fe[_0xc4f4('0xe')](_0xc4f4('0xf'),'uc','uc.CmContactId\x20=\x20'+_0x406114+_0xc4f4('0x10'))[_0xc4f4('0xe')](_0xc4f4('0x11'),'ct',_0xc4f4('0x12')+_0x406114+_0xc4f4('0x10'))[_0xc4f4('0xe')](_0xc4f4('0x13'),'t',_0xc4f4('0x14'));return _0x4219fe;}function addFieldsToQuery(_0x372f70,_0x8235be,_0x1885d2,_0x2c6e3d,_0x41707c){var _0x1cb717=_0x41707c?'c':_0xc4f4('0xd');if(!_0x8235be){_0x8235be=['id',_0xc4f4('0x15'),'lastName',_0xc4f4('0x16'),_0xc4f4('0x17'),_0xc4f4('0x18'),_0xc4f4('0x19'),'ListId','CompanyId','createdAt',_0xc4f4('0x1a'),_0xc4f4('0x1b'),_0xc4f4('0x1c')];}else if(!_0x8235be[_0xc4f4('0x1d')]('id')){_0x8235be[_0xc4f4('0x1e')]('id');}var _0x51ea28=_0x1885d2&&_0x41707c||!_0x1885d2&&!_0x41707c;if(_0x2c6e3d){_0x51ea28=_0x2c6e3d&&_0x41707c||!_0x2c6e3d&&!_0x41707c;}_0x8235be[_0xc4f4('0x1f')](function(_0xcf612c){if(_0xcf612c===_0xc4f4('0x1c')){if(_0x51ea28){_0x372f70['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xcf612c);}else if(_0x1885d2||_0x2c6e3d){_0x372f70['field'](_0x1cb717+'.'+_0xcf612c);}}else{_0x372f70[_0xc4f4('0x20')](_0x1cb717+'.'+_0xcf612c);}});return _0x372f70;}function getSqlClauses(){var _0x2a9b3a={'default':squel[_0xc4f4('0x21')](),'fields':squel[_0xc4f4('0x21')](),'filter':squel[_0xc4f4('0x21')](),'tags':{'clause':squel[_0xc4f4('0x21')](),'ids':null},'user':{'clause':squel[_0xc4f4('0x21')](),'skip':![]}};return _0x2a9b3a;}function parseTagParameter(_0x2b12f5){var _0x42d8c5=squel[_0xc4f4('0x21')]();if(_0x2b12f5){var _0x11ea07=utils[_0xc4f4('0x22')](_0x2b12f5);_0x11ea07[_0xc4f4('0x1f')](function(_0x4e896e){_0x42d8c5['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4e896e+',%');});}return _0x42d8c5;}function parseSearchFilter(_0xa168e){var _0x25dbfa=squel['expr']();if(_0xa168e){var _0x591fe7=_0xa168e['replace']('\x5c','\x5c\x5c')[_0xc4f4('0x23')](/'/g,'\x27\x27');if(_0x591fe7[_0xc4f4('0x24')]('\x20')[_0xc4f4('0x25')]>0x1){_0x25dbfa['or'](_0xc4f4('0x26'),qs[_0xc4f4('0x27')](_0x591fe7,!![]),null);}else{if(qs[_0xc4f4('0x28')](_0x591fe7)){_0x25dbfa['or']('c.id\x20LIKE\x20?',_0x591fe7+'%');_0x25dbfa['or'](_0xc4f4('0x29'),_0x591fe7+'%');_0x25dbfa['or'](_0xc4f4('0x2a'),_0x591fe7+'%');_0x25dbfa['or'](_0xc4f4('0x2b'),_0x591fe7+'%');}else if(qs['isEmail'](_0x591fe7)){_0x25dbfa['or'](_0xc4f4('0x2c'),_0x591fe7+'%');}else{_0x25dbfa['or'](_0xc4f4('0x2d'),'%'+_0x591fe7+'%');_0x25dbfa['or'](_0xc4f4('0x2e'),'%'+_0x591fe7+'%');_0x25dbfa['or']('c.email\x20LIKE\x20?','%'+_0x591fe7+'%');}}}return _0x25dbfa;}function parseAdvancedSearchFilter(_0x217812,_0x2dd38f){var _0x3247ef=getSqlClauses();var _0x15b0e6=as[_0xc4f4('0x2f')](_0x217812);var _0x3a7bbb=_0x15b0e6[_0xc4f4('0x30')];for(var _0x4f79c0=0x0;_0x4f79c0<_0x15b0e6[_0xc4f4('0x31')][_0xc4f4('0x25')];_0x4f79c0++){var _0x584477=_0x15b0e6['conditions'][_0x4f79c0];var _0x45313c='c';var _0x3807db=_[_0xc4f4('0x32')](_0x2dd38f,['name',_0x584477[_0xc4f4('0x20')]]);if(_0x3807db){if(_0x584477['field']===_0xc4f4('0x33')||_0x3807db[_0xc4f4('0x34')]===_0xc4f4('0x35')){_0x584477[_0xc4f4('0x36')]=_0xc4f4('0x37');}var _0x46c9a6=as[_0xc4f4('0x38')](_0x45313c,_0x3807db[_0xc4f4('0x39')],_0x584477);_0x3247ef[_0xc4f4('0x3a')][_0x3a7bbb](_0x46c9a6[_0xc4f4('0x3b')],_0x46c9a6[_0xc4f4('0x3c')]['start'],_0x46c9a6[_0xc4f4('0x3c')][_0xc4f4('0x3d')]);}else{if(_0x584477['field']===_0xc4f4('0x3e')){var _0x59e798=_0x584477[_0xc4f4('0x3c')][_0xc4f4('0x24')](',')['map'](function(_0x4089f4){return Number(_0x4089f4);});var _0xe76fb2=parseTagParameter(_0x59e798);_0x3247ef['tags'][_0xc4f4('0x3f')][_0xc4f4('0x40')](_0xe76fb2);_0x3247ef[_0xc4f4('0x41')][_0xc4f4('0x42')]=_0x59e798;}else if(_0x584477['field']===_0xc4f4('0x43')){_0x3247ef[_0xc4f4('0x44')][_0xc4f4('0x3f')][_0xc4f4('0x40')](_0xc4f4('0x45'),_0x584477['value']);_0x3247ef[_0xc4f4('0x44')]['skip']=!![];}}}return _0x3247ef;}function parseModelFields(_0x3de531,_0x391a29){var _0xbd5b66=squel[_0xc4f4('0x21')]();var _0x37ba65=_(_0x3de531)[_0xc4f4('0x46')]()['map'](function(_0x2c7281){return _[_0xc4f4('0x47')](_0x391a29,[_0xc4f4('0x48'),_0x2c7281])?_0x2c7281:undefined;})['compact']()[_0xc4f4('0x3c')]();if(_0x3de531[_0xc4f4('0x49')]){_0x37ba65[_0xc4f4('0x1e')](_0xc4f4('0x49'));}if(_0x3de531[_0xc4f4('0x43')]){_0x37ba65[_0xc4f4('0x1e')](_0xc4f4('0x43'));}if(_0x37ba65[_0xc4f4('0x25')]>0x0){_0x37ba65[_0xc4f4('0x1f')](function(_0xd1b153){if(_0xd1b153===_0xc4f4('0x6')){_0xbd5b66['and']('c.ListId\x20IN\x20?',[][_0xc4f4('0x4a')](_0x3de531[_0xd1b153]));}else if(_0xd1b153===_0xc4f4('0x49')){var _0x55936f='%'+_0x3de531[_0xd1b153]+'%';_0xbd5b66['and'](_0xc4f4('0x4b'),_0x55936f);}else if(_0xd1b153===_0xc4f4('0x43')){_0xbd5b66['and']('uc.UserId\x20=\x20?',_0x3de531[_0xd1b153]);}else{_0xbd5b66[_0xc4f4('0x40')]('c.'+_0xd1b153+_0xc4f4('0x4c'),_0x3de531[_0xd1b153]);}});}return _0xbd5b66;}function parseQueryParameters(_0x5293f6,_0x1b28f4){var _0x51501e=getSqlClauses();return Promise[_0xc4f4('0x4d')]()[_0xc4f4('0x4e')](function(){return parseModelFields(_0x5293f6,_0x1b28f4);})[_0xc4f4('0x4e')](function(_0x485adb){_0x51501e['fields'][_0xc4f4('0x40')](_0x485adb);return parseTagParameter(_0x5293f6[_0xc4f4('0x4f')]);})[_0xc4f4('0x4e')](function(_0x15666f){_0x51501e[_0xc4f4('0x41')]['clause'][_0xc4f4('0x40')](_0x15666f);return parseSearchFilter(_0x5293f6['filter']);})[_0xc4f4('0x4e')](function(_0x47b6e6){_0x51501e[_0xc4f4('0x50')]=_0x47b6e6;return _0x51501e;});}function checkListsRestrictions(_0x15b120,_0x30f91a,_0x45b233){var _0x5df0c0=squel[_0xc4f4('0x21')]();return Promise[_0xc4f4('0x4d')]()[_0xc4f4('0x4e')](function(){if(_0x30f91a[_0xc4f4('0x51')]&&_0x15b120['role']===_0xc4f4('0x5')&&!_0x45b233){return _0x15b120['getLists']({'attributes':['id'],'raw':!![]});}})[_0xc4f4('0x4e')](function(_0x45a6f3){if(_0x45a6f3){if(_0x45a6f3[_0xc4f4('0x25')]===0x0){_0x5df0c0['and'](_0xc4f4('0x52'));}else{_0x5df0c0[_0xc4f4('0x40')](_0xc4f4('0x53'),_['map'](_0x45a6f3,'id'));}}})['then'](function(){return _0x5df0c0;});}function buildContactsQuery(_0x40d304,_0x4769c8,_0x391a3d,_0x4c9d75,_0x299a5d,_0x58b83a){if(_0x4769c8){_0x4769c8=_0x391a3d[_0xc4f4('0x54')];}_0x40d304=addFieldsToQuery(_0x40d304,_0x4769c8,_0x4c9d75,_0x58b83a,!![]);var _0x2558e9=squel['select']();_0x2558e9=addFieldsToQuery(_0x2558e9,_0x4769c8,_0x4c9d75,_0x58b83a,![]);if(_0x4c9d75||_0x58b83a){_0x40d304=applyJoinClauses(_0x40d304,!![]);_0x40d304[_0xc4f4('0x55')](_0xc4f4('0x56'));if(_0x391a3d[_0xc4f4('0x57')]){_0x2558e9['limit'](_0x391a3d[_0xc4f4('0x57')]);}if(_0x391a3d[_0xc4f4('0x58')]){_0x2558e9[_0xc4f4('0x58')](_0x391a3d['offset']);}}else{_0x2558e9=applyJoinClauses(_0x2558e9,![]);_0x2558e9[_0xc4f4('0x55')](_0xc4f4('0x59'));if(_0x391a3d[_0xc4f4('0x57')]){_0x40d304[_0xc4f4('0x57')](_0x391a3d[_0xc4f4('0x57')]);}if(_0x391a3d[_0xc4f4('0x58')]){_0x40d304[_0xc4f4('0x58')](_0x391a3d[_0xc4f4('0x58')]);}}_0x2558e9[_0xc4f4('0x5a')](_0x299a5d);if(_0x391a3d[_0xc4f4('0x5b')]){_0x391a3d['order'][_0xc4f4('0x1f')](function(_0x35d648){_0x40d304['order']('c.'+_0x35d648[0x0],_0x35d648[0x1]==='DESC'?![]:!![]);_0x2558e9[_0xc4f4('0x5b')](_0xc4f4('0x5c')+_0x35d648[0x0],_0x35d648[0x1]==='DESC'?![]:!![]);});}_0x2558e9['from'](_0x40d304,'subqry');return _0x2558e9;}function getFilteredContacts(_0x3584b4){var _0x17b667=[];return db['Tag']['findAll']({'attributes':['id',_0xc4f4('0x48'),_0xc4f4('0x5d')],'raw':!![]})[_0xc4f4('0x4e')](function(_0x461f16){_0x17b667=_[_0xc4f4('0x5e')](_0x461f16,'id');var _0x47ffb7={'type':db[_0xc4f4('0x5f')][_0xc4f4('0x60')]['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xc4f4('0x61')](_0x3584b4[_0xc4f4('0x62')](),_0x47ffb7);})[_0xc4f4('0x4e')](function(_0x101fac){_0x101fac[_0xc4f4('0x1f')](function(_0x116f4f){if(_0x116f4f[_0xc4f4('0x1c')]){_0x116f4f[_0xc4f4('0x63')]=[];_0x116f4f[_0xc4f4('0x1c')][_0xc4f4('0x24')](',')[_0xc4f4('0x1f')](function(_0x5c4fbe){_0x116f4f[_0xc4f4('0x63')][_0xc4f4('0x1e')](_0x17b667[_0x5c4fbe]);});}delete _0x116f4f[_0xc4f4('0x1c')];});return _0x101fac;});}function countFilteredContacts(_0x1b2a5b,_0x2c137a){var _0x1725c2=_0x1b2a5b[_0xc4f4('0x64')]();_0x1725c2[_0xc4f4('0x20')](_0xc4f4('0x65'));_0x1725c2=applyJoinClauses(_0x1725c2,!![]);_0x1b2a5b['group'](_0xc4f4('0x56'));var _0x599ffa=utils[_0xc4f4('0x22')](_0x2c137a);if(!_[_0xc4f4('0x66')](_0x599ffa)){_0x1725c2[_0xc4f4('0xb')](_0xc4f4('0x67'),_0x599ffa);}var _0x4ff96e={'type':db[_0xc4f4('0x5f')][_0xc4f4('0x60')]['SELECT'],'raw':!![]};return db[_0xc4f4('0x68')][_0xc4f4('0x61')](_0x1725c2[_0xc4f4('0x62')](),_0x4ff96e)[_0xc4f4('0x4e')](function(_0x17b742){return _0x17b742[0x0]['COUNT(*)'];});}module[_0xc4f4('0x69')]={'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 e79338a..90b6659 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 _0xe876=['base64','decryptString','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createCipher','data','update','binary','write','end','final','close','unlink','createReadStream','createWriteStream','createDecipher','encryptString','secret','utf8'];(function(_0x59d424,_0x2ce287){var _0x12641c=function(_0x498c06){while(--_0x498c06){_0x59d424['push'](_0x59d424['shift']());}};_0x12641c(++_0x2ce287);}(_0xe876,0x1f1));var _0x6e87=function(_0x308f8c,_0x4eb53c){_0x308f8c=_0x308f8c-0x0;var _0x2e8ace=_0xe876[_0x308f8c];return _0x2e8ace;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x6e87('0x0'));var config=require(_0x6e87('0x1'));var logger=require(_0x6e87('0x2'))(_0x6e87('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x6e87('0x4')][_0x6e87('0x5')],'algorithm':_0x6e87('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0x6e87('0x7')]&&config[_0x6e87('0x7')][_0x6e87('0x8')]){var isSupported=isAlgorithmSupported(config[_0x6e87('0x7')][_0x6e87('0x8')]);if(isSupported){fileOptions[_0x6e87('0x8')]=config[_0x6e87('0x7')][_0x6e87('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6e87('0x9')](',\x20');logger['error'](config['encrypt'][_0x6e87('0x8')],_0x6e87('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x19d153){return AES_SUPPORTED_RX['test'](_0x19d153);}function getSupportedCiphers(){return crypto[_0x6e87('0xb')]()[_0x6e87('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x2e5bd7){return getSupportedCiphers()[_0x6e87('0xd')](_0x2e5bd7)>-0x1;}function combineOptions(_0x3dcc2b){var _0x45bd24={};for(var _0x2db2a2 in fileOptions){if(fileOptions['hasOwnProperty'](_0x2db2a2)){_0x45bd24[_0x2db2a2]=fileOptions[_0x2db2a2];}}if(_0x3dcc2b){for(var _0x1a5ac6 in _0x3dcc2b){if(_0x3dcc2b[_0x6e87('0xe')](_0x1a5ac6)){_0x45bd24[_0x1a5ac6]=_0x3dcc2b[_0x1a5ac6];}}}return _0x45bd24;}exports[_0x6e87('0xf')]=function(_0xd54c16,_0x348147,_0xb54986,_0x448c65){return new BPromise(function(_0x1eb264,_0xdbe853){_0x448c65=combineOptions(_0x448c65);var _0x26c639=new Buffer(_0xb54986);var _0x41a306=fs['createReadStream'](_0xd54c16);var _0x5c6ce8=fs['createWriteStream'](_0x348147);var _0x40606a=crypto[_0x6e87('0x10')](_0x448c65['algorithm'],_0x26c639);_0x41a306['on'](_0x6e87('0x11'),function(_0x5c2d5c){var _0x44416d=new Buffer(_0x40606a[_0x6e87('0x12')](_0x5c2d5c),_0x6e87('0x13'));_0x5c6ce8[_0x6e87('0x14')](_0x44416d);});_0x41a306['on'](_0x6e87('0x15'),function(){try{var _0x42836e=new Buffer(_0x40606a[_0x6e87('0x16')]('binary'),_0x6e87('0x13'));_0x5c6ce8[_0x6e87('0x14')](_0x42836e);_0x5c6ce8['end']();_0x5c6ce8['on'](_0x6e87('0x17'),function(){return _0x1eb264(_0x348147);});}catch(_0x5ae738){fs[_0x6e87('0x18')](_0x348147);return _0xdbe853(_0x5ae738);}});});};exports['decryptFile']=function(_0x3d68e7,_0x1de0a7,_0x20968d,_0x40c05a){return new BPromise(function(_0x202497,_0x9344d3){_0x40c05a=combineOptions(_0x40c05a);var _0x3c18e4=new Buffer(_0x20968d);var _0x599ea4=fs[_0x6e87('0x19')](_0x3d68e7);var _0x1ff530=fs[_0x6e87('0x1a')](_0x1de0a7);var _0x129c2b=crypto[_0x6e87('0x1b')](_0x40c05a[_0x6e87('0x8')],_0x3c18e4);_0x599ea4['on'](_0x6e87('0x11'),function(_0x58b29c){var _0x507911=new Buffer(_0x129c2b[_0x6e87('0x12')](_0x58b29c),'binary');_0x1ff530[_0x6e87('0x14')](_0x507911);});_0x599ea4['on'](_0x6e87('0x15'),function(){try{var _0x82f6=new Buffer(_0x129c2b['final']('binary'),_0x6e87('0x13'));_0x1ff530[_0x6e87('0x14')](_0x82f6);_0x1ff530[_0x6e87('0x15')]();_0x1ff530['on']('close',function(){return _0x202497(_0x1de0a7);});}catch(_0x3976db){fs['unlink'](_0x1de0a7);return _0x9344d3(_0x3976db);}});});};exports[_0x6e87('0x1c')]=function(_0xd2c89e,_0x49f93a,_0x53a3f0){var _0x14bae3=_0x53a3f0||stringOptions[_0x6e87('0x8')];var _0x35192a=_0x49f93a||stringOptions[_0x6e87('0x1d')];var _0x458021=crypto['createCipher'](_0x14bae3,_0x35192a);var _0x2bf174=_0x458021[_0x6e87('0x12')](_0xd2c89e,_0x6e87('0x1e'),_0x6e87('0x1f'));_0x2bf174+=_0x458021[_0x6e87('0x16')](_0x6e87('0x1f'));return _0x2bf174;};exports[_0x6e87('0x20')]=function(_0x4b2240,_0x246dbc,_0x216de7){var _0x3a7eda=_0x216de7||stringOptions['algorithm'];var _0x29d80f=_0x246dbc||stringOptions['secret'];var _0x51466c=crypto['createDecipher'](_0x3a7eda,_0x29d80f);var _0x37384b=_0x51466c[_0x6e87('0x12')](_0x4b2240,_0x6e87('0x1f'),_0x6e87('0x1e'));_0x37384b+=_0x51466c[_0x6e87('0x16')](_0x6e87('0x1e'));return _0x37384b;}; \ No newline at end of file +var _0xc9cd=['getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','final','binary','write','end','unlink','decryptFile','createWriteStream','createDecipher','encryptString','utf8','base64','crypto','lodash','../../config/environment','app','session','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test'];(function(_0x3bdb5a,_0x39528d){var _0x3914ec=function(_0xcfab35){while(--_0xcfab35){_0x3bdb5a['push'](_0x3bdb5a['shift']());}};_0x3914ec(++_0x39528d);}(_0xc9cd,0x199));var _0xdc9c=function(_0x4b5c23,_0x101faa){_0x4b5c23=_0x4b5c23-0x0;var _0x262cfd=_0xc9cd[_0x4b5c23];return _0x262cfd;};'use strict';var crypto=require(_0xdc9c('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xdc9c('0x1'));var config=require(_0xdc9c('0x2'));var logger=require('../../config/logger')(_0xdc9c('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xdc9c('0x4')],'algorithm':_0xdc9c('0x5')};const fileOptions={'algorithm':_0xdc9c('0x6')};if(config['encrypt']&&config[_0xdc9c('0x7')][_0xdc9c('0x8')]){var isSupported=isAlgorithmSupported(config[_0xdc9c('0x7')][_0xdc9c('0x8')]);if(isSupported){fileOptions[_0xdc9c('0x8')]=config[_0xdc9c('0x7')][_0xdc9c('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config['encrypt'][_0xdc9c('0x8')],_0xdc9c('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x2fba56){return AES_SUPPORTED_RX[_0xdc9c('0xa')](_0x2fba56);}function getSupportedCiphers(){return crypto[_0xdc9c('0xb')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x48f6b1){return getSupportedCiphers()[_0xdc9c('0xc')](_0x48f6b1)>-0x1;}function combineOptions(_0x9b2bfa){var _0x38657f={};for(var _0x5887bc in fileOptions){if(fileOptions['hasOwnProperty'](_0x5887bc)){_0x38657f[_0x5887bc]=fileOptions[_0x5887bc];}}if(_0x9b2bfa){for(var _0x1a4196 in _0x9b2bfa){if(_0x9b2bfa[_0xdc9c('0xd')](_0x1a4196)){_0x38657f[_0x1a4196]=_0x9b2bfa[_0x1a4196];}}}return _0x38657f;}exports[_0xdc9c('0xe')]=function(_0x336590,_0xbe2c7d,_0x451594,_0x1b6b3a){return new BPromise(function(_0x412ba4,_0x5ca32b){_0x1b6b3a=combineOptions(_0x1b6b3a);var _0x41bbb1=new Buffer(_0x451594);var _0xbc95b2=fs[_0xdc9c('0xf')](_0x336590);var _0x4e846b=fs['createWriteStream'](_0xbe2c7d);var _0x33bd44=crypto[_0xdc9c('0x10')](_0x1b6b3a['algorithm'],_0x41bbb1);_0xbc95b2['on'](_0xdc9c('0x11'),function(_0x2de16b){var _0x2acfe1=new Buffer(_0x33bd44[_0xdc9c('0x12')](_0x2de16b),'binary');_0x4e846b['write'](_0x2acfe1);});_0xbc95b2['on']('end',function(){try{var _0x45e6e5=new Buffer(_0x33bd44[_0xdc9c('0x13')](_0xdc9c('0x14')),_0xdc9c('0x14'));_0x4e846b[_0xdc9c('0x15')](_0x45e6e5);_0x4e846b[_0xdc9c('0x16')]();_0x4e846b['on']('close',function(){return _0x412ba4(_0xbe2c7d);});}catch(_0x45673f){fs[_0xdc9c('0x17')](_0xbe2c7d);return _0x5ca32b(_0x45673f);}});});};exports[_0xdc9c('0x18')]=function(_0x5dc86d,_0x3015aa,_0x1dc14e,_0x169fa1){return new BPromise(function(_0x1c30a7,_0x1f6195){_0x169fa1=combineOptions(_0x169fa1);var _0x494bea=new Buffer(_0x1dc14e);var _0x40cc88=fs['createReadStream'](_0x5dc86d);var _0x10288c=fs[_0xdc9c('0x19')](_0x3015aa);var _0x5c8dd3=crypto[_0xdc9c('0x1a')](_0x169fa1['algorithm'],_0x494bea);_0x40cc88['on'](_0xdc9c('0x11'),function(_0x54bee1){var _0x3d8787=new Buffer(_0x5c8dd3[_0xdc9c('0x12')](_0x54bee1),_0xdc9c('0x14'));_0x10288c[_0xdc9c('0x15')](_0x3d8787);});_0x40cc88['on'](_0xdc9c('0x16'),function(){try{var _0x44ebbd=new Buffer(_0x5c8dd3['final'](_0xdc9c('0x14')),'binary');_0x10288c[_0xdc9c('0x15')](_0x44ebbd);_0x10288c['end']();_0x10288c['on']('close',function(){return _0x1c30a7(_0x3015aa);});}catch(_0x1dbdc8){fs['unlink'](_0x3015aa);return _0x1f6195(_0x1dbdc8);}});});};exports[_0xdc9c('0x1b')]=function(_0x46b433,_0x391dea,_0xdbf8bb){var _0x250e50=_0xdbf8bb||stringOptions[_0xdc9c('0x8')];var _0x4c182f=_0x391dea||stringOptions['secret'];var _0x549d15=crypto[_0xdc9c('0x10')](_0x250e50,_0x4c182f);var _0x1a03cb=_0x549d15[_0xdc9c('0x12')](_0x46b433,_0xdc9c('0x1c'),'base64');_0x1a03cb+=_0x549d15[_0xdc9c('0x13')](_0xdc9c('0x1d'));return _0x1a03cb;};exports['decryptString']=function(_0x16a099,_0x4123ec,_0x743248){var _0x4e5d78=_0x743248||stringOptions[_0xdc9c('0x8')];var _0x570895=_0x4123ec||stringOptions['secret'];var _0xefa0be=crypto[_0xdc9c('0x1a')](_0x4e5d78,_0x570895);var _0x1da560=_0xefa0be[_0xdc9c('0x12')](_0x16a099,_0xdc9c('0x1d'),'utf8');_0x1da560+=_0xefa0be[_0xdc9c('0x13')](_0xdc9c('0x1c'));return _0x1da560;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 7cf993e..3fdf3ea 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 _0xb0ee=['info','format','Setting','find','split','splitSizeCsv','sequelize','query','SELECT','then','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip\x20finished','CSV','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','util','path','lodash','to-csv','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport'];(function(_0x41c3bc,_0x271ee0){var _0x56f6f1=function(_0x37054e){while(--_0x37054e){_0x41c3bc['push'](_0x41c3bc['shift']());}};_0x56f6f1(++_0x271ee0);}(_0xb0ee,0x18b));var _0xeb0e=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xb0ee[_0x4e9d3c];return _0x2d0825;};'use strict';var util=require(_0xeb0e('0x0'));var path=require(_0xeb0e('0x1'));var _=require(_0xeb0e('0x2'));var csv=require(_0xeb0e('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xeb0e('0x4'))['db'];var dbH=require(_0xeb0e('0x4'))[_0xeb0e('0x5')];var logger=require(_0xeb0e('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xeb0e('0x7')][0x2]);var QUERY=process[_0xeb0e('0x7')][0x3];var PATH=process[_0xeb0e('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x388c23,_0x401daf){var _0x343601={'status':_0x388c23};var _0x21e66d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x401daf){_0x343601[_0xeb0e('0x8')]=_0x401daf;}return db[_0xeb0e('0x9')]['update'](_0x343601,_0x21e66d);}function main(){var _0x1840ba=0x1388;var _0x569f8c;logger[_0xeb0e('0xa')](util[_0xeb0e('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xeb0e('0xc')][_0xeb0e('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xeb0e('0xe'),_0xeb0e('0xf')]})['then'](function(_0x33e5ec){if(_0x33e5ec){_0x569f8c=_0x33e5ec;_0x1840ba=_0x569f8c[_0xeb0e('0xf')]||0x1388;}})['then'](function(){return dbH[_0xeb0e('0x10')][_0xeb0e('0x11')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xeb0e('0x10')]['QueryTypes'][_0xeb0e('0x12')]});})[_0xeb0e('0x13')](function(_0xc1c310){if(!_0xc1c310[0x0][_0xeb0e('0x14')]){return analyticExtractedReport(_0xeb0e('0x15'));}var _0x3f14b5=[];var _0x4d4d3b=0x0;if(_0x569f8c[_0xeb0e('0xe')]){if(_0xc1c310&&_0xc1c310[_0xeb0e('0x16')]){var _0x2ab678=_[_0xeb0e('0x17')](_0xc1c310[0x0]['num']/_0x1840ba);var _0x542bf9=Number['isInteger'](_0xc1c310[0x0][_0xeb0e('0x14')]/_0x1840ba)?_0xc1c310[0x0][_0xeb0e('0x14')]%_0x1840ba:0x0;_0x2ab678[_0xeb0e('0x18')](function(_0x1b0cf7){if(_0x1b0cf7>0x0){_0x4d4d3b+=_0x1840ba;}_0x3f14b5[_0xeb0e('0x19')](dbH[_0xeb0e('0x10')][_0xeb0e('0x11')](util['format'](_0xeb0e('0x1a'),QUERY,_0x1840ba,_0x4d4d3b),{'type':dbH[_0xeb0e('0x10')]['QueryTypes'][_0xeb0e('0x12')]}));});if(_0x542bf9>0x0){_0x4d4d3b+=_0x1840ba;_0x3f14b5['push'](dbH['sequelize'][_0xeb0e('0x11')](util[_0xeb0e('0xb')](_0xeb0e('0x1a'),QUERY,_0x542bf9,_0x4d4d3b),{'type':dbH['sequelize'][_0xeb0e('0x1b')]['SELECT']}));}}}else{_0x3f14b5[_0xeb0e('0x19')](dbH[_0xeb0e('0x10')][_0xeb0e('0x11')](QUERY,{'type':dbH[_0xeb0e('0x10')][_0xeb0e('0x1b')][_0xeb0e('0x12')]}));}var _0x4e0f2d=path[_0xeb0e('0x1c')](PATH);var _0x59ed76=path[_0xeb0e('0x1d')](PATH,'.csv');var _0x41c7a8=_0x569f8c[_0xeb0e('0xe')]&&_0x3f14b5[_0xeb0e('0x16')]>0x1;var _0x415eee=[];if(!fs[_0xeb0e('0x1e')](path[_0xeb0e('0x1f')](_0x4e0f2d,_0x59ed76))&&_0x41c7a8){fs[_0xeb0e('0x20')](path[_0xeb0e('0x1f')](_0x4e0f2d,_0x59ed76));}return BPromise[_0xeb0e('0x21')](_0x3f14b5,function(_0x2855d9){_0x415eee[_0xeb0e('0x19')](_0x2855d9);})[_0xeb0e('0x13')](function(){for(var _0x50f0c2=0x0;_0x50f0c2<_0x415eee[_0xeb0e('0x16')];_0x50f0c2+=0x1){var _0x4c4174;var _0x20c6de=_0x415eee[_0x50f0c2];if(_0x41c7a8){_0x4c4174=path['join'](_0x4e0f2d,_0x59ed76,util[_0xeb0e('0xb')](_0xeb0e('0x22'),_0x59ed76,_0x50f0c2,_0xeb0e('0x23')));}else{_0x4c4174=path[_0xeb0e('0x1f')](_0x4e0f2d,util[_0xeb0e('0xb')](_0xeb0e('0x24'),_0x59ed76,_0xeb0e('0x23')));}fs['writeFileSync'](_0x4c4174,csv(_0x20c6de));}})[_0xeb0e('0x13')](function(){if(_0x41c7a8){return new Promise(function(_0x2eb850){zipdir(path[_0xeb0e('0x1f')](_0x4e0f2d,_0x59ed76),{'saveTo':path[_0xeb0e('0x1f')](_0x4e0f2d,util[_0xeb0e('0xb')](_0xeb0e('0x24'),_0x59ed76,'zip'))},function(_0x8ebc06,_0x3afd93){rimraf(path[_0xeb0e('0x1f')](_0x4e0f2d,_0x59ed76),function(){});_0x2eb850(_0xeb0e('0x25'));});});}})[_0xeb0e('0x13')](function(){logger[_0xeb0e('0xa')](util[_0xeb0e('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xeb0e('0x26')));return analyticExtractedReport(_0xeb0e('0x27'),_0x41c7a8?util[_0xeb0e('0xb')](_0xeb0e('0x24'),_0x59ed76,_0x41c7a8?_0xeb0e('0x28'):_0xeb0e('0x23')):null);});})[_0xeb0e('0x29')](function(_0x475dbc){logger[_0xeb0e('0xa')](util[_0xeb0e('0xb')](_0xeb0e('0x2a'),EXTRACTED_REPORT_ID,_0xeb0e('0x26')),util['inspect'](_0x475dbc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xeb0e('0x2b'));})['finally'](function(){process[_0xeb0e('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8343=['bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Empty','length','range','isInteger','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','existsSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','to-csv'];(function(_0x1753fd,_0x3d5e1e){var _0x6e9db8=function(_0x10405d){while(--_0x10405d){_0x1753fd['push'](_0x1753fd['shift']());}};_0x6e9db8(++_0x3d5e1e);}(_0x8343,0xbc));var _0x3834=function(_0x483b06,_0x569bd0){_0x483b06=_0x483b06-0x0;var _0x5e0f30=_0x8343[_0x483b06];return _0x5e0f30;};'use strict';var util=require(_0x3834('0x0'));var path=require(_0x3834('0x1'));var _=require(_0x3834('0x2'));var csv=require(_0x3834('0x3'));var fs=require('fs');var BPromise=require(_0x3834('0x4'));var zipdir=require(_0x3834('0x5'));var rimraf=require(_0x3834('0x6'));var db=require(_0x3834('0x7'))['db'];var dbH=require(_0x3834('0x7'))[_0x3834('0x8')];var logger=require('../../config/logger')(_0x3834('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x3834('0xa')][0x2]);var QUERY=process[_0x3834('0xa')][0x3];var PATH=process[_0x3834('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1273da,_0x3a7405){var _0x57cd89={'status':_0x1273da};var _0x20dc41={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a7405){_0x57cd89[_0x3834('0xb')]=_0x3a7405;}return db['AnalyticExtractedReport']['update'](_0x57cd89,_0x20dc41);}function main(){var _0x2d98dc=0x1388;var _0x2d174d;logger[_0x3834('0xc')](util[_0x3834('0xd')](_0x3834('0xe'),EXTRACTED_REPORT_ID,_0x3834('0xf')));return db[_0x3834('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3834('0x11'),_0x3834('0x12')]})[_0x3834('0x13')](function(_0x2c5fb2){if(_0x2c5fb2){_0x2d174d=_0x2c5fb2;_0x2d98dc=_0x2d174d[_0x3834('0x12')]||0x1388;}})[_0x3834('0x13')](function(){return dbH[_0x3834('0x14')][_0x3834('0x15')](util[_0x3834('0xd')](_0x3834('0x16'),QUERY),{'type':dbH[_0x3834('0x14')]['QueryTypes']['SELECT']});})[_0x3834('0x13')](function(_0x221425){if(!_0x221425[0x0]['num']){return analyticExtractedReport(_0x3834('0x17'));}var _0x30eebd=[];var _0x10cf65=0x0;if(_0x2d174d[_0x3834('0x11')]){if(_0x221425&&_0x221425[_0x3834('0x18')]){var _0x4f9020=_[_0x3834('0x19')](_0x221425[0x0]['num']/_0x2d98dc);var _0x5c600f=Number[_0x3834('0x1a')](_0x221425[0x0][_0x3834('0x1b')]/_0x2d98dc)?_0x221425[0x0]['num']%_0x2d98dc:0x0;_0x4f9020[_0x3834('0x1c')](function(_0x3ed7ee){if(_0x3ed7ee>0x0){_0x10cf65+=_0x2d98dc;}_0x30eebd[_0x3834('0x1d')](dbH[_0x3834('0x14')]['query'](util['format'](_0x3834('0x1e'),QUERY,_0x2d98dc,_0x10cf65),{'type':dbH['sequelize'][_0x3834('0x1f')][_0x3834('0x20')]}));});if(_0x5c600f>0x0){_0x10cf65+=_0x2d98dc;_0x30eebd[_0x3834('0x1d')](dbH[_0x3834('0x14')]['query'](util[_0x3834('0xd')](_0x3834('0x1e'),QUERY,_0x5c600f,_0x10cf65),{'type':dbH[_0x3834('0x14')][_0x3834('0x1f')][_0x3834('0x20')]}));}}}else{_0x30eebd[_0x3834('0x1d')](dbH[_0x3834('0x14')][_0x3834('0x15')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x3834('0x20')]}));}var _0x2e66a8=path['dirname'](PATH);var _0x289672=path[_0x3834('0x21')](PATH,'.csv');var _0x463ac7=_0x2d174d[_0x3834('0x11')]&&_0x30eebd[_0x3834('0x18')]>0x1;var _0x18d51a=[];if(!fs[_0x3834('0x22')](path[_0x3834('0x23')](_0x2e66a8,_0x289672))&&_0x463ac7){fs['mkdirSync'](path[_0x3834('0x23')](_0x2e66a8,_0x289672));}return BPromise['each'](_0x30eebd,function(_0x27b336){_0x18d51a[_0x3834('0x1d')](_0x27b336);})[_0x3834('0x13')](function(){for(var _0x4f0015=0x0;_0x4f0015<_0x18d51a[_0x3834('0x18')];_0x4f0015+=0x1){var _0x56b6d4;var _0x1a616b=_0x18d51a[_0x4f0015];if(_0x463ac7){_0x56b6d4=path[_0x3834('0x23')](_0x2e66a8,_0x289672,util[_0x3834('0xd')](_0x3834('0x24'),_0x289672,_0x4f0015,_0x3834('0x25')));}else{_0x56b6d4=path[_0x3834('0x23')](_0x2e66a8,util[_0x3834('0xd')](_0x3834('0x26'),_0x289672,'csv'));}fs[_0x3834('0x27')](_0x56b6d4,csv(_0x1a616b));}})[_0x3834('0x13')](function(){if(_0x463ac7){return new Promise(function(_0x938177){zipdir(path[_0x3834('0x23')](_0x2e66a8,_0x289672),{'saveTo':path[_0x3834('0x23')](_0x2e66a8,util[_0x3834('0xd')](_0x3834('0x26'),_0x289672,'zip'))},function(_0x30695f,_0x13fe35){rimraf(path['join'](_0x2e66a8,_0x289672),function(){});_0x938177(_0x3834('0x28'));});});}})[_0x3834('0x13')](function(){logger[_0x3834('0xc')](util['format'](_0x3834('0x29'),EXTRACTED_REPORT_ID,_0x3834('0xf')));return analyticExtractedReport(_0x3834('0x2a'),_0x463ac7?util[_0x3834('0xd')](_0x3834('0x26'),_0x289672,_0x463ac7?_0x3834('0x2b'):'csv'):null);});})['catch'](function(_0x4520ba){logger[_0x3834('0xc')](util[_0x3834('0xd')](_0x3834('0x2c'),EXTRACTED_REPORT_ID,_0x3834('0xf')),util[_0x3834('0x2d')](_0x4520ba,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3834('0x2e'));})['finally'](function(){process[_0x3834('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 46f4ee4..a052a04 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 _0x703f=['Arial','right','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','join','zip','info','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','end','lodash','path','rimraf','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','endDate','header','margin','landscape','\x20/\x20'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x703f,0x87));var _0xf703=function(_0x38797a,_0x5b2537){_0x38797a=_0x38797a-0x0;var _0x51cbcf=_0x703f[_0x38797a];return _0x51cbcf;};'use strict';var _=require(_0xf703('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xf703('0x1'));var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0xf703('0x2'));var JSDOM=require('jsdom')[_0xf703('0x3')];var window=new JSDOM('')[_0xf703('0x4')];var BPromise=require(_0xf703('0x5'));var db=require(_0xf703('0x6'))['db'];var dbH=require('../../mysqldb')[_0xf703('0x7')];var logger=require(_0xf703('0x8'))(_0xf703('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xf703('0xa')][0x2]);var QUERY=process[_0xf703('0xa')][0x3];var PATH=process[_0xf703('0xa')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf703('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1d445f,_0x1b33c7){var _0xff9ec={'status':_0x1d445f};var _0x9451d1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b33c7){_0xff9ec[_0xf703('0xc')]=_0x1b33c7;}return db['AnalyticExtractedReport'][_0xf703('0xd')](_0xff9ec,_0x9451d1);}function getHeaders(_0x2c00c7){return _[_0xf703('0xe')](_0x2c00c7,function(_0x116edc){return{'text':_0x116edc,'style':_0xf703('0xf')};});}function getRows(_0x2ebf0a,_0x25590f){return _[_0xf703('0xe')](_0x25590f,function(_0x55f36f){return _(_0x55f36f)[_0xf703('0x10')](_0x2ebf0a)[_0xf703('0xe')](function(_0x1f370c){return _0x1f370c?_[_0xf703('0x11')](_0x1f370c):'';})[_0xf703('0x12')]();});}function createTable(_0x109ae0,_0x4eb4f8){var _0x38cbea={'widths':_[_0xf703('0x13')](Array(_0x109ae0[_0xf703('0x14')]),0x91),'heights':function(_0x560407){return _0x560407===0x0?_0xf703('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x55e878=getHeaders(_0x109ae0);_0x38cbea[_0xf703('0x16')][_0xf703('0x17')](_0x55e878);var _0x26b0d8=getRows(_0x109ae0,_0x4eb4f8);_0x38cbea['body']=_0x38cbea[_0xf703('0x16')]['concat'](_0x26b0d8);return _0x38cbea;}function createTables(_0x1b30c7){var _0x262281=[];var _0x4c851e=_[_0xf703('0x18')](Object[_0xf703('0x19')](_0x1b30c7[0x0]),0x5);_0x4c851e[_0xf703('0x1a')](function(_0x5c5734){_0x262281[_0xf703('0x17')](createTable(_0x5c5734,_0x1b30c7));});return _0x262281;}function getPDFDocDefinition(_0x1e2110){var _0x3823df=util['format'](_0xf703('0x1b'),NAME,EXTRACTED_REPORT[_0xf703('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0xf703('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xf703('0x1e')])[_0xf703('0x1d')](FORMAT));var _0x2e597b=[];for(var _0x3366ab=0x0;_0x3366ab<_0x1e2110['length'];_0x3366ab++){var _0x4d15a6=[];if(_0x3366ab===0x0){_0x4d15a6[_0xf703('0x17')]({'text':_0x3823df,'style':_0xf703('0x1f')});}var _0x15e1bf={'table':_0x1e2110[_0x3366ab]};if(_0x3366ab>0x0){_0x15e1bf['pageBreak']='before';_0x15e1bf[_0xf703('0x20')]=[0x0,0x46,0x0,0x0];}_0x4d15a6[_0xf703('0x17')](_0x15e1bf);_0x2e597b[_0xf703('0x17')](_0x4d15a6);}return{'pageSize':'A4','pageOrientation':_0xf703('0x21'),'content':_0x2e597b,'footer':function(_0x553465,_0x166214){return{'text':_0x553465[_0xf703('0x11')]()+_0xf703('0x22')+_0x166214,'style':'footer'};},'defaultStyle':{'font':_0xf703('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xf703('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x34fe01){var _0x40b38f=0x1388;var _0x5e4674;if(!_0x34fe01[0x0][_0xf703('0x25')]){return analyticExtractedReport(_0xf703('0x26'));}return db[_0xf703('0x27')][_0xf703('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf703('0x29')]})[_0xf703('0x2a')](function(_0x18c9e8){if(_0x18c9e8){_0x5e4674=_0x18c9e8;_0x40b38f=_0x5e4674[_0xf703('0x29')]||0x3e8;}})[_0xf703('0x2a')](function(){var _0x3edfe0=[];var _0xb80cfa=0x0;if(_0x5e4674[_0xf703('0x2b')]){if(_0x34fe01&&_0x34fe01[_0xf703('0x14')]){var _0x28dcc0=_[_0xf703('0x2c')](_0x34fe01[0x0][_0xf703('0x25')]/_0x40b38f);var _0x3a8098=Number[_0xf703('0x2d')](_0x34fe01[0x0][_0xf703('0x25')]/_0x40b38f)?_0x34fe01[0x0][_0xf703('0x25')]%_0x40b38f:0x0;_0x28dcc0[_0xf703('0x1a')](function(_0x52582e){if(_0x52582e>0x0){_0xb80cfa+=_0x40b38f;}_0x3edfe0[_0xf703('0x17')](dbH[_0xf703('0x2e')][_0xf703('0x2f')](util['format'](_0xf703('0x30'),QUERY,_0x40b38f,_0xb80cfa),{'type':dbH[_0xf703('0x2e')][_0xf703('0x31')]['SELECT']}));});if(_0x3a8098>0x0){_0xb80cfa+=_0x40b38f;_0x3edfe0['push'](dbH[_0xf703('0x2e')][_0xf703('0x2f')](util[_0xf703('0x1d')](_0xf703('0x30'),QUERY,_0x3a8098,_0xb80cfa),{'type':dbH['sequelize'][_0xf703('0x31')][_0xf703('0x32')]}));}}}else{_0x3edfe0['push'](dbH[_0xf703('0x2e')][_0xf703('0x2f')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xf703('0x32')]}));}var _0xeada40=path[_0xf703('0x33')](PATH);var _0x4dd01=path['basename'](PATH,_0xf703('0x34'));var _0x18c515=_0x5e4674['split']&&_0x3edfe0[_0xf703('0x14')]>0x1;var _0x289cd3=[];if(!fs['existsSync'](path['join'](_0xeada40,_0x4dd01))&&_0x18c515){fs[_0xf703('0x35')](path['join'](_0xeada40,_0x4dd01));}return BPromise[_0xf703('0x36')](_0x3edfe0,function(_0xeeb442){_0x289cd3[_0xf703('0x17')](_0xeeb442);})[_0xf703('0x2a')](function(){var _0x40d84c=[];for(var _0x548d1e=0x0;_0x548d1e<_0x289cd3[_0xf703('0x14')];_0x548d1e+=0x1){var _0x578f68=_0x289cd3[_0x548d1e];var _0x5a707f=createTables(_[_0xf703('0x37')](_0x578f68));var _0xfb85;var _0x471d5f=getPDFDocDefinition(_0x5a707f);var _0x409030=getPDFPrinter();var _0x4944c2=_0x409030[_0xf703('0x38')](_0x471d5f);if(_0x18c515){_0xfb85=path['join'](_0xeada40,_0x4dd01,util[_0xf703('0x1d')]('%s%d.%s',_0x4dd01,_0x548d1e,_0xf703('0x39')));}else{_0xfb85=path['join'](_0xeada40,util[_0xf703('0x1d')](_0xf703('0x3a'),_0x4dd01,_0xf703('0x39')));}_0x40d84c[_0xf703('0x17')](writePDFDocument(_0x4944c2,_0xfb85));}return Promise[_0xf703('0x3b')](_0x40d84c);})[_0xf703('0x2a')](function(){if(_0x18c515){return new Promise(function(_0x5415cc){zipdir(path['join'](_0xeada40,_0x4dd01),{'saveTo':path[_0xf703('0x3c')](_0xeada40,util['format'](_0xf703('0x3a'),_0x4dd01,_0xf703('0x3d')))},function(){rimraf(path[_0xf703('0x3c')](_0xeada40,_0x4dd01),function(){});_0x5415cc('zip\x20finished');});});}})['then'](function(){if(!_0x18c515)return;rimraf(path[_0xf703('0x3c')](_0xeada40,_0x4dd01),function(){});})[_0xf703('0x2a')](function(){logger[_0xf703('0x3e')](util[_0xf703('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xf703('0x3f'),_0x18c515?util[_0xf703('0x1d')](_0xf703('0x3a'),_0x4dd01,_0x18c515?_0xf703('0x3d'):_0xf703('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf703('0x3e')](util[_0xf703('0x1d')](_0xf703('0x40'),EXTRACTED_REPORT_ID,_0xf703('0x41')));return db[_0xf703('0x42')][_0xf703('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf703('0x2a')](function(_0x320898){EXTRACTED_REPORT=_0x320898;return dbH['sequelize']['query'](util[_0xf703('0x1d')](_0xf703('0x44'),QUERY),{'type':dbH[_0xf703('0x2e')][_0xf703('0x31')][_0xf703('0x32')]});})['then'](extractReport)[_0xf703('0x45')](function(_0x35b770){logger[_0xf703('0x3e')](util[_0xf703('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf703('0x41')),util['inspect'](_0x35b770,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf703('0x46')](function(){process[_0xf703('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x385027=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xf703('0x48'),'italics':__dirname+_0xf703('0x49'),'bolditalics':__dirname+_0xf703('0x4a')}});return _0x385027;}function getPDFDocDefinitionFromHTML(_0x3dcda3,_0x2ea92e){var _0x2c7f7f=util[_0xf703('0x1d')]('%s\x20#%d',_0x2ea92e[_0xf703('0x4b')],_0x2ea92e[_0xf703('0x4c')]);var _0x5d9abd=moment()[_0xf703('0x1d')](_0xf703('0x4d'))[_0xf703('0x11')]();var _0x5eb3fb=htmlToPdfmake(_0x3dcda3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5eb3fb],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf703('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf703('0x4e'),'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':_0xf703('0x1f')}];},'footer':function(_0x9353f1,_0x272cbe){return[{'text':util[_0xf703('0x1d')](_0xf703('0x4f'),_0x2c7f7f,_0x9353f1,_0x272cbe,_0x5d9abd),'style':_0xf703('0x50')}];}};}function writePDFDocument(_0x74f216,_0x2db450){return new Promise(function(_0x39b7ff,_0x458a3c){var _0x3deb69=_0x74f216[_0xf703('0x51')](fs[_0xf703('0x52')](_0x2db450));_0x3deb69['on'](_0xf703('0x53'),function(){_0x39b7ff('finish');});_0x3deb69['on']('error',function(_0xc03a60){_0x458a3c(_0xc03a60);});_0x74f216[_0xf703('0x54')]();});}exports['createPdfFromHTML']=function(_0x5d6504,_0x4c437f){var _0x1aa440=getPDFPrinter();var _0x4a7ea9=getPDFDocDefinitionFromHTML(_0x5d6504,_0x4c437f);var _0x51bd27=_0x1aa440['createPdfKitDocument'](_0x4a7ea9);return writePDFDocument(_0x51bd27,_0x4c437f[_0xf703('0x1')])['catch'](function(_0x4172ef){throw _0x4172ef;});}; \ No newline at end of file +var _0xb88e=['endDate','pageBreak','before','\x20/\x20','footer','Arial','black','Empty','Setting','split','splitSizePdf','then','range','num','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','createPdfFromHTML','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','toString','length','push','body','chunk','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','format'];(function(_0x131a70,_0x5f53b2){var _0x212967=function(_0x2a43ac){while(--_0x2a43ac){_0x131a70['push'](_0x131a70['shift']());}};_0x212967(++_0x5f53b2);}(_0xb88e,0xe4));var _0xeb88=function(_0x5ddc0b,_0x5b7ff5){_0x5ddc0b=_0x5ddc0b-0x0;var _0x149b1b=_0xb88e[_0x5ddc0b];return _0x149b1b;};'use strict';var _=require(_0xeb88('0x0'));var fs=require('fs');var util=require(_0xeb88('0x1'));var path=require(_0xeb88('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0xeb88('0x3'));var PdfPrinter=require(_0xeb88('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xeb88('0x5'));var JSDOM=require(_0xeb88('0x6'))[_0xeb88('0x7')];var window=new JSDOM('')[_0xeb88('0x8')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0xeb88('0x9'))[_0xeb88('0xa')];var logger=require(_0xeb88('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xeb88('0xc')][0x3];var PATH=process[_0xeb88('0xc')][0x4];var NAME=process[_0xeb88('0xc')][0x5];var FORMAT=_0xeb88('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f2f73,_0xcb9ef5){var _0x1d0e9c={'status':_0x1f2f73};var _0x4a2466={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xcb9ef5){_0x1d0e9c[_0xeb88('0xe')]=_0xcb9ef5;}return db['AnalyticExtractedReport'][_0xeb88('0xf')](_0x1d0e9c,_0x4a2466);}function getHeaders(_0x3105ad){return _[_0xeb88('0x10')](_0x3105ad,function(_0x233d08){return{'text':_0x233d08,'style':'tableHeader'};});}function getRows(_0xef3c29,_0x4d1cc7){return _[_0xeb88('0x10')](_0x4d1cc7,function(_0x50ceab){return _(_0x50ceab)['pick'](_0xef3c29)['map'](function(_0x24171d){return _0x24171d?_[_0xeb88('0x11')](_0x24171d):'';})['value']();});}function createTable(_0x5411a7,_0x5dcbd6){var _0x37fd3c={'widths':_['fill'](Array(_0x5411a7[_0xeb88('0x12')]),0x91),'heights':function(_0x1296b1){return _0x1296b1===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5d315a=getHeaders(_0x5411a7);_0x37fd3c['body'][_0xeb88('0x13')](_0x5d315a);var _0xaaff31=getRows(_0x5411a7,_0x5dcbd6);_0x37fd3c[_0xeb88('0x14')]=_0x37fd3c[_0xeb88('0x14')]['concat'](_0xaaff31);return _0x37fd3c;}function createTables(_0x496d27){var _0x42c476=[];var _0x1e85bb=_[_0xeb88('0x15')](Object['keys'](_0x496d27[0x0]),0x5);_0x1e85bb['forEach'](function(_0x4cde84){_0x42c476[_0xeb88('0x13')](createTable(_0x4cde84,_0x496d27));});return _0x42c476;}function getPDFDocDefinition(_0x3e09ab){var _0x348015=util['format'](_0xeb88('0x16'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0xeb88('0x17')](FORMAT),moment(EXTRACTED_REPORT[_0xeb88('0x18')])['format'](FORMAT));var _0xc3a32f=[];for(var _0x22bd00=0x0;_0x22bd00<_0x3e09ab[_0xeb88('0x12')];_0x22bd00++){var _0x4c4ec0=[];if(_0x22bd00===0x0){_0x4c4ec0['push']({'text':_0x348015,'style':'header'});}var _0x3a10a2={'table':_0x3e09ab[_0x22bd00]};if(_0x22bd00>0x0){_0x3a10a2[_0xeb88('0x19')]=_0xeb88('0x1a');_0x3a10a2['margin']=[0x0,0x46,0x0,0x0];}_0x4c4ec0[_0xeb88('0x13')](_0x3a10a2);_0xc3a32f[_0xeb88('0x13')](_0x4c4ec0);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0xc3a32f,'footer':function(_0x362539,_0x484464){return{'text':_0x362539[_0xeb88('0x11')]()+_0xeb88('0x1b')+_0x484464,'style':_0xeb88('0x1c')};},'defaultStyle':{'font':_0xeb88('0x1d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xeb88('0x1e')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5383b6){var _0x27cd05=0x1388;var _0x45bd45;if(!_0x5383b6[0x0]['num']){return analyticExtractedReport(_0xeb88('0x1f'));}return db[_0xeb88('0x20')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xeb88('0x21'),_0xeb88('0x22')]})[_0xeb88('0x23')](function(_0x153f2e){if(_0x153f2e){_0x45bd45=_0x153f2e;_0x27cd05=_0x45bd45[_0xeb88('0x22')]||0x3e8;}})[_0xeb88('0x23')](function(){var _0x23d577=[];var _0x4f3785=0x0;if(_0x45bd45['split']){if(_0x5383b6&&_0x5383b6['length']){var _0x1cb4bc=_[_0xeb88('0x24')](_0x5383b6[0x0][_0xeb88('0x25')]/_0x27cd05);var _0x1c8163=Number[_0xeb88('0x26')](_0x5383b6[0x0][_0xeb88('0x25')]/_0x27cd05)?_0x5383b6[0x0][_0xeb88('0x25')]%_0x27cd05:0x0;_0x1cb4bc[_0xeb88('0x27')](function(_0x1a85c4){if(_0x1a85c4>0x0){_0x4f3785+=_0x27cd05;}_0x23d577[_0xeb88('0x13')](dbH['sequelize'][_0xeb88('0x28')](util['format'](_0xeb88('0x29'),QUERY,_0x27cd05,_0x4f3785),{'type':dbH[_0xeb88('0x2a')][_0xeb88('0x2b')]['SELECT']}));});if(_0x1c8163>0x0){_0x4f3785+=_0x27cd05;_0x23d577['push'](dbH[_0xeb88('0x2a')][_0xeb88('0x28')](util[_0xeb88('0x17')](_0xeb88('0x29'),QUERY,_0x1c8163,_0x4f3785),{'type':dbH['sequelize'][_0xeb88('0x2b')]['SELECT']}));}}}else{_0x23d577['push'](dbH[_0xeb88('0x2a')][_0xeb88('0x28')](QUERY,{'type':dbH[_0xeb88('0x2a')][_0xeb88('0x2b')][_0xeb88('0x2c')]}));}var _0x4e2664=path[_0xeb88('0x2d')](PATH);var _0x561788=path[_0xeb88('0x2e')](PATH,_0xeb88('0x2f'));var _0x8fd2db=_0x45bd45[_0xeb88('0x21')]&&_0x23d577[_0xeb88('0x12')]>0x1;var _0x3fca47=[];if(!fs[_0xeb88('0x30')](path[_0xeb88('0x31')](_0x4e2664,_0x561788))&&_0x8fd2db){fs['mkdirSync'](path['join'](_0x4e2664,_0x561788));}return BPromise[_0xeb88('0x32')](_0x23d577,function(_0xdfa4ad){_0x3fca47['push'](_0xdfa4ad);})[_0xeb88('0x23')](function(){var _0x11913d=[];for(var _0x465cc1=0x0;_0x465cc1<_0x3fca47[_0xeb88('0x12')];_0x465cc1+=0x1){var _0x1f6b1e=_0x3fca47[_0x465cc1];var _0x4b04be=createTables(_[_0xeb88('0x33')](_0x1f6b1e));var _0x2a782d;var _0xf9a08d=getPDFDocDefinition(_0x4b04be);var _0x54458f=getPDFPrinter();var _0x28f6f2=_0x54458f[_0xeb88('0x34')](_0xf9a08d);if(_0x8fd2db){_0x2a782d=path[_0xeb88('0x31')](_0x4e2664,_0x561788,util['format'](_0xeb88('0x35'),_0x561788,_0x465cc1,_0xeb88('0x36')));}else{_0x2a782d=path[_0xeb88('0x31')](_0x4e2664,util[_0xeb88('0x17')](_0xeb88('0x37'),_0x561788,_0xeb88('0x36')));}_0x11913d['push'](writePDFDocument(_0x28f6f2,_0x2a782d));}return Promise[_0xeb88('0x38')](_0x11913d);})[_0xeb88('0x23')](function(){if(_0x8fd2db){return new Promise(function(_0x23fd1b){zipdir(path[_0xeb88('0x31')](_0x4e2664,_0x561788),{'saveTo':path['join'](_0x4e2664,util[_0xeb88('0x17')]('%s.%s',_0x561788,_0xeb88('0x39')))},function(){rimraf(path[_0xeb88('0x31')](_0x4e2664,_0x561788),function(){});_0x23fd1b(_0xeb88('0x3a'));});});}})['then'](function(){if(!_0x8fd2db)return;rimraf(path[_0xeb88('0x31')](_0x4e2664,_0x561788),function(){});})['then'](function(){logger[_0xeb88('0x3b')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x8fd2db?util[_0xeb88('0x17')](_0xeb88('0x37'),_0x561788,_0x8fd2db?_0xeb88('0x39'):_0xeb88('0x36')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xeb88('0x3b')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xeb88('0x3c')));return db[_0xeb88('0x3d')][_0xeb88('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xeb88('0x23')](function(_0x1ca040){EXTRACTED_REPORT=_0x1ca040;return dbH[_0xeb88('0x2a')][_0xeb88('0x28')](util[_0xeb88('0x17')](_0xeb88('0x3f'),QUERY),{'type':dbH['sequelize'][_0xeb88('0x2b')][_0xeb88('0x2c')]});})[_0xeb88('0x23')](extractReport)[_0xeb88('0x40')](function(_0x52c271){logger[_0xeb88('0x3b')](util[_0xeb88('0x17')](_0xeb88('0x41'),EXTRACTED_REPORT_ID,_0xeb88('0x3c')),util[_0xeb88('0x42')](_0x52c271,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xeb88('0x43'));})[_0xeb88('0x44')](function(){process[_0xeb88('0x45')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4cad2d=new PdfPrinter({'Arial':{'normal':__dirname+_0xeb88('0x46'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xeb88('0x47'),'bolditalics':__dirname+_0xeb88('0x48')}});return _0x4cad2d;}function getPDFDocDefinitionFromHTML(_0x85e388,_0x2e3010){var _0x57ce6d=util[_0xeb88('0x17')](_0xeb88('0x49'),_0x2e3010[_0xeb88('0x4a')],_0x2e3010[_0xeb88('0x4b')]);var _0x156824=moment()['format']('YYYY-MM-DD')['toString']();var _0x4f9942=htmlToPdfmake(_0x85e388,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4f9942],'defaultStyle':{'font':_0xeb88('0x1d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','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':_0xeb88('0x4c')}},'header':function(){return[{'text':_0xeb88('0x4d'),'style':_0xeb88('0x4e')}];},'footer':function(_0x3bcd28,_0x5c780f){return[{'text':util[_0xeb88('0x17')](_0xeb88('0x4f'),_0x57ce6d,_0x3bcd28,_0x5c780f,_0x156824),'style':_0xeb88('0x1c')}];}};}function writePDFDocument(_0x1e24a5,_0x411357){return new Promise(function(_0x5e2828,_0x296397){var _0x30bd3e=_0x1e24a5[_0xeb88('0x50')](fs['createWriteStream'](_0x411357));_0x30bd3e['on'](_0xeb88('0x51'),function(){_0x5e2828(_0xeb88('0x51'));});_0x30bd3e['on'](_0xeb88('0x52'),function(_0x1461d0){_0x296397(_0x1461d0);});_0x1e24a5['end']();});}exports[_0xeb88('0x53')]=function(_0x763cf6,_0x45ecf7){var _0x1fedec=getPDFPrinter();var _0x220c0f=getPDFDocDefinitionFromHTML(_0x763cf6,_0x45ecf7);var _0x56a7a4=_0x1fedec[_0xeb88('0x34')](_0x220c0f);return writePDFDocument(_0x56a7a4,_0x45ecf7[_0xeb88('0x2')])['catch'](function(_0xfd8363){throw _0xfd8363;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 2909df6..e87dcfa 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 _0x6b39=['AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x6b39,0x1bf));var _0x96b3=function(_0x3c02e0,_0x49fbc5){_0x3c02e0=_0x3c02e0-0x0;var _0x344759=_0x6b39[_0x3c02e0];return _0x344759;};'use strict';var util=require(_0x96b3('0x0'));var path=require(_0x96b3('0x1'));var _=require(_0x96b3('0x2'));var fs=require('fs');var json2xls=require(_0x96b3('0x3'));var BPromise=require(_0x96b3('0x4'));var zipdir=require(_0x96b3('0x5'));var rimraf=require(_0x96b3('0x6'));var db=require(_0x96b3('0x7'))['db'];var dbH=require('../../mysqldb')[_0x96b3('0x8')];var logger=require(_0x96b3('0x9'))(_0x96b3('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x96b3('0xb')][0x2]);var QUERY=process[_0x96b3('0xb')][0x3];var PATH=process[_0x96b3('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4a0499,_0x54cf39){var _0x25ea59={'status':_0x4a0499};var _0x3abc19={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x54cf39){_0x25ea59['savename']=_0x54cf39;}return db[_0x96b3('0xc')][_0x96b3('0xd')](_0x25ea59,_0x3abc19);}function main(){var _0x1c955c=0x1388;var _0x26594b;logger[_0x96b3('0xe')](util[_0x96b3('0xf')](_0x96b3('0x10'),EXTRACTED_REPORT_ID,_0x96b3('0x11')));return db['Setting'][_0x96b3('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x96b3('0x13')]})[_0x96b3('0x14')](function(_0x23a23e){if(_0x23a23e){_0x26594b=_0x23a23e;_0x1c955c=_0x26594b['splitSizeXlsx']||0x1388;}})[_0x96b3('0x14')](function(){return dbH[_0x96b3('0x15')][_0x96b3('0x16')](util['format'](_0x96b3('0x17'),QUERY),{'type':dbH['sequelize'][_0x96b3('0x18')][_0x96b3('0x19')]});})[_0x96b3('0x14')](function(_0xf50792){if(!_0xf50792[0x0][_0x96b3('0x1a')]){return analyticExtractedReport('Empty');}var _0x139137=[];var _0x4ac3a9=0x0;if(_0x26594b[_0x96b3('0x1b')]){if(_0xf50792&&_0xf50792['length']){var _0x163ab4=_['range'](_0xf50792[0x0][_0x96b3('0x1a')]/_0x1c955c);var _0x4f1194=Number[_0x96b3('0x1c')](_0xf50792[0x0][_0x96b3('0x1a')]/_0x1c955c)?_0xf50792[0x0][_0x96b3('0x1a')]%_0x1c955c:0x0;_0x163ab4['forEach'](function(_0xf3d249){if(_0xf3d249>0x0){_0x4ac3a9+=_0x1c955c;}_0x139137['push'](dbH['sequelize'][_0x96b3('0x16')](util[_0x96b3('0xf')](_0x96b3('0x1d'),QUERY,_0x1c955c,_0x4ac3a9),{'type':dbH[_0x96b3('0x15')][_0x96b3('0x18')][_0x96b3('0x19')]}));});if(_0x4f1194>0x0){_0x4ac3a9+=_0x1c955c;_0x139137['push'](dbH[_0x96b3('0x15')][_0x96b3('0x16')](util[_0x96b3('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f1194,_0x4ac3a9),{'type':dbH['sequelize'][_0x96b3('0x18')][_0x96b3('0x19')]}));}}}else{_0x139137['push'](dbH[_0x96b3('0x15')][_0x96b3('0x16')](QUERY,{'type':dbH['sequelize'][_0x96b3('0x18')][_0x96b3('0x19')]}));}var _0x48480f=path[_0x96b3('0x1e')](PATH);var _0x33bf68=path[_0x96b3('0x1f')](PATH,_0x96b3('0x20'));var _0x10b4b0=_0x26594b[_0x96b3('0x1b')]&&_0x139137[_0x96b3('0x21')]>0x1;var _0x18913e=[];if(!fs[_0x96b3('0x22')](path[_0x96b3('0x23')](_0x48480f,_0x33bf68))&&_0x10b4b0){fs[_0x96b3('0x24')](path[_0x96b3('0x23')](_0x48480f,_0x33bf68));}return BPromise[_0x96b3('0x25')](_0x139137,function(_0x337f73){_0x18913e['push'](_0x337f73);})['then'](function(){for(var _0x60296a=0x0;_0x60296a<_0x18913e[_0x96b3('0x21')];_0x60296a+=0x1){var _0x45e717;var _0x57711d=_0x18913e[_0x60296a];if(_0x10b4b0){_0x45e717=path['join'](_0x48480f,_0x33bf68,util[_0x96b3('0xf')](_0x96b3('0x26'),_0x33bf68,_0x60296a,_0x96b3('0x27')));}else{_0x45e717=path[_0x96b3('0x23')](_0x48480f,util[_0x96b3('0xf')]('%s.%s',_0x33bf68,_0x96b3('0x27')));}fs[_0x96b3('0x28')](_0x45e717,json2xls(_0x57711d),_0x96b3('0x29'));}})[_0x96b3('0x14')](function(){if(_0x10b4b0){return new Promise(function(_0x35ff93){zipdir(path[_0x96b3('0x23')](_0x48480f,_0x33bf68),{'saveTo':path[_0x96b3('0x23')](_0x48480f,util[_0x96b3('0xf')]('%s.%s',_0x33bf68,_0x96b3('0x2a')))},function(_0x4377c5,_0x5340b1){rimraf(path['join'](_0x48480f,_0x33bf68),function(){});_0x35ff93(_0x96b3('0x2b'));});});}})[_0x96b3('0x14')](function(){logger['info'](util[_0x96b3('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x96b3('0x11')));return analyticExtractedReport(_0x96b3('0x2c'),_0x10b4b0?util[_0x96b3('0xf')]('%s.%s',_0x33bf68,_0x10b4b0?_0x96b3('0x2a'):_0x96b3('0x27')):null);});})[_0x96b3('0x2d')](function(_0x45276c){logger[_0x96b3('0xe')](util[_0x96b3('0xf')](_0x96b3('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x96b3('0x2f')](_0x45276c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x96b3('0x30'));})[_0x96b3('0x31')](function(){process[_0x96b3('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xfe13=['basename','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname'];(function(_0xb29018,_0x3334ee){var _0x34e818=function(_0x115f81){while(--_0x115f81){_0xb29018['push'](_0xb29018['shift']());}};_0x34e818(++_0x3334ee);}(_0xfe13,0x178));var _0x3fe1=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0xfe13[_0x27ddf5];return _0x26e74a;};'use strict';var util=require(_0x3fe1('0x0'));var path=require('path');var _=require(_0x3fe1('0x1'));var fs=require('fs');var json2xls=require(_0x3fe1('0x2'));var BPromise=require(_0x3fe1('0x3'));var zipdir=require(_0x3fe1('0x4'));var rimraf=require(_0x3fe1('0x5'));var db=require(_0x3fe1('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x3fe1('0x7'))(_0x3fe1('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x3fe1('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x3fe1('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x228b55,_0x1c3fac){var _0x22fe4b={'status':_0x228b55};var _0x216b43={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3fac){_0x22fe4b['savename']=_0x1c3fac;}return db['AnalyticExtractedReport'][_0x3fe1('0xa')](_0x22fe4b,_0x216b43);}function main(){var _0x278655=0x1388;var _0x1513b6;logger[_0x3fe1('0xb')](util[_0x3fe1('0xc')](_0x3fe1('0xd'),EXTRACTED_REPORT_ID,_0x3fe1('0xe')));return db[_0x3fe1('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3fe1('0x10'),_0x3fe1('0x11')]})[_0x3fe1('0x12')](function(_0x23da7f){if(_0x23da7f){_0x1513b6=_0x23da7f;_0x278655=_0x1513b6[_0x3fe1('0x11')]||0x1388;}})[_0x3fe1('0x12')](function(){return dbH[_0x3fe1('0x13')][_0x3fe1('0x14')](util[_0x3fe1('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3fe1('0x13')][_0x3fe1('0x15')][_0x3fe1('0x16')]});})[_0x3fe1('0x12')](function(_0xb4d7e3){if(!_0xb4d7e3[0x0]['num']){return analyticExtractedReport(_0x3fe1('0x17'));}var _0x358209=[];var _0x2a802d=0x0;if(_0x1513b6[_0x3fe1('0x10')]){if(_0xb4d7e3&&_0xb4d7e3[_0x3fe1('0x18')]){var _0xc0aaf0=_[_0x3fe1('0x19')](_0xb4d7e3[0x0][_0x3fe1('0x1a')]/_0x278655);var _0xf28d3c=Number[_0x3fe1('0x1b')](_0xb4d7e3[0x0]['num']/_0x278655)?_0xb4d7e3[0x0]['num']%_0x278655:0x0;_0xc0aaf0[_0x3fe1('0x1c')](function(_0x2462a1){if(_0x2462a1>0x0){_0x2a802d+=_0x278655;}_0x358209[_0x3fe1('0x1d')](dbH[_0x3fe1('0x13')][_0x3fe1('0x14')](util[_0x3fe1('0xc')](_0x3fe1('0x1e'),QUERY,_0x278655,_0x2a802d),{'type':dbH[_0x3fe1('0x13')][_0x3fe1('0x15')][_0x3fe1('0x16')]}));});if(_0xf28d3c>0x0){_0x2a802d+=_0x278655;_0x358209[_0x3fe1('0x1d')](dbH[_0x3fe1('0x13')][_0x3fe1('0x14')](util['format'](_0x3fe1('0x1e'),QUERY,_0xf28d3c,_0x2a802d),{'type':dbH['sequelize']['QueryTypes'][_0x3fe1('0x16')]}));}}}else{_0x358209['push'](dbH[_0x3fe1('0x13')][_0x3fe1('0x14')](QUERY,{'type':dbH[_0x3fe1('0x13')][_0x3fe1('0x15')][_0x3fe1('0x16')]}));}var _0x2d5101=path[_0x3fe1('0x1f')](PATH);var _0x3420cb=path[_0x3fe1('0x20')](PATH,'.xlsx');var _0x154b5d=_0x1513b6['split']&&_0x358209['length']>0x1;var _0x92eff8=[];if(!fs[_0x3fe1('0x21')](path[_0x3fe1('0x22')](_0x2d5101,_0x3420cb))&&_0x154b5d){fs[_0x3fe1('0x23')](path[_0x3fe1('0x22')](_0x2d5101,_0x3420cb));}return BPromise[_0x3fe1('0x24')](_0x358209,function(_0x316456){_0x92eff8[_0x3fe1('0x1d')](_0x316456);})[_0x3fe1('0x12')](function(){for(var _0x27fae1=0x0;_0x27fae1<_0x92eff8['length'];_0x27fae1+=0x1){var _0x2157e1;var _0x198242=_0x92eff8[_0x27fae1];if(_0x154b5d){_0x2157e1=path[_0x3fe1('0x22')](_0x2d5101,_0x3420cb,util[_0x3fe1('0xc')](_0x3fe1('0x25'),_0x3420cb,_0x27fae1,_0x3fe1('0x26')));}else{_0x2157e1=path[_0x3fe1('0x22')](_0x2d5101,util[_0x3fe1('0xc')](_0x3fe1('0x27'),_0x3420cb,_0x3fe1('0x26')));}fs[_0x3fe1('0x28')](_0x2157e1,json2xls(_0x198242),_0x3fe1('0x29'));}})[_0x3fe1('0x12')](function(){if(_0x154b5d){return new Promise(function(_0x1bdbcf){zipdir(path[_0x3fe1('0x22')](_0x2d5101,_0x3420cb),{'saveTo':path['join'](_0x2d5101,util[_0x3fe1('0xc')](_0x3fe1('0x27'),_0x3420cb,_0x3fe1('0x2a')))},function(_0x18f731,_0x33ecd8){rimraf(path[_0x3fe1('0x22')](_0x2d5101,_0x3420cb),function(){});_0x1bdbcf('zip\x20finished');});});}})[_0x3fe1('0x12')](function(){logger[_0x3fe1('0xb')](util[_0x3fe1('0xc')](_0x3fe1('0x2b'),EXTRACTED_REPORT_ID,_0x3fe1('0xe')));return analyticExtractedReport(_0x3fe1('0x2c'),_0x154b5d?util[_0x3fe1('0xc')]('%s.%s',_0x3420cb,_0x154b5d?_0x3fe1('0x2a'):_0x3fe1('0x26')):null);});})[_0x3fe1('0x2d')](function(_0xb3a6da){logger['info'](util['format'](_0x3fe1('0x2e'),EXTRACTED_REPORT_ID,_0x3fe1('0xe')),util[_0x3fe1('0x2f')](_0xb3a6da,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3fe1('0x30'));})[_0x3fe1('0x31')](function(){process[_0x3fe1('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 331df5d..d2728b2 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 _0xd063=[',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','catch','error','rewrite','lodash','util','Interval','findAll','models','VoiceExtension','then','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','VoiceExtensionId','inbound','Set','context','CDR(destination)=','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','cutdigits','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','intervals','IntervalId','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime'];(function(_0x21ebba,_0x36fafb){var _0xfabede=function(_0x70a662){while(--_0x70a662){_0x21ebba['push'](_0x21ebba['shift']());}};_0xfabede(++_0x36fafb);}(_0xd063,0x1c5));var _0x3d06=function(_0x497182,_0x40b150){_0x497182=_0x497182-0x0;var _0x33fcfc=_0xd063[_0x497182];return _0x33fcfc;};'use strict';var _=require(_0x3d06('0x0'));var util=require(_0x3d06('0x1'));function rewrite(_0x2d4692,_0x5f2028){var _0x579f8c=this;return _0x2d4692['models'][_0x3d06('0x2')][_0x3d06('0x3')]({'raw':!![]})['then'](function(_0xd4bf99){_0x579f8c['intervals']=_0xd4bf99;return _0x2d4692[_0x3d06('0x4')][_0x3d06('0x5')][_0x3d06('0x3')]({'where':{'IntervalId':_0x5f2028['IntervalId']},'raw':!![]});})[_0x3d06('0x6')](function(_0x5e3ff7){return _0x2d4692[_0x3d06('0x4')]['VoiceExtension'][_0x3d06('0x3')]({'where':{'exten':{'$in':_[_0x3d06('0x7')](_[_0x3d06('0x8')](_0x5e3ff7,'exten'))}},'order':[{'raw':_0x3d06('0x9')}],'raw':!![]});})['then'](function(_0x56eb75){var _0x3ce6da=_[_0x3d06('0xa')](_0x56eb75,{'priority':'1'});var _0x2687cf=_[_0x3d06('0xa')](_0x56eb75,{'isApp':0x1});var _0x4f12fa=_[_0x3d06('0xb')](_0x2687cf,_0x3d06('0xc'));var _0x526037=[_0x3d06('0xd'),_0x3d06('0xe')];var _0x293e27=[];var _0x3dccf7=[];for(var _0x231c40 in _0x4f12fa){if(_0x4f12fa[_0x3d06('0xf')](_0x231c40)){_0x579f8c[_0x3d06('0x10')]=0x2;_0x579f8c[_0x3d06('0x11')]=[];_0x579f8c[_0x3d06('0x12')]=_[_0x3d06('0x13')](_0x3ce6da,{'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')]});_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':'Set','appdata':util[_0x3d06('0x16')](_0x3d06('0x17'),_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')]),'context':_0x4f12fa[_0x231c40][0x0]['context'],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});if(_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')]===_0x3d06('0x19')){_0x579f8c['extensions'][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':_0x3d06('0x1a'),'appdata':'CDR(routeid)='+_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')],'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x579f8c['priority']++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});}else if(_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')]==='outbound'){if(_0x579f8c['extension']){_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0]['type'],'app':'Set','appdata':_0x3d06('0x1c')+(_0x579f8c[_0x3d06('0x12')]['cutdigits']?_0x3d06('0x1d')+_0x579f8c['extension']['cutdigits']+'}':_0x3d06('0x1e')),'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});}_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':_0x3d06('0x1a'),'appdata':_0x3d06('0x1f')+_0x4f12fa[_0x231c40][0x0]['VoiceExtensionId'],'context':_0x4f12fa[_0x231c40][0x0]['context'],'exten':_0x4f12fa[_0x231c40][0x0]['exten'],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});var _0x363f75=_0x579f8c['priority']++;_0x579f8c[_0x3d06('0x11')]['push']({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':_0x3d06('0x20'),'appdata':_0x3d06('0x21')+(_0x363f75+0x2)+_0x3d06('0x22')+(_0x363f75+0x1)+')','context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x363f75,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});if(_0x579f8c[_0x3d06('0x12')]){_0x579f8c[_0x3d06('0x11')]['push']({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':_0x3d06('0x1a'),'appdata':_0x579f8c[_0x3d06('0x12')]['cutdigits']?_0x3d06('0x23')+_0x579f8c['extension'][_0x3d06('0x24')]+'}':_0x3d06('0x25'),'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0]['exten'],'priority':_0x579f8c['priority']++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});}_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0]['type'],'app':_0x3d06('0x1a'),'appdata':_0x3d06('0x26')+_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')],'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0]['exten'],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});if(_0x579f8c['extension']&&_0x579f8c['extension'][_0x3d06('0xf')](_0x3d06('0x27'))&&_0x579f8c[_0x3d06('0x12')]['recordingFormat']!==_0x3d06('0x28')){_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':_0x3d06('0x1a'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4f12fa[_0x231c40][0x0]['context'],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x579f8c['priority']++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});_0x579f8c['extensions'][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0]['type'],'app':_0x3d06('0x1a'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x579f8c[_0x3d06('0x12')][_0x3d06('0x27')]||_0x3d06('0x29'),'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0]['exten'],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0]['VoiceExtensionId']});}}_0x579f8c[_0x3d06('0x11')]['push']({'type':_0x4f12fa[_0x231c40][0x0]['type'],'app':_0x3d06('0x1a'),'appdata':_0x3d06('0x2a'),'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':'Set','appdata':_0x3d06('0x2b'),'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0]['VoiceExtensionId']});_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':'Set','appdata':_0x3d06('0x2c'),'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0]['exten'],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0]['VoiceExtensionId']});for(var _0x32cefb=0x0,_0xf06915=0x0;_0x32cefb<_0x4f12fa[_0x231c40][_0x3d06('0x2d')];_0x32cefb+=0x1,_0xf06915=0x0){var _0x28ebf4=_0x4f12fa[_0x231c40][_0x32cefb];if(_0x28ebf4[_0x3d06('0x15')]){_0x28ebf4['type']=_0x28ebf4[_0x3d06('0x15')][_0x3d06('0x2e')]();}var _0x328e2d=[];var _0x134a4d=[];delete _0x28ebf4['id'];delete _0x28ebf4[_0x3d06('0x2f')];delete _0x28ebf4['updatedAt'];var _0x1cbef4=_0x28ebf4[_0x3d06('0x30')]!==_0x3d06('0x31')?[_0x28ebf4[_0x3d06('0x30')]]:_0x28ebf4['IntervalId']?_[_0x3d06('0x8')](_[_0x3d06('0xa')](_0x579f8c[_0x3d06('0x32')],{'IntervalId':_0x28ebf4[_0x3d06('0x33')]}),'interval'):[];if(_0x28ebf4[_0x3d06('0xf')](_0x3d06('0x34'))){if(_0x28ebf4['tag']&&_0x28ebf4[_0x3d06('0x34')]!=='--'){_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4[_0x3d06('0x15')],'app':_0x3d06('0x1a'),'appdata':_0x3d06('0x35')+_0x28ebf4['tag'],'context':_0x28ebf4['context'],'exten':_0x28ebf4[_0x3d06('0xc')],'priority':_0x1cbef4['length']+_0x579f8c[_0x3d06('0x10')]+_0xf06915++,'VoiceExtensionId':_0x28ebf4[_0x3d06('0x18')]});}}if(_0x28ebf4[_0x3d06('0x15')]===_0x3d06('0x36')&&_0x28ebf4[_0x3d06('0xf')](_0x3d06('0x37'))){if(_0x28ebf4['callerID']){_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4[_0x3d06('0x15')],'app':_0x3d06('0x20'),'appdata':_0x3d06('0x38')+_0x28ebf4[_0x3d06('0x37')]+')','context':_0x28ebf4['context'],'exten':_0x28ebf4[_0x3d06('0xc')],'priority':_0x1cbef4[_0x3d06('0x2d')]+_0x579f8c[_0x3d06('0x10')]+_0xf06915++,'VoiceExtensionId':_0x28ebf4['VoiceExtensionId']});}else{_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4[_0x3d06('0x15')],'app':'ExecIf','appdata':_0x3d06('0x39'),'context':_0x28ebf4['context'],'exten':_0x28ebf4['exten'],'priority':_0x1cbef4[_0x3d06('0x2d')]+_0x579f8c[_0x3d06('0x10')]+_0xf06915++,'VoiceExtensionId':_0x28ebf4['VoiceExtensionId']});}}if(_0x28ebf4['hasOwnProperty']('answer')){if(_0x526037[_0x3d06('0x3a')](_0x28ebf4[_0x3d06('0x3b')][_0x3d06('0x2e')]())>=0x0&&_0x28ebf4[_0x3d06('0x3c')]!==_0x3d06('0x3d')){if(_0x28ebf4['answer']){_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4[_0x3d06('0x15')],'app':_0x3d06('0x20'),'appdata':_0x3d06('0x3e'),'context':_0x28ebf4['context'],'exten':_0x28ebf4[_0x3d06('0xc')],'priority':_0x1cbef4[_0x3d06('0x2d')]+_0x579f8c['priority']+_0xf06915++,'VoiceExtensionId':_0x28ebf4['VoiceExtensionId']});_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4[_0x3d06('0x15')],'app':_0x3d06('0x1a'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x28ebf4['context'],'exten':_0x28ebf4[_0x3d06('0xc')],'priority':_0x1cbef4[_0x3d06('0x2d')]+_0x579f8c['priority']+_0xf06915++,'VoiceExtensionId':_0x28ebf4[_0x3d06('0x18')]});}else{_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4['type'],'app':'ExecIf','appdata':_0x3d06('0x3f'),'context':_0x28ebf4[_0x3d06('0x1b')],'exten':_0x28ebf4['exten'],'priority':_0x1cbef4['length']+_0x579f8c[_0x3d06('0x10')]+_0xf06915++,'VoiceExtensionId':_0x28ebf4['VoiceExtensionId']});_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4[_0x3d06('0x15')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x28ebf4[_0x3d06('0x1b')],'exten':_0x28ebf4[_0x3d06('0xc')],'priority':_0x1cbef4[_0x3d06('0x2d')]+_0x579f8c[_0x3d06('0x10')]+_0xf06915++,'VoiceExtensionId':_0x28ebf4[_0x3d06('0x18')]});}}}for(var _0x311f45=0x0;_0x311f45<_0x1cbef4[_0x3d06('0x2d')];_0x311f45+=0x1){var _0x4b01f6=_0x579f8c['priority']+_0x1cbef4[_0x3d06('0x2d')];var _0x3f2855=_0x311f45===_0x1cbef4[_0x3d06('0x2d')]-0x1?_0x579f8c[_0x3d06('0x10')]+_0x328e2d[_0x3d06('0x2d')]+_0x134a4d[_0x3d06('0x2d')]+0x2:_0x579f8c['priority']+_0x311f45+0x1;_0x328e2d['splice'](_0x311f45,0x0,{'type':_0x28ebf4[_0x3d06('0x15')],'app':_0x3d06('0x40'),'appdata':_0x1cbef4[_0x311f45]+'?'+_0x28ebf4[_0x3d06('0x1b')]+_0x3d06('0x41')+_0x4b01f6+':'+_0x28ebf4[_0x3d06('0x1b')]+_0x3d06('0x41')+_0x3f2855,'exten':_0x28ebf4[_0x3d06('0xc')],'context':_0x28ebf4[_0x3d06('0x1b')],'priority':_0x579f8c[_0x3d06('0x10')]+_0x311f45,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});}_0x28ebf4[_0x3d06('0x10')]=_0x328e2d[_0x3d06('0x2d')]?_[_0x3d06('0x42')](_0x328e2d)[_0x3d06('0x10')]+0x1:_0x579f8c[_0x3d06('0x10')];_0x579f8c['priority']=(_0x134a4d[_0x3d06('0x2d')]?_['last'](_0x134a4d)[_0x3d06('0x10')]:_0x28ebf4[_0x3d06('0x10')])+0x1;_0x579f8c['extensions']=_[_0x3d06('0x43')](_0x579f8c['extensions'],_0x328e2d,[_0x28ebf4],_0x134a4d);}_0x579f8c[_0x3d06('0x11')]['push']({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':_0x3d06('0x44'),'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'priority':_0x579f8c[_0x3d06('0x10')],'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});_0x293e27[_0x3d06('0x14')](_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]);_0x3dccf7=_[_0x3d06('0x43')](_0x3dccf7,_0x579f8c[_0x3d06('0x11')]);}}return _0x2d4692[_0x3d06('0x45')](function(_0x22dac9){return _0x2d4692['models'][_0x3d06('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x293e27}},'transaction':_0x22dac9})['then'](function(_0x4961c9){return _0x2d4692[_0x3d06('0x4')]['VoiceExtension'][_0x3d06('0x46')](_['sortBy'](_0x3dccf7,_0x3d06('0x10')),{'transaction':_0x22dac9});});});})[_0x3d06('0x47')](function(_0x7b20cd){console[_0x3d06('0x48')](_0x7b20cd);});}exports[_0x3d06('0x49')]=rewrite; \ No newline at end of file +var _0x7387=['${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','hasOwnProperty','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)','indexOf','app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','map','exten','filter','groupBy','queue','playback','priority','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','extensions','CDR(destination)=','extension','cutdigits','${EXTEN:'];(function(_0x3f1e31,_0x5f26bd){var _0x5174d2=function(_0x82a48d){while(--_0x82a48d){_0x3f1e31['push'](_0x3f1e31['shift']());}};_0x5174d2(++_0x5f26bd);}(_0x7387,0x149));var _0x7738=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7387[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7738('0x0'));var util=require(_0x7738('0x1'));function rewrite(_0x185d80,_0x5bd8b3){var _0x52a861=this;return _0x185d80[_0x7738('0x2')][_0x7738('0x3')][_0x7738('0x4')]({'raw':!![]})[_0x7738('0x5')](function(_0xa0fe41){_0x52a861[_0x7738('0x6')]=_0xa0fe41;return _0x185d80[_0x7738('0x2')]['VoiceExtension'][_0x7738('0x4')]({'where':{'IntervalId':_0x5bd8b3[_0x7738('0x7')]},'raw':!![]});})[_0x7738('0x5')](function(_0x4be98c){return _0x185d80[_0x7738('0x2')][_0x7738('0x8')][_0x7738('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0x7738('0x9')](_0x4be98c,_0x7738('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x7738('0x5')](function(_0x1caf90){var _0x3719fe=_[_0x7738('0xb')](_0x1caf90,{'priority':'1'});var _0xaa8ab3=_[_0x7738('0xb')](_0x1caf90,{'isApp':0x1});var _0x206e1d=_[_0x7738('0xc')](_0xaa8ab3,_0x7738('0xa'));var _0x1be52e=[_0x7738('0xd'),_0x7738('0xe')];var _0x22dbf1=[];var _0x4776a1=[];for(var _0x2b5f26 in _0x206e1d){if(_0x206e1d['hasOwnProperty'](_0x2b5f26)){_0x52a861[_0x7738('0xf')]=0x2;_0x52a861['extensions']=[];_0x52a861['extension']=_[_0x7738('0x10')](_0x3719fe,{'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')]});_0x52a861['extensions'][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':util['format'](_0x7738('0x14'),_0x206e1d[_0x2b5f26][0x0]['type']),'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});if(_0x206e1d[_0x2b5f26][0x0]['type']===_0x7738('0x17')){_0x52a861['extensions'][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x18')+_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')],'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});}else if(_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')]===_0x7738('0x19')){if(_0x52a861['extension']){_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x1b')+(_0x52a861[_0x7738('0x1c')][_0x7738('0x1d')]?_0x7738('0x1e')+_0x52a861[_0x7738('0x1c')][_0x7738('0x1d')]+'}':_0x7738('0x1f')),'context':_0x206e1d[_0x2b5f26][0x0]['context'],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861['priority']++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});}_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':'Set','appdata':_0x7738('0x18')+_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')],'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});var _0x4dc739=_0x52a861[_0x7738('0xf')]++;_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x20'),'appdata':_0x7738('0x21')+(_0x4dc739+0x2)+_0x7738('0x22')+(_0x4dc739+0x1)+')','context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x4dc739,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});if(_0x52a861[_0x7738('0x1c')]){_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':'Set','appdata':_0x52a861[_0x7738('0x1c')][_0x7738('0x1d')]?_0x7738('0x23')+_0x52a861[_0x7738('0x1c')][_0x7738('0x1d')]+'}':_0x7738('0x24'),'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861['priority']++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0]['VoiceExtensionId']});}_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0]['type'],'app':_0x7738('0x13'),'appdata':_0x7738('0x25')+_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')],'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});if(_0x52a861[_0x7738('0x1c')]&&_0x52a861[_0x7738('0x1c')]['hasOwnProperty'](_0x7738('0x26'))&&_0x52a861[_0x7738('0x1c')][_0x7738('0x26')]!==_0x7738('0x27')){_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x28'),'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861['priority']++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0]['VoiceExtensionId']});_0x52a861[_0x7738('0x1a')]['push']({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x52a861[_0x7738('0x1c')]['recordingFormat']||'wav','context':_0x206e1d[_0x2b5f26][0x0]['context'],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});}}_0x52a861['extensions'][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x29'),'context':_0x206e1d[_0x2b5f26][0x0]['context'],'exten':_0x206e1d[_0x2b5f26][0x0]['exten'],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0]['VoiceExtensionId']});_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x2a'),'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0]['VoiceExtensionId']});for(var _0x5a7588=0x0,_0x5c8292=0x0;_0x5a7588<_0x206e1d[_0x2b5f26][_0x7738('0x2b')];_0x5a7588+=0x1,_0x5c8292=0x0){var _0x3759ea=_0x206e1d[_0x2b5f26][_0x5a7588];if(_0x3759ea[_0x7738('0x12')]){_0x3759ea[_0x7738('0x12')]=_0x3759ea[_0x7738('0x12')][_0x7738('0x2c')]();}var _0x44e1ab=[];var _0x559fc6=[];delete _0x3759ea['id'];delete _0x3759ea[_0x7738('0x2d')];delete _0x3759ea[_0x7738('0x2e')];var _0x3674a8=_0x3759ea[_0x7738('0x2f')]!==_0x7738('0x30')?[_0x3759ea[_0x7738('0x2f')]]:_0x3759ea[_0x7738('0x7')]?_[_0x7738('0x9')](_[_0x7738('0xb')](_0x52a861[_0x7738('0x6')],{'IntervalId':_0x3759ea[_0x7738('0x7')]}),'interval'):[];if(_0x3759ea[_0x7738('0x31')]('tag')){if(_0x3759ea[_0x7738('0x32')]&&_0x3759ea[_0x7738('0x32')]!=='--'){_0x44e1ab[_0x7738('0x11')]({'type':_0x3759ea[_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x33')+_0x3759ea[_0x7738('0x32')],'context':_0x3759ea[_0x7738('0x15')],'exten':_0x3759ea[_0x7738('0xa')],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861['priority']+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});}}if(_0x3759ea[_0x7738('0x12')]===_0x7738('0x19')&&_0x3759ea['hasOwnProperty'](_0x7738('0x34'))){if(_0x3759ea[_0x7738('0x34')]){_0x44e1ab[_0x7738('0x11')]({'type':_0x3759ea[_0x7738('0x12')],'app':_0x7738('0x20'),'appdata':_0x7738('0x35')+_0x3759ea['callerID']+')','context':_0x3759ea[_0x7738('0x15')],'exten':_0x3759ea['exten'],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861[_0x7738('0xf')]+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});}else{_0x44e1ab[_0x7738('0x11')]({'type':_0x3759ea[_0x7738('0x12')],'app':_0x7738('0x20'),'appdata':_0x7738('0x36'),'context':_0x3759ea[_0x7738('0x15')],'exten':_0x3759ea[_0x7738('0xa')],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861[_0x7738('0xf')]+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});}}if(_0x3759ea[_0x7738('0x31')]('answer')){if(_0x1be52e[_0x7738('0x37')](_0x3759ea[_0x7738('0x38')]['toLowerCase']())>=0x0&&_0x3759ea[_0x7738('0x39')]!=='custom'){if(_0x3759ea[_0x7738('0x3a')]){_0x44e1ab[_0x7738('0x11')]({'type':_0x3759ea['type'],'app':'ExecIf','appdata':_0x7738('0x3b'),'context':_0x3759ea[_0x7738('0x15')],'exten':_0x3759ea[_0x7738('0xa')],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861['priority']+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});_0x44e1ab['push']({'type':_0x3759ea[_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x3c'),'context':_0x3759ea[_0x7738('0x15')],'exten':_0x3759ea['exten'],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861['priority']+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});}else{_0x44e1ab[_0x7738('0x11')]({'type':_0x3759ea[_0x7738('0x12')],'app':_0x7738('0x20'),'appdata':_0x7738('0x3d'),'context':_0x3759ea[_0x7738('0x15')],'exten':_0x3759ea[_0x7738('0xa')],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861[_0x7738('0xf')]+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});_0x44e1ab[_0x7738('0x11')]({'type':_0x3759ea[_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x3e'),'context':_0x3759ea['context'],'exten':_0x3759ea[_0x7738('0xa')],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861[_0x7738('0xf')]+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});}}}for(var _0x155bc2=0x0;_0x155bc2<_0x3674a8[_0x7738('0x2b')];_0x155bc2+=0x1){var _0x386b3e=_0x52a861['priority']+_0x3674a8[_0x7738('0x2b')];var _0x5a58ba=_0x155bc2===_0x3674a8['length']-0x1?_0x52a861['priority']+_0x44e1ab[_0x7738('0x2b')]+_0x559fc6[_0x7738('0x2b')]+0x2:_0x52a861[_0x7738('0xf')]+_0x155bc2+0x1;_0x44e1ab[_0x7738('0x3f')](_0x155bc2,0x0,{'type':_0x3759ea[_0x7738('0x12')],'app':'GotoIfTime','appdata':_0x3674a8[_0x155bc2]+'?'+_0x3759ea[_0x7738('0x15')]+_0x7738('0x40')+_0x386b3e+':'+_0x3759ea['context']+_0x7738('0x40')+_0x5a58ba,'exten':_0x3759ea['exten'],'context':_0x3759ea[_0x7738('0x15')],'priority':_0x52a861[_0x7738('0xf')]+_0x155bc2,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0]['VoiceExtensionId']});}_0x3759ea['priority']=_0x44e1ab['length']?_[_0x7738('0x41')](_0x44e1ab)[_0x7738('0xf')]+0x1:_0x52a861[_0x7738('0xf')];_0x52a861['priority']=(_0x559fc6[_0x7738('0x2b')]?_['last'](_0x559fc6)[_0x7738('0xf')]:_0x3759ea[_0x7738('0xf')])+0x1;_0x52a861[_0x7738('0x1a')]=_[_0x7738('0x42')](_0x52a861[_0x7738('0x1a')],_0x44e1ab,[_0x3759ea],_0x559fc6);}_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':'Hangup','exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'priority':_0x52a861[_0x7738('0xf')],'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});_0x22dbf1[_0x7738('0x11')](_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]);_0x4776a1=_[_0x7738('0x42')](_0x4776a1,_0x52a861[_0x7738('0x1a')]);}}return _0x185d80[_0x7738('0x43')](function(_0x46cca9){return _0x185d80['models'][_0x7738('0x8')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x22dbf1}},'transaction':_0x46cca9})[_0x7738('0x5')](function(_0x595753){return _0x185d80[_0x7738('0x2')][_0x7738('0x8')][_0x7738('0x44')](_[_0x7738('0x45')](_0x4776a1,_0x7738('0xf')),{'transaction':_0x46cca9});});});})[_0x7738('0x46')](function(_0x5958f){console['error'](_0x5958f);});}exports[_0x7738('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 8d60871..938e44b 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 _0x16a7=['ListId','CompanyId','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','id\x20IN\x20?','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','get','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CmContact','createReadStream','parse','info','CSV\x20parsed\x20correctly!','stringify','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','../../../config/logger','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x16a7,0x1e1));var _0x716a=function(_0x37406a,_0x5bdd74){_0x37406a=_0x37406a-0x0;var _0x2b3e03=_0x16a7[_0x37406a];return _0x2b3e03;};'use strict';var BPromise=require(_0x716a('0x0'));var util=require('util');var _=require(_0x716a('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x716a('0x2'))('api');config[_0x716a('0x3')]=_[_0x716a('0x4')](config[_0x716a('0x3')],{'host':_0x716a('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x716a('0x3')]));require(_0x716a('0x6'))[_0x716a('0x7')](socket);try{if(!process['argv'][0x2]||process[_0x716a('0x8')][0x2]===_0x716a('0x9')||process['argv'][0x2]===_0x716a('0xa')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0x716a('0x8')][0x3]===_0x716a('0x9')||process['argv'][0x3]===_0x716a('0xa')||!process[_0x716a('0x8')][0x4]||process[_0x716a('0x8')][0x4]===_0x716a('0x9')||process[_0x716a('0x8')][0x4]===_0x716a('0xa')){throw new Error(_0x716a('0xb'));}var FIELDS=_['zipObject'](process[_0x716a('0x8')][0x3][_0x716a('0xc')](','),process[_0x716a('0x8')][0x4][_0x716a('0xc')](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x716a('0x9')||process[_0x716a('0x8')][0x5]===_0x716a('0xa')){throw new Error(_0x716a('0xd'));}var LISTID=process[_0x716a('0x8')][0x5];var COMPANYID=process[_0x716a('0x8')][0x6]&&process['argv'][0x6]!==_0x716a('0x9')&&process[_0x716a('0x8')][0x6]!==_0x716a('0xa')?process[_0x716a('0x8')][0x6]:null;var DUPLICATES=process[_0x716a('0x8')][0x7]&&process[_0x716a('0x8')][0x7]!==_0x716a('0x9')&&process[_0x716a('0x8')][0x7]!=='null'?process[_0x716a('0x8')][0x7]:null;if(!process[_0x716a('0x8')][0x8]||process[_0x716a('0x8')][0x8]===_0x716a('0x9')||process[_0x716a('0x8')][0x8]==='null'){throw new Error(_0x716a('0xe'));}var SOCKET_TIMESTAMP=process[_0x716a('0x8')][0x8];}catch(_0x233de6){logger[_0x716a('0xf')](_0x233de6);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(_0x2b32b4,_0x567311,_0x4e1028,_0x4137cb){var _0x295d15={'message':_0x567311};_0x295d15[_0x2b32b4]=!![];if(_0x4e1028){_0x295d15[_0x716a('0x10')]=_0x4e1028;}if(_0x4137cb){_0x295d15[_0x716a('0x11')]=_0x4137cb;}return _0x295d15;}function isEmail(_0xf94f4d){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))*$/[_0x716a('0x12')](_0xf94f4d);}function checkRow(_0x2fdbc9,_0x2e2941,_0x1d77fe){return new BPromise(function(_0x14ddc0,_0x3acd28){if(_[_0x716a('0x13')](_0x2fdbc9)){return _0x3acd28(handleCheckRowError(_0x716a('0xf'),_0x716a('0x14'),null,_0x1d77fe));}if(_0x2fdbc9[_0x716a('0x15')]&&_0x2fdbc9['errors'][_0x716a('0x16')]){var _0x473647=_[_0x716a('0x17')](_0x2fdbc9['errors'],'message')['join'](';');return _0x3acd28(handleCheckRowError(_0x716a('0xf'),_0x473647,null,_0x1d77fe));}var _0x33f66b={};for(var _0x8a3eb9 in FIELDS){if(FIELDS[_0x716a('0x18')](_0x8a3eb9)&&FIELDS[_0x8a3eb9]){_0x33f66b[_0x8a3eb9]=_0x2fdbc9[_0x716a('0x19')][0x0][FIELDS[_0x8a3eb9]]||_0x2fdbc9[_0x716a('0x19')][0x0]['\ufeff'+FIELDS[_0x8a3eb9]];}}if(!_0x33f66b[_0x716a('0x1a')]){return _0x3acd28(handleCheckRowError('error',_0x716a('0x1b'),null,_0x1d77fe));}if(!_0x33f66b[_0x716a('0x1c')]){return _0x3acd28(handleCheckRowError('error',_0x716a('0x1d'),null,_0x1d77fe));}if(_0x33f66b[_0x716a('0x1e')]){var _0x1fc930=moment(_0x33f66b['birthDate'],_0x716a('0x1f'));if(!_0x1fc930[_0x716a('0x20')]()){return _0x3acd28(handleCheckRowError(_0x716a('0xf'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x1d77fe));}}if(_0x33f66b['email']){if(!isEmail(_0x33f66b[_0x716a('0x21')])){return _0x3acd28(handleCheckRowError(_0x716a('0xf'),'email\x20format\x20is\x20not\x20valid!',null,_0x1d77fe));}}_0x33f66b[_0x716a('0x22')]=LISTID;_0x33f66b[_0x716a('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x716a('0x16')]&&_0x2e2941){var _0x513609={};for(var _0x33145b=0x0,_0x21ca7a=DUPLICATES[_0x716a('0x16')];_0x33145b<_0x21ca7a;_0x33145b+=0x1){_0x513609[DUPLICATES[_0x33145b]]=_0x33f66b[DUPLICATES[_0x33145b]];}var _0x79c152=_['find'](_0x2e2941,_0x513609);if(_0x79c152){return _0x3acd28(handleCheckRowError(_0x716a('0x24'),_0x716a('0x25'),_0x79c152,_0x1d77fe));}}return db['CmContact'][_0x716a('0x26')](_0x33f66b,{'raw':!![],'hooks':![],'fields':_[_0x716a('0x27')](_0x33f66b)})[_0x716a('0x28')](function(_0x44096a){if(DUPLICATES&&DUPLICATES[_0x716a('0x16')]&&_0x2e2941){_0x2e2941[_0x716a('0x29')](_[_0x716a('0x2a')](_0x33f66b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x44096a['id'];return _0x14ddc0();})[_0x716a('0x2b')](function(_0xb11c5e){return _0x3acd28(handleCheckRowError('error',_0x716a('0x2c')+(_0xb11c5e['message']||JSON['stringify'](_0xb11c5e)),null,_0x1d77fe));});});}function checkHopper(){function _0x2abeb0(){return function(_0x5cd6e4){logger['error'](_0x716a('0x2d'),_0x716a('0x2e'),util[_0x716a('0x2f')](_0x5cd6e4,{'showHidden':![],'depth':null}));};}var _0x4743b8=function(_0x1e949a,_0x35024e){var _0x5e62d3=squel[_0x716a('0x30')]()[_0x716a('0x31')](_0x716a('0x32'))[_0x716a('0x33')]([_0x716a('0x1c'),_0x716a('0x34'),_0x716a('0x35'),'ListId',_0x35024e,'createdAt',_0x716a('0x36')],squel[_0x716a('0x37')]()[_0x716a('0x38')](_0x716a('0x1c'),_0x716a('0x1c'))['field'](_0x716a('0x39'),_0x716a('0x34'))[_0x716a('0x38')]('id',_0x716a('0x35'))[_0x716a('0x38')](LISTID[_0x716a('0x3a')](),_0x716a('0x22'))[_0x716a('0x38')](_0x1e949a['id'][_0x716a('0x3a')](),_0x35024e)[_0x716a('0x38')](_0x716a('0x39'),_0x716a('0x3b'))[_0x716a('0x38')]('NOW()',_0x716a('0x36'))[_0x716a('0x3c')](_0x716a('0x3d'))[_0x716a('0x3e')](_0x716a('0x3f'))['where'](_0x716a('0x40'),LISTID[_0x716a('0x3a')]())[_0x716a('0x3e')](_0x716a('0x41'))['where'](_0x716a('0x42'),squel[_0x716a('0x37')]()['field'](_0x716a('0x1c'))[_0x716a('0x3c')](_0x716a('0x32'))[_0x716a('0x3e')](_0x35024e+_0x716a('0x43'),_0x1e949a['id'][_0x716a('0x3a')]())))[_0x716a('0x3a')]();return _0x5e62d3;};var _0x5858bc=function(_0x291042,_0x3c0832){var _0x3e19d6=squel[_0x716a('0x30')]()[_0x716a('0x31')](_0x716a('0x32'))[_0x716a('0x33')]([_0x716a('0x1c'),'scheduledAt',_0x716a('0x35'),_0x716a('0x22'),_0x3c0832,'createdAt','updatedAt'],squel['select']()['field'](_0x716a('0x1c'),'phone')['field'](_0x716a('0x39'),_0x716a('0x34'))['field']('id',_0x716a('0x35'))[_0x716a('0x38')](LISTID[_0x716a('0x3a')](),_0x716a('0x22'))[_0x716a('0x38')](_0x291042['id'][_0x716a('0x3a')](),_0x3c0832)[_0x716a('0x38')](_0x716a('0x39'),_0x716a('0x3b'))[_0x716a('0x38')]('NOW()','updatedAt')[_0x716a('0x3c')](_0x716a('0x3d'))[_0x716a('0x3e')](_0x716a('0x3f'))[_0x716a('0x3e')](_0x716a('0x40'),LISTID[_0x716a('0x3a')]())[_0x716a('0x3e')]('id\x20IN\x20?',squel[_0x716a('0x44')](hopperContacts))[_0x716a('0x3e')](_0x716a('0x41'))['where'](_0x716a('0x42'),squel[_0x716a('0x37')]()[_0x716a('0x38')]('calleridnum')[_0x716a('0x3c')]('cm_hopper_final')['where'](_0x3c0832+_0x716a('0x43'),_0x291042['id']['toString']()))[_0x716a('0x3e')](_0x716a('0x42'),squel['select']()[_0x716a('0x38')]('phone')['from'](_0x716a('0x32'))['where'](_0x3c0832+_0x716a('0x43'),_0x291042['id'][_0x716a('0x3a')]())))[_0x716a('0x3a')]();return _0x3e19d6;};function _0x3ae2ba(_0x5e52f8,_0x19da6a){var _0x1ca6dc=squel[_0x716a('0x30')]()[_0x716a('0x31')](_0x716a('0x32'))[_0x716a('0x33')]([_0x716a('0x1c'),_0x716a('0x34'),_0x716a('0x35'),_0x716a('0x22'),_0x19da6a,_0x716a('0x3b'),_0x716a('0x36')],squel[_0x716a('0x37')]()[_0x716a('0x38')](_0x716a('0x1c'),_0x716a('0x1c'))[_0x716a('0x38')](_0x716a('0x39'),'scheduledAt')[_0x716a('0x38')]('id',_0x716a('0x35'))[_0x716a('0x38')](LISTID[_0x716a('0x3a')](),_0x716a('0x22'))[_0x716a('0x38')](_0x5e52f8['id'][_0x716a('0x3a')](),_0x19da6a)[_0x716a('0x38')]('NOW()','createdAt')[_0x716a('0x38')](_0x716a('0x39'),'updatedAt')['from']('cm_contacts')['where'](_0x716a('0x3f'))[_0x716a('0x3e')](_0x716a('0x40'),LISTID[_0x716a('0x3a')]())[_0x716a('0x3e')](_0x716a('0x45'),squel[_0x716a('0x44')](hopperContacts))[_0x716a('0x3e')](_0x716a('0x41')))['toString']();return _0x1ca6dc;}function _0x24644f(_0x174140,_0x5c686f){var _0x5d3aad=squel[_0x716a('0x30')]()[_0x716a('0x31')](_0x716a('0x46'))['fromQuery']([_0x716a('0x1c'),'ContactId',_0x716a('0x22'),_0x5c686f,'createdAt',_0x716a('0x36')],squel['select']()[_0x716a('0x38')](_0x716a('0x1c'),_0x716a('0x1c'))[_0x716a('0x38')]('id',_0x716a('0x35'))[_0x716a('0x38')](LISTID[_0x716a('0x3a')](),_0x716a('0x22'))[_0x716a('0x38')](_0x174140['id']['toString'](),_0x5c686f)[_0x716a('0x38')](_0x716a('0x39'),_0x716a('0x3b'))[_0x716a('0x38')](_0x716a('0x39'),_0x716a('0x36'))[_0x716a('0x3c')](_0x716a('0x3d'))[_0x716a('0x3e')](_0x716a('0x3f'))[_0x716a('0x3e')](_0x716a('0x40'),LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x716a('0x44')](hopperContacts))['where'](_0x716a('0x41')))[_0x716a('0x3a')]();return _0x5d3aad;}return db['VoiceQueue'][_0x716a('0x47')]({'where':{'type':_0x716a('0x48')},'attributes':['id',_0x716a('0x49')],'include':[{'model':db[_0x716a('0x4a')],'as':_0x716a('0x4b'),'where':{'id':LISTID}}]})[_0x716a('0x28')](function(_0x1c7f12){var _0x428cab=[];if(_0x1c7f12){var _0xa5d39;for(var _0x5cc3fa=0x0,_0x12b00c;_0x5cc3fa<_0x1c7f12[_0x716a('0x16')];_0x5cc3fa+=0x1){_0x12b00c=_0x1c7f12[_0x5cc3fa]['get']({'plain':!![]});switch(_0x12b00c['dialCheckDuplicateType']){case _0x716a('0x4c'):_0x428cab[_0x716a('0x29')](db['sequelize'][_0x716a('0x4d')](_0x5858bc(_0x12b00c,_0x716a('0x4e')))['then'](function(){})[_0x716a('0x2b')](_0x2abeb0()));break;case _0x716a('0x4f'):_0x428cab['push'](db['sequelize'][_0x716a('0x4d')](_0x4743b8(_0x12b00c,_0x716a('0x4e')))[_0x716a('0x28')](function(){})['catch'](_0x2abeb0()));break;default:_0x428cab[_0x716a('0x29')](db[_0x716a('0x50')][_0x716a('0x4d')](_0x3ae2ba(_0x12b00c,_0x716a('0x4e')))[_0x716a('0x28')](function(){})[_0x716a('0x2b')](_0x2abeb0()));}}}return _0x428cab;})[_0x716a('0x51')]()[_0x716a('0x28')](function(){return db['VoiceQueue'][_0x716a('0x47')]({'where':{'type':_0x716a('0x48')},'attributes':['id'],'include':[{'model':db[_0x716a('0x4a')],'as':_0x716a('0x52'),'where':{'id':LISTID}}]})[_0x716a('0x28')](function(_0x125a9f){var _0x400d7c=[];if(_0x125a9f){var _0x65cea0;for(var _0x1fcda6=0x0,_0xbdf5ad;_0x1fcda6<_0x125a9f[_0x716a('0x16')];_0x1fcda6+=0x1){_0xbdf5ad=_0x125a9f[_0x1fcda6][_0x716a('0x53')]({'plain':!![]});_0x400d7c[_0x716a('0x29')](db[_0x716a('0x50')]['query'](_0x24644f(_0xbdf5ad,_0x716a('0x4e')))[_0x716a('0x28')](function(){})[_0x716a('0x2b')](_0x2abeb0()));}}return _0x400d7c;})[_0x716a('0x51')]();})['then'](function(){return db['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x716a('0x4a')],'as':_0x716a('0x4b'),'where':{'id':LISTID}}]})[_0x716a('0x28')](function(_0x7a01e7){var _0x228398=[];if(_0x7a01e7){for(var _0x8f5d38=0x0,_0x8e4d63;_0x8f5d38<_0x7a01e7['length'];_0x8f5d38+=0x1){_0x8e4d63=_0x7a01e7[_0x8f5d38][_0x716a('0x53')]({'plain':!![]});switch(_0x8e4d63['dialCheckDuplicateType']){case _0x716a('0x4c'):_0x228398[_0x716a('0x29')](db['sequelize']['query'](_0x5858bc(_0x8e4d63,_0x716a('0x54')))[_0x716a('0x28')](function(){})['catch'](_0x2abeb0()));break;case _0x716a('0x4f'):_0x228398[_0x716a('0x29')](db['sequelize'][_0x716a('0x4d')](_0x4743b8(_0x8e4d63,'CampaignId'))[_0x716a('0x28')](function(){})['catch'](_0x2abeb0()));break;default:_0x228398['push'](db['sequelize'][_0x716a('0x4d')](_0x3ae2ba(_0x8e4d63,_0x716a('0x54')))[_0x716a('0x28')](function(){})[_0x716a('0x2b')](_0x2abeb0()));}}}return _0x228398;})[_0x716a('0x51')]();})[_0x716a('0x28')](function(){return db[_0x716a('0x55')][_0x716a('0x47')]({'attributes':['id'],'include':[{'model':db[_0x716a('0x4a')],'as':_0x716a('0x52'),'where':{'id':LISTID}}]})[_0x716a('0x28')](function(_0x1cafdf){var _0xe8c0ea=[];if(_0x1cafdf){for(var _0x4bfc01=0x0,_0x2f7aed;_0x4bfc01<_0x1cafdf['length'];_0x4bfc01+=0x1){_0x2f7aed=_0x1cafdf[_0x4bfc01]['get']({'plain':!![]});_0xe8c0ea[_0x716a('0x29')](db[_0x716a('0x50')][_0x716a('0x4d')](_0x24644f(_0x2f7aed,'CampaignId'))['then'](function(){})[_0x716a('0x2b')](_0x2abeb0()));}}return _0xe8c0ea;})[_0x716a('0x51')]();})[_0x716a('0x2b')](function(_0x2b8a11){logger['error'](_0x716a('0x56'),_0x716a('0x57'),_0x2b8a11['message']);});}var processPromises=function(_0x450079){return BPromise[_0x716a('0x51')](promises)[_0x716a('0x28')](function(_0x3ff33c){})['catch'](function(_0x44c22f){logger['error'](_0x716a('0x58'),JSON['stringify'](_0x44c22f));})['finally'](function(){socket[_0x716a('0x59')](_0x716a('0x5a')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x450079){return _0x450079[_0x716a('0x5b')]();}});};var endCsv=function(){return BPromise[_0x716a('0x5c')]()[_0x716a('0x28')](function(){if(hopperContacts){return checkHopper();}})[_0x716a('0x28')](function(){socket[_0x716a('0x59')](_0x716a('0x5a')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x716a('0x5d')](FILEPATH);}catch(_0x201511){logger[_0x716a('0xf')](_0x716a('0x5e'),JSON['stringify'](_0x201511));}finally{process['exit'](0x0);}});};process['on'](_0x716a('0x5f'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x716a('0x5c')]()[_0x716a('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x716a('0x60')][_0x716a('0x47')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1ba5cc){var _0x4e01f1=fs[_0x716a('0x61')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x716a('0x62')](_0x4e01f1,{'header':!![],'skipEmptyLines':!![],'step':function(_0xf0cc71,_0x1afd77){total+=0x1;var _0x4a8d4b=total;promises[_0x716a('0x29')](checkRow(_0xf0cc71,_0x1ba5cc,_0x4a8d4b)[_0x716a('0x28')](function(){success+=0x1;})[_0x716a('0x2b')](function(_0x17511f){if(_0x17511f[_0x716a('0xf')]){errors+=0x1;delete _0x17511f[_0x716a('0xf')];}else if(_0x17511f[_0x716a('0x24')]){duplicates+=0x1;delete _0x17511f['duplicate'];}rows[_0x716a('0x29')](_0x17511f);}));if(total%0xc8===0x0){_0x1afd77['pause']();return processPromises(_0x1afd77);}},'complete':function(){return processPromises()['then'](function(){logger[_0x716a('0x63')](_0x716a('0x64'));endCsv();});},'error':function(_0x14d662,_0xba077d){logger['info']('CSV\x20parse\x20error',JSON[_0x716a('0x65')](_0x14d662));endCsv();}});})['catch'](function(_0x387fd7){logger['error'](_0x716a('0x66'),JSON[_0x716a('0x65')](_0x387fd7));});}main(); \ No newline at end of file +var _0x6fc4=['Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','select','field','scheduledAt','toString','ListId','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','insert','cm_hopper_black','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','findAll','BlackLists','Campaign','CampaignId','all','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','createReadStream','duplicate','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6fc4,0x13b));var _0x46fc=function(_0x455b35,_0x5d2b5e){_0x455b35=_0x455b35-0x0;var _0x1fc095=_0x6fc4[_0x455b35];return _0x1fc095;};'use strict';var BPromise=require(_0x46fc('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x46fc('0x1'));var Papa=require(_0x46fc('0x2'));var Redis=require(_0x46fc('0x3'));var db=require(_0x46fc('0x4'))['db'];var config=require(_0x46fc('0x5'));var logger=require('../../../config/logger')(_0x46fc('0x6'));config[_0x46fc('0x7')]=_['defaults'](config[_0x46fc('0x7')],{'host':_0x46fc('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x46fc('0x7')]));require(_0x46fc('0x9'))[_0x46fc('0xa')](socket);try{if(!process[_0x46fc('0xb')][0x2]||process[_0x46fc('0xb')][0x2]===_0x46fc('0xc')||process[_0x46fc('0xb')][0x2]===_0x46fc('0xd')){throw new Error(_0x46fc('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0x46fc('0xb')][0x3]||process['argv'][0x3]===_0x46fc('0xc')||process[_0x46fc('0xb')][0x3]===_0x46fc('0xd')||!process['argv'][0x4]||process['argv'][0x4]==='undefined'||process['argv'][0x4]===_0x46fc('0xd')){throw new Error(_0x46fc('0xf'));}var FIELDS=_[_0x46fc('0x10')](process[_0x46fc('0xb')][0x3][_0x46fc('0x11')](','),process[_0x46fc('0xb')][0x4]['split'](','));if(!process[_0x46fc('0xb')][0x5]||process[_0x46fc('0xb')][0x5]===_0x46fc('0xc')||process[_0x46fc('0xb')][0x5]===_0x46fc('0xd')){throw new Error(_0x46fc('0x12'));}var LISTID=process[_0x46fc('0xb')][0x5];var COMPANYID=process[_0x46fc('0xb')][0x6]&&process['argv'][0x6]!==_0x46fc('0xc')&&process['argv'][0x6]!==_0x46fc('0xd')?process[_0x46fc('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x46fc('0xb')][0x7]!==_0x46fc('0xc')&&process['argv'][0x7]!==_0x46fc('0xd')?process['argv'][0x7]:null;if(!process[_0x46fc('0xb')][0x8]||process[_0x46fc('0xb')][0x8]===_0x46fc('0xc')||process[_0x46fc('0xb')][0x8]===_0x46fc('0xd')){throw new Error(_0x46fc('0x13'));}var SOCKET_TIMESTAMP=process[_0x46fc('0xb')][0x8];}catch(_0x4b829f){logger['error'](_0x4b829f);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(_0x1337b0,_0x2744d2,_0x17eaa3,_0x503dae){var _0x21f930={'message':_0x2744d2};_0x21f930[_0x1337b0]=!![];if(_0x17eaa3){_0x21f930[_0x46fc('0x14')]=_0x17eaa3;}if(_0x503dae){_0x21f930[_0x46fc('0x15')]=_0x503dae;}return _0x21f930;}function isEmail(_0x24da64){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))*$/[_0x46fc('0x16')](_0x24da64);}function checkRow(_0x558486,_0x233dee,_0x1defbe){return new BPromise(function(_0x24b8fd,_0xe9b276){if(_['isNil'](_0x558486)){return _0xe9b276(handleCheckRowError(_0x46fc('0x17'),_0x46fc('0x18'),null,_0x1defbe));}if(_0x558486[_0x46fc('0x19')]&&_0x558486[_0x46fc('0x19')][_0x46fc('0x1a')]){var _0x536476=_['map'](_0x558486['errors'],'message')[_0x46fc('0x1b')](';');return _0xe9b276(handleCheckRowError('error',_0x536476,null,_0x1defbe));}var _0x512bfe={};for(var _0x1abb34 in FIELDS){if(FIELDS[_0x46fc('0x1c')](_0x1abb34)&&FIELDS[_0x1abb34]){_0x512bfe[_0x1abb34]=_0x558486['data'][0x0][FIELDS[_0x1abb34]]||_0x558486[_0x46fc('0x1d')][0x0]['\ufeff'+FIELDS[_0x1abb34]];}}if(!_0x512bfe[_0x46fc('0x1e')]){return _0xe9b276(handleCheckRowError(_0x46fc('0x17'),_0x46fc('0x1f'),null,_0x1defbe));}if(!_0x512bfe[_0x46fc('0x20')]){return _0xe9b276(handleCheckRowError(_0x46fc('0x17'),_0x46fc('0x21'),null,_0x1defbe));}if(_0x512bfe[_0x46fc('0x22')]){var _0x1e339e=moment(_0x512bfe[_0x46fc('0x22')],_0x46fc('0x23'));if(!_0x1e339e['isValid']()){return _0xe9b276(handleCheckRowError('error',_0x46fc('0x24'),null,_0x1defbe));}}if(_0x512bfe[_0x46fc('0x25')]){if(!isEmail(_0x512bfe[_0x46fc('0x25')])){return _0xe9b276(handleCheckRowError(_0x46fc('0x17'),'email\x20format\x20is\x20not\x20valid!',null,_0x1defbe));}}_0x512bfe['ListId']=LISTID;_0x512bfe[_0x46fc('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x46fc('0x1a')]&&_0x233dee){var _0x36d322={};for(var _0x378d5e=0x0,_0x19bb61=DUPLICATES[_0x46fc('0x1a')];_0x378d5e<_0x19bb61;_0x378d5e+=0x1){_0x36d322[DUPLICATES[_0x378d5e]]=_0x512bfe[DUPLICATES[_0x378d5e]];}var _0x58b317=_[_0x46fc('0x27')](_0x233dee,_0x36d322);if(_0x58b317){return _0xe9b276(handleCheckRowError('duplicate',_0x46fc('0x28'),_0x58b317,_0x1defbe));}}return db[_0x46fc('0x29')][_0x46fc('0x2a')](_0x512bfe,{'raw':!![],'hooks':![],'fields':_[_0x46fc('0x2b')](_0x512bfe)})['then'](function(_0x4c8ddf){if(DUPLICATES&&DUPLICATES[_0x46fc('0x1a')]&&_0x233dee){_0x233dee[_0x46fc('0x2c')](_[_0x46fc('0x2d')](_0x512bfe,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4c8ddf['id'];return _0x24b8fd();})[_0x46fc('0x2e')](function(_0x5ca170){return _0xe9b276(handleCheckRowError(_0x46fc('0x17'),_0x46fc('0x2f')+(_0x5ca170[_0x46fc('0x30')]||JSON[_0x46fc('0x31')](_0x5ca170)),null,_0x1defbe));});});}function checkHopper(){function _0x304b26(){return function(_0x3a5f48){logger[_0x46fc('0x17')](_0x46fc('0x32'),_0x46fc('0x33'),util[_0x46fc('0x34')](_0x3a5f48,{'showHidden':![],'depth':null}));};}var _0x32ad18=function(_0x241c79,_0x205dc4){var _0x303a5c=squel['insert']()[_0x46fc('0x35')](_0x46fc('0x36'))[_0x46fc('0x37')]([_0x46fc('0x20'),'scheduledAt',_0x46fc('0x38'),'ListId',_0x205dc4,_0x46fc('0x39'),_0x46fc('0x3a')],squel[_0x46fc('0x3b')]()[_0x46fc('0x3c')](_0x46fc('0x20'),'phone')[_0x46fc('0x3c')]('NOW()',_0x46fc('0x3d'))[_0x46fc('0x3c')]('id',_0x46fc('0x38'))['field'](LISTID[_0x46fc('0x3e')](),_0x46fc('0x3f'))[_0x46fc('0x3c')](_0x241c79['id'][_0x46fc('0x3e')](),_0x205dc4)[_0x46fc('0x3c')](_0x46fc('0x40'),_0x46fc('0x39'))['field'](_0x46fc('0x40'),_0x46fc('0x3a'))[_0x46fc('0x41')](_0x46fc('0x42'))[_0x46fc('0x43')](_0x46fc('0x44'))[_0x46fc('0x43')](_0x46fc('0x45'),LISTID['toString']())[_0x46fc('0x43')](_0x46fc('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x46fc('0x3b')]()[_0x46fc('0x3c')](_0x46fc('0x20'))[_0x46fc('0x41')](_0x46fc('0x36'))['where'](_0x205dc4+_0x46fc('0x47'),_0x241c79['id'][_0x46fc('0x3e')]())))[_0x46fc('0x3e')]();return _0x303a5c;};var _0x565363=function(_0x1b8bad,_0x5210bf){var _0x1a13b7=squel['insert']()[_0x46fc('0x35')](_0x46fc('0x36'))[_0x46fc('0x37')]([_0x46fc('0x20'),'scheduledAt',_0x46fc('0x38'),'ListId',_0x5210bf,_0x46fc('0x39'),_0x46fc('0x3a')],squel['select']()[_0x46fc('0x3c')](_0x46fc('0x20'),_0x46fc('0x20'))[_0x46fc('0x3c')](_0x46fc('0x40'),_0x46fc('0x3d'))[_0x46fc('0x3c')]('id',_0x46fc('0x38'))[_0x46fc('0x3c')](LISTID[_0x46fc('0x3e')](),_0x46fc('0x3f'))['field'](_0x1b8bad['id'][_0x46fc('0x3e')](),_0x5210bf)[_0x46fc('0x3c')]('NOW()','createdAt')[_0x46fc('0x3c')](_0x46fc('0x40'),_0x46fc('0x3a'))['from'](_0x46fc('0x42'))[_0x46fc('0x43')]('deletedAt\x20IS\x20NULL')[_0x46fc('0x43')](_0x46fc('0x45'),LISTID[_0x46fc('0x3e')]())[_0x46fc('0x43')](_0x46fc('0x48'),squel[_0x46fc('0x49')](hopperContacts))[_0x46fc('0x43')](_0x46fc('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x46fc('0x3b')]()[_0x46fc('0x3c')]('calleridnum')[_0x46fc('0x41')]('cm_hopper_final')['where'](_0x5210bf+_0x46fc('0x47'),_0x1b8bad['id'][_0x46fc('0x3e')]()))['where'](_0x46fc('0x4a'),squel['select']()[_0x46fc('0x3c')](_0x46fc('0x20'))[_0x46fc('0x41')]('cm_hopper')[_0x46fc('0x43')](_0x5210bf+_0x46fc('0x47'),_0x1b8bad['id']['toString']())))[_0x46fc('0x3e')]();return _0x1a13b7;};function _0x5202af(_0x424969,_0x858b29){var _0x3315f9=squel[_0x46fc('0x4b')]()[_0x46fc('0x35')](_0x46fc('0x36'))[_0x46fc('0x37')]([_0x46fc('0x20'),_0x46fc('0x3d'),_0x46fc('0x38'),_0x46fc('0x3f'),_0x858b29,_0x46fc('0x39'),'updatedAt'],squel['select']()[_0x46fc('0x3c')](_0x46fc('0x20'),'phone')[_0x46fc('0x3c')](_0x46fc('0x40'),_0x46fc('0x3d'))[_0x46fc('0x3c')]('id',_0x46fc('0x38'))['field'](LISTID[_0x46fc('0x3e')](),_0x46fc('0x3f'))[_0x46fc('0x3c')](_0x424969['id'][_0x46fc('0x3e')](),_0x858b29)['field'](_0x46fc('0x40'),_0x46fc('0x39'))['field'](_0x46fc('0x40'),_0x46fc('0x3a'))[_0x46fc('0x41')](_0x46fc('0x42'))['where'](_0x46fc('0x44'))[_0x46fc('0x43')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x46fc('0x48'),squel[_0x46fc('0x49')](hopperContacts))['where'](_0x46fc('0x46')))[_0x46fc('0x3e')]();return _0x3315f9;}function _0x5158a(_0x5ae884,_0x43915b){var _0xe3905d=squel[_0x46fc('0x4b')]()[_0x46fc('0x35')](_0x46fc('0x4c'))[_0x46fc('0x37')]([_0x46fc('0x20'),_0x46fc('0x38'),_0x46fc('0x3f'),_0x43915b,_0x46fc('0x39'),_0x46fc('0x3a')],squel[_0x46fc('0x3b')]()[_0x46fc('0x3c')](_0x46fc('0x20'),_0x46fc('0x20'))[_0x46fc('0x3c')]('id',_0x46fc('0x38'))[_0x46fc('0x3c')](LISTID[_0x46fc('0x3e')](),_0x46fc('0x3f'))[_0x46fc('0x3c')](_0x5ae884['id']['toString'](),_0x43915b)[_0x46fc('0x3c')]('NOW()',_0x46fc('0x39'))[_0x46fc('0x3c')](_0x46fc('0x40'),_0x46fc('0x3a'))[_0x46fc('0x41')](_0x46fc('0x42'))[_0x46fc('0x43')]('deletedAt\x20IS\x20NULL')[_0x46fc('0x43')]('ListId\x20=\x20?',LISTID[_0x46fc('0x3e')]())['where'](_0x46fc('0x48'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0xe3905d;}return db['VoiceQueue']['findAll']({'where':{'type':_0x46fc('0x4d')},'attributes':['id',_0x46fc('0x4e')],'include':[{'model':db[_0x46fc('0x4f')],'as':_0x46fc('0x50'),'where':{'id':LISTID}}]})[_0x46fc('0x51')](function(_0x19efa5){var _0xf23491=[];if(_0x19efa5){var _0x51d2a1;for(var _0x3e6027=0x0,_0x2a00f2;_0x3e6027<_0x19efa5[_0x46fc('0x1a')];_0x3e6027+=0x1){_0x2a00f2=_0x19efa5[_0x3e6027][_0x46fc('0x52')]({'plain':!![]});switch(_0x2a00f2[_0x46fc('0x4e')]){case _0x46fc('0x53'):_0xf23491[_0x46fc('0x2c')](db[_0x46fc('0x54')]['query'](_0x565363(_0x2a00f2,_0x46fc('0x55')))[_0x46fc('0x51')](function(){})[_0x46fc('0x2e')](_0x304b26()));break;case _0x46fc('0x56'):_0xf23491['push'](db[_0x46fc('0x54')][_0x46fc('0x57')](_0x32ad18(_0x2a00f2,_0x46fc('0x55')))[_0x46fc('0x51')](function(){})['catch'](_0x304b26()));break;default:_0xf23491[_0x46fc('0x2c')](db[_0x46fc('0x54')]['query'](_0x5202af(_0x2a00f2,'VoiceQueueId'))['then'](function(){})['catch'](_0x304b26()));}}}return _0xf23491;})['all']()['then'](function(){return db['VoiceQueue'][_0x46fc('0x58')]({'where':{'type':_0x46fc('0x4d')},'attributes':['id'],'include':[{'model':db[_0x46fc('0x4f')],'as':_0x46fc('0x59'),'where':{'id':LISTID}}]})[_0x46fc('0x51')](function(_0x3ecae4){var _0x51e274=[];if(_0x3ecae4){var _0x1d1008;for(var _0x42477f=0x0,_0x38ebf5;_0x42477f<_0x3ecae4[_0x46fc('0x1a')];_0x42477f+=0x1){_0x38ebf5=_0x3ecae4[_0x42477f][_0x46fc('0x52')]({'plain':!![]});_0x51e274['push'](db[_0x46fc('0x54')]['query'](_0x5158a(_0x38ebf5,_0x46fc('0x55')))[_0x46fc('0x51')](function(){})[_0x46fc('0x2e')](_0x304b26()));}}return _0x51e274;})['all']();})[_0x46fc('0x51')](function(){return db[_0x46fc('0x5a')][_0x46fc('0x58')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x46fc('0x50'),'where':{'id':LISTID}}]})[_0x46fc('0x51')](function(_0x4dea94){var _0x298d49=[];if(_0x4dea94){for(var _0xe209fa=0x0,_0x32af21;_0xe209fa<_0x4dea94[_0x46fc('0x1a')];_0xe209fa+=0x1){_0x32af21=_0x4dea94[_0xe209fa][_0x46fc('0x52')]({'plain':!![]});switch(_0x32af21[_0x46fc('0x4e')]){case _0x46fc('0x53'):_0x298d49[_0x46fc('0x2c')](db[_0x46fc('0x54')]['query'](_0x565363(_0x32af21,_0x46fc('0x5b')))[_0x46fc('0x51')](function(){})[_0x46fc('0x2e')](_0x304b26()));break;case _0x46fc('0x56'):_0x298d49[_0x46fc('0x2c')](db['sequelize'][_0x46fc('0x57')](_0x32ad18(_0x32af21,_0x46fc('0x5b')))['then'](function(){})[_0x46fc('0x2e')](_0x304b26()));break;default:_0x298d49[_0x46fc('0x2c')](db[_0x46fc('0x54')][_0x46fc('0x57')](_0x5202af(_0x32af21,'CampaignId'))[_0x46fc('0x51')](function(){})[_0x46fc('0x2e')](_0x304b26()));}}}return _0x298d49;})[_0x46fc('0x5c')]();})[_0x46fc('0x51')](function(){return db[_0x46fc('0x5a')][_0x46fc('0x58')]({'attributes':['id'],'include':[{'model':db[_0x46fc('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x3ef2d8){var _0x41053a=[];if(_0x3ef2d8){for(var _0x2e1a4b=0x0,_0x1fd615;_0x2e1a4b<_0x3ef2d8[_0x46fc('0x1a')];_0x2e1a4b+=0x1){_0x1fd615=_0x3ef2d8[_0x2e1a4b][_0x46fc('0x52')]({'plain':!![]});_0x41053a[_0x46fc('0x2c')](db[_0x46fc('0x54')][_0x46fc('0x57')](_0x5158a(_0x1fd615,'CampaignId'))[_0x46fc('0x51')](function(){})['catch'](_0x304b26()));}}return _0x41053a;})[_0x46fc('0x5c')]();})['catch'](function(_0x40c2f9){logger[_0x46fc('0x17')](_0x46fc('0x5d'),_0x46fc('0x5e'),_0x40c2f9[_0x46fc('0x30')]);});}var processPromises=function(_0x43d534){return BPromise[_0x46fc('0x5c')](promises)[_0x46fc('0x51')](function(_0x432e0d){})[_0x46fc('0x2e')](function(_0x303f33){logger[_0x46fc('0x17')](_0x46fc('0x5f'),JSON[_0x46fc('0x31')](_0x303f33));})[_0x46fc('0x60')](function(){socket[_0x46fc('0x61')](_0x46fc('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x43d534){return _0x43d534['resume']();}});};var endCsv=function(){return BPromise[_0x46fc('0x63')]()[_0x46fc('0x51')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x46fc('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x46fc('0x64')](FILEPATH);}catch(_0x479756){logger[_0x46fc('0x17')](_0x46fc('0x65'),JSON['stringify'](_0x479756));}finally{process[_0x46fc('0x66')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0x46fc('0x67'));endCsv();});function main(){return BPromise[_0x46fc('0x63')]()[_0x46fc('0x51')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x46fc('0x11')](',');return db[_0x46fc('0x29')][_0x46fc('0x58')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x46fc('0x51')](function(_0x3fdcbe){var _0x33be79=fs[_0x46fc('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x33be79,{'header':!![],'skipEmptyLines':!![],'step':function(_0x38f638,_0x21685f){total+=0x1;var _0x4fa1c7=total;promises['push'](checkRow(_0x38f638,_0x3fdcbe,_0x4fa1c7)[_0x46fc('0x51')](function(){success+=0x1;})[_0x46fc('0x2e')](function(_0x3e4dbc){if(_0x3e4dbc['error']){errors+=0x1;delete _0x3e4dbc[_0x46fc('0x17')];}else if(_0x3e4dbc['duplicate']){duplicates+=0x1;delete _0x3e4dbc[_0x46fc('0x69')];}rows[_0x46fc('0x2c')](_0x3e4dbc);}));if(total%0xc8===0x0){_0x21685f['pause']();return processPromises(_0x21685f);}},'complete':function(){return processPromises()['then'](function(){logger[_0x46fc('0x6a')](_0x46fc('0x6b'));endCsv();});},'error':function(_0x12f342,_0x256cac){logger['info'](_0x46fc('0x6c'),JSON[_0x46fc('0x31')](_0x12f342));endCsv();}});})[_0x46fc('0x2e')](function(_0x31a2d5){logger['error'](_0x46fc('0x6d'),JSON[_0x46fc('0x31')](_0x31a2d5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index b338b58..039baa6 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 _0x9dc1=['cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','insert','cm_hopper_black','updatedAt','.CmListId','.CmListId\x20=\x20?','priority','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','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','errors','code','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','utcOffset','set','offset','sequelize','stringify','start','binding','clone','socket_timestamp','includes','header','name','_description','writeFileSync','parse','createReadStream','data','rows','find','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','timezones','firstName','\x20not\x20specified','hasOwnProperty','trim','itemTypeId','description','SystemRow','appendFileSync','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','lodash','papaparse','util','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','findOne','update','updated','CmContactHasItem','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','UserId','recallme','fields'];(function(_0x51dfb6,_0x1bb779){var _0x36824a=function(_0x266d8e){while(--_0x266d8e){_0x51dfb6['push'](_0x51dfb6['shift']());}};_0x36824a(++_0x1bb779);}(_0x9dc1,0x1d5));var _0x19dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dc1[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x19dc('0x0'));var Papa=require(_0x19dc('0x1'));var util=require(_0x19dc('0x2'));var BPromise=require('bluebird');var moment=require(_0x19dc('0x3'));var squel=require(_0x19dc('0x4'));var Redis=require('ioredis');var db=require(_0x19dc('0x5'))['db'];var config=require(_0x19dc('0x6'));var shared=require(_0x19dc('0x7'));var logger=require(_0x19dc('0x8'))('import');config['redis']=_[_0x19dc('0x9')](config[_0x19dc('0xa')],{'host':_0x19dc('0xb'),'port':0x18eb});var socket=require(_0x19dc('0xc'))(new Redis(config[_0x19dc('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x19dc('0xd')]('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()[_0x19dc('0xd')](_0x19dc('0xe'));function isEmail(_0x43f11e){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))*$/[_0x19dc('0xf')](_0x43f11e);}function selectNotIn(_0x383d27,_0x5dcaa1,_0x469930,_0xe08734,_0x10536d){return squel[_0x19dc('0x10')]()[_0x19dc('0x11')]('phone')[_0x19dc('0x12')](_0xe08734)[_0x19dc('0x13')](_0x5dcaa1,null,_0x5dcaa1+_0x19dc('0x14')+_0xe08734+'.'+_0x469930)['where'](_0xe08734+'.'+_0x469930+_0x19dc('0x15')+_0x383d27+'.'+_0x469930)[_0x19dc('0x16')](_0x5dcaa1+_0x19dc('0x17')+_0x10536d['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x505e5c,_0xba8fe7){promisesAdditionalPhones=[];return db['CmContact'][_0x19dc('0x18')]({'raw':!![],'attributes':['id',_0x19dc('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x19dc('0x1a')](function(_0x3109c7){if(_0x3109c7!==null){var _0xb5dea5=[];for(var _0x1237c1=0x0;_0x1237c1<_0x3109c7[_0x19dc('0x1b')];_0x1237c1++){var _0x59cc3c=_0x3109c7[_0x1237c1];_0xb5dea5[_0x19dc('0x1c')](insertAdditionalPhones(_0x59cc3c));}}Promise[_0x19dc('0x1d')](_0xb5dea5)[_0x19dc('0x1a')](function(){_0x505e5c({'val':0x1});});});});}function insertAdditionalPhones(_0x1c41e0){return new Promise(function(_0x532886,_0xa7453a){var _0xc7fcf6=_0x1c41e0[_0x19dc('0x19')];var _0x5885c6=_0xc7fcf6[_0x19dc('0x1e')](';');var _0x26ded3=[];orderBy=0x0;for(var _0x23c13e=0x0;_0x23c13e<_0x5885c6[_0x19dc('0x1b')];_0x23c13e++){_0x26ded3[_0x19dc('0x1c')](splitAdditionalPhone(_0x1c41e0['id'],_0x5885c6[_0x23c13e]));}Promise[_0x19dc('0x1d')](_0x26ded3)[_0x19dc('0x1a')](function(){_0x532886({'val':_0x5885c6[_0x19dc('0x1b')]});});});}function splitAdditionalPhone(_0x24e4ac,_0x19f61f){return new Promise(function(_0x585984,_0x551a59){var _0x1f1180=_0x19f61f[_0x19dc('0x1e')](':');var _0x282307=_0x1f1180[0x0];var _0x2ed96c=_0x1f1180[0x1];if(!_[_0x19dc('0x1f')](_0x2ed96c)){var _0x42f269=_0x2ed96c[_0x19dc('0x1e')]('|');var _0x1cd844=[];for(var _0x361713=0x0;_0x361713<_0x42f269[_0x19dc('0x1b')];_0x361713++){if(_0x42f269[_0x361713]!==''){var _0x163bdc=_[_0x19dc('0x20')](promisesAdditionalPhones,{'contactId':_0x24e4ac,'phone':_0x42f269[_0x361713]});if(_0x163bdc['length']==0x0){orderBy++;promisesAdditionalPhones[_0x19dc('0x1c')]({'contactId':_0x24e4ac,'contactTypeId':_0x282307,'phone':_0x42f269[_0x361713],'orderBy':orderBy});}}}_0x585984({'ok':0x1});}else _0x585984({'res':0x0});});}function createAdditionalPhone(_0x2c40d9,_0x1c830c,_0xcca96b,_0x3e798f){var _0x5e6597='';var _0x2a0643='';var _0x3db8c3=_0xcca96b['split']('§');_0x5e6597=_0x3db8c3[0x0];if(_0x3db8c3[_0x19dc('0x1b')]==0x2)_0x2a0643=_0x3db8c3[0x1];return new Promise(function(_0x45cbec,_0x51223e){return db['CmContactHasItem'][_0x19dc('0x21')]({'where':{'CmContactId':_0x2c40d9,'item':_0x5e6597}})[_0x19dc('0x1a')](function(_0x3450e4){if(_0x3450e4){return db['CmContactHasItem'][_0x19dc('0x22')]({'ItemTypeId':_0x1c830c,'description':_0x2a0643,'OrderBy':_0x3e798f},{'where':{'CmContactId':_0x2c40d9,'item':_0x5e6597}})[_0x19dc('0x1a')](function(_0x1baffe){_0x45cbec({'res':_0x19dc('0x23')});});}else{return db[_0x19dc('0x24')]['create']({'CmContactId':_0x2c40d9,'item':_0x5e6597,'description':_0x2a0643,'ItemTypeId':_0x1c830c,'OrderBy':_0x3e798f,'ItemClass':_0x19dc('0x25')})[_0x19dc('0x1a')](function(_0x3d0353){_0x45cbec({'res':_0x19dc('0x26')});});}});});}function insertCmHopper(_0x4a0422,_0x79ccc6,_0x51c858,_0x626f8c,_0x539255){var _0x24fc6c=[_0x19dc('0x27'),_0x19dc('0x28'),'cm_contacts.id',_0x19dc('0x29'),_0x79ccc6+'.'+_0x626f8c,_0x19dc('0x2a'),_0x19dc('0x2b'),_0x19dc('0x2c'),'cm_contacts.UserId','\x22'+_0x539255+'\x22'];return squel['insert']()[_0x19dc('0x2d')](_0x19dc('0x2e'))[_0x19dc('0x2f')]([_0x19dc('0x30'),_0x19dc('0x31'),_0x19dc('0x32'),_0x19dc('0x33'),_0x626f8c,_0x19dc('0x34'),'updatedAt','priority',_0x19dc('0x35'),_0x19dc('0x36')],squel[_0x19dc('0x10')]()[_0x19dc('0x37')](_0x24fc6c)['from'](_0x79ccc6)[_0x19dc('0x13')](_0x19dc('0x38'),null,_0x19dc('0x39')+_0x79ccc6+'.CmListId')[_0x19dc('0x13')](_0x51c858,null,_0x51c858+_0x19dc('0x14')+_0x79ccc6+'.'+_0x626f8c)[_0x19dc('0x16')](_0x79ccc6+'.CmListId\x20=\x20?',_0x4a0422)[_0x19dc('0x16')](_0x19dc('0x3a'),NOW)[_0x19dc('0x16')](_0x19dc('0x3b'),selectNotIn(_0x79ccc6,_0x51c858,_0x626f8c,'cm_hopper',[_0x19dc('0x3c'),_0x19dc('0x3d')]))['where'](_0x19dc('0x3b'),selectNotIn(_0x79ccc6,_0x51c858,_0x626f8c,'cm_hopper',[_0x19dc('0x3c')])))[_0x19dc('0x3e')]();}function insertCmHopperBlack(_0x128952,_0xdd437e,_0x340cff,_0x2a5005){var _0xf46b77=[_0x19dc('0x27'),_0x19dc('0x3f'),_0x19dc('0x29'),_0xdd437e+'.'+_0x2a5005,_0x19dc('0x2a'),'cm_contacts.updatedAt'];return squel[_0x19dc('0x40')]()[_0x19dc('0x2d')](_0x19dc('0x41'))[_0x19dc('0x2f')]([_0x19dc('0x30'),_0x19dc('0x32'),_0x19dc('0x33'),_0x2a5005,_0x19dc('0x34'),_0x19dc('0x42')],squel[_0x19dc('0x10')]()[_0x19dc('0x37')](_0xf46b77)[_0x19dc('0x12')](_0xdd437e)[_0x19dc('0x13')]('cm_contacts',null,_0x19dc('0x39')+_0xdd437e+_0x19dc('0x43'))[_0x19dc('0x13')](_0x340cff,null,_0x340cff+_0x19dc('0x14')+_0xdd437e+'.'+_0x2a5005)[_0x19dc('0x16')](_0xdd437e+_0x19dc('0x44'),_0x128952)[_0x19dc('0x16')](_0x19dc('0x3a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x19dc('0x10')]()[_0x19dc('0x11')](_0x19dc('0x30'))[_0x19dc('0x12')]('cm_hopper_black')['where']('ListId\x20=\x20?',_0x128952)['where'](_0x2a5005+_0x19dc('0x15')+_0xdd437e+'.'+_0x2a5005)))['toString']();}function insertTzCmHopper(_0x2b17ed,_0x43a73a,_0x510e8d,_0x27e202,_0x5e4044,_0x48ad95){var _0x45ac3e=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x48ad95+'.offset-cm_contacts.utcOffset\x20minute)',_0x19dc('0x3f'),_0x19dc('0x29'),_0x43a73a+'.'+_0x27e202,_0x19dc('0x2a'),_0x19dc('0x2b'),_0x19dc('0x2c'),'cm_contacts.UserId','\x22'+_0x5e4044+'\x22'];var _0x53ad0e=squel[_0x19dc('0x40')]()[_0x19dc('0x2d')](_0x19dc('0x2e'))[_0x19dc('0x2f')](['phone',_0x19dc('0x31'),_0x19dc('0x32'),_0x19dc('0x33'),_0x27e202,_0x19dc('0x34'),_0x19dc('0x42'),_0x19dc('0x45'),_0x19dc('0x35'),_0x19dc('0x36')],squel['select']()['fields'](_0x45ac3e)[_0x19dc('0x12')](_0x43a73a)[_0x19dc('0x13')](_0x19dc('0x38'),null,_0x19dc('0x39')+_0x43a73a+_0x19dc('0x43'))[_0x19dc('0x13')](_0x510e8d,null,_0x510e8d+_0x19dc('0x14')+_0x43a73a+'.'+_0x27e202)[_0x19dc('0x13')](_0x48ad95,null,_0x48ad95+_0x19dc('0x14')+_0x43a73a+'.'+_0x27e202)[_0x19dc('0x16')](_0x43a73a+_0x19dc('0x44'),_0x2b17ed)[_0x19dc('0x16')](_0x19dc('0x3a'),NOW)['where'](_0x19dc('0x3b'),selectNotIn(_0x43a73a,_0x510e8d,_0x27e202,_0x19dc('0x2e'),[_0x19dc('0x3c'),'\x22onlyIfOpen\x22']))[_0x19dc('0x16')](_0x19dc('0x3b'),selectNotIn(_0x43a73a,_0x510e8d,_0x27e202,_0x19dc('0x2e'),[_0x19dc('0x3c')])))[_0x19dc('0x3e')]();return _0x53ad0e;}function insertTzCmHopperBlack(_0x3e6a8f,_0x3cee13,_0x25b1bb,_0x104b0e){var _0x2688da=[_0x19dc('0x27'),_0x19dc('0x3f'),_0x19dc('0x29'),_0x3cee13+'.'+_0x104b0e,_0x19dc('0x2a'),_0x19dc('0x2b')];return squel[_0x19dc('0x40')]()[_0x19dc('0x2d')]('cm_hopper_black')[_0x19dc('0x2f')](['phone',_0x19dc('0x32'),_0x19dc('0x33'),_0x104b0e,'createdAt','updatedAt'],squel[_0x19dc('0x10')]()[_0x19dc('0x37')](_0x2688da)['from'](_0x3cee13)['join'](_0x19dc('0x38'),null,_0x19dc('0x39')+_0x3cee13+'.CmListId')['join'](_0x25b1bb,null,_0x25b1bb+'.id\x20=\x20'+_0x3cee13+'.'+_0x104b0e)[_0x19dc('0x16')](_0x3cee13+_0x19dc('0x44'),_0x3e6a8f)[_0x19dc('0x16')](_0x19dc('0x3a'),NOW)[_0x19dc('0x16')](_0x19dc('0x3b'),squel['select']()[_0x19dc('0x11')]('phone')[_0x19dc('0x12')](_0x19dc('0x41'))[_0x19dc('0x16')](_0x19dc('0x46'),_0x3e6a8f)[_0x19dc('0x16')](_0x104b0e+_0x19dc('0x15')+_0x3cee13+'.'+_0x104b0e)))[_0x19dc('0x3e')]();}function insertCmHopperAdditionalPhones(_0x4c3661){var _0x39da98=[_0x19dc('0x47'),_0x19dc('0x48'),_0x19dc('0x49'),_0x19dc('0x4a'),_0x19dc('0x4b')];return squel[_0x19dc('0x40')]()[_0x19dc('0x2d')](_0x19dc('0x4c'))['fromQuery']([_0x19dc('0x4d'),_0x19dc('0x30'),'OrderBy','createdAt',_0x19dc('0x42')],squel[_0x19dc('0x10')]()['fields'](_0x39da98)['from'](_0x19dc('0x2e'))[_0x19dc('0x13')](_0x19dc('0x38'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x19dc('0x13')]('cm_contact_has_items',null,_0x19dc('0x4e'))[_0x19dc('0x16')](_0x19dc('0x4f'),_0x4c3661)[_0x19dc('0x16')](_0x19dc('0x3a'),NOW))[_0x19dc('0x3e')]();}function insertCmContact(_0x4c8af0,_0x56d634,_0x1e90f0,_0xb7650e){var _0x1bb6c7=_['concat'](_[_0x19dc('0x50')](_0xb7650e),[_0x19dc('0x33'),_0x19dc('0x51'),_0x19dc('0x34'),_0x19dc('0x42'),'scheduledAt']);return squel[_0x19dc('0x40')]()[_0x19dc('0x2d')](_0x19dc('0x38'))[_0x19dc('0x2f')](_0x1bb6c7,squel[_0x19dc('0x10')]()[_0x19dc('0x37')](_0x1bb6c7)[_0x19dc('0x12')](_0x56d634)['where']('('+_0x1e90f0['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x19dc('0x10')]()[_0x19dc('0x37')](_0x1e90f0)[_0x19dc('0x12')](_0x19dc('0x38'))['where'](_0x19dc('0x46'),_0x4c8af0)[_0x19dc('0x16')](_0x19dc('0x52')))[_0x19dc('0x16')](_0x19dc('0x53'),squel['select']()[_0x19dc('0x11')]('MIN(id)',_0x19dc('0x54'))[_0x19dc('0x12')](_0x56d634)[_0x19dc('0x55')](_0x1e90f0[_0x19dc('0x13')](','))))[_0x19dc('0x3e')]();}function handleStop(){logger[_0x19dc('0x56')](_0x19dc('0x57'));stopped=!![];}function handleUncaughtException(_0x2fd1b2){logger[_0x19dc('0x58')](_0x2fd1b2[_0x19dc('0x59')]);process['exit'](0x1);}function handleError(_0x44f125,_0x39aa5f){stats[_0x19dc('0x5a')]['push']({'name':_0x39aa5f[_0x19dc('0x5b')],'message':_0x39aa5f['message'],'row':_0x44f125});}function handleQuery(_0x2487a8){logger['info'](_0x2487a8);return db['sequelize'][_0x19dc('0x5c')](_0x2487a8)[_0x19dc('0x5d')](function(_0x4c4fef){results['push'](_0x4c4fef);})[_0x19dc('0x5e')](function(_0x30c7b9){logger[_0x19dc('0x58')](_0x30c7b9[_0x19dc('0x59')]);});}function updateTzCampaigns(_0x407a7e){return new Promise(function(_0x4ab07f,_0xa2820f){var _0x5892f8=squel[_0x19dc('0x10')]()[_0x19dc('0x37')]([_0x19dc('0x5f'),_0x19dc('0x60')])[_0x19dc('0x12')](_0x19dc('0x61'))[_0x19dc('0x13')](_0x19dc('0x62'),null,_0x19dc('0x63'))[_0x19dc('0x16')](_0x19dc('0x64')+_0x407a7e);db['sequelize'][_0x19dc('0x5c')](_0x5892f8[_0x19dc('0x3e')]())[_0x19dc('0x5d')](function(_0x12a5de){var _0x46f108=[];for(var _0x2a0db4=0x0;_0x2a0db4<_0x12a5de['length'];_0x2a0db4++){_0x46f108['push'](getTimezoneData(_0x12a5de[_0x2a0db4],tmp_campaigns));}BPromise[_0x19dc('0x1d')](_0x46f108)[_0x19dc('0x1a')](function(){_0x4ab07f({'val':0x1});});})['catch'](function(_0x55651a){logger['error'](_0x55651a[_0x19dc('0x59')]);_0x4ab07f({'val':0x0});});});}function updateTzVoiceQueues(_0x12d5f7){return new Promise(function(_0x11c520,_0x41e71a){var _0x6f8a73=squel[_0x19dc('0x10')]()['fields']([_0x19dc('0x65'),'voice_queues.dialTimezone'])[_0x19dc('0x12')](_0x19dc('0x66'))['join'](_0x19dc('0x67'),null,_0x19dc('0x68'))['where'](_0x19dc('0x69')+_0x12d5f7);db['sequelize'][_0x19dc('0x5c')](_0x6f8a73[_0x19dc('0x3e')]())[_0x19dc('0x5d')](function(_0x2b0157){var _0x232a26=[];for(var _0xbea920=0x0;_0xbea920<_0x2b0157['length'];_0xbea920++){_0x232a26[_0x19dc('0x1c')](getTimezoneData(_0x2b0157[_0xbea920],tmp_voice_queues));}BPromise[_0x19dc('0x1d')](_0x232a26)[_0x19dc('0x1a')](function(){_0x11c520({'val':0x1});});})[_0x19dc('0x5e')](function(_0x2c50b9){logger[_0x19dc('0x58')](_0x2c50b9['message']);_0x11c520({'val':0x0});});});}function getTimezoneData(_0x41f892,_0x4a4de3){return new Promise(function(_0x2b6861,_0x56307e){var _0x511191=shared['timezones'];var _0x2d6bf5=_0x511191[_0x41f892[_0x19dc('0x6a')]];if(_[_0x19dc('0x1f')](_0x2d6bf5)){_0x2b6861({'ret':0x1});}else{var _0x563256=_0x2d6bf5[_0x19dc('0x6b')];var _0x4f1311=squel['insert']()[_0x19dc('0x2d')](_0x4a4de3)[_0x19dc('0x6c')]('id',_0x41f892['id'])[_0x19dc('0x6c')](_0x19dc('0x6d'),_0x563256)['set'](_0x19dc('0x6a'),_0x41f892[_0x19dc('0x6a')])['toString']();return db['sequelize'][_0x19dc('0x5c')](_0x4f1311)['spread'](function(_0x1897d7){_0x2b6861({'ret':0x1});})[_0x19dc('0x5e')](function(_0x14f614){logger[_0x19dc('0x58')](_0x14f614[_0x19dc('0x59')]);_0x56307e({'ret':0x1});});}});}function handleTZQuery(_0x24cadb){logger[_0x19dc('0x56')](_0x24cadb);return db[_0x19dc('0x6e')][_0x19dc('0x5c')](_0x24cadb)['spread'](function(_0x4a231f){})[_0x19dc('0x5e')](function(_0x33390d){logger['error'](_0x33390d['message']);});}function main(_0x426797,_0x5b54bd,_0x3d0e78,_0x31dad9){logger[_0x19dc('0x56')]('main',_0x426797,JSON[_0x19dc('0x6f')](_0x5b54bd));process['send'](_0x19dc('0x70'));var _0x5d52bd=_0x5b54bd[_0x19dc('0x71')];var _0x339200=_[_0x19dc('0x72')](_0x5d52bd);var _0x67da09=_0x5b54bd[_0x19dc('0x73')];var _0x634c23=path[_0x19dc('0x13')](config['root'],'server/files/tmp',_0x67da09+'.csv');hasTZ=_[_0x19dc('0x50')](_0x5d52bd)[_0x19dc('0x74')](_0x19dc('0x6a'));var _0x1da1a7=_[_0x19dc('0x50')](_0x5d52bd)[_0x19dc('0x13')]();logger[_0x19dc('0x56')](_0x19dc('0x75'),_0x1da1a7);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id','name']})[_0x19dc('0x1a')](function(_0xb43c27){for(var _0x576016=0x0;_0x576016<_0xb43c27['length'];_0x576016++){if(_0xb43c27[_0x576016][_0x19dc('0x76')]in _0x5d52bd){contactItemTypes[_0x19dc('0x1c')](_0xb43c27[_0x576016]);delete _0x339200[_0xb43c27[_0x576016][_0x19dc('0x76')]];hasAdditionalPhones=!![];}for(var _0x1ea693 in _0x5d52bd){if(_0xb43c27[_0x576016][_0x19dc('0x76')]+_0x19dc('0x77')===_0x1ea693){phoneDescriptions[_0x19dc('0x1c')]({'itemTypeId':_0xb43c27[_0x576016]['id'],'description':_0x1ea693});delete _0x339200[_0x1ea693];}}}if(hasAdditionalPhones)_0x339200[_0x19dc('0x19')]='';var _0x123c90=_[_0x19dc('0x50')](_0x339200)[_0x19dc('0x13')]();logger[_0x19dc('0x56')]('header',_0x123c90);fs[_0x19dc('0x78')](_0x634c23,_0x123c90+'\x0a');Papa[_0x19dc('0x79')](fs[_0x19dc('0x7a')](_0x426797),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3b56ed,_0x2e902c){try{for(var _0xe873fe=0x0,_0x2336f6=[];_0xe873fe<_0x3b56ed[_0x19dc('0x7b')][_0x19dc('0x1b')];_0xe873fe++){stats[_0x19dc('0x7c')]+=0x1;if(_0x3b56ed[_0x19dc('0x5a')][_0xe873fe]){handleError(_0x3b56ed['data'][_0xe873fe],_0x3b56ed[_0x19dc('0x5a')][_0xe873fe]);}else{var _0xbed637=[];var _0x543368=[];var _0x1c8f69={};for(var _0x15075c in _0x5d52bd){let _0x3f4909=contactItemTypes[_0x19dc('0x7d')](_0xc8f325=>_0xc8f325[_0x19dc('0x76')]===_0x15075c);let _0xe8141f=contactItemTypes[_0x19dc('0x7d')](_0x24a2b9=>_0x24a2b9['name']+_0x19dc('0x77')===_0x15075c);if(_[_0x19dc('0x1f')](_0x3f4909)&&_[_0x19dc('0x1f')](_0xe8141f)){if(_0x5d52bd['hasOwnProperty'](_0x15075c)){if(_0x3b56ed[_0x19dc('0x7b')][_0xe873fe][_0x5d52bd[_0x15075c]]){var _0x357947=_['trim'](_0x3b56ed[_0x19dc('0x7b')][_0xe873fe][_0x5d52bd[_0x15075c]][_0x19dc('0x7e')](/"/g,'\x27'));switch(_0x15075c){case _0x19dc('0x31'):var _0x34aefb=moment(_0x357947,_0x19dc('0xe'),!![]);if(_0x34aefb[_0x19dc('0x7f')]()){_0x2336f6[_0x19dc('0x1c')]('\x22'+_0x357947+'\x22');}else{_0xbed637['push'](_0x19dc('0x80'));}break;case _0x19dc('0x45'):var _0x5c727a=parseInt(_0x357947);_0x357947=_[_0x19dc('0x81')](_0x5c727a)||_0x5c727a<0x0||_0x5c727a>0x4?_0x31dad9?0x3:0x2:_0x5c727a;_0x2336f6[_0x19dc('0x1c')]('\x22'+_0x357947+'\x22');break;case _0x19dc('0x35'):var _0x5da8c0=parseInt(_0x357947);if(_[_0x19dc('0x82')](_0x5da8c0)&&_['includes'](_0x3d0e78,_0x5da8c0)){_0x2336f6['push']('\x22'+_0x5da8c0+'\x22');}else{_0xbed637[_0x19dc('0x1c')]('agent\x20not\x20exists');}break;case _0x19dc('0x83'):if(isEmail(_0x357947)){_0x2336f6[_0x19dc('0x1c')]('\x22'+_0x357947+'\x22');}else{_0xbed637[_0x19dc('0x1c')](_0x19dc('0x84'));}break;case _0x19dc('0x85'):var _0x2709a8=moment(_0x357947,_0x19dc('0x86'),!![]);if(_0x2709a8[_0x19dc('0x7f')]()){_0x2336f6[_0x19dc('0x1c')]('\x22'+_0x357947+'\x22');}else{_0xbed637['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x19dc('0x6a'):var _0x33a0d2=shared[_0x19dc('0x87')];var _0x2f4f7a=_0x33a0d2[_0x357947];if(!_[_0x19dc('0x1f')](_0x2f4f7a)){var _0x59a553=_0x2f4f7a['utcOffset'];_0x2336f6[_0x19dc('0x1c')]('\x22'+_0x357947+'\x22');_0x2336f6[_0x19dc('0x1c')]('\x22'+_0x59a553+'\x22');}break;default:_0x2336f6[_0x19dc('0x1c')]('\x22'+_0x357947+'\x22');}}else{switch(_0x15075c){case _0x19dc('0x88'):case'phone':_0xbed637[_0x19dc('0x1c')](_0x15075c+_0x19dc('0x89'));break;default:_0x2336f6[_0x19dc('0x1c')]('\x22\x22');}}}}else{var _0x43c323='';if(!_['isNil'](_0x3f4909)){if(!_0x1c8f69[_0x19dc('0x8a')](_0x3f4909['id'])){if(!_[_0x19dc('0x1f')](_0x3b56ed[_0x19dc('0x7b')][_0xe873fe][_0x5d52bd[_0x15075c]])){var _0x357947=_[_0x19dc('0x8b')](_0x3b56ed[_0x19dc('0x7b')][_0xe873fe][_0x5d52bd[_0x15075c]][_0x19dc('0x7e')](/"/g,'\x27'));var _0x3100bd=phoneDescriptions[_0x19dc('0x7d')](_0x247c14=>_0x247c14[_0x19dc('0x8c')]===_0x3f4909['id']);if(!_[_0x19dc('0x1f')](_0x3100bd)){var _0x1db3f3=_['trim'](_0x3b56ed[_0x19dc('0x7b')][_0xe873fe][_0x5d52bd[_0x3100bd[_0x19dc('0x8d')]]][_0x19dc('0x7e')](/"/g,'\x27'));if(!_[_0x19dc('0x1f')](_0x1db3f3))_0x357947=_0x357947+'§'+_0x1db3f3;}if(_0x43c323=='')_0x43c323=_0x357947;else _0x43c323+='|'+_0x357947;}_0x543368[_0x19dc('0x1c')](_0x3f4909['id']+':'+_0x43c323);_0x1c8f69[_0x3f4909['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2336f6[_0x19dc('0x1c')]('\x22'+_0x543368[_0x19dc('0x13')](';')+'\x22');}if(_0xbed637[_0x19dc('0x1b')]){handleError(_0x3b56ed[_0x19dc('0x7b')][_0xe873fe],{'code':_0x19dc('0x8e'),'message':_0xbed637[_0x19dc('0x13')]()});}else{fs[_0x19dc('0x8f')](_0x634c23,_0x2336f6[_0x19dc('0x13')]()+'\x0a');}_0x2336f6=[];}if(!(stats[_0x19dc('0x7c')]%0xc8)){socket['emit']('contact:import:'+_0x67da09,stats);stats['errors']=[];}}if(stopped){logger[_0x19dc('0x56')](_0x19dc('0x90'));_0x2e902c['abort']();}}catch(_0x418df6){handleError(_0x3b56ed[_0x19dc('0x7b')][_0xe873fe],{'code':_0x19dc('0x91'),'message':_0x418df6['message']});logger['error'](_0x19dc('0x92'),_0x418df6['message']);}},'complete':function(){try{var _0x535f3b=[];var _0x4e1ae1=[];var _0x3e5a40=_0x19dc('0x38');if(_0x5b54bd[_0x19dc('0x93')]&&_0x5b54bd[_0x19dc('0x93')][_0x19dc('0x1b')]){_0x3e5a40=_0x19dc('0x94')+_0x67da09;_0x535f3b[_0x19dc('0x1c')](_0x19dc('0x95')+_0x3e5a40+_0x19dc('0x96'));}tmp_campaigns=_0x19dc('0x97')+_0x67da09;tmp_voice_queues=_0x19dc('0x98')+_0x67da09;_0x4e1ae1[_0x19dc('0x1c')](_0x19dc('0x95')+tmp_campaigns+_0x19dc('0x99'));_0x4e1ae1[_0x19dc('0x1c')](_0x19dc('0x95')+tmp_voice_queues+_0x19dc('0x99'));BPromise[_0x19dc('0x9a')](_0x4e1ae1,handleTZQuery)[_0x19dc('0x1a')](function(_0x5d8c4a){updateTzCampaigns(_0x5b54bd[_0x19dc('0x33')])[_0x19dc('0x1a')](function(_0x12fd9a){updateTzVoiceQueues(_0x5b54bd[_0x19dc('0x33')])[_0x19dc('0x1a')](function(_0x46e6e5){if(hasTZ)_0x123c90=_0x123c90[_0x19dc('0x7e')](_0x19dc('0x6a'),'dialTimezone,utcOffset');var _0x4ab088=util[_0x19dc('0xd')]('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',_0x634c23,_0x3e5a40,_0x123c90,_0x5b54bd[_0x19dc('0x33')],_0x5b54bd['CompanyId']||null,NOW,NOW);if(_[_0x19dc('0x1f')](_0x5d52bd[_0x19dc('0x31')])){_0x4ab088+=_0x19dc('0x9b');}_0x535f3b['push'](_0x4ab088);if(_0x5b54bd[_0x19dc('0x93')]&&_0x5b54bd['duplicates'][_0x19dc('0x1b')]){_0x535f3b['push'](insertCmContact(_0x5b54bd[_0x19dc('0x33')],_0x3e5a40,_0x5b54bd['duplicates'],_0x5d52bd));_0x535f3b[_0x19dc('0x1c')](_0x19dc('0x9c')+_0x3e5a40+';');}BPromise[_0x19dc('0x9a')](_0x535f3b,handleQuery)[_0x19dc('0x1a')](function(_0x1b76d4){BPromise[_0x19dc('0x1d')]([handleAdditionalPhones()])[_0x19dc('0x1a')](function(){_0x535f3b=[];for(var _0x5551fd=0x0;_0x5551fd\x20\x20','root','existsSync','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x8a9b,0x95));var _0xb8a9=function(_0x232b7c,_0x22ff83){_0x232b7c=_0x232b7c-0x0;var _0x1b44d3=_0x8a9b[_0x232b7c];return _0x1b44d3;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xb8a9('0x0'));var Papa=require(_0xb8a9('0x1'));var util=require('util');var BPromise=require(_0xb8a9('0x2'));var moment=require(_0xb8a9('0x3'));var squel=require(_0xb8a9('0x4'));var Redis=require(_0xb8a9('0x5'));var db=require(_0xb8a9('0x6'))['db'];var config=require('../../../config/environment');var shared=require(_0xb8a9('0x7'));var logger=require('../../../config/logger')(_0xb8a9('0x8'));config[_0xb8a9('0x9')]=_[_0xb8a9('0xa')](config[_0xb8a9('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb8a9('0xb'))(new Redis(config[_0xb8a9('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xb8a9('0xc')](_0xb8a9('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xb8a9('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x45dbee){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))*$/[_0xb8a9('0xe')](_0x45dbee);}function selectNotIn(_0x55fd74,_0x457224,_0x7b9979,_0x4ea158,_0x47e773){return squel[_0xb8a9('0xf')]()['field'](_0xb8a9('0x10'))[_0xb8a9('0x11')](_0x4ea158)[_0xb8a9('0x12')](_0x457224,null,_0x457224+_0xb8a9('0x13')+_0x4ea158+'.'+_0x7b9979)[_0xb8a9('0x14')](_0x4ea158+'.'+_0x7b9979+'\x20=\x20'+_0x55fd74+'.'+_0x7b9979)[_0xb8a9('0x14')](_0x457224+_0xb8a9('0x15')+_0x47e773[_0xb8a9('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x549bf7,_0x22ad3e){promisesAdditionalPhones=[];return db[_0xb8a9('0x16')][_0xb8a9('0x17')]({'raw':!![],'attributes':['id',_0xb8a9('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xb8a9('0x19')](function(_0xc5610a){if(_0xc5610a!==null){var _0x180c75=[];for(var _0x21a366=0x0;_0x21a366<_0xc5610a[_0xb8a9('0x1a')];_0x21a366++){var _0x627da8=_0xc5610a[_0x21a366];_0x180c75[_0xb8a9('0x1b')](insertAdditionalPhones(_0x627da8));}}Promise['all'](_0x180c75)['then'](function(){_0x549bf7({'val':0x1});});});});}function insertAdditionalPhones(_0x26f282){return new Promise(function(_0x284ec7,_0x382312){var _0x252816=_0x26f282[_0xb8a9('0x18')];var _0x10d2ca=_0x252816['split'](';');var _0x1b4bb2=[];orderBy=0x0;for(var _0x1dde37=0x0;_0x1dde37<_0x10d2ca[_0xb8a9('0x1a')];_0x1dde37++){_0x1b4bb2['push'](splitAdditionalPhone(_0x26f282['id'],_0x10d2ca[_0x1dde37]));}Promise[_0xb8a9('0x1c')](_0x1b4bb2)[_0xb8a9('0x19')](function(){_0x284ec7({'val':_0x10d2ca[_0xb8a9('0x1a')]});});});}function splitAdditionalPhone(_0x3b9676,_0x54b027){return new Promise(function(_0xf3a24c,_0x19de74){var _0x12a54b=_0x54b027['split'](':');var _0x1b3c4a=_0x12a54b[0x0];var _0x230e15=_0x12a54b[0x1];if(!_['isNil'](_0x230e15)){var _0x3d2d26=_0x230e15[_0xb8a9('0x1d')]('|');var _0x4575f9=[];for(var _0x3a237f=0x0;_0x3a237f<_0x3d2d26[_0xb8a9('0x1a')];_0x3a237f++){if(_0x3d2d26[_0x3a237f]!==''){var _0x2b99cf=_[_0xb8a9('0x1e')](promisesAdditionalPhones,{'contactId':_0x3b9676,'phone':_0x3d2d26[_0x3a237f]});if(_0x2b99cf[_0xb8a9('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xb8a9('0x1b')]({'contactId':_0x3b9676,'contactTypeId':_0x1b3c4a,'phone':_0x3d2d26[_0x3a237f],'orderBy':orderBy});}}}_0xf3a24c({'ok':0x1});}else _0xf3a24c({'res':0x0});});}function createAdditionalPhone(_0x5529ab,_0x5cd1a6,_0x54ef22,_0x529125){var _0x172312='';var _0x467d2d='';var _0x266d55=_0x54ef22[_0xb8a9('0x1d')]('§');_0x172312=_0x266d55[0x0];if(_0x266d55['length']==0x2)_0x467d2d=_0x266d55[0x1];return new Promise(function(_0x390de2,_0x35b0ea){return db[_0xb8a9('0x1f')][_0xb8a9('0x20')]({'where':{'CmContactId':_0x5529ab,'item':_0x172312}})[_0xb8a9('0x19')](function(_0x475928){if(_0x475928){return db[_0xb8a9('0x1f')][_0xb8a9('0x21')]({'ItemTypeId':_0x5cd1a6,'description':_0x467d2d,'OrderBy':_0x529125},{'where':{'CmContactId':_0x5529ab,'item':_0x172312}})[_0xb8a9('0x19')](function(_0x10a93f){_0x390de2({'res':'updated'});});}else{return db[_0xb8a9('0x1f')][_0xb8a9('0x22')]({'CmContactId':_0x5529ab,'item':_0x172312,'description':_0x467d2d,'ItemTypeId':_0x5cd1a6,'OrderBy':_0x529125,'ItemClass':_0xb8a9('0x23')})[_0xb8a9('0x19')](function(_0x448819){_0x390de2({'res':_0xb8a9('0x24')});});}});});}function insertCmHopper(_0x57c668,_0x5e8422,_0xeda1d2,_0x5dbfe7,_0x5c2e9a){var _0x4db1d3=[_0xb8a9('0x25'),_0xb8a9('0x26'),_0xb8a9('0x27'),_0xb8a9('0x28'),_0x5e8422+'.'+_0x5dbfe7,_0xb8a9('0x29'),_0xb8a9('0x2a'),_0xb8a9('0x2b'),_0xb8a9('0x2c'),'\x22'+_0x5c2e9a+'\x22'];return squel['insert']()[_0xb8a9('0x2d')](_0xb8a9('0x2e'))[_0xb8a9('0x2f')]([_0xb8a9('0x10'),_0xb8a9('0x30'),_0xb8a9('0x31'),'ListId',_0x5dbfe7,_0xb8a9('0x32'),_0xb8a9('0x33'),'priority','UserId',_0xb8a9('0x34')],squel['select']()['fields'](_0x4db1d3)[_0xb8a9('0x11')](_0x5e8422)[_0xb8a9('0x12')](_0xb8a9('0x35'),null,_0xb8a9('0x36')+_0x5e8422+_0xb8a9('0x37'))[_0xb8a9('0x12')](_0xeda1d2,null,_0xeda1d2+_0xb8a9('0x13')+_0x5e8422+'.'+_0x5dbfe7)[_0xb8a9('0x14')](_0x5e8422+_0xb8a9('0x38'),_0x57c668)[_0xb8a9('0x14')](_0xb8a9('0x39'),NOW)['where'](_0xb8a9('0x3a'),selectNotIn(_0x5e8422,_0xeda1d2,_0x5dbfe7,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0xb8a9('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5e8422,_0xeda1d2,_0x5dbfe7,_0xb8a9('0x2e'),[_0xb8a9('0x3b')])))['toString']();}function insertCmHopperBlack(_0x5f2d6e,_0x526962,_0x20285f,_0x27a951){var _0x157f99=['cm_contacts.phone',_0xb8a9('0x27'),_0xb8a9('0x28'),_0x526962+'.'+_0x27a951,_0xb8a9('0x29'),_0xb8a9('0x2a')];return squel[_0xb8a9('0x3c')]()['into'](_0xb8a9('0x3d'))['fromQuery']([_0xb8a9('0x10'),_0xb8a9('0x31'),_0xb8a9('0x3e'),_0x27a951,_0xb8a9('0x32'),_0xb8a9('0x33')],squel[_0xb8a9('0xf')]()[_0xb8a9('0x3f')](_0x157f99)[_0xb8a9('0x11')](_0x526962)[_0xb8a9('0x12')](_0xb8a9('0x35'),null,_0xb8a9('0x36')+_0x526962+_0xb8a9('0x37'))[_0xb8a9('0x12')](_0x20285f,null,_0x20285f+_0xb8a9('0x13')+_0x526962+'.'+_0x27a951)[_0xb8a9('0x14')](_0x526962+_0xb8a9('0x38'),_0x5f2d6e)[_0xb8a9('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb8a9('0x14')](_0xb8a9('0x3a'),squel[_0xb8a9('0xf')]()[_0xb8a9('0x40')](_0xb8a9('0x10'))[_0xb8a9('0x11')]('cm_hopper_black')['where'](_0xb8a9('0x41'),_0x5f2d6e)[_0xb8a9('0x14')](_0x27a951+_0xb8a9('0x42')+_0x526962+'.'+_0x27a951)))[_0xb8a9('0x43')]();}function insertTzCmHopper(_0xc7d981,_0x2661c5,_0x57e04a,_0x57c9aa,_0x585c65,_0x92459c){var _0x4164e5=[_0xb8a9('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x92459c+_0xb8a9('0x44'),_0xb8a9('0x27'),_0xb8a9('0x28'),_0x2661c5+'.'+_0x57c9aa,_0xb8a9('0x29'),'cm_contacts.updatedAt','cm_contacts.priority',_0xb8a9('0x2c'),'\x22'+_0x585c65+'\x22'];var _0x323ba3=squel[_0xb8a9('0x3c')]()[_0xb8a9('0x2d')]('cm_hopper')[_0xb8a9('0x2f')]([_0xb8a9('0x10'),'scheduledat',_0xb8a9('0x31'),_0xb8a9('0x3e'),_0x57c9aa,'createdAt','updatedAt','priority',_0xb8a9('0x45'),_0xb8a9('0x34')],squel[_0xb8a9('0xf')]()['fields'](_0x4164e5)[_0xb8a9('0x11')](_0x2661c5)[_0xb8a9('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x2661c5+_0xb8a9('0x37'))[_0xb8a9('0x12')](_0x57e04a,null,_0x57e04a+_0xb8a9('0x13')+_0x2661c5+'.'+_0x57c9aa)[_0xb8a9('0x12')](_0x92459c,null,_0x92459c+_0xb8a9('0x13')+_0x2661c5+'.'+_0x57c9aa)['where'](_0x2661c5+_0xb8a9('0x38'),_0xc7d981)[_0xb8a9('0x14')](_0xb8a9('0x39'),NOW)[_0xb8a9('0x14')](_0xb8a9('0x3a'),selectNotIn(_0x2661c5,_0x57e04a,_0x57c9aa,_0xb8a9('0x2e'),[_0xb8a9('0x3b'),_0xb8a9('0x46')]))[_0xb8a9('0x14')](_0xb8a9('0x3a'),selectNotIn(_0x2661c5,_0x57e04a,_0x57c9aa,_0xb8a9('0x2e'),[_0xb8a9('0x3b')])))[_0xb8a9('0x43')]();return _0x323ba3;}function insertTzCmHopperBlack(_0x458379,_0x39d02b,_0xe75beb,_0x4e0a1a){var _0x2b7df1=[_0xb8a9('0x25'),'cm_contacts.id',_0xb8a9('0x28'),_0x39d02b+'.'+_0x4e0a1a,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel['insert']()[_0xb8a9('0x2d')](_0xb8a9('0x3d'))[_0xb8a9('0x2f')](['phone',_0xb8a9('0x31'),_0xb8a9('0x3e'),_0x4e0a1a,_0xb8a9('0x32'),_0xb8a9('0x33')],squel[_0xb8a9('0xf')]()['fields'](_0x2b7df1)[_0xb8a9('0x11')](_0x39d02b)[_0xb8a9('0x12')](_0xb8a9('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x39d02b+_0xb8a9('0x37'))[_0xb8a9('0x12')](_0xe75beb,null,_0xe75beb+'.id\x20=\x20'+_0x39d02b+'.'+_0x4e0a1a)['where'](_0x39d02b+'.CmListId\x20=\x20?',_0x458379)[_0xb8a9('0x14')](_0xb8a9('0x39'),NOW)[_0xb8a9('0x14')](_0xb8a9('0x3a'),squel[_0xb8a9('0xf')]()[_0xb8a9('0x40')](_0xb8a9('0x10'))[_0xb8a9('0x11')](_0xb8a9('0x3d'))[_0xb8a9('0x14')](_0xb8a9('0x41'),_0x458379)[_0xb8a9('0x14')](_0x4e0a1a+'\x20=\x20'+_0x39d02b+'.'+_0x4e0a1a)))['toString']();}function insertCmHopperAdditionalPhones(_0x43f338){var _0x269134=[_0xb8a9('0x47'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0xb8a9('0x48'),_0xb8a9('0x49')];return squel['insert']()['into']('cm_hopper_additional_phones')[_0xb8a9('0x2f')]([_0xb8a9('0x4a'),_0xb8a9('0x10'),_0xb8a9('0x4b'),_0xb8a9('0x32'),_0xb8a9('0x33')],squel[_0xb8a9('0xf')]()[_0xb8a9('0x3f')](_0x269134)[_0xb8a9('0x11')](_0xb8a9('0x2e'))[_0xb8a9('0x12')](_0xb8a9('0x35'),null,_0xb8a9('0x4c'))[_0xb8a9('0x12')](_0xb8a9('0x4d'),null,_0xb8a9('0x4e'))['where'](_0xb8a9('0x4f'),_0x43f338)[_0xb8a9('0x14')](_0xb8a9('0x39'),NOW))[_0xb8a9('0x43')]();}function insertCmContact(_0x2c5a33,_0xee1cba,_0x79bb9,_0x11fd93){var _0x3bdc26=_[_0xb8a9('0x50')](_[_0xb8a9('0x51')](_0x11fd93),[_0xb8a9('0x3e'),_0xb8a9('0x52'),_0xb8a9('0x32'),_0xb8a9('0x33'),'scheduledAt']);return squel[_0xb8a9('0x3c')]()['into'](_0xb8a9('0x35'))['fromQuery'](_0x3bdc26,squel[_0xb8a9('0xf')]()[_0xb8a9('0x3f')](_0x3bdc26)['from'](_0xee1cba)['where']('('+_0x79bb9['join'](',')+_0xb8a9('0x53'),squel[_0xb8a9('0xf')]()[_0xb8a9('0x3f')](_0x79bb9)[_0xb8a9('0x11')]('cm_contacts')['where'](_0xb8a9('0x41'),_0x2c5a33)[_0xb8a9('0x14')](_0xb8a9('0x54')))[_0xb8a9('0x14')]('id\x20IN\x20?',squel[_0xb8a9('0xf')]()[_0xb8a9('0x40')](_0xb8a9('0x55'),'min_id')[_0xb8a9('0x11')](_0xee1cba)[_0xb8a9('0x56')](_0x79bb9[_0xb8a9('0x12')](','))))[_0xb8a9('0x43')]();}function handleStop(){logger[_0xb8a9('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5f033c){logger[_0xb8a9('0x58')](_0x5f033c[_0xb8a9('0x59')]);process[_0xb8a9('0x5a')](0x1);}function handleError(_0x451b06,_0x12d547){stats[_0xb8a9('0x5b')][_0xb8a9('0x1b')]({'name':_0x12d547[_0xb8a9('0x5c')],'message':_0x12d547['message'],'row':_0x451b06});}function handleQuery(_0x48e5e1){logger[_0xb8a9('0x57')](_0x48e5e1);return db[_0xb8a9('0x5d')][_0xb8a9('0x5e')](_0x48e5e1)[_0xb8a9('0x5f')](function(_0x2fa45f){results[_0xb8a9('0x1b')](_0x2fa45f);})[_0xb8a9('0x60')](function(_0x27b3a7){logger['error'](_0x27b3a7['message']);});}function updateTzCampaigns(_0x46f1cd){return new Promise(function(_0x1d5983,_0x581403){var _0xe3b3b4=squel[_0xb8a9('0xf')]()[_0xb8a9('0x3f')]([_0xb8a9('0x61'),_0xb8a9('0x62')])['from']('campaigns')[_0xb8a9('0x12')](_0xb8a9('0x63'),null,_0xb8a9('0x64'))[_0xb8a9('0x14')](_0xb8a9('0x65')+_0x46f1cd);db[_0xb8a9('0x5d')][_0xb8a9('0x5e')](_0xe3b3b4[_0xb8a9('0x43')]())[_0xb8a9('0x5f')](function(_0x9e3ba){var _0x4222e6=[];for(var _0x4e94b2=0x0;_0x4e94b2<_0x9e3ba['length'];_0x4e94b2++){_0x4222e6[_0xb8a9('0x1b')](getTimezoneData(_0x9e3ba[_0x4e94b2],tmp_campaigns));}BPromise[_0xb8a9('0x1c')](_0x4222e6)[_0xb8a9('0x19')](function(){_0x1d5983({'val':0x1});});})['catch'](function(_0x38a76f){logger[_0xb8a9('0x58')](_0x38a76f['message']);_0x1d5983({'val':0x0});});});}function updateTzVoiceQueues(_0x2a4cbf){return new Promise(function(_0x37673e,_0x1c0130){var _0x17a6be=squel[_0xb8a9('0xf')]()['fields'](['voice_queues.id','voice_queues.dialTimezone'])[_0xb8a9('0x11')](_0xb8a9('0x66'))[_0xb8a9('0x12')]('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0xb8a9('0x67')+_0x2a4cbf);db['sequelize'][_0xb8a9('0x5e')](_0x17a6be[_0xb8a9('0x43')]())[_0xb8a9('0x5f')](function(_0x46a5d1){var _0x5948e6=[];for(var _0x5a1cf2=0x0;_0x5a1cf2<_0x46a5d1['length'];_0x5a1cf2++){_0x5948e6['push'](getTimezoneData(_0x46a5d1[_0x5a1cf2],tmp_voice_queues));}BPromise['all'](_0x5948e6)[_0xb8a9('0x19')](function(){_0x37673e({'val':0x1});});})[_0xb8a9('0x60')](function(_0x39c8af){logger['error'](_0x39c8af['message']);_0x37673e({'val':0x0});});});}function getTimezoneData(_0x1e8323,_0x152076){return new Promise(function(_0x18ee9d,_0x797e1b){var _0x51122b=shared[_0xb8a9('0x68')];var _0x383972=_0x51122b[_0x1e8323[_0xb8a9('0x69')]];if(_[_0xb8a9('0x6a')](_0x383972)){_0x18ee9d({'ret':0x1});}else{var _0x1044fa=_0x383972[_0xb8a9('0x6b')];var _0x576eca=squel['insert']()['into'](_0x152076)['set']('id',_0x1e8323['id'])['set'](_0xb8a9('0x6c'),_0x1044fa)[_0xb8a9('0x6d')]('dialTimezone',_0x1e8323['dialTimezone'])[_0xb8a9('0x43')]();return db['sequelize'][_0xb8a9('0x5e')](_0x576eca)[_0xb8a9('0x5f')](function(_0x55015f){_0x18ee9d({'ret':0x1});})[_0xb8a9('0x60')](function(_0x37f486){logger['error'](_0x37f486[_0xb8a9('0x59')]);_0x797e1b({'ret':0x1});});}});}function handleTZQuery(_0x353a17){logger[_0xb8a9('0x57')](_0x353a17);return db[_0xb8a9('0x5d')][_0xb8a9('0x5e')](_0x353a17)[_0xb8a9('0x5f')](function(_0x726927){})[_0xb8a9('0x60')](function(_0x1a4cc5){logger['error'](_0x1a4cc5[_0xb8a9('0x59')]);});}function main(_0x1817c0,_0x2a4fe0,_0x12f557,_0x5ed433){logger[_0xb8a9('0x57')](_0xb8a9('0x6e'),_0x1817c0,JSON[_0xb8a9('0x6f')](_0x2a4fe0));process[_0xb8a9('0x70')]('start');var _0x799de2=_0x2a4fe0[_0xb8a9('0x71')];var _0x4a0bda=_['clone'](_0x799de2);var _0x17e17b=_0x2a4fe0[_0xb8a9('0x72')];var _0x1c72e0=path[_0xb8a9('0x12')](config['root'],_0xb8a9('0x73'),_0x17e17b+_0xb8a9('0x74'));hasTZ=_[_0xb8a9('0x51')](_0x799de2)[_0xb8a9('0x75')](_0xb8a9('0x69'));var _0x242be0=_['keys'](_0x799de2)[_0xb8a9('0x12')]();logger[_0xb8a9('0x57')](_0xb8a9('0x76'),_0x242be0);db[_0xb8a9('0x77')]['findAll']({'raw':!![],'attributes':['id',_0xb8a9('0x78')]})[_0xb8a9('0x19')](function(_0x4f7ea4){for(var _0x234118=0x0;_0x234118<_0x4f7ea4[_0xb8a9('0x1a')];_0x234118++){if(_0x4f7ea4[_0x234118][_0xb8a9('0x78')]in _0x799de2){contactItemTypes['push'](_0x4f7ea4[_0x234118]);delete _0x4a0bda[_0x4f7ea4[_0x234118][_0xb8a9('0x78')]];hasAdditionalPhones=!![];}for(var _0x46ba42 in _0x799de2){if(_0x4f7ea4[_0x234118][_0xb8a9('0x78')]+_0xb8a9('0x79')===_0x46ba42){phoneDescriptions['push']({'itemTypeId':_0x4f7ea4[_0x234118]['id'],'description':_0x46ba42});delete _0x4a0bda[_0x46ba42];}}}if(hasAdditionalPhones)_0x4a0bda['AdditionalPhones']='';var _0x3ff926=_['keys'](_0x4a0bda)[_0xb8a9('0x12')]();logger[_0xb8a9('0x57')]('header',_0x3ff926);fs[_0xb8a9('0x7a')](_0x1c72e0,_0x3ff926+'\x0a');Papa[_0xb8a9('0x7b')](fs['createReadStream'](_0x1817c0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x49e8ed,_0x200ca9){try{for(var _0x511d12=0x0,_0x116915=[];_0x511d12<_0x49e8ed['data']['length'];_0x511d12++){stats['rows']+=0x1;if(_0x49e8ed[_0xb8a9('0x5b')][_0x511d12]){handleError(_0x49e8ed[_0xb8a9('0x7c')][_0x511d12],_0x49e8ed[_0xb8a9('0x5b')][_0x511d12]);}else{var _0x2b55ee=[];var _0xe058ac=[];var _0x32a2ad={};for(var _0x11a313 in _0x799de2){let _0x260fca=contactItemTypes[_0xb8a9('0x7d')](_0x7d7b5f=>_0x7d7b5f[_0xb8a9('0x78')]===_0x11a313);let _0x1389d8=contactItemTypes[_0xb8a9('0x7d')](_0x24aaae=>_0x24aaae[_0xb8a9('0x78')]+_0xb8a9('0x79')===_0x11a313);if(_[_0xb8a9('0x6a')](_0x260fca)&&_[_0xb8a9('0x6a')](_0x1389d8)){if(_0x799de2['hasOwnProperty'](_0x11a313)){if(_0x49e8ed[_0xb8a9('0x7c')][_0x511d12][_0x799de2[_0x11a313]]){var _0x27e39b=_['trim'](_0x49e8ed['data'][_0x511d12][_0x799de2[_0x11a313]][_0xb8a9('0x7e')](/"/g,'\x27'));switch(_0x11a313){case _0xb8a9('0x30'):var _0x396924=moment(_0x27e39b,_0xb8a9('0xd'),!![]);if(_0x396924['isValid']()){_0x116915[_0xb8a9('0x1b')]('\x22'+_0x27e39b+'\x22');}else{_0x2b55ee['push'](_0xb8a9('0x7f'));}break;case _0xb8a9('0x80'):var _0x3f0776=parseInt(_0x27e39b);_0x27e39b=_[_0xb8a9('0x81')](_0x3f0776)||_0x3f0776<0x0||_0x3f0776>0x4?_0x5ed433?0x3:0x2:_0x3f0776;_0x116915[_0xb8a9('0x1b')]('\x22'+_0x27e39b+'\x22');break;case _0xb8a9('0x45'):var _0x567b08=parseInt(_0x27e39b);if(_['isNumber'](_0x567b08)&&_[_0xb8a9('0x75')](_0x12f557,_0x567b08)){_0x116915[_0xb8a9('0x1b')]('\x22'+_0x567b08+'\x22');}else{_0x2b55ee[_0xb8a9('0x1b')](_0xb8a9('0x82'));}break;case'email':if(isEmail(_0x27e39b)){_0x116915['push']('\x22'+_0x27e39b+'\x22');}else{_0x2b55ee[_0xb8a9('0x1b')]('email\x20wrong\x20format');}break;case _0xb8a9('0x83'):var _0x1d4951=moment(_0x27e39b,_0xb8a9('0x84'),!![]);if(_0x1d4951[_0xb8a9('0x85')]()){_0x116915[_0xb8a9('0x1b')]('\x22'+_0x27e39b+'\x22');}else{_0x2b55ee['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xb8a9('0x69'):var _0x2fd831=shared[_0xb8a9('0x68')];var _0x29a648=_0x2fd831[_0x27e39b];if(!_[_0xb8a9('0x6a')](_0x29a648)){var _0x2970c1=_0x29a648['utcOffset'];_0x116915['push']('\x22'+_0x27e39b+'\x22');_0x116915['push']('\x22'+_0x2970c1+'\x22');}break;default:_0x116915[_0xb8a9('0x1b')]('\x22'+_0x27e39b+'\x22');}}else{switch(_0x11a313){case _0xb8a9('0x86'):case _0xb8a9('0x10'):_0x2b55ee[_0xb8a9('0x1b')](_0x11a313+_0xb8a9('0x87'));break;default:_0x116915['push']('\x22\x22');}}}}else{var _0xa59f5f='';if(!_['isNil'](_0x260fca)){if(!_0x32a2ad[_0xb8a9('0x88')](_0x260fca['id'])){if(!_[_0xb8a9('0x6a')](_0x49e8ed[_0xb8a9('0x7c')][_0x511d12][_0x799de2[_0x11a313]])){var _0x27e39b=_['trim'](_0x49e8ed[_0xb8a9('0x7c')][_0x511d12][_0x799de2[_0x11a313]][_0xb8a9('0x7e')](/"/g,'\x27'));var _0x59191f=phoneDescriptions[_0xb8a9('0x7d')](_0x883083=>_0x883083[_0xb8a9('0x89')]===_0x260fca['id']);if(!_['isNil'](_0x59191f)){var _0x78b21b=_['trim'](_0x49e8ed[_0xb8a9('0x7c')][_0x511d12][_0x799de2[_0x59191f[_0xb8a9('0x8a')]]]['replace'](/"/g,'\x27'));if(!_[_0xb8a9('0x6a')](_0x78b21b))_0x27e39b=_0x27e39b+'§'+_0x78b21b;}if(_0xa59f5f=='')_0xa59f5f=_0x27e39b;else _0xa59f5f+='|'+_0x27e39b;}_0xe058ac['push'](_0x260fca['id']+':'+_0xa59f5f);_0x32a2ad[_0x260fca['id']]=0x1;}}}}if(hasAdditionalPhones){_0x116915['push']('\x22'+_0xe058ac[_0xb8a9('0x12')](';')+'\x22');}if(_0x2b55ee[_0xb8a9('0x1a')]){handleError(_0x49e8ed['data'][_0x511d12],{'code':_0xb8a9('0x8b'),'message':_0x2b55ee[_0xb8a9('0x12')]()});}else{fs['appendFileSync'](_0x1c72e0,_0x116915[_0xb8a9('0x12')]()+'\x0a');}_0x116915=[];}if(!(stats[_0xb8a9('0x8c')]%0xc8)){socket[_0xb8a9('0x8d')]('contact:import:'+_0x17e17b,stats);stats[_0xb8a9('0x5b')]=[];}}if(stopped){logger[_0xb8a9('0x57')]('Abort\x20parser');_0x200ca9[_0xb8a9('0x8e')]();}}catch(_0x4f8e07){handleError(_0x49e8ed['data'][_0x511d12],{'code':_0xb8a9('0x8f'),'message':_0x4f8e07[_0xb8a9('0x59')]});logger[_0xb8a9('0x58')]('step',_0x4f8e07['message']);}},'complete':function(){try{var _0x2cb535=[];var _0x176251=[];var _0x4680b6='cm_contacts';if(_0x2a4fe0[_0xb8a9('0x90')]&&_0x2a4fe0['duplicates'][_0xb8a9('0x1a')]){_0x4680b6=_0xb8a9('0x91')+_0x17e17b;_0x2cb535[_0xb8a9('0x1b')](_0xb8a9('0x92')+_0x4680b6+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x17e17b;tmp_voice_queues='voice_queues_'+_0x17e17b;_0x176251['push'](_0xb8a9('0x92')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x176251['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xb8a9('0x93'));BPromise[_0xb8a9('0x94')](_0x176251,handleTZQuery)[_0xb8a9('0x19')](function(_0x49b907){updateTzCampaigns(_0x2a4fe0['ListId'])[_0xb8a9('0x19')](function(_0x3def9a){updateTzVoiceQueues(_0x2a4fe0['ListId'])[_0xb8a9('0x19')](function(_0x5dac2c){if(hasTZ)_0x3ff926=_0x3ff926[_0xb8a9('0x7e')](_0xb8a9('0x69'),_0xb8a9('0x95'));var _0x35d01e=util['format'](_0xb8a9('0x96'),_0x1c72e0,_0x4680b6,_0x3ff926,_0x2a4fe0[_0xb8a9('0x3e')],_0x2a4fe0['CompanyId']||null,NOW,NOW);if(_[_0xb8a9('0x6a')](_0x799de2['scheduledat'])){_0x35d01e+=',\x20scheduledAt\x20=\x20NOW()';}_0x2cb535['push'](_0x35d01e);if(_0x2a4fe0['duplicates']&&_0x2a4fe0[_0xb8a9('0x90')][_0xb8a9('0x1a')]){_0x2cb535[_0xb8a9('0x1b')](insertCmContact(_0x2a4fe0[_0xb8a9('0x3e')],_0x4680b6,_0x2a4fe0['duplicates'],_0x799de2));_0x2cb535[_0xb8a9('0x1b')](_0xb8a9('0x97')+_0x4680b6+';');}BPromise[_0xb8a9('0x94')](_0x2cb535,handleQuery)['then'](function(_0xb672bd){BPromise[_0xb8a9('0x1c')]([handleAdditionalPhones()])[_0xb8a9('0x19')](function(){_0x2cb535=[];for(var _0x24b65c=0x0;_0x24b65c\x20\x20','root','existsSync','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','path','lodash','squel','ioredis','import','localhost','redis','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','catch','error','message','split','then','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','into','cm_hopper','phone','scheduledat','ListId','updatedAt','priority','UserId','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','insert','cm_hopper_black','fromQuery','fields','.CmListId','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','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?','toString','concat','keys','CompanyId','createdAt',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','code','sequelize','query','stringify','start','binding','clone','socket_timestamp','server/files/tmp','ContactItemType','findAll','name','_description','header','rows','data','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','appendFileSync','emit','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','CIS\x20len','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','each','contact','orderBy'];(function(_0x7962f3,_0x3e996d){var _0x42af33=function(_0x1285f4){while(--_0x1285f4){_0x7962f3['push'](_0x7962f3['shift']());}};_0x42af33(++_0x3e996d);}(_0x4cd3,0x1ca));var _0x34cd=function(_0x3ead55,_0x22bc51){_0x3ead55=_0x3ead55-0x0;var _0x3ea16d=_0x4cd3[_0x3ead55];return _0x3ea16d;};'use strict';var fs=require('fs');var path=require(_0x34cd('0x0'));var _=require(_0x34cd('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x34cd('0x2'));var Redis=require(_0x34cd('0x3'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x34cd('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0x34cd('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x34cd('0x6')]));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()[_0x34cd('0x7')](_0x34cd('0x8'));var tempTableName='cm_contacts_temp_'+moment()[_0x34cd('0x7')](_0x34cd('0x9'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xf91b0c){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))*$/[_0x34cd('0xa')](_0xf91b0c);}function selectNotIn(_0x306a76,_0x2b9e6c,_0x3858c2,_0x1d08c7,_0xf71977){return squel[_0x34cd('0xb')]()[_0x34cd('0xc')]('phone')[_0x34cd('0xd')](_0x1d08c7)[_0x34cd('0xe')](_0x2b9e6c,null,_0x2b9e6c+_0x34cd('0xf')+_0x1d08c7+'.'+_0x3858c2)[_0x34cd('0x10')](_0x1d08c7+'.'+_0x3858c2+_0x34cd('0x11')+_0x306a76+'.'+_0x3858c2)[_0x34cd('0x10')](_0x2b9e6c+_0x34cd('0x12')+_0xf71977['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2881ba,_0x29db1f){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize']['query'](_0x34cd('0x13')+tempTableName)[_0x34cd('0x14')](function(_0x471982){if(_0x471982!==null){var _0x1e73a5=[];for(var _0x571a28=0x0;_0x571a28<_0x471982[_0x34cd('0x15')];_0x571a28++){var _0xea8261=_0x471982[_0x571a28];if(!_[_0x34cd('0x16')](_0xea8261['phone'])){if(!_['isNil'](_0xea8261[_0x34cd('0x17')]))_0x1e73a5[_0x34cd('0x18')](insertAdditionalPhones(_0xea8261));promisesContact[_0x34cd('0x18')]({'contact':_0xea8261});}}}Promise[_0x34cd('0x19')](_0x1e73a5)['then'](function(){_0x2881ba({'val':0x1});});})[_0x34cd('0x1a')](function(_0xfebf8f){logger[_0x34cd('0x1b')](_0xfebf8f[_0x34cd('0x1c')]);});});}function insertAdditionalPhones(_0x37ba94){return new Promise(function(_0x2ada47,_0x435a24){var _0x395a3c=_0x37ba94[_0x34cd('0x17')];if(_[_0x34cd('0x16')](_0x395a3c))_0x435a24({'val':0x0});else{var _0x1bd1f9=_0x395a3c[_0x34cd('0x1d')](';');var _0x1276aa=[];orderBy=0x0;for(var _0x127169=0x0;_0x127169<_0x1bd1f9[_0x34cd('0x15')];_0x127169++){_0x1276aa[_0x34cd('0x18')](splitAdditionalPhone(_0x37ba94['id'],_0x1bd1f9[_0x127169]));}Promise['all'](_0x1276aa)[_0x34cd('0x1e')](function(){_0x2ada47({'val':_0x1bd1f9[_0x34cd('0x15')]});});}});}function splitAdditionalPhone(_0x4cbf48,_0x5165da){return new Promise(function(_0x2f4396,_0x4b2363){var _0x2e960e=_0x5165da[_0x34cd('0x1d')](':');var _0x45f63f=_0x2e960e[0x0];var _0x43eb88=_0x2e960e[0x1];if(_0x43eb88!==''){var _0x1338e9=_0x43eb88['split']('|');var _0x3a37ed=[];for(var _0x1a580d=0x0;_0x1a580d<_0x1338e9[_0x34cd('0x15')];_0x1a580d++){if(_0x1338e9[_0x1a580d]!==''){var _0x239d54=_[_0x34cd('0x1f')](promisesAdditionalPhones,{'contactId':_0x4cbf48,'phone':_0x1338e9[_0x1a580d]});if(_0x239d54[_0x34cd('0x15')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x4cbf48,'contactTypeId':_0x45f63f,'phone':_0x1338e9[_0x1a580d],'orderBy':orderBy});}}}_0x2f4396({'ok':0x1});}else _0x2f4396({'res':0x0});});}function createAdditionalPhone(_0x8186e5,_0x4566e2,_0x1904b6,_0x2f5b26){var _0x15a8e7='';var _0x2bca91='';var _0xfd718c=_0x1904b6[_0x34cd('0x1d')]('§');_0x15a8e7=_0xfd718c[0x0];if(_0xfd718c[_0x34cd('0x15')]==0x2)_0x2bca91=_0xfd718c[0x1];return new Promise(function(_0x178484,_0x3316b0){return db[_0x34cd('0x20')][_0x34cd('0x21')]({'where':{'CmContactId':_0x8186e5,'item':_0x15a8e7}})['then'](function(_0x1c5dd0){if(_0x1c5dd0){return db[_0x34cd('0x20')][_0x34cd('0x22')]({'ItemTypeId':_0x4566e2,'description':_0x2bca91,'OrderBy':_0x2f5b26},{'where':{'CmContactId':_0x8186e5,'item':_0x15a8e7}})[_0x34cd('0x1e')](function(_0x1dbee5){_0x178484({'res':'updated'});});}else{return db[_0x34cd('0x20')][_0x34cd('0x23')]({'CmContactId':_0x8186e5,'item':_0x15a8e7,'ItemTypeId':_0x4566e2,'description':_0x2bca91,'OrderBy':_0x2f5b26,'ItemClass':_0x34cd('0x24')})[_0x34cd('0x1e')](function(_0x238678){_0x178484({'res':_0x34cd('0x25')});});}});});}function updateContact(_0x192ddb){return new Promise(function(_0x18e05b,_0x10e056){var _0x5a225d=_0x192ddb['id'];delete _0x192ddb['id'];return db['CmContact'][_0x34cd('0x22')](_0x192ddb,{'where':{'id':_0x5a225d}})[_0x34cd('0x1e')](function(_0x6b15d6){updatedRows+=0x1;return db[_0x34cd('0x26')][_0x34cd('0x22')]({'phone':_0x192ddb['phone']},{'where':{'ContactId':_0x5a225d}})['then'](function(_0x3b0c28){_0x18e05b({'ret':'OK'});});});});}function insertCmHopper(_0x271cb9,_0x214437,_0x51464d,_0x155ca8,_0xf1d437){var _0x25e32e=[_0x34cd('0x27'),_0x34cd('0x28'),_0x34cd('0x29'),_0x34cd('0x2a'),_0x214437+'.'+_0x155ca8,_0x34cd('0x2b'),_0x34cd('0x2c'),'cm_contacts.priority',_0x34cd('0x2d'),'\x22'+_0xf1d437+'\x22'];return squel['insert']()[_0x34cd('0x2e')](_0x34cd('0x2f'))['fromQuery']([_0x34cd('0x30'),_0x34cd('0x31'),'ContactId',_0x34cd('0x32'),_0x155ca8,'createdAt',_0x34cd('0x33'),_0x34cd('0x34'),_0x34cd('0x35'),'recallme'],squel['select']()['fields'](_0x25e32e)[_0x34cd('0xd')](_0x214437)[_0x34cd('0xe')](_0x34cd('0x36'),null,_0x34cd('0x37')+_0x214437+'.CmListId')[_0x34cd('0xe')](_0x51464d,null,_0x51464d+_0x34cd('0xf')+_0x214437+'.'+_0x155ca8)[_0x34cd('0x10')](_0x214437+_0x34cd('0x38'),_0x271cb9)['where'](_0x34cd('0x39'),NOW)[_0x34cd('0x10')](_0x34cd('0x3a'),selectNotIn(_0x214437,_0x51464d,_0x155ca8,_0x34cd('0x2f'),[_0x34cd('0x3b'),_0x34cd('0x3c')]))[_0x34cd('0x10')](_0x34cd('0x3a'),selectNotIn(_0x214437,_0x51464d,_0x155ca8,_0x34cd('0x2f'),[_0x34cd('0x3b')])))['toString']();}function insertCmHopperBlack(_0x3f852b,_0x9629e4,_0x31f8c5,_0x5d387b){var _0x128938=[_0x34cd('0x27'),_0x34cd('0x29'),'cm_contacts.ListId',_0x9629e4+'.'+_0x5d387b,_0x34cd('0x2b'),_0x34cd('0x2c')];return squel[_0x34cd('0x3d')]()[_0x34cd('0x2e')](_0x34cd('0x3e'))[_0x34cd('0x3f')]([_0x34cd('0x30'),'ContactId',_0x34cd('0x32'),_0x5d387b,'createdAt',_0x34cd('0x33')],squel[_0x34cd('0xb')]()[_0x34cd('0x40')](_0x128938)[_0x34cd('0xd')](_0x9629e4)[_0x34cd('0xe')]('cm_contacts',null,_0x34cd('0x37')+_0x9629e4+_0x34cd('0x41'))[_0x34cd('0xe')](_0x31f8c5,null,_0x31f8c5+_0x34cd('0xf')+_0x9629e4+'.'+_0x5d387b)[_0x34cd('0x10')](_0x9629e4+_0x34cd('0x38'),_0x3f852b)[_0x34cd('0x10')](_0x34cd('0x39'),NOW)[_0x34cd('0x10')](_0x34cd('0x3a'),squel[_0x34cd('0xb')]()[_0x34cd('0xc')](_0x34cd('0x30'))[_0x34cd('0xd')](_0x34cd('0x3e'))['where'](_0x34cd('0x42'),_0x3f852b)[_0x34cd('0x10')](_0x5d387b+_0x34cd('0x43'),_0x9629e4+'.'+_0x5d387b)))['toString']();}function insertCmHopperAdditionalPhones(_0x57b196){var _0xb15687=[_0x34cd('0x44'),'cm_contact_has_items.item',_0x34cd('0x45'),_0x34cd('0x46'),_0x34cd('0x47')];return squel['insert']()[_0x34cd('0x2e')](_0x34cd('0x48'))[_0x34cd('0x3f')]([_0x34cd('0x49'),_0x34cd('0x30'),'OrderBy','createdAt',_0x34cd('0x33')],squel[_0x34cd('0xb')]()[_0x34cd('0x40')](_0xb15687)['from'](_0x34cd('0x2f'))[_0x34cd('0xe')](_0x34cd('0x36'),null,_0x34cd('0x4a'))[_0x34cd('0xe')](_0x34cd('0x4b'),null,_0x34cd('0x4c'))[_0x34cd('0x10')](_0x34cd('0x4d'),_0x57b196)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x34cd('0x4e')]();}function insertCmContact(_0x353caf,_0x52410d,_0x446975,_0x2d27df){var _0x3283fe=_[_0x34cd('0x4f')](_[_0x34cd('0x50')](_0x2d27df),[_0x34cd('0x32'),_0x34cd('0x51'),_0x34cd('0x52'),_0x34cd('0x33')]);return squel[_0x34cd('0x3d')]()[_0x34cd('0x2e')](_0x34cd('0x36'))[_0x34cd('0x3f')](_0x3283fe,squel[_0x34cd('0xb')]()['fields'](_0x3283fe)[_0x34cd('0xd')](_0x52410d)[_0x34cd('0x10')]('('+_0x446975['join'](',')+_0x34cd('0x53'),squel[_0x34cd('0xb')]()[_0x34cd('0x40')](_0x446975)[_0x34cd('0xd')](_0x34cd('0x36'))[_0x34cd('0x10')]('ListId\x20=\x20?',_0x353caf))[_0x34cd('0x10')]('id\x20IN\x20?',squel[_0x34cd('0xb')]()[_0x34cd('0xc')](_0x34cd('0x54'),_0x34cd('0x55'))[_0x34cd('0xd')](_0x52410d)[_0x34cd('0x56')](_0x446975[_0x34cd('0xe')](','))))[_0x34cd('0x4e')]();}function handleStop(){logger[_0x34cd('0x57')](_0x34cd('0x58'));stopped=!![];}function handleUncaughtException(_0x5d28b3){logger[_0x34cd('0x1b')](_0x5d28b3[_0x34cd('0x1c')]);process[_0x34cd('0x59')](0x1);}function handleError(_0x4bc687,_0xf52a17){stats[_0x34cd('0x5a')][_0x34cd('0x18')]({'name':_0xf52a17[_0x34cd('0x5b')],'message':_0xf52a17[_0x34cd('0x1c')],'row':_0x4bc687});}function handleQuery(_0x48efc0){logger[_0x34cd('0x57')](_0x48efc0);return db[_0x34cd('0x5c')][_0x34cd('0x5d')](_0x48efc0)[_0x34cd('0x14')](function(_0x1369b7){results[_0x34cd('0x18')](_0x1369b7);})['catch'](function(_0x367304){logger[_0x34cd('0x1b')](_0x367304[_0x34cd('0x1c')]);});}function main(_0x4f196a,_0x343582,_0x1ef52b,_0xca5e15){logger[_0x34cd('0x57')]('main',_0x4f196a,JSON[_0x34cd('0x5e')](_0x343582));process['send'](_0x34cd('0x5f'));var _0x13c4a2=_0x343582[_0x34cd('0x60')];var _0x40a7f6=_[_0x34cd('0x61')](_0x13c4a2);var _0x3ea76d=_0x343582[_0x34cd('0x62')];var _0x504281=path['join'](config['root'],_0x34cd('0x63'),_0x3ea76d+'.csv');logger[_0x34cd('0x57')]('body',_0x343582);db[_0x34cd('0x64')][_0x34cd('0x65')]({'raw':!![],'attributes':['id',_0x34cd('0x66')]})[_0x34cd('0x1e')](function(_0x26c38c){for(var _0xc0cbf0=0x0;_0xc0cbf0<_0x26c38c[_0x34cd('0x15')];_0xc0cbf0++){if(_0x26c38c[_0xc0cbf0][_0x34cd('0x66')]in _0x13c4a2){contactItemTypes[_0x34cd('0x18')](_0x26c38c[_0xc0cbf0]);delete _0x40a7f6[_0x26c38c[_0xc0cbf0][_0x34cd('0x66')]];hasAdditionalPhones=!![];}for(var _0x3bed1b in _0x13c4a2){if(_0x26c38c[_0xc0cbf0][_0x34cd('0x66')]+_0x34cd('0x67')===_0x3bed1b){phoneDescriptions[_0x34cd('0x18')]({'itemTypeId':_0x26c38c[_0xc0cbf0]['id'],'description':_0x3bed1b});delete _0x40a7f6[_0x3bed1b];}}}if(hasAdditionalPhones)_0x40a7f6['AdditionalPhones']='';var _0x5862c8=_[_0x34cd('0x50')](_0x40a7f6)[_0x34cd('0xe')]();logger[_0x34cd('0x57')](_0x34cd('0x68'),_0x5862c8);fs['writeFileSync'](_0x504281,_0x5862c8+'\x0a');Papa['parse'](fs['createReadStream'](_0x4f196a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x16512e,_0x18eec7){try{for(var _0x102de8=0x0,_0xcc9df=[];_0x102de8<_0x16512e['data']['length'];_0x102de8++){stats[_0x34cd('0x69')]+=0x1;if(_0x16512e[_0x34cd('0x5a')][_0x102de8]){handleError(_0x16512e[_0x34cd('0x6a')][_0x102de8],_0x16512e[_0x34cd('0x5a')][_0x102de8]);}else{var _0x251ec8=[];var _0x153d4b=[];var _0x1bf35c={};for(var _0x23b93d in _0x13c4a2){let _0x4935db=contactItemTypes['find'](_0x236dc4=>_0x236dc4[_0x34cd('0x66')]===_0x23b93d);let _0x8de903=contactItemTypes['find'](_0x4b9073=>_0x4b9073[_0x34cd('0x66')]+_0x34cd('0x67')===_0x23b93d);if(_[_0x34cd('0x16')](_0x4935db)&&_[_0x34cd('0x16')](_0x8de903)){if(_0x13c4a2[_0x34cd('0x6b')](_0x23b93d)){if(_0x16512e['data'][_0x102de8][_0x13c4a2[_0x23b93d]]){var _0x426fbc=_[_0x34cd('0x6c')](_0x16512e['data'][_0x102de8][_0x13c4a2[_0x23b93d]][_0x34cd('0x6d')](/"/g,'\x27'));switch(_0x23b93d){case _0x34cd('0x31'):var _0x2c3c07=moment(_0x426fbc,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2c3c07[_0x34cd('0x6e')]()){_0xcc9df[_0x34cd('0x18')]('\x22'+_0x426fbc+'\x22');}else{_0x251ec8[_0x34cd('0x18')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x34cd('0x34'):var _0x1f6123=parseInt(_0x426fbc);_0x426fbc=_[_0x34cd('0x6f')](_0x1f6123)||_0x1f6123<0x0||_0x1f6123>0x4?_0xca5e15?0x3:0x2:_0x1f6123;_0xcc9df['push']('\x22'+_0x426fbc+'\x22');break;case _0x34cd('0x35'):var _0x4d134c=parseInt(_0x426fbc);if(_[_0x34cd('0x70')](_0x4d134c)&&_[_0x34cd('0x71')](_0x1ef52b,_0x4d134c)){_0xcc9df[_0x34cd('0x18')]('\x22'+_0x4d134c+'\x22');}else{_0x251ec8[_0x34cd('0x18')]('agent\x20not\x20exists');}break;case _0x34cd('0x72'):if(isEmail(_0x426fbc)){_0xcc9df[_0x34cd('0x18')]('\x22'+_0x426fbc+'\x22');}else{_0x251ec8[_0x34cd('0x18')](_0x34cd('0x73'));}break;case _0x34cd('0x74'):var _0x1b112f=moment(_0x426fbc,_0x34cd('0x75'),!![]);if(_0x1b112f[_0x34cd('0x6e')]()){_0xcc9df[_0x34cd('0x18')]('\x22'+_0x426fbc+'\x22');}else{_0x251ec8['push'](_0x34cd('0x76'));}break;default:_0xcc9df[_0x34cd('0x18')]('\x22'+_0x426fbc+'\x22');}}else{switch(_0x23b93d){case _0x34cd('0x77'):case'phone':_0x251ec8[_0x34cd('0x18')](_0x23b93d+_0x34cd('0x78'));break;default:_0xcc9df['push']('\x22\x22');}}}}else{var _0x3698e2='';if(!_[_0x34cd('0x16')](_0x4935db)){if(!_0x1bf35c[_0x34cd('0x6b')](_0x4935db['id'])){for(var _0x3eb2e7=0x0;_0x3eb2e7<_0x13c4a2[_0x23b93d][_0x34cd('0x15')];_0x3eb2e7++){var _0x426fbc=_[_0x34cd('0x6c')](_0x16512e[_0x34cd('0x6a')][_0x102de8][_0x13c4a2[_0x23b93d][_0x3eb2e7]][_0x34cd('0x6d')](/"/g,'\x27'));var _0x3d3780=phoneDescriptions['find'](_0xcb1ac3=>_0xcb1ac3[_0x34cd('0x79')]===_0x4935db['id']);if(!_['isNil'](_0x3d3780)){var _0x543a85=_['trim'](_0x16512e[_0x34cd('0x6a')][_0x102de8][_0x13c4a2[_0x3d3780[_0x34cd('0x7a')]][0x0]][_0x34cd('0x6d')](/"/g,'\x27'));if(!_[_0x34cd('0x16')](_0x543a85))_0x426fbc=_0x426fbc+'§'+_0x543a85;}if(_0x3698e2=='')_0x3698e2=_0x426fbc;else _0x3698e2+='|'+_0x426fbc;}_0x153d4b[_0x34cd('0x18')](_0x4935db['id']+':'+_0x3698e2);_0x1bf35c[_0x4935db['id']]=0x1;}}}}if(hasAdditionalPhones){_0xcc9df[_0x34cd('0x18')]('\x22'+_0x153d4b[_0x34cd('0xe')](';')+'\x22');}if(_0x251ec8[_0x34cd('0x15')]){handleError(_0x16512e[_0x34cd('0x6a')][_0x102de8],{'code':'SystemRow','message':_0x251ec8['join']()});}else{fs[_0x34cd('0x7b')](_0x504281,_0xcc9df[_0x34cd('0xe')]()+'\x0a');}_0xcc9df=[];}if(!(stats[_0x34cd('0x69')]%0xc8)){socket[_0x34cd('0x7c')]('contact:import:'+_0x3ea76d,stats);stats[_0x34cd('0x5a')]=[];}}if(stopped){logger[_0x34cd('0x57')](_0x34cd('0x7d'));_0x18eec7['abort']();}}catch(_0x2dca0a){handleError(_0x16512e[_0x34cd('0x6a')][_0x102de8],{'code':_0x34cd('0x7e'),'message':_0x2dca0a['message']});logger['error'](_0x34cd('0x7f'),_0x2dca0a[_0x34cd('0x1c')]);}},'complete':function(){try{var _0xbfa819=[];var _0x2cefb5=tempTableName;_0xbfa819['push'](_0x34cd('0x80')+_0x2cefb5+'\x20LIKE\x20cm_contacts;');logger[_0x34cd('0x57')](_0x34cd('0x81'),contactItemTypes[_0x34cd('0x15')]);var _0x3084d7=util[_0x34cd('0x7')](_0x34cd('0x82'),_0x504281,_0x2cefb5,_0x5862c8,_0x343582[_0x34cd('0x32')],_0x343582[_0x34cd('0x51')]||null,NOW,NOW);if(_[_0x34cd('0x16')](_0x13c4a2['scheduledat'])){_0x3084d7+=',\x20scheduledAt\x20=\x20NOW()';}_0xbfa819[_0x34cd('0x18')](_0x3084d7);BPromise[_0x34cd('0x83')](_0xbfa819,handleQuery)[_0x34cd('0x1e')](function(_0x9232f1){BPromise['all']([handleAdditionalPhones()])[_0x34cd('0x1e')](function(){_0xbfa819=[];for(var _0xb0a859=0x0;_0xb0a859\x20\x20','existsSync','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','bluebird','ioredis','../../../config/logger','socket.io-emitter','redis','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','from','where','\x20=\x20','sequelize','query','select\x20*\x20from\x20','spread','length','phone','AdditionalPhones','push','all','then','catch','error','message','split','CmContactHasItem','findOne','updated','create','PHONE','inserted','CmContact','update','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','UserId','recallme','fields','cm_contacts','.CmListId','join','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_contacts.ListId','cm_contacts.updatedAt','insert','cm_hopper_black','updatedAt','field','ListId\x20=\x20?'];(function(_0x5f27f8,_0x3187f3){var _0x35ab2a=function(_0x41f34e){while(--_0x41f34e){_0x5f27f8['push'](_0x5f27f8['shift']());}};_0x35ab2a(++_0x3187f3);}(_0xa5df,0xe8));var _0xfa5d=function(_0x32e54f,_0x36288e){_0x32e54f=_0x32e54f-0x0;var _0x28bbab=_0xa5df[_0x32e54f];return _0x28bbab;};'use strict';var fs=require('fs');var path=require(_0xfa5d('0x0'));var _=require(_0xfa5d('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xfa5d('0x2'));var moment=require('moment');var squel=require('squel');var Redis=require(_0xfa5d('0x3'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xfa5d('0x4'))('import');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfa5d('0x5'))(new Redis(config[_0xfa5d('0x6')]));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()['format'](_0xfa5d('0x7'));var tempTableName='cm_contacts_temp_'+moment()['format'](_0xfa5d('0x8'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x24012f){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))*$/[_0xfa5d('0x9')](_0x24012f);}function selectNotIn(_0x5f4440,_0xeb8207,_0x287552,_0x5db303,_0x120552){return squel[_0xfa5d('0xa')]()['field']('phone')[_0xfa5d('0xb')](_0x5db303)['join'](_0xeb8207,null,_0xeb8207+'.id\x20=\x20'+_0x5db303+'.'+_0x287552)[_0xfa5d('0xc')](_0x5db303+'.'+_0x287552+_0xfa5d('0xd')+_0x5f4440+'.'+_0x287552)[_0xfa5d('0xc')](_0xeb8207+'.dialCheckDuplicateType\x20IN\x20('+_0x120552['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0xc9d9db,_0x5b6e1e){promisesAdditionalPhones=[];promisesContact=[];return db[_0xfa5d('0xe')][_0xfa5d('0xf')](_0xfa5d('0x10')+tempTableName)[_0xfa5d('0x11')](function(_0x5eb640){if(_0x5eb640!==null){var _0x257f36=[];for(var _0x5ab084=0x0;_0x5ab084<_0x5eb640[_0xfa5d('0x12')];_0x5ab084++){var _0x111cef=_0x5eb640[_0x5ab084];if(!_['isNil'](_0x111cef[_0xfa5d('0x13')])){if(!_['isNil'](_0x111cef[_0xfa5d('0x14')]))_0x257f36['push'](insertAdditionalPhones(_0x111cef));promisesContact[_0xfa5d('0x15')]({'contact':_0x111cef});}}}Promise[_0xfa5d('0x16')](_0x257f36)[_0xfa5d('0x17')](function(){_0xc9d9db({'val':0x1});});})[_0xfa5d('0x18')](function(_0x37b44c){logger[_0xfa5d('0x19')](_0x37b44c[_0xfa5d('0x1a')]);});});}function insertAdditionalPhones(_0xa5b088){return new Promise(function(_0x14ff29,_0x2a95f8){var _0x8cfa3c=_0xa5b088['AdditionalPhones'];if(_['isNil'](_0x8cfa3c))_0x2a95f8({'val':0x0});else{var _0x21f2c6=_0x8cfa3c['split'](';');var _0x47f21e=[];orderBy=0x0;for(var _0x499071=0x0;_0x499071<_0x21f2c6[_0xfa5d('0x12')];_0x499071++){_0x47f21e['push'](splitAdditionalPhone(_0xa5b088['id'],_0x21f2c6[_0x499071]));}Promise[_0xfa5d('0x16')](_0x47f21e)[_0xfa5d('0x17')](function(){_0x14ff29({'val':_0x21f2c6[_0xfa5d('0x12')]});});}});}function splitAdditionalPhone(_0x51cba2,_0x5c5fe5){return new Promise(function(_0x5d14ed,_0x5debcd){var _0x55831e=_0x5c5fe5[_0xfa5d('0x1b')](':');var _0x48286b=_0x55831e[0x0];var _0x96e468=_0x55831e[0x1];if(_0x96e468!==''){var _0x262b9a=_0x96e468['split']('|');var _0xa31d35=[];for(var _0x55f761=0x0;_0x55f761<_0x262b9a['length'];_0x55f761++){if(_0x262b9a[_0x55f761]!==''){var _0x128ff4=_['filter'](promisesAdditionalPhones,{'contactId':_0x51cba2,'phone':_0x262b9a[_0x55f761]});if(_0x128ff4[_0xfa5d('0x12')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x51cba2,'contactTypeId':_0x48286b,'phone':_0x262b9a[_0x55f761],'orderBy':orderBy});}}}_0x5d14ed({'ok':0x1});}else _0x5d14ed({'res':0x0});});}function createAdditionalPhone(_0x57bcfe,_0x5e2345,_0x117b11,_0x21c2ca){var _0x6cf0fd='';var _0x9b2141='';var _0x2623b4=_0x117b11[_0xfa5d('0x1b')]('§');_0x6cf0fd=_0x2623b4[0x0];if(_0x2623b4[_0xfa5d('0x12')]==0x2)_0x9b2141=_0x2623b4[0x1];return new Promise(function(_0x2d53e6,_0x5919b6){return db[_0xfa5d('0x1c')][_0xfa5d('0x1d')]({'where':{'CmContactId':_0x57bcfe,'item':_0x6cf0fd}})['then'](function(_0x598cbc){if(_0x598cbc){return db[_0xfa5d('0x1c')]['update']({'ItemTypeId':_0x5e2345,'description':_0x9b2141,'OrderBy':_0x21c2ca},{'where':{'CmContactId':_0x57bcfe,'item':_0x6cf0fd}})[_0xfa5d('0x17')](function(_0x28262d){_0x2d53e6({'res':_0xfa5d('0x1e')});});}else{return db[_0xfa5d('0x1c')][_0xfa5d('0x1f')]({'CmContactId':_0x57bcfe,'item':_0x6cf0fd,'ItemTypeId':_0x5e2345,'description':_0x9b2141,'OrderBy':_0x21c2ca,'ItemClass':_0xfa5d('0x20')})[_0xfa5d('0x17')](function(_0x7219d9){_0x2d53e6({'res':_0xfa5d('0x21')});});}});});}function updateContact(_0x3664c8){return new Promise(function(_0xef808,_0x4579c4){var _0x5e25f6=_0x3664c8['id'];delete _0x3664c8['id'];return db[_0xfa5d('0x22')][_0xfa5d('0x23')](_0x3664c8,{'where':{'id':_0x5e25f6}})[_0xfa5d('0x17')](function(_0x2b77e4){updatedRows+=0x1;return db[_0xfa5d('0x24')][_0xfa5d('0x23')]({'phone':_0x3664c8[_0xfa5d('0x13')]},{'where':{'ContactId':_0x5e25f6}})[_0xfa5d('0x17')](function(_0x244ff3){_0xef808({'ret':'OK'});});});});}function insertCmHopper(_0x124ab9,_0x3d31f4,_0x3b73db,_0x464729,_0x1f7a42){var _0x3667ed=['cm_contacts.phone',_0xfa5d('0x25'),_0xfa5d('0x26'),'cm_contacts.ListId',_0x3d31f4+'.'+_0x464729,_0xfa5d('0x27'),'cm_contacts.updatedAt',_0xfa5d('0x28'),_0xfa5d('0x29'),'\x22'+_0x1f7a42+'\x22'];return squel['insert']()[_0xfa5d('0x2a')](_0xfa5d('0x2b'))[_0xfa5d('0x2c')]([_0xfa5d('0x13'),'scheduledat',_0xfa5d('0x2d'),_0xfa5d('0x2e'),_0x464729,_0xfa5d('0x2f'),'updatedAt','priority',_0xfa5d('0x30'),_0xfa5d('0x31')],squel['select']()[_0xfa5d('0x32')](_0x3667ed)['from'](_0x3d31f4)['join'](_0xfa5d('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x3d31f4+_0xfa5d('0x34'))[_0xfa5d('0x35')](_0x3b73db,null,_0x3b73db+'.id\x20=\x20'+_0x3d31f4+'.'+_0x464729)[_0xfa5d('0xc')](_0x3d31f4+_0xfa5d('0x36'),_0x124ab9)[_0xfa5d('0xc')](_0xfa5d('0x37'),NOW)[_0xfa5d('0xc')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3d31f4,_0x3b73db,_0x464729,_0xfa5d('0x2b'),[_0xfa5d('0x38'),_0xfa5d('0x39')]))[_0xfa5d('0xc')](_0xfa5d('0x3a'),selectNotIn(_0x3d31f4,_0x3b73db,_0x464729,_0xfa5d('0x2b'),['\x22always\x22'])))[_0xfa5d('0x3b')]();}function insertCmHopperBlack(_0xc96079,_0x504fb3,_0x5b0e09,_0x18bea6){var _0x376591=[_0xfa5d('0x3c'),_0xfa5d('0x26'),_0xfa5d('0x3d'),_0x504fb3+'.'+_0x18bea6,_0xfa5d('0x27'),_0xfa5d('0x3e')];return squel[_0xfa5d('0x3f')]()[_0xfa5d('0x2a')](_0xfa5d('0x40'))['fromQuery']([_0xfa5d('0x13'),_0xfa5d('0x2d'),_0xfa5d('0x2e'),_0x18bea6,_0xfa5d('0x2f'),_0xfa5d('0x41')],squel[_0xfa5d('0xa')]()[_0xfa5d('0x32')](_0x376591)[_0xfa5d('0xb')](_0x504fb3)[_0xfa5d('0x35')](_0xfa5d('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x504fb3+_0xfa5d('0x34'))[_0xfa5d('0x35')](_0x5b0e09,null,_0x5b0e09+'.id\x20=\x20'+_0x504fb3+'.'+_0x18bea6)[_0xfa5d('0xc')](_0x504fb3+_0xfa5d('0x36'),_0xc96079)[_0xfa5d('0xc')](_0xfa5d('0x37'),NOW)[_0xfa5d('0xc')](_0xfa5d('0x3a'),squel['select']()[_0xfa5d('0x42')](_0xfa5d('0x13'))[_0xfa5d('0xb')](_0xfa5d('0x40'))[_0xfa5d('0xc')](_0xfa5d('0x43'),_0xc96079)['where'](_0x18bea6+_0xfa5d('0x44'),_0x504fb3+'.'+_0x18bea6)))[_0xfa5d('0x3b')]();}function insertCmHopperAdditionalPhones(_0x3e9027){var _0x5ced23=['cm_hopper.id',_0xfa5d('0x45'),_0xfa5d('0x46'),_0xfa5d('0x47'),_0xfa5d('0x48')];return squel[_0xfa5d('0x3f')]()[_0xfa5d('0x2a')](_0xfa5d('0x49'))['fromQuery']([_0xfa5d('0x4a'),_0xfa5d('0x13'),_0xfa5d('0x4b'),_0xfa5d('0x2f'),_0xfa5d('0x41')],squel[_0xfa5d('0xa')]()[_0xfa5d('0x32')](_0x5ced23)['from'](_0xfa5d('0x2b'))['join'](_0xfa5d('0x33'),null,_0xfa5d('0x4c'))[_0xfa5d('0x35')](_0xfa5d('0x4d'),null,_0xfa5d('0x4e'))[_0xfa5d('0xc')](_0xfa5d('0x4f'),_0x3e9027)[_0xfa5d('0xc')](_0xfa5d('0x37'),NOW))[_0xfa5d('0x3b')]();}function insertCmContact(_0x556001,_0x424800,_0x1d0f12,_0x27ea08){var _0x3730ea=_[_0xfa5d('0x50')](_[_0xfa5d('0x51')](_0x27ea08),['ListId',_0xfa5d('0x52'),_0xfa5d('0x2f'),_0xfa5d('0x41')]);return squel[_0xfa5d('0x3f')]()[_0xfa5d('0x2a')]('cm_contacts')['fromQuery'](_0x3730ea,squel['select']()[_0xfa5d('0x32')](_0x3730ea)[_0xfa5d('0xb')](_0x424800)[_0xfa5d('0xc')]('('+_0x1d0f12[_0xfa5d('0x35')](',')+_0xfa5d('0x53'),squel[_0xfa5d('0xa')]()[_0xfa5d('0x32')](_0x1d0f12)['from'](_0xfa5d('0x33'))[_0xfa5d('0xc')](_0xfa5d('0x43'),_0x556001))[_0xfa5d('0xc')](_0xfa5d('0x54'),squel[_0xfa5d('0xa')]()[_0xfa5d('0x42')]('MIN(id)',_0xfa5d('0x55'))[_0xfa5d('0xb')](_0x424800)[_0xfa5d('0x56')](_0x1d0f12[_0xfa5d('0x35')](','))))['toString']();}function handleStop(){logger[_0xfa5d('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x436f7b){logger['error'](_0x436f7b[_0xfa5d('0x1a')]);process['exit'](0x1);}function handleError(_0xf87eb,_0xaae56b){stats[_0xfa5d('0x58')][_0xfa5d('0x15')]({'name':_0xaae56b['code'],'message':_0xaae56b[_0xfa5d('0x1a')],'row':_0xf87eb});}function handleQuery(_0x3e697e){logger[_0xfa5d('0x57')](_0x3e697e);return db[_0xfa5d('0xe')][_0xfa5d('0xf')](_0x3e697e)[_0xfa5d('0x11')](function(_0x57549f){results[_0xfa5d('0x15')](_0x57549f);})[_0xfa5d('0x18')](function(_0x4e926b){logger[_0xfa5d('0x19')](_0x4e926b[_0xfa5d('0x1a')]);});}function main(_0x27a586,_0x3e82f2,_0xb4eff7,_0x528bc7){logger[_0xfa5d('0x57')](_0xfa5d('0x59'),_0x27a586,JSON[_0xfa5d('0x5a')](_0x3e82f2));process[_0xfa5d('0x5b')]('start');var _0x513938=_0x3e82f2['binding'];var _0x28a19b=_[_0xfa5d('0x5c')](_0x513938);var _0x558d7c=_0x3e82f2['socket_timestamp'];var _0x3e81d2=path[_0xfa5d('0x35')](config[_0xfa5d('0x5d')],_0xfa5d('0x5e'),_0x558d7c+_0xfa5d('0x5f'));logger[_0xfa5d('0x57')](_0xfa5d('0x60'),_0x3e82f2);db[_0xfa5d('0x61')][_0xfa5d('0x62')]({'raw':!![],'attributes':['id',_0xfa5d('0x63')]})['then'](function(_0x4168c1){for(var _0x5ac57b=0x0;_0x5ac57b<_0x4168c1[_0xfa5d('0x12')];_0x5ac57b++){if(_0x4168c1[_0x5ac57b][_0xfa5d('0x63')]in _0x513938){contactItemTypes[_0xfa5d('0x15')](_0x4168c1[_0x5ac57b]);delete _0x28a19b[_0x4168c1[_0x5ac57b][_0xfa5d('0x63')]];hasAdditionalPhones=!![];}for(var _0x18125a in _0x513938){if(_0x4168c1[_0x5ac57b][_0xfa5d('0x63')]+_0xfa5d('0x64')===_0x18125a){phoneDescriptions[_0xfa5d('0x15')]({'itemTypeId':_0x4168c1[_0x5ac57b]['id'],'description':_0x18125a});delete _0x28a19b[_0x18125a];}}}if(hasAdditionalPhones)_0x28a19b[_0xfa5d('0x14')]='';var _0x5e0a98=_[_0xfa5d('0x51')](_0x28a19b)[_0xfa5d('0x35')]();logger[_0xfa5d('0x57')]('header',_0x5e0a98);fs[_0xfa5d('0x65')](_0x3e81d2,_0x5e0a98+'\x0a');Papa[_0xfa5d('0x66')](fs[_0xfa5d('0x67')](_0x27a586),{'header':!![],'skipEmptyLines':!![],'step':function(_0x9b533e,_0x1d02ee){try{for(var _0x423832=0x0,_0x1a7150=[];_0x423832<_0x9b533e[_0xfa5d('0x68')][_0xfa5d('0x12')];_0x423832++){stats[_0xfa5d('0x69')]+=0x1;if(_0x9b533e[_0xfa5d('0x58')][_0x423832]){handleError(_0x9b533e[_0xfa5d('0x68')][_0x423832],_0x9b533e['errors'][_0x423832]);}else{var _0x5e66b7=[];var _0x412d67=[];var _0x410b00={};for(var _0x27345e in _0x513938){let _0x4ae580=contactItemTypes[_0xfa5d('0x6a')](_0x435c38=>_0x435c38[_0xfa5d('0x63')]===_0x27345e);let _0x420c6b=contactItemTypes[_0xfa5d('0x6a')](_0x1d33d1=>_0x1d33d1['name']+_0xfa5d('0x64')===_0x27345e);if(_[_0xfa5d('0x6b')](_0x4ae580)&&_[_0xfa5d('0x6b')](_0x420c6b)){if(_0x513938[_0xfa5d('0x6c')](_0x27345e)){if(_0x9b533e[_0xfa5d('0x68')][_0x423832][_0x513938[_0x27345e]]){var _0x288a75=_[_0xfa5d('0x6d')](_0x9b533e[_0xfa5d('0x68')][_0x423832][_0x513938[_0x27345e]][_0xfa5d('0x6e')](/"/g,'\x27'));switch(_0x27345e){case'scheduledat':var _0x3d38dc=moment(_0x288a75,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3d38dc['isValid']()){_0x1a7150['push']('\x22'+_0x288a75+'\x22');}else{_0x5e66b7[_0xfa5d('0x15')](_0xfa5d('0x6f'));}break;case'priority':var _0x591173=parseInt(_0x288a75);_0x288a75=_[_0xfa5d('0x70')](_0x591173)||_0x591173<0x0||_0x591173>0x4?_0x528bc7?0x3:0x2:_0x591173;_0x1a7150[_0xfa5d('0x15')]('\x22'+_0x288a75+'\x22');break;case'UserId':var _0x1f913c=parseInt(_0x288a75);if(_['isNumber'](_0x1f913c)&&_[_0xfa5d('0x71')](_0xb4eff7,_0x1f913c)){_0x1a7150[_0xfa5d('0x15')]('\x22'+_0x1f913c+'\x22');}else{_0x5e66b7[_0xfa5d('0x15')](_0xfa5d('0x72'));}break;case _0xfa5d('0x73'):if(isEmail(_0x288a75)){_0x1a7150['push']('\x22'+_0x288a75+'\x22');}else{_0x5e66b7[_0xfa5d('0x15')]('email\x20wrong\x20format');}break;case _0xfa5d('0x74'):var _0x40e355=moment(_0x288a75,_0xfa5d('0x75'),!![]);if(_0x40e355[_0xfa5d('0x76')]()){_0x1a7150[_0xfa5d('0x15')]('\x22'+_0x288a75+'\x22');}else{_0x5e66b7['push'](_0xfa5d('0x77'));}break;default:_0x1a7150[_0xfa5d('0x15')]('\x22'+_0x288a75+'\x22');}}else{switch(_0x27345e){case _0xfa5d('0x78'):case _0xfa5d('0x13'):_0x5e66b7[_0xfa5d('0x15')](_0x27345e+'\x20not\x20specified');break;default:_0x1a7150[_0xfa5d('0x15')]('\x22\x22');}}}}else{var _0x31eedf='';if(!_['isNil'](_0x4ae580)){if(!_0x410b00[_0xfa5d('0x6c')](_0x4ae580['id'])){for(var _0x5c88cc=0x0;_0x5c88cc<_0x513938[_0x27345e][_0xfa5d('0x12')];_0x5c88cc++){var _0x288a75=_[_0xfa5d('0x6d')](_0x9b533e[_0xfa5d('0x68')][_0x423832][_0x513938[_0x27345e][_0x5c88cc]][_0xfa5d('0x6e')](/"/g,'\x27'));var _0x172abf=phoneDescriptions['find'](_0x4cf9ae=>_0x4cf9ae['itemTypeId']===_0x4ae580['id']);if(!_[_0xfa5d('0x6b')](_0x172abf)){var _0x2d0a72=_[_0xfa5d('0x6d')](_0x9b533e['data'][_0x423832][_0x513938[_0x172abf[_0xfa5d('0x79')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xfa5d('0x6b')](_0x2d0a72))_0x288a75=_0x288a75+'§'+_0x2d0a72;}if(_0x31eedf=='')_0x31eedf=_0x288a75;else _0x31eedf+='|'+_0x288a75;}_0x412d67['push'](_0x4ae580['id']+':'+_0x31eedf);_0x410b00[_0x4ae580['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1a7150[_0xfa5d('0x15')]('\x22'+_0x412d67[_0xfa5d('0x35')](';')+'\x22');}if(_0x5e66b7['length']){handleError(_0x9b533e[_0xfa5d('0x68')][_0x423832],{'code':_0xfa5d('0x7a'),'message':_0x5e66b7[_0xfa5d('0x35')]()});}else{fs[_0xfa5d('0x7b')](_0x3e81d2,_0x1a7150[_0xfa5d('0x35')]()+'\x0a');}_0x1a7150=[];}if(!(stats[_0xfa5d('0x69')]%0xc8)){socket[_0xfa5d('0x7c')](_0xfa5d('0x7d')+_0x558d7c,stats);stats[_0xfa5d('0x58')]=[];}}if(stopped){logger[_0xfa5d('0x57')](_0xfa5d('0x7e'));_0x1d02ee[_0xfa5d('0x7f')]();}}catch(_0x34ae06){handleError(_0x9b533e[_0xfa5d('0x68')][_0x423832],{'code':_0xfa5d('0x80'),'message':_0x34ae06[_0xfa5d('0x1a')]});logger[_0xfa5d('0x19')]('step',_0x34ae06['message']);}},'complete':function(){try{var _0x1c3857=[];var _0x1ca6ed=tempTableName;_0x1c3857[_0xfa5d('0x15')](_0xfa5d('0x81')+_0x1ca6ed+_0xfa5d('0x82'));logger[_0xfa5d('0x57')]('CIS\x20len',contactItemTypes[_0xfa5d('0x12')]);var _0x383e12=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',_0x3e81d2,_0x1ca6ed,_0x5e0a98,_0x3e82f2[_0xfa5d('0x2e')],_0x3e82f2[_0xfa5d('0x52')]||null,NOW,NOW);if(_[_0xfa5d('0x6b')](_0x513938[_0xfa5d('0x83')])){_0x383e12+=_0xfa5d('0x84');}_0x1c3857[_0xfa5d('0x15')](_0x383e12);BPromise[_0xfa5d('0x85')](_0x1c3857,handleQuery)[_0xfa5d('0x17')](function(_0x356602){BPromise[_0xfa5d('0x16')]([handleAdditionalPhones()])[_0xfa5d('0x17')](function(){_0x1c3857=[];for(var _0x4e7faa=0x0;_0x4e7faa\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.closedAt','i.attach','i.lastMsgAt','i.subject','i.ContactId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','all','clone','isEmpty','Sequelize','QueryTypes','SELECT','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','length','where','ui.','\x20IN\x20?','map','getInteractionsTables','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','it.','\x20=\x20i.id','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','mail','isEmail','c.email\x20LIKE\x20?','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)','sqlOperator','conditions','find','buildExpression','type','default','text','value','start','end','unreadMessages','and','Contact'];(function(_0x463458,_0xf3b666){var _0x58e404=function(_0x465693){while(--_0x465693){_0x463458['push'](_0x463458['shift']());}};_0x58e404(++_0xf3b666);}(_0x0e74,0xff));var _0x40e7=function(_0x5b8736,_0x348588){_0x5b8736=_0x5b8736-0x0;var _0x4dfe79=_0x0e74[_0x5b8736];return _0x4dfe79;};'use strict';var _=require(_0x40e7('0x0'));var squel=require(_0x40e7('0x1'));var as=require(_0x40e7('0x2'));var qs=require(_0x40e7('0x3'));var updateInteraction=require(_0x40e7('0x4'))[_0x40e7('0x5')];var utils=require(_0x40e7('0x6'));var db=require(_0x40e7('0x7'))['db'];function skipInteractionsQuery(_0x107c0a,_0x4faef3,_0x2d46d8){var _0x1dea8c=![];var _0xcaec44=utils['getAccountFK'](_0x107c0a);if(_0x4faef3[_0x40e7('0x8')]===_0x40e7('0x9')&&!_0x2d46d8[_0x40e7('0xa')]&&!_0x2d46d8[_0xcaec44]){_0x1dea8c=!![];}return _0x1dea8c;}function getTagsQuery(){return squel[_0x40e7('0xb')]()[_0x40e7('0xc')]('id')[_0x40e7('0xc')](_0x40e7('0xd'))['field'](_0x40e7('0xe'))[_0x40e7('0xf')](_0x40e7('0x10'));}function getUsersQuery(_0x1315e6,_0x786add){var _0x2d67c7=utils[_0x40e7('0x11')](_0x1315e6);var _0x4e0bbf=_0x40e7('0x12')+_0x1315e6+_0x40e7('0x13');var _0x5e77b3=squel[_0x40e7('0xb')]()[_0x40e7('0xc')](_0x40e7('0x14'))[_0x40e7('0xc')](_0x40e7('0x15'))['field']('ui.'+_0x2d67c7)[_0x40e7('0xf')](_0x4e0bbf,'ui')[_0x40e7('0x16')](_0x40e7('0x17'),'u',_0x40e7('0x18'));if(_0x786add[_0x40e7('0x19')]>0x0){_0x5e77b3[_0x40e7('0x1a')](_0x40e7('0x1b')+_0x2d67c7+_0x40e7('0x1c'),_[_0x40e7('0x1d')](_0x786add,'id'));}return _0x5e77b3;}function getInteractionsQuery(_0x1a44a1){var _0x1d3aa3=utils[_0x40e7('0x1e')](_0x1a44a1);var _0x45044b=utils['getAccountFK'](_0x1a44a1);var _0x1774f5=utils['getInteractionFK'](_0x1a44a1);return squel['select']()[_0x40e7('0xf')](_0x1d3aa3['interactions'],'i')[_0x40e7('0x16')](_0x40e7('0x1f'),'c',_0x40e7('0x20'))[_0x40e7('0x16')](_0x40e7('0x17'),'o',_0x40e7('0x21'))['left_join'](_0x1d3aa3[_0x40e7('0x22')],'a',_0x40e7('0x23')+_0x45044b)[_0x40e7('0x16')](_0x1d3aa3[_0x40e7('0x24')],'me',_0x40e7('0x25')+_0x1774f5+'\x20=\x20i.id')[_0x40e7('0x16')](_0x1d3aa3['interactionsTags'],'it',_0x40e7('0x26')+_0x1774f5+_0x40e7('0x27'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x259252={'body':squel[_0x40e7('0x28')](),'contact':squel[_0x40e7('0x28')](),'default':squel[_0x40e7('0x28')](),'fields':squel[_0x40e7('0x28')](),'filter':squel[_0x40e7('0x28')](),'read':squel['expr'](),'tags':{'clause':squel[_0x40e7('0x28')](),'ids':null},'user':squel[_0x40e7('0x28')]()};return _0x259252;}function parseTagParameter(_0x5bd9e0){var _0x2df4a7=squel['expr']();if(_0x5bd9e0){var _0x1c1870=utils[_0x40e7('0x29')](_0x5bd9e0);_0x1c1870[_0x40e7('0x2a')](function(_0x1d49a0){_0x2df4a7['or'](_0x40e7('0x2b'),'%,'+_0x1d49a0+',%');});}return _0x2df4a7;}function parseReadParameter(_0x371987){var _0x167d87='';if(_0x371987){_0x167d87=_0x40e7('0x2c');if(_0x371987==='1'){_0x167d87=_0x167d87[_0x40e7('0x2d')](_0x40e7('0x2e'),'=');}else{_0x167d87=_0x167d87[_0x40e7('0x2d')](_0x40e7('0x2e'),'>');}}return _0x167d87;}function parseSearchFilter(_0x3d8cb2,_0x191972){var _0x3f11c7=squel[_0x40e7('0x28')]();if(_0x191972){var _0x574759=_0x191972[_0x40e7('0x2d')]('\x5c','\x5c\x5c')[_0x40e7('0x2d')](/'/g,'\x27\x27');if(qs[_0x40e7('0x2f')](_0x574759)){_0x3f11c7['or']('i.id\x20LIKE\x20?',_0x574759+'%');if(['sms',_0x40e7('0x30')]['includes'](_0x3d8cb2)){_0x3f11c7['or'](_0x40e7('0x31'),_0x574759+'%');}else if(_0x3d8cb2===_0x40e7('0x32')){_0x3f11c7['or'](_0x40e7('0x33'),_0x574759+'%');}else if(_0x3d8cb2===_0x40e7('0x34')){_0x3f11c7['or']('i.from\x20LIKE\x20?',_0x574759+'%');}}else if(_0x3d8cb2===_0x40e7('0x35')&&qs[_0x40e7('0x36')](_0x574759)){_0x3f11c7['or'](_0x40e7('0x37'),_0x574759+'%');}else{if(_0x3d8cb2==='mail'){_0x3f11c7['or'](_0x40e7('0x38'),qs[_0x40e7('0x39')](_0x574759,!![]))['or'](_0x40e7('0x3a'),qs[_0x40e7('0x39')](_0x574759));}else if(_0x3d8cb2!==_0x40e7('0x32')){_0x3f11c7['or'](_0x40e7('0x3b'),qs[_0x40e7('0x39')](_0x574759));}_0x3f11c7['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x40e7('0x39')](_0x574759,!![]),null);}}return _0x3f11c7;}function parseAdvancedSearchFilter(_0x52ea59,_0x22836b){var _0x1d9b78=getSqlClauses();var _0x497e33=as['parseSearch'](_0x52ea59);var _0x3c3339=_0x497e33[_0x40e7('0x3c')];for(var _0xc72380=0x0;_0xc72380<_0x497e33[_0x40e7('0x3d')][_0x40e7('0x19')];_0xc72380++){var _0x493121=_0x497e33[_0x40e7('0x3d')][_0xc72380];var _0x33a215='i';var _0x4d8326=_[_0x40e7('0x3e')](_0x22836b,[_0x40e7('0xd'),_0x493121[_0x40e7('0xc')]]);if(_0x4d8326){var _0x7a5cad=as[_0x40e7('0x3f')](_0x33a215,_0x4d8326[_0x40e7('0x40')],_0x493121);_0x1d9b78[_0x40e7('0x41')][_0x3c3339](_0x7a5cad[_0x40e7('0x42')],_0x7a5cad[_0x40e7('0x43')][_0x40e7('0x44')],_0x7a5cad['value'][_0x40e7('0x45')]);}else{switch(_0x493121[_0x40e7('0xc')]){case _0x40e7('0x46'):var _0x2805ff=parseReadParameter(_0x493121[_0x40e7('0x43')]);_0x1d9b78['read'][_0x40e7('0x47')](_0x2805ff);break;case _0x40e7('0x48'):if(_0x493121[_0x40e7('0x49')]===_0x40e7('0x4a')){if(_0x493121['value'][_0x40e7('0x4b')]('\x20')['length']>0x1){_0x1d9b78['contact'][_0x3c3339](_0x40e7('0x4c'),qs['getFullTextValue'](_0x493121[_0x40e7('0x43')],!![]),null);}else{var _0x5d6dc6='%'+_0x493121['value']+'%';_0x1d9b78['contact'][_0x3c3339](_0x40e7('0x4d'),_0x5d6dc6,_0x5d6dc6,_0x5d6dc6);}}else{_0x4d8326=_[_0x40e7('0x3e')](_0x22836b,[_0x40e7('0xd'),'ContactId']);_0x493121[_0x40e7('0xc')]=_0x40e7('0x4e');_0x7a5cad=as[_0x40e7('0x3f')](_0x33a215,_0x4d8326[_0x40e7('0x40')],_0x493121);_0x1d9b78[_0x40e7('0x4f')][_0x3c3339](_0x7a5cad[_0x40e7('0x42')],_0x7a5cad[_0x40e7('0x43')]['start'],_0x7a5cad[_0x40e7('0x43')][_0x40e7('0x45')]);}break;case _0x40e7('0x50'):var _0x3fa559=_0x493121['value'][_0x40e7('0x4b')](',')['map'](function(_0x4a2300){return Number(_0x4a2300);});var _0x428bbd=parseTagParameter(_0x3fa559);_0x1d9b78[_0x40e7('0x51')][_0x40e7('0x52')][_0x40e7('0x47')](_0x428bbd);_0x1d9b78[_0x40e7('0x51')][_0x40e7('0x53')]=_0x3fa559;break;case _0x40e7('0x54'):if(_0x493121[_0x40e7('0x49')]==='$substring'){_0x1d9b78[_0x40e7('0x55')][_0x3c3339](_0x40e7('0x56'),'%'+_0x493121[_0x40e7('0x43')]+'%',null);}else{_0x4d8326=_[_0x40e7('0x3e')](_0x22836b,[_0x40e7('0xd'),_0x40e7('0x57')]);_0x493121[_0x40e7('0xc')]=_0x40e7('0x57');_0x7a5cad=as[_0x40e7('0x3f')](_0x33a215,_0x4d8326[_0x40e7('0x40')],_0x493121);_0x1d9b78[_0x40e7('0x55')][_0x3c3339](_0x7a5cad[_0x40e7('0x42')],_0x7a5cad[_0x40e7('0x43')]['start'],_0x7a5cad[_0x40e7('0x43')][_0x40e7('0x45')]);}break;case _0x40e7('0x58'):case'plainBody':_0x7a5cad=as[_0x40e7('0x3f')]('me',null,_0x493121);_0x1d9b78['body'][_0x3c3339](_0x7a5cad[_0x40e7('0x42')],_0x7a5cad[_0x40e7('0x43')][_0x40e7('0x44')],_0x7a5cad['value'][_0x40e7('0x45')]);break;}}}return _0x1d9b78;}function parseModelFields(_0x280957,_0x46966b,_0x26b3d4){var _0x5f2d52=utils[_0x40e7('0x59')](_0x280957);var _0x48e832=squel[_0x40e7('0x28')]();var _0x10554a=_(_0x46966b)[_0x40e7('0x5a')]()[_0x40e7('0x1d')](function(_0x34448d){return _[_0x40e7('0x5b')](_0x26b3d4,['name',_0x34448d])?_0x34448d:undefined;})[_0x40e7('0x5c')]()[_0x40e7('0x43')]();if(_0x10554a[_0x40e7('0x19')]>0x0){_0x10554a[_0x40e7('0x2a')](function(_0x3dbc81){if(_0x3dbc81===_0x5f2d52){_0x48e832[_0x40e7('0x47')]('i.'+_0x5f2d52+_0x40e7('0x1c'),[]['concat'](_0x46966b[_0x3dbc81]));}else if(_0x3dbc81===_0x40e7('0x5d')){var _0x306113=JSON[_0x40e7('0x5e')](_0x46966b[_0x3dbc81])[_0x40e7('0x5f')];var _0x4a1ae5=JSON[_0x40e7('0x5e')](_0x46966b[_0x3dbc81])['$lte'];_0x48e832['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x306113,_0x4a1ae5);}else{if(_0x46966b[_0x3dbc81]===_0x40e7('0x60')){_0x48e832[_0x40e7('0x47')]('i.'+_0x3dbc81+_0x40e7('0x61'));}else{_0x48e832[_0x40e7('0x47')]('i.'+_0x3dbc81+_0x40e7('0x62'),_0x46966b[_0x3dbc81]);}}});}return _0x48e832;}function parseQueryParameters(_0x3e3040,_0x177581,_0x2372ee){var _0x104642=getSqlClauses();return Promise[_0x40e7('0x63')]()[_0x40e7('0x64')](function(){return parseModelFields(_0x3e3040,_0x177581,_0x2372ee);})[_0x40e7('0x64')](function(_0xb3c878){_0x104642[_0x40e7('0x65')][_0x40e7('0x47')](_0xb3c878);return parseReadParameter(_0x177581[_0x40e7('0x66')]);})[_0x40e7('0x64')](function(_0x175fbf){_0x104642[_0x40e7('0x66')][_0x40e7('0x47')](_0x175fbf);return parseTagParameter(_0x177581[_0x40e7('0x67')]);})[_0x40e7('0x64')](function(_0x30e0eb){_0x104642[_0x40e7('0x51')]['clause'][_0x40e7('0x47')](_0x30e0eb);return parseSearchFilter(_0x3e3040,_0x177581[_0x40e7('0x68')]);})['then'](function(_0x1453b3){_0x104642[_0x40e7('0x68')]=_0x1453b3;return _0x104642;});}function checkAccountsRestrictions(_0x3f0f58,_0x3b3e6f,_0x271cd3){var _0x3c62e8=utils['getAccountFK'](_0x3f0f58);var _0x2f4e15=_0x40e7('0x69')+_[_0x40e7('0x6a')](_0x3f0f58)+(_0x3f0f58==='chat'?'Websites':_0x40e7('0x6b'));var _0x4da2ae=squel[_0x40e7('0x28')]();return Promise['resolve']()[_0x40e7('0x64')](function(){if(_0x271cd3[_0x40e7('0xa')]&&_0x3b3e6f['role']==='agent'){return _0x3b3e6f[_0x2f4e15]({'attributes':['id'],'raw':!![]});}})[_0x40e7('0x64')](function(_0x2fbb88){if(_0x2fbb88){if(_0x2fbb88[_0x40e7('0x19')]===0x0){_0x4da2ae[_0x40e7('0x47')]('i.'+_0x3c62e8+_0x40e7('0x61'));}else{_0x4da2ae[_0x40e7('0x47')]('i.'+_0x3c62e8+_0x40e7('0x1c'),_[_0x40e7('0x1d')](_0x2fbb88,'id'));}}else if(!_0x271cd3[_0x3c62e8]){_0x4da2ae['and']('i.'+_0x3c62e8+_0x40e7('0x6c'));}})[_0x40e7('0x64')](function(){return _0x4da2ae;});}function getClosedOrderClause(_0x25257f,_0x11bcc5){var _0x4ca4e9='';var _0x582040=[_0x40e7('0x6d'),_0x40e7('0x6e'),_0x40e7('0x6f')];if(_0x25257f===_0x40e7('0x35')){_0x582040['unshift'](_0x40e7('0x70'));}if(_0x11bcc5[_0x40e7('0x71')]==='0'&&_0x25257f===_0x40e7('0x35')){_0x4ca4e9=_0x40e7('0x70');}else{if(_0x11bcc5[_0x40e7('0x71')]==='1'){_0x582040[_0x40e7('0x72')]();}_0x4ca4e9=_0x40e7('0x73')+_0x582040[_0x40e7('0x74')](',\x20')+')';}return _0x4ca4e9;}function getFilteredInteractions(_0x21ad52,_0x3d9786,_0x383549,_0x3450c5){var _0x1afcad=utils[_0x40e7('0x11')](_0x21ad52);var _0xdeb9=_[_0x40e7('0x6a')](_0x21ad52)+_0x40e7('0x75');var _0x46c46c=[];var _0x484f47=getTagsQuery();var _0xe288b0={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x4941c2=[];var _0x412dd0=[];return db['sequelize'][_0x40e7('0x76')](_0x484f47[_0x40e7('0x77')](),_0xe288b0)[_0x40e7('0x64')](function(_0x32f3b6){_0x46c46c=_['keyBy'](_0x32f3b6,'id');_0xe288b0=_[_0x40e7('0x78')](_0xe288b0,{'model':db[_0xdeb9],'mapToModel':!![],'nest':!![]});if(_0x383549['fields']){_0x3450c5[_0x40e7('0x79')]['forEach'](function(_0x228d23){_0x3d9786[_0x40e7('0xc')]('i.'+_0x228d23);});}else{_0x3d9786[_0x40e7('0xc')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x3d9786['field'](_0x40e7('0x7a'),_0x40e7('0x7b'));_0x3d9786['field'](_0x40e7('0x7c'),_0x40e7('0x7d'));if(_0x21ad52===_0x40e7('0x35')){_0x3d9786[_0x40e7('0xc')]('a.email',_0x40e7('0x7e'));_0x3d9786['field'](_0x40e7('0x7f'),_0x40e7('0x80'));_0x3d9786[_0x40e7('0xc')]('i.id');_0x3d9786[_0x40e7('0xc')](_0x40e7('0x81'));_0x3d9786[_0x40e7('0xc')](_0x40e7('0x82'));_0x3d9786[_0x40e7('0xc')](_0x40e7('0x83'));_0x3d9786[_0x40e7('0xc')](_0x40e7('0x84'));_0x3d9786[_0x40e7('0xc')](_0x40e7('0x85'));_0x3d9786['field'](_0x40e7('0x86'));_0x3d9786[_0x40e7('0xc')]('i.lastMsgDirection');_0x3d9786[_0x40e7('0xc')](_0x40e7('0x87'));_0x3d9786[_0x40e7('0xc')](_0x40e7('0x6f'));_0x3d9786[_0x40e7('0xc')](_0x40e7('0x6e'));_0x3d9786['field'](_0x40e7('0x6d'));_0x3d9786['field'](_0x40e7('0x70'));_0x3d9786[_0x40e7('0xc')]('i.to');_0x3d9786[_0x40e7('0xc')](_0x40e7('0x88'));_0x3d9786['field']('i.MailAccountId');_0x3d9786[_0x40e7('0xc')]('i.UserId');}else if(_0x21ad52===_0x40e7('0x34')){_0x3d9786[_0x40e7('0xc')](_0x40e7('0x89'),_0x40e7('0x80'));}else{_0x3d9786[_0x40e7('0xc')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}if(_0x21ad52!==_0x40e7('0x35')){_0x3d9786['field'](_0x40e7('0x8a'));}_0x3d9786[_0x40e7('0xc')](_0x40e7('0x8b'),_0x40e7('0x8c'));_0x3d9786[_0x40e7('0xc')](_0x40e7('0x8d'),'Contact.lastName');_0x3d9786['field'](_0x40e7('0x8e'),_0x40e7('0x8f'));_0x3d9786[_0x40e7('0xc')]('c.phone',_0x40e7('0x90'));_0x3d9786[_0x40e7('0xc')]('c.mobile',_0x40e7('0x91'));_0x3d9786[_0x40e7('0xc')]('c.fax','Contact.fax');_0x3d9786['field'](_0x40e7('0x92'),_0x40e7('0x93'));_0x3d9786[_0x40e7('0xc')](_0x40e7('0x94'),_0x40e7('0x95'));_0x3d9786[_0x40e7('0xc')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3450c5[_0x40e7('0x96')]){_0x3d9786['limit'](_0x3450c5[_0x40e7('0x96')]);}if(_0x3450c5[_0x40e7('0x97')]){_0x3d9786[_0x40e7('0x97')](_0x3450c5[_0x40e7('0x97')]);}return db[_0x40e7('0x98')][_0x40e7('0x76')](_0x3d9786[_0x40e7('0x77')](),_0xe288b0);})[_0x40e7('0x64')](function(_0x492dc8){_0x4941c2=_0x492dc8;var _0x3ff287=getUsersQuery(_0x21ad52,_0x4941c2);return db[_0x40e7('0x98')][_0x40e7('0x76')](_0x3ff287[_0x40e7('0x77')](),_0xe288b0);})['then'](function(_0x13abdb){_0x412dd0=_[_0x40e7('0x99')](_0x13abdb,_0x1afcad);if(_0x21ad52===_0x40e7('0x35')){return db[_0x40e7('0x9a')][_0x40e7('0x9b')]({'attributes':[_0x40e7('0x9c')],'raw':!![]});}})[_0x40e7('0x64')](function(_0x2449c5){var _0x58a082=_0x2449c5?_0x2449c5['enableEmailPreview']:undefined;var _0xb85463=_0x4941c2[_0x40e7('0x1d')](function(_0xd54672){return updateInteraction(_0xd54672,_0x46c46c,_0x412dd0,_0x58a082);});return Promise[_0x40e7('0x9d')](_0xb85463);});}function countFilteredInteractions(_0x346eea,_0x1ad91d){var _0x414e32=_0x346eea[_0x40e7('0x9e')]();_0x414e32[_0x40e7('0xc')]('COUNT(*)');_0x414e32[_0x40e7('0xc')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x40e7('0x46'));var _0x264789=utils[_0x40e7('0x29')](_0x1ad91d);if(!_[_0x40e7('0x9f')](_0x264789)){_0x414e32[_0x40e7('0x1a')]('t.id\x20IN\x20?',_0x264789);}var _0x36598e={'type':db[_0x40e7('0xa0')][_0x40e7('0xa1')][_0x40e7('0xa2')],'raw':!![]};return db['sequelize']['query'](_0x414e32[_0x40e7('0x77')](),_0x36598e);}module[_0x40e7('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x04f6=['i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','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','find','default','text','value','start','end','unreadMessages','read','and','Contact','operator','split','contact','ContactId','buildExpression','tags','clause','ids','User','user','UserId','type','body','plainBody','some','compact','\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','fields','filter','get','chat','Websites','Accounts','search','role','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','capitalize','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','merge','attributes','a.key','Account.key','Account.mandatoryDisposition','a.email','Account.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.id','i.createdAt','i.closed','i.closedAt','i.lastMsgAt','i.subject','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','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','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','getSelectedTags','where','t.id\x20IN\x20?','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','agent','select','field','name','color','from','tools_tags','user_has_','u.id','ui.','u.id\x20=\x20ui.UserId','length','map','getInteractionsTables','getAccountFK','getInteractionFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','left_join','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','includes'];(function(_0x1d89ee,_0x56f24c){var _0x4d15a7=function(_0x3434da){while(--_0x3434da){_0x1d89ee['push'](_0x1d89ee['shift']());}};_0x4d15a7(++_0x56f24c);}(_0x04f6,0x80));var _0x604f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x04f6[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x604f('0x0'));var squel=require(_0x604f('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x604f('0x2'));var updateInteraction=require(_0x604f('0x3'))[_0x604f('0x4')];var utils=require(_0x604f('0x5'));var db=require(_0x604f('0x6'))['db'];function skipInteractionsQuery(_0x39855f,_0x28f392,_0xea3864){var _0x391066=![];var _0x4a9c1c=utils['getAccountFK'](_0x39855f);if(_0x28f392['role']===_0x604f('0x7')&&!_0xea3864['search']&&!_0xea3864[_0x4a9c1c]){_0x391066=!![];}return _0x391066;}function getTagsQuery(){return squel[_0x604f('0x8')]()[_0x604f('0x9')]('id')[_0x604f('0x9')](_0x604f('0xa'))[_0x604f('0x9')](_0x604f('0xb'))[_0x604f('0xc')](_0x604f('0xd'));}function getUsersQuery(_0xe99e33,_0x243b93){var _0x54e6c5=utils['getInteractionFK'](_0xe99e33);var _0x5e1c36=_0x604f('0xe')+_0xe99e33+'_interactions';var _0x2d9055=squel[_0x604f('0x8')]()[_0x604f('0x9')](_0x604f('0xf'))[_0x604f('0x9')]('u.fullname')[_0x604f('0x9')](_0x604f('0x10')+_0x54e6c5)[_0x604f('0xc')](_0x5e1c36,'ui')['left_join']('users','u',_0x604f('0x11'));if(_0x243b93[_0x604f('0x12')]>0x0){_0x2d9055['where'](_0x604f('0x10')+_0x54e6c5+'\x20IN\x20?',_[_0x604f('0x13')](_0x243b93,'id'));}return _0x2d9055;}function getInteractionsQuery(_0x4ca61b){var _0x256d9b=utils[_0x604f('0x14')](_0x4ca61b);var _0x3e1c9a=utils[_0x604f('0x15')](_0x4ca61b);var _0x1793ca=utils[_0x604f('0x16')](_0x4ca61b);return squel[_0x604f('0x8')]()[_0x604f('0xc')](_0x256d9b[_0x604f('0x17')],'i')['left_join'](_0x604f('0x18'),'c',_0x604f('0x19'))['left_join'](_0x604f('0x1a'),'o',_0x604f('0x1b'))[_0x604f('0x1c')](_0x256d9b[_0x604f('0x1d')],'a',_0x604f('0x1e')+_0x3e1c9a)['left_join'](_0x256d9b[_0x604f('0x1f')],'me',_0x604f('0x20')+_0x1793ca+_0x604f('0x21'))['left_join'](_0x256d9b[_0x604f('0x22')],'it','it.'+_0x1793ca+'\x20=\x20i.id')['left_join']('tools_tags','t',_0x604f('0x23'));}function getSqlClauses(){var _0x55d7df={'body':squel[_0x604f('0x24')](),'contact':squel['expr'](),'default':squel[_0x604f('0x24')](),'fields':squel['expr'](),'filter':squel[_0x604f('0x24')](),'read':squel['expr'](),'tags':{'clause':squel[_0x604f('0x24')](),'ids':null},'user':squel[_0x604f('0x24')]()};return _0x55d7df;}function parseTagParameter(_0x5753dc){var _0xd1e408=squel['expr']();if(_0x5753dc){var _0x326d07=utils['getSelectedTags'](_0x5753dc);_0x326d07[_0x604f('0x25')](function(_0x3057d2){_0xd1e408['or'](_0x604f('0x26'),'%,'+_0x3057d2+',%');});}return _0xd1e408;}function parseReadParameter(_0x231b45){var _0x59cd78='';if(_0x231b45){_0x59cd78=_0x604f('0x27');if(_0x231b45==='1'){_0x59cd78=_0x59cd78['replace']('{OPERATOR}','=');}else{_0x59cd78=_0x59cd78['replace'](_0x604f('0x28'),'>');}}return _0x59cd78;}function parseSearchFilter(_0x542a90,_0x9b762d){var _0x21b9eb=squel[_0x604f('0x24')]();if(_0x9b762d){var _0x51106a=_0x9b762d[_0x604f('0x29')]('\x5c','\x5c\x5c')[_0x604f('0x29')](/'/g,'\x27\x27');if(qs[_0x604f('0x2a')](_0x51106a)){_0x21b9eb['or'](_0x604f('0x2b'),_0x51106a+'%');if(['sms','whatsapp'][_0x604f('0x2c')](_0x542a90)){_0x21b9eb['or'](_0x604f('0x2d'),_0x51106a+'%');}else if(_0x542a90===_0x604f('0x2e')){_0x21b9eb['or']('i.fax\x20LIKE\x20?',_0x51106a+'%');}else if(_0x542a90===_0x604f('0x2f')){_0x21b9eb['or'](_0x604f('0x30'),_0x51106a+'%');}}else if(_0x542a90===_0x604f('0x31')&&qs['isEmail'](_0x51106a)){_0x21b9eb['or'](_0x604f('0x32'),_0x51106a+'%');}else{if(_0x542a90==='mail'){_0x21b9eb['or'](_0x604f('0x33'),qs[_0x604f('0x34')](_0x51106a,!![]))['or'](_0x604f('0x35'),qs[_0x604f('0x34')](_0x51106a));}else if(_0x542a90!==_0x604f('0x2e')){_0x21b9eb['or'](_0x604f('0x36'),qs['getFullTextValue'](_0x51106a));}_0x21b9eb['or'](_0x604f('0x37'),qs[_0x604f('0x34')](_0x51106a,!![]),null);}}return _0x21b9eb;}function parseAdvancedSearchFilter(_0x3327ac,_0x75710){var _0x51a87b=getSqlClauses();var _0x4459ef=as[_0x604f('0x38')](_0x3327ac);var _0x2e0300=_0x4459ef[_0x604f('0x39')];for(var _0x5dcf1c=0x0;_0x5dcf1c<_0x4459ef['conditions']['length'];_0x5dcf1c++){var _0x3b36b4=_0x4459ef[_0x604f('0x3a')][_0x5dcf1c];var _0x46992b='i';var _0xf4cf1b=_[_0x604f('0x3b')](_0x75710,[_0x604f('0xa'),_0x3b36b4['field']]);if(_0xf4cf1b){var _0x2303bd=as['buildExpression'](_0x46992b,_0xf4cf1b['type'],_0x3b36b4);_0x51a87b[_0x604f('0x3c')][_0x2e0300](_0x2303bd[_0x604f('0x3d')],_0x2303bd[_0x604f('0x3e')][_0x604f('0x3f')],_0x2303bd['value'][_0x604f('0x40')]);}else{switch(_0x3b36b4['field']){case _0x604f('0x41'):var _0x237c94=parseReadParameter(_0x3b36b4[_0x604f('0x3e')]);_0x51a87b[_0x604f('0x42')][_0x604f('0x43')](_0x237c94);break;case _0x604f('0x44'):if(_0x3b36b4[_0x604f('0x45')]==='$substring'){if(_0x3b36b4['value'][_0x604f('0x46')]('\x20')[_0x604f('0x12')]>0x1){_0x51a87b[_0x604f('0x47')][_0x2e0300](_0x604f('0x37'),qs[_0x604f('0x34')](_0x3b36b4['value'],!![]),null);}else{var _0x421366='%'+_0x3b36b4['value']+'%';_0x51a87b[_0x604f('0x47')][_0x2e0300]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x421366,_0x421366,_0x421366);}}else{_0xf4cf1b=_[_0x604f('0x3b')](_0x75710,[_0x604f('0xa'),_0x604f('0x48')]);_0x3b36b4['field']='ContactId';_0x2303bd=as[_0x604f('0x49')](_0x46992b,_0xf4cf1b['type'],_0x3b36b4);_0x51a87b[_0x604f('0x47')][_0x2e0300](_0x2303bd[_0x604f('0x3d')],_0x2303bd[_0x604f('0x3e')][_0x604f('0x3f')],_0x2303bd['value'][_0x604f('0x40')]);}break;case'Tag':var _0x361790=_0x3b36b4['value'][_0x604f('0x46')](',')['map'](function(_0x29243c){return Number(_0x29243c);});var _0x3ce7b8=parseTagParameter(_0x361790);_0x51a87b[_0x604f('0x4a')][_0x604f('0x4b')][_0x604f('0x43')](_0x3ce7b8);_0x51a87b[_0x604f('0x4a')][_0x604f('0x4c')]=_0x361790;break;case _0x604f('0x4d'):if(_0x3b36b4[_0x604f('0x45')]==='$substring'){_0x51a87b[_0x604f('0x4e')][_0x2e0300]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3b36b4[_0x604f('0x3e')]+'%',null);}else{_0xf4cf1b=_['find'](_0x75710,[_0x604f('0xa'),'UserId']);_0x3b36b4['field']=_0x604f('0x4f');_0x2303bd=as[_0x604f('0x49')](_0x46992b,_0xf4cf1b[_0x604f('0x50')],_0x3b36b4);_0x51a87b[_0x604f('0x4e')][_0x2e0300](_0x2303bd['text'],_0x2303bd[_0x604f('0x3e')][_0x604f('0x3f')],_0x2303bd['value'][_0x604f('0x40')]);}break;case _0x604f('0x51'):case _0x604f('0x52'):_0x2303bd=as['buildExpression']('me',null,_0x3b36b4);_0x51a87b[_0x604f('0x51')][_0x2e0300](_0x2303bd[_0x604f('0x3d')],_0x2303bd[_0x604f('0x3e')][_0x604f('0x3f')],_0x2303bd[_0x604f('0x3e')][_0x604f('0x40')]);break;}}}return _0x51a87b;}function parseModelFields(_0x4dde20,_0x19455a,_0x57e797){var _0x51eb3d=utils[_0x604f('0x15')](_0x4dde20);var _0x3edc32=squel[_0x604f('0x24')]();var _0x17a7ae=_(_0x19455a)['keys']()[_0x604f('0x13')](function(_0x5475bb){return _[_0x604f('0x53')](_0x57e797,[_0x604f('0xa'),_0x5475bb])?_0x5475bb:undefined;})[_0x604f('0x54')]()['value']();if(_0x17a7ae[_0x604f('0x12')]>0x0){_0x17a7ae[_0x604f('0x25')](function(_0xd8d883){if(_0xd8d883===_0x51eb3d){_0x3edc32[_0x604f('0x43')]('i.'+_0x51eb3d+_0x604f('0x55'),[]['concat'](_0x19455a[_0xd8d883]));}else if(_0xd8d883===_0x604f('0x56')){var _0x28b06d=JSON[_0x604f('0x57')](_0x19455a[_0xd8d883])[_0x604f('0x58')];var _0xe4be13=JSON[_0x604f('0x57')](_0x19455a[_0xd8d883])[_0x604f('0x59')];_0x3edc32[_0x604f('0x43')](_0x604f('0x5a'),_0x28b06d,_0xe4be13);}else{if(_0x19455a[_0xd8d883]===_0x604f('0x5b')){_0x3edc32[_0x604f('0x43')]('i.'+_0xd8d883+'\x20IS\x20NULL');}else{_0x3edc32[_0x604f('0x43')]('i.'+_0xd8d883+_0x604f('0x5c'),_0x19455a[_0xd8d883]);}}});}return _0x3edc32;}function parseQueryParameters(_0x36bb22,_0x3e85e1,_0x3734a2){var _0x18cde6=getSqlClauses();return Promise[_0x604f('0x5d')]()[_0x604f('0x5e')](function(){return parseModelFields(_0x36bb22,_0x3e85e1,_0x3734a2);})[_0x604f('0x5e')](function(_0x24eee7){_0x18cde6[_0x604f('0x5f')]['and'](_0x24eee7);return parseReadParameter(_0x3e85e1[_0x604f('0x42')]);})['then'](function(_0x318e3f){_0x18cde6[_0x604f('0x42')][_0x604f('0x43')](_0x318e3f);return parseTagParameter(_0x3e85e1['tag']);})['then'](function(_0x41c276){_0x18cde6[_0x604f('0x4a')][_0x604f('0x4b')]['and'](_0x41c276);return parseSearchFilter(_0x36bb22,_0x3e85e1[_0x604f('0x60')]);})['then'](function(_0x2623ce){_0x18cde6['filter']=_0x2623ce;return _0x18cde6;});}function checkAccountsRestrictions(_0x19f109,_0x586862,_0x3e771c){var _0x16df6f=utils[_0x604f('0x15')](_0x19f109);var _0xff9275=_0x604f('0x61')+_['capitalize'](_0x19f109)+(_0x19f109===_0x604f('0x62')?_0x604f('0x63'):_0x604f('0x64'));var _0x1baf74=squel[_0x604f('0x24')]();return Promise['resolve']()[_0x604f('0x5e')](function(){if(_0x3e771c[_0x604f('0x65')]&&_0x586862[_0x604f('0x66')]===_0x604f('0x7')){return _0x586862[_0xff9275]({'attributes':['id'],'raw':!![]});}})[_0x604f('0x5e')](function(_0x10ac68){if(_0x10ac68){if(_0x10ac68[_0x604f('0x12')]===0x0){_0x1baf74[_0x604f('0x43')]('i.'+_0x16df6f+_0x604f('0x67'));}else{_0x1baf74[_0x604f('0x43')]('i.'+_0x16df6f+_0x604f('0x55'),_[_0x604f('0x13')](_0x10ac68,'id'));}}else if(!_0x3e771c[_0x16df6f]){_0x1baf74[_0x604f('0x43')]('i.'+_0x16df6f+_0x604f('0x68'));}})[_0x604f('0x5e')](function(){return _0x1baf74;});}function getClosedOrderClause(_0x511e28,_0x1076ea){var _0x292433='';var _0x517ce6=['i.thirdDisposition',_0x604f('0x69'),_0x604f('0x6a')];if(_0x511e28==='mail'){_0x517ce6[_0x604f('0x6b')](_0x604f('0x6c'));}if(_0x1076ea[_0x604f('0x6d')]==='0'&&_0x511e28===_0x604f('0x31')){_0x292433=_0x604f('0x6c');}else{if(_0x1076ea[_0x604f('0x6d')]==='1'){_0x517ce6['shift']();}_0x292433=_0x604f('0x6e')+_0x517ce6[_0x604f('0x6f')](',\x20')+')';}return _0x292433;}function getFilteredInteractions(_0x19034d,_0x2636dd,_0x317708,_0x3aa817){var _0xaeba98=utils[_0x604f('0x16')](_0x19034d);var _0x392aad=_[_0x604f('0x70')](_0x19034d)+_0x604f('0x71');var _0x350e5b=[];var _0x40c96b=getTagsQuery();var _0x176c30={'type':db[_0x604f('0x72')][_0x604f('0x73')][_0x604f('0x74')],'raw':!![]};var _0x58d56c=[];var _0x1ec37f=[];return db[_0x604f('0x75')][_0x604f('0x76')](_0x40c96b[_0x604f('0x77')](),_0x176c30)['then'](function(_0x513619){_0x350e5b=_['keyBy'](_0x513619,'id');_0x176c30=_[_0x604f('0x78')](_0x176c30,{'model':db[_0x392aad],'mapToModel':!![],'nest':!![]});if(_0x317708[_0x604f('0x5f')]){_0x3aa817[_0x604f('0x79')][_0x604f('0x25')](function(_0x277c62){_0x2636dd['field']('i.'+_0x277c62);});}else{_0x2636dd['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x604f('0x41'));_0x2636dd['field'](_0x604f('0x7a'),_0x604f('0x7b'));_0x2636dd[_0x604f('0x9')]('a.mandatoryDisposition',_0x604f('0x7c'));if(_0x19034d===_0x604f('0x31')){_0x2636dd[_0x604f('0x9')](_0x604f('0x7d'),_0x604f('0x7e'));_0x2636dd['field'](_0x604f('0x7f'),_0x604f('0x80'));_0x2636dd['field'](_0x604f('0x81'));_0x2636dd[_0x604f('0x9')](_0x604f('0x82'));_0x2636dd['field']('i.updatedAt');_0x2636dd[_0x604f('0x9')](_0x604f('0x83'));_0x2636dd['field'](_0x604f('0x84'));_0x2636dd[_0x604f('0x9')]('i.attach');_0x2636dd[_0x604f('0x9')](_0x604f('0x85'));_0x2636dd[_0x604f('0x9')]('i.lastMsgDirection');_0x2636dd[_0x604f('0x9')](_0x604f('0x86'));_0x2636dd['field'](_0x604f('0x6a'));_0x2636dd['field']('i.secondDisposition');_0x2636dd[_0x604f('0x9')](_0x604f('0x87'));_0x2636dd['field'](_0x604f('0x6c'));_0x2636dd['field'](_0x604f('0x88'));_0x2636dd['field'](_0x604f('0x89'));_0x2636dd[_0x604f('0x9')](_0x604f('0x8a'));_0x2636dd[_0x604f('0x9')](_0x604f('0x8b'));}else if(_0x19034d===_0x604f('0x2f')){_0x2636dd[_0x604f('0x9')](_0x604f('0x8c'),'contactName');}else{_0x2636dd[_0x604f('0x9')](_0x604f('0x8d'),_0x604f('0x80'));}if(_0x19034d!==_0x604f('0x31')){_0x2636dd[_0x604f('0x9')](_0x604f('0x8e'));}_0x2636dd[_0x604f('0x9')](_0x604f('0x8f'),_0x604f('0x90'));_0x2636dd[_0x604f('0x9')](_0x604f('0x91'),_0x604f('0x92'));_0x2636dd[_0x604f('0x9')]('c.email',_0x604f('0x93'));_0x2636dd['field'](_0x604f('0x94'),_0x604f('0x95'));_0x2636dd[_0x604f('0x9')](_0x604f('0x96'),_0x604f('0x97'));_0x2636dd['field'](_0x604f('0x98'),_0x604f('0x99'));_0x2636dd[_0x604f('0x9')](_0x604f('0x9a'),_0x604f('0x9b'));_0x2636dd['field'](_0x604f('0x9c'),_0x604f('0x9d'));_0x2636dd[_0x604f('0x9')](_0x604f('0x9e'),_0x604f('0x9f'));}if(_0x3aa817[_0x604f('0xa0')]){_0x2636dd[_0x604f('0xa0')](_0x3aa817[_0x604f('0xa0')]);}if(_0x3aa817[_0x604f('0xa1')]){_0x2636dd[_0x604f('0xa1')](_0x3aa817[_0x604f('0xa1')]);}return db[_0x604f('0x75')]['query'](_0x2636dd['toString'](),_0x176c30);})[_0x604f('0x5e')](function(_0x1b7daa){_0x58d56c=_0x1b7daa;var _0x15cb8f=getUsersQuery(_0x19034d,_0x58d56c);return db[_0x604f('0x75')][_0x604f('0x76')](_0x15cb8f[_0x604f('0x77')](),_0x176c30);})[_0x604f('0x5e')](function(_0x439569){_0x1ec37f=_[_0x604f('0xa2')](_0x439569,_0xaeba98);if(_0x19034d===_0x604f('0x31')){return db[_0x604f('0xa3')][_0x604f('0xa4')]({'attributes':[_0x604f('0xa5')],'raw':!![]});}})[_0x604f('0x5e')](function(_0x4a52e5){var _0x50ccfe=_0x4a52e5?_0x4a52e5['enableEmailPreview']:undefined;var _0x181535=_0x58d56c[_0x604f('0x13')](function(_0x2397b7){return updateInteraction(_0x2397b7,_0x350e5b,_0x1ec37f,_0x50ccfe);});return Promise[_0x604f('0xa6')](_0x181535);});}function countFilteredInteractions(_0x3e5585,_0x1e3b44){var _0x3688a5=_0x3e5585['clone']();_0x3688a5['field'](_0x604f('0xa7'));_0x3688a5[_0x604f('0x9')](_0x604f('0xa8'),_0x604f('0x41'));var _0x544134=utils[_0x604f('0xa9')](_0x1e3b44);if(!_['isEmpty'](_0x544134)){_0x3688a5[_0x604f('0xaa')](_0x604f('0xab'),_0x544134);}var _0x274e56={'type':db[_0x604f('0x72')][_0x604f('0x73')]['SELECT'],'raw':!![]};return db[_0x604f('0x75')][_0x604f('0x76')](_0x3688a5[_0x604f('0x77')](),_0x274e56);}module[_0x604f('0xac')]={'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 de010ad..c6cd768 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 _0x8bd0=['waiting','unmanaged','disposition','abandoned','UserId','answered','talking','total','findOne','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','lodash','map','fullname','split','forEach','push'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8bd0,0x132));var _0x08bd=function(_0x3880a9,_0xff5b2c){_0x3880a9=_0x3880a9-0x0;var _0x23f9d7=_0x8bd0[_0x3880a9];return _0x23f9d7;};'use strict';var _=require(_0x08bd('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x21c850,_0x1ee8fc){return new Promise(function(_0x583593,_0x4e565e){try{var _0x3863b3=[];if(_0x1ee8fc[_0x21c850]){_0x3863b3=_0x1ee8fc[_0x21c850][_0x08bd('0x1')](function(_0x5517bc){return{'id':_0x5517bc['id'],'fullname':_0x5517bc[_0x08bd('0x2')]};});}return _0x583593(_0x3863b3);}catch(_0xd878e){_0x4e565e(_0xd878e);}});}function getInteractionTags(_0x2b9be1,_0x8f500a){var _0x3fc4fe=[];if(_0x2b9be1){_0x2b9be1[_0x08bd('0x3')](',')[_0x08bd('0x4')](function(_0x49801f){_0x3fc4fe[_0x08bd('0x5')](_0x8f500a[_0x49801f]);});}return _0x3fc4fe;}function updateWaitingCounter(_0xd194cd){if(_0xd194cd['waiting']){_0xd194cd[_0x08bd('0x6')]-=0x1;}}function updateInteractionCounters(_0xdebd39){_0xdebd39[_0x08bd('0x6')]=0x0;_0xdebd39['talking']=0x0;_0xdebd39['answered']=0x0;_0xdebd39[_0x08bd('0x7')]=0x0;_0xdebd39['abandoned']=0x0;_0xdebd39['total']=0x0;if(_0xdebd39['closed']){if(_0xdebd39[_0x08bd('0x8')]===_0x08bd('0x9')){_0xdebd39[_0x08bd('0x9')]+=0x1;updateWaitingCounter(_0xdebd39);}if(_0xdebd39[_0x08bd('0xa')]){_0xdebd39[_0x08bd('0xb')]+=0x1;if(_0xdebd39['talking']){_0xdebd39['talking']-=0x1;}}else{if(_0xdebd39[_0x08bd('0x8')]){_0xdebd39[_0x08bd('0x7')]+=0x1;updateWaitingCounter(_0xdebd39);}}}else{if(!_0xdebd39[_0x08bd('0xa')]){_0xdebd39[_0x08bd('0x6')]+=0x1;}if(_0xdebd39[_0x08bd('0xa')]){_0xdebd39[_0x08bd('0xc')]+=0x1;updateWaitingCounter(_0xdebd39);}}_0xdebd39[_0x08bd('0xd')]+=0x1;return _0xdebd39;}function getLastMessageText(_0x37daf0){return db['MailMessage'][_0x08bd('0xe')]({'where':{'$and':[{'MailInteractionId':_0x37daf0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x08bd('0xf')],'order':_0x08bd('0x10'),'raw':!![]})[_0x08bd('0x11')](function(_0x551596){if(_0x551596&&_0x551596[_0x08bd('0xf')]){_0x37daf0[_0x08bd('0x12')]=_[_0x08bd('0x13')](_0x551596[_0x08bd('0xf')]);}return _0x37daf0;})[_0x08bd('0x14')](function(_0x307f4e){throw _0x307f4e;});}exports[_0x08bd('0x15')]=function(_0x5cba3c,_0x2c19c6,_0x3bc0ec,_0x549e3c){return new Promise(function(_0x10aead,_0x39fb7d){return getInteractionUsers(_0x5cba3c['id'],_0x3bc0ec)[_0x08bd('0x11')](function(_0x505818){_0x5cba3c[_0x08bd('0x16')]=_0x505818;return getInteractionTags(_0x5cba3c[_0x08bd('0x17')],_0x2c19c6);})[_0x08bd('0x11')](function(_0x55fc8){_0x5cba3c['Tags']=_0x55fc8;delete _0x5cba3c['TagIds'];return updateInteractionCounters(_0x5cba3c);})[_0x08bd('0x11')](function(_0x3330c0){if(_0x549e3c){return getLastMessageText(_0x3330c0);}else{return _0x3330c0;}})[_0x08bd('0x11')](function(_0x531374){_0x10aead(_0x531374);})[_0x08bd('0x14')](function(_0xae09e1){_0x39fb7d(_0xae09e1);});});}; \ No newline at end of file +var _0xf7b0=['unmanaged','abandoned','disposition','UserId','answered','total','MailMessage','findOne','out','-id','then','plainBody','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','map','split','forEach','push','waiting','talking'];(function(_0x1b532f,_0xf85d63){var _0x45b0e2=function(_0x20c520){while(--_0x20c520){_0x1b532f['push'](_0x1b532f['shift']());}};_0x45b0e2(++_0xf85d63);}(_0xf7b0,0x1ed));var _0x0f7b=function(_0x527579,_0x1a4807){_0x527579=_0x527579-0x0;var _0x31b289=_0xf7b0[_0x527579];return _0x31b289;};'use strict';var _=require(_0x0f7b('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x2bcc35,_0x404937){return new Promise(function(_0x36da0e,_0xfceb5){try{var _0x1a72af=[];if(_0x404937[_0x2bcc35]){_0x1a72af=_0x404937[_0x2bcc35][_0x0f7b('0x1')](function(_0x3dfaa5){return{'id':_0x3dfaa5['id'],'fullname':_0x3dfaa5['fullname']};});}return _0x36da0e(_0x1a72af);}catch(_0x5f1490){_0xfceb5(_0x5f1490);}});}function getInteractionTags(_0x231b89,_0x534e81){var _0x447c0e=[];if(_0x231b89){_0x231b89[_0x0f7b('0x2')](',')[_0x0f7b('0x3')](function(_0x3cccbd){_0x447c0e[_0x0f7b('0x4')](_0x534e81[_0x3cccbd]);});}return _0x447c0e;}function updateWaitingCounter(_0x46ffbb){if(_0x46ffbb['waiting']){_0x46ffbb[_0x0f7b('0x5')]-=0x1;}}function updateInteractionCounters(_0x3de58a){_0x3de58a[_0x0f7b('0x5')]=0x0;_0x3de58a[_0x0f7b('0x6')]=0x0;_0x3de58a['answered']=0x0;_0x3de58a[_0x0f7b('0x7')]=0x0;_0x3de58a[_0x0f7b('0x8')]=0x0;_0x3de58a['total']=0x0;if(_0x3de58a['closed']){if(_0x3de58a[_0x0f7b('0x9')]===_0x0f7b('0x8')){_0x3de58a[_0x0f7b('0x8')]+=0x1;updateWaitingCounter(_0x3de58a);}if(_0x3de58a[_0x0f7b('0xa')]){_0x3de58a[_0x0f7b('0xb')]+=0x1;if(_0x3de58a[_0x0f7b('0x6')]){_0x3de58a[_0x0f7b('0x6')]-=0x1;}}else{if(_0x3de58a['disposition']){_0x3de58a[_0x0f7b('0x7')]+=0x1;updateWaitingCounter(_0x3de58a);}}}else{if(!_0x3de58a[_0x0f7b('0xa')]){_0x3de58a[_0x0f7b('0x5')]+=0x1;}if(_0x3de58a[_0x0f7b('0xa')]){_0x3de58a[_0x0f7b('0x6')]+=0x1;updateWaitingCounter(_0x3de58a);}}_0x3de58a[_0x0f7b('0xc')]+=0x1;return _0x3de58a;}function getLastMessageText(_0x76e828){return db[_0x0f7b('0xd')][_0x0f7b('0xe')]({'where':{'$and':[{'MailInteractionId':_0x76e828['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0f7b('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0f7b('0x10'),'raw':!![]})[_0x0f7b('0x11')](function(_0x458abb){if(_0x458abb&&_0x458abb[_0x0f7b('0x12')]){_0x76e828['lastMsgText']=_[_0x0f7b('0x13')](_0x458abb[_0x0f7b('0x12')]);}return _0x76e828;})[_0x0f7b('0x14')](function(_0x5c10fb){throw _0x5c10fb;});}exports[_0x0f7b('0x15')]=function(_0x234be2,_0x18908d,_0x32baf7,_0x5b3732){return new Promise(function(_0x4ff1be,_0x31d1f2){return getInteractionUsers(_0x234be2['id'],_0x32baf7)[_0x0f7b('0x11')](function(_0xa29aae){_0x234be2[_0x0f7b('0x16')]=_0xa29aae;return getInteractionTags(_0x234be2[_0x0f7b('0x17')],_0x18908d);})[_0x0f7b('0x11')](function(_0x36ce29){_0x234be2[_0x0f7b('0x18')]=_0x36ce29;delete _0x234be2[_0x0f7b('0x17')];return updateInteractionCounters(_0x234be2);})['then'](function(_0x22dd8b){if(_0x5b3732){return getLastMessageText(_0x22dd8b);}else{return _0x22dd8b;}})[_0x0f7b('0x11')](function(_0x539642){_0x4ff1be(_0x539642);})[_0x0f7b('0x14')](function(_0x20b708){_0x31d1f2(_0x20b708);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index eb466aa..a0d0864 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 _0x93b0=['InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','findOne','then','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account'];(function(_0x1df2fe,_0x494dd5){var _0x4ca0ed=function(_0x25d378){while(--_0x25d378){_0x1df2fe['push'](_0x1df2fe['shift']());}};_0x4ca0ed(++_0x494dd5);}(_0x93b0,0x148));var _0x093b=function(_0x47b48c,_0xf95a71){_0x47b48c=_0x47b48c-0x0;var _0x2d03ff=_0x93b0[_0x47b48c];return _0x2d03ff;};'use strict';var _=require(_0x093b('0x0'));var db=require(_0x093b('0x1'))['db'];var loggers={'openchannel':require(_0x093b('0x2'))(_0x093b('0x3')),'mail':require(_0x093b('0x2'))('mail-interactions'),'fax':require(_0x093b('0x2'))(_0x093b('0x4')),'sms':require('../../config/logger')(_0x093b('0x5')),'chat':require(_0x093b('0x2'))(_0x093b('0x6')),'whatsapp':require('../../config/logger')(_0x093b('0x7'))};function getAccountFK(_0xa6a4b2){return _[_0x093b('0x8')](_0xa6a4b2)+(_0xa6a4b2===_0x093b('0x9')?_0x093b('0xa'):_0x093b('0xb'))+'Id';}function getInteractionFK(_0x134498){return _['capitalize'](_0x134498)+_0x093b('0xc');}function getInteractionId(_0x169203,_0x5f4e7e,_0x5a5077){if(_0x169203&&_0x169203[_[_0x093b('0xd')](_0x5a5077)+_0x093b('0xc')]){return _0x169203[_[_0x093b('0xd')](_0x5a5077)+_0x093b('0xc')];}else if(_0x169203&&_0x169203['id']){return _0x169203['id'];}else if(_0x5f4e7e&&_0x5f4e7e['id']){return _0x5f4e7e['id'];}else{return _0x093b('0xe');}}function getInteractionsTables(_0x5b37fc){return{'accounts':_0x5b37fc+'_'+(_0x5b37fc===_0x093b('0x9')?_0x093b('0xf'):_0x093b('0x10')),'interactions':_0x5b37fc+_0x093b('0x11'),'interactionsTags':_0x5b37fc+_0x093b('0x12'),'messages':_0x5b37fc+_0x093b('0x13'),'userInteractions':_0x093b('0x14')+_0x5b37fc+_0x093b('0x11')};}function getSelectedTags(_0x3e7f6a){var _0x500e27=[];if(_0x3e7f6a){_0x500e27=Array[_0x093b('0x15')](_0x3e7f6a)?_0x3e7f6a:[_0x3e7f6a];}return _0x500e27;}function log(_0xe5dbfa,_0x407a44,_0x1e74d0,_0xb37825,_0x28192c,_0x280c8c){loggers[_0x28192c[_0x093b('0x16')]()][_0xe5dbfa](_0x093b('0x17'),_0x280c8c[_0x093b('0x18')](),_0x407a44?_0x407a44['id']:null,_0x407a44?_0x407a44[_0x093b('0x19')]:null,_0x407a44?_0x407a44[_0x093b('0x1a')]:null,getInteractionId(_0x1e74d0,_0xb37825,_0x28192c),_0x1e74d0?JSON[_0x093b('0x1b')](_0x1e74d0):'null');}function updateUser(_0x5a526b,_0x253605,_0x1735e5,_0x3a1e9b,_0xbe9ac7){db[_[_0x093b('0xd')](_0x3a1e9b)+'Interaction'][_0x093b('0x1c')]({'where':{'id':getInteractionId(_0x253605,_0x1735e5,_0x3a1e9b)}})[_0x093b('0x1d')](function(_0x4910f1){if(_0x4910f1){return _0x4910f1['update']({'UserId':_0x5a526b?_0x5a526b['id']:null});}})[_0x093b('0x1d')](function(_0x303051){if(_0x303051){log(_0x093b('0x1e'),_0x5a526b,_0x253605,_0x1735e5,_0x3a1e9b,_0xbe9ac7);}})[_0x093b('0x1f')](function(){log(_0x093b('0x20'),_0x5a526b,_0x253605,_0x1735e5,_0x3a1e9b,_0xbe9ac7);});}module[_0x093b('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xfaa8=['chat','InteractionId','upperFirst','unknown','websites','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','catch','error','exports','../../mysqldb','../../config/logger','fax-interactions','whatsapp-interactions','capitalize'];(function(_0x44d509,_0x9fd84a){var _0x2547d3=function(_0x227be0){while(--_0x227be0){_0x44d509['push'](_0x44d509['shift']());}};_0x2547d3(++_0x9fd84a);}(_0xfaa8,0xa3));var _0x8faa=function(_0x5ecaa1,_0x27253c){_0x5ecaa1=_0x5ecaa1-0x0;var _0x53b5d8=_0xfaa8[_0x5ecaa1];return _0x53b5d8;};'use strict';var _=require('lodash');var db=require(_0x8faa('0x0'))['db'];var loggers={'openchannel':require(_0x8faa('0x1'))('openchannel-interactions'),'mail':require(_0x8faa('0x1'))('mail-interactions'),'fax':require('../../config/logger')(_0x8faa('0x2')),'sms':require('../../config/logger')('sms-interactions'),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0x8faa('0x1'))(_0x8faa('0x3'))};function getAccountFK(_0x487225){return _[_0x8faa('0x4')](_0x487225)+(_0x487225===_0x8faa('0x5')?'Website':'Account')+'Id';}function getInteractionFK(_0x17eb5a){return _[_0x8faa('0x4')](_0x17eb5a)+_0x8faa('0x6');}function getInteractionId(_0x257412,_0x34dc2f,_0x5d8fad){if(_0x257412&&_0x257412[_['upperFirst'](_0x5d8fad)+'InteractionId']){return _0x257412[_[_0x8faa('0x7')](_0x5d8fad)+_0x8faa('0x6')];}else if(_0x257412&&_0x257412['id']){return _0x257412['id'];}else if(_0x34dc2f&&_0x34dc2f['id']){return _0x34dc2f['id'];}else{return _0x8faa('0x8');}}function getInteractionsTables(_0x12369b){return{'accounts':_0x12369b+'_'+(_0x12369b===_0x8faa('0x5')?_0x8faa('0x9'):'accounts'),'interactions':_0x12369b+_0x8faa('0xa'),'interactionsTags':_0x12369b+_0x8faa('0xb'),'messages':_0x12369b+_0x8faa('0xc'),'userInteractions':_0x8faa('0xd')+_0x12369b+_0x8faa('0xa')};}function getSelectedTags(_0x398b6b){var _0x305545=[];if(_0x398b6b){_0x305545=Array[_0x8faa('0xe')](_0x398b6b)?_0x398b6b:[_0x398b6b];}return _0x305545;}function log(_0x618747,_0x3e4d8e,_0x531975,_0x3d95d5,_0x379c3d,_0x19b8bb){loggers[_0x379c3d[_0x8faa('0xf')]()][_0x618747]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x19b8bb[_0x8faa('0x10')](),_0x3e4d8e?_0x3e4d8e['id']:null,_0x3e4d8e?_0x3e4d8e[_0x8faa('0x11')]:null,_0x3e4d8e?_0x3e4d8e[_0x8faa('0x12')]:null,getInteractionId(_0x531975,_0x3d95d5,_0x379c3d),_0x531975?JSON[_0x8faa('0x13')](_0x531975):_0x8faa('0x14'));}function updateUser(_0x111450,_0x19214d,_0x16c01c,_0x3880e2,_0x4c6148){db[_['upperFirst'](_0x3880e2)+_0x8faa('0x15')][_0x8faa('0x16')]({'where':{'id':getInteractionId(_0x19214d,_0x16c01c,_0x3880e2)}})[_0x8faa('0x17')](function(_0x48670d){if(_0x48670d){return _0x48670d[_0x8faa('0x18')]({'UserId':_0x111450?_0x111450['id']:null});}})[_0x8faa('0x17')](function(_0x24ad35){if(_0x24ad35){log('info',_0x111450,_0x19214d,_0x16c01c,_0x3880e2,_0x4c6148);}})[_0x8faa('0x19')](function(){log(_0x8faa('0x1a'),_0x111450,_0x19214d,_0x16c01c,_0x3880e2,_0x4c6148);});}module[_0x8faa('0x1b')]={'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 dcff946..1bfce58 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 _0x27f4=['parse','hasOwnProperty','use','License','findOne','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','util','composable-middleware','license','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','utf8'];(function(_0x9d2167,_0x87cfb6){var _0x9520ff=function(_0x33d37b){while(--_0x33d37b){_0x9d2167['push'](_0x9d2167['shift']());}};_0x9520ff(++_0x87cfb6);}(_0x27f4,0x87));var _0x427f=function(_0x582598,_0x311dc5){_0x582598=_0x582598-0x0;var _0x1de137=_0x27f4[_0x582598];return _0x1de137;};'use strict';var crypto=require('crypto');var util=require(_0x427f('0x0'));var compose=require(_0x427f('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x225959,_0x2f0a81){if(_0x225959&&_0x2f0a81){if(_0x2f0a81['data1']&&_0x2f0a81[_0x427f('0x2')]){var _0x1c585c=_0x2f0a81[_0x427f('0x3')];var _0x20d011=_0x2f0a81['license'];var _0x50839c=_0x1c585c[_0x427f('0x4')]('-')[0x4];var _0x2db84d=_0x1c585c[_0x427f('0x4')]('-')[0x0];var _0xc9bda9=crypto[_0x427f('0x5')](_0x427f('0x6'),util['format'](_0x427f('0x7'),_0x50839c,_0x1c585c,_0x2db84d));var _0x3e635e=_0xc9bda9['update'](_0x20d011,'base64',_0x427f('0x8'));_0x3e635e+=_0xc9bda9['final'](_0x427f('0x8'));var _0x10a662=JSON[_0x427f('0x9')](_0x3e635e);return _0x10a662[_0x427f('0xa')](_0x225959)?_0x10a662[_0x225959]:null;}}return null;}function isLimit(_0x14a939,_0x50f87f,_0xe86d6c,_0x3910ce){var _0x565622=_0x50f87f;return compose()[_0x427f('0xb')](function(_0x163ea7,_0x124140,_0x51e27c){return db[_0x427f('0xc')][_0x427f('0xd')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3d6982){var _0x31194c=getValueFromLicense(_0x14a939,_0x3d6982);return _0x31194c?_0x31194c:_0x565622;})[_0x427f('0xe')](function(_0xf444f){_0x565622=_0xf444f;return _0xe86d6c[_0x427f('0xf')](_0x3910ce);})[_0x427f('0xe')](function(_0x340819){if(_0x340819>=_0x565622){return _0x124140['status'](0x193)[_0x427f('0x10')]({'message':util[_0x427f('0x11')](_0x427f('0x12'),_0x14a939)});}_0x51e27c();})[_0x427f('0x13')](function(_0x861300){_0x51e27c(_0x861300);});});}function isUserLimit(){return isLimit(_0x427f('0x14'),0x1,db[_0x427f('0x15')],{'where':{'$or':[{'role':_0x427f('0x16')},{'role':'user'}]}});}exports[_0x427f('0x17')]=isUserLimit; \ No newline at end of file +var _0xca59=['final','parse','hasOwnProperty','use','findOne','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','user','crypto','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8'];(function(_0x385c35,_0x38965f){var _0x2e2170=function(_0x126fc2){while(--_0x126fc2){_0x385c35['push'](_0x385c35['shift']());}};_0x2e2170(++_0x38965f);}(_0xca59,0x1bc));var _0x9ca5=function(_0x178e13,_0x26ebe2){_0x178e13=_0x178e13-0x0;var _0x5be3fc=_0xca59[_0x178e13];return _0x5be3fc;};'use strict';var crypto=require(_0x9ca5('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0x9ca5('0x1'))['db'];var config=require(_0x9ca5('0x2'));function getValueFromLicense(_0x33db95,_0x52b636){if(_0x33db95&&_0x52b636){if(_0x52b636[_0x9ca5('0x3')]&&_0x52b636['license']){var _0x151710=_0x52b636[_0x9ca5('0x3')];var _0x2699a8=_0x52b636[_0x9ca5('0x4')];var _0x1ca429=_0x151710[_0x9ca5('0x5')]('-')[0x4];var _0x286b47=_0x151710[_0x9ca5('0x5')]('-')[0x0];var _0x29f0c8=crypto[_0x9ca5('0x6')](_0x9ca5('0x7'),util[_0x9ca5('0x8')](_0x9ca5('0x9'),_0x1ca429,_0x151710,_0x286b47));var _0xb4c242=_0x29f0c8[_0x9ca5('0xa')](_0x2699a8,'base64',_0x9ca5('0xb'));_0xb4c242+=_0x29f0c8[_0x9ca5('0xc')](_0x9ca5('0xb'));var _0x2bc9e7=JSON[_0x9ca5('0xd')](_0xb4c242);return _0x2bc9e7[_0x9ca5('0xe')](_0x33db95)?_0x2bc9e7[_0x33db95]:null;}}return null;}function isLimit(_0x5ede1d,_0x3bce9a,_0x4cf5a4,_0x404a8d){var _0x40cb8e=_0x3bce9a;return compose()[_0x9ca5('0xf')](function(_0x348460,_0x3c338f,_0x4ba661){return db['License'][_0x9ca5('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x145727){var _0x708840=getValueFromLicense(_0x5ede1d,_0x145727);return _0x708840?_0x708840:_0x40cb8e;})['then'](function(_0x304aea){_0x40cb8e=_0x304aea;return _0x4cf5a4[_0x9ca5('0x11')](_0x404a8d);})['then'](function(_0x4719c7){if(_0x4719c7>=_0x40cb8e){return _0x3c338f[_0x9ca5('0x12')](0x193)[_0x9ca5('0x13')]({'message':util[_0x9ca5('0x8')](_0x9ca5('0x14'),_0x5ede1d)});}_0x4ba661();})['catch'](function(_0x4744a1){_0x4ba661(_0x4744a1);});});}function isUserLimit(){return isLimit(_0x9ca5('0x15'),0x1,db[_0x9ca5('0x16')],{'where':{'$or':[{'role':'admin'},{'role':_0x9ca5('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index bb6d389..69ece0d 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 _0xc916=['sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','shift','match','forEach','filter','map','push','DATE','$eq','operator','$between','value','includes','$gt','$lte','add','days','format','castTo','text','CAST(','field','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','minutes','lodash','moment','parseSearch'];(function(_0x3dc2b3,_0x2ede51){var _0x204240=function(_0x4d0ef8){while(--_0x4d0ef8){_0x3dc2b3['push'](_0x3dc2b3['shift']());}};_0x204240(++_0x2ede51);}(_0xc916,0xd1));var _0x6c91=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0xc916[_0x212bf5];return _0xfcad21;};'use strict';var _=require(_0x6c91('0x0'));var moment=require(_0x6c91('0x1'));exports[_0x6c91('0x2')]=function(_0x444bab){var _0x2fe936={'conditions':[]};_0x2fe936[_0x6c91('0x3')]=_[_0x6c91('0x4')](_0x444bab,_0x6c91('0x5'))?'or':_0x6c91('0x6');var _0x77882e=_0x444bab[_0x6c91('0x7')](_0x6c91('0x8'),'')['replace'](_0x6c91('0x5'),'')[_0x6c91('0x9')]('||');for(var _0x59ba59=0x0;_0x59ba59<_0x77882e[_0x6c91('0xa')];_0x59ba59++){var _0x509980=_0x77882e[_0x59ba59][_0x6c91('0x9')](':=');var _0x12a64f=_0x509980[0x0];var _0x15cd75=_0x509980[_0x6c91('0xb')](0x1);_0x15cd75['forEach'](function(_0x271aa0){var _0x2fc80f=_0x271aa0[_0x6c91('0x9')]('[')[_0x6c91('0xc')]();var _0x1f5d6f=_0x271aa0[_0x6c91('0xd')](/\[(.*?)\]/g);_0x1f5d6f[_0x6c91('0xe')](function(_0xc8e891){var _0x58fe13=_0xc8e891[_0x6c91('0x9')]('[')[_0x6c91('0xf')](function(_0x3ead5d){return _0x3ead5d['indexOf'](']')>-0x1;})[_0x6c91('0x10')](function(_0x5cbc35){return _0x5cbc35[_0x6c91('0x9')](']')[0x0];})[0x0];_0x2fe936['conditions'][_0x6c91('0x11')]({'field':_0x12a64f,'operator':_0x2fc80f,'value':_0x58fe13});});});}return _0x2fe936;};exports['buildExpression']=function(_0x3161a6,_0x2abe8d,_0xefc13e){var _0x587360={};if(_0x2abe8d===_0x6c91('0x12')){if(_0xefc13e['operator']===_0x6c91('0x13')){_0xefc13e[_0x6c91('0x14')]=_0x6c91('0x15');_0xefc13e[_0x6c91('0x16')]+=','+_0xefc13e[_0x6c91('0x16')];}else if(_[_0x6c91('0x17')]([_0x6c91('0x18'),_0x6c91('0x19')],_0xefc13e['operator'])){_0xefc13e[_0x6c91('0x16')]=moment(_0xefc13e[_0x6c91('0x16')])[_0x6c91('0x1a')](0x1,_0x6c91('0x1b'))[_0x6c91('0x1c')]('YYYY-MM-DD');}}if(_0xefc13e['castTo']){_0x2abe8d=_0xefc13e[_0x6c91('0x1d')];_0x587360[_0x6c91('0x1e')]=_0x6c91('0x1f')+_0x3161a6+'.'+_0xefc13e[_0x6c91('0x20')]+'\x20AS\x20'+_0xefc13e[_0x6c91('0x1d')]+')\x20'+parseOperator(_0xefc13e[_0x6c91('0x14')]);}else{_0x587360[_0x6c91('0x1e')]=_0x3161a6+'.'+_0xefc13e[_0x6c91('0x20')]+'\x20'+parseOperator(_0xefc13e[_0x6c91('0x14')]);}if(_[_0x6c91('0x17')](['$ne',_0x6c91('0x21')],_0xefc13e['operator']))_0x587360['text']='('+_0x587360[_0x6c91('0x1e')]+'\x20OR\x20'+_0x3161a6+'.'+_0xefc13e['field']+_0x6c91('0x22');_0x587360[_0x6c91('0x16')]=parseValue(_0x2abe8d,_0xefc13e['operator'],_0xefc13e['value']);return _0x587360;};function parseOperator(_0x416702){var _0x4dd90d;switch(_0x416702){case _0x6c91('0x23'):_0x4dd90d=_0x6c91('0x24');break;case _0x6c91('0x21'):_0x4dd90d=_0x6c91('0x25');break;case _0x6c91('0x13'):_0x4dd90d=_0x6c91('0x26');break;case _0x6c91('0x27'):_0x4dd90d=_0x6c91('0x28');break;case _0x6c91('0x29'):case _0x6c91('0x2a'):case _0x6c91('0x2b'):_0x4dd90d=_0x6c91('0x2c');break;case'$lt':_0x4dd90d='<\x20?';break;case _0x6c91('0x18'):_0x4dd90d='>\x20?';break;case _0x6c91('0x19'):_0x4dd90d=_0x6c91('0x2d');break;case _0x6c91('0x2e'):_0x4dd90d=_0x6c91('0x2f');break;case _0x6c91('0x15'):_0x4dd90d=_0x6c91('0x30');break;}return _0x4dd90d;}function parseValue(_0x34be85,_0x52e82f,_0x4edbac){var _0x21f02d={'start':undefined,'end':undefined};switch(_0x52e82f){case'$in':case _0x6c91('0x21'):_0x21f02d[_0x6c91('0x31')]=_0x4edbac[_0x6c91('0x9')](',');break;case _0x6c91('0x29'):_0x21f02d[_0x6c91('0x31')]='%'+_0x4edbac+'%';break;case _0x6c91('0x2a'):_0x21f02d[_0x6c91('0x31')]=_0x4edbac+'%';break;case _0x6c91('0x2b'):_0x21f02d['start']='%'+_0x4edbac;break;case _0x6c91('0x15'):var _0x4ef230=_0x4edbac[_0x6c91('0x9')](',');var _0x4edbac=_0x4ef230['shift']();var _0x51cea3=_0x4ef230['pop']();if(_0x34be85===_0x6c91('0x12')){_0x4edbac=moment(_0x4edbac)[_0x6c91('0x32')](0x0,!![])[_0x6c91('0x1c')]();_0x51cea3=moment(_0x51cea3)['utcOffset'](0x0,!![])['add'](0x17,_0x6c91('0x33'))[_0x6c91('0x1a')](0x3b,_0x6c91('0x34'))[_0x6c91('0x1a')](0x3b,'seconds')[_0x6c91('0x1c')]();}_0x21f02d={'start':_0x4edbac,'end':_0x51cea3};break;default:_0x21f02d[_0x6c91('0x31')]=_0x4edbac;break;}return _0x21f02d;} \ No newline at end of file +var _0xb550=['$eq','=\x20?','<>\x20?','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$substring','utcOffset','minutes','seconds','lodash','moment','parseSearch','[$or]','replace','[$and]','split','length','slice','shift','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','$in','IN\x20?','$notIn','NOT\x20IN\x20?'];(function(_0x432f45,_0xc9a936){var _0x4c9118=function(_0x48dddd){while(--_0x48dddd){_0x432f45['push'](_0x432f45['shift']());}};_0x4c9118(++_0xc9a936);}(_0xb550,0x119));var _0x0b55=function(_0x2edd43,_0x52e338){_0x2edd43=_0x2edd43-0x0;var _0x1af2fb=_0xb550[_0x2edd43];return _0x1af2fb;};'use strict';var _=require(_0x0b55('0x0'));var moment=require(_0x0b55('0x1'));exports[_0x0b55('0x2')]=function(_0x333021){var _0x39e9b5={'conditions':[]};_0x39e9b5['sqlOperator']=_['startsWith'](_0x333021,_0x0b55('0x3'))?'or':'and';var _0x5a668c=_0x333021[_0x0b55('0x4')](_0x0b55('0x5'),'')['replace']('[$or]','')[_0x0b55('0x6')]('||');for(var _0x300afe=0x0;_0x300afe<_0x5a668c[_0x0b55('0x7')];_0x300afe++){var _0x11199f=_0x5a668c[_0x300afe]['split'](':=');var _0x21d3cc=_0x11199f[0x0];var _0x211d63=_0x11199f[_0x0b55('0x8')](0x1);_0x211d63['forEach'](function(_0x495836){var _0xc6d016=_0x495836[_0x0b55('0x6')]('[')[_0x0b55('0x9')]();var _0x1f6ad5=_0x495836[_0x0b55('0xa')](/\[(.*?)\]/g);_0x1f6ad5['forEach'](function(_0x255823){var _0x40407c=_0x255823['split']('[')[_0x0b55('0xb')](function(_0x5ab0dc){return _0x5ab0dc[_0x0b55('0xc')](']')>-0x1;})['map'](function(_0x2784f6){return _0x2784f6[_0x0b55('0x6')](']')[0x0];})[0x0];_0x39e9b5[_0x0b55('0xd')][_0x0b55('0xe')]({'field':_0x21d3cc,'operator':_0xc6d016,'value':_0x40407c});});});}return _0x39e9b5;};exports[_0x0b55('0xf')]=function(_0x498200,_0x336a9e,_0x5ab6cb){var _0x187135={};if(_0x336a9e===_0x0b55('0x10')){if(_0x5ab6cb[_0x0b55('0x11')]==='$eq'){_0x5ab6cb[_0x0b55('0x11')]=_0x0b55('0x12');_0x5ab6cb[_0x0b55('0x13')]+=','+_0x5ab6cb[_0x0b55('0x13')];}else if(_[_0x0b55('0x14')]([_0x0b55('0x15'),_0x0b55('0x16')],_0x5ab6cb[_0x0b55('0x11')])){_0x5ab6cb['value']=moment(_0x5ab6cb[_0x0b55('0x13')])[_0x0b55('0x17')](0x1,_0x0b55('0x18'))[_0x0b55('0x19')](_0x0b55('0x1a'));}}if(_0x5ab6cb['castTo']){_0x336a9e=_0x5ab6cb['castTo'];_0x187135[_0x0b55('0x1b')]=_0x0b55('0x1c')+_0x498200+'.'+_0x5ab6cb[_0x0b55('0x1d')]+_0x0b55('0x1e')+_0x5ab6cb['castTo']+')\x20'+parseOperator(_0x5ab6cb['operator']);}else{_0x187135[_0x0b55('0x1b')]=_0x498200+'.'+_0x5ab6cb[_0x0b55('0x1d')]+'\x20'+parseOperator(_0x5ab6cb['operator']);}if(_[_0x0b55('0x14')]([_0x0b55('0x1f'),'$notIn'],_0x5ab6cb[_0x0b55('0x11')]))_0x187135[_0x0b55('0x1b')]='('+_0x187135['text']+_0x0b55('0x20')+_0x498200+'.'+_0x5ab6cb[_0x0b55('0x1d')]+'\x20IS\x20NULL)';_0x187135['value']=parseValue(_0x336a9e,_0x5ab6cb['operator'],_0x5ab6cb[_0x0b55('0x13')]);return _0x187135;};function parseOperator(_0x541115){var _0x302fe1;switch(_0x541115){case _0x0b55('0x21'):_0x302fe1=_0x0b55('0x22');break;case _0x0b55('0x23'):_0x302fe1=_0x0b55('0x24');break;case _0x0b55('0x25'):_0x302fe1=_0x0b55('0x26');break;case _0x0b55('0x1f'):_0x302fe1=_0x0b55('0x27');break;case'$substring':case _0x0b55('0x28'):case _0x0b55('0x29'):_0x302fe1='LIKE\x20?';break;case _0x0b55('0x2a'):_0x302fe1=_0x0b55('0x2b');break;case _0x0b55('0x15'):_0x302fe1=_0x0b55('0x2c');break;case _0x0b55('0x16'):_0x302fe1=_0x0b55('0x2d');break;case _0x0b55('0x2e'):_0x302fe1='>=\x20?';break;case _0x0b55('0x12'):_0x302fe1=_0x0b55('0x2f');break;}return _0x302fe1;}function parseValue(_0x3a6366,_0x5bd427,_0x5b6c03){var _0x201853={'start':undefined,'end':undefined};switch(_0x5bd427){case _0x0b55('0x21'):case'$notIn':_0x201853[_0x0b55('0x30')]=_0x5b6c03[_0x0b55('0x6')](',');break;case _0x0b55('0x31'):_0x201853['start']='%'+_0x5b6c03+'%';break;case'$startsWith':_0x201853[_0x0b55('0x30')]=_0x5b6c03+'%';break;case _0x0b55('0x29'):_0x201853['start']='%'+_0x5b6c03;break;case _0x0b55('0x12'):var _0x5c21da=_0x5b6c03[_0x0b55('0x6')](',');var _0x5b6c03=_0x5c21da['shift']();var _0x26de40=_0x5c21da['pop']();if(_0x3a6366===_0x0b55('0x10')){_0x5b6c03=moment(_0x5b6c03)[_0x0b55('0x32')](0x0,!![])['format']();_0x26de40=moment(_0x26de40)[_0x0b55('0x32')](0x0,!![])[_0x0b55('0x17')](0x17,'hours')[_0x0b55('0x17')](0x3b,_0x0b55('0x33'))['add'](0x3b,_0x0b55('0x34'))[_0x0b55('0x19')]();}_0x201853={'start':_0x5b6c03,'end':_0x26de40};break;default:_0x201853['start']=_0x5b6c03;break;}return _0x201853;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ea5a009..c221a31 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 _0xf163=['length','isObject','isString','unset','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','model','intersection','attributes','hasOwnProperty','nolimit','limit','order','where','pick','filter','includes','columns','merge','lower','include','lodash','moment','../../mysqldb','keys','parse','alias','fields','raw','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','offset','sort','map','indexOf','priority','cast','col','substr','omit'];(function(_0x42a40d,_0x4d0c7a){var _0x2d4d7d=function(_0x160d48){while(--_0x160d48){_0x42a40d['push'](_0x42a40d['shift']());}};_0x2d4d7d(++_0x4d0c7a);}(_0xf163,0x129));var _0x3f16=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0xf163[_0x1ee62e];return _0x27c6c8;};'use strict';var _=require(_0x3f16('0x0'));var sequelize=require('sequelize');var moment=require(_0x3f16('0x1'));var db=require(_0x3f16('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3ccaa4){var _0x335c2b=['ne'];try{var _0x3b5045=JSON['parse'](_0x3ccaa4);var _0xb7e352=Object[_0x3f16('0x3')](_0x3b5045)[0x0];return _0x335c2b['includes'](_0xb7e352);}catch(_0x1bd04f){return![];}}function getOperatorValue(_0x1307b7){var _0x6d1be=JSON[_0x3f16('0x4')](_0x1307b7);var _0x401a6c=Object[_0x3f16('0x3')](_0x6d1be)[0x0];var _0x3b3a9c=_0x6d1be[_0x401a6c];return{['$'+_0x401a6c]:_0x3b3a9c};}function parseIncludeModel(_0x258189){var _0x28eaae=JSON[_0x3f16('0x4')](_0x258189);return{'model':db[_0x28eaae['model']],'as':_0x28eaae[_0x3f16('0x5')],'attributes':_0x28eaae[_0x3f16('0x6')],'raw':_0x28eaae[_0x3f16('0x7')]};}exports[_0x3f16('0x6')]=function(_0x1ef5ea){var _0x2ac491=null;if(_0x1ef5ea){_0x2ac491=_0x1ef5ea['split'](',');}return _0x2ac491;};exports[_0x3f16('0x8')]=function(_0x4d4f83,_0x33d611){var _0x254ca7={};if(!_[_0x3f16('0x9')](_0x4d4f83)){_[_0x3f16('0xa')](_0x4d4f83,function(_0x1e7330,_0x200cc5){try{if(_0x33d611){var _0x52175d=_[_0x3f16('0xb')](_0x33d611,{'name':_0x200cc5})||{};if(hasSequelizeOperator(_0x1e7330)){_0x254ca7[_0x200cc5]=getOperatorValue(_0x1e7330);}else if(_0x52175d[_0x3f16('0xc')]===_0x3f16('0xd')&&_[_0x3f16('0xe')](_0x1e7330)){var _0xb28281=JSON['parse'](_0x1e7330);var _0x461d4e={'$gte':moment(moment(_0xb28281['$gte'])[_0x3f16('0xf')](_0x3f16('0x10')))[_0x3f16('0x11')]()[_0x3f16('0xf')](),'$lte':moment(moment(_0xb28281[_0x3f16('0x12')])[_0x3f16('0xf')](_0x3f16('0x10')))[_0x3f16('0x11')]()[_0x3f16('0x13')](0x1,'s')[_0x3f16('0xf')]()};_0x254ca7[_0x200cc5]=_0x461d4e;}else if(_0x52175d[_0x3f16('0x14')]===_0x3f16('0x15')){_0x254ca7[_0x200cc5]=_0x1e7330;}else{_0x254ca7[_0x200cc5]=_[_0x3f16('0x16')](_0x1e7330)?_0x1e7330:JSON[_0x3f16('0x4')](_0x1e7330);}}else{_0x254ca7[_0x200cc5]=_[_0x3f16('0x16')](_0x1e7330)?_0x1e7330:JSON[_0x3f16('0x4')](_0x1e7330);}}catch(_0x4cb533){_0x254ca7[_0x200cc5]=_0x1e7330[_0x3f16('0x17')](',');}});}return _0x254ca7;};exports['limit']=function(_0x27166c){_0x27166c=parseInt(_0x27166c,0xa);if(!_0x27166c||_0x27166c<0x0){_0x27166c=LIMIT_VALUE;}return _0x27166c;};exports[_0x3f16('0x18')]=function(_0x1e9ac9){_0x1e9ac9=parseInt(_0x1e9ac9,0xa);if(!_0x1e9ac9||_0x1e9ac9<0x0){_0x1e9ac9=0x0;}return _0x1e9ac9;};exports[_0x3f16('0x19')]=function(_0x4e76de){var _0x27bba9,_0xd451c6=null;if(_0x4e76de){_0x27bba9=_0x4e76de[_0x3f16('0x17')](',');_0xd451c6=_[_0x3f16('0x1a')](_0x27bba9,function(_0x18a18a){if(_0x18a18a[_0x3f16('0x1b')]('-')===0x0){return[_0x18a18a===_0x3f16('0x1c')?sequelize[_0x3f16('0x1d')](sequelize[_0x3f16('0x1e')](_0x3f16('0x1c')),'unsigned'):_0x18a18a[_0x3f16('0x1f')](0x1),'DESC'];}else{return[_0x18a18a===_0x3f16('0x1c')?sequelize[_0x3f16('0x1d')](sequelize[_0x3f16('0x1e')](_0x3f16('0x1c')),'unsigned'):_0x18a18a,'ASC'];}});}return _0xd451c6;};exports[_0x3f16('0x20')]=function(_0x20261f,_0x1f18eb){if(_[_0x3f16('0x9')](_0x20261f)){return _0x20261f;}if(_[_0x3f16('0x16')](_0x20261f)){for(var _0x3d6ddd=0x0;_0x3d6ddd<_0x20261f[_0x3f16('0x21')];_0x3d6ddd+=0x1){_0x20261f[_0x3d6ddd]=this['omit'](_0x20261f[_0x3d6ddd],_0x1f18eb);}return _0x20261f;}if(!_[_0x3f16('0x22')](_0x20261f)){return _0x20261f;}if(_[_0x3f16('0x23')](_0x1f18eb)){_0x1f18eb=[_0x1f18eb];}if(!_['isArray'](_0x1f18eb)){return _0x20261f;}for(var _0x5ee64e=0x0;_0x5ee64e<_0x1f18eb[_0x3f16('0x21')];_0x5ee64e+=0x1){_[_0x3f16('0x24')](_0x20261f,_0x1f18eb[_0x5ee64e]);}for(var _0x5eff4f in _0x20261f){if(_0x20261f['hasOwnProperty'](_0x5eff4f)){_0x20261f[_0x5eff4f]=this[_0x3f16('0x20')](_0x20261f[_0x5eff4f],_0x1f18eb);}}return _0x20261f;};exports[_0x3f16('0x25')]=function(_0x52a045){return _0x52a045['match'](RegExp(_0x3f16('0x26')))?!![]:![];};exports[_0x3f16('0x27')]=function(_0xf1c937){return _0xf1c937[_0x3f16('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x3f16('0x29')]=function(_0xe368de,_0x5ad909){var _0x264b9e=[];var _0x28f23c=/[ `!@#$%^&*()_\-?~]/;var _0x1e19bb=_0x5ad909?_0x3f16('0x2a'):_0x3f16('0x2b');_0xe368de[_0x3f16('0x17')](/[ ,]+/)[_0x3f16('0x2c')](function(_0x308752){_0x308752=_0x308752[_0x3f16('0x2d')](/([^:]")"+/g,'$1');_0x308752='+'+_0x308752+'*';var _0x5654b5=_0x308752['match'](_0x28f23c);if(_0x5654b5){_0x308752='\x22'+_0x308752+'\x22';}_0x264b9e[_0x3f16('0x2e')](_0x308752);});_0x1e19bb=_0x1e19bb[_0x3f16('0x2d')]('{EXPR}',_0x264b9e[_0x3f16('0x2f')]('\x20'));return _0x1e19bb;};exports[_0x3f16('0x30')]=function(_0x420c85,_0x1faaba,_0x297d61){var _0x112a92={},_0x4b3814={};if(_0x1faaba[_0x3f16('0x31')][_0x3f16('0x32')]){_0x1faaba[_0x3f16('0x31')]['id']=_0x1faaba[_0x3f16('0x31')][_0x3f16('0x32')];delete _0x1faaba[_0x3f16('0x31')][_0x3f16('0x32')];}_0x112a92[_0x3f16('0x33')]=_[_0x3f16('0x1a')](_0x420c85,_0x3f16('0x14'));_0x112a92[_0x3f16('0x31')]=_[_0x3f16('0x3')](_0x1faaba['query']);_0x112a92[_0x3f16('0x8')]=_[_0x3f16('0x34')](_0x112a92[_0x3f16('0x33')],_0x112a92[_0x3f16('0x31')]);_0x4b3814[_0x3f16('0x35')]=_[_0x3f16('0x34')](_0x112a92[_0x3f16('0x33')],this[_0x3f16('0x6')](_0x1faaba['query'][_0x3f16('0x6')]));_0x4b3814[_0x3f16('0x35')]=_0x4b3814[_0x3f16('0x35')][_0x3f16('0x21')]?_0x4b3814[_0x3f16('0x35')]:_0x112a92['model'];if(!_0x1faaba[_0x3f16('0x31')][_0x3f16('0x36')](_0x3f16('0x37'))){_0x4b3814[_0x3f16('0x38')]=this['limit'](_0x1faaba[_0x3f16('0x31')][_0x3f16('0x38')]);_0x4b3814[_0x3f16('0x18')]=this[_0x3f16('0x18')](_0x1faaba['query']['offset']);}_0x4b3814[_0x3f16('0x39')]=this[_0x3f16('0x19')](_0x1faaba[_0x3f16('0x31')][_0x3f16('0x19')]);_0x4b3814[_0x3f16('0x3a')]=this[_0x3f16('0x8')](_[_0x3f16('0x3b')](_0x1faaba['query'],_0x112a92[_0x3f16('0x8')]),_0x420c85);if(_0x1faaba['query'][_0x3f16('0x3c')]){var _0x13de11=_0x420c85;var _0x3d1403=_0x1faaba[_0x3f16('0x31')][_0x3f16('0x3c')];if(typeof _0x3d1403==='object'){_0x13de11=_[_0x3f16('0x3c')](_0x420c85,function(_0x3a65bc){return _[_0x3f16('0x3d')](_0x3d1403[_0x3f16('0x3e')],_0x3a65bc[_0x3f16('0x14')]);});_0x3d1403=_0x3d1403['value'];}_0x4b3814[_0x3f16('0x3a')]=_[_0x3f16('0x3f')](_0x4b3814[_0x3f16('0x3a')],{'$or':_['map'](_0x13de11,function(_0x4aa94a){if(_0x4aa94a[_0x3f16('0xc')]!=='VIRTUAL'){if(_0x297d61){return sequelize[_0x3f16('0x3a')](sequelize['fn'](_0x3f16('0x40'),sequelize[_0x3f16('0x1e')](_0x4aa94a[_0x3f16('0x14')])),{'$like':sequelize['fn']('lower','%'+_0x1faaba[_0x3f16('0x31')]['filter']+'%')});}else{var _0x35a895={};_0x35a895[_0x4aa94a['name']]={'$like':'%'+_0x1faaba[_0x3f16('0x31')][_0x3f16('0x3c')]+'%'};return _0x35a895;}}})});}_0x4b3814=_['merge']({},_0x4b3814,_0x1faaba['options']);return _0x4b3814;};exports[_0x3f16('0x41')]=function(_0x3d5e55){var _0x238b39=[];if(_0x3d5e55['includeAll']){_0x238b39[_0x3f16('0x2e')]({'all':!![]});}else if(_0x3d5e55[_0x3f16('0x41')]){if(Array[_0x3f16('0x16')](_0x3d5e55[_0x3f16('0x41')])){_0x238b39=Object[_0x3f16('0x3')](_0x3d5e55['include'])[_0x3f16('0x1a')](function(_0x4ebd04){return parseIncludeModel(_0x3d5e55['include'][_0x4ebd04]);});}else{var _0x59d583=parseIncludeModel(_0x3d5e55['include']);_0x238b39[_0x3f16('0x2e')](_0x59d583);}}return _0x238b39;}; \ No newline at end of file +var _0x6df0=['\x22{EXPR}\x22','forEach','replace','join','getOptions','query','$id','filters','attributes','intersection','fields','nolimit','order','pick','object','filter','columns','where','merge','VIRTUAL','lower','options','include','push','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','model','alias','raw','find','type','DATE','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','split','limit','offset','sort','map','indexOf','cast','col','unsigned','substr','DESC','priority','omit','isObject','isString','length','unset','hasOwnProperty','match','^[+]?[0-9]*$'];(function(_0x1bf7f0,_0x18f402){var _0x357f71=function(_0x967898){while(--_0x967898){_0x1bf7f0['push'](_0x1bf7f0['shift']());}};_0x357f71(++_0x18f402);}(_0x6df0,0x15d));var _0x06df=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x6df0[_0x43a37c];return _0x5d1d40;};'use strict';var _=require(_0x06df('0x0'));var sequelize=require(_0x06df('0x1'));var moment=require(_0x06df('0x2'));var db=require(_0x06df('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x33b410){var _0xe148c2=['ne'];try{var _0x57408e=JSON[_0x06df('0x4')](_0x33b410);var _0x199ee0=Object[_0x06df('0x5')](_0x57408e)[0x0];return _0xe148c2[_0x06df('0x6')](_0x199ee0);}catch(_0x16aa04){return![];}}function getOperatorValue(_0x57e486){var _0x487280=JSON[_0x06df('0x4')](_0x57e486);var _0xf2f327=Object[_0x06df('0x5')](_0x487280)[0x0];var _0x358cd3=_0x487280[_0xf2f327];return{['$'+_0xf2f327]:_0x358cd3};}function parseIncludeModel(_0x2645f5){var _0x111631=JSON[_0x06df('0x4')](_0x2645f5);return{'model':db[_0x111631[_0x06df('0x7')]],'as':_0x111631[_0x06df('0x8')],'attributes':_0x111631['fields'],'raw':_0x111631[_0x06df('0x9')]};}exports['fields']=function(_0x2fb92b){var _0x48c766=null;if(_0x2fb92b){_0x48c766=_0x2fb92b['split'](',');}return _0x48c766;};exports['filters']=function(_0x1f7afa,_0x1b722d){var _0x53f121={};if(!_['isEmpty'](_0x1f7afa)){_['forOwn'](_0x1f7afa,function(_0x54f2a9,_0x5c1f2c){try{if(_0x1b722d){var _0x5e2761=_[_0x06df('0xa')](_0x1b722d,{'name':_0x5c1f2c})||{};if(hasSequelizeOperator(_0x54f2a9)){_0x53f121[_0x5c1f2c]=getOperatorValue(_0x54f2a9);}else if(_0x5e2761[_0x06df('0xb')]===_0x06df('0xc')&&_['isPlainObject'](_0x54f2a9)){var _0x181710=JSON['parse'](_0x54f2a9);var _0x299bf5={'$gte':moment(moment(_0x181710[_0x06df('0xd')])[_0x06df('0xe')](_0x06df('0xf')))[_0x06df('0x10')]()[_0x06df('0xe')](),'$lte':moment(moment(_0x181710['$lte'])[_0x06df('0xe')](_0x06df('0xf')))[_0x06df('0x10')]()[_0x06df('0x11')](0x1,'s')[_0x06df('0xe')]()};_0x53f121[_0x5c1f2c]=_0x299bf5;}else if(_0x5e2761[_0x06df('0x12')]===_0x06df('0x13')){_0x53f121[_0x5c1f2c]=_0x54f2a9;}else{_0x53f121[_0x5c1f2c]=_[_0x06df('0x14')](_0x54f2a9)?_0x54f2a9:JSON[_0x06df('0x4')](_0x54f2a9);}}else{_0x53f121[_0x5c1f2c]=_[_0x06df('0x14')](_0x54f2a9)?_0x54f2a9:JSON[_0x06df('0x4')](_0x54f2a9);}}catch(_0x25728e){_0x53f121[_0x5c1f2c]=_0x54f2a9[_0x06df('0x15')](',');}});}return _0x53f121;};exports[_0x06df('0x16')]=function(_0x2bd2f9){_0x2bd2f9=parseInt(_0x2bd2f9,0xa);if(!_0x2bd2f9||_0x2bd2f9<0x0){_0x2bd2f9=LIMIT_VALUE;}return _0x2bd2f9;};exports[_0x06df('0x17')]=function(_0x10a463){_0x10a463=parseInt(_0x10a463,0xa);if(!_0x10a463||_0x10a463<0x0){_0x10a463=0x0;}return _0x10a463;};exports[_0x06df('0x18')]=function(_0x50d9f3){var _0x16a7ec,_0x36eab8=null;if(_0x50d9f3){_0x16a7ec=_0x50d9f3[_0x06df('0x15')](',');_0x36eab8=_[_0x06df('0x19')](_0x16a7ec,function(_0x3c3644){if(_0x3c3644[_0x06df('0x1a')]('-')===0x0){return[_0x3c3644==='priority'?sequelize[_0x06df('0x1b')](sequelize[_0x06df('0x1c')]('priority'),_0x06df('0x1d')):_0x3c3644[_0x06df('0x1e')](0x1),_0x06df('0x1f')];}else{return[_0x3c3644===_0x06df('0x20')?sequelize[_0x06df('0x1b')](sequelize[_0x06df('0x1c')](_0x06df('0x20')),_0x06df('0x1d')):_0x3c3644,'ASC'];}});}return _0x36eab8;};exports[_0x06df('0x21')]=function(_0x3428fa,_0xda95e){if(_['isEmpty'](_0x3428fa)){return _0x3428fa;}if(_['isArray'](_0x3428fa)){for(var _0x1de1cd=0x0;_0x1de1cd<_0x3428fa['length'];_0x1de1cd+=0x1){_0x3428fa[_0x1de1cd]=this[_0x06df('0x21')](_0x3428fa[_0x1de1cd],_0xda95e);}return _0x3428fa;}if(!_[_0x06df('0x22')](_0x3428fa)){return _0x3428fa;}if(_[_0x06df('0x23')](_0xda95e)){_0xda95e=[_0xda95e];}if(!_[_0x06df('0x14')](_0xda95e)){return _0x3428fa;}for(var _0x5c6a9c=0x0;_0x5c6a9c<_0xda95e[_0x06df('0x24')];_0x5c6a9c+=0x1){_[_0x06df('0x25')](_0x3428fa,_0xda95e[_0x5c6a9c]);}for(var _0x1b111d in _0x3428fa){if(_0x3428fa[_0x06df('0x26')](_0x1b111d)){_0x3428fa[_0x1b111d]=this[_0x06df('0x21')](_0x3428fa[_0x1b111d],_0xda95e);}}return _0x3428fa;};exports['isNumeric']=function(_0x1b5b95){return _0x1b5b95[_0x06df('0x27')](RegExp(_0x06df('0x28')))?!![]:![];};exports['isEmail']=function(_0x4f2fd1){return _0x4f2fd1[_0x06df('0x27')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x31225a,_0x49238c){var _0x3c5c8c=[];var _0x2b19eb=/[ `!@#$%^&*()_\-?~]/;var _0x304c3e=_0x49238c?_0x06df('0x29'):'{EXPR}';_0x31225a['split'](/[ ,]+/)[_0x06df('0x2a')](function(_0x52069a){_0x52069a=_0x52069a[_0x06df('0x2b')](/([^:]")"+/g,'$1');_0x52069a='+'+_0x52069a+'*';var _0x36f7e0=_0x52069a[_0x06df('0x27')](_0x2b19eb);if(_0x36f7e0){_0x52069a='\x22'+_0x52069a+'\x22';}_0x3c5c8c['push'](_0x52069a);});_0x304c3e=_0x304c3e['replace']('{EXPR}',_0x3c5c8c[_0x06df('0x2c')]('\x20'));return _0x304c3e;};exports[_0x06df('0x2d')]=function(_0x354ca8,_0x2511dd,_0xa04100){var _0x441e37={},_0x839831={};if(_0x2511dd['query']['$id']){_0x2511dd[_0x06df('0x2e')]['id']=_0x2511dd['query'][_0x06df('0x2f')];delete _0x2511dd[_0x06df('0x2e')]['$id'];}_0x441e37[_0x06df('0x7')]=_[_0x06df('0x19')](_0x354ca8,_0x06df('0x12'));_0x441e37[_0x06df('0x2e')]=_[_0x06df('0x5')](_0x2511dd[_0x06df('0x2e')]);_0x441e37[_0x06df('0x30')]=_['intersection'](_0x441e37[_0x06df('0x7')],_0x441e37[_0x06df('0x2e')]);_0x839831[_0x06df('0x31')]=_[_0x06df('0x32')](_0x441e37[_0x06df('0x7')],this[_0x06df('0x33')](_0x2511dd[_0x06df('0x2e')]['fields']));_0x839831['attributes']=_0x839831[_0x06df('0x31')][_0x06df('0x24')]?_0x839831[_0x06df('0x31')]:_0x441e37[_0x06df('0x7')];if(!_0x2511dd['query'][_0x06df('0x26')](_0x06df('0x34'))){_0x839831[_0x06df('0x16')]=this[_0x06df('0x16')](_0x2511dd['query'][_0x06df('0x16')]);_0x839831['offset']=this[_0x06df('0x17')](_0x2511dd[_0x06df('0x2e')][_0x06df('0x17')]);}_0x839831[_0x06df('0x35')]=this['sort'](_0x2511dd[_0x06df('0x2e')]['sort']);_0x839831['where']=this[_0x06df('0x30')](_[_0x06df('0x36')](_0x2511dd[_0x06df('0x2e')],_0x441e37[_0x06df('0x30')]),_0x354ca8);if(_0x2511dd[_0x06df('0x2e')]['filter']){var _0x1ba1ee=_0x354ca8;var _0x513ce1=_0x2511dd[_0x06df('0x2e')]['filter'];if(typeof _0x513ce1===_0x06df('0x37')){_0x1ba1ee=_[_0x06df('0x38')](_0x354ca8,function(_0x577a7f){return _[_0x06df('0x6')](_0x513ce1[_0x06df('0x39')],_0x577a7f[_0x06df('0x12')]);});_0x513ce1=_0x513ce1['value'];}_0x839831[_0x06df('0x3a')]=_[_0x06df('0x3b')](_0x839831[_0x06df('0x3a')],{'$or':_['map'](_0x1ba1ee,function(_0x59e46a){if(_0x59e46a['type']!==_0x06df('0x3c')){if(_0xa04100){return sequelize[_0x06df('0x3a')](sequelize['fn'](_0x06df('0x3d'),sequelize['col'](_0x59e46a[_0x06df('0x12')])),{'$like':sequelize['fn'](_0x06df('0x3d'),'%'+_0x2511dd[_0x06df('0x2e')][_0x06df('0x38')]+'%')});}else{var _0x221577={};_0x221577[_0x59e46a[_0x06df('0x12')]]={'$like':'%'+_0x2511dd[_0x06df('0x2e')][_0x06df('0x38')]+'%'};return _0x221577;}}})});}_0x839831=_['merge']({},_0x839831,_0x2511dd[_0x06df('0x3e')]);return _0x839831;};exports[_0x06df('0x3f')]=function(_0x16b30a){var _0x2180e2=[];if(_0x16b30a['includeAll']){_0x2180e2[_0x06df('0x40')]({'all':!![]});}else if(_0x16b30a[_0x06df('0x3f')]){if(Array[_0x06df('0x14')](_0x16b30a[_0x06df('0x3f')])){_0x2180e2=Object[_0x06df('0x5')](_0x16b30a[_0x06df('0x3f')])[_0x06df('0x19')](function(_0x1e0626){return parseIncludeModel(_0x16b30a[_0x06df('0x3f')][_0x1e0626]);});}else{var _0x7c7909=parseIncludeModel(_0x16b30a[_0x06df('0x3f')]);_0x2180e2['push'](_0x7c7909);}}return _0x2180e2;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 2840da2..2e20f89 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 _0x9c5a=['getAgents','all','value','getAgentIdsByQueues','filter','includes','resolve','findAll','name','fullname','chatPause','mailPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','mailCapacity','smsCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','role','faxStatus','voiceStatusTime','chatCapacity','faxCapacity','chatCurrentCapacity','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','client','http','faxPause','openchannelPause','smsPause','every','length','idle','ringing','isNil','voiceStatus','voicePause','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','getAgentStatus','isArray','map','findOne'];(function(_0xfa4aa2,_0x2f92b6){var _0x228b11=function(_0x3a991f){while(--_0x3a991f){_0xfa4aa2['push'](_0xfa4aa2['shift']());}};_0x228b11(++_0x2f92b6);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4a60bc,_0x1bc067){_0x4a60bc=_0x4a60bc-0x0;var _0x179938=_0x9c5a[_0x4a60bc];return _0x179938;};'use strict';var _=require(_0xa9c5('0x0'));var jayson=require(_0xa9c5('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xa9c5('0x2')][_0xa9c5('0x3')]({'port':0x232a});var routingClient=jayson[_0xa9c5('0x2')][_0xa9c5('0x3')]({'port':0x232c});function isAgentPaused(_0x4f5552,_0x2acfaf){var _0x3051b1=[_0x4f5552['chatPause'],_0x4f5552[_0xa9c5('0x4')],_0x4f5552['mailPause'],_0x4f5552[_0xa9c5('0x5')],_0x4f5552[_0xa9c5('0x6')],_0x4f5552['voicePause'],_0x4f5552['whatsappPause']];if(!_0x2acfaf)return _[_0xa9c5('0x7')](_0x3051b1);var _0x16f331=_['filter'](_0x3051b1);return _0x16f331[_0xa9c5('0x8')]>0x0&&_0x16f331[_0xa9c5('0x8')]<_0x3051b1['length']?!![]:![];}function isIdle(_0x2e4f45){return _0x2e4f45===_0xa9c5('0x9')||_0x2e4f45==='unknown'||_0x2e4f45==='unavailable'||_0x2e4f45===_0xa9c5('0xa')||_[_0xa9c5('0xb')](_0x2e4f45);}function isAgentIdle(_0x45f8d8){if(_0x45f8d8[_0xa9c5('0xc')]!==_0xa9c5('0x9')&&_0x45f8d8[_0xa9c5('0xd')]){_0x45f8d8[_0xa9c5('0xc')]=_0xa9c5('0xe');return![];}return _[_0xa9c5('0x7')]([_0x45f8d8[_0xa9c5('0xf')],_0x45f8d8['faxStatus'],_0x45f8d8[_0xa9c5('0x10')],_0x45f8d8[_0xa9c5('0x11')],_0x45f8d8[_0xa9c5('0x12')],_0x45f8d8[_0xa9c5('0xc')],_0x45f8d8[_0xa9c5('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xa9c5('0x14')](_0xa9c5('0x15'),{})[_0xa9c5('0x16')](function(_0x19a43e){if(_0x19a43e[_0xa9c5('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x2b0d73=_0x19a43e[_0xa9c5('0x18')];return routingClient[_0xa9c5('0x14')]('Agents',{})[_0xa9c5('0x16')](function(_0x1142d9){if(_0x1142d9[_0xa9c5('0x17')]){throw new Error(_0xa9c5('0x19'));}var _0x452a9b=_0x1142d9[_0xa9c5('0x18')];return _[_0xa9c5('0x1a')]({},_0x2b0d73,_0x452a9b);});})[_0xa9c5('0x1b')](function(_0x2c7cd5){throw _0x2c7cd5;});}exports[_0xa9c5('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x113c8f){var _0x2d95f8='unknown';if(isAgentPaused(_0x113c8f))_0x2d95f8=_0xa9c5('0xe');else if(isAgentPaused(_0x113c8f,!![]))_0x2d95f8=_0xa9c5('0x1d');else if(isAgentIdle(_0x113c8f))_0x2d95f8='idle';else _0x2d95f8='busy';return _0x2d95f8;}exports[_0xa9c5('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x366f5c,_0x10b208){var _0x3b497a=_[_0xa9c5('0x1f')](_0x366f5c)?_0x366f5c:[_0x366f5c];var _0xd4b8a1=_['startCase'](_0x10b208)+'Queue';var _0x3d4e1b=_[_0xa9c5('0x20')](_0x3b497a,function(_0x4b0f05){return db[_0xd4b8a1][_0xa9c5('0x21')]({'where':{'id':_0x4b0f05}})[_0xa9c5('0x16')](function(_0x306c9b){if(!_0x306c9b)return[];return _0x306c9b[_0xa9c5('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xa9c5('0x23')](_0x3d4e1b)[_0xa9c5('0x16')](function(_0xe44e6d){var _0x51b64a=_(_0xe44e6d)['flatten']()[_0xa9c5('0x20')]('id')['uniq']()[_0xa9c5('0x24')]();return _0x51b64a;});}exports[_0xa9c5('0x25')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4caefa,_0x11a723,_0x320dc0){try{if(_0x11a723['length']>0x0){_0x4caefa=_0x4caefa[_0xa9c5('0x26')](function(_0x32baf9){return _0x11a723[_0xa9c5('0x27')](_0x32baf9['id']);});}var _0x185eb8=_0x4caefa[_0xa9c5('0x26')](function(_0x4f6e70){var _0x36f267='busy';if(isAgentIdle(_0x4f6e70)){_0x36f267=_0xa9c5('0x9');}return _0x36f267===_0x320dc0;});return _[_0xa9c5('0x20')](_0x185eb8,'id');}catch(_0x2eeed1){throw _0x2eeed1;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xc6d0c1,_0xbe29c5,_0x5bc9bb){return Promise[_0xa9c5('0x28')]()[_0xa9c5('0x16')](function(){if(_0xbe29c5[_0xa9c5('0x8')]>0x0){_0xc6d0c1=_0xc6d0c1[_0xa9c5('0x26')](function(_0x22ee21){return _0xbe29c5[_0xa9c5('0x27')](_0x22ee21['id']);});}return _0xc6d0c1;})[_0xa9c5('0x16')](function(){return db['User'][_0xa9c5('0x29')]({'attributes':['id',_0xa9c5('0x2a'),_0xa9c5('0x2b'),_0xa9c5('0x2c'),_0xa9c5('0x4'),_0xa9c5('0x2d'),_0xa9c5('0x5'),_0xa9c5('0x6'),'voicePause','whatsappPause',_0xa9c5('0x2e')],'where':{'id':{'$in':_[_0xa9c5('0x20')](_0xc6d0c1,'id')}},'raw':!![]});})[_0xa9c5('0x16')](function(_0x1313b2){return _0x1313b2[_0xa9c5('0x20')](function(_0x25121e){var _0x4dfdb5=_['find'](_0xc6d0c1,['id',_0x25121e['id']]);var _0x517b9a=filterAgentAttributes(_0x4dfdb5);_[_0xa9c5('0x1a')](_0x25121e,_0x517b9a);_0x25121e[_0xa9c5('0x2f')]=getAgentStatus(_0x25121e);return _0x25121e;});})['then'](function(_0x13a1f5){var _0x56eb82=sortAgentsByStatus(_0x13a1f5,_0x5bc9bb);return _[_0xa9c5('0x20')](_0x56eb82,'id');})[_0xa9c5('0x1b')](function(_0x2567be){throw _0x2567be;});}exports[_0xa9c5('0x30')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x593be8){var _0x675588={'fields':[],'order':null};var _0x2cd721=_0x593be8[_0xa9c5('0x31')](',');_0x675588[_0xa9c5('0x32')]=_[_0xa9c5('0x26')](_0x2cd721,function(_0x17ef8e){if(!_0x17ef8e[_0xa9c5('0x27')](_0xa9c5('0x2f'))){return!![];}_0x675588['order']=_[_0xa9c5('0x33')](_0x17ef8e,'-')?_0xa9c5('0x34'):_0xa9c5('0x35');return![];});return _0x675588;}exports[_0xa9c5('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x1132e0){if(!_0x1132e0){_0x1132e0=_0xa9c5('0x37');}if(_0x1132e0['includes'](_0xa9c5('0x2b'))&&!_0x1132e0['includes'](_0xa9c5('0x38'))){var _0x5c89e7=_0x1132e0[_0xa9c5('0x39')](0x0,_0x1132e0[_0xa9c5('0x3a')](_0xa9c5('0x2b')));_0x1132e0+=','+_0x5c89e7+'internal';}return _0x1132e0;}exports[_0xa9c5('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x1ddd72,_0x3a2b67){var _0x26dd0c=_0x1ddd72['sort'](function(_0x2dbb48,_0x97803f){if(_0x2dbb48[_0xa9c5('0x2f')]===_0x97803f[_0xa9c5('0x2f')]){if(_0x2dbb48[_0xa9c5('0x2f')]==='pause'){if(_0x3a2b67===_0xa9c5('0x34')){return(_0x2dbb48['pauseType']||'')<(_0x97803f[_0xa9c5('0x2e')]||'')||_0x2dbb48[_0xa9c5('0x2b')][_0xa9c5('0x3c')]()>_0x97803f[_0xa9c5('0x2b')][_0xa9c5('0x3c')]()?0x1:-0x1;}else{return(_0x2dbb48[_0xa9c5('0x2e')]||'')<(_0x97803f[_0xa9c5('0x2e')]||'')||_0x2dbb48[_0xa9c5('0x2b')][_0xa9c5('0x3c')]()>_0x97803f[_0xa9c5('0x2b')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x3a2b67===_0xa9c5('0x34')){return _0x2dbb48[_0xa9c5('0x2b')][_0xa9c5('0x3c')]()<_0x97803f[_0xa9c5('0x2b')][_0xa9c5('0x3c')]()?0x1:-0x1;}else{return _0x2dbb48[_0xa9c5('0x2b')]['toLowerCase']()<_0x97803f[_0xa9c5('0x2b')][_0xa9c5('0x3c')]()?-0x1:0x1;}}}else{if(_0x3a2b67==='DESC'){return _0x2dbb48['globalStatus']<_0x97803f['globalStatus']?0x1:-0x1;}else{return _0x2dbb48['globalStatus']<_0x97803f['globalStatus']?-0x1:0x1;}}});return _0x26dd0c;}exports[_0xa9c5('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x569185){var _0x245f9d=[_0xa9c5('0x3e'),_0xa9c5('0x3f'),_0xa9c5('0x40'),_0xa9c5('0x41'),_0xa9c5('0x2e'),_0xa9c5('0x41'),_0xa9c5('0x38'),_0xa9c5('0x42'),_0xa9c5('0x2c'),_0xa9c5('0x5'),'mailPause',_0xa9c5('0x6'),'whatsappPause',_0xa9c5('0x4'),_0xa9c5('0xd'),'chatCapacity','openchannelCapacity',_0xa9c5('0x43'),_0xa9c5('0x44'),_0xa9c5('0x45'),'faxCapacity','chatCurrentCapacity',_0xa9c5('0x46'),_0xa9c5('0x47'),'smsCurrentCapacity',_0xa9c5('0x48'),_0xa9c5('0x49'),_0xa9c5('0xf'),_0xa9c5('0x11'),_0xa9c5('0x10'),_0xa9c5('0x12'),'whatsappStatus','faxStatus','voiceStatus',_0xa9c5('0x4a'),_0xa9c5('0x4b'),_0xa9c5('0x4c'),_0xa9c5('0x4d'),_0xa9c5('0x4e'),_0xa9c5('0x4f'),'voiceStatusTime',_0xa9c5('0x50'),_0xa9c5('0x51'),_0xa9c5('0x52'),_0xa9c5('0x53'),_0xa9c5('0x54'),_0xa9c5('0x55')];var _0x547654=['chatPause',_0xa9c5('0x5'),'mailPause',_0xa9c5('0x6'),'whatsappPause',_0xa9c5('0x4'),_0xa9c5('0xd'),_0xa9c5('0x3f')];var _0x5c7d7c=_(_0x569185)[_0xa9c5('0x56')](_0x547654)[_0xa9c5('0x57')](_0x245f9d)[_0xa9c5('0x24')]();return _0x5c7d7c;}exports[_0xa9c5('0x58')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name','fullname',_0xa9c5('0x59'),_0xa9c5('0x38'),_0xa9c5('0x3f'),'globalStatus',_0xa9c5('0x3e'),_0xa9c5('0x40'),_0xa9c5('0x2e'),_0xa9c5('0x41'),_0xa9c5('0x4'),_0xa9c5('0x2c'),_0xa9c5('0x2d'),_0xa9c5('0x5'),'smsPause',_0xa9c5('0xd'),'whatsappPause',_0xa9c5('0xf'),_0xa9c5('0x5a'),_0xa9c5('0x10'),'openchannelStatus',_0xa9c5('0x12'),_0xa9c5('0xc'),'whatsappStatus',_0xa9c5('0x4a'),_0xa9c5('0x4f'),_0xa9c5('0x4c'),_0xa9c5('0x4b'),'smsStatusTime',_0xa9c5('0x5b'),_0xa9c5('0x4e'),_0xa9c5('0x5c'),_0xa9c5('0x5d'),'mailCapacity','openchannelCapacity',_0xa9c5('0x44'),_0xa9c5('0x45'),_0xa9c5('0x5e'),_0xa9c5('0x49'),_0xa9c5('0x47'),_0xa9c5('0x46'),'smsCurrentCapacity',_0xa9c5('0x48'),_0xa9c5('0x53'),_0xa9c5('0x54'),_0xa9c5('0x51'),_0xa9c5('0x5f'),_0xa9c5('0x50'),_0xa9c5('0x55'),_0xa9c5('0x52')];}exports[_0xa9c5('0x60')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xdc97=['openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','value','filterAgentAttributes','role','userpic','voiceStatusTime','mailCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','chatPause','faxPause','mailPause','smsPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','voiceStatus','whatsappStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','isArray','Queue','map','findOne','uniq','getAgentIdsByQueues','includes','resolve','name','openchannelPause','voicePause','whatsappPause','pauseType','find','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','DESC','ASC','fullname,internal','fullname','internal','substring','indexOf','toLowerCase','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus'];(function(_0x527dc5,_0x1de7e7){var _0x216de9=function(_0xde9c52){while(--_0xde9c52){_0x527dc5['push'](_0x527dc5['shift']());}};_0x216de9(++_0x1de7e7);}(_0xdc97,0x13b));var _0x7dc9=function(_0x50b3a5,_0x5934f4){_0x50b3a5=_0x50b3a5-0x0;var _0x118acb=_0xdc97[_0x50b3a5];return _0x118acb;};'use strict';var _=require(_0x7dc9('0x0'));var jayson=require(_0x7dc9('0x1'));var db=require(_0x7dc9('0x2'))['db'];var amiClient=jayson['client'][_0x7dc9('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x7dc9('0x3')]({'port':0x232c});function isAgentPaused(_0x2b86da,_0x478a95){var _0x2a77c1=[_0x2b86da[_0x7dc9('0x4')],_0x2b86da[_0x7dc9('0x5')],_0x2b86da[_0x7dc9('0x6')],_0x2b86da['openchannelPause'],_0x2b86da[_0x7dc9('0x7')],_0x2b86da['voicePause'],_0x2b86da['whatsappPause']];if(!_0x478a95)return _[_0x7dc9('0x8')](_0x2a77c1);var _0x23737d=_[_0x7dc9('0x9')](_0x2a77c1);return _0x23737d[_0x7dc9('0xa')]>0x0&&_0x23737d[_0x7dc9('0xa')]<_0x2a77c1['length']?!![]:![];}function isIdle(_0xb2fa2a){return _0xb2fa2a===_0x7dc9('0xb')||_0xb2fa2a===_0x7dc9('0xc')||_0xb2fa2a===_0x7dc9('0xd')||_0xb2fa2a===_0x7dc9('0xe')||_[_0x7dc9('0xf')](_0xb2fa2a);}function isAgentIdle(_0x1e336a){if(_0x1e336a['voiceStatus']!=='idle'&&_0x1e336a['voicePause']){_0x1e336a['voiceStatus']=_0x7dc9('0x10');return![];}return _[_0x7dc9('0x8')]([_0x1e336a['chatStatus'],_0x1e336a[_0x7dc9('0x11')],_0x1e336a[_0x7dc9('0x12')],_0x1e336a[_0x7dc9('0x13')],_0x1e336a[_0x7dc9('0x14')],_0x1e336a[_0x7dc9('0x15')],_0x1e336a[_0x7dc9('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x7dc9('0x17'),{})[_0x7dc9('0x18')](function(_0x1b0aa1){if(_0x1b0aa1[_0x7dc9('0x19')]){throw new Error(_0x7dc9('0x1a'));}var _0xbe0437=_0x1b0aa1[_0x7dc9('0x1b')];return routingClient[_0x7dc9('0x1c')](_0x7dc9('0x17'),{})['then'](function(_0x22577e){if(_0x22577e['error']){throw new Error(_0x7dc9('0x1d'));}var _0x1cc237=_0x22577e['result'];return _[_0x7dc9('0x1e')]({},_0xbe0437,_0x1cc237);});})[_0x7dc9('0x1f')](function(_0x12f08d){throw _0x12f08d;});}exports[_0x7dc9('0x20')]=getRealtimeAgents;function getAgentStatus(_0x43ec33){var _0x184bfd=_0x7dc9('0xc');if(isAgentPaused(_0x43ec33))_0x184bfd=_0x7dc9('0x10');else if(isAgentPaused(_0x43ec33,!![]))_0x184bfd=_0x7dc9('0x21');else if(isAgentIdle(_0x43ec33))_0x184bfd=_0x7dc9('0xb');else _0x184bfd='busy';return _0x184bfd;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x12954f,_0x5981e2){var _0x596e0f=_[_0x7dc9('0x22')](_0x12954f)?_0x12954f:[_0x12954f];var _0x27f7fa=_['startCase'](_0x5981e2)+_0x7dc9('0x23');var _0x43d31f=_[_0x7dc9('0x24')](_0x596e0f,function(_0x4906b1){return db[_0x27f7fa][_0x7dc9('0x25')]({'where':{'id':_0x4906b1}})[_0x7dc9('0x18')](function(_0xf95336){if(!_0xf95336)return[];return _0xf95336['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x43d31f)['then'](function(_0x25b383){var _0x32d032=_(_0x25b383)['flatten']()['map']('id')[_0x7dc9('0x26')]()['value']();return _0x32d032;});}exports[_0x7dc9('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1c690b,_0x3a74a0,_0x3e4102){try{if(_0x3a74a0[_0x7dc9('0xa')]>0x0){_0x1c690b=_0x1c690b[_0x7dc9('0x9')](function(_0x236d42){return _0x3a74a0[_0x7dc9('0x28')](_0x236d42['id']);});}var _0x1fcf0e=_0x1c690b[_0x7dc9('0x9')](function(_0x14083d){var _0x2a456c='busy';if(isAgentIdle(_0x14083d)){_0x2a456c='idle';}return _0x2a456c===_0x3e4102;});return _['map'](_0x1fcf0e,'id');}catch(_0x49a4a5){throw _0x49a4a5;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x553a03,_0x58c4e8,_0x59f5d8){return Promise[_0x7dc9('0x29')]()[_0x7dc9('0x18')](function(){if(_0x58c4e8[_0x7dc9('0xa')]>0x0){_0x553a03=_0x553a03[_0x7dc9('0x9')](function(_0x3300ff){return _0x58c4e8[_0x7dc9('0x28')](_0x3300ff['id']);});}return _0x553a03;})['then'](function(){return db['User']['findAll']({'attributes':['id',_0x7dc9('0x2a'),'fullname',_0x7dc9('0x4'),_0x7dc9('0x5'),_0x7dc9('0x6'),_0x7dc9('0x2b'),_0x7dc9('0x7'),_0x7dc9('0x2c'),_0x7dc9('0x2d'),_0x7dc9('0x2e')],'where':{'id':{'$in':_['map'](_0x553a03,'id')}},'raw':!![]});})[_0x7dc9('0x18')](function(_0x4cdec4){return _0x4cdec4[_0x7dc9('0x24')](function(_0x16431a){var _0x3dc8e0=_[_0x7dc9('0x2f')](_0x553a03,['id',_0x16431a['id']]);var _0x48d9b2=filterAgentAttributes(_0x3dc8e0);_[_0x7dc9('0x1e')](_0x16431a,_0x48d9b2);_0x16431a['globalStatus']=getAgentStatus(_0x16431a);return _0x16431a;});})[_0x7dc9('0x18')](function(_0x4f47af){var _0x590bed=sortAgentsByStatus(_0x4f47af,_0x59f5d8);return _[_0x7dc9('0x24')](_0x590bed,'id');})[_0x7dc9('0x1f')](function(_0x21e036){throw _0x21e036;});}exports[_0x7dc9('0x30')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5dac5b){var _0x9376a5={'fields':[],'order':null};var _0x183d87=_0x5dac5b[_0x7dc9('0x31')](',');_0x9376a5[_0x7dc9('0x32')]=_[_0x7dc9('0x9')](_0x183d87,function(_0x21faa6){if(!_0x21faa6[_0x7dc9('0x28')](_0x7dc9('0x33'))){return!![];}_0x9376a5[_0x7dc9('0x34')]=_[_0x7dc9('0x35')](_0x21faa6,'-')?_0x7dc9('0x36'):_0x7dc9('0x37');return![];});return _0x9376a5;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x34b5c9){if(!_0x34b5c9){_0x34b5c9=_0x7dc9('0x38');}if(_0x34b5c9[_0x7dc9('0x28')](_0x7dc9('0x39'))&&!_0x34b5c9['includes'](_0x7dc9('0x3a'))){var _0x89db0e=_0x34b5c9[_0x7dc9('0x3b')](0x0,_0x34b5c9[_0x7dc9('0x3c')](_0x7dc9('0x39')));_0x34b5c9+=','+_0x89db0e+_0x7dc9('0x3a');}return _0x34b5c9;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x553230,_0x3ef9fd){var _0x36a965=_0x553230['sort'](function(_0x3a705c,_0x4a37ec){if(_0x3a705c[_0x7dc9('0x33')]===_0x4a37ec[_0x7dc9('0x33')]){if(_0x3a705c[_0x7dc9('0x33')]==='pause'){if(_0x3ef9fd===_0x7dc9('0x36')){return(_0x3a705c[_0x7dc9('0x2e')]||'')<(_0x4a37ec[_0x7dc9('0x2e')]||'')||_0x3a705c[_0x7dc9('0x39')][_0x7dc9('0x3d')]()>_0x4a37ec[_0x7dc9('0x39')][_0x7dc9('0x3d')]()?0x1:-0x1;}else{return(_0x3a705c['pauseType']||'')<(_0x4a37ec[_0x7dc9('0x2e')]||'')||_0x3a705c['fullname']['toLowerCase']()>_0x4a37ec[_0x7dc9('0x39')][_0x7dc9('0x3d')]()?-0x1:0x1;}}else{if(_0x3ef9fd===_0x7dc9('0x36')){return _0x3a705c[_0x7dc9('0x39')][_0x7dc9('0x3d')]()<_0x4a37ec[_0x7dc9('0x39')][_0x7dc9('0x3d')]()?0x1:-0x1;}else{return _0x3a705c[_0x7dc9('0x39')][_0x7dc9('0x3d')]()<_0x4a37ec['fullname'][_0x7dc9('0x3d')]()?-0x1:0x1;}}}else{if(_0x3ef9fd===_0x7dc9('0x36')){return _0x3a705c[_0x7dc9('0x33')]<_0x4a37ec[_0x7dc9('0x33')]?0x1:-0x1;}else{return _0x3a705c[_0x7dc9('0x33')]<_0x4a37ec[_0x7dc9('0x33')]?-0x1:0x1;}}});return _0x36a965;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x3774cb){var _0x42e110=['userpic',_0x7dc9('0x3e'),_0x7dc9('0x3f'),_0x7dc9('0x40'),'pauseType',_0x7dc9('0x40'),'internal','address',_0x7dc9('0x4'),_0x7dc9('0x2b'),_0x7dc9('0x6'),'smsPause','whatsappPause',_0x7dc9('0x5'),'voicePause',_0x7dc9('0x41'),_0x7dc9('0x42'),'mailCapacity',_0x7dc9('0x43'),_0x7dc9('0x44'),_0x7dc9('0x45'),_0x7dc9('0x46'),_0x7dc9('0x47'),_0x7dc9('0x48'),_0x7dc9('0x49'),_0x7dc9('0x4a'),_0x7dc9('0x4b'),_0x7dc9('0x4c'),_0x7dc9('0x13'),_0x7dc9('0x12'),_0x7dc9('0x14'),'whatsappStatus',_0x7dc9('0x11'),'voiceStatus','chatStatusTime',_0x7dc9('0x4d'),_0x7dc9('0x4e'),_0x7dc9('0x4f'),_0x7dc9('0x50'),_0x7dc9('0x51'),'voiceStatusTime',_0x7dc9('0x52'),_0x7dc9('0x53'),_0x7dc9('0x54'),'phoneBarEnableScreenRecordingByAgent',_0x7dc9('0x55'),_0x7dc9('0x56')];var _0x2cf133=[_0x7dc9('0x4'),_0x7dc9('0x2b'),_0x7dc9('0x6'),'smsPause',_0x7dc9('0x2d'),_0x7dc9('0x5'),_0x7dc9('0x2c'),_0x7dc9('0x3e')];var _0x877a67=_(_0x3774cb)[_0x7dc9('0x57')](_0x2cf133)[_0x7dc9('0x58')](_0x42e110)[_0x7dc9('0x59')]();return _0x877a67;}exports[_0x7dc9('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7dc9('0x2a'),_0x7dc9('0x39'),_0x7dc9('0x5b'),'internal',_0x7dc9('0x3e'),_0x7dc9('0x33'),_0x7dc9('0x5c'),_0x7dc9('0x3f'),_0x7dc9('0x2e'),'lastPauseAt',_0x7dc9('0x5'),_0x7dc9('0x4'),_0x7dc9('0x6'),_0x7dc9('0x2b'),_0x7dc9('0x7'),_0x7dc9('0x2c'),'whatsappPause','chatStatus','faxStatus',_0x7dc9('0x12'),_0x7dc9('0x13'),_0x7dc9('0x14'),_0x7dc9('0x15'),'whatsappStatus','chatStatusTime',_0x7dc9('0x51'),_0x7dc9('0x4e'),_0x7dc9('0x4d'),_0x7dc9('0x4f'),_0x7dc9('0x5d'),_0x7dc9('0x50'),_0x7dc9('0x41'),'faxCapacity',_0x7dc9('0x5e'),_0x7dc9('0x42'),_0x7dc9('0x43'),_0x7dc9('0x44'),_0x7dc9('0x46'),'faxCurrentCapacity',_0x7dc9('0x48'),_0x7dc9('0x47'),_0x7dc9('0x49'),_0x7dc9('0x4a'),_0x7dc9('0x5f'),_0x7dc9('0x55'),_0x7dc9('0x53'),_0x7dc9('0x60'),_0x7dc9('0x52'),_0x7dc9('0x56'),_0x7dc9('0x54')];}exports[_0x7dc9('0x61')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 3a2dc78..14ff00b 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 _0x1336=['onHold','ringing','talking','unavailable','pTalking','message','statusMessage','dialActive','Trunk','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','startCase','Queues','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','map','outbound','originated','find','merge','pick','initializeQueues','jayson/promise','util','client','http','available','paused','waiting','busy','invalid','loggedInDb','notInUse'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1336,0x175));var _0x6133=function(_0x1af776,_0x1c4d12){_0x1af776=_0x1af776-0x0;var _0x4c4cde=_0x1336[_0x1af776];return _0x4c4cde;};'use strict';var _=require('lodash');var jayson=require(_0x6133('0x0'));var util=require(_0x6133('0x1'));var amiClient=jayson[_0x6133('0x2')][_0x6133('0x3')]({'port':0x232a});var routingClient=jayson[_0x6133('0x2')][_0x6133('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x6133('0x4'),'loggedIn',_0x6133('0x5'),_0x6133('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x6133('0x7'),'inUse',_0x6133('0x8'),_0x6133('0x9'),_0x6133('0xa'),_0x6133('0xb'),_0x6133('0xc'),'ringInUse',_0x6133('0xd'),_0x6133('0xe'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x6133('0xf'),'originated',_0x6133('0x10'),_0x6133('0x11'),_0x6133('0x12'),'dialMethod',_0x6133('0x13'),'startPredictive','startProgressive',_0x6133('0x14'),_0x6133('0x15'),_0x6133('0x16'),_0x6133('0x17'),_0x6133('0x18'),'dialPredictiveIntervalMaxThreshold',_0x6133('0x19'),_0x6133('0x1a'),_0x6133('0x1b'),_0x6133('0x1c'),_0x6133('0x1d'),_0x6133('0x1e'),_0x6133('0x1f'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x323803,_0x1eb143){var _0x1bfd16=_0x1eb143===_0x6133('0x20')?amiClient:routingClient;return _0x1bfd16['request'](_[_0x6133('0x21')](_0x1eb143)+_0x6133('0x22'),_0x323803)['then'](function(_0x6d41ec){if(_0x6d41ec[_0x6133('0x23')])throw new Error(util['format'](_0x6133('0x24'),_0x1eb143));return _0x6d41ec[_0x6133('0x25')];})['catch'](function(_0x9eccba){throw _0x9eccba;});}exports[_0x6133('0x26')]=getRealtimeQueues;function initializeQueues(_0x3241cd,_0x2b8375,_0x504c7e,_0x134b6b){var _0x12f6e2=DEFAULT_QUEUE_ATTRIBUTES;if(_0x504c7e==='voice'){if(_0x134b6b===_0x6133('0x27')){_0x12f6e2=_0x12f6e2[_0x6133('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x134b6b==='outbound'){_0x12f6e2=_0x12f6e2[_0x6133('0x28')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3241cd[_0x6133('0x29')](function(_0x30bb99){var _0x41b63e=_0x30bb99['get']({'plain':!![]});_0x41b63e['paused']=0x0;_0x41b63e['loggedInDb']=0x0;_0x41b63e['loggedIn']=0x0;_0x41b63e[_0x6133('0x4')]=0x0;_0x41b63e['waiting']=0x0;if(_0x504c7e===_0x6133('0x20')){_0x41b63e['talking']=0x0;_0x41b63e[_0x6133('0x7')]=0x0;if(_0x134b6b===_0x6133('0x2a')){_0x41b63e[_0x6133('0xf')]=0x0;_0x41b63e[_0x6133('0x2b')]=0x0;}}var _0x40912e=_[_0x6133('0x2c')](_0x2b8375,['id',_0x41b63e['id']]);if(_0x40912e){_[_0x6133('0x2d')](_0x41b63e,_[_0x6133('0x2e')](_0x40912e,_0x12f6e2));}return _0x41b63e;});}exports[_0x6133('0x2f')]=initializeQueues; \ No newline at end of file +var _0xd4e9=['predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','available','talking','find','merge','pick','lodash','jayson/promise','util','client','http','loggedIn','paused','waiting','busy','invalid','loggedInDb','notInUse','onHold','ringing','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','Trunk','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd4e9,0x85));var _0x9d4e=function(_0x3c5b1f,_0x2d1eab){_0x3c5b1f=_0x3c5b1f-0x0;var _0x5b740f=_0xd4e9[_0x3c5b1f];return _0x5b740f;};'use strict';var _=require(_0x9d4e('0x0'));var jayson=require(_0x9d4e('0x1'));var util=require(_0x9d4e('0x2'));var amiClient=jayson[_0x9d4e('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x9d4e('0x3')][_0x9d4e('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x9d4e('0x5'),_0x9d4e('0x6'),_0x9d4e('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x9d4e('0x8'),'inUse',_0x9d4e('0x9'),_0x9d4e('0xa'),_0x9d4e('0xb'),_0x9d4e('0xc'),_0x9d4e('0xd'),'ringInUse','talking',_0x9d4e('0xe'),_0x9d4e('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x9d4e('0x10'),_0x9d4e('0x11'),_0x9d4e('0x12'),_0x9d4e('0x13'),_0x9d4e('0x14'),'dialMethod',_0x9d4e('0x15'),'startPredictive',_0x9d4e('0x16'),_0x9d4e('0x17'),'erlangCallToSecond',_0x9d4e('0x18'),_0x9d4e('0x19'),_0x9d4e('0x1a'),'dialPredictiveIntervalMaxThreshold',_0x9d4e('0x1b'),_0x9d4e('0x1c'),_0x9d4e('0x1d'),'predictiveIntervalAnsweredCalls',_0x9d4e('0x1e'),_0x9d4e('0x1f'),_0x9d4e('0x20'),_0x9d4e('0x21')];function getRealtimeQueues(_0x2ba874,_0x45aec8){var _0x5340d3=_0x45aec8===_0x9d4e('0x22')?amiClient:routingClient;return _0x5340d3[_0x9d4e('0x23')](_[_0x9d4e('0x24')](_0x45aec8)+'Queues',_0x2ba874)[_0x9d4e('0x25')](function(_0x4477f7){if(_0x4477f7[_0x9d4e('0x26')])throw new Error(util[_0x9d4e('0x27')](_0x9d4e('0x28'),_0x45aec8));return _0x4477f7[_0x9d4e('0x29')];})[_0x9d4e('0x2a')](function(_0x29b8bd){throw _0x29b8bd;});}exports[_0x9d4e('0x2b')]=getRealtimeQueues;function initializeQueues(_0x37085d,_0x19eca4,_0x46ed21,_0xdef9cc){var _0x3896ab=DEFAULT_QUEUE_ATTRIBUTES;if(_0x46ed21==='voice'){if(_0xdef9cc===_0x9d4e('0x2c')){_0x3896ab=_0x3896ab[_0x9d4e('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0xdef9cc===_0x9d4e('0x2e')){_0x3896ab=_0x3896ab[_0x9d4e('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x37085d[_0x9d4e('0x2f')](function(_0x305039){var _0x26eafb=_0x305039[_0x9d4e('0x30')]({'plain':!![]});_0x26eafb['paused']=0x0;_0x26eafb[_0x9d4e('0xa')]=0x0;_0x26eafb[_0x9d4e('0x5')]=0x0;_0x26eafb[_0x9d4e('0x31')]=0x0;_0x26eafb[_0x9d4e('0x7')]=0x0;if(_0x46ed21===_0x9d4e('0x22')){_0x26eafb[_0x9d4e('0x32')]=0x0;_0x26eafb['busy']=0x0;if(_0xdef9cc===_0x9d4e('0x2e')){_0x26eafb[_0x9d4e('0x10')]=0x0;_0x26eafb[_0x9d4e('0x11')]=0x0;}}var _0x450e82=_[_0x9d4e('0x33')](_0x19eca4,['id',_0x26eafb['id']]);if(_0x450e82){_[_0x9d4e('0x34')](_0x26eafb,_[_0x9d4e('0x35')](_0x450e82,_0x3896ab));}return _0x26eafb;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index cbe8730..0348289 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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(_0x3ed1c1,_0x45fe0a){var _0x11797d=function(_0x26bad3){while(--_0x26bad3){_0x3ed1c1['push'](_0x3ed1c1['shift']());}};_0x11797d(++_0x45fe0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 +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(_0x506002,_0x17ad62){var _0x5a020c=function(_0xf907bc){while(--_0xf907bc){_0x506002['push'](_0x506002['shift']());}};_0x5a020c(++_0x17ad62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 73ab7a5..a9fcadf 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 _0x4b22=['getFirstInterface','map','join','createHash','md5','digest','hex','getUuid','platform','licenseToken','win32','utf8','replace','ipAddress','update','substring','lodash','crypto','child_process','execSync','networkInterfaces','orderBy','keys','filter','IPv4','internal','head','mac','00:00:00:00:00:00','address'];(function(_0x41a6c9,_0x288c65){var _0x4de8d3=function(_0xd1b16e){while(--_0xd1b16e){_0x41a6c9['push'](_0x41a6c9['shift']());}};_0x4de8d3(++_0x288c65);}(_0x4b22,0x196));var _0x24b2=function(_0x184a5f,_0x30896e){_0x184a5f=_0x184a5f-0x0;var _0x5cacbc=_0x4b22[_0x184a5f];return _0x5cacbc;};'use strict';var _=require(_0x24b2('0x0'));var os=require('os');var crypto=require(_0x24b2('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x24b2('0x2'))[_0x24b2('0x3')];var config=require('../environment');function getInterfaces(){var _0x542e62=[];var _0x333c1e=os[_0x24b2('0x4')]();var _0x13d470=_[_0x24b2('0x5')](_[_0x24b2('0x6')](_0x333c1e));for(var _0x123dd9=0x0;_0x123dd9<_0x13d470['length'];_0x123dd9++){var _0x5ed86c=_0x333c1e[_0x13d470[_0x123dd9]][_0x24b2('0x7')](function(_0xc2ab23){return _0xc2ab23['family']===_0x24b2('0x8')&&_0xc2ab23[_0x24b2('0x9')]===![];});_0x542e62=_0x542e62['concat'](_0x5ed86c);}return _0x542e62;}function getFirstInterface(){var _0x4f9a86=_[_0x24b2('0xa')](getInterfaces());return{'macAddress':_0x4f9a86&&_0x4f9a86[_0x24b2('0xb')]?_0x4f9a86['mac']:_0x24b2('0xc'),'ipAddress':_0x4f9a86&&_0x4f9a86[_0x24b2('0xd')]?_0x4f9a86[_0x24b2('0xd')]:'127.0.0.1'};}exports[_0x24b2('0xe')]=getFirstInterface;function getCPUhash(){var _0x5b9b1e=_['orderBy'](os['cpus']()[_0x24b2('0xf')](function(_0x2e629c){return _0x2e629c['model'];}))[_0x24b2('0x10')](':');return crypto[_0x24b2('0x11')](_0x24b2('0x12'))['update'](_0x5b9b1e)[_0x24b2('0x13')](_0x24b2('0x14'));}exports[_0x24b2('0x15')]=function(){var _0xc3675f=os[_0x24b2('0x16')]();var _0x49e757=/[0-9a-f-]{36}/;if(config[_0x24b2('0x17')]&&_0x49e757['test'](config['licenseToken'])){return config[_0x24b2('0x17')];}else if(_0xc3675f===_0x24b2('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x24b2('0x19')})[_0x24b2('0x1a')]('\x0d\x0a','');}else{var _0x4947af=getFirstInterface();var _0x4f828e=getCPUhash();var _0x3eb262=_0x4f828e+'|'+os['hostname']()+'|'+_0x4947af['macAddress']+'|'+_0x4947af[_0x24b2('0x1b')];var _0x45f99c=crypto['createHash'](_0x24b2('0x12'))[_0x24b2('0x1c')](_0x3eb262)[_0x24b2('0x13')](_0x24b2('0x14'));return _0x45f99c[_0x24b2('0x1d')](0x0,0x8)+'-'+_0x45f99c[_0x24b2('0x1d')](0x8,0xc)+'-'+_0x45f99c[_0x24b2('0x1d')](0xc,0x10)+'-'+_0x45f99c['substring'](0x10,0x14)+'-'+_0x45f99c[_0x24b2('0x1d')](0x14);}}; \ No newline at end of file +var _0xc326=['keys','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','join','md5','update','digest','hex','getUuid','platform','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','lodash','crypto','child_process','execSync','orderBy'];(function(_0x18fcd6,_0x173104){var _0x404291=function(_0x1811db){while(--_0x1811db){_0x18fcd6['push'](_0x18fcd6['shift']());}};_0x404291(++_0x173104);}(_0xc326,0xc1));var _0x6c32=function(_0x384f7c,_0xb36fe2){_0x384f7c=_0x384f7c-0x0;var _0x309aac=_0xc326[_0x384f7c];return _0x309aac;};'use strict';var _=require(_0x6c32('0x0'));var os=require('os');var crypto=require(_0x6c32('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x6c32('0x2'))[_0x6c32('0x3')];var config=require('../environment');function getInterfaces(){var _0x310240=[];var _0x59c245=os['networkInterfaces']();var _0x503e40=_[_0x6c32('0x4')](_[_0x6c32('0x5')](_0x59c245));for(var _0x2e7f27=0x0;_0x2e7f27<_0x503e40[_0x6c32('0x6')];_0x2e7f27++){var _0x5c8e06=_0x59c245[_0x503e40[_0x2e7f27]][_0x6c32('0x7')](function(_0x338825){return _0x338825[_0x6c32('0x8')]===_0x6c32('0x9')&&_0x338825[_0x6c32('0xa')]===![];});_0x310240=_0x310240[_0x6c32('0xb')](_0x5c8e06);}return _0x310240;}function getFirstInterface(){var _0x50ec56=_['head'](getInterfaces());return{'macAddress':_0x50ec56&&_0x50ec56[_0x6c32('0xc')]?_0x50ec56[_0x6c32('0xc')]:_0x6c32('0xd'),'ipAddress':_0x50ec56&&_0x50ec56[_0x6c32('0xe')]?_0x50ec56[_0x6c32('0xe')]:'127.0.0.1'};}exports[_0x6c32('0xf')]=getFirstInterface;function getCPUhash(){var _0xdc249e=_[_0x6c32('0x4')](os[_0x6c32('0x10')]()[_0x6c32('0x11')](function(_0x16e1e8){return _0x16e1e8['model'];}))[_0x6c32('0x12')](':');return crypto['createHash'](_0x6c32('0x13'))[_0x6c32('0x14')](_0xdc249e)[_0x6c32('0x15')](_0x6c32('0x16'));}exports[_0x6c32('0x17')]=function(){var _0x961009=os[_0x6c32('0x18')]();var _0x352558=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x352558[_0x6c32('0x19')](config['licenseToken'])){return config[_0x6c32('0x1a')];}else if(_0x961009==='win32'){return exec(_0x6c32('0x1b'),{'encoding':_0x6c32('0x1c')})[_0x6c32('0x1d')]('\x0d\x0a','');}else{var _0x441c53=getFirstInterface();var _0x5956ee=getCPUhash();var _0x526376=_0x5956ee+'|'+os[_0x6c32('0x1e')]()+'|'+_0x441c53[_0x6c32('0x1f')]+'|'+_0x441c53['ipAddress'];var _0x381798=crypto['createHash'](_0x6c32('0x13'))[_0x6c32('0x14')](_0x526376)['digest'](_0x6c32('0x16'));return _0x381798[_0x6c32('0x20')](0x0,0x8)+'-'+_0x381798[_0x6c32('0x20')](0x8,0xc)+'-'+_0x381798['substring'](0xc,0x10)+'-'+_0x381798['substring'](0x10,0x14)+'-'+_0x381798['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index e240863..3f8231c 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 _0x25aa=['active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data2','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','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'];(function(_0x347ea8,_0x2ac098){var _0x2e83f4=function(_0x430d5f){while(--_0x430d5f){_0x347ea8['push'](_0x347ea8['shift']());}};_0x2e83f4(++_0x2ac098);}(_0x25aa,0x15d));var _0xa25a=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x25aa[_0xda464c];return _0x19e222;};'use strict';var util=require(_0xa25a('0x0'));var moment=require(_0xa25a('0x1'));var rp=require(_0xa25a('0x2'));var BPromise=require(_0xa25a('0x3'));var pkginfo=require('pkginfo')(module,_0xa25a('0x4'));var db=require(_0xa25a('0x5'))['db'];var encryptor=require(_0xa25a('0x6'));var hardware=require(_0xa25a('0x7'));var logger=require(_0xa25a('0x8'))(_0xa25a('0x9'));var HOST=_0xa25a('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5aab07){return new BPromise(function(_0x4bdddf,_0xa658c8){var _0x1ebf16=util[_0xa25a('0xb')](_0xa25a('0xc'),HOST,_0x5aab07,module[_0xa25a('0xd')]['version']);if(oldToken){_0x1ebf16=util[_0xa25a('0xb')](_0xa25a('0xe'),HOST,_0x5aab07,module[_0xa25a('0xd')]['version'],oldToken);}var _0x26a8d5={'uri':_0x1ebf16,'method':_0xa25a('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x26a8d5)[_0xa25a('0x10')](function(_0x53ac1d){_0x4bdddf(_0x53ac1d);})[_0xa25a('0x11')](function(_0x326d00){_0xa658c8(_0x326d00);});});}function manageLicense(_0xfd0552,_0x57aacd){var _0x46e65e=_0x57aacd[_0xa25a('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x46e65e[_0xa25a('0x13')]!==_0xfd0552&&!_0x46e65e['data2']){oldToken=_0x46e65e[_0xa25a('0x13')];}httpRequest(_0xfd0552)['then'](function(_0x1101a9){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1101a9[_0xa25a('0x14')]){isOldTokenSent=![];if(!_0x46e65e['license']&&_0x46e65e[_0xa25a('0x9')]!=_0x1101a9[_0xa25a('0x9')]||_0x46e65e[_0xa25a('0x9')]&&_0x46e65e['data2']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x46e65e[_0xa25a('0x9')]&&!_0x46e65e['data2']&&_0x46e65e[_0xa25a('0x9')]!=_0x1101a9['license']){logger[_0xa25a('0x15')](_0xa25a('0x16'));}if(_0x46e65e[_0xa25a('0x9')]&&!_0x46e65e[_0xa25a('0x17')]&&_0x46e65e[_0xa25a('0x9')]==_0x1101a9[_0xa25a('0x9')]){return _0x57aacd;}return _0x57aacd[_0xa25a('0x18')]({'data1':_0xfd0552,'data2':null,'license':_0x1101a9[_0xa25a('0x9')]});}else{if(_0x1101a9['license']||_0x46e65e[_0xa25a('0x9')]){if(!_0x46e65e[_0xa25a('0x17')]){if(_0x46e65e[_0xa25a('0x13')]==_0xfd0552){GRAY_PERIOD_REASON=_0xa25a('0x19');logger[_0xa25a('0x15')](_0xa25a('0x1a'));}else{GRAY_PERIOD_REASON=_0xa25a('0x1b');logger[_0xa25a('0x15')](_0xa25a('0x1c'),_0x46e65e[_0xa25a('0x13')],_0xfd0552);}logger[_0xa25a('0x15')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0xa25a('0x1d')));return _0x57aacd[_0xa25a('0x18')]({'data2':encryptor[_0xa25a('0x1e')](moment()[_0xa25a('0xb')](_0xa25a('0x1d')))});}else{if(moment()['diff'](encryptor[_0xa25a('0x1f')](_0x46e65e[_0xa25a('0x17')]),_0xa25a('0x20'))>DAYS){logger[_0xa25a('0x15')](_0xa25a('0x21'),moment()[_0xa25a('0xb')](_0xa25a('0x1d')));isOldTokenSent=![];return _0x57aacd['update']({'data1':_0xfd0552,'data2':null,'license':null});}}}else{if(_0x46e65e[_0xa25a('0x13')]!=_0xfd0552){logger[_0xa25a('0x15')](_0xa25a('0x1c'),_0x46e65e[_0xa25a('0x13')],_0xfd0552);return _0x57aacd[_0xa25a('0x18')]({'data1':_0xfd0552,'data2':null,'license':null});}}}return _0x57aacd;})[_0xa25a('0x10')](function(_0x1a0b84){_0x57aacd=_0x1a0b84;})[_0xa25a('0x11')](function(_0x3abc77){logger[_0xa25a('0x22')](_0x3abc77[_0xa25a('0x23')]);})[_0xa25a('0x24')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x57aacd);},TIME);});}function defaultLicense(){var _0x2aa10b=hardware[_0xa25a('0x25')]();if(_0x2aa10b){return db[_0xa25a('0x26')][_0xa25a('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x2aa10b}})[_0xa25a('0x28')](function(_0x457eeb,_0xf6a3f2){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x2aa10b);manageLicense(_0x2aa10b,_0x457eeb);})[_0xa25a('0x11')](function(_0x36ca82){logger[_0xa25a('0x22')](_0x36ca82[_0xa25a('0x23')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x9dcf=['then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','format','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','catch','get','data1'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x9dcf,0x115));var _0xf9dc=function(_0x15f005,_0x4650ca){_0x15f005=_0x15f005-0x0;var _0x9d03ab=_0x9dcf[_0x15f005];return _0x9d03ab;};'use strict';var util=require(_0xf9dc('0x0'));var moment=require(_0xf9dc('0x1'));var rp=require(_0xf9dc('0x2'));var BPromise=require(_0xf9dc('0x3'));var pkginfo=require(_0xf9dc('0x4'))(module,'version');var db=require(_0xf9dc('0x5'))['db'];var encryptor=require(_0xf9dc('0x6'));var hardware=require(_0xf9dc('0x7'));var logger=require(_0xf9dc('0x8'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2fac27){return new BPromise(function(_0x4baaa2,_0x1cc07e){var _0x530e14=util[_0xf9dc('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x2fac27,module['exports'][_0xf9dc('0xa')]);if(oldToken){_0x530e14=util[_0xf9dc('0x9')](_0xf9dc('0xb'),HOST,_0x2fac27,module[_0xf9dc('0xc')][_0xf9dc('0xa')],oldToken);}var _0x4ec109={'uri':_0x530e14,'method':_0xf9dc('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x4ec109)['then'](function(_0x961ce1){_0x4baaa2(_0x961ce1);})[_0xf9dc('0xe')](function(_0x29bdcb){_0x1cc07e(_0x29bdcb);});});}function manageLicense(_0x191cab,_0x402b8b){var _0x32359a=_0x402b8b[_0xf9dc('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x32359a[_0xf9dc('0x10')]!==_0x191cab&&!_0x32359a['data2']){oldToken=_0x32359a[_0xf9dc('0x10')];}httpRequest(_0x191cab)[_0xf9dc('0x11')](function(_0x9705d5){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x9705d5[_0xf9dc('0x12')]){isOldTokenSent=![];if(!_0x32359a[_0xf9dc('0x13')]&&_0x32359a[_0xf9dc('0x13')]!=_0x9705d5[_0xf9dc('0x13')]||_0x32359a['license']&&_0x32359a['data2']){logger[_0xf9dc('0x14')](_0xf9dc('0x15'));}if(_0x32359a[_0xf9dc('0x13')]&&!_0x32359a[_0xf9dc('0x16')]&&_0x32359a[_0xf9dc('0x13')]!=_0x9705d5[_0xf9dc('0x13')]){logger[_0xf9dc('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x32359a[_0xf9dc('0x13')]&&!_0x32359a[_0xf9dc('0x16')]&&_0x32359a[_0xf9dc('0x13')]==_0x9705d5['license']){return _0x402b8b;}return _0x402b8b['update']({'data1':_0x191cab,'data2':null,'license':_0x9705d5[_0xf9dc('0x13')]});}else{if(_0x9705d5[_0xf9dc('0x13')]||_0x32359a[_0xf9dc('0x13')]){if(!_0x32359a[_0xf9dc('0x16')]){if(_0x32359a['data1']==_0x191cab){GRAY_PERIOD_REASON=_0xf9dc('0x17');logger['info'](_0xf9dc('0x18'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xf9dc('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x32359a['data1'],_0x191cab);}logger[_0xf9dc('0x14')](_0xf9dc('0x19'),GRAY_PERIOD_REASON[_0xf9dc('0x1a')](),moment()[_0xf9dc('0x9')](_0xf9dc('0x1b')));return _0x402b8b[_0xf9dc('0x1c')]({'data2':encryptor[_0xf9dc('0x1d')](moment()[_0xf9dc('0x9')](_0xf9dc('0x1b')))});}else{if(moment()[_0xf9dc('0x1e')](encryptor[_0xf9dc('0x1f')](_0x32359a['data2']),'days')>DAYS){logger[_0xf9dc('0x14')](_0xf9dc('0x20'),moment()['format'](_0xf9dc('0x1b')));isOldTokenSent=![];return _0x402b8b[_0xf9dc('0x1c')]({'data1':_0x191cab,'data2':null,'license':null});}}}else{if(_0x32359a[_0xf9dc('0x10')]!=_0x191cab){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x32359a[_0xf9dc('0x10')],_0x191cab);return _0x402b8b[_0xf9dc('0x1c')]({'data1':_0x191cab,'data2':null,'license':null});}}}return _0x402b8b;})['then'](function(_0x22f066){_0x402b8b=_0x22f066;})[_0xf9dc('0xe')](function(_0x56ab26){logger['error'](_0x56ab26[_0xf9dc('0x21')]);})[_0xf9dc('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xf9dc('0x23')](),_0x402b8b);},TIME);});}function defaultLicense(){var _0x27f35c=hardware[_0xf9dc('0x23')]();if(_0x27f35c){return db[_0xf9dc('0x24')][_0xf9dc('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x27f35c}})[_0xf9dc('0x26')](function(_0x4264bd,_0x54e634){logger['info'](_0xf9dc('0x27'),_0x27f35c);manageLicense(_0x27f35c,_0x4264bd);})[_0xf9dc('0xe')](function(_0x4ad2a4){logger[_0xf9dc('0x28')](_0x4ad2a4[_0xf9dc('0x21')]);});}}exports[_0xf9dc('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index d3d0c02..10a1c8d 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 _0xa089=['lodash','moment','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','License','find','then','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','format','%s:%s:%s','parse','demo','machineUuid','decryptString','add','grayReason','changed','disabled','message','User','findAll','sequelize','col','role','count','user','telephone','users','telephones','admin','catch','License\x20limit\x20reached\x20for\x20users','exports','util'];(function(_0x21a848,_0x5ce41a){var _0x5aaf99=function(_0x342593){while(--_0x342593){_0x21a848['push'](_0x21a848['shift']());}};_0x5aaf99(++_0x5ce41a);}(_0xa089,0xfb));var _0x9a08=function(_0x43ea20,_0x3b25e1){_0x43ea20=_0x43ea20-0x0;var _0x179562=_0xa089[_0x43ea20];return _0x179562;};'use strict';var util=require(_0x9a08('0x0'));var _=require(_0x9a08('0x1'));var moment=require(_0x9a08('0x2'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0x9a08('0x3'))['db'];const demoLicense={'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':![],'description':_0x9a08('0x4'),'machineUuid':hardware[_0x9a08('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9a08('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x9a08('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x58968b){return new BPromise(function(_0x41ae44,_0x218d3c){return db[_0x9a08('0x7')][_0x9a08('0x8')](_['defaults'](_0x58968b,{'raw':!![],'where':{'id':0x1}}))[_0x9a08('0x9')](function(_0x224312){return checkLicense(_0x224312,null);})[_0x9a08('0x9')](function(_0x49f891){_0x41ae44(_0x49f891);return;})['catch'](function(_0x4ecc15){_0x218d3c(_0x4ecc15);});});}function checkLicense(_0xc576b5,_0x54424d){if(!_0xc576b5){demoLicense[_0x9a08('0xa')]=_0xc576b5['data1'];return demoLicense;}try{var _0x46ee8f=_0x54424d||_0xc576b5[_0x9a08('0xb')];if(_[_0x9a08('0xc')](_0x46ee8f)){throw new Error(_0x9a08('0xd'));}var _0x3da91f=_0xc576b5[_0x9a08('0xe')];var _0x4c1f68=_0xc576b5[_0x9a08('0xf')];var _0x2c2e0b=_0x3da91f['split']('-')[0x4];var _0x35b715=_0x3da91f[_0x9a08('0x10')]('-')[0x0];var _0x684245=encryptor['decryptString'](_0x46ee8f,util[_0x9a08('0x11')](_0x9a08('0x12'),_0x2c2e0b,_0x3da91f,_0x35b715));var _0x3ba05f=JSON[_0x9a08('0x13')](_0x684245);_0x3ba05f[_0x9a08('0x14')]=![];_0x3ba05f[_0x9a08('0xa')]=_0x3da91f;_0x3ba05f[_0x9a08('0x15')]=hardware[_0x9a08('0x5')]();if(_0x4c1f68){var _0x387f73=encryptor[_0x9a08('0x16')](_0x4c1f68);_0x3ba05f['gray']=_0x387f73;_0x3ba05f['deadline']=moment(_0x387f73)[_0x9a08('0x17')](0x7,'days')[_0x9a08('0x11')]();_0x3ba05f[_0x9a08('0x18')]=_0x3ba05f[_0x9a08('0xa')]!=_0x3ba05f[_0x9a08('0x15')]?_0x9a08('0x19'):_0x9a08('0x1a');}return _0x3ba05f;}catch(_0x5a6098){breakingLicense[_0x9a08('0xa')]=_0xc576b5[_0x9a08('0xe')];breakingLicense['message']=_0x5a6098[_0x9a08('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4dddac,_0x4de033){getLicense()[_0x9a08('0x9')](function(_0x4f5b7a){return db[_0x9a08('0x1c')][_0x9a08('0x1d')]({'attributes':['role',[db[_0x9a08('0x1e')]['fn']('COUNT',db['sequelize'][_0x9a08('0x1f')](_0x9a08('0x20'))),_0x9a08('0x21')]],'group':'role','where':{'role':{'$or':['admin',_0x9a08('0x22'),_0x9a08('0x23')]}},'raw':!![]})[_0x9a08('0x9')](function(_0x2824fc){var _0x574fe4={'user':_0x4f5b7a[_0x9a08('0x24')]||0x0,'telephone':_0x4f5b7a[_0x9a08('0x25')]||0x0};_0x2824fc['forEach'](function(_0x2473a0){var _0x281eec=_0x2473a0['role']===_0x9a08('0x26')?_0x9a08('0x22'):_0x2473a0['role'];_0x574fe4[_0x281eec]-=_0x2473a0['count'];if(_0x574fe4[_0x281eec]<0x0)_0x574fe4[_0x281eec]=0x0;});_0x4dddac(_0x574fe4);return;});})[_0x9a08('0x27')](function(_0x129ec9){_0x4de033(_0x129ec9);});});}function checkUserLimits(_0x4b8e9e){return new BPromise(function(_0x183ca1,_0x2497ad){getLimits()[_0x9a08('0x9')](function(_0x160d04){var _0x4f1f43=_['pick'](_['countBy'](_0x4b8e9e,_0x9a08('0x20')),[_0x9a08('0x26'),'user',_0x9a08('0x23')]);var _0x22ced2=(_0x4f1f43[_0x9a08('0x26')]||0x0)+(_0x4f1f43[_0x9a08('0x22')]||0x0);var _0x2140a2=_0x4f1f43['telephone']||0x0;if(_0x22ced2>_0x160d04[_0x9a08('0x22')])return _0x2497ad(_0x9a08('0x28'));if(_0x2140a2>_0x160d04[_0x9a08('0x23')])return _0x2497ad('License\x20limit\x20reached\x20for\x20telephones');return _0x183ca1();})[_0x9a08('0x27')](function(_0x22c4eb){_0x2497ad(_0x22c4eb);});});}module[_0x9a08('0x29')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xb6e5=['disabled','message','User','role','sequelize','COUNT','col','count','user','then','users','telephones','forEach','admin','pick','countBy','License\x20limit\x20reached\x20for\x20users','telephone','exports','moment','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','catch','uuid','data1','isEmpty','data2','split','decryptString','format','parse','machineUuid','gray','deadline','add','days','grayReason','changed'];(function(_0x647a62,_0x1a0020){var _0x29d830=function(_0x191f19){while(--_0x191f19){_0x647a62['push'](_0x647a62['shift']());}};_0x29d830(++_0x1a0020);}(_0xb6e5,0x140));var _0x5b6e=function(_0x22a2aa,_0x173fc4){_0x22a2aa=_0x22a2aa-0x0;var _0x4d7214=_0xb6e5[_0x22a2aa];return _0x4d7214;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x5b6e('0x0'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0x5b6e('0x1'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5b6e('0x2'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x5b6e('0x3'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5b6e('0x2'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x5b6e('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5ea0c5){return new BPromise(function(_0x3a05a7,_0x173565){return db[_0x5b6e('0x5')][_0x5b6e('0x6')](_[_0x5b6e('0x7')](_0x5ea0c5,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x315831){return checkLicense(_0x315831,null);})['then'](function(_0x5ed1b8){_0x3a05a7(_0x5ed1b8);return;})[_0x5b6e('0x8')](function(_0x556b48){_0x173565(_0x556b48);});});}function checkLicense(_0x18d7e0,_0x4573cc){if(!_0x18d7e0){demoLicense[_0x5b6e('0x9')]=_0x18d7e0[_0x5b6e('0xa')];return demoLicense;}try{var _0x36bfac=_0x4573cc||_0x18d7e0['license'];if(_[_0x5b6e('0xb')](_0x36bfac)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x2e4eea=_0x18d7e0['data1'];var _0x53fd41=_0x18d7e0[_0x5b6e('0xc')];var _0x242ba2=_0x2e4eea[_0x5b6e('0xd')]('-')[0x4];var _0x2db84d=_0x2e4eea[_0x5b6e('0xd')]('-')[0x0];var _0x52cb08=encryptor[_0x5b6e('0xe')](_0x36bfac,util[_0x5b6e('0xf')]('%s:%s:%s',_0x242ba2,_0x2e4eea,_0x2db84d));var _0x359e33=JSON[_0x5b6e('0x10')](_0x52cb08);_0x359e33['demo']=![];_0x359e33[_0x5b6e('0x9')]=_0x2e4eea;_0x359e33[_0x5b6e('0x11')]=hardware['getUuid']();if(_0x53fd41){var _0x3987f3=encryptor[_0x5b6e('0xe')](_0x53fd41);_0x359e33[_0x5b6e('0x12')]=_0x3987f3;_0x359e33[_0x5b6e('0x13')]=moment(_0x3987f3)[_0x5b6e('0x14')](0x7,_0x5b6e('0x15'))[_0x5b6e('0xf')]();_0x359e33[_0x5b6e('0x16')]=_0x359e33['uuid']!=_0x359e33[_0x5b6e('0x11')]?_0x5b6e('0x17'):_0x5b6e('0x18');}return _0x359e33;}catch(_0x4ee938){breakingLicense[_0x5b6e('0x9')]=_0x18d7e0['data1'];breakingLicense[_0x5b6e('0x19')]=_0x4ee938['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5a8c86,_0x2d01ca){getLicense()['then'](function(_0x130751){return db[_0x5b6e('0x1a')]['findAll']({'attributes':[_0x5b6e('0x1b'),[db[_0x5b6e('0x1c')]['fn'](_0x5b6e('0x1d'),db[_0x5b6e('0x1c')][_0x5b6e('0x1e')](_0x5b6e('0x1b'))),_0x5b6e('0x1f')]],'group':_0x5b6e('0x1b'),'where':{'role':{'$or':['admin',_0x5b6e('0x20'),'telephone']}},'raw':!![]})[_0x5b6e('0x21')](function(_0x252af5){var _0x5370dd={'user':_0x130751[_0x5b6e('0x22')]||0x0,'telephone':_0x130751[_0x5b6e('0x23')]||0x0};_0x252af5[_0x5b6e('0x24')](function(_0x272a79){var _0x2a1dd2=_0x272a79[_0x5b6e('0x1b')]===_0x5b6e('0x25')?_0x5b6e('0x20'):_0x272a79['role'];_0x5370dd[_0x2a1dd2]-=_0x272a79[_0x5b6e('0x1f')];if(_0x5370dd[_0x2a1dd2]<0x0)_0x5370dd[_0x2a1dd2]=0x0;});_0x5a8c86(_0x5370dd);return;});})[_0x5b6e('0x8')](function(_0xf988f7){_0x2d01ca(_0xf988f7);});});}function checkUserLimits(_0x435efa){return new BPromise(function(_0x46fd0a,_0x1e19ae){getLimits()[_0x5b6e('0x21')](function(_0x2b4c7b){var _0x4e10bb=_[_0x5b6e('0x26')](_[_0x5b6e('0x27')](_0x435efa,_0x5b6e('0x1b')),['admin',_0x5b6e('0x20'),'telephone']);var _0x212b33=(_0x4e10bb['admin']||0x0)+(_0x4e10bb[_0x5b6e('0x20')]||0x0);var _0x599d79=_0x4e10bb['telephone']||0x0;if(_0x212b33>_0x2b4c7b['user'])return _0x1e19ae(_0x5b6e('0x28'));if(_0x599d79>_0x2b4c7b[_0x5b6e('0x29')])return _0x1e19ae('License\x20limit\x20reached\x20for\x20telephones');return _0x46fd0a();})[_0x5b6e('0x8')](function(_0x1a8709){_0x1e19ae(_0x1a8709);});});}module[_0x5b6e('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 50ebfca..8cb1773 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 _0x5f2f=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x429b7c,_0x31ba9b){var _0x113a3e=function(_0x13905f){while(--_0x13905f){_0x429b7c['push'](_0x429b7c['shift']());}};_0x113a3e(++_0x31ba9b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x976b53,_0x4489a6){_0x976b53=_0x976b53-0x0;var _0x5daab6=_0x5f2f[_0x976b53];return _0x5daab6;};'use strict';module[_0xf5f2('0x0')]={'DOMAIN':_0xf5f2('0x1'),'SESSION_SECRET':_0xf5f2('0x2'),'GOOGLE_ID':_0xf5f2('0x3'),'GOOGLE_SECRET':_0xf5f2('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xeb3b=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x385b0a,_0x29886d){var _0x1bf8d7=function(_0x395383){while(--_0x395383){_0x385b0a['push'](_0x385b0a['shift']());}};_0x1bf8d7(++_0x29886d);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x13b3b5,_0x52d8d8){_0x13b3b5=_0x13b3b5-0x0;var _0x337cd0=_0xeb3b[_0x13b3b5];return _0x337cd0;};'use strict';module[_0xbeb3('0x0')]={'DOMAIN':_0xbeb3('0x1'),'SESSION_SECRET':_0xbeb3('0x2'),'GOOGLE_ID':_0xbeb3('0x3'),'GOOGLE_SECRET':_0xbeb3('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 1f20f66..b08367b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfdb=['fileLogger','exports'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xdfdb,0x11a));var _0xbdfd=function(_0x3d66f0,_0x3f4e63){_0x3d66f0=_0x3d66f0-0x0;var _0x4164f3=_0xdfdb[_0x3d66f0];return _0x4164f3;};'use strict';var fileLogger=require('../utils/loggers')[_0xbdfd('0x0')];module[_0xbdfd('0x1')]=fileLogger; \ No newline at end of file +var _0x6cb0=['fileLogger','exports','../utils/loggers'];(function(_0x4bafac,_0x4ab088){var _0x2f706b=function(_0xb49191){while(--_0xb49191){_0x4bafac['push'](_0x4bafac['shift']());}};_0x2f706b(++_0x4ab088);}(_0x6cb0,0x161));var _0x06cb=function(_0x25a23f,_0x41d099){_0x25a23f=_0x25a23f-0x0;var _0x18643c=_0x6cb0[_0x25a23f];return _0x18643c;};'use strict';var fileLogger=require(_0x06cb('0x0'))[_0x06cb('0x1')];module[_0x06cb('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 31e5dbe..c6beeff 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 _0x4c34=['join','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','routing','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0x4c34,0xa5));var _0x44c3=function(_0x2ad52d,_0x1b4b9c){_0x2ad52d=_0x2ad52d-0x0;var _0x37b18c=_0x4c34[_0x2ad52d];return _0x37b18c;};'use strict';var path=require(_0x44c3('0x0'));var cfg=require(_0x44c3('0x1'));var env={'NODE_PATH':path[_0x44c3('0x2')](path[_0x44c3('0x3')](cfg['root'],_0x44c3('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x44c3('0x3')](__dirname,_0x44c3('0x5')),'env':env},{'name':_0x44c3('0x6'),'script':path['join'](__dirname,_0x44c3('0x7')),'env':env},{'name':_0x44c3('0x8'),'script':path[_0x44c3('0x3')](__dirname,_0x44c3('0x9')),'env':env},{'name':'email','script':path[_0x44c3('0x3')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x44c3('0xa'),'script':path[_0x44c3('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x44c3('0xb'),'script':path['join'](__dirname,_0x44c3('0xc')),'env':env}]};module[_0x44c3('0xd')]=pm2config; \ No newline at end of file +var _0xb6d0=['resolve','join','root','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/xdr/index.js','exports','../../config/environment'];(function(_0x2cb03e,_0x3ff6e6){var _0x292cf5=function(_0x4599f4){while(--_0x4599f4){_0x2cb03e['push'](_0x2cb03e['shift']());}};_0x292cf5(++_0x3ff6e6);}(_0xb6d0,0x1df));var _0x0b6d=function(_0x533990,_0x21fe8d){_0x533990=_0x533990-0x0;var _0x5a5e2a=_0xb6d0[_0x533990];return _0x5a5e2a;};'use strict';var path=require('path');var cfg=require(_0x0b6d('0x0'));var env={'NODE_PATH':path[_0x0b6d('0x1')](path[_0x0b6d('0x2')](cfg[_0x0b6d('0x3')],_0x0b6d('0x4')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0x0b6d('0x5')),'env':env},{'name':_0x0b6d('0x6'),'script':path[_0x0b6d('0x2')](__dirname,_0x0b6d('0x7')),'env':env},{'name':_0x0b6d('0x8'),'script':path['join'](__dirname,_0x0b6d('0x9')),'env':env},{'name':_0x0b6d('0xa'),'script':path[_0x0b6d('0x2')](__dirname,_0x0b6d('0xb')),'env':env},{'name':_0x0b6d('0xc'),'script':path[_0x0b6d('0x2')](__dirname,'../../services/routing/index.js'),'env':env},{'name':'xdr','script':path[_0x0b6d('0x2')](__dirname,_0x0b6d('0xd')),'env':env}]};module[_0x0b6d('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 49c1de4..007acd4 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 _0x0e53=['stop','restart','list','delete','dump','saved','bluebird','connect','then','start','disconnect'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x0e53,0x15b));var _0x30e5=function(_0x26fb64,_0x20b9a6){_0x26fb64=_0x26fb64-0x0;var _0x4267bc=_0x0e53[_0x26fb64];return _0x4267bc;};'use strict';var pm2=require('pm2');var BPromise=require(_0x30e5('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x15c7d0,_0x55400d){return pm2[_0x30e5('0x1')](function(_0x304d48){if(_0x304d48){return _0x55400d(_0x304d48);}return _0x15c7d0('connected');});});};exports['start']=function(_0x13d6e3){return connect()[_0x30e5('0x2')](function(){return new BPromise(function(_0x489685,_0x3bdf13){return pm2[_0x30e5('0x3')](_0x13d6e3,function(_0x41c8c3,_0x3f002d){if(_0x41c8c3){return _0x3bdf13(_0x41c8c3);}pm2[_0x30e5('0x4')]();return _0x489685(_0x3f002d);});});});};exports[_0x30e5('0x5')]=function(_0x4e8f9e){return connect()[_0x30e5('0x2')](function(){return new BPromise(function(_0x2c7c1c,_0x23ef42){return pm2['stop'](_0x4e8f9e,function(_0x2b8438,_0x589895){if(_0x2b8438){return _0x23ef42(_0x2b8438);}pm2[_0x30e5('0x4')]();return _0x2c7c1c(_0x589895);});});});};exports['restart']=function(_0x5526f2){return connect()[_0x30e5('0x2')](function(){return new BPromise(function(_0x39b9d3,_0x250f9b){return pm2[_0x30e5('0x6')](_0x5526f2,function(_0x2f72b6,_0x32526e){if(_0x2f72b6){return _0x250f9b(_0x2f72b6);}pm2[_0x30e5('0x4')]();return _0x39b9d3(_0x32526e);});});});};exports[_0x30e5('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4f0fd3,_0x3ba1f3){return pm2[_0x30e5('0x7')](function(_0x10728e,_0x3ffc20){if(_0x10728e){return _0x3ba1f3(_0x10728e);}pm2[_0x30e5('0x4')]();return _0x4f0fd3(_0x3ffc20);});});});};exports['describe']=function(_0x465a70){return connect()[_0x30e5('0x2')](function(){return new BPromise(function(_0x540735,_0x73a04e){return pm2['describe'](_0x465a70,function(_0x36e599,_0x13b051){if(_0x36e599){return _0x73a04e(_0x36e599);}pm2[_0x30e5('0x4')]();return _0x540735(_0x13b051);});});});};exports[_0x30e5('0x8')]=function(_0x17106d){return connect()[_0x30e5('0x2')](function(){return new BPromise(function(_0x36197d,_0x2c723a){return pm2[_0x30e5('0x8')](_0x17106d,function(_0x422c24,_0x538286){if(_0x422c24){return _0x2c723a(_0x422c24);}pm2['disconnect']();return _0x36197d(_0x538286);});});});};exports['dump']=function(){return connect()[_0x30e5('0x2')](function(){return new BPromise(function(_0x26dad4,_0x306157){return pm2[_0x30e5('0x9')](function(_0x1dceca){if(_0x1dceca){return _0x306157(_0x1dceca);}return _0x26dad4(_0x30e5('0xa'));});});});}; \ No newline at end of file +var _0xeb65=['stop','then','restart','list','describe','delete','dump','saved','pm2','bluebird','connect','connected','start','disconnect'];(function(_0x3d2799,_0x58c640){var _0x305e71=function(_0x5095bf){while(--_0x5095bf){_0x3d2799['push'](_0x3d2799['shift']());}};_0x305e71(++_0x58c640);}(_0xeb65,0x1ac));var _0x5eb6=function(_0x3aaf80,_0x702ad9){_0x3aaf80=_0x3aaf80-0x0;var _0xa05429=_0xeb65[_0x3aaf80];return _0xa05429;};'use strict';var pm2=require(_0x5eb6('0x0'));var BPromise=require(_0x5eb6('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x41c5d4,_0x3df1fa){return pm2[_0x5eb6('0x2')](function(_0x4dfd1d){if(_0x4dfd1d){return _0x3df1fa(_0x4dfd1d);}return _0x41c5d4(_0x5eb6('0x3'));});});};exports[_0x5eb6('0x4')]=function(_0x16b0a7){return connect()['then'](function(){return new BPromise(function(_0x370ffa,_0x2f2f51){return pm2['start'](_0x16b0a7,function(_0x1b656a,_0x5c31fd){if(_0x1b656a){return _0x2f2f51(_0x1b656a);}pm2[_0x5eb6('0x5')]();return _0x370ffa(_0x5c31fd);});});});};exports[_0x5eb6('0x6')]=function(_0x1f0ad6){return connect()[_0x5eb6('0x7')](function(){return new BPromise(function(_0x45b03e,_0x3ecc62){return pm2[_0x5eb6('0x6')](_0x1f0ad6,function(_0x20f617,_0x25f49a){if(_0x20f617){return _0x3ecc62(_0x20f617);}pm2[_0x5eb6('0x5')]();return _0x45b03e(_0x25f49a);});});});};exports[_0x5eb6('0x8')]=function(_0x376db7){return connect()[_0x5eb6('0x7')](function(){return new BPromise(function(_0x66229a,_0x5ec74f){return pm2['restart'](_0x376db7,function(_0x5843bc,_0x4a8f21){if(_0x5843bc){return _0x5ec74f(_0x5843bc);}pm2[_0x5eb6('0x5')]();return _0x66229a(_0x4a8f21);});});});};exports['list']=function(){return connect()[_0x5eb6('0x7')](function(){return new BPromise(function(_0x23cbd2,_0x53bdc8){return pm2[_0x5eb6('0x9')](function(_0x3ed0db,_0x3fa630){if(_0x3ed0db){return _0x53bdc8(_0x3ed0db);}pm2[_0x5eb6('0x5')]();return _0x23cbd2(_0x3fa630);});});});};exports[_0x5eb6('0xa')]=function(_0x442958){return connect()['then'](function(){return new BPromise(function(_0x1960bc,_0x57055e){return pm2[_0x5eb6('0xa')](_0x442958,function(_0xce477c,_0x5e2a1c){if(_0xce477c){return _0x57055e(_0xce477c);}pm2[_0x5eb6('0x5')]();return _0x1960bc(_0x5e2a1c);});});});};exports[_0x5eb6('0xb')]=function(_0x255597){return connect()['then'](function(){return new BPromise(function(_0x29fb3c,_0x48450d){return pm2[_0x5eb6('0xb')](_0x255597,function(_0x546af6,_0x31a378){if(_0x546af6){return _0x48450d(_0x546af6);}pm2['disconnect']();return _0x29fb3c(_0x31a378);});});});};exports[_0x5eb6('0xc')]=function(){return connect()[_0x5eb6('0x7')](function(){return new BPromise(function(_0x36be97,_0x141d48){return pm2['dump'](function(_0x4ba70f){if(_0x4ba70f){return _0x141d48(_0x4ba70f);}return _0x36be97(_0x5eb6('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a8563bf..3ffc4c8 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 _0xc20b=['ioredis','../../config/environment','schedule','redis','defaults','localhost','Setting','chatTimeout','then','findAll','minutes','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','timeout','format','length','emit','chatInteraction:update','error','start','lodash','moment'];(function(_0xf33eef,_0x528409){var _0x2a4da1=function(_0x338dd9){while(--_0x338dd9){_0xf33eef['push'](_0xf33eef['shift']());}};_0x2a4da1(++_0x528409);}(_0xc20b,0xc6));var _0xbc20=function(_0x4951a0,_0x479e9e){_0x4951a0=_0x4951a0-0x0;var _0x4d3e3c=_0xc20b[_0x4951a0];return _0x4d3e3c;};'use strict';var _=require(_0xbc20('0x0'));var moment=require(_0xbc20('0x1'));var Redis=require(_0xbc20('0x2'));var util=require('util');var config=require(_0xbc20('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xbc20('0x4'));config[_0xbc20('0x5')]=_[_0xbc20('0x6')](config[_0xbc20('0x5')],{'host':_0xbc20('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbc20('0x5')]));function closeInteractions(){var _0x4aea19=0x0;var _0x204afb=[];return db[_0xbc20('0x8')]['find']({'raw':!![],'attributes':['id',_0xbc20('0x9')],'where':{'id':0x1}})[_0xbc20('0xa')](function(_0x35e0f1){_0x4aea19=_0x35e0f1[_0xbc20('0x9')];if(_0x4aea19){return db['ChatInteraction'][_0xbc20('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x35e0f1[_0xbc20('0x9')],_0xbc20('0xc'))}}});}else{return[];}})['then'](function(_0x2f49bd){if(_0x2f49bd&&_0x2f49bd['length']){_0x204afb=_['map'](_0x2f49bd||[],'id');logger[_0xbc20('0xd')](_0xbc20('0xe'),_0x204afb[_0xbc20('0xf')]());return db[_0xbc20('0x10')][_0xbc20('0x11')]({'closeReason':'system','disposition':_0xbc20('0x12'),'closed':!![],'closedAt':moment()[_0xbc20('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x204afb}});}})[_0xbc20('0xa')](function(){if(_0x204afb&&_0x204afb[_0xbc20('0x14')]){logger[_0xbc20('0xd')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x204afb[_0xbc20('0xf')]());for(var _0x2e19b8=0x0;_0x2e19b8<_0x204afb[_0xbc20('0x14')];_0x2e19b8++){io[_0xbc20('0x15')](_0xbc20('0x16'),{'id':_0x204afb[_0x2e19b8],'closed':!![]});}}})['catch'](function(_0x55b5ce){logger[_0xbc20('0x17')]('[CHAT]\x20Error\x20closing\x20interactions',_0x55b5ce?util['inspect'](_0x55b5ce,{'showHidden':![],'depth':null}):'');});}exports[_0xbc20('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x32c6=['chatTimeout','ChatInteraction','findAll','subtract','minutes','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','emit','catch','inspect','start','lodash','ioredis','util','../../config/environment','../logger','redis','defaults','then'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x32c6,0x1de));var _0x632c=function(_0x1fcc1f,_0x29fcf1){_0x1fcc1f=_0x1fcc1f-0x0;var _0x1f03c0=_0x32c6[_0x1fcc1f];return _0x1f03c0;};'use strict';var _=require(_0x632c('0x0'));var moment=require('moment');var Redis=require(_0x632c('0x1'));var util=require(_0x632c('0x2'));var config=require(_0x632c('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x632c('0x4'))('schedule');config[_0x632c('0x5')]=_[_0x632c('0x6')](config[_0x632c('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x186477=0x0;var _0x39fa6e=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x632c('0x7')](function(_0x39e26f){_0x186477=_0x39e26f[_0x632c('0x8')];if(_0x186477){return db[_0x632c('0x9')][_0x632c('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x632c('0xb')](_0x39e26f[_0x632c('0x8')],_0x632c('0xc'))}}});}else{return[];}})[_0x632c('0x7')](function(_0x14cde9){if(_0x14cde9&&_0x14cde9['length']){_0x39fa6e=_[_0x632c('0xd')](_0x14cde9||[],'id');logger[_0x632c('0xe')]('[CHAT]\x20Interactions\x20to\x20close:',_0x39fa6e[_0x632c('0xf')]());return db[_0x632c('0x9')][_0x632c('0x10')]({'closeReason':_0x632c('0x11'),'disposition':_0x632c('0x12'),'closed':!![],'closedAt':moment()[_0x632c('0x13')](_0x632c('0x14'))},{'where':{'id':_0x39fa6e}});}})[_0x632c('0x7')](function(){if(_0x39fa6e&&_0x39fa6e['length']){logger['info'](_0x632c('0x15'),_0x39fa6e[_0x632c('0xf')]());for(var _0x2b91ea=0x0;_0x2b91ea<_0x39fa6e[_0x632c('0x16')];_0x2b91ea++){io[_0x632c('0x17')]('chatInteraction:update',{'id':_0x39fa6e[_0x2b91ea],'closed':!![]});}}})[_0x632c('0x18')](function(_0x4c0a57){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x4c0a57?util[_0x632c('0x19')](_0x4c0a57,{'showHidden':![],'depth':null}):'');});}exports[_0x632c('0x1a')]=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 e8a4f0e..905c6a7 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 _0xc1a0=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x3c8828,_0x2b7afd){var _0x41e0ba=function(_0x5cbe4f){while(--_0x5cbe4f){_0x3c8828['push'](_0x3c8828['shift']());}};_0x41e0ba(++_0x2b7afd);}(_0xc1a0,0x1e6));var _0x0c1a=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0xc1a0[_0x1e6659];return _0x4d16e4;};'use strict';function start(){var _0x3b019c=require(_0x0c1a('0x0'));return _0x3b019c[_0x0c1a('0x1')]();}module[_0x0c1a('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xd211=['startAllRefreshIntervals','exports'];(function(_0x1c7f8b,_0x4ee962){var _0x373794=function(_0x414f9b){while(--_0x414f9b){_0x1c7f8b['push'](_0x1c7f8b['shift']());}};_0x373794(++_0x4ee962);}(_0xd211,0x1aa));var _0x1d21=function(_0x3397b3,_0x21c7b8){_0x3397b3=_0x3397b3-0x0;var _0x276406=_0xd211[_0x3397b3];return _0x276406;};'use strict';function start(){var _0xac04b4=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0xac04b4[_0x1d21('0x0')]();}module[_0x1d21('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index ebf5424..f4b2c74 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 _0x7500=['attachments','stringify','text','empty\x20file,\x20email\x20not\x20sent','then','error','error\x20mail','email\x20sent','catch','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','Schedule','findAll','email','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update','update\x20cron','run','start','path','lodash','moment','cron-job-manager','jayson/promise','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','%s.%s','basename','extname','savename','zip','existsSync','status','Sent','message'];(function(_0x2c4046,_0x96834e){var _0x5b2979=function(_0xa6d4f6){while(--_0xa6d4f6){_0x2c4046['push'](_0x2c4046['shift']());}};_0x5b2979(++_0x96834e);}(_0x7500,0xdd));var _0x0750=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x7500[_0x413feb];return _0x40ee88;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x0750('0x0'));var _=require(_0x0750('0x1'));var moment=require(_0x0750('0x2'));var CronJobManager=require(_0x0750('0x3'));var jayson=require(_0x0750('0x4'));var BPromise=require('bluebird');var logger=require('../logger')(_0x0750('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x0750('0x6'));var analyticDefaultReportController=require(_0x0750('0x7'));var client=jayson['client'][_0x0750('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5718d5,_0xa0946a){return function(){logger[_0x0750('0x9')](_0x0750('0xa'),_0x5718d5['email']);var _0x388d07=!![];var _0x128cf6=_0x5718d5[_0x0750('0xb')][_0x0750('0xc')]();var _0x13e6cd={'account':_0x128cf6,'message':{'from':util[_0x0750('0xd')](_0x0750('0xe'),_0x5718d5['MailAccount'][_0x0750('0xf')],_0x5718d5[_0x0750('0xb')]['email']||_0x5718d5['MailAccount']['Smtp'][_0x0750('0x10')]),'to':_0x5718d5['email'],'cc':_0x5718d5['cc'],'bcc':_0x5718d5[_0x0750('0x11')],'subject':util[_0x0750('0xd')](_0x0750('0x12'),_0xa0946a[_0x0750('0xf')],_0x5718d5[_0x0750('0x13')],_0x5718d5[_0x0750('0x14')])}};var _0x450a43=path[_0x0750('0x15')](__dirname,'../../files/reports');var _0x1ae079=_0xa0946a['savename'];var _0x10b2f1=util['format'](_0x0750('0x16'),path[_0x0750('0x17')](_0xa0946a['savename'],path[_0x0750('0x18')](_0xa0946a[_0x0750('0x19')])),_0x0750('0x1a'));var _0x493361=path['join'](_0x450a43,_0x1ae079);var _0x5d36a1=path[_0x0750('0x15')](_0x450a43,_0x10b2f1);if(fs[_0x0750('0x1b')](_0x493361)){_0xa0946a[_0x0750('0x1c')]=_0x0750('0x1d');_0x13e6cd[_0x0750('0x1e')][_0x0750('0x1f')]=[{'filename':_0x1ae079,'path':_0x493361}];_0x13e6cd[_0x0750('0x1e')]['text']=util[_0x0750('0xd')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x0750('0x20')](_0xa0946a,null,0x2));}else if(fs[_0x0750('0x1b')](_0x5d36a1)){_0xa0946a['status']=_0x0750('0x1d');_0x13e6cd['message'][_0x0750('0x1f')]=[{'filename':_0x10b2f1,'path':_0x5d36a1}];}else{_0x13e6cd[_0x0750('0x1e')][_0x0750('0x21')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5718d5['sendIfEmpty']){_0x388d07=![];logger[_0x0750('0x9')](_0x0750('0x22'));}}if(_0x388d07){return client['request']('SendMail',_0x13e6cd)[_0x0750('0x23')](function(_0x59a690){if(_0x59a690['error']){return logger[_0x0750('0x24')](_0x0750('0x25'),JSON['stringify'](_0x59a690));}return logger[_0x0750('0x9')](_0x0750('0x26'));})[_0x0750('0x27')](function(_0x2fd40d){return logger[_0x0750('0x24')]('error\x20mail',JSON[_0x0750('0x20')](_0x2fd40d));});}};}function handleError(){return function(_0x3d7399){return logger[_0x0750('0x24')](JSON['stringify'](_0x3d7399));};}function handleResult(_0x410361){return function(_0x25d4f2){logger[_0x0750('0x9')]('data',JSON['stringify'](_0x25d4f2));if(_0x410361['MailAccount']&&_0x410361[_0x0750('0xb')][_0x0750('0x28')]&&!_[_0x0750('0x29')](_0x410361['email'])){setTimeout(handleSendEmail(_0x410361,_0x25d4f2),0x3c*0x3e8);}};}function handleJob(_0x97a5e3){return function(){try{if(_['isNil'](_0x97a5e3[_0x0750('0x13')])){return logger[_0x0750('0x9')](_0x0750('0x2a'));}if(_[_0x0750('0x29')](_0x97a5e3[_0x0750('0x14')])){return logger[_0x0750('0x9')](_0x0750('0x2b'));}var _0x4b7993={'startDate':moment()[_0x0750('0x2c')](_0x97a5e3[_0x0750('0x13')],_0x97a5e3[_0x0750('0x14')])[_0x0750('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x0750('0xd')](_0x0750('0x2d')),'type':'scheduled','output':_0x97a5e3[_0x0750('0x2e')],'name':_0x97a5e3['name']};if(!_[_0x0750('0x29')](_0x97a5e3[_0x0750('0x2f')])){logger[_0x0750('0x9')](_0x0750('0x30'),_0x97a5e3[_0x0750('0x2f')]);return analyticDefaultReportController['runReport']({'id':_0x97a5e3[_0x0750('0x2f')]},_0x4b7993)['then'](handleResult(_0x97a5e3))[_0x0750('0x27')](handleError());}if(!_[_0x0750('0x29')](_0x97a5e3[_0x0750('0x31')])){logger[_0x0750('0x9')](_0x0750('0x32'),_0x97a5e3[_0x0750('0x31')]);return analyticCustomReportController[_0x0750('0x33')]({'id':_0x97a5e3[_0x0750('0x31')]},_0x4b7993)[_0x0750('0x23')](handleResult(_0x97a5e3))[_0x0750('0x27')](handleError());}}catch(_0x53a7a9){logger['error'](JSON[_0x0750('0x20')](_0x53a7a9));}return logger[_0x0750('0x9')]('no\x20report\x20id');};}function getJobs(_0x370b23){var _0x2e1212={};if(_0x370b23){_0x2e1212['id']=_0x370b23;}return db[_0x0750('0x34')][_0x0750('0x35')]({'where':_0x2e1212,'include':[{'model':db['MailAccount'],'attributes':['id',_0x0750('0xf'),_0x0750('0x36')],'include':[{'model':db[_0x0750('0x37')],'as':_0x0750('0x28'),'include':[{'model':db[_0x0750('0x38')],'as':_0x0750('0x38')}]}]}]})[_0x0750('0x23')](function(_0x1b23c5){var _0x4aaae5=_[_0x0750('0x39')](manager[_0x0750('0x3a')]);var _0xfa3c2f=_[_0x0750('0x3b')](_0x1b23c5,function(_0x417546){return _0x417546['id'][_0x0750('0x3c')]();});var _0x57d685=_[_0x0750('0x3d')](_0x1b23c5,function(_0x31abdb){return _0x31abdb['id'][_0x0750('0x3c')]();});var _0x1cfe5b=_0x370b23?_0xfa3c2f:_[_0x0750('0x3e')](_0xfa3c2f,_0x4aaae5);var _0x428997=_[_0x0750('0x3f')](_0xfa3c2f,_0x4aaae5);var _0x5a61cb=_['difference'](_0x4aaae5,_0xfa3c2f);var _0x5e33e7;var _0x4b1b20;for(_0x5e33e7=0x0;_0x5e33e7<_0x5a61cb[_0x0750('0x40')]&&!_0x370b23;_0x5e33e7+=0x1){_0x4b1b20=_0x5a61cb[_0x5e33e7][_0x0750('0x3c')]();if(manager['exists'](_0x4b1b20)){manager[_0x0750('0x41')](_0x4b1b20);manager[_0x0750('0x42')](_0x4b1b20);logger[_0x0750('0x9')](_0x0750('0x43'),_0x4b1b20);}}logger['info']('toRun',JSON[_0x0750('0x20')](_0x1cfe5b));for(_0x5e33e7=0x0;_0x5e33e7<_0x1cfe5b[_0x0750('0x40')];_0x5e33e7+=0x1){_0x4b1b20=_0x1cfe5b[_0x5e33e7][_0x0750('0x3c')]();logger[_0x0750('0x9')](_0x0750('0x44'),_0x4b1b20);if(_0x370b23){logger[_0x0750('0x9')](_0x0750('0x45'),_0x370b23);logger[_0x0750('0x9')](JSON[_0x0750('0x20')](_0x57d685[_0x4b1b20]));BPromise[_0x0750('0x46')]()[_0x0750('0x23')](handleJob(_0x57d685[_0x4b1b20]));logger[_0x0750('0x9')](_0x0750('0x47'),_0x57d685[_0x4b1b20][_0x0750('0xf')],_0x57d685[_0x4b1b20][_0x0750('0x48')]);}else if(_0x57d685[_0x4b1b20][_0x0750('0x48')]&&_0x57d685[_0x4b1b20][_0x0750('0x49')]&&moment()[_0x0750('0x4a')](_0x57d685[_0x4b1b20][_0x0750('0x4b')],_0x57d685[_0x4b1b20][_0x0750('0x4c')])){manager[_0x0750('0x4d')](_0x4b1b20,_0x57d685[_0x4b1b20]['cron'],handleJob(_0x57d685[_0x4b1b20]));manager['start'](_0x4b1b20);logger[_0x0750('0x9')](_0x0750('0x4e'),_0x57d685[_0x4b1b20][_0x0750('0xf')],_0x57d685[_0x4b1b20][_0x0750('0x48')]);}else if(manager['exists'](_0x4b1b20)){manager[_0x0750('0x41')](_0x4b1b20);manager[_0x0750('0x42')](_0x4b1b20);logger[_0x0750('0x9')](_0x0750('0x4f'),_0x57d685[_0x4b1b20][_0x0750('0xf')],_0x57d685[_0x4b1b20][_0x0750('0x48')]);}}for(_0x5e33e7=0x0,_0x4b1b20;_0x5e33e7<_0x428997[_0x0750('0x40')]&&!_0x370b23;_0x5e33e7+=0x1){_0x4b1b20=_0x428997[_0x5e33e7]['toString']();if(manager['exists'](_0x4b1b20)){if(_0x57d685[_0x4b1b20][_0x0750('0x48')]&&_0x57d685[_0x4b1b20][_0x0750('0x49')]&&moment()[_0x0750('0x4a')](_0x57d685[_0x4b1b20][_0x0750('0x4b')],_0x57d685[_0x4b1b20][_0x0750('0x4c')])){manager[_0x0750('0x50')](_0x4b1b20,_0x57d685[_0x4b1b20][_0x0750('0x48')],handleJob(_0x57d685[_0x4b1b20]));logger[_0x0750('0x9')](_0x0750('0x51'),_0x57d685[_0x4b1b20][_0x0750('0xf')],_0x57d685[_0x4b1b20]['cron']);}else{manager['stop'](_0x4b1b20);manager['deleteJob'](_0x4b1b20);logger['info']('stop\x20cron',_0x57d685[_0x4b1b20][_0x0750('0xf')],_0x57d685[_0x4b1b20][_0x0750('0x48')]);}}}})['catch'](function(_0x3a34e3){logger[_0x0750('0x24')](JSON[_0x0750('0x20')](_0x3a34e3));});}exports[_0x0750('0x52')]=function(_0xbfcadd){return getJobs(_0xbfcadd);};exports[_0x0750('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x59e5=['findAll','MailServerOut','CloudProvider','keys','toString','keyBy','difference','exists','stop','length','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','deleteJob','stop\x20cron','update','update\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','Sent','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','existsSync','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','stringify','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x59e5,0x11b));var _0x559e=function(_0xd687fc,_0x566e6e){_0xd687fc=_0xd687fc-0x0;var _0x53972e=_0x59e5[_0xd687fc];return _0x53972e;};'use strict';var fs=require('fs');var util=require(_0x559e('0x0'));var path=require(_0x559e('0x1'));var _=require(_0x559e('0x2'));var moment=require('moment');var CronJobManager=require(_0x559e('0x3'));var jayson=require(_0x559e('0x4'));var BPromise=require(_0x559e('0x5'));var logger=require(_0x559e('0x6'))('schedule');var db=require(_0x559e('0x7'))['db'];var analyticCustomReportController=require(_0x559e('0x8'));var analyticDefaultReportController=require(_0x559e('0x9'));var client=jayson[_0x559e('0xa')][_0x559e('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x7100c6,_0x5abb19){return function(){logger[_0x559e('0xc')](_0x559e('0xd'),_0x7100c6[_0x559e('0xe')]);var _0x151f71=!![];var _0x1c4d89=_0x7100c6[_0x559e('0xf')][_0x559e('0x10')]();var _0xd85dbd={'account':_0x1c4d89,'message':{'from':util[_0x559e('0x11')](_0x559e('0x12'),_0x7100c6['MailAccount'][_0x559e('0x13')],_0x7100c6[_0x559e('0xf')][_0x559e('0xe')]||_0x7100c6[_0x559e('0xf')][_0x559e('0x14')][_0x559e('0x15')]),'to':_0x7100c6[_0x559e('0xe')],'cc':_0x7100c6['cc'],'bcc':_0x7100c6[_0x559e('0x16')],'subject':util[_0x559e('0x11')]('Report\x20%s\x20last\x20%s\x20%s',_0x5abb19[_0x559e('0x13')],_0x7100c6[_0x559e('0x17')],_0x7100c6[_0x559e('0x18')])}};var _0x20a6e8=path[_0x559e('0x19')](__dirname,_0x559e('0x1a'));var _0x57b097=_0x5abb19[_0x559e('0x1b')];var _0x4eca77=util['format'](_0x559e('0x1c'),path[_0x559e('0x1d')](_0x5abb19['savename'],path[_0x559e('0x1e')](_0x5abb19['savename'])),_0x559e('0x1f'));var _0x134b55=path[_0x559e('0x19')](_0x20a6e8,_0x57b097);var _0x2c1111=path['join'](_0x20a6e8,_0x4eca77);if(fs['existsSync'](_0x134b55)){_0x5abb19[_0x559e('0x20')]=_0x559e('0x21');_0xd85dbd[_0x559e('0x22')]['attachments']=[{'filename':_0x57b097,'path':_0x134b55}];_0xd85dbd[_0x559e('0x22')][_0x559e('0x23')]=util[_0x559e('0x11')](_0x559e('0x24'),JSON['stringify'](_0x5abb19,null,0x2));}else if(fs[_0x559e('0x25')](_0x2c1111)){_0x5abb19['status']=_0x559e('0x21');_0xd85dbd[_0x559e('0x22')][_0x559e('0x26')]=[{'filename':_0x4eca77,'path':_0x2c1111}];}else{_0xd85dbd[_0x559e('0x22')][_0x559e('0x23')]=_0x559e('0x27');if(!_0x7100c6[_0x559e('0x28')]){_0x151f71=![];logger[_0x559e('0xc')](_0x559e('0x29'));}}if(_0x151f71){return client[_0x559e('0x2a')](_0x559e('0x2b'),_0xd85dbd)[_0x559e('0x2c')](function(_0x85c4e1){if(_0x85c4e1[_0x559e('0x2d')]){return logger[_0x559e('0x2d')](_0x559e('0x2e'),JSON[_0x559e('0x2f')](_0x85c4e1));}return logger['info']('email\x20sent');})['catch'](function(_0x1378ab){return logger[_0x559e('0x2d')]('error\x20mail',JSON[_0x559e('0x2f')](_0x1378ab));});}};}function handleError(){return function(_0x3722da){return logger[_0x559e('0x2d')](JSON['stringify'](_0x3722da));};}function handleResult(_0x5f4789){return function(_0x11001e){logger[_0x559e('0xc')]('data',JSON[_0x559e('0x2f')](_0x11001e));if(_0x5f4789[_0x559e('0xf')]&&_0x5f4789['MailAccount'][_0x559e('0x14')]&&!_[_0x559e('0x30')](_0x5f4789[_0x559e('0xe')])){setTimeout(handleSendEmail(_0x5f4789,_0x11001e),0x3c*0x3e8);}};}function handleJob(_0x671fa0){return function(){try{if(_[_0x559e('0x30')](_0x671fa0[_0x559e('0x17')])){return logger[_0x559e('0xc')](_0x559e('0x31'));}if(_['isNil'](_0x671fa0[_0x559e('0x18')])){return logger[_0x559e('0xc')](_0x559e('0x32'));}var _0x2f7b49={'startDate':moment()[_0x559e('0x33')](_0x671fa0[_0x559e('0x17')],_0x671fa0[_0x559e('0x18')])[_0x559e('0x11')](_0x559e('0x34')),'endDate':moment()['format'](_0x559e('0x34')),'type':_0x559e('0x35'),'output':_0x671fa0[_0x559e('0x36')],'name':_0x671fa0[_0x559e('0x13')]};if(!_['isNil'](_0x671fa0[_0x559e('0x37')])){logger[_0x559e('0xc')]('exec\x20defaul\x20report\x20id:%s',_0x671fa0[_0x559e('0x37')]);return analyticDefaultReportController[_0x559e('0x38')]({'id':_0x671fa0[_0x559e('0x37')]},_0x2f7b49)[_0x559e('0x2c')](handleResult(_0x671fa0))[_0x559e('0x39')](handleError());}if(!_[_0x559e('0x30')](_0x671fa0[_0x559e('0x3a')])){logger['info'](_0x559e('0x3b'),_0x671fa0['CustomReportId']);return analyticCustomReportController[_0x559e('0x38')]({'id':_0x671fa0[_0x559e('0x3a')]},_0x2f7b49)[_0x559e('0x2c')](handleResult(_0x671fa0))[_0x559e('0x39')](handleError());}}catch(_0xe1db5b){logger[_0x559e('0x2d')](JSON[_0x559e('0x2f')](_0xe1db5b));}return logger[_0x559e('0xc')](_0x559e('0x3c'));};}function getJobs(_0x2140f8){var _0x53f892={};if(_0x2140f8){_0x53f892['id']=_0x2140f8;}return db['Schedule'][_0x559e('0x3d')]({'where':_0x53f892,'include':[{'model':db[_0x559e('0xf')],'attributes':['id','name',_0x559e('0xe')],'include':[{'model':db[_0x559e('0x3e')],'as':_0x559e('0x14'),'include':[{'model':db['CloudProvider'],'as':_0x559e('0x3f')}]}]}]})[_0x559e('0x2c')](function(_0x2bca2d){var _0x15f787=_[_0x559e('0x40')](manager['jobs']);var _0x5923ef=_['map'](_0x2bca2d,function(_0x2272b0){return _0x2272b0['id'][_0x559e('0x41')]();});var _0x2f001f=_[_0x559e('0x42')](_0x2bca2d,function(_0x11f653){return _0x11f653['id'][_0x559e('0x41')]();});var _0x181748=_0x2140f8?_0x5923ef:_[_0x559e('0x43')](_0x5923ef,_0x15f787);var _0x478562=_['intersection'](_0x5923ef,_0x15f787);var _0x486f1a=_[_0x559e('0x43')](_0x15f787,_0x5923ef);var _0xada04b;var _0xa7cb49;for(_0xada04b=0x0;_0xada04b<_0x486f1a['length']&&!_0x2140f8;_0xada04b+=0x1){_0xa7cb49=_0x486f1a[_0xada04b]['toString']();if(manager[_0x559e('0x44')](_0xa7cb49)){manager[_0x559e('0x45')](_0xa7cb49);manager['deleteJob'](_0xa7cb49);logger[_0x559e('0xc')]('delete\x20cron',_0xa7cb49);}}logger[_0x559e('0xc')]('toRun',JSON['stringify'](_0x181748));for(_0xada04b=0x0;_0xada04b<_0x181748[_0x559e('0x46')];_0xada04b+=0x1){_0xa7cb49=_0x181748[_0xada04b]['toString']();logger[_0x559e('0xc')](_0x559e('0x47'),_0xa7cb49);if(_0x2140f8){logger[_0x559e('0xc')](_0x559e('0x48'),_0x2140f8);logger[_0x559e('0xc')](JSON[_0x559e('0x2f')](_0x2f001f[_0xa7cb49]));BPromise[_0x559e('0x49')]()[_0x559e('0x2c')](handleJob(_0x2f001f[_0xa7cb49]));logger[_0x559e('0xc')](_0x559e('0x4a'),_0x2f001f[_0xa7cb49]['name'],_0x2f001f[_0xa7cb49][_0x559e('0x4b')]);}else if(_0x2f001f[_0xa7cb49]['cron']&&_0x2f001f[_0xa7cb49][_0x559e('0x4c')]&&moment()[_0x559e('0x4d')](_0x2f001f[_0xa7cb49][_0x559e('0x4e')],_0x2f001f[_0xa7cb49][_0x559e('0x4f')])){manager['add'](_0xa7cb49,_0x2f001f[_0xa7cb49][_0x559e('0x4b')],handleJob(_0x2f001f[_0xa7cb49]));manager[_0x559e('0x50')](_0xa7cb49);logger['info']('add\x20cron',_0x2f001f[_0xa7cb49][_0x559e('0x13')],_0x2f001f[_0xa7cb49][_0x559e('0x4b')]);}else if(manager[_0x559e('0x44')](_0xa7cb49)){manager[_0x559e('0x45')](_0xa7cb49);manager[_0x559e('0x51')](_0xa7cb49);logger[_0x559e('0xc')](_0x559e('0x52'),_0x2f001f[_0xa7cb49][_0x559e('0x13')],_0x2f001f[_0xa7cb49][_0x559e('0x4b')]);}}for(_0xada04b=0x0,_0xa7cb49;_0xada04b<_0x478562[_0x559e('0x46')]&&!_0x2140f8;_0xada04b+=0x1){_0xa7cb49=_0x478562[_0xada04b]['toString']();if(manager['exists'](_0xa7cb49)){if(_0x2f001f[_0xa7cb49][_0x559e('0x4b')]&&_0x2f001f[_0xa7cb49][_0x559e('0x4c')]&&moment()[_0x559e('0x4d')](_0x2f001f[_0xa7cb49]['startAt'],_0x2f001f[_0xa7cb49]['endAt'])){manager[_0x559e('0x53')](_0xa7cb49,_0x2f001f[_0xa7cb49]['cron'],handleJob(_0x2f001f[_0xa7cb49]));logger['info'](_0x559e('0x54'),_0x2f001f[_0xa7cb49][_0x559e('0x13')],_0x2f001f[_0xa7cb49][_0x559e('0x4b')]);}else{manager[_0x559e('0x45')](_0xa7cb49);manager['deleteJob'](_0xa7cb49);logger[_0x559e('0xc')](_0x559e('0x52'),_0x2f001f[_0xa7cb49][_0x559e('0x13')],_0x2f001f[_0xa7cb49][_0x559e('0x4b')]);}}}})[_0x559e('0x39')](function(_0x303e6a){logger[_0x559e('0x2d')](JSON[_0x559e('0x2f')](_0x303e6a));});}exports[_0x559e('0x55')]=function(_0x534e42){return getJobs(_0x534e42);};exports[_0x559e('0x50')]=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 a57d770..4b6665c 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 _0x38d0=['error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','then','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment','sentimentAccountId','sentimentRegion','bucket','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','ValidationError','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','findOne','Mixed','catch','name','SequelizeValidationError'];(function(_0x43cf13,_0x4de48e){var _0x16a178=function(_0x434bd0){while(--_0x434bd0){_0x43cf13['push'](_0x43cf13['shift']());}};_0x16a178(++_0x4de48e);}(_0x38d0,0x123));var _0x038d=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x38d0[_0x342baa];return _0x1208f3;};var _=require('lodash');var AWS=require(_0x038d('0x0'));var rp=require(_0x038d('0x1'));var util=require(_0x038d('0x2'));var BPromise=require('bluebird');var db=require(_0x038d('0x3'))['db'];var logger=require(_0x038d('0x4'))('transcribe');function getTranscriptionJob(_0x52b2f8,_0xfff18,_0x53b1b4,_0x26ae55){return new Promise(function(_0x2dd6b0,_0x5914cb){var _0x10dca5=new AWS[(_0x038d('0x5'))]({'accessKeyId':_0xfff18,'secretAccessKey':_0x52b2f8,'region':_0x53b1b4});_0x10dca5[_0x038d('0x6')]({'TranscriptionJobName':_0x26ae55},function(_0x76bc10,_0x22d8ab){if(_0x76bc10){return _0x5914cb(_0x76bc10);}else{return _0x2dd6b0(_0x22d8ab);}});});}function sentiment(_0x1f8f2a,_0x113aec,_0x353806,_0x4689dc,_0xd38e5e){return new Promise(function(_0xf2147f,_0x41ffe0){var _0x56ba0e=new AWS[(_0x038d('0x7'))]({'accessKeyId':_0x113aec,'secretAccessKey':_0x1f8f2a,'region':_0x353806});_0x56ba0e[_0x038d('0x8')]({'Text':_0x4689dc,'LanguageCode':_0xd38e5e[_0x038d('0x9')](0x0,0x2)},function(_0x5b6439,_0x292b7f){if(_0x5b6439){return _0x41ffe0(_0x5b6439);}else{return _0xf2147f(_0x292b7f);}});});}function checkTranscribeJob(_0x36ef7c,_0x1be329,_0x225683){var _0x12c34d;return new BPromise(function(_0x114250,_0x12c302){logger[_0x038d('0xa')](util[_0x038d('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x36ef7c['id'],_0x36ef7c['transcribeName']));return getTranscriptionJob(_0x225683['data1'],_0x225683[_0x038d('0xc')],_0x1be329[_0x038d('0xd')],_0x36ef7c['transcribeName'])['then'](function(_0x4e4960){logger['info'](util[_0x038d('0xb')](_0x038d('0xe'),_0x36ef7c['id'],_0x36ef7c[_0x038d('0xf')],_0x4e4960[_0x038d('0x10')][_0x038d('0x11')]));if(!_0x36ef7c[_0x038d('0x12')]){switch(_0x4e4960[_0x038d('0x10')][_0x038d('0x11')]){case _0x038d('0x13'):var _0x46a9c2={'transcribeStatus':_0x4e4960[_0x038d('0x10')][_0x038d('0x11')],'fileUri':_0x4e4960[_0x038d('0x10')][_0x038d('0x14')]['TranscriptFileUri']};logger['info'](util[_0x038d('0xb')](_0x038d('0x15'),_0x36ef7c['id']));return rp({'uri':_0x4e4960[_0x038d('0x10')][_0x038d('0x14')][_0x038d('0x16')],'json':!![]})[_0x038d('0x17')](function(_0x40586e){logger['info'](util[_0x038d('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x36ef7c['id']));if(_0x40586e&&_0x40586e[_0x038d('0x18')]&&_0x40586e[_0x038d('0x18')]['transcripts']&&_0x40586e[_0x038d('0x18')][_0x038d('0x19')][_0x038d('0x1a')]){_0x46a9c2[_0x038d('0x12')]='';for(var _0xdeab55=0x0;_0xdeab55<_0x40586e['results'][_0x038d('0x19')][_0x038d('0x1a')];_0xdeab55++){_0x46a9c2[_0x038d('0x12')]+=_0x40586e['results']['transcripts'][_0xdeab55]['transcript']+'';}}return _0x36ef7c[_0x038d('0x1b')](_0x46a9c2);})[_0x038d('0x17')](function(){logger[_0x038d('0xa')](util[_0x038d('0xb')](_0x038d('0x1c'),_0x36ef7c['id']));if(!_0x36ef7c[_0x038d('0x1d')]){throw new db[(_0x038d('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1be329[_0x038d('0x1f')]||!_0x1be329[_0x038d('0x20')]||!_0x1be329[_0x038d('0x21')]||!_0x1be329['language']||!_0x1be329[_0x038d('0x22')]){throw new db[(_0x038d('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x46a9c2[_0x038d('0x12')]){throw new Error(_0x038d('0x23'));}if(_0x1be329[_0x038d('0x20')]===_0x225683['id']){return _0x225683;}else{return db[_0x038d('0x24')]['findOne']({'where':{'id':_settings[_0x038d('0x20')]}});}})['then'](function(_0x1ea796){if(!_0x1ea796){throw new db[(_0x038d('0x1e'))]['ValidationError'](_0x038d('0x25'));}if(!_0x1ea796[_0x038d('0x26')]||!_0x1ea796[_0x038d('0xc')]){throw new db['Sequelize'][(_0x038d('0x27'))](_0x038d('0x28'));}_0x12c34d=_0x1ea796;logger['info'](util[_0x038d('0xb')](_0x038d('0x29'),_0x36ef7c['id']));return sentiment(_0x12c34d[_0x038d('0x26')],_0x12c34d['data2'],_0x1be329[_0x038d('0x21')],_0x46a9c2[_0x038d('0x12')],_0x1be329[_0x038d('0x2a')]);})[_0x038d('0x17')](function(_0x5f30e7){logger[_0x038d('0xa')](util[_0x038d('0xb')](_0x038d('0x2b'),_0x36ef7c['id']));return _0x36ef7c[_0x038d('0x1b')]({'sentiment':_0x5f30e7[_0x038d('0x2c')],'sPositive':_0x5f30e7['SentimentScore'][_0x038d('0x2d')],'sNegative':_0x5f30e7[_0x038d('0x2e')][_0x038d('0x2f')],'sMixed':_0x5f30e7[_0x038d('0x2e')]['Mixed'],'sNeutral':_0x5f30e7[_0x038d('0x2e')][_0x038d('0x30')]});})[_0x038d('0x17')](function(){logger[_0x038d('0xa')](util['format'](_0x038d('0x1c'),_0x36ef7c['id']));_0x114250();});case _0x038d('0x31'):return _0x36ef7c['update']({'transcribeStatus':_0x038d('0x31'),'failureReason':_0x4e4960['TranscriptionJob'][_0x038d('0x32')]})[_0x038d('0x17')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x36ef7c['id']));_0x114250();});default:logger[_0x038d('0xa')](util[_0x038d('0xb')](_0x038d('0x33'),_0x36ef7c['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x36ef7c['tempSentiment']){throw new db[(_0x038d('0x1e'))][(_0x038d('0x27'))](_0x038d('0x34'));}if(!_0x1be329[_0x038d('0x1f')]||!_0x1be329['sentimentAccountId']||!_0x1be329[_0x038d('0x21')]||!_0x1be329[_0x038d('0x2a')]||!_0x1be329[_0x038d('0x22')]){throw new db[(_0x038d('0x1e'))][(_0x038d('0x27'))](_0x038d('0x35'));}if(!_0x36ef7c[_0x038d('0x12')]){throw new Error(_0x038d('0x23'));}if(_0x1be329[_0x038d('0x20')]===_0x225683['id']){return _0x225683;}else{return db[_0x038d('0x24')][_0x038d('0x36')]({'where':{'id':_settings[_0x038d('0x20')]}});}})[_0x038d('0x17')](function(_0x3051a2){if(!_0x3051a2){throw new db[(_0x038d('0x1e'))][(_0x038d('0x27'))](_0x038d('0x25'));}if(!_0x3051a2[_0x038d('0x26')]||!_0x3051a2[_0x038d('0xc')]){throw new db[(_0x038d('0x1e'))][(_0x038d('0x27'))](_0x038d('0x28'));}_0x12c34d=_0x3051a2;logger[_0x038d('0xa')](util['format'](_0x038d('0x29'),_0x36ef7c['id']));return sentiment(_0x12c34d['data1'],_0x12c34d['data2'],_0x1be329[_0x038d('0x21')],_0x36ef7c[_0x038d('0x12')],_0x1be329[_0x038d('0x2a')]);})[_0x038d('0x17')](function(_0x299e94){logger[_0x038d('0xa')](util[_0x038d('0xb')](_0x038d('0x2b'),_0x36ef7c['id']));return _0x36ef7c[_0x038d('0x1b')]({'sentiment':_0x299e94[_0x038d('0x2c')],'sPositive':_0x299e94[_0x038d('0x2e')][_0x038d('0x2d')],'sNegative':_0x299e94[_0x038d('0x2e')]['Negative'],'sMixed':_0x299e94[_0x038d('0x2e')][_0x038d('0x37')],'sNeutral':_0x299e94[_0x038d('0x2e')][_0x038d('0x30')],'transcribeStatus':_0x038d('0x13')});})[_0x038d('0x17')](function(){logger[_0x038d('0xa')](util[_0x038d('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x36ef7c['id']));_0x114250();});}})[_0x038d('0x38')](function(_0x2162ee){if(_0x2162ee){if(!_0x2162ee[_0x038d('0x39')]||_0x2162ee[_0x038d('0x39')]!==_0x038d('0x3a')){logger[_0x038d('0x3b')](util[_0x038d('0xb')](_0x038d('0x3c'),_0x36ef7c['id']),util[_0x038d('0x3d')](_0x2162ee,{'showHidden':![],'depth':null}));}}_0x114250();});});}function checkTranscribe(){var _0xb11206;var _0x55bcd6;var _0x2df566;return db[_0x038d('0x3e')]['findAll']({'where':{'transcribeStatus':_0x038d('0x3f')}})[_0x038d('0x17')](function(_0x11b2a1){if(!_0x11b2a1||!_0x11b2a1[_0x038d('0x1a')]){throw new db[(_0x038d('0x1e'))][(_0x038d('0x27'))]('No\x20transcribe\x20job\x20to\x20check');}_0xb11206=_0x11b2a1;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x038d('0x17')](function(_0x3d7dcd){if(!_0x3d7dcd){throw new db['Sequelize'][(_0x038d('0x27'))](_0x038d('0x40'));}_0x55bcd6=_0x3d7dcd;if(!_0x55bcd6['transcribe']||!_0x55bcd6[_0x038d('0x41')]||!_0x55bcd6['transcribeRegion']||!_0x55bcd6[_0x038d('0x2a')]||!_0x55bcd6[_0x038d('0x22')]){throw new db['Sequelize'][(_0x038d('0x27'))](_0x038d('0x42'));}return db[_0x038d('0x24')][_0x038d('0x36')]({'where':{'id':_0x55bcd6[_0x038d('0x41')]}});})[_0x038d('0x17')](function(_0x55f50f){if(!_0x55f50f){throw new db[(_0x038d('0x1e'))][(_0x038d('0x27'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x55f50f[_0x038d('0x26')]||!_0x55f50f[_0x038d('0xc')]){throw new db[(_0x038d('0x1e'))]['ValidationError'](_0x038d('0x28'));}_0x2df566=_0x55f50f;var _0x408119=[];_0xb11206[_0x038d('0x43')](function(_0x3d30c4){_0x408119[_0x038d('0x44')](checkTranscribeJob(_0x3d30c4,_0x55bcd6,_0x2df566));});return BPromise[_0x038d('0x45')](_0x408119);})[_0x038d('0x38')](function(_0x50f1f2){if(_0x50f1f2){if(!_0x50f1f2[_0x038d('0x39')]||_0x50f1f2[_0x038d('0x39')]!==_0x038d('0x3a')){logger[_0x038d('0x3b')](util[_0x038d('0x3d')](_0x50f1f2,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xc7ea=['resolve','tempSentiment','sentiment','Negative','COMPLETED','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','forEach','push','all','catch','SequelizeValidationError','inspect','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed'];(function(_0x3939c3,_0x22b35f){var _0x5f17ec=function(_0x425feb){while(--_0x425feb){_0x3939c3['push'](_0x3939c3['shift']());}};_0x5f17ec(++_0x22b35f);}(_0xc7ea,0x171));var _0xac7e=function(_0x4cee82,_0x208e67){_0x4cee82=_0x4cee82-0x0;var _0x200c1d=_0xc7ea[_0x4cee82];return _0x200c1d;};var _=require(_0xac7e('0x0'));var AWS=require(_0xac7e('0x1'));var rp=require('request-promise');var util=require(_0xac7e('0x2'));var BPromise=require(_0xac7e('0x3'));var db=require(_0xac7e('0x4'))['db'];var logger=require(_0xac7e('0x5'))('transcribe');function getTranscriptionJob(_0x134a3d,_0x39bf60,_0x1c15cf,_0x3ca05f){return new Promise(function(_0x26b1c5,_0x45e73f){var _0x447bfe=new AWS[(_0xac7e('0x6'))]({'accessKeyId':_0x39bf60,'secretAccessKey':_0x134a3d,'region':_0x1c15cf});_0x447bfe[_0xac7e('0x7')]({'TranscriptionJobName':_0x3ca05f},function(_0x1cb874,_0x4d83fb){if(_0x1cb874){return _0x45e73f(_0x1cb874);}else{return _0x26b1c5(_0x4d83fb);}});});}function sentiment(_0x114e82,_0x446f88,_0x2efbf4,_0x173b59,_0x39d2e3){return new Promise(function(_0x260889,_0x10873d){var _0x240869=new AWS[(_0xac7e('0x8'))]({'accessKeyId':_0x446f88,'secretAccessKey':_0x114e82,'region':_0x2efbf4});_0x240869[_0xac7e('0x9')]({'Text':_0x173b59,'LanguageCode':_0x39d2e3[_0xac7e('0xa')](0x0,0x2)},function(_0xe9d96a,_0x4efc1d){if(_0xe9d96a){return _0x10873d(_0xe9d96a);}else{return _0x260889(_0x4efc1d);}});});}function checkTranscribeJob(_0x9cd7c,_0x13e126,_0x5d4537){var _0x617cf9;return new BPromise(function(_0x24d5e9,_0x37839d){logger[_0xac7e('0xb')](util[_0xac7e('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x9cd7c['id'],_0x9cd7c[_0xac7e('0xd')]));return getTranscriptionJob(_0x5d4537[_0xac7e('0xe')],_0x5d4537[_0xac7e('0xf')],_0x13e126[_0xac7e('0x10')],_0x9cd7c[_0xac7e('0xd')])[_0xac7e('0x11')](function(_0x7ee114){logger[_0xac7e('0xb')](util['format'](_0xac7e('0x12'),_0x9cd7c['id'],_0x9cd7c[_0xac7e('0xd')],_0x7ee114[_0xac7e('0x13')][_0xac7e('0x14')]));if(!_0x9cd7c[_0xac7e('0x15')]){switch(_0x7ee114['TranscriptionJob'][_0xac7e('0x14')]){case'COMPLETED':var _0xba3d01={'transcribeStatus':_0x7ee114['TranscriptionJob'][_0xac7e('0x14')],'fileUri':_0x7ee114[_0xac7e('0x13')][_0xac7e('0x16')][_0xac7e('0x17')]};logger[_0xac7e('0xb')](util[_0xac7e('0xc')]('[RECORDING:%d]\x20Get\x20transcript',_0x9cd7c['id']));return rp({'uri':_0x7ee114[_0xac7e('0x13')][_0xac7e('0x16')]['TranscriptFileUri'],'json':!![]})[_0xac7e('0x11')](function(_0x2ebc78){logger[_0xac7e('0xb')](util[_0xac7e('0xc')](_0xac7e('0x18'),_0x9cd7c['id']));if(_0x2ebc78&&_0x2ebc78[_0xac7e('0x19')]&&_0x2ebc78[_0xac7e('0x19')][_0xac7e('0x1a')]&&_0x2ebc78[_0xac7e('0x19')][_0xac7e('0x1a')][_0xac7e('0x1b')]){_0xba3d01['fileText']='';for(var _0x57c945=0x0;_0x57c945<_0x2ebc78[_0xac7e('0x19')][_0xac7e('0x1a')][_0xac7e('0x1b')];_0x57c945++){_0xba3d01['fileText']+=_0x2ebc78[_0xac7e('0x19')][_0xac7e('0x1a')][_0x57c945][_0xac7e('0x1c')]+'';}}return _0x9cd7c[_0xac7e('0x1d')](_0xba3d01);})['then'](function(){logger['info'](util[_0xac7e('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x9cd7c['id']));if(!_0x9cd7c['tempSentiment']){throw new db[(_0xac7e('0x1e'))][(_0xac7e('0x1f'))](_0xac7e('0x20'));}if(!_0x13e126['sentiment']||!_0x13e126[_0xac7e('0x21')]||!_0x13e126[_0xac7e('0x22')]||!_0x13e126[_0xac7e('0x23')]||!_0x13e126[_0xac7e('0x24')]){throw new db['Sequelize'][(_0xac7e('0x1f'))](_0xac7e('0x25'));}if(!_0xba3d01[_0xac7e('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x13e126[_0xac7e('0x21')]===_0x5d4537['id']){return _0x5d4537;}else{return db[_0xac7e('0x26')][_0xac7e('0x27')]({'where':{'id':_settings[_0xac7e('0x21')]}});}})['then'](function(_0x282a26){if(!_0x282a26){throw new db['Sequelize'][(_0xac7e('0x1f'))](_0xac7e('0x28'));}if(!_0x282a26[_0xac7e('0xe')]||!_0x282a26['data2']){throw new db[(_0xac7e('0x1e'))][(_0xac7e('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x617cf9=_0x282a26;logger['info'](util[_0xac7e('0xc')](_0xac7e('0x29'),_0x9cd7c['id']));return sentiment(_0x617cf9[_0xac7e('0xe')],_0x617cf9[_0xac7e('0xf')],_0x13e126[_0xac7e('0x22')],_0xba3d01[_0xac7e('0x15')],_0x13e126[_0xac7e('0x23')]);})[_0xac7e('0x11')](function(_0x38bfb1){logger['info'](util[_0xac7e('0xc')](_0xac7e('0x2a'),_0x9cd7c['id']));return _0x9cd7c[_0xac7e('0x1d')]({'sentiment':_0x38bfb1[_0xac7e('0x2b')],'sPositive':_0x38bfb1[_0xac7e('0x2c')][_0xac7e('0x2d')],'sNegative':_0x38bfb1['SentimentScore']['Negative'],'sMixed':_0x38bfb1[_0xac7e('0x2c')][_0xac7e('0x2e')],'sNeutral':_0x38bfb1[_0xac7e('0x2c')][_0xac7e('0x2f')]});})[_0xac7e('0x11')](function(){logger[_0xac7e('0xb')](util[_0xac7e('0xc')](_0xac7e('0x30'),_0x9cd7c['id']));_0x24d5e9();});case _0xac7e('0x31'):return _0x9cd7c['update']({'transcribeStatus':_0xac7e('0x31'),'failureReason':_0x7ee114[_0xac7e('0x13')]['FailureReason']})[_0xac7e('0x11')](function(){logger[_0xac7e('0xb')](util['format'](_0xac7e('0x30'),_0x9cd7c['id']));_0x24d5e9();});default:logger[_0xac7e('0xb')](util[_0xac7e('0xc')](_0xac7e('0x32'),_0x9cd7c['id']));break;}}else{return BPromise[_0xac7e('0x33')]()[_0xac7e('0x11')](function(){if(!_0x9cd7c[_0xac7e('0x34')]){throw new db[(_0xac7e('0x1e'))]['ValidationError'](_0xac7e('0x20'));}if(!_0x13e126[_0xac7e('0x35')]||!_0x13e126['sentimentAccountId']||!_0x13e126[_0xac7e('0x22')]||!_0x13e126[_0xac7e('0x23')]||!_0x13e126[_0xac7e('0x24')]){throw new db['Sequelize']['ValidationError'](_0xac7e('0x25'));}if(!_0x9cd7c[_0xac7e('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x13e126[_0xac7e('0x21')]===_0x5d4537['id']){return _0x5d4537;}else{return db[_0xac7e('0x26')][_0xac7e('0x27')]({'where':{'id':_settings[_0xac7e('0x21')]}});}})[_0xac7e('0x11')](function(_0x21e628){if(!_0x21e628){throw new db[(_0xac7e('0x1e'))][(_0xac7e('0x1f'))](_0xac7e('0x28'));}if(!_0x21e628[_0xac7e('0xe')]||!_0x21e628[_0xac7e('0xf')]){throw new db[(_0xac7e('0x1e'))][(_0xac7e('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x617cf9=_0x21e628;logger[_0xac7e('0xb')](util[_0xac7e('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x9cd7c['id']));return sentiment(_0x617cf9[_0xac7e('0xe')],_0x617cf9[_0xac7e('0xf')],_0x13e126[_0xac7e('0x22')],_0x9cd7c[_0xac7e('0x15')],_0x13e126['language']);})[_0xac7e('0x11')](function(_0xc23c3e){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x9cd7c['id']));return _0x9cd7c[_0xac7e('0x1d')]({'sentiment':_0xc23c3e['Sentiment'],'sPositive':_0xc23c3e[_0xac7e('0x2c')][_0xac7e('0x2d')],'sNegative':_0xc23c3e['SentimentScore'][_0xac7e('0x36')],'sMixed':_0xc23c3e[_0xac7e('0x2c')][_0xac7e('0x2e')],'sNeutral':_0xc23c3e[_0xac7e('0x2c')][_0xac7e('0x2f')],'transcribeStatus':_0xac7e('0x37')});})['then'](function(){logger[_0xac7e('0xb')](util[_0xac7e('0xc')](_0xac7e('0x30'),_0x9cd7c['id']));_0x24d5e9();});}})['catch'](function(_0x227673){if(_0x227673){if(!_0x227673[_0xac7e('0x38')]||_0x227673['name']!=='SequelizeValidationError'){logger['error'](util['format'](_0xac7e('0x39'),_0x9cd7c['id']),util['inspect'](_0x227673,{'showHidden':![],'depth':null}));}}_0x24d5e9();});});}function checkTranscribe(){var _0x47ae4e;var _0x5b3929;var _0x4cd8f6;return db[_0xac7e('0x3a')]['findAll']({'where':{'transcribeStatus':_0xac7e('0x3b')}})[_0xac7e('0x11')](function(_0x2b9ffb){if(!_0x2b9ffb||!_0x2b9ffb['length']){throw new db['Sequelize'][(_0xac7e('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x47ae4e=_0x2b9ffb;return db['Setting'][_0xac7e('0x27')]({'where':{'id':0x1}});})[_0xac7e('0x11')](function(_0x319429){if(!_0x319429){throw new db['Sequelize']['ValidationError']('Settings\x20not\x20available');}_0x5b3929=_0x319429;if(!_0x5b3929['transcribe']||!_0x5b3929[_0xac7e('0x3c')]||!_0x5b3929[_0xac7e('0x10')]||!_0x5b3929[_0xac7e('0x23')]||!_0x5b3929[_0xac7e('0x24')]){throw new db[(_0xac7e('0x1e'))][(_0xac7e('0x1f'))](_0xac7e('0x3d'));}return db[_0xac7e('0x26')][_0xac7e('0x27')]({'where':{'id':_0x5b3929['transcribeAccountId']}});})[_0xac7e('0x11')](function(_0x188f59){if(!_0x188f59){throw new db[(_0xac7e('0x1e'))]['ValidationError'](_0xac7e('0x28'));}if(!_0x188f59[_0xac7e('0xe')]||!_0x188f59[_0xac7e('0xf')]){throw new db[(_0xac7e('0x1e'))][(_0xac7e('0x1f'))](_0xac7e('0x3e'));}_0x4cd8f6=_0x188f59;var _0x43cad3=[];_0x47ae4e[_0xac7e('0x3f')](function(_0xbbef){_0x43cad3[_0xac7e('0x40')](checkTranscribeJob(_0xbbef,_0x5b3929,_0x4cd8f6));});return BPromise[_0xac7e('0x41')](_0x43cad3);})[_0xac7e('0x42')](function(_0x482f27){if(_0x482f27){if(!_0x482f27[_0xac7e('0x38')]||_0x482f27['name']!==_0xac7e('0x43')){logger['error'](util[_0xac7e('0x44')](_0x482f27,{'showHidden':![],'depth':null}));}}});}exports[_0xac7e('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 2124bde..ace94cf 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 _0x4ac9=['../../mysqldb','../logger','schedule','redis','defaults','localhost','lastMsgAt','map','info','join','WhatsappInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','start','lodash','ioredis','util','../../config/environment'];(function(_0x30dea6,_0x45559f){var _0x1a70bd=function(_0x52a805){while(--_0x52a805){_0x30dea6['push'](_0x30dea6['shift']());}};_0x1a70bd(++_0x45559f);}(_0x4ac9,0xab));var _0x94ac=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x4ac9[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x94ac('0x0'));var moment=require('moment');var Redis=require(_0x94ac('0x1'));var util=require(_0x94ac('0x2'));var config=require(_0x94ac('0x3'));var db=require(_0x94ac('0x4'))['db'];var logger=require(_0x94ac('0x5'))(_0x94ac('0x6'));config[_0x94ac('0x7')]=_[_0x94ac('0x8')](config[_0x94ac('0x7')],{'host':_0x94ac('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x94ac('0x7')]));function closeInteractions(){var _0x14c39f=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x94ac('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})['then'](function(_0x5ca0c7){if(_0x5ca0c7&&_0x5ca0c7['length']){_0x14c39f=_[_0x94ac('0xb')](_0x5ca0c7||[],'id');logger[_0x94ac('0xc')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x14c39f[_0x94ac('0xd')]());return db[_0x94ac('0xe')][_0x94ac('0xf')]({'closeReason':_0x94ac('0x10'),'disposition':_0x94ac('0x11'),'closed':!![],'closedAt':moment()['format'](_0x94ac('0x12'))},{'where':{'id':_0x14c39f}});}})['then'](function(){if(_0x14c39f&&_0x14c39f[_0x94ac('0x13')]){logger[_0x94ac('0xc')](_0x94ac('0x14'),_0x14c39f['join']());for(var _0x4e27a9=0x0;_0x4e27a9<_0x14c39f['length'];_0x4e27a9++){io['emit'](_0x94ac('0x15'),{'id':_0x14c39f[_0x4e27a9],'closed':!![]});}}})[_0x94ac('0x16')](function(_0x4cd92a){logger[_0x94ac('0x17')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x4cd92a?util['inspect'](_0x4cd92a,{'showHidden':![],'depth':null}):'');});}exports[_0x94ac('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x91da=['localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','info','update','system','YYYY-MM-DD\x20HH:mm:ss','then','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults'];(function(_0xffd37c,_0x4072b4){var _0x111f03=function(_0x44d961){while(--_0x44d961){_0xffd37c['push'](_0xffd37c['shift']());}};_0x111f03(++_0x4072b4);}(_0x91da,0xe7));var _0xa91d=function(_0x14ca62,_0x372a32){_0x14ca62=_0x14ca62-0x0;var _0x1640e7=_0x91da[_0x14ca62];return _0x1640e7;};'use strict';var _=require(_0xa91d('0x0'));var moment=require(_0xa91d('0x1'));var Redis=require(_0xa91d('0x2'));var util=require(_0xa91d('0x3'));var config=require('../../config/environment');var db=require(_0xa91d('0x4'))['db'];var logger=require(_0xa91d('0x5'))(_0xa91d('0x6'));config[_0xa91d('0x7')]=_[_0xa91d('0x8')](config[_0xa91d('0x7')],{'host':_0xa91d('0x9'),'port':0x18eb});var io=require(_0xa91d('0xa'))(new Redis(config[_0xa91d('0x7')]));function closeInteractions(){var _0x3de0cd=[];return db[_0xa91d('0xb')][_0xa91d('0xc')]({'raw':!![],'attributes':['id',_0xa91d('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xa91d('0xe')](0x18,_0xa91d('0xf'))}}})['then'](function(_0x543029){if(_0x543029&&_0x543029['length']){_0x3de0cd=_['map'](_0x543029||[],'id');logger[_0xa91d('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x3de0cd['join']());return db[_0xa91d('0xb')][_0xa91d('0x11')]({'closeReason':_0xa91d('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xa91d('0x13'))},{'where':{'id':_0x3de0cd}});}})[_0xa91d('0x14')](function(){if(_0x3de0cd&&_0x3de0cd[_0xa91d('0x15')]){logger[_0xa91d('0x10')](_0xa91d('0x16'),_0x3de0cd[_0xa91d('0x17')]());for(var _0x5fddb0=0x0;_0x5fddb0<_0x3de0cd[_0xa91d('0x15')];_0x5fddb0++){io[_0xa91d('0x18')](_0xa91d('0x19'),{'id':_0x3de0cd[_0x5fddb0],'closed':!![]});}}})[_0xa91d('0x1a')](function(_0x4a2b74){logger[_0xa91d('0x1b')](_0xa91d('0x1c'),_0x4a2b74?util[_0xa91d('0x1d')](_0x4a2b74,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index f7c50e6..66ca961 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa670=['now','innocenzo.biondo','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','Biondo','@xcally.com','push'];(function(_0x58c338,_0x1955c6){var _0x5c3133=function(_0xa79a6c){while(--_0xa79a6c){_0x58c338['push'](_0x58c338['shift']());}};_0x5c3133(++_0x1955c6);}(_0xa670,0x86));var _0x0a67=function(_0x5b266e,_0x156efd){_0x5b266e=_0x5b266e-0x0;var _0x39ca67=_0xa670[_0x5b266e];return _0x39ca67;};'use strict';var util=require(_0x0a67('0x0'));var db=require(_0x0a67('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x0a67('0x2')+i,'lastName':_0x0a67('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x0a67('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0a67('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x0a67('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0a67('0x6')](),'updatedAt':Date[_0x0a67('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0a67('0x5')]({'id':i,'firstName':_0x0a67('0x2')+i,'lastName':_0x0a67('0x3')+i,'phone':0xf879fb460+i,'email':_0x0a67('0x7')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0a67('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x0a67('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0a67('0x6')](),'updatedAt':Date[_0x0a67('0x6')]()});}db[_0x0a67('0x8')]['destroy']({'where':{}})[_0x0a67('0x9')](function(){return db[_0x0a67('0x8')][_0x0a67('0xa')](contacts);})[_0x0a67('0x9')](function(){console[_0x0a67('0xb')](_0x0a67('0xc'),_0x0a67('0xd'));return db[_0x0a67('0xe')][_0x0a67('0xf')]({'where':{}});})[_0x0a67('0x9')](function(){return db[_0x0a67('0xe')]['bulkCreate'](hopper);})[_0x0a67('0x9')](function(){console[_0x0a67('0xb')]('finished\x20populating',_0x0a67('0x10'));return db[_0x0a67('0x8')][_0x0a67('0xa')](contacts2);})['then'](function(){console[_0x0a67('0xb')](_0x0a67('0xc'),_0x0a67('0x11'));return db[_0x0a67('0xe')][_0x0a67('0xa')](hopper2);})[_0x0a67('0x9')](function(){console[_0x0a67('0xb')](_0x0a67('0xc'),_0x0a67('0x12'));})[_0x0a67('0x13')](function(_0x37dd3f){console[_0x0a67('0xb')](_0x37dd3f);}); \ No newline at end of file +var _0xad93=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','bulkCreate','log','contacts1','CmHopper','destroy','hopper1','finished\x20populating','catch','util','push'];(function(_0x14e2f4,_0x589017){var _0x3ae9c1=function(_0x2fa65f){while(--_0x2fa65f){_0x14e2f4['push'](_0x14e2f4['shift']());}};_0x3ae9c1(++_0x589017);}(_0xad93,0x174));var _0x3ad9=function(_0x23e26c,_0x501919){_0x23e26c=_0x23e26c-0x0;var _0x5deb1b=_0xad93[_0x23e26c];return _0x5deb1b;};'use strict';var util=require(_0x3ad9('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x3ad9('0x1')]({'id':i,'firstName':_0x3ad9('0x2')+i,'lastName':_0x3ad9('0x3')+i,'phone':0xf879fb460+i,'email':_0x3ad9('0x4')+i+_0x3ad9('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3ad9('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x3ad9('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3ad9('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x3ad9('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3ad9('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x3ad9('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3ad9('0x6')](),'updatedAt':Date['now']()});}db[_0x3ad9('0x7')]['destroy']({'where':{}})[_0x3ad9('0x8')](function(){return db[_0x3ad9('0x7')][_0x3ad9('0x9')](contacts);})['then'](function(){console[_0x3ad9('0xa')]('finished\x20populating',_0x3ad9('0xb'));return db[_0x3ad9('0xc')][_0x3ad9('0xd')]({'where':{}});})['then'](function(){return db[_0x3ad9('0xc')]['bulkCreate'](hopper);})[_0x3ad9('0x8')](function(){console[_0x3ad9('0xa')]('finished\x20populating',_0x3ad9('0xe'));return db['CmContact'][_0x3ad9('0x9')](contacts2);})['then'](function(){console[_0x3ad9('0xa')]('finished\x20populating','contacts2');return db[_0x3ad9('0xc')][_0x3ad9('0x9')](hopper2);})['then'](function(){console[_0x3ad9('0xa')](_0x3ad9('0xf'),'hopper2');})[_0x3ad9('0x10')](function(_0x37df39){console[_0x3ad9('0xa')](_0x37df39);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 2b5ae25..7897df6 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x230d=['%s%s@xcally.com','password','wss','all','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','../mysqldb','push','format','agent','%s%s'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x230d,0x108));var _0xd230=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x230d[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0xd230('0x0'));var db=require(_0xd230('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd230('0x2')]({'name':util[_0xd230('0x3')]('%s%s',_0xd230('0x4'),i),'fullname':util[_0xd230('0x3')](_0xd230('0x5'),_0xd230('0x4'),i),'email':util[_0xd230('0x3')](_0xd230('0x6'),_0xd230('0x4'),i),'role':_0xd230('0x4'),'password':_0xd230('0x7'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0xd230('0x8')],'disallow':[_0xd230('0x9')],'allow':['ulaw'],'defaultuser':util[_0xd230('0x3')](_0xd230('0x5'),_0xd230('0x4'),i),'encryption':_0xd230('0xa'),'avpf':_0xd230('0xa'),'force_avp':_0xd230('0xa'),'icesupport':_0xd230('0xa'),'dtlsenable':_0xd230('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xd230('0xb'),'callerid':util['format'](_0xd230('0xc'),util[_0xd230('0x3')](_0xd230('0x5'),_0xd230('0x4'),i),0xfa0+i)});}db[_0xd230('0xd')][_0xd230('0xe')](users)[_0xd230('0xf')](function(){console[_0xd230('0x10')](_0xd230('0x11'));})['catch'](function(_0x3cfeea){console[_0xd230('0x10')](_0x3cfeea);}); \ No newline at end of file +var _0x6f9a=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','util','../mysqldb','push','format','%s%s','agent','password','friend','udp','wss','all'];(function(_0x3f2fea,_0x3c4ea8){var _0x69a4d5=function(_0x223109){while(--_0x223109){_0x3f2fea['push'](_0x3f2fea['shift']());}};_0x69a4d5(++_0x3c4ea8);}(_0x6f9a,0x1d8));var _0xa6f9=function(_0x583ba9,_0x269585){_0x583ba9=_0x583ba9-0x0;var _0x5a422a=_0x6f9a[_0x583ba9];return _0x5a422a;};'use strict';var util=require(_0xa6f9('0x0'));var db=require(_0xa6f9('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa6f9('0x2')]({'name':util[_0xa6f9('0x3')](_0xa6f9('0x4'),'agent',i),'fullname':util['format']('%s%s',_0xa6f9('0x5'),i),'email':util[_0xa6f9('0x3')]('%s%s@xcally.com',_0xa6f9('0x5'),i),'role':_0xa6f9('0x5'),'password':_0xa6f9('0x6'),'internal':0xfa0+i,'type':_0xa6f9('0x7'),'transport':[_0xa6f9('0x8'),'ws',_0xa6f9('0x9')],'disallow':[_0xa6f9('0xa')],'allow':[_0xa6f9('0xb')],'defaultuser':util[_0xa6f9('0x3')](_0xa6f9('0x4'),_0xa6f9('0x5'),i),'encryption':'yes','avpf':_0xa6f9('0xc'),'force_avp':_0xa6f9('0xc'),'icesupport':_0xa6f9('0xc'),'dtlsenable':_0xa6f9('0xc'),'dtlsverify':'no','dtlscertfile':_0xa6f9('0xd'),'dtlsprivatekey':_0xa6f9('0xe'),'dtlssetup':_0xa6f9('0xf'),'callerid':util[_0xa6f9('0x3')]('\x22%s\x22\x20<%s>',util[_0xa6f9('0x3')](_0xa6f9('0x4'),'agent',i),0xfa0+i)});}db[_0xa6f9('0x10')][_0xa6f9('0x11')](users)[_0xa6f9('0x12')](function(){console[_0xa6f9('0x13')](_0xa6f9('0x14'));})['catch'](function(_0x158f5d){console[_0xa6f9('0x13')](_0x158f5d);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 274a724..bcdf718 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c84=['getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','openchannel','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','MailInteractions','removeMailInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','User','role','agent','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','where','telephone','Campaign','format','%s:queue:%s','Agents','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','WhatsappQueue','Trunk','user','VoiceQueue','FaxQueues','MailQueue','Telephones','Trunks','getVoiceQueues'];(function(_0x46b8aa,_0x246d21){var _0x5a3d61=function(_0x5c748d){while(--_0x5c748d){_0x46b8aa['push'](_0x46b8aa['shift']());}};_0x5a3d61(++_0x246d21);}(_0x4c84,0x14d));var _0x44c8=function(_0x34f8a0,_0x29483c){_0x34f8a0=_0x34f8a0-0x0;var _0x513be8=_0x4c84[_0x34f8a0];return _0x513be8;};'use strict';var _=require('lodash');var util=require(_0x44c8('0x0'));var BPromise=require(_0x44c8('0x1'));var db=require(_0x44c8('0x2'))['db'];var config=require(_0x44c8('0x3'));var queryQueues={'attributes':['id',_0x44c8('0x4')],'include':[{'as':'Agents','model':db[_0x44c8('0x5')],'attributes':['id',_0x44c8('0x4'),_0x44c8('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x44c8('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x44c8('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x44c8('0x4'),_0x44c8('0x8')],'where':{'type':_0x44c8('0x9')}};function getAssociatedResources(_0x31a428,_0xb4fe3b,_0x1aa0b1){return db[_0x44c8('0xa')][_0x44c8('0xb')]({'where':{'name':_0x31a428,'userProfileId':_0xb4fe3b},'raw':!![]})[_0x44c8('0xc')](function(_0x1f7371){if(_0x1f7371){if(_0x1f7371['autoAssociation']){switch(_0x31a428){case _0x44c8('0xd'):case _0x44c8('0xe'):case'FaxQueues':case _0x44c8('0xf'):case _0x44c8('0x10'):case _0x44c8('0x11'):case _0x44c8('0x12'):return db[_0x1aa0b1][_0x44c8('0x13')](queryQueues);case'Telephones':return db[_0x1aa0b1][_0x44c8('0x13')](queryTelephones);case'Trunks':return db[_0x1aa0b1][_0x44c8('0x13')](queryTrunks);case _0x44c8('0x14'):return db[_0x1aa0b1]['findAll'](queryCampaigns);}}else{return db[_0x44c8('0x15')][_0x44c8('0x13')]({'attributes':[_0x44c8('0x16')],'where':{'sectionId':_0x1f7371['id']},'raw':!![]})[_0x44c8('0xc')](function(_0x28f849){if(_0x28f849){var _0x1c641b={'where':{'id':_['map'](_0x28f849,_0x44c8('0x16'))},'raw':!![]};switch(_0x1aa0b1){case _0x44c8('0x5'):_0x1c641b[_0x44c8('0x17')]['role']=_0x44c8('0x18');break;case _0x44c8('0x19'):_0x1c641b[_0x44c8('0x17')][_0x44c8('0x8')]=_0x44c8('0x9');break;}return db[_0x1aa0b1][_0x44c8('0x13')](_0x1c641b);}else{return[];}});}}else{return[];}})['then'](function(_0x50a564){return _0x50a564;});}function joinOrLeaveQueues(_0x18bbf9,_0x2e5e8e,_0x2293a8,_0x19e649){_0x18bbf9[_0x2e5e8e](util[_0x44c8('0x1a')](_0x44c8('0x1b'),_0x2293a8,_0x19e649[_0x44c8('0x4')]));if(_0x19e649[_0x44c8('0x1c')]){for(var _0x3d7d0f=0x0;_0x3d7d0f<_0x19e649[_0x44c8('0x1c')][_0x44c8('0x1d')];_0x3d7d0f+=0x1){_0x18bbf9[_0x2e5e8e](util[_0x44c8('0x1a')](_0x44c8('0x1e'),_0x19e649[_0x44c8('0x1c')][_0x3d7d0f][_0x44c8('0x4')]));}}}function joinOrLeave(_0x5f10ec,_0x380859,_0x58298b){var _0x327afd;if(_0x5f10ec['handshake'][_0x44c8('0x1f')]['id']){db[_0x44c8('0x5')][_0x44c8('0x20')]({'attributes':['id',_0x44c8('0x4'),_0x44c8('0x6'),_0x44c8('0x21')],'where':{'id':_0x5f10ec[_0x44c8('0x22')]['query']['id']},'include':[{'model':db[_0x44c8('0x23')],'as':_0x44c8('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x44c8('0x25')],'as':_0x44c8('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x44c8('0x27')],'as':_0x44c8('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x44c8('0x29'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x19df7e){if(_0x19df7e){_0x327afd=_0x19df7e;_0x5f10ec[_0x380859](util[_0x44c8('0x1a')]('user:%s',_0x19df7e['name']));var _0x4c410e=[];switch(_0x19df7e[_0x44c8('0x6')]){case _0x44c8('0x2a'):_0x5f10ec[_0x380859](_0x44c8('0x2b'));_0x5f10ec[_0x380859](_0x44c8('0x2c'));if(queryQueues['hasOwnProperty'](_0x44c8('0x2d'))){delete queryQueues['include'];}_0x4c410e[_0x44c8('0x2e')](db['VoiceQueue'][_0x44c8('0x13')](queryQueues));_0x4c410e[_0x44c8('0x2e')](db[_0x44c8('0x2f')][_0x44c8('0x13')](queryQueues));_0x4c410e[_0x44c8('0x2e')](db[_0x44c8('0x30')]['findAll'](queryQueues));_0x4c410e[_0x44c8('0x2e')](db[_0x44c8('0x31')]['findAll'](queryQueues));_0x4c410e[_0x44c8('0x2e')](db['MailQueue'][_0x44c8('0x13')](queryQueues));_0x4c410e[_0x44c8('0x2e')](db['OpenchannelQueue']['findAll'](queryQueues));_0x4c410e[_0x44c8('0x2e')](db[_0x44c8('0x32')]['findAll'](queryQueues));_0x4c410e[_0x44c8('0x2e')](db[_0x44c8('0x5')]['findAll'](queryTelephones));_0x4c410e[_0x44c8('0x2e')](db[_0x44c8('0x33')][_0x44c8('0x13')](queryTrunks));_0x4c410e['push'](db[_0x44c8('0x19')][_0x44c8('0x13')](queryCampaigns));_0x4c410e[_0x44c8('0x2e')](db[_0x44c8('0x5')][_0x44c8('0x13')](queryAgents));break;case _0x44c8('0x34'):_0x5f10ec[_0x380859](_0x44c8('0x2b'));_0x5f10ec[_0x380859]('voice:outbound');_0x4c410e[_0x44c8('0x2e')](getAssociatedResources(_0x44c8('0xd'),_0x19df7e['userProfileId'],_0x44c8('0x35')));_0x4c410e[_0x44c8('0x2e')](getAssociatedResources(_0x44c8('0xe'),_0x19df7e[_0x44c8('0x21')],_0x44c8('0x2f')));_0x4c410e[_0x44c8('0x2e')](getAssociatedResources(_0x44c8('0x36'),_0x19df7e[_0x44c8('0x21')],_0x44c8('0x30')));_0x4c410e[_0x44c8('0x2e')](getAssociatedResources(_0x44c8('0xf'),_0x19df7e[_0x44c8('0x21')],_0x44c8('0x31')));_0x4c410e[_0x44c8('0x2e')](getAssociatedResources(_0x44c8('0x10'),_0x19df7e[_0x44c8('0x21')],_0x44c8('0x37')));_0x4c410e[_0x44c8('0x2e')](getAssociatedResources(_0x44c8('0x11'),_0x19df7e[_0x44c8('0x21')],'OpenchannelQueue'));_0x4c410e['push'](getAssociatedResources('WhatsappQueues',_0x19df7e[_0x44c8('0x21')],'WhatsappQueue'));_0x4c410e[_0x44c8('0x2e')](getAssociatedResources(_0x44c8('0x38'),_0x19df7e['userProfileId'],_0x44c8('0x5')));_0x4c410e[_0x44c8('0x2e')](getAssociatedResources(_0x44c8('0x39'),_0x19df7e[_0x44c8('0x21')],_0x44c8('0x33')));_0x4c410e[_0x44c8('0x2e')](getAssociatedResources(_0x44c8('0x14'),_0x19df7e[_0x44c8('0x21')],'Campaign'));_0x4c410e[_0x44c8('0x2e')](db[_0x44c8('0x5')][_0x44c8('0x13')](queryAgents));break;case _0x44c8('0x7'):_0x5f10ec[_0x380859](_0x44c8('0x2b'));_0x5f10ec[_0x380859](_0x44c8('0x2c'));_0x4c410e[_0x44c8('0x2e')](_0x19df7e[_0x44c8('0x3a')]({'attributes':['id','name']}));_0x4c410e[_0x44c8('0x2e')](_0x19df7e[_0x44c8('0x3b')]({'attributes':['id',_0x44c8('0x4')]}));_0x4c410e[_0x44c8('0x2e')](_0x19df7e[_0x44c8('0x3c')]({'attributes':['id',_0x44c8('0x4')]}));_0x4c410e[_0x44c8('0x2e')](_0x19df7e['getSmsQueues']({'attributes':['id','name']}));_0x4c410e[_0x44c8('0x2e')](_0x19df7e[_0x44c8('0x3d')]({'attributes':['id',_0x44c8('0x4')]}));_0x4c410e[_0x44c8('0x2e')](_0x19df7e[_0x44c8('0x3e')]({'attributes':['id','name']}));_0x4c410e[_0x44c8('0x2e')](_0x19df7e['getWhatsappQueues']({'attributes':['id',_0x44c8('0x4')]}));break;}return BPromise[_0x44c8('0x3f')](_0x4c410e);}})[_0x44c8('0xc')](function(_0x2a593f){if(_0x2a593f&&_0x2a593f[_0x44c8('0x1d')]){for(var _0x6d025=0x0;_0x6d025<_0x2a593f[_0x44c8('0x1d')];_0x6d025+=0x1){for(var _0x1cfd5b=0x0;_0x1cfd5b<_0x2a593f[_0x6d025][_0x44c8('0x1d')];_0x1cfd5b+=0x1){switch(_0x6d025){case 0x0:joinOrLeaveQueues(_0x5f10ec,_0x380859,_0x44c8('0x40'),_0x2a593f[_0x6d025][_0x1cfd5b]);break;case 0x1:joinOrLeaveQueues(_0x5f10ec,_0x380859,_0x44c8('0x41'),_0x2a593f[_0x6d025][_0x1cfd5b]);break;case 0x2:joinOrLeaveQueues(_0x5f10ec,_0x380859,_0x44c8('0x42'),_0x2a593f[_0x6d025][_0x1cfd5b]);break;case 0x3:joinOrLeaveQueues(_0x5f10ec,_0x380859,_0x44c8('0x43'),_0x2a593f[_0x6d025][_0x1cfd5b]);break;case 0x4:joinOrLeaveQueues(_0x5f10ec,_0x380859,_0x44c8('0x44'),_0x2a593f[_0x6d025][_0x1cfd5b]);break;case 0x5:joinOrLeaveQueues(_0x5f10ec,_0x380859,_0x44c8('0x45'),_0x2a593f[_0x6d025][_0x1cfd5b]);break;case 0x6:joinOrLeaveQueues(_0x5f10ec,_0x380859,'whatsapp',_0x2a593f[_0x6d025][_0x1cfd5b]);break;case 0x7:if(_0x327afd['role']!==_0x44c8('0x7'))_0x5f10ec[_0x380859](util[_0x44c8('0x1a')]('telephone:%s',_0x2a593f[_0x6d025][_0x1cfd5b][_0x44c8('0x4')]));break;case 0x8:if(_0x327afd[_0x44c8('0x6')]!==_0x44c8('0x7'))_0x5f10ec[_0x380859](util[_0x44c8('0x1a')](_0x44c8('0x46'),_0x2a593f[_0x6d025][_0x1cfd5b][_0x44c8('0x4')]));break;case 0x9:if(_0x327afd[_0x44c8('0x6')]!=='agent')_0x5f10ec[_0x380859](util[_0x44c8('0x1a')](_0x44c8('0x47'),_0x2a593f[_0x6d025][_0x1cfd5b][_0x44c8('0x8')],_0x2a593f[_0x6d025][_0x1cfd5b][_0x44c8('0x4')]));break;case 0xa:_0x5f10ec[_0x380859](util[_0x44c8('0x1a')]('user:%s',_0x2a593f[_0x6d025][_0x1cfd5b][_0x44c8('0x4')]));break;}}}}})['then'](function(){if(_0x380859===_0x44c8('0x48')){var _0x33455d=_[_0x44c8('0x49')](_0x327afd[_0x44c8('0x24')],'id');return _0x327afd[_0x44c8('0x4a')](_0x33455d)[_0x44c8('0xc')](function(){for(var _0x1287c6=0x0;_0x1287c6<_0x33455d[_0x44c8('0x1d')];_0x1287c6+=0x1){_0x58298b['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x33455d[_0x1287c6]),'UserId':Number(_0x327afd['id'])});}});}})[_0x44c8('0xc')](function(){if(_0x380859===_0x44c8('0x48')){var _0x4fdceb=_[_0x44c8('0x49')](_0x327afd[_0x44c8('0x4b')],'id');return _0x327afd[_0x44c8('0x4c')](_0x4fdceb)[_0x44c8('0xc')](function(){for(var _0x223a83=0x0;_0x223a83<_0x4fdceb[_0x44c8('0x1d')];_0x223a83+=0x1){_0x58298b[_0x44c8('0x4d')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4fdceb[_0x223a83]),'UserId':Number(_0x327afd['id'])});}});}})[_0x44c8('0xc')](function(){if(_0x380859===_0x44c8('0x48')){var _0x23f7fe=_[_0x44c8('0x49')](_0x327afd[_0x44c8('0x26')],'id');return _0x327afd[_0x44c8('0x4e')](_0x23f7fe)[_0x44c8('0xc')](function(){for(var _0x278e52=0x0;_0x278e52<_0x23f7fe['length'];_0x278e52+=0x1){_0x58298b[_0x44c8('0x4d')](_0x44c8('0x4f'),{'FaxInteractionId':Number(_0x23f7fe[_0x278e52]),'UserId':Number(_0x327afd['id'])});}});}})['then'](function(){if(_0x380859==='leave'){var _0x7eeeac=_[_0x44c8('0x49')](_0x327afd['SmsInteractions'],'id');return _0x327afd[_0x44c8('0x50')](_0x7eeeac)[_0x44c8('0xc')](function(){for(var _0x47d865=0x0;_0x47d865<_0x7eeeac[_0x44c8('0x1d')];_0x47d865+=0x1){_0x58298b[_0x44c8('0x4d')](_0x44c8('0x51'),{'SmsInteractionId':Number(_0x7eeeac[_0x47d865]),'UserId':Number(_0x327afd['id'])});}});}})['then'](function(){if(_0x380859==='leave'){var _0x49adef=_[_0x44c8('0x49')](_0x327afd[_0x44c8('0x28')],'id');return _0x327afd['removeOpenchannelInteractions'](_0x49adef)[_0x44c8('0xc')](function(){for(var _0x78ee24=0x0;_0x78ee24<_0x49adef[_0x44c8('0x1d')];_0x78ee24+=0x1){_0x58298b['emit'](_0x44c8('0x52'),{'OpenchannelInteractionId':Number(_0x49adef[_0x78ee24]),'UserId':Number(_0x327afd['id'])});}});}})[_0x44c8('0xc')](function(){if(_0x380859===_0x44c8('0x48')){var _0x4eee16=_[_0x44c8('0x49')](_0x327afd[_0x44c8('0x29')],'id');return _0x327afd[_0x44c8('0x53')](_0x4eee16)['then'](function(){for(var _0x299c55=0x0;_0x299c55<_0x4eee16[_0x44c8('0x1d')];_0x299c55+=0x1){_0x58298b['emit'](_0x44c8('0x54'),{'WhatsappInteractionId':Number(_0x4eee16[_0x299c55]),'UserId':Number(_0x327afd['id'])});}});}})['catch'](function(_0x45eb19){_0x5f10ec[_0x44c8('0x55')](_0x45eb19);});}}function onDisconnect(_0x407639,_0x4381e2){joinOrLeave(_0x407639,'leave',_0x4381e2);}function onConnect(_0x3d5c48){joinOrLeave(_0x3d5c48,_0x44c8('0x56'));}exports[_0x44c8('0x57')]=function(_0x3711a4){_0x3711a4['on'](_0x44c8('0x58'),function(_0x5cba52){_0x5cba52[_0x44c8('0x59')](0x0);_0x5cba52[_0x44c8('0x5a')]=_0x5cba52[_0x44c8('0x5b')][_0x44c8('0x58')][_0x44c8('0x5c')]+':'+_0x5cba52[_0x44c8('0x5b')]['connection'][_0x44c8('0x5d')];_0x5cba52['connectedAt']=new Date();_0x5cba52[_0x44c8('0x55')]=function(_0x2292cb){console[_0x44c8('0x55')](_0x44c8('0x5e')+_0x5cba52['nsp'][_0x44c8('0x4')]+'['+_0x5cba52[_0x44c8('0x5a')]+']',_0x2292cb);};_0x5cba52['on'](_0x44c8('0x5f'),function(){onDisconnect(_0x5cba52,_0x3711a4);_0x5cba52[_0x44c8('0x55')](_0x44c8('0x60'));});onConnect(_0x5cba52);_0x5cba52[_0x44c8('0x55')](_0x44c8('0x61'));});}; \ No newline at end of file +var _0xba0d=['FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','FaxQueue','Telephones','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','fax','sms','mail','openchannel','whatsapp','trunk:%s','leave','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','default','request','connection','remoteAddress','remotePort','connectedAt','log','nsp','DISCONNECTED','lodash','bluebird','../mysqldb','./environment','Agents','name','role','agent','type','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','User','where','telephone','Campaign','format','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteractions'];(function(_0xb7a656,_0x41ccae){var _0x402450=function(_0xce4338){while(--_0xce4338){_0xb7a656['push'](_0xb7a656['shift']());}};_0x402450(++_0x41ccae);}(_0xba0d,0x8e));var _0xdba0=function(_0x5be8fd,_0x39f0ba){_0x5be8fd=_0x5be8fd-0x0;var _0x59006a=_0xba0d[_0x5be8fd];return _0x59006a;};'use strict';var _=require(_0xdba0('0x0'));var util=require('util');var BPromise=require(_0xdba0('0x1'));var db=require(_0xdba0('0x2'))['db'];var config=require(_0xdba0('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xdba0('0x4'),'model':db['User'],'attributes':['id',_0xdba0('0x5'),_0xdba0('0x6')],'raw':!![],'where':{'role':_0xdba0('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xdba0('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xdba0('0x5')],'where':{'role':_0xdba0('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xdba0('0x5'),_0xdba0('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x3db492,_0x5d2ac2,_0x4ff5f5){return db[_0xdba0('0x9')]['findOne']({'where':{'name':_0x3db492,'userProfileId':_0x5d2ac2},'raw':!![]})[_0xdba0('0xa')](function(_0x56d368){if(_0x56d368){if(_0x56d368[_0xdba0('0xb')]){switch(_0x3db492){case _0xdba0('0xc'):case _0xdba0('0xd'):case _0xdba0('0xe'):case _0xdba0('0xf'):case _0xdba0('0x10'):case _0xdba0('0x11'):case _0xdba0('0x12'):return db[_0x4ff5f5]['findAll'](queryQueues);case'Telephones':return db[_0x4ff5f5][_0xdba0('0x13')](queryTelephones);case _0xdba0('0x14'):return db[_0x4ff5f5][_0xdba0('0x13')](queryTrunks);case _0xdba0('0x15'):return db[_0x4ff5f5][_0xdba0('0x13')](queryCampaigns);}}else{return db[_0xdba0('0x16')][_0xdba0('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x56d368['id']},'raw':!![]})[_0xdba0('0xa')](function(_0x722955){if(_0x722955){var _0x3e47da={'where':{'id':_[_0xdba0('0x17')](_0x722955,_0xdba0('0x18'))},'raw':!![]};switch(_0x4ff5f5){case _0xdba0('0x19'):_0x3e47da[_0xdba0('0x1a')][_0xdba0('0x6')]=_0xdba0('0x1b');break;case _0xdba0('0x1c'):_0x3e47da['where'][_0xdba0('0x8')]='ivr';break;}return db[_0x4ff5f5][_0xdba0('0x13')](_0x3e47da);}else{return[];}});}}else{return[];}})[_0xdba0('0xa')](function(_0x30b049){return _0x30b049;});}function joinOrLeaveQueues(_0x436fff,_0x5c1d6c,_0x4c954f,_0x393c12){_0x436fff[_0x5c1d6c](util[_0xdba0('0x1d')]('%s:queue:%s',_0x4c954f,_0x393c12[_0xdba0('0x5')]));if(_0x393c12[_0xdba0('0x4')]){for(var _0x907a7a=0x0;_0x907a7a<_0x393c12['Agents'][_0xdba0('0x1e')];_0x907a7a+=0x1){_0x436fff[_0x5c1d6c](util[_0xdba0('0x1d')](_0xdba0('0x1f'),_0x393c12[_0xdba0('0x4')][_0x907a7a][_0xdba0('0x5')]));}}}function joinOrLeave(_0x31b917,_0xe4ac33,_0x41d2d8){var _0x21932d;if(_0x31b917[_0xdba0('0x20')][_0xdba0('0x21')]['id']){db['User'][_0xdba0('0x22')]({'attributes':['id',_0xdba0('0x5'),'role',_0xdba0('0x23')],'where':{'id':_0x31b917['handshake'][_0xdba0('0x21')]['id']},'include':[{'model':db[_0xdba0('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xdba0('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xdba0('0x26')],'as':_0xdba0('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xdba0('0x28')],'as':_0xdba0('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xdba0('0x2a')],'as':_0xdba0('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xdba0('0xa')](function(_0x1d91a3){if(_0x1d91a3){_0x21932d=_0x1d91a3;_0x31b917[_0xe4ac33](util[_0xdba0('0x1d')](_0xdba0('0x1f'),_0x1d91a3['name']));var _0x5544c3=[];switch(_0x1d91a3[_0xdba0('0x6')]){case'admin':_0x31b917[_0xe4ac33](_0xdba0('0x2c'));_0x31b917[_0xe4ac33]('voice:outbound');if(queryQueues[_0xdba0('0x2d')](_0xdba0('0x2e'))){delete queryQueues['include'];}_0x5544c3[_0xdba0('0x2f')](db[_0xdba0('0x30')][_0xdba0('0x13')](queryQueues));_0x5544c3[_0xdba0('0x2f')](db[_0xdba0('0x31')][_0xdba0('0x13')](queryQueues));_0x5544c3[_0xdba0('0x2f')](db['FaxQueue']['findAll'](queryQueues));_0x5544c3[_0xdba0('0x2f')](db[_0xdba0('0x32')][_0xdba0('0x13')](queryQueues));_0x5544c3[_0xdba0('0x2f')](db[_0xdba0('0x33')]['findAll'](queryQueues));_0x5544c3['push'](db[_0xdba0('0x34')][_0xdba0('0x13')](queryQueues));_0x5544c3['push'](db[_0xdba0('0x35')]['findAll'](queryQueues));_0x5544c3[_0xdba0('0x2f')](db[_0xdba0('0x19')][_0xdba0('0x13')](queryTelephones));_0x5544c3[_0xdba0('0x2f')](db[_0xdba0('0x36')][_0xdba0('0x13')](queryTrunks));_0x5544c3[_0xdba0('0x2f')](db['Campaign'][_0xdba0('0x13')](queryCampaigns));_0x5544c3['push'](db['User'][_0xdba0('0x13')](queryAgents));break;case _0xdba0('0x37'):_0x31b917[_0xe4ac33]('voice:inbound');_0x31b917[_0xe4ac33](_0xdba0('0x38'));_0x5544c3[_0xdba0('0x2f')](getAssociatedResources('VoiceQueues',_0x1d91a3['userProfileId'],'VoiceQueue'));_0x5544c3['push'](getAssociatedResources(_0xdba0('0xd'),_0x1d91a3['userProfileId'],'ChatQueue'));_0x5544c3[_0xdba0('0x2f')](getAssociatedResources('FaxQueues',_0x1d91a3[_0xdba0('0x23')],_0xdba0('0x39')));_0x5544c3[_0xdba0('0x2f')](getAssociatedResources(_0xdba0('0xf'),_0x1d91a3[_0xdba0('0x23')],_0xdba0('0x32')));_0x5544c3[_0xdba0('0x2f')](getAssociatedResources(_0xdba0('0x10'),_0x1d91a3[_0xdba0('0x23')],_0xdba0('0x33')));_0x5544c3[_0xdba0('0x2f')](getAssociatedResources(_0xdba0('0x11'),_0x1d91a3['userProfileId'],_0xdba0('0x34')));_0x5544c3[_0xdba0('0x2f')](getAssociatedResources('WhatsappQueues',_0x1d91a3[_0xdba0('0x23')],_0xdba0('0x35')));_0x5544c3[_0xdba0('0x2f')](getAssociatedResources(_0xdba0('0x3a'),_0x1d91a3[_0xdba0('0x23')],_0xdba0('0x19')));_0x5544c3[_0xdba0('0x2f')](getAssociatedResources(_0xdba0('0x14'),_0x1d91a3[_0xdba0('0x23')],_0xdba0('0x36')));_0x5544c3[_0xdba0('0x2f')](getAssociatedResources(_0xdba0('0x15'),_0x1d91a3[_0xdba0('0x23')],'Campaign'));_0x5544c3[_0xdba0('0x2f')](db['User'][_0xdba0('0x13')](queryAgents));break;case _0xdba0('0x7'):_0x31b917[_0xe4ac33]('voice:inbound');_0x31b917[_0xe4ac33]('voice:outbound');_0x5544c3['push'](_0x1d91a3['getVoiceQueues']({'attributes':['id',_0xdba0('0x5')]}));_0x5544c3[_0xdba0('0x2f')](_0x1d91a3['getChatQueues']({'attributes':['id','name']}));_0x5544c3[_0xdba0('0x2f')](_0x1d91a3[_0xdba0('0x3b')]({'attributes':['id',_0xdba0('0x5')]}));_0x5544c3[_0xdba0('0x2f')](_0x1d91a3[_0xdba0('0x3c')]({'attributes':['id',_0xdba0('0x5')]}));_0x5544c3[_0xdba0('0x2f')](_0x1d91a3[_0xdba0('0x3d')]({'attributes':['id',_0xdba0('0x5')]}));_0x5544c3[_0xdba0('0x2f')](_0x1d91a3[_0xdba0('0x3e')]({'attributes':['id',_0xdba0('0x5')]}));_0x5544c3[_0xdba0('0x2f')](_0x1d91a3[_0xdba0('0x3f')]({'attributes':['id',_0xdba0('0x5')]}));break;}return BPromise['all'](_0x5544c3);}})[_0xdba0('0xa')](function(_0x77df20){if(_0x77df20&&_0x77df20[_0xdba0('0x1e')]){for(var _0x4c297e=0x0;_0x4c297e<_0x77df20[_0xdba0('0x1e')];_0x4c297e+=0x1){for(var _0x2e6632=0x0;_0x2e6632<_0x77df20[_0x4c297e][_0xdba0('0x1e')];_0x2e6632+=0x1){switch(_0x4c297e){case 0x0:joinOrLeaveQueues(_0x31b917,_0xe4ac33,_0xdba0('0x40'),_0x77df20[_0x4c297e][_0x2e6632]);break;case 0x1:joinOrLeaveQueues(_0x31b917,_0xe4ac33,'chat',_0x77df20[_0x4c297e][_0x2e6632]);break;case 0x2:joinOrLeaveQueues(_0x31b917,_0xe4ac33,_0xdba0('0x41'),_0x77df20[_0x4c297e][_0x2e6632]);break;case 0x3:joinOrLeaveQueues(_0x31b917,_0xe4ac33,_0xdba0('0x42'),_0x77df20[_0x4c297e][_0x2e6632]);break;case 0x4:joinOrLeaveQueues(_0x31b917,_0xe4ac33,_0xdba0('0x43'),_0x77df20[_0x4c297e][_0x2e6632]);break;case 0x5:joinOrLeaveQueues(_0x31b917,_0xe4ac33,_0xdba0('0x44'),_0x77df20[_0x4c297e][_0x2e6632]);break;case 0x6:joinOrLeaveQueues(_0x31b917,_0xe4ac33,_0xdba0('0x45'),_0x77df20[_0x4c297e][_0x2e6632]);break;case 0x7:if(_0x21932d[_0xdba0('0x6')]!==_0xdba0('0x7'))_0x31b917[_0xe4ac33](util[_0xdba0('0x1d')]('telephone:%s',_0x77df20[_0x4c297e][_0x2e6632][_0xdba0('0x5')]));break;case 0x8:if(_0x21932d[_0xdba0('0x6')]!==_0xdba0('0x7'))_0x31b917[_0xe4ac33](util[_0xdba0('0x1d')](_0xdba0('0x46'),_0x77df20[_0x4c297e][_0x2e6632]['name']));break;case 0x9:if(_0x21932d['role']!==_0xdba0('0x7'))_0x31b917[_0xe4ac33](util[_0xdba0('0x1d')]('campaign:%s:%s',_0x77df20[_0x4c297e][_0x2e6632][_0xdba0('0x8')],_0x77df20[_0x4c297e][_0x2e6632][_0xdba0('0x5')]));break;case 0xa:_0x31b917[_0xe4ac33](util[_0xdba0('0x1d')](_0xdba0('0x1f'),_0x77df20[_0x4c297e][_0x2e6632]['name']));break;}}}}})[_0xdba0('0xa')](function(){if(_0xe4ac33===_0xdba0('0x47')){var _0x6f7dac=_[_0xdba0('0x17')](_0x21932d['ChatInteractions'],'id');return _0x21932d['removeChatInteractions'](_0x6f7dac)[_0xdba0('0xa')](function(){for(var _0x54e416=0x0;_0x54e416<_0x6f7dac[_0xdba0('0x1e')];_0x54e416+=0x1){_0x41d2d8[_0xdba0('0x48')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x6f7dac[_0x54e416]),'UserId':Number(_0x21932d['id'])});}});}})['then'](function(){if(_0xe4ac33===_0xdba0('0x47')){var _0x25adee=_[_0xdba0('0x17')](_0x21932d['MailInteractions'],'id');return _0x21932d['removeMailInteractions'](_0x25adee)[_0xdba0('0xa')](function(){for(var _0x480b78=0x0;_0x480b78<_0x25adee[_0xdba0('0x1e')];_0x480b78+=0x1){_0x41d2d8[_0xdba0('0x48')](_0xdba0('0x49'),{'MailInteractionId':Number(_0x25adee[_0x480b78]),'UserId':Number(_0x21932d['id'])});}});}})[_0xdba0('0xa')](function(){if(_0xe4ac33===_0xdba0('0x47')){var _0x4380b9=_['map'](_0x21932d[_0xdba0('0x27')],'id');return _0x21932d['removeFaxInteractions'](_0x4380b9)['then'](function(){for(var _0xafe6a=0x0;_0xafe6a<_0x4380b9['length'];_0xafe6a+=0x1){_0x41d2d8['emit'](_0xdba0('0x4a'),{'FaxInteractionId':Number(_0x4380b9[_0xafe6a]),'UserId':Number(_0x21932d['id'])});}});}})[_0xdba0('0xa')](function(){if(_0xe4ac33===_0xdba0('0x47')){var _0x1f9063=_[_0xdba0('0x17')](_0x21932d['SmsInteractions'],'id');return _0x21932d[_0xdba0('0x4b')](_0x1f9063)['then'](function(){for(var _0x40e6ff=0x0;_0x40e6ff<_0x1f9063[_0xdba0('0x1e')];_0x40e6ff+=0x1){_0x41d2d8[_0xdba0('0x48')](_0xdba0('0x4c'),{'SmsInteractionId':Number(_0x1f9063[_0x40e6ff]),'UserId':Number(_0x21932d['id'])});}});}})[_0xdba0('0xa')](function(){if(_0xe4ac33===_0xdba0('0x47')){var _0x171c8a=_[_0xdba0('0x17')](_0x21932d[_0xdba0('0x2b')],'id');return _0x21932d[_0xdba0('0x4d')](_0x171c8a)[_0xdba0('0xa')](function(){for(var _0x335e38=0x0;_0x335e38<_0x171c8a[_0xdba0('0x1e')];_0x335e38+=0x1){_0x41d2d8[_0xdba0('0x48')](_0xdba0('0x4e'),{'OpenchannelInteractionId':Number(_0x171c8a[_0x335e38]),'UserId':Number(_0x21932d['id'])});}});}})[_0xdba0('0xa')](function(){if(_0xe4ac33===_0xdba0('0x47')){var _0x4f8bcf=_[_0xdba0('0x17')](_0x21932d[_0xdba0('0x4f')],'id');return _0x21932d[_0xdba0('0x50')](_0x4f8bcf)[_0xdba0('0xa')](function(){for(var _0x2cadf5=0x0;_0x2cadf5<_0x4f8bcf[_0xdba0('0x1e')];_0x2cadf5+=0x1){_0x41d2d8[_0xdba0('0x48')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x4f8bcf[_0x2cadf5]),'UserId':Number(_0x21932d['id'])});}});}})['catch'](function(_0x319791){_0x31b917['log'](_0x319791);});}}function onDisconnect(_0x1812b4,_0x3e5b49){joinOrLeave(_0x1812b4,'leave',_0x3e5b49);}function onConnect(_0x21215f){joinOrLeave(_0x21215f,'join');}exports[_0xdba0('0x51')]=function(_0x4408b6){_0x4408b6['on']('connection',function(_0x1bc05b){_0x1bc05b['setMaxListeners'](0x0);_0x1bc05b['address']=_0x1bc05b[_0xdba0('0x52')][_0xdba0('0x53')][_0xdba0('0x54')]+':'+_0x1bc05b['request'][_0xdba0('0x53')][_0xdba0('0x55')];_0x1bc05b[_0xdba0('0x56')]=new Date();_0x1bc05b[_0xdba0('0x57')]=function(_0x1c520a){console[_0xdba0('0x57')]('SocketIO\x20'+_0x1bc05b[_0xdba0('0x58')][_0xdba0('0x5')]+'['+_0x1bc05b['address']+']',_0x1c520a);};_0x1bc05b['on']('disconnect',function(){onDisconnect(_0x1bc05b,_0x4408b6);_0x1bc05b[_0xdba0('0x57')](_0xdba0('0x59'));});onConnect(_0x1bc05b);_0x1bc05b['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index cb29d9e..3362264 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 _0x4808=['EventManager','then','Trigger,\x20%s','error','catch','channel','motionChannel','event','direction','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','offlineMessage','opened','resolve','undefined','format','SIP/%s','name','AfterCreate','closed','substatus','fullname','internal','length','hasOwnProperty','model','hook','condition','util','../../mysqldb','jayson/promise','triggers','client','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','ChatOfflineMessage','newmessage','Sms','newinteraction','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','request'];(function(_0x23c5e1,_0x1b2cc1){var _0x26875e=function(_0x3debe5){while(--_0x3debe5){_0x23c5e1['push'](_0x23c5e1['shift']());}};_0x26875e(++_0x1b2cc1);}(_0x4808,0x182));var _0x8480=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x4808[_0x5d2803];return _0xdcad2c;};'use strict';var util=require(_0x8480('0x0'));var db=require(_0x8480('0x1'))['db'];var jayson=require(_0x8480('0x2'));var logger=require('../logger')(_0x8480('0x3'));var client=jayson[_0x8480('0x4')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x8480('0x5'),'event':_0x8480('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':_0x8480('0x5'),'event':_0x8480('0x7'),'condition':_0x8480('0x8'),'callback':afterUpdate},{'channel':'Chat','model':_0x8480('0x9'),'event':_0x8480('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Chat','model':_0x8480('0xa'),'event':_0x8480('0x6'),'condition':_0x8480('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x8480('0xc'),'model':'SmsInteraction','event':_0x8480('0x6'),'condition':_0x8480('0xd'),'callback':afterCreate},{'channel':_0x8480('0xc'),'model':_0x8480('0xe'),'event':_0x8480('0x7'),'condition':_0x8480('0x8'),'callback':afterUpdate},{'channel':_0x8480('0xc'),'model':_0x8480('0xf'),'event':_0x8480('0x6'),'condition':_0x8480('0xb'),'callback':afterCreateMessage},{'channel':_0x8480('0x10'),'model':_0x8480('0x11'),'event':_0x8480('0x6'),'condition':_0x8480('0xd'),'callback':afterCreate},{'channel':_0x8480('0x10'),'model':'WhatsappInteraction','event':'afterUpdate','condition':_0x8480('0x8'),'callback':afterUpdate},{'channel':_0x8480('0x10'),'model':_0x8480('0x12'),'event':_0x8480('0x6'),'condition':_0x8480('0xb'),'callback':afterCreateMessage},{'channel':_0x8480('0x13'),'model':_0x8480('0x14'),'event':_0x8480('0x6'),'condition':_0x8480('0xd'),'callback':afterCreate},{'channel':_0x8480('0x13'),'model':_0x8480('0x14'),'event':_0x8480('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x8480('0x13'),'model':_0x8480('0x15'),'event':_0x8480('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0x8480('0x16'),'event':_0x8480('0x6'),'condition':_0x8480('0xd'),'callback':afterCreate},{'channel':_0x8480('0x17'),'model':_0x8480('0x16'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0x8480('0x18'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8480('0x19'),'model':_0x8480('0x1a'),'event':_0x8480('0x6'),'condition':_0x8480('0xd'),'callback':afterCreate},{'channel':_0x8480('0x19'),'model':_0x8480('0x1a'),'event':_0x8480('0x7'),'condition':_0x8480('0x8'),'callback':afterUpdate},{'channel':_0x8480('0x19'),'model':'OpenchannelMessage','event':_0x8480('0x6'),'condition':_0x8480('0xb'),'callback':afterCreateMessage}];function request(_0x53d938){return client[_0x8480('0x1b')](_0x8480('0x1c'),_0x53d938)[_0x8480('0x1d')](function(_0x5084f3){logger['info'](_0x8480('0x1e'),'EventManager',_0x5084f3);if(_0x5084f3['error']){if(_0x5084f3[_0x8480('0x1f')]['code']===0x1f4){logger[_0x8480('0x1f')](_0x8480('0x1e'),'EventManager',_0x5084f3[_0x8480('0x1f')]);}}})[_0x8480('0x20')](function(_0x3712c5){logger['error']('Trigger,\x20%s','EventManager',_0x3712c5);});}function afterCreateMessage(_0x3e1b02){return function(_0xc104b3){_0xc104b3=_0xc104b3['get']({'plain':!![]});_0xc104b3[_0x8480('0x21')]=_0x3e1b02;_0xc104b3[_0x8480('0x22')]=_0x3e1b02;_0xc104b3[_0x8480('0x23')]=_0xc104b3[_0x8480('0x24')];Promise['resolve']()[_0x8480('0x1d')](function(){if(typeof _0xc104b3[_0x8480('0x25')]==='undefined')return null;var _0x3e0142=_0x8480('0x26')+_0xc104b3[_0x8480('0x25')];return db[_0x8480('0x27')][_0x8480('0x28')](_0x3e0142,{'type':db[_0x8480('0x29')][_0x8480('0x2a')][_0x8480('0x2b')],'raw':!![]});})[_0x8480('0x1d')](function(_0x321e73){if(_0x321e73){_0xc104b3[_0x8480('0x2c')]=_0x321e73[0x0];}if(typeof _0xc104b3[_0x8480('0x2d')]==='undefined')return;return getAgent(_0xc104b3[_0x8480('0x2d')]);})['then'](function(_0x2c7465){if(_0x2c7465){_0xc104b3[_0x8480('0x2e')]=util['format']('SIP/%s',_0x2c7465['name']);_0xc104b3[_0x8480('0x2f')]=_0x2c7465;_0xc104b3[_0x8480('0x21')]=_0x3e1b02;return request({'event':_0x8480('0x30'),'message':_0xc104b3});}else{return request({'event':_0x8480('0x31'),'message':_0xc104b3});}})[_0x8480('0x20')](function(_0x3d63f0){logger[_0x8480('0x1f')](_0x8480('0x1e'),_0x8480('0x32'),_0x3d63f0);});};}function afterCreateOfflineMessage(_0x1c65de){return function(_0x43fad7){_0x43fad7=_0x43fad7[_0x8480('0x33')]({'plain':!![]});_0x43fad7[_0x8480('0x21')]=_0x1c65de;_0x43fad7[_0x8480('0x22')]=_0x1c65de;_0x43fad7[_0x8480('0x23')]=_0x8480('0x34');return request({'event':_0x43fad7[_0x8480('0x23')],'message':_0x43fad7});};}function afterCreate(_0x2fa478,_0x55f3f2){return function(_0x3cd16f){_0x3cd16f=_0x3cd16f[_0x8480('0x33')]({'plain':!![]});_0x3cd16f[_0x8480('0x21')]=_0x2fa478;_0x3cd16f[_0x8480('0x22')]=_0x2fa478;_0x3cd16f[_0x8480('0x23')]=_0x8480('0x35');Promise[_0x8480('0x36')]()[_0x8480('0x1d')](function(){var _0x14121e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3cd16f[_0x8480('0x25')];return db[_0x8480('0x27')][_0x8480('0x28')](_0x14121e,{'type':db[_0x8480('0x29')]['QueryTypes'][_0x8480('0x2b')],'raw':!![]});})[_0x8480('0x1d')](function(_0x1370cb){if(_0x1370cb){_0x3cd16f[_0x8480('0x2c')]=_0x1370cb[0x0];}if(typeof _0x3cd16f[_0x8480('0x2d')]===_0x8480('0x37'))return;return getAgent(_0x3cd16f[_0x8480('0x2d')]);})['then'](function(_0xb338cc){if(_0xb338cc){_0x3cd16f['interface']=util[_0x8480('0x38')](_0x8480('0x39'),_0xb338cc[_0x8480('0x3a')]);_0x3cd16f['agent']=_0xb338cc;}return request({'event':_0x55f3f2,'message':_0x3cd16f});})['catch'](function(_0x15c41d){logger['error'](_0x8480('0x1e'),_0x8480('0x3b'),_0x15c41d);});};}function afterUpdate(_0x53be68){return function(_0x4c7691){var _0x23d640=_0x4c7691['changed'](_0x8480('0x3c'))&&_0x4c7691[_0x8480('0x3c')];var _0x54813d=_0x4c7691['changed'](_0x8480('0x3d'));if(_0x23d640||_0x54813d){var _0x4c9aa1=_0x23d640?_0x8480('0x8'):_0x8480('0x3d');var _0x833ac0=_0x4c7691[_0x8480('0x33')]({'plain':!![]});_0x833ac0[_0x8480('0x21')]=_0x53be68;_0x833ac0[_0x8480('0x22')]=_0x53be68;_0x833ac0[_0x8480('0x23')]=_0x23d640?_0x8480('0x3c'):_0x8480('0x3d');var _0x250b87=_0x8480('0x26')+_0x833ac0[_0x8480('0x25')];return db[_0x8480('0x27')][_0x8480('0x28')](_0x250b87,{'type':db['Sequelize'][_0x8480('0x2a')][_0x8480('0x2b')],'raw':!![]})[_0x8480('0x1d')](function(_0x2f3460){if(_0x2f3460){_0x833ac0[_0x8480('0x2c')]=_0x2f3460[0x0];}if(typeof _0x833ac0['UserId']===_0x8480('0x37'))return;return getAgent(_0x833ac0[_0x8480('0x2d')]);})[_0x8480('0x1d')](function(_0x5e9b32){if(_0x5e9b32){_0x833ac0['interface']=util[_0x8480('0x38')](_0x8480('0x39'),_0x5e9b32['name']);_0x833ac0[_0x8480('0x2f')]=_0x5e9b32;}return request({'event':_0x4c9aa1,'message':_0x833ac0});})['catch'](function(_0x5c3a53){logger['error'](_0x8480('0x1e'),'AfterUpdate',_0x5c3a53);});}};}function getAgent(_0x2b1db6){return db['User']['find']({'where':{'id':_0x2b1db6},'attributes':['id','name',_0x8480('0x3e'),'email',_0x8480('0x3f')],'raw':!![]})['then'](function(_0x125717){return _0x125717;});}exports['default']=function(){for(var _0x41cd5e=0x0;_0x41cd5e=_0xa59517[_0xdd10('0x11')]){throw Error(_0xdd10('0x12'));}_0x245f60(_0x41521f);})[_0xdd10('0x13')](function(_0x5c4a10){_0x50be56(_0x5c4a10);});});}; \ No newline at end of file +var _0x4ced=['getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','updateAttributes','getLicense','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','bluebird','../mysqldb','./license/util','mail','chat','fax','whatsapp','openchannel'];(function(_0x4f0adb,_0x288035){var _0x3a9483=function(_0x549bd9){while(--_0x549bd9){_0x4f0adb['push'](_0x4f0adb['shift']());}};_0x3a9483(++_0x288035);}(_0x4ced,0x109));var _0xd4ce=function(_0x597bbc,_0x2f76f9){_0x597bbc=_0x597bbc-0x0;var _0x35e2fa=_0x4ced[_0x597bbc];return _0x35e2fa;};'use strict';var _=require('lodash');var BPromise=require(_0xd4ce('0x0'));var db=require(_0xd4ce('0x1'))['db'];var util=require(_0xd4ce('0x2'));var channels=['voice',_0xd4ce('0x3'),_0xd4ce('0x4'),_0xd4ce('0x5'),'sms',_0xd4ce('0x6'),_0xd4ce('0x7')];exports[_0xd4ce('0x8')]=function(){return channels;};exports[_0xd4ce('0x9')]=function(_0x21a4be){_0x21a4be=_0x21a4be[_0xd4ce('0xa')]();return _[_0xd4ce('0xb')](channels,_0x21a4be);};exports[_0xd4ce('0xc')]=function(_0x3de259,_0x7192c6,_0x29be88,_0x4f943e){var _0x22a73f={'loginAttempts':_0x7192c6,'blocked':_0x29be88};if(!_['isUndefined'](_0x4f943e)){_0x22a73f['blockedAt']=_0x4f943e;}return _0x3de259[_0xd4ce('0xd')](_0x22a73f);};exports[_0xd4ce('0xe')]=function(_0x1d959c){return new BPromise(function(_0x44bd40,_0x533b83){var _0x11ef7e=0x0;if(_0x1d959c['role']!==_0xd4ce('0xf')){_0x44bd40(_0x1d959c);}db[_0xd4ce('0x10')][_0xd4ce('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1d959c['id']}}})[_0xd4ce('0x12')](function(_0x5ac7dd){_0x11ef7e=_0x5ac7dd;return util['getLicense']();})[_0xd4ce('0x12')](function(_0x498a3d){if(_0x498a3d&&_0x498a3d[_0xd4ce('0x13')]&&_0x11ef7e>=_0x498a3d[_0xd4ce('0x13')]){throw Error(_0xd4ce('0x14'));}_0x44bd40(_0x1d959c);})['catch'](function(_0x1cf023){_0x533b83(_0x1cf023);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 59c2e6e..25688da 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa77f=['Not\x20Found','Out\x20Of\x20Interval','OutOfInterval','Conflict','error','statusMessage','exports','../config/logger','api','message','Internal\x20Server\x20Error','Error','Bad\x20Request','name','Forbidden','inherits','Entity\x20not\x20found'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa77f,0x106));var _0xfa77=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa77f[_0xa464c9];return _0x3d73c4;};'use strict';var util=require('util');var logger=require(_0xfa77('0x0'))(_0xfa77('0x1'));var APIError=function(_0x3c02f7,_0x5d57ff){this[_0xfa77('0x2')]=_0x3c02f7||_0xfa77('0x3');this['name']=_0x5d57ff||_0xfa77('0x4');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x59a1e3){this[_0xfa77('0x2')]=_0x59a1e3||_0xfa77('0x5');this[_0xfa77('0x6')]=_0xfa77('0x5');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x1a97ea){this[_0xfa77('0x2')]=_0x1a97ea||_0xfa77('0x7');this[_0xfa77('0x6')]='Forbidden';util[_0xfa77('0x8')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x553b71){this[_0xfa77('0x2')]=_0x553b71||_0xfa77('0x9');this[_0xfa77('0x6')]=_0xfa77('0xa');util[_0xfa77('0x8')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x309698){this[_0xfa77('0x2')]=_0x309698||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xfa77('0x6')]=_0xfa77('0xb');this['code']=0x193;this['details']={'type':_0xfa77('0xc')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x56bd9e){this[_0xfa77('0x2')]=_0x56bd9e||'Resource\x20Conflict';this['name']=_0xfa77('0xd');util[_0xfa77('0x8')](APIBadRequestError,APIError);};function getStatusCode(_0xf5b97a){switch(_0xf5b97a){case _0xfa77('0x5'):return 0x190;case'Forbidden',_0xfa77('0xb'):return 0x193;case _0xfa77('0xa'):return 0x194;case _0xfa77('0xd'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x4f7356){if(_0x4f7356==='Out\x20Of\x20Interval')return _0x4f7356;return null;}function handleError(_0x115206){return function(_0x3fb737){logger[_0xfa77('0xe')](_0x3fb737['stack']);var _0x3753ce=getStatusCode(_0x3fb737[_0xfa77('0x6')]);var _0x17923c=getCustomStatusMessage(_0x3fb737[_0xfa77('0x6')]);if(_0x3fb737[_0xfa77('0x6')]){delete _0x3fb737[_0xfa77('0x6')];}if(_0x17923c){_0x115206[_0xfa77('0xf')]=_0x17923c;}return _0x115206['status'](_0x3753ce)['send'](_0x3fb737);};}module[_0xfa77('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x122d=['statusMessage','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','OutOfInterval','Conflict','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x122d,0xa2));var _0xd122=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x122d[_0x456fb1];return _0x4083d6;};'use strict';var util=require(_0xd122('0x0'));var logger=require(_0xd122('0x1'))(_0xd122('0x2'));var APIError=function(_0xcd5e4b,_0x174f8a){this[_0xd122('0x3')]=_0xcd5e4b||_0xd122('0x4');this[_0xd122('0x5')]=_0x174f8a||_0xd122('0x6');util[_0xd122('0x7')](APIError,Error);};var APIBadRequestError=function(_0x2ccb96){this[_0xd122('0x3')]=_0x2ccb96||'Bad\x20Request';this[_0xd122('0x5')]=_0xd122('0x8');util[_0xd122('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x4ebcfe){this['message']=_0x4ebcfe||'Forbidden';this[_0xd122('0x5')]=_0xd122('0x9');util[_0xd122('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x5cfc4e){this['message']=_0x5cfc4e||_0xd122('0xa');this[_0xd122('0x5')]=_0xd122('0xb');util[_0xd122('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4257fe){this[_0xd122('0x3')]=_0x4257fe||_0xd122('0xc');this[_0xd122('0x5')]=_0xd122('0xd');this[_0xd122('0xe')]=0x193;this['details']={'type':_0xd122('0xf')};util[_0xd122('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x270396){this[_0xd122('0x3')]=_0x270396||'Resource\x20Conflict';this['name']=_0xd122('0x10');util[_0xd122('0x7')](APIBadRequestError,APIError);};function getStatusCode(_0x547381){switch(_0x547381){case _0xd122('0x8'):return 0x190;case'Forbidden','Out\x20Of\x20Interval':return 0x193;case'Not\x20Found':return 0x194;case _0xd122('0x10'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x1b3e85){if(_0x1b3e85===_0xd122('0xd'))return _0x1b3e85;return null;}function handleError(_0x488f9b){return function(_0x70cb7a){logger[_0xd122('0x11')](_0x70cb7a['stack']);var _0x556faf=getStatusCode(_0x70cb7a[_0xd122('0x5')]);var _0x446954=getCustomStatusMessage(_0x70cb7a[_0xd122('0x5')]);if(_0x70cb7a[_0xd122('0x5')]){delete _0x70cb7a[_0xd122('0x5')];}if(_0x446954){_0x488f9b[_0xd122('0x12')]=_0x446954;}return _0x488f9b['status'](_0x556faf)['send'](_0x70cb7a);};}module[_0xd122('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 40a1ed1..ae110f3 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb71=['render','json','send','exports','404','status'];(function(_0x46afc8,_0x833bc1){var _0x1dc057=function(_0x3109e7){while(--_0x3109e7){_0x46afc8['push'](_0x46afc8['shift']());}};_0x1dc057(++_0x833bc1);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x45a289,_0x3cba96){_0x45a289=_0x45a289-0x0;var _0x126361=_0xfb71[_0x45a289];return _0x126361;};'use strict';module[_0x1fb7('0x0')][0x194]=function pageNotFound(_0x413c41,_0x1affc7){var _0x6e642c=_0x1fb7('0x1');var _0x5077d8=0x194;var _0x58b7c1={'status':_0x5077d8};_0x1affc7[_0x1fb7('0x2')](_0x58b7c1[_0x1fb7('0x2')]);_0x1affc7[_0x1fb7('0x3')](_0x6e642c,{},function(_0x4b9066,_0x45ed1c){if(_0x4b9066){return _0x1affc7[_0x1fb7('0x2')](_0x58b7c1[_0x1fb7('0x2')])[_0x1fb7('0x4')](_0x58b7c1);}_0x1affc7[_0x1fb7('0x5')](_0x45ed1c);});}; \ No newline at end of file +var _0xd5b9=['status','render','json','send','404'];(function(_0x4adcee,_0x2d8be3){var _0x40f122=function(_0x2e9474){while(--_0x2e9474){_0x4adcee['push'](_0x4adcee['shift']());}};_0x40f122(++_0x2d8be3);}(_0xd5b9,0xe0));var _0x9d5b=function(_0x31b5dd,_0x36a269){_0x31b5dd=_0x31b5dd-0x0;var _0x56494b=_0xd5b9[_0x31b5dd];return _0x56494b;};'use strict';module['exports'][0x194]=function pageNotFound(_0x29aef8,_0x2a864c){var _0x4e882d=_0x9d5b('0x0');var _0xb9ce9e=0x194;var _0x226693={'status':_0xb9ce9e};_0x2a864c[_0x9d5b('0x1')](_0x226693[_0x9d5b('0x1')]);_0x2a864c[_0x9d5b('0x2')](_0x4e882d,{},function(_0x35eb41,_0x3d00ad){if(_0x35eb41){return _0x2a864c['status'](_0x226693[_0x9d5b('0x1')])[_0x9d5b('0x3')](_0x226693);}_0x2a864c[_0x9d5b('0x4')](_0x3d00ad);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 9cb0038..d496028 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebd3=['CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/network/network.model','ChatQueueReport','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceExtension','CmHopperFinal','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','SenderId','userProfileId','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','belongsToMany','Lists','cm_user_has_lists','user_has_teams','MailInteraction','MailInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','UserVoiceQueue','VoicePrefixes','UserVoicePrefix','MailQueue','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_openchannel_accounts','SmsAccount','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperHistory','JscriptySessionReport','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailbox','QueueCalls','uniqueid','ContactId','MailAccountId','restrict','MailServerOut','CloudProviderId','Imap','Smtp','Dispositions','Interactions','MailApplication','List','TemplateId','Agents','user_has_mail_accounts','team_has_mail_queues','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','MailInteractionId','Attachments','Interaction','Account','ChatWebsiteId','MailQueueReport','ListId','Items','Answers','FaxAccountId','Exntensions','TagId','fax_interaction_has_tags','FaxInteractionId','AttachmentId','FaxQueueReport','SmsAccountId','sms_interaction_has_tags','Tags','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','Phones','CmContactId','JscriptySessions','CmCompany','Company','CompanyId','cm_contact_has_tags','CmHopperAdditionalPhone','CmHopperId','CampaignId','OwnerId','All','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','CmContactHasItem','ContactItemType','Hopper','AllConditions','AllCondition','TriggerAllId','Condition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','SalesforceField','FieldId','SalesforceAccount','Subject','Description','Field','VariableId','DeskField','int_desk_configuration_has_tags','ZohoConfiguration','ZohoField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','Dynamics365Account','FreshsalesField','ChatInternalMessage','FromId','SessionId','JscriptyProject','ProjectId','VoiceQueues','team_has_fax_queues','team_has_sms_queues','team_has_whatsapp_queues','HopperHistories','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelAccountId','ToQueue','ToSmsAccountId','CustomFields','Queues','UserProfileSections','Resources','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','user','exports','../config/environment','lodash','determine','sequelize','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceQueue','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xebd3,0x194));var _0x3ebd=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0xebd3[_0x296754];return _0x1d9f1d;};'use strict';var config=require(_0x3ebd('0x0'));var Sequelize=require('sequelize');var _=require(_0x3ebd('0x1'));var jstz=require('jstz');var timezone=jstz[_0x3ebd('0x2')]();config[_0x3ebd('0x3')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':_0x3ebd('0x4'),'password':_0x3ebd('0x5'),'options':{'host':_0x3ebd('0x6'),'port':0xcea,'dialect':_0x3ebd('0x7'),'dialectOptions':{'charset':_0x3ebd('0x8')},'logging':![],'timezone':timezone[_0x3ebd('0x9')](),'define':{'charset':_0x3ebd('0xa'),'collate':_0x3ebd('0xb')}}});config[_0x3ebd('0xc')]=_[_0x3ebd('0xd')](config['sequelizeHistory'],{'database':_0x3ebd('0xe'),'username':'xcall','password':_0x3ebd('0x5'),'options':{'host':_0x3ebd('0x6'),'port':0xcea,'dialect':_0x3ebd('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x3ebd('0x9')](),'define':{'charset':'utf8','collate':_0x3ebd('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x3ebd('0xf')],config[_0x3ebd('0x3')][_0x3ebd('0x10')],config[_0x3ebd('0x3')][_0x3ebd('0x11')],config['sequelize'][_0x3ebd('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3ebd('0xc')]['database'],config[_0x3ebd('0xc')][_0x3ebd('0x10')],config[_0x3ebd('0xc')]['password'],config['sequelizeHistory'][_0x3ebd('0x12')])};db['User']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x14'));db[_0x3ebd('0x15')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x16'));db[_0x3ebd('0x17')]=db[_0x3ebd('0x3')]['import']('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0x3ebd('0x3')]['import'](_0x3ebd('0x18'));db['VoiceMusicOnHold']=db['sequelize']['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x3ebd('0x19')]=db[_0x3ebd('0x3')]['import']('../api/voiceQueue/voiceQueue.model');db[_0x3ebd('0x1a')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x3ebd('0x1b')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x1c'));db['VoiceMail']=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db['sequelize']['import'](_0x3ebd('0x1d'));db[_0x3ebd('0x1e')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x1f'));db[_0x3ebd('0x20')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x21'));db[_0x3ebd('0x22')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x23'));db[_0x3ebd('0x24')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x25'));db[_0x3ebd('0x26')]=db['sequelize'][_0x3ebd('0x13')]('../api/trunk/trunk.model');db[_0x3ebd('0x27')]=db['sequelize']['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0x3ebd('0x28')]=db['sequelize']['import'](_0x3ebd('0x29'));db['UserVoiceQueue']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x2a'));db[_0x3ebd('0x2b')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0x3ebd('0x2c')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x2d'));db[_0x3ebd('0x2e')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0x2f'));db[_0x3ebd('0x30')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0x31'));db[_0x3ebd('0x32')]=db['sequelize']['import'](_0x3ebd('0x33'));db[_0x3ebd('0x34')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x3ebd('0x35')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x36'));db['MailServerOut']=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0x37'));db[_0x3ebd('0x38')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x39'));db['MailQueue']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x3a'));db[_0x3ebd('0x3b')]=db['sequelize']['import'](_0x3ebd('0x3c'));db['MailInteraction']=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0x3d'));db[_0x3ebd('0x3e')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x3f'));db['MailApplication']=db[_0x3ebd('0x3')]['import']('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x40'));db[_0x3ebd('0x41')]=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0x42'));db[_0x3ebd('0x43')]=db[_0x3ebd('0x3')]['import']('../api/dashboardItem/dashboardItem.model');db[_0x3ebd('0x44')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/faxAccount/faxAccount.model');db[_0x3ebd('0x45')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x46'));db[_0x3ebd('0x47')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x48'));db[_0x3ebd('0x49')]=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0x4a'));db[_0x3ebd('0x4b')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x4c'));db['FaxQueueReport']=db['sequelize'][_0x3ebd('0x13')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x4d'));db[_0x3ebd('0x4e')]=db['sequelize'][_0x3ebd('0x13')]('../api/smsApplication/smsApplication.model');db[_0x3ebd('0x4f')]=db['sequelize']['import'](_0x3ebd('0x50'));db[_0x3ebd('0x51')]=db['sequelize']['import']('../api/smsMessage/smsMessage.model');db[_0x3ebd('0x52')]=db['sequelize'][_0x3ebd('0x13')]('../api/smsQueue/smsQueue.model');db[_0x3ebd('0x53')]=db['sequelize']['import']('../api/openchannelAccount/openchannelAccount.model');db[_0x3ebd('0x54')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x55'));db[_0x3ebd('0x56')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x57'));db[_0x3ebd('0x58')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x59'));db[_0x3ebd('0x5a')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x3ebd('0x5b')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x3ebd('0x5c')]=db['sequelize'][_0x3ebd('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x3ebd('0x5d')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x5e'));db[_0x3ebd('0x5f')]=db[_0x3ebd('0x3')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x3ebd('0x60')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x61'));db[_0x3ebd('0x62')]=db[_0x3ebd('0x3')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/chatQueue/chatQueue.model');db[_0x3ebd('0x63')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x64'));db[_0x3ebd('0x65')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x66'));db['CmCompany']=db['sequelize'][_0x3ebd('0x13')]('../api/cmCompany/cmCompany.model');db[_0x3ebd('0x67')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0x68'));db[_0x3ebd('0x69')]=db['sequelize']['import'](_0x3ebd('0x6a'));db[_0x3ebd('0x6b')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0x6c'));db['CmHopperFinal']=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db['sequelize'][_0x3ebd('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x3ebd('0x3')]['import'](_0x3ebd('0x6d'));db[_0x3ebd('0x6e')]=db[_0x3ebd('0x3')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x3ebd('0x6f')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x70'));db[_0x3ebd('0x71')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x72'));db[_0x3ebd('0x73')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x74'));db[_0x3ebd('0x75')]=db['sequelize']['import'](_0x3ebd('0x76'));db['Condition']=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0x77'));db[_0x3ebd('0x78')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x79'));db[_0x3ebd('0x7a')]=db['sequelize']['import'](_0x3ebd('0x7b'));db[_0x3ebd('0x7c')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x7d'));db[_0x3ebd('0x7e')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x7f'));db[_0x3ebd('0x80')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x81'));db[_0x3ebd('0x82')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x83'));db[_0x3ebd('0x84')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0x85'));db['ContactItemType']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x86'));db['CmContactHasItem']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x87'));db['CmHopperAdditionalPhone']=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0x88'));db[_0x3ebd('0x89')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x8a'));db[_0x3ebd('0x8b')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0x8c'));db[_0x3ebd('0x8d')]=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0x8e'));db[_0x3ebd('0x8f')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0x90'));db[_0x3ebd('0x91')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x92'));db[_0x3ebd('0x93')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x3ebd('0x94')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x95'));db[_0x3ebd('0x96')]=db[_0x3ebd('0x3')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x3ebd('0x97')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x98'));db['AnalyticFieldReport']=db['sequelize']['import'](_0x3ebd('0x99'));db[_0x3ebd('0x9a')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0x9b'));db['SalesforceAccount']=db[_0x3ebd('0x3')]['import'](_0x3ebd('0x9c'));db['SalesforceConfiguration']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x9d'));db['SalesforceField']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x9e'));db[_0x3ebd('0x9f')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x3ebd('0xa0')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xa1'));db[_0x3ebd('0xa2')]=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0xa3'));db[_0x3ebd('0xa4')]=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0xa5'));db[_0x3ebd('0xa6')]=db[_0x3ebd('0x3')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xa7'));db[_0x3ebd('0xa8')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xa9'));db['ZohoConfiguration']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xaa'));db['ZohoField']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xab'));db[_0x3ebd('0xac')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x3ebd('0xad')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xae'));db[_0x3ebd('0xaf')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xb0'));db[_0x3ebd('0xb1')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x3ebd('0xb2')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xb3'));db[_0x3ebd('0xb4')]=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0xb5'));db[_0x3ebd('0xb6')]=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0xb7'));db[_0x3ebd('0xb8')]=db['sequelize'][_0x3ebd('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x3ebd('0xb9')]=db['sequelize']['import']('../api/intVtigerField/intVtigerField.model');db[_0x3ebd('0xba')]=db['sequelize']['import'](_0x3ebd('0xbb'));db[_0x3ebd('0xbc')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xbd'));db[_0x3ebd('0xbe')]=db['sequelize'][_0x3ebd('0x13')]('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x3ebd('0x3')]['import'](_0x3ebd('0xbf'));db[_0x3ebd('0xc0')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xc1'));db[_0x3ebd('0xc2')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0xc3'));db[_0x3ebd('0xc4')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0xc5'));db[_0x3ebd('0xc6')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xc7'));db['FreshsalesField']=db['sequelize'][_0x3ebd('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x3ebd('0x8f')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/integration/integration.model');db['Network']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xc8'));db[_0x3ebd('0xc9')]=db['sequelize'][_0x3ebd('0x13')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xca'));db[_0x3ebd('0xcb')]=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0xcc'));db[_0x3ebd('0xcd')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xce'));db['JscriptySessionReport']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xcf'));db[_0x3ebd('0xd0')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xd1'));db[_0x3ebd('0xd2')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/squareReport/squareReport.model');db[_0x3ebd('0xd3')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xd4'));db['JscriptyProject']=db['sequelize'][_0x3ebd('0x13')]('../api/jscriptyProject/jscriptyProject.model');db[_0x3ebd('0xd5')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xd6'));db['SquareOdbc']=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xd7'));db[_0x3ebd('0xd8')]=db[_0x3ebd('0x3')]['import']('../api/squareProject/squareProject.model');db[_0x3ebd('0xd9')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xda'));db[_0x3ebd('0xdb')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0xdc'));db[_0x3ebd('0xdd')]=db['sequelize']['import'](_0x3ebd('0xde'));db['License']=db[_0x3ebd('0x3')]['import'](_0x3ebd('0xdf'));db[_0x3ebd('0xe0')]=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0xe1'));db['Migration']=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0xe2'));db[_0x3ebd('0xe3')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/attachment/attachment.model');db[_0x3ebd('0xe4')]=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0xe5'));db[_0x3ebd('0xe6')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0xe7'));db[_0x3ebd('0xe8')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0xe9'));db[_0x3ebd('0xea')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0xeb'));db[_0x3ebd('0xec')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x3ebd('0xed')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x3ebd('0xee')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xef'));db[_0x3ebd('0xf0')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0x3ebd('0xf1')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xf2'));db[_0x3ebd('0xf3')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')]('../api/userProfileSection/userProfileSection.model');db[_0x3ebd('0xf4')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xf5'));db[_0x3ebd('0xf6')]=db['sequelize'][_0x3ebd('0x13')]('../api/userNotification/userNotification.model');db[_0x3ebd('0xf7')]=db[_0x3ebd('0x3')]['import'](_0x3ebd('0xf8'));db[_0x3ebd('0xf9')]=db['sequelize'][_0x3ebd('0x13')](_0x3ebd('0xfa'));db[_0x3ebd('0xfb')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xfc'));db['WhatsappMessage']=db[_0x3ebd('0x3')]['import'](_0x3ebd('0xfd'));db[_0x3ebd('0xfe')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0xff'));db[_0x3ebd('0x100')]=db['sequelize'][_0x3ebd('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x3ebd('0x101')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x102'));db[_0x3ebd('0x103')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x104'));db[_0x3ebd('0x105')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x106'));db[_0x3ebd('0x107')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x108'));db['UserVoicePrefix']=db[_0x3ebd('0x3')]['import'](_0x3ebd('0x109'));db[_0x3ebd('0x10a')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x10b'));db[_0x3ebd('0x10c')]=db[_0x3ebd('0x3')][_0x3ebd('0x13')](_0x3ebd('0x10d'));db[_0x3ebd('0x10e')][_0x3ebd('0x10f')](db[_0x3ebd('0x110')],{'as':_0x3ebd('0x110'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x10e')][_0x3ebd('0x10f')](db[_0x3ebd('0x10a')],{'as':'userSetting','onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x112')});db['User'][_0x3ebd('0x113')](db[_0x3ebd('0x1a')],{'as':_0x3ebd('0x114'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x10e')][_0x3ebd('0x113')](db[_0x3ebd('0x28')],{'as':'VoiceQueuesRt','foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x10e')][_0x3ebd('0x113')](db[_0x3ebd('0x115')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0x3ebd('0x10e')][_0x3ebd('0x113')](db[_0x3ebd('0x116')],{'as':_0x3ebd('0x117'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x10e')][_0x3ebd('0x113')](db['CmHopperHistory'],{'as':_0x3ebd('0x118'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x10e')][_0x3ebd('0x113')](db['ReportAgentPreview'],{'as':_0x3ebd('0x119'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x10e')]['hasMany'](db[_0x3ebd('0x56')],{'as':_0x3ebd('0x11a'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x10e')][_0x3ebd('0x113')](db['ChatInteraction'],{'as':_0x3ebd('0x11b'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x10e')][_0x3ebd('0x113')](db[_0x3ebd('0x4f')],{'as':_0x3ebd('0x11c'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x10e')]['hasMany'](db[_0x3ebd('0x47')],{'as':_0x3ebd('0x11d'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x10e')][_0x3ebd('0x113')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x10e')][_0x3ebd('0x113')](db[_0x3ebd('0xfb')],{'as':_0x3ebd('0x11e'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x10e')][_0x3ebd('0x113')](db[_0x3ebd('0xf6')],{'as':'UserNotifications','foreignKey':_0x3ebd('0x11f')});db[_0x3ebd('0x10e')]['hasMany'](db[_0x3ebd('0x69')],{'as':'Hoppers','foreignKey':_0x3ebd('0x112'),'onDelete':'SET\x20NULL'});db['User']['belongsTo'](db[_0x3ebd('0xf1')],{'as':_0x3ebd('0xf1'),'foreignKey':_0x3ebd('0x120')});db[_0x3ebd('0x10e')]['belongsToMany'](db['ChatGroup'],{'as':_0x3ebd('0x121'),'through':_0x3ebd('0x122')});db[_0x3ebd('0x10e')]['belongsToMany'](db[_0x3ebd('0x67')],{'as':_0x3ebd('0x123'),'through':_0x3ebd('0x124')});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db[_0x3ebd('0xee')],{'as':_0x3ebd('0x126'),'through':_0x3ebd('0x127')});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db[_0x3ebd('0xdd')],{'through':_0x3ebd('0x128')});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db[_0x3ebd('0x129')],{'as':_0x3ebd('0x12a'),'through':'user_has_mail_interactions'});db[_0x3ebd('0x10e')]['belongsToMany'](db[_0x3ebd('0x5f')],{'as':_0x3ebd('0x11b'),'through':_0x3ebd('0x12b')});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db[_0x3ebd('0x47')],{'as':'FaxInteractions','through':_0x3ebd('0x12c')});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db[_0x3ebd('0x4f')],{'as':_0x3ebd('0x11c'),'through':_0x3ebd('0x12d')});db['User']['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0x3ebd('0x10e')]['belongsToMany'](db[_0x3ebd('0xfb')],{'as':'WhatsappInteractions','through':_0x3ebd('0x12e')});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db[_0x3ebd('0x19')],{'as':'VoiceQueues','through':_0x3ebd('0x12f'),'required':![]});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db['VoicePrefix'],{'as':_0x3ebd('0x130'),'through':_0x3ebd('0x131'),'required':![]});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db[_0x3ebd('0x132')],{'as':_0x3ebd('0x133'),'through':_0x3ebd('0x2c'),'required':![]});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db[_0x3ebd('0x134')],{'as':_0x3ebd('0x135'),'through':_0x3ebd('0x2b'),'required':![],'hooks':!![]});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db[_0x3ebd('0x4b')],{'as':_0x3ebd('0x136'),'through':_0x3ebd('0x2e'),'required':![]});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db['SmsQueue'],{'as':_0x3ebd('0x137'),'through':'UserSmsQueue','required':![]});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db['OpenchannelQueue'],{'as':_0x3ebd('0x138'),'through':_0x3ebd('0x32'),'required':![]});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db[_0x3ebd('0x101')],{'as':_0x3ebd('0x139'),'through':_0x3ebd('0x34'),'required':![]});db['User'][_0x3ebd('0x125')](db[_0x3ebd('0xee')],{'through':_0x3ebd('0x127')});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db['ChatWebsite'],{'as':_0x3ebd('0x13a'),'through':_0x3ebd('0x13b')});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db['FaxAccount'],{'as':_0x3ebd('0x13c'),'through':_0x3ebd('0x13d')});db['User'][_0x3ebd('0x125')](db[_0x3ebd('0x38')],{'as':_0x3ebd('0x13e'),'through':'user_has_mail_accounts'});db['User']['belongsToMany'](db[_0x3ebd('0x53')],{'as':'OpenchannelAccounts','through':_0x3ebd('0x13f')});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db[_0x3ebd('0x140')],{'as':'SmsAccounts','through':_0x3ebd('0x141')});db[_0x3ebd('0x10e')][_0x3ebd('0x125')](db[_0x3ebd('0xf7')],{'as':_0x3ebd('0x142'),'through':_0x3ebd('0x143')});db[_0x3ebd('0x15')][_0x3ebd('0x113')](db[_0x3ebd('0x115')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x3ebd('0x144')});db[_0x3ebd('0x17')][_0x3ebd('0x113')](db[_0x3ebd('0x115')],{'onDelete':_0x3ebd('0x111')});db['VoiceExtension'][_0x3ebd('0x113')](db[_0x3ebd('0x115')],{'as':_0x3ebd('0x145'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x146')][_0x3ebd('0x125')](db['Sound'],{'as':_0x3ebd('0x147'),'through':_0x3ebd('0x148')});db[_0x3ebd('0x19')][_0x3ebd('0x113')](db[_0x3ebd('0x28')],{'as':_0x3ebd('0x149'),'foreignKey':_0x3ebd('0x14a')});db['VoiceQueue']['hasMany'](db['CmHopper'],{'as':_0x3ebd('0x14b'),'foreignKey':_0x3ebd('0x14a')});db[_0x3ebd('0x19')][_0x3ebd('0x113')](db[_0x3ebd('0x116')],{'as':_0x3ebd('0x117'),'foreignKey':'VoiceQueueId'});db[_0x3ebd('0x19')]['hasMany'](db[_0x3ebd('0x14c')],{'as':'HopperHistories','foreignKey':_0x3ebd('0x14a')});db[_0x3ebd('0x19')][_0x3ebd('0x113')](db[_0x3ebd('0x119')],{'as':_0x3ebd('0x119'),'foreignKey':'VoiceQueueId'});db[_0x3ebd('0x19')][_0x3ebd('0x113')](db[_0x3ebd('0x6b')],{'as':'HopperBlacks','foreignKey':_0x3ebd('0x14a')});db[_0x3ebd('0x19')][_0x3ebd('0x113')](db[_0x3ebd('0x14d')],{'as':'JscriptySessions','foreignKey':_0x3ebd('0x14a')});db[_0x3ebd('0x19')][_0x3ebd('0x14e')](db['Trunk'],{'as':_0x3ebd('0x26'),'foreignKey':_0x3ebd('0x14f')});db[_0x3ebd('0x19')][_0x3ebd('0x14e')](db[_0x3ebd('0x26')],{'as':_0x3ebd('0x150'),'foreignKey':_0x3ebd('0x151')});db[_0x3ebd('0x19')][_0x3ebd('0x14e')](db[_0x3ebd('0x78')],{'as':_0x3ebd('0x78'),'foreignKey':_0x3ebd('0x152')});db[_0x3ebd('0x19')][_0x3ebd('0x14e')](db[_0x3ebd('0x7a')],{'as':_0x3ebd('0x153'),'foreignKey':_0x3ebd('0x154')});db[_0x3ebd('0x19')][_0x3ebd('0x125')](db[_0x3ebd('0xee')],{'as':'Lists','through':_0x3ebd('0x155')});db['VoiceQueue'][_0x3ebd('0x125')](db['User'],{'as':'Agents','through':'UserVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0x3ebd('0xdd')],{'as':_0x3ebd('0x156'),'through':_0x3ebd('0x105')});db['VoiceQueue'][_0x3ebd('0x125')](db[_0x3ebd('0xee')],{'as':_0x3ebd('0x157'),'through':_0x3ebd('0x158')});db[_0x3ebd('0x1a')]['belongsTo'](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x10e'),'foreignKey':'UserId'});db['ScreenRecording'][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x10e'),'foreignKey':'UserId'});db[_0x3ebd('0x110')][_0x3ebd('0x113')](db[_0x3ebd('0x159')],{'as':_0x3ebd('0x15a'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x3ebd('0x15b')});db[_0x3ebd('0x159')]['belongsTo'](db[_0x3ebd('0x110')],{'foreignKey':'mailboxuser','targetKey':_0x3ebd('0x15b')});db['VoiceCallReport']['hasMany'](db['VoiceQueueReport'],{'as':_0x3ebd('0x15c'),'foreignKey':_0x3ebd('0x15d'),'constraints':![]});db[_0x3ebd('0x1e')][_0x3ebd('0x113')](db[_0x3ebd('0x22')],{'as':'AgentReports','foreignKey':_0x3ebd('0x15d'),'constraints':![]});db[_0x3ebd('0x1e')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x10e'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x1e')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'as':'Contact','foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0x35')][_0x3ebd('0x14e')](db[_0x3ebd('0x38')],{'as':_0x3ebd('0x38'),'foreignKey':_0x3ebd('0x15f')});db[_0x3ebd('0x35')][_0x3ebd('0x14e')](db[_0x3ebd('0x103')],{'as':_0x3ebd('0x103'),'foreignKey':'CloudProviderId','onDelete':_0x3ebd('0x160')});db['MailServerOut'][_0x3ebd('0x14e')](db[_0x3ebd('0x38')],{'as':'MailAccount','foreignKey':_0x3ebd('0x15f')});db[_0x3ebd('0x161')][_0x3ebd('0x14e')](db[_0x3ebd('0x103')],{'as':_0x3ebd('0x103'),'foreignKey':_0x3ebd('0x162'),'onDelete':_0x3ebd('0x160')});db['MailAccount'][_0x3ebd('0x10f')](db[_0x3ebd('0x35')],{'as':_0x3ebd('0x163'),'onDelete':_0x3ebd('0x111')});db['MailAccount']['hasOne'](db[_0x3ebd('0x161')],{'as':_0x3ebd('0x164'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x38')][_0x3ebd('0x113')](db[_0x3ebd('0x75')],{'as':_0x3ebd('0x165'),'foreignKey':_0x3ebd('0x15f'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x38')][_0x3ebd('0x113')](db[_0x3ebd('0x73')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x3ebd('0x38')][_0x3ebd('0x113')](db[_0x3ebd('0x3e')],{'as':_0x3ebd('0x15a'),'foreignKey':_0x3ebd('0x15f')});db['MailAccount']['hasMany'](db[_0x3ebd('0x129')],{'as':_0x3ebd('0x166')});db['MailAccount'][_0x3ebd('0x113')](db[_0x3ebd('0x167')],{'as':_0x3ebd('0x145'),'foreignKey':_0x3ebd('0x15f'),'onDelete':'cascade'});db[_0x3ebd('0x38')][_0x3ebd('0x14e')](db[_0x3ebd('0xee')],{'as':_0x3ebd('0x168'),'foreignKey':'ListId'});db[_0x3ebd('0x38')][_0x3ebd('0x14e')](db[_0x3ebd('0x89')],{'as':'Template','foreignKey':_0x3ebd('0x169')});db[_0x3ebd('0x38')]['belongsTo'](db[_0x3ebd('0x7a')],{'as':_0x3ebd('0x153'),'foreignKey':_0x3ebd('0x154')});db[_0x3ebd('0x38')]['belongsToMany'](db['User'],{'as':_0x3ebd('0x16a'),'through':_0x3ebd('0x16b')});db[_0x3ebd('0x132')]['belongsToMany'](db[_0x3ebd('0x10e')],{'as':'Agents','through':_0x3ebd('0x2c')});db['MailQueue'][_0x3ebd('0x125')](db[_0x3ebd('0xdd')],{'through':_0x3ebd('0x16c'),'as':_0x3ebd('0x156')});db['MailInteraction'][_0x3ebd('0x113')](db['MailMessage'],{'as':_0x3ebd('0x15a'),'onDelete':_0x3ebd('0x111'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x3ebd('0x14e')](db['MailAccount'],{'as':'Account','foreignKey':'MailAccountId'});db[_0x3ebd('0x129')][_0x3ebd('0x14e')](db['CmContact'],{'as':_0x3ebd('0x16d'),'foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0x129')][_0x3ebd('0x14e')](db['User'],{'as':_0x3ebd('0x16e'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x129')][_0x3ebd('0x125')](db[_0x3ebd('0x84')],{'through':_0x3ebd('0x16f'),'as':'Tags'});db[_0x3ebd('0x129')][_0x3ebd('0x125')](db[_0x3ebd('0x84')],{'through':_0x3ebd('0x16f'),'as':_0x3ebd('0x170')});db[_0x3ebd('0x129')][_0x3ebd('0x125')](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x171'),'through':_0x3ebd('0x172'),'foreignKey':_0x3ebd('0x173')});db[_0x3ebd('0x3e')][_0x3ebd('0x113')](db[_0x3ebd('0xe3')],{'as':_0x3ebd('0x174'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x3e')][_0x3ebd('0x14e')](db['User'],{'as':'User'});db['MailMessage'][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'onDelete':_0x3ebd('0x111'),'as':_0x3ebd('0x16d')});db[_0x3ebd('0x3e')]['belongsTo'](db[_0x3ebd('0x129')],{'as':_0x3ebd('0x175'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x3ebd('0x14e')](db[_0x3ebd('0x38')],{'as':_0x3ebd('0x176'),'foreignKey':'MailAccountId'});db[_0x3ebd('0x3e')][_0x3ebd('0x14e')](db[_0x3ebd('0x5b')],{'as':_0x3ebd('0x5b'),'foreignKey':_0x3ebd('0x177')});db[_0x3ebd('0x3e')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0x3ebd('0x62'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x3ebd('0x14e')](db['User'],{'onDelete':_0x3ebd('0x160')});db['MailApplication'][_0x3ebd('0x14e')](db[_0x3ebd('0x132')],{'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x167')][_0x3ebd('0x14e')](db['MailAccount'],{'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x167')][_0x3ebd('0x14e')](db[_0x3ebd('0x78')],{'onDelete':_0x3ebd('0x160'),'foreignKey':_0x3ebd('0x152')});db[_0x3ebd('0x167')][_0x3ebd('0x14e')](db[_0x3ebd('0x84')],{'onDelete':_0x3ebd('0x160'),'foreignKey':'TagId'});db[_0x3ebd('0x178')][_0x3ebd('0x14e')](db[_0x3ebd('0x38')],{});db[_0x3ebd('0x178')][_0x3ebd('0x14e')](db[_0x3ebd('0xee')],{'as':_0x3ebd('0x168'),'foreignKey':_0x3ebd('0x179')});db[_0x3ebd('0x178')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'as':'Contact','foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0x178')][_0x3ebd('0x14e')](db[_0x3ebd('0x129')],{});db[_0x3ebd('0x178')][_0x3ebd('0x14e')](db['MailMessage'],{});db[_0x3ebd('0x178')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{});db[_0x3ebd('0x178')]['belongsTo'](db[_0x3ebd('0x132')],{});db[_0x3ebd('0x41')][_0x3ebd('0x113')](db[_0x3ebd('0x43')],{'as':_0x3ebd('0x17a'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x44')][_0x3ebd('0x113')](db[_0x3ebd('0x75')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x44')]['hasMany'](db[_0x3ebd('0x73')],{'as':_0x3ebd('0x17b'),'foreignKey':_0x3ebd('0x17c')});db[_0x3ebd('0x44')]['hasMany'](db[_0x3ebd('0x47')],{'as':_0x3ebd('0x166')});db[_0x3ebd('0x44')][_0x3ebd('0x113')](db[_0x3ebd('0x45')],{'as':'Applications','foreignKey':_0x3ebd('0x17c'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x44')][_0x3ebd('0x113')](db[_0x3ebd('0x115')],{'as':_0x3ebd('0x17d'),'onDelete':'cascade'});db['FaxAccount'][_0x3ebd('0x113')](db[_0x3ebd('0x49')],{'as':_0x3ebd('0x15a')});db[_0x3ebd('0x44')][_0x3ebd('0x14e')](db[_0x3ebd('0x26')],{'as':_0x3ebd('0x26')});db['FaxAccount'][_0x3ebd('0x14e')](db[_0x3ebd('0xee')],{'as':_0x3ebd('0x168'),'foreignKey':'ListId'});db[_0x3ebd('0x44')]['belongsTo'](db[_0x3ebd('0x7a')],{'as':_0x3ebd('0x153'),'foreignKey':_0x3ebd('0x154')});db[_0x3ebd('0x44')][_0x3ebd('0x125')](db[_0x3ebd('0x10e')],{'as':'Agents','through':_0x3ebd('0x13d')});db[_0x3ebd('0x45')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x45')][_0x3ebd('0x14e')](db[_0x3ebd('0x4b')],{'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x45')][_0x3ebd('0x14e')](db['FaxAccount'],{'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x45')]['belongsTo'](db[_0x3ebd('0x84')],{'onDelete':'restrict','foreignKey':_0x3ebd('0x17e')});db[_0x3ebd('0x47')][_0x3ebd('0x113')](db[_0x3ebd('0x49')],{'as':_0x3ebd('0x15a'),'onDelete':_0x3ebd('0x111'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x3ebd('0x14e')](db[_0x3ebd('0x44')],{'as':_0x3ebd('0x176'),'foreignKey':'FaxAccountId'});db[_0x3ebd('0x47')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'as':_0x3ebd('0x16d'),'foreignKey':'ContactId'});db[_0x3ebd('0x47')][_0x3ebd('0x14e')](db['User'],{'as':_0x3ebd('0x16e'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x47')][_0x3ebd('0x125')](db['Tag'],{'through':_0x3ebd('0x17f'),'as':'Tags'});db[_0x3ebd('0x47')][_0x3ebd('0x125')](db[_0x3ebd('0x84')],{'through':'fax_interaction_has_tags','as':_0x3ebd('0x170')});db[_0x3ebd('0x47')][_0x3ebd('0x125')](db['User'],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x3ebd('0x180')});db[_0x3ebd('0x49')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'onDelete':_0x3ebd('0x111'),'as':_0x3ebd('0x10e')});db[_0x3ebd('0x49')][_0x3ebd('0x14e')](db[_0x3ebd('0x47')],{'as':_0x3ebd('0x175'),'foreignKey':_0x3ebd('0x180')});db['FaxMessage'][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'onDelete':_0x3ebd('0x111'),'as':_0x3ebd('0x16d')});db['FaxMessage'][_0x3ebd('0x14e')](db[_0x3ebd('0xe3')],{'as':_0x3ebd('0xe3'),'foreignKey':_0x3ebd('0x181')});db[_0x3ebd('0x49')]['belongsTo'](db[_0x3ebd('0x44')],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x17c')});db[_0x3ebd('0x4b')][_0x3ebd('0x125')](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x16a'),'through':_0x3ebd('0x2e')});db[_0x3ebd('0x4b')]['belongsToMany'](db[_0x3ebd('0xdd')],{'through':'team_has_fax_queues','as':'Teams'});db[_0x3ebd('0x182')]['belongsTo'](db['FaxAccount'],{});db[_0x3ebd('0x182')][_0x3ebd('0x14e')](db['CmList'],{'as':_0x3ebd('0x168'),'foreignKey':_0x3ebd('0x179')});db[_0x3ebd('0x182')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'as':'Contact','foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0x182')][_0x3ebd('0x14e')](db['FaxInteraction'],{});db[_0x3ebd('0x182')][_0x3ebd('0x14e')](db[_0x3ebd('0x49')],{});db[_0x3ebd('0x182')][_0x3ebd('0x14e')](db['User'],{});db[_0x3ebd('0x182')][_0x3ebd('0x14e')](db['FaxQueue'],{});db[_0x3ebd('0x140')]['hasMany'](db[_0x3ebd('0x75')],{'as':'Dispositions','foreignKey':_0x3ebd('0x183'),'onDelete':_0x3ebd('0x111')});db['SmsAccount'][_0x3ebd('0x113')](db[_0x3ebd('0x73')],{'as':_0x3ebd('0x17b'),'foreignKey':'SmsAccountId'});db[_0x3ebd('0x140')][_0x3ebd('0x113')](db['SmsMessage'],{'as':_0x3ebd('0x15a'),'foreignKey':_0x3ebd('0x183')});db[_0x3ebd('0x140')][_0x3ebd('0x113')](db[_0x3ebd('0x4f')],{'as':_0x3ebd('0x166')});db[_0x3ebd('0x140')][_0x3ebd('0x113')](db[_0x3ebd('0x4e')],{'as':_0x3ebd('0x145'),'foreignKey':_0x3ebd('0x183'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x140')][_0x3ebd('0x14e')](db[_0x3ebd('0xee')],{'as':'List','foreignKey':_0x3ebd('0x179')});db[_0x3ebd('0x140')][_0x3ebd('0x14e')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount'][_0x3ebd('0x125')](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x16a'),'through':_0x3ebd('0x141')});db['SmsApplication'][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x4e')][_0x3ebd('0x14e')](db[_0x3ebd('0x52')],{'onDelete':'restrict'});db[_0x3ebd('0x4e')][_0x3ebd('0x14e')](db['SmsAccount'],{'onDelete':_0x3ebd('0x160')});db['SmsApplication'][_0x3ebd('0x14e')](db['Interval'],{'onDelete':_0x3ebd('0x160'),'foreignKey':_0x3ebd('0x152')});db[_0x3ebd('0x4e')][_0x3ebd('0x14e')](db[_0x3ebd('0x84')],{'onDelete':_0x3ebd('0x160'),'foreignKey':_0x3ebd('0x17e')});db[_0x3ebd('0x4f')][_0x3ebd('0x113')](db['SmsMessage'],{'as':'Messages','onDelete':_0x3ebd('0x111'),'foreignKey':'SmsInteractionId'});db[_0x3ebd('0x4f')]['belongsTo'](db[_0x3ebd('0x140')],{'as':'Account','foreignKey':_0x3ebd('0x183')});db[_0x3ebd('0x4f')]['belongsTo'](db[_0x3ebd('0x67')],{'as':_0x3ebd('0x16d'),'foreignKey':'ContactId'});db[_0x3ebd('0x4f')]['belongsTo'](db['User'],{'as':_0x3ebd('0x16e'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x4f')][_0x3ebd('0x125')](db[_0x3ebd('0x84')],{'through':_0x3ebd('0x184'),'as':_0x3ebd('0x185')});db[_0x3ebd('0x4f')][_0x3ebd('0x125')](db[_0x3ebd('0x84')],{'through':_0x3ebd('0x184'),'as':'ThroughTags'});db[_0x3ebd('0x4f')][_0x3ebd('0x125')](db['User'],{'as':_0x3ebd('0x171'),'through':_0x3ebd('0x12d'),'foreignKey':'SmsInteractionId'});db[_0x3ebd('0x51')][_0x3ebd('0x14e')](db['User'],{'as':_0x3ebd('0x10e')});db[_0x3ebd('0x51')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'onDelete':_0x3ebd('0x111'),'as':_0x3ebd('0x16d')});db['SmsMessage'][_0x3ebd('0x14e')](db['SmsInteraction'],{'onDelete':_0x3ebd('0x111'),'as':'Interaction','foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x3ebd('0x14e')](db[_0x3ebd('0x140')],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x183')});db['SmsQueue'][_0x3ebd('0x125')](db['User'],{'as':_0x3ebd('0x16a'),'through':_0x3ebd('0x30'),'foreignKey':'SmsQueueId'});db[_0x3ebd('0x52')][_0x3ebd('0x125')](db['Team'],{'through':'team_has_sms_queues','as':'Teams'});db[_0x3ebd('0x53')]['hasMany'](db[_0x3ebd('0x75')],{'as':_0x3ebd('0x165'),'foreignKey':'OpenchannelAccountId','onDelete':_0x3ebd('0x111')});db['OpenchannelAccount'][_0x3ebd('0x113')](db[_0x3ebd('0x73')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x3ebd('0x53')][_0x3ebd('0x113')](db[_0x3ebd('0x56')],{'as':_0x3ebd('0x166'),'foreignKey':'OpenchannelAccountId'});db[_0x3ebd('0x53')][_0x3ebd('0x113')](db[_0x3ebd('0x58')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x3ebd('0x113')](db[_0x3ebd('0x54')],{'as':_0x3ebd('0x145'),'foreignKey':_0x3ebd('0x186'),'onDelete':_0x3ebd('0x111')});db['OpenchannelAccount'][_0x3ebd('0x14e')](db['CmList'],{'as':_0x3ebd('0x168'),'foreignKey':_0x3ebd('0x179')});db['OpenchannelAccount'][_0x3ebd('0x14e')](db[_0x3ebd('0x7a')],{'as':_0x3ebd('0x153'),'foreignKey':_0x3ebd('0x154')});db[_0x3ebd('0x53')][_0x3ebd('0x125')](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x16a'),'through':'user_has_openchannel_accounts'});db[_0x3ebd('0x54')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x54')][_0x3ebd('0x14e')](db['OpenchannelQueue'],{'onDelete':_0x3ebd('0x160'),'foreignKey':_0x3ebd('0x187')});db[_0x3ebd('0x54')][_0x3ebd('0x14e')](db[_0x3ebd('0x53')],{'onDelete':_0x3ebd('0x160'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication']['belongsTo'](db[_0x3ebd('0x78')],{'onDelete':'restrict','foreignKey':_0x3ebd('0x152')});db[_0x3ebd('0x54')][_0x3ebd('0x14e')](db[_0x3ebd('0x84')],{'onDelete':'restrict','foreignKey':_0x3ebd('0x17e')});db[_0x3ebd('0x56')]['hasMany'](db[_0x3ebd('0x58')],{'as':'Messages','onDelete':_0x3ebd('0x111'),'foreignKey':'OpenchannelInteractionId'});db[_0x3ebd('0x56')][_0x3ebd('0x14e')](db['OpenchannelAccount'],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x186')});db[_0x3ebd('0x56')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'as':'Contact','foreignKey':_0x3ebd('0x15e')});db['OpenchannelInteraction']['belongsTo'](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x16e'),'foreignKey':_0x3ebd('0x112')});db[_0x3ebd('0x56')][_0x3ebd('0x125')](db[_0x3ebd('0x84')],{'through':_0x3ebd('0x188'),'as':'Tags'});db[_0x3ebd('0x56')][_0x3ebd('0x125')](db[_0x3ebd('0x84')],{'through':_0x3ebd('0x188'),'as':_0x3ebd('0x170')});db[_0x3ebd('0x56')][_0x3ebd('0x125')](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x171'),'through':'user_has_openchannel_interactions','foreignKey':_0x3ebd('0x189')});db[_0x3ebd('0x58')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'onDelete':_0x3ebd('0x111'),'as':'User'});db[_0x3ebd('0x58')]['belongsTo'](db[_0x3ebd('0x67')],{'onDelete':_0x3ebd('0x111'),'as':'Contact'});db['OpenchannelMessage'][_0x3ebd('0x14e')](db[_0x3ebd('0x56')],{'onDelete':'cascade','as':_0x3ebd('0x175'),'foreignKey':_0x3ebd('0x189')});db[_0x3ebd('0x58')][_0x3ebd('0x14e')](db[_0x3ebd('0xe3')],{'as':'Attachment','foreignKey':_0x3ebd('0x181')});db[_0x3ebd('0x58')][_0x3ebd('0x14e')](db[_0x3ebd('0x53')],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x186')});db[_0x3ebd('0x5a')][_0x3ebd('0x125')](db[_0x3ebd('0x10e')],{'as':'Agents','through':_0x3ebd('0x32'),'foreignKey':_0x3ebd('0x187')});db['OpenchannelQueue'][_0x3ebd('0x125')](db[_0x3ebd('0xdd')],{'through':_0x3ebd('0x18a'),'as':_0x3ebd('0x156')});db[_0x3ebd('0x5b')]['hasMany'](db[_0x3ebd('0x75')],{'as':_0x3ebd('0x165'),'foreignKey':_0x3ebd('0x177'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x5b')]['hasMany'](db[_0x3ebd('0x73')],{'as':_0x3ebd('0x17b'),'foreignKey':_0x3ebd('0x177')});db[_0x3ebd('0x5b')]['hasMany'](db['ChatProactiveAction'],{'as':_0x3ebd('0x18b')});db['ChatWebsite'][_0x3ebd('0x113')](db[_0x3ebd('0x5f')],{'as':_0x3ebd('0x166')});db[_0x3ebd('0x5b')]['hasMany'](db['ChatApplication'],{'as':_0x3ebd('0x145'),'foreignKey':_0x3ebd('0x177'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x5b')][_0x3ebd('0x113')](db[_0x3ebd('0x60')],{'as':_0x3ebd('0x15a')});db[_0x3ebd('0x5b')][_0x3ebd('0x14e')](db[_0x3ebd('0xee')],{'as':'List','foreignKey':_0x3ebd('0x179')});db[_0x3ebd('0x5b')][_0x3ebd('0x14e')](db[_0x3ebd('0x78')],{'as':_0x3ebd('0x78'),'foreignKey':_0x3ebd('0x152')});db[_0x3ebd('0x5b')][_0x3ebd('0x14e')](db[_0x3ebd('0x38')],{'as':_0x3ebd('0x38'),'foreignKey':_0x3ebd('0x15f')});db[_0x3ebd('0x5b')][_0x3ebd('0x14e')](db[_0x3ebd('0x7a')],{'as':_0x3ebd('0x153'),'foreignKey':_0x3ebd('0x154')});db['ChatWebsite']['belongsToMany'](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x16a'),'through':_0x3ebd('0x13b')});db[_0x3ebd('0x5c')][_0x3ebd('0x14e')](db['OpenchannelAccount'],{});db[_0x3ebd('0x5c')][_0x3ebd('0x14e')](db[_0x3ebd('0xee')],{'as':'List','foreignKey':_0x3ebd('0x179')});db['OpenchannelQueueReport'][_0x3ebd('0x14e')](db['CmContact'],{'as':'Contact','foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0x5c')][_0x3ebd('0x14e')](db[_0x3ebd('0x56')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{});db[_0x3ebd('0x5c')][_0x3ebd('0x14e')](db[_0x3ebd('0x5a')],{});db['ChatApplication'][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x18c'),'foreignKey':_0x3ebd('0x112'),'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x5d')][_0x3ebd('0x14e')](db[_0x3ebd('0x134')],{'as':_0x3ebd('0x18d'),'foreignKey':_0x3ebd('0x18e'),'onDelete':_0x3ebd('0x160')});db['ChatApplication'][_0x3ebd('0x14e')](db[_0x3ebd('0x5b')],{'as':_0x3ebd('0x18f'),'foreignKey':'ChatWebsiteId','onDelete':_0x3ebd('0x160')});db['ChatApplication'][_0x3ebd('0x14e')](db[_0x3ebd('0x84')],{'onDelete':_0x3ebd('0x160'),'foreignKey':'TagId'});db[_0x3ebd('0x5f')][_0x3ebd('0x113')](db[_0x3ebd('0x60')],{'as':'Messages','onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x190')});db['ChatInteraction'][_0x3ebd('0x14e')](db[_0x3ebd('0x5b')],{'as':_0x3ebd('0x176'),'foreignKey':'ChatWebsiteId'});db[_0x3ebd('0x5f')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'as':_0x3ebd('0x16d'),'foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0x5f')][_0x3ebd('0x14e')](db['User'],{'as':_0x3ebd('0x16e'),'foreignKey':_0x3ebd('0x112')});db['ChatInteraction']['belongsToMany'](db[_0x3ebd('0x84')],{'through':_0x3ebd('0x191'),'as':_0x3ebd('0x185')});db[_0x3ebd('0x5f')][_0x3ebd('0x125')](db[_0x3ebd('0x84')],{'through':_0x3ebd('0x191'),'as':_0x3ebd('0x170')});db[_0x3ebd('0x5f')][_0x3ebd('0x125')](db['User'],{'as':_0x3ebd('0x171'),'through':_0x3ebd('0x12b'),'foreignKey':_0x3ebd('0x190')});db[_0x3ebd('0x60')][_0x3ebd('0x14e')](db['User'],{'onDelete':'cascade','as':_0x3ebd('0x10e')});db[_0x3ebd('0x60')]['belongsTo'](db[_0x3ebd('0x67')],{'onDelete':_0x3ebd('0x111'),'as':_0x3ebd('0x16d'),'foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0x60')][_0x3ebd('0x14e')](db[_0x3ebd('0x5f')],{'onDelete':_0x3ebd('0x111'),'as':_0x3ebd('0x175'),'foreignKey':_0x3ebd('0x190')});db[_0x3ebd('0x60')][_0x3ebd('0x14e')](db[_0x3ebd('0xe3')],{'as':_0x3ebd('0xe3'),'foreignKey':_0x3ebd('0x181')});db['ChatMessage'][_0x3ebd('0x14e')](db[_0x3ebd('0x5b')],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x177')});db[_0x3ebd('0x62')][_0x3ebd('0x113')](db['Attachment'],{'as':_0x3ebd('0x174'),'foreignKey':_0x3ebd('0x192'),'onDelete':_0x3ebd('0x111'),'hooks':!![]});db[_0x3ebd('0x62')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'onDelete':'cascade','as':_0x3ebd('0x16d'),'foreignKey':_0x3ebd('0x15e')});db['ChatOfflineMessage'][_0x3ebd('0x14e')](db[_0x3ebd('0x5b')],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x177')});db[_0x3ebd('0x134')][_0x3ebd('0x125')](db['User'],{'as':_0x3ebd('0x16a'),'through':_0x3ebd('0x2b'),'hooks':!![]});db[_0x3ebd('0x134')][_0x3ebd('0x125')](db[_0x3ebd('0xdd')],{'through':_0x3ebd('0x193'),'as':_0x3ebd('0x156')});db[_0x3ebd('0x63')][_0x3ebd('0x113')](db['ChatInternalMessage'],{'as':_0x3ebd('0x15a'),'foreignKey':_0x3ebd('0x194'),'onDelete':'cascade'});db[_0x3ebd('0x63')]['belongsToMany'](db[_0x3ebd('0x10e')],{'as':'Members','through':_0x3ebd('0x122')});db[_0x3ebd('0x65')][_0x3ebd('0x14e')](db[_0x3ebd('0x5b')],{'as':_0x3ebd('0x18f'),'foreignKey':_0x3ebd('0x177')});db['CmCompany']['hasMany'](db[_0x3ebd('0x67')],{'as':_0x3ebd('0x123'),'foreignKey':'CompanyId'});db[_0x3ebd('0x67')][_0x3ebd('0x113')](db['CmContactHasItem'],{'as':_0x3ebd('0x195'),'foreignKey':_0x3ebd('0x196')});db[_0x3ebd('0x67')][_0x3ebd('0x113')](db[_0x3ebd('0x69')],{'as':_0x3ebd('0x14b'),'foreignKey':'ContactId'});db[_0x3ebd('0x67')]['hasMany'](db['CmHopperFinal'],{'as':_0x3ebd('0x117'),'foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0x67')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0x67')][_0x3ebd('0x113')](db[_0x3ebd('0x119')],{'as':_0x3ebd('0x119'),'foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0x67')][_0x3ebd('0x113')](db[_0x3ebd('0x14d')],{'as':_0x3ebd('0x197'),'foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0x67')]['hasMany'](db[_0x3ebd('0x56')],{'as':_0x3ebd('0x11a'),'foreignKey':_0x3ebd('0x15e'),'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x67')]['hasMany'](db[_0x3ebd('0x5f')],{'as':_0x3ebd('0x11b'),'foreignKey':_0x3ebd('0x15e'),'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x67')][_0x3ebd('0x113')](db[_0x3ebd('0x4f')],{'as':'SmsInteractions','foreignKey':_0x3ebd('0x15e'),'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x67')][_0x3ebd('0x113')](db['FaxInteraction'],{'as':_0x3ebd('0x11d'),'foreignKey':'ContactId','onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x67')][_0x3ebd('0x113')](db['MailInteraction'],{'as':_0x3ebd('0x12a'),'foreignKey':_0x3ebd('0x15e'),'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x67')][_0x3ebd('0x14e')](db[_0x3ebd('0x198')],{'as':_0x3ebd('0x199'),'foreignKey':_0x3ebd('0x19a')});db[_0x3ebd('0x67')][_0x3ebd('0x14e')](db['CmList'],{'as':_0x3ebd('0x168'),'foreignKey':'ListId','onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x67')][_0x3ebd('0x125')](db[_0x3ebd('0x10e')],{'as':'Users','through':'cm_user_has_contacts'});db['CmContact'][_0x3ebd('0x125')](db[_0x3ebd('0x84')],{'as':_0x3ebd('0x185'),'through':_0x3ebd('0x19b')});db[_0x3ebd('0x67')]['belongsToMany'](db['Tag'],{'through':_0x3ebd('0x19b'),'as':'ThroughTags'});db[_0x3ebd('0x69')][_0x3ebd('0x113')](db[_0x3ebd('0x19c')],{'as':'AdditionalPhones','foreignKey':_0x3ebd('0x19d')});db[_0x3ebd('0x69')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'as':_0x3ebd('0x16d'),'foreignKey':'ContactId','onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x69')][_0x3ebd('0x14e')](db[_0x3ebd('0xee')],{'as':'List','foreignKey':'ListId','onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x69')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'as':'Agent','foreignKey':'UserId'});db[_0x3ebd('0x69')][_0x3ebd('0x14e')](db['VoiceQueue'],{'as':_0x3ebd('0x18d'),'foreignKey':_0x3ebd('0x14a'),'onDelete':_0x3ebd('0x111')});db['CmHopper'][_0x3ebd('0x14e')](db[_0x3ebd('0xe0')],{'as':_0x3ebd('0xe0'),'foreignKey':_0x3ebd('0x19e'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0x69')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x16e'),'foreignKey':_0x3ebd('0x19f')});db[_0x3ebd('0x6b')]['belongsTo'](db[_0x3ebd('0x67')],{'as':_0x3ebd('0x16d'),'foreignKey':'ContactId','onDelete':_0x3ebd('0x111')});db['CmHopperBlack']['belongsTo'](db[_0x3ebd('0xee')],{'as':'List','foreignKey':_0x3ebd('0x179'),'onDelete':'cascade'});db[_0x3ebd('0x6b')][_0x3ebd('0x14e')](db[_0x3ebd('0x19')],{'as':_0x3ebd('0x18d'),'foreignKey':_0x3ebd('0x14a'),'onDelete':_0x3ebd('0x111')});db['CmHopperBlack']['belongsTo'](db[_0x3ebd('0xe0')],{'as':_0x3ebd('0xe0'),'foreignKey':_0x3ebd('0x19e'),'onDelete':'cascade'});db[_0x3ebd('0x71')][_0x3ebd('0x113')](db['Condition'],{'as':{'plural':_0x3ebd('0x1a0'),'singular':_0x3ebd('0x1a1')},'foreignKey':'AutomationAllId','onDelete':_0x3ebd('0x111'),'hooks':!![]});db[_0x3ebd('0x71')][_0x3ebd('0x113')](db['Condition'],{'as':{'plural':_0x3ebd('0x1a2'),'singular':_0x3ebd('0x1a3')},'foreignKey':_0x3ebd('0x1a4'),'onDelete':_0x3ebd('0x111'),'hooks':!![]});db['Automation'][_0x3ebd('0x113')](db['Action'],{'as':_0x3ebd('0x1a5'),'foreignKey':_0x3ebd('0x1a6'),'onDelete':_0x3ebd('0x111'),'hooks':!![]});db[_0x3ebd('0x75')][_0x3ebd('0x113')](db[_0x3ebd('0x75')],{'as':'Dispositions','foreignKey':_0x3ebd('0x1a7'),'onDelete':'cascade'});db[_0x3ebd('0x78')][_0x3ebd('0x113')](db['Interval'],{'as':_0x3ebd('0x1a8'),'foreignKey':_0x3ebd('0x152'),'onDelete':_0x3ebd('0x111'),'hooks':!![],'required':![]});db[_0x3ebd('0x78')]['hasMany'](db[_0x3ebd('0x115')],{'as':_0x3ebd('0x1a9'),'foreignKey':_0x3ebd('0x152'),'onDelete':_0x3ebd('0x160')});db['Interval']['hasMany'](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x3ebd('0x152')});db[_0x3ebd('0x78')]['hasMany'](db['ChatApplication'],{'as':_0x3ebd('0x1aa'),'foreignKey':_0x3ebd('0x152')});db[_0x3ebd('0x78')][_0x3ebd('0x113')](db[_0x3ebd('0x45')],{'as':'FaxApplications','foreignKey':_0x3ebd('0x152')});db[_0x3ebd('0x78')]['hasMany'](db[_0x3ebd('0x4e')],{'as':_0x3ebd('0x1ab'),'foreignKey':_0x3ebd('0x152')});db[_0x3ebd('0x80')][_0x3ebd('0x14e')](db[_0x3ebd('0x38')],{});db[_0x3ebd('0x80')][_0x3ebd('0x14e')](db[_0x3ebd('0x94')],{'foreignKey':_0x3ebd('0x1ac')});db[_0x3ebd('0x80')][_0x3ebd('0x14e')](db[_0x3ebd('0x93')],{'foreignKey':_0x3ebd('0x1ad')});db[_0x3ebd('0x82')][_0x3ebd('0x125')](db[_0x3ebd('0x146')],{'as':_0x3ebd('0x1ae'),'through':'moh_has_sounds','onDelete':_0x3ebd('0x160')});db['Tag']['belongsToMany'](db[_0x3ebd('0x67')],{'through':'cm_contact_has_tags'});db[_0x3ebd('0x84')][_0x3ebd('0x125')](db[_0x3ebd('0x5f')],{'through':_0x3ebd('0x191')});db[_0x3ebd('0x84')][_0x3ebd('0x125')](db[_0x3ebd('0x129')],{'through':'mail_interaction_has_tags'});db[_0x3ebd('0x84')][_0x3ebd('0x125')](db[_0x3ebd('0x4f')],{'through':_0x3ebd('0x184')});db[_0x3ebd('0x84')]['belongsToMany'](db[_0x3ebd('0x47')],{'through':_0x3ebd('0x17f')});db[_0x3ebd('0x84')][_0x3ebd('0x125')](db['OpenchannelInteraction'],{'through':_0x3ebd('0x188')});db[_0x3ebd('0x84')][_0x3ebd('0x125')](db[_0x3ebd('0xfb')],{'through':_0x3ebd('0x1af')});db[_0x3ebd('0x1b0')]['belongsTo'](db[_0x3ebd('0x1b1')],{'as':'ItemType','foreignKey':'ItemTypeId'});db[_0x3ebd('0x19c')][_0x3ebd('0x14e')](db['CmHopper'],{'as':_0x3ebd('0x1b2'),'foreignKey':_0x3ebd('0x19d')});db[_0x3ebd('0x1b0')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'as':'Contact','foreignKey':'CmContactId'});db['Trigger'][_0x3ebd('0x113')](db['Condition'],{'as':{'plural':_0x3ebd('0x1b3'),'singular':_0x3ebd('0x1b4')},'foreignKey':_0x3ebd('0x1b5'),'onDelete':_0x3ebd('0x111'),'hooks':!![]});db[_0x3ebd('0x8b')][_0x3ebd('0x113')](db[_0x3ebd('0x1b6')],{'as':{'plural':_0x3ebd('0x1b7'),'singular':_0x3ebd('0x1b8')},'foreignKey':_0x3ebd('0x1b9'),'onDelete':_0x3ebd('0x111'),'hooks':!![]});db[_0x3ebd('0x8b')][_0x3ebd('0x113')](db[_0x3ebd('0x6f')],{'as':_0x3ebd('0x1a5'),'foreignKey':_0x3ebd('0x1ba'),'onDelete':_0x3ebd('0x111'),'hooks':!![]});db[_0x3ebd('0x93')][_0x3ebd('0x113')](db[_0x3ebd('0x1bb')],{'as':_0x3ebd('0x1bc'),'onDelete':_0x3ebd('0x111'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x3ebd('0x94')][_0x3ebd('0x113')](db[_0x3ebd('0x1bb')],{'as':'Fields','onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1ac')});db['AnalyticMetric'][_0x3ebd('0x113')](db[_0x3ebd('0x1bb')],{'as':'Fields','onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1bd')});db[_0x3ebd('0x1bb')][_0x3ebd('0x14e')](db['AnalyticMetric'],{'foreignKey':_0x3ebd('0x1bd')});db['SalesforceAccount']['hasMany'](db[_0x3ebd('0x1be')],{'as':_0x3ebd('0x1bf'),'onDelete':'cascade','foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0x1be')][_0x3ebd('0x113')](db['SalesforceField'],{'as':_0x3ebd('0x1c1'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0x1be')][_0x3ebd('0x113')](db['SalesforceField'],{'as':_0x3ebd('0x1c3'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c4')});db[_0x3ebd('0x1be')][_0x3ebd('0x113')](db[_0x3ebd('0x1c5')],{'as':_0x3ebd('0x1bc'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0x1be')][_0x3ebd('0x14e')](db[_0x3ebd('0x1c7')],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0x1c5')][_0x3ebd('0x113')](db[_0x3ebd('0x1c5')],{'as':_0x3ebd('0x1c8'),'foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0x1c5')][_0x3ebd('0x113')](db[_0x3ebd('0x1c5')],{'as':_0x3ebd('0x1c9'),'foreignKey':_0x3ebd('0x1c4')});db[_0x3ebd('0x1c5')]['hasMany'](db[_0x3ebd('0x1c5')],{'as':_0x3ebd('0x1ca'),'foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0x1c5')][_0x3ebd('0x14e')](db['Variable'],{'as':_0x3ebd('0x8d'),'foreignKey':'VariableId'});db['SugarcrmAccount']['hasMany'](db['SugarcrmConfiguration'],{'as':_0x3ebd('0x1bf'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c0')});db['SugarcrmConfiguration'][_0x3ebd('0x113')](db[_0x3ebd('0xa2')],{'as':_0x3ebd('0x1c1'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0xa0')][_0x3ebd('0x113')](db[_0x3ebd('0xa2')],{'as':_0x3ebd('0x1c3'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c4')});db['SugarcrmConfiguration'][_0x3ebd('0x113')](db[_0x3ebd('0xa2')],{'as':_0x3ebd('0x1bc'),'onDelete':'cascade','foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0xa0')][_0x3ebd('0x14e')](db['SugarcrmAccount'],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0xa2')]['hasMany'](db[_0x3ebd('0xa2')],{'as':_0x3ebd('0x1c8'),'foreignKey':'SubjectId'});db[_0x3ebd('0xa2')][_0x3ebd('0x113')](db[_0x3ebd('0xa2')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x3ebd('0xa2')][_0x3ebd('0x113')](db['SugarcrmField'],{'as':_0x3ebd('0x1ca'),'foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0xa2')][_0x3ebd('0x14e')](db[_0x3ebd('0x8d')],{'as':_0x3ebd('0x8d'),'foreignKey':_0x3ebd('0x1cb')});db[_0x3ebd('0xa4')]['hasMany'](db['DeskConfiguration'],{'as':_0x3ebd('0x1bf'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0xa6')][_0x3ebd('0x113')](db[_0x3ebd('0x1cc')],{'as':'Subjects','onDelete':_0x3ebd('0x111'),'foreignKey':'SubjectId'});db[_0x3ebd('0xa6')]['hasMany'](db['DeskField'],{'as':'Descriptions','onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c4')});db[_0x3ebd('0xa6')][_0x3ebd('0x113')](db[_0x3ebd('0x1cc')],{'as':'Fields','onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0xa6')][_0x3ebd('0x14e')](db['DeskAccount'],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0xa6')][_0x3ebd('0x125')](db[_0x3ebd('0x84')],{'through':_0x3ebd('0x1cd')});db['DeskField'][_0x3ebd('0x113')](db[_0x3ebd('0x1cc')],{'as':_0x3ebd('0x1c8'),'foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0x1cc')][_0x3ebd('0x113')](db[_0x3ebd('0x1cc')],{'as':_0x3ebd('0x1c9'),'foreignKey':_0x3ebd('0x1c4')});db[_0x3ebd('0x1cc')][_0x3ebd('0x113')](db[_0x3ebd('0x1cc')],{'as':_0x3ebd('0x1ca'),'foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0x1cc')][_0x3ebd('0x14e')](db[_0x3ebd('0x8d')],{'as':'Variable','foreignKey':_0x3ebd('0x1cb')});db[_0x3ebd('0xa8')][_0x3ebd('0x113')](db[_0x3ebd('0x1ce')],{'as':'Configurations','onDelete':_0x3ebd('0x111'),'foreignKey':'AccountId'});db[_0x3ebd('0x1ce')][_0x3ebd('0x113')](db[_0x3ebd('0x1cf')],{'as':_0x3ebd('0x1c1'),'onDelete':'cascade','foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0x1ce')][_0x3ebd('0x113')](db['ZohoField'],{'as':_0x3ebd('0x1c3'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x3ebd('0x1ce')][_0x3ebd('0x113')](db[_0x3ebd('0x1cf')],{'as':_0x3ebd('0x1bc'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0x1ce')][_0x3ebd('0x14e')](db[_0x3ebd('0xa8')],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0x1cf')][_0x3ebd('0x113')](db[_0x3ebd('0x1cf')],{'as':_0x3ebd('0x1c8'),'foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0x1cf')][_0x3ebd('0x113')](db[_0x3ebd('0x1cf')],{'as':_0x3ebd('0x1c9'),'foreignKey':_0x3ebd('0x1c4')});db[_0x3ebd('0x1cf')][_0x3ebd('0x113')](db[_0x3ebd('0x1cf')],{'as':_0x3ebd('0x1ca'),'foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0x1cf')]['belongsTo'](db[_0x3ebd('0x8d')],{'as':_0x3ebd('0x8d'),'foreignKey':_0x3ebd('0x1cb')});db[_0x3ebd('0xac')][_0x3ebd('0x113')](db[_0x3ebd('0xad')],{'as':_0x3ebd('0x1bf'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0xad')]['hasMany'](db[_0x3ebd('0xaf')],{'as':_0x3ebd('0x1c1'),'foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0xad')][_0x3ebd('0x113')](db[_0x3ebd('0xaf')],{'as':'Descriptions','foreignKey':_0x3ebd('0x1c4')});db[_0x3ebd('0xad')][_0x3ebd('0x113')](db[_0x3ebd('0xaf')],{'as':'Fields','foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db['ZendeskAccount'],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0xad')][_0x3ebd('0x125')](db[_0x3ebd('0x84')],{'through':_0x3ebd('0x1d0')});db['ZendeskField']['hasMany'](db[_0x3ebd('0xaf')],{'as':_0x3ebd('0x1c8'),'foreignKey':'SubjectId'});db[_0x3ebd('0xaf')][_0x3ebd('0x113')](db['ZendeskField'],{'as':_0x3ebd('0x1c9'),'foreignKey':'DescriptionId'});db[_0x3ebd('0xaf')][_0x3ebd('0x113')](db[_0x3ebd('0xaf')],{'as':'Field','foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0xaf')][_0x3ebd('0x14e')](db[_0x3ebd('0x8d')],{'as':_0x3ebd('0x8d'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0x3ebd('0x113')](db['FreshdeskConfiguration'],{'as':_0x3ebd('0x1bf'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c0')});db['FreshdeskConfiguration'][_0x3ebd('0x113')](db['FreshdeskField'],{'as':_0x3ebd('0x1c1'),'onDelete':'cascade','foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0xb2')][_0x3ebd('0x113')](db[_0x3ebd('0xb4')],{'as':_0x3ebd('0x1c3'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['FreshdeskConfiguration']['hasMany'](db[_0x3ebd('0xb4')],{'as':_0x3ebd('0x1bc'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0xb2')][_0x3ebd('0x14e')](db[_0x3ebd('0xb1')],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0xb2')]['belongsToMany'](db[_0x3ebd('0x84')],{'through':_0x3ebd('0x1d1')});db[_0x3ebd('0xb4')]['hasMany'](db[_0x3ebd('0xb4')],{'as':'Subject','foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0xb4')]['hasMany'](db[_0x3ebd('0xb4')],{'as':'Description','foreignKey':_0x3ebd('0x1c4')});db[_0x3ebd('0xb4')]['hasMany'](db[_0x3ebd('0xb4')],{'as':'Field','foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0xb4')][_0x3ebd('0x14e')](db[_0x3ebd('0x8d')],{'as':_0x3ebd('0x8d'),'foreignKey':_0x3ebd('0x1cb')});db[_0x3ebd('0xb6')]['hasMany'](db[_0x3ebd('0xb8')],{'as':_0x3ebd('0x1bf'),'onDelete':'cascade','foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0xb8')][_0x3ebd('0x113')](db[_0x3ebd('0xb9')],{'as':_0x3ebd('0x1c1'),'foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0xb8')][_0x3ebd('0x113')](db[_0x3ebd('0xb9')],{'as':_0x3ebd('0x1c3'),'foreignKey':_0x3ebd('0x1c4')});db['VtigerConfiguration']['hasMany'](db[_0x3ebd('0xb9')],{'as':'Fields','foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0xb8')][_0x3ebd('0x14e')](db[_0x3ebd('0xb6')],{'as':_0x3ebd('0x176'),'foreignKey':'AccountId'});db[_0x3ebd('0xb9')][_0x3ebd('0x113')](db[_0x3ebd('0xb9')],{'as':_0x3ebd('0x1c8'),'foreignKey':'SubjectId'});db[_0x3ebd('0xb9')]['hasMany'](db['VtigerField'],{'as':_0x3ebd('0x1c9'),'foreignKey':_0x3ebd('0x1c4')});db[_0x3ebd('0xb9')][_0x3ebd('0x113')](db[_0x3ebd('0xb9')],{'as':_0x3ebd('0x1ca'),'foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0xb9')][_0x3ebd('0x14e')](db[_0x3ebd('0x8d')],{'as':_0x3ebd('0x8d'),'foreignKey':'VariableId'});db[_0x3ebd('0xba')][_0x3ebd('0x113')](db[_0x3ebd('0xbc')],{'as':_0x3ebd('0x1bf'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c0')});db['ServicenowConfiguration'][_0x3ebd('0x113')](db[_0x3ebd('0xbe')],{'as':_0x3ebd('0x1c1'),'foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0xbc')][_0x3ebd('0x113')](db[_0x3ebd('0xbe')],{'as':_0x3ebd('0x1c3'),'foreignKey':'DescriptionId'});db[_0x3ebd('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x3ebd('0x1bc'),'foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0xbc')][_0x3ebd('0x14e')](db[_0x3ebd('0xba')],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0xbe')][_0x3ebd('0x113')](db[_0x3ebd('0xbe')],{'as':_0x3ebd('0x1c8'),'foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0xbe')][_0x3ebd('0x113')](db['ServicenowField'],{'as':_0x3ebd('0x1c9'),'foreignKey':_0x3ebd('0x1c4')});db['ServicenowField'][_0x3ebd('0x113')](db[_0x3ebd('0xbe')],{'as':_0x3ebd('0x1ca'),'foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0xbe')]['belongsTo'](db[_0x3ebd('0x8d')],{'as':'Variable','foreignKey':'VariableId'});db[_0x3ebd('0x1d2')][_0x3ebd('0x113')](db[_0x3ebd('0xc0')],{'as':_0x3ebd('0x1bf'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0x1d2')][_0x3ebd('0x14e')](db[_0x3ebd('0x103')],{'as':_0x3ebd('0x103'),'foreignKey':_0x3ebd('0x162')});db[_0x3ebd('0xc0')][_0x3ebd('0x113')](db['Dynamics365Field'],{'as':_0x3ebd('0x1c1'),'onDelete':'cascade','foreignKey':_0x3ebd('0x1c2')});db[_0x3ebd('0xc0')][_0x3ebd('0x113')](db['Dynamics365Field'],{'as':'Descriptions','onDelete':_0x3ebd('0x111'),'foreignKey':'DescriptionId'});db[_0x3ebd('0xc0')][_0x3ebd('0x113')](db[_0x3ebd('0xc2')],{'as':_0x3ebd('0x1bc'),'onDelete':'cascade','foreignKey':_0x3ebd('0x1c6')});db[_0x3ebd('0xc0')][_0x3ebd('0x14e')](db['Dynamics365Account'],{'as':_0x3ebd('0x176'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0x3ebd('0x113')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x3ebd('0x1c2')});db['Dynamics365Field'][_0x3ebd('0x113')](db[_0x3ebd('0xc2')],{'as':_0x3ebd('0x1c9'),'foreignKey':'DescriptionId'});db[_0x3ebd('0xc2')][_0x3ebd('0x113')](db[_0x3ebd('0xc2')],{'as':'Field','foreignKey':'FieldId'});db[_0x3ebd('0xc2')][_0x3ebd('0x14e')](db[_0x3ebd('0x8d')],{'as':_0x3ebd('0x8d'),'foreignKey':_0x3ebd('0x1cb')});db[_0x3ebd('0xc4')]['hasMany'](db[_0x3ebd('0xc6')],{'as':_0x3ebd('0x1bf'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1c0')});db[_0x3ebd('0xc6')]['hasMany'](db['FreshsalesField'],{'as':_0x3ebd('0x1c1'),'foreignKey':'SubjectId'});db[_0x3ebd('0xc6')][_0x3ebd('0x113')](db[_0x3ebd('0x1d3')],{'as':_0x3ebd('0x1c3'),'foreignKey':_0x3ebd('0x1c4')});db[_0x3ebd('0xc6')]['hasMany'](db[_0x3ebd('0x1d3')],{'as':_0x3ebd('0x1bc'),'foreignKey':_0x3ebd('0x1c6')});db['FreshsalesConfiguration'][_0x3ebd('0x14e')](db[_0x3ebd('0xc4')],{'as':'Account','foreignKey':_0x3ebd('0x1c0')});db['FreshsalesField'][_0x3ebd('0x113')](db[_0x3ebd('0x1d3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x3ebd('0x1d3')][_0x3ebd('0x113')](db[_0x3ebd('0x1d3')],{'as':_0x3ebd('0x1c9'),'foreignKey':_0x3ebd('0x1c4')});db[_0x3ebd('0x1d3')][_0x3ebd('0x113')](db[_0x3ebd('0x1d3')],{'as':'Field','foreignKey':_0x3ebd('0x1c6')});db['FreshsalesField'][_0x3ebd('0x14e')](db['Variable'],{'as':_0x3ebd('0x8d'),'foreignKey':'VariableId'});db[_0x3ebd('0xc9')]['belongsTo'](db[_0x3ebd('0x5b')],{});db[_0x3ebd('0xc9')][_0x3ebd('0x14e')](db[_0x3ebd('0xee')],{'as':_0x3ebd('0x168'),'foreignKey':_0x3ebd('0x179')});db[_0x3ebd('0xc9')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'as':'Contact','foreignKey':'ContactId'});db['ChatQueueReport']['belongsTo'](db[_0x3ebd('0x5f')],{});db['ChatQueueReport'][_0x3ebd('0x14e')](db[_0x3ebd('0x60')],{});db[_0x3ebd('0xc9')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{});db['ChatQueueReport']['belongsTo'](db[_0x3ebd('0x134')],{});db[_0x3ebd('0x1d4')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1d5')});db[_0x3ebd('0x1d4')]['belongsTo'](db[_0x3ebd('0x10e')],{'onDelete':_0x3ebd('0x111'),'foreignKey':'ToId'});db[_0x3ebd('0x14d')][_0x3ebd('0x113')](db['JscriptyQuestionReport'],{'foreignKey':_0x3ebd('0x1d6'),'onDelete':'cascade'});db[_0x3ebd('0x14d')][_0x3ebd('0x113')](db[_0x3ebd('0xcb')],{'foreignKey':_0x3ebd('0x1d6'),'onDelete':_0x3ebd('0x111')});db['SmsQueueReport'][_0x3ebd('0x14e')](db[_0x3ebd('0x140')],{});db[_0x3ebd('0xd0')][_0x3ebd('0x14e')](db[_0x3ebd('0xee')],{'as':'List','foreignKey':_0x3ebd('0x179')});db['SmsQueueReport'][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'as':_0x3ebd('0x16d'),'foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0xd0')]['belongsTo'](db[_0x3ebd('0x4f')],{});db[_0x3ebd('0xd0')][_0x3ebd('0x14e')](db[_0x3ebd('0x51')],{});db['SmsQueueReport'][_0x3ebd('0x14e')](db['User'],{});db['SmsQueueReport'][_0x3ebd('0x14e')](db[_0x3ebd('0x52')],{});db['JscriptyProject'][_0x3ebd('0x113')](db[_0x3ebd('0x14d')],{'foreignKey':'ProjectId'});db[_0x3ebd('0x1d7')][_0x3ebd('0x113')](db[_0x3ebd('0xcd')],{'foreignKey':_0x3ebd('0x1d8')});db['JscriptyProject']['hasMany'](db[_0x3ebd('0xcb')],{'foreignKey':'ProjectId'});db[_0x3ebd('0xdd')]['belongsToMany'](db['User'],{'as':_0x3ebd('0x16a'),'through':_0x3ebd('0x128')});db[_0x3ebd('0xdd')]['belongsToMany'](db['VoiceQueue'],{'through':_0x3ebd('0x105'),'as':_0x3ebd('0x1d9')});db[_0x3ebd('0xdd')][_0x3ebd('0x125')](db[_0x3ebd('0x132')],{'through':_0x3ebd('0x16c'),'as':_0x3ebd('0x133')});db[_0x3ebd('0xdd')][_0x3ebd('0x125')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x3ebd('0x135')});db['Team']['belongsToMany'](db[_0x3ebd('0x4b')],{'through':_0x3ebd('0x1da'),'as':'FaxQueues'});db[_0x3ebd('0xdd')][_0x3ebd('0x125')](db[_0x3ebd('0x52')],{'through':_0x3ebd('0x1db'),'as':_0x3ebd('0x137')});db[_0x3ebd('0xdd')][_0x3ebd('0x125')](db['OpenchannelQueue'],{'through':_0x3ebd('0x18a'),'as':'OpenchannelQueues'});db['Team'][_0x3ebd('0x125')](db[_0x3ebd('0x101')],{'through':_0x3ebd('0x1dc'),'as':_0x3ebd('0x139')});db['Team'][_0x3ebd('0x125')](db[_0x3ebd('0xf0')],{'through':_0x3ebd('0x107'),'as':_0x3ebd('0x130')});db[_0x3ebd('0xe0')][_0x3ebd('0x113')](db['CmHopper'],{'as':_0x3ebd('0x14b'),'foreignKey':_0x3ebd('0x19e')});db[_0x3ebd('0xe0')][_0x3ebd('0x113')](db[_0x3ebd('0x116')],{'as':'HopperFinals','foreignKey':'CampaignId'});db['Campaign']['hasMany'](db[_0x3ebd('0x14c')],{'as':_0x3ebd('0x1dd'),'foreignKey':_0x3ebd('0x19e')});db[_0x3ebd('0xe0')][_0x3ebd('0x113')](db[_0x3ebd('0x6b')],{'as':_0x3ebd('0x1de'),'foreignKey':_0x3ebd('0x19e')});db[_0x3ebd('0xe0')][_0x3ebd('0x14e')](db[_0x3ebd('0x26')],{'as':_0x3ebd('0x26'),'foreignKey':'TrunkId'});db[_0x3ebd('0xe0')]['belongsTo'](db[_0x3ebd('0x26')],{'as':_0x3ebd('0x150'),'foreignKey':_0x3ebd('0x151')});db[_0x3ebd('0xe0')][_0x3ebd('0x14e')](db[_0x3ebd('0x78')],{'as':_0x3ebd('0x78'),'foreignKey':_0x3ebd('0x152')});db[_0x3ebd('0xe0')][_0x3ebd('0x14e')](db[_0x3ebd('0xd8')],{'as':'SquareProject','foreignKey':_0x3ebd('0x1df')});db[_0x3ebd('0xe0')]['belongsToMany'](db[_0x3ebd('0xee')],{'as':_0x3ebd('0x126'),'through':_0x3ebd('0x1e0')});db[_0x3ebd('0xe0')][_0x3ebd('0x125')](db[_0x3ebd('0xee')],{'as':_0x3ebd('0x157'),'through':_0x3ebd('0x1e1')});db[_0x3ebd('0xe3')]['belongsTo'](db[_0x3ebd('0x62')],{'as':'ChatOfflineMessage','foreignKey':_0x3ebd('0x192')});db['MailTransferReport'][_0x3ebd('0x14e')](db[_0x3ebd('0x3e')],{});db[_0x3ebd('0xe6')][_0x3ebd('0x14e')](db[_0x3ebd('0x129')],{});db[_0x3ebd('0xe6')]['belongsTo'](db[_0x3ebd('0x38')],{'foreignKey':'FromMailAccountId','as':_0x3ebd('0x1e2')});db['MailTransferReport'][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'foreignKey':'FromUserId','as':_0x3ebd('0x1e3')});db[_0x3ebd('0xe6')]['belongsTo'](db[_0x3ebd('0x10e')],{'foreignKey':_0x3ebd('0x1e4'),'as':_0x3ebd('0x1e5')});db['MailTransferReport'][_0x3ebd('0x14e')](db[_0x3ebd('0x132')],{'foreignKey':_0x3ebd('0x1e6'),'as':'ToQueue'});db[_0x3ebd('0xe6')][_0x3ebd('0x14e')](db[_0x3ebd('0x38')],{'foreignKey':_0x3ebd('0x1e7'),'as':_0x3ebd('0x1e8')});db[_0x3ebd('0xe8')][_0x3ebd('0x14e')](db[_0x3ebd('0x60')],{});db[_0x3ebd('0xe8')][_0x3ebd('0x14e')](db[_0x3ebd('0x5f')],{});db['ChatTransferReport'][_0x3ebd('0x14e')](db['ChatWebsite'],{'foreignKey':_0x3ebd('0x1e9'),'as':_0x3ebd('0x1e2')});db[_0x3ebd('0xe8')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'foreignKey':_0x3ebd('0x1ea'),'as':'FromAgent'});db[_0x3ebd('0xe8')][_0x3ebd('0x14e')](db['User'],{'foreignKey':_0x3ebd('0x1e4'),'as':_0x3ebd('0x1e5')});db['ChatTransferReport'][_0x3ebd('0x14e')](db[_0x3ebd('0x134')],{'foreignKey':_0x3ebd('0x1eb'),'as':'ToQueue'});db[_0x3ebd('0xe8')][_0x3ebd('0x14e')](db[_0x3ebd('0x5b')],{'foreignKey':_0x3ebd('0x1ec'),'as':_0x3ebd('0x1e8')});db[_0x3ebd('0xea')]['belongsTo'](db[_0x3ebd('0x49')],{});db['FaxTransferReport'][_0x3ebd('0x14e')](db['FaxInteraction'],{});db[_0x3ebd('0xea')]['belongsTo'](db[_0x3ebd('0x44')],{'foreignKey':'FromFaxAccountId','as':_0x3ebd('0x1e2')});db[_0x3ebd('0xea')][_0x3ebd('0x14e')](db['User'],{'foreignKey':_0x3ebd('0x1ea'),'as':_0x3ebd('0x1e3')});db[_0x3ebd('0xea')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'foreignKey':_0x3ebd('0x1e4'),'as':'ToAgent'});db[_0x3ebd('0xea')][_0x3ebd('0x14e')](db[_0x3ebd('0x4b')],{'foreignKey':_0x3ebd('0x1ed'),'as':'ToQueue'});db[_0x3ebd('0xea')][_0x3ebd('0x14e')](db[_0x3ebd('0x44')],{'foreignKey':'ToFaxAccountId','as':_0x3ebd('0x1e8')});db[_0x3ebd('0xec')][_0x3ebd('0x14e')](db[_0x3ebd('0x58')],{});db['OpenchannelTransferReport'][_0x3ebd('0x14e')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x3ebd('0x14e')](db[_0x3ebd('0x53')],{'foreignKey':_0x3ebd('0x1ee'),'as':_0x3ebd('0x1e2')});db['OpenchannelTransferReport']['belongsTo'](db[_0x3ebd('0x10e')],{'foreignKey':'FromUserId','as':_0x3ebd('0x1e3')});db[_0x3ebd('0xec')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'foreignKey':_0x3ebd('0x1e4'),'as':'ToAgent'});db[_0x3ebd('0xec')][_0x3ebd('0x14e')](db[_0x3ebd('0x5a')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x3ebd('0xec')][_0x3ebd('0x14e')](db[_0x3ebd('0x53')],{'foreignKey':_0x3ebd('0x1ef'),'as':_0x3ebd('0x1e8')});db[_0x3ebd('0xed')][_0x3ebd('0x14e')](db[_0x3ebd('0x51')],{});db[_0x3ebd('0xed')][_0x3ebd('0x14e')](db[_0x3ebd('0x4f')],{});db[_0x3ebd('0xed')]['belongsTo'](db[_0x3ebd('0x140')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0x3ebd('0xed')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'foreignKey':_0x3ebd('0x1ea'),'as':_0x3ebd('0x1e3')});db[_0x3ebd('0xed')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'foreignKey':_0x3ebd('0x1e4'),'as':_0x3ebd('0x1e5')});db[_0x3ebd('0xed')]['belongsTo'](db[_0x3ebd('0x52')],{'foreignKey':'ToSmsQueueId','as':_0x3ebd('0x1f0')});db[_0x3ebd('0xed')][_0x3ebd('0x14e')](db[_0x3ebd('0x140')],{'foreignKey':_0x3ebd('0x1f1'),'as':'ToAccount'});db[_0x3ebd('0xee')][_0x3ebd('0x113')](db[_0x3ebd('0x75')],{'as':'Dispositions','foreignKey':'ListId','onDelete':_0x3ebd('0x111')});db['CmList']['hasMany'](db[_0x3ebd('0x6e')],{'as':_0x3ebd('0x1f2'),'foreignKey':_0x3ebd('0x179')});db[_0x3ebd('0xee')][_0x3ebd('0x113')](db[_0x3ebd('0x67')],{'as':_0x3ebd('0x123'),'onDelete':'cascade','foreignKey':'ListId'});db['CmList'][_0x3ebd('0x113')](db['CmHopperFinal'],{'as':_0x3ebd('0x117'),'foreignKey':'ListId'});db[_0x3ebd('0xee')][_0x3ebd('0x113')](db[_0x3ebd('0x14c')],{'as':_0x3ebd('0x118'),'foreignKey':_0x3ebd('0x179')});db[_0x3ebd('0xee')]['hasMany'](db[_0x3ebd('0x119')],{'as':_0x3ebd('0x119'),'foreignKey':_0x3ebd('0x179')});db['CmList'][_0x3ebd('0x125')](db[_0x3ebd('0x19')],{'as':_0x3ebd('0x1f3'),'through':_0x3ebd('0x155')});db[_0x3ebd('0xee')][_0x3ebd('0x125')](db['User'],{'as':_0x3ebd('0x16a'),'through':_0x3ebd('0x127')});db[_0x3ebd('0xf0')][_0x3ebd('0x113')](db['VoiceExtension'],{'as':_0x3ebd('0x1a9'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0xf0')][_0x3ebd('0x125')](db[_0x3ebd('0x10e')],{'as':'Agents','through':'UserVoicePrefix'});db[_0x3ebd('0xf0')][_0x3ebd('0x125')](db[_0x3ebd('0xdd')],{'through':_0x3ebd('0x107'),'as':_0x3ebd('0x156')});db[_0x3ebd('0xf1')][_0x3ebd('0x113')](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x171'),'foreignKey':_0x3ebd('0x120')});db[_0x3ebd('0xf1')]['hasMany'](db[_0x3ebd('0xf3')],{'as':_0x3ebd('0x1f4'),'foreignKey':_0x3ebd('0x120'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0xf3')][_0x3ebd('0x113')](db[_0x3ebd('0xf4')],{'as':_0x3ebd('0x1f5'),'foreignKey':'sectionId','onDelete':_0x3ebd('0x111')});db[_0x3ebd('0xf7')]['hasMany'](db[_0x3ebd('0x75')],{'as':_0x3ebd('0x165'),'foreignKey':_0x3ebd('0x1f6'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0xf7')][_0x3ebd('0x113')](db[_0x3ebd('0x73')],{'as':_0x3ebd('0x17b'),'foreignKey':_0x3ebd('0x1f6')});db['WhatsappAccount'][_0x3ebd('0x113')](db[_0x3ebd('0x1f7')],{'as':'Messages','foreignKey':_0x3ebd('0x1f6')});db[_0x3ebd('0xf7')][_0x3ebd('0x113')](db['WhatsappInteraction'],{'as':'Interactions'});db[_0x3ebd('0xf7')][_0x3ebd('0x113')](db[_0x3ebd('0xf9')],{'as':_0x3ebd('0x145'),'foreignKey':_0x3ebd('0x1f6'),'onDelete':_0x3ebd('0x111')});db[_0x3ebd('0xf7')]['belongsTo'](db[_0x3ebd('0xee')],{'as':_0x3ebd('0x168'),'foreignKey':'ListId'});db['WhatsappAccount']['belongsTo'](db[_0x3ebd('0x7a')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount']['belongsToMany'](db[_0x3ebd('0x10e')],{'as':'Agents','through':_0x3ebd('0x143')});db[_0x3ebd('0xf9')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'onDelete':_0x3ebd('0x160')});db['WhatsappApplication'][_0x3ebd('0x14e')](db[_0x3ebd('0x101')],{'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0xf9')][_0x3ebd('0x14e')](db[_0x3ebd('0xf7')],{'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0xf9')][_0x3ebd('0x14e')](db[_0x3ebd('0x78')],{'onDelete':_0x3ebd('0x160'),'foreignKey':_0x3ebd('0x152')});db[_0x3ebd('0xf9')][_0x3ebd('0x14e')](db[_0x3ebd('0x84')],{'onDelete':_0x3ebd('0x160'),'foreignKey':_0x3ebd('0x17e')});db[_0x3ebd('0xfb')][_0x3ebd('0x113')](db[_0x3ebd('0x1f7')],{'as':_0x3ebd('0x15a'),'onDelete':_0x3ebd('0x111'),'foreignKey':_0x3ebd('0x1f8')});db[_0x3ebd('0xfb')][_0x3ebd('0x14e')](db[_0x3ebd('0xf7')],{'as':_0x3ebd('0x176'),'foreignKey':_0x3ebd('0x1f6')});db[_0x3ebd('0xfb')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'as':_0x3ebd('0x16d'),'foreignKey':_0x3ebd('0x15e')});db['WhatsappInteraction'][_0x3ebd('0x14e')](db['User'],{'as':_0x3ebd('0x16e'),'foreignKey':'UserId'});db[_0x3ebd('0xfb')][_0x3ebd('0x125')](db['Tag'],{'through':_0x3ebd('0x1af'),'as':_0x3ebd('0x185')});db[_0x3ebd('0xfb')][_0x3ebd('0x125')](db[_0x3ebd('0x84')],{'through':'whatsapp_interaction_has_tags','as':_0x3ebd('0x170')});db[_0x3ebd('0xfb')][_0x3ebd('0x125')](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x171'),'through':_0x3ebd('0x12e'),'foreignKey':'WhatsappInteractionId'});db[_0x3ebd('0x1f7')][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x10e')});db[_0x3ebd('0x1f7')][_0x3ebd('0x14e')](db[_0x3ebd('0x67')],{'onDelete':_0x3ebd('0x111'),'as':_0x3ebd('0x16d')});db[_0x3ebd('0x1f7')]['belongsTo'](db[_0x3ebd('0xfb')],{'onDelete':_0x3ebd('0x111'),'as':_0x3ebd('0x175'),'foreignKey':'WhatsappInteractionId'});db[_0x3ebd('0x1f7')][_0x3ebd('0x14e')](db[_0x3ebd('0xf7')],{'as':'Account','foreignKey':_0x3ebd('0x1f6')});db[_0x3ebd('0xfe')][_0x3ebd('0x14e')](db['WhatsappAccount'],{});db[_0x3ebd('0xfe')][_0x3ebd('0x14e')](db['CmList'],{'as':'List','foreignKey':_0x3ebd('0x179')});db['WhatsappQueueReport'][_0x3ebd('0x14e')](db['CmContact'],{'as':_0x3ebd('0x16d'),'foreignKey':_0x3ebd('0x15e')});db[_0x3ebd('0xfe')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x3ebd('0xfe')]['belongsTo'](db[_0x3ebd('0x101')],{});db[_0x3ebd('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x3ebd('0x10e')],{});db[_0x3ebd('0x100')][_0x3ebd('0x14e')](db[_0x3ebd('0x1f7')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x3ebd('0xfb')],{});db[_0x3ebd('0x100')][_0x3ebd('0x14e')](db[_0x3ebd('0xf7')],{'foreignKey':_0x3ebd('0x1f9'),'as':_0x3ebd('0x1e2')});db[_0x3ebd('0x100')][_0x3ebd('0x14e')](db['WhatsappAccount'],{'foreignKey':_0x3ebd('0x1fa'),'as':'ToAccount'});db[_0x3ebd('0x100')][_0x3ebd('0x14e')](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':'ToQueue'});db['WhatsappTransferReport'][_0x3ebd('0x14e')](db[_0x3ebd('0x10e')],{'foreignKey':'FromUserId','as':_0x3ebd('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x3ebd('0x1e4'),'as':'ToAgent'});db['WhatsappQueue']['belongsToMany'](db[_0x3ebd('0x10e')],{'as':_0x3ebd('0x16a'),'through':_0x3ebd('0x34'),'foreignKey':'WhatsappQueueId'});db[_0x3ebd('0x101')][_0x3ebd('0x125')](db['Team'],{'through':_0x3ebd('0x1dc'),'as':_0x3ebd('0x156')});db['UserSetting'][_0x3ebd('0x14e')](db['User'],{'as':_0x3ebd('0x1fb'),'foreignKey':'UserId','onDelete':_0x3ebd('0x111'),'hooks':!![]});db[_0x3ebd('0x103')][_0x3ebd('0x10f')](db['Dynamics365Account'],{'as':_0x3ebd('0x1d2'),'onDelete':_0x3ebd('0x160')});db['CloudProvider'][_0x3ebd('0x10f')](db[_0x3ebd('0x35')],{'as':_0x3ebd('0x163'),'onDelete':_0x3ebd('0x160')});db[_0x3ebd('0x103')][_0x3ebd('0x10f')](db[_0x3ebd('0x161')],{'as':_0x3ebd('0x164'),'onDelete':_0x3ebd('0x160')});module[_0x3ebd('0x1fc')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xd21b=['user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueue','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','WhatsappQueue','WhatsappQueues','ChatWebsite','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','VoiceMusicOnHold','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','belongsTo','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','QueueCalls','uniqueid','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Applications','TemplateId','team_has_mail_queues','Account','CmContact','Contact','Owner','mail_interaction_has_tags','Tag','ThroughTags','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','List','ListId','Dashboard','FaxAccountId','Interactions','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','mandatoryDispositionPause','SmsQueue','SmsMessage','SmsInteractionId','Tags','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','ChatMessage','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CompanyId','Phones','Hoppers','Company','cm_contact_has_tags','CampaignId','OwnerId','All','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','CmContactHasItem','ItemType','ItemTypeId','Hopper','CmHopperId','CmContactId','AllCondition','AnyConditions','AnyCondition','Action','AnalyticCustomReport','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','int_desk_configuration_has_tags','Description','VtigerConfiguration','VtigerField','ServicenowConfiguration','FreshsalesConfiguration','ChatQueueReport','FromId','ToId','JscriptyAnswerReport','SessionId','ProjectId','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToQueue','ToAccount','FromChatWebsiteId','FromAgent','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','HopperHistory','Queues','VoicePrefix','Resources','sectionId','WhatsappAccountId','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','lodash','jstz','determine','defaultsDeep','xcall','127.0.0.1','mysql','name','utf8','sequelizeHistory','xC@LL1234','utf8_general_ci','sequelize','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/smsTransferReport/smsTransferReport.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','WhatsappApplication','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','hasOne','VoiceMail','cascade','UserSetting','userSetting','hasMany','UserId','UserVoiceQueueRt','Extensions','CmHopperFinal','HopperFinals','OpenchannelInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteraction','WhatsappInteractions','CmHopper','SET\x20NULL','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions'];(function(_0x5615ca,_0x29e5a7){var _0x5b28a2=function(_0x4bdb0d){while(--_0x4bdb0d){_0x5615ca['push'](_0x5615ca['shift']());}};_0x5b28a2(++_0x29e5a7);}(_0xd21b,0xcf));var _0xbd21=function(_0x7f6e9,_0x2cf772){_0x7f6e9=_0x7f6e9-0x0;var _0x5a3124=_0xd21b[_0x7f6e9];return _0x5a3124;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0xbd21('0x0'));var jstz=require(_0xbd21('0x1'));var timezone=jstz[_0xbd21('0x2')]();config['sequelize']=_[_0xbd21('0x3')](config['sequelize'],{'database':'motion2','username':_0xbd21('0x4'),'password':'xC@LL1234','options':{'host':_0xbd21('0x5'),'port':0xcea,'dialect':_0xbd21('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xbd21('0x7')](),'define':{'charset':_0xbd21('0x8'),'collate':'utf8_general_ci'}}});config[_0xbd21('0x9')]=_[_0xbd21('0x3')](config['sequelizeHistory'],{'database':'motion2','username':_0xbd21('0x4'),'password':_0xbd21('0xa'),'options':{'host':_0xbd21('0x5'),'port':0xcea,'dialect':_0xbd21('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xbd21('0x8'),'collate':_0xbd21('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbd21('0xc')]['database'],config[_0xbd21('0xc')]['username'],config[_0xbd21('0xc')]['password'],config['sequelize'][_0xbd21('0xd')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbd21('0x9')]['database'],config['sequelizeHistory'][_0xbd21('0xe')],config[_0xbd21('0x9')]['password'],config[_0xbd21('0x9')]['options'])};db[_0xbd21('0xf')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x11'));db[_0xbd21('0x12')]=db[_0xbd21('0xc')]['import'](_0xbd21('0x13'));db['VoiceContext']=db['sequelize']['import'](_0xbd21('0x14'));db[_0xbd21('0x15')]=db[_0xbd21('0xc')]['import'](_0xbd21('0x16'));db['VoiceMusicOnHold']=db['sequelize']['import'](_0xbd21('0x17'));db[_0xbd21('0x18')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x19'));db[_0xbd21('0x1a')]=db[_0xbd21('0xc')]['import'](_0xbd21('0x1b'));db['ScreenRecording']=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x1c'));db['VoiceMail']=db[_0xbd21('0xc')]['import']('../api/voiceMail/voiceMail.model');db[_0xbd21('0x1d')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x1e'));db[_0xbd21('0x1f')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x20'));db[_0xbd21('0x21')]=db[_0xbd21('0xc')]['import'](_0xbd21('0x22'));db[_0xbd21('0x23')]=db['sequelize'][_0xbd21('0x10')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xbd21('0x24')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x25'));db[_0xbd21('0x26')]=db[_0xbd21('0xc')]['import'](_0xbd21('0x27'));db[_0xbd21('0x28')]=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/trunk/trunk.model');db[_0xbd21('0x29')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x2a'));db['UserVoiceQueueRt']=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x2b'));db['UserVoiceQueue']=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x2c'));db[_0xbd21('0x2d')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x2e'));db[_0xbd21('0x2f')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x30'));db[_0xbd21('0x31')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x32'));db['UserSmsQueue']=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x33'));db['UserOpenchannelQueue']=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x34'));db[_0xbd21('0x35')]=db[_0xbd21('0xc')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xbd21('0x36')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x37'));db[_0xbd21('0x38')]=db[_0xbd21('0xc')]['import'](_0xbd21('0x39'));db[_0xbd21('0x3a')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x3b'));db['MailQueue']=db[_0xbd21('0xc')]['import']('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x3c'));db[_0xbd21('0x3d')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x3e'));db[_0xbd21('0x3f')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x40'));db[_0xbd21('0x41')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x42'));db['Dashboard']=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x43'));db[_0xbd21('0x44')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x45'));db[_0xbd21('0x46')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x47'));db[_0xbd21('0x48')]=db['sequelize']['import'](_0xbd21('0x49'));db[_0xbd21('0x4a')]=db[_0xbd21('0xc')]['import'](_0xbd21('0x4b'));db[_0xbd21('0x4c')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x4d'));db[_0xbd21('0x4e')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x4f'));db[_0xbd21('0x50')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x51'));db['SmsAccount']=db['sequelize'][_0xbd21('0x10')]('../api/smsAccount/smsAccount.model');db[_0xbd21('0x52')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x53'));db[_0xbd21('0x54')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x55'));db['SmsMessage']=db[_0xbd21('0xc')]['import'](_0xbd21('0x56'));db['SmsQueue']=db['sequelize']['import']('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/openchannelAccount/openchannelAccount.model');db[_0xbd21('0x57')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x58'));db[_0xbd21('0x59')]=db[_0xbd21('0xc')]['import'](_0xbd21('0x5a'));db[_0xbd21('0x5b')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x5c'));db[_0xbd21('0x5d')]=db[_0xbd21('0xc')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x5e'));db[_0xbd21('0x5f')]=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xbd21('0x60')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x61'));db[_0xbd21('0x62')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x63'));db['ChatMessage']=db[_0xbd21('0xc')]['import']('../api/chatMessage/chatMessage.model');db[_0xbd21('0x64')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x65'));db[_0xbd21('0x66')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x67'));db[_0xbd21('0x68')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x69'));db[_0xbd21('0x6a')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x6b'));db[_0xbd21('0x6c')]=db[_0xbd21('0xc')]['import']('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0xbd21('0xc')]['import'](_0xbd21('0x6d'));db['CmHopper']=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x6e'));db[_0xbd21('0x6f')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x70'));db['CmHopperFinal']=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x71'));db[_0xbd21('0x72')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x73'));db[_0xbd21('0x74')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x75'));db[_0xbd21('0x76')]=db['sequelize'][_0xbd21('0x10')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/action/action.model');db[_0xbd21('0x77')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x78'));db[_0xbd21('0x79')]=db[_0xbd21('0xc')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0xbd21('0x7a')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x7b'));db[_0xbd21('0x7c')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x7d'));db[_0xbd21('0x7e')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x7f'));db[_0xbd21('0x80')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x81'));db[_0xbd21('0x82')]=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/cdr/cdr.model');db[_0xbd21('0x83')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x84'));db[_0xbd21('0x85')]=db['sequelize']['import'](_0xbd21('0x86'));db[_0xbd21('0x87')]=db['sequelize'][_0xbd21('0x10')]('../api/sound/sound.model');db['Tag']=db[_0xbd21('0xc')]['import'](_0xbd21('0x88'));db[_0xbd21('0x89')]=db[_0xbd21('0xc')]['import'](_0xbd21('0x8a'));db['CmContactHasItem']=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x8b'));db[_0xbd21('0x8c')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x8d'));db[_0xbd21('0x8e')]=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/template/template.model');db[_0xbd21('0x8f')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x90'));db[_0xbd21('0x91')]=db[_0xbd21('0xc')]['import']('../api/variable/variable.model');db[_0xbd21('0x92')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x93'));db[_0xbd21('0x94')]=db[_0xbd21('0xc')]['import'](_0xbd21('0x95'));db['AnalyticCustomReport']=db['sequelize']['import'](_0xbd21('0x96'));db[_0xbd21('0x97')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x98'));db['AnalyticExtractedReport']=db['sequelize']['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xbd21('0x99')]=db['sequelize'][_0xbd21('0x10')]('../api/analyticMetric/analyticMetric.model');db[_0xbd21('0x9a')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x9b'));db[_0xbd21('0x9c')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x9d'));db[_0xbd21('0x9e')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x9f'));db['SalesforceConfiguration']=db[_0xbd21('0xc')]['import'](_0xbd21('0xa0'));db[_0xbd21('0xa1')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0xa2'));db[_0xbd21('0xa3')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xa4'));db[_0xbd21('0xa5')]=db[_0xbd21('0xc')]['import'](_0xbd21('0xa6'));db[_0xbd21('0xa7')]=db[_0xbd21('0xc')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0xbd21('0xa8')]=db[_0xbd21('0xc')]['import'](_0xbd21('0xa9'));db[_0xbd21('0xaa')]=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xbd21('0xab')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0xac'));db[_0xbd21('0xad')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0xae'));db[_0xbd21('0xaf')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xb0'));db[_0xbd21('0xb1')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xb2'));db[_0xbd21('0xb3')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xb4'));db[_0xbd21('0xb5')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0xb6'));db[_0xbd21('0xb7')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xb8'));db[_0xbd21('0xb9')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xba'));db[_0xbd21('0xbb')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xbc'));db[_0xbd21('0xbd')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xbe'));db[_0xbd21('0xbf')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xc0'));db['VtigerConfiguration']=db[_0xbd21('0xc')]['import'](_0xbd21('0xc1'));db['VtigerField']=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/intVtigerField/intVtigerField.model');db[_0xbd21('0xc2')]=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xbd21('0xc3')]=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/intServicenowField/intServicenowField.model');db[_0xbd21('0xc4')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xc5'));db[_0xbd21('0xc6')]=db[_0xbd21('0xc')]['import'](_0xbd21('0xc7'));db[_0xbd21('0xc8')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xc9'));db[_0xbd21('0xca')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xcb'));db['FreshsalesConfiguration']=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xcc'));db[_0xbd21('0xcd')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0xce'));db[_0xbd21('0x92')]=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/integration/integration.model');db[_0xbd21('0xcf')]=db[_0xbd21('0xc')]['import']('../api/network/network.model');db['ChatQueueReport']=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xd0'));db[_0xbd21('0xd1')]=db[_0xbd21('0xc')]['import'](_0xbd21('0xd2'));db['JscriptyAnswerReport']=db[_0xbd21('0xc')]['import'](_0xbd21('0xd3'));db[_0xbd21('0xd4')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xd5'));db[_0xbd21('0xd6')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xd7'));db[_0xbd21('0xd8')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xd9'));db['SquareReport']=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xbd21('0xc')]['import'](_0xbd21('0xda'));db[_0xbd21('0xdb')]=db[_0xbd21('0xc')]['import'](_0xbd21('0xdc'));db[_0xbd21('0xdd')]=db['sequelize']['import'](_0xbd21('0xde'));db[_0xbd21('0xdf')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xe0'));db[_0xbd21('0xe1')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0xe2'));db[_0xbd21('0xe3')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0xe4'));db[_0xbd21('0xe5')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xe6'));db[_0xbd21('0xe7')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xe8'));db[_0xbd21('0xe9')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xea'));db[_0xbd21('0xeb')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xec'));db[_0xbd21('0xed')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xee'));db[_0xbd21('0xef')]=db['sequelize']['import'](_0xbd21('0xf0'));db['Plugin']=db['sequelize'][_0xbd21('0x10')](_0xbd21('0xf1'));db['MailTransferReport']=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xf2'));db[_0xbd21('0xf3')]=db['sequelize'][_0xbd21('0x10')]('../api/chatTransferReport/chatTransferReport.model');db[_0xbd21('0xf4')]=db[_0xbd21('0xc')]['import'](_0xbd21('0xf5'));db['OpenchannelTransferReport']=db['sequelize'][_0xbd21('0x10')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db['sequelize'][_0xbd21('0x10')](_0xbd21('0xf6'));db['CmList']=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xf7'));db[_0xbd21('0xf8')]=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/userProfile/userProfile.model');db[_0xbd21('0xf9')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0xfa'));db[_0xbd21('0xfb')]=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/userProfileResource/userProfileResource.model');db[_0xbd21('0xfc')]=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/whatsappAccount/whatsappAccount.model');db[_0xbd21('0xfd')]=db['sequelize']['import']('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db['sequelize'][_0xbd21('0x10')](_0xbd21('0xfe'));db[_0xbd21('0xff')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x100'));db[_0xbd21('0x101')]=db['sequelize'][_0xbd21('0x10')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db['sequelize']['import'](_0xbd21('0x102'));db['WhatsappQueue']=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x103'));db[_0xbd21('0x104')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x105'));db['TeamVoiceQueue']=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xbd21('0x106')]=db[_0xbd21('0xc')][_0xbd21('0x10')](_0xbd21('0x107'));db[_0xbd21('0x108')]=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x109'));db['UserSetting']=db['sequelize'][_0xbd21('0x10')](_0xbd21('0x10a'));db['MailInteractionHasTag']=db[_0xbd21('0xc')][_0xbd21('0x10')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db['User'][_0xbd21('0x10b')](db[_0xbd21('0x10c')],{'as':_0xbd21('0x10c'),'onDelete':_0xbd21('0x10d'),'foreignKey':'UserId'});db[_0xbd21('0xf')][_0xbd21('0x10b')](db[_0xbd21('0x10e')],{'as':_0xbd21('0x10f'),'onDelete':'cascade','foreignKey':'UserId'});db['User'][_0xbd21('0x110')](db[_0xbd21('0x1a')],{'as':'Recordings','foreignKey':_0xbd21('0x111')});db['User'][_0xbd21('0x110')](db[_0xbd21('0x112')],{'as':'VoiceQueuesRt','foreignKey':_0xbd21('0x111')});db[_0xbd21('0xf')][_0xbd21('0x110')](db[_0xbd21('0x15')],{'as':_0xbd21('0x113'),'onDelete':_0xbd21('0x10d'),'hooks':!![]});db['User'][_0xbd21('0x110')](db[_0xbd21('0x114')],{'as':_0xbd21('0x115'),'foreignKey':_0xbd21('0x111')});db[_0xbd21('0xf')]['hasMany'](db[_0xbd21('0x72')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xbd21('0xf')][_0xbd21('0x110')](db['ReportAgentPreview'],{'as':_0xbd21('0x74'),'foreignKey':'UserId'});db[_0xbd21('0xf')]['hasMany'](db[_0xbd21('0x59')],{'as':_0xbd21('0x116'),'foreignKey':_0xbd21('0x111')});db[_0xbd21('0xf')][_0xbd21('0x110')](db[_0xbd21('0x62')],{'as':'ChatInteractions','foreignKey':_0xbd21('0x111')});db[_0xbd21('0xf')]['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0xbd21('0xf')][_0xbd21('0x110')](db['FaxInteraction'],{'as':_0xbd21('0x117'),'foreignKey':_0xbd21('0x111')});db[_0xbd21('0xf')]['hasMany'](db[_0xbd21('0x118')],{'as':_0xbd21('0x119'),'foreignKey':_0xbd21('0x111')});db[_0xbd21('0xf')][_0xbd21('0x110')](db[_0xbd21('0x11a')],{'as':_0xbd21('0x11b'),'foreignKey':_0xbd21('0x111')});db['User'][_0xbd21('0x110')](db['UserNotification'],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0xbd21('0xf')][_0xbd21('0x110')](db[_0xbd21('0x11c')],{'as':'Hoppers','foreignKey':_0xbd21('0x111'),'onDelete':_0xbd21('0x11d')});db['User']['belongsTo'](db[_0xbd21('0xf8')],{'as':'UserProfile','foreignKey':_0xbd21('0x11e')});db[_0xbd21('0xf')][_0xbd21('0x11f')](db[_0xbd21('0x68')],{'as':_0xbd21('0x120'),'through':_0xbd21('0x121')});db[_0xbd21('0xf')][_0xbd21('0x11f')](db['CmContact'],{'as':_0xbd21('0x122'),'through':_0xbd21('0x123')});db['User'][_0xbd21('0x11f')](db[_0xbd21('0x124')],{'as':_0xbd21('0x125'),'through':_0xbd21('0x126')});db['User'][_0xbd21('0x11f')](db[_0xbd21('0xe7')],{'through':_0xbd21('0x127')});db[_0xbd21('0xf')][_0xbd21('0x11f')](db[_0xbd21('0x118')],{'as':'MailInteractions','through':_0xbd21('0x128')});db[_0xbd21('0xf')][_0xbd21('0x11f')](db['ChatInteraction'],{'as':_0xbd21('0x129'),'through':_0xbd21('0x12a')});db['User'][_0xbd21('0x11f')](db[_0xbd21('0x4a')],{'as':_0xbd21('0x117'),'through':_0xbd21('0x12b')});db['User'][_0xbd21('0x11f')](db[_0xbd21('0x54')],{'as':_0xbd21('0x12c'),'through':_0xbd21('0x12d')});db[_0xbd21('0xf')]['belongsToMany'](db[_0xbd21('0x59')],{'as':_0xbd21('0x116'),'through':_0xbd21('0x12e')});db[_0xbd21('0xf')][_0xbd21('0x11f')](db[_0xbd21('0x11a')],{'as':_0xbd21('0x11b'),'through':_0xbd21('0x12f')});db['User'][_0xbd21('0x11f')](db[_0xbd21('0x18')],{'as':_0xbd21('0x130'),'through':'UserVoiceQueue','required':![]});db[_0xbd21('0xf')][_0xbd21('0x11f')](db['VoicePrefix'],{'as':_0xbd21('0x131'),'through':_0xbd21('0x108'),'required':![]});db[_0xbd21('0xf')]['belongsToMany'](db[_0xbd21('0x132')],{'as':'MailQueues','through':_0xbd21('0x2f'),'required':![]});db[_0xbd21('0xf')]['belongsToMany'](db[_0xbd21('0x66')],{'as':_0xbd21('0x133'),'through':_0xbd21('0x2d'),'required':![],'hooks':!![]});db[_0xbd21('0xf')][_0xbd21('0x11f')](db[_0xbd21('0x4e')],{'as':_0xbd21('0x134'),'through':_0xbd21('0x31'),'required':![]});db['User']['belongsToMany'](db['SmsQueue'],{'as':_0xbd21('0x135'),'through':_0xbd21('0x136'),'required':![]});db[_0xbd21('0xf')][_0xbd21('0x11f')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xbd21('0xf')][_0xbd21('0x11f')](db[_0xbd21('0x137')],{'as':_0xbd21('0x138'),'through':_0xbd21('0x35'),'required':![]});db[_0xbd21('0xf')][_0xbd21('0x11f')](db[_0xbd21('0x124')],{'through':'cm_user_has_lists'});db[_0xbd21('0xf')][_0xbd21('0x11f')](db[_0xbd21('0x139')],{'as':_0xbd21('0x13a'),'through':'user_has_chat_websites'});db[_0xbd21('0xf')]['belongsToMany'](db[_0xbd21('0x46')],{'as':_0xbd21('0x13b'),'through':_0xbd21('0x13c')});db[_0xbd21('0xf')][_0xbd21('0x11f')](db['MailAccount'],{'as':_0xbd21('0x13d'),'through':_0xbd21('0x13e')});db['User'][_0xbd21('0x11f')](db[_0xbd21('0x13f')],{'as':'OpenchannelAccounts','through':_0xbd21('0x140')});db[_0xbd21('0xf')][_0xbd21('0x11f')](db[_0xbd21('0x141')],{'as':_0xbd21('0x142'),'through':_0xbd21('0x143')});db['User'][_0xbd21('0x11f')](db[_0xbd21('0x144')],{'as':_0xbd21('0x145'),'through':_0xbd21('0x146')});db[_0xbd21('0x12')][_0xbd21('0x110')](db[_0xbd21('0x15')],{'as':_0xbd21('0x147'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db['VoiceContext'][_0xbd21('0x110')](db[_0xbd21('0x15')],{'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x15')][_0xbd21('0x110')](db[_0xbd21('0x15')],{'as':'Applications','onDelete':_0xbd21('0x10d')});db[_0xbd21('0x148')]['belongsToMany'](db['Sound'],{'as':'Sounds','through':_0xbd21('0x149')});db[_0xbd21('0x18')][_0xbd21('0x110')](db[_0xbd21('0x112')],{'as':_0xbd21('0x14a'),'foreignKey':_0xbd21('0x14b')});db[_0xbd21('0x18')][_0xbd21('0x110')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xbd21('0x14b')});db[_0xbd21('0x18')][_0xbd21('0x110')](db[_0xbd21('0x114')],{'as':'HopperFinals','foreignKey':_0xbd21('0x14b')});db[_0xbd21('0x18')][_0xbd21('0x110')](db[_0xbd21('0x72')],{'as':_0xbd21('0x14c'),'foreignKey':_0xbd21('0x14b')});db[_0xbd21('0x18')][_0xbd21('0x110')](db[_0xbd21('0x74')],{'as':_0xbd21('0x74'),'foreignKey':_0xbd21('0x14b')});db[_0xbd21('0x18')]['hasMany'](db[_0xbd21('0x6f')],{'as':_0xbd21('0x14d'),'foreignKey':_0xbd21('0x14b')});db[_0xbd21('0x18')]['hasMany'](db[_0xbd21('0xd6')],{'as':_0xbd21('0x14e'),'foreignKey':_0xbd21('0x14b')});db[_0xbd21('0x18')]['belongsTo'](db[_0xbd21('0x28')],{'as':'Trunk','foreignKey':_0xbd21('0x14f')});db[_0xbd21('0x18')]['belongsTo'](db[_0xbd21('0x28')],{'as':_0xbd21('0x150'),'foreignKey':_0xbd21('0x151')});db[_0xbd21('0x18')][_0xbd21('0x152')](db[_0xbd21('0x7e')],{'as':_0xbd21('0x7e'),'foreignKey':_0xbd21('0x153')});db[_0xbd21('0x18')][_0xbd21('0x152')](db[_0xbd21('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0xbd21('0x154')});db['VoiceQueue']['belongsToMany'](db[_0xbd21('0x124')],{'as':_0xbd21('0x125'),'through':_0xbd21('0x155')});db['VoiceQueue'][_0xbd21('0x11f')](db['User'],{'as':_0xbd21('0x156'),'through':'UserVoiceQueue'});db[_0xbd21('0x18')]['belongsToMany'](db['Team'],{'as':_0xbd21('0x157'),'through':_0xbd21('0x158')});db['VoiceQueue'][_0xbd21('0x11f')](db['CmList'],{'as':'BlackLists','through':_0xbd21('0x159')});db[_0xbd21('0x1a')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'as':'User','foreignKey':_0xbd21('0x111')});db[_0xbd21('0x15a')]['belongsTo'](db['User'],{'as':_0xbd21('0xf'),'foreignKey':_0xbd21('0x111')});db['VoiceMail'][_0xbd21('0x110')](db['VoiceMailMessage'],{'as':_0xbd21('0x15b'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x15c'),'sourceKey':'mailbox'});db[_0xbd21('0x1d')]['belongsTo'](db[_0xbd21('0x10c')],{'foreignKey':_0xbd21('0x15c'),'targetKey':'mailbox'});db[_0xbd21('0x1f')][_0xbd21('0x110')](db[_0xbd21('0x24')],{'as':_0xbd21('0x15d'),'foreignKey':_0xbd21('0x15e'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0xbd21('0x23')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xbd21('0x1f')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'as':'User','foreignKey':'UserId'});db[_0xbd21('0x1f')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x36')][_0xbd21('0x152')](db[_0xbd21('0x3a')],{'as':_0xbd21('0x3a'),'foreignKey':_0xbd21('0x160')});db[_0xbd21('0x36')]['belongsTo'](db['CloudProvider'],{'as':_0xbd21('0x104'),'foreignKey':_0xbd21('0x161'),'onDelete':'restrict'});db[_0xbd21('0x38')]['belongsTo'](db['MailAccount'],{'as':_0xbd21('0x3a'),'foreignKey':_0xbd21('0x160')});db[_0xbd21('0x38')]['belongsTo'](db[_0xbd21('0x104')],{'as':_0xbd21('0x104'),'foreignKey':'CloudProviderId','onDelete':_0xbd21('0x162')});db['MailAccount'][_0xbd21('0x10b')](db[_0xbd21('0x36')],{'as':_0xbd21('0x163'),'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x3a')][_0xbd21('0x10b')](db[_0xbd21('0x38')],{'as':_0xbd21('0x164'),'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x3a')][_0xbd21('0x110')](db['Disposition'],{'as':_0xbd21('0x165'),'foreignKey':'MailAccountId','onDelete':_0xbd21('0x10d')});db['MailAccount'][_0xbd21('0x110')](db[_0xbd21('0x79')],{'as':_0xbd21('0x166'),'foreignKey':_0xbd21('0x160')});db[_0xbd21('0x3a')][_0xbd21('0x110')](db[_0xbd21('0x3d')],{'as':'Messages','foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0xbd21('0x118')],{'as':'Interactions'});db['MailAccount'][_0xbd21('0x110')](db['MailApplication'],{'as':_0xbd21('0x167'),'foreignKey':_0xbd21('0x160'),'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x3a')][_0xbd21('0x152')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['MailAccount'][_0xbd21('0x152')](db[_0xbd21('0x8e')],{'as':'Template','foreignKey':_0xbd21('0x168')});db['MailAccount'][_0xbd21('0x152')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xbd21('0x154')});db[_0xbd21('0x3a')]['belongsToMany'](db['User'],{'as':_0xbd21('0x156'),'through':_0xbd21('0x13e')});db[_0xbd21('0x132')][_0xbd21('0x11f')](db['User'],{'as':'Agents','through':_0xbd21('0x2f')});db['MailQueue']['belongsToMany'](db[_0xbd21('0xe7')],{'through':_0xbd21('0x169'),'as':_0xbd21('0x157')});db[_0xbd21('0x118')][_0xbd21('0x110')](db[_0xbd21('0x3d')],{'as':_0xbd21('0x15b'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db['MailInteraction'][_0xbd21('0x152')](db[_0xbd21('0x3a')],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x160')});db['MailInteraction'][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'as':_0xbd21('0x16c'),'foreignKey':_0xbd21('0x15f')});db['MailInteraction']['belongsTo'](db[_0xbd21('0xf')],{'as':_0xbd21('0x16d'),'foreignKey':_0xbd21('0x111')});db[_0xbd21('0x118')][_0xbd21('0x11f')](db['Tag'],{'through':_0xbd21('0x16e'),'as':'Tags'});db[_0xbd21('0x118')][_0xbd21('0x11f')](db[_0xbd21('0x16f')],{'through':_0xbd21('0x16e'),'as':_0xbd21('0x170')});db['MailInteraction'][_0xbd21('0x11f')](db[_0xbd21('0xf')],{'as':'Users','through':_0xbd21('0x128'),'foreignKey':_0xbd21('0x171')});db[_0xbd21('0x3d')][_0xbd21('0x110')](db[_0xbd21('0xef')],{'as':_0xbd21('0x172'),'onDelete':_0xbd21('0x10d')});db['MailMessage'][_0xbd21('0x152')](db[_0xbd21('0xf')],{'as':_0xbd21('0xf')});db[_0xbd21('0x3d')]['belongsTo'](db[_0xbd21('0x16b')],{'onDelete':'cascade','as':'Contact'});db[_0xbd21('0x3d')][_0xbd21('0x152')](db[_0xbd21('0x118')],{'as':_0xbd21('0x173'),'foreignKey':_0xbd21('0x171')});db[_0xbd21('0x3d')][_0xbd21('0x152')](db[_0xbd21('0x3a')],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x160')});db[_0xbd21('0x3d')]['belongsTo'](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0xbd21('0x174')});db[_0xbd21('0x3d')][_0xbd21('0x152')](db[_0xbd21('0x64')],{'as':_0xbd21('0x64'),'foreignKey':_0xbd21('0x175')});db[_0xbd21('0x3f')]['belongsTo'](db[_0xbd21('0xf')],{'onDelete':_0xbd21('0x162')});db[_0xbd21('0x3f')][_0xbd21('0x152')](db[_0xbd21('0x132')],{'onDelete':_0xbd21('0x162')});db[_0xbd21('0x3f')][_0xbd21('0x152')](db[_0xbd21('0x3a')],{'onDelete':_0xbd21('0x162')});db['MailApplication'][_0xbd21('0x152')](db[_0xbd21('0x7e')],{'onDelete':'restrict','foreignKey':_0xbd21('0x153')});db['MailApplication'][_0xbd21('0x152')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xbd21('0x176')});db[_0xbd21('0x41')][_0xbd21('0x152')](db[_0xbd21('0x3a')],{});db[_0xbd21('0x41')][_0xbd21('0x152')](db[_0xbd21('0x124')],{'as':_0xbd21('0x177'),'foreignKey':_0xbd21('0x178')});db[_0xbd21('0x41')][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'as':_0xbd21('0x16c'),'foreignKey':'ContactId'});db[_0xbd21('0x41')][_0xbd21('0x152')](db[_0xbd21('0x118')],{});db['MailQueueReport']['belongsTo'](db[_0xbd21('0x3d')],{});db[_0xbd21('0x41')][_0xbd21('0x152')](db[_0xbd21('0xf')],{});db[_0xbd21('0x41')][_0xbd21('0x152')](db['MailQueue'],{});db[_0xbd21('0x179')][_0xbd21('0x110')](db['DashboardItem'],{'as':'Items','onDelete':'cascade'});db[_0xbd21('0x46')][_0xbd21('0x110')](db[_0xbd21('0x7a')],{'as':_0xbd21('0x165'),'foreignKey':_0xbd21('0x17a'),'onDelete':'cascade'});db[_0xbd21('0x46')][_0xbd21('0x110')](db[_0xbd21('0x79')],{'as':_0xbd21('0x166'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0xbd21('0x110')](db['FaxInteraction'],{'as':_0xbd21('0x17b')});db[_0xbd21('0x46')]['hasMany'](db[_0xbd21('0x48')],{'as':_0xbd21('0x167'),'foreignKey':'FaxAccountId','onDelete':_0xbd21('0x10d')});db[_0xbd21('0x46')][_0xbd21('0x110')](db[_0xbd21('0x15')],{'as':_0xbd21('0x17c'),'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x46')][_0xbd21('0x110')](db['FaxMessage'],{'as':_0xbd21('0x15b')});db[_0xbd21('0x46')][_0xbd21('0x152')](db[_0xbd21('0x28')],{'as':_0xbd21('0x28')});db['FaxAccount'][_0xbd21('0x152')](db[_0xbd21('0x124')],{'as':_0xbd21('0x177'),'foreignKey':_0xbd21('0x178')});db[_0xbd21('0x46')][_0xbd21('0x152')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xbd21('0x46')][_0xbd21('0x11f')](db['User'],{'as':_0xbd21('0x156'),'through':_0xbd21('0x13c')});db[_0xbd21('0x48')][_0xbd21('0x152')](db['User'],{'onDelete':_0xbd21('0x162')});db[_0xbd21('0x48')][_0xbd21('0x152')](db[_0xbd21('0x4e')],{'onDelete':'restrict'});db[_0xbd21('0x48')][_0xbd21('0x152')](db[_0xbd21('0x46')],{'onDelete':_0xbd21('0x162')});db['FaxApplication'][_0xbd21('0x152')](db['Tag'],{'onDelete':_0xbd21('0x162'),'foreignKey':_0xbd21('0x176')});db['FaxInteraction'][_0xbd21('0x110')](db['FaxMessage'],{'as':_0xbd21('0x15b'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x17d')});db[_0xbd21('0x4a')]['belongsTo'](db[_0xbd21('0x46')],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x17a')});db[_0xbd21('0x4a')]['belongsTo'](db[_0xbd21('0x16b')],{'as':_0xbd21('0x16c'),'foreignKey':_0xbd21('0x15f')});db['FaxInteraction']['belongsTo'](db['User'],{'as':_0xbd21('0x16d'),'foreignKey':'UserId'});db[_0xbd21('0x4a')][_0xbd21('0x11f')](db['Tag'],{'through':_0xbd21('0x17e'),'as':'Tags'});db[_0xbd21('0x4a')][_0xbd21('0x11f')](db[_0xbd21('0x16f')],{'through':_0xbd21('0x17e'),'as':_0xbd21('0x170')});db[_0xbd21('0x4a')][_0xbd21('0x11f')](db[_0xbd21('0xf')],{'as':_0xbd21('0x17f'),'through':_0xbd21('0x12b'),'foreignKey':'FaxInteractionId'});db[_0xbd21('0x4c')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'onDelete':_0xbd21('0x10d'),'as':_0xbd21('0xf')});db[_0xbd21('0x4c')][_0xbd21('0x152')](db[_0xbd21('0x4a')],{'as':_0xbd21('0x173'),'foreignKey':_0xbd21('0x17d')});db[_0xbd21('0x4c')]['belongsTo'](db[_0xbd21('0x16b')],{'onDelete':_0xbd21('0x10d'),'as':_0xbd21('0x16c')});db[_0xbd21('0x4c')][_0xbd21('0x152')](db[_0xbd21('0xef')],{'as':_0xbd21('0xef'),'foreignKey':_0xbd21('0x180')});db[_0xbd21('0x4c')][_0xbd21('0x152')](db[_0xbd21('0x46')],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x17a')});db[_0xbd21('0x4e')][_0xbd21('0x11f')](db['User'],{'as':_0xbd21('0x156'),'through':_0xbd21('0x31')});db[_0xbd21('0x4e')]['belongsToMany'](db[_0xbd21('0xe7')],{'through':_0xbd21('0x181'),'as':_0xbd21('0x157')});db['FaxQueueReport'][_0xbd21('0x152')](db[_0xbd21('0x46')],{});db[_0xbd21('0x50')][_0xbd21('0x152')](db[_0xbd21('0x124')],{'as':'List','foreignKey':_0xbd21('0x178')});db['FaxQueueReport'][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'as':_0xbd21('0x16c'),'foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x50')][_0xbd21('0x152')](db[_0xbd21('0x4a')],{});db['FaxQueueReport'][_0xbd21('0x152')](db[_0xbd21('0x4c')],{});db[_0xbd21('0x50')][_0xbd21('0x152')](db['User'],{});db['FaxQueueReport'][_0xbd21('0x152')](db[_0xbd21('0x4e')],{});db[_0xbd21('0x141')][_0xbd21('0x110')](db[_0xbd21('0x7a')],{'as':_0xbd21('0x165'),'foreignKey':_0xbd21('0x182'),'onDelete':'cascade'});db[_0xbd21('0x141')][_0xbd21('0x110')](db[_0xbd21('0x79')],{'as':_0xbd21('0x166'),'foreignKey':_0xbd21('0x182')});db[_0xbd21('0x141')][_0xbd21('0x110')](db['SmsMessage'],{'as':_0xbd21('0x15b'),'foreignKey':_0xbd21('0x182')});db[_0xbd21('0x141')][_0xbd21('0x110')](db['SmsInteraction'],{'as':_0xbd21('0x17b')});db[_0xbd21('0x141')][_0xbd21('0x110')](db['SmsApplication'],{'as':'Applications','foreignKey':'SmsAccountId','onDelete':'cascade'});db['SmsAccount'][_0xbd21('0x152')](db['CmList'],{'as':'List','foreignKey':_0xbd21('0x178')});db[_0xbd21('0x141')][_0xbd21('0x152')](db['Pause'],{'as':_0xbd21('0x183'),'foreignKey':_0xbd21('0x154')});db[_0xbd21('0x141')][_0xbd21('0x11f')](db[_0xbd21('0xf')],{'as':_0xbd21('0x156'),'through':_0xbd21('0x143')});db[_0xbd21('0x52')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'onDelete':_0xbd21('0x162')});db[_0xbd21('0x52')]['belongsTo'](db[_0xbd21('0x184')],{'onDelete':'restrict'});db[_0xbd21('0x52')]['belongsTo'](db[_0xbd21('0x141')],{'onDelete':_0xbd21('0x162')});db['SmsApplication'][_0xbd21('0x152')](db[_0xbd21('0x7e')],{'onDelete':_0xbd21('0x162'),'foreignKey':_0xbd21('0x153')});db['SmsApplication'][_0xbd21('0x152')](db['Tag'],{'onDelete':_0xbd21('0x162'),'foreignKey':_0xbd21('0x176')});db['SmsInteraction']['hasMany'](db[_0xbd21('0x185')],{'as':_0xbd21('0x15b'),'onDelete':'cascade','foreignKey':_0xbd21('0x186')});db[_0xbd21('0x54')][_0xbd21('0x152')](db[_0xbd21('0x141')],{'as':_0xbd21('0x16a'),'foreignKey':'SmsAccountId'});db[_0xbd21('0x54')]['belongsTo'](db[_0xbd21('0x16b')],{'as':_0xbd21('0x16c'),'foreignKey':'ContactId'});db[_0xbd21('0x54')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'as':'Owner','foreignKey':'UserId'});db[_0xbd21('0x54')][_0xbd21('0x11f')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xbd21('0x187')});db[_0xbd21('0x54')][_0xbd21('0x11f')](db['Tag'],{'through':_0xbd21('0x188'),'as':_0xbd21('0x170')});db[_0xbd21('0x54')][_0xbd21('0x11f')](db[_0xbd21('0xf')],{'as':_0xbd21('0x17f'),'through':_0xbd21('0x12d'),'foreignKey':_0xbd21('0x186')});db['SmsMessage']['belongsTo'](db['User'],{'as':_0xbd21('0xf')});db['SmsMessage'][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'onDelete':_0xbd21('0x10d'),'as':_0xbd21('0x16c')});db[_0xbd21('0x185')][_0xbd21('0x152')](db['SmsInteraction'],{'onDelete':_0xbd21('0x10d'),'as':_0xbd21('0x173'),'foreignKey':_0xbd21('0x186')});db['SmsMessage'][_0xbd21('0x152')](db[_0xbd21('0x141')],{'as':_0xbd21('0x16a'),'foreignKey':'SmsAccountId'});db['SmsQueue']['belongsToMany'](db[_0xbd21('0xf')],{'as':_0xbd21('0x156'),'through':'UserSmsQueue','foreignKey':_0xbd21('0x189')});db[_0xbd21('0x184')][_0xbd21('0x11f')](db['Team'],{'through':_0xbd21('0x18a'),'as':_0xbd21('0x157')});db['OpenchannelAccount'][_0xbd21('0x110')](db['Disposition'],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0xbd21('0x10d')});db[_0xbd21('0x13f')][_0xbd21('0x110')](db[_0xbd21('0x79')],{'as':_0xbd21('0x166'),'foreignKey':_0xbd21('0x18b')});db[_0xbd21('0x13f')][_0xbd21('0x110')](db[_0xbd21('0x59')],{'as':'Interactions','foreignKey':_0xbd21('0x18b')});db[_0xbd21('0x13f')][_0xbd21('0x110')](db['OpenchannelMessage'],{'as':_0xbd21('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0xbd21('0x13f')][_0xbd21('0x110')](db[_0xbd21('0x57')],{'as':_0xbd21('0x167'),'foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db[_0xbd21('0x13f')]['belongsTo'](db[_0xbd21('0x124')],{'as':_0xbd21('0x177'),'foreignKey':_0xbd21('0x178')});db[_0xbd21('0x13f')]['belongsTo'](db['Pause'],{'as':_0xbd21('0x183'),'foreignKey':_0xbd21('0x154')});db[_0xbd21('0x13f')]['belongsToMany'](db[_0xbd21('0xf')],{'as':_0xbd21('0x156'),'through':'user_has_openchannel_accounts'});db[_0xbd21('0x57')][_0xbd21('0x152')](db['User'],{'onDelete':_0xbd21('0x162')});db[_0xbd21('0x57')][_0xbd21('0x152')](db[_0xbd21('0x5d')],{'onDelete':'restrict','foreignKey':_0xbd21('0x18c')});db[_0xbd21('0x57')]['belongsTo'](db[_0xbd21('0x13f')],{'onDelete':'restrict','foreignKey':_0xbd21('0x18b')});db[_0xbd21('0x57')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xbd21('0x57')]['belongsTo'](db[_0xbd21('0x16f')],{'onDelete':_0xbd21('0x162'),'foreignKey':_0xbd21('0x176')});db[_0xbd21('0x59')][_0xbd21('0x110')](db[_0xbd21('0x5b')],{'as':'Messages','onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x18d')});db[_0xbd21('0x59')][_0xbd21('0x152')](db[_0xbd21('0x13f')],{'as':'Account','foreignKey':_0xbd21('0x18b')});db['OpenchannelInteraction'][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'as':_0xbd21('0x16c'),'foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x59')]['belongsTo'](db[_0xbd21('0xf')],{'as':_0xbd21('0x16d'),'foreignKey':_0xbd21('0x111')});db['OpenchannelInteraction'][_0xbd21('0x11f')](db['Tag'],{'through':_0xbd21('0x18e'),'as':_0xbd21('0x187')});db[_0xbd21('0x59')][_0xbd21('0x11f')](db[_0xbd21('0x16f')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0xbd21('0x59')][_0xbd21('0x11f')](db[_0xbd21('0xf')],{'as':_0xbd21('0x17f'),'through':_0xbd21('0x12e'),'foreignKey':_0xbd21('0x18d')});db[_0xbd21('0x5b')][_0xbd21('0x152')](db['User'],{'onDelete':_0xbd21('0x10d'),'as':_0xbd21('0xf')});db[_0xbd21('0x5b')][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'onDelete':'cascade','as':_0xbd21('0x16c')});db[_0xbd21('0x5b')][_0xbd21('0x152')](db['OpenchannelInteraction'],{'onDelete':_0xbd21('0x10d'),'as':_0xbd21('0x173'),'foreignKey':_0xbd21('0x18d')});db[_0xbd21('0x5b')][_0xbd21('0x152')](db[_0xbd21('0xef')],{'as':_0xbd21('0xef'),'foreignKey':_0xbd21('0x180')});db[_0xbd21('0x5b')][_0xbd21('0x152')](db[_0xbd21('0x13f')],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x18b')});db[_0xbd21('0x5d')]['belongsToMany'](db[_0xbd21('0xf')],{'as':_0xbd21('0x156'),'through':_0xbd21('0x18f'),'foreignKey':'OpenchannelQueueId'});db[_0xbd21('0x5d')][_0xbd21('0x11f')](db[_0xbd21('0xe7')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0xbd21('0x139')][_0xbd21('0x110')](db[_0xbd21('0x7a')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0xbd21('0x10d')});db['ChatWebsite']['hasMany'](db[_0xbd21('0x79')],{'as':'Answers','foreignKey':_0xbd21('0x174')});db[_0xbd21('0x139')][_0xbd21('0x110')](db['ChatProactiveAction'],{'as':_0xbd21('0x190')});db[_0xbd21('0x139')][_0xbd21('0x110')](db[_0xbd21('0x62')],{'as':_0xbd21('0x17b')});db[_0xbd21('0x139')][_0xbd21('0x110')](db['ChatApplication'],{'as':'Applications','foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0xbd21('0x139')]['hasMany'](db['ChatMessage'],{'as':_0xbd21('0x15b')});db['ChatWebsite'][_0xbd21('0x152')](db[_0xbd21('0x124')],{'as':_0xbd21('0x177'),'foreignKey':_0xbd21('0x178')});db['ChatWebsite'][_0xbd21('0x152')](db['Interval'],{'as':_0xbd21('0x7e'),'foreignKey':'IntervalId'});db[_0xbd21('0x139')]['belongsTo'](db[_0xbd21('0x3a')],{'as':_0xbd21('0x3a'),'foreignKey':'MailAccountId'});db[_0xbd21('0x139')][_0xbd21('0x152')](db[_0xbd21('0x80')],{'as':_0xbd21('0x183'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xbd21('0x139')][_0xbd21('0x11f')](db['User'],{'as':_0xbd21('0x156'),'through':_0xbd21('0x191')});db[_0xbd21('0x5f')][_0xbd21('0x152')](db[_0xbd21('0x13f')],{});db[_0xbd21('0x5f')][_0xbd21('0x152')](db[_0xbd21('0x124')],{'as':'List','foreignKey':_0xbd21('0x178')});db['OpenchannelQueueReport']['belongsTo'](db[_0xbd21('0x16b')],{'as':_0xbd21('0x16c'),'foreignKey':'ContactId'});db[_0xbd21('0x5f')][_0xbd21('0x152')](db[_0xbd21('0x59')],{});db[_0xbd21('0x5f')]['belongsTo'](db[_0xbd21('0x5b')],{});db[_0xbd21('0x5f')]['belongsTo'](db[_0xbd21('0xf')],{});db[_0xbd21('0x5f')]['belongsTo'](db[_0xbd21('0x5d')],{});db[_0xbd21('0x60')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'as':_0xbd21('0x192'),'foreignKey':_0xbd21('0x111'),'onDelete':_0xbd21('0x162')});db[_0xbd21('0x60')][_0xbd21('0x152')](db[_0xbd21('0x66')],{'as':_0xbd21('0x193'),'foreignKey':_0xbd21('0x194'),'onDelete':_0xbd21('0x162')});db[_0xbd21('0x60')][_0xbd21('0x152')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xbd21('0x174'),'onDelete':_0xbd21('0x162')});db['ChatApplication']['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0xbd21('0x176')});db[_0xbd21('0x62')][_0xbd21('0x110')](db[_0xbd21('0x195')],{'as':'Messages','onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x196')});db[_0xbd21('0x62')]['belongsTo'](db[_0xbd21('0x139')],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x174')});db[_0xbd21('0x62')]['belongsTo'](db[_0xbd21('0x16b')],{'as':_0xbd21('0x16c'),'foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x62')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'as':_0xbd21('0x16d'),'foreignKey':'UserId'});db[_0xbd21('0x62')][_0xbd21('0x11f')](db[_0xbd21('0x16f')],{'through':_0xbd21('0x197'),'as':_0xbd21('0x187')});db[_0xbd21('0x62')][_0xbd21('0x11f')](db['Tag'],{'through':_0xbd21('0x197'),'as':_0xbd21('0x170')});db['ChatInteraction'][_0xbd21('0x11f')](db[_0xbd21('0xf')],{'as':_0xbd21('0x17f'),'through':_0xbd21('0x12a'),'foreignKey':_0xbd21('0x196')});db[_0xbd21('0x195')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'onDelete':_0xbd21('0x10d'),'as':_0xbd21('0xf')});db[_0xbd21('0x195')]['belongsTo'](db[_0xbd21('0x16b')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x195')][_0xbd21('0x152')](db[_0xbd21('0x62')],{'onDelete':_0xbd21('0x10d'),'as':_0xbd21('0x173'),'foreignKey':_0xbd21('0x196')});db[_0xbd21('0x195')][_0xbd21('0x152')](db[_0xbd21('0xef')],{'as':_0xbd21('0xef'),'foreignKey':_0xbd21('0x180')});db[_0xbd21('0x195')]['belongsTo'](db[_0xbd21('0x139')],{'as':_0xbd21('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0xbd21('0x64')][_0xbd21('0x110')](db[_0xbd21('0xef')],{'as':_0xbd21('0x172'),'foreignKey':_0xbd21('0x175'),'onDelete':'cascade','hooks':!![]});db[_0xbd21('0x64')][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'onDelete':_0xbd21('0x10d'),'as':_0xbd21('0x16c'),'foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x64')][_0xbd21('0x152')](db['ChatWebsite'],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x174')});db['ChatQueue'][_0xbd21('0x11f')](db[_0xbd21('0xf')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0xbd21('0x66')]['belongsToMany'](db['Team'],{'through':_0xbd21('0x198'),'as':'Teams'});db['ChatGroup'][_0xbd21('0x110')](db[_0xbd21('0xd1')],{'as':_0xbd21('0x15b'),'foreignKey':_0xbd21('0x199'),'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x68')][_0xbd21('0x11f')](db[_0xbd21('0xf')],{'as':_0xbd21('0x14a'),'through':'chat_group_has_users'});db[_0xbd21('0x6a')][_0xbd21('0x152')](db[_0xbd21('0x139')],{'as':_0xbd21('0x19a'),'foreignKey':_0xbd21('0x174')});db[_0xbd21('0x6c')][_0xbd21('0x110')](db[_0xbd21('0x16b')],{'as':_0xbd21('0x122'),'foreignKey':_0xbd21('0x19b')});db[_0xbd21('0x16b')][_0xbd21('0x110')](db['CmContactHasItem'],{'as':_0xbd21('0x19c'),'foreignKey':'CmContactId'});db[_0xbd21('0x16b')][_0xbd21('0x110')](db[_0xbd21('0x11c')],{'as':_0xbd21('0x19d'),'foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x16b')][_0xbd21('0x110')](db[_0xbd21('0x114')],{'as':_0xbd21('0x115'),'foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x16b')][_0xbd21('0x110')](db[_0xbd21('0x72')],{'as':_0xbd21('0x14c'),'foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x16b')][_0xbd21('0x110')](db[_0xbd21('0x74')],{'as':'ReportAgentPreview','foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x16b')][_0xbd21('0x110')](db[_0xbd21('0xd6')],{'as':_0xbd21('0x14e'),'foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x16b')][_0xbd21('0x110')](db[_0xbd21('0x59')],{'as':'OpenchannelInteractions','foreignKey':_0xbd21('0x15f'),'onDelete':_0xbd21('0x162')});db['CmContact'][_0xbd21('0x110')](db[_0xbd21('0x62')],{'as':_0xbd21('0x129'),'foreignKey':'ContactId','onDelete':_0xbd21('0x162')});db[_0xbd21('0x16b')][_0xbd21('0x110')](db[_0xbd21('0x54')],{'as':'SmsInteractions','foreignKey':_0xbd21('0x15f'),'onDelete':_0xbd21('0x162')});db[_0xbd21('0x16b')][_0xbd21('0x110')](db[_0xbd21('0x4a')],{'as':_0xbd21('0x117'),'foreignKey':_0xbd21('0x15f'),'onDelete':_0xbd21('0x162')});db[_0xbd21('0x16b')]['hasMany'](db[_0xbd21('0x118')],{'as':_0xbd21('0x119'),'foreignKey':'ContactId','onDelete':_0xbd21('0x162')});db[_0xbd21('0x16b')][_0xbd21('0x152')](db[_0xbd21('0x6c')],{'as':_0xbd21('0x19e'),'foreignKey':_0xbd21('0x19b')});db[_0xbd21('0x16b')][_0xbd21('0x152')](db[_0xbd21('0x124')],{'as':_0xbd21('0x177'),'foreignKey':_0xbd21('0x178'),'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x16b')][_0xbd21('0x11f')](db['User'],{'as':_0xbd21('0x17f'),'through':'cm_user_has_contacts'});db[_0xbd21('0x16b')]['belongsToMany'](db[_0xbd21('0x16f')],{'as':_0xbd21('0x187'),'through':_0xbd21('0x19f')});db['CmContact']['belongsToMany'](db[_0xbd21('0x16f')],{'through':'cm_contact_has_tags','as':_0xbd21('0x170')});db[_0xbd21('0x11c')]['hasMany'](db[_0xbd21('0x8c')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0xbd21('0x11c')][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xbd21('0x10d')});db[_0xbd21('0x11c')][_0xbd21('0x152')](db[_0xbd21('0x124')],{'as':_0xbd21('0x177'),'foreignKey':_0xbd21('0x178'),'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x11c')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'as':_0xbd21('0x192'),'foreignKey':_0xbd21('0x111')});db[_0xbd21('0x11c')][_0xbd21('0x152')](db['VoiceQueue'],{'as':_0xbd21('0x193'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xbd21('0x11c')]['belongsTo'](db['Campaign'],{'as':_0xbd21('0xeb'),'foreignKey':_0xbd21('0x1a0'),'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x11c')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'as':_0xbd21('0x16d'),'foreignKey':_0xbd21('0x1a1')});db[_0xbd21('0x6f')][_0xbd21('0x152')](db['CmContact'],{'as':_0xbd21('0x16c'),'foreignKey':_0xbd21('0x15f'),'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x6f')]['belongsTo'](db['CmList'],{'as':_0xbd21('0x177'),'foreignKey':_0xbd21('0x178'),'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x6f')][_0xbd21('0x152')](db[_0xbd21('0x18')],{'as':_0xbd21('0x193'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xbd21('0x6f')][_0xbd21('0x152')](db[_0xbd21('0xeb')],{'as':_0xbd21('0xeb'),'foreignKey':_0xbd21('0x1a0'),'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x77')][_0xbd21('0x110')](db[_0xbd21('0x7c')],{'as':{'plural':_0xbd21('0x1a2'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0xbd21('0x77')][_0xbd21('0x110')](db[_0xbd21('0x7c')],{'as':{'plural':_0xbd21('0x1a3'),'singular':'OneAny'},'foreignKey':_0xbd21('0x1a4'),'onDelete':_0xbd21('0x10d'),'hooks':!![]});db[_0xbd21('0x77')]['hasMany'](db['Action'],{'as':_0xbd21('0x1a5'),'foreignKey':_0xbd21('0x1a6'),'onDelete':_0xbd21('0x10d'),'hooks':!![]});db[_0xbd21('0x7a')][_0xbd21('0x110')](db[_0xbd21('0x7a')],{'as':_0xbd21('0x165'),'foreignKey':_0xbd21('0x1a7'),'onDelete':'cascade'});db[_0xbd21('0x7e')][_0xbd21('0x110')](db[_0xbd21('0x7e')],{'as':_0xbd21('0x1a8'),'foreignKey':_0xbd21('0x153'),'onDelete':_0xbd21('0x10d'),'hooks':!![],'required':![]});db[_0xbd21('0x7e')][_0xbd21('0x110')](db[_0xbd21('0x15')],{'as':_0xbd21('0x113'),'foreignKey':'IntervalId','onDelete':_0xbd21('0x162')});db['Interval']['hasMany'](db[_0xbd21('0x3f')],{'as':'MailApplications','foreignKey':_0xbd21('0x153')});db['Interval'][_0xbd21('0x110')](db[_0xbd21('0x60')],{'as':_0xbd21('0x1a9'),'foreignKey':'IntervalId'});db[_0xbd21('0x7e')][_0xbd21('0x110')](db['FaxApplication'],{'as':_0xbd21('0x1aa'),'foreignKey':_0xbd21('0x153')});db[_0xbd21('0x7e')][_0xbd21('0x110')](db[_0xbd21('0x52')],{'as':_0xbd21('0x1ab'),'foreignKey':'IntervalId'});db[_0xbd21('0x85')][_0xbd21('0x152')](db[_0xbd21('0x3a')],{});db[_0xbd21('0x85')]['belongsTo'](db[_0xbd21('0x97')],{'foreignKey':_0xbd21('0x1ac')});db[_0xbd21('0x85')][_0xbd21('0x152')](db['AnalyticCustomReport'],{'foreignKey':_0xbd21('0x1ad')});db[_0xbd21('0x87')]['belongsToMany'](db[_0xbd21('0x148')],{'as':'Mohs','through':_0xbd21('0x149'),'onDelete':_0xbd21('0x162')});db['Tag'][_0xbd21('0x11f')](db[_0xbd21('0x16b')],{'through':_0xbd21('0x19f')});db[_0xbd21('0x16f')][_0xbd21('0x11f')](db[_0xbd21('0x62')],{'through':_0xbd21('0x197')});db[_0xbd21('0x16f')][_0xbd21('0x11f')](db[_0xbd21('0x118')],{'through':_0xbd21('0x16e')});db[_0xbd21('0x16f')]['belongsToMany'](db['SmsInteraction'],{'through':_0xbd21('0x188')});db['Tag'][_0xbd21('0x11f')](db[_0xbd21('0x4a')],{'through':'fax_interaction_has_tags'});db[_0xbd21('0x16f')][_0xbd21('0x11f')](db[_0xbd21('0x59')],{'through':_0xbd21('0x18e')});db[_0xbd21('0x16f')][_0xbd21('0x11f')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0xbd21('0x1ae')][_0xbd21('0x152')](db[_0xbd21('0x89')],{'as':_0xbd21('0x1af'),'foreignKey':_0xbd21('0x1b0')});db[_0xbd21('0x8c')][_0xbd21('0x152')](db[_0xbd21('0x11c')],{'as':_0xbd21('0x1b1'),'foreignKey':_0xbd21('0x1b2')});db['CmContactHasItem'][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'as':_0xbd21('0x16c'),'foreignKey':_0xbd21('0x1b3')});db[_0xbd21('0x8f')][_0xbd21('0x110')](db[_0xbd21('0x7c')],{'as':{'plural':'AllConditions','singular':_0xbd21('0x1b4')},'foreignKey':'TriggerAllId','onDelete':_0xbd21('0x10d'),'hooks':!![]});db['Trigger'][_0xbd21('0x110')](db[_0xbd21('0x7c')],{'as':{'plural':_0xbd21('0x1b5'),'singular':_0xbd21('0x1b6')},'foreignKey':'TriggerAnyId','onDelete':_0xbd21('0x10d'),'hooks':!![]});db['Trigger'][_0xbd21('0x110')](db[_0xbd21('0x1b7')],{'as':_0xbd21('0x1a5'),'foreignKey':'TriggerId','onDelete':_0xbd21('0x10d'),'hooks':!![]});db[_0xbd21('0x1b8')][_0xbd21('0x110')](db['AnalyticFieldReport'],{'as':_0xbd21('0x1b9'),'onDelete':_0xbd21('0x10d'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xbd21('0x97')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xbd21('0x1b9'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1ac')});db[_0xbd21('0x99')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xbd21('0x1b9'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1ba')});db['AnalyticFieldReport'][_0xbd21('0x152')](db[_0xbd21('0x99')],{'foreignKey':_0xbd21('0x1ba')});db[_0xbd21('0x9e')][_0xbd21('0x110')](db[_0xbd21('0x1bb')],{'as':_0xbd21('0x1bc'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1bd')});db[_0xbd21('0x1bb')][_0xbd21('0x110')](db['SalesforceField'],{'as':_0xbd21('0x1be'),'onDelete':'cascade','foreignKey':_0xbd21('0x1bf')});db[_0xbd21('0x1bb')]['hasMany'](db[_0xbd21('0xa1')],{'as':_0xbd21('0x1c0'),'onDelete':'cascade','foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0x1bb')][_0xbd21('0x110')](db[_0xbd21('0xa1')],{'as':_0xbd21('0x1b9'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1c2')});db[_0xbd21('0x1bb')][_0xbd21('0x152')](db['SalesforceAccount'],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x1bd')});db[_0xbd21('0xa1')][_0xbd21('0x110')](db[_0xbd21('0xa1')],{'as':_0xbd21('0x1c3'),'foreignKey':'SubjectId'});db[_0xbd21('0xa1')][_0xbd21('0x110')](db[_0xbd21('0xa1')],{'as':'Description','foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0xa1')][_0xbd21('0x110')](db[_0xbd21('0xa1')],{'as':'Field','foreignKey':'FieldId'});db[_0xbd21('0xa1')][_0xbd21('0x152')](db[_0xbd21('0x91')],{'as':_0xbd21('0x91'),'foreignKey':'VariableId'});db[_0xbd21('0xa3')][_0xbd21('0x110')](db[_0xbd21('0xa5')],{'as':_0xbd21('0x1bc'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1bd')});db[_0xbd21('0xa5')][_0xbd21('0x110')](db[_0xbd21('0xa7')],{'as':'Subjects','onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1bf')});db[_0xbd21('0xa5')]['hasMany'](db['SugarcrmField'],{'as':_0xbd21('0x1c0'),'onDelete':'cascade','foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0xa5')][_0xbd21('0x110')](db[_0xbd21('0xa7')],{'as':_0xbd21('0x1b9'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1c2')});db['SugarcrmConfiguration'][_0xbd21('0x152')](db[_0xbd21('0xa3')],{'as':_0xbd21('0x16a'),'foreignKey':'AccountId'});db['SugarcrmField'][_0xbd21('0x110')](db[_0xbd21('0xa7')],{'as':_0xbd21('0x1c3'),'foreignKey':_0xbd21('0x1bf')});db[_0xbd21('0xa7')][_0xbd21('0x110')](db[_0xbd21('0xa7')],{'as':'Description','foreignKey':_0xbd21('0x1c1')});db['SugarcrmField'][_0xbd21('0x110')](db['SugarcrmField'],{'as':_0xbd21('0x1c4'),'foreignKey':'FieldId'});db[_0xbd21('0xa7')][_0xbd21('0x152')](db[_0xbd21('0x91')],{'as':_0xbd21('0x91'),'foreignKey':_0xbd21('0x1c5')});db['DeskAccount']['hasMany'](db[_0xbd21('0xaa')],{'as':_0xbd21('0x1bc'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xbd21('0xaa')][_0xbd21('0x110')](db[_0xbd21('0xab')],{'as':_0xbd21('0x1be'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1bf')});db[_0xbd21('0xaa')]['hasMany'](db[_0xbd21('0xab')],{'as':_0xbd21('0x1c0'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0xaa')][_0xbd21('0x110')](db[_0xbd21('0xab')],{'as':_0xbd21('0x1b9'),'onDelete':_0xbd21('0x10d'),'foreignKey':'FieldId'});db[_0xbd21('0xaa')][_0xbd21('0x152')](db[_0xbd21('0xa8')],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x1bd')});db['DeskConfiguration'][_0xbd21('0x11f')](db['Tag'],{'through':_0xbd21('0x1c6')});db['DeskField'][_0xbd21('0x110')](db[_0xbd21('0xab')],{'as':_0xbd21('0x1c3'),'foreignKey':_0xbd21('0x1bf')});db['DeskField'][_0xbd21('0x110')](db[_0xbd21('0xab')],{'as':_0xbd21('0x1c7'),'foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0xab')][_0xbd21('0x110')](db['DeskField'],{'as':_0xbd21('0x1c4'),'foreignKey':_0xbd21('0x1c2')});db[_0xbd21('0xab')][_0xbd21('0x152')](db[_0xbd21('0x91')],{'as':'Variable','foreignKey':_0xbd21('0x1c5')});db['ZohoAccount'][_0xbd21('0x110')](db[_0xbd21('0xaf')],{'as':_0xbd21('0x1bc'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1bd')});db[_0xbd21('0xaf')][_0xbd21('0x110')](db[_0xbd21('0xb1')],{'as':_0xbd21('0x1be'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xbd21('0xaf')][_0xbd21('0x110')](db[_0xbd21('0xb1')],{'as':_0xbd21('0x1c0'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1c1')});db['ZohoConfiguration'][_0xbd21('0x110')](db['ZohoField'],{'as':'Fields','onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1c2')});db['ZohoConfiguration'][_0xbd21('0x152')](db[_0xbd21('0xad')],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x1bd')});db[_0xbd21('0xb1')]['hasMany'](db[_0xbd21('0xb1')],{'as':_0xbd21('0x1c3'),'foreignKey':'SubjectId'});db[_0xbd21('0xb1')][_0xbd21('0x110')](db[_0xbd21('0xb1')],{'as':_0xbd21('0x1c7'),'foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0xb1')][_0xbd21('0x110')](db['ZohoField'],{'as':'Field','foreignKey':'FieldId'});db[_0xbd21('0xb1')][_0xbd21('0x152')](db[_0xbd21('0x91')],{'as':_0xbd21('0x91'),'foreignKey':'VariableId'});db[_0xbd21('0xb3')][_0xbd21('0x110')](db[_0xbd21('0xb5')],{'as':_0xbd21('0x1bc'),'onDelete':'cascade','foreignKey':_0xbd21('0x1bd')});db[_0xbd21('0xb5')][_0xbd21('0x110')](db[_0xbd21('0xb7')],{'as':_0xbd21('0x1be'),'foreignKey':'SubjectId'});db[_0xbd21('0xb5')][_0xbd21('0x110')](db[_0xbd21('0xb7')],{'as':_0xbd21('0x1c0'),'foreignKey':_0xbd21('0x1c1')});db['ZendeskConfiguration']['hasMany'](db[_0xbd21('0xb7')],{'as':'Fields','foreignKey':'FieldId'});db[_0xbd21('0xb5')]['belongsTo'](db[_0xbd21('0xb3')],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x1bd')});db[_0xbd21('0xb5')]['belongsToMany'](db[_0xbd21('0x16f')],{'through':'int_zendesk_configuration_has_tags'});db[_0xbd21('0xb7')]['hasMany'](db[_0xbd21('0xb7')],{'as':_0xbd21('0x1c3'),'foreignKey':_0xbd21('0x1bf')});db[_0xbd21('0xb7')][_0xbd21('0x110')](db[_0xbd21('0xb7')],{'as':_0xbd21('0x1c7'),'foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0xb7')]['hasMany'](db[_0xbd21('0xb7')],{'as':_0xbd21('0x1c4'),'foreignKey':_0xbd21('0x1c2')});db[_0xbd21('0xb7')][_0xbd21('0x152')](db[_0xbd21('0x91')],{'as':_0xbd21('0x91'),'foreignKey':_0xbd21('0x1c5')});db[_0xbd21('0xb9')][_0xbd21('0x110')](db[_0xbd21('0xbb')],{'as':_0xbd21('0x1bc'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xbd21('0xbb')][_0xbd21('0x110')](db[_0xbd21('0xbd')],{'as':_0xbd21('0x1be'),'onDelete':_0xbd21('0x10d'),'foreignKey':'SubjectId'});db[_0xbd21('0xbb')]['hasMany'](db[_0xbd21('0xbd')],{'as':_0xbd21('0x1c0'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0xbb')][_0xbd21('0x110')](db['FreshdeskField'],{'as':_0xbd21('0x1b9'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1c2')});db[_0xbd21('0xbb')][_0xbd21('0x152')](db[_0xbd21('0xb9')],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x1bd')});db[_0xbd21('0xbb')][_0xbd21('0x11f')](db[_0xbd21('0x16f')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xbd21('0xbd')][_0xbd21('0x110')](db[_0xbd21('0xbd')],{'as':_0xbd21('0x1c3'),'foreignKey':'SubjectId'});db[_0xbd21('0xbd')][_0xbd21('0x110')](db[_0xbd21('0xbd')],{'as':'Description','foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0xbd')][_0xbd21('0x110')](db['FreshdeskField'],{'as':_0xbd21('0x1c4'),'foreignKey':_0xbd21('0x1c2')});db[_0xbd21('0xbd')][_0xbd21('0x152')](db[_0xbd21('0x91')],{'as':_0xbd21('0x91'),'foreignKey':'VariableId'});db[_0xbd21('0xbf')]['hasMany'](db[_0xbd21('0x1c8')],{'as':_0xbd21('0x1bc'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1bd')});db['VtigerConfiguration'][_0xbd21('0x110')](db['VtigerField'],{'as':_0xbd21('0x1be'),'foreignKey':'SubjectId'});db[_0xbd21('0x1c8')][_0xbd21('0x110')](db[_0xbd21('0x1c9')],{'as':'Descriptions','foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0x1c8')]['hasMany'](db['VtigerField'],{'as':'Fields','foreignKey':_0xbd21('0x1c2')});db[_0xbd21('0x1c8')]['belongsTo'](db[_0xbd21('0xbf')],{'as':'Account','foreignKey':'AccountId'});db[_0xbd21('0x1c9')][_0xbd21('0x110')](db[_0xbd21('0x1c9')],{'as':_0xbd21('0x1c3'),'foreignKey':_0xbd21('0x1bf')});db[_0xbd21('0x1c9')][_0xbd21('0x110')](db[_0xbd21('0x1c9')],{'as':_0xbd21('0x1c7'),'foreignKey':'DescriptionId'});db[_0xbd21('0x1c9')]['hasMany'](db[_0xbd21('0x1c9')],{'as':_0xbd21('0x1c4'),'foreignKey':_0xbd21('0x1c2')});db['VtigerField'][_0xbd21('0x152')](db[_0xbd21('0x91')],{'as':_0xbd21('0x91'),'foreignKey':_0xbd21('0x1c5')});db[_0xbd21('0xc2')][_0xbd21('0x110')](db['ServicenowConfiguration'],{'as':_0xbd21('0x1bc'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1bd')});db[_0xbd21('0x1ca')]['hasMany'](db[_0xbd21('0xc3')],{'as':_0xbd21('0x1be'),'foreignKey':_0xbd21('0x1bf')});db[_0xbd21('0x1ca')][_0xbd21('0x110')](db[_0xbd21('0xc3')],{'as':_0xbd21('0x1c0'),'foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0x1ca')]['hasMany'](db['ServicenowField'],{'as':_0xbd21('0x1b9'),'foreignKey':_0xbd21('0x1c2')});db[_0xbd21('0x1ca')]['belongsTo'](db[_0xbd21('0xc2')],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x1bd')});db[_0xbd21('0xc3')][_0xbd21('0x110')](db['ServicenowField'],{'as':_0xbd21('0x1c3'),'foreignKey':_0xbd21('0x1bf')});db[_0xbd21('0xc3')][_0xbd21('0x110')](db[_0xbd21('0xc3')],{'as':_0xbd21('0x1c7'),'foreignKey':_0xbd21('0x1c1')});db['ServicenowField'][_0xbd21('0x110')](db['ServicenowField'],{'as':_0xbd21('0x1c4'),'foreignKey':_0xbd21('0x1c2')});db[_0xbd21('0xc3')]['belongsTo'](db[_0xbd21('0x91')],{'as':'Variable','foreignKey':'VariableId'});db[_0xbd21('0xc4')][_0xbd21('0x110')](db[_0xbd21('0xc6')],{'as':_0xbd21('0x1bc'),'onDelete':_0xbd21('0x10d'),'foreignKey':'AccountId'});db['Dynamics365Account'][_0xbd21('0x152')](db[_0xbd21('0x104')],{'as':_0xbd21('0x104'),'foreignKey':_0xbd21('0x161')});db['Dynamics365Configuration'][_0xbd21('0x110')](db[_0xbd21('0xc8')],{'as':'Subjects','onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1bf')});db['Dynamics365Configuration'][_0xbd21('0x110')](db['Dynamics365Field'],{'as':_0xbd21('0x1c0'),'onDelete':'cascade','foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0xc6')]['hasMany'](db[_0xbd21('0xc8')],{'as':_0xbd21('0x1b9'),'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1c2')});db[_0xbd21('0xc6')]['belongsTo'](db[_0xbd21('0xc4')],{'as':'Account','foreignKey':_0xbd21('0x1bd')});db[_0xbd21('0xc8')]['hasMany'](db[_0xbd21('0xc8')],{'as':_0xbd21('0x1c3'),'foreignKey':'SubjectId'});db[_0xbd21('0xc8')][_0xbd21('0x110')](db['Dynamics365Field'],{'as':_0xbd21('0x1c7'),'foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0xc8')][_0xbd21('0x110')](db[_0xbd21('0xc8')],{'as':_0xbd21('0x1c4'),'foreignKey':_0xbd21('0x1c2')});db['Dynamics365Field'][_0xbd21('0x152')](db[_0xbd21('0x91')],{'as':_0xbd21('0x91'),'foreignKey':_0xbd21('0x1c5')});db[_0xbd21('0xca')][_0xbd21('0x110')](db[_0xbd21('0x1cb')],{'as':_0xbd21('0x1bc'),'onDelete':_0xbd21('0x10d'),'foreignKey':'AccountId'});db[_0xbd21('0x1cb')]['hasMany'](db[_0xbd21('0xcd')],{'as':_0xbd21('0x1be'),'foreignKey':_0xbd21('0x1bf')});db['FreshsalesConfiguration']['hasMany'](db[_0xbd21('0xcd')],{'as':'Descriptions','foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0x1cb')][_0xbd21('0x110')](db[_0xbd21('0xcd')],{'as':_0xbd21('0x1b9'),'foreignKey':_0xbd21('0x1c2')});db[_0xbd21('0x1cb')][_0xbd21('0x152')](db[_0xbd21('0xca')],{'as':_0xbd21('0x16a'),'foreignKey':'AccountId'});db[_0xbd21('0xcd')][_0xbd21('0x110')](db[_0xbd21('0xcd')],{'as':'Subject','foreignKey':_0xbd21('0x1bf')});db['FreshsalesField']['hasMany'](db[_0xbd21('0xcd')],{'as':_0xbd21('0x1c7'),'foreignKey':_0xbd21('0x1c1')});db[_0xbd21('0xcd')][_0xbd21('0x110')](db[_0xbd21('0xcd')],{'as':_0xbd21('0x1c4'),'foreignKey':_0xbd21('0x1c2')});db['FreshsalesField']['belongsTo'](db[_0xbd21('0x91')],{'as':_0xbd21('0x91'),'foreignKey':_0xbd21('0x1c5')});db[_0xbd21('0x1cc')][_0xbd21('0x152')](db['ChatWebsite'],{});db[_0xbd21('0x1cc')][_0xbd21('0x152')](db[_0xbd21('0x124')],{'as':_0xbd21('0x177'),'foreignKey':_0xbd21('0x178')});db['ChatQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xbd21('0x15f')});db['ChatQueueReport'][_0xbd21('0x152')](db[_0xbd21('0x62')],{});db[_0xbd21('0x1cc')][_0xbd21('0x152')](db[_0xbd21('0x195')],{});db['ChatQueueReport']['belongsTo'](db[_0xbd21('0xf')],{});db[_0xbd21('0x1cc')][_0xbd21('0x152')](db[_0xbd21('0x66')],{});db['ChatInternalMessage'][_0xbd21('0x152')](db[_0xbd21('0xf')],{'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1cd')});db['ChatInternalMessage'][_0xbd21('0x152')](db[_0xbd21('0xf')],{'onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x1ce')});db[_0xbd21('0xd6')][_0xbd21('0x110')](db[_0xbd21('0xd4')],{'foreignKey':'SessionId','onDelete':_0xbd21('0x10d')});db[_0xbd21('0xd6')]['hasMany'](db[_0xbd21('0x1cf')],{'foreignKey':_0xbd21('0x1d0'),'onDelete':_0xbd21('0x10d')});db['SmsQueueReport'][_0xbd21('0x152')](db[_0xbd21('0x141')],{});db['SmsQueueReport']['belongsTo'](db[_0xbd21('0x124')],{'as':_0xbd21('0x177'),'foreignKey':'ListId'});db['SmsQueueReport'][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'as':'Contact','foreignKey':_0xbd21('0x15f')});db[_0xbd21('0xd8')][_0xbd21('0x152')](db[_0xbd21('0x54')],{});db[_0xbd21('0xd8')][_0xbd21('0x152')](db[_0xbd21('0x185')],{});db[_0xbd21('0xd8')][_0xbd21('0x152')](db[_0xbd21('0xf')],{});db['SmsQueueReport'][_0xbd21('0x152')](db['SmsQueue'],{});db[_0xbd21('0xdb')][_0xbd21('0x110')](db[_0xbd21('0xd6')],{'foreignKey':_0xbd21('0x1d1')});db[_0xbd21('0xdb')][_0xbd21('0x110')](db[_0xbd21('0xd4')],{'foreignKey':'ProjectId'});db[_0xbd21('0xdb')][_0xbd21('0x110')](db[_0xbd21('0x1cf')],{'foreignKey':_0xbd21('0x1d1')});db[_0xbd21('0xe7')][_0xbd21('0x11f')](db[_0xbd21('0xf')],{'as':_0xbd21('0x156'),'through':_0xbd21('0x127')});db[_0xbd21('0xe7')][_0xbd21('0x11f')](db[_0xbd21('0x18')],{'through':_0xbd21('0x158'),'as':_0xbd21('0x130')});db[_0xbd21('0xe7')][_0xbd21('0x11f')](db[_0xbd21('0x132')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0xbd21('0xe7')][_0xbd21('0x11f')](db[_0xbd21('0x66')],{'through':_0xbd21('0x198'),'as':_0xbd21('0x133')});db[_0xbd21('0xe7')][_0xbd21('0x11f')](db[_0xbd21('0x4e')],{'through':'team_has_fax_queues','as':_0xbd21('0x134')});db[_0xbd21('0xe7')][_0xbd21('0x11f')](db[_0xbd21('0x184')],{'through':_0xbd21('0x18a'),'as':_0xbd21('0x135')});db[_0xbd21('0xe7')][_0xbd21('0x11f')](db[_0xbd21('0x5d')],{'through':_0xbd21('0x1d2'),'as':'OpenchannelQueues'});db[_0xbd21('0xe7')][_0xbd21('0x11f')](db['WhatsappQueue'],{'through':_0xbd21('0x1d3'),'as':_0xbd21('0x138')});db[_0xbd21('0xe7')][_0xbd21('0x11f')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0xbd21('0x131')});db[_0xbd21('0xeb')][_0xbd21('0x110')](db['CmHopper'],{'as':_0xbd21('0x19d'),'foreignKey':_0xbd21('0x1a0')});db[_0xbd21('0xeb')][_0xbd21('0x110')](db[_0xbd21('0x114')],{'as':_0xbd21('0x115'),'foreignKey':_0xbd21('0x1a0')});db[_0xbd21('0xeb')][_0xbd21('0x110')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0xbd21('0xeb')][_0xbd21('0x110')](db[_0xbd21('0x6f')],{'as':_0xbd21('0x14d'),'foreignKey':_0xbd21('0x1a0')});db[_0xbd21('0xeb')]['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0xbd21('0x14f')});db[_0xbd21('0xeb')]['belongsTo'](db[_0xbd21('0x28')],{'as':_0xbd21('0x150'),'foreignKey':_0xbd21('0x151')});db[_0xbd21('0xeb')][_0xbd21('0x152')](db['Interval'],{'as':_0xbd21('0x7e'),'foreignKey':_0xbd21('0x153')});db[_0xbd21('0xeb')][_0xbd21('0x152')](db[_0xbd21('0xe1')],{'as':_0xbd21('0xe1'),'foreignKey':_0xbd21('0x1d4')});db['Campaign']['belongsToMany'](db['CmList'],{'as':_0xbd21('0x125'),'through':_0xbd21('0x1d5')});db[_0xbd21('0xeb')][_0xbd21('0x11f')](db['CmList'],{'as':_0xbd21('0x1d6'),'through':_0xbd21('0x1d7')});db['Attachment'][_0xbd21('0x152')](db[_0xbd21('0x64')],{'as':_0xbd21('0x64'),'foreignKey':_0xbd21('0x175')});db[_0xbd21('0x1d8')][_0xbd21('0x152')](db['MailMessage'],{});db[_0xbd21('0x1d8')][_0xbd21('0x152')](db[_0xbd21('0x118')],{});db[_0xbd21('0x1d8')][_0xbd21('0x152')](db[_0xbd21('0x3a')],{'foreignKey':_0xbd21('0x1d9'),'as':_0xbd21('0x1da')});db['MailTransferReport'][_0xbd21('0x152')](db[_0xbd21('0xf')],{'foreignKey':_0xbd21('0x1db'),'as':'FromAgent'});db[_0xbd21('0x1d8')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'foreignKey':_0xbd21('0x1dc'),'as':_0xbd21('0x1dd')});db[_0xbd21('0x1d8')][_0xbd21('0x152')](db[_0xbd21('0x132')],{'foreignKey':'ToMailQueueId','as':_0xbd21('0x1de')});db['MailTransferReport'][_0xbd21('0x152')](db[_0xbd21('0x3a')],{'foreignKey':'ToMailAccountId','as':_0xbd21('0x1df')});db[_0xbd21('0xf3')][_0xbd21('0x152')](db['ChatMessage'],{});db[_0xbd21('0xf3')]['belongsTo'](db[_0xbd21('0x62')],{});db[_0xbd21('0xf3')][_0xbd21('0x152')](db['ChatWebsite'],{'foreignKey':_0xbd21('0x1e0'),'as':'FromAccount'});db[_0xbd21('0xf3')]['belongsTo'](db['User'],{'foreignKey':_0xbd21('0x1db'),'as':_0xbd21('0x1e1')});db['ChatTransferReport'][_0xbd21('0x152')](db[_0xbd21('0xf')],{'foreignKey':'ToUserId','as':'ToAgent'});db['ChatTransferReport'][_0xbd21('0x152')](db[_0xbd21('0x66')],{'foreignKey':_0xbd21('0x1e2'),'as':_0xbd21('0x1de')});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xbd21('0x1e3'),'as':_0xbd21('0x1df')});db[_0xbd21('0xf4')]['belongsTo'](db[_0xbd21('0x4c')],{});db['FaxTransferReport'][_0xbd21('0x152')](db['FaxInteraction'],{});db[_0xbd21('0xf4')][_0xbd21('0x152')](db[_0xbd21('0x46')],{'foreignKey':'FromFaxAccountId','as':_0xbd21('0x1da')});db[_0xbd21('0xf4')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xbd21('0xf4')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'foreignKey':_0xbd21('0x1dc'),'as':_0xbd21('0x1dd')});db[_0xbd21('0xf4')][_0xbd21('0x152')](db[_0xbd21('0x4e')],{'foreignKey':_0xbd21('0x1e4'),'as':_0xbd21('0x1de')});db['FaxTransferReport'][_0xbd21('0x152')](db[_0xbd21('0x46')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0xbd21('0x5b')],{});db[_0xbd21('0x1e5')]['belongsTo'](db[_0xbd21('0x59')],{});db[_0xbd21('0x1e5')][_0xbd21('0x152')](db[_0xbd21('0x13f')],{'foreignKey':_0xbd21('0x1e6'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0xbd21('0x152')](db[_0xbd21('0xf')],{'foreignKey':_0xbd21('0x1db'),'as':'FromAgent'});db[_0xbd21('0x1e5')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'foreignKey':_0xbd21('0x1dc'),'as':'ToAgent'});db[_0xbd21('0x1e5')][_0xbd21('0x152')](db[_0xbd21('0x5d')],{'foreignKey':'ToOpenchannelQueueId','as':_0xbd21('0x1de')});db['OpenchannelTransferReport'][_0xbd21('0x152')](db['OpenchannelAccount'],{'foreignKey':_0xbd21('0x1e7'),'as':_0xbd21('0x1df')});db[_0xbd21('0x1e8')][_0xbd21('0x152')](db[_0xbd21('0x185')],{});db[_0xbd21('0x1e8')][_0xbd21('0x152')](db[_0xbd21('0x54')],{});db[_0xbd21('0x1e8')][_0xbd21('0x152')](db[_0xbd21('0x141')],{'foreignKey':_0xbd21('0x1e9'),'as':'FromAccount'});db[_0xbd21('0x1e8')]['belongsTo'](db['User'],{'foreignKey':_0xbd21('0x1db'),'as':'FromAgent'});db[_0xbd21('0x1e8')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'foreignKey':_0xbd21('0x1dc'),'as':_0xbd21('0x1dd')});db[_0xbd21('0x1e8')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0xbd21('0x1de')});db[_0xbd21('0x1e8')][_0xbd21('0x152')](db[_0xbd21('0x141')],{'foreignKey':'ToSmsAccountId','as':_0xbd21('0x1df')});db['CmList']['hasMany'](db['Disposition'],{'as':_0xbd21('0x165'),'foreignKey':'ListId','onDelete':_0xbd21('0x10d')});db['CmList'][_0xbd21('0x110')](db[_0xbd21('0x76')],{'as':'CustomFields','foreignKey':_0xbd21('0x178')});db[_0xbd21('0x124')]['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':_0xbd21('0x10d'),'foreignKey':_0xbd21('0x178')});db[_0xbd21('0x124')]['hasMany'](db['CmHopperFinal'],{'as':_0xbd21('0x115'),'foreignKey':_0xbd21('0x178')});db['CmList']['hasMany'](db[_0xbd21('0x72')],{'as':_0xbd21('0x1ea'),'foreignKey':_0xbd21('0x178')});db[_0xbd21('0x124')][_0xbd21('0x110')](db[_0xbd21('0x74')],{'as':_0xbd21('0x74'),'foreignKey':'ListId'});db['CmList'][_0xbd21('0x11f')](db[_0xbd21('0x18')],{'as':_0xbd21('0x1eb'),'through':_0xbd21('0x155')});db[_0xbd21('0x124')]['belongsToMany'](db[_0xbd21('0xf')],{'as':_0xbd21('0x156'),'through':_0xbd21('0x126')});db[_0xbd21('0x1ec')][_0xbd21('0x110')](db[_0xbd21('0x15')],{'as':'Extensions','onDelete':_0xbd21('0x10d')});db[_0xbd21('0x1ec')][_0xbd21('0x11f')](db[_0xbd21('0xf')],{'as':'Agents','through':_0xbd21('0x108')});db[_0xbd21('0x1ec')][_0xbd21('0x11f')](db[_0xbd21('0xe7')],{'through':_0xbd21('0x106'),'as':_0xbd21('0x157')});db['UserProfile'][_0xbd21('0x110')](db[_0xbd21('0xf')],{'as':'Users','foreignKey':_0xbd21('0x11e')});db[_0xbd21('0xf8')][_0xbd21('0x110')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0xbd21('0x10d')});db[_0xbd21('0xf9')][_0xbd21('0x110')](db['UserProfileResource'],{'as':_0xbd21('0x1ed'),'foreignKey':_0xbd21('0x1ee'),'onDelete':_0xbd21('0x10d')});db['WhatsappAccount']['hasMany'](db['Disposition'],{'as':_0xbd21('0x165'),'foreignKey':_0xbd21('0x1ef'),'onDelete':_0xbd21('0x10d')});db[_0xbd21('0x144')]['hasMany'](db[_0xbd21('0x79')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xbd21('0x144')][_0xbd21('0x110')](db[_0xbd21('0xff')],{'as':_0xbd21('0x15b'),'foreignKey':_0xbd21('0x1ef')});db[_0xbd21('0x144')][_0xbd21('0x110')](db[_0xbd21('0x11a')],{'as':_0xbd21('0x17b')});db[_0xbd21('0x144')][_0xbd21('0x110')](db[_0xbd21('0xfd')],{'as':_0xbd21('0x167'),'foreignKey':_0xbd21('0x1ef'),'onDelete':'cascade'});db[_0xbd21('0x144')][_0xbd21('0x152')](db[_0xbd21('0x124')],{'as':_0xbd21('0x177'),'foreignKey':_0xbd21('0x178')});db[_0xbd21('0x144')][_0xbd21('0x152')](db[_0xbd21('0x80')],{'as':_0xbd21('0x183'),'foreignKey':_0xbd21('0x154')});db[_0xbd21('0x144')][_0xbd21('0x11f')](db[_0xbd21('0xf')],{'as':_0xbd21('0x156'),'through':_0xbd21('0x146')});db[_0xbd21('0xfd')]['belongsTo'](db[_0xbd21('0xf')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xbd21('0x152')](db[_0xbd21('0x137')],{'onDelete':_0xbd21('0x162')});db[_0xbd21('0xfd')]['belongsTo'](db[_0xbd21('0x144')],{'onDelete':_0xbd21('0x162')});db[_0xbd21('0xfd')][_0xbd21('0x152')](db[_0xbd21('0x7e')],{'onDelete':_0xbd21('0x162'),'foreignKey':_0xbd21('0x153')});db[_0xbd21('0xfd')][_0xbd21('0x152')](db[_0xbd21('0x16f')],{'onDelete':_0xbd21('0x162'),'foreignKey':'TagId'});db[_0xbd21('0x11a')][_0xbd21('0x110')](db['WhatsappMessage'],{'as':_0xbd21('0x15b'),'onDelete':_0xbd21('0x10d'),'foreignKey':'WhatsappInteractionId'});db[_0xbd21('0x11a')][_0xbd21('0x152')](db[_0xbd21('0x144')],{'as':'Account','foreignKey':_0xbd21('0x1ef')});db['WhatsappInteraction'][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'as':_0xbd21('0x16c'),'foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x11a')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'as':_0xbd21('0x16d'),'foreignKey':_0xbd21('0x111')});db[_0xbd21('0x11a')]['belongsToMany'](db[_0xbd21('0x16f')],{'through':_0xbd21('0x1f0'),'as':_0xbd21('0x187')});db[_0xbd21('0x11a')][_0xbd21('0x11f')](db[_0xbd21('0x16f')],{'through':'whatsapp_interaction_has_tags','as':_0xbd21('0x170')});db['WhatsappInteraction'][_0xbd21('0x11f')](db[_0xbd21('0xf')],{'as':_0xbd21('0x17f'),'through':_0xbd21('0x12f'),'foreignKey':_0xbd21('0x1f1')});db['WhatsappMessage'][_0xbd21('0x152')](db[_0xbd21('0xf')],{'as':'User'});db[_0xbd21('0xff')][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'onDelete':'cascade','as':_0xbd21('0x16c')});db['WhatsappMessage'][_0xbd21('0x152')](db[_0xbd21('0x11a')],{'onDelete':_0xbd21('0x10d'),'as':_0xbd21('0x173'),'foreignKey':'WhatsappInteractionId'});db[_0xbd21('0xff')][_0xbd21('0x152')](db[_0xbd21('0x144')],{'as':_0xbd21('0x16a'),'foreignKey':_0xbd21('0x1ef')});db[_0xbd21('0x101')][_0xbd21('0x152')](db['WhatsappAccount'],{});db[_0xbd21('0x101')]['belongsTo'](db['CmList'],{'as':_0xbd21('0x177'),'foreignKey':_0xbd21('0x178')});db[_0xbd21('0x101')][_0xbd21('0x152')](db[_0xbd21('0x16b')],{'as':_0xbd21('0x16c'),'foreignKey':_0xbd21('0x15f')});db[_0xbd21('0x101')][_0xbd21('0x152')](db[_0xbd21('0x11a')],{});db[_0xbd21('0x101')]['belongsTo'](db[_0xbd21('0x137')],{});db[_0xbd21('0x101')][_0xbd21('0x152')](db[_0xbd21('0xff')],{});db[_0xbd21('0x101')][_0xbd21('0x152')](db[_0xbd21('0xf')],{});db[_0xbd21('0x1f2')][_0xbd21('0x152')](db[_0xbd21('0xff')],{});db[_0xbd21('0x1f2')][_0xbd21('0x152')](db[_0xbd21('0x11a')],{});db[_0xbd21('0x1f2')][_0xbd21('0x152')](db[_0xbd21('0x144')],{'foreignKey':_0xbd21('0x1f3'),'as':_0xbd21('0x1da')});db[_0xbd21('0x1f2')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xbd21('0x1f4'),'as':_0xbd21('0x1df')});db[_0xbd21('0x1f2')]['belongsTo'](db[_0xbd21('0x137')],{'foreignKey':_0xbd21('0x1f5'),'as':'ToQueue'});db[_0xbd21('0x1f2')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'foreignKey':_0xbd21('0x1db'),'as':_0xbd21('0x1e1')});db[_0xbd21('0x1f2')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'foreignKey':_0xbd21('0x1dc'),'as':_0xbd21('0x1dd')});db[_0xbd21('0x137')][_0xbd21('0x11f')](db['User'],{'as':_0xbd21('0x156'),'through':_0xbd21('0x35'),'foreignKey':_0xbd21('0x1f6')});db[_0xbd21('0x137')]['belongsToMany'](db[_0xbd21('0xe7')],{'through':_0xbd21('0x1d3'),'as':_0xbd21('0x157')});db[_0xbd21('0x10e')][_0xbd21('0x152')](db[_0xbd21('0xf')],{'as':_0xbd21('0x1f7'),'foreignKey':_0xbd21('0x111'),'onDelete':'cascade','hooks':!![]});db['CloudProvider'][_0xbd21('0x10b')](db[_0xbd21('0xc4')],{'as':_0xbd21('0xc4'),'onDelete':_0xbd21('0x162')});db[_0xbd21('0x104')][_0xbd21('0x10b')](db[_0xbd21('0x36')],{'as':_0xbd21('0x163'),'onDelete':_0xbd21('0x162')});db[_0xbd21('0x104')][_0xbd21('0x10b')](db[_0xbd21('0x38')],{'as':_0xbd21('0x164'),'onDelete':_0xbd21('0x162')});module[_0xbd21('0x1f8')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 0185380..bae6f41 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1fb=['./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','/api/auth/local','/api/auth/google','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.9.0','/server/files/plugins','route','get','sendFile','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','./api/user','use','/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/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','/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/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','/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/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./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/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts'];(function(_0x5804c8,_0x57af4d){var _0x33d432=function(_0x3510ac){while(--_0x3510ac){_0x5804c8['push'](_0x5804c8['shift']());}};_0x33d432(++_0x57af4d);}(_0xb1fb,0x69));var _0xbb1f=function(_0x466e21,_0x44d30c){_0x466e21=_0x466e21-0x0;var _0x80c484=_0xb1fb[_0x466e21];return _0x80c484;};'use strict';var path=require(_0xbb1f('0x0'));var express=require(_0xbb1f('0x1'));var errors=require(_0xbb1f('0x2'));var config=require(_0xbb1f('0x3'));var setupLoggers=require(_0xbb1f('0x4'))[_0xbb1f('0x5')];var clientSideLogs=require(_0xbb1f('0x6'));exports[_0xbb1f('0x7')]=function(_0x510582){return setupLoggers(_0x510582)[_0xbb1f('0x8')](function(){_0x510582['use']('/api/users',require(_0xbb1f('0x9')));_0x510582[_0xbb1f('0xa')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xb'),require(_0xbb1f('0xc')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xd'),require(_0xbb1f('0xe')));_0x510582['use']('/api/voice/mohs',require(_0xbb1f('0xf')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x10'),require(_0xbb1f('0x11')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x12'),require(_0xbb1f('0x13')));_0x510582[_0xbb1f('0xa')]('/api/screen/recordings',require(_0xbb1f('0x14')));_0x510582[_0xbb1f('0xa')]('/api/voice/mails',require(_0xbb1f('0x15')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x16'),require(_0xbb1f('0x17')));_0x510582['use'](_0xbb1f('0x18'),require(_0xbb1f('0x19')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x1a'),require('./api/voiceDialReport'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x1b'),require(_0xbb1f('0x1c')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x1d'),require(_0xbb1f('0x1e')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x1f'),require(_0xbb1f('0x20')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x21'),require(_0xbb1f('0x22')));_0x510582[_0xbb1f('0xa')]('/api/voice/transfers/reports',require(_0xbb1f('0x23')));_0x510582[_0xbb1f('0xa')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x24'),require(_0xbb1f('0x25')));_0x510582[_0xbb1f('0xa')]('/api/mail/queues',require('./api/mailQueue'));_0x510582[_0xbb1f('0xa')]('/api/mail/substatuses',require(_0xbb1f('0x26')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x27'),require(_0xbb1f('0x28')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x29'),require('./api/mailMessage'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x2a'),require(_0xbb1f('0x2b')));_0x510582['use']('/api/mail/reports/queue',require(_0xbb1f('0x2c')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x2d'),require(_0xbb1f('0x2e')));_0x510582[_0xbb1f('0xa')]('/api/dashboards/items',require(_0xbb1f('0x2f')));_0x510582[_0xbb1f('0xa')]('/api/fax/accounts',require('./api/faxAccount'));_0x510582['use'](_0xbb1f('0x30'),require('./api/faxApplication'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x31'),require(_0xbb1f('0x32')));_0x510582['use'](_0xbb1f('0x33'),require('./api/faxMessage'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x34'),require(_0xbb1f('0x35')));_0x510582['use']('/api/fax/reports/queue',require(_0xbb1f('0x36')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x37'),require(_0xbb1f('0x38')));_0x510582['use'](_0xbb1f('0x39'),require(_0xbb1f('0x3a')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x3b'),require(_0xbb1f('0x3c')));_0x510582[_0xbb1f('0xa')]('/api/sms/messages',require(_0xbb1f('0x3d')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x3e'),require('./api/smsQueue'));_0x510582['use'](_0xbb1f('0x3f'),require(_0xbb1f('0x40')));_0x510582['use'](_0xbb1f('0x41'),require(_0xbb1f('0x42')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x43'),require(_0xbb1f('0x44')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x45'),require(_0xbb1f('0x46')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x47'),require(_0xbb1f('0x48')));_0x510582[_0xbb1f('0xa')]('/api/chat/websites',require('./api/chatWebsite'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x49'),require(_0xbb1f('0x4a')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x4b'),require(_0xbb1f('0x4c')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x4d'),require('./api/chatInteraction'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x4e'),require(_0xbb1f('0x4f')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x50'),require('./api/chatOfflineMessage'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x51'),require(_0xbb1f('0x52')));_0x510582[_0xbb1f('0xa')]('/api/chat/groups',require('./api/chatGroup'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x53'),require('./api/chatProactiveAction'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x54'),require(_0xbb1f('0x55')));_0x510582[_0xbb1f('0xa')]('/api/cm/contacts',require(_0xbb1f('0x56')));_0x510582['use'](_0xbb1f('0x57'),require('./api/cmHopper'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x58'),require(_0xbb1f('0x59')));_0x510582['use']('/api/cm/hopper_final',require(_0xbb1f('0x5a')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x5b'),require(_0xbb1f('0x5c')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x5d'),require(_0xbb1f('0x5e')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x5f'),require(_0xbb1f('0x60')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x61'),require(_0xbb1f('0x62')));_0x510582['use'](_0xbb1f('0x63'),require(_0xbb1f('0x64')));_0x510582['use']('/api/dispositions',require(_0xbb1f('0x65')));_0x510582['use'](_0xbb1f('0x66'),require(_0xbb1f('0x67')));_0x510582['use'](_0xbb1f('0x68'),require('./api/interval'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x69'),require(_0xbb1f('0x6a')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x6b'),require('./api/cdr'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x6c'),require('./api/voiceQueuesLog'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x6d'),require(_0xbb1f('0x6e')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x6f'),require(_0xbb1f('0x70')));_0x510582[_0xbb1f('0xa')]('/api/tags',require(_0xbb1f('0x71')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x72'),require(_0xbb1f('0x73')));_0x510582['use'](_0xbb1f('0x74'),require(_0xbb1f('0x75')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x76'),require(_0xbb1f('0x77')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x78'),require(_0xbb1f('0x79')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x7a'),require(_0xbb1f('0x7b')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x7c'),require(_0xbb1f('0x7d')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x7e'),require(_0xbb1f('0x7f')));_0x510582['use'](_0xbb1f('0x80'),require(_0xbb1f('0x81')));_0x510582[_0xbb1f('0xa')]('/api/analytics/custom_reports',require(_0xbb1f('0x82')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x83'),require('./api/analyticDefaultReport'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x84'),require(_0xbb1f('0x85')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x86'),require('./api/analyticMetric'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x87'),require(_0xbb1f('0x88')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x89'),require('./api/analyticTreeReport'));_0x510582[_0xbb1f('0xa')]('/api/integrations/salesforce/accounts',require(_0xbb1f('0x8a')));_0x510582['use'](_0xbb1f('0x8b'),require(_0xbb1f('0x8c')));_0x510582[_0xbb1f('0xa')]('/api/integrations/salesforce/fields',require(_0xbb1f('0x8d')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x8e'),require('./api/intSugarcrmAccount'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x8f'),require(_0xbb1f('0x90')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x91'),require(_0xbb1f('0x92')));_0x510582['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x93'),require('./api/intDeskConfiguration'));_0x510582[_0xbb1f('0xa')]('/api/integrations/desk/fields',require(_0xbb1f('0x94')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x95'),require(_0xbb1f('0x96')));_0x510582[_0xbb1f('0xa')]('/api/integrations/zoho/configurations',require(_0xbb1f('0x97')));_0x510582[_0xbb1f('0xa')]('/api/integrations/zoho/fields',require(_0xbb1f('0x98')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x99'),require(_0xbb1f('0x9a')));_0x510582[_0xbb1f('0xa')]('/api/integrations/zendesk/configurations',require(_0xbb1f('0x9b')));_0x510582['use'](_0xbb1f('0x9c'),require('./api/intZendeskField'));_0x510582['use']('/api/integrations/freshdesk/accounts',require(_0xbb1f('0x9d')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x9e'),require(_0xbb1f('0x9f')));_0x510582['use'](_0xbb1f('0xa0'),require(_0xbb1f('0xa1')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xa2'),require(_0xbb1f('0xa3')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xa4'),require(_0xbb1f('0xa5')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xa6'),require(_0xbb1f('0xa7')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xa8'),require(_0xbb1f('0xa9')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xaa'),require(_0xbb1f('0xab')));_0x510582[_0xbb1f('0xa')]('/api/integrations/servicenow/fields',require(_0xbb1f('0xac')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xad'),require(_0xbb1f('0xae')));_0x510582['use']('/api/integrations/dynamics365/configurations',require(_0xbb1f('0xaf')));_0x510582[_0xbb1f('0xa')]('/api/integrations/dynamics365/fields',require(_0xbb1f('0xb0')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xb1'),require('./api/intFreshsalesAccount'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xb2'),require(_0xbb1f('0xb3')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xb4'),require(_0xbb1f('0xb5')));_0x510582['use']('/api/networks',require(_0xbb1f('0xb6')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xb7'),require(_0xbb1f('0xb8')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xb9'),require(_0xbb1f('0xba')));_0x510582['use'](_0xbb1f('0xbb'),require(_0xbb1f('0xbc')));_0x510582['use'](_0xbb1f('0xbd'),require(_0xbb1f('0xbe')));_0x510582['use'](_0xbb1f('0xbf'),require(_0xbb1f('0xc0')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xc1'),require(_0xbb1f('0xc2')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xc3'),require(_0xbb1f('0xc4')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xc5'),require('./api/squareReportDetail'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xc6'),require(_0xbb1f('0xc7')));_0x510582['use'](_0xbb1f('0xc8'),require(_0xbb1f('0xc9')));_0x510582['use']('/api/square/odbc',require(_0xbb1f('0xca')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xcb'),require(_0xbb1f('0xcc')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xcd'),require(_0xbb1f('0xce')));_0x510582[_0xbb1f('0xa')]('/api/square/messages',require(_0xbb1f('0xcf')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xd0'),require(_0xbb1f('0xd1')));_0x510582['use'](_0xbb1f('0xd2'),require(_0xbb1f('0xd3')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xd4'),require('./api/campaign'));_0x510582['use'](_0xbb1f('0xd5'),require(_0xbb1f('0xd6')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xd7'),require(_0xbb1f('0xd8')));_0x510582[_0xbb1f('0xa')]('/api/plugins',require('./api/plugin'));_0x510582[_0xbb1f('0xa')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xd9'),require('./api/chatTransferReport'));_0x510582['use'](_0xbb1f('0xda'),require(_0xbb1f('0xdb')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xdc'),require(_0xbb1f('0xdd')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xde'),require('./api/smsTransferReport'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xdf'),require('./api/cmList'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xe0'),require(_0xbb1f('0xe1')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xe2'),require(_0xbb1f('0xe3')));_0x510582[_0xbb1f('0xa')]('/api/userProfile/sections',require(_0xbb1f('0xe4')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xe5'),require(_0xbb1f('0xe6')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xe7'),require(_0xbb1f('0xe8')));_0x510582['use'](_0xbb1f('0xe9'),require(_0xbb1f('0xea')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xeb'),require(_0xbb1f('0xec')));_0x510582['use'](_0xbb1f('0xed'),require(_0xbb1f('0xee')));_0x510582[_0xbb1f('0xa')]('/api/whatsapp/messages',require(_0xbb1f('0xef')));_0x510582[_0xbb1f('0xa')]('/api/whatsapp/reports/queue',require(_0xbb1f('0xf0')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xf1'),require('./api/whatsappTransferReport'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xf2'),require(_0xbb1f('0xf3')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xf4'),require(_0xbb1f('0xf5')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xf6'),require(_0xbb1f('0xf7')));_0x510582['use'](_0xbb1f('0xf8'),require(_0xbb1f('0xf9')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xfa'),require('./api/mailInteractionHasTag'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xfb'),require('./api/authLocal'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xfc'),require('./api/authGoogle'));_0x510582['use']('/api/auth/activedirectory',require(_0xbb1f('0xfd')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0xfe'),require(_0xbb1f('0xff')));_0x510582['use'](_0xbb1f('0x100'),require(_0xbb1f('0x101')));_0x510582['use'](_0xbb1f('0x102'),require(_0xbb1f('0x103')));_0x510582[_0xbb1f('0xa')]('/api/system',require(_0xbb1f('0x104')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x105'),require(_0xbb1f('0x106')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x107'),require('./api/webbar'));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x108'),clientSideLogs);_0x510582[_0xbb1f('0xa')](_0xbb1f('0x109'),express[_0xbb1f('0x10a')](path[_0xbb1f('0x10b')](config[_0xbb1f('0x10c')],'/apidoc')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x10d'),express[_0xbb1f('0x10a')](path['join'](config[_0xbb1f('0x10c')],'/www')));_0x510582[_0xbb1f('0xa')](_0xbb1f('0x10e'),express['static'](path[_0xbb1f('0x10b')](config['root'],_0xbb1f('0x10e'))));_0x510582['use'](_0xbb1f('0x10f'),express[_0xbb1f('0x10a')](path[_0xbb1f('0x10b')](config[_0xbb1f('0x10c')],_0xbb1f('0x110'),_0xbb1f('0x111'))));_0x510582[_0xbb1f('0xa')]('/plugins',express['static'](path[_0xbb1f('0x10b')](config[_0xbb1f('0x10c')],_0xbb1f('0x112'))));_0x510582[_0xbb1f('0x113')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xbb1f('0x114')](errors[0x194]);_0x510582['route']('/*')[_0xbb1f('0x114')](function(_0x57ec43,_0x5df6ef){_0x5df6ef[_0xbb1f('0x115')](path['resolve'](_0x510582[_0xbb1f('0x114')](_0xbb1f('0x116'))+'/index.html'));});return _0x510582;});}; \ No newline at end of file +var _0x409e=['./api/schedule','/api/sounds','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/vtiger/accounts','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/chat/reports/queue','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/mailInteractionHasTag','/api/auth/local','/api/auth/google','/api/auth/activedirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','/apidoc','/www','root','join','/demo','/snippet','snippet','3.9.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./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/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules'];(function(_0x592b35,_0x2d9892){var _0x59b1c7=function(_0x35b250){while(--_0x35b250){_0x592b35['push'](_0x592b35['shift']());}};_0x59b1c7(++_0x2d9892);}(_0x409e,0x1ac));var _0xe409=function(_0x1bd230,_0x1da01e){_0x1bd230=_0x1bd230-0x0;var _0x19a3e3=_0x409e[_0x1bd230];return _0x19a3e3;};'use strict';var path=require(_0xe409('0x0'));var express=require(_0xe409('0x1'));var errors=require(_0xe409('0x2'));var config=require(_0xe409('0x3'));var setupLoggers=require(_0xe409('0x4'))[_0xe409('0x5')];var clientSideLogs=require(_0xe409('0x6'));exports[_0xe409('0x7')]=function(_0x506cd2){return setupLoggers(_0x506cd2)[_0xe409('0x8')](function(){_0x506cd2[_0xe409('0x9')]('/api/users',require(_0xe409('0xa')));_0x506cd2['use'](_0xe409('0xb'),require(_0xe409('0xc')));_0x506cd2[_0xe409('0x9')](_0xe409('0xd'),require(_0xe409('0xe')));_0x506cd2[_0xe409('0x9')](_0xe409('0xf'),require(_0xe409('0x10')));_0x506cd2[_0xe409('0x9')](_0xe409('0x11'),require(_0xe409('0x12')));_0x506cd2['use'](_0xe409('0x13'),require(_0xe409('0x14')));_0x506cd2[_0xe409('0x9')](_0xe409('0x15'),require(_0xe409('0x16')));_0x506cd2[_0xe409('0x9')](_0xe409('0x17'),require('./api/screenRecording'));_0x506cd2[_0xe409('0x9')](_0xe409('0x18'),require('./api/voiceMail'));_0x506cd2[_0xe409('0x9')](_0xe409('0x19'),require(_0xe409('0x1a')));_0x506cd2[_0xe409('0x9')](_0xe409('0x1b'),require(_0xe409('0x1c')));_0x506cd2[_0xe409('0x9')]('/api/voice/dials/reports',require(_0xe409('0x1d')));_0x506cd2['use']('/api/voice/agents/reports',require(_0xe409('0x1e')));_0x506cd2['use'](_0xe409('0x1f'),require('./api/voiceQueueReport'));_0x506cd2[_0xe409('0x9')](_0xe409('0x20'),require(_0xe409('0x21')));_0x506cd2[_0xe409('0x9')](_0xe409('0x22'),require('./api/trunk'));_0x506cd2[_0xe409('0x9')](_0xe409('0x23'),require(_0xe409('0x24')));_0x506cd2[_0xe409('0x9')](_0xe409('0x25'),require(_0xe409('0x26')));_0x506cd2[_0xe409('0x9')]('/api/mail/accounts',require(_0xe409('0x27')));_0x506cd2['use'](_0xe409('0x28'),require('./api/mailQueue'));_0x506cd2['use'](_0xe409('0x29'),require(_0xe409('0x2a')));_0x506cd2[_0xe409('0x9')](_0xe409('0x2b'),require('./api/mailInteraction'));_0x506cd2[_0xe409('0x9')](_0xe409('0x2c'),require(_0xe409('0x2d')));_0x506cd2[_0xe409('0x9')](_0xe409('0x2e'),require('./api/mailApplication'));_0x506cd2[_0xe409('0x9')](_0xe409('0x2f'),require('./api/mailQueueReport'));_0x506cd2[_0xe409('0x9')]('/api/dashboards',require(_0xe409('0x30')));_0x506cd2[_0xe409('0x9')](_0xe409('0x31'),require('./api/dashboardItem'));_0x506cd2[_0xe409('0x9')](_0xe409('0x32'),require(_0xe409('0x33')));_0x506cd2[_0xe409('0x9')](_0xe409('0x34'),require(_0xe409('0x35')));_0x506cd2[_0xe409('0x9')](_0xe409('0x36'),require('./api/faxInteraction'));_0x506cd2['use'](_0xe409('0x37'),require(_0xe409('0x38')));_0x506cd2[_0xe409('0x9')](_0xe409('0x39'),require(_0xe409('0x3a')));_0x506cd2['use']('/api/fax/reports/queue',require(_0xe409('0x3b')));_0x506cd2[_0xe409('0x9')](_0xe409('0x3c'),require(_0xe409('0x3d')));_0x506cd2[_0xe409('0x9')]('/api/sms/applications',require(_0xe409('0x3e')));_0x506cd2[_0xe409('0x9')](_0xe409('0x3f'),require(_0xe409('0x40')));_0x506cd2[_0xe409('0x9')](_0xe409('0x41'),require('./api/smsMessage'));_0x506cd2['use'](_0xe409('0x42'),require(_0xe409('0x43')));_0x506cd2[_0xe409('0x9')](_0xe409('0x44'),require(_0xe409('0x45')));_0x506cd2[_0xe409('0x9')]('/api/openchannel/applications',require(_0xe409('0x46')));_0x506cd2[_0xe409('0x9')](_0xe409('0x47'),require('./api/openchannelInteraction'));_0x506cd2['use'](_0xe409('0x48'),require(_0xe409('0x49')));_0x506cd2[_0xe409('0x9')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x506cd2[_0xe409('0x9')](_0xe409('0x4a'),require('./api/chatWebsite'));_0x506cd2[_0xe409('0x9')](_0xe409('0x4b'),require(_0xe409('0x4c')));_0x506cd2[_0xe409('0x9')](_0xe409('0x4d'),require(_0xe409('0x4e')));_0x506cd2[_0xe409('0x9')](_0xe409('0x4f'),require(_0xe409('0x50')));_0x506cd2[_0xe409('0x9')](_0xe409('0x51'),require('./api/chatMessage'));_0x506cd2[_0xe409('0x9')](_0xe409('0x52'),require(_0xe409('0x53')));_0x506cd2[_0xe409('0x9')](_0xe409('0x54'),require(_0xe409('0x55')));_0x506cd2['use'](_0xe409('0x56'),require(_0xe409('0x57')));_0x506cd2[_0xe409('0x9')](_0xe409('0x58'),require('./api/chatProactiveAction'));_0x506cd2[_0xe409('0x9')](_0xe409('0x59'),require(_0xe409('0x5a')));_0x506cd2['use'](_0xe409('0x5b'),require('./api/cmContact'));_0x506cd2['use'](_0xe409('0x5c'),require('./api/cmHopper'));_0x506cd2[_0xe409('0x9')]('/api/cm/hopper_black',require(_0xe409('0x5d')));_0x506cd2[_0xe409('0x9')](_0xe409('0x5e'),require(_0xe409('0x5f')));_0x506cd2[_0xe409('0x9')](_0xe409('0x60'),require(_0xe409('0x61')));_0x506cd2[_0xe409('0x9')](_0xe409('0x62'),require(_0xe409('0x63')));_0x506cd2['use'](_0xe409('0x64'),require(_0xe409('0x65')));_0x506cd2[_0xe409('0x9')](_0xe409('0x66'),require(_0xe409('0x67')));_0x506cd2[_0xe409('0x9')]('/api/canned_answers',require('./api/cannedAnswer'));_0x506cd2[_0xe409('0x9')](_0xe409('0x68'),require(_0xe409('0x69')));_0x506cd2[_0xe409('0x9')]('/api/conditions',require(_0xe409('0x6a')));_0x506cd2[_0xe409('0x9')](_0xe409('0x6b'),require(_0xe409('0x6c')));_0x506cd2['use'](_0xe409('0x6d'),require(_0xe409('0x6e')));_0x506cd2[_0xe409('0x9')](_0xe409('0x6f'),require(_0xe409('0x70')));_0x506cd2[_0xe409('0x9')](_0xe409('0x71'),require(_0xe409('0x72')));_0x506cd2[_0xe409('0x9')](_0xe409('0x73'),require(_0xe409('0x74')));_0x506cd2[_0xe409('0x9')](_0xe409('0x75'),require('./api/sound'));_0x506cd2[_0xe409('0x9')]('/api/tags',require('./api/tag'));_0x506cd2[_0xe409('0x9')](_0xe409('0x76'),require(_0xe409('0x77')));_0x506cd2['use'](_0xe409('0x78'),require(_0xe409('0x79')));_0x506cd2[_0xe409('0x9')](_0xe409('0x7a'),require(_0xe409('0x7b')));_0x506cd2[_0xe409('0x9')](_0xe409('0x7c'),require(_0xe409('0x7d')));_0x506cd2[_0xe409('0x9')](_0xe409('0x7e'),require(_0xe409('0x7f')));_0x506cd2[_0xe409('0x9')](_0xe409('0x80'),require(_0xe409('0x81')));_0x506cd2['use'](_0xe409('0x82'),require('./api/integration'));_0x506cd2[_0xe409('0x9')]('/api/integrations/reports',require('./api/integrationReport'));_0x506cd2[_0xe409('0x9')]('/api/analytics/custom_reports',require(_0xe409('0x83')));_0x506cd2['use'](_0xe409('0x84'),require(_0xe409('0x85')));_0x506cd2['use'](_0xe409('0x86'),require(_0xe409('0x87')));_0x506cd2[_0xe409('0x9')]('/api/analytics/metrics',require(_0xe409('0x88')));_0x506cd2[_0xe409('0x9')]('/api/analytics/field_reports',require(_0xe409('0x89')));_0x506cd2[_0xe409('0x9')](_0xe409('0x8a'),require(_0xe409('0x8b')));_0x506cd2['use'](_0xe409('0x8c'),require(_0xe409('0x8d')));_0x506cd2[_0xe409('0x9')]('/api/integrations/salesforce/configurations',require(_0xe409('0x8e')));_0x506cd2['use']('/api/integrations/salesforce/fields',require(_0xe409('0x8f')));_0x506cd2[_0xe409('0x9')]('/api/integrations/sugarcrm/accounts',require(_0xe409('0x90')));_0x506cd2[_0xe409('0x9')]('/api/integrations/sugarcrm/configurations',require(_0xe409('0x91')));_0x506cd2[_0xe409('0x9')](_0xe409('0x92'),require(_0xe409('0x93')));_0x506cd2[_0xe409('0x9')]('/api/integrations/desk/accounts',require(_0xe409('0x94')));_0x506cd2[_0xe409('0x9')](_0xe409('0x95'),require(_0xe409('0x96')));_0x506cd2['use']('/api/integrations/desk/fields',require(_0xe409('0x97')));_0x506cd2['use'](_0xe409('0x98'),require('./api/intZohoAccount'));_0x506cd2[_0xe409('0x9')](_0xe409('0x99'),require(_0xe409('0x9a')));_0x506cd2[_0xe409('0x9')]('/api/integrations/zoho/fields',require(_0xe409('0x9b')));_0x506cd2['use'](_0xe409('0x9c'),require(_0xe409('0x9d')));_0x506cd2[_0xe409('0x9')](_0xe409('0x9e'),require(_0xe409('0x9f')));_0x506cd2['use']('/api/integrations/zendesk/fields',require(_0xe409('0xa0')));_0x506cd2[_0xe409('0x9')](_0xe409('0xa1'),require(_0xe409('0xa2')));_0x506cd2['use'](_0xe409('0xa3'),require(_0xe409('0xa4')));_0x506cd2[_0xe409('0x9')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x506cd2[_0xe409('0x9')](_0xe409('0xa5'),require('./api/intVtigerAccount'));_0x506cd2[_0xe409('0x9')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x506cd2[_0xe409('0x9')]('/api/integrations/vtiger/fields',require(_0xe409('0xa6')));_0x506cd2[_0xe409('0x9')](_0xe409('0xa7'),require(_0xe409('0xa8')));_0x506cd2[_0xe409('0x9')](_0xe409('0xa9'),require('./api/intServicenowConfiguration'));_0x506cd2[_0xe409('0x9')](_0xe409('0xaa'),require(_0xe409('0xab')));_0x506cd2[_0xe409('0x9')]('/api/integrations/dynamics365/accounts',require(_0xe409('0xac')));_0x506cd2['use'](_0xe409('0xad'),require('./api/intDynamics365Configuration'));_0x506cd2[_0xe409('0x9')](_0xe409('0xae'),require(_0xe409('0xaf')));_0x506cd2[_0xe409('0x9')]('/api/integrations/freshsales/accounts',require(_0xe409('0xb0')));_0x506cd2[_0xe409('0x9')](_0xe409('0xb1'),require(_0xe409('0xb2')));_0x506cd2[_0xe409('0x9')]('/api/integrations/freshsales/fields',require(_0xe409('0xb3')));_0x506cd2['use']('/api/networks',require('./api/network'));_0x506cd2[_0xe409('0x9')](_0xe409('0xb4'),require('./api/chatQueueReport'));_0x506cd2[_0xe409('0x9')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x506cd2[_0xe409('0x9')](_0xe409('0xb5'),require(_0xe409('0xb6')));_0x506cd2[_0xe409('0x9')](_0xe409('0xb7'),require(_0xe409('0xb8')));_0x506cd2[_0xe409('0x9')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x506cd2[_0xe409('0x9')](_0xe409('0xb9'),require('./api/smsQueueReport'));_0x506cd2['use'](_0xe409('0xba'),require(_0xe409('0xbb')));_0x506cd2[_0xe409('0x9')](_0xe409('0xbc'),require(_0xe409('0xbd')));_0x506cd2[_0xe409('0x9')](_0xe409('0xbe'),require(_0xe409('0xbf')));_0x506cd2[_0xe409('0x9')]('/api/settings',require('./api/setting'));_0x506cd2['use']('/api/square/odbc',require(_0xe409('0xc0')));_0x506cd2[_0xe409('0x9')](_0xe409('0xc1'),require(_0xe409('0xc2')));_0x506cd2[_0xe409('0x9')](_0xe409('0xc3'),require('./api/squareRecording'));_0x506cd2['use']('/api/square/messages',require('./api/squareMessage'));_0x506cd2[_0xe409('0x9')](_0xe409('0xc4'),require(_0xe409('0xc5')));_0x506cd2[_0xe409('0x9')](_0xe409('0xc6'),require(_0xe409('0xc7')));_0x506cd2['use'](_0xe409('0xc8'),require(_0xe409('0xc9')));_0x506cd2[_0xe409('0x9')](_0xe409('0xca'),require('./api/migration'));_0x506cd2[_0xe409('0x9')](_0xe409('0xcb'),require(_0xe409('0xcc')));_0x506cd2['use']('/api/plugins',require('./api/plugin'));_0x506cd2[_0xe409('0x9')](_0xe409('0xcd'),require('./api/mailTransferReport'));_0x506cd2['use'](_0xe409('0xce'),require(_0xe409('0xcf')));_0x506cd2['use'](_0xe409('0xd0'),require(_0xe409('0xd1')));_0x506cd2['use'](_0xe409('0xd2'),require(_0xe409('0xd3')));_0x506cd2['use'](_0xe409('0xd4'),require(_0xe409('0xd5')));_0x506cd2['use'](_0xe409('0xd6'),require(_0xe409('0xd7')));_0x506cd2[_0xe409('0x9')](_0xe409('0xd8'),require('./api/voicePrefix'));_0x506cd2[_0xe409('0x9')](_0xe409('0xd9'),require(_0xe409('0xda')));_0x506cd2[_0xe409('0x9')](_0xe409('0xdb'),require(_0xe409('0xdc')));_0x506cd2[_0xe409('0x9')](_0xe409('0xdd'),require(_0xe409('0xde')));_0x506cd2['use'](_0xe409('0xdf'),require(_0xe409('0xe0')));_0x506cd2[_0xe409('0x9')](_0xe409('0xe1'),require(_0xe409('0xe2')));_0x506cd2[_0xe409('0x9')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x506cd2['use']('/api/whatsapp/interactions',require(_0xe409('0xe3')));_0x506cd2['use'](_0xe409('0xe4'),require('./api/whatsappMessage'));_0x506cd2[_0xe409('0x9')](_0xe409('0xe5'),require(_0xe409('0xe6')));_0x506cd2[_0xe409('0x9')](_0xe409('0xe7'),require(_0xe409('0xe8')));_0x506cd2['use'](_0xe409('0xe9'),require(_0xe409('0xea')));_0x506cd2[_0xe409('0x9')](_0xe409('0xeb'),require(_0xe409('0xec')));_0x506cd2[_0xe409('0x9')](_0xe409('0xed'),require(_0xe409('0xee')));_0x506cd2[_0xe409('0x9')](_0xe409('0xef'),require('./api/user-setting'));_0x506cd2['use']('/api/mail_interaction_has_tags',require(_0xe409('0xf0')));_0x506cd2['use'](_0xe409('0xf1'),require('./api/authLocal'));_0x506cd2[_0xe409('0x9')](_0xe409('0xf2'),require('./api/authGoogle'));_0x506cd2['use'](_0xe409('0xf3'),require('./api/authActiveDirectory'));_0x506cd2[_0xe409('0x9')](_0xe409('0xf4'),require(_0xe409('0xf5')));_0x506cd2['use']('/api/rpc',require(_0xe409('0xf6')));_0x506cd2[_0xe409('0x9')](_0xe409('0xf7'),require(_0xe409('0xf8')));_0x506cd2[_0xe409('0x9')](_0xe409('0xf9'),require('./api/system'));_0x506cd2[_0xe409('0x9')]('/api/pm2',require(_0xe409('0xfa')));_0x506cd2[_0xe409('0x9')](_0xe409('0xfb'),require(_0xe409('0xfc')));_0x506cd2['use'](_0xe409('0xfd'),clientSideLogs);_0x506cd2[_0xe409('0x9')]('/apidoc',express[_0xe409('0xfe')](path['join'](config['root'],_0xe409('0xff'))));_0x506cd2[_0xe409('0x9')](_0xe409('0x100'),express['static'](path['join'](config[_0xe409('0x101')],_0xe409('0x100'))));_0x506cd2[_0xe409('0x9')]('/demo',express[_0xe409('0xfe')](path[_0xe409('0x102')](config[_0xe409('0x101')],_0xe409('0x103'))));_0x506cd2[_0xe409('0x9')](_0xe409('0x104'),express[_0xe409('0xfe')](path[_0xe409('0x102')](config[_0xe409('0x101')],_0xe409('0x105'),_0xe409('0x106'))));_0x506cd2[_0xe409('0x9')](_0xe409('0x107'),express[_0xe409('0xfe')](path[_0xe409('0x102')](config[_0xe409('0x101')],_0xe409('0x108'))));_0x506cd2[_0xe409('0x109')](_0xe409('0x10a'))[_0xe409('0x10b')](errors[0x194]);_0x506cd2[_0xe409('0x109')]('/*')[_0xe409('0x10b')](function(_0x28956c,_0x567d29){_0x567d29[_0xe409('0x10c')](path[_0xe409('0x10d')](_0x506cd2['get'](_0xe409('0x10e'))+_0xe409('0x10f')));});return _0x506cd2;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 2200b57..813a7ba 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83b3=['../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.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/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.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/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc'];(function(_0x51f156,_0x4ca398){var _0x21a5f7=function(_0x391a90){while(--_0x391a90){_0x51f156['push'](_0x51f156['shift']());}};_0x21a5f7(++_0x4ca398);}(_0x83b3,0x147));var _0x383b=function(_0x3694fb,_0x3d8f22){_0x3694fb=_0x3694fb-0x0;var _0x3e8f42=_0x83b3[_0x3694fb];return _0x3e8f42;};'use strict';var jayson=require(_0x383b('0x0'));var _=require(_0x383b('0x1'));var config=require(_0x383b('0x2'));exports[_0x383b('0x3')]=function(){return new Promise(function(_0x18acbd,_0x439bad){var _0x35c94b={};_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x5')));_0x35c94b=_['merge'](_0x35c94b,require('../api/voiceExtension/voiceExtension.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x6')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x7')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x8')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x9')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0xa')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0xb')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0xc')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/mailServerIn/mailServerIn.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0xd')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0xe')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/mailInteraction/mailInteraction.rpc'));_0x35c94b=_['merge'](_0x35c94b,require(_0x383b('0xf')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x10')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x11')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x12')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x13')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x14')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x15')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x16')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/smsAccount/smsAccount.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x17')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x18')));_0x35c94b=_['merge'](_0x35c94b,require(_0x383b('0x19')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x1a')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x1b')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x1c')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x1d')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x1e')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x1f')));_0x35c94b=_['merge'](_0x35c94b,require('../api/chatMessage/chatMessage.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x20')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x21')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x22')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x23')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x24')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x25')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x26')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/pause/pause.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x27')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x28')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/template/template.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x29')));_0x35c94b=_['merge'](_0x35c94b,require(_0x383b('0x2a')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x2b')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x2c')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x2d')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x2e')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x2f')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x30')));_0x35c94b=_['merge'](_0x35c94b,require(_0x383b('0x31')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x32')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x33')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x34')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x35')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x36')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x37')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x38')));_0x35c94b=_['merge'](_0x35c94b,require(_0x383b('0x39')));_0x35c94b=_['merge'](_0x35c94b,require(_0x383b('0x3a')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x3b')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/attachment/attachment.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x3c')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x3d')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require(_0x383b('0x3e')));_0x35c94b=_[_0x383b('0x4')](_0x35c94b,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x420f2d=jayson[_0x383b('0x3f')](_0x35c94b)['http']();var _0x2aa654=config[_0x383b('0x40')][_0x383b('0x41')]||config[_0x383b('0x41')]+0x1;var _0x4f1f73=config[_0x383b('0x40')]['ip']||_0x383b('0x42');_0x420f2d['on'](_0x383b('0x43'),function(_0x4c2e3b){return _0x439bad(_0x4c2e3b);});_0x420f2d[_0x383b('0x3')](_0x2aa654,_0x4f1f73,function(){console['log'](_0x383b('0x44'),_0x4f1f73,_0x2aa654);require(_0x383b('0x45'))[_0x383b('0x46')]();return _0x18acbd(_0x383b('0x47')+_0x4f1f73+':'+_0x2aa654);});});}; \ No newline at end of file +var _0x71af=['../api/cmHopperHistory/cmHopperHistory.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/intDeskAccount/intDeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','rpc','port','localhost','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','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/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc'];(function(_0xfe5961,_0x5ec433){var _0x57fb6d=function(_0x3370fe){while(--_0x3370fe){_0xfe5961['push'](_0xfe5961['shift']());}};_0x57fb6d(++_0x5ec433);}(_0x71af,0x17d));var _0xf71a=function(_0x63b469,_0xbe0f2e){_0x63b469=_0x63b469-0x0;var _0x302d5c=_0x71af[_0x63b469];return _0x302d5c;};'use strict';var jayson=require(_0xf71a('0x0'));var _=require(_0xf71a('0x1'));var config=require(_0xf71a('0x2'));exports[_0xf71a('0x3')]=function(){return new Promise(function(_0x26f666,_0x6d2f41){var _0x21a214={};_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x5')));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0x6')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x7')));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0x8')));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0x9')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0xa')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0xb')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0xc')));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0xd')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0xe')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0xf')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x10')));_0x21a214=_['merge'](_0x21a214,require('../api/mailServerIn/mailServerIn.rpc'));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x11')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require('../api/mailQueue/mailQueue.rpc'));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x12')));_0x21a214=_['merge'](_0x21a214,require('../api/mailMessage/mailMessage.rpc'));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0x13')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x14')));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0x15')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require('../api/faxApplication/faxApplication.rpc'));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x16')));_0x21a214=_['merge'](_0x21a214,require('../api/faxMessage/faxMessage.rpc'));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x17')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x18')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x19')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x1a')));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0x1b')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x1c')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x1d')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x1e')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x1f')));_0x21a214=_['merge'](_0x21a214,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0x20')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x21')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require('../api/chatMessage/chatMessage.rpc'));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0x22')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x23')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x24')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x25')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x26')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x27')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x21a214=_['merge'](_0x21a214,require('../api/interval/interval.rpc'));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x28')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x29')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x2a')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x2b')));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0x2c')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x2d')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x2e')));_0x21a214=_['merge'](_0x21a214,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x2f')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x21a214=_['merge'](_0x21a214,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x30')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x31')));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0x32')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x33')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x21a214=_['merge'](_0x21a214,require('../api/squareReport/squareReport.rpc'));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0x34')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x35')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x36')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require('../api/squareRecording/squareRecording.rpc'));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x37')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x38')));_0x21a214=_['merge'](_0x21a214,require(_0xf71a('0x39')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x3a')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x3b')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x3c')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x3d')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require(_0xf71a('0x3e')));_0x21a214=_[_0xf71a('0x4')](_0x21a214,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x1d7962=jayson[_0xf71a('0x3f')](_0x21a214)['http']();var _0x2497be=config[_0xf71a('0x40')][_0xf71a('0x41')]||config[_0xf71a('0x41')]+0x1;var _0x49b674=config[_0xf71a('0x40')]['ip']||_0xf71a('0x42');_0x1d7962['on']('error',function(_0x7a07db){return _0x6d2f41(_0x7a07db);});_0x1d7962[_0xf71a('0x3')](_0x2497be,_0x49b674,function(){console['log'](_0xf71a('0x43'),_0x49b674,_0x2497be);require(_0xf71a('0x44'))[_0xf71a('0x45')]();return _0x26f666('RPC\x20listening\x20on\x20'+_0x49b674+':'+_0x2497be);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e2a43e8..4f8578a 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 _0x5396=['RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','no\x20code','replace','result=','substr','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','close','inherits','sendRequest','prototype','ANSWER','beep','format','noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x5396,0x134));var _0x6539=function(_0x47d10f,_0x44846c){_0x47d10f=_0x47d10f-0x0;var _0x1f06ac=_0x5396[_0x47d10f];return _0x1f06ac;};'use strict';var util=require(_0x6539('0x0'));var _=require(_0x6539('0x1'));var EventEmitter=require(_0x6539('0x2'))[_0x6539('0x3')];var AGIReply=require(_0x6539('0x4'));var AGIError=require(_0x6539('0x5'));function AGIChannel(_0x40a594){var _0x58a35f=this,_0x5bea39=new AGIReply(),_0x574389=![],_0x27972e={};EventEmitter[_0x6539('0x6')](_0x58a35f);_0x40a594[_0x6539('0x7')](_0x6539('0x8'));_0x40a594[_0x6539('0x9')](0x8*0x3c*0x3c*0x3e8);_0x5bea39[_0x6539('0x7')](_0x6539('0x8'));_0x5bea39['on'](_0x6539('0xa'),function(_0x2da1c8){for(var _0x4b9e75 in _0x2da1c8){_0x58a35f[_0x4b9e75]=_0x2da1c8[_0x4b9e75];}_0x58a35f[_0x6539('0xb')](_0x6539('0xc'));});_0x5bea39['on'](_0x6539('0xd'),function(_0xe7eeb0){if(_0xe7eeb0[_0x6539('0xe')]()=='hangup'){_0x58a35f[_0x6539('0xb')](_0x6539('0xf'));return;}if(_0xe7eeb0[_0x6539('0x10')](0x0,0xb)==_0x6539('0x11')){_0x574389=!![];}if(_0x574389){_0x27972e['rx']+=_0xe7eeb0+'\x0a';if(_0xe7eeb0[_0x6539('0x12')]('520\x20End\x20of\x20proper')!=-0x1){_0x574389=![];}}else{_0x27972e['rx']=_0xe7eeb0;}if(_0x574389){return;}if(typeof _0x27972e['cb']=='function'){var _0x470294=_0x27972e['rx'][_0x6539('0x10')](0x0,0x3),_0x438312=null,_0x50bb16=null;_0x470294=parseInt(_0x470294);if(isNaN(_0x470294)){_0x27972e['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6539('0x13')});return;}if(_0x470294!=0xc8){_0x27972e['cb'](null,{'code':_0x470294,'result':-0x1,'extra':'KO'});return;}_0x438312=_0x27972e['rx'][_0x6539('0x10')](0x4)[_0x6539('0x14')](_0x6539('0x15'),'');if(_0x438312['indexOf']('\x20')!=-0x1){_0x438312=_0x438312[_0x6539('0x16')](0x0,_0x438312[_0x6539('0x17')]('\x20'));}if(_[_0x6539('0x18')](_0x438312,'-1')){_0x438312=parseInt(_0x438312);}_0x50bb16=_0x27972e['rx']['split']('\x20');if(_0x50bb16[_0x6539('0x19')]==0x3){_0x50bb16=_0x50bb16[0x2][_0x6539('0x10')](0x1,_0x50bb16[0x2][_0x6539('0x19')]-0x1);}else if(_0x50bb16[_0x6539('0x19')]>0x3){var _0x6150f9=/\((.+)\)/;var _0x4b66e5=_0x27972e['rx'][_0x6539('0x1a')](_0x6150f9);if(_0x4b66e5){_0x50bb16=_0x4b66e5[0x1];}else{_0x50bb16=null;}}else{_0x50bb16=null;}_0x27972e['cb'](null,{'code':_0x470294,'result':_0x438312,'extra':_0x50bb16});}});_0x40a594['on'](_0x6539('0x1b'),function(_0x559a9e){_0x58a35f[_0x6539('0xb')](_0x6539('0x1b'),new AGIError(_0x6539('0x1c'),_0x559a9e[_0x6539('0x1d')]));});_0x40a594['on']('close',function(){_0x58a35f[_0x6539('0xb')]('close',new AGIError(_0x6539('0x1e')));});_0x40a594['on'](_0x6539('0x1f'),function(){_0x58a35f[_0x6539('0xb')]('timeout',new AGIError(_0x6539('0x20')));_0x40a594[_0x6539('0x21')]();});_0x40a594[_0x6539('0x22')](_0x5bea39);this['command']=function(_0x4c4c0b,_0x2b3409){var _0x4c4c0b=_0x4c4c0b||'',_0x2b3409=typeof _0x2b3409=='function'?_0x2b3409:new Function();_0x27972e={'tx':_0x4c4c0b,'rx':'','cb':_0x2b3409};_0x40a594[_0x6539('0x23')](_0x4c4c0b+'\x0a');},this[_0x6539('0x24')]=function(){_0x40a594[_0x6539('0x21')]();};}util[_0x6539('0x25')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x6539('0x26')]=function(_0x3721b6){return this['command']['sync'](this,_0x3721b6);};AGIChannel[_0x6539('0x27')]['answer']=function(){return this[_0x6539('0x26')](_0x6539('0x28'));};AGIChannel['prototype']['getData']=function(_0x54b51f,_0x1a626d,_0x6b9a7a){_0x54b51f=_0x54b51f===undefined?_0x6539('0x29'):_0x54b51f;_0x1a626d=_0x1a626d===undefined?'5':_0x1a626d;_0x6b9a7a=_0x6b9a7a===undefined?'1':_0x6b9a7a;return this[_0x6539('0x26')](util[_0x6539('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x54b51f,_0x1a626d*0x3e8,_0x6b9a7a));};AGIChannel['prototype'][_0x6539('0x2b')]=function(_0x1805d4){_0x1805d4=_0x1805d4||_0x6539('0x2c');return this['sendRequest'](util[_0x6539('0x2a')]('VERBOSE\x20\x22%s\x22',_0x1805d4));};AGIChannel[_0x6539('0x27')][_0x6539('0x2d')]=function(_0x5db5b6,_0x97f996){if(_[_0x6539('0x2e')](_0x97f996)){return this[_0x6539('0x26')](util[_0x6539('0x2a')](_0x6539('0x2f'),_0x5db5b6,_0x97f996[_0x6539('0x30')](',')));}return this['sendRequest'](util[_0x6539('0x2a')]('EXEC\x20%s\x20%s',_0x5db5b6,_0x97f996));};AGIChannel['prototype'][_0x6539('0x31')]=function(_0x51d36e){return this[_0x6539('0x26')](util[_0x6539('0x2a')]('SET\x20CONTEXT\x20%s',_0x51d36e));};AGIChannel['prototype'][_0x6539('0x32')]=function(_0xb86d94){return this['sendRequest'](util[_0x6539('0x2a')](_0x6539('0x33'),_0xb86d94));};AGIChannel[_0x6539('0x27')][_0x6539('0x34')]=function(_0x1f3e2f){return this[_0x6539('0x26')](util['format'](_0x6539('0x35'),_0x1f3e2f));};AGIChannel[_0x6539('0x27')]['hangup']=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x6539('0x27')]['setVariable']=function(_0x2bb7d2,_0x2189ca){var _0x43695d=_[_0x6539('0x36')](_0x2189ca)||_[_0x6539('0x37')](_0x2189ca)?_0x2189ca[_0x6539('0x38')]():_0x2189ca;return this[_0x6539('0x26')](util[_0x6539('0x2a')](_0x6539('0x39'),_0x2bb7d2,_0x43695d?_0x43695d[_0x6539('0x38')]()[_0x6539('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x6539('0x27')]['sayNumber']=function(_0x588195,_0x413e48){return this[_0x6539('0x26')](util[_0x6539('0x2a')](_0x6539('0x3a'),_0x588195,_0x413e48));};AGIChannel[_0x6539('0x27')][_0x6539('0x3b')]=function(_0x37ec63,_0x25247c){return this[_0x6539('0x26')](util[_0x6539('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x37ec63,_0x25247c));};AGIChannel['prototype']['sayPhonetic']=function(_0x7b9cf0,_0x8fd3d9){return this[_0x6539('0x26')](util[_0x6539('0x2a')](_0x6539('0x3c'),_0x7b9cf0,_0x8fd3d9));};AGIChannel[_0x6539('0x27')][_0x6539('0x3d')]=function(_0x56e233,_0x9b7ead,_0x24a5b3){_0x9b7ead=_0x9b7ead||this[_0x6539('0x3e')];_0x24a5b3=_0x24a5b3||0x1;this[_0x6539('0x31')](_0x56e233);this[_0x6539('0x32')](_0x9b7ead);this[_0x6539('0x34')](_0x24a5b3);return this[_0x6539('0x2b')](util[_0x6539('0x2a')](_0x6539('0x3f'),_0x56e233,_0x9b7ead,_0x24a5b3));};AGIChannel[_0x6539('0x27')][_0x6539('0x40')]=function(_0x581d91){return this[_0x6539('0x26')](util['format'](_0x6539('0x41'),_0x581d91));};AGIChannel[_0x6539('0x27')][_0x6539('0x42')]=function(_0xd4aae1,_0x4925df,_0x41c731,_0x2618fd,_0x34cb4f,_0x21629b){_0x4925df=_0x4925df||'wav';_0x41c731=_0x41c731||'';_0x2618fd=_0x2618fd===undefined?-0x1:_0x2618fd==='-1'?-0x1:_0x2618fd*0x3e8;_0x34cb4f=_0x34cb4f===undefined?'':'s='+_0x34cb4f;_0x21629b=_0x21629b?'BEEP':'';return this[_0x6539('0x26')](util[_0x6539('0x2a')](_0x6539('0x43'),_0xd4aae1,_0x4925df,_0x41c731,_0x2618fd,_0x21629b,_0x34cb4f));};AGIChannel[_0x6539('0x27')][_0x6539('0x44')]=function(_0x310898,_0x4cf0dc){_0x4cf0dc=_0x4cf0dc||'';return this[_0x6539('0x26')](util[_0x6539('0x2a')](_0x6539('0x45'),_0x310898,_0x4cf0dc));};AGIChannel[_0x6539('0x27')][_0x6539('0x46')]=function(_0x46e016){return this[_0x6539('0x2d')](_0x6539('0x47'),_0x46e016);};AGIChannel[_0x6539('0x27')][_0x6539('0x48')]=function(_0x29e361){return this[_0x6539('0x2d')]('WAIT',_0x29e361);};AGIChannel[_0x6539('0x27')][_0x6539('0x1b')]=function(_0x58d5be,_0x45b298){this[_0x6539('0x2b')](util[_0x6539('0x2a')](_0x6539('0x49'),_0x58d5be['id'],_0x58d5be[_0x6539('0x4a')],_0x45b298));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x7dc5=['startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','prototype','sync','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','emit','520-Invalid','520\x20End\x20of\x20proper','substring','no\x20code','replace','result=','indexOf','substr'];(function(_0x331dd0,_0x5e9c52){var _0x26a008=function(_0xbc1818){while(--_0xbc1818){_0x331dd0['push'](_0x331dd0['shift']());}};_0x26a008(++_0x5e9c52);}(_0x7dc5,0x11c));var _0x57dc=function(_0x2417f9,_0x803ba4){_0x2417f9=_0x2417f9-0x0;var _0x142d82=_0x7dc5[_0x2417f9];return _0x142d82;};'use strict';var util=require(_0x57dc('0x0'));var _=require(_0x57dc('0x1'));var EventEmitter=require(_0x57dc('0x2'))[_0x57dc('0x3')];var AGIReply=require(_0x57dc('0x4'));var AGIError=require(_0x57dc('0x5'));function AGIChannel(_0x142563){var _0x4554b9=this,_0x302f85=new AGIReply(),_0x69ff49=![],_0x7b9be5={};EventEmitter[_0x57dc('0x6')](_0x4554b9);_0x142563[_0x57dc('0x7')](_0x57dc('0x8'));_0x142563[_0x57dc('0x9')](0x8*0x3c*0x3c*0x3e8);_0x302f85[_0x57dc('0x7')](_0x57dc('0x8'));_0x302f85['on'](_0x57dc('0xa'),function(_0x2d3391){for(var _0xd8fce3 in _0x2d3391){_0x4554b9[_0xd8fce3]=_0x2d3391[_0xd8fce3];}_0x4554b9['emit'](_0x57dc('0xb'));});_0x302f85['on'](_0x57dc('0xc'),function(_0x5cda41){if(_0x5cda41[_0x57dc('0xd')]()==_0x57dc('0xe')){_0x4554b9[_0x57dc('0xf')](_0x57dc('0xe'));return;}if(_0x5cda41['substring'](0x0,0xb)==_0x57dc('0x10')){_0x69ff49=!![];}if(_0x69ff49){_0x7b9be5['rx']+=_0x5cda41+'\x0a';if(_0x5cda41['search'](_0x57dc('0x11'))!=-0x1){_0x69ff49=![];}}else{_0x7b9be5['rx']=_0x5cda41;}if(_0x69ff49){return;}if(typeof _0x7b9be5['cb']=='function'){var _0x486db9=_0x7b9be5['rx'][_0x57dc('0x12')](0x0,0x3),_0x4ed9d6=null,_0x1cb92e=null;_0x486db9=parseInt(_0x486db9);if(isNaN(_0x486db9)){_0x7b9be5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x57dc('0x13')});return;}if(_0x486db9!=0xc8){_0x7b9be5['cb'](null,{'code':_0x486db9,'result':-0x1,'extra':'KO'});return;}_0x4ed9d6=_0x7b9be5['rx'][_0x57dc('0x12')](0x4)[_0x57dc('0x14')](_0x57dc('0x15'),'');if(_0x4ed9d6[_0x57dc('0x16')]('\x20')!=-0x1){_0x4ed9d6=_0x4ed9d6[_0x57dc('0x17')](0x0,_0x4ed9d6['indexOf']('\x20'));}if(_[_0x57dc('0x18')](_0x4ed9d6,'-1')){_0x4ed9d6=parseInt(_0x4ed9d6);}_0x1cb92e=_0x7b9be5['rx'][_0x57dc('0x19')]('\x20');if(_0x1cb92e[_0x57dc('0x1a')]==0x3){_0x1cb92e=_0x1cb92e[0x2][_0x57dc('0x12')](0x1,_0x1cb92e[0x2][_0x57dc('0x1a')]-0x1);}else if(_0x1cb92e['length']>0x3){var _0xff429f=/\((.+)\)/;var _0xd402e7=_0x7b9be5['rx'][_0x57dc('0x1b')](_0xff429f);if(_0xd402e7){_0x1cb92e=_0xd402e7[0x1];}else{_0x1cb92e=null;}}else{_0x1cb92e=null;}_0x7b9be5['cb'](null,{'code':_0x486db9,'result':_0x4ed9d6,'extra':_0x1cb92e});}});_0x142563['on'](_0x57dc('0x1c'),function(_0x4d2d9){_0x4554b9[_0x57dc('0xf')](_0x57dc('0x1c'),new AGIError(_0x57dc('0x1d'),_0x4d2d9['code']));});_0x142563['on'](_0x57dc('0x1e'),function(){_0x4554b9[_0x57dc('0xf')](_0x57dc('0x1e'),new AGIError(_0x57dc('0x1f')));});_0x142563['on']('timeout',function(){_0x4554b9[_0x57dc('0xf')]('timeout',new AGIError(_0x57dc('0x20')));_0x142563[_0x57dc('0x21')]();});_0x142563[_0x57dc('0x22')](_0x302f85);this[_0x57dc('0x23')]=function(_0x4b6d38,_0x167f4c){var _0x4b6d38=_0x4b6d38||'',_0x167f4c=typeof _0x167f4c==_0x57dc('0x24')?_0x167f4c:new Function();_0x7b9be5={'tx':_0x4b6d38,'rx':'','cb':_0x167f4c};_0x142563[_0x57dc('0x25')](_0x4b6d38+'\x0a');},this['close']=function(){_0x142563[_0x57dc('0x21')]();};}util[_0x57dc('0x26')](AGIChannel,EventEmitter);AGIChannel[_0x57dc('0x27')]['sendRequest']=function(_0x557142){return this[_0x57dc('0x23')][_0x57dc('0x28')](this,_0x557142);};AGIChannel['prototype']['answer']=function(){return this['sendRequest'](_0x57dc('0x29'));};AGIChannel[_0x57dc('0x27')][_0x57dc('0x2a')]=function(_0xdde69d,_0xf36b47,_0x2d296d){_0xdde69d=_0xdde69d===undefined?_0x57dc('0x2b'):_0xdde69d;_0xf36b47=_0xf36b47===undefined?'5':_0xf36b47;_0x2d296d=_0x2d296d===undefined?'1':_0x2d296d;return this['sendRequest'](util[_0x57dc('0x2c')](_0x57dc('0x2d'),_0xdde69d,_0xf36b47*0x3e8,_0x2d296d));};AGIChannel['prototype']['noop']=function(_0x7afd44){_0x7afd44=_0x7afd44||_0x57dc('0x2e');return this[_0x57dc('0x2f')](util[_0x57dc('0x2c')]('VERBOSE\x20\x22%s\x22',_0x7afd44));};AGIChannel[_0x57dc('0x27')]['exec']=function(_0xe3c1ab,_0x4eda69){if(_['isArray'](_0x4eda69)){return this['sendRequest'](util[_0x57dc('0x2c')]('EXEC\x20%s\x20%s',_0xe3c1ab,_0x4eda69['join'](',')));}return this[_0x57dc('0x2f')](util['format'](_0x57dc('0x30'),_0xe3c1ab,_0x4eda69));};AGIChannel[_0x57dc('0x27')][_0x57dc('0x31')]=function(_0x5b8b83){return this[_0x57dc('0x2f')](util[_0x57dc('0x2c')](_0x57dc('0x32'),_0x5b8b83));};AGIChannel[_0x57dc('0x27')][_0x57dc('0x33')]=function(_0x477df9){return this[_0x57dc('0x2f')](util['format']('SET\x20EXTENSION\x20%s',_0x477df9));};AGIChannel[_0x57dc('0x27')][_0x57dc('0x34')]=function(_0xbf021c){return this[_0x57dc('0x2f')](util[_0x57dc('0x2c')](_0x57dc('0x35'),_0xbf021c));};AGIChannel['prototype'][_0x57dc('0xe')]=function(){return this[_0x57dc('0x2f')]('HANGUP');};AGIChannel[_0x57dc('0x27')][_0x57dc('0x36')]=function(_0x14cba8,_0x4de818){var _0x16876b=_[_0x57dc('0x37')](_0x4de818)||_['isNumber'](_0x4de818)?_0x4de818['toString']():_0x4de818;return this['sendRequest'](util[_0x57dc('0x2c')](_0x57dc('0x38'),_0x14cba8,_0x16876b?_0x16876b[_0x57dc('0x39')]()[_0x57dc('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x57dc('0x27')]['sayNumber']=function(_0x588c0b,_0x28c2b9){return this['sendRequest'](util['format'](_0x57dc('0x3a'),_0x588c0b,_0x28c2b9));};AGIChannel['prototype'][_0x57dc('0x3b')]=function(_0x2d74c7,_0x14965f){return this[_0x57dc('0x2f')](util[_0x57dc('0x2c')](_0x57dc('0x3c'),_0x2d74c7,_0x14965f));};AGIChannel[_0x57dc('0x27')][_0x57dc('0x3d')]=function(_0xb2206e,_0x3cd514){return this[_0x57dc('0x2f')](util[_0x57dc('0x2c')](_0x57dc('0x3e'),_0xb2206e,_0x3cd514));};AGIChannel[_0x57dc('0x27')][_0x57dc('0x3f')]=function(_0x3fa39e,_0xd8e11,_0x41455a){_0xd8e11=_0xd8e11||this['extension'];_0x41455a=_0x41455a||0x1;this[_0x57dc('0x31')](_0x3fa39e);this[_0x57dc('0x33')](_0xd8e11);this[_0x57dc('0x34')](_0x41455a);return this['noop'](util[_0x57dc('0x2c')](_0x57dc('0x40'),_0x3fa39e,_0xd8e11,_0x41455a));};AGIChannel['prototype'][_0x57dc('0x41')]=function(_0x317ef6){return this['sendRequest'](util[_0x57dc('0x2c')](_0x57dc('0x42'),_0x317ef6));};AGIChannel[_0x57dc('0x27')][_0x57dc('0x43')]=function(_0x370a8e,_0x180c65,_0x1a1abb,_0x3cc130,_0x2294e9,_0x3ea5aa){_0x180c65=_0x180c65||_0x57dc('0x44');_0x1a1abb=_0x1a1abb||'';_0x3cc130=_0x3cc130===undefined?-0x1:_0x3cc130==='-1'?-0x1:_0x3cc130*0x3e8;_0x2294e9=_0x2294e9===undefined?'':'s='+_0x2294e9;_0x3ea5aa=_0x3ea5aa?'BEEP':'';return this['sendRequest'](util['format'](_0x57dc('0x45'),_0x370a8e,_0x180c65,_0x1a1abb,_0x3cc130,_0x3ea5aa,_0x2294e9));};AGIChannel[_0x57dc('0x27')]['streamFile']=function(_0xacd99d,_0x3733f7){_0x3733f7=_0x3733f7||'';return this[_0x57dc('0x2f')](util[_0x57dc('0x2c')](_0x57dc('0x46'),_0xacd99d,_0x3733f7));};AGIChannel[_0x57dc('0x27')][_0x57dc('0x47')]=function(_0x2995c8){return this['exec'](_0x57dc('0x48'),_0x2995c8);};AGIChannel[_0x57dc('0x27')][_0x57dc('0x49')]=function(_0x55d42b){return this['exec']('WAIT',_0x55d42b);};AGIChannel[_0x57dc('0x27')]['error']=function(_0x1f4794,_0x5c8e9d){this['noop'](util[_0x57dc('0x2c')](_0x57dc('0x4a'),_0x1f4794['id'],_0x1f4794[_0x57dc('0x4b')],_0x5c8e9d));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x57dc('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f83841b..02428b9 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 _0x172a=['push','format','apply','message','name','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x3c8be9,_0x278c00){var _0x302bfa=function(_0x445d38){while(--_0x445d38){_0x3c8be9['push'](_0x3c8be9['shift']());}};_0x302bfa(++_0x278c00);}(_0x172a,0x91));var _0xa172=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x172a[_0x2e913b];return _0x173899;};'use strict';var util=require(_0xa172('0x0'));var error={'E_AGI_UNDEFINED':_0xa172('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xa172('0x2'),'E_AGI_SERVER_CLOSE':_0xa172('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xa172('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xa172('0x5'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa172('0x6'),'E_AGI_IVR_ENTRY':_0xa172('0x7')};function AGIError(_0x597f45){var _0x597f45=_0x597f45||null,_0x5d0256=_0x5d0256||[],_0x3c8cf8=0x1,_0x33bff9='';if(!error[_0x597f45]){_0x597f45=_0xa172('0x8');}_0x5d0256[_0xa172('0x9')](error[_0x597f45]);while(arguments[_0x3c8cf8]){_0x5d0256[_0xa172('0x9')](arguments[_0x3c8cf8]);_0x3c8cf8++;}_0x33bff9=util[_0xa172('0xa')][_0xa172('0xb')](util,_0x5d0256);this[_0xa172('0xc')]=_0x33bff9;this[_0xa172('0xd')]=_0x597f45;}module['exports']=AGIError; \ No newline at end of file +var _0x5d56=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x4447aa,_0x24e155){var _0x5be418=function(_0x1aba58){while(--_0x1aba58){_0x4447aa['push'](_0x4447aa['shift']());}};_0x5be418(++_0x24e155);}(_0x5d56,0xbc));var _0x65d5=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5d56[_0x3e5086];return _0xfeb102;};'use strict';var util=require(_0x65d5('0x0'));var error={'E_AGI_UNDEFINED':_0x65d5('0x1'),'E_AGI_ARGUMENT_PORT':_0x65d5('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x65d5('0x3'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x65d5('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x65d5('0x5'),'E_AGI_COMMAND_EMPTY':_0x65d5('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x65d5('0x7')};function AGIError(_0x4b6421){var _0x4b6421=_0x4b6421||null,_0x2375ff=_0x2375ff||[],_0x1d1100=0x1,_0x2c116b='';if(!error[_0x4b6421]){_0x4b6421=_0x65d5('0x8');}_0x2375ff[_0x65d5('0x9')](error[_0x4b6421]);while(arguments[_0x1d1100]){_0x2375ff[_0x65d5('0x9')](arguments[_0x1d1100]);_0x1d1100++;}_0x2c116b=util[_0x65d5('0xa')]['apply'](util,_0x2375ff);this['message']=_0x2c116b;this[_0x65d5('0xb')]=_0x4b6421;}module[_0x65d5('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index ba7a7f6..303e27c 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 _0xe9b2=['EventEmitter','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','message','emit','projectUpdate','exports','lodash','events'];(function(_0x1992a4,_0x2ec180){var _0x501797=function(_0x56ae44){while(--_0x56ae44){_0x1992a4['push'](_0x1992a4['shift']());}};_0x501797(++_0x2ec180);}(_0xe9b2,0x7c));var _0x2e9b=function(_0x2644dd,_0x39d79e){_0x2644dd=_0x2644dd-0x0;var _0x4dad81=_0xe9b2[_0x2644dd];return _0x4dad81;};'use strict';var _=require(_0x2e9b('0x0'));var EventEmitter=require(_0x2e9b('0x1'))[_0x2e9b('0x2')];var Redis=require('ioredis');var AGIError=require(_0x2e9b('0x3'));var config=require(_0x2e9b('0x4'));config[_0x2e9b('0x5')]=_[_0x2e9b('0x6')](config[_0x2e9b('0x5')],{'host':_0x2e9b('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x2e9b('0x5')]);sub[_0x2e9b('0x8')](_0x2e9b('0x9'),function(_0x114167){if(_0x114167)return eventEmitter['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x114167));});sub['on'](_0x2e9b('0xa'),function(_0x3f2a6e,_0x7d7caa){if(_0x3f2a6e!==_0x2e9b('0x9'))return;try{var _0x21e059=JSON['parse'](_0x7d7caa);eventEmitter[_0x2e9b('0xb')](_0x2e9b('0xc'),_0x21e059);}catch(_0x13339c){eventEmitter[_0x2e9b('0xb')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x13339c));}});module[_0x2e9b('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x7166=['./error','../../config/environment','redis','localhost','emit','E_AGI_SERVER_ERROR','message','agi','projectUpdate','error','lodash','ioredis'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7166,0x9a));var _0x6716=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0x7166[_0x15dbca];return _0x326533;};'use strict';var _=require(_0x6716('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0x6716('0x1'));var AGIError=require(_0x6716('0x2'));var config=require(_0x6716('0x3'));config['redis']=_['defaults'](config[_0x6716('0x4')],{'host':_0x6716('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x6716('0x4')]);sub['subscribe']('agi',function(_0x1d8890){if(_0x1d8890)return eventEmitter[_0x6716('0x6')]('error',new AGIError(_0x6716('0x7'),_0x1d8890));});sub['on'](_0x6716('0x8'),function(_0x1b17e1,_0x55571d){if(_0x1b17e1!==_0x6716('0x9'))return;try{var _0x27fb87=JSON['parse'](_0x55571d);eventEmitter['emit'](_0x6716('0xa'),_0x27fb87);}catch(_0x511929){eventEmitter['emit'](_0x6716('0xb'),new AGIError(_0x6716('0x7'),_0x511929));}});module['exports']={'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 9662a05..4fb8c8f 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 _0x3b31=['vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','vertices','edges','prototype','addEdge','push','numberOfEdges','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','agicommand'];(function(_0x142c73,_0x3c1d1f){var _0x517e55=function(_0xa11b3c){while(--_0xa11b3c){_0x142c73['push'](_0x142c73['shift']());}};_0x517e55(++_0x3c1d1f);}(_0x3b31,0xfa));var _0x13b3=function(_0xf98136,_0x2b9091){_0xf98136=_0xf98136-0x0;var _0x3e6876=_0x3b31[_0xf98136];return _0x3e6876;};'use strict';var _=require(_0x13b3('0x0'));var logger=require(_0x13b3('0x1'))(_0x13b3('0x2'));var verticesWithRetry=[_0x13b3('0x3'),'getdigits','getsecretdigits'];var Graph=function(){this[_0x13b3('0x4')]={};this[_0x13b3('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x13b3('0x6')]['addVertex']=function(_0x2bc40f){this[_0x13b3('0x4')][_0x2bc40f['id']]=_0x2bc40f;this['edges'][_0x2bc40f['id']]=[];};Graph['prototype'][_0x13b3('0x7')]=function(_0x3f6106,_0x201c82,_0xeaff1a){this['edges'][_0x3f6106][_0x13b3('0x8')]({'target':_0x201c82,'condition':_0xeaff1a});this[_0x13b3('0x9')]+=0x1;};Graph[_0x13b3('0x6')][_0x13b3('0xa')]=function(){return _[_0x13b3('0xa')](this[_0x13b3('0x4')]);};Graph[_0x13b3('0x6')][_0x13b3('0xb')]=function(){return this[_0x13b3('0x9')];};Graph[_0x13b3('0x6')][_0x13b3('0xc')]=function(_0x33f5a4){return this[_0x13b3('0x4')][_0x33f5a4];};Graph[_0x13b3('0x6')][_0x13b3('0xd')]=function(_0x11edf1,_0x5858cb){if(!this[_0x13b3('0x4')][_0x11edf1]){return logger[_0x13b3('0xe')](_0x13b3('0xf'));}var _0x5d5572=_0x5858cb(this[_0x13b3('0x4')][_0x11edf1]);if(!_0x5d5572){return logger[_0x13b3('0xe')](_0x13b3('0x10'));}if(this[_0x13b3('0x5')][_0x11edf1][_0x13b3('0x11')]===0x0){return logger[_0x13b3('0xe')]('no\x20edge/s\x20available');}for(var _0x531966=0x0,_0x13ffab=[],_0x4173ac=![];_0x531966\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','hasOwnProperty','substring','debug','stringify','hangup','handleNotFound','production','handleUnpublished','initialize','getLicense'];(function(_0x4c1ec2,_0x4f42b7){var _0x3f6f1c=function(_0xc82652){while(--_0xc82652){_0x4c1ec2['push'](_0x4c1ec2['shift']());}};_0x3f6f1c(++_0x4f42b7);}(_0x6149,0x1a1));var _0x9614=function(_0x58d349,_0x3f80e3){_0x58d349=_0x58d349-0x0;var _0x531639=_0x6149[_0x58d349];return _0x531639;};'use strict';var _=require(_0x9614('0x0'));var syncho=require(_0x9614('0x1'));var util=require(_0x9614('0x2'));var config=require(_0x9614('0x3'));var logger=require(_0x9614('0x4'))(_0x9614('0x5'));var utilLicense=require(_0x9614('0x6'));var rpc=require('./rpc');var Project=require(_0x9614('0x7'));var AGIEmitter=require(_0x9614('0x8'))['EventEmitter'];var projects=[];config[_0x9614('0x5')]=_[_0x9614('0x9')](config[_0x9614('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x9614('0xa'),projectUpdateHandler);function connectionHandler(_0x54a778){process[_0x9614('0xb')](function(){syncho(function(){try{setChannelVariables(_0x54a778);agiHandler(_0x54a778);}catch(_0xd9fb79){logger['error'](_0xd9fb79[_0x9614('0xc')]);}});});}function projectUpdateHandler(_0x368597){try{var _0x35e723=_[_0x9614('0xd')](projects,['id',_0x368597['id']]);if(_0x35e723>-0x1){if(_0x368597['deleted']===!![]){projects[_0x9614('0xe')](_0x35e723,0x1);}else{projects[_0x35e723]=_0x368597;}}else{projects[_0x9614('0xf')](_0x368597);}}catch(_0x36a0fd){logger[_0x9614('0x10')](_0x36a0fd[_0x9614('0xc')]);}}function listeningHandler(){console[_0x9614('0x11')](_0x9614('0x12'),config[_0x9614('0x5')][_0x9614('0x13')]);logger[_0x9614('0x14')](util['format'](_0x9614('0x15'),config[_0x9614('0x5')]['ip'],config['agi']['port']));}function errorHandler(_0xbd28cb){if(_0xbd28cb&&_0xbd28cb[_0x9614('0x16')]&&_0xbd28cb[_0x9614('0x17')]){logger[_0x9614('0x10')](util['format'](_0x9614('0x18'),_0xbd28cb[_0x9614('0x16')],_0xbd28cb[_0x9614('0x17')]));}else{logger[_0x9614('0x10')](util['format'](_0x9614('0x19'),_0xbd28cb[_0x9614('0xc')]));}}function closeHandler(){logger[_0x9614('0x14')](util[_0x9614('0x1a')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x9614('0x1b')],this[_0x9614('0x1c')],this[_0x9614('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x567adf){logger[_0x9614('0x10')](_0x567adf['stack']);}}function timeoutHandler(){logger[_0x9614('0x14')](util['format'](_0x9614('0x1e'),this[_0x9614('0x1f')],this[_0x9614('0x1b')],this[_0x9614('0x1c')],this[_0x9614('0x1d')],this[_0x9614('0x20')]));}function hangupHandler(){logger[_0x9614('0x14')](util['format'](_0x9614('0x21'),this[_0x9614('0x1f')],this[_0x9614('0x1b')],this[_0x9614('0x1c')],this['dnid'],this[_0x9614('0x20')]));this[_0x9614('0x22')]=!![];}function createSquareReport(_0x51e05f,_0x35d794){rpc[_0x9614('0x23')](_0x51e05f)['then'](function(_0x44c73e){if(_0x35d794){_0x35d794(null,_0x44c73e);}})[_0x9614('0x24')](function(_0x5b9bf9){if(_0x35d794){_0x35d794(null,_0x5b9bf9);}});}function setChannelVariables(_0x3d9c0a){for(var _0x2ce73a in _0x3d9c0a){if(_0x3d9c0a[_0x9614('0x25')](_0x2ce73a)){if(_0x2ce73a['indexOf']('agi_')===0x0){_0x3d9c0a[_0x2ce73a[_0x9614('0x26')](0x4)]=_0x3d9c0a[_0x2ce73a];delete _0x3d9c0a[_0x2ce73a];}}}}function agiHandler(_0x51b65f){logger[_0x9614('0x27')]('variables',JSON[_0x9614('0x28')](_0x51b65f,null,0x2));logger[_0x9614('0x14')](util[_0x9614('0x1a')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x51b65f[_0x9614('0x1f')],_0x51b65f['calleridname'],_0x51b65f[_0x9614('0x1c')],_0x51b65f['dnid'],_0x51b65f[_0x9614('0x20')]));_0x51b65f['on'](_0x9614('0x10'),errorHandler);_0x51b65f['on']('close',closeHandler);_0x51b65f['on']('timeout',timeoutHandler);_0x51b65f[_0x9614('0x22')]=![];_0x51b65f['on'](_0x9614('0x29'),hangupHandler);var _0x52e0de=_['find'](projects,[_0x9614('0x16'),_0x51b65f[_0x9614('0x1f')]]);if(!_0x52e0de)return Project[_0x9614('0x2a')](_0x51b65f);if(!_0x52e0de[_0x9614('0x2b')])return Project[_0x9614('0x2c')](_0x51b65f);return Project[_0x9614('0x2d')](_0x52e0de,_0x51b65f);}function main(){var _0x1b2bec;return utilLicense[_0x9614('0x2e')]()[_0x9614('0x2f')](function(_0x5a3670){if(!_0x5a3670)return;if(_0x5a3670['voice']){if(_0x5a3670['callysquare']&&_0x5a3670['callysquare']>0x0){logger[_0x9614('0x14')](util[_0x9614('0x1a')](_0x9614('0x30'),_0x5a3670[_0x9614('0x31')]));_0x1b2bec=_0x5a3670['callysquare'];}else{logger[_0x9614('0x14')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x9614('0x14')](_0x9614('0x32'));_0x1b2bec=-0x1;}})['then'](function(){return Project[_0x9614('0x33')]();})[_0x9614('0x2f')](function(_0x6e57f4){projects=_0x6e57f4;return;})[_0x9614('0x24')](function(_0x2cd087){logger[_0x9614('0x10')](_0x9614('0x34'),_0x2cd087['stack']);})[_0x9614('0x35')](function(){var _0xe9b1cd=require(_0x9614('0x36'))(config['agi'][_0x9614('0x13')],config[_0x9614('0x5')]['ip'],_0x1b2bec);_0xe9b1cd['on'](_0x9614('0x10'),errorHandler);_0xe9b1cd['on'](_0x9614('0x37'),listeningHandler);_0xe9b1cd['on'](_0x9614('0x38'),connectionHandler);_0xe9b1cd['on'](_0x9614('0x39'),closeHandler);});}main(); \ No newline at end of file +var _0x6794=['../../config/license/util','./project','EventEmitter','agi','projectUpdate','nextTick','error','findIndex','deleted','push','stack','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','debug','stringify','close','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger'];(function(_0x5012a6,_0x327180){var _0x19c9c3=function(_0x37ee38){while(--_0x37ee38){_0x5012a6['push'](_0x5012a6['shift']());}};_0x19c9c3(++_0x327180);}(_0x6794,0x67));var _0x4679=function(_0x197c09,_0x441b62){_0x197c09=_0x197c09-0x0;var _0x28fc4a=_0x6794[_0x197c09];return _0x28fc4a;};'use strict';var _=require(_0x4679('0x0'));var syncho=require(_0x4679('0x1'));var util=require(_0x4679('0x2'));var config=require(_0x4679('0x3'));var logger=require(_0x4679('0x4'))('agi');var utilLicense=require(_0x4679('0x5'));var rpc=require('./rpc');var Project=require(_0x4679('0x6'));var AGIEmitter=require('./events')[_0x4679('0x7')];var projects=[];config[_0x4679('0x8')]=_['defaults'](config[_0x4679('0x8')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x4679('0x9'),projectUpdateHandler);function connectionHandler(_0x12948f){process[_0x4679('0xa')](function(){syncho(function(){try{setChannelVariables(_0x12948f);agiHandler(_0x12948f);}catch(_0x28001d){logger[_0x4679('0xb')](_0x28001d['stack']);}});});}function projectUpdateHandler(_0x1f6303){try{var _0x5e943e=_[_0x4679('0xc')](projects,['id',_0x1f6303['id']]);if(_0x5e943e>-0x1){if(_0x1f6303[_0x4679('0xd')]===!![]){projects['splice'](_0x5e943e,0x1);}else{projects[_0x5e943e]=_0x1f6303;}}else{projects[_0x4679('0xe')](_0x1f6303);}}catch(_0x43aeeb){logger[_0x4679('0xb')](_0x43aeeb[_0x4679('0xf')]);}}function listeningHandler(){console[_0x4679('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x4679('0x11')]);logger[_0x4679('0x12')](util[_0x4679('0x13')](_0x4679('0x14'),config[_0x4679('0x8')]['ip'],config['agi'][_0x4679('0x11')]));}function errorHandler(_0x113108){if(_0x113108&&_0x113108[_0x4679('0x15')]&&_0x113108[_0x4679('0x16')]){logger['error'](util[_0x4679('0x13')]('[%s]\x20%s',_0x113108['name'],_0x113108['message']));}else{logger[_0x4679('0xb')](util[_0x4679('0x13')](_0x4679('0x17'),_0x113108[_0x4679('0xf')]));}}function closeHandler(){logger['info'](util['format'](_0x4679('0x18'),this[_0x4679('0x19')],this['calleridname'],this[_0x4679('0x1a')],this[_0x4679('0x1b')],this[_0x4679('0x1c')]));try{createSquareReport(this);}catch(_0x3a0194){logger[_0x4679('0xb')](_0x3a0194['stack']);}}function timeoutHandler(){logger[_0x4679('0x12')](util[_0x4679('0x13')](_0x4679('0x1d'),this[_0x4679('0x19')],this[_0x4679('0x1e')],this[_0x4679('0x1a')],this[_0x4679('0x1b')],this[_0x4679('0x1c')]));}function hangupHandler(){logger['info'](util['format'](_0x4679('0x1f'),this[_0x4679('0x19')],this[_0x4679('0x1e')],this[_0x4679('0x1a')],this[_0x4679('0x1b')],this[_0x4679('0x1c')]));this[_0x4679('0x20')]=!![];}function createSquareReport(_0x161328,_0x1c36e7){rpc[_0x4679('0x21')](_0x161328)[_0x4679('0x22')](function(_0x5ad01d){if(_0x1c36e7){_0x1c36e7(null,_0x5ad01d);}})[_0x4679('0x23')](function(_0x563dc0){if(_0x1c36e7){_0x1c36e7(null,_0x563dc0);}});}function setChannelVariables(_0x445be6){for(var _0x4176af in _0x445be6){if(_0x445be6[_0x4679('0x24')](_0x4176af)){if(_0x4176af['indexOf'](_0x4679('0x25'))===0x0){_0x445be6[_0x4176af['substring'](0x4)]=_0x445be6[_0x4176af];delete _0x445be6[_0x4176af];}}}}function agiHandler(_0x14a131){logger[_0x4679('0x26')]('variables',JSON[_0x4679('0x27')](_0x14a131,null,0x2));logger[_0x4679('0x12')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x14a131[_0x4679('0x19')],_0x14a131[_0x4679('0x1e')],_0x14a131[_0x4679('0x1a')],_0x14a131[_0x4679('0x1b')],_0x14a131['uniqueid']));_0x14a131['on'](_0x4679('0xb'),errorHandler);_0x14a131['on'](_0x4679('0x28'),closeHandler);_0x14a131['on']('timeout',timeoutHandler);_0x14a131[_0x4679('0x20')]=![];_0x14a131['on']('hangup',hangupHandler);var _0x2777a7=_['find'](projects,[_0x4679('0x15'),_0x14a131[_0x4679('0x19')]]);if(!_0x2777a7)return Project['handleNotFound'](_0x14a131);if(!_0x2777a7[_0x4679('0x29')])return Project[_0x4679('0x2a')](_0x14a131);return Project[_0x4679('0x2b')](_0x2777a7,_0x14a131);}function main(){var _0x2183ee;return utilLicense[_0x4679('0x2c')]()[_0x4679('0x22')](function(_0x27bb61){if(!_0x27bb61)return;if(_0x27bb61[_0x4679('0x2d')]){if(_0x27bb61[_0x4679('0x2e')]&&_0x27bb61['callysquare']>0x0){logger[_0x4679('0x12')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x27bb61['callysquare']));_0x2183ee=_0x27bb61[_0x4679('0x2e')];}else{logger[_0x4679('0x12')](_0x4679('0x2f'));}}else{logger['info'](_0x4679('0x30'));_0x2183ee=-0x1;}})[_0x4679('0x22')](function(){return Project[_0x4679('0x31')]();})[_0x4679('0x22')](function(_0x533308){projects=_0x533308;return;})['catch'](function(_0x545e93){logger[_0x4679('0xb')]('[LICENSE]',_0x545e93[_0x4679('0xf')]);})[_0x4679('0x32')](function(){var _0x5593d5=require(_0x4679('0x33'))(config['agi']['port'],config[_0x4679('0x8')]['ip'],_0x2183ee);_0x5593d5['on']('error',errorHandler);_0x5593d5['on'](_0x4679('0x34'),listeningHandler);_0x5593d5['on'](_0x4679('0x35'),connectionHandler);_0x5593d5['on'](_0x4679('0x28'),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 ae58153..9208f7b 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 _0xa19b=['http','request','error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client'];(function(_0x250b29,_0x1d0a9f){var _0x173414=function(_0x159010){while(--_0x159010){_0x250b29['push'](_0x250b29['shift']());}};_0x173414(++_0x1d0a9f);}(_0xa19b,0x13d));var _0xba19=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa19b[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0xba19('0x0'));var jayson=require(_0xba19('0x1'));var client=jayson[_0xba19('0x2')][_0xba19('0x3')]({'port':0x232b});function request(_0x59b922,_0x117432){return new BPromise(function(_0x1902f5,_0xd5cae1){return client[_0xba19('0x4')](_0x59b922,_0x117432)['then'](function(_0x4eba2d){if(_0x4eba2d[_0xba19('0x5')]){return _0xd5cae1(_0x4eba2d[_0xba19('0x5')][_0xba19('0x6')]);}else{return _0x1902f5(_0x4eba2d[_0xba19('0x7')]);}})[_0xba19('0x8')](function(_0x4edb8c){return _0xd5cae1(_0x4edb8c);});});}exports[_0xba19('0x9')]=function(_0xd752c1,_0x485154){return request('SendMail',{'account':_0xd752c1,'message':_0x485154});}; \ No newline at end of file +var _0xe8c7=['bluebird','jayson/promise','client','http','then','error','message','catch','sendMailMessage','SendMail'];(function(_0x29293c,_0x1be7a6){var _0x2dc2cc=function(_0x352424){while(--_0x352424){_0x29293c['push'](_0x29293c['shift']());}};_0x2dc2cc(++_0x1be7a6);}(_0xe8c7,0x122));var _0x7e8c=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xe8c7[_0x1eda20];return _0x31b953;};'use strict';var BPromise=require(_0x7e8c('0x0'));var jayson=require(_0x7e8c('0x1'));var client=jayson[_0x7e8c('0x2')][_0x7e8c('0x3')]({'port':0x232b});function request(_0x5ca127,_0x2a1de3){return new BPromise(function(_0x2d6de4,_0x114e1e){return client['request'](_0x5ca127,_0x2a1de3)[_0x7e8c('0x4')](function(_0x10dce4){if(_0x10dce4[_0x7e8c('0x5')]){return _0x114e1e(_0x10dce4[_0x7e8c('0x5')][_0x7e8c('0x6')]);}else{return _0x2d6de4(_0x10dce4['result']);}})[_0x7e8c('0x7')](function(_0x61844a){return _0x114e1e(_0x61844a);});});}exports[_0x7e8c('0x8')]=function(_0x381f6b,_0x4fbd59){return request(_0x7e8c('0x9'),{'account':_0x381f6b,'message':_0x4fbd59});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 6ee1f0b..7f3024a 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 _0xe89e=['addEdge','value','mxGraphModel','inspect','production','start','debug','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','traverseBFS','clear','vertex','agicommand','gotoc','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','error','stack','retry','maxRetry','addVertex','omit','hasOwnProperty','isArray','length','source','target'];(function(_0x48da6a,_0xb5c722){var _0x5470f5=function(_0x17dafd){while(--_0x17dafd){_0x48da6a['push'](_0x48da6a['shift']());}};_0x5470f5(++_0xb5c722);}(_0xe89e,0x121));var _0xee89=function(_0x38a581,_0x4a71bb){_0x38a581=_0x38a581-0x0;var _0x349907=_0xe89e[_0x38a581];return _0x349907;};'use strict';var _=require(_0xee89('0x0'));var moment=require('moment');var parser=require(_0xee89('0x1'));var util=require(_0xee89('0x2'));var logger=require(_0xee89('0x3'))(_0xee89('0x4'));var rpc=require(_0xee89('0x5'));var mailRpc=require(_0xee89('0x6'));var Graph=require(_0xee89('0x7'));var Vertices=require(_0xee89('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xee89('0x9')]()['catch'](function(_0x4ef028){logger[_0xee89('0xa')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x4ef028[_0xee89('0xb')]);return[];});}function addVertex(_0x265450,_0xaa7bb7,_0x4971ac){_0xaa7bb7['agicommand']=_0x4971ac;if(_0xaa7bb7['hasOwnProperty'](_0xee89('0xc'))){_0xaa7bb7[_0xee89('0xd')]=parseInt(_0xaa7bb7[_0xee89('0xc')],0xa);}_0x265450[_0xee89('0xe')](_[_0xee89('0xf')](_0xaa7bb7,'mxCell'));}function initGraph(_0x2d89f9,_0x23060b){var _0x8864e7=new Graph();for(var _0x1a5543 in _0x2d89f9){if(_0x2d89f9[_0xee89('0x10')](_0x1a5543)){if(_[_0xee89('0x11')](_0x2d89f9[_0x1a5543])){for(var _0x13b74c=0x0;_0x13b74c<_0x2d89f9[_0x1a5543][_0xee89('0x12')];_0x13b74c+=0x1){addVertex(_0x8864e7,_0x2d89f9[_0x1a5543][_0x13b74c],_0x1a5543);}}else{addVertex(_0x8864e7,_0x2d89f9[_0x1a5543],_0x1a5543);}}}for(var _0x4b7b75=0x0;_0x4b7b75<_0x23060b[_0xee89('0x12')];_0x4b7b75+=0x1){if(_0x23060b[_0x4b7b75][_0xee89('0x13')]&&_0x23060b[_0x4b7b75][_0xee89('0x14')]){_0x8864e7[_0xee89('0x15')](_0x23060b[_0x4b7b75]['source'],_0x23060b[_0x4b7b75][_0xee89('0x14')],_0x23060b[_0x4b7b75][_0xee89('0x16')]);}}return _0x8864e7;}function getRoot(_0x938ded){return parser['toJson'](_0x938ded,{'object':!![]})[_0xee89('0x17')]['root'];}function inspect(_0x12aa0d){return util[_0xee89('0x18')](_0x12aa0d,{'showHidden':![],'depth':null});}function initialize(_0x2146b6,_0x319875){var _0x322c40=getRoot(_0x2146b6[_0xee89('0x19')]);if(!_0x322c40||!_0x322c40[_0xee89('0x1a')])return;var _0x423c33,_0x24d55a,_0x2287b7;logger[_0xee89('0x1b')](_0xee89('0x1c'),JSON[_0xee89('0x1d')](_0x322c40,null,0x2));_0x319875[_0xee89('0x1e')]=moment()['format'](_0xee89('0x1f'));_0x423c33=initGraph(_[_0xee89('0xf')](_0x322c40,'mxCell'),_0x322c40['mxCell']);_0x24d55a=new Vertices(_0x319875,rpc,mailRpc);logger[_0xee89('0x20')](util[_0xee89('0x21')](_0xee89('0x22'),_0x319875[_0xee89('0x23')],_0x319875['calleridname'],_0x319875[_0xee89('0x24')],_0x319875[_0xee89('0x25')],_0x319875[_0xee89('0x26')]));_0x423c33[_0xee89('0x27')](_0x322c40['start']['id'],function(_0x342a9f){try{_0x342a9f=_0x24d55a[_0xee89('0x28')](_0x342a9f);logger['debug'](_0xee89('0x29'),JSON[_0xee89('0x1d')](_0x342a9f,null,0x2));if(_0x342a9f[_0xee89('0x2a')]===_0xee89('0x2b')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x319875[_0xee89('0x2c')]=_0x342a9f['context']||_0x319875[_0xee89('0x2c')];_0x319875[_0xee89('0x2d')]=_0x342a9f['extension'];_0x319875[_0xee89('0x2e')]=_0x342a9f[_0xee89('0x2e')]?_0x342a9f[_0xee89('0x2e')]-0x1:0x1;return null;}else if(_0x342a9f&&_0x24d55a[_0x342a9f['agicommand']]){_0x2287b7=_0x24d55a[_0x342a9f[_0xee89('0x2a')]](_0x342a9f);logger['info'](_0xee89('0x2f'),JSON[_0xee89('0x1d')](_0x2287b7,null,0x2));if(_0x2287b7&&_0x2287b7[_0xee89('0x30')]===AGI_CODE_SUCCESS&&_0x2287b7[_0xee89('0x31')]!==AGI_RESULT_ERROR&&!_0x319875[_0xee89('0x32')]){logger['debug'](_0xee89('0x2f'),inspect(_0x2287b7));return _[_0xee89('0x33')](_0x2287b7[_0xee89('0x31')])?null:_0x2287b7['result'][_0xee89('0x34')]();}else{logger[_0xee89('0xa')](_0xee89('0x2f'),inspect(_0x2287b7));return null;}}else{logger[_0xee89('0xa')](_0xee89('0x35'));return null;}}catch(_0x31abf3){logger['error'](_0x31abf3[_0xee89('0xb')]);return null;}});if(_0x322c40[_0xee89('0x36')]){logger[_0xee89('0x20')](util['format'](_0xee89('0x37'),_0x319875['arg_1'],_0x319875['calleridname'],_0x319875['callerid'],_0x319875[_0xee89('0x25')],_0x319875[_0xee89('0x26')]));_0x423c33[_0xee89('0x27')](_0x322c40[_0xee89('0x36')]['id'],function(_0x2a04df){try{_0x2a04df=_0x24d55a[_0xee89('0x28')](_0x2a04df);logger['debug']('vertex',JSON[_0xee89('0x1d')](_0x2a04df,null,0x2));if(_0x2a04df&&_0x24d55a[_0x2a04df[_0xee89('0x2a')]]){_0x2287b7=_0x24d55a[_0x2a04df['agicommand']](_0x2a04df);if(_0x2287b7){logger[_0xee89('0x1b')](_0xee89('0x2f'),inspect(_0x2287b7));return _[_0xee89('0x33')](_0x2287b7[_0xee89('0x31')])?null:_0x2287b7[_0xee89('0x31')]['toString']();}else{logger[_0xee89('0xa')](_0xee89('0x2f'),inspect(_0x2287b7));return null;}}else{logger[_0xee89('0xa')](_0xee89('0x35'));return null;}}catch(_0x551d55){logger[_0xee89('0xa')](_0x551d55[_0xee89('0xb')]);return null;}});}logger[_0xee89('0x20')](util[_0xee89('0x21')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x319875[_0xee89('0x23')],_0x319875['calleridname'],_0x319875[_0xee89('0x24')],_0x319875['dnid'],_0x319875['uniqueid']));logger['info'](util[_0xee89('0x21')](_0xee89('0x38'),_0x319875[_0xee89('0x2c')],_0x319875[_0xee89('0x2d')],parseInt(_0x319875[_0xee89('0x2e')],0xa)+0x1));_0x319875['continueAt'](_0x319875[_0xee89('0x2c')],_0x319875[_0xee89('0x2d')],parseInt(_0x319875['priority'],0xa)+0x1);_0x319875[_0xee89('0x39')]();}function handleNotFound(_0x5909d5){logger[_0xee89('0xa')](util[_0xee89('0x21')](_0xee89('0x3a'),_0x5909d5['arg_1']));_0x5909d5[_0xee89('0x3b')](_0x5909d5[_0xee89('0x2c')],_0x5909d5[_0xee89('0x2d')],parseInt(_0x5909d5[_0xee89('0x2e')],0xa)+0x1);_0x5909d5[_0xee89('0x39')]();}function handleUnpublished(_0x154da8){logger[_0xee89('0xa')](util[_0xee89('0x21')](_0xee89('0x3c'),_0x154da8['arg_1']));_0x154da8['continueAt'](_0x154da8[_0xee89('0x2c')],_0x154da8['extension'],parseInt(_0x154da8[_0xee89('0x2e')],0xa)+0x1);_0x154da8['close']();}module[_0xee89('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x5d84=['priority','response','code','result','evtHangup','toString','error','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports','lodash','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','length','source','target','addEdge','toJson','mxGraphModel','root','inspect','production','start','stringify','format','omit','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','traverseBFS','clear','debug','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension'];(function(_0x47bdcf,_0x1fddd9){var _0x38ae0e=function(_0x4485e5){while(--_0x4485e5){_0x47bdcf['push'](_0x47bdcf['shift']());}};_0x38ae0e(++_0x1fddd9);}(_0x5d84,0x1bf));var _0x45d8=function(_0x56f02c,_0x2a2dcd){_0x56f02c=_0x56f02c-0x0;var _0x568c05=_0x5d84[_0x56f02c];return _0x568c05;};'use strict';var _=require(_0x45d8('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require('util');var logger=require(_0x45d8('0x1'))(_0x45d8('0x2'));var rpc=require(_0x45d8('0x3'));var mailRpc=require(_0x45d8('0x4'));var Graph=require(_0x45d8('0x5'));var Vertices=require(_0x45d8('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x45d8('0x7')]()[_0x45d8('0x8')](function(_0x263a7c){logger['error'](_0x45d8('0x9'),_0x263a7c[_0x45d8('0xa')]);return[];});}function addVertex(_0x150400,_0x54a5f8,_0x499ce7){_0x54a5f8[_0x45d8('0xb')]=_0x499ce7;if(_0x54a5f8[_0x45d8('0xc')](_0x45d8('0xd'))){_0x54a5f8['maxRetry']=parseInt(_0x54a5f8[_0x45d8('0xd')],0xa);}_0x150400[_0x45d8('0xe')](_['omit'](_0x54a5f8,'mxCell'));}function initGraph(_0xa8d9d5,_0x1b65f1){var _0x2faacc=new Graph();for(var _0x46ce92 in _0xa8d9d5){if(_0xa8d9d5[_0x45d8('0xc')](_0x46ce92)){if(_['isArray'](_0xa8d9d5[_0x46ce92])){for(var _0x53715d=0x0;_0x53715d<_0xa8d9d5[_0x46ce92][_0x45d8('0xf')];_0x53715d+=0x1){addVertex(_0x2faacc,_0xa8d9d5[_0x46ce92][_0x53715d],_0x46ce92);}}else{addVertex(_0x2faacc,_0xa8d9d5[_0x46ce92],_0x46ce92);}}}for(var _0x4f6cfe=0x0;_0x4f6cfe<_0x1b65f1[_0x45d8('0xf')];_0x4f6cfe+=0x1){if(_0x1b65f1[_0x4f6cfe][_0x45d8('0x10')]&&_0x1b65f1[_0x4f6cfe][_0x45d8('0x11')]){_0x2faacc[_0x45d8('0x12')](_0x1b65f1[_0x4f6cfe]['source'],_0x1b65f1[_0x4f6cfe][_0x45d8('0x11')],_0x1b65f1[_0x4f6cfe]['value']);}}return _0x2faacc;}function getRoot(_0x58a376){return parser[_0x45d8('0x13')](_0x58a376,{'object':!![]})[_0x45d8('0x14')][_0x45d8('0x15')];}function inspect(_0x3c5f81){return util[_0x45d8('0x16')](_0x3c5f81,{'showHidden':![],'depth':null});}function initialize(_0x1eeb72,_0xc3c5c6){var _0x1252bc=getRoot(_0x1eeb72[_0x45d8('0x17')]);if(!_0x1252bc||!_0x1252bc[_0x45d8('0x18')])return;var _0x515e0d,_0x17a7ba,_0x2b6130;logger['debug'](_0x45d8('0x15'),JSON[_0x45d8('0x19')](_0x1252bc,null,0x2));_0xc3c5c6['joinAt']=moment()[_0x45d8('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');_0x515e0d=initGraph(_[_0x45d8('0x1b')](_0x1252bc,_0x45d8('0x1c')),_0x1252bc[_0x45d8('0x1c')]);_0x17a7ba=new Vertices(_0xc3c5c6,rpc,mailRpc);logger['info'](util[_0x45d8('0x1a')](_0x45d8('0x1d'),_0xc3c5c6[_0x45d8('0x1e')],_0xc3c5c6[_0x45d8('0x1f')],_0xc3c5c6['callerid'],_0xc3c5c6['dnid'],_0xc3c5c6['uniqueid']));_0x515e0d[_0x45d8('0x20')](_0x1252bc[_0x45d8('0x18')]['id'],function(_0x149834){try{_0x149834=_0x17a7ba[_0x45d8('0x21')](_0x149834);logger[_0x45d8('0x22')](_0x45d8('0x23'),JSON['stringify'](_0x149834,null,0x2));if(_0x149834[_0x45d8('0xb')]===_0x45d8('0x24')){logger[_0x45d8('0x25')](_0x45d8('0x26'));_0xc3c5c6[_0x45d8('0x27')]=_0x149834[_0x45d8('0x27')]||_0xc3c5c6['context'];_0xc3c5c6[_0x45d8('0x28')]=_0x149834[_0x45d8('0x28')];_0xc3c5c6['priority']=_0x149834[_0x45d8('0x29')]?_0x149834[_0x45d8('0x29')]-0x1:0x1;return null;}else if(_0x149834&&_0x17a7ba[_0x149834[_0x45d8('0xb')]]){_0x2b6130=_0x17a7ba[_0x149834[_0x45d8('0xb')]](_0x149834);logger[_0x45d8('0x25')](_0x45d8('0x2a'),JSON[_0x45d8('0x19')](_0x2b6130,null,0x2));if(_0x2b6130&&_0x2b6130[_0x45d8('0x2b')]===AGI_CODE_SUCCESS&&_0x2b6130[_0x45d8('0x2c')]!==AGI_RESULT_ERROR&&!_0xc3c5c6[_0x45d8('0x2d')]){logger['debug'](_0x45d8('0x2a'),inspect(_0x2b6130));return _['isUndefined'](_0x2b6130[_0x45d8('0x2c')])?null:_0x2b6130[_0x45d8('0x2c')][_0x45d8('0x2e')]();}else{logger[_0x45d8('0x2f')]('response',inspect(_0x2b6130));return null;}}else{logger[_0x45d8('0x2f')](_0x45d8('0x30'));return null;}}catch(_0x260f1e){logger[_0x45d8('0x2f')](_0x260f1e[_0x45d8('0xa')]);return null;}});if(_0x1252bc['finally']){logger[_0x45d8('0x25')](util[_0x45d8('0x1a')](_0x45d8('0x31'),_0xc3c5c6[_0x45d8('0x1e')],_0xc3c5c6[_0x45d8('0x1f')],_0xc3c5c6[_0x45d8('0x32')],_0xc3c5c6[_0x45d8('0x33')],_0xc3c5c6[_0x45d8('0x34')]));_0x515e0d[_0x45d8('0x20')](_0x1252bc[_0x45d8('0x35')]['id'],function(_0x3e4eb8){try{_0x3e4eb8=_0x17a7ba[_0x45d8('0x21')](_0x3e4eb8);logger[_0x45d8('0x22')](_0x45d8('0x23'),JSON[_0x45d8('0x19')](_0x3e4eb8,null,0x2));if(_0x3e4eb8&&_0x17a7ba[_0x3e4eb8[_0x45d8('0xb')]]){_0x2b6130=_0x17a7ba[_0x3e4eb8[_0x45d8('0xb')]](_0x3e4eb8);if(_0x2b6130){logger['debug'](_0x45d8('0x2a'),inspect(_0x2b6130));return _['isUndefined'](_0x2b6130[_0x45d8('0x2c')])?null:_0x2b6130[_0x45d8('0x2c')][_0x45d8('0x2e')]();}else{logger[_0x45d8('0x2f')](_0x45d8('0x2a'),inspect(_0x2b6130));return null;}}else{logger['error'](_0x45d8('0x30'));return null;}}catch(_0x4e1b2c){logger[_0x45d8('0x2f')](_0x4e1b2c[_0x45d8('0xa')]);return null;}});}logger[_0x45d8('0x25')](util[_0x45d8('0x1a')](_0x45d8('0x36'),_0xc3c5c6[_0x45d8('0x1e')],_0xc3c5c6[_0x45d8('0x1f')],_0xc3c5c6[_0x45d8('0x32')],_0xc3c5c6[_0x45d8('0x33')],_0xc3c5c6[_0x45d8('0x34')]));logger[_0x45d8('0x25')](util[_0x45d8('0x1a')](_0x45d8('0x37'),_0xc3c5c6['context'],_0xc3c5c6[_0x45d8('0x28')],parseInt(_0xc3c5c6['priority'],0xa)+0x1));_0xc3c5c6[_0x45d8('0x38')](_0xc3c5c6[_0x45d8('0x27')],_0xc3c5c6['extension'],parseInt(_0xc3c5c6['priority'],0xa)+0x1);_0xc3c5c6['close']();}function handleNotFound(_0x260661){logger[_0x45d8('0x2f')](util[_0x45d8('0x1a')](_0x45d8('0x39'),_0x260661[_0x45d8('0x1e')]));_0x260661['continueAt'](_0x260661[_0x45d8('0x27')],_0x260661[_0x45d8('0x28')],parseInt(_0x260661[_0x45d8('0x29')],0xa)+0x1);_0x260661[_0x45d8('0x3a')]();}function handleUnpublished(_0x255c42){logger[_0x45d8('0x2f')](util[_0x45d8('0x1a')](_0x45d8('0x3b'),_0x255c42[_0x45d8('0x1e')]));_0x255c42['continueAt'](_0x255c42['context'],_0x255c42[_0x45d8('0x28')],parseInt(_0x255c42['priority'],0xa)+0x1);_0x255c42[_0x45d8('0x3a')]();}module[_0x45d8('0x3c')]={'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 37331bd..43be70d 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 _0xbacf=['prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','_inBody','indexOf','substring','length','trim','slice','emit','headers','line','exports','stream','Transform','call'];(function(_0x28a433,_0x53d91b){var _0x2d7b59=function(_0x37a2d4){while(--_0x37a2d4){_0x28a433['push'](_0x28a433['shift']());}};_0x2d7b59(++_0x53d91b);}(_0xbacf,0xf9));var _0xfbac=function(_0x2baca1,_0x2f3557){_0x2baca1=_0x2baca1-0x0;var _0x9aa62a=_0xbacf[_0x2baca1];return _0x9aa62a;};'use strict';var util=require('util');var Transform=require(_0xfbac('0x0'))[_0xfbac('0x1')];function AGIReply(_0x306d5c){Transform[_0xfbac('0x2')](this,_0x306d5c);this['_localBuffer']='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xfbac('0x3')][_0xfbac('0x4')]=function(_0x2d75e0,_0x1e7b89,_0x2e4915){var _0x21746a='\x0a',_0x32a173=['\x0a\x0a',_0xfbac('0x5')],_0x31ff42=-0x1,_0x5880c9=-0x1,_0x38c928='',_0x35d67f=0x0,_0x150e8a='',_0x14b7e6='';this[_0xfbac('0x6')]+=_0x2d75e0[_0xfbac('0x7')]();_0x150e8a=this['_localBuffer'];if(!this[_0xfbac('0x8')]){_0x35d67f=0x0;while(_0x32a173[_0x35d67f]){while((_0x5880c9=_0x150e8a[_0xfbac('0x9')](_0x32a173[_0x35d67f]))!=-0x1){_0x38c928=_0x32a173[_0x35d67f];_0x14b7e6=_0x150e8a[_0xfbac('0xa')](0x0,_0x5880c9);_0x150e8a=_0x150e8a[_0xfbac('0xa')](_0x5880c9+_0x38c928[_0xfbac('0xb')]);var _0x2e54d5=_0x14b7e6['split'](_0x21746a),_0x4d311e=0x0,_0x11d9b1={},_0x4a064f='',_0x428383='',_0x32eb83=-0x1;while(_0x2e54d5[_0x4d311e]){_0x32eb83=_0x2e54d5[_0x4d311e][_0xfbac('0x9')](':');if(_0x32eb83!=-0x1){_0x4a064f=_0x2e54d5[_0x4d311e]['slice'](0x0,_0x32eb83)[_0xfbac('0xc')]();_0x428383=_0x2e54d5[_0x4d311e][_0xfbac('0xd')](_0x32eb83+0x1)['trim']();if(_0x4a064f[_0xfbac('0xb')]>0x0){_0x11d9b1[_0x4a064f]=_0x428383;}}else{}_0x4d311e++;}this[_0xfbac('0xe')](_0xfbac('0xf'),_0x11d9b1);this['_inBody']=!![];}_0x35d67f++;}this[_0xfbac('0x6')]=_0x150e8a;}else{while((_0x31ff42=_0x150e8a[_0xfbac('0x9')](_0x21746a))!=-0x1){_0x14b7e6=_0x150e8a[_0xfbac('0xa')](0x0,_0x31ff42);this[_0xfbac('0xe')](_0xfbac('0x10'),_0x14b7e6);_0x150e8a=_0x150e8a[_0xfbac('0xa')](_0x31ff42+_0x21746a['length']);}this['_localBuffer']=_0x150e8a;}_0x2e4915();};module[_0xfbac('0x11')]=AGIReply; \ No newline at end of file +var _0xa1a1=['trim','emit','headers','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice'];(function(_0x542994,_0x255c84){var _0x136b03=function(_0x14ae9c){while(--_0x14ae9c){_0x542994['push'](_0x542994['shift']());}};_0x136b03(++_0x255c84);}(_0xa1a1,0x91));var _0x1a1a=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0xa1a1[_0x23c6f2];return _0x4c270b;};'use strict';var util=require(_0x1a1a('0x0'));var Transform=require(_0x1a1a('0x1'))[_0x1a1a('0x2')];function AGIReply(_0x1fb482){Transform[_0x1a1a('0x3')](this,_0x1fb482);this[_0x1a1a('0x4')]='';this[_0x1a1a('0x5')]=![];}util[_0x1a1a('0x6')](AGIReply,Transform);AGIReply[_0x1a1a('0x7')][_0x1a1a('0x8')]=function(_0x34d88c,_0x1c9fbe,_0x264d5c){var _0x1e8807='\x0a',_0x281043=['\x0a\x0a',_0x1a1a('0x9')],_0x290168=-0x1,_0x209795=-0x1,_0x31eed4='',_0x40e8c1=0x0,_0x4aaef8='',_0x40bdcd='';this['_localBuffer']+=_0x34d88c[_0x1a1a('0xa')]();_0x4aaef8=this[_0x1a1a('0x4')];if(!this[_0x1a1a('0x5')]){_0x40e8c1=0x0;while(_0x281043[_0x40e8c1]){while((_0x209795=_0x4aaef8[_0x1a1a('0xb')](_0x281043[_0x40e8c1]))!=-0x1){_0x31eed4=_0x281043[_0x40e8c1];_0x40bdcd=_0x4aaef8[_0x1a1a('0xc')](0x0,_0x209795);_0x4aaef8=_0x4aaef8[_0x1a1a('0xc')](_0x209795+_0x31eed4[_0x1a1a('0xd')]);var _0x1d5168=_0x40bdcd['split'](_0x1e8807),_0x3ad1a9=0x0,_0x179210={},_0x2c82dd='',_0x402fd2='',_0x2924a6=-0x1;while(_0x1d5168[_0x3ad1a9]){_0x2924a6=_0x1d5168[_0x3ad1a9][_0x1a1a('0xb')](':');if(_0x2924a6!=-0x1){_0x2c82dd=_0x1d5168[_0x3ad1a9][_0x1a1a('0xe')](0x0,_0x2924a6)['trim']();_0x402fd2=_0x1d5168[_0x3ad1a9][_0x1a1a('0xe')](_0x2924a6+0x1)[_0x1a1a('0xf')]();if(_0x2c82dd[_0x1a1a('0xd')]>0x0){_0x179210[_0x2c82dd]=_0x402fd2;}}else{}_0x3ad1a9++;}this[_0x1a1a('0x10')](_0x1a1a('0x11'),_0x179210);this[_0x1a1a('0x5')]=!![];}_0x40e8c1++;}this[_0x1a1a('0x4')]=_0x4aaef8;}else{while((_0x290168=_0x4aaef8[_0x1a1a('0xb')](_0x1e8807))!=-0x1){_0x40bdcd=_0x4aaef8[_0x1a1a('0xc')](0x0,_0x290168);this[_0x1a1a('0x10')](_0x1a1a('0x12'),_0x40bdcd);_0x4aaef8=_0x4aaef8[_0x1a1a('0xc')](_0x290168+_0x1e8807[_0x1a1a('0xd')]);}this['_localBuffer']=_0x4aaef8;}_0x264d5c();};module[_0x1a1a('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 86e0b63..2f7d4e4 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 _0xbe45=['createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','agentLogin','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','client','http','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','MailServerOut','Smtp','CloudProvider','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','CreateSquareRecording'];(function(_0x571559,_0x23ae55){var _0x55eec2=function(_0x362683){while(--_0x362683){_0x571559['push'](_0x571559['shift']());}};_0x55eec2(++_0x23ae55);}(_0xbe45,0xf0));var _0x5be4=function(_0x50fa8b,_0x2bf038){_0x50fa8b=_0x50fa8b-0x0;var _0x1dc2a7=_0xbe45[_0x50fa8b];return _0x1dc2a7;};'use strict';var _=require(_0x5be4('0x0'));var moment=require(_0x5be4('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x5be4('0x2')][_0x5be4('0x3')]({'port':0x2329});function request(_0x3e60c5,_0x1bf021){return new Promise(function(_0x67400b,_0x106b95){return client['request'](_0x3e60c5,_0x1bf021)[_0x5be4('0x4')](function(_0x1ddd74){if(_0x1ddd74[_0x5be4('0x5')]){return _0x106b95(_0x1ddd74[_0x5be4('0x5')][_0x5be4('0x6')]);}else{return _0x67400b(_0x1ddd74[_0x5be4('0x7')]);}})[_0x5be4('0x8')](function(_0x2301ae){return _0x106b95(_0x2301ae);});});}exports[_0x5be4('0x9')]=function(){return request(_0x5be4('0xa'),{'options':{'raw':![],'attributes':['id',_0x5be4('0xb'),_0x5be4('0xc')]}});};exports[_0x5be4('0xd')]=function(_0x4abb5d){return request(_0x5be4('0xe'),{'options':{'raw':![],'where':{'name':_0x4abb5d},'attributes':['production']}});};exports['getMailAccountById']=function(_0x35662a){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x35662a},'include':[{'model':_0x5be4('0xf'),'as':_0x5be4('0x10'),'include':[{'model':'CloudProvider','as':_0x5be4('0x11')}]}],'attributes':['id',_0x5be4('0xb'),_0x5be4('0x12')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x349610){return request('ShowSquareProject',{'options':{'where':{'id':_0x349610},'attributes':[_0x5be4('0xb')]}});};exports[_0x5be4('0x13')]=function(_0x2dd93e){return request(_0x5be4('0x14'),{'options':{'where':{'id':_0x2dd93e},'attributes':[_0x5be4('0xb')]}});};exports[_0x5be4('0x15')]=function(_0x3980fc){return request('ShowVariable',{'options':{'where':{'id':_0x3980fc},'attributes':[_0x5be4('0xb')]}});};exports[_0x5be4('0x16')]=function(_0x1d7db7){return request(_0x5be4('0x17'),{'options':{'where':{'id':_0x1d7db7},'attributes':[_0x5be4('0x18')]}});};exports[_0x5be4('0x19')]=function(_0x94f434){return request(_0x5be4('0x1a'),{'options':{'where':{'id':_0x94f434},'attributes':['name']}});};exports[_0x5be4('0x1b')]=function(_0x50b970){return request('GetContactByPhone',{'options':{'where':{'phone':_0x50b970[_0x5be4('0x1c')]},'attributes':['id']}});};exports[_0x5be4('0x1d')]=function(_0x4cce93){return request(_0x5be4('0x1e'),{'options':{'where':{'id':_0x4cce93},'attributes':[_0x5be4('0xb')]}});};exports['getSoundById']=function(_0x4af89d){return request(_0x5be4('0x1f'),{'options':{'where':{'id':_0x4af89d},'attributes':[_0x5be4('0x20')]}});};exports['getIntervalById']=function(_0x553f59){return request(_0x5be4('0x21'),{'options':{'raw':![],'where':{'id':_0x553f59},'include':[{'model':_0x5be4('0x22'),'as':_0x5be4('0x23')}]}});};exports[_0x5be4('0x24')]=function(_0xa20552){return request('ShowSmsAccount',{'options':{'where':{'id':_0xa20552},'attributes':['id',_0x5be4('0xb')]}});};exports['createSmsMessage']=function(_0x242005){return request(_0x5be4('0x25'),{'body':_0x242005});};exports['createSquareDetailsReport']=function(_0xf74e0c){return request(_0x5be4('0x26'),{'body':_0xf74e0c});};exports['createSquareReport']=function(_0x211ec7){return request(_0x5be4('0x27'),{'body':_[_0x5be4('0x28')](_0x211ec7,{'project_name':_0x211ec7[_0x5be4('0x29')],'prev_project_name':_0x211ec7[_0x5be4('0x2a')]||'','is_subproject':_0x211ec7[_0x5be4('0x2a')]?!![]:![],'leaveAt':moment()[_0x5be4('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x51584f){return request(_0x5be4('0x2c'),{'body':_0x51584f});};exports[_0x5be4('0x2d')]=function(_0x5c489e){return request(_0x5be4('0x2e'),{'body':_0x5c489e});};exports[_0x5be4('0x2f')]=function(_0x3bd842){return request(_0x5be4('0x30'),{'options':{'raw':![],'where':{'phone':_0x3bd842[_0x5be4('0x1c')],'ListId':_0x3bd842[_0x5be4('0x31')]}}})['then'](function(_0x1661c2){if(_0x1661c2){return _0x1661c2;}return request(_0x5be4('0x32'),{'body':_0x3bd842});});};exports['getPauseById']=function(_0x3a36cd){return request('ShowPause',{'options':{'where':{'id':_0x3a36cd},'attributes':[_0x5be4('0xb')]}});};exports[_0x5be4('0x33')]=function(_0x47ecca,_0x33aacb){return request('LoginUser',{'body':{'interface':_0x33aacb},'options':{'where':_0x47ecca}});};exports['agentPause']=function(_0x11929e,_0x337ca1,_0x6e2def){return request(_0x5be4('0x34'),{'body':{'type':_0x337ca1,'uniqueid':_0x6e2def},'options':{'where':_0x11929e}});};exports[_0x5be4('0x35')]=function(_0x23775c){return request(_0x5be4('0x36'),{'body':{},'options':{'where':_0x23775c}});};exports[_0x5be4('0x37')]=function(_0x1fc0bd){return request(_0x5be4('0x38'),{'body':{},'options':{'where':_0x1fc0bd}});}; \ No newline at end of file +var _0x9de3=['ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise','client','http','request','then','error','message','result','catch','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','GetContactByPhone','getTrunkById','ShowTrunk','ShowSound','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareMessage','createCmContact','ShowCmHopper'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9de3,0xea));var _0x39de=function(_0x3d8f54,_0x5be188){_0x3d8f54=_0x3d8f54-0x0;var _0x3dfc18=_0x9de3[_0x3d8f54];return _0x3dfc18;};'use strict';var _=require(_0x39de('0x0'));var moment=require('moment');var jayson=require(_0x39de('0x1'));var client=jayson[_0x39de('0x2')][_0x39de('0x3')]({'port':0x2329});function request(_0x4f43f9,_0x3c8483){return new Promise(function(_0x515fba,_0x1010da){return client[_0x39de('0x4')](_0x4f43f9,_0x3c8483)[_0x39de('0x5')](function(_0x1d59d6){if(_0x1d59d6['error']){return _0x1010da(_0x1d59d6[_0x39de('0x6')][_0x39de('0x7')]);}else{return _0x515fba(_0x1d59d6[_0x39de('0x8')]);}})[_0x39de('0x9')](function(_0x2604fa){return _0x1010da(_0x2604fa);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0x39de('0xa')]}});};exports[_0x39de('0xb')]=function(_0x3e92d9){return request(_0x39de('0xc'),{'options':{'raw':![],'where':{'name':_0x3e92d9},'attributes':[_0x39de('0xa')]}});};exports[_0x39de('0xd')]=function(_0x431b4a){return request(_0x39de('0xe'),{'options':{'raw':![],'where':{'id':_0x431b4a},'include':[{'model':'MailServerOut','as':_0x39de('0xf'),'include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id',_0x39de('0x10'),_0x39de('0x11')],'smtp':!![]}});};exports[_0x39de('0x12')]=function(_0x494764){return request(_0x39de('0xc'),{'options':{'where':{'id':_0x494764},'attributes':[_0x39de('0x10')]}});};exports[_0x39de('0x13')]=function(_0x905132){return request(_0x39de('0x14'),{'options':{'where':{'id':_0x905132},'attributes':[_0x39de('0x10')]}});};exports[_0x39de('0x15')]=function(_0x25ca17){return request(_0x39de('0x16'),{'options':{'where':{'id':_0x25ca17},'attributes':[_0x39de('0x10')]}});};exports['getSquareOdbcById']=function(_0x1f36e0){return request(_0x39de('0x17'),{'options':{'where':{'id':_0x1f36e0},'attributes':[_0x39de('0x18')]}});};exports[_0x39de('0x19')]=function(_0x493200){return request('ShowUser',{'options':{'where':{'id':_0x493200},'attributes':[_0x39de('0x10')]}});};exports['getContactByPhone']=function(_0x1fb6fa){return request(_0x39de('0x1a'),{'options':{'where':{'phone':_0x1fb6fa['phone']},'attributes':['id']}});};exports[_0x39de('0x1b')]=function(_0x5dcb96){return request(_0x39de('0x1c'),{'options':{'where':{'id':_0x5dcb96},'attributes':[_0x39de('0x10')]}});};exports['getSoundById']=function(_0x5d34dd){return request(_0x39de('0x1d'),{'options':{'where':{'id':_0x5d34dd},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x315e4a){return request(_0x39de('0x1e'),{'options':{'raw':![],'where':{'id':_0x315e4a},'include':[{'model':_0x39de('0x1f'),'as':_0x39de('0x20')}]}});};exports[_0x39de('0x21')]=function(_0x10c0fc){return request('ShowSmsAccount',{'options':{'where':{'id':_0x10c0fc},'attributes':['id',_0x39de('0x10')]}});};exports[_0x39de('0x22')]=function(_0x45abce){return request('CreateSmsMessage',{'body':_0x45abce});};exports[_0x39de('0x23')]=function(_0x483d49){return request(_0x39de('0x24'),{'body':_0x483d49});};exports[_0x39de('0x25')]=function(_0x30c3e3){return request(_0x39de('0x26'),{'body':_[_0x39de('0x27')](_0x30c3e3,{'project_name':_0x30c3e3['arg_1'],'prev_project_name':_0x30c3e3[_0x39de('0x28')]||'','is_subproject':_0x30c3e3[_0x39de('0x28')]?!![]:![],'leaveAt':moment()[_0x39de('0x29')](_0x39de('0x2a'))})});};exports['createSquareRecording']=function(_0x3fd91a){return request('CreateSquareRecording',{'body':_0x3fd91a});};exports['createSquareMessage']=function(_0x17d876){return request(_0x39de('0x2b'),{'body':_0x17d876});};exports[_0x39de('0x2c')]=function(_0x3ff4d8){return request(_0x39de('0x2d'),{'options':{'raw':![],'where':{'phone':_0x3ff4d8['phone'],'ListId':_0x3ff4d8[_0x39de('0x2e')]}}})[_0x39de('0x5')](function(_0x46dfd2){if(_0x46dfd2){return _0x46dfd2;}return request(_0x39de('0x2f'),{'body':_0x3ff4d8});});};exports[_0x39de('0x30')]=function(_0x2db103){return request(_0x39de('0x31'),{'options':{'where':{'id':_0x2db103},'attributes':['name']}});};exports[_0x39de('0x32')]=function(_0x2ca57d,_0x3760c7){return request(_0x39de('0x33'),{'body':{'interface':_0x3760c7},'options':{'where':_0x2ca57d}});};exports['agentPause']=function(_0x44df77,_0x3d6562,_0x410d9e){return request(_0x39de('0x34'),{'body':{'type':_0x3d6562,'uniqueid':_0x410d9e},'options':{'where':_0x44df77}});};exports['agentUnpause']=function(_0x184ea6){return request(_0x39de('0x35'),{'body':{},'options':{'where':_0x184ea6}});};exports[_0x39de('0x36')]=function(_0x363eff){return request(_0x39de('0x37'),{'body':{},'options':{'where':_0x363eff}});}; \ 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 548ea2d..532c692 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 _0x2cd0=['exports','./polly','./lex'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x2cd0,0x10f));var _0x02cd=function(_0x1353bc,_0x432b07){_0x1353bc=_0x1353bc-0x0;var _0x3097a6=_0x2cd0[_0x1353bc];return _0x3097a6;};var polly=require(_0x02cd('0x0'));var lex=require(_0x02cd('0x1'));module[_0x02cd('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7c49=['./lex','./polly'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x7c49,0x141));var _0x97c4=function(_0x4c4c9f,_0x3f5603){_0x4c4c9f=_0x4c4c9f-0x0;var _0x578758=_0x7c49[_0x4c4c9f];return _0x578758;};var polly=require(_0x97c4('0x0'));var lex=require(_0x97c4('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 5d9137c..f4b4704 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(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4){return lex(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4);}; \ No newline at end of file +var _0x55e0=['./lib/api','exports'];(function(_0x1b85e7,_0x281259){var _0x53aa66=function(_0x4b84f6){while(--_0x4b84f6){_0x1b85e7['push'](_0x1b85e7['shift']());}};_0x53aa66(++_0x281259);}(_0x55e0,0xdc));var _0x055e=function(_0x2be9af,_0x88f907){_0x2be9af=_0x2be9af-0x0;var _0x1f62db=_0x55e0[_0x2be9af];return _0x1f62db;};'use strict';var lex=require(_0x055e('0x0'));module[_0x055e('0x1')]=function(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5){return lex(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5);}; \ 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 860d408..5a5817c 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(_0x491f87,_0x18f826){var _0x4e696f=function(_0x29f455){while(--_0x29f455){_0x491f87['push'](_0x491f87['shift']());}};_0x4e696f(++_0x18f826);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0x166be7,_0x3f02c9){var _0x15f20d=function(_0x57a9bb){while(--_0x57a9bb){_0x166be7['push'](_0x166be7['shift']());}};_0x15f20d(++_0x3f02c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 a9a210d..a82735c 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 _0x7194=['exports'];(function(_0x682687,_0x13282a){var _0x33e469=function(_0x5091f2){while(--_0x5091f2){_0x682687['push'](_0x682687['shift']());}};_0x33e469(++_0x13282a);}(_0x7194,0x192));var _0x4719=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7194[_0x20a584];return _0x4b41a8;};'use strict';var polly=require('./lib/api');module[_0x4719('0x0')]=function(_0x52a3ec,_0x55e182,_0x432fa6,_0x357083,_0x1b7e54,_0x1ec568,_0xb7a7db){return polly(_0x52a3ec,_0x55e182,_0x432fa6,_0x357083,_0x1b7e54,_0x1ec568,_0xb7a7db);}; \ No newline at end of file +var _0x584a=['exports'];(function(_0x4abab9,_0xde21a4){var _0x374eba=function(_0x3659f7){while(--_0x3659f7){_0x4abab9['push'](_0x4abab9['shift']());}};_0x374eba(++_0xde21a4);}(_0x584a,0x177));var _0xa584=function(_0x546c68,_0x5c0116){_0x546c68=_0x546c68-0x0;var _0x4a2389=_0x584a[_0x546c68];return _0x4a2389;};'use strict';var polly=require('./lib/api');module[_0xa584('0x0')]=function(_0x4c34bc,_0x190c12,_0x4f71be,_0x451c88,_0x3788a1,_0x57abeb,_0x45a324){return polly(_0x4c34bc,_0x190c12,_0x4f71be,_0x451c88,_0x3788a1,_0x57abeb,_0x45a324);}; \ 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 2dbee0e..27263a6 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 _0xb08a=['randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird'];(function(_0x512f81,_0x4a7986){var _0xa15099=function(_0x1f7371){while(--_0x1f7371){_0x512f81['push'](_0x512f81['shift']());}};_0xa15099(++_0x4a7986);}(_0xb08a,0x1a2));var _0xab08=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xb08a[_0x34bf97];return _0x292719;};'use strict';var fs=require('fs');var path=require(_0xab08('0x0'));var BPromise=require(_0xab08('0x1'));var rs=require(_0xab08('0x2'));var AWS=require(_0xab08('0x3'));function pollyResult(_0x58c7d8,_0x197d14,_0x191444){return new BPromise(function(_0x348671,_0x4a76b7){_0x58c7d8[_0xab08('0x4')](_0x197d14,function(_0x17dd51,_0x2405cf){if(_0x17dd51){_0x4a76b7(_0x17dd51);}else if(_0x2405cf){if(_0x2405cf[_0xab08('0x5')]instanceof Buffer){fs[_0xab08('0x6')](_0x191444,_0x2405cf[_0xab08('0x5')],function(_0x1f3024){if(_0x1f3024){_0x4a76b7(_0x1f3024);}else{_0x348671();}});}else{_0x4a76b7(new Error(_0xab08('0x7')));}}else{_0x4a76b7(new Error(_0xab08('0x8')));}});});}module[_0xab08('0x9')]=function(_0x185401,_0x3e3def,_0x337ac1,_0xe98362,_0x646645,_0x2cc719,_0x37c896){var _0x54f521=new AWS['Polly']({'accessKeyId':_0x185401,'secretAccessKey':_0x3e3def,'region':_0x337ac1});var _0x2cab78={'Text':_0x646645,'TextType':_0x2cc719||_0xab08('0xa'),'OutputFormat':_0xab08('0xb'),'VoiceId':_0xe98362};return pollyResult(_0x54f521,_0x2cab78,_0x37c896);}; \ No newline at end of file +var _0x2679=['path','bluebird','randomstring','aws-sdk','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text'];(function(_0x406ba5,_0x39fa4b){var _0x557db7=function(_0x40f28b){while(--_0x40f28b){_0x406ba5['push'](_0x406ba5['shift']());}};_0x557db7(++_0x39fa4b);}(_0x2679,0x98));var _0x9267=function(_0x24a188,_0x4efd77){_0x24a188=_0x24a188-0x0;var _0x493a78=_0x2679[_0x24a188];return _0x493a78;};'use strict';var fs=require('fs');var path=require(_0x9267('0x0'));var BPromise=require(_0x9267('0x1'));var rs=require(_0x9267('0x2'));var AWS=require(_0x9267('0x3'));function pollyResult(_0x843afa,_0x5aeeac,_0x4bcd93){return new BPromise(function(_0x4b1a27,_0xb6abe9){_0x843afa['synthesizeSpeech'](_0x5aeeac,function(_0x322859,_0x119a74){if(_0x322859){_0xb6abe9(_0x322859);}else if(_0x119a74){if(_0x119a74[_0x9267('0x4')]instanceof Buffer){fs['writeFile'](_0x4bcd93,_0x119a74[_0x9267('0x4')],function(_0x3af7c2){if(_0x3af7c2){_0xb6abe9(_0x3af7c2);}else{_0x4b1a27();}});}else{_0xb6abe9(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0xb6abe9(new Error(_0x9267('0x5')));}});});}module['exports']=function(_0x122cc0,_0x363929,_0x4ed71e,_0x884ffb,_0x3a49f4,_0x44613f,_0x19273c){var _0x2bf28c=new AWS[(_0x9267('0x6'))]({'accessKeyId':_0x122cc0,'secretAccessKey':_0x363929,'region':_0x4ed71e});var _0x2ffa29={'Text':_0x3a49f4,'TextType':_0x44613f||_0x9267('0x7'),'OutputFormat':'mp3','VoiceId':_0x884ffb};return pollyResult(_0x2bf28c,_0x2ffa29,_0x19273c);}; \ 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 15c5177..624bd11 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 _0xfb18=['exports','./lib/api'];(function(_0x1685e9,_0x40d849){var _0x1cade1=function(_0x4dff8d){while(--_0x4dff8d){_0x1685e9['push'](_0x1685e9['shift']());}};_0x1cade1(++_0x40d849);}(_0xfb18,0xfd));var _0x8fb1=function(_0x43dc7e,_0x49a390){_0x43dc7e=_0x43dc7e-0x0;var _0x21e12d=_0xfb18[_0x43dc7e];return _0x21e12d;};'use strict';var asr=require(_0x8fb1('0x0'));module[_0x8fb1('0x1')]=function(_0x4c11db,_0x45a3b7,_0x533198,_0x17994c){return asr(_0x4c11db,_0x45a3b7,_0x533198);}; \ No newline at end of file +var _0x8af0=['exports','./lib/api'];(function(_0x4c7d8b,_0x572388){var _0x187158=function(_0x5e956d){while(--_0x5e956d){_0x4c7d8b['push'](_0x4c7d8b['shift']());}};_0x187158(++_0x572388);}(_0x8af0,0x123));var _0x08af=function(_0x4f6d08,_0x1b3dd0){_0x4f6d08=_0x4f6d08-0x0;var _0x53a9c6=_0x8af0[_0x4f6d08];return _0x53a9c6;};'use strict';var asr=require(_0x08af('0x0'));module[_0x08af('0x1')]=function(_0x19d2c5,_0x31a34c,_0x2f8b2d,_0x5dd9f7){return asr(_0x19d2c5,_0x31a34c,_0x2f8b2d);}; \ 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 85c9a57..f6ab543 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 _0xb377=['string','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x1b08b1,_0x249597){var _0x16e073=function(_0x3535e9){while(--_0x3535e9){_0x1b08b1['push'](_0x1b08b1['shift']());}};_0x16e073(++_0x249597);}(_0xb377,0x1b6));var _0x7b37=function(_0x32f73e,_0x232d84){_0x32f73e=_0x32f73e-0x0;var _0x198d1e=_0xb377[_0x32f73e];return _0x198d1e;};'use strict';var url=require(_0x7b37('0x0'));var BPromise=require(_0x7b37('0x1'));var fs=require('fs');var host=_0x7b37('0x2');module[_0x7b37('0x3')]=function(_0xbcbce6,_0x36868b,_0x15bc68){return new BPromise(function(_0x3c4851,_0x2018bd){var _0x13f4c4;if(typeof _0xbcbce6!==_0x7b37('0x4')||_0xbcbce6[_0x7b37('0x5')]===0x0){return _0x2018bd('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x36868b!=='string'||_0x36868b[_0x7b37('0x5')]===0x0){return _0x2018bd('key\x20should\x20be\x20a\x20string');}if(typeof _0x15bc68!=='undefined'&&(typeof _0x15bc68!==_0x7b37('0x4')||_0x15bc68[_0x7b37('0x5')]===0x0)){return _0x2018bd(_0x7b37('0x6'));}try{_0x13f4c4=fs[_0x7b37('0x7')](_0xbcbce6)[_0x7b37('0x8')](_0x7b37('0x9'));}catch(_0x4610cd){return _0x2018bd(_0x4610cd);}return _0x3c4851({'method':_0x7b37('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x36868b,'body':{'config':{'encoding':_0x7b37('0xb'),'sampleRateHertz':_0x7b37('0xc'),'languageCode':_0x15bc68},'audio':{'content':_0x13f4c4}},'json':!![]});});}; \ No newline at end of file +var _0x54f3=['LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','string','key\x20should\x20be\x20a\x20string','undefined','length','readFileSync','base64'];(function(_0x359dae,_0x1d9105){var _0x183a50=function(_0xcbef90){while(--_0xcbef90){_0x359dae['push'](_0x359dae['shift']());}};_0x183a50(++_0x1d9105);}(_0x54f3,0x120));var _0x354f=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x54f3[_0x8c43de];return _0xa6591b;};'use strict';var url=require('url');var BPromise=require(_0x354f('0x0'));var fs=require('fs');var host=_0x354f('0x1');module[_0x354f('0x2')]=function(_0x1cb51f,_0x2cd824,_0x517a53){return new BPromise(function(_0x48d7aa,_0xe4efe){var _0x86b73e;if(typeof _0x1cb51f!==_0x354f('0x3')||_0x1cb51f['length']===0x0){return _0xe4efe('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x2cd824!==_0x354f('0x3')||_0x2cd824['length']===0x0){return _0xe4efe(_0x354f('0x4'));}if(typeof _0x517a53!==_0x354f('0x5')&&(typeof _0x517a53!==_0x354f('0x3')||_0x517a53[_0x354f('0x6')]===0x0)){return _0xe4efe('lang\x20should\x20be\x20a\x20string');}try{_0x86b73e=fs[_0x354f('0x7')](_0x1cb51f)['toString'](_0x354f('0x8'));}catch(_0x1fc9d9){return _0xe4efe(_0x1fc9d9);}return _0x48d7aa({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x2cd824,'body':{'config':{'encoding':_0x354f('0x9'),'sampleRateHertz':_0x354f('0xa'),'languageCode':_0x517a53},'audio':{'content':_0x86b73e}},'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 da95580..3df0e01 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 _0x1f8e=['exports','./asr'];(function(_0x491780,_0x2bfddc){var _0x56e231=function(_0x216bd5){while(--_0x216bd5){_0x491780['push'](_0x491780['shift']());}};_0x56e231(++_0x2bfddc);}(_0x1f8e,0xdd));var _0xe1f8=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x1f8e[_0x2555d0];return _0x3bb486;};var asr=require(_0xe1f8('0x0'));module[_0xe1f8('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe824=['exports'];(function(_0x59719d,_0x4b74d7){var _0x2bd9d4=function(_0x5e4dc2){while(--_0x5e4dc2){_0x59719d['push'](_0x59719d['shift']());}};_0x2bd9d4(++_0x4b74d7);}(_0xe824,0x79));var _0x4e82=function(_0x437aa2,_0x48d508){_0x437aa2=_0x437aa2-0x0;var _0x28ac4d=_0xe824[_0x437aa2];return _0x28ac4d;};var asr=require('./asr');module[_0x4e82('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 228596e..8ca43b7 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 _0x2d1e=['pipe','end','protocol','data','transcode','error\x20convert','finish\x20to\x20convert','start','tmp','.wav','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','generate','.mp3','from','audioContent','writeFile','777','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','action','fulfillment','speech','score','status','metadata','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error'];(function(_0x462f5c,_0xd41889){var _0x52df33=function(_0x54f23a){while(--_0x54f23a){_0x462f5c['push'](_0x462f5c['shift']());}};_0x52df33(++_0xd41889);}(_0x2d1e,0x101));var _0xe2d1=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x2d1e[_0x5ddb1c];return _0x354adc;};'use strict';var apiai=require(_0xe2d1('0x0'));var BPromise=require(_0xe2d1('0x1'));var dialogflow=require(_0xe2d1('0x2'));var fs=require('fs');var http=require(_0xe2d1('0x3'));var https=require(_0xe2d1('0x4'));var md5=require(_0xe2d1('0x5'));var path=require(_0xe2d1('0x6'));var querystring=require('querystring');var rp=require(_0xe2d1('0x7'));var rs=require(_0xe2d1('0x8'));var sox=require(_0xe2d1('0x9'));var tts=require(_0xe2d1('0xa'));var urlParse=require(_0xe2d1('0xb'))[_0xe2d1('0xc')];var util=require(_0xe2d1('0xd'));var aws=require(_0xe2d1('0xe'));var google=require(_0xe2d1('0xf'));var sestek=require(_0xe2d1('0x10'));var tilde=require('./tilde');var logger=require(_0xe2d1('0x11'))(_0xe2d1('0x12'));var ISPEECH_API=_0xe2d1('0x13');function downloadFile(_0x1ed75b,_0x3e719f){return new BPromise(function(_0x3ea656,_0x45750e){var _0x3b59fc=urlParse(_0x1ed75b);var _0x54f21b=_0x3b59fc['protocol']===_0xe2d1('0x14')?https:http;var _0x2327bf={'host':_0x3b59fc[_0xe2d1('0x15')],'path':_0x3b59fc[_0xe2d1('0x6')],'headers':{'user-agent':_0xe2d1('0x16')}};_0x54f21b[_0xe2d1('0x17')](_0x2327bf,function(_0xf372b5){if(_0xf372b5['statusCode']!==0xc8){logger[_0xe2d1('0x18')](_0xe2d1('0x19')+_0x1ed75b+_0xe2d1('0x1a')+_0xf372b5[_0xe2d1('0x1b')]+'\x20('+_0xf372b5[_0xe2d1('0x1c')]+')');_0x45750e(new Error(_0xe2d1('0x19')+_0x1ed75b+_0xe2d1('0x1a')+_0xf372b5[_0xe2d1('0x1b')]+'\x20('+_0xf372b5['statusMessage']+')'));return;}var _0x3388be=fs['createWriteStream'](_0x3e719f);_0x3388be['on'](_0xe2d1('0x1d'),function(){logger[_0xe2d1('0x1e')](_0xe2d1('0x1f'));_0x3388be[_0xe2d1('0x20')](_0x3ea656);});_0x3388be['on'](_0xe2d1('0x18'),function(_0x219423){fs[_0xe2d1('0x21')](_0x3e719f);logger[_0xe2d1('0x18')](_0xe2d1('0x22'),_0x219423);_0x45750e(_0x219423);});_0xf372b5[_0xe2d1('0x23')](_0x3388be);})['on']('error',function(_0xad3c68){logger[_0xe2d1('0x18')](_0xad3c68);_0x45750e(_0xad3c68);})[_0xe2d1('0x24')]();});}function uploadFile(_0xbeb3cc){return new BPromise(function(_0x3dc282,_0x44970a){var _0x7af2d=urlParse(_0xbeb3cc);var _0x56ce57=_0x7af2d[_0xe2d1('0x25')]===_0xe2d1('0x14')?https:http;var _0x526d45={'host':_0x7af2d['host'],'path':_0x7af2d[_0xe2d1('0x6')],'headers':{'user-agent':_0xe2d1('0x16')}};_0x56ce57[_0xe2d1('0x17')](_0x526d45,function(_0x23eaab){if(_0x23eaab[_0xe2d1('0x1b')]!==0xc8){_0x44970a(new Error(_0xe2d1('0x19')+_0xbeb3cc+_0xe2d1('0x1a')+_0x23eaab[_0xe2d1('0x1b')]+'\x20('+_0x23eaab[_0xe2d1('0x1c')]+')'));return;}var _0x194a7f='';_0x23eaab['on'](_0xe2d1('0x26'),function(_0x1769ac){_0x194a7f+=_0x1769ac;});_0x23eaab['on'](_0xe2d1('0x24'),function(){_0x3dc282(_0x194a7f);});})['on'](_0xe2d1('0x18'),function(_0x5b1bed){_0x44970a(_0x5b1bed);})[_0xe2d1('0x24')]();});}function convertFile(_0x20455e,_0x5c0b33){return new BPromise(function(_0x4505aa,_0x1c1e20){var _0x25ad16=sox[_0xe2d1('0x27')](_0x20455e,_0x5c0b33,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x25ad16['on'](_0xe2d1('0x18'),function(_0x34d6c3){logger['error'](_0xe2d1('0x28'),_0x34d6c3);_0x1c1e20(_0x34d6c3);});_0x25ad16['on'](_0xe2d1('0x24'),function(){logger[_0xe2d1('0x1e')](_0xe2d1('0x29'));_0x4505aa();});_0x25ad16[_0xe2d1('0x2a')]();});}function base64Decode(_0x5b2c07,_0x1a52e1){var _0x103635=path['resolve'](__dirname,_0xe2d1('0x2b'),rs['generate'](0x4)+_0xe2d1('0x2c'));fs['writeFileSync'](_0x103635,_0x5b2c07,_0xe2d1('0x2d'));return convertFile(_0x103635,_0x1a52e1)[_0xe2d1('0x2e')](function(){try{fs[_0xe2d1('0x21')](_0x103635);fs[_0xe2d1('0x2f')](_0x1a52e1,'777');}catch(_0x58bbaa){logger[_0xe2d1('0x18')](_0x58bbaa);}return _0x1a52e1[_0xe2d1('0x30')]('.')[0x0];});}function base64Encode(_0x237e40){var _0x29b852=fs[_0xe2d1('0x31')](_0x237e40);return new Buffer(_0x29b852)[_0xe2d1('0x32')]('base64');}exports[_0xe2d1('0x33')]=function(_0x420669,_0x833c1a,_0x2df2d4,_0x575337,_0x5b8da6,_0x3f3413){var _0x115ed5,_0x337b06;var _0x123de8=_0xe2d1('0x34');var _0x313555=_0xe2d1('0x35')+_0x420669;var _0x334e7b={};if(_0x833c1a===_0xe2d1('0x36')){_0x334e7b[_0xe2d1('0x37')]={'ssml':_0x2df2d4};}else{_0x334e7b[_0xe2d1('0x37')]={'text':_0x2df2d4};};_0x334e7b[_0xe2d1('0x38')]={'languageCode':_0x575337,'ssmlGender':_0x5b8da6};_0x334e7b[_0xe2d1('0x39')]={'audioEncoding':_0xe2d1('0x3a'),'sampleRateHertz':0x1f40};var _0x3b6f8e={'url':_0x123de8+_0xe2d1('0x3b')+_0x313555,'method':_0xe2d1('0x3c'),'json':!![],'body':_0x334e7b};return rp(_0x3b6f8e)[_0xe2d1('0x2e')](function(_0x49ff32){return new BPromise(function(_0x340614,_0x13fa27){_0x115ed5=path[_0xe2d1('0x3d')](__dirname,_0xe2d1('0x2b'),rs[_0xe2d1('0x3e')](0x4)+_0xe2d1('0x3f'));var _0x452cfc=Buffer[_0xe2d1('0x40')](_0x49ff32[_0xe2d1('0x41')],_0xe2d1('0x2d'));return fs[_0xe2d1('0x42')](_0x115ed5,_0x452cfc,function(_0x50414a){_0x13fa27(_0x50414a);},function(_0x2cf328){fs[_0xe2d1('0x2f')](_0x115ed5,_0xe2d1('0x43'));_0x340614(_0x2cf328);});});})[_0xe2d1('0x2e')](function(_0x2b8586){_0x337b06=path[_0xe2d1('0x3d')](__dirname,_0xe2d1('0x2b'),rs[_0xe2d1('0x3e')](0x4)+_0xe2d1('0x2c'));return convertFile(_0x115ed5,_0x337b06);})['then'](function(){try{fs[_0xe2d1('0x21')](_0x115ed5);fs[_0xe2d1('0x2f')](_0x337b06,_0xe2d1('0x43'));}catch(_0x50971a){logger[_0xe2d1('0x18')](_0x50971a);}logger[_0xe2d1('0x1e')](_0xe2d1('0x44'),_0x337b06[_0xe2d1('0x30')]('.')[0x0]);return _0x337b06[_0xe2d1('0x30')]('.')[0x0];});};exports['googleTTS']=function(_0xa03257,_0x12173f){var _0x1011f1=_0xe2d1('0x45');var _0x27ba55,_0x3a6b48;var _0x42cdac;var _0x66c3af={'encoding':_0xe2d1('0x46'),'method':_0xe2d1('0x3c'),'timeout':0x2710,'url':_0x1011f1,'headers':{'Content-Type':_0xe2d1('0x47')},'body':_0xe2d1('0x48')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0xe2d1('0x49')]([_0xa03257,_0x12173f||'en',![],_0xe2d1('0x4a')]),null,'generic']]]))};return rp(_0x66c3af)['then'](function(_0x229f6b){try{_0x42cdac=eval(_0x229f6b['slice'](0x5))[0x0][0x2];}catch(_0x1237ca){throw new Error(_0xe2d1('0x4b')+_0x229f6b[_0xe2d1('0x26')]);}if(!_0x42cdac){if(_0xa03257[_0xe2d1('0x4c')]>0xc8){throw new Error(_0xe2d1('0x4d'));}else{throw new Error(_0xe2d1('0x4e')+_0x12173f+_0xe2d1('0x4f'));}}try{_0x42cdac=eval(_0x42cdac)[0x0];}catch(_0x522f4f){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xe2d1('0x26')]);}const _0x8ae003=_0x42cdac;_0x27ba55=path[_0xe2d1('0x3d')](__dirname,_0xe2d1('0x2b'),rs['generate'](0x4)+_0xe2d1('0x3f'));fs[_0xe2d1('0x50')](_0x27ba55,_0x42cdac,{'encoding':'base64'});_0x3a6b48=path['resolve'](__dirname,_0xe2d1('0x2b'),rs[_0xe2d1('0x3e')](0x4)+_0xe2d1('0x2c'));return convertFile(_0x27ba55,_0x3a6b48);})[_0xe2d1('0x2e')](function(){try{fs[_0xe2d1('0x21')](_0x27ba55);fs[_0xe2d1('0x2f')](_0x3a6b48,_0xe2d1('0x43'));}catch(_0x3308a1){logger['error'](_0x3308a1);}logger['info'](_0xe2d1('0x51'),_0x3a6b48[_0xe2d1('0x30')]('.')[0x0]);return _0x3a6b48['split']('.')[0x0];});};exports[_0xe2d1('0x52')]=function(_0xe3705a,_0x3e1478,_0x376b5f){return google[_0xe2d1('0x53')](_0xe3705a,_0x3e1478,_0x376b5f)[_0xe2d1('0x2e')](function(_0x1d4cca){logger[_0xe2d1('0x1e')](_0x1d4cca[_0xe2d1('0x54')]);return rp(_0x1d4cca);})['then'](function(_0x298e42){var _0x5bd10d='';var _0x1cbb7b=0x0;try{fs[_0xe2d1('0x21')](_0xe3705a);}catch(_0x54b9aa){logger[_0xe2d1('0x18')](_0x54b9aa);}if(_0x298e42&&_0x298e42['results']){_0x5bd10d=_0x298e42[_0xe2d1('0x55')][_0xe2d1('0x56')](function(_0x1a39f0){return _0x1a39f0&&_0x1a39f0[_0xe2d1('0x57')][0x0]&&_0x1a39f0[_0xe2d1('0x57')][0x0][_0xe2d1('0x58')]?_0x1a39f0[_0xe2d1('0x57')][0x0]['transcript']:'';})[_0xe2d1('0x59')]('\x0a');_0x1cbb7b=_0x298e42[_0xe2d1('0x55')]['map'](function(_0x5ce165){return _0x5ce165&&_0x5ce165[_0xe2d1('0x57')][0x0]&&_0x5ce165['alternatives'][0x0]['confidence']?_0x5ce165['alternatives'][0x0][_0xe2d1('0x5a')]:0x0;})[_0xe2d1('0x59')]('\x0a');}logger[_0xe2d1('0x1e')](_0xe2d1('0x5b'),_0x5bd10d);logger[_0xe2d1('0x1e')](_0xe2d1('0x5c'),_0x1cbb7b);return{'transcript':_0x5bd10d,'confidence':_0x1cbb7b};})[_0xe2d1('0x5d')](function(_0x1bb9eb){logger[_0xe2d1('0x18')](_0xe2d1('0x5e'),_0x1bb9eb[_0xe2d1('0x1b')],_0x1bb9eb[_0xe2d1('0x5f')],_0x1bb9eb[_0xe2d1('0x60')]);});};exports['googleDialogflow']=function(_0x441ece,_0x31f618,_0x533061,_0x3ebb75){var _0x436bc3=apiai(_0x31f618,{'language':_0x3ebb75||'en'});return _0x436bc3[_0xe2d1('0x61')](_0x533061,{'sessionId':md5(_0x441ece)})[_0xe2d1('0x2e')](function(_0x2f84e9){logger[_0xe2d1('0x1e')](JSON['stringify'](_0x2f84e9));return{'source':_0x2f84e9[_0xe2d1('0x62')][_0xe2d1('0x63')],'resolvedQuery':_0x2f84e9[_0xe2d1('0x62')][_0xe2d1('0x64')],'action':_0x2f84e9[_0xe2d1('0x62')][_0xe2d1('0x65')],'actionIncomplete':_0x2f84e9['result']['actionIncomplete'],'speech':_0x2f84e9[_0xe2d1('0x62')][_0xe2d1('0x66')][_0xe2d1('0x67')],'score':_0x2f84e9['result'][_0xe2d1('0x68')],'statusCode':_0x2f84e9[_0xe2d1('0x69')]['code'],'endConversation':_0x2f84e9[_0xe2d1('0x62')][_0xe2d1('0x6a')]['endConversation']||![],'isFallbackIntent':_0x2f84e9[_0xe2d1('0x62')]['metadata']['isFallbackIntent']};});};exports[_0xe2d1('0x6b')]=function(_0x22d441,_0x28bfe7,_0x29bedb,_0x3c1baa,_0x5a0232,_0x1a539d){var _0x74d4fe=_0x3c1baa[_0xe2d1('0x6c')](/\\n/g,'\x0a');var _0x4aa157={'credentials':{'private_key':_0x74d4fe,'client_email':_0x29bedb}};var _0x25890f=new dialogflow[(_0xe2d1('0x6d'))](_0x4aa157);var _0x16f236=_0x25890f[_0xe2d1('0x6e')](_0x28bfe7,md5(_0x22d441));var _0x419108={'session':_0x16f236,'queryInput':{'text':{'text':_0x5a0232,'languageCode':_0x1a539d}}};return _0x25890f[_0xe2d1('0x6f')](_0x419108)['then'](function(_0x1b6858){if(_0x1b6858&&_0x1b6858['length']){logger[_0xe2d1('0x1e')](_0xe2d1('0x70'),JSON[_0xe2d1('0x49')](_0x1b6858));var _0x496884=_0x1b6858[0x0];if(_0x496884){var _0x13b53f={'action':_0x496884[_0xe2d1('0x71')][_0xe2d1('0x65')],'allRequiredParamsPresent':_0x496884['queryResult'][_0xe2d1('0x72')],'endConversation':_0x496884[_0xe2d1('0x71')][_0xe2d1('0x73')]&&_0x496884[_0xe2d1('0x71')][_0xe2d1('0x73')][_0xe2d1('0x74')]?_0x496884[_0xe2d1('0x71')]['diagnosticInfo'][_0xe2d1('0x74')]['end_conversation'][_0xe2d1('0x75')]:![],'fulfillmentText':_0x496884[_0xe2d1('0x71')][_0xe2d1('0x76')],'intentName':_0x496884['queryResult'][_0xe2d1('0x77')][_0xe2d1('0x5f')],'intentDisplayName':_0x496884[_0xe2d1('0x71')][_0xe2d1('0x77')][_0xe2d1('0x78')],'isFallbackIntent':_0x496884[_0xe2d1('0x71')]['intent'][_0xe2d1('0x79')],'languageCode':_0x496884[_0xe2d1('0x71')][_0xe2d1('0x7a')],'queryText':_0x496884[_0xe2d1('0x71')]['queryText'],'responseId':_0x496884[_0xe2d1('0x7b')],'score':_0x496884[_0xe2d1('0x71')][_0xe2d1('0x7c')],'speech':_0x496884[_0xe2d1('0x71')][_0xe2d1('0x76')],'providerResponse':JSON[_0xe2d1('0x49')](_0x1b6858)};return _0x13b53f;}}});};exports['tildeASR']=function(_0x490f35,_0x41c858,_0x298ae5,_0x1c6271){return tilde['asr'](_0x490f35,_0x41c858,_0x298ae5,_0x1c6271)[_0xe2d1('0x2e')](function(_0x391b66){try{fs['unlink'](_0x490f35);}catch(_0x491be7){logger[_0xe2d1('0x18')](_0x491be7);}logger[_0xe2d1('0x1e')](_0xe2d1('0x7d'),_0x391b66[_0xe2d1('0x58')]);logger[_0xe2d1('0x1e')](_0xe2d1('0x7e'),_0x391b66[_0xe2d1('0x5a')]);return _0x391b66;});};exports[_0xe2d1('0x7f')]=function(_0xe092d0,_0x46533b,_0xa9c01d,_0x51247c,_0x1f677b,_0x45a5b4){var _0x5c16a1=path['resolve'](__dirname,_0xe2d1('0x2b'),rs[_0xe2d1('0x3e')](0x4)+_0xe2d1('0x3f'));var _0x4f663b;return aws[_0xe2d1('0x80')](_0xe092d0,_0x46533b,_0xa9c01d,_0x51247c,_0x1f677b,_0x45a5b4,_0x5c16a1)[_0xe2d1('0x2e')](function(){_0x4f663b=path[_0xe2d1('0x3d')](__dirname,_0xe2d1('0x2b'),rs['generate'](0x4)+'.wav');return convertFile(_0x5c16a1,_0x4f663b);})[_0xe2d1('0x2e')](function(){try{fs['unlink'](_0x5c16a1);fs[_0xe2d1('0x2f')](_0x4f663b,_0xe2d1('0x43'));}catch(_0x33b7ae){logger[_0xe2d1('0x18')](_0x33b7ae);}return _0x4f663b[_0xe2d1('0x30')]('.')[0x0];});};exports[_0xe2d1('0x81')]=function(_0x1cf8d6,_0x3a24ef,_0x10375a,_0x507f81,_0x536f49,_0x376eec){return aws[_0xe2d1('0x82')](_0x1cf8d6,_0x3a24ef,_0x10375a,_0x507f81,_0x536f49,_0x376eec)[_0xe2d1('0x2e')](function(_0x572e17){logger[_0xe2d1('0x1e')](JSON[_0xe2d1('0x49')](_0x572e17));return _0x572e17;});};exports['ispeechTTS']=function(_0x5bbf26,_0x425648,_0x54db20,_0x460e1b){var _0x59bffa=util[_0xe2d1('0x83')](_0xe2d1('0x84'),ISPEECH_API,_0x5bbf26,encodeURIComponent(_0x425648),_0x54db20,_0x460e1b);var _0x6c374b=path['resolve'](__dirname,_0xe2d1('0x2b'),rs[_0xe2d1('0x3e')](0x4)+_0xe2d1('0x3f'));var _0x949c2b;return downloadFile(_0x59bffa,_0x6c374b)['then'](function(){_0x949c2b=path[_0xe2d1('0x3d')](__dirname,_0xe2d1('0x2b'),rs['generate'](0x4)+_0xe2d1('0x2c'));return convertFile(_0x6c374b,_0x949c2b);})[_0xe2d1('0x2e')](function(){try{fs['unlink'](_0x6c374b);fs[_0xe2d1('0x2f')](_0x949c2b,'777');}catch(_0x449091){logger['error'](_0x449091);}return _0x949c2b[_0xe2d1('0x30')]('.')[0x0];});};exports[_0xe2d1('0x85')]=function(_0x24f84d,_0x29d616,_0x4a63ef,_0x216f1d){var _0xbd92fd=util[_0xe2d1('0x83')](_0xe2d1('0x86'),ISPEECH_API,_0x29d616,_0x4a63ef,base64Encode(_0x24f84d),_0x216f1d?util[_0xe2d1('0x83')]('model=%s',encodeURIComponent(_0x216f1d)):_0xe2d1('0x87'));return uploadFile(_0xbd92fd)[_0xe2d1('0x2e')](function(_0x15b354){return querystring[_0xe2d1('0xc')](_0x15b354);});};exports[_0xe2d1('0x88')]=function(_0x484622,_0x353c6f){return sestek[_0xe2d1('0x89')](_0x484622,_0x353c6f)[_0xe2d1('0x2e')](function(_0x38b90b){logger['info'](JSON[_0xe2d1('0x49')](_0x38b90b));var _0x39bb55={'speech':_0x38b90b[_0xe2d1('0x8a')],'action':_0x38b90b['channelData']?_0x38b90b[_0xe2d1('0x8b')][_0xe2d1('0x8c')]:undefined,'actiondata':_0x38b90b['channelData']?_0x38b90b[_0xe2d1('0x8b')][_0xe2d1('0x8d')]:undefined};if(_0x38b90b[_0xe2d1('0x8b')]&&_0x38b90b[_0xe2d1('0x8b')][_0xe2d1('0x8e')]){return base64Decode(_0x38b90b['channelData'][_0xe2d1('0x8e')][_0xe2d1('0x8f')],path[_0xe2d1('0x3d')](__dirname,_0xe2d1('0x2b'),rs['generate'](0x4)+_0xe2d1('0x2c')))[_0xe2d1('0x2e')](function(_0x3cc4ee){_0x39bb55[_0xe2d1('0x90')]=_0x3cc4ee;return _0x39bb55;});}return _0x39bb55;});};exports[_0xe2d1('0x91')]=function(){return __dirname;}; \ No newline at end of file +var _0x9abe=['tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','AudioFromTts','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','unlink','download\x20error','pipe','end','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','generate','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','tmp','.mp3','from','audioContent','777','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','.wav','goggleTTS\x20path','asr','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','fields','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence'];(function(_0xb5ed0b,_0x55c30f){var _0x276fbe=function(_0x15cf82){while(--_0x15cf82){_0xb5ed0b['push'](_0xb5ed0b['shift']());}};_0x276fbe(++_0x55c30f);}(_0x9abe,0x126));var _0xe9ab=function(_0x16c99d,_0x3b81c9){_0x16c99d=_0x16c99d-0x0;var _0x4295aa=_0x9abe[_0x16c99d];return _0x4295aa;};'use strict';var apiai=require(_0xe9ab('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xe9ab('0x1'));var fs=require('fs');var http=require(_0xe9ab('0x2'));var https=require(_0xe9ab('0x3'));var md5=require(_0xe9ab('0x4'));var path=require(_0xe9ab('0x5'));var querystring=require('querystring');var rp=require(_0xe9ab('0x6'));var rs=require(_0xe9ab('0x7'));var sox=require(_0xe9ab('0x8'));var tts=require(_0xe9ab('0x9'));var urlParse=require(_0xe9ab('0xa'))[_0xe9ab('0xb')];var util=require('util');var aws=require(_0xe9ab('0xc'));var google=require(_0xe9ab('0xd'));var sestek=require('./sestek');var tilde=require(_0xe9ab('0xe'));var logger=require(_0xe9ab('0xf'))(_0xe9ab('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x4fb3f2,_0x5dcc18){return new BPromise(function(_0x3fe168,_0x4c9b3f){var _0x1d7674=urlParse(_0x4fb3f2);var _0x1002cd=_0x1d7674[_0xe9ab('0x11')]===_0xe9ab('0x12')?https:http;var _0x39b7b6={'host':_0x1d7674[_0xe9ab('0x13')],'path':_0x1d7674['path'],'headers':{'user-agent':_0xe9ab('0x14')}};_0x1002cd[_0xe9ab('0x15')](_0x39b7b6,function(_0x32a1e2){if(_0x32a1e2[_0xe9ab('0x16')]!==0xc8){logger[_0xe9ab('0x17')](_0xe9ab('0x18')+_0x4fb3f2+_0xe9ab('0x19')+_0x32a1e2[_0xe9ab('0x16')]+'\x20('+_0x32a1e2[_0xe9ab('0x1a')]+')');_0x4c9b3f(new Error(_0xe9ab('0x18')+_0x4fb3f2+_0xe9ab('0x19')+_0x32a1e2['statusCode']+'\x20('+_0x32a1e2[_0xe9ab('0x1a')]+')'));return;}var _0x2677d3=fs[_0xe9ab('0x1b')](_0x5dcc18);_0x2677d3['on'](_0xe9ab('0x1c'),function(){logger[_0xe9ab('0x1d')]('finish\x20download\x20file');_0x2677d3['close'](_0x3fe168);});_0x2677d3['on'](_0xe9ab('0x17'),function(_0x2943de){fs[_0xe9ab('0x1e')](_0x5dcc18);logger[_0xe9ab('0x17')](_0xe9ab('0x1f'),_0x2943de);_0x4c9b3f(_0x2943de);});_0x32a1e2[_0xe9ab('0x20')](_0x2677d3);})['on'](_0xe9ab('0x17'),function(_0x53cc09){logger[_0xe9ab('0x17')](_0x53cc09);_0x4c9b3f(_0x53cc09);})[_0xe9ab('0x21')]();});}function uploadFile(_0x4d8eff){return new BPromise(function(_0x1eacc9,_0x2e3675){var _0x343d0b=urlParse(_0x4d8eff);var _0x35a1a9=_0x343d0b[_0xe9ab('0x11')]===_0xe9ab('0x12')?https:http;var _0x319142={'host':_0x343d0b[_0xe9ab('0x13')],'path':_0x343d0b[_0xe9ab('0x5')],'headers':{'user-agent':_0xe9ab('0x14')}};_0x35a1a9[_0xe9ab('0x15')](_0x319142,function(_0x16a6d8){if(_0x16a6d8[_0xe9ab('0x16')]!==0xc8){_0x2e3675(new Error(_0xe9ab('0x18')+_0x4d8eff+'\x20failed,\x20status\x20code\x20=\x20'+_0x16a6d8[_0xe9ab('0x16')]+'\x20('+_0x16a6d8['statusMessage']+')'));return;}var _0x3e8f3='';_0x16a6d8['on'](_0xe9ab('0x22'),function(_0x2b14a9){_0x3e8f3+=_0x2b14a9;});_0x16a6d8['on'](_0xe9ab('0x21'),function(){_0x1eacc9(_0x3e8f3);});})['on'](_0xe9ab('0x17'),function(_0x22e4f9){_0x2e3675(_0x22e4f9);})['end']();});}function convertFile(_0x4c593b,_0x5999ce){return new BPromise(function(_0x349b65,_0x43bf50){var _0x3025ac=sox['transcode'](_0x4c593b,_0x5999ce,{'sampleRate':0x1f40,'format':_0xe9ab('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3025ac['on']('error',function(_0x5326fa){logger[_0xe9ab('0x17')](_0xe9ab('0x24'),_0x5326fa);_0x43bf50(_0x5326fa);});_0x3025ac['on'](_0xe9ab('0x21'),function(){logger[_0xe9ab('0x1d')](_0xe9ab('0x25'));_0x349b65();});_0x3025ac[_0xe9ab('0x26')]();});}function base64Decode(_0x19832f,_0x4e91a4){var _0x24ff9a=path[_0xe9ab('0x27')](__dirname,'tmp',rs[_0xe9ab('0x28')](0x4)+'.wav');fs['writeFileSync'](_0x24ff9a,_0x19832f,_0xe9ab('0x29'));return convertFile(_0x24ff9a,_0x4e91a4)[_0xe9ab('0x2a')](function(){try{fs['unlink'](_0x24ff9a);fs[_0xe9ab('0x2b')](_0x4e91a4,'777');}catch(_0x4098cc){logger['error'](_0x4098cc);}return _0x4e91a4[_0xe9ab('0x2c')]('.')[0x0];});}function base64Encode(_0x4f44ce){var _0x58489a=fs[_0xe9ab('0x2d')](_0x4f44ce);return new Buffer(_0x58489a)[_0xe9ab('0x2e')]('base64');}exports[_0xe9ab('0x2f')]=function(_0x4733d4,_0x8ccbd2,_0x44bdb0,_0x49f9d1,_0x49a6ec,_0x4692c5){var _0x51d27d,_0x576061;var _0x4a8cf2=_0xe9ab('0x30');var _0x224533=_0xe9ab('0x31')+_0x4733d4;var _0x82ba63={};if(_0x8ccbd2===_0xe9ab('0x32')){_0x82ba63[_0xe9ab('0x33')]={'ssml':_0x44bdb0};}else{_0x82ba63[_0xe9ab('0x33')]={'text':_0x44bdb0};};_0x82ba63[_0xe9ab('0x34')]={'languageCode':_0x49f9d1,'ssmlGender':_0x49a6ec};_0x82ba63[_0xe9ab('0x35')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x4c0d01={'url':_0x4a8cf2+_0xe9ab('0x36')+_0x224533,'method':_0xe9ab('0x37'),'json':!![],'body':_0x82ba63};return rp(_0x4c0d01)[_0xe9ab('0x2a')](function(_0x14b32d){return new BPromise(function(_0x2d3426,_0x2041be){_0x51d27d=path['resolve'](__dirname,_0xe9ab('0x38'),rs['generate'](0x4)+_0xe9ab('0x39'));var _0x508320=Buffer[_0xe9ab('0x3a')](_0x14b32d[_0xe9ab('0x3b')],_0xe9ab('0x29'));return fs['writeFile'](_0x51d27d,_0x508320,function(_0x8b2109){_0x2041be(_0x8b2109);},function(_0x3e3bcc){fs[_0xe9ab('0x2b')](_0x51d27d,_0xe9ab('0x3c'));_0x2d3426(_0x3e3bcc);});});})[_0xe9ab('0x2a')](function(_0x2bef54){_0x576061=path[_0xe9ab('0x27')](__dirname,_0xe9ab('0x38'),rs[_0xe9ab('0x28')](0x4)+'.wav');return convertFile(_0x51d27d,_0x576061);})['then'](function(){try{fs[_0xe9ab('0x1e')](_0x51d27d);fs['chmodSync'](_0x576061,_0xe9ab('0x3c'));}catch(_0x531bf2){logger[_0xe9ab('0x17')](_0x531bf2);}logger[_0xe9ab('0x1d')]('googleCloudTTS\x20path',_0x576061[_0xe9ab('0x2c')]('.')[0x0]);return _0x576061['split']('.')[0x0];});};exports[_0xe9ab('0x3d')]=function(_0x36852c,_0x545a68){var _0x5269de=_0xe9ab('0x3e');var _0x1c8026,_0xec4a7d;var _0xe3a89f;var _0x33e29a={'encoding':_0xe9ab('0x3f'),'method':'POST','timeout':0x2710,'url':_0x5269de,'headers':{'Content-Type':_0xe9ab('0x40')},'body':_0xe9ab('0x41')+encodeURIComponent(JSON['stringify']([[[_0xe9ab('0x42'),JSON['stringify']([_0x36852c,_0x545a68||'en',![],_0xe9ab('0x43')]),null,_0xe9ab('0x44')]]]))};return rp(_0x33e29a)[_0xe9ab('0x2a')](function(_0x200b77){try{_0xe3a89f=eval(_0x200b77['slice'](0x5))[0x0][0x2];}catch(_0x1ff1e1){throw new Error(_0xe9ab('0x45')+_0x200b77[_0xe9ab('0x22')]);}if(!_0xe3a89f){if(_0x36852c[_0xe9ab('0x46')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xe9ab('0x47')+_0x545a68+_0xe9ab('0x48'));}}try{_0xe3a89f=eval(_0xe3a89f)[0x0];}catch(_0x24c338){throw new Error(_0xe9ab('0x45')+res[_0xe9ab('0x22')]);}const _0x4eb607=_0xe3a89f;_0x1c8026=path[_0xe9ab('0x27')](__dirname,'tmp',rs[_0xe9ab('0x28')](0x4)+_0xe9ab('0x39'));fs[_0xe9ab('0x49')](_0x1c8026,_0xe3a89f,{'encoding':'base64'});_0xec4a7d=path[_0xe9ab('0x27')](__dirname,_0xe9ab('0x38'),rs[_0xe9ab('0x28')](0x4)+_0xe9ab('0x4a'));return convertFile(_0x1c8026,_0xec4a7d);})[_0xe9ab('0x2a')](function(){try{fs[_0xe9ab('0x1e')](_0x1c8026);fs[_0xe9ab('0x2b')](_0xec4a7d,_0xe9ab('0x3c'));}catch(_0x5de5ab){logger[_0xe9ab('0x17')](_0x5de5ab);}logger[_0xe9ab('0x1d')](_0xe9ab('0x4b'),_0xec4a7d[_0xe9ab('0x2c')]('.')[0x0]);return _0xec4a7d[_0xe9ab('0x2c')]('.')[0x0];});};exports['googleASR']=function(_0x2bd63a,_0x4cd6b0,_0x3dafac){return google[_0xe9ab('0x4c')](_0x2bd63a,_0x4cd6b0,_0x3dafac)['then'](function(_0x2be35e){logger[_0xe9ab('0x1d')](_0x2be35e['uri']);return rp(_0x2be35e);})['then'](function(_0x2ec6c6){var _0x15db6b='';var _0xc809d8=0x0;try{fs['unlink'](_0x2bd63a);}catch(_0xa9c3a8){logger['error'](_0xa9c3a8);}if(_0x2ec6c6&&_0x2ec6c6[_0xe9ab('0x4d')]){_0x15db6b=_0x2ec6c6[_0xe9ab('0x4d')][_0xe9ab('0x4e')](function(_0x164662){return _0x164662&&_0x164662[_0xe9ab('0x4f')][0x0]&&_0x164662[_0xe9ab('0x4f')][0x0][_0xe9ab('0x50')]?_0x164662['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0xc809d8=_0x2ec6c6[_0xe9ab('0x4d')][_0xe9ab('0x4e')](function(_0x529ec4){return _0x529ec4&&_0x529ec4[_0xe9ab('0x4f')][0x0]&&_0x529ec4[_0xe9ab('0x4f')][0x0][_0xe9ab('0x51')]?_0x529ec4['alternatives'][0x0]['confidence']:0x0;})[_0xe9ab('0x52')]('\x0a');}logger[_0xe9ab('0x1d')](_0xe9ab('0x53'),_0x15db6b);logger[_0xe9ab('0x1d')]('googleASR\x20confidence',_0xc809d8);return{'transcript':_0x15db6b,'confidence':_0xc809d8};})['catch'](function(_0x514b3c){logger[_0xe9ab('0x17')](_0xe9ab('0x54'),_0x514b3c[_0xe9ab('0x16')],_0x514b3c[_0xe9ab('0x55')],_0x514b3c[_0xe9ab('0x56')]);});};exports[_0xe9ab('0x57')]=function(_0x288b8b,_0x15fce6,_0x3ace6b,_0x4e84bf){var _0x52d54b=apiai(_0x15fce6,{'language':_0x4e84bf||'en'});return _0x52d54b[_0xe9ab('0x58')](_0x3ace6b,{'sessionId':md5(_0x288b8b)})[_0xe9ab('0x2a')](function(_0x2b78b9){logger[_0xe9ab('0x1d')](JSON[_0xe9ab('0x59')](_0x2b78b9));return{'source':_0x2b78b9[_0xe9ab('0x5a')][_0xe9ab('0x5b')],'resolvedQuery':_0x2b78b9[_0xe9ab('0x5a')][_0xe9ab('0x5c')],'action':_0x2b78b9[_0xe9ab('0x5a')][_0xe9ab('0x5d')],'actionIncomplete':_0x2b78b9[_0xe9ab('0x5a')][_0xe9ab('0x5e')],'speech':_0x2b78b9[_0xe9ab('0x5a')][_0xe9ab('0x5f')][_0xe9ab('0x60')],'score':_0x2b78b9[_0xe9ab('0x5a')][_0xe9ab('0x61')],'statusCode':_0x2b78b9[_0xe9ab('0x62')][_0xe9ab('0x63')],'endConversation':_0x2b78b9[_0xe9ab('0x5a')][_0xe9ab('0x64')][_0xe9ab('0x65')]||![],'isFallbackIntent':_0x2b78b9['result'][_0xe9ab('0x64')][_0xe9ab('0x66')]};});};exports[_0xe9ab('0x67')]=function(_0x57e764,_0x25bca9,_0x2098a7,_0x3d8ecb,_0x22d8d8,_0xa5a898){var _0x4723aa=_0x3d8ecb[_0xe9ab('0x68')](/\\n/g,'\x0a');var _0x1df442={'credentials':{'private_key':_0x4723aa,'client_email':_0x2098a7}};var _0x50bdf0=new dialogflow[(_0xe9ab('0x69'))](_0x1df442);var _0x8d9b7d=_0x50bdf0[_0xe9ab('0x6a')](_0x25bca9,md5(_0x57e764));var _0x4adf4b={'session':_0x8d9b7d,'queryInput':{'text':{'text':_0x22d8d8,'languageCode':_0xa5a898}}};return _0x50bdf0[_0xe9ab('0x6b')](_0x4adf4b)[_0xe9ab('0x2a')](function(_0x4f0e92){if(_0x4f0e92&&_0x4f0e92['length']){logger[_0xe9ab('0x1d')](_0xe9ab('0x6c'),JSON[_0xe9ab('0x59')](_0x4f0e92));var _0x13a208=_0x4f0e92[0x0];if(_0x13a208){var _0x586022={'action':_0x13a208[_0xe9ab('0x6d')][_0xe9ab('0x5d')],'allRequiredParamsPresent':_0x13a208[_0xe9ab('0x6d')][_0xe9ab('0x6e')],'endConversation':_0x13a208[_0xe9ab('0x6d')]['diagnosticInfo']&&_0x13a208[_0xe9ab('0x6d')]['diagnosticInfo'][_0xe9ab('0x6f')]?_0x13a208[_0xe9ab('0x6d')]['diagnosticInfo']['fields']['end_conversation']['boolValue']:![],'fulfillmentText':_0x13a208[_0xe9ab('0x6d')][_0xe9ab('0x70')],'intentName':_0x13a208[_0xe9ab('0x6d')][_0xe9ab('0x71')]['name'],'intentDisplayName':_0x13a208[_0xe9ab('0x6d')][_0xe9ab('0x71')][_0xe9ab('0x72')],'isFallbackIntent':_0x13a208[_0xe9ab('0x6d')][_0xe9ab('0x71')][_0xe9ab('0x73')],'languageCode':_0x13a208[_0xe9ab('0x6d')][_0xe9ab('0x74')],'queryText':_0x13a208[_0xe9ab('0x6d')][_0xe9ab('0x75')],'responseId':_0x13a208[_0xe9ab('0x76')],'score':_0x13a208[_0xe9ab('0x6d')][_0xe9ab('0x77')],'speech':_0x13a208[_0xe9ab('0x6d')][_0xe9ab('0x70')],'providerResponse':JSON['stringify'](_0x4f0e92)};return _0x586022;}}});};exports[_0xe9ab('0x78')]=function(_0x271427,_0x13a035,_0x39ac44,_0x3929d8){return tilde['asr'](_0x271427,_0x13a035,_0x39ac44,_0x3929d8)[_0xe9ab('0x2a')](function(_0x5de5a8){try{fs[_0xe9ab('0x1e')](_0x271427);}catch(_0x610227){logger[_0xe9ab('0x17')](_0x610227);}logger['info'](_0xe9ab('0x79'),_0x5de5a8[_0xe9ab('0x50')]);logger[_0xe9ab('0x1d')]('Tilde\x20ASR\x20confidence',_0x5de5a8[_0xe9ab('0x51')]);return _0x5de5a8;});};exports[_0xe9ab('0x7a')]=function(_0x4199cf,_0x1e1d58,_0x236a1e,_0x57dc65,_0x14cac1,_0x4ae956){var _0x58e81f=path['resolve'](__dirname,_0xe9ab('0x38'),rs['generate'](0x4)+_0xe9ab('0x39'));var _0x542b83;return aws[_0xe9ab('0x7b')](_0x4199cf,_0x1e1d58,_0x236a1e,_0x57dc65,_0x14cac1,_0x4ae956,_0x58e81f)[_0xe9ab('0x2a')](function(){_0x542b83=path[_0xe9ab('0x27')](__dirname,_0xe9ab('0x38'),rs['generate'](0x4)+_0xe9ab('0x4a'));return convertFile(_0x58e81f,_0x542b83);})[_0xe9ab('0x2a')](function(){try{fs[_0xe9ab('0x1e')](_0x58e81f);fs[_0xe9ab('0x2b')](_0x542b83,_0xe9ab('0x3c'));}catch(_0x40761f){logger[_0xe9ab('0x17')](_0x40761f);}return _0x542b83['split']('.')[0x0];});};exports['awsLex']=function(_0x3fce15,_0x134e86,_0xe0d62f,_0x1e2e0e,_0x2b789f,_0x15ece7){return aws[_0xe9ab('0x7c')](_0x3fce15,_0x134e86,_0xe0d62f,_0x1e2e0e,_0x2b789f,_0x15ece7)['then'](function(_0x44143e){logger[_0xe9ab('0x1d')](JSON[_0xe9ab('0x59')](_0x44143e));return _0x44143e;});};exports[_0xe9ab('0x7d')]=function(_0x3cb2ef,_0x5b73d6,_0xb71984,_0xe38a5c){var _0x101e30=util[_0xe9ab('0x7e')](_0xe9ab('0x7f'),ISPEECH_API,_0x3cb2ef,encodeURIComponent(_0x5b73d6),_0xb71984,_0xe38a5c);var _0x4e9c52=path[_0xe9ab('0x27')](__dirname,'tmp',rs[_0xe9ab('0x28')](0x4)+'.mp3');var _0xef013a;return downloadFile(_0x101e30,_0x4e9c52)[_0xe9ab('0x2a')](function(){_0xef013a=path['resolve'](__dirname,'tmp',rs[_0xe9ab('0x28')](0x4)+_0xe9ab('0x4a'));return convertFile(_0x4e9c52,_0xef013a);})['then'](function(){try{fs[_0xe9ab('0x1e')](_0x4e9c52);fs[_0xe9ab('0x2b')](_0xef013a,_0xe9ab('0x3c'));}catch(_0x5f076d){logger[_0xe9ab('0x17')](_0x5f076d);}return _0xef013a[_0xe9ab('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x4a79aa,_0x334670,_0x3be6ef,_0x34671f){var _0x37a046=util['format'](_0xe9ab('0x80'),ISPEECH_API,_0x334670,_0x3be6ef,base64Encode(_0x4a79aa),_0x34671f?util[_0xe9ab('0x7e')](_0xe9ab('0x81'),encodeURIComponent(_0x34671f)):_0xe9ab('0x82'));return uploadFile(_0x37a046)[_0xe9ab('0x2a')](function(_0x718aa1){return querystring[_0xe9ab('0xb')](_0x718aa1);});};exports[_0xe9ab('0x83')]=function(_0x4aaf58,_0x1eb786){return sestek[_0xe9ab('0x84')](_0x4aaf58,_0x1eb786)['then'](function(_0x5e0084){logger[_0xe9ab('0x1d')](JSON[_0xe9ab('0x59')](_0x5e0084));var _0x5802da={'speech':_0x5e0084[_0xe9ab('0x85')],'action':_0x5e0084[_0xe9ab('0x86')]?_0x5e0084[_0xe9ab('0x86')]['CustomAction']:undefined,'actiondata':_0x5e0084[_0xe9ab('0x86')]?_0x5e0084[_0xe9ab('0x86')]['CustomActionData']:undefined};if(_0x5e0084[_0xe9ab('0x86')]&&_0x5e0084['channelData']['AudioFromTts']){return base64Decode(_0x5e0084[_0xe9ab('0x86')][_0xe9ab('0x87')]['Data'],path[_0xe9ab('0x27')](__dirname,_0xe9ab('0x38'),rs['generate'](0x4)+_0xe9ab('0x4a')))[_0xe9ab('0x2a')](function(_0x1bb03b){_0x5802da[_0xe9ab('0x88')]=_0x1bb03b;return _0x5802da;});}return _0x5802da;});};exports[_0xe9ab('0x89')]=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 6378569..8f34e03 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 _0x105d=['./nda','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x105d,0x13c));var _0xd105=function(_0x2b1b6d,_0x517c89){_0x2b1b6d=_0x2b1b6d-0x0;var _0x422682=_0x105d[_0x2b1b6d];return _0x422682;};var nda=require(_0xd105('0x0'));module[_0xd105('0x1')]={'nda':nda}; \ No newline at end of file +var nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index a2b1c89..b6e24df 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 _0xf4eb=['CustomActionData','info','request-promise','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','dnid','text','Bearer\x20','project','ProjectName','ndagenerate_audio','body','channelData','AudioOutputSettings','CustomAction','custom_action_data'];(function(_0x39f6f3,_0x455044){var _0x586f64=function(_0x4df46a){while(--_0x4df46a){_0x39f6f3['push'](_0x39f6f3['shift']());}};_0x586f64(++_0x455044);}(_0xf4eb,0xec));var _0xbf4e=function(_0x22bc84,_0x4c2cff){_0x22bc84=_0x22bc84-0x0;var _0x3077ce=_0xf4eb[_0x22bc84];return _0x3077ce;};'use strict';var rp=require(_0xbf4e('0x0'));var url=require('url');var logger=require('../../../../../config/logger')('agi');module['exports']=function(_0xbbbf01,_0x49d80e){var _0x4e7fa7={'method':_0xbf4e('0x1'),'uri':url[_0xbf4e('0x2')](_0x49d80e[_0xbf4e('0x3')],_0xbf4e('0x4')),'form':{'grant_type':_0xbf4e('0x5'),'username':_0x49d80e[_0xbf4e('0x6')],'password':_0x49d80e[_0xbf4e('0x5')]},'json':!![]};return rp(_0x4e7fa7)['then'](function(_0x449d55){var _0x5013c2={'method':'POST','uri':url[_0xbf4e('0x2')](_0x49d80e[_0xbf4e('0x7')],_0xbf4e('0x8')),'body':{'type':_0x49d80e[_0xbf4e('0x9')]||_0xbf4e('0xa'),'channelId':_0xbf4e('0xb'),'conversation':{'id':_0xbbbf01[_0xbf4e('0xc')]},'from':{'id':_0xbbbf01['callerid'],'name':_0xbbbf01['calleridname']},'recipient':{'id':_0xbbbf01[_0xbf4e('0xd')],'name':_0xbbbf01['extension']},'text':_0x49d80e[_0xbf4e('0xe')],'channelData':{}},'headers':{'Authorization':_0xbf4e('0xf')+_0x449d55['access_token']},'json':!![]};if(_0x49d80e[_0xbf4e('0x10')]){_0x5013c2['body']['channelData'][_0xbf4e('0x11')]=_0x49d80e[_0xbf4e('0x10')];}if(_0x49d80e[_0xbf4e('0x12')]=='1'){_0x5013c2[_0xbf4e('0x13')][_0xbf4e('0x14')][_0xbf4e('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x49d80e['custom_action']){_0x5013c2[_0xbf4e('0x13')][_0xbf4e('0x14')][_0xbf4e('0x16')]=_0x49d80e['custom_action'];if(_0x49d80e[_0xbf4e('0x17')]){_0x5013c2[_0xbf4e('0x13')][_0xbf4e('0x14')][_0xbf4e('0x18')]=_0x49d80e['custom_action_data'];}}logger[_0xbf4e('0x19')](JSON['stringify'](_0x5013c2));return rp(_0x5013c2);});}; \ No newline at end of file +var _0x7d98=['ndagenerate_audio','AudioOutputSettings','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','ndauth_url','password','then','resolve','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName'];(function(_0x239ccd,_0x2d731b){var _0x430c39=function(_0x6b7fb4){while(--_0x6b7fb4){_0x239ccd['push'](_0x239ccd['shift']());}};_0x430c39(++_0x2d731b);}(_0x7d98,0xe7));var _0x87d9=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x7d98[_0xa8883];return _0x479426;};'use strict';var rp=require(_0x87d9('0x0'));var url=require('url');var logger=require(_0x87d9('0x1'))(_0x87d9('0x2'));module[_0x87d9('0x3')]=function(_0xbee750,_0x47cceb){var _0x417ed2={'method':_0x87d9('0x4'),'uri':url['resolve'](_0x47cceb[_0x87d9('0x5')],'/token'),'form':{'grant_type':'password','username':_0x47cceb['username'],'password':_0x47cceb[_0x87d9('0x6')]},'json':!![]};return rp(_0x417ed2)[_0x87d9('0x7')](function(_0x2dc542){var _0x5f2693={'method':_0x87d9('0x4'),'uri':url[_0x87d9('0x8')](_0x47cceb[_0x87d9('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x47cceb[_0x87d9('0xa')]||_0x87d9('0xb'),'channelId':_0x87d9('0xc'),'conversation':{'id':_0xbee750[_0x87d9('0xd')]},'from':{'id':_0xbee750[_0x87d9('0xe')],'name':_0xbee750[_0x87d9('0xf')]},'recipient':{'id':_0xbee750[_0x87d9('0x10')],'name':_0xbee750[_0x87d9('0x11')]},'text':_0x47cceb[_0x87d9('0x12')],'channelData':{}},'headers':{'Authorization':_0x87d9('0x13')+_0x2dc542[_0x87d9('0x14')]},'json':!![]};if(_0x47cceb[_0x87d9('0x15')]){_0x5f2693[_0x87d9('0x16')][_0x87d9('0x17')][_0x87d9('0x18')]=_0x47cceb[_0x87d9('0x15')];}if(_0x47cceb[_0x87d9('0x19')]=='1'){_0x5f2693[_0x87d9('0x16')][_0x87d9('0x17')][_0x87d9('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x47cceb['custom_action']){_0x5f2693[_0x87d9('0x16')][_0x87d9('0x17')][_0x87d9('0x1b')]=_0x47cceb['custom_action'];if(_0x47cceb['custom_action_data']){_0x5f2693[_0x87d9('0x16')][_0x87d9('0x17')][_0x87d9('0x1c')]=_0x47cceb[_0x87d9('0x1d')];}}logger[_0x87d9('0x1e')](JSON[_0x87d9('0x1f')](_0x5f2693));return rp(_0x5f2693);});}; \ 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 1667854..f7a44a5 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x48f594,_0x196a53,_0x541075,_0x22e790){return asr(_0x48f594,_0x196a53,_0x541075,_0x22e790);}; \ No newline at end of file +var _0x2449=['exports'];(function(_0x4370b3,_0x23f01e){var _0x4f24ea=function(_0x4e2138){while(--_0x4e2138){_0x4370b3['push'](_0x4370b3['shift']());}};_0x4f24ea(++_0x23f01e);}(_0x2449,0xa7));var _0x9244=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2449[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require('./lib/api');module[_0x9244('0x0')]=function(_0x20bed9,_0x16b69c,_0xdeefb7,_0x44d1c4){return asr(_0x20bed9,_0x16b69c,_0xdeefb7,_0x44d1c4);}; \ 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 d43712a..3813b9a 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 _0xa1dd=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','message','close','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','transcript','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0x40f74b,_0x445621){var _0x221f69=function(_0x3c7045){while(--_0x3c7045){_0x40f74b['push'](_0x40f74b['shift']());}};_0x221f69(++_0x445621);}(_0xa1dd,0x1a9));var _0xda1d=function(_0x3cea39,_0x291ec8){_0x3cea39=_0x3cea39-0x0;var _0x4dbaaf=_0xa1dd[_0x3cea39];return _0x4dbaaf;};'use strict';var BPromise=require(_0xda1d('0x0'));var _=require(_0xda1d('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xda1d('0x2'));var logger=require(_0xda1d('0x3'))(_0xda1d('0x4'));module[_0xda1d('0x5')]=function(_0x136191,_0x1b8e14,_0x5964d6,_0x2ac53e){return new BPromise(function(_0x59f9d6,_0x3ec549){logger[_0xda1d('0x6')](_0xda1d('0x7'),_0x2ac53e||_0xda1d('0x8'));var _0x12e44f=new WebSocket(_0x2ac53e||_0xda1d('0x8'),{'perMessageDeflate':![]});var _0x3e1fa7='';var _0x2220cd='0';var _0x192270='1';var _0x4d60da=_0xda1d('0x9');function _0x1a5a53(_0xa66e9c){var _0x4d1453=crypto[_0xda1d('0xa')](_0xda1d('0xb'));_0x4d1453['update'](_0xa66e9c);return _0x4d1453[_0xda1d('0xc')](_0xda1d('0xd'));}function _0x31430f(){try{logger[_0xda1d('0x6')](_0xda1d('0xe'));var _0x8fe7cb=moment()[_0xda1d('0xf')]();var _0x36775c=_0x1a5a53(_0x8fe7cb+_0x1b8e14+_0x5964d6);_0x12e44f[_0xda1d('0x10')](JSON[_0xda1d('0x11')]({'appID':_0x1b8e14,'timestamp':_0x8fe7cb,'appKey':_0x36775c}));var _0x4740c7=fs['createReadStream'](_0x136191);_0x4740c7['on']('data',function(_0x456009){_0x12e44f[_0xda1d('0x10')](_0x456009);});_0x4740c7['on']('close',function(){_0x12e44f[_0xda1d('0x10')](_0xda1d('0x12'));});}catch(_0x42bc62){logger['error'](_0xda1d('0x13'),JSON[_0xda1d('0x11')](_0x42bc62));_0x12e44f[_0xda1d('0x14')]();}}function _0x4658f8(_0x4c30fc){try{if(_0x4c30fc){var _0x12ab7a=JSON[_0xda1d('0x15')](_0x4c30fc);switch(_0x12ab7a[_0xda1d('0x16')]){case 0x0:if(_0x12ab7a[_0xda1d('0x17')]){if(_0x12ab7a['result'][_0xda1d('0x18')]){logger[_0xda1d('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0xda1d('0x11')](_0x12ab7a[_0xda1d('0x17')]['hypotheses']));_0x3e1fa7=_0x12ab7a['result']['hypotheses'][0x0][_0xda1d('0x19')];_0x2220cd=_0x12ab7a[_0xda1d('0x17')][_0xda1d('0x1a')][0x0]['likelihood'];_0x192270='0';_0x4d60da=_0xda1d('0x1b');_0x12e44f[_0xda1d('0x14')]();}}break;case 0x1:logger[_0xda1d('0x6')](_0xda1d('0x9'));_0x192270='1';_0x4d60da=_0xda1d('0x9');break;case 0x2:logger[_0xda1d('0x6')](_0xda1d('0x1c'));_0x192270='2';_0x4d60da='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0xda1d('0x1d'));_0x192270='9';_0x4d60da='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xda1d('0x6')](_0xda1d('0x1e'));_0x192270='10';_0x4d60da='Authentication\x20failed.';break;case 0xb:logger[_0xda1d('0x6')](_0xda1d('0x1f'));_0x192270='11';_0x4d60da=_0xda1d('0x1f');}}}catch(_0x2d4b32){logger[_0xda1d('0x20')](_0xda1d('0x21'),JSON[_0xda1d('0x11')](_0x2d4b32));_0x12e44f[_0xda1d('0x14')]();}}function _0x2b81e1(){logger[_0xda1d('0x6')](_0xda1d('0x22'));_0x59f9d6({'transcript':_0x3e1fa7,'confidence':_0x2220cd,'status':_0x192270,'status_message':_0x4d60da});}function _0x5eb2db(_0x6859d5){logger[_0xda1d('0x20')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xda1d('0x23')](_0x6859d5)){logger[_0xda1d('0x20')](_['isObject'](_0x6859d5)?JSON[_0xda1d('0x11')](_0x6859d5):_0x6859d5);}}_0x12e44f['on']('open',_0x31430f);_0x12e44f['on'](_0xda1d('0x24'),_0x4658f8);_0x12e44f['on'](_0xda1d('0x25'),_0x2b81e1);_0x12e44f['on']('error',_0x5eb2db);});}; \ No newline at end of file +var _0x0c55=['transcript','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','close','send','EOS','error','terminate','parse','result'];(function(_0x16759a,_0x2c1f70){var _0x49d27a=function(_0xf9815d){while(--_0xf9815d){_0x16759a['push'](_0x16759a['shift']());}};_0x49d27a(++_0x2c1f70);}(_0x0c55,0xeb));var _0x50c5=function(_0x5d0aaa,_0xfc8c32){_0x5d0aaa=_0x5d0aaa-0x0;var _0x34cadb=_0x0c55[_0x5d0aaa];return _0x34cadb;};'use strict';var BPromise=require(_0x50c5('0x0'));var _=require(_0x50c5('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x50c5('0x2'));var crypto=require(_0x50c5('0x3'));var logger=require(_0x50c5('0x4'))('agi');module[_0x50c5('0x5')]=function(_0x4aaa2f,_0xfb62a3,_0x205037,_0x46b9f3){return new BPromise(function(_0x238f03,_0x760f84){logger[_0x50c5('0x6')](_0x50c5('0x7'),_0x46b9f3||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x5190ab=new WebSocket(_0x46b9f3||_0x50c5('0x8'),{'perMessageDeflate':![]});var _0x59d352='';var _0x2181b7='0';var _0xe76fbf='1';var _0x3fd062=_0x50c5('0x9');function _0xe0eb49(_0x4785b5){var _0x44918d=crypto[_0x50c5('0xa')]('sha1');_0x44918d['update'](_0x4785b5);return _0x44918d['digest'](_0x50c5('0xb'));}function _0x45aa1a(){try{logger[_0x50c5('0x6')](_0x50c5('0xc'));var _0x22398e=moment()[_0x50c5('0xd')]();var _0x3e321d=_0xe0eb49(_0x22398e+_0xfb62a3+_0x205037);_0x5190ab['send'](JSON[_0x50c5('0xe')]({'appID':_0xfb62a3,'timestamp':_0x22398e,'appKey':_0x3e321d}));var _0x294cab=fs[_0x50c5('0xf')](_0x4aaa2f);_0x294cab['on'](_0x50c5('0x10'),function(_0x26f0fa){_0x5190ab['send'](_0x26f0fa);});_0x294cab['on'](_0x50c5('0x11'),function(){_0x5190ab[_0x50c5('0x12')](_0x50c5('0x13'));});}catch(_0x5ecf97){logger[_0x50c5('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x50c5('0xe')](_0x5ecf97));_0x5190ab[_0x50c5('0x15')]();}}function _0x461639(_0x349831){try{if(_0x349831){var _0x172b26=JSON[_0x50c5('0x16')](_0x349831);switch(_0x172b26['status']){case 0x0:if(_0x172b26['result']){if(_0x172b26[_0x50c5('0x17')]['final']){logger[_0x50c5('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0x50c5('0xe')](_0x172b26[_0x50c5('0x17')]['hypotheses']));_0x59d352=_0x172b26['result']['hypotheses'][0x0][_0x50c5('0x18')];_0x2181b7=_0x172b26['result'][_0x50c5('0x19')][0x0][_0x50c5('0x1a')];_0xe76fbf='0';_0x3fd062=_0x50c5('0x1b');_0x5190ab['terminate']();}}break;case 0x1:logger[_0x50c5('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0xe76fbf='1';_0x3fd062=_0x50c5('0x9');break;case 0x2:logger[_0x50c5('0x6')](_0x50c5('0x1c'));_0xe76fbf='2';_0x3fd062=_0x50c5('0x1c');break;case 0x9:logger[_0x50c5('0x6')](_0x50c5('0x1d'));_0xe76fbf='9';_0x3fd062=_0x50c5('0x1d');break;case 0xa:logger[_0x50c5('0x6')]('Authentication\x20failed.');_0xe76fbf='10';_0x3fd062='Authentication\x20failed.';break;case 0xb:logger['info'](_0x50c5('0x1e'));_0xe76fbf='11';_0x3fd062=_0x50c5('0x1e');}}}catch(_0x27c14c){logger[_0x50c5('0x14')](_0x50c5('0x1f'),JSON[_0x50c5('0xe')](_0x27c14c));_0x5190ab[_0x50c5('0x15')]();}}function _0x2a7179(){logger[_0x50c5('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x238f03({'transcript':_0x59d352,'confidence':_0x2181b7,'status':_0xe76fbf,'status_message':_0x3fd062});}function _0x43539f(_0x4fbdeb){logger[_0x50c5('0x14')](_0x50c5('0x20'));if(!_[_0x50c5('0x21')](_0x4fbdeb)){logger[_0x50c5('0x14')](_[_0x50c5('0x22')](_0x4fbdeb)?JSON[_0x50c5('0xe')](_0x4fbdeb):_0x4fbdeb);}}_0x5190ab['on'](_0x50c5('0x23'),_0x45aa1a);_0x5190ab['on'](_0x50c5('0x24'),_0x461639);_0x5190ab['on']('close',_0x2a7179);_0x5190ab['on'](_0x50c5('0x14'),_0x43539f);});}; \ 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 af43c8e..c04178d 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 _0x7e86=['exports'];(function(_0x2f4cf8,_0x5041f3){var _0x31571b=function(_0x23e175){while(--_0x23e175){_0x2f4cf8['push'](_0x2f4cf8['shift']());}};_0x31571b(++_0x5041f3);}(_0x7e86,0x91));var _0x67e8=function(_0x41f828,_0x3fe0ad){_0x41f828=_0x41f828-0x0;var _0x492937=_0x7e86[_0x41f828];return _0x492937;};var asr=require('./asr');module[_0x67e8('0x0')]={'asr':asr}; \ No newline at end of file +var _0xe8ff=['./asr'];(function(_0x1b3c2a,_0x37c6b2){var _0x4d82bd=function(_0x1c11a0){while(--_0x1c11a0){_0x1b3c2a['push'](_0x1b3c2a['shift']());}};_0x4d82bd(++_0x37c6b2);}(_0xe8ff,0xcf));var _0xfe8f=function(_0x305117,_0x289f1a){_0x305117=_0x305117-0x0;var _0x184cb7=_0xe8ff[_0x305117];return _0x184cb7;};var asr=require(_0xfe8f('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 0456d89..90c0e76 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ 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(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'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 3bca762..86e633c 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 _0x0ba7=['MP3','googleTTS','restAPI','method','timeout','number','POST','body','parse','headers','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_voice','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','tildeASR','appsecret','uri','clear','clone','hasOwnProperty','isString','includes','replaceAllVariables','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','length','setVariable','replaceObjectAllVariables','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','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','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','sip_id','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','toString','test','mindigit','hiddendigitsnum','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','generate','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','agentLogout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','url','macro','gosub','QUEUE','record','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sms_account_id','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','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','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','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','util','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariable','rpc','catch','prototype','getVoiceQueue','getVoiceQueueById','then','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','map','getSoundPath','format','%s/sounds/converted/%s','open','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','callback','Callback\x20scheduled\x20at\x20','scheduledAt','callback_priority','getPauseById','agentPause','agentUnpause','agent','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','MALE','audioEncoding'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ba7,0x16d));var _0x70ba=function(_0x4a20d4,_0x5dde24){_0x4a20d4=_0x4a20d4-0x0;var _0x37b32b=_0x0ba7[_0x4a20d4];return _0x37b32b;};'use strict';var fs=require('fs');var util=require(_0x70ba('0x0'));var _=require('lodash');var sh=require(_0x70ba('0x1'));var odbc=require(_0x70ba('0x2'))();var rs=require(_0x70ba('0x3'));var moment=require(_0x70ba('0x4'));var Mustache=require('mustache');var rp=require(_0x70ba('0x5'));var logger=require(_0x70ba('0x6'))(_0x70ba('0x7'));var config=require(_0x70ba('0x8'));var scripts=require(_0x70ba('0x9'));var FILES_PATH=_0x70ba('0xa');var recursiveMapAttributes=[_0x70ba('0xb'),_0x70ba('0xc')];var verticesWithRetry=[_0x70ba('0xd'),_0x70ba('0xe'),_0x70ba('0xf')];var AGIVertices=function(_0x41cd10,_0x1264b0,_0x371629){this[_0x70ba('0x10')]=_0x41cd10;this['rpc']=_0x1264b0;this[_0x70ba('0x11')]=_0x371629;};AGIVertices['prototype'][_0x70ba('0x12')]=function(_0x258604,_0xfc4de3){this[_0x70ba('0x13')]['getVariableById'](_0x258604)['then'](function(_0x12cea8){_0xfc4de3(null,_0x12cea8?_0x12cea8['name']:![]);})[_0x70ba('0x14')](function(_0x5e94c7){_0xfc4de3(_0x5e94c7);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x16')]=function(_0x4df1e3,_0x1d674b){this['rpc'][_0x70ba('0x17')](_0x4df1e3)[_0x70ba('0x18')](function(_0x211b0e){_0x1d674b(null,_0x211b0e?_0x211b0e[_0x70ba('0x19')]:![]);})[_0x70ba('0x14')](function(_0x29734b){_0x1d674b(_0x29734b);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1a')]=function(_0x18334a,_0x3e27e8){this[_0x70ba('0x13')][_0x70ba('0x1b')](_0x18334a)[_0x70ba('0x18')](function(_0xb6d69a){_0x3e27e8(null,_0xb6d69a?_0xb6d69a['name']:![]);})['catch'](function(_0x489cf9){_0x3e27e8(_0x489cf9);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1c')]=function(_0x20c2aa,_0xb4dad){this[_0x70ba('0x13')][_0x70ba('0x1d')](_0x20c2aa)[_0x70ba('0x18')](function(_0x2763f3){_0xb4dad(null,_0x2763f3?_0x2763f3[_0x70ba('0x1e')]:![]);})[_0x70ba('0x14')](function(_0x26c039){_0xb4dad(_0x26c039);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1f')]=function(_0x4570b0,_0x273ce4){this['rpc'][_0x70ba('0x20')](_0x4570b0)[_0x70ba('0x18')](function(_0x52accf){_0x273ce4(null,_0x52accf?_0x52accf[_0x70ba('0x19')]:![]);})['catch'](function(_0x4868a1){_0x273ce4(_0x4868a1);});};AGIVertices[_0x70ba('0x15')]['getTrunk']=function(_0x45bbf2,_0x304a41){this['rpc'][_0x70ba('0x21')](_0x45bbf2)['then'](function(_0x5ad828){_0x304a41(null,_0x5ad828?_0x5ad828[_0x70ba('0x19')]:![]);})['catch'](function(_0x230d11){_0x304a41(_0x230d11);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x22')]=function(_0x33e218,_0x2c6d18){var _0x265423=this;this['rpc'][_0x70ba('0x23')](_0x33e218)[_0x70ba('0x18')](function(_0x797467){_0x2c6d18(null,_0x797467?_0x265423['getSoundPath'](_0x797467[_0x70ba('0x24')]):![]);})['catch'](function(_0x5955dc){_0x2c6d18(_0x5955dc);});};AGIVertices['prototype'][_0x70ba('0x25')]=function(_0x345edd,_0x5b6e6e){this['rpc'][_0x70ba('0x26')](_0x345edd)['then'](function(_0x102661){_0x5b6e6e(null,_0x102661?_0x102661:![]);})[_0x70ba('0x14')](function(_0x46b7e3){_0x5b6e6e(_0x46b7e3);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x27')]=function(_0x269943,_0x1f86cf,_0x9bafd){this[_0x70ba('0x11')][_0x70ba('0x27')](_0x269943,_0x1f86cf)[_0x70ba('0x18')](function(){_0x9bafd(null);})['catch'](function(_0x576ec4){_0x9bafd(_0x576ec4);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x28')]=function(_0x943e49,_0x563f68){this['rpc']['getIntervalById'](_0x943e49)[_0x70ba('0x18')](function(_0x806866){if(_0x806866){if(_0x806866[_0x70ba('0x29')]){_0x563f68(null,[_0x806866['interval']]);}else{_0x563f68(null,_[_0x70ba('0x2a')](_0x806866['Intervals'],'interval'));}}else{_0x563f68(null,![]);}})[_0x70ba('0x14')](function(_0x591596){_0x563f68(_0x591596);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x2b')]=function(_0x4f3d6f){return util[_0x70ba('0x2c')](_0x70ba('0x2d'),FILES_PATH,_0x4f3d6f);};AGIVertices[_0x70ba('0x15')]['getQueryOdbc']=function(_0x1402b2,_0x20c3fd,_0xbb0c72){odbc[_0x70ba('0x2e')](_0x1402b2,function(_0x5245f7){if(_0x5245f7){logger[_0x70ba('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x5245f7);_0xbb0c72(_0x5245f7);}else{logger[_0x70ba('0x30')](_0x70ba('0x31'));odbc[_0x70ba('0x32')](_0x20c3fd,function(_0x450eb3,_0x16ce39){if(_0x450eb3){logger[_0x70ba('0x30')](_0x70ba('0x33'),_0x20c3fd);_0xbb0c72(_0x450eb3);}else{logger['info'](_0x70ba('0x34'),_0x20c3fd);odbc[_0x70ba('0x35')](function(_0x31e713){if(_0x31e713){logger[_0x70ba('0x2f')](_0x70ba('0x36'),_0x31e713);}_0xbb0c72(null,_0x16ce39);});}});}});};AGIVertices[_0x70ba('0x15')]['getSmsAccount']=function(_0x452208,_0x175152){this[_0x70ba('0x13')]['getSmsAccountById'](_0x452208)['then'](function(_0x5ee9b1){_0x175152(null,_0x5ee9b1?_0x5ee9b1:![]);})[_0x70ba('0x14')](function(_0x59044){_0x175152(_0x59044);});};AGIVertices[_0x70ba('0x15')]['createSmsMessage']=function(_0x24a8c3,_0x27203b){this[_0x70ba('0x13')][_0x70ba('0x37')](_0x24a8c3)[_0x70ba('0x18')](function(_0x54e732){_0x27203b(null,_0x54e732);})['catch'](function(_0x7b0436){_0x27203b(_0x7b0436);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x38')]=function(_0x5a1edb,_0x595645,_0x2fc262){this['rpc'][_0x70ba('0x38')]({'uniqueid':this[_0x70ba('0x10')][_0x70ba('0x39')],'node':_0x5a1edb[_0x70ba('0x3a')],'application':_0x5a1edb[_0x70ba('0x3b')],'data':_0x595645||null,'project_name':this['channel'][_0x70ba('0x3c')],'callerid':this[_0x70ba('0x10')][_0x70ba('0x3d')]})[_0x70ba('0x18')](function(_0x817e59){if(_0x2fc262){_0x2fc262(null,_0x817e59);}})[_0x70ba('0x14')](function(_0x900910){if(_0x2fc262){_0x2fc262(_0x900910);}});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x3e')]=function(_0x1f804b,_0x389571,_0x349059,_0x3e3ce5){this[_0x70ba('0x13')][_0x70ba('0x3e')]({'uniqueid':this['channel'][_0x70ba('0x39')],'callerid':this[_0x70ba('0x10')]['callerid'],'calleridname':this[_0x70ba('0x10')][_0x70ba('0x3f')],'context':this[_0x70ba('0x10')][_0x70ba('0x40')],'extension':this[_0x70ba('0x10')][_0x70ba('0x41')],'priority':this[_0x70ba('0x10')]['priority'],'accountcode':this[_0x70ba('0x10')][_0x70ba('0x42')],'dnid':this[_0x70ba('0x10')][_0x70ba('0x43')],'projectName':this[_0x70ba('0x10')][_0x70ba('0x3c')],'saveName':_0x389571,'filename':_0x1f804b[_0x70ba('0x44')]||_0x389571,'savePath':_0x349059})[_0x70ba('0x18')](function(_0xc574b){_0x3e3ce5(null,_0xc574b);})[_0x70ba('0x14')](function(_0x3a4247){_0x3e3ce5(_0x3a4247);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x45')]=function(_0x16af4d,_0x25f68a,_0x2536cd,_0x9f97c5,_0x4a848b){this[_0x70ba('0x13')][_0x70ba('0x45')]({'uniqueid':this[_0x70ba('0x10')][_0x70ba('0x39')],'body':_0x16af4d,'direction':_0x25f68a,'providerName':_0x2536cd,'providerResponse':_0x9f97c5})['then'](function(_0x47c40c){if(_0x4a848b){_0x4a848b(null,_0x47c40c);}})['catch'](function(_0x471d19){if(_0x4a848b){_0x4a848b(_0x471d19);}});};AGIVertices[_0x70ba('0x15')]['createCmContact']=function(_0x572834,_0x6a3dc6){this[_0x70ba('0x13')][_0x70ba('0x46')]({'firstName':_[_0x70ba('0x47')](_0x572834[_0x70ba('0x19')])||_[_0x70ba('0x48')](_0x572834[_0x70ba('0x19')])?'callback_'+Math['random']():_0x572834[_0x70ba('0x19')],'lastName':_[_0x70ba('0x47')](_0x572834[_0x70ba('0x49')])||_[_0x70ba('0x48')](_0x572834['lastName'])?null:_0x572834[_0x70ba('0x49')],'phone':_0x572834[_0x70ba('0x4a')],'ListId':_0x572834['list_id'],'scheduledat':_0x572834['scheduledAt'],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x70ba('0x4b'),'description':_0x70ba('0x4c')+_0x572834[_0x70ba('0x4d')]['toString'](),'priority':_0x572834[_0x70ba('0x4e')]})[_0x70ba('0x18')](function(_0x29bb0b){_0x6a3dc6(null,_0x29bb0b);})['catch'](function(_0x1bdcd4){_0x6a3dc6(_0x1bdcd4);});};AGIVertices[_0x70ba('0x15')]['getPause']=function(_0x49f89a,_0x2ccfd4){this[_0x70ba('0x13')][_0x70ba('0x4f')](_0x49f89a)[_0x70ba('0x18')](function(_0x10e824){_0x2ccfd4(null,_0x10e824?_0x10e824[_0x70ba('0x19')]:![]);})[_0x70ba('0x14')](function(_0x5e7a92){_0x2ccfd4(_0x5e7a92);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x50')]=function(_0x4de412,_0x508da6,_0x137b7d){var _0x26c5a7={'role':'agent'};_0x26c5a7[_0x4de412]=this['channel'][_0x70ba('0x3d')];this['rpc']['agentPause'](_0x26c5a7,_0x508da6,this[_0x70ba('0x10')][_0x70ba('0x39')])[_0x70ba('0x18')](function(_0xb03649){_0x137b7d(null,_[_0x70ba('0x48')](_0xb03649)?![]:!![]);})[_0x70ba('0x14')](function(_0xeac8a8){logger['error'](_0xeac8a8);_0x137b7d(null,![]);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x51')]=function(_0x16e607,_0xaad21){var _0x355df4={'role':_0x70ba('0x52')};_0x355df4[_0x16e607]=this['channel'][_0x70ba('0x3d')];this['rpc'][_0x70ba('0x51')](_0x355df4)['then'](function(_0x3badfd){_0xaad21(null,_[_0x70ba('0x48')](_0x3badfd)?![]:!![]);})[_0x70ba('0x14')](function(_0x305df9){logger[_0x70ba('0x2f')](_0x305df9);_0xaad21(null,![]);});};AGIVertices[_0x70ba('0x15')]['agentLogout']=function(_0x2a46cd,_0x4d7e67){var _0x490948={'role':_0x70ba('0x52')};_0x490948[_0x2a46cd]=this[_0x70ba('0x10')]['callerid'];this[_0x70ba('0x13')]['agentLogout'](_0x490948)[_0x70ba('0x18')](function(_0x2a8aa9){_0x4d7e67(null,_[_0x70ba('0x48')](_0x2a8aa9)?![]:!![]);})['catch'](function(_0x327219){logger['error'](_0x327219);_0x4d7e67(null,![]);});};AGIVertices[_0x70ba('0x15')]['agentLogin']=function(_0x2ee3d0,_0x3e0aeb){var _0x1bd96e={'role':_0x70ba('0x52')};_0x1bd96e[_0x2ee3d0]=this['channel'][_0x70ba('0x3d')];var _0x530324=_0x2ee3d0!=_0x70ba('0x53')?util[_0x70ba('0x2c')](_0x70ba('0x54'),_0x70ba('0x55'),this['channel'][_0x70ba('0x3d')]):undefined;this[_0x70ba('0x13')][_0x70ba('0x56')](_0x1bd96e,_0x530324)[_0x70ba('0x18')](function(_0x14c761){_0x3e0aeb(null,_[_0x70ba('0x48')](_0x14c761)?![]:!![]);})[_0x70ba('0x14')](function(_0x2e0f08){logger['error'](_0x2e0f08);_0x3e0aeb(null,![]);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x57')]=function(_0x28294e,_0x157404){sh[_0x70ba('0x58')](_[_0x70ba('0x59')](_0x28294e),function(_0xb2276e,_0x4d83ab){var _0x1bc8c6=_0x4d83ab[_0x70ba('0x5a')](/(\r\n|\n|\r)/gm,'');_0x157404(null,_0x1bc8c6);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x5b')]=function(_0x30fad7,_0x67628f){scripts[_0x70ba('0x5b')](_0x30fad7[_0x70ba('0x5c')],_0x30fad7['google_cloud_tts_text_type']||'text',_0x30fad7[_0x70ba('0x5d')],_0x30fad7[_0x70ba('0x5e')]||_0x70ba('0x5f'),_0x30fad7['ssmlGender']||_0x70ba('0x60'),_0x30fad7[_0x70ba('0x61')]||_0x70ba('0x62'))['then'](function(_0x3e341a){_0x67628f(null,_0x3e341a);})[_0x70ba('0x14')](function(_0xa9009d){_0x67628f(_0xa9009d);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x63')]=function(_0x3184cc,_0x22e520){scripts['googleTTS'](_0x3184cc[_0x70ba('0x5d')],_0x3184cc['google_tts_language']||'en',0x1)['then'](function(_0x12f420){_0x22e520(null,_0x12f420);})[_0x70ba('0x14')](function(_0x13cb22){_0x22e520(_0x13cb22);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x64')]=function(_0x408f46,_0x36eb0f){var _0x315ed4={'uri':_0x408f46['url'],'method':_0x408f46[_0x70ba('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x408f46[_0x70ba('0x66')])===_0x70ba('0x67')&&parseInt(_0x408f46['timeout'])>=0x1?parseInt(_0x408f46['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x70ba('0x68'),'PUT'],_0x315ed4['method']['toUpperCase']())){try{_0x315ed4[_0x70ba('0x69')]=_0x408f46[_0x70ba('0xc')]?JSON[_0x70ba('0x6a')](_0x408f46[_0x70ba('0xc')]):{};}catch(_0xe214a7){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0xe214a7);}}try{_0x315ed4[_0x70ba('0x6b')]=_0x408f46[_0x70ba('0xb')]?JSON['parse'](_0x408f46[_0x70ba('0xb')]):{};}catch(_0x3ba6c3){logger[_0x70ba('0x2f')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3ba6c3);}if(_0x408f46[_0x70ba('0x6c')]){try{var _0x534ea9=require(_0x408f46[_0x70ba('0x6c')])[_0x70ba('0x6d')](this,_0x315ed4);_0x315ed4['uri']=Mustache[_0x70ba('0x6e')](_0x408f46['url'],_0x534ea9,{},['$$','$$']);if(_0x315ed4[_0x70ba('0x6b')]){_0x315ed4[_0x70ba('0x6b')]=JSON['parse'](Mustache[_0x70ba('0x6e')](JSON[_0x70ba('0x6f')](_0x315ed4[_0x70ba('0x6b')]),_0x534ea9,{},['$$','$$']));}if(_0x315ed4[_0x70ba('0x69')]){_0x315ed4[_0x70ba('0x69')]=JSON[_0x70ba('0x6a')](Mustache[_0x70ba('0x6e')](JSON[_0x70ba('0x6f')](_0x315ed4[_0x70ba('0x69')]),_0x534ea9,{},['$$','$$']));}}catch(_0xc4c5d3){logger['error'](_0x70ba('0x70'),_0xc4c5d3);}}rp(_0x315ed4)[_0x70ba('0x18')](function(_0x46e1f1){var _0x313a9a={'statusCode':_0x46e1f1['statusCode']||0xc8,'statusMessage':_0x46e1f1[_0x70ba('0x71')]||'OK','headers':_0x46e1f1['headers']||{},'body':_0x46e1f1[_0x70ba('0x69')]||{}};_0x36eb0f(null,_0x313a9a);})['catch'](function(_0x44b3ad){var _0x18d129={'statusCode':_0x44b3ad['statusCode']||0x1f4,'statusMessage':_0x44b3ad[_0x70ba('0x72')]||_0x70ba('0x73'),'headers':_0x44b3ad[_0x70ba('0x74')][_0x70ba('0x6b')]||{},'body':_0x44b3ad[_0x70ba('0x74')][_0x70ba('0x69')]||{}};_0x36eb0f(null,_0x18d129);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x75')]=function(_0x58e514,_0x3b4036){scripts[_0x70ba('0x75')](this[_0x70ba('0x10')][_0x70ba('0x39')],_0x58e514[_0x70ba('0x76')],_0x58e514[_0x70ba('0x5d')],_0x58e514[_0x70ba('0x77')]||'en')[_0x70ba('0x18')](function(_0x57ec44){_0x3b4036(null,_0x57ec44);})[_0x70ba('0x14')](function(_0x3b4ee6){_0x3b4036(_0x3b4ee6);});};AGIVertices[_0x70ba('0x15')]['googleDialogflowV2']=function(_0x271b69,_0x1a037e){scripts[_0x70ba('0x78')](this['channel']['uniqueid'],_0x271b69[_0x70ba('0x79')],_0x271b69['client_email'],_0x271b69['private_key'],_0x271b69[_0x70ba('0x5d')],_0x271b69[_0x70ba('0x7a')]||'en')[_0x70ba('0x18')](function(_0x10282f){_0x1a037e(null,_0x10282f);})[_0x70ba('0x14')](function(_0x239265){_0x1a037e(_0x239265);});};AGIVertices['prototype']['sestekNDA']=function(_0xa0f12b,_0x312048){scripts[_0x70ba('0x7b')](this[_0x70ba('0x10')],_0xa0f12b)['then'](function(_0x3e4ec7){_0x312048(null,_0x3e4ec7);})[_0x70ba('0x14')](function(_0x459128){_0x312048(_0x459128);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x7c')]=function(_0x3e3e45,_0x132ff1){scripts[_0x70ba('0x7c')](_0x3e3e45[_0x70ba('0x76')],_0x3e3e45[_0x70ba('0x5d')],_0x3e3e45[_0x70ba('0x7d')]||_0x70ba('0x5f'),_0x3e3e45[_0x70ba('0x7e')])[_0x70ba('0x18')](function(_0x53df7a){_0x132ff1(null,_0x53df7a);})[_0x70ba('0x14')](function(_0x24328e){_0x132ff1(_0x24328e);});};AGIVertices[_0x70ba('0x15')]['ispeechASR']=function(_0x5f2e0a,_0x54849c,_0x1e9f8a){scripts[_0x70ba('0x7f')](_0x54849c,_0x5f2e0a[_0x70ba('0x76')],_0x5f2e0a[_0x70ba('0x80')]||'en-US',this[_0x70ba('0x81')](_0x5f2e0a[_0x70ba('0x82')])?_0x5f2e0a[_0x70ba('0x82')]:undefined)[_0x70ba('0x18')](function(_0x5445e7){_0x1e9f8a(null,_0x5445e7);})['catch'](function(_0x4875e6){_0x1e9f8a(_0x4875e6);});};AGIVertices[_0x70ba('0x15')]['awsPolly']=function(_0x363fa4,_0x5e2822){scripts[_0x70ba('0x83')](_0x363fa4[_0x70ba('0x84')],_0x363fa4['aws_secret_access_key'],_0x363fa4['aws_polly_region'],_0x363fa4[_0x70ba('0x85')]||'Amy',_0x363fa4['text'],_0x363fa4[_0x70ba('0x86')]||_0x70ba('0x5d'))[_0x70ba('0x18')](function(_0x374ed7){_0x5e2822(null,_0x374ed7);})[_0x70ba('0x14')](function(_0x130029){_0x5e2822(_0x130029);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x87')]=function(_0x152fdb,_0x26c4a7){scripts[_0x70ba('0x87')](this[_0x70ba('0x10')][_0x70ba('0x39')],_0x152fdb[_0x70ba('0x84')],_0x152fdb[_0x70ba('0x88')],_0x152fdb['aws_lex_region'],_0x152fdb[_0x70ba('0x5d')],_0x152fdb[_0x70ba('0x89')])[_0x70ba('0x18')](function(_0x5441f9){_0x26c4a7(null,_0x5441f9);})[_0x70ba('0x14')](function(_0x2fbf2b){_0x26c4a7(_0x2fbf2b);});};AGIVertices['prototype'][_0x70ba('0x8a')]=function(_0x490b96,_0x4cf238,_0xb13413){scripts['googleASR'](_0x4cf238,_0x490b96[_0x70ba('0x76')],_0x490b96['google_asr_language']||_0x70ba('0x5f'))[_0x70ba('0x18')](function(_0x3386fd){_0xb13413(null,_0x3386fd);})[_0x70ba('0x14')](function(_0x365faf){_0xb13413(_0x365faf);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x8b')]=function(_0x360b23,_0x5a1e70,_0x541fb6){scripts[_0x70ba('0x8b')](_0x5a1e70,_0x360b23['appid'],_0x360b23[_0x70ba('0x8c')],_0x360b23[_0x70ba('0x8d')])[_0x70ba('0x18')](function(_0x1359cc){_0x541fb6(null,_0x1359cc);})[_0x70ba('0x14')](function(_0xa0e34d){_0x541fb6(_0xa0e34d);});};AGIVertices[_0x70ba('0x15')][_0x70ba('0x8e')]=function(_0x1e537b){var _0x5ebb9a=_['includes'](verticesWithRetry,_0x1e537b['agicommand'])?_0x1e537b:_[_0x70ba('0x8f')](_0x1e537b);for(var _0x556c20 in _0x5ebb9a){if(_0x5ebb9a[_0x70ba('0x90')](_0x556c20)){if(_0x5ebb9a[_0x556c20]&&_[_0x70ba('0x91')](_0x5ebb9a[_0x556c20])){if(_[_0x70ba('0x92')](recursiveMapAttributes,_0x556c20)){_0x5ebb9a[_0x556c20]=this['replaceObjectAllVariables'](_0x5ebb9a[_0x556c20]);}else{_0x5ebb9a[_0x556c20]=this[_0x70ba('0x93')](_0x5ebb9a[_0x556c20]);}}}}return _0x5ebb9a;};AGIVertices[_0x70ba('0x15')][_0x70ba('0x94')]=function(_0x363aad){for(var _0x21dff6 in _0x363aad){if(_0x363aad[_0x70ba('0x90')](_0x21dff6)){if(_['isPlainObject'](_0x363aad[_0x21dff6])){this['recursiveNodeIndex'](_0x363aad[_0x21dff6]);}else if(_[_0x70ba('0x95')](_0x363aad[_0x21dff6])){for(var _0x4302e6=0x0;_0x4302e6<_0x363aad[_0x21dff6]['length'];_0x4302e6++){this[_0x70ba('0x94')](_0x363aad[_0x21dff6][_0x4302e6]);}}else if(_['isString'](_0x363aad[_0x21dff6])){_0x363aad[_0x21dff6]=this[_0x70ba('0x93')](_0x363aad[_0x21dff6]);}}}};AGIVertices[_0x70ba('0x15')]['saveRestApiResult']=function(_0x3b3c28,_0x1dc7db){for(var _0x814ec6 in _0x3b3c28){if(_0x3b3c28[_0x70ba('0x90')](_0x814ec6)){if(_['isPlainObject'](_0x3b3c28[_0x814ec6])){if(!_[_0x70ba('0x47')](_0x3b3c28[_0x814ec6])){this[_0x70ba('0x96')](_0x3b3c28[_0x814ec6],util[_0x70ba('0x2c')](_0x70ba('0x97'),_0x1dc7db,_0x814ec6));}}else if(_['isArray'](_0x3b3c28[_0x814ec6])){for(var _0x10acf1=0x0;_0x10acf1<_0x3b3c28[_0x814ec6][_0x70ba('0x98')];_0x10acf1++){this[_0x70ba('0x96')](_0x3b3c28[_0x814ec6][_0x10acf1],util[_0x70ba('0x2c')]('%s.%s',_0x1dc7db,_0x814ec6+'['+_0x10acf1+']'));}}else{if(!_['isNil'](_0x3b3c28[_0x814ec6])){this[_0x70ba('0x10')][_0x70ba('0x99')](util['format'](_0x70ba('0x97'),_0x1dc7db,_0x814ec6),_0x3b3c28[_0x814ec6]);}}}}};AGIVertices[_0x70ba('0x15')][_0x70ba('0x9a')]=function(_0xcdd6c4){try{var _0x2cfbd8=JSON[_0x70ba('0x6a')](_0xcdd6c4);this[_0x70ba('0x94')](_0x2cfbd8);return JSON[_0x70ba('0x6f')](_0x2cfbd8);}catch(_0x1536d6){return this[_0x70ba('0x93')](_0xcdd6c4);}};AGIVertices[_0x70ba('0x15')][_0x70ba('0x93')]=function(_0x1d90be){var _0xa83ff8=_0x1d90be[_0x70ba('0x9b')]('{');for(var _0x203622=0x1;_0x203622<_0xa83ff8[_0x70ba('0x98')];_0x203622+=0x1){var _0x53e87f=_0xa83ff8[_0x203622][_0x70ba('0x9b')]('}');if(_0x53e87f[_0x70ba('0x98')]>0x1){_0x1d90be=_0x1d90be[_0x70ba('0x9c')]('{'+_0x53e87f[0x0]+'}',this[_0x70ba('0x10')][_0x70ba('0x12')](_0x53e87f[0x0])[_0x70ba('0x9d')]||_0x53e87f[0x0]);}}if(_0xa83ff8[_0x70ba('0x98')]===0x1){return _0x1d90be['toString']();}return this['replaceAllVariables'](_0x1d90be);};AGIVertices[_0x70ba('0x15')]['getAndSetVariable']=function(_0x18db80,_0x1a23d9){var _0x12329d=this[_0x70ba('0x10')][_0x70ba('0x12')](_0x18db80);if(_0x12329d[_0x70ba('0x9e')]===-0x1){return _0x12329d;}logger[_0x70ba('0x30')](util['format'](_0x70ba('0x9f'),_0x1a23d9,_0x12329d[_0x70ba('0x9d')]));return this[_0x70ba('0x10')][_0x70ba('0x99')](_0x1a23d9,_0x12329d[_0x70ba('0x9d')]);};AGIVertices[_0x70ba('0x15')]['isConfigured']=function(_0x610164){return _0x610164&&_0x610164!=='0'&&_0x610164!=='-1'&&_0x610164!=='';};AGIVertices[_0x70ba('0x15')][_0x70ba('0xa0')]=function(_0x408378){this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x408378,'-');_0x408378[_0x70ba('0xa1')]=_0x408378['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x70ba('0xa2')]=function(_0x312626){logger['info'](util[_0x70ba('0x2c')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x312626[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x312626[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xa4'));}var _0x375b6d='\x22'+_0x312626[_0x70ba('0x5d')]+'\x22';if(this[_0x70ba('0x81')](_0x312626['options'])){_0x375b6d+=','+_0x312626[_0x70ba('0x74')];}var _0x237d3b=this[_0x70ba('0x10')]['exec'](_0x70ba('0xa5'),_0x375b6d);if(_0x237d3b[_0x70ba('0x9e')]===-0x1){return _0x237d3b;}return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xa6'),_0x375b6d));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xa7')]=function(_0x3016dd){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xa8'),_0x3016dd[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x3016dd[_0x70ba('0xa9')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0xaa'));}var _0x491471=_0x3016dd[_0x70ba('0xa9')];if(this[_0x70ba('0x81')](_0x3016dd['options'])){_0x491471+=','+_0x3016dd['options'];}var _0x5e5e6b=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xab'),_0x491471);if(_0x5e5e6b[_0x70ba('0x9e')]===-0x1){return _0x5e5e6b;}var _0x226f09=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x70ba('0xac'));if(_0x226f09['result']===-0x1){return _0x226f09;}var _0xb1be95=this[_0x70ba('0xad')](_0x70ba('0xae'),_0x70ba('0xaf'));if(_0xb1be95[_0x70ba('0x9e')]===-0x1){return _0xb1be95;}var _0x6b82ab=this[_0x70ba('0xad')](_0x70ba('0xb0'),_0x70ba('0xb1'));if(_0x6b82ab[_0x70ba('0x9e')]===-0x1){return _0x6b82ab;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xb2'),_0x491471));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x7')]=function(_0x569c8a){logger[_0x70ba('0x30')](util['format'](_0x70ba('0xb3'),_0x569c8a['label']));return this[_0x70ba('0x10')][_0x70ba('0x7')]([_0x569c8a['command'],_0x569c8a[_0x70ba('0xb4')]]);};AGIVertices[_0x70ba('0x15')][_0x70ba('0xb5')]=function(_0x2e6661){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xb6'),_0x2e6661[_0x70ba('0x3a')]));if(this[_0x70ba('0x81')](_0x2e6661[_0x70ba('0x66')])){logger[_0x70ba('0x30')](util['format'](_0x70ba('0xb7'),_0x2e6661[_0x70ba('0x66')]));var _0x1e1133=this['channel'][_0x70ba('0xb8')](_0x2e6661['timeout']);if(_0x1e1133[_0x70ba('0x9e')]===-0x1){return _0x1e1133;}}return this['channel'][_0x70ba('0xb5')]();};AGIVertices[_0x70ba('0x15')][_0x70ba('0x4b')]=function(_0x264058){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xb9'),_0x264058[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x264058[_0x70ba('0xba')])){return this['channel']['error'](_0x264058,'no\x20list\x20selected');}_0x264058[_0x70ba('0x4d')]=moment();if(this[_0x70ba('0x81')](_0x264058[_0x70ba('0xbb')])){_0x264058[_0x70ba('0x4d')]=moment()['add'](_0x264058[_0x70ba('0xbb')],_0x70ba('0xbc'));}if(!this[_0x70ba('0x81')](_0x264058[_0x70ba('0x4e')])){_0x264058['callback_priority']=0x2;}this[_0x70ba('0x46')][_0x70ba('0x6d')](this,_0x264058);return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x264058[_0x70ba('0x4a')],_0x264058['list_id'],_0x264058[_0x70ba('0x4d')]));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xbd')]=function(_0x43b8d4){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0xbe'),_0x43b8d4[_0x70ba('0x3a')]));var _0x357fc2=this[_0x70ba('0x10')]['exec'](_0x43b8d4[_0x70ba('0xbf')],_0x43b8d4[_0x70ba('0x74')]);if(_0x357fc2['result']===-0x1){return _0x357fc2;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xc0'),_0x43b8d4[_0x70ba('0xbf')],_0x43b8d4['options']));};AGIVertices[_0x70ba('0x15')]['lumenvoxtts']=function(_0x5a22b1){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x5a22b1[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x5a22b1['text'])){return this['channel'][_0x70ba('0xa3')]('no\x20text\x20configured');}var _0x5f5831='\x22'+_0x5a22b1[_0x70ba('0x5d')]+'\x22';if(this[_0x70ba('0x81')](_0x5a22b1[_0x70ba('0x74')])){_0x5f5831+=','+_0x5a22b1['options'];}var _0x29e322=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xa5'),_0x5f5831);if(_0x29e322[_0x70ba('0x9e')]===-0x1){return _0x29e322;}return this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0xa6'),_0x5f5831));};AGIVertices[_0x70ba('0x15')]['sestektts']=function(_0x4fb1f0){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xc1'),_0x4fb1f0[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x4fb1f0[_0x70ba('0x5d')])){return this['channel'][_0x70ba('0xa3')](_0x70ba('0xa4'));}var _0x29b478='\x22'+_0x4fb1f0[_0x70ba('0x5d')]+'\x22';if(this[_0x70ba('0x81')](_0x4fb1f0[_0x70ba('0x74')])){_0x29b478+=','+_0x4fb1f0['options'];}var _0xd4eb4e=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xa5'),_0x29b478);if(_0xd4eb4e['result']===-0x1){return _0xd4eb4e;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xa6'),_0x29b478));};AGIVertices[_0x70ba('0x15')]['lumenvoxasr']=function(_0x3cefff){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xc2'),_0x3cefff[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x3cefff[_0x70ba('0xa9')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xaa'));}var _0x4f9305=_0x3cefff['grammar'];if(this[_0x70ba('0x81')](_0x3cefff[_0x70ba('0x74')])){_0x4f9305+=','+_0x3cefff['options'];}var _0x55c471=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xab'),_0x4f9305);if(_0x55c471['result']===-0x1){return _0x55c471;}var _0x138ae3=this['getAndSetVariable'](_0x70ba('0xc3'),_0x70ba('0xc4'));if(_0x138ae3[_0x70ba('0x9e')]===-0x1){return _0x138ae3;}var _0x1ea5b8=this[_0x70ba('0xad')](_0x70ba('0xae'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x1ea5b8[_0x70ba('0x9e')]===-0x1){return _0x1ea5b8;}var _0x5be21f=this[_0x70ba('0xad')](_0x70ba('0xb0'),_0x70ba('0xc5'));if(_0x5be21f[_0x70ba('0x9e')]===-0x1){return _0x5be21f;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xb2'),_0x4f9305));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xc6')]=function(_0xd1f4fc){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xc7'),_0xd1f4fc[_0x70ba('0x3a')]));if(!this['isConfigured'](_0xd1f4fc['grammar'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xaa'));}var _0x34e82d=_0xd1f4fc[_0x70ba('0xa9')];if(this[_0x70ba('0x81')](_0xd1f4fc[_0x70ba('0x74')])){_0x34e82d+=','+_0xd1f4fc[_0x70ba('0x74')];}var _0x88e63d=this[_0x70ba('0x10')]['exec'](_0x70ba('0xab'),_0x34e82d);if(_0x88e63d[_0x70ba('0x9e')]===-0x1){return _0x88e63d;}var _0x1bdae4=this[_0x70ba('0xad')](_0x70ba('0xc3'),_0x70ba('0xc8'));if(_0x1bdae4[_0x70ba('0x9e')]===-0x1){return _0x1bdae4;}var _0x1d7db7=this[_0x70ba('0xad')](_0x70ba('0xae'),_0x70ba('0xc9'));if(_0x1d7db7[_0x70ba('0x9e')]===-0x1){return _0x1d7db7;}var _0x1f9bfc=this[_0x70ba('0xad')]('RECOG_INSTANCE()',_0x70ba('0xca'));if(_0x1f9bfc[_0x70ba('0x9e')]===-0x1){return _0x1f9bfc;}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0xb2'),_0x34e82d));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xcb')]=function(_0x43a456){logger['info'](util['format'](_0x70ba('0xcc'),_0x43a456[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x43a456[_0x70ba('0xcd')])){return this[_0x70ba('0x10')]['error'](_0x43a456,_0x70ba('0xce'));}var _0x3ab9d8=this[_0x70ba('0x1c')]['sync'](this,_0x43a456[_0x70ba('0xcd')]);if(!_0x3ab9d8){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x43a456,_0x70ba('0xcf'));}if(!this['isConfigured'](_0x43a456[_0x70ba('0x32')])){return this['channel']['error'](_0x43a456,_0x70ba('0xd0'));}var _0x3d10d8=_0x43a456[_0x70ba('0x32')][_0x70ba('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xd1'),_0x3d10d8));var _0x5c0407=this[_0x70ba('0xd2')][_0x70ba('0x6d')](this,_0x3ab9d8,_0x3d10d8);this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x43a456,_0x3d10d8);if(!this['isConfigured'](_0x43a456[_0x70ba('0xd3')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4eb230=this[_0x70ba('0x12')][_0x70ba('0x6d')](this,_0x43a456['variable_id']);if(!_0x4eb230){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x43a456,_0x70ba('0xd4'));}var _0x36f3ed=this;_0x5c0407[_0x70ba('0xd5')](function(_0x217f66,_0x5d0ac3){Object[_0x70ba('0xd6')](_0x217f66)[_0x70ba('0xd5')](function(_0x39ea4d){_0x36f3ed[_0x70ba('0x10')]['setVariable'](util['format'](_0x70ba('0xd7'),_0x4eb230,_0x5d0ac3,_0x39ea4d),_0x217f66[_0x39ea4d]);});});this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')](_0x70ba('0xd8'),_0x4eb230),_0x5c0407['length']);return this['channel'][_0x70ba('0xa3')](util['format']('variable\x20%s\x20set',_0x4eb230));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xd9')]=function(_0x1e0375){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1e0375[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x1e0375[_0x70ba('0xda')])){return this[_0x70ba('0x10')]['error'](_0x1e0375,'no\x20user\x20selected');}var _0x4eed89=this[_0x70ba('0x1f')]['sync'](this,_0x1e0375['sip_id']);if(!_0x4eed89){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x1e0375,'no\x20user\x20found');}var _0x4909d3=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0xdb'),[util['format'](_0x70ba('0xdc'),_0x4eed89),_0x1e0375[_0x70ba('0x66')],_0x1e0375['opts'],_0x1e0375['url']]);if(_0x4909d3[_0x70ba('0x9e')]===-0x1){return _0x4909d3;}return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xdd'),'DIAL'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xde')]=function(_0xed07e2){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xdf'),_0xed07e2[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0xed07e2[_0x70ba('0x76')])){return this['channel'][_0x70ba('0xa3')]('no\x20key\x20configured');}if(!this[_0x70ba('0x81')](_0xed07e2['text'])){return this['channel']['noop'](_0x70ba('0xa4'));}this[_0x70ba('0x10')][_0x70ba('0xe0')]=!![];this[_0x70ba('0x38')](_0xed07e2);this[_0x70ba('0x45')](_0xed07e2[_0x70ba('0x5d')],'in','','');this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0xe1'),_0xed07e2[_0x70ba('0x5d')]));var _0x401556=this['googleDialogflow'][_0x70ba('0x6d')](this,_0xed07e2);if(_0x401556){for(var _0x1a63b7 in _0x401556){if(_0x401556[_0x70ba('0x90')](_0x1a63b7)){this[_0x70ba('0x10')]['setVariable'](util[_0x70ba('0x2c')](_0x70ba('0xe2'),_0x1a63b7[_0x70ba('0xe3')]()),_0x401556[_0x1a63b7]);}}this['createSquareMessage'](_0x401556[_0x70ba('0xe4')],_0x70ba('0xe5'),_0x70ba('0xde'),'');return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')]('Dialogflow\x20Result\x20%s',_0x401556[_0x70ba('0xe4')]));}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xed07e2,_0x70ba('0xe6'));};AGIVertices['prototype'][_0x70ba('0xe7')]=function(_0x11efa8){logger[_0x70ba('0x30')](util['format'](_0x70ba('0xe8'),_0x11efa8[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0x79')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xe9'));}if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0xea')])){return this['channel'][_0x70ba('0xa3')]('no\x20client_email\x20configured');}if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0xeb')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xec'));}if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0x7a')])){return this['channel']['noop'](_0x70ba('0xed'));}if(!this[_0x70ba('0x81')](_0x11efa8[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20text\x20configured');}this[_0x70ba('0x10')]['bot']=!![];this['createSquareDetailsReport'](_0x11efa8);this[_0x70ba('0x45')](_0x11efa8[_0x70ba('0x5d')],'in','','');this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0xee'),_0x11efa8[_0x70ba('0x5d')]));var _0x29fd70=this['googleDialogflowV2'][_0x70ba('0x6d')](this,_0x11efa8);if(_0x29fd70){for(var _0x32b3b9 in _0x29fd70){if(_0x29fd70[_0x70ba('0x90')](_0x32b3b9)){if(_0x32b3b9!==_0x70ba('0xef')){this[_0x70ba('0x10')][_0x70ba('0x99')](util['format']('DIALOGFLOW_%s',_0x32b3b9[_0x70ba('0xe3')]()),_0x29fd70[_0x32b3b9]);}}}this[_0x70ba('0x45')](_0x29fd70[_0x70ba('0xe4')],_0x70ba('0xe5'),_0x70ba('0xe7'),_0x29fd70[_0x70ba('0xef')]);return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')]('DialogflowV2\x20Result\x20%s',_0x29fd70[_0x70ba('0xe4')]));}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x11efa8,_0x70ba('0xf0'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0xf1')]=function(_0x1c0bfa){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0xf2'),_0x1c0bfa[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x1c0bfa[_0x70ba('0xf3')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xf4'));}if(!this[_0x70ba('0x81')](_0x1c0bfa[_0x70ba('0xf5')])){return this['channel']['noop'](_0x70ba('0xf6'));}if(!this[_0x70ba('0x81')](_0x1c0bfa[_0x70ba('0xf7')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xf8'));}if(!this[_0x70ba('0x81')](_0x1c0bfa['ndassistant_url'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xa4'));}this[_0x70ba('0x10')][_0x70ba('0xe0')]=!![];this[_0x70ba('0x38')](_0x1c0bfa);this[_0x70ba('0x45')](_0x1c0bfa[_0x70ba('0x5d')],'in','','');this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('Trying\x20SestekNDA:\x20%s',_0x1c0bfa[_0x70ba('0x5d')]));var _0x652fe7=this[_0x70ba('0x7b')][_0x70ba('0x6d')](this,_0x1c0bfa);if(_0x652fe7){for(var _0x2b08c9 in _0x652fe7){if(_0x652fe7[_0x70ba('0x90')](_0x2b08c9)){this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')](_0x70ba('0xf9'),_0x2b08c9['toUpperCase']()),_0x652fe7[_0x2b08c9]);}}this[_0x70ba('0x45')](_0x652fe7[_0x70ba('0xe4')],_0x70ba('0xe5'),_0x70ba('0xf1'),'');if(_0x652fe7['audiofile']){this['channel'][_0x70ba('0xa3')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x652fe7[_0x70ba('0xfa')]));var _0x1232b9=this['channel']['streamFile'](_0x652fe7[_0x70ba('0xfa')]);try{fs[_0x70ba('0xfb')](_0x652fe7[_0x70ba('0xfa')]+_0x70ba('0xfc'));}catch(_0x8d2d41){logger[_0x70ba('0x2f')](_0x8d2d41);}return _0x1232b9;}else{return this['channel']['noop'](util[_0x70ba('0x2c')](_0x70ba('0xfd'),_0x652fe7['speech']));}}return this['channel'][_0x70ba('0x2f')](_0x1c0bfa,_0x70ba('0xfe'));};AGIVertices['prototype']['end']=function(_0x3f65c3){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0xff'),_0x3f65c3['label']));return this[_0x70ba('0x10')]['noop'](_0x70ba('0x100'));};AGIVertices['prototype'][_0x70ba('0x101')]=function(_0xe2926f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xe2926f[_0x70ba('0x3a')]));var _0x48014f='';if(_0xe2926f[_0x70ba('0x102')]){if(!this[_0x70ba('0x81')](_0xe2926f[_0x70ba('0x102')])){return this['channel']['error'](_0xe2926f,'no\x20trunk\x20selected');}else{var _0x7a9fdf=parseInt(_0xe2926f['trunk_id'],0xa);if(isNaN(_0x7a9fdf)){_0x48014f=_0xe2926f[_0x70ba('0x102')];}else{_0x48014f=this[_0x70ba('0x103')][_0x70ba('0x6d')](this,_0xe2926f[_0x70ba('0x102')]);if(!_0x48014f){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xe2926f,_0x70ba('0x104'));}}}}else if(_0xe2926f[_0x70ba('0x105')]){_0x48014f=_0xe2926f[_0x70ba('0x105')];}else{return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xe2926f,_0x70ba('0x106'));}var _0x24ae91=this[_0x70ba('0x10')]['exec'](_0x70ba('0xdb'),[util[_0x70ba('0x2c')](_0x70ba('0x107'),_0x48014f,_0xe2926f[_0x70ba('0x4a')]),_0xe2926f[_0x70ba('0x66')],_0xe2926f[_0x70ba('0x108')],_0xe2926f['url']]);if(_0x24ae91[_0x70ba('0x9e')]===-0x1){return _0x24ae91;}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0xdd'),_0x70ba('0xdb')));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x109')]=function(_0x473f0f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x10a'),_0x473f0f[_0x70ba('0x3a')]));return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x109'));};AGIVertices[_0x70ba('0x15')]['getdigits']=function(_0x19459b){logger['info'](util['format'](_0x70ba('0x10b'),_0x19459b['label']));if(_0x19459b[_0x70ba('0xa1')]===0x0){return this[_0x70ba('0xa0')](_0x19459b);}_0x19459b[_0x70ba('0xa1')]-=0x1;if(!this[_0x70ba('0x81')](_0x19459b[_0x70ba('0x10c')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x19459b,_0x70ba('0x10d'));}var _0x2742fe=this[_0x70ba('0x22')][_0x70ba('0x6d')](this,_0x19459b['file_id']);if(!_0x2742fe){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x19459b,_0x70ba('0x10e'));}if(!this['isConfigured'](_0x19459b[_0x70ba('0xd3')])){return this['channel']['error'](_0x70ba('0x10f'));}var _0x330f9f=this[_0x70ba('0x10')]['getData'](_0x2742fe,_0x19459b[_0x70ba('0x110')],_0x19459b[_0x70ba('0x111')]);var _0x3c0a25=_0x330f9f[_0x70ba('0x9e')]?_0x330f9f['result'][_0x70ba('0x112')]():'';logger[_0x70ba('0x30')](_0x70ba('0x113'),JSON['stringify'](_0x330f9f));if(_0x330f9f[_0x70ba('0x9e')]===-0x1){this[_0x70ba('0x38')]['sync'](this,_0x19459b,_0x3c0a25);return _0x330f9f;}else if(_0x330f9f[_0x70ba('0x9d')]==='timeout'){_0x330f9f['result']=_0x3c0a25[_0x70ba('0x98')]>=parseInt(_0x19459b['mindigit'])?'x':'i';}else{_0x330f9f[_0x70ba('0x9e')]=_0x3c0a25[_0x70ba('0x98')]>=parseInt(_0x19459b[_0x70ba('0x114')])&&_0x3c0a25[_0x70ba('0x98')]<=parseInt(_0x19459b[_0x70ba('0x111')])?'x':'i';}var _0x46fc83=this['getVariable'][_0x70ba('0x6d')](this,_0x19459b[_0x70ba('0xd3')]);if(!_0x46fc83){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x19459b,'no\x20variable\x20found');}this[_0x70ba('0x10')][_0x70ba('0x99')](_0x46fc83,_0x3c0a25);if(this['isConfigured'](_0x19459b['hiddendigitsnum'])){var _0x1cecde=parseInt(_0x19459b[_0x70ba('0x115')],0xa);var _0x344d78=rs['generate']({'charset':'*','length':_0x1cecde});var _0x316cdf=_0x3c0a25['length'];if(_0x316cdf>0x0){if(_0x316cdf>_0x1cecde){this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x19459b,_0x19459b['hiddendigitspos']===_0x70ba('0x116')?_0x344d78+_0x3c0a25[_0x70ba('0x117')](_0x1cecde):_0x3c0a25['substr'](0x0,_0x316cdf-_0x1cecde)+_0x344d78);}else{this['createSquareDetailsReport']['sync'](this,_0x19459b,rs['generate']({'charset':'*','length':_0x316cdf}));}}else{this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x19459b,'');}}else{this[_0x70ba('0x38')]['sync'](this,_0x19459b,_0x3c0a25);}return _0x330f9f;};AGIVertices[_0x70ba('0x15')]['getsecretdigits']=function(_0x34649b){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x118'),_0x34649b[_0x70ba('0x3a')]));return this['getdigits'](_0x34649b);};AGIVertices[_0x70ba('0x15')]['goal']=function(_0x5567ce){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x119'),_0x5567ce[_0x70ba('0x3a')]));this['createSquareDetailsReport'][_0x70ba('0x6d')](this,_0x5567ce,_0x5567ce[_0x70ba('0x11a')]);return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x11b'),_0x5567ce[_0x70ba('0x11a')]));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x11c')]=function(_0x33ef13){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x11d'),_0x33ef13[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x33ef13[_0x70ba('0x84')])||!this['isConfigured'](_0x33ef13[_0x70ba('0x88')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x70ba('0x81')](_0x33ef13[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20text\x20configured');}this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x11e'),_0x33ef13[_0x70ba('0x5d')]));var _0x1c47c0=this['awsPolly'][_0x70ba('0x6d')](this,_0x33ef13);if(_0x1c47c0){this[_0x70ba('0x10')]['noop'](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x1c47c0));var _0xb8eda0=this['channel'][_0x70ba('0x11f')](_0x1c47c0);try{fs['unlink'](_0x1c47c0+'.wav');}catch(_0x2e49be){logger[_0x70ba('0x2f')](_0x2e49be);}return _0xb8eda0;}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x33ef13,_0x70ba('0x120'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x121')]=function(_0x3f736a){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x122'),_0x3f736a[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x3f736a[_0x70ba('0x84')])||!this[_0x70ba('0x81')](_0x3f736a[_0x70ba('0x88')])){return this['channel']['noop'](_0x70ba('0x123'));}if(!this['isConfigured'](_0x3f736a[_0x70ba('0x89')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0x124'));}if(!this[_0x70ba('0x81')](_0x3f736a[_0x70ba('0x5d')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0xa4'));}this[_0x70ba('0x10')][_0x70ba('0xe0')]=!![];this[_0x70ba('0x38')](_0x3f736a);this['createSquareMessage'](_0x3f736a[_0x70ba('0x5d')],'in','','');this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x125'),_0x3f736a[_0x70ba('0x5d')]));var _0x3637a7=this['awsLex'][_0x70ba('0x6d')](this,_0x3f736a);if(_0x3637a7){for(var _0x4912cb in _0x3637a7){if(_0x3637a7[_0x70ba('0x90')](_0x4912cb)&&_[_0x70ba('0x91')](_0x3637a7[_0x4912cb])){this[_0x70ba('0x10')][_0x70ba('0x99')](util['format']('AWS_LEX_%s',_0x4912cb[_0x70ba('0xe3')]()),_0x3637a7[_0x4912cb]);}}if(_[_0x70ba('0x48')](_0x3637a7[_0x70ba('0x72')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x70ba('0x45')](_0x3637a7[_0x70ba('0x72')],_0x70ba('0xe5'),_0x70ba('0x126'),'');return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x127'),_0x3637a7[_0x70ba('0x72')]));}}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x3f736a,_0x70ba('0x128'));};AGIVertices['prototype'][_0x70ba('0x129')]=function(_0x2be697){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x12a'),_0x2be697[_0x70ba('0x3a')],_0x2be697[_0x70ba('0x66')]));if(!this[_0x70ba('0x81')](_0x2be697[_0x70ba('0x76')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x12b'));}var _0x27c559=_0x70ba('0x12c');var _0x5996f8=util[_0x70ba('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0x70ba('0x12d')](0x4));var _0x1c3dca=util['format']('%s.%s',_0x5996f8,_0x27c559);var _0x5a3c96=!![];if(_0x2be697[_0x70ba('0x12e')]==='NOBEEP'){_0x5a3c96=![];}var _0xea2416=this[_0x70ba('0x10')][_0x70ba('0x12f')](_0x5996f8,_0x27c559,_0x2be697['intKey'],_0x2be697['timeout'],undefined,_0x5a3c96);if(_0xea2416[_0x70ba('0x9e')]!==-0x1){this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x130'),_0x1c3dca));var _0x27a850=this[_0x70ba('0x8a')][_0x70ba('0x6d')](this,_0x2be697,_0x1c3dca);if(_0x27a850){for(var _0x43e2a7 in _0x27a850){if(_0x27a850[_0x70ba('0x90')](_0x43e2a7)){this['channel']['setVariable'](util[_0x70ba('0x2c')](_0x70ba('0x131'),_0x43e2a7[_0x70ba('0xe3')]()),_0x27a850[_0x43e2a7]);}}return this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0x132'),JSON[_0x70ba('0x6f')](_0x27a850)));}}return _0xea2416;};AGIVertices['prototype'][_0x70ba('0x133')]=function(_0x255d7e){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x134'),_0x255d7e[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x255d7e[_0x70ba('0x135')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0x136'));}if(!this[_0x70ba('0x81')](_0x255d7e[_0x70ba('0x8c')])){return this['channel'][_0x70ba('0xa3')](_0x70ba('0x137'));}var _0x5a36df='wav';var _0x5b2da3=util[_0x70ba('0x2c')](_0x70ba('0x138'),FILES_PATH,rs[_0x70ba('0x12d')](0x4));var _0x4cbd35=util[_0x70ba('0x2c')]('%s.%s',_0x5b2da3,_0x5a36df);var _0xc333d1=!![];if(_0x255d7e[_0x70ba('0x12e')]===_0x70ba('0x139')){_0xc333d1=![];}var _0x2e2856=this['channel']['recordFile'](_0x5b2da3,_0x5a36df,_0x255d7e[_0x70ba('0x13a')],_0x255d7e[_0x70ba('0x66')],undefined,_0xc333d1);if(_0x2e2856[_0x70ba('0x9e')]!==-0x1){this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x13b'),_0x4cbd35));var _0x34589c=this['tildeASR'][_0x70ba('0x6d')](this,_0x255d7e,_0x4cbd35);if(_0x34589c){for(var _0x44d4e6 in _0x34589c){if(_0x34589c[_0x70ba('0x90')](_0x44d4e6)){this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')](_0x70ba('0x13c'),_0x44d4e6[_0x70ba('0xe3')]()),_0x34589c[_0x44d4e6]);}}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x13d'),JSON[_0x70ba('0x6f')](_0x34589c)));}}return _0x2e2856;};AGIVertices[_0x70ba('0x15')][_0x70ba('0x13e')]=function(_0x15461f){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x13f'),_0x15461f[_0x70ba('0x3a')]));return this['channel'][_0x70ba('0x140')](_0x15461f[_0x70ba('0x40')],_0x15461f[_0x70ba('0x41')],_0x15461f[_0x70ba('0x141')]);};AGIVertices[_0x70ba('0x15')]['gotoif']=function(_0x3d39a9){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x142'),_0x3d39a9[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x3d39a9[_0x70ba('0x143')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x3d39a9,_0x70ba('0x144'));}try{var _0x36a943=eval(_0x3d39a9[_0x70ba('0x143')])?_0x70ba('0x145'):'false';this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0x146'),_0x3d39a9[_0x70ba('0x143')],_0x36a943));return{'code':0xc8,'result':_0x36a943};}catch(_0x124177){return{'code':0xc8,'result':_0x70ba('0x147')};}};AGIVertices[_0x70ba('0x15')]['gotoiftime']=function(_0x4e46e3){logger['info'](util[_0x70ba('0x2c')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x4e46e3[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x4e46e3['interval_id'])){return this[_0x70ba('0x10')]['error'](_0x4e46e3,_0x70ba('0x148'));}var _0x183749=this[_0x70ba('0x28')][_0x70ba('0x6d')](this,_0x4e46e3[_0x70ba('0x149')]);if(!_0x183749){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4e46e3,_0x70ba('0x14a'));}for(var _0x228aa5=0x0;_0x228aa5<_0x183749['length'];_0x228aa5+=0x1){var _0x291d2d=this[_0x70ba('0x10')]['getVariable'](util[_0x70ba('0x2c')]('IFTIME(%s?true:false)',_0x183749[_0x228aa5]));if(_0x291d2d[_0x70ba('0x9e')]===-0x1){return _0x291d2d;}logger['info'](util[_0x70ba('0x2c')]('IFTIME\x20%s\x20%s',_0x183749[_0x228aa5],_0x291d2d['extra']));if(_0x291d2d['extra']===_0x70ba('0x145')){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x14b'),_0x183749[_0x228aa5],_0x70ba('0x145')));this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x14b'),_0x183749[_0x228aa5],'true'));return{'code':0xc8,'result':_0x70ba('0x145')};}else{logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x14b'),_0x183749[_0x228aa5],_0x70ba('0x147')));this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('IFTIME\x20%s\x20%s',_0x183749[_0x228aa5],_0x70ba('0x147')));}}return{'code':0xc8,'result':_0x70ba('0x147')};};AGIVertices[_0x70ba('0x15')]['hangup']=function(_0x5b86b0){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x14c'),_0x5b86b0[_0x70ba('0x3a')]));return this['channel']['hangup']();};AGIVertices[_0x70ba('0x15')][_0x70ba('0x14d')]=function(_0xf966b8){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x14e'),_0xf966b8[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0xf966b8[_0x70ba('0x76')])){return this['channel'][_0x70ba('0xa3')](_0x70ba('0x12b'));}var _0x14a6ec=_0x70ba('0x12c');var _0x54b253=util[_0x70ba('0x2c')](_0x70ba('0x138'),FILES_PATH,rs['generate'](0x4));var _0x148c21=util['format'](_0x70ba('0x97'),_0x54b253,_0x14a6ec);var _0x3d1cf0=!![];if(_0xf966b8[_0x70ba('0x12e')]===_0x70ba('0x139')){_0x3d1cf0=![];}var _0x2a590a=this['channel'][_0x70ba('0x12f')](_0x54b253,_0x14a6ec,_0xf966b8['intKey'],_0xf966b8['timeout'],undefined,_0x3d1cf0);if(_0x2a590a[_0x70ba('0x9e')]!==-0x1){this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('ispeech\x20%s\x20file\x20created',_0x148c21));var _0x3cf5a7=this['ispeechASR'][_0x70ba('0x6d')](this,_0xf966b8,_0x148c21);if(_0x3cf5a7){for(var _0x37b72b in _0x3cf5a7){if(_0x3cf5a7[_0x70ba('0x90')](_0x37b72b)){this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')]('ISPEECH_ASR_%s',_0x37b72b[_0x70ba('0xe3')]()),_0x3cf5a7[_0x37b72b]);}}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x14f'),JSON[_0x70ba('0x6f')](_0x3cf5a7)));}}return _0x2a590a;};AGIVertices['prototype']['ispeechtts']=function(_0x36afbb){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x150'),_0x36afbb[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x36afbb[_0x70ba('0x76')])){return this['channel']['noop'](_0x70ba('0x12b'));}if(!this['isConfigured'](_0x36afbb[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20text\x20configured');}this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x151'),_0x36afbb[_0x70ba('0x5d')]));var _0x49293b=this[_0x70ba('0x7c')][_0x70ba('0x6d')](this,_0x36afbb);if(_0x49293b){this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')]('ispeech\x20%s\x20file\x20created',_0x49293b));var _0x3e6d49=this[_0x70ba('0x10')][_0x70ba('0x11f')](_0x49293b,_0x36afbb['intKey']);try{fs[_0x70ba('0xfb')](_0x49293b+_0x70ba('0xfc'));}catch(_0x43a5ec){logger[_0x70ba('0x2f')](_0x43a5ec);}return _0x3e6d49;}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x36afbb,_0x70ba('0x152'));};AGIVertices['prototype'][_0x70ba('0x153')]=function(_0xf4c0f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xf4c0f[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0xf4c0f[_0x70ba('0x154')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xf4c0f,_0x70ba('0x155'));}logger['info'](util['format'](_0x70ba('0x156'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));var _0x34832e=this[_0x70ba('0x56')]['sync'](this,_0xf4c0f[_0x70ba('0x154')]);if(_0x34832e){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));return{'code':0xc8,'result':_0x70ba('0x158')};}else{logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0xf4c0f[_0x70ba('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x70ba('0x15')][_0x70ba('0x15a')]=function(_0x11d626){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x15b'),_0x11d626[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x11d626[_0x70ba('0x154')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x11d626,_0x70ba('0x155'));}logger[_0x70ba('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x11d626[_0x70ba('0x154')]));var _0x481ba6=this[_0x70ba('0x15c')][_0x70ba('0x6d')](this,_0x11d626[_0x70ba('0x154')]);if(_0x481ba6){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x157'),this[_0x70ba('0x10')]['callerid'],_0x11d626[_0x70ba('0x154')]));this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x11d626[_0x70ba('0x154')]));return{'code':0xc8,'result':_0x70ba('0x158')};}else{logger['info'](util[_0x70ba('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x11d626[_0x70ba('0x154')]));this['channel'][_0x70ba('0xa3')](util['format'](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x11d626['findBy']));return{'code':0xc8,'result':_0x70ba('0x15d')};}};AGIVertices[_0x70ba('0x15')][_0x70ba('0x15e')]=function(_0x551a95){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x15f'),_0x551a95[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x551a95[_0x70ba('0x160')])){return this[_0x70ba('0x10')]['error'](_0x551a95,_0x70ba('0x161'));}this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x162'),_0x551a95[_0x70ba('0x160')]));var _0x40a429=eval(_0x551a95[_0x70ba('0x160')]);if(!this[_0x70ba('0x81')](_0x551a95['variable_id'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x10f'));}var _0x5a7bb7=this[_0x70ba('0x12')][_0x70ba('0x6d')](this,_0x551a95[_0x70ba('0xd3')]);if(!_0x5a7bb7){return this['channel'][_0x70ba('0x2f')](_0x551a95,'no\x20variable\x20found');}if(_['isArray'](_0x40a429)){var _0x58f5d7=this;_0x40a429[_0x70ba('0xd5')](function(_0x223c10,_0x4bab7f){_0x58f5d7[_0x70ba('0x10')]['setVariable'](util['format'](_0x70ba('0x163'),_0x5a7bb7,_0x4bab7f),_0x223c10);});return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x164'),_0x5a7bb7));}else{return this[_0x70ba('0x10')]['setVariable'](_0x5a7bb7,_0x40a429);}};AGIVertices[_0x70ba('0x15')][_0x70ba('0xd')]=function(_0x247767){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x247767[_0x70ba('0x3a')]));if(_0x247767['retry']===0x0){return this[_0x70ba('0xa0')](_0x247767);}_0x247767[_0x70ba('0xa1')]-=0x1;if(!this[_0x70ba('0x81')](_0x247767[_0x70ba('0x10c')])){return this[_0x70ba('0x10')]['error'](_0x247767,_0x70ba('0x10d'));}var _0x19e17f=this[_0x70ba('0x22')][_0x70ba('0x6d')](this,_0x247767[_0x70ba('0x10c')]);if(!_0x19e17f){return this['channel'][_0x70ba('0x2f')](_0x247767,_0x70ba('0x10e'));}var _0x1932a4=this[_0x70ba('0x10')][_0x70ba('0x165')](_0x19e17f,_0x247767['response'],_0x247767['digit']);var _0x2cae5f=_0x1932a4[_0x70ba('0x9e')];if(_0x1932a4['result']===-0x1){this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x247767,'-1');return _0x1932a4;}else if(_0x1932a4[_0x70ba('0x9d')]===_0x70ba('0x66')){_0x1932a4[_0x70ba('0x9e')]=_0x1932a4[_0x70ba('0x9e')]['length']>0x0?_0x1932a4[_0x70ba('0x9e')]:'t';}else if(_[_0x70ba('0x47')](_0x1932a4['result'])){_0x1932a4['result']='#';_0x2cae5f='#';}if(!this[_0x70ba('0x81')](_0x247767['variable_id'])){this['channel'][_0x70ba('0xa3')](_0x70ba('0x10f'));}else{var _0x45b259=this[_0x70ba('0x12')][_0x70ba('0x6d')](this,_0x247767[_0x70ba('0xd3')]);if(!_0x45b259){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x247767,'no\x20variable\x20found');}this[_0x70ba('0x10')][_0x70ba('0x99')](_0x45b259,_0x2cae5f);}this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x247767,_0x2cae5f);return _0x1932a4;};AGIVertices[_0x70ba('0x15')]['noop']=function(_0x3600ff){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x166'),_0x3600ff[_0x70ba('0x3a')]));return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x3600ff[_0x70ba('0x167')]||_0x3600ff[_0x70ba('0x3a')]);};AGIVertices[_0x70ba('0x15')][_0x70ba('0x168')]=function(_0x249a43){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x169'),_0x249a43['label']));if(!this[_0x70ba('0x81')](_0x249a43['findBy'])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x249a43,_0x70ba('0x155'));}logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x156'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x249a43[_0x70ba('0x154')]));var _0x5b7268=this[_0x70ba('0x16a')][_0x70ba('0x6d')](this,_0x249a43[_0x70ba('0x16b')]);var _0x204f52=this[_0x70ba('0x50')]['sync'](this,_0x249a43[_0x70ba('0x154')],_0x5b7268);if(_0x204f52){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x249a43[_0x70ba('0x154')]));this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x249a43[_0x70ba('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')]['callerid'],_0x249a43[_0x70ba('0x154')]));this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x249a43[_0x70ba('0x154')]));return{'code':0xc8,'result':_0x70ba('0x15d')};}};AGIVertices['prototype'][_0x70ba('0x16c')]=function(_0x48135d){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x16d'),_0x48135d[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x48135d[_0x70ba('0x10c')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x48135d,_0x70ba('0x10d'));}var _0x111c22=this[_0x70ba('0x22')][_0x70ba('0x6d')](this,_0x48135d[_0x70ba('0x10c')]);if(!_0x111c22){return this[_0x70ba('0x10')]['error'](_0x48135d,'no\x20file\x20audio\x20found');}var _0x4101f7=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0x16e'),[_0x111c22,_0x48135d[_0x70ba('0x108')]]);if(_0x4101f7[_0x70ba('0x9e')]===-0x1){return _0x4101f7;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x111c22));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x16f')]=function(_0x4ff4d6){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4ff4d6[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x4ff4d6[_0x70ba('0x170')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4ff4d6,_0x70ba('0x171'));}var _0xd51ae3='';var _0x1617a4=parseInt(_0x4ff4d6[_0x70ba('0x170')],0xa);if(isNaN(_0x1617a4)){_0xd51ae3=_0x4ff4d6[_0x70ba('0x170')];}else{_0xd51ae3=this[_0x70ba('0x16')]['sync'](this,_0x4ff4d6['queue_id']);if(!_0xd51ae3){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4ff4d6,'no\x20queue\x20found');}}var _0x1b9173='';if(this[_0x70ba('0x81')](_0x4ff4d6[_0x70ba('0x10c')])){var _0x4fa5ca=this[_0x70ba('0x22')][_0x70ba('0x6d')](this,_0x4ff4d6[_0x70ba('0x10c')]);if(_0x4fa5ca){_0x1b9173=_0x4fa5ca;}}this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x4ff4d6,_0xd51ae3);if(_0x4ff4d6[_0x70ba('0x108')][_0x70ba('0x172')]('x')<0x0){_0x4ff4d6[_0x70ba('0x108')]+='x';}if(_0x4ff4d6[_0x70ba('0x108')][_0x70ba('0x172')]('X')<0x0){_0x4ff4d6[_0x70ba('0x108')]+='X';}this[_0x70ba('0x10')]['setVariable'](_0x70ba('0x173'),_0xd51ae3?_0xd51ae3['toLowerCase']():'');var _0x24101b=this['channel'][_0x70ba('0x58')]('QUEUE',[_0xd51ae3,_0x4ff4d6[_0x70ba('0x108')],_0x4ff4d6[_0x70ba('0x174')],_0x1b9173,_0x4ff4d6[_0x70ba('0x66')],_0x4ff4d6[_0x70ba('0x7')],_0x4ff4d6[_0x70ba('0x175')],_0x4ff4d6[_0x70ba('0x176')],'',_0x4ff4d6['position']]);if(_0x24101b[_0x70ba('0x9e')]===-0x1){return _0x24101b;}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0xc0'),_0x70ba('0x177'),_0xd51ae3));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x178')]=function(_0x3e5a68){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x3e5a68[_0x70ba('0x3a')]));var _0x3e4e26=_0x3e5a68[_0x70ba('0x179')]||_0x70ba('0x12c');var _0x3f239d=util['format']('%s_%s',this['channel']['uniqueid'],rs[_0x70ba('0x12d')](0x5));var _0xdc0f1b=util[_0x70ba('0x2c')](_0x70ba('0x17a'),FILES_PATH,_0x3f239d,_0x3e4e26);var _0x5171fd=util[_0x70ba('0x2c')]('%s/recordings/%s',FILES_PATH,_0x3f239d);this[_0x70ba('0x3e')][_0x70ba('0x6d')](this,_0x3e5a68,_0x3f239d,_0xdc0f1b);this[_0x70ba('0x10')][_0x70ba('0x99')]('RECORDING_SAVENAME',_0x3f239d);logger[_0x70ba('0x30')](_0x70ba('0x17b'),_0x5171fd,_0x3e4e26,_0x3e5a68['escape_digits'],_0x3e5a68['timeout']);return this[_0x70ba('0x10')][_0x70ba('0x12f')](_0x5171fd,_0x3e4e26,_0x3e5a68[_0x70ba('0x17c')],_0x3e5a68[_0x70ba('0x66')],undefined,!![]);};AGIVertices[_0x70ba('0x15')]['restapi']=function(_0x5eb281){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x17d'),_0x5eb281[_0x70ba('0x3a')]));if(!this['isConfigured'](_0x5eb281[_0x70ba('0x174')])){return this['channel'][_0x70ba('0xa3')](_0x70ba('0x17e'));}var _0x1f3ce8=this['restAPI'][_0x70ba('0x6d')](this,_0x5eb281);logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x17f'),util[_0x70ba('0x180')](_0x1f3ce8,{'showHidden':![],'depth':null})));if(!this[_0x70ba('0x81')](_0x5eb281['variable_id'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x181'));}var _0x4fda0a=this[_0x70ba('0x12')]['sync'](this,_0x5eb281[_0x70ba('0xd3')]);if(!_0x4fda0a){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x5eb281,_0x70ba('0xd4'));}this[_0x70ba('0x10')][_0x70ba('0x99')](util['format'](_0x70ba('0x182'),_0x4fda0a),_0x1f3ce8[_0x70ba('0x183')]?_0x1f3ce8[_0x70ba('0x183')]:_0x70ba('0x184'));this[_0x70ba('0x10')][_0x70ba('0x99')](util[_0x70ba('0x2c')]('%s_STATUS_MESSAGE',_0x4fda0a),_0x1f3ce8[_0x70ba('0x71')]?_0x1f3ce8[_0x70ba('0x71')]:'OK');if(_0x1f3ce8[_0x70ba('0x69')]){try{this[_0x70ba('0x96')](_0x1f3ce8[_0x70ba('0x69')],_0x4fda0a);}catch(_0x2434fd){logger['error'](util[_0x70ba('0x2c')](_0x70ba('0x185'),_0x4fda0a));}}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x186'),_0x4fda0a));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x187')]=function(_0x16b083){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x188'),_0x16b083['label']));return this[_0x70ba('0x10')][_0x70ba('0x189')](_0x16b083[_0x70ba('0x18a')][_0x70ba('0x5a')](/\s+/g,''),_0x16b083[_0x70ba('0x17c')]);};AGIVertices['prototype'][_0x70ba('0x18b')]=function(_0x14e8f6){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x18c'),_0x14e8f6['label']));return this['channel'][_0x70ba('0x18d')](_0x14e8f6[_0x70ba('0x67')][_0x70ba('0x5a')](/\s+/g,''),_0x14e8f6['escape_digits']);};AGIVertices['prototype']['sayphonetic']=function(_0x486e9f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x18e'),_0x486e9f[_0x70ba('0x3a')]));return this['channel'][_0x70ba('0x18f')](_0x486e9f[_0x70ba('0x5d')],_0x486e9f[_0x70ba('0x17c')]);};AGIVertices[_0x70ba('0x15')][_0x70ba('0x190')]=function(_0x1dc3c0){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x1dc3c0[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x1dc3c0[_0x70ba('0x191')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x192'));}var _0x293b23=this[_0x70ba('0x25')][_0x70ba('0x6d')](this,_0x1dc3c0['account_id']);if(!_0x293b23||!_0x293b23['Smtp']){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x1dc3c0,_0x70ba('0x193'));}var _0x29fbff={'from':util[_0x70ba('0x2c')](_0x70ba('0x194'),_0x293b23['name'],_0x293b23[_0x70ba('0x195')]||_0x293b23[_0x70ba('0x196')][_0x70ba('0x197')]),'to':_0x1dc3c0['to']||'','cc':_0x1dc3c0['cc']||'','bcc':_0x1dc3c0['bcc']||'','subject':_0x1dc3c0[_0x70ba('0x198')],'html':_0x1dc3c0[_0x70ba('0x5d')],'text':_0x1dc3c0[_0x70ba('0x5d')]};if(this[_0x70ba('0x81')](_0x1dc3c0[_0x70ba('0x199')])){}logger[_0x70ba('0x19a')](_0x70ba('0x19b'),JSON['stringify'](_0x29fbff));this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x1dc3c0,_0x1dc3c0['account_id']);this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format'](_0x70ba('0x19c'),_0x293b23[_0x70ba('0x19')]));this[_0x70ba('0x27')][_0x70ba('0x6d')](this,_0x293b23[_0x70ba('0x19d')],_0x29fbff);return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x19e'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x19f')]=function(_0x4fe497){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x1a0'),_0x4fe497[_0x70ba('0x3a')]));return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x1a1'));};AGIVertices['prototype'][_0x70ba('0x1a2')]=function(_0x175bf6){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x175bf6[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x175bf6['sms_account_id'])){return this[_0x70ba('0x10')][_0x70ba('0xa3')]('no\x20sms\x20account\x20configured');}var _0xff896a=this[_0x70ba('0x1a3')][_0x70ba('0x6d')](this,_0x175bf6['sms_account_id']);if(!_0xff896a){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x175bf6,_0x70ba('0x1a4'));}var _0x52fd64={'body':_0x175bf6[_0x70ba('0x1a5')],'phone':_0x175bf6['to']||'','SmsAccountId':_0xff896a['id']};logger[_0x70ba('0x19a')]('sendSMS\x20message',JSON[_0x70ba('0x6f')](_0x52fd64));this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x175bf6,_0x175bf6[_0x70ba('0x1a6')]);this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format'](_0x70ba('0x1a7'),_0xff896a[_0x70ba('0x19')]));this[_0x70ba('0x37')][_0x70ba('0x6d')](this,_0x52fd64);return this['channel']['noop'](_0x70ba('0x1a8'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1a9')]=function(_0x4c97fc){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x1aa'),_0x4c97fc[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x4c97fc[_0x70ba('0xd3')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4c97fc,_0x70ba('0x1ab'));}var _0x2f2c95=this['getVariable'][_0x70ba('0x6d')](this,_0x4c97fc[_0x70ba('0xd3')]);if(!_0x2f2c95){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4c97fc,_0x70ba('0xd4'));}return this[_0x70ba('0x10')][_0x70ba('0x99')](_0x2f2c95,_0x4c97fc[_0x70ba('0x1ac')]);};AGIVertices[_0x70ba('0x15')]['start']=function(_0xea2390){logger[_0x70ba('0x30')](util['format'](_0x70ba('0x1ad'),_0xea2390[_0x70ba('0x3a')]));this[_0x70ba('0x10')]['noop'](_0x70ba('0x1ae'));var _0x5ae974=this[_0x70ba('0x10')][_0x70ba('0x12')](_0x70ba('0x1af'));if(!_['isEmpty'](_0x5ae974['extra'])){this[_0x70ba('0x10')][_0x70ba('0x39')]=_0x5ae974[_0x70ba('0x9d')];}if(_0xea2390['answer']==='yes'){this[_0x70ba('0x10')]['noop'](_0x70ba('0x1b0'));return this[_0x70ba('0x10')][_0x70ba('0xb5')]();}return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0x1b1'));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1b2')]=function(_0xbf1224){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x1b3'),_0xbf1224[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0xbf1224[_0x70ba('0x1b4')])){return this[_0x70ba('0x10')]['error'](_0xbf1224,_0x70ba('0x1b5'));}var _0x1a6410=this[_0x70ba('0x1a')][_0x70ba('0x6d')](this,_0xbf1224[_0x70ba('0x1b4')]);if(!this[_0x70ba('0x81')](_0x1a6410)){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0xbf1224,util[_0x70ba('0x2c')](_0x70ba('0x1b6'),_0xbf1224[_0x70ba('0x1b4')]));}if(_0x1a6410===this[_0x70ba('0x10')][_0x70ba('0x3c')]){return this['channel']['error'](_0xbf1224,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x70ba('0x6d')](this,_0xbf1224,_0x1a6410);var _0x5a41e1=this[_0x70ba('0x10')][_0x70ba('0x58')](_0x70ba('0x1b7'),util[_0x70ba('0x2c')](_0x70ba('0x1b8'),config['agi'][_0x70ba('0x1b9')]||_0x70ba('0x1ba'),_0x1a6410,this[_0x70ba('0x10')]['arg_1']));if(_0x5a41e1['result']===-0x1){return _0x5a41e1;}return this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0xc0'),'AGI',_0x1a6410));};AGIVertices['prototype'][_0x70ba('0x1bb')]=function(_0x53dcf7){logger['info'](util[_0x70ba('0x2c')](_0x70ba('0x1bc'),_0x53dcf7[_0x70ba('0x3a')]));var _0x5c7ca8=this[_0x70ba('0x57')][_0x70ba('0x6d')](this,_0x53dcf7['command']);this[_0x70ba('0x38')][_0x70ba('0x6d')](this,_0x53dcf7,_0x53dcf7[_0x70ba('0x1bd')]);if(this[_0x70ba('0x81')](_0x53dcf7[_0x70ba('0xd3')])){var _0x53647d=this[_0x70ba('0x12')]['sync'](this,_0x53dcf7['variable_id']);if(_0x53647d){this['channel'][_0x70ba('0x99')](_0x53647d,_0x5c7ca8);return this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x1be'),_0x53dcf7[_0x70ba('0x1bd')],_0x53647d));}}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x1bf'),_0x53dcf7[_0x70ba('0x1bd')]));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1c0')]=function(_0x4936a3){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x1c1'),_0x4936a3[_0x70ba('0x3a')]));_0x4936a3['text']=_0x4936a3[_0x70ba('0x5d')][_0x70ba('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x70ba('0x81')](_0x4936a3[_0x70ba('0x5c')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0x1c2'));}if(!this['isConfigured'](_0x4936a3[_0x70ba('0x5d')])){return this[_0x70ba('0x10')]['noop'](_0x70ba('0xa4'));}this[_0x70ba('0x10')]['noop'](util[_0x70ba('0x2c')](_0x70ba('0x1c3'),_0x4936a3[_0x70ba('0x5d')]));var _0x8b1cbe=this[_0x70ba('0x5b')][_0x70ba('0x6d')](this,_0x4936a3);if(_0x8b1cbe){this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x8b1cbe));var _0x38fa5f=this[_0x70ba('0x10')]['streamFile'](_0x8b1cbe);try{fs[_0x70ba('0xfb')](_0x8b1cbe+_0x70ba('0xfc'));}catch(_0x1af05e){logger[_0x70ba('0x2f')](_0x1af05e);}return _0x38fa5f;}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x4936a3,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1c4')]=function(_0x1dbdca){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x1c5'),_0x1dbdca['label']));_0x1dbdca[_0x70ba('0x5d')]=_0x1dbdca[_0x70ba('0x5d')][_0x70ba('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1dbdca[_0x70ba('0x5d')])){return this[_0x70ba('0x10')][_0x70ba('0xa3')](_0x70ba('0xa4'));}this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x1c6'),_0x1dbdca[_0x70ba('0x5d')]));var _0x4306e0=this[_0x70ba('0x63')][_0x70ba('0x6d')](this,_0x1dbdca);if(_0x4306e0){this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x1c7'),_0x4306e0));var _0x1d31ce=this['channel']['streamFile'](_0x4306e0);try{fs[_0x70ba('0xfb')](_0x4306e0+'.wav');}catch(_0x4a4436){logger[_0x70ba('0x2f')](_0x4a4436);}return _0x1d31ce;}return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x1dbdca,_0x70ba('0x1c8'));};AGIVertices[_0x70ba('0x15')]['unpause']=function(_0x3cc12a){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x3cc12a[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x3cc12a[_0x70ba('0x154')])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x3cc12a,_0x70ba('0x155'));}logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x156'),this[_0x70ba('0x10')]['callerid'],_0x3cc12a[_0x70ba('0x154')]));var _0x57ae81=this[_0x70ba('0x51')][_0x70ba('0x6d')](this,_0x3cc12a[_0x70ba('0x154')]);if(_0x57ae81){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')]['callerid'],_0x3cc12a[_0x70ba('0x154')]));this[_0x70ba('0x10')][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x157'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x3cc12a[_0x70ba('0x154')]));return{'code':0xc8,'result':_0x70ba('0x158')};}else{logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x3cc12a[_0x70ba('0x154')]));this['channel'][_0x70ba('0xa3')](util[_0x70ba('0x2c')](_0x70ba('0x159'),this[_0x70ba('0x10')][_0x70ba('0x3d')],_0x3cc12a[_0x70ba('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x70ba('0x15')]['voicemail']=function(_0x11ab41){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')](_0x70ba('0x1c9'),_0x11ab41[_0x70ba('0x3a')]));var _0x131c12=this[_0x70ba('0x10')]['exec'](_0x70ba('0x1ca'),[_0x11ab41[_0x70ba('0x1cb')],_0x11ab41[_0x70ba('0x74')]]);if(_0x131c12['result']===-0x1){return _0x131c12;}return this[_0x70ba('0x10')][_0x70ba('0xa3')](util['format'](_0x70ba('0xc0'),_0x70ba('0x1ca'),_0x11ab41['mailbox']));};AGIVertices[_0x70ba('0x15')][_0x70ba('0x1cc')]=function(_0x14578f){logger[_0x70ba('0x30')](util[_0x70ba('0x2c')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x14578f[_0x70ba('0x3a')]));if(!this[_0x70ba('0x81')](_0x14578f['variable_id'])){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x14578f,_0x70ba('0x1ab'));}var _0x4ea88c=this[_0x70ba('0x12')][_0x70ba('0x6d')](this,_0x14578f[_0x70ba('0xd3')]);if(!_0x4ea88c){return this[_0x70ba('0x10')][_0x70ba('0x2f')](_0x14578f,_0x70ba('0xd4'));}var _0x550887=this['channel'][_0x70ba('0x12')](_0x4ea88c);return{'code':0xc8,'result':_0x550887[_0x70ba('0x9d')]?_0x550887[_0x70ba('0x9d')]:'-'};};String[_0x70ba('0x15')][_0x70ba('0x9c')]=function(_0x19ab44,_0xbb007c){return this['split'](_0x19ab44)[_0x70ba('0x1cd')](_0xbb007c);};module[_0x70ba('0x1ce')]=AGIVertices; \ No newline at end of file +var _0xd6d2=['sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','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','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','no\x20appid\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','playback','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','escape_digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','email','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','split','exports','util','lodash','odbc','randomstring','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','then','name','catch','getVoiceQueue','getSquareProject','getSquareOdbc','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','mailRpc','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','calleridname','context','extension','accountcode','file','createSquareMessage','createCmContact','isEmpty','callback_','isNil','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','callerid','agentLogout','internal','%s/%s@from-sip/n','agentLogin','shellCommand','exec','trim','googleCloudTTS','apiKey','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','method','timeout','number','includes','POST','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','%s.%s','saveRestApiResult','setVariable','extra','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','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','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','url','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s'];(function(_0x770f7e,_0x5e1274){var _0x51b20f=function(_0x5dc1d4){while(--_0x5dc1d4){_0x770f7e['push'](_0x770f7e['shift']());}};_0x51b20f(++_0x5e1274);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x1de7d0,_0x47d035){_0x1de7d0=_0x1de7d0-0x0;var _0x4e86e0=_0xd6d2[_0x1de7d0];return _0x4e86e0;};'use strict';var fs=require('fs');var util=require(_0x2d6d('0x0'));var _=require(_0x2d6d('0x1'));var sh=require('shelljs');var odbc=require(_0x2d6d('0x2'))();var rs=require(_0x2d6d('0x3'));var moment=require('moment');var Mustache=require(_0x2d6d('0x4'));var rp=require('request-promise');var logger=require(_0x2d6d('0x5'))(_0x2d6d('0x6'));var config=require(_0x2d6d('0x7'));var scripts=require('./scripts');var FILES_PATH=_0x2d6d('0x8');var recursiveMapAttributes=[_0x2d6d('0x9'),_0x2d6d('0xa')];var verticesWithRetry=[_0x2d6d('0xb'),_0x2d6d('0xc'),_0x2d6d('0xd')];var AGIVertices=function(_0x1cab9b,_0x34e259,_0x8e4be8){this[_0x2d6d('0xe')]=_0x1cab9b;this[_0x2d6d('0xf')]=_0x34e259;this['mailRpc']=_0x8e4be8;};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x11')]=function(_0x3ea447,_0x3cc2fa){this[_0x2d6d('0xf')]['getVariableById'](_0x3ea447)[_0x2d6d('0x12')](function(_0x171940){_0x3cc2fa(null,_0x171940?_0x171940[_0x2d6d('0x13')]:![]);})[_0x2d6d('0x14')](function(_0x5c4bf6){_0x3cc2fa(_0x5c4bf6);});};AGIVertices['prototype'][_0x2d6d('0x15')]=function(_0x156188,_0x46c909){this[_0x2d6d('0xf')]['getVoiceQueueById'](_0x156188)[_0x2d6d('0x12')](function(_0x40a6a9){_0x46c909(null,_0x40a6a9?_0x40a6a9['name']:![]);})['catch'](function(_0x370096){_0x46c909(_0x370096);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x16')]=function(_0x54c473,_0x385613){this['rpc']['getSquareProjectById'](_0x54c473)['then'](function(_0x1896fc){_0x385613(null,_0x1896fc?_0x1896fc[_0x2d6d('0x13')]:![]);})[_0x2d6d('0x14')](function(_0x3c527e){_0x385613(_0x3c527e);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x17')]=function(_0x389040,_0xa2c4a7){this[_0x2d6d('0xf')]['getSquareOdbcById'](_0x389040)[_0x2d6d('0x12')](function(_0x41d287){_0xa2c4a7(null,_0x41d287?_0x41d287['dsn']:![]);})[_0x2d6d('0x14')](function(_0x7226e6){_0xa2c4a7(_0x7226e6);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x18')]=function(_0x37b4c8,_0x59234a){this['rpc'][_0x2d6d('0x19')](_0x37b4c8)[_0x2d6d('0x12')](function(_0x3d5399){_0x59234a(null,_0x3d5399?_0x3d5399['name']:![]);})['catch'](function(_0x3ae8ad){_0x59234a(_0x3ae8ad);});};AGIVertices['prototype']['getTrunk']=function(_0x5763ce,_0x14f291){this[_0x2d6d('0xf')][_0x2d6d('0x1a')](_0x5763ce)[_0x2d6d('0x12')](function(_0x3e5a92){_0x14f291(null,_0x3e5a92?_0x3e5a92['name']:![]);})[_0x2d6d('0x14')](function(_0x1b4964){_0x14f291(_0x1b4964);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x1b')]=function(_0x33817d,_0x256d84){var _0x3e9f75=this;this[_0x2d6d('0xf')][_0x2d6d('0x1c')](_0x33817d)['then'](function(_0x1016e1){_0x256d84(null,_0x1016e1?_0x3e9f75[_0x2d6d('0x1d')](_0x1016e1[_0x2d6d('0x1e')]):![]);})[_0x2d6d('0x14')](function(_0x486963){_0x256d84(_0x486963);});};AGIVertices[_0x2d6d('0x10')]['getMailAccount']=function(_0x7ef067,_0x4a8e54){this['rpc'][_0x2d6d('0x1f')](_0x7ef067)['then'](function(_0x2fe536){_0x4a8e54(null,_0x2fe536?_0x2fe536:![]);})[_0x2d6d('0x14')](function(_0x479320){_0x4a8e54(_0x479320);});};AGIVertices[_0x2d6d('0x10')]['sendMailMessage']=function(_0xfbf3dc,_0x422153,_0xafd15a){this[_0x2d6d('0x20')][_0x2d6d('0x21')](_0xfbf3dc,_0x422153)[_0x2d6d('0x12')](function(){_0xafd15a(null);})[_0x2d6d('0x14')](function(_0x3450fc){_0xafd15a(_0x3450fc);});};AGIVertices['prototype'][_0x2d6d('0x22')]=function(_0x1fee00,_0x489f47){this[_0x2d6d('0xf')][_0x2d6d('0x23')](_0x1fee00)[_0x2d6d('0x12')](function(_0x3aed80){if(_0x3aed80){if(_0x3aed80[_0x2d6d('0x24')]){_0x489f47(null,[_0x3aed80['interval']]);}else{_0x489f47(null,_['map'](_0x3aed80['Intervals'],_0x2d6d('0x25')));}}else{_0x489f47(null,![]);}})[_0x2d6d('0x14')](function(_0x1043e2){_0x489f47(_0x1043e2);});};AGIVertices['prototype'][_0x2d6d('0x1d')]=function(_0x256f46){return util[_0x2d6d('0x26')](_0x2d6d('0x27'),FILES_PATH,_0x256f46);};AGIVertices['prototype'][_0x2d6d('0x28')]=function(_0x2bdc1b,_0x23cc39,_0x15f9af){odbc[_0x2d6d('0x29')](_0x2bdc1b,function(_0x3be16a){if(_0x3be16a){logger[_0x2d6d('0x2a')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x3be16a);_0x15f9af(_0x3be16a);}else{logger[_0x2d6d('0x2b')](_0x2d6d('0x2c'));odbc[_0x2d6d('0x2d')](_0x23cc39,function(_0x3d4723,_0x25be40){if(_0x3d4723){logger['info'](_0x2d6d('0x2e'),_0x23cc39);_0x15f9af(_0x3d4723);}else{logger[_0x2d6d('0x2b')](_0x2d6d('0x2f'),_0x23cc39);odbc[_0x2d6d('0x30')](function(_0x65d69c){if(_0x65d69c){logger[_0x2d6d('0x2a')](_0x2d6d('0x31'),_0x65d69c);}_0x15f9af(null,_0x25be40);});}});}});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x32')]=function(_0x38cce8,_0x3d2fea){this[_0x2d6d('0xf')][_0x2d6d('0x33')](_0x38cce8)[_0x2d6d('0x12')](function(_0x34fc23){_0x3d2fea(null,_0x34fc23?_0x34fc23:![]);})[_0x2d6d('0x14')](function(_0x452417){_0x3d2fea(_0x452417);});};AGIVertices['prototype'][_0x2d6d('0x34')]=function(_0x97b688,_0x4569a0){this[_0x2d6d('0xf')][_0x2d6d('0x34')](_0x97b688)['then'](function(_0x402578){_0x4569a0(null,_0x402578);})[_0x2d6d('0x14')](function(_0x40c11a){_0x4569a0(_0x40c11a);});};AGIVertices[_0x2d6d('0x10')]['createSquareDetailsReport']=function(_0x3b62b1,_0x7f76ad,_0x3a991a){this[_0x2d6d('0xf')][_0x2d6d('0x35')]({'uniqueid':this['channel'][_0x2d6d('0x36')],'node':_0x3b62b1[_0x2d6d('0x37')],'application':_0x3b62b1['agicommand'],'data':_0x7f76ad||null,'project_name':this[_0x2d6d('0xe')][_0x2d6d('0x38')],'callerid':this[_0x2d6d('0xe')]['callerid']})[_0x2d6d('0x12')](function(_0x1ddc3e){if(_0x3a991a){_0x3a991a(null,_0x1ddc3e);}})['catch'](function(_0x546f1f){if(_0x3a991a){_0x3a991a(_0x546f1f);}});};AGIVertices['prototype'][_0x2d6d('0x39')]=function(_0x2501ac,_0x5017c9,_0x38e2aa,_0x2d5193){this[_0x2d6d('0xf')][_0x2d6d('0x39')]({'uniqueid':this['channel'][_0x2d6d('0x36')],'callerid':this[_0x2d6d('0xe')]['callerid'],'calleridname':this[_0x2d6d('0xe')][_0x2d6d('0x3a')],'context':this[_0x2d6d('0xe')][_0x2d6d('0x3b')],'extension':this[_0x2d6d('0xe')][_0x2d6d('0x3c')],'priority':this[_0x2d6d('0xe')]['priority'],'accountcode':this[_0x2d6d('0xe')][_0x2d6d('0x3d')],'dnid':this[_0x2d6d('0xe')]['dnid'],'projectName':this['channel'][_0x2d6d('0x38')],'saveName':_0x5017c9,'filename':_0x2501ac[_0x2d6d('0x3e')]||_0x5017c9,'savePath':_0x38e2aa})[_0x2d6d('0x12')](function(_0x4e5203){_0x2d5193(null,_0x4e5203);})[_0x2d6d('0x14')](function(_0xff0b07){_0x2d5193(_0xff0b07);});};AGIVertices['prototype'][_0x2d6d('0x3f')]=function(_0x375a51,_0x158c8a,_0x1ec507,_0x20e807,_0x28385f){this[_0x2d6d('0xf')][_0x2d6d('0x3f')]({'uniqueid':this[_0x2d6d('0xe')][_0x2d6d('0x36')],'body':_0x375a51,'direction':_0x158c8a,'providerName':_0x1ec507,'providerResponse':_0x20e807})['then'](function(_0xd89457){if(_0x28385f){_0x28385f(null,_0xd89457);}})[_0x2d6d('0x14')](function(_0x2cb650){if(_0x28385f){_0x28385f(_0x2cb650);}});};AGIVertices['prototype'][_0x2d6d('0x40')]=function(_0x3ea69a,_0x3738b3){this[_0x2d6d('0xf')][_0x2d6d('0x40')]({'firstName':_[_0x2d6d('0x41')](_0x3ea69a[_0x2d6d('0x13')])||_['isNil'](_0x3ea69a[_0x2d6d('0x13')])?_0x2d6d('0x42')+Math['random']():_0x3ea69a[_0x2d6d('0x13')],'lastName':_[_0x2d6d('0x41')](_0x3ea69a['lastName'])||_[_0x2d6d('0x43')](_0x3ea69a[_0x2d6d('0x44')])?null:_0x3ea69a['lastName'],'phone':_0x3ea69a[_0x2d6d('0x45')],'ListId':_0x3ea69a[_0x2d6d('0x46')],'scheduledat':_0x3ea69a[_0x2d6d('0x47')],'callbackUniqueid':this[_0x2d6d('0xe')][_0x2d6d('0x36')],'tags':_0x2d6d('0x48'),'description':_0x2d6d('0x49')+_0x3ea69a['scheduledAt']['toString'](),'priority':_0x3ea69a[_0x2d6d('0x4a')]})['then'](function(_0x40c13f){_0x3738b3(null,_0x40c13f);})[_0x2d6d('0x14')](function(_0x311079){_0x3738b3(_0x311079);});};AGIVertices['prototype'][_0x2d6d('0x4b')]=function(_0x49cd6f,_0x2a231c){this[_0x2d6d('0xf')][_0x2d6d('0x4c')](_0x49cd6f)[_0x2d6d('0x12')](function(_0x30402e){_0x2a231c(null,_0x30402e?_0x30402e[_0x2d6d('0x13')]:![]);})[_0x2d6d('0x14')](function(_0xa84033){_0x2a231c(_0xa84033);});};AGIVertices['prototype'][_0x2d6d('0x4d')]=function(_0x2ccae2,_0x3832d7,_0x581669){var _0x5ede07={'role':'agent'};_0x5ede07[_0x2ccae2]=this[_0x2d6d('0xe')]['callerid'];this[_0x2d6d('0xf')][_0x2d6d('0x4d')](_0x5ede07,_0x3832d7,this[_0x2d6d('0xe')][_0x2d6d('0x36')])[_0x2d6d('0x12')](function(_0x46b437){_0x581669(null,_['isNil'](_0x46b437)?![]:!![]);})[_0x2d6d('0x14')](function(_0x389d3a){logger[_0x2d6d('0x2a')](_0x389d3a);_0x581669(null,![]);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x4e')]=function(_0x487b55,_0x4bbbeb){var _0x1c6b87={'role':_0x2d6d('0x4f')};_0x1c6b87[_0x487b55]=this[_0x2d6d('0xe')][_0x2d6d('0x50')];this['rpc'][_0x2d6d('0x4e')](_0x1c6b87)[_0x2d6d('0x12')](function(_0xb7ae2b){_0x4bbbeb(null,_['isNil'](_0xb7ae2b)?![]:!![]);})[_0x2d6d('0x14')](function(_0x37556f){logger[_0x2d6d('0x2a')](_0x37556f);_0x4bbbeb(null,![]);});};AGIVertices['prototype'][_0x2d6d('0x51')]=function(_0x50a729,_0x28057e){var _0x2cdb39={'role':_0x2d6d('0x4f')};_0x2cdb39[_0x50a729]=this[_0x2d6d('0xe')][_0x2d6d('0x50')];this[_0x2d6d('0xf')][_0x2d6d('0x51')](_0x2cdb39)[_0x2d6d('0x12')](function(_0x4b046a){_0x28057e(null,_[_0x2d6d('0x43')](_0x4b046a)?![]:!![]);})[_0x2d6d('0x14')](function(_0x115895){logger[_0x2d6d('0x2a')](_0x115895);_0x28057e(null,![]);});};AGIVertices[_0x2d6d('0x10')]['agentLogin']=function(_0x187499,_0x483fda){var _0x2ab4f2={'role':_0x2d6d('0x4f')};_0x2ab4f2[_0x187499]=this[_0x2d6d('0xe')][_0x2d6d('0x50')];var _0x200ef4=_0x187499!=_0x2d6d('0x52')?util[_0x2d6d('0x26')](_0x2d6d('0x53'),'LOCAL',this[_0x2d6d('0xe')][_0x2d6d('0x50')]):undefined;this[_0x2d6d('0xf')][_0x2d6d('0x54')](_0x2ab4f2,_0x200ef4)[_0x2d6d('0x12')](function(_0x5a58dc){_0x483fda(null,_['isNil'](_0x5a58dc)?![]:!![]);})['catch'](function(_0x3e80d8){logger[_0x2d6d('0x2a')](_0x3e80d8);_0x483fda(null,![]);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x55')]=function(_0x11618a,_0x145865){sh[_0x2d6d('0x56')](_[_0x2d6d('0x57')](_0x11618a),function(_0x30927f,_0x572d55){var _0x3f785f=_0x572d55['replace'](/(\r\n|\n|\r)/gm,'');_0x145865(null,_0x3f785f);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x58')]=function(_0x3ba0b7,_0x38cc43){scripts[_0x2d6d('0x58')](_0x3ba0b7[_0x2d6d('0x59')],_0x3ba0b7['google_cloud_tts_text_type']||_0x2d6d('0x5a'),_0x3ba0b7[_0x2d6d('0x5a')],_0x3ba0b7['languageCode']||_0x2d6d('0x5b'),_0x3ba0b7[_0x2d6d('0x5c')]||_0x2d6d('0x5d'),_0x3ba0b7[_0x2d6d('0x5e')]||_0x2d6d('0x5f'))['then'](function(_0x2772e7){_0x38cc43(null,_0x2772e7);})[_0x2d6d('0x14')](function(_0x395198){_0x38cc43(_0x395198);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x60')]=function(_0x233934,_0x29013a){scripts[_0x2d6d('0x60')](_0x233934['text'],_0x233934[_0x2d6d('0x61')]||'en',0x1)[_0x2d6d('0x12')](function(_0x406b43){_0x29013a(null,_0x406b43);})[_0x2d6d('0x14')](function(_0x5084e7){_0x29013a(_0x5084e7);});};AGIVertices[_0x2d6d('0x10')]['restAPI']=function(_0x4b67d8,_0x55e5d1){var _0x5c3218={'uri':_0x4b67d8['url'],'method':_0x4b67d8[_0x2d6d('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4b67d8[_0x2d6d('0x63')])===_0x2d6d('0x64')&&parseInt(_0x4b67d8[_0x2d6d('0x63')])>=0x1?parseInt(_0x4b67d8[_0x2d6d('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x2d6d('0x65')]([_0x2d6d('0x66'),'PUT'],_0x5c3218[_0x2d6d('0x62')][_0x2d6d('0x67')]())){try{_0x5c3218['body']=_0x4b67d8[_0x2d6d('0xa')]?JSON[_0x2d6d('0x68')](_0x4b67d8['rawBody']):{};}catch(_0x3b38d3){logger[_0x2d6d('0x2a')](_0x2d6d('0x69'),_0x3b38d3);}}try{_0x5c3218['headers']=_0x4b67d8[_0x2d6d('0x9')]?JSON[_0x2d6d('0x68')](_0x4b67d8[_0x2d6d('0x9')]):{};}catch(_0x287edc){logger[_0x2d6d('0x2a')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x287edc);}if(_0x4b67d8[_0x2d6d('0x6a')]){try{var _0x5de755=require(_0x4b67d8[_0x2d6d('0x6a')])[_0x2d6d('0x6b')](this,_0x5c3218);_0x5c3218[_0x2d6d('0x6c')]=Mustache['render'](_0x4b67d8['url'],_0x5de755,{},['$$','$$']);if(_0x5c3218[_0x2d6d('0x6d')]){_0x5c3218[_0x2d6d('0x6d')]=JSON['parse'](Mustache[_0x2d6d('0x6e')](JSON[_0x2d6d('0x6f')](_0x5c3218['headers']),_0x5de755,{},['$$','$$']));}if(_0x5c3218[_0x2d6d('0x70')]){_0x5c3218[_0x2d6d('0x70')]=JSON[_0x2d6d('0x68')](Mustache[_0x2d6d('0x6e')](JSON[_0x2d6d('0x6f')](_0x5c3218[_0x2d6d('0x70')]),_0x5de755,{},['$$','$$']));}}catch(_0x5c5bdf){logger[_0x2d6d('0x2a')](_0x2d6d('0x71'),_0x5c5bdf);}}rp(_0x5c3218)[_0x2d6d('0x12')](function(_0x27d38f){var _0x547272={'statusCode':_0x27d38f[_0x2d6d('0x72')]||0xc8,'statusMessage':_0x27d38f['statusMessage']||'OK','headers':_0x27d38f[_0x2d6d('0x6d')]||{},'body':_0x27d38f['body']||{}};_0x55e5d1(null,_0x547272);})[_0x2d6d('0x14')](function(_0x264d57){var _0x58e1a0={'statusCode':_0x264d57[_0x2d6d('0x72')]||0x1f4,'statusMessage':_0x264d57['message']||_0x2d6d('0x73'),'headers':_0x264d57['options']['headers']||{},'body':_0x264d57[_0x2d6d('0x74')][_0x2d6d('0x70')]||{}};_0x55e5d1(null,_0x58e1a0);});};AGIVertices['prototype'][_0x2d6d('0x75')]=function(_0x46113c,_0x47f382){scripts[_0x2d6d('0x75')](this[_0x2d6d('0xe')][_0x2d6d('0x36')],_0x46113c[_0x2d6d('0x76')],_0x46113c[_0x2d6d('0x5a')],_0x46113c['dialogflow_language']||'en')[_0x2d6d('0x12')](function(_0x28d9ad){_0x47f382(null,_0x28d9ad);})['catch'](function(_0x51ca9d){_0x47f382(_0x51ca9d);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x77')]=function(_0x4d596c,_0x53ef4e){scripts[_0x2d6d('0x77')](this[_0x2d6d('0xe')]['uniqueid'],_0x4d596c[_0x2d6d('0x78')],_0x4d596c[_0x2d6d('0x79')],_0x4d596c[_0x2d6d('0x7a')],_0x4d596c[_0x2d6d('0x5a')],_0x4d596c['dialogflowV2_language']||'en')['then'](function(_0x89311a){_0x53ef4e(null,_0x89311a);})[_0x2d6d('0x14')](function(_0x4383f0){_0x53ef4e(_0x4383f0);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x7b')]=function(_0x23a636,_0x449011){scripts[_0x2d6d('0x7b')](this['channel'],_0x23a636)[_0x2d6d('0x12')](function(_0x14e265){_0x449011(null,_0x14e265);})[_0x2d6d('0x14')](function(_0x121a9d){_0x449011(_0x121a9d);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x7c')]=function(_0x44418d,_0x2cb036){scripts[_0x2d6d('0x7c')](_0x44418d['key'],_0x44418d[_0x2d6d('0x5a')],_0x44418d[_0x2d6d('0x7d')]||_0x2d6d('0x5b'),_0x44418d[_0x2d6d('0x7e')])[_0x2d6d('0x12')](function(_0x53c820){_0x2cb036(null,_0x53c820);})[_0x2d6d('0x14')](function(_0x5c0320){_0x2cb036(_0x5c0320);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x7f')]=function(_0x3cb8b4,_0x4248a7,_0x3e6be0){scripts[_0x2d6d('0x7f')](_0x4248a7,_0x3cb8b4[_0x2d6d('0x76')],_0x3cb8b4[_0x2d6d('0x80')]||'en-US',this[_0x2d6d('0x81')](_0x3cb8b4[_0x2d6d('0x82')])?_0x3cb8b4['model']:undefined)[_0x2d6d('0x12')](function(_0xc07927){_0x3e6be0(null,_0xc07927);})[_0x2d6d('0x14')](function(_0x451a6e){_0x3e6be0(_0x451a6e);});};AGIVertices['prototype'][_0x2d6d('0x83')]=function(_0x3f18a0,_0x1f106b){scripts[_0x2d6d('0x83')](_0x3f18a0[_0x2d6d('0x84')],_0x3f18a0[_0x2d6d('0x85')],_0x3f18a0[_0x2d6d('0x86')],_0x3f18a0[_0x2d6d('0x87')]||'Amy',_0x3f18a0[_0x2d6d('0x5a')],_0x3f18a0[_0x2d6d('0x88')]||_0x2d6d('0x5a'))[_0x2d6d('0x12')](function(_0x37ee39){_0x1f106b(null,_0x37ee39);})['catch'](function(_0x3ba3fe){_0x1f106b(_0x3ba3fe);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x89')]=function(_0x463aba,_0x489692){scripts['awsLex'](this[_0x2d6d('0xe')][_0x2d6d('0x36')],_0x463aba[_0x2d6d('0x84')],_0x463aba[_0x2d6d('0x85')],_0x463aba[_0x2d6d('0x8a')],_0x463aba[_0x2d6d('0x5a')],_0x463aba[_0x2d6d('0x8b')])['then'](function(_0x31c43a){_0x489692(null,_0x31c43a);})['catch'](function(_0x48130a){_0x489692(_0x48130a);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x8c')]=function(_0x5c2c1d,_0x294d30,_0x377291){scripts[_0x2d6d('0x8c')](_0x294d30,_0x5c2c1d[_0x2d6d('0x76')],_0x5c2c1d[_0x2d6d('0x8d')]||_0x2d6d('0x5b'))[_0x2d6d('0x12')](function(_0x347f09){_0x377291(null,_0x347f09);})['catch'](function(_0x3d2288){_0x377291(_0x3d2288);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x8e')]=function(_0x575a69,_0x5bb45b,_0x3aaae8){scripts[_0x2d6d('0x8e')](_0x5bb45b,_0x575a69[_0x2d6d('0x8f')],_0x575a69[_0x2d6d('0x90')],_0x575a69[_0x2d6d('0x6c')])[_0x2d6d('0x12')](function(_0x4a264e){_0x3aaae8(null,_0x4a264e);})[_0x2d6d('0x14')](function(_0x28ac6c){_0x3aaae8(_0x28ac6c);});};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x91')]=function(_0x418f92){var _0x57505b=_[_0x2d6d('0x65')](verticesWithRetry,_0x418f92[_0x2d6d('0x92')])?_0x418f92:_[_0x2d6d('0x93')](_0x418f92);for(var _0xa1c10b in _0x57505b){if(_0x57505b[_0x2d6d('0x94')](_0xa1c10b)){if(_0x57505b[_0xa1c10b]&&_[_0x2d6d('0x95')](_0x57505b[_0xa1c10b])){if(_[_0x2d6d('0x65')](recursiveMapAttributes,_0xa1c10b)){_0x57505b[_0xa1c10b]=this[_0x2d6d('0x96')](_0x57505b[_0xa1c10b]);}else{_0x57505b[_0xa1c10b]=this[_0x2d6d('0x97')](_0x57505b[_0xa1c10b]);}}}}return _0x57505b;};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x98')]=function(_0x11c056){for(var _0x499dd2 in _0x11c056){if(_0x11c056[_0x2d6d('0x94')](_0x499dd2)){if(_[_0x2d6d('0x99')](_0x11c056[_0x499dd2])){this[_0x2d6d('0x98')](_0x11c056[_0x499dd2]);}else if(_[_0x2d6d('0x9a')](_0x11c056[_0x499dd2])){for(var _0x141f16=0x0;_0x141f16<_0x11c056[_0x499dd2][_0x2d6d('0x9b')];_0x141f16++){this[_0x2d6d('0x98')](_0x11c056[_0x499dd2][_0x141f16]);}}else if(_[_0x2d6d('0x95')](_0x11c056[_0x499dd2])){_0x11c056[_0x499dd2]=this['replaceAllVariables'](_0x11c056[_0x499dd2]);}}}};AGIVertices[_0x2d6d('0x10')]['saveRestApiResult']=function(_0x5d40c5,_0x5f4807){for(var _0x69ea6d in _0x5d40c5){if(_0x5d40c5[_0x2d6d('0x94')](_0x69ea6d)){if(_['isPlainObject'](_0x5d40c5[_0x69ea6d])){if(!_[_0x2d6d('0x41')](_0x5d40c5[_0x69ea6d])){this['saveRestApiResult'](_0x5d40c5[_0x69ea6d],util['format'](_0x2d6d('0x9c'),_0x5f4807,_0x69ea6d));}}else if(_['isArray'](_0x5d40c5[_0x69ea6d])){for(var _0xad8e11=0x0;_0xad8e11<_0x5d40c5[_0x69ea6d][_0x2d6d('0x9b')];_0xad8e11++){this[_0x2d6d('0x9d')](_0x5d40c5[_0x69ea6d][_0xad8e11],util[_0x2d6d('0x26')](_0x2d6d('0x9c'),_0x5f4807,_0x69ea6d+'['+_0xad8e11+']'));}}else{if(!_[_0x2d6d('0x43')](_0x5d40c5[_0x69ea6d])){this[_0x2d6d('0xe')][_0x2d6d('0x9e')](util['format'](_0x2d6d('0x9c'),_0x5f4807,_0x69ea6d),_0x5d40c5[_0x69ea6d]);}}}}};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x96')]=function(_0x3783bd){try{var _0x506e65=JSON[_0x2d6d('0x68')](_0x3783bd);this[_0x2d6d('0x98')](_0x506e65);return JSON[_0x2d6d('0x6f')](_0x506e65);}catch(_0x571c1a){return this[_0x2d6d('0x97')](_0x3783bd);}};AGIVertices[_0x2d6d('0x10')]['replaceAllVariables']=function(_0x9b13a5){var _0x52e08b=_0x9b13a5['split']('{');for(var _0x502f53=0x1;_0x502f53<_0x52e08b[_0x2d6d('0x9b')];_0x502f53+=0x1){var _0x10d5f7=_0x52e08b[_0x502f53]['split']('}');if(_0x10d5f7[_0x2d6d('0x9b')]>0x1){_0x9b13a5=_0x9b13a5['replaceAll']('{'+_0x10d5f7[0x0]+'}',this[_0x2d6d('0xe')][_0x2d6d('0x11')](_0x10d5f7[0x0])[_0x2d6d('0x9f')]||_0x10d5f7[0x0]);}}if(_0x52e08b[_0x2d6d('0x9b')]===0x1){return _0x9b13a5['toString']();}return this[_0x2d6d('0x97')](_0x9b13a5);};AGIVertices[_0x2d6d('0x10')]['getAndSetVariable']=function(_0x551532,_0x5d0c74){var _0x4ff3ce=this[_0x2d6d('0xe')][_0x2d6d('0x11')](_0x551532);if(_0x4ff3ce['result']===-0x1){return _0x4ff3ce;}logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5d0c74,_0x4ff3ce[_0x2d6d('0x9f')]));return this[_0x2d6d('0xe')][_0x2d6d('0x9e')](_0x5d0c74,_0x4ff3ce[_0x2d6d('0x9f')]);};AGIVertices['prototype'][_0x2d6d('0x81')]=function(_0x3496e1){return _0x3496e1&&_0x3496e1!=='0'&&_0x3496e1!=='-1'&&_0x3496e1!=='';};AGIVertices['prototype']['maxRetry']=function(_0x5d7fe1){this[_0x2d6d('0x35')][_0x2d6d('0x6b')](this,_0x5d7fe1,'-');_0x5d7fe1[_0x2d6d('0xa0')]=_0x5d7fe1[_0x2d6d('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x2d6d('0xa2')]=function(_0x2de260){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0xa3'),_0x2de260[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x2de260[_0x2d6d('0x5a')])){return this[_0x2d6d('0xe')]['noop'](_0x2d6d('0xa4'));}var _0x5d8c7d='\x22'+_0x2de260[_0x2d6d('0x5a')]+'\x22';if(this[_0x2d6d('0x81')](_0x2de260[_0x2d6d('0x74')])){_0x5d8c7d+=','+_0x2de260[_0x2d6d('0x74')];}var _0x3163b=this[_0x2d6d('0xe')]['exec'](_0x2d6d('0xa5'),_0x5d8c7d);if(_0x3163b[_0x2d6d('0xa6')]===-0x1){return _0x3163b;}return this['channel'][_0x2d6d('0xa7')](util['format'](_0x2d6d('0xa8'),_0x5d8c7d));};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0xa9')]=function(_0x48f200){logger[_0x2d6d('0x2b')](util['format'](_0x2d6d('0xaa'),_0x48f200[_0x2d6d('0x37')]));if(!this['isConfigured'](_0x48f200[_0x2d6d('0xab')])){return this[_0x2d6d('0xe')]['noop'](_0x2d6d('0xac'));}var _0x443e4a=_0x48f200[_0x2d6d('0xab')];if(this[_0x2d6d('0x81')](_0x48f200['options'])){_0x443e4a+=','+_0x48f200[_0x2d6d('0x74')];}var _0x4febed=this[_0x2d6d('0xe')][_0x2d6d('0x56')](_0x2d6d('0xad'),_0x443e4a);if(_0x4febed['result']===-0x1){return _0x4febed;}var _0x3223ec=this[_0x2d6d('0xae')](_0x2d6d('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x3223ec[_0x2d6d('0xa6')]===-0x1){return _0x3223ec;}var _0x786a32=this[_0x2d6d('0xae')](_0x2d6d('0xb0'),_0x2d6d('0xb1'));if(_0x786a32[_0x2d6d('0xa6')]===-0x1){return _0x786a32;}var _0x7ef50d=this[_0x2d6d('0xae')](_0x2d6d('0xb2'),_0x2d6d('0xb3'));if(_0x7ef50d[_0x2d6d('0xa6')]===-0x1){return _0x7ef50d;}return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0xb4'),_0x443e4a));};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x6')]=function(_0x5b4e0c){logger['info'](util[_0x2d6d('0x26')](_0x2d6d('0xb5'),_0x5b4e0c[_0x2d6d('0x37')]));return this[_0x2d6d('0xe')]['agi']([_0x5b4e0c['command'],_0x5b4e0c[_0x2d6d('0xb6')]]);};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0xb7')]=function(_0x46af0d){logger['info'](util['format'](_0x2d6d('0xb8'),_0x46af0d['label']));if(this[_0x2d6d('0x81')](_0x46af0d['timeout'])){logger['info'](util[_0x2d6d('0x26')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x46af0d[_0x2d6d('0x63')]));var _0x5e1d90=this['channel'][_0x2d6d('0xb9')](_0x46af0d[_0x2d6d('0x63')]);if(_0x5e1d90[_0x2d6d('0xa6')]===-0x1){return _0x5e1d90;}}return this[_0x2d6d('0xe')][_0x2d6d('0xb7')]();};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x48')]=function(_0x13e7f7){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0xba'),_0x13e7f7[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x13e7f7[_0x2d6d('0x46')])){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x13e7f7,'no\x20list\x20selected');}_0x13e7f7['scheduledAt']=moment();if(this['isConfigured'](_0x13e7f7[_0x2d6d('0xbb')])){_0x13e7f7[_0x2d6d('0x47')]=moment()['add'](_0x13e7f7['delay'],'minutes');}if(!this[_0x2d6d('0x81')](_0x13e7f7[_0x2d6d('0x4a')])){_0x13e7f7[_0x2d6d('0x4a')]=0x2;}this[_0x2d6d('0x40')][_0x2d6d('0x6b')](this,_0x13e7f7);return this['channel']['noop'](util[_0x2d6d('0x26')](_0x2d6d('0xbc'),_0x13e7f7[_0x2d6d('0x45')],_0x13e7f7[_0x2d6d('0x46')],_0x13e7f7[_0x2d6d('0x47')]));};AGIVertices['prototype'][_0x2d6d('0xbd')]=function(_0x1418c3){logger['info'](util[_0x2d6d('0x26')](_0x2d6d('0xbe'),_0x1418c3[_0x2d6d('0x37')]));var _0x403f48=this[_0x2d6d('0xe')][_0x2d6d('0x56')](_0x1418c3['application'],_0x1418c3[_0x2d6d('0x74')]);if(_0x403f48[_0x2d6d('0xa6')]===-0x1){return _0x403f48;}return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0xbf'),_0x1418c3['application'],_0x1418c3[_0x2d6d('0x74')]));};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0xc0')]=function(_0x55b943){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0xc1'),_0x55b943['label']));if(!this[_0x2d6d('0x81')](_0x55b943['text'])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')]('no\x20text\x20configured');}var _0x1673f1='\x22'+_0x55b943['text']+'\x22';if(this[_0x2d6d('0x81')](_0x55b943[_0x2d6d('0x74')])){_0x1673f1+=','+_0x55b943[_0x2d6d('0x74')];}var _0x41878e=this[_0x2d6d('0xe')][_0x2d6d('0x56')](_0x2d6d('0xa5'),_0x1673f1);if(_0x41878e[_0x2d6d('0xa6')]===-0x1){return _0x41878e;}return this[_0x2d6d('0xe')]['noop'](util[_0x2d6d('0x26')](_0x2d6d('0xa8'),_0x1673f1));};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0xc2')]=function(_0x1476ae){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0xc3'),_0x1476ae[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x1476ae[_0x2d6d('0x5a')])){return this['channel'][_0x2d6d('0xa7')](_0x2d6d('0xa4'));}var _0x39faff='\x22'+_0x1476ae[_0x2d6d('0x5a')]+'\x22';if(this[_0x2d6d('0x81')](_0x1476ae[_0x2d6d('0x74')])){_0x39faff+=','+_0x1476ae[_0x2d6d('0x74')];}var _0x27e57c=this['channel'][_0x2d6d('0x56')](_0x2d6d('0xa5'),_0x39faff);if(_0x27e57c[_0x2d6d('0xa6')]===-0x1){return _0x27e57c;}return this[_0x2d6d('0xe')]['noop'](util[_0x2d6d('0x26')](_0x2d6d('0xa8'),_0x39faff));};AGIVertices['prototype'][_0x2d6d('0xc4')]=function(_0x2a59c6){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x2a59c6[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x2a59c6['grammar'])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xac'));}var _0x4ce9c3=_0x2a59c6[_0x2d6d('0xab')];if(this[_0x2d6d('0x81')](_0x2a59c6['options'])){_0x4ce9c3+=','+_0x2a59c6[_0x2d6d('0x74')];}var _0x5c045d=this['channel'][_0x2d6d('0x56')](_0x2d6d('0xad'),_0x4ce9c3);if(_0x5c045d[_0x2d6d('0xa6')]===-0x1){return _0x5c045d;}var _0x2edd98=this[_0x2d6d('0xae')](_0x2d6d('0xaf'),'LUMENVOX_ASR_CONFIDENCE');if(_0x2edd98[_0x2d6d('0xa6')]===-0x1){return _0x2edd98;}var _0x5a6042=this[_0x2d6d('0xae')]('RECOG_INPUT()',_0x2d6d('0xc5'));if(_0x5a6042['result']===-0x1){return _0x5a6042;}var _0x43abef=this[_0x2d6d('0xae')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x43abef[_0x2d6d('0xa6')]===-0x1){return _0x43abef;}return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0xb4'),_0x4ce9c3));};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0xc6')]=function(_0x173d60){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0xc7'),_0x173d60[_0x2d6d('0x37')]));if(!this['isConfigured'](_0x173d60[_0x2d6d('0xab')])){return this[_0x2d6d('0xe')]['noop']('no\x20grammar\x20configured');}var _0x4d8019=_0x173d60[_0x2d6d('0xab')];if(this['isConfigured'](_0x173d60[_0x2d6d('0x74')])){_0x4d8019+=','+_0x173d60['options'];}var _0x44afc1=this[_0x2d6d('0xe')][_0x2d6d('0x56')]('MRCPRecog',_0x4d8019);if(_0x44afc1['result']===-0x1){return _0x44afc1;}var _0x24c1a4=this[_0x2d6d('0xae')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x24c1a4['result']===-0x1){return _0x24c1a4;}var _0x1cca4e=this[_0x2d6d('0xae')]('RECOG_INPUT()',_0x2d6d('0xc8'));if(_0x1cca4e[_0x2d6d('0xa6')]===-0x1){return _0x1cca4e;}var _0x59295c=this['getAndSetVariable']('RECOG_INSTANCE()',_0x2d6d('0xc9'));if(_0x59295c['result']===-0x1){return _0x59295c;}return this['channel'][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0xb4'),_0x4d8019));};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0xca')]=function(_0x49bb8f){logger[_0x2d6d('0x2b')](util['format'](_0x2d6d('0xcb'),_0x49bb8f[_0x2d6d('0x37')]));if(!this['isConfigured'](_0x49bb8f[_0x2d6d('0xcc')])){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x49bb8f,_0x2d6d('0xcd'));}var _0x52f00c=this[_0x2d6d('0x17')][_0x2d6d('0x6b')](this,_0x49bb8f['odbc_id']);if(!_0x52f00c){return this[_0x2d6d('0xe')]['error'](_0x49bb8f,_0x2d6d('0xce'));}if(!this[_0x2d6d('0x81')](_0x49bb8f[_0x2d6d('0x2d')])){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x49bb8f,_0x2d6d('0xcf'));}var _0x85ef32=_0x49bb8f['query'][_0x2d6d('0xd0')](/(\r\n|\n|\r)/gm,'\x20');this[_0x2d6d('0xe')]['noop'](util[_0x2d6d('0x26')](_0x2d6d('0xd1'),_0x85ef32));var _0x10d532=this['getQueryOdbc'][_0x2d6d('0x6b')](this,_0x52f00c,_0x85ef32);this[_0x2d6d('0x35')][_0x2d6d('0x6b')](this,_0x49bb8f,_0x85ef32);if(!this[_0x2d6d('0x81')](_0x49bb8f['variable_id'])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xd2'));}var _0x27e2ff=this[_0x2d6d('0x11')][_0x2d6d('0x6b')](this,_0x49bb8f[_0x2d6d('0xd3')]);if(!_0x27e2ff){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x49bb8f,_0x2d6d('0xd4'));}var _0x16a190=this;_0x10d532[_0x2d6d('0xd5')](function(_0x41e414,_0x23319b){Object[_0x2d6d('0xd6')](_0x41e414)[_0x2d6d('0xd5')](function(_0x4d988f){_0x16a190['channel'][_0x2d6d('0x9e')](util[_0x2d6d('0x26')](_0x2d6d('0xd7'),_0x27e2ff,_0x23319b,_0x4d988f),_0x41e414[_0x4d988f]);});});this[_0x2d6d('0xe')][_0x2d6d('0x9e')](util[_0x2d6d('0x26')]('%s_ROWS_COUNT',_0x27e2ff),_0x10d532[_0x2d6d('0x9b')]);return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0xd8'),_0x27e2ff));};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0xd9')]=function(_0x30c0fe){logger[_0x2d6d('0xda')](util['format'](_0x2d6d('0xdb'),_0x30c0fe[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x30c0fe[_0x2d6d('0xdc')])){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x30c0fe,_0x2d6d('0xdd'));}var _0x5cf1c6=this[_0x2d6d('0x18')][_0x2d6d('0x6b')](this,_0x30c0fe[_0x2d6d('0xdc')]);if(!_0x5cf1c6){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x30c0fe,_0x2d6d('0xde'));}var _0x116daa=this['channel'][_0x2d6d('0x56')](_0x2d6d('0xdf'),[util['format'](_0x2d6d('0xe0'),_0x5cf1c6),_0x30c0fe['timeout'],_0x30c0fe[_0x2d6d('0xe1')],_0x30c0fe[_0x2d6d('0xe2')]]);if(_0x116daa[_0x2d6d('0xa6')]===-0x1){return _0x116daa;}return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0xe3'),_0x2d6d('0xdf')));};AGIVertices['prototype'][_0x2d6d('0xe4')]=function(_0x14b6ef){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0xe5'),_0x14b6ef['label']));if(!this['isConfigured'](_0x14b6ef[_0x2d6d('0x76')])){return this['channel'][_0x2d6d('0xa7')](_0x2d6d('0xe6'));}if(!this[_0x2d6d('0x81')](_0x14b6ef['text'])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xa4'));}this[_0x2d6d('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x14b6ef);this[_0x2d6d('0x3f')](_0x14b6ef[_0x2d6d('0x5a')],'in','','');this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util['format'](_0x2d6d('0xe7'),_0x14b6ef[_0x2d6d('0x5a')]));var _0x2d8ef8=this['googleDialogflow'][_0x2d6d('0x6b')](this,_0x14b6ef);if(_0x2d8ef8){for(var _0x5b5fc0 in _0x2d8ef8){if(_0x2d8ef8[_0x2d6d('0x94')](_0x5b5fc0)){this['channel'][_0x2d6d('0x9e')](util['format'](_0x2d6d('0xe8'),_0x5b5fc0['toUpperCase']()),_0x2d8ef8[_0x5b5fc0]);}}this[_0x2d6d('0x3f')](_0x2d8ef8[_0x2d6d('0xe9')],_0x2d6d('0xea'),_0x2d6d('0xe4'),'');return this['channel'][_0x2d6d('0xa7')](util['format'](_0x2d6d('0xeb'),_0x2d8ef8[_0x2d6d('0xe9')]));}return this['channel'][_0x2d6d('0x2a')](_0x14b6ef,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0xec')]=function(_0x50ba53){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0xed'),_0x50ba53[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x50ba53[_0x2d6d('0x78')])){return this['channel'][_0x2d6d('0xa7')](_0x2d6d('0xee'));}if(!this[_0x2d6d('0x81')](_0x50ba53[_0x2d6d('0x79')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xef'));}if(!this[_0x2d6d('0x81')](_0x50ba53[_0x2d6d('0x7a')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xf0'));}if(!this['isConfigured'](_0x50ba53[_0x2d6d('0xf1')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xf2'));}if(!this[_0x2d6d('0x81')](_0x50ba53[_0x2d6d('0x5a')])){return this['channel'][_0x2d6d('0xa7')](_0x2d6d('0xa4'));}this[_0x2d6d('0xe')][_0x2d6d('0xf3')]=!![];this['createSquareDetailsReport'](_0x50ba53);this['createSquareMessage'](_0x50ba53['text'],'in','','');this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0xf4'),_0x50ba53[_0x2d6d('0x5a')]));var _0x3984cd=this[_0x2d6d('0x77')][_0x2d6d('0x6b')](this,_0x50ba53);if(_0x3984cd){for(var _0x19228b in _0x3984cd){if(_0x3984cd[_0x2d6d('0x94')](_0x19228b)){if(_0x19228b!==_0x2d6d('0xf5')){this[_0x2d6d('0xe')][_0x2d6d('0x9e')](util[_0x2d6d('0x26')](_0x2d6d('0xe8'),_0x19228b['toUpperCase']()),_0x3984cd[_0x19228b]);}}}this[_0x2d6d('0x3f')](_0x3984cd['speech'],_0x2d6d('0xea'),_0x2d6d('0xec'),_0x3984cd[_0x2d6d('0xf5')]);return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')]('DialogflowV2\x20Result\x20%s',_0x3984cd[_0x2d6d('0xe9')]));}return this[_0x2d6d('0xe')]['error'](_0x50ba53,_0x2d6d('0xf6'));};AGIVertices['prototype']['sesteknda']=function(_0xd3448d){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0xf7'),_0xd3448d[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0xd3448d[_0x2d6d('0xf8')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x2d6d('0x81')](_0xd3448d[_0x2d6d('0xf9')])){return this['channel']['noop'](_0x2d6d('0xfa'));}if(!this[_0x2d6d('0x81')](_0xd3448d[_0x2d6d('0xfb')])){return this[_0x2d6d('0xe')]['noop'](_0x2d6d('0xfc'));}if(!this[_0x2d6d('0x81')](_0xd3448d[_0x2d6d('0xfd')])){return this['channel'][_0x2d6d('0xa7')](_0x2d6d('0xa4'));}this[_0x2d6d('0xe')][_0x2d6d('0xf3')]=!![];this[_0x2d6d('0x35')](_0xd3448d);this['createSquareMessage'](_0xd3448d[_0x2d6d('0x5a')],'in','','');this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')]('Trying\x20SestekNDA:\x20%s',_0xd3448d[_0x2d6d('0x5a')]));var _0x31c3f3=this[_0x2d6d('0x7b')]['sync'](this,_0xd3448d);if(_0x31c3f3){for(var _0x2545ad in _0x31c3f3){if(_0x31c3f3['hasOwnProperty'](_0x2545ad)){this[_0x2d6d('0xe')][_0x2d6d('0x9e')](util[_0x2d6d('0x26')](_0x2d6d('0xfe'),_0x2545ad[_0x2d6d('0x67')]()),_0x31c3f3[_0x2545ad]);}}this[_0x2d6d('0x3f')](_0x31c3f3['speech'],_0x2d6d('0xea'),_0x2d6d('0xff'),'');if(_0x31c3f3[_0x2d6d('0x100')]){this['channel'][_0x2d6d('0xa7')](util['format'](_0x2d6d('0x101'),_0x31c3f3[_0x2d6d('0x100')]));var _0x3595b3=this[_0x2d6d('0xe')]['streamFile'](_0x31c3f3[_0x2d6d('0x100')]);try{fs['unlink'](_0x31c3f3[_0x2d6d('0x100')]+_0x2d6d('0x102'));}catch(_0x55c9a){logger[_0x2d6d('0x2a')](_0x55c9a);}return _0x3595b3;}else{return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x103'),_0x31c3f3['speech']));}}return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0xd3448d,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x104')]=function(_0x1f58ca){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x105'),_0x1f58ca['label']));return this[_0x2d6d('0xe')][_0x2d6d('0xa7')]('end');};AGIVertices['prototype']['ext_dial']=function(_0x22baa0){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x106'),_0x22baa0[_0x2d6d('0x37')]));var _0x3aba18='';if(_0x22baa0[_0x2d6d('0x107')]){if(!this[_0x2d6d('0x81')](_0x22baa0[_0x2d6d('0x107')])){return this['channel'][_0x2d6d('0x2a')](_0x22baa0,_0x2d6d('0x108'));}else{var _0x42c68d=parseInt(_0x22baa0[_0x2d6d('0x107')],0xa);if(isNaN(_0x42c68d)){_0x3aba18=_0x22baa0[_0x2d6d('0x107')];}else{_0x3aba18=this[_0x2d6d('0x109')][_0x2d6d('0x6b')](this,_0x22baa0[_0x2d6d('0x107')]);if(!_0x3aba18){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x22baa0,_0x2d6d('0x10a'));}}}}else if(_0x22baa0[_0x2d6d('0x10b')]){_0x3aba18=_0x22baa0[_0x2d6d('0x10b')];}else{return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x22baa0,_0x2d6d('0x108'));}var _0x187040=this['channel'][_0x2d6d('0x56')](_0x2d6d('0xdf'),[util['format'](_0x2d6d('0x10c'),_0x3aba18,_0x22baa0['phone']),_0x22baa0[_0x2d6d('0x63')],_0x22baa0[_0x2d6d('0xe1')],_0x22baa0[_0x2d6d('0xe2')]]);if(_0x187040[_0x2d6d('0xa6')]===-0x1){return _0x187040;}return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0xe3'),'DIAL'));};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x10d')]=function(_0x3fa77a){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x10e'),_0x3fa77a[_0x2d6d('0x37')]));return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0x10d'));};AGIVertices[_0x2d6d('0x10')]['getdigits']=function(_0x52cbae){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x10f'),_0x52cbae[_0x2d6d('0x37')]));if(_0x52cbae[_0x2d6d('0xa0')]===0x0){return this['maxRetry'](_0x52cbae);}_0x52cbae[_0x2d6d('0xa0')]-=0x1;if(!this[_0x2d6d('0x81')](_0x52cbae[_0x2d6d('0x110')])){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x52cbae,_0x2d6d('0x111'));}var _0x5e54e5=this['getSound'][_0x2d6d('0x6b')](this,_0x52cbae[_0x2d6d('0x110')]);if(!_0x5e54e5){return this['channel']['error'](_0x52cbae,_0x2d6d('0x112'));}if(!this[_0x2d6d('0x81')](_0x52cbae[_0x2d6d('0xd3')])){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3184d9=this[_0x2d6d('0xe')][_0x2d6d('0x113')](_0x5e54e5,_0x52cbae[_0x2d6d('0x114')],_0x52cbae['maxdigit']);var _0xa8286c=_0x3184d9[_0x2d6d('0xa6')]?_0x3184d9[_0x2d6d('0xa6')]['toString']():'';logger[_0x2d6d('0x2b')](_0x2d6d('0x115'),JSON[_0x2d6d('0x6f')](_0x3184d9));if(_0x3184d9[_0x2d6d('0xa6')]===-0x1){this[_0x2d6d('0x35')]['sync'](this,_0x52cbae,_0xa8286c);return _0x3184d9;}else if(_0x3184d9['extra']===_0x2d6d('0x63')){_0x3184d9[_0x2d6d('0xa6')]=_0xa8286c[_0x2d6d('0x9b')]>=parseInt(_0x52cbae[_0x2d6d('0x116')])?'x':'i';}else{_0x3184d9[_0x2d6d('0xa6')]=_0xa8286c['length']>=parseInt(_0x52cbae['mindigit'])&&_0xa8286c['length']<=parseInt(_0x52cbae['maxdigit'])?'x':'i';}var _0x3df010=this['getVariable'][_0x2d6d('0x6b')](this,_0x52cbae[_0x2d6d('0xd3')]);if(!_0x3df010){return this[_0x2d6d('0xe')]['error'](_0x52cbae,'no\x20variable\x20found');}this[_0x2d6d('0xe')][_0x2d6d('0x9e')](_0x3df010,_0xa8286c);if(this[_0x2d6d('0x81')](_0x52cbae[_0x2d6d('0x117')])){var _0x249809=parseInt(_0x52cbae[_0x2d6d('0x117')],0xa);var _0x17a226=rs[_0x2d6d('0x118')]({'charset':'*','length':_0x249809});var _0x598d2f=_0xa8286c['length'];if(_0x598d2f>0x0){if(_0x598d2f>_0x249809){this[_0x2d6d('0x35')][_0x2d6d('0x6b')](this,_0x52cbae,_0x52cbae['hiddendigitspos']===_0x2d6d('0x119')?_0x17a226+_0xa8286c[_0x2d6d('0x11a')](_0x249809):_0xa8286c[_0x2d6d('0x11a')](0x0,_0x598d2f-_0x249809)+_0x17a226);}else{this[_0x2d6d('0x35')][_0x2d6d('0x6b')](this,_0x52cbae,rs[_0x2d6d('0x118')]({'charset':'*','length':_0x598d2f}));}}else{this[_0x2d6d('0x35')][_0x2d6d('0x6b')](this,_0x52cbae,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x52cbae,_0xa8286c);}return _0x3184d9;};AGIVertices['prototype']['getsecretdigits']=function(_0x2a0d1a){logger['info'](util[_0x2d6d('0x26')](_0x2d6d('0x11b'),_0x2a0d1a['label']));return this['getdigits'](_0x2a0d1a);};AGIVertices['prototype'][_0x2d6d('0x11c')]=function(_0x178cb5){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x178cb5[_0x2d6d('0x37')]));this[_0x2d6d('0x35')][_0x2d6d('0x6b')](this,_0x178cb5,_0x178cb5[_0x2d6d('0x11d')]);return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util['format'](_0x2d6d('0x11e'),_0x178cb5[_0x2d6d('0x11d')]));};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x11f')]=function(_0x380f14){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x120'),_0x380f14[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x380f14[_0x2d6d('0x84')])||!this['isConfigured'](_0x380f14[_0x2d6d('0x85')])){return this['channel']['noop'](_0x2d6d('0x121'));}if(!this['isConfigured'](_0x380f14[_0x2d6d('0x5a')])){return this['channel'][_0x2d6d('0xa7')](_0x2d6d('0xa4'));}this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')]('Trying\x20aws\x20Polly\x20%s',_0x380f14[_0x2d6d('0x5a')]));var _0x4835fa=this[_0x2d6d('0x83')][_0x2d6d('0x6b')](this,_0x380f14);if(_0x4835fa){this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x122'),_0x4835fa));var _0x47b682=this['channel'][_0x2d6d('0x123')](_0x4835fa);try{fs[_0x2d6d('0x124')](_0x4835fa+_0x2d6d('0x102'));}catch(_0x5a0212){logger['error'](_0x5a0212);}return _0x47b682;}return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x380f14,_0x2d6d('0x125'));};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x126')]=function(_0x33eb36){logger[_0x2d6d('0x2b')](util['format'](_0x2d6d('0x127'),_0x33eb36['label']));if(!this[_0x2d6d('0x81')](_0x33eb36[_0x2d6d('0x84')])||!this[_0x2d6d('0x81')](_0x33eb36[_0x2d6d('0x85')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0x121'));}if(!this['isConfigured'](_0x33eb36['aws_bot_name'])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')]('no\x20bot\x20name\x20configured');}if(!this[_0x2d6d('0x81')](_0x33eb36['text'])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xa4'));}this[_0x2d6d('0xe')]['bot']=!![];this[_0x2d6d('0x35')](_0x33eb36);this[_0x2d6d('0x3f')](_0x33eb36[_0x2d6d('0x5a')],'in','','');this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x128'),_0x33eb36['text']));var _0x551ded=this[_0x2d6d('0x89')][_0x2d6d('0x6b')](this,_0x33eb36);if(_0x551ded){for(var _0x4767f6 in _0x551ded){if(_0x551ded[_0x2d6d('0x94')](_0x4767f6)&&_[_0x2d6d('0x95')](_0x551ded[_0x4767f6])){this[_0x2d6d('0xe')]['setVariable'](util['format'](_0x2d6d('0x129'),_0x4767f6[_0x2d6d('0x67')]()),_0x551ded[_0x4767f6]);}}if(_[_0x2d6d('0x43')](_0x551ded[_0x2d6d('0x12a')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0x12b'));}else{this[_0x2d6d('0x3f')](_0x551ded[_0x2d6d('0x12a')],_0x2d6d('0xea'),'amazonlex','');return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util['format'](_0x2d6d('0x12c'),_0x551ded[_0x2d6d('0x12a')]));}}return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x33eb36,_0x2d6d('0x12d'));};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x12e')]=function(_0x31e2d5){logger['info'](util['format'](_0x2d6d('0x12f'),_0x31e2d5['label'],_0x31e2d5[_0x2d6d('0x63')]));if(!this[_0x2d6d('0x81')](_0x31e2d5[_0x2d6d('0x76')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xe6'));}var _0x2c3f18=_0x2d6d('0x130');var _0x293a1e=util['format'](_0x2d6d('0x131'),FILES_PATH,rs[_0x2d6d('0x118')](0x4));var _0x2f98d4=util['format'](_0x2d6d('0x9c'),_0x293a1e,_0x2c3f18);var _0x803af6=!![];if(_0x31e2d5['beep']===_0x2d6d('0x132')){_0x803af6=![];}var _0x1ffaff=this[_0x2d6d('0xe')][_0x2d6d('0x133')](_0x293a1e,_0x2c3f18,_0x31e2d5[_0x2d6d('0x134')],_0x31e2d5[_0x2d6d('0x63')],undefined,_0x803af6);if(_0x1ffaff[_0x2d6d('0xa6')]!==-0x1){this[_0x2d6d('0xe')]['noop'](util[_0x2d6d('0x26')](_0x2d6d('0x135'),_0x2f98d4));var _0x2be8a3=this[_0x2d6d('0x8c')]['sync'](this,_0x31e2d5,_0x2f98d4);if(_0x2be8a3){for(var _0x172e71 in _0x2be8a3){if(_0x2be8a3[_0x2d6d('0x94')](_0x172e71)){this[_0x2d6d('0xe')][_0x2d6d('0x9e')](util[_0x2d6d('0x26')](_0x2d6d('0x136'),_0x172e71['toUpperCase']()),_0x2be8a3[_0x172e71]);}}return this['channel'][_0x2d6d('0xa7')](util[_0x2d6d('0x26')]('GoogleASR\x20Result\x20%s',JSON[_0x2d6d('0x6f')](_0x2be8a3)));}}return _0x1ffaff;};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x137')]=function(_0x4e5c20){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4e5c20[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x4e5c20[_0x2d6d('0x8f')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0x138'));}if(!this[_0x2d6d('0x81')](_0x4e5c20[_0x2d6d('0x90')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')]('no\x20appsecret\x20configured');}var _0x3788e7=_0x2d6d('0x130');var _0x339633=util[_0x2d6d('0x26')](_0x2d6d('0x131'),FILES_PATH,rs[_0x2d6d('0x118')](0x4));var _0x3182fe=util[_0x2d6d('0x26')](_0x2d6d('0x9c'),_0x339633,_0x3788e7);var _0xf91b=!![];if(_0x4e5c20[_0x2d6d('0x139')]===_0x2d6d('0x132')){_0xf91b=![];}var _0x4c0532=this['channel'][_0x2d6d('0x133')](_0x339633,_0x3788e7,_0x4e5c20[_0x2d6d('0x134')],_0x4e5c20['timeout'],undefined,_0xf91b);if(_0x4c0532[_0x2d6d('0xa6')]!==-0x1){this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x13a'),_0x3182fe));var _0x2c08b2=this['tildeASR'][_0x2d6d('0x6b')](this,_0x4e5c20,_0x3182fe);if(_0x2c08b2){for(var _0x16a39c in _0x2c08b2){if(_0x2c08b2[_0x2d6d('0x94')](_0x16a39c)){this[_0x2d6d('0xe')]['setVariable'](util['format'](_0x2d6d('0x13b'),_0x16a39c[_0x2d6d('0x67')]()),_0x2c08b2[_0x16a39c]);}}return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util['format'](_0x2d6d('0x13c'),JSON['stringify'](_0x2c08b2)));}}return _0x4c0532;};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x13d')]=function(_0x24d1e2){logger['info'](util[_0x2d6d('0x26')](_0x2d6d('0x13e'),_0x24d1e2['label']));return this['channel'][_0x2d6d('0x13f')](_0x24d1e2[_0x2d6d('0x3b')],_0x24d1e2[_0x2d6d('0x3c')],_0x24d1e2[_0x2d6d('0x140')]);};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x141')]=function(_0x14f312){logger['info'](util['format'](_0x2d6d('0x142'),_0x14f312[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x14f312[_0x2d6d('0x143')])){return this['channel'][_0x2d6d('0x2a')](_0x14f312,_0x2d6d('0x144'));}try{var _0x3bddbc=eval(_0x14f312[_0x2d6d('0x143')])?'true':_0x2d6d('0x145');this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x146'),_0x14f312['condition'],_0x3bddbc));return{'code':0xc8,'result':_0x3bddbc};}catch(_0x14974d){return{'code':0xc8,'result':_0x2d6d('0x145')};}};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x147')]=function(_0xed4e52){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x148'),_0xed4e52[_0x2d6d('0x37')]));if(!this['isConfigured'](_0xed4e52[_0x2d6d('0x149')])){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0xed4e52,_0x2d6d('0x14a'));}var _0x5416bb=this['getIntervals'][_0x2d6d('0x6b')](this,_0xed4e52[_0x2d6d('0x149')]);if(!_0x5416bb){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0xed4e52,_0x2d6d('0x14b'));}for(var _0x18c719=0x0;_0x18c719<_0x5416bb['length'];_0x18c719+=0x1){var _0xd8bf23=this[_0x2d6d('0xe')]['getVariable'](util[_0x2d6d('0x26')](_0x2d6d('0x14c'),_0x5416bb[_0x18c719]));if(_0xd8bf23[_0x2d6d('0xa6')]===-0x1){return _0xd8bf23;}logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x14d'),_0x5416bb[_0x18c719],_0xd8bf23[_0x2d6d('0x9f')]));if(_0xd8bf23[_0x2d6d('0x9f')]==='true'){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x14d'),_0x5416bb[_0x18c719],_0x2d6d('0x14e')));this[_0x2d6d('0xe')]['noop'](util[_0x2d6d('0x26')](_0x2d6d('0x14d'),_0x5416bb[_0x18c719],_0x2d6d('0x14e')));return{'code':0xc8,'result':_0x2d6d('0x14e')};}else{logger['info'](util['format'](_0x2d6d('0x14d'),_0x5416bb[_0x18c719],'false'));this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x14d'),_0x5416bb[_0x18c719],_0x2d6d('0x145')));}}return{'code':0xc8,'result':_0x2d6d('0x145')};};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x14f')]=function(_0x1b181a){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1b181a[_0x2d6d('0x37')]));return this['channel']['hangup']();};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x150')]=function(_0x50c8af){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x50c8af[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x50c8af[_0x2d6d('0x76')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')]('no\x20key\x20configured');}var _0x3198c2=_0x2d6d('0x130');var _0x12c3fc=util[_0x2d6d('0x26')](_0x2d6d('0x131'),FILES_PATH,rs[_0x2d6d('0x118')](0x4));var _0x2503a9=util[_0x2d6d('0x26')](_0x2d6d('0x9c'),_0x12c3fc,_0x3198c2);var _0x2696f1=!![];if(_0x50c8af[_0x2d6d('0x139')]===_0x2d6d('0x132')){_0x2696f1=![];}var _0x1b7a9c=this[_0x2d6d('0xe')]['recordFile'](_0x12c3fc,_0x3198c2,_0x50c8af[_0x2d6d('0x134')],_0x50c8af[_0x2d6d('0x63')],undefined,_0x2696f1);if(_0x1b7a9c['result']!==-0x1){this[_0x2d6d('0xe')]['noop'](util[_0x2d6d('0x26')](_0x2d6d('0x151'),_0x2503a9));var _0x5595bc=this[_0x2d6d('0x7f')][_0x2d6d('0x6b')](this,_0x50c8af,_0x2503a9);if(_0x5595bc){for(var _0x47aaae in _0x5595bc){if(_0x5595bc[_0x2d6d('0x94')](_0x47aaae)){this[_0x2d6d('0xe')][_0x2d6d('0x9e')](util['format'](_0x2d6d('0x152'),_0x47aaae[_0x2d6d('0x67')]()),_0x5595bc[_0x47aaae]);}}return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x153'),JSON[_0x2d6d('0x6f')](_0x5595bc)));}}return _0x1b7a9c;};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x154')]=function(_0x2bc0c9){logger['info'](util[_0x2d6d('0x26')](_0x2d6d('0x155'),_0x2bc0c9[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x2bc0c9[_0x2d6d('0x76')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xe6'));}if(!this['isConfigured'](_0x2bc0c9[_0x2d6d('0x5a')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xa4'));}this['channel'][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x156'),_0x2bc0c9[_0x2d6d('0x5a')]));var _0x3c611f=this[_0x2d6d('0x7c')][_0x2d6d('0x6b')](this,_0x2bc0c9);if(_0x3c611f){this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')]('ispeech\x20%s\x20file\x20created',_0x3c611f));var _0x2c009d=this['channel']['streamFile'](_0x3c611f,_0x2bc0c9[_0x2d6d('0x134')]);try{fs[_0x2d6d('0x124')](_0x3c611f+'.wav');}catch(_0x4067ea){logger[_0x2d6d('0x2a')](_0x4067ea);}return _0x2c009d;}return this[_0x2d6d('0xe')]['error'](_0x2bc0c9,_0x2d6d('0x157'));};AGIVertices['prototype'][_0x2d6d('0x158')]=function(_0x20d0fb){logger['info'](util[_0x2d6d('0x26')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x20d0fb[_0x2d6d('0x37')]));if(!this['isConfigured'](_0x20d0fb[_0x2d6d('0x159')])){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x20d0fb,_0x2d6d('0x15a'));}logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x2d6d('0xe')][_0x2d6d('0x50')],_0x20d0fb[_0x2d6d('0x159')]));var _0x49c59d=this[_0x2d6d('0x54')][_0x2d6d('0x6b')](this,_0x20d0fb[_0x2d6d('0x159')]);if(_0x49c59d){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2d6d('0xe')][_0x2d6d('0x50')],_0x20d0fb['findBy']));this[_0x2d6d('0xe')]['noop'](util[_0x2d6d('0x26')](_0x2d6d('0x15b'),this[_0x2d6d('0xe')][_0x2d6d('0x50')],_0x20d0fb['findBy']));return{'code':0xc8,'result':_0x2d6d('0x15c')};}else{logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x15d'),this['channel']['callerid'],_0x20d0fb[_0x2d6d('0x159')]));this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x15d'),this[_0x2d6d('0xe')][_0x2d6d('0x50')],_0x20d0fb[_0x2d6d('0x159')]));return{'code':0xc8,'result':_0x2d6d('0x15e')};}};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x15f')]=function(_0x13329e){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x13329e[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x13329e[_0x2d6d('0x159')])){return this['channel'][_0x2d6d('0x2a')](_0x13329e,_0x2d6d('0x15a'));}logger['info'](util[_0x2d6d('0x26')](_0x2d6d('0x160'),this[_0x2d6d('0xe')][_0x2d6d('0x50')],_0x13329e['findBy']));var _0x2afbf1=this[_0x2d6d('0x51')][_0x2d6d('0x6b')](this,_0x13329e[_0x2d6d('0x159')]);if(_0x2afbf1){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x15b'),this[_0x2d6d('0xe')]['callerid'],_0x13329e[_0x2d6d('0x159')]));this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x15b'),this[_0x2d6d('0xe')][_0x2d6d('0x50')],_0x13329e[_0x2d6d('0x159')]));return{'code':0xc8,'result':_0x2d6d('0x15c')};}else{logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x15d'),this[_0x2d6d('0xe')]['callerid'],_0x13329e[_0x2d6d('0x159')]));this['channel'][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x15d'),this[_0x2d6d('0xe')][_0x2d6d('0x50')],_0x13329e[_0x2d6d('0x159')]));return{'code':0xc8,'result':_0x2d6d('0x15e')};}};AGIVertices[_0x2d6d('0x10')]['math']=function(_0x9dac20){logger[_0x2d6d('0x2b')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x9dac20['label']));if(!this[_0x2d6d('0x81')](_0x9dac20['operation'])){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x9dac20,_0x2d6d('0x161'));}this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x162'),_0x9dac20['operation']));var _0x5c99ea=eval(_0x9dac20['operation']);if(!this[_0x2d6d('0x81')](_0x9dac20[_0x2d6d('0xd3')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xd2'));}var _0x50a95e=this[_0x2d6d('0x11')]['sync'](this,_0x9dac20[_0x2d6d('0xd3')]);if(!_0x50a95e){return this['channel'][_0x2d6d('0x2a')](_0x9dac20,'no\x20variable\x20found');}if(_['isArray'](_0x5c99ea)){var _0x4782f7=this;_0x5c99ea[_0x2d6d('0xd5')](function(_0x2729e5,_0x144153){_0x4782f7['channel'][_0x2d6d('0x9e')](util[_0x2d6d('0x26')](_0x2d6d('0x163'),_0x50a95e,_0x144153),_0x2729e5);});return this['channel'][_0x2d6d('0xa7')](util[_0x2d6d('0x26')]('variable\x20%s[key]\x20set',_0x50a95e));}else{return this['channel'][_0x2d6d('0x9e')](_0x50a95e,_0x5c99ea);}};AGIVertices[_0x2d6d('0x10')]['menu']=function(_0x1a57c5){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x164'),_0x1a57c5[_0x2d6d('0x37')]));if(_0x1a57c5['retry']===0x0){return this[_0x2d6d('0xa1')](_0x1a57c5);}_0x1a57c5[_0x2d6d('0xa0')]-=0x1;if(!this['isConfigured'](_0x1a57c5['file_id'])){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x1a57c5,_0x2d6d('0x111'));}var _0xbc28ef=this[_0x2d6d('0x1b')][_0x2d6d('0x6b')](this,_0x1a57c5[_0x2d6d('0x110')]);if(!_0xbc28ef){return this[_0x2d6d('0xe')]['error'](_0x1a57c5,_0x2d6d('0x112'));}var _0x4e2e37=this['channel'][_0x2d6d('0x113')](_0xbc28ef,_0x1a57c5[_0x2d6d('0x114')],_0x1a57c5[_0x2d6d('0x165')]);var _0x5f425f=_0x4e2e37[_0x2d6d('0xa6')];if(_0x4e2e37['result']===-0x1){this['createSquareDetailsReport'][_0x2d6d('0x6b')](this,_0x1a57c5,'-1');return _0x4e2e37;}else if(_0x4e2e37['extra']===_0x2d6d('0x63')){_0x4e2e37[_0x2d6d('0xa6')]=_0x4e2e37[_0x2d6d('0xa6')][_0x2d6d('0x9b')]>0x0?_0x4e2e37[_0x2d6d('0xa6')]:'t';}else if(_[_0x2d6d('0x41')](_0x4e2e37[_0x2d6d('0xa6')])){_0x4e2e37[_0x2d6d('0xa6')]='#';_0x5f425f='#';}if(!this[_0x2d6d('0x81')](_0x1a57c5[_0x2d6d('0xd3')])){this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xd2'));}else{var _0x2983e5=this[_0x2d6d('0x11')][_0x2d6d('0x6b')](this,_0x1a57c5[_0x2d6d('0xd3')]);if(!_0x2983e5){return this[_0x2d6d('0xe')]['error'](_0x1a57c5,_0x2d6d('0xd4'));}this[_0x2d6d('0xe')][_0x2d6d('0x9e')](_0x2983e5,_0x5f425f);}this['createSquareDetailsReport'][_0x2d6d('0x6b')](this,_0x1a57c5,_0x5f425f);return _0x4e2e37;};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0xa7')]=function(_0x2d56d4){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x166'),_0x2d56d4[_0x2d6d('0x37')]));return this[_0x2d6d('0xe')]['noop'](_0x2d56d4[_0x2d6d('0x167')]||_0x2d56d4[_0x2d6d('0x37')]);};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x168')]=function(_0xbfc3c5){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0xbfc3c5[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0xbfc3c5['findBy'])){return this[_0x2d6d('0xe')]['error'](_0xbfc3c5,'no\x20find\x20by\x20configured');}logger['info'](util[_0x2d6d('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x2d6d('0xe')]['callerid'],_0xbfc3c5['findBy']));var _0x916a5d=this[_0x2d6d('0x4b')]['sync'](this,_0xbfc3c5['pause_id']);var _0x54570f=this[_0x2d6d('0x4d')][_0x2d6d('0x6b')](this,_0xbfc3c5[_0x2d6d('0x159')],_0x916a5d);if(_0x54570f){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x15b'),this[_0x2d6d('0xe')]['callerid'],_0xbfc3c5[_0x2d6d('0x159')]));this[_0x2d6d('0xe')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x2d6d('0xe')][_0x2d6d('0x50')],_0xbfc3c5[_0x2d6d('0x159')]));return{'code':0xc8,'result':_0x2d6d('0x15c')};}else{logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x15d'),this[_0x2d6d('0xe')][_0x2d6d('0x50')],_0xbfc3c5[_0x2d6d('0x159')]));this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x15b'),this[_0x2d6d('0xe')]['callerid'],_0xbfc3c5[_0x2d6d('0x159')]));return{'code':0xc8,'result':_0x2d6d('0x15e')};}};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x169')]=function(_0x20c713){logger['info'](util[_0x2d6d('0x26')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x20c713['label']));if(!this[_0x2d6d('0x81')](_0x20c713[_0x2d6d('0x110')])){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x20c713,_0x2d6d('0x111'));}var _0x46545d=this[_0x2d6d('0x1b')]['sync'](this,_0x20c713[_0x2d6d('0x110')]);if(!_0x46545d){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x20c713,_0x2d6d('0x112'));}var _0x4906a6=this[_0x2d6d('0xe')][_0x2d6d('0x56')](_0x2d6d('0x16a'),[_0x46545d,_0x20c713['opts']]);if(_0x4906a6[_0x2d6d('0xa6')]===-0x1){return _0x4906a6;}return this[_0x2d6d('0xe')]['noop'](util['format'](_0x2d6d('0xbf'),'PLAYBACK',_0x46545d));};AGIVertices['prototype'][_0x2d6d('0x16b')]=function(_0x15e777){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x15e777[_0x2d6d('0x37')]));if(!this['isConfigured'](_0x15e777[_0x2d6d('0x16c')])){return this['channel']['error'](_0x15e777,'no\x20queue\x20selected');}var _0x24eaf5='';var _0x39bba8=parseInt(_0x15e777[_0x2d6d('0x16c')],0xa);if(isNaN(_0x39bba8)){_0x24eaf5=_0x15e777[_0x2d6d('0x16c')];}else{_0x24eaf5=this['getVoiceQueue'][_0x2d6d('0x6b')](this,_0x15e777['queue_id']);if(!_0x24eaf5){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x15e777,_0x2d6d('0x16d'));}}var _0x22c14c='';if(this[_0x2d6d('0x81')](_0x15e777[_0x2d6d('0x110')])){var _0x233fb8=this[_0x2d6d('0x1b')]['sync'](this,_0x15e777[_0x2d6d('0x110')]);if(_0x233fb8){_0x22c14c=_0x233fb8;}}this[_0x2d6d('0x35')][_0x2d6d('0x6b')](this,_0x15e777,_0x24eaf5);if(_0x15e777['opts']['indexOf']('x')<0x0){_0x15e777['opts']+='x';}if(_0x15e777[_0x2d6d('0xe1')][_0x2d6d('0x16e')]('X')<0x0){_0x15e777['opts']+='X';}this['channel'][_0x2d6d('0x9e')](_0x2d6d('0x16f'),_0x24eaf5?_0x24eaf5[_0x2d6d('0x170')]():'');var _0x1d246d=this[_0x2d6d('0xe')]['exec']('QUEUE',[_0x24eaf5,_0x15e777[_0x2d6d('0xe1')],_0x15e777[_0x2d6d('0xe2')],_0x22c14c,_0x15e777[_0x2d6d('0x63')],_0x15e777[_0x2d6d('0x6')],_0x15e777[_0x2d6d('0x171')],_0x15e777[_0x2d6d('0x172')],'',_0x15e777['position']]);if(_0x1d246d[_0x2d6d('0xa6')]===-0x1){return _0x1d246d;}return this['channel'][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0xbf'),_0x2d6d('0x173'),_0x24eaf5));};AGIVertices['prototype']['record']=function(_0x44c2b8){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x174'),_0x44c2b8[_0x2d6d('0x37')]));var _0x1ccf1e=_0x44c2b8[_0x2d6d('0x175')]||'wav';var _0x5d9112=util[_0x2d6d('0x26')](_0x2d6d('0x176'),this[_0x2d6d('0xe')][_0x2d6d('0x36')],rs[_0x2d6d('0x118')](0x5));var _0x557be0=util[_0x2d6d('0x26')](_0x2d6d('0x177'),FILES_PATH,_0x5d9112,_0x1ccf1e);var _0x3a3339=util[_0x2d6d('0x26')](_0x2d6d('0x131'),FILES_PATH,_0x5d9112);this[_0x2d6d('0x39')]['sync'](this,_0x44c2b8,_0x5d9112,_0x557be0);this[_0x2d6d('0xe')][_0x2d6d('0x9e')](_0x2d6d('0x178'),_0x5d9112);logger[_0x2d6d('0x2b')](_0x2d6d('0x179'),_0x3a3339,_0x1ccf1e,_0x44c2b8['escape_digits'],_0x44c2b8[_0x2d6d('0x63')]);return this[_0x2d6d('0xe')]['recordFile'](_0x3a3339,_0x1ccf1e,_0x44c2b8['escape_digits'],_0x44c2b8[_0x2d6d('0x63')],undefined,!![]);};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x17a')]=function(_0x21f5ec){logger[_0x2d6d('0x2b')](util['format'](_0x2d6d('0x17b'),_0x21f5ec[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x21f5ec[_0x2d6d('0xe2')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0x17c'));}var _0x299772=this[_0x2d6d('0x17d')][_0x2d6d('0x6b')](this,_0x21f5ec);logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('Response:',util[_0x2d6d('0x17e')](_0x299772,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x21f5ec[_0x2d6d('0xd3')])){return this['channel'][_0x2d6d('0xa7')](_0x2d6d('0x17f'));}var _0x36ac3a=this[_0x2d6d('0x11')][_0x2d6d('0x6b')](this,_0x21f5ec[_0x2d6d('0xd3')]);if(!_0x36ac3a){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x21f5ec,_0x2d6d('0xd4'));}this[_0x2d6d('0xe')]['setVariable'](util['format'](_0x2d6d('0x180'),_0x36ac3a),_0x299772[_0x2d6d('0x72')]?_0x299772['statusCode']:_0x2d6d('0x181'));this[_0x2d6d('0xe')][_0x2d6d('0x9e')](util[_0x2d6d('0x26')]('%s_STATUS_MESSAGE',_0x36ac3a),_0x299772[_0x2d6d('0x182')]?_0x299772['statusMessage']:'OK');if(_0x299772[_0x2d6d('0x70')]){try{this[_0x2d6d('0x9d')](_0x299772[_0x2d6d('0x70')],_0x36ac3a);}catch(_0x20a6ad){logger[_0x2d6d('0x2a')](util['format'](_0x2d6d('0x183'),_0x36ac3a));}}return this['channel'][_0x2d6d('0xa7')](util['format'](_0x2d6d('0xd8'),_0x36ac3a));};AGIVertices['prototype'][_0x2d6d('0x184')]=function(_0x2fdecf){logger[_0x2d6d('0x2b')](util['format'](_0x2d6d('0x185'),_0x2fdecf['label']));return this[_0x2d6d('0xe')][_0x2d6d('0x186')](_0x2fdecf['digits'][_0x2d6d('0xd0')](/\s+/g,''),_0x2fdecf[_0x2d6d('0x187')]);};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x188')]=function(_0x5177eb){logger[_0x2d6d('0x2b')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x5177eb[_0x2d6d('0x37')]));return this[_0x2d6d('0xe')][_0x2d6d('0x189')](_0x5177eb[_0x2d6d('0x64')]['replace'](/\s+/g,''),_0x5177eb[_0x2d6d('0x187')]);};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x18a')]=function(_0x478b46){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x18b'),_0x478b46[_0x2d6d('0x37')]));return this[_0x2d6d('0xe')][_0x2d6d('0x18c')](_0x478b46[_0x2d6d('0x5a')],_0x478b46['escape_digits']);};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x18d')]=function(_0x54c589){logger['info'](util[_0x2d6d('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x54c589['label']));if(!this[_0x2d6d('0x81')](_0x54c589[_0x2d6d('0x18e')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0x18f'));}var _0x1e8cb9=this[_0x2d6d('0x190')]['sync'](this,_0x54c589[_0x2d6d('0x18e')]);if(!_0x1e8cb9||!_0x1e8cb9[_0x2d6d('0x191')]){return this[_0x2d6d('0xe')]['error'](_0x54c589,_0x2d6d('0x192'));}var _0x169b1a={'from':util[_0x2d6d('0x26')]('\x22%s\x22\x20<%s>',_0x1e8cb9[_0x2d6d('0x13')],_0x1e8cb9[_0x2d6d('0x193')]||_0x1e8cb9['Smtp']['user']),'to':_0x54c589['to']||'','cc':_0x54c589['cc']||'','bcc':_0x54c589[_0x2d6d('0x194')]||'','subject':_0x54c589[_0x2d6d('0x195')],'html':_0x54c589[_0x2d6d('0x5a')],'text':_0x54c589[_0x2d6d('0x5a')]};if(this['isConfigured'](_0x54c589[_0x2d6d('0x196')])){}logger[_0x2d6d('0xda')](_0x2d6d('0x197'),JSON[_0x2d6d('0x6f')](_0x169b1a));this[_0x2d6d('0x35')][_0x2d6d('0x6b')](this,_0x54c589,_0x54c589[_0x2d6d('0x18e')]);this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x198'),_0x1e8cb9[_0x2d6d('0x13')]));this['sendMailMessage'][_0x2d6d('0x6b')](this,_0x1e8cb9[_0x2d6d('0x199')],_0x169b1a);return this[_0x2d6d('0xe')][_0x2d6d('0xa7')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x19a')]=function(_0x3ff96c){logger[_0x2d6d('0x2b')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x3ff96c[_0x2d6d('0x37')]));return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0x19b'));};AGIVertices['prototype'][_0x2d6d('0x19c')]=function(_0x2ba4e7){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2ba4e7[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x2ba4e7[_0x2d6d('0x19d')])){return this[_0x2d6d('0xe')]['noop'](_0x2d6d('0x19e'));}var _0x2e59e9=this[_0x2d6d('0x32')][_0x2d6d('0x6b')](this,_0x2ba4e7[_0x2d6d('0x19d')]);if(!_0x2e59e9){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x2ba4e7,_0x2d6d('0x19f'));}var _0x17326f={'body':_0x2ba4e7[_0x2d6d('0x1a0')],'phone':_0x2ba4e7['to']||'','SmsAccountId':_0x2e59e9['id']};logger[_0x2d6d('0xda')](_0x2d6d('0x1a1'),JSON[_0x2d6d('0x6f')](_0x17326f));this[_0x2d6d('0x35')][_0x2d6d('0x6b')](this,_0x2ba4e7,_0x2ba4e7[_0x2d6d('0x19d')]);this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x1a2'),_0x2e59e9[_0x2d6d('0x13')]));this[_0x2d6d('0x34')][_0x2d6d('0x6b')](this,_0x17326f);return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0x1a3'));};AGIVertices[_0x2d6d('0x10')]['set']=function(_0x1f689e){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x1a4'),_0x1f689e[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x1f689e['variable_id'])){return this[_0x2d6d('0xe')]['error'](_0x1f689e,'no\x20variable\x20selected');}var _0x236a3e=this[_0x2d6d('0x11')][_0x2d6d('0x6b')](this,_0x1f689e[_0x2d6d('0xd3')]);if(!_0x236a3e){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x1f689e,_0x2d6d('0xd4'));}return this[_0x2d6d('0xe')][_0x2d6d('0x9e')](_0x236a3e,_0x1f689e[_0x2d6d('0x1a5')]);};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x1a6')]=function(_0x3527ed){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x1a7'),_0x3527ed[_0x2d6d('0x37')]));this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0x1a8'));var _0x132184=this[_0x2d6d('0xe')][_0x2d6d('0x11')](_0x2d6d('0x1a9'));if(!_[_0x2d6d('0x41')](_0x132184[_0x2d6d('0x9f')])){this[_0x2d6d('0xe')][_0x2d6d('0x36')]=_0x132184['extra'];}if(_0x3527ed[_0x2d6d('0xb7')]===_0x2d6d('0x1aa')){this['channel'][_0x2d6d('0xa7')](_0x2d6d('0x1ab'));return this[_0x2d6d('0xe')][_0x2d6d('0xb7')]();}return this[_0x2d6d('0xe')]['noop'](_0x2d6d('0x1ac'));};AGIVertices[_0x2d6d('0x10')]['subproject']=function(_0x1be8c7){logger[_0x2d6d('0x2b')](util['format'](_0x2d6d('0x1ad'),_0x1be8c7[_0x2d6d('0x37')]));if(!this['isConfigured'](_0x1be8c7[_0x2d6d('0x1ae')])){return this[_0x2d6d('0xe')]['error'](_0x1be8c7,_0x2d6d('0x1af'));}var _0x44908e=this[_0x2d6d('0x16')]['sync'](this,_0x1be8c7[_0x2d6d('0x1ae')]);if(!this[_0x2d6d('0x81')](_0x44908e)){return this['channel'][_0x2d6d('0x2a')](_0x1be8c7,util[_0x2d6d('0x26')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x1be8c7[_0x2d6d('0x1ae')]));}if(_0x44908e===this[_0x2d6d('0xe')][_0x2d6d('0x38')]){return this[_0x2d6d('0xe')]['error'](_0x1be8c7,_0x2d6d('0x1b0'));}this['createSquareDetailsReport'][_0x2d6d('0x6b')](this,_0x1be8c7,_0x44908e);var _0x183c30=this[_0x2d6d('0xe')][_0x2d6d('0x56')](_0x2d6d('0x1b1'),util['format'](_0x2d6d('0x1b2'),config['agi']['host']||_0x2d6d('0x1b3'),_0x44908e,this[_0x2d6d('0xe')][_0x2d6d('0x38')]));if(_0x183c30[_0x2d6d('0xa6')]===-0x1){return _0x183c30;}return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')]('Executed\x20command\x20%s\x20%s','AGI',_0x44908e));};AGIVertices[_0x2d6d('0x10')]['system']=function(_0x64e054){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x64e054['label']));var _0x4cec52=this[_0x2d6d('0x55')][_0x2d6d('0x6b')](this,_0x64e054['command']);this[_0x2d6d('0x35')][_0x2d6d('0x6b')](this,_0x64e054,_0x64e054[_0x2d6d('0x1b4')]);if(this['isConfigured'](_0x64e054[_0x2d6d('0xd3')])){var _0x236246=this['getVariable']['sync'](this,_0x64e054[_0x2d6d('0xd3')]);if(_0x236246){this['channel'][_0x2d6d('0x9e')](_0x236246,_0x4cec52);return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x1b5'),_0x64e054[_0x2d6d('0x1b4')],_0x236246));}}return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x64e054[_0x2d6d('0x1b4')]));};AGIVertices['prototype'][_0x2d6d('0x1b6')]=function(_0x544fbf){logger['info'](util[_0x2d6d('0x26')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x544fbf[_0x2d6d('0x37')]));_0x544fbf[_0x2d6d('0x5a')]=_0x544fbf[_0x2d6d('0x5a')][_0x2d6d('0xd0')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x544fbf[_0x2d6d('0x59')])){return this['channel']['noop'](_0x2d6d('0x1b7'));}if(!this['isConfigured'](_0x544fbf[_0x2d6d('0x5a')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xa4'));}this[_0x2d6d('0xe')]['noop'](util[_0x2d6d('0x26')](_0x2d6d('0x1b8'),_0x544fbf[_0x2d6d('0x5a')]));var _0x459564=this[_0x2d6d('0x58')][_0x2d6d('0x6b')](this,_0x544fbf);if(_0x459564){this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x1b9'),_0x459564));var _0x5debf5=this['channel']['streamFile'](_0x459564);try{fs[_0x2d6d('0x124')](_0x459564+_0x2d6d('0x102'));}catch(_0x3852c1){logger['error'](_0x3852c1);}return _0x5debf5;}return this[_0x2d6d('0xe')]['error'](_0x544fbf,_0x2d6d('0x1ba'));};AGIVertices['prototype']['tts']=function(_0x37a117){logger[_0x2d6d('0x2b')](util['format'](_0x2d6d('0x1bb'),_0x37a117[_0x2d6d('0x37')]));_0x37a117[_0x2d6d('0x5a')]=_0x37a117[_0x2d6d('0x5a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2d6d('0x81')](_0x37a117[_0x2d6d('0x5a')])){return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](_0x2d6d('0xa4'));}this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')](_0x2d6d('0x1bc'),_0x37a117[_0x2d6d('0x5a')]));var _0x259cdc=this['googleTTS'][_0x2d6d('0x6b')](this,_0x37a117);if(_0x259cdc){this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util['format'](_0x2d6d('0x1bd'),_0x259cdc));var _0x558bd7=this[_0x2d6d('0xe')][_0x2d6d('0x123')](_0x259cdc);try{fs['unlink'](_0x259cdc+_0x2d6d('0x102'));}catch(_0x40ddd7){logger[_0x2d6d('0x2a')](_0x40ddd7);}return _0x558bd7;}return this['channel'][_0x2d6d('0x2a')](_0x37a117,_0x2d6d('0x1be'));};AGIVertices['prototype'][_0x2d6d('0x1bf')]=function(_0x3d1747){logger[_0x2d6d('0x2b')](util['format'](_0x2d6d('0x1c0'),_0x3d1747[_0x2d6d('0x37')]));if(!this[_0x2d6d('0x81')](_0x3d1747[_0x2d6d('0x159')])){return this['channel'][_0x2d6d('0x2a')](_0x3d1747,_0x2d6d('0x15a'));}logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x160'),this[_0x2d6d('0xe')][_0x2d6d('0x50')],_0x3d1747['findBy']));var _0x4e0daa=this[_0x2d6d('0x4e')]['sync'](this,_0x3d1747[_0x2d6d('0x159')]);if(_0x4e0daa){logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x15b'),this[_0x2d6d('0xe')][_0x2d6d('0x50')],_0x3d1747['findBy']));this[_0x2d6d('0xe')]['noop'](util[_0x2d6d('0x26')](_0x2d6d('0x15b'),this[_0x2d6d('0xe')][_0x2d6d('0x50')],_0x3d1747[_0x2d6d('0x159')]));return{'code':0xc8,'result':_0x2d6d('0x15c')};}else{logger[_0x2d6d('0x2b')](util[_0x2d6d('0x26')](_0x2d6d('0x15d'),this['channel']['callerid'],_0x3d1747['findBy']));this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2d6d('0xe')]['callerid'],_0x3d1747[_0x2d6d('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2d6d('0x10')]['voicemail']=function(_0x42d4ad){logger['info'](util['format'](_0x2d6d('0x1c1'),_0x42d4ad['label']));var _0x416bf5=this[_0x2d6d('0xe')]['exec'](_0x2d6d('0x1c2'),[_0x42d4ad[_0x2d6d('0x1c3')],_0x42d4ad[_0x2d6d('0x74')]]);if(_0x416bf5[_0x2d6d('0xa6')]===-0x1){return _0x416bf5;}return this[_0x2d6d('0xe')][_0x2d6d('0xa7')](util[_0x2d6d('0x26')]('Executed\x20command\x20%s\x20%s',_0x2d6d('0x1c2'),_0x42d4ad[_0x2d6d('0x1c3')]));};AGIVertices[_0x2d6d('0x10')][_0x2d6d('0x1c4')]=function(_0x555893){logger[_0x2d6d('0x2b')](util['format'](_0x2d6d('0x1c5'),_0x555893[_0x2d6d('0x37')]));if(!this['isConfigured'](_0x555893[_0x2d6d('0xd3')])){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x555893,_0x2d6d('0x1c6'));}var _0x1f684e=this[_0x2d6d('0x11')][_0x2d6d('0x6b')](this,_0x555893[_0x2d6d('0xd3')]);if(!_0x1f684e){return this[_0x2d6d('0xe')][_0x2d6d('0x2a')](_0x555893,'no\x20variable\x20found');}var _0x4954c3=this['channel'][_0x2d6d('0x11')](_0x1f684e);return{'code':0xc8,'result':_0x4954c3[_0x2d6d('0x9f')]?_0x4954c3[_0x2d6d('0x9f')]:'-'};};String[_0x2d6d('0x10')][_0x2d6d('0x1c7')]=function(_0x126750,_0x50ec4d){return this[_0x2d6d('0x1c8')](_0x126750)['join'](_0x50ec4d);};module[_0x2d6d('0x1c9')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 40b5e8b..edb43ac 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 _0xf188=['syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','error','[ACW][START]\x20%s','message','pauseType','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','syncHangupRequest','bind','hangup','syncHangup','blindtransfer'];(function(_0x30bf8e,_0x145794){var _0x2bf17e=function(_0x447ba1){while(--_0x447ba1){_0x30bf8e['push'](_0x30bf8e['shift']());}};_0x2bf17e(++_0x145794);}(_0xf188,0x187));var _0x8f18=function(_0xcf7ca,_0x54e647){_0xcf7ca=_0xcf7ca-0x0;var _0x259582=_0xf188[_0xcf7ca];return _0x259582;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require('../ami');var logger=require(_0x8f18('0x0'))('acw');var RpcUser=require(_0x8f18('0x1'));var RpcVoiceAgentReport=require(_0x8f18('0x2'));function Acw(_0x30da46){this['voiceQueues']=_0x30da46[_0x8f18('0x3')];this[_0x8f18('0x4')]=_0x30da46[_0x8f18('0x4')];this['timers']=_0x30da46[_0x8f18('0x5')];this[_0x8f18('0x6')]={};ami['on'](_0x8f18('0x7'),this[_0x8f18('0x8')]['bind'](this));ami['on']('hanguprequest',this[_0x8f18('0x9')][_0x8f18('0xa')](this));ami['on'](_0x8f18('0xb'),this[_0x8f18('0xc')][_0x8f18('0xa')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x8f18('0xa')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x8f18('0xd'),this[_0x8f18('0xe')][_0x8f18('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0x8f18('0xf')][_0x8f18('0xa')](this));}function getDiff(_0x3ecd55){var _0x436c4e=moment()[_0x8f18('0x10')](0x0);var _0x1d14b5=moment(_0x3ecd55)[_0x8f18('0x10')](0x0);return _0x436c4e[_0x8f18('0x11')](_0x1d14b5,_0x8f18('0x12'));}Acw[_0x8f18('0x13')][_0x8f18('0x14')]=function(_0x22154a,_0x246e27){var _0xafadb7=this;var _0x439c81=getDiff(_0xafadb7['timers'][_0x22154a]['lastPauseAt']);clearTimeout(_0xafadb7[_0x8f18('0x5')][_0x22154a][_0x8f18('0x15')]);_0xafadb7[_0x8f18('0x5')][_0x22154a][_0x8f18('0x15')]=![];return RpcVoiceAgentReport[_0x8f18('0x16')]({'acwtime':_0x439c81},_0xafadb7[_0x8f18('0x5')][_0x22154a][_0x8f18('0x17')],_0x22154a)['then'](function(_0x2c4cd9){logger[_0x8f18('0x18')](_0x8f18('0x19'),_0x246e27,_0x439c81,_0x2c4cd9);})['catch'](function(_0x4082c5){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x246e27,_0x4082c5);})['finally'](function(){delete _0xafadb7[_0x8f18('0x5')][_0x22154a];});};Acw[_0x8f18('0x13')][_0x8f18('0x1a')]=function(_0x5795eb){try{var _0x4194c0=this;var _0xa4515=this[_0x8f18('0x6')][_0x5795eb][_0x8f18('0x1b')];var _0x4ea8ee=this[_0x8f18('0x6')][_0x5795eb][_0x8f18('0x1c')];var _0x34bf99=this[_0x8f18('0x3')][_0x4ea8ee];var _0x29e788=![];var _0x359fad=_0x8f18('0x1d');if(_0x34bf99[_0x8f18('0x1e')]&&_0x34bf99[_0x8f18('0x1f')]['name']){_0x29e788=!![];_0x359fad=_0x34bf99[_0x8f18('0x1f')][_0x8f18('0x20')];}if(!_0x4194c0[_0x8f18('0x4')][_0xa4515]){return Promise[_0x8f18('0x21')]();}return RpcUser[_0x8f18('0x22')](_0x4194c0['agents'][_0xa4515]['id'])[_0x8f18('0x23')](function(_0x2537a8){if(!_0x2537a8||_0x2537a8[_0x8f18('0x24')]){logger[_0x8f18('0x18')](_0x8f18('0x25'),_0x5795eb,_0xa4515,_0x4ea8ee);return;}logger[_0x8f18('0x18')](_0x8f18('0x26'),_0x5795eb,_0xa4515,_0x4ea8ee);var _0x2e0fb6=_0x4194c0[_0x8f18('0x6')][_0x5795eb][_0x8f18('0x27')]&&_0x4194c0[_0x8f18('0x6')][_0x5795eb][_0x8f18('0x28')]?_0x4194c0[_0x8f18('0x6')][_0x5795eb][_0x8f18('0x28')]:_0x5795eb;return RpcUser[_0x8f18('0x29')](_0x4194c0[_0x8f18('0x4')][_0xa4515],_0x359fad,_0x2e0fb6)[_0x8f18('0x23')](function(_0x2b8518){_0x4194c0['voiceQueues'][_0x4ea8ee][_0x8f18('0x2a')]-=0x1;_0x4194c0['voiceQueues'][_0x4ea8ee][_0x8f18('0x2b')]+=0x1;return _0x2b8518;});})[_0x8f18('0x23')](function(_0x27e925){if(_0x29e788||!_0x27e925){return;}_0x4194c0[_0x8f18('0x5')][_0xa4515]={};logger[_0x8f18('0x18')](_0x8f18('0x2c'),_0x5795eb,_0x4194c0[_0x8f18('0x3')][_0x4ea8ee][_0x8f18('0x2d')],_0xa4515,_0x4ea8ee);_0x4194c0[_0x8f18('0x5')][_0xa4515][_0x8f18('0x15')]=setTimeout(_0x4194c0[_0x8f18('0x2e')][_0x8f18('0xa')](_0x4194c0,_0xa4515),_0x4194c0[_0x8f18('0x3')][_0x4ea8ee][_0x8f18('0x2d')]*0x3e8);_0x4194c0[_0x8f18('0x5')][_0xa4515]['lastPauseAt']=moment()[_0x8f18('0x2f')](_0x8f18('0x30'));_0x4194c0[_0x8f18('0x5')][_0xa4515][_0x8f18('0x17')]=_0x5795eb;_0x4194c0['timers'][_0xa4515][_0x8f18('0x1c')]=_0x4ea8ee;_0x4194c0[_0x8f18('0x5')][_0xa4515]['updateAcw']=_0x4194c0[_0x8f18('0x14')][_0x8f18('0xa')](_0x4194c0,_0xa4515,_0x5795eb);})['catch'](function(){logger[_0x8f18('0x31')](_0x8f18('0x2c'),_0x5795eb,_0x4194c0[_0x8f18('0x3')][_0x4ea8ee][_0x8f18('0x2d')],_0xa4515,_0x4ea8ee);})['finally'](function(){delete _0x4194c0['channels'][_0x5795eb];});}catch(_0x54c78c){logger['error'](_0x8f18('0x32'),_0x54c78c[_0x8f18('0x33')]);}};Acw[_0x8f18('0x13')][_0x8f18('0x2e')]=function(_0x332468){try{var _0xa531f=this;if(_0xa531f[_0x8f18('0x5')][_0x332468]){_0xa531f[_0x8f18('0x5')][_0x332468][_0x8f18('0x15')]=![];var _0x5d61d8=_0xa531f[_0x8f18('0x5')][_0x332468]['uniqueid'];var _0x4b449e=_0xa531f[_0x8f18('0x5')][_0x332468][_0x8f18('0x1c')];var _0x4bf8de=_0xa531f[_0x8f18('0x3')][_0x4b449e][_0x8f18('0x2d')];logger[_0x8f18('0x18')]('[%s][TIMER][STOP][AGENT:%s]',_0x5d61d8,_0x332468);RpcUser['getAgent'](this[_0x8f18('0x4')][_0x332468]['id'])[_0x8f18('0x23')](function(_0x1a3547){if(_0x1a3547[_0x8f18('0x34')]===_0x8f18('0x1d')){return RpcUser[_0x8f18('0x35')](_0xa531f[_0x8f18('0x4')][_0x332468]);}});RpcVoiceAgentReport['update']({'acwtime':_0x4bf8de,'agentacw':!![]},_0x5d61d8,_0x332468)['then'](function(_0x2e2b8f){logger['info'](_0x8f18('0x19'),_0x5d61d8,_0x4bf8de,_0x2e2b8f);})['catch'](function(_0x34ef66){logger[_0x8f18('0x31')](_0x8f18('0x36'),_0x5d61d8,_0x34ef66);});}else{logger['error'](_0x8f18('0x37'),_0x332468);if(_0xa531f[_0x8f18('0x5')]){logger[_0x8f18('0x18')](_0x8f18('0x38'),JSON[_0x8f18('0x39')](_0xa531f['timers']));}}}catch(_0x65f533){logger[_0x8f18('0x31')]('[ACW][STOP]\x20%s',_0x65f533['message']);}};Acw[_0x8f18('0x13')][_0x8f18('0x8')]=function(_0x2bffe7){try{if(this[_0x8f18('0x3')][_0x2bffe7[_0x8f18('0x1c')]]&&(this[_0x8f18('0x3')][_0x2bffe7[_0x8f18('0x1c')]]['acw']||this['voiceQueues'][_0x2bffe7[_0x8f18('0x1c')]][_0x8f18('0x1e')])){if(this[_0x8f18('0x4')][_0x2bffe7[_0x8f18('0x1b')]]){this['channels'][_0x2bffe7[_0x8f18('0x17')]]={'queue':_0x2bffe7[_0x8f18('0x1c')],'interface':_0x2bffe7[_0x8f18('0x1b')],'destlinkedid':_0x2bffe7[_0x8f18('0x28')]};}}}catch(_0x1d495b){logger[_0x8f18('0x31')]('[ACW][syncAgentConnect]\x20%s',_0x1d495b[_0x8f18('0x33')]);}};Acw[_0x8f18('0x13')][_0x8f18('0xf')]=function(_0x1f36f2){try{if(this[_0x8f18('0x3')][_0x1f36f2['queue']]&&(this[_0x8f18('0x3')][_0x1f36f2[_0x8f18('0x1c')]][_0x8f18('0x3a')]||this[_0x8f18('0x3')][_0x1f36f2['queue']][_0x8f18('0x1e')])){if(this[_0x8f18('0x4')][_0x1f36f2[_0x8f18('0x1b')]]){this['channels'][_0x1f36f2[_0x8f18('0x17')]]={'queue':_0x1f36f2[_0x8f18('0x1c')],'interface':_0x1f36f2[_0x8f18('0x1b')]};}}}catch(_0x385397){logger[_0x8f18('0x31')](_0x8f18('0x3b'),_0x385397[_0x8f18('0x33')]);}};Acw[_0x8f18('0x13')][_0x8f18('0x9')]=function(_0x11aaea){try{if(this[_0x8f18('0x6')][_0x11aaea[_0x8f18('0x17')]]&&_[_0x8f18('0x3c')](this[_0x8f18('0x6')][_0x11aaea[_0x8f18('0x17')]]['attended'])){logger[_0x8f18('0x18')](_0x8f18('0x3d'),_0x11aaea[_0x8f18('0x17')]);this['startAcw'](_0x11aaea[_0x8f18('0x17')]);}else if(this[_0x8f18('0x6')][_0x11aaea[_0x8f18('0x3e')]]&&_['isUndefined'](this['channels'][_0x11aaea[_0x8f18('0x3e')]]['attended'])){logger[_0x8f18('0x18')]('[%s][HANGUP:LINKEDID]',_0x11aaea[_0x8f18('0x3e')]);this[_0x8f18('0x1a')](_0x11aaea[_0x8f18('0x3e')]);}}catch(_0x1b1cba){logger['error'](_0x8f18('0x3f'),_0x1b1cba[_0x8f18('0x33')]);}};Acw[_0x8f18('0x13')][_0x8f18('0xc')]=function(_0x32a827){try{if(this[_0x8f18('0x6')][_0x32a827[_0x8f18('0x17')]]&&this[_0x8f18('0x6')][_0x32a827[_0x8f18('0x17')]][_0x8f18('0x27')]){logger['info'](_0x8f18('0x40'),_0x32a827[_0x8f18('0x17')]);this[_0x8f18('0x1a')](_0x32a827['uniqueid']);}else if(this['channels'][_0x32a827[_0x8f18('0x3e')]]&&this['channels'][_0x32a827[_0x8f18('0x3e')]][_0x8f18('0x27')]){logger[_0x8f18('0x18')](_0x8f18('0x41'),_0x32a827[_0x8f18('0x3e')]);this[_0x8f18('0x1a')](_0x32a827[_0x8f18('0x3e')]);}}catch(_0x191fc4){logger['error']('[ACW][syncHangup]\x20%s',_0x191fc4[_0x8f18('0x33')]);}};Acw[_0x8f18('0x13')]['syncAttendedTransfer']=function(_0x4a80be){try{if(!_[_0x8f18('0x42')](this['channels'][_0x4a80be['transfereeuniqueid']])){this[_0x8f18('0x1a')](_0x4a80be['transfereeuniqueid']);if(this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x43')]]){this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x43')]][_0x8f18('0x27')]=!![];this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x44')]]=this['channels'][_0x4a80be['secondtransfereruniqueid']];delete this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x43')]];}}else if(!_[_0x8f18('0x42')](this['channels'][_0x4a80be['transfertargetuniqueid']])){this[_0x8f18('0x1a')](_0x4a80be[_0x8f18('0x44')]);if(this[_0x8f18('0x6')][_0x4a80be['origtransfereruniqueid']]){this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x45')]]['attended']=!![];this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x46')]]=this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x45')]];delete this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x45')]];}}}catch(_0x307896){logger[_0x8f18('0x31')](_0x8f18('0x47'),_0x307896['message']);}};Acw[_0x8f18('0x13')][_0x8f18('0xe')]=function(_0x37c8d0){try{if(this[_0x8f18('0x6')][_0x37c8d0[_0x8f18('0x48')]]){logger['info'](_0x8f18('0x49'),JSON['stringify'](_0x37c8d0[_0x8f18('0x48')]));this[_0x8f18('0x1a')](_0x37c8d0['transfereruniqueid']);}else if(this[_0x8f18('0x6')][_0x37c8d0[_0x8f18('0x4a')]]){logger[_0x8f18('0x18')](_0x8f18('0x4b'),JSON[_0x8f18('0x39')](_0x37c8d0[_0x8f18('0x4a')]));this['startAcw'](_0x37c8d0[_0x8f18('0x4a')]);}}catch(_0x23758c){logger[_0x8f18('0x31')](_0x8f18('0x4c'),_0x23758c[_0x8f18('0x33')]);}};Acw[_0x8f18('0x13')][_0x8f18('0x4d')]=function(_0x43043d){try{if(this['voiceQueues'][_0x43043d[_0x8f18('0x1c')]]&&this[_0x8f18('0x3')][_0x43043d[_0x8f18('0x1c')]]['autopause']==='all'){if(this[_0x8f18('0x4')][_0x43043d[_0x8f18('0x1b')]]){logger['info'](_0x8f18('0x4e'),_0x43043d['uniqueid'],_0x43043d[_0x8f18('0x1b')],_0x43043d[_0x8f18('0x1c')]);return RpcUser[_0x8f18('0x29')](this[_0x8f18('0x4')][_0x43043d['interface']],_0x8f18('0x4f'),_0x43043d[_0x8f18('0x17')]);}}}catch(_0x30036b){logger[_0x8f18('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x30036b['message']);}};module[_0x8f18('0x50')]=Acw; \ No newline at end of file +var _0x7f0c=['acwTimeout','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','catch','finally','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','syncHangup','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','updateAcw','timer','update','then','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','startAcw','channels','queue','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw'];(function(_0x1d02d0,_0x59840f){var _0x15a16c=function(_0x1a30e2){while(--_0x1a30e2){_0x1d02d0['push'](_0x1d02d0['shift']());}};_0x15a16c(++_0x59840f);}(_0x7f0c,0x1d4));var _0xc7f0=function(_0x1a2347,_0x53830b){_0x1a2347=_0x1a2347-0x0;var _0xf7f6bd=_0x7f0c[_0x1a2347];return _0xf7f6bd;};'use strict';var _=require(_0xc7f0('0x0'));var moment=require(_0xc7f0('0x1'));var ami=require('../ami');var logger=require('../../../config/logger')(_0xc7f0('0x2'));var RpcUser=require(_0xc7f0('0x3'));var RpcVoiceAgentReport=require(_0xc7f0('0x4'));function Acw(_0x278e38){this['voiceQueues']=_0x278e38[_0xc7f0('0x5')];this[_0xc7f0('0x6')]=_0x278e38[_0xc7f0('0x6')];this[_0xc7f0('0x7')]=_0x278e38[_0xc7f0('0x7')];this['channels']={};ami['on']('agentconnect',this[_0xc7f0('0x8')][_0xc7f0('0x9')](this));ami['on'](_0xc7f0('0xa'),this[_0xc7f0('0xb')][_0xc7f0('0x9')](this));ami['on'](_0xc7f0('0xc'),this['syncHangup'][_0xc7f0('0x9')](this));ami['on'](_0xc7f0('0xd'),this[_0xc7f0('0xe')][_0xc7f0('0x9')](this));ami['on'](_0xc7f0('0xf'),this[_0xc7f0('0x10')][_0xc7f0('0x9')](this));ami['on'](_0xc7f0('0x11'),this['syncBlindTransfer'][_0xc7f0('0x9')](this));ami['on'](_0xc7f0('0x12'),this[_0xc7f0('0x13')][_0xc7f0('0x9')](this));}function getDiff(_0x1640d9){var _0x5b335f=moment()['milliseconds'](0x0);var _0x1ae71a=moment(_0x1640d9)[_0xc7f0('0x14')](0x0);return _0x5b335f[_0xc7f0('0x15')](_0x1ae71a,_0xc7f0('0x16'));}Acw['prototype'][_0xc7f0('0x17')]=function(_0x4de2ea,_0x4f6e36){var _0x7c3172=this;var _0x282511=getDiff(_0x7c3172[_0xc7f0('0x7')][_0x4de2ea]['lastPauseAt']);clearTimeout(_0x7c3172['timers'][_0x4de2ea][_0xc7f0('0x18')]);_0x7c3172[_0xc7f0('0x7')][_0x4de2ea][_0xc7f0('0x18')]=![];return RpcVoiceAgentReport[_0xc7f0('0x19')]({'acwtime':_0x282511},_0x7c3172['timers'][_0x4de2ea]['uniqueid'],_0x4de2ea)[_0xc7f0('0x1a')](function(_0x533342){logger[_0xc7f0('0x1b')](_0xc7f0('0x1c'),_0x4f6e36,_0x282511,_0x533342);})['catch'](function(_0x46d6ca){logger[_0xc7f0('0x1d')](_0xc7f0('0x1e'),_0x4f6e36,_0x46d6ca);})['finally'](function(){delete _0x7c3172[_0xc7f0('0x7')][_0x4de2ea];});};Acw['prototype'][_0xc7f0('0x1f')]=function(_0x200154){try{var _0x2354a7=this;var _0x222703=this[_0xc7f0('0x20')][_0x200154]['interface'];var _0x223343=this[_0xc7f0('0x20')][_0x200154][_0xc7f0('0x21')];var _0xf88102=this[_0xc7f0('0x5')][_0x223343];var _0x513e72=![];var _0x4543ff='ACW';if(_0xf88102[_0xc7f0('0x22')]&&_0xf88102[_0xc7f0('0x23')][_0xc7f0('0x24')]){_0x513e72=!![];_0x4543ff=_0xf88102['mandatoryDispositionPause'][_0xc7f0('0x24')];}if(!_0x2354a7[_0xc7f0('0x6')][_0x222703]){return Promise[_0xc7f0('0x25')]();}return RpcUser[_0xc7f0('0x26')](_0x2354a7['agents'][_0x222703]['id'])[_0xc7f0('0x1a')](function(_0x3efd57){if(!_0x3efd57||_0x3efd57[_0xc7f0('0x27')]){logger[_0xc7f0('0x1b')](_0xc7f0('0x28'),_0x200154,_0x222703,_0x223343);return;}logger[_0xc7f0('0x1b')](_0xc7f0('0x29'),_0x200154,_0x222703,_0x223343);var _0x3e5681=_0x2354a7[_0xc7f0('0x20')][_0x200154][_0xc7f0('0x2a')]&&_0x2354a7[_0xc7f0('0x20')][_0x200154][_0xc7f0('0x2b')]?_0x2354a7[_0xc7f0('0x20')][_0x200154]['destlinkedid']:_0x200154;return RpcUser['savePause'](_0x2354a7['agents'][_0x222703],_0x4543ff,_0x3e5681)[_0xc7f0('0x1a')](function(_0x411b83){_0x2354a7[_0xc7f0('0x5')][_0x223343][_0xc7f0('0x2c')]-=0x1;_0x2354a7[_0xc7f0('0x5')][_0x223343][_0xc7f0('0x2d')]+=0x1;return _0x411b83;});})[_0xc7f0('0x1a')](function(_0x1d4cb5){if(_0x513e72||!_0x1d4cb5){return;}_0x2354a7[_0xc7f0('0x7')][_0x222703]={};logger[_0xc7f0('0x1b')](_0xc7f0('0x2e'),_0x200154,_0x2354a7['voiceQueues'][_0x223343]['acwTimeout'],_0x222703,_0x223343);_0x2354a7['timers'][_0x222703][_0xc7f0('0x18')]=setTimeout(_0x2354a7[_0xc7f0('0x2f')]['bind'](_0x2354a7,_0x222703),_0x2354a7['voiceQueues'][_0x223343][_0xc7f0('0x30')]*0x3e8);_0x2354a7[_0xc7f0('0x7')][_0x222703][_0xc7f0('0x31')]=moment()['format'](_0xc7f0('0x32'));_0x2354a7[_0xc7f0('0x7')][_0x222703][_0xc7f0('0x33')]=_0x200154;_0x2354a7[_0xc7f0('0x7')][_0x222703]['queue']=_0x223343;_0x2354a7[_0xc7f0('0x7')][_0x222703][_0xc7f0('0x17')]=_0x2354a7[_0xc7f0('0x17')][_0xc7f0('0x9')](_0x2354a7,_0x222703,_0x200154);})[_0xc7f0('0x34')](function(){logger['error'](_0xc7f0('0x2e'),_0x200154,_0x2354a7['voiceQueues'][_0x223343]['acwTimeout'],_0x222703,_0x223343);})[_0xc7f0('0x35')](function(){delete _0x2354a7[_0xc7f0('0x20')][_0x200154];});}catch(_0x5c2a77){logger[_0xc7f0('0x1d')](_0xc7f0('0x36'),_0x5c2a77[_0xc7f0('0x37')]);}};Acw[_0xc7f0('0x38')][_0xc7f0('0x2f')]=function(_0x36b68b){try{var _0x24ed11=this;if(_0x24ed11['timers'][_0x36b68b]){_0x24ed11['timers'][_0x36b68b][_0xc7f0('0x18')]=![];var _0x5090a9=_0x24ed11[_0xc7f0('0x7')][_0x36b68b][_0xc7f0('0x33')];var _0x525d7=_0x24ed11['timers'][_0x36b68b][_0xc7f0('0x21')];var _0x1e1c49=_0x24ed11[_0xc7f0('0x5')][_0x525d7][_0xc7f0('0x30')];logger['info'](_0xc7f0('0x39'),_0x5090a9,_0x36b68b);RpcUser[_0xc7f0('0x26')](this['agents'][_0x36b68b]['id'])[_0xc7f0('0x1a')](function(_0x26ef9a){if(_0x26ef9a[_0xc7f0('0x3a')]==='ACW'){return RpcUser[_0xc7f0('0x3b')](_0x24ed11[_0xc7f0('0x6')][_0x36b68b]);}});RpcVoiceAgentReport[_0xc7f0('0x19')]({'acwtime':_0x1e1c49,'agentacw':!![]},_0x5090a9,_0x36b68b)[_0xc7f0('0x1a')](function(_0x55358a){logger['info'](_0xc7f0('0x1c'),_0x5090a9,_0x1e1c49,_0x55358a);})[_0xc7f0('0x34')](function(_0x5da96e){logger[_0xc7f0('0x1d')](_0xc7f0('0x1e'),_0x5090a9,_0x5da96e);});}else{logger[_0xc7f0('0x1d')](_0xc7f0('0x3c'),_0x36b68b);if(_0x24ed11[_0xc7f0('0x7')]){logger[_0xc7f0('0x1b')](_0xc7f0('0x3d'),JSON[_0xc7f0('0x3e')](_0x24ed11['timers']));}}}catch(_0x5a2fc8){logger[_0xc7f0('0x1d')](_0xc7f0('0x3f'),_0x5a2fc8[_0xc7f0('0x37')]);}};Acw[_0xc7f0('0x38')][_0xc7f0('0x8')]=function(_0x3734a2){try{if(this[_0xc7f0('0x5')][_0x3734a2['queue']]&&(this['voiceQueues'][_0x3734a2[_0xc7f0('0x21')]][_0xc7f0('0x2')]||this[_0xc7f0('0x5')][_0x3734a2[_0xc7f0('0x21')]][_0xc7f0('0x22')])){if(this[_0xc7f0('0x6')][_0x3734a2[_0xc7f0('0x40')]]){this['channels'][_0x3734a2[_0xc7f0('0x33')]]={'queue':_0x3734a2[_0xc7f0('0x21')],'interface':_0x3734a2[_0xc7f0('0x40')],'destlinkedid':_0x3734a2['destlinkedid']};}}}catch(_0x431bbb){logger[_0xc7f0('0x1d')](_0xc7f0('0x41'),_0x431bbb[_0xc7f0('0x37')]);}};Acw[_0xc7f0('0x38')]['syncAgentConnectPreview']=function(_0x51eb2b){try{if(this['voiceQueues'][_0x51eb2b['queue']]&&(this[_0xc7f0('0x5')][_0x51eb2b[_0xc7f0('0x21')]][_0xc7f0('0x2')]||this[_0xc7f0('0x5')][_0x51eb2b[_0xc7f0('0x21')]][_0xc7f0('0x22')])){if(this[_0xc7f0('0x6')][_0x51eb2b[_0xc7f0('0x40')]]){this[_0xc7f0('0x20')][_0x51eb2b[_0xc7f0('0x33')]]={'queue':_0x51eb2b[_0xc7f0('0x21')],'interface':_0x51eb2b['interface']};}}}catch(_0x4dd481){logger[_0xc7f0('0x1d')](_0xc7f0('0x42'),_0x4dd481[_0xc7f0('0x37')]);}};Acw[_0xc7f0('0x38')][_0xc7f0('0xb')]=function(_0x4c3234){try{if(this[_0xc7f0('0x20')][_0x4c3234['uniqueid']]&&_[_0xc7f0('0x43')](this[_0xc7f0('0x20')][_0x4c3234['uniqueid']][_0xc7f0('0x2a')])){logger[_0xc7f0('0x1b')]('[%s][HANGUP:UNIQUEID]',_0x4c3234[_0xc7f0('0x33')]);this[_0xc7f0('0x1f')](_0x4c3234[_0xc7f0('0x33')]);}else if(this[_0xc7f0('0x20')][_0x4c3234[_0xc7f0('0x44')]]&&_[_0xc7f0('0x43')](this['channels'][_0x4c3234[_0xc7f0('0x44')]][_0xc7f0('0x2a')])){logger[_0xc7f0('0x1b')]('[%s][HANGUP:LINKEDID]',_0x4c3234[_0xc7f0('0x44')]);this[_0xc7f0('0x1f')](_0x4c3234[_0xc7f0('0x44')]);}}catch(_0x43bea8){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x43bea8[_0xc7f0('0x37')]);}};Acw[_0xc7f0('0x38')][_0xc7f0('0x45')]=function(_0x447e48){try{if(this[_0xc7f0('0x20')][_0x447e48[_0xc7f0('0x33')]]&&this[_0xc7f0('0x20')][_0x447e48[_0xc7f0('0x33')]][_0xc7f0('0x2a')]){logger[_0xc7f0('0x1b')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x447e48[_0xc7f0('0x33')]);this[_0xc7f0('0x1f')](_0x447e48['uniqueid']);}else if(this[_0xc7f0('0x20')][_0x447e48[_0xc7f0('0x44')]]&&this[_0xc7f0('0x20')][_0x447e48[_0xc7f0('0x44')]][_0xc7f0('0x2a')]){logger[_0xc7f0('0x1b')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x447e48['linkedid']);this[_0xc7f0('0x1f')](_0x447e48[_0xc7f0('0x44')]);}}catch(_0x9ff042){logger[_0xc7f0('0x1d')](_0xc7f0('0x46'),_0x9ff042['message']);}};Acw[_0xc7f0('0x38')]['syncAttendedTransfer']=function(_0x18a5fa){try{if(!_[_0xc7f0('0x47')](this[_0xc7f0('0x20')][_0x18a5fa[_0xc7f0('0x48')]])){this['startAcw'](_0x18a5fa['transfereeuniqueid']);if(this['channels'][_0x18a5fa['secondtransfereruniqueid']]){this['channels'][_0x18a5fa['secondtransfereruniqueid']][_0xc7f0('0x2a')]=!![];this[_0xc7f0('0x20')][_0x18a5fa[_0xc7f0('0x49')]]=this[_0xc7f0('0x20')][_0x18a5fa[_0xc7f0('0x4a')]];delete this[_0xc7f0('0x20')][_0x18a5fa['secondtransfereruniqueid']];}}else if(!_[_0xc7f0('0x47')](this['channels'][_0x18a5fa[_0xc7f0('0x49')]])){this[_0xc7f0('0x1f')](_0x18a5fa['transfertargetuniqueid']);if(this[_0xc7f0('0x20')][_0x18a5fa[_0xc7f0('0x4b')]]){this['channels'][_0x18a5fa[_0xc7f0('0x4b')]][_0xc7f0('0x2a')]=!![];this[_0xc7f0('0x20')][_0x18a5fa[_0xc7f0('0x48')]]=this[_0xc7f0('0x20')][_0x18a5fa[_0xc7f0('0x4b')]];delete this[_0xc7f0('0x20')][_0x18a5fa[_0xc7f0('0x4b')]];}}}catch(_0x302cea){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x302cea[_0xc7f0('0x37')]);}};Acw['prototype'][_0xc7f0('0x4c')]=function(_0x5c2411){try{if(this[_0xc7f0('0x20')][_0x5c2411[_0xc7f0('0x4d')]]){logger['info'](_0xc7f0('0x4e'),JSON[_0xc7f0('0x3e')](_0x5c2411[_0xc7f0('0x4d')]));this[_0xc7f0('0x1f')](_0x5c2411['transfereruniqueid']);}else if(this[_0xc7f0('0x20')][_0x5c2411[_0xc7f0('0x4f')]]){logger[_0xc7f0('0x1b')](_0xc7f0('0x50'),JSON['stringify'](_0x5c2411['transfererlinkedid']));this[_0xc7f0('0x1f')](_0x5c2411[_0xc7f0('0x4f')]);}}catch(_0x4a1b6d){logger[_0xc7f0('0x1d')](_0xc7f0('0x51'),_0x4a1b6d[_0xc7f0('0x37')]);}};Acw['prototype'][_0xc7f0('0xe')]=function(_0xc6c54){try{if(this[_0xc7f0('0x5')][_0xc6c54['queue']]&&this[_0xc7f0('0x5')][_0xc6c54[_0xc7f0('0x21')]]['autopause']==='all'){if(this[_0xc7f0('0x6')][_0xc6c54[_0xc7f0('0x40')]]){logger[_0xc7f0('0x1b')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0xc6c54[_0xc7f0('0x33')],_0xc6c54[_0xc7f0('0x40')],_0xc6c54[_0xc7f0('0x21')]);return RpcUser[_0xc7f0('0x52')](this[_0xc7f0('0x6')][_0xc6c54[_0xc7f0('0x40')]],_0xc7f0('0x53'),_0xc6c54[_0xc7f0('0x33')]);}}}catch(_0x569d83){logger['error'](_0xc7f0('0x54'),_0x569d83[_0xc7f0('0x37')]);}};module[_0xc7f0('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f8c16f8..214d385 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 _0x38dd=['sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','info','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','username','password','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','Action','devicestatelist','actionSipPeerStatus'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x38dd,0x8e));var _0xd38d=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0x38dd[_0x5a2d3f];return _0x5c65d8;};'use strict';var Manager=require(_0xd38d('0x0'));var BPromise=require(_0xd38d('0x1'));var util=require(_0xd38d('0x2'));var logger=require(_0xd38d('0x3'))(_0xd38d('0x4'));var config=require(_0xd38d('0x5'));var ami=new Manager(config[_0xd38d('0x6')]['port'],config[_0xd38d('0x6')]['ip'],config[_0xd38d('0x6')][_0xd38d('0x7')],config[_0xd38d('0x6')][_0xd38d('0x8')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xd38d('0x9')](ami['action']);function error(_0x34a009){logger[_0xd38d('0xa')](util[_0xd38d('0xb')](_0xd38d('0xc'),config[_0xd38d('0x6')][_0xd38d('0x7')],config[_0xd38d('0x6')]['ip'],config[_0xd38d('0x6')][_0xd38d('0xd')],util[_0xd38d('0xe')](_0x34a009,![],null)));}function close(){logger[_0xd38d('0xa')](util['format'](_0xd38d('0xf'),config[_0xd38d('0x6')][_0xd38d('0x7')],config[_0xd38d('0x6')]['ip'],config['asterisk'][_0xd38d('0xd')]));}ami[_0xd38d('0x10')]=function(){return function(){return ami['Action']({'action':_0xd38d('0x11')});};};ami[_0xd38d('0x12')]=function(){return function(){return ami[_0xd38d('0x13')]({'action':_0xd38d('0x14')});};};ami[_0xd38d('0x15')]=function(){return function(){return ami[_0xd38d('0x13')]({'action':_0xd38d('0x16')});};};ami[_0xd38d('0x17')]=function(){return function(){return ami[_0xd38d('0x13')]({'action':_0xd38d('0x18')});};};ami[_0xd38d('0x19')]=function(){return function(){return ami[_0xd38d('0x13')]({'action':_0xd38d('0x1a')});};};function connect(){logger['info'](util[_0xd38d('0xb')](_0xd38d('0x1b'),config[_0xd38d('0x6')][_0xd38d('0x7')],config[_0xd38d('0x6')]['ip'],config[_0xd38d('0x6')][_0xd38d('0xd')]));ami[_0xd38d('0x1c')]('error',error);ami[_0xd38d('0x1c')](_0xd38d('0x1d'),close);}ami['on'](_0xd38d('0x1e'),connect);ami['on'](_0xd38d('0x1f'),function(_0x5d2245){logger[_0xd38d('0x20')](util[_0xd38d('0xb')](_0xd38d('0x21'),config['asterisk'][_0xd38d('0x7')],config[_0xd38d('0x6')]['ip'],config['asterisk']['port'],util['inspect'](_0x5d2245,![],null)));});ami['on'](_0xd38d('0x22'),function(){logger[_0xd38d('0x20')](util[_0xd38d('0xb')](_0xd38d('0x23'),config[_0xd38d('0x6')][_0xd38d('0x7')],config['asterisk']['ip'],config[_0xd38d('0x6')][_0xd38d('0xd')]));return Promise[_0xd38d('0x24')]()[_0xd38d('0x25')](ami[_0xd38d('0x10')]())[_0xd38d('0x25')](ami['actionDeviceStateList']())['then'](ami[_0xd38d('0x15')]())['then'](ami['actionQueueSummary']())[_0xd38d('0x25')](ami[_0xd38d('0x19')]())[_0xd38d('0x26')](function(_0x213d7e){logger['error'](_0xd38d('0x27'),util[_0xd38d('0xe')](_0x213d7e,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami['once']('close',close);module[_0xd38d('0x28')]=ami; \ No newline at end of file +var _0x28ac=['close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch','exports','asterisk-manager','util','../../config/logger','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once'];(function(_0x4ca097,_0x2ebf43){var _0x48598c=function(_0x41a229){while(--_0x41a229){_0x4ca097['push'](_0x4ca097['shift']());}};_0x48598c(++_0x2ebf43);}(_0x28ac,0xf1));var _0xc28a=function(_0x41f4c0,_0x351f53){_0x41f4c0=_0x41f4c0-0x0;var _0x189418=_0x28ac[_0x41f4c0];return _0x189418;};'use strict';var Manager=require(_0xc28a('0x0'));var BPromise=require('bluebird');var util=require(_0xc28a('0x1'));var logger=require(_0xc28a('0x2'))(_0xc28a('0x3'));var config=require(_0xc28a('0x4'));var ami=new Manager(config[_0xc28a('0x5')][_0xc28a('0x6')],config[_0xc28a('0x5')]['ip'],config[_0xc28a('0x5')]['username'],config[_0xc28a('0x5')][_0xc28a('0x7')],!![]);ami['keepConnected']();ami[_0xc28a('0x8')]=BPromise[_0xc28a('0x9')](ami[_0xc28a('0xa')]);function error(_0x2aae94){logger[_0xc28a('0xb')](util[_0xc28a('0xc')](_0xc28a('0xd'),config[_0xc28a('0x5')]['username'],config[_0xc28a('0x5')]['ip'],config[_0xc28a('0x5')][_0xc28a('0x6')],util['inspect'](_0x2aae94,![],null)));}function close(){logger['error'](util[_0xc28a('0xc')](_0xc28a('0xe'),config['asterisk']['username'],config[_0xc28a('0x5')]['ip'],config[_0xc28a('0x5')][_0xc28a('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0xc28a('0xf')});};};ami[_0xc28a('0x10')]=function(){return function(){return ami['Action']({'action':_0xc28a('0x11')});};};ami[_0xc28a('0x12')]=function(){return function(){return ami[_0xc28a('0x8')]({'action':'sippeerstatus'});};};ami[_0xc28a('0x13')]=function(){return function(){return ami[_0xc28a('0x8')]({'action':_0xc28a('0x14')});};};ami[_0xc28a('0x15')]=function(){return function(){return ami['Action']({'action':_0xc28a('0x16')});};};function connect(){logger['info'](util[_0xc28a('0xc')](_0xc28a('0x17'),config[_0xc28a('0x5')]['username'],config[_0xc28a('0x5')]['ip'],config[_0xc28a('0x5')][_0xc28a('0x6')]));ami[_0xc28a('0x18')](_0xc28a('0xb'),error);ami[_0xc28a('0x18')](_0xc28a('0x19'),close);}ami['on']('connect',connect);ami['on'](_0xc28a('0x1a'),function(_0x54ddc4){logger[_0xc28a('0x1b')](util['format'](_0xc28a('0x1c'),config[_0xc28a('0x5')][_0xc28a('0x1d')],config['asterisk']['ip'],config['asterisk']['port'],util[_0xc28a('0x1e')](_0x54ddc4,![],null)));});ami['on'](_0xc28a('0x1f'),function(){logger[_0xc28a('0x1b')](util[_0xc28a('0xc')](_0xc28a('0x20'),config[_0xc28a('0x5')][_0xc28a('0x1d')],config[_0xc28a('0x5')]['ip'],config[_0xc28a('0x5')]['port']));return Promise[_0xc28a('0x21')]()[_0xc28a('0x22')](ami[_0xc28a('0x23')]())[_0xc28a('0x22')](ami[_0xc28a('0x10')]())[_0xc28a('0x22')](ami['actionSipPeerStatus']())['then'](ami[_0xc28a('0x13')]())[_0xc28a('0x22')](ami[_0xc28a('0x15')]())[_0xc28a('0x24')](function(_0x33b77f){logger[_0xc28a('0xb')]('[ami.js][fullybooted]',util['inspect'](_0x33b77f,{'showHidden':![],'depth':null}));});});ami[_0xc28a('0x18')](_0xc28a('0xb'),error);ami[_0xc28a('0x18')](_0xc28a('0x19'),close);module[_0xc28a('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 58fd114..bd316c4 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 _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe706,0xa3));var _0x6e70=function(_0x1c9093,_0x31eb87){_0x1c9093=_0x1c9093-0x0;var _0x32dd36=_0xe706[_0x1c9093];return _0x32dd36;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x21c2c8,_0x44257e){var _0x4dd745=function(_0x1b3196){while(--_0x1b3196){_0x21c2c8['push'](_0x21c2c8['shift']());}};_0x4dd745(++_0x44257e);}(_0xe706,0xa3));var _0x6e70=function(_0x2c3f37,_0x5a46b6){_0x2c3f37=_0x2c3f37-0x0;var _0x12a453=_0xe706[_0x2c3f37];return _0x12a453;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 00bd2a1..37542d8 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 _0x9cbf=['custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','getSettings','then','isUndefined','emit','debug','voice:queue:%s','voice_queue:save','isEmpty','info','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','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','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','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','name','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','queueStatusComplete','stringify','pick','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','Interval','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','sendMessageOneNotActive','originated','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','prototype','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','iftime\x20%s,%s','interval','timezones','content','indexOf','true','catch','command','all','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','dialGlobalInterval','dialTimezone','launchHandleIvr','dialMethod','progressive','handlePower','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueId','uniqueid','type','ivr','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','droptime','responsetime','dropreason','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','callAdditionalPhoneAfterMin','voiceQueue','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','Abandoned','[syncAgentComplete][createHistory][11]','syncNewExten','actions','channel','actionid','isNil','locked','paused','stateinterface','merge','rrmemory','roundrobin','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','updateOriginated','CampaignId','queueBookedRR','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','preview','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','membername','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','dialAMDActive','Machine','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','HangupInAMD','[syncHangupInAMDIvr]','MACHINE','outboundAnswerAgiCallsDay','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','AGI','[syncHangupIvr][createHistory]','dialQueueProject','cause-txt','Normal\x20Clearing','moveContactManagedDialer','[syncAgentComplete]','outboundUnknownCallsDay','Unknow','running','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','pTalking','ACTIVE','checkDialMethod','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','map','Agent','user:%s','user:dialPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','loggerHandler','notFound','UserId','checkPreviewRecallReminder','handleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','scheduledat','voicePause','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[getContactCampaign2]','not_inuse','countReScheduled','emptyContact','checkIsBlackList','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','moment','ioredis','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete'];(function(_0x3213e1,_0x3bdf0f){var _0x32898c=function(_0x2919f0){while(--_0x2919f0){_0x3213e1['push'](_0x3213e1['shift']());}};_0x32898c(++_0x3bdf0f);}(_0x9cbf,0x1e5));var _0xf9cb=function(_0x536181,_0x5f1860){_0x536181=_0x536181-0x0;var _0x4ea8f1=_0x9cbf[_0x536181];return _0x4ea8f1;};'use strict';var util=require(_0xf9cb('0x0'));var _=require(_0xf9cb('0x1'));var uuid=require('uuid');var moment=require(_0xf9cb('0x2'));var rr=require('rr');var Redis=require(_0xf9cb('0x3'));var utils=require('./utils');var hopperUtils=require(_0xf9cb('0x4'));var ut=require('../preview/util/util');var config=require(_0xf9cb('0x5'));var logger=require(_0xf9cb('0x6'))(_0xf9cb('0x7'));var loggerBooked=require(_0xf9cb('0x6'))(_0xf9cb('0x8'));var loggerPredictive=require(_0xf9cb('0x6'))(_0xf9cb('0x9'));var loggerPredictiveCalls=require('../../../config/logger')(_0xf9cb('0xa'));var loggerSyncQueueSummary=require(_0xf9cb('0x6'))(_0xf9cb('0xb'));var ami=require('../ami');config[_0xf9cb('0xc')]=_['defaults'](config[_0xf9cb('0xc')],{'host':_0xf9cb('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf9cb('0xc')]));var cmHopper=require(_0xf9cb('0xe'));var voiceQueueRt=require(_0xf9cb('0xf'));var RpcSetting=require('../rpc/setting');var Interval=require(_0xf9cb('0x10'));var Action=require(_0xf9cb('0x11'));var History=require(_0xf9cb('0x12'));var Final=require(_0xf9cb('0x13'));var AgentComplete=require(_0xf9cb('0x14'));var QueueCallerAbandon=require(_0xf9cb('0x15'));var Hangup=require(_0xf9cb('0x16'));var ipAgi=process[_0xf9cb('0x17')][_0xf9cb('0x18')]||_0xf9cb('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xf9cb('0x1a')]=function(_0x3d6cb8){this[_0xf9cb('0x1b')]=this['tail']?this['tail'][_0xf9cb('0x1c')](_0x3d6cb8):_0x3d6cb8();};function Dialer(_0x318e33,_0x4ade1c){this[_0xf9cb('0x1d')]=new Sequence();this['preview']=_0x4ade1c;this[_0xf9cb('0x1e')]=_0x318e33[_0xf9cb('0x1e')];this[_0xf9cb('0x1f')]=_0x318e33[_0xf9cb('0x1f')];this[_0xf9cb('0x20')]=_0x318e33[_0xf9cb('0x20')];this[_0xf9cb('0x21')]=_0x318e33[_0xf9cb('0x21')];this[_0xf9cb('0x22')]=config['maxNumberOriginate']||0x2;this[_0xf9cb('0x23')]={};this['actions']={};this[_0xf9cb('0x24')]={};this['uniqueId']={};this[_0xf9cb('0x25')]={};this[_0xf9cb('0x26')]={};this[_0xf9cb('0x27')]={};this[_0xf9cb('0x28')]={};this[_0xf9cb('0x29')]={};this['queueBookedRR']={};this[_0xf9cb('0x2a')]={};ami['on'](_0xf9cb('0x2b'),this['syncAgentConnect'][_0xf9cb('0x2c')](this));ami['on'](_0xf9cb('0x2d'),this[_0xf9cb('0x2e')][_0xf9cb('0x2c')](this));ami['on'](_0xf9cb('0x2f'),this['syncOriginateResponse'][_0xf9cb('0x2c')](this));ami['on'](_0xf9cb('0x30'),this[_0xf9cb('0x31')][_0xf9cb('0x2c')](this));ami['on'](_0xf9cb('0x32'),this[_0xf9cb('0xb')][_0xf9cb('0x2c')](this));ami['on'](_0xf9cb('0x33'),this[_0xf9cb('0x34')][_0xf9cb('0x2c')](this));ami['on'](_0xf9cb('0x35'),this[_0xf9cb('0x36')]['bind'](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on']('varset',this[_0xf9cb('0x37')][_0xf9cb('0x2c')](this));ami['on'](_0xf9cb('0x38'),this[_0xf9cb('0x39')][_0xf9cb('0x2c')](this));ami['on'](_0xf9cb('0x3a'),this['syncQueueStatusComplete']['bind'](this));this['loopCampaigns']();this[_0xf9cb('0x3b')]();RpcSetting[_0xf9cb('0x3c')]()[_0xf9cb('0x3d')](function(_0x5c1403){previewRecallmeReminderInterval=_0x5c1403['previewRecallmeReminderInterval'];});}function isNotNull(_0x3cd1e3){return _0x3cd1e3!==null&&!_[_0xf9cb('0x3e')](_0x3cd1e3);}function msgResponse(_0x208a26,_0x1f6373,_0x27bf1b){return{'action':_0x208a26,'response':_0x1f6373,'message':_0x27bf1b,'stack':_0x27bf1b};}function emit(_0x54e71e,_0x2729d5,_0x597955){io['to'](_0x54e71e)[_0xf9cb('0x3f')](_0x2729d5,_0x597955);}function emitOutboundVoiceQueueSummary(_0x23da76){if(_0x23da76['type']==='outbound'){logger[_0xf9cb('0x40')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0x23da76,{'showHidden':![],'depth':null}));emit(util['format'](_0xf9cb('0x41'),_0x23da76['name']),_0xf9cb('0x42'),_0x23da76);}}function checkGetDataPredictive(_0x49c5ed){if(isNotNull(_0x49c5ed)&&!_[_0xf9cb('0x43')](_0x49c5ed)){loggerPredictive[_0xf9cb('0x44')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xf9cb('0x44')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x49c5ed['predictiveIntervalTotalCalls']);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x45'),_0x49c5ed[_0xf9cb('0x46')]);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x47'),_0x49c5ed[_0xf9cb('0x48')]);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x49'),_0x49c5ed[_0xf9cb('0x4a')]);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x4b'),_0x49c5ed[_0xf9cb('0x4c')]);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x4d'),_0x49c5ed[_0xf9cb('0x4e')]);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x4f'));if(_0x49c5ed[_0xf9cb('0x50')]>0x0){if(!_['isUndefined'](_0x49c5ed['predictiveIntervalAvgTalktime'])&&_0x49c5ed[_0xf9cb('0x4e')]>0x0){return!![];}loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x51'));if(!_[_0xf9cb('0x3e')](_0x49c5ed[_0xf9cb('0x4c')])&&_0x49c5ed[_0xf9cb('0x4c')]>0x0){return!![];}loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x52'));}else{loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x53'));}}else{loggerPredictive[_0xf9cb('0x44')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x597ff4){return function(_0x5e0887){loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x54'));loggerPredictive['info'](_0xf9cb('0x55'),_0x5e0887['erlangCalls']);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x56'),_0x5e0887[_0xf9cb('0x57')]);loggerPredictive[_0xf9cb('0x44')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e0887[_0xf9cb('0x58')]);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x59'),_0x5e0887[_0xf9cb('0x5a')]);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x5b'),_0x5e0887[_0xf9cb('0x58')]);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x4f'));_['merge'](_0x597ff4,_0x5e0887);};}function ifInterval(_0x571c65,_0x403798){if(_['isUndefined'](_0x403798)){return![];}return utils[_0xf9cb('0x5c')](undefined,_0x403798)<_0x571c65*0x3c;}function clearPredictiveAttributes(_0x8ccd79){if(_0x8ccd79[_0xf9cb('0x27')]){_0x8ccd79[_0xf9cb('0x27')]=undefined;loggerPredictive[_0xf9cb('0x40')](_0x8ccd79['name'],_0xf9cb('0x5d'));}if(_0x8ccd79[_0xf9cb('0x26')]){_0x8ccd79[_0xf9cb('0x26')]=undefined;loggerPredictive[_0xf9cb('0x40')](_0x8ccd79[_0xf9cb('0x5e')],'startPredictive\x20value\x20cleared');}if(_0x8ccd79[_0xf9cb('0x5f')]){clearInterval(_0x8ccd79[_0xf9cb('0x5f')]);_0x8ccd79[_0xf9cb('0x5f')]=undefined;loggerPredictive[_0xf9cb('0x40')](_0x8ccd79['name'],_0xf9cb('0x60'));}}function loggerCatchPredictive(_0x53b977,_0xc315d7){return function(_0x28412d){loggerPredictive[_0xf9cb('0x61')](_0xc315d7[_0xf9cb('0x5e')],_0x53b977);loggerPredictive['error'](_0x28412d[_0xf9cb('0x62')]);clearPredictiveAttributes(_0xc315d7);};}function loggerCatch(_0x5c10e5){return function(_0x2c780f){logger[_0xf9cb('0x61')](_0x5c10e5,util[_0xf9cb('0x63')](_0x2c780f,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x225b9a,_0xe88670,_0x31d5a1){return function(_0x286e62){utils[_0xf9cb('0x64')](_0xe88670,_0x31d5a1,0x0);_0xe88670[_0xf9cb('0x65')]=0x0;logger[_0xf9cb('0x61')](_0x225b9a,util[_0xf9cb('0x63')](_0x286e62,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x30c026){return function(_0x200536){if(isNotNull(_0x200536)&&isNotNull(_0x200536[0x0])){if(_0x200536[0x0][_0xf9cb('0x66')]>0x0){_0x30c026[_0xf9cb('0x67')]=utils[_0xf9cb('0x68')]['CONTACTS_RESCHEDULED'];logger['info'](_0xf9cb('0x69')+_0x30c026[_0xf9cb('0x5e')],_0x200536[0x0][_0xf9cb('0x66')],_0xf9cb('0x6a'));}else{_0x30c026[_0xf9cb('0x67')]=utils[_0xf9cb('0x68')][_0xf9cb('0x6b')];logger[_0xf9cb('0x44')](_0xf9cb('0x6c')+_0x30c026[_0xf9cb('0x5e')]);}}};}function createObjHistory(_0x3b156d,_0x166006,_0x69b340,_0x5aa4a7,_0x46ae42){_0x3b156d[_0xf9cb('0x67')]=_0x69b340;var _0x3dadba=new Action(_0x3b156d,_0x166006);var _0x154823=new History(_0x3dadba);_0x154823[_0xf9cb('0x6d')]=_0x5aa4a7;_0x154823[_0xf9cb('0x6e')]=_0x46ae42;_0x154823[_0xf9cb('0x6f')]=_0x3dadba['starttime'];return _0x154823;}function unlockQueueStatus(_0x7884d3,_0x2eff23){setTimeout(function(){if(_[_0xf9cb('0x3e')](_0x7884d3['queueStatusComplete'])){loggerBooked[_0xf9cb('0x61')]('[unlockQueueStatus][undefined]',_0x2eff23);}_0x7884d3[_0xf9cb('0x70')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x2eff23,JSON[_0xf9cb('0x71')](_[_0xf9cb('0x72')](_0x7884d3,[_0xf9cb('0x5e'),_0xf9cb('0x70')])));},0x1f3);}function checkInterval(_0x129fce){return function(){if(!isNotNull(_0x129fce['Interval'])){_0x129fce[_0xf9cb('0x67')]=utils[_0xf9cb('0x68')]['NULL_INTERVAL'];throw _0x129fce[_0xf9cb('0x5e')]+_0xf9cb('0x73');}if(!isNotNull(_0x129fce['Interval'][_0xf9cb('0x74')])){_0x129fce[_0xf9cb('0x67')]=utils[_0xf9cb('0x68')][_0xf9cb('0x75')];throw _0x129fce['name']+_0xf9cb('0x73');}if(!isNotNull(_['isEmpty'](_0x129fce[_0xf9cb('0x76')]['Intervals']))){_0x129fce['message']=utils[_0xf9cb('0x68')][_0xf9cb('0x75')];throw _0x129fce[_0xf9cb('0x5e')]+_0xf9cb('0x73');}};}function checkIsIVRCampaignActive(_0x4c4530){return function(){if(!utils[_0xf9cb('0x77')](_0x4c4530)){_0x4c4530[_0xf9cb('0x67')]=utils[_0xf9cb('0x68')][_0xf9cb('0x78')];throw _0x4c4530[_0xf9cb('0x5e')]+_0xf9cb('0x79');}};}function emitCampaignSummary(_0x1de7ca){if(utils[_0xf9cb('0x7a')](_0x1de7ca)){emit(util[_0xf9cb('0x7b')](_0xf9cb('0x7c'),_0x1de7ca[_0xf9cb('0x5e')]),'campaign:save',_0x1de7ca);}}function loggerCatchQueueSummary(_0x2f9375,_0x137dc3){return function(_0x329f64){clearPredictiveAttributes(_0x137dc3);emitCampaignSummary(_0x137dc3);loggerSyncQueueSummary[_0xf9cb('0x40')](_0x2f9375,util[_0xf9cb('0x63')](_0x329f64,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1b061e){if(_0x1b061e[_0xf9cb('0x7d')]){if(_0x1b061e[_0xf9cb('0x7e')]===0x0){_0x1b061e[_0xf9cb('0x7d')]=![];_0x1b061e[_0xf9cb('0x67')]=utils[_0xf9cb('0x68')][_0xf9cb('0x78')];loggerSyncQueueSummary[_0xf9cb('0x40')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1b061e['name'],'is\x20not\x20active');}else{_0x1b061e['message']=utils['CAMPAIGN_STATUS'][_0xf9cb('0x7f')];loggerSyncQueueSummary[_0xf9cb('0x40')](_0xf9cb('0x80'),_0x1b061e['name'],_0xf9cb('0x81'));}emitCampaignSummary(_0x1b061e);}}function myreject(_0x47a2d2){return function(_0x5a634f){return _0x47a2d2(msgResponse(_0xf9cb('0x82'),_0xf9cb('0x83'),JSON[_0xf9cb('0x71')](_0x5a634f)));};}Dialer[_0xf9cb('0x84')][_0xf9cb('0x85')]=function(_0x298d0f){return!_[_0xf9cb('0x3e')](_0x298d0f)&&_0x298d0f&&!_[_0xf9cb('0x3e')](_0x298d0f[_0xf9cb('0x5e')])&&!_[_0xf9cb('0x3e')](_0x298d0f['active'])&&_0x298d0f[_0xf9cb('0x86')]&&(this[_0xf9cb('0x21')][util['format'](_0xf9cb('0x87'),_0x298d0f[_0xf9cb('0x5e')])]['status']===_0xf9cb('0x88')||this[_0xf9cb('0x21')][util['format'](_0xf9cb('0x87'),_0x298d0f['name'])][_0xf9cb('0x89')]===_0xf9cb('0x8a'));};Dialer['prototype'][_0xf9cb('0x8b')]=function(_0x42ece3){var _0x388523=this;return function(){if(!_0x388523[_0xf9cb('0x85')](_0x42ece3[_0xf9cb('0x8c')])){if(!_0x388523[_0xf9cb('0x85')](_0x42ece3[_0xf9cb('0x8d')])){_0x42ece3[_0xf9cb('0x67')]=utils[_0xf9cb('0x68')][_0xf9cb('0x8e')];throw _0x42ece3[_0xf9cb('0x5e')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0xf9cb('0x8f')]=function(_0x25e9c3,_0x82021b,_0xb7d88f,_0x5755b5){var _0x3639d7=this;return function(){var _0x3b2d9a=!![];return _0x3639d7[_0xf9cb('0x90')](_0x25e9c3,_0x82021b,_0xb7d88f,_0x5755b5,_0x3b2d9a);};};Dialer[_0xf9cb('0x84')][_0xf9cb('0x91')]=function(_0x47799f,_0x224e6e,_0x3ac8e1,_0x1bcc9a){var _0x2fe90b=this;return function(){var _0x42a2b3=![];return _0x2fe90b[_0xf9cb('0x90')](_0x47799f['Intervals'],_0x224e6e,_0x3ac8e1,_0x1bcc9a,_0x42a2b3);};};Dialer[_0xf9cb('0x84')][_0xf9cb('0x90')]=function(_0x45003e,_0x593970,_0x2c56b3,_0x5b1765,_0x239f8b){var _0x2fc277=[];return new Promise(function(_0x46a3b4,_0x500d9d){if(!isNotNull(_0x45003e)){_0x5b1765[_0xf9cb('0x67')]=utils[_0xf9cb('0x68')][_0xf9cb('0x75')];return _0x500d9d(msgResponse(_0xf9cb('0x92'),'Failure',_0x2c56b3+_0xf9cb('0x93')));}if(_['isEmpty'](_0x45003e)){_0x5b1765[_0xf9cb('0x67')]=utils[_0xf9cb('0x68')][_0xf9cb('0x94')];return _0x500d9d(msgResponse(_0xf9cb('0x92'),_0xf9cb('0x95'),_0x2c56b3+_0xf9cb('0x96')));}if(_0x593970&&_[_0xf9cb('0x3e')](config['timezones'][_0x593970])){_0x5b1765['message']=utils[_0xf9cb('0x68')][_0xf9cb('0x97')];return _0x500d9d(msgResponse(_0xf9cb('0x92'),_0xf9cb('0x95'),_0x2c56b3+_0xf9cb('0x98')+_0x593970));}if(_[_0xf9cb('0x99')](_0x45003e)){for(var _0x317ccd=0x0;_0x317ccd<_0x45003e[_0xf9cb('0x9a')];_0x317ccd+=0x1){_0x2fc277[_0xf9cb('0x9b')](ami[_0xf9cb('0x9c')]({'action':'command','command':util['format'](_0xf9cb('0x9d'),_0x45003e[_0x317ccd][_0xf9cb('0x9e')],!_[_0xf9cb('0x3e')](config[_0xf9cb('0x9f')][_0x593970])?_0x593970:'')})[_0xf9cb('0x3d')](function(_0x5068d1){return _0x5068d1[_0xf9cb('0xa0')][_0xf9cb('0xa1')](_0xf9cb('0xa2'))>=0x0;})[_0xf9cb('0xa3')](myreject(_0x500d9d)));}}else{_0x2fc277[_0xf9cb('0x9b')](ami['Action']({'action':_0xf9cb('0xa4'),'command':util['format']('iftime\x20%s,%s',_0x45003e,!_[_0xf9cb('0x3e')](config[_0xf9cb('0x9f')][_0x593970])?_0x593970:'')})[_0xf9cb('0x3d')](function(_0x11b5b2){return _0x11b5b2['content'][_0xf9cb('0xa1')](_0xf9cb('0xa2'))>=0x0;})[_0xf9cb('0xa3')](myreject(_0x500d9d)));}Promise[_0xf9cb('0xa5')](_0x2fc277)['then'](function(_0x4e6ea1){var _0x46fc37=_['some'](_0x4e6ea1);if(_0x46fc37){return _0x46a3b4(_0x46fc37);}else{_0x5b1765[_0xf9cb('0x67')]=_0x239f8b?utils[_0xf9cb('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xf9cb('0x68')][_0xf9cb('0xa6')];return _0x500d9d(msgResponse(_0xf9cb('0xa7'),'Failure',_0xf9cb('0xa8')+_0x239f8b+'\x20'+_0x2c56b3+_0xf9cb('0xa9')+util['inspect'](_0x45003e,{'showHidden':![],'depth':null})+_0xf9cb('0xaa')+_0x593970));}})[_0xf9cb('0xa3')](function(_0x3bd36b){return _0x500d9d(msgResponse(_0xf9cb('0x92'),_0xf9cb('0x95'),JSON['stringify'](_0x3bd36b)));});});};Dialer[_0xf9cb('0x84')][_0xf9cb('0xab')]=function(){var _0x15ae59=this;return cmHopper[_0xf9cb('0xac')]({'active':![]},{'where':{'active':!![]}})[_0xf9cb('0x3d')](function(){setInterval(function(){_0x15ae59['syncCampaigns']();},0x3e8);});};Dialer[_0xf9cb('0x84')][_0xf9cb('0xad')]=function(){var _0x4d0254=this;var _0x228fa1;for(var _0x412158 in this[_0xf9cb('0x1f')]){if(typeof this[_0xf9cb('0x1f')][_0x412158]!==_0xf9cb('0xae')){_0x228fa1=this[_0xf9cb('0x1f')][_0x412158];if(utils[_0xf9cb('0x7a')](_0x228fa1)&&utils['isIVRCampaignActive'](_0x228fa1)){_0x228fa1['sendMessageOneNotActive']=!![];Promise['resolve']()[_0xf9cb('0x3d')](checkIsIVRCampaignActive(_0x228fa1))[_0xf9cb('0x3d')](checkInterval(_0x228fa1))[_0xf9cb('0x3d')](_0x4d0254[_0xf9cb('0x8b')](_0x228fa1))[_0xf9cb('0x3d')](_0x4d0254[_0xf9cb('0x8f')](_0x228fa1[_0xf9cb('0xaf')],_0x228fa1['dialTimezone'],_0x228fa1[_0xf9cb('0x5e')],_0x228fa1))[_0xf9cb('0x3d')](_0x4d0254[_0xf9cb('0x91')](_0x228fa1[_0xf9cb('0x76')],_0x228fa1[_0xf9cb('0xb0')],_0x228fa1[_0xf9cb('0x5e')],_0x228fa1))[_0xf9cb('0x3d')](_0x4d0254[_0xf9cb('0xb1')](_0x228fa1))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x228fa1));}else{notSendMessagesCampaign(_0x228fa1);}}}};Dialer['prototype']['checkDialMethod']=function(_0x16bcff){if(_0x16bcff[_0xf9cb('0xb2')]!==_0xf9cb('0x9')){clearPredictiveAttributes(_0x16bcff);}switch(_0x16bcff[_0xf9cb('0xb2')]){case _0xf9cb('0xb3'):this['handlePower'](_0x16bcff,0x1);break;case'power':this[_0xf9cb('0xb4')](_0x16bcff,_0x16bcff['dialPowerLevel']);break;case _0xf9cb('0x9'):this['predictive'](_0x16bcff);break;case _0xf9cb('0x8'):this[_0xf9cb('0xb4')](_0x16bcff,0x1);break;default:logger[_0xf9cb('0x61')]('Queue',_0x16bcff['name'],'method\x20not\x20recognized');}};Dialer[_0xf9cb('0x84')][_0xf9cb('0x92')]=function(_0xcce9f,_0xe27778){var _0x6afdef=_0xcce9f['dialTimezone'];var _0x38c55c=_0xe27778?_0xcce9f['dialGlobalInterval']:_0xcce9f[_0xf9cb('0x76')][_0xf9cb('0x74')];logger['silly'](_0xf9cb('0xb5'),_0x38c55c,_0x6afdef,_0xcce9f[_0xf9cb('0x5e')],util['format'](_0xf9cb('0xb6'),_0xcce9f['name'],_0xcce9f['id']));var _0x35fe80=null;return Interval[_0xf9cb('0xb7')](_0x38c55c,_0x6afdef)[_0xf9cb('0x3d')](function(_0x209a31){if(_0x209a31===!![]){return _0x209a31;}else{_0xcce9f[_0xf9cb('0x67')]=_0xe27778?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0xf9cb('0x68')]['OVERTIME_INTERVAL'];_0x35fe80=msgResponse(_0xf9cb('0xa7'),_0xf9cb('0x95'),'Global:\x20'+_0xe27778+'\x20'+_0xcce9f[_0xf9cb('0x5e')]+_0xf9cb('0xa9')+util['inspect'](_0x38c55c,{'showHidden':![],'depth':null})+_0xf9cb('0xaa')+_0x6afdef);}if(_0x35fe80!==null){logger[_0xf9cb('0xb8')](_0xf9cb('0xb9'),_0x35fe80);_0x35fe80[_0xf9cb('0xba')]=_0xe27778;throw _0x35fe80;}})[_0xf9cb('0xa3')](function(_0x547359){logger[_0xf9cb('0x61')](_0xf9cb('0xbb'),_0x547359);throw msgResponse(_0xf9cb('0x82'),_0xf9cb('0x83'),util[_0xf9cb('0x63')](_0x547359,{'showHidden':![],'depth':null}));});};Dialer[_0xf9cb('0x84')][_0xf9cb('0xbc')]=function(_0x117f39){if(this['voiceQueues'][_0x117f39[_0xf9cb('0xbd')]]){if(this[_0xf9cb('0xbe')][_0x117f39[_0xf9cb('0xbf')]]&&this[_0xf9cb('0xbe')][_0x117f39[_0xf9cb('0xbf')]][_0xf9cb('0xc0')]!==_0xf9cb('0xc1')){this['updateOriginated'](this[_0xf9cb('0x1e')][_0x117f39[_0xf9cb('0xbd')]]);this[_0xf9cb('0xbe')][_0x117f39[_0xf9cb('0xbf')]]['answertime']=moment()[_0xf9cb('0x7b')](_0xf9cb('0xc2'));}}};Dialer[_0xf9cb('0x84')][_0xf9cb('0x31')]=function(_0x80e3a6){var _0xabc0b=this[_0xf9cb('0xbe')][_0x80e3a6[_0xf9cb('0xbf')]];if(this[_0xf9cb('0x1e')][_0x80e3a6[_0xf9cb('0xbd')]]){if(_0xabc0b&&_0xabc0b[_0xf9cb('0xc0')]!==_0xf9cb('0xc1')){delete this[_0xf9cb('0xbe')][_0x80e3a6[_0xf9cb('0xbf')]];this[_0xf9cb('0x1e')][_0x80e3a6[_0xf9cb('0xbd')]][_0xf9cb('0xc3')]+=0x1;var _0x3dbc83=new AgentComplete(_0xabc0b,_0x80e3a6);if(_0x80e3a6[_0xf9cb('0xc4')]===_0xf9cb('0xc5')){_0x3dbc83[_0xf9cb('0xc6')]=this[_0xf9cb('0x1e')][_0x80e3a6[_0xf9cb('0xbd')]][_0xf9cb('0xc7')]&&this['voiceQueues'][_0x80e3a6['queue']][_0xf9cb('0xc8')]?moment()['format'](_0xf9cb('0xc2')):undefined;}hopperUtils[_0xf9cb('0xc9')](_0x3dbc83)['catch'](loggerCatch(_0xf9cb('0xca')));hopperUtils['moveContactManagedDialer'](_0x3dbc83)[_0xf9cb('0xa3')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xf9cb('0x84')][_0xf9cb('0x2e')]=function(_0x58961f){var _0x402a48=this[_0xf9cb('0xbe')][_0x58961f[_0xf9cb('0xbf')]];var _0x130a50=this;var _0x240c0f=![];var _0x4f53e5;var _0x1bf370;if(this[_0xf9cb('0x1e')][_0x58961f[_0xf9cb('0xbd')]]){if(_0x402a48&&_0x402a48['type']!==_0xf9cb('0xc1')){delete this[_0xf9cb('0xbe')][_0x58961f[_0xf9cb('0xbf')]];this['updateOriginated'](this[_0xf9cb('0x1e')][_0x58961f[_0xf9cb('0xbd')]]);_0x402a48['droptime']=moment()['format'](_0xf9cb('0xc2'));var _0x40b7c2=new QueueCallerAbandon(_0x402a48,_0x58961f);if(utils[_0xf9cb('0x5c')](_0x402a48[_0xf9cb('0xcb')],_0x402a48[_0xf9cb('0xcc')])>=_0x402a48['dialQueueTimeout']){this['voiceQueues'][_0x58961f[_0xf9cb('0xbd')]][_0xf9cb('0x48')]+=0x1;this['voiceQueues'][_0x58961f[_0xf9cb('0xbd')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xf9cb('0x1e')][_0x58961f[_0xf9cb('0xbd')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x40b7c2[_0xf9cb('0x6d')]=0xa;_0x40b7c2['statedesc']='Drop';_0x40b7c2[_0xf9cb('0xcd')]='TIMEOUT';_0x40b7c2['agiafterat']=this[_0xf9cb('0x1e')][_0x58961f[_0xf9cb('0xbd')]][_0xf9cb('0xc7')]?moment()[_0xf9cb('0x7b')](_0xf9cb('0xc2')):undefined;_0x40b7c2[_0xf9cb('0xce')]+=0x1;_0x40b7c2[_0xf9cb('0xcf')]+=0x1;_0x4f53e5=this['voiceQueues'][_0x58961f[_0xf9cb('0xbd')]][_0xf9cb('0xd0')];_0x1bf370=this[_0xf9cb('0x1e')][_0x58961f[_0xf9cb('0xbd')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xf9cb('0xd1')](_0x40b7c2,_0x40b7c2[_0xf9cb('0x6d')],_0x402a48['voiceQueue'])[_0xf9cb('0x3d')](function(_0x12e5d5){_0x240c0f=_0x12e5d5[_0xf9cb('0xd2')]==0x1;if(_0x40b7c2[_0xf9cb('0xce')]>=_0x130a50[_0xf9cb('0x1e')][_0x58961f[_0xf9cb('0xbd')]][_0xf9cb('0xd3')]){_0x130a50[_0xf9cb('0xd4')](_0x40b7c2,_0x12e5d5['additional']);}else{hopperUtils[_0xf9cb('0xd5')]({'active':![],'countdropretry':_0x40b7c2['countdropretry'],'scheduledat':moment()[_0xf9cb('0xd6')](_0x130a50[_0xf9cb('0x1e')][_0x58961f[_0xf9cb('0xbd')]][_0xf9cb('0xd0')],_0xf9cb('0xd7'))[_0xf9cb('0x7b')](_0xf9cb('0xc2')),'ContactId':_0x402a48[_0xf9cb('0xd8')],'ListId':_0x402a48[_0xf9cb('0xd9')],'VoiceQueueId':_0x402a48[_0xf9cb('0xda')]||undefined,'CampaignId':_0x402a48['CampaignId']||undefined})['catch'](loggerCatch(_0xf9cb('0xdb')));var _0x50da42=new History(_0x40b7c2);_0x50da42[_0xf9cb('0x6d')]=0xa;_0x50da42[_0xf9cb('0x6e')]='Drop';_0x50da42[_0xf9cb('0xdc')]=moment()[_0xf9cb('0x7b')](_0xf9cb('0xc2'));_0x50da42[_0xf9cb('0x6f')]=_0x50da42[_0xf9cb('0xdc')];_0x50da42[_0xf9cb('0xdd')]=_0x40b7c2[_0xf9cb('0xdd')];_0x50da42[_0xf9cb('0xde')]=_0x40b7c2['calleridnum'];hopperUtils[_0xf9cb('0xc9')](_0x50da42)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0xdf')));}})[_0xf9cb('0x3d')](function(){if(_0x240c0f)hopperUtils[_0xf9cb('0xe0')](_0x40b7c2,_0x4f53e5,_0x1bf370)[_0xf9cb('0x3d')](function(){return 0x1;});});}else{this[_0xf9cb('0x1e')][_0x58961f[_0xf9cb('0xbd')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x58961f[_0xf9cb('0xbd')]][_0xf9cb('0xe1')]+=0x1;_0x40b7c2[_0xf9cb('0x6d')]=0xb;_0x40b7c2[_0xf9cb('0x6e')]='Abandoned';_0x40b7c2[_0xf9cb('0xcd')]=_0xf9cb('0xe2');_0x40b7c2[_0xf9cb('0xe3')]+=0x1;_0x40b7c2[_0xf9cb('0xcf')]+=0x1;_0x4f53e5=this[_0xf9cb('0x1e')][_0x58961f[_0xf9cb('0xbd')]]['dialAbandonedRetryFrequency'];_0x1bf370=this[_0xf9cb('0x1e')][_0x58961f[_0xf9cb('0xbd')]][_0xf9cb('0xe4')];hopperUtils[_0xf9cb('0xd1')](_0x40b7c2,_0x40b7c2['state'],_0x402a48[_0xf9cb('0xe5')])[_0xf9cb('0x3d')](function(_0x546928){if(_0x40b7c2[_0xf9cb('0xe3')]>=_0x130a50[_0xf9cb('0x1e')][_0x58961f[_0xf9cb('0xbd')]][_0xf9cb('0xe6')]){_0x130a50[_0xf9cb('0xd4')](_0x40b7c2,_0x546928[_0xf9cb('0xd2')]);}else{hopperUtils[_0xf9cb('0xd5')]({'active':![],'countabandonedretry':_0x40b7c2['countabandonedretry'],'scheduledat':moment()[_0xf9cb('0xd6')](_0x130a50['voiceQueues'][_0x58961f['queue']][_0xf9cb('0xe7')],_0xf9cb('0xd7'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x402a48['ContactId'],'ListId':_0x402a48[_0xf9cb('0xd9')],'VoiceQueueId':_0x402a48[_0xf9cb('0xda')]||undefined,'CampaignId':_0x402a48['CampaignId']||undefined})[_0xf9cb('0xa3')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x58006a=new History(_0x40b7c2);_0x58006a[_0xf9cb('0x6d')]=0xb;_0x58006a[_0xf9cb('0x6e')]=_0xf9cb('0xe8');_0x58006a[_0xf9cb('0xdc')]=moment()[_0xf9cb('0x7b')](_0xf9cb('0xc2'));_0x58006a[_0xf9cb('0x6f')]=_0x58006a['starttime'];_0x58006a[_0xf9cb('0xdd')]=_0x40b7c2[_0xf9cb('0xdd')];_0x58006a[_0xf9cb('0xde')]=_0x40b7c2[_0xf9cb('0xde')];hopperUtils[_0xf9cb('0xc9')](_0x58006a)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0xe9')));}})[_0xf9cb('0x3d')](function(){if(_0x240c0f)hopperUtils[_0xf9cb('0xe0')](_0x40b7c2,_0x4f53e5,_0x1bf370)['then'](function(){return 0x1;});});}}}};Dialer[_0xf9cb('0x84')][_0xf9cb('0xea')]=function(_0x17ee87){if(this[_0xf9cb('0xeb')][_0x17ee87[_0xf9cb('0xbf')]]){this['actions'][_0x17ee87[_0xf9cb('0xbf')]]['channel']=_0x17ee87[_0xf9cb('0xec')];}if(this['uniqueId'][_0x17ee87['uniqueid']]){this[_0xf9cb('0xbe')][_0x17ee87[_0xf9cb('0xbf')]][_0xf9cb('0xec')]=_0x17ee87[_0xf9cb('0xec')];}};Dialer[_0xf9cb('0x84')]['syncQueueMember']=function(_0xa671a9){if(!this['actions'][_0xa671a9[_0xf9cb('0xed')]]){return;}var _0x24b6bc=this[_0xf9cb('0x1e')][this[_0xf9cb('0xeb')][_0xa671a9['actionid']][_0xf9cb('0xbd')]]['strategy']||'rrmemory';if(_0x24b6bc==='roundrobin'){if(this[_0xf9cb('0xeb')][_0xa671a9['actionid']]&&_[_0xf9cb('0xee')](this[_0xf9cb('0xeb')][_0xa671a9['actionid']][_0xf9cb('0xef')])&&_0xa671a9[_0xf9cb('0x89')]==='1'&&_0xa671a9[_0xf9cb('0xf0')]==='0'){if(this[_0xf9cb('0x20')][_0xa671a9[_0xf9cb('0xf1')]]){if(!this[_0xf9cb('0x20')][_0xa671a9[_0xf9cb('0xf1')]][_0xf9cb('0xef')]){this[_0xf9cb('0x20')][_0xa671a9[_0xf9cb('0xf1')]]['locked']=!![];this[_0xf9cb('0xeb')][_0xa671a9['actionid']]['locked']=!![];this['actions'][_0xa671a9[_0xf9cb('0xed')]][_0xf9cb('0xf1')]=_0xa671a9['stateinterface'];}}}}else if(_0x24b6bc==='rrmemory'){if(this['actions'][_0xa671a9[_0xf9cb('0xed')]]){if(this[_0xf9cb('0x20')][_0xa671a9[_0xf9cb('0xf1')]]){this[_0xf9cb('0xeb')][_0xa671a9[_0xf9cb('0xed')]][_0xf9cb('0xf1')]=_0xa671a9['stateinterface'];if(_['isNil'](this[_0xf9cb('0x29')][this[_0xf9cb('0xeb')][_0xa671a9[_0xf9cb('0xed')]]['queue']])){this['queueBooked'][this[_0xf9cb('0xeb')][_0xa671a9[_0xf9cb('0xed')]][_0xf9cb('0xbd')]]=[];}this['queueBooked'][this[_0xf9cb('0xeb')][_0xa671a9[_0xf9cb('0xed')]][_0xf9cb('0xbd')]][_0xf9cb('0x9b')](_[_0xf9cb('0xf2')](_['pick'](this[_0xf9cb('0xeb')][_0xa671a9['actionid']],['idHopper',_0xf9cb('0xf1')]),{'status':_0xa671a9[_0xf9cb('0x89')],'paused':_0xa671a9['paused']}));}}}};Dialer[_0xf9cb('0x84')]['syncQueueStatusComplete']=function(_0x15680e){if(!this[_0xf9cb('0xeb')][_0x15680e['actionid']]){return;}var _0x1cde4e=this;var _0x33e18c=this[_0xf9cb('0x1e')][this['actions'][_0x15680e['actionid']][_0xf9cb('0xbd')]];var _0x525220=_0x33e18c['strategy']||_0xf9cb('0xf3');if(_0x525220===_0xf9cb('0xf4')){if(this[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]]&&this['actions'][_0x15680e[_0xf9cb('0xed')]]['stateinterface']){this['preview'][_0xf9cb('0xf5')](this[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]][_0xf9cb('0xf6')],this[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]][_0xf9cb('0xf1')])[_0xf9cb('0xa3')](function(_0x1cbced){logger[_0xf9cb('0x61')](_0xf9cb('0xf7'),util[_0xf9cb('0x63')](_0x1cbced,{'showHidden':![],'depth':null}));})[_0xf9cb('0x1c')](function(){_0x1cde4e['updateOriginated'](_0x1cde4e[_0xf9cb('0x1e')][_0x1cde4e[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]]['queue']]);_0x1cde4e['agents'][_0x1cde4e[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]]['stateinterface']][_0xf9cb('0xef')]=![];delete _0x1cde4e[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]];unlockQueueStatus(_0x33e18c);});}else{this[_0xf9cb('0xf8')](this['voiceQueues'][this[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]]['queue']]);hopperUtils[_0xf9cb('0xd5')]({'active':![],'ContactId':this[_0xf9cb('0xeb')][_0x15680e['actionid']][_0xf9cb('0xd8')],'ListId':this['actions'][_0x15680e[_0xf9cb('0xed')]][_0xf9cb('0xd9')],'VoiceQueueId':this[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]][_0xf9cb('0xda')]||undefined,'CampaignId':this[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]][_0xf9cb('0xf9')]||undefined})[_0xf9cb('0xa3')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x15680e[_0xf9cb('0xed')]];unlockQueueStatus(_0x33e18c);}}else if(_0x525220===_0xf9cb('0xf3')){var _0x4b2124;if(this['actions'][_0x15680e[_0xf9cb('0xed')]]&&!_[_0xf9cb('0x43')](this[_0xf9cb('0x29')][this[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]][_0xf9cb('0xbd')]])){if(this['queueBookedRR'][_0x1cde4e[_0xf9cb('0xeb')][_0x15680e['actionid']]['queue']]){this[_0xf9cb('0xfa')][_0x1cde4e[_0xf9cb('0xeb')][_0x15680e['actionid']][_0xf9cb('0xbd')]]=this[_0xf9cb('0xfa')][this[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]]['queue']]?this[_0xf9cb('0xfa')][this[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]][_0xf9cb('0xbd')]]:this['queueBooked'][this[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]]['queue']]?this[_0xf9cb('0x29')][this[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]][_0xf9cb('0xbd')]]['_rr']||0x0:0x0;}this['queueBooked'][this[_0xf9cb('0xeb')][_0x15680e[_0xf9cb('0xed')]][_0xf9cb('0xbd')]]['_rr']=this[_0xf9cb('0xfa')][this['actions'][_0x15680e[_0xf9cb('0xed')]][_0xf9cb('0xbd')]];for(var _0x5f3c17=0x0;_0x5f3c17=_0x24f31a[_0xf9cb('0x122')]){_0x1171c5[_0xf9cb('0x123')](_0x367c7a,_0x23edcb,_0x338c7f,_0xf9cb('0x124'));}else{if(_0x367c7a['countmachineretry']>=_0x24f31a[_0xf9cb('0x125')]){_0x1171c5[_0xf9cb('0x126')](_0x367c7a,_0x23edcb,_0x338c7f,_0xf9cb('0x127'));}else{hopperUtils[_0xf9cb('0xd5')]({'active':![],'countmachineretry':_0x367c7a[_0xf9cb('0x11a')],'scheduledat':moment()[_0xf9cb('0xd6')](_0x24f31a[_0xf9cb('0x128')],_0xf9cb('0xd7'))['format'](_0xf9cb('0xc2')),'ContactId':_0x367c7a[_0xf9cb('0xd8')],'ListId':_0x367c7a['ListId'],'VoiceQueueId':_0x367c7a[_0xf9cb('0xda')]||undefined,'CampaignId':_0x367c7a[_0xf9cb('0xf9')]||undefined})[_0xf9cb('0xa3')](loggerCatch('[rescheduleContact][Machine]'));_0x23edcb({'reschedule':0x1});}}});}if(_0x365d40[_0xf9cb('0xc0')]===_0xf9cb('0xc1')&&this[_0xf9cb('0x1f')][_0x365d40['queue']][_0xf9cb('0x118')]&&_0x198ab9['value']==='HANGUP'){delete this[_0xf9cb('0xbe')][_0x198ab9['uniqueid']];this[_0xf9cb('0xf8')](this[_0xf9cb('0x1f')][_0x365d40[_0xf9cb('0xbd')]]);_0x490fd6=new Hangup(_0x365d40,_0x198ab9);_0x490fd6['state']=0x12;_0x490fd6[_0xf9cb('0x6e')]=_0xf9cb('0x129');_0x490fd6['membername']=_0xf9cb('0x113');ami[_0xf9cb('0x3f')](_0xf9cb('0x114'),ut[_0xf9cb('0x115')](_0x490fd6,_0xf9cb('0x11b')));this[_0xf9cb('0x116')](_0x490fd6,'[syncHangupInAMDIvr][createHistory]',_0xf9cb('0x12a'));}if(_0x365d40['type']==='ivr'&&this[_0xf9cb('0x1f')][_0x365d40['queue']]['dialAMDActive']&&_0x198ab9['value']===_0xf9cb('0x12b')){return new Promise(function(_0x53ca5e,_0x1b6e0f){delete _0x1171c5['uniqueId'][_0x198ab9[_0xf9cb('0xbf')]];_0x1171c5[_0xf9cb('0xf8')](_0x1171c5[_0xf9cb('0x1f')][_0x365d40[_0xf9cb('0xbd')]]);_0x1171c5[_0xf9cb('0x1f')][_0x365d40[_0xf9cb('0xbd')]][_0xf9cb('0xc3')]+=0x1;_0x1171c5[_0xf9cb('0x1f')][_0x365d40[_0xf9cb('0xbd')]][_0xf9cb('0x12c')]+=0x1;var _0x3a0804=_0x1171c5[_0xf9cb('0x1f')][_0x365d40['queue']];var _0x2ecbf4=new Hangup(_0x365d40,_0x198ab9);_0x2ecbf4['state']=0x13;_0x2ecbf4[_0xf9cb('0x6e')]=_0xf9cb('0x119');_0x2ecbf4[_0xf9cb('0x112')]=_0xf9cb('0x113');_0x2ecbf4[_0xf9cb('0x11a')]+=0x1;_0x2ecbf4[_0xf9cb('0xcf')]+=0x1;_0x2ecbf4[_0xf9cb('0x11b')]=!![];ami['emit'](_0xf9cb('0x114'),ut[_0xf9cb('0x115')](_0x2ecbf4,_0xf9cb('0x11b')));hopperUtils['createHistory'](_0x2ecbf4)[_0xf9cb('0xa3')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2ecbf4[_0xf9cb('0x11d')]+_0x2ecbf4[_0xf9cb('0x11e')]+_0x2ecbf4[_0xf9cb('0x11f')]+_0x2ecbf4[_0xf9cb('0x120')]+_0x2ecbf4[_0xf9cb('0xce')]+_0x2ecbf4[_0xf9cb('0xe3')]+_0x2ecbf4[_0xf9cb('0x11a')]+_0x2ecbf4[_0xf9cb('0x121')]>=_0x3a0804[_0xf9cb('0x122')]){_0x1171c5[_0xf9cb('0x123')](_0x2ecbf4,_0x53ca5e,_0x1b6e0f,_0xf9cb('0x124'));}else{if(_0x2ecbf4[_0xf9cb('0x11a')]>=_0x3a0804[_0xf9cb('0x125')]){_0x1171c5[_0xf9cb('0x126')](_0x2ecbf4,_0x53ca5e,_0x1b6e0f,_0xf9cb('0x127'));}else{hopperUtils[_0xf9cb('0xd5')]({'active':![],'countmachineretry':_0x2ecbf4[_0xf9cb('0x11a')],'scheduledat':moment()[_0xf9cb('0xd6')](_0x3a0804[_0xf9cb('0x128')],_0xf9cb('0xd7'))['format'](_0xf9cb('0xc2')),'ContactId':_0x2ecbf4[_0xf9cb('0xd8')],'ListId':_0x2ecbf4[_0xf9cb('0xd9')],'VoiceQueueId':_0x2ecbf4[_0xf9cb('0xda')]||undefined,'CampaignId':_0x2ecbf4[_0xf9cb('0xf9')]||undefined})[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x12d')));_0x53ca5e({'reschedule':0x1});}}});}}};Dialer[_0xf9cb('0x84')][_0xf9cb('0x36')]=function(_0x5a9be9){var _0x485d7d=this[_0xf9cb('0xbe')][_0x5a9be9[_0xf9cb('0xbf')]];var _0x465e36;if(_0x485d7d&&_0x485d7d[_0xf9cb('0xc0')]===_0xf9cb('0xc1')){delete this[_0xf9cb('0xbe')][_0x5a9be9[_0xf9cb('0xbf')]];this['updateOriginated'](this[_0xf9cb('0x1f')][_0x485d7d[_0xf9cb('0xbd')]]);this[_0xf9cb('0x1f')][_0x485d7d[_0xf9cb('0xbd')]][_0xf9cb('0x12e')]+=0x1;_0x465e36=new Hangup(_0x485d7d,_0x5a9be9);hopperUtils[_0xf9cb('0xc9')](_0x465e36)[_0xf9cb('0xa3')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x465e36)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x12f')));}if(_0x485d7d&&_0x485d7d[_0xf9cb('0xc0')]!==_0xf9cb('0xc1')&&isNotNull(this[_0xf9cb('0x1e')][_0x485d7d[_0xf9cb('0xbd')]]['dialQueueProject'])){delete this[_0xf9cb('0xbe')][_0x5a9be9[_0xf9cb('0xbf')]];this['updateOriginated'](this[_0xf9cb('0x1e')][_0x485d7d[_0xf9cb('0xbd')]]);this[_0xf9cb('0x1e')][_0x485d7d[_0xf9cb('0xbd')]][_0xf9cb('0xc3')]+=0x1;this['voiceQueues'][_0x485d7d[_0xf9cb('0xbd')]][_0xf9cb('0x12c')]+=0x1;_0x465e36=new Hangup(_0x485d7d,_0x5a9be9);_0x465e36[_0xf9cb('0x6d')]=0x10;_0x465e36[_0xf9cb('0x6e')]=_0xf9cb('0x130');_0x465e36[_0xf9cb('0x112')]=_0xf9cb('0x131');hopperUtils[_0xf9cb('0xc9')](_0x465e36)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x132')));hopperUtils['moveContactManagedDialer'](_0x465e36)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x12f')));}if(_0x485d7d&&_0x485d7d[_0xf9cb('0xc0')]!=='ivr'&&!isNotNull(this[_0xf9cb('0x1e')][_0x485d7d[_0xf9cb('0xbd')]][_0xf9cb('0x133')])){if(_0x5a9be9[_0xf9cb('0x134')]===_0xf9cb('0x135')){delete this['uniqueId'][_0x5a9be9[_0xf9cb('0xbf')]];this['voiceQueues'][_0x485d7d[_0xf9cb('0xbd')]][_0xf9cb('0xc3')]+=0x1;const _0x5acfa9=new AgentComplete(_0x485d7d,_0x5a9be9);_0x5acfa9[_0xf9cb('0xf9')]=this[_0xf9cb('0x1e')][_0x485d7d[_0xf9cb('0xbd')]]['id'];hopperUtils['createHistory'](_0x5acfa9)['catch'](loggerCatch(_0xf9cb('0xca')));hopperUtils[_0xf9cb('0x136')](_0x5acfa9)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x137')));}else{delete this['uniqueId'][_0x5a9be9[_0xf9cb('0xbf')]];this[_0xf9cb('0xf8')](this[_0xf9cb('0x1e')][_0x485d7d['queue']]);this[_0xf9cb('0x1e')][_0x485d7d[_0xf9cb('0xbd')]][_0xf9cb('0x138')]+=0x1;_0x465e36=new Hangup(_0x485d7d,_0x5a9be9);_0x465e36[_0xf9cb('0x6d')]=0xc;_0x465e36[_0xf9cb('0x6e')]=_0x5a9be9[_0xf9cb('0x134')];_0x465e36['membername']=_0xf9cb('0x139');hopperUtils[_0xf9cb('0xc9')](_0x465e36)['catch'](loggerCatch(_0xf9cb('0x132')));hopperUtils[_0xf9cb('0x136')](_0x465e36)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x12f')));}}};Dialer['prototype'][_0xf9cb('0xb')]=function(_0x139ae6){var _0x433b07=this;if(!_0x433b07[_0xf9cb('0x2a')][_0x139ae6['name']]){_0x433b07['queuesSummary'][_0x139ae6[_0xf9cb('0x5e')]]={'running':![]};}else if(_0x433b07[_0xf9cb('0x2a')][_0x139ae6[_0xf9cb('0x5e')]]['running']===!![]){return;}else if(_0x433b07['queuesSummary'][_0x139ae6[_0xf9cb('0x5e')]][_0xf9cb('0x13a')]===![]){_0x433b07[_0xf9cb('0x2a')][_0x139ae6[_0xf9cb('0x5e')]][_0xf9cb('0x13a')]=!![];}var _0x4e2a78=_0x433b07[_0xf9cb('0x1e')][_0x139ae6['name']];var _0x264a73=_0x4e2a78[_0xf9cb('0x67')]!==utils[_0xf9cb('0x68')][_0xf9cb('0x78')];var _0x6f121b=utils['isPreviewCampaign'](_0x4e2a78);_0x4e2a78[_0xf9cb('0x13b')]=utils[_0xf9cb('0x13c')](_0x4e2a78,_0x433b07[_0xf9cb('0x21')]);Promise[_0xf9cb('0x13d')]()[_0xf9cb('0x3d')](function(){if(_0x4e2a78[_0xf9cb('0x13b')]===utils[_0xf9cb('0x68')]['INACTIVE']){if(_0x264a73){clearPredictiveAttributes(_0x4e2a78);_0x139ae6[_0xf9cb('0x26')]=undefined;_0x139ae6['startProgressive']=undefined;}if(_0x4e2a78['statusMessage']===utils[_0xf9cb('0x68')]['INACTIVE']){_0x139ae6[_0xf9cb('0x13e')]=0x0;_0x139ae6[_0xf9cb('0xf0')]=0x0;_0x139ae6[_0xf9cb('0x13f')]=0x0;_0x139ae6[_0xf9cb('0x140')]=0x0;_0x139ae6[_0xf9cb('0x141')]=0x0;}}else if(_0x4e2a78[_0xf9cb('0x13b')]===utils[_0xf9cb('0x68')][_0xf9cb('0x142')]&&!_0x6f121b){return _0x433b07[_0xf9cb('0x92')](_0x4e2a78,!![])['then'](function(){return _0x433b07[_0xf9cb('0x92')](_0x4e2a78,![]);})[_0xf9cb('0x3d')](function(){return _0x433b07[_0xf9cb('0x143')](_0x4e2a78);})[_0xf9cb('0xa3')](function(_0x472b08){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util['inspect'](_0x472b08,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4e2a78);});}else{clearPredictiveAttributes(_0x4e2a78);}})[_0xf9cb('0x3d')](function(){var _0x1c15d7=_0x139ae6['compareToOutboundQueue'](_0x4e2a78);if(_0x1c15d7||_0x4e2a78['queueSummaryCountersUpdated']){_0x4e2a78[_0xf9cb('0x144')]=![];_0x139ae6[_0xf9cb('0x145')](_0x4e2a78);Object[_0xf9cb('0x146')](_0x4e2a78,_0x139ae6);emitOutboundVoiceQueueSummary(_0x139ae6);}_0x433b07['queuesSummary'][_0x4e2a78[_0xf9cb('0x5e')]][_0xf9cb('0x13a')]=![];})[_0xf9cb('0xa3')](function(_0x3168ec){logger[_0xf9cb('0x61')]('[syncQueueSummary]',util[_0xf9cb('0x63')](_0x3168ec,{'showHidden':![],'depth':null}));_0x433b07[_0xf9cb('0x2a')][_0x4e2a78[_0xf9cb('0x5e')]][_0xf9cb('0x13a')]=![];});};Dialer[_0xf9cb('0x84')][_0xf9cb('0x34')]=_[_0xf9cb('0x147')](function(){var _0x12c2fb=_[_0xf9cb('0x148')](this['voiceQueues'],function(_0xe01bec){return _0xe01bec[_0xf9cb('0x149')];});var _0x39d70f=_[_0xf9cb('0x148')](this[_0xf9cb('0x20')],function(_0x4aa39a){return _0x4aa39a[_0xf9cb('0x14a')]&&_0x4aa39a[_0xf9cb('0x89')]==='reachable';});if(_0x12c2fb[_0xf9cb('0x9a')]>0x0&&_0x39d70f[_0xf9cb('0x9a')]>0x0){return Promise[_0xf9cb('0x13d')]()[_0xf9cb('0x3d')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x12c2fb,'id'),previewRecallmeReminderInterval,_[_0xf9cb('0x14b')](_0x39d70f,'id')))['then'](function(_0xc8e997){for(var _0x9ffc59=0x0;_0x9ffc59<_0xc8e997[_0xf9cb('0x9a')];_0x9ffc59++){var _0x15f1be=_0xc8e997[_0x9ffc59][_0xf9cb('0x14c')][_0xf9cb('0x5e')];if(_0x15f1be)io['to'](util[_0xf9cb('0x7b')](_0xf9cb('0x14d'),_0x15f1be))['emit'](_0xf9cb('0x14e'),{'hopper':_0xc8e997[_0x9ffc59]});}})[_0xf9cb('0xa3')](function(_0x31c197){logger[_0xf9cb('0x61')]('checkPreviewRecallReminder',_0x31c197);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0xf9cb('0x3b')]=function(){var _0x505287=this;setInterval(function(){_0x505287['clearZombieChannels'](_0x505287[_0xf9cb('0xbe')],_0xf9cb('0x14f'));_0x505287[_0xf9cb('0x150')](_0x505287[_0xf9cb('0xeb')],_0xf9cb('0x151'));},0x32c8);};Dialer['prototype'][_0xf9cb('0x150')]=function(_0x2e40c9,_0x102744){var _0x3bc66f=this;for(var _0x3a899c in _0x2e40c9){if(typeof _0x2e40c9[_0x3a899c]!==_0xf9cb('0xae')){this[_0xf9cb('0x1d')][_0xf9cb('0x1a')](function(){if(!_[_0xf9cb('0xee')](_0x2e40c9[_0x3a899c])){return ami[_0xf9cb('0x9c')]({'action':_0xf9cb('0x89'),'channel':_0x2e40c9[_0x3a899c][_0xf9cb('0xec')]})[_0xf9cb('0xa3')](function(_0x39dc97){if(_0x39dc97[_0xf9cb('0x67')]===_0xf9cb('0x152')){setTimeout(function(){if(_0x2e40c9[_0x3a899c]&&_0x2e40c9[_0x3a899c][_0xf9cb('0xc0')]!==_0xf9cb('0xc1')){_0x3bc66f[_0xf9cb('0xf8')](_0x3bc66f[_0xf9cb('0x1e')][_0x2e40c9[_0x3a899c][_0xf9cb('0xbd')]]);logger['error'](_0xf9cb('0x153'),_0x102744,_0x3a899c,_0x2e40c9[_0x3a899c][_0xf9cb('0xbd')]);delete _0x2e40c9[_0x3a899c];}if(_0x2e40c9[_0x3a899c]&&_0x2e40c9[_0x3a899c][_0xf9cb('0xc0')]===_0xf9cb('0xc1')){_0x3bc66f[_0xf9cb('0xf8')](_0x3bc66f[_0xf9cb('0x1f')][_0x2e40c9[_0x3a899c]['queue']]);logger['error'](_0xf9cb('0x154'),_0x102744,_0x3a899c,_0x2e40c9[_0x3a899c]['queue']);delete _0x2e40c9[_0x3a899c];}},0x2328);}});}});}}};Dialer[_0xf9cb('0x84')][_0xf9cb('0x155')]=function(_0x4cfe5d){return Promise[_0xf9cb('0x13d')]()[_0xf9cb('0x3d')](voiceQueueRt[_0xf9cb('0x155')](_0x4cfe5d))['catch'](loggerCatch(_0xf9cb('0x156')));};Dialer[_0xf9cb('0x84')][_0xf9cb('0xf8')]=function(_0x598d47){if(!_['isUndefined'](_0x598d47)&&_0x598d47!==null){if(typeof _0x598d47[_0xf9cb('0x7e')]!==_0xf9cb('0xae')){if(_0x598d47[_0xf9cb('0x7e')]>0x0){_0x598d47[_0xf9cb('0x7e')]-=0x1;}else{logger[_0xf9cb('0x61')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xf9cb('0x61')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0xf9cb('0x157')]=function(_0x441f0f,_0xaa5e78){var _0x5d39b2=this;return function(_0x3b9a86){_0x5d39b2[_0xf9cb('0xf8')](_0xaa5e78);logger['error'](_0x441f0f,util[_0xf9cb('0x63')](_0x3b9a86,{'showHidden':![],'depth':null}));};};Dialer[_0xf9cb('0x84')]['emptyContact']=function(_0x3450c0,_0x8608bd,_0x298e40){var _0x43ad00={'state':0x19,'statedesc':_0xf9cb('0x158')};this['updateOriginated'](_0x8608bd);this[_0xf9cb('0x116')](_[_0xf9cb('0xf2')](_0x43ad00,_[_0xf9cb('0x72')](_0x298e40,['ContactId','ListId',_0xf9cb('0x159'),_0xf9cb('0xda'),_0xf9cb('0xf9')])),'[emptyContact][createHistory]','[emptyContact]');logger['error'](_0x3450c0);};Dialer[_0xf9cb('0x84')]['saveInDb']=function(_0x16ea49,_0x247cfa,_0x45b160){hopperUtils[_0xf9cb('0xc9')](_0x16ea49)['catch'](loggerCatch(_0x247cfa));hopperUtils['moveContactManagedDialer'](_0x16ea49)['catch'](loggerCatch(_0x45b160));};Dialer['prototype'][_0xf9cb('0xd4')]=function(_0x2671d5,_0x2194ec){hopperUtils[_0xf9cb('0xc9')](_0x2671d5)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0xca')));if(_0x2194ec==0x0){hopperUtils['moveContactManagedDialer'](_0x2671d5)[_0xf9cb('0xa3')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xf9cb('0x84')][_0xf9cb('0x15a')]=function(_0x823a1b){return Promise[_0xf9cb('0x13d')]()[_0xf9cb('0x3d')](cmHopper['handlePreviewRecallNotifications'](_0x823a1b['id'],previewRecallmeReminderInterval))['then'](function(_0x737ac5){for(var _0x457c04=0x0;_0x457c04<_0x737ac5[_0xf9cb('0x9a')];_0x457c04++){var _0x8693fb=_0x737ac5[_0x457c04]['Agent'][_0xf9cb('0x5e')];if(_0x8693fb)io['to'](util[_0xf9cb('0x7b')]('user:%s',_0x8693fb))[_0xf9cb('0x3f')](_0xf9cb('0x14e'),{'hopper':_0x737ac5[_0x457c04]});}})[_0xf9cb('0xa3')](function(){});};Dialer[_0xf9cb('0x84')][_0xf9cb('0xb1')]=function(_0x45de16){var _0x2fc4f2=this;return function(){_0x2fc4f2[_0xf9cb('0x15b')](_0x45de16);};};Dialer[_0xf9cb('0x84')][_0xf9cb('0x15c')]=function(_0x20605c,_0x35978b){var _0x23ba82=this;var _0x2c578d=uuid['v4']();this[_0xf9cb('0xeb')][_0x2c578d]=new Action(_0x20605c,_0x35978b,_0x2c578d);return new Promise(function(_0x281d8f,_0x262c16){if(_['isUndefined'](_0x20605c)&&typeof _0x20605c!==_0xf9cb('0x15d')){return _0x262c16(msgResponse(_0xf9cb('0x15e'),_0xf9cb('0x95'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x35978b[_0xf9cb('0x15f')])||_0x35978b[_0xf9cb('0x15f')]===null){return _0x262c16(msgResponse(_0xf9cb('0x15e'),'Failure',_0xf9cb('0x160')));}var _0x37f790={'XMD-CALLERID':_0x23ba82[_0xf9cb('0xeb')][_0x2c578d][_0xf9cb('0x161')](),'XMD-AGI':_0x20605c[_0xf9cb('0x133')]?util[_0xf9cb('0x7b')](_0xf9cb('0x162'),ipAgi,_0x20605c[_0xf9cb('0x133')]):_0xf9cb('0x163'),'XMD-AGIAFTER':_0x20605c['dialQueueProject2']?util[_0xf9cb('0x7b')](_0xf9cb('0x162'),ipAgi,_0x20605c['dialQueueProject2']):_0xf9cb('0x163'),'XMD-QUEUE':utils['isOutboundQueue'](_0x20605c)?util['format'](_0xf9cb('0x164'),_0x20605c['name'],_0x20605c[_0xf9cb('0x165')]||'',_0x20605c[_0xf9cb('0xc8')]?'c':'',_0x20605c['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x35978b[_0xf9cb('0xd8')],'XMD-CDRTYPE':_0xf9cb('0x7'),'CALLERID(all)':_0x23ba82[_0xf9cb('0xeb')][_0x2c578d][_0xf9cb('0x161')](),'XMD-AMD':_0x20605c[_0xf9cb('0x118')]?'ACTIVE':'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x20605c[_0xf9cb('0x118')]){_0x37f790['XMD-AMDINITIALSILENCE']=_0x20605c[_0xf9cb('0x166')]||0x9c4;_0x37f790[_0xf9cb('0x167')]=_0x20605c['dialAMDGreeting']||0x5dc;_0x37f790[_0xf9cb('0x168')]=_0x20605c['dialAMDAfterGreetingSilence']||0x320;_0x37f790[_0xf9cb('0x169')]=_0x20605c[_0xf9cb('0x16a')]||0x1388;_0x37f790['XMD-AMDMINWORDLENGTH']=_0x20605c[_0xf9cb('0x16b')]||0x64;_0x37f790[_0xf9cb('0x16c')]=_0x20605c[_0xf9cb('0x16d')]||0x32;_0x37f790[_0xf9cb('0x16e')]=_0x20605c[_0xf9cb('0x16f')]||0x3;_0x37f790['XMD-AMDSILENCETHRESHOLD']=_0x20605c['dialAMDSilenceThreshold']||0x100;_0x37f790[_0xf9cb('0x170')]=_0x20605c[_0xf9cb('0x171')]||0x1388;}if(utils[_0xf9cb('0x172')](_0x20605c)){_0x37f790[_0xf9cb('0x173')]=_0x35978b[_0xf9cb('0xda')];}else{_0x37f790['XMD-CAMPAIGNID']=_0x35978b[_0xf9cb('0xf9')];}var _0x4b8514=utils['setXMDContactVariables'](_0x35978b[_0xf9cb('0x174')]);Object[_0xf9cb('0x146')](_0x37f790,_0x4b8514);var _0x3af312=_0x23ba82[_0xf9cb('0x85')](_0x20605c[_0xf9cb('0x8c')])?utils[_0xf9cb('0x175')](_0x20605c[_0xf9cb('0x8c')]['callerid'],_0x20605c[_0xf9cb('0x176')],_0x20605c[_0xf9cb('0x177')]>0x0?utils[_0xf9cb('0x178')](_0x20605c[_0xf9cb('0x179')],_0x20605c['dialRandomLastDigitCallerIdNumber']):_0x20605c[_0xf9cb('0x179')]):utils[_0xf9cb('0x175')](_[_0xf9cb('0xee')](_0x20605c[_0xf9cb('0x8d')])?_0x20605c['Trunk'][_0xf9cb('0x17a')]:_0x20605c[_0xf9cb('0x8d')]['callerid'],_0x20605c[_0xf9cb('0x176')],_0x20605c[_0xf9cb('0x177')]>0x0?utils[_0xf9cb('0x178')](_0x20605c[_0xf9cb('0x179')],_0x20605c['dialRandomLastDigitCallerIdNumber']):_0x20605c[_0xf9cb('0x179')]);if(_0x3af312){_0x37f790[_0xf9cb('0x17b')]=_0x23ba82[_0xf9cb('0xeb')][_0x2c578d][_0xf9cb('0x17c')]=utils[_0xf9cb('0x17d')](_0x3af312);_0x37f790[_0xf9cb('0x17e')]=_0x35978b['phone'];}_0x20605c[_0xf9cb('0x17f')]=_0x37f790;return ami[_0xf9cb('0x9c')]({'actionid':_0x2c578d,'action':'originate','channel':_0x23ba82[_0xf9cb('0x85')](_0x20605c[_0xf9cb('0x8c')])?util[_0xf9cb('0x7b')](_0xf9cb('0x180'),_0x20605c[_0xf9cb('0x8c')][_0xf9cb('0x5e')],isNotNull(_0x20605c[_0xf9cb('0x181')])?_0x20605c[_0xf9cb('0x181')][_0xf9cb('0x182')]()||'':'',_0x20605c[_0xf9cb('0x183')]>0x0?_0x35978b['phone']['substring'](_0x20605c['dialCutDigit']):_0x35978b[_0xf9cb('0x15f')]):util['format'](_0xf9cb('0x180'),_['isNil'](_0x20605c[_0xf9cb('0x8d')])?_0x20605c[_0xf9cb('0x8c')][_0xf9cb('0x5e')]:_0x20605c[_0xf9cb('0x8d')]['name'],isNotNull(_0x20605c[_0xf9cb('0x181')])?_0x20605c[_0xf9cb('0x181')]['trim']()||'':'',_0x20605c[_0xf9cb('0x183')]>0x0?_0x35978b[_0xf9cb('0x15f')]['substring'](_0x20605c['dialCutDigit']):_0x35978b[_0xf9cb('0x15f')]),'callerid':_0x3af312,'Exten':_0xf9cb('0x10f'),'Context':_0xf9cb('0x184'),'Priority':'1','variable':_0x37f790,'timeout':(_0x20605c[_0xf9cb('0x185')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c578d})[_0xf9cb('0x3d')](function(_0xa1f449){return _0x281d8f(_0xa1f449);})[_0xf9cb('0xa3')](function(_0x57c954){_0x20605c[_0xf9cb('0x186')]+=0x1;var _0x4cd232=new History(_0x23ba82[_0xf9cb('0xeb')][_0x2c578d]);logger[_0xf9cb('0x61')](util[_0xf9cb('0x7b')](_0xf9cb('0x187'),JSON[_0xf9cb('0x71')](_0x57c954)));_0x4cd232[_0xf9cb('0x6d')]=0xe;_0x4cd232['statedesc']=_0xf9cb('0x188');_0x4cd232[_0xf9cb('0xdc')]=moment()['format'](_0xf9cb('0xc2'));_0x4cd232[_0xf9cb('0x6f')]=_0x4cd232[_0xf9cb('0xdc')];hopperUtils['createHistory'](_0x4cd232)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x189')));_0x23ba82[_0xf9cb('0x136')](_0x4cd232)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x189')))[_0xf9cb('0x1c')](function(){delete _0x23ba82['actions'][_0x2c578d];return _0x262c16(msgResponse(_0xf9cb('0x15e'),_0xf9cb('0x83'),'originate\x20action\x20Error'));});});});};Dialer[_0xf9cb('0x84')][_0xf9cb('0x18a')]=function(_0x543780,_0x5cf0d5,_0x1d1643){var _0x26e66b=new History(_0x5cf0d5);if(_0x26e66b[_0xf9cb('0x11d')]+_0x26e66b['countcongestionretry']+_0x26e66b[_0xf9cb('0x11f')]+_0x26e66b['countnosuchnumberretry']+_0x26e66b[_0xf9cb('0xce')]+_0x26e66b[_0xf9cb('0xe3')]+_0x26e66b[_0xf9cb('0x11a')]+_0x26e66b[_0xf9cb('0x121')]>=_0x1d1643[_0xf9cb('0x122')]-0x1){return!![];}switch(_0x543780){case 0x3:if(_0x26e66b[_0xf9cb('0x11f')]>=_0x1d1643[_0xf9cb('0x18b')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x26e66b[_0xf9cb('0x11f')]+=0x1,'scheduledat':moment()[_0xf9cb('0xd6')](_0x1d1643['dialNoAnswerRetryFrequency'],_0xf9cb('0xd7'))[_0xf9cb('0x7b')](_0xf9cb('0xc2')),'ContactId':_0x26e66b[_0xf9cb('0xd8')],'ListId':_0x26e66b['ListId'],'VoiceQueueId':_0x26e66b[_0xf9cb('0xda')]||undefined,'CampaignId':_0x26e66b['CampaignId']||undefined})['catch'](loggerCatch(_0xf9cb('0x18c')));break;case 0x5:if(_0x26e66b[_0xf9cb('0x11d')]>=_0x1d1643[_0xf9cb('0x18d')]-0x1){return!![];}hopperUtils[_0xf9cb('0xd5')]({'active':![],'countbusyretry':_0x26e66b[_0xf9cb('0x11d')]+=0x1,'scheduledat':moment()[_0xf9cb('0xd6')](_0x1d1643[_0xf9cb('0x18e')],'minutes')[_0xf9cb('0x7b')](_0xf9cb('0xc2')),'ContactId':_0x26e66b[_0xf9cb('0xd8')],'ListId':_0x26e66b['ListId'],'VoiceQueueId':_0x26e66b[_0xf9cb('0xda')]||undefined,'CampaignId':_0x26e66b[_0xf9cb('0xf9')]||undefined})[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x18f')));break;case 0x8:if(_0x26e66b[_0xf9cb('0x11e')]>=_0x1d1643[_0xf9cb('0x190')]-0x1){return!![];}hopperUtils[_0xf9cb('0xd5')]({'active':![],'countcongestionretry':_0x26e66b[_0xf9cb('0x11e')]+=0x1,'scheduledat':moment()[_0xf9cb('0xd6')](_0x1d1643[_0xf9cb('0x191')],'minutes')[_0xf9cb('0x7b')](_0xf9cb('0xc2')),'ContactId':_0x26e66b[_0xf9cb('0xd8')],'ListId':_0x26e66b[_0xf9cb('0xd9')],'VoiceQueueId':_0x26e66b['VoiceQueueId']||undefined,'CampaignId':_0x26e66b['CampaignId']||undefined})['catch'](loggerCatch(_0xf9cb('0x192')));break;case 0x0:if(_0x26e66b[_0xf9cb('0x120')]>=_0x1d1643['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0xf9cb('0xd5')]({'active':![],'countnosuchnumberretry':_0x26e66b[_0xf9cb('0x120')]+=0x1,'scheduledat':moment()[_0xf9cb('0xd6')](_0x1d1643['dialNoSuchNumberRetryFrequency'],'minutes')[_0xf9cb('0x7b')](_0xf9cb('0xc2')),'ContactId':_0x26e66b['ContactId'],'ListId':_0x26e66b[_0xf9cb('0xd9')],'VoiceQueueId':_0x26e66b['VoiceQueueId']||undefined,'CampaignId':_0x26e66b['CampaignId']||undefined})[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x193')));}break;case 0xa:if(_0x26e66b[_0xf9cb('0xce')]>=_0x1d1643[_0xf9cb('0xd3')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x26e66b[_0xf9cb('0xce')]+=0x1,'scheduledat':moment()[_0xf9cb('0xd6')](_0x1d1643[_0xf9cb('0xd0')],'minutes')[_0xf9cb('0x7b')](_0xf9cb('0xc2')),'ContactId':_0x26e66b['ContactId'],'ListId':_0x26e66b[_0xf9cb('0xd9')],'VoiceQueueId':_0x26e66b[_0xf9cb('0xda')]||undefined,'CampaignId':_0x26e66b[_0xf9cb('0xf9')]||undefined})['catch'](loggerCatch(_0xf9cb('0xdb')));break;case 0xb:if(_0x26e66b['countabandonedretry']>=_0x1d1643[_0xf9cb('0xe6')]-0x1){return!![];}hopperUtils[_0xf9cb('0xd5')]({'active':![],'countabandonedretry':_0x26e66b[_0xf9cb('0xe3')]+=0x1,'scheduledat':moment()[_0xf9cb('0xd6')](_0x1d1643['dialAbandonedRetryFrequency'],'minutes')[_0xf9cb('0x7b')](_0xf9cb('0xc2')),'ContactId':_0x26e66b['ContactId'],'ListId':_0x26e66b[_0xf9cb('0xd9')],'VoiceQueueId':_0x26e66b[_0xf9cb('0xda')]||undefined,'CampaignId':_0x26e66b[_0xf9cb('0xf9')]||undefined})[_0xf9cb('0xa3')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x26e66b[_0xf9cb('0x11a')]>=_0x1d1643[_0xf9cb('0x125')]-0x1){return!![];}hopperUtils[_0xf9cb('0xd5')]({'active':![],'countmachineretry':_0x26e66b[_0xf9cb('0x11a')]+=0x1,'scheduledat':moment()['add'](_0x1d1643[_0xf9cb('0x128')],_0xf9cb('0xd7'))[_0xf9cb('0x7b')](_0xf9cb('0xc2')),'ContactId':_0x26e66b[_0xf9cb('0xd8')],'ListId':_0x26e66b[_0xf9cb('0xd9')],'VoiceQueueId':_0x26e66b[_0xf9cb('0xda')]||undefined,'CampaignId':_0x26e66b['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x26e66b[_0xf9cb('0x121')]>=_0x1d1643[_0xf9cb('0x194')]-0x1){return!![];}hopperUtils[_0xf9cb('0xd5')]({'active':![],'countagentrejectretry':_0x26e66b['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xf9cb('0xd6')](_0x1d1643[_0xf9cb('0x195')],_0xf9cb('0xd7'))[_0xf9cb('0x7b')](_0xf9cb('0xc2')),'ContactId':_0x26e66b[_0xf9cb('0xd8')],'ListId':_0x26e66b[_0xf9cb('0xd9')],'VoiceQueueId':_0x26e66b[_0xf9cb('0xda')]||undefined,'CampaignId':_0x26e66b[_0xf9cb('0xf9')]||undefined})[_0xf9cb('0xa3')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xf9cb('0x84')]['callProgressDetecting']=function(_0x458c3d,_0xa5e4cb,_0x3e7f9a){var _0x45a54d=this;var _0x297c65=new History(_0x458c3d);var _0x470b84=![];var _0x2488f1;var _0x14d6ef;return new Promise(function(_0x203fd3,_0x1f09c1){if(_[_0xf9cb('0x3e')](_0xa5e4cb)&&typeof _0xa5e4cb!==_0xf9cb('0x15d')){return _0x1f09c1(msgResponse(_0xf9cb('0x196'),_0xf9cb('0x95'),_0xf9cb('0x197')));}if(_['isUndefined'](_0x3e7f9a)&&typeof _0x3e7f9a!=='object'){return _0x1f09c1(msgResponse(_0xf9cb('0x196'),_0xf9cb('0x95'),_0xf9cb('0x198')));}hopperUtils['verifyAdditionalPhones'](_0x297c65,_0x3e7f9a[_0xf9cb('0xc4')],_0xa5e4cb)[_0xf9cb('0x3d')](function(_0x4806ec){if(_0x4806ec['additional']==0x1)_0x470b84=!![];switch(_0x3e7f9a['reason']){case'0':_0xa5e4cb[_0xf9cb('0x199')]+=0x1;_0x297c65[_0xf9cb('0x6d')]=0x0;_0x297c65[_0xf9cb('0x6e')]=_0xf9cb('0x19a');_0x297c65[_0xf9cb('0x120')]+=0x1;_0x297c65[_0xf9cb('0xcf')]+=0x1;ami[_0xf9cb('0x3f')](_0xf9cb('0x19b'),ut['buildObj'](_0x458c3d,'nosuchnumber'));_0x2488f1=_0xa5e4cb['dialNoSuchNumberRetryFrequency'];_0x14d6ef=_0xa5e4cb['callAdditionalPhoneAfterMin'];hopperUtils[_0xf9cb('0xc9')](_0x297c65)[_0xf9cb('0xa3')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x45a54d['checkRetriveMax'](0x0,_0x458c3d,_0xa5e4cb)&&!_0x470b84){if(_0x297c65['countnosuchnumberretry']>=_0xa5e4cb[_0xf9cb('0x19c')]){_0x45a54d['createStateFinal'](_0x297c65,_0x203fd3,_0x1f09c1,_0xf9cb('0x19d'));}else{_0x45a54d[_0xf9cb('0x123')](_0x297c65,_0x203fd3,_0x1f09c1,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0xa5e4cb[_0xf9cb('0x19e')]+=0x1;_0x297c65[_0xf9cb('0x6d')]=0x3;_0x297c65[_0xf9cb('0x6e')]=_0xf9cb('0x19f');_0x297c65[_0xf9cb('0x11f')]+=0x1;_0x297c65[_0xf9cb('0xcf')]+=0x1;var _0x3f1899=ut[_0xf9cb('0x1a0')](_0x458c3d,_0xa5e4cb);ami[_0xf9cb('0x3f')]('custom:agentnoanswer',_0x3f1899);_0x2488f1=_0xa5e4cb['dialNoAnswerRetryFrequency'];_0x14d6ef=_0xa5e4cb['callAdditionalPhoneAfterMin'];hopperUtils[_0xf9cb('0xc9')](_0x297c65)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x1a1')));if(_0x45a54d[_0xf9cb('0x18a')](0x3,_0x458c3d,_0xa5e4cb)&&!_0x470b84){if(_0x297c65[_0xf9cb('0x11f')]>=_0xa5e4cb[_0xf9cb('0x18b')]){_0x45a54d[_0xf9cb('0x126')](_0x297c65,_0x203fd3,_0x1f09c1,_0xf9cb('0x1a2'));}else{_0x45a54d['stateGlobal'](_0x297c65,_0x203fd3,_0x1f09c1,_0xf9cb('0x1a2'));}}break;case'5':_0xa5e4cb['outboundBusyCallsDay']+=0x1;_0x297c65[_0xf9cb('0x6d')]=0x5;_0x297c65[_0xf9cb('0x6e')]=_0xf9cb('0x1a3');_0x297c65['countbusyretry']+=0x1;_0x297c65['countglobal']+=0x1;ami[_0xf9cb('0x3f')](_0xf9cb('0x1a4'),ut[_0xf9cb('0x115')](_0x458c3d,_0xf9cb('0x1a5')));_0x2488f1=_0xa5e4cb[_0xf9cb('0x18e')];_0x14d6ef=_0xa5e4cb[_0xf9cb('0xe4')];hopperUtils['createHistory'](_0x297c65)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x1a6')));if(_0x45a54d[_0xf9cb('0x18a')](0x5,_0x458c3d,_0xa5e4cb)&&!_0x470b84){if(_0x297c65['countbusyretry']>=_0xa5e4cb['dialBusyMaxRetry']){_0x45a54d[_0xf9cb('0x126')](_0x297c65,_0x203fd3,_0x1f09c1,'reason\x205\x20busy');}else{_0x45a54d[_0xf9cb('0x123')](_0x297c65,_0x203fd3,_0x1f09c1,_0xf9cb('0x1a7'));}}break;case'8':_0xa5e4cb[_0xf9cb('0x1a8')]+=0x1;_0x297c65[_0xf9cb('0x6d')]=0x8;_0x297c65[_0xf9cb('0x6e')]=_0xf9cb('0x1a9');_0x297c65[_0xf9cb('0x11e')]+=0x1;_0x297c65[_0xf9cb('0xcf')]+=0x1;_0x2488f1=_0xa5e4cb[_0xf9cb('0x191')];_0x14d6ef=_0xa5e4cb['callAdditionalPhoneAfterMin'];ami[_0xf9cb('0x3f')]('custom:agentcongestion',ut[_0xf9cb('0x115')](_0x458c3d,_0xf9cb('0x1aa')));hopperUtils['createHistory'](_0x297c65)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x1ab')));if(_0x45a54d[_0xf9cb('0x18a')](0x8,_0x458c3d,_0xa5e4cb)&&!_0x470b84){if(_0x297c65[_0xf9cb('0x11e')]>=_0xa5e4cb[_0xf9cb('0x190')]){_0x45a54d[_0xf9cb('0x126')](_0x297c65,_0x203fd3,_0x1f09c1,_0xf9cb('0x1ac'));}else{_0x45a54d['stateGlobal'](_0x297c65,_0x203fd3,_0x1f09c1,_0xf9cb('0x1ac'));}}break;case'11':_0xa5e4cb[_0xf9cb('0x1ad')]+=0x1;_0x297c65[_0xf9cb('0x6d')]=0xb;_0x297c65['statedesc']=_0xf9cb('0xe8');_0x297c65[_0xf9cb('0xe3')]+=0x1;_0x297c65['countglobal']+=0x1;_0x2488f1=_0xa5e4cb['dialAbandonedRetryFrequency'];_0x14d6ef=_0xa5e4cb[_0xf9cb('0xe4')];hopperUtils[_0xf9cb('0xc9')](_0x297c65)[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0xe9')));if(_0x45a54d[_0xf9cb('0x18a')](0xb,_0x458c3d,_0xa5e4cb)&&!_0x470b84){if(_0x297c65['countabandonedretry']>=_0xa5e4cb['dialAbandonedMaxRetry']){_0x45a54d[_0xf9cb('0x126')](_0x297c65,_0x203fd3,_0x1f09c1,_0xf9cb('0x1ae'));}else{_0x45a54d['stateGlobal'](_0x297c65,_0x203fd3,_0x1f09c1,_0xf9cb('0x1ae'));}}break;case'20':_0xa5e4cb[_0xf9cb('0x1af')]+=0x1;_0x297c65[_0xf9cb('0x6d')]=0x14;_0x297c65['statedesc']=_0xf9cb('0x1b0');_0x297c65[_0xf9cb('0x121')]+=0x1;_0x297c65[_0xf9cb('0xcf')]+=0x1;_0x2488f1=_0xa5e4cb[_0xf9cb('0x195')];_0x14d6ef=_0xa5e4cb[_0xf9cb('0xe4')];ami[_0xf9cb('0x3f')](_0xf9cb('0x1b1'),ut[_0xf9cb('0x115')](_0x458c3d,_0xf9cb('0x1b2')));hopperUtils[_0xf9cb('0xc9')](_0x297c65)[_0xf9cb('0xa3')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x45a54d[_0xf9cb('0x18a')](0x14,_0x458c3d,_0xa5e4cb)&&!_0x470b84){if(_0x297c65[_0xf9cb('0x121')]>=_0xa5e4cb[_0xf9cb('0x194')]){_0x45a54d[_0xf9cb('0x126')](_0x297c65,_0x203fd3,_0x1f09c1,_0xf9cb('0x1b3'));}else{_0x45a54d[_0xf9cb('0x123')](_0x297c65,_0x203fd3,_0x1f09c1,_0xf9cb('0x1b3'));}}break;default:_0xa5e4cb['outboundUnknownCallsDay']+=0x1;_0x297c65[_0xf9cb('0x6d')]=0xc;_0x297c65[_0xf9cb('0x6e')]=_0x3e7f9a['reason'];_0x2488f1=_0xa5e4cb[_0xf9cb('0x195')];_0x14d6ef=_0xa5e4cb[_0xf9cb('0xe4')];hopperUtils[_0xf9cb('0xc9')](_0x297c65)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x45a54d[_0xf9cb('0x18a')](_0x3e7f9a['reason'],_0x458c3d,_0xa5e4cb)&&!_0x470b84){if(_0x297c65[_0xf9cb('0x11d')]+_0x297c65[_0xf9cb('0x11e')]+_0x297c65['countnoanswerretry']+_0x297c65[_0xf9cb('0x120')]+_0x297c65[_0xf9cb('0xce')]+_0x297c65[_0xf9cb('0xe3')]+_0x297c65[_0xf9cb('0x11a')]+_0x297c65[_0xf9cb('0x121')]>=_0xa5e4cb[_0xf9cb('0x122')]){_0x45a54d[_0xf9cb('0x123')](_0x297c65,_0x203fd3,_0x1f09c1,_0x3e7f9a[_0xf9cb('0xc4')]);}else{_0x45a54d[_0xf9cb('0x126')](_0x297c65,_0x203fd3,_0x1f09c1,_0x3e7f9a[_0xf9cb('0xc4')]);}}}})[_0xf9cb('0x3d')](function(){if(_0x470b84){hopperUtils['swapAdditionalPhones'](_0x297c65,_0x2488f1,_0x14d6ef)['then'](function(){return _0x203fd3(0x1);});}});});};Dialer['prototype'][_0xf9cb('0x123')]=function(_0x5d6b40,_0x59848b,_0x3c143c,_0x4e99fd){var _0xc69a36=new Final(_0x5d6b40);_0xc69a36[_0xf9cb('0x6d')]=0xf;_0xc69a36[_0xf9cb('0x6e')]='Global';this[_0xf9cb('0x126')](_0xc69a36,_0x59848b,_0x3c143c,_0x4e99fd);};Dialer[_0xf9cb('0x84')]['createStateFinal']=function(_0x185a1f,_0x38375f,_0x595ef1,_0x267472){hopperUtils[_0xf9cb('0x136')](_0x185a1f)[_0xf9cb('0x3d')](function(){return _0x38375f(msgResponse('[callProgressDetecting]','Success',_0x267472));})[_0xf9cb('0xa3')](function(){return _0x595ef1(msgResponse(_0xf9cb('0x1b4'),_0xf9cb('0x95'),_0xf9cb('0x1b5')));});};Dialer['prototype'][_0xf9cb('0x9')]=function(_0xd691bd){var _0x4cba01=_0xd691bd['dialPredictiveOptimizationPercentage']/0x64;var _0x4718b7=_0xd691bd['outboundDropCallsDayTimeout']/(_0xd691bd[_0xf9cb('0x1b6')]+_0xd691bd[_0xf9cb('0xc3')]);var _0x588bdd=Math[_0xf9cb('0x1b7')](_0xd691bd[_0xf9cb('0x1b8')]*(_0xd691bd['predictiveIntervalMaxThreshold']/0x64));var _0x3811ca=Math['round'](_0xd691bd[_0xf9cb('0x1b8')]*(_0xd691bd[_0xf9cb('0x1b9')]/0x64));var _0x145c6d=_0xd691bd[_0xf9cb('0x13e')]+_0xd691bd[_0xf9cb('0x140')];var _0x4b95e5=Math[_0xf9cb('0x1ba')](_0xd691bd['erlangCalls']*_0xd691bd[_0xf9cb('0x58')]*_0xd691bd[_0xf9cb('0x1bb')]*_0xd691bd[_0xf9cb('0x1bc')]);if(_['isUndefined'](_0xd691bd[_0xf9cb('0x27')])){if(!_[_0xf9cb('0x3e')](_0xd691bd[_0xf9cb('0x26')])){_0xd691bd[_0xf9cb('0x26')]=undefined;loggerPredictive[_0xf9cb('0x61')](_0xf9cb('0x1bd'),_0xf9cb('0x1be'));}if(!_[_0xf9cb('0x3e')](_0xd691bd[_0xf9cb('0x5f')])){loggerPredictive['error'](_0xf9cb('0x1bd'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xd691bd[_0xf9cb('0x5f')]);_0xd691bd['handlePredictive']=undefined;}_0xd691bd[_0xf9cb('0x27')]=moment()['format'](_0xf9cb('0xc2'));loggerPredictive[_0xf9cb('0x44')](_0xd691bd[_0xf9cb('0x5e')],_0xf9cb('0x1bf'),_0xd691bd['startProgressive']);this[_0xf9cb('0xb4')](_0xd691bd,0x1);}else if(ifInterval(_0xd691bd[_0xf9cb('0x1c0')],_0xd691bd['startProgressive'])){this[_0xf9cb('0xb4')](_0xd691bd,0x1);loggerPredictiveCalls['info'](_0xf9cb('0x1c1'),_0xd691bd['startProgressive'],_0xd691bd[_0xf9cb('0x5e')]);_0xd691bd['erlangCalls']=0x0;_0xd691bd[_0xf9cb('0x1c2')]=0x0;}else if(_0x4cba01<_0x4718b7&&_0xd691bd[_0xf9cb('0x1c3')]===_0xf9cb('0x1c4')){clearPredictiveAttributes(_0xd691bd);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x1c5'),_0xf9cb('0x1c6'),_0x4718b7,'startProgressive',_0xd691bd[_0xf9cb('0x5e')]);}else if(_0x4b95e5<_0xd691bd[_0xf9cb('0x1c2')]&&_0xd691bd['dialPredictiveOptimization']===_0xf9cb('0x1c4')){clearPredictiveAttributes(_0xd691bd);loggerPredictive[_0xf9cb('0x44')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xf9cb('0x1c7'),_0x4b95e5,_0xf9cb('0x1c8'),_0xd691bd[_0xf9cb('0x1c2')],_0xf9cb('0x27'),_0xd691bd['name']);}else if(!ifInterval(_0xd691bd[_0xf9cb('0x1c0')],_0xd691bd['startProgressive'])&&_['isUndefined'](_0xd691bd[_0xf9cb('0x26')])&&!_['isUndefined'](_0xd691bd[_0xf9cb('0x27')])){_0xd691bd[_0xf9cb('0x26')]=moment()[_0xf9cb('0x7b')](_0xf9cb('0xc2'));loggerPredictive['info'](_0xd691bd[_0xf9cb('0x5e')],'started\x20in\x20predictive\x20at',_0xd691bd[_0xf9cb('0x26')]);hopperUtils[_0xf9cb('0x1c9')](_0xd691bd[_0xf9cb('0x1c0')])[_0xf9cb('0x3d')](this['getDataPredictive'](_0xd691bd))[_0xf9cb('0x3d')](mergeDataErlangB(_0xd691bd))[_0xf9cb('0x3d')](this[_0xf9cb('0x1ca')](_0xd691bd))[_0xf9cb('0xa3')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0xd691bd));}else if(!ifInterval(_0xd691bd[_0xf9cb('0x1c0')],_0xd691bd['startPredictive'])){_0xd691bd[_0xf9cb('0x1c2')]=0x0;_0xd691bd[_0xf9cb('0x26')]=moment()[_0xf9cb('0x7b')](_0xf9cb('0xc2'));loggerPredictive[_0xf9cb('0x44')](_0xd691bd[_0xf9cb('0x5e')],_0xf9cb('0x1cb'),_0xd691bd[_0xf9cb('0x26')]);clearInterval(_0xd691bd[_0xf9cb('0x5f')]);_0xd691bd[_0xf9cb('0x5f')]=undefined;hopperUtils[_0xf9cb('0x1c9')](_0xd691bd[_0xf9cb('0x1c0')])['then'](this[_0xf9cb('0x1cc')](_0xd691bd))[_0xf9cb('0x3d')](mergeDataErlangB(_0xd691bd))['then'](this[_0xf9cb('0x1ca')](_0xd691bd))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0xd691bd));}else if(_0xd691bd[_0xf9cb('0x1b8')]&&_0x145c6d<_0xd691bd[_0xf9cb('0x1b8')]-_0x3811ca){clearPredictiveAttributes(_0xd691bd);loggerPredictive[_0xf9cb('0x44')](_0xd691bd['name'],_0xf9cb('0x1cd'),_0x145c6d,_0xf9cb('0x1ce'),_0xd691bd[_0xf9cb('0x1b8')],'-',_0x3811ca,'=',_0xd691bd['predictiveIntervalAvailable']-_0x3811ca,')');}else if(_0xd691bd['predictiveIntervalAvailable']&&_0x145c6d>_0xd691bd[_0xf9cb('0x1b8')]+_0x588bdd){clearPredictiveAttributes(_0xd691bd);loggerPredictive[_0xf9cb('0x44')](_0xd691bd[_0xf9cb('0x5e')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x145c6d,')\x20are\x20more\x20than\x20threshold\x20(',_0xd691bd[_0xf9cb('0x1b8')],'+',_0x588bdd,'=',_0xd691bd[_0xf9cb('0x1b8')]+_0x588bdd,')');}};Dialer['prototype'][_0xf9cb('0x1cc')]=function(_0xf3eb6e){var _0x2b3bec=this;return function(_0x490ecd){return new Promise(function(_0x950ff8,_0x2bc8ce){_[_0xf9cb('0xf2')](_0xf3eb6e,_0x490ecd[0x0]);if(checkGetDataPredictive(_0x490ecd[0x0])){var _0x47d6c0=_0xf3eb6e[_0xf9cb('0x1b8')]=_0xf3eb6e[_0xf9cb('0x140')]+_0xf3eb6e[_0xf9cb('0x13e')];var _0x42523f=_0xf3eb6e[_0xf9cb('0x1c0')]*0x3c;var _0x34d8ca=_0x490ecd[0x0][_0xf9cb('0x4e')]+_0x490ecd[0x0][_0xf9cb('0x4c')];var _0x37fea4=(_0x490ecd[0x0]['predictiveIntervalAnsweredCalls']+_0x490ecd[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x490ecd[0x0][_0xf9cb('0x4a')])/_0x490ecd[0x0][_0xf9cb('0x50')];_0xf3eb6e['predictiveIntervalHitRate']=_0x37fea4>0x0?_0x37fea4:0x1;switch(_0xf3eb6e[_0xf9cb('0x1c3')]){case'dropRate':var _0x4346c2=_0xf3eb6e[_0xf9cb('0x1cf')]/0x64;return _0x2b3bec[_0xf9cb('0x1d0')](_0x47d6c0,_0x42523f,_0x34d8ca,_0x37fea4,_0x4346c2)[_0xf9cb('0x3d')](function(_0x11c6eb){return _0x950ff8(_0x11c6eb);});case _0xf9cb('0x1d1'):var _0xc56fe5=_0xf3eb6e[_0xf9cb('0x1cf')]/0x64;return _0x2b3bec[_0xf9cb('0x1d2')](_0x47d6c0,_0x42523f,_0x34d8ca,_0x37fea4,_0xc56fe5)[_0xf9cb('0x3d')](function(_0x203575){return _0x950ff8(_0x203575);});default:return _0x2bc8ce(msgResponse(_0xf9cb('0x1d3'),_0xf9cb('0x95'),_0xf9cb('0x1d4')));}}else{return _0x2bc8ce(msgResponse(_0xf9cb('0x1d3'),'Failure',_0xf9cb('0x1d5')));}});};};Dialer[_0xf9cb('0x84')]['getDataPredictiveOld']=function(_0x2edab2){var _0x4111e0=this;return function(_0x4350e){return new Promise(function(_0x9cfe6e,_0x31f0ee){_[_0xf9cb('0xf2')](_0x2edab2,_0x4350e[0x0]);if(checkGetDataPredictive(_0x4350e[0x0])){loggerPredictive['info'](JSON[_0xf9cb('0x71')](_0x4350e[0x0]));if(_0x2edab2['dialPredictiveOptimization']===_0xf9cb('0x1c4')){return _0x4111e0['getVoiceQueueRtPauses'](_0x2edab2['id'])[_0xf9cb('0x3d')](function(_0x2639f7){var _0x27b6d0=_0x2edab2[_0xf9cb('0x1d6')]-_0x2639f7[0x0][_0xf9cb('0x1d7')];var _0x882751=_0x2edab2[_0xf9cb('0x1c0')]*0x3c;var _0x138bab=_0x4350e[0x0][_0xf9cb('0x4e')]+_0x4350e[0x0][_0xf9cb('0x4c')];var _0x660754=(_0x4350e[0x0][_0xf9cb('0x46')]+_0x4350e[0x0][_0xf9cb('0x48')]+_0x4350e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4350e[0x0]['predictiveIntervalTotalCalls'];var _0x2427d9=_0x2edab2[_0xf9cb('0x1cf')]/0x64;_0x2edab2[_0xf9cb('0x1d8')]=_0x2639f7[0x0][_0xf9cb('0x1d7')]||0x0;_0x2edab2['predictiveIntervalHitRate']=_0x660754>0x0?_0x660754:0x1;return _0x4111e0['abandonmentRate'](_0x27b6d0,_0x882751,_0x138bab,_0x660754,_0x2427d9);})[_0xf9cb('0x3d')](function(_0x3b1c1d){return _0x9cfe6e(_0x3b1c1d);})[_0xf9cb('0xa3')](function(_0x557ad2){return _0x31f0ee(msgResponse('[CatchErlangB]',_0xf9cb('0x95'),JSON[_0xf9cb('0x71')](_0x557ad2)));});}if(_0x2edab2['dialPredictiveOptimization']===_0xf9cb('0x1d1')){return _0x4111e0[_0xf9cb('0x155')](_0x2edab2['id'])[_0xf9cb('0x3d')](function(_0x3ab358){var _0x28f1ae=_0x2edab2['loggedIn']-_0x3ab358[0x0][_0xf9cb('0x1d7')];var _0x16e76c=_0x2edab2[_0xf9cb('0x1c0')]*0x3c;var _0x1d3d29=_0x4350e[0x0]['predictiveIntervalAvgTalktime']+_0x4350e[0x0]['predictiveIntervalAvgHoldtime'];var _0xeaa174=(_0x4350e[0x0][_0xf9cb('0x46')]+_0x4350e[0x0][_0xf9cb('0x48')]+_0x4350e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4350e[0x0][_0xf9cb('0x50')];var _0x1a54b9=_0x2edab2['dialPredictiveOptimizationPercentage']/0x64;_0x2edab2['predictiveIntervalPauses']=_0x3ab358[0x0]['outboundQueuePauses']||0x0;_0x2edab2['predictiveIntervalHitRate']=_0xeaa174>0x0?_0xeaa174:0x1;return _0x4111e0[_0xf9cb('0x1d2')](_0x28f1ae,_0x16e76c,_0x1d3d29,_0xeaa174,_0x1a54b9);})['then'](function(_0xe98409){return _0x9cfe6e(_0xe98409);})[_0xf9cb('0xa3')](function(_0x2c42a1){return _0x31f0ee(msgResponse(_0xf9cb('0x1d9'),'Failure',JSON[_0xf9cb('0x71')](_0x2c42a1)));});}}else{return _0x31f0ee(msgResponse(_0xf9cb('0x1d3'),'Failure','check\x20failure'));}});};};Dialer['prototype'][_0xf9cb('0x1ca')]=function(_0x334555){var _0x503549=this;return function(){var _0x33661f=0x0;var _0x3392e2=Math[_0xf9cb('0x1ba')](_0x334555[_0xf9cb('0x57')]*0x3e8);if(_0x3392e2>0x0){_0x3392e2=_0x3392e2<0x64?0x64:_0x3392e2;loggerPredictive[_0xf9cb('0x44')](_0x334555[_0xf9cb('0x5e')],_0xf9cb('0x1da'),_0x3392e2,_0xf9cb('0x1db'));_0x334555[_0xf9cb('0x5f')]=setInterval(function(){_0x503549['handlePredictive'](_0x334555);loggerPredictiveCalls[_0xf9cb('0x44')](_0xf9cb('0x1dc'),_0x33661f+=0x1);},_0x3392e2);}else{loggerPredictive[_0xf9cb('0x44')](_0x334555[_0xf9cb('0x5e')],_0xf9cb('0x1dd'));}};};Dialer[_0xf9cb('0x84')][_0xf9cb('0x1de')]=function(_0x56be9d,_0x26b6a3){var _0x458f10=this;return function(_0x116e43){if(_[_0xf9cb('0x43')](_0x116e43)){if(_[_0xf9cb('0xee')](_0x26b6a3[_0xf9cb('0x159')])||!_0x26b6a3[_0xf9cb('0x1df')]){if(_0x56be9d[_0xf9cb('0xb2')]==='booked'){_0x56be9d[_0xf9cb('0x70')]=_[_0xf9cb('0x3e')](_0x56be9d[_0xf9cb('0x70')])?!![]:_0x56be9d['queueStatusComplete'];var _0xee29d5=uuid['v4']();_0x458f10[_0xf9cb('0xeb')][_0xee29d5]=new Action(_0x56be9d,_0x26b6a3,_0xee29d5);loggerBooked[_0xf9cb('0x44')](_0xf9cb('0x1e0'),_0xee29d5,_0xf9cb('0x1e1'),JSON[_0xf9cb('0x71')](_0x56be9d[_0xf9cb('0x70')]),'Queue:\x20',_0x56be9d[_0xf9cb('0x5e')]);if(_0x56be9d['queueStatusComplete']){_0x56be9d[_0xf9cb('0x70')]=![];_0x458f10[_0xf9cb('0x29')][_0x458f10[_0xf9cb('0xeb')][_0xee29d5][_0xf9cb('0xbd')]]=[];ami[_0xf9cb('0x9c')]({'actionid':_0xee29d5,'action':'queuestatus','queue':_0x56be9d[_0xf9cb('0x5e')]})['catch'](function(){_0x458f10[_0xf9cb('0xf8')](_0x56be9d);hopperUtils[_0xf9cb('0xd5')]({'active':![],'ContactId':_0x458f10[_0xf9cb('0xeb')][_0xee29d5]['ContactId'],'ListId':_0x458f10[_0xf9cb('0xeb')][_0xee29d5]['ListId'],'VoiceQueueId':_0x458f10['actions'][_0xee29d5][_0xf9cb('0xda')]||undefined,'CampaignId':_0x458f10[_0xf9cb('0xeb')][_0xee29d5]['CampaignId']||undefined})[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x1e2')));delete _0x458f10[_0xf9cb('0xeb')][_0xee29d5];});}else{loggerBooked[_0xf9cb('0x44')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x56be9d[_0xf9cb('0x70')]),_0xf9cb('0x1e3'),_0x56be9d[_0xf9cb('0x5e')]);_0x458f10[_0xf9cb('0xf8')](_0x56be9d);hopperUtils[_0xf9cb('0xd5')]({'active':![],'ContactId':_0x458f10[_0xf9cb('0xeb')][_0xee29d5][_0xf9cb('0xd8')],'ListId':_0x458f10[_0xf9cb('0xeb')][_0xee29d5][_0xf9cb('0xd9')],'VoiceQueueId':_0x458f10['actions'][_0xee29d5][_0xf9cb('0xda')]||undefined,'CampaignId':_0x458f10['actions'][_0xee29d5]['CampaignId']||undefined})[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x1e2')));delete _0x458f10['actions'][_0xee29d5];}}else{return _0x458f10[_0xf9cb('0x15c')](_0x56be9d,_0x26b6a3);}}else{if(utils[_0xf9cb('0x5c')](undefined,_0x26b6a3[_0xf9cb('0x1e4')])<_0x56be9d['dialRecallMeTimeout']*0x3c){if(_0x26b6a3[_0xf9cb('0x14c')]&&!_0x26b6a3[_0xf9cb('0x14c')][_0xf9cb('0x1e5')]){_0x458f10[_0xf9cb('0xfe')][_0xf9cb('0xf5')](_0x26b6a3['id'])[_0xf9cb('0x1c')](function(){_0x458f10[_0xf9cb('0xf8')](_0x56be9d);});}else{hopperUtils['unlockContact']({'active':![]},_0x26b6a3['id'],0x1)['finally'](function(){_0x458f10[_0xf9cb('0xf8')](_0x56be9d);});}}else{_0x56be9d['outboundReCallsDay']+=0x1;_0x458f10[_0xf9cb('0xf8')](_0x56be9d);if(_0x56be9d['dialRecallInQueue']){hopperUtils[_0xf9cb('0xd5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x26b6a3['ContactId'],'ListId':_0x26b6a3[_0xf9cb('0xd9')],'VoiceQueueId':_0x26b6a3[_0xf9cb('0xda')]||undefined,'CampaignId':_0x26b6a3[_0xf9cb('0xf9')]||undefined})['catch'](loggerCatch(_0xf9cb('0x1e6')));hopperUtils[_0xf9cb('0xc9')](createObjHistory(_0x56be9d,_0x26b6a3,utils[_0xf9cb('0x68')][_0xf9cb('0x1e7')],0x17,_0xf9cb('0x1e8')))[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x1e9')));}else{_0x458f10[_0xf9cb('0x116')](createObjHistory(_0x56be9d,_0x26b6a3,utils[_0xf9cb('0x68')][_0xf9cb('0x1ea')],0x16,_0xf9cb('0x1eb')),_0xf9cb('0x1ec'),_0xf9cb('0x1ed'));}}}}else{_0x56be9d[_0xf9cb('0x1ee')]+=0x1;_0x458f10[_0xf9cb('0x116')](createObjHistory(_0x56be9d,_0x26b6a3,utils[_0xf9cb('0x68')][_0xf9cb('0x1ef')],0xd,'Blacklist'),_0xf9cb('0x1f0'),_0xf9cb('0x1f1'));throw _0xf9cb('0x1f2');}};};Dialer[_0xf9cb('0x84')][_0xf9cb('0x15b')]=function(_0x4de2b7){var _0x1152b5=this;var _0x93a08e=_0x4de2b7[_0xf9cb('0x1f3')]-_0x4de2b7[_0xf9cb('0x7e')];emitCampaignSummary(_0x4de2b7);if(_0x93a08e>0x0&&_0x4de2b7[_0xf9cb('0x65')]==0x0){if(_0x93a08e>this[_0xf9cb('0x22')]){_0x93a08e=this['maxNumberOriginate'];}_0x4de2b7[_0xf9cb('0x65')]=0x1;hopperUtils[_0xf9cb('0x1f4')](_0x4de2b7,_0x93a08e)[_0xf9cb('0x3d')](function(_0x6d98b){_0x4de2b7[_0xf9cb('0x65')]=0x0;if(_0x6d98b){if(!utils[_0xf9cb('0x1f5')](_0x6d98b)){_0x4de2b7['message']=utils[_0xf9cb('0x68')][_0xf9cb('0x6b')];logger[_0xf9cb('0x44')](_0xf9cb('0x1f6')+_0x4de2b7[_0xf9cb('0x5e')]);}else{_0x4de2b7[_0xf9cb('0x7e')]+=_0x6d98b[_0xf9cb('0x9a')];_0x4de2b7[_0xf9cb('0x67')]=utils['CAMPAIGN_STATUS'][_0xf9cb('0x1f7')];for(var _0x5dd7bb=0x0;_0x5dd7bb<_0x6d98b[_0xf9cb('0x9a')];_0x5dd7bb+=0x1){_0x4de2b7[_0xf9cb('0x1f8')]+=0x1;if(_[_0xf9cb('0xee')](_0x6d98b[_0x5dd7bb])||_[_0xf9cb('0xee')](_0x6d98b[_0x5dd7bb][_0xf9cb('0x174')])||_['isNil'](_0x6d98b[_0x5dd7bb]['phone'])){_0x1152b5['emptyContact'](_0xf9cb('0x1f9'),_0x4de2b7,_0x6d98b[_0x5dd7bb]);}else{hopperUtils['checkIsBlackListIvr'](_[_0xf9cb('0x72')](_0x6d98b[_0x5dd7bb],[_0xf9cb('0xf9'),_0xf9cb('0x15f')]))['then'](_0x1152b5[_0xf9cb('0x1de')](_0x4de2b7,_0x6d98b[_0x5dd7bb]))[_0xf9cb('0xa3')](_0x1152b5[_0xf9cb('0x157')]('[actionOriginateIvr]\x20',_0x4de2b7));}}}}})['catch'](loggerGetContactDialer(_0xf9cb('0x1fa'),_0x4de2b7,_0x93a08e));}};Dialer['prototype']['handlePower']=function(_0x23d574,_0x5927d2){var _0x27aae=this;var _0x550592=[];if(_0x5927d2<0x1||_0x23d574['dialMethod']===_0xf9cb('0x8')){_0x5927d2=0x1;}var _0x1c32f2=Math['floor'](_0x23d574[_0xf9cb('0x13e')]*_0x5927d2)-_0x23d574[_0xf9cb('0x7e')];if(_0x23d574['dialLimitQueue']>0x0){var _0x50a030=_0x23d574['dialLimitQueue']-_0x23d574[_0xf9cb('0x7e')]-_0x23d574[_0xf9cb('0x140')]-_0x23d574[_0xf9cb('0x141')];if(_0x1c32f2>_0x50a030){_0x1c32f2=_0x50a030;}}if(_0x1c32f2>0x0&&_0x23d574[_0xf9cb('0x65')]==0x0){if(_0x23d574[_0xf9cb('0xb2')]===_0xf9cb('0x8')){_0x1c32f2=0x1;}if(_0x1c32f2>this[_0xf9cb('0x22')]){_0x1c32f2=this[_0xf9cb('0x22')];}for(var _0x292c63 in this[_0xf9cb('0x20')]){if(typeof this[_0xf9cb('0x20')][_0x292c63]!=='undefined'){if(this['agents'][_0x292c63]['state']===_0xf9cb('0x1fb')&&this[_0xf9cb('0x20')][_0x292c63][_0xf9cb('0x89')]==='reachable'){_0x550592[_0xf9cb('0x9b')](this[_0xf9cb('0x20')][_0x292c63]['id']);}}}_0x23d574[_0xf9cb('0x65')]=0x1;hopperUtils['getContactDialer'](_0x23d574,_0x550592,_0x1c32f2)['then'](function(_0x1e0228){_0x23d574[_0xf9cb('0x65')]=0x0;if(_0x1e0228){if(!utils[_0xf9cb('0x1f5')](_0x1e0228)){hopperUtils[_0xf9cb('0x1fc')](_0x23d574)[_0xf9cb('0x3d')](sendMessageReschedule(_0x23d574))[_0xf9cb('0xa3')](loggerCatch('[countReScheduled]\x20'));}else{_0x23d574['originated']+=_0x1e0228[_0xf9cb('0x9a')];_0x23d574[_0xf9cb('0x67')]=_0x23d574[_0xf9cb('0xb2')]==='booked'?utils[_0xf9cb('0x68')][_0xf9cb('0x142')]:utils[_0xf9cb('0x68')][_0xf9cb('0x1f7')];for(var _0x2a5964=0x0;_0x2a5964<_0x1e0228['length'];_0x2a5964+=0x1){if(_['isNil'](_0x1e0228[_0x2a5964])||_[_0xf9cb('0xee')](_0x1e0228[_0x2a5964][_0xf9cb('0x174')])||_[_0xf9cb('0xee')](_0x1e0228[_0x2a5964]['phone'])){_0x27aae[_0xf9cb('0x1fd')](_0xf9cb('0x1f9'),_0x23d574,_0x1e0228[_0x2a5964]);}else{hopperUtils[_0xf9cb('0x1fe')](_[_0xf9cb('0x72')](_0x1e0228[_0x2a5964],[_0xf9cb('0xda'),'phone']))[_0xf9cb('0x3d')](_0x27aae['checkContactBlack'](_0x23d574,_0x1e0228[_0x2a5964]))['catch'](_0x27aae[_0xf9cb('0x157')]('[actionOriginate]\x20',_0x23d574));}}}}})[_0xf9cb('0xa3')](loggerGetContactDialer('[getContactDialer2]',_0x23d574,_0x1c32f2));}};Dialer['prototype'][_0xf9cb('0x5f')]=function(_0x2eca3e){if(_0x2eca3e['dialLimitQueue']>0x0){var _0x3feafb=_0x2eca3e[_0xf9cb('0x1ff')]-_0x2eca3e[_0xf9cb('0x7e')]-_0x2eca3e[_0xf9cb('0x140')];if(_0x3feafb>0x0&&_0x2eca3e[_0xf9cb('0x65')]==0x0){this[_0xf9cb('0x200')](_0x2eca3e);}else{loggerPredictiveCalls[_0xf9cb('0x44')](_0xf9cb('0x201'));}}else{this[_0xf9cb('0x200')](_0x2eca3e);}};Dialer[_0xf9cb('0x84')]['tryOriginatePredictive']=function(_0x5b0500){var _0x4b0cd0=this;var _0x46965e=[];_0x5b0500['originated']+=0x1;for(var _0x73c389 in this[_0xf9cb('0x20')]){if(typeof this['agents'][_0x73c389]!==_0xf9cb('0xae')){if(this[_0xf9cb('0x20')][_0x73c389][_0xf9cb('0x6d')]==='not_inuse'&&this[_0xf9cb('0x20')][_0x73c389][_0xf9cb('0x89')]===_0xf9cb('0x88')){_0x46965e[_0xf9cb('0x9b')](this[_0xf9cb('0x20')][_0x73c389]['id']);}}}_0x5b0500[_0xf9cb('0x65')]=0x1;return this[_0xf9cb('0x202')](_0x5b0500['id'],_0x46965e,0x1,_0x5b0500[_0xf9cb('0x203')],_0x5b0500)[_0xf9cb('0x3d')](function(_0x182c76){_0x5b0500['temp']=0x1;if(_0x182c76){if(!utils[_0xf9cb('0x1f5')](_0x182c76)){utils[_0xf9cb('0x64')](_0x5b0500,0x1,0x0);return hopperUtils[_0xf9cb('0x1fc')](_0x5b0500)['then'](sendMessageReschedule(_0x5b0500))[_0xf9cb('0xa3')](loggerCatch(_0xf9cb('0x204')));}else{_0x5b0500[_0xf9cb('0x67')]=utils[_0xf9cb('0x68')][_0xf9cb('0x1f7')];if(_[_0xf9cb('0xee')](_0x182c76[0x0])||_[_0xf9cb('0xee')](_0x182c76[0x0][_0xf9cb('0x174')])||_[_0xf9cb('0xee')](_0x182c76[0x0][_0xf9cb('0x15f')])){_0x4b0cd0[_0xf9cb('0x1fd')]('[actionOriginate]\x20',_0x5b0500,_0x182c76[0x0]);}else{return hopperUtils[_0xf9cb('0x1fe')](_['pick'](_0x182c76[0x0],[_0xf9cb('0xda'),_0xf9cb('0x15f')]))['then'](_0x4b0cd0[_0xf9cb('0x1de')](_0x5b0500,_0x182c76[0x0]))[_0xf9cb('0xa3')](_0x4b0cd0[_0xf9cb('0x157')](_0xf9cb('0x205'),_0x5b0500));}}}})[_0xf9cb('0xa3')](loggerGetContactDialer(_0xf9cb('0x206'),_0x5b0500,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x38a954,_0x1ac456,_0x1c2e40,_0x1a8b11,_0x263577,_0x20735c){loggerPredictive['info'](_0xf9cb('0x207'));loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x208'),_0x38a954);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x209'),_0x1ac456);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x20a'),_0x1c2e40);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x20b'),_0x1a8b11);loggerPredictive[_0xf9cb('0x44')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x263577);loggerPredictive['info'](_0xf9cb('0x4f'));return new Promise(function(_0x5952ac,_0xb03083){if(_0x38a954<=0x0||isNaN(_0x38a954)){return _0xb03083(msgResponse(_0xf9cb('0x20c'),_0xf9cb('0x83'),'m\x20=\x20'+_0x38a954));}if(_0x1c2e40<=0x0||isNaN(_0x1c2e40)){return _0xb03083(msgResponse(_0xf9cb('0x20c'),_0xf9cb('0x83'),'Ts\x20=\x20'+_0x1c2e40));}if(_0x1a8b11<=0x0||isNaN(_0x1a8b11)){return _0xb03083(msgResponse(_0xf9cb('0x20c'),_0xf9cb('0x83'),_0xf9cb('0x20d')+_0x1a8b11));}if(_0x1ac456<=0x0||isNaN(_0x1ac456)){return _0xb03083(msgResponse(_0xf9cb('0x20c'),_0xf9cb('0x83'),_0xf9cb('0x20e')+_0x1ac456));}if(_0x263577<=0x0||isNaN(_0x263577)){return _0xb03083(msgResponse(_0xf9cb('0x20c'),_0xf9cb('0x83'),_0xf9cb('0x20f')+_0x263577));}_0x20735c=_0x20735c||0x0;var _0x4e11f7=0x1/_0x1c2e40;var _0x12c12a=0x0;var _0x4caf47=0x0;var _0xa04422=0x0;var _0x4fc82b=0x0;for(var _0x2e6bb3=0x0;_0xa04422<_0x263577;_0x2e6bb3+=0x1){_0x4caf47=_0x2e6bb3/_0x1ac456;_0x12c12a=(_0x1a8b11*_0x4caf47+_0x20735c)/_0x4e11f7;_0xa04422=utils[_0xf9cb('0x210')](_0x12c12a,_0x38a954);_0x4fc82b=_0x12c12a/_0x38a954*(0x1-utils[_0xf9cb('0x210')](_0x12c12a,_0x38a954));}return _0x5952ac({'erlangCalls':_0x2e6bb3,'erlangCallToSecond':_0x1ac456/_0x2e6bb3,'erlangAbandonmentRate':_0xa04422,'erlangBusyFactor':_0x4fc82b});});};Dialer[_0xf9cb('0x84')][_0xf9cb('0x1d2')]=function(_0x197df2,_0x52e5f6,_0x329fb3,_0x334cc2,_0x28e421,_0x4f7771){loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x211'));loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x208'),_0x197df2);loggerPredictive['info'](_0xf9cb('0x209'),_0x52e5f6);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x20a'),_0x329fb3);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x20b'),_0x334cc2);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x212'),_0x28e421);loggerPredictive[_0xf9cb('0x44')](_0xf9cb('0x4f'));return new Promise(function(_0x2a4974,_0x37995d){if(_0x197df2<=0x0||isNaN(_0x197df2)){return _0x37995d(msgResponse(_0xf9cb('0x213'),_0xf9cb('0x83'),_0xf9cb('0x214')+_0x197df2));}if(_0x329fb3<=0x0||isNaN(_0x329fb3)){return _0x37995d(msgResponse(_0xf9cb('0x213'),_0xf9cb('0x83'),'Ts\x20=\x20'+_0x329fb3));}if(_0x334cc2<=0x0||isNaN(_0x334cc2)){return _0x37995d(msgResponse('[busyFactor]',_0xf9cb('0x83'),_0xf9cb('0x20d')+_0x334cc2));}if(_0x52e5f6<=0x0||isNaN(_0x52e5f6)){return _0x37995d(msgResponse('[busyFactor]','Error',_0xf9cb('0x20e')+_0x52e5f6));}if(_0x28e421<=0x0||isNaN(_0x28e421)){return _0x37995d(msgResponse('[busyFactor]',_0xf9cb('0x83'),_0xf9cb('0x215')+_0x28e421));}_0x4f7771=_0x4f7771||0x0;var _0x490658=0x1/_0x329fb3;var _0x596fa1=0x0;var _0x13f03d=0x0;var _0x26a982=0x0;var _0x27be86=0x0;for(var _0xdeef2a=0x0;_0x27be86<_0x28e421;_0xdeef2a+=0x1){_0x13f03d=_0xdeef2a/_0x52e5f6;_0x596fa1=(_0x334cc2*_0x13f03d+_0x4f7771)/_0x490658;_0x26a982=utils[_0xf9cb('0x210')](_0x596fa1,_0x197df2);_0x27be86=_0x596fa1/_0x197df2*(0x1-utils[_0xf9cb('0x210')](_0x596fa1,_0x197df2));}return _0x2a4974({'erlangCalls':_0xdeef2a,'erlangCallToSecond':_0x52e5f6/_0xdeef2a,'erlangAbandonmentRate':_0x26a982,'erlangBusyFactor':_0x27be86});});};module[_0xf9cb('0x216')]=Dialer; \ No newline at end of file +var _0xd7e2=['isArray','length','Action','command','interval','content','indexOf','true','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Timezone:\x20','syncCampaigns','undefined','isIVRCampaign','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','catch','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncAgentComplete]','droptime','getSeconds','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','statedesc','dropreason','TIMEOUT','agiafterat','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','dialAbandonedMaxRetry','ListId','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','isNil','locked','stateinterface','rrmemory','push','idHopper','paused','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','dialAMDActive','[syncHangupInAMDIvr]','outboundAnswerAgiCallsDay','countcongestionretry','dialGlobalMaxRetry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Normal\x20Clearing','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','dialPreviewRecallmeReminder','filter','reachable','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','sequence','enqueue','[Dialer][checkChannel]','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','handleIvr','actionOriginate','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','custom:agentnosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalHitRate','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','getVoiceQueueRtPauses','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','floor','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[actionOriginate]\x20','checkIsBlackList','checkContactBlack','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','[abandonmentRate]','interval\x20=\x20','Amax\x20=\x20','erlangb','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/agentComplete','./models/hangup','env','127.0.0.1','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','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','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','stack','error','checkContactLowerLimitOriginate','temp','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','\x20INTERVAL_IS_NULL','Interval','Intervals','NULL_INTERVAL','isEmpty','INACTIVE','\x20NOT\x20Active','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','Error','active','SIP/%s','status','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xd7e2,0x183));var _0x2d7e=function(_0x3d8536,_0x530762){_0x3d8536=_0x3d8536-0x0;var _0x29a076=_0xd7e2[_0x3d8536];return _0x29a076;};'use strict';var util=require(_0x2d7e('0x0'));var _=require(_0x2d7e('0x1'));var uuid=require(_0x2d7e('0x2'));var moment=require(_0x2d7e('0x3'));var rr=require('rr');var Redis=require(_0x2d7e('0x4'));var utils=require(_0x2d7e('0x5'));var hopperUtils=require(_0x2d7e('0x6'));var ut=require(_0x2d7e('0x7'));var config=require(_0x2d7e('0x8'));var logger=require(_0x2d7e('0x9'))(_0x2d7e('0xa'));var loggerBooked=require(_0x2d7e('0x9'))(_0x2d7e('0xb'));var loggerPredictive=require(_0x2d7e('0x9'))(_0x2d7e('0xc'));var loggerPredictiveCalls=require(_0x2d7e('0x9'))(_0x2d7e('0xd'));var loggerSyncQueueSummary=require(_0x2d7e('0x9'))('syncQueueSummary');var ami=require(_0x2d7e('0xe'));config[_0x2d7e('0xf')]=_[_0x2d7e('0x10')](config[_0x2d7e('0xf')],{'host':_0x2d7e('0x11'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2d7e('0xf')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x2d7e('0x12'));var RpcSetting=require(_0x2d7e('0x13'));var Interval=require(_0x2d7e('0x14'));var Action=require(_0x2d7e('0x15'));var History=require(_0x2d7e('0x16'));var Final=require('./models/final');var AgentComplete=require(_0x2d7e('0x17'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x2d7e('0x18'));var ipAgi=process[_0x2d7e('0x19')]['XCALLY_IP_AGI']||_0x2d7e('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x2d7e('0x1b')]['enqueue']=function(_0x3a0c70){this[_0x2d7e('0x1c')]=this['tail']?this['tail'][_0x2d7e('0x1d')](_0x3a0c70):_0x3a0c70();};function Dialer(_0x4f5fb4,_0x51f9ce){this['sequence']=new Sequence();this[_0x2d7e('0x1e')]=_0x51f9ce;this[_0x2d7e('0x1f')]=_0x4f5fb4[_0x2d7e('0x1f')];this['campaigns']=_0x4f5fb4[_0x2d7e('0x20')];this[_0x2d7e('0x21')]=_0x4f5fb4[_0x2d7e('0x21')];this['trunks']=_0x4f5fb4[_0x2d7e('0x22')];this['maxNumberOriginate']=config[_0x2d7e('0x23')]||0x2;this['channels']={};this[_0x2d7e('0x24')]={};this[_0x2d7e('0x25')]={};this[_0x2d7e('0x26')]={};this['optionPredictive']={};this[_0x2d7e('0x27')]={};this[_0x2d7e('0x28')]={};this[_0x2d7e('0x29')]={};this[_0x2d7e('0x2a')]={};this[_0x2d7e('0x2b')]={};this['queuesSummary']={};ami['on']('agentconnect',this[_0x2d7e('0x2c')][_0x2d7e('0x2d')](this));ami['on'](_0x2d7e('0x2e'),this[_0x2d7e('0x2f')][_0x2d7e('0x2d')](this));ami['on'](_0x2d7e('0x30'),this['syncOriginateResponse'][_0x2d7e('0x2d')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x2d7e('0x2d')](this));ami['on'](_0x2d7e('0x31'),this[_0x2d7e('0x32')][_0x2d7e('0x2d')](this));ami['on'](_0x2d7e('0x33'),this[_0x2d7e('0x34')][_0x2d7e('0x2d')](this));ami['on'](_0x2d7e('0x35'),this[_0x2d7e('0x36')][_0x2d7e('0x2d')](this));ami['on'](_0x2d7e('0x37'),this[_0x2d7e('0x38')]['bind'](this));ami['on'](_0x2d7e('0x39'),this[_0x2d7e('0x3a')][_0x2d7e('0x2d')](this));ami['on'](_0x2d7e('0x3b'),this[_0x2d7e('0x3c')][_0x2d7e('0x2d')](this));ami['on'](_0x2d7e('0x3d'),this['syncQueueStatusComplete'][_0x2d7e('0x2d')](this));this[_0x2d7e('0x3e')]();this[_0x2d7e('0x3f')]();RpcSetting[_0x2d7e('0x40')]()[_0x2d7e('0x41')](function(_0xcf6818){previewRecallmeReminderInterval=_0xcf6818[_0x2d7e('0x42')];});}function isNotNull(_0x315edd){return _0x315edd!==null&&!_[_0x2d7e('0x43')](_0x315edd);}function msgResponse(_0x3e2917,_0x446be6,_0x45e94d){return{'action':_0x3e2917,'response':_0x446be6,'message':_0x45e94d,'stack':_0x45e94d};}function emit(_0x2fc230,_0x180eac,_0x1be87c){io['to'](_0x2fc230)[_0x2d7e('0x44')](_0x180eac,_0x1be87c);}function emitOutboundVoiceQueueSummary(_0x1b7da7){if(_0x1b7da7[_0x2d7e('0x45')]===_0x2d7e('0x46')){logger[_0x2d7e('0x47')](_0x2d7e('0x48'),util[_0x2d7e('0x49')](_0x1b7da7,{'showHidden':![],'depth':null}));emit(util[_0x2d7e('0x4a')](_0x2d7e('0x4b'),_0x1b7da7[_0x2d7e('0x4c')]),_0x2d7e('0x4d'),_0x1b7da7);}}function checkGetDataPredictive(_0x441277){if(isNotNull(_0x441277)&&!_['isEmpty'](_0x441277)){loggerPredictive[_0x2d7e('0x4e')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x4f'),_0x441277['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x2d7e('0x50'),_0x441277['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x51'),_0x441277['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x52'),_0x441277[_0x2d7e('0x53')]);loggerPredictive[_0x2d7e('0x4e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x441277[_0x2d7e('0x54')]);loggerPredictive['info'](_0x2d7e('0x55'),_0x441277[_0x2d7e('0x56')]);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x57'));if(_0x441277[_0x2d7e('0x58')]>0x0){if(!_[_0x2d7e('0x43')](_0x441277[_0x2d7e('0x56')])&&_0x441277[_0x2d7e('0x56')]>0x0){return!![];}loggerPredictive['info'](_0x2d7e('0x59'));if(!_[_0x2d7e('0x43')](_0x441277[_0x2d7e('0x54')])&&_0x441277[_0x2d7e('0x54')]>0x0){return!![];}loggerPredictive['info'](_0x2d7e('0x5a'));}else{loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x5b'));}}else{loggerPredictive['info'](_0x2d7e('0x5c'));}return![];}function mergeDataErlangB(_0x4e5958){return function(_0x1bd22c){loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x5d'));loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x5e'),_0x1bd22c[_0x2d7e('0x5f')]);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x60'),_0x1bd22c[_0x2d7e('0x61')]);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x62'),_0x1bd22c[_0x2d7e('0x63')]);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x64'),_0x1bd22c[_0x2d7e('0x65')]);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x62'),_0x1bd22c['erlangAbandonmentRate']);loggerPredictive['info'](_0x2d7e('0x57'));_[_0x2d7e('0x66')](_0x4e5958,_0x1bd22c);};}function ifInterval(_0x5bab8e,_0x292fb9){if(_[_0x2d7e('0x43')](_0x292fb9)){return![];}return utils['getSeconds'](undefined,_0x292fb9)<_0x5bab8e*0x3c;}function clearPredictiveAttributes(_0xbc89ee){if(_0xbc89ee[_0x2d7e('0x28')]){_0xbc89ee['startProgressive']=undefined;loggerPredictive[_0x2d7e('0x47')](_0xbc89ee[_0x2d7e('0x4c')],_0x2d7e('0x67'));}if(_0xbc89ee['startPredictive']){_0xbc89ee[_0x2d7e('0x27')]=undefined;loggerPredictive[_0x2d7e('0x47')](_0xbc89ee['name'],'startPredictive\x20value\x20cleared');}if(_0xbc89ee[_0x2d7e('0x68')]){clearInterval(_0xbc89ee[_0x2d7e('0x68')]);_0xbc89ee[_0x2d7e('0x68')]=undefined;loggerPredictive[_0x2d7e('0x47')](_0xbc89ee[_0x2d7e('0x4c')],_0x2d7e('0x69'));}}function loggerCatchPredictive(_0x53ffd2,_0x50df10){return function(_0x26351f){loggerPredictive['error'](_0x50df10['name'],_0x53ffd2);loggerPredictive['error'](_0x26351f[_0x2d7e('0x6a')]);clearPredictiveAttributes(_0x50df10);};}function loggerCatch(_0x1603e1){return function(_0x10ee42){logger[_0x2d7e('0x6b')](_0x1603e1,util['inspect'](_0x10ee42,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x2835f6,_0x559db3,_0xe9bbc1){return function(_0x124362){utils[_0x2d7e('0x6c')](_0x559db3,_0xe9bbc1,0x0);_0x559db3[_0x2d7e('0x6d')]=0x0;logger[_0x2d7e('0x6b')](_0x2835f6,util[_0x2d7e('0x49')](_0x124362,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x484870){return function(_0x16220c){if(isNotNull(_0x16220c)&&isNotNull(_0x16220c[0x0])){if(_0x16220c[0x0]['contactsRescheduled']>0x0){_0x484870[_0x2d7e('0x6e')]=utils[_0x2d7e('0x6f')][_0x2d7e('0x70')];logger['info'](_0x2d7e('0x71')+_0x484870[_0x2d7e('0x4c')],_0x16220c[0x0][_0x2d7e('0x72')],_0x2d7e('0x73'));}else{_0x484870[_0x2d7e('0x6e')]=utils['CAMPAIGN_STATUS'][_0x2d7e('0x74')];logger['info'](_0x2d7e('0x75')+_0x484870[_0x2d7e('0x4c')]);}}};}function createObjHistory(_0x3c8256,_0x2dc5f6,_0x7bcc3c,_0xe1a8c8,_0xf46694){_0x3c8256[_0x2d7e('0x6e')]=_0x7bcc3c;var _0x5c9d1e=new Action(_0x3c8256,_0x2dc5f6);var _0x222309=new History(_0x5c9d1e);_0x222309['state']=_0xe1a8c8;_0x222309['statedesc']=_0xf46694;_0x222309['endtime']=_0x5c9d1e[_0x2d7e('0x76')];return _0x222309;}function unlockQueueStatus(_0x16cdce,_0x50c8e1){setTimeout(function(){if(_['isUndefined'](_0x16cdce[_0x2d7e('0x77')])){loggerBooked[_0x2d7e('0x6b')]('[unlockQueueStatus][undefined]',_0x50c8e1);}_0x16cdce['queueStatusComplete']=!![];loggerBooked[_0x2d7e('0x4e')](_0x2d7e('0x78'),_0x50c8e1,JSON[_0x2d7e('0x79')](_[_0x2d7e('0x7a')](_0x16cdce,['name',_0x2d7e('0x77')])));},0x1f3);}function checkInterval(_0x42718b){return function(){if(!isNotNull(_0x42718b['Interval'])){_0x42718b[_0x2d7e('0x6e')]=utils[_0x2d7e('0x6f')]['NULL_INTERVAL'];throw _0x42718b[_0x2d7e('0x4c')]+_0x2d7e('0x7b');}if(!isNotNull(_0x42718b[_0x2d7e('0x7c')][_0x2d7e('0x7d')])){_0x42718b['message']=utils[_0x2d7e('0x6f')][_0x2d7e('0x7e')];throw _0x42718b[_0x2d7e('0x4c')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x2d7e('0x7f')](_0x42718b[_0x2d7e('0x7c')]['Intervals']))){_0x42718b['message']=utils['CAMPAIGN_STATUS'][_0x2d7e('0x7e')];throw _0x42718b[_0x2d7e('0x4c')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x1d6f9d){return function(){if(!utils['isIVRCampaignActive'](_0x1d6f9d)){_0x1d6f9d[_0x2d7e('0x6e')]=utils['CAMPAIGN_STATUS'][_0x2d7e('0x80')];throw _0x1d6f9d['name']+_0x2d7e('0x81');}};}function emitCampaignSummary(_0x5f1c6d){if(utils['isIVRCampaign'](_0x5f1c6d)){emit(util['format']('campaign:ivr:%s',_0x5f1c6d[_0x2d7e('0x4c')]),_0x2d7e('0x82'),_0x5f1c6d);}}function loggerCatchQueueSummary(_0x53181d,_0x64a065){return function(_0x39a5f8){clearPredictiveAttributes(_0x64a065);emitCampaignSummary(_0x64a065);loggerSyncQueueSummary['debug'](_0x53181d,util[_0x2d7e('0x49')](_0x39a5f8,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4eb78d){if(_0x4eb78d[_0x2d7e('0x83')]){if(_0x4eb78d['originated']===0x0){_0x4eb78d[_0x2d7e('0x83')]=![];_0x4eb78d[_0x2d7e('0x6e')]=utils[_0x2d7e('0x6f')][_0x2d7e('0x80')];loggerSyncQueueSummary['debug'](_0x2d7e('0x84'),_0x4eb78d[_0x2d7e('0x4c')],'is\x20not\x20active');}else{_0x4eb78d['message']=utils[_0x2d7e('0x6f')][_0x2d7e('0x85')];loggerSyncQueueSummary[_0x2d7e('0x47')](_0x2d7e('0x84'),_0x4eb78d[_0x2d7e('0x4c')],_0x2d7e('0x86'));}emitCampaignSummary(_0x4eb78d);}}function myreject(_0x27fb7){return function(_0x11c443){return _0x27fb7(msgResponse('[ifTime][Action]',_0x2d7e('0x87'),JSON[_0x2d7e('0x79')](_0x11c443)));};}Dialer[_0x2d7e('0x1b')]['isTrunkReachable']=function(_0x3d869e){return!_[_0x2d7e('0x43')](_0x3d869e)&&_0x3d869e&&!_['isUndefined'](_0x3d869e['name'])&&!_[_0x2d7e('0x43')](_0x3d869e[_0x2d7e('0x88')])&&_0x3d869e[_0x2d7e('0x88')]&&(this[_0x2d7e('0x22')][util[_0x2d7e('0x4a')](_0x2d7e('0x89'),_0x3d869e[_0x2d7e('0x4c')])]['status']==='reachable'||this[_0x2d7e('0x22')][util[_0x2d7e('0x4a')](_0x2d7e('0x89'),_0x3d869e[_0x2d7e('0x4c')])][_0x2d7e('0x8a')]==='unmonitored');};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x8b')]=function(_0x36a655){var _0x4a3448=this;return function(){if(!_0x4a3448[_0x2d7e('0x8c')](_0x36a655[_0x2d7e('0x8d')])){if(!_0x4a3448['isTrunkReachable'](_0x36a655[_0x2d7e('0x8e')])){_0x36a655[_0x2d7e('0x6e')]=utils[_0x2d7e('0x6f')][_0x2d7e('0x8f')];throw _0x36a655[_0x2d7e('0x4c')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x90')]=function(_0x53eb0b,_0x20e5cc,_0xa570c0,_0x36258c){var _0x178a93=this;return function(){var _0x4b0ec2=!![];return _0x178a93[_0x2d7e('0x91')](_0x53eb0b,_0x20e5cc,_0xa570c0,_0x36258c,_0x4b0ec2);};};Dialer['prototype'][_0x2d7e('0x92')]=function(_0x489d51,_0x5d713d,_0x51c24f,_0x4e8e0a){var _0x15ed35=this;return function(){var _0x2513aa=![];return _0x15ed35[_0x2d7e('0x91')](_0x489d51[_0x2d7e('0x7d')],_0x5d713d,_0x51c24f,_0x4e8e0a,_0x2513aa);};};Dialer[_0x2d7e('0x1b')]['ifTimeIvr']=function(_0x5b74c4,_0x22e48c,_0x50a06d,_0x288ca9,_0x27f603){var _0x5e6a58=[];return new Promise(function(_0x2cc666,_0x56dda3){if(!isNotNull(_0x5b74c4)){_0x288ca9[_0x2d7e('0x6e')]=utils[_0x2d7e('0x6f')][_0x2d7e('0x7e')];return _0x56dda3(msgResponse(_0x2d7e('0x93'),'Failure',_0x50a06d+_0x2d7e('0x94')));}if(_[_0x2d7e('0x7f')](_0x5b74c4)){_0x288ca9[_0x2d7e('0x6e')]=utils[_0x2d7e('0x6f')][_0x2d7e('0x95')];return _0x56dda3(msgResponse(_0x2d7e('0x93'),_0x2d7e('0x96'),_0x50a06d+_0x2d7e('0x97')));}if(_0x22e48c&&_[_0x2d7e('0x43')](config[_0x2d7e('0x98')][_0x22e48c])){_0x288ca9[_0x2d7e('0x6e')]=utils[_0x2d7e('0x6f')][_0x2d7e('0x99')];return _0x56dda3(msgResponse(_0x2d7e('0x93'),_0x2d7e('0x96'),_0x50a06d+_0x2d7e('0x9a')+_0x22e48c));}if(_[_0x2d7e('0x9b')](_0x5b74c4)){for(var _0x424002=0x0;_0x424002<_0x5b74c4[_0x2d7e('0x9c')];_0x424002+=0x1){_0x5e6a58['push'](ami[_0x2d7e('0x9d')]({'action':_0x2d7e('0x9e'),'command':util[_0x2d7e('0x4a')]('iftime\x20%s,%s',_0x5b74c4[_0x424002][_0x2d7e('0x9f')],!_['isUndefined'](config[_0x2d7e('0x98')][_0x22e48c])?_0x22e48c:'')})[_0x2d7e('0x41')](function(_0x472f57){return _0x472f57[_0x2d7e('0xa0')][_0x2d7e('0xa1')](_0x2d7e('0xa2'))>=0x0;})['catch'](myreject(_0x56dda3)));}}else{_0x5e6a58['push'](ami[_0x2d7e('0x9d')]({'action':'command','command':util['format']('iftime\x20%s,%s',_0x5b74c4,!_[_0x2d7e('0x43')](config['timezones'][_0x22e48c])?_0x22e48c:'')})[_0x2d7e('0x41')](function(_0x2ace07){return _0x2ace07[_0x2d7e('0xa0')][_0x2d7e('0xa1')](_0x2d7e('0xa2'))>=0x0;})['catch'](myreject(_0x56dda3)));}Promise[_0x2d7e('0xa3')](_0x5e6a58)[_0x2d7e('0x41')](function(_0x996bed){var _0xd04730=_[_0x2d7e('0xa4')](_0x996bed);if(_0xd04730){return _0x2cc666(_0xd04730);}else{_0x288ca9[_0x2d7e('0x6e')]=_0x27f603?utils['CAMPAIGN_STATUS'][_0x2d7e('0xa5')]:utils[_0x2d7e('0x6f')][_0x2d7e('0xa6')];return _0x56dda3(msgResponse('[ifTime][promiseAll]','Failure','Global:\x20'+_0x27f603+'\x20'+_0x50a06d+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2d7e('0x49')](_0x5b74c4,{'showHidden':![],'depth':null})+_0x2d7e('0xa7')+_0x22e48c));}})['catch'](function(_0x3fc217){return _0x56dda3(msgResponse('ifTime','Failure',JSON[_0x2d7e('0x79')](_0x3fc217)));});});};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x3e')]=function(){var _0x5ed586=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x2d7e('0x41')](function(){setInterval(function(){_0x5ed586[_0x2d7e('0xa8')]();},0x3e8);});};Dialer[_0x2d7e('0x1b')][_0x2d7e('0xa8')]=function(){var _0x3f8cb6=this;var _0xb5789e;for(var _0x1427ce in this['campaigns']){if(typeof this[_0x2d7e('0x20')][_0x1427ce]!==_0x2d7e('0xa9')){_0xb5789e=this[_0x2d7e('0x20')][_0x1427ce];if(utils[_0x2d7e('0xaa')](_0xb5789e)&&utils[_0x2d7e('0xab')](_0xb5789e)){_0xb5789e['sendMessageOneNotActive']=!![];Promise[_0x2d7e('0xac')]()[_0x2d7e('0x41')](checkIsIVRCampaignActive(_0xb5789e))['then'](checkInterval(_0xb5789e))[_0x2d7e('0x41')](_0x3f8cb6['checkIsTrunkReachable'](_0xb5789e))['then'](_0x3f8cb6[_0x2d7e('0x90')](_0xb5789e[_0x2d7e('0xad')],_0xb5789e[_0x2d7e('0xae')],_0xb5789e[_0x2d7e('0x4c')],_0xb5789e))['then'](_0x3f8cb6[_0x2d7e('0x92')](_0xb5789e[_0x2d7e('0x7c')],_0xb5789e[_0x2d7e('0xae')],_0xb5789e[_0x2d7e('0x4c')],_0xb5789e))[_0x2d7e('0x41')](_0x3f8cb6[_0x2d7e('0xaf')](_0xb5789e))[_0x2d7e('0xb0')](loggerCatchQueueSummary(_0x2d7e('0xb1'),_0xb5789e));}else{notSendMessagesCampaign(_0xb5789e);}}}};Dialer['prototype']['checkDialMethod']=function(_0x2ec8bd){if(_0x2ec8bd[_0x2d7e('0xb2')]!==_0x2d7e('0xc')){clearPredictiveAttributes(_0x2ec8bd);}switch(_0x2ec8bd['dialMethod']){case _0x2d7e('0xb3'):this[_0x2d7e('0xb4')](_0x2ec8bd,0x1);break;case _0x2d7e('0xb5'):this[_0x2d7e('0xb4')](_0x2ec8bd,_0x2ec8bd[_0x2d7e('0xb6')]);break;case _0x2d7e('0xc'):this[_0x2d7e('0xc')](_0x2ec8bd);break;case _0x2d7e('0xb'):this['handlePower'](_0x2ec8bd,0x1);break;default:logger[_0x2d7e('0x6b')](_0x2d7e('0xb7'),_0x2ec8bd[_0x2d7e('0x4c')],_0x2d7e('0xb8'));}};Dialer['prototype']['ifTime']=function(_0x1c8e3b,_0xc3a6c7){var _0x3b8f92=_0x1c8e3b[_0x2d7e('0xae')];var _0x15ff54=_0xc3a6c7?_0x1c8e3b['dialGlobalInterval']:_0x1c8e3b[_0x2d7e('0x7c')][_0x2d7e('0x7d')];logger[_0x2d7e('0xb9')](_0x2d7e('0xba'),_0x15ff54,_0x3b8f92,_0x1c8e3b[_0x2d7e('0x4c')],util[_0x2d7e('0x4a')](_0x2d7e('0xbb'),_0x1c8e3b[_0x2d7e('0x4c')],_0x1c8e3b['id']));var _0x56dbd8=null;return Interval['intervalIftime'](_0x15ff54,_0x3b8f92)['then'](function(_0x18763c){if(_0x18763c===!![]){return _0x18763c;}else{_0x1c8e3b[_0x2d7e('0x6e')]=_0xc3a6c7?utils[_0x2d7e('0x6f')][_0x2d7e('0xa5')]:utils[_0x2d7e('0x6f')][_0x2d7e('0xa6')];_0x56dbd8=msgResponse('[ifTime][promiseAll]',_0x2d7e('0x96'),'Global:\x20'+_0xc3a6c7+'\x20'+_0x1c8e3b[_0x2d7e('0x4c')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2d7e('0x49')](_0x15ff54,{'showHidden':![],'depth':null})+_0x2d7e('0xa7')+_0x3b8f92);}if(_0x56dbd8!==null){logger['silly'](_0x2d7e('0xbc'),_0x56dbd8);_0x56dbd8[_0x2d7e('0xbd')]=_0xc3a6c7;throw _0x56dbd8;}})[_0x2d7e('0xb0')](function(_0x323758){logger[_0x2d7e('0x6b')](_0x2d7e('0xbe'),_0x323758);throw msgResponse(_0x2d7e('0xbf'),_0x2d7e('0x87'),util['inspect'](_0x323758,{'showHidden':![],'depth':null}));});};Dialer[_0x2d7e('0x1b')]['syncAgentConnect']=function(_0x5c92d0){if(this[_0x2d7e('0x1f')][_0x5c92d0[_0x2d7e('0xc0')]]){if(this['uniqueId'][_0x5c92d0['uniqueid']]&&this[_0x2d7e('0x26')][_0x5c92d0[_0x2d7e('0xc1')]][_0x2d7e('0x45')]!==_0x2d7e('0xc2')){this[_0x2d7e('0xc3')](this['voiceQueues'][_0x5c92d0[_0x2d7e('0xc0')]]);this['uniqueId'][_0x5c92d0['uniqueid']]['answertime']=moment()[_0x2d7e('0x4a')](_0x2d7e('0xc4'));}}};Dialer[_0x2d7e('0x1b')][_0x2d7e('0xc5')]=function(_0x2b83ee){var _0x325d0d=this[_0x2d7e('0x26')][_0x2b83ee[_0x2d7e('0xc1')]];if(this[_0x2d7e('0x1f')][_0x2b83ee[_0x2d7e('0xc0')]]){if(_0x325d0d&&_0x325d0d[_0x2d7e('0x45')]!==_0x2d7e('0xc2')){delete this[_0x2d7e('0x26')][_0x2b83ee[_0x2d7e('0xc1')]];this[_0x2d7e('0x1f')][_0x2b83ee[_0x2d7e('0xc0')]][_0x2d7e('0xc6')]+=0x1;var _0x4d36b3=new AgentComplete(_0x325d0d,_0x2b83ee);if(_0x2b83ee[_0x2d7e('0xc7')]===_0x2d7e('0xc8')){_0x4d36b3['agiafterat']=this['voiceQueues'][_0x2b83ee[_0x2d7e('0xc0')]][_0x2d7e('0xc9')]&&this['voiceQueues'][_0x2b83ee['queue']][_0x2d7e('0xca')]?moment()[_0x2d7e('0x4a')](_0x2d7e('0xc4')):undefined;}hopperUtils[_0x2d7e('0xcb')](_0x4d36b3)[_0x2d7e('0xb0')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x2d7e('0xcc')](_0x4d36b3)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0xcd')));}}};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x2f')]=function(_0x45362b){var _0x5c559c=this[_0x2d7e('0x26')][_0x45362b['uniqueid']];var _0x20d6c5=this;var _0x2d0369=![];var _0x3e933f;var _0x1085da;if(this[_0x2d7e('0x1f')][_0x45362b['queue']]){if(_0x5c559c&&_0x5c559c[_0x2d7e('0x45')]!==_0x2d7e('0xc2')){delete this[_0x2d7e('0x26')][_0x45362b[_0x2d7e('0xc1')]];this[_0x2d7e('0xc3')](this['voiceQueues'][_0x45362b['queue']]);_0x5c559c[_0x2d7e('0xce')]=moment()[_0x2d7e('0x4a')](_0x2d7e('0xc4'));var _0x3f0c56=new QueueCallerAbandon(_0x5c559c,_0x45362b);if(utils[_0x2d7e('0xcf')](_0x5c559c[_0x2d7e('0xce')],_0x5c559c[_0x2d7e('0xd0')])>=_0x5c559c[_0x2d7e('0xd1')]){this[_0x2d7e('0x1f')][_0x45362b[_0x2d7e('0xc0')]][_0x2d7e('0xd2')]+=0x1;this[_0x2d7e('0x1f')][_0x45362b['queue']][_0x2d7e('0xd3')]+=0x1;this[_0x2d7e('0x1f')][_0x45362b[_0x2d7e('0xc0')]][_0x2d7e('0xd4')]+=0x1;_0x3f0c56[_0x2d7e('0xd5')]=0xa;_0x3f0c56[_0x2d7e('0xd6')]='Drop';_0x3f0c56[_0x2d7e('0xd7')]=_0x2d7e('0xd8');_0x3f0c56[_0x2d7e('0xd9')]=this[_0x2d7e('0x1f')][_0x45362b[_0x2d7e('0xc0')]][_0x2d7e('0xc9')]?moment()[_0x2d7e('0x4a')](_0x2d7e('0xc4')):undefined;_0x3f0c56[_0x2d7e('0xda')]+=0x1;_0x3f0c56[_0x2d7e('0xdb')]+=0x1;_0x3e933f=this[_0x2d7e('0x1f')][_0x45362b[_0x2d7e('0xc0')]][_0x2d7e('0xdc')];_0x1085da=this[_0x2d7e('0x1f')][_0x45362b[_0x2d7e('0xc0')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x2d7e('0xdd')](_0x3f0c56,_0x3f0c56[_0x2d7e('0xd5')],_0x5c559c['voiceQueue'])[_0x2d7e('0x41')](function(_0x312622){_0x2d0369=_0x312622[_0x2d7e('0xde')]==0x1;if(_0x3f0c56[_0x2d7e('0xda')]>=_0x20d6c5[_0x2d7e('0x1f')][_0x45362b[_0x2d7e('0xc0')]][_0x2d7e('0xdf')]){_0x20d6c5[_0x2d7e('0xe0')](_0x3f0c56,_0x312622[_0x2d7e('0xde')]);}else{hopperUtils[_0x2d7e('0xe1')]({'active':![],'countdropretry':_0x3f0c56[_0x2d7e('0xda')],'scheduledat':moment()[_0x2d7e('0xe2')](_0x20d6c5['voiceQueues'][_0x45362b[_0x2d7e('0xc0')]][_0x2d7e('0xdc')],'minutes')[_0x2d7e('0x4a')](_0x2d7e('0xc4')),'ContactId':_0x5c559c[_0x2d7e('0xe3')],'ListId':_0x5c559c['ListId'],'VoiceQueueId':_0x5c559c[_0x2d7e('0xe4')]||undefined,'CampaignId':_0x5c559c[_0x2d7e('0xe5')]||undefined})['catch'](loggerCatch(_0x2d7e('0xe6')));var _0x2bdbf0=new History(_0x3f0c56);_0x2bdbf0[_0x2d7e('0xd5')]=0xa;_0x2bdbf0[_0x2d7e('0xd6')]=_0x2d7e('0xe7');_0x2bdbf0[_0x2d7e('0x76')]=moment()['format'](_0x2d7e('0xc4'));_0x2bdbf0[_0x2d7e('0xe8')]=_0x2bdbf0[_0x2d7e('0x76')];_0x2bdbf0[_0x2d7e('0xe9')]=_0x3f0c56[_0x2d7e('0xe9')];_0x2bdbf0[_0x2d7e('0xea')]=_0x3f0c56['calleridnum'];hopperUtils[_0x2d7e('0xcb')](_0x2bdbf0)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0xeb')));}})[_0x2d7e('0x41')](function(){if(_0x2d0369)hopperUtils[_0x2d7e('0xec')](_0x3f0c56,_0x3e933f,_0x1085da)['then'](function(){return 0x1;});});}else{this['voiceQueues'][_0x45362b[_0x2d7e('0xc0')]][_0x2d7e('0x53')]+=0x1;this[_0x2d7e('0x1f')][_0x45362b[_0x2d7e('0xc0')]][_0x2d7e('0xed')]+=0x1;_0x3f0c56[_0x2d7e('0xd5')]=0xb;_0x3f0c56[_0x2d7e('0xd6')]=_0x2d7e('0xee');_0x3f0c56[_0x2d7e('0xd7')]='CALLEREXIT';_0x3f0c56[_0x2d7e('0xef')]+=0x1;_0x3f0c56[_0x2d7e('0xdb')]+=0x1;_0x3e933f=this[_0x2d7e('0x1f')][_0x45362b['queue']][_0x2d7e('0xf0')];_0x1085da=this['voiceQueues'][_0x45362b[_0x2d7e('0xc0')]][_0x2d7e('0xf1')];hopperUtils[_0x2d7e('0xdd')](_0x3f0c56,_0x3f0c56['state'],_0x5c559c[_0x2d7e('0xf2')])['then'](function(_0x213e54){if(_0x3f0c56[_0x2d7e('0xef')]>=_0x20d6c5[_0x2d7e('0x1f')][_0x45362b[_0x2d7e('0xc0')]][_0x2d7e('0xf3')]){_0x20d6c5[_0x2d7e('0xe0')](_0x3f0c56,_0x213e54[_0x2d7e('0xde')]);}else{hopperUtils[_0x2d7e('0xe1')]({'active':![],'countabandonedretry':_0x3f0c56[_0x2d7e('0xef')],'scheduledat':moment()[_0x2d7e('0xe2')](_0x20d6c5[_0x2d7e('0x1f')][_0x45362b[_0x2d7e('0xc0')]][_0x2d7e('0xf0')],'minutes')[_0x2d7e('0x4a')](_0x2d7e('0xc4')),'ContactId':_0x5c559c[_0x2d7e('0xe3')],'ListId':_0x5c559c[_0x2d7e('0xf4')],'VoiceQueueId':_0x5c559c[_0x2d7e('0xe4')]||undefined,'CampaignId':_0x5c559c['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x32b375=new History(_0x3f0c56);_0x32b375[_0x2d7e('0xd5')]=0xb;_0x32b375[_0x2d7e('0xd6')]=_0x2d7e('0xee');_0x32b375[_0x2d7e('0x76')]=moment()[_0x2d7e('0x4a')](_0x2d7e('0xc4'));_0x32b375['endtime']=_0x32b375['starttime'];_0x32b375[_0x2d7e('0xe9')]=_0x3f0c56[_0x2d7e('0xe9')];_0x32b375[_0x2d7e('0xea')]=_0x3f0c56[_0x2d7e('0xea')];hopperUtils[_0x2d7e('0xcb')](_0x32b375)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0xf5')));}})[_0x2d7e('0x41')](function(){if(_0x2d0369)hopperUtils[_0x2d7e('0xec')](_0x3f0c56,_0x3e933f,_0x1085da)[_0x2d7e('0x41')](function(){return 0x1;});});}}}};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x38')]=function(_0x298d1c){if(this['actions'][_0x298d1c[_0x2d7e('0xc1')]]){this['actions'][_0x298d1c[_0x2d7e('0xc1')]][_0x2d7e('0xf6')]=_0x298d1c[_0x2d7e('0xf6')];}if(this[_0x2d7e('0x26')][_0x298d1c[_0x2d7e('0xc1')]]){this[_0x2d7e('0x26')][_0x298d1c[_0x2d7e('0xc1')]][_0x2d7e('0xf6')]=_0x298d1c[_0x2d7e('0xf6')];}};Dialer[_0x2d7e('0x1b')]['syncQueueMember']=function(_0x19fa4f){if(!this[_0x2d7e('0x24')][_0x19fa4f[_0x2d7e('0xf7')]]){return;}var _0x3b7293=this[_0x2d7e('0x1f')][this['actions'][_0x19fa4f[_0x2d7e('0xf7')]][_0x2d7e('0xc0')]][_0x2d7e('0xf8')]||'rrmemory';if(_0x3b7293===_0x2d7e('0xf9')){if(this[_0x2d7e('0x24')][_0x19fa4f[_0x2d7e('0xf7')]]&&_[_0x2d7e('0xfa')](this[_0x2d7e('0x24')][_0x19fa4f[_0x2d7e('0xf7')]][_0x2d7e('0xfb')])&&_0x19fa4f[_0x2d7e('0x8a')]==='1'&&_0x19fa4f['paused']==='0'){if(this['agents'][_0x19fa4f[_0x2d7e('0xfc')]]){if(!this[_0x2d7e('0x21')][_0x19fa4f[_0x2d7e('0xfc')]]['locked']){this[_0x2d7e('0x21')][_0x19fa4f[_0x2d7e('0xfc')]][_0x2d7e('0xfb')]=!![];this[_0x2d7e('0x24')][_0x19fa4f[_0x2d7e('0xf7')]]['locked']=!![];this[_0x2d7e('0x24')][_0x19fa4f[_0x2d7e('0xf7')]]['stateinterface']=_0x19fa4f[_0x2d7e('0xfc')];}}}}else if(_0x3b7293===_0x2d7e('0xfd')){if(this[_0x2d7e('0x24')][_0x19fa4f['actionid']]){if(this['agents'][_0x19fa4f[_0x2d7e('0xfc')]]){this['actions'][_0x19fa4f[_0x2d7e('0xf7')]][_0x2d7e('0xfc')]=_0x19fa4f[_0x2d7e('0xfc')];if(_[_0x2d7e('0xfa')](this[_0x2d7e('0x2a')][this[_0x2d7e('0x24')][_0x19fa4f[_0x2d7e('0xf7')]]['queue']])){this['queueBooked'][this[_0x2d7e('0x24')][_0x19fa4f[_0x2d7e('0xf7')]][_0x2d7e('0xc0')]]=[];}this[_0x2d7e('0x2a')][this[_0x2d7e('0x24')][_0x19fa4f[_0x2d7e('0xf7')]][_0x2d7e('0xc0')]][_0x2d7e('0xfe')](_[_0x2d7e('0x66')](_[_0x2d7e('0x7a')](this[_0x2d7e('0x24')][_0x19fa4f[_0x2d7e('0xf7')]],[_0x2d7e('0xff'),_0x2d7e('0xfc')]),{'status':_0x19fa4f[_0x2d7e('0x8a')],'paused':_0x19fa4f[_0x2d7e('0x100')]}));}}}};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x101')]=function(_0x45d86a){if(!this[_0x2d7e('0x24')][_0x45d86a[_0x2d7e('0xf7')]]){return;}var _0x23b373=this;var _0x2bdcf3=this[_0x2d7e('0x1f')][this[_0x2d7e('0x24')][_0x45d86a[_0x2d7e('0xf7')]][_0x2d7e('0xc0')]];var _0x985d48=_0x2bdcf3[_0x2d7e('0xf8')]||_0x2d7e('0xfd');if(_0x985d48===_0x2d7e('0xf9')){if(this[_0x2d7e('0x24')][_0x45d86a[_0x2d7e('0xf7')]]&&this['actions'][_0x45d86a[_0x2d7e('0xf7')]][_0x2d7e('0xfc')]){this[_0x2d7e('0x1e')][_0x2d7e('0x102')](this[_0x2d7e('0x24')][_0x45d86a[_0x2d7e('0xf7')]]['idHopper'],this[_0x2d7e('0x24')][_0x45d86a[_0x2d7e('0xf7')]][_0x2d7e('0xfc')])[_0x2d7e('0xb0')](function(_0x160af8){logger[_0x2d7e('0x6b')](_0x2d7e('0x103'),util['inspect'](_0x160af8,{'showHidden':![],'depth':null}));})[_0x2d7e('0x1d')](function(){_0x23b373[_0x2d7e('0xc3')](_0x23b373[_0x2d7e('0x1f')][_0x23b373['actions'][_0x45d86a[_0x2d7e('0xf7')]][_0x2d7e('0xc0')]]);_0x23b373['agents'][_0x23b373[_0x2d7e('0x24')][_0x45d86a['actionid']]['stateinterface']][_0x2d7e('0xfb')]=![];delete _0x23b373[_0x2d7e('0x24')][_0x45d86a['actionid']];unlockQueueStatus(_0x2bdcf3);});}else{this[_0x2d7e('0xc3')](this[_0x2d7e('0x1f')][this[_0x2d7e('0x24')][_0x45d86a['actionid']]['queue']]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x2d7e('0x24')][_0x45d86a[_0x2d7e('0xf7')]][_0x2d7e('0xe3')],'ListId':this['actions'][_0x45d86a[_0x2d7e('0xf7')]][_0x2d7e('0xf4')],'VoiceQueueId':this[_0x2d7e('0x24')][_0x45d86a[_0x2d7e('0xf7')]][_0x2d7e('0xe4')]||undefined,'CampaignId':this[_0x2d7e('0x24')][_0x45d86a['actionid']][_0x2d7e('0xe5')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x2d7e('0x24')][_0x45d86a['actionid']];unlockQueueStatus(_0x2bdcf3);}}else if(_0x985d48==='rrmemory'){var _0x388e13;if(this['actions'][_0x45d86a[_0x2d7e('0xf7')]]&&!_[_0x2d7e('0x7f')](this[_0x2d7e('0x2a')][this[_0x2d7e('0x24')][_0x45d86a[_0x2d7e('0xf7')]]['queue']])){if(this[_0x2d7e('0x2b')][_0x23b373[_0x2d7e('0x24')][_0x45d86a[_0x2d7e('0xf7')]][_0x2d7e('0xc0')]]){this['queueBookedRR'][_0x23b373[_0x2d7e('0x24')][_0x45d86a[_0x2d7e('0xf7')]][_0x2d7e('0xc0')]]=this[_0x2d7e('0x2b')][this[_0x2d7e('0x24')][_0x45d86a['actionid']][_0x2d7e('0xc0')]]?this[_0x2d7e('0x2b')][this[_0x2d7e('0x24')][_0x45d86a[_0x2d7e('0xf7')]]['queue']]:this[_0x2d7e('0x2a')][this['actions'][_0x45d86a[_0x2d7e('0xf7')]][_0x2d7e('0xc0')]]?this[_0x2d7e('0x2a')][this['actions'][_0x45d86a[_0x2d7e('0xf7')]][_0x2d7e('0xc0')]][_0x2d7e('0x104')]||0x0:0x0;}this[_0x2d7e('0x2a')][this[_0x2d7e('0x24')][_0x45d86a['actionid']]['queue']][_0x2d7e('0x104')]=this['queueBookedRR'][this[_0x2d7e('0x24')][_0x45d86a['actionid']]['queue']];for(var _0x2461d3=0x0;_0x2461d3=_0x405017['dialGlobalMaxRetry']){_0xa9086d['stateGlobal'](_0x1daeb3,_0x44940a,_0x3e8e3f,_0x2d7e('0x125'));}else{if(_0x1daeb3[_0x2d7e('0x11f')]>=_0x405017[_0x2d7e('0x126')]){_0xa9086d[_0x2d7e('0x127')](_0x1daeb3,_0x44940a,_0x3e8e3f,_0x2d7e('0x128'));}else{hopperUtils[_0x2d7e('0xe1')]({'active':![],'countmachineretry':_0x1daeb3[_0x2d7e('0x11f')],'scheduledat':moment()[_0x2d7e('0xe2')](_0x405017[_0x2d7e('0x129')],_0x2d7e('0x12a'))[_0x2d7e('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1daeb3[_0x2d7e('0xe3')],'ListId':_0x1daeb3[_0x2d7e('0xf4')],'VoiceQueueId':_0x1daeb3[_0x2d7e('0xe4')]||undefined,'CampaignId':_0x1daeb3[_0x2d7e('0xe5')]||undefined})[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x12b')));_0x44940a({'reschedule':0x1});}}});}if(_0x210dbc[_0x2d7e('0x45')]===_0x2d7e('0xc2')&&this[_0x2d7e('0x20')][_0x210dbc[_0x2d7e('0xc0')]][_0x2d7e('0x12c')]&&_0x5c9df3[_0x2d7e('0x11c')]==='HANGUP'){delete this[_0x2d7e('0x26')][_0x5c9df3[_0x2d7e('0xc1')]];this[_0x2d7e('0xc3')](this[_0x2d7e('0x20')][_0x210dbc[_0x2d7e('0xc0')]]);_0x255f37=new Hangup(_0x210dbc,_0x5c9df3);_0x255f37[_0x2d7e('0xd5')]=0x12;_0x255f37[_0x2d7e('0xd6')]='HangupInAMD';_0x255f37[_0x2d7e('0x114')]='AMD';ami[_0x2d7e('0x44')](_0x2d7e('0x116'),ut[_0x2d7e('0x117')](_0x255f37,_0x2d7e('0x118')));this[_0x2d7e('0x119')](_0x255f37,'[syncHangupInAMDIvr][createHistory]',_0x2d7e('0x12d'));}if(_0x210dbc['type']===_0x2d7e('0xc2')&&this[_0x2d7e('0x20')][_0x210dbc[_0x2d7e('0xc0')]][_0x2d7e('0x12c')]&&_0x5c9df3[_0x2d7e('0x11c')]==='MACHINE'){return new Promise(function(_0x18594c,_0x4090b1){delete _0xa9086d[_0x2d7e('0x26')][_0x5c9df3[_0x2d7e('0xc1')]];_0xa9086d[_0x2d7e('0xc3')](_0xa9086d[_0x2d7e('0x20')][_0x210dbc[_0x2d7e('0xc0')]]);_0xa9086d[_0x2d7e('0x20')][_0x210dbc[_0x2d7e('0xc0')]]['outboundAnswerCallsDay']+=0x1;_0xa9086d[_0x2d7e('0x20')][_0x210dbc[_0x2d7e('0xc0')]][_0x2d7e('0x12e')]+=0x1;var _0x3583a8=_0xa9086d[_0x2d7e('0x20')][_0x210dbc['queue']];var _0xbb2db0=new Hangup(_0x210dbc,_0x5c9df3);_0xbb2db0['state']=0x13;_0xbb2db0[_0x2d7e('0xd6')]=_0x2d7e('0x11e');_0xbb2db0[_0x2d7e('0x114')]=_0x2d7e('0x115');_0xbb2db0[_0x2d7e('0x11f')]+=0x1;_0xbb2db0['countglobal']+=0x1;_0xbb2db0[_0x2d7e('0x118')]=!![];ami[_0x2d7e('0x44')]('custom:amd',ut[_0x2d7e('0x117')](_0xbb2db0,_0x2d7e('0x118')));hopperUtils['createHistory'](_0xbb2db0)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x120')));if(_0xbb2db0[_0x2d7e('0x121')]+_0xbb2db0[_0x2d7e('0x12f')]+_0xbb2db0[_0x2d7e('0x122')]+_0xbb2db0[_0x2d7e('0x123')]+_0xbb2db0[_0x2d7e('0xda')]+_0xbb2db0[_0x2d7e('0xef')]+_0xbb2db0['countmachineretry']+_0xbb2db0[_0x2d7e('0x124')]>=_0x3583a8[_0x2d7e('0x130')]){_0xa9086d[_0x2d7e('0x131')](_0xbb2db0,_0x18594c,_0x4090b1,_0x2d7e('0x125'));}else{if(_0xbb2db0[_0x2d7e('0x11f')]>=_0x3583a8['dialMachineMaxRetry']){_0xa9086d['createStateFinal'](_0xbb2db0,_0x18594c,_0x4090b1,_0x2d7e('0x128'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0xbb2db0['countmachineretry'],'scheduledat':moment()[_0x2d7e('0xe2')](_0x3583a8[_0x2d7e('0x129')],_0x2d7e('0x12a'))[_0x2d7e('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xbb2db0[_0x2d7e('0xe3')],'ListId':_0xbb2db0[_0x2d7e('0xf4')],'VoiceQueueId':_0xbb2db0[_0x2d7e('0xe4')]||undefined,'CampaignId':_0xbb2db0[_0x2d7e('0xe5')]||undefined})[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x12b')));_0x18594c({'reschedule':0x1});}}});}}};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x36')]=function(_0x21edb6){var _0x310c30=this[_0x2d7e('0x26')][_0x21edb6['uniqueid']];var _0x32f9eb;if(_0x310c30&&_0x310c30[_0x2d7e('0x45')]===_0x2d7e('0xc2')){delete this[_0x2d7e('0x26')][_0x21edb6[_0x2d7e('0xc1')]];this['updateOriginated'](this[_0x2d7e('0x20')][_0x310c30[_0x2d7e('0xc0')]]);this[_0x2d7e('0x20')][_0x310c30[_0x2d7e('0xc0')]][_0x2d7e('0x132')]+=0x1;_0x32f9eb=new Hangup(_0x310c30,_0x21edb6);hopperUtils[_0x2d7e('0xcb')](_0x32f9eb)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x133')));hopperUtils[_0x2d7e('0xcc')](_0x32f9eb)['catch'](loggerCatch(_0x2d7e('0x134')));}if(_0x310c30&&_0x310c30[_0x2d7e('0x45')]!==_0x2d7e('0xc2')&&isNotNull(this[_0x2d7e('0x1f')][_0x310c30['queue']][_0x2d7e('0x135')])){delete this[_0x2d7e('0x26')][_0x21edb6['uniqueid']];this[_0x2d7e('0xc3')](this[_0x2d7e('0x1f')][_0x310c30[_0x2d7e('0xc0')]]);this[_0x2d7e('0x1f')][_0x310c30[_0x2d7e('0xc0')]]['outboundAnswerCallsDay']+=0x1;this[_0x2d7e('0x1f')][_0x310c30[_0x2d7e('0xc0')]][_0x2d7e('0x12e')]+=0x1;_0x32f9eb=new Hangup(_0x310c30,_0x21edb6);_0x32f9eb[_0x2d7e('0xd5')]=0x10;_0x32f9eb[_0x2d7e('0xd6')]=_0x2d7e('0x136');_0x32f9eb['membername']=_0x2d7e('0x137');hopperUtils[_0x2d7e('0xcb')](_0x32f9eb)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x133')));hopperUtils[_0x2d7e('0xcc')](_0x32f9eb)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x134')));}if(_0x310c30&&_0x310c30[_0x2d7e('0x45')]!=='ivr'&&!isNotNull(this[_0x2d7e('0x1f')][_0x310c30[_0x2d7e('0xc0')]][_0x2d7e('0x135')])){if(_0x21edb6['cause-txt']===_0x2d7e('0x138')){delete this[_0x2d7e('0x26')][_0x21edb6['uniqueid']];this[_0x2d7e('0x1f')][_0x310c30[_0x2d7e('0xc0')]][_0x2d7e('0xc6')]+=0x1;const _0x3a6d40=new AgentComplete(_0x310c30,_0x21edb6);_0x3a6d40[_0x2d7e('0xe5')]=this[_0x2d7e('0x1f')][_0x310c30['queue']]['id'];hopperUtils[_0x2d7e('0xcb')](_0x3a6d40)[_0x2d7e('0xb0')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x3a6d40)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0xcd')));}else{delete this[_0x2d7e('0x26')][_0x21edb6['uniqueid']];this[_0x2d7e('0xc3')](this[_0x2d7e('0x1f')][_0x310c30[_0x2d7e('0xc0')]]);this[_0x2d7e('0x1f')][_0x310c30[_0x2d7e('0xc0')]][_0x2d7e('0x139')]+=0x1;_0x32f9eb=new Hangup(_0x310c30,_0x21edb6);_0x32f9eb[_0x2d7e('0xd5')]=0xc;_0x32f9eb[_0x2d7e('0xd6')]=_0x21edb6[_0x2d7e('0x13a')];_0x32f9eb['membername']=_0x2d7e('0x13b');hopperUtils[_0x2d7e('0xcb')](_0x32f9eb)['catch'](loggerCatch(_0x2d7e('0x133')));hopperUtils['moveContactManagedDialer'](_0x32f9eb)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x134')));}}};Dialer[_0x2d7e('0x1b')]['syncQueueSummary']=function(_0x2fb4d1){var _0x20a570=this;if(!_0x20a570['queuesSummary'][_0x2fb4d1[_0x2d7e('0x4c')]]){_0x20a570[_0x2d7e('0x13c')][_0x2fb4d1[_0x2d7e('0x4c')]]={'running':![]};}else if(_0x20a570[_0x2d7e('0x13c')][_0x2fb4d1[_0x2d7e('0x4c')]][_0x2d7e('0x13d')]===!![]){return;}else if(_0x20a570['queuesSummary'][_0x2fb4d1[_0x2d7e('0x4c')]][_0x2d7e('0x13d')]===![]){_0x20a570[_0x2d7e('0x13c')][_0x2fb4d1[_0x2d7e('0x4c')]]['running']=!![];}var _0x1ab552=_0x20a570[_0x2d7e('0x1f')][_0x2fb4d1['name']];var _0x3a8b94=_0x1ab552[_0x2d7e('0x6e')]!==utils[_0x2d7e('0x6f')][_0x2d7e('0x80')];var _0x3c9b46=utils[_0x2d7e('0x13e')](_0x1ab552);_0x1ab552[_0x2d7e('0x13f')]=utils[_0x2d7e('0x140')](_0x1ab552,_0x20a570['trunks']);Promise['resolve']()[_0x2d7e('0x41')](function(){if(_0x1ab552[_0x2d7e('0x13f')]===utils['CAMPAIGN_STATUS'][_0x2d7e('0x80')]){if(_0x3a8b94){clearPredictiveAttributes(_0x1ab552);_0x2fb4d1['startPredictive']=undefined;_0x2fb4d1[_0x2d7e('0x28')]=undefined;}if(_0x1ab552[_0x2d7e('0x13f')]===utils[_0x2d7e('0x6f')]['INACTIVE']){_0x2fb4d1[_0x2d7e('0x141')]=0x0;_0x2fb4d1[_0x2d7e('0x100')]=0x0;_0x2fb4d1[_0x2d7e('0x142')]=0x0;_0x2fb4d1[_0x2d7e('0x143')]=0x0;_0x2fb4d1[_0x2d7e('0x144')]=0x0;}}else if(_0x1ab552[_0x2d7e('0x13f')]===utils[_0x2d7e('0x6f')][_0x2d7e('0x145')]&&!_0x3c9b46){return _0x20a570['ifTime'](_0x1ab552,!![])[_0x2d7e('0x41')](function(){return _0x20a570[_0x2d7e('0x93')](_0x1ab552,![]);})[_0x2d7e('0x41')](function(){return _0x20a570[_0x2d7e('0x146')](_0x1ab552);})['catch'](function(_0xcb565b){loggerSyncQueueSummary[_0x2d7e('0x47')](_0x2d7e('0x147'),util[_0x2d7e('0x49')](_0xcb565b,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1ab552);});}else{clearPredictiveAttributes(_0x1ab552);}})[_0x2d7e('0x41')](function(){var _0x5ee30c=_0x2fb4d1[_0x2d7e('0x148')](_0x1ab552);if(_0x5ee30c||_0x1ab552[_0x2d7e('0x149')]){_0x1ab552[_0x2d7e('0x149')]=![];_0x2fb4d1[_0x2d7e('0x14a')](_0x1ab552);Object[_0x2d7e('0x14b')](_0x1ab552,_0x2fb4d1);emitOutboundVoiceQueueSummary(_0x2fb4d1);}_0x20a570[_0x2d7e('0x13c')][_0x1ab552['name']][_0x2d7e('0x13d')]=![];})[_0x2d7e('0xb0')](function(_0x11e120){logger[_0x2d7e('0x6b')](_0x2d7e('0x147'),util[_0x2d7e('0x49')](_0x11e120,{'showHidden':![],'depth':null}));_0x20a570[_0x2d7e('0x13c')][_0x1ab552['name']][_0x2d7e('0x13d')]=![];});};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x34')]=_[_0x2d7e('0x14c')](function(){var _0x26781d=_['filter'](this['voiceQueues'],function(_0x399cf9){return _0x399cf9[_0x2d7e('0x14d')];});var _0x175142=_[_0x2d7e('0x14e')](this[_0x2d7e('0x21')],function(_0x4a5e88){return _0x4a5e88['online']&&_0x4a5e88['status']===_0x2d7e('0x14f');});if(_0x26781d[_0x2d7e('0x9c')]>0x0&&_0x175142['length']>0x0){return Promise[_0x2d7e('0xac')]()['then'](cmHopper['handlePreviewRecallNotifications'](_[_0x2d7e('0x150')](_0x26781d,'id'),previewRecallmeReminderInterval,_[_0x2d7e('0x150')](_0x175142,'id')))[_0x2d7e('0x41')](function(_0xc2ce14){for(var _0x3ece3e=0x0;_0x3ece3e<_0xc2ce14[_0x2d7e('0x9c')];_0x3ece3e++){var _0xa22062=_0xc2ce14[_0x3ece3e][_0x2d7e('0x151')][_0x2d7e('0x4c')];if(_0xa22062)io['to'](util[_0x2d7e('0x4a')](_0x2d7e('0x152'),_0xa22062))[_0x2d7e('0x44')](_0x2d7e('0x153'),{'hopper':_0xc2ce14[_0x3ece3e]});}})[_0x2d7e('0xb0')](function(_0x1848da){logger[_0x2d7e('0x6b')](_0x2d7e('0x154'),_0x1848da);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x2d7e('0x3f')]=function(){var _0x1061e3=this;setInterval(function(){_0x1061e3[_0x2d7e('0x155')](_0x1061e3['uniqueId'],_0x2d7e('0x156'));_0x1061e3[_0x2d7e('0x155')](_0x1061e3['actions'],_0x2d7e('0x157'));},0x32c8);};Dialer[_0x2d7e('0x1b')]['clearZombieChannels']=function(_0x4b67ba,_0x4c0d54){var _0x55fcc6=this;for(var _0x30a82b in _0x4b67ba){if(typeof _0x4b67ba[_0x30a82b]!=='undefined'){this[_0x2d7e('0x158')][_0x2d7e('0x159')](function(){if(!_[_0x2d7e('0xfa')](_0x4b67ba[_0x30a82b])){return ami[_0x2d7e('0x9d')]({'action':'status','channel':_0x4b67ba[_0x30a82b][_0x2d7e('0xf6')]})[_0x2d7e('0xb0')](function(_0x30bbc2){if(_0x30bbc2[_0x2d7e('0x6e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4b67ba[_0x30a82b]&&_0x4b67ba[_0x30a82b]['type']!==_0x2d7e('0xc2')){_0x55fcc6[_0x2d7e('0xc3')](_0x55fcc6[_0x2d7e('0x1f')][_0x4b67ba[_0x30a82b][_0x2d7e('0xc0')]]);logger['error'](_0x2d7e('0x15a'),_0x4c0d54,_0x30a82b,_0x4b67ba[_0x30a82b]['queue']);delete _0x4b67ba[_0x30a82b];}if(_0x4b67ba[_0x30a82b]&&_0x4b67ba[_0x30a82b][_0x2d7e('0x45')]===_0x2d7e('0xc2')){_0x55fcc6[_0x2d7e('0xc3')](_0x55fcc6[_0x2d7e('0x20')][_0x4b67ba[_0x30a82b][_0x2d7e('0xc0')]]);logger[_0x2d7e('0x6b')]('[Dialer][checkChannel][ivr]',_0x4c0d54,_0x30a82b,_0x4b67ba[_0x30a82b][_0x2d7e('0xc0')]);delete _0x4b67ba[_0x30a82b];}},0x2328);}});}});}}};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x1794c9){return Promise[_0x2d7e('0xac')]()[_0x2d7e('0x41')](voiceQueueRt['getVoiceQueueRtPauses'](_0x1794c9))[_0x2d7e('0xb0')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0x2d7e('0xc3')]=function(_0x1a7d27){if(!_['isUndefined'](_0x1a7d27)&&_0x1a7d27!==null){if(typeof _0x1a7d27[_0x2d7e('0x15b')]!==_0x2d7e('0xa9')){if(_0x1a7d27[_0x2d7e('0x15b')]>0x0){_0x1a7d27[_0x2d7e('0x15b')]-=0x1;}else{logger[_0x2d7e('0x6b')](_0x2d7e('0x15c'));}}}else{logger[_0x2d7e('0x6b')](_0x2d7e('0x15d'));}};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x15e')]=function(_0x228c7e,_0x3b40bc){var _0x26d7c4=this;return function(_0x4bb4dd){_0x26d7c4[_0x2d7e('0xc3')](_0x3b40bc);logger[_0x2d7e('0x6b')](_0x228c7e,util[_0x2d7e('0x49')](_0x4bb4dd,{'showHidden':![],'depth':null}));};};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x15f')]=function(_0x13bcf9,_0x531bd2,_0x1f5561){var _0x178796={'state':0x19,'statedesc':_0x2d7e('0x160')};this[_0x2d7e('0xc3')](_0x531bd2);this[_0x2d7e('0x119')](_['merge'](_0x178796,_[_0x2d7e('0x7a')](_0x1f5561,[_0x2d7e('0xe3'),_0x2d7e('0xf4'),_0x2d7e('0x161'),_0x2d7e('0xe4'),_0x2d7e('0xe5')])),_0x2d7e('0x162'),'[emptyContact]');logger[_0x2d7e('0x6b')](_0x13bcf9);};Dialer[_0x2d7e('0x1b')]['saveInDb']=function(_0x2b5e87,_0x1d169b,_0x3f90ac){hopperUtils[_0x2d7e('0xcb')](_0x2b5e87)['catch'](loggerCatch(_0x1d169b));hopperUtils[_0x2d7e('0xcc')](_0x2b5e87)[_0x2d7e('0xb0')](loggerCatch(_0x3f90ac));};Dialer[_0x2d7e('0x1b')][_0x2d7e('0xe0')]=function(_0x1af9ff,_0x5f3e08){hopperUtils['createHistory'](_0x1af9ff)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x163')));if(_0x5f3e08==0x0){hopperUtils[_0x2d7e('0xcc')](_0x1af9ff)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x164')));}};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x154')]=function(_0x40fe1e){return Promise[_0x2d7e('0xac')]()[_0x2d7e('0x41')](cmHopper[_0x2d7e('0x165')](_0x40fe1e['id'],previewRecallmeReminderInterval))[_0x2d7e('0x41')](function(_0x21626d){for(var _0xf36c75=0x0;_0xf36c75<_0x21626d[_0x2d7e('0x9c')];_0xf36c75++){var _0x159ede=_0x21626d[_0xf36c75][_0x2d7e('0x151')][_0x2d7e('0x4c')];if(_0x159ede)io['to'](util['format'](_0x2d7e('0x152'),_0x159ede))[_0x2d7e('0x44')](_0x2d7e('0x153'),{'hopper':_0x21626d[_0xf36c75]});}})[_0x2d7e('0xb0')](function(){});};Dialer[_0x2d7e('0x1b')]['launchHandleIvr']=function(_0x473cfb){var _0x4fc67b=this;return function(){_0x4fc67b[_0x2d7e('0x166')](_0x473cfb);};};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x167')]=function(_0xb40f14,_0x22cfb9){var _0x39f564=this;var _0x4448fd=uuid['v4']();this['actions'][_0x4448fd]=new Action(_0xb40f14,_0x22cfb9,_0x4448fd);return new Promise(function(_0x279c3a,_0x29c57d){if(_[_0x2d7e('0x43')](_0xb40f14)&&typeof _0xb40f14!=='object'){return _0x29c57d(msgResponse(_0x2d7e('0x168'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x2d7e('0x43')](_0x22cfb9[_0x2d7e('0x169')])||_0x22cfb9[_0x2d7e('0x169')]===null){return _0x29c57d(msgResponse(_0x2d7e('0x168'),_0x2d7e('0x96'),_0x2d7e('0x16a')));}var _0x4d39c5={'XMD-CALLERID':_0x39f564[_0x2d7e('0x24')][_0x4448fd][_0x2d7e('0x16b')](),'XMD-AGI':_0xb40f14[_0x2d7e('0x135')]?util[_0x2d7e('0x4a')](_0x2d7e('0x16c'),ipAgi,_0xb40f14[_0x2d7e('0x135')]):_0x2d7e('0x16d'),'XMD-AGIAFTER':_0xb40f14['dialQueueProject2']?util['format'](_0x2d7e('0x16c'),ipAgi,_0xb40f14[_0x2d7e('0xc9')]):'NONE','XMD-QUEUE':utils[_0x2d7e('0x16e')](_0xb40f14)?util[_0x2d7e('0x4a')]('\x22%s,%s%s,,,%s\x22',_0xb40f14[_0x2d7e('0x4c')],_0xb40f14[_0x2d7e('0x16f')]||'',_0xb40f14[_0x2d7e('0xca')]?'c':'',_0xb40f14[_0x2d7e('0xd1')]||0x3):_0x2d7e('0x16d'),'XMD-CONTACTID':_0x22cfb9[_0x2d7e('0xe3')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x39f564[_0x2d7e('0x24')][_0x4448fd][_0x2d7e('0x16b')](),'XMD-AMD':_0xb40f14[_0x2d7e('0x12c')]?_0x2d7e('0x145'):'NONE','XMD-DESTINATION':_0x2d7e('0x170')};if(_0xb40f14['dialAMDActive']){_0x4d39c5[_0x2d7e('0x171')]=_0xb40f14[_0x2d7e('0x172')]||0x9c4;_0x4d39c5['XMD-AMDGREETING']=_0xb40f14[_0x2d7e('0x173')]||0x5dc;_0x4d39c5['XMD-AMDAFTERGREETINGSILENCE']=_0xb40f14[_0x2d7e('0x174')]||0x320;_0x4d39c5[_0x2d7e('0x175')]=_0xb40f14[_0x2d7e('0x176')]||0x1388;_0x4d39c5[_0x2d7e('0x177')]=_0xb40f14[_0x2d7e('0x178')]||0x64;_0x4d39c5[_0x2d7e('0x179')]=_0xb40f14['dialAMDBetweenWordsSilence']||0x32;_0x4d39c5[_0x2d7e('0x17a')]=_0xb40f14[_0x2d7e('0x17b')]||0x3;_0x4d39c5['XMD-AMDSILENCETHRESHOLD']=_0xb40f14['dialAMDSilenceThreshold']||0x100;_0x4d39c5[_0x2d7e('0x17c')]=_0xb40f14[_0x2d7e('0x17d')]||0x1388;}if(utils[_0x2d7e('0x16e')](_0xb40f14)){_0x4d39c5[_0x2d7e('0x17e')]=_0x22cfb9[_0x2d7e('0xe4')];}else{_0x4d39c5['XMD-CAMPAIGNID']=_0x22cfb9['CampaignId'];}var _0x53af01=utils['setXMDContactVariables'](_0x22cfb9[_0x2d7e('0x17f')]);Object[_0x2d7e('0x14b')](_0x4d39c5,_0x53af01);var _0x3a85f5=_0x39f564[_0x2d7e('0x8c')](_0xb40f14[_0x2d7e('0x8d')])?utils['getCallerId'](_0xb40f14[_0x2d7e('0x8d')][_0x2d7e('0x180')],_0xb40f14[_0x2d7e('0x181')],_0xb40f14['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x2d7e('0x182')](_0xb40f14[_0x2d7e('0x183')],_0xb40f14[_0x2d7e('0x184')]):_0xb40f14['dialOriginateCallerIdNumber']):utils[_0x2d7e('0x185')](_[_0x2d7e('0xfa')](_0xb40f14[_0x2d7e('0x8e')])?_0xb40f14[_0x2d7e('0x8d')]['callerid']:_0xb40f14[_0x2d7e('0x8e')][_0x2d7e('0x180')],_0xb40f14['dialOriginateCallerIdName'],_0xb40f14[_0x2d7e('0x184')]>0x0?utils[_0x2d7e('0x182')](_0xb40f14['dialOriginateCallerIdNumber'],_0xb40f14[_0x2d7e('0x184')]):_0xb40f14[_0x2d7e('0x183')]);if(_0x3a85f5){_0x4d39c5[_0x2d7e('0x186')]=_0x39f564[_0x2d7e('0x24')][_0x4448fd][_0x2d7e('0x187')]=utils[_0x2d7e('0x188')](_0x3a85f5);_0x4d39c5['XMD-ORIGINATECALLERIDNUM']=_0x22cfb9[_0x2d7e('0x169')];}_0xb40f14[_0x2d7e('0x189')]=_0x4d39c5;return ami['Action']({'actionid':_0x4448fd,'action':_0x2d7e('0x168'),'channel':_0x39f564[_0x2d7e('0x8c')](_0xb40f14[_0x2d7e('0x8d')])?util[_0x2d7e('0x4a')]('SIP/%s/%s%s',_0xb40f14['Trunk'][_0x2d7e('0x4c')],isNotNull(_0xb40f14[_0x2d7e('0x18a')])?_0xb40f14[_0x2d7e('0x18a')]['trim']()||'':'',_0xb40f14[_0x2d7e('0x18b')]>0x0?_0x22cfb9[_0x2d7e('0x169')][_0x2d7e('0x18c')](_0xb40f14['dialCutDigit']):_0x22cfb9[_0x2d7e('0x169')]):util[_0x2d7e('0x4a')](_0x2d7e('0x18d'),_[_0x2d7e('0xfa')](_0xb40f14['TrunkBackup'])?_0xb40f14['Trunk']['name']:_0xb40f14['TrunkBackup']['name'],isNotNull(_0xb40f14[_0x2d7e('0x18a')])?_0xb40f14[_0x2d7e('0x18a')]['trim']()||'':'',_0xb40f14[_0x2d7e('0x18b')]>0x0?_0x22cfb9[_0x2d7e('0x169')]['substring'](_0xb40f14[_0x2d7e('0x18b')]):_0x22cfb9[_0x2d7e('0x169')]),'callerid':_0x3a85f5,'Exten':_0x2d7e('0x170'),'Context':_0x2d7e('0x18e'),'Priority':'1','variable':_0x4d39c5,'timeout':(_0xb40f14[_0x2d7e('0x18f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4448fd})[_0x2d7e('0x41')](function(_0x18cfa3){return _0x279c3a(_0x18cfa3);})['catch'](function(_0x17aed0){_0xb40f14[_0x2d7e('0x190')]+=0x1;var _0x3c230b=new History(_0x39f564[_0x2d7e('0x24')][_0x4448fd]);logger['error'](util[_0x2d7e('0x4a')](_0x2d7e('0x191'),JSON['stringify'](_0x17aed0)));_0x3c230b[_0x2d7e('0xd5')]=0xe;_0x3c230b['statedesc']='OriginateError';_0x3c230b[_0x2d7e('0x76')]=moment()['format'](_0x2d7e('0xc4'));_0x3c230b[_0x2d7e('0xe8')]=_0x3c230b[_0x2d7e('0x76')];hopperUtils['createHistory'](_0x3c230b)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x192')));_0x39f564[_0x2d7e('0xcc')](_0x3c230b)['catch'](loggerCatch(_0x2d7e('0x192')))[_0x2d7e('0x1d')](function(){delete _0x39f564['actions'][_0x4448fd];return _0x29c57d(msgResponse(_0x2d7e('0x168'),_0x2d7e('0x87'),'originate\x20action\x20Error'));});});});};Dialer[_0x2d7e('0x1b')]['checkRetriveMax']=function(_0x583de4,_0x41d83a,_0x42f562){var _0x4b6287=new History(_0x41d83a);if(_0x4b6287[_0x2d7e('0x121')]+_0x4b6287[_0x2d7e('0x12f')]+_0x4b6287[_0x2d7e('0x122')]+_0x4b6287[_0x2d7e('0x123')]+_0x4b6287[_0x2d7e('0xda')]+_0x4b6287[_0x2d7e('0xef')]+_0x4b6287[_0x2d7e('0x11f')]+_0x4b6287[_0x2d7e('0x124')]>=_0x42f562[_0x2d7e('0x130')]-0x1){return!![];}switch(_0x583de4){case 0x3:if(_0x4b6287['countnoanswerretry']>=_0x42f562[_0x2d7e('0x193')]-0x1){return!![];}hopperUtils[_0x2d7e('0xe1')]({'active':![],'countnoanswerretry':_0x4b6287[_0x2d7e('0x122')]+=0x1,'scheduledat':moment()['add'](_0x42f562[_0x2d7e('0x194')],_0x2d7e('0x12a'))[_0x2d7e('0x4a')](_0x2d7e('0xc4')),'ContactId':_0x4b6287['ContactId'],'ListId':_0x4b6287['ListId'],'VoiceQueueId':_0x4b6287[_0x2d7e('0xe4')]||undefined,'CampaignId':_0x4b6287['CampaignId']||undefined})[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x195')));break;case 0x5:if(_0x4b6287[_0x2d7e('0x121')]>=_0x42f562[_0x2d7e('0x196')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x4b6287[_0x2d7e('0x121')]+=0x1,'scheduledat':moment()[_0x2d7e('0xe2')](_0x42f562[_0x2d7e('0x197')],_0x2d7e('0x12a'))['format'](_0x2d7e('0xc4')),'ContactId':_0x4b6287[_0x2d7e('0xe3')],'ListId':_0x4b6287[_0x2d7e('0xf4')],'VoiceQueueId':_0x4b6287[_0x2d7e('0xe4')]||undefined,'CampaignId':_0x4b6287[_0x2d7e('0xe5')]||undefined})[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x198')));break;case 0x8:if(_0x4b6287[_0x2d7e('0x12f')]>=_0x42f562[_0x2d7e('0x199')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x4b6287[_0x2d7e('0x12f')]+=0x1,'scheduledat':moment()[_0x2d7e('0xe2')](_0x42f562[_0x2d7e('0x19a')],'minutes')[_0x2d7e('0x4a')](_0x2d7e('0xc4')),'ContactId':_0x4b6287[_0x2d7e('0xe3')],'ListId':_0x4b6287[_0x2d7e('0xf4')],'VoiceQueueId':_0x4b6287[_0x2d7e('0xe4')]||undefined,'CampaignId':_0x4b6287[_0x2d7e('0xe5')]||undefined})[_0x2d7e('0xb0')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x4b6287[_0x2d7e('0x123')]>=_0x42f562['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x2d7e('0xe1')]({'active':![],'countnosuchnumberretry':_0x4b6287[_0x2d7e('0x123')]+=0x1,'scheduledat':moment()[_0x2d7e('0xe2')](_0x42f562[_0x2d7e('0x19b')],'minutes')[_0x2d7e('0x4a')](_0x2d7e('0xc4')),'ContactId':_0x4b6287[_0x2d7e('0xe3')],'ListId':_0x4b6287['ListId'],'VoiceQueueId':_0x4b6287[_0x2d7e('0xe4')]||undefined,'CampaignId':_0x4b6287[_0x2d7e('0xe5')]||undefined})['catch'](loggerCatch(_0x2d7e('0x19c')));}break;case 0xa:if(_0x4b6287[_0x2d7e('0xda')]>=_0x42f562['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x2d7e('0xe1')]({'active':![],'countdropretry':_0x4b6287['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x42f562['dialDropRetryFrequency'],_0x2d7e('0x12a'))[_0x2d7e('0x4a')](_0x2d7e('0xc4')),'ContactId':_0x4b6287[_0x2d7e('0xe3')],'ListId':_0x4b6287[_0x2d7e('0xf4')],'VoiceQueueId':_0x4b6287[_0x2d7e('0xe4')]||undefined,'CampaignId':_0x4b6287[_0x2d7e('0xe5')]||undefined})['catch'](loggerCatch(_0x2d7e('0xe6')));break;case 0xb:if(_0x4b6287['countabandonedretry']>=_0x42f562[_0x2d7e('0xf3')]-0x1){return!![];}hopperUtils[_0x2d7e('0xe1')]({'active':![],'countabandonedretry':_0x4b6287[_0x2d7e('0xef')]+=0x1,'scheduledat':moment()['add'](_0x42f562['dialAbandonedRetryFrequency'],'minutes')[_0x2d7e('0x4a')](_0x2d7e('0xc4')),'ContactId':_0x4b6287[_0x2d7e('0xe3')],'ListId':_0x4b6287[_0x2d7e('0xf4')],'VoiceQueueId':_0x4b6287[_0x2d7e('0xe4')]||undefined,'CampaignId':_0x4b6287['CampaignId']||undefined})['catch'](loggerCatch(_0x2d7e('0x19d')));break;case 0x13:if(_0x4b6287[_0x2d7e('0x11f')]>=_0x42f562[_0x2d7e('0x126')]-0x1){return!![];}hopperUtils[_0x2d7e('0xe1')]({'active':![],'countmachineretry':_0x4b6287[_0x2d7e('0x11f')]+=0x1,'scheduledat':moment()['add'](_0x42f562[_0x2d7e('0x129')],_0x2d7e('0x12a'))[_0x2d7e('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b6287[_0x2d7e('0xe3')],'ListId':_0x4b6287[_0x2d7e('0xf4')],'VoiceQueueId':_0x4b6287['VoiceQueueId']||undefined,'CampaignId':_0x4b6287[_0x2d7e('0xe5')]||undefined})[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x12b')));break;case 0x14:if(_0x4b6287[_0x2d7e('0x124')]>=_0x42f562[_0x2d7e('0x19e')]-0x1){return!![];}hopperUtils[_0x2d7e('0xe1')]({'active':![],'countagentrejectretry':_0x4b6287[_0x2d7e('0x124')]+=0x1,'scheduledat':moment()[_0x2d7e('0xe2')](_0x42f562[_0x2d7e('0x19f')],_0x2d7e('0x12a'))[_0x2d7e('0x4a')](_0x2d7e('0xc4')),'ContactId':_0x4b6287['ContactId'],'ListId':_0x4b6287['ListId'],'VoiceQueueId':_0x4b6287[_0x2d7e('0xe4')]||undefined,'CampaignId':_0x4b6287[_0x2d7e('0xe5')]||undefined})['catch'](loggerCatch(_0x2d7e('0x1a0')));break;default:return!![];}};Dialer['prototype'][_0x2d7e('0x10f')]=function(_0x54a637,_0x5cd2fd,_0x42b833){var _0x1b29c7=this;var _0x416084=new History(_0x54a637);var _0xb69a3c=![];var _0x4fe584;var _0xf6e1ec;return new Promise(function(_0x4a563c,_0x5007af){if(_[_0x2d7e('0x43')](_0x5cd2fd)&&typeof _0x5cd2fd!==_0x2d7e('0x1a1')){return _0x5007af(msgResponse('[callProgressDetecting]',_0x2d7e('0x96'),_0x2d7e('0x1a2')));}if(_['isUndefined'](_0x42b833)&&typeof _0x42b833!==_0x2d7e('0x1a1')){return _0x5007af(msgResponse(_0x2d7e('0x1a3'),'Failure','evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x416084,_0x42b833['reason'],_0x5cd2fd)[_0x2d7e('0x41')](function(_0x5d16ac){if(_0x5d16ac[_0x2d7e('0xde')]==0x1)_0xb69a3c=!![];switch(_0x42b833[_0x2d7e('0xc7')]){case'0':_0x5cd2fd[_0x2d7e('0x1a4')]+=0x1;_0x416084[_0x2d7e('0xd5')]=0x0;_0x416084[_0x2d7e('0xd6')]='NoSuchNumber';_0x416084['countnosuchnumberretry']+=0x1;_0x416084[_0x2d7e('0xdb')]+=0x1;ami[_0x2d7e('0x44')](_0x2d7e('0x1a5'),ut[_0x2d7e('0x117')](_0x54a637,'nosuchnumber'));_0x4fe584=_0x5cd2fd[_0x2d7e('0x19b')];_0xf6e1ec=_0x5cd2fd[_0x2d7e('0xf1')];hopperUtils['createHistory'](_0x416084)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x120')));if(_0x1b29c7[_0x2d7e('0x1a6')](0x0,_0x54a637,_0x5cd2fd)&&!_0xb69a3c){if(_0x416084[_0x2d7e('0x123')]>=_0x5cd2fd[_0x2d7e('0x1a7')]){_0x1b29c7[_0x2d7e('0x127')](_0x416084,_0x4a563c,_0x5007af,_0x2d7e('0x1a8'));}else{_0x1b29c7[_0x2d7e('0x131')](_0x416084,_0x4a563c,_0x5007af,_0x2d7e('0x1a8'));}}break;case'3':_0x5cd2fd['outboundNoAnswerCallsDay']+=0x1;_0x416084[_0x2d7e('0xd5')]=0x3;_0x416084[_0x2d7e('0xd6')]='NoAnswer';_0x416084[_0x2d7e('0x122')]+=0x1;_0x416084[_0x2d7e('0xdb')]+=0x1;var _0x35c507=ut[_0x2d7e('0x1a9')](_0x54a637,_0x5cd2fd);ami[_0x2d7e('0x44')]('custom:agentnoanswer',_0x35c507);_0x4fe584=_0x5cd2fd['dialNoAnswerRetryFrequency'];_0xf6e1ec=_0x5cd2fd[_0x2d7e('0xf1')];hopperUtils[_0x2d7e('0xcb')](_0x416084)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x1aa')));if(_0x1b29c7[_0x2d7e('0x1a6')](0x3,_0x54a637,_0x5cd2fd)&&!_0xb69a3c){if(_0x416084['countnoanswerretry']>=_0x5cd2fd[_0x2d7e('0x193')]){_0x1b29c7[_0x2d7e('0x127')](_0x416084,_0x4a563c,_0x5007af,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1b29c7[_0x2d7e('0x131')](_0x416084,_0x4a563c,_0x5007af,_0x2d7e('0x1ab'));}}break;case'5':_0x5cd2fd[_0x2d7e('0x1ac')]+=0x1;_0x416084['state']=0x5;_0x416084[_0x2d7e('0xd6')]=_0x2d7e('0x1ad');_0x416084[_0x2d7e('0x121')]+=0x1;_0x416084[_0x2d7e('0xdb')]+=0x1;ami[_0x2d7e('0x44')](_0x2d7e('0x1ae'),ut[_0x2d7e('0x117')](_0x54a637,'busy'));_0x4fe584=_0x5cd2fd[_0x2d7e('0x197')];_0xf6e1ec=_0x5cd2fd['callAdditionalPhoneAfterMin'];hopperUtils[_0x2d7e('0xcb')](_0x416084)['catch'](loggerCatch(_0x2d7e('0x1af')));if(_0x1b29c7[_0x2d7e('0x1a6')](0x5,_0x54a637,_0x5cd2fd)&&!_0xb69a3c){if(_0x416084['countbusyretry']>=_0x5cd2fd['dialBusyMaxRetry']){_0x1b29c7['createStateFinal'](_0x416084,_0x4a563c,_0x5007af,_0x2d7e('0x1b0'));}else{_0x1b29c7[_0x2d7e('0x131')](_0x416084,_0x4a563c,_0x5007af,_0x2d7e('0x1b0'));}}break;case'8':_0x5cd2fd[_0x2d7e('0x1b1')]+=0x1;_0x416084[_0x2d7e('0xd5')]=0x8;_0x416084[_0x2d7e('0xd6')]=_0x2d7e('0x1b2');_0x416084[_0x2d7e('0x12f')]+=0x1;_0x416084['countglobal']+=0x1;_0x4fe584=_0x5cd2fd['dialCongestionRetryFrequency'];_0xf6e1ec=_0x5cd2fd['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut[_0x2d7e('0x117')](_0x54a637,'congestion'));hopperUtils['createHistory'](_0x416084)['catch'](loggerCatch(_0x2d7e('0x1b3')));if(_0x1b29c7['checkRetriveMax'](0x8,_0x54a637,_0x5cd2fd)&&!_0xb69a3c){if(_0x416084['countcongestionretry']>=_0x5cd2fd[_0x2d7e('0x199')]){_0x1b29c7[_0x2d7e('0x127')](_0x416084,_0x4a563c,_0x5007af,'reason\x208\x20congestion');}else{_0x1b29c7[_0x2d7e('0x131')](_0x416084,_0x4a563c,_0x5007af,_0x2d7e('0x1b4'));}}break;case'11':_0x5cd2fd[_0x2d7e('0x1b5')]+=0x1;_0x416084[_0x2d7e('0xd5')]=0xb;_0x416084['statedesc']='Abandoned';_0x416084[_0x2d7e('0xef')]+=0x1;_0x416084[_0x2d7e('0xdb')]+=0x1;_0x4fe584=_0x5cd2fd[_0x2d7e('0xf0')];_0xf6e1ec=_0x5cd2fd[_0x2d7e('0xf1')];hopperUtils['createHistory'](_0x416084)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0xf5')));if(_0x1b29c7['checkRetriveMax'](0xb,_0x54a637,_0x5cd2fd)&&!_0xb69a3c){if(_0x416084[_0x2d7e('0xef')]>=_0x5cd2fd['dialAbandonedMaxRetry']){_0x1b29c7[_0x2d7e('0x127')](_0x416084,_0x4a563c,_0x5007af,_0x2d7e('0x1b6'));}else{_0x1b29c7['stateGlobal'](_0x416084,_0x4a563c,_0x5007af,_0x2d7e('0x1b6'));}}break;case'20':_0x5cd2fd[_0x2d7e('0x1b7')]+=0x1;_0x416084['state']=0x14;_0x416084[_0x2d7e('0xd6')]='AgentReject';_0x416084[_0x2d7e('0x124')]+=0x1;_0x416084[_0x2d7e('0xdb')]+=0x1;_0x4fe584=_0x5cd2fd['dialAgentRejectRetryFrequency'];_0xf6e1ec=_0x5cd2fd[_0x2d7e('0xf1')];ami['emit']('custom:agentreject',ut['buildObj'](_0x54a637,_0x2d7e('0x1b8')));hopperUtils[_0x2d7e('0xcb')](_0x416084)[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x1b9')));if(_0x1b29c7[_0x2d7e('0x1a6')](0x14,_0x54a637,_0x5cd2fd)&&!_0xb69a3c){if(_0x416084[_0x2d7e('0x124')]>=_0x5cd2fd['dialAgentRejectMaxRetry']){_0x1b29c7['createStateFinal'](_0x416084,_0x4a563c,_0x5007af,_0x2d7e('0x1ba'));}else{_0x1b29c7['stateGlobal'](_0x416084,_0x4a563c,_0x5007af,_0x2d7e('0x1ba'));}}break;default:_0x5cd2fd[_0x2d7e('0x139')]+=0x1;_0x416084[_0x2d7e('0xd5')]=0xc;_0x416084['statedesc']=_0x42b833[_0x2d7e('0xc7')];_0x4fe584=_0x5cd2fd[_0x2d7e('0x19f')];_0xf6e1ec=_0x5cd2fd['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x416084)[_0x2d7e('0xb0')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x1b29c7[_0x2d7e('0x1a6')](_0x42b833[_0x2d7e('0xc7')],_0x54a637,_0x5cd2fd)&&!_0xb69a3c){if(_0x416084[_0x2d7e('0x121')]+_0x416084[_0x2d7e('0x12f')]+_0x416084['countnoanswerretry']+_0x416084[_0x2d7e('0x123')]+_0x416084['countdropretry']+_0x416084[_0x2d7e('0xef')]+_0x416084['countmachineretry']+_0x416084[_0x2d7e('0x124')]>=_0x5cd2fd[_0x2d7e('0x130')]){_0x1b29c7[_0x2d7e('0x131')](_0x416084,_0x4a563c,_0x5007af,_0x42b833[_0x2d7e('0xc7')]);}else{_0x1b29c7[_0x2d7e('0x127')](_0x416084,_0x4a563c,_0x5007af,_0x42b833[_0x2d7e('0xc7')]);}}}})[_0x2d7e('0x41')](function(){if(_0xb69a3c){hopperUtils[_0x2d7e('0xec')](_0x416084,_0x4fe584,_0xf6e1ec)[_0x2d7e('0x41')](function(){return _0x4a563c(0x1);});}});});};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x131')]=function(_0x4d35bb,_0x8b553d,_0x544018,_0x3aea1f){var _0x3df123=new Final(_0x4d35bb);_0x3df123[_0x2d7e('0xd5')]=0xf;_0x3df123['statedesc']=_0x2d7e('0x1bb');this[_0x2d7e('0x127')](_0x3df123,_0x8b553d,_0x544018,_0x3aea1f);};Dialer['prototype'][_0x2d7e('0x127')]=function(_0x1f2740,_0x37c3fd,_0x3bdd9c,_0x11bc0b){hopperUtils['moveContactManagedDialer'](_0x1f2740)[_0x2d7e('0x41')](function(){return _0x37c3fd(msgResponse(_0x2d7e('0x1a3'),_0x2d7e('0x10e'),_0x11bc0b));})[_0x2d7e('0xb0')](function(){return _0x3bdd9c(msgResponse('[moveContactManagedDialer][0]','Failure',_0x2d7e('0x1bc')));});};Dialer[_0x2d7e('0x1b')]['predictive']=function(_0x31a31c){var _0x54d089=_0x31a31c['dialPredictiveOptimizationPercentage']/0x64;var _0x142e61=_0x31a31c[_0x2d7e('0xd3')]/(_0x31a31c[_0x2d7e('0xd3')]+_0x31a31c['outboundAnswerCallsDay']);var _0x5a31f9=Math[_0x2d7e('0x1bd')](_0x31a31c[_0x2d7e('0x1be')]*(_0x31a31c[_0x2d7e('0x1bf')]/0x64));var _0x3dae11=Math['round'](_0x31a31c['predictiveIntervalAvailable']*(_0x31a31c[_0x2d7e('0x1c0')]/0x64));var _0x249677=_0x31a31c['available']+_0x31a31c[_0x2d7e('0x143')];var _0x4bc92e=Math['floor'](_0x31a31c[_0x2d7e('0x5f')]*_0x31a31c[_0x2d7e('0x63')]*_0x31a31c['predictiveIntervalHitRate']*_0x31a31c[_0x2d7e('0x1c1')]);if(_[_0x2d7e('0x43')](_0x31a31c[_0x2d7e('0x28')])){if(!_['isUndefined'](_0x31a31c[_0x2d7e('0x27')])){_0x31a31c[_0x2d7e('0x27')]=undefined;loggerPredictive[_0x2d7e('0x6b')](_0x2d7e('0x1c2'),_0x2d7e('0x1c3'));}if(!_['isUndefined'](_0x31a31c[_0x2d7e('0x68')])){loggerPredictive['error'](_0x2d7e('0x1c2'),_0x2d7e('0x1c4'));clearInterval(_0x31a31c[_0x2d7e('0x68')]);_0x31a31c[_0x2d7e('0x68')]=undefined;}_0x31a31c[_0x2d7e('0x28')]=moment()['format'](_0x2d7e('0xc4'));loggerPredictive['info'](_0x31a31c['name'],'collection\x20data\x20in\x20progressive\x20at',_0x31a31c[_0x2d7e('0x28')]);this[_0x2d7e('0xb4')](_0x31a31c,0x1);}else if(ifInterval(_0x31a31c['dialPredictiveInterval'],_0x31a31c[_0x2d7e('0x28')])){this[_0x2d7e('0xb4')](_0x31a31c,0x1);loggerPredictiveCalls['info'](_0x2d7e('0x1c5'),_0x31a31c['startProgressive'],_0x31a31c['name']);_0x31a31c[_0x2d7e('0x5f')]=0x0;_0x31a31c[_0x2d7e('0xd4')]=0x0;}else if(_0x54d089<_0x142e61&&_0x31a31c[_0x2d7e('0x1c6')]===_0x2d7e('0x1c7')){clearPredictiveAttributes(_0x31a31c);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x1c8'),_0x2d7e('0x1c9'),_0x142e61,_0x2d7e('0x28'),_0x31a31c['name']);}else if(_0x4bc92e<_0x31a31c[_0x2d7e('0xd4')]&&_0x31a31c[_0x2d7e('0x1c6')]===_0x2d7e('0x1c7')){clearPredictiveAttributes(_0x31a31c);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x1ca'),'Max\x20Drop\x20',_0x4bc92e,_0x2d7e('0x1cb'),_0x31a31c['predictiveIntervalErlangCallsDroppedCalls'],_0x2d7e('0x28'),_0x31a31c[_0x2d7e('0x4c')]);}else if(!ifInterval(_0x31a31c[_0x2d7e('0x1cc')],_0x31a31c['startProgressive'])&&_[_0x2d7e('0x43')](_0x31a31c[_0x2d7e('0x27')])&&!_['isUndefined'](_0x31a31c[_0x2d7e('0x28')])){_0x31a31c[_0x2d7e('0x27')]=moment()[_0x2d7e('0x4a')](_0x2d7e('0xc4'));loggerPredictive[_0x2d7e('0x4e')](_0x31a31c[_0x2d7e('0x4c')],_0x2d7e('0x1cd'),_0x31a31c[_0x2d7e('0x27')]);hopperUtils['avgHandleTime'](_0x31a31c[_0x2d7e('0x1cc')])['then'](this[_0x2d7e('0x1ce')](_0x31a31c))[_0x2d7e('0x41')](mergeDataErlangB(_0x31a31c))[_0x2d7e('0x41')](this[_0x2d7e('0x1cf')](_0x31a31c))[_0x2d7e('0xb0')](loggerCatchPredictive(_0x2d7e('0x1d0'),_0x31a31c));}else if(!ifInterval(_0x31a31c[_0x2d7e('0x1cc')],_0x31a31c[_0x2d7e('0x27')])){_0x31a31c[_0x2d7e('0xd4')]=0x0;_0x31a31c['startPredictive']=moment()[_0x2d7e('0x4a')](_0x2d7e('0xc4'));loggerPredictive[_0x2d7e('0x4e')](_0x31a31c[_0x2d7e('0x4c')],'recalculate\x20predictive\x20at',_0x31a31c['startPredictive']);clearInterval(_0x31a31c[_0x2d7e('0x68')]);_0x31a31c[_0x2d7e('0x68')]=undefined;hopperUtils[_0x2d7e('0x1d1')](_0x31a31c[_0x2d7e('0x1cc')])[_0x2d7e('0x41')](this[_0x2d7e('0x1ce')](_0x31a31c))['then'](mergeDataErlangB(_0x31a31c))[_0x2d7e('0x41')](this[_0x2d7e('0x1cf')](_0x31a31c))[_0x2d7e('0xb0')](loggerCatchPredictive(_0x2d7e('0x1d2'),_0x31a31c));}else if(_0x31a31c[_0x2d7e('0x1be')]&&_0x249677<_0x31a31c['predictiveIntervalAvailable']-_0x3dae11){clearPredictiveAttributes(_0x31a31c);loggerPredictive[_0x2d7e('0x4e')](_0x31a31c['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x249677,')\x20are\x20less\x20than\x20threshold\x20(',_0x31a31c[_0x2d7e('0x1be')],'-',_0x3dae11,'=',_0x31a31c[_0x2d7e('0x1be')]-_0x3dae11,')');}else if(_0x31a31c[_0x2d7e('0x1be')]&&_0x249677>_0x31a31c['predictiveIntervalAvailable']+_0x5a31f9){clearPredictiveAttributes(_0x31a31c);loggerPredictive[_0x2d7e('0x4e')](_0x31a31c[_0x2d7e('0x4c')],_0x2d7e('0x1d3'),_0x249677,_0x2d7e('0x1d4'),_0x31a31c[_0x2d7e('0x1be')],'+',_0x5a31f9,'=',_0x31a31c[_0x2d7e('0x1be')]+_0x5a31f9,')');}};Dialer['prototype'][_0x2d7e('0x1ce')]=function(_0x4319e3){var _0x5742b4=this;return function(_0x3c85e2){return new Promise(function(_0x3b8778,_0x4733ab){_['merge'](_0x4319e3,_0x3c85e2[0x0]);if(checkGetDataPredictive(_0x3c85e2[0x0])){var _0x50b671=_0x4319e3[_0x2d7e('0x1be')]=_0x4319e3[_0x2d7e('0x143')]+_0x4319e3[_0x2d7e('0x141')];var _0x198bb2=_0x4319e3[_0x2d7e('0x1cc')]*0x3c;var _0x298b8a=_0x3c85e2[0x0][_0x2d7e('0x56')]+_0x3c85e2[0x0][_0x2d7e('0x54')];var _0x53d924=(_0x3c85e2[0x0][_0x2d7e('0x1d5')]+_0x3c85e2[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3c85e2[0x0][_0x2d7e('0x53')])/_0x3c85e2[0x0][_0x2d7e('0x58')];_0x4319e3[_0x2d7e('0x1d6')]=_0x53d924>0x0?_0x53d924:0x1;switch(_0x4319e3[_0x2d7e('0x1c6')]){case _0x2d7e('0x1c7'):var _0xe8be1f=_0x4319e3[_0x2d7e('0x1d7')]/0x64;return _0x5742b4[_0x2d7e('0x1d8')](_0x50b671,_0x198bb2,_0x298b8a,_0x53d924,_0xe8be1f)[_0x2d7e('0x41')](function(_0x55adbf){return _0x3b8778(_0x55adbf);});case _0x2d7e('0x1d9'):var _0x14a64f=_0x4319e3[_0x2d7e('0x1d7')]/0x64;return _0x5742b4['busyFactor'](_0x50b671,_0x198bb2,_0x298b8a,_0x53d924,_0x14a64f)[_0x2d7e('0x41')](function(_0x489a5b){return _0x3b8778(_0x489a5b);});default:return _0x4733ab(msgResponse(_0x2d7e('0x1da'),_0x2d7e('0x96'),_0x2d7e('0x1db')));}}else{return _0x4733ab(msgResponse(_0x2d7e('0x1da'),_0x2d7e('0x96'),_0x2d7e('0x1dc')));}});};};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x1dd')]=function(_0x304d75){var _0x1a7ea0=this;return function(_0x5cd5df){return new Promise(function(_0x174321,_0x1450ff){_[_0x2d7e('0x66')](_0x304d75,_0x5cd5df[0x0]);if(checkGetDataPredictive(_0x5cd5df[0x0])){loggerPredictive['info'](JSON[_0x2d7e('0x79')](_0x5cd5df[0x0]));if(_0x304d75['dialPredictiveOptimization']==='dropRate'){return _0x1a7ea0[_0x2d7e('0x1de')](_0x304d75['id'])[_0x2d7e('0x41')](function(_0x420e9e){var _0x22298a=_0x304d75[_0x2d7e('0x1df')]-_0x420e9e[0x0][_0x2d7e('0x1e0')];var _0x5a3ac8=_0x304d75[_0x2d7e('0x1cc')]*0x3c;var _0x50f149=_0x5cd5df[0x0][_0x2d7e('0x56')]+_0x5cd5df[0x0][_0x2d7e('0x54')];var _0x18d4ad=(_0x5cd5df[0x0][_0x2d7e('0x1d5')]+_0x5cd5df[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5cd5df[0x0][_0x2d7e('0x53')])/_0x5cd5df[0x0][_0x2d7e('0x58')];var _0x4beb38=_0x304d75[_0x2d7e('0x1d7')]/0x64;_0x304d75[_0x2d7e('0x1e1')]=_0x420e9e[0x0][_0x2d7e('0x1e0')]||0x0;_0x304d75[_0x2d7e('0x1d6')]=_0x18d4ad>0x0?_0x18d4ad:0x1;return _0x1a7ea0[_0x2d7e('0x1d8')](_0x22298a,_0x5a3ac8,_0x50f149,_0x18d4ad,_0x4beb38);})['then'](function(_0x3abd6a){return _0x174321(_0x3abd6a);})['catch'](function(_0x2f32d3){return _0x1450ff(msgResponse(_0x2d7e('0x1e2'),'Failure',JSON['stringify'](_0x2f32d3)));});}if(_0x304d75[_0x2d7e('0x1c6')]===_0x2d7e('0x1d9')){return _0x1a7ea0['getVoiceQueueRtPauses'](_0x304d75['id'])[_0x2d7e('0x41')](function(_0x109df9){var _0x5c783a=_0x304d75[_0x2d7e('0x1df')]-_0x109df9[0x0][_0x2d7e('0x1e0')];var _0x36ea9f=_0x304d75[_0x2d7e('0x1cc')]*0x3c;var _0x3cb54e=_0x5cd5df[0x0]['predictiveIntervalAvgTalktime']+_0x5cd5df[0x0]['predictiveIntervalAvgHoldtime'];var _0x20e0a7=(_0x5cd5df[0x0][_0x2d7e('0x1d5')]+_0x5cd5df[0x0][_0x2d7e('0xd2')]+_0x5cd5df[0x0][_0x2d7e('0x53')])/_0x5cd5df[0x0]['predictiveIntervalTotalCalls'];var _0x30a7b0=_0x304d75[_0x2d7e('0x1d7')]/0x64;_0x304d75[_0x2d7e('0x1e1')]=_0x109df9[0x0]['outboundQueuePauses']||0x0;_0x304d75[_0x2d7e('0x1d6')]=_0x20e0a7>0x0?_0x20e0a7:0x1;return _0x1a7ea0['busyFactor'](_0x5c783a,_0x36ea9f,_0x3cb54e,_0x20e0a7,_0x30a7b0);})['then'](function(_0x4e244a){return _0x174321(_0x4e244a);})[_0x2d7e('0xb0')](function(_0x13c87a){return _0x1450ff(msgResponse(_0x2d7e('0x1e2'),_0x2d7e('0x96'),JSON[_0x2d7e('0x79')](_0x13c87a)));});}}else{return _0x1450ff(msgResponse(_0x2d7e('0x1da'),_0x2d7e('0x96'),_0x2d7e('0x1dc')));}});};};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x1cf')]=function(_0x3627be){var _0xa1c28a=this;return function(){var _0x56e862=0x0;var _0x36b670=Math[_0x2d7e('0x1e3')](_0x3627be['erlangCallToSecond']*0x3e8);if(_0x36b670>0x0){_0x36b670=_0x36b670<0x64?0x64:_0x36b670;loggerPredictive[_0x2d7e('0x4e')](_0x3627be[_0x2d7e('0x4c')],'one\x20call\x20every:',_0x36b670,_0x2d7e('0x1e4'));_0x3627be[_0x2d7e('0x68')]=setInterval(function(){_0xa1c28a['handlePredictive'](_0x3627be);loggerPredictiveCalls[_0x2d7e('0x4e')](_0x2d7e('0x1e5'),_0x56e862+=0x1);},_0x36b670);}else{loggerPredictive[_0x2d7e('0x4e')](_0x3627be['name'],_0x2d7e('0x1e6'));}};};Dialer[_0x2d7e('0x1b')]['checkContactBlack']=function(_0x230d25,_0x489363){var _0x4e1b96=this;return function(_0x1f93cf){if(_[_0x2d7e('0x7f')](_0x1f93cf)){if(_[_0x2d7e('0xfa')](_0x489363[_0x2d7e('0x161')])||!_0x489363['recallme']){if(_0x230d25[_0x2d7e('0xb2')]==='booked'){_0x230d25[_0x2d7e('0x77')]=_[_0x2d7e('0x43')](_0x230d25[_0x2d7e('0x77')])?!![]:_0x230d25['queueStatusComplete'];var _0x100754=uuid['v4']();_0x4e1b96[_0x2d7e('0x24')][_0x100754]=new Action(_0x230d25,_0x489363,_0x100754);loggerBooked[_0x2d7e('0x4e')](_0x2d7e('0x1e7'),_0x100754,_0x2d7e('0x1e8'),JSON[_0x2d7e('0x79')](_0x230d25[_0x2d7e('0x77')]),_0x2d7e('0x1e9'),_0x230d25[_0x2d7e('0x4c')]);if(_0x230d25[_0x2d7e('0x77')]){_0x230d25[_0x2d7e('0x77')]=![];_0x4e1b96[_0x2d7e('0x2a')][_0x4e1b96[_0x2d7e('0x24')][_0x100754]['queue']]=[];ami[_0x2d7e('0x9d')]({'actionid':_0x100754,'action':_0x2d7e('0x1ea'),'queue':_0x230d25[_0x2d7e('0x4c')]})['catch'](function(){_0x4e1b96['updateOriginated'](_0x230d25);hopperUtils[_0x2d7e('0xe1')]({'active':![],'ContactId':_0x4e1b96[_0x2d7e('0x24')][_0x100754][_0x2d7e('0xe3')],'ListId':_0x4e1b96[_0x2d7e('0x24')][_0x100754][_0x2d7e('0xf4')],'VoiceQueueId':_0x4e1b96['actions'][_0x100754][_0x2d7e('0xe4')]||undefined,'CampaignId':_0x4e1b96[_0x2d7e('0x24')][_0x100754][_0x2d7e('0xe5')]||undefined})[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x1eb')));delete _0x4e1b96['actions'][_0x100754];});}else{loggerBooked[_0x2d7e('0x4e')](_0x2d7e('0x1ec'),JSON['stringify'](_0x230d25[_0x2d7e('0x77')]),_0x2d7e('0x1e9'),_0x230d25[_0x2d7e('0x4c')]);_0x4e1b96['updateOriginated'](_0x230d25);hopperUtils[_0x2d7e('0xe1')]({'active':![],'ContactId':_0x4e1b96[_0x2d7e('0x24')][_0x100754]['ContactId'],'ListId':_0x4e1b96['actions'][_0x100754][_0x2d7e('0xf4')],'VoiceQueueId':_0x4e1b96[_0x2d7e('0x24')][_0x100754][_0x2d7e('0xe4')]||undefined,'CampaignId':_0x4e1b96[_0x2d7e('0x24')][_0x100754][_0x2d7e('0xe5')]||undefined})[_0x2d7e('0xb0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4e1b96[_0x2d7e('0x24')][_0x100754];}}else{return _0x4e1b96[_0x2d7e('0x167')](_0x230d25,_0x489363);}}else{if(utils['getSeconds'](undefined,_0x489363['scheduledat'])<_0x230d25[_0x2d7e('0x1ed')]*0x3c){if(_0x489363[_0x2d7e('0x151')]&&!_0x489363[_0x2d7e('0x151')][_0x2d7e('0x1ee')]){_0x4e1b96[_0x2d7e('0x1e')][_0x2d7e('0x102')](_0x489363['id'])[_0x2d7e('0x1d')](function(){_0x4e1b96[_0x2d7e('0xc3')](_0x230d25);});}else{hopperUtils[_0x2d7e('0x1ef')]({'active':![]},_0x489363['id'],0x1)[_0x2d7e('0x1d')](function(){_0x4e1b96[_0x2d7e('0xc3')](_0x230d25);});}}else{_0x230d25[_0x2d7e('0x1f0')]+=0x1;_0x4e1b96[_0x2d7e('0xc3')](_0x230d25);if(_0x230d25[_0x2d7e('0x1f1')]){hopperUtils[_0x2d7e('0xe1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x489363[_0x2d7e('0xe3')],'ListId':_0x489363['ListId'],'VoiceQueueId':_0x489363['VoiceQueueId']||undefined,'CampaignId':_0x489363[_0x2d7e('0xe5')]||undefined})[_0x2d7e('0xb0')](loggerCatch(_0x2d7e('0x1f2')));hopperUtils['createHistory'](createObjHistory(_0x230d25,_0x489363,utils['CAMPAIGN_STATUS']['QUEUE_RECALL'],0x17,_0x2d7e('0x1f3')))[_0x2d7e('0xb0')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x4e1b96[_0x2d7e('0x119')](createObjHistory(_0x230d25,_0x489363,utils[_0x2d7e('0x6f')]['RECALL_TIMEOUT'],0x16,'RecallFailedTimeout'),_0x2d7e('0x1f4'),_0x2d7e('0x1f5'));}}}}else{_0x230d25[_0x2d7e('0x1f6')]+=0x1;_0x4e1b96[_0x2d7e('0x119')](createObjHistory(_0x230d25,_0x489363,utils[_0x2d7e('0x6f')]['BLACKLIST'],0xd,_0x2d7e('0x1f7')),'[Originate][historyBlacklist]',_0x2d7e('0x1f8'));throw _0x2d7e('0x1f9');}};};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x166')]=function(_0xb5c41d){var _0x3e1abc=this;var _0x357f68=_0xb5c41d[_0x2d7e('0x1fa')]-_0xb5c41d[_0x2d7e('0x15b')];emitCampaignSummary(_0xb5c41d);if(_0x357f68>0x0&&_0xb5c41d[_0x2d7e('0x6d')]==0x0){if(_0x357f68>this[_0x2d7e('0x23')]){_0x357f68=this[_0x2d7e('0x23')];}_0xb5c41d[_0x2d7e('0x6d')]=0x1;hopperUtils[_0x2d7e('0x1fb')](_0xb5c41d,_0x357f68)[_0x2d7e('0x41')](function(_0x5e5b90){_0xb5c41d[_0x2d7e('0x6d')]=0x0;if(_0x5e5b90){if(!utils[_0x2d7e('0x1fc')](_0x5e5b90)){_0xb5c41d[_0x2d7e('0x6e')]=utils['CAMPAIGN_STATUS'][_0x2d7e('0x74')];logger[_0x2d7e('0x4e')](_0x2d7e('0x1fd')+_0xb5c41d['name']);}else{_0xb5c41d['originated']+=_0x5e5b90['length'];_0xb5c41d[_0x2d7e('0x6e')]=utils[_0x2d7e('0x6f')][_0x2d7e('0x1fe')];for(var _0x2f8a43=0x0;_0x2f8a43<_0x5e5b90[_0x2d7e('0x9c')];_0x2f8a43+=0x1){_0xb5c41d[_0x2d7e('0x1ff')]+=0x1;if(_[_0x2d7e('0xfa')](_0x5e5b90[_0x2f8a43])||_[_0x2d7e('0xfa')](_0x5e5b90[_0x2f8a43][_0x2d7e('0x17f')])||_[_0x2d7e('0xfa')](_0x5e5b90[_0x2f8a43]['phone'])){_0x3e1abc[_0x2d7e('0x15f')]('[actionOriginate]\x20',_0xb5c41d,_0x5e5b90[_0x2f8a43]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x2d7e('0x7a')](_0x5e5b90[_0x2f8a43],[_0x2d7e('0xe5'),_0x2d7e('0x169')]))[_0x2d7e('0x41')](_0x3e1abc['checkContactBlack'](_0xb5c41d,_0x5e5b90[_0x2f8a43]))[_0x2d7e('0xb0')](_0x3e1abc['loggerHandler'](_0x2d7e('0x200'),_0xb5c41d));}}}}})[_0x2d7e('0xb0')](loggerGetContactDialer('[getContactCampaign2]',_0xb5c41d,_0x357f68));}};Dialer[_0x2d7e('0x1b')][_0x2d7e('0xb4')]=function(_0x18cb21,_0x4c6475){var _0x3c2f15=this;var _0x5a8e84=[];if(_0x4c6475<0x1||_0x18cb21[_0x2d7e('0xb2')]==='booked'){_0x4c6475=0x1;}var _0x303c2e=Math['floor'](_0x18cb21[_0x2d7e('0x141')]*_0x4c6475)-_0x18cb21[_0x2d7e('0x15b')];if(_0x18cb21[_0x2d7e('0x201')]>0x0){var _0x469ddb=_0x18cb21[_0x2d7e('0x201')]-_0x18cb21[_0x2d7e('0x15b')]-_0x18cb21[_0x2d7e('0x143')]-_0x18cb21[_0x2d7e('0x144')];if(_0x303c2e>_0x469ddb){_0x303c2e=_0x469ddb;}}if(_0x303c2e>0x0&&_0x18cb21[_0x2d7e('0x6d')]==0x0){if(_0x18cb21[_0x2d7e('0xb2')]===_0x2d7e('0xb')){_0x303c2e=0x1;}if(_0x303c2e>this[_0x2d7e('0x23')]){_0x303c2e=this[_0x2d7e('0x23')];}for(var _0xfda7f1 in this['agents']){if(typeof this[_0x2d7e('0x21')][_0xfda7f1]!==_0x2d7e('0xa9')){if(this['agents'][_0xfda7f1][_0x2d7e('0xd5')]===_0x2d7e('0x202')&&this[_0x2d7e('0x21')][_0xfda7f1][_0x2d7e('0x8a')]===_0x2d7e('0x14f')){_0x5a8e84[_0x2d7e('0xfe')](this[_0x2d7e('0x21')][_0xfda7f1]['id']);}}}_0x18cb21[_0x2d7e('0x6d')]=0x1;hopperUtils[_0x2d7e('0x203')](_0x18cb21,_0x5a8e84,_0x303c2e)[_0x2d7e('0x41')](function(_0x56bc91){_0x18cb21[_0x2d7e('0x6d')]=0x0;if(_0x56bc91){if(!utils[_0x2d7e('0x1fc')](_0x56bc91)){hopperUtils[_0x2d7e('0x204')](_0x18cb21)[_0x2d7e('0x41')](sendMessageReschedule(_0x18cb21))[_0x2d7e('0xb0')](loggerCatch('[countReScheduled]\x20'));}else{_0x18cb21[_0x2d7e('0x15b')]+=_0x56bc91[_0x2d7e('0x9c')];_0x18cb21[_0x2d7e('0x6e')]=_0x18cb21[_0x2d7e('0xb2')]===_0x2d7e('0xb')?utils[_0x2d7e('0x6f')][_0x2d7e('0x145')]:utils[_0x2d7e('0x6f')][_0x2d7e('0x1fe')];for(var _0x1d34de=0x0;_0x1d34de<_0x56bc91['length'];_0x1d34de+=0x1){if(_[_0x2d7e('0xfa')](_0x56bc91[_0x1d34de])||_[_0x2d7e('0xfa')](_0x56bc91[_0x1d34de][_0x2d7e('0x17f')])||_[_0x2d7e('0xfa')](_0x56bc91[_0x1d34de][_0x2d7e('0x169')])){_0x3c2f15[_0x2d7e('0x15f')](_0x2d7e('0x205'),_0x18cb21,_0x56bc91[_0x1d34de]);}else{hopperUtils[_0x2d7e('0x206')](_[_0x2d7e('0x7a')](_0x56bc91[_0x1d34de],[_0x2d7e('0xe4'),_0x2d7e('0x169')]))[_0x2d7e('0x41')](_0x3c2f15[_0x2d7e('0x207')](_0x18cb21,_0x56bc91[_0x1d34de]))['catch'](_0x3c2f15['loggerHandler'](_0x2d7e('0x205'),_0x18cb21));}}}}})[_0x2d7e('0xb0')](loggerGetContactDialer(_0x2d7e('0x208'),_0x18cb21,_0x303c2e));}};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x68')]=function(_0x110d86){if(_0x110d86['dialLimitQueue']>0x0){var _0x4a9ee4=_0x110d86['dialLimitQueue']-_0x110d86['originated']-_0x110d86[_0x2d7e('0x143')];if(_0x4a9ee4>0x0&&_0x110d86[_0x2d7e('0x6d')]==0x0){this[_0x2d7e('0x209')](_0x110d86);}else{loggerPredictiveCalls['info'](_0x2d7e('0x20a'));}}else{this['tryOriginatePredictive'](_0x110d86);}};Dialer['prototype'][_0x2d7e('0x209')]=function(_0x1048a2){var _0x34f272=this;var _0x5cd2ee=[];_0x1048a2[_0x2d7e('0x15b')]+=0x1;for(var _0x992680 in this[_0x2d7e('0x21')]){if(typeof this[_0x2d7e('0x21')][_0x992680]!==_0x2d7e('0xa9')){if(this[_0x2d7e('0x21')][_0x992680][_0x2d7e('0xd5')]===_0x2d7e('0x202')&&this['agents'][_0x992680][_0x2d7e('0x8a')]==='reachable'){_0x5cd2ee[_0x2d7e('0xfe')](this[_0x2d7e('0x21')][_0x992680]['id']);}}}_0x1048a2['temp']=0x1;return this[_0x2d7e('0x203')](_0x1048a2['id'],_0x5cd2ee,0x1,_0x1048a2[_0x2d7e('0x20b')],_0x1048a2)[_0x2d7e('0x41')](function(_0x3a8199){_0x1048a2[_0x2d7e('0x6d')]=0x1;if(_0x3a8199){if(!utils[_0x2d7e('0x1fc')](_0x3a8199)){utils[_0x2d7e('0x6c')](_0x1048a2,0x1,0x0);return hopperUtils[_0x2d7e('0x204')](_0x1048a2)[_0x2d7e('0x41')](sendMessageReschedule(_0x1048a2))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x1048a2['message']=utils[_0x2d7e('0x6f')][_0x2d7e('0x1fe')];if(_[_0x2d7e('0xfa')](_0x3a8199[0x0])||_[_0x2d7e('0xfa')](_0x3a8199[0x0][_0x2d7e('0x17f')])||_[_0x2d7e('0xfa')](_0x3a8199[0x0]['phone'])){_0x34f272['emptyContact'](_0x2d7e('0x205'),_0x1048a2,_0x3a8199[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x2d7e('0x7a')](_0x3a8199[0x0],[_0x2d7e('0xe4'),'phone']))[_0x2d7e('0x41')](_0x34f272[_0x2d7e('0x207')](_0x1048a2,_0x3a8199[0x0]))[_0x2d7e('0xb0')](_0x34f272['loggerHandler'](_0x2d7e('0x20c'),_0x1048a2));}}}})[_0x2d7e('0xb0')](loggerGetContactDialer(_0x2d7e('0x20d'),_0x1048a2,0x1));};Dialer[_0x2d7e('0x1b')]['abandonmentRate']=function(_0x143892,_0x9e367a,_0x5bc6dd,_0xe7dad0,_0x49d58a,_0x1dc8c0){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x2d7e('0x4e')]('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',_0x143892);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x20e'),_0x9e367a);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x20f'),_0x5bc6dd);loggerPredictive['info']('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',_0xe7dad0);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x210'),_0x49d58a);loggerPredictive['info']('---------------------------');return new Promise(function(_0x1d2063,_0x40a213){if(_0x143892<=0x0||isNaN(_0x143892)){return _0x40a213(msgResponse('[abandonmentRate]','Error',_0x2d7e('0x211')+_0x143892));}if(_0x5bc6dd<=0x0||isNaN(_0x5bc6dd)){return _0x40a213(msgResponse('[abandonmentRate]',_0x2d7e('0x87'),_0x2d7e('0x212')+_0x5bc6dd));}if(_0xe7dad0<=0x0||isNaN(_0xe7dad0)){return _0x40a213(msgResponse('[abandonmentRate]','Error',_0x2d7e('0x213')+_0xe7dad0));}if(_0x9e367a<=0x0||isNaN(_0x9e367a)){return _0x40a213(msgResponse(_0x2d7e('0x214'),_0x2d7e('0x87'),_0x2d7e('0x215')+_0x9e367a));}if(_0x49d58a<=0x0||isNaN(_0x49d58a)){return _0x40a213(msgResponse(_0x2d7e('0x214'),_0x2d7e('0x87'),_0x2d7e('0x216')+_0x49d58a));}_0x1dc8c0=_0x1dc8c0||0x0;var _0x3a374f=0x1/_0x5bc6dd;var _0x2e4c86=0x0;var _0x274289=0x0;var _0x2f267f=0x0;var _0x1877d1=0x0;for(var _0x5d6957=0x0;_0x2f267f<_0x49d58a;_0x5d6957+=0x1){_0x274289=_0x5d6957/_0x9e367a;_0x2e4c86=(_0xe7dad0*_0x274289+_0x1dc8c0)/_0x3a374f;_0x2f267f=utils[_0x2d7e('0x217')](_0x2e4c86,_0x143892);_0x1877d1=_0x2e4c86/_0x143892*(0x1-utils[_0x2d7e('0x217')](_0x2e4c86,_0x143892));}return _0x1d2063({'erlangCalls':_0x5d6957,'erlangCallToSecond':_0x9e367a/_0x5d6957,'erlangAbandonmentRate':_0x2f267f,'erlangBusyFactor':_0x1877d1});});};Dialer[_0x2d7e('0x1b')][_0x2d7e('0x218')]=function(_0x1afba0,_0x18370f,_0x104462,_0xabe04b,_0x47a218,_0x4d8db8){loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x219'));loggerPredictive[_0x2d7e('0x4e')]('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',_0x1afba0);loggerPredictive['info'](_0x2d7e('0x20e'),_0x18370f);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x20f'),_0x104462);loggerPredictive['info'](_0x2d7e('0x21a'),_0xabe04b);loggerPredictive['info'](_0x2d7e('0x21b'),_0x47a218);loggerPredictive[_0x2d7e('0x4e')](_0x2d7e('0x57'));return new Promise(function(_0x435755,_0x20a129){if(_0x1afba0<=0x0||isNaN(_0x1afba0)){return _0x20a129(msgResponse(_0x2d7e('0x21c'),_0x2d7e('0x87'),'m\x20=\x20'+_0x1afba0));}if(_0x104462<=0x0||isNaN(_0x104462)){return _0x20a129(msgResponse(_0x2d7e('0x21c'),_0x2d7e('0x87'),'Ts\x20=\x20'+_0x104462));}if(_0xabe04b<=0x0||isNaN(_0xabe04b)){return _0x20a129(msgResponse('[busyFactor]',_0x2d7e('0x87'),_0x2d7e('0x213')+_0xabe04b));}if(_0x18370f<=0x0||isNaN(_0x18370f)){return _0x20a129(msgResponse(_0x2d7e('0x21c'),_0x2d7e('0x87'),_0x2d7e('0x215')+_0x18370f));}if(_0x47a218<=0x0||isNaN(_0x47a218)){return _0x20a129(msgResponse(_0x2d7e('0x21c'),_0x2d7e('0x87'),'Umin\x20=\x20'+_0x47a218));}_0x4d8db8=_0x4d8db8||0x0;var _0x359c81=0x1/_0x104462;var _0x4a03b5=0x0;var _0x53cf04=0x0;var _0x8b67d7=0x0;var _0x3ae757=0x0;for(var _0x3ea7b=0x0;_0x3ae757<_0x47a218;_0x3ea7b+=0x1){_0x53cf04=_0x3ea7b/_0x18370f;_0x4a03b5=(_0xabe04b*_0x53cf04+_0x4d8db8)/_0x359c81;_0x8b67d7=utils['erlangb'](_0x4a03b5,_0x1afba0);_0x3ae757=_0x4a03b5/_0x1afba0*(0x1-utils[_0x2d7e('0x217')](_0x4a03b5,_0x1afba0));}return _0x435755({'erlangCalls':_0x3ea7b,'erlangCallToSecond':_0x18370f/_0x3ea7b,'erlangAbandonmentRate':_0x8b67d7,'erlangBusyFactor':_0x3ae757});});};module[_0x2d7e('0x21d')]=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 7f65510..3bb0e7f 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 _0x650b=['ContactId','ListId','UserId','VoiceQueueId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x4d9107,_0x387fb0){var _0x1f1bc8=function(_0x206993){while(--_0x206993){_0x4d9107['push'](_0x4d9107['shift']());}};_0x1f1bc8(++_0x387fb0);}(_0x650b,0xee));var _0xb650=function(_0x5a06f8,_0x1ca6ae){_0x5a06f8=_0x5a06f8-0x0;var _0x5695ae=_0x650b[_0x5a06f8];return _0x5695ae;};'use strict';var util=require(_0xb650('0x0'));var _=require(_0xb650('0x1'));var moment=require(_0xb650('0x2'));function checkNameSurname(_0x13f7b9,_0x4dc7ad,_0x2c59af){var _0x2259b8='';if(!_[_0xb650('0x3')](_0x4dc7ad)&&_0xb650('0x4')===typeof _0x4dc7ad){_0x2259b8+=_0x4dc7ad;}if(!_[_0xb650('0x3')](_0x2c59af)&&'string'===typeof _0x2c59af){_0x2259b8+='\x20'+_0x2c59af;}if(_0x2259b8!==''){return _0x2259b8;}return _0x13f7b9;}function Action(_0x15a26e,_0x521c23,_0x4651ff){this[_0xb650('0x5')]=_0x15a26e;this[_0xb650('0x6')]=_0x4651ff||undefined;this[_0xb650('0x7')]=checkNameSurname(_0x521c23[_0xb650('0x8')][_0xb650('0x9')],_0x521c23[_0xb650('0x8')][_0xb650('0xa')],_0x521c23['Contact'][_0xb650('0xb')]);this[_0xb650('0xc')]=_0x521c23['phone'];this[_0xb650('0xd')]=_0x15a26e[_0xb650('0x7')];this[_0xb650('0xe')]=_0x521c23['active']||![];this['type']=_0x15a26e[_0xb650('0xf')];this[_0xb650('0x10')]=_0x15a26e['dialQueueTimeout']||0x3;this['scheduledat']=_0x521c23[_0xb650('0x11')];this[_0xb650('0x12')]=_0x521c23[_0xb650('0x12')];this[_0xb650('0x13')]=_0x521c23[_0xb650('0x13')];this[_0xb650('0x14')]=_0x521c23[_0xb650('0x14')];this[_0xb650('0x15')]=_0x521c23[_0xb650('0x15')];this[_0xb650('0x16')]=_0x521c23['countdropretry'];this[_0xb650('0x17')]=_0x521c23[_0xb650('0x17')];this[_0xb650('0x18')]=_0x521c23[_0xb650('0x18')];this[_0xb650('0x19')]=_0x521c23[_0xb650('0x19')];this[_0xb650('0x1a')]=_0x521c23['ContactId'];this['ListId']=_0x521c23[_0xb650('0x1b')];this[_0xb650('0x1c')]=_0x521c23[_0xb650('0x1c')];this[_0xb650('0x1d')]=_0x521c23[_0xb650('0x1d')];this['CampaignId']=_0x521c23['CampaignId'];this[_0xb650('0x1e')]=_0x521c23['id'];this[_0xb650('0x1f')]=_0x521c23['Contact'][_0xb650('0xa')]||'';this['starttime']=moment()[_0xb650('0x20')](_0xb650('0x21'));this['callback']=_0x521c23[_0xb650('0x22')];this[_0xb650('0x23')]=_0x521c23[_0xb650('0x23')];this[_0xb650('0x24')]=_0x521c23[_0xb650('0x24')];this[_0xb650('0x25')]=_0x521c23[_0xb650('0x25')];this[_0xb650('0x26')]='';this[_0xb650('0x27')]='';}Action[_0xb650('0x28')][_0xb650('0x29')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xb650('0x7')],this['voiceQueue']['dialCutDigit']>0x0?this[_0xb650('0xc')]['substring'](this[_0xb650('0x5')]['dialCutDigit']):this[_0xb650('0xc')]);};Action[_0xb650('0x28')][_0xb650('0x2a')]=function(){return this['queue'];};module[_0xb650('0x2b')]=Action; \ No newline at end of file +var _0xbbf8=['originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','exports','string','uniqueid','name','Contact','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0xb2d5e0,_0x8a8428){var _0x70097=function(_0x40f367){while(--_0x40f367){_0xb2d5e0['push'](_0xb2d5e0['shift']());}};_0x70097(++_0x8a8428);}(_0xbbf8,0x7b));var _0x8bbf=function(_0x14102c,_0x1cb214){_0x14102c=_0x14102c-0x0;var _0x13297b=_0xbbf8[_0x14102c];return _0x13297b;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x1ad779,_0x3854bb,_0x25f365){var _0x57e202='';if(!_['isNil'](_0x3854bb)&&_0x8bbf('0x0')===typeof _0x3854bb){_0x57e202+=_0x3854bb;}if(!_['isNil'](_0x25f365)&&_0x8bbf('0x0')===typeof _0x25f365){_0x57e202+='\x20'+_0x25f365;}if(_0x57e202!==''){return _0x57e202;}return _0x1ad779;}function Action(_0x36da7e,_0x412a23,_0x102bb0){this['voiceQueue']=_0x36da7e;this[_0x8bbf('0x1')]=_0x102bb0||undefined;this[_0x8bbf('0x2')]=checkNameSurname(_0x412a23['Contact']['phone'],_0x412a23['Contact']['firstName'],_0x412a23[_0x8bbf('0x3')]['lastName']);this[_0x8bbf('0x4')]=_0x412a23[_0x8bbf('0x5')];this[_0x8bbf('0x6')]=_0x36da7e['name'];this[_0x8bbf('0x7')]=_0x412a23[_0x8bbf('0x7')]||![];this[_0x8bbf('0x8')]=_0x36da7e[_0x8bbf('0x8')];this[_0x8bbf('0x9')]=_0x36da7e[_0x8bbf('0x9')]||0x3;this[_0x8bbf('0xa')]=_0x412a23[_0x8bbf('0xa')];this[_0x8bbf('0xb')]=_0x412a23[_0x8bbf('0xb')];this['countcongestionretry']=_0x412a23[_0x8bbf('0xc')];this[_0x8bbf('0xd')]=_0x412a23[_0x8bbf('0xd')];this['countnosuchnumberretry']=_0x412a23[_0x8bbf('0xe')];this['countdropretry']=_0x412a23['countdropretry'];this['countabandonedretry']=_0x412a23[_0x8bbf('0xf')];this['countmachineretry']=_0x412a23['countmachineretry'];this['countagentrejectretry']=_0x412a23[_0x8bbf('0x10')];this['ContactId']=_0x412a23[_0x8bbf('0x11')];this['ListId']=_0x412a23['ListId'];this[_0x8bbf('0x12')]=_0x412a23['UserId'];this[_0x8bbf('0x13')]=_0x412a23[_0x8bbf('0x13')];this[_0x8bbf('0x14')]=_0x412a23['CampaignId'];this[_0x8bbf('0x15')]=_0x412a23['id'];this['ContactFirstName']=_0x412a23[_0x8bbf('0x3')][_0x8bbf('0x16')]||'';this['starttime']=moment()[_0x8bbf('0x17')](_0x8bbf('0x18'));this[_0x8bbf('0x19')]=_0x412a23[_0x8bbf('0x19')];this[_0x8bbf('0x1a')]=_0x412a23[_0x8bbf('0x1a')];this[_0x8bbf('0x1b')]=_0x412a23[_0x8bbf('0x1b')];this['recallme']=_0x412a23[_0x8bbf('0x1c')];this[_0x8bbf('0x1d')]='';this[_0x8bbf('0x1e')]='';}Action[_0x8bbf('0x1f')]['getCaller']=function(){return util[_0x8bbf('0x17')](_0x8bbf('0x20'),this[_0x8bbf('0x2')],this[_0x8bbf('0x21')][_0x8bbf('0x22')]>0x0?this[_0x8bbf('0x4')][_0x8bbf('0x23')](this[_0x8bbf('0x21')][_0x8bbf('0x22')]):this[_0x8bbf('0x4')]);};Action[_0x8bbf('0x1f')][_0x8bbf('0x24')]=function(){return this[_0x8bbf('0x6')];};module[_0x8bbf('0x25')]=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 df080ae..20bd998 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 _0x3b10=['ringtime','getSeconds','holdtime','answertime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4c3206,_0x58cd5){var _0x4b97bb=function(_0x24c452){while(--_0x24c452){_0x4c3206['push'](_0x4c3206['shift']());}};_0x4b97bb(++_0x58cd5);}(_0x3b10,0x194));var _0x03b1=function(_0x709aac,_0xbb49f8){_0x709aac=_0x709aac-0x0;var _0x41f12a=_0x3b10[_0x709aac];return _0x41f12a;};'use strict';var moment=require('moment');var utils=require(_0x03b1('0x0'));function AgentComplete(_0x141731,_0x279db2){this[_0x03b1('0x1')]=0x4;this[_0x03b1('0x2')]=_0x03b1('0x3');this['scheduledat']=_0x141731[_0x03b1('0x4')];this['type']=_0x141731[_0x03b1('0x5')];this[_0x03b1('0x6')]=_0x141731[_0x03b1('0x5')]==='outbound'?_0x03b1('0x7'):_0x141731[_0x03b1('0x5')];this[_0x03b1('0x8')]=_0x141731['countbusyretry'];this[_0x03b1('0x9')]=_0x141731[_0x03b1('0x9')];this[_0x03b1('0xa')]=_0x141731[_0x03b1('0xa')];this[_0x03b1('0xb')]=_0x141731[_0x03b1('0x8')]+_0x141731[_0x03b1('0x9')]+_0x141731[_0x03b1('0xa')]+_0x141731[_0x03b1('0xc')]+_0x141731[_0x03b1('0xd')]+_0x141731[_0x03b1('0xe')]+_0x141731[_0x03b1('0xf')]+_0x141731[_0x03b1('0x10')];this[_0x03b1('0xc')]=_0x141731[_0x03b1('0xc')];this[_0x03b1('0xd')]=_0x141731[_0x03b1('0xd')];this[_0x03b1('0xe')]=_0x141731[_0x03b1('0xe')];this[_0x03b1('0xf')]=_0x141731[_0x03b1('0xf')];this[_0x03b1('0x10')]=_0x141731[_0x03b1('0x10')];this['uniqueid']=_0x279db2['uniqueid'];this[_0x03b1('0x11')]=_0x141731[_0x03b1('0x12')];this[_0x03b1('0x13')]=_0x141731[_0x03b1('0x14')];this[_0x03b1('0x15')]=_0x141731[_0x03b1('0x15')];this['responsetime']=_0x141731[_0x03b1('0x16')];this['answertime']=_0x141731['answertime'];this[_0x03b1('0x17')]=moment()[_0x03b1('0x18')](_0x03b1('0x19'));this[_0x03b1('0x1a')]=utils[_0x03b1('0x1b')](_0x141731[_0x03b1('0x16')],_0x141731[_0x03b1('0x15')]);this[_0x03b1('0x1c')]=utils[_0x03b1('0x1b')](_0x141731[_0x03b1('0x1d')],_0x141731[_0x03b1('0x16')]);this['talktime']=utils['getSeconds'](this['endtime'],_0x141731[_0x03b1('0x1d')]);this[_0x03b1('0x7')]=_0x279db2[_0x03b1('0x7')];this['membername']=_0x279db2['membername'];this[_0x03b1('0x1e')]=_0x279db2[_0x03b1('0x1e')];this[_0x03b1('0x1f')]=_0x141731[_0x03b1('0x1f')];this[_0x03b1('0x20')]=_0x141731[_0x03b1('0x20')];this[_0x03b1('0x21')]=_0x141731['callbackat'];this[_0x03b1('0x22')]=_0x141731[_0x03b1('0x22')];this[_0x03b1('0x23')]=_0x141731[_0x03b1('0x23')];this['ListId']=_0x141731[_0x03b1('0x24')];this['UserId']=_0x141731[_0x03b1('0x25')];this[_0x03b1('0x26')]=_0x141731[_0x03b1('0x26')];this[_0x03b1('0x27')]=_0x141731['CampaignId'];this[_0x03b1('0x28')]=_0x141731[_0x03b1('0x28')]||'';this[_0x03b1('0x29')]=_0x141731[_0x03b1('0x29')]||'';this[_0x03b1('0x2a')]=_0x141731[_0x03b1('0x2a')];}module['exports']=AgentComplete; \ No newline at end of file +var _0x32c6=['countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','answertime','endtime','ringtime','getSeconds','responsetime','holdtime','talktime','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry'];(function(_0x141470,_0x20e178){var _0x127313=function(_0x76bd31){while(--_0x76bd31){_0x141470['push'](_0x141470['shift']());}};_0x127313(++_0x20e178);}(_0x32c6,0x152));var _0x632c=function(_0x4a540f,_0x2e3f9d){_0x4a540f=_0x4a540f-0x0;var _0x3573f7=_0x32c6[_0x4a540f];return _0x3573f7;};'use strict';var moment=require('moment');var utils=require(_0x632c('0x0'));function AgentComplete(_0x4fd9dd,_0x89f457){this['state']=0x4;this[_0x632c('0x1')]=_0x632c('0x2');this[_0x632c('0x3')]=_0x4fd9dd['scheduledat'];this[_0x632c('0x4')]=_0x4fd9dd['type'];this[_0x632c('0x5')]=_0x4fd9dd[_0x632c('0x4')]===_0x632c('0x6')?_0x632c('0x7'):_0x4fd9dd['type'];this['countbusyretry']=_0x4fd9dd['countbusyretry'];this['countcongestionretry']=_0x4fd9dd[_0x632c('0x8')];this[_0x632c('0x9')]=_0x4fd9dd[_0x632c('0x9')];this[_0x632c('0xa')]=_0x4fd9dd[_0x632c('0xb')]+_0x4fd9dd[_0x632c('0x8')]+_0x4fd9dd['countnoanswerretry']+_0x4fd9dd[_0x632c('0xc')]+_0x4fd9dd[_0x632c('0xd')]+_0x4fd9dd['countabandonedretry']+_0x4fd9dd[_0x632c('0xe')]+_0x4fd9dd[_0x632c('0xf')];this[_0x632c('0xc')]=_0x4fd9dd['countnosuchnumberretry'];this[_0x632c('0xd')]=_0x4fd9dd[_0x632c('0xd')];this[_0x632c('0x10')]=_0x4fd9dd[_0x632c('0x10')];this['countmachineretry']=_0x4fd9dd['countmachineretry'];this[_0x632c('0xf')]=_0x4fd9dd['countagentrejectretry'];this[_0x632c('0x11')]=_0x89f457[_0x632c('0x11')];this[_0x632c('0x12')]=_0x4fd9dd[_0x632c('0x13')];this[_0x632c('0x14')]=_0x4fd9dd[_0x632c('0x15')];this[_0x632c('0x16')]=_0x4fd9dd[_0x632c('0x16')];this['responsetime']=_0x4fd9dd['responsetime'];this[_0x632c('0x17')]=_0x4fd9dd[_0x632c('0x17')];this[_0x632c('0x18')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x632c('0x19')]=utils[_0x632c('0x1a')](_0x4fd9dd[_0x632c('0x1b')],_0x4fd9dd[_0x632c('0x16')]);this[_0x632c('0x1c')]=utils[_0x632c('0x1a')](_0x4fd9dd['answertime'],_0x4fd9dd[_0x632c('0x1b')]);this[_0x632c('0x1d')]=utils['getSeconds'](this[_0x632c('0x18')],_0x4fd9dd['answertime']);this[_0x632c('0x7')]=_0x89f457[_0x632c('0x7')];this['membername']=_0x89f457[_0x632c('0x1e')];this[_0x632c('0x1f')]=_0x89f457[_0x632c('0x1f')];this[_0x632c('0x20')]=_0x4fd9dd[_0x632c('0x20')];this['callbackuniqueid']=_0x4fd9dd['callbackuniqueid'];this[_0x632c('0x21')]=_0x4fd9dd['callbackat'];this[_0x632c('0x22')]=_0x4fd9dd[_0x632c('0x22')];this['ContactId']=_0x4fd9dd[_0x632c('0x23')];this['ListId']=_0x4fd9dd[_0x632c('0x24')];this['UserId']=_0x4fd9dd[_0x632c('0x25')];this[_0x632c('0x26')]=_0x4fd9dd[_0x632c('0x26')];this[_0x632c('0x27')]=_0x4fd9dd[_0x632c('0x27')];this[_0x632c('0x28')]=_0x4fd9dd[_0x632c('0x28')]||'';this['originatecalleridname']=_0x4fd9dd[_0x632c('0x29')]||'';this[_0x632c('0x2a')]=_0x4fd9dd[_0x632c('0x2a')];}module[_0x632c('0x2b')]=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 0957914..c34d487 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 _0x406d=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x15a8fa,_0xde3e6){var _0x3bbd4d=function(_0x59b7c9){while(--_0x59b7c9){_0x15a8fa['push'](_0x15a8fa['shift']());}};_0x3bbd4d(++_0xde3e6);}(_0x406d,0x83));var _0xd406=function(_0x3a5ea9,_0x13fb5e){_0x3a5ea9=_0x3a5ea9-0x0;var _0x14f566=_0x406d[_0x3a5ea9];return _0x14f566;};'use strict';function Final(_0x354743){this[_0xd406('0x0')]=_0x354743['uniqueid'];this[_0xd406('0x1')]=_0x354743[_0xd406('0x1')];this[_0xd406('0x2')]=_0x354743[_0xd406('0x2')];this[_0xd406('0x3')]=_0x354743['type']===_0xd406('0x4')?_0xd406('0x5'):_0x354743[_0xd406('0x2')];this[_0xd406('0x6')]=_0x354743[_0xd406('0x6')];this[_0xd406('0x7')]=_0x354743[_0xd406('0x7')];this[_0xd406('0x8')]=_0x354743['countnoanswerretry'];this['countglobal']=_0x354743[_0xd406('0x6')]+_0x354743[_0xd406('0x7')]+_0x354743[_0xd406('0x8')]+_0x354743[_0xd406('0x9')]+_0x354743[_0xd406('0xa')]+_0x354743['countabandonedretry']+_0x354743[_0xd406('0xb')]+_0x354743[_0xd406('0xc')];this[_0xd406('0x9')]=_0x354743[_0xd406('0x9')];this[_0xd406('0xa')]=_0x354743[_0xd406('0xa')];this['countabandonedretry']=_0x354743[_0xd406('0xd')];this[_0xd406('0xb')]=_0x354743[_0xd406('0xb')];this[_0xd406('0xc')]=_0x354743[_0xd406('0xc')];this['queue']=_0x354743['queue'];this['calleridname']=_0x354743[_0xd406('0xe')];this[_0xd406('0xf')]=_0x354743[_0xd406('0xf')];this[_0xd406('0x10')]=_0x354743[_0xd406('0x10')];this[_0xd406('0x11')]=_0x354743['responsetime'];this[_0xd406('0x12')]=_0x354743[_0xd406('0x11')];this[_0xd406('0x13')]=_0x354743[_0xd406('0x13')]||0x0;this['holdtime']=_0x354743[_0xd406('0x14')]||0x0;this['talktime']=_0x354743['talktime']||0x0;this[_0xd406('0x15')]=_0x354743['callback'];this[_0xd406('0x16')]=_0x354743[_0xd406('0x16')];this[_0xd406('0x17')]=_0x354743[_0xd406('0x17')];this['recallme']=_0x354743[_0xd406('0x18')];this[_0xd406('0x19')]=_0x354743[_0xd406('0x19')];this[_0xd406('0x1a')]=_0x354743[_0xd406('0x1a')];this['UserId']=_0x354743['UserId'];this[_0xd406('0x1b')]=_0x354743[_0xd406('0x1b')];this[_0xd406('0x1c')]=_0x354743[_0xd406('0x1c')];this[_0xd406('0x1d')]=_0x354743[_0xd406('0x1d')]||'';this[_0xd406('0x1e')]=_0x354743[_0xd406('0x1e')]||'';this['state']=_0x354743[_0xd406('0x1f')];this['statedesc']=_0x354743[_0xd406('0x20')];}module[_0xd406('0x21')]=Final; \ No newline at end of file +var _0x6e97=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x16c4d0,_0x5cb02b){var _0x360bdd=function(_0x2d7436){while(--_0x2d7436){_0x16c4d0['push'](_0x16c4d0['shift']());}};_0x360bdd(++_0x5cb02b);}(_0x6e97,0xd7));var _0x76e9=function(_0x32d6a0,_0x2af7da){_0x32d6a0=_0x32d6a0-0x0;var _0x327fe9=_0x6e97[_0x32d6a0];return _0x327fe9;};'use strict';function Final(_0x942ed6){this[_0x76e9('0x0')]=_0x942ed6[_0x76e9('0x0')];this[_0x76e9('0x1')]=_0x942ed6[_0x76e9('0x1')];this[_0x76e9('0x2')]=_0x942ed6[_0x76e9('0x2')];this[_0x76e9('0x3')]=_0x942ed6[_0x76e9('0x2')]===_0x76e9('0x4')?_0x76e9('0x5'):_0x942ed6[_0x76e9('0x2')];this[_0x76e9('0x6')]=_0x942ed6[_0x76e9('0x6')];this[_0x76e9('0x7')]=_0x942ed6['countcongestionretry'];this['countnoanswerretry']=_0x942ed6[_0x76e9('0x8')];this[_0x76e9('0x9')]=_0x942ed6[_0x76e9('0x6')]+_0x942ed6['countcongestionretry']+_0x942ed6[_0x76e9('0x8')]+_0x942ed6[_0x76e9('0xa')]+_0x942ed6[_0x76e9('0xb')]+_0x942ed6['countabandonedretry']+_0x942ed6[_0x76e9('0xc')]+_0x942ed6[_0x76e9('0xd')];this[_0x76e9('0xa')]=_0x942ed6[_0x76e9('0xa')];this['countdropretry']=_0x942ed6[_0x76e9('0xb')];this[_0x76e9('0xe')]=_0x942ed6[_0x76e9('0xe')];this[_0x76e9('0xc')]=_0x942ed6['countmachineretry'];this[_0x76e9('0xd')]=_0x942ed6[_0x76e9('0xd')];this[_0x76e9('0x5')]=_0x942ed6['queue'];this['calleridname']=_0x942ed6[_0x76e9('0xf')];this[_0x76e9('0x10')]=_0x942ed6['calleridnum'];this[_0x76e9('0x11')]=_0x942ed6['starttime'];this[_0x76e9('0x12')]=_0x942ed6[_0x76e9('0x12')];this[_0x76e9('0x13')]=_0x942ed6[_0x76e9('0x12')];this['ringtime']=_0x942ed6[_0x76e9('0x14')]||0x0;this[_0x76e9('0x15')]=_0x942ed6[_0x76e9('0x15')]||0x0;this[_0x76e9('0x16')]=_0x942ed6['talktime']||0x0;this['callback']=_0x942ed6[_0x76e9('0x17')];this[_0x76e9('0x18')]=_0x942ed6[_0x76e9('0x18')];this[_0x76e9('0x19')]=_0x942ed6[_0x76e9('0x19')];this[_0x76e9('0x1a')]=_0x942ed6[_0x76e9('0x1a')];this[_0x76e9('0x1b')]=_0x942ed6['ContactId'];this[_0x76e9('0x1c')]=_0x942ed6[_0x76e9('0x1c')];this[_0x76e9('0x1d')]=_0x942ed6['UserId'];this[_0x76e9('0x1e')]=_0x942ed6['VoiceQueueId'];this[_0x76e9('0x1f')]=_0x942ed6[_0x76e9('0x1f')];this['originatecalleridnum']=_0x942ed6[_0x76e9('0x20')]||'';this[_0x76e9('0x21')]=_0x942ed6['originatecalleridname']||'';this[_0x76e9('0x22')]=_0x942ed6[_0x76e9('0x22')];this['statedesc']=_0x942ed6[_0x76e9('0x23')];}module[_0x76e9('0x24')]=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 bdeb78b..a260c05 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 _0x7191=['queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','campaigntype','type'];(function(_0xd2709e,_0x27a3b1){var _0x11fda3=function(_0x4d4314){while(--_0x4d4314){_0xd2709e['push'](_0xd2709e['shift']());}};_0x11fda3(++_0x27a3b1);}(_0x7191,0x1bb));var _0x1719=function(_0x2170aa,_0x3b50f0){_0x2170aa=_0x2170aa-0x0;var _0x41ec22=_0x7191[_0x2170aa];return _0x41ec22;};'use strict';var moment=require(_0x1719('0x0'));var utils=require(_0x1719('0x1'));function Hangup(_0x798c3a,_0x59d246){this[_0x1719('0x2')]=0x4;this[_0x1719('0x3')]=_0x1719('0x4');this[_0x1719('0x5')]=_0x798c3a[_0x1719('0x5')];this['type']=_0x798c3a['type'];this[_0x1719('0x6')]=_0x798c3a[_0x1719('0x7')]==='outbound'?_0x1719('0x8'):_0x798c3a[_0x1719('0x7')];this['amd']=_0x798c3a[_0x1719('0x9')]||![];this[_0x1719('0xa')]=_0x798c3a[_0x1719('0xa')];this['countcongestionretry']=_0x798c3a[_0x1719('0xb')];this[_0x1719('0xc')]=_0x798c3a[_0x1719('0xc')];this[_0x1719('0xd')]=_0x798c3a['countbusyretry']+_0x798c3a[_0x1719('0xb')]+_0x798c3a['countnoanswerretry']+_0x798c3a[_0x1719('0xe')]+_0x798c3a[_0x1719('0xf')]+_0x798c3a[_0x1719('0x10')]+_0x798c3a[_0x1719('0x11')]+_0x798c3a[_0x1719('0x12')];this[_0x1719('0xe')]=_0x798c3a[_0x1719('0xe')];this[_0x1719('0xf')]=_0x798c3a[_0x1719('0xf')];this[_0x1719('0x10')]=_0x798c3a[_0x1719('0x10')];this[_0x1719('0x11')]=_0x798c3a[_0x1719('0x11')];this['countagentrejectretry']=_0x798c3a[_0x1719('0x12')];this[_0x1719('0x13')]=_0x59d246[_0x1719('0x13')];this['calleridname']=_0x798c3a[_0x1719('0x14')];this['calleridnum']=_0x798c3a[_0x1719('0x15')];this['starttime']=_0x798c3a[_0x1719('0x16')];this[_0x1719('0x17')]=_0x798c3a[_0x1719('0x17')];this['endtime']=moment()[_0x1719('0x18')](_0x1719('0x19'));this[_0x1719('0x1a')]=utils[_0x1719('0x1b')](_0x798c3a[_0x1719('0x17')],_0x798c3a[_0x1719('0x16')]);this[_0x1719('0x1c')]=0x0;this[_0x1719('0x1d')]=utils['getSeconds'](this[_0x1719('0x1e')],_0x798c3a[_0x1719('0x17')]);this['queue']=_0x798c3a[_0x1719('0x8')];this['membername']='IVR';this['reason']=_0x59d246[_0x1719('0x1f')];this[_0x1719('0x20')]=_0x798c3a['callback'];this['callbackuniqueid']=_0x798c3a[_0x1719('0x21')];this['callbackat']=_0x798c3a[_0x1719('0x22')];this[_0x1719('0x23')]=_0x798c3a[_0x1719('0x23')];this[_0x1719('0x24')]=_0x798c3a[_0x1719('0x24')];this['ListId']=_0x798c3a[_0x1719('0x25')];this['UserId']=_0x798c3a[_0x1719('0x26')];this['VoiceQueueId']=_0x798c3a['VoiceQueueId'];this[_0x1719('0x27')]=_0x798c3a['CampaignId'];}module[_0x1719('0x28')]=Hangup; \ No newline at end of file +var _0xb08c=['name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','getSeconds','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','moment','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname'];(function(_0x5c3ee2,_0x38893b){var _0x27398e=function(_0x3ce9ce){while(--_0x3ce9ce){_0x5c3ee2['push'](_0x5c3ee2['shift']());}};_0x27398e(++_0x38893b);}(_0xb08c,0x6a));var _0xcb08=function(_0x4404a8,_0x3b1e0b){_0x4404a8=_0x4404a8-0x0;var _0x1f656f=_0xb08c[_0x4404a8];return _0x1f656f;};'use strict';var moment=require(_0xcb08('0x0'));var utils=require(_0xcb08('0x1'));function Hangup(_0xa22776,_0x122675){this[_0xcb08('0x2')]=0x4;this[_0xcb08('0x3')]='Answer';this[_0xcb08('0x4')]=_0xa22776[_0xcb08('0x4')];this['type']=_0xa22776[_0xcb08('0x5')];this[_0xcb08('0x6')]=_0xa22776['type']===_0xcb08('0x7')?_0xcb08('0x8'):_0xa22776[_0xcb08('0x5')];this[_0xcb08('0x9')]=_0xa22776['amd']||![];this[_0xcb08('0xa')]=_0xa22776[_0xcb08('0xa')];this[_0xcb08('0xb')]=_0xa22776[_0xcb08('0xb')];this[_0xcb08('0xc')]=_0xa22776[_0xcb08('0xc')];this[_0xcb08('0xd')]=_0xa22776['countbusyretry']+_0xa22776['countcongestionretry']+_0xa22776['countnoanswerretry']+_0xa22776['countnosuchnumberretry']+_0xa22776['countdropretry']+_0xa22776['countabandonedretry']+_0xa22776['countmachineretry']+_0xa22776['countagentrejectretry'];this[_0xcb08('0xe')]=_0xa22776[_0xcb08('0xe')];this['countdropretry']=_0xa22776['countdropretry'];this[_0xcb08('0xf')]=_0xa22776['countabandonedretry'];this['countmachineretry']=_0xa22776[_0xcb08('0x10')];this[_0xcb08('0x11')]=_0xa22776[_0xcb08('0x11')];this[_0xcb08('0x12')]=_0x122675[_0xcb08('0x12')];this[_0xcb08('0x13')]=_0xa22776[_0xcb08('0x14')];this[_0xcb08('0x15')]=_0xa22776[_0xcb08('0x16')];this['starttime']=_0xa22776[_0xcb08('0x17')];this[_0xcb08('0x18')]=_0xa22776[_0xcb08('0x18')];this[_0xcb08('0x19')]=moment()[_0xcb08('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcb08('0x1b')]=utils['getSeconds'](_0xa22776[_0xcb08('0x18')],_0xa22776['starttime']);this[_0xcb08('0x1c')]=0x0;this['talktime']=utils[_0xcb08('0x1d')](this[_0xcb08('0x19')],_0xa22776[_0xcb08('0x18')]);this['queue']=_0xa22776[_0xcb08('0x8')];this[_0xcb08('0x1e')]=_0xcb08('0x1f');this[_0xcb08('0x20')]=_0x122675[_0xcb08('0x21')];this['callback']=_0xa22776[_0xcb08('0x22')];this[_0xcb08('0x23')]=_0xa22776[_0xcb08('0x23')];this[_0xcb08('0x24')]=_0xa22776[_0xcb08('0x24')];this[_0xcb08('0x25')]=_0xa22776[_0xcb08('0x25')];this['ContactId']=_0xa22776[_0xcb08('0x26')];this[_0xcb08('0x27')]=_0xa22776[_0xcb08('0x27')];this['UserId']=_0xa22776[_0xcb08('0x28')];this['VoiceQueueId']=_0xa22776['VoiceQueueId'];this['CampaignId']=_0xa22776[_0xcb08('0x29')];}module['exports']=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 226209f..31c5486 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 _0x9cc8=['getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','calleridnum','number','starttime','ringtime'];(function(_0x189b3b,_0x484de8){var _0x7c4721=function(_0x1ca32b){while(--_0x1ca32b){_0x189b3b['push'](_0x189b3b['shift']());}};_0x7c4721(++_0x484de8);}(_0x9cc8,0xc5));var _0x89cc=function(_0x56a825,_0x78fe73){_0x56a825=_0x56a825-0x0;var _0x480149=_0x9cc8[_0x56a825];return _0x480149;};'use strict';var utils=require(_0x89cc('0x0'));function History(_0x4523eb){this['uniqueid']=_0x4523eb['uniqueid'];this['scheduledat']=_0x4523eb[_0x89cc('0x1')]||undefined;this['type']=_0x4523eb[_0x89cc('0x2')];this[_0x89cc('0x3')]=_0x4523eb[_0x89cc('0x2')]===_0x89cc('0x4')?'queue':_0x4523eb[_0x89cc('0x2')];this[_0x89cc('0x5')]=_0x4523eb[_0x89cc('0x5')];this[_0x89cc('0x6')]=_0x4523eb['countcongestionretry'];this[_0x89cc('0x7')]=_0x4523eb[_0x89cc('0x7')];this['countglobal']=_0x4523eb[_0x89cc('0x5')]+_0x4523eb[_0x89cc('0x6')]+_0x4523eb[_0x89cc('0x7')]+_0x4523eb[_0x89cc('0x8')]+_0x4523eb[_0x89cc('0x9')]+_0x4523eb[_0x89cc('0xa')]+_0x4523eb[_0x89cc('0xb')]+_0x4523eb[_0x89cc('0xc')];this[_0x89cc('0x8')]=_0x4523eb['countnosuchnumberretry'];this[_0x89cc('0x9')]=_0x4523eb[_0x89cc('0x9')];this[_0x89cc('0xa')]=_0x4523eb['countabandonedretry'];this[_0x89cc('0xb')]=_0x4523eb[_0x89cc('0xb')];this[_0x89cc('0xc')]=_0x4523eb[_0x89cc('0xc')];this[_0x89cc('0xd')]=_0x4523eb[_0x89cc('0xd')];this['calleridname']=_0x4523eb[_0x89cc('0xe')];this[_0x89cc('0xf')]=_0x4523eb[_0x89cc('0x10')];this['starttime']=_0x4523eb[_0x89cc('0x11')];this['responsetime']=_0x4523eb['responsetime'];this['endtime']=_0x4523eb['responsetime'];this[_0x89cc('0x12')]=utils[_0x89cc('0x13')](_0x4523eb['responsetime'],_0x4523eb[_0x89cc('0x11')]);this[_0x89cc('0x14')]=0x0;this[_0x89cc('0x15')]=0x0;this[_0x89cc('0x16')]=_0x4523eb[_0x89cc('0x16')];this[_0x89cc('0x17')]=_0x4523eb['callbackuniqueid'];this[_0x89cc('0x18')]=_0x4523eb[_0x89cc('0x18')];this[_0x89cc('0x19')]=_0x4523eb[_0x89cc('0x19')];this[_0x89cc('0x1a')]=_0x4523eb['ContactId'];this[_0x89cc('0x1b')]=_0x4523eb[_0x89cc('0x1b')];this['UserId']=_0x4523eb[_0x89cc('0x1c')];this[_0x89cc('0x1d')]=_0x4523eb['VoiceQueueId'];this[_0x89cc('0x1e')]=_0x4523eb['CampaignId'];this['originatecalleridnum']=_0x4523eb[_0x89cc('0x1f')]||'';this[_0x89cc('0x20')]=_0x4523eb[_0x89cc('0x20')]||'';this['state']=_0x4523eb[_0x89cc('0x21')];this[_0x89cc('0x22')]=_0x4523eb[_0x89cc('0x22')];}module[_0x89cc('0x23')]=History; \ No newline at end of file +var _0xae25=['exports','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xae25,0x177));var _0x5ae2=function(_0x50b5cf,_0x17521f){_0x50b5cf=_0x50b5cf-0x0;var _0x55ebd7=_0xae25[_0x50b5cf];return _0x55ebd7;};'use strict';var utils=require('../utils');function History(_0x37675a){this['uniqueid']=_0x37675a['uniqueid'];this[_0x5ae2('0x0')]=_0x37675a[_0x5ae2('0x0')]||undefined;this['type']=_0x37675a[_0x5ae2('0x1')];this['campaigntype']=_0x37675a[_0x5ae2('0x1')]===_0x5ae2('0x2')?_0x5ae2('0x3'):_0x37675a[_0x5ae2('0x1')];this['countbusyretry']=_0x37675a[_0x5ae2('0x4')];this[_0x5ae2('0x5')]=_0x37675a[_0x5ae2('0x5')];this[_0x5ae2('0x6')]=_0x37675a[_0x5ae2('0x6')];this['countglobal']=_0x37675a[_0x5ae2('0x4')]+_0x37675a[_0x5ae2('0x5')]+_0x37675a[_0x5ae2('0x6')]+_0x37675a[_0x5ae2('0x7')]+_0x37675a['countdropretry']+_0x37675a[_0x5ae2('0x8')]+_0x37675a[_0x5ae2('0x9')]+_0x37675a[_0x5ae2('0xa')];this[_0x5ae2('0x7')]=_0x37675a[_0x5ae2('0x7')];this[_0x5ae2('0xb')]=_0x37675a['countdropretry'];this['countabandonedretry']=_0x37675a[_0x5ae2('0x8')];this[_0x5ae2('0x9')]=_0x37675a['countmachineretry'];this['countagentrejectretry']=_0x37675a[_0x5ae2('0xa')];this[_0x5ae2('0x3')]=_0x37675a[_0x5ae2('0x3')];this[_0x5ae2('0xc')]=_0x37675a['name'];this['calleridnum']=_0x37675a[_0x5ae2('0xd')];this[_0x5ae2('0xe')]=_0x37675a['starttime'];this[_0x5ae2('0xf')]=_0x37675a[_0x5ae2('0xf')];this[_0x5ae2('0x10')]=_0x37675a[_0x5ae2('0xf')];this[_0x5ae2('0x11')]=utils[_0x5ae2('0x12')](_0x37675a[_0x5ae2('0xf')],_0x37675a[_0x5ae2('0xe')]);this[_0x5ae2('0x13')]=0x0;this[_0x5ae2('0x14')]=0x0;this[_0x5ae2('0x15')]=_0x37675a[_0x5ae2('0x15')];this[_0x5ae2('0x16')]=_0x37675a[_0x5ae2('0x16')];this[_0x5ae2('0x17')]=_0x37675a[_0x5ae2('0x17')];this[_0x5ae2('0x18')]=_0x37675a['recallme'];this[_0x5ae2('0x19')]=_0x37675a['ContactId'];this[_0x5ae2('0x1a')]=_0x37675a[_0x5ae2('0x1a')];this[_0x5ae2('0x1b')]=_0x37675a[_0x5ae2('0x1b')];this[_0x5ae2('0x1c')]=_0x37675a[_0x5ae2('0x1c')];this['CampaignId']=_0x37675a[_0x5ae2('0x1d')];this[_0x5ae2('0x1e')]=_0x37675a[_0x5ae2('0x1e')]||'';this['originatecalleridname']=_0x37675a['originatecalleridname']||'';this[_0x5ae2('0x1f')]=_0x37675a[_0x5ae2('0x1f')];this[_0x5ae2('0x20')]=_0x37675a[_0x5ae2('0x20')];}module[_0x5ae2('0x21')]=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 2149325..10dbd42 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 _0x2f59=['countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','ringtime','holdtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2f59,0x157));var _0x92f5=function(_0x33968f,_0x19e029){_0x33968f=_0x33968f-0x0;var _0x3ca1e5=_0x2f59[_0x33968f];return _0x3ca1e5;};'use strict';var utils=require(_0x92f5('0x0'));function QueueCallerAbandon(_0x1cd5f8,_0x4906cc){this[_0x92f5('0x1')]=_0x1cd5f8[_0x92f5('0x1')];this['type']=_0x1cd5f8[_0x92f5('0x2')];this[_0x92f5('0x3')]=_0x1cd5f8['type']===_0x92f5('0x4')?_0x92f5('0x5'):_0x1cd5f8[_0x92f5('0x2')];this['countbusyretry']=_0x1cd5f8[_0x92f5('0x6')];this[_0x92f5('0x7')]=_0x1cd5f8[_0x92f5('0x7')];this[_0x92f5('0x8')]=_0x1cd5f8['countnoanswerretry'];this[_0x92f5('0x9')]=_0x1cd5f8[_0x92f5('0x6')]+_0x1cd5f8[_0x92f5('0x7')]+_0x1cd5f8[_0x92f5('0x8')]+_0x1cd5f8[_0x92f5('0xa')]+_0x1cd5f8[_0x92f5('0xb')]+_0x1cd5f8['countabandonedretry']+_0x1cd5f8[_0x92f5('0xc')]+_0x1cd5f8[_0x92f5('0xd')];this[_0x92f5('0xa')]=_0x1cd5f8['countnosuchnumberretry'];this[_0x92f5('0xb')]=_0x1cd5f8['countdropretry'];this[_0x92f5('0xe')]=_0x1cd5f8['countabandonedretry'];this['countmachineretry']=_0x1cd5f8[_0x92f5('0xc')];this[_0x92f5('0xd')]=_0x1cd5f8[_0x92f5('0xd')];this[_0x92f5('0xf')]=_0x4906cc['uniqueid'];this[_0x92f5('0x10')]=_0x1cd5f8['name'];this[_0x92f5('0x11')]=_0x1cd5f8[_0x92f5('0x12')];this[_0x92f5('0x13')]=_0x1cd5f8['starttime'];this['responsetime']=_0x1cd5f8[_0x92f5('0x14')];this[_0x92f5('0x15')]=_0x1cd5f8[_0x92f5('0x15')];this[_0x92f5('0x16')]=_0x1cd5f8[_0x92f5('0x16')];this['endtime']=this[_0x92f5('0x15')];this[_0x92f5('0x17')]=utils['getSeconds'](_0x1cd5f8['responsetime'],_0x1cd5f8[_0x92f5('0x13')]);this[_0x92f5('0x18')]=utils[_0x92f5('0x19')](this[_0x92f5('0x15')],_0x1cd5f8['responsetime']);this[_0x92f5('0x1a')]=0x0;this[_0x92f5('0x5')]=_0x4906cc[_0x92f5('0x5')];this[_0x92f5('0x1b')]=_0x4906cc[_0x92f5('0x1c')];this[_0x92f5('0x1d')]=_0x4906cc[_0x92f5('0x1d')];this[_0x92f5('0x1e')]=_0x1cd5f8[_0x92f5('0x1e')];this['callbackuniqueid']=_0x1cd5f8[_0x92f5('0x1f')];this[_0x92f5('0x20')]=_0x1cd5f8['callbackat'];this['recallme']=_0x1cd5f8[_0x92f5('0x21')];this['ContactId']=_0x1cd5f8['ContactId'];this[_0x92f5('0x22')]=_0x1cd5f8[_0x92f5('0x22')];this[_0x92f5('0x23')]=_0x1cd5f8[_0x92f5('0x23')];this[_0x92f5('0x24')]=_0x1cd5f8[_0x92f5('0x24')];this[_0x92f5('0x25')]=_0x1cd5f8[_0x92f5('0x25')];this[_0x92f5('0x26')]=_0x1cd5f8[_0x92f5('0x26')]||'';this[_0x92f5('0x27')]=_0x1cd5f8[_0x92f5('0x27')]||'';this['agiafterat']=_0x1cd5f8[_0x92f5('0x28')];this[_0x92f5('0x29')]=_0x1cd5f8[_0x92f5('0x29')];this['statedesc']=_0x1cd5f8[_0x92f5('0x2a')];}module[_0x92f5('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0xf8ff=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','dropreason','getSeconds','connectedlinename','reason','callback','callbackuniqueid','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','type','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x11d8ea,_0x38e25a){var _0x230c58=function(_0x546056){while(--_0x546056){_0x11d8ea['push'](_0x11d8ea['shift']());}};_0x230c58(++_0x38e25a);}(_0xf8ff,0x11a));var _0xff8f=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xf8ff[_0x1cfa0d];return _0xe33279;};'use strict';var utils=require(_0xff8f('0x0'));function QueueCallerAbandon(_0x5ab362,_0x35d0da){this['scheduledat']=_0x5ab362['scheduledat'];this[_0xff8f('0x1')]=_0x5ab362[_0xff8f('0x1')];this['campaigntype']=_0x5ab362[_0xff8f('0x1')]===_0xff8f('0x2')?_0xff8f('0x3'):_0x5ab362[_0xff8f('0x1')];this[_0xff8f('0x4')]=_0x5ab362['countbusyretry'];this[_0xff8f('0x5')]=_0x5ab362['countcongestionretry'];this['countnoanswerretry']=_0x5ab362[_0xff8f('0x6')];this[_0xff8f('0x7')]=_0x5ab362[_0xff8f('0x4')]+_0x5ab362[_0xff8f('0x5')]+_0x5ab362['countnoanswerretry']+_0x5ab362[_0xff8f('0x8')]+_0x5ab362[_0xff8f('0x9')]+_0x5ab362[_0xff8f('0xa')]+_0x5ab362[_0xff8f('0xb')]+_0x5ab362['countagentrejectretry'];this['countnosuchnumberretry']=_0x5ab362[_0xff8f('0x8')];this[_0xff8f('0x9')]=_0x5ab362[_0xff8f('0x9')];this[_0xff8f('0xa')]=_0x5ab362['countabandonedretry'];this[_0xff8f('0xb')]=_0x5ab362['countmachineretry'];this[_0xff8f('0xc')]=_0x5ab362['countagentrejectretry'];this[_0xff8f('0xd')]=_0x35d0da[_0xff8f('0xd')];this[_0xff8f('0xe')]=_0x5ab362[_0xff8f('0xf')];this[_0xff8f('0x10')]=_0x5ab362['number'];this[_0xff8f('0x11')]=_0x5ab362[_0xff8f('0x11')];this[_0xff8f('0x12')]=_0x5ab362[_0xff8f('0x12')];this[_0xff8f('0x13')]=_0x5ab362['droptime'];this[_0xff8f('0x14')]=_0x5ab362['dropreason'];this['endtime']=this['droptime'];this['ringtime']=utils[_0xff8f('0x15')](_0x5ab362[_0xff8f('0x12')],_0x5ab362[_0xff8f('0x11')]);this['holdtime']=utils[_0xff8f('0x15')](this[_0xff8f('0x13')],_0x5ab362['responsetime']);this['talktime']=0x0;this['queue']=_0x35d0da[_0xff8f('0x3')];this['membername']=_0x35d0da[_0xff8f('0x16')];this[_0xff8f('0x17')]=_0x35d0da[_0xff8f('0x17')];this[_0xff8f('0x18')]=_0x5ab362[_0xff8f('0x18')];this[_0xff8f('0x19')]=_0x5ab362[_0xff8f('0x19')];this['callbackat']=_0x5ab362['callbackat'];this['recallme']=_0x5ab362['recallme'];this[_0xff8f('0x1a')]=_0x5ab362['ContactId'];this[_0xff8f('0x1b')]=_0x5ab362[_0xff8f('0x1b')];this[_0xff8f('0x1c')]=_0x5ab362[_0xff8f('0x1c')];this['VoiceQueueId']=_0x5ab362['VoiceQueueId'];this[_0xff8f('0x1d')]=_0x5ab362[_0xff8f('0x1d')];this[_0xff8f('0x1e')]=_0x5ab362['originatecalleridnum']||'';this[_0xff8f('0x1f')]=_0x5ab362['originatecalleridname']||'';this['agiafterat']=_0x5ab362[_0xff8f('0x20')];this['state']=_0x5ab362[_0xff8f('0x21')];this[_0xff8f('0x22')]=_0x5ab362[_0xff8f('0x22')];}module[_0xff8f('0x23')]=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 45fe84b..106f3d6 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 _0x6d11=['checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d11,0xbf));var _0x16d1=function(_0x52d4ee,_0x64e207){_0x52d4ee=_0x52d4ee-0x0;var _0x51d053=_0x6d11[_0x52d4ee];return _0x51d053;};'use strict';var util=require(_0x16d1('0x0'));var logger=require(_0x16d1('0x1'))(_0x16d1('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x16d1('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x16d1('0x4'));function inspectError(_0x2e1a35){return util['inspect'](_0x2e1a35,{'showHidden':![],'depth':null});}function getContactDialer(_0x48754e,_0x3e0e86,_0x46f7d7){return cmHopper[_0x16d1('0x5')](_0x48754e['id'],_0x3e0e86,_0x46f7d7,_0x48754e[_0x16d1('0x6')])[_0x16d1('0x7')](function(_0x150217){_0x48754e[_0x16d1('0x8')]=0x0;logger['error']('[getContactDialer]',inspectError(_0x150217));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x3275c8,_0xcfbb15){return cmHopper[_0x16d1('0x9')](_0x3275c8['id'],_0xcfbb15,_0x3275c8[_0x16d1('0x6')])['catch'](function(_0x265a84){_0x3275c8[_0x16d1('0x8')]=0x0;logger[_0x16d1('0xa')](_0x16d1('0xb'),inspectError(_0x265a84));});}exports[_0x16d1('0x9')]=getContactDialerIvr;function countReScheduled(_0x20edf8){return cmHopper[_0x16d1('0xc')](_0x20edf8)[_0x16d1('0x7')](function(_0x4de260){logger[_0x16d1('0xa')](_0x16d1('0xd'),inspectError(_0x4de260));});}exports[_0x16d1('0xc')]=countReScheduled;function rescheduleContact(_0x32351b){return cmHopper[_0x16d1('0xe')](_0x32351b)['catch'](function(_0xc034b7){logger[_0x16d1('0xa')](_0x16d1('0xf'),inspectError(_0xc034b7));});}exports[_0x16d1('0xe')]=rescheduleContact;function unlockContact(_0x29ebba,_0x173e16,_0x2d7e8a){return cmHopper['unlockContact'](_0x29ebba,_0x173e16,_0x2d7e8a)[_0x16d1('0x7')](function(_0x2b399c){logger['error']('[unlockContact]',inspectError(_0x2b399c));});}exports[_0x16d1('0x10')]=unlockContact;function moveContactManagedDialer(_0x47c245){return cmHopper[_0x16d1('0x11')](_0x47c245)['catch'](function(_0x1da1b8){logger['error'](_0x16d1('0x12'),inspectError(_0x1da1b8));});}exports[_0x16d1('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x48cd70){return cmHopperBlack['checkIsBlackList'](_0x48cd70)['catch'](function(_0x5b9599){logger[_0x16d1('0xa')]('[checkIsBlackList]',inspectError(_0x5b9599));});}exports[_0x16d1('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x7887d5){return cmHopperBlack[_0x16d1('0x14')](_0x7887d5)[_0x16d1('0x7')](function(_0x54b3a6){logger[_0x16d1('0xa')](_0x16d1('0x15'),inspectError(_0x54b3a6));});}exports[_0x16d1('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x585ce5,_0x3fc99e,_0x8c7266){return cmHopperAdditionalPhone[_0x16d1('0x16')](_0x585ce5,_0x3fc99e,_0x8c7266)[_0x16d1('0x7')](function(_0x215c23){logger[_0x16d1('0xa')](_0x16d1('0x17'),inspectError(_0x215c23));});}exports[_0x16d1('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x3f8436,_0x335c24,_0x4b2b5c){return cmHopperAdditionalPhone[_0x16d1('0x18')](_0x3f8436,_0x335c24,_0x4b2b5c)[_0x16d1('0x7')](function(_0x262f89){logger[_0x16d1('0xa')](_0x16d1('0x19'),inspectError(_0x262f89));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x25ae4e){return cmHopperHistory[_0x16d1('0x1a')](_0x25ae4e)[_0x16d1('0x7')](function(_0x49fc1b){logger[_0x16d1('0xa')](_0x16d1('0x1b'),inspectError(_0x49fc1b));});}exports[_0x16d1('0x1a')]=avgHandleTime;function createHistory(_0x22e5b3){return cmHopperHistory[_0x16d1('0x1c')](_0x22e5b3)[_0x16d1('0x7')](function(_0x1dd574){logger['error'](_0x16d1('0x1d'),inspectError(_0x1dd574));});}exports[_0x16d1('0x1c')]=createHistory; \ No newline at end of file +var _0xffd6=['[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','catch','temp','error','[getContactDialer]','dialOrderByScheduledAt'];(function(_0x1a5076,_0x31b7fc){var _0xedba48=function(_0x57ccf2){while(--_0x57ccf2){_0x1a5076['push'](_0x1a5076['shift']());}};_0xedba48(++_0x31b7fc);}(_0xffd6,0x97));var _0x6ffd=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0xffd6[_0x52085a];return _0x5afc1a;};'use strict';var util=require(_0x6ffd('0x0'));var logger=require(_0x6ffd('0x1'))(_0x6ffd('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x6ffd('0x3'));var cmHopperHistory=require(_0x6ffd('0x4'));function inspectError(_0x39fd49){return util['inspect'](_0x39fd49,{'showHidden':![],'depth':null});}function getContactDialer(_0x1d12e3,_0x173979,_0x3b8a46){return cmHopper[_0x6ffd('0x5')](_0x1d12e3['id'],_0x173979,_0x3b8a46,_0x1d12e3['dialOrderByScheduledAt'])[_0x6ffd('0x6')](function(_0xeefe34){_0x1d12e3[_0x6ffd('0x7')]=0x0;logger[_0x6ffd('0x8')](_0x6ffd('0x9'),inspectError(_0xeefe34));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x455dda,_0x417f34){return cmHopper['getContactDialerIvr'](_0x455dda['id'],_0x417f34,_0x455dda[_0x6ffd('0xa')])[_0x6ffd('0x6')](function(_0x23f7f2){_0x455dda[_0x6ffd('0x7')]=0x0;logger[_0x6ffd('0x8')](_0x6ffd('0xb'),inspectError(_0x23f7f2));});}exports[_0x6ffd('0xc')]=getContactDialerIvr;function countReScheduled(_0x5892e1){return cmHopper[_0x6ffd('0xd')](_0x5892e1)[_0x6ffd('0x6')](function(_0x5e8d6d){logger[_0x6ffd('0x8')](_0x6ffd('0xe'),inspectError(_0x5e8d6d));});}exports[_0x6ffd('0xd')]=countReScheduled;function rescheduleContact(_0x1a00d9){return cmHopper['rescheduleContact'](_0x1a00d9)[_0x6ffd('0x6')](function(_0x594cb3){logger[_0x6ffd('0x8')]('[rescheduleContact]',inspectError(_0x594cb3));});}exports[_0x6ffd('0xf')]=rescheduleContact;function unlockContact(_0x261ed7,_0x45db49,_0x5d8aff){return cmHopper[_0x6ffd('0x10')](_0x261ed7,_0x45db49,_0x5d8aff)[_0x6ffd('0x6')](function(_0x350c94){logger[_0x6ffd('0x8')](_0x6ffd('0x11'),inspectError(_0x350c94));});}exports[_0x6ffd('0x10')]=unlockContact;function moveContactManagedDialer(_0x3f38e7){return cmHopper[_0x6ffd('0x12')](_0x3f38e7)['catch'](function(_0x11a609){logger['error']('[moveContactManagedDialer]',inspectError(_0x11a609));});}exports[_0x6ffd('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x359d09){return cmHopperBlack['checkIsBlackList'](_0x359d09)[_0x6ffd('0x6')](function(_0x4612a3){logger['error']('[checkIsBlackList]',inspectError(_0x4612a3));});}exports[_0x6ffd('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x1c9d19){return cmHopperBlack['checkIsBlackListIvr'](_0x1c9d19)[_0x6ffd('0x6')](function(_0x39f25c){logger[_0x6ffd('0x8')]('[checkIsBlackListIvr]',inspectError(_0x39f25c));});}exports[_0x6ffd('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2efeb5,_0x50896b,_0x356c9c){return cmHopperAdditionalPhone[_0x6ffd('0x15')](_0x2efeb5,_0x50896b,_0x356c9c)['catch'](function(_0x31fb22){logger[_0x6ffd('0x8')](_0x6ffd('0x16'),inspectError(_0x31fb22));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x46631e,_0x3e5726,_0x46b03f){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x46631e,_0x3e5726,_0x46b03f)[_0x6ffd('0x6')](function(_0x5a55e2){logger[_0x6ffd('0x8')](_0x6ffd('0x17'),inspectError(_0x5a55e2));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x520258){return cmHopperHistory[_0x6ffd('0x18')](_0x520258)[_0x6ffd('0x6')](function(_0x1934d4){logger['error']('[avgHandleTime]',inspectError(_0x1934d4));});}exports[_0x6ffd('0x18')]=avgHandleTime;function createHistory(_0x48feb4){return cmHopperHistory[_0x6ffd('0x19')](_0x48feb4)[_0x6ffd('0x6')](function(_0x51fdb6){logger[_0x6ffd('0x8')](_0x6ffd('0x1a'),inspectError(_0x51fdb6));});}exports[_0x6ffd('0x19')]=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 bc6a924..a215988 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 _0x3bd8=['name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','TrunkBackup','status','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','checkContactEmpty','checkContactLowerLimitOriginate','createdAt','tags','undefined','description','length','toUpperCase','substring','XMD-','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','BLACKLIST','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk'];(function(_0x55df6c,_0x3a6851){var _0x7c9e7e=function(_0xb1e15f){while(--_0xb1e15f){_0x55df6c['push'](_0x55df6c['shift']());}};_0x7c9e7e(++_0x3a6851);}(_0x3bd8,0xd4));var _0x83bd=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0x3bd8[_0x299784];return _0x5ab008;};'use strict';var _=require(_0x83bd('0x0'));var moment=require(_0x83bd('0x1'));var util=require(_0x83bd('0x2'));var logger=require(_0x83bd('0x3'))('dialer');var timezones=require(_0x83bd('0x4'))[_0x83bd('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x83bd('0x6'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x83bd('0x7'),'DISACTIVED':_0x83bd('0x8'),'EMPTY_INTERVAL':_0x83bd('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0x83bd('0xa'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x83bd('0xb'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x83bd('0xc'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x83bd('0xd'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x83bd('0xe')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1461b6){return _0x1461b6[_0x83bd('0xf')]===_0x83bd('0x10');}exports[_0x83bd('0x11')]=isPreviewCampaign;function isIVRCampaign(_0xbd1819){return _0xbd1819[_0x83bd('0x12')]==='ivr';}exports[_0x83bd('0x13')]=isIVRCampaign;function isOutboundQueue(_0x5d865a){return _0x5d865a[_0x83bd('0x12')]===_0x83bd('0x14');}exports[_0x83bd('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x5a382a){return _0x5a382a[_0x83bd('0x16')];}exports[_0x83bd('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5b375f){return _0x5b375f[_0x83bd('0x18')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x220885,_0x515ca4){var _0x59bfce=moment(_0x220885)[_0x83bd('0x19')](0x0);var _0x32ea33=moment(_0x515ca4)[_0x83bd('0x19')](0x0);return _0x59bfce[_0x83bd('0x1a')](_0x32ea33,_0x83bd('0x1b'));}exports[_0x83bd('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0x51c785,_0x119bf2){var _0x112df7=![];var _0x43369b=_0x51c785[_0x83bd('0xf')]!==_0x119bf2[_0x83bd('0xf')]||_0x51c785[_0x83bd('0x16')]!==_0x119bf2['dialActive']||_0x51c785[_0x83bd('0x1d')]!==_0x119bf2['message'];var _0x4a1455=_0x51c785['available']!==_0x119bf2[_0x83bd('0x1e')]||_0x51c785[_0x83bd('0x1f')]!==_0x119bf2['loggedIn']||_0x51c785['loggedInDb']!==_0x119bf2[_0x83bd('0x20')]||_0x51c785[_0x83bd('0x21')]!==_0x119bf2[_0x83bd('0x21')]||_0x51c785['talking']!==_0x119bf2[_0x83bd('0x22')]||_0x51c785[_0x83bd('0x23')]!==_0x119bf2[_0x83bd('0x23')]||_0x51c785[_0x83bd('0x24')]!==_0x119bf2[_0x83bd('0x24')]||_0x51c785[_0x83bd('0x25')]!==_0x119bf2[_0x83bd('0x25')]||_0x51c785[_0x83bd('0x26')]!==_0x119bf2['originated'];if(_0x51c785['Trunk']&&_0x119bf2[_0x83bd('0x27')]){_0x112df7=_0x51c785['Trunk'][_0x83bd('0x28')]!==_0x119bf2[_0x83bd('0x27')][_0x83bd('0x28')]||_0x51c785[_0x83bd('0x27')][_0x83bd('0x18')]!==_0x119bf2[_0x83bd('0x27')][_0x83bd('0x18')];}return _0x43369b||_0x4a1455||_0x112df7;}exports[_0x83bd('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x16575f){var _0x19d893=null;var _0x33a4fc=_0x16575f['dialTimezone'];if(_[_0x83bd('0x2a')](_0x16575f[_0x83bd('0x2b')])||_[_0x83bd('0x2a')](_0x16575f[_0x83bd('0x2c')])||_['isNil'](_0x16575f[_0x83bd('0x2c')][_0x83bd('0x2d')])){_0x19d893=CAMPAIGN_STATUS[_0x83bd('0x2e')];}else if(_['isEmpty'](_0x16575f[_0x83bd('0x2b')])||_[_0x83bd('0x2f')](_0x16575f[_0x83bd('0x2c')][_0x83bd('0x2d')])){_0x19d893=CAMPAIGN_STATUS[_0x83bd('0x30')];}else if(_0x33a4fc&&!timezones[_0x33a4fc]){_0x19d893=CAMPAIGN_STATUS[_0x83bd('0x31')];}return _0x19d893;}function checkAnyValidTrunk(_0x37a595,_0x4d708a){var _0x17c52=null;var _0x7481f3=_0x83bd('0x32');var _0x589c9a=[_0x83bd('0x33'),_0x83bd('0x34')];var _0x1380ae=!![];if(_0x37a595['Trunk']&&_0x37a595[_0x83bd('0x27')]['active']){_0x7481f3+=_0x37a595[_0x83bd('0x27')][_0x83bd('0x28')];_0x17c52=_0x4d708a[_0x7481f3];_0x1380ae=_0x589c9a[_0x83bd('0x35')](_0x17c52['status']);}else if(_0x37a595[_0x83bd('0x36')]&&_0x37a595[_0x83bd('0x36')]['active']){_0x7481f3+=_0x37a595[_0x83bd('0x36')][_0x83bd('0x28')];_0x17c52=_0x4d708a[_0x7481f3];_0x1380ae=_0x589c9a[_0x83bd('0x35')](_0x17c52[_0x83bd('0x37')]);}return _0x1380ae;}function getQueueCampaignStatusMessage(_0x14f858,_0x2deb12){var _0x21b4b6=CAMPAIGN_STATUS['ACTIVE'];var _0x4978e7=isPreviewCampaign(_0x14f858);if(!isQueueCampaignActive(_0x14f858)){if(_0x4978e7){_0x21b4b6=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x14f858[_0x83bd('0x26')]===0x0&&_0x14f858['talking']===0x0&&_0x14f858[_0x83bd('0x24')]===0x0&&(_0x14f858[_0x83bd('0x23')]||0x0)===0x0){_0x21b4b6=CAMPAIGN_STATUS[_0x83bd('0x38')];}else{_0x21b4b6=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x14f858[_0x83bd('0x1f')]===0x0){_0x21b4b6=CAMPAIGN_STATUS[_0x83bd('0x39')];}else if(!checkAnyValidTrunk(_0x14f858,_0x2deb12)){_0x21b4b6=CAMPAIGN_STATUS[_0x83bd('0x3a')];}else if(!isPreviewCampaign(_0x14f858)){var _0x135384=checkAnyValidQueueCampaignInterval(_0x14f858);if(_0x135384){_0x21b4b6=_0x135384;}}return _0x21b4b6;}exports[_0x83bd('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x22b304){var _0x16495b=CAMPAIGN_STATUS[_0x83bd('0x3c')];if(_0x22b304[_0x83bd('0x26')]===0x0&&_0x22b304[_0x83bd('0x22')]===0x0&&_0x22b304[_0x83bd('0x24')]===0x0&&(_0x22b304[_0x83bd('0x23')]||0x0)===0x0){_0x16495b=CAMPAIGN_STATUS[_0x83bd('0x38')];}return _0x16495b;}exports[_0x83bd('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x6e3908){var _0x15670b=_0x6e3908['match'](/"(.*?)"/);return _0x15670b?_0x15670b[0x1]:_0x6e3908;}exports[_0x83bd('0x3e')]=extractCalleridName;function getCallerId(_0x42b4d1,_0x12fe91,_0x8a8ef8){if(!_[_0x83bd('0x3f')](_0x8a8ef8)&&typeof _0x8a8ef8==='string'&&!_[_0x83bd('0x2f')](_0x8a8ef8)){if(!_[_0x83bd('0x3f')](_0x12fe91)&&typeof _0x12fe91===_0x83bd('0x40')&&!_['isEmpty'](_0x12fe91)){return util[_0x83bd('0x41')](_0x83bd('0x42'),_0x12fe91,_0x8a8ef8);}return util[_0x83bd('0x41')](_0x83bd('0x42'),_0x8a8ef8,_0x8a8ef8);}if(!_[_0x83bd('0x3f')](_0x42b4d1)&&typeof _0x42b4d1===_0x83bd('0x40')&&!_[_0x83bd('0x2f')](_0x42b4d1)){return _0x42b4d1;}return'\x22\x22\x20<>';}exports[_0x83bd('0x43')]=getCallerId;function getCallerIdRandom(_0x19b148,_0x32da19){var _0x3582ac;var _0x3e3d3f;var _0x23cf98;if(_0x32da19<=0x0){_0x32da19=0x1;}_0x3582ac=new RegExp(_0x83bd('0x44')+_0x32da19+'}$');_0x3e3d3f=Math['pow'](0xa,_0x32da19-0x1);_0x23cf98=Math[_0x83bd('0x45')](0xa,_0x32da19)-0x1;return util[_0x83bd('0x41')]('%s',_['replace'](_0x19b148,_0x3582ac,_[_0x83bd('0x46')](_0x3e3d3f,_0x23cf98)[_0x83bd('0x47')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x4c41fd){if(_0x4c41fd[_0x83bd('0x26')]&&_0x4c41fd[_0x83bd('0x26')]>0x0){_0x4c41fd[_0x83bd('0x26')]-=0x1;}else{logger[_0x83bd('0x48')](_0x83bd('0x49'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x5d7320){return _0x5d7320&&_0x5d7320['length']>0x0;}exports[_0x83bd('0x4a')]=checkContactEmpty;function erlangb(_0x21c828,_0x445d42){if(_0x445d42===0x0){return 0x0;}var _0x12b693=0x1;for(var _0x3ca8f0=0x1;_0x3ca8f0<=_0x445d42;_0x3ca8f0+=0x1){_0x12b693=0x1+_0x12b693*_0x3ca8f0/_0x21c828;}return 0x1/_0x12b693;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x33f67a,_0x429535,_0x291312){if(_0x429535>_0x291312){for(var _0x441bc2=0x0;_0x441bc2<_0x429535-_0x291312;_0x441bc2+=0x1){decrementOriginate(_0x33f67a);}}}exports[_0x83bd('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x117d59){var _0x6fa015={};var _0x274a52=['id',_0x83bd('0x4c'),_0x83bd('0x4d'),'updatedAt'];const _0x1cf17e=0xfa;if(_0x117d59){for(var _0x14ed63 in _0x117d59){if(typeof _0x117d59[_0x14ed63]!==_0x83bd('0x4e')){if(!_[_0x83bd('0x2a')](_0x117d59[_0x14ed63])&&!_0x274a52[_0x83bd('0x35')](_0x14ed63)){if(_0x14ed63===_0x83bd('0x4f')&&_0x117d59[_0x14ed63][_0x83bd('0x50')]>_0x1cf17e){_0x6fa015['XMD-'+_0x14ed63[_0x83bd('0x51')]()]=_0x117d59[_0x14ed63][_0x83bd('0x47')]()[_0x83bd('0x52')](0x0,_0x1cf17e);}else{_0x6fa015[_0x83bd('0x53')+_0x14ed63[_0x83bd('0x51')]()]=_0x117d59[_0x14ed63];}}}}}return _0x6fa015;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x5c0c=['RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','unmonitored','status','TrunkBackup','includes','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','pow','format','replace','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','checkContactLowerLimitOriginate','tags','description','toUpperCase','lodash','moment','dialer','../../../../config/environment/shared'];(function(_0x5c6f24,_0x4ac04c){var _0xda5cef=function(_0xa06c1f){while(--_0xa06c1f){_0x5c6f24['push'](_0x5c6f24['shift']());}};_0xda5cef(++_0x4ac04c);}(_0x5c0c,0x124));var _0xc5c0=function(_0x98e9a9,_0x5de789){_0x98e9a9=_0x98e9a9-0x0;var _0x41ea42=_0x5c0c[_0x98e9a9];return _0x41ea42;};'use strict';var _=require(_0xc5c0('0x0'));var moment=require(_0xc5c0('0x1'));var util=require('util');var logger=require('../../../../config/logger')(_0xc5c0('0x2'));var timezones=require(_0xc5c0('0x3'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xc5c0('0x4'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xc5c0('0x5'),'EMPTY_INTERVAL':_0xc5c0('0x6'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xc5c0('0x7'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xc5c0('0x8'),'QUEUE_RECALL':_0xc5c0('0x9'),'RECALL_TIMEOUT':_0xc5c0('0xa'),'RUNNING':_0xc5c0('0xb'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xc5c0('0xc')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5ee6a8){return _0x5ee6a8['dialMethod']===_0xc5c0('0xd');}exports[_0xc5c0('0xe')]=isPreviewCampaign;function isIVRCampaign(_0x4710a0){return _0x4710a0[_0xc5c0('0xf')]===_0xc5c0('0x10');}exports[_0xc5c0('0x11')]=isIVRCampaign;function isOutboundQueue(_0x21b435){return _0x21b435[_0xc5c0('0xf')]===_0xc5c0('0x12');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x5e81d8){return _0x5e81d8[_0xc5c0('0x13')];}exports[_0xc5c0('0x14')]=isQueueCampaignActive;function isIVRCampaignActive(_0x46f52e){return _0x46f52e[_0xc5c0('0x15')];}exports[_0xc5c0('0x16')]=isIVRCampaignActive;function getSeconds(_0x1cd726,_0x1cc30c){var _0x37314c=moment(_0x1cd726)['milliseconds'](0x0);var _0x186018=moment(_0x1cc30c)[_0xc5c0('0x17')](0x0);return _0x37314c['diff'](_0x186018,_0xc5c0('0x18'));}exports[_0xc5c0('0x19')]=getSeconds;function hasQueueCampaignDataChanged(_0x574d13,_0x365c91){var _0x45beba=![];var _0x2061de=_0x574d13[_0xc5c0('0x1a')]!==_0x365c91['dialMethod']||_0x574d13['dialActive']!==_0x365c91['dialActive']||_0x574d13[_0xc5c0('0x1b')]!==_0x365c91[_0xc5c0('0x1b')];var _0x319458=_0x574d13[_0xc5c0('0x1c')]!==_0x365c91[_0xc5c0('0x1c')]||_0x574d13[_0xc5c0('0x1d')]!==_0x365c91[_0xc5c0('0x1d')]||_0x574d13[_0xc5c0('0x1e')]!==_0x365c91[_0xc5c0('0x1e')]||_0x574d13['paused']!==_0x365c91[_0xc5c0('0x1f')]||_0x574d13['talking']!==_0x365c91[_0xc5c0('0x20')]||_0x574d13['pTalking']!==_0x365c91[_0xc5c0('0x21')]||_0x574d13[_0xc5c0('0x22')]!==_0x365c91[_0xc5c0('0x22')]||_0x574d13[_0xc5c0('0x23')]!==_0x365c91[_0xc5c0('0x23')]||_0x574d13[_0xc5c0('0x24')]!==_0x365c91[_0xc5c0('0x24')];if(_0x574d13[_0xc5c0('0x25')]&&_0x365c91[_0xc5c0('0x25')]){_0x45beba=_0x574d13[_0xc5c0('0x25')][_0xc5c0('0x26')]!==_0x365c91[_0xc5c0('0x25')][_0xc5c0('0x26')]||_0x574d13['Trunk']['active']!==_0x365c91[_0xc5c0('0x25')]['active'];}return _0x2061de||_0x319458||_0x45beba;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x41c196){var _0x2b598a=null;var _0x19b8b6=_0x41c196[_0xc5c0('0x27')];if(_[_0xc5c0('0x28')](_0x41c196[_0xc5c0('0x29')])||_['isNil'](_0x41c196[_0xc5c0('0x2a')])||_['isNil'](_0x41c196[_0xc5c0('0x2a')][_0xc5c0('0x2b')])){_0x2b598a=CAMPAIGN_STATUS[_0xc5c0('0x2c')];}else if(_[_0xc5c0('0x2d')](_0x41c196[_0xc5c0('0x29')])||_[_0xc5c0('0x2d')](_0x41c196[_0xc5c0('0x2a')][_0xc5c0('0x2b')])){_0x2b598a=CAMPAIGN_STATUS[_0xc5c0('0x2e')];}else if(_0x19b8b6&&!timezones[_0x19b8b6]){_0x2b598a=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x2b598a;}function checkAnyValidTrunk(_0x132f12,_0x107811){var _0x9855b4=null;var _0x3750d4='SIP/';var _0x23e328=['reachable',_0xc5c0('0x2f')];var _0x32d996=!![];if(_0x132f12[_0xc5c0('0x25')]&&_0x132f12[_0xc5c0('0x25')][_0xc5c0('0x15')]){_0x3750d4+=_0x132f12[_0xc5c0('0x25')][_0xc5c0('0x26')];_0x9855b4=_0x107811[_0x3750d4];_0x32d996=_0x23e328['includes'](_0x9855b4[_0xc5c0('0x30')]);}else if(_0x132f12[_0xc5c0('0x31')]&&_0x132f12[_0xc5c0('0x31')]['active']){_0x3750d4+=_0x132f12[_0xc5c0('0x31')][_0xc5c0('0x26')];_0x9855b4=_0x107811[_0x3750d4];_0x32d996=_0x23e328[_0xc5c0('0x32')](_0x9855b4[_0xc5c0('0x30')]);}return _0x32d996;}function getQueueCampaignStatusMessage(_0x136543,_0xc7bd6){var _0x404b3e=CAMPAIGN_STATUS['ACTIVE'];var _0x1e9a1a=isPreviewCampaign(_0x136543);if(!isQueueCampaignActive(_0x136543)){if(_0x1e9a1a){_0x404b3e=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x136543[_0xc5c0('0x24')]===0x0&&_0x136543[_0xc5c0('0x20')]===0x0&&_0x136543[_0xc5c0('0x22')]===0x0&&(_0x136543['pTalking']||0x0)===0x0){_0x404b3e=CAMPAIGN_STATUS['INACTIVE'];}else{_0x404b3e=CAMPAIGN_STATUS[_0xc5c0('0x33')];}}}else if(_0x136543['loggedIn']===0x0){_0x404b3e=CAMPAIGN_STATUS[_0xc5c0('0x34')];}else if(!checkAnyValidTrunk(_0x136543,_0xc7bd6)){_0x404b3e=CAMPAIGN_STATUS[_0xc5c0('0x35')];}else if(!isPreviewCampaign(_0x136543)){var _0x42f0aa=checkAnyValidQueueCampaignInterval(_0x136543);if(_0x42f0aa){_0x404b3e=_0x42f0aa;}}return _0x404b3e;}exports[_0xc5c0('0x36')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1ac69f){var _0x445b69=CAMPAIGN_STATUS['DISACTIVED'];if(_0x1ac69f['originated']===0x0&&_0x1ac69f[_0xc5c0('0x20')]===0x0&&_0x1ac69f[_0xc5c0('0x22')]===0x0&&(_0x1ac69f[_0xc5c0('0x21')]||0x0)===0x0){_0x445b69=CAMPAIGN_STATUS['INACTIVE'];}return _0x445b69;}exports[_0xc5c0('0x37')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x342dec){var _0x2d5d05=_0x342dec[_0xc5c0('0x38')](/"(.*?)"/);return _0x2d5d05?_0x2d5d05[0x1]:_0x342dec;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x5685e3,_0x39c4ad,_0x4517b5){if(!_[_0xc5c0('0x39')](_0x4517b5)&&typeof _0x4517b5===_0xc5c0('0x3a')&&!_[_0xc5c0('0x2d')](_0x4517b5)){if(!_[_0xc5c0('0x39')](_0x39c4ad)&&typeof _0x39c4ad===_0xc5c0('0x3a')&&!_[_0xc5c0('0x2d')](_0x39c4ad)){return util['format']('\x22%s\x22\x20<%s>',_0x39c4ad,_0x4517b5);}return util['format'](_0xc5c0('0x3b'),_0x4517b5,_0x4517b5);}if(!_[_0xc5c0('0x39')](_0x5685e3)&&typeof _0x5685e3==='string'&&!_['isEmpty'](_0x5685e3)){return _0x5685e3;}return _0xc5c0('0x3c');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x2b9e58,_0x26ac2b){var _0x308ddb;var _0x297602;var _0x51d369;if(_0x26ac2b<=0x0){_0x26ac2b=0x1;}_0x308ddb=new RegExp('\x5cw{0,'+_0x26ac2b+'}$');_0x297602=Math[_0xc5c0('0x3d')](0xa,_0x26ac2b-0x1);_0x51d369=Math[_0xc5c0('0x3d')](0xa,_0x26ac2b)-0x1;return util[_0xc5c0('0x3e')]('%s',_[_0xc5c0('0x3f')](_0x2b9e58,_0x308ddb,_[_0xc5c0('0x40')](_0x297602,_0x51d369)[_0xc5c0('0x41')]()));}exports[_0xc5c0('0x42')]=getCallerIdRandom;function decrementOriginate(_0x5da3b5){if(_0x5da3b5[_0xc5c0('0x24')]&&_0x5da3b5[_0xc5c0('0x24')]>0x0){_0x5da3b5['originated']-=0x1;}else{logger['error'](_0xc5c0('0x43'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x26bdb3){return _0x26bdb3&&_0x26bdb3[_0xc5c0('0x44')]>0x0;}exports[_0xc5c0('0x45')]=checkContactEmpty;function erlangb(_0x163d55,_0x4bdbc3){if(_0x4bdbc3===0x0){return 0x0;}var _0x17a71d=0x1;for(var _0x269225=0x1;_0x269225<=_0x4bdbc3;_0x269225+=0x1){_0x17a71d=0x1+_0x17a71d*_0x269225/_0x163d55;}return 0x1/_0x17a71d;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x50c9c9,_0x3f4b00,_0x7c0b00){if(_0x3f4b00>_0x7c0b00){for(var _0x40697f=0x0;_0x40697f<_0x3f4b00-_0x7c0b00;_0x40697f+=0x1){decrementOriginate(_0x50c9c9);}}}exports[_0xc5c0('0x46')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0xb8abd5){var _0x5ab853={};var _0x14c64f=['id','createdAt',_0xc5c0('0x47'),'updatedAt'];const _0x245122=0xfa;if(_0xb8abd5){for(var _0x288830 in _0xb8abd5){if(typeof _0xb8abd5[_0x288830]!=='undefined'){if(!_['isNil'](_0xb8abd5[_0x288830])&&!_0x14c64f[_0xc5c0('0x32')](_0x288830)){if(_0x288830===_0xc5c0('0x48')&&_0xb8abd5[_0x288830][_0xc5c0('0x44')]>_0x245122){_0x5ab853['XMD-'+_0x288830[_0xc5c0('0x49')]()]=_0xb8abd5[_0x288830][_0xc5c0('0x41')]()['substring'](0x0,_0x245122);}else{_0x5ab853['XMD-'+_0x288830[_0xc5c0('0x49')]()]=_0xb8abd5[_0x288830];}}}}}return _0x5ab853;}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 31d9a52..bfe0170 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(_0x13aa55,_0x5d6228){var _0x47d9fd=function(_0x2e7cc0){while(--_0x2e7cc0){_0x13aa55['push'](_0x13aa55['shift']());}};_0x47d9fd(++_0x5d6228);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x519d0b,_0x11c94d){var _0x3c74a7=function(_0x237c7c){while(--_0x237c7c){_0x519d0b['push'](_0x519d0b['shift']());}};_0x3c74a7(++_0x11c94d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 aba759e..ef4cdda 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 _0x2a84=['status','filename','\x20syncFaxStatus\x20','syncReceiveFax','pagestransferred','resolution','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isNil','active','SIP/%s','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','uuid','path','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a84,0x194));var _0x42a8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2a84[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x42a8('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x42a8('0x1'));var moment=require('moment');var path=require(_0x42a8('0x2'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x42a8('0x3'))(_0x42a8('0x4'));var ami=require(_0x42a8('0x5'));var rpcDb=require(_0x42a8('0x6'));var Channel=require(_0x42a8('0x7'));var ut=require(_0x42a8('0x8'));var Action=require(_0x42a8('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x42a8('0xa'));var faxMessage=require(_0x42a8('0xb'));function Fax(_0x1b0dca){this[_0x42a8('0xc')]={};this[_0x42a8('0xd')]=_0x1b0dca[_0x42a8('0xd')];this['trunks']=_0x1b0dca[_0x42a8('0xe')];this[_0x42a8('0xf')]={};ami['on'](_0x42a8('0x10'),this[_0x42a8('0x11')][_0x42a8('0x12')](this));ami['on'](_0x42a8('0x13'),this['syncVarSet']['bind'](this));ami['on'](_0x42a8('0x14'),this['syncNewState'][_0x42a8('0x12')](this));ami['on'](_0x42a8('0x15'),this[_0x42a8('0x16')][_0x42a8('0x12')](this));ami['on'](_0x42a8('0x17'),this[_0x42a8('0x18')][_0x42a8('0x12')](this));ami['on'](_0x42a8('0x19'),this['syncReceiveFax'][_0x42a8('0x12')](this));ami['on']('hangup',this[_0x42a8('0x1a')]['bind'](this));ami['on']('originateresponse',this[_0x42a8('0x1b')]['bind'](this));}Fax[_0x42a8('0x1c')][_0x42a8('0x11')]=function(_0x583738){if(_0x583738[_0x42a8('0x1d')]===_0x42a8('0x1e')){for(var _0xda70ab in this[_0x42a8('0xd')]){if(this[_0x42a8('0xd')][_0x42a8('0x1f')](_0xda70ab)){if(_0x583738['exten']===this[_0x42a8('0xd')][_0xda70ab][_0x42a8('0x20')]){this[_0x42a8('0xc')][_0x583738[_0x42a8('0x21')]]={};this[_0x42a8('0xc')][_0x583738['uniqueid']][_0x42a8('0x22')]=_0x583738[_0x42a8('0x22')];this[_0x42a8('0xc')][_0x583738[_0x42a8('0x21')]]['id']=this[_0x42a8('0xd')][_0xda70ab]['id'];this[_0x42a8('0xc')][_0x583738[_0x42a8('0x21')]][_0x42a8('0x23')]=this[_0x42a8('0xd')][_0xda70ab][_0x42a8('0x23')];logger[_0x42a8('0x24')](_0x583738[_0x42a8('0x21')],'\x20syncNewchannel\x20');}}}}if(this[_0x42a8('0xf')][_0x583738['uniqueid']]){this[_0x42a8('0xc')][_0x583738['uniqueid']]={};this[_0x42a8('0xc')][_0x583738[_0x42a8('0x21')]]['channel']=_0x583738[_0x42a8('0x22')];logger[_0x42a8('0x24')](_0x583738[_0x42a8('0x21')],_0x42a8('0x25'));}};Fax[_0x42a8('0x1c')]['syncVarSet']=function(_0x3f25df){if(this[_0x42a8('0xc')][_0x3f25df[_0x42a8('0x21')]]){for(var _0x33380b in _0x3f25df[_0x42a8('0x26')]){if(_0x3f25df['variable'][_0x42a8('0x1f')](_0x33380b)){this['channels'][_0x3f25df[_0x42a8('0x21')]][_0x33380b]=_0x3f25df[_0x42a8('0x27')];}}}};Fax[_0x42a8('0x1c')][_0x42a8('0x28')]=function(_0xed09a5){if(this[_0x42a8('0xc')][_0xed09a5[_0x42a8('0x21')]]){this['channels'][_0xed09a5['uniqueid']]['channelstate']=_0xed09a5[_0x42a8('0x29')];this[_0x42a8('0xc')][_0xed09a5[_0x42a8('0x21')]][_0x42a8('0x2a')]=_0xed09a5[_0x42a8('0x2a')];}};Fax[_0x42a8('0x1c')][_0x42a8('0x16')]=function(_0x5c4fc3){if(this['channels'][_0x5c4fc3['uniqueid']]){for(var _0x206463 in _0x5c4fc3[_0x42a8('0x26')]){if(_0x5c4fc3['variable'][_0x42a8('0x1f')](_0x206463)){this[_0x42a8('0xc')][_0x5c4fc3['uniqueid']][_0x206463]=_0x5c4fc3[_0x42a8('0x27')];}}}};Fax[_0x42a8('0x1c')][_0x42a8('0x18')]=function(_0x25c17e){if(this[_0x42a8('0xc')][_0x25c17e['uniqueid']]){this[_0x42a8('0xc')][_0x25c17e[_0x42a8('0x21')]][_0x42a8('0x2b')]=_0x25c17e[_0x42a8('0x2b')];this[_0x42a8('0xc')][_0x25c17e['uniqueid']][_0x42a8('0x2c')]=_0x25c17e[_0x42a8('0x2c')];this['channels'][_0x25c17e[_0x42a8('0x21')]][_0x42a8('0x20')]=_0x25c17e[_0x42a8('0x20')];this[_0x42a8('0xc')][_0x25c17e[_0x42a8('0x21')]][_0x42a8('0x2d')]=_0x25c17e[_0x42a8('0x2d')];logger[_0x42a8('0x24')](_0x25c17e['uniqueid'],_0x42a8('0x2e'));}};Fax[_0x42a8('0x1c')][_0x42a8('0x2f')]=function(_0x6c3c33){var _0x41e162=this;if(this[_0x42a8('0xc')][_0x6c3c33[_0x42a8('0x21')]]){var _0x186fd7=this['channels'][_0x6c3c33['uniqueid']]['id'];this[_0x42a8('0xc')][_0x6c3c33['uniqueid']]['remotestationid']=_0x6c3c33['remotestationid'];this[_0x42a8('0xc')][_0x6c3c33[_0x42a8('0x21')]][_0x42a8('0x30')]=_0x6c3c33[_0x42a8('0x30')];this[_0x42a8('0xc')][_0x6c3c33[_0x42a8('0x21')]]['localstationid']=_0x6c3c33[_0x42a8('0x20')];this[_0x42a8('0xc')][_0x6c3c33['uniqueid']][_0x42a8('0x31')]=_0x6c3c33[_0x42a8('0x31')];this[_0x42a8('0xc')][_0x6c3c33[_0x42a8('0x21')]]['transferrate']=_0x6c3c33['transferrate'];this[_0x42a8('0xc')][_0x6c3c33['uniqueid']][_0x42a8('0x2d')]=_0x6c3c33[_0x42a8('0x2d')];this[_0x42a8('0xc')][_0x6c3c33[_0x42a8('0x21')]][_0x42a8('0x32')]=_0x6c3c33['calleridnum'];if(this[_0x42a8('0xc')][_0x6c3c33[_0x42a8('0x21')]][_0x42a8('0x30')]>0x0){tiff2pdf(_0x6c3c33[_0x42a8('0x2d')],'/var/opt/motion2/server/files/attachments/',function(_0x24e101){logger[_0x42a8('0x24')](_0x6c3c33['uniqueid'],_0x42a8('0x33'),_0x24e101[_0x42a8('0x34')]);attachment[_0x42a8('0x35')]({'name':path['parse'](_0x6c3c33[_0x42a8('0x2d')])[_0x42a8('0x23')],'basename':path[_0x42a8('0x36')](_0x6c3c33[_0x42a8('0x2d')])['name']+_0x42a8('0x37'),'type':'application/pdf'})[_0x42a8('0x38')](function(_0x35c91b){faxAccount[_0x42a8('0x39')](_0x186fd7,{'from':_0x6c3c33['calleridnum'],'mapKey':_0x42a8('0x4'),'body':path[_0x42a8('0x36')](_0x6c3c33[_0x42a8('0x2d')])[_0x42a8('0x23')]+_0x42a8('0x37'),'AttachmentId':_0x35c91b['id']})[_0x42a8('0x3a')](function(_0x1d4da1){logger[_0x42a8('0x3b')](_0x6c3c33[_0x42a8('0x21')],_0x42a8('0x3c'),JSON[_0x42a8('0x3d')](_0x1d4da1));});})[_0x42a8('0x3a')](function(_0x2582b5){logger[_0x42a8('0x3b')](_0x6c3c33['uniqueid'],'\x20receiveFax\x20',JSON[_0x42a8('0x3d')](_0x2582b5));});});}logger[_0x42a8('0x24')](_0x6c3c33[_0x42a8('0x21')],_0x42a8('0x3e'));}};Fax[_0x42a8('0x1c')][_0x42a8('0x1b')]=function(_0x20904){if(this[_0x42a8('0xf')][_0x20904[_0x42a8('0x21')]]){_[_0x42a8('0x3f')](this[_0x42a8('0xc')][_0x20904[_0x42a8('0x21')]],_[_0x42a8('0x40')](_0x20904,[_0x42a8('0x41'),'reason']));}};function updateStatus(_0xe80246){if(_0xe80246[_0x42a8('0x42')]){faxMessage['update'](_0xe80246[_0x42a8('0x42')],{'failMessage':_0x42a8('0x43')})[_0x42a8('0x38')](function(_0x38e4e7){ut[_0x42a8('0x44')](_0x42a8('0x45'),_0x38e4e7);})[_0x42a8('0x3a')](function(_0x5b7a8d){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x5b7a8d);});}else{ut[_0x42a8('0x44')](_0x42a8('0x46'));}}Fax[_0x42a8('0x1c')][_0x42a8('0x47')]=function(_0x28bd9f,_0xc99e87,_0x440eff){var _0x584db2=this;var _0x4c3499={};if(_0xc99e87){_0x4c3499={'read':_0xc99e87};}else{_0x4c3499={'failMessage':_0x440eff};}if(this['actions'][_0x28bd9f][_0x42a8('0x42')]){faxMessage[_0x42a8('0x48')](this[_0x42a8('0xf')][_0x28bd9f][_0x42a8('0x42')],_0x4c3499)[_0x42a8('0x38')](function(_0x12b22e){ut[_0x42a8('0x44')](_0x42a8('0x49'),_0x12b22e);})[_0x42a8('0x3a')](function(_0x2f3d5c){ut[_0x42a8('0x44')](_0x42a8('0x4a'),_0x2f3d5c);})['finally'](function(){delete _0x584db2[_0x42a8('0xc')][_0x28bd9f];delete _0x584db2[_0x42a8('0xf')][_0x28bd9f];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this['channels'][_0x28bd9f];delete this['actions'][_0x28bd9f];}};Fax[_0x42a8('0x1c')][_0x42a8('0x1a')]=function(_0x1d1268){var _0x574552=this;if(this['channels'][_0x1d1268[_0x42a8('0x21')]]){if(this[_0x42a8('0xf')][_0x1d1268[_0x42a8('0x21')]]){this[_0x42a8('0xc')][_0x1d1268[_0x42a8('0x21')]]['id']=this[_0x42a8('0xf')][_0x1d1268['uniqueid']]['id'];this['channels'][_0x1d1268['uniqueid']]['name']=this[_0x42a8('0xf')][_0x1d1268[_0x42a8('0x21')]][_0x42a8('0x23')];}logger[_0x42a8('0x24')](_0x1d1268[_0x42a8('0x21')],this[_0x42a8('0xf')][_0x1d1268[_0x42a8('0x21')]]?_0x42a8('0x4b'):_0x42a8('0x4c'),JSON[_0x42a8('0x3d')](this[_0x42a8('0xc')][_0x1d1268['uniqueid']]));if(this[_0x42a8('0xf')][_0x1d1268[_0x42a8('0x21')]]){if(this[_0x42a8('0xc')][_0x1d1268[_0x42a8('0x21')]][_0x42a8('0x4d')]>0x0&&this['channels'][_0x1d1268[_0x42a8('0x21')]][_0x42a8('0x17')]==='SUCCESS'){this[_0x42a8('0x47')](_0x1d1268[_0x42a8('0x21')],!![]);}else{this['updateStatus'](_0x1d1268[_0x42a8('0x21')],![],this[_0x42a8('0xc')][_0x1d1268['uniqueid']][_0x42a8('0x4e')]?_0x42a8('0x4f')+this[_0x42a8('0xc')][_0x1d1268[_0x42a8('0x21')]][_0x42a8('0x4e')]:_0x42a8('0x50'));}}}};Fax[_0x42a8('0x1c')][_0x42a8('0x51')]=function(_0x1347e1){var _0x54e339=this;return new BPromise(function(_0x1f0008,_0x5e56b1){_0x54e339[_0x42a8('0x52')](_0x1347e1,_0x54e339['faxAccounts'][_0x1347e1[_0x42a8('0x53')]])[_0x42a8('0x38')](function(_0x4a2f70){ut[_0x42a8('0x44')](_0x42a8('0x54'),_0x4a2f70);_0x1f0008(ut[_0x42a8('0x34')](_0x42a8('0x55')));})[_0x42a8('0x3a')](function(_0x2cc767){ut[_0x42a8('0x44')]('[Fax][execOriginate][failure]',_0x2cc767);updateStatus(_0x1347e1);_0x5e56b1(ut['message'](_0x42a8('0x56')));});});};Fax[_0x42a8('0x1c')][_0x42a8('0x57')]=function(_0x1e51a5){var _0x4cf0a6=this;return new BPromise(function(_0x46d682,_0x3b04a2){var _0x19bcc0=_0x4cf0a6[_0x42a8('0x58')](_0x4cf0a6[_0x42a8('0xd')][_0x1e51a5[_0x42a8('0x53')]][_0x42a8('0x59')],_0x1e51a5);if(_0x19bcc0['isValid']){_0x46d682(ut[_0x42a8('0x34')]('Trunk\x20Reachable'));}else{_0x3b04a2(ut['message'](_0x19bcc0[_0x42a8('0x34')]));}});};function originate(_0xb85b98,_0x56b15b,_0x17a09d){return new BPromise(function(_0x44f5bd,_0x539763){if(_0x17a09d){var _0x66cbbe=util[_0x42a8('0x5a')](_0x42a8('0x5b'),path[_0x42a8('0x36')](_0xb85b98[_0x42a8('0x2')])[_0x42a8('0x23')],_0xb85b98[_0x42a8('0x2')]);gs[_0x42a8('0x5c')](_0x66cbbe)[_0x42a8('0x38')](function(){_0xb85b98[_0x42a8('0x2')]=util[_0x42a8('0x5a')](_0x42a8('0x5d'),path[_0x42a8('0x36')](_0xb85b98[_0x42a8('0x2')])[_0x42a8('0x5e')],path[_0x42a8('0x36')](_0xb85b98[_0x42a8('0x2')])[_0x42a8('0x23')]);_0x56b15b[_0x42a8('0x5f')]=_0xb85b98['path'];ut['logger'](_0x42a8('0x60'),'');ami[_0x42a8('0x61')](ut[_0x42a8('0x62')](_0xb85b98,_0x56b15b))[_0x42a8('0x38')](function(_0x56b046){_0x44f5bd(_0x56b046);})[_0x42a8('0x3a')](function(_0x34e94f){_0x539763(_0x34e94f);});})[_0x42a8('0x3a')](function(_0x90da34){_0x539763(_0x90da34);});}else{ami[_0x42a8('0x61')](ut[_0x42a8('0x62')](_0xb85b98,_0x56b15b))['then'](function(_0x41c233){_0x44f5bd(_0x41c233);})[_0x42a8('0x3a')](function(_0x161244){_0x539763(_0x161244);});}});}Fax['prototype'][_0x42a8('0x52')]=function(_0x59d292,_0x2c99c6){var _0x1a5bbf=this;return new BPromise(function(_0x10575a,_0x1e71bb){var _0x3c62c7=uuid['v4']();var _0x1f7270=ut[_0x42a8('0x63')](_0x59d292,_0x2c99c6);_0x1a5bbf[_0x42a8('0xf')][_0x3c62c7]=new Action(_0x3c62c7,_0x2c99c6,_0x59d292);var _0x5d3a56=_0x1a5bbf['actions'][_0x3c62c7];if(path[_0x42a8('0x36')](_0x59d292[_0x42a8('0x2')])['ext']===_0x42a8('0x37')){originate(_0x5d3a56,_0x1f7270,!![])[_0x42a8('0x38')](function(_0x4a86b7){_0x10575a(_0x4a86b7);})[_0x42a8('0x3a')](function(_0x3c16af){_0x1e71bb(_0x3c16af);});}else{originate(_0x5d3a56,_0x1f7270,![])['then'](function(_0x472b27){_0x10575a(_0x472b27);})[_0x42a8('0x3a')](function(_0x547381){_0x1e71bb(_0x547381);});}});};Fax[_0x42a8('0x1c')]['isTrunkReachable']=function(_0x2f8c1c){return!_['isNil'](_0x2f8c1c)&&!_['isNil'](_0x2f8c1c['name'])&&!_[_0x42a8('0x64')](_0x2f8c1c['active'])&&_0x2f8c1c[_0x42a8('0x65')]&&!_[_0x42a8('0x64')](this[_0x42a8('0xe')][util[_0x42a8('0x5a')](_0x42a8('0x66'),_0x2f8c1c[_0x42a8('0x23')])])&&!_[_0x42a8('0x64')](this[_0x42a8('0xe')][util['format']('SIP/%s',_0x2f8c1c[_0x42a8('0x23')])][_0x42a8('0x2c')])&&(this[_0x42a8('0xe')][util['format'](_0x42a8('0x66'),_0x2f8c1c[_0x42a8('0x23')])][_0x42a8('0x2c')]==='reachable'||this[_0x42a8('0xe')][util[_0x42a8('0x5a')](_0x42a8('0x66'),_0x2f8c1c[_0x42a8('0x23')])]['status']===_0x42a8('0x67'));};Fax['prototype'][_0x42a8('0x58')]=function(_0xacf8db,_0x178f09){if(!this[_0x42a8('0x68')](_0xacf8db)){ut['logger'](_0x42a8('0x69'),_[_0x42a8('0x64')](_0xacf8db)?'':_0xacf8db[_0x42a8('0x23')]+_0x42a8('0x6a'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_['isNil'](_0x178f09['fax'])){ut[_0x42a8('0x44')](_0x42a8('0x6b'),JSON[_0x42a8('0x3d')](_0x178f09));return{'isValid':![],'message':_0x42a8('0x6c')};}if(_[_0x42a8('0x64')](_0x178f09[_0x42a8('0x2')])){ut[_0x42a8('0x44')](_0x42a8('0x6d'),JSON[_0x42a8('0x3d')](_0x178f09));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x42a8('0x6e')};};module[_0x42a8('0x6f')]=Fax; \ No newline at end of file +var _0x51b3=['filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','Trunk','Trunk\x20Reachable','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','SIP/%s','reachable','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','bind','varset','syncVarSet','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','localstationid'];(function(_0x3d90b4,_0x1e2fc6){var _0x4c65d3=function(_0x311abc){while(--_0x311abc){_0x3d90b4['push'](_0x3d90b4['shift']());}};_0x4c65d3(++_0x1e2fc6);}(_0x51b3,0x130));var _0x351b=function(_0xdc997c,_0xae6693){_0xdc997c=_0xdc997c-0x0;var _0x2b5b43=_0x51b3[_0xdc997c];return _0x2b5b43;};'use strict';var util=require(_0x351b('0x0'));var _=require(_0x351b('0x1'));var BPromise=require(_0x351b('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x351b('0x3'));var tiff2pdf=require(_0x351b('0x4'));var gs=require(_0x351b('0x5'));var logger=require(_0x351b('0x6'))(_0x351b('0x7'));var ami=require(_0x351b('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x351b('0x9'));var ut=require(_0x351b('0xa'));var Action=require(_0x351b('0xb'));var faxAccount=require(_0x351b('0xc'));var attachment=require(_0x351b('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x13f1dc){this['channels']={};this[_0x351b('0xe')]=_0x13f1dc[_0x351b('0xe')];this[_0x351b('0xf')]=_0x13f1dc['trunks'];this[_0x351b('0x10')]={};ami['on']('newchannel',this['syncNewchannel'][_0x351b('0x11')](this));ami['on'](_0x351b('0x12'),this[_0x351b('0x13')][_0x351b('0x11')](this));ami['on']('newstate',this['syncNewState'][_0x351b('0x11')](this));ami['on']('newexten',this[_0x351b('0x14')][_0x351b('0x11')](this));ami['on'](_0x351b('0x15'),this[_0x351b('0x16')][_0x351b('0x11')](this));ami['on'](_0x351b('0x17'),this[_0x351b('0x18')][_0x351b('0x11')](this));ami['on'](_0x351b('0x19'),this[_0x351b('0x1a')][_0x351b('0x11')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x351b('0x11')](this));}Fax[_0x351b('0x1b')][_0x351b('0x1c')]=function(_0x200c5d){if(_0x200c5d[_0x351b('0x1d')]===_0x351b('0x1e')){for(var _0x6775ac in this[_0x351b('0xe')]){if(this[_0x351b('0xe')][_0x351b('0x1f')](_0x6775ac)){if(_0x200c5d[_0x351b('0x20')]===this[_0x351b('0xe')][_0x6775ac]['localstationid']){this['channels'][_0x200c5d['uniqueid']]={};this[_0x351b('0x21')][_0x200c5d[_0x351b('0x22')]][_0x351b('0x23')]=_0x200c5d['channel'];this[_0x351b('0x21')][_0x200c5d[_0x351b('0x22')]]['id']=this['faxAccounts'][_0x6775ac]['id'];this[_0x351b('0x21')][_0x200c5d[_0x351b('0x22')]][_0x351b('0x24')]=this[_0x351b('0xe')][_0x6775ac][_0x351b('0x24')];logger[_0x351b('0x25')](_0x200c5d[_0x351b('0x22')],_0x351b('0x26'));}}}}if(this[_0x351b('0x10')][_0x200c5d[_0x351b('0x22')]]){this[_0x351b('0x21')][_0x200c5d[_0x351b('0x22')]]={};this[_0x351b('0x21')][_0x200c5d[_0x351b('0x22')]][_0x351b('0x23')]=_0x200c5d[_0x351b('0x23')];logger['info'](_0x200c5d[_0x351b('0x22')],_0x351b('0x26'));}};Fax[_0x351b('0x1b')][_0x351b('0x13')]=function(_0x2077b4){if(this[_0x351b('0x21')][_0x2077b4[_0x351b('0x22')]]){for(var _0x375b0b in _0x2077b4['variable']){if(_0x2077b4[_0x351b('0x27')][_0x351b('0x1f')](_0x375b0b)){this[_0x351b('0x21')][_0x2077b4['uniqueid']][_0x375b0b]=_0x2077b4[_0x351b('0x28')];}}}};Fax[_0x351b('0x1b')][_0x351b('0x29')]=function(_0x23a334){if(this[_0x351b('0x21')][_0x23a334[_0x351b('0x22')]]){this[_0x351b('0x21')][_0x23a334['uniqueid']]['channelstate']=_0x23a334[_0x351b('0x2a')];this[_0x351b('0x21')][_0x23a334[_0x351b('0x22')]]['channelstatedesc']=_0x23a334[_0x351b('0x2b')];}};Fax[_0x351b('0x1b')]['syncNewExten']=function(_0x52b535){if(this[_0x351b('0x21')][_0x52b535[_0x351b('0x22')]]){for(var _0x3e520c in _0x52b535['variable']){if(_0x52b535[_0x351b('0x27')][_0x351b('0x1f')](_0x3e520c)){this[_0x351b('0x21')][_0x52b535[_0x351b('0x22')]][_0x3e520c]=_0x52b535[_0x351b('0x28')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x275bd5){if(this['channels'][_0x275bd5[_0x351b('0x22')]]){this[_0x351b('0x21')][_0x275bd5['uniqueid']][_0x351b('0x2c')]=_0x275bd5[_0x351b('0x2c')];this[_0x351b('0x21')][_0x275bd5[_0x351b('0x22')]][_0x351b('0x2d')]=_0x275bd5[_0x351b('0x2d')];this[_0x351b('0x21')][_0x275bd5[_0x351b('0x22')]]['localstationid']=_0x275bd5[_0x351b('0x2e')];this[_0x351b('0x21')][_0x275bd5[_0x351b('0x22')]]['filename']=_0x275bd5[_0x351b('0x2f')];logger[_0x351b('0x25')](_0x275bd5[_0x351b('0x22')],_0x351b('0x30'));}};Fax[_0x351b('0x1b')][_0x351b('0x18')]=function(_0x3a6e2a){var _0x4cc5bf=this;if(this[_0x351b('0x21')][_0x3a6e2a[_0x351b('0x22')]]){var _0x114a9b=this[_0x351b('0x21')][_0x3a6e2a[_0x351b('0x22')]]['id'];this[_0x351b('0x21')][_0x3a6e2a[_0x351b('0x22')]][_0x351b('0x31')]=_0x3a6e2a[_0x351b('0x31')];this[_0x351b('0x21')][_0x3a6e2a[_0x351b('0x22')]]['pagestransferred']=_0x3a6e2a[_0x351b('0x32')];this[_0x351b('0x21')][_0x3a6e2a[_0x351b('0x22')]][_0x351b('0x2e')]=_0x3a6e2a['localstationid'];this[_0x351b('0x21')][_0x3a6e2a['uniqueid']][_0x351b('0x33')]=_0x3a6e2a['resolution'];this['channels'][_0x3a6e2a[_0x351b('0x22')]][_0x351b('0x34')]=_0x3a6e2a['transferrate'];this[_0x351b('0x21')][_0x3a6e2a['uniqueid']][_0x351b('0x2f')]=_0x3a6e2a[_0x351b('0x2f')];this[_0x351b('0x21')][_0x3a6e2a[_0x351b('0x22')]]['calleridnum']=_0x3a6e2a[_0x351b('0x35')];if(this[_0x351b('0x21')][_0x3a6e2a[_0x351b('0x22')]]['pagestransferred']>0x0){tiff2pdf(_0x3a6e2a[_0x351b('0x2f')],_0x351b('0x36'),function(_0x4b3a7c){logger[_0x351b('0x25')](_0x3a6e2a[_0x351b('0x22')],_0x351b('0x37'),_0x4b3a7c[_0x351b('0x38')]);attachment['create']({'name':path['parse'](_0x3a6e2a[_0x351b('0x2f')])[_0x351b('0x24')],'basename':path[_0x351b('0x39')](_0x3a6e2a[_0x351b('0x2f')])[_0x351b('0x24')]+_0x351b('0x3a'),'type':_0x351b('0x3b')})[_0x351b('0x3c')](function(_0x49027a){faxAccount[_0x351b('0x3d')](_0x114a9b,{'from':_0x3a6e2a[_0x351b('0x35')],'mapKey':'fax','body':path[_0x351b('0x39')](_0x3a6e2a['filename'])[_0x351b('0x24')]+_0x351b('0x3a'),'AttachmentId':_0x49027a['id']})[_0x351b('0x3e')](function(_0x5b44a6){logger[_0x351b('0x3f')](_0x3a6e2a[_0x351b('0x22')],_0x351b('0x40'),JSON[_0x351b('0x41')](_0x5b44a6));});})[_0x351b('0x3e')](function(_0x4190d9){logger[_0x351b('0x3f')](_0x3a6e2a[_0x351b('0x22')],_0x351b('0x42'),JSON[_0x351b('0x41')](_0x4190d9));});});}logger[_0x351b('0x25')](_0x3a6e2a['uniqueid'],'\x20receiveFax\x20');}};Fax['prototype'][_0x351b('0x43')]=function(_0x431d3d){if(this[_0x351b('0x10')][_0x431d3d[_0x351b('0x22')]]){_['merge'](this[_0x351b('0x21')][_0x431d3d[_0x351b('0x22')]],_[_0x351b('0x44')](_0x431d3d,[_0x351b('0x45'),_0x351b('0x46')]));}};function updateStatus(_0x5a01e3){if(_0x5a01e3[_0x351b('0x47')]){faxMessage[_0x351b('0x48')](_0x5a01e3[_0x351b('0x47')],{'failMessage':_0x351b('0x49')})[_0x351b('0x3c')](function(_0x323e16){ut[_0x351b('0x4a')](_0x351b('0x4b'),_0x323e16);})[_0x351b('0x3e')](function(_0x23f514){ut['logger'](_0x351b('0x4c'),_0x23f514);});}else{ut[_0x351b('0x4a')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x351b('0x1b')][_0x351b('0x4d')]=function(_0x2cf132,_0x27f06d,_0x5f0f23){var _0x3a5504=this;var _0x1aa495={};if(_0x27f06d){_0x1aa495={'read':_0x27f06d};}else{_0x1aa495={'failMessage':_0x5f0f23};}if(this[_0x351b('0x10')][_0x2cf132][_0x351b('0x47')]){faxMessage[_0x351b('0x48')](this[_0x351b('0x10')][_0x2cf132][_0x351b('0x47')],_0x1aa495)[_0x351b('0x3c')](function(_0xf76f05){ut[_0x351b('0x4a')](_0x351b('0x4e'),_0xf76f05);})[_0x351b('0x3e')](function(_0x3fb13c){ut[_0x351b('0x4a')](_0x351b('0x4f'),_0x3fb13c);})['finally'](function(){delete _0x3a5504['channels'][_0x2cf132];delete _0x3a5504[_0x351b('0x10')][_0x2cf132];});}else{ut['logger'](_0x351b('0x50'));delete this[_0x351b('0x21')][_0x2cf132];delete this[_0x351b('0x10')][_0x2cf132];}};Fax[_0x351b('0x1b')][_0x351b('0x1a')]=function(_0x3f8095){var _0x5a1283=this;if(this['channels'][_0x3f8095['uniqueid']]){if(this[_0x351b('0x10')][_0x3f8095[_0x351b('0x22')]]){this[_0x351b('0x21')][_0x3f8095[_0x351b('0x22')]]['id']=this[_0x351b('0x10')][_0x3f8095['uniqueid']]['id'];this[_0x351b('0x21')][_0x3f8095[_0x351b('0x22')]]['name']=this[_0x351b('0x10')][_0x3f8095[_0x351b('0x22')]][_0x351b('0x24')];}logger[_0x351b('0x25')](_0x3f8095['uniqueid'],this['actions'][_0x3f8095['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x351b('0x51'),JSON[_0x351b('0x41')](this['channels'][_0x3f8095['uniqueid']]));if(this[_0x351b('0x10')][_0x3f8095['uniqueid']]){if(this[_0x351b('0x21')][_0x3f8095['uniqueid']]['faxpages']>0x0&&this[_0x351b('0x21')][_0x3f8095[_0x351b('0x22')]][_0x351b('0x15')]===_0x351b('0x52')){this[_0x351b('0x4d')](_0x3f8095[_0x351b('0x22')],!![]);}else{this[_0x351b('0x4d')](_0x3f8095['uniqueid'],![],this[_0x351b('0x21')][_0x3f8095[_0x351b('0x22')]]['faxstatusstring']?_0x351b('0x53')+this['channels'][_0x3f8095['uniqueid']][_0x351b('0x54')]:_0x351b('0x55'));}}}};Fax[_0x351b('0x1b')]['send']=function(_0x42c856){var _0x4f49aa=this;return new BPromise(function(_0x26b7e8,_0x1fe11f){_0x4f49aa[_0x351b('0x56')](_0x42c856,_0x4f49aa['faxAccounts'][_0x42c856[_0x351b('0x57')]])[_0x351b('0x3c')](function(_0x3030ae){ut[_0x351b('0x4a')](_0x351b('0x58'),_0x3030ae);_0x26b7e8(ut[_0x351b('0x38')](_0x351b('0x59')));})[_0x351b('0x3e')](function(_0x284aad){ut[_0x351b('0x4a')]('[Fax][execOriginate][failure]',_0x284aad);updateStatus(_0x42c856);_0x1fe11f(ut[_0x351b('0x38')](_0x351b('0x5a')));});});};Fax['prototype'][_0x351b('0x5b')]=function(_0x52cf91){var _0x2e9fe0=this;return new BPromise(function(_0x1f8b4e,_0x2d4d48){var _0x54a2e8=_0x2e9fe0['checkTrunk'](_0x2e9fe0[_0x351b('0xe')][_0x52cf91[_0x351b('0x57')]][_0x351b('0x5c')],_0x52cf91);if(_0x54a2e8['isValid']){_0x1f8b4e(ut[_0x351b('0x38')](_0x351b('0x5d')));}else{_0x2d4d48(ut[_0x351b('0x38')](_0x54a2e8[_0x351b('0x38')]));}});};function originate(_0xd016ce,_0x194b0d,_0xfd19cc){return new BPromise(function(_0x4f7c95,_0x47eab3){if(_0xfd19cc){var _0x3f3c42=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x351b('0x39')](_0xd016ce[_0x351b('0x3')])['name'],_0xd016ce[_0x351b('0x3')]);gs[_0x351b('0x5e')](_0x3f3c42)[_0x351b('0x3c')](function(){_0xd016ce[_0x351b('0x3')]=util[_0x351b('0x5f')](_0x351b('0x60'),path[_0x351b('0x39')](_0xd016ce[_0x351b('0x3')])[_0x351b('0x61')],path[_0x351b('0x39')](_0xd016ce['path'])[_0x351b('0x24')]);_0x194b0d[_0x351b('0x62')]=_0xd016ce['path'];ut[_0x351b('0x4a')](_0x351b('0x63'),'');ami[_0x351b('0x64')](ut[_0x351b('0x65')](_0xd016ce,_0x194b0d))[_0x351b('0x3c')](function(_0x3a2277){_0x4f7c95(_0x3a2277);})[_0x351b('0x3e')](function(_0x28c3b0){_0x47eab3(_0x28c3b0);});})[_0x351b('0x3e')](function(_0xf269e3){_0x47eab3(_0xf269e3);});}else{ami['Action'](ut[_0x351b('0x65')](_0xd016ce,_0x194b0d))[_0x351b('0x3c')](function(_0x1f9b33){_0x4f7c95(_0x1f9b33);})[_0x351b('0x3e')](function(_0x394e56){_0x47eab3(_0x394e56);});}});}Fax[_0x351b('0x1b')][_0x351b('0x56')]=function(_0x1fd127,_0x2f6e5e){var _0x3813e3=this;return new BPromise(function(_0xf57c8b,_0x863e12){var _0x2aeda2=uuid['v4']();var _0x44d5ca=ut[_0x351b('0x66')](_0x1fd127,_0x2f6e5e);_0x3813e3[_0x351b('0x10')][_0x2aeda2]=new Action(_0x2aeda2,_0x2f6e5e,_0x1fd127);var _0x408190=_0x3813e3[_0x351b('0x10')][_0x2aeda2];if(path[_0x351b('0x39')](_0x1fd127[_0x351b('0x3')])[_0x351b('0x67')]===_0x351b('0x3a')){originate(_0x408190,_0x44d5ca,!![])[_0x351b('0x3c')](function(_0x5844f4){_0xf57c8b(_0x5844f4);})[_0x351b('0x3e')](function(_0x5658c6){_0x863e12(_0x5658c6);});}else{originate(_0x408190,_0x44d5ca,![])[_0x351b('0x3c')](function(_0x29966b){_0xf57c8b(_0x29966b);})[_0x351b('0x3e')](function(_0x7a3b14){_0x863e12(_0x7a3b14);});}});};Fax[_0x351b('0x1b')][_0x351b('0x68')]=function(_0x2dc390){return!_[_0x351b('0x69')](_0x2dc390)&&!_[_0x351b('0x69')](_0x2dc390[_0x351b('0x24')])&&!_['isNil'](_0x2dc390['active'])&&_0x2dc390['active']&&!_[_0x351b('0x69')](this[_0x351b('0xf')][util[_0x351b('0x5f')](_0x351b('0x6a'),_0x2dc390[_0x351b('0x24')])])&&!_['isNil'](this[_0x351b('0xf')][util[_0x351b('0x5f')]('SIP/%s',_0x2dc390[_0x351b('0x24')])][_0x351b('0x2d')])&&(this[_0x351b('0xf')][util[_0x351b('0x5f')](_0x351b('0x6a'),_0x2dc390[_0x351b('0x24')])][_0x351b('0x2d')]===_0x351b('0x6b')||this[_0x351b('0xf')][util[_0x351b('0x5f')](_0x351b('0x6a'),_0x2dc390[_0x351b('0x24')])]['status']===_0x351b('0x6c'));};Fax[_0x351b('0x1b')][_0x351b('0x6d')]=function(_0x248e96,_0x3ad752){if(!this['isTrunkReachable'](_0x248e96)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_['isNil'](_0x248e96)?'':_0x248e96[_0x351b('0x24')]+_0x351b('0x6e'));return{'isValid':![],'message':_0x351b('0x6f')};}if(_[_0x351b('0x69')](_0x3ad752[_0x351b('0x7')])){ut[_0x351b('0x4a')](_0x351b('0x70'),JSON['stringify'](_0x3ad752));return{'isValid':![],'message':_0x351b('0x71')};}if(_[_0x351b('0x69')](_0x3ad752[_0x351b('0x3')])){ut[_0x351b('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x351b('0x41')](_0x3ad752));return{'isValid':![],'message':_0x351b('0x72')};}return{'isValid':!![],'message':_0x351b('0x73')};};module[_0x351b('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 3357938..2c585be 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 _0xd6de=['../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','bluebird','preview','lodash'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xd6de,0x126));var _0xed6d=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xd6de[_0x4f9b18];return _0x29f20c;};'use strict';var util=require('util');var BPromise=require(_0xed6d('0x0'));var logger=require('../../../config/logger')(_0xed6d('0x1'));var _=require(_0xed6d('0x2'));var faxAccount=require(_0xed6d('0x3'));function loggerCatch(_0x50511e){return function(_0x4d0acf){logger[_0xed6d('0x4')](_0x50511e,util[_0xed6d('0x5')](_0x4d0acf,{'showHidden':![],'depth':null}));};}exports[_0xed6d('0x6')]=function(_0x5ff6dc,_0x32e8a1){return BPromise[_0xed6d('0x7')]()[_0xed6d('0x8')](faxAccount[_0xed6d('0x6')](_0x5ff6dc,_0x32e8a1))[_0xed6d('0x9')](loggerCatch(_0xed6d('0xa')));}; \ No newline at end of file +var _0x4aa8=['lodash','error','inspect','resolve','then','notify','catch','[Notify]\x20','util','bluebird'];(function(_0x3fd8e0,_0x33c129){var _0x50a6f9=function(_0x11c124){while(--_0x11c124){_0x3fd8e0['push'](_0x3fd8e0['shift']());}};_0x50a6f9(++_0x33c129);}(_0x4aa8,0x8a));var _0x84aa=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x4aa8[_0x432fca];return _0x3adba4;};'use strict';var util=require(_0x84aa('0x0'));var BPromise=require(_0x84aa('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x84aa('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x71962){return function(_0x24eaf3){logger[_0x84aa('0x3')](_0x71962,util[_0x84aa('0x4')](_0x24eaf3,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2a0ded,_0x3bc47b){return BPromise[_0x84aa('0x5')]()[_0x84aa('0x6')](faxAccount[_0x84aa('0x7')](_0x2a0ded,_0x3bc47b))[_0x84aa('0x8')](loggerCatch(_0x84aa('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 bb42277..d7d43f8 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 _0xf1ab=['inspect','../../../../config/logger','fax','bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x47c28c,_0x52f17e){var _0x13c2ec=function(_0xf21752){while(--_0xf21752){_0x47c28c['push'](_0x47c28c['shift']());}};_0x13c2ec(++_0x52f17e);}(_0xf1ab,0xe2));var _0xbf1a=function(_0x4ec4eb,_0x1a3d64){_0x4ec4eb=_0x4ec4eb-0x0;var _0x2fbd23=_0xf1ab[_0x4ec4eb];return _0x2fbd23;};'use strict';var util=require('util');var logger=require(_0xbf1a('0x0'))(_0xbf1a('0x1'));var BPromise=require(_0xbf1a('0x2'));var exec=require(_0xbf1a('0x3'))['exec'];exports[_0xbf1a('0x4')]=function(_0x450a9e){return new BPromise(function(_0x221fa9,_0x158204){exec(_0x450a9e,function(_0x2bea54,_0x54d491,_0x5b9b37){logger[_0xbf1a('0x5')](_0xbf1a('0x6'),_0x54d491);if(_0x2bea54){logger['info'](_0xbf1a('0x6'),_0xbf1a('0x7'),util[_0xbf1a('0x8')](_0x2bea54,{'showHidden':![],'depth':null}),_0x54d491,_0x5b9b37);_0x158204(_0x2bea54);}_0x221fa9(_0x54d491);});});}; \ No newline at end of file +var _0xdd0b=['util','../../../../config/logger','bluebird','child_process','exec','info','Exec\x20gs','inspect'];(function(_0x123e6d,_0x5bd78d){var _0x54af21=function(_0x102007){while(--_0x102007){_0x123e6d['push'](_0x123e6d['shift']());}};_0x54af21(++_0x5bd78d);}(_0xdd0b,0xc8));var _0xbdd0=function(_0x1dfb77,_0x310318){_0x1dfb77=_0x1dfb77-0x0;var _0x478562=_0xdd0b[_0x1dfb77];return _0x478562;};'use strict';var util=require(_0xbdd0('0x0'));var logger=require(_0xbdd0('0x1'))('fax');var BPromise=require(_0xbdd0('0x2'));var exec=require(_0xbdd0('0x3'))[_0xbdd0('0x4')];exports['execute']=function(_0x49976d){return new BPromise(function(_0x57087c,_0x2daa9a){exec(_0x49976d,function(_0x417cf1,_0x5e00ef,_0x112919){logger[_0xbdd0('0x5')](_0xbdd0('0x6'),_0x5e00ef);if(_0x417cf1){logger[_0xbdd0('0x5')](_0xbdd0('0x6'),'\x20Error\x20:',util[_0xbdd0('0x7')](_0x417cf1,{'showHidden':![],'depth':null}),_0x5e00ef,_0x112919);_0x2daa9a(_0x417cf1);}_0x57087c(_0x5e00ef);});});}; \ 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 a864f98..87738f0 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 _0x1803=['maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','localstationid','lodash','moment','../../../../config/logger','fax','message','logger','info','addVariables','headerinfo','minrate'];(function(_0x2e18d7,_0x16c3e6){var _0x59ae50=function(_0x22d744){while(--_0x22d744){_0x2e18d7['push'](_0x2e18d7['shift']());}};_0x59ae50(++_0x16c3e6);}(_0x1803,0x146));var _0x3180=function(_0x19f451,_0x4b5e9b){_0x19f451=_0x19f451-0x0;var _0x376db5=_0x1803[_0x19f451];return _0x376db5;};'use strict';var util=require('util');var _=require(_0x3180('0x0'));var moment=require(_0x3180('0x1'));var logger=require(_0x3180('0x2'))(_0x3180('0x3'));exports[_0x3180('0x4')]=function(_0x5162b3){return{'message':_0x5162b3};};exports[_0x3180('0x5')]=function(_0x42d5ed,_0x546980){logger[_0x3180('0x6')](_0x42d5ed,util['inspect'](_0x546980,{'showHidden':![],'depth':null}));};exports[_0x3180('0x7')]=function(_0x4a6d90,_0x58c06f){var _0x527c84={'XMF-ECM':_0x58c06f['ecm'],'XMF-HEADERINFO':_0x58c06f[_0x3180('0x8')],'XMF-MINRATE':_0x58c06f[_0x3180('0x9')],'XMF-MAXRATE':_0x58c06f[_0x3180('0xa')],'XMF-MODEM':util[_0x3180('0xb')](_0x3180('0xc'),_0x58c06f[_0x3180('0xd')]),'XMF-GATEWAY':_0x58c06f['gateway'],'XMF-FAXDETECT':_0x58c06f[_0x3180('0xe')],'XMF-T38TIMEOUT':_0x58c06f[_0x3180('0xf')],'XMF-LOCALSTATIONID':_0x58c06f['localstationid'],'XMF-PATH':_0x4a6d90[_0x3180('0x10')]};return _0x527c84;};exports[_0x3180('0x11')]=function(_0x1602dc,_0x4e92d0){return{'actionid':_0x1602dc[_0x3180('0x12')],'action':_0x3180('0x13'),'channel':_0x1602dc[_0x3180('0x14')],'Exten':_0x3180('0x15'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0x3180('0x16'),_0x1602dc[_0x3180('0x8')]?_0x1602dc[_0x3180('0x8')]:'',_0x1602dc[_0x3180('0x17')]),'variable':_0x4e92d0,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1602dc[_0x3180('0x12')]};}; \ No newline at end of file +var _0x6f43=['format','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','minrate','maxrate'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0x6f43,0x109));var _0x36f4=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0x6f43[_0x38a3d6];return _0x3768d7;};'use strict';var util=require('util');var _=require(_0x36f4('0x0'));var moment=require(_0x36f4('0x1'));var logger=require(_0x36f4('0x2'))(_0x36f4('0x3'));exports[_0x36f4('0x4')]=function(_0x4a4045){return{'message':_0x4a4045};};exports[_0x36f4('0x5')]=function(_0x2c0f97,_0x14dfc7){logger[_0x36f4('0x6')](_0x2c0f97,util[_0x36f4('0x7')](_0x14dfc7,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x892901,_0x47dc15){var _0x3229e7={'XMF-ECM':_0x47dc15[_0x36f4('0x8')],'XMF-HEADERINFO':_0x47dc15['headerinfo'],'XMF-MINRATE':_0x47dc15[_0x36f4('0x9')],'XMF-MAXRATE':_0x47dc15[_0x36f4('0xa')],'XMF-MODEM':util[_0x36f4('0xb')]('\x22%s\x22',_0x47dc15['modem']),'XMF-GATEWAY':_0x47dc15[_0x36f4('0xc')],'XMF-FAXDETECT':_0x47dc15[_0x36f4('0xd')],'XMF-T38TIMEOUT':_0x47dc15[_0x36f4('0xe')],'XMF-LOCALSTATIONID':_0x47dc15[_0x36f4('0xf')],'XMF-PATH':_0x892901['path']};return _0x3229e7;};exports[_0x36f4('0x10')]=function(_0x162c12,_0x308437){return{'actionid':_0x162c12[_0x36f4('0x11')],'action':'originate','channel':_0x162c12[_0x36f4('0x12')],'Exten':_0x36f4('0x13'),'Context':_0x36f4('0x14'),'Priority':'1','callerid':util[_0x36f4('0xb')](_0x36f4('0x15'),_0x162c12[_0x36f4('0x16')]?_0x162c12['headerinfo']:'',_0x162c12['localstationid']),'variable':_0x308437,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x162c12['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 40d181d..0ac1b04 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 _0x0de6=['getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','[index.js][main]','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory'];(function(_0x111912,_0x427d64){var _0x2215a8=function(_0x4ea4f9){while(--_0x4ea4f9){_0x111912['push'](_0x111912['shift']());}};_0x2215a8(++_0x427d64);}(_0x0de6,0x99));var _0x60de=function(_0x1afa89,_0xd81c5a){_0x1afa89=_0x1afa89-0x0;var _0xf4e084=_0x0de6[_0x1afa89];return _0xf4e084;};'use strict';var util=require('util');var moment=require(_0x60de('0x0'));var server=require(_0x60de('0x1'));var Realtime=require(_0x60de('0x2'));var Report=require(_0x60de('0x3'));var Acw=require(_0x60de('0x4'));var Trigger=require(_0x60de('0x5'));var Dialer=require(_0x60de('0x6'));var Preview=require('./preview');var Fax=require(_0x60de('0x7'));var user=require(_0x60de('0x8'));var voiceQueue=require(_0x60de('0x9'));var voiceQueueReport=require(_0x60de('0xa'));var voiceCallReport=require(_0x60de('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0x60de('0xc'));var template=require(_0x60de('0xd'));var cmHopperHistory=require(_0x60de('0xe'));var campaign=require(_0x60de('0xf'));var voiceExtension=require(_0x60de('0x10'));var faxAccount=require(_0x60de('0x11'));var zendesk=require(_0x60de('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x60de('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x60de('0x14'));var zoho=require(_0x60de('0x15'));var vtiger=require(_0x60de('0x16'));var freshsales=require(_0x60de('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x60de('0x18'));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(_0x60de('0x19'))(_0x60de('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x60de('0x1b')](_0x60de('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x60de('0x1d')]()[_0x60de('0x1e')](user['getAgents']())[_0x60de('0x1e')](realtime[_0x60de('0x1f')]())[_0x60de('0x1e')](user[_0x60de('0x20')]())['then'](realtime[_0x60de('0x21')]())[_0x60de('0x1e')](trunk[_0x60de('0x22')]())[_0x60de('0x1e')](realtime['initTrunks']())['then'](voiceQueue[_0x60de('0x23')]())[_0x60de('0x1e')](realtime[_0x60de('0x24')]())[_0x60de('0x1e')](trigger[_0x60de('0x25')]())[_0x60de('0x1e')](realtime[_0x60de('0x26')]())[_0x60de('0x1e')](template['getTemplates']())[_0x60de('0x1e')](realtime[_0x60de('0x27')]())[_0x60de('0x1e')](zendesk['getZendeskAccounts']())['then'](realtime[_0x60de('0x28')]())[_0x60de('0x1e')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x60de('0x29')]())['then'](sugarcrm[_0x60de('0x2a')]())['then'](realtime['initSugarcrmAccounts']())[_0x60de('0x1e')](freshdesk['getFreshdeskAccounts']())[_0x60de('0x1e')](realtime[_0x60de('0x2b')]())['then'](desk[_0x60de('0x2c')]())[_0x60de('0x1e')](realtime[_0x60de('0x2d')]())[_0x60de('0x1e')](zoho['getZohoAccounts']())[_0x60de('0x1e')](realtime[_0x60de('0x2e')]())[_0x60de('0x1e')](vtiger[_0x60de('0x2f')]())[_0x60de('0x1e')](realtime[_0x60de('0x30')]())[_0x60de('0x1e')](freshsales[_0x60de('0x31')]())['then'](realtime[_0x60de('0x32')]())[_0x60de('0x1e')](servicenow[_0x60de('0x33')]())[_0x60de('0x1e')](realtime[_0x60de('0x34')]())[_0x60de('0x1e')](dynamics365[_0x60de('0x35')]())[_0x60de('0x1e')](realtime[_0x60de('0x36')]())[_0x60de('0x1e')](campaign[_0x60de('0x37')]())['then'](realtime[_0x60de('0x38')]())[_0x60de('0x1e')](voiceExtension['getVoiceExtensions']())[_0x60de('0x1e')](realtime[_0x60de('0x39')]())[_0x60de('0x1e')](faxAccount[_0x60de('0x3a')]())[_0x60de('0x1e')](realtime[_0x60de('0x3b')]())['then'](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x60de('0x1e')](voiceQueueReport[_0x60de('0x3c')]())['then'](realtime[_0x60de('0x3d')]())['then'](cmHopperHistory[_0x60de('0x3e')]())[_0x60de('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0x60de('0x1e')](cmHopperHistory[_0x60de('0x3f')]())[_0x60de('0x1e')](realtime[_0x60de('0x40')]())['then'](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0x60de('0x41')]())[_0x60de('0x42')](function(_0x549607){logger[_0x60de('0x43')](_0x60de('0x44'),util[_0x60de('0x45')](_0x549607,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x60de('0x1e')](function(){return initRealtime();})[_0x60de('0x1e')](function(){return initParams();})[_0x60de('0x1e')](function(){report[_0x60de('0x46')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x52d689){logger[_0x60de('0x43')](_0x60de('0x47'),util[_0x60de('0x45')](_0x52d689,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xf914=['get','hour','resolve','then','getAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','[index.js][main]','moment','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0xf914,0xa0));var _0x4f91=function(_0x17fdde,_0x4b3717){_0x17fdde=_0x17fdde-0x0;var _0x4fd885=_0xf914[_0x17fdde];return _0x4fd885;};'use strict';var util=require('util');var moment=require(_0x4f91('0x0'));var server=require('./server');var Realtime=require('./realtime');var Report=require('./report');var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x4f91('0x1'));var Preview=require(_0x4f91('0x2'));var Fax=require(_0x4f91('0x3'));var user=require(_0x4f91('0x4'));var voiceQueue=require(_0x4f91('0x5'));var voiceQueueReport=require(_0x4f91('0x6'));var voiceCallReport=require(_0x4f91('0x7'));var trunk=require(_0x4f91('0x8'));var trigger=require(_0x4f91('0x9'));var template=require('./rpc/template');var cmHopperHistory=require(_0x4f91('0xa'));var campaign=require(_0x4f91('0xb'));var voiceExtension=require(_0x4f91('0xc'));var faxAccount=require(_0x4f91('0xd'));var zendesk=require(_0x4f91('0xe'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x4f91('0xf'));var zoho=require(_0x4f91('0x10'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x4f91('0x11'));var dynamics365=require(_0x4f91('0x12'));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(_0x4f91('0x13'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4f91('0x14')](_0x4f91('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4f91('0x14')](_0x4f91('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x4f91('0x16')]()[_0x4f91('0x17')](user[_0x4f91('0x18')]())[_0x4f91('0x17')](realtime['initAgents']())['then'](user[_0x4f91('0x19')]())[_0x4f91('0x17')](realtime['initTelephones']())[_0x4f91('0x17')](trunk[_0x4f91('0x1a')]())['then'](realtime[_0x4f91('0x1b')]())[_0x4f91('0x17')](voiceQueue[_0x4f91('0x1c')]())[_0x4f91('0x17')](realtime[_0x4f91('0x1d')]())[_0x4f91('0x17')](trigger['getTriggers']())[_0x4f91('0x17')](realtime[_0x4f91('0x1e')]())[_0x4f91('0x17')](template[_0x4f91('0x1f')]())[_0x4f91('0x17')](realtime['initTemplates']())['then'](zendesk[_0x4f91('0x20')]())[_0x4f91('0x17')](realtime['initZendeskAccounts']())[_0x4f91('0x17')](salesforce[_0x4f91('0x21')]())[_0x4f91('0x17')](realtime['initSalesforceAccounts']())[_0x4f91('0x17')](sugarcrm[_0x4f91('0x22')]())[_0x4f91('0x17')](realtime[_0x4f91('0x23')]())['then'](freshdesk['getFreshdeskAccounts']())['then'](realtime['initFreshdeskAccounts']())[_0x4f91('0x17')](desk['getDeskAccounts']())[_0x4f91('0x17')](realtime[_0x4f91('0x24')]())[_0x4f91('0x17')](zoho['getZohoAccounts']())[_0x4f91('0x17')](realtime[_0x4f91('0x25')]())[_0x4f91('0x17')](vtiger[_0x4f91('0x26')]())[_0x4f91('0x17')](realtime[_0x4f91('0x27')]())[_0x4f91('0x17')](freshsales['getFreshsalesAccounts']())[_0x4f91('0x17')](realtime['initFreshsalesAccounts']())[_0x4f91('0x17')](servicenow['getServicenowAccounts']())[_0x4f91('0x17')](realtime[_0x4f91('0x28')]())['then'](dynamics365[_0x4f91('0x29')]())['then'](realtime[_0x4f91('0x2a')]())[_0x4f91('0x17')](campaign['getCampaigns']())[_0x4f91('0x17')](realtime[_0x4f91('0x2b')]())[_0x4f91('0x17')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x4f91('0x2c')]())['then'](faxAccount[_0x4f91('0x2d')]())[_0x4f91('0x17')](realtime['initFaxAccounts']())[_0x4f91('0x17')](function(){return realtime;});}function initParams(){return Promise[_0x4f91('0x16')]()[_0x4f91('0x17')](voiceQueueReport[_0x4f91('0x2e')]())[_0x4f91('0x17')](realtime[_0x4f91('0x2f')]())[_0x4f91('0x17')](cmHopperHistory[_0x4f91('0x30')]())['then'](realtime[_0x4f91('0x31')]())[_0x4f91('0x17')](cmHopperHistory[_0x4f91('0x32')]())[_0x4f91('0x17')](realtime['initCampaignHopperHistory']())[_0x4f91('0x17')](voiceCallReport[_0x4f91('0x33')]())[_0x4f91('0x17')](realtime[_0x4f91('0x34')]())[_0x4f91('0x35')](function(_0x36afe9){logger['error'](_0x4f91('0x36'),util[_0x4f91('0x37')](_0x36afe9,{'showHidden':![],'depth':null}));});}function main(){return server[_0x4f91('0x38')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x4f91('0x17')](function(){return initParams();})['then'](function(){report[_0x4f91('0x39')]();setInterval(initRealtime,0x1388);})[_0x4f91('0x35')](function(_0x162968){logger[_0x4f91('0x3a')](_0x4f91('0x3b'),util[_0x4f91('0x37')](_0x162968,{'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 1a77300..98feecf 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 _0xf804=['redis','defaults','localhost','name','email','accountcode','fullname','state','unknown','stateTime','phone','mobile','interface','online','voiceStatus','voiceStatusTime','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','status','address','voiceStatusQueue','stringify','user:%s','omit','emit','exports','lodash','util','moment','md5','ioredis','../../../config/environment'];(function(_0x5c830f,_0x3ea7cc){var _0x33ec0e=function(_0x157cea){while(--_0x157cea){_0x5c830f['push'](_0x5c830f['shift']());}};_0x33ec0e(++_0x3ea7cc);}(_0xf804,0x1f2));var _0x4f80=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf804[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x4f80('0x0'));var util=require(_0x4f80('0x1'));var moment=require(_0x4f80('0x2'));var md5=require(_0x4f80('0x3'));var Redis=require(_0x4f80('0x4'));var config=require(_0x4f80('0x5'));config[_0x4f80('0x6')]=_[_0x4f80('0x7')](config[_0x4f80('0x6')],{'host':_0x4f80('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4f80('0x6')]));function Agent(_0x1ca02f){this['id']=_0x1ca02f['id']||0x0;this['name']=_0x1ca02f[_0x4f80('0x9')]||'';this['email']=_0x1ca02f[_0x4f80('0xa')]||'';this[_0x4f80('0xb')]=_0x1ca02f[_0x4f80('0xb')]||'';this[_0x4f80('0xc')]=_0x1ca02f[_0x4f80('0xc')]||'';this[_0x4f80('0xd')]=_0x4f80('0xe');this[_0x4f80('0xf')]=0x0;this['status']=_0x4f80('0xe');this['address']='';this[_0x4f80('0x10')]='';this[_0x4f80('0x11')]='';this[_0x4f80('0x12')]='';this[_0x4f80('0x13')]=_0x1ca02f['online']||![];this[_0x4f80('0x14')]=_0x4f80('0xe');this[_0x4f80('0x15')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x4f80('0x16')]=![];this[_0x4f80('0x17')]=![];this[_0x4f80('0x3')]='';}Agent[_0x4f80('0x18')][_0x4f80('0x19')]=function(_0x450e0a){var _0x2ad05d;if(_0x450e0a&&_0x450e0a[_0x4f80('0xd')]){_0x2ad05d=_0x450e0a[_0x4f80('0xd')][_0x4f80('0x1a')]();switch(_0x2ad05d){case _0x4f80('0x1b'):_0x2ad05d=_0x4f80('0x1c');break;case _0x4f80('0x1d'):_0x2ad05d=_0x4f80('0x1e');break;}}if(_0x2ad05d&&this[_0x4f80('0x14')]!==_0x2ad05d||_0x450e0a[_0x4f80('0x1f')]){this['voiceStatusTime']=_[_0x4f80('0x20')](moment()[_0x4f80('0x21')]('x'));}if(_0x2ad05d){this[_0x4f80('0x14')]=_0x2ad05d;}var _0x2ca8ef={'id':this['id'],'name':this[_0x4f80('0x9')],'email':this['email'],'accountcode':this[_0x4f80('0xb')],'fullname':this[_0x4f80('0xc')],'state':this[_0x4f80('0xd')],'stateTime':this[_0x4f80('0xf')],'status':this[_0x4f80('0x22')],'address':this[_0x4f80('0x23')],'online':this[_0x4f80('0x13')],'voiceStatus':this[_0x4f80('0x14')],'voiceStatusTime':this[_0x4f80('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x4f80('0x24')],'interface':this[_0x4f80('0x12')],'onhold':this[_0x4f80('0x16')]};var _0x1bfbeb=md5(JSON[_0x4f80('0x25')](_0x2ca8ef));if(this[_0x4f80('0x3')]!==_0x1bfbeb){this[_0x4f80('0x3')]=_0x1bfbeb;io['to'](util[_0x4f80('0x21')](_0x4f80('0x26'),_0x2ca8ef[_0x4f80('0x9')]))['emit']('user:ami:update',_[_0x4f80('0x27')](_0x2ca8ef,[_0x4f80('0x13')]));io[_0x4f80('0x28')]('user:presence',_0x2ca8ef);}};module[_0x4f80('0x29')]=Agent; \ No newline at end of file +var _0xa1da=['status','address','phone','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','not_inuse','idle','talking','voiceStatus','toNumber','interface','stringify','format','user:%s','user:ami:update','emit','user:presence','exports','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xa1da,0xb0));var _0xaa1d=function(_0x2fa04a,_0x324bb9){_0x2fa04a=_0x2fa04a-0x0;var _0x145d62=_0xa1da[_0x2fa04a];return _0x145d62;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa1d('0x0'));var md5=require(_0xaa1d('0x1'));var Redis=require(_0xaa1d('0x2'));var config=require('../../../config/environment');config[_0xaa1d('0x3')]=_[_0xaa1d('0x4')](config[_0xaa1d('0x3')],{'host':_0xaa1d('0x5'),'port':0x18eb});var io=require(_0xaa1d('0x6'))(new Redis(config[_0xaa1d('0x3')]));function Agent(_0x128f41){this['id']=_0x128f41['id']||0x0;this[_0xaa1d('0x7')]=_0x128f41[_0xaa1d('0x7')]||'';this[_0xaa1d('0x8')]=_0x128f41[_0xaa1d('0x8')]||'';this[_0xaa1d('0x9')]=_0x128f41['accountcode']||'';this[_0xaa1d('0xa')]=_0x128f41[_0xaa1d('0xa')]||'';this[_0xaa1d('0xb')]=_0xaa1d('0xc');this[_0xaa1d('0xd')]=0x0;this[_0xaa1d('0xe')]=_0xaa1d('0xc');this[_0xaa1d('0xf')]='';this[_0xaa1d('0x10')]='';this[_0xaa1d('0x11')]='';this['interface']='';this['online']=_0x128f41[_0xaa1d('0x12')]||![];this['voiceStatus']=_0xaa1d('0xc');this[_0xaa1d('0x13')]=0x0;this[_0xaa1d('0x14')]='';this[_0xaa1d('0x15')]='';this[_0xaa1d('0x16')]=![];this[_0xaa1d('0x17')]=![];this['md5']='';}Agent['prototype'][_0xaa1d('0x18')]=function(_0x3eef2e){var _0x1277d0;if(_0x3eef2e&&_0x3eef2e[_0xaa1d('0xb')]){_0x1277d0=_0x3eef2e[_0xaa1d('0xb')]['toLowerCase']();switch(_0x1277d0){case _0xaa1d('0x19'):_0x1277d0=_0xaa1d('0x1a');break;case'inuse':_0x1277d0=_0xaa1d('0x1b');break;}}if(_0x1277d0&&this[_0xaa1d('0x1c')]!==_0x1277d0||_0x3eef2e['statePause']){this[_0xaa1d('0x13')]=_[_0xaa1d('0x1d')](moment()['format']('x'));}if(_0x1277d0){this[_0xaa1d('0x1c')]=_0x1277d0;}var _0x324de0={'id':this['id'],'name':this[_0xaa1d('0x7')],'email':this[_0xaa1d('0x8')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0xaa1d('0xd')],'status':this[_0xaa1d('0xe')],'address':this[_0xaa1d('0xf')],'online':this[_0xaa1d('0x12')],'voiceStatus':this[_0xaa1d('0x1c')],'voiceStatusTime':this[_0xaa1d('0x13')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xaa1d('0x15')],'interface':this[_0xaa1d('0x1e')],'onhold':this[_0xaa1d('0x16')]};var _0x3b9fd7=md5(JSON[_0xaa1d('0x1f')](_0x324de0));if(this[_0xaa1d('0x1')]!==_0x3b9fd7){this[_0xaa1d('0x1')]=_0x3b9fd7;io['to'](util[_0xaa1d('0x20')](_0xaa1d('0x21'),_0x324de0[_0xaa1d('0x7')]))['emit'](_0xaa1d('0x22'),_['omit'](_0x324de0,['online']));io[_0xaa1d('0x23')](_0xaa1d('0x24'),_0x324de0);}};module[_0xaa1d('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 8bea605..3d8b2cc 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 _0x2a2d=['dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','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','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2a2d,0x1c7));var _0xd2a2=function(_0x9d39e9,_0x3aebc9){_0x9d39e9=_0x9d39e9-0x0;var _0x4ac75b=_0x2a2d[_0x9d39e9];return _0x4ac75b;};'use strict';function Campaign(_0x4babd6){this['id']=_0x4babd6['id']||0x0;this[_0xd2a2('0x0')]=_0x4babd6[_0xd2a2('0x0')]||'';this[_0xd2a2('0x1')]=_0x4babd6[_0xd2a2('0x1')]||_0xd2a2('0x2');this[_0xd2a2('0x3')]=0x0;this[_0xd2a2('0x4')]=0x0;this[_0xd2a2('0x5')]=0x0;this[_0xd2a2('0x6')]=0x0;this[_0xd2a2('0x7')]='';this[_0xd2a2('0x8')]=!![];this[_0xd2a2('0x9')]=_0x4babd6[_0xd2a2('0x9')];this[_0xd2a2('0xa')]=_0x4babd6['limitCalls'];this['dialTimezone']=_0x4babd6[_0xd2a2('0xb')]||null;this[_0xd2a2('0xc')]=_0x4babd6[_0xd2a2('0xc')]?_0x4babd6[_0xd2a2('0xc')]:null;this['dialOriginateCallerIdName']=_0x4babd6[_0xd2a2('0xd')];this['dialOriginateCallerIdNumber']=_0x4babd6[_0xd2a2('0xe')];this[_0xd2a2('0xf')]=_0x4babd6[_0xd2a2('0xf')]||0x1e;this[_0xd2a2('0x10')]=_0x4babd6[_0xd2a2('0x10')];this[_0xd2a2('0x11')]=_0x4babd6[_0xd2a2('0x11')];this[_0xd2a2('0x12')]=_0x4babd6['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x4babd6[_0xd2a2('0x13')];this['dialNoAnswerMaxRetry']=_0x4babd6[_0xd2a2('0x14')];this[_0xd2a2('0x15')]=_0x4babd6[_0xd2a2('0x15')];this[_0xd2a2('0x16')]=_0x4babd6['dialGlobalMaxRetry'];this[_0xd2a2('0x17')]=_0x4babd6['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4babd6['dialNoSuchNumberRetryFrequency']||0x96;this[_0xd2a2('0x18')]=_0x4babd6[_0xd2a2('0x18')]||0x3;this[_0xd2a2('0x19')]=_0x4babd6[_0xd2a2('0x19')]||0x96;this[_0xd2a2('0x1a')]=_0x4babd6[_0xd2a2('0x1a')]||0x3;this[_0xd2a2('0x1b')]=_0x4babd6['dialAbandonedRetryFrequency']||0x96;this[_0xd2a2('0x1c')]=_0x4babd6[_0xd2a2('0x1c')]||0x3;this[_0xd2a2('0x1d')]=_0x4babd6[_0xd2a2('0x1d')]||0x96;this[_0xd2a2('0x1e')]=_0x4babd6[_0xd2a2('0x1e')]||0x3;this[_0xd2a2('0x1f')]=_0x4babd6[_0xd2a2('0x1f')]||0x96;this[_0xd2a2('0x20')]=_0x4babd6['dialOrderByScheduledAt']||_0xd2a2('0x21');this['dialPrefix']=_0x4babd6[_0xd2a2('0x22')]||undefined;this[_0xd2a2('0x23')]=_0x4babd6[_0xd2a2('0x23')]||undefined;this[_0xd2a2('0x24')]=_0x4babd6[_0xd2a2('0x24')]||undefined;this[_0xd2a2('0x25')]=_0x4babd6[_0xd2a2('0x25')]?_0x4babd6[_0xd2a2('0x25')]:undefined;this[_0xd2a2('0x26')]=_0x4babd6[_0xd2a2('0x26')]?_0x4babd6[_0xd2a2('0x26')]:undefined;this['Interval']=_0x4babd6[_0xd2a2('0x27')]?_0x4babd6[_0xd2a2('0x27')]:undefined;this[_0xd2a2('0x28')]=_0x4babd6[_0xd2a2('0x28')]?_0x4babd6[_0xd2a2('0x28')]:undefined;this[_0xd2a2('0x29')]=_0x4babd6[_0xd2a2('0x28')]?_0x4babd6[_0xd2a2('0x28')][_0xd2a2('0x0')]:undefined;this[_0xd2a2('0x2a')]=_0x4babd6['dialAMDActive']||![];this[_0xd2a2('0x2b')]=_0x4babd6[_0xd2a2('0x2b')];this[_0xd2a2('0x2c')]=_0x4babd6[_0xd2a2('0x2c')];this[_0xd2a2('0x2d')]=_0x4babd6['dialAMDAfterGreetingSilence'];this[_0xd2a2('0x2e')]=_0x4babd6[_0xd2a2('0x2e')];this['dialAMDMinWordLength']=_0x4babd6[_0xd2a2('0x2f')];this[_0xd2a2('0x30')]=_0x4babd6[_0xd2a2('0x30')];this[_0xd2a2('0x31')]=_0x4babd6[_0xd2a2('0x31')];this[_0xd2a2('0x32')]=_0x4babd6[_0xd2a2('0x32')];this[_0xd2a2('0x33')]=_0x4babd6[_0xd2a2('0x33')];}module[_0xd2a2('0x34')]=Campaign; \ No newline at end of file +var _0x90da=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x166945,_0x470405){var _0x495057=function(_0x3976f7){while(--_0x3976f7){_0x166945['push'](_0x166945['shift']());}};_0x495057(++_0x470405);}(_0x90da,0xa9));var _0xa90d=function(_0x485507,_0x9ab47f){_0x485507=_0x485507-0x0;var _0x1f79e7=_0x90da[_0x485507];return _0x1f79e7;};'use strict';function Campaign(_0x5c643e){this['id']=_0x5c643e['id']||0x0;this['name']=_0x5c643e[_0xa90d('0x0')]||'';this[_0xa90d('0x1')]=_0x5c643e[_0xa90d('0x1')]||_0xa90d('0x2');this[_0xa90d('0x3')]=0x0;this['temp']=0x0;this[_0xa90d('0x4')]=0x0;this[_0xa90d('0x5')]=0x0;this[_0xa90d('0x6')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x5c643e[_0xa90d('0x7')];this['limitCalls']=_0x5c643e[_0xa90d('0x8')];this[_0xa90d('0x9')]=_0x5c643e[_0xa90d('0x9')]||null;this[_0xa90d('0xa')]=_0x5c643e[_0xa90d('0xa')]?_0x5c643e['dialGlobalInterval']:null;this[_0xa90d('0xb')]=_0x5c643e[_0xa90d('0xb')];this[_0xa90d('0xc')]=_0x5c643e[_0xa90d('0xc')];this['dialOriginateTimeout']=_0x5c643e[_0xa90d('0xd')]||0x1e;this[_0xa90d('0xe')]=_0x5c643e[_0xa90d('0xe')];this['dialCongestionRetryFrequency']=_0x5c643e[_0xa90d('0xf')];this[_0xa90d('0x10')]=_0x5c643e['dialBusyMaxRetry'];this[_0xa90d('0x11')]=_0x5c643e[_0xa90d('0x11')];this[_0xa90d('0x12')]=_0x5c643e[_0xa90d('0x12')];this[_0xa90d('0x13')]=_0x5c643e['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x5c643e[_0xa90d('0x14')];this['dialNoSuchNumberMaxRetry']=_0x5c643e['dialNoSuchNumberMaxRetry']||0x3;this[_0xa90d('0x15')]=_0x5c643e[_0xa90d('0x15')]||0x96;this['dialDropMaxRetry']=_0x5c643e[_0xa90d('0x16')]||0x3;this[_0xa90d('0x17')]=_0x5c643e[_0xa90d('0x17')]||0x96;this[_0xa90d('0x18')]=_0x5c643e[_0xa90d('0x18')]||0x3;this[_0xa90d('0x19')]=_0x5c643e[_0xa90d('0x19')]||0x96;this[_0xa90d('0x1a')]=_0x5c643e['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x5c643e[_0xa90d('0x1b')]||0x96;this[_0xa90d('0x1c')]=_0x5c643e[_0xa90d('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5c643e[_0xa90d('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x5c643e['dialOrderByScheduledAt']||_0xa90d('0x1e');this[_0xa90d('0x1f')]=_0x5c643e['dialPrefix']||undefined;this[_0xa90d('0x20')]=_0x5c643e[_0xa90d('0x20')]||undefined;this[_0xa90d('0x21')]=_0x5c643e[_0xa90d('0x21')]||undefined;this[_0xa90d('0x22')]=_0x5c643e[_0xa90d('0x22')]?_0x5c643e[_0xa90d('0x22')]:undefined;this[_0xa90d('0x23')]=_0x5c643e['Trunk']?_0x5c643e['Trunk']:undefined;this[_0xa90d('0x24')]=_0x5c643e['Interval']?_0x5c643e[_0xa90d('0x24')]:undefined;this[_0xa90d('0x25')]=_0x5c643e[_0xa90d('0x25')]?_0x5c643e[_0xa90d('0x25')]:undefined;this[_0xa90d('0x26')]=_0x5c643e[_0xa90d('0x25')]?_0x5c643e[_0xa90d('0x25')]['name']:undefined;this[_0xa90d('0x27')]=_0x5c643e['dialAMDActive']||![];this[_0xa90d('0x28')]=_0x5c643e[_0xa90d('0x28')];this[_0xa90d('0x29')]=_0x5c643e[_0xa90d('0x29')];this[_0xa90d('0x2a')]=_0x5c643e[_0xa90d('0x2a')];this[_0xa90d('0x2b')]=_0x5c643e['dialAMDTotalAnalysisTime'];this[_0xa90d('0x2c')]=_0x5c643e[_0xa90d('0x2c')];this[_0xa90d('0x2d')]=_0x5c643e[_0xa90d('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x5c643e['dialAMDMaximumNumberOfWords'];this[_0xa90d('0x2e')]=_0x5c643e['dialAMDSilenceThreshold'];this[_0xa90d('0x2f')]=_0x5c643e[_0xa90d('0x2f')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index addaa0c..0a77bc6 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 _0x0abf=['monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','holdtime','type','tag'];(function(_0x69b0bf,_0x248a70){var _0x53a201=function(_0x5d1c3f){while(--_0x5d1c3f){_0x69b0bf['push'](_0x69b0bf['shift']());}};_0x53a201(++_0x248a70);}(_0x0abf,0xe8));var _0xf0ab=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0abf[_0x14add3];return _0x4a174f;};'use strict';function Channel(){this[_0xf0ab('0x0')]=null;this['channel']='';this[_0xf0ab('0x1')]='';this[_0xf0ab('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0xf0ab('0x3')]=undefined;this['accountcode']=0x0;this[_0xf0ab('0x4')]='';this[_0xf0ab('0x5')]=0x0;this[_0xf0ab('0x6')]=0x0;this[_0xf0ab('0x7')]=0x0;this[_0xf0ab('0x8')]=![];this[_0xf0ab('0x9')]=null;this[_0xf0ab('0xa')]=null;this['unmanaged']=![];this[_0xf0ab('0xb')]=![];this[_0xf0ab('0xc')]='';this[_0xf0ab('0xd')]='';this[_0xf0ab('0xe')]=0x0;this['billableseconds']=0x0;this[_0xf0ab('0xf')]=0x0;this[_0xf0ab('0x10')]=null;this[_0xf0ab('0x11')]=null;this['disposition']=null;this['monitor']=![];this[_0xf0ab('0x12')]=null;this['queue']=null;this[_0xf0ab('0x13')]=[];this[_0xf0ab('0x14')]=undefined;this[_0xf0ab('0x15')]=undefined;this[_0xf0ab('0x16')]=undefined;this[_0xf0ab('0x17')]=0x0;}module[_0xf0ab('0x18')]=Channel; \ No newline at end of file +var _0x1a85=['unmanaged','abandoned','lastdata','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','destinationchannel','calleridnum','calleridname','accountcode','context','uniqueid','exten','answertime'];(function(_0x5a3ee9,_0x11ed55){var _0x45032c=function(_0x13a1ab){while(--_0x13a1ab){_0x5a3ee9['push'](_0x5a3ee9['shift']());}};_0x45032c(++_0x11ed55);}(_0x1a85,0x178));var _0x51a8=function(_0x30b094,_0x555417){_0x30b094=_0x30b094-0x0;var _0x4337f3=_0x1a85[_0x30b094];return _0x4337f3;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x51a8('0x0')]='';this[_0x51a8('0x1')]=0x0;this[_0x51a8('0x2')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x51a8('0x3')]=0x0;this[_0x51a8('0x4')]='';this[_0x51a8('0x5')]=0x0;this['linkedid']=0x0;this[_0x51a8('0x6')]=0x0;this['answered']=![];this[_0x51a8('0x7')]=null;this['endtime']=null;this[_0x51a8('0x8')]=![];this[_0x51a8('0x9')]=![];this['lastapplication']='';this[_0x51a8('0xa')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x51a8('0xb')]=0x0;this[_0x51a8('0xc')]=null;this[_0x51a8('0xd')]=null;this[_0x51a8('0xe')]=null;this[_0x51a8('0xf')]=![];this[_0x51a8('0x10')]=null;this[_0x51a8('0x11')]=null;this[_0x51a8('0x12')]=[];this[_0x51a8('0x13')]=undefined;this[_0x51a8('0x14')]=undefined;this[_0x51a8('0x15')]=undefined;this[_0x51a8('0x16')]=0x0;}module[_0x51a8('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 898de77..8dcb482 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 _0xad07=['username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad07,0xbf));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x218471){this['id']=_0x218471['id']||0x0;this[_0x7ad0('0x0')]=_0x218471[_0x7ad0('0x0')]||'';this[_0x7ad0('0x1')]=_0x218471[_0x7ad0('0x1')]||'';this[_0x7ad0('0x2')]=_0x218471[_0x7ad0('0x2')]||'';this['authType']=_0x218471['authType']||'';this[_0x7ad0('0x3')]=_0x218471[_0x7ad0('0x3')]||'';this[_0x7ad0('0x4')]=_0x218471[_0x7ad0('0x4')]||'';this[_0x7ad0('0x5')]=_0x218471[_0x7ad0('0x5')]||'';this['token']=_0x218471[_0x7ad0('0x6')]||'';this[_0x7ad0('0x7')]=_0x218471[_0x7ad0('0x7')]||'';this[_0x7ad0('0x8')]=_0x218471[_0x7ad0('0x8')]||'';this[_0x7ad0('0x9')]=_0x218471[_0x7ad0('0x9')]||'';this[_0x7ad0('0xa')]=_0x218471['Configurations']||{};}module[_0x7ad0('0xb')]=DeskAccount; \ No newline at end of file +var _0x203b=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x203b,0x9f));var _0xb203=function(_0x280820,_0x5b7eca){_0x280820=_0x280820-0x0;var _0x317378=_0x203b[_0x280820];return _0x317378;};'use strict';function DeskAccount(_0x171564){this['id']=_0x171564['id']||0x0;this[_0xb203('0x0')]=_0x171564[_0xb203('0x0')]||'';this['username']=_0x171564[_0xb203('0x1')]||'';this[_0xb203('0x2')]=_0x171564[_0xb203('0x2')]||'';this[_0xb203('0x3')]=_0x171564[_0xb203('0x3')]||'';this[_0xb203('0x4')]=_0x171564[_0xb203('0x4')]||'';this[_0xb203('0x5')]=_0x171564[_0xb203('0x5')]||'';this[_0xb203('0x6')]=_0x171564[_0xb203('0x6')]||'';this[_0xb203('0x7')]=_0x171564[_0xb203('0x7')]||'';this[_0xb203('0x8')]=_0x171564[_0xb203('0x8')]||'';this[_0xb203('0x9')]=_0x171564[_0xb203('0x9')]||'';this['serverUrl']=_0x171564[_0xb203('0xa')]||'';this[_0xb203('0xb')]=_0x171564['Configurations']||{};}module[_0xb203('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index e2debcb..2d95dea 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 _0x2737=['exports','username','password','remoteUri','tenantId','clientId','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x27b283,_0x8bb83b){var _0x4dcaf3=function(_0x526743){while(--_0x526743){_0x27b283['push'](_0x27b283['shift']());}};_0x4dcaf3(++_0x8bb83b);}(_0x2737,0xdd));var _0x7273=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2737[_0xbca1b1];return _0x4e1686;};'use strict';function Dynamics365Account(_0x16985d){this['id']=_0x16985d['id']||0x0;this['name']=_0x16985d['name']||'';this[_0x7273('0x0')]=_0x16985d[_0x7273('0x0')]||'';this[_0x7273('0x1')]=_0x16985d[_0x7273('0x1')]||'';this[_0x7273('0x2')]=_0x16985d[_0x7273('0x2')]||'';this[_0x7273('0x3')]=_0x16985d[_0x7273('0x3')]||'';this[_0x7273('0x4')]=_0x16985d[_0x7273('0x4')]||'';this['clientSecret']=_0x16985d['clientSecret']||{};this[_0x7273('0x5')]=_0x16985d[_0x7273('0x5')]||'';this[_0x7273('0x6')]=_0x16985d['modernAuthentication']||![];this['Configurations']=_0x16985d[_0x7273('0x7')]||{};this['CloudProvider']=_0x16985d[_0x7273('0x8')]||{};}module[_0x7273('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x0215=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x511b30,_0x16a9bf){var _0x32371e=function(_0x5b95c7){while(--_0x5b95c7){_0x511b30['push'](_0x511b30['shift']());}};_0x32371e(++_0x16a9bf);}(_0x0215,0x90));var _0x5021=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0x0215[_0x599c94];return _0x34e215;};'use strict';function Dynamics365Account(_0xb3bed8){this['id']=_0xb3bed8['id']||0x0;this['name']=_0xb3bed8[_0x5021('0x0')]||'';this[_0x5021('0x1')]=_0xb3bed8['username']||'';this[_0x5021('0x2')]=_0xb3bed8[_0x5021('0x2')]||'';this[_0x5021('0x3')]=_0xb3bed8[_0x5021('0x3')]||'';this[_0x5021('0x4')]=_0xb3bed8[_0x5021('0x4')]||'';this[_0x5021('0x5')]=_0xb3bed8[_0x5021('0x5')]||'';this[_0x5021('0x6')]=_0xb3bed8[_0x5021('0x6')]||{};this['serverUrl']=_0xb3bed8[_0x5021('0x7')]||'';this[_0x5021('0x8')]=_0xb3bed8[_0x5021('0x8')]||![];this[_0x5021('0x9')]=_0xb3bed8[_0x5021('0x9')]||{};this[_0x5021('0xa')]=_0xb3bed8[_0x5021('0xa')]||{};}module[_0x5021('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 8f3b252..8418a9f 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 _0xd012=['Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x2fdf6a,_0x11071a){var _0x3a53f8=function(_0x442686){while(--_0x442686){_0x2fdf6a['push'](_0x2fdf6a['shift']());}};_0x3a53f8(++_0x11071a);}(_0xd012,0xe3));var _0x2d01=function(_0x4c1c2f,_0x541c58){_0x4c1c2f=_0x4c1c2f-0x0;var _0x25d783=_0xd012[_0x4c1c2f];return _0x25d783;};'use strict';function FaxAccount(_0x45a8e0){this['id']=_0x45a8e0['id']||0x0;this[_0x2d01('0x0')]=_0x45a8e0[_0x2d01('0x0')]||'';this[_0x2d01('0x1')]=_0x45a8e0[_0x2d01('0x1')];this[_0x2d01('0x2')]=_0x45a8e0[_0x2d01('0x2')];this[_0x2d01('0x3')]=_0x45a8e0[_0x2d01('0x3')];this[_0x2d01('0x4')]=_0x45a8e0[_0x2d01('0x4')];this[_0x2d01('0x5')]=_0x45a8e0[_0x2d01('0x5')]||0x960;this[_0x2d01('0x6')]=_0x45a8e0['maxrate']||0x3840;this[_0x2d01('0x7')]=_0x45a8e0[_0x2d01('0x7')]||'v17,v27,v29';this['gateway']=_0x45a8e0[_0x2d01('0x8')]||'no';this['faxdetect']=_0x45a8e0[_0x2d01('0x9')]||'no';this[_0x2d01('0xa')]=_0x45a8e0[_0x2d01('0xa')]||0x1388;this[_0x2d01('0xb')]=_0x45a8e0[_0x2d01('0xb')]||_0x2d01('0xc');this[_0x2d01('0xd')]=_0x45a8e0['Trunk']?_0x45a8e0[_0x2d01('0xd')]:undefined;this[_0x2d01('0xe')]=_0x45a8e0[_0x2d01('0xe')];this[_0x2d01('0xf')]=_0x45a8e0[_0x2d01('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x728b=['SIP','Trunk','ListId','key','exports','name','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0x451980,_0x2ad060){var _0x3a66cf=function(_0x365204){while(--_0x365204){_0x451980['push'](_0x451980['shift']());}};_0x3a66cf(++_0x2ad060);}(_0x728b,0x126));var _0xb728=function(_0x1c6231,_0x229278){_0x1c6231=_0x1c6231-0x0;var _0x2075a0=_0x728b[_0x1c6231];return _0x2075a0;};'use strict';function FaxAccount(_0x5a4ba5){this['id']=_0x5a4ba5['id']||0x0;this['name']=_0x5a4ba5[_0xb728('0x0')]||'';this[_0xb728('0x1')]=_0x5a4ba5[_0xb728('0x1')];this[_0xb728('0x2')]=_0x5a4ba5[_0xb728('0x2')];this['headerinfo']=_0x5a4ba5['headerinfo'];this[_0xb728('0x3')]=_0x5a4ba5['localstationid'];this[_0xb728('0x4')]=_0x5a4ba5['minrate']||0x960;this['maxrate']=_0x5a4ba5[_0xb728('0x5')]||0x3840;this[_0xb728('0x6')]=_0x5a4ba5[_0xb728('0x6')]||_0xb728('0x7');this['gateway']=_0x5a4ba5[_0xb728('0x8')]||'no';this[_0xb728('0x9')]=_0x5a4ba5['faxdetect']||'no';this[_0xb728('0xa')]=_0x5a4ba5[_0xb728('0xa')]||0x1388;this[_0xb728('0xb')]=_0x5a4ba5[_0xb728('0xb')]||_0xb728('0xc');this['Trunk']=_0x5a4ba5[_0xb728('0xd')]?_0x5a4ba5[_0xb728('0xd')]:undefined;this[_0xb728('0xe')]=_0x5a4ba5['ListId'];this[_0xb728('0xf')]=_0x5a4ba5[_0xb728('0xf')];}module[_0xb728('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 98d385c..e23da6c 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 _0xc1ac=['name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x4aadab,_0x378b5c){var _0x1f99a0=function(_0x7d36f9){while(--_0x7d36f9){_0x4aadab['push'](_0x4aadab['shift']());}};_0x1f99a0(++_0x378b5c);}(_0xc1ac,0xde));var _0xcc1a=function(_0x58822b,_0x2fa6c3){_0x58822b=_0x58822b-0x0;var _0x48a8c8=_0xc1ac[_0x58822b];return _0x48a8c8;};'use strict';function FreshdeskAccount(_0x53955c){this['id']=_0x53955c['id']||0x0;this[_0xcc1a('0x0')]=_0x53955c['name']||'';this[_0xcc1a('0x1')]=_0x53955c[_0xcc1a('0x1')]||'';this[_0xcc1a('0x2')]=_0x53955c['token']||'';this[_0xcc1a('0x3')]=_0x53955c[_0xcc1a('0x3')]||'';this[_0xcc1a('0x4')]=_0x53955c[_0xcc1a('0x4')]||'';this[_0xcc1a('0x5')]=_0x53955c['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xc5ce=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x25562a,_0x3d6063){var _0x1a2d01=function(_0x1c1855){while(--_0x1c1855){_0x25562a['push'](_0x25562a['shift']());}};_0x1a2d01(++_0x3d6063);}(_0xc5ce,0x112));var _0xec5c=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc5ce[_0x5d2803];return _0xdcad2c;};'use strict';function FreshdeskAccount(_0x2f48ba){this['id']=_0x2f48ba['id']||0x0;this[_0xec5c('0x0')]=_0x2f48ba[_0xec5c('0x0')]||'';this[_0xec5c('0x1')]=_0x2f48ba[_0xec5c('0x1')]||'';this[_0xec5c('0x2')]=_0x2f48ba[_0xec5c('0x3')]||'';this[_0xec5c('0x4')]=_0x2f48ba['remoteUri']||'';this[_0xec5c('0x5')]=_0x2f48ba[_0xec5c('0x5')]||'';this[_0xec5c('0x6')]=_0x2f48ba[_0xec5c('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 99359f8..288eefb 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 _0x4006=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x655268,_0x90fd8){var _0x2840c8=function(_0x20a984){while(--_0x20a984){_0x655268['push'](_0x655268['shift']());}};_0x2840c8(++_0x90fd8);}(_0x4006,0x1c7));var _0x6400=function(_0x1583fa,_0x201e17){_0x1583fa=_0x1583fa-0x0;var _0x11b21a=_0x4006[_0x1583fa];return _0x11b21a;};'use strict';function FreshsalesAccount(_0x2ed8d6){this['id']=_0x2ed8d6['id']||0x0;this[_0x6400('0x0')]=_0x2ed8d6[_0x6400('0x0')]||'';this[_0x6400('0x1')]=_0x2ed8d6[_0x6400('0x1')]||'';this['apiKey']=_0x2ed8d6['token']||'';this[_0x6400('0x2')]=_0x2ed8d6['remoteUri']||'';this[_0x6400('0x3')]=_0x2ed8d6['serverUrl']||'';this['Configurations']=_0x2ed8d6[_0x6400('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x61df=['serverUrl','Configurations','exports','username','token','remoteUri'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0x61df,0xbd));var _0xf61d=function(_0x1d4a64,_0x5a5162){_0x1d4a64=_0x1d4a64-0x0;var _0x404962=_0x61df[_0x1d4a64];return _0x404962;};'use strict';function FreshsalesAccount(_0x6f613e){this['id']=_0x6f613e['id']||0x0;this['name']=_0x6f613e['name']||'';this[_0xf61d('0x0')]=_0x6f613e[_0xf61d('0x0')]||'';this['apiKey']=_0x6f613e[_0xf61d('0x1')]||'';this[_0xf61d('0x2')]=_0x6f613e['remoteUri']||'';this[_0xf61d('0x3')]=_0x6f613e[_0xf61d('0x3')]||'';this[_0xf61d('0x4')]=_0x6f613e[_0xf61d('0x4')]||{};}module[_0xf61d('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index e0c31a3..a823014 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 _0xc3e0=['queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','assigned','voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xc3e0,0xf6));var _0x0c3e=function(_0x3101e2,_0x1dcacc){_0x3101e2=_0x3101e2-0x0;var _0xef19b6=_0xc3e0[_0x3101e2];return _0xef19b6;};'use strict';function QueueReport(){this[_0x0c3e('0x0')]=_0x0c3e('0x1');this[_0x0c3e('0x2')]='';this[_0x0c3e('0x3')]='';this['calleridname']='';this[_0x0c3e('0x4')]='';this[_0x0c3e('0x5')]=null;this[_0x0c3e('0x6')]=null;this['position']=0x1;this[_0x0c3e('0x7')]=0x1;this['queuecallerabandon']=![];this[_0x0c3e('0x8')]=null;this['queuecallercomplete']=![];this[_0x0c3e('0x9')]=null;this[_0x0c3e('0xa')]=![];this[_0x0c3e('0xb')]=null;this[_0x0c3e('0xc')]=0x1;this[_0x0c3e('0xd')]='';this[_0x0c3e('0xe')]='';this[_0x0c3e('0xf')]='';this[_0x0c3e('0x10')]='';this['context']='';this[_0x0c3e('0x11')]='';this[_0x0c3e('0x12')]='';this['holdtime']=0x0;this[_0x0c3e('0x13')]=![];this['lastAssignedTo']='';this['motionChannel']=_0x0c3e('0x14');this[_0x0c3e('0x15')]=null;this[_0x0c3e('0x16')]=0x0;this[_0x0c3e('0x17')]={};}module[_0x0c3e('0x18')]=QueueReport; \ No newline at end of file +var _0xeec0=['voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xeec0,0x1eb));var _0x0eec=function(_0x3a355b,_0x195b35){_0x3a355b=_0x3a355b-0x0;var _0x2235d6=_0xeec0[_0x3a355b];return _0x2235d6;};'use strict';function QueueReport(){this[_0x0eec('0x0')]=_0x0eec('0x1');this[_0x0eec('0x2')]='';this[_0x0eec('0x3')]='';this['calleridname']='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x0eec('0x4')]=null;this[_0x0eec('0x5')]=0x1;this['count']=0x1;this[_0x0eec('0x6')]=![];this[_0x0eec('0x7')]=null;this['queuecallercomplete']=![];this[_0x0eec('0x8')]=null;this[_0x0eec('0x9')]=![];this['queuecallerexitAt']=null;this[_0x0eec('0xa')]=0x1;this[_0x0eec('0xb')]='';this[_0x0eec('0xc')]='';this[_0x0eec('0xd')]='';this[_0x0eec('0xe')]='';this[_0x0eec('0xf')]='';this[_0x0eec('0x10')]='';this[_0x0eec('0x11')]='';this[_0x0eec('0x12')]=0x0;this[_0x0eec('0x13')]=![];this[_0x0eec('0x14')]='';this[_0x0eec('0x15')]=_0x0eec('0x16');this[_0x0eec('0x17')]=null;this[_0x0eec('0x18')]=0x0;this[_0x0eec('0x19')]={};}module[_0x0eec('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 7d8adc4..c1bf6b7 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 _0x1baf=['type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x2aaf7d,_0x4d4084){var _0x3d177d=function(_0x3c2295){while(--_0x3c2295){_0x2aaf7d['push'](_0x2aaf7d['shift']());}};_0x3d177d(++_0x4d4084);}(_0x1baf,0x14e));var _0xf1ba=function(_0x1ac823,_0x3ff2e5){_0x1ac823=_0x1ac823-0x0;var _0x53f19d=_0x1baf[_0x1ac823];return _0x53f19d;};'use strict';function SalesforceAccount(_0x2a75fa){this['id']=_0x2a75fa['id']||0x0;this[_0xf1ba('0x0')]=_0x2a75fa[_0xf1ba('0x0')]||'';this['username']=_0x2a75fa[_0xf1ba('0x1')]||'';this[_0xf1ba('0x2')]=_0x2a75fa[_0xf1ba('0x2')]||'';this[_0xf1ba('0x3')]=_0x2a75fa[_0xf1ba('0x3')]||'';this[_0xf1ba('0x4')]=_0x2a75fa['clientId']||'';this[_0xf1ba('0x5')]=_0x2a75fa[_0xf1ba('0x5')]||'';this['securityToken']=_0x2a75fa['securityToken']||'';this[_0xf1ba('0x6')]=_0x2a75fa[_0xf1ba('0x6')]||_0xf1ba('0x7');this[_0xf1ba('0x8')]=_0x2a75fa[_0xf1ba('0x8')]||'';this[_0xf1ba('0x9')]=_0x2a75fa[_0xf1ba('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x0c8d=['name','username','remoteUri','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0xcae49f,_0x58bcb9){var _0x5700d3=function(_0x39a4ee){while(--_0x39a4ee){_0xcae49f['push'](_0xcae49f['shift']());}};_0x5700d3(++_0x58bcb9);}(_0x0c8d,0x79));var _0xd0c8=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x0c8d[_0x5c2e3e];return _0x53f64a;};'use strict';function SalesforceAccount(_0x58354d){this['id']=_0x58354d['id']||0x0;this[_0xd0c8('0x0')]=_0x58354d[_0xd0c8('0x0')]||'';this[_0xd0c8('0x1')]=_0x58354d[_0xd0c8('0x1')]||'';this[_0xd0c8('0x2')]=_0x58354d['remoteUri']||'';this['password']=_0x58354d['password']||'';this['clientId']=_0x58354d[_0xd0c8('0x3')]||'';this[_0xd0c8('0x4')]=_0x58354d[_0xd0c8('0x4')]||'';this['securityToken']=_0x58354d[_0xd0c8('0x5')]||'';this['type']=_0x58354d[_0xd0c8('0x6')]||_0xd0c8('0x7');this[_0xd0c8('0x8')]=_0x58354d[_0xd0c8('0x8')]||'';this[_0xd0c8('0x9')]=_0x58354d['Configurations']||{};}module[_0xd0c8('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 67e2103..f516523 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 _0x01c9=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0x1e7077,_0x3e57b3){var _0x2bb221=function(_0x4452e2){while(--_0x4452e2){_0x1e7077['push'](_0x1e7077['shift']());}};_0x2bb221(++_0x3e57b3);}(_0x01c9,0x16e));var _0x901c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01c9[_0x20a584];return _0x4b41a8;};'use strict';function ServicenowAccount(_0x1265f7){this['id']=_0x1265f7['id']||0x0;this['name']=_0x1265f7[_0x901c('0x0')]||'';this[_0x901c('0x1')]=_0x1265f7[_0x901c('0x1')]||'';this['password']=_0x1265f7['password']||'';this['remoteUri']=_0x1265f7[_0x901c('0x2')]||'';this['serverUrl']=_0x1265f7[_0x901c('0x3')]||'';this[_0x901c('0x4')]=_0x1265f7[_0x901c('0x4')]||{};}module[_0x901c('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x237e=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x56f75c,_0x32b053){var _0x34ba47=function(_0xc90be2){while(--_0xc90be2){_0x56f75c['push'](_0x56f75c['shift']());}};_0x34ba47(++_0x32b053);}(_0x237e,0x1a8));var _0xe237=function(_0x537935,_0x10cec3){_0x537935=_0x537935-0x0;var _0x2279dc=_0x237e[_0x537935];return _0x2279dc;};'use strict';function ServicenowAccount(_0x65c7c8){this['id']=_0x65c7c8['id']||0x0;this[_0xe237('0x0')]=_0x65c7c8[_0xe237('0x0')]||'';this[_0xe237('0x1')]=_0x65c7c8[_0xe237('0x1')]||'';this[_0xe237('0x2')]=_0x65c7c8[_0xe237('0x2')]||'';this[_0xe237('0x3')]=_0x65c7c8[_0xe237('0x3')]||'';this[_0xe237('0x4')]=_0x65c7c8[_0xe237('0x4')]||'';this[_0xe237('0x5')]=_0x65c7c8[_0xe237('0x5')]||{};}module[_0xe237('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index b614bc1..c36c9ee 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 _0xb786=['serverUrl','Configurations','username','password','remoteUri'];(function(_0x44fef1,_0x132cf4){var _0x3c3a04=function(_0x175a90){while(--_0x175a90){_0x44fef1['push'](_0x44fef1['shift']());}};_0x3c3a04(++_0x132cf4);}(_0xb786,0x179));var _0x6b78=function(_0x58a4b5,_0x182439){_0x58a4b5=_0x58a4b5-0x0;var _0x51821d=_0xb786[_0x58a4b5];return _0x51821d;};'use strict';function SugarcrmAccount(_0x42f64a){this['id']=_0x42f64a['id']||0x0;this['name']=_0x42f64a['name']||'';this[_0x6b78('0x0')]=_0x42f64a[_0x6b78('0x0')]||'';this[_0x6b78('0x1')]=_0x42f64a['password']||'';this['remoteUri']=_0x42f64a[_0x6b78('0x2')]||'';this[_0x6b78('0x3')]=_0x42f64a['serverUrl']||'';this[_0x6b78('0x4')]=_0x42f64a[_0x6b78('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xdc2c=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4ede2d,_0x3a10e3){var _0x3cb57a=function(_0x2d7c04){while(--_0x2d7c04){_0x4ede2d['push'](_0x4ede2d['shift']());}};_0x3cb57a(++_0x3a10e3);}(_0xdc2c,0x11d));var _0xcdc2=function(_0x377d49,_0x273eb6){_0x377d49=_0x377d49-0x0;var _0x3fe875=_0xdc2c[_0x377d49];return _0x3fe875;};'use strict';function SugarcrmAccount(_0x3453f2){this['id']=_0x3453f2['id']||0x0;this[_0xcdc2('0x0')]=_0x3453f2[_0xcdc2('0x0')]||'';this[_0xcdc2('0x1')]=_0x3453f2[_0xcdc2('0x1')]||'';this[_0xcdc2('0x2')]=_0x3453f2[_0xcdc2('0x2')]||'';this[_0xcdc2('0x3')]=_0x3453f2['remoteUri']||'';this[_0xcdc2('0x4')]=_0x3453f2[_0xcdc2('0x4')]||'';this[_0xcdc2('0x5')]=_0x3453f2[_0xcdc2('0x5')]||{};}module[_0xcdc2('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 78626f2..d7e3d31 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 _0xb10d=['accountcode','state','unknown','stateTime','status','address','exports','name'];(function(_0x1f31c3,_0x5bef05){var _0x46ed9c=function(_0x257201){while(--_0x257201){_0x1f31c3['push'](_0x1f31c3['shift']());}};_0x46ed9c(++_0x5bef05);}(_0xb10d,0x17f));var _0xdb10=function(_0x20a930,_0x1f2361){_0x20a930=_0x20a930-0x0;var _0x594268=_0xb10d[_0x20a930];return _0x594268;};'use strict';function Telephone(_0x27394b){this['id']=_0x27394b['id']||0x0;this['name']=_0x27394b[_0xdb10('0x0')]||'';this[_0xdb10('0x1')]=_0x27394b[_0xdb10('0x1')]||'';this[_0xdb10('0x2')]=_0xdb10('0x3');this[_0xdb10('0x4')]=0x0;this[_0xdb10('0x5')]=_0xdb10('0x3');this[_0xdb10('0x6')]='';}module[_0xdb10('0x7')]=Telephone; \ No newline at end of file +var _0xf330=['stateTime','exports','name','accountcode','unknown'];(function(_0x5e8904,_0x422ad7){var _0x14517d=function(_0x2236f8){while(--_0x2236f8){_0x5e8904['push'](_0x5e8904['shift']());}};_0x14517d(++_0x422ad7);}(_0xf330,0x147));var _0x0f33=function(_0x137681,_0x456c89){_0x137681=_0x137681-0x0;var _0x10a95a=_0xf330[_0x137681];return _0x10a95a;};'use strict';function Telephone(_0x357dc9){this['id']=_0x357dc9['id']||0x0;this['name']=_0x357dc9[_0x0f33('0x0')]||'';this[_0x0f33('0x1')]=_0x357dc9[_0x0f33('0x1')]||'';this['state']=_0x0f33('0x2');this[_0x0f33('0x3')]=0x0;this['status']=_0x0f33('0x2');this['address']='';}module[_0x0f33('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 353ad8c..bd97476 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 _0xa9e0=['exports','name'];(function(_0x1f4cce,_0x201785){var _0x1418b5=function(_0x62e456){while(--_0x62e456){_0x1f4cce['push'](_0x1f4cce['shift']());}};_0x1418b5(++_0x201785);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 +var _0xa9e0=['exports','name'];(function(_0x16b397,_0x23cb1c){var _0x50319e=function(_0x252d8b){while(--_0x252d8b){_0x16b397['push'](_0x16b397['shift']());}};_0x50319e(++_0x23cb1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 8abd051..bfbe0f8 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 _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x141e87,_0x98a1c9){var _0x5331e0=function(_0x19934f){while(--_0x19934f){_0x141e87['push'](_0x141e87['shift']());}};_0x5331e0(++_0x98a1c9);}(_0xda2d,0x102));var _0xdda2=function(_0x390863,_0x17cb04){_0x390863=_0x390863-0x0;var _0x2241d1=_0xda2d[_0x390863];return _0x2241d1;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 831981c..8bb9dc5 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 _0x7bf2=['port','domain','domainport','refresh','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','split','host'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x7bf2,0xd4));var _0x27bf=function(_0x1dffc4,_0x3ab29e){_0x1dffc4=_0x1dffc4-0x0;var _0xb878c6=_0x7bf2[_0x1dffc4];return _0xb878c6;};'use strict';function Trunk(_0x25129e){this['id']=_0x25129e['id']||0x0;this[_0x27bf('0x0')]=_0x25129e[_0x27bf('0x0')]||![];this[_0x27bf('0x1')]=_0x25129e[_0x27bf('0x1')]||'';this[_0x27bf('0x2')]=_0x27bf('0x3');this[_0x27bf('0x4')]=0x0;this[_0x27bf('0x5')]=_0x27bf('0x3');this['registry']=_0x25129e[_0x27bf('0x6')]&&_0x25129e[_0x27bf('0x6')]['indexOf'](':')?_0x25129e[_0x27bf('0x6')][_0x27bf('0x7')](':')[0x0]:'';this[_0x27bf('0x8')]='';this[_0x27bf('0x9')]='';this[_0x27bf('0xa')]='';this[_0x27bf('0xb')]='';this[_0x27bf('0xc')]='';this['stateRegistry']=_0x27bf('0x3');this[_0x27bf('0xd')]='';this[_0x27bf('0xe')]='';this[_0x27bf('0xf')]=_0x25129e[_0x27bf('0xf')]||'';}module[_0x27bf('0x10')]=Trunk; \ No newline at end of file +var _0x7d59=['stateRegistry','defaultuser','exports','name','state','unknown','stateTime','status','registry','split','host','domain'];(function(_0x236303,_0xf81391){var _0x1729a6=function(_0x4ee6ad){while(--_0x4ee6ad){_0x236303['push'](_0x236303['shift']());}};_0x1729a6(++_0xf81391);}(_0x7d59,0x10b));var _0x97d5=function(_0x5b4a57,_0x256746){_0x5b4a57=_0x5b4a57-0x0;var _0x350ead=_0x7d59[_0x5b4a57];return _0x350ead;};'use strict';function Trunk(_0x47ac01){this['id']=_0x47ac01['id']||0x0;this['active']=_0x47ac01['active']||![];this[_0x97d5('0x0')]=_0x47ac01[_0x97d5('0x0')]||'';this[_0x97d5('0x1')]=_0x97d5('0x2');this[_0x97d5('0x3')]=0x0;this[_0x97d5('0x4')]=_0x97d5('0x2');this['registry']=_0x47ac01[_0x97d5('0x5')]&&_0x47ac01[_0x97d5('0x5')]['indexOf'](':')?_0x47ac01[_0x97d5('0x5')][_0x97d5('0x6')](':')[0x0]:'';this[_0x97d5('0x7')]='';this['port']='';this[_0x97d5('0x8')]='';this['domainport']='';this['refresh']='';this[_0x97d5('0x9')]=_0x97d5('0x2');this['registrationtime']='';this['address']='';this[_0x97d5('0xa')]=_0x47ac01[_0x97d5('0xa')]||'';}module[_0x97d5('0xb')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 8b55f14..3116e28 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 _0xbd00=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0xa9e7f6,_0x3b6a74){var _0x17c7a4=function(_0x3b0de9){while(--_0x3b0de9){_0xa9e7f6['push'](_0xa9e7f6['shift']());}};_0x17c7a4(++_0x3b6a74);}(_0xbd00,0x147));var _0x0bd0=function(_0x1e441f,_0x51dcad){_0x1e441f=_0x1e441f-0x0;var _0x5dc8d4=_0xbd00[_0x1e441f];return _0x5dc8d4;};'use strict';function voiceExtension(_0x578088){this['id']=_0x578088['id']||0x0;this['exten']=_0x578088[_0x0bd0('0x0')]||'';this[_0x0bd0('0x1')]=_0x578088[_0x0bd0('0x1')]||'none';this[_0x0bd0('0x2')]=_0x578088[_0x0bd0('0x2')]||![];}module[_0x0bd0('0x3')]=voiceExtension; \ No newline at end of file +var _0xe823=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x5c3134,_0x3ad683){var _0x3cdae3=function(_0x25d3bc){while(--_0x25d3bc){_0x5c3134['push'](_0x5c3134['shift']());}};_0x3cdae3(++_0x3ad683);}(_0xe823,0x14a));var _0x3e82=function(_0x339173,_0x12d37c){_0x339173=_0x339173-0x0;var _0xcd36eb=_0xe823[_0x339173];return _0xcd36eb;};'use strict';function voiceExtension(_0x623cc8){this['id']=_0x623cc8['id']||0x0;this[_0x3e82('0x0')]=_0x623cc8[_0x3e82('0x0')]||'';this[_0x3e82('0x1')]=_0x623cc8[_0x3e82('0x1')]||_0x3e82('0x2');this[_0x3e82('0x3')]=_0x623cc8[_0x3e82('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index e420e0c..1a00044 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 _0x4da5=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','linear','ringall','roundrobin','rrmemory','rrordered','name','monitor_format','type','waiting','total','answered','sumHoldTime','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x13ba93,_0x37c9e4){var _0x407f56=function(_0x3b7879){while(--_0x3b7879){_0x13ba93['push'](_0x13ba93['shift']());}};_0x407f56(++_0x37c9e4);}(_0x4da5,0x1b7));var _0x54da=function(_0x48bec2,_0x42c34c){_0x48bec2=_0x48bec2-0x0;var _0x53e3c5=_0x4da5[_0x48bec2];return _0x53e3c5;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x54da('0x0'),'gsm':_0x54da('0x1')};var strategy={'fewestcalls':_0x54da('0x2'),'leastrecent':'leastrecent','linear':_0x54da('0x3'),'random':'random','ringall':_0x54da('0x4'),'rr':_0x54da('0x5'),'rrmemory':_0x54da('0x6'),'rrordered':_0x54da('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x200b6c){this['id']=_0x200b6c['id']||0x0;this[_0x54da('0x8')]=_0x200b6c[_0x54da('0x8')]||'';this[_0x54da('0x9')]=_0x200b6c[_0x54da('0x9')]||'';this[_0x54da('0xa')]=_0x200b6c[_0x54da('0xa')]||'inbound';this[_0x54da('0xb')]=0x0;this[_0x54da('0xc')]=0x0;this[_0x54da('0xd')]=0x0;this['sumDuration']=0x0;this[_0x54da('0xe')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x54da('0xf')]=0x0;this[_0x54da('0x10')]=0x0;this[_0x54da('0x11')]=0x0;this[_0x54da('0x12')]=0x0;this[_0x54da('0x13')]=0x0;this[_0x54da('0x14')]=0x0;this[_0x54da('0x15')]=0x0;this[_0x54da('0x16')]=0x0;this[_0x54da('0x17')]=0x0;this[_0x54da('0x18')]=0x0;this[_0x54da('0x19')]=0x0;this[_0x54da('0x1a')]=0x0;this[_0x54da('0x1b')]=0x0;this['unknown']=0x0;this[_0x54da('0x1c')]=_0x200b6c[_0x54da('0x1c')]||![];this[_0x54da('0x1d')]=_0x200b6c[_0x54da('0x1d')]||0xa;this['autopause']=_0x200b6c[_0x54da('0x1e')]||'no';this[_0x54da('0x1f')]=!![];this[_0x54da('0x20')]='';this[_0x54da('0x21')]='';this[_0x54da('0x22')]=0x0;this[_0x54da('0x23')]=0x0;this['dialTimezone']=_0x200b6c[_0x54da('0x24')]||null;this[_0x54da('0x25')]=_0x200b6c['dialGlobalInterval']?_0x200b6c[_0x54da('0x25')]:null;this[_0x54da('0x26')]=_0x200b6c['dialActive'];this['dialMethod']=_0x200b6c[_0x54da('0x27')]||'progressive';this[_0x54da('0x28')]=_0x200b6c[_0x54da('0x28')]||0x0;this['dialLimitQueue']=_0x200b6c[_0x54da('0x29')]||0x0;this[_0x54da('0x2a')]=_0x200b6c[_0x54da('0x2a')]||0x1;this[_0x54da('0x2b')]=_0x200b6c[_0x54da('0x2b')]||_0x54da('0x2c');this[_0x54da('0x2d')]=_0x200b6c[_0x54da('0x2d')]||0.03;this[_0x54da('0x2e')]=_0x200b6c[_0x54da('0x2e')]||0x258;this['dialOriginateCallerIdName']=_0x200b6c[_0x54da('0x2f')]||_0x54da('0x30');this[_0x54da('0x31')]=_0x200b6c[_0x54da('0x31')]||_0x54da('0x30');this[_0x54da('0x32')]=_0x200b6c['dialOriginateTimeout']||0x1e;this[_0x54da('0x33')]=_0x200b6c[_0x54da('0x33')]||_0x54da('0x34');this[_0x54da('0x35')]=_0x200b6c[_0x54da('0x35')]||0x3;this[_0x54da('0x36')]=_0x200b6c['dialQueueProject']||undefined;this[_0x54da('0x37')]=_0x200b6c['dialCongestionMaxRetry']||0x3;this[_0x54da('0x38')]=_0x200b6c[_0x54da('0x38')]||0x96;this[_0x54da('0x39')]=_0x200b6c['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x200b6c[_0x54da('0x3a')]||0x96;this[_0x54da('0x3b')]=_0x200b6c[_0x54da('0x3b')]||0x3;this['dialNoAnswerRetryFrequency']=_0x200b6c[_0x54da('0x3c')]||0x96;this[_0x54da('0x3d')]=_0x200b6c['dialNoSuchNumberMaxRetry']||0x3;this[_0x54da('0x3e')]=_0x200b6c[_0x54da('0x3e')]||0x96;this[_0x54da('0x3f')]=_0x200b6c['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x200b6c[_0x54da('0x40')]||0x96;this['dialAbandonedMaxRetry']=_0x200b6c[_0x54da('0x41')]||0x3;this[_0x54da('0x42')]=_0x200b6c[_0x54da('0x42')]||0x96;this[_0x54da('0x43')]=_0x200b6c[_0x54da('0x43')]||0x3;this[_0x54da('0x44')]=_0x200b6c[_0x54da('0x44')]||0x96;this[_0x54da('0x45')]=_0x200b6c['dialAgentRejectMaxRetry']||0x3;this[_0x54da('0x46')]=_0x200b6c[_0x54da('0x46')]||0x96;this['callAdditionalPhoneAfterMin']=_0x200b6c['callAdditionalPhoneAfterMin']||0x3;this[_0x54da('0x47')]=_0x200b6c[_0x54da('0x47')]||0x4;this[_0x54da('0x48')]=_0x200b6c[_0x54da('0x48')]?_0x200b6c[_0x54da('0x48')]:undefined;this[_0x54da('0x49')]=_0x200b6c[_0x54da('0x49')]?_0x200b6c[_0x54da('0x49')]:undefined;this[_0x54da('0x4a')]=_0x200b6c[_0x54da('0x4a')]||undefined;this[_0x54da('0x4b')]=_0x200b6c[_0x54da('0x4b')]?_0x200b6c['Interval']:undefined;this[_0x54da('0x4c')]=_0x200b6c[_0x54da('0x4c')]||'DESC';this[_0x54da('0x4d')]=_0x200b6c[_0x54da('0x4d')]||undefined;this[_0x54da('0x4e')]=_0x200b6c[_0x54da('0x4e')]||undefined;this[_0x54da('0x4f')]=strategy[_0x200b6c['strategy']];this['queueStatusComplete']=!![];this[_0x54da('0x50')]=_0x200b6c['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x200b6c['dialAMDInitialSilence'];this[_0x54da('0x51')]=_0x200b6c[_0x54da('0x51')];this[_0x54da('0x52')]=_0x200b6c[_0x54da('0x52')];this[_0x54da('0x53')]=_0x200b6c[_0x54da('0x53')];this[_0x54da('0x54')]=_0x200b6c[_0x54da('0x54')];this[_0x54da('0x55')]=_0x200b6c[_0x54da('0x55')];this[_0x54da('0x56')]=_0x200b6c[_0x54da('0x56')];this[_0x54da('0x57')]=_0x200b6c[_0x54da('0x57')];this[_0x54da('0x58')]=_0x200b6c[_0x54da('0x58')];this[_0x54da('0x59')]=0x0;this[_0x54da('0x5a')]=0x0;this['timeout']=_0x200b6c[_0x54da('0x5b')];this['outboundAnswerCallsDay']=0x0;this[_0x54da('0x5c')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x54da('0x5d')]=0x0;this[_0x54da('0x5e')]=0x0;this[_0x54da('0x5f')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x54da('0x60')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x54da('0x61')]=0x0;this[_0x54da('0x62')]=0x0;this[_0x54da('0x63')]=0x0;this['outboundReCallsDay']=0x0;this[_0x54da('0x64')]=0x0;this[_0x54da('0x65')]=undefined;this[_0x54da('0x66')]=undefined;this[_0x54da('0x67')]=undefined;this[_0x54da('0x68')]=1.05;this[_0x54da('0x69')]=0x0;this[_0x54da('0x6a')]=0x0;this[_0x54da('0x6b')]=0x0;this[_0x54da('0x6c')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x54da('0x6d')]=0x0;this[_0x54da('0x6e')]=0x0;this[_0x54da('0x6f')]=0x0;this['predictiveIntervalMaxThreshold']=_0x200b6c[_0x54da('0x70')]||0x14;this['predictiveIntervalMinThreshold']=_0x200b6c[_0x54da('0x70')]||0xa;this[_0x54da('0x71')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x54da('0x72')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0x54da('0x73')]=0x0;this['erlangBusyFactor']=0x0;this[_0x54da('0x74')]=_0x200b6c['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x200b6c[_0x54da('0x75')]||![];this[_0x54da('0x76')]=!!_0x200b6c[_0x54da('0x76')]||![];this[_0x54da('0x77')]=!!_0x200b6c[_0x54da('0x77')]||![];this['dialQueueProject2']=_0x200b6c[_0x54da('0x78')]||undefined;this[_0x54da('0x79')]=_0x200b6c[_0x54da('0x79')]||![];this[_0x54da('0x7a')]=_0x200b6c[_0x54da('0x7a')]||![];this[_0x54da('0x9')]=monitorFormat[_0x200b6c['monitor_format']]?monitorFormat[_0x200b6c[_0x54da('0x9')]]:undefined;this[_0x54da('0x7b')]=_0x200b6c[_0x54da('0x7b')]||![];this['mandatoryDispositionPause']=_0x200b6c[_0x54da('0x7c')]?_0x200b6c['mandatoryDispositionPause']:undefined;this[_0x54da('0x7d')]=![];}module[_0x54da('0x7e')]=VoiceQueue; \ No newline at end of file +var _0x4aeb=['dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialCutDigit','strategy','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','linear','random','ringall','rrmemory','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','onHold','ringing','talking','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x4aeb,0x131));var _0xb4ae=function(_0x200d00,_0x2000f9){_0x200d00=_0x200d00-0x0;var _0x30787d=_0x4aeb[_0x200d00];return _0x30787d;};'use strict';var monitorFormat={'wav':_0xb4ae('0x0'),'wav49':_0xb4ae('0x1'),'gsm':_0xb4ae('0x2')};var strategy={'fewestcalls':_0xb4ae('0x3'),'leastrecent':'leastrecent','linear':_0xb4ae('0x4'),'random':_0xb4ae('0x5'),'ringall':_0xb4ae('0x6'),'rr':'roundrobin','rrmemory':_0xb4ae('0x7'),'rrordered':'rrordered','wrandom':'wrandom'};function VoiceQueue(_0x5063cb){this['id']=_0x5063cb['id']||0x0;this['name']=_0x5063cb[_0xb4ae('0x8')]||'';this[_0xb4ae('0x9')]=_0x5063cb['monitor_format']||'';this[_0xb4ae('0xa')]=_0x5063cb[_0xb4ae('0xa')]||_0xb4ae('0xb');this[_0xb4ae('0xc')]=0x0;this[_0xb4ae('0xd')]=0x0;this[_0xb4ae('0xe')]=0x0;this[_0xb4ae('0xf')]=0x0;this[_0xb4ae('0x10')]=0x0;this[_0xb4ae('0x11')]=0x0;this[_0xb4ae('0x12')]=0x0;this[_0xb4ae('0x13')]=0x0;this[_0xb4ae('0x14')]=0x0;this[_0xb4ae('0x15')]=0x0;this[_0xb4ae('0x16')]=0x0;this['invalid']=0x0;this[_0xb4ae('0x17')]=0x0;this[_0xb4ae('0x18')]=0x0;this[_0xb4ae('0x19')]=0x0;this['paused']=0x0;this[_0xb4ae('0x1a')]=0x0;this['ringInUse']=0x0;this[_0xb4ae('0x1b')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this[_0xb4ae('0x1c')]=_0x5063cb['acw']||![];this[_0xb4ae('0x1d')]=_0x5063cb[_0xb4ae('0x1d')]||0xa;this[_0xb4ae('0x1e')]=_0x5063cb[_0xb4ae('0x1e')]||'no';this[_0xb4ae('0x1f')]=!![];this[_0xb4ae('0x20')]='';this['statusMessage']='';this[_0xb4ae('0x21')]=0x0;this[_0xb4ae('0x22')]=0x0;this[_0xb4ae('0x23')]=_0x5063cb[_0xb4ae('0x23')]||null;this['dialGlobalInterval']=_0x5063cb['dialGlobalInterval']?_0x5063cb['dialGlobalInterval']:null;this['dialActive']=_0x5063cb[_0xb4ae('0x24')];this[_0xb4ae('0x25')]=_0x5063cb[_0xb4ae('0x25')]||_0xb4ae('0x26');this[_0xb4ae('0x27')]=_0x5063cb[_0xb4ae('0x27')]||0x0;this[_0xb4ae('0x28')]=_0x5063cb[_0xb4ae('0x28')]||0x0;this[_0xb4ae('0x29')]=_0x5063cb[_0xb4ae('0x29')]||0x1;this['dialPredictiveOptimization']=_0x5063cb[_0xb4ae('0x2a')]||'dropRate';this[_0xb4ae('0x2b')]=_0x5063cb[_0xb4ae('0x2b')]||0.03;this[_0xb4ae('0x2c')]=_0x5063cb['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x5063cb[_0xb4ae('0x2d')]||_0xb4ae('0x2e');this[_0xb4ae('0x2f')]=_0x5063cb[_0xb4ae('0x2f')]||_0xb4ae('0x2e');this[_0xb4ae('0x30')]=_0x5063cb[_0xb4ae('0x30')]||0x1e;this[_0xb4ae('0x31')]=_0x5063cb[_0xb4ae('0x31')]||_0xb4ae('0x32');this[_0xb4ae('0x33')]=_0x5063cb[_0xb4ae('0x33')]||0x3;this[_0xb4ae('0x34')]=_0x5063cb[_0xb4ae('0x34')]||undefined;this['dialCongestionMaxRetry']=_0x5063cb[_0xb4ae('0x35')]||0x3;this[_0xb4ae('0x36')]=_0x5063cb['dialCongestionRetryFrequency']||0x96;this[_0xb4ae('0x37')]=_0x5063cb['dialBusyMaxRetry']||0x3;this[_0xb4ae('0x38')]=_0x5063cb[_0xb4ae('0x38')]||0x96;this[_0xb4ae('0x39')]=_0x5063cb[_0xb4ae('0x39')]||0x3;this[_0xb4ae('0x3a')]=_0x5063cb[_0xb4ae('0x3a')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x5063cb[_0xb4ae('0x3b')]||0x3;this[_0xb4ae('0x3c')]=_0x5063cb['dialNoSuchNumberRetryFrequency']||0x96;this[_0xb4ae('0x3d')]=_0x5063cb[_0xb4ae('0x3d')]||0x3;this[_0xb4ae('0x3e')]=_0x5063cb[_0xb4ae('0x3e')]||0x96;this['dialAbandonedMaxRetry']=_0x5063cb['dialAbandonedMaxRetry']||0x3;this[_0xb4ae('0x3f')]=_0x5063cb[_0xb4ae('0x3f')]||0x96;this[_0xb4ae('0x40')]=_0x5063cb[_0xb4ae('0x40')]||0x3;this[_0xb4ae('0x41')]=_0x5063cb[_0xb4ae('0x41')]||0x96;this[_0xb4ae('0x42')]=_0x5063cb['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x5063cb[_0xb4ae('0x43')]||0x96;this['callAdditionalPhoneAfterMin']=_0x5063cb['callAdditionalPhoneAfterMin']||0x3;this[_0xb4ae('0x44')]=_0x5063cb['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x5063cb[_0xb4ae('0x45')]?_0x5063cb[_0xb4ae('0x45')]:undefined;this[_0xb4ae('0x46')]=_0x5063cb[_0xb4ae('0x46')]?_0x5063cb[_0xb4ae('0x46')]:undefined;this['dialPrefix']=_0x5063cb[_0xb4ae('0x47')]||undefined;this['Interval']=_0x5063cb[_0xb4ae('0x48')]?_0x5063cb['Interval']:undefined;this[_0xb4ae('0x49')]=_0x5063cb[_0xb4ae('0x49')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x5063cb['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x5063cb[_0xb4ae('0x4a')]||undefined;this['strategy']=strategy[_0x5063cb[_0xb4ae('0x4b')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x5063cb[_0xb4ae('0x4c')]||![];this['dialAMDInitialSilence']=_0x5063cb['dialAMDInitialSilence'];this[_0xb4ae('0x4d')]=_0x5063cb[_0xb4ae('0x4d')];this[_0xb4ae('0x4e')]=_0x5063cb[_0xb4ae('0x4e')];this['dialAMDTotalAnalysisTime']=_0x5063cb['dialAMDTotalAnalysisTime'];this[_0xb4ae('0x4f')]=_0x5063cb['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x5063cb[_0xb4ae('0x50')];this[_0xb4ae('0x51')]=_0x5063cb['dialAMDMaximumNumberOfWords'];this[_0xb4ae('0x52')]=_0x5063cb[_0xb4ae('0x52')];this['dialAMDMaximumWordLength']=_0x5063cb[_0xb4ae('0x53')];this[_0xb4ae('0x54')]=0x0;this[_0xb4ae('0x55')]=0x0;this['timeout']=_0x5063cb[_0xb4ae('0x56')];this['outboundAnswerCallsDay']=0x0;this[_0xb4ae('0x57')]=0x0;this[_0xb4ae('0x58')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xb4ae('0x59')]=0x0;this[_0xb4ae('0x5a')]=0x0;this[_0xb4ae('0x5b')]=0x0;this[_0xb4ae('0x5c')]=0x0;this[_0xb4ae('0x5d')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xb4ae('0x5e')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xb4ae('0x5f')]=0x0;this[_0xb4ae('0x60')]=0x0;this[_0xb4ae('0x61')]=undefined;this['startPredictive']=undefined;this[_0xb4ae('0x62')]=undefined;this[_0xb4ae('0x63')]=1.05;this[_0xb4ae('0x64')]=0x0;this[_0xb4ae('0x65')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xb4ae('0x66')]=0x0;this[_0xb4ae('0x67')]=0x0;this[_0xb4ae('0x68')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xb4ae('0x69')]=_0x5063cb[_0xb4ae('0x6a')]||0x14;this['predictiveIntervalMinThreshold']=_0x5063cb[_0xb4ae('0x6a')]||0xa;this[_0xb4ae('0x6b')]=0x0;this[_0xb4ae('0x6c')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xb4ae('0x6d')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0xb4ae('0x6e')]=_0x5063cb[_0xb4ae('0x6e')]||0x1e;this[_0xb4ae('0x6f')]=_0x5063cb[_0xb4ae('0x6f')]||![];this[_0xb4ae('0x70')]=!!_0x5063cb['dialPreviewAutoRecallMe']||![];this[_0xb4ae('0x71')]=!!_0x5063cb[_0xb4ae('0x71')]||![];this[_0xb4ae('0x72')]=_0x5063cb[_0xb4ae('0x72')]||undefined;this[_0xb4ae('0x73')]=_0x5063cb['dialAgiAfterHangupClient']||![];this[_0xb4ae('0x74')]=_0x5063cb[_0xb4ae('0x74')]||![];this[_0xb4ae('0x9')]=monitorFormat[_0x5063cb[_0xb4ae('0x9')]]?monitorFormat[_0x5063cb[_0xb4ae('0x9')]]:undefined;this['mandatoryDisposition']=_0x5063cb[_0xb4ae('0x75')]||![];this['mandatoryDispositionPause']=_0x5063cb[_0xb4ae('0x76')]?_0x5063cb[_0xb4ae('0x76')]:undefined;this[_0xb4ae('0x77')]=![];}module[_0xb4ae('0x78')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 4e0750a..d845240 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 _0xaf79=['predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','unknown','callers','length','SIP/','online','incall','includes','status','dialMethod','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumDuration','total','name','strategy','available','busy','invalid','onHold','notInUse','ringInUse','sumBillable','type','unavailable','unmanaged','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime'];(function(_0xeedf1c,_0x5968dd){var _0x4986fa=function(_0xa8226d){while(--_0xa8226d){_0xeedf1c['push'](_0xeedf1c['shift']());}};_0x4986fa(++_0x5968dd);}(_0xaf79,0x82));var _0x9af7=function(_0x488243,_0x361cfa){_0x488243=_0x488243-0x0;var _0x5220bd=_0xaf79[_0x488243];return _0x5220bd;};'use strict';var INBOUND_COUNTERS=['available',_0x9af7('0x0'),_0x9af7('0x1'),_0x9af7('0x2'),_0x9af7('0x3'),_0x9af7('0x4'),_0x9af7('0x5')];var OUTBOUND_COUNTERS=['available',_0x9af7('0x6'),_0x9af7('0x7'),_0x9af7('0x0'),_0x9af7('0x1'),'originated','outboundAbandonedCallsDay',_0x9af7('0x8'),_0x9af7('0x9'),_0x9af7('0xa'),_0x9af7('0xb'),_0x9af7('0xc'),_0x9af7('0xd'),_0x9af7('0xe'),_0x9af7('0xf'),_0x9af7('0x10'),_0x9af7('0x2'),_0x9af7('0x11'),_0x9af7('0x4'),'sumBillable',_0x9af7('0x12'),_0x9af7('0x13'),_0x9af7('0x5')];function VoiceQueueSummary(_0x45c53d){this['id']=_0x45c53d['id'];this[_0x9af7('0x14')]=_0x45c53d[_0x9af7('0x14')];this[_0x9af7('0x15')]=_0x45c53d[_0x9af7('0x15')];this['abandoned']=_0x45c53d['abandoned']||0x0;this[_0x9af7('0x6')]=_0x45c53d[_0x9af7('0x6')]||0x0;this[_0x9af7('0x16')]=_0x45c53d[_0x9af7('0x16')]||0x0;this[_0x9af7('0x17')]=_0x45c53d[_0x9af7('0x17')]||0x0;this[_0x9af7('0x7')]=_0x45c53d['inUse']||0x0;this['invalid']=_0x45c53d[_0x9af7('0x18')]||0x0;this[_0x9af7('0x0')]=_0x45c53d['loggedIn']||0x0;this[_0x9af7('0x1')]=_0x45c53d[_0x9af7('0x1')]||0x0;this[_0x9af7('0x19')]=_0x45c53d[_0x9af7('0x19')]||0x0;this[_0x9af7('0x1a')]=_0x45c53d[_0x9af7('0x1a')]||0x0;this['paused']=_0x45c53d['paused']||0x0;this['ringing']=_0x45c53d[_0x9af7('0x3')]||0x0;this[_0x9af7('0x1b')]=_0x45c53d['ringInUse'];this[_0x9af7('0x1c')]=_0x45c53d[_0x9af7('0x1c')];this[_0x9af7('0x12')]=_0x45c53d[_0x9af7('0x12')];this['sumHoldTime']=_0x45c53d['sumHoldTime']||0x0;this[_0x9af7('0x4')]=_0x45c53d[_0x9af7('0x4')]||0x0;this[_0x9af7('0x13')]=_0x45c53d[_0x9af7('0x13')]||0x0;this[_0x9af7('0x1d')]=_0x45c53d['type'];this[_0x9af7('0x1e')]=_0x45c53d[_0x9af7('0x1e')]||0x0;this['unknown']=_0x45c53d['unknown']||0x0;this[_0x9af7('0x1f')]=_0x45c53d['unmanaged']||0x0;this[_0x9af7('0x5')]=_0x45c53d[_0x9af7('0x5')]||0x0;if(_0x45c53d['type']==='outbound'){this['pTalking']=_0x45c53d[_0x9af7('0x11')]||0x0;this[_0x9af7('0x20')]=_0x45c53d['dialActive'];this['dialMethod']=_0x45c53d['dialMethod'];this[_0x9af7('0x21')]=_0x45c53d['dialOriginateCallerIdName'];this[_0x9af7('0x22')]=_0x45c53d['dialOriginateCallerIdNumber'];this[_0x9af7('0x23')]=_0x45c53d[_0x9af7('0x23')];this[_0x9af7('0x24')]=_0x45c53d[_0x9af7('0x24')];this[_0x9af7('0x25')]=_0x45c53d['temp'];this[_0x9af7('0x26')]=_0x45c53d[_0x9af7('0x26')];this['outboundAnswerCallsDay']=_0x45c53d[_0x9af7('0x8')];this[_0x9af7('0x9')]=_0x45c53d['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x45c53d['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x45c53d[_0x9af7('0xb')];this[_0x9af7('0x27')]=_0x45c53d['outboundDropCallsDayACS'];this[_0x9af7('0x28')]=_0x45c53d[_0x9af7('0x28')];this[_0x9af7('0x29')]=_0x45c53d[_0x9af7('0x29')];this['outboundNoAnswerCallsDay']=_0x45c53d[_0x9af7('0xc')];this['outboundNoSuchCallsDay']=_0x45c53d['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x45c53d['outboundOriginateFailureCallsDay'];this[_0x9af7('0xe')]=_0x45c53d['outboundReCallsDay'];this[_0x9af7('0xf')]=_0x45c53d['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x45c53d[_0x9af7('0x10')];this[_0x9af7('0x2a')]=_0x45c53d['predictiveIntervalAnsweredCalls'];this[_0x9af7('0x2b')]=_0x45c53d[_0x9af7('0x2b')];this['predictiveIntervalAvgTalktime']=_0x45c53d[_0x9af7('0x2c')];this['predictiveIntervalDroppedCallsCallersExit']=_0x45c53d[_0x9af7('0x2d')];this[_0x9af7('0x2e')]=_0x45c53d['predictiveIntervalDroppedCallsTimeout'];this[_0x9af7('0x2f')]=_0x45c53d[_0x9af7('0x2f')];this[_0x9af7('0x30')]=_0x45c53d[_0x9af7('0x30')];this[_0x9af7('0x31')]=_0x45c53d[_0x9af7('0x31')];this['predictiveIntervalMultiplicativeFactor']=_0x45c53d[_0x9af7('0x32')];this[_0x9af7('0x33')]=_0x45c53d[_0x9af7('0x33')];this[_0x9af7('0x34')]=_0x45c53d['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x45c53d[_0x9af7('0x35')];this[_0x9af7('0x36')]=_0x45c53d[_0x9af7('0x36')];this['erlangCalls']=_0x45c53d['erlangCalls'];this[_0x9af7('0x37')]=_0x45c53d['erlangCallToSecond'];this[_0x9af7('0x38')]=_0x45c53d[_0x9af7('0x38')];this['erlangBusyFactor']=_0x45c53d[_0x9af7('0x39')];this['startPredictive']=_0x45c53d[_0x9af7('0x3a')];this[_0x9af7('0x3b')]=_0x45c53d[_0x9af7('0x3b')];this['message']=_0x45c53d[_0x9af7('0x3c')];this[_0x9af7('0x3d')]=_0x45c53d[_0x9af7('0x3d')];}if(_0x45c53d['Trunk']){this[_0x9af7('0x3e')]={'id':_0x45c53d[_0x9af7('0x3e')]['id'],'name':_0x45c53d[_0x9af7('0x3e')][_0x9af7('0x14')],'active':_0x45c53d[_0x9af7('0x3e')][_0x9af7('0x3f')],'callerid':_0x45c53d[_0x9af7('0x3e')][_0x9af7('0x40')]};}}VoiceQueueSummary[_0x9af7('0x41')][_0x9af7('0x42')]=function(_0x48de57,_0x1ad12d,_0x42c83b,_0x3c35c4){this[_0x9af7('0x1')]=0x0;this[_0x9af7('0x4')]=0x0;this[_0x9af7('0x2')]=0x0;this[_0x9af7('0x43')]=0x0;this[_0x9af7('0x1a')]=0x0;this[_0x9af7('0x7')]=0x0;this[_0x9af7('0x17')]=0x0;this[_0x9af7('0x18')]=0x0;this['unavailable']=0x0;this[_0x9af7('0x3')]=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x42c83b){if(_0x42c83b[_0x9af7('0x16')]){this[_0x9af7('0x16')]=Number(_0x42c83b[_0x9af7('0x16')]);}if(_0x42c83b['loggedin']){this['loggedIn']=Number(_0x42c83b['loggedin']);}if(_0x42c83b[_0x9af7('0x44')]){this[_0x9af7('0x5')]=Number(_0x42c83b['callers']);}}for(var _0x24ad42=0x0;_0x24ad42<_0x48de57[_0x9af7('0x45')];_0x24ad42++){var _0x6aae6b=_0x1ad12d[_0x9af7('0x46')+_0x48de57[_0x24ad42]['name']];if(_0x6aae6b&&_0x6aae6b[_0x9af7('0x47')]){this['loggedInDb']+=0x1;}if(_0x48de57[_0x24ad42][_0x9af7('0x48')]==='1'){this['talking']+=0x1;}if(_0x48de57[_0x24ad42][_0x9af7('0x2')]==='1'&&!['2','7','8'][_0x9af7('0x49')](_0x48de57[_0x24ad42][_0x9af7('0x4a')])){this[_0x9af7('0x2')]+=0x1;}switch(_0x48de57[_0x24ad42][_0x9af7('0x4a')]){case'0':this[_0x9af7('0x43')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x9af7('0x7')]+=0x1;break;case'3':this[_0x9af7('0x17')]+=0x1;break;case'4':this[_0x9af7('0x18')]+=0x1;break;case'5':this[_0x9af7('0x1e')]+=0x1;break;case'6':this[_0x9af7('0x3')]+=0x1;break;case'7':this[_0x9af7('0x1b')]+=0x1;break;case'8':this[_0x9af7('0x19')]+=0x1;break;}}if(this[_0x9af7('0x4b')]==='booked'){var _0x560862=Object[_0x9af7('0x4c')](_0x3c35c4);for(var _0x2e2e9c=0x0;_0x2e2e9c<_0x560862[_0x9af7('0x45')];_0x2e2e9c++){var _0x54f257=_0x560862[_0x2e2e9c];var _0x136de7=_0x3c35c4[_0x54f257];if(_0x136de7[_0x9af7('0x4d')]===this[_0x9af7('0x14')]&&_0x136de7[_0x9af7('0x1d')]===_0x9af7('0x4e')&&_0x136de7[_0x9af7('0x4f')]===_0x9af7('0x50')){this['talking']+=0x1;}}if(this[_0x9af7('0x4')]>this[_0x9af7('0x7')]){this[_0x9af7('0x4')]=this[_0x9af7('0x7')];}this[_0x9af7('0x11')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x9af7('0x51')]=function(_0x459eac){var _0xdd2854=![];if(_0x459eac){_0xdd2854=INBOUND_COUNTERS[_0x9af7('0x52')](function(_0x560181){return this[_0x560181]!==_0x459eac[_0x560181];},this);}return _0xdd2854;};VoiceQueueSummary[_0x9af7('0x41')][_0x9af7('0x53')]=function(_0x19628a){var _0x2ef41d=![];var _0x2942b0=![];var _0x311ac0=![];if(_0x19628a){_0x2ef41d=this[_0x9af7('0x4b')]!==_0x19628a[_0x9af7('0x4b')]||this[_0x9af7('0x20')]!==_0x19628a['dialActive']||this[_0x9af7('0x3c')]!==_0x19628a[_0x9af7('0x3c')]||this['statusMessage']!==_0x19628a[_0x9af7('0x3d')];_0x2942b0=OUTBOUND_COUNTERS[_0x9af7('0x52')](function(_0x1fe141){return this[_0x1fe141]!==_0x19628a[_0x1fe141];},this);if(this[_0x9af7('0x3e')]&&_0x19628a['Trunk']){_0x311ac0=this[_0x9af7('0x3e')][_0x9af7('0x14')]!==_0x19628a[_0x9af7('0x3e')][_0x9af7('0x14')]||this[_0x9af7('0x3e')][_0x9af7('0x3f')]!==_0x19628a[_0x9af7('0x3e')]['active'];}}return _0x2ef41d||_0x2942b0||_0x311ac0;};VoiceQueueSummary[_0x9af7('0x41')][_0x9af7('0x54')]=function(_0x58957a){this[_0x9af7('0x6')]=_0x58957a['answered'];this[_0x9af7('0x3c')]=_0x58957a[_0x9af7('0x3c')];this[_0x9af7('0x3d')]=_0x58957a['statusMessage'];this['originated']=_0x58957a[_0x9af7('0x36')];this[_0x9af7('0x55')]=_0x58957a[_0x9af7('0x55')];this[_0x9af7('0x8')]=_0x58957a[_0x9af7('0x8')];this['outboundBlacklistCallsDay']=_0x58957a[_0x9af7('0x9')];this['outboundBusyCallsDay']=_0x58957a[_0x9af7('0xa')];this[_0x9af7('0xb')]=_0x58957a[_0x9af7('0xb')];this['outboundNoAnswerCallsDay']=_0x58957a[_0x9af7('0xc')];this[_0x9af7('0xd')]=_0x58957a[_0x9af7('0xd')];this[_0x9af7('0xe')]=_0x58957a[_0x9af7('0xe')];this[_0x9af7('0xf')]=_0x58957a[_0x9af7('0xf')];this[_0x9af7('0x10')]=_0x58957a['outboundUnknownCallsDay'];this['sumBillable']=_0x58957a[_0x9af7('0x1c')];this['sumDuration']=_0x58957a[_0x9af7('0x12')];this[_0x9af7('0x13')]=_0x58957a[_0x9af7('0x13')];if(this[_0x9af7('0x4b')]===_0x9af7('0x56')){this[_0x9af7('0x11')]=_0x58957a[_0x9af7('0x11')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x6aa7=['incall','includes','status','keys','length','dialer','exten','xcally-motion-preview','compareToInboundQueue','compareToOutboundQueue','some','active','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedInDb','paused','ringing','talking','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','waiting','name','strategy','abandoned','busy','invalid','loggedIn','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','online'];(function(_0x4fdc9f,_0x7e9d4){var _0x38941c=function(_0x3df7dd){while(--_0x3df7dd){_0x4fdc9f['push'](_0x4fdc9f['shift']());}};_0x38941c(++_0x7e9d4);}(_0x6aa7,0x178));var _0x76aa=function(_0x1d9685,_0x427472){_0x1d9685=_0x1d9685-0x0;var _0x49b5b2=_0x6aa7[_0x1d9685];return _0x49b5b2;};'use strict';var INBOUND_COUNTERS=[_0x76aa('0x0'),'loggedIn',_0x76aa('0x1'),_0x76aa('0x2'),_0x76aa('0x3'),_0x76aa('0x4'),'waiting'];var OUTBOUND_COUNTERS=[_0x76aa('0x0'),_0x76aa('0x5'),_0x76aa('0x6'),'loggedIn','loggedInDb',_0x76aa('0x7'),'outboundAbandonedCallsDay',_0x76aa('0x8'),_0x76aa('0x9'),_0x76aa('0xa'),'outboundCongestionCallsDay',_0x76aa('0xb'),_0x76aa('0xc'),_0x76aa('0xd'),'outboundRejectCallsDay',_0x76aa('0xe'),_0x76aa('0x2'),_0x76aa('0xf'),_0x76aa('0x4'),_0x76aa('0x10'),_0x76aa('0x11'),_0x76aa('0x12'),_0x76aa('0x13')];function VoiceQueueSummary(_0xd6327){this['id']=_0xd6327['id'];this[_0x76aa('0x14')]=_0xd6327['name'];this[_0x76aa('0x15')]=_0xd6327['strategy'];this[_0x76aa('0x16')]=_0xd6327[_0x76aa('0x16')]||0x0;this[_0x76aa('0x5')]=_0xd6327[_0x76aa('0x5')]||0x0;this[_0x76aa('0x0')]=_0xd6327['available']||0x0;this['busy']=_0xd6327[_0x76aa('0x17')]||0x0;this['inUse']=_0xd6327[_0x76aa('0x6')]||0x0;this[_0x76aa('0x18')]=_0xd6327['invalid']||0x0;this[_0x76aa('0x19')]=_0xd6327['loggedIn']||0x0;this[_0x76aa('0x1')]=_0xd6327['loggedInDb']||0x0;this[_0x76aa('0x1a')]=_0xd6327[_0x76aa('0x1a')]||0x0;this[_0x76aa('0x1b')]=_0xd6327[_0x76aa('0x1b')]||0x0;this[_0x76aa('0x2')]=_0xd6327[_0x76aa('0x2')]||0x0;this['ringing']=_0xd6327['ringing']||0x0;this[_0x76aa('0x1c')]=_0xd6327[_0x76aa('0x1c')];this[_0x76aa('0x10')]=_0xd6327[_0x76aa('0x10')];this[_0x76aa('0x11')]=_0xd6327[_0x76aa('0x11')];this[_0x76aa('0x1d')]=_0xd6327[_0x76aa('0x1d')]||0x0;this[_0x76aa('0x4')]=_0xd6327['talking']||0x0;this[_0x76aa('0x12')]=_0xd6327[_0x76aa('0x12')]||0x0;this[_0x76aa('0x1e')]=_0xd6327['type'];this[_0x76aa('0x1f')]=_0xd6327[_0x76aa('0x1f')]||0x0;this[_0x76aa('0x20')]=_0xd6327[_0x76aa('0x20')]||0x0;this[_0x76aa('0x21')]=_0xd6327[_0x76aa('0x21')]||0x0;this[_0x76aa('0x13')]=_0xd6327[_0x76aa('0x13')]||0x0;if(_0xd6327[_0x76aa('0x1e')]===_0x76aa('0x22')){this[_0x76aa('0xf')]=_0xd6327[_0x76aa('0xf')]||0x0;this[_0x76aa('0x23')]=_0xd6327['dialActive'];this[_0x76aa('0x24')]=_0xd6327[_0x76aa('0x24')];this[_0x76aa('0x25')]=_0xd6327[_0x76aa('0x25')];this[_0x76aa('0x26')]=_0xd6327[_0x76aa('0x26')];this[_0x76aa('0x27')]=_0xd6327[_0x76aa('0x27')];this[_0x76aa('0x28')]=_0xd6327[_0x76aa('0x28')];this['temp']=_0xd6327[_0x76aa('0x29')];this['outboundAnswerAgiCallsDay']=_0xd6327[_0x76aa('0x2a')];this[_0x76aa('0x8')]=_0xd6327[_0x76aa('0x8')];this[_0x76aa('0x9')]=_0xd6327[_0x76aa('0x9')];this[_0x76aa('0xa')]=_0xd6327[_0x76aa('0xa')];this[_0x76aa('0x2b')]=_0xd6327[_0x76aa('0x2b')];this[_0x76aa('0x2c')]=_0xd6327['outboundDropCallsDayACS'];this[_0x76aa('0x2d')]=_0xd6327[_0x76aa('0x2d')];this[_0x76aa('0x2e')]=_0xd6327[_0x76aa('0x2e')];this[_0x76aa('0xb')]=_0xd6327[_0x76aa('0xb')];this[_0x76aa('0xc')]=_0xd6327['outboundNoSuchCallsDay'];this[_0x76aa('0x2f')]=_0xd6327[_0x76aa('0x2f')];this['outboundReCallsDay']=_0xd6327[_0x76aa('0xd')];this['outboundRejectCallsDay']=_0xd6327[_0x76aa('0x30')];this['outboundUnknownCallsDay']=_0xd6327[_0x76aa('0xe')];this['predictiveIntervalAnsweredCalls']=_0xd6327['predictiveIntervalAnsweredCalls'];this[_0x76aa('0x31')]=_0xd6327[_0x76aa('0x31')];this[_0x76aa('0x32')]=_0xd6327[_0x76aa('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0xd6327['predictiveIntervalDroppedCallsCallersExit'];this[_0x76aa('0x33')]=_0xd6327[_0x76aa('0x33')];this[_0x76aa('0x34')]=_0xd6327[_0x76aa('0x34')];this[_0x76aa('0x35')]=_0xd6327['predictiveIntervalErlangCallsDroppedCalls'];this[_0x76aa('0x36')]=_0xd6327['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0xd6327[_0x76aa('0x37')];this[_0x76aa('0x38')]=_0xd6327[_0x76aa('0x38')];this[_0x76aa('0x39')]=_0xd6327['predictiveIntervalAvailable'];this[_0x76aa('0x3a')]=_0xd6327[_0x76aa('0x3a')];this[_0x76aa('0x7')]=_0xd6327['originated'];this[_0x76aa('0x3b')]=_0xd6327[_0x76aa('0x3b')];this[_0x76aa('0x3c')]=_0xd6327[_0x76aa('0x3c')];this[_0x76aa('0x3d')]=_0xd6327[_0x76aa('0x3d')];this[_0x76aa('0x3e')]=_0xd6327[_0x76aa('0x3e')];this[_0x76aa('0x3f')]=_0xd6327['startPredictive'];this[_0x76aa('0x40')]=_0xd6327[_0x76aa('0x40')];this[_0x76aa('0x41')]=_0xd6327[_0x76aa('0x41')];this[_0x76aa('0x42')]=_0xd6327[_0x76aa('0x42')];}if(_0xd6327['Trunk']){this['Trunk']={'id':_0xd6327[_0x76aa('0x43')]['id'],'name':_0xd6327[_0x76aa('0x43')][_0x76aa('0x14')],'active':_0xd6327[_0x76aa('0x43')]['active'],'callerid':_0xd6327[_0x76aa('0x43')][_0x76aa('0x44')]};}}VoiceQueueSummary[_0x76aa('0x45')][_0x76aa('0x46')]=function(_0x1138b5,_0x4aa2f3,_0x13dafe,_0x556f59){this[_0x76aa('0x1')]=0x0;this['talking']=0x0;this['paused']=0x0;this['unknown']=0x0;this[_0x76aa('0x1b')]=0x0;this['inUse']=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0x76aa('0x1f')]=0x0;this[_0x76aa('0x3')]=0x0;this[_0x76aa('0x1c')]=0x0;this[_0x76aa('0x1a')]=0x0;if(_0x13dafe){if(_0x13dafe[_0x76aa('0x0')]){this['available']=Number(_0x13dafe[_0x76aa('0x0')]);}if(_0x13dafe[_0x76aa('0x47')]){this[_0x76aa('0x19')]=Number(_0x13dafe[_0x76aa('0x47')]);}if(_0x13dafe[_0x76aa('0x48')]){this['waiting']=Number(_0x13dafe[_0x76aa('0x48')]);}}for(var _0x1c62a9=0x0;_0x1c62a9<_0x1138b5['length'];_0x1c62a9++){var _0x2d3441=_0x4aa2f3['SIP/'+_0x1138b5[_0x1c62a9][_0x76aa('0x14')]];if(_0x2d3441&&_0x2d3441[_0x76aa('0x49')]){this[_0x76aa('0x1')]+=0x1;}if(_0x1138b5[_0x1c62a9][_0x76aa('0x4a')]==='1'){this[_0x76aa('0x4')]+=0x1;}if(_0x1138b5[_0x1c62a9][_0x76aa('0x2')]==='1'&&!['2','7','8'][_0x76aa('0x4b')](_0x1138b5[_0x1c62a9][_0x76aa('0x4c')])){this[_0x76aa('0x2')]+=0x1;}switch(_0x1138b5[_0x1c62a9][_0x76aa('0x4c')]){case'0':this['unknown']+=0x1;break;case'1':this[_0x76aa('0x1b')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x76aa('0x17')]+=0x1;break;case'4':this[_0x76aa('0x18')]+=0x1;break;case'5':this[_0x76aa('0x1f')]+=0x1;break;case'6':this[_0x76aa('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x76aa('0x24')]==='booked'){var _0x8660a4=Object[_0x76aa('0x4d')](_0x556f59);for(var _0x4315b3=0x0;_0x4315b3<_0x8660a4[_0x76aa('0x4e')];_0x4315b3++){var _0x30c577=_0x8660a4[_0x4315b3];var _0x110f3c=_0x556f59[_0x30c577];if(_0x110f3c['queue']===this['name']&&_0x110f3c[_0x76aa('0x1e')]===_0x76aa('0x4f')&&_0x110f3c[_0x76aa('0x50')]===_0x76aa('0x51')){this[_0x76aa('0x4')]+=0x1;}}if(this[_0x76aa('0x4')]>this['inUse']){this[_0x76aa('0x4')]=this[_0x76aa('0x6')];}this[_0x76aa('0xf')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x76aa('0x52')]=function(_0x5c7d52){var _0x2a663a=![];if(_0x5c7d52){_0x2a663a=INBOUND_COUNTERS['some'](function(_0x339b0d){return this[_0x339b0d]!==_0x5c7d52[_0x339b0d];},this);}return _0x2a663a;};VoiceQueueSummary[_0x76aa('0x45')][_0x76aa('0x53')]=function(_0xd39920){var _0x37a4d9=![];var _0x316de3=![];var _0x953726=![];if(_0xd39920){_0x37a4d9=this['dialMethod']!==_0xd39920[_0x76aa('0x24')]||this['dialActive']!==_0xd39920[_0x76aa('0x23')]||this[_0x76aa('0x41')]!==_0xd39920[_0x76aa('0x41')]||this[_0x76aa('0x42')]!==_0xd39920[_0x76aa('0x42')];_0x316de3=OUTBOUND_COUNTERS[_0x76aa('0x54')](function(_0x336024){return this[_0x336024]!==_0xd39920[_0x336024];},this);if(this['Trunk']&&_0xd39920[_0x76aa('0x43')]){_0x953726=this[_0x76aa('0x43')][_0x76aa('0x14')]!==_0xd39920[_0x76aa('0x43')]['name']||this[_0x76aa('0x43')][_0x76aa('0x55')]!==_0xd39920[_0x76aa('0x43')][_0x76aa('0x55')];}}return _0x37a4d9||_0x316de3||_0x953726;};VoiceQueueSummary[_0x76aa('0x45')][_0x76aa('0x56')]=function(_0x4e6c09){this[_0x76aa('0x5')]=_0x4e6c09[_0x76aa('0x5')];this[_0x76aa('0x41')]=_0x4e6c09[_0x76aa('0x41')];this[_0x76aa('0x42')]=_0x4e6c09[_0x76aa('0x42')];this[_0x76aa('0x7')]=_0x4e6c09['originated'];this['outboundAbandonedCallsDay']=_0x4e6c09[_0x76aa('0x57')];this[_0x76aa('0x8')]=_0x4e6c09['outboundAnswerCallsDay'];this[_0x76aa('0x9')]=_0x4e6c09[_0x76aa('0x9')];this['outboundBusyCallsDay']=_0x4e6c09[_0x76aa('0xa')];this[_0x76aa('0x2b')]=_0x4e6c09[_0x76aa('0x2b')];this[_0x76aa('0xb')]=_0x4e6c09[_0x76aa('0xb')];this[_0x76aa('0xc')]=_0x4e6c09[_0x76aa('0xc')];this[_0x76aa('0xd')]=_0x4e6c09[_0x76aa('0xd')];this['outboundRejectCallsDay']=_0x4e6c09[_0x76aa('0x30')];this['outboundUnknownCallsDay']=_0x4e6c09[_0x76aa('0xe')];this[_0x76aa('0x10')]=_0x4e6c09[_0x76aa('0x10')];this[_0x76aa('0x11')]=_0x4e6c09[_0x76aa('0x11')];this[_0x76aa('0x12')]=_0x4e6c09[_0x76aa('0x12')];if(this[_0x76aa('0x24')]===_0x76aa('0x58')){this['pTalking']=_0x4e6c09[_0x76aa('0xf')];}};module[_0x76aa('0x59')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 6780c90..194c3bd 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 _0x7107=['remoteUri','serverUrl','Configurations','name','username'];(function(_0x363441,_0x288e66){var _0x30f706=function(_0x1479ff){while(--_0x1479ff){_0x363441['push'](_0x363441['shift']());}};_0x30f706(++_0x288e66);}(_0x7107,0x17a));var _0x7710=function(_0x452849,_0x4aeb7f){_0x452849=_0x452849-0x0;var _0x43dd13=_0x7107[_0x452849];return _0x43dd13;};'use strict';function VtigerAccount(_0x4e377d){this['id']=_0x4e377d['id']||0x0;this[_0x7710('0x0')]=_0x4e377d[_0x7710('0x0')]||'';this['username']=_0x4e377d[_0x7710('0x1')]||'';this['accessKey']=_0x4e377d['accessKey']||'';this[_0x7710('0x2')]=_0x4e377d[_0x7710('0x2')]||'';this[_0x7710('0x3')]=_0x4e377d[_0x7710('0x3')]||'';this[_0x7710('0x4')]=_0x4e377d[_0x7710('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x4fb3=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x59e32d,_0x81952f){var _0x1d0362=function(_0x429316){while(--_0x429316){_0x59e32d['push'](_0x59e32d['shift']());}};_0x1d0362(++_0x81952f);}(_0x4fb3,0x13e));var _0x34fb=function(_0x1ab65a,_0x2d77f0){_0x1ab65a=_0x1ab65a-0x0;var _0x4b2e9d=_0x4fb3[_0x1ab65a];return _0x4b2e9d;};'use strict';function VtigerAccount(_0x30c425){this['id']=_0x30c425['id']||0x0;this[_0x34fb('0x0')]=_0x30c425[_0x34fb('0x0')]||'';this[_0x34fb('0x1')]=_0x30c425[_0x34fb('0x1')]||'';this[_0x34fb('0x2')]=_0x30c425[_0x34fb('0x2')]||'';this[_0x34fb('0x3')]=_0x30c425[_0x34fb('0x3')]||'';this[_0x34fb('0x4')]=_0x30c425['serverUrl']||'';this[_0x34fb('0x5')]=_0x30c425[_0x34fb('0x5')]||{};}module[_0x34fb('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index a9ffb37..aa85b38 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 _0xb75a=['exports','name','password','token','remoteUri','authType','type','Configurations'];(function(_0x5b5ed5,_0x5ea1c0){var _0x448ea9=function(_0x4b24ba){while(--_0x4b24ba){_0x5b5ed5['push'](_0x5b5ed5['shift']());}};_0x448ea9(++_0x5ea1c0);}(_0xb75a,0xc9));var _0xab75=function(_0x3f4098,_0x3365b2){_0x3f4098=_0x3f4098-0x0;var _0x3d5d0c=_0xb75a[_0x3f4098];return _0x3d5d0c;};'use strict';function ZendeskAccount(_0x21b5ba){this['id']=_0x21b5ba['id']||0x0;this[_0xab75('0x0')]=_0x21b5ba[_0xab75('0x0')]||'';this['username']=_0x21b5ba['username']||'';this[_0xab75('0x1')]=_0x21b5ba[_0xab75('0x1')]||'';this[_0xab75('0x2')]=_0x21b5ba[_0xab75('0x2')]||'';this['remoteUri']=_0x21b5ba[_0xab75('0x3')]||'';this[_0xab75('0x4')]=_0x21b5ba[_0xab75('0x4')]||'';this['type']=_0x21b5ba[_0xab75('0x5')]||'integrationTab';this['serverUrl']=_0x21b5ba['serverUrl']||'';this['Configurations']=_0x21b5ba[_0xab75('0x6')]||{};}module[_0xab75('0x7')]=ZendeskAccount; \ No newline at end of file +var _0xfe0e=['username','password','token','remoteUri','authType','type','serverUrl','Configurations','exports','name'];(function(_0x15e282,_0xab74ec){var _0x389c83=function(_0x1ce311){while(--_0x1ce311){_0x15e282['push'](_0x15e282['shift']());}};_0x389c83(++_0xab74ec);}(_0xfe0e,0xa9));var _0xefe0=function(_0x236e4b,_0x136c92){_0x236e4b=_0x236e4b-0x0;var _0x5cce4e=_0xfe0e[_0x236e4b];return _0x5cce4e;};'use strict';function ZendeskAccount(_0x418c5f){this['id']=_0x418c5f['id']||0x0;this[_0xefe0('0x0')]=_0x418c5f['name']||'';this[_0xefe0('0x1')]=_0x418c5f[_0xefe0('0x1')]||'';this['password']=_0x418c5f[_0xefe0('0x2')]||'';this[_0xefe0('0x3')]=_0x418c5f[_0xefe0('0x3')]||'';this['remoteUri']=_0x418c5f[_0xefe0('0x4')]||'';this[_0xefe0('0x5')]=_0x418c5f['authType']||'';this[_0xefe0('0x6')]=_0x418c5f[_0xefe0('0x6')]||'integrationTab';this[_0xefe0('0x7')]=_0x418c5f[_0xefe0('0x7')]||'';this[_0xefe0('0x8')]=_0x418c5f[_0xefe0('0x8')]||{};}module[_0xefe0('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 97d742b..482636a 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 _0xdd1d=['zone','clientId','clientSecret','serverUrl','code','refreshToken','exports','name','description','host'];(function(_0x386709,_0x49f5e3){var _0x4fbe5b=function(_0x114249){while(--_0x114249){_0x386709['push'](_0x386709['shift']());}};_0x4fbe5b(++_0x49f5e3);}(_0xdd1d,0xc5));var _0xddd1=function(_0x335cfa,_0x1e7634){_0x335cfa=_0x335cfa-0x0;var _0xb7a81b=_0xdd1d[_0x335cfa];return _0xb7a81b;};'use strict';function ZohoAccount(_0x5c5dbc){this['id']=_0x5c5dbc['id']||0x0;this[_0xddd1('0x0')]=_0x5c5dbc[_0xddd1('0x0')]||'';this[_0xddd1('0x1')]=_0x5c5dbc['description']||'';this[_0xddd1('0x2')]=_0x5c5dbc[_0xddd1('0x2')]||'';this[_0xddd1('0x3')]=_0x5c5dbc[_0xddd1('0x3')]||'';this['clientId']=_0x5c5dbc[_0xddd1('0x4')]||'';this['clientSecret']=_0x5c5dbc[_0xddd1('0x5')]||'';this[_0xddd1('0x6')]=_0x5c5dbc[_0xddd1('0x6')]||'';this['code']=_0x5c5dbc[_0xddd1('0x7')]||'';this[_0xddd1('0x8')]=_0x5c5dbc[_0xddd1('0x8')]||'';this['Configurations']=_0x5c5dbc['Configurations']||{};}module[_0xddd1('0x9')]=ZohoAccount; \ No newline at end of file +var _0x3dac=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x3c6ab7,_0x311d17){var _0x1b135d=function(_0x1a7aa2){while(--_0x1a7aa2){_0x3c6ab7['push'](_0x3c6ab7['shift']());}};_0x1b135d(++_0x311d17);}(_0x3dac,0x127));var _0xc3da=function(_0x24ec15,_0x3fd1f8){_0x24ec15=_0x24ec15-0x0;var _0x1a0ba3=_0x3dac[_0x24ec15];return _0x1a0ba3;};'use strict';function ZohoAccount(_0x446f4f){this['id']=_0x446f4f['id']||0x0;this[_0xc3da('0x0')]=_0x446f4f[_0xc3da('0x0')]||'';this[_0xc3da('0x1')]=_0x446f4f[_0xc3da('0x1')]||'';this[_0xc3da('0x2')]=_0x446f4f[_0xc3da('0x2')]||'';this[_0xc3da('0x3')]=_0x446f4f[_0xc3da('0x3')]||'';this[_0xc3da('0x4')]=_0x446f4f['clientId']||'';this[_0xc3da('0x5')]=_0x446f4f[_0xc3da('0x5')]||'';this['serverUrl']=_0x446f4f[_0xc3da('0x6')]||'';this[_0xc3da('0x7')]=_0x446f4f[_0xc3da('0x7')]||'';this[_0xc3da('0x8')]=_0x446f4f[_0xc3da('0x8')]||'';this[_0xc3da('0x9')]=_0x446f4f[_0xc3da('0x9')]||{};}module[_0xc3da('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 006b22b..fd34884 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 _0x0598=['Contact','phone','firstName','lastName','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','name','SIP/%s','calleridname'];(function(_0x5f57a2,_0xabf9ef){var _0x2c23ec=function(_0x4c09fd){while(--_0x4c09fd){_0x5f57a2['push'](_0x5f57a2['shift']());}};_0x2c23ec(++_0xabf9ef);}(_0x0598,0x92));var _0x8059=function(_0x1aa284,_0x104b75){_0x1aa284=_0x1aa284-0x0;var _0x43d7d5=_0x0598[_0x1aa284];return _0x43d7d5;};'use strict';var util=require(_0x8059('0x0'));var _=require(_0x8059('0x1'));var moment=require('moment');function checkNameSurname(_0x3386f0,_0x52c9bf,_0x4dad54){var _0x14109c='';if(!_[_0x8059('0x2')](_0x52c9bf)&&'string'===typeof _0x52c9bf){_0x14109c+=_0x52c9bf;}if(!_['isNil'](_0x4dad54)&&'string'===typeof _0x4dad54){_0x14109c+='\x20'+_0x4dad54;}if(_0x14109c!==''){return _0x14109c;}return _0x3386f0;}function Action(_0x467206,_0xa7d7c1,_0x512c0f,_0x5996d7,_0x248273){this[_0x8059('0x3')]=_0x512c0f||undefined;this[_0x8059('0x4')]=_0x467206['id'];this[_0x8059('0x5')]=_0xa7d7c1['name'];this['type']=_0xa7d7c1[_0x8059('0x6')];this[_0x8059('0x7')]=_0x8059('0x5');this[_0x8059('0x8')]=![];this[_0x8059('0x9')]=_['isNil'](_0x467206['Agent'])?undefined:_0x467206[_0x8059('0xa')][_0x8059('0xb')];this['channelAgent']=this['membername']?util['format'](_0x8059('0xc'),this[_0x8059('0x9')]):_0x5996d7||undefined;this[_0x8059('0xd')]=checkNameSurname(_0x467206[_0x8059('0xe')][_0x8059('0xf')],_0x467206['Contact'][_0x8059('0x10')],_0x467206['Contact'][_0x8059('0x11')]);this['active']=_0x467206[_0x8059('0x12')]||![];this[_0x8059('0x13')]=_0x467206[_0x8059('0xf')];this['scheduledat']=_0x467206['scheduledat'];this['countbusyretry']=_0x467206[_0x8059('0x14')]||0x0;this[_0x8059('0x15')]=_0x467206[_0x8059('0x15')]||0x0;this[_0x8059('0x16')]=_0x467206[_0x8059('0x16')]||0x0;this['countglobal']=(_0x467206[_0x8059('0x14')]||0x0)+(_0x467206[_0x8059('0x15')]||0x0)+(_0x467206[_0x8059('0x16')]||0x0)+(_0x467206[_0x8059('0x17')]||0x0)+(_0x467206['countdropretry']||0x0)+(_0x467206[_0x8059('0x18')]||0x0)+(_0x467206['countmachineretry']||0x0)+(_0x467206[_0x8059('0x19')]||0x0);this['countnosuchnumberretry']=_0x467206[_0x8059('0x17')]||0x0;this['countdropretry']=_0x467206[_0x8059('0x1a')]||0x0;this[_0x8059('0x18')]=_0x467206[_0x8059('0x18')]||0x0;this['countmachineretry']=_0x467206['countmachineretry']||0x0;this[_0x8059('0x19')]=_0x467206[_0x8059('0x19')]||0x0;this[_0x8059('0x1b')]=_0x467206[_0x8059('0x1b')];this['callbackuniqueid']=_0x467206[_0x8059('0x1c')];this[_0x8059('0x1d')]=_0x467206[_0x8059('0x1d')];this['recallme']=_0x467206[_0x8059('0x1e')];this[_0x8059('0x1f')]=_0x467206[_0x8059('0x1f')];this[_0x8059('0x20')]=_0x467206['ListId'];this[_0x8059('0x21')]=_[_0x8059('0x2')](_0x467206[_0x8059('0xa')])?_0x467206[_0x8059('0x21')]:_0x467206[_0x8059('0xa')]['id'];this['VoiceQueueId']=_0x467206[_0x8059('0x22')];this[_0x8059('0x23')]='';this[_0x8059('0x24')]='';}Action['prototype']['getCaller']=function(){return util['format'](_0x8059('0x25'),this[_0x8059('0xd')],this[_0x8059('0x26')]);};module[_0x8059('0x27')]=Action; \ No newline at end of file +var _0x8f4c=['lodash','moment','isNil','string','idContact','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util'];(function(_0x303195,_0x1c19ac){var _0x2e6e79=function(_0x518e64){while(--_0x518e64){_0x303195['push'](_0x303195['shift']());}};_0x2e6e79(++_0x1c19ac);}(_0x8f4c,0x113));var _0xc8f4=function(_0x5dcf9e,_0x46534c){_0x5dcf9e=_0x5dcf9e-0x0;var _0x198a2c=_0x8f4c[_0x5dcf9e];return _0x198a2c;};'use strict';var util=require(_0xc8f4('0x0'));var _=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));function checkNameSurname(_0x43926b,_0x19893b,_0x134d73){var _0x580083='';if(!_[_0xc8f4('0x3')](_0x19893b)&&_0xc8f4('0x4')===typeof _0x19893b){_0x580083+=_0x19893b;}if(!_[_0xc8f4('0x3')](_0x134d73)&&'string'===typeof _0x134d73){_0x580083+='\x20'+_0x134d73;}if(_0x580083!==''){return _0x580083;}return _0x43926b;}function Action(_0x32cd80,_0x5208da,_0x4c86f8,_0x520063,_0x373506){this['uniqueid']=_0x4c86f8||undefined;this[_0xc8f4('0x5')]=_0x32cd80['id'];this[_0xc8f4('0x6')]=_0x5208da[_0xc8f4('0x7')];this[_0xc8f4('0x8')]=_0x5208da[_0xc8f4('0x8')];this['campaigntype']=_0xc8f4('0x6');this[_0xc8f4('0x9')]=![];this[_0xc8f4('0xa')]=_[_0xc8f4('0x3')](_0x32cd80['Agent'])?undefined:_0x32cd80[_0xc8f4('0xb')]['name'];this[_0xc8f4('0xc')]=this[_0xc8f4('0xa')]?util[_0xc8f4('0xd')](_0xc8f4('0xe'),this[_0xc8f4('0xa')]):_0x520063||undefined;this['calleridname']=checkNameSurname(_0x32cd80[_0xc8f4('0xf')][_0xc8f4('0x10')],_0x32cd80[_0xc8f4('0xf')][_0xc8f4('0x11')],_0x32cd80[_0xc8f4('0xf')][_0xc8f4('0x12')]);this['active']=_0x32cd80[_0xc8f4('0x13')]||![];this[_0xc8f4('0x14')]=_0x32cd80[_0xc8f4('0x10')];this[_0xc8f4('0x15')]=_0x32cd80[_0xc8f4('0x15')];this['countbusyretry']=_0x32cd80[_0xc8f4('0x16')]||0x0;this['countcongestionretry']=_0x32cd80['countcongestionretry']||0x0;this[_0xc8f4('0x17')]=_0x32cd80[_0xc8f4('0x17')]||0x0;this[_0xc8f4('0x18')]=(_0x32cd80[_0xc8f4('0x16')]||0x0)+(_0x32cd80[_0xc8f4('0x19')]||0x0)+(_0x32cd80[_0xc8f4('0x17')]||0x0)+(_0x32cd80[_0xc8f4('0x1a')]||0x0)+(_0x32cd80[_0xc8f4('0x1b')]||0x0)+(_0x32cd80[_0xc8f4('0x1c')]||0x0)+(_0x32cd80[_0xc8f4('0x1d')]||0x0)+(_0x32cd80[_0xc8f4('0x1e')]||0x0);this[_0xc8f4('0x1a')]=_0x32cd80[_0xc8f4('0x1a')]||0x0;this['countdropretry']=_0x32cd80[_0xc8f4('0x1b')]||0x0;this[_0xc8f4('0x1c')]=_0x32cd80[_0xc8f4('0x1c')]||0x0;this[_0xc8f4('0x1d')]=_0x32cd80[_0xc8f4('0x1d')]||0x0;this[_0xc8f4('0x1e')]=_0x32cd80[_0xc8f4('0x1e')]||0x0;this[_0xc8f4('0x1f')]=_0x32cd80['callback'];this[_0xc8f4('0x20')]=_0x32cd80[_0xc8f4('0x20')];this[_0xc8f4('0x21')]=_0x32cd80[_0xc8f4('0x21')];this['recallme']=_0x32cd80[_0xc8f4('0x22')];this['ContactId']=_0x32cd80[_0xc8f4('0x23')];this['ListId']=_0x32cd80[_0xc8f4('0x24')];this[_0xc8f4('0x25')]=_['isNil'](_0x32cd80[_0xc8f4('0xb')])?_0x32cd80[_0xc8f4('0x25')]:_0x32cd80[_0xc8f4('0xb')]['id'];this[_0xc8f4('0x26')]=_0x32cd80['VoiceQueueId'];this[_0xc8f4('0x27')]='';this[_0xc8f4('0x28')]='';}Action['prototype'][_0xc8f4('0x29')]=function(){return util[_0xc8f4('0xd')](_0xc8f4('0x2a'),this[_0xc8f4('0x2b')],this[_0xc8f4('0x2c')]);};module[_0xc8f4('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 14c7d7c..6a041de 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 _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x1a818e,_0x1ad18b){var _0x1f0b8e=function(_0x120ec3){while(--_0x120ec3){_0x1a818e['push'](_0x1a818e['shift']());}};_0x1f0b8e(++_0x1ad18b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x3c9e98,_0x4f715e){var _0x1943e9=function(_0x3e7c3a){while(--_0x3e7c3a){_0x3c9e98['push'](_0x3c9e98['shift']());}};_0x1943e9(++_0x4f715e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 24d61a6..203a4d8 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 _0xea79=['catch','resolve','then','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','UserId','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','xcally-motion-preview','assigned','queuecallerexitreason','COMPLETED','create','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory'];(function(_0x5d46fa,_0x472f27){var _0x5b49ec=function(_0x1205b8){while(--_0x1205b8){_0x5d46fa['push'](_0x5d46fa['shift']());}};_0x5b49ec(++_0x472f27);}(_0xea79,0x8a));var _0x9ea7=function(_0x103466,_0x190bb5){_0x103466=_0x103466-0x0;var _0x416ba8=_0xea79[_0x103466];return _0x416ba8;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x9ea7('0x0'))(_0x9ea7('0x1'));var cmHopper=require(_0x9ea7('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x9ea7('0x3'));var agentReportPreview=require(_0x9ea7('0x4'));var voiceQueueReport=require(_0x9ea7('0x5'));function loggerCatch(_0x569931){return function(_0x3599a9){logger[_0x9ea7('0x6')](_0x569931,util[_0x9ea7('0x7')](_0x3599a9,{'showHidden':![],'depth':null}));};}function create(_0x52cee4){return cmHopperHistory[_0x9ea7('0x8')](_0x52cee4)[_0x9ea7('0x9')](loggerCatch('[createHistory]\x20'));}function createAgent(_0xc2a7f4){return BPromise[_0x9ea7('0xa')]()[_0x9ea7('0xb')](agentReportPreview['createHistory'](_0xc2a7f4))[_0x9ea7('0x9')](loggerCatch(_0x9ea7('0xc')));}function moveContact(_0x183bfd){return cmHopper[_0x9ea7('0xd')](_0x183bfd,!![])[_0x9ea7('0x9')](loggerCatch(_0x9ea7('0xe')));}exports[_0x9ea7('0xf')]=function(_0x2534f9){return cmHopperBlack[_0x9ea7('0xf')](_0x2534f9)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x9ea7('0x10')]=function(_0x40cc7a){return BPromise[_0x9ea7('0xa')]()[_0x9ea7('0xb')](cmHopper[_0x9ea7('0x10')](_0x40cc7a))[_0x9ea7('0x9')](loggerCatch(_0x9ea7('0x11')));};exports[_0x9ea7('0x8')]=function(_0x596471,_0x4d9c62){create(_0x596471)[_0x9ea7('0x9')](loggerCatch(_0x4d9c62));moveContact(_0x596471)['catch'](loggerCatch(_0x4d9c62));};exports[_0x9ea7('0x12')]=function(_0x3ca9b7,_0x338a37){createAgent(_0x3ca9b7)[_0x9ea7('0x9')](loggerCatch(_0x338a37));};exports[_0x9ea7('0x13')]=function(_0x44899b,_0x285485){create(_0x44899b)[_0x9ea7('0x9')](loggerCatch(_0x285485));};exports['createCustomerFinal']=function(_0x5720f5,_0x9434f6){moveContact(_0x5720f5)[_0x9ea7('0x9')](loggerCatch(_0x9434f6));};exports['rescheduleContact']=function(_0x56b4c0,_0x14e126,_0x2b5fb7){if(_0x14e126){_0x56b4c0[_0x9ea7('0x14')]=null;}if(_0x2b5fb7){_0x56b4c0[_0x9ea7('0x15')]=![];}return cmHopper['rescheduleContact'](_0x56b4c0)[_0x9ea7('0x9')](loggerCatch(_0x9ea7('0x16')));};exports['countReScheduled']=function(_0x28216c){return cmHopper['countReScheduled'](_0x28216c)[_0x9ea7('0x9')](loggerCatch(_0x9ea7('0x17')));};exports[_0x9ea7('0x18')]=function(_0x1ee146){return cmHopper['unlockContact']({'UserId':null},_0x1ee146,0x1)[_0x9ea7('0x9')](loggerCatch(_0x9ea7('0x19')));};exports[_0x9ea7('0x1a')]=function(_0x5e8da2){return cmHopper[_0x9ea7('0x18')]({'active':![]},_0x5e8da2,0x1)[_0x9ea7('0x9')](loggerCatch(_0x9ea7('0x1b')));};exports[_0x9ea7('0x1c')]=function(_0x465787){var _0x4531ce={};_0x4531ce[_0x9ea7('0x1d')]=_0x465787['type'];_0x4531ce['uniqueid']=_0x465787['uniqueid'];_0x4531ce[_0x9ea7('0x1e')]=_0x465787[_0x9ea7('0x1e')];_0x4531ce[_0x9ea7('0x1f')]=_0x465787[_0x9ea7('0x1f')];_0x4531ce['queue']=_0x465787[_0x9ea7('0x20')];_0x4531ce['queuecallerjoinAt']=_0x465787[_0x9ea7('0x21')];_0x4531ce[_0x9ea7('0x22')]=_0x465787['answertime'];_0x4531ce[_0x9ea7('0x23')]=0x1;_0x4531ce[_0x9ea7('0x24')]=_0x465787[_0x9ea7('0x25')];_0x4531ce[_0x9ea7('0x26')]=_0x465787['membername'];_0x4531ce[_0x9ea7('0x27')]=_0x9ea7('0x28');_0x4531ce['exten']=_0x9ea7('0x29');_0x4531ce['holdtime']=0x0;_0x4531ce[_0x9ea7('0x2a')]=0x1;_0x4531ce['lastAssignedTo']=_0x465787['membername'];_0x4531ce[_0x9ea7('0x2b')]=_0x9ea7('0x2c');return BPromise[_0x9ea7('0xa')]()[_0x9ea7('0xb')](voiceQueueReport[_0x9ea7('0x2d')](_0x4531ce))[_0x9ea7('0x9')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x2c1d7e,_0x38b9f2){return BPromise[_0x9ea7('0xa')]()['then'](cmHopper['getContactRecallMe'](_0x2c1d7e,_0x38b9f2))[_0x9ea7('0x9')](loggerCatch(_0x9ea7('0x2e')));};exports[_0x9ea7('0x2f')]=function(_0x39700d){return cmHopper['rescheduleContact'](_0x39700d,!![],!![])['catch'](loggerCatch(_0x9ea7('0x30')));}; \ No newline at end of file +var _0x0919=['error','inspect','catch','[createHistory]\x20','resolve','createHistory','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperBlack'];(function(_0x39dd57,_0x4ef720){var _0x25171a=function(_0x30e588){while(--_0x30e588){_0x39dd57['push'](_0x39dd57['shift']());}};_0x25171a(++_0x4ef720);}(_0x0919,0x1e1));var _0x9091=function(_0x193927,_0x545c88){_0x193927=_0x193927-0x0;var _0x1d21b1=_0x0919[_0x193927];return _0x1d21b1;};'use strict';var util=require(_0x9091('0x0'));var BPromise=require(_0x9091('0x1'));var logger=require('../../../config/logger')(_0x9091('0x2'));var cmHopper=require(_0x9091('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x9091('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x173767){return function(_0xef08f2){logger[_0x9091('0x5')](_0x173767,util[_0x9091('0x6')](_0xef08f2,{'showHidden':![],'depth':null}));};}function create(_0xa96738){return cmHopperHistory['createHistory'](_0xa96738)[_0x9091('0x7')](loggerCatch(_0x9091('0x8')));}function createAgent(_0x51e342){return BPromise[_0x9091('0x9')]()['then'](agentReportPreview[_0x9091('0xa')](_0x51e342))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x52d7cf){return cmHopper['moveContactManagedDialer'](_0x52d7cf,!![])[_0x9091('0x7')](loggerCatch(_0x9091('0xb')));}exports[_0x9091('0xc')]=function(_0x38fd42){return cmHopperBlack[_0x9091('0xc')](_0x38fd42)[_0x9091('0x7')](loggerCatch(_0x9091('0xd')));};exports[_0x9091('0xe')]=function(_0x27a742){return BPromise[_0x9091('0x9')]()[_0x9091('0xf')](cmHopper['getContactPreview'](_0x27a742))[_0x9091('0x7')](loggerCatch(_0x9091('0x10')));};exports['createHistory']=function(_0x520744,_0x43ca35){create(_0x520744)[_0x9091('0x7')](loggerCatch(_0x43ca35));moveContact(_0x520744)[_0x9091('0x7')](loggerCatch(_0x43ca35));};exports[_0x9091('0x11')]=function(_0x23b47c,_0x8cb2bc){createAgent(_0x23b47c)[_0x9091('0x7')](loggerCatch(_0x8cb2bc));};exports[_0x9091('0x12')]=function(_0x3e6e0c,_0x39e9f3){create(_0x3e6e0c)[_0x9091('0x7')](loggerCatch(_0x39e9f3));};exports[_0x9091('0x13')]=function(_0xe7347,_0x1060a0){moveContact(_0xe7347)[_0x9091('0x7')](loggerCatch(_0x1060a0));};exports[_0x9091('0x14')]=function(_0x448145,_0x300c5c,_0x4b8800){if(_0x300c5c){_0x448145[_0x9091('0x15')]=null;}if(_0x4b8800){_0x448145[_0x9091('0x16')]=![];}return cmHopper[_0x9091('0x14')](_0x448145)[_0x9091('0x7')](loggerCatch(_0x9091('0x17')));};exports[_0x9091('0x18')]=function(_0x38f714){return cmHopper[_0x9091('0x18')](_0x38f714)['catch'](loggerCatch(_0x9091('0x19')));};exports[_0x9091('0x1a')]=function(_0x14115d){return cmHopper[_0x9091('0x1a')]({'UserId':null},_0x14115d,0x1)[_0x9091('0x7')](loggerCatch('[unlockContact]\x20'));};exports[_0x9091('0x1b')]=function(_0x3e6b5b){return cmHopper[_0x9091('0x1a')]({'active':![]},_0x3e6b5b,0x1)[_0x9091('0x7')](loggerCatch(_0x9091('0x1c')));};exports[_0x9091('0x1d')]=function(_0x2a87cb){var _0x3288c1={};_0x3288c1[_0x9091('0x1e')]=_0x2a87cb[_0x9091('0x1e')];_0x3288c1['uniqueid']=_0x2a87cb[_0x9091('0x1f')];_0x3288c1[_0x9091('0x20')]=_0x2a87cb[_0x9091('0x20')];_0x3288c1[_0x9091('0x21')]=_0x2a87cb[_0x9091('0x21')];_0x3288c1[_0x9091('0x22')]=_0x2a87cb[_0x9091('0x22')];_0x3288c1[_0x9091('0x23')]=_0x2a87cb[_0x9091('0x24')];_0x3288c1[_0x9091('0x25')]=_0x2a87cb[_0x9091('0x24')];_0x3288c1[_0x9091('0x26')]=0x1;_0x3288c1['queuecallercompleteAt']=_0x2a87cb['endtime'];_0x3288c1[_0x9091('0x27')]=_0x2a87cb[_0x9091('0x28')];_0x3288c1[_0x9091('0x29')]=_0x9091('0x2a');_0x3288c1[_0x9091('0x2b')]=_0x9091('0x2c');_0x3288c1[_0x9091('0x2d')]=0x0;_0x3288c1['assigned']=0x1;_0x3288c1['lastAssignedTo']=_0x2a87cb['membername'];_0x3288c1[_0x9091('0x2e')]=_0x9091('0x2f');return BPromise[_0x9091('0x9')]()[_0x9091('0xf')](voiceQueueReport[_0x9091('0x30')](_0x3288c1))[_0x9091('0x7')](loggerCatch(_0x9091('0x31')));};exports[_0x9091('0x32')]=function(_0x2f02d5,_0x1fefae){return BPromise[_0x9091('0x9')]()[_0x9091('0xf')](cmHopper[_0x9091('0x32')](_0x2f02d5,_0x1fefae))[_0x9091('0x7')](loggerCatch(_0x9091('0x33')));};exports[_0x9091('0x34')]=function(_0x24efd7){return cmHopper['rescheduleContact'](_0x24efd7,!![],!![])[_0x9091('0x7')](loggerCatch(_0x9091('0x35')));}; \ 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 49ea45f..0bec95d 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 _0x6cb8=['VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','name','motionChannel','voice','mandatoryDisposition','not_inuse','status','reachable','push','getDiff','diff','seconds','createBody','CampaignId','filterKey','idContact','queue','campaigntype','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosloss','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','logger','inspect','loggerError','info','string','isEmpty','isUndefined','format','\x22\x22\x20<>','isActive','addVariables','Queue','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_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','Blacklist','responsetime','endtime','statedesc','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','getSeconds','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ListId'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x6cb8,0x1e2));var _0x86cb=function(_0x41856a,_0x54b172){_0x41856a=_0x41856a-0x0;var _0x55fd58=_0x6cb8[_0x41856a];return _0x55fd58;};'use strict';var util=require(_0x86cb('0x0'));var _=require(_0x86cb('0x1'));var moment=require(_0x86cb('0x2'));var logger=require(_0x86cb('0x3'))(_0x86cb('0x4'));var ipAgi=process[_0x86cb('0x5')][_0x86cb('0x6')]||_0x86cb('0x7');var utils=require(_0x86cb('0x8'));exports[_0x86cb('0x9')]=function(_0x300572){return function(_0x1d66ca){logger[_0x86cb('0xa')](_0x300572,util['inspect'](_0x1d66ca,{'showHidden':![],'depth':null}));};};exports[_0x86cb('0xb')]=function(_0x3f1d11,_0x22fd75){logger['info'](_0x3f1d11,util[_0x86cb('0xc')](_0x22fd75,{'showHidden':![],'depth':null}));};exports[_0x86cb('0xd')]=function(_0x4f3f5b,_0x3c454a){logger[_0x86cb('0xa')](_0x4f3f5b,util['inspect'](_0x3c454a,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x260dfb){return function(_0x49bbd2){logger[_0x86cb('0xe')](_0x260dfb,util[_0x86cb('0xc')](_0x49bbd2,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x3cc857,_0x4b7e76,_0x392cf0){return{'message':_0x3cc857,'unlock':_0x4b7e76,'active':_0x392cf0};};exports['getCallerId']=function(_0x29a7dd,_0x4d2fc7,_0x4c7e19){if(!_['isUndefined'](_0x4c7e19)&&_0x86cb('0xf')===typeof _0x4c7e19&&!_[_0x86cb('0x10')](_0x4c7e19)){if(!_[_0x86cb('0x11')](_0x4d2fc7)&&_0x86cb('0xf')===typeof _0x4d2fc7&&!_['isEmpty'](_0x4d2fc7)){return util[_0x86cb('0x12')]('\x22%s\x22\x20<%s>',_0x4d2fc7,_0x4c7e19);}return util[_0x86cb('0x12')]('\x22%s\x22\x20<%s>',_0x4c7e19,_0x4c7e19);}if(!_[_0x86cb('0x11')](_0x29a7dd)&&_0x86cb('0xf')===typeof _0x29a7dd&&!_[_0x86cb('0x10')](_0x29a7dd)){return _0x29a7dd;}return _0x86cb('0x13');};exports[_0x86cb('0x14')]=function(_0x46e3a7){if(_['isNil'](_0x46e3a7)){return![];}return _0x46e3a7;};exports[_0x86cb('0x15')]=function(_0x565c16,_0x46a7b5,_0x581dac,_0x31d8d7,_0xa47812,_0x25cfae){var _0x25e44f={'XMD-QUEUE':_0x46a7b5[_0x86cb('0x16')]?_0x46a7b5[_0x86cb('0x16')]['name']:'','XMD-CALLERID':_0x31d8d7,'XMD-CALLERID-PREVIEW':_0x25cfae?util['format'](_0x86cb('0x17'),_0x25cfae[_0x86cb('0x18')],_0x25cfae[_0x86cb('0x19')]):_0x31d8d7,'XMD-DIALID':_0xa47812,'XMD-CONTACTID':_0x46a7b5[_0x86cb('0x1a')],'XMD-CDRTYPE':_0x86cb('0x1b'),'CALLERID(all)':_0x31d8d7,'XMD-VOICEQUEUEID':_0x46a7b5['VoiceQueueId'],'XMD-DIALCHANNEL':_0x581dac,'XMD-DIALTIMEOUT':_0x565c16[_0x86cb('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x86cb('0x12')](_0x86cb('0x1d'),_0x565c16['dialQueueProject2']?'g':'',_['isEmpty'](_0x565c16[_0x86cb('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x565c16[_0x86cb('0x1f')]||'','XMD-AGI':_0x565c16[_0x86cb('0x20')]?util['format'](_0x86cb('0x21'),ipAgi,_0x565c16['dialQueueProject']):_0x86cb('0x22'),'XMD-AGIAFTER':_0x565c16['dialQueueProject2']?util[_0x86cb('0x12')](_0x86cb('0x21'),ipAgi,_0x565c16[_0x86cb('0x23')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x25cfae?_0x25cfae[_0x86cb('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x25cfae?_0x25cfae[_0x86cb('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x86cb('0x26')};if(!_[_0x86cb('0x10')](_0x565c16[_0x86cb('0x1e')])){_0x25e44f[util['format']('%s',_0x86cb('0x27'))]=_0x565c16[_0x86cb('0x1e')];_0x25e44f[util[_0x86cb('0x12')]('%s',_0x86cb('0x28'))]=_0xa47812;}return _0x25e44f;};exports[_0x86cb('0x29')]=function(_0x330feb){var _0x26e2f9={};for(var _0x3b5c79 in _0x330feb){if(_0x330feb[_0x86cb('0x2a')](_0x3b5c79)){_0x26e2f9[util['format']('%s',_[_0x86cb('0x2b')](_0x3b5c79))]=_0x330feb[_0x3b5c79];}}return{'variables':_0x26e2f9};};exports[_0x86cb('0x2c')]=function(_0x562e1a,_0x5de6c2){if(!_[_0x86cb('0x2d')](_0x562e1a)){if(_0x562e1a[_0x86cb('0x2a')](_0x86cb('0x2e'))){if(_0x562e1a[_0x86cb('0x2e')]>0x0){_0x562e1a[_0x86cb('0x2e')]-=0x1;}else{logger[_0x86cb('0xa')](_0x86cb('0x2f'),_0x5de6c2);}}}else{logger[_0x86cb('0xa')](_0x86cb('0x30'),_0x5de6c2);}};exports[_0x86cb('0x31')]=function(_0x745b19){var _0xa73ed9=moment()['format'](_0x86cb('0x32'));_0x745b19[_0x86cb('0x33')]=0xd;_0x745b19['statedesc']=_0x86cb('0x34');_0x745b19['starttime']=_0xa73ed9;_0x745b19[_0x86cb('0x35')]=_0xa73ed9;_0x745b19[_0x86cb('0x36')]=_0xa73ed9;};exports['logAgent']=function(_0x42013a,_0x2657a3,_0x4fd40d){var _0x36fee1=moment()[_0x86cb('0x12')](_0x86cb('0x32'));_0x42013a['state']=_0x2657a3;_0x42013a[_0x86cb('0x37')]=_0x4fd40d;_0x42013a[_0x86cb('0x35')]=_0x36fee1;_0x42013a[_0x86cb('0x38')]=utils['getSeconds'](_0x42013a['responsetime'],_0x42013a[_0x86cb('0x39')]);};exports[_0x86cb('0x3a')]=function(_0x11cc16,_0x550741,_0x55fb38){_0x11cc16[_0x86cb('0x3b')]=_0x550741;_0x11cc16[_0x86cb('0x3c')]=_0x55fb38;};exports[_0x86cb('0x3d')]=function(_0x1f3d07,_0x29966a,_0x56e941){var _0x1427da=moment()['format'](_0x86cb('0x32'));_0x1f3d07[_0x86cb('0x33')]=_0x29966a;_0x1f3d07['statedesc']=_0x56e941;_0x1f3d07[_0x86cb('0x35')]=_0x1f3d07['responsetime']?_0x1f3d07[_0x86cb('0x35')]:_0x1427da;_0x1f3d07['endtime']=_0x1f3d07['endtime']?_0x1f3d07[_0x86cb('0x36')]:_0x1427da;_0x1f3d07[_0x86cb('0x38')]=utils[_0x86cb('0x3e')](_0x1f3d07[_0x86cb('0x35')]||0x0,_0x1f3d07['starttime']||0x0);_0x1f3d07[_0x86cb('0x3f')]=_0x1f3d07[_0x86cb('0x40')]?utils['getSeconds'](_0x1f3d07[_0x86cb('0x36')],_0x1f3d07[_0x86cb('0x40')]):0x0;};exports['isFailure']=function(_0x39b79f){return _0x39b79f===_0x86cb('0x41');};exports[_0x86cb('0x42')]=function(_0xdee206,_0x283ab5,_0x3993d2,_0x45c1f4,_0x4b606c){var _0xfa5c87=_0x45c1f4?_0x86cb('0x43'):_0xdee206[_0x86cb('0x18')];_0xfa5c87=_0x4b606c?_0x86cb('0x44'):_0xfa5c87;return{'actionid':_0xdee206[_0x86cb('0x45')],'action':_0x86cb('0x46'),'channel':_0xdee206[_0x86cb('0x47')],'callerid':util[_0x86cb('0x12')]('\x22%s\x22\x20<%s>',_0xfa5c87,_0xdee206[_0x86cb('0x19')]),'Exten':_0x86cb('0x48'),'Context':_0x86cb('0x49'),'Priority':'1','variable':_0x3993d2,'timeout':(_0x283ab5[_0x86cb('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0xdee206[_0x86cb('0x45')]};};exports['totalGlobal']=function(_0x4adcc2){return _0x4adcc2['countbusyretry']+_0x4adcc2[_0x86cb('0x4b')]+_0x4adcc2[_0x86cb('0x4c')]+_0x4adcc2[_0x86cb('0x4d')]+_0x4adcc2['countnosuchnumberretry'];};exports[_0x86cb('0x4e')]=function(_0x530920){var _0x5c5f95=_[_0x86cb('0x4f')](_0x530920);_0x5c5f95[_0x86cb('0x33')]=0xf;_0x5c5f95[_0x86cb('0x37')]='Global';return _0x5c5f95;};exports[_0x86cb('0x50')]=function(_0x3d4e30,_0x3b3dbf,_0x648dbb){var _0x1e7642={};_0x1e7642[_0x3b3dbf]=_0x3d4e30[_0x3b3dbf];_0x1e7642[_0x86cb('0x51')]=![];_0x1e7642[_0x86cb('0x52')]=moment()[_0x86cb('0x53')](_0x648dbb,_0x86cb('0x54'))['format'](_0x86cb('0x32'));_0x1e7642[_0x86cb('0x1a')]=_0x3d4e30[_0x86cb('0x1a')];_0x1e7642[_0x86cb('0x55')]=_0x3d4e30['ListId'];_0x1e7642[_0x86cb('0x56')]=_0x3d4e30[_0x86cb('0x56')]||undefined;return _0x1e7642;};exports[_0x86cb('0x57')]=function(_0x28b555,_0x5aab82){if(!_[_0x86cb('0x2d')](_0x28b555)){if(_0x28b555['pTalking']>0x0){_0x28b555[_0x86cb('0x58')]-=0x1;}else{logger[_0x86cb('0xa')](_0x5aab82,_0x86cb('0x59'));}}else{logger[_0x86cb('0xa')](_0x5aab82,_0x86cb('0x5a'));}};exports[_0x86cb('0x5b')]=function(_0x3e7a00){if(_0x3e7a00<=0x0){return!![];}return![];};function buildObj(_0x1a96d7,_0x817f90,_0x28b675){_0x1a96d7['lastevent']=_0x817f90;_0x1a96d7[_0x86cb('0x5c')]=_0x1a96d7['queue'];_0x1a96d7['interface']=_0x1a96d7[_0x86cb('0x47')];_0x1a96d7[_0x86cb('0x5d')]=_0x86cb('0x5e');if(_0x28b675){_0x1a96d7['mandatoryDisposition']=_0x28b675[_0x86cb('0x5f')];}return _0x1a96d7;}exports['buildObj']=buildObj;exports['agentReadyId']=function(_0x24eb49){var _0x314782=[];for(var _0x5cd7ff in _0x24eb49){if(_0x24eb49['hasOwnProperty'](_0x5cd7ff)){if(!_[_0x86cb('0x2d')](_0x24eb49[_0x5cd7ff])&&_0x24eb49[_0x5cd7ff]['state']===_0x86cb('0x60')&&_0x24eb49[_0x5cd7ff][_0x86cb('0x61')]===_0x86cb('0x62')){_0x314782[_0x86cb('0x63')](_0x24eb49[_0x5cd7ff]['id']);}}}return _0x314782;};exports[_0x86cb('0x64')]=function(_0x4cce5d){var _0x3c5c33=moment()['milliseconds'](0x0);var _0x1d5f9f=moment(_0x4cce5d)['milliseconds'](0x0);return _0x3c5c33[_0x86cb('0x65')](_0x1d5f9f,_0x86cb('0x66'));};exports[_0x86cb('0x67')]=function(_0xabbf54){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xabbf54[_0x86cb('0x1a')],'ListId':_0xabbf54[_0x86cb('0x55')],'VoiceQueueId':_0xabbf54['VoiceQueueId']||undefined,'CampaignId':_0xabbf54[_0x86cb('0x68')]||undefined};};exports[_0x86cb('0x69')]=function(_0x3fe616){if(_0x3fe616===_0x86cb('0x45')||_0x3fe616===_0x86cb('0x6a')||_0x3fe616===_0x86cb('0x6b')||_0x3fe616==='type'||_0x3fe616===_0x86cb('0x6c')||_0x3fe616==='dialAnswer'||_0x3fe616==='membername'||_0x3fe616==='channelAgent'||_0x3fe616===_0x86cb('0x18')||_0x3fe616===_0x86cb('0x51')||_0x3fe616==='calleridnum'||_0x3fe616==='scheduledat'||_0x3fe616===_0x86cb('0x6d')||_0x3fe616===_0x86cb('0x4b')||_0x3fe616==='countnoanswerretry'||_0x3fe616===_0x86cb('0x6e')||_0x3fe616===_0x86cb('0x6f')||_0x3fe616===_0x86cb('0x70')||_0x3fe616===_0x86cb('0x71')||_0x3fe616==='recallme'||_0x3fe616===_0x86cb('0x1a')||_0x3fe616==='ListId'||_0x3fe616===_0x86cb('0x3c')||_0x3fe616==='VoiceQueueId'||_0x3fe616===_0x86cb('0x72')||_0x3fe616==='xmd-voicequeueid'||_0x3fe616===_0x86cb('0x73')||_0x3fe616===_0x86cb('0x74')||_0x3fe616===_0x86cb('0x75')||_0x3fe616==='xmd-dialurl'||_0x3fe616===_0x86cb('0x76')||_0x3fe616===_0x86cb('0x77')||_0x3fe616==='xmd-dialid'||_0x3fe616===_0x86cb('0x78')||_0x3fe616==='xmd-contactid'||_0x3fe616===_0x86cb('0x79')||_0x3fe616==='xmd-callerid'||_0x3fe616===_0x86cb('0x7a')||_0x3fe616===_0x86cb('0x7b')||_0x3fe616===_0x86cb('0x7c')||_0x3fe616===_0x86cb('0x7d')||_0x3fe616===_0x86cb('0x7e')||_0x3fe616===_0x86cb('0x7f')||_0x3fe616==='rtpaudioqosloss'||_0x3fe616===_0x86cb('0x80')||_0x3fe616==='rtpaudioqosrtt'||_0x3fe616==='rtpaudioqosrttbridged'||_0x3fe616===_0x86cb('0x7c')||_0x3fe616===_0x86cb('0x7d')||_0x3fe616===_0x86cb('0x7e')||_0x3fe616==='rtpaudioqosjitterbridged'||_0x3fe616===_0x86cb('0x81')||_0x3fe616==='rtpaudioqoslossbridged'||_0x3fe616==='rtpaudioqosrtt'||_0x3fe616==='rtpaudioqosrttbridged'||_0x3fe616==='bridgepeer'||_0x3fe616===_0x86cb('0x82')||_0x3fe616==='state'||_0x3fe616===_0x86cb('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5d5789,_0x1693d2){var _0x2e1c05,_0x161e7a,_0x43e9f4;if(_0x1693d2<=0x0){_0x1693d2=0x1;}_0x2e1c05=new RegExp(_0x86cb('0x83')+_0x1693d2+'}$');_0x161e7a=Math[_0x86cb('0x84')](0xa,_0x1693d2-0x1);_0x43e9f4=Math[_0x86cb('0x84')](0xa,_0x1693d2)-0x1;return util[_0x86cb('0x12')]('%s',_[_0x86cb('0x85')](_0x5d5789,_0x2e1c05,_[_0x86cb('0x86')](_0x161e7a,_0x43e9f4)));};exports[_0x86cb('0x87')]=function(_0x2c220b){var _0x42d3ba=_0x2c220b[_0x86cb('0x88')](/"(.*?)"/);return _0x42d3ba?_0x42d3ba[0x1]:_0x2c220b;};exports[_0x86cb('0x89')]=function(_0x5355f9){var _0x3772a4=_0x5355f9[_0x86cb('0x88')](/<(.*?)>/);return _0x3772a4?_0x3772a4[0x1]:_0x5355f9;};function buildNoAnswerEventPayload(_0x26ee35,_0x130538){var _0x5c01f1=buildObj(_0x26ee35,'noanswer');if(!_['isEmpty'](_0x130538[_0x86cb('0x8a')])){Object[_0x86cb('0x8b')](_0x130538['variables'])[_0x86cb('0x8c')](function(_0x537a48){_0x5c01f1[_0x537a48[_0x86cb('0x8d')]()]=_0x130538[_0x86cb('0x8a')][_0x537a48];});}return _0x5c01f1;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0xd0e0=['minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','queue','voice','mandatoryDisposition','buildObj','agentReadyId','reachable','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','idContact','type','active','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','env','127.0.0.1','../../dialer/utils','loggerCatch','inspect','info','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','isActive','isNil','Queue','\x22%s\x22\x20<%s>','calleridnum','ContactId','dialer','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','answertime','isFailure','variablesAction','RECALL','calleridname','uniqueid','originate','channelAgent','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add'];(function(_0x14525d,_0x747b83){var _0x26b05c=function(_0xf98e52){while(--_0xf98e52){_0x14525d['push'](_0x14525d['shift']());}};_0x26b05c(++_0x747b83);}(_0xd0e0,0x146));var _0x0d0e=function(_0x34fd62,_0x1d39a2){_0x34fd62=_0x34fd62-0x0;var _0x3aa8e1=_0xd0e0[_0x34fd62];return _0x3aa8e1;};'use strict';var util=require(_0x0d0e('0x0'));var _=require(_0x0d0e('0x1'));var moment=require('moment');var logger=require(_0x0d0e('0x2'))('preview');var ipAgi=process[_0x0d0e('0x3')]['XCALLY_IP_AGI']||_0x0d0e('0x4');var utils=require(_0x0d0e('0x5'));exports[_0x0d0e('0x6')]=function(_0x41078b){return function(_0x16c52d){logger['error'](_0x41078b,util[_0x0d0e('0x7')](_0x16c52d,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0xa38ca6,_0x429385){logger[_0x0d0e('0x8')](_0xa38ca6,util[_0x0d0e('0x7')](_0x429385,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x12da5c,_0x4e6b62){logger[_0x0d0e('0x9')](_0x12da5c,util[_0x0d0e('0x7')](_0x4e6b62,{'showHidden':![],'depth':null}));};exports[_0x0d0e('0xa')]=function(_0x19405e){return function(_0x477712){logger[_0x0d0e('0x8')](_0x19405e,util[_0x0d0e('0x7')](_0x477712,{'showHidden':![],'depth':null}));};};exports[_0x0d0e('0xb')]=function(_0x1b2ac7,_0x2d336c,_0x2c409){return{'message':_0x1b2ac7,'unlock':_0x2d336c,'active':_0x2c409};};exports[_0x0d0e('0xc')]=function(_0x3ae3b4,_0x5cba16,_0x52a5dd){if(!_[_0x0d0e('0xd')](_0x52a5dd)&&_0x0d0e('0xe')===typeof _0x52a5dd&&!_[_0x0d0e('0xf')](_0x52a5dd)){if(!_[_0x0d0e('0xd')](_0x5cba16)&&_0x0d0e('0xe')===typeof _0x5cba16&&!_[_0x0d0e('0xf')](_0x5cba16)){return util[_0x0d0e('0x10')]('\x22%s\x22\x20<%s>',_0x5cba16,_0x52a5dd);}return util[_0x0d0e('0x10')]('\x22%s\x22\x20<%s>',_0x52a5dd,_0x52a5dd);}if(!_[_0x0d0e('0xd')](_0x3ae3b4)&&_0x0d0e('0xe')===typeof _0x3ae3b4&&!_[_0x0d0e('0xf')](_0x3ae3b4)){return _0x3ae3b4;}return'\x22\x22\x20<>';};exports[_0x0d0e('0x11')]=function(_0x2731a3){if(_[_0x0d0e('0x12')](_0x2731a3)){return![];}return _0x2731a3;};exports['addVariables']=function(_0x5ead07,_0x5ec9e8,_0x4c6d8c,_0x3fbf9f,_0x59810e,_0x4935ba){var _0x1c2f29={'XMD-QUEUE':_0x5ec9e8[_0x0d0e('0x13')]?_0x5ec9e8[_0x0d0e('0x13')]['name']:'','XMD-CALLERID':_0x3fbf9f,'XMD-CALLERID-PREVIEW':_0x4935ba?util[_0x0d0e('0x10')](_0x0d0e('0x14'),_0x4935ba['calleridname'],_0x4935ba[_0x0d0e('0x15')]):_0x3fbf9f,'XMD-DIALID':_0x59810e,'XMD-CONTACTID':_0x5ec9e8[_0x0d0e('0x16')],'XMD-CDRTYPE':_0x0d0e('0x17'),'CALLERID(all)':_0x3fbf9f,'XMD-VOICEQUEUEID':_0x5ec9e8['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4c6d8c,'XMD-DIALTIMEOUT':_0x5ead07['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x0d0e('0x10')](_0x0d0e('0x18'),_0x5ead07['dialQueueProject2']?'g':'',_['isEmpty'](_0x5ead07[_0x0d0e('0x19')])?'':_0x0d0e('0x1a')),'XMD-DIALURL':_0x5ead07[_0x0d0e('0x1b')]||'','XMD-AGI':_0x5ead07[_0x0d0e('0x1c')]?util[_0x0d0e('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5ead07[_0x0d0e('0x1c')]):_0x0d0e('0x1d'),'XMD-AGIAFTER':_0x5ead07[_0x0d0e('0x1e')]?util[_0x0d0e('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5ead07[_0x0d0e('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4935ba?_0x4935ba[_0x0d0e('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x4935ba?_0x4935ba['originatecalleridname']:'','XMD-DESTINATION':_0x0d0e('0x20'),'SIPADDHEADER':_0x0d0e('0x21')};if(!_[_0x0d0e('0xf')](_0x5ead07[_0x0d0e('0x19')])){_0x1c2f29[util[_0x0d0e('0x10')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x5ead07['monitor_format'];_0x1c2f29[util[_0x0d0e('0x10')]('%s',_0x0d0e('0x22'))]=_0x59810e;}return _0x1c2f29;};exports['toLowerVariables']=function(_0x48af06){var _0x5e006c={};for(var _0x56c1aa in _0x48af06){if(_0x48af06[_0x0d0e('0x23')](_0x56c1aa)){_0x5e006c[util[_0x0d0e('0x10')]('%s',_['toLower'](_0x56c1aa))]=_0x48af06[_0x56c1aa];}}return{'variables':_0x5e006c};};exports[_0x0d0e('0x24')]=function(_0x2864a8,_0x26e8a7){if(!_['isNil'](_0x2864a8)){if(_0x2864a8['hasOwnProperty'](_0x0d0e('0x25'))){if(_0x2864a8['originated']>0x0){_0x2864a8[_0x0d0e('0x25')]-=0x1;}else{logger[_0x0d0e('0x9')](_0x0d0e('0x26'),_0x26e8a7);}}}else{logger[_0x0d0e('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x26e8a7);}};exports[_0x0d0e('0x27')]=function(_0x27a844){var _0x17aef7=moment()[_0x0d0e('0x10')](_0x0d0e('0x28'));_0x27a844[_0x0d0e('0x29')]=0xd;_0x27a844[_0x0d0e('0x2a')]=_0x0d0e('0x2b');_0x27a844[_0x0d0e('0x2c')]=_0x17aef7;_0x27a844[_0x0d0e('0x2d')]=_0x17aef7;_0x27a844[_0x0d0e('0x2e')]=_0x17aef7;};exports['logAgent']=function(_0x1b1a56,_0x3b64e9,_0x1d2f20){var _0x464008=moment()[_0x0d0e('0x10')](_0x0d0e('0x28'));_0x1b1a56[_0x0d0e('0x29')]=_0x3b64e9;_0x1b1a56[_0x0d0e('0x2a')]=_0x1d2f20;_0x1b1a56[_0x0d0e('0x2d')]=_0x464008;_0x1b1a56[_0x0d0e('0x2f')]=utils[_0x0d0e('0x30')](_0x1b1a56[_0x0d0e('0x2d')],_0x1b1a56[_0x0d0e('0x2c')]);};exports[_0x0d0e('0x31')]=function(_0x3065b1,_0x39b26,_0x148e11){_0x3065b1[_0x0d0e('0x32')]=_0x39b26;_0x3065b1[_0x0d0e('0x33')]=_0x148e11;};exports[_0x0d0e('0x34')]=function(_0x51e16a,_0x4a495d,_0x393406){var _0x3af450=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x51e16a[_0x0d0e('0x29')]=_0x4a495d;_0x51e16a[_0x0d0e('0x2a')]=_0x393406;_0x51e16a[_0x0d0e('0x2d')]=_0x51e16a['responsetime']?_0x51e16a[_0x0d0e('0x2d')]:_0x3af450;_0x51e16a[_0x0d0e('0x2e')]=_0x51e16a[_0x0d0e('0x2e')]?_0x51e16a['endtime']:_0x3af450;_0x51e16a[_0x0d0e('0x2f')]=utils[_0x0d0e('0x30')](_0x51e16a[_0x0d0e('0x2d')]||0x0,_0x51e16a[_0x0d0e('0x2c')]||0x0);_0x51e16a['talktime']=_0x51e16a[_0x0d0e('0x35')]?utils[_0x0d0e('0x30')](_0x51e16a[_0x0d0e('0x2e')],_0x51e16a[_0x0d0e('0x35')]):0x0;};exports[_0x0d0e('0x36')]=function(_0x32de02){return _0x32de02==='Failure';};exports[_0x0d0e('0x37')]=function(_0x4df72f,_0x50fc6a,_0x4f793a,_0x57d9a2,_0x5d4262){var _0x15bd6c=_0x57d9a2?_0x0d0e('0x38'):_0x4df72f[_0x0d0e('0x39')];_0x15bd6c=_0x5d4262?'BOOKED':_0x15bd6c;return{'actionid':_0x4df72f[_0x0d0e('0x3a')],'action':_0x0d0e('0x3b'),'channel':_0x4df72f[_0x0d0e('0x3c')],'callerid':util[_0x0d0e('0x10')]('\x22%s\x22\x20<%s>',_0x15bd6c,_0x4df72f[_0x0d0e('0x15')]),'Exten':_0x0d0e('0x20'),'Context':'from-sip','Priority':'1','variable':_0x4f793a,'timeout':(_0x50fc6a[_0x0d0e('0x3d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4df72f[_0x0d0e('0x3a')]};};exports['totalGlobal']=function(_0x141d0a){return _0x141d0a[_0x0d0e('0x3e')]+_0x141d0a[_0x0d0e('0x3f')]+_0x141d0a[_0x0d0e('0x40')]+_0x141d0a[_0x0d0e('0x41')]+_0x141d0a[_0x0d0e('0x42')];};exports[_0x0d0e('0x43')]=function(_0x40162e){var _0x45cb67=_[_0x0d0e('0x44')](_0x40162e);_0x45cb67[_0x0d0e('0x29')]=0xf;_0x45cb67[_0x0d0e('0x2a')]=_0x0d0e('0x45');return _0x45cb67;};exports[_0x0d0e('0x46')]=function(_0xbd2bc3,_0x44f19e,_0x1750cc){var _0x3a4ef8={};_0x3a4ef8[_0x44f19e]=_0xbd2bc3[_0x44f19e];_0x3a4ef8['active']=![];_0x3a4ef8[_0x0d0e('0x47')]=moment()[_0x0d0e('0x48')](_0x1750cc,_0x0d0e('0x49'))[_0x0d0e('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a4ef8[_0x0d0e('0x16')]=_0xbd2bc3[_0x0d0e('0x16')];_0x3a4ef8[_0x0d0e('0x4a')]=_0xbd2bc3[_0x0d0e('0x4a')];_0x3a4ef8[_0x0d0e('0x4b')]=_0xbd2bc3['VoiceQueueId']||undefined;return _0x3a4ef8;};exports[_0x0d0e('0x4c')]=function(_0x5dcae1,_0x37d23b){if(!_['isNil'](_0x5dcae1)){if(_0x5dcae1['pTalking']>0x0){_0x5dcae1[_0x0d0e('0x4d')]-=0x1;}else{logger[_0x0d0e('0x9')](_0x37d23b,_0x0d0e('0x4e'));}}else{logger['error'](_0x37d23b,_0x0d0e('0x4f'));}};exports['IsNotLoggedIn']=function(_0x15d13f){if(_0x15d13f<=0x0){return!![];}return![];};function buildObj(_0x273d09,_0x3f145f,_0x4e3430){_0x273d09[_0x0d0e('0x50')]=_0x3f145f;_0x273d09[_0x0d0e('0x51')]=_0x273d09[_0x0d0e('0x52')];_0x273d09['interface']=_0x273d09[_0x0d0e('0x3c')];_0x273d09['motionChannel']=_0x0d0e('0x53');if(_0x4e3430){_0x273d09[_0x0d0e('0x54')]=_0x4e3430[_0x0d0e('0x54')];}return _0x273d09;}exports[_0x0d0e('0x55')]=buildObj;exports[_0x0d0e('0x56')]=function(_0x3bac85){var _0x5a71f0=[];for(var _0x15f092 in _0x3bac85){if(_0x3bac85[_0x0d0e('0x23')](_0x15f092)){if(!_['isNil'](_0x3bac85[_0x15f092])&&_0x3bac85[_0x15f092]['state']==='not_inuse'&&_0x3bac85[_0x15f092]['status']===_0x0d0e('0x57')){_0x5a71f0[_0x0d0e('0x58')](_0x3bac85[_0x15f092]['id']);}}}return _0x5a71f0;};exports[_0x0d0e('0x59')]=function(_0x44b1eb){var _0x1aa12b=moment()[_0x0d0e('0x5a')](0x0);var _0x5df5c0=moment(_0x44b1eb)['milliseconds'](0x0);return _0x1aa12b[_0x0d0e('0x5b')](_0x5df5c0,_0x0d0e('0x5c'));};exports['createBody']=function(_0x2e4f17){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2e4f17[_0x0d0e('0x16')],'ListId':_0x2e4f17[_0x0d0e('0x4a')],'VoiceQueueId':_0x2e4f17[_0x0d0e('0x4b')]||undefined,'CampaignId':_0x2e4f17[_0x0d0e('0x5d')]||undefined};};exports[_0x0d0e('0x5e')]=function(_0x338f40){if(_0x338f40===_0x0d0e('0x3a')||_0x338f40===_0x0d0e('0x5f')||_0x338f40===_0x0d0e('0x52')||_0x338f40===_0x0d0e('0x60')||_0x338f40==='campaigntype'||_0x338f40==='dialAnswer'||_0x338f40==='membername'||_0x338f40===_0x0d0e('0x3c')||_0x338f40===_0x0d0e('0x39')||_0x338f40===_0x0d0e('0x61')||_0x338f40==='calleridnum'||_0x338f40===_0x0d0e('0x47')||_0x338f40===_0x0d0e('0x3e')||_0x338f40===_0x0d0e('0x3f')||_0x338f40===_0x0d0e('0x40')||_0x338f40==='countglobal'||_0x338f40==='callback'||_0x338f40===_0x0d0e('0x62')||_0x338f40==='callbackat'||_0x338f40===_0x0d0e('0x63')||_0x338f40===_0x0d0e('0x16')||_0x338f40==='ListId'||_0x338f40==='UserId'||_0x338f40===_0x0d0e('0x4b')||_0x338f40===_0x0d0e('0x64')||_0x338f40===_0x0d0e('0x65')||_0x338f40===_0x0d0e('0x66')||_0x338f40==='xmd-phone'||_0x338f40===_0x0d0e('0x67')||_0x338f40===_0x0d0e('0x68')||_0x338f40==='xmd-dialtimeout'||_0x338f40===_0x0d0e('0x69')||_0x338f40==='xmd-dialid'||_0x338f40==='xmd-dialchannel'||_0x338f40===_0x0d0e('0x6a')||_0x338f40===_0x0d0e('0x6b')||_0x338f40===_0x0d0e('0x6c')||_0x338f40===_0x0d0e('0x6d')||_0x338f40==='xmd-agi'||_0x338f40===_0x0d0e('0x6e')||_0x338f40===_0x0d0e('0x6f')||_0x338f40===_0x0d0e('0x70')||_0x338f40==='rtpaudioqosjitterbridged'||_0x338f40===_0x0d0e('0x71')||_0x338f40===_0x0d0e('0x72')||_0x338f40===_0x0d0e('0x73')||_0x338f40===_0x0d0e('0x74')||_0x338f40===_0x0d0e('0x6e')||_0x338f40==='rtpaudioqosbridged'||_0x338f40==='rtpaudioqosjitter'||_0x338f40===_0x0d0e('0x75')||_0x338f40===_0x0d0e('0x71')||_0x338f40===_0x0d0e('0x72')||_0x338f40===_0x0d0e('0x73')||_0x338f40==='rtpaudioqosrttbridged'||_0x338f40===_0x0d0e('0x76')||_0x338f40===_0x0d0e('0x77')||_0x338f40===_0x0d0e('0x29')||_0x338f40===_0x0d0e('0x2a')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3bfee8,_0x1ea333){var _0x2077e1,_0x51f165,_0x1bd5ff;if(_0x1ea333<=0x0){_0x1ea333=0x1;}_0x2077e1=new RegExp(_0x0d0e('0x78')+_0x1ea333+'}$');_0x51f165=Math[_0x0d0e('0x79')](0xa,_0x1ea333-0x1);_0x1bd5ff=Math[_0x0d0e('0x79')](0xa,_0x1ea333)-0x1;return util[_0x0d0e('0x10')]('%s',_[_0x0d0e('0x7a')](_0x3bfee8,_0x2077e1,_[_0x0d0e('0x7b')](_0x51f165,_0x1bd5ff)));};exports[_0x0d0e('0x7c')]=function(_0x513b31){var _0x1ddb48=_0x513b31[_0x0d0e('0x7d')](/"(.*?)"/);return _0x1ddb48?_0x1ddb48[0x1]:_0x513b31;};exports[_0x0d0e('0x7e')]=function(_0x36c3f2){var _0x5b599a=_0x36c3f2[_0x0d0e('0x7d')](/<(.*?)>/);return _0x5b599a?_0x5b599a[0x1]:_0x36c3f2;};function buildNoAnswerEventPayload(_0x160430,_0x344f48){var _0xf45e0b=buildObj(_0x160430,_0x0d0e('0x7f'));if(!_['isEmpty'](_0x344f48['variables'])){Object[_0x0d0e('0x80')](_0x344f48[_0x0d0e('0x81')])[_0x0d0e('0x82')](function(_0x429070){_0xf45e0b[_0x429070[_0x0d0e('0x83')]()]=_0x344f48['variables'][_0x429070];});}return _0xf45e0b;}exports[_0x0d0e('0x84')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 7b1979f..4b4b112 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 _0x0236=['number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string'];(function(_0x58277a,_0x3509d0){var _0xca9bc3=function(_0x1a2698){while(--_0x1a2698){_0x58277a['push'](_0x58277a['shift']());}};_0xca9bc3(++_0x3509d0);}(_0x0236,0x9f));var _0x6023=function(_0x13e11a,_0xe0fc7){_0x13e11a=_0x13e11a-0x0;var _0xd7f115=_0x0236[_0x13e11a];return _0xd7f115;};'use strict';exports['queueadd']={'queue':{'type':_0x6023('0x0'),'required':!![]},'interface':{'type':_0x6023('0x0'),'required':!![]},'membername':{'type':_0x6023('0x0'),'required':!![]},'penalty':{'type':_0x6023('0x1'),'required':![]},'paused':{'type':_0x6023('0x2'),'required':![]}};exports[_0x6023('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x6023('0x0'),'required':!![]}};exports[_0x6023('0x4')]={'interface':{'type':_0x6023('0x0'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0x6023('0x5')]={'module':{'type':_0x6023('0x0'),'required':![]}};exports[_0x6023('0x6')]={'uniqueid':{'type':_0x6023('0x0'),'required':!![]}};exports[_0x6023('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x6023('0x0')},'format':{'type':_0x6023('0x0')},'mixmonitorid':{'type':_0x6023('0x0')}};exports[_0x6023('0x8')]={'uniqueid':{'type':_0x6023('0x0'),'required':!![]}};exports[_0x6023('0x9')]={'uniqueid':{'type':_0x6023('0x0'),'required':!![]},'exten':{'type':_0x6023('0x0'),'required':!![]},'context':{'type':_0x6023('0x0')}}; \ No newline at end of file +var _0xf086=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean'];(function(_0x1a57e6,_0x11685a){var _0x1c059b=function(_0x27475e){while(--_0x27475e){_0x1a57e6['push'](_0x1a57e6['shift']());}};_0x1c059b(++_0x11685a);}(_0xf086,0x165));var _0x6f08=function(_0x3cc309,_0x1731a2){_0x3cc309=_0x3cc309-0x0;var _0x330321=_0xf086[_0x3cc309];return _0x330321;};'use strict';exports['queueadd']={'queue':{'type':_0x6f08('0x0'),'required':!![]},'interface':{'type':_0x6f08('0x0'),'required':!![]},'membername':{'type':_0x6f08('0x0'),'required':!![]},'penalty':{'type':_0x6f08('0x1'),'required':![]},'paused':{'type':_0x6f08('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x6f08('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x6f08('0x2')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x6f08('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x6f08('0x0'),'required':!![]}};exports[_0x6f08('0x3')]={'uniqueid':{'type':_0x6f08('0x0'),'required':!![]},'filename':{'type':_0x6f08('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x6f08('0x4')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x6f08('0x5')]={'uniqueid':{'type':_0x6f08('0x0'),'required':!![]},'exten':{'type':_0x6f08('0x0'),'required':!![]},'context':{'type':_0x6f08('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6f830a6..2ee0438 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 _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0x0b0e[_0x13137e];return _0x346261;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x4e31f6,_0x439119){var _0x5e57fc=function(_0x47593a){while(--_0x47593a){_0x4e31f6['push'](_0x4e31f6['shift']());}};_0x5e57fc(++_0x439119);}(_0xb10b,0x12a));var _0xbb10=function(_0x380158,_0x599bd1){_0x380158=_0x380158-0x0;var _0x39ac68=_0xb10b[_0x380158];return _0x39ac68;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 106a5a7..027abac 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 _0x096c=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x2968d0,_0x286634){var _0x3b86df=function(_0x2bb442){while(--_0x2bb442){_0x2968d0['push'](_0x2968d0['shift']());}};_0x3b86df(++_0x286634);}(_0x096c,0x1a0));var _0xc096=function(_0x586479,_0x5736fa){_0x586479=_0x586479-0x0;var _0x2f3973=_0x096c[_0x586479];return _0x2f3973;};'use strict';function mergeDBDataToRealtime(_0x2b4a45,_0x1f2095){var _0x3021d0=Object[_0xc096('0x0')]({},_0x2b4a45);for(var _0x52faba in _0x1f2095){if(_0x3021d0[_0xc096('0x1')](_0x52faba)){_0x3021d0[_0x52faba]=_0x1f2095[_0x52faba];}}return _0x3021d0;}exports[_0xc096('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x96df=['hasOwnProperty','assign'];(function(_0x3e28be,_0x70d30f){var _0xcba72d=function(_0x3d2b8b){while(--_0x3d2b8b){_0x3e28be['push'](_0x3e28be['shift']());}};_0xcba72d(++_0x70d30f);}(_0x96df,0x1d5));var _0xf96d=function(_0x42fe9c,_0x8ea8df){_0x42fe9c=_0x42fe9c-0x0;var _0xe8737f=_0x96df[_0x42fe9c];return _0xe8737f;};'use strict';function mergeDBDataToRealtime(_0x40f0,_0x33119c){var _0x3703c3=Object[_0xf96d('0x0')]({},_0x40f0);for(var _0x5f1825 in _0x33119c){if(_0x3703c3[_0xf96d('0x1')](_0x5f1825)){_0x3703c3[_0x5f1825]=_0x33119c[_0x5f1825];}}return _0x3703c3;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 1907770..b86bad0 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 _0x034c=['length','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','create','match','keys','getCallType','channel','split','getAgentByInternal','calleridnum','outbound','internal','destination','type','lastapplication','queue','lastdata','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','membername','monitor','monitors','filename','createdAt','exten','connectedlinename','xcally-motion-dialer','isArray','forEach','voiceDialReport','indexOf','mobile','phone','substring','transfererlinkedid','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','voiceQueueReport'];(function(_0x63179d,_0x41f5b1){var _0x7746be=function(_0x526a28){while(--_0x526a28){_0x63179d['push'](_0x63179d['shift']());}};_0x7746be(++_0x41f5b1);}(_0x034c,0xf2));var _0xc034=function(_0x36ebb3,_0x3a7e09){_0x36ebb3=_0x36ebb3-0x0;var _0x2a2e29=_0x034c[_0x36ebb3];return _0x2a2e29;};'use strict';var _=require('lodash');var moment=require(_0xc034('0x0'));var util=require(_0xc034('0x1'));var config=require(_0xc034('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xc034('0x3'));var RpcVoiceCallReport=require(_0xc034('0x4'));var RpcVoiceDialReport=require(_0xc034('0x5'));var RpcMemberReport=require(_0xc034('0x6'));var RpcVoiceQueueReport=require(_0xc034('0x7'));var RpcVoiceRecording=require(_0xc034('0x8'));var RpcVoiceTransferReport=require(_0xc034('0x9'));var VoiceQueueReport=require(_0xc034('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xc034('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xc034('0xc'));function Report(_0x2c6f37){this[_0xc034('0xd')]=_0x2c6f37;this[_0xc034('0xe')]=_0x2c6f37['agents'];this[_0xc034('0xf')]=_0x2c6f37['telephones'];}Report[_0xc034('0x10')][_0xc034('0x11')]=function(_0x374ff0){var _0x2271e3=new VoiceQueueReport(this[_0xc034('0xd')]);var _0x3e8012=new VoiceAgentReport(this[_0xc034('0xd')]);var _0x32eec3=new VoiceDialReport(this['realtime']);var _0x41a610=new VoiceCallReport(this['realtime']);var _0x5f3cac=new UserReport(this[_0xc034('0xd')]);if(config[_0xc034('0x12')]&&config['xdr']['disabled']){ami['on'](_0xc034('0x13'),this['voiceQueueReport'][_0xc034('0x14')](this));ami['on'](_0xc034('0x15'),this[_0xc034('0x16')][_0xc034('0x14')](this));ami['on'](_0xc034('0x17'),this[_0xc034('0x18')][_0xc034('0x14')](this));ami['on'](_0xc034('0x19'),this['voiceDialReport'][_0xc034('0x14')](this));ami['on'](_0xc034('0x1a'),this['blindTransfer'][_0xc034('0x14')](this));ami['on'](_0xc034('0x1b'),this[_0xc034('0x1c')]['bind'](this));}};Report[_0xc034('0x10')][_0xc034('0x1d')]=function(_0xb45240){var _0x1b533c;_0x1b533c=_[_0xc034('0x1e')](this['agents'],function(_0x5afece){return _0x5afece[_0xc034('0x1f')]==_0xb45240||_0x5afece[_0xc034('0x20')]==_0xb45240;});if(_[_0xc034('0x21')](_0x1b533c)){var _0x5897ba=_['find'](this[_0xc034('0xf')],function(_0xa92741){return _0xa92741[_0xc034('0x1f')]==_0xb45240||_0xa92741[_0xc034('0x20')]==_0xb45240;});if(_0x5897ba){_0x1b533c=_[_0xc034('0x1e')](this['agents'],function(_0x56b04a){return _0x56b04a[_0xc034('0x22')]==util['format'](_0xc034('0x23'),_0x5897ba[_0xc034('0x20')]);});}}return _0x1b533c;};Report[_0xc034('0x10')][_0xc034('0x24')]=function(_0x244dfb){for(var _0x534cb8=0x0;_0x534cb8<_0x244dfb[_0xc034('0x25')];_0x534cb8+=0x1){var _0x1e7a56=this[_0xc034('0x1d')](_0x244dfb[_0x534cb8]['connectedlinenum']);if(_0x1e7a56){_0x244dfb[_0x534cb8]['accountcode']=_0x1e7a56[_0xc034('0x1f')];_0x244dfb[_0x534cb8][_0xc034('0x26')]=!![];_0x244dfb[_0x534cb8][_0xc034('0x27')]=_0x1e7a56[_0xc034('0x20')];_0x244dfb[_0x534cb8][_0xc034('0x22')]=_[_0xc034('0x21')](_0x1e7a56[_0xc034('0x22')])?util[_0xc034('0x28')](_0xc034('0x23'),_0x1e7a56[_0xc034('0x20')]):_0x1e7a56[_0xc034('0x22')];if(_0x244dfb[_0x534cb8][_0xc034('0x29')]){_0x244dfb[_0x534cb8][_0xc034('0x2a')]=moment()[_0xc034('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x244dfb[_0x534cb8]['queuecallerexit']){_0x244dfb[_0x534cb8][_0xc034('0x2b')]=moment()[_0xc034('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xc034('0x24')](_0x244dfb[_0x534cb8]);}RpcVoiceQueueReport[_0xc034('0x2c')](_0x244dfb[_0x534cb8]);}};function extractCalleridNumber(_0x21c196){var _0x2f1ea9=_0x21c196[_0xc034('0x2d')](/<(.*?)>/);return _0x2f1ea9?_0x2f1ea9[0x1]:_0x21c196;}Report[_0xc034('0x10')]['getAgentByInternal']=function(_0x59bd30){for(var _0x3b4377=0x0;_0x3b4377','calleridname','transfers','linkedid','transfereelinkedid','blindTransfer','type','UserId','membername','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','create','startsWith','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','find','accountcode','name','interface','format','voiceQueueReport','length','findAgent','connectedlinenum','assigned','isNil','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','channel'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x7d2f,0xe9));var _0xf7d2=function(_0x1f711c,_0x358a89){_0x1f711c=_0x1f711c-0x0;var _0x18d183=_0x7d2f[_0x1f711c];return _0x18d183;};'use strict';var _=require(_0xf7d2('0x0'));var moment=require(_0xf7d2('0x1'));var util=require(_0xf7d2('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xf7d2('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xf7d2('0x4'));var RpcMemberReport=require(_0xf7d2('0x5'));var RpcVoiceQueueReport=require(_0xf7d2('0x6'));var RpcVoiceRecording=require(_0xf7d2('0x7'));var RpcVoiceTransferReport=require(_0xf7d2('0x8'));var VoiceQueueReport=require(_0xf7d2('0x9'));var VoiceCallReport=require(_0xf7d2('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xf7d2('0xb'));var UserReport=require(_0xf7d2('0xc'));function Report(_0x3d256e){this[_0xf7d2('0xd')]=_0x3d256e;this['agents']=_0x3d256e[_0xf7d2('0xe')];this[_0xf7d2('0xf')]=_0x3d256e[_0xf7d2('0xf')];}Report[_0xf7d2('0x10')]['sync']=function(_0x3d6475){var _0x29c505=new VoiceQueueReport(this[_0xf7d2('0xd')]);var _0x4ef9e9=new VoiceAgentReport(this[_0xf7d2('0xd')]);var _0x1b25f0=new VoiceDialReport(this['realtime']);var _0x186050=new VoiceCallReport(this[_0xf7d2('0xd')]);var _0x8f9070=new UserReport(this[_0xf7d2('0xd')]);if(config[_0xf7d2('0x11')]&&config[_0xf7d2('0x11')][_0xf7d2('0x12')]){ami['on'](_0xf7d2('0x13'),this['voiceQueueReport'][_0xf7d2('0x14')](this));ami['on'](_0xf7d2('0x15'),this[_0xf7d2('0x16')]['bind'](this));ami['on'](_0xf7d2('0x17'),this[_0xf7d2('0x18')]['bind'](this));ami['on'](_0xf7d2('0x19'),this[_0xf7d2('0x1a')][_0xf7d2('0x14')](this));ami['on'](_0xf7d2('0x1b'),this['blindTransfer']['bind'](this));ami['on'](_0xf7d2('0x1c'),this[_0xf7d2('0x1d')][_0xf7d2('0x14')](this));}};Report[_0xf7d2('0x10')]['findAgent']=function(_0x58d6d7){var _0x48b909;_0x48b909=_[_0xf7d2('0x1e')](this['agents'],function(_0x2025be){return _0x2025be[_0xf7d2('0x1f')]==_0x58d6d7||_0x2025be[_0xf7d2('0x20')]==_0x58d6d7;});if(_['isNil'](_0x48b909)){var _0x4cbe6b=_['find'](this[_0xf7d2('0xf')],function(_0x3db9e1){return _0x3db9e1[_0xf7d2('0x1f')]==_0x58d6d7||_0x3db9e1[_0xf7d2('0x20')]==_0x58d6d7;});if(_0x4cbe6b){_0x48b909=_['find'](this[_0xf7d2('0xe')],function(_0x37dd32){return _0x37dd32[_0xf7d2('0x21')]==util[_0xf7d2('0x22')]('SIP/%s',_0x4cbe6b['name']);});}}return _0x48b909;};Report[_0xf7d2('0x10')][_0xf7d2('0x23')]=function(_0x546065){for(var _0x505159=0x0;_0x505159<_0x546065[_0xf7d2('0x24')];_0x505159+=0x1){var _0x19be2c=this[_0xf7d2('0x25')](_0x546065[_0x505159][_0xf7d2('0x26')]);if(_0x19be2c){_0x546065[_0x505159]['accountcode']=_0x19be2c[_0xf7d2('0x1f')];_0x546065[_0x505159][_0xf7d2('0x27')]=!![];_0x546065[_0x505159]['lastAssignedTo']=_0x19be2c[_0xf7d2('0x20')];_0x546065[_0x505159]['interface']=_[_0xf7d2('0x28')](_0x19be2c[_0xf7d2('0x21')])?util[_0xf7d2('0x22')](_0xf7d2('0x29'),_0x19be2c[_0xf7d2('0x20')]):_0x19be2c[_0xf7d2('0x21')];if(_0x546065[_0x505159][_0xf7d2('0x2a')]){_0x546065[_0x505159][_0xf7d2('0x2b')]=moment()[_0xf7d2('0x22')](_0xf7d2('0x2c'));}if(_0x546065[_0x505159][_0xf7d2('0x2d')]){_0x546065[_0x505159][_0xf7d2('0x2e')]=moment()[_0xf7d2('0x22')](_0xf7d2('0x2c'));}RpcMemberReport[_0xf7d2('0x23')](_0x546065[_0x505159]);}RpcVoiceQueueReport['create'](_0x546065[_0x505159]);}};function extractCalleridNumber(_0x39b3c0){var _0x188d91=_0x39b3c0[_0xf7d2('0x2f')](/<(.*?)>/);return _0x188d91?_0x188d91[0x1]:_0x39b3c0;}Report[_0xf7d2('0x10')][_0xf7d2('0x30')]=function(_0x1baceb){for(var _0x4a531e=0x0;_0x4a531e0x0?!![]:![];if(!_0x5a3bf7){return this[_0x4bb3('0x6e')](this[_0x4bb3('0x17')]['completeEvent']);}};VoiceQueueReport[_0x4bb3('0xc')]['syncQueueMember']=function(_0x362326){var _0x519173=this['summary']['id'];if(this[_0x4bb3('0x17')][_0x4bb3('0x61')][_0x519173]&&this['summary']['queuestatus'][_0x519173][_0x362326['actionid']]){this[_0x4bb3('0x17')][_0x4bb3('0x61')][_0x519173][_0x362326['actionid']][_0x4bb3('0x12')][_0x4bb3('0x6f')](_0x362326);}};VoiceQueueReport[_0x4bb3('0xc')][_0x4bb3('0x19')]=function(_0x113a5e){var _0x498922=this;try{if(this['isNotNull'](_0x113a5e)&&this[_0x4bb3('0x5b')](_0x113a5e[_0x4bb3('0x56')])){logger[_0x4bb3('0x4c')](_0x4bb3('0x70'),util[_0x4bb3('0x45')](_0x113a5e,{'showHidden':![],'depth':null}));var _0x332802=this['voiceQueues'][_0x113a5e[_0x4bb3('0x56')]];if(_0x332802){logger[_0x4bb3('0x4c')](_0x4bb3('0x71'),_0x332802[_0x4bb3('0x5a')]);this[_0x4bb3('0x17')]['queues'][_0x332802['name']]={'summaryEvent':_0x113a5e};this[_0x4bb3('0x17')][_0x4bb3('0x6d')]+=0x1;return ami['Action']({'action':_0x4bb3('0x61'),'queue':_0x332802['name']})[_0x4bb3('0x5f')](function(_0x41d2cd){if(!_0x498922[_0x4bb3('0x17')][_0x4bb3('0x61')][_0x113a5e[_0x4bb3('0x60')]]){_0x498922[_0x4bb3('0x17')][_0x4bb3('0x61')][_0x113a5e[_0x4bb3('0x60')]]={};}_0x498922[_0x4bb3('0x17')][_0x4bb3('0x61')][_0x113a5e['actionid']][_0x41d2cd['actionid']]={'queue':_0x332802[_0x4bb3('0x5a')],'agents':[]};})[_0x4bb3('0x40')](function(_0x1b843a){throw _0x1b843a;});}}}catch(_0x109b26){logger[_0x4bb3('0x42')](_0x4bb3('0x62'),util['inspect'](_0x109b26,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4bb3('0x6e')]=function(_0x339e4c){if(this[_0x4bb3('0x17')][_0x4bb3('0x6d')]>0x0){this[_0x4bb3('0x17')][_0x4bb3('0x72')]=_0x339e4c;return;}logger[_0x4bb3('0x4c')](_0x4bb3('0x73'),util[_0x4bb3('0x45')](_0x339e4c,{'showHidden':![],'depth':null}));this[_0x4bb3('0x17')]=initializeSummary();ami[_0x4bb3('0x4a')](_0x4bb3('0x74'),{});};VoiceQueueReport['prototype'][_0x4bb3('0x21')]=function(_0x1e2253){try{if(this[_0x4bb3('0x5b')](_0x1e2253)){logger[_0x4bb3('0x4c')](_0x4bb3('0x75'),_0x1e2253[_0x4bb3('0x4e')],util[_0x4bb3('0x45')](_0x1e2253,{'showHidden':![],'depth':null}));if(_[_0x4bb3('0x5c')](this[_0x4bb3('0x10')][_0x1e2253['uniqueid']])){this[_0x4bb3('0x10')][_0x1e2253[_0x4bb3('0x4e')]]=[];}if(_[_0x4bb3('0x5c')](this[_0x4bb3('0x13')][_0x1e2253[_0x4bb3('0x4e')]])){this[_0x4bb3('0x13')][_0x1e2253[_0x4bb3('0x4e')]]={};}var _0x16a8da=new QueueReport();_0x16a8da[_0x4bb3('0x56')]=_0x1e2253['queue'];_0x16a8da[_0x4bb3('0x6a')]=this['voiceQueues'][_0x16a8da['queue']]&&this[_0x4bb3('0x15')][_0x16a8da['queue']][_0x4bb3('0x6a')]?this[_0x4bb3('0x15')][_0x16a8da[_0x4bb3('0x56')]][_0x4bb3('0x6a')]||_0x4bb3('0x6b'):_0x4bb3('0x6b');_0x16a8da[_0x4bb3('0x76')]=moment()[_0x4bb3('0x4f')](_0x4bb3('0x77'));_0x16a8da['position']=_0x1e2253[_0x4bb3('0x78')];_0x16a8da['count']=_0x1e2253[_0x4bb3('0x79')];_0x16a8da['uniqueid']=_0x1e2253[_0x4bb3('0x4e')];_0x16a8da[_0x4bb3('0x7a')]=this['channels'][_0x1e2253['uniqueid']][_0x4bb3('0x7a')];logger[_0x4bb3('0x7b')](_0x4bb3('0x7c'),_0x16a8da[_0x4bb3('0x56')],_0x16a8da[_0x4bb3('0x6a')]);Object['assign'](_0x16a8da,_[_0x4bb3('0x7d')](_0x1e2253,_[_0x4bb3('0x7e')](_0x16a8da)));this[_0x4bb3('0x10')][_0x1e2253[_0x4bb3('0x4e')]]['push'](_0x16a8da);this[_0x4bb3('0x13')][_0x1e2253[_0x4bb3('0x4e')]]=_0x16a8da;this[_0x4bb3('0x4b')](_0x16a8da,_0x4bb3('0x20'));}}catch(_0x5cc977){logger[_0x4bb3('0x42')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1e2253[_0x4bb3('0x4e')],util['inspect'](_0x5cc977,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0xf2dae7){try{if(this[_0x4bb3('0x5b')](_0xf2dae7)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0xf2dae7['uniqueid'],util['inspect'](_0xf2dae7,{'showHidden':![],'depth':null}));if(this[_0x4bb3('0x10')][_0xf2dae7[_0x4bb3('0x4e')]]){var _0x5228d3=_[_0x4bb3('0x7f')](this['queueReports'][_0xf2dae7[_0x4bb3('0x4e')]]);_0x5228d3[_0x4bb3('0x80')]=![];_0x5228d3[_0x4bb3('0x81')]=null;_0x5228d3[_0x4bb3('0x82')]=_0xf2dae7['holdtime'];_0x5228d3[_0x4bb3('0x83')]=_0xf2dae7[_0x4bb3('0x83')];_0x5228d3[_0x4bb3('0x22')]=!![];_0x5228d3['queuecallerabandonAt']=moment()[_0x4bb3('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x5228d3[_0x4bb3('0x54')]=_0x4bb3('0x84');_0x5228d3[_0x4bb3('0x85')]=null;logger[_0x4bb3('0x7b')](_0x4bb3('0x86'),_0x5228d3['queue'],_0x5228d3['type']);this[_0x4bb3('0x13')][_0xf2dae7[_0x4bb3('0x4e')]]=_0x5228d3;this[_0x4bb3('0x48')](_0x5228d3,_0x4bb3('0x22'));}}}catch(_0x471e29){logger[_0x4bb3('0x42')](_0x4bb3('0x87'),_0xf2dae7[_0x4bb3('0x4e')],util['inspect'](_0x471e29,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4bb3('0xc')][_0x4bb3('0x23')]=function(_0x1a76d1){try{if(this[_0x4bb3('0x5b')](_0x1a76d1)){logger[_0x4bb3('0x4c')](_0x4bb3('0x88'),_0x1a76d1[_0x4bb3('0x4e')],util[_0x4bb3('0x45')](_0x1a76d1,{'showHidden':![],'depth':null}));if(this[_0x4bb3('0x10')][_0x1a76d1[_0x4bb3('0x4e')]]){var _0x2cb6a2=_[_0x4bb3('0x7f')](this[_0x4bb3('0x10')][_0x1a76d1[_0x4bb3('0x4e')]]);_0x2cb6a2[_0x4bb3('0x89')]=moment()[_0x4bb3('0x4f')](_0x4bb3('0x77'));_0x2cb6a2[_0x4bb3('0x8a')]=_0x1a76d1['connectedlinenum'];_0x2cb6a2['connectedlinename']=_0x1a76d1[_0x4bb3('0x8b')];logger[_0x4bb3('0x7b')](_0x4bb3('0x8c'),_0x2cb6a2['queue'],_0x2cb6a2['type'],_0x1a76d1[_0x4bb3('0x8a')],_0x1a76d1[_0x4bb3('0x8b')]);this['channels'][_0x1a76d1['uniqueid']]=_0x2cb6a2;this['emitVoiceQueueChannelSave'](_0x2cb6a2,'queuecallerleave');}}}catch(_0x5ba3a3){logger['error'](_0x4bb3('0x88'),_0x1a76d1[_0x4bb3('0x4e')],util[_0x4bb3('0x45')](_0x5ba3a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4bb3('0xc')]['syncAgentConnect']=function(_0x2e8fc6){try{if(this[_0x4bb3('0x5b')](_0x2e8fc6)){logger['debug'](_0x4bb3('0x8d'),_0x2e8fc6[_0x4bb3('0x4e')],util[_0x4bb3('0x45')](_0x2e8fc6,{'showHidden':![],'depth':null}));if(this[_0x4bb3('0x10')][_0x2e8fc6['uniqueid']]){var _0x423ac5=_['last'](this[_0x4bb3('0x10')][_0x2e8fc6['uniqueid']]);_0x423ac5[_0x4bb3('0x80')]=!![];_0x423ac5[_0x4bb3('0x54')]=_0x4bb3('0x8e');logger[_0x4bb3('0x7b')](_0x4bb3('0x8f'),_0x423ac5[_0x4bb3('0x56')],_0x423ac5[_0x4bb3('0x6a')]);}}}catch(_0x32f0f6){logger['error'](_0x4bb3('0x8d'),_0x2e8fc6[_0x4bb3('0x4e')],util['inspect'](_0x32f0f6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4bb3('0xc')]['syncAgentComplete']=function(_0x3c27fe){try{if(this[_0x4bb3('0x5b')](_0x3c27fe)){logger[_0x4bb3('0x4c')](_0x4bb3('0x90'),_0x3c27fe[_0x4bb3('0x4e')],util[_0x4bb3('0x45')](_0x3c27fe,{'showHidden':![],'depth':null}));if(this[_0x4bb3('0x10')][_0x3c27fe['uniqueid']]){var _0x2f5cdb=_[_0x4bb3('0x7f')](this[_0x4bb3('0x10')][_0x3c27fe[_0x4bb3('0x4e')]]);_0x2f5cdb[_0x4bb3('0x22')]=![];_0x2f5cdb[_0x4bb3('0x91')]=null;_0x2f5cdb[_0x4bb3('0x92')]=!![];_0x2f5cdb[_0x4bb3('0x85')]=_0x3c27fe[_0x4bb3('0x93')];_0x2f5cdb[_0x4bb3('0x82')]=_0x3c27fe[_0x4bb3('0x82')];_0x2f5cdb['queuecallercomplete']=!![];_0x2f5cdb[_0x4bb3('0x39')]=![];_0x2f5cdb[_0x4bb3('0x94')]=null;if(!_0x2f5cdb['transfer']){if(_0x3c27fe[_0x4bb3('0x95')]=='transfer'){_0x2f5cdb['queuecallerexitreason']='COMPLETED';logger['info'](_0x4bb3('0x96'),_0x2f5cdb[_0x4bb3('0x56')],_0x2f5cdb[_0x4bb3('0x6a')]);}else{if(_['startsWith'](_0x3c27fe[_0x4bb3('0x3f')][_0x4bb3('0x97')](),_0x4bb3('0x98'))){if(this['queueReports'][_0x3c27fe['linkedid']]){var _0x4745a4=_[_0x4bb3('0x7f')](this[_0x4bb3('0x10')][_0x3c27fe[_0x4bb3('0x99')]]);_0x4745a4[_0x4bb3('0x80')]=![];_0x4745a4[_0x4bb3('0x39')]=!![];_0x4745a4['queuecallerexitAt']=moment(_0x2f5cdb['queuecallerjoinAt'])['add'](_0x3c27fe[_0x4bb3('0x82')],'seconds')[_0x4bb3('0x4f')](_0x4bb3('0x77'));_0x4745a4[_0x4bb3('0x54')]=_0x4bb3('0x9a');_0x4745a4[_0x4bb3('0x9b')]=!![];_0x4745a4[_0x4bb3('0x9c')]=_0x4bb3('0x9d');_0x4745a4[_0x4bb3('0x9e')]=_0x3c27fe[_0x4bb3('0x9f')];_0x4745a4['transferuniqueid']=_0x3c27fe[_0x4bb3('0x4e')];logger['info'](_0x4bb3('0xa0'),_0x4745a4[_0x4bb3('0x56')],_0x4745a4['type']);var _0x380620=this[_0x4bb3('0x10')][_0x3c27fe[_0x4bb3('0x99')]];this['queueReports'][_0x3c27fe[_0x4bb3('0x99')]]=this[_0x4bb3('0x10')][_0x3c27fe[_0x4bb3('0x4e')]];this['queueReports'][_0x3c27fe[_0x4bb3('0x4e')]]=_0x380620;}}else{_0x2f5cdb[_0x4bb3('0x54')]=_0x4bb3('0xa1')+_0x3c27fe[_0x4bb3('0x95')][_0x4bb3('0xa2')]();logger[_0x4bb3('0x7b')](_0x4bb3('0xa3'),_0x2f5cdb[_0x4bb3('0x56')],_0x2f5cdb[_0x4bb3('0x6a')],_0x2f5cdb[_0x4bb3('0x54')]);}}}this['channels'][_0x3c27fe[_0x4bb3('0x4e')]]=_0x2f5cdb;}}}catch(_0x4ed7b7){logger[_0x4bb3('0x42')](_0x4bb3('0x90'),_0x3c27fe[_0x4bb3('0x4e')],util['inspect'](_0x4ed7b7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4bb3('0xa4')]=function(_0x24d992){try{if(this[_0x4bb3('0x5b')](_0x24d992)){logger[_0x4bb3('0x4c')](_0x4bb3('0xa5'),_0x24d992[_0x4bb3('0x4e')],util[_0x4bb3('0x45')](_0x24d992,{'showHidden':![],'depth':null}));this['addVariable'](_0x24d992[_0x4bb3('0x4e')],_[_0x4bb3('0x7e')](_0x24d992[_0x4bb3('0xa6')])[0x0],_0x24d992[_0x4bb3('0xa7')]);if(this[_0x4bb3('0x10')][_0x24d992[_0x4bb3('0x4e')]]){var _0x84f400=_[_0x4bb3('0x7f')](this[_0x4bb3('0x10')][_0x24d992['uniqueid']]);if(_0x84f400){if(this[_0x4bb3('0x5b')](_0x24d992['variable'])&&this[_0x4bb3('0x5b')](_0x24d992[_0x4bb3('0xa6')][_0x4bb3('0x61')])){switch(_0x24d992[_0x4bb3('0xa7')]){case'CONTINUE':_0x84f400['queuecallerexit']=![];_0x84f400[_0x4bb3('0x94')]=null;break;case _0x4bb3('0xa8'):_0x84f400[_0x4bb3('0xa9')]=_0x4bb3('0xaa');_0x84f400['queuecallerexit']=!![];_0x84f400['queuecallerexitAt']=moment()[_0x4bb3('0x4f')](_0x4bb3('0x77'));_0x84f400[_0x4bb3('0x89')]=moment()[_0x4bb3('0x4f')](_0x4bb3('0x77'));logger['debug'](_0x4bb3('0xab'),_0x24d992[_0x4bb3('0x4e')],util[_0x4bb3('0x45')](_0x84f400,{'showHidden':![],'depth':null}));ami[_0x4bb3('0x4a')](_0x4bb3('0xac'),_0x84f400);break;default:_0x84f400['queuecallerexit']=!![];_0x84f400[_0x4bb3('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x84f400[_0x4bb3('0x89')]=moment()[_0x4bb3('0x4f')](_0x4bb3('0x77'));}_0x84f400['queuecallerabandon']=![];_0x84f400[_0x4bb3('0x91')]=null;_0x84f400[_0x4bb3('0x54')]=_0x24d992[_0x4bb3('0xa7')];this[_0x4bb3('0x13')][_0x24d992[_0x4bb3('0x4e')]]=_0x84f400;this['emitVoiceQueueChannelRemove'](_0x84f400,_0x4bb3('0x28'));}else if(this[_0x4bb3('0x5b')](_0x24d992['variable'])&&this['isNotNull'](_0x24d992['variable']['queueposition'])){if(!_0x84f400[_0x4bb3('0x22')]){_0x84f400[_0x4bb3('0x39')]=!![];_0x84f400['queuecallerexitAt']=moment()['format'](_0x4bb3('0x77'));_0x84f400['queuecallerexitreason']='EXITWITHKEY';_0x84f400['queuecallerleaveAt']=moment()[_0x4bb3('0x4f')](_0x4bb3('0x77'));this[_0x4bb3('0x13')][_0x24d992[_0x4bb3('0x4e')]]=_0x84f400;}}logger[_0x4bb3('0x7b')](_0x4bb3('0xad'),_0x24d992[_0x4bb3('0x4e')],_0x84f400['queue'],_0x84f400[_0x4bb3('0x6a')],_[_0x4bb3('0x7e')](_0x24d992[_0x4bb3('0xa6')])[0x0],_0x24d992['value']);_0x84f400[_0x4bb3('0xae')]=this[_0x4bb3('0xae')][_0x24d992[_0x4bb3('0x4e')]];}}}}catch(_0x22ce67){logger[_0x4bb3('0x42')](_0x4bb3('0xa5'),_0x24d992[_0x4bb3('0x4e')],util[_0x4bb3('0x45')](_0x22ce67,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4bb3('0xc')]['addVariable']=function(_0x5ba3ec,_0x9b007d,_0x4ef53b){var _0xb2812d=['rtpaudioqos','rtpaudioqosbridged',_0x4bb3('0xaf'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x4bb3('0xb0'),_0x4bb3('0xb1'),_0x4bb3('0xb2'),_0x4bb3('0xb3'),_0x4bb3('0xb4'),_0x4bb3('0xb5'),_0x4bb3('0xb6'),_0x4bb3('0xb7'),_0x4bb3('0xb8'),_0x4bb3('0xb9'),_0x4bb3('0xba'),'membername','memberpenalty',_0x4bb3('0xbb')];if(!_[_0x4bb3('0x3c')](_0x9b007d)&&!_['includes'](_0xb2812d,_0x9b007d)){if(_[_0x4bb3('0x5c')](this[_0x4bb3('0xae')][_0x5ba3ec])){this[_0x4bb3('0xae')][_0x5ba3ec]={};}this[_0x4bb3('0xae')][_0x5ba3ec][_0x9b007d]=_0x4ef53b;}};VoiceQueueReport[_0x4bb3('0xc')][_0x4bb3('0xbc')]=function(_0x45584f,_0x26f8b3,_0x594ef9){try{var _0x1a3baf={};if(this[_0x4bb3('0x10')][_0x45584f]){for(var _0x5134c2=0x0;_0x5134c20x0?!![]:![];if(!_0x422ce4){return this[_0x0c4d('0x1b')](this[_0x0c4d('0x17')][_0x0c4d('0x6f')]);}};VoiceQueueReport[_0x0c4d('0xc')][_0x0c4d('0x70')]=function(_0x5a75ec){var _0x5b3624=this[_0x0c4d('0x17')]['id'];if(this[_0x0c4d('0x17')][_0x0c4d('0x64')][_0x5b3624]&&this['summary'][_0x0c4d('0x64')][_0x5b3624][_0x5a75ec[_0x0c4d('0x62')]]){this[_0x0c4d('0x17')][_0x0c4d('0x64')][_0x5b3624][_0x5a75ec[_0x0c4d('0x62')]][_0x0c4d('0x12')]['push'](_0x5a75ec);}};VoiceQueueReport[_0x0c4d('0xc')][_0x0c4d('0x18')]=function(_0x37d62a){var _0x1130ab=this;try{if(this[_0x0c4d('0x5d')](_0x37d62a)&&this[_0x0c4d('0x5d')](_0x37d62a[_0x0c4d('0x4e')])){logger[_0x0c4d('0x4b')](_0x0c4d('0x71'),util[_0x0c4d('0x41')](_0x37d62a,{'showHidden':![],'depth':null}));var _0x3eabd8=this[_0x0c4d('0x15')][_0x37d62a[_0x0c4d('0x4e')]];if(_0x3eabd8){logger[_0x0c4d('0x4b')](_0x0c4d('0x72'),_0x3eabd8[_0x0c4d('0x66')]);this[_0x0c4d('0x17')]['queues'][_0x3eabd8[_0x0c4d('0x66')]]={'summaryEvent':_0x37d62a};this[_0x0c4d('0x17')][_0x0c4d('0x6e')]+=0x1;return ami['Action']({'action':_0x0c4d('0x64'),'queue':_0x3eabd8[_0x0c4d('0x66')]})[_0x0c4d('0x61')](function(_0x38bef6){if(!_0x1130ab['summary'][_0x0c4d('0x64')][_0x37d62a['actionid']]){_0x1130ab[_0x0c4d('0x17')][_0x0c4d('0x64')][_0x37d62a[_0x0c4d('0x62')]]={};}_0x1130ab['summary'][_0x0c4d('0x64')][_0x37d62a[_0x0c4d('0x62')]][_0x38bef6['actionid']]={'queue':_0x3eabd8[_0x0c4d('0x66')],'agents':[]};})[_0x0c4d('0x3d')](function(_0x17806e){throw _0x17806e;});}}}catch(_0x44dcb0){logger[_0x0c4d('0x3f')]('[voiceQueueReport][queuesummary]',util[_0x0c4d('0x41')](_0x44dcb0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c4d('0xc')]['syncQueueSummaryComplete']=function(_0x73d71c){if(this[_0x0c4d('0x17')][_0x0c4d('0x6e')]>0x0){this[_0x0c4d('0x17')]['completeEvent']=_0x73d71c;return;}logger[_0x0c4d('0x4b')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x0c4d('0x41')](_0x73d71c,{'showHidden':![],'depth':null}));this[_0x0c4d('0x17')]=initializeSummary();ami[_0x0c4d('0x49')](_0x0c4d('0x73'),{});};VoiceQueueReport['prototype'][_0x0c4d('0x20')]=function(_0x4d7216){try{if(this[_0x0c4d('0x5d')](_0x4d7216)){logger[_0x0c4d('0x4b')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4d7216['uniqueid'],util[_0x0c4d('0x41')](_0x4d7216,{'showHidden':![],'depth':null}));if(_[_0x0c4d('0x5e')](this[_0x0c4d('0x10')][_0x4d7216['uniqueid']])){this[_0x0c4d('0x10')][_0x4d7216[_0x0c4d('0x4d')]]=[];}if(_[_0x0c4d('0x5e')](this[_0x0c4d('0x13')][_0x4d7216['uniqueid']])){this['channels'][_0x4d7216[_0x0c4d('0x4d')]]={};}var _0x2e5ad3=new QueueReport();_0x2e5ad3['queue']=_0x4d7216[_0x0c4d('0x4e')];_0x2e5ad3[_0x0c4d('0x59')]=this[_0x0c4d('0x15')][_0x2e5ad3[_0x0c4d('0x4e')]]&&this[_0x0c4d('0x15')][_0x2e5ad3['queue']]['type']?this[_0x0c4d('0x15')][_0x2e5ad3[_0x0c4d('0x4e')]][_0x0c4d('0x59')]||'inbound':_0x0c4d('0x5a');_0x2e5ad3['queuecallerjoinAt']=moment()[_0x0c4d('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e5ad3[_0x0c4d('0x74')]=_0x4d7216[_0x0c4d('0x74')];_0x2e5ad3['count']=_0x4d7216[_0x0c4d('0x75')];_0x2e5ad3['uniqueid']=_0x4d7216['uniqueid'];_0x2e5ad3[_0x0c4d('0x76')]=this[_0x0c4d('0x13')][_0x4d7216['uniqueid']][_0x0c4d('0x76')];logger['info'](_0x0c4d('0x77'),_0x2e5ad3[_0x0c4d('0x4e')],_0x2e5ad3['type']);Object[_0x0c4d('0x6b')](_0x2e5ad3,_[_0x0c4d('0x78')](_0x4d7216,_['keys'](_0x2e5ad3)));this[_0x0c4d('0x10')][_0x4d7216['uniqueid']][_0x0c4d('0x79')](_0x2e5ad3);this[_0x0c4d('0x13')][_0x4d7216[_0x0c4d('0x4d')]]=_0x2e5ad3;this[_0x0c4d('0x4a')](_0x2e5ad3,_0x0c4d('0x1f'));}}catch(_0x1f7389){logger[_0x0c4d('0x3f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4d7216['uniqueid'],util[_0x0c4d('0x41')](_0x1f7389,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0c4d('0x21')]=function(_0x251b8b){try{if(this['isNotNull'](_0x251b8b)){logger[_0x0c4d('0x4b')](_0x0c4d('0x7a'),_0x251b8b[_0x0c4d('0x4d')],util[_0x0c4d('0x41')](_0x251b8b,{'showHidden':![],'depth':null}));if(this[_0x0c4d('0x10')][_0x251b8b[_0x0c4d('0x4d')]]){var _0x48fc31=_['last'](this[_0x0c4d('0x10')][_0x251b8b[_0x0c4d('0x4d')]]);_0x48fc31[_0x0c4d('0x7b')]=![];_0x48fc31[_0x0c4d('0x7c')]=null;_0x48fc31[_0x0c4d('0x7d')]=_0x251b8b[_0x0c4d('0x7d')];_0x48fc31[_0x0c4d('0x7e')]=_0x251b8b[_0x0c4d('0x7e')];_0x48fc31['queuecallerabandon']=!![];_0x48fc31['queuecallerabandonAt']=moment()[_0x0c4d('0x55')](_0x0c4d('0x7f'));_0x48fc31[_0x0c4d('0x53')]='ABANDONED';_0x48fc31['lastAssignedTo']=null;logger[_0x0c4d('0x80')](_0x0c4d('0x81'),_0x48fc31['queue'],_0x48fc31[_0x0c4d('0x59')]);this[_0x0c4d('0x13')][_0x251b8b[_0x0c4d('0x4d')]]=_0x48fc31;this[_0x0c4d('0x51')](_0x48fc31,_0x0c4d('0x39'));}}}catch(_0xba8d82){logger[_0x0c4d('0x3f')](_0x0c4d('0x7a'),_0x251b8b['uniqueid'],util[_0x0c4d('0x41')](_0xba8d82,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c4d('0xc')][_0x0c4d('0x82')]=function(_0x41948f){try{if(this[_0x0c4d('0x5d')](_0x41948f)){logger['debug'](_0x0c4d('0x83'),_0x41948f[_0x0c4d('0x4d')],util[_0x0c4d('0x41')](_0x41948f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x41948f[_0x0c4d('0x4d')]]){var _0x566d59=_[_0x0c4d('0x84')](this['queueReports'][_0x41948f[_0x0c4d('0x4d')]]);_0x566d59[_0x0c4d('0x85')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x566d59['connectedlinenum']=_0x41948f[_0x0c4d('0x86')];_0x566d59[_0x0c4d('0x87')]=_0x41948f['connectedlinename'];logger['info'](_0x0c4d('0x88'),_0x566d59[_0x0c4d('0x4e')],_0x566d59[_0x0c4d('0x59')],_0x41948f[_0x0c4d('0x86')],_0x41948f[_0x0c4d('0x87')]);this[_0x0c4d('0x13')][_0x41948f[_0x0c4d('0x4d')]]=_0x566d59;this[_0x0c4d('0x4a')](_0x566d59,_0x0c4d('0x22'));}}}catch(_0x43da6b){logger['error'](_0x0c4d('0x83'),_0x41948f[_0x0c4d('0x4d')],util[_0x0c4d('0x41')](_0x43da6b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0c4d('0x26')]=function(_0x154220){try{if(this[_0x0c4d('0x5d')](_0x154220)){logger[_0x0c4d('0x4b')](_0x0c4d('0x89'),_0x154220[_0x0c4d('0x4d')],util['inspect'](_0x154220,{'showHidden':![],'depth':null}));if(this[_0x0c4d('0x10')][_0x154220[_0x0c4d('0x4d')]]){var _0x5222a8=_[_0x0c4d('0x84')](this[_0x0c4d('0x10')][_0x154220[_0x0c4d('0x4d')]]);_0x5222a8[_0x0c4d('0x7b')]=!![];_0x5222a8[_0x0c4d('0x53')]=_0x0c4d('0x8a');logger[_0x0c4d('0x80')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x5222a8[_0x0c4d('0x4e')],_0x5222a8[_0x0c4d('0x59')]);}}}catch(_0x480912){logger[_0x0c4d('0x3f')]('[%s][voiceQueueReport][agentconnect]',_0x154220['uniqueid'],util[_0x0c4d('0x41')](_0x480912,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c4d('0xc')][_0x0c4d('0x24')]=function(_0x180258){try{if(this[_0x0c4d('0x5d')](_0x180258)){logger[_0x0c4d('0x4b')](_0x0c4d('0x8b'),_0x180258[_0x0c4d('0x4d')],util[_0x0c4d('0x41')](_0x180258,{'showHidden':![],'depth':null}));if(this[_0x0c4d('0x10')][_0x180258[_0x0c4d('0x4d')]]){var _0x48d449=_['last'](this[_0x0c4d('0x10')][_0x180258[_0x0c4d('0x4d')]]);_0x48d449[_0x0c4d('0x39')]=![];_0x48d449[_0x0c4d('0x8c')]=null;_0x48d449['assigned']=!![];_0x48d449[_0x0c4d('0x8d')]=_0x180258['membername'];_0x48d449['holdtime']=_0x180258[_0x0c4d('0x7d')];_0x48d449['queuecallercomplete']=!![];_0x48d449[_0x0c4d('0x8e')]=![];_0x48d449[_0x0c4d('0x8f')]=null;if(!_0x48d449[_0x0c4d('0x90')]){if(_0x180258[_0x0c4d('0x91')]=='transfer'){_0x48d449['queuecallerexitreason']=_0x0c4d('0x92');logger[_0x0c4d('0x80')](_0x0c4d('0x93'),_0x48d449[_0x0c4d('0x4e')],_0x48d449[_0x0c4d('0x59')]);}else{if(_[_0x0c4d('0x94')](_0x180258[_0x0c4d('0x95')][_0x0c4d('0x96')](),_0x0c4d('0x97'))){if(this[_0x0c4d('0x10')][_0x180258[_0x0c4d('0x98')]]){var _0x1df980=_[_0x0c4d('0x84')](this[_0x0c4d('0x10')][_0x180258[_0x0c4d('0x98')]]);_0x1df980[_0x0c4d('0x7b')]=![];_0x1df980['queuecallerexit']=!![];_0x1df980['queuecallerexitAt']=moment(_0x48d449[_0x0c4d('0x99')])[_0x0c4d('0x9a')](_0x180258[_0x0c4d('0x7d')],'seconds')[_0x0c4d('0x55')](_0x0c4d('0x7f'));_0x1df980['queuecallerexitreason']='FORWARDTRANSFER';_0x1df980['transfer']=!![];_0x1df980['transfertype']='FORWARD';_0x1df980[_0x0c4d('0x9b')]=_0x180258['destexten'];_0x1df980['transferuniqueid']=_0x180258[_0x0c4d('0x4d')];logger['info'](_0x0c4d('0x9c'),_0x1df980[_0x0c4d('0x4e')],_0x1df980['type']);var _0x13e389=this[_0x0c4d('0x10')][_0x180258[_0x0c4d('0x98')]];this['queueReports'][_0x180258[_0x0c4d('0x98')]]=this['queueReports'][_0x180258[_0x0c4d('0x4d')]];this['queueReports'][_0x180258[_0x0c4d('0x4d')]]=_0x13e389;}}else{_0x48d449[_0x0c4d('0x53')]=_0x0c4d('0x9d')+_0x180258['reason']['toUpperCase']();logger['info'](_0x0c4d('0x9e'),_0x48d449[_0x0c4d('0x4e')],_0x48d449[_0x0c4d('0x59')],_0x48d449[_0x0c4d('0x53')]);}}}this['channels'][_0x180258[_0x0c4d('0x4d')]]=_0x48d449;}}}catch(_0x43a1d2){logger['error'](_0x0c4d('0x8b'),_0x180258[_0x0c4d('0x4d')],util['inspect'](_0x43a1d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c4d('0xc')]['syncVarSet']=function(_0x4c1dbe){try{if(this[_0x0c4d('0x5d')](_0x4c1dbe)){logger[_0x0c4d('0x4b')](_0x0c4d('0x9f'),_0x4c1dbe['uniqueid'],util[_0x0c4d('0x41')](_0x4c1dbe,{'showHidden':![],'depth':null}));this[_0x0c4d('0xa0')](_0x4c1dbe[_0x0c4d('0x4d')],_['keys'](_0x4c1dbe['variable'])[0x0],_0x4c1dbe[_0x0c4d('0xa1')]);if(this['queueReports'][_0x4c1dbe[_0x0c4d('0x4d')]]){var _0x54249c=_[_0x0c4d('0x84')](this['queueReports'][_0x4c1dbe['uniqueid']]);if(_0x54249c){if(this[_0x0c4d('0x5d')](_0x4c1dbe[_0x0c4d('0xa2')])&&this['isNotNull'](_0x4c1dbe[_0x0c4d('0xa2')]['queuestatus'])){switch(_0x4c1dbe[_0x0c4d('0xa1')]){case _0x0c4d('0xa3'):_0x54249c['queuecallerexit']=![];_0x54249c[_0x0c4d('0x8f')]=null;break;case _0x0c4d('0xa4'):_0x54249c['lastevent']=_0x0c4d('0xa5');_0x54249c[_0x0c4d('0x8e')]=!![];_0x54249c[_0x0c4d('0x8f')]=moment()['format'](_0x0c4d('0x7f'));_0x54249c[_0x0c4d('0x85')]=moment()['format'](_0x0c4d('0x7f'));logger[_0x0c4d('0x4b')](_0x0c4d('0xa6'),_0x4c1dbe[_0x0c4d('0x4d')],util['inspect'](_0x54249c,{'showHidden':![],'depth':null}));ami['emit'](_0x0c4d('0xa7'),_0x54249c);break;default:_0x54249c[_0x0c4d('0x8e')]=!![];_0x54249c[_0x0c4d('0x8f')]=moment()['format'](_0x0c4d('0x7f'));_0x54249c[_0x0c4d('0x85')]=moment()[_0x0c4d('0x55')](_0x0c4d('0x7f'));}_0x54249c['queuecallerabandon']=![];_0x54249c[_0x0c4d('0x8c')]=null;_0x54249c['queuecallerexitreason']=_0x4c1dbe['value'];this[_0x0c4d('0x13')][_0x4c1dbe[_0x0c4d('0x4d')]]=_0x54249c;this['emitVoiceQueueChannelRemove'](_0x54249c,_0x0c4d('0x27'));}else if(this[_0x0c4d('0x5d')](_0x4c1dbe[_0x0c4d('0xa2')])&&this[_0x0c4d('0x5d')](_0x4c1dbe[_0x0c4d('0xa2')][_0x0c4d('0xa8')])){if(!_0x54249c[_0x0c4d('0x39')]){_0x54249c[_0x0c4d('0x8e')]=!![];_0x54249c['queuecallerexitAt']=moment()[_0x0c4d('0x55')](_0x0c4d('0x7f'));_0x54249c[_0x0c4d('0x53')]='EXITWITHKEY';_0x54249c['queuecallerleaveAt']=moment()['format'](_0x0c4d('0x7f'));this[_0x0c4d('0x13')][_0x4c1dbe[_0x0c4d('0x4d')]]=_0x54249c;}}logger[_0x0c4d('0x80')](_0x0c4d('0xa9'),_0x4c1dbe[_0x0c4d('0x4d')],_0x54249c[_0x0c4d('0x4e')],_0x54249c[_0x0c4d('0x59')],_[_0x0c4d('0xaa')](_0x4c1dbe[_0x0c4d('0xa2')])[0x0],_0x4c1dbe[_0x0c4d('0xa1')]);_0x54249c[_0x0c4d('0x43')]=this[_0x0c4d('0x43')][_0x4c1dbe[_0x0c4d('0x4d')]];}}}}catch(_0x3121ea){logger[_0x0c4d('0x3f')]('[%s][voiceQueueReport][varset]',_0x4c1dbe[_0x0c4d('0x4d')],util[_0x0c4d('0x41')](_0x3121ea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c4d('0xc')][_0x0c4d('0xa0')]=function(_0x4e189d,_0x3ac5df,_0x4750c7){var _0x416db0=['rtpaudioqos',_0x0c4d('0xab'),_0x0c4d('0xac'),'rtpaudioqosjitterbridged',_0x0c4d('0xad'),_0x0c4d('0xae'),_0x0c4d('0xaf'),_0x0c4d('0xb0'),_0x0c4d('0xb1'),_0x0c4d('0xb2'),_0x0c4d('0xb3'),_0x0c4d('0xb4'),_0x0c4d('0xb5'),_0x0c4d('0xb6'),_0x0c4d('0xb7'),_0x0c4d('0xb8'),'membername','memberpenalty',_0x0c4d('0xb9')];if(!_[_0x0c4d('0xba')](_0x3ac5df)&&!_[_0x0c4d('0xbb')](_0x416db0,_0x3ac5df)){if(_['isUndefined'](this[_0x0c4d('0x43')][_0x4e189d])){this[_0x0c4d('0x43')][_0x4e189d]={};}this[_0x0c4d('0x43')][_0x4e189d][_0x3ac5df]=_0x4750c7;}};VoiceQueueReport[_0x0c4d('0xc')][_0x0c4d('0xbc')]=function(_0x101165,_0x540e5f,_0x555e24){try{var _0x16a068={};if(this[_0x0c4d('0x10')][_0x101165]){for(var _0x2a8004=0x0;_0x2a8004=0x0?moment(_0x386b7c[_0x8ab8('0x19')])[_0x8ab8('0x1a')](_0x386b7c[_0x8ab8('0x18')],'seconds'):null,'data1':'outbound','data2':_0x386b7c[_0x8ab8('0x11')],'data3':_0x386b7c['exten'],'data4':_0x386b7c[_0x8ab8('0x1b')]||null,'role':'agent','internal':_0x386b7c[_0x8ab8('0x11')]?_['toNumber'](_0x386b7c[_0x8ab8('0x11')]):undefined,'uniqueid':_0x386b7c[_0x8ab8('0x13')]},'log':_0x8ab8('0x6')});}; \ No newline at end of file +var _0x0229=['util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','accountcode','toNumber','uniqueid','voice','membername','starttime','endtime','outbound','agent','lodash'];(function(_0x500d08,_0x578dda){var _0x17e7fb=function(_0x292cb7){while(--_0x292cb7){_0x500d08['push'](_0x500d08['shift']());}};_0x17e7fb(++_0x578dda);}(_0x0229,0x117));var _0x9022=function(_0x13864c,_0x33a4c6){_0x13864c=_0x13864c-0x0;var _0x381cd9=_0x0229[_0x13864c];return _0x381cd9;};'use strict';var moment=require('moment');var _=require(_0x9022('0x0'));var util=require(_0x9022('0x1'));var client=require('../client');exports[_0x9022('0x2')]=function(_0x38a333){var _0x4248a2=_0x38a333[_0x9022('0x3')]||_0x38a333[_0x9022('0x4')];return client[_0x9022('0x5')](_0x9022('0x6'),{'body':{'channel':'voice','membername':_0x38a333['lastAssignedTo'],'interface':_[_0x9022('0x7')](_0x38a333[_0x9022('0x8')])?util[_0x9022('0x9')](_0x9022('0xa'),_0x38a333['lastAssignedTo']):_0x38a333[_0x9022('0x8')],'type':_0x9022('0xb'),'enterAt':_0x38a333[_0x9022('0xc')],'exitAt':_0x4248a2,'duration':moment(_0x4248a2)[_0x9022('0xd')](_0x38a333[_0x9022('0xc')],_0x9022('0xe')),'data1':_0x9022('0xf'),'data2':_0x38a333[_0x9022('0x10')],'data3':_0x38a333[_0x9022('0x11')],'data4':null,'data5':_0x38a333[_0x9022('0x12')],'role':'agent','internal':_0x38a333[_0x9022('0x13')]?_[_0x9022('0x14')](_0x38a333[_0x9022('0x13')]):undefined,'uniqueid':_0x38a333[_0x9022('0x15')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x8f820c){return client['Request'](_0x9022('0x6'),{'body':{'channel':_0x9022('0x16'),'membername':_0x8f820c[_0x9022('0x17')],'interface':_0x8f820c[_0x9022('0x8')],'type':_0x9022('0xb'),'enterAt':_0x8f820c[_0x9022('0x18')],'exitAt':_0x8f820c[_0x9022('0x19')],'duration':moment(_0x8f820c['endtime'])[_0x9022('0xd')](_0x8f820c[_0x9022('0x18')],_0x9022('0xe'))>=0x0?moment(_0x8f820c[_0x9022('0x19')])['diff'](_0x8f820c['starttime'],_0x9022('0xe')):null,'data1':_0x9022('0x1a'),'data2':_0x8f820c[_0x9022('0x13')],'data3':_0x8f820c[_0x9022('0x11')],'data4':_0x8f820c['dialstring']||null,'role':_0x9022('0x1b'),'internal':_0x8f820c['accountcode']?_['toNumber'](_0x8f820c[_0x9022('0x13')]):undefined,'uniqueid':_0x8f820c[_0x9022('0x15')]},'log':_0x9022('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 6fd8ae6..107b8ca 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 _0x96f9=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x2947d1,_0x5e70b0){var _0x2b36a5=function(_0x37637c){while(--_0x37637c){_0x2947d1['push'](_0x2947d1['shift']());}};_0x2b36a5(++_0x5e70b0);}(_0x96f9,0x64));var _0x996f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x96f9[_0x17d9e3];return _0x14192d;};'use strict';var client=require(_0x996f('0x0'));exports[_0x996f('0x1')]=function(){return client[_0x996f('0x2')](_0x996f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x996f('0x4'),_0x996f('0x5')]},'log':_0x996f('0x6')});}; \ No newline at end of file +var _0x9bb3=['Request','ShowSetting','stopRecordingOnTransfer','../client','getSettings'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x9bb3,0x134));var _0x39bb=function(_0x478543,_0x1be631){_0x478543=_0x478543-0x0;var _0x31ab65=_0x9bb3[_0x478543];return _0x31ab65;};'use strict';var client=require(_0x39bb('0x0'));exports[_0x39bb('0x1')]=function(){return client[_0x39bb('0x2')](_0x39bb('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x39bb('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 ffd43cd..31bd6fb 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 _0x73aa=['GetTemplate','name','Request'];(function(_0x4acb39,_0x3cdf16){var _0x18d1fd=function(_0x4da001){while(--_0x4da001){_0x4acb39['push'](_0x4acb39['shift']());}};_0x18d1fd(++_0x3cdf16);}(_0x73aa,0x1eb));var _0xa73a=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x73aa[_0x42f009];return _0x22a1e0;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x3ad4c0){return function(_0x408f02){return client[_0xa73a('0x0')](_0xa73a('0x1'),{'options':{'raw':!![],'attributes':['id',_0xa73a('0x2'),'html']},'log':_0xa73a('0x1')});};}; \ No newline at end of file +var _0x86e7=['html','../client','getTemplates','Request','GetTemplate'];(function(_0x5db2c3,_0x20f623){var _0x51ca00=function(_0x56eb59){while(--_0x56eb59){_0x5db2c3['push'](_0x5db2c3['shift']());}};_0x51ca00(++_0x20f623);}(_0x86e7,0xf1));var _0x786e=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x86e7[_0x455c6c];return _0x488242;};'use strict';var client=require(_0x786e('0x0'));exports[_0x786e('0x1')]=function(_0x3dd50d){return function(_0x4e7681){return client[_0x786e('0x2')](_0x786e('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x786e('0x4')]},'log':_0x786e('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c07dd3b..e3380c6 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 _0x224e=['channel','Condition','operator','value','AnyConditions','field','Action','Actions','data1','data2','data3','data4','data5','data6','GetTrigger','../client','getTriggers','Request','name'];(function(_0x4b5d8d,_0x61becb){var _0x2c91d4=function(_0x36e7f0){while(--_0x36e7f0){_0x4b5d8d['push'](_0x4b5d8d['shift']());}};_0x2c91d4(++_0x61becb);}(_0x224e,0x1b1));var _0xe224=function(_0x57f7dd,_0x24647b){_0x57f7dd=_0x57f7dd-0x0;var _0x483894=_0x224e[_0x57f7dd];return _0x483894;};'use strict';var client=require(_0xe224('0x0'));exports[_0xe224('0x1')]=function(_0x3b7c16){return function(_0x5d9e27){return client[_0xe224('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xe224('0x3'),_0xe224('0x4'),'status'],'include':[{'model':_0xe224('0x5'),'as':'AllConditions','attributes':['id','field',_0xe224('0x6'),_0xe224('0x7')]},{'model':_0xe224('0x5'),'as':_0xe224('0x8'),'attributes':['id',_0xe224('0x9'),_0xe224('0x6'),_0xe224('0x7')]},{'model':_0xe224('0xa'),'as':_0xe224('0xb'),'attributes':['id','action',_0xe224('0xc'),_0xe224('0xd'),_0xe224('0xe'),_0xe224('0xf'),_0xe224('0x10'),_0xe224('0x11'),'data7']}]},'log':_0xe224('0x12')});};}; \ No newline at end of file +var _0xecd3=['AnyConditions','Action','Actions','data1','data2','data3','data4','data5','data6','data7','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xecd3,0x73));var _0x3ecd=function(_0x51b2ed,_0x54d7c9){_0x51b2ed=_0x51b2ed-0x0;var _0x298f1a=_0xecd3[_0x51b2ed];return _0x298f1a;};'use strict';var client=require('../client');exports[_0x3ecd('0x0')]=function(_0x57b0d2){return function(_0x17660b){return client[_0x3ecd('0x1')](_0x3ecd('0x2'),{'options':{'raw':![],'attributes':['id',_0x3ecd('0x3'),_0x3ecd('0x4'),_0x3ecd('0x5')],'include':[{'model':_0x3ecd('0x6'),'as':_0x3ecd('0x7'),'attributes':['id',_0x3ecd('0x8'),_0x3ecd('0x9'),_0x3ecd('0xa')]},{'model':_0x3ecd('0x6'),'as':_0x3ecd('0xb'),'attributes':['id',_0x3ecd('0x8'),_0x3ecd('0x9'),_0x3ecd('0xa')]},{'model':_0x3ecd('0xc'),'as':_0x3ecd('0xd'),'attributes':['id','action',_0x3ecd('0xe'),_0x3ecd('0xf'),_0x3ecd('0x10'),_0x3ecd('0x11'),_0x3ecd('0x12'),_0x3ecd('0x13'),_0x3ecd('0x14')]}]},'log':_0x3ecd('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 4ca6f63..3d94888 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 _0x9f3c=['getTrunks','Request','GetTrunk','registry','defaultuser','../client'];(function(_0x5e4278,_0x53ed71){var _0x2b35fe=function(_0x172b6f){while(--_0x172b6f){_0x5e4278['push'](_0x5e4278['shift']());}};_0x2b35fe(++_0x53ed71);}(_0x9f3c,0x12b));var _0xc9f3=function(_0x1ec7ba,_0x13ab92){_0x1ec7ba=_0x1ec7ba-0x0;var _0x2dee18=_0x9f3c[_0x1ec7ba];return _0x2dee18;};'use strict';var client=require(_0xc9f3('0x0'));exports[_0xc9f3('0x1')]=function(_0x1a88be){return function(_0x496a87){return client[_0xc9f3('0x2')](_0xc9f3('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xc9f3('0x4'),_0xc9f3('0x5')]},'log':_0xc9f3('0x3')});};}; \ No newline at end of file +var _0xe105=['GetTrunk','name','registry','defaultuser','../client'];(function(_0x6d3f38,_0x1a9713){var _0x3259f2=function(_0x430981){while(--_0x430981){_0x6d3f38['push'](_0x6d3f38['shift']());}};_0x3259f2(++_0x1a9713);}(_0xe105,0xef));var _0x5e10=function(_0x680a2d,_0x319d33){_0x680a2d=_0x680a2d-0x0;var _0x4ad068=_0xe105[_0x680a2d];return _0x4ad068;};'use strict';var client=require(_0x5e10('0x0'));exports['getTrunks']=function(_0x4d5a73){return function(_0x55d186){return client['Request'](_0x5e10('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5e10('0x2'),_0x5e10('0x3'),_0x5e10('0x4')]},'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 a637f41..1f43328 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 _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(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe706,0xa3));var _0x6e70=function(_0x1aab74,_0x38a57b){_0x1aab74=_0x1aab74-0x0;var _0x396af2=_0xe706[_0x1aab74];return _0x396af2;};'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 +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x63336c,_0x2f0481){var _0xe9d97f=function(_0x42d11d){while(--_0x42d11d){_0x63336c['push'](_0x63336c['shift']());}};_0xe9d97f(++_0x2f0481);}(_0xedd9,0xfc));var _0x9edd=function(_0x30e7c4,_0x4cbfe0){_0x30e7c4=_0x30e7c4-0x0;var _0x28b693=_0xedd9[_0x30e7c4];return _0x28b693;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index aa04ac3..2e85b95 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 _0x658f=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0xecdc8,_0x37baa2){var _0x494fab=function(_0x3bf51e){while(--_0x3bf51e){_0xecdc8['push'](_0xecdc8['shift']());}};_0x494fab(++_0x37baa2);}(_0x658f,0x153));var _0xf658=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x658f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf658('0x0'));exports['create']=function(_0x2581fd){return client[_0xf658('0x1')]('CreateVoiceAgentReport',{'body':_0x2581fd,'log':_0xf658('0x2')});};exports['update']=function(_0x5657a2,_0x16a8b0,_0x575279){return client['Request'](_0xf658('0x3'),{'body':_0x5657a2,'options':{'where':{'uniqueid':_0x16a8b0,'interface':_0x575279,'agentcomplete':!![]}},'log':_0xf658('0x3')});}; \ No newline at end of file +var _0xd632=['../client','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xd632,0x1cc));var _0x2d63=function(_0x2ebd68,_0x10e9cc){_0x2ebd68=_0x2ebd68-0x0;var _0x2e68d5=_0xd632[_0x2ebd68];return _0x2e68d5;};'use strict';var client=require(_0x2d63('0x0'));exports['create']=function(_0x54674e){return client['Request'](_0x2d63('0x1'),{'body':_0x54674e,'log':_0x2d63('0x1')});};exports[_0x2d63('0x2')]=function(_0x4bb66f,_0x55e3d4,_0x2972dd){return client['Request'](_0x2d63('0x3'),{'body':_0x4bb66f,'options':{'where':{'uniqueid':_0x55e3d4,'interface':_0x2972dd,'agentcomplete':!![]}},'log':_0x2d63('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 6a6b914..79f1347 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 _0x4958=['billableseconds','GetVoiceCallReports','moment','util','create','Request','CreateVoiceCallReport','merge','context','callerid','getVoiceCallReports','GetVoiceCallReport','day','endOf','type','disposition'];(function(_0x153075,_0xe98537){var _0x594ae9=function(_0xc79fed){while(--_0xc79fed){_0x153075['push'](_0x153075['shift']());}};_0x594ae9(++_0xe98537);}(_0x4958,0x82));var _0x8495=function(_0x5dbff5,_0x5153c9){_0x5dbff5=_0x5dbff5-0x0;var _0xfbd3f5=_0x4958[_0x5dbff5];return _0xfbd3f5;};'use strict';var moment=require(_0x8495('0x0'));var util=require(_0x8495('0x1'));var _=require('lodash');var client=require('../client');exports[_0x8495('0x2')]=function(_0x48a071){return client[_0x8495('0x3')](_0x8495('0x4'),{'body':_[_0x8495('0x5')](_0x48a071,{'source':_0x48a071['calleridnum'],'destinationcontext':_0x48a071[_0x8495('0x6')],'callerid':_0x48a071[_0x8495('0x7')],'amaflags':'DOCUMENTATION'}),'log':_0x8495('0x4')});};exports[_0x8495('0x8')]=function(){return function(){return client['Request'](_0x8495('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x8495('0xa'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x8495('0xb')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x8495('0xc'),_0x8495('0xd'),'duration',_0x8495('0xe')]},'log':_0x8495('0xf')});};}; \ No newline at end of file +var _0xbed8=['Request','CreateVoiceCallReport','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0xbed8,0x160));var _0x8bed=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0xbed8[_0x13594e];return _0x1a4f42;};'use strict';var moment=require(_0x8bed('0x0'));var util=require(_0x8bed('0x1'));var _=require(_0x8bed('0x2'));var client=require(_0x8bed('0x3'));exports[_0x8bed('0x4')]=function(_0x45d585){return client[_0x8bed('0x5')](_0x8bed('0x6'),{'body':_['merge'](_0x45d585,{'source':_0x45d585['calleridnum'],'destinationcontext':_0x45d585[_0x8bed('0x7')],'callerid':_0x45d585[_0x8bed('0x8')],'amaflags':_0x8bed('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0x8bed('0xa')]=function(){return function(){return client['Request'](_0x8bed('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x8bed('0xc')](_0x8bed('0xd'))[_0x8bed('0xe')](_0x8bed('0xf')),moment()[_0x8bed('0x10')](_0x8bed('0xd'))[_0x8bed('0xe')](_0x8bed('0xf'))]}},'attributes':[_0x8bed('0x11'),'disposition',_0x8bed('0x12'),_0x8bed('0x13')]},'log':_0x8bed('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 3b959f9..cef8dd5 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 _0x7017=['CreateVoiceDialReport','create','Request'];(function(_0x20d337,_0x496f31){var _0x3e1243=function(_0x4e3f3b){while(--_0x4e3f3b){_0x20d337['push'](_0x20d337['shift']());}};_0x3e1243(++_0x496f31);}(_0x7017,0xd0));var _0x7701=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x7017[_0x1cc8fe];return _0x230054;};'use strict';var client=require('../client');exports[_0x7701('0x0')]=function(_0x50a4c3){return client[_0x7701('0x1')]('CreateVoiceDialReport',{'body':_0x50a4c3,'log':_0x7701('0x2')});}; \ No newline at end of file +var _0xe615=['../client','create','Request','CreateVoiceDialReport'];(function(_0x2093ca,_0x40ac52){var _0x4c6c74=function(_0x23c740){while(--_0x23c740){_0x2093ca['push'](_0x2093ca['shift']());}};_0x4c6c74(++_0x40ac52);}(_0xe615,0x150));var _0x5e61=function(_0x3446af,_0x3b2f92){_0x3446af=_0x3446af-0x0;var _0x252b14=_0xe615[_0x3446af];return _0x252b14;};'use strict';var client=require(_0x5e61('0x0'));exports[_0x5e61('0x1')]=function(_0x2c88e8){return client[_0x5e61('0x2')](_0x5e61('0x3'),{'body':_0x2c88e8,'log':_0x5e61('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 696bfe1..11786fa 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 _0x74f4=['GetVoiceExtension','exten','../client','getVoiceExtensions'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x74f4,0xaa));var _0x474f=function(_0x35db17,_0x8d64da){_0x35db17=_0x35db17-0x0;var _0x73f088=_0x74f4[_0x35db17];return _0x73f088;};'use strict';var client=require(_0x474f('0x0'));exports[_0x474f('0x1')]=function(){return function(){return client['Request'](_0x474f('0x2'),{'options':{'raw':!![],'attributes':['id',_0x474f('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x474f('0x1')});};}; \ No newline at end of file +var _0xf996=['../client','getVoiceExtensions','Request','exten'];(function(_0x1d006a,_0x2812b5){var _0x20a76b=function(_0x15953f){while(--_0x15953f){_0x1d006a['push'](_0x1d006a['shift']());}};_0x20a76b(++_0x2812b5);}(_0xf996,0x74));var _0x6f99=function(_0x30dae4,_0x571c28){_0x30dae4=_0x30dae4-0x0;var _0x587053=_0xf996[_0x30dae4];return _0x587053;};'use strict';var client=require(_0x6f99('0x0'));exports[_0x6f99('0x1')]=function(){return function(){return client[_0x6f99('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x6f99('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 8315130..7cdaff3 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 _0x2fe7=['dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','getVoiceQueues','Request','name','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialOrderByScheduledAt'];(function(_0x39d92c,_0x5da592){var _0x47065f=function(_0x246a91){while(--_0x246a91){_0x39d92c['push'](_0x39d92c['shift']());}};_0x47065f(++_0x5da592);}(_0x2fe7,0x1cb));var _0x72fe=function(_0x4e7dc4,_0x72f324){_0x4e7dc4=_0x4e7dc4-0x0;var _0x4d81aa=_0x2fe7[_0x4e7dc4];return _0x4d81aa;};'use strict';var client=require('../client');exports[_0x72fe('0x0')]=function(){return function(){return client[_0x72fe('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x72fe('0x2'),'acw',_0x72fe('0x3'),_0x72fe('0x4'),_0x72fe('0x5'),'type',_0x72fe('0x6'),_0x72fe('0x7'),_0x72fe('0x8'),_0x72fe('0x9'),_0x72fe('0xa'),_0x72fe('0xb'),_0x72fe('0xc'),_0x72fe('0xd'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout',_0x72fe('0xe'),_0x72fe('0xf'),'dialQueueProject',_0x72fe('0x10'),_0x72fe('0x11'),_0x72fe('0x12'),_0x72fe('0x13'),_0x72fe('0x14'),_0x72fe('0x15'),'dialGlobalMaxRetry',_0x72fe('0x16'),_0x72fe('0x17'),_0x72fe('0x18'),_0x72fe('0x19'),_0x72fe('0x1a'),_0x72fe('0x1b'),_0x72fe('0x1c'),_0x72fe('0x1d'),_0x72fe('0x1e'),'dialAMDMinWordLength',_0x72fe('0x1f'),_0x72fe('0x20'),_0x72fe('0x21'),'dialAMDMaximumWordLength',_0x72fe('0x22'),'dialRecallMeTimeout',_0x72fe('0x23'),_0x72fe('0x24'),_0x72fe('0x25'),_0x72fe('0x26'),_0x72fe('0x27'),_0x72fe('0x5'),_0x72fe('0x28'),_0x72fe('0x29'),_0x72fe('0x2a'),_0x72fe('0x2b'),_0x72fe('0x2c'),_0x72fe('0x2d'),_0x72fe('0x2e'),_0x72fe('0x2f'),_0x72fe('0x30'),_0x72fe('0x31'),_0x72fe('0x32'),_0x72fe('0x33'),'dialAgentRejectRetryFrequency',_0x72fe('0x34'),_0x72fe('0x35'),_0x72fe('0x36'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x72fe('0x2'),'callerid',_0x72fe('0x37')]},{'model':_0x72fe('0x38'),'as':_0x72fe('0x39'),'attributes':['id',_0x72fe('0x2')]},{'model':'Trunk','as':_0x72fe('0x3a'),'attributes':['id',_0x72fe('0x2'),_0x72fe('0x3b'),_0x72fe('0x37')]},{'model':_0x72fe('0x3c'),'as':_0x72fe('0x3c'),'attributes':['id',_0x72fe('0x2')],'include':[{'model':_0x72fe('0x3c'),'as':_0x72fe('0x3d'),'attributes':['id',_0x72fe('0x2'),'interval']}]}]},'log':_0x72fe('0x0')});};}; \ No newline at end of file +var _0xe126=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency'];(function(_0x45b92e,_0x2aca6c){var _0x1c41d2=function(_0x532f7f){while(--_0x532f7f){_0x45b92e['push'](_0x45b92e['shift']());}};_0x1c41d2(++_0x2aca6c);}(_0xe126,0x13f));var _0x6e12=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xe126[_0x4dc7b9];return _0x3ab114;};'use strict';var client=require(_0x6e12('0x0'));exports[_0x6e12('0x1')]=function(){return function(){return client[_0x6e12('0x2')](_0x6e12('0x3'),{'options':{'raw':![],'attributes':['id',_0x6e12('0x4'),_0x6e12('0x5'),'acwTimeout','autopause',_0x6e12('0x6'),'type',_0x6e12('0x7'),'dialMethod',_0x6e12('0x8'),_0x6e12('0x9'),'dialPowerLevel','dialPredictiveOptimization',_0x6e12('0xa'),_0x6e12('0xb'),_0x6e12('0xc'),_0x6e12('0xd'),'dialOriginateTimeout',_0x6e12('0xe'),'dialQueueTimeout',_0x6e12('0xf'),_0x6e12('0x10'),_0x6e12('0x11'),'dialBusyMaxRetry',_0x6e12('0x12'),_0x6e12('0x13'),'dialNoAnswerRetryFrequency',_0x6e12('0x14'),_0x6e12('0x15'),_0x6e12('0x16'),'dialPrefix',_0x6e12('0x17'),_0x6e12('0x18'),'dialAMDInitialSilence',_0x6e12('0x19'),_0x6e12('0x1a'),_0x6e12('0x1b'),_0x6e12('0x1c'),_0x6e12('0x1d'),'dialAMDMaximumNumberOfWords',_0x6e12('0x1e'),_0x6e12('0x1f'),_0x6e12('0x20'),_0x6e12('0x21'),_0x6e12('0x22'),_0x6e12('0x23'),'dialAgiAfterHangupAgent',_0x6e12('0x24'),_0x6e12('0x25'),_0x6e12('0x6'),_0x6e12('0x26'),_0x6e12('0x27'),_0x6e12('0x28'),'dialNoSuchNumberMaxRetry',_0x6e12('0x29'),_0x6e12('0x2a'),_0x6e12('0x2b'),_0x6e12('0x2c'),_0x6e12('0x2d'),'dialMachineMaxRetry',_0x6e12('0x2e'),_0x6e12('0x2f'),_0x6e12('0x30'),_0x6e12('0x31'),'dialPredictiveIntervalMaxThreshold',_0x6e12('0x32'),_0x6e12('0x33'),_0x6e12('0x34')],'include':[{'model':_0x6e12('0x35'),'as':_0x6e12('0x35'),'attributes':['id','name',_0x6e12('0x36'),_0x6e12('0x37')]},{'model':_0x6e12('0x38'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':'Trunk','as':_0x6e12('0x39'),'attributes':['id',_0x6e12('0x4'),_0x6e12('0x36'),_0x6e12('0x37')]},{'model':_0x6e12('0x3a'),'as':_0x6e12('0x3a'),'attributes':['id',_0x6e12('0x4')],'include':[{'model':_0x6e12('0x3a'),'as':_0x6e12('0x3b'),'attributes':['id',_0x6e12('0x4'),_0x6e12('0x3c')]}]}]},'log':_0x6e12('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f94c66b..f8733a7 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(_0x6541aa,_0x561678){var _0x4f52d0=function(_0x33fc6e){while(--_0x33fc6e){_0x6541aa['push'](_0x6541aa['shift']());}};_0x4f52d0(++_0x561678);}(_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 +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(_0xd2a945,_0x396b4b){var _0x2f4039=function(_0x5d6b7c){while(--_0x5d6b7c){_0xd2a945['push'](_0xd2a945['shift']());}};_0x2f4039(++_0x396b4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 f274347..54e00a2 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 _0xe7a9=['getVoiceQueueRtPauses','Request','../client'];(function(_0x5bca34,_0x34625c){var _0x3f3581=function(_0x38e50e){while(--_0x38e50e){_0x5bca34['push'](_0x5bca34['shift']());}};_0x3f3581(++_0x34625c);}(_0xe7a9,0x1eb));var _0x9e7a=function(_0x2d8670,_0x547868){_0x2d8670=_0x2d8670-0x0;var _0x6609f4=_0xe7a9[_0x2d8670];return _0x6609f4;};'use strict';var client=require(_0x9e7a('0x0'));exports[_0x9e7a('0x1')]=function(_0x4f98ec){return function(){return client[_0x9e7a('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x4f98ec,'paused':!![]},'raw':!![]},'log':_0x9e7a('0x1')});};}; \ No newline at end of file +var _0x16c8=['Request','../client','getVoiceQueueRtPauses'];(function(_0x5caf77,_0x44bd89){var _0xa4056d=function(_0x4d41db){while(--_0x4d41db){_0x5caf77['push'](_0x5caf77['shift']());}};_0xa4056d(++_0x44bd89);}(_0x16c8,0x79));var _0x816c=function(_0x531a04,_0x416549){_0x531a04=_0x531a04-0x0;var _0x210985=_0x16c8[_0x531a04];return _0x210985;};'use strict';var client=require(_0x816c('0x0'));exports[_0x816c('0x1')]=function(_0x19ca82){return function(){return client[_0x816c('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x19ca82,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 7db9418..11c94e7 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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1bb0f0,_0x404032){var _0xa5c62f=function(_0x5e0860){while(--_0x5e0860){_0x1bb0f0['push'](_0x1bb0f0['shift']());}};_0xa5c62f(++_0x404032);}(_0x7a54,0x106));var _0x47a5=function(_0x2fa617,_0x31a970){_0x2fa617=_0x2fa617-0x0;var _0x37b35c=_0x7a54[_0x2fa617];return _0x37b35c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x4a1716,_0x42e402){var _0x45c22e=function(_0x1f9403){while(--_0x1f9403){_0x4a1716['push'](_0x4a1716['shift']());}};_0x45c22e(++_0x42e402);}(_0x7a54,0x106));var _0x47a5=function(_0x14559c,_0x4430b2){_0x14559c=_0x14559c-0x0;var _0x461567=_0x7a54[_0x14559c];return _0x461567;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 34cc243..39bed5d 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 _0x7959=['isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','blindTransfer','Request','CreateVoiceTransferReport','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid'];(function(_0x1b892b,_0x4efe48){var _0xa99e57=function(_0x3f957a){while(--_0x3f957a){_0x1b892b['push'](_0x1b892b['shift']());}};_0xa99e57(++_0x4efe48);}(_0x7959,0xf9));var _0x9795=function(_0x150d49,_0x1ac7ac){_0x150d49=_0x150d49-0x0;var _0x3a0efa=_0x7959[_0x150d49];return _0x3a0efa;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x9795('0x0')]=function(_0x3fb881){return client[_0x9795('0x1')](_0x9795('0x2'),{'body':{'result':_0x3fb881['result'],'transfererchannel':_0x3fb881['transfererchannel'],'transferercalleridnum':_0x3fb881[_0x9795('0x3')],'transferercalleridname':_0x3fb881[_0x9795('0x4')],'transfererconnectedlinenum':_0x3fb881[_0x9795('0x5')],'transfererconnectedlinename':_0x3fb881['transfererconnectedlinename'],'transfereraccountcode':_0x3fb881[_0x9795('0x6')],'transferercontext':_0x3fb881[_0x9795('0x7')],'transfererexten':_0x3fb881[_0x9795('0x8')],'transfererlinkedid':_0x3fb881[_0x9795('0x9')],'transfereechannel':_0x3fb881[_0x9795('0xa')],'transfereecalleridnum':_0x3fb881['transfereecalleridnum'],'transfereecalleridname':_0x3fb881[_0x9795('0xb')],'transfereeconnectedlinenum':_0x3fb881['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x3fb881[_0x9795('0xc')],'transfereeaccountcode':_0x3fb881[_0x9795('0xd')],'transfereecontext':_0x3fb881[_0x9795('0xe')],'transfereeexten':_0x3fb881[_0x9795('0xf')],'transfereelinkedid':_0x3fb881[_0x9795('0x10')],'isexternal':_0x3fb881[_0x9795('0x11')],'context':_0x3fb881[_0x9795('0x12')],'extension':_0x3fb881['extension'],'type':_0x9795('0x13')},'log':_0x9795('0x2')});};exports[_0x9795('0x14')]=function(_0x145638){return client[_0x9795('0x1')](_0x9795('0x2'),{'body':{'result':_0x145638['result'],'transfererchannel':_0x145638[_0x9795('0x15')],'transferercalleridnum':_0x145638[_0x9795('0x16')],'transferercalleridname':_0x145638[_0x9795('0x17')],'transfererconnectedlinenum':_0x145638[_0x9795('0x18')],'transfererconnectedlinename':_0x145638['secondtransfererconnectedlinename'],'transfereraccountcode':_0x145638[_0x9795('0x19')],'transferercontext':_0x145638[_0x9795('0x1a')],'transfererexten':_0x145638['secondtransfererexten'],'transfererlinkedid':_0x145638[_0x9795('0x1b')],'transfereechannel':_0x145638['transfertargetchannel'],'transfereecalleridnum':_0x145638[_0x9795('0x1c')],'transfereecalleridname':_0x145638[_0x9795('0x1d')],'transfereeconnectedlinenum':_0x145638[_0x9795('0x1e')],'transfereeconnectedlinename':_0x145638['transfertargetconnectedlinename'],'transfereeaccountcode':_0x145638[_0x9795('0x1f')],'transfereecontext':_0x145638[_0x9795('0x20')],'transfereeexten':_0x145638[_0x9795('0x21')],'transfereelinkedid':_0x145638[_0x9795('0x22')],'isexternal':_0x145638[_0x9795('0x11')],'context':_0x145638[_0x9795('0x23')],'extension':_0x145638[_0x9795('0x24')],'type':_0x9795('0x25')},'log':_0x9795('0x2')});}; \ No newline at end of file +var _0x818e=['transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','context','extension','blind','attendedTransfer','CreateVoiceTransferReport','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten'];(function(_0x2c01cc,_0x1789aa){var _0x29e517=function(_0x3c102f){while(--_0x3c102f){_0x2c01cc['push'](_0x2c01cc['shift']());}};_0x29e517(++_0x1789aa);}(_0x818e,0x166));var _0xe818=function(_0x4ccdbc,_0x4d3654){_0x4ccdbc=_0x4ccdbc-0x0;var _0x25fc94=_0x818e[_0x4ccdbc];return _0x25fc94;};'use strict';var client=require(_0xe818('0x0'));exports[_0xe818('0x1')]={};exports['blindTransfer']=function(_0x4e328e){return client[_0xe818('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x4e328e['result'],'transfererchannel':_0x4e328e[_0xe818('0x3')],'transferercalleridnum':_0x4e328e[_0xe818('0x4')],'transferercalleridname':_0x4e328e[_0xe818('0x5')],'transfererconnectedlinenum':_0x4e328e[_0xe818('0x6')],'transfererconnectedlinename':_0x4e328e[_0xe818('0x7')],'transfereraccountcode':_0x4e328e[_0xe818('0x8')],'transferercontext':_0x4e328e[_0xe818('0x9')],'transfererexten':_0x4e328e[_0xe818('0xa')],'transfererlinkedid':_0x4e328e[_0xe818('0xb')],'transfereechannel':_0x4e328e[_0xe818('0xc')],'transfereecalleridnum':_0x4e328e[_0xe818('0xd')],'transfereecalleridname':_0x4e328e[_0xe818('0xe')],'transfereeconnectedlinenum':_0x4e328e['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x4e328e[_0xe818('0xf')],'transfereeaccountcode':_0x4e328e[_0xe818('0x10')],'transfereecontext':_0x4e328e[_0xe818('0x11')],'transfereeexten':_0x4e328e['transfereeexten'],'transfereelinkedid':_0x4e328e[_0xe818('0x12')],'isexternal':_0x4e328e['isexternal'],'context':_0x4e328e[_0xe818('0x13')],'extension':_0x4e328e[_0xe818('0x14')],'type':_0xe818('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0xe818('0x16')]=function(_0xef0f3a){return client[_0xe818('0x2')](_0xe818('0x17'),{'body':{'result':_0xef0f3a[_0xe818('0x18')],'transfererchannel':_0xef0f3a['origtransfererchannel'],'transferercalleridnum':_0xef0f3a[_0xe818('0x19')],'transferercalleridname':_0xef0f3a[_0xe818('0x1a')],'transfererconnectedlinenum':_0xef0f3a['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xef0f3a[_0xe818('0x1b')],'transfereraccountcode':_0xef0f3a[_0xe818('0x1c')],'transferercontext':_0xef0f3a[_0xe818('0x1d')],'transfererexten':_0xef0f3a['secondtransfererexten'],'transfererlinkedid':_0xef0f3a[_0xe818('0x1e')],'transfereechannel':_0xef0f3a['transfertargetchannel'],'transfereecalleridnum':_0xef0f3a[_0xe818('0x1f')],'transfereecalleridname':_0xef0f3a[_0xe818('0x20')],'transfereeconnectedlinenum':_0xef0f3a[_0xe818('0x21')],'transfereeconnectedlinename':_0xef0f3a['transfertargetconnectedlinename'],'transfereeaccountcode':_0xef0f3a[_0xe818('0x22')],'transfereecontext':_0xef0f3a[_0xe818('0x23')],'transfereeexten':_0xef0f3a[_0xe818('0x24')],'transfereelinkedid':_0xef0f3a[_0xe818('0x25')],'isexternal':_0xef0f3a['isexternal'],'context':_0xef0f3a[_0xe818('0x26')],'extension':_0xef0f3a[_0xe818('0x27')],'type':_0xe818('0x28')},'log':_0xe818('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 0a32804..f677d88 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 _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(_0x461a5f,_0x4b573d){var _0x5d5d8a=function(_0x15c9c4){while(--_0x15c9c4){_0x461a5f['push'](_0x461a5f['shift']());}};_0x5d5d8a(++_0x4b573d);}(_0xb10b,0x12a));var _0xbb10=function(_0x41094d,_0x4ca21d){_0x41094d=_0x41094d-0x0;var _0x503ee1=_0xb10b[_0x41094d];return _0x503ee1;};'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 +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(_0x4ccc1b,_0x228142){var _0x4233fd=function(_0xc4e5e7){while(--_0xc4e5e7){_0x4ccc1b['push'](_0x4ccc1b['shift']());}};_0x4233fd(++_0x228142);}(_0xb10b,0x12a));var _0xbb10=function(_0x298510,_0x21b06b){_0x298510=_0x298510-0x0;var _0x51f279=_0xb10b[_0x298510];return _0x51f279;};'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 52c037a..8671edb 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 _0x7d90=['info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','','calleridname','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','stringify','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0x7d90,0x1ab));var _0x07d9=function(_0x581771,_0x5bff80){_0x581771=_0x581771-0x0;var _0x1b9f6d=_0x7d90[_0x581771];return _0x1b9f6d;};'use strict';var _=require(_0x07d9('0x0'));var BPromise=require(_0x07d9('0x1'));var Redis=require(_0x07d9('0x2'));var util=require('util');var config=require(_0x07d9('0x3'));var logger=require(_0x07d9('0x4'))(_0x07d9('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0x07d9('0x6')]=_[_0x07d9('0x7')](config[_0x07d9('0x6')],{'host':_0x07d9('0x8'),'port':0x18eb});var io=require(_0x07d9('0x9'))(new Redis(config[_0x07d9('0x6')]));function emit(_0x17bd3b,_0x3f5307,_0x839973,_0x151d03,_0x2ba4e5){logger['info']('[CM][%s][%s]',_0x17bd3b,_0x3f5307['id'],_0x839973,_0x151d03,JSON[_0x07d9('0xa')](_0x2ba4e5));io['to'](_0x839973)[_0x07d9('0xb')](_0x151d03,_0x2ba4e5);}exports[_0x07d9('0xc')]=function(_0x24ffbf,_0x4fd9c0,_0x373447,_0x171a77){var _0x219d9f,_0x49c548;var _0x312c7={};var _0x1c012e;var _0x249d8a=Number(_0x373447[_0x07d9('0xd')]);var _0x4767d=_0x373447[_0x07d9('0xe')]?Boolean(Number(_0x373447[_0x07d9('0xe')])):![];var _0x42c303;var _0x2221b0=![];if(!_['isNil'](_0x373447[_0x07d9('0xf')])){if(_0x373447[_0x07d9('0xf')]=='1')_0x2221b0=!![];}if(!_0x2221b0){if(_0x171a77[_0x07d9('0x10')]){_0x312c7['id']=_0x171a77[_0x07d9('0x10')];}}if(!_0x312c7['id']){_0x312c7[_0x07d9('0x11')]=_0x249d8a;_0x42c303=_0x373447[_0x07d9('0x12')]&&_0x373447['data3']!=='0'?_0x373447[_0x07d9('0x12')]['split'](','):[_0x07d9('0x13')];_0x312c7[_0x07d9('0x14')]=_[_0x07d9('0x15')](_0x42c303,function(_0x4c4e3d){var _0x1e0cc7={};_0x1e0cc7[_0x4c4e3d]=_0x171a77[_0x07d9('0x16')]?_0x171a77['destcalleridnum']:_0x171a77[_0x07d9('0x17')];return _0x1e0cc7;});_0x1c012e=_0x171a77[_0x07d9('0x16')]?_0x171a77['destcalleridnum']:_0x171a77[_0x07d9('0x17')];}var _0x1cdc50=['id',_0x07d9('0x18'),_0x07d9('0x19'),_0x07d9('0x13'),_0x07d9('0x1a'),_0x07d9('0x1b'),'ListId',_0x07d9('0x1c'),_0x07d9('0x1d'),_0x07d9('0x1e')];var _0x51787d=_[_0x07d9('0x1f')](_0x1cdc50,_0x42c303);BPromise[_0x07d9('0x20')]()[_0x07d9('0x21')](cmContactRpc[_0x07d9('0x22')]({'attributes':_0x51787d,'where':_0x312c7,'phone':_0x1c012e}))[_0x07d9('0x21')](function(_0x50ebb6){_0x49c548=_0x50ebb6;if(!_[_0x07d9('0x23')](_0x49c548)){if(_0x49c548[_0x07d9('0x24')]===0x1){_0x219d9f=_0x49c548[0x0];logger[_0x07d9('0x25')](_0x07d9('0x26'),_0x171a77['uniqueid'],_0x4fd9c0['id'],_0x219d9f['id']);}else{logger[_0x07d9('0x25')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x171a77[_0x07d9('0x27')],_0x4fd9c0['id'],_[_0x07d9('0x15')](_0x49c548,'id')[_0x07d9('0x28')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x171a77[_0x07d9('0x27')],_0x4fd9c0['id']);var _0x17b7d1={'ListId':_0x249d8a};var _0x549b44=_0x373447[_0x07d9('0x29')]&&_0x373447['data4']!=='0'?_0x373447[_0x07d9('0x29')]:_0x07d9('0x13');if(_0x4767d){logger[_0x07d9('0x25')](_0x07d9('0x2a'),_0x171a77[_0x07d9('0x27')],_0x4fd9c0['id']);_0x17b7d1[_0x549b44]=_[_0x07d9('0x2b')](_0x171a77[_0x07d9('0x16')])?_0x171a77['calleridnum']:_0x171a77['destcalleridnum'];if(_[_0x07d9('0x2b')](_0x171a77[_0x07d9('0x16')])){_0x17b7d1[_0x07d9('0x18')]=_0x171a77['calleridname']&&_0x171a77['calleridname']!==_0x07d9('0x2c')?_0x171a77[_0x07d9('0x2d')]:'Unknown';}else{_0x17b7d1[_0x07d9('0x18')]=_0x171a77[_0x07d9('0x2e')]&&_0x171a77[_0x07d9('0x2e')]!==''?_0x171a77[_0x07d9('0x2e')]:'Unknown';}return BPromise['resolve']()[_0x07d9('0x21')](cmContactRpc[_0x07d9('0x2f')](_0x17b7d1))[_0x07d9('0x21')](function(_0x123417){_0x219d9f=_0x123417;_0x49c548[_0x07d9('0x30')](_0x123417);if(_0x219d9f){logger['info'](_0x07d9('0x31'),_0x171a77[_0x07d9('0x27')],_0x4fd9c0['id'],_0x219d9f['id']);}return;});}else{logger[_0x07d9('0x25')](_0x07d9('0x32'),_0x171a77[_0x07d9('0x27')],_0x4fd9c0['id']);_0x17b7d1[_0x549b44]=_['isNil'](_0x171a77['routeId'])?_0x171a77['calleridnum']:_0x171a77['destcalleridnum'];if(_[_0x07d9('0x2b')](_0x171a77[_0x07d9('0x16')])){_0x17b7d1['firstName']=_0x171a77[_0x07d9('0x2d')]&&_0x171a77['calleridname']!==''?_0x171a77[_0x07d9('0x2d')]:_0x07d9('0x33');}else{_0x17b7d1['firstName']=_0x171a77[_0x07d9('0x2e')]&&_0x171a77[_0x07d9('0x2e')]!==_0x07d9('0x2c')?_0x171a77[_0x07d9('0x2e')]:'Unknown';}_0x219d9f=_0x17b7d1;_0x49c548[_0x07d9('0x30')](_0x17b7d1);return;}}})[_0x07d9('0x21')](function(){if(_0x24ffbf){emit(_0x171a77['uniqueid'],_0x4fd9c0,util[_0x07d9('0x34')](_0x07d9('0x35'),_0x24ffbf[_0x07d9('0x36')]),util[_0x07d9('0x34')](_0x07d9('0x37'),_0x373447[_0x07d9('0x38')][_0x07d9('0x39')]()),{'evt':_['merge'](_0x171a77,{'autoCreate':_0x4767d}),'contact':_0x219d9f===undefined?{}:_0x219d9f,'contacts':_0x49c548['length']===0x0?undefined:_0x49c548});}});}; \ No newline at end of file +var _0xdab6=['resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','toLowerCase','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','scheduledAt','updatedAt','union','then','getContacts','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname'];(function(_0x44c325,_0x19c625){var _0x55f09e=function(_0x322d1b){while(--_0x322d1b){_0x44c325['push'](_0x44c325['shift']());}};_0x55f09e(++_0x19c625);}(_0xdab6,0x153));var _0x6dab=function(_0x1ee4d6,_0x26a81d){_0x1ee4d6=_0x1ee4d6-0x0;var _0x2cb60e=_0xdab6[_0x1ee4d6];return _0x2cb60e;};'use strict';var _=require(_0x6dab('0x0'));var BPromise=require(_0x6dab('0x1'));var Redis=require(_0x6dab('0x2'));var util=require(_0x6dab('0x3'));var config=require(_0x6dab('0x4'));var logger=require(_0x6dab('0x5'))(_0x6dab('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x6dab('0x7')]=_[_0x6dab('0x8')](config[_0x6dab('0x7')],{'host':_0x6dab('0x9'),'port':0x18eb});var io=require(_0x6dab('0xa'))(new Redis(config[_0x6dab('0x7')]));function emit(_0x649f81,_0x581889,_0xff9d6d,_0x229975,_0x3f365b){logger[_0x6dab('0xb')](_0x6dab('0xc'),_0x649f81,_0x581889['id'],_0xff9d6d,_0x229975,JSON[_0x6dab('0xd')](_0x3f365b));io['to'](_0xff9d6d)[_0x6dab('0xe')](_0x229975,_0x3f365b);}exports[_0x6dab('0xf')]=function(_0x3a8561,_0x29a6bc,_0x1ca490,_0x2f3ce7){var _0x295cb9,_0x5643c9;var _0x18b17d={};var _0x59b853;var _0x9462ea=Number(_0x1ca490[_0x6dab('0x10')]);var _0x51d444=_0x1ca490['data2']?Boolean(Number(_0x1ca490[_0x6dab('0x11')])):![];var _0x580d42;var _0x4373e3=![];if(!_['isNil'](_0x1ca490[_0x6dab('0x12')])){if(_0x1ca490['data5']=='1')_0x4373e3=!![];}if(!_0x4373e3){if(_0x2f3ce7['xmd-contactid']){_0x18b17d['id']=_0x2f3ce7[_0x6dab('0x13')];}}if(!_0x18b17d['id']){_0x18b17d[_0x6dab('0x14')]=_0x9462ea;_0x580d42=_0x1ca490[_0x6dab('0x15')]&&_0x1ca490['data3']!=='0'?_0x1ca490[_0x6dab('0x15')][_0x6dab('0x16')](','):[_0x6dab('0x17')];_0x18b17d[_0x6dab('0x18')]=_[_0x6dab('0x19')](_0x580d42,function(_0x3a7287){var _0x2efb94={};_0x2efb94[_0x3a7287]=_0x2f3ce7[_0x6dab('0x1a')]?_0x2f3ce7[_0x6dab('0x1b')]:_0x2f3ce7[_0x6dab('0x1c')];return _0x2efb94;});_0x59b853=_0x2f3ce7[_0x6dab('0x1a')]?_0x2f3ce7['destcalleridnum']:_0x2f3ce7[_0x6dab('0x1c')];}var _0x36ee1c=['id',_0x6dab('0x1d'),'lastName',_0x6dab('0x17'),_0x6dab('0x1e'),_0x6dab('0x1f'),_0x6dab('0x14'),'createdAt',_0x6dab('0x20'),_0x6dab('0x21')];var _0x5debd7=_[_0x6dab('0x22')](_0x36ee1c,_0x580d42);BPromise['resolve']()[_0x6dab('0x23')](cmContactRpc[_0x6dab('0x24')]({'attributes':_0x5debd7,'where':_0x18b17d,'phone':_0x59b853}))[_0x6dab('0x23')](function(_0x4f774c){_0x5643c9=_0x4f774c;if(!_['isEmpty'](_0x5643c9)){if(_0x5643c9['length']===0x1){_0x295cb9=_0x5643c9[0x0];logger[_0x6dab('0xb')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x2f3ce7[_0x6dab('0x25')],_0x29a6bc['id'],_0x295cb9['id']);}else{logger[_0x6dab('0xb')](_0x6dab('0x26'),_0x2f3ce7[_0x6dab('0x25')],_0x29a6bc['id'],_[_0x6dab('0x19')](_0x5643c9,'id')['join'](','));}return;}else{logger[_0x6dab('0xb')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2f3ce7[_0x6dab('0x25')],_0x29a6bc['id']);var _0x25ec5d={'ListId':_0x9462ea};var _0x2bfac7=_0x1ca490['data4']&&_0x1ca490[_0x6dab('0x27')]!=='0'?_0x1ca490[_0x6dab('0x27')]:_0x6dab('0x17');if(_0x51d444){logger[_0x6dab('0xb')](_0x6dab('0x28'),_0x2f3ce7[_0x6dab('0x25')],_0x29a6bc['id']);_0x25ec5d[_0x2bfac7]=_[_0x6dab('0x29')](_0x2f3ce7[_0x6dab('0x1a')])?_0x2f3ce7[_0x6dab('0x1c')]:_0x2f3ce7['destcalleridnum'];if(_[_0x6dab('0x29')](_0x2f3ce7[_0x6dab('0x1a')])){_0x25ec5d['firstName']=_0x2f3ce7[_0x6dab('0x2a')]&&_0x2f3ce7[_0x6dab('0x2a')]!==_0x6dab('0x2b')?_0x2f3ce7['calleridname']:_0x6dab('0x2c');}else{_0x25ec5d[_0x6dab('0x1d')]=_0x2f3ce7[_0x6dab('0x2d')]&&_0x2f3ce7[_0x6dab('0x2d')]!==''?_0x2f3ce7['destcalleridname']:'Unknown';}return BPromise[_0x6dab('0x2e')]()[_0x6dab('0x23')](cmContactRpc[_0x6dab('0x2f')](_0x25ec5d))[_0x6dab('0x23')](function(_0x442656){_0x295cb9=_0x442656;_0x5643c9[_0x6dab('0x30')](_0x442656);if(_0x295cb9){logger['info'](_0x6dab('0x31'),_0x2f3ce7[_0x6dab('0x25')],_0x29a6bc['id'],_0x295cb9['id']);}return;});}else{logger[_0x6dab('0xb')](_0x6dab('0x32'),_0x2f3ce7[_0x6dab('0x25')],_0x29a6bc['id']);_0x25ec5d[_0x2bfac7]=_[_0x6dab('0x29')](_0x2f3ce7[_0x6dab('0x1a')])?_0x2f3ce7[_0x6dab('0x1c')]:_0x2f3ce7[_0x6dab('0x1b')];if(_[_0x6dab('0x29')](_0x2f3ce7[_0x6dab('0x1a')])){_0x25ec5d[_0x6dab('0x1d')]=_0x2f3ce7[_0x6dab('0x2a')]&&_0x2f3ce7[_0x6dab('0x2a')]!==''?_0x2f3ce7[_0x6dab('0x2a')]:'Unknown';}else{_0x25ec5d[_0x6dab('0x1d')]=_0x2f3ce7[_0x6dab('0x2d')]&&_0x2f3ce7['destcalleridname']!==_0x6dab('0x2b')?_0x2f3ce7['destcalleridname']:_0x6dab('0x2c');}_0x295cb9=_0x25ec5d;_0x5643c9['push'](_0x25ec5d);return;}}})[_0x6dab('0x23')](function(){if(_0x3a8561){emit(_0x2f3ce7[_0x6dab('0x25')],_0x29a6bc,util[_0x6dab('0x33')]('user:%s',_0x3a8561[_0x6dab('0x34')]),util[_0x6dab('0x33')]('trigger:%s',_0x1ca490['action'][_0x6dab('0x35')]()),{'evt':_['merge'](_0x2f3ce7,{'autoCreate':_0x51d444}),'contact':_0x295cb9===undefined?{}:_0x295cb9,'contacts':_0x5643c9[_0x6dab('0x36')]===0x0?undefined:_0x5643c9});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 8be352f..32419d3 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 _0xf290=['integration','accounts','queue','script','search','channel','AllConditions','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','created','equals','util','lodash','url','./cmContact','./script','../../../config/environment','../ami','defaults','redis','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','salesforceAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit','info','clone','undefined','motionChannel','voice','debug','inspect','interface','status','checkTrigger','variables','Actions','length','contactmanager','motionbar','browser','data1','popup','TemplateId','data2','render','html','buildUri','isNil','data3','data4','uriLocation','windowWidth','800','data5','windowHeight','600','data6','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','action','toLowerCase','exec'];(function(_0x3f4585,_0x2e4839){var _0x46a32d=function(_0x4d007f){while(--_0x4d007f){_0x3f4585['push'](_0x3f4585['shift']());}};_0x46a32d(++_0x2e4839);}(_0xf290,0x9e));var _0x0f29=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xf290[_0x279d37];return _0x530173;};'use strict';var util=require(_0x0f29('0x0'));var _=require(_0x0f29('0x1'));var url=require(_0x0f29('0x2'));var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require(_0x0f29('0x3'));var script=require(_0x0f29('0x4'));var config=require(_0x0f29('0x5'));var logger=require('../../../config/logger')('trigger');var ami=require(_0x0f29('0x6'));config['redis']=_[_0x0f29('0x7')](config[_0x0f29('0x8')],{'host':_0x0f29('0x9'),'port':0x18eb});var io=require(_0x0f29('0xa'))(new Redis(config[_0x0f29('0x8')]));var operators={'equals':function(_0x5caccd,_0x338a72){return _0x5caccd==_0x338a72;},'not_equals':function(_0x260089,_0x3806bc){return _0x260089!=_0x3806bc;}};var barAndWebActions=['popup',_0x0f29('0x2'),_0x0f29('0xb')];function Trigger(_0x3539d2){this[_0x0f29('0xc')]=_0x3539d2[_0x0f29('0xc')];this[_0x0f29('0xd')]=_0x3539d2[_0x0f29('0xd')];this[_0x0f29('0xe')]=_0x3539d2[_0x0f29('0xe')];this[_0x0f29('0xf')]=_0x3539d2[_0x0f29('0xf')];this[_0x0f29('0x10')]=_0x3539d2[_0x0f29('0x10')];this[_0x0f29('0x11')]=_0x3539d2[_0x0f29('0x11')];this[_0x0f29('0x12')]=_0x3539d2[_0x0f29('0x12')];this['salesforceAccounts']=_0x3539d2['salesforceAccounts'];this[_0x0f29('0x13')]=_0x3539d2['sugarcrmAccounts'];this[_0x0f29('0x14')]=_0x3539d2[_0x0f29('0x14')];this[_0x0f29('0x15')]=_0x3539d2[_0x0f29('0x15')];this[_0x0f29('0x16')]=_0x3539d2[_0x0f29('0x16')];this['servicenowAccounts']=_0x3539d2[_0x0f29('0x17')];this[_0x0f29('0x18')]=_0x3539d2['dynamics365Accounts'];this[_0x0f29('0x19')]=_0x3539d2[_0x0f29('0x19')];this['accounts']={'zendesk':this[_0x0f29('0x11')],'salesforce':this[_0x0f29('0x1a')],'freshdesk':this[_0x0f29('0x12')],'sugarcrm':this[_0x0f29('0x13')],'zoho':this[_0x0f29('0x14')],'desk':this[_0x0f29('0x15')],'vtiger':this[_0x0f29('0x16')],'dynamics365':this[_0x0f29('0x18')],'freshsales':this[_0x0f29('0x19')],'servicenow':this[_0x0f29('0x17')]};ami['on'](_0x0f29('0x1b'),this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x1e'),this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x1f'),this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x20'),this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x21'),this['syncCustomEvent'][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x22'),this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x23'),this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x24'),this['syncCustomEvent'][_0x0f29('0x1d')](this));ami['on']('custom:agentreject',this[_0x0f29('0x1c')]['bind'](this));ami['on']('custom:amd',this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x25'),this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on']('custom:timeout',this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x26'),this[_0x0f29('0x27')]['bind'](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x28'),this['syncAgentDial']['bind'](this));ami['on'](_0x0f29('0x29'),this['syncCustomEvent'][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x2a'),this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on']('custom:substatus',this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x2b'),this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x2c'),this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x2d'),this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on']('custom:rejectmessage',this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));ami['on'](_0x0f29('0x2e'),this[_0x0f29('0x1c')][_0x0f29('0x1d')](this));}Trigger[_0x0f29('0x2f')][_0x0f29('0x30')]=function(_0x4dc193,_0x2b49d2,_0x46fdb7){logger[_0x0f29('0x31')](_0x4dc193,_0x2b49d2,JSON['stringify'](_0x46fdb7));io['to'](_0x4dc193)[_0x0f29('0x30')](_0x2b49d2,_0x46fdb7);};Trigger[_0x0f29('0x2f')]['syncCustomEvent']=function(_0x4c4769){var _0x46a4a9=_[_0x0f29('0x32')](_0x4c4769);if(typeof _0x46a4a9['motionChannel']===_0x0f29('0x33')){_0x46a4a9[_0x0f29('0x34')]=_0x0f29('0x35');}logger[_0x0f29('0x36')](_0x0f29('0x1c'),util[_0x0f29('0x37')](_0x46a4a9,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x46a4a9);};Trigger[_0x0f29('0x2f')][_0x0f29('0x27')]=function(_0x49ff){if(this[_0x0f29('0xd')][_0x49ff[_0x0f29('0x38')]]){this[_0x0f29('0x1c')](_0x49ff);}};Trigger[_0x0f29('0x2f')]['checkTriggers']=function(_0x2c9ca9){var _0x9da354;for(var _0x14e22e in this[_0x0f29('0xc')]){if(this[_0x0f29('0xc')]['hasOwnProperty'](_0x14e22e)){if(this[_0x0f29('0xc')][_0x14e22e][_0x0f29('0x39')]){_0x9da354=this[_0x0f29('0x3a')](this[_0x0f29('0xc')][_0x14e22e],_0x2c9ca9);if(_0x9da354){_['merge'](_0x2c9ca9,_0x2c9ca9[_0x0f29('0x3b')]);for(var _0x17444e=0x0,_0x64a5ec,_0x42fca0,_0x460688;_0x17444e0x0){_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 _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x5866f3,_0x86e77f){var _0x5489d2=function(_0x2b9159){while(--_0x2b9159){_0x5866f3['push'](_0x5866f3['shift']());}};_0x5489d2(++_0x86e77f);}(_0x7217,0x19e));var _0x7721=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x7217[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ 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 5e862ab..2e5fb39 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 _0xb289=['%2b','value','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','customField','idField','indexOf','ticketType','assign','getString','Subjects','Descriptions','Fields','phonecall','/systemusers(','callDirection','/contacts(','queue','phonecalls','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','ioredis','../../../../config/logger','dynamics365','redis','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','data5','POST','clientId','password','clientSecret','then','access_token','catch','error','toUpperCase','GET','Bearer\x20','4.0','validateEmail','userEmail','length','email','isdisabled','info','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','username','message','toLowerCase','outbound','destcalleridnum','contacts','body','headers','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace'];(function(_0x4326a3,_0x5d713c){var _0x26e30a=function(_0x216943){while(--_0x216943){_0x4326a3['push'](_0x4326a3['shift']());}};_0x26e30a(++_0x5d713c);}(_0xb289,0x101));var _0x9b28=function(_0x1ed6d6,_0x1756cf){_0x1ed6d6=_0x1ed6d6-0x0;var _0x42e416=_0xb289[_0x1ed6d6];return _0x42e416;};'use strict';var _=require(_0x9b28('0x0'));var rp=require(_0x9b28('0x1'));var util=require(_0x9b28('0x2'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x9b28('0x3'));var logger=require(_0x9b28('0x4'))(_0x9b28('0x5'));var config=require('../../../../config/environment');config['redis']=_['defaults'](config[_0x9b28('0x6')],{'host':_0x9b28('0x7'),'port':0x18eb});var io=require(_0x9b28('0x8'))(new Redis(config['redis']));function getAuthToken(_0x562087,_0x4eb1b8,_0x1afc1a){if(_0x562087['modernAuthentication']){_0x562087[_0x9b28('0x9')]=_0x562087[_0x9b28('0xa')][_0x9b28('0xb')];_0x562087[_0x9b28('0xc')]=_0x562087[_0x9b28('0xa')][_0x9b28('0xd')];return Promise['resolve'](_0x562087[_0x9b28('0xa')][_0x9b28('0xe')]);}var _0x3d48b2={'method':_0x9b28('0xf'),'uri':_0x4eb1b8,'form':{'client_id':_0x562087[_0x9b28('0x10')],'resource':_0x562087['remoteUri'],'username':_0x562087['username'],'password':_0x562087[_0x9b28('0x11')],'grant_type':'password','client_secret':_0x562087[_0x9b28('0x12')]},'json':!![]};return rp(_0x3d48b2)[_0x9b28('0x13')](function(_0x5ac25b){return _0x5ac25b[_0x9b28('0x14')];})[_0x9b28('0x15')](function(_0x274f23){logger[_0x9b28('0x16')]('['+[_0x1afc1a[_0x9b28('0x17')]()]+']\x20Wrong\x20credentials!');return _0x274f23['message'];});}function getUser(_0x4476ce,_0x1a4103,_0x4b32e1,_0xd35801,_0x26ba5b,_0x19eb36){return new Promise(function(_0x51f99d,_0x374c13){return getAuthToken(_0x1a4103,_0xd35801,_0x19eb36)['then'](function(_0x19fad8){var _0x598dae={'method':_0x9b28('0x18'),'uri':_0x26ba5b+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x9b28('0x19')+_0x19fad8,'OData-Version':_0x9b28('0x1a')},'json':!![]};return rp(_0x598dae);})[_0x9b28('0x13')](function(_0x21eed1){var _0x1f15e1=_0x21eed1['value'];var _0x380ac2=![];var _0x5640fa=null;if(!_['isNil'](_0x4b32e1)){if(intUtil[_0x9b28('0x1b')](_0x4b32e1['email'])){_0x4476ce[_0x9b28('0x1c')]=_0x4b32e1['email'];for(_0x5640fa=0x0;_0x5640fa<_0x1f15e1[_0x9b28('0x1d')];_0x5640fa++){if(_0x1f15e1[_0x5640fa]['internalemailaddress']===_0x4b32e1[_0x9b28('0x1e')]&&!_0x1f15e1[_0x5640fa][_0x9b28('0x1f')]){_0x380ac2=!![];logger[_0x9b28('0x20')]('['+[_0x19eb36[_0x9b28('0x17')]()]+']\x20Agent\x20found\x20'+_0x1f15e1[_0x5640fa]['systemuserid']+'!');_0x4476ce[_0x9b28('0x21')]=_0x1f15e1[_0x5640fa][_0x9b28('0x22')];}}}}if(!_0x380ac2){logger[_0x9b28('0x20')]('['+[_0x19eb36[_0x9b28('0x17')]()]+_0x9b28('0x23'));_0x4476ce[_0x9b28('0x1c')]=_0x1a4103['username'];for(_0x5640fa=0x0;_0x5640fa<_0x1f15e1[_0x9b28('0x1d')];_0x5640fa++){if(_0x1f15e1[_0x5640fa][_0x9b28('0x24')]===_0x1a4103[_0x9b28('0x25')]){_0x4476ce[_0x9b28('0x21')]=_0x1f15e1[_0x5640fa][_0x9b28('0x22')];}}}_0x51f99d(_0x4476ce);})[_0x9b28('0x15')](function(_0x48dd1d){_0x374c13(_0x48dd1d[_0x9b28('0x26')]);});});}function createEndUser(_0x30afbd,_0x23027b,_0x460a6a,_0x3e6e5e,_0x5d43b8,_0x4fdd2f,_0x18bcbc){return new Promise(function(_0x3e12e5,_0x4bbd57){return getAuthToken(_0x23027b,_0x460a6a,_0x4fdd2f)[_0x9b28('0x13')](function(_0x428566){var _0x4205e3=_0x4fdd2f[_0x9b28('0x27')]()===_0x9b28('0x28')?_0x5d43b8[_0x9b28('0x29')]:_0x5d43b8['calleridnum'];var _0x43ad04={'method':_0x9b28('0xf'),'uri':_0x3e6e5e+_0x9b28('0x2a'),'body':{'fullname':_0x4205e3,'firstname':_0x4205e3,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x30afbd[_0x9b28('0x21')]+')'},'headers':{'Authorization':_0x9b28('0x19')+_0x428566,'OData-Version':_0x9b28('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x43ad04[_0x9b28('0x2b')][_0x18bcbc]=_0x4205e3;return rp(_0x43ad04);})[_0x9b28('0x13')](function(_0x782eab){var _0x1ddbb7=_0x782eab[_0x9b28('0x2c')][_0x9b28('0x2d')];var _0x4741fd=_0x1ddbb7[_0x9b28('0x2e')](_0x1ddbb7[_0x9b28('0x2f')]('(')+0x1,_0x1ddbb7[_0x9b28('0x2f')](')'));_0x30afbd[_0x9b28('0x30')]=_0x4741fd;_0x3e12e5(_0x30afbd);})[_0x9b28('0x15')](function(_0x29c98b){_0x4bbd57(_0x29c98b[_0x9b28('0x26')]);});});}function getEndUser(_0x4d6919,_0x326ec0,_0x1d42ae,_0x5a631a,_0x14a4cc,_0x2ec55f,_0x5bd6db,_0x1c94df){var _0x31f441=_0x2ec55f['toLowerCase']()===_0x9b28('0x28')?_0x14a4cc['destcalleridnum']:_0x14a4cc[_0x9b28('0x31')];return getAuthToken(_0x326ec0,_0x1d42ae,_0x2ec55f)[_0x9b28('0x13')](function(_0x566cca){_0x1c94df=_0x1c94df?_0x1c94df:_0x9b28('0x32');var _0x32b0aa={'method':_0x9b28('0x18'),'uri':_0x5a631a+_0x9b28('0x33')+_0x1c94df+_0x9b28('0x34')+_0x1c94df+_0x9b28('0x35')+_0x31f441[_0x9b28('0x36')]('+',_0x9b28('0x37'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x566cca,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x32b0aa);})[_0x9b28('0x13')](function(_0x630fb){var _0x492f8b=![];if(!_0x630fb)return _0x492f8b;var _0x30f63e=_0x630fb[_0x9b28('0x38')];for(var _0x187e79=0x0;_0x187e79<_0x30f63e[_0x9b28('0x1d')];_0x187e79++){if(_0x30f63e[_0x187e79][_0x1c94df]===_0x31f441){_0x492f8b=!![];_0x4d6919['enduserId']=_0x30f63e[_0x187e79][_0x9b28('0x39')];}}return _0x492f8b;})[_0x9b28('0x13')](function(_0x337cc2){if(_0x337cc2)return _0x4d6919;if(_0x5bd6db==='nothing'){logger['info']('['+[_0x2ec55f[_0x9b28('0x17')]()]+_0x9b28('0x3a'));return _0x4d6919;}return createEndUser(_0x4d6919,_0x326ec0,_0x1d42ae,_0x5a631a,_0x14a4cc,_0x2ec55f,_0x1c94df)['then'](function(_0x36e712){logger[_0x9b28('0x20')]('['+[_0x2ec55f[_0x9b28('0x17')]()]+_0x9b28('0x3b'),_0x36e712[_0x9b28('0x30')]);return _0x36e712;});});}function getCustomFields(_0x404c18,_0x2503df,_0x4d58f7){var _0x2f876d={};if(_0x404c18[_0x9b28('0x1d')]>0x0){_[_0x9b28('0x3c')](_0x404c18,function(_0x5c2696){if(_[_0x9b28('0x3d')]([_0x9b28('0x3e'),'picklist'],_0x5c2696['type'])&&_0x5c2696['nameField']&&!_0x5c2696[_0x9b28('0x3f')]){var _0x930692=_0x5c2696[_0x9b28('0x40')][_0x9b28('0x27')]();var _0x246072=_0x930692['substring'](0x0,_0x930692[_0x9b28('0x41')]('_'));var _0x3ddf83=_0x930692[_0x9b28('0x2e')](_0x930692[_0x9b28('0x41')]('_')+0x1);if(_0x246072===_0x4d58f7){_0x2f876d[_0x3ddf83]=_0x5c2696['content'];}}});}return _0x2f876d;}function getTicket(_0x1f009e,_0x5b0f7f,_0xeeb30f,_0xc8b510,_0x23e1ec,_0x1daa7a,_0x137711){return new Promise(function(_0x730333,_0x418b97){var _0x323783;return getAuthToken(_0x5b0f7f,_0xeeb30f,_0x137711)[_0x9b28('0x13')](function(_0x4ca3a5){if(_0x1daa7a[_0x9b28('0x42')]==='incident'){_0x323783={'method':_0x9b28('0xf'),'uri':_0xc8b510+'incidents','body':Object[_0x9b28('0x43')]({},{'title':intUtil[_0x9b28('0x44')](_0x1daa7a[_0x9b28('0x45')],_0x23e1ec,'\x20'),'description':intUtil[_0x9b28('0x44')](_0x1daa7a[_0x9b28('0x46')],_0x23e1ec,'\x0a'),'customerid_contact@odata.bind':_0x1f009e['enduserId']?'/contacts('+_0x1f009e[_0x9b28('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x1f009e[_0x9b28('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x1daa7a[_0x9b28('0x47')],_0x23e1ec,_0x1daa7a[_0x9b28('0x42')])),'headers':{'Authorization':'Bearer\x20'+_0x4ca3a5,'OData-Version':_0x9b28('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1daa7a['ticketType']===_0x9b28('0x48')){var _0x185ac8=_0x1f009e[_0x9b28('0x30')]?[{'partyid_systemuser@odata.bind':_0x9b28('0x49')+_0x1f009e['userId']+')','participationtypemask':_0x1f009e[_0x9b28('0x4a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x9b28('0x4b')+_0x1f009e[_0x9b28('0x30')]+')','participationtypemask':_0x1f009e['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1f009e[_0x9b28('0x21')]+')','participationtypemask':_0x1f009e[_0x9b28('0x4a')]===_0x9b28('0x4c')?0x2:0x1}];_0x323783={'method':_0x9b28('0xf'),'uri':_0xc8b510+_0x9b28('0x4d'),'body':Object[_0x9b28('0x43')]({},{'subject':intUtil['getString'](_0x1daa7a[_0x9b28('0x45')],_0x23e1ec,'\x20'),'phonenumber':String(_0x23e1ec[_0x9b28('0x31')]),'description':intUtil[_0x9b28('0x44')](_0x1daa7a['Descriptions'],_0x23e1ec,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1f009e[_0x9b28('0x30')]?_0x9b28('0x4b')+_0x1f009e[_0x9b28('0x30')]+')':undefined,'ownerid@odata.bind':_0x9b28('0x49')+_0x1f009e[_0x9b28('0x21')]+')','directioncode':_0x1f009e[_0x9b28('0x4a')]===_0x9b28('0x4c')?![]:!![],'phonecall_activity_parties':_0x185ac8},getCustomFields(_0x1daa7a['Fields'],_0x23e1ec,_0x1daa7a['ticketType'])),'headers':{'Authorization':_0x9b28('0x19')+_0x4ca3a5,'OData-Version':_0x9b28('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x323783);})[_0x9b28('0x13')](function(_0x248da1){var _0x2ef9c2=_0x248da1[_0x9b28('0x2c')][_0x9b28('0x2d')];var _0x435ce8=_0x2ef9c2[_0x9b28('0x2e')](_0x2ef9c2['lastIndexOf']('(')+0x1,_0x2ef9c2[_0x9b28('0x2f')](')'));_0x1f009e['ticketId']=_0x435ce8;_0x730333(_0x1f009e);})['catch'](function(_0x45c68c){_0x418b97(_0x45c68c['message']);});});}function emit(_0x5f2f7d,_0x309b45,_0x4a7ad3,_0x5e01d8){var _0x4ab913={'uri':util[_0x9b28('0x4e')](_0x9b28('0x4f'),_0x5f2f7d,_0x4a7ad3,_0x5e01d8)};io['to'](util[_0x9b28('0x4e')]('user:%s',_0x309b45))[_0x9b28('0x50')]('trigger:browser:url',_0x4ab913);}exports['cs']=function(_0x4ef812,_0x29e13d,_0x48b77c,_0x20a414,_0x5c1c8c,_0x215d3c,_0xfdcf4,_0x5c906f){var _0x7eb8b2={};_0x215d3c[_0x9b28('0x9')]=_0x215d3c[_0x9b28('0x51')]?intUtil[_0x9b28('0x52')](_0x215d3c[_0x9b28('0xa')][_0x9b28('0xb')]):intUtil['stripTrailingSlash'](_0x215d3c[_0x9b28('0x9')]);_0x215d3c[_0x9b28('0x53')]=intUtil[_0x9b28('0x52')](_0x215d3c['serverUrl']);_0x7eb8b2[_0x9b28('0x4a')]=_0x5c906f==='queue'||_0x5c906f===_0x9b28('0x54')?_0x9b28('0x4c'):_0x9b28('0x28');var _0x4e3433=_0x215d3c[_0x9b28('0x51')]?util[_0x9b28('0x4e')](_0x9b28('0x55'),_0x215d3c['CloudProvider'][_0x9b28('0xb')]):util[_0x9b28('0x4e')](_0x9b28('0x55'),_0x215d3c[_0x9b28('0x9')]);var _0x1bde12=util[_0x9b28('0x4e')](_0x9b28('0x56'),_0x215d3c[_0x9b28('0xc')]);var _0x139565=util[_0x9b28('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x215d3c[_0x9b28('0x53')],_0x29e13d[_0x9b28('0x57')],md5(_0x29e13d['uniqueid']));if(_0x5c1c8c&&_0x5c1c8c['monitor_format']){logger['info'](_0x9b28('0x58'),_0x9b28('0x59'));_0x29e13d[_0x9b28('0x5a')]=_0x139565;}else if(_0xfdcf4&&_0xfdcf4['recordingFormat']&&_0xfdcf4[_0x9b28('0x5b')]!==_0x9b28('0x5c')){logger[_0x9b28('0x20')](_0x9b28('0x5d'),_0x9b28('0x59'));_0x29e13d[_0x9b28('0x5a')]=_0x139565;}else{_0x29e13d[_0x9b28('0x5a')]='';}return getUser(_0x7eb8b2,_0x215d3c,_0x20a414,_0x1bde12,_0x4e3433,_0x5c906f)['then'](function(_0xa7098){logger[_0x9b28('0x20')]('['+_0x5c906f[_0x9b28('0x17')]()+_0x9b28('0x5e'),_0xa7098[_0x9b28('0x21')]);logger[_0x9b28('0x20')]('['+_0x5c906f[_0x9b28('0x17')]()+_0x9b28('0x5f'),_0xa7098['userEmail']);return getEndUser(_0xa7098,_0x215d3c,_0x1bde12,_0x4e3433,_0x29e13d,_0x5c906f,_0x48b77c[_0x9b28('0x60')],_0x48b77c[_0x9b28('0x61')]);})[_0x9b28('0x13')](function(_0x4925f7){logger['info']('['+_0x5c906f[_0x9b28('0x17')]()+_0x9b28('0x62'),_0x4925f7[_0x9b28('0x30')]);logger[_0x9b28('0x20')]('['+_0x5c906f[_0x9b28('0x17')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x29e13d[_0x9b28('0x31')]);return getTicket(_0x4925f7,_0x215d3c,_0x1bde12,_0x4e3433,_0x29e13d,_0x48b77c,_0x5c906f);})[_0x9b28('0x13')](function(_0x14a94d){logger[_0x9b28('0x20')](util[_0x9b28('0x4e')]('['+_0x5c906f['toUpperCase']()+_0x9b28('0x63'),_0x48b77c[_0x9b28('0x42')],_0x14a94d[_0x9b28('0x64')]));logger[_0x9b28('0x20')](util[_0x9b28('0x4e')]('['+_0x5c906f[_0x9b28('0x17')]()+_0x9b28('0x65'),_0x5c906f));if(_0x5c906f!=='unmanaged'&&_0x48b77c['openNewTab']){logger[_0x9b28('0x20')]('['+_0x5c906f[_0x9b28('0x17')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x215d3c[_0x9b28('0x9')],_0x20a414[_0x9b28('0x66')],_0x48b77c[_0x9b28('0x42')],_0x14a94d[_0x9b28('0x64')]);}})[_0x9b28('0x15')](function(_0x17c02b){logger[_0x9b28('0x16')]('['+_0x5c906f[_0x9b28('0x17')]()+_0x9b28('0x67'),_0x17c02b[_0x9b28('0x26')]);console[_0x9b28('0x16')]('Error\x20running\x20Dynamics365\x20integration',_0x17c02b);});}; \ No newline at end of file +var _0xc053=[']\x20Enduser\x20created!','forEach','picklist','type','nameField','customField','idField','indexOf','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','ticketType','phonecall','callDirection','queue','phonecalls','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','isNil','validateEmail','email','userEmail','length','internalemailaddress','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','calleridnum','contacts','4.0','body','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','GET','contacts?$select=','&$filter=','%2b','value','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing'];(function(_0x1ec447,_0x8e4771){var _0x42f254=function(_0x38f66a){while(--_0x38f66a){_0x1ec447['push'](_0x1ec447['shift']());}};_0x42f254(++_0x8e4771);}(_0xc053,0x112));var _0x3c05=function(_0x4a756c,_0x1f2e9c){_0x4a756c=_0x4a756c-0x0;var _0x3b1680=_0xc053[_0x4a756c];return _0x3b1680;};'use strict';var _=require('lodash');var rp=require(_0x3c05('0x0'));var util=require(_0x3c05('0x1'));var intUtil=require(_0x3c05('0x2'));var md5=require(_0x3c05('0x3'));var Redis=require('ioredis');var logger=require(_0x3c05('0x4'))(_0x3c05('0x5'));var config=require(_0x3c05('0x6'));config[_0x3c05('0x7')]=_[_0x3c05('0x8')](config[_0x3c05('0x7')],{'host':_0x3c05('0x9'),'port':0x18eb});var io=require(_0x3c05('0xa'))(new Redis(config[_0x3c05('0x7')]));function getAuthToken(_0x5725e3,_0x167791,_0xa9f578){if(_0x5725e3['modernAuthentication']){_0x5725e3[_0x3c05('0xb')]=_0x5725e3[_0x3c05('0xc')][_0x3c05('0xd')];_0x5725e3[_0x3c05('0xe')]=_0x5725e3[_0x3c05('0xc')][_0x3c05('0xf')];return Promise[_0x3c05('0x10')](_0x5725e3[_0x3c05('0xc')][_0x3c05('0x11')]);}var _0x4de2ca={'method':_0x3c05('0x12'),'uri':_0x167791,'form':{'client_id':_0x5725e3[_0x3c05('0x13')],'resource':_0x5725e3[_0x3c05('0xb')],'username':_0x5725e3[_0x3c05('0x14')],'password':_0x5725e3[_0x3c05('0x15')],'grant_type':_0x3c05('0x15'),'client_secret':_0x5725e3[_0x3c05('0x16')]},'json':!![]};return rp(_0x4de2ca)[_0x3c05('0x17')](function(_0x3547d0){return _0x3547d0[_0x3c05('0x18')];})[_0x3c05('0x19')](function(_0xd25118){logger[_0x3c05('0x1a')]('['+[_0xa9f578[_0x3c05('0x1b')]()]+_0x3c05('0x1c'));return _0xd25118[_0x3c05('0x1d')];});}function getUser(_0x2c8e40,_0x6f3e1e,_0x21b89b,_0x476926,_0x2c642c,_0x5a4ed7){return new Promise(function(_0x1e098b,_0x26f533){return getAuthToken(_0x6f3e1e,_0x476926,_0x5a4ed7)[_0x3c05('0x17')](function(_0x30379f){var _0xb89c88={'method':'GET','uri':_0x2c642c+_0x3c05('0x1e'),'headers':{'Authorization':_0x3c05('0x1f')+_0x30379f,'OData-Version':'4.0'},'json':!![]};return rp(_0xb89c88);})[_0x3c05('0x17')](function(_0x319fdf){var _0x40f63f=_0x319fdf['value'];var _0x38e4dd=![];var _0x196479=null;if(!_[_0x3c05('0x20')](_0x21b89b)){if(intUtil[_0x3c05('0x21')](_0x21b89b[_0x3c05('0x22')])){_0x2c8e40[_0x3c05('0x23')]=_0x21b89b[_0x3c05('0x22')];for(_0x196479=0x0;_0x196479<_0x40f63f[_0x3c05('0x24')];_0x196479++){if(_0x40f63f[_0x196479][_0x3c05('0x25')]===_0x21b89b[_0x3c05('0x22')]&&!_0x40f63f[_0x196479]['isdisabled']){_0x38e4dd=!![];logger[_0x3c05('0x26')]('['+[_0x5a4ed7[_0x3c05('0x1b')]()]+']\x20Agent\x20found\x20'+_0x40f63f[_0x196479][_0x3c05('0x27')]+'!');_0x2c8e40[_0x3c05('0x28')]=_0x40f63f[_0x196479][_0x3c05('0x27')];}}}}if(!_0x38e4dd){logger[_0x3c05('0x26')]('['+[_0x5a4ed7[_0x3c05('0x1b')]()]+_0x3c05('0x29'));_0x2c8e40[_0x3c05('0x23')]=_0x6f3e1e[_0x3c05('0x14')];for(_0x196479=0x0;_0x196479<_0x40f63f[_0x3c05('0x24')];_0x196479++){if(_0x40f63f[_0x196479]['internalemailaddress']===_0x6f3e1e[_0x3c05('0x14')]){_0x2c8e40[_0x3c05('0x28')]=_0x40f63f[_0x196479][_0x3c05('0x27')];}}}_0x1e098b(_0x2c8e40);})[_0x3c05('0x19')](function(_0x597697){_0x26f533(_0x597697[_0x3c05('0x1d')]);});});}function createEndUser(_0x4f0aa9,_0x509d91,_0x26714a,_0x21147e,_0x17188b,_0x2e0bf4,_0xab2b60){return new Promise(function(_0x1afa4d,_0x2a3078){return getAuthToken(_0x509d91,_0x26714a,_0x2e0bf4)[_0x3c05('0x17')](function(_0x552a49){var _0x265787=_0x2e0bf4[_0x3c05('0x2a')]()===_0x3c05('0x2b')?_0x17188b['destcalleridnum']:_0x17188b[_0x3c05('0x2c')];var _0x369510={'method':_0x3c05('0x12'),'uri':_0x21147e+_0x3c05('0x2d'),'body':{'fullname':_0x265787,'firstname':_0x265787,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x4f0aa9['userId']+')'},'headers':{'Authorization':_0x3c05('0x1f')+_0x552a49,'OData-Version':_0x3c05('0x2e')},'json':!![],'resolveWithFullResponse':!![]};_0x369510[_0x3c05('0x2f')][_0xab2b60]=_0x265787;return rp(_0x369510);})['then'](function(_0x5900b9){var _0x23a109=_0x5900b9[_0x3c05('0x30')][_0x3c05('0x31')];var _0x5def2e=_0x23a109[_0x3c05('0x32')](_0x23a109[_0x3c05('0x33')]('(')+0x1,_0x23a109[_0x3c05('0x33')](')'));_0x4f0aa9[_0x3c05('0x34')]=_0x5def2e;_0x1afa4d(_0x4f0aa9);})[_0x3c05('0x19')](function(_0x5ad217){_0x2a3078(_0x5ad217[_0x3c05('0x1d')]);});});}function getEndUser(_0x209598,_0x5545a0,_0x33dab2,_0x4ff9fe,_0x20f94e,_0x241481,_0x45ce27,_0x4e51bb){var _0x26c866=_0x241481[_0x3c05('0x2a')]()===_0x3c05('0x2b')?_0x20f94e[_0x3c05('0x35')]:_0x20f94e[_0x3c05('0x2c')];return getAuthToken(_0x5545a0,_0x33dab2,_0x241481)[_0x3c05('0x17')](function(_0xf61d9d){_0x4e51bb=_0x4e51bb?_0x4e51bb:_0x3c05('0x36');var _0x4b0dc9={'method':_0x3c05('0x37'),'uri':_0x4ff9fe+_0x3c05('0x38')+_0x4e51bb+_0x3c05('0x39')+_0x4e51bb+'\x20eq\x20\x27'+_0x26c866['replace']('+',_0x3c05('0x3a'))+'\x27','headers':{'Authorization':_0x3c05('0x1f')+_0xf61d9d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b0dc9);})[_0x3c05('0x17')](function(_0x47b335){var _0x44b9a0=![];if(!_0x47b335)return _0x44b9a0;var _0x222d44=_0x47b335[_0x3c05('0x3b')];for(var _0x472509=0x0;_0x472509<_0x222d44['length'];_0x472509++){if(_0x222d44[_0x472509][_0x4e51bb]===_0x26c866){_0x44b9a0=!![];_0x209598['enduserId']=_0x222d44[_0x472509]['contactid'];}}return _0x44b9a0;})['then'](function(_0x3d5206){if(_0x3d5206)return _0x209598;if(_0x45ce27===_0x3c05('0x3c')){logger['info']('['+[_0x241481[_0x3c05('0x1b')]()]+_0x3c05('0x3d'));return _0x209598;}return createEndUser(_0x209598,_0x5545a0,_0x33dab2,_0x4ff9fe,_0x20f94e,_0x241481,_0x4e51bb)[_0x3c05('0x17')](function(_0x27e1d4){logger[_0x3c05('0x26')]('['+[_0x241481[_0x3c05('0x1b')]()]+_0x3c05('0x3e'),_0x27e1d4[_0x3c05('0x34')]);return _0x27e1d4;});});}function getCustomFields(_0x4bb61b,_0x35d6ef,_0x1d3533){var _0x1c34c3={};if(_0x4bb61b[_0x3c05('0x24')]>0x0){_[_0x3c05('0x3f')](_0x4bb61b,function(_0x8773d9){if(_['includes'](['string',_0x3c05('0x40')],_0x8773d9[_0x3c05('0x41')])&&_0x8773d9[_0x3c05('0x42')]&&!_0x8773d9[_0x3c05('0x43')]){var _0x2dd076=_0x8773d9[_0x3c05('0x44')][_0x3c05('0x2a')]();var _0x1610ea=_0x2dd076[_0x3c05('0x32')](0x0,_0x2dd076['indexOf']('_'));var _0x4c2836=_0x2dd076[_0x3c05('0x32')](_0x2dd076[_0x3c05('0x45')]('_')+0x1);if(_0x1610ea===_0x1d3533){_0x1c34c3[_0x4c2836]=_0x8773d9['content'];}}});}return _0x1c34c3;}function getTicket(_0x494697,_0x3c4605,_0x2b4445,_0x364e31,_0x426bfd,_0x2e2146,_0x1c4429){return new Promise(function(_0x71c6c6,_0x336eeb){var _0x30ea3e;return getAuthToken(_0x3c4605,_0x2b4445,_0x1c4429)[_0x3c05('0x17')](function(_0x1af7f1){if(_0x2e2146['ticketType']===_0x3c05('0x46')){_0x30ea3e={'method':'POST','uri':_0x364e31+_0x3c05('0x47'),'body':Object[_0x3c05('0x48')]({},{'title':intUtil[_0x3c05('0x49')](_0x2e2146[_0x3c05('0x4a')],_0x426bfd,'\x20'),'description':intUtil[_0x3c05('0x49')](_0x2e2146[_0x3c05('0x4b')],_0x426bfd,'\x0a'),'customerid_contact@odata.bind':_0x494697[_0x3c05('0x34')]?_0x3c05('0x4c')+_0x494697[_0x3c05('0x34')]+')':undefined,'ownerid@odata.bind':_0x3c05('0x4d')+_0x494697[_0x3c05('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x2e2146['Fields'],_0x426bfd,_0x2e2146['ticketType'])),'headers':{'Authorization':_0x3c05('0x1f')+_0x1af7f1,'OData-Version':_0x3c05('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2e2146[_0x3c05('0x4e')]===_0x3c05('0x4f')){var _0x2cfe73=_0x494697[_0x3c05('0x34')]?[{'partyid_systemuser@odata.bind':_0x3c05('0x4d')+_0x494697[_0x3c05('0x28')]+')','participationtypemask':_0x494697[_0x3c05('0x50')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x3c05('0x4c')+_0x494697['enduserId']+')','participationtypemask':_0x494697['callDirection']===_0x3c05('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x3c05('0x4d')+_0x494697[_0x3c05('0x28')]+')','participationtypemask':_0x494697['callDirection']==='queue'?0x2:0x1}];_0x30ea3e={'method':_0x3c05('0x12'),'uri':_0x364e31+_0x3c05('0x52'),'body':Object[_0x3c05('0x48')]({},{'subject':intUtil['getString'](_0x2e2146['Subjects'],_0x426bfd,'\x20'),'phonenumber':String(_0x426bfd[_0x3c05('0x2c')]),'description':intUtil[_0x3c05('0x49')](_0x2e2146[_0x3c05('0x4b')],_0x426bfd,'\x0a'),'regardingobjectid_contact@odata.bind':_0x494697[_0x3c05('0x34')]?'/contacts('+_0x494697[_0x3c05('0x34')]+')':undefined,'ownerid@odata.bind':_0x3c05('0x4d')+_0x494697['userId']+')','directioncode':_0x494697[_0x3c05('0x50')]===_0x3c05('0x51')?![]:!![],'phonecall_activity_parties':_0x2cfe73},getCustomFields(_0x2e2146[_0x3c05('0x53')],_0x426bfd,_0x2e2146[_0x3c05('0x4e')])),'headers':{'Authorization':_0x3c05('0x1f')+_0x1af7f1,'OData-Version':_0x3c05('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x30ea3e);})[_0x3c05('0x17')](function(_0x46ee6b){var _0x202e9c=_0x46ee6b[_0x3c05('0x30')][_0x3c05('0x31')];var _0x22ccf0=_0x202e9c[_0x3c05('0x32')](_0x202e9c[_0x3c05('0x33')]('(')+0x1,_0x202e9c[_0x3c05('0x33')](')'));_0x494697[_0x3c05('0x54')]=_0x22ccf0;_0x71c6c6(_0x494697);})[_0x3c05('0x19')](function(_0x4cdaab){_0x336eeb(_0x4cdaab[_0x3c05('0x1d')]);});});}function emit(_0x34c5f0,_0x552faf,_0x255490,_0x2f12d6){var _0x574f8f={'uri':util[_0x3c05('0x55')](_0x3c05('0x56'),_0x34c5f0,_0x255490,_0x2f12d6)};io['to'](util[_0x3c05('0x55')](_0x3c05('0x57'),_0x552faf))[_0x3c05('0x58')](_0x3c05('0x59'),_0x574f8f);}exports['cs']=function(_0x6ccd5f,_0xfd84ba,_0x3eeb60,_0x18a979,_0x3569ab,_0x35232e,_0x5c82b5,_0x47bc68){var _0x23fd30={};_0x35232e[_0x3c05('0xb')]=_0x35232e[_0x3c05('0x5a')]?intUtil[_0x3c05('0x5b')](_0x35232e[_0x3c05('0xc')]['data7']):intUtil[_0x3c05('0x5b')](_0x35232e[_0x3c05('0xb')]);_0x35232e[_0x3c05('0x5c')]=intUtil[_0x3c05('0x5b')](_0x35232e['serverUrl']);_0x23fd30['callDirection']=_0x47bc68===_0x3c05('0x51')||_0x47bc68==='unmanaged'?_0x3c05('0x51'):_0x3c05('0x2b');var _0x5404b9=_0x35232e[_0x3c05('0x5a')]?util[_0x3c05('0x55')](_0x3c05('0x5d'),_0x35232e[_0x3c05('0xc')]['data7']):util[_0x3c05('0x55')](_0x3c05('0x5d'),_0x35232e[_0x3c05('0xb')]);var _0x25c78f=util[_0x3c05('0x55')](_0x3c05('0x5e'),_0x35232e['tenantId']);var _0x5501dc=util[_0x3c05('0x55')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35232e[_0x3c05('0x5c')],_0xfd84ba[_0x3c05('0x5f')],md5(_0xfd84ba['uniqueid']));if(_0x3569ab&&_0x3569ab[_0x3c05('0x60')]){logger[_0x3c05('0x26')](_0x3c05('0x61'),_0x3c05('0x62'));_0xfd84ba[_0x3c05('0x63')]=_0x5501dc;}else if(_0x5c82b5&&_0x5c82b5['recordingFormat']&&_0x5c82b5[_0x3c05('0x64')]!==_0x3c05('0x65')){logger[_0x3c05('0x26')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xfd84ba[_0x3c05('0x63')]=_0x5501dc;}else{_0xfd84ba[_0x3c05('0x63')]='';}return getUser(_0x23fd30,_0x35232e,_0x18a979,_0x25c78f,_0x5404b9,_0x47bc68)[_0x3c05('0x17')](function(_0x42de40){logger[_0x3c05('0x26')]('['+_0x47bc68[_0x3c05('0x1b')]()+_0x3c05('0x66'),_0x42de40[_0x3c05('0x28')]);logger[_0x3c05('0x26')]('['+_0x47bc68[_0x3c05('0x1b')]()+']\x20The\x20User\x20email\x20is:',_0x42de40[_0x3c05('0x23')]);return getEndUser(_0x42de40,_0x35232e,_0x25c78f,_0x5404b9,_0xfd84ba,_0x47bc68,_0x3eeb60[_0x3c05('0x67')],_0x3eeb60['additionalSearchContact']);})['then'](function(_0x3002af){logger[_0x3c05('0x26')]('['+_0x47bc68[_0x3c05('0x1b')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x3002af[_0x3c05('0x34')]);logger[_0x3c05('0x26')]('['+_0x47bc68[_0x3c05('0x1b')]()+_0x3c05('0x68'),_0xfd84ba[_0x3c05('0x2c')]);return getTicket(_0x3002af,_0x35232e,_0x25c78f,_0x5404b9,_0xfd84ba,_0x3eeb60,_0x47bc68);})[_0x3c05('0x17')](function(_0x27ab78){logger[_0x3c05('0x26')](util[_0x3c05('0x55')]('['+_0x47bc68[_0x3c05('0x1b')]()+_0x3c05('0x69'),_0x3eeb60[_0x3c05('0x4e')],_0x27ab78[_0x3c05('0x54')]));logger[_0x3c05('0x26')](util['format']('['+_0x47bc68['toUpperCase']()+_0x3c05('0x6a'),_0x47bc68));if(_0x47bc68!==_0x3c05('0x6b')&&_0x3eeb60['openNewTab']){logger[_0x3c05('0x26')]('['+_0x47bc68[_0x3c05('0x1b')]()+']',_0x3c05('0x6c'));emit(_0x35232e[_0x3c05('0xb')],_0x18a979[_0x3c05('0x6d')],_0x3eeb60[_0x3c05('0x4e')],_0x27ab78[_0x3c05('0x54')]);}})['catch'](function(_0x39b327){logger[_0x3c05('0x1a')]('['+_0x47bc68[_0x3c05('0x1b')]()+_0x3c05('0x6e'),_0x39b327[_0x3c05('0x1d')]);console['error'](_0x3c05('0x6f'),_0x39b327);});}; \ 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 9871385..b4b15a5 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 _0x9bdc=['format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','GET','map','forEach','string','picklist','type','customField','nameField','content','idField','push','variableName','customVariable','Variable','name','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Ticket\x20ID\x20is:','catch','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge'];(function(_0x5bc6a6,_0x158e11){var _0x312c55=function(_0x439cdd){while(--_0x439cdd){_0x5bc6a6['push'](_0x5bc6a6['shift']());}};_0x312c55(++_0x158e11);}(_0x9bdc,0x1c6));var _0xc9bd=function(_0x39495e,_0x520bdb){_0x39495e=_0x39495e-0x0;var _0x16691c=_0x9bdc[_0x39495e];return _0x16691c;};'use strict';var _=require(_0xc9bd('0x0'));var rp=require(_0xc9bd('0x1'));var md5=require(_0xc9bd('0x2'));var util=require(_0xc9bd('0x3'));var Redis=require(_0xc9bd('0x4'));var intUtil=require(_0xc9bd('0x5'));var config=require(_0xc9bd('0x6'));var logger=require('../../../../config/logger')(_0xc9bd('0x7'));config['redis']=_[_0xc9bd('0x8')](config[_0xc9bd('0x9')],{'host':_0xc9bd('0xa'),'port':0x18eb});var io=require(_0xc9bd('0xb'))(new Redis(config[_0xc9bd('0x9')]));var headers={'Content-Type':'application/json','Accept':_0xc9bd('0xc')};function emit(_0x4b4d16,_0x3f3f40,_0x1de118){io['to'](_0x4b4d16)['emit'](_0x3f3f40,_0x1de118);}function getTicket(_0x5e1235,_0x55858c,_0x1940eb,_0x28f447,_0x1478de){logger[_0xc9bd('0xd')](_0xc9bd('0xe'));var _0x186bc3=_[_0xc9bd('0xf')]({'responder_id':_0x55858c['id'],'requester_id':_0x1940eb['id'],'name':util[_0xc9bd('0x10')](_0xc9bd('0x11'),_0x1478de[_0xc9bd('0x12')]),'phone':_0x1478de[_0xc9bd('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc9bd('0x14')](_0x28f447[_0xc9bd('0x15')],_0x1478de,'\x20'),'description':intUtil[_0xc9bd('0x14')](_0x28f447[_0xc9bd('0x16')],_0x1478de,_0xc9bd('0x17')),'tags':getTags(_0x28f447[_0xc9bd('0x18')],'name')},getCustomFields(_0x28f447[_0xc9bd('0x19')],_0x1478de));_0x186bc3[_0xc9bd('0x1a')]=_['mapValues'](_['keyBy'](_0x186bc3[_0xc9bd('0x1a')],'id'),'value');return request({'uri':util[_0xc9bd('0x10')]('%s/api/v2/tickets',_0x5e1235['remoteUri']),'method':_0xc9bd('0x1b'),'body':_0x186bc3})[_0xc9bd('0x1c')](function(_0x48f58f){logger[_0xc9bd('0xd')](_0xc9bd('0x1d'));return _0x48f58f;});}function getUser(_0x354bc7,_0x5ddb4d){if(intUtil[_0xc9bd('0x1e')](_0x5ddb4d)){return request({'uri':util[_0xc9bd('0x10')](_0xc9bd('0x1f'),_0x354bc7['remoteUri']),'qs':{'email':_0x5ddb4d}})[_0xc9bd('0x1c')](function(_0x282434){if(_0x282434[_0xc9bd('0x20')]){logger['info'](_0xc9bd('0x21'));return _[_0xc9bd('0x22')](_0x282434,function(_0x34b6e5){return _0x34b6e5[_0xc9bd('0x23')][_0xc9bd('0x24')]===_0x5ddb4d;});}else{logger[_0xc9bd('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc9bd('0x10')](_0xc9bd('0x25'),_0x354bc7[_0xc9bd('0x26')])})[_0xc9bd('0x1c')](function(_0x28440c){logger[_0xc9bd('0xd')]('Admin\x20account\x20selected.');return _0x28440c;});}});}else{logger[_0xc9bd('0xd')](_0xc9bd('0x27'));return request({'uri':util[_0xc9bd('0x10')](_0xc9bd('0x25'),_0x354bc7['remoteUri'])})[_0xc9bd('0x1c')](function(_0x3744e8){logger['info'](_0xc9bd('0x28'));return _0x3744e8;});}}function getEndUser(_0x37000d,_0x3f41e5,_0x359d5d){logger['info'](_0xc9bd('0x29'),_0x359d5d);return request({'uri':util[_0xc9bd('0x10')]('%s/api/v2/contacts',_0x37000d[_0xc9bd('0x26')]),'qs':{'phone':_0x359d5d}})[_0xc9bd('0x1c')](function(_0x1b9c00){if(_0x1b9c00['length']){logger[_0xc9bd('0xd')](_0xc9bd('0x2a'));return _['find'](_0x1b9c00,{'phone':_0x359d5d});}else{logger[_0xc9bd('0xd')](_0xc9bd('0x2b'));return request({'uri':util[_0xc9bd('0x10')](_0xc9bd('0x2c'),_0x37000d['remoteUri']),'method':_0xc9bd('0x1b'),'body':{'name':_0x3f41e5,'phone':_0x359d5d}})[_0xc9bd('0x1c')](function(_0xfdbf96){logger['info'](_0xc9bd('0x2d'));return _0xfdbf96;});}});}function getAuth(_0x569068){return util[_0xc9bd('0x10')](_0xc9bd('0x2e'),new Buffer(_0x569068[_0xc9bd('0x2f')]+':X')[_0xc9bd('0x30')](_0xc9bd('0x31')));}function request(_0x4c539a){logger['debug'](_0xc9bd('0x32'),JSON[_0xc9bd('0x33')](_0x4c539a));return rp(_['defaults'](_0x4c539a,{'method':_0xc9bd('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x1d06c1,_0x450127){var _0x2d3bce=[];if(_0x1d06c1&&_0x1d06c1[_0xc9bd('0x20')]>0x0){_0x2d3bce=_[_0xc9bd('0x35')](_0x1d06c1,_0x450127);}return _0x2d3bce;}function getCustomFields(_0x3eb1e5,_0x5eb94f){var _0x2c30f4=[];var _0x55c163={'custom_fields':[]};if(_0x3eb1e5[_0xc9bd('0x20')]>0x0){_[_0xc9bd('0x36')](_0x3eb1e5,function(_0x396735){if(_['includes']([_0xc9bd('0x37'),_0xc9bd('0x38')],_0x396735[_0xc9bd('0x39')])&&_0x396735['nameField']&&!_0x396735[_0xc9bd('0x3a')]){_0x55c163[_0x396735[_0xc9bd('0x3b')]['toLowerCase']()]=_0x396735[_0xc9bd('0x3c')][_0xc9bd('0x30')]();}else if(_['includes']([_0xc9bd('0x37'),'picklist'],_0x396735['type'])&&_0x396735[_0xc9bd('0x3d')]&&_0x396735[_0xc9bd('0x3a')]){_0x55c163[_0xc9bd('0x1a')][_0xc9bd('0x3e')]({'id':_0x396735['idField'],'value':_0x396735['content'][_0xc9bd('0x30')]()});}else if(_0x396735[_0xc9bd('0x39')]==='variable'&&_0x396735[_0xc9bd('0x3f')]&&_0x396735[_0xc9bd('0x3d')]&&_0x396735[_0xc9bd('0x3a')]){_0x5eb94f[_0x396735[_0xc9bd('0x3f')]]&&_0x55c163['custom_fields'][_0xc9bd('0x3e')]({'id':_0x396735[_0xc9bd('0x3d')],'value':_0x5eb94f[_0x396735[_0xc9bd('0x3f')]][_0xc9bd('0x30')]()});}else if(_0x396735[_0xc9bd('0x39')]===_0xc9bd('0x40')&&_0x396735['Variable']&&_0x396735[_0xc9bd('0x41')]['name']&&_0x396735[_0xc9bd('0x3d')]&&_0x396735[_0xc9bd('0x3a')]){_0x5eb94f[_0x396735[_0xc9bd('0x41')][_0xc9bd('0x42')][_0xc9bd('0x43')]()]&&_0x55c163[_0xc9bd('0x1a')][_0xc9bd('0x3e')]({'id':_0x396735[_0xc9bd('0x3d')],'value':_0x5eb94f[_0x396735[_0xc9bd('0x41')][_0xc9bd('0x42')][_0xc9bd('0x43')]()][_0xc9bd('0x30')]()});}});}return _0x55c163;}exports[_0xc9bd('0x44')]=function(_0x39783d,_0x36ff7c,_0xd7f837,_0x189eb2,_0x4360e7,_0x1a8bf1){var _0xeb287a,_0x313b15;_0x1a8bf1[_0xc9bd('0x26')]=intUtil['stripTrailingSlash'](_0x1a8bf1[_0xc9bd('0x26')]);_0x1a8bf1[_0xc9bd('0x45')]=intUtil[_0xc9bd('0x46')](_0x1a8bf1[_0xc9bd('0x45')]);if(_0x4360e7&&_0x4360e7[_0xc9bd('0x47')]){logger[_0xc9bd('0xd')](_0xc9bd('0x48'),'Recording\x20is\x20enabled!');_0x36ff7c[_0xc9bd('0x49')]=util[_0xc9bd('0x10')](_0xc9bd('0x4a'),_0x1a8bf1['serverUrl'],_0x36ff7c['uniqueid'],md5(_0x36ff7c[_0xc9bd('0x4b')]));}else{_0x36ff7c[_0xc9bd('0x49')]='';}headers[_0xc9bd('0x4c')]=getAuth(_0x1a8bf1);return getUser(_0x1a8bf1,_0x189eb2[_0xc9bd('0x24')])[_0xc9bd('0x1c')](function(_0x184b9d){_0xeb287a=_0x184b9d;logger[_0xc9bd('0xd')](_0xc9bd('0x4d'),_0xeb287a['id']);return getEndUser(_0x1a8bf1,_0x36ff7c[_0xc9bd('0x12')],_0x36ff7c[_0xc9bd('0x13')]);})[_0xc9bd('0x1c')](function(_0x5991d6){_0x313b15=_0x5991d6;logger[_0xc9bd('0xd')](_0xc9bd('0x4e'),_0x313b15['id']);return getTicket(_0x1a8bf1,_0xeb287a,_0x313b15,_0xd7f837,_0x36ff7c);})[_0xc9bd('0x1c')](function(_0x4d9b87){if(_0x4d9b87&&_0x4d9b87['id']){logger[_0xc9bd('0xd')](_0xc9bd('0x1d'));logger[_0xc9bd('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4d9b87['id']);logger[_0xc9bd('0xd')]('[QUEUE]',_0xc9bd('0x4f'));emit(util[_0xc9bd('0x10')](_0xc9bd('0x50'),_0x189eb2[_0xc9bd('0x42')]),_0xc9bd('0x51'),{'uri':util['format'](_0xc9bd('0x52'),_0x1a8bf1[_0xc9bd('0x26')],_0x4d9b87['id'])});}})['catch'](function(_0x9a1d9e){logger[_0xc9bd('0x53')]('[QUEUE]',JSON[_0xc9bd('0x33')](_0x9a1d9e));});};exports[_0xc9bd('0x54')]=function(_0x2fbc0b,_0x538b82,_0x199bac,_0x2982f3,_0x20a15f,_0xb8018,_0x58d653){var _0x20904a,_0x59c11c;_0xb8018['remoteUri']=intUtil[_0xc9bd('0x46')](_0xb8018[_0xc9bd('0x26')]);_0xb8018[_0xc9bd('0x45')]=intUtil['stripTrailingSlash'](_0xb8018[_0xc9bd('0x45')]);if(_0x58d653&&_0x58d653['recordingFormat']&&_0x58d653[_0xc9bd('0x55')]!==_0xc9bd('0x56')){logger[_0xc9bd('0xd')](_0xc9bd('0x57'),'Recording\x20is\x20enabled!');_0x538b82[_0xc9bd('0x49')]=util[_0xc9bd('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb8018[_0xc9bd('0x45')],_0x538b82[_0xc9bd('0x4b')],md5(_0x538b82['uniqueid']));}headers[_0xc9bd('0x4c')]=getAuth(_0xb8018);return getUser(_0xb8018,_0x2982f3[_0xc9bd('0x24')])['then'](function(_0xaf503f){_0x20904a=_0xaf503f;logger[_0xc9bd('0xd')]('The\x20User\x20ID\x20is:',_0x20904a['id']);return getEndUser(_0xb8018,_0x538b82['destcalleridname'],_0x538b82['destcalleridnum']);})['then'](function(_0x4c3d98){_0x59c11c=_0x4c3d98;logger[_0xc9bd('0xd')](_0xc9bd('0x4e'),_0x59c11c['id']);return getTicket(_0xb8018,_0x20904a,_0x59c11c,_0x199bac,_0x538b82);})[_0xc9bd('0x1c')](function(_0x3bca41){if(_0x3bca41&&_0x3bca41['id']){logger[_0xc9bd('0xd')]('Ticket\x20created!');logger[_0xc9bd('0xd')](_0xc9bd('0x58'),_0x3bca41['id']);logger[_0xc9bd('0xd')](_0xc9bd('0x57'),_0xc9bd('0x4f'));emit(util[_0xc9bd('0x10')]('user:%s',_0x2982f3[_0xc9bd('0x42')]),'trigger:browser:url',{'uri':util[_0xc9bd('0x10')](_0xc9bd('0x52'),_0xb8018[_0xc9bd('0x26')],_0x3bca41['id'])});}})[_0xc9bd('0x59')](function(_0x45da08){logger[_0xc9bd('0x53')](_0xc9bd('0x57'),JSON[_0xc9bd('0x33')](_0x45da08));});};exports[_0xc9bd('0x5a')]=function(_0x39fd11,_0x418e7a,_0x347c20,_0x5059c4,_0xe7b4b7,_0x25ba95){var _0x4fe164,_0xf43f32;_0x25ba95[_0xc9bd('0x26')]=intUtil[_0xc9bd('0x46')](_0x25ba95[_0xc9bd('0x26')]);_0x25ba95['serverUrl']=intUtil[_0xc9bd('0x46')](_0x25ba95[_0xc9bd('0x45')]);if(_0xe7b4b7&&_0xe7b4b7[_0xc9bd('0x47')]){logger[_0xc9bd('0xd')]('['+_0x418e7a[_0xc9bd('0x5b')][_0xc9bd('0x5c')]()+']',_0xc9bd('0x5d'));_0x418e7a['recordingURL']=util[_0xc9bd('0x10')](_0xc9bd('0x4a'),_0x25ba95['serverUrl'],_0x418e7a[_0xc9bd('0x4b')],md5(_0x418e7a[_0xc9bd('0x4b')]));}else{_0x418e7a[_0xc9bd('0x49')]='';}headers[_0xc9bd('0x4c')]=getAuth(_0x25ba95);return getUser(_0x25ba95,'')[_0xc9bd('0x1c')](function(_0x1542d4){_0x4fe164=_0x1542d4;logger[_0xc9bd('0xd')]('The\x20User\x20ID\x20is:',_0x4fe164['id']);return getEndUser(_0x25ba95,_0x418e7a[_0xc9bd('0x12')],_0x418e7a[_0xc9bd('0x13')]);})[_0xc9bd('0x1c')](function(_0x5a8aac){_0xf43f32=_0x5a8aac;logger[_0xc9bd('0xd')]('The\x20Enduser\x20ID\x20is:',_0xf43f32['id']);return getTicket(_0x25ba95,_0x4fe164,_0xf43f32,_0x347c20,_0x418e7a);})[_0xc9bd('0x1c')](function(_0x18f19c){if(_0x18f19c){logger[_0xc9bd('0xd')]('Ticket\x20created!');logger[_0xc9bd('0xd')]('The\x20Ticket\x20ID\x20is:',_0x18f19c['id']);}})[_0xc9bd('0x59')](function(_0x30a0ed){logger[_0xc9bd('0x53')]('['+_0x418e7a[_0xc9bd('0x5b')]['toUpperCase']()+']',JSON[_0xc9bd('0x33')](_0x30a0ed));});}; \ No newline at end of file +var _0xa8b2=['destcalleridnum','catch','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','format','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','Agent\x20found!','find','%s/api/v2/agents/me','Admin\x20account\x20selected.','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','length','map','forEach','string','picklist','nameField','customField','content','includes','type','push','idField','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','destcalleridname'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xa8b2,0x1ed));var _0x2a8b=function(_0x43d96f,_0x2e63bb){_0x43d96f=_0x43d96f-0x0;var _0x3c8268=_0xa8b2[_0x43d96f];return _0x3c8268;};'use strict';var _=require(_0x2a8b('0x0'));var rp=require(_0x2a8b('0x1'));var md5=require(_0x2a8b('0x2'));var util=require('util');var Redis=require(_0x2a8b('0x3'));var intUtil=require(_0x2a8b('0x4'));var config=require(_0x2a8b('0x5'));var logger=require(_0x2a8b('0x6'))(_0x2a8b('0x7'));config['redis']=_[_0x2a8b('0x8')](config[_0x2a8b('0x9')],{'host':_0x2a8b('0xa'),'port':0x18eb});var io=require(_0x2a8b('0xb'))(new Redis(config[_0x2a8b('0x9')]));var headers={'Content-Type':_0x2a8b('0xc'),'Accept':_0x2a8b('0xc')};function emit(_0x15dbbb,_0x1945a7,_0x581006){io['to'](_0x15dbbb)[_0x2a8b('0xd')](_0x1945a7,_0x581006);}function getTicket(_0x3da1da,_0x23da8c,_0x64bee,_0x2b056b,_0x3b3b6a){logger[_0x2a8b('0xe')]('Creating\x20new\x20ticket...');var _0x193eb7=_['merge']({'responder_id':_0x23da8c['id'],'requester_id':_0x64bee['id'],'name':util['format'](_0x2a8b('0xf'),_0x3b3b6a[_0x2a8b('0x10')]),'phone':_0x3b3b6a[_0x2a8b('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2b056b[_0x2a8b('0x12')],_0x3b3b6a,'\x20'),'description':intUtil[_0x2a8b('0x13')](_0x2b056b[_0x2a8b('0x14')],_0x3b3b6a,_0x2a8b('0x15')),'tags':getTags(_0x2b056b[_0x2a8b('0x16')],_0x2a8b('0x17'))},getCustomFields(_0x2b056b[_0x2a8b('0x18')],_0x3b3b6a));_0x193eb7['custom_fields']=_[_0x2a8b('0x19')](_[_0x2a8b('0x1a')](_0x193eb7[_0x2a8b('0x1b')],'id'),_0x2a8b('0x1c'));return request({'uri':util[_0x2a8b('0x1d')](_0x2a8b('0x1e'),_0x3da1da['remoteUri']),'method':_0x2a8b('0x1f'),'body':_0x193eb7})[_0x2a8b('0x20')](function(_0x871630){logger[_0x2a8b('0xe')](_0x2a8b('0x21'));return _0x871630;});}function getUser(_0x1d9738,_0x339f97){if(intUtil[_0x2a8b('0x22')](_0x339f97)){return request({'uri':util['format'](_0x2a8b('0x23'),_0x1d9738[_0x2a8b('0x24')]),'qs':{'email':_0x339f97}})['then'](function(_0xfc8f00){if(_0xfc8f00['length']){logger[_0x2a8b('0xe')](_0x2a8b('0x25'));return _[_0x2a8b('0x26')](_0xfc8f00,function(_0x2ef713){return _0x2ef713['contact']['email']===_0x339f97;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2a8b('0x1d')](_0x2a8b('0x27'),_0x1d9738[_0x2a8b('0x24')])})['then'](function(_0x2afd03){logger[_0x2a8b('0xe')](_0x2a8b('0x28'));return _0x2afd03;});}});}else{logger[_0x2a8b('0xe')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2a8b('0x1d')](_0x2a8b('0x27'),_0x1d9738['remoteUri'])})['then'](function(_0xd665e7){logger['info'](_0x2a8b('0x28'));return _0xd665e7;});}}function getEndUser(_0x2a8534,_0x2b149c,_0x178547){logger[_0x2a8b('0xe')]('Searching\x20enduser\x20with\x20phone',_0x178547);return request({'uri':util[_0x2a8b('0x1d')]('%s/api/v2/contacts',_0x2a8534[_0x2a8b('0x24')]),'qs':{'phone':_0x178547}})[_0x2a8b('0x20')](function(_0x396cdf){if(_0x396cdf['length']){logger[_0x2a8b('0xe')](_0x2a8b('0x29'));return _[_0x2a8b('0x26')](_0x396cdf,{'phone':_0x178547});}else{logger[_0x2a8b('0xe')](_0x2a8b('0x2a'));return request({'uri':util[_0x2a8b('0x1d')]('%s/api/v2/contacts',_0x2a8534[_0x2a8b('0x24')]),'method':_0x2a8b('0x1f'),'body':{'name':_0x2b149c,'phone':_0x178547}})['then'](function(_0x2c3c00){logger[_0x2a8b('0xe')](_0x2a8b('0x2b'));return _0x2c3c00;});}});}function getAuth(_0x476a03){return util[_0x2a8b('0x1d')](_0x2a8b('0x2c'),new Buffer(_0x476a03[_0x2a8b('0x2d')]+':X')[_0x2a8b('0x2e')](_0x2a8b('0x2f')));}function request(_0x517f4e){logger[_0x2a8b('0x30')](_0x2a8b('0x31'),JSON[_0x2a8b('0x32')](_0x517f4e));return rp(_[_0x2a8b('0x8')](_0x517f4e,{'method':_0x2a8b('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x50f42b,_0x55385d){var _0x3dd207=[];if(_0x50f42b&&_0x50f42b[_0x2a8b('0x34')]>0x0){_0x3dd207=_[_0x2a8b('0x35')](_0x50f42b,_0x55385d);}return _0x3dd207;}function getCustomFields(_0x5a2444,_0x1ff106){var _0x5a8b6d=[];var _0xaa8564={'custom_fields':[]};if(_0x5a2444[_0x2a8b('0x34')]>0x0){_[_0x2a8b('0x36')](_0x5a2444,function(_0x31e197){if(_['includes']([_0x2a8b('0x37'),_0x2a8b('0x38')],_0x31e197['type'])&&_0x31e197[_0x2a8b('0x39')]&&!_0x31e197[_0x2a8b('0x3a')]){_0xaa8564[_0x31e197[_0x2a8b('0x39')]['toLowerCase']()]=_0x31e197[_0x2a8b('0x3b')][_0x2a8b('0x2e')]();}else if(_[_0x2a8b('0x3c')]([_0x2a8b('0x37'),'picklist'],_0x31e197[_0x2a8b('0x3d')])&&_0x31e197['idField']&&_0x31e197[_0x2a8b('0x3a')]){_0xaa8564[_0x2a8b('0x1b')][_0x2a8b('0x3e')]({'id':_0x31e197[_0x2a8b('0x3f')],'value':_0x31e197[_0x2a8b('0x3b')][_0x2a8b('0x2e')]()});}else if(_0x31e197['type']===_0x2a8b('0x40')&&_0x31e197['variableName']&&_0x31e197[_0x2a8b('0x3f')]&&_0x31e197[_0x2a8b('0x3a')]){_0x1ff106[_0x31e197[_0x2a8b('0x41')]]&&_0xaa8564[_0x2a8b('0x1b')][_0x2a8b('0x3e')]({'id':_0x31e197[_0x2a8b('0x3f')],'value':_0x1ff106[_0x31e197[_0x2a8b('0x41')]][_0x2a8b('0x2e')]()});}else if(_0x31e197[_0x2a8b('0x3d')]===_0x2a8b('0x42')&&_0x31e197[_0x2a8b('0x43')]&&_0x31e197[_0x2a8b('0x43')][_0x2a8b('0x17')]&&_0x31e197['idField']&&_0x31e197[_0x2a8b('0x3a')]){_0x1ff106[_0x31e197['Variable']['name'][_0x2a8b('0x44')]()]&&_0xaa8564[_0x2a8b('0x1b')][_0x2a8b('0x3e')]({'id':_0x31e197[_0x2a8b('0x3f')],'value':_0x1ff106[_0x31e197['Variable']['name']['toLowerCase']()][_0x2a8b('0x2e')]()});}});}return _0xaa8564;}exports[_0x2a8b('0x45')]=function(_0x218d36,_0x365f75,_0x1cb5fd,_0x56a9e7,_0x2107af,_0x391c2e){var _0x272c22,_0x100c99;_0x391c2e['remoteUri']=intUtil[_0x2a8b('0x46')](_0x391c2e[_0x2a8b('0x24')]);_0x391c2e[_0x2a8b('0x47')]=intUtil['stripTrailingSlash'](_0x391c2e['serverUrl']);if(_0x2107af&&_0x2107af['monitor_format']){logger[_0x2a8b('0xe')](_0x2a8b('0x48'),_0x2a8b('0x49'));_0x365f75[_0x2a8b('0x4a')]=util[_0x2a8b('0x1d')](_0x2a8b('0x4b'),_0x391c2e['serverUrl'],_0x365f75[_0x2a8b('0x4c')],md5(_0x365f75['uniqueid']));}else{_0x365f75['recordingURL']='';}headers[_0x2a8b('0x4d')]=getAuth(_0x391c2e);return getUser(_0x391c2e,_0x56a9e7[_0x2a8b('0x4e')])[_0x2a8b('0x20')](function(_0x14ef05){_0x272c22=_0x14ef05;logger['info'](_0x2a8b('0x4f'),_0x272c22['id']);return getEndUser(_0x391c2e,_0x365f75[_0x2a8b('0x10')],_0x365f75['calleridnum']);})[_0x2a8b('0x20')](function(_0x4d962c){_0x100c99=_0x4d962c;logger[_0x2a8b('0xe')]('The\x20Enduser\x20ID\x20is:',_0x100c99['id']);return getTicket(_0x391c2e,_0x272c22,_0x100c99,_0x1cb5fd,_0x365f75);})['then'](function(_0x4ec7cb){if(_0x4ec7cb&&_0x4ec7cb['id']){logger[_0x2a8b('0xe')](_0x2a8b('0x21'));logger[_0x2a8b('0xe')](_0x2a8b('0x50'),_0x4ec7cb['id']);logger[_0x2a8b('0xe')](_0x2a8b('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2a8b('0x1d')](_0x2a8b('0x51'),_0x56a9e7[_0x2a8b('0x17')]),_0x2a8b('0x52'),{'uri':util[_0x2a8b('0x1d')](_0x2a8b('0x53'),_0x391c2e[_0x2a8b('0x24')],_0x4ec7cb['id'])});}})['catch'](function(_0x5250bb){logger[_0x2a8b('0x54')](_0x2a8b('0x48'),JSON[_0x2a8b('0x32')](_0x5250bb));});};exports[_0x2a8b('0x55')]=function(_0x501b5e,_0x129fe3,_0x1acdf4,_0x257090,_0x488e8a,_0x4e00eb,_0x36fafc){var _0x35f455,_0x541a0c;_0x4e00eb[_0x2a8b('0x24')]=intUtil[_0x2a8b('0x46')](_0x4e00eb[_0x2a8b('0x24')]);_0x4e00eb[_0x2a8b('0x47')]=intUtil[_0x2a8b('0x46')](_0x4e00eb['serverUrl']);if(_0x36fafc&&_0x36fafc[_0x2a8b('0x56')]&&_0x36fafc[_0x2a8b('0x56')]!==_0x2a8b('0x57')){logger['info']('[OUTBOUND]',_0x2a8b('0x49'));_0x129fe3[_0x2a8b('0x4a')]=util[_0x2a8b('0x1d')](_0x2a8b('0x4b'),_0x4e00eb[_0x2a8b('0x47')],_0x129fe3[_0x2a8b('0x4c')],md5(_0x129fe3['uniqueid']));}headers[_0x2a8b('0x4d')]=getAuth(_0x4e00eb);return getUser(_0x4e00eb,_0x257090[_0x2a8b('0x4e')])['then'](function(_0x46fd68){_0x35f455=_0x46fd68;logger[_0x2a8b('0xe')](_0x2a8b('0x4f'),_0x35f455['id']);return getEndUser(_0x4e00eb,_0x129fe3[_0x2a8b('0x58')],_0x129fe3[_0x2a8b('0x59')]);})[_0x2a8b('0x20')](function(_0x51b3ab){_0x541a0c=_0x51b3ab;logger[_0x2a8b('0xe')]('The\x20Enduser\x20ID\x20is:',_0x541a0c['id']);return getTicket(_0x4e00eb,_0x35f455,_0x541a0c,_0x1acdf4,_0x129fe3);})[_0x2a8b('0x20')](function(_0x2a8dba){if(_0x2a8dba&&_0x2a8dba['id']){logger[_0x2a8b('0xe')]('Ticket\x20created!');logger[_0x2a8b('0xe')](_0x2a8b('0x50'),_0x2a8dba['id']);logger[_0x2a8b('0xe')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2a8b('0x1d')](_0x2a8b('0x51'),_0x257090[_0x2a8b('0x17')]),_0x2a8b('0x52'),{'uri':util[_0x2a8b('0x1d')]('%s/helpdesk/tickets/%d',_0x4e00eb[_0x2a8b('0x24')],_0x2a8dba['id'])});}})[_0x2a8b('0x5a')](function(_0x4785e0){logger['error'](_0x2a8b('0x5b'),JSON[_0x2a8b('0x32')](_0x4785e0));});};exports[_0x2a8b('0x5c')]=function(_0x7f1df5,_0x3e7958,_0x4bdb82,_0x5c8d9c,_0x3fc3fc,_0x51e57c){var _0xa798d8,_0x319560;_0x51e57c['remoteUri']=intUtil[_0x2a8b('0x46')](_0x51e57c[_0x2a8b('0x24')]);_0x51e57c[_0x2a8b('0x47')]=intUtil['stripTrailingSlash'](_0x51e57c[_0x2a8b('0x47')]);if(_0x3fc3fc&&_0x3fc3fc[_0x2a8b('0x5d')]){logger[_0x2a8b('0xe')]('['+_0x3e7958[_0x2a8b('0x5e')][_0x2a8b('0x5f')]()+']',_0x2a8b('0x49'));_0x3e7958[_0x2a8b('0x4a')]=util[_0x2a8b('0x1d')](_0x2a8b('0x4b'),_0x51e57c[_0x2a8b('0x47')],_0x3e7958['uniqueid'],md5(_0x3e7958[_0x2a8b('0x4c')]));}else{_0x3e7958[_0x2a8b('0x4a')]='';}headers[_0x2a8b('0x4d')]=getAuth(_0x51e57c);return getUser(_0x51e57c,'')[_0x2a8b('0x20')](function(_0x287f7e){_0xa798d8=_0x287f7e;logger[_0x2a8b('0xe')]('The\x20User\x20ID\x20is:',_0xa798d8['id']);return getEndUser(_0x51e57c,_0x3e7958['calleridname'],_0x3e7958[_0x2a8b('0x11')]);})[_0x2a8b('0x20')](function(_0x239e02){_0x319560=_0x239e02;logger['info'](_0x2a8b('0x60'),_0x319560['id']);return getTicket(_0x51e57c,_0xa798d8,_0x319560,_0x4bdb82,_0x3e7958);})[_0x2a8b('0x20')](function(_0x5dd337){if(_0x5dd337){logger[_0x2a8b('0xe')](_0x2a8b('0x21'));logger[_0x2a8b('0xe')](_0x2a8b('0x50'),_0x5dd337['id']);}})['catch'](function(_0x235f06){logger[_0x2a8b('0x54')]('['+_0x3e7958[_0x2a8b('0x5e')]['toUpperCase']()+']',JSON[_0x2a8b('0x32')](_0x235f06));});}; \ 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 451c8cb..6040829 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 _0x9348=['apiKey','remoteUri','stripTrailingSlash','serverUrl','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','User\x20found:','userId','Admin\x20selected','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','toUpperCase','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','Token\x20token='];(function(_0x33b627,_0xcd64e0){var _0x531df0=function(_0x46db94){while(--_0x46db94){_0x33b627['push'](_0x33b627['shift']());}};_0x531df0(++_0xcd64e0);}(_0x9348,0xb4));var _0x8934=function(_0xe4bb3f,_0x2c3774){_0xe4bb3f=_0xe4bb3f-0x0;var _0x4eec9b=_0x9348[_0xe4bb3f];return _0x4eec9b;};'use strict';var _=require(_0x8934('0x0'));var rp=require(_0x8934('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0x8934('0x2'));var Promise=require(_0x8934('0x3'));var Redis=require(_0x8934('0x4'));var intUtil=require(_0x8934('0x5'));var config=require('../../../../config/environment');var logger=require(_0x8934('0x6'))(_0x8934('0x7'));config[_0x8934('0x8')]=_[_0x8934('0x9')](config[_0x8934('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x8934('0xa'))(new Redis(config[_0x8934('0x8')]));function getAdminId(_0x147d8c,_0xf581eb,_0x2aaf22,_0x3fc9b5){return new Promise(function(_0x33fac1,_0x114665){var _0x33fba4=![];var _0x6e8b9={'method':_0x8934('0xb'),'uri':_0x3fc9b5+_0x8934('0xc'),'json':!![]};_0x6e8b9['headers']=_0x2aaf22;logger[_0x8934('0xd')](_0x8934('0xe'));return rp(_0x6e8b9)[_0x8934('0xf')](function(_0x441798){if(_0x441798){var _0x1e9aaa=_0x441798[_0x8934('0x10')];var _0x13f55e=null;for(_0x13f55e=0x0;_0x13f55e<_0x1e9aaa['length'];_0x13f55e++){if(_0x1e9aaa[_0x13f55e][_0x8934('0x11')]===_0x147d8c[_0x8934('0x12')]){_0x147d8c[_0x8934('0x13')]=_0x1e9aaa[_0x13f55e]['id'];_0x33fba4=!![];}}if(_0x33fba4){logger[_0x8934('0xd')]('Admin\x20found:',_0x147d8c[_0x8934('0x13')]);_0x33fac1(_0x147d8c);}else{_0x114665({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x114665({'statusCode':0x194,'message':_0x8934('0x14')});}})[_0x8934('0x15')](function(_0x178b47){logger[_0x8934('0x16')]('['+[_0xf581eb['toUpperCase']()]+']',_0x178b47[_0x8934('0x17')]);_0x114665(_0x178b47);});});}function getUser(_0x43330c,_0x4fd6ef,_0x162edb){return function(_0x95a287){return new Promise(function(_0x34518e,_0x5215e6){var _0x173235={'method':_0x8934('0xb'),'uri':_0x162edb+_0x8934('0xc'),'json':!![]};_0x173235['headers']=_0x4fd6ef;logger[_0x8934('0xd')](_0x8934('0x18'));return rp(_0x173235)[_0x8934('0xf')](function(_0x27e1bd){if(_0x27e1bd){var _0x5dda40=_0x27e1bd['users'];var _0x229545=![];var _0x183f32=null;if(_0x95a287[_0x8934('0x19')]!==null){logger[_0x8934('0xd')](_0x8934('0x1a'),_0x95a287[_0x8934('0x19')]);_0x95a287[_0x8934('0x1b')]=_0x95a287['agentEmail'];for(_0x183f32=0x0;_0x183f32<_0x5dda40[_0x8934('0x1c')];_0x183f32++){if(_0x5dda40[_0x183f32][_0x8934('0x11')]===_0x95a287[_0x8934('0x19')]){_0x229545=!![];_0x95a287['userId']=_0x5dda40[_0x183f32]['id'];logger[_0x8934('0xd')](_0x8934('0x1d'),_0x95a287[_0x8934('0x1e')]);}}}if(!_0x229545){logger[_0x8934('0xd')](_0x8934('0x1f'));_0x95a287[_0x8934('0x1b')]=_0x95a287['adminEmail'];_0x95a287[_0x8934('0x1e')]=_0x95a287[_0x8934('0x13')];_0x229545=!![];}if(_0x229545){_0x34518e(_0x95a287);}else{_0x5215e6({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5215e6({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x8934('0x15')](function(_0x4f5af4){logger[_0x8934('0x16')]('['+[_0x43330c['toUpperCase']()]+']',_0x4f5af4[_0x8934('0x17')]);_0x5215e6(_0x4f5af4);});});};}function searchContact(_0x4218b0,_0x449899,_0x31c357,_0x113b48){return new Promise(function(_0x205180,_0x43f8e8){var _0x5a00dc={'method':_0x8934('0xb'),'headers':_0x449899,'uri':_0x4218b0+'/api/lookup?q='+_0x113b48+_0x8934('0x20')+_0x31c357+'&entities=contact','json':!![]};rp(_0x5a00dc)[_0x8934('0xf')](function(_0x34eb35){var _0xba67a5=_[_0x8934('0x21')](_0x34eb35[_0x8934('0x22')][_0x8934('0x22')],[_0x31c357,_0x113b48]);_0x205180(_0xba67a5);})['catch'](function(_0x685717){_0x43f8e8(_0x685717);});});}function getEndUser(_0x1cb740,_0x12bf06,_0x39d350){return function(_0x3e33c3){return new Promise(function(_0xdab650,_0x35c70a){logger['info'](util[_0x8934('0x23')](_0x8934('0x24'),_0x3e33c3['contactNumber']));searchContact(_0x39d350,_0x12bf06,_0x8934('0x25'),_0x3e33c3[_0x8934('0x26')])['then'](function(_0x3bac35){if(_0x3bac35){_0x3e33c3[_0x8934('0x27')]=_0x3bac35['id'];logger[_0x8934('0xd')]('Contact\x20found\x20mobile_number:',_0x3e33c3[_0x8934('0x27')]);return _0xdab650(_0x3e33c3);}searchContact(_0x39d350,_0x12bf06,_0x8934('0x28'),_0x3e33c3[_0x8934('0x26')])[_0x8934('0xf')](function(_0x389ac1){if(_0x389ac1){_0x3e33c3[_0x8934('0x27')]=_0x389ac1['id'];logger[_0x8934('0xd')](_0x8934('0x29'),_0x3e33c3['endUserId']);return _0xdab650(_0x3e33c3);}createEndUser(_0x3e33c3,_0x1cb740,_0x12bf06,_0x39d350)[_0x8934('0xf')](function(_0x25974a){logger['info'](_0x8934('0x2a'),_0x25974a[_0x8934('0x27')]);return _0xdab650(_0x25974a);});});})['catch'](function(_0x3fd6a8){_0x35c70a(_0x3fd6a8);});});};}function createEndUser(_0x4366c0,_0x124f8c,_0x4f4f59,_0x50e9ea){return new Promise(function(_0xd6e913,_0x41ab4a){var _0xbe9029=moment();var _0x2690c9={'method':_0x8934('0x2b'),'uri':_0x50e9ea+_0x8934('0x2c'),'body':{'contact':{'last_name':_0x4366c0[_0x8934('0x26')],'work_number':_0x4366c0[_0x8934('0x26')],'mobile_number':_0x4366c0[_0x8934('0x26')],'owner_id':_0x4366c0['userId'],'created_at':_0xbe9029['format'](_0x8934('0x2d'))}},'json':!![]};_0x2690c9[_0x8934('0x2e')]=_0x4f4f59;logger[_0x8934('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2690c9)[_0x8934('0xf')](function(_0x51364f){_0x4366c0[_0x8934('0x27')]=_0x51364f['contact']['id'];_0xd6e913(_0x4366c0);})[_0x8934('0x15')](function(_0x58426a){logger['error']('['+[_0x124f8c[_0x8934('0x2f')]()]+']',_0x58426a[_0x8934('0x17')]);_0x41ab4a(_0x58426a[_0x8934('0x17')]);});});}function getTicket(_0x8fea03,_0x587d5a,_0x50ece4,_0x45c308,_0x471547){return function(_0x231e1f){logger['info'](_0x8934('0x30'));return new Promise(function(_0x1ecb3a,_0xcc0e1b){var _0x488cf2=moment();var _0x11f636={'method':_0x8934('0x2b'),'uri':_0x50ece4+_0x8934('0x31'),'body':{'title':intUtil['getString'](_0x45c308[_0x8934('0x32')],_0x471547,'\x20'),'description':intUtil[_0x8934('0x33')](_0x45c308[_0x8934('0x34')],_0x471547,'\x0a'),'owner_id':_0x231e1f['userId'],'creater_id':_0x231e1f[_0x8934('0x13')],'targetable_id':_0x231e1f[_0x8934('0x27')],'targetable_type':'Contact','created_at':_0x488cf2[_0x8934('0x23')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x488cf2[_0x8934('0x35')](0x1e,'m')[_0x8934('0x23')](_0x8934('0x2d'))},'json':!![]};_0x11f636[_0x8934('0x2e')]=_0x587d5a;return rp(_0x11f636)['then'](function(_0x27eeef){_0x231e1f[_0x8934('0x36')]=_0x27eeef['task']['id'];logger[_0x8934('0xd')](_0x8934('0x37'),_0x231e1f[_0x8934('0x36')]);_0x1ecb3a(_0x231e1f);})[_0x8934('0x15')](function(_0x4ae16b){logger[_0x8934('0x16')]('['+[_0x8fea03['toUpperCase']()]+']',_0x4ae16b[_0x8934('0x17')]);_0xcc0e1b(_0x4ae16b[_0x8934('0x17')]);});});};}function emit(_0x3c6b9d,_0x480533,_0x1a49f4){var _0x2ca4cc={'uri':_0x3c6b9d+_0x8934('0x38')+_0x1a49f4};io['to'](util['format'](_0x8934('0x39'),_0x480533))[_0x8934('0x3a')]('trigger:browser:url',_0x2ca4cc);}exports['cs']=function(_0x1a3a01,_0x51fc56,_0x45faea,_0x2967ba,_0x46d130,_0x2d937f,_0x105f62,_0x15279f){var _0x3b2cf2={};var _0x28f530={'Authorization':_0x8934('0x3b')+_0x2d937f[_0x8934('0x3c')]};_0x2d937f[_0x8934('0x3d')]=intUtil[_0x8934('0x3e')](_0x2d937f[_0x8934('0x3d')]);_0x2d937f[_0x8934('0x3f')]=intUtil['stripTrailingSlash'](_0x2d937f[_0x8934('0x3f')]);var _0x4e484e=_0x2d937f['remoteUri'];_0x3b2cf2[_0x8934('0x12')]=_0x2d937f['username'];_0x3b2cf2[_0x8934('0x26')]=_0x15279f['toLowerCase']()==='outbound'?_0x51fc56[_0x8934('0x40')]:_0x51fc56[_0x8934('0x41')];_0x3b2cf2[_0x8934('0x42')]=_0x15279f===_0x8934('0x43')||_0x15279f===_0x8934('0x44')?_0x8934('0x43'):'outbound';if(_0x2967ba){_0x3b2cf2[_0x8934('0x19')]=_0x2967ba['email'];}var _0x51ee04=util[_0x8934('0x23')](_0x8934('0x45'),_0x2d937f[_0x8934('0x3f')],_0x51fc56[_0x8934('0x46')],md5(_0x51fc56[_0x8934('0x46')]));if(_0x46d130&&_0x46d130[_0x8934('0x47')]){logger['info']('[QUEUE]',_0x8934('0x48'));_0x51fc56[_0x8934('0x49')]=_0x51ee04;}else if(_0x105f62&&_0x105f62[_0x8934('0x4a')]&&_0x105f62['recordingFormat']!=='none'){logger[_0x8934('0xd')](_0x8934('0x4b'),'Recording\x20is\x20enabled!');_0x51fc56[_0x8934('0x49')]=_0x51ee04;}else{_0x51fc56['recordingURL']='';}return getAdminId(_0x3b2cf2,_0x15279f,_0x28f530,_0x4e484e)[_0x8934('0xf')](getUser(_0x15279f,_0x28f530,_0x4e484e))[_0x8934('0xf')](getEndUser(_0x15279f,_0x28f530,_0x4e484e))[_0x8934('0xf')](getTicket(_0x15279f,_0x28f530,_0x4e484e,_0x45faea,_0x51fc56))['then'](function(_0x3f27de){logger[_0x8934('0xd')](util['format'](_0x8934('0x4c'),_0x3f27de[_0x8934('0x36')]));if(_0x15279f!=='unmanaged'){logger[_0x8934('0xd')]('['+[_0x15279f[_0x8934('0x2f')]()]+']',_0x8934('0x4d'));emit(_0x4e484e,_0x2967ba[_0x8934('0x4e')],_0x3f27de[_0x8934('0x27')]);}})[_0x8934('0x15')](function(_0x1570b5){logger[_0x8934('0x16')]('['+[_0x15279f[_0x8934('0x2f')]()]+_0x8934('0x4f'),util['inspect'](_0x1570b5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x56c4=['users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','message','Getting\x20user\x20list','agentEmail','userEmail','userId','toUpperCase','&f=','&entities=contact','contacts','catch','format','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','moment','ioredis','./util','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then'];(function(_0x3ab6bf,_0x38e5c0){var _0x1c3c30=function(_0x3fc57b){while(--_0x3fc57b){_0x3ab6bf['push'](_0x3ab6bf['shift']());}};_0x1c3c30(++_0x38e5c0);}(_0x56c4,0x1e8));var _0x456c=function(_0x2ff127,_0x3d6e2b){_0x2ff127=_0x2ff127-0x0;var _0x53af48=_0x56c4[_0x2ff127];return _0x53af48;};'use strict';var _=require(_0x456c('0x0'));var rp=require(_0x456c('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0x456c('0x2'));var Promise=require('bluebird');var Redis=require(_0x456c('0x3'));var intUtil=require(_0x456c('0x4'));var config=require('../../../../config/environment');var logger=require(_0x456c('0x5'))(_0x456c('0x6'));config[_0x456c('0x7')]=_['defaults'](config['redis'],{'host':_0x456c('0x8'),'port':0x18eb});var io=require(_0x456c('0x9'))(new Redis(config[_0x456c('0x7')]));function getAdminId(_0xd36d10,_0xc0fbde,_0x2db9c7,_0x50f21c){return new Promise(function(_0x5f085a,_0x18c117){var _0x5acf38=![];var _0x2e4f6f={'method':_0x456c('0xa'),'uri':_0x50f21c+_0x456c('0xb'),'json':!![]};_0x2e4f6f[_0x456c('0xc')]=_0x2db9c7;logger[_0x456c('0xd')](_0x456c('0xe'));return rp(_0x2e4f6f)[_0x456c('0xf')](function(_0x9b4b06){if(_0x9b4b06){var _0x2a1f39=_0x9b4b06[_0x456c('0x10')];var _0x5e4f66=null;for(_0x5e4f66=0x0;_0x5e4f66<_0x2a1f39[_0x456c('0x11')];_0x5e4f66++){if(_0x2a1f39[_0x5e4f66][_0x456c('0x12')]===_0xd36d10[_0x456c('0x13')]){_0xd36d10[_0x456c('0x14')]=_0x2a1f39[_0x5e4f66]['id'];_0x5acf38=!![];}}if(_0x5acf38){logger['info'](_0x456c('0x15'),_0xd36d10[_0x456c('0x14')]);_0x5f085a(_0xd36d10);}else{_0x18c117({'statusCode':0x194,'message':_0x456c('0x16')});}}else{_0x18c117({'statusCode':0x194,'message':_0x456c('0x16')});}})['catch'](function(_0xb2741c){logger[_0x456c('0x17')]('['+[_0xc0fbde['toUpperCase']()]+']',_0xb2741c[_0x456c('0x18')]);_0x18c117(_0xb2741c);});});}function getUser(_0x3c7eee,_0x349c6d,_0xcd6551){return function(_0x52ad82){return new Promise(function(_0x5eea6d,_0x23b952){var _0x38bc45={'method':'GET','uri':_0xcd6551+'/api/selector/owners','json':!![]};_0x38bc45[_0x456c('0xc')]=_0x349c6d;logger[_0x456c('0xd')](_0x456c('0x19'));return rp(_0x38bc45)['then'](function(_0x29b95f){if(_0x29b95f){var _0x46febd=_0x29b95f[_0x456c('0x10')];var _0xad8ab3=![];var _0x354d08=null;if(_0x52ad82[_0x456c('0x1a')]!==null){logger[_0x456c('0xd')]('Getting\x20user\x20with\x20email',_0x52ad82[_0x456c('0x1a')]);_0x52ad82[_0x456c('0x1b')]=_0x52ad82[_0x456c('0x1a')];for(_0x354d08=0x0;_0x354d08<_0x46febd[_0x456c('0x11')];_0x354d08++){if(_0x46febd[_0x354d08][_0x456c('0x12')]===_0x52ad82[_0x456c('0x1a')]){_0xad8ab3=!![];_0x52ad82[_0x456c('0x1c')]=_0x46febd[_0x354d08]['id'];logger[_0x456c('0xd')]('User\x20found:',_0x52ad82[_0x456c('0x1c')]);}}}if(!_0xad8ab3){logger['info']('Admin\x20selected');_0x52ad82['userEmail']=_0x52ad82[_0x456c('0x13')];_0x52ad82[_0x456c('0x1c')]=_0x52ad82[_0x456c('0x14')];_0xad8ab3=!![];}if(_0xad8ab3){_0x5eea6d(_0x52ad82);}else{_0x23b952({'statusCode':0x194,'message':_0x456c('0x16')});}}else{_0x23b952({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x4811d5){logger[_0x456c('0x17')]('['+[_0x3c7eee[_0x456c('0x1d')]()]+']',_0x4811d5[_0x456c('0x18')]);_0x23b952(_0x4811d5);});});};}function searchContact(_0xc5cdd,_0x2d142d,_0x433052,_0x3fc56b){return new Promise(function(_0x1fab19,_0x28396c){var _0x44898c={'method':'GET','headers':_0x2d142d,'uri':_0xc5cdd+'/api/lookup?q='+_0x3fc56b+_0x456c('0x1e')+_0x433052+_0x456c('0x1f'),'json':!![]};rp(_0x44898c)[_0x456c('0xf')](function(_0x1fd5ba){var _0x5b99c2=_['find'](_0x1fd5ba[_0x456c('0x20')][_0x456c('0x20')],[_0x433052,_0x3fc56b]);_0x1fab19(_0x5b99c2);})[_0x456c('0x21')](function(_0x326d56){_0x28396c(_0x326d56);});});}function getEndUser(_0xfd785d,_0x26efb6,_0x34369c){return function(_0x112ca8){return new Promise(function(_0x208a9e,_0x1409af){logger[_0x456c('0xd')](util[_0x456c('0x22')]('Searching\x20contact\x20with\x20phone\x20%s',_0x112ca8['contactNumber']));searchContact(_0x34369c,_0x26efb6,_0x456c('0x23'),_0x112ca8[_0x456c('0x24')])[_0x456c('0xf')](function(_0x20bae4){if(_0x20bae4){_0x112ca8[_0x456c('0x25')]=_0x20bae4['id'];logger[_0x456c('0xd')](_0x456c('0x26'),_0x112ca8['endUserId']);return _0x208a9e(_0x112ca8);}searchContact(_0x34369c,_0x26efb6,_0x456c('0x27'),_0x112ca8[_0x456c('0x24')])[_0x456c('0xf')](function(_0x545d99){if(_0x545d99){_0x112ca8[_0x456c('0x25')]=_0x545d99['id'];logger[_0x456c('0xd')](_0x456c('0x28'),_0x112ca8[_0x456c('0x25')]);return _0x208a9e(_0x112ca8);}createEndUser(_0x112ca8,_0xfd785d,_0x26efb6,_0x34369c)[_0x456c('0xf')](function(_0x11120a){logger[_0x456c('0xd')](_0x456c('0x29'),_0x11120a[_0x456c('0x25')]);return _0x208a9e(_0x11120a);});});})[_0x456c('0x21')](function(_0x569bcb){_0x1409af(_0x569bcb);});});};}function createEndUser(_0x3bcd4c,_0x2f97a6,_0x219716,_0x39629c){return new Promise(function(_0x205b3e,_0x19f49c){var _0x41a3ea=moment();var _0x28664a={'method':_0x456c('0x2a'),'uri':_0x39629c+_0x456c('0x2b'),'body':{'contact':{'last_name':_0x3bcd4c['contactNumber'],'work_number':_0x3bcd4c['contactNumber'],'mobile_number':_0x3bcd4c[_0x456c('0x24')],'owner_id':_0x3bcd4c[_0x456c('0x1c')],'created_at':_0x41a3ea[_0x456c('0x22')](_0x456c('0x2c'))}},'json':!![]};_0x28664a[_0x456c('0xc')]=_0x219716;logger[_0x456c('0xd')](_0x456c('0x2d'));return rp(_0x28664a)[_0x456c('0xf')](function(_0x23ca67){_0x3bcd4c[_0x456c('0x25')]=_0x23ca67[_0x456c('0x2e')]['id'];_0x205b3e(_0x3bcd4c);})[_0x456c('0x21')](function(_0x220af7){logger[_0x456c('0x17')]('['+[_0x2f97a6[_0x456c('0x1d')]()]+']',_0x220af7[_0x456c('0x18')]);_0x19f49c(_0x220af7[_0x456c('0x18')]);});});}function getTicket(_0x1d53e2,_0x1da111,_0x53a973,_0x147dd2,_0x48dcc5){return function(_0x1892bf){logger[_0x456c('0xd')](_0x456c('0x2f'));return new Promise(function(_0x47b2b4,_0x176293){var _0x553851=moment();var _0x2bb249={'method':_0x456c('0x2a'),'uri':_0x53a973+_0x456c('0x30'),'body':{'title':intUtil['getString'](_0x147dd2[_0x456c('0x31')],_0x48dcc5,'\x20'),'description':intUtil[_0x456c('0x32')](_0x147dd2[_0x456c('0x33')],_0x48dcc5,'\x0a'),'owner_id':_0x1892bf[_0x456c('0x1c')],'creater_id':_0x1892bf[_0x456c('0x14')],'targetable_id':_0x1892bf['endUserId'],'targetable_type':_0x456c('0x34'),'created_at':_0x553851[_0x456c('0x22')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x553851['add'](0x1e,'m')['format'](_0x456c('0x2c'))},'json':!![]};_0x2bb249[_0x456c('0xc')]=_0x1da111;return rp(_0x2bb249)[_0x456c('0xf')](function(_0x5a1e32){_0x1892bf[_0x456c('0x35')]=_0x5a1e32[_0x456c('0x36')]['id'];logger['info'](_0x456c('0x37'),_0x1892bf['ticketId']);_0x47b2b4(_0x1892bf);})[_0x456c('0x21')](function(_0x45fd1c){logger['error']('['+[_0x1d53e2[_0x456c('0x1d')]()]+']',_0x45fd1c[_0x456c('0x18')]);_0x176293(_0x45fd1c[_0x456c('0x18')]);});});};}function emit(_0x4fb94e,_0x1a34e9,_0x35db66){var _0x54af02={'uri':_0x4fb94e+_0x456c('0x38')+_0x35db66};io['to'](util[_0x456c('0x22')](_0x456c('0x39'),_0x1a34e9))[_0x456c('0x3a')](_0x456c('0x3b'),_0x54af02);}exports['cs']=function(_0x5d9285,_0x4c0f74,_0x425ee5,_0x11a26c,_0x4d1483,_0x363fdf,_0x47661e,_0x4fb2c3){var _0x3eb5cf={};var _0x321d37={'Authorization':_0x456c('0x3c')+_0x363fdf[_0x456c('0x3d')]};_0x363fdf[_0x456c('0x3e')]=intUtil[_0x456c('0x3f')](_0x363fdf[_0x456c('0x3e')]);_0x363fdf['serverUrl']=intUtil['stripTrailingSlash'](_0x363fdf[_0x456c('0x40')]);var _0xfc4283=_0x363fdf[_0x456c('0x3e')];_0x3eb5cf[_0x456c('0x13')]=_0x363fdf[_0x456c('0x41')];_0x3eb5cf[_0x456c('0x24')]=_0x4fb2c3[_0x456c('0x42')]()==='outbound'?_0x4c0f74[_0x456c('0x43')]:_0x4c0f74[_0x456c('0x44')];_0x3eb5cf['callDirection']=_0x4fb2c3===_0x456c('0x45')||_0x4fb2c3===_0x456c('0x46')?'queue':_0x456c('0x47');if(_0x11a26c){_0x3eb5cf[_0x456c('0x1a')]=_0x11a26c['email'];}var _0x1860f0=util[_0x456c('0x22')](_0x456c('0x48'),_0x363fdf[_0x456c('0x40')],_0x4c0f74[_0x456c('0x49')],md5(_0x4c0f74[_0x456c('0x49')]));if(_0x4d1483&&_0x4d1483['monitor_format']){logger[_0x456c('0xd')](_0x456c('0x4a'),_0x456c('0x4b'));_0x4c0f74[_0x456c('0x4c')]=_0x1860f0;}else if(_0x47661e&&_0x47661e['recordingFormat']&&_0x47661e[_0x456c('0x4d')]!==_0x456c('0x4e')){logger[_0x456c('0xd')](_0x456c('0x4f'),_0x456c('0x4b'));_0x4c0f74['recordingURL']=_0x1860f0;}else{_0x4c0f74[_0x456c('0x4c')]='';}return getAdminId(_0x3eb5cf,_0x4fb2c3,_0x321d37,_0xfc4283)[_0x456c('0xf')](getUser(_0x4fb2c3,_0x321d37,_0xfc4283))[_0x456c('0xf')](getEndUser(_0x4fb2c3,_0x321d37,_0xfc4283))[_0x456c('0xf')](getTicket(_0x4fb2c3,_0x321d37,_0xfc4283,_0x425ee5,_0x4c0f74))[_0x456c('0xf')](function(_0x22197e){logger[_0x456c('0xd')](util[_0x456c('0x22')](_0x456c('0x50'),_0x22197e['ticketId']));if(_0x4fb2c3!==_0x456c('0x46')){logger[_0x456c('0xd')]('['+[_0x4fb2c3['toUpperCase']()]+']',_0x456c('0x51'));emit(_0xfc4283,_0x11a26c['name'],_0x22197e['endUserId']);}})[_0x456c('0x21')](function(_0x40f331){logger[_0x456c('0x17')]('['+[_0x4fb2c3['toUpperCase']()]+_0x456c('0x52'),util[_0x456c('0x53')](_0x40f331,{'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 9461025..ef4faf0 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 _0xb261=['toLowerCase','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','salesforce','desk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','data1'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xb261,0x85));var _0x1b26=function(_0x225737,_0x28110b){_0x225737=_0x225737-0x0;var _0x4c5156=_0xb261[_0x225737];return _0x4c5156;};'use strict';var _=require(_0x1b26('0x0'));var util=require(_0x1b26('0x1'));var zendesk=require(_0x1b26('0x2'));var salesforce=require(_0x1b26('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x1b26('0x4'));var desk=require(_0x1b26('0x5'));var vtiger=require(_0x1b26('0x6'));var servicenow=require(_0x1b26('0x7'));var dynamics365=require(_0x1b26('0x8'));var freshsales=require(_0x1b26('0x9'));var integrations=['zendesk','salesforce',_0x1b26('0xa'),_0x1b26('0xb'),_0x1b26('0xc'),'desk',_0x1b26('0xd'),_0x1b26('0xe'),_0x1b26('0xf'),_0x1b26('0x10')];exports[_0x1b26('0x11')]=function(_0x300166,_0xcd0f87,_0x43cbba,_0x3b1d9f,_0x480ffe,_0x3e1234){if(_0x43cbba){if(_['includes'](integrations,_0x300166[_0x1b26('0x12')][_0x1b26('0x13')]())){try{var _0x54af38=null;var _0x465c4e='';var _0x3bbf23=_0x43cbba[_0x300166['data1']['toLowerCase']()];if(_0x3bbf23){var _0x131ca3=_0x3bbf23[_0x300166['data2']];if(_0x131ca3){var _0x3cc412=_[_0x1b26('0x14')](_0x131ca3[_0x1b26('0x15')],{'id':parseInt(_0x300166[_0x1b26('0x16')],0xa)});if(_0x3cc412){if(_0x3b1d9f){if(_0x480ffe&&_0xcd0f87[_0x1b26('0x17')]){_0x465c4e=_0x1b26('0x17');}else if(_0xcd0f87['routeId']){_0x465c4e=_0x1b26('0x18');}else{console[_0x1b26('0x19')](_0x1b26('0x1a'),_0xcd0f87);}}else{_0x465c4e=_0x1b26('0x1b');}switch(_0x300166[_0x1b26('0x12')][_0x1b26('0x13')]()){case _0x1b26('0x1c'):zendesk[_0x465c4e](_0x300166,_0xcd0f87,_0x3cc412,_0x3b1d9f,_0x480ffe,_0x131ca3,_0x3e1234);break;case _0x1b26('0x1d'):salesforce[_0x465c4e](_0x300166,_0xcd0f87,_0x3cc412,_0x3b1d9f,_0x480ffe,_0x131ca3,_0x3e1234);break;case'sugarcrm':sugarcrm[_0x465c4e](_0x300166,_0xcd0f87,_0x3cc412,_0x3b1d9f,_0x480ffe,_0x131ca3,_0x3e1234);break;case _0x1b26('0xb'):freshdesk[_0x465c4e](_0x300166,_0xcd0f87,_0x3cc412,_0x3b1d9f,_0x480ffe,_0x131ca3,_0x3e1234);break;case'zoho':zoho[_0x465c4e](_0x300166,_0xcd0f87,_0x3cc412,_0x3b1d9f,_0x480ffe,_0x131ca3,_0x3e1234);break;case _0x1b26('0x1e'):desk[_0x465c4e](_0x300166,_0xcd0f87,_0x3cc412,_0x3b1d9f,_0x480ffe,_0x131ca3,_0x3e1234);break;case _0x1b26('0xd'):vtiger[_0x465c4e](_0x300166,_0xcd0f87,_0x3cc412,_0x3b1d9f,_0x480ffe,_0x131ca3,_0x3e1234);break;case _0x1b26('0xf'):freshsales['cs'](_0x300166,_0xcd0f87,_0x3cc412,_0x3b1d9f,_0x480ffe,_0x131ca3,_0x3e1234,_0x465c4e);break;case _0x1b26('0x10'):servicenow['cs'](_0x300166,_0xcd0f87,_0x3cc412,_0x3b1d9f,_0x480ffe,_0x131ca3,_0x3e1234,_0x465c4e);break;case _0x1b26('0xe'):dynamics365['cs'](_0x300166,_0xcd0f87,_0x3cc412,_0x3b1d9f,_0x480ffe,_0x131ca3,_0x3e1234,_0x465c4e);break;default:console['log'](_0x1b26('0x1f'));}}else{_0x54af38=require(_0x1b26('0x20'))(_0x300166[_0x1b26('0x12')][_0x1b26('0x13')]());_0x54af38[_0x1b26('0x21')](_0x1b26('0x22'),util[_0x1b26('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x300166[_0x1b26('0x12')][_0x1b26('0x13')](),_0x300166['data3']));}}else{_0x54af38=require(_0x1b26('0x20'))(_0x300166['data1']['toLowerCase']());_0x54af38[_0x1b26('0x21')](_0x1b26('0x22'),util[_0x1b26('0x23')](_0x1b26('0x24'),_0x300166[_0x1b26('0x12')][_0x1b26('0x13')](),_0x300166[_0x1b26('0x25')]));}}else{}}catch(_0x3aa548){console[_0x1b26('0x21')](_0x3aa548);}}}}; \ No newline at end of file +var _0x0677=['error','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','unmanaged','desk','freshsales','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found'];(function(_0x166dc0,_0x97de1f){var _0xd51d12=function(_0x502f41){while(--_0x502f41){_0x166dc0['push'](_0x166dc0['shift']());}};_0xd51d12(++_0x97de1f);}(_0x0677,0xc5));var _0x7067=function(_0x5e2152,_0x172f3d){_0x5e2152=_0x5e2152-0x0;var _0x5ddcf6=_0x0677[_0x5e2152];return _0x5ddcf6;};'use strict';var _=require('lodash');var util=require(_0x7067('0x0'));var zendesk=require(_0x7067('0x1'));var salesforce=require(_0x7067('0x2'));var sugarcrm=require(_0x7067('0x3'));var freshdesk=require(_0x7067('0x4'));var zoho=require(_0x7067('0x5'));var desk=require(_0x7067('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x7067('0x7'));var dynamics365=require(_0x7067('0x8'));var freshsales=require(_0x7067('0x9'));var integrations=[_0x7067('0xa'),_0x7067('0xb'),_0x7067('0xc'),_0x7067('0xd'),_0x7067('0xe'),'desk',_0x7067('0xf'),_0x7067('0x10'),'freshsales',_0x7067('0x11')];exports[_0x7067('0x12')]=function(_0x3d4b9c,_0x380b58,_0xb7fdbc,_0x444343,_0x58c5ba,_0x5781ad){if(_0xb7fdbc){if(_[_0x7067('0x13')](integrations,_0x3d4b9c[_0x7067('0x14')][_0x7067('0x15')]())){try{var _0x3efdff=null;var _0x43366c='';var _0x802183=_0xb7fdbc[_0x3d4b9c[_0x7067('0x14')][_0x7067('0x15')]()];if(_0x802183){var _0x261ead=_0x802183[_0x3d4b9c['data2']];if(_0x261ead){var _0x48c3e6=_[_0x7067('0x16')](_0x261ead[_0x7067('0x17')],{'id':parseInt(_0x3d4b9c[_0x7067('0x18')],0xa)});if(_0x48c3e6){if(_0x444343){if(_0x58c5ba&&_0x380b58[_0x7067('0x19')]){_0x43366c=_0x7067('0x19');}else if(_0x380b58[_0x7067('0x1a')]){_0x43366c=_0x7067('0x1b');}else{console[_0x7067('0x1c')]('EVENT\x20UNKNOWN',_0x380b58);}}else{_0x43366c=_0x7067('0x1d');}switch(_0x3d4b9c[_0x7067('0x14')]['toLowerCase']()){case _0x7067('0xa'):zendesk[_0x43366c](_0x3d4b9c,_0x380b58,_0x48c3e6,_0x444343,_0x58c5ba,_0x261ead,_0x5781ad);break;case _0x7067('0xb'):salesforce[_0x43366c](_0x3d4b9c,_0x380b58,_0x48c3e6,_0x444343,_0x58c5ba,_0x261ead,_0x5781ad);break;case'sugarcrm':sugarcrm[_0x43366c](_0x3d4b9c,_0x380b58,_0x48c3e6,_0x444343,_0x58c5ba,_0x261ead,_0x5781ad);break;case _0x7067('0xd'):freshdesk[_0x43366c](_0x3d4b9c,_0x380b58,_0x48c3e6,_0x444343,_0x58c5ba,_0x261ead,_0x5781ad);break;case _0x7067('0xe'):zoho[_0x43366c](_0x3d4b9c,_0x380b58,_0x48c3e6,_0x444343,_0x58c5ba,_0x261ead,_0x5781ad);break;case _0x7067('0x1e'):desk[_0x43366c](_0x3d4b9c,_0x380b58,_0x48c3e6,_0x444343,_0x58c5ba,_0x261ead,_0x5781ad);break;case'vtiger':vtiger[_0x43366c](_0x3d4b9c,_0x380b58,_0x48c3e6,_0x444343,_0x58c5ba,_0x261ead,_0x5781ad);break;case _0x7067('0x1f'):freshsales['cs'](_0x3d4b9c,_0x380b58,_0x48c3e6,_0x444343,_0x58c5ba,_0x261ead,_0x5781ad,_0x43366c);break;case _0x7067('0x11'):servicenow['cs'](_0x3d4b9c,_0x380b58,_0x48c3e6,_0x444343,_0x58c5ba,_0x261ead,_0x5781ad,_0x43366c);break;case _0x7067('0x10'):dynamics365['cs'](_0x3d4b9c,_0x380b58,_0x48c3e6,_0x444343,_0x58c5ba,_0x261ead,_0x5781ad,_0x43366c);break;default:console[_0x7067('0x1c')](_0x7067('0x20'));}}else{_0x3efdff=require(_0x7067('0x21'))(_0x3d4b9c[_0x7067('0x14')][_0x7067('0x15')]());_0x3efdff['error'](_0x7067('0x22'),util[_0x7067('0x23')](_0x7067('0x24'),_0x3d4b9c[_0x7067('0x14')][_0x7067('0x15')](),_0x3d4b9c['data3']));}}else{_0x3efdff=require(_0x7067('0x21'))(_0x3d4b9c[_0x7067('0x14')][_0x7067('0x15')]());_0x3efdff[_0x7067('0x25')](_0x7067('0x22'),util[_0x7067('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x3d4b9c[_0x7067('0x14')]['toLowerCase'](),_0x3d4b9c[_0x7067('0x26')]));}}else{}}catch(_0x5be6b0){console[_0x7067('0x25')](_0x5be6b0);}}}}; \ 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 39589f3..01f2b73 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 _0xeb6a=['destcalleridnum','integrationTab','user:%s','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','../../../../config/logger','salesforce','redis','defaults','localhost','emit','getString','Subjects','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','contact','WhoId','account','WhatId','Case','ContactId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','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','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','Lead','additionalSearchAccount','Contact','Account','first','Phone','attributes','type','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','No\x20Company','create','forEach','idField','content','toString','variableName','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','Connection\x20established.','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xeb6a,0x185));var _0xaeb6=function(_0x60146f,_0x5cd85c){_0x60146f=_0x60146f-0x0;var _0x147552=_0xeb6a[_0x60146f];return _0x147552;};'use strict';var _=require(_0xaeb6('0x0'));var rp=require(_0xaeb6('0x1'));var moment=require(_0xaeb6('0x2'));var BPromise=require(_0xaeb6('0x3'));var md5=require('md5');var jsforce=require(_0xaeb6('0x4'));var util=require(_0xaeb6('0x5'));var Redis=require(_0xaeb6('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xaeb6('0x7'))(_0xaeb6('0x8'));config[_0xaeb6('0x9')]=_[_0xaeb6('0xa')](config[_0xaeb6('0x9')],{'host':_0xaeb6('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaeb6('0x9')]));function emit(_0x45b19e,_0x3a735c,_0x4745ad){io['to'](_0x45b19e)[_0xaeb6('0xc')](_0x3a735c,_0x4745ad);}function getTicket(_0x2334d2,_0x48d140,_0x220955,_0x23f5a9,_0x3d581b,_0x4cb1cb,_0x2be865,_0x15adfa){var _0x3c26a3=Object['assign']({},{'OwnerId':_0x48d140['id'],'Subject':intUtil[_0xaeb6('0xd')](_0x23f5a9[_0xaeb6('0xe')],_0x3d581b,'\x20'),'Description':intUtil[_0xaeb6('0xd')](_0x23f5a9['Descriptions'],_0x3d581b,'\x0a')},getCustomFields(_0x4cb1cb,_0x3d581b));if(_0x220955){if(_0x23f5a9[_0xaeb6('0xf')]===_0xaeb6('0x10')){_0x3c26a3[_0xaeb6('0x11')]=moment[_0xaeb6('0x12')]();_0x3c26a3[_0xaeb6('0x13')]=![];_0x3c26a3['IsRecurrence']=![];if(_0x220955[_0xaeb6('0x14')]===_0xaeb6('0x15')||_0x220955['endUserType']==='lead'){_0x3c26a3[_0xaeb6('0x16')]=_0x220955['id'];}else if(_0x220955['endUserType']===_0xaeb6('0x17')){_0x3c26a3[_0xaeb6('0x18')]=_0x220955['id'];}}else if(_0x23f5a9[_0xaeb6('0xf')]===_0xaeb6('0x19')){if(_0x220955[_0xaeb6('0x14')]===_0xaeb6('0x15')){_0x3c26a3[_0xaeb6('0x1a')]=_0x220955['id'];}else if(_0x220955[_0xaeb6('0x14')]===_0xaeb6('0x17')){_0x3c26a3['AccountId']=_0x220955['id'];}else if(_0x220955[_0xaeb6('0x14')]===_0xaeb6('0x1b')&&_0x23f5a9['leadId']){_0x3c26a3[_0x23f5a9[_0xaeb6('0x1c')]]=_0x220955['id'];}else{logger[_0xaeb6('0x1d')](_0xaeb6('0x1e'));}}}return _0x2be865[_0xaeb6('0x1f')](_0x23f5a9[_0xaeb6('0xf')])['create'](_0x3c26a3);}function getUser(_0x10ce86,_0x569338,_0x36c0c4){if(!_[_0xaeb6('0x20')](_0x569338)&&intUtil[_0xaeb6('0x21')](_0x569338)){var _0x15f522={'Email':_0x569338};var _0x3ae0f4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x36c0c4['sobject'](_0xaeb6('0x22'))[_0xaeb6('0x23')](_0x15f522,_0x3ae0f4)[_0xaeb6('0x24')]()[_0xaeb6('0x25')](function(_0x4accfd){if(_0x4accfd[_0xaeb6('0x26')]){var _0x187011=_['find'](_0x4accfd,function(_0x1ee0f5){return _0x1ee0f5[_0xaeb6('0x27')]===_0x569338;});if(_0x187011){logger[_0xaeb6('0x1d')](_0xaeb6('0x28'),_0x569338);return BPromise[_0xaeb6('0x29')]({'id':_0x187011['Id'],'name':_0x187011[_0xaeb6('0x2a')]});}}else{logger['info'](_0xaeb6('0x2b'),_0x569338);return _0x36c0c4[_0xaeb6('0x2c')]()[_0xaeb6('0x25')](function(_0xb5501f){return BPromise[_0xaeb6('0x29')]({'id':_0xb5501f[_0xaeb6('0x2d')],'name':_0xb5501f[_0xaeb6('0x2e')]});});}});}else{logger['info'](_0xaeb6('0x2b'),_0x569338);return _0x36c0c4[_0xaeb6('0x2c')]()[_0xaeb6('0x25')](function(_0x4d7542){return BPromise[_0xaeb6('0x29')]({'id':_0x4d7542['user_id'],'name':_0x4d7542['display_name']});});}}function getEndUser(_0x4dee93,_0x4f73ae,_0xfad076,_0x3b11cf,_0x5ac200){var _0x1205d0={'$or':{'Phone':_0x3b11cf}};var _0x520237={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xaeb6('0x25')](function(){logger[_0xaeb6('0x1d')](_0xaeb6('0x2f'),_0x3b11cf,_0x4f73ae['moduleSearch']);switch(_0x4f73ae[_0xaeb6('0x30')]){case _0xaeb6('0x31'):var _0x41e10b=_[_0xaeb6('0x32')](_0x1205d0);if(_0x4f73ae[_0xaeb6('0x33')]){var _0x5caa19={};_0x5caa19[_0x4f73ae[_0xaeb6('0x33')]]=_0x3b11cf;_[_0xaeb6('0x34')](_0x41e10b[_0xaeb6('0x35')],_0x5caa19);}return _0x5ac200['sobject']('Contact')[_0xaeb6('0x23')](_0x41e10b,_0x520237)[_0xaeb6('0x24')]()['then'](function(_0xbb8afa){if(_0xbb8afa&&_0xbb8afa[_0xaeb6('0x26')]){return _0xbb8afa;}else{var _0x50a573=_[_0xaeb6('0x32')](_0x1205d0);if(_0x4f73ae[_0xaeb6('0x36')]){var _0x95333f={};_0x95333f[_0x4f73ae['additionalSearchLead']]=_0x3b11cf;_['merge'](_0x50a573['$or'],_0x95333f);}return _0x5ac200['sobject'](_0xaeb6('0x37'))[_0xaeb6('0x23')](_0x50a573,_0x520237);}});case'account_contact_lead':var _0x45fd0f=_[_0xaeb6('0x32')](_0x1205d0);if(_0x4f73ae[_0xaeb6('0x38')]){var _0x5caa19={};_0x5caa19[_0x4f73ae[_0xaeb6('0x38')]]=_0x3b11cf;_[_0xaeb6('0x34')](_0x45fd0f[_0xaeb6('0x35')],_0x5caa19);}return _0x5ac200[_0xaeb6('0x1f')]('Account')[_0xaeb6('0x23')](_0x45fd0f,_0x520237)[_0xaeb6('0x24')]()[_0xaeb6('0x25')](function(_0x4aa825){if(_0x4aa825&&_0x4aa825['length']){return _0x4aa825;}else{var _0x227e5e=_[_0xaeb6('0x32')](_0x1205d0);if(_0x4f73ae[_0xaeb6('0x33')]){var _0x118af1={};_0x118af1[_0x4f73ae[_0xaeb6('0x33')]]=_0x3b11cf;_[_0xaeb6('0x34')](_0x227e5e[_0xaeb6('0x35')],_0x118af1);}return _0x5ac200['sobject']('Contact')[_0xaeb6('0x23')](_0x227e5e,_0x520237)[_0xaeb6('0x25')](function(_0x58219c){if(_0x58219c&&_0x58219c[_0xaeb6('0x26')]){return _0x58219c;}else{var _0x3517f6=_['cloneDeep'](_0x1205d0);if(_0x4f73ae[_0xaeb6('0x36')]){var _0x5e0c7f={};_0x5e0c7f[_0x4f73ae[_0xaeb6('0x36')]]=_0x3b11cf;_['merge'](_0x3517f6[_0xaeb6('0x35')],_0x5e0c7f);}return _0x5ac200['sobject'](_0xaeb6('0x37'))[_0xaeb6('0x23')](_0x3517f6,_0x520237);}});}});case'contact':var _0x41e10b=_[_0xaeb6('0x32')](_0x1205d0);if(_0x4f73ae['additionalSearchContact']){var _0x5caa19={};_0x5caa19[_0x4f73ae[_0xaeb6('0x33')]]=_0x3b11cf;_[_0xaeb6('0x34')](_0x41e10b[_0xaeb6('0x35')],_0x5caa19);}return _0x5ac200['sobject'](_0xaeb6('0x39'))[_0xaeb6('0x23')](_0x41e10b,_0x520237)['execute']();case _0xaeb6('0x1b'):var _0x4aa762=_[_0xaeb6('0x32')](_0x1205d0);if(_0x4f73ae[_0xaeb6('0x36')]){var _0x5caa19={};_0x5caa19[_0x4f73ae[_0xaeb6('0x36')]]=_0x3b11cf;_[_0xaeb6('0x34')](_0x4aa762[_0xaeb6('0x35')],_0x5caa19);}return _0x5ac200[_0xaeb6('0x1f')](_0xaeb6('0x37'))['find'](_0x4aa762,_0x520237);case _0xaeb6('0x17'):var _0x45fd0f=_[_0xaeb6('0x32')](_0x1205d0);if(_0x4f73ae[_0xaeb6('0x38')]){var _0x5caa19={};_0x5caa19[_0x4f73ae[_0xaeb6('0x38')]]=_0x3b11cf;_[_0xaeb6('0x34')](_0x45fd0f['$or'],_0x5caa19);}return _0x5ac200[_0xaeb6('0x1f')](_0xaeb6('0x3a'))['find'](_0x45fd0f,_0x520237);default:return null;}})['then'](function(_0x3d1582){if(_0x3d1582&&_0x3d1582[_0xaeb6('0x26')]){var _0x2c8dfa=_[_0xaeb6('0x3b')](_0x3d1582);if(_0x2c8dfa){return BPromise[_0xaeb6('0x29')]({'id':_0x2c8dfa['Id'],'name':_0x2c8dfa[_0xaeb6('0x2a')],'phone':_0x2c8dfa[_0xaeb6('0x3c')],'endUserType':_0x2c8dfa[_0xaeb6('0x3d')][_0xaeb6('0x3e')]['toLowerCase']()});}}})['then'](function(_0x2c916b){if(_0x2c916b){logger[_0xaeb6('0x1d')](_0xaeb6('0x3f'),_0x2c916b[_0xaeb6('0x14')],_0x3b11cf);return BPromise[_0xaeb6('0x29')](_0x2c916b);}else{logger[_0xaeb6('0x1d')](_0xaeb6('0x40'),_0x3b11cf);var _0x4a79dd={'Phone':_0x3b11cf};if(_0x4f73ae[_0xaeb6('0x41')]){if(_0x4f73ae[_0xaeb6('0x41')]===_0xaeb6('0x15')){logger['info'](_0xaeb6('0x42'),_0x3b11cf,_0x4f73ae[_0xaeb6('0x41')]);_0x4a79dd[_0xaeb6('0x43')]=_0xfad076!==''?_0xfad076:util[_0xaeb6('0x44')](_0xaeb6('0x45'),_0x3b11cf);}else if(_0x4f73ae[_0xaeb6('0x41')]===_0xaeb6('0x1b')){logger[_0xaeb6('0x1d')](_0xaeb6('0x42'),_0x3b11cf,_0x4f73ae[_0xaeb6('0x41')]);_0x4a79dd['LastName']=_0xfad076!==''?_0xfad076:util['format']('Caller\x20-\x20%s',_0x3b11cf);_0x4a79dd[_0xaeb6('0x46')]=_0xaeb6('0x47');}else if(_0x4f73ae['moduleCreate']===_0xaeb6('0x17')){logger[_0xaeb6('0x1d')](_0xaeb6('0x42'),_0x3b11cf,_0x4f73ae['moduleCreate']);_0x4a79dd['Name']=_0xfad076!==''?_0xfad076:util[_0xaeb6('0x44')](_0xaeb6('0x45'),_0x3b11cf);}else{return null;}}return _0x5ac200[_0xaeb6('0x1f')](_['upperFirst'](_0x4f73ae[_0xaeb6('0x41')]))[_0xaeb6('0x48')](_0x4a79dd)['then'](function(_0x2b2877){return BPromise[_0xaeb6('0x29')]({'id':_0x2b2877['id'],'endUserType':_0x4f73ae[_0xaeb6('0x41')]});});}});}function getCustomFields(_0x3ee598,_0x3a070f){var _0x55936e={};if(_0x3ee598['length']>0x0){_[_0xaeb6('0x49')](_0x3ee598,function(_0x2ef5de){if(_['includes'](['string','picklist'],_0x2ef5de[_0xaeb6('0x3e')])&&_0x2ef5de[_0xaeb6('0x4a')]){_0x55936e[_0x2ef5de[_0xaeb6('0x4a')]]=_0x2ef5de[_0xaeb6('0x4b')][_0xaeb6('0x4c')]();}else if(_0x2ef5de['type']==='variable'&&_0x2ef5de[_0xaeb6('0x4d')]&&_0x2ef5de[_0xaeb6('0x4a')]){_0x3a070f[_0x2ef5de[_0xaeb6('0x4d')]]&&(_0x55936e[_0x2ef5de[_0xaeb6('0x4a')]]=_0x3a070f[_0x2ef5de['variableName']][_0xaeb6('0x4c')]());}else if(_0x2ef5de[_0xaeb6('0x3e')]==='customVariable'&&_0x2ef5de['Variable']&&_0x2ef5de[_0xaeb6('0x4e')]['name']&&_0x2ef5de['idField']){_0x3a070f[_0x2ef5de[_0xaeb6('0x4e')][_0xaeb6('0x4f')][_0xaeb6('0x50')]()]&&(_0x55936e[_0x2ef5de[_0xaeb6('0x4a')]]=_0x3a070f[_0x2ef5de['Variable']['name'][_0xaeb6('0x50')]()][_0xaeb6('0x4c')]());}});}return _0x55936e;}function getConnection(_0x248729){var _0x131d6e=_0x248729[_0xaeb6('0x51')][_0xaeb6('0x52')](_0x248729['securityToken']);var _0x101a35=new jsforce[(_0xaeb6('0x53'))]({'oauth2':{'loginUrl':_0x248729[_0xaeb6('0x54')]||_0xaeb6('0x55'),'clientId':_0x248729[_0xaeb6('0x56')],'clientSecret':_0x248729[_0xaeb6('0x57')]}});return _0x101a35['login'](_0x248729['username'],_0x131d6e)[_0xaeb6('0x25')](function(){logger['info'](_0xaeb6('0x58'));return _0x101a35;});}exports['queue']=function(_0x2e1330,_0x55284,_0x4a68f5,_0x48117e,_0x450ced,_0x1bd99f){var _0x2be0a7,_0x231d51,_0x34dcdf,_0x237c90;_0x1bd99f['serverUrl']=intUtil[_0xaeb6('0x59')](_0x1bd99f['serverUrl']);_0x1bd99f['remoteUri']=intUtil[_0xaeb6('0x59')](_0x1bd99f['remoteUri']);if(_0x450ced&&_0x450ced['monitor_format']){logger[_0xaeb6('0x1d')](_0xaeb6('0x5a'),_0xaeb6('0x5b'));_0x55284[_0xaeb6('0x5c')]=util['format'](_0xaeb6('0x5d'),_0x1bd99f[_0xaeb6('0x5e')],_0x55284[_0xaeb6('0x5f')],md5(_0x55284['uniqueid']));}else{_0x55284['recordingURL']='';}return getConnection(_0x1bd99f)[_0xaeb6('0x25')](function(_0x26ac7a){_0x237c90=_0x26ac7a;return getUser(_0x1bd99f,_0x48117e[_0xaeb6('0x60')],_0x237c90);})['then'](function(_0x58e210){_0x2be0a7=_0x58e210;return getEndUser(_0x1bd99f,_0x4a68f5,_0x55284[_0xaeb6('0x61')],_0x55284[_0xaeb6('0x62')],_0x237c90);})[_0xaeb6('0x25')](function(_0x26746){_0x231d51=_0x26746;return getTicket(_0x1bd99f,_0x2be0a7,_0x231d51,_0x4a68f5,_0x55284,_0x4a68f5[_0xaeb6('0x63')],_0x237c90,_0xaeb6('0x64'));})[_0xaeb6('0x25')](function(_0x3e730c){_0x34dcdf=_0x3e730c;logger[_0xaeb6('0x1d')](_0xaeb6('0x65'),_0x34dcdf['id']);logger[_0xaeb6('0x1d')](_0xaeb6('0x66'),_0x34dcdf['id'],_0x48117e[_0xaeb6('0x4f')],_0x1bd99f['type']);switch(_0x1bd99f['type']){case'integrationTab':emit(util[_0xaeb6('0x44')]('user:%s',_0x48117e[_0xaeb6('0x4f')]),_0xaeb6('0x67'),{'recordId':_0x34dcdf['id']});break;case'newTab':emit(util['format']('user:%s',_0x48117e[_0xaeb6('0x4f')]),_0xaeb6('0x68'),{'uri':util['format'](_0xaeb6('0x69'),_0x237c90[_0xaeb6('0x6a')],_0x34dcdf['id'])});break;default:logger['error'](_0xaeb6('0x6b'));}})[_0xaeb6('0x6c')](function(_0x52c249){logger[_0xaeb6('0x6d')](_0xaeb6('0x5a'),_0x52c249);});};exports[_0xaeb6('0x6e')]=function(_0x3d6b0f,_0x37871e,_0xe5cc85,_0x9c547d,_0x5d61fc,_0x1d1ab8,_0x186b3f){var _0x50b9d5,_0xe61da1,_0x554363,_0x194666;_0x1d1ab8[_0xaeb6('0x5e')]=intUtil[_0xaeb6('0x59')](_0x1d1ab8[_0xaeb6('0x5e')]);_0x1d1ab8['remoteUri']=intUtil[_0xaeb6('0x59')](_0x1d1ab8[_0xaeb6('0x54')]);if(_0x186b3f&&_0x186b3f[_0xaeb6('0x6f')]&&_0x186b3f['recordingFormat']!==_0xaeb6('0x70')){logger['info'](_0xaeb6('0x71'),_0xaeb6('0x5b'));_0x37871e[_0xaeb6('0x5c')]=util[_0xaeb6('0x44')](_0xaeb6('0x5d'),_0x1d1ab8[_0xaeb6('0x5e')],_0x37871e[_0xaeb6('0x5f')],md5(_0x37871e[_0xaeb6('0x5f')]));}return getConnection(_0x1d1ab8)[_0xaeb6('0x25')](function(_0x4c7600){_0x194666=_0x4c7600;return getUser(_0x1d1ab8,_0x9c547d[_0xaeb6('0x60')],_0x194666);})[_0xaeb6('0x25')](function(_0x1b8e2b){_0x50b9d5=_0x1b8e2b;return getEndUser(_0x1d1ab8,_0xe5cc85,_0x37871e[_0xaeb6('0x72')],_0x37871e[_0xaeb6('0x73')],_0x194666);})['then'](function(_0x2be06b){_0xe61da1=_0x2be06b;return getTicket(_0x1d1ab8,_0x50b9d5,_0xe61da1,_0xe5cc85,_0x37871e,_0xe5cc85['Fields'],_0x194666,'outbound');})['then'](function(_0x1fe145){_0x554363=_0x1fe145;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x554363['id']);logger[_0xaeb6('0x1d')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x554363['id'],_0x9c547d['name'],_0x1d1ab8[_0xaeb6('0x3e')]);switch(_0x1d1ab8[_0xaeb6('0x3e')]){case _0xaeb6('0x74'):emit(util[_0xaeb6('0x44')](_0xaeb6('0x75'),_0x9c547d[_0xaeb6('0x4f')]),_0xaeb6('0x67'),{'recordId':_0x554363['id']});break;case _0xaeb6('0x76'):emit(util[_0xaeb6('0x44')]('user:%s',_0x9c547d[_0xaeb6('0x4f')]),'trigger:browser:url',{'uri':util[_0xaeb6('0x44')](_0xaeb6('0x69'),_0x194666['instanceUrl'],_0x554363['id'])});break;default:logger[_0xaeb6('0x6d')]('[OUTBOUND]',_0xaeb6('0x77'));}})[_0xaeb6('0x6c')](function(_0xf7d956){logger[_0xaeb6('0x6d')](_0xaeb6('0x71'),_0xf7d956);});};exports[_0xaeb6('0x78')]=function(_0x2214d3,_0x56c1f0,_0x5ea4d6,_0x1f2919,_0x21d3f1,_0x1fbe5d){var _0x25f444,_0x14edab,_0x1bc960,_0x4ec104;_0x1fbe5d[_0xaeb6('0x5e')]=intUtil[_0xaeb6('0x59')](_0x1fbe5d[_0xaeb6('0x5e')]);_0x1fbe5d['remoteUri']=intUtil[_0xaeb6('0x59')](_0x1fbe5d[_0xaeb6('0x54')]);if(_0x21d3f1&&_0x21d3f1[_0xaeb6('0x79')]){logger[_0xaeb6('0x1d')]('['+_0x56c1f0[_0xaeb6('0x7a')][_0xaeb6('0x7b')]()+']',_0xaeb6('0x5b'));_0x56c1f0[_0xaeb6('0x5c')]=util[_0xaeb6('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1fbe5d[_0xaeb6('0x5e')],_0x56c1f0['uniqueid'],md5(_0x56c1f0[_0xaeb6('0x5f')]));}else{_0x56c1f0[_0xaeb6('0x5c')]='';}return getConnection(_0x1fbe5d)[_0xaeb6('0x25')](function(_0x2a3419){_0x4ec104=_0x2a3419;if(!_[_0xaeb6('0x20')](_0x1f2919)){return getUser(_0x1fbe5d,_0x1f2919[_0xaeb6('0x4f')],_0x4ec104);}else{return getUser(_0x1fbe5d,null,_0x4ec104);}})[_0xaeb6('0x25')](function(_0x56acf7){_0x25f444=_0x56acf7;return getEndUser(_0x1fbe5d,_0x5ea4d6,_0x56c1f0[_0xaeb6('0x61')],_0x56c1f0[_0xaeb6('0x62')],_0x4ec104);})[_0xaeb6('0x25')](function(_0x18d4eb){_0x14edab=_0x18d4eb;return getTicket(_0x1fbe5d,_0x25f444,_0x14edab,_0x5ea4d6,_0x56c1f0,_0x5ea4d6['Fields'],_0x4ec104);})[_0xaeb6('0x25')](function(_0x395ca9){_0x1bc960=_0x395ca9;logger[_0xaeb6('0x1d')]('['+_0x56c1f0[_0xaeb6('0x7a')][_0xaeb6('0x7b')]()+_0xaeb6('0x7c'),_0x1bc960['id']);logger['info']('['+_0x56c1f0[_0xaeb6('0x7a')]['toUpperCase']()+_0xaeb6('0x7d'),_0x1fbe5d[_0xaeb6('0x3e')]);})[_0xaeb6('0x6c')](function(_0x406cb7){logger[_0xaeb6('0x6d')]('['+_0x56c1f0[_0xaeb6('0x7a')][_0xaeb6('0x7b')]()+']',_0x406cb7);});}; \ No newline at end of file +var _0xf4d7=['lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','defaults','redis','localhost','socket.io-emitter','emit','getString','Subjects','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','contact','ContactId','AccountId','leadId','info','sobject','create','isNil','validateEmail','User','execute','then','length','Email','Agent\x20%s\x20found.','Name','identity','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','find','account_contact_lead','additionalSearchAccount','Phone','attributes','type','toLowerCase','moduleCreate','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','upperFirst','forEach','includes','string','idField','content','variable','toString','customVariable','name','Variable','concat','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','email','destcalleridname','Fields','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged'];(function(_0x17138d,_0x4130b0){var _0x5ed55b=function(_0x55e31b){while(--_0x55e31b){_0x17138d['push'](_0x17138d['shift']());}};_0x5ed55b(++_0x4130b0);}(_0xf4d7,0x81));var _0x7f4d=function(_0x15e6b8,_0x67eaa3){_0x15e6b8=_0x15e6b8-0x0;var _0x4f9a53=_0xf4d7[_0x15e6b8];return _0x4f9a53;};'use strict';var _=require(_0x7f4d('0x0'));var rp=require(_0x7f4d('0x1'));var moment=require(_0x7f4d('0x2'));var BPromise=require(_0x7f4d('0x3'));var md5=require('md5');var jsforce=require(_0x7f4d('0x4'));var util=require(_0x7f4d('0x5'));var Redis=require(_0x7f4d('0x6'));var intUtil=require(_0x7f4d('0x7'));var config=require(_0x7f4d('0x8'));var logger=require('../../../../config/logger')(_0x7f4d('0x9'));config['redis']=_[_0x7f4d('0xa')](config[_0x7f4d('0xb')],{'host':_0x7f4d('0xc'),'port':0x18eb});var io=require(_0x7f4d('0xd'))(new Redis(config[_0x7f4d('0xb')]));function emit(_0x309b7a,_0x1fded0,_0x48a0eb){io['to'](_0x309b7a)[_0x7f4d('0xe')](_0x1fded0,_0x48a0eb);}function getTicket(_0x2372fb,_0x490666,_0x182cbb,_0xbea189,_0x47758c,_0x1ce2a4,_0x109683,_0x309019){var _0x50d865=Object['assign']({},{'OwnerId':_0x490666['id'],'Subject':intUtil[_0x7f4d('0xf')](_0xbea189[_0x7f4d('0x10')],_0x47758c,'\x20'),'Description':intUtil[_0x7f4d('0xf')](_0xbea189['Descriptions'],_0x47758c,'\x0a')},getCustomFields(_0x1ce2a4,_0x47758c));if(_0x182cbb){if(_0xbea189[_0x7f4d('0x11')]==='Task'){_0x50d865['ActivityDate']=moment[_0x7f4d('0x12')]();_0x50d865[_0x7f4d('0x13')]=![];_0x50d865[_0x7f4d('0x14')]=![];if(_0x182cbb['endUserType']==='contact'||_0x182cbb[_0x7f4d('0x15')]===_0x7f4d('0x16')){_0x50d865[_0x7f4d('0x17')]=_0x182cbb['id'];}else if(_0x182cbb['endUserType']===_0x7f4d('0x18')){_0x50d865[_0x7f4d('0x19')]=_0x182cbb['id'];}}else if(_0xbea189['ticketType']===_0x7f4d('0x1a')){if(_0x182cbb[_0x7f4d('0x15')]===_0x7f4d('0x1b')){_0x50d865[_0x7f4d('0x1c')]=_0x182cbb['id'];}else if(_0x182cbb[_0x7f4d('0x15')]===_0x7f4d('0x18')){_0x50d865[_0x7f4d('0x1d')]=_0x182cbb['id'];}else if(_0x182cbb[_0x7f4d('0x15')]===_0x7f4d('0x16')&&_0xbea189[_0x7f4d('0x1e')]){_0x50d865[_0xbea189['leadId']]=_0x182cbb['id'];}else{logger[_0x7f4d('0x1f')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x109683[_0x7f4d('0x20')](_0xbea189[_0x7f4d('0x11')])[_0x7f4d('0x21')](_0x50d865);}function getUser(_0x25e685,_0x3f301b,_0x5dc842){if(!_[_0x7f4d('0x22')](_0x3f301b)&&intUtil[_0x7f4d('0x23')](_0x3f301b)){var _0x13697d={'Email':_0x3f301b};var _0x317718={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5dc842['sobject'](_0x7f4d('0x24'))['find'](_0x13697d,_0x317718)[_0x7f4d('0x25')]()[_0x7f4d('0x26')](function(_0x294742){if(_0x294742[_0x7f4d('0x27')]){var _0x560cc1=_['find'](_0x294742,function(_0x8dd616){return _0x8dd616[_0x7f4d('0x28')]===_0x3f301b;});if(_0x560cc1){logger['info'](_0x7f4d('0x29'),_0x3f301b);return BPromise['resolve']({'id':_0x560cc1['Id'],'name':_0x560cc1[_0x7f4d('0x2a')]});}}else{logger[_0x7f4d('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3f301b);return _0x5dc842[_0x7f4d('0x2b')]()['then'](function(_0x1a2d71){return BPromise[_0x7f4d('0x2c')]({'id':_0x1a2d71[_0x7f4d('0x2d')],'name':_0x1a2d71[_0x7f4d('0x2e')]});});}});}else{logger[_0x7f4d('0x1f')](_0x7f4d('0x2f'),_0x3f301b);return _0x5dc842['identity']()['then'](function(_0x468c9a){return BPromise[_0x7f4d('0x2c')]({'id':_0x468c9a[_0x7f4d('0x2d')],'name':_0x468c9a[_0x7f4d('0x2e')]});});}}function getEndUser(_0x1929ea,_0x3395b2,_0x41a757,_0x26fbfb,_0x411af1){var _0x2eb1dc={'$or':{'Phone':_0x26fbfb}};var _0x2735ca={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7f4d('0x2c')]()['then'](function(){logger[_0x7f4d('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x26fbfb,_0x3395b2[_0x7f4d('0x30')]);switch(_0x3395b2[_0x7f4d('0x30')]){case _0x7f4d('0x31'):var _0x29da30=_[_0x7f4d('0x32')](_0x2eb1dc);if(_0x3395b2['additionalSearchContact']){var _0x99b588={};_0x99b588[_0x3395b2[_0x7f4d('0x33')]]=_0x26fbfb;_['merge'](_0x29da30[_0x7f4d('0x34')],_0x99b588);}return _0x411af1[_0x7f4d('0x20')](_0x7f4d('0x35'))['find'](_0x29da30,_0x2735ca)[_0x7f4d('0x25')]()[_0x7f4d('0x26')](function(_0x18d8b8){if(_0x18d8b8&&_0x18d8b8[_0x7f4d('0x27')]){return _0x18d8b8;}else{var _0x2a9add=_[_0x7f4d('0x32')](_0x2eb1dc);if(_0x3395b2[_0x7f4d('0x36')]){var _0x33b7ef={};_0x33b7ef[_0x3395b2[_0x7f4d('0x36')]]=_0x26fbfb;_[_0x7f4d('0x37')](_0x2a9add[_0x7f4d('0x34')],_0x33b7ef);}return _0x411af1['sobject'](_0x7f4d('0x38'))[_0x7f4d('0x39')](_0x2a9add,_0x2735ca);}});case _0x7f4d('0x3a'):var _0x514446=_[_0x7f4d('0x32')](_0x2eb1dc);if(_0x3395b2['additionalSearchAccount']){var _0x99b588={};_0x99b588[_0x3395b2[_0x7f4d('0x3b')]]=_0x26fbfb;_[_0x7f4d('0x37')](_0x514446['$or'],_0x99b588);}return _0x411af1[_0x7f4d('0x20')]('Account')[_0x7f4d('0x39')](_0x514446,_0x2735ca)[_0x7f4d('0x25')]()[_0x7f4d('0x26')](function(_0x58980c){if(_0x58980c&&_0x58980c[_0x7f4d('0x27')]){return _0x58980c;}else{var _0x1a1528=_[_0x7f4d('0x32')](_0x2eb1dc);if(_0x3395b2['additionalSearchContact']){var _0x2bb56b={};_0x2bb56b[_0x3395b2[_0x7f4d('0x33')]]=_0x26fbfb;_['merge'](_0x1a1528['$or'],_0x2bb56b);}return _0x411af1[_0x7f4d('0x20')]('Contact')['find'](_0x1a1528,_0x2735ca)[_0x7f4d('0x26')](function(_0x44a77f){if(_0x44a77f&&_0x44a77f[_0x7f4d('0x27')]){return _0x44a77f;}else{var _0x3391d8=_[_0x7f4d('0x32')](_0x2eb1dc);if(_0x3395b2[_0x7f4d('0x36')]){var _0x369575={};_0x369575[_0x3395b2[_0x7f4d('0x36')]]=_0x26fbfb;_[_0x7f4d('0x37')](_0x3391d8['$or'],_0x369575);}return _0x411af1['sobject'](_0x7f4d('0x38'))['find'](_0x3391d8,_0x2735ca);}});}});case _0x7f4d('0x1b'):var _0x29da30=_[_0x7f4d('0x32')](_0x2eb1dc);if(_0x3395b2[_0x7f4d('0x33')]){var _0x99b588={};_0x99b588[_0x3395b2[_0x7f4d('0x33')]]=_0x26fbfb;_[_0x7f4d('0x37')](_0x29da30['$or'],_0x99b588);}return _0x411af1[_0x7f4d('0x20')]('Contact')[_0x7f4d('0x39')](_0x29da30,_0x2735ca)[_0x7f4d('0x25')]();case _0x7f4d('0x16'):var _0x4952a7=_[_0x7f4d('0x32')](_0x2eb1dc);if(_0x3395b2[_0x7f4d('0x36')]){var _0x99b588={};_0x99b588[_0x3395b2[_0x7f4d('0x36')]]=_0x26fbfb;_[_0x7f4d('0x37')](_0x4952a7[_0x7f4d('0x34')],_0x99b588);}return _0x411af1['sobject'](_0x7f4d('0x38'))['find'](_0x4952a7,_0x2735ca);case _0x7f4d('0x18'):var _0x514446=_[_0x7f4d('0x32')](_0x2eb1dc);if(_0x3395b2[_0x7f4d('0x3b')]){var _0x99b588={};_0x99b588[_0x3395b2[_0x7f4d('0x3b')]]=_0x26fbfb;_[_0x7f4d('0x37')](_0x514446[_0x7f4d('0x34')],_0x99b588);}return _0x411af1[_0x7f4d('0x20')]('Account')[_0x7f4d('0x39')](_0x514446,_0x2735ca);default:return null;}})[_0x7f4d('0x26')](function(_0x4dcc74){if(_0x4dcc74&&_0x4dcc74[_0x7f4d('0x27')]){var _0x115f2b=_['first'](_0x4dcc74);if(_0x115f2b){return BPromise[_0x7f4d('0x2c')]({'id':_0x115f2b['Id'],'name':_0x115f2b[_0x7f4d('0x2a')],'phone':_0x115f2b[_0x7f4d('0x3c')],'endUserType':_0x115f2b[_0x7f4d('0x3d')][_0x7f4d('0x3e')][_0x7f4d('0x3f')]()});}}})[_0x7f4d('0x26')](function(_0x578656){if(_0x578656){logger[_0x7f4d('0x1f')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x578656[_0x7f4d('0x15')],_0x26fbfb);return BPromise[_0x7f4d('0x2c')](_0x578656);}else{logger[_0x7f4d('0x1f')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x26fbfb);var _0x4a5f48={'Phone':_0x26fbfb};if(_0x3395b2[_0x7f4d('0x40')]){if(_0x3395b2['moduleCreate']===_0x7f4d('0x1b')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x26fbfb,_0x3395b2[_0x7f4d('0x40')]);_0x4a5f48[_0x7f4d('0x41')]=_0x41a757!==_0x7f4d('0x42')?_0x41a757:util[_0x7f4d('0x43')](_0x7f4d('0x44'),_0x26fbfb);}else if(_0x3395b2['moduleCreate']===_0x7f4d('0x16')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x26fbfb,_0x3395b2[_0x7f4d('0x40')]);_0x4a5f48['LastName']=_0x41a757!==_0x7f4d('0x42')?_0x41a757:util['format']('Caller\x20-\x20%s',_0x26fbfb);_0x4a5f48[_0x7f4d('0x45')]=_0x7f4d('0x46');}else if(_0x3395b2[_0x7f4d('0x40')]===_0x7f4d('0x18')){logger[_0x7f4d('0x1f')](_0x7f4d('0x47'),_0x26fbfb,_0x3395b2['moduleCreate']);_0x4a5f48[_0x7f4d('0x2a')]=_0x41a757!==''?_0x41a757:util[_0x7f4d('0x43')]('Caller\x20-\x20%s',_0x26fbfb);}else{return null;}}return _0x411af1[_0x7f4d('0x20')](_[_0x7f4d('0x48')](_0x3395b2[_0x7f4d('0x40')]))[_0x7f4d('0x21')](_0x4a5f48)[_0x7f4d('0x26')](function(_0x3876c0){return BPromise[_0x7f4d('0x2c')]({'id':_0x3876c0['id'],'endUserType':_0x3395b2[_0x7f4d('0x40')]});});}});}function getCustomFields(_0x33a888,_0x514ca9){var _0x44e5ce={};if(_0x33a888['length']>0x0){_[_0x7f4d('0x49')](_0x33a888,function(_0x50478a){if(_[_0x7f4d('0x4a')]([_0x7f4d('0x4b'),'picklist'],_0x50478a[_0x7f4d('0x3e')])&&_0x50478a[_0x7f4d('0x4c')]){_0x44e5ce[_0x50478a[_0x7f4d('0x4c')]]=_0x50478a[_0x7f4d('0x4d')]['toString']();}else if(_0x50478a['type']===_0x7f4d('0x4e')&&_0x50478a['variableName']&&_0x50478a[_0x7f4d('0x4c')]){_0x514ca9[_0x50478a['variableName']]&&(_0x44e5ce[_0x50478a[_0x7f4d('0x4c')]]=_0x514ca9[_0x50478a['variableName']][_0x7f4d('0x4f')]());}else if(_0x50478a[_0x7f4d('0x3e')]===_0x7f4d('0x50')&&_0x50478a['Variable']&&_0x50478a['Variable'][_0x7f4d('0x51')]&&_0x50478a[_0x7f4d('0x4c')]){_0x514ca9[_0x50478a['Variable'][_0x7f4d('0x51')][_0x7f4d('0x3f')]()]&&(_0x44e5ce[_0x50478a['idField']]=_0x514ca9[_0x50478a[_0x7f4d('0x52')]['name'][_0x7f4d('0x3f')]()][_0x7f4d('0x4f')]());}});}return _0x44e5ce;}function getConnection(_0x5995f5){var _0x43be3e=_0x5995f5['password'][_0x7f4d('0x53')](_0x5995f5['securityToken']);var _0x5cb663=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5995f5[_0x7f4d('0x54')]||_0x7f4d('0x55'),'clientId':_0x5995f5[_0x7f4d('0x56')],'clientSecret':_0x5995f5['clientSecret']}});return _0x5cb663[_0x7f4d('0x57')](_0x5995f5[_0x7f4d('0x58')],_0x43be3e)['then'](function(){logger[_0x7f4d('0x1f')](_0x7f4d('0x59'));return _0x5cb663;});}exports['queue']=function(_0x5c8b57,_0x2c2e8c,_0x71f40d,_0x56ea9a,_0x27a4b5,_0xd594f5){var _0x419ab7,_0x191ed1,_0x1f4d0f,_0x3b85be;_0xd594f5['serverUrl']=intUtil['stripTrailingSlash'](_0xd594f5['serverUrl']);_0xd594f5[_0x7f4d('0x54')]=intUtil['stripTrailingSlash'](_0xd594f5['remoteUri']);if(_0x27a4b5&&_0x27a4b5[_0x7f4d('0x5a')]){logger['info'](_0x7f4d('0x5b'),_0x7f4d('0x5c'));_0x2c2e8c[_0x7f4d('0x5d')]=util[_0x7f4d('0x43')](_0x7f4d('0x5e'),_0xd594f5[_0x7f4d('0x5f')],_0x2c2e8c[_0x7f4d('0x60')],md5(_0x2c2e8c[_0x7f4d('0x60')]));}else{_0x2c2e8c['recordingURL']='';}return getConnection(_0xd594f5)[_0x7f4d('0x26')](function(_0x488b56){_0x3b85be=_0x488b56;return getUser(_0xd594f5,_0x56ea9a['email'],_0x3b85be);})[_0x7f4d('0x26')](function(_0x17fe45){_0x419ab7=_0x17fe45;return getEndUser(_0xd594f5,_0x71f40d,_0x2c2e8c['calleridname'],_0x2c2e8c[_0x7f4d('0x61')],_0x3b85be);})[_0x7f4d('0x26')](function(_0x1e8cf6){_0x191ed1=_0x1e8cf6;return getTicket(_0xd594f5,_0x419ab7,_0x191ed1,_0x71f40d,_0x2c2e8c,_0x71f40d['Fields'],_0x3b85be,_0x7f4d('0x62'));})[_0x7f4d('0x26')](function(_0x4fecad){_0x1f4d0f=_0x4fecad;logger[_0x7f4d('0x1f')](_0x7f4d('0x63'),_0x1f4d0f['id']);logger[_0x7f4d('0x1f')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1f4d0f['id'],_0x56ea9a['name'],_0xd594f5['type']);switch(_0xd594f5[_0x7f4d('0x3e')]){case'integrationTab':emit(util[_0x7f4d('0x43')](_0x7f4d('0x64'),_0x56ea9a[_0x7f4d('0x51')]),'trigger:salesforce:display',{'recordId':_0x1f4d0f['id']});break;case _0x7f4d('0x65'):emit(util[_0x7f4d('0x43')](_0x7f4d('0x64'),_0x56ea9a[_0x7f4d('0x51')]),_0x7f4d('0x66'),{'uri':util[_0x7f4d('0x43')]('%s/%s/e',_0x3b85be[_0x7f4d('0x67')],_0x1f4d0f['id'])});break;default:logger[_0x7f4d('0x68')](_0x7f4d('0x69'));}})[_0x7f4d('0x6a')](function(_0x3e42f1){logger[_0x7f4d('0x68')](_0x7f4d('0x5b'),_0x3e42f1);});};exports['outbound']=function(_0x4f4964,_0x195f2a,_0x50e4aa,_0x437926,_0xa00fdc,_0x5ece85,_0x407ebe){var _0x198c31,_0x2b560d,_0x4d1a0e,_0x218bca;_0x5ece85[_0x7f4d('0x5f')]=intUtil[_0x7f4d('0x6b')](_0x5ece85['serverUrl']);_0x5ece85['remoteUri']=intUtil[_0x7f4d('0x6b')](_0x5ece85[_0x7f4d('0x54')]);if(_0x407ebe&&_0x407ebe[_0x7f4d('0x6c')]&&_0x407ebe['recordingFormat']!==_0x7f4d('0x6d')){logger[_0x7f4d('0x1f')](_0x7f4d('0x6e'),'Recording\x20is\x20enabled!');_0x195f2a[_0x7f4d('0x5d')]=util[_0x7f4d('0x43')](_0x7f4d('0x5e'),_0x5ece85[_0x7f4d('0x5f')],_0x195f2a[_0x7f4d('0x60')],md5(_0x195f2a[_0x7f4d('0x60')]));}return getConnection(_0x5ece85)[_0x7f4d('0x26')](function(_0x7b73de){_0x218bca=_0x7b73de;return getUser(_0x5ece85,_0x437926[_0x7f4d('0x6f')],_0x218bca);})['then'](function(_0x327d6d){_0x198c31=_0x327d6d;return getEndUser(_0x5ece85,_0x50e4aa,_0x195f2a[_0x7f4d('0x70')],_0x195f2a['destcalleridnum'],_0x218bca);})[_0x7f4d('0x26')](function(_0x528cbc){_0x2b560d=_0x528cbc;return getTicket(_0x5ece85,_0x198c31,_0x2b560d,_0x50e4aa,_0x195f2a,_0x50e4aa[_0x7f4d('0x71')],_0x218bca,_0x7f4d('0x72'));})[_0x7f4d('0x26')](function(_0x53f9a0){_0x4d1a0e=_0x53f9a0;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x4d1a0e['id']);logger[_0x7f4d('0x1f')](_0x7f4d('0x73'),_0x4d1a0e['id'],_0x437926['name'],_0x5ece85[_0x7f4d('0x3e')]);switch(_0x5ece85[_0x7f4d('0x3e')]){case _0x7f4d('0x74'):emit(util['format'](_0x7f4d('0x64'),_0x437926['name']),_0x7f4d('0x75'),{'recordId':_0x4d1a0e['id']});break;case _0x7f4d('0x65'):emit(util[_0x7f4d('0x43')](_0x7f4d('0x64'),_0x437926[_0x7f4d('0x51')]),_0x7f4d('0x66'),{'uri':util['format'](_0x7f4d('0x76'),_0x218bca['instanceUrl'],_0x4d1a0e['id'])});break;default:logger[_0x7f4d('0x68')](_0x7f4d('0x6e'),_0x7f4d('0x77'));}})[_0x7f4d('0x6a')](function(_0x36aa39){logger[_0x7f4d('0x68')](_0x7f4d('0x6e'),_0x36aa39);});};exports[_0x7f4d('0x78')]=function(_0x1e9919,_0x13bd2b,_0x3e60ab,_0x1b6fce,_0x406978,_0x9909c0){var _0x3e1999,_0x1ecb92,_0x8ec3b5,_0x22e492;_0x9909c0[_0x7f4d('0x5f')]=intUtil[_0x7f4d('0x6b')](_0x9909c0[_0x7f4d('0x5f')]);_0x9909c0[_0x7f4d('0x54')]=intUtil['stripTrailingSlash'](_0x9909c0['remoteUri']);if(_0x406978&&_0x406978[_0x7f4d('0x5a')]){logger[_0x7f4d('0x1f')]('['+_0x13bd2b[_0x7f4d('0x79')][_0x7f4d('0x7a')]()+']',_0x7f4d('0x5c'));_0x13bd2b[_0x7f4d('0x5d')]=util[_0x7f4d('0x43')](_0x7f4d('0x5e'),_0x9909c0[_0x7f4d('0x5f')],_0x13bd2b[_0x7f4d('0x60')],md5(_0x13bd2b[_0x7f4d('0x60')]));}else{_0x13bd2b['recordingURL']='';}return getConnection(_0x9909c0)[_0x7f4d('0x26')](function(_0x32f60d){_0x22e492=_0x32f60d;if(!_[_0x7f4d('0x22')](_0x1b6fce)){return getUser(_0x9909c0,_0x1b6fce['name'],_0x22e492);}else{return getUser(_0x9909c0,null,_0x22e492);}})[_0x7f4d('0x26')](function(_0x25ec4c){_0x3e1999=_0x25ec4c;return getEndUser(_0x9909c0,_0x3e60ab,_0x13bd2b['calleridname'],_0x13bd2b[_0x7f4d('0x61')],_0x22e492);})[_0x7f4d('0x26')](function(_0x262d78){_0x1ecb92=_0x262d78;return getTicket(_0x9909c0,_0x3e1999,_0x1ecb92,_0x3e60ab,_0x13bd2b,_0x3e60ab[_0x7f4d('0x71')],_0x22e492);})[_0x7f4d('0x26')](function(_0x4ea489){_0x8ec3b5=_0x4ea489;logger['info']('['+_0x13bd2b['lastevent'][_0x7f4d('0x7a')]()+_0x7f4d('0x7b'),_0x8ec3b5['id']);logger['info']('['+_0x13bd2b['lastevent']['toUpperCase']()+_0x7f4d('0x7c'),_0x9909c0[_0x7f4d('0x3e')]);})['catch'](function(_0x26ec05){logger[_0x7f4d('0x68')]('['+_0x13bd2b[_0x7f4d('0x79')][_0x7f4d('0x7a')]()+']',_0x26ec05);});}; \ 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 2221046..a3df294 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 _0x5da3=[']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','info','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','user','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','type','customField','nameField','toLowerCase','content','toString','picklist','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','endUserId','POST','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x5da3,0xe2));var _0x35da=function(_0x34ba14,_0x3db2af){_0x34ba14=_0x34ba14-0x0;var _0x288a36=_0x5da3[_0x34ba14];return _0x288a36;};'use strict';var _=require(_0x35da('0x0'));var Promise=require(_0x35da('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x35da('0x2'));var Redis=require(_0x35da('0x3'));var intUtil=require(_0x35da('0x4'));var config=require(_0x35da('0x5'));var logger=require('../../../../config/logger')(_0x35da('0x6'));config[_0x35da('0x7')]=_[_0x35da('0x8')](config[_0x35da('0x7')],{'host':_0x35da('0x9'),'port':0x18eb});var io=require(_0x35da('0xa'))(new Redis(config[_0x35da('0x7')]));function getAdminUser(_0x54ab90,_0x13642c,_0x1e8fb0,_0x4dab56,_0x2ede96,_0x4bfe34){return new Promise(function(_0x244894,_0x3bd6e6){var _0x505c7e={'method':_0x35da('0xb'),'uri':_0x4dab56+_0x35da('0xc')+'&'+_0x2ede96+'&'+_0x4bfe34,'auth':_0x13642c,'json':!![]};return rp(_0x505c7e)[_0x35da('0xd')](function(_0x508c07){if(_0x508c07['result'][_0x35da('0xe')]>0x0){_0x1e8fb0[_0x35da('0xf')]=_0x508c07[_0x35da('0x10')][0x0]['sys_id'];}logger[_0x35da('0x11')]('['+[_0x54ab90['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x1e8fb0);_0x244894(_0x1e8fb0);})['catch'](function(_0x58a3f2){logger[_0x35da('0x12')]('['+[_0x54ab90[_0x35da('0x13')]()]+']',_0x58a3f2[_0x35da('0x14')]);_0x3bd6e6(_0x58a3f2[_0x35da('0x14')]);});});}function getUser(_0x3a0fec,_0x4559bd,_0x626af6,_0x5cdb58,_0x16c689){return function(_0x5a0259){logger[_0x35da('0x11')]('['+[_0x3a0fec['toUpperCase']()]+_0x35da('0x15'),_0x5a0259);return new Promise(function(_0x57a7df,_0x508927){if(intUtil[_0x35da('0x16')](_0x5a0259[_0x35da('0x17')])){var _0x1b579d={'method':_0x35da('0xb'),'uri':_0x626af6+'sys_user?sysparm_query=email%3D'+_0x5a0259[_0x35da('0x17')]+'&'+_0x5cdb58+'&'+_0x16c689,'auth':_0x4559bd,'json':!![]};logger[_0x35da('0x11')]('['+[_0x3a0fec[_0x35da('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x1b579d);return rp(_0x1b579d)['then'](function(_0x2a2a6f){logger[_0x35da('0x11')]('['+[_0x3a0fec['toUpperCase']()]+_0x35da('0x18'),_0x2a2a6f);if(_0x2a2a6f[_0x35da('0x10')][_0x35da('0xe')]>0x0&&String(_0x2a2a6f[_0x35da('0x10')][0x0][_0x35da('0x19')])===_0x35da('0x1a')){_0x5a0259[_0x35da('0x1b')]=_0x2a2a6f[_0x35da('0x10')][0x0][_0x35da('0x1c')];}else{_0x5a0259[_0x35da('0x1b')]=_0x5a0259[_0x35da('0xf')];_0x5a0259[_0x35da('0x17')]=_0x5a0259[_0x35da('0x1d')];}logger[_0x35da('0x11')]('['+[_0x3a0fec[_0x35da('0x13')]()]+_0x35da('0x1e'),_0x5a0259);_0x57a7df(_0x5a0259);})[_0x35da('0x1f')](function(_0x354cf7){logger[_0x35da('0x12')]('['+[_0x3a0fec[_0x35da('0x13')]()]+']',_0x354cf7[_0x35da('0x14')]);_0x508927(_0x354cf7[_0x35da('0x14')]);});}else{logger[_0x35da('0x11')]('['+[_0x3a0fec[_0x35da('0x13')]()]+']\x20using\x20admin\x20profile');_0x5a0259['userId']=_0x5a0259[_0x35da('0xf')];_0x5a0259[_0x35da('0x17')]=_0x5a0259['adminEmail'];_0x57a7df(_0x5a0259);}});};}function createEndUser(_0x3535db,_0x3af924,_0x443978,_0x571457,_0x24cbad){logger[_0x35da('0x11')]('['+[_0x3535db[_0x35da('0x13')]()]+_0x35da('0x20'),_0x443978);return new Promise(function(_0x3830b8,_0x570065){var _0x24c624={'method':'POST','uri':_0x571457+'sys_user?'+_0x24cbad,'body':{'user_name':_0x443978['endUserNumber'],'roles':_0x35da('0x21'),'first_name':_0x443978[_0x35da('0x22')],'active':'true','date_format':_0x35da('0x23'),'phone':_0x443978['endUserNumber']},'auth':_0x3af924,'json':!![]};return rp(_0x24c624)[_0x35da('0xd')](function(_0xf47eb3){logger[_0x35da('0x11')]('['+[_0x3535db[_0x35da('0x13')]()]+_0x35da('0x24'),_0xf47eb3[_0x35da('0x10')]);_0x443978['endUserId']=_0xf47eb3[_0x35da('0x10')][_0x35da('0x1c')];_0x3830b8(_0x443978);})['catch'](function(_0x4d5d26){logger[_0x35da('0x12')]('['+[_0x3535db['toUpperCase']()]+']',_0x4d5d26[_0x35da('0x14')]);_0x570065(_0x4d5d26['message']);});});}function getEndUser(_0x2f1351,_0x46fea4,_0x10c718,_0x33d43e,_0x196d22){return function(_0x3f4789){logger[_0x35da('0x11')]('['+[_0x2f1351['toUpperCase']()]+_0x35da('0x25'),_0x3f4789);return new Promise(function(_0x151f89,_0x36fa2e){var _0x4a7723={'method':_0x35da('0xb'),'uri':_0x10c718+_0x35da('0x26')+_0x3f4789['endUserNumber']+'&'+_0x33d43e+'&'+_0x196d22,'auth':_0x46fea4,'json':!![]};return rp(_0x4a7723)[_0x35da('0xd')](function(_0x194cb6){if(_0x194cb6[_0x35da('0x10')][_0x35da('0xe')]>0x0){_0x3f4789['endUserId']=_0x194cb6[_0x35da('0x10')][0x0]['sys_id'];logger['info']('['+[_0x2f1351['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x3f4789);_0x151f89(_0x3f4789);}else{return createEndUser(_0x2f1351,_0x46fea4,_0x3f4789,_0x10c718,_0x33d43e)[_0x35da('0xd')](function(_0x408eae){logger[_0x35da('0x11')]('['+[_0x2f1351[_0x35da('0x13')]()]+_0x35da('0x27'),_0x408eae);_0x151f89(_0x408eae);});}})[_0x35da('0x1f')](function(_0x65ded6){logger[_0x35da('0x12')]('['+[_0x2f1351[_0x35da('0x13')]()]+']',_0x65ded6['message']);_0x36fa2e(_0x65ded6[_0x35da('0x14')]);});});};}function getCustomFields(_0xf88449,_0x3e4154){var _0xadd992={};if(_0xf88449[_0x35da('0xe')]>0x0){_[_0x35da('0x28')](_0xf88449,function(_0x200e8f){if(_[_0x35da('0x29')]([_0x35da('0x2a'),'picklist'],_0x200e8f[_0x35da('0x2b')])&&_0x200e8f['nameField']&&!_0x200e8f[_0x35da('0x2c')]){_0xadd992[_0x200e8f[_0x35da('0x2d')][_0x35da('0x2e')]()]=_0x200e8f[_0x35da('0x2f')][_0x35da('0x30')]();}else if(_[_0x35da('0x29')]([_0x35da('0x2a'),_0x35da('0x31')],_0x200e8f[_0x35da('0x2b')])&&_0x200e8f[_0x35da('0x32')]&&_0x200e8f[_0x35da('0x2c')]){_0xadd992[_0x200e8f[_0x35da('0x32')][_0x35da('0x2e')]()]=_0x200e8f[_0x35da('0x2f')][_0x35da('0x30')]();}else if(_0x200e8f[_0x35da('0x2b')]===_0x35da('0x33')&&_0x200e8f['variableName']&&_0x200e8f['idField']&&_0x200e8f[_0x35da('0x2c')]){_0xadd992[_0x200e8f[_0x35da('0x32')][_0x35da('0x2e')]()]=_0x3e4154[_0x200e8f[_0x35da('0x34')]][_0x35da('0x30')]();}else if(_0x200e8f[_0x35da('0x2b')]===_0x35da('0x35')&&_0x200e8f[_0x35da('0x36')]&&_0x200e8f[_0x35da('0x36')]['name']&&_0x200e8f[_0x35da('0x32')]&&_0x200e8f[_0x35da('0x2c')]){_0xadd992[_0x200e8f[_0x35da('0x32')][_0x35da('0x2e')]()]=_0x3e4154[_0x200e8f[_0x35da('0x36')][_0x35da('0x37')][_0x35da('0x2e')]()][_0x35da('0x30')]();}});}return _0xadd992;}function getTicket(_0x3940ee,_0x4161d7,_0x570af0,_0x269cde,_0xfc8b72,_0x17a60b){return function(_0x1e74be){logger[_0x35da('0x11')]('['+[_0x3940ee[_0x35da('0x13')]()]+_0x35da('0x38'),_0x1e74be);return new Promise(function(_0xae0b73,_0x1b8006){var _0x179843=_0x3940ee[_0x35da('0x2e')]()==='outbound'?_0x1e74be[_0x35da('0x1b')]:_0x1e74be[_0x35da('0x39')];var _0x56fcb2={'method':_0x35da('0x3a'),'uri':_0x570af0+'incident'+'?'+_0x17a60b,'body':Object[_0x35da('0x3b')]({},{'active':_0x35da('0x1a'),'caller_id':_0x179843,'assigned_to':_0x1e74be[_0x35da('0x1b')],'short_description':intUtil[_0x35da('0x3c')](_0x269cde[_0x35da('0x3d')],_0xfc8b72,'\x20'),'description':intUtil[_0x35da('0x3c')](_0x269cde[_0x35da('0x3e')],_0xfc8b72,'\x0a')},getCustomFields(_0x269cde[_0x35da('0x3f')],_0xfc8b72)),'auth':_0x4161d7,'json':!![]};return rp(_0x56fcb2)[_0x35da('0xd')](function(_0x381c80){logger['info']('['+[_0x3940ee[_0x35da('0x13')]()]+_0x35da('0x40'),_0x381c80[_0x35da('0x10')]);_0x1e74be[_0x35da('0x41')]=_0x381c80[_0x35da('0x10')][_0x35da('0x1c')];_0x1e74be['ticketNumber']=_0x381c80[_0x35da('0x10')][_0x35da('0x42')];logger['info']('['+[_0x3940ee['toUpperCase']()]+_0x35da('0x43'),_0x1e74be);_0xae0b73(_0x1e74be);})[_0x35da('0x1f')](function(_0x47825b){logger[_0x35da('0x12')]('['+[_0x3940ee['toUpperCase']()]+']',_0x47825b['message']);_0x1b8006(_0x47825b[_0x35da('0x14')]);});});};}function createRemoteTag(_0x5c2951,_0x3c677e,_0x56f421,_0x28d971){return new Promise(function(_0x151164,_0x5d9919){var _0x36e2b8={'method':_0x35da('0x3a'),'uri':_0x56f421+_0x35da('0x44')+'?'+_0x28d971,'body':{'short_description':_0x5c2951,'global':!![],'active':!![],'name':_0x5c2951},'auth':_0x3c677e,'json':!![]};return rp(_0x36e2b8)[_0x35da('0xd')](function(_0x3929a8){var _0x38a137=_0x3929a8['result']['sys_id'];_0x151164(_0x38a137);});});}function getRemoteTag(_0x2e8ed9,_0xd79404,_0x321a49,_0x29fdb4,_0x5c19b6){return new Promise(function(_0x4c5305,_0x4282ae){var _0x5bc5b4={'method':_0x35da('0xb'),'uri':_0x321a49+_0x35da('0x44')+_0x35da('0x45')+_0x2e8ed9+'&'+_0x29fdb4,'auth':_0xd79404,'json':!![]};return rp(_0x5bc5b4)[_0x35da('0xd')](function(_0x5e5971){if(_0x5e5971[_0x35da('0x10')][_0x35da('0xe')]>0x0){var _0xbed8c7=_0x5e5971[_0x35da('0x10')][0x0][_0x35da('0x1c')];_0x4c5305(_0xbed8c7);}else{return createRemoteTag(_0x2e8ed9,_0xd79404,_0x321a49,_0x29fdb4)[_0x35da('0xd')](function(_0xa0a576){_0x4c5305(_0xa0a576);});}});});}function assignTagToIncident(_0x3d6530,_0x717a6b,_0x22b30c,_0x293517,_0x227925){return new Promise(function(_0x49946d,_0x3506fe){var _0xeb1f1f={'method':_0x35da('0x3a'),'uri':_0x22b30c+_0x35da('0x46')+'?'+_0x227925,'body':{'label':_0x3d6530,'table':_0x35da('0x47'),'id_type':_0x35da('0x48'),'table_key':_0x293517[_0x35da('0x41')],'title':'Incident\x20-\x20'+_0x293517['ticketNumber'],'id_display':_0x293517[_0x35da('0x49')]},'auth':_0x717a6b,'json':!![]};return rp(_0xeb1f1f)[_0x35da('0xd')](function(_0x1b30fe){_0x49946d();})[_0x35da('0x1f')](function(){_0x49946d();});});}function manageTags(_0x1e3f3f,_0x350af8,_0x4c4975,_0x2cf6ea,_0x14303a,_0x44776c,_0x86b685){return new Promise(function(_0x282acd,_0x1e6ba1){var _0xf68e53=[];_0x350af8[_0x35da('0x28')](function(_0x141089){_0xf68e53[_0x35da('0x4a')](getRemoteTag(_0x141089,_0x4c4975,_0x2cf6ea,_0x44776c,_0x86b685));});return Promise[_0x35da('0x4b')](_0xf68e53)[_0x35da('0xd')](function(_0x1c86ca){if(_0x1c86ca[_0x35da('0xe')]){logger[_0x35da('0x11')]('['+[_0x1e3f3f[_0x35da('0x13')]()]+_0x35da('0x4c'),_0x1c86ca);var _0x4a3ff4=[];_0x1c86ca['forEach'](function(_0x3f8768){_0x4a3ff4[_0x35da('0x4a')](assignTagToIncident(_0x3f8768,_0x4c4975,_0x2cf6ea,_0x14303a,_0x44776c));});return Promise[_0x35da('0x4b')](_0x4a3ff4)['then'](function(){_0x282acd();})[_0x35da('0x1f')](function(){_0x282acd();});}else{_0x282acd();}});});}function getTags(_0x2946,_0x42bda3,_0x3b64be,_0x135332,_0x3da947,_0x7fc014){return function(_0x58a1a4){return new Promise(function(_0x4c3289,_0x3ed4eb){var _0x44e2f6=[];var _0x234d61=_0x135332[_0x35da('0x4d')];if(_0x234d61&&_0x234d61[_0x35da('0xe')]>0x0){_0x44e2f6=_[_0x35da('0x4e')](_0x234d61,_0x35da('0x37'));}if(_0x44e2f6[_0x35da('0xe')]>0x0){return manageTags(_0x2946,_0x44e2f6,_0x42bda3,_0x3b64be,_0x58a1a4,_0x3da947,_0x7fc014)[_0x35da('0xd')](function(){_0x4c3289(_0x58a1a4);});}else{_0x4c3289(_0x58a1a4);}});};}function emit(_0x358d70,_0x8c329a,_0x500c7f){var _0x5ad43b=_0x35da('0x4f')+_0x35da('0x50')+_0x35da('0x51')+_0x35da('0x52');var _0x1ff2bb={'uri':_0x358d70+_0x35da('0x53')+_0x500c7f+_0x5ad43b};io['to'](util['format'](_0x35da('0x54'),_0x8c329a))[_0x35da('0x55')](_0x35da('0x56'),_0x1ff2bb);}exports['cs']=function(_0x37a14e,_0x27767a,_0x58f3a7,_0x3fede3,_0x947de6,_0x56ea98,_0x1fad0b,_0x30f2c2){var _0x23d99c={};var _0x1f3e2a={'user':_0x56ea98[_0x35da('0x57')],'pass':_0x56ea98[_0x35da('0x58')]};var _0x519ebd=_0x35da('0x59');var _0x2ff34d='sysparm_display_value=true';_0x56ea98[_0x35da('0x5a')]=intUtil['stripTrailingSlash'](_0x56ea98['remoteUri']);_0x56ea98[_0x35da('0x5b')]=intUtil[_0x35da('0x5c')](_0x56ea98[_0x35da('0x5b')]);var _0x3eaa0b=util[_0x35da('0x5d')](_0x35da('0x5e'),_0x56ea98[_0x35da('0x5a')]);_0x23d99c['userEmail']=!_[_0x35da('0x5f')](_0x3fede3)?_0x3fede3['email']:null;_0x23d99c[_0x35da('0x1d')]=_0x56ea98[_0x35da('0x60')];_0x23d99c[_0x35da('0x22')]=_0x30f2c2[_0x35da('0x2e')]()===_0x35da('0x61')?_0x27767a[_0x35da('0x62')]:_0x27767a[_0x35da('0x63')];_0x23d99c[_0x35da('0x64')]=_0x30f2c2===_0x35da('0x65')||_0x30f2c2===_0x35da('0x66')?'queue':'outbound';var _0x42ed9d=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56ea98[_0x35da('0x5b')],_0x27767a[_0x35da('0x67')],md5(_0x27767a[_0x35da('0x67')]));if(_0x947de6&&_0x947de6['monitor_format']){logger[_0x35da('0x11')](_0x35da('0x68'),_0x35da('0x69'));_0x27767a['recordingURL']=_0x42ed9d;}else if(_0x1fad0b&&_0x1fad0b[_0x35da('0x6a')]&&_0x1fad0b[_0x35da('0x6a')]!=='none'){logger['info']('[OUTBOUND]',_0x35da('0x69'));_0x27767a['recordingURL']=_0x42ed9d;}else{_0x27767a[_0x35da('0x6b')]='';}return getAdminUser(_0x30f2c2,_0x1f3e2a,_0x23d99c,_0x3eaa0b,_0x2ff34d,_0x519ebd)[_0x35da('0xd')](getUser(_0x30f2c2,_0x1f3e2a,_0x3eaa0b,_0x2ff34d,_0x519ebd))[_0x35da('0xd')](getEndUser(_0x30f2c2,_0x1f3e2a,_0x3eaa0b,_0x2ff34d,_0x519ebd))[_0x35da('0xd')](getTicket(_0x30f2c2,_0x1f3e2a,_0x3eaa0b,_0x58f3a7,_0x27767a,_0x2ff34d))[_0x35da('0xd')](function(_0x4cd963){logger[_0x35da('0x11')](util[_0x35da('0x5d')](_0x35da('0x6c'),_0x4cd963[_0x35da('0x41')]));logger[_0x35da('0x11')](util[_0x35da('0x5d')]('call\x20direction:\x20%s',_0x30f2c2));if(_0x30f2c2!==_0x35da('0x66')){logger[_0x35da('0x11')]('['+[_0x30f2c2[_0x35da('0x13')]()]+']',_0x35da('0x6d'));emit(_0x56ea98[_0x35da('0x5a')],_0x3fede3[_0x35da('0x37')],_0x4cd963[_0x35da('0x41')]);}})[_0x35da('0x1f')](function(_0xa0e4be){logger[_0x35da('0x12')]('['+[_0x30f2c2[_0x35da('0x13')]()]+_0x35da('0x6e'),util[_0x35da('0x6f')](_0xa0e4be,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4280=['user','true','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','length','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','customField','toLowerCase','content','toString','picklist','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','assign','Subjects','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20Error\x20running\x20ServiceNow\x20integration','util','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','GET','then','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','userId','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminEmail','sys_user?','endUserNumber'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x4280,0x1e9));var _0x0428=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4280[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0x0428('0x0'));var md5=require('md5');var Redis=require(_0x0428('0x1'));var intUtil=require(_0x0428('0x2'));var config=require('../../../../config/environment');var logger=require(_0x0428('0x3'))('servicenow');config['redis']=_[_0x0428('0x4')](config[_0x0428('0x5')],{'host':_0x0428('0x6'),'port':0x18eb});var io=require(_0x0428('0x7'))(new Redis(config[_0x0428('0x5')]));function getAdminUser(_0x3e07c1,_0x1e560f,_0x1aa800,_0x579448,_0x1a3024,_0x497455){return new Promise(function(_0x468ae8,_0x26baff){var _0x5f244e={'method':_0x0428('0x8'),'uri':_0x579448+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x1a3024+'&'+_0x497455,'auth':_0x1e560f,'json':!![]};return rp(_0x5f244e)[_0x0428('0x9')](function(_0x16f1e5){if(_0x16f1e5['result']['length']>0x0){_0x1aa800[_0x0428('0xa')]=_0x16f1e5[_0x0428('0xb')][0x0][_0x0428('0xc')];}logger[_0x0428('0xd')]('['+[_0x3e07c1[_0x0428('0xe')]()]+_0x0428('0xf'),_0x1aa800);_0x468ae8(_0x1aa800);})['catch'](function(_0x112b60){logger[_0x0428('0x10')]('['+[_0x3e07c1[_0x0428('0xe')]()]+']',_0x112b60[_0x0428('0x11')]);_0x26baff(_0x112b60[_0x0428('0x11')]);});});}function getUser(_0x29a6c4,_0x71d148,_0x392828,_0x1aa6fc,_0x3fe3d1){return function(_0x1747fb){logger['info']('['+[_0x29a6c4[_0x0428('0xe')]()]+_0x0428('0x12'),_0x1747fb);return new Promise(function(_0x124a8a,_0x1f94bc){if(intUtil[_0x0428('0x13')](_0x1747fb[_0x0428('0x14')])){var _0x319a1b={'method':_0x0428('0x8'),'uri':_0x392828+_0x0428('0x15')+_0x1747fb[_0x0428('0x14')]+'&'+_0x1aa6fc+'&'+_0x3fe3d1,'auth':_0x71d148,'json':!![]};logger[_0x0428('0xd')]('['+[_0x29a6c4[_0x0428('0xe')]()]+_0x0428('0x16'),_0x319a1b);return rp(_0x319a1b)['then'](function(_0x270af7){logger['info']('['+[_0x29a6c4[_0x0428('0xe')]()]+'],\x20getUser\x20entity',_0x270af7);if(_0x270af7[_0x0428('0xb')]['length']>0x0&&String(_0x270af7[_0x0428('0xb')][0x0][_0x0428('0x17')])==='true'){_0x1747fb[_0x0428('0x18')]=_0x270af7[_0x0428('0xb')][0x0]['sys_id'];}else{_0x1747fb[_0x0428('0x18')]=_0x1747fb[_0x0428('0xa')];_0x1747fb['userEmail']=_0x1747fb['adminEmail'];}logger[_0x0428('0xd')]('['+[_0x29a6c4[_0x0428('0xe')]()]+_0x0428('0x19'),_0x1747fb);_0x124a8a(_0x1747fb);})[_0x0428('0x1a')](function(_0x5d6193){logger[_0x0428('0x10')]('['+[_0x29a6c4[_0x0428('0xe')]()]+']',_0x5d6193[_0x0428('0x11')]);_0x1f94bc(_0x5d6193[_0x0428('0x11')]);});}else{logger[_0x0428('0xd')]('['+[_0x29a6c4['toUpperCase']()]+_0x0428('0x1b'));_0x1747fb[_0x0428('0x18')]=_0x1747fb['adminId'];_0x1747fb[_0x0428('0x14')]=_0x1747fb[_0x0428('0x1c')];_0x124a8a(_0x1747fb);}});};}function createEndUser(_0xd5c08c,_0x5a0a01,_0x34a029,_0x233522,_0x482234){logger[_0x0428('0xd')]('['+[_0xd5c08c['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x34a029);return new Promise(function(_0xade56e,_0xd5bf13){var _0x309719={'method':'POST','uri':_0x233522+_0x0428('0x1d')+_0x482234,'body':{'user_name':_0x34a029[_0x0428('0x1e')],'roles':_0x0428('0x1f'),'first_name':_0x34a029[_0x0428('0x1e')],'active':_0x0428('0x20'),'date_format':_0x0428('0x21'),'phone':_0x34a029[_0x0428('0x1e')]},'auth':_0x5a0a01,'json':!![]};return rp(_0x309719)['then'](function(_0xe2e074){logger[_0x0428('0xd')]('['+[_0xd5c08c[_0x0428('0xe')]()]+_0x0428('0x22'),_0xe2e074['result']);_0x34a029['endUserId']=_0xe2e074[_0x0428('0xb')]['sys_id'];_0xade56e(_0x34a029);})[_0x0428('0x1a')](function(_0x554560){logger[_0x0428('0x10')]('['+[_0xd5c08c[_0x0428('0xe')]()]+']',_0x554560[_0x0428('0x11')]);_0xd5bf13(_0x554560[_0x0428('0x11')]);});});}function getEndUser(_0x17923d,_0x8133ff,_0x3ee039,_0x5e8d88,_0x355b00){return function(_0x3c9ecc){logger[_0x0428('0xd')]('['+[_0x17923d['toUpperCase']()]+_0x0428('0x23'),_0x3c9ecc);return new Promise(function(_0x4a1e06,_0x160648){var _0x2e5c3d={'method':_0x0428('0x8'),'uri':_0x3ee039+'sys_user?sysparm_query=phone%3D'+_0x3c9ecc[_0x0428('0x1e')]+'&'+_0x5e8d88+'&'+_0x355b00,'auth':_0x8133ff,'json':!![]};return rp(_0x2e5c3d)[_0x0428('0x9')](function(_0x93b495){if(_0x93b495[_0x0428('0xb')][_0x0428('0x24')]>0x0){_0x3c9ecc[_0x0428('0x25')]=_0x93b495[_0x0428('0xb')][0x0][_0x0428('0xc')];logger[_0x0428('0xd')]('['+[_0x17923d['toUpperCase']()]+_0x0428('0x26'),_0x3c9ecc);_0x4a1e06(_0x3c9ecc);}else{return createEndUser(_0x17923d,_0x8133ff,_0x3c9ecc,_0x3ee039,_0x5e8d88)[_0x0428('0x9')](function(_0x5b1217){logger['info']('['+[_0x17923d[_0x0428('0xe')]()]+_0x0428('0x27'),_0x5b1217);_0x4a1e06(_0x5b1217);});}})[_0x0428('0x1a')](function(_0x63732e){logger['error']('['+[_0x17923d[_0x0428('0xe')]()]+']',_0x63732e[_0x0428('0x11')]);_0x160648(_0x63732e[_0x0428('0x11')]);});});};}function getCustomFields(_0x3fc27c,_0x2dfdd7){var _0x2d27cb={};if(_0x3fc27c[_0x0428('0x24')]>0x0){_[_0x0428('0x28')](_0x3fc27c,function(_0x57f28e){if(_[_0x0428('0x29')]([_0x0428('0x2a'),'picklist'],_0x57f28e[_0x0428('0x2b')])&&_0x57f28e[_0x0428('0x2c')]&&!_0x57f28e[_0x0428('0x2d')]){_0x2d27cb[_0x57f28e['nameField'][_0x0428('0x2e')]()]=_0x57f28e[_0x0428('0x2f')][_0x0428('0x30')]();}else if(_[_0x0428('0x29')]([_0x0428('0x2a'),_0x0428('0x31')],_0x57f28e[_0x0428('0x2b')])&&_0x57f28e[_0x0428('0x32')]&&_0x57f28e[_0x0428('0x2d')]){_0x2d27cb[_0x57f28e[_0x0428('0x32')]['toLowerCase']()]=_0x57f28e[_0x0428('0x2f')][_0x0428('0x30')]();}else if(_0x57f28e[_0x0428('0x2b')]==='variable'&&_0x57f28e[_0x0428('0x33')]&&_0x57f28e[_0x0428('0x32')]&&_0x57f28e['customField']){_0x2d27cb[_0x57f28e[_0x0428('0x32')][_0x0428('0x2e')]()]=_0x2dfdd7[_0x57f28e['variableName']][_0x0428('0x30')]();}else if(_0x57f28e['type']===_0x0428('0x34')&&_0x57f28e[_0x0428('0x35')]&&_0x57f28e['Variable'][_0x0428('0x36')]&&_0x57f28e[_0x0428('0x32')]&&_0x57f28e[_0x0428('0x2d')]){_0x2d27cb[_0x57f28e[_0x0428('0x32')][_0x0428('0x2e')]()]=_0x2dfdd7[_0x57f28e[_0x0428('0x35')][_0x0428('0x36')][_0x0428('0x2e')]()]['toString']();}});}return _0x2d27cb;}function getTicket(_0x17a58a,_0x5b4b72,_0x283f7b,_0x5576bb,_0x6b3b40,_0x554c60){return function(_0x208462){logger[_0x0428('0xd')]('['+[_0x17a58a[_0x0428('0xe')]()]+_0x0428('0x37'),_0x208462);return new Promise(function(_0x934fcc,_0x36bbf1){var _0x1c6846=_0x17a58a[_0x0428('0x2e')]()===_0x0428('0x38')?_0x208462[_0x0428('0x18')]:_0x208462[_0x0428('0x25')];var _0x3e057a={'method':_0x0428('0x39'),'uri':_0x283f7b+'incident'+'?'+_0x554c60,'body':Object[_0x0428('0x3a')]({},{'active':_0x0428('0x20'),'caller_id':_0x1c6846,'assigned_to':_0x208462[_0x0428('0x18')],'short_description':intUtil['getString'](_0x5576bb[_0x0428('0x3b')],_0x6b3b40,'\x20'),'description':intUtil[_0x0428('0x3c')](_0x5576bb[_0x0428('0x3d')],_0x6b3b40,'\x0a')},getCustomFields(_0x5576bb['Fields'],_0x6b3b40)),'auth':_0x5b4b72,'json':!![]};return rp(_0x3e057a)['then'](function(_0x35b737){logger['info']('['+[_0x17a58a[_0x0428('0xe')]()]+_0x0428('0x3e'),_0x35b737[_0x0428('0xb')]);_0x208462[_0x0428('0x3f')]=_0x35b737[_0x0428('0xb')]['sys_id'];_0x208462[_0x0428('0x40')]=_0x35b737['result'][_0x0428('0x41')];logger[_0x0428('0xd')]('['+[_0x17a58a[_0x0428('0xe')]()]+_0x0428('0x42'),_0x208462);_0x934fcc(_0x208462);})[_0x0428('0x1a')](function(_0x46ef10){logger[_0x0428('0x10')]('['+[_0x17a58a[_0x0428('0xe')]()]+']',_0x46ef10[_0x0428('0x11')]);_0x36bbf1(_0x46ef10['message']);});});};}function createRemoteTag(_0x3e7cd0,_0x326a17,_0x52e597,_0x11150e){return new Promise(function(_0x332f11,_0xd9743b){var _0x32ccc1={'method':_0x0428('0x39'),'uri':_0x52e597+_0x0428('0x43')+'?'+_0x11150e,'body':{'short_description':_0x3e7cd0,'global':!![],'active':!![],'name':_0x3e7cd0},'auth':_0x326a17,'json':!![]};return rp(_0x32ccc1)[_0x0428('0x9')](function(_0x229b43){var _0x9e8d92=_0x229b43['result'][_0x0428('0xc')];_0x332f11(_0x9e8d92);});});}function getRemoteTag(_0x43eef3,_0x94821c,_0x53b1c1,_0x1a5be7,_0x3127db){return new Promise(function(_0x3c585f,_0x577498){var _0x4221e0={'method':'GET','uri':_0x53b1c1+'label'+_0x0428('0x44')+_0x43eef3+'&'+_0x1a5be7,'auth':_0x94821c,'json':!![]};return rp(_0x4221e0)[_0x0428('0x9')](function(_0x3720e2){if(_0x3720e2[_0x0428('0xb')][_0x0428('0x24')]>0x0){var _0x2c8dd2=_0x3720e2[_0x0428('0xb')][0x0][_0x0428('0xc')];_0x3c585f(_0x2c8dd2);}else{return createRemoteTag(_0x43eef3,_0x94821c,_0x53b1c1,_0x1a5be7)[_0x0428('0x9')](function(_0x5e182f){_0x3c585f(_0x5e182f);});}});});}function assignTagToIncident(_0x2f0f04,_0x287a1d,_0x4fac22,_0x43c97c,_0x161291){return new Promise(function(_0x45183b,_0x115c9c){var _0x3cba55={'method':_0x0428('0x39'),'uri':_0x4fac22+_0x0428('0x45')+'?'+_0x161291,'body':{'label':_0x2f0f04,'table':'incident','id_type':_0x0428('0x46'),'table_key':_0x43c97c[_0x0428('0x3f')],'title':_0x0428('0x47')+_0x43c97c[_0x0428('0x40')],'id_display':_0x43c97c[_0x0428('0x40')]},'auth':_0x287a1d,'json':!![]};return rp(_0x3cba55)['then'](function(_0x12149b){_0x45183b();})['catch'](function(){_0x45183b();});});}function manageTags(_0x46e062,_0x482a73,_0x3876cc,_0x4968ac,_0x60c53f,_0x45e310,_0xc45f50){return new Promise(function(_0xa5fbc8,_0xaf82bc){var _0x33e1c2=[];_0x482a73[_0x0428('0x28')](function(_0x16a428){_0x33e1c2[_0x0428('0x48')](getRemoteTag(_0x16a428,_0x3876cc,_0x4968ac,_0x45e310,_0xc45f50));});return Promise[_0x0428('0x49')](_0x33e1c2)[_0x0428('0x9')](function(_0x5bedea){if(_0x5bedea['length']){logger[_0x0428('0xd')]('['+[_0x46e062['toUpperCase']()]+_0x0428('0x4a'),_0x5bedea);var _0x4b2589=[];_0x5bedea['forEach'](function(_0xfaa0a0){_0x4b2589[_0x0428('0x48')](assignTagToIncident(_0xfaa0a0,_0x3876cc,_0x4968ac,_0x60c53f,_0x45e310));});return Promise[_0x0428('0x49')](_0x4b2589)[_0x0428('0x9')](function(){_0xa5fbc8();})[_0x0428('0x1a')](function(){_0xa5fbc8();});}else{_0xa5fbc8();}});});}function getTags(_0x516835,_0x112e9c,_0x50486a,_0x56f835,_0x9e0460,_0x57bf3f){return function(_0x4fedca){return new Promise(function(_0x3979f6,_0x278d9f){var _0x5977b6=[];var _0x4fb248=_0x56f835[_0x0428('0x4b')];if(_0x4fb248&&_0x4fb248[_0x0428('0x24')]>0x0){_0x5977b6=_[_0x0428('0x4c')](_0x4fb248,_0x0428('0x36'));}if(_0x5977b6['length']>0x0){return manageTags(_0x516835,_0x5977b6,_0x112e9c,_0x50486a,_0x4fedca,_0x9e0460,_0x57bf3f)[_0x0428('0x9')](function(){_0x3979f6(_0x4fedca);});}else{_0x3979f6(_0x4fedca);}});};}function emit(_0x41f246,_0x1e3186,_0x2ee7c2){var _0x1c5d43=_0x0428('0x4d')+_0x0428('0x4e')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x0428('0x4f');var _0x270560={'uri':_0x41f246+_0x0428('0x50')+_0x2ee7c2+_0x1c5d43};io['to'](util[_0x0428('0x51')](_0x0428('0x52'),_0x1e3186))['emit'](_0x0428('0x53'),_0x270560);}exports['cs']=function(_0x4b4af1,_0x528436,_0x477088,_0x24c380,_0x2ffdf3,_0x7a16cb,_0x1b6a23,_0x884382){var _0x3a95bf={};var _0x3dbcb0={'user':_0x7a16cb['username'],'pass':_0x7a16cb[_0x0428('0x54')]};var _0x168153=_0x0428('0x55');var _0xe3ef4='sysparm_display_value=true';_0x7a16cb[_0x0428('0x56')]=intUtil[_0x0428('0x57')](_0x7a16cb[_0x0428('0x56')]);_0x7a16cb['serverUrl']=intUtil[_0x0428('0x57')](_0x7a16cb[_0x0428('0x58')]);var _0x5561ff=util['format'](_0x0428('0x59'),_0x7a16cb['remoteUri']);_0x3a95bf['userEmail']=!_[_0x0428('0x5a')](_0x24c380)?_0x24c380[_0x0428('0x5b')]:null;_0x3a95bf[_0x0428('0x1c')]=_0x7a16cb[_0x0428('0x5b')];_0x3a95bf[_0x0428('0x1e')]=_0x884382['toLowerCase']()===_0x0428('0x38')?_0x528436[_0x0428('0x5c')]:_0x528436[_0x0428('0x5d')];_0x3a95bf[_0x0428('0x5e')]=_0x884382===_0x0428('0x5f')||_0x884382==='unmanaged'?'queue':_0x0428('0x38');var _0x419709=util[_0x0428('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x7a16cb[_0x0428('0x58')],_0x528436[_0x0428('0x60')],md5(_0x528436[_0x0428('0x60')]));if(_0x2ffdf3&&_0x2ffdf3[_0x0428('0x61')]){logger[_0x0428('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x528436[_0x0428('0x62')]=_0x419709;}else if(_0x1b6a23&&_0x1b6a23[_0x0428('0x63')]&&_0x1b6a23[_0x0428('0x63')]!==_0x0428('0x64')){logger[_0x0428('0xd')](_0x0428('0x65'),_0x0428('0x66'));_0x528436[_0x0428('0x62')]=_0x419709;}else{_0x528436[_0x0428('0x62')]='';}return getAdminUser(_0x884382,_0x3dbcb0,_0x3a95bf,_0x5561ff,_0xe3ef4,_0x168153)[_0x0428('0x9')](getUser(_0x884382,_0x3dbcb0,_0x5561ff,_0xe3ef4,_0x168153))['then'](getEndUser(_0x884382,_0x3dbcb0,_0x5561ff,_0xe3ef4,_0x168153))[_0x0428('0x9')](getTicket(_0x884382,_0x3dbcb0,_0x5561ff,_0x477088,_0x528436,_0xe3ef4))[_0x0428('0x9')](function(_0x5546e8){logger[_0x0428('0xd')](util[_0x0428('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5546e8[_0x0428('0x3f')]));logger[_0x0428('0xd')](util['format']('call\x20direction:\x20%s',_0x884382));if(_0x884382!=='unmanaged'){logger[_0x0428('0xd')]('['+[_0x884382['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x7a16cb[_0x0428('0x56')],_0x24c380[_0x0428('0x36')],_0x5546e8[_0x0428('0x3f')]);}})[_0x0428('0x1a')](function(_0x736811){logger[_0x0428('0x10')]('['+[_0x884382[_0x0428('0xe')]()]+_0x0428('0x67'),util['inspect'](_0x736811,{'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 b5a4c13..cfe503b 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 _0x1e6b=['apiKey','base64','get_server_info','info','Getting\x20agent\x20with\x20name','Employees','user_name','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','map','customField','nameField','toLowerCase','content','string','custom_fields','toString','type','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','The\x20Enduser\x20ID\x20is:','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','unmanaged','lastevent','isNil','Fields','Inbound','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','defaults','localhost','socket.io-emitter','redis','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s'];(function(_0x5887d7,_0x424837){var _0x3e2ed2=function(_0x261cac){while(--_0x261cac){_0x5887d7['push'](_0x5887d7['shift']());}};_0x3e2ed2(++_0x424837);}(_0x1e6b,0xd0));var _0xb1e6=function(_0x144595,_0x13a043){_0x144595=_0x144595-0x0;var _0x4c8788=_0x1e6b[_0x144595];return _0x4c8788;};'use strict';var _=require(_0xb1e6('0x0'));var rp=require(_0xb1e6('0x1'));var BPromise=require('bluebird');var md5=require(_0xb1e6('0x2'));var util=require(_0xb1e6('0x3'));var Redis=require(_0xb1e6('0x4'));var intUtil=require(_0xb1e6('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb1e6('0x6'))(_0xb1e6('0x7'));config['redis']=_[_0xb1e6('0x8')](config['redis'],{'host':_0xb1e6('0x9'),'port':0x18eb});var io=require(_0xb1e6('0xa'))(new Redis(config[_0xb1e6('0xb')]));var def={'method':_0xb1e6('0xc'),'json':!![]};function emit(_0x4e142c,_0x30d003,_0x37cc31){io['to'](_0x4e142c)[_0xb1e6('0xd')](_0x30d003,_0x37cc31);}function getTicket(_0x579b96,_0x3af97c,_0x461983,_0x31b6f5,_0x3a4229,_0x78377f,_0x39b9d4,_0x564941){logger['info'](_0xb1e6('0xe'));var _0x15210e=new Date();var _0x55d3c3=[{'name':_0xb1e6('0xf'),'value':intUtil[_0xb1e6('0x10')](_0x31b6f5[_0xb1e6('0x11')],_0x3a4229,'\x20')},{'name':_0xb1e6('0x12'),'value':_0x3af97c['id']},{'name':_0xb1e6('0x13'),'value':_0x3af97c['id']},{'name':_0xb1e6('0x14'),'value':intUtil[_0xb1e6('0x10')](_0x31b6f5['Descriptions'],_0x3a4229,'\x0a')},{'name':_0xb1e6('0x15'),'value':_0x15210e[_0xb1e6('0x16')]()[_0xb1e6('0x17')](0x0,0x13)[_0xb1e6('0x18')]('T','\x20')},{'name':_0xb1e6('0x19'),'value':'0'},{'name':_0xb1e6('0x1a'),'value':'15'},{'name':_0xb1e6('0x1b'),'value':_0x461983['id']},{'name':'parent_type','value':_0xb1e6('0x1c')},{'name':'parent_name','value':_0x461983[_0xb1e6('0xf')]},{'name':'direction','value':_0x564941}];if(_0x78377f[_0xb1e6('0x1d')]){_[_0xb1e6('0x1e')](_0x78377f,function(_0x3c701f){if(_0x3a4229[_0x3c701f[_0xb1e6('0x1f')]]){_0x55d3c3[_0xb1e6('0x20')]({'name':_0x3c701f[_0xb1e6('0x21')],'value':_0x3a4229[_0x3c701f[_0xb1e6('0x1f')]]});}});}return request({'form':{'method':_0xb1e6('0x22'),'input_type':_0xb1e6('0x23'),'response_type':'JSON','rest_data':JSON[_0xb1e6('0x24')]({'session':_0x39b9d4['id'],'module_name':_0xb1e6('0x25'),'name_value_list':_0x55d3c3})}});}function getAuth(_0x4c7115){return util[_0xb1e6('0x26')](_0xb1e6('0x27'),new Buffer(_0x4c7115[_0xb1e6('0x28')]+':X')['toString'](_0xb1e6('0x29')));}function getServerInfo(_0x5727ea){return request({'form':{'method':_0xb1e6('0x2a'),'input_type':_0xb1e6('0x23'),'response_type':_0xb1e6('0x23'),'rest_data':JSON[_0xb1e6('0x24')]({'session':_0x5727ea['id']})}});}function getUser(_0x3cd067,_0x244610,_0x5854f6){if(!_['isNil'](_0x244610)){logger[_0xb1e6('0x2b')](_0xb1e6('0x2c'),_0x244610);return request({'form':{'method':'get_entry_list','input_type':_0xb1e6('0x23'),'response_type':_0xb1e6('0x23'),'rest_data':JSON[_0xb1e6('0x24')]({'session':_0x5854f6['id'],'module_name':_0xb1e6('0x2d'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x244610),'order_by':'','offset':'0','select_fields':['id',_0xb1e6('0xf'),_0xb1e6('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x394d80){if(_0x394d80[_0xb1e6('0x2f')][_0xb1e6('0x1d')]){var _0x3f84e5=_[_0xb1e6('0x30')](_0x394d80[_0xb1e6('0x2f')],function(_0x4bdf0b){return _0x4bdf0b[_0xb1e6('0x31')][_0xb1e6('0x2e')][_0xb1e6('0x32')]===_0x244610;});if(_0x3f84e5){logger['info'](_0xb1e6('0x33'));return BPromise[_0xb1e6('0x34')]({'id':_0x3f84e5[_0xb1e6('0x31')]['id'][_0xb1e6('0x32')],'name':_0x3f84e5[_0xb1e6('0x31')][_0xb1e6('0xf')][_0xb1e6('0x32')]});}}logger[_0xb1e6('0x2b')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x5854f6[_0xb1e6('0x31')][_0xb1e6('0x35')][_0xb1e6('0x32')],'name':_0x5854f6[_0xb1e6('0x31')][_0xb1e6('0x2e')][_0xb1e6('0x32')]});});}else{logger[_0xb1e6('0x2b')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x5854f6[_0xb1e6('0x31')]['user_id'][_0xb1e6('0x32')],'name':_0x5854f6['name_value_list']['user_name'][_0xb1e6('0x32')]});}}function getEndUser(_0xbaa75,_0x421255,_0xd3dd4a,_0x5e1ee0){logger[_0xb1e6('0x2b')](_0xb1e6('0x36'),_0xd3dd4a);return request({'form':{'method':_0xb1e6('0x37'),'input_type':_0xb1e6('0x23'),'response_type':_0xb1e6('0x23'),'rest_data':JSON['stringify']({'session':_0x5e1ee0['id'],'module_name':_0xb1e6('0x1c'),'query':util[_0xb1e6('0x26')](_0xb1e6('0x38'),_0xd3dd4a),'order_by':'','offset':'0','select_fields':['id',_0xb1e6('0xf'),_0xb1e6('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb1e6('0x3a')](function(_0x4e1a44){if(_0x4e1a44[_0xb1e6('0x2f')][_0xb1e6('0x1d')]){var _0x4cd86e=_['find'](_0x4e1a44['entry_list'],function(_0x139a46){return _0x139a46[_0xb1e6('0x31')][_0xb1e6('0x39')]['value']===_0xd3dd4a;});if(_0x4cd86e){logger[_0xb1e6('0x2b')](_0xb1e6('0x3b'));return BPromise[_0xb1e6('0x34')]({'id':_0x4cd86e[_0xb1e6('0x31')]['id'][_0xb1e6('0x32')],'name':_0x4cd86e[_0xb1e6('0x31')]['name'][_0xb1e6('0x32')],'phone':_0x4cd86e[_0xb1e6('0x31')]['phone_home'][_0xb1e6('0x32')]});}}else{logger[_0xb1e6('0x2b')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xb1e6('0x22'),'input_type':_0xb1e6('0x23'),'response_type':_0xb1e6('0x23'),'rest_data':JSON['stringify']({'session':_0x5e1ee0['id'],'module_name':_0xb1e6('0x1c'),'name_value_list':[{'name':'first_name','value':_0x421255!==_0xb1e6('0x3c')?_0x421255:util[_0xb1e6('0x26')](_0xb1e6('0x3d'),_0xd3dd4a)},{'name':'phone_home','value':_0xd3dd4a}]})}})[_0xb1e6('0x3a')](function(_0x1b1b96){logger[_0xb1e6('0x2b')](_0xb1e6('0x3e'));return BPromise[_0xb1e6('0x34')]({'id':_0x1b1b96['id'],'name':_0x1b1b96[_0xb1e6('0x2f')][_0xb1e6('0x3f')][_0xb1e6('0x32')],'phone':_0x1b1b96['entry_list'][_0xb1e6('0x39')][_0xb1e6('0x32')]});});}});}function request(_0x573652){logger[_0xb1e6('0x40')](_0xb1e6('0x41'),JSON[_0xb1e6('0x24')](_0x573652));return rp(_['merge'](def,_0x573652));}function getTags(_0x2d02d6,_0x29e247){var _0x40f45a=[];if(_0x2d02d6&&_0x2d02d6[_0xb1e6('0x1d')]>0x0){_0x40f45a=_[_0xb1e6('0x42')](_0x2d02d6,_0x29e247);}return _0x40f45a;}function getCustomFields(_0x11fc4d,_0x1b5c8a){var _0xfe6bf9=[];var _0x5eb0bc={'custom_fields':[]};if(_0x11fc4d['length']>0x0){_['forEach'](_0x11fc4d,function(_0xc3d23){if(_0xc3d23['type']==='string'&&_0xc3d23['nameField']&&!_0xc3d23[_0xb1e6('0x43')]){_0x5eb0bc[_0xc3d23[_0xb1e6('0x44')][_0xb1e6('0x45')]()]=_0xc3d23[_0xb1e6('0x46')]['toString']();}else if(_0xc3d23['type']===_0xb1e6('0x47')&&_0xc3d23[_0xb1e6('0x21')]&&_0xc3d23[_0xb1e6('0x43')]){_0x5eb0bc[_0xb1e6('0x48')][_0xb1e6('0x20')]({'id':_0xc3d23[_0xb1e6('0x21')],'value':_0xc3d23['content'][_0xb1e6('0x49')]()});}else if(_0xc3d23[_0xb1e6('0x4a')]===_0xb1e6('0x4b')&&_0xc3d23[_0xb1e6('0x1f')]&&_0xc3d23[_0xb1e6('0x21')]&&_0xc3d23[_0xb1e6('0x43')]){_0x1b5c8a[_0xc3d23[_0xb1e6('0x1f')]]&&_0x5eb0bc[_0xb1e6('0x48')]['push']({'id':_0xc3d23[_0xb1e6('0x21')],'value':_0x1b5c8a[_0xc3d23[_0xb1e6('0x1f')]][_0xb1e6('0x49')]()});}else if(_0xc3d23['type']===_0xb1e6('0x4c')&&_0xc3d23['Variable']&&_0xc3d23[_0xb1e6('0x4d')][_0xb1e6('0xf')]&&_0xc3d23[_0xb1e6('0x21')]&&_0xc3d23['customField']){_0x1b5c8a[_0xc3d23[_0xb1e6('0x4d')][_0xb1e6('0xf')][_0xb1e6('0x45')]()]&&_0x5eb0bc[_0xb1e6('0x48')][_0xb1e6('0x20')]({'id':_0xc3d23['idField'],'value':_0x1b5c8a[_0xc3d23['Variable'][_0xb1e6('0xf')][_0xb1e6('0x45')]()][_0xb1e6('0x49')]()});}});}return _0x5eb0bc;}function getConnection(_0x3fdb51){return request({'method':_0xb1e6('0xc'),'form':{'method':_0xb1e6('0x4e'),'input_type':_0xb1e6('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3fdb51[_0xb1e6('0x4f')],'password':_0x3fdb51[_0xb1e6('0x50')],'encryption':_0xb1e6('0x51')},'application':_0xb1e6('0x52')})}})[_0xb1e6('0x3a')](function(_0x14505e){var _0x24bb7f=_0x14505e;if(_0x24bb7f['id']){def[_0xb1e6('0x53')]=_0x24bb7f['id'];return BPromise[_0xb1e6('0x34')](_0x24bb7f);}else{throw new Error(util[_0xb1e6('0x26')](_0xb1e6('0x54'),_0x3fdb51['id']));}});}function setRelationship(_0x383a91,_0x533e5b,_0x56cb54,_0x5a1e69){return request({'form':{'method':_0xb1e6('0x55'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x383a91['id'],'module_name':_0xb1e6('0x25'),'module_id':_0x56cb54['id'],'link_field_name':_0x5a1e69,'related_ids':[_0x533e5b['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x549957,_0x554e82,_0x26786b,_0x44e206,_0x1b1323,_0x416ab1){var _0xc9260c,_0x521010,_0x5087b5,_0x348307;_0x416ab1[_0xb1e6('0x56')]=intUtil['stripTrailingSlash'](_0x416ab1[_0xb1e6('0x56')]);_0x416ab1['serverUrl']=intUtil[_0xb1e6('0x57')](_0x416ab1[_0xb1e6('0x58')]);def[_0xb1e6('0x59')]=util[_0xb1e6('0x26')]('%s/service/v4_1/rest.php',_0x416ab1[_0xb1e6('0x56')]);if(_0x1b1323&&_0x1b1323[_0xb1e6('0x5a')]){logger[_0xb1e6('0x2b')]('[QUEUE]',_0xb1e6('0x5b'));_0x554e82['recordingURL']=util[_0xb1e6('0x26')](_0xb1e6('0x5c'),_0x416ab1['serverUrl'],_0x554e82[_0xb1e6('0x5d')],md5(_0x554e82['uniqueid']));}else{_0x554e82[_0xb1e6('0x5e')]='';}return getConnection(_0x416ab1)[_0xb1e6('0x3a')](function(_0x2950df){_0x348307=_0x2950df;return getUser(_0x416ab1,_0x44e206[_0xb1e6('0xf')],_0x348307);})[_0xb1e6('0x3a')](function(_0x205d93){_0xc9260c=_0x205d93;logger['info']('The\x20User\x20ID\x20is:',_0xc9260c['id']);return getEndUser(_0x416ab1,_0x554e82[_0xb1e6('0x5f')],_0x554e82['calleridnum'],_0x348307);})[_0xb1e6('0x3a')](function(_0x5ea8a6){_0x521010=_0x5ea8a6;logger['info'](_0xb1e6('0x60'),_0x521010['id']);return getTicket(_0x416ab1,_0xc9260c,_0x521010,_0x26786b,_0x554e82,_0x26786b['Fields'],_0x348307,'Inbound');})['then'](function(_0x257daa){_0x5087b5=_0x257daa;logger['info'](_0xb1e6('0x61'));logger[_0xb1e6('0x2b')](_0xb1e6('0x62'),_0x5087b5['id']);return setRelationship(_0x348307,_0xc9260c,_0x5087b5,_0xb1e6('0x63'));})[_0xb1e6('0x3a')](function(){return setRelationship(_0x348307,_0x521010,_0x5087b5,_0xb1e6('0x64'));})[_0xb1e6('0x3a')](function(){return getServerInfo(_0x348307);})[_0xb1e6('0x3a')](function(_0x43fa76){var _0x427c56=parseInt(_0x43fa76[_0xb1e6('0x65')][_0xb1e6('0x66')](0x0));var _0x323b55=util[_0xb1e6('0x26')](_0xb1e6('0x67'),_0x416ab1[_0xb1e6('0x56')],_0x5087b5['id']);if(_0x427c56>0x6){_0x323b55=util[_0xb1e6('0x26')](_0xb1e6('0x68'),_0x416ab1[_0xb1e6('0x56')],_0x5087b5['id']);}logger[_0xb1e6('0x2b')](_0xb1e6('0x69'),_0xb1e6('0x6a'));emit(util['format'](_0xb1e6('0x6b'),_0x44e206[_0xb1e6('0xf')]),_0xb1e6('0x6c'),{'uri':_0x323b55});})[_0xb1e6('0x6d')](function(_0x31f16a){logger[_0xb1e6('0x6e')](_0xb1e6('0x69'),JSON['stringify'](_0x31f16a));});};exports[_0xb1e6('0x6f')]=function(_0x505957,_0x17abd4,_0x13246a,_0x1a8376,_0x3c1033,_0x588441,_0x4715c0){var _0x42a71c,_0x3c82ac,_0x418760,_0x4003fa;_0x588441[_0xb1e6('0x56')]=intUtil[_0xb1e6('0x57')](_0x588441['remoteUri']);_0x588441[_0xb1e6('0x58')]=intUtil[_0xb1e6('0x57')](_0x588441[_0xb1e6('0x58')]);def[_0xb1e6('0x59')]=util[_0xb1e6('0x26')](_0xb1e6('0x70'),_0x588441[_0xb1e6('0x56')]);if(_0x4715c0&&_0x4715c0[_0xb1e6('0x71')]&&_0x4715c0[_0xb1e6('0x71')]!=='none'){logger[_0xb1e6('0x2b')](_0xb1e6('0x72'),'Recording\x20is\x20enabled!');_0x17abd4[_0xb1e6('0x5e')]=util['format'](_0xb1e6('0x5c'),_0x588441['serverUrl'],_0x17abd4[_0xb1e6('0x5d')],md5(_0x17abd4[_0xb1e6('0x5d')]));}return getConnection(_0x588441)[_0xb1e6('0x3a')](function(_0x487e51){_0x4003fa=_0x487e51;return getUser(_0x588441,_0x1a8376['name'],_0x4003fa);})['then'](function(_0x3b9861){_0x42a71c=_0x3b9861;logger[_0xb1e6('0x2b')](_0xb1e6('0x73'),_0x42a71c['id']);return getEndUser(_0x588441,_0x17abd4[_0xb1e6('0x74')],_0x17abd4[_0xb1e6('0x75')],_0x4003fa);})[_0xb1e6('0x3a')](function(_0x53eb2a){_0x3c82ac=_0x53eb2a;logger[_0xb1e6('0x2b')](_0xb1e6('0x60'),_0x3c82ac['id']);return getTicket(_0x588441,_0x42a71c,_0x3c82ac,_0x13246a,_0x17abd4,_0x13246a['Fields'],_0x4003fa,'Outbound');})[_0xb1e6('0x3a')](function(_0x4e2545){_0x418760=_0x4e2545;logger[_0xb1e6('0x2b')]('Ticket\x20created!');logger['info'](_0xb1e6('0x62'),_0x418760['id']);return setRelationship(_0x4003fa,_0x42a71c,_0x418760,_0xb1e6('0x63'));})['then'](function(){return setRelationship(_0x4003fa,_0x3c82ac,_0x418760,_0xb1e6('0x64'));})['then'](function(){return getServerInfo(_0x4003fa);})['then'](function(_0x476125){var _0x24b0ac=parseInt(_0x476125[_0xb1e6('0x65')][_0xb1e6('0x66')](0x0));var _0x33f330=util['format'](_0xb1e6('0x67'),_0x588441[_0xb1e6('0x56')],_0x418760['id']);if(_0x24b0ac>0x6){_0x33f330=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x588441['remoteUri'],_0x418760['id']);}logger[_0xb1e6('0x2b')](_0xb1e6('0x72'),_0xb1e6('0x6a'));emit(util['format'](_0xb1e6('0x6b'),_0x1a8376[_0xb1e6('0xf')]),_0xb1e6('0x6c'),{'uri':_0x33f330});})[_0xb1e6('0x6d')](function(_0x3a217b){logger['error'](_0xb1e6('0x72'),JSON[_0xb1e6('0x24')](_0x3a217b));});};exports[_0xb1e6('0x76')]=function(_0x4feee2,_0x4e5e16,_0x10ded0,_0x37143c,_0x55480,_0x40a417){var _0x273b73,_0x4454b9,_0x52218b,_0x4a8007;_0x40a417[_0xb1e6('0x56')]=intUtil[_0xb1e6('0x57')](_0x40a417[_0xb1e6('0x56')]);_0x40a417[_0xb1e6('0x58')]=intUtil[_0xb1e6('0x57')](_0x40a417['serverUrl']);def[_0xb1e6('0x59')]=util['format'](_0xb1e6('0x70'),_0x40a417[_0xb1e6('0x56')]);if(_0x55480&&_0x55480['monitor_format']){logger[_0xb1e6('0x2b')]('['+_0x4e5e16[_0xb1e6('0x77')]['toUpperCase']()+']',_0xb1e6('0x5b'));_0x4e5e16[_0xb1e6('0x5e')]=util[_0xb1e6('0x26')](_0xb1e6('0x5c'),_0x40a417['serverUrl'],_0x4e5e16[_0xb1e6('0x5d')],md5(_0x4e5e16[_0xb1e6('0x5d')]));}else{_0x4e5e16['recordingURL']='';}return getConnection(_0x40a417)['then'](function(_0x15c8d5){_0x4a8007=_0x15c8d5;if(!_[_0xb1e6('0x78')](_0x37143c)){return getUser(_0x40a417,_0x37143c[_0xb1e6('0xf')],_0x4a8007);}else{return getUser(_0x40a417,null,_0x4a8007);}})[_0xb1e6('0x3a')](function(_0x1d0d67){_0x273b73=_0x1d0d67;logger[_0xb1e6('0x2b')](_0xb1e6('0x73'),_0x273b73['id']);return getEndUser(_0x40a417,_0x4e5e16[_0xb1e6('0x5f')],_0x4e5e16['calleridnum'],_0x4a8007);})['then'](function(_0x554280){_0x4454b9=_0x554280;logger['info'](_0xb1e6('0x60'),_0x4454b9['id']);return getTicket(_0x40a417,_0x273b73,_0x4454b9,_0x10ded0,_0x4e5e16,_0x10ded0[_0xb1e6('0x79')],_0x4a8007,_0xb1e6('0x7a'));})[_0xb1e6('0x3a')](function(_0x89b337){_0x52218b=_0x89b337;logger['info'](_0xb1e6('0x61'));logger[_0xb1e6('0x2b')]('The\x20Ticket\x20ID\x20is:',_0x52218b['id']);return setRelationship(_0x4a8007,_0x273b73,_0x52218b,_0xb1e6('0x63'));})[_0xb1e6('0x3a')](function(){return setRelationship(_0x4a8007,_0x4454b9,_0x52218b,'contacts');})[_0xb1e6('0x3a')](function(){return getServerInfo(_0x4a8007);})[_0xb1e6('0x6d')](function(_0x28bba5){logger[_0xb1e6('0x6e')]('['+_0x4e5e16[_0xb1e6('0x77')][_0xb1e6('0x7b')]()+']',JSON[_0xb1e6('0x24')](_0x28bba5));});}; \ No newline at end of file +var _0x499d=['Descriptions','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','length','forEach','variableName','push','JSON','stringify','format','Basic\x20%s','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','phone_home','debug','[HTTP]','merge','type','customField','nameField','toLowerCase','content','string','idField','custom_fields','toString','variable','customVariable','Variable','POST','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','charAt','error','monitor_format','lastevent','toUpperCase','isNil','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description'];(function(_0x4ba260,_0x3deaa1){var _0x943ccc=function(_0x41a505){while(--_0x41a505){_0x4ba260['push'](_0x4ba260['shift']());}};_0x943ccc(++_0x3deaa1);}(_0x499d,0x1e3));var _0xd499=function(_0x1c8845,_0xdc370b){_0x1c8845=_0x1c8845-0x0;var _0x1d0694=_0x499d[_0x1c8845];return _0x1d0694;};'use strict';var _=require(_0xd499('0x0'));var rp=require(_0xd499('0x1'));var BPromise=require(_0xd499('0x2'));var md5=require(_0xd499('0x3'));var util=require(_0xd499('0x4'));var Redis=require(_0xd499('0x5'));var intUtil=require(_0xd499('0x6'));var config=require(_0xd499('0x7'));var logger=require(_0xd499('0x8'))(_0xd499('0x9'));config[_0xd499('0xa')]=_['defaults'](config[_0xd499('0xa')],{'host':_0xd499('0xb'),'port':0x18eb});var io=require(_0xd499('0xc'))(new Redis(config[_0xd499('0xa')]));var def={'method':'POST','json':!![]};function emit(_0x3cff5c,_0xba4d85,_0x24c947){io['to'](_0x3cff5c)[_0xd499('0xd')](_0xba4d85,_0x24c947);}function getTicket(_0x1a84de,_0x12f656,_0x3ae682,_0xa10ff9,_0x187dcf,_0x36ee88,_0x117528,_0x162508){logger[_0xd499('0xe')](_0xd499('0xf'));var _0x36b593=new Date();var _0x79ceaf=[{'name':'name','value':intUtil[_0xd499('0x10')](_0xa10ff9[_0xd499('0x11')],_0x187dcf,'\x20')},{'name':_0xd499('0x12'),'value':_0x12f656['id']},{'name':_0xd499('0x13'),'value':_0x12f656['id']},{'name':_0xd499('0x14'),'value':intUtil[_0xd499('0x10')](_0xa10ff9[_0xd499('0x15')],_0x187dcf,'\x0a')},{'name':'date_start','value':_0x36b593[_0xd499('0x16')]()[_0xd499('0x17')](0x0,0x13)[_0xd499('0x18')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xd499('0x19'),'value':'15'},{'name':_0xd499('0x1a'),'value':_0x3ae682['id']},{'name':_0xd499('0x1b'),'value':_0xd499('0x1c')},{'name':_0xd499('0x1d'),'value':_0x3ae682[_0xd499('0x1e')]},{'name':_0xd499('0x1f'),'value':_0x162508}];if(_0x36ee88[_0xd499('0x20')]){_[_0xd499('0x21')](_0x36ee88,function(_0x1d99cf){if(_0x187dcf[_0x1d99cf[_0xd499('0x22')]]){_0x79ceaf[_0xd499('0x23')]({'name':_0x1d99cf['idField'],'value':_0x187dcf[_0x1d99cf[_0xd499('0x22')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xd499('0x24'),'response_type':'JSON','rest_data':JSON[_0xd499('0x25')]({'session':_0x117528['id'],'module_name':'Calls','name_value_list':_0x79ceaf})}});}function getAuth(_0x286de1){return util[_0xd499('0x26')](_0xd499('0x27'),new Buffer(_0x286de1['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x14015f){return request({'form':{'method':'get_server_info','input_type':_0xd499('0x24'),'response_type':_0xd499('0x24'),'rest_data':JSON[_0xd499('0x25')]({'session':_0x14015f['id']})}});}function getUser(_0xf00bb5,_0x313371,_0x465662){if(!_['isNil'](_0x313371)){logger[_0xd499('0xe')]('Getting\x20agent\x20with\x20name',_0x313371);return request({'form':{'method':_0xd499('0x28'),'input_type':_0xd499('0x24'),'response_type':_0xd499('0x24'),'rest_data':JSON[_0xd499('0x25')]({'session':_0x465662['id'],'module_name':_0xd499('0x29'),'query':util['format'](_0xd499('0x2a'),_0x313371),'order_by':'','offset':'0','select_fields':['id',_0xd499('0x1e'),_0xd499('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd499('0x2c')](function(_0x4a7ddc){if(_0x4a7ddc[_0xd499('0x2d')]['length']){var _0x35da1c=_[_0xd499('0x2e')](_0x4a7ddc[_0xd499('0x2d')],function(_0x12bab4){return _0x12bab4['name_value_list'][_0xd499('0x2b')][_0xd499('0x2f')]===_0x313371;});if(_0x35da1c){logger[_0xd499('0xe')](_0xd499('0x30'));return BPromise['resolve']({'id':_0x35da1c['name_value_list']['id'][_0xd499('0x2f')],'name':_0x35da1c['name_value_list'][_0xd499('0x1e')][_0xd499('0x2f')]});}}logger[_0xd499('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd499('0x31')]({'id':_0x465662[_0xd499('0x32')][_0xd499('0x33')][_0xd499('0x2f')],'name':_0x465662[_0xd499('0x32')][_0xd499('0x2b')]['value']});});}else{logger[_0xd499('0xe')](_0xd499('0x34'));return BPromise[_0xd499('0x31')]({'id':_0x465662[_0xd499('0x32')][_0xd499('0x33')][_0xd499('0x2f')],'name':_0x465662[_0xd499('0x32')][_0xd499('0x2b')]['value']});}}function getEndUser(_0x14d956,_0x3d1887,_0x5856ff,_0x4bfb2f){logger[_0xd499('0xe')](_0xd499('0x35'),_0x5856ff);return request({'form':{'method':_0xd499('0x28'),'input_type':_0xd499('0x24'),'response_type':_0xd499('0x24'),'rest_data':JSON[_0xd499('0x25')]({'session':_0x4bfb2f['id'],'module_name':_0xd499('0x1c'),'query':util[_0xd499('0x26')](_0xd499('0x36'),_0x5856ff),'order_by':'','offset':'0','select_fields':['id',_0xd499('0x1e'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x36a843){if(_0x36a843['entry_list'][_0xd499('0x20')]){var _0x332740=_[_0xd499('0x2e')](_0x36a843[_0xd499('0x2d')],function(_0x852f78){return _0x852f78['name_value_list']['phone_home']['value']===_0x5856ff;});if(_0x332740){logger['info'](_0xd499('0x37'));return BPromise[_0xd499('0x31')]({'id':_0x332740[_0xd499('0x32')]['id']['value'],'name':_0x332740['name_value_list'][_0xd499('0x1e')][_0xd499('0x2f')],'phone':_0x332740[_0xd499('0x32')]['phone_home']['value']});}}else{logger[_0xd499('0xe')](_0xd499('0x38'));return request({'form':{'method':_0xd499('0x39'),'input_type':_0xd499('0x24'),'response_type':'JSON','rest_data':JSON[_0xd499('0x25')]({'session':_0x4bfb2f['id'],'module_name':_0xd499('0x1c'),'name_value_list':[{'name':_0xd499('0x3a'),'value':_0x3d1887!==_0xd499('0x3b')?_0x3d1887:util['format'](_0xd499('0x3c'),_0x5856ff)},{'name':_0xd499('0x3d'),'value':_0x5856ff}]})}})['then'](function(_0x419e8f){logger['info']('Enduser\x20created.');return BPromise[_0xd499('0x31')]({'id':_0x419e8f['id'],'name':_0x419e8f[_0xd499('0x2d')][_0xd499('0x3a')][_0xd499('0x2f')],'phone':_0x419e8f[_0xd499('0x2d')][_0xd499('0x3d')][_0xd499('0x2f')]});});}});}function request(_0x5336d0){logger[_0xd499('0x3e')](_0xd499('0x3f'),JSON[_0xd499('0x25')](_0x5336d0));return rp(_[_0xd499('0x40')](def,_0x5336d0));}function getTags(_0x23c397,_0x1ac9fe){var _0x4dacb2=[];if(_0x23c397&&_0x23c397[_0xd499('0x20')]>0x0){_0x4dacb2=_['map'](_0x23c397,_0x1ac9fe);}return _0x4dacb2;}function getCustomFields(_0x20e57d,_0x571749){var _0x491f5a=[];var _0x535fa7={'custom_fields':[]};if(_0x20e57d[_0xd499('0x20')]>0x0){_['forEach'](_0x20e57d,function(_0x34332c){if(_0x34332c[_0xd499('0x41')]==='string'&&_0x34332c['nameField']&&!_0x34332c[_0xd499('0x42')]){_0x535fa7[_0x34332c[_0xd499('0x43')][_0xd499('0x44')]()]=_0x34332c[_0xd499('0x45')]['toString']();}else if(_0x34332c[_0xd499('0x41')]===_0xd499('0x46')&&_0x34332c[_0xd499('0x47')]&&_0x34332c[_0xd499('0x42')]){_0x535fa7[_0xd499('0x48')][_0xd499('0x23')]({'id':_0x34332c[_0xd499('0x47')],'value':_0x34332c[_0xd499('0x45')][_0xd499('0x49')]()});}else if(_0x34332c[_0xd499('0x41')]===_0xd499('0x4a')&&_0x34332c[_0xd499('0x22')]&&_0x34332c['idField']&&_0x34332c['customField']){_0x571749[_0x34332c[_0xd499('0x22')]]&&_0x535fa7['custom_fields']['push']({'id':_0x34332c[_0xd499('0x47')],'value':_0x571749[_0x34332c[_0xd499('0x22')]][_0xd499('0x49')]()});}else if(_0x34332c['type']===_0xd499('0x4b')&&_0x34332c[_0xd499('0x4c')]&&_0x34332c[_0xd499('0x4c')][_0xd499('0x1e')]&&_0x34332c[_0xd499('0x47')]&&_0x34332c[_0xd499('0x42')]){_0x571749[_0x34332c[_0xd499('0x4c')]['name'][_0xd499('0x44')]()]&&_0x535fa7[_0xd499('0x48')]['push']({'id':_0x34332c['idField'],'value':_0x571749[_0x34332c[_0xd499('0x4c')]['name']['toLowerCase']()]['toString']()});}});}return _0x535fa7;}function getConnection(_0x2b86a1){return request({'method':_0xd499('0x4d'),'form':{'method':'login','input_type':'JSON','response_type':_0xd499('0x24'),'rest_data':JSON[_0xd499('0x25')]({'user_auth':{'user_name':_0x2b86a1[_0xd499('0x4e')],'password':_0x2b86a1['password'],'encryption':_0xd499('0x4f')},'application':_0xd499('0x50')})}})['then'](function(_0x4d8115){var _0xba26ac=_0x4d8115;if(_0xba26ac['id']){def[_0xd499('0x51')]=_0xba26ac['id'];return BPromise[_0xd499('0x31')](_0xba26ac);}else{throw new Error(util[_0xd499('0x26')](_0xd499('0x52'),_0x2b86a1['id']));}});}function setRelationship(_0x715641,_0x455771,_0x2e0c7b,_0x42d1c0){return request({'form':{'method':_0xd499('0x53'),'input_type':'JSON','response_type':_0xd499('0x24'),'rest_data':JSON['stringify']({'session':_0x715641['id'],'module_name':_0xd499('0x54'),'module_id':_0x2e0c7b['id'],'link_field_name':_0x42d1c0,'related_ids':[_0x455771['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd499('0x55')]=function(_0x4eb674,_0x35b383,_0x56afab,_0x363174,_0x474f84,_0x146e37){var _0x565071,_0x1767e2,_0x875996,_0x41b8b3;_0x146e37[_0xd499('0x56')]=intUtil[_0xd499('0x57')](_0x146e37[_0xd499('0x56')]);_0x146e37[_0xd499('0x58')]=intUtil[_0xd499('0x57')](_0x146e37[_0xd499('0x58')]);def[_0xd499('0x59')]=util[_0xd499('0x26')](_0xd499('0x5a'),_0x146e37[_0xd499('0x56')]);if(_0x474f84&&_0x474f84['monitor_format']){logger[_0xd499('0xe')](_0xd499('0x5b'),_0xd499('0x5c'));_0x35b383[_0xd499('0x5d')]=util[_0xd499('0x26')](_0xd499('0x5e'),_0x146e37['serverUrl'],_0x35b383['uniqueid'],md5(_0x35b383[_0xd499('0x5f')]));}else{_0x35b383['recordingURL']='';}return getConnection(_0x146e37)[_0xd499('0x2c')](function(_0xc8190){_0x41b8b3=_0xc8190;return getUser(_0x146e37,_0x363174[_0xd499('0x1e')],_0x41b8b3);})['then'](function(_0xf5da8b){_0x565071=_0xf5da8b;logger[_0xd499('0xe')](_0xd499('0x60'),_0x565071['id']);return getEndUser(_0x146e37,_0x35b383[_0xd499('0x61')],_0x35b383[_0xd499('0x62')],_0x41b8b3);})[_0xd499('0x2c')](function(_0x4ee41c){_0x1767e2=_0x4ee41c;logger[_0xd499('0xe')](_0xd499('0x63'),_0x1767e2['id']);return getTicket(_0x146e37,_0x565071,_0x1767e2,_0x56afab,_0x35b383,_0x56afab[_0xd499('0x64')],_0x41b8b3,_0xd499('0x65'));})[_0xd499('0x2c')](function(_0x5630bd){_0x875996=_0x5630bd;logger[_0xd499('0xe')](_0xd499('0x66'));logger[_0xd499('0xe')]('The\x20Ticket\x20ID\x20is:',_0x875996['id']);return setRelationship(_0x41b8b3,_0x565071,_0x875996,_0xd499('0x67'));})[_0xd499('0x2c')](function(){return setRelationship(_0x41b8b3,_0x1767e2,_0x875996,_0xd499('0x68'));})[_0xd499('0x2c')](function(){return getServerInfo(_0x41b8b3);})[_0xd499('0x2c')](function(_0x2fb52c){var _0x39f8b6=parseInt(_0x2fb52c[_0xd499('0x69')]['charAt'](0x0));var _0x3bbbd7=util[_0xd499('0x26')](_0xd499('0x6a'),_0x146e37[_0xd499('0x56')],_0x875996['id']);if(_0x39f8b6>0x6){_0x3bbbd7=util[_0xd499('0x26')](_0xd499('0x6b'),_0x146e37[_0xd499('0x56')],_0x875996['id']);}logger['info']('[QUEUE]',_0xd499('0x6c'));emit(util[_0xd499('0x26')](_0xd499('0x6d'),_0x363174[_0xd499('0x1e')]),_0xd499('0x6e'),{'uri':_0x3bbbd7});})[_0xd499('0x6f')](function(_0x231fb0){logger['error'](_0xd499('0x5b'),JSON[_0xd499('0x25')](_0x231fb0));});};exports[_0xd499('0x70')]=function(_0x1e6f07,_0x5be546,_0x580902,_0x102ed7,_0x169a4d,_0x2a0c4c,_0x5aa8b0){var _0x3eda9a,_0x5c9567,_0x67b5f8,_0x32d9c4;_0x2a0c4c[_0xd499('0x56')]=intUtil[_0xd499('0x57')](_0x2a0c4c[_0xd499('0x56')]);_0x2a0c4c[_0xd499('0x58')]=intUtil['stripTrailingSlash'](_0x2a0c4c['serverUrl']);def['uri']=util[_0xd499('0x26')](_0xd499('0x5a'),_0x2a0c4c[_0xd499('0x56')]);if(_0x5aa8b0&&_0x5aa8b0[_0xd499('0x71')]&&_0x5aa8b0[_0xd499('0x71')]!==_0xd499('0x72')){logger[_0xd499('0xe')](_0xd499('0x73'),_0xd499('0x5c'));_0x5be546[_0xd499('0x5d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a0c4c[_0xd499('0x58')],_0x5be546[_0xd499('0x5f')],md5(_0x5be546['uniqueid']));}return getConnection(_0x2a0c4c)['then'](function(_0x5a6373){_0x32d9c4=_0x5a6373;return getUser(_0x2a0c4c,_0x102ed7['name'],_0x32d9c4);})[_0xd499('0x2c')](function(_0x148264){_0x3eda9a=_0x148264;logger[_0xd499('0xe')](_0xd499('0x60'),_0x3eda9a['id']);return getEndUser(_0x2a0c4c,_0x5be546[_0xd499('0x74')],_0x5be546[_0xd499('0x75')],_0x32d9c4);})['then'](function(_0x41ab6c){_0x5c9567=_0x41ab6c;logger['info'](_0xd499('0x63'),_0x5c9567['id']);return getTicket(_0x2a0c4c,_0x3eda9a,_0x5c9567,_0x580902,_0x5be546,_0x580902['Fields'],_0x32d9c4,_0xd499('0x76'));})[_0xd499('0x2c')](function(_0x36fe34){_0x67b5f8=_0x36fe34;logger['info'](_0xd499('0x66'));logger[_0xd499('0xe')](_0xd499('0x77'),_0x67b5f8['id']);return setRelationship(_0x32d9c4,_0x3eda9a,_0x67b5f8,_0xd499('0x67'));})['then'](function(){return setRelationship(_0x32d9c4,_0x5c9567,_0x67b5f8,_0xd499('0x68'));})[_0xd499('0x2c')](function(){return getServerInfo(_0x32d9c4);})[_0xd499('0x2c')](function(_0x5ac9a2){var _0xaf3cd0=parseInt(_0x5ac9a2['version'][_0xd499('0x78')](0x0));var _0x947b40=util['format'](_0xd499('0x6a'),_0x2a0c4c[_0xd499('0x56')],_0x67b5f8['id']);if(_0xaf3cd0>0x6){_0x947b40=util[_0xd499('0x26')](_0xd499('0x6b'),_0x2a0c4c[_0xd499('0x56')],_0x67b5f8['id']);}logger['info'](_0xd499('0x73'),_0xd499('0x6c'));emit(util[_0xd499('0x26')](_0xd499('0x6d'),_0x102ed7[_0xd499('0x1e')]),_0xd499('0x6e'),{'uri':_0x947b40});})[_0xd499('0x6f')](function(_0x3e4731){logger[_0xd499('0x79')](_0xd499('0x73'),JSON[_0xd499('0x25')](_0x3e4731));});};exports['unmanaged']=function(_0x57f862,_0x508638,_0x1057d6,_0x85c1ec,_0x53c516,_0x2d9e0d){var _0x41cc40,_0x570531,_0x169a9e,_0x5828d9;_0x2d9e0d['remoteUri']=intUtil[_0xd499('0x57')](_0x2d9e0d['remoteUri']);_0x2d9e0d['serverUrl']=intUtil['stripTrailingSlash'](_0x2d9e0d[_0xd499('0x58')]);def[_0xd499('0x59')]=util[_0xd499('0x26')](_0xd499('0x5a'),_0x2d9e0d[_0xd499('0x56')]);if(_0x53c516&&_0x53c516[_0xd499('0x7a')]){logger['info']('['+_0x508638[_0xd499('0x7b')][_0xd499('0x7c')]()+']',_0xd499('0x5c'));_0x508638[_0xd499('0x5d')]=util[_0xd499('0x26')](_0xd499('0x5e'),_0x2d9e0d[_0xd499('0x58')],_0x508638[_0xd499('0x5f')],md5(_0x508638['uniqueid']));}else{_0x508638[_0xd499('0x5d')]='';}return getConnection(_0x2d9e0d)['then'](function(_0x16cf0b){_0x5828d9=_0x16cf0b;if(!_[_0xd499('0x7d')](_0x85c1ec)){return getUser(_0x2d9e0d,_0x85c1ec[_0xd499('0x1e')],_0x5828d9);}else{return getUser(_0x2d9e0d,null,_0x5828d9);}})[_0xd499('0x2c')](function(_0x1cae9c){_0x41cc40=_0x1cae9c;logger[_0xd499('0xe')](_0xd499('0x60'),_0x41cc40['id']);return getEndUser(_0x2d9e0d,_0x508638['calleridname'],_0x508638[_0xd499('0x62')],_0x5828d9);})[_0xd499('0x2c')](function(_0x4eb707){_0x570531=_0x4eb707;logger['info']('The\x20Enduser\x20ID\x20is:',_0x570531['id']);return getTicket(_0x2d9e0d,_0x41cc40,_0x570531,_0x1057d6,_0x508638,_0x1057d6[_0xd499('0x64')],_0x5828d9,_0xd499('0x65'));})[_0xd499('0x2c')](function(_0x15928f){_0x169a9e=_0x15928f;logger[_0xd499('0xe')](_0xd499('0x66'));logger['info'](_0xd499('0x77'),_0x169a9e['id']);return setRelationship(_0x5828d9,_0x41cc40,_0x169a9e,'users');})[_0xd499('0x2c')](function(){return setRelationship(_0x5828d9,_0x570531,_0x169a9e,'contacts');})[_0xd499('0x2c')](function(){return getServerInfo(_0x5828d9);})[_0xd499('0x6f')](function(_0x550ba1){logger[_0xd499('0x79')]('['+_0x508638['lastevent'][_0xd499('0x7c')]()+']',JSON['stringify'](_0x550ba1));});}; \ 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 97c6684..7a66fed 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 _0xce4a=['variableName','toString','Variable','name','keyValue','keyType','key','format','keyContent','%s:\x20%s','customVariable','toLowerCase','join','stripTrailingSlash','slice','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','content','variable'];(function(_0x2ddc04,_0x6127fb){var _0x117415=function(_0xb7fb9d){while(--_0xb7fb9d){_0x2ddc04['push'](_0x2ddc04['shift']());}};_0x117415(++_0x6127fb);}(_0xce4a,0x10e));var _0xace4=function(_0x42d1d7,_0x43dccd){_0x42d1d7=_0x42d1d7-0x0;var _0xc9d4eb=_0xce4a[_0x42d1d7];return _0xc9d4eb;};'use strict';var _=require(_0xace4('0x0'));var util=require(_0xace4('0x1'));exports[_0xace4('0x2')]=function(_0x162ab1,_0x13b5d6,_0x58a712){var _0x1a0d97=[];if(_0x162ab1[_0xace4('0x3')]>0x0){var _0x3b1fdf=_[_0xace4('0x4')](_0x162ab1,['id']);for(var _0x3ef5e7=0x0;_0x3ef5e7<_0x3b1fdf['length'];_0x3ef5e7++){var _0x2596a0=_0x3b1fdf[_0x3ef5e7];if(_0x2596a0[_0xace4('0x5')]===_0xace4('0x6')){_0x1a0d97[_0xace4('0x7')](_0x2596a0[_0xace4('0x8')]);}else if(_0x2596a0['type']===_0xace4('0x9')&&_0x2596a0[_0xace4('0xa')]){_0x13b5d6[_0x2596a0['variableName']]&&_0x1a0d97[_0xace4('0x7')](_0x13b5d6[_0x2596a0[_0xace4('0xa')]][_0xace4('0xb')]());}else if(_0x2596a0['type']==='customVariable'&&_0x2596a0['Variable']&&_0x2596a0[_0xace4('0xc')][_0xace4('0xd')]){_0x13b5d6[_0x2596a0[_0xace4('0xc')]['name']['toLowerCase']()]&&_0x1a0d97[_0xace4('0x7')](_0x13b5d6[_0x2596a0[_0xace4('0xc')][_0xace4('0xd')]['toLowerCase']()]['toString']());}else if(_0x2596a0[_0xace4('0x5')]===_0xace4('0xe')){if(_0x2596a0[_0xace4('0xf')]===_0xace4('0x6')&&_0x2596a0[_0xace4('0x10')]){_0x1a0d97[_0xace4('0x7')](util[_0xace4('0x11')]('%s:\x20%s',_0x2596a0[_0xace4('0x10')],_0x2596a0[_0xace4('0x12')]));}else if(_0x2596a0[_0xace4('0xf')]==='variable'&&_0x2596a0[_0xace4('0xa')]&&_0x2596a0[_0xace4('0x10')]){_0x13b5d6[_0x2596a0[_0xace4('0xa')]]&&_0x1a0d97[_0xace4('0x7')](util['format'](_0xace4('0x13'),_0x2596a0[_0xace4('0x10')],_0x13b5d6[_0x2596a0[_0xace4('0xa')]]));}else if(_0x2596a0[_0xace4('0xf')]===_0xace4('0x14')&&_0x2596a0[_0xace4('0xc')]&&_0x2596a0[_0xace4('0xc')][_0xace4('0xd')]&&_0x2596a0[_0xace4('0x10')]){_0x13b5d6[_0x2596a0[_0xace4('0xc')][_0xace4('0xd')][_0xace4('0x15')]()]&&_0x1a0d97[_0xace4('0x7')](util[_0xace4('0x11')]('%s:\x20%s',_0x2596a0[_0xace4('0x10')],_0x13b5d6[_0x2596a0[_0xace4('0xc')][_0xace4('0xd')]['toLowerCase']()]));}}}}return _0x1a0d97[_0xace4('0x16')](_0x58a712);};exports[_0xace4('0x17')]=function(_0x180827){var _0x1f6d68=_0x180827[_0xace4('0x18')](-0x1);if(_0x1f6d68==='/'){_0x180827=_0x180827['substring'](0x0,_0x180827['lastIndexOf'](_0x1f6d68));}return _0x180827;};exports[_0xace4('0x19')]=function(_0x4eae69){if(!_[_0xace4('0x1a')](_0x4eae69)&&_0x4eae69!==''){var _0x480f40=/^(([^<>()\[\]\\.,;:\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 _0x480f40[_0xace4('0x1b')](String(_0x4eae69)[_0xace4('0x15')]());}else{return![];}}; \ No newline at end of file +var _0xf18d=['string','content','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','join','stripTrailingSlash','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','sortBy','type'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0xf18d,0x1aa));var _0xdf18=function(_0x544008,_0x2119a8){_0x544008=_0x544008-0x0;var _0xefc5ef=_0xf18d[_0x544008];return _0xefc5ef;};'use strict';var _=require(_0xdf18('0x0'));var util=require(_0xdf18('0x1'));exports[_0xdf18('0x2')]=function(_0x45da01,_0x356ff6,_0x4d5de7){var _0x54ba67=[];if(_0x45da01[_0xdf18('0x3')]>0x0){var _0x19af1a=_[_0xdf18('0x4')](_0x45da01,['id']);for(var _0x775bd=0x0;_0x775bd<_0x19af1a[_0xdf18('0x3')];_0x775bd++){var _0x15f086=_0x19af1a[_0x775bd];if(_0x15f086[_0xdf18('0x5')]===_0xdf18('0x6')){_0x54ba67['push'](_0x15f086[_0xdf18('0x7')]);}else if(_0x15f086[_0xdf18('0x5')]===_0xdf18('0x8')&&_0x15f086[_0xdf18('0x9')]){_0x356ff6[_0x15f086[_0xdf18('0x9')]]&&_0x54ba67[_0xdf18('0xa')](_0x356ff6[_0x15f086['variableName']][_0xdf18('0xb')]());}else if(_0x15f086[_0xdf18('0x5')]===_0xdf18('0xc')&&_0x15f086[_0xdf18('0xd')]&&_0x15f086[_0xdf18('0xd')][_0xdf18('0xe')]){_0x356ff6[_0x15f086[_0xdf18('0xd')][_0xdf18('0xe')][_0xdf18('0xf')]()]&&_0x54ba67[_0xdf18('0xa')](_0x356ff6[_0x15f086[_0xdf18('0xd')][_0xdf18('0xe')][_0xdf18('0xf')]()][_0xdf18('0xb')]());}else if(_0x15f086[_0xdf18('0x5')]===_0xdf18('0x10')){if(_0x15f086['keyType']===_0xdf18('0x6')&&_0x15f086[_0xdf18('0x11')]){_0x54ba67['push'](util[_0xdf18('0x12')](_0xdf18('0x13'),_0x15f086[_0xdf18('0x11')],_0x15f086[_0xdf18('0x14')]));}else if(_0x15f086[_0xdf18('0x15')]===_0xdf18('0x8')&&_0x15f086[_0xdf18('0x9')]&&_0x15f086[_0xdf18('0x11')]){_0x356ff6[_0x15f086[_0xdf18('0x9')]]&&_0x54ba67['push'](util[_0xdf18('0x12')](_0xdf18('0x13'),_0x15f086[_0xdf18('0x11')],_0x356ff6[_0x15f086[_0xdf18('0x9')]]));}else if(_0x15f086[_0xdf18('0x15')]===_0xdf18('0xc')&&_0x15f086[_0xdf18('0xd')]&&_0x15f086[_0xdf18('0xd')][_0xdf18('0xe')]&&_0x15f086[_0xdf18('0x11')]){_0x356ff6[_0x15f086['Variable'][_0xdf18('0xe')]['toLowerCase']()]&&_0x54ba67['push'](util[_0xdf18('0x12')](_0xdf18('0x13'),_0x15f086[_0xdf18('0x11')],_0x356ff6[_0x15f086[_0xdf18('0xd')][_0xdf18('0xe')][_0xdf18('0xf')]()]));}}}}return _0x54ba67[_0xdf18('0x16')](_0x4d5de7);};exports[_0xdf18('0x17')]=function(_0x550415){var _0x211a98=_0x550415['slice'](-0x1);if(_0x211a98==='/'){_0x550415=_0x550415['substring'](0x0,_0x550415[_0xdf18('0x18')](_0x211a98));}return _0x550415;};exports[_0xdf18('0x19')]=function(_0xf7692a){if(!_[_0xdf18('0x1a')](_0xf7692a)&&_0xf7692a!==''){var _0x80cedd=/^(([^<>()\[\]\\.,;:\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 _0x80cedd['test'](String(_0xf7692a)[_0xdf18('0xf')]());}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 b8478af..6109c74 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 _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x812a1,_0x12e1d5){var _0x3fc999=function(_0x2cb9f6){while(--_0x2cb9f6){_0x812a1['push'](_0x812a1['shift']());}};_0x3fc999(++_0x12e1d5);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x194062,_0x17c012){var _0x52ee21=function(_0x898a3a){while(--_0x898a3a){_0x194062['push'](_0x194062['shift']());}};_0x52ee21(++_0x17c012);}(_0x34e8,0x12c));var _0x834e=function(_0x38daac,_0x2b0e84){_0x38daac=_0x38daac-0x0;var _0x3079fc=_0x34e8[_0x38daac];return _0x3079fc;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ 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 0560f8a..bc7c22e 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 _0x0d4c=['calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','stripTrailingSlash','none','Recording\x20is\x20enabled!','recordingURL','email','destcalleridname','[OUTBOUND]','user:%s','trigger:browser:url','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','info','Getting\x20agent\x20with\x20email','%s/search.json','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','user','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','string','picklist','type','nameField','customField','toLowerCase','includes','idField','push','content','variable','variableName','custom_fields','Variable','name','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname'];(function(_0x3acc1f,_0x3cda5c){var _0x2bf4b8=function(_0x2fbd52){while(--_0x2fbd52){_0x3acc1f['push'](_0x3acc1f['shift']());}};_0x2bf4b8(++_0x3cda5c);}(_0x0d4c,0x8e));var _0xc0d4=function(_0x493fa2,_0x53008d){_0x493fa2=_0x493fa2-0x0;var _0x5e2258=_0x0d4c[_0x493fa2];return _0x5e2258;};'use strict';var _=require(_0xc0d4('0x0'));var rp=require('request-promise');var md5=require(_0xc0d4('0x1'));var util=require(_0xc0d4('0x2'));var Redis=require(_0xc0d4('0x3'));var intUtil=require('./util');var config=require(_0xc0d4('0x4'));var logger=require('../../../../config/logger')('zendesk');config[_0xc0d4('0x5')]=_[_0xc0d4('0x6')](config[_0xc0d4('0x5')],{'host':_0xc0d4('0x7'),'port':0x18eb});var io=require(_0xc0d4('0x8'))(new Redis(config[_0xc0d4('0x5')]));function emit(_0x186fd6,_0x6780b2,_0x31edfc){io['to'](_0x186fd6)[_0xc0d4('0x9')](_0x6780b2,_0x31edfc);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x244799,_0x3ab911,_0x29b6c3,_0x368ba2,_0x2ccad5){logger['info'](_0xc0d4('0xa'));return request({'uri':util[_0xc0d4('0xb')](_0xc0d4('0xc'),_0x244799[_0xc0d4('0xd')]),'method':'POST','body':{'ticket':_[_0xc0d4('0xe')]({'requester_id':_0x29b6c3['id'],'submitter_id':_0x3ab911?_0x3ab911['id']:undefined,'assignee_id':_0x3ab911?_0x3ab911['id']:undefined,'tags':getTags(_0x368ba2[_0xc0d4('0xf')],'name'),'subject':intUtil['getString'](_0x368ba2['Subjects'],_0x2ccad5,'\x20'),'description':intUtil[_0xc0d4('0x10')](_0x368ba2[_0xc0d4('0x11')],_0x2ccad5,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc0d4('0x10')](_0x368ba2[_0xc0d4('0x11')],_0x2ccad5,'\x0a')}},getCustomFields(_0x368ba2[_0xc0d4('0x12')],_0x2ccad5))}})[_0xc0d4('0x13')](function(_0x4c7fa8){logger['info'](_0xc0d4('0x14'));return _0x4c7fa8[_0xc0d4('0x15')];});}function getUser(_0x2de071,_0x5d3852){if(intUtil[_0xc0d4('0x16')](_0x5d3852)){logger[_0xc0d4('0x17')](_0xc0d4('0x18'),_0x5d3852);return request({'uri':util[_0xc0d4('0xb')](_0xc0d4('0x19'),_0x2de071['remoteUri']),'qs':{'query':util[_0xc0d4('0xb')]('type:user\x20role:agent\x20email:%s',_0x5d3852)}})['then'](function(_0x4c7397){if(_0x4c7397['count']){logger['info'](_0xc0d4('0x1a'));return _[_0xc0d4('0x1b')](_0x4c7397[_0xc0d4('0x1c')],{'email':_0x5d3852,'role':_0xc0d4('0x1d')});}else{logger[_0xc0d4('0x17')](_0xc0d4('0x1e'));return request({'uri':util[_0xc0d4('0xb')](_0xc0d4('0x1f'),_0x2de071[_0xc0d4('0xd')])})[_0xc0d4('0x13')](function(_0x37ee38){logger[_0xc0d4('0x17')](_0xc0d4('0x20'));return _0x37ee38['user'];});}});}else{logger[_0xc0d4('0x17')](_0xc0d4('0x1e'));return request({'uri':util['format'](_0xc0d4('0x1f'),_0x2de071['remoteUri'])})[_0xc0d4('0x13')](function(_0x3daad6){logger[_0xc0d4('0x17')](_0xc0d4('0x20'));return _0x3daad6['user'];});}}function getEndUser(_0x50aac7,_0x58c876,_0x38ef37){logger['info'](_0xc0d4('0x21'),_0x38ef37);return request({'uri':util[_0xc0d4('0xb')]('%s/search.json',_0x50aac7[_0xc0d4('0xd')]),'qs':{'query':util[_0xc0d4('0xb')](_0xc0d4('0x22'),_0x38ef37)}})[_0xc0d4('0x13')](function(_0x544108){var _0x59856a;if(_0x544108[_0xc0d4('0x1c')][_0xc0d4('0x23')]){_0x544108['results']=_[_0xc0d4('0x24')](_0x544108[_0xc0d4('0x1c')],{'suspended':![],'role':_0xc0d4('0x25')});if(_0x544108[_0xc0d4('0x1c')]['length']){_0x59856a=_[_0xc0d4('0x26')](_0x544108[_0xc0d4('0x1c')]);}}if(_0x59856a){logger[_0xc0d4('0x17')]('Enduser\x20found!');return _0x59856a;}else{logger[_0xc0d4('0x17')](_0xc0d4('0x27'));return request({'uri':util['format'](_0xc0d4('0x28'),_0x50aac7['remoteUri']),'method':_0xc0d4('0x29'),'body':{'user':{'role':_0xc0d4('0x25'),'name':util[_0xc0d4('0xb')](_0xc0d4('0x2a'),_0x58c876||_0x38ef37),'phone':_0x38ef37}}})[_0xc0d4('0x13')](function(_0x3163e5){logger[_0xc0d4('0x17')](_0xc0d4('0x2b'));return _0x3163e5[_0xc0d4('0x2c')];});}});}function getAuth(_0x2853f6){var _0x13c976;if(_0x2853f6[_0xc0d4('0x2d')]===_0xc0d4('0x2e')){_0x13c976=util[_0xc0d4('0xb')](_0xc0d4('0x2f'),_0x2853f6[_0xc0d4('0x30')],_0x2853f6[_0xc0d4('0x2e')]);}else if(_0x2853f6[_0xc0d4('0x2d')]===_0xc0d4('0x31')){_0x13c976=util[_0xc0d4('0xb')](_0xc0d4('0x32'),_0x2853f6[_0xc0d4('0x30')],_0x2853f6[_0xc0d4('0x31')]);}return util['format'](_0xc0d4('0x33'),new Buffer(_0x13c976)[_0xc0d4('0x34')](_0xc0d4('0x35')));}function request(_0x120082){logger['debug'](_0xc0d4('0x36'),JSON[_0xc0d4('0x37')](_0x120082));return rp(_[_0xc0d4('0x6')](_0x120082,{'method':_0xc0d4('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x3b8d83,_0x4a47e0){var _0x5b4fab=[];if(_0x3b8d83&&_0x3b8d83[_0xc0d4('0x23')]>0x0){_0x5b4fab=_[_0xc0d4('0x39')](_0x3b8d83,_0x4a47e0);}return _0x5b4fab;}function getCustomFields(_0x2e98ed,_0x41334a){var _0x457fd7=[];var _0x27ceeb={'custom_fields':[]};if(_0x2e98ed[_0xc0d4('0x23')]>0x0){_[_0xc0d4('0x3a')](_0x2e98ed,function(_0x49f728){if(_['includes']([_0xc0d4('0x3b'),_0xc0d4('0x3c')],_0x49f728[_0xc0d4('0x3d')])&&_0x49f728[_0xc0d4('0x3e')]&&!_0x49f728[_0xc0d4('0x3f')]){_0x27ceeb[_0x49f728[_0xc0d4('0x3e')][_0xc0d4('0x40')]()]=_0x49f728['content']['toString']();}else if(_[_0xc0d4('0x41')]([_0xc0d4('0x3b'),_0xc0d4('0x3c')],_0x49f728['type'])&&_0x49f728[_0xc0d4('0x42')]&&_0x49f728[_0xc0d4('0x3f')]){_0x27ceeb['custom_fields'][_0xc0d4('0x43')]({'id':_0x49f728[_0xc0d4('0x42')],'value':_0x49f728[_0xc0d4('0x44')][_0xc0d4('0x34')]()});}else if(_0x49f728[_0xc0d4('0x3d')]===_0xc0d4('0x45')&&_0x49f728[_0xc0d4('0x46')]&&_0x49f728[_0xc0d4('0x42')]&&_0x49f728[_0xc0d4('0x3f')]){_0x41334a[_0x49f728['variableName']]&&_0x27ceeb[_0xc0d4('0x47')][_0xc0d4('0x43')]({'id':_0x49f728['idField'],'value':_0x41334a[_0x49f728[_0xc0d4('0x46')]][_0xc0d4('0x34')]()});}else if(_0x49f728[_0xc0d4('0x3d')]==='customVariable'&&_0x49f728[_0xc0d4('0x48')]&&_0x49f728[_0xc0d4('0x48')]['name']&&_0x49f728[_0xc0d4('0x42')]&&_0x49f728[_0xc0d4('0x3f')]){_0x41334a[_0x49f728[_0xc0d4('0x48')][_0xc0d4('0x49')][_0xc0d4('0x40')]()]&&_0x27ceeb['custom_fields']['push']({'id':_0x49f728[_0xc0d4('0x42')],'value':_0x41334a[_0x49f728[_0xc0d4('0x48')][_0xc0d4('0x49')]['toLowerCase']()][_0xc0d4('0x34')]()});}});}return _0x27ceeb;}exports['queue']=function(_0x2251dd,_0xbaf204,_0x150da5,_0xa2035d,_0x3e53ba,_0x46f272){var _0x32a00d,_0x33ad86;_0x46f272[_0xc0d4('0xd')]=intUtil['stripTrailingSlash'](_0x46f272[_0xc0d4('0xd')]);_0x46f272[_0xc0d4('0x4a')]=intUtil['stripTrailingSlash'](_0x46f272['serverUrl']);if(_0x3e53ba&&_0x3e53ba[_0xc0d4('0x4b')]){logger[_0xc0d4('0x17')](_0xc0d4('0x4c'),'Recording\x20is\x20enabled!');_0xbaf204['recordingURL']=util['format'](_0xc0d4('0x4d'),_0x46f272[_0xc0d4('0x4a')],_0xbaf204['uniqueid'],md5(_0xbaf204[_0xc0d4('0x4e')]));}else{_0xbaf204['recordingURL']='';}headers[_0xc0d4('0x4f')]=getAuth(_0x46f272);return getUser(_0x46f272,_0xa2035d['email'])[_0xc0d4('0x13')](function(_0x5abc60){_0x32a00d=_0x5abc60;logger['info'](_0xc0d4('0x50'),_0x32a00d['id']);return getEndUser(_0x46f272,_0xbaf204[_0xc0d4('0x51')],_0xbaf204[_0xc0d4('0x52')]);})[_0xc0d4('0x13')](function(_0x42be99){_0x33ad86=_0x42be99;logger['info'](_0xc0d4('0x53'),_0x33ad86['id']);return getTicket(_0x46f272,_0x32a00d,_0x33ad86,_0x150da5,_0xbaf204);})[_0xc0d4('0x13')](function(_0x5a66b2){if(_0x5a66b2){logger[_0xc0d4('0x17')](_0xc0d4('0x54'),_0x5a66b2['id']);switch(_0x46f272[_0xc0d4('0x3d')]){case _0xc0d4('0x55'):logger['info'](_0xc0d4('0x4c'),_0xc0d4('0x56'));return request({'uri':util[_0xc0d4('0xb')](_0xc0d4('0x57'),_0x46f272[_0xc0d4('0xd')],_0x32a00d['id'],_0x5a66b2['id']),'method':_0xc0d4('0x29')});case _0xc0d4('0x58'):logger[_0xc0d4('0x17')]('[QUEUE]',_0xc0d4('0x59'));emit(util[_0xc0d4('0xb')]('user:%s',_0xa2035d[_0xc0d4('0x49')]),'trigger:browser:url',{'uri':util[_0xc0d4('0xb')](_0xc0d4('0x5a'),_0x46f272[_0xc0d4('0xd')][_0xc0d4('0x5b')](_0xc0d4('0x5c'),''),_0x5a66b2['id'])});break;default:logger['error'](_0xc0d4('0x4c'),_0xc0d4('0x5d'));}}})['catch'](function(_0x976e67){logger['error'](_0xc0d4('0x5e'),util['inspect'](_0x976e67,{'showHidden':!![],'depth':null}));});};exports[_0xc0d4('0x5f')]=function(_0x585b08,_0x38517b,_0x17adb1,_0x48e151,_0x23f019,_0x2e5bdc,_0x578792){var _0xa00ab5,_0x2a31f3;_0x2e5bdc[_0xc0d4('0xd')]=intUtil[_0xc0d4('0x60')](_0x2e5bdc[_0xc0d4('0xd')]);_0x2e5bdc[_0xc0d4('0x4a')]=intUtil['stripTrailingSlash'](_0x2e5bdc['serverUrl']);if(_0x578792&&_0x578792['recordingFormat']&&_0x578792['recordingFormat']!==_0xc0d4('0x61')){logger[_0xc0d4('0x17')]('[OUTBOUND]',_0xc0d4('0x62'));_0x38517b[_0xc0d4('0x63')]=util[_0xc0d4('0xb')](_0xc0d4('0x4d'),_0x2e5bdc[_0xc0d4('0x4a')],_0x38517b[_0xc0d4('0x4e')],md5(_0x38517b['uniqueid']));}headers['Authorization']=getAuth(_0x2e5bdc);return getUser(_0x2e5bdc,_0x48e151[_0xc0d4('0x64')])[_0xc0d4('0x13')](function(_0x15aca6){_0xa00ab5=_0x15aca6;logger['info'](_0xc0d4('0x50'),_0xa00ab5['id']);return getEndUser(_0x2e5bdc,_0x38517b[_0xc0d4('0x65')],_0x38517b['destcalleridnum']);})[_0xc0d4('0x13')](function(_0x45ae39){_0x2a31f3=_0x45ae39;logger[_0xc0d4('0x17')]('The\x20Enduser\x20ID\x20is:',_0x2a31f3['id']);return getTicket(_0x2e5bdc,_0xa00ab5,_0x2a31f3,_0x17adb1,_0x38517b);})['then'](function(_0x5f1925){if(_0x5f1925){logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f1925['id']);switch(_0x2e5bdc['type']){case'integrationTab':logger[_0xc0d4('0x17')](_0xc0d4('0x66'),_0xc0d4('0x56'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2e5bdc[_0xc0d4('0xd')],_0xa00ab5['id'],_0x5f1925['id']),'method':_0xc0d4('0x29')});case'newTab':logger[_0xc0d4('0x17')]('[OUTBOUND]',_0xc0d4('0x59'));emit(util[_0xc0d4('0xb')](_0xc0d4('0x67'),_0x48e151[_0xc0d4('0x49')]),_0xc0d4('0x68'),{'uri':util['format'](_0xc0d4('0x5a'),_0x2e5bdc['remoteUri'][_0xc0d4('0x5b')](_0xc0d4('0x5c'),''),_0x5f1925['id'])});break;default:logger[_0xc0d4('0x69')](_0xc0d4('0x66'),_0xc0d4('0x5d'));}}})['catch'](function(_0x2a6078){logger['error'](_0xc0d4('0x6a'),util[_0xc0d4('0x6b')](_0x2a6078,{'showHidden':!![],'depth':null}));});};exports[_0xc0d4('0x6c')]=function(_0x2f7f4f,_0x56100a,_0x7ecfa1,_0xe83238,_0x3d4489,_0x27a8a4){var _0x11a94b,_0x89e60e;_0x27a8a4[_0xc0d4('0xd')]=intUtil[_0xc0d4('0x60')](_0x27a8a4[_0xc0d4('0xd')]);_0x27a8a4[_0xc0d4('0x4a')]=intUtil[_0xc0d4('0x60')](_0x27a8a4['serverUrl']);if(_0x3d4489&&_0x3d4489[_0xc0d4('0x4b')]){logger['info']('['+_0x56100a[_0xc0d4('0x6d')]['toUpperCase']()+']',_0xc0d4('0x62'));_0x56100a['recordingURL']=util[_0xc0d4('0xb')](_0xc0d4('0x4d'),_0x27a8a4[_0xc0d4('0x4a')],_0x56100a['uniqueid'],md5(_0x56100a['uniqueid']));}else{_0x56100a[_0xc0d4('0x63')]='';}headers[_0xc0d4('0x4f')]=getAuth(_0x27a8a4);return getUser(_0x27a8a4)[_0xc0d4('0x13')](function(_0x2b66b7){_0x11a94b=_0x2b66b7;logger[_0xc0d4('0x17')]('The\x20User\x20ID\x20is:',_0x11a94b['id']);return getEndUser(_0x27a8a4,_0x56100a[_0xc0d4('0x51')],_0x56100a['calleridnum']);})[_0xc0d4('0x13')](function(_0x342257){_0x89e60e=_0x342257;logger[_0xc0d4('0x17')](_0xc0d4('0x53'),_0x89e60e['id']);return getTicket(_0x27a8a4,_0x11a94b,_0x89e60e,_0x7ecfa1,_0x56100a);})[_0xc0d4('0x13')](function(_0x24b458){if(_0x24b458){logger['info']('The\x20Ticket\x20ID\x20is:',_0x24b458['id']);}})['catch'](function(_0x48a05d){logger[_0xc0d4('0x69')]('['+_0x56100a[_0xc0d4('0x6d')][_0xc0d4('0x6e')]()+']'+_0xc0d4('0x6f'),util[_0xc0d4('0x6b')](_0x48a05d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4bad=['lastevent','Recording\x20is\x20enabled!','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','name','getString','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','GET','map','includes','picklist','type','customField','nameField','toLowerCase','content','string','push','variable','variableName','idField','custom_fields','Variable','queue','stripTrailingSlash','serverUrl','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','monitor_format'];(function(_0x5d9d10,_0x248051){var _0x338e62=function(_0x5dfef4){while(--_0x5dfef4){_0x5d9d10['push'](_0x5d9d10['shift']());}};_0x338e62(++_0x248051);}(_0x4bad,0x14d));var _0xd4ba=function(_0x1944a1,_0x455152){_0x1944a1=_0x1944a1-0x0;var _0x54f5d0=_0x4bad[_0x1944a1];return _0x54f5d0;};'use strict';var _=require(_0xd4ba('0x0'));var rp=require(_0xd4ba('0x1'));var md5=require(_0xd4ba('0x2'));var util=require(_0xd4ba('0x3'));var Redis=require(_0xd4ba('0x4'));var intUtil=require(_0xd4ba('0x5'));var config=require(_0xd4ba('0x6'));var logger=require(_0xd4ba('0x7'))(_0xd4ba('0x8'));config[_0xd4ba('0x9')]=_['defaults'](config[_0xd4ba('0x9')],{'host':_0xd4ba('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd4ba('0x9')]));function emit(_0x973eed,_0x4de06f,_0x141014){io['to'](_0x973eed)['emit'](_0x4de06f,_0x141014);}var headers={'Content-Type':'application/json','Accept':_0xd4ba('0xb')};function getTicket(_0x4d5c46,_0x23b5fd,_0x21fa2e,_0x4e0ea4,_0x421045){logger['info'](_0xd4ba('0xc'));return request({'uri':util[_0xd4ba('0xd')](_0xd4ba('0xe'),_0x4d5c46[_0xd4ba('0xf')]),'method':_0xd4ba('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x21fa2e['id'],'submitter_id':_0x23b5fd?_0x23b5fd['id']:undefined,'assignee_id':_0x23b5fd?_0x23b5fd['id']:undefined,'tags':getTags(_0x4e0ea4['Tags'],_0xd4ba('0x11')),'subject':intUtil[_0xd4ba('0x12')](_0x4e0ea4['Subjects'],_0x421045,'\x20'),'description':intUtil[_0xd4ba('0x12')](_0x4e0ea4[_0xd4ba('0x13')],_0x421045,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd4ba('0x12')](_0x4e0ea4[_0xd4ba('0x13')],_0x421045,'\x0a')}},getCustomFields(_0x4e0ea4[_0xd4ba('0x14')],_0x421045))}})[_0xd4ba('0x15')](function(_0x40fb41){logger[_0xd4ba('0x16')](_0xd4ba('0x17'));return _0x40fb41[_0xd4ba('0x18')];});}function getUser(_0x3e1505,_0x2a1118){if(intUtil[_0xd4ba('0x19')](_0x2a1118)){logger['info'](_0xd4ba('0x1a'),_0x2a1118);return request({'uri':util[_0xd4ba('0xd')](_0xd4ba('0x1b'),_0x3e1505['remoteUri']),'qs':{'query':util['format'](_0xd4ba('0x1c'),_0x2a1118)}})['then'](function(_0x44a312){if(_0x44a312[_0xd4ba('0x1d')]){logger[_0xd4ba('0x16')](_0xd4ba('0x1e'));return _[_0xd4ba('0x1f')](_0x44a312[_0xd4ba('0x20')],{'email':_0x2a1118,'role':_0xd4ba('0x21')});}else{logger[_0xd4ba('0x16')](_0xd4ba('0x22'));return request({'uri':util['format'](_0xd4ba('0x23'),_0x3e1505[_0xd4ba('0xf')])})[_0xd4ba('0x15')](function(_0x34bc4d){logger[_0xd4ba('0x16')](_0xd4ba('0x24'));return _0x34bc4d[_0xd4ba('0x25')];});}});}else{logger[_0xd4ba('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd4ba('0xd')](_0xd4ba('0x23'),_0x3e1505[_0xd4ba('0xf')])})[_0xd4ba('0x15')](function(_0x283332){logger[_0xd4ba('0x16')](_0xd4ba('0x24'));return _0x283332['user'];});}}function getEndUser(_0x4c5fd6,_0x27aa37,_0x1c5ff1){logger[_0xd4ba('0x16')](_0xd4ba('0x26'),_0x1c5ff1);return request({'uri':util[_0xd4ba('0xd')](_0xd4ba('0x1b'),_0x4c5fd6['remoteUri']),'qs':{'query':util[_0xd4ba('0xd')](_0xd4ba('0x27'),_0x1c5ff1)}})[_0xd4ba('0x15')](function(_0x200222){var _0x1e0e98;if(_0x200222[_0xd4ba('0x20')][_0xd4ba('0x28')]){_0x200222[_0xd4ba('0x20')]=_['filter'](_0x200222[_0xd4ba('0x20')],{'suspended':![],'role':_0xd4ba('0x29')});if(_0x200222[_0xd4ba('0x20')][_0xd4ba('0x28')]){_0x1e0e98=_[_0xd4ba('0x2a')](_0x200222[_0xd4ba('0x20')]);}}if(_0x1e0e98){logger['info']('Enduser\x20found!');return _0x1e0e98;}else{logger['info'](_0xd4ba('0x2b'));return request({'uri':util[_0xd4ba('0xd')](_0xd4ba('0x2c'),_0x4c5fd6['remoteUri']),'method':_0xd4ba('0x10'),'body':{'user':{'role':_0xd4ba('0x29'),'name':util[_0xd4ba('0xd')](_0xd4ba('0x2d'),_0x27aa37||_0x1c5ff1),'phone':_0x1c5ff1}}})[_0xd4ba('0x15')](function(_0x4aab57){logger[_0xd4ba('0x16')](_0xd4ba('0x2e'));return _0x4aab57[_0xd4ba('0x25')];});}});}function getAuth(_0x4c3440){var _0x423179;if(_0x4c3440[_0xd4ba('0x2f')]==='password'){_0x423179=util[_0xd4ba('0xd')](_0xd4ba('0x30'),_0x4c3440[_0xd4ba('0x31')],_0x4c3440['password']);}else if(_0x4c3440[_0xd4ba('0x2f')]===_0xd4ba('0x32')){_0x423179=util[_0xd4ba('0xd')](_0xd4ba('0x33'),_0x4c3440[_0xd4ba('0x31')],_0x4c3440[_0xd4ba('0x32')]);}return util[_0xd4ba('0xd')](_0xd4ba('0x34'),new Buffer(_0x423179)[_0xd4ba('0x35')]('base64'));}function request(_0x103cf9){logger[_0xd4ba('0x36')](_0xd4ba('0x37'),JSON['stringify'](_0x103cf9));return rp(_['defaults'](_0x103cf9,{'method':_0xd4ba('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x405913,_0xd5cf74){var _0x449041=[];if(_0x405913&&_0x405913[_0xd4ba('0x28')]>0x0){_0x449041=_[_0xd4ba('0x39')](_0x405913,_0xd5cf74);}return _0x449041;}function getCustomFields(_0x57b81d,_0x407472){var _0x3b1212=[];var _0x832b61={'custom_fields':[]};if(_0x57b81d[_0xd4ba('0x28')]>0x0){_['forEach'](_0x57b81d,function(_0x31ba9a){if(_[_0xd4ba('0x3a')](['string',_0xd4ba('0x3b')],_0x31ba9a[_0xd4ba('0x3c')])&&_0x31ba9a['nameField']&&!_0x31ba9a[_0xd4ba('0x3d')]){_0x832b61[_0x31ba9a[_0xd4ba('0x3e')][_0xd4ba('0x3f')]()]=_0x31ba9a[_0xd4ba('0x40')][_0xd4ba('0x35')]();}else if(_[_0xd4ba('0x3a')]([_0xd4ba('0x41'),_0xd4ba('0x3b')],_0x31ba9a['type'])&&_0x31ba9a['idField']&&_0x31ba9a['customField']){_0x832b61['custom_fields'][_0xd4ba('0x42')]({'id':_0x31ba9a['idField'],'value':_0x31ba9a[_0xd4ba('0x40')][_0xd4ba('0x35')]()});}else if(_0x31ba9a[_0xd4ba('0x3c')]===_0xd4ba('0x43')&&_0x31ba9a[_0xd4ba('0x44')]&&_0x31ba9a[_0xd4ba('0x45')]&&_0x31ba9a[_0xd4ba('0x3d')]){_0x407472[_0x31ba9a[_0xd4ba('0x44')]]&&_0x832b61[_0xd4ba('0x46')][_0xd4ba('0x42')]({'id':_0x31ba9a[_0xd4ba('0x45')],'value':_0x407472[_0x31ba9a[_0xd4ba('0x44')]]['toString']()});}else if(_0x31ba9a[_0xd4ba('0x3c')]==='customVariable'&&_0x31ba9a[_0xd4ba('0x47')]&&_0x31ba9a[_0xd4ba('0x47')][_0xd4ba('0x11')]&&_0x31ba9a[_0xd4ba('0x45')]&&_0x31ba9a[_0xd4ba('0x3d')]){_0x407472[_0x31ba9a[_0xd4ba('0x47')]['name'][_0xd4ba('0x3f')]()]&&_0x832b61[_0xd4ba('0x46')]['push']({'id':_0x31ba9a[_0xd4ba('0x45')],'value':_0x407472[_0x31ba9a['Variable'][_0xd4ba('0x11')]['toLowerCase']()][_0xd4ba('0x35')]()});}});}return _0x832b61;}exports[_0xd4ba('0x48')]=function(_0x35c1ef,_0x704876,_0x1b02d4,_0x4361f4,_0x313534,_0x54105f){var _0x4090ac,_0x129030;_0x54105f[_0xd4ba('0xf')]=intUtil[_0xd4ba('0x49')](_0x54105f['remoteUri']);_0x54105f[_0xd4ba('0x4a')]=intUtil['stripTrailingSlash'](_0x54105f[_0xd4ba('0x4a')]);if(_0x313534&&_0x313534['monitor_format']){logger[_0xd4ba('0x16')]('[QUEUE]','Recording\x20is\x20enabled!');_0x704876['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x54105f[_0xd4ba('0x4a')],_0x704876['uniqueid'],md5(_0x704876['uniqueid']));}else{_0x704876[_0xd4ba('0x4b')]='';}headers[_0xd4ba('0x4c')]=getAuth(_0x54105f);return getUser(_0x54105f,_0x4361f4[_0xd4ba('0x4d')])[_0xd4ba('0x15')](function(_0x1d751a){_0x4090ac=_0x1d751a;logger[_0xd4ba('0x16')](_0xd4ba('0x4e'),_0x4090ac['id']);return getEndUser(_0x54105f,_0x704876[_0xd4ba('0x4f')],_0x704876['calleridnum']);})[_0xd4ba('0x15')](function(_0x596503){_0x129030=_0x596503;logger[_0xd4ba('0x16')](_0xd4ba('0x50'),_0x129030['id']);return getTicket(_0x54105f,_0x4090ac,_0x129030,_0x1b02d4,_0x704876);})['then'](function(_0x2a704d){if(_0x2a704d){logger[_0xd4ba('0x16')](_0xd4ba('0x51'),_0x2a704d['id']);switch(_0x54105f['type']){case _0xd4ba('0x52'):logger['info'](_0xd4ba('0x53'),_0xd4ba('0x54'));return request({'uri':util[_0xd4ba('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x54105f[_0xd4ba('0xf')],_0x4090ac['id'],_0x2a704d['id']),'method':'POST'});case _0xd4ba('0x55'):logger[_0xd4ba('0x16')](_0xd4ba('0x53'),_0xd4ba('0x56'));emit(util[_0xd4ba('0xd')](_0xd4ba('0x57'),_0x4361f4[_0xd4ba('0x11')]),_0xd4ba('0x58'),{'uri':util[_0xd4ba('0xd')](_0xd4ba('0x59'),_0x54105f[_0xd4ba('0xf')][_0xd4ba('0x5a')](_0xd4ba('0x5b'),''),_0x2a704d['id'])});break;default:logger[_0xd4ba('0x5c')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd4ba('0x5d')](function(_0x263018){logger[_0xd4ba('0x5c')](_0xd4ba('0x5e'),util[_0xd4ba('0x5f')](_0x263018,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x2c2ec5,_0x56a395,_0x5d73ff,_0x5f569b,_0x2d21c0,_0x441792,_0x2c6ed9){var _0x50b66e,_0x31b933;_0x441792[_0xd4ba('0xf')]=intUtil[_0xd4ba('0x49')](_0x441792[_0xd4ba('0xf')]);_0x441792[_0xd4ba('0x4a')]=intUtil[_0xd4ba('0x49')](_0x441792['serverUrl']);if(_0x2c6ed9&&_0x2c6ed9[_0xd4ba('0x60')]&&_0x2c6ed9[_0xd4ba('0x60')]!==_0xd4ba('0x61')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x56a395[_0xd4ba('0x4b')]=util['format'](_0xd4ba('0x62'),_0x441792[_0xd4ba('0x4a')],_0x56a395[_0xd4ba('0x63')],md5(_0x56a395[_0xd4ba('0x63')]));}headers[_0xd4ba('0x4c')]=getAuth(_0x441792);return getUser(_0x441792,_0x5f569b[_0xd4ba('0x4d')])[_0xd4ba('0x15')](function(_0x39c8d8){_0x50b66e=_0x39c8d8;logger[_0xd4ba('0x16')]('The\x20User\x20ID\x20is:',_0x50b66e['id']);return getEndUser(_0x441792,_0x56a395[_0xd4ba('0x64')],_0x56a395[_0xd4ba('0x65')]);})[_0xd4ba('0x15')](function(_0xc482a6){_0x31b933=_0xc482a6;logger[_0xd4ba('0x16')]('The\x20Enduser\x20ID\x20is:',_0x31b933['id']);return getTicket(_0x441792,_0x50b66e,_0x31b933,_0x5d73ff,_0x56a395);})['then'](function(_0x59f7d8){if(_0x59f7d8){logger[_0xd4ba('0x16')](_0xd4ba('0x51'),_0x59f7d8['id']);switch(_0x441792[_0xd4ba('0x3c')]){case'integrationTab':logger[_0xd4ba('0x16')](_0xd4ba('0x66'),_0xd4ba('0x54'));return request({'uri':util['format'](_0xd4ba('0x67'),_0x441792[_0xd4ba('0xf')],_0x50b66e['id'],_0x59f7d8['id']),'method':'POST'});case _0xd4ba('0x55'):logger[_0xd4ba('0x16')](_0xd4ba('0x66'),_0xd4ba('0x56'));emit(util[_0xd4ba('0xd')](_0xd4ba('0x57'),_0x5f569b[_0xd4ba('0x11')]),_0xd4ba('0x58'),{'uri':util[_0xd4ba('0xd')](_0xd4ba('0x59'),_0x441792[_0xd4ba('0xf')][_0xd4ba('0x5a')](_0xd4ba('0x5b'),''),_0x59f7d8['id'])});break;default:logger['error'](_0xd4ba('0x66'),_0xd4ba('0x68'));}}})[_0xd4ba('0x5d')](function(_0x5484c8){logger[_0xd4ba('0x5c')](_0xd4ba('0x69'),util[_0xd4ba('0x5f')](_0x5484c8,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x105e1b,_0x554903,_0x19610b,_0x208cea,_0x3d1e59,_0x531649){var _0x4fd97a,_0x1bbbc4;_0x531649['remoteUri']=intUtil['stripTrailingSlash'](_0x531649[_0xd4ba('0xf')]);_0x531649[_0xd4ba('0x4a')]=intUtil[_0xd4ba('0x49')](_0x531649[_0xd4ba('0x4a')]);if(_0x3d1e59&&_0x3d1e59[_0xd4ba('0x6a')]){logger[_0xd4ba('0x16')]('['+_0x554903[_0xd4ba('0x6b')]['toUpperCase']()+']',_0xd4ba('0x6c'));_0x554903[_0xd4ba('0x4b')]=util[_0xd4ba('0xd')](_0xd4ba('0x62'),_0x531649['serverUrl'],_0x554903[_0xd4ba('0x63')],md5(_0x554903[_0xd4ba('0x63')]));}else{_0x554903['recordingURL']='';}headers[_0xd4ba('0x4c')]=getAuth(_0x531649);return getUser(_0x531649)['then'](function(_0x36b0eb){_0x4fd97a=_0x36b0eb;logger[_0xd4ba('0x16')](_0xd4ba('0x4e'),_0x4fd97a['id']);return getEndUser(_0x531649,_0x554903[_0xd4ba('0x4f')],_0x554903['calleridnum']);})[_0xd4ba('0x15')](function(_0x437ef7){_0x1bbbc4=_0x437ef7;logger['info'](_0xd4ba('0x50'),_0x1bbbc4['id']);return getTicket(_0x531649,_0x4fd97a,_0x1bbbc4,_0x19610b,_0x554903);})[_0xd4ba('0x15')](function(_0x2a4b9f){if(_0x2a4b9f){logger[_0xd4ba('0x16')](_0xd4ba('0x51'),_0x2a4b9f['id']);}})[_0xd4ba('0x5d')](function(_0x3a5db9){logger['error']('['+_0x554903[_0xd4ba('0x6b')]['toUpperCase']()+']'+_0xd4ba('0x6d'),util[_0xd4ba('0x5f')](_0x3a5db9,{'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 651b01c..d55fd31 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 _0xa67b=['recordingURL','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','none','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','zoho','defaults','redis','localhost','socket.io-emitter','emit','[HTTP]','stringify','string','picklist','type','idField','content','variableName','customVariable','Variable','name','toLowerCase','toString','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','isNil','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','/crm/v2/','startCase','moduleCreate','role','first_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','Creating\x20new\x20call...','Owner','administrator','last_name','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','mm:ss','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]'];(function(_0xa0195,_0x1eac94){var _0x21755e=function(_0x4caccf){while(--_0x4caccf){_0xa0195['push'](_0xa0195['shift']());}};_0x21755e(++_0x1eac94);}(_0xa67b,0x14a));var _0xba67=function(_0x653c85,_0x2e09e2){_0x653c85=_0x653c85-0x0;var _0x1d6296=_0xa67b[_0x653c85];return _0x1d6296;};'use strict';var _=require(_0xba67('0x0'));var rp=require(_0xba67('0x1'));var md5=require(_0xba67('0x2'));var util=require(_0xba67('0x3'));var intUtil=require(_0xba67('0x4'));var moment=require(_0xba67('0x5'));var Redis=require('ioredis');var BPromise=require(_0xba67('0x6'));var config=require(_0xba67('0x7'));var logger=require('../../../../config/logger')(_0xba67('0x8'));config['redis']=_[_0xba67('0x9')](config[_0xba67('0xa')],{'host':_0xba67('0xb'),'port':0x18eb});var io=require(_0xba67('0xc'))(new Redis(config[_0xba67('0xa')]));function emit(_0x26e7f2,_0x1a3c93,_0x3fd8d5){io['to'](_0x26e7f2)[_0xba67('0xd')](_0x1a3c93,_0x3fd8d5);}function request(_0x507e0e){logger['debug'](_0xba67('0xe'),JSON[_0xba67('0xf')](_0x507e0e));return rp(_0x507e0e);}function getCustomFields(_0x573ce4,_0x358e5c){var _0x31dc86={};if(_0x573ce4['length']>0x0){_['forEach'](_0x573ce4,function(_0x221033){if(_['includes']([_0xba67('0x10'),_0xba67('0x11')],_0x221033[_0xba67('0x12')])&&_0x221033[_0xba67('0x13')]){_0x31dc86[_0x221033[_0xba67('0x13')]]=_0x221033[_0xba67('0x14')]['toString']();}else if(_0x221033[_0xba67('0x12')]==='variable'&&_0x221033[_0xba67('0x15')]&&_0x221033['idField']&&_0x358e5c[_0x221033['variableName']]){_0x31dc86[_0x221033[_0xba67('0x13')]]=_0x358e5c[_0x221033[_0xba67('0x15')]]['toString']();}else if(_0x221033['type']===_0xba67('0x16')&&_0x221033['Variable']&&_0x221033[_0xba67('0x17')][_0xba67('0x18')]&&_0x221033['idField']&&_0x358e5c[_0x221033[_0xba67('0x17')][_0xba67('0x18')][_0xba67('0x19')]()]){_0x31dc86[_0x221033[_0xba67('0x13')]]=_0x358e5c[_0x221033[_0xba67('0x17')][_0xba67('0x18')]['toLowerCase']()][_0xba67('0x1a')]();}});}return _0x31dc86;}function getName(_0x52e40a){if(_0x52e40a['indexOf']('\x20')>0x0){var _0x2cf2a5=_0x52e40a['split'](/ (.+)/);if(_0x2cf2a5[0x1]){return _0x2cf2a5;}}return[_0x52e40a,_0x52e40a];}var accountsTokens={};function getAccessToken(_0x300ccb){return new Promise(function(_0x32a706,_0x3e9c0b){if(!_['isNil'](accountsTokens[_0x300ccb['id']])&&!_['isNil'](accountsTokens[_0x300ccb['id']][_0xba67('0x1b')])){if(moment()['isBefore'](accountsTokens[_0x300ccb['id']][_0xba67('0x1c')])){_0x32a706(accountsTokens[_0x300ccb['id']][_0xba67('0x1b')]);}}var _0x5094de;switch(_0x300ccb[_0xba67('0x1d')]){case'US':_0x5094de=_0xba67('0x1e');break;case'AU':_0x5094de=_0xba67('0x1f');break;case'EU':_0x5094de=_0xba67('0x20');break;case'IN':_0x5094de=_0xba67('0x21');break;case'CN':_0x5094de=_0xba67('0x22');break;default:_0x5094de=_0xba67('0x20');break;}var _0x1140a7={'method':'POST','uri':_0x5094de+_0xba67('0x23'),'qs':{'refresh_token':_0x300ccb[_0xba67('0x24')],'client_id':_0x300ccb[_0xba67('0x25')],'client_secret':_0x300ccb[_0xba67('0x26')],'grant_type':_0xba67('0x27')},'json':!![]};return rp(_0x1140a7)[_0xba67('0x28')](function(_0x13dd5f){accountsTokens[_0x300ccb['id']]={'access_token':_0x13dd5f['access_token'],'expires_in':moment()[_0xba67('0x29')](_0x13dd5f[_0xba67('0x1c')],_0xba67('0x2a'))};_0x32a706(_0x13dd5f[_0xba67('0x1b')]);})[_0xba67('0x2b')](function(_0x2e9a62){logger[_0xba67('0x2c')](_0xba67('0x2d'),_0x2e9a62[_0xba67('0x2e')]);_0x3e9c0b(_0x2e9a62);});});}function getUser(_0x29d426,_0x46e600,_0x30d7d0,_0x458ff1){logger[_0xba67('0x2f')](_0xba67('0x30'));return request({'method':'GET','uri':util[_0xba67('0x31')](_0xba67('0x32'),_0x46e600),'qs':{'type':_0xba67('0x33')},'headers':{'Authorization':_0xba67('0x34')+_0x29d426},'json':!![]})[_0xba67('0x28')](function(_0x4c54d3){if(_0x4c54d3['users']){var _0x53fce7=-0x1;if(_[_0xba67('0x35')](_0x4c54d3[_0xba67('0x36')])){if(!_[_0xba67('0x37')](_0x458ff1)){_0x53fce7=_[_0xba67('0x38')](_0x4c54d3[_0xba67('0x36')],function(_0xe259a7){return _0xe259a7[_0xba67('0x39')]===_0x458ff1;});}if(_0x53fce7>=0x0){logger[_0xba67('0x2f')]('Agent\x20found!');}else{logger[_0xba67('0x2f')](_0xba67('0x3a'));_0x53fce7=_['findIndex'](_0x4c54d3['users'],function(_0x2a0d66){return _0x2a0d66[_0xba67('0x3b')][_0xba67('0x18')]===_0xba67('0x3c');});}return _0x4c54d3['users'][_0x53fce7];}else{if(_0x4c54d3[_0xba67('0x3d')]['profile'][_0xba67('0x18')]===_0xba67('0x3c')){logger[_0xba67('0x2f')](_0xba67('0x3a'));user=_0x4c54d3[_0xba67('0x3d')];return user;}else{logger[_0xba67('0x2c')](_0xba67('0x3e'),JSON[_0xba67('0xf')](_0x4c54d3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xba67('0xf')](_0x4c54d3));}}}else{logger[_0xba67('0x2c')](_0xba67('0x3e'),JSON[_0xba67('0xf')](_0x4c54d3));throw new Error(_0xba67('0x3f')+JSON[_0xba67('0xf')](_0x4c54d3));}})['catch'](function(_0x62679e){console[_0xba67('0x2c')](_0x62679e);});}function getZohoUser(_0xbb9700,_0x519b71){return new BPromise(function(_0x486688,_0x1d90ec){request(_0xbb9700)[_0xba67('0x28')](function(_0x17ac79){var _0x1c2663=null;if(_0x17ac79){_0x1c2663=_0x17ac79[_0xba67('0x40')][0x0];_0x1c2663[_0xba67('0x41')]=_0x519b71;}_0x486688(_0x1c2663);})['catch'](function(_0x195939){_0x1d90ec(_0x195939);});});}function createEndUser(_0x4781d4,_0x356daf,_0x2f5a1f,_0x5f9bc,_0x448741,_0x178fd5){var _0x2f5a1f=getName(_0x2f5a1f);return request({'method':_0xba67('0x42'),'uri':'https://www.zohoapis.'+_0x356daf+_0xba67('0x43')+_[_0xba67('0x44')](_0x178fd5[_0xba67('0x45')])+'s','body':{'data':[{'Last_Name':_0x2f5a1f[0x1],'First_Name':_0x2f5a1f[0x0],'Phone':_0x5f9bc,'Owner':{'name':!_[_0xba67('0x37')](_0x448741[_0xba67('0x46')][_0xba67('0x18')])?_0x448741[_0xba67('0x46')][_0xba67('0x18')]:!_[_0xba67('0x37')](_0x448741[_0xba67('0x47')])?_0x448741[_0xba67('0x47')]+'\x20'+_0x448741['last_name']:_0x448741['last_name'],'id':_0x448741['id']}}]},'headers':{'Authorization':_0xba67('0x34')+_0x4781d4},'json':!![]})[_0xba67('0x28')](function(_0x1e937b){if(_0x1e937b&&_0x1e937b['data'][0x0][_0xba67('0x48')]===_0xba67('0x49')){var _0x3cb0b3=_0x1e937b['data'][0x0][_0xba67('0x4a')];_0x3cb0b3[_0xba67('0x41')]=_[_0xba67('0x44')](_0x178fd5[_0xba67('0x45')])+'s';return _0x3cb0b3;}logger[_0xba67('0x2c')](_0xba67('0x3e'),JSON[_0xba67('0xf')](data));throw new Error(_0xba67('0x4b')+JSON['stringify'](data));})['catch'](function(_0x2f2cdd){console[_0xba67('0x4c')](_0xba67('0x4d'),_0x2f2cdd);});}function getEndUser(_0x3729c8,_0x2b5b9e,_0x2c896f,_0x10c2ac,_0x1e04aa,_0x53ddae,_0x68ee67){var _0x32ff8a={'method':_0xba67('0x4e'),'uri':'','headers':{'Authorization':_0xba67('0x34')+_0x3729c8},'json':!![]};switch(_0x68ee67[_0xba67('0x4f')]){case _0xba67('0x50'):_0x32ff8a['uri']='https://www.zohoapis.'+_0x2b5b9e+_0xba67('0x51')+_0x1e04aa+'))';return getZohoUser(_0x32ff8a,_0xba67('0x52'))[_0xba67('0x28')](function(_0xc188e1){if(_0xc188e1)return _0xc188e1;_0x32ff8a[_0xba67('0x53')]=_0xba67('0x54')+_0x2b5b9e+_0xba67('0x55')+_0x1e04aa+'))';return getZohoUser(_0x32ff8a,_0xba67('0x56'))['then'](function(_0x108964){if(_0x108964)return _0x108964;if(_0x68ee67[_0xba67('0x45')]!='nothing'){return createEndUser(_0x3729c8,_0x2b5b9e,_0x10c2ac,_0x1e04aa,_0x53ddae,_0x68ee67);}else{return{};}});});break;case _0xba67('0x57'):_0x32ff8a[_0xba67('0x53')]=_0xba67('0x54')+_0x2b5b9e+_0xba67('0x51')+_0x1e04aa+'))';return getZohoUser(_0x32ff8a,_0xba67('0x52'))[_0xba67('0x28')](function(_0x12bf00){if(_0x12bf00)return _0x12bf00;if(_0x68ee67['moduleCreate']!='nothing'){return createEndUser(_0x3729c8,_0x2b5b9e,_0x10c2ac,_0x1e04aa,_0x53ddae,_0x68ee67);}else{return{};}});break;case'lead':_0x32ff8a[_0xba67('0x53')]=_0xba67('0x54')+_0x2b5b9e+_0xba67('0x55')+_0x1e04aa+'))';return getZohoUser(_0x32ff8a,_0xba67('0x56'))[_0xba67('0x28')](function(_0x5689df){if(_0x5689df)return _0x5689df;if(_0x68ee67['moduleCreate']!=_0xba67('0x58')){return createEndUser(_0x3729c8,_0x2b5b9e,_0x10c2ac,_0x1e04aa,_0x53ddae,_0x68ee67);}else{return{};}});break;}}function getCall(_0xf2b255,_0x57579a,_0x9a87cd,_0x13bb95,_0x521457,_0x440e08,_0x2d783,_0x11848b){logger[_0xba67('0x2f')](_0xba67('0x59'));var _0x169438={};_0x169438[_0xba67('0x5a')]={'name':!_[_0xba67('0x37')](_0x13bb95[_0xba67('0x46')][_0xba67('0x18')])&&!_[_0xba67('0x37')](_0x13bb95[_0xba67('0x3b')][_0xba67('0x18')])&&_0x13bb95[_0xba67('0x3b')]['name']===_0xba67('0x5b')?_0x13bb95['role'][_0xba67('0x18')]:!_[_0xba67('0x37')](_0x13bb95[_0xba67('0x47')])?_0x13bb95['first_name']+'\x20'+_0x13bb95[_0xba67('0x5c')]:_0x13bb95[_0xba67('0x5c')],'id':_0x13bb95['id']};_0x169438[_0xba67('0x5d')]=intUtil[_0xba67('0x5e')](_0x440e08[_0xba67('0x5f')],_0x2d783,'\x20');_0x169438[_0xba67('0x60')]=intUtil[_0xba67('0x5e')](_0x440e08[_0xba67('0x61')],_0x2d783,'\x0a');if(_0x521457['enduserType']===_0xba67('0x52')){_0x169438[_0xba67('0x62')]={'name':!_[_0xba67('0x37')](_0x521457[_0xba67('0x63')])?_0x521457[_0xba67('0x63')]:!_[_0xba67('0x37')](_0x521457[_0xba67('0x64')])?_0x521457['First_Name']+'\x20'+_0x521457['Last_Name']:_0x521457['Last_Name'],'id':_0x521457['id']};}if(_0x521457[_0xba67('0x41')]===_0xba67('0x56')){_0x169438['What_Id']={'name':!_[_0xba67('0x37')](_0x521457[_0xba67('0x63')])?_0x521457['Full_Name']:!_['isNil'](_0x521457[_0xba67('0x64')])?_0x521457[_0xba67('0x64')]+'\x20'+_0x521457[_0xba67('0x65')]:_0x521457['Last_Name'],'id':_0x521457['id']};_0x169438[_0xba67('0x66')]=_['startCase'](_0x521457[_0xba67('0x41')]);}if(_0x2d783[_0xba67('0x67')]){_0x169438['Call_Duration']=moment['utc'](parseInt(_0x2d783[_0xba67('0x67')])*0x3e8)['format'](_0xba67('0x68'));}else if(_0x2d783['answertime']&&_0x2d783[_0xba67('0x69')]){_0x169438['Call_Duration']=moment['utc'](moment(_0x2d783[_0xba67('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0xba67('0x6a')](moment(_0x2d783[_0xba67('0x6b')],_0xba67('0x6c'))))[_0xba67('0x31')](_0xba67('0x68'));}switch(_0x2d783[_0xba67('0x6d')]){case _0xba67('0x6e'):_0x169438[_0xba67('0x6f')]=_0xba67('0x70');break;case _0xba67('0x71'):case _0xba67('0x72'):_0x169438['Call_Result']=_0xba67('0x73');break;case'rejected':_0x169438['Call_Result']='Rejected';break;case'abandoned':_0x169438[_0xba67('0x6f')]='Abandoned';break;case _0xba67('0x74'):_0x169438[_0xba67('0x6f')]='Timeout';default:}_0x169438[_0xba67('0x75')]=(_0x11848b===_0xba67('0x76')?moment(_0x2d783[_0xba67('0x6b')])[_0xba67('0x31')](_0xba67('0x6c')):moment(_0x2d783[_0xba67('0x77')])['format'](_0xba67('0x6c')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x169438[_0xba67('0x78')]=_0x11848b||_0xba67('0x79');_0x169438=_[_0xba67('0x7a')](_0x169438,getCustomFields(_0x440e08[_0xba67('0x7b')],_0x2d783));return request({'method':_0xba67('0x42'),'uri':_0xba67('0x54')+_0x57579a+_0xba67('0x7c'),'headers':{'Authorization':_0xba67('0x34')+_0xf2b255},'body':{'data':[_0x169438]},'json':!![]})[_0xba67('0x28')](function(_0x2487e2){if(_0x2487e2&&_0x2487e2[_0xba67('0x40')][0x0][_0xba67('0x48')]===_0xba67('0x49')){logger[_0xba67('0x2f')](_0xba67('0x7d'));return{'id':_0x2487e2['data'][0x0]['details']['id']};}})[_0xba67('0x2b')](function(_0xef7f8f){logger[_0xba67('0x2f')](_0xba67('0x7e'),_0xef7f8f[_0xba67('0x2e')]);console['log']('err',_0xef7f8f);});}exports['queue']=function(_0x1755b3,_0x220e66,_0x12f206,_0x578c9c,_0x132528,_0x1fca10){var _0x1caa9b,_0x56652d,_0x22616f;_0x1fca10['host']=intUtil[_0xba67('0x7f')](_0x1fca10[_0xba67('0x80')]);_0x1fca10[_0xba67('0x81')]=intUtil[_0xba67('0x7f')](_0x1fca10[_0xba67('0x81')]);if(_0x132528&&_0x132528[_0xba67('0x82')]){logger[_0xba67('0x2f')](_0xba67('0x83'),'Recording\x20is\x20enabled!');_0x220e66[_0xba67('0x84')]=_0x1fca10['serverUrl']+'/api/voice/recordings/'+_0x220e66['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x220e66[_0xba67('0x85')]);}else{_0x220e66['recordingURL']='';}var _0x229ec1=_0x1fca10['host']===_0xba67('0x86')?'eu':_0xba67('0x87');return getAccessToken(_0x1fca10)[_0xba67('0x28')](function(_0x3c9cf7){_0x22616f=_0x3c9cf7;return getUser(_0x22616f,_0x229ec1,_0x1fca10,_0x578c9c[_0xba67('0x39')]);})[_0xba67('0x28')](function(_0x51a580){_0x1caa9b=_0x51a580;logger['info'](_0xba67('0x88'),_0x1caa9b['id']);return getEndUser(_0x22616f,_0x229ec1,_0x1fca10,_0x220e66[_0xba67('0x89')],_0x220e66[_0xba67('0x8a')],_0x1caa9b,_0x12f206);})[_0xba67('0x28')](function(_0x1c3783){_0x56652d=_0x1c3783;return getCall(_0x22616f,_0x229ec1,_0x1fca10,_0x1caa9b,_0x56652d,_0x12f206,_0x220e66,_0xba67('0x79'));})[_0xba67('0x28')](function(_0x167be3){if(_0x167be3){logger[_0xba67('0x2f')](_0xba67('0x8b'),_0x167be3['id']);logger[_0xba67('0x2f')](_0xba67('0x83'),_0xba67('0x8c'));emit(util[_0xba67('0x31')]('user:%s',_0x578c9c[_0xba67('0x18')]),'trigger:browser:url',{'uri':_0xba67('0x8d')+_0x1fca10[_0xba67('0x80')]+'/crm/EntityInfo.do?module=Calls&id='+_0x167be3['id']});}})[_0xba67('0x2b')](function(_0x21965d){logger['error'](_0xba67('0x83'),JSON['stringify'](_0x21965d));});};exports[_0xba67('0x76')]=function(_0x220538,_0x1a7ccc,_0x50f2ab,_0x18c7f2,_0x22b15a,_0x20e383,_0x4739d1){var _0x4848f3,_0x207d75,_0x584a8c;_0x20e383[_0xba67('0x80')]=intUtil['stripTrailingSlash'](_0x20e383[_0xba67('0x80')]);_0x20e383[_0xba67('0x81')]=intUtil[_0xba67('0x7f')](_0x20e383['serverUrl']);if(_0x4739d1&&_0x4739d1['recordingFormat']&&_0x4739d1['recordingFormat']!==_0xba67('0x8e')){logger['info']('[OUTBOUND]',_0xba67('0x8f'));_0x1a7ccc[_0xba67('0x84')]=_0x20e383[_0xba67('0x81')]+_0xba67('0x90')+_0x1a7ccc['uniqueid']+_0xba67('0x91')+md5(_0x1a7ccc[_0xba67('0x85')]);}var _0x1c8275=_0x20e383['host']===_0xba67('0x86')?'eu':'com';return getAccessToken(_0x20e383)['then'](function(_0x3bd285){_0x584a8c=_0x3bd285;return getUser(_0x584a8c,_0x1c8275,_0x20e383,_0x18c7f2['email']);})['then'](function(_0x3f41f0){_0x4848f3=_0x3f41f0;logger[_0xba67('0x2f')](_0xba67('0x88'),_0x4848f3['id']);return getEndUser(_0x584a8c,_0x1c8275,_0x20e383,_0x1a7ccc[_0xba67('0x92')],_0x1a7ccc[_0xba67('0x93')],_0x4848f3,_0x50f2ab);})[_0xba67('0x28')](function(_0x4cbe05){_0x207d75=_0x4cbe05;return getCall(_0x584a8c,_0x1c8275,_0x20e383,_0x4848f3,_0x207d75,_0x50f2ab,_0x1a7ccc,_0xba67('0x94'));})['then'](function(_0x544747){if(_0x544747){logger[_0xba67('0x2f')](_0xba67('0x8b'),_0x544747['id']);logger[_0xba67('0x2f')]('[OUTBOUND]',_0xba67('0x8c'));emit(util[_0xba67('0x31')](_0xba67('0x95'),_0x18c7f2[_0xba67('0x18')]),_0xba67('0x96'),{'uri':'https://crm.'+_0x20e383[_0xba67('0x80')]+_0xba67('0x97')+_0x544747['id']});}})[_0xba67('0x2b')](function(_0x3e771c){logger[_0xba67('0x2c')]('[OUTBOUND]',JSON[_0xba67('0xf')](_0x3e771c));});};exports[_0xba67('0x98')]=function(_0x575dcc,_0x7896c9,_0x53b144,_0x46abe9,_0x14fb83,_0x48551f){var _0x9f628e,_0x41017f,_0x4ef821;_0x48551f[_0xba67('0x80')]=intUtil[_0xba67('0x7f')](_0x48551f['host']);_0x48551f[_0xba67('0x81')]=intUtil[_0xba67('0x7f')](_0x48551f[_0xba67('0x81')]);if(_0x14fb83&&_0x14fb83['monitor_format']){logger[_0xba67('0x2f')]('['+_0x7896c9[_0xba67('0x6d')][_0xba67('0x99')]()+']',_0xba67('0x8f'));_0x7896c9[_0xba67('0x84')]=_0x48551f[_0xba67('0x81')]+_0xba67('0x90')+_0x7896c9[_0xba67('0x85')]+_0xba67('0x91')+md5(_0x7896c9[_0xba67('0x85')]);}else{_0x7896c9[_0xba67('0x84')]='';}var _0x278c11=_0x48551f['host']===_0xba67('0x86')?'eu':_0xba67('0x87');return getAccessToken(_0x48551f)['then'](function(_0x39073d){_0x4ef821=_0x39073d;return getUser(_0x4ef821,_0x278c11,_0x48551f);})[_0xba67('0x28')](function(_0x2d96d1){_0x9f628e=_0x2d96d1;logger[_0xba67('0x2f')](_0xba67('0x88'),_0x9f628e['id']);return getEndUser(_0x4ef821,_0x278c11,_0x48551f,_0x7896c9[_0xba67('0x89')],_0x7896c9[_0xba67('0x8a')],_0x9f628e,_0x53b144);})[_0xba67('0x28')](function(_0x326737){_0x41017f=_0x326737;return getCall(_0x4ef821,_0x278c11,_0x48551f,_0x9f628e,_0x41017f,_0x53b144,_0x7896c9,'Inbound');})[_0xba67('0x28')](function(_0x63b2ef){if(_0x63b2ef){logger[_0xba67('0x2f')]('The\x20Call\x20ID\x20is:',_0x63b2ef['id']);}})['catch'](function(_0x510d3f){logger[_0xba67('0x2c')]('['+_0x7896c9[_0xba67('0x6d')][_0xba67('0x99')]()+']',JSON[_0xba67('0xf')](_0x510d3f));});}; \ No newline at end of file +var _0x77ed=['type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','Administrator','profile','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','/crm/v2/','startCase','role','first_name','last_name','SUCCESS','enduserType','moduleCreate','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Creating\x20new\x20call...','Owner','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','outbound','agentcalledAt','merge','Fields','/crm/v2/Calls','code','Call\x20created!','details','err','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','uniqueid','host','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','zoho.eu','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','defaults','emit','debug','[HTTP]','string','picklist'];(function(_0x21b810,_0x189f45){var _0x186cfe=function(_0x3de87b){while(--_0x3de87b){_0x21b810['push'](_0x21b810['shift']());}};_0x186cfe(++_0x189f45);}(_0x77ed,0x1ba));var _0xd77e=function(_0x30d2ad,_0x3b4e07){_0x30d2ad=_0x30d2ad-0x0;var _0x125f3d=_0x77ed[_0x30d2ad];return _0x125f3d;};'use strict';var _=require(_0xd77e('0x0'));var rp=require(_0xd77e('0x1'));var md5=require('md5');var util=require(_0xd77e('0x2'));var intUtil=require(_0xd77e('0x3'));var moment=require(_0xd77e('0x4'));var Redis=require(_0xd77e('0x5'));var BPromise=require(_0xd77e('0x6'));var config=require(_0xd77e('0x7'));var logger=require('../../../../config/logger')('zoho');config['redis']=_[_0xd77e('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x2cf07c,_0x22f356,_0x1500c6){io['to'](_0x2cf07c)[_0xd77e('0x9')](_0x22f356,_0x1500c6);}function request(_0x5150a0){logger[_0xd77e('0xa')](_0xd77e('0xb'),JSON['stringify'](_0x5150a0));return rp(_0x5150a0);}function getCustomFields(_0x34d521,_0x433b04){var _0x3d6527={};if(_0x34d521['length']>0x0){_['forEach'](_0x34d521,function(_0x562f73){if(_['includes']([_0xd77e('0xc'),_0xd77e('0xd')],_0x562f73[_0xd77e('0xe')])&&_0x562f73['idField']){_0x3d6527[_0x562f73[_0xd77e('0xf')]]=_0x562f73[_0xd77e('0x10')][_0xd77e('0x11')]();}else if(_0x562f73['type']===_0xd77e('0x12')&&_0x562f73[_0xd77e('0x13')]&&_0x562f73[_0xd77e('0xf')]&&_0x433b04[_0x562f73[_0xd77e('0x13')]]){_0x3d6527[_0x562f73[_0xd77e('0xf')]]=_0x433b04[_0x562f73[_0xd77e('0x13')]][_0xd77e('0x11')]();}else if(_0x562f73[_0xd77e('0xe')]===_0xd77e('0x14')&&_0x562f73[_0xd77e('0x15')]&&_0x562f73[_0xd77e('0x15')][_0xd77e('0x16')]&&_0x562f73['idField']&&_0x433b04[_0x562f73[_0xd77e('0x15')][_0xd77e('0x16')]['toLowerCase']()]){_0x3d6527[_0x562f73[_0xd77e('0xf')]]=_0x433b04[_0x562f73[_0xd77e('0x15')]['name'][_0xd77e('0x17')]()][_0xd77e('0x11')]();}});}return _0x3d6527;}function getName(_0x2ff8f4){if(_0x2ff8f4['indexOf']('\x20')>0x0){var _0x3ff26c=_0x2ff8f4[_0xd77e('0x18')](/ (.+)/);if(_0x3ff26c[0x1]){return _0x3ff26c;}}return[_0x2ff8f4,_0x2ff8f4];}var accountsTokens={};function getAccessToken(_0xfe8f15){return new Promise(function(_0x88b05b,_0x43d9ac){if(!_[_0xd77e('0x19')](accountsTokens[_0xfe8f15['id']])&&!_['isNil'](accountsTokens[_0xfe8f15['id']][_0xd77e('0x1a')])){if(moment()['isBefore'](accountsTokens[_0xfe8f15['id']][_0xd77e('0x1b')])){_0x88b05b(accountsTokens[_0xfe8f15['id']][_0xd77e('0x1a')]);}}var _0x23e641;switch(_0xfe8f15[_0xd77e('0x1c')]){case'US':_0x23e641='https://accounts.zoho.com';break;case'AU':_0x23e641='https://accounts.zoho.com.au';break;case'EU':_0x23e641=_0xd77e('0x1d');break;case'IN':_0x23e641=_0xd77e('0x1e');break;case'CN':_0x23e641=_0xd77e('0x1f');break;default:_0x23e641=_0xd77e('0x1d');break;}var _0x1da858={'method':'POST','uri':_0x23e641+_0xd77e('0x20'),'qs':{'refresh_token':_0xfe8f15['refreshToken'],'client_id':_0xfe8f15[_0xd77e('0x21')],'client_secret':_0xfe8f15[_0xd77e('0x22')],'grant_type':_0xd77e('0x23')},'json':!![]};return rp(_0x1da858)[_0xd77e('0x24')](function(_0x3564ed){accountsTokens[_0xfe8f15['id']]={'access_token':_0x3564ed[_0xd77e('0x1a')],'expires_in':moment()[_0xd77e('0x25')](_0x3564ed['expires_in'],'seconds')};_0x88b05b(_0x3564ed[_0xd77e('0x1a')]);})[_0xd77e('0x26')](function(_0x1b0c9a){logger[_0xd77e('0x27')](_0xd77e('0x28'),_0x1b0c9a[_0xd77e('0x29')]);_0x43d9ac(_0x1b0c9a);});});}function getUser(_0xc5c3ac,_0x41c71a,_0x25aeb7,_0x29a275){logger[_0xd77e('0x2a')]('Search\x20user');return request({'method':_0xd77e('0x2b'),'uri':util[_0xd77e('0x2c')]('https://www.zohoapis.%s/crm/v2/users',_0x41c71a),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xd77e('0x2d')+_0xc5c3ac},'json':!![]})['then'](function(_0x367015){if(_0x367015[_0xd77e('0x2e')]){var _0x57ea58=-0x1;if(_[_0xd77e('0x2f')](_0x367015[_0xd77e('0x2e')])){if(!_[_0xd77e('0x19')](_0x29a275)){_0x57ea58=_[_0xd77e('0x30')](_0x367015[_0xd77e('0x2e')],function(_0x57bc50){return _0x57bc50[_0xd77e('0x31')]===_0x29a275;});}if(_0x57ea58>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xd77e('0x2a')](_0xd77e('0x32'));_0x57ea58=_[_0xd77e('0x30')](_0x367015[_0xd77e('0x2e')],function(_0x454480){return _0x454480['profile'][_0xd77e('0x16')]===_0xd77e('0x33');});}return _0x367015[_0xd77e('0x2e')][_0x57ea58];}else{if(_0x367015['user'][_0xd77e('0x34')][_0xd77e('0x16')]===_0xd77e('0x33')){logger[_0xd77e('0x2a')](_0xd77e('0x32'));user=_0x367015[_0xd77e('0x35')];return user;}else{logger[_0xd77e('0x27')](_0xd77e('0x36'),JSON[_0xd77e('0x37')](_0x367015));throw new Error(_0xd77e('0x38')+JSON[_0xd77e('0x37')](_0x367015));}}}else{logger[_0xd77e('0x27')](_0xd77e('0x36'),JSON[_0xd77e('0x37')](_0x367015));throw new Error(_0xd77e('0x38')+JSON[_0xd77e('0x37')](_0x367015));}})[_0xd77e('0x26')](function(_0x30e5a1){console[_0xd77e('0x27')](_0x30e5a1);});}function getZohoUser(_0xe4ad58,_0x9df54a){return new BPromise(function(_0x1689d3,_0x13ddd8){request(_0xe4ad58)[_0xd77e('0x24')](function(_0x2c800b){var _0x28a847=null;if(_0x2c800b){_0x28a847=_0x2c800b[_0xd77e('0x39')][0x0];_0x28a847['enduserType']=_0x9df54a;}_0x1689d3(_0x28a847);})[_0xd77e('0x26')](function(_0x207fa9){_0x13ddd8(_0x207fa9);});});}function createEndUser(_0x6d9933,_0x3d754a,_0x8db31f,_0x114b35,_0x2b50d5,_0x16ba2b){var _0x8db31f=getName(_0x8db31f);return request({'method':_0xd77e('0x3a'),'uri':'https://www.zohoapis.'+_0x3d754a+_0xd77e('0x3b')+_[_0xd77e('0x3c')](_0x16ba2b['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x8db31f[0x1],'First_Name':_0x8db31f[0x0],'Phone':_0x114b35,'Owner':{'name':!_['isNil'](_0x2b50d5[_0xd77e('0x3d')][_0xd77e('0x16')])?_0x2b50d5['role']['name']:!_['isNil'](_0x2b50d5[_0xd77e('0x3e')])?_0x2b50d5['first_name']+'\x20'+_0x2b50d5[_0xd77e('0x3f')]:_0x2b50d5[_0xd77e('0x3f')],'id':_0x2b50d5['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x6d9933},'json':!![]})[_0xd77e('0x24')](function(_0x50ed88){if(_0x50ed88&&_0x50ed88[_0xd77e('0x39')][0x0]['code']===_0xd77e('0x40')){var _0x1480b8=_0x50ed88['data'][0x0]['details'];_0x1480b8[_0xd77e('0x41')]=_[_0xd77e('0x3c')](_0x16ba2b[_0xd77e('0x42')])+'s';return _0x1480b8;}logger[_0xd77e('0x27')](_0xd77e('0x36'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0xd77e('0x37')](data));})[_0xd77e('0x26')](function(_0x187cce){console[_0xd77e('0x43')](_0xd77e('0x44'),_0x187cce);});}function getEndUser(_0x2a2c0c,_0x417a24,_0x500759,_0x4b9ff6,_0x5fd1d,_0x2b2395,_0x130a4e){var _0x1a434f={'method':_0xd77e('0x2b'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2a2c0c},'json':!![]};switch(_0x130a4e[_0xd77e('0x45')]){case _0xd77e('0x46'):_0x1a434f[_0xd77e('0x47')]=_0xd77e('0x48')+_0x417a24+_0xd77e('0x49')+_0x5fd1d+'))';return getZohoUser(_0x1a434f,_0xd77e('0x4a'))['then'](function(_0x4ee7f3){if(_0x4ee7f3)return _0x4ee7f3;_0x1a434f[_0xd77e('0x47')]='https://www.zohoapis.'+_0x417a24+_0xd77e('0x4b')+_0x5fd1d+'))';return getZohoUser(_0x1a434f,_0xd77e('0x4c'))['then'](function(_0x2e45cd){if(_0x2e45cd)return _0x2e45cd;if(_0x130a4e[_0xd77e('0x42')]!='nothing'){return createEndUser(_0x2a2c0c,_0x417a24,_0x4b9ff6,_0x5fd1d,_0x2b2395,_0x130a4e);}else{return{};}});});break;case _0xd77e('0x4d'):_0x1a434f[_0xd77e('0x47')]='https://www.zohoapis.'+_0x417a24+_0xd77e('0x49')+_0x5fd1d+'))';return getZohoUser(_0x1a434f,_0xd77e('0x4a'))['then'](function(_0x58ee51){if(_0x58ee51)return _0x58ee51;if(_0x130a4e['moduleCreate']!=_0xd77e('0x4e')){return createEndUser(_0x2a2c0c,_0x417a24,_0x4b9ff6,_0x5fd1d,_0x2b2395,_0x130a4e);}else{return{};}});break;case _0xd77e('0x4f'):_0x1a434f['uri']='https://www.zohoapis.'+_0x417a24+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5fd1d+'))';return getZohoUser(_0x1a434f,_0xd77e('0x4c'))[_0xd77e('0x24')](function(_0x3daba4){if(_0x3daba4)return _0x3daba4;if(_0x130a4e[_0xd77e('0x42')]!=_0xd77e('0x4e')){return createEndUser(_0x2a2c0c,_0x417a24,_0x4b9ff6,_0x5fd1d,_0x2b2395,_0x130a4e);}else{return{};}});break;}}function getCall(_0xfa4396,_0x46b5dd,_0x5561f1,_0x8c679c,_0x20c07f,_0x29533c,_0x104946,_0x2cf586){logger[_0xd77e('0x2a')](_0xd77e('0x50'));var _0x59f8ba={};_0x59f8ba[_0xd77e('0x51')]={'name':!_[_0xd77e('0x19')](_0x8c679c[_0xd77e('0x3d')][_0xd77e('0x16')])&&!_[_0xd77e('0x19')](_0x8c679c['profile'][_0xd77e('0x16')])&&_0x8c679c[_0xd77e('0x34')][_0xd77e('0x16')]==='administrator'?_0x8c679c[_0xd77e('0x3d')][_0xd77e('0x16')]:!_[_0xd77e('0x19')](_0x8c679c['first_name'])?_0x8c679c[_0xd77e('0x3e')]+'\x20'+_0x8c679c['last_name']:_0x8c679c[_0xd77e('0x3f')],'id':_0x8c679c['id']};_0x59f8ba[_0xd77e('0x52')]=intUtil[_0xd77e('0x53')](_0x29533c['Subjects'],_0x104946,'\x20');_0x59f8ba[_0xd77e('0x54')]=intUtil[_0xd77e('0x53')](_0x29533c[_0xd77e('0x55')],_0x104946,'\x0a');if(_0x20c07f[_0xd77e('0x41')]===_0xd77e('0x4a')){_0x59f8ba[_0xd77e('0x56')]={'name':!_[_0xd77e('0x19')](_0x20c07f[_0xd77e('0x57')])?_0x20c07f['Full_Name']:!_['isNil'](_0x20c07f['First_Name'])?_0x20c07f[_0xd77e('0x58')]+'\x20'+_0x20c07f['Last_Name']:_0x20c07f[_0xd77e('0x59')],'id':_0x20c07f['id']};}if(_0x20c07f[_0xd77e('0x41')]===_0xd77e('0x4c')){_0x59f8ba[_0xd77e('0x5a')]={'name':!_['isNil'](_0x20c07f[_0xd77e('0x57')])?_0x20c07f[_0xd77e('0x57')]:!_[_0xd77e('0x19')](_0x20c07f[_0xd77e('0x58')])?_0x20c07f[_0xd77e('0x58')]+'\x20'+_0x20c07f[_0xd77e('0x59')]:_0x20c07f[_0xd77e('0x59')],'id':_0x20c07f['id']};_0x59f8ba[_0xd77e('0x5b')]=_[_0xd77e('0x3c')](_0x20c07f['enduserType']);}if(_0x104946[_0xd77e('0x5c')]){_0x59f8ba[_0xd77e('0x5d')]=moment[_0xd77e('0x5e')](parseInt(_0x104946[_0xd77e('0x5c')])*0x3e8)[_0xd77e('0x2c')](_0xd77e('0x5f'));}else if(_0x104946[_0xd77e('0x60')]&&_0x104946[_0xd77e('0x61')]){_0x59f8ba[_0xd77e('0x5d')]=moment[_0xd77e('0x5e')](moment(_0x104946[_0xd77e('0x61')],_0xd77e('0x62'))[_0xd77e('0x63')](moment(_0x104946[_0xd77e('0x64')],_0xd77e('0x62'))))[_0xd77e('0x2c')](_0xd77e('0x5f'));}switch(_0x104946[_0xd77e('0x65')]){case _0xd77e('0x66'):_0x59f8ba[_0xd77e('0x67')]='Called';break;case _0xd77e('0x68'):case _0xd77e('0x69'):_0x59f8ba['Call_Result']=_0xd77e('0x6a');break;case _0xd77e('0x6b'):_0x59f8ba[_0xd77e('0x67')]=_0xd77e('0x6c');break;case _0xd77e('0x6d'):_0x59f8ba[_0xd77e('0x67')]='Abandoned';break;case _0xd77e('0x6e'):_0x59f8ba[_0xd77e('0x67')]=_0xd77e('0x6f');default:}_0x59f8ba['Call_Start_Time']=(_0x2cf586===_0xd77e('0x70')?moment(_0x104946['starttime'])[_0xd77e('0x2c')](_0xd77e('0x62')):moment(_0x104946[_0xd77e('0x71')])[_0xd77e('0x2c')](_0xd77e('0x62')))||moment()[_0xd77e('0x2c')]('YYYY-MM-DDTHH:mm:ss');_0x59f8ba['Call_Type']=_0x2cf586||'Inbound';_0x59f8ba=_[_0xd77e('0x72')](_0x59f8ba,getCustomFields(_0x29533c[_0xd77e('0x73')],_0x104946));return request({'method':_0xd77e('0x3a'),'uri':_0xd77e('0x48')+_0x46b5dd+_0xd77e('0x74'),'headers':{'Authorization':_0xd77e('0x2d')+_0xfa4396},'body':{'data':[_0x59f8ba]},'json':!![]})[_0xd77e('0x24')](function(_0x1bad48){if(_0x1bad48&&_0x1bad48[_0xd77e('0x39')][0x0][_0xd77e('0x75')]===_0xd77e('0x40')){logger['info'](_0xd77e('0x76'));return{'id':_0x1bad48[_0xd77e('0x39')][0x0][_0xd77e('0x77')]['id']};}})[_0xd77e('0x26')](function(_0x3fe7cc){logger[_0xd77e('0x2a')](_0xd77e('0x78'),_0x3fe7cc[_0xd77e('0x29')]);console[_0xd77e('0x43')]('err',_0x3fe7cc);});}exports[_0xd77e('0x79')]=function(_0x41cd51,_0x3b1c52,_0x4963f9,_0x121959,_0x2859ac,_0x46510a){var _0x30b94c,_0x16919d,_0x5a050e;_0x46510a['host']=intUtil[_0xd77e('0x7a')](_0x46510a['host']);_0x46510a[_0xd77e('0x7b')]=intUtil[_0xd77e('0x7a')](_0x46510a['serverUrl']);if(_0x2859ac&&_0x2859ac[_0xd77e('0x7c')]){logger['info'](_0xd77e('0x7d'),_0xd77e('0x7e'));_0x3b1c52[_0xd77e('0x7f')]=_0x46510a[_0xd77e('0x7b')]+'/api/voice/recordings/'+_0x3b1c52['uniqueid']+_0xd77e('0x80')+md5(_0x3b1c52[_0xd77e('0x81')]);}else{_0x3b1c52[_0xd77e('0x7f')]='';}var _0x181ebc=_0x46510a[_0xd77e('0x82')]==='zoho.eu'?'eu':_0xd77e('0x83');return getAccessToken(_0x46510a)[_0xd77e('0x24')](function(_0x484dd2){_0x5a050e=_0x484dd2;return getUser(_0x5a050e,_0x181ebc,_0x46510a,_0x121959[_0xd77e('0x31')]);})[_0xd77e('0x24')](function(_0x29f300){_0x30b94c=_0x29f300;logger[_0xd77e('0x2a')](_0xd77e('0x84'),_0x30b94c['id']);return getEndUser(_0x5a050e,_0x181ebc,_0x46510a,_0x3b1c52[_0xd77e('0x85')],_0x3b1c52[_0xd77e('0x86')],_0x30b94c,_0x4963f9);})['then'](function(_0x22005a){_0x16919d=_0x22005a;return getCall(_0x5a050e,_0x181ebc,_0x46510a,_0x30b94c,_0x16919d,_0x4963f9,_0x3b1c52,_0xd77e('0x87'));})[_0xd77e('0x24')](function(_0x217512){if(_0x217512){logger[_0xd77e('0x2a')](_0xd77e('0x88'),_0x217512['id']);logger[_0xd77e('0x2a')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xd77e('0x89'),_0x121959[_0xd77e('0x16')]),_0xd77e('0x8a'),{'uri':_0xd77e('0x8b')+_0x46510a[_0xd77e('0x82')]+_0xd77e('0x8c')+_0x217512['id']});}})[_0xd77e('0x26')](function(_0x1a350d){logger[_0xd77e('0x27')](_0xd77e('0x7d'),JSON['stringify'](_0x1a350d));});};exports[_0xd77e('0x70')]=function(_0x1161df,_0x404adf,_0x13d484,_0x435a70,_0x41cd5c,_0x4c6c5f,_0x33fe1e){var _0x41b41d,_0x35dc6f,_0x8b112a;_0x4c6c5f[_0xd77e('0x82')]=intUtil[_0xd77e('0x7a')](_0x4c6c5f[_0xd77e('0x82')]);_0x4c6c5f[_0xd77e('0x7b')]=intUtil[_0xd77e('0x7a')](_0x4c6c5f[_0xd77e('0x7b')]);if(_0x33fe1e&&_0x33fe1e[_0xd77e('0x8d')]&&_0x33fe1e['recordingFormat']!==_0xd77e('0x8e')){logger[_0xd77e('0x2a')](_0xd77e('0x8f'),_0xd77e('0x7e'));_0x404adf['recordingURL']=_0x4c6c5f['serverUrl']+_0xd77e('0x90')+_0x404adf[_0xd77e('0x81')]+_0xd77e('0x80')+md5(_0x404adf['uniqueid']);}var _0x346d64=_0x4c6c5f['host']===_0xd77e('0x91')?'eu':_0xd77e('0x83');return getAccessToken(_0x4c6c5f)[_0xd77e('0x24')](function(_0x5e2c52){_0x8b112a=_0x5e2c52;return getUser(_0x8b112a,_0x346d64,_0x4c6c5f,_0x435a70[_0xd77e('0x31')]);})[_0xd77e('0x24')](function(_0x37fdef){_0x41b41d=_0x37fdef;logger['info'](_0xd77e('0x84'),_0x41b41d['id']);return getEndUser(_0x8b112a,_0x346d64,_0x4c6c5f,_0x404adf[_0xd77e('0x92')],_0x404adf[_0xd77e('0x93')],_0x41b41d,_0x13d484);})[_0xd77e('0x24')](function(_0x34bbc5){_0x35dc6f=_0x34bbc5;return getCall(_0x8b112a,_0x346d64,_0x4c6c5f,_0x41b41d,_0x35dc6f,_0x13d484,_0x404adf,_0xd77e('0x94'));})[_0xd77e('0x24')](function(_0x37de2f){if(_0x37de2f){logger['info']('The\x20Call\x20ID\x20is:',_0x37de2f['id']);logger['info'](_0xd77e('0x8f'),_0xd77e('0x95'));emit(util[_0xd77e('0x2c')](_0xd77e('0x89'),_0x435a70[_0xd77e('0x16')]),_0xd77e('0x8a'),{'uri':'https://crm.'+_0x4c6c5f[_0xd77e('0x82')]+_0xd77e('0x8c')+_0x37de2f['id']});}})[_0xd77e('0x26')](function(_0x344def){logger[_0xd77e('0x27')](_0xd77e('0x8f'),JSON[_0xd77e('0x37')](_0x344def));});};exports[_0xd77e('0x96')]=function(_0x472f3e,_0x3ecb19,_0x581ec0,_0x23bdaa,_0x3dfd60,_0x49528e){var _0xe9c6bf,_0x3780cc,_0x2f2194;_0x49528e[_0xd77e('0x82')]=intUtil['stripTrailingSlash'](_0x49528e[_0xd77e('0x82')]);_0x49528e[_0xd77e('0x7b')]=intUtil[_0xd77e('0x7a')](_0x49528e[_0xd77e('0x7b')]);if(_0x3dfd60&&_0x3dfd60['monitor_format']){logger[_0xd77e('0x2a')]('['+_0x3ecb19['lastevent']['toUpperCase']()+']',_0xd77e('0x7e'));_0x3ecb19[_0xd77e('0x7f')]=_0x49528e[_0xd77e('0x7b')]+_0xd77e('0x90')+_0x3ecb19[_0xd77e('0x81')]+_0xd77e('0x80')+md5(_0x3ecb19[_0xd77e('0x81')]);}else{_0x3ecb19[_0xd77e('0x7f')]='';}var _0x333c04=_0x49528e[_0xd77e('0x82')]===_0xd77e('0x91')?'eu':_0xd77e('0x83');return getAccessToken(_0x49528e)[_0xd77e('0x24')](function(_0x1913b2){_0x2f2194=_0x1913b2;return getUser(_0x2f2194,_0x333c04,_0x49528e);})[_0xd77e('0x24')](function(_0x206a1b){_0xe9c6bf=_0x206a1b;logger[_0xd77e('0x2a')](_0xd77e('0x84'),_0xe9c6bf['id']);return getEndUser(_0x2f2194,_0x333c04,_0x49528e,_0x3ecb19[_0xd77e('0x85')],_0x3ecb19[_0xd77e('0x86')],_0xe9c6bf,_0x581ec0);})[_0xd77e('0x24')](function(_0x3a39a0){_0x3780cc=_0x3a39a0;return getCall(_0x2f2194,_0x333c04,_0x49528e,_0xe9c6bf,_0x3780cc,_0x581ec0,_0x3ecb19,_0xd77e('0x87'));})[_0xd77e('0x24')](function(_0x38c920){if(_0x38c920){logger[_0xd77e('0x2a')](_0xd77e('0x88'),_0x38c920['id']);}})['catch'](function(_0x414b6f){logger[_0xd77e('0x27')]('['+_0x3ecb19[_0xd77e('0x65')][_0xd77e('0x97')]()+']',JSON[_0xd77e('0x37')](_0x414b6f));});}; \ 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 2d42b3a..c87afa8 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 _0x3864=['data2','Script','data3','render','exec','format','info','util','shelljs','mustache'];(function(_0x515cff,_0x4fb356){var _0x128bf4=function(_0x2805c1){while(--_0x2805c1){_0x515cff['push'](_0x515cff['shift']());}};_0x128bf4(++_0x4fb356);}(_0x3864,0xf7));var _0x4386=function(_0x330213,_0x1192d7){_0x330213=_0x330213-0x0;var _0x58e5e1=_0x3864[_0x330213];return _0x58e5e1;};'use strict';var util=require(_0x4386('0x0'));var sh=require(_0x4386('0x1'));var Mustache=require(_0x4386('0x2'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x3237df,_0x3feec3){var _0x24dacb=_0x3237df[_0x4386('0x3')]?_0x3237df[_0x4386('0x3')]:_0x4386('0x4');var _0x257058=_0x3237df[_0x4386('0x5')]?Mustache[_0x4386('0x6')](_0x3237df[_0x4386('0x5')],_0x3feec3):_0x3feec3;sh[_0x4386('0x7')](_0x257058,function(_0x2c7146,_0x36b49a,_0x4315cf){if(_0x2c7146!==0x0){logger['error'](util[_0x4386('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x24dacb,_0x257058,_0x2c7146,_0x4315cf));}else{logger[_0x4386('0x9')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x24dacb,_0x257058,_0x36b49a));}});}; \ No newline at end of file +var _0x3db7=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','format','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','render','data3','error'];(function(_0x538316,_0x5d871b){var _0x2b5e61=function(_0x4ec3f0){while(--_0x4ec3f0){_0x538316['push'](_0x538316['shift']());}};_0x2b5e61(++_0x5d871b);}(_0x3db7,0x1d6));var _0x73db=function(_0x2b5bbe,_0x5044db){_0x2b5bbe=_0x2b5bbe-0x0;var _0x2f5060=_0x3db7[_0x2b5bbe];return _0x2f5060;};'use strict';var util=require(_0x73db('0x0'));var sh=require(_0x73db('0x1'));var Mustache=require(_0x73db('0x2'));var logger=require(_0x73db('0x3'))(_0x73db('0x4'));exports[_0x73db('0x5')]=function(_0x4dac7e,_0x58bb69){var _0x436200=_0x4dac7e[_0x73db('0x6')]?_0x4dac7e[_0x73db('0x6')]:_0x73db('0x7');var _0x387731=_0x4dac7e['data3']?Mustache[_0x73db('0x8')](_0x4dac7e[_0x73db('0x9')],_0x58bb69):_0x58bb69;sh[_0x73db('0x5')](_0x387731,function(_0x39bc2f,_0x32e8c9,_0x3b50a6){if(_0x39bc2f!==0x0){logger[_0x73db('0xa')](util['format'](_0x73db('0xb'),_0x436200,_0x387731,_0x39bc2f,_0x3b50a6));}else{logger['info'](util[_0x73db('0xc')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x436200,_0x387731,_0x32e8c9));}});}; \ 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 f484a1f..ec01805 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 _0x95ad=['object','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','request-promise','util','lodash','mustache','../../../../config/logger','data1','toUpperCase','render','data5','number','headers','parse','data6','stack','GET','DELETE','POST','PUT','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20'];(function(_0x44bfb4,_0x2010d8){var _0x4e38c1=function(_0x559cd2){while(--_0x559cd2){_0x44bfb4['push'](_0x44bfb4['shift']());}};_0x4e38c1(++_0x2010d8);}(_0x95ad,0xaf));var _0xd95a=function(_0x5a0491,_0x3cfad9){_0x5a0491=_0x5a0491-0x0;var _0x3664cd=_0x95ad[_0x5a0491];return _0x3664cd;};'use strict';var rp=require(_0xd95a('0x0'));var util=require(_0xd95a('0x1'));var _=require(_0xd95a('0x2'));var Mustache=require(_0xd95a('0x3'));var logger=require(_0xd95a('0x4'))('trigger');exports['exec']=function(_0x2c132a,_0x59771a){var _0x4f6936,_0x38a722;var _0xe72701={'method':_0x2c132a[_0xd95a('0x5')][_0xd95a('0x6')](),'uri':Mustache[_0xd95a('0x7')](_0x2c132a['data2'],_0x59771a),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2c132a[_0xd95a('0x8')])===_0xd95a('0x9')&&parseInt(_0x2c132a[_0xd95a('0x8')])>=0x1&&parseInt(_0x2c132a[_0xd95a('0x8')])<=0xa?parseInt(_0x2c132a['data5'])*0x3e8:0x5*0x3e8};try{_0xe72701[_0xd95a('0xa')]=_0x2c132a['data6']?JSON[_0xd95a('0xb')](Mustache[_0xd95a('0x7')](_0x2c132a[_0xd95a('0xc')],_0x59771a)):{};}catch(_0xd8ba39){logger['error'](_0xd8ba39[_0xd95a('0xd')]);}switch(_0x2c132a['data1'][_0xd95a('0x6')]()){case _0xd95a('0xe'):case _0xd95a('0xf'):_0x4f6936=null;_0xe72701['qs']=_0x59771a;break;case _0xd95a('0x10'):case _0xd95a('0x11'):if(_0x2c132a['data7']){try{_0x4f6936=JSON[_0xd95a('0xb')](Mustache['render'](_0x2c132a['data7'],_0x59771a));_0xe72701[_0xd95a('0x12')]=_0x4f6936;}catch(_0x1b9e62){logger[_0xd95a('0x13')](_0x1b9e62[_0xd95a('0xd')]);logger[_0xd95a('0x13')](_0xd95a('0x14'));}}else{_0x4f6936=_0x59771a;_0xe72701[_0xd95a('0x12')]=_0x4f6936;}break;}logger[_0xd95a('0x15')](util[_0xd95a('0x16')](_0xd95a('0x17'),_0x2c132a[_0xd95a('0x5')],_0x2c132a[_0xd95a('0x18')],JSON[_0xd95a('0x19')](_0xe72701)));rp(_0xe72701)[_0xd95a('0x1a')](function(_0x5e2a17){_0x4f6936=!_[_0xd95a('0x1b')](_0x4f6936)?_0xd95a('0x1c')+_0x4f6936:'';_0x38a722=typeof _0x5e2a17[_0xd95a('0x12')]===_0xd95a('0x1d')?JSON['stringify'](_0x5e2a17[_0xd95a('0x12')]):_0x5e2a17['body'];logger['info'](util[_0xd95a('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x2c132a[_0xd95a('0x5')],_0x2c132a[_0xd95a('0x18')],_0x5e2a17['statusCode'],_0x38a722));})[_0xd95a('0x1e')](function(_0xb4e2dd){logger['error'](util[_0xd95a('0x16')](_0xd95a('0x1f'),_0x2c132a[_0xd95a('0x5')],_0x2c132a[_0xd95a('0x18')],_0xb4e2dd[_0xd95a('0x20')],_0xb4e2dd[_0xd95a('0x21')],_0xb4e2dd['message']));});}; \ No newline at end of file +var _0x5ebd=['data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','stringify','object','body','format','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','util','lodash','mustache','../../../../config/logger','trigger','data1','toUpperCase','render','data2','data5','number','headers','parse','error','stack','GET','DELETE','POST','PUT'];(function(_0x1196bd,_0xba4aea){var _0x26014f=function(_0x542a3d){while(--_0x542a3d){_0x1196bd['push'](_0x1196bd['shift']());}};_0x26014f(++_0xba4aea);}(_0x5ebd,0x183));var _0xd5eb=function(_0x16d8db,_0x6a1999){_0x16d8db=_0x16d8db-0x0;var _0x51ca48=_0x5ebd[_0x16d8db];return _0x51ca48;};'use strict';var rp=require('request-promise');var util=require(_0xd5eb('0x0'));var _=require(_0xd5eb('0x1'));var Mustache=require(_0xd5eb('0x2'));var logger=require(_0xd5eb('0x3'))(_0xd5eb('0x4'));exports['exec']=function(_0x281731,_0x4d5ffc){var _0x2ef5b0,_0x18c335;var _0x16d0e1={'method':_0x281731[_0xd5eb('0x5')][_0xd5eb('0x6')](),'uri':Mustache[_0xd5eb('0x7')](_0x281731[_0xd5eb('0x8')],_0x4d5ffc),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x281731[_0xd5eb('0x9')])===_0xd5eb('0xa')&&parseInt(_0x281731[_0xd5eb('0x9')])>=0x1&&parseInt(_0x281731[_0xd5eb('0x9')])<=0xa?parseInt(_0x281731[_0xd5eb('0x9')])*0x3e8:0x5*0x3e8};try{_0x16d0e1[_0xd5eb('0xb')]=_0x281731['data6']?JSON[_0xd5eb('0xc')](Mustache['render'](_0x281731['data6'],_0x4d5ffc)):{};}catch(_0x174d32){logger[_0xd5eb('0xd')](_0x174d32[_0xd5eb('0xe')]);}switch(_0x281731[_0xd5eb('0x5')][_0xd5eb('0x6')]()){case _0xd5eb('0xf'):case _0xd5eb('0x10'):_0x2ef5b0=null;_0x16d0e1['qs']=_0x4d5ffc;break;case _0xd5eb('0x11'):case _0xd5eb('0x12'):if(_0x281731[_0xd5eb('0x13')]){try{_0x2ef5b0=JSON['parse'](Mustache[_0xd5eb('0x7')](_0x281731['data7'],_0x4d5ffc));_0x16d0e1['body']=_0x2ef5b0;}catch(_0x585742){logger['error'](_0x585742[_0xd5eb('0xe')]);logger['error'](_0xd5eb('0x14'));}}else{_0x2ef5b0=_0x4d5ffc;_0x16d0e1['body']=_0x2ef5b0;}break;}logger[_0xd5eb('0x15')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x281731[_0xd5eb('0x5')],_0x281731['data2'],JSON[_0xd5eb('0x16')](_0x16d0e1)));rp(_0x16d0e1)['then'](function(_0x21e7af){_0x2ef5b0=!_['isNil'](_0x2ef5b0)?',\x20request\x20body:\x20'+_0x2ef5b0:'';_0x18c335=typeof _0x21e7af['body']===_0xd5eb('0x17')?JSON[_0xd5eb('0x16')](_0x21e7af[_0xd5eb('0x18')]):_0x21e7af[_0xd5eb('0x18')];logger[_0xd5eb('0x15')](util[_0xd5eb('0x19')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x281731[_0xd5eb('0x5')],_0x281731[_0xd5eb('0x8')],_0x21e7af['statusCode'],_0x18c335));})[_0xd5eb('0x1a')](function(_0x4d562e){logger[_0xd5eb('0xd')](util['format'](_0xd5eb('0x1b'),_0x281731['data1'],_0x281731['data2'],_0x4d562e['statusCode'],_0x4d562e[_0xd5eb('0x1c')],_0x4d562e['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index e9dbd75..6587fd9 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 _0x5e67=['debug','rpc','error','result','exports','jayson/promise','bluebird','routing','client','request','then'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x5e67,0x191));var _0x75e6=function(_0x206037,_0x4ddf97){_0x206037=_0x206037-0x0;var _0x58b1e9=_0x5e67[_0x206037];return _0x58b1e9;};'use strict';var jayson=require(_0x75e6('0x0'));var BPromise=require(_0x75e6('0x1'));var logger=require('../../config/logger')(_0x75e6('0x2'));var client=jayson[_0x75e6('0x3')]['http']({'port':0x2329});client['Request']=function(_0x12b51b,_0x503cb3){return new BPromise(function(_0xd3be94,_0x3cb2f4){return client[_0x75e6('0x4')](_0x12b51b,_0x503cb3)[_0x75e6('0x5')](function(_0x397bc2){logger[_0x75e6('0x6')](_0x75e6('0x7'),_0x75e6('0x2'),_0x12b51b,_0x503cb3,_0x397bc2);if(_0x397bc2[_0x75e6('0x8')]){logger[_0x75e6('0x8')]('rpc',_0x75e6('0x2'),_0x12b51b,_0x397bc2['error']['message'],_0x503cb3);return _0x3cb2f4(_0x397bc2['error']['message']);}else{return _0xd3be94(_0x397bc2[_0x75e6('0x9')]);}})['catch'](function(_0x1892e9){logger[_0x75e6('0x8')](_0x75e6('0x7'),_0x75e6('0x2'),_0x12b51b,_0x1892e9,_0x503cb3);return _0x3cb2f4(_0x1892e9);});});};module[_0x75e6('0xa')]=client; \ No newline at end of file +var _0xd52f=['then','rpc','error','message','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request'];(function(_0x271234,_0x2f92bb){var _0x3ce947=function(_0x2d6d99){while(--_0x2d6d99){_0x271234['push'](_0x271234['shift']());}};_0x3ce947(++_0x2f92bb);}(_0xd52f,0x1d9));var _0xfd52=function(_0xef59,_0x3d8e11){_0xef59=_0xef59-0x0;var _0x1cf63f=_0xd52f[_0xef59];return _0x1cf63f;};'use strict';var jayson=require(_0xfd52('0x0'));var BPromise=require(_0xfd52('0x1'));var logger=require(_0xfd52('0x2'))(_0xfd52('0x3'));var client=jayson[_0xfd52('0x4')][_0xfd52('0x5')]({'port':0x2329});client[_0xfd52('0x6')]=function(_0x1de7da,_0x3baaa5){return new BPromise(function(_0x37387f,_0x2f5bb1){return client[_0xfd52('0x7')](_0x1de7da,_0x3baaa5)[_0xfd52('0x8')](function(_0x5b8a60){logger['debug'](_0xfd52('0x9'),_0xfd52('0x3'),_0x1de7da,_0x3baaa5,_0x5b8a60);if(_0x5b8a60[_0xfd52('0xa')]){logger[_0xfd52('0xa')](_0xfd52('0x9'),_0xfd52('0x3'),_0x1de7da,_0x5b8a60[_0xfd52('0xa')]['message'],_0x3baaa5);return _0x2f5bb1(_0x5b8a60[_0xfd52('0xa')][_0xfd52('0xb')]);}else{return _0x37387f(_0x5b8a60['result']);}})[_0xfd52('0xc')](function(_0x1f1e26){logger['error'](_0xfd52('0x9'),_0xfd52('0x3'),_0x1de7da,_0x1f1e26,_0x3baaa5);return _0x2f5bb1(_0x1f1e26);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 3616f2d..ff7aafa 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 _0x6a7e=['listen','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','../../config/logger','resolve','getMailAccounts','initMailAccounts','then','refresh'];(function(_0x1a957b,_0x3a5dca){var _0x2b79f4=function(_0x113582){while(--_0x113582){_0x1a957b['push'](_0x1a957b['shift']());}};_0x2b79f4(++_0x3a5dca);}(_0x6a7e,0x138));var _0xe6a7=function(_0x50507f,_0x5e29e9){_0x50507f=_0x50507f-0x0;var _0x242b06=_0x6a7e[_0x50507f];return _0x242b06;};'use strict';var server=require(_0xe6a7('0x0'));var Realtime=require(_0xe6a7('0x1'));var EmailChannel=require(_0xe6a7('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xe6a7('0x3'));var logger=require(_0xe6a7('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xe6a7('0x5')]()['then'](mailAccount[_0xe6a7('0x6')]())['then'](realtime[_0xe6a7('0x7')]())[_0xe6a7('0x8')](function(){email[_0xe6a7('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xe6a7('0xa')](realtime,email)[_0xe6a7('0x8')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0xe6a7('0x8')](function(_0x5d1e53){return setInterval(initRealtime,_0x5d1e53[_0xe6a7('0xb')]*0x3e8);})[_0xe6a7('0xc')](function(_0x130c98){logger['error'](_0xe6a7('0xd'),_0x130c98);});}main(); \ No newline at end of file +var _0xb1c6=['error','Email\x20service\x20initialization','./lib/email','./rpc/setting','../../config/logger','email','resolve','then','initMailAccounts','refresh','mailAccounts','listen','loginMailFrequency'];(function(_0x555782,_0x355de0){var _0x15c116=function(_0x3c81aa){while(--_0x3c81aa){_0x555782['push'](_0x555782['shift']());}};_0x15c116(++_0x355de0);}(_0xb1c6,0x12d));var _0x6b1c=function(_0x564bec,_0x4e98e2){_0x564bec=_0x564bec-0x0;var _0x8dc0f7=_0xb1c6[_0x564bec];return _0x8dc0f7;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x6b1c('0x0'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x6b1c('0x1'));var logger=require(_0x6b1c('0x2'))(_0x6b1c('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x6b1c('0x4')]()['then'](mailAccount['getMailAccounts']())[_0x6b1c('0x5')](realtime[_0x6b1c('0x6')]())[_0x6b1c('0x5')](function(){email[_0x6b1c('0x7')](realtime[_0x6b1c('0x8')]);return realtime;});}function main(){return server[_0x6b1c('0x9')](realtime,email)['then'](function(){return initRealtime();})[_0x6b1c('0x5')](function(){return setting['getSettings']();})['then'](function(_0x309b20){return setInterval(initRealtime,_0x309b20[_0x6b1c('0xa')]*0x3e8);})['catch'](function(_0x1ab065){logger[_0x6b1c('0xb')](_0x6b1c('0xc'),_0x1ab065);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index e03068a..f97740a 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 _0xa71e=['handleImapEmail','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','error','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','service','provider','custom','hasOwnProperty','email','box','handleImapBox','bind','end','handleImapEnd','handleImapError','disabled','connected','name','messages','total'];(function(_0x455959,_0x27e796){var _0x1e54c2=function(_0x30a0a7){while(--_0x30a0a7){_0x455959['push'](_0x455959['shift']());}};_0x1e54c2(++_0x27e796);}(_0xa71e,0x1e8));var _0xea71=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0xa71e[_0x17823f];return _0x51fc21;};'use strict';var _=require(_0xea71('0x0'));var moment=require(_0xea71('0x1'));var BPromise=require(_0xea71('0x2'));var md5=require(_0xea71('0x3'));var Redis=require(_0xea71('0x4'));var config=require(_0xea71('0x5'));var logger=require(_0xea71('0x6'))('email');config['redis']=_[_0xea71('0x7')](config[_0xea71('0x8')],{'host':_0xea71('0x9'),'port':0x18eb});var io=require(_0xea71('0xa'))(new Redis(config[_0xea71('0x8')]));var EmailImap=require(_0xea71('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x41fcfa){logger[_0xea71('0xc')](_0xea71('0xd'));this[_0xea71('0xe')]=_0x41fcfa[_0xea71('0xe')];this[_0xea71('0xf')]={};this[_0xea71('0x10')]=new EmailSmtp();}EmailChannel[_0xea71('0x11')][_0xea71('0x12')]=function(_0x56cd97){var _0x179070=this[_0xea71('0xe')][_0x56cd97];var _0x1fb309={'id':_0x179070['id'],'name':_0x179070['name'],'key':_0x179070[_0xea71('0x13')],'active':_0x179070[_0xea71('0x14')],'Imap':{'status':_0x179070[_0xea71('0x15')][_0xea71('0x16')],'messageStatus':_0x179070[_0xea71('0x15')][_0xea71('0x17')],'total':_0x179070[_0xea71('0x15')]['total']}};if(_[_0xea71('0x18')](md5Accounts[_0x56cd97])){md5Accounts[_0x56cd97]={};}var _0x1a7599=md5(JSON[_0xea71('0x19')](_0x1fb309));if(md5Accounts[_0x56cd97]['md5']!==_0x1a7599){md5Accounts[_0x56cd97]['md5']=_0x1a7599;io[_0xea71('0x12')](_0xea71('0x1a'),_0x1fb309);}};EmailChannel[_0xea71('0x11')]['refresh']=function(_0x3a0596){for(var _0x4ed2c1 in _0x3a0596){if(_0x3a0596['hasOwnProperty'](_0x4ed2c1)){if(_0x3a0596[_0x4ed2c1][_0xea71('0x15')]&&_0x3a0596[_0x4ed2c1][_0xea71('0x14')]){var _0x5a9004=_0x3a0596[_0x4ed2c1][_0xea71('0x15')];if(!_0x5a9004[_0xea71('0x1b')]&&_0x3a0596[_0x4ed2c1][_0xea71('0x1c')]!==_0xea71('0x1d'))_0x5a9004[_0xea71('0x1b')]=_0x3a0596[_0x4ed2c1]['provider'];if(!this[_0xea71('0xf')][_0xea71('0x1e')](_0x5a9004['id'])){this['imapAccounts'][_0x5a9004['id']]=new EmailImap(_0x5a9004,_0x3a0596[_0x4ed2c1][_0xea71('0x1f')]);this[_0xea71('0xf')][_0x5a9004['id']]['on'](_0xea71('0x20'),this[_0xea71('0x21')][_0xea71('0x22')](this,_0x4ed2c1));this['imapAccounts'][_0x5a9004['id']]['on'](_0xea71('0x1f'),this['handleImapEmail']['bind'](this,_0x4ed2c1));this[_0xea71('0xf')][_0x5a9004['id']]['on'](_0xea71('0x23'),this[_0xea71('0x24')][_0xea71('0x22')](this,_0x4ed2c1));this[_0xea71('0xf')][_0x5a9004['id']]['on']('error',this[_0xea71('0x25')][_0xea71('0x22')](this,_0x4ed2c1));}}else{if(_['isNil'](this[_0xea71('0xe')][_0x4ed2c1]['Imap'])){this[_0xea71('0xe')][_0x4ed2c1][_0xea71('0x15')]={};}this[_0xea71('0xe')][_0x4ed2c1]['Imap'][_0xea71('0x16')]=_0xea71('0x26');this[_0xea71('0xe')][_0x4ed2c1][_0xea71('0x15')]['messageStatus']='';this[_0xea71('0x12')](_0x4ed2c1);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x401119,_0x25558e){if(this[_0xea71('0xe')][_0x401119]){this[_0xea71('0xe')][_0x401119][_0xea71('0x15')][_0xea71('0x16')]=_0xea71('0x27');this[_0xea71('0xe')][_0x401119][_0xea71('0x15')][_0xea71('0x17')]=_0x25558e[_0xea71('0x28')];if(_0x25558e[_0xea71('0x29')]){this['mailAccounts'][_0x401119][_0xea71('0x15')][_0xea71('0x2a')]=_0x25558e['messages'][_0xea71('0x2a')];}return this[_0xea71('0x12')](_0x401119);}};EmailChannel[_0xea71('0x11')][_0xea71('0x2b')]=function(_0x45a13a,_0x4c6d48){logger[_0xea71('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x4c6d48[_0xea71('0x2c')],_0x4c6d48[_0xea71('0x2d')],_0x4c6d48[_0xea71('0x2e')],_0x45a13a);if(this['mailAccounts'][_0x45a13a]){return mailAccount[_0xea71('0x2f')](_0x45a13a,_0x4c6d48)[_0xea71('0x30')](function(_0x2973c5){if(_0x2973c5){logger[_0xea71('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0xea71('0x31')](function(_0x36eeb1){logger['error'](_0xea71('0x32'),JSON[_0xea71('0x19')](_0x36eeb1));});}};EmailChannel[_0xea71('0x11')]['handleImapEnd']=function(_0x9271bb){if(this[_0xea71('0xe')][_0x9271bb]&&this[_0xea71('0xe')][_0x9271bb][_0xea71('0x15')]){if(this['imapAccounts'][this[_0xea71('0xe')][_0x9271bb]['Imap']['id']]){delete this[_0xea71('0xf')][this[_0xea71('0xe')][_0x9271bb][_0xea71('0x15')]['id']];}this[_0xea71('0xe')][_0x9271bb][_0xea71('0x15')][_0xea71('0x33')]=moment();this[_0xea71('0x12')](_0x9271bb);}};EmailChannel[_0xea71('0x11')][_0xea71('0x25')]=function(_0x3a9865,_0xbfd5ee){if(this[_0xea71('0xe')][_0x3a9865]){this[_0xea71('0xe')][_0x3a9865][_0xea71('0x15')][_0xea71('0x16')]=_0xea71('0x34');this[_0xea71('0xe')][_0x3a9865]['Imap'][_0xea71('0x17')]=_0xbfd5ee;return this['emit'](_0x3a9865);}};EmailChannel[_0xea71('0x11')]['sendMail']=function(_0xf8c91b,_0x29f902){return this['smtp'][_0xea71('0x35')](_0xf8c91b,_0x29f902);};EmailChannel[_0xea71('0x11')][_0xea71('0x36')]=function(_0x3356d1){var _0x4d1afc=this;if(this[_0xea71('0xe')][_0x3356d1['id']]){if(_[_0xea71('0x18')](this[_0xea71('0xe')][_0x3356d1['id']]['Smtp'])){this[_0xea71('0xe')][_0x3356d1['id']][_0xea71('0x37')]={};}this[_0xea71('0xe')][_0x3356d1['id']][_0xea71('0x37')][_0xea71('0x33')]=moment();return new BPromise(function(_0x326b46,_0x2f9500){return _0x4d1afc[_0xea71('0x10')][_0xea71('0x38')](_0x3356d1)[_0xea71('0x30')](function(_0x476dee){_0x4d1afc[_0xea71('0xe')][_0x3356d1['id']][_0xea71('0x37')][_0xea71('0x16')]=_0xea71('0x39');_0x4d1afc[_0xea71('0xe')][_0x3356d1['id']][_0xea71('0x37')]['messageStatus']='';_0x4d1afc[_0xea71('0x12')](_0x3356d1['id']);_0x326b46(_0x476dee);})[_0xea71('0x31')](function(_0x486861){_0x4d1afc['mailAccounts'][_0x3356d1['id']][_0xea71('0x37')][_0xea71('0x16')]=_0xea71('0x34');_0x4d1afc[_0xea71('0xe')][_0x3356d1['id']][_0xea71('0x37')][_0xea71('0x17')]=_0x486861;_0x4d1afc[_0xea71('0x12')](_0x3356d1['id']);_0x2f9500(_0x486861);});});}return this[_0xea71('0x10')][_0xea71('0x38')](_0x3356d1);};module[_0xea71('0x3a')]=EmailChannel; \ No newline at end of file +var _0x5a9c=['service','provider','custom','email','box','handleImapEmail','bind','handleImapEnd','handleImapError','disabled','handleImapBox','connected','messages','total','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','Smtp','then','verified','verify','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x5a9c,0xcb));var _0xc5a9=function(_0x3c0b37,_0x5da0fa){_0x3c0b37=_0x3c0b37-0x0;var _0x4cfd9b=_0x5a9c[_0x3c0b37];return _0x4cfd9b;};'use strict';var _=require('lodash');var moment=require(_0xc5a9('0x0'));var BPromise=require(_0xc5a9('0x1'));var md5=require(_0xc5a9('0x2'));var Redis=require(_0xc5a9('0x3'));var config=require(_0xc5a9('0x4'));var logger=require(_0xc5a9('0x5'))('email');config[_0xc5a9('0x6')]=_[_0xc5a9('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc5a9('0x8'))(new Redis(config[_0xc5a9('0x6')]));var EmailImap=require(_0xc5a9('0x9'));var EmailSmtp=require(_0xc5a9('0xa'));var mailAccount=require(_0xc5a9('0xb'));var md5Accounts={};function EmailChannel(_0x1f6010){logger['info'](_0xc5a9('0xc'));this[_0xc5a9('0xd')]=_0x1f6010['mailAccounts'];this[_0xc5a9('0xe')]={};this[_0xc5a9('0xf')]=new EmailSmtp();}EmailChannel[_0xc5a9('0x10')][_0xc5a9('0x11')]=function(_0xde16d){var _0x41ff80=this[_0xc5a9('0xd')][_0xde16d];var _0x2f650f={'id':_0x41ff80['id'],'name':_0x41ff80[_0xc5a9('0x12')],'key':_0x41ff80[_0xc5a9('0x13')],'active':_0x41ff80[_0xc5a9('0x14')],'Imap':{'status':_0x41ff80[_0xc5a9('0x15')][_0xc5a9('0x16')],'messageStatus':_0x41ff80[_0xc5a9('0x15')][_0xc5a9('0x17')],'total':_0x41ff80[_0xc5a9('0x15')]['total']}};if(_[_0xc5a9('0x18')](md5Accounts[_0xde16d])){md5Accounts[_0xde16d]={};}var _0x140a09=md5(JSON[_0xc5a9('0x19')](_0x2f650f));if(md5Accounts[_0xde16d][_0xc5a9('0x2')]!==_0x140a09){md5Accounts[_0xde16d][_0xc5a9('0x2')]=_0x140a09;io[_0xc5a9('0x11')](_0xc5a9('0x1a'),_0x2f650f);}};EmailChannel['prototype'][_0xc5a9('0x1b')]=function(_0x592640){for(var _0x5d6310 in _0x592640){if(_0x592640[_0xc5a9('0x1c')](_0x5d6310)){if(_0x592640[_0x5d6310]['Imap']&&_0x592640[_0x5d6310][_0xc5a9('0x14')]){var _0x2ace6e=_0x592640[_0x5d6310][_0xc5a9('0x15')];if(!_0x2ace6e[_0xc5a9('0x1d')]&&_0x592640[_0x5d6310][_0xc5a9('0x1e')]!==_0xc5a9('0x1f'))_0x2ace6e[_0xc5a9('0x1d')]=_0x592640[_0x5d6310][_0xc5a9('0x1e')];if(!this[_0xc5a9('0xe')][_0xc5a9('0x1c')](_0x2ace6e['id'])){this['imapAccounts'][_0x2ace6e['id']]=new EmailImap(_0x2ace6e,_0x592640[_0x5d6310][_0xc5a9('0x20')]);this['imapAccounts'][_0x2ace6e['id']]['on'](_0xc5a9('0x21'),this['handleImapBox']['bind'](this,_0x5d6310));this[_0xc5a9('0xe')][_0x2ace6e['id']]['on'](_0xc5a9('0x20'),this[_0xc5a9('0x22')][_0xc5a9('0x23')](this,_0x5d6310));this[_0xc5a9('0xe')][_0x2ace6e['id']]['on']('end',this[_0xc5a9('0x24')][_0xc5a9('0x23')](this,_0x5d6310));this[_0xc5a9('0xe')][_0x2ace6e['id']]['on']('error',this[_0xc5a9('0x25')][_0xc5a9('0x23')](this,_0x5d6310));}}else{if(_[_0xc5a9('0x18')](this[_0xc5a9('0xd')][_0x5d6310][_0xc5a9('0x15')])){this[_0xc5a9('0xd')][_0x5d6310][_0xc5a9('0x15')]={};}this[_0xc5a9('0xd')][_0x5d6310][_0xc5a9('0x15')]['status']=_0xc5a9('0x26');this[_0xc5a9('0xd')][_0x5d6310][_0xc5a9('0x15')][_0xc5a9('0x17')]='';this[_0xc5a9('0x11')](_0x5d6310);}}}};EmailChannel[_0xc5a9('0x10')][_0xc5a9('0x27')]=function(_0x5de278,_0x3f150b){if(this[_0xc5a9('0xd')][_0x5de278]){this[_0xc5a9('0xd')][_0x5de278][_0xc5a9('0x15')][_0xc5a9('0x16')]=_0xc5a9('0x28');this[_0xc5a9('0xd')][_0x5de278][_0xc5a9('0x15')][_0xc5a9('0x17')]=_0x3f150b[_0xc5a9('0x12')];if(_0x3f150b[_0xc5a9('0x29')]){this[_0xc5a9('0xd')][_0x5de278][_0xc5a9('0x15')]['total']=_0x3f150b[_0xc5a9('0x29')][_0xc5a9('0x2a')];}return this[_0xc5a9('0x11')](_0x5de278);}};EmailChannel[_0xc5a9('0x10')][_0xc5a9('0x22')]=function(_0x2b61bb,_0x4c2c9d){logger[_0xc5a9('0x2b')](_0xc5a9('0x2c'),_0x4c2c9d[_0xc5a9('0x2d')],_0x4c2c9d['lastName'],_0x4c2c9d[_0xc5a9('0x2e')],_0x2b61bb);if(this[_0xc5a9('0xd')][_0x2b61bb]){return mailAccount['notify'](_0x2b61bb,_0x4c2c9d)['then'](function(_0x103899){if(_0x103899){logger['info'](_0xc5a9('0x2f'));}})[_0xc5a9('0x30')](function(_0x5443b6){logger[_0xc5a9('0x31')](_0xc5a9('0x32'),JSON['stringify'](_0x5443b6));});}};EmailChannel[_0xc5a9('0x10')][_0xc5a9('0x24')]=function(_0x45847b){if(this['mailAccounts'][_0x45847b]&&this[_0xc5a9('0xd')][_0x45847b]['Imap']){if(this[_0xc5a9('0xe')][this['mailAccounts'][_0x45847b][_0xc5a9('0x15')]['id']]){delete this[_0xc5a9('0xe')][this['mailAccounts'][_0x45847b][_0xc5a9('0x15')]['id']];}this[_0xc5a9('0xd')][_0x45847b]['Imap'][_0xc5a9('0x33')]=moment();this[_0xc5a9('0x11')](_0x45847b);}};EmailChannel[_0xc5a9('0x10')][_0xc5a9('0x25')]=function(_0x14ea9b,_0x61099b){if(this[_0xc5a9('0xd')][_0x14ea9b]){this[_0xc5a9('0xd')][_0x14ea9b][_0xc5a9('0x15')][_0xc5a9('0x16')]=_0xc5a9('0x31');this[_0xc5a9('0xd')][_0x14ea9b][_0xc5a9('0x15')][_0xc5a9('0x17')]=_0x61099b;return this[_0xc5a9('0x11')](_0x14ea9b);}};EmailChannel[_0xc5a9('0x10')]['sendMail']=function(_0x2df353,_0x505c2e){return this['smtp'][_0xc5a9('0x34')](_0x2df353,_0x505c2e);};EmailChannel[_0xc5a9('0x10')]['verifySmtp']=function(_0x1c4f72){var _0x38b6b6=this;if(this['mailAccounts'][_0x1c4f72['id']]){if(_[_0xc5a9('0x18')](this[_0xc5a9('0xd')][_0x1c4f72['id']][_0xc5a9('0x35')])){this[_0xc5a9('0xd')][_0x1c4f72['id']][_0xc5a9('0x35')]={};}this['mailAccounts'][_0x1c4f72['id']][_0xc5a9('0x35')]['lastSync']=moment();return new BPromise(function(_0x11b877,_0x1bf846){return _0x38b6b6[_0xc5a9('0xf')]['verify'](_0x1c4f72)[_0xc5a9('0x36')](function(_0x31e4b9){_0x38b6b6[_0xc5a9('0xd')][_0x1c4f72['id']]['Smtp'][_0xc5a9('0x16')]=_0xc5a9('0x37');_0x38b6b6[_0xc5a9('0xd')][_0x1c4f72['id']][_0xc5a9('0x35')]['messageStatus']='';_0x38b6b6[_0xc5a9('0x11')](_0x1c4f72['id']);_0x11b877(_0x31e4b9);})['catch'](function(_0x8625c8){_0x38b6b6[_0xc5a9('0xd')][_0x1c4f72['id']][_0xc5a9('0x35')]['status']=_0xc5a9('0x31');_0x38b6b6[_0xc5a9('0xd')][_0x1c4f72['id']][_0xc5a9('0x35')]['messageStatus']=_0x8625c8;_0x38b6b6[_0xc5a9('0x11')](_0x1c4f72['id']);_0x1bf846(_0x8625c8);});});}return this[_0xc5a9('0xf')][_0xc5a9('0x38')](_0x1c4f72);};module[_0xc5a9('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 ebceb7c..3114cea 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 _0xcd27=['events','EventEmitter','account','getAccount','ready','bind','once','end','handleEnd','error','handleError','inherits','prototype','connTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','port','tls','required','handleReady','mailbox','handleOpenBox','emit','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleCloseBox','stringify','textCode','upperFirst','lodash','imap','Iconv'];(function(_0x519380,_0x7f196){var _0x60ba2c=function(_0x5b2110){while(--_0x5b2110){_0x519380['push'](_0x519380['shift']());}};_0x60ba2c(++_0x7f196);}(_0xcd27,0x1c5));var _0x7cd2=function(_0x412ac1,_0x84ea47){_0x412ac1=_0x412ac1-0x0;var _0xe6c244=_0xcd27[_0x412ac1];return _0xe6c244;};'use strict';var _=require(_0x7cd2('0x0'));var util=require('util');var Imap=require(_0x7cd2('0x1'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require('iconv')[_0x7cd2('0x2')];var EventEmitter=require(_0x7cd2('0x3'))[_0x7cd2('0x4')];var utils=require('./utils');var logger=require('../../../config/logger')('email');function EmailImap(_0xddc48c,_0x1ee163){this['mailbox']=_0xddc48c['mailbox'];this[_0x7cd2('0x5')]=this[_0x7cd2('0x6')](_0xddc48c,_0x1ee163);this[_0x7cd2('0x1')]=new Imap(this[_0x7cd2('0x5')]);this[_0x7cd2('0x1')]['once'](_0x7cd2('0x7'),this['handleReady'][_0x7cd2('0x8')](this));this[_0x7cd2('0x1')][_0x7cd2('0x9')](_0x7cd2('0xa'),this[_0x7cd2('0xb')][_0x7cd2('0x8')](this));this[_0x7cd2('0x1')]['on'](_0x7cd2('0xc'),this[_0x7cd2('0xd')]['bind'](this));this['imap']['connect']();}util[_0x7cd2('0xe')](EmailImap,EventEmitter);EmailImap[_0x7cd2('0xf')]['getAccount']=function(_0x239024,_0x4746ef){var _0x4980f8={'connTimeout':_0x239024[_0x7cd2('0x10')]?_0x239024['connTimeout']*0x3e8:0x2710,'authTimeout':_0x239024['authTimeout']?_0x239024['authTimeout']*0x3e8:0x1388};if(_0x239024[_0x7cd2('0x11')]){_0x4980f8[_0x7cd2('0x12')]=_0x239024['user'];if(_0x239024[_0x7cd2('0x13')]){_0x4980f8[_0x7cd2('0x14')]=utils[_0x7cd2('0x15')](_0x239024[_0x7cd2('0x16')][_0x7cd2('0x17')],_0x239024[_0x7cd2('0x12')]);}else{_0x4980f8[_0x7cd2('0x18')]=_0x239024[_0x7cd2('0x18')];}}else{if(_0x239024[_0x7cd2('0x19')]){_0x4980f8['user']=_0x239024[_0x7cd2('0x12')];_0x4980f8[_0x7cd2('0x18')]=_0x239024[_0x7cd2('0x18')];}}_0x4980f8[_0x7cd2('0x1a')]=_0x4746ef||_0x239024[_0x7cd2('0x12')]||_0x7cd2('0x1b');_0x4980f8['host']=_0x239024[_0x7cd2('0x1c')];_0x4980f8[_0x7cd2('0x1d')]=_0x239024[_0x7cd2('0x1d')]||0x3e1;if(_0x239024[_0x7cd2('0x1e')]){_0x4980f8[_0x7cd2('0x1e')]=!![];}else{_0x4980f8[_0x7cd2('0x1e')]=![];_0x4980f8['autotls']=_0x7cd2('0x1f');}return _0x4980f8;};EmailImap[_0x7cd2('0xf')][_0x7cd2('0x20')]=function(){this[_0x7cd2('0x1')]['openBox'](this[_0x7cd2('0x21')],![],this[_0x7cd2('0x22')]['bind'](this));};EmailImap[_0x7cd2('0xf')][_0x7cd2('0x22')]=function(_0x4ed383,_0x33d824){if(_0x4ed383){this[_0x7cd2('0xd')](_0x4ed383,!![]);}else{this[_0x7cd2('0x23')]('box',_0x33d824);this[_0x7cd2('0x24')]();}};EmailImap[_0x7cd2('0xf')]['handleCloseBox']=function(_0xf93f01){if(_0xf93f01){this[_0x7cd2('0xd')](_0xf93f01,!![]);}else{this['imap'][_0x7cd2('0xa')]();}};EmailImap[_0x7cd2('0xf')]['readUnseen']=function(){this[_0x7cd2('0x1')][_0x7cd2('0x25')]([_0x7cd2('0x26')],this[_0x7cd2('0x27')][_0x7cd2('0x8')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x4ff85a,_0x5e85f7){if(_0x4ff85a){this[_0x7cd2('0xd')](_0x4ff85a,!![]);}else{if(_0x5e85f7[_0x7cd2('0x28')]){try{var _0x5c4bdc=this[_0x7cd2('0x1')][_0x7cd2('0x29')](_0x5e85f7,{'bodies':'','markSeen':!![]});_0x5c4bdc['on'](_0x7cd2('0x2a'),this[_0x7cd2('0x2b')]['bind'](this));_0x5c4bdc[_0x7cd2('0x9')](_0x7cd2('0xc'),this[_0x7cd2('0x2c')][_0x7cd2('0x8')](this));_0x5c4bdc[_0x7cd2('0x9')](_0x7cd2('0xa'),this['handleFetchEnd'][_0x7cd2('0x8')](this));}catch(_0x430faa){logger[_0x7cd2('0xc')](_0x430faa);}}else{this[_0x7cd2('0x1')][_0x7cd2('0x2d')](!![],this['handleCloseBox'][_0x7cd2('0x8')](this));}}};EmailImap[_0x7cd2('0xf')][_0x7cd2('0x2b')]=function(_0x2b4e95){_0x2b4e95['on'](_0x7cd2('0x2e'),this['handleMessageBody'][_0x7cd2('0x8')](this));_0x2b4e95['once'](_0x7cd2('0x2f'),this[_0x7cd2('0x30')][_0x7cd2('0x8')](this));_0x2b4e95[_0x7cd2('0x9')](_0x7cd2('0xa'),this[_0x7cd2('0x31')][_0x7cd2('0x8')](this));};EmailImap[_0x7cd2('0xf')][_0x7cd2('0x32')]=function(_0xc4456a){simpleParser(_0xc4456a,{'Iconv':Iconv},this['handleSimpleParser'][_0x7cd2('0x8')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap[_0x7cd2('0xf')][_0x7cd2('0x31')]=function(){};EmailImap[_0x7cd2('0xf')][_0x7cd2('0x33')]=function(_0x3d4fdf,_0x53e58e){if(_0x3d4fdf){logger[_0x7cd2('0xc')](_0x3d4fdf);}else{var _0x2e40a3=this;utils[_0x7cd2('0x34')](this[_0x7cd2('0x5')],_0x53e58e,function(_0x3aedb0){_0x2e40a3['emit'](_0x7cd2('0x1a'),_0x3aedb0);});}};EmailImap[_0x7cd2('0xf')]['handleFetchEnd']=function(){this[_0x7cd2('0x1')]['closeBox'](!![],this[_0x7cd2('0x35')][_0x7cd2('0x8')](this));};EmailImap[_0x7cd2('0xf')]['handleFetchError']=function(_0xc8cfac){this[_0x7cd2('0xd')](_0xc8cfac);this[_0x7cd2('0x1')]['closeBox'](!![],this[_0x7cd2('0x35')][_0x7cd2('0x8')](this));};EmailImap[_0x7cd2('0xf')][_0x7cd2('0xb')]=function(){this[_0x7cd2('0x23')](_0x7cd2('0xa'));};EmailImap['prototype'][_0x7cd2('0xd')]=function(_0x4ff911,_0xd27d64){logger[_0x7cd2('0xc')](_0x7cd2('0xd'),this[_0x7cd2('0x5')]['email'],JSON[_0x7cd2('0x36')](_0x4ff911));var _0xe7aee1='';if(_0x4ff911){if(_0x4ff911[_0x7cd2('0x37')]){_0xe7aee1=_0x4ff911[_0x7cd2('0x37')];}else{for(var _0x2697a7 in _0x4ff911){if(_0x4ff911['hasOwnProperty'](_0x2697a7)){_0xe7aee1+=_[_0x7cd2('0x38')](_0x2697a7)+':\x20'+_0x4ff911[_0x2697a7]+'\x0a';}}}}if(_0xd27d64){this['imap']['end']();}else{this[_0x7cd2('0x23')](_0x7cd2('0xc'),_0xe7aee1);this[_0x7cd2('0x23')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0x8643=['closeBox','body','handleMessageBody','attributes','end','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','lodash','util','imap','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','mailbox','account','getAccount','once','ready','handleReady','bind','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','required','handleOpenBox','emit','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','handleFetchMessage','handleFetchError'];(function(_0x399aac,_0x162856){var _0x2b902e=function(_0x5a7115){while(--_0x5a7115){_0x399aac['push'](_0x399aac['shift']());}};_0x2b902e(++_0x162856);}(_0x8643,0x1bf));var _0x3864=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x8643[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x3864('0x0'));var util=require(_0x3864('0x1'));var Imap=require(_0x3864('0x2'));var simpleParser=require('mailparser')[_0x3864('0x3')];var Iconv=require(_0x3864('0x4'))[_0x3864('0x5')];var EventEmitter=require(_0x3864('0x6'))['EventEmitter'];var utils=require(_0x3864('0x7'));var logger=require(_0x3864('0x8'))('email');function EmailImap(_0x186851,_0x100038){this[_0x3864('0x9')]=_0x186851['mailbox'];this[_0x3864('0xa')]=this[_0x3864('0xb')](_0x186851,_0x100038);this[_0x3864('0x2')]=new Imap(this[_0x3864('0xa')]);this[_0x3864('0x2')][_0x3864('0xc')](_0x3864('0xd'),this[_0x3864('0xe')][_0x3864('0xf')](this));this[_0x3864('0x2')]['once']('end',this[_0x3864('0x10')][_0x3864('0xf')](this));this[_0x3864('0x2')]['on'](_0x3864('0x11'),this[_0x3864('0x12')][_0x3864('0xf')](this));this[_0x3864('0x2')]['connect']();}util[_0x3864('0x13')](EmailImap,EventEmitter);EmailImap[_0x3864('0x14')][_0x3864('0xb')]=function(_0x50d2fb,_0x537fe5){var _0x428d74={'connTimeout':_0x50d2fb[_0x3864('0x15')]?_0x50d2fb[_0x3864('0x15')]*0x3e8:0x2710,'authTimeout':_0x50d2fb[_0x3864('0x16')]?_0x50d2fb[_0x3864('0x16')]*0x3e8:0x1388};if(_0x50d2fb[_0x3864('0x17')]){_0x428d74['user']=_0x50d2fb[_0x3864('0x18')];if(_0x50d2fb[_0x3864('0x19')]){_0x428d74[_0x3864('0x1a')]=utils[_0x3864('0x1b')](_0x50d2fb[_0x3864('0x1c')][_0x3864('0x1d')],_0x50d2fb[_0x3864('0x18')]);}else{_0x428d74[_0x3864('0x1e')]=_0x50d2fb[_0x3864('0x1e')];}}else{if(_0x50d2fb[_0x3864('0x1f')]){_0x428d74['user']=_0x50d2fb[_0x3864('0x18')];_0x428d74[_0x3864('0x1e')]=_0x50d2fb[_0x3864('0x1e')];}}_0x428d74[_0x3864('0x20')]=_0x537fe5||_0x50d2fb[_0x3864('0x18')]||_0x3864('0x21');_0x428d74[_0x3864('0x22')]=_0x50d2fb[_0x3864('0x22')];_0x428d74[_0x3864('0x23')]=_0x50d2fb[_0x3864('0x23')]||0x3e1;if(_0x50d2fb[_0x3864('0x24')]){_0x428d74['tls']=!![];}else{_0x428d74['tls']=![];_0x428d74[_0x3864('0x25')]=_0x3864('0x26');}return _0x428d74;};EmailImap['prototype']['handleReady']=function(){this[_0x3864('0x2')]['openBox'](this['mailbox'],![],this[_0x3864('0x27')][_0x3864('0xf')](this));};EmailImap['prototype'][_0x3864('0x27')]=function(_0x169881,_0x4f70d3){if(_0x169881){this[_0x3864('0x12')](_0x169881,!![]);}else{this[_0x3864('0x28')](_0x3864('0x29'),_0x4f70d3);this[_0x3864('0x2a')]();}};EmailImap['prototype'][_0x3864('0x2b')]=function(_0x45ef57){if(_0x45ef57){this[_0x3864('0x12')](_0x45ef57,!![]);}else{this[_0x3864('0x2')]['end']();}};EmailImap['prototype'][_0x3864('0x2a')]=function(){this[_0x3864('0x2')]['search']([_0x3864('0x2c')],this[_0x3864('0x2d')][_0x3864('0xf')](this));};EmailImap[_0x3864('0x14')]['handleReadUnseen']=function(_0xc1f909,_0x27264e){if(_0xc1f909){this['handleError'](_0xc1f909,!![]);}else{if(_0x27264e[_0x3864('0x2e')]){try{var _0x4667b6=this['imap']['fetch'](_0x27264e,{'bodies':'','markSeen':!![]});_0x4667b6['on']('message',this[_0x3864('0x2f')]['bind'](this));_0x4667b6[_0x3864('0xc')](_0x3864('0x11'),this[_0x3864('0x30')][_0x3864('0xf')](this));_0x4667b6[_0x3864('0xc')]('end',this['handleFetchEnd'][_0x3864('0xf')](this));}catch(_0x134cc5){logger[_0x3864('0x11')](_0x134cc5);}}else{this['imap'][_0x3864('0x31')](!![],this[_0x3864('0x2b')][_0x3864('0xf')](this));}}};EmailImap[_0x3864('0x14')][_0x3864('0x2f')]=function(_0x11edba){_0x11edba['on'](_0x3864('0x32'),this[_0x3864('0x33')][_0x3864('0xf')](this));_0x11edba[_0x3864('0xc')](_0x3864('0x34'),this['handleMessageAttributes'][_0x3864('0xf')](this));_0x11edba[_0x3864('0xc')](_0x3864('0x35'),this[_0x3864('0x36')][_0x3864('0xf')](this));};EmailImap['prototype'][_0x3864('0x33')]=function(_0x46fa69){simpleParser(_0x46fa69,{'Iconv':Iconv},this[_0x3864('0x37')]['bind'](this));};EmailImap[_0x3864('0x14')][_0x3864('0x38')]=function(){};EmailImap['prototype'][_0x3864('0x36')]=function(){};EmailImap[_0x3864('0x14')]['handleSimpleParser']=function(_0x5ef020,_0x2ad279){if(_0x5ef020){logger['error'](_0x5ef020);}else{var _0x5490b2=this;utils[_0x3864('0x39')](this[_0x3864('0xa')],_0x2ad279,function(_0x4a16b3){_0x5490b2[_0x3864('0x28')](_0x3864('0x20'),_0x4a16b3);});}};EmailImap[_0x3864('0x14')][_0x3864('0x3a')]=function(){this[_0x3864('0x2')][_0x3864('0x31')](!![],this[_0x3864('0x2b')][_0x3864('0xf')](this));};EmailImap[_0x3864('0x14')][_0x3864('0x30')]=function(_0x5f3381){this['handleError'](_0x5f3381);this[_0x3864('0x2')][_0x3864('0x31')](!![],this[_0x3864('0x2b')]['bind'](this));};EmailImap[_0x3864('0x14')][_0x3864('0x10')]=function(){this[_0x3864('0x28')](_0x3864('0x35'));};EmailImap[_0x3864('0x14')][_0x3864('0x12')]=function(_0x57917c,_0x41f1db){logger['error'](_0x3864('0x12'),this['account'][_0x3864('0x20')],JSON[_0x3864('0x3b')](_0x57917c));var _0x28583a='';if(_0x57917c){if(_0x57917c[_0x3864('0x3c')]){_0x28583a=_0x57917c[_0x3864('0x3c')];}else{for(var _0x3447fd in _0x57917c){if(_0x57917c[_0x3864('0x3d')](_0x3447fd)){_0x28583a+=_['upperFirst'](_0x3447fd)+':\x20'+_0x57917c[_0x3447fd]+'\x0a';}}}}if(_0x41f1db){this[_0x3864('0x2')]['end']();}else{this[_0x3864('0x28')](_0x3864('0x11'),_0x28583a);this[_0x3864('0x28')]('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index fbdd10a..6f5042e 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 _0x7348=['nodemailer','nodemailer-plugin-inline-base64','prototype','compile','toString','createTransport','verify','Not\x20verifired','exports'];(function(_0x2a8396,_0x2a9470){var _0x2b1db3=function(_0x4f3ac5){while(--_0x4f3ac5){_0x2a8396['push'](_0x2a8396['shift']());}};_0x2b1db3(++_0x2a9470);}(_0x7348,0x195));var _0x8734=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7348[_0x2641f9];return _0x585741;};'use strict';var nodemailer=require(_0x8734('0x0'));var inlineBase64=require(_0x8734('0x1'));function EmailSmtp(){}EmailSmtp[_0x8734('0x2')]['send']=function(_0x57e297,_0x247414){return new Promise(function(_0x3cf21f,_0x2e9fd1){var _0x3b0b52=nodemailer['createTransport'](_0x57e297);_0x3b0b52['use'](_0x8734('0x3'),inlineBase64());_0x3b0b52['sendMail'](_0x247414,function(_0x5e3930,_0x27c1ae){if(_0x5e3930){_0x2e9fd1(_0x5e3930[_0x8734('0x4')]());}else{_0x3cf21f(_0x27c1ae);}});});};EmailSmtp[_0x8734('0x2')]['verify']=function(_0x25a63a){return new Promise(function(_0x577290,_0x2267e6){var _0x23ac75=nodemailer[_0x8734('0x5')](_0x25a63a);_0x23ac75[_0x8734('0x6')](function(_0x523dac,_0x25763e){if(_0x523dac){_0x2267e6(_0x523dac[_0x8734('0x4')]());}else{if(_0x25763e){_0x577290(_0x25763e);}else{_0x2267e6(_0x8734('0x7'));}}});});};module[_0x8734('0x8')]=EmailSmtp; \ No newline at end of file +var _0x953f=['use','compile','toString','verify','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x429e03,_0x271ddb){var _0x15748b=function(_0x185450){while(--_0x185450){_0x429e03['push'](_0x429e03['shift']());}};_0x15748b(++_0x271ddb);}(_0x953f,0x1eb));var _0xf953=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x953f[_0x5d6456];return _0x4d66c1;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xf953('0x0'));function EmailSmtp(){}EmailSmtp[_0xf953('0x1')][_0xf953('0x2')]=function(_0x3f4cce,_0xad7d8f){return new Promise(function(_0x4776d2,_0x7937c3){var _0x5580eb=nodemailer[_0xf953('0x3')](_0x3f4cce);_0x5580eb[_0xf953('0x4')](_0xf953('0x5'),inlineBase64());_0x5580eb['sendMail'](_0xad7d8f,function(_0x498384,_0x4884e2){if(_0x498384){_0x7937c3(_0x498384[_0xf953('0x6')]());}else{_0x4776d2(_0x4884e2);}});});};EmailSmtp['prototype'][_0xf953('0x7')]=function(_0x96a0a){return new Promise(function(_0x4aa957,_0x5af432){var _0x2b3870=nodemailer[_0xf953('0x3')](_0x96a0a);_0x2b3870[_0xf953('0x7')](function(_0x21fc68,_0x3ef7b2){if(_0x21fc68){_0x5af432(_0x21fc68['toString']());}else{if(_0x3ef7b2){_0x4aa957(_0x3ef7b2);}else{_0x5af432('Not\x20verifired');}}});});};module[_0xf953('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 833ed5e..7d88513 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 _0xec13=['\x20]','body','textAsHtml','message','originTo','email','originCc','bcc','attach','type','attachment','format','%s-%s','now','root','server/files/attachments/','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','parser','from','subject','date','filter','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','user=','utf-8','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','join','Anonymous','split','length','isEmpty','anonymous','html','replace','includes','\x20[Attachment:\x20'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0xec13,0x109));var _0x3ec1=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xec13[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x3ec1('0x0'));var moment=require(_0x3ec1('0x1'));var random=require(_0x3ec1('0x2'));var fs=require('fs');var path=require(_0x3ec1('0x3'));var util=require(_0x3ec1('0x4'));var tnef=require(_0x3ec1('0x5'));var logger=require(_0x3ec1('0x6'))('email');var config=require(_0x3ec1('0x7'));function getAddress(_0x39f072){var _0x46e62f=_[_0x3ec1('0x8')](_0x39f072[_0x3ec1('0x9')]);return _0x46e62f&&_0x46e62f[_0x3ec1('0xa')]?_0x46e62f[_0x3ec1('0xa')]:'anonymous'+random[_0x3ec1('0xb')](0x6)+_0x3ec1('0xc');}function getFirstName(_0xd69459){var _0x39cf0a=_[_0x3ec1('0x8')](_0xd69459[_0x3ec1('0x9')]);if(_0x39cf0a&&_0x39cf0a[_0x3ec1('0xd')]){if(_0x39cf0a[_0x3ec1('0xd')]==_0x39cf0a[_0x3ec1('0xa')]){return _0x39cf0a[_0x3ec1('0xd')][_0x3ec1('0xe')](0x0,_0x39cf0a[_0x3ec1('0xd')]['indexOf']('@'));}var _0x31b407=_0x39cf0a[_0x3ec1('0xd')]['split'](/\s+/);return _0x31b407['length']>0x1?_0x31b407['slice'](0x0,-0x1)[_0x3ec1('0xf')]('\x20'):_0x39cf0a['name'];}return _0x3ec1('0x10');}function getLastName(_0x433139){var _0x2eec76=_[_0x3ec1('0x8')](_0x433139[_0x3ec1('0x9')]);if(_0x2eec76&&_0x2eec76[_0x3ec1('0xd')]){var _0xfe40da=_0x2eec76[_0x3ec1('0xd')][_0x3ec1('0x11')](/\s+/);return _0xfe40da['length']>0x1?_0xfe40da['pop']():'';}return'';}function getMails(_0x2da518,_0x1a6fc5){var _0x358430='';for(var _0x6cd993=0x0;_0x6cd993<_0x1a6fc5['value'][_0x3ec1('0x12')];_0x6cd993+=0x1){if(_0x1a6fc5[_0x3ec1('0x9')][_0x6cd993][_0x3ec1('0xa')]!==_0x2da518){if(!_[_0x3ec1('0x13')](_0x358430)){_0x358430+=',';}_0x358430+=_0x1a6fc5[_0x3ec1('0x9')][_0x6cd993]['name']||_0x1a6fc5[_0x3ec1('0x9')][_0x6cd993][_0x3ec1('0xa')]||'';_0x358430+='\x20<';_0x358430+=_0x1a6fc5[_0x3ec1('0x9')][_0x6cd993]['address']?_0x1a6fc5[_0x3ec1('0x9')][_0x6cd993][_0x3ec1('0xa')]:_0x3ec1('0x14')+random[_0x3ec1('0xb')](0x6)+_0x3ec1('0xc');_0x358430+='>';}}return _0x358430;}function parseEmail(_0x3e7d2e,_0x561e2f,_0x39c6b3){if(_0x561e2f[_0x3ec1('0x15')]){var _0x1357de=/)<[^<]*)*<\/script>/gi;while(_0x1357de['test'](_0x561e2f[_0x3ec1('0x15')])){_0x561e2f['html']=_0x561e2f[_0x3ec1('0x15')][_0x3ec1('0x16')](_0x1357de,'');}if(_0x561e2f[_0x3ec1('0x15')][_0x3ec1('0x17')](_0x3ec1('0x18'))){var _0x29fcf7=[];_0x561e2f[_0x3ec1('0x19')]['forEach'](_0x3918ed=>{_0x29fcf7[_0x3ec1('0x1a')](_0x3918ed[_0x3ec1('0x1b')]);});var _0x4c772c=/]+>/g;var _0x52e544=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x663cc6=_0x561e2f['html'][_0x3ec1('0x16')](_0x52e544,_0x3ec1('0x1c'));var _0x373b93=_0x663cc6[_0x3ec1('0x16')](_0x4c772c,_0x3ec1('0x1d'));for(let _0x53a522=0x0;_0x53a522<_0x29fcf7[_0x3ec1('0x12')];_0x53a522++){var _0x3fe403=_0x373b93[_0x3ec1('0x16')](_0x3ec1('0x1d'),_0x3ec1('0x1e')+_0x29fcf7[_0x53a522]+_0x3ec1('0x1f'));_0x373b93=_0x3fe403;}_0x561e2f['html']=_0x373b93;}_0x39c6b3[_0x3ec1('0x20')]=_0x561e2f[_0x3ec1('0x15')];}else{_0x39c6b3['body']=_0x561e2f[_0x3ec1('0x21')];}if(_0x39c6b3[_0x3ec1('0x20')]){_0x39c6b3[_0x3ec1('0x20')]=_0x39c6b3[_0x3ec1('0x20')][_0x3ec1('0x16')](/0x0){var _0x271c96=[_0x3ec1('0x32'),_0x3ec1('0x33'),_0x3ec1('0x34')];for(var _0xd23d1e=0x0;_0xd23d1e<_0x561e2f['headerLines']['length'];_0xd23d1e++){var _0x3f63a8=_[_0x3ec1('0x35')](_0x271c96,_0x561e2f[_0x3ec1('0x31')][_0xd23d1e][_0x3ec1('0x36')]);if(_0x3f63a8>=0x0){_0x39c6b3[_0x3ec1('0x37')]=!![];}}}return _0x39c6b3;}exports[_0x3ec1('0x38')]=function(_0x33ef75,_0x13eb36,_0x5a2a7b){var _0x460e1a={'from':getAddress(_0x13eb36[_0x3ec1('0x39')]),'firstName':getFirstName(_0x13eb36[_0x3ec1('0x39')]),'lastName':getLastName(_0x13eb36[_0x3ec1('0x39')]),'mapKey':'email','message':{'from':getMails(_0x33ef75[_0x3ec1('0x24')],_0x13eb36[_0x3ec1('0x39')]),'to':_0x33ef75['email'],'cc':'','subject':_0x13eb36[_0x3ec1('0x3a')]||'','messageId':_0x13eb36['messageId'],'inReplyTo':_0x13eb36['inReplyTo'],'sentAt':moment(_0x13eb36[_0x3ec1('0x3b')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x13eb36[_0x3ec1('0x15')]&&!_0x13eb36[_0x3ec1('0x21')]){var _0x1280eb=_[_0x3ec1('0x3c')](_0x13eb36['attachments'],{'contentType':'application/ms-tnef'});if(_0x1280eb[_0x3ec1('0x12')]){logger['info'](util[_0x3ec1('0x2a')](_0x3ec1('0x3d'),_0x13eb36[_0x3ec1('0x3e')]));tnef[_0x3ec1('0x3f')](_[_0x3ec1('0x40')](_0x1280eb)[_0x3ec1('0x2f')],function(_0x5eb4c0,_0xc6e1b7){if(_0xc6e1b7){_0x13eb36['html']=_0xc6e1b7[_0x3ec1('0x41')]||'

Empty\x20message

';if(_0xc6e1b7[_0x3ec1('0x42')]){for(var _0x47ccf0=0x0;_0x47ccf0<_0xc6e1b7[_0x3ec1('0x42')][_0x3ec1('0x12')];_0x47ccf0++){var _0x5cf491=_0xc6e1b7[_0x3ec1('0x42')][_0x47ccf0];_0x460e1a[_0x3ec1('0x22')][_0x3ec1('0x19')]['push']({'filename':_0x5cf491[_0x3ec1('0x43')],'content':Buffer[_0x3ec1('0x39')](_0x5cf491[_0x3ec1('0x44')])});}}}_0x5a2a7b(parseEmail(_0x33ef75,_0x13eb36,_0x460e1a));});}else{_0x13eb36[_0x3ec1('0x15')]=_0x3ec1('0x45');_0x5a2a7b(parseEmail(_0x33ef75,_0x13eb36,_0x460e1a));}}else{_0x5a2a7b(parseEmail(_0x33ef75,_0x13eb36,_0x460e1a));}};exports[_0x3ec1('0x46')]=function(_0x4b1926,_0x2d8582){var _0x5582d2=[_0x3ec1('0x47')+(_0x2d8582||''),'auth=Bearer\x20'+_0x4b1926,'',''];return Buffer[_0x3ec1('0x39')](_0x5582d2[_0x3ec1('0xf')](''),_0x3ec1('0x48'))['toString'](_0x3ec1('0x49'));}; \ No newline at end of file +var _0x60da=['isEmpty','html','replace','includes','attachments','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','util','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','join','Anonymous','pop'];(function(_0x411aeb,_0x1480fe){var _0x46b706=function(_0x44c882){while(--_0x44c882){_0x411aeb['push'](_0x411aeb['shift']());}};_0x46b706(++_0x1480fe);}(_0x60da,0x1d1));var _0xa60d=function(_0x2981e5,_0x345788){_0x2981e5=_0x2981e5-0x0;var _0x76ffe4=_0x60da[_0x2981e5];return _0x76ffe4;};'use strict';var _=require(_0xa60d('0x0'));var moment=require(_0xa60d('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0xa60d('0x2'));var tnef=require('node-tnef');var logger=require('../../../config/logger')('email');var config=require(_0xa60d('0x3'));function getAddress(_0x2c795b){var _0x2708f8=_[_0xa60d('0x4')](_0x2c795b[_0xa60d('0x5')]);return _0x2708f8&&_0x2708f8['address']?_0x2708f8[_0xa60d('0x6')]:_0xa60d('0x7')+random[_0xa60d('0x8')](0x6)+_0xa60d('0x9');}function getFirstName(_0x25b672){var _0x585127=_[_0xa60d('0x4')](_0x25b672[_0xa60d('0x5')]);if(_0x585127&&_0x585127[_0xa60d('0xa')]){if(_0x585127[_0xa60d('0xa')]==_0x585127['address']){return _0x585127[_0xa60d('0xa')][_0xa60d('0xb')](0x0,_0x585127[_0xa60d('0xa')][_0xa60d('0xc')]('@'));}var _0x4b7750=_0x585127[_0xa60d('0xa')][_0xa60d('0xd')](/\s+/);return _0x4b7750[_0xa60d('0xe')]>0x1?_0x4b7750['slice'](0x0,-0x1)[_0xa60d('0xf')]('\x20'):_0x585127[_0xa60d('0xa')];}return _0xa60d('0x10');}function getLastName(_0x2ea061){var _0x29b9dd=_[_0xa60d('0x4')](_0x2ea061[_0xa60d('0x5')]);if(_0x29b9dd&&_0x29b9dd[_0xa60d('0xa')]){var _0x443090=_0x29b9dd[_0xa60d('0xa')][_0xa60d('0xd')](/\s+/);return _0x443090[_0xa60d('0xe')]>0x1?_0x443090[_0xa60d('0x11')]():'';}return'';}function getMails(_0x28e49e,_0xcf7f7c){var _0x19e0d5='';for(var _0x3d60a3=0x0;_0x3d60a3<_0xcf7f7c[_0xa60d('0x5')]['length'];_0x3d60a3+=0x1){if(_0xcf7f7c[_0xa60d('0x5')][_0x3d60a3][_0xa60d('0x6')]!==_0x28e49e){if(!_[_0xa60d('0x12')](_0x19e0d5)){_0x19e0d5+=',';}_0x19e0d5+=_0xcf7f7c[_0xa60d('0x5')][_0x3d60a3]['name']||_0xcf7f7c[_0xa60d('0x5')][_0x3d60a3][_0xa60d('0x6')]||'';_0x19e0d5+='\x20<';_0x19e0d5+=_0xcf7f7c['value'][_0x3d60a3]['address']?_0xcf7f7c[_0xa60d('0x5')][_0x3d60a3][_0xa60d('0x6')]:_0xa60d('0x7')+random[_0xa60d('0x8')](0x6)+_0xa60d('0x9');_0x19e0d5+='>';}}return _0x19e0d5;}function parseEmail(_0x4a79dc,_0x403186,_0x468f6b){if(_0x403186[_0xa60d('0x13')]){var _0x5d474e=/)<[^<]*)*<\/script>/gi;while(_0x5d474e['test'](_0x403186[_0xa60d('0x13')])){_0x403186[_0xa60d('0x13')]=_0x403186[_0xa60d('0x13')][_0xa60d('0x14')](_0x5d474e,'');}if(_0x403186[_0xa60d('0x13')][_0xa60d('0x15')]('{_0x4562bc[_0xa60d('0x17')](_0x4eb7eb[_0xa60d('0x18')]);});var _0x50a685=/]+>/g;var _0x5bb3ca=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x322faf=_0x403186[_0xa60d('0x13')]['replace'](_0x5bb3ca,_0xa60d('0x19'));var _0x5135e1=_0x322faf[_0xa60d('0x14')](_0x50a685,_0xa60d('0x1a'));for(let _0x294afc=0x0;_0x294afc<_0x4562bc[_0xa60d('0xe')];_0x294afc++){var _0x52feb7=_0x5135e1[_0xa60d('0x14')](_0xa60d('0x1a'),_0xa60d('0x1b')+_0x4562bc[_0x294afc]+_0xa60d('0x1c'));_0x5135e1=_0x52feb7;}_0x403186[_0xa60d('0x13')]=_0x5135e1;}_0x468f6b['body']=_0x403186[_0xa60d('0x13')];}else{_0x468f6b['body']=_0x403186[_0xa60d('0x1d')];}if(_0x468f6b['body']){_0x468f6b['body']=_0x468f6b['body']['replace'](/0x0){var _0x2d7364=[_0xa60d('0x2c'),_0xa60d('0x2d'),'Precedence:\x20auto_reply'];for(var _0x37ebcd=0x0;_0x37ebcd<_0x403186[_0xa60d('0x2b')][_0xa60d('0xe')];_0x37ebcd++){var _0x113c4c=_[_0xa60d('0xc')](_0x2d7364,_0x403186[_0xa60d('0x2b')][_0x37ebcd][_0xa60d('0x2e')]);if(_0x113c4c>=0x0){_0x468f6b[_0xa60d('0x2f')]=!![];}}}return _0x468f6b;}exports['parser']=function(_0x5dd8b6,_0x3dc0e5,_0x26b9de){var _0x1a18f3={'from':getAddress(_0x3dc0e5[_0xa60d('0x30')]),'firstName':getFirstName(_0x3dc0e5[_0xa60d('0x30')]),'lastName':getLastName(_0x3dc0e5[_0xa60d('0x30')]),'mapKey':'email','message':{'from':getMails(_0x5dd8b6[_0xa60d('0x21')],_0x3dc0e5[_0xa60d('0x30')]),'to':_0x5dd8b6['email'],'cc':'','subject':_0x3dc0e5[_0xa60d('0x31')]||'','messageId':_0x3dc0e5[_0xa60d('0x32')],'inReplyTo':_0x3dc0e5['inReplyTo'],'sentAt':moment(_0x3dc0e5[_0xa60d('0x33')])['format'](_0xa60d('0x34')),'attach':![],'attachments':[]}};if(!_0x3dc0e5['html']&&!_0x3dc0e5['textAsHtml']){var _0x1a021b=_[_0xa60d('0x35')](_0x3dc0e5[_0xa60d('0x16')],{'contentType':_0xa60d('0x36')});if(_0x1a021b[_0xa60d('0xe')]){logger[_0xa60d('0x37')](util[_0xa60d('0x28')](_0xa60d('0x38'),_0x3dc0e5[_0xa60d('0x32')]));tnef[_0xa60d('0x39')](_['first'](_0x1a021b)['content'],function(_0x3b1172,_0x37fdb9){if(_0x37fdb9){_0x3dc0e5[_0xa60d('0x13')]=_0x37fdb9[_0xa60d('0x3a')]||_0xa60d('0x3b');if(_0x37fdb9[_0xa60d('0x3c')]){for(var _0xea4ff1=0x0;_0xea4ff1<_0x37fdb9[_0xa60d('0x3c')][_0xa60d('0xe')];_0xea4ff1++){var _0x24082d=_0x37fdb9[_0xa60d('0x3c')][_0xea4ff1];_0x1a18f3['message'][_0xa60d('0x16')][_0xa60d('0x17')]({'filename':_0x24082d[_0xa60d('0x3d')],'content':Buffer[_0xa60d('0x30')](_0x24082d[_0xa60d('0x3e')])});}}}_0x26b9de(parseEmail(_0x5dd8b6,_0x3dc0e5,_0x1a18f3));});}else{_0x3dc0e5[_0xa60d('0x13')]=_0xa60d('0x3b');_0x26b9de(parseEmail(_0x5dd8b6,_0x3dc0e5,_0x1a18f3));}}else{_0x26b9de(parseEmail(_0x5dd8b6,_0x3dc0e5,_0x1a18f3));}};exports[_0xa60d('0x3f')]=function(_0x3d9d30,_0x44c547){var _0x5e9e8f=[_0xa60d('0x40')+(_0x44c547||''),_0xa60d('0x41')+_0x3d9d30,'',''];return Buffer['from'](_0x5e9e8f[_0xa60d('0xf')](''),_0xa60d('0x42'))[_0xa60d('0x43')](_0xa60d('0x44'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index c820722..d634de4 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 _0xc7ea=['exports','name','Service','key','SERV','active','Imap'];(function(_0x307e23,_0x81517b){var _0x3f13b9=function(_0x367e){while(--_0x367e){_0x307e23['push'](_0x307e23['shift']());}};_0x3f13b9(++_0x81517b);}(_0xc7ea,0x13c));var _0xac7e=function(_0x2e3084,_0x170398){_0x2e3084=_0x2e3084-0x0;var _0x233549=_0xc7ea[_0x2e3084];return _0x233549;};'use strict';var _=require('lodash');function MailAccount(_0x106213){this['id']=_0x106213['id']||0x0;this[_0xac7e('0x0')]=_0x106213['name']||_0xac7e('0x1');this[_0xac7e('0x2')]=_0x106213[_0xac7e('0x2')]||_0xac7e('0x3');this['active']=_0x106213[_0xac7e('0x4')]||![];this[_0xac7e('0x5')]=_0x106213['Imap']||[];this['Smtp']=_0x106213['Smtp']||[];}module[_0xac7e('0x6')]=MailAccount; \ No newline at end of file +var _0xcb94=['lodash','name','Service','key','active','Imap','Smtp','exports'];(function(_0x521e8d,_0x23a290){var _0x518bbd=function(_0x4241eb){while(--_0x4241eb){_0x521e8d['push'](_0x521e8d['shift']());}};_0x518bbd(++_0x23a290);}(_0xcb94,0x1f0));var _0x4cb9=function(_0x8cc6d,_0x38740d){_0x8cc6d=_0x8cc6d-0x0;var _0x469ce6=_0xcb94[_0x8cc6d];return _0x469ce6;};'use strict';var _=require(_0x4cb9('0x0'));function MailAccount(_0x518012){this['id']=_0x518012['id']||0x0;this['name']=_0x518012[_0x4cb9('0x1')]||_0x4cb9('0x2');this['key']=_0x518012[_0x4cb9('0x3')]||'SERV';this[_0x4cb9('0x4')]=_0x518012[_0x4cb9('0x4')]||![];this[_0x4cb9('0x5')]=_0x518012[_0x4cb9('0x5')]||[];this[_0x4cb9('0x6')]=_0x518012[_0x4cb9('0x6')]||[];}module[_0x4cb9('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 010083a..935cd93 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 _0x6bc5=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','mailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bc5,0x11c));var _0x56bc=function(_0x5cfac5,_0x3ea499){_0x5cfac5=_0x5cfac5-0x0;var _0x4c4b2d=_0x6bc5[_0x5cfac5];return _0x4c4b2d;};'use strict';var _=require(_0x56bc('0x0'));var MailAccount=require(_0x56bc('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x4eac99,_0x5244a8,_0x4a1bac){var _0x44eec0=_[_0x56bc('0x2')](_0x4eac99,function(_0x20a3ed,_0x5e42c9){return _0x20a3ed[_0x4a1bac];});for(var _0x4a8d4e in _0x5244a8){if(_0x5244a8[_0x56bc('0x3')](_0x4a8d4e)){if(!_0x44eec0[_0x4a8d4e]){delete _0x5244a8[_0x4a8d4e];}}}}Realtime[_0x56bc('0x4')][_0x56bc('0x5')]=function(_0x23ad75,_0x32c791){for(var _0x52d960 in _0x32c791){if(_0x23ad75[_0x56bc('0x3')](_0x52d960)){_0x23ad75[_0x52d960]=_0x32c791[_0x52d960];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x4938ad=this;return function(_0x2ac061){if(_0x2ac061){freeIsNotKey(_0x2ac061,_0x4938ad[_0x56bc('0x6')],'id');for(var _0x41c6fa=0x0,_0x50981c={},_0x2021a8={};_0x41c6fa<_0x2ac061[_0x56bc('0x7')];_0x41c6fa+=0x1){_0x50981c=_0x2ac061[_0x41c6fa];if(_[_0x56bc('0x8')](_0x4938ad['mailAccounts'][_0x50981c['id']])){_0x4938ad['mailAccounts'][_0x50981c['id']]=new MailAccount(_0x50981c);}else{_[_0x56bc('0x9')](_0x4938ad[_0x56bc('0x6')][_0x50981c['id']],_0x50981c);}}}return _0x4938ad[_0x56bc('0x6')];};};module[_0x56bc('0xa')]=Realtime; \ No newline at end of file +var _0x8f9f=['../model/mailAccount','mailAccounts','hasOwnProperty','prototype','length','isUndefined','merge'];(function(_0xc7eb83,_0x6abf90){var _0x4b5d9f=function(_0x65744a){while(--_0x65744a){_0xc7eb83['push'](_0xc7eb83['shift']());}};_0x4b5d9f(++_0x6abf90);}(_0x8f9f,0x16c));var _0xf8f9=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x8f9f[_0x2283dc];return _0x16db90;};'use strict';var _=require('lodash');var MailAccount=require(_0xf8f9('0x0'));var Realtime=function(){this[_0xf8f9('0x1')]={};};function freeIsNotKey(_0x1f3e86,_0xe111,_0x285da7){var _0x5ae4fd=_['mapKeys'](_0x1f3e86,function(_0x28f8f7,_0x5815f9){return _0x28f8f7[_0x285da7];});for(var _0x469e80 in _0xe111){if(_0xe111[_0xf8f9('0x2')](_0x469e80)){if(!_0x5ae4fd[_0x469e80]){delete _0xe111[_0x469e80];}}}}Realtime[_0xf8f9('0x3')]['mergeFromDatabase']=function(_0xaa58fe,_0x1aa60e){for(var _0x5a1d04 in _0x1aa60e){if(_0xaa58fe['hasOwnProperty'](_0x5a1d04)){_0xaa58fe[_0x5a1d04]=_0x1aa60e[_0x5a1d04];}}};Realtime[_0xf8f9('0x3')]['initMailAccounts']=function(){var _0x2fe7c2=this;return function(_0x577e59){if(_0x577e59){freeIsNotKey(_0x577e59,_0x2fe7c2[_0xf8f9('0x1')],'id');for(var _0x48caf4=0x0,_0x1f86a2={},_0x441158={};_0x48caf4<_0x577e59[_0xf8f9('0x4')];_0x48caf4+=0x1){_0x1f86a2=_0x577e59[_0x48caf4];if(_[_0xf8f9('0x5')](_0x2fe7c2[_0xf8f9('0x1')][_0x1f86a2['id']])){_0x2fe7c2[_0xf8f9('0x1')][_0x1f86a2['id']]=new MailAccount(_0x1f86a2);}else{_[_0xf8f9('0x6')](_0x2fe7c2[_0xf8f9('0x1')][_0x1f86a2['id']],_0x1f86a2);}}}return _0x2fe7c2['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 1a72252..f10390d 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 _0xadbb=['Imap','CloudProvider','data5','MailServerOut','type','Request','NotifyMailAccount','../client','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn'];(function(_0x458f8f,_0x405864){var _0x133e2a=function(_0xbae5c3){while(--_0xbae5c3){_0x458f8f['push'](_0x458f8f['shift']());}};_0x133e2a(++_0x405864);}(_0xadbb,0x97));var _0xbadb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xadbb[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xbadb('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0xbadb('0x1'),{'options':{'attributes':['id',_0xbadb('0x2'),_0xbadb('0x3'),_0xbadb('0x4'),_0xbadb('0x5'),_0xbadb('0x6'),_0xbadb('0x7'),_0xbadb('0x8'),_0xbadb('0x9')],'raw':![],'include':[{'model':_0xbadb('0xa'),'as':_0xbadb('0xb'),'include':[{'model':_0xbadb('0xc'),'attributes':['id',_0xbadb('0x2'),_0xbadb('0x4'),'type',_0xbadb('0xd')],'as':_0xbadb('0xc')}]},{'model':_0xbadb('0xe'),'as':'Smtp','include':[{'model':_0xbadb('0xc'),'attributes':['id',_0xbadb('0x2'),_0xbadb('0x4'),_0xbadb('0xf'),_0xbadb('0xd')],'as':_0xbadb('0xc')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x46adf9,_0x20cc60){return client[_0xbadb('0x10')](_0xbadb('0x11'),{'account':{'id':_0x46adf9},'body':_0x20cc60,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x5d17=['getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','name','provider','service','active','key','ListId','TemplateId','Imap','CloudProvider','type','data5'];(function(_0x38556f,_0x263a7e){var _0x46812a=function(_0x2e2ad9){while(--_0x2e2ad9){_0x38556f['push'](_0x38556f['shift']());}};_0x46812a(++_0x263a7e);}(_0x5d17,0x114));var _0x75d1=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0x5d17[_0x3ebb69];return _0x421e59;};'use strict';var client=require(_0x75d1('0x0'));exports[_0x75d1('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x75d1('0x2'),_0x75d1('0x3'),_0x75d1('0x4'),'email',_0x75d1('0x5'),_0x75d1('0x6'),_0x75d1('0x7'),_0x75d1('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x75d1('0x9'),'include':[{'model':_0x75d1('0xa'),'attributes':['id',_0x75d1('0x2'),_0x75d1('0x4'),_0x75d1('0xb'),_0x75d1('0xc')],'as':_0x75d1('0xa')}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x75d1('0xa'),'attributes':['id','name','service',_0x75d1('0xb'),_0x75d1('0xc')],'as':'CloudProvider'}]}]},'log':_0x75d1('0xd')});};};exports[_0x75d1('0xe')]=function(_0x28b9b4,_0xe07f4a){return client[_0x75d1('0xf')](_0x75d1('0x10'),{'account':{'id':_0x28b9b4},'body':_0xe07f4a,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 5fa2f5f..ae0f72a 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 _0x8712=['loginMailFrequency','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x2db328,_0xf8e678){var _0x15b8b5=function(_0x1e0447){while(--_0x1e0447){_0x2db328['push'](_0x2db328['shift']());}};_0x15b8b5(++_0xf8e678);}(_0x8712,0x19a));var _0x2871=function(_0x550937,_0x20e57d){_0x550937=_0x550937-0x0;var _0x3b33b7=_0x8712[_0x550937];return _0x3b33b7;};'use strict';var client=require(_0x2871('0x0'));exports[_0x2871('0x1')]=function(){return client[_0x2871('0x2')](_0x2871('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2871('0x4')]},'log':_0x2871('0x5')});}; \ No newline at end of file +var _0xdb9b=['getSettings','Request','ShowSetting','loginMailFrequency','../client'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xdb9b,0xf9));var _0xbdb9=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xdb9b[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0xbdb9('0x0'));exports[_0xbdb9('0x1')]=function(){return client[_0xbdb9('0x2')](_0xbdb9('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbdb9('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 9faaf30..3162b50 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 665b66d..6bc805e 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 _0xdfbc=['port','lodash','http','express','sticky-session','ioredis','../../config/environment','timeout','socket.io','websocket','defaults','redis','localhost','socket.io-redis','../../config/triggers','default','../../config/express','log'];(function(_0x5341ff,_0x1de6df){var _0x53be58=function(_0x4da0da){while(--_0x4da0da){_0x5341ff['push'](_0x5341ff['shift']());}};_0x53be58(++_0x1de6df);}(_0xdfbc,0x145));var _0xcdfb=function(_0x2b8ca3,_0x1bae1f){_0x2b8ca3=_0x2b8ca3-0x0;var _0x3a4027=_0xdfbc[_0x2b8ca3];return _0x3a4027;};'use strict';var _=require(_0xcdfb('0x0'));var http=require(_0xcdfb('0x1'));var express=require(_0xcdfb('0x2'));var sticky=require(_0xcdfb('0x3'));var Redis=require(_0xcdfb('0x4'));var config=require(_0xcdfb('0x5'));var app=express();var server=http['createServer'](app);server[_0xcdfb('0x6')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0xcdfb('0x7'))(server,{'transports':[_0xcdfb('0x8'),'polling']});config['redis']=_[_0xcdfb('0x9')](config[_0xcdfb('0xa')],{'host':_0xcdfb('0xb'),'port':0x18eb});socketio['adapter'](require(_0xcdfb('0xc'))({'pubClient':new Redis(config[_0xcdfb('0xa')]),'subClient':new Redis(config[_0xcdfb('0xa')])}));require(_0xcdfb('0xd'))[_0xcdfb('0xe')]();require('../../config/socketio')[_0xcdfb('0xe')](socketio);require(_0xcdfb('0xf'))['default'](app);require('../../routes')[_0xcdfb('0xe')](app);}else{server['once']('listening',function(){console[_0xcdfb('0x10')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xcdfb('0x11')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xb0dd=['../../config/triggers','default','../../config/express','../../routes','once','listening','log','exports','lodash','http','express','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','localhost','socket.io-redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb0dd,0xc0));var _0xdb0d=function(_0x1d0d46,_0x75b300){_0x1d0d46=_0x1d0d46-0x0;var _0x5b454a=_0xb0dd[_0x1d0d46];return _0x5b454a;};'use strict';var _=require(_0xdb0d('0x0'));var http=require(_0xdb0d('0x1'));var express=require(_0xdb0d('0x2'));var sticky=require(_0xdb0d('0x3'));var Redis=require('ioredis');var config=require(_0xdb0d('0x4'));var app=express();var server=http[_0xdb0d('0x5')](app);server[_0xdb0d('0x6')]=0xdbba0;if(sticky[_0xdb0d('0x7')](server,config[_0xdb0d('0x8')])){var socketio=require(_0xdb0d('0x9'))(server,{'transports':[_0xdb0d('0xa'),_0xdb0d('0xb')]});config[_0xdb0d('0xc')]=_['defaults'](config[_0xdb0d('0xc')],{'host':_0xdb0d('0xd'),'port':0x18eb});socketio['adapter'](require(_0xdb0d('0xe'))({'pubClient':new Redis(config[_0xdb0d('0xc')]),'subClient':new Redis(config[_0xdb0d('0xc')])}));require(_0xdb0d('0xf'))[_0xdb0d('0x10')]();require('../../config/socketio')[_0xdb0d('0x10')](socketio);require(_0xdb0d('0x11'))[_0xdb0d('0x10')](app);require(_0xdb0d('0x12'))[_0xdb0d('0x10')](app);}else{server[_0xdb0d('0x13')](_0xdb0d('0x14'),function(){console[_0xdb0d('0x15')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xdb0d('0x8')]);});}exports=module[_0xdb0d('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 019be5c..0a33de8 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 _0x4d4e=['debug','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','request','then'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x4d4e,0x156));var _0xe4d4=function(_0x52bd10,_0x192e9f){_0x52bd10=_0x52bd10-0x0;var _0x457cf2=_0x4d4e[_0x52bd10];return _0x457cf2;};'use strict';var jayson=require(_0xe4d4('0x0'));var BPromise=require(_0xe4d4('0x1'));var logger=require(_0xe4d4('0x2'))(_0xe4d4('0x3'));var client=jayson[_0xe4d4('0x4')][_0xe4d4('0x5')]({'port':0x2329});client['Request']=function(_0x543f10,_0x21d426){return new BPromise(function(_0x3d9f72,_0x57bc2c){return client[_0xe4d4('0x6')](_0x543f10,_0x21d426)[_0xe4d4('0x7')](function(_0x3cfb49){logger[_0xe4d4('0x8')](_0xe4d4('0x9'),_0xe4d4('0x3'),_0x543f10,_0x21d426,_0x3cfb49);if(_0x3cfb49['error']){logger[_0xe4d4('0xa')](_0xe4d4('0x9'),_0xe4d4('0x3'),_0x543f10,_0x3cfb49[_0xe4d4('0xa')][_0xe4d4('0xb')],_0x21d426);return _0x57bc2c(_0x3cfb49[_0xe4d4('0xa')][_0xe4d4('0xb')]);}else{return _0x3d9f72(_0x3cfb49[_0xe4d4('0xc')]);}})[_0xe4d4('0xd')](function(_0x4d3563){logger[_0xe4d4('0xa')](_0xe4d4('0x9'),_0xe4d4('0x3'),_0x543f10,_0x4d3563,_0x21d426);return _0x57bc2c(_0x4d3563);});});};module['exports']=client; \ No newline at end of file +var _0xcef9=['Request','request','then','debug','rpc','routing','error','message','result','catch','client'];(function(_0x5c1ee8,_0x32323f){var _0x5c2a1b=function(_0x1bb845){while(--_0x1bb845){_0x5c1ee8['push'](_0x5c1ee8['shift']());}};_0x5c2a1b(++_0x32323f);}(_0xcef9,0x112));var _0x9cef=function(_0x141f15,_0x9ce9bc){_0x141f15=_0x141f15-0x0;var _0x47d612=_0xcef9[_0x141f15];return _0x47d612;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0x9cef('0x0')]['http']({'port':0x2329});client[_0x9cef('0x1')]=function(_0x53b7e8,_0x574712){return new BPromise(function(_0x1198ad,_0x981fe2){return client[_0x9cef('0x2')](_0x53b7e8,_0x574712)[_0x9cef('0x3')](function(_0x397f79){logger[_0x9cef('0x4')](_0x9cef('0x5'),_0x9cef('0x6'),_0x53b7e8,_0x574712,_0x397f79);if(_0x397f79[_0x9cef('0x7')]){logger['error'](_0x9cef('0x5'),_0x9cef('0x6'),_0x53b7e8,_0x397f79[_0x9cef('0x7')]['message'],_0x574712);return _0x981fe2(_0x397f79['error'][_0x9cef('0x8')]);}else{return _0x1198ad(_0x397f79[_0x9cef('0x9')]);}})[_0x9cef('0xa')](function(_0x44d3bd){logger[_0x9cef('0x7')](_0x9cef('0x5'),_0x9cef('0x6'),_0x53b7e8,_0x44d3bd,_0x574712);return _0x981fe2(_0x44d3bd);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 7b8c1e7..9304a64 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 _0x1ddc=['getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues'];(function(_0x40aaa4,_0x3b22f4){var _0x4e21e5=function(_0x35d2f3){while(--_0x35d2f3){_0x40aaa4['push'](_0x40aaa4['shift']());}};_0x4e21e5(++_0x3b22f4);}(_0x1ddc,0x110));var _0xc1dd=function(_0x3d7bf8,_0x4f1f4f){_0x3d7bf8=_0x3d7bf8-0x0;var _0x512d3d=_0x1ddc[_0x3d7bf8];return _0x512d3d;};'use strict';var BPromise=require(_0xc1dd('0x0'));var server=require('./server');var Realtime=require(_0xc1dd('0x1'));var user=require(_0xc1dd('0x2'));var interval=require(_0xc1dd('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xc1dd('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xc1dd('0x5'));var whatsappQueue=require(_0xc1dd('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xc1dd('0x7')]()[_0xc1dd('0x8')](user['getAgents']())[_0xc1dd('0x8')](realtime['initAgents']())[_0xc1dd('0x8')](interval[_0xc1dd('0x9')]())['then'](realtime[_0xc1dd('0xa')]())[_0xc1dd('0x8')](openchannelQueue[_0xc1dd('0xb')]())[_0xc1dd('0x8')](realtime['initOpenchannelQueues']())[_0xc1dd('0x8')](chatQueue[_0xc1dd('0xc')]())[_0xc1dd('0x8')](realtime[_0xc1dd('0xd')]())[_0xc1dd('0x8')](smsQueue[_0xc1dd('0xe')]())[_0xc1dd('0x8')](realtime[_0xc1dd('0xf')]())[_0xc1dd('0x8')](mailQueue[_0xc1dd('0x10')]())[_0xc1dd('0x8')](realtime['initMailQueues']())[_0xc1dd('0x8')](faxQueue[_0xc1dd('0x11')]())[_0xc1dd('0x8')](realtime[_0xc1dd('0x12')]())[_0xc1dd('0x8')](whatsappQueue[_0xc1dd('0x13')]())[_0xc1dd('0x8')](realtime[_0xc1dd('0x14')]())[_0xc1dd('0x8')](function(){return realtime;});}function main(){return server[_0xc1dd('0x15')](realtime)[_0xc1dd('0x8')](function(_0x49db5b){return initRealtime();})['then'](function(_0x2a81c9){return setInterval(initRealtime,0x1388);})[_0xc1dd('0x16')](function(_0x42dd00){console[_0xc1dd('0x17')](_0x42dd00);});}main(); \ No newline at end of file +var _0xc583=['./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue'];(function(_0x4e89e6,_0x8b956f){var _0x4d2484=function(_0x4bccba){while(--_0x4bccba){_0x4e89e6['push'](_0x4e89e6['shift']());}};_0x4d2484(++_0x8b956f);}(_0xc583,0x1e9));var _0x3c58=function(_0x578a5d,_0x36281a){_0x578a5d=_0x578a5d-0x0;var _0x74fba9=_0xc583[_0x578a5d];return _0x74fba9;};'use strict';var BPromise=require('bluebird');var server=require(_0x3c58('0x0'));var Realtime=require(_0x3c58('0x1'));var user=require(_0x3c58('0x2'));var interval=require(_0x3c58('0x3'));var openchannelQueue=require(_0x3c58('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x3c58('0x5'));var mailQueue=require(_0x3c58('0x6'));var faxQueue=require(_0x3c58('0x7'));var whatsappQueue=require(_0x3c58('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x3c58('0x9')]()[_0x3c58('0xa')](user[_0x3c58('0xb')]())[_0x3c58('0xa')](realtime[_0x3c58('0xc')]())[_0x3c58('0xa')](interval[_0x3c58('0xd')]())['then'](realtime[_0x3c58('0xe')]())[_0x3c58('0xa')](openchannelQueue[_0x3c58('0xf')]())[_0x3c58('0xa')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x3c58('0x10')]())[_0x3c58('0xa')](realtime[_0x3c58('0x11')]())[_0x3c58('0xa')](smsQueue[_0x3c58('0x12')]())[_0x3c58('0xa')](realtime['initSmsQueues']())[_0x3c58('0xa')](mailQueue['getMailQueues']())['then'](realtime[_0x3c58('0x13')]())[_0x3c58('0xa')](faxQueue[_0x3c58('0x14')]())[_0x3c58('0xa')](realtime[_0x3c58('0x15')]())[_0x3c58('0xa')](whatsappQueue[_0x3c58('0x16')]())['then'](realtime[_0x3c58('0x17')]())[_0x3c58('0xa')](function(){return realtime;});}function main(){return server[_0x3c58('0x18')](realtime)[_0x3c58('0xa')](function(_0x3ad619){return initRealtime();})['then'](function(_0x458af2){return setInterval(initRealtime,0x1388);})['catch'](function(_0x58239f){console[_0x3c58('0x19')](_0x58239f);});}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 149e580..9f522e8 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 _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x488c71,_0x30c149){var _0x3a13ae=function(_0x423146){while(--_0x423146){_0x488c71['push'](_0x488c71['shift']());}};_0x3a13ae(++_0x30c149);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0x5fc3[_0x1057a3];return _0x131cdb;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x46d68b,_0x154971){var _0x3a7893=function(_0x17e56a){while(--_0x17e56a){_0x46d68b['push'](_0x46d68b['shift']());}};_0x3a7893(++_0x154971);}(_0x326f,0xd1));var _0xf326=function(_0x3ab952,_0x2a88fe){_0x3ab952=_0x3ab952-0x0;var _0xef174c=_0x326f[_0x3ab952];return _0xef174c;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index b1e0418..0b21f05 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 _0xeaaf=['result','catch','SendMail','bluebird','client','http','then','error','message'];(function(_0x4a9ad7,_0x51f4cd){var _0x10f7cc=function(_0x1259f9){while(--_0x1259f9){_0x4a9ad7['push'](_0x4a9ad7['shift']());}};_0x10f7cc(++_0x51f4cd);}(_0xeaaf,0x1ce));var _0xfeaa=function(_0x3e4f9e,_0x1c573b){_0x3e4f9e=_0x3e4f9e-0x0;var _0x188769=_0xeaaf[_0x3e4f9e];return _0x188769;};'use strict';var BPromise=require(_0xfeaa('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xfeaa('0x1')][_0xfeaa('0x2')]({'port':0x232b});function request(_0x59090e,_0x27c353){return new BPromise(function(_0x5c1619,_0x318fc8){return client['request'](_0x59090e,_0x27c353)[_0xfeaa('0x3')](function(_0x59379d){if(_0x59379d[_0xfeaa('0x4')]){return _0x318fc8(_0x59379d[_0xfeaa('0x4')][_0xfeaa('0x5')]);}else{return _0x5c1619(_0x59379d[_0xfeaa('0x6')]);}})[_0xfeaa('0x7')](function(_0x46e81b){return _0x318fc8(_0x46e81b);});});}exports['sendMailMessage']=function(_0x32deca,_0x1fce12){return request(_0xfeaa('0x8'),{'account':_0x32deca,'message':_0x1fce12});}; \ No newline at end of file +var _0xaecd=['error','message','result','catch','sendMailMessage','jayson/promise','client','http'];(function(_0x560042,_0x4d21ab){var _0x48f48e=function(_0x3f2e00){while(--_0x3f2e00){_0x560042['push'](_0x560042['shift']());}};_0x48f48e(++_0x4d21ab);}(_0xaecd,0xe5));var _0xdaec=function(_0x29e5b4,_0x33a290){_0x29e5b4=_0x29e5b4-0x0;var _0x58f332=_0xaecd[_0x29e5b4];return _0x58f332;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xdaec('0x0'));var client=jayson[_0xdaec('0x1')][_0xdaec('0x2')]({'port':0x232b});function request(_0x4cb440,_0x444602){return new BPromise(function(_0x4be15a,_0x30b2bd){return client['request'](_0x4cb440,_0x444602)['then'](function(_0x5177c5){if(_0x5177c5[_0xdaec('0x3')]){return _0x30b2bd(_0x5177c5[_0xdaec('0x3')][_0xdaec('0x4')]);}else{return _0x4be15a(_0x5177c5[_0xdaec('0x5')]);}})[_0xdaec('0x6')](function(_0x563e69){return _0x30b2bd(_0x563e69);});});}exports[_0xdaec('0x7')]=function(_0x4ea25e,_0x489592){return request('SendMail',{'account':_0x4ea25e,'message':_0x489592});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 5881b8e..89089e2 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 _0x3ed5=['redis','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','CurrentCapacity','maxcapacity','working','idle','mail','chat','fax','sms','whatsapp','length','StatusTime','toNumber','Status','chatStatusTime','mailStatus','whatsappStatus','openchannelStatusTime','user:routing:update','omit','exports','md5','ioredis','defaults'];(function(_0x549a38,_0x37e9f8){var _0x44c912=function(_0x1acf2b){while(--_0x1acf2b){_0x549a38['push'](_0x549a38['shift']());}};_0x44c912(++_0x37e9f8);}(_0x3ed5,0x1ed));var _0x53ed=function(_0x118c10,_0x400a43){_0x118c10=_0x118c10-0x0;var _0x57e31b=_0x3ed5[_0x118c10];return _0x57e31b;};'use strict';var _=require('lodash');var md5=require(_0x53ed('0x0'));var moment=require('moment');var Redis=require(_0x53ed('0x1'));var config=require('../../../config/environment');config['redis']=_[_0x53ed('0x2')](config[_0x53ed('0x3')],{'host':_0x53ed('0x4'),'port':0x18eb});var io=require(_0x53ed('0x5'))(new Redis(config[_0x53ed('0x3')]));function Agent(_0x3e1897){this['id']=_0x3e1897['id']||0x0;this[_0x53ed('0x6')]=_0x3e1897[_0x53ed('0x6')]||'';this[_0x53ed('0x7')]=_0x3e1897[_0x53ed('0x7')]||![];this[_0x53ed('0x8')]=_0x3e1897['chatPause']||![];this['mailPause']=_0x3e1897[_0x53ed('0x9')]||![];this[_0x53ed('0xa')]=_0x3e1897['faxPause']||![];this['smsPause']=_0x3e1897[_0x53ed('0xb')]||![];this[_0x53ed('0xc')]=_0x3e1897['openchannelPause']||![];this['chatStatus']=_0x53ed('0xd');this['chatStatusTime']=0x0;this[_0x53ed('0xe')]=_0x3e1897['chatCapacity']||0x0;this[_0x53ed('0xf')]=0x0;this['mailStatus']='unknown';this[_0x53ed('0x10')]=0x0;this[_0x53ed('0x11')]=_0x3e1897[_0x53ed('0x11')]||0x0;this[_0x53ed('0x12')]=0x0;this[_0x53ed('0x13')]=_0x53ed('0xd');this[_0x53ed('0x14')]=0x0;this[_0x53ed('0x15')]=_0x3e1897[_0x53ed('0x15')]||0x0;this[_0x53ed('0x16')]=0x0;this[_0x53ed('0x17')]=_0x53ed('0xd');this[_0x53ed('0x18')]=0x0;this['smsCapacity']=_0x3e1897[_0x53ed('0x19')]||0x0;this[_0x53ed('0x1a')]=0x0;this['whatsappStatus']=_0x53ed('0xd');this[_0x53ed('0x1b')]=0x0;this[_0x53ed('0x1c')]=_0x3e1897[_0x53ed('0x1c')]||0x0;this[_0x53ed('0x1d')]=0x0;this[_0x53ed('0x1e')]='unknown';this['openchannelStatusTime']=0x0;this[_0x53ed('0x1f')]=_0x3e1897[_0x53ed('0x1f')]||0x0;this[_0x53ed('0x20')]=0x0;this[_0x53ed('0x21')]=![];this[_0x53ed('0x22')]=undefined;this[_0x53ed('0x0')]='';this[_0x53ed('0x23')]={};this[_0x53ed('0x24')]={};this[_0x53ed('0x25')]={};this[_0x53ed('0x26')]={};this[_0x53ed('0x27')]={};this[_0x53ed('0x28')]={};this['updateRealtime']();}Agent[_0x53ed('0x29')]['getChannelStatus']=function(_0x5c1f0f){if(this[_0x5c1f0f+_0x53ed('0x2a')]>0x0){if(this[_0x5c1f0f+'Capacity']>0x0&&this[_0x5c1f0f+'CurrentCapacity']>=this[_0x5c1f0f+'Capacity']){return _0x53ed('0x2b');}else{return _0x53ed('0x2c');}}else{return _0x53ed('0x2d');}};Agent[_0x53ed('0x29')]['updateRealtime']=function(){var _0xf204b7=[_0x53ed('0x2e'),_0x53ed('0x2f'),'openchannel',_0x53ed('0x30'),_0x53ed('0x31'),_0x53ed('0x32')];for(var _0x5b828e=0x0;_0x5b828e<_0xf204b7[_0x53ed('0x33')];_0x5b828e+=0x1){var _0x1d3a2b=this['getChannelStatus'](_0xf204b7[_0x5b828e]);if(this[_0xf204b7[_0x5b828e]+'Status']!==_0x1d3a2b){this[_0xf204b7[_0x5b828e]+_0x53ed('0x34')]=_[_0x53ed('0x35')](moment()['format']('x'));}this[_0xf204b7[_0x5b828e]+_0x53ed('0x36')]=_0x1d3a2b;}var _0x3cfdeb={'id':this['id'],'name':this[_0x53ed('0x6')],'online':this['online'],'voicePause':this[_0x53ed('0x7')],'chatPause':this[_0x53ed('0x8')],'mailPause':this[_0x53ed('0x9')],'smsPause':this[_0x53ed('0xb')],'faxPause':this['faxPause'],'openchannelPause':this[_0x53ed('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x53ed('0x37')],'chatCapacity':this[_0x53ed('0xe')],'chatCurrentCapacity':this[_0x53ed('0xf')],'mailStatus':this[_0x53ed('0x38')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x53ed('0x12')],'faxStatus':this[_0x53ed('0x13')],'faxStatusTime':this[_0x53ed('0x14')],'faxCapacity':this[_0x53ed('0x15')],'faxCurrentCapacity':this[_0x53ed('0x16')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x53ed('0x18')],'smsCapacity':this[_0x53ed('0x19')],'smsCurrentCapacity':this[_0x53ed('0x1a')],'whatsappStatus':this[_0x53ed('0x39')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x53ed('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x53ed('0x1e')],'openchannelStatusTime':this[_0x53ed('0x3a')],'openchannelCapacity':this[_0x53ed('0x1f')],'openchannelCurrentCapacity':this[_0x53ed('0x20')],'busy':this[_0x53ed('0x21')],'busyQueue':this[_0x53ed('0x22')],'chatWaitingInteractions':this[_0x53ed('0x23')],'faxWaitingInteractions':this[_0x53ed('0x24')],'mailWaitingInteractions':this[_0x53ed('0x25')],'openchannelWaitingInteractions':this[_0x53ed('0x26')],'smsWaitingInteractions':this[_0x53ed('0x27')],'whatsappWaitingInteractions':this[_0x53ed('0x28')]};var _0xc07810=md5(JSON['stringify'](_0x3cfdeb));if(this[_0x53ed('0x0')]!==_0xc07810){this[_0x53ed('0x0')]=_0xc07810;io['emit'](_0x53ed('0x3b'),_[_0x53ed('0x3c')](_0x3cfdeb,['online']));}};module[_0x53ed('0x3d')]=Agent; \ No newline at end of file +var _0x540c=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','busy','md5','chatWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','CurrentCapacity','Capacity','working','prototype','chat','openchannel','fax','getChannelStatus','Status','StatusTime','toNumber','format','online','faxStatusTime','openchannelCapacity','faxWaitingInteractions','openchannelWaitingInteractions','user:routing:update','omit','exports','moment'];(function(_0x1ccdfb,_0x36430f){var _0x28618a=function(_0x540bf0){while(--_0x540bf0){_0x1ccdfb['push'](_0x1ccdfb['shift']());}};_0x28618a(++_0x36430f);}(_0x540c,0x130));var _0xc540=function(_0x563923,_0x85b59d){_0x563923=_0x563923-0x0;var _0x1aabd2=_0x540c[_0x563923];return _0x1aabd2;};'use strict';var _=require('lodash');var md5=require('md5');var moment=require(_0xc540('0x0'));var Redis=require('ioredis');var config=require(_0xc540('0x1'));config[_0xc540('0x2')]=_[_0xc540('0x3')](config[_0xc540('0x2')],{'host':_0xc540('0x4'),'port':0x18eb});var io=require(_0xc540('0x5'))(new Redis(config[_0xc540('0x2')]));function Agent(_0x583e9e){this['id']=_0x583e9e['id']||0x0;this[_0xc540('0x6')]=_0x583e9e[_0xc540('0x6')]||'';this[_0xc540('0x7')]=_0x583e9e['voicePause']||![];this['chatPause']=_0x583e9e[_0xc540('0x8')]||![];this[_0xc540('0x9')]=_0x583e9e['mailPause']||![];this[_0xc540('0xa')]=_0x583e9e[_0xc540('0xa')]||![];this[_0xc540('0xb')]=_0x583e9e[_0xc540('0xb')]||![];this['openchannelPause']=_0x583e9e[_0xc540('0xc')]||![];this[_0xc540('0xd')]='unknown';this[_0xc540('0xe')]=0x0;this[_0xc540('0xf')]=_0x583e9e[_0xc540('0xf')]||0x0;this[_0xc540('0x10')]=0x0;this[_0xc540('0x11')]=_0xc540('0x12');this[_0xc540('0x13')]=0x0;this[_0xc540('0x14')]=_0x583e9e['mailCapacity']||0x0;this[_0xc540('0x15')]=0x0;this[_0xc540('0x16')]=_0xc540('0x12');this['faxStatusTime']=0x0;this[_0xc540('0x17')]=_0x583e9e[_0xc540('0x17')]||0x0;this[_0xc540('0x18')]=0x0;this[_0xc540('0x19')]=_0xc540('0x12');this['smsStatusTime']=0x0;this['smsCapacity']=_0x583e9e[_0xc540('0x1a')]||0x0;this[_0xc540('0x1b')]=0x0;this[_0xc540('0x1c')]=_0xc540('0x12');this[_0xc540('0x1d')]=0x0;this['whatsappCapacity']=_0x583e9e[_0xc540('0x1e')]||0x0;this[_0xc540('0x1f')]=0x0;this[_0xc540('0x20')]=_0xc540('0x12');this[_0xc540('0x21')]=0x0;this['openchannelCapacity']=_0x583e9e['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xc540('0x22')]=![];this['busyQueue']=undefined;this[_0xc540('0x23')]='';this[_0xc540('0x24')]={};this['faxWaitingInteractions']={};this[_0xc540('0x25')]={};this['openchannelWaitingInteractions']={};this[_0xc540('0x26')]={};this[_0xc540('0x27')]={};this[_0xc540('0x28')]();}Agent['prototype']['getChannelStatus']=function(_0x3bfffa){if(this[_0x3bfffa+_0xc540('0x29')]>0x0){if(this[_0x3bfffa+_0xc540('0x2a')]>0x0&&this[_0x3bfffa+_0xc540('0x29')]>=this[_0x3bfffa+'Capacity']){return'maxcapacity';}else{return _0xc540('0x2b');}}else{return'idle';}};Agent[_0xc540('0x2c')][_0xc540('0x28')]=function(){var _0x5a9cae=['mail',_0xc540('0x2d'),_0xc540('0x2e'),_0xc540('0x2f'),'sms','whatsapp'];for(var _0x4c5e19=0x0;_0x4c5e19<_0x5a9cae['length'];_0x4c5e19+=0x1){var _0x645431=this[_0xc540('0x30')](_0x5a9cae[_0x4c5e19]);if(this[_0x5a9cae[_0x4c5e19]+_0xc540('0x31')]!==_0x645431){this[_0x5a9cae[_0x4c5e19]+_0xc540('0x32')]=_[_0xc540('0x33')](moment()[_0xc540('0x34')]('x'));}this[_0x5a9cae[_0x4c5e19]+_0xc540('0x31')]=_0x645431;}var _0x2d036e={'id':this['id'],'name':this[_0xc540('0x6')],'online':this[_0xc540('0x35')],'voicePause':this[_0xc540('0x7')],'chatPause':this[_0xc540('0x8')],'mailPause':this[_0xc540('0x9')],'smsPause':this[_0xc540('0xb')],'faxPause':this[_0xc540('0xa')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xc540('0xd')],'chatStatusTime':this[_0xc540('0xe')],'chatCapacity':this[_0xc540('0xf')],'chatCurrentCapacity':this[_0xc540('0x10')],'mailStatus':this[_0xc540('0x11')],'mailStatusTime':this[_0xc540('0x13')],'mailCapacity':this[_0xc540('0x14')],'mailCurrentCapacity':this[_0xc540('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xc540('0x36')],'faxCapacity':this[_0xc540('0x17')],'faxCurrentCapacity':this[_0xc540('0x18')],'smsStatus':this[_0xc540('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xc540('0x1c')],'whatsappStatusTime':this[_0xc540('0x1d')],'whatsappCapacity':this[_0xc540('0x1e')],'whatsappCurrentCapacity':this[_0xc540('0x1f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xc540('0x21')],'openchannelCapacity':this[_0xc540('0x37')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xc540('0x22')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xc540('0x38')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xc540('0x39')],'smsWaitingInteractions':this[_0xc540('0x26')],'whatsappWaitingInteractions':this[_0xc540('0x27')]};var _0x4261c6=md5(JSON['stringify'](_0x2d036e));if(this[_0xc540('0x23')]!==_0x4261c6){this[_0xc540('0x23')]=_0x4261c6;io['emit'](_0xc540('0x3a'),_[_0xc540('0x3b')](_0x2d036e,[_0xc540('0x35')]));}};module[_0xc540('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 23fa718..99303da 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 _0xdb80=['timeout','beepall','Agents','mapAgentsId','md5','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','available','name','waiting','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','../../../config/environment','defaults','socket.io-emitter','redis'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0xdb80,0xaa));var _0x0db8=function(_0x494bba,_0x10541e){_0x494bba=_0x494bba-0x0;var _0x3fa4b3=_0xdb80[_0x494bba];return _0x3fa4b3;};'use strict';var _=require(_0x0db8('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x0db8('0x1'));config['redis']=_[_0x0db8('0x2')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0db8('0x3'))(new Redis(config[_0x0db8('0x4')]));function ChatQueue(_0x51391a){this['id']=_0x51391a['id']||0x0;this['name']=_0x51391a['name']||'';this[_0x0db8('0x5')]=_0x51391a['timeout']||0xa;this['strategy']=_0x51391a['strategy']||_0x0db8('0x6');this[_0x0db8('0x7')]=_0x51391a['Agents'];this[_0x0db8('0x8')]={};this['waiting']=0x0;this[_0x0db8('0x9')]='';this[_0x0db8('0xa')]();this['updateRealtime']();}ChatQueue[_0x0db8('0xb')][_0x0db8('0xa')]=function(){var _0x2a860b=this[_0x0db8('0x8')][_0x0db8('0xc')];this[_0x0db8('0x8')]=_['map'](this[_0x0db8('0x7')],'id');this[_0x0db8('0x8')][_0x0db8('0xc')]=_0x2a860b;};ChatQueue['prototype'][_0x0db8('0xd')]=function(){this[_0x0db8('0xe')]=0x0;this[_0x0db8('0xf')]=0x0;for(var _0x891db9=0x0;_0x891db9=0x0?this[_0x0db8('0x11')]:0x0;var _0x5b9abd={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0db8('0xe')],'name':this[_0x0db8('0x12')],'paused':this[_0x0db8('0xf')],'waiting':this[_0x0db8('0x13')]};var _0x21fdd3=md5(JSON[_0x0db8('0x14')](_0x5b9abd));if(this[_0x0db8('0x9')]!==_0x21fdd3){this[_0x0db8('0x9')]=_0x21fdd3;io['to'](util['format'](_0x0db8('0x15'),_0x5b9abd['name']))[_0x0db8('0x16')](_0x0db8('0x17'),_0x5b9abd);}};module[_0x0db8('0x18')]=ChatQueue; \ No newline at end of file +var _0x7431=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','online','chatPause','available','loggedIn','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x2773e9,_0x3a03f2){var _0x2921e5=function(_0x4d7798){while(--_0x4d7798){_0x2773e9['push'](_0x2773e9['shift']());}};_0x2921e5(++_0x3a03f2);}(_0x7431,0x13f));var _0x1743=function(_0x131c4c,_0x15e9a7){_0x131c4c=_0x131c4c-0x0;var _0x53d693=_0x7431[_0x131c4c];return _0x53d693;};'use strict';var _=require(_0x1743('0x0'));var md5=require(_0x1743('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x1743('0x2'));config[_0x1743('0x3')]=_[_0x1743('0x4')](config[_0x1743('0x3')],{'host':_0x1743('0x5'),'port':0x18eb});var io=require(_0x1743('0x6'))(new Redis(config[_0x1743('0x3')]));function ChatQueue(_0x1b8345){this['id']=_0x1b8345['id']||0x0;this['name']=_0x1b8345[_0x1743('0x7')]||'';this[_0x1743('0x8')]=_0x1b8345[_0x1743('0x8')]||0xa;this[_0x1743('0x9')]=_0x1b8345['strategy']||_0x1743('0xa');this[_0x1743('0xb')]=_0x1b8345[_0x1743('0xb')];this[_0x1743('0xc')]={};this[_0x1743('0xd')]=0x0;this['md5']='';this[_0x1743('0xe')]();this[_0x1743('0xf')]();}ChatQueue[_0x1743('0x10')][_0x1743('0xe')]=function(){var _0x25a8eb=this['mapAgentsId'][_0x1743('0x11')];this['mapAgentsId']=_[_0x1743('0x12')](this[_0x1743('0xb')],'id');this['mapAgentsId'][_0x1743('0x11')]=_0x25a8eb;};ChatQueue[_0x1743('0x10')][_0x1743('0xf')]=function(){this['loggedIn']=0x0;this[_0x1743('0x13')]=0x0;for(var _0x4ca83d=0x0;_0x4ca83d=0x0?this[_0x1743('0x16')]:0x0;var _0x25ac60={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1743('0x17')],'name':this[_0x1743('0x7')],'paused':this[_0x1743('0x13')],'waiting':this[_0x1743('0xd')]};var _0xfe4ace=md5(JSON[_0x1743('0x18')](_0x25ac60));if(this['md5']!==_0xfe4ace){this[_0x1743('0x1')]=_0xfe4ace;io['to'](util[_0x1743('0x19')](_0x1743('0x1a'),_0x25ac60[_0x1743('0x7')]))[_0x1743('0x1b')](_0x1743('0x1c'),_0x25ac60);}};module[_0x1743('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index d961343..9d9950d 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 _0x2647=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','map','_rr','prototype','loggedIn','paused','length','faxPause','available','stringify','md5','format','emit','exports','lodash','util','ioredis','../../../config/environment','redis'];(function(_0xf6d4b3,_0x1162e0){var _0x2fbb5e=function(_0x293812){while(--_0x293812){_0xf6d4b3['push'](_0xf6d4b3['shift']());}};_0x2fbb5e(++_0x1162e0);}(_0x2647,0x91));var _0x7264=function(_0x1c5e2f,_0x372a8d){_0x1c5e2f=_0x1c5e2f-0x0;var _0x5defd1=_0x2647[_0x1c5e2f];return _0x5defd1;};'use strict';var _=require(_0x7264('0x0'));var md5=require('md5');var util=require(_0x7264('0x1'));var Redis=require(_0x7264('0x2'));var config=require(_0x7264('0x3'));config[_0x7264('0x4')]=_[_0x7264('0x5')](config[_0x7264('0x4')],{'host':_0x7264('0x6'),'port':0x18eb});var io=require(_0x7264('0x7'))(new Redis(config[_0x7264('0x4')]));function FaxQueue(_0x2a8322){this['id']=_0x2a8322['id']||0x0;this['name']=_0x2a8322[_0x7264('0x8')]||'';this[_0x7264('0x9')]=_0x2a8322[_0x7264('0x9')]||0xa;this['strategy']=_0x2a8322[_0x7264('0xa')]||_0x7264('0xb');this[_0x7264('0xc')]=_0x2a8322[_0x7264('0xc')];this[_0x7264('0xd')]={};this[_0x7264('0xe')]=0x0;this['md5']='';this['updateRouting']();this[_0x7264('0xf')]();}FaxQueue['prototype'][_0x7264('0x10')]=function(){var _0x14bc4c=this[_0x7264('0xd')]['_rr'];this[_0x7264('0xd')]=_[_0x7264('0x11')](this[_0x7264('0xc')],'id');this['mapAgentsId'][_0x7264('0x12')]=_0x14bc4c;};FaxQueue[_0x7264('0x13')][_0x7264('0xf')]=function(){this[_0x7264('0x14')]=0x0;this[_0x7264('0x15')]=0x0;for(var _0x44af96=0x0;_0x44af96=0x0?this[_0x7264('0x18')]:0x0;var _0x1070fd={'id':this['id'],'available':this[_0x7264('0x18')],'loggedIn':this[_0x7264('0x14')],'name':this[_0x7264('0x8')],'paused':this[_0x7264('0x15')],'waiting':this[_0x7264('0xe')]};var _0x50c273=md5(JSON[_0x7264('0x19')](_0x1070fd));if(this['md5']!==_0x50c273){this[_0x7264('0x1a')]=_0x50c273;io['to'](util[_0x7264('0x1b')]('fax:queue:%s',_0x1070fd[_0x7264('0x8')]))[_0x7264('0x1c')]('fax_queue:save',_0x1070fd);}};module[_0x7264('0x1d')]=FaxQueue; \ No newline at end of file +var _0xfec8=['waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','online','faxPause','available','stringify','fax:queue:%s','emit','exports','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x45cd76,_0x2e2a5b){var _0x55918d=function(_0x76c438){while(--_0x76c438){_0x45cd76['push'](_0x45cd76['shift']());}};_0x55918d(++_0x2e2a5b);}(_0xfec8,0xaa));var _0x8fec=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0xfec8[_0xffa198];return _0x1e4b50;};'use strict';var _=require('lodash');var md5=require(_0x8fec('0x0'));var util=require(_0x8fec('0x1'));var Redis=require(_0x8fec('0x2'));var config=require(_0x8fec('0x3'));config[_0x8fec('0x4')]=_['defaults'](config['redis'],{'host':_0x8fec('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8fec('0x4')]));function FaxQueue(_0x2bef89){this['id']=_0x2bef89['id']||0x0;this[_0x8fec('0x6')]=_0x2bef89[_0x8fec('0x6')]||'';this[_0x8fec('0x7')]=_0x2bef89[_0x8fec('0x7')]||0xa;this[_0x8fec('0x8')]=_0x2bef89[_0x8fec('0x8')]||_0x8fec('0x9');this[_0x8fec('0xa')]=_0x2bef89[_0x8fec('0xa')];this[_0x8fec('0xb')]={};this[_0x8fec('0xc')]=0x0;this[_0x8fec('0x0')]='';this[_0x8fec('0xd')]();this['updateRealtime']();}FaxQueue[_0x8fec('0xe')][_0x8fec('0xd')]=function(){var _0x3bf43a=this[_0x8fec('0xb')]['_rr'];this[_0x8fec('0xb')]=_['map'](this['Agents'],'id');this[_0x8fec('0xb')][_0x8fec('0xf')]=_0x3bf43a;};FaxQueue[_0x8fec('0xe')][_0x8fec('0x10')]=function(){this[_0x8fec('0x11')]=0x0;this[_0x8fec('0x12')]=0x0;for(var _0x17527b=0x0;_0x17527b=0x0?this[_0x8fec('0x15')]:0x0;var _0x31e03c={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8fec('0x11')],'name':this[_0x8fec('0x6')],'paused':this[_0x8fec('0x12')],'waiting':this[_0x8fec('0xc')]};var _0x526973=md5(JSON[_0x8fec('0x16')](_0x31e03c));if(this[_0x8fec('0x0')]!==_0x526973){this[_0x8fec('0x0')]=_0x526973;io['to'](util['format'](_0x8fec('0x17'),_0x31e03c['name']))[_0x8fec('0x18')]('fax_queue:save',_0x31e03c);}};module[_0x8fec('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index c1e58a9..e62e58f 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 _0xbfac=['Intervals','exports','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbfac,0x92));var _0xcbfa=function(_0x38f0e8,_0x266286){_0x38f0e8=_0x38f0e8-0x0;var _0x25a453=_0xbfac[_0x38f0e8];return _0x25a453;};'use strict';function Interval(_0x22f73f){this['id']=_0x22f73f['id']||0x0;this[_0xcbfa('0x0')]=_0x22f73f[_0xcbfa('0x0')]||'';this[_0xcbfa('0x1')]=_0x22f73f[_0xcbfa('0x1')]||{};}module[_0xcbfa('0x2')]=Interval; \ No newline at end of file +var _0xc754=['Intervals','exports','name'];(function(_0x2fe1de,_0x2ca69a){var _0x5d59fe=function(_0x439c80){while(--_0x439c80){_0x2fe1de['push'](_0x2fe1de['shift']());}};_0x5d59fe(++_0x2ca69a);}(_0xc754,0x185));var _0x4c75=function(_0x40ce73,_0x3f30f8){_0x40ce73=_0x40ce73-0x0;var _0xebbe2=_0xc754[_0x40ce73];return _0xebbe2;};'use strict';function Interval(_0x49747e){this['id']=_0x49747e['id']||0x0;this['name']=_0x49747e[_0x4c75('0x0')]||'';this['Intervals']=_0x49747e[_0x4c75('0x1')]||{};}module[_0x4c75('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index b75d573..045cda2 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 _0x8888=['prototype','_rr','loggedIn','paused','length','online','mailPause','available','stringify','mail:queue:%s','emit','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x3aec1e,_0x3be4a2){var _0x4df3d7=function(_0x4c92c6){while(--_0x4c92c6){_0x3aec1e['push'](_0x3aec1e['shift']());}};_0x4df3d7(++_0x3be4a2);}(_0x8888,0x97));var _0x8888=function(_0x5d582d,_0x2e926d){_0x5d582d=_0x5d582d-0x0;var _0xbd54d2=_0x8888[_0x5d582d];return _0xbd54d2;};'use strict';var _=require(_0x8888('0x0'));var md5=require(_0x8888('0x1'));var util=require(_0x8888('0x2'));var Redis=require('ioredis');var config=require(_0x8888('0x3'));config[_0x8888('0x4')]=_[_0x8888('0x5')](config['redis'],{'host':_0x8888('0x6'),'port':0x18eb});var io=require(_0x8888('0x7'))(new Redis(config[_0x8888('0x4')]));function MailQueue(_0x12bac7){this['id']=_0x12bac7['id']||0x0;this[_0x8888('0x8')]=_0x12bac7[_0x8888('0x8')]||'';this[_0x8888('0x9')]=_0x12bac7[_0x8888('0x9')]||0xa;this[_0x8888('0xa')]=_0x12bac7[_0x8888('0xa')]||_0x8888('0xb');this['Agents']=_0x12bac7[_0x8888('0xc')];this[_0x8888('0xd')]={};this[_0x8888('0xe')]=0x0;this['md5']='';this[_0x8888('0xf')]();this[_0x8888('0x10')]();}MailQueue[_0x8888('0x11')][_0x8888('0xf')]=function(){var _0xd61293=this[_0x8888('0xd')]['_rr'];this[_0x8888('0xd')]=_['map'](this[_0x8888('0xc')],'id');this[_0x8888('0xd')][_0x8888('0x12')]=_0xd61293;};MailQueue[_0x8888('0x11')]['updateRealtime']=function(){this[_0x8888('0x13')]=0x0;this[_0x8888('0x14')]=0x0;for(var _0x3a4efd=0x0;_0x3a4efd=0x0?this[_0x8888('0x18')]:0x0;var _0x3586c4={'id':this['id'],'available':this[_0x8888('0x18')],'loggedIn':this[_0x8888('0x13')],'name':this[_0x8888('0x8')],'paused':this['paused'],'waiting':this[_0x8888('0xe')]};var _0x132659=md5(JSON[_0x8888('0x19')](_0x3586c4));if(this[_0x8888('0x1')]!==_0x132659){this['md5']=_0x132659;io['to'](util['format'](_0x8888('0x1a'),_0x3586c4['name']))[_0x8888('0x1b')]('mail_queue:save',_0x3586c4);}};module['exports']=MailQueue; \ No newline at end of file +var _0xf72b=['lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','mailPause','paused','available','waiting','format','emit','exports'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0xf72b,0x190));var _0xbf72=function(_0x13c873,_0x2387cd){_0x13c873=_0x13c873-0x0;var _0x1d0a44=_0xf72b[_0x13c873];return _0x1d0a44;};'use strict';var _=require(_0xbf72('0x0'));var md5=require(_0xbf72('0x1'));var util=require(_0xbf72('0x2'));var Redis=require(_0xbf72('0x3'));var config=require('../../../config/environment');config[_0xbf72('0x4')]=_[_0xbf72('0x5')](config[_0xbf72('0x4')],{'host':_0xbf72('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbf72('0x4')]));function MailQueue(_0x4bac39){this['id']=_0x4bac39['id']||0x0;this[_0xbf72('0x7')]=_0x4bac39[_0xbf72('0x7')]||'';this[_0xbf72('0x8')]=_0x4bac39['timeout']||0xa;this[_0xbf72('0x9')]=_0x4bac39['strategy']||'beepall';this[_0xbf72('0xa')]=_0x4bac39[_0xbf72('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xbf72('0x1')]='';this[_0xbf72('0xb')]();this[_0xbf72('0xc')]();}MailQueue[_0xbf72('0xd')][_0xbf72('0xb')]=function(){var _0x563bd9=this['mapAgentsId'][_0xbf72('0xe')];this[_0xbf72('0xf')]=_[_0xbf72('0x10')](this[_0xbf72('0xa')],'id');this[_0xbf72('0xf')]['_rr']=_0x563bd9;};MailQueue[_0xbf72('0xd')]['updateRealtime']=function(){this[_0xbf72('0x11')]=0x0;this['paused']=0x0;for(var _0x3ca2d8=0x0;_0x3ca2d8=0x0?this[_0xbf72('0x14')]:0x0;var _0x5c4c34={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbf72('0x11')],'name':this[_0xbf72('0x7')],'paused':this[_0xbf72('0x13')],'waiting':this[_0xbf72('0x15')]};var _0x59504e=md5(JSON['stringify'](_0x5c4c34));if(this[_0xbf72('0x1')]!==_0x59504e){this[_0xbf72('0x1')]=_0x59504e;io['to'](util[_0xbf72('0x16')]('mail:queue:%s',_0x5c4c34['name']))[_0xbf72('0x17')]('mail_queue:save',_0x5c4c34);}};module[_0xbf72('0x18')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 7cb12c5..1d7fe1a 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x1e6b34,_0x5c6474){var _0x74c6d=function(_0x4a204d){while(--_0x4a204d){_0x1e6b34['push'](_0x1e6b34['shift']());}};_0x74c6d(++_0x5c6474);}(_0x814b,0x1a2));var _0xb814=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0x814b[_0x5e1b91];return _0x59b52f;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +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(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 329baa6..06aaef1 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 _0x37f8=['prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0x37f8,0xd2));var _0x837f=function(_0x51f468,_0x4da72b){_0x51f468=_0x51f468-0x0;var _0x437c1e=_0x37f8[_0x51f468];return _0x437c1e;};'use strict';var _=require('lodash');var md5=require(_0x837f('0x0'));var util=require(_0x837f('0x1'));var Redis=require(_0x837f('0x2'));var config=require(_0x837f('0x3'));config['redis']=_[_0x837f('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x4e3d08){this['id']=_0x4e3d08['id']||0x0;this[_0x837f('0x5')]=_0x4e3d08[_0x837f('0x5')]||'';this[_0x837f('0x6')]=_0x4e3d08[_0x837f('0x6')]||0xa;this[_0x837f('0x7')]=_0x4e3d08[_0x837f('0x7')]||_0x837f('0x8');this[_0x837f('0x9')]=_0x4e3d08[_0x837f('0x9')];this[_0x837f('0xa')]={};this[_0x837f('0xb')]=0x0;this[_0x837f('0x0')]='';this[_0x837f('0xc')]();this[_0x837f('0xd')]();}SmsQueue[_0x837f('0xe')]['updateRouting']=function(){var _0x204747=this[_0x837f('0xa')][_0x837f('0xf')];this[_0x837f('0xa')]=_[_0x837f('0x10')](this['Agents'],'id');this['mapAgentsId'][_0x837f('0xf')]=_0x204747;};SmsQueue[_0x837f('0xe')][_0x837f('0xd')]=function(){this[_0x837f('0x11')]=0x0;this[_0x837f('0x12')]=0x0;for(var _0x483267=0x0;_0x483267=0x0?this[_0x837f('0x15')]:0x0;var _0x53279d={'id':this['id'],'available':this[_0x837f('0x15')],'loggedIn':this[_0x837f('0x11')],'name':this[_0x837f('0x5')],'paused':this[_0x837f('0x12')],'waiting':this[_0x837f('0xb')]};var _0x4e46c4=md5(JSON[_0x837f('0x16')](_0x53279d));if(this[_0x837f('0x0')]!==_0x4e46c4){this[_0x837f('0x0')]=_0x4e46c4;io['to'](util[_0x837f('0x17')](_0x837f('0x18'),_0x53279d['name']))[_0x837f('0x19')](_0x837f('0x1a'),_0x53279d);}};module[_0x837f('0x1b')]=SmsQueue; \ No newline at end of file +var _0x89e8=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports'];(function(_0x2b4259,_0x572c7a){var _0x591080=function(_0x14909c){while(--_0x14909c){_0x2b4259['push'](_0x2b4259['shift']());}};_0x591080(++_0x572c7a);}(_0x89e8,0x74));var _0x889e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x89e8[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x889e('0x0'));var md5=require(_0x889e('0x1'));var util=require(_0x889e('0x2'));var Redis=require(_0x889e('0x3'));var config=require(_0x889e('0x4'));config[_0x889e('0x5')]=_[_0x889e('0x6')](config[_0x889e('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x186826){this['id']=_0x186826['id']||0x0;this[_0x889e('0x7')]=_0x186826[_0x889e('0x7')]||'';this['timeout']=_0x186826[_0x889e('0x8')]||0xa;this['strategy']=_0x186826[_0x889e('0x9')]||_0x889e('0xa');this[_0x889e('0xb')]=_0x186826['Agents'];this[_0x889e('0xc')]={};this[_0x889e('0xd')]=0x0;this[_0x889e('0x1')]='';this[_0x889e('0xe')]();this['updateRealtime']();}SmsQueue[_0x889e('0xf')][_0x889e('0xe')]=function(){var _0x5eca9c=this[_0x889e('0xc')][_0x889e('0x10')];this[_0x889e('0xc')]=_[_0x889e('0x11')](this['Agents'],'id');this[_0x889e('0xc')][_0x889e('0x10')]=_0x5eca9c;};SmsQueue[_0x889e('0xf')]['updateRealtime']=function(){this[_0x889e('0x12')]=0x0;this[_0x889e('0x13')]=0x0;for(var _0x2b69db=0x0;_0x2b69db=0x0?this['available']:0x0;var _0x75e219={'id':this['id'],'available':this[_0x889e('0x16')],'loggedIn':this[_0x889e('0x12')],'name':this[_0x889e('0x7')],'paused':this[_0x889e('0x13')],'waiting':this['waiting']};var _0xa1b610=md5(JSON[_0x889e('0x17')](_0x75e219));if(this['md5']!==_0xa1b610){this[_0x889e('0x1')]=_0xa1b610;io['to'](util[_0x889e('0x18')](_0x889e('0x19'),_0x75e219['name']))[_0x889e('0x1a')](_0x889e('0x1b'),_0x75e219);}};module[_0x889e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 2fb2f07..9caf721 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 _0xce13=['lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','_rr','map','loggedIn','paused','online','whatsappPause','available','waiting','stringify','format','emit','whatsapp_queue:save','exports'];(function(_0x4ac303,_0x1048c4){var _0x1bf616=function(_0x1d5e02){while(--_0x1d5e02){_0x4ac303['push'](_0x4ac303['shift']());}};_0x1bf616(++_0x1048c4);}(_0xce13,0x6c));var _0x3ce1=function(_0x44286d,_0x5ddefe){_0x44286d=_0x44286d-0x0;var _0x51a71a=_0xce13[_0x44286d];return _0x51a71a;};'use strict';var _=require(_0x3ce1('0x0'));var md5=require(_0x3ce1('0x1'));var util=require(_0x3ce1('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x3ce1('0x3')]=_['defaults'](config['redis'],{'host':_0x3ce1('0x4'),'port':0x18eb});var io=require(_0x3ce1('0x5'))(new Redis(config[_0x3ce1('0x3')]));function WhatsappQueue(_0x3e265a){this['id']=_0x3e265a['id']||0x0;this[_0x3ce1('0x6')]=_0x3e265a['name']||'';this[_0x3ce1('0x7')]=_0x3e265a[_0x3ce1('0x7')]||0xa;this[_0x3ce1('0x8')]=_0x3e265a[_0x3ce1('0x8')]||_0x3ce1('0x9');this[_0x3ce1('0xa')]=_0x3e265a[_0x3ce1('0xa')];this[_0x3ce1('0xb')]={};this['waiting']=0x0;this[_0x3ce1('0x1')]='';this['updateRouting']();this[_0x3ce1('0xc')]();}WhatsappQueue[_0x3ce1('0xd')]['updateRouting']=function(){var _0x3d8c75=this['mapAgentsId'][_0x3ce1('0xe')];this[_0x3ce1('0xb')]=_[_0x3ce1('0xf')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x3d8c75;};WhatsappQueue[_0x3ce1('0xd')][_0x3ce1('0xc')]=function(){this[_0x3ce1('0x10')]=0x0;this[_0x3ce1('0x11')]=0x0;for(var _0x28460b=0x0;_0x28460b=0x0?this[_0x3ce1('0x14')]:0x0;var _0x4e637b={'id':this['id'],'available':this[_0x3ce1('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x3ce1('0x6')],'paused':this['paused'],'waiting':this[_0x3ce1('0x15')]};var _0x247bab=md5(JSON[_0x3ce1('0x16')](_0x4e637b));if(this[_0x3ce1('0x1')]!==_0x247bab){this[_0x3ce1('0x1')]=_0x247bab;io['to'](util[_0x3ce1('0x17')]('whatsapp:queue:%s',_0x4e637b[_0x3ce1('0x6')]))[_0x3ce1('0x18')](_0x3ce1('0x19'),_0x4e637b);}};module[_0x3ce1('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x9424=['name','strategy','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','prototype','length','loggedIn','whatsappPause','paused','available','stringify','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','defaults','redis','socket.io-emitter'];(function(_0x3f5519,_0x40abda){var _0x25cdbe=function(_0x30cf99){while(--_0x30cf99){_0x3f5519['push'](_0x3f5519['shift']());}};_0x25cdbe(++_0x40abda);}(_0x9424,0x76));var _0x4942=function(_0x5af5f3,_0x22a246){_0x5af5f3=_0x5af5f3-0x0;var _0x2521c7=_0x9424[_0x5af5f3];return _0x2521c7;};'use strict';var _=require(_0x4942('0x0'));var md5=require(_0x4942('0x1'));var util=require(_0x4942('0x2'));var Redis=require(_0x4942('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x4942('0x4')](config[_0x4942('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x4942('0x6'))(new Redis(config[_0x4942('0x5')]));function WhatsappQueue(_0x10dcc3){this['id']=_0x10dcc3['id']||0x0;this[_0x4942('0x7')]=_0x10dcc3[_0x4942('0x7')]||'';this['timeout']=_0x10dcc3['timeout']||0xa;this['strategy']=_0x10dcc3[_0x4942('0x8')]||'beepall';this[_0x4942('0x9')]=_0x10dcc3[_0x4942('0x9')];this[_0x4942('0xa')]={};this[_0x4942('0xb')]=0x0;this[_0x4942('0x1')]='';this['updateRouting']();this[_0x4942('0xc')]();}WhatsappQueue['prototype'][_0x4942('0xd')]=function(){var _0x252fab=this[_0x4942('0xa')]['_rr'];this[_0x4942('0xa')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x4942('0xe')]=_0x252fab;};WhatsappQueue[_0x4942('0xf')][_0x4942('0xc')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x17f374=0x0;_0x17f374=0x0?this[_0x4942('0x14')]:0x0;var _0x2ee073={'id':this['id'],'available':this[_0x4942('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x4942('0x7')],'paused':this[_0x4942('0x13')],'waiting':this[_0x4942('0xb')]};var _0x262a3d=md5(JSON[_0x4942('0x15')](_0x2ee073));if(this['md5']!==_0x262a3d){this[_0x4942('0x1')]=_0x262a3d;io['to'](util['format']('whatsapp:queue:%s',_0x2ee073['name']))[_0x4942('0x16')](_0x4942('0x17'),_0x2ee073);}};module[_0x4942('0x18')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index d7c12f2..39142f3 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(_0x46d3eb,_0x490c69){var _0x33f609=function(_0x24295c){while(--_0x24295c){_0x46d3eb['push'](_0x46d3eb['shift']());}};_0x33f609(++_0x490c69);}(_0xb10b,0x12a));var _0xbb10=function(_0x49c1f2,_0x468abb){_0x49c1f2=_0x49c1f2-0x0;var _0x2058c9=_0xb10b[_0x49c1f2];return _0x2058c9;};'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(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 183bc7d..f0e516c 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 _0xba40=['../client','update','Request','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x3712a0,_0x42e538){var _0x5395cc=function(_0x355453){while(--_0x355453){_0x3712a0['push'](_0x3712a0['shift']());}};_0x5395cc(++_0x42e538);}(_0xba40,0x14a));var _0x0ba4=function(_0x5fc36a,_0x30fda8){_0x5fc36a=_0x5fc36a-0x0;var _0x4f9e26=_0xba40[_0x5fc36a];return _0x4f9e26;};'use strict';var client=require(_0x0ba4('0x0'));exports[_0x0ba4('0x1')]=function(_0x5a4689,_0x4d8b79){return client[_0x0ba4('0x2')]('UpdateChatInteraction',{'body':_0x4d8b79,'options':{'where':{'id':_0x5a4689}},'log':_0x0ba4('0x3')});};exports[_0x0ba4('0x4')]=function(_0x3c498e,_0x8b9dcf){return client['Request'](_0x0ba4('0x5'),{'body':_0x8b9dcf,'options':{'where':{'id':_0x3c498e}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xa8fb=['updateChatInteraction','addTags','AddTagsToChatInteraction','update','Request','UpdateChatInteraction'];(function(_0x62dd25,_0x254fac){var _0xda2a3a=function(_0x2eda31){while(--_0x2eda31){_0x62dd25['push'](_0x62dd25['shift']());}};_0xda2a3a(++_0x254fac);}(_0xa8fb,0x16b));var _0xba8f=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xa8fb[_0x3fba9f];return _0x192cf1;};'use strict';var client=require('../client');exports[_0xba8f('0x0')]=function(_0x4e1027,_0x47fa03){return client[_0xba8f('0x1')](_0xba8f('0x2'),{'body':_0x47fa03,'options':{'where':{'id':_0x4e1027}},'log':_0xba8f('0x3')});};exports[_0xba8f('0x4')]=function(_0x53bc2f,_0x2f8281){return client[_0xba8f('0x1')](_0xba8f('0x5'),{'body':_0x2f8281,'options':{'where':{'id':_0x53bc2f}},'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 f1969a6..8203923 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 _0xb8e6=['create','CreateChatMessage','../client'];(function(_0x3d8461,_0x410aea){var _0x3421b5=function(_0x1e10a0){while(--_0x1e10a0){_0x3d8461['push'](_0x3d8461['shift']());}};_0x3421b5(++_0x410aea);}(_0xb8e6,0xda));var _0x6b8e=function(_0x2165e5,_0x156d6d){_0x2165e5=_0x2165e5-0x0;var _0x297746=_0xb8e6[_0x2165e5];return _0x297746;};'use strict';var client=require(_0x6b8e('0x0'));exports[_0x6b8e('0x1')]=function(_0x2c215f){return client['Request'](_0x6b8e('0x2'),{'body':_0x2c215f,'log':'createChatMessage'});}; \ No newline at end of file +var _0xcb56=['create','CreateChatMessage','createChatMessage','../client'];(function(_0x13594e,_0x6f0ed0){var _0x1a4f42=function(_0x30b064){while(--_0x30b064){_0x13594e['push'](_0x13594e['shift']());}};_0x1a4f42(++_0x6f0ed0);}(_0xcb56,0x6f));var _0x6cb5=function(_0x4a7fcf,_0x2543b6){_0x4a7fcf=_0x4a7fcf-0x0;var _0x198071=_0xcb56[_0x4a7fcf];return _0x198071;};'use strict';var client=require(_0x6cb5('0x0'));exports[_0x6cb5('0x1')]=function(_0x2c4eea){return client['Request'](_0x6cb5('0x2'),{'body':_0x2c4eea,'log':_0x6cb5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index f06b433..152d4c1 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 _0xf3a7=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','online'];(function(_0x289243,_0x326754){var _0x1f7e18=function(_0x4f3ad5){while(--_0x4f3ad5){_0x289243['push'](_0x289243['shift']());}};_0x1f7e18(++_0x326754);}(_0xf3a7,0x99));var _0x7f3a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf3a7[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0x7f3a('0x0')]=function(){return function(){return client[_0x7f3a('0x1')](_0x7f3a('0x2'),{'options':{'raw':![],'attributes':['id',_0x7f3a('0x3'),_0x7f3a('0x4'),_0x7f3a('0x5')],'include':[{'model':_0x7f3a('0x6'),'as':_0x7f3a('0x7'),'attributes':['id',_0x7f3a('0x3'),_0x7f3a('0x8'),'chatPause']}]},'log':_0x7f3a('0x0')});};}; \ No newline at end of file +var _0x1c88=['chatPause','getChatQueues','../client','Request','GetChatQueue','name','User','Agents','online'];(function(_0x4b87fa,_0xdef607){var _0x4765ff=function(_0x455930){while(--_0x455930){_0x4b87fa['push'](_0x4b87fa['shift']());}};_0x4765ff(++_0xdef607);}(_0x1c88,0x1a9));var _0x81c8=function(_0x1f9503,_0x8e450b){_0x1f9503=_0x1f9503-0x0;var _0xaab94f=_0x1c88[_0x1f9503];return _0xaab94f;};'use strict';var client=require(_0x81c8('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x81c8('0x1')](_0x81c8('0x2'),{'options':{'raw':![],'attributes':['id',_0x81c8('0x3'),'timeout','strategy'],'include':[{'model':_0x81c8('0x4'),'as':_0x81c8('0x5'),'attributes':['id',_0x81c8('0x3'),_0x81c8('0x6'),_0x81c8('0x7')]}]},'log':_0x81c8('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index ff6be80..f7bf470 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 _0xcb81=['../client','create','Request','UpdateChatQueueReport','DESC'];(function(_0x1598b4,_0x5de7ca){var _0x22f37f=function(_0x50d921){while(--_0x50d921){_0x1598b4['push'](_0x1598b4['shift']());}};_0x22f37f(++_0x5de7ca);}(_0xcb81,0x154));var _0x1cb8=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0xcb81[_0x5e709a];return _0x57401a;};'use strict';var client=require(_0x1cb8('0x0'));exports[_0x1cb8('0x1')]=function(_0x5081c6){return client[_0x1cb8('0x2')]('CreateChatQueueReport',{'body':_0x5081c6,'log':'CreateChatQueueReport'});};exports['update']=function(_0x38c3ea,_0x33a8f2){return client[_0x1cb8('0x2')](_0x1cb8('0x3'),{'body':_0x33a8f2,'options':{'where':{'uniqueid':_0x38c3ea},'order':[['id',_0x1cb8('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x39a9=['update','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport'];(function(_0x125fba,_0x539559){var _0x33356c=function(_0x450272){while(--_0x450272){_0x125fba['push'](_0x125fba['shift']());}};_0x33356c(++_0x539559);}(_0x39a9,0x1d0));var _0x939a=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x39a9[_0x29db36];return _0x234e87;};'use strict';var client=require(_0x939a('0x0'));exports[_0x939a('0x1')]=function(_0xb72a0){return client[_0x939a('0x2')](_0x939a('0x3'),{'body':_0xb72a0,'log':_0x939a('0x3')});};exports[_0x939a('0x4')]=function(_0x2b4648,_0x450b95){return client[_0x939a('0x2')](_0x939a('0x5'),{'body':_0x450b95,'options':{'where':{'uniqueid':_0x2b4648},'order':[['id','DESC']],'limit':0x1},'log':_0x939a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index a31be56..3ccda51 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(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7a54,0x106));var _0x47a5=function(_0x546b45,_0xf06122){_0x546b45=_0x546b45-0x0;var _0x2b8c73=_0x7a54[_0x546b45];return _0x2b8c73;};'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 _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x586fa2,_0x1a45bc){var _0x515be9=function(_0x4e90d5){while(--_0x4e90d5){_0x586fa2['push'](_0x586fa2['shift']());}};_0x515be9(++_0x1a45bc);}(_0x7a54,0x106));var _0x47a5=function(_0x436b5f,_0x1fe18f){_0x436b5f=_0x436b5f-0x0;var _0x13bd2a=_0x7a54[_0x436b5f];return _0x13bd2a;};'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 diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 2bd659b..c44d4bb 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 _0x2ad2=['createFaxMessage','../client','create','CreateFaxMessage'];(function(_0x130209,_0x2cc129){var _0x155fb7=function(_0x891a60){while(--_0x891a60){_0x130209['push'](_0x130209['shift']());}};_0x155fb7(++_0x2cc129);}(_0x2ad2,0x1e1));var _0x22ad=function(_0x1a30c7,_0x5d5441){_0x1a30c7=_0x1a30c7-0x0;var _0x3be1e6=_0x2ad2[_0x1a30c7];return _0x3be1e6;};'use strict';var client=require(_0x22ad('0x0'));exports[_0x22ad('0x1')]=function(_0x501c9e){return client['Request'](_0x22ad('0x2'),{'body':_0x501c9e,'log':_0x22ad('0x3')});}; \ No newline at end of file +var _0x8fc3=['Request','CreateFaxMessage','../client','create'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0x8fc3,0x112));var _0x38fc=function(_0x4b9dc9,_0x14b3a2){_0x4b9dc9=_0x4b9dc9-0x0;var _0x57b302=_0x8fc3[_0x4b9dc9];return _0x57b302;};'use strict';var client=require(_0x38fc('0x0'));exports[_0x38fc('0x1')]=function(_0x456a6b){return client[_0x38fc('0x2')](_0x38fc('0x3'),{'body':_0x456a6b,'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 55e1f5e..9bc1fe0 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 _0x8d3a=['Agents','faxPause','../client','getFaxQueues','GetFaxQueue','name','strategy','User'];(function(_0x5d99bb,_0x10e04b){var _0xdfe846=function(_0x2e3377){while(--_0x2e3377){_0x5d99bb['push'](_0x5d99bb['shift']());}};_0xdfe846(++_0x10e04b);}(_0x8d3a,0xf2));var _0xa8d3=function(_0x2f479f,_0x450994){_0x2f479f=_0x2f479f-0x0;var _0x1295c3=_0x8d3a[_0x2f479f];return _0x1295c3;};'use strict';var client=require(_0xa8d3('0x0'));exports[_0xa8d3('0x1')]=function(){return function(){return client['Request'](_0xa8d3('0x2'),{'options':{'raw':![],'attributes':['id',_0xa8d3('0x3'),'timeout',_0xa8d3('0x4')],'include':[{'model':_0xa8d3('0x5'),'as':_0xa8d3('0x6'),'attributes':['id',_0xa8d3('0x3'),'online',_0xa8d3('0x7')]}]},'log':_0xa8d3('0x1')});};}; \ No newline at end of file +var _0x4348=['User','Agents','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x3e8276,_0x3e304a){var _0x190c8d=function(_0x23a225){while(--_0x23a225){_0x3e8276['push'](_0x3e8276['shift']());}};_0x190c8d(++_0x3e304a);}(_0x4348,0xd5));var _0x8434=function(_0x49ae0d,_0x2607df){_0x49ae0d=_0x49ae0d-0x0;var _0x132d65=_0x4348[_0x49ae0d];return _0x132d65;};'use strict';var client=require(_0x8434('0x0'));exports[_0x8434('0x1')]=function(){return function(){return client[_0x8434('0x2')](_0x8434('0x3'),{'options':{'raw':![],'attributes':['id',_0x8434('0x4'),_0x8434('0x5'),_0x8434('0x6')],'include':[{'model':_0x8434('0x7'),'as':_0x8434('0x8'),'attributes':['id',_0x8434('0x4'),'online',_0x8434('0x9')]}]},'log':_0x8434('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 31a75da..9abd938 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 _0x1c03=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x33cd4b,_0x2288fd){var _0x372866=function(_0xbea668){while(--_0xbea668){_0x33cd4b['push'](_0x33cd4b['shift']());}};_0x372866(++_0x2288fd);}(_0x1c03,0xa0));var _0x31c0=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x1c03[_0x2e8418];return _0x548fe6;};'use strict';var client=require(_0x31c0('0x0'));exports[_0x31c0('0x1')]=function(_0x2c3721){return client['Request'](_0x31c0('0x2'),{'body':_0x2c3721,'log':_0x31c0('0x2')});};exports[_0x31c0('0x3')]=function(_0x56d6d7,_0x1e68aa){return client['Request'](_0x31c0('0x4'),{'body':_0x1e68aa,'options':{'where':{'uniqueid':_0x56d6d7},'order':[['id',_0x31c0('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x40d4=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x4eb7da,_0x1c2e37){var _0x53870e=function(_0x239744){while(--_0x239744){_0x4eb7da['push'](_0x4eb7da['shift']());}};_0x53870e(++_0x1c2e37);}(_0x40d4,0xa0));var _0x440d=function(_0x5607f2,_0x56e147){_0x5607f2=_0x5607f2-0x0;var _0x3685fb=_0x40d4[_0x5607f2];return _0x3685fb;};'use strict';var client=require('../client');exports['create']=function(_0x2b81c7){return client[_0x440d('0x0')](_0x440d('0x1'),{'body':_0x2b81c7,'log':_0x440d('0x1')});};exports[_0x440d('0x2')]=function(_0x283de9,_0x2818c6){return client['Request'](_0x440d('0x3'),{'body':_0x2818c6,'options':{'where':{'uniqueid':_0x283de9},'order':[['id','DESC']],'limit':0x1},'log':_0x440d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 6514119..e4b6c7d 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 _0xa623=['name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x43f5cb,_0x232212){var _0x5c35ed=function(_0x34a8e7){while(--_0x34a8e7){_0x43f5cb['push'](_0x43f5cb['shift']());}};_0x5c35ed(++_0x232212);}(_0xa623,0x1c4));var _0x3a62=function(_0x2d1962,_0x1e601e){_0x2d1962=_0x2d1962-0x0;var _0x4c5cf5=_0xa623[_0x2d1962];return _0x4c5cf5;};'use strict';var client=require(_0x3a62('0x0'));exports[_0x3a62('0x1')]=function(){return function(){return client[_0x3a62('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3a62('0x3')],'include':[{'model':_0x3a62('0x4'),'as':_0x3a62('0x5'),'attributes':['id',_0x3a62('0x3'),_0x3a62('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xca33=['GetInterval','name','Intervals','../client','getIntervals','Request'];(function(_0x42c140,_0x415e11){var _0xc6f9e9=function(_0x24bf2e){while(--_0x24bf2e){_0x42c140['push'](_0x42c140['shift']());}};_0xc6f9e9(++_0x415e11);}(_0xca33,0x6f));var _0x3ca3=function(_0x58e386,_0x347bdf){_0x58e386=_0x58e386-0x0;var _0x4fdea4=_0xca33[_0x58e386];return _0x4fdea4;};'use strict';var client=require(_0x3ca3('0x0'));exports[_0x3ca3('0x1')]=function(){return function(){return client[_0x3ca3('0x2')](_0x3ca3('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3ca3('0x4')],'include':[{'model':'Interval','as':_0x3ca3('0x5'),'attributes':['id',_0x3ca3('0x4'),'interval']}]},'log':_0x3ca3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 56ce7c9..a54e5cc 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 _0x5204=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x5204,0xdf));var _0x4520=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x5204[_0x296754];return _0x1d9f1d;};'use strict';var client=require(_0x4520('0x0'));exports[_0x4520('0x1')]=function(_0x53b1ab,_0x12a3a1){return client[_0x4520('0x2')](_0x4520('0x3'),{'body':_0x12a3a1,'options':{'where':{'id':_0x53b1ab}},'log':_0x4520('0x4')});};exports[_0x4520('0x5')]=function(_0x592fe0,_0x41d89c){return client['Request'](_0x4520('0x6'),{'body':_0x41d89c,'options':{'where':{'id':_0x592fe0}},'log':_0x4520('0x7')});}; \ No newline at end of file +var _0x1775=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update'];(function(_0x808e0d,_0x55f5da){var _0x5b6c43=function(_0x26e710){while(--_0x26e710){_0x808e0d['push'](_0x808e0d['shift']());}};_0x5b6c43(++_0x55f5da);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0x5177('0x0')]=function(_0x26ce12,_0x6abfb8){return client[_0x5177('0x1')](_0x5177('0x2'),{'body':_0x6abfb8,'options':{'where':{'id':_0x26ce12}},'log':_0x5177('0x3')});};exports[_0x5177('0x4')]=function(_0x2027bf,_0x359401){return client[_0x5177('0x1')](_0x5177('0x5'),{'body':_0x359401,'options':{'where':{'id':_0x2027bf}},'log':_0x5177('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 6f66f68..27d678c 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 _0x51ed=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x1ac2cc,_0x220ffa){var _0x58dead=function(_0x28b121){while(--_0x28b121){_0x1ac2cc['push'](_0x1ac2cc['shift']());}};_0x58dead(++_0x220ffa);}(_0x51ed,0xb7));var _0xd51e=function(_0x17a749,_0x40908b){_0x17a749=_0x17a749-0x0;var _0x10ee89=_0x51ed[_0x17a749];return _0x10ee89;};'use strict';var client=require(_0xd51e('0x0'));exports[_0xd51e('0x1')]=function(_0x4717ca){return client[_0xd51e('0x2')](_0xd51e('0x3'),{'body':_0x4717ca,'log':_0xd51e('0x4')});}; \ No newline at end of file +var _0xe7d9=['create','Request','createMailMessage','../client'];(function(_0x4e923c,_0x4d9897){var _0x29638e=function(_0x555f90){while(--_0x555f90){_0x4e923c['push'](_0x4e923c['shift']());}};_0x29638e(++_0x4d9897);}(_0xe7d9,0x1bf));var _0x9e7d=function(_0x387668,_0x144644){_0x387668=_0x387668-0x0;var _0xd3fd7e=_0xe7d9[_0x387668];return _0xd3fd7e;};'use strict';var client=require(_0x9e7d('0x0'));exports[_0x9e7d('0x1')]=function(_0x280f2f){return client[_0x9e7d('0x2')]('CreateMailMessage',{'body':_0x280f2f,'log':_0x9e7d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 3b1b618..e29cee4 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 _0xdf8d=['../client','getMailQueues','GetMailQueue','name','strategy','User','Agents','mailPause'];(function(_0x435c92,_0xd825a6){var _0x2b9c48=function(_0x543d2c){while(--_0x543d2c){_0x435c92['push'](_0x435c92['shift']());}};_0x2b9c48(++_0xd825a6);}(_0xdf8d,0x1e0));var _0xddf8=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xdf8d[_0x3430aa];return _0x2ac5c;};'use strict';var client=require(_0xddf8('0x0'));exports[_0xddf8('0x1')]=function(){return function(){return client['Request'](_0xddf8('0x2'),{'options':{'raw':![],'attributes':['id',_0xddf8('0x3'),'timeout',_0xddf8('0x4')],'include':[{'model':_0xddf8('0x5'),'as':_0xddf8('0x6'),'attributes':['id',_0xddf8('0x3'),'online',_0xddf8('0x7')]}]},'log':_0xddf8('0x1')});};}; \ No newline at end of file +var _0xc386=['GetMailQueue','name','strategy','User','Agents','online','mailPause','../client','getMailQueues'];(function(_0x296469,_0xffde92){var _0x274e93=function(_0x30ca60){while(--_0x30ca60){_0x296469['push'](_0x296469['shift']());}};_0x274e93(++_0xffde92);}(_0xc386,0x8e));var _0x6c38=function(_0x111519,_0x58cccc){_0x111519=_0x111519-0x0;var _0x4f94ce=_0xc386[_0x111519];return _0x4f94ce;};'use strict';var client=require(_0x6c38('0x0'));exports[_0x6c38('0x1')]=function(){return function(){return client['Request'](_0x6c38('0x2'),{'options':{'raw':![],'attributes':['id',_0x6c38('0x3'),'timeout',_0x6c38('0x4')],'include':[{'model':_0x6c38('0x5'),'as':_0x6c38('0x6'),'attributes':['id',_0x6c38('0x3'),_0x6c38('0x7'),_0x6c38('0x8')]}]},'log':_0x6c38('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index d0a0e45..fb96251 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 _0x2800=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x2eaf19,_0x31eadb){var _0x939ae7=function(_0x51322e){while(--_0x51322e){_0x2eaf19['push'](_0x2eaf19['shift']());}};_0x939ae7(++_0x31eadb);}(_0x2800,0x169));var _0x0280=function(_0x2eb52e,_0x2b53f0){_0x2eb52e=_0x2eb52e-0x0;var _0x4128b5=_0x2800[_0x2eb52e];return _0x4128b5;};'use strict';var client=require(_0x0280('0x0'));exports[_0x0280('0x1')]=function(_0x16da11){return client[_0x0280('0x2')](_0x0280('0x3'),{'body':_0x16da11,'log':_0x0280('0x3')});};exports[_0x0280('0x4')]=function(_0x62eb7f,_0x375710){return client[_0x0280('0x2')](_0x0280('0x5'),{'body':_0x375710,'options':{'where':{'uniqueid':_0x62eb7f},'order':[['id',_0x0280('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xa549=['DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x219a71,_0x14a94a){var _0x456e89=function(_0x4e5230){while(--_0x4e5230){_0x219a71['push'](_0x219a71['shift']());}};_0x456e89(++_0x14a94a);}(_0xa549,0x1c8));var _0x9a54=function(_0x1174e7,_0x25e8a9){_0x1174e7=_0x1174e7-0x0;var _0x299c7f=_0xa549[_0x1174e7];return _0x299c7f;};'use strict';var client=require(_0x9a54('0x0'));exports[_0x9a54('0x1')]=function(_0x5b1e3d){return client[_0x9a54('0x2')](_0x9a54('0x3'),{'body':_0x5b1e3d,'log':_0x9a54('0x3')});};exports['update']=function(_0x426f27,_0x522a06){return client['Request']('UpdateMailQueueReport',{'body':_0x522a06,'options':{'where':{'uniqueid':_0x426f27},'order':[['id',_0x9a54('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 5de06eb..c701ad9 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 _0x0a27=['addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x0a27,0xcc));var _0x70a2=function(_0x15c061,_0x5aa013){_0x15c061=_0x15c061-0x0;var _0x8ae5f6=_0x0a27[_0x15c061];return _0x8ae5f6;};'use strict';var client=require('../client');exports[_0x70a2('0x0')]=function(_0x575a93,_0x569014){return client[_0x70a2('0x1')](_0x70a2('0x2'),{'body':_0x569014,'options':{'where':{'id':_0x575a93}},'log':_0x70a2('0x3')});};exports[_0x70a2('0x4')]=function(_0x22a382,_0x5a31ce){return client[_0x70a2('0x1')](_0x70a2('0x5'),{'body':_0x5a31ce,'options':{'where':{'id':_0x22a382}},'log':_0x70a2('0x6')});}; \ No newline at end of file +var _0x47b8=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','Request'];(function(_0x1e576e,_0x2e59eb){var _0x159f18=function(_0x14095c){while(--_0x14095c){_0x1e576e['push'](_0x1e576e['shift']());}};_0x159f18(++_0x2e59eb);}(_0x47b8,0x1e4));var _0x847b=function(_0x33680b,_0x5105ef){_0x33680b=_0x33680b-0x0;var _0x118c9c=_0x47b8[_0x33680b];return _0x118c9c;};'use strict';var client=require(_0x847b('0x0'));exports['update']=function(_0x3b8cd7,_0x573c1){return client[_0x847b('0x1')](_0x847b('0x2'),{'body':_0x573c1,'options':{'where':{'id':_0x3b8cd7}},'log':_0x847b('0x3')});};exports[_0x847b('0x4')]=function(_0x2fdd7e,_0x571eaa){return client[_0x847b('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x571eaa,'options':{'where':{'id':_0x2fdd7e}},'log':_0x847b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 1e272e8..3065edf 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 _0x8c30=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8c30,0x140));var _0x08c3=function(_0x48e56d,_0x151c63){_0x48e56d=_0x48e56d-0x0;var _0x357ac5=_0x8c30[_0x48e56d];return _0x357ac5;};'use strict';var client=require('../client');exports[_0x08c3('0x0')]=function(_0x3f2089){return client[_0x08c3('0x1')](_0x08c3('0x2'),{'body':_0x3f2089,'log':_0x08c3('0x3')});}; \ No newline at end of file +var _0xc611=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x25b8ae,_0x123756){var _0x1956bf=function(_0x44df57){while(--_0x44df57){_0x25b8ae['push'](_0x25b8ae['shift']());}};_0x1956bf(++_0x123756);}(_0xc611,0xb2));var _0x1c61=function(_0x1ba7ac,_0x449202){_0x1ba7ac=_0x1ba7ac-0x0;var _0x379214=_0xc611[_0x1ba7ac];return _0x379214;};'use strict';var client=require(_0x1c61('0x0'));exports[_0x1c61('0x1')]=function(_0x410dd7){return client[_0x1c61('0x2')](_0x1c61('0x3'),{'body':_0x410dd7,'log':_0x1c61('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 66eaf34..6f24206 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 _0xdf7a=['Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x3d75da,_0x372212){var _0x1bd83f=function(_0x3908dd){while(--_0x3908dd){_0x3d75da['push'](_0x3d75da['shift']());}};_0x1bd83f(++_0x372212);}(_0xdf7a,0x9d));var _0xadf7=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0xdf7a[_0x30faec];return _0x29484f;};'use strict';var client=require(_0xadf7('0x0'));exports[_0xadf7('0x1')]=function(){return function(){return client[_0xadf7('0x2')](_0xadf7('0x3'),{'options':{'raw':![],'attributes':['id',_0xadf7('0x4'),_0xadf7('0x5'),_0xadf7('0x6')],'include':[{'model':_0xadf7('0x7'),'as':_0xadf7('0x8'),'attributes':['id',_0xadf7('0x4'),_0xadf7('0x9'),_0xadf7('0xa')]}]},'log':_0xadf7('0x1')});};}; \ No newline at end of file +var _0xa0fa=['name','online','../client','getOpenchannelQueues','Request','timeout','strategy','User','Agents'];(function(_0x331b0c,_0x455d0f){var _0x2051c9=function(_0x51530b){while(--_0x51530b){_0x331b0c['push'](_0x331b0c['shift']());}};_0x2051c9(++_0x455d0f);}(_0xa0fa,0xd1));var _0xaa0f=function(_0x34eeef,_0xb672df){_0x34eeef=_0x34eeef-0x0;var _0x4ab199=_0xa0fa[_0x34eeef];return _0x4ab199;};'use strict';var client=require(_0xaa0f('0x0'));exports[_0xaa0f('0x1')]=function(){return function(){return client[_0xaa0f('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0xaa0f('0x3'),_0xaa0f('0x4')],'include':[{'model':_0xaa0f('0x5'),'as':_0xaa0f('0x6'),'attributes':['id',_0xaa0f('0x7'),_0xaa0f('0x8'),'openchannelPause']}]},'log':_0xaa0f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 4b95a12..5408642 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 _0xec37=['../client','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC'];(function(_0x11016a,_0x160b6a){var _0x3ca33e=function(_0x14fce6){while(--_0x14fce6){_0x11016a['push'](_0x11016a['shift']());}};_0x3ca33e(++_0x160b6a);}(_0xec37,0x1e0));var _0x7ec3=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0xec37[_0x33fcbb];return _0x2efe40;};'use strict';var client=require(_0x7ec3('0x0'));exports[_0x7ec3('0x1')]=function(_0x4617cd){return client[_0x7ec3('0x2')](_0x7ec3('0x3'),{'body':_0x4617cd,'log':_0x7ec3('0x3')});};exports['update']=function(_0x40f84e,_0xd2075e){return client['Request'](_0x7ec3('0x4'),{'body':_0xd2075e,'options':{'where':{'uniqueid':_0x40f84e},'order':[['id',_0x7ec3('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x25a8=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','create'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x25a8,0x126));var _0x825a=function(_0x5021f2,_0x647466){_0x5021f2=_0x5021f2-0x0;var _0x29e9a5=_0x25a8[_0x5021f2];return _0x29e9a5;};'use strict';var client=require('../client');exports[_0x825a('0x0')]=function(_0x3a6242){return client[_0x825a('0x1')]('CreateOpenchannelQueueReport',{'body':_0x3a6242,'log':_0x825a('0x2')});};exports['update']=function(_0x350c61,_0x193d08){return client[_0x825a('0x1')](_0x825a('0x3'),{'body':_0x193d08,'options':{'where':{'uniqueid':_0x350c61},'order':[['id',_0x825a('0x4')]],'limit':0x1},'log':_0x825a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index c43e4a4..8a9d3e8 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 _0xec46=['updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','../client','update'];(function(_0x29d3d4,_0x2f0f8a){var _0x5e5d4f=function(_0x2f2c0b){while(--_0x2f2c0b){_0x29d3d4['push'](_0x29d3d4['shift']());}};_0x5e5d4f(++_0x2f0f8a);}(_0xec46,0x19c));var _0x6ec4=function(_0x24bd96,_0x260e8f){_0x24bd96=_0x24bd96-0x0;var _0x5bfdd7=_0xec46[_0x24bd96];return _0x5bfdd7;};'use strict';var client=require(_0x6ec4('0x0'));exports[_0x6ec4('0x1')]=function(_0x455c4a,_0x181058){return client['Request']('UpdateSmsInteraction',{'body':_0x181058,'options':{'where':{'id':_0x455c4a}},'log':_0x6ec4('0x2')});};exports[_0x6ec4('0x3')]=function(_0x86b9f8,_0x53bbed){return client[_0x6ec4('0x4')](_0x6ec4('0x5'),{'body':_0x53bbed,'options':{'where':{'id':_0x86b9f8}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x4abf=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','addTags'];(function(_0x20efe0,_0x52f0ac){var _0x32d4db=function(_0x5492db){while(--_0x5492db){_0x20efe0['push'](_0x20efe0['shift']());}};_0x32d4db(++_0x52f0ac);}(_0x4abf,0xac));var _0xf4ab=function(_0x2f71c1,_0x319017){_0x2f71c1=_0x2f71c1-0x0;var _0x411bb7=_0x4abf[_0x2f71c1];return _0x411bb7;};'use strict';var client=require(_0xf4ab('0x0'));exports[_0xf4ab('0x1')]=function(_0x5cddfe,_0x321a54){return client['Request']('UpdateSmsInteraction',{'body':_0x321a54,'options':{'where':{'id':_0x5cddfe}},'log':'updateSmsInteraction'});};exports[_0xf4ab('0x2')]=function(_0x4599f6,_0x592623){return client['Request'](_0xf4ab('0x3'),{'body':_0x592623,'options':{'where':{'id':_0x4599f6}},'log':_0xf4ab('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index eb32363..2d828c8 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 _0x2f93=['../client','CreateSmsMessage','createSmsMessage'];(function(_0x48bbf0,_0x317fae){var _0x52cf42=function(_0x13a303){while(--_0x13a303){_0x48bbf0['push'](_0x48bbf0['shift']());}};_0x52cf42(++_0x317fae);}(_0x2f93,0x15f));var _0x32f9=function(_0x363f00,_0x4bf0af){_0x363f00=_0x363f00-0x0;var _0x47d449=_0x2f93[_0x363f00];return _0x47d449;};'use strict';var client=require(_0x32f9('0x0'));exports['create']=function(_0x4bba28){return client['Request'](_0x32f9('0x1'),{'body':_0x4bba28,'log':_0x32f9('0x2')});}; \ No newline at end of file +var _0x17e5=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x39806c,_0x296666){var _0x47505c=function(_0x510785){while(--_0x510785){_0x39806c['push'](_0x39806c['shift']());}};_0x47505c(++_0x296666);}(_0x17e5,0xce));var _0x517e=function(_0x49c960,_0x42a12a){_0x49c960=_0x49c960-0x0;var _0x1a17e5=_0x17e5[_0x49c960];return _0x1a17e5;};'use strict';var client=require(_0x517e('0x0'));exports[_0x517e('0x1')]=function(_0x1b2cea){return client[_0x517e('0x2')](_0x517e('0x3'),{'body':_0x1b2cea,'log':_0x517e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c900cce..525fe9f 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x20ce22,_0x248d78){var _0x25800e=function(_0x30111e){while(--_0x30111e){_0x20ce22['push'](_0x20ce22['shift']());}};_0x25800e(++_0x248d78);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x1b4119,_0x3ba30f){var _0x1ef133=function(_0xdb346d){while(--_0xdb346d){_0x1b4119['push'](_0x1b4119['shift']());}};_0x1ef133(++_0x3ba30f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index e5c1255..d74cfd2 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x273305,_0x57815f){var _0x12cf22=function(_0x308154){while(--_0x308154){_0x273305['push'](_0x273305['shift']());}};_0x12cf22(++_0x57815f);}(_0x008c,0x188));var _0xc008=function(_0x8b9e62,_0x173b44){_0x8b9e62=_0x8b9e62-0x0;var _0x31a9a0=_0x008c[_0x8b9e62];return _0x31a9a0;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a0fd1,_0x3e2ad0){_0x3a0fd1=_0x3a0fd1-0x0;var _0x53d693=_0xedd9[_0x3a0fd1];return _0x53d693;};'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 91ee72b..7ae55a0 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(_0x3c65ab,_0x1aad41){var _0x2db417=function(_0x1a47a7){while(--_0x1a47a7){_0x3c65ab['push'](_0x3c65ab['shift']());}};_0x2db417(++_0x1aad41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0xa2125,_0x22f19b){var _0x157240=function(_0x3c537e){while(--_0x3c537e){_0xa2125['push'](_0xa2125['shift']());}};_0x157240(++_0x22f19b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 e6f177a..a3ffd8d 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 _0x3595=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','update'];(function(_0x4226d6,_0x3864ca){var _0x19655b=function(_0x1d43a1){while(--_0x1d43a1){_0x4226d6['push'](_0x4226d6['shift']());}};_0x19655b(++_0x3864ca);}(_0x3595,0x147));var _0x5359=function(_0x2c4e83,_0x1635a3){_0x2c4e83=_0x2c4e83-0x0;var _0x495114=_0x3595[_0x2c4e83];return _0x495114;};'use strict';var client=require(_0x5359('0x0'));exports[_0x5359('0x1')]=function(_0xa74118,_0x52b0f5){return client[_0x5359('0x2')](_0x5359('0x3'),{'body':_0x52b0f5,'options':{'where':{'id':_0xa74118}},'log':_0x5359('0x4')});};exports[_0x5359('0x5')]=function(_0x1fa814,_0x125c76){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x125c76,'options':{'where':{'id':_0x1fa814}},'log':_0x5359('0x6')});}; \ No newline at end of file +var _0xb4d9=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x214089,_0xb880e6){var _0x20c571=function(_0xcc8487){while(--_0xcc8487){_0x214089['push'](_0x214089['shift']());}};_0x20c571(++_0xb880e6);}(_0xb4d9,0xce));var _0x9b4d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb4d9[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x9b4d('0x0'));exports[_0x9b4d('0x1')]=function(_0x59a6ca,_0x21d695){return client[_0x9b4d('0x2')](_0x9b4d('0x3'),{'body':_0x21d695,'options':{'where':{'id':_0x59a6ca}},'log':'updateWhatsappInteraction'});};exports[_0x9b4d('0x4')]=function(_0x27adf9,_0x19b7aa){return client[_0x9b4d('0x2')](_0x9b4d('0x5'),{'body':_0x19b7aa,'options':{'where':{'id':_0x27adf9}},'log':_0x9b4d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index cdd9c65..ba8fe33 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 _0x3085=['createWhatsappMessage','create','CreateWhatsappMessage'];(function(_0x3d9b3f,_0xd7cc64){var _0x3f7189=function(_0x89b666){while(--_0x89b666){_0x3d9b3f['push'](_0x3d9b3f['shift']());}};_0x3f7189(++_0xd7cc64);}(_0x3085,0x178));var _0x5308=function(_0x126ccf,_0x5461a8){_0x126ccf=_0x126ccf-0x0;var _0x2f565c=_0x3085[_0x126ccf];return _0x2f565c;};'use strict';var client=require('../client');exports[_0x5308('0x0')]=function(_0x7f11e5){return client['Request'](_0x5308('0x1'),{'body':_0x7f11e5,'log':_0x5308('0x2')});}; \ No newline at end of file +var _0x5879=['create','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x261abd,_0x2f2e52){var _0x345c8e=function(_0x5841ee){while(--_0x5841ee){_0x261abd['push'](_0x261abd['shift']());}};_0x345c8e(++_0x2f2e52);}(_0x5879,0x10f));var _0x9587=function(_0x32b527,_0x5d253b){_0x32b527=_0x32b527-0x0;var _0x116fa5=_0x5879[_0x32b527];return _0x116fa5;};'use strict';var client=require(_0x9587('0x0'));exports[_0x9587('0x1')]=function(_0x36367e){return client['Request'](_0x9587('0x2'),{'body':_0x36367e,'log':_0x9587('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index bacd832..b6b46ac 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 _0x6d30=['Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','getWhatsappQueues'];(function(_0x6afc9c,_0xf6b755){var _0x195d68=function(_0x48f1eb){while(--_0x48f1eb){_0x6afc9c['push'](_0x6afc9c['shift']());}};_0x195d68(++_0xf6b755);}(_0x6d30,0x1a6));var _0x06d3=function(_0x23733d,_0x56f0a1){_0x23733d=_0x23733d-0x0;var _0x4a9cc4=_0x6d30[_0x23733d];return _0x4a9cc4;};'use strict';var client=require('../client');exports[_0x06d3('0x0')]=function(){return function(){return client[_0x06d3('0x1')](_0x06d3('0x2'),{'options':{'raw':![],'attributes':['id',_0x06d3('0x3'),_0x06d3('0x4'),_0x06d3('0x5')],'include':[{'model':_0x06d3('0x6'),'as':_0x06d3('0x7'),'attributes':['id','name',_0x06d3('0x8'),'whatsappPause']}]},'log':_0x06d3('0x0')});};}; \ No newline at end of file +var _0x734a=['Agents','online','whatsappPause','../client','getWhatsappQueues','Request','name','strategy','User'];(function(_0x553315,_0x11037a){var _0x5af990=function(_0x344796){while(--_0x344796){_0x553315['push'](_0x553315['shift']());}};_0x5af990(++_0x11037a);}(_0x734a,0xae));var _0xa734=function(_0x3c7a73,_0x3cd0f5){_0x3c7a73=_0x3c7a73-0x0;var _0xd0e2b6=_0x734a[_0x3c7a73];return _0xd0e2b6;};'use strict';var client=require(_0xa734('0x0'));exports[_0xa734('0x1')]=function(){return function(){return client[_0xa734('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xa734('0x3'),'timeout',_0xa734('0x4')],'include':[{'model':_0xa734('0x5'),'as':_0xa734('0x6'),'attributes':['id',_0xa734('0x3'),_0xa734('0x7'),_0xa734('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 5d15d90..825a4ab 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 _0x01e6=['../client','create','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x2e6ab8,_0x4ea85c){var _0x16cba0=function(_0x4b3776){while(--_0x4b3776){_0x2e6ab8['push'](_0x2e6ab8['shift']());}};_0x16cba0(++_0x4ea85c);}(_0x01e6,0x108));var _0x601e=function(_0x33ce71,_0x5325cb){_0x33ce71=_0x33ce71-0x0;var _0x18623e=_0x01e6[_0x33ce71];return _0x18623e;};'use strict';var client=require(_0x601e('0x0'));exports[_0x601e('0x1')]=function(_0x412b28){return client['Request'](_0x601e('0x2'),{'body':_0x412b28,'log':_0x601e('0x2')});};exports[_0x601e('0x3')]=function(_0x42235a,_0x3ce09f){return client['Request'](_0x601e('0x4'),{'body':_0x3ce09f,'options':{'where':{'uniqueid':_0x42235a},'order':[['id',_0x601e('0x5')]],'limit':0x1},'log':_0x601e('0x4')});}; \ No newline at end of file +var _0x3fc5=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x3fc5,0x124));var _0x53fc=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3fc5[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x53fc('0x0'));exports[_0x53fc('0x1')]=function(_0x37672f){return client[_0x53fc('0x2')](_0x53fc('0x3'),{'body':_0x37672f,'log':_0x53fc('0x3')});};exports[_0x53fc('0x4')]=function(_0x2cbaf5,_0x37061d){return client[_0x53fc('0x2')](_0x53fc('0x5'),{'body':_0x37061d,'options':{'where':{'uniqueid':_0x2cbaf5},'order':[['id',_0x53fc('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 abebb6d..25e6b77 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 _0x8526=['name','toLowerCase','length','map','message','find','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','log','error','stack','validate','lodash','util','seq-queue','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]'];(function(_0x56ea12,_0x304238){var _0x4b9883=function(_0x5a0ffa){while(--_0x5a0ffa){_0x56ea12['push'](_0x56ea12['shift']());}};_0x4b9883(++_0x304238);}(_0x8526,0xe3));var _0x6852=function(_0x4125a7,_0x421f72){_0x4125a7=_0x4125a7-0x0;var _0x204ec6=_0x8526[_0x4125a7];return _0x204ec6;};'use strict';var schema=require(_0x6852('0x0'));var _=require(_0x6852('0x1'));var util=require(_0x6852('0x2'));var seqqueue=require(_0x6852('0x3'));var logger=require('../../../../config/logger')(_0x6852('0x4'));var strategy=require(_0x6852('0x5'));var queue=schema({'name':{'type':_0x6852('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x6852('0x7'),'message':_0x6852('0x8')}});function writeLog(_0xe09783,_0x1ed521,_0x368a0f){return logger[_0x6852('0x9')](util['format'](_0x6852('0xa'),_0xe09783,_0x1ed521[_0x6852('0xb')],_0x368a0f));}function handleFindAgent(_0x1ec82c){return function(_0x1258fd){return _0x1258fd[_0x6852('0xb')][_0x6852('0xc')]()===_0x1ec82c[_0x6852('0xc')]();};}exports['consequence']=function(_0x558af7,_0xbd90c7,_0x5aca66,_0x11252a){return function(_0x3f02a8){try{var _0x2d1f45={'name':_0xbd90c7[0x0],'timeout':_0xbd90c7[0x1]};var _0x1bfa90=queue[_0x6852('0x0')](_0x2d1f45,{'typecast':!![]});if(_0x1bfa90[_0x6852('0xd')]){logger['error']('[%s][AGENT]\x20%s',_0x558af7,_[_0x6852('0xe')](_0x1bfa90,_0x6852('0xf'))['join'](',\x20'));_0x3f02a8['stop']();}else{var _0x18ff4c=_[_0x6852('0x10')](_0x5aca66[_0x6852('0x11')],handleFindAgent(_0x2d1f45[_0x6852('0xb')]));if(_0x18ff4c){var _0x272a77=(_0x2d1f45[_0x6852('0x12')]||0xa)*0x3e8;var _0x5ad558,_0x18215f;var _0x48e310=seqqueue[_0x6852('0x13')](_0x272a77);_0x48e310['id']=_0x558af7;_0x48e310[_0x6852('0x14')]=_0x272a77;_0x48e310[_0x6852('0x15')]=_0x11252a[_0x6852('0x15')];writeLog(_0x558af7,_0x18ff4c,util[_0x6852('0x16')](_0x6852('0x17'),_0x272a77));_0x5aca66[_0x6852('0x18')][_0x558af7]['on']('end',function(){logger[_0x6852('0x9')](_0x6852('0x19'),_0x558af7);clearTimeout(_0x18215f);_0x18215f=undefined;_0x48e310[_0x6852('0x1a')]();if(_0x5aca66[_0x6852('0x18')][_0x558af7]){delete _0x5aca66[_0x6852('0x18')][_0x558af7];}_0x3f02a8['stop']();});_0x5aca66[_0x6852('0x18')][_0x558af7]['on']('complete',function(){if(_0x5aca66[_0x6852('0x18')][_0x558af7]){delete _0x5aca66['rules'][_0x558af7];}});_0x18215f=setTimeout(function(){logger[_0x6852('0x9')](_0x6852('0x1b'),_0x558af7);clearTimeout(_0x18215f);_0x48e310[_0x6852('0x1a')]();_0x3f02a8['next']();},_0x272a77);strategy[_0x6852('0x1c')](_0x48e310,_0x18ff4c,_0x5aca66,_0x11252a);}else{logger['error'](_0x6852('0x1d'),_0x558af7,_0x2d1f45[_0x6852('0xb')]);_0x3f02a8[_0x6852('0x1e')]();}}}catch(_0x4dae50){console[_0x6852('0x1f')](_0x4dae50);logger[_0x6852('0x20')]('[%s][QUEUE]\x20%s',_0x558af7,_0x4dae50[_0x6852('0x21')]);_0x3f02a8[_0x6852('0x1e')]();}};}; \ No newline at end of file +var _0xf4df=['name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','createQueue','atimeout','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','util','seq-queue','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]'];(function(_0x4e7197,_0x552137){var _0x2e267c=function(_0xc117a1){while(--_0xc117a1){_0x4e7197['push'](_0x4e7197['shift']());}};_0x2e267c(++_0x552137);}(_0xf4df,0x83));var _0xff4d=function(_0x53d68a,_0x27d046){_0x53d68a=_0x53d68a-0x0;var _0x14f9f8=_0xf4df[_0x53d68a];return _0x14f9f8;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xff4d('0x0'));var seqqueue=require(_0xff4d('0x1'));var logger=require(_0xff4d('0x2'))(_0xff4d('0x3'));var strategy=require(_0xff4d('0x4'));var queue=schema({'name':{'type':_0xff4d('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xff4d('0x6')}});function writeLog(_0x256874,_0x3226a7,_0x551695){return logger['info'](util[_0xff4d('0x7')](_0xff4d('0x8'),_0x256874,_0x3226a7[_0xff4d('0x9')],_0x551695));}function handleFindAgent(_0x40690f){return function(_0x4d9e73){return _0x4d9e73[_0xff4d('0x9')]['toLowerCase']()===_0x40690f[_0xff4d('0xa')]();};}exports[_0xff4d('0xb')]=function(_0x38dcc3,_0x335814,_0x38a3fe,_0x268be7){return function(_0x5b25f0){try{var _0x56f0d2={'name':_0x335814[0x0],'timeout':_0x335814[0x1]};var _0x5df747=queue[_0xff4d('0xc')](_0x56f0d2,{'typecast':!![]});if(_0x5df747[_0xff4d('0xd')]){logger[_0xff4d('0xe')](_0xff4d('0xf'),_0x38dcc3,_[_0xff4d('0x10')](_0x5df747,_0xff4d('0x11'))['join'](',\x20'));_0x5b25f0[_0xff4d('0x12')]();}else{var _0x2c5498=_[_0xff4d('0x13')](_0x38a3fe[_0xff4d('0x14')],handleFindAgent(_0x56f0d2[_0xff4d('0x9')]));if(_0x2c5498){var _0x4830da=(_0x56f0d2[_0xff4d('0x15')]||0xa)*0x3e8;var _0x2ec3a3,_0x150639;var _0x49a1fe=seqqueue[_0xff4d('0x16')](_0x4830da);_0x49a1fe['id']=_0x38dcc3;_0x49a1fe[_0xff4d('0x17')]=_0x4830da;_0x49a1fe['channel']=_0x268be7['channel'];writeLog(_0x38dcc3,_0x2c5498,util[_0xff4d('0x7')]('START:%s',_0x4830da));_0x38a3fe[_0xff4d('0x18')][_0x38dcc3]['on'](_0xff4d('0x19'),function(){logger[_0xff4d('0x1a')](_0xff4d('0x1b'),_0x38dcc3);clearTimeout(_0x150639);_0x150639=undefined;_0x49a1fe[_0xff4d('0x1c')]();if(_0x38a3fe[_0xff4d('0x18')][_0x38dcc3]){delete _0x38a3fe['rules'][_0x38dcc3];}_0x5b25f0['stop']();});_0x38a3fe['rules'][_0x38dcc3]['on'](_0xff4d('0x1d'),function(){if(_0x38a3fe[_0xff4d('0x18')][_0x38dcc3]){delete _0x38a3fe[_0xff4d('0x18')][_0x38dcc3];}});_0x150639=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x38dcc3);clearTimeout(_0x150639);_0x49a1fe['close']();_0x5b25f0[_0xff4d('0x1e')]();},_0x4830da);strategy[_0xff4d('0x1f')](_0x49a1fe,_0x2c5498,_0x38a3fe,_0x268be7);}else{logger[_0xff4d('0xe')](_0xff4d('0x20'),_0x38dcc3,_0x56f0d2['name']);_0x5b25f0[_0xff4d('0x12')]();}}}catch(_0x25c452){console[_0xff4d('0x21')](_0x25c452);logger['error'](_0xff4d('0x22'),_0x38dcc3,_0x25c452['stack']);_0x5b25f0[_0xff4d('0x12')]();}};}; \ 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 6af7ed1..96fd72e 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 _0x2f18=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','create','then','[%s][AMAZONLEX]\x20%s','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','Message','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info'];(function(_0x412f73,_0x3f1870){var _0x5733b7=function(_0x3b25f6){while(--_0x3b25f6){_0x412f73['push'](_0x412f73['shift']());}};_0x5733b7(++_0x3f1870);}(_0x2f18,0xc1));var _0x82f1=function(_0x1c764b,_0x5ed291){_0x1c764b=_0x1c764b-0x0;var _0x523f10=_0x2f18[_0x1c764b];return _0x523f10;};'use strict';var _=require(_0x82f1('0x0'));var moment=require(_0x82f1('0x1'));var AWS=require(_0x82f1('0x2'));var utils=require(_0x82f1('0x3'));var logger=require('../../../../config/logger')(_0x82f1('0x4'));var rpc={'chatMessage':require(_0x82f1('0x5')),'openchannelMessage':require(_0x82f1('0x6')),'mailMessage':require(_0x82f1('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x82f1('0x8')),'whatsappMessage':require(_0x82f1('0x9'))};exports[_0x82f1('0xa')]=function(_0x1e7687,_0xe5d7f3){return function(_0x5184af){try{if(!_[_0x82f1('0xb')](this[_0x82f1('0xc')][_0x82f1('0xd')])){logger[_0x82f1('0xe')]('[%s][AMAZONLEX]\x20%s',_0x1e7687,_0x82f1('0xf'));return _0x5184af[_0x82f1('0x10')]();}var _0x5eee80={'ContactId':this[_0x82f1('0x11')]['id'],'sentAt':moment()[_0x82f1('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x82f1('0x13')};if(this[_0x82f1('0x14')]===_0x82f1('0x15')||this['channel']==='whatsapp'){_0x5eee80[_0x82f1('0x16')]=this['interaction']['phone'];}var _0x2635bd=this[_0x82f1('0x14')];if(_0x2635bd===_0x82f1('0x17')){_0x5eee80[_0x82f1('0x18')]=this[_0x82f1('0x19')]['id'];}else{_0x5eee80[_[_0x82f1('0x1a')](_0x2635bd)+_0x82f1('0x1b')]=this[_0x82f1('0x19')]['id'];}_0x5eee80[_['upperFirst'](_0x2635bd)+_0x82f1('0x1c')]=this[_0x82f1('0xc')]['id'];if(this[_0x82f1('0xc')][_0x82f1('0x1d')]){var _0x1071f1=_0xe5d7f3[0x4];if(!_[_0x82f1('0x1e')](_0x1071f1)){_0x5eee80['body']=utils['getMustacheRender'](_0x1071f1,this);return rpc[_0x2635bd+'Message'][_0x82f1('0x1f')](_0x5eee80)[_0x82f1('0x20')](function(_0x5b6e05){logger['info'](_0x82f1('0x21'),_0x1e7687,_0x5eee80[_0x82f1('0x22')]);})[_0x82f1('0x23')](function(_0x240dd2){logger[_0x82f1('0x24')](_0x82f1('0x21'),_0x1e7687,JSON[_0x82f1('0x25')](_0x240dd2));})[_0x82f1('0x26')](function(){logger[_0x82f1('0xe')](_0x82f1('0x27'),_0x1e7687);_0x5184af[_0x82f1('0x28')]();});}else{logger[_0x82f1('0xe')](_0x82f1('0x29'),_0x1e7687);_0x5184af[_0x82f1('0x28')]();}}else{var _0x50f789=this;var _0x4f7f38=new AWS[(_0x82f1('0x2a'))]({'accessKeyId':_0xe5d7f3[0x0],'secretAccessKey':_0xe5d7f3[0x1],'region':_0xe5d7f3[0x2]});var _0x46380c={'botAlias':_0x82f1('0x2b'),'botName':_0xe5d7f3[0x3],'inputText':this[_0x82f1('0x2c')]['body'],'userId':this[_0x82f1('0x14')]+':'+this[_0x82f1('0xc')]['id'][_0x82f1('0x2d')]()};_0x4f7f38[_0x82f1('0x2e')](_0x46380c,function(_0x115862,_0x4b0fcc){if(_0x115862){logger[_0x82f1('0x24')](_0x82f1('0x21'),_0x1e7687,_0x115862[_0x82f1('0x2c')]);_0x5184af[_0x82f1('0x10')]();}else if(_0x4b0fcc&&_0x4b0fcc[_0x82f1('0x2c')]){_0x50f789[_0x82f1('0x22')]['amazonlex']=_0x4b0fcc;_0x5eee80['body']=_0x4b0fcc[_0x82f1('0x2c')];_0x5eee80['providerName']=_0x82f1('0x2f');_0x5eee80[_0x82f1('0x30')]=JSON[_0x82f1('0x25')](_0x4b0fcc);return rpc[_0x2635bd+_0x82f1('0x31')][_0x82f1('0x1f')](_0x5eee80)[_0x82f1('0x20')](function(_0x4d5328){logger[_0x82f1('0xe')](_0x82f1('0x21'),_0x1e7687,_0x5eee80[_0x82f1('0x22')]);if(_0x4b0fcc[_0x82f1('0x32')]==_0x82f1('0x33')){_0x5184af[_0x82f1('0x10')]();}else{_0x5184af[_0x82f1('0x28')]();}})[_0x82f1('0x23')](function(_0x199a85){logger[_0x82f1('0x24')](_0x82f1('0x21'),_0x1e7687,JSON['stringify'](_0x199a85));_0x5184af[_0x82f1('0x10')]();});}else{_0x5184af['next']();}});}}catch(_0x128866){logger[_0x82f1('0x24')]('[%s][AMAZONLEX]\x20%s',_0x1e7687,JSON[_0x82f1('0x25')](_0x128866));_0x5184af[_0x82f1('0x28')]();}};}; \ No newline at end of file +var _0x5c9b=['out','sms','channel','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','then','info','[%s][AMAZONLEX]\x20%s','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','next','amazonlex','providerName','Message','dialogState','catch','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2cce6d,_0xf01189){var _0x5adaa7=function(_0x40b8aa){while(--_0x40b8aa){_0x2cce6d['push'](_0x2cce6d['shift']());}};_0x5adaa7(++_0xf01189);}(_0x5c9b,0x16f));var _0xb5c9=function(_0x10c215,_0x263d3e){_0x10c215=_0x10c215-0x0;var _0x48896c=_0x5c9b[_0x10c215];return _0x48896c;};'use strict';var _=require(_0xb5c9('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xb5c9('0x1'));var logger=require(_0xb5c9('0x2'))(_0xb5c9('0x3'));var rpc={'chatMessage':require(_0xb5c9('0x4')),'openchannelMessage':require(_0xb5c9('0x5')),'mailMessage':require(_0xb5c9('0x6')),'smsMessage':require(_0xb5c9('0x7')),'faxMessage':require(_0xb5c9('0x8')),'whatsappMessage':require(_0xb5c9('0x9'))};exports[_0xb5c9('0xa')]=function(_0x554e2d,_0x2246d7){return function(_0x2d0a12){try{if(!_[_0xb5c9('0xb')](this[_0xb5c9('0xc')][_0xb5c9('0xd')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x554e2d,_0xb5c9('0xe'));return _0x2d0a12['next']();}var _0x7a855b={'ContactId':this[_0xb5c9('0xf')]['id'],'sentAt':moment()['format'](_0xb5c9('0x10')),'direction':_0xb5c9('0x11')};if(this['channel']===_0xb5c9('0x12')||this[_0xb5c9('0x13')]==='whatsapp'){_0x7a855b['phone']=this[_0xb5c9('0xc')][_0xb5c9('0x14')];}var _0x3e2611=this['channel'];if(_0x3e2611==='chat'){_0x7a855b[_0xb5c9('0x15')]=this['account']['id'];}else{_0x7a855b[_[_0xb5c9('0x16')](_0x3e2611)+_0xb5c9('0x17')]=this[_0xb5c9('0x18')]['id'];}_0x7a855b[_[_0xb5c9('0x16')](_0x3e2611)+_0xb5c9('0x19')]=this['interaction']['id'];if(this[_0xb5c9('0xc')][_0xb5c9('0x1a')]){var _0x1b8124=_0x2246d7[0x4];if(!_[_0xb5c9('0x1b')](_0x1b8124)){_0x7a855b[_0xb5c9('0x1c')]=utils['getMustacheRender'](_0x1b8124,this);return rpc[_0x3e2611+'Message']['create'](_0x7a855b)[_0xb5c9('0x1d')](function(_0x8b8282){logger[_0xb5c9('0x1e')](_0xb5c9('0x1f'),_0x554e2d,_0x7a855b[_0xb5c9('0x1c')]);})['catch'](function(_0xe4ec1c){logger[_0xb5c9('0x20')](_0xb5c9('0x1f'),_0x554e2d,JSON[_0xb5c9('0x21')](_0xe4ec1c));})[_0xb5c9('0x22')](function(){logger['info'](_0xb5c9('0x23'),_0x554e2d);_0x2d0a12[_0xb5c9('0x24')]();});}else{logger['info'](_0xb5c9('0x25'),_0x554e2d);_0x2d0a12[_0xb5c9('0x24')]();}}else{var _0x17df7b=this;var _0x3df34c=new AWS[(_0xb5c9('0x26'))]({'accessKeyId':_0x2246d7[0x0],'secretAccessKey':_0x2246d7[0x1],'region':_0x2246d7[0x2]});var _0x2021a1={'botAlias':_0xb5c9('0x27'),'botName':_0x2246d7[0x3],'inputText':this[_0xb5c9('0x28')][_0xb5c9('0x1c')],'userId':this[_0xb5c9('0x13')]+':'+this[_0xb5c9('0xc')]['id'][_0xb5c9('0x29')]()};_0x3df34c['postText'](_0x2021a1,function(_0x414c34,_0x4180ca){if(_0x414c34){logger['error'](_0xb5c9('0x1f'),_0x554e2d,_0x414c34[_0xb5c9('0x28')]);_0x2d0a12[_0xb5c9('0x2a')]();}else if(_0x4180ca&&_0x4180ca[_0xb5c9('0x28')]){_0x17df7b[_0xb5c9('0x1c')][_0xb5c9('0x2b')]=_0x4180ca;_0x7a855b[_0xb5c9('0x1c')]=_0x4180ca['message'];_0x7a855b[_0xb5c9('0x2c')]='amazonlex';_0x7a855b['providerResponse']=JSON['stringify'](_0x4180ca);return rpc[_0x3e2611+_0xb5c9('0x2d')]['create'](_0x7a855b)[_0xb5c9('0x1d')](function(_0x355de6){logger[_0xb5c9('0x1e')](_0xb5c9('0x1f'),_0x554e2d,_0x7a855b[_0xb5c9('0x1c')]);if(_0x4180ca[_0xb5c9('0x2e')]=='Failed'){_0x2d0a12[_0xb5c9('0x2a')]();}else{_0x2d0a12[_0xb5c9('0x24')]();}})[_0xb5c9('0x2f')](function(_0x292124){logger['error']('[%s][AMAZONLEX]\x20%s',_0x554e2d,JSON['stringify'](_0x292124));_0x2d0a12['next']();});}else{_0x2d0a12['next']();}});}}catch(_0x268788){logger[_0xb5c9('0x20')](_0xb5c9('0x1f'),_0x554e2d,JSON[_0xb5c9('0x21')](_0x268788));_0x2d0a12['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 7957225..f949303 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 _0x6b4f=['[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','','replace','headers','auto-replied','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','finally','resolve','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x6b4f,0x6d));var _0xf6b4=function(_0x270c24,_0x3939fa){_0x270c24=_0x270c24-0x0;var _0x41d574=_0x6b4f[_0x270c24];return _0x41d574;};'use strict';var _=require(_0xf6b4('0x0'));var moment=require(_0xf6b4('0x1'));var utils=require(_0xf6b4('0x2'));var logger=require(_0xf6b4('0x3'))(_0xf6b4('0x4'));var rpc={'chatMessage':require(_0xf6b4('0x5')),'openchannelMessage':require(_0xf6b4('0x6')),'mailMessage':require(_0xf6b4('0x7')),'smsMessage':require(_0xf6b4('0x8')),'faxMessage':require(_0xf6b4('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf6b4('0xa')),'mailInteraction':require(_0xf6b4('0xb')),'smsInteraction':require(_0xf6b4('0xc')),'faxInteraction':require(_0xf6b4('0xd')),'whatsappInteraction':require(_0xf6b4('0xe'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x5376da,_0x35b062,_0x5b7b0e,_0x4be19b){return function(_0x384933){try{var _0x2f4001=this['channel'];if(_0x2f4001===_0xf6b4('0xf')&&_0x4be19b[_0xf6b4('0x10')][_0xf6b4('0x11')]){logger['info'](_0xf6b4('0x12'),_0x5376da,_0xf6b4('0x13'));return _0x384933[_0xf6b4('0x14')]();}if(_0x35b062[0x0]==='1'&&(_[_0xf6b4('0x15')](this[_0xf6b4('0x16')][_0xf6b4('0x17')])||!this[_0xf6b4('0x16')][_0xf6b4('0x17')])){logger[_0xf6b4('0x18')](_0xf6b4('0x12'),_0x5376da,'Autoreply\x20already\x20sent');return _0x384933[_0xf6b4('0x14')]();}if(_0x35b062[0x0]==='2'&&this[_0xf6b4('0x16')]['autoreplyExecuted']){logger[_0xf6b4('0x18')](_0xf6b4('0x19'),_0x5376da,'One\x20Time\x20already\x20sent');return _0x384933['next']();}var _0x289481={'ContactId':this[_0xf6b4('0x1a')]['id'],'sentAt':moment()[_0xf6b4('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf6b4('0x1c')};if(this[_0xf6b4('0x1d')]===_0xf6b4('0xf')){_0x289481[_0xf6b4('0x10')]=utils[_0xf6b4('0x1e')](_0x35b062[0x2],this);}else{_0x289481[_0xf6b4('0x10')]=utils['getMustacheRender'](_0x35b062[0x1],this);}if(this[_0xf6b4('0x1f')]){_0x289481['to']=this[_0xf6b4('0x1f')][_0xf6b4('0x20')]||'';if(this[_0xf6b4('0x1d')]===_0xf6b4('0xf')&&_0x35b062[0x1]==='1'){_0x289481['cc']=this[_0xf6b4('0x1f')]['cc']||'';}_0x289481[_0xf6b4('0x20')]=this[_0xf6b4('0x1f')]['to']||'';_0x289481[_0xf6b4('0x21')]=this[_0xf6b4('0x1f')][_0xf6b4('0x21')]||'';_0x289481[_0xf6b4('0x22')]=!![];if(this[_0xf6b4('0x1f')][_0xf6b4('0x23')]){_0x289481[_0xf6b4('0x23')]='';_0x289481[_0xf6b4('0x23')]+=_[_0xf6b4('0x24')](this[_0xf6b4('0x1f')][_0xf6b4('0x23')],_0xf6b4('0x25'))?'':_0xf6b4('0x26');_0x289481[_0xf6b4('0x23')]+=this['message'][_0xf6b4('0x23')];}}if(this[_0xf6b4('0x1d')]===_0xf6b4('0x27')){_0x289481[_0xf6b4('0x28')]=this[_0xf6b4('0x29')]['id'];}else{_0x289481[_[_0xf6b4('0x2a')](this[_0xf6b4('0x1d')])+_0xf6b4('0x2b')]=this[_0xf6b4('0x29')]['id'];}_0x289481[_['upperFirst'](this[_0xf6b4('0x1d')])+_0xf6b4('0x2c')]=this[_0xf6b4('0x16')]['id'];var _0x3cdd4b=this['interaction'];if(rpc[this[_0xf6b4('0x1d')]+_0xf6b4('0x2d')]){if(this[_0xf6b4('0x1d')]===_0xf6b4('0xf')){_0x289481[_0xf6b4('0x2e')]=this[_0xf6b4('0x1f')][_0xf6b4('0x2f')];_0x289481['html']=_0xf6b4('0x30')+_[_0xf6b4('0x31')](_0x289481[_0xf6b4('0x10')],'';_0x289481[_0xf6b4('0x32')]={'Auto-Submitted':_0xf6b4('0x33'),'X-Auto-Response-Suppress':'All','Precedence':_0xf6b4('0x34')};return mailRpc[_0xf6b4('0x35')](this[_0xf6b4('0x29')]['smtpOptions'],_0x289481)[_0xf6b4('0x36')](function(_0x2f72fd){logger[_0xf6b4('0x18')](_0xf6b4('0x37'),_0x5376da);_0x289481[_0xf6b4('0x2f')]=_0x2f72fd[_0xf6b4('0x1f')]['messageId'];return rpc[_0x2f4001+_0xf6b4('0x2d')][_0xf6b4('0x38')](_0x289481);})[_0xf6b4('0x36')](function(_0x2c7511){logger['info'](_0xf6b4('0x12'),_0x5376da,JSON[_0xf6b4('0x39')](_0x2c7511));})[_0xf6b4('0x3a')](function(_0x322296){logger[_0xf6b4('0x3b')]('[RPC][%s][AUTOREPLY]\x20%s',_0x5376da,JSON[_0xf6b4('0x39')](_0x322296));})[_0xf6b4('0x3c')](function(){Promise[_0xf6b4('0x3d')]()[_0xf6b4('0x36')](function(){if(_0x35b062[0x0]!=='2'||_0x3cdd4b[_0xf6b4('0x3e')])return;return rpc[_0x2f4001+_0xf6b4('0x3f')][_0xf6b4('0x40')](_0x3cdd4b['id'],{'autoreplyExecuted':!![]})[_0xf6b4('0x36')](function(_0x51e9d1){logger['info'](_0xf6b4('0x19'),_0x5376da,JSON[_0xf6b4('0x39')](_0x51e9d1));})[_0xf6b4('0x3a')](function(_0x351904){logger[_0xf6b4('0x3b')](_0xf6b4('0x41'),_0x5376da,JSON[_0xf6b4('0x39')](_0x351904));});})[_0xf6b4('0x36')](function(){_0x384933[_0xf6b4('0x14')]();});});}else{return rpc[this[_0xf6b4('0x1d')]+_0xf6b4('0x2d')][_0xf6b4('0x38')](_0x289481)[_0xf6b4('0x36')](function(){logger[_0xf6b4('0x18')]('[%s][AUTOREPLY]\x20%s',_0x5376da,_0x289481[_0xf6b4('0x10')]);})[_0xf6b4('0x3a')](function(_0x330653){logger[_0xf6b4('0x3b')](_0xf6b4('0x12'),_0x5376da,JSON[_0xf6b4('0x39')](_0x330653));})['finally'](function(){Promise[_0xf6b4('0x3d')]()[_0xf6b4('0x36')](function(){if(_0x35b062[0x0]!=='2'||_0x3cdd4b[_0xf6b4('0x3e')])return;return rpc[_0x2f4001+_0xf6b4('0x3f')]['update'](_0x3cdd4b['id'],{'autoreplyExecuted':!![]})['then'](function(_0x5840bf){logger[_0xf6b4('0x18')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5376da,JSON[_0xf6b4('0x39')](_0x5840bf));})['catch'](function(_0x319952){logger[_0xf6b4('0x3b')](_0xf6b4('0x41'),_0x5376da,JSON[_0xf6b4('0x39')](_0x319952));});})[_0xf6b4('0x36')](function(){_0x384933[_0xf6b4('0x14')]();});});}}}catch(_0x5bde1a){logger[_0xf6b4('0x3b')](_0xf6b4('0x12'),_0x5376da,JSON[_0xf6b4('0x39')](_0x5bde1a));_0x384933[_0xf6b4('0x42')]();}};}; \ No newline at end of file +var _0x527e=['messageId',''+_['replace'](_0xcb0cd7[_0xe527('0x19')],_0xe527('0x27'),_0xe527('0x28'))+'';_0xcb0cd7[_0xe527('0x29')]={'Auto-Submitted':_0xe527('0x2a'),'X-Auto-Response-Suppress':'All','Precedence':_0xe527('0x2b')};return mailRpc['sendMailMessage'](this[_0xe527('0x23')]['smtpOptions'],_0xcb0cd7)[_0xe527('0x2c')](function(_0x1657bd){logger[_0xe527('0xe')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x24fe98);_0xcb0cd7[_0xe527('0x26')]=_0x1657bd[_0xe527('0x1b')][_0xe527('0x26')];return rpc[_0x10f4ac+'Message'][_0xe527('0x2d')](_0xcb0cd7);})[_0xe527('0x2c')](function(_0xf3ac16){logger[_0xe527('0xe')](_0xe527('0xf'),_0x24fe98,JSON[_0xe527('0x2e')](_0xf3ac16));})[_0xe527('0x2f')](function(_0x356541){logger[_0xe527('0x30')](_0xe527('0x31'),_0x24fe98,JSON[_0xe527('0x2e')](_0x356541));})['finally'](function(){Promise[_0xe527('0x32')]()[_0xe527('0x2c')](function(){if(_0x3c2a09[0x0]!=='2'||_0x45c7e8[_0xe527('0x33')])return;return rpc[_0x10f4ac+_0xe527('0x34')]['update'](_0x45c7e8['id'],{'autoreplyExecuted':!![]})[_0xe527('0x2c')](function(_0x176f14){logger[_0xe527('0xe')](_0xe527('0x15'),_0x24fe98,JSON[_0xe527('0x2e')](_0x176f14));})[_0xe527('0x2f')](function(_0x35e9cd){logger[_0xe527('0x30')](_0xe527('0x35'),_0x24fe98,JSON[_0xe527('0x2e')](_0x35e9cd));});})[_0xe527('0x2c')](function(){_0x27f875[_0xe527('0x14')]();});});}else{return rpc[this['channel']+'Message']['create'](_0xcb0cd7)['then'](function(){logger[_0xe527('0xe')](_0xe527('0xf'),_0x24fe98,_0xcb0cd7[_0xe527('0x19')]);})[_0xe527('0x2f')](function(_0x52364c){logger[_0xe527('0x30')](_0xe527('0xf'),_0x24fe98,JSON[_0xe527('0x2e')](_0x52364c));})['finally'](function(){Promise[_0xe527('0x32')]()[_0xe527('0x2c')](function(){if(_0x3c2a09[0x0]!=='2'||_0x45c7e8['autoreplyExecuted'])return;return rpc[_0x10f4ac+_0xe527('0x34')][_0xe527('0x36')](_0x45c7e8['id'],{'autoreplyExecuted':!![]})[_0xe527('0x2c')](function(_0x51c7f9){logger[_0xe527('0xe')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x24fe98,JSON[_0xe527('0x2e')](_0x51c7f9));})[_0xe527('0x2f')](function(_0x18ad74){logger[_0xe527('0x30')](_0xe527('0x35'),_0x24fe98,JSON[_0xe527('0x2e')](_0x18ad74));});})[_0xe527('0x2c')](function(){_0x27f875[_0xe527('0x14')]();});});}}}catch(_0x2812b6){logger[_0xe527('0x30')](_0xe527('0xf'),_0x24fe98,JSON[_0xe527('0x2e')](_0x2812b6));_0x27f875[_0xe527('0x37')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index f103955..526d9a6 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a78=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','update','interaction','then','info','catch','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing'];(function(_0x2f9781,_0x51ffe3){var _0x1707ed=function(_0x1fb98){while(--_0x1fb98){_0x2f9781['push'](_0x2f9781['shift']());}};_0x1707ed(++_0x51ffe3);}(_0x3a78,0x156));var _0x83a7=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x3a78[_0x5ddaac];return _0x2a9c58;};'use strict';var moment=require(_0x83a7('0x0'));var logger=require(_0x83a7('0x1'))(_0x83a7('0x2'));var rpc={'chatInteraction':require(_0x83a7('0x3')),'openchannelInteraction':require(_0x83a7('0x4')),'smsInteraction':require(_0x83a7('0x5')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x83a7('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x83a7('0x7')]=function(_0x574fd4,_0x10c5b6,_0x454d75,_0x2be7ea){return function(_0x204d5a){try{logger['info'](_0x83a7('0x8'),_0x574fd4,_0x10c5b6[0x0]);var _0x4e4368={'closed':0x1,'closedAt':moment()[_0x83a7('0x9')](_0x83a7('0xa')),'closeReason':_0x83a7('0xb'),'disposition':_0x10c5b6[0x0]};if(rpc[_0x2be7ea['channel']+'Interaction']){rpc[_0x2be7ea['channel']+_0x83a7('0xc')][_0x83a7('0xd')](_0x2be7ea[_0x83a7('0xe')]['id'],_0x4e4368)[_0x83a7('0xf')](function(_0x3ccf35){logger[_0x83a7('0x10')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x574fd4,_0x2be7ea[_0x83a7('0xe')]['id']);})[_0x83a7('0x11')](function(_0x34c75d){logger[_0x83a7('0x12')]('[%s][CLOSE]\x20%s',_0x574fd4,JSON[_0x83a7('0x13')](_0x34c75d));})[_0x83a7('0x14')](function(){_0x204d5a[_0x83a7('0x15')]();});}}catch(_0x346846){logger[_0x83a7('0x12')](_0x83a7('0x16'),_0x574fd4,JSON['stringify'](_0x346846));_0x204d5a['stop']();}};}; \ No newline at end of file +var _0x39f2=['YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','stringify','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format'];(function(_0x2ec3b4,_0x167faa){var _0x3563a5=function(_0xa1348c){while(--_0xa1348c){_0x2ec3b4['push'](_0x2ec3b4['shift']());}};_0x3563a5(++_0x167faa);}(_0x39f2,0x192));var _0x239f=function(_0x1efb4d,_0x1736ab){_0x1efb4d=_0x1efb4d-0x0;var _0x361d17=_0x39f2[_0x1efb4d];return _0x361d17;};'use strict';var moment=require(_0x239f('0x0'));var logger=require(_0x239f('0x1'))('routing');var rpc={'chatInteraction':require(_0x239f('0x2')),'openchannelInteraction':require(_0x239f('0x3')),'smsInteraction':require(_0x239f('0x4')),'mailInteraction':require(_0x239f('0x5')),'faxInteraction':require(_0x239f('0x6')),'whatsappInteraction':require(_0x239f('0x7'))};exports[_0x239f('0x8')]=function(_0x166385,_0x53b739,_0x45d66f,_0x38e4be){return function(_0x212f63){try{logger[_0x239f('0x9')](_0x239f('0xa'),_0x166385,_0x53b739[0x0]);var _0x17af21={'closed':0x1,'closedAt':moment()[_0x239f('0xb')](_0x239f('0xc')),'closeReason':'system','disposition':_0x53b739[0x0]};if(rpc[_0x38e4be[_0x239f('0xd')]+'Interaction']){rpc[_0x38e4be[_0x239f('0xd')]+_0x239f('0xe')][_0x239f('0xf')](_0x38e4be['interaction']['id'],_0x17af21)['then'](function(_0x498eec){logger[_0x239f('0x9')](_0x239f('0x10'),_0x166385,_0x38e4be[_0x239f('0x11')]['id']);})[_0x239f('0x12')](function(_0x329934){logger[_0x239f('0x13')]('[%s][CLOSE]\x20%s',_0x166385,JSON[_0x239f('0x14')](_0x329934));})['finally'](function(){_0x212f63[_0x239f('0x15')]();});}}catch(_0x1c70e1){logger[_0x239f('0x13')](_0x239f('0x16'),_0x166385,JSON['stringify'](_0x1c70e1));_0x212f63[_0x239f('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 2e50960..171d740 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6596=['catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','body','dialogflow','result','fulfillment','speech','providerName','create','metadata','endConversation','error','message','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','Message','then'];(function(_0x5f09be,_0x36d613){var _0x2915fd=function(_0x1f9320){while(--_0x1f9320){_0x5f09be['push'](_0x5f09be['shift']());}};_0x2915fd(++_0x36d613);}(_0x6596,0x1d3));var _0x6659=function(_0x33821e,_0x4424cb){_0x33821e=_0x33821e-0x0;var _0x16de3e=_0x6596[_0x33821e];return _0x16de3e;};'use strict';var _=require(_0x6659('0x0'));var moment=require(_0x6659('0x1'));var apiai=require('apiai-promise');var md5=require(_0x6659('0x2'));var utils=require(_0x6659('0x3'));var logger=require(_0x6659('0x4'))(_0x6659('0x5'));var rpc={'chatMessage':require(_0x6659('0x6')),'openchannelMessage':require(_0x6659('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6659('0x8')),'whatsappMessage':require(_0x6659('0x9'))};exports[_0x6659('0xa')]=function(_0x1ed458,_0x29292b){return function(_0x4a900d){try{if(!_['isNil'](this[_0x6659('0xb')][_0x6659('0xc')])){logger[_0x6659('0xd')](_0x6659('0xe'),_0x1ed458,_0x6659('0xf'));return _0x4a900d[_0x6659('0x10')]();}var _0x4e5c6c={'ContactId':this[_0x6659('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6659('0x12')};if(this['channel']===_0x6659('0x13')||this[_0x6659('0x14')]===_0x6659('0x15')){_0x4e5c6c[_0x6659('0x16')]=this['interaction'][_0x6659('0x16')];}var _0x329ebc=this['channel'];if(_0x329ebc===_0x6659('0x17')){_0x4e5c6c[_0x6659('0x18')]=this[_0x6659('0x19')]['id'];}else{_0x4e5c6c[_[_0x6659('0x1a')](_0x329ebc)+_0x6659('0x1b')]=this[_0x6659('0x19')]['id'];}_0x4e5c6c[_['upperFirst'](_0x329ebc)+_0x6659('0x1c')]=this[_0x6659('0xb')]['id'];if(this[_0x6659('0xb')][_0x6659('0x1d')]){var _0x324fbc=_0x29292b[0x2];if(!_[_0x6659('0x1e')](_0x324fbc)){_0x4e5c6c['body']=utils['getMustacheRender'](_0x324fbc,this);return rpc[_0x329ebc+_0x6659('0x1f')]['create'](_0x4e5c6c)[_0x6659('0x20')](function(_0x38e4d6){logger['info'](_0x6659('0xe'),_0x1ed458,_0x4e5c6c['body']);})[_0x6659('0x21')](function(_0x1dc4f1){logger['error'](_0x6659('0xe'),_0x1ed458,JSON[_0x6659('0x22')](_0x1dc4f1));})[_0x6659('0x23')](function(){logger[_0x6659('0xd')](_0x6659('0x24'),_0x1ed458);_0x4a900d[_0x6659('0x25')]();});}else{logger[_0x6659('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1ed458);_0x4a900d[_0x6659('0x25')]();}}else{var _0x3506fd=this;var _0x314e40=apiai(_0x29292b[0x0],{'language':_0x29292b[0x1]||'en'});return _0x314e40[_0x6659('0x26')](this['message']['body'],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0xbad53f){_0x3506fd[_0x6659('0x27')][_0x6659('0x28')]=_0xbad53f;_0x4e5c6c[_0x6659('0x27')]=_0xbad53f[_0x6659('0x29')][_0x6659('0x2a')][_0x6659('0x2b')];_0x4e5c6c[_0x6659('0x2c')]=_0x6659('0x28');_0x4e5c6c['providerResponse']=JSON[_0x6659('0x22')](_0xbad53f);return rpc[_0x329ebc+_0x6659('0x1f')][_0x6659('0x2d')](_0x4e5c6c)['then'](function(_0x4f6787){logger[_0x6659('0xd')](_0x6659('0xe'),_0x1ed458,_0x4e5c6c['body']);if(_0xbad53f[_0x6659('0x29')][_0x6659('0x2e')][_0x6659('0x2f')]){_0x4a900d[_0x6659('0x10')]();}else{_0x4a900d[_0x6659('0x25')]();}})['catch'](function(_0x23ee05){logger[_0x6659('0x30')](_0x6659('0xe'),_0x1ed458,JSON[_0x6659('0x22')](_0x23ee05));_0x4a900d[_0x6659('0x10')]();});})['catch'](function(_0x32ba2a){logger[_0x6659('0x30')](_0x6659('0xe'),_0x1ed458,_0x32ba2a[_0x6659('0x31')]);_0x4a900d[_0x6659('0x10')]();});}}catch(_0x41094b){logger[_0x6659('0x30')]('[%s][DIALOGFLOW]\x20%s',_0x1ed458,JSON[_0x6659('0x22')](_0x41094b));_0x4a900d[_0x6659('0x25')]();}};}; \ No newline at end of file +var _0xf105=['contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','isEmpty','getMustacheRender','Message','create','then','body','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','providerName','providerResponse','stringify','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x1e2dad,_0x3071eb){var _0x1fd721=function(_0x4058d9){while(--_0x4058d9){_0x1e2dad['push'](_0x1e2dad['shift']());}};_0x1fd721(++_0x3071eb);}(_0xf105,0x1b0));var _0x5f10=function(_0x41dadc,_0x11836c){_0x41dadc=_0x41dadc-0x0;var _0x5117f8=_0xf105[_0x41dadc];return _0x5117f8;};'use strict';var _=require(_0x5f10('0x0'));var moment=require(_0x5f10('0x1'));var apiai=require(_0x5f10('0x2'));var md5=require(_0x5f10('0x3'));var utils=require(_0x5f10('0x4'));var logger=require(_0x5f10('0x5'))('routing');var rpc={'chatMessage':require(_0x5f10('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5f10('0x7')),'smsMessage':require(_0x5f10('0x8')),'faxMessage':require(_0x5f10('0x9')),'whatsappMessage':require(_0x5f10('0xa'))};exports[_0x5f10('0xb')]=function(_0x2871bb,_0x34bd06){return function(_0x445aa4){try{if(!_['isNil'](this[_0x5f10('0xc')][_0x5f10('0xd')])){logger[_0x5f10('0xe')](_0x5f10('0xf'),_0x2871bb,_0x5f10('0x10'));return _0x445aa4[_0x5f10('0x11')]();}var _0x540d92={'ContactId':this[_0x5f10('0x12')]['id'],'sentAt':moment()[_0x5f10('0x13')](_0x5f10('0x14')),'direction':_0x5f10('0x15')};if(this[_0x5f10('0x16')]===_0x5f10('0x17')||this['channel']===_0x5f10('0x18')){_0x540d92[_0x5f10('0x19')]=this[_0x5f10('0xc')][_0x5f10('0x19')];}var _0x4aed1d=this['channel'];if(_0x4aed1d===_0x5f10('0x1a')){_0x540d92[_0x5f10('0x1b')]=this['account']['id'];}else{_0x540d92[_['upperFirst'](_0x4aed1d)+_0x5f10('0x1c')]=this['account']['id'];}_0x540d92[_['upperFirst'](_0x4aed1d)+'InteractionId']=this[_0x5f10('0xc')]['id'];if(this[_0x5f10('0xc')]['created']){var _0x369a23=_0x34bd06[0x2];if(!_[_0x5f10('0x1d')](_0x369a23)){_0x540d92['body']=utils[_0x5f10('0x1e')](_0x369a23,this);return rpc[_0x4aed1d+_0x5f10('0x1f')][_0x5f10('0x20')](_0x540d92)[_0x5f10('0x21')](function(_0x565c4f){logger['info'](_0x5f10('0xf'),_0x2871bb,_0x540d92[_0x5f10('0x22')]);})[_0x5f10('0x23')](function(_0x581666){logger[_0x5f10('0x24')](_0x5f10('0xf'),_0x2871bb,JSON['stringify'](_0x581666));})[_0x5f10('0x25')](function(){logger['info'](_0x5f10('0x26'),_0x2871bb);_0x445aa4[_0x5f10('0x27')]();});}else{logger[_0x5f10('0xe')](_0x5f10('0x28'),_0x2871bb);_0x445aa4[_0x5f10('0x27')]();}}else{var _0x5600da=this;var _0x5407a6=apiai(_0x34bd06[0x0],{'language':_0x34bd06[0x1]||'en'});return _0x5407a6[_0x5f10('0x29')](this[_0x5f10('0x2a')][_0x5f10('0x22')],{'sessionId':md5(this[_0x5f10('0xc')]['id'])})[_0x5f10('0x21')](function(_0x4ac05d){_0x5600da[_0x5f10('0x22')][_0x5f10('0x2b')]=_0x4ac05d;_0x540d92[_0x5f10('0x22')]=_0x4ac05d[_0x5f10('0x2c')]['fulfillment']['speech'];_0x540d92[_0x5f10('0x2d')]=_0x5f10('0x2b');_0x540d92[_0x5f10('0x2e')]=JSON[_0x5f10('0x2f')](_0x4ac05d);return rpc[_0x4aed1d+_0x5f10('0x1f')][_0x5f10('0x20')](_0x540d92)[_0x5f10('0x21')](function(_0xf45c0d){logger[_0x5f10('0xe')](_0x5f10('0xf'),_0x2871bb,_0x540d92[_0x5f10('0x22')]);if(_0x4ac05d[_0x5f10('0x2c')][_0x5f10('0x30')][_0x5f10('0x31')]){_0x445aa4[_0x5f10('0x11')]();}else{_0x445aa4['stop']();}})[_0x5f10('0x23')](function(_0x412756){logger['error'](_0x5f10('0xf'),_0x2871bb,JSON[_0x5f10('0x2f')](_0x412756));_0x445aa4[_0x5f10('0x11')]();});})[_0x5f10('0x23')](function(_0x1ff9a4){logger[_0x5f10('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x2871bb,_0x1ff9a4['message']);_0x445aa4[_0x5f10('0x11')]();});}}catch(_0x2ba88c){logger[_0x5f10('0x24')](_0x5f10('0xf'),_0x2871bb,JSON['stringify'](_0x2ba88c));_0x445aa4[_0x5f10('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 2329d53..61cf599 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfeb9=['message','then','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerResponse','fulfillmentText','all','stack','lodash','dialogflow','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','catch','[%s][DIALOGFLOWV2]\x20%s','consequence','isNil','interaction','UserId','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','InteractionId','created','isEmpty','create','error','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace'];(function(_0x59fd5a,_0x544c1c){var _0x50da96=function(_0x390ee1){while(--_0x390ee1){_0x59fd5a['push'](_0x59fd5a['shift']());}};_0x50da96(++_0x544c1c);}(_0xfeb9,0x1c7));var _0x9feb=function(_0x5d7ddd,_0x529ac8){_0x5d7ddd=_0x5d7ddd-0x0;var _0x22483a=_0xfeb9[_0x5d7ddd];return _0x22483a;};'use strict';var _=require(_0x9feb('0x0'));var dialogflow=require(_0x9feb('0x1'));var md5=require('md5');var moment=require(_0x9feb('0x2'));var Promise=require(_0x9feb('0x3'));var logger=require(_0x9feb('0x4'))(_0x9feb('0x5'));var utils=require(_0x9feb('0x6'));var rpc={'chatMessage':require(_0x9feb('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9feb('0x8')),'smsMessage':require(_0x9feb('0x9')),'faxMessage':require(_0x9feb('0xa')),'whatsappMessage':require(_0x9feb('0xb'))};function createMessage(_0x1cc09c,_0x1ca876,_0xdc85b,_0xb3f3ad){return new Promise(function(_0x530a27,_0x42318a){var _0x4c2847=_['clone'](_0xdc85b);_0x4c2847[_0x9feb('0xc')]=_0xb3f3ad;return rpc[_0x1ca876+'Message']['create'](_0x4c2847)['then'](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x1cc09c,_0x4c2847['body']);_0x530a27();})[_0x9feb('0xd')](function(_0x58eb44){logger['error'](_0x9feb('0xe'),_0x1cc09c,JSON['stringify'](_0x58eb44));_0x42318a(_0x58eb44);});});}exports[_0x9feb('0xf')]=function(_0x5d9457,_0x19e167){return function(_0x8ce315){try{if(!_[_0x9feb('0x10')](this[_0x9feb('0x11')][_0x9feb('0x12')])){logger[_0x9feb('0x13')](_0x9feb('0xe'),_0x5d9457,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x8ce315[_0x9feb('0x14')]();}var _0x500252={'ContactId':this[_0x9feb('0x15')]['id'],'sentAt':moment()[_0x9feb('0x16')](_0x9feb('0x17')),'direction':_0x9feb('0x18')};if(this[_0x9feb('0x19')]===_0x9feb('0x1a')||this['channel']===_0x9feb('0x1b')){_0x500252['phone']=this[_0x9feb('0x11')][_0x9feb('0x1c')];}var _0x964e37=this[_0x9feb('0x19')];if(_0x964e37===_0x9feb('0x1d')){_0x500252['ChatWebsiteId']=this['account']['id'];}else{_0x500252[_[_0x9feb('0x1e')](_0x964e37)+_0x9feb('0x1f')]=this['account']['id'];}_0x500252[_[_0x9feb('0x1e')](_0x964e37)+_0x9feb('0x20')]=this[_0x9feb('0x11')]['id'];if(this[_0x9feb('0x11')][_0x9feb('0x21')]){var _0x213ebc=_0x19e167[0x4];if(!_[_0x9feb('0x22')](_0x213ebc)){_0x500252[_0x9feb('0xc')]=utils['getMustacheRender'](_0x213ebc,this);return rpc[_0x964e37+'Message'][_0x9feb('0x23')](_0x500252)['then'](function(_0x30101d){logger[_0x9feb('0x13')](_0x9feb('0xe'),_0x5d9457,_0x500252[_0x9feb('0xc')]);})[_0x9feb('0xd')](function(_0x13db52){logger[_0x9feb('0x24')](_0x9feb('0xe'),_0x5d9457,JSON[_0x9feb('0x25')](_0x13db52));})[_0x9feb('0x26')](function(){logger['info'](_0x9feb('0x27'),_0x5d9457);_0x8ce315[_0x9feb('0x28')]();});}else{logger[_0x9feb('0x13')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5d9457);_0x8ce315[_0x9feb('0x28')]();}}else{var _0x7d19ce=this;var _0x1b93c8=_0x19e167[0x2][_0x9feb('0x29')](/\\n/g,'\x0a');var _0x165dfa={'credentials':{'private_key':_0x1b93c8,'client_email':_0x19e167[0x1]}};var _0x23f8ca=new dialogflow['SessionsClient'](_0x165dfa);var _0x25b108=_0x23f8ca['sessionPath'](_0x19e167[0x0],md5(_0x7d19ce[_0x9feb('0x11')]['id']));var _0x4dc937={'session':_0x25b108,'queryInput':{'text':{'text':_0x7d19ce[_0x9feb('0x2a')]['body'],'languageCode':_0x19e167[0x3]||'en'}}};return _0x23f8ca['detectIntent'](_0x4dc937)[_0x9feb('0x2b')](function(_0x2319b5){if(_0x2319b5&&_0x2319b5[_0x9feb('0x2c')]){_0x7d19ce[_0x9feb('0xc')][_0x9feb('0x2d')]=_0x2319b5;var _0x2c49c5=_0x2319b5[0x0];var _0x55eeb2=_0x2c49c5[_0x9feb('0x2e')][_0x9feb('0x2f')]&&_0x2c49c5['queryResult']['diagnosticInfo'][_0x9feb('0x30')]?_0x2c49c5[_0x9feb('0x2e')][_0x9feb('0x2f')][_0x9feb('0x30')][_0x9feb('0x31')][_0x9feb('0x32')]:![];_0x7d19ce[_0x9feb('0xc')][_0x9feb('0x33')]=_0x2c49c5[_0x9feb('0x2e')][_0x9feb('0x34')];_0x7d19ce[_0x9feb('0xc')][_0x9feb('0x35')]=_0x2c49c5[_0x9feb('0x2e')][_0x9feb('0x36')];_0x7d19ce[_0x9feb('0xc')][_0x9feb('0x37')]=_0x2c49c5[_0x9feb('0x2e')][_0x9feb('0x2f')]&&_0x2c49c5[_0x9feb('0x2e')][_0x9feb('0x2f')][_0x9feb('0x30')]?_0x2c49c5[_0x9feb('0x2e')]['diagnosticInfo'][_0x9feb('0x30')]['end_conversation'][_0x9feb('0x32')]:![];_0x7d19ce[_0x9feb('0xc')][_0x9feb('0x38')]=_0x2c49c5[_0x9feb('0x2e')][_0x9feb('0x39')][_0x9feb('0x3a')];_0x7d19ce[_0x9feb('0xc')][_0x9feb('0x3b')]=_0x2c49c5['queryResult'][_0x9feb('0x39')][_0x9feb('0x3c')];_0x7d19ce[_0x9feb('0xc')][_0x9feb('0x3d')]=_0x2c49c5[_0x9feb('0x2e')][_0x9feb('0x39')][_0x9feb('0x3e')];_0x7d19ce['body'][_0x9feb('0x3f')]=_0x2c49c5[_0x9feb('0x2e')]['languageCode'];_0x7d19ce['body'][_0x9feb('0x40')]=_0x2c49c5['queryResult'][_0x9feb('0x41')];_0x7d19ce['body']['DIALOGFLOWV2_SCORE']=_0x2c49c5[_0x9feb('0x2e')][_0x9feb('0x42')];_0x500252['providerName']=_0x9feb('0x2d');_0x500252[_0x9feb('0x43')]=JSON[_0x9feb('0x25')](_0x2319b5);var _0xef7677=[];for(var _0x11255a=0x0;_0x11255a<_0x2319b5['length'];_0x11255a++){var _0x5d1317=_0x2319b5[_0x11255a];if(_0x5d1317&&_0x5d1317[_0x9feb('0x2e')]&&_0x5d1317[_0x9feb('0x2e')][_0x9feb('0x44')]){_0xef7677['push'](createMessage(_0x5d9457,_0x964e37,_0x500252,_0x5d1317[_0x9feb('0x2e')]['fulfillmentText']));}}return Promise[_0x9feb('0x45')](_0xef7677)['then'](function(){if(_0x55eeb2){_0x8ce315[_0x9feb('0x14')]();}else{_0x8ce315['stop']();}})[_0x9feb('0xd')](function(_0x4a3c98){logger['error'](_0x9feb('0xe'),_0x5d9457,JSON[_0x9feb('0x25')](_0x4a3c98));_0x8ce315['next']();});}})[_0x9feb('0xd')](function(_0x2630f9){logger[_0x9feb('0x24')](_0x9feb('0xe'),_0x5d9457,_0x2630f9[_0x9feb('0x2a')],_0x2630f9[_0x9feb('0x46')]);_0x8ce315[_0x9feb('0x14')]();});}}catch(_0x242388){logger[_0x9feb('0x24')](_0x9feb('0xe'),_0x5d9457,JSON['stringify'](_0x242388));_0x8ce315[_0x9feb('0x28')]();}};}; \ No newline at end of file +var _0x2396=['fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','error','stack','lodash','dialogflow','moment','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','Message','then','info','body','catch','[%s][DIALOGFLOWV2]\x20%s','stringify','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','dialogflowV2','queryResult','diagnosticInfo'];(function(_0x475dcf,_0x50e10a){var _0x38702a=function(_0x184139){while(--_0x184139){_0x475dcf['push'](_0x475dcf['shift']());}};_0x38702a(++_0x50e10a);}(_0x2396,0x187));var _0x6239=function(_0x3f6460,_0x3bdb9b){_0x3f6460=_0x3f6460-0x0;var _0x5d9ac6=_0x2396[_0x3f6460];return _0x5d9ac6;};'use strict';var _=require(_0x6239('0x0'));var dialogflow=require(_0x6239('0x1'));var md5=require('md5');var moment=require(_0x6239('0x2'));var Promise=require('bluebird');var logger=require(_0x6239('0x3'))('routing');var utils=require(_0x6239('0x4'));var rpc={'chatMessage':require(_0x6239('0x5')),'openchannelMessage':require(_0x6239('0x6')),'mailMessage':require(_0x6239('0x7')),'smsMessage':require(_0x6239('0x8')),'faxMessage':require(_0x6239('0x9')),'whatsappMessage':require(_0x6239('0xa'))};function createMessage(_0x52a4a0,_0x3c9616,_0x445516,_0x434797){return new Promise(function(_0x295a5a,_0x28246a){var _0xfad4da=_['clone'](_0x445516);_0xfad4da['body']=_0x434797;return rpc[_0x3c9616+_0x6239('0xb')]['create'](_0xfad4da)[_0x6239('0xc')](function(){logger[_0x6239('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x52a4a0,_0xfad4da[_0x6239('0xe')]);_0x295a5a();})[_0x6239('0xf')](function(_0x46c950){logger['error'](_0x6239('0x10'),_0x52a4a0,JSON[_0x6239('0x11')](_0x46c950));_0x28246a(_0x46c950);});});}exports['consequence']=function(_0x5a8f0f,_0x5d311d){return function(_0x2b077f){try{if(!_['isNil'](this[_0x6239('0x12')][_0x6239('0x13')])){logger[_0x6239('0xd')](_0x6239('0x10'),_0x5a8f0f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2b077f[_0x6239('0x14')]();}var _0x397325={'ContactId':this[_0x6239('0x15')]['id'],'sentAt':moment()[_0x6239('0x16')](_0x6239('0x17')),'direction':_0x6239('0x18')};if(this[_0x6239('0x19')]===_0x6239('0x1a')||this['channel']===_0x6239('0x1b')){_0x397325[_0x6239('0x1c')]=this['interaction'][_0x6239('0x1c')];}var _0x45dc5a=this[_0x6239('0x19')];if(_0x45dc5a===_0x6239('0x1d')){_0x397325[_0x6239('0x1e')]=this[_0x6239('0x1f')]['id'];}else{_0x397325[_[_0x6239('0x20')](_0x45dc5a)+_0x6239('0x21')]=this[_0x6239('0x1f')]['id'];}_0x397325[_[_0x6239('0x20')](_0x45dc5a)+_0x6239('0x22')]=this[_0x6239('0x12')]['id'];if(this['interaction'][_0x6239('0x23')]){var _0x13ee54=_0x5d311d[0x4];if(!_[_0x6239('0x24')](_0x13ee54)){_0x397325[_0x6239('0xe')]=utils[_0x6239('0x25')](_0x13ee54,this);return rpc[_0x45dc5a+_0x6239('0xb')]['create'](_0x397325)[_0x6239('0xc')](function(_0x46f0e5){logger[_0x6239('0xd')](_0x6239('0x10'),_0x5a8f0f,_0x397325[_0x6239('0xe')]);})[_0x6239('0xf')](function(_0x12ed5e){logger['error'](_0x6239('0x10'),_0x5a8f0f,JSON[_0x6239('0x11')](_0x12ed5e));})['finally'](function(){logger[_0x6239('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5a8f0f);_0x2b077f[_0x6239('0x26')]();});}else{logger[_0x6239('0xd')](_0x6239('0x27'),_0x5a8f0f);_0x2b077f[_0x6239('0x26')]();}}else{var _0x400195=this;var _0x1507f8=_0x5d311d[0x2][_0x6239('0x28')](/\\n/g,'\x0a');var _0x2b0711={'credentials':{'private_key':_0x1507f8,'client_email':_0x5d311d[0x1]}};var _0x394f63=new dialogflow[(_0x6239('0x29'))](_0x2b0711);var _0x4848c0=_0x394f63[_0x6239('0x2a')](_0x5d311d[0x0],md5(_0x400195[_0x6239('0x12')]['id']));var _0x121ce8={'session':_0x4848c0,'queryInput':{'text':{'text':_0x400195[_0x6239('0x2b')][_0x6239('0xe')],'languageCode':_0x5d311d[0x3]||'en'}}};return _0x394f63['detectIntent'](_0x121ce8)[_0x6239('0xc')](function(_0x49aeb5){if(_0x49aeb5&&_0x49aeb5['length']){_0x400195[_0x6239('0xe')][_0x6239('0x2c')]=_0x49aeb5;var _0x83f6fe=_0x49aeb5[0x0];var _0x12e3bd=_0x83f6fe[_0x6239('0x2d')][_0x6239('0x2e')]&&_0x83f6fe['queryResult'][_0x6239('0x2e')][_0x6239('0x2f')]?_0x83f6fe[_0x6239('0x2d')]['diagnosticInfo'][_0x6239('0x2f')][_0x6239('0x30')][_0x6239('0x31')]:![];_0x400195[_0x6239('0xe')][_0x6239('0x32')]=_0x83f6fe['queryResult'][_0x6239('0x33')];_0x400195[_0x6239('0xe')][_0x6239('0x34')]=_0x83f6fe[_0x6239('0x2d')][_0x6239('0x35')];_0x400195[_0x6239('0xe')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x83f6fe[_0x6239('0x2d')]['diagnosticInfo']&&_0x83f6fe[_0x6239('0x2d')][_0x6239('0x2e')][_0x6239('0x2f')]?_0x83f6fe[_0x6239('0x2d')]['diagnosticInfo'][_0x6239('0x2f')][_0x6239('0x30')][_0x6239('0x31')]:![];_0x400195['body'][_0x6239('0x36')]=_0x83f6fe[_0x6239('0x2d')][_0x6239('0x37')][_0x6239('0x38')];_0x400195[_0x6239('0xe')][_0x6239('0x39')]=_0x83f6fe[_0x6239('0x2d')][_0x6239('0x37')][_0x6239('0x3a')];_0x400195[_0x6239('0xe')][_0x6239('0x3b')]=_0x83f6fe[_0x6239('0x2d')]['intent'][_0x6239('0x3c')];_0x400195['body'][_0x6239('0x3d')]=_0x83f6fe[_0x6239('0x2d')][_0x6239('0x3e')];_0x400195[_0x6239('0xe')][_0x6239('0x3f')]=_0x83f6fe[_0x6239('0x2d')][_0x6239('0x40')];_0x400195['body'][_0x6239('0x41')]=_0x83f6fe['queryResult'][_0x6239('0x42')];_0x397325['providerName']='dialogflowV2';_0x397325[_0x6239('0x43')]=JSON['stringify'](_0x49aeb5);var _0x51035d=[];for(var _0x1efa55=0x0;_0x1efa55<_0x49aeb5['length'];_0x1efa55++){var _0x2db4b3=_0x49aeb5[_0x1efa55];if(_0x2db4b3&&_0x2db4b3['queryResult']&&_0x2db4b3['queryResult'][_0x6239('0x44')]){_0x51035d[_0x6239('0x45')](createMessage(_0x5a8f0f,_0x45dc5a,_0x397325,_0x2db4b3[_0x6239('0x2d')][_0x6239('0x44')]));}}return Promise[_0x6239('0x46')](_0x51035d)[_0x6239('0xc')](function(){if(_0x12e3bd){_0x2b077f['next']();}else{_0x2b077f[_0x6239('0x26')]();}})['catch'](function(_0x3762bd){logger[_0x6239('0x47')](_0x6239('0x10'),_0x5a8f0f,JSON[_0x6239('0x11')](_0x3762bd));_0x2b077f[_0x6239('0x14')]();});}})[_0x6239('0xf')](function(_0x2539c0){logger['error'](_0x6239('0x10'),_0x5a8f0f,_0x2539c0['message'],_0x2539c0[_0x6239('0x48')]);_0x2b077f[_0x6239('0x14')]();});}}catch(_0x8184cb){logger[_0x6239('0x47')](_0x6239('0x10'),_0x5a8f0f,JSON[_0x6239('0x11')](_0x8184cb));_0x2b077f[_0x6239('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index b5eda78..67ddcf5 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf31b=['lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','next','stringify','validate'];(function(_0x44d693,_0x4a9d83){var _0x3aa5bb=function(_0x3efa06){while(--_0x3efa06){_0x44d693['push'](_0x44d693['shift']());}};_0x3aa5bb(++_0x4a9d83);}(_0xf31b,0x195));var _0xbf31=function(_0x1ac6fc,_0x51a028){_0x1ac6fc=_0x1ac6fc-0x0;var _0x3ece2d=_0xf31b[_0x1ac6fc];return _0x3ece2d;};'use strict';var schema=require(_0xbf31('0x0'));var _=require(_0xbf31('0x1'));var htmlToText=require(_0xbf31('0x2'));var utils=require(_0xbf31('0x3'));var logger=require(_0xbf31('0x4'))(_0xbf31('0x5'));var gotoif=schema({'condition':{'type':_0xbf31('0x6'),'required':!![],'message':_0xbf31('0x7')},'priorityTrue':{'type':_0xbf31('0x8'),'message':_0xbf31('0x9')},'priorityFalse':{'type':_0xbf31('0x8'),'message':_0xbf31('0xa')}});exports[_0xbf31('0xb')]=function(_0x3d7a07,_0x3e538b){return function(_0xbee15c){try{var _0x4fcf8={'condition':htmlToText[_0xbf31('0xc')](utils['getMustacheRender'](_0x3e538b[0x0],this),{'wordwrap':![]})[_0xbf31('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3e538b[0x1],'priorityFalse':_0x3e538b[0x2]};var _0x480eda=gotoif[_0xbf31('0x0')](_0x4fcf8,{'typecast':!![]});if(_0x480eda[_0xbf31('0xe')]){logger[_0xbf31('0xf')](_0xbf31('0x10'),_0x3d7a07,_['map'](_0x480eda,_0xbf31('0x11'))[_0xbf31('0x12')](',\x20'));_0xbee15c[_0xbf31('0x13')]();}else{try{var _0x299942=eval('('+_0x4fcf8[_0xbf31('0x14')]+')');var _0x2a9f48=_0x299942?_0x4fcf8[_0xbf31('0x15')]:_0x4fcf8[_0xbf31('0x16')];logger[_0xbf31('0x17')](_0xbf31('0x18'),_0x3d7a07,_0x4fcf8[_0xbf31('0x14')],_0x299942,_0x2a9f48||'next');if(_0x2a9f48){var _0x273ef0=_[_0xbf31('0x19')](_0xbee15c[_0xbf31('0x1a')](),{'p':_0x2a9f48});if(_0x273ef0>=0x0){logger[_0xbf31('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3d7a07,_0x2a9f48||_0xbf31('0x1b'),_0x273ef0);_0xbee15c['next'](_0x273ef0);}else{logger[_0xbf31('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3d7a07,_0x2a9f48||_0xbf31('0x1b'));_0xbee15c['stop']();}}else{_0xbee15c[_0xbf31('0x1b')]();}}catch(_0x22c510){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x3d7a07,_0x22c510[_0xbf31('0x11')]);_0xbee15c[_0xbf31('0x13')]();}}}catch(_0x2286fb){logger[_0xbf31('0xf')](_0xbf31('0x10'),_0x3d7a07,JSON[_0xbf31('0x1c')](_0x2286fb));_0xbee15c[_0xbf31('0x13')]();}};}; \ No newline at end of file +var _0x404c=['consequence','validate','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','./utils','routing','string','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number'];(function(_0x19a732,_0x1f3601){var _0x27a9b6=function(_0x1c2ef8){while(--_0x1c2ef8){_0x19a732['push'](_0x19a732['shift']());}};_0x27a9b6(++_0x1f3601);}(_0x404c,0x1dd));var _0xc404=function(_0x202aa8,_0x3b1ede){_0x202aa8=_0x202aa8-0x0;var _0x474298=_0x404c[_0x202aa8];return _0x474298;};'use strict';var schema=require('validate');var _=require(_0xc404('0x0'));var htmlToText=require('html-to-text');var utils=require(_0xc404('0x1'));var logger=require('../../../../config/logger')(_0xc404('0x2'));var gotoif=schema({'condition':{'type':_0xc404('0x3'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0xc404('0x4')},'priorityFalse':{'type':'number','message':_0xc404('0x5')}});exports[_0xc404('0x6')]=function(_0x75a40b,_0x522949){return function(_0x326a6b){try{var _0x195988={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x522949[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x522949[0x1],'priorityFalse':_0x522949[0x2]};var _0x24a975=gotoif[_0xc404('0x7')](_0x195988,{'typecast':!![]});if(_0x24a975['length']){logger[_0xc404('0x8')](_0xc404('0x9'),_0x75a40b,_[_0xc404('0xa')](_0x24a975,_0xc404('0xb'))[_0xc404('0xc')](',\x20'));_0x326a6b[_0xc404('0xd')]();}else{try{var _0x22acf8=eval('('+_0x195988[_0xc404('0xe')]+')');var _0x54e2c0=_0x22acf8?_0x195988[_0xc404('0xf')]:_0x195988['priorityFalse'];logger[_0xc404('0x10')](_0xc404('0x11'),_0x75a40b,_0x195988[_0xc404('0xe')],_0x22acf8,_0x54e2c0||'next');if(_0x54e2c0){var _0x35bcee=_[_0xc404('0x12')](_0x326a6b['rules'](),{'p':_0x54e2c0});if(_0x35bcee>=0x0){logger[_0xc404('0x10')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x75a40b,_0x54e2c0||_0xc404('0x13'),_0x35bcee);_0x326a6b[_0xc404('0x13')](_0x35bcee);}else{logger[_0xc404('0x10')](_0xc404('0x14'),_0x75a40b,_0x54e2c0||_0xc404('0x13'));_0x326a6b[_0xc404('0xd')]();}}else{_0x326a6b['next']();}}catch(_0x1a7f10){logger[_0xc404('0x8')](_0xc404('0x15'),_0x75a40b,_0x1a7f10['message']);_0x326a6b['stop']();}}}catch(_0x45a5f1){logger['error'](_0xc404('0x9'),_0x75a40b,JSON[_0xc404('0x16')](_0x45a5f1));_0x326a6b['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 1ebb4e8..0377b17 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 _0xd002=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0xd60bf9,_0x4190de){var _0x7de348=function(_0x3b9f5b){while(--_0x3b9f5b){_0xd60bf9['push'](_0xd60bf9['shift']());}};_0x7de348(++_0x4190de);}(_0xd002,0x97));var _0x2d00=function(_0x32158d,_0x4c6085){_0x32158d=_0x32158d-0x0;var _0x1fc3cf=_0xd002[_0x32158d];return _0x1fc3cf;};'use strict';var schema=require(_0x2d00('0x0'));var _=require('lodash');var logger=require(_0x2d00('0x1'))(_0x2d00('0x2'));var gotop=schema({'priority':{'type':_0x2d00('0x3'),'required':!![],'message':_0x2d00('0x4')}});exports[_0x2d00('0x5')]=function(_0x1e797d,_0x550693){return function(_0x599527){try{var _0x3ddeec={'priority':_0x550693[0x0]};var _0x5175b0=gotop[_0x2d00('0x0')](_0x3ddeec,{'typecast':!![]});if(_0x5175b0[_0x2d00('0x6')]){logger[_0x2d00('0x7')]('[%s][GOTOP]\x20%s',_0x1e797d,_[_0x2d00('0x8')](_0x5175b0,'message')[_0x2d00('0x9')](',\x20'));_0x599527[_0x2d00('0xa')]();}else{logger[_0x2d00('0xb')](_0x2d00('0xc'),_0x1e797d,_0x3ddeec[_0x2d00('0xd')]);if(_0x3ddeec['priority']){var _0x1cf5ff=_[_0x2d00('0xe')](_0x599527[_0x2d00('0xf')](),{'p':_0x3ddeec['priority']});if(_0x1cf5ff>=0x0){logger[_0x2d00('0xb')](_0x2d00('0x10'),_0x1e797d,_0x3ddeec[_0x2d00('0xd')]||_0x2d00('0x11'),_0x1cf5ff);_0x599527[_0x2d00('0x11')](_0x1cf5ff);}else{logger[_0x2d00('0xb')](_0x2d00('0x12'),_0x1e797d,_0x3ddeec[_0x2d00('0xd')]||_0x2d00('0x11'));_0x599527[_0x2d00('0xa')]();}}else{_0x599527[_0x2d00('0x11')]();}}}catch(_0x3dd901){logger[_0x2d00('0x7')](_0x2d00('0x13'),_0x1e797d,JSON[_0x2d00('0x14')](_0x3dd901));_0x599527[_0x2d00('0xa')]();}};}; \ No newline at end of file +var _0x4b2e=['findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','error','stop','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b2e,0x115));var _0xe4b2=function(_0x5b035c,_0x3c2dfc){_0x5b035c=_0x5b035c-0x0;var _0x505ae8=_0x4b2e[_0x5b035c];return _0x505ae8;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0xe4b2('0x0'))(_0xe4b2('0x1'));var gotop=schema({'priority':{'type':_0xe4b2('0x2'),'required':!![],'message':_0xe4b2('0x3')}});exports[_0xe4b2('0x4')]=function(_0x1f01d9,_0xb0a1d0){return function(_0x57ec54){try{var _0x53f3d2={'priority':_0xb0a1d0[0x0]};var _0x3edb9a=gotop['validate'](_0x53f3d2,{'typecast':!![]});if(_0x3edb9a['length']){logger['error'](_0xe4b2('0x5'),_0x1f01d9,_[_0xe4b2('0x6')](_0x3edb9a,_0xe4b2('0x7'))[_0xe4b2('0x8')](',\x20'));_0x57ec54['stop']();}else{logger[_0xe4b2('0x9')](_0xe4b2('0xa'),_0x1f01d9,_0x53f3d2['priority']);if(_0x53f3d2[_0xe4b2('0xb')]){var _0x1c2291=_[_0xe4b2('0xc')](_0x57ec54['rules'](),{'p':_0x53f3d2[_0xe4b2('0xb')]});if(_0x1c2291>=0x0){logger[_0xe4b2('0x9')](_0xe4b2('0xd'),_0x1f01d9,_0x53f3d2[_0xe4b2('0xb')]||_0xe4b2('0xe'),_0x1c2291);_0x57ec54['next'](_0x1c2291);}else{logger[_0xe4b2('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x1f01d9,_0x53f3d2[_0xe4b2('0xb')]||_0xe4b2('0xe'));_0x57ec54['stop']();}}else{_0x57ec54['next']();}}}catch(_0x449f46){logger[_0xe4b2('0xf')](_0xe4b2('0x5'),_0x1f01d9,JSON['stringify'](_0x449f46));_0x57ec54[_0xe4b2('0x10')]();}};}; \ 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 8b0788a..c23d059 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 _0xcc85=['stringify','stop','error','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','chat','upperFirst','channel','AccountId','account','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch'];(function(_0x34d1aa,_0x2e1799){var _0x11e755=function(_0x20f464){while(--_0x20f464){_0x34d1aa['push'](_0x34d1aa['shift']());}};_0x11e755(++_0x2e1799);}(_0xcc85,0x121));var _0x5cc8=function(_0x3e85a4,_0x18c3a9){_0x3e85a4=_0x3e85a4-0x0;var _0x21e7d1=_0xcc85[_0x3e85a4];return _0x21e7d1;};'use strict';var _=require('lodash');var utils=require(_0x5cc8('0x0'));var logger=require('../../../../config/logger')(_0x5cc8('0x1'));var rpc={'chatMessage':require(_0x5cc8('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5cc8('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x5cc8('0x4')),'whatsappMessage':require(_0x5cc8('0x5'))};exports['consequence']=function(_0x124fa6,_0x531039){return function(_0x576844){try{var _0x25a65d={'body':utils[_0x5cc8('0x6')](_0x531039[0x0],this),'ContactId':this[_0x5cc8('0x7')]['id']};if(this['channel']===_0x5cc8('0x8')){_0x25a65d['ChatWebsiteId']=this['account']['id'];}else{_0x25a65d[_[_0x5cc8('0x9')](this[_0x5cc8('0xa')])+_0x5cc8('0xb')]=this[_0x5cc8('0xc')]['id'];}_0x25a65d[_[_0x5cc8('0x9')](this['channel'])+_0x5cc8('0xd')]=this[_0x5cc8('0xe')]['id'];if(rpc[this[_0x5cc8('0xa')]+_0x5cc8('0xf')]){return rpc[this['channel']+'Message'][_0x5cc8('0x10')](_0x25a65d)[_0x5cc8('0x11')](function(_0x544f9f){logger[_0x5cc8('0x12')](_0x5cc8('0x13'),_0x124fa6,_0x25a65d[_0x5cc8('0x14')]);_0x576844[_0x5cc8('0x15')]();})[_0x5cc8('0x16')](function(_0x5d5ff0){logger['error'](_0x5cc8('0x13'),_0x124fa6,JSON[_0x5cc8('0x17')](_0x5d5ff0));_0x576844[_0x5cc8('0x18')]();});}}catch(_0x82486a){logger[_0x5cc8('0x19')](_0x5cc8('0x13'),_0x124fa6,JSON[_0x5cc8('0x17')](_0x82486a));_0x576844[_0x5cc8('0x18')]();}};}; \ No newline at end of file +var _0x6da9=['create','then','info','[%s][MESSAGE]\x20%s','next','catch','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','contact','channel','chat','AccountId','account','InteractionId','Message'];(function(_0x1a1b64,_0x2c81b3){var _0x2663b8=function(_0x29c950){while(--_0x29c950){_0x1a1b64['push'](_0x1a1b64['shift']());}};_0x2663b8(++_0x2c81b3);}(_0x6da9,0x161));var _0x96da=function(_0x266536,_0x1999dc){_0x266536=_0x266536-0x0;var _0x2c3e2b=_0x6da9[_0x266536];return _0x2c3e2b;};'use strict';var _=require(_0x96da('0x0'));var utils=require(_0x96da('0x1'));var logger=require(_0x96da('0x2'))(_0x96da('0x3'));var rpc={'chatMessage':require(_0x96da('0x4')),'openchannelMessage':require(_0x96da('0x5')),'mailMessage':require(_0x96da('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x96da('0x7')]=function(_0x3c8e0c,_0x26fdbb){return function(_0x5c4924){try{var _0x1bc4b0={'body':utils['getMustacheRender'](_0x26fdbb[0x0],this),'ContactId':this[_0x96da('0x8')]['id']};if(this[_0x96da('0x9')]===_0x96da('0xa')){_0x1bc4b0['ChatWebsiteId']=this['account']['id'];}else{_0x1bc4b0[_['upperFirst'](this[_0x96da('0x9')])+_0x96da('0xb')]=this[_0x96da('0xc')]['id'];}_0x1bc4b0[_['upperFirst'](this[_0x96da('0x9')])+_0x96da('0xd')]=this['interaction']['id'];if(rpc[this[_0x96da('0x9')]+_0x96da('0xe')]){return rpc[this[_0x96da('0x9')]+_0x96da('0xe')][_0x96da('0xf')](_0x1bc4b0)[_0x96da('0x10')](function(_0x2cdcdf){logger[_0x96da('0x11')](_0x96da('0x12'),_0x3c8e0c,_0x1bc4b0['body']);_0x5c4924[_0x96da('0x13')]();})[_0x96da('0x14')](function(_0x4807b7){logger['error'](_0x96da('0x12'),_0x3c8e0c,JSON[_0x96da('0x15')](_0x4807b7));_0x5c4924['stop']();});}}catch(_0x13f426){logger['error'](_0x96da('0x12'),_0x3c8e0c,JSON[_0x96da('0x15')](_0x13f426));_0x5c4924[_0x96da('0x16')]();}};}; \ 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 b312d46..cc8c4ef 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 _0x9a74=['routing','info','[%s][NOOP]\x20%s','getMustacheRender','error'];(function(_0x48c9dd,_0x3607d3){var _0x514c16=function(_0x47b28b){while(--_0x47b28b){_0x48c9dd['push'](_0x48c9dd['shift']());}};_0x514c16(++_0x3607d3);}(_0x9a74,0x168));var _0x49a7=function(_0x158898,_0x3c8809){_0x158898=_0x158898-0x0;var _0x1001b2=_0x9a74[_0x158898];return _0x1001b2;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x49a7('0x0'));exports['consequence']=function(_0x37f14e,_0x308c86){return function(_0x359d7e){try{logger[_0x49a7('0x1')](_0x49a7('0x2'),_0x37f14e,utils[_0x49a7('0x3')](_0x308c86[0x0],this));_0x359d7e['next']();}catch(_0x3d8528){logger[_0x49a7('0x4')](_0x49a7('0x2'),_0x37f14e,JSON['stringify'](_0x3d8528));_0x359d7e['stop']();}};}; \ No newline at end of file +var _0xc48c=['consequence','[%s][NOOP]\x20%s','next','stop','./utils','../../../../config/logger','routing'];(function(_0x2c6647,_0x394ea3){var _0x45b18d=function(_0x488a72){while(--_0x488a72){_0x2c6647['push'](_0x2c6647['shift']());}};_0x45b18d(++_0x394ea3);}(_0xc48c,0x74));var _0xcc48=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xc48c[_0x433a86];return _0x23000c;};'use strict';var utils=require(_0xcc48('0x0'));var logger=require(_0xcc48('0x1'))(_0xcc48('0x2'));exports[_0xcc48('0x3')]=function(_0x28b971,_0xa564b7){return function(_0x4082a3){try{logger['info'](_0xcc48('0x4'),_0x28b971,utils['getMustacheRender'](_0xa564b7[0x0],this));_0x4082a3[_0xcc48('0x5')]();}catch(_0x30fbd2){logger['error']('[%s][NOOP]\x20%s',_0x28b971,JSON['stringify'](_0x30fbd2));_0x4082a3[_0xcc48('0x6')]();}};}; \ 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 980e676..c362018 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 _0x65aa=['../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','accepted','info','Interaction','update','then','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','util','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','queue','joinAt','emit','queue_id','account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport'];(function(_0x45416a,_0x50d3ec){var _0x5c24f3=function(_0x902ad4){while(--_0x902ad4){_0x45416a['push'](_0x45416a['shift']());}};_0x5c24f3(++_0x50d3ec);}(_0x65aa,0x142));var _0xa65a=function(_0x1c0b20,_0x249b3e){_0x1c0b20=_0x1c0b20-0x0;var _0x58a367=_0x65aa[_0x1c0b20];return _0x58a367;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xa65a('0x0'));var seqqueue=require('seq-queue');var moment=require(_0xa65a('0x1'));var Redis=require(_0xa65a('0x2'));var config=require(_0xa65a('0x3'));var logger=require('../../../../config/logger')(_0xa65a('0x4'));var strategy=require(_0xa65a('0x5'));config[_0xa65a('0x6')]=_[_0xa65a('0x7')](config[_0xa65a('0x6')],{'host':_0xa65a('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa65a('0x6')]));var attributes=['id','queue_id','account',_0xa65a('0x9'),'from',_0xa65a('0xa')];function emit(_0x292452,_0x1217ce,_0x1b6b19){io['to'](_0x292452)[_0xa65a('0xb')](_0x1217ce,_0x1b6b19);}function emitChannelQueueInteraction(_0x339865,_0xf9d406,_0x443382,_0x35b7b6,_0x17c44f,_0x3a4638,_0x313c60,_0x1bc7a9){var _0x3af206=_['clone'](_0x443382);_0x3af206[_0xa65a('0xc')]=_0x1bc7a9;_0x3af206[_0xa65a('0x9')]=_0xf9d406;_0x3af206[_0xa65a('0xd')]=_0x35b7b6;_0x3af206['id']=_0x17c44f;if(_0x3a4638){attributes[_0xa65a('0xe')](_[_0xa65a('0xf')](_0x339865)+_0xa65a('0x10'));_0x313c60[util[_0xa65a('0x11')](_0xa65a('0x12'),_0x339865)][_0x17c44f]=_['pick'](_0x3af206,attributes);}else{delete _0x313c60[util[_0xa65a('0x11')](_0xa65a('0x12'),_0x339865)][_0x17c44f];}emit(util[_0xa65a('0x11')](_0xa65a('0x13'),_0x339865,_0xf9d406),util[_0xa65a('0x11')](_0xa65a('0x14'),_0x339865,_0x3a4638?_0xa65a('0x15'):_0xa65a('0x16')),_[_0xa65a('0x17')](_0x3af206,attributes));}var rpc={'openchannelQueueReport':require(_0xa65a('0x18')),'mailQueueReport':require(_0xa65a('0x19')),'chatQueueReport':require(_0xa65a('0x1a')),'smsQueueReport':require(_0xa65a('0x1b')),'faxQueueReport':require(_0xa65a('0x1c')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0xa65a('0x1d')),'mailInteraction':require(_0xa65a('0x1e')),'openchannelInteraction':require(_0xa65a('0x1f')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0xa65a('0x20'),'required':!![],'message':_0xa65a('0x21')},'timeout':{'type':_0xa65a('0x22'),'message':_0xa65a('0x23')}});function startRouting(_0x462a3e,_0x2d8583,_0x33d6b4,_0x11acc1){if(_0x462a3e&&_0x2d8583&&_0x33d6b4){_0x2d8583[_0xa65a('0x24')]+=0x1;var _0x182673={'uniqueid':_0x462a3e,'from':_0x33d6b4[_0xa65a('0x25')]?_0x33d6b4[_0xa65a('0x25')][_0xa65a('0x26')]:'','joinAt':moment()[_0xa65a('0x11')](_0xa65a('0x27')),'ContactId':_0x33d6b4[_0xa65a('0x28')]?_0x33d6b4[_0xa65a('0x28')]['id']:null,'ListId':_0x33d6b4[_0xa65a('0x29')]?_0x33d6b4['list']['id']:null};_0x182673[_['upperFirst'](_0x33d6b4[_0xa65a('0x2a')])+_0xa65a('0x2b')]=_0x2d8583['id']||null;_0x182673[_[_0xa65a('0x2c')](_0x33d6b4[_0xa65a('0x2a')])+'InteractionId']=_0x33d6b4[_0xa65a('0x2d')]?_0x33d6b4[_0xa65a('0x2d')]['id']:null;_0x182673[_[_0xa65a('0x2c')](_0x33d6b4[_0xa65a('0x2a')])+_0xa65a('0x2e')]=_0x33d6b4[_0xa65a('0x2f')]?_0x33d6b4['message']['id']:null;_0x182673[_[_0xa65a('0x2c')](_0x33d6b4['channel'])+(_0x33d6b4[_0xa65a('0x2a')]!==_0xa65a('0x30')?_0xa65a('0x31'):_0xa65a('0x32'))]=_0x33d6b4[_0xa65a('0xd')]?_0x33d6b4[_0xa65a('0xd')]['id']:null;logger['info'](util['format'](_0xa65a('0x33'),_0x462a3e,_0x2d8583[_0xa65a('0x34')]));emitChannelQueueInteraction(_0x33d6b4['channel'],_0x2d8583[_0xa65a('0x34')],_0x182673,_0x33d6b4[_0xa65a('0xd')][_0xa65a('0x34')],_0x33d6b4[_0xa65a('0x2f')]['id'],!![],_0x11acc1,_0x2d8583['id']);if(rpc[_0x33d6b4['channel']+'QueueReport']){return rpc[_0x33d6b4[_0xa65a('0x2a')]+_0xa65a('0x35')][_0xa65a('0x36')](_0x182673)['catch'](function(_0x3d4056){logger[_0xa65a('0x37')]('create\x20queue\x20report',_0x3d4056);});}}}function stopRouting(_0x210a8d,_0x2df86c,_0x207d56,_0x509c0a){if(_0x210a8d&&_0x2df86c){_0x2df86c[_0xa65a('0x24')]-=0x1;var _0x5521f6={'leaveAt':moment()[_0xa65a('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xa65a('0x11')](_0xa65a('0x27')),'reason':_0xa65a('0x38')};logger[_0xa65a('0x39')](util[_0xa65a('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x210a8d,_0x2df86c['name']));emitChannelQueueInteraction(_0x207d56['channel'],_0x2df86c[_0xa65a('0x34')],_0x207d56[_0xa65a('0x25')],_0x207d56[_0xa65a('0xd')][_0xa65a('0x34')],_0x207d56['message']['id'],![],_0x509c0a,_0x2df86c['id']);return rpc[_0x207d56[_0xa65a('0x2a')]+_0xa65a('0x3a')][_0xa65a('0x3b')](_0x207d56[_0xa65a('0x2d')]['id'],{'queueId':_0x2df86c['id']})[_0xa65a('0x3c')](function(){if(rpc[_0x207d56[_0xa65a('0x2a')]+'QueueReport']){return rpc[_0x207d56['channel']+'QueueReport'][_0xa65a('0x3b')](_0x210a8d,_0x5521f6)[_0xa65a('0x3d')](function(_0x5bdffe){logger[_0xa65a('0x37')](_0xa65a('0x3e'),_0x5bdffe);});}});}}function endRouting(_0x58314d,_0x49c234,_0x55daac,_0x9f7174){if(_0x58314d&&_0x49c234){_0x49c234[_0xa65a('0x24')]-=0x1;var _0x5ede66={'leaveAt':moment()['format'](_0xa65a('0x27')),'exitAt':moment()[_0xa65a('0x11')](_0xa65a('0x27')),'reason':_0xa65a('0x3f')};logger[_0xa65a('0x39')](util[_0xa65a('0x11')](_0xa65a('0x40'),_0x58314d,_0x49c234[_0xa65a('0x34')]));emitChannelQueueInteraction(_0x55daac['channel'],_0x49c234[_0xa65a('0x34')],_0x55daac['body'],_0x55daac[_0xa65a('0xd')][_0xa65a('0x34')],_0x55daac[_0xa65a('0x2f')]['id'],![],_0x9f7174);if(rpc[_0x55daac[_0xa65a('0x2a')]+_0xa65a('0x35')]){return rpc[_0x55daac[_0xa65a('0x2a')]+_0xa65a('0x35')][_0xa65a('0x3b')](_0x58314d,_0x5ede66)[_0xa65a('0x3d')](function(_0x4c2b92){logger[_0xa65a('0x37')]('update\x20queue\x20report',_0x4c2b92);});}}}function handleFindQueue(_0x5e08cd){return function(_0x56cc77){return _0x56cc77['name'][_0xa65a('0x41')]()===_0x5e08cd[_0xa65a('0x41')]();};}exports[_0xa65a('0x42')]=function(_0x4bcf66,_0x29a9c7,_0x2ff6e8,_0x28fe07){return function(_0xc0fa30){try{var _0x22a72e={'name':_0x29a9c7[0x0],'timeout':_0x29a9c7[0x1]};var _0x108d99=queue[_0xa65a('0x43')](_0x22a72e,{'typecast':!![]});if(_0x108d99[_0xa65a('0x44')]){logger[_0xa65a('0x37')](_0xa65a('0x45'),_0x4bcf66,_[_0xa65a('0x46')](_0x108d99,_0xa65a('0x2f'))[_0xa65a('0x47')](',\x20'));_0xc0fa30[_0xa65a('0x48')]();}else{var _0x337efa=_['find'](_0x2ff6e8[_0x28fe07['channel']+_0xa65a('0x49')],handleFindQueue(_0x22a72e['name']));if(_0x337efa){startRouting(_0x4bcf66,_0x337efa,_0x28fe07,_0x2ff6e8);var _0xd5618e=(_0x337efa['timeout']||0xa)*0x3e8;var _0x3f7222=(_0x22a72e['timeout']||0x14)*0x3e8;var _0x3ef89d;if(_0xd5618e>_0x3f7222){_0x3f7222=_0xd5618e;}var _0x5b2357=seqqueue[_0xa65a('0x4a')](_0xd5618e);_0x5b2357['id']=_0x4bcf66;_0x5b2357['atimeout']=_0xd5618e;_0x5b2357['qtimeout']=_0x3f7222;_0x5b2357[_0xa65a('0x2a')]=_0x28fe07['channel'];_0x2ff6e8[_0xa65a('0x4b')][_0x4bcf66]['on'](_0xa65a('0x4c'),function(){logger[_0xa65a('0x39')](_0xa65a('0x4d'),_0x4bcf66);stopRouting(_0x4bcf66,_0x337efa,_0x28fe07,_0x2ff6e8);clearTimeout(_0x3ef89d);_0x3ef89d=undefined;_0x5b2357[_0xa65a('0x4e')](!![]);if(_0x2ff6e8[_0xa65a('0x4b')][_0x4bcf66]){delete _0x2ff6e8[_0xa65a('0x4b')][_0x4bcf66];}_0xc0fa30[_0xa65a('0x48')]();});_0x2ff6e8[_0xa65a('0x4b')][_0x4bcf66]['on'](_0xa65a('0x4f'),function(){if(_0x2ff6e8[_0xa65a('0x4b')][_0x4bcf66]){delete _0x2ff6e8[_0xa65a('0x4b')][_0x4bcf66];}});_0x3ef89d=setTimeout(function(){logger[_0xa65a('0x39')](_0xa65a('0x50'),_0x4bcf66);endRouting(_0x4bcf66,_0x337efa,_0x28fe07,_0x2ff6e8);clearTimeout(_0x3ef89d);_0x5b2357['close'](!![]);_0xc0fa30[_0xa65a('0x51')]();},_0x3f7222);switch(_0x337efa[_0xa65a('0x52')]){case _0xa65a('0x53'):strategy[_0xa65a('0x53')](_0x5b2357,_0x337efa,_0x2ff6e8,_0x28fe07);break;default:strategy[_0xa65a('0x54')](_0x5b2357,_0x337efa,_0x2ff6e8,_0x28fe07);}}else{logger[_0xa65a('0x37')](_0xa65a('0x55'),_0x4bcf66,_0x22a72e['name']);_0xc0fa30[_0xa65a('0x48')]();}}}catch(_0x4e69dc){logger[_0xa65a('0x37')](_0xa65a('0x45'),_0x4bcf66,_0x4e69dc[_0xa65a('0x56')]);_0xc0fa30['stop']();}};}; \ No newline at end of file +var _0xb760=['validate','length','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','lodash','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','defaults','redis','queue_id','queue','from','joinAt','emit','push','capitalize','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../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','InteractionId','interaction','MessageId','message','chat','AccountId','account','info','name','QueueReport','create','catch','error','create\x20queue\x20report','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence'];(function(_0x38aa04,_0x2c8039){var _0x39bb22=function(_0x5b4e9a){while(--_0x5b4e9a){_0x38aa04['push'](_0x38aa04['shift']());}};_0x39bb22(++_0x2c8039);}(_0xb760,0x161));var _0x0b76=function(_0x506b76,_0x53a866){_0x506b76=_0x506b76-0x0;var _0x22afbf=_0xb760[_0x506b76];return _0x22afbf;};'use strict';var schema=require('validate');var _=require(_0x0b76('0x0'));var util=require('util');var seqqueue=require(_0x0b76('0x1'));var moment=require(_0x0b76('0x2'));var Redis=require('ioredis');var config=require(_0x0b76('0x3'));var logger=require(_0x0b76('0x4'))(_0x0b76('0x5'));var strategy=require('./strategy');config['redis']=_[_0x0b76('0x6')](config[_0x0b76('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0b76('0x7')]));var attributes=['id',_0x0b76('0x8'),'account',_0x0b76('0x9'),_0x0b76('0xa'),_0x0b76('0xb')];function emit(_0x175997,_0x10c3f7,_0x138816){io['to'](_0x175997)[_0x0b76('0xc')](_0x10c3f7,_0x138816);}function emitChannelQueueInteraction(_0x1a8007,_0x322b1b,_0x59bcb2,_0x1eb278,_0x57ba6d,_0x23e432,_0x4320c5,_0x11f61d){var _0xe65e16=_['clone'](_0x59bcb2);_0xe65e16[_0x0b76('0x8')]=_0x11f61d;_0xe65e16['queue']=_0x322b1b;_0xe65e16['account']=_0x1eb278;_0xe65e16['id']=_0x57ba6d;if(_0x23e432){attributes[_0x0b76('0xd')](_[_0x0b76('0xe')](_0x1a8007)+'InteractionId');_0x4320c5[util[_0x0b76('0xf')](_0x0b76('0x10'),_0x1a8007)][_0x57ba6d]=_[_0x0b76('0x11')](_0xe65e16,attributes);}else{delete _0x4320c5[util[_0x0b76('0xf')](_0x0b76('0x10'),_0x1a8007)][_0x57ba6d];}emit(util[_0x0b76('0xf')](_0x0b76('0x12'),_0x1a8007,_0x322b1b),util[_0x0b76('0xf')](_0x0b76('0x13'),_0x1a8007,_0x23e432?_0x0b76('0x14'):_0x0b76('0x15')),_[_0x0b76('0x11')](_0xe65e16,attributes));}var rpc={'openchannelQueueReport':require(_0x0b76('0x16')),'mailQueueReport':require(_0x0b76('0x17')),'chatQueueReport':require(_0x0b76('0x18')),'smsQueueReport':require(_0x0b76('0x19')),'faxQueueReport':require(_0x0b76('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x0b76('0x1b')),'faxInteraction':require(_0x0b76('0x1c')),'mailInteraction':require(_0x0b76('0x1d')),'openchannelInteraction':require(_0x0b76('0x1e')),'smsInteraction':require(_0x0b76('0x1f')),'whatsappInteraction':require(_0x0b76('0x20'))};var queue=schema({'name':{'type':_0x0b76('0x21'),'required':!![],'message':_0x0b76('0x22')},'timeout':{'type':_0x0b76('0x23'),'message':_0x0b76('0x24')}});function startRouting(_0x340873,_0x3ac8fc,_0x375da7,_0x29c8af){if(_0x340873&&_0x3ac8fc&&_0x375da7){_0x3ac8fc[_0x0b76('0x25')]+=0x1;var _0x5a1f35={'uniqueid':_0x340873,'from':_0x375da7['body']?_0x375da7[_0x0b76('0x26')][_0x0b76('0xa')]:'','joinAt':moment()['format'](_0x0b76('0x27')),'ContactId':_0x375da7[_0x0b76('0x28')]?_0x375da7[_0x0b76('0x28')]['id']:null,'ListId':_0x375da7['list']?_0x375da7[_0x0b76('0x29')]['id']:null};_0x5a1f35[_[_0x0b76('0x2a')](_0x375da7[_0x0b76('0x2b')])+_0x0b76('0x2c')]=_0x3ac8fc['id']||null;_0x5a1f35[_[_0x0b76('0x2a')](_0x375da7[_0x0b76('0x2b')])+_0x0b76('0x2d')]=_0x375da7[_0x0b76('0x2e')]?_0x375da7[_0x0b76('0x2e')]['id']:null;_0x5a1f35[_[_0x0b76('0x2a')](_0x375da7['channel'])+_0x0b76('0x2f')]=_0x375da7[_0x0b76('0x30')]?_0x375da7[_0x0b76('0x30')]['id']:null;_0x5a1f35[_[_0x0b76('0x2a')](_0x375da7[_0x0b76('0x2b')])+(_0x375da7[_0x0b76('0x2b')]!==_0x0b76('0x31')?_0x0b76('0x32'):'WebsiteId')]=_0x375da7[_0x0b76('0x33')]?_0x375da7[_0x0b76('0x33')]['id']:null;logger[_0x0b76('0x34')](util[_0x0b76('0xf')]('[%s][START:QUEUE][NAME:%s]',_0x340873,_0x3ac8fc[_0x0b76('0x35')]));emitChannelQueueInteraction(_0x375da7[_0x0b76('0x2b')],_0x3ac8fc['name'],_0x5a1f35,_0x375da7[_0x0b76('0x33')][_0x0b76('0x35')],_0x375da7[_0x0b76('0x30')]['id'],!![],_0x29c8af,_0x3ac8fc['id']);if(rpc[_0x375da7[_0x0b76('0x2b')]+'QueueReport']){return rpc[_0x375da7['channel']+_0x0b76('0x36')][_0x0b76('0x37')](_0x5a1f35)[_0x0b76('0x38')](function(_0x427bbc){logger[_0x0b76('0x39')](_0x0b76('0x3a'),_0x427bbc);});}}}function stopRouting(_0x18c70f,_0x2babd1,_0x3786a9,_0x40c397){if(_0x18c70f&&_0x2babd1){_0x2babd1[_0x0b76('0x25')]-=0x1;var _0x8143da={'leaveAt':moment()[_0x0b76('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x0b76('0xf')](_0x0b76('0x27')),'reason':'accepted'};logger[_0x0b76('0x34')](util[_0x0b76('0xf')]('[%s][STOP:QUEUE][NAME:%s]',_0x18c70f,_0x2babd1[_0x0b76('0x35')]));emitChannelQueueInteraction(_0x3786a9[_0x0b76('0x2b')],_0x2babd1['name'],_0x3786a9[_0x0b76('0x26')],_0x3786a9[_0x0b76('0x33')][_0x0b76('0x35')],_0x3786a9['message']['id'],![],_0x40c397,_0x2babd1['id']);return rpc[_0x3786a9['channel']+_0x0b76('0x3b')][_0x0b76('0x3c')](_0x3786a9[_0x0b76('0x2e')]['id'],{'queueId':_0x2babd1['id']})[_0x0b76('0x3d')](function(){if(rpc[_0x3786a9['channel']+_0x0b76('0x36')]){return rpc[_0x3786a9[_0x0b76('0x2b')]+_0x0b76('0x36')]['update'](_0x18c70f,_0x8143da)[_0x0b76('0x38')](function(_0x1221a7){logger[_0x0b76('0x39')](_0x0b76('0x3e'),_0x1221a7);});}});}}function endRouting(_0x1510da,_0x92cc9d,_0x2b1ff0,_0x114d08){if(_0x1510da&&_0x92cc9d){_0x92cc9d[_0x0b76('0x25')]-=0x1;var _0x258eac={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x0b76('0xf')](_0x0b76('0x27')),'reason':_0x0b76('0x3f')};logger[_0x0b76('0x34')](util[_0x0b76('0xf')](_0x0b76('0x40'),_0x1510da,_0x92cc9d[_0x0b76('0x35')]));emitChannelQueueInteraction(_0x2b1ff0['channel'],_0x92cc9d[_0x0b76('0x35')],_0x2b1ff0[_0x0b76('0x26')],_0x2b1ff0[_0x0b76('0x33')][_0x0b76('0x35')],_0x2b1ff0[_0x0b76('0x30')]['id'],![],_0x114d08);if(rpc[_0x2b1ff0[_0x0b76('0x2b')]+_0x0b76('0x36')]){return rpc[_0x2b1ff0[_0x0b76('0x2b')]+_0x0b76('0x36')][_0x0b76('0x3c')](_0x1510da,_0x258eac)['catch'](function(_0x49d9fd){logger[_0x0b76('0x39')](_0x0b76('0x3e'),_0x49d9fd);});}}}function handleFindQueue(_0x347df8){return function(_0x185b24){return _0x185b24[_0x0b76('0x35')][_0x0b76('0x41')]()===_0x347df8[_0x0b76('0x41')]();};}exports[_0x0b76('0x42')]=function(_0x9b5d10,_0x5c03f3,_0x432284,_0x55f79e){return function(_0xa16183){try{var _0x1bf7f7={'name':_0x5c03f3[0x0],'timeout':_0x5c03f3[0x1]};var _0x2e94b6=queue[_0x0b76('0x43')](_0x1bf7f7,{'typecast':!![]});if(_0x2e94b6[_0x0b76('0x44')]){logger[_0x0b76('0x39')](_0x0b76('0x45'),_0x9b5d10,_[_0x0b76('0x46')](_0x2e94b6,_0x0b76('0x30'))['join'](',\x20'));_0xa16183[_0x0b76('0x47')]();}else{var _0x2bd2c9=_['find'](_0x432284[_0x55f79e[_0x0b76('0x2b')]+_0x0b76('0x48')],handleFindQueue(_0x1bf7f7[_0x0b76('0x35')]));if(_0x2bd2c9){startRouting(_0x9b5d10,_0x2bd2c9,_0x55f79e,_0x432284);var _0x58730b=(_0x2bd2c9[_0x0b76('0x3f')]||0xa)*0x3e8;var _0x22b7ca=(_0x1bf7f7[_0x0b76('0x3f')]||0x14)*0x3e8;var _0x33b454;if(_0x58730b>_0x22b7ca){_0x22b7ca=_0x58730b;}var _0x22fc4d=seqqueue[_0x0b76('0x49')](_0x58730b);_0x22fc4d['id']=_0x9b5d10;_0x22fc4d['atimeout']=_0x58730b;_0x22fc4d[_0x0b76('0x4a')]=_0x22b7ca;_0x22fc4d['channel']=_0x55f79e['channel'];_0x432284[_0x0b76('0x4b')][_0x9b5d10]['on'](_0x0b76('0x4c'),function(){logger['info'](_0x0b76('0x4d'),_0x9b5d10);stopRouting(_0x9b5d10,_0x2bd2c9,_0x55f79e,_0x432284);clearTimeout(_0x33b454);_0x33b454=undefined;_0x22fc4d['close'](!![]);if(_0x432284['rules'][_0x9b5d10]){delete _0x432284[_0x0b76('0x4b')][_0x9b5d10];}_0xa16183[_0x0b76('0x47')]();});_0x432284[_0x0b76('0x4b')][_0x9b5d10]['on'](_0x0b76('0x4e'),function(){if(_0x432284['rules'][_0x9b5d10]){delete _0x432284[_0x0b76('0x4b')][_0x9b5d10];}});_0x33b454=setTimeout(function(){logger[_0x0b76('0x34')](_0x0b76('0x4f'),_0x9b5d10);endRouting(_0x9b5d10,_0x2bd2c9,_0x55f79e,_0x432284);clearTimeout(_0x33b454);_0x22fc4d[_0x0b76('0x50')](!![]);_0xa16183[_0x0b76('0x51')]();},_0x22b7ca);switch(_0x2bd2c9[_0x0b76('0x52')]){case _0x0b76('0x53'):strategy[_0x0b76('0x53')](_0x22fc4d,_0x2bd2c9,_0x432284,_0x55f79e);break;default:strategy['beepall'](_0x22fc4d,_0x2bd2c9,_0x432284,_0x55f79e);}}else{logger[_0x0b76('0x39')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x9b5d10,_0x1bf7f7[_0x0b76('0x35')]);_0xa16183[_0x0b76('0x47')]();}}}catch(_0x32521e){logger['error'](_0x0b76('0x45'),_0x9b5d10,_0x32521e['stack']);_0xa16183[_0x0b76('0x47')]();}};}; \ 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 923dcf2..38fa875 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 _0xb821=['squeue','agent','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime','channel','agents','busy','busyQueue','saveWaitingNotification','showNotification','forcedOwnership',':FORCED','debug','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','STOP','TIMEOUT','exports','uuid','./util','notificationId'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb821,0xa7));var _0x1b82=function(_0x358f81,_0x445e75){_0x358f81=_0x358f81-0x0;var _0x206e91=_0xb821[_0x358f81];return _0x206e91;};'use strict';var _=require('lodash');var uuid=require(_0x1b82('0x0'));var util=require(_0x1b82('0x1'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0xbab478,_0x578a10,_0x4b1809,_0x3b1d14){this[_0x1b82('0x2')]=uuid['v4']();this[_0x1b82('0x3')]=_0xbab478;this[_0x1b82('0x4')]=_0x578a10;this['realtime']=_0x4b1809;this[_0x1b82('0x5')]=_0x3b1d14;this[_0x1b82('0x3')][_0x1b82('0x6')](this[_0x1b82('0x7')][_0x1b82('0x8')](this),this[_0x1b82('0x9')][_0x1b82('0x8')](this));this[_0x1b82('0x3')]['on'](_0x1b82('0xa'),this['handleTimeout'][_0x1b82('0x8')](this));this[_0x1b82('0x3')]['on'](_0x1b82('0xb'),this[_0x1b82('0xc')][_0x1b82('0x8')](this));};Agent[_0x1b82('0xd')][_0x1b82('0x6')]=function(){this[_0x1b82('0x3')]['push'](this[_0x1b82('0x7')][_0x1b82('0x8')](this),this[_0x1b82('0x9')][_0x1b82('0x8')](this));};Agent['prototype'][_0x1b82('0xc')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x1b82('0x7')]=function(){logger['debug'](_0x1b82('0xe'),this[_0x1b82('0x3')]['id'],this['agent']['id']);if(_[_0x1b82('0xf')](this['realtime']['agents'][this[_0x1b82('0x4')]['id']])){logger['debug'](_0x1b82('0x10'),this[_0x1b82('0x3')]['id'],this[_0x1b82('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0x1b82('0x5')]['forcedOwnership']||util[_0x1b82('0x11')](this[_0x1b82('0x3')]['id'],this[_0x1b82('0x12')]['agents'][this[_0x1b82('0x4')]['id']],this[_0x1b82('0x3')][_0x1b82('0x13')],![])){this[_0x1b82('0x12')][_0x1b82('0x14')][this['agent']['id']][_0x1b82('0x15')]=!![];this[_0x1b82('0x12')][_0x1b82('0x14')][this[_0x1b82('0x4')]['id']][_0x1b82('0x16')]=undefined;util[_0x1b82('0x17')](this[_0x1b82('0x12')],this['routing'],this[_0x1b82('0x4')],this[_0x1b82('0x3')]['channel']);util[_0x1b82('0x18')](this[_0x1b82('0x2')],this[_0x1b82('0x3')]['id'],this['realtime'][_0x1b82('0x14')][this['agent']['id']],null,this['routing']);util['writeLog'](this[_0x1b82('0x3')]['id'],this[_0x1b82('0x12')][_0x1b82('0x14')][this[_0x1b82('0x4')]['id']],'RINGING'+(this[_0x1b82('0x5')][_0x1b82('0x19')]?_0x1b82('0x1a'):''));}else{logger[_0x1b82('0x1b')](_0x1b82('0x1c'),this[_0x1b82('0x3')]['id'],this[_0x1b82('0x4')]['id']);setTimeout(this[_0x1b82('0x6')][_0x1b82('0x8')](this),0x3e8);}}};Agent[_0x1b82('0xd')][_0x1b82('0x9')]=function(_0x37275f){if(_[_0x1b82('0xf')](this['realtime'][_0x1b82('0x14')][this[_0x1b82('0x4')]['id']])){return logger[_0x1b82('0x1b')](_0x1b82('0x10'),this[_0x1b82('0x3')]['id'],this[_0x1b82('0x4')]['id']);}else{logger[_0x1b82('0x1b')](_0x1b82('0x1d'),this[_0x1b82('0x3')]['id'],this[_0x1b82('0x4')]['id']);util['hideNotification'](this[_0x1b82('0x2')],this[_0x1b82('0x3')]['id'],this[_0x1b82('0x12')][_0x1b82('0x14')][this['agent']['id']],null,this[_0x1b82('0x5')]);this[_0x1b82('0x12')]['agents'][this[_0x1b82('0x4')]['id']][_0x1b82('0x15')]=![];this[_0x1b82('0x12')]['agents'][this['agent']['id']][_0x1b82('0x16')]=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x1b82('0x5')],this[_0x1b82('0x4')],this[_0x1b82('0x3')]['channel']);util[_0x1b82('0x1e')](this[_0x1b82('0x3')]['id'],this[_0x1b82('0x12')][_0x1b82('0x14')][this['agent']['id']],_0x37275f?_0x1b82('0x1f'):_0x1b82('0x20'));}if(!_0x37275f){setTimeout(this[_0x1b82('0x6')]['bind'](this),0x3e8);}};function agent(_0x48fd54,_0x21e859,_0x5d7e6a,_0x1d3e68){return new Agent(_0x48fd54,_0x21e859,_0x5d7e6a,_0x1d3e68);}module[_0x1b82('0x21')]=agent; \ No newline at end of file +var _0x7a2c=['squeue','isNil','agents','forcedOwnership','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','channel','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','agent','realtime','handleRun','bind','handleTimeout','timeout','drained','prototype','push','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x16ccc2,_0x10d9b7){var _0x2b54d0=function(_0x2453a5){while(--_0x2453a5){_0x16ccc2['push'](_0x16ccc2['shift']());}};_0x2b54d0(++_0x10d9b7);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x392c75,_0x574216){_0x392c75=_0x392c75-0x0;var _0x4521fc=_0x7a2c[_0x392c75];return _0x4521fc;};'use strict';var _=require(_0xc7a2('0x0'));var uuid=require('uuid');var util=require(_0xc7a2('0x1'));var logger=require(_0xc7a2('0x2'))(_0xc7a2('0x3'));var Agent=function(_0x26fb61,_0x44d702,_0x2abba8,_0x3f2b0d){this[_0xc7a2('0x4')]=uuid['v4']();this['squeue']=_0x26fb61;this[_0xc7a2('0x5')]=_0x44d702;this[_0xc7a2('0x6')]=_0x2abba8;this['routing']=_0x3f2b0d;this['squeue']['push'](this[_0xc7a2('0x7')][_0xc7a2('0x8')](this),this[_0xc7a2('0x9')][_0xc7a2('0x8')](this));this['squeue']['on'](_0xc7a2('0xa'),this[_0xc7a2('0x9')][_0xc7a2('0x8')](this));this['squeue']['on'](_0xc7a2('0xb'),this['handleDrained'][_0xc7a2('0x8')](this));};Agent[_0xc7a2('0xc')][_0xc7a2('0xd')]=function(){this['squeue'][_0xc7a2('0xd')](this[_0xc7a2('0x7')][_0xc7a2('0x8')](this),this['handleTimeout'][_0xc7a2('0x8')](this));};Agent[_0xc7a2('0xc')][_0xc7a2('0xe')]=function(){this[_0xc7a2('0x9')](!![]);};Agent[_0xc7a2('0xc')][_0xc7a2('0x7')]=function(){logger[_0xc7a2('0xf')](_0xc7a2('0x10'),this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x5')]['id']);if(_[_0xc7a2('0x12')](this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']])){logger[_0xc7a2('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc7a2('0x11')]['id'],this['agent']['id']);setTimeout(this[_0xc7a2('0xd')][_0xc7a2('0x8')](this),0x3e8);}else{if(this[_0xc7a2('0x3')][_0xc7a2('0x14')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],this['squeue']['channel'],![])){this[_0xc7a2('0x6')]['agents'][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x15')]=!![];this['realtime'][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x16')]=undefined;util[_0xc7a2('0x17')](this[_0xc7a2('0x6')],this[_0xc7a2('0x3')],this[_0xc7a2('0x5')],this['squeue']['channel']);util[_0xc7a2('0x18')](this[_0xc7a2('0x4')],this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']],null,this[_0xc7a2('0x3')]);util[_0xc7a2('0x19')](this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],_0xc7a2('0x1a')+(this['routing'][_0xc7a2('0x14')]?':FORCED':''));}else{logger[_0xc7a2('0xf')](_0xc7a2('0x1b'),this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x5')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xc7a2('0xc')][_0xc7a2('0x9')]=function(_0x272c6b){if(_[_0xc7a2('0x12')](this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']])){return logger['debug'](_0xc7a2('0x1c'),this[_0xc7a2('0x11')]['id'],this['agent']['id']);}else{logger[_0xc7a2('0xf')](_0xc7a2('0x1d'),this[_0xc7a2('0x11')]['id'],this['agent']['id']);util[_0xc7a2('0x1e')](this['notificationId'],this[_0xc7a2('0x11')]['id'],this['realtime']['agents'][this[_0xc7a2('0x5')]['id']],null,this['routing']);this['realtime'][_0xc7a2('0x13')][this['agent']['id']][_0xc7a2('0x15')]=![];this['realtime'][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x16')]=undefined;util[_0xc7a2('0x1f')](this[_0xc7a2('0x6')],this[_0xc7a2('0x3')],this[_0xc7a2('0x5')],this[_0xc7a2('0x11')][_0xc7a2('0x20')]);util[_0xc7a2('0x19')](this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],_0x272c6b?_0xc7a2('0x21'):_0xc7a2('0x22'));}if(!_0x272c6b){setTimeout(this[_0xc7a2('0xd')][_0xc7a2('0x8')](this),0x3e8);}};function agent(_0x178c3e,_0x46a665,_0x3a7845,_0x4972a4){return new Agent(_0x178c3e,_0x46a665,_0x3a7845,_0x4972a4);}module[_0xc7a2('0x23')]=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 b58d71a..0c47497 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 _0x3ec5=['bind','drained','prototype','isNil','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','agents','RINGING','busyQueue','name','saveWaitingNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','removeWaitingNotification','exports','lodash','./util','routing','notificationId','squeue','queue','realtime','push','handleRun','handleTimeout','timeout'];(function(_0x521915,_0x2fc457){var _0x4e06b9=function(_0x4c240d){while(--_0x4c240d){_0x521915['push'](_0x521915['shift']());}};_0x4e06b9(++_0x2fc457);}(_0x3ec5,0xa4));var _0x53ec=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3ec5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x53ec('0x0'));var uuid=require('uuid');var util=require(_0x53ec('0x1'));var logger=require('../../../../../config/logger')(_0x53ec('0x2'));var Beepall=function(_0x4eff54,_0x15141e,_0xd57be0,_0x28e71e){this[_0x53ec('0x3')]=uuid['v4']();this[_0x53ec('0x4')]=_0x4eff54;this[_0x53ec('0x5')]=_0x15141e;this[_0x53ec('0x6')]=_0xd57be0;this[_0x53ec('0x2')]=_0x28e71e;this[_0x53ec('0x4')][_0x53ec('0x7')](this[_0x53ec('0x8')]['bind'](this),this[_0x53ec('0x9')]['bind'](this));this[_0x53ec('0x4')]['on'](_0x53ec('0xa'),this[_0x53ec('0x9')][_0x53ec('0xb')](this));this['squeue']['on'](_0x53ec('0xc'),this['handleDrained'][_0x53ec('0xb')](this));};Beepall['prototype']['push']=function(){this[_0x53ec('0x4')][_0x53ec('0x7')](this[_0x53ec('0x8')]['bind'](this),this[_0x53ec('0x9')][_0x53ec('0xb')](this));};Beepall['prototype']['handleDrained']=function(){this[_0x53ec('0x9')](!![]);};Beepall[_0x53ec('0xd')]['handleRun']=function(){var _0x4111d0=!![];if(!_[_0x53ec('0xe')](this[_0x53ec('0x5')])&&!_[_0x53ec('0xe')](this['queue'][_0x53ec('0xf')])&&this[_0x53ec('0x5')]['Agents'][_0x53ec('0x10')]>0x0){for(var _0x31af16=0x0,_0x3f7fba;_0x31af160x0){for(var _0x2e73b4=0x0,_0xb3c254;_0x2e73b40x0&&_0x5a31d6[_0x28e1fb+_0x53af('0x23')]>=_0x5a31d6[_0x28e1fb+_0x53af('0x21')]){writeLog(_0x37ecb3,_0x5a31d6,_0x28e1fb['toUpperCase']()+_0x53af('0x24'));return![];}}return!![];};exports[_0x53af('0x25')]=function(_0x26a0cf,_0x2b232c,_0x480665,_0x27dbd9,_0x17d47d){return sendNotification(!![],_0x26a0cf,_0x2b232c,_0x480665,_0x27dbd9,_0x17d47d);};exports[_0x53af('0x26')]=function(_0x530e3c,_0x1db2fc,_0x152dcc,_0x474d5f,_0x20449f){return sendNotification(![],_0x530e3c,_0x1db2fc,_0x152dcc,_0x474d5f,_0x20449f);};exports['checkWaitingNotifications']=function(_0x808023,_0x1ec47c,_0xc9b0df){var _0x2c27ba=_0x1ec47c[_0x53af('0x27')][_0x53af('0x28')];if(!_0x2c27ba&&_0xc9b0df){_0x2c27ba=_0xc9b0df['id'];}var _0x154cc2=_['some'](_0x808023[_0x1ec47c['channel']+_0x53af('0x29')],function(_0x490f70){var _0x308819=_[_0x53af('0x2a')](_0x1ec47c[_0x53af('0x2b')])+_0x53af('0x2c');return _0x490f70[_0x308819]===_0x1ec47c['interaction']['id'];});if(!_0x154cc2&&_0x2c27ba&&_0x808023[_0x53af('0x2d')][_0x2c27ba]){_0x154cc2=_[_0x53af('0x2e')](_0x808023['agents'][_0x2c27ba][_0x1ec47c['channel']+_0x53af('0x2f')],function(_0x1fa69c){return _0x1fa69c['id']===_0x1ec47c[_0x53af('0x27')]['id'];});}return _0x154cc2;};exports[_0x53af('0x30')]=function(_0x505003,_0x4ff785,_0x3b7ad0,_0x30e609){if(_0x3b7ad0&&_0x3b7ad0['id']&&_0x505003[_0x53af('0x2d')]&&_0x505003['agents'][_0x3b7ad0['id']]){_0x505003['agents'][_0x3b7ad0['id']][_0x30e609+_0x53af('0x2f')][_0x4ff785[_0x53af('0x31')]['id']]={'id':_0x4ff785[_0x53af('0x27')]['id']};}};exports[_0x53af('0x32')]=function(_0x44e1c4,_0x98e868,_0x34fcb4,_0x4d7741){if(_0x34fcb4&&_0x34fcb4['id']&&_0x44e1c4[_0x53af('0x2d')]&&_0x44e1c4[_0x53af('0x2d')][_0x34fcb4['id']]){delete _0x44e1c4['agents'][_0x34fcb4['id']][_0x4d7741+_0x53af('0x2f')][_0x98e868[_0x53af('0x31')]['id']];}};exports[_0x53af('0x33')]=writeLog; \ No newline at end of file +var _0xde80=['[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','interaction','UserId','some','channel','QueuesWaitingInteractions','InteractionId','WaitingInteractions','saveWaitingNotification','agents','message','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','split','name','account','queue','body','getMustacheRender','notificationTemplate','error','format','[%s][QUEUE]\x20%s','emit','notification:%s','save','remove','debug'];(function(_0x448fcd,_0x1c5e41){var _0x6976ca=function(_0x43db37){while(--_0x43db37){_0x448fcd['push'](_0x448fcd['shift']());}};_0x6976ca(++_0x1c5e41);}(_0xde80,0x1d1));var _0x0de8=function(_0x5e323e,_0x2235de){_0x5e323e=_0x5e323e-0x0;var _0x3336eb=_0xde80[_0x5e323e];return _0x3336eb;};'use strict';var _=require(_0x0de8('0x0'));var util=require(_0x0de8('0x1'));var utils=require(_0x0de8('0x2'));var Redis=require(_0x0de8('0x3'));var config=require(_0x0de8('0x4'));var logger=require(_0x0de8('0x5'))(_0x0de8('0x6'));config[_0x0de8('0x7')]=_[_0x0de8('0x8')](config[_0x0de8('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x0de8('0x9'))(new Redis(config[_0x0de8('0x7')]));function sendNotification(_0x2ad29b,_0x4d8be0,_0x1d9e47,_0x3b98b1,_0x131f53,_0x46f7bb){var _0x22ea67=_0x46f7bb||{};var _0x3db352=_0x1d9e47[_0x0de8('0xa')]('.');var _0x3750c7={'uniqueid':_0x4d8be0,'channel':_0x3db352[0x0],'id':_0x3db352[0x1],'title':_0x3db352[0x0]+'\x20interaction','interactionId':_0x3db352[0x2],'queue':_0x131f53?_0x131f53[_0x0de8('0xb')]:null,'sound':_0x22ea67[_0x0de8('0xc')]['notificationSound'],'shake':_0x22ea67['account']['notificationShake']};try{if(!_0x22ea67['body']){_0x22ea67['body']={};}if(_0x131f53){_0x22ea67['body'][_0x0de8('0xd')]=_0x131f53;}else if(_0x22ea67[_0x0de8('0xe')]['queue']){delete _0x22ea67[_0x0de8('0xe')][_0x0de8('0xd')];}_0x3750c7['msg']=utils[_0x0de8('0xf')](_0x22ea67['account'][_0x0de8('0x10')],_0x22ea67);}catch(_0x6a9b24){_0x3750c7['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0x0de8('0x11')](util[_0x0de8('0x12')](_0x0de8('0x13'),_0x4d8be0,_0x6a9b24['message']));}io['to'](util[_0x0de8('0x12')]('user:%s',_0x3b98b1[_0x0de8('0xb')]))[_0x0de8('0x14')](util[_0x0de8('0x12')](_0x0de8('0x15'),_0x2ad29b?_0x0de8('0x16'):_0x0de8('0x17')),_0x3750c7);}function writeLog(_0x2171ec,_0x1e0201,_0x11e976){return logger[_0x0de8('0x18')](util[_0x0de8('0x12')](_0x0de8('0x19'),_0x2171ec,_0x1e0201[_0x0de8('0xb')],_0x11e976));}exports[_0x0de8('0x1a')]=function(_0x1d331f,_0x480f50,_0x3baa4,_0x56dd7f){if(_0x480f50[_0x0de8('0x1b')]){writeLog(_0x1d331f,_0x480f50,'BUSY');return![];}if(!_0x480f50[_0x0de8('0x1c')]){writeLog(_0x1d331f,_0x480f50,'OFFLINE');return![];}if(_0x480f50[_0x3baa4+_0x0de8('0x1d')]){writeLog(_0x1d331f,_0x480f50,_0x0de8('0x1e'));return![];}if(_0x56dd7f&&_0x480f50[_0x0de8('0x1f')](_0x3baa4+_0x0de8('0x20'))&&_0x480f50[_0x0de8('0x1f')](_0x3baa4+_0x0de8('0x21'))){if(_0x480f50[_0x3baa4+_0x0de8('0x20')]>0x0&&_0x480f50[_0x3baa4+'CurrentCapacity']>=_0x480f50[_0x3baa4+_0x0de8('0x20')]){writeLog(_0x1d331f,_0x480f50,_0x3baa4[_0x0de8('0x22')]()+_0x0de8('0x23'));return![];}}return!![];};exports['showNotification']=function(_0x1419d5,_0x10563a,_0x183e35,_0x35ca6f,_0xf88730){return sendNotification(!![],_0x1419d5,_0x10563a,_0x183e35,_0x35ca6f,_0xf88730);};exports[_0x0de8('0x24')]=function(_0x3bf5bb,_0x185f04,_0x313cb8,_0x38d63d,_0x47c97c){return sendNotification(![],_0x3bf5bb,_0x185f04,_0x313cb8,_0x38d63d,_0x47c97c);};exports['checkWaitingNotifications']=function(_0x460fad,_0x434627,_0x260325){var _0x5a41a5=_0x434627[_0x0de8('0x25')][_0x0de8('0x26')];if(!_0x5a41a5&&_0x260325){_0x5a41a5=_0x260325['id'];}var _0x1e3509=_[_0x0de8('0x27')](_0x460fad[_0x434627[_0x0de8('0x28')]+_0x0de8('0x29')],function(_0x45d1ef){var _0x13a5df=_['capitalize'](_0x434627[_0x0de8('0x28')])+_0x0de8('0x2a');return _0x45d1ef[_0x13a5df]===_0x434627[_0x0de8('0x25')]['id'];});if(!_0x1e3509&&_0x5a41a5&&_0x460fad['agents'][_0x5a41a5]){_0x1e3509=_['some'](_0x460fad['agents'][_0x5a41a5][_0x434627[_0x0de8('0x28')]+_0x0de8('0x2b')],function(_0x1861a5){return _0x1861a5['id']===_0x434627[_0x0de8('0x25')]['id'];});}return _0x1e3509;};exports[_0x0de8('0x2c')]=function(_0x206aed,_0x4045b2,_0x4591d7,_0x306545){if(_0x4591d7&&_0x4591d7['id']&&_0x206aed[_0x0de8('0x2d')]&&_0x206aed['agents'][_0x4591d7['id']]){_0x206aed[_0x0de8('0x2d')][_0x4591d7['id']][_0x306545+_0x0de8('0x2b')][_0x4045b2[_0x0de8('0x2e')]['id']]={'id':_0x4045b2['interaction']['id']};}};exports[_0x0de8('0x2f')]=function(_0x1a0a6a,_0x3a7e87,_0x4e2bf4,_0x492536){if(_0x4e2bf4&&_0x4e2bf4['id']&&_0x1a0a6a[_0x0de8('0x2d')]&&_0x1a0a6a[_0x0de8('0x2d')][_0x4e2bf4['id']]){delete _0x1a0a6a[_0x0de8('0x2d')][_0x4e2bf4['id']][_0x492536+_0x0de8('0x2b')][_0x3a7e87[_0x0de8('0x2e')]['id']];}};exports[_0x0de8('0x30')]=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 931af62..57b9b58 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 _0x8666=['validate','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','./utils','../../../../config/logger','routing','string','consequence'];(function(_0x407107,_0x791532){var _0xdcbde=function(_0x30b5d7){while(--_0x30b5d7){_0x407107['push'](_0x407107['shift']());}};_0xdcbde(++_0x791532);}(_0x8666,0x174));var _0x6866=function(_0x22d9a2,_0x4ebdf1){_0x22d9a2=_0x22d9a2-0x0;var _0x25877e=_0x8666[_0x22d9a2];return _0x25877e;};'use strict';var schema=require('validate');var sh=require(_0x6866('0x0'));var _=require('lodash');var utils=require(_0x6866('0x1'));var logger=require(_0x6866('0x2'))(_0x6866('0x3'));var system=schema({'command':{'type':_0x6866('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x6866('0x5')]=function(_0x1b4fe9,_0x466fe2){return function(_0x400e38){try{var _0x39dfb2={'command':_0x466fe2[0x0]};var _0x43f7af=system[_0x6866('0x6')](_0x39dfb2,{'typecast':!![]});if(_0x43f7af[_0x6866('0x7')]){logger[_0x6866('0x8')](_0x6866('0x9'),_0x1b4fe9,_['map'](_0x43f7af,_0x6866('0xa'))[_0x6866('0xb')](',\x20'));logger[_0x6866('0xc')](_0x6866('0xd'),_0x1b4fe9);_0x400e38[_0x6866('0xe')]();}else{var _0x3c5536=this;var _0x16b6e5=utils[_0x6866('0xf')](_0x466fe2[0x0],this);logger[_0x6866('0xc')](_0x6866('0x10'),_0x1b4fe9,_0x16b6e5);sh[_0x6866('0x11')](_['trim'](_0x16b6e5),function(_0xbea7ee,_0x4632f3){logger[_0x6866('0xc')](_0x6866('0x12'),_0x1b4fe9,_0xbea7ee);if(_0xbea7ee==0x0){var _0x312ee1=_0x4632f3[_0x6866('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x6866('0x14')](_0x466fe2[0x1])||_[_0x6866('0x15')](_0x466fe2[0x1])){logger[_0x6866('0xc')](_0x6866('0x16'),_0x1b4fe9);_0x3c5536[_0x6866('0x17')][_0x466fe2[0x1]]=_0x312ee1;}else{logger[_0x6866('0xc')](_0x6866('0x18'),_0x1b4fe9,_0x466fe2[0x1],_0x312ee1);_0x3c5536['body'][_0x466fe2[0x1]]=_0x312ee1;}}_0x400e38['next']();});}}catch(_0x2769b4){logger[_0x6866('0x8')](_0x6866('0x9'),_0x1b4fe9,_[_0x6866('0x19')](_0x2769b4)?JSON[_0x6866('0x1a')](_0x2769b4):_0x2769b4);logger[_0x6866('0xc')](_0x6866('0xd'),_0x1b4fe9);_0x400e38['next']();}};}; \ No newline at end of file +var _0x1fec=['trim','replace','isNil','body','isObject','stringify','next','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x5c42de,_0x3af522){var _0x267626=function(_0x431fc2){while(--_0x431fc2){_0x5c42de['push'](_0x5c42de['shift']());}};_0x267626(++_0x3af522);}(_0x1fec,0x1ea));var _0xc1fe=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x1fec[_0x2ec461];return _0x28603d;};'use strict';var schema=require('validate');var sh=require(_0xc1fe('0x0'));var _=require(_0xc1fe('0x1'));var utils=require(_0xc1fe('0x2'));var logger=require(_0xc1fe('0x3'))(_0xc1fe('0x4'));var system=schema({'command':{'type':_0xc1fe('0x5'),'required':!![],'message':_0xc1fe('0x6')}});exports[_0xc1fe('0x7')]=function(_0x4d2952,_0x39f5e5){return function(_0x57be1a){try{var _0x5aef62={'command':_0x39f5e5[0x0]};var _0x25ec9a=system[_0xc1fe('0x8')](_0x5aef62,{'typecast':!![]});if(_0x25ec9a[_0xc1fe('0x9')]){logger[_0xc1fe('0xa')]('[%s][SYSTEM]\x20%s',_0x4d2952,_[_0xc1fe('0xb')](_0x25ec9a,'message')['join'](',\x20'));logger[_0xc1fe('0xc')](_0xc1fe('0xd'),_0x4d2952);_0x57be1a['next']();}else{var _0x34b8de=this;var _0xb2f813=utils[_0xc1fe('0xe')](_0x39f5e5[0x0],this);logger[_0xc1fe('0xc')](_0xc1fe('0xf'),_0x4d2952,_0xb2f813);sh['exec'](_[_0xc1fe('0x10')](_0xb2f813),function(_0x5b5658,_0x343703){logger[_0xc1fe('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x4d2952,_0x5b5658);if(_0x5b5658==0x0){var _0x5e13ea=_0x343703[_0xc1fe('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xc1fe('0x12')](_0x39f5e5[0x1])||_['isEmpty'](_0x39f5e5[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x4d2952);_0x34b8de[_0xc1fe('0x13')][_0x39f5e5[0x1]]=_0x5e13ea;}else{logger[_0xc1fe('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x4d2952,_0x39f5e5[0x1],_0x5e13ea);_0x34b8de['body'][_0x39f5e5[0x1]]=_0x5e13ea;}}_0x57be1a['next']();});}}catch(_0x48bed5){logger['error']('[%s][SYSTEM]\x20%s',_0x4d2952,_[_0xc1fe('0x14')](_0x48bed5)?JSON[_0xc1fe('0x15')](_0x48bed5):_0x48bed5);logger[_0xc1fe('0xc')](_0xc1fe('0xd'),_0x4d2952);_0x57be1a[_0xc1fe('0x16')]();}};}; \ 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 b8af579..dcc660f 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 _0x81d8=['../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction'];(function(_0x4adc21,_0x55f004){var _0x278123=function(_0x1a9321){while(--_0x1a9321){_0x4adc21['push'](_0x4adc21['shift']());}};_0x278123(++_0x55f004);}(_0x81d8,0xd2));var _0x881d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81d8[_0x14add3];return _0x4a174f;};'use strict';var schema=require(_0x881d('0x0'));var _=require(_0x881d('0x1'));var rpc={'chatInteraction':require(_0x881d('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x881d('0x3')),'mailInteraction':require(_0x881d('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x881d('0x5'))};var logger=require(_0x881d('0x6'))('routing');var tag=schema({'tag':{'type':_0x881d('0x7'),'required':!![],'message':_0x881d('0x8')}});exports['consequence']=function(_0x1a8ae9,_0x2b4c63,_0x2fe88,_0x5cde54){return function(_0x348360){try{var _0x159e53={'tag':_0x2b4c63[0x0]};var _0x1aab94=tag[_0x881d('0x0')](_0x159e53,{'typecast':!![]});if(_0x1aab94[_0x881d('0x9')]){logger[_0x881d('0xa')](_0x881d('0xb'),_0x1a8ae9,_['map'](_0x1aab94,'message')['join'](',\x20'));logger[_0x881d('0xc')](_0x881d('0xd'),_0x1a8ae9);_0x348360[_0x881d('0xe')]();}else{var _0x44d80c={'ids':[_0x2b4c63[0x0]]};if(rpc[_0x5cde54['channel']+'Interaction']){rpc[_0x5cde54[_0x881d('0xf')]+_0x881d('0x10')][_0x881d('0x11')](_0x5cde54[_0x881d('0x12')]['id'],_0x44d80c)['then'](function(_0xdfea22){logger['info'](_0x881d('0x13'),_0x1a8ae9,_0x2b4c63[0x1],_0x5cde54['channel'],_0x5cde54[_0x881d('0x12')]['id']);})[_0x881d('0x14')](function(_0x36a4e3){logger[_0x881d('0xa')](_0x881d('0xb'),_0x1a8ae9,JSON[_0x881d('0x15')](_0x36a4e3));logger[_0x881d('0xc')](_0x881d('0xd'),_0x1a8ae9);})[_0x881d('0x16')](function(){_0x348360[_0x881d('0xe')]();});}}}catch(_0x36a6f6){logger[_0x881d('0xa')](_0x881d('0xb'),_0x1a8ae9,_[_0x881d('0x17')](_0x36a6f6)?JSON[_0x881d('0x15')](_0x36a6f6):_0x36a6f6);logger[_0x881d('0xc')](_0x881d('0xd'),_0x1a8ae9);_0x348360['next']();}};}; \ No newline at end of file +var _0x6bbf=['lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','error','[%s][TAG]\x20%s','stringify','finally','validate'];(function(_0x1fcbb7,_0x21ff69){var _0x1a5046=function(_0xe0768){while(--_0xe0768){_0x1fcbb7['push'](_0x1fcbb7['shift']());}};_0x1a5046(++_0x21ff69);}(_0x6bbf,0x187));var _0xf6bb=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x6bbf[_0x15bc81];return _0x59440e;};'use strict';var schema=require(_0xf6bb('0x0'));var _=require(_0xf6bb('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf6bb('0x2')),'smsInteraction':require(_0xf6bb('0x3')),'mailInteraction':require(_0xf6bb('0x4')),'faxInteraction':require(_0xf6bb('0x5')),'whatsappInteraction':require(_0xf6bb('0x6'))};var logger=require(_0xf6bb('0x7'))(_0xf6bb('0x8'));var tag=schema({'tag':{'type':_0xf6bb('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xf6bb('0xa')]=function(_0x127ed9,_0x48df42,_0x306180,_0x1007de){return function(_0x5e0b55){try{var _0x3fed16={'tag':_0x48df42[0x0]};var _0x22dbd1=tag[_0xf6bb('0x0')](_0x3fed16,{'typecast':!![]});if(_0x22dbd1[_0xf6bb('0xb')]){logger['error']('[%s][TAG]\x20%s',_0x127ed9,_[_0xf6bb('0xc')](_0x22dbd1,_0xf6bb('0xd'))['join'](',\x20'));logger[_0xf6bb('0xe')](_0xf6bb('0xf'),_0x127ed9);_0x5e0b55[_0xf6bb('0x10')]();}else{var _0x4b2104={'ids':[_0x48df42[0x0]]};if(rpc[_0x1007de['channel']+_0xf6bb('0x11')]){rpc[_0x1007de[_0xf6bb('0x12')]+'Interaction'][_0xf6bb('0x13')](_0x1007de['interaction']['id'],_0x4b2104)[_0xf6bb('0x14')](function(_0x38acae){logger[_0xf6bb('0xe')](_0xf6bb('0x15'),_0x127ed9,_0x48df42[0x1],_0x1007de['channel'],_0x1007de[_0xf6bb('0x16')]['id']);})[_0xf6bb('0x17')](function(_0x5cbd13){logger[_0xf6bb('0x18')](_0xf6bb('0x19'),_0x127ed9,JSON[_0xf6bb('0x1a')](_0x5cbd13));logger['info'](_0xf6bb('0xf'),_0x127ed9);})[_0xf6bb('0x1b')](function(){_0x5e0b55[_0xf6bb('0x10')]();});}}}catch(_0x1c7267){logger[_0xf6bb('0x18')](_0xf6bb('0x19'),_0x127ed9,_['isObject'](_0x1c7267)?JSON[_0xf6bb('0x1a')](_0x1c7267):_0x1c7267);logger[_0xf6bb('0xe')](_0xf6bb('0xf'),_0x127ed9);_0x5e0b55[_0xf6bb('0x10')]();}};}; \ 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 e310e1f..bac65ac 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 _0x6252=['?params=','title','jsonrpc','2.0','method','login','stringify','utf8','POST','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','info','stop','catch','error','isObject','next','request-promise','consequence','replace','includes','push','urlOnAnswer'];(function(_0x45bc68,_0x25eae1){var _0x3f3062=function(_0x33cb26){while(--_0x33cb26){_0x45bc68['push'](_0x45bc68['shift']());}};_0x3f3062(++_0x25eae1);}(_0x6252,0x6a));var _0x2625=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x6252[_0x1da527];return _0x40fc7c;};'use strict';var rp=require(_0x2625('0x0'));var logger=require('../../../../config/logger')('routing');var _=require('lodash');var arr=[];exports[_0x2625('0x1')]=function(_0x44820d,_0x11e2ae){return function(_0xf04a37){var _0x58165e=_0x11e2ae[0xa];var _0x231515=_0x11e2ae[0xb];var _0x22712c=_0x11e2ae[0xc];var _0x523b6f=_0x11e2ae[0xd];var _0x4cf63a=_0x11e2ae[0xe];var _0x59dd1b=_0x11e2ae[0xf][_0x2625('0x2')](/\n/g,'\x20-\x20');var _0x2d6f6e=_0x11e2ae[0x10][_0x2625('0x2')](/\n/g,'\x20');if(!arr[_0x2625('0x3')](_0x231515)){arr[_0x2625('0x4')](_0x231515);var _0x48d15d=_0x11e2ae[0x3];var _0x1b270a=_0x11e2ae[0x4];var _0x437ae5=_0x11e2ae[0x1];var _0x3a491d=_0x11e2ae[0x0];var _0x26f21a={};_0x26f21a[_0x2625('0x5')]=_0x11e2ae[0x8]+_0x2625('0x6')+_0x22712c+'|'+_0x58165e+'|'+_0x523b6f+'|'+_0x231515+'|'+_0x4cf63a;_0x26f21a['urlOnRing']=_0x11e2ae[0x7]+_0x2625('0x6')+_0x22712c+'|'+_0x58165e+'|'+_0x523b6f+'|'+_0x231515+'|'+_0x4cf63a+'|'+_0x59dd1b+'|'+_0x2d6f6e;_0x26f21a[_0x2625('0x7')]=_0x11e2ae[0x9];var _0x5a287c={};_0x5a287c[_0x2625('0x8')]=_0x2625('0x9');_0x5a287c[_0x2625('0xa')]=_0x2625('0xb');var _0x56ddbb=[];_0x56ddbb['push'](_0x11e2ae[0x2]);_0x56ddbb['push'](_0x11e2ae[0x5]);_0x56ddbb[_0x2625('0x4')](_0x11e2ae[0x6]);_0x5a287c['params']=_0x56ddbb;_0x5a287c['id']=0x1;var _0x319ae0=JSON[_0x2625('0xc')](_0x5a287c);var _0x33e312={'encoding':_0x2625('0xd'),'method':_0x2625('0xe'),'timeout':0x2710,'url':_0x48d15d,'headers':{'Content-Type':_0x2625('0xf')},'body':_0x319ae0};return rp(_0x33e312)[_0x2625('0x10')](function(_0x37229f){const _0xf3a108=JSON[_0x2625('0x11')](_0x37229f);if(!_0xf3a108[_0x2625('0x12')]['logged']){throw new Error(_0x2625('0x13'));}var _0x2c4198=_0x231515;var _0x1ce8a8=_0x2625('0x14')+_0x437ae5+'&serviceId='+_0x3a491d+_0x2625('0x15')+_0x2c4198+'&data='+JSON['stringify'](_0x26f21a);var _0x1fddd1=_0x1b270a+'?'+_0x1ce8a8;return rp(_0x1fddd1);})[_0x2625('0x10')](function(_0x585435){logger[_0x2625('0x16')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x44820d,_0x585435);_0xf04a37[_0x2625('0x17')]();})[_0x2625('0x18')](function(_0x187286){logger[_0x2625('0x19')]('[%s][TVOX]\x20%s',_0x44820d,_[_0x2625('0x1a')](_0x187286)?JSON['stringify'](_0x187286):_0x187286);_0xf04a37[_0x2625('0x17')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x44820d);_0xf04a37[_0x2625('0x1b')]();}};}; \ No newline at end of file +var _0x13f7=['error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','../../../../config/logger','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','info','stop','catch'];(function(_0x402716,_0x5c84b9){var _0x42ddcd=function(_0x232049){while(--_0x232049){_0x402716['push'](_0x402716['shift']());}};_0x42ddcd(++_0x5c84b9);}(_0x13f7,0x1c3));var _0x713f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f7[_0x20a584];return _0x4b41a8;};'use strict';var rp=require('request-promise');var logger=require(_0x713f('0x0'))('routing');var _=require(_0x713f('0x1'));var arr=[];exports['consequence']=function(_0x415a88,_0x150ced){return function(_0x481d0c){var _0x579842=_0x150ced[0xa];var _0x187585=_0x150ced[0xb];var _0x445311=_0x150ced[0xc];var _0x5409e7=_0x150ced[0xd];var _0x395ce7=_0x150ced[0xe];var _0x15de7b=_0x150ced[0xf][_0x713f('0x2')](/\n/g,_0x713f('0x3'));var _0x3a358f=_0x150ced[0x10][_0x713f('0x2')](/\n/g,'\x20');if(!arr[_0x713f('0x4')](_0x187585)){arr[_0x713f('0x5')](_0x187585);var _0x25ae00=_0x150ced[0x3];var _0x13fec7=_0x150ced[0x4];var _0x4eb589=_0x150ced[0x1];var _0x29592d=_0x150ced[0x0];var _0x2e1c51={};_0x2e1c51[_0x713f('0x6')]=_0x150ced[0x8]+_0x713f('0x7')+_0x445311+'|'+_0x579842+'|'+_0x5409e7+'|'+_0x187585+'|'+_0x395ce7;_0x2e1c51[_0x713f('0x8')]=_0x150ced[0x7]+_0x713f('0x7')+_0x445311+'|'+_0x579842+'|'+_0x5409e7+'|'+_0x187585+'|'+_0x395ce7+'|'+_0x15de7b+'|'+_0x3a358f;_0x2e1c51[_0x713f('0x9')]=_0x150ced[0x9];var _0x42b0ad={};_0x42b0ad[_0x713f('0xa')]='2.0';_0x42b0ad[_0x713f('0xb')]=_0x713f('0xc');var _0xa23ae8=[];_0xa23ae8['push'](_0x150ced[0x2]);_0xa23ae8['push'](_0x150ced[0x5]);_0xa23ae8[_0x713f('0x5')](_0x150ced[0x6]);_0x42b0ad[_0x713f('0xd')]=_0xa23ae8;_0x42b0ad['id']=0x1;var _0x723683=JSON[_0x713f('0xe')](_0x42b0ad);var _0xf2bd7f={'encoding':_0x713f('0xf'),'method':_0x713f('0x10'),'timeout':0x2710,'url':_0x25ae00,'headers':{'Content-Type':_0x713f('0x11')},'body':_0x723683};return rp(_0xf2bd7f)[_0x713f('0x12')](function(_0x4690cd){const _0x3bbae9=JSON[_0x713f('0x13')](_0x4690cd);if(!_0x3bbae9[_0x713f('0x14')][_0x713f('0x15')]){throw new Error(_0x713f('0x16'));}var _0x8a640=_0x187585;var _0x47bc87=_0x713f('0x17')+_0x4eb589+_0x713f('0x18')+_0x29592d+'&sessionId='+_0x8a640+_0x713f('0x19')+JSON[_0x713f('0xe')](_0x2e1c51);var _0x1e0ed8=_0x13fec7+'?'+_0x47bc87;return rp(_0x1e0ed8);})[_0x713f('0x12')](function(_0x2310aa){logger[_0x713f('0x1a')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x415a88,_0x2310aa);_0x481d0c[_0x713f('0x1b')]();})[_0x713f('0x1c')](function(_0x433969){logger[_0x713f('0x1d')]('[%s][TVOX]\x20%s',_0x415a88,_[_0x713f('0x1e')](_0x433969)?JSON[_0x713f('0xe')](_0x433969):_0x433969);_0x481d0c[_0x713f('0x1b')]();});}else{logger[_0x713f('0x1a')](_0x713f('0x1f'),_0x415a88);_0x481d0c['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index a008c7f..f65690d 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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x315ba2,_0x410458){var _0x3cee83=function(_0x235175){while(--_0x235175){_0x315ba2['push'](_0x315ba2['shift']());}};_0x3cee83(++_0x410458);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x3be7e,_0x859c8b){var _0x192038=function(_0x1a1c46){while(--_0x1a1c46){_0x3be7e['push'](_0x3be7e['shift']());}};_0x192038(++_0x859c8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index ea4b742..3d723fb 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 _0x684b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','IntervalId','isNil','Intervals','map','interval','listen','channel','message','interaction','transfer','isArray','applications','length','existsSync','join','app','toLowerCase','autoreply','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','appdata','tag','TagId','tvox','ContactId','body','./interval','./applications/','priority','Push\x20new\x20rule','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','info','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','name','waiting','mailQueues','loggedIn','paused','openchannelQueues','smsQueues'];(function(_0x24a371,_0x48a879){var _0x1b62c5=function(_0x17652b){while(--_0x17652b){_0x24a371['push'](_0x24a371['shift']());}};_0x1b62c5(++_0x48a879);}(_0x684b,0x1a5));var _0xb684=function(_0x49ff9c,_0x1e5268){_0x49ff9c=_0x49ff9c-0x0;var _0x5a9d92=_0x684b[_0x49ff9c];return _0x5a9d92;};'use strict';var _=require(_0xb684('0x0'));var util=require('util');var path=require(_0xb684('0x1'));var fs=require('fs');var jayson=require(_0xb684('0x2'));var BPromise=require('bluebird');var utils=require(_0xb684('0x3'));var sUtils=require(_0xb684('0x4'));var logger=require(_0xb684('0x5'))(_0xb684('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xb684('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xb684('0x8')),'faxQueueReport':require(_0xb684('0x9')),'whatsappQueueReport':require(_0xb684('0xa'))};var RuleEngine=require(_0xb684('0xb'));function getId(_0x194198,_0x3f2199,_0x627347){return util[_0xb684('0xc')]('%s.%s.%s',_0x194198,_0x3f2199||0x0,_0x627347||0x0);}function getIntervals(_0x59f387,_0x562a09){var _0x500933=[];if(!_['isNil'](_0x562a09[_0xb684('0xd')])&&!_[_0xb684('0xe')](_0x59f387[_0x562a09[_0xb684('0xd')]])&&!_[_0xb684('0xe')](_0x59f387[_0x562a09[_0xb684('0xd')]][_0xb684('0xf')])){_0x500933=_[_0xb684('0x10')](_0x59f387[_0x562a09[_0xb684('0xd')]]['Intervals'],_0xb684('0x11'));}else if(!_['isNil'](_0x562a09[_0xb684('0x11')])){_0x500933=[_0x562a09[_0xb684('0x11')]];}return _0x500933;}exports[_0xb684('0x12')]=function(_0x52d397){_0x52d397['rules']={};return new BPromise(function(_0x2a0bc3,_0x3ede39){var _0x1fd817={'Start':function(_0x332687){var _0x1670c0=this;return new Promise(function(_0x2f105c,_0x1cd422){if(_0x332687){try{var _0x194bf7=[];var _0x218f9d=getId(_0x332687[_0xb684('0x13')],_0x332687['message']?_0x332687[_0xb684('0x14')]['id']:0x0,_0x332687[_0xb684('0x15')]?_0x332687['interaction']['id']:0x0);var _0x2227b4=sUtils['checkWaitingNotifications'](_0x52d397,_0x332687);if(_0x332687[_0xb684('0x16')]||!_0x2227b4&&_0x332687['applications']&&_[_0xb684('0x17')](_0x332687[_0xb684('0x18')])&&_0x332687[_0xb684('0x18')][_0xb684('0x19')]){for(var _0x31a345=0x0;_0x31a345<_0x332687[_0xb684('0x18')][_0xb684('0x19')];_0x31a345+=0x1){var _0x3d17ee=_0x332687[_0xb684('0x18')][_0x31a345];if(fs[_0xb684('0x1a')](path[_0xb684('0x1b')](__dirname,'applications',_0x3d17ee[_0xb684('0x1c')]+'.js'))){var _0x49cc57=[];switch(_0x3d17ee[_0xb684('0x1c')][_0xb684('0x1d')]()){case _0xb684('0x1e'):var _0x3fde39=_0x3d17ee['appdata'][_0xb684('0x1f')](',');if(_0x332687[_0xb684('0x13')]===_0xb684('0x20')){_0x49cc57[_0xb684('0x21')](_0x3fde39[0x0]);_0x49cc57[_0xb684('0x21')](_0x3fde39[0x1]);_0x49cc57[_0xb684('0x21')](_0x3fde39[_0xb684('0x22')](0x2,_0x3fde39[_0xb684('0x19')])['join'](','));}else{_0x49cc57[_0xb684('0x21')](_0x3fde39[0x0]);_0x49cc57[_0xb684('0x21')](_0x3fde39[_0xb684('0x22')](0x1,_0x3fde39[_0xb684('0x19')])[_0xb684('0x1b')](','));}break;case _0xb684('0x23'):var _0x5eb96c=_0x3d17ee['appdata'][_0xb684('0x1f')](',');_0x49cc57['push'](_0x5eb96c[0x0]);_0x49cc57[_0xb684('0x21')](_0x5eb96c[0x1]);_0x49cc57[_0xb684('0x21')](_0x5eb96c[_0xb684('0x22')](0x2,_0x5eb96c[_0xb684('0x19')])[_0xb684('0x1b')](','));break;case _0xb684('0x24'):var _0xc5bece=_0x3d17ee['appdata'][_0xb684('0x1f')](',');_0x49cc57[_0xb684('0x21')](_0xc5bece[0x0]);_0x49cc57[_0xb684('0x21')](_0xc5bece[0x1]);_0x49cc57[_0xb684('0x21')](_0xc5bece[0x2]);_0x49cc57['push'](_0xc5bece[0x3]);_0x49cc57['push'](_0xc5bece[_0xb684('0x22')](0x4,_0xc5bece['length'])['join'](','));break;case _0xb684('0x25'):var _0x3c7855=_0x3d17ee[_0xb684('0x26')][_0xb684('0x1f')](',');_0x49cc57[_0xb684('0x21')](_0x3c7855[0x0]);_0x49cc57[_0xb684('0x21')](_0x3c7855[0x1]);_0x49cc57[_0xb684('0x21')](_0x3c7855[0x2]);_0x49cc57[_0xb684('0x21')](_0x3c7855[0x3]);_0x49cc57[_0xb684('0x21')](_0x3c7855[_0xb684('0x22')](0x4,_0x3c7855[_0xb684('0x19')])[_0xb684('0x1b')](','));break;case _0xb684('0x14'):_0x49cc57[_0xb684('0x21')](_0x3d17ee[_0xb684('0x26')]);break;case _0xb684('0x27'):_0x49cc57[_0xb684('0x21')](_0x3d17ee[_0xb684('0x28')]);_0x49cc57['push'](_0x3d17ee[_0xb684('0x26')]);break;case _0xb684('0x29'):var _0x1a2fbc=utils['getMustacheRender'](_0x332687['account']['notificationTemplate'],_0x332687);var _0xb2030c=_0x3d17ee[_0xb684('0x26')][_0xb684('0x1f')](',');_0x49cc57['push'](_0xb2030c[0x0]);_0x49cc57[_0xb684('0x21')](_0xb2030c[0x1]);_0x49cc57[_0xb684('0x21')](_0xb2030c[0x2]);_0x49cc57[_0xb684('0x21')](_0xb2030c[0x3]);_0x49cc57['push'](_0xb2030c[0x4]);_0x49cc57[_0xb684('0x21')](_0xb2030c[0x5]);_0x49cc57['push'](_0xb2030c[0x6]);_0x49cc57[_0xb684('0x21')](_0xb2030c[0x7]);_0x49cc57[_0xb684('0x21')](_0xb2030c[0x8]);_0x49cc57['push'](_0xb2030c[0x9]);_0x49cc57[_0xb684('0x21')](_0xb2030c[0xa]);_0x49cc57[_0xb684('0x21')](_0x332687['interaction']['id']);_0x49cc57[_0xb684('0x21')](_0x332687[_0xb684('0x14')]['id']);_0x49cc57[_0xb684('0x21')](_0x3d17ee['ChatWebsiteId']);_0x49cc57[_0xb684('0x21')](_0x332687['interaction'][_0xb684('0x2a')]);_0x49cc57[_0xb684('0x21')](_0x332687[_0xb684('0x2b')][_0xb684('0x2b')]);_0x49cc57[_0xb684('0x21')](_0x1a2fbc);break;default:_0x49cc57=_[_0xb684('0xe')](_0x3d17ee[_0xb684('0x26')])?[]:_0x3d17ee[_0xb684('0x26')][_0xb684('0x1f')](',');}var _0x219415={'id':util[_0xb684('0xc')]('%s:%s:%s',_0x218f9d,_0x3d17ee['id'],_0x3d17ee['app']),'condition':require(_0xb684('0x2c'))['condition'](_0x218f9d,getIntervals(_0x52d397['intervals'],_0x3d17ee),_0x52d397),'consequence':require(_0xb684('0x2d')+_0x3d17ee[_0xb684('0x1c')])['consequence'](_0x218f9d,_0x49cc57,_0x52d397,_0x332687),'p':_0x3d17ee[_0xb684('0x2e')]||0x0};logger['info'](_0xb684('0x2f'),_0x219415['id'],'on\x20interval',getIntervals(_0x52d397[_0xb684('0x30')],_0x3d17ee)['join'](_0xb684('0x31')));_0x194bf7['push'](_0x219415);}else{logger[_0xb684('0x32')](_0xb684('0x33'),path[_0xb684('0x1b')](__dirname,_0xb684('0x18'),_0x3d17ee[_0xb684('0x1c')]+_0xb684('0x34')));}}_0x52d397[_0xb684('0x35')][_0x218f9d]=new RuleEngine(_0x194bf7);_0x52d397['rules'][_0x218f9d]['execute'](_0x332687,function(_0x4fb242){logger[_0xb684('0x36')](_0xb684('0x37'),JSON[_0xb684('0x38')](_0x4fb242[_0xb684('0x39')]));if(_0x52d397[_0xb684('0x35')][_0x218f9d]){_0x52d397[_0xb684('0x35')][_0x218f9d][_0xb684('0x3a')](_0xb684('0x3b'));}});return _0x2f105c({'code':0xc8,'message':_0x332687});}else{if(_0x2227b4){logger['info'](util[_0xb684('0xc')](_0xb684('0x3c'),_0x218f9d));}else{logger[_0xb684('0x36')](_0xb684('0x3d'));}return _0x2f105c({'code':0xc8,'message':_0x332687});}}catch(_0x286575){logger[_0xb684('0x32')](_0x286575['stack']);return _0x1cd422(_0x1670c0[_0xb684('0x32')](0x1f4,_0x286575));}}return _0x1cd422(_0xb684('0x3e'));});},'AcceptMessage':function(_0x3ac318){var _0x6e5240=this;return new Promise(function(_0x308de5,_0x118539){if(_0x3ac318[_0xb684('0x3f')]&&_0x3ac318[_0xb684('0x3f')]['id']){if(_0x52d397[_0xb684('0x40')][_0x3ac318[_0xb684('0x3f')]['id']]){_0x52d397[_0xb684('0x40')][_0x3ac318['agent']['id']][_0xb684('0x41')]=![];_0x52d397[_0xb684('0x40')][_0x3ac318[_0xb684('0x3f')]['id']][_0xb684('0x42')]=undefined;}}if(_0x3ac318['message']&&_0x3ac318[_0xb684('0x14')]['id']){try{var _0xe3e717=getId(_0x3ac318[_0xb684('0x13')],_0x3ac318[_0xb684('0x14')]?_0x3ac318['message']['id']:0x0,_0x3ac318[_0xb684('0x15')]?_0x3ac318[_0xb684('0x15')]['id']:0x0);if(_0x52d397[_0xb684('0x35')][_0xe3e717]){_0x52d397[_0xb684('0x35')][_0xe3e717][_0xb684('0x3a')](_0xb684('0x43'));if(rpc[_0x3ac318[_0xb684('0x13')]+_0xb684('0x44')]){rpc[_0x3ac318['channel']+'QueueReport'][_0xb684('0x45')](_0xe3e717,{'UserId':_0x3ac318[_0xb684('0x14')][_0xb684('0x46')]})['catch'](function(){logger[_0xb684('0x32')](_0xb684('0x47'));});}}return _0x308de5({'code':0xc8,'message':_0x3ac318});}catch(_0x1f0ae6){logger['error'](_0x1f0ae6[_0xb684('0x48')]);return _0x118539(_0x6e5240[_0xb684('0x32')](0x1f4,_0x1f0ae6));}}logger[_0xb684('0x32')]('message\x20is\x20empty');return _0x118539(_0x6e5240[_0xb684('0x32')](0x1f4,_0xb684('0x49')));});},'RejectMessage':function(_0x838bb9){var _0x22803a=this;return new Promise(function(_0x37eb11,_0x56340d){if(_0x838bb9[_0xb684('0x3f')]&&_0x838bb9[_0xb684('0x3f')]['id']){try{if(_0x52d397[_0xb684('0x40')][_0x838bb9[_0xb684('0x3f')]['id']]){_0x52d397['agents'][_0x838bb9[_0xb684('0x3f')]['id']][_0xb684('0x41')]=![];_0x52d397[_0xb684('0x40')][_0x838bb9[_0xb684('0x3f')]['id']][_0xb684('0x42')]=undefined;}return _0x37eb11({'code':0xc8,'message':_0x838bb9});}catch(_0x8421ac){logger[_0xb684('0x32')](_0x8421ac[_0xb684('0x48')]);return _0x56340d(_0x22803a[_0xb684('0x32')](0x1f4,_0x8421ac));}}logger[_0xb684('0x32')]('message\x20is\x20empty');return _0x56340d(_0x22803a[_0xb684('0x32')](0x1f4,_0xb684('0x49')));});},'AbandonInteraction':function(_0x2b0325){var _0x5e17e3=this;return new Promise(function(_0x8eda22,_0x40e2e0){if(_0x2b0325[_0xb684('0x13')]&&_0x2b0325[_0xb684('0x15')]&&_0x2b0325[_0xb684('0x15')]['id']){try{var _0x49e187=getId(_0x2b0325[_0xb684('0x13')],_0x2b0325[_0xb684('0x14')]?_0x2b0325[_0xb684('0x14')]['id']:0x0,_0x2b0325['interaction']?_0x2b0325[_0xb684('0x15')]['id']:0x0);if(_0x52d397['rules'][_0x49e187]){_0x52d397[_0xb684('0x35')][_0x49e187]['emit'](_0xb684('0x43'));}return _0x8eda22({'code':0xc8,'message':_0x2b0325});}catch(_0x31a793){logger[_0xb684('0x32')](_0x31a793[_0xb684('0x48')]);return _0x40e2e0(_0x5e17e3[_0xb684('0x32')](0x1f4,_0x31a793));}}logger[_0xb684('0x32')](_0xb684('0x49'));return _0x40e2e0(_0x5e17e3[_0xb684('0x32')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xc9a26d){var _0x2edab6=this;return new Promise(function(_0x5bd00e,_0x77bdbd){if(_0x52d397['agents'][_0xb684('0x4a')](_0xc9a26d['id'])){for(var _0x55fa4e in _0xc9a26d[_0xb684('0x4b')]){if(_0xc9a26d[_0xb684('0x4b')]['hasOwnProperty'](_0x55fa4e)){if(_0x52d397['agents'][_0xc9a26d['id']][_0xb684('0x4a')](_0x55fa4e+_0xb684('0x4c'))){_0x52d397[_0xb684('0x40')][_0xc9a26d['id']][_0x55fa4e+_0xb684('0x4c')]=parseInt(_0xc9a26d[_0xb684('0x4b')][_0x55fa4e],0xa);}}}_0x52d397[_0xb684('0x40')][_0xc9a26d['id']][_0xb684('0x4d')]();return _0x5bd00e({'code':0xc8,'message':_0x52d397[_0xb684('0x40')][_0xc9a26d['id']]});}else{return _0x77bdbd(_0x2edab6[_0xb684('0x32')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x41ff3c){return new Promise(function(_0x9af582){var _0x334e26=_[_0xb684('0x4e')](_0x52d397[_0xb684('0x40')]);if(_0x41ff3c&&_0x41ff3c['id']){var _0x453b0c=_[_0xb684('0x4f')](_0x334e26,function(_0x255955){return _0x255955['id']===_0x41ff3c['id'];});_0x9af582(_0x453b0c);}else{_0x9af582({'count':_0x334e26[_0xb684('0x19')],'rows':_0x334e26});}});},'ChatQueues':function(){return new Promise(function(_0x22e8db){var _0x24366a=[];for(var _0x2366cf in _0x52d397['chatQueues']){if(_0x52d397[_0xb684('0x50')][_0xb684('0x4a')](_0x2366cf)){var _0x18fb85=_0x52d397[_0xb684('0x50')][_0x2366cf];var _0x1bcaac={'id':_0x18fb85['id'],'available':_0x18fb85[_0xb684('0x51')],'loggedIn':_0x18fb85['loggedIn'],'name':_0x18fb85[_0xb684('0x52')],'paused':_0x18fb85['paused'],'waiting':_0x18fb85[_0xb684('0x53')]};_0x24366a[_0xb684('0x21')](_0x1bcaac);}}_0x22e8db({'count':_0x24366a['length'],'rows':_0x24366a});});},'MailQueues':function(){return new Promise(function(_0x5b84f9){var _0x49ab45=[];for(var _0x18a9d0 in _0x52d397[_0xb684('0x54')]){if(_0x52d397[_0xb684('0x54')][_0xb684('0x4a')](_0x18a9d0)){var _0x2b97f6=_0x52d397['mailQueues'][_0x18a9d0];var _0x25ce26={'id':_0x2b97f6['id'],'available':_0x2b97f6[_0xb684('0x51')],'loggedIn':_0x2b97f6[_0xb684('0x55')],'name':_0x2b97f6[_0xb684('0x52')],'paused':_0x2b97f6[_0xb684('0x56')],'waiting':_0x2b97f6[_0xb684('0x53')]};_0x49ab45[_0xb684('0x21')](_0x25ce26);}}_0x5b84f9({'count':_0x49ab45[_0xb684('0x19')],'rows':_0x49ab45});});},'OpenchannelQueues':function(){return new Promise(function(_0x3dc45d){var _0x47e5d1=[];for(var _0x130c59 in _0x52d397['openchannelQueues']){if(_0x52d397[_0xb684('0x57')]['hasOwnProperty'](_0x130c59)){var _0x3155d9=_0x52d397[_0xb684('0x57')][_0x130c59];var _0x21c595={'id':_0x3155d9['id'],'available':_0x3155d9[_0xb684('0x51')],'loggedIn':_0x3155d9[_0xb684('0x55')],'name':_0x3155d9[_0xb684('0x52')],'paused':_0x3155d9[_0xb684('0x56')],'waiting':_0x3155d9[_0xb684('0x53')]};_0x47e5d1[_0xb684('0x21')](_0x21c595);}}_0x3dc45d({'count':_0x47e5d1['length'],'rows':_0x47e5d1});});},'SmsQueues':function(){return new Promise(function(_0x55bed4){var _0x61116e=[];for(var _0x2bd58a in _0x52d397[_0xb684('0x58')]){if(_0x52d397['smsQueues'][_0xb684('0x4a')](_0x2bd58a)){var _0x1fbb2d=_0x52d397[_0xb684('0x58')][_0x2bd58a];var _0x44109a={'id':_0x1fbb2d['id'],'available':_0x1fbb2d['available'],'loggedIn':_0x1fbb2d[_0xb684('0x55')],'name':_0x1fbb2d[_0xb684('0x52')],'paused':_0x1fbb2d[_0xb684('0x56')],'waiting':_0x1fbb2d[_0xb684('0x53')]};_0x61116e[_0xb684('0x21')](_0x44109a);}}_0x55bed4({'count':_0x61116e['length'],'rows':_0x61116e});});},'FaxQueues':function(){return new Promise(function(_0x1da00f){var _0x5bc1e6=[];for(var _0x2dcfc2 in _0x52d397[_0xb684('0x59')]){if(_0x52d397[_0xb684('0x59')][_0xb684('0x4a')](_0x2dcfc2)){var _0x2359fa=_0x52d397[_0xb684('0x59')][_0x2dcfc2];var _0x284c9={'id':_0x2359fa['id'],'available':_0x2359fa[_0xb684('0x51')],'loggedIn':_0x2359fa[_0xb684('0x55')],'name':_0x2359fa['name'],'paused':_0x2359fa['paused'],'waiting':_0x2359fa[_0xb684('0x53')]};_0x5bc1e6[_0xb684('0x21')](_0x284c9);}}_0x1da00f({'count':_0x5bc1e6[_0xb684('0x19')],'rows':_0x5bc1e6});});},'WhatsappQueues':function(){return new Promise(function(_0x180616){var _0x2d023e=[];for(var _0x1d547c in _0x52d397[_0xb684('0x5a')]){if(_0x52d397['whatsappQueues']['hasOwnProperty'](_0x1d547c)){var _0x45c19e=_0x52d397['whatsappQueues'][_0x1d547c];var _0x55e06d={'id':_0x45c19e['id'],'available':_0x45c19e[_0xb684('0x51')],'loggedIn':_0x45c19e[_0xb684('0x55')],'name':_0x45c19e[_0xb684('0x52')],'paused':_0x45c19e[_0xb684('0x56')],'waiting':_0x45c19e[_0xb684('0x53')]};_0x2d023e[_0xb684('0x21')](_0x55e06d);}}_0x180616({'count':_0x2d023e[_0xb684('0x19')],'rows':_0x2d023e});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x22dc09){var _0x5974de=_[_0xb684('0x4e')](_0x52d397[_0xb684('0x5b')]);_0x22dc09({'count':_0x5974de['length'],'rows':_0x5974de});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2e067a){var _0x1d79b7=_[_0xb684('0x4e')](_0x52d397[_0xb684('0x5c')]);_0x2e067a({'count':_0x1d79b7['length'],'rows':_0x1d79b7});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x25656d){var _0x13ba11=_[_0xb684('0x4e')](_0x52d397[_0xb684('0x5d')]);_0x25656d({'count':_0x13ba11[_0xb684('0x19')],'rows':_0x13ba11});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4993a6){var _0x3e4166=_[_0xb684('0x4e')](_0x52d397[_0xb684('0x5e')]);_0x4993a6({'count':_0x3e4166[_0xb684('0x19')],'rows':_0x3e4166});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x33125e){var _0x2f7278=_[_0xb684('0x4e')](_0x52d397[_0xb684('0x5f')]);_0x33125e({'count':_0x2f7278[_0xb684('0x19')],'rows':_0x2f7278});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x13144c){var _0x3682d9=_[_0xb684('0x4e')](_0x52d397[_0xb684('0x60')]);_0x13144c({'count':_0x3682d9[_0xb684('0x19')],'rows':_0x3682d9});});}};var _0x21529b=jayson[_0xb684('0x61')](_0x1fd817)[_0xb684('0x62')]();_0x21529b['on'](_0xb684('0x32'),function(_0x4188e2){logger[_0xb684('0x32')](JSON[_0xb684('0x38')](_0x4188e2));return _0x3ede39(_0x4188e2);});_0x21529b['listen'](0x232c,_0xb684('0x63'),function(){console[_0xb684('0x64')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2a0bc3(_0xb684('0x65')+0x232c);});});}; \ No newline at end of file +var _0xd943=['agent','agents','busy','busyQueue','emit','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','paused','waiting','mailQueues','openchannelQueues','smsQueues','name','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','condition','intervals','./applications/','consequence','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','.js','stringify','matchPath','complete','format','Skipped\x20routing\x20for\x20%s','info','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd943,0x15d));var _0x3d94=function(_0x58ed0c,_0x5b5b0a){_0x58ed0c=_0x58ed0c-0x0;var _0x25915a=_0xd943[_0x58ed0c];return _0x25915a;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var fs=require('fs');var jayson=require(_0x3d94('0x3'));var BPromise=require('bluebird');var utils=require(_0x3d94('0x4'));var sUtils=require(_0x3d94('0x5'));var logger=require(_0x3d94('0x6'))(_0x3d94('0x7'));var rpc={'openchannelQueueReport':require(_0x3d94('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x3d94('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x20f4d1,_0x35d36a,_0x5244c3){return util['format'](_0x3d94('0xa'),_0x20f4d1,_0x35d36a||0x0,_0x5244c3||0x0);}function getIntervals(_0x27e381,_0x1cc58c){var _0x5908a7=[];if(!_[_0x3d94('0xb')](_0x1cc58c['IntervalId'])&&!_[_0x3d94('0xb')](_0x27e381[_0x1cc58c[_0x3d94('0xc')]])&&!_['isNil'](_0x27e381[_0x1cc58c[_0x3d94('0xc')]][_0x3d94('0xd')])){_0x5908a7=_[_0x3d94('0xe')](_0x27e381[_0x1cc58c[_0x3d94('0xc')]][_0x3d94('0xd')],'interval');}else if(!_[_0x3d94('0xb')](_0x1cc58c[_0x3d94('0xf')])){_0x5908a7=[_0x1cc58c[_0x3d94('0xf')]];}return _0x5908a7;}exports['listen']=function(_0x24e8b9){_0x24e8b9[_0x3d94('0x10')]={};return new BPromise(function(_0x7d6969,_0x5d9366){var _0x14ea5f={'Start':function(_0x340818){var _0x292419=this;return new Promise(function(_0x34098e,_0xaf939a){if(_0x340818){try{var _0xd8efaa=[];var _0x31c6e8=getId(_0x340818[_0x3d94('0x11')],_0x340818['message']?_0x340818[_0x3d94('0x12')]['id']:0x0,_0x340818[_0x3d94('0x13')]?_0x340818[_0x3d94('0x13')]['id']:0x0);var _0x1c35a8=sUtils[_0x3d94('0x14')](_0x24e8b9,_0x340818);if(_0x340818[_0x3d94('0x15')]||!_0x1c35a8&&_0x340818[_0x3d94('0x16')]&&_['isArray'](_0x340818[_0x3d94('0x16')])&&_0x340818['applications'][_0x3d94('0x17')]){for(var _0x193934=0x0;_0x193934<_0x340818[_0x3d94('0x16')][_0x3d94('0x17')];_0x193934+=0x1){var _0x35a3cc=_0x340818['applications'][_0x193934];if(fs['existsSync'](path[_0x3d94('0x18')](__dirname,_0x3d94('0x16'),_0x35a3cc[_0x3d94('0x19')]+'.js'))){var _0x30af25=[];switch(_0x35a3cc[_0x3d94('0x19')][_0x3d94('0x1a')]()){case _0x3d94('0x1b'):var _0x395133=_0x35a3cc[_0x3d94('0x1c')][_0x3d94('0x1d')](',');if(_0x340818[_0x3d94('0x11')]===_0x3d94('0x1e')){_0x30af25[_0x3d94('0x1f')](_0x395133[0x0]);_0x30af25[_0x3d94('0x1f')](_0x395133[0x1]);_0x30af25[_0x3d94('0x1f')](_0x395133[_0x3d94('0x20')](0x2,_0x395133[_0x3d94('0x17')])[_0x3d94('0x18')](','));}else{_0x30af25['push'](_0x395133[0x0]);_0x30af25[_0x3d94('0x1f')](_0x395133['slice'](0x1,_0x395133[_0x3d94('0x17')])[_0x3d94('0x18')](','));}break;case _0x3d94('0x21'):var _0x439173=_0x35a3cc[_0x3d94('0x1c')][_0x3d94('0x1d')](',');_0x30af25[_0x3d94('0x1f')](_0x439173[0x0]);_0x30af25['push'](_0x439173[0x1]);_0x30af25['push'](_0x439173[_0x3d94('0x20')](0x2,_0x439173['length'])['join'](','));break;case _0x3d94('0x22'):var _0x58c0d0=_0x35a3cc[_0x3d94('0x1c')][_0x3d94('0x1d')](',');_0x30af25[_0x3d94('0x1f')](_0x58c0d0[0x0]);_0x30af25['push'](_0x58c0d0[0x1]);_0x30af25[_0x3d94('0x1f')](_0x58c0d0[0x2]);_0x30af25['push'](_0x58c0d0[0x3]);_0x30af25[_0x3d94('0x1f')](_0x58c0d0['slice'](0x4,_0x58c0d0[_0x3d94('0x17')])[_0x3d94('0x18')](','));break;case _0x3d94('0x23'):var _0x246f88=_0x35a3cc['appdata'][_0x3d94('0x1d')](',');_0x30af25['push'](_0x246f88[0x0]);_0x30af25[_0x3d94('0x1f')](_0x246f88[0x1]);_0x30af25[_0x3d94('0x1f')](_0x246f88[0x2]);_0x30af25['push'](_0x246f88[0x3]);_0x30af25['push'](_0x246f88[_0x3d94('0x20')](0x4,_0x246f88[_0x3d94('0x17')])[_0x3d94('0x18')](','));break;case'message':_0x30af25[_0x3d94('0x1f')](_0x35a3cc[_0x3d94('0x1c')]);break;case'tag':_0x30af25[_0x3d94('0x1f')](_0x35a3cc[_0x3d94('0x24')]);_0x30af25[_0x3d94('0x1f')](_0x35a3cc[_0x3d94('0x1c')]);break;case _0x3d94('0x25'):var _0x4d55ff=utils[_0x3d94('0x26')](_0x340818[_0x3d94('0x27')][_0x3d94('0x28')],_0x340818);var _0x52bdb9=_0x35a3cc[_0x3d94('0x1c')][_0x3d94('0x1d')](',');_0x30af25['push'](_0x52bdb9[0x0]);_0x30af25['push'](_0x52bdb9[0x1]);_0x30af25[_0x3d94('0x1f')](_0x52bdb9[0x2]);_0x30af25[_0x3d94('0x1f')](_0x52bdb9[0x3]);_0x30af25[_0x3d94('0x1f')](_0x52bdb9[0x4]);_0x30af25[_0x3d94('0x1f')](_0x52bdb9[0x5]);_0x30af25[_0x3d94('0x1f')](_0x52bdb9[0x6]);_0x30af25[_0x3d94('0x1f')](_0x52bdb9[0x7]);_0x30af25[_0x3d94('0x1f')](_0x52bdb9[0x8]);_0x30af25[_0x3d94('0x1f')](_0x52bdb9[0x9]);_0x30af25[_0x3d94('0x1f')](_0x52bdb9[0xa]);_0x30af25[_0x3d94('0x1f')](_0x340818['interaction']['id']);_0x30af25[_0x3d94('0x1f')](_0x340818[_0x3d94('0x12')]['id']);_0x30af25[_0x3d94('0x1f')](_0x35a3cc[_0x3d94('0x29')]);_0x30af25['push'](_0x340818[_0x3d94('0x13')][_0x3d94('0x2a')]);_0x30af25[_0x3d94('0x1f')](_0x340818[_0x3d94('0x2b')][_0x3d94('0x2b')]);_0x30af25['push'](_0x4d55ff);break;default:_0x30af25=_[_0x3d94('0xb')](_0x35a3cc[_0x3d94('0x1c')])?[]:_0x35a3cc[_0x3d94('0x1c')]['split'](',');}var _0x4eee4d={'id':util['format']('%s:%s:%s',_0x31c6e8,_0x35a3cc['id'],_0x35a3cc[_0x3d94('0x19')]),'condition':require(_0x3d94('0x2c'))[_0x3d94('0x2d')](_0x31c6e8,getIntervals(_0x24e8b9[_0x3d94('0x2e')],_0x35a3cc),_0x24e8b9),'consequence':require(_0x3d94('0x2f')+_0x35a3cc[_0x3d94('0x19')])[_0x3d94('0x30')](_0x31c6e8,_0x30af25,_0x24e8b9,_0x340818),'p':_0x35a3cc['priority']||0x0};logger['info'](_0x3d94('0x31'),_0x4eee4d['id'],_0x3d94('0x32'),getIntervals(_0x24e8b9['intervals'],_0x35a3cc)[_0x3d94('0x18')]('\x20|\x20'));_0xd8efaa[_0x3d94('0x1f')](_0x4eee4d);}else{logger[_0x3d94('0x33')](_0x3d94('0x34'),path[_0x3d94('0x18')](__dirname,_0x3d94('0x16'),_0x35a3cc['app']+_0x3d94('0x35')));}}_0x24e8b9[_0x3d94('0x10')][_0x31c6e8]=new RuleEngine(_0xd8efaa);_0x24e8b9[_0x3d94('0x10')][_0x31c6e8]['execute'](_0x340818,function(_0x2910ea){logger['info']('Applications\x20executed',JSON[_0x3d94('0x36')](_0x2910ea[_0x3d94('0x37')]));if(_0x24e8b9[_0x3d94('0x10')][_0x31c6e8]){_0x24e8b9[_0x3d94('0x10')][_0x31c6e8]['emit'](_0x3d94('0x38'));}});return _0x34098e({'code':0xc8,'message':_0x340818});}else{if(_0x1c35a8){logger['info'](util[_0x3d94('0x39')](_0x3d94('0x3a'),_0x31c6e8));}else{logger[_0x3d94('0x3b')](_0x3d94('0x3c'));}return _0x34098e({'code':0xc8,'message':_0x340818});}}catch(_0x20e6d4){logger[_0x3d94('0x33')](_0x20e6d4[_0x3d94('0x3d')]);return _0xaf939a(_0x292419['error'](0x1f4,_0x20e6d4));}}return _0xaf939a(_0x3d94('0x3e'));});},'AcceptMessage':function(_0x19dabb){var _0x52c82b=this;return new Promise(function(_0x53e611,_0xf8632d){if(_0x19dabb[_0x3d94('0x3f')]&&_0x19dabb['agent']['id']){if(_0x24e8b9[_0x3d94('0x40')][_0x19dabb[_0x3d94('0x3f')]['id']]){_0x24e8b9[_0x3d94('0x40')][_0x19dabb[_0x3d94('0x3f')]['id']][_0x3d94('0x41')]=![];_0x24e8b9[_0x3d94('0x40')][_0x19dabb[_0x3d94('0x3f')]['id']][_0x3d94('0x42')]=undefined;}}if(_0x19dabb[_0x3d94('0x12')]&&_0x19dabb[_0x3d94('0x12')]['id']){try{var _0x4075ef=getId(_0x19dabb[_0x3d94('0x11')],_0x19dabb[_0x3d94('0x12')]?_0x19dabb[_0x3d94('0x12')]['id']:0x0,_0x19dabb[_0x3d94('0x13')]?_0x19dabb['interaction']['id']:0x0);if(_0x24e8b9[_0x3d94('0x10')][_0x4075ef]){_0x24e8b9[_0x3d94('0x10')][_0x4075ef][_0x3d94('0x43')](_0x3d94('0x44'));if(rpc[_0x19dabb[_0x3d94('0x11')]+_0x3d94('0x45')]){rpc[_0x19dabb[_0x3d94('0x11')]+_0x3d94('0x45')][_0x3d94('0x46')](_0x4075ef,{'UserId':_0x19dabb['message'][_0x3d94('0x47')]})['catch'](function(){logger[_0x3d94('0x33')](_0x3d94('0x48'));});}}return _0x53e611({'code':0xc8,'message':_0x19dabb});}catch(_0x4af4c2){logger[_0x3d94('0x33')](_0x4af4c2['stack']);return _0xf8632d(_0x52c82b['error'](0x1f4,_0x4af4c2));}}logger[_0x3d94('0x33')]('message\x20is\x20empty');return _0xf8632d(_0x52c82b[_0x3d94('0x33')](0x1f4,_0x3d94('0x49')));});},'RejectMessage':function(_0x5b6061){var _0x426ccb=this;return new Promise(function(_0x590f77,_0x598c6a){if(_0x5b6061[_0x3d94('0x3f')]&&_0x5b6061[_0x3d94('0x3f')]['id']){try{if(_0x24e8b9[_0x3d94('0x40')][_0x5b6061[_0x3d94('0x3f')]['id']]){_0x24e8b9[_0x3d94('0x40')][_0x5b6061[_0x3d94('0x3f')]['id']][_0x3d94('0x41')]=![];_0x24e8b9[_0x3d94('0x40')][_0x5b6061[_0x3d94('0x3f')]['id']]['busyQueue']=undefined;}return _0x590f77({'code':0xc8,'message':_0x5b6061});}catch(_0x28cfbb){logger[_0x3d94('0x33')](_0x28cfbb[_0x3d94('0x3d')]);return _0x598c6a(_0x426ccb[_0x3d94('0x33')](0x1f4,_0x28cfbb));}}logger[_0x3d94('0x33')](_0x3d94('0x49'));return _0x598c6a(_0x426ccb[_0x3d94('0x33')](0x1f4,_0x3d94('0x49')));});},'AbandonInteraction':function(_0x1210b5){var _0x469122=this;return new Promise(function(_0x1fd806,_0x5eba38){if(_0x1210b5[_0x3d94('0x11')]&&_0x1210b5['interaction']&&_0x1210b5[_0x3d94('0x13')]['id']){try{var _0x3a30f7=getId(_0x1210b5[_0x3d94('0x11')],_0x1210b5[_0x3d94('0x12')]?_0x1210b5[_0x3d94('0x12')]['id']:0x0,_0x1210b5[_0x3d94('0x13')]?_0x1210b5[_0x3d94('0x13')]['id']:0x0);if(_0x24e8b9[_0x3d94('0x10')][_0x3a30f7]){_0x24e8b9[_0x3d94('0x10')][_0x3a30f7]['emit']('end');}return _0x1fd806({'code':0xc8,'message':_0x1210b5});}catch(_0x46bff3){logger['error'](_0x46bff3[_0x3d94('0x3d')]);return _0x5eba38(_0x469122[_0x3d94('0x33')](0x1f4,_0x46bff3));}}logger['error'](_0x3d94('0x49'));return _0x5eba38(_0x469122[_0x3d94('0x33')](0x1f4,_0x3d94('0x49')));});},'AgentCapacity':function(_0x467648){var _0xcefff5=this;return new Promise(function(_0x42eb81,_0xd3bb){if(_0x24e8b9['agents'][_0x3d94('0x4a')](_0x467648['id'])){for(var _0x351ea6 in _0x467648[_0x3d94('0x4b')]){if(_0x467648['capacity'][_0x3d94('0x4a')](_0x351ea6)){if(_0x24e8b9[_0x3d94('0x40')][_0x467648['id']][_0x3d94('0x4a')](_0x351ea6+_0x3d94('0x4c'))){_0x24e8b9['agents'][_0x467648['id']][_0x351ea6+'CurrentCapacity']=parseInt(_0x467648[_0x3d94('0x4b')][_0x351ea6],0xa);}}}_0x24e8b9[_0x3d94('0x40')][_0x467648['id']][_0x3d94('0x4d')]();return _0x42eb81({'code':0xc8,'message':_0x24e8b9[_0x3d94('0x40')][_0x467648['id']]});}else{return _0xd3bb(_0xcefff5['error'](0x1f4,_0x3d94('0x4e')));}});},'Agents':function(_0x1c99d1){return new Promise(function(_0x49bfb0){var _0x5ba865=_[_0x3d94('0x4f')](_0x24e8b9[_0x3d94('0x40')]);if(_0x1c99d1&&_0x1c99d1['id']){var _0x4eee2b=_[_0x3d94('0x50')](_0x5ba865,function(_0x227372){return _0x227372['id']===_0x1c99d1['id'];});_0x49bfb0(_0x4eee2b);}else{_0x49bfb0({'count':_0x5ba865[_0x3d94('0x17')],'rows':_0x5ba865});}});},'ChatQueues':function(){return new Promise(function(_0x5747a8){var _0x11eeaa=[];for(var _0x68c033 in _0x24e8b9['chatQueues']){if(_0x24e8b9['chatQueues']['hasOwnProperty'](_0x68c033)){var _0x3ac9ea=_0x24e8b9[_0x3d94('0x51')][_0x68c033];var _0x13544a={'id':_0x3ac9ea['id'],'available':_0x3ac9ea[_0x3d94('0x52')],'loggedIn':_0x3ac9ea[_0x3d94('0x53')],'name':_0x3ac9ea['name'],'paused':_0x3ac9ea[_0x3d94('0x54')],'waiting':_0x3ac9ea[_0x3d94('0x55')]};_0x11eeaa[_0x3d94('0x1f')](_0x13544a);}}_0x5747a8({'count':_0x11eeaa[_0x3d94('0x17')],'rows':_0x11eeaa});});},'MailQueues':function(){return new Promise(function(_0x28d548){var _0x13f475=[];for(var _0x59abcc in _0x24e8b9[_0x3d94('0x56')]){if(_0x24e8b9['mailQueues'][_0x3d94('0x4a')](_0x59abcc)){var _0x41d561=_0x24e8b9[_0x3d94('0x56')][_0x59abcc];var _0x393ac9={'id':_0x41d561['id'],'available':_0x41d561[_0x3d94('0x52')],'loggedIn':_0x41d561[_0x3d94('0x53')],'name':_0x41d561['name'],'paused':_0x41d561['paused'],'waiting':_0x41d561[_0x3d94('0x55')]};_0x13f475['push'](_0x393ac9);}}_0x28d548({'count':_0x13f475['length'],'rows':_0x13f475});});},'OpenchannelQueues':function(){return new Promise(function(_0x5c5fb2){var _0x3c7dc4=[];for(var _0x262a6a in _0x24e8b9[_0x3d94('0x57')]){if(_0x24e8b9[_0x3d94('0x57')][_0x3d94('0x4a')](_0x262a6a)){var _0x2e2fb0=_0x24e8b9[_0x3d94('0x57')][_0x262a6a];var _0x34ecc4={'id':_0x2e2fb0['id'],'available':_0x2e2fb0['available'],'loggedIn':_0x2e2fb0[_0x3d94('0x53')],'name':_0x2e2fb0['name'],'paused':_0x2e2fb0[_0x3d94('0x54')],'waiting':_0x2e2fb0[_0x3d94('0x55')]};_0x3c7dc4[_0x3d94('0x1f')](_0x34ecc4);}}_0x5c5fb2({'count':_0x3c7dc4['length'],'rows':_0x3c7dc4});});},'SmsQueues':function(){return new Promise(function(_0x55084e){var _0x4f0f84=[];for(var _0x426ef5 in _0x24e8b9[_0x3d94('0x58')]){if(_0x24e8b9[_0x3d94('0x58')][_0x3d94('0x4a')](_0x426ef5)){var _0x2382df=_0x24e8b9['smsQueues'][_0x426ef5];var _0x5b7316={'id':_0x2382df['id'],'available':_0x2382df[_0x3d94('0x52')],'loggedIn':_0x2382df[_0x3d94('0x53')],'name':_0x2382df[_0x3d94('0x59')],'paused':_0x2382df['paused'],'waiting':_0x2382df[_0x3d94('0x55')]};_0x4f0f84['push'](_0x5b7316);}}_0x55084e({'count':_0x4f0f84[_0x3d94('0x17')],'rows':_0x4f0f84});});},'FaxQueues':function(){return new Promise(function(_0x5789df){var _0x15adf7=[];for(var _0x12c535 in _0x24e8b9[_0x3d94('0x5a')]){if(_0x24e8b9[_0x3d94('0x5a')][_0x3d94('0x4a')](_0x12c535)){var _0x19476d=_0x24e8b9[_0x3d94('0x5a')][_0x12c535];var _0xf0d4eb={'id':_0x19476d['id'],'available':_0x19476d[_0x3d94('0x52')],'loggedIn':_0x19476d[_0x3d94('0x53')],'name':_0x19476d[_0x3d94('0x59')],'paused':_0x19476d['paused'],'waiting':_0x19476d[_0x3d94('0x55')]};_0x15adf7[_0x3d94('0x1f')](_0xf0d4eb);}}_0x5789df({'count':_0x15adf7[_0x3d94('0x17')],'rows':_0x15adf7});});},'WhatsappQueues':function(){return new Promise(function(_0x14e64b){var _0x501d6f=[];for(var _0x9b282a in _0x24e8b9['whatsappQueues']){if(_0x24e8b9['whatsappQueues'][_0x3d94('0x4a')](_0x9b282a)){var _0x55fed9=_0x24e8b9[_0x3d94('0x5b')][_0x9b282a];var _0x45daa1={'id':_0x55fed9['id'],'available':_0x55fed9['available'],'loggedIn':_0x55fed9[_0x3d94('0x53')],'name':_0x55fed9['name'],'paused':_0x55fed9[_0x3d94('0x54')],'waiting':_0x55fed9[_0x3d94('0x55')]};_0x501d6f['push'](_0x45daa1);}}_0x14e64b({'count':_0x501d6f['length'],'rows':_0x501d6f});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4ceff3){var _0x833d96=_['values'](_0x24e8b9['chatQueuesWaitingInteractions']);_0x4ceff3({'count':_0x833d96[_0x3d94('0x17')],'rows':_0x833d96});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x39ea2a){var _0x184c4b=_[_0x3d94('0x4f')](_0x24e8b9['mailQueuesWaitingInteractions']);_0x39ea2a({'count':_0x184c4b[_0x3d94('0x17')],'rows':_0x184c4b});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3fc0e7){var _0xa0a84c=_[_0x3d94('0x4f')](_0x24e8b9[_0x3d94('0x5c')]);_0x3fc0e7({'count':_0xa0a84c[_0x3d94('0x17')],'rows':_0xa0a84c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x53c0f0){var _0x467ccb=_[_0x3d94('0x4f')](_0x24e8b9[_0x3d94('0x5d')]);_0x53c0f0({'count':_0x467ccb[_0x3d94('0x17')],'rows':_0x467ccb});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x35fee2){var _0x32f5df=_[_0x3d94('0x4f')](_0x24e8b9[_0x3d94('0x5e')]);_0x35fee2({'count':_0x32f5df['length'],'rows':_0x32f5df});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x535d01){var _0x2977ac=_[_0x3d94('0x4f')](_0x24e8b9[_0x3d94('0x5f')]);_0x535d01({'count':_0x2977ac['length'],'rows':_0x2977ac});});}};var _0x43a00e=jayson[_0x3d94('0x60')](_0x14ea5f)[_0x3d94('0x61')]();_0x43a00e['on'](_0x3d94('0x33'),function(_0x860ee5){logger['error'](JSON['stringify'](_0x860ee5));return _0x5d9366(_0x860ee5);});_0x43a00e[_0x3d94('0x62')](0x232c,_0x3d94('0x63'),function(){console[_0x3d94('0x64')](_0x3d94('0x65'),0x232c);return _0x7d6969(_0x3d94('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 78db2d0..1748043 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 _0x1571=['map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','../../../utils/iftime','iftime','../../../config/logger','routing','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop'];(function(_0x276cfd,_0x177ed5){var _0x5a05e6=function(_0x1f9d1d){while(--_0x1f9d1d){_0x276cfd['push'](_0x276cfd['shift']());}};_0x5a05e6(++_0x177ed5);}(_0x1571,0x18e));var _0x1157=function(_0x179b80,_0x440291){_0x179b80=_0x179b80-0x0;var _0x1e8d03=_0x1571[_0x179b80];return _0x1e8d03;};'use strict';var _=require(_0x1157('0x0'));var iftime=require(_0x1157('0x1'))[_0x1157('0x2')];var logger=require(_0x1157('0x3'))(_0x1157('0x4'));exports[_0x1157('0x5')]=function(_0x47377a,_0x4be1ca,_0x3b5d7e){return function(_0x24ee2a){if(_0x3b5d7e[_0x1157('0x6')]&&!_0x3b5d7e['rules'][_0x47377a]){logger[_0x1157('0x7')](_0x1157('0x8'),_0x47377a);return _0x24ee2a[_0x1157('0x9')]();}var _0x45322b=_0x4be1ca[_0x1157('0xa')](function(_0x3ddec5){return iftime(_0x3ddec5);});var _0x2ff034=_[_0x1157('0xb')](_0x45322b);if(_0x2ff034){logger[_0x1157('0x7')](_0x1157('0xc'),_0x47377a,_0x4be1ca[_0x1157('0xd')](_0x1157('0xe')),_0x2ff034);_0x24ee2a[_0x1157('0xf')](_0x2ff034);}else{logger[_0x1157('0x7')](_0x1157('0x10'),_0x47377a,_0x4be1ca[_0x1157('0xd')](_0x1157('0xe')));_0x24ee2a[_0x1157('0x9')]();}};}; \ No newline at end of file +var _0x1065=['lodash','../../../utils/iftime','iftime','../../../config/logger','rules','info','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s'];(function(_0x182cf2,_0x3189bb){var _0xc0293=function(_0x3cc5d3){while(--_0x3cc5d3){_0x182cf2['push'](_0x182cf2['shift']());}};_0xc0293(++_0x3189bb);}(_0x1065,0xd2));var _0x5106=function(_0x179c7f,_0x4aaf89){_0x179c7f=_0x179c7f-0x0;var _0x1ecc87=_0x1065[_0x179c7f];return _0x1ecc87;};'use strict';var _=require(_0x5106('0x0'));var iftime=require(_0x5106('0x1'))[_0x5106('0x2')];var logger=require(_0x5106('0x3'))('routing');exports['condition']=function(_0x2ff1d8,_0x50b971,_0x577d18){return function(_0x1753ef){if(_0x577d18[_0x5106('0x4')]&&!_0x577d18[_0x5106('0x4')][_0x2ff1d8]){logger[_0x5106('0x5')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x2ff1d8);return _0x1753ef[_0x5106('0x6')]();}var _0x2d8f72=_0x50b971[_0x5106('0x7')](function(_0x5ac83c){return iftime(_0x5ac83c);});var _0x26c8db=_[_0x5106('0x8')](_0x2d8f72);if(_0x26c8db){logger[_0x5106('0x5')](_0x5106('0x9'),_0x2ff1d8,_0x50b971[_0x5106('0xa')](_0x5106('0xb')),_0x26c8db);_0x1753ef[_0x5106('0xc')](_0x26c8db);}else{logger[_0x5106('0x5')](_0x5106('0xd'),_0x2ff1d8,_0x50b971[_0x5106('0xa')]('\x20|\x20'));_0x1753ef['stop']();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 6e43ad6..1750eb2 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 _0x0102=['agentringnoanswerAt','now','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','util','./utils','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','format','[%s][agents][agentcalled]','agentcalledAt','connectedlinenum','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','debug','[%s][agents][agentringnoanswer]'];(function(_0x41c773,_0x19f46d){var _0xf1e7d2=function(_0x4d1be5){while(--_0x4d1be5){_0x41c773['push'](_0x41c773['shift']());}};_0xf1e7d2(++_0x19f46d);}(_0x0102,0x186));var _0x2010=function(_0x3b751f,_0x51d8e5){_0x3b751f=_0x3b751f-0x0;var _0x2a01c3=_0x0102[_0x3b751f];return _0x2a01c3;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var utils=require(_0x2010('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x34c31e,_0x9ae519){utils['info'](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x34c31e['uniqueid'],_0x34c31e['channel'],_0x34c31e[_0x2010('0x2')],_0x34c31e[_0x2010('0x3')],_0x34c31e[_0x2010('0x4')],_0x34c31e[_0x2010('0x5')],_0x34c31e['connectedlinenum'],_0x34c31e[_0x2010('0x6')]));if(_0x34c31e['queue']){utils[_0x2010('0x7')](_0x34c31e[_0x2010('0x2')])['then'](function(_0x1f94ca){if(_0x1f94ca){_0x34c31e[_0x2010('0x8')]=_0x1f94ca[_0x2010('0x8')];_0x34c31e[_0x2010('0x9')]=_0x34c31e[_0x2010('0xa')]?_0x1f94ca[_0x2010('0xb')]:![];_0x34c31e[_0x2010('0xc')]=_0x34c31e[_0x2010('0x9')]?_0x1f94ca[_0x2010('0xd')]:0x0;}utils[_0x2010('0xe')](_0x2010('0xf'),_0x34c31e);});}else{utils[_0x2010('0xe')](_0x2010('0xf'),_0x34c31e);}if(_0x9ae519){delete transfers[_0x34c31e[_0x2010('0x10')]];}else{delete agents[_0x34c31e[_0x2010('0x11')]];}}exports[_0x2010('0x12')]=function(_0x528a38){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x14'),_0x528a38[_0x2010('0x10')]),_0x528a38);agents[_0x528a38[_0x2010('0x11')]]=_0x528a38;agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x15')]=utils['now']();agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x6')]='called';agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x16')]=null;agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x17')]=null;utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x19'),_0x528a38[_0x2010('0x10')],agents[_0x528a38[_0x2010('0x11')]]['membername'],_0x528a38['destuniqueid']));}catch(_0x3c72a8){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x14'),_0x528a38['uniqueid']),_0x3c72a8);}};exports['agentringnoanswer']=function(_0x22c252){try{if(!_[_0x2010('0x1b')](agents[_0x22c252[_0x2010('0x11')]])){utils[_0x2010('0x1c')](util[_0x2010('0x13')](_0x2010('0x1d'),_0x22c252['uniqueid']),_0x22c252);utils[_0x2010('0x18')](util[_0x2010('0x13')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x22c252['uniqueid'],agents[_0x22c252['destuniqueid']][_0x2010('0x3')],_0x22c252['destuniqueid']));agents[_0x22c252[_0x2010('0x11')]]['agentringnoanswer']=!![];agents[_0x22c252['destuniqueid']][_0x2010('0x1e')]=utils[_0x2010('0x1f')]();agents[_0x22c252['destuniqueid']][_0x2010('0x6')]='timeout';agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x20')]=_0x2010('0x21');agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x22')]=_0x22c252[_0x2010('0x23')]?parseInt(_0x22c252[_0x2010('0x23')])/0x3e8:0x0;agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x24')]=0x0;unanswered[_0x2010('0x25')](_0x22c252[_0x2010('0x11')]);}}catch(_0x2ebdbb){utils['error'](util[_0x2010('0x13')]('[%s][agents][agentringnoanswer]',_0x22c252[_0x2010('0x10')]),_0x2ebdbb);}};exports[_0x2010('0x26')]=function(_0xd16c04){try{_[_0x2010('0x27')](agents,function(_0x564a64,_0x554f66){if(_0x564a64[_0x2010('0x10')]==_0xd16c04['uniqueid']&&!_[_0x2010('0x28')](unanswered,_0x564a64[_0x2010('0x11')])){utils['debug'](util[_0x2010('0x13')](_0x2010('0x29'),_0xd16c04[_0x2010('0x10')]),_0xd16c04);utils[_0x2010('0x18')](util[_0x2010('0x13')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xd16c04[_0x2010('0x10')],_0x564a64[_0x2010('0x3')],_0x564a64[_0x2010('0x11')]));_0x564a64['agentringnoanswer']=!![];_0x564a64['agentringnoanswerAt']=utils[_0x2010('0x1f')]();_0x564a64[_0x2010('0x6')]=_0x2010('0x2a');_0x564a64['reason']='abandoned';_0x564a64[_0x2010('0x22')]=_0xd16c04[_0x2010('0x22')];_0x564a64[_0x2010('0x24')]=0x0;writeDB(_0x564a64);}});}catch(_0x339fd2){utils[_0x2010('0x1a')](util['format']('[%s][agents][queuecallerabandon]',_0xd16c04['uniqueid']),_0x339fd2);}};exports[_0x2010('0x2b')]=function(_0x447eed){try{if(agents[_0x447eed[_0x2010('0x11')]]){utils['debug'](util[_0x2010('0x13')](_0x2010('0x2c'),_0x447eed[_0x2010('0x10')]),_0x447eed);utils[_0x2010('0x18')](util['format'](_0x2010('0x2d'),_0x447eed[_0x2010('0x10')],agents[_0x447eed[_0x2010('0x11')]]['membername'],_0x447eed[_0x2010('0x11')]));agents[_0x447eed['destuniqueid']][_0x2010('0x2e')]=utils[_0x2010('0x1f')]();agents[_0x447eed[_0x2010('0x11')]][_0x2010('0x16')]=_0x447eed[_0x2010('0x16')];agents[_0x447eed[_0x2010('0x11')]]['connectedlinename']=_0x447eed[_0x2010('0x17')];agents[_0x447eed['destuniqueid']][_0x2010('0x22')]=_0x447eed[_0x2010('0x23')];agents[_0x447eed[_0x2010('0x11')]][_0x2010('0x6')]=_0x2010('0x2f');_[_0x2010('0x27')](agents,function(_0x398f10,_0x36ff3e){if(_0x398f10[_0x2010('0x11')]!=_0x447eed[_0x2010('0x11')]&&_0x398f10[_0x2010('0x10')]==_0x447eed[_0x2010('0x10')]){_0x398f10[_0x2010('0x24')]=0x0;_0x398f10[_0x2010('0x22')]=_0x447eed['ringtime'];_0x398f10['agentringnoanswer']=!![];_0x398f10[_0x2010('0x1e')]=utils[_0x2010('0x1f')]();_0x398f10[_0x2010('0x6')]=_0x2010('0x30');_0x398f10[_0x2010('0x20')]=_0x2010('0x30');_0x398f10[_0x2010('0x31')]=_0x447eed['destuniqueid'];_0x398f10[_0x2010('0x32')]=_0x447eed['membername'];writeDB(_0x398f10);}});}}catch(_0x27fd64){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x2c'),_0x447eed[_0x2010('0x10')]),_0x27fd64);}};exports['agentcomplete']=function(_0x364338){try{if(!_[_0x2010('0x1b')](agents[_0x364338[_0x2010('0x11')]])){utils[_0x2010('0x1c')](util['format'](_0x2010('0x33'),_0x364338['uniqueid']),_0x364338);utils['info'](util['format'](_0x2010('0x34'),_0x364338[_0x2010('0x10')],agents[_0x364338[_0x2010('0x11')]][_0x2010('0x3')],_0x364338[_0x2010('0x11')]));agents[_0x364338[_0x2010('0x11')]]['agentcomplete']=!![];agents[_0x364338[_0x2010('0x11')]][_0x2010('0x35')]=utils[_0x2010('0x1f')]();agents[_0x364338['destuniqueid']]['talktime']=utils[_0x2010('0x36')](agents[_0x364338['destuniqueid']][_0x2010('0x35')],agents[_0x364338[_0x2010('0x11')]][_0x2010('0x2e')]);agents[_0x364338[_0x2010('0x11')]]['reason']=_0x364338[_0x2010('0x20')];agents[_0x364338[_0x2010('0x11')]][_0x2010('0x6')]=_0x2010('0x37');writeDB(agents[_0x364338[_0x2010('0x11')]]);}}catch(_0x2a53b3){utils['error'](util[_0x2010('0x13')](_0x2010('0x33'),_0x364338[_0x2010('0x10')]),_0x2a53b3);}};exports['blindtransfer']=function(_0x30e5d0){try{if(!_[_0x2010('0x1b')](agents[_0x30e5d0['transfereruniqueid']])){utils[_0x2010('0x1c')](util[_0x2010('0x13')](_0x2010('0x38'),_0x30e5d0[_0x2010('0x10')]),_0x30e5d0);utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x39'),_0x30e5d0[_0x2010('0x10')],agents[_0x30e5d0['transfereruniqueid']]['membername'],agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x10')]));agents[_0x30e5d0['transfereruniqueid']][_0x2010('0x3b')]=!![];agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x3c')]=_0x2010('0x3d');agents[_0x30e5d0[_0x2010('0x3a')]]['transferexten']=_0x30e5d0['extension'];agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x3e')]=agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x10')];}}catch(_0x38e596){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x38'),_0x30e5d0[_0x2010('0x10')]),_0x38e596);}};exports[_0x2010('0x3f')]=function(_0x1cc164){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x40'),_0x1cc164['origtransfereruniqueid']),_0x1cc164);if(_0x1cc164[_0x2010('0x41')]==_0x1cc164[_0x2010('0x42')]){if(!_[_0x2010('0x1b')](agents[_0x1cc164[_0x2010('0x43')]])){utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x44'),_0x1cc164[_0x2010('0x41')],agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3')]));agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3b')]=!![];agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3c')]=_0x2010('0x45');agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x46')]=_0x1cc164[_0x2010('0x47')];agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3e')]=_0x1cc164[_0x2010('0x41')];}if(_0x1cc164[_0x2010('0x48')]&&agents[_0x1cc164[_0x2010('0x48')]]){agents[_0x1cc164['transfereeuniqueid']][_0x2010('0x49')]=0x1;transfers[_0x1cc164['transfereeuniqueid']]=_['clone'](agents[_0x1cc164[_0x2010('0x48')]]);transfers[_0x1cc164[_0x2010('0x48')]]['calleridnum']=agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x5')];transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x4a')]=agents[_0x1cc164['secondtransfereruniqueid']][_0x2010('0x4a')];transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x15')]=utils[_0x2010('0x1f')]();transfers[_0x1cc164['transfereeuniqueid']][_0x2010('0x2e')]=utils['now']();transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x22')]=0x0;transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x49')]=0x2;}}else if(_0x1cc164['secondtransfereruniqueid']==_0x1cc164['secondtransfererlinkedid']){if(!_[_0x2010('0x1b')](agents[_0x1cc164[_0x2010('0x41')]])){utils['info'](util['format'](_0x2010('0x44'),_0x1cc164[_0x2010('0x41')],agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x3')]));agents[_0x1cc164['origtransfereruniqueid']][_0x2010('0x3b')]=!![];agents[_0x1cc164['origtransfereruniqueid']][_0x2010('0x3c')]=_0x2010('0x45');agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x46')]=_0x1cc164['secondtransfererexten'];agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x3e')]=_0x1cc164['secondtransfereruniqueid'];}if(_0x1cc164[_0x2010('0x4b')]&&agents[_0x1cc164[_0x2010('0x4b')]]){agents[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x49')]=0x1;transfers[_0x1cc164[_0x2010('0x4b')]]=_[_0x2010('0x4c')](agents[_0x1cc164[_0x2010('0x4b')]]);transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x5')]=agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x5')];transfers[_0x1cc164[_0x2010('0x4b')]]['calleridname']=agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x4a')];transfers[_0x1cc164[_0x2010('0x4b')]]['agentcalledAt']=utils['now']();transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x2e')]=utils[_0x2010('0x1f')]();transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x22')]=0x0;transfers[_0x1cc164[_0x2010('0x4b')]]['agententerreason']=0x2;}}}catch(_0xe37cef){utils[_0x2010('0x1a')](util[_0x2010('0x13')]('[%s][agents][attendedtransfer]',_0x1cc164[_0x2010('0x41')]),_0xe37cef);}};exports[_0x2010('0x4d')]=function(_0x13d06d){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x4e'),_0x13d06d['uniqueid']),_0x13d06d);if(agents[_0x13d06d['uniqueid']]&&agents[_0x13d06d[_0x2010('0x10')]]['reason']==='timeout'){if(_0x13d06d[_0x2010('0x4f')]==='21'){agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')]=_0x2010('0x50');agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]=_0x2010('0x50');}utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d['uniqueid'],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x3')],agents[_0x13d06d['uniqueid']][_0x2010('0x20')],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]));writeDB(agents[_0x13d06d[_0x2010('0x10')]]);var _0x517afa=unanswered[_0x2010('0x52')](_0x13d06d[_0x2010('0x10')]);if(_0x517afa>-0x1){unanswered['splice'](_0x517afa,0x1);}}if(transfers[_0x13d06d['uniqueid']]){transfers[_0x13d06d[_0x2010('0x10')]]['agentcomplete']=!![];transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x35')]=utils[_0x2010('0x1f')]();transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x24')]=utils[_0x2010('0x36')](transfers[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt'],transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x2e')]);transfers[_0x13d06d[_0x2010('0x10')]]['reason']=_0x2010('0x53');transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]=_0x2010('0x37');utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d[_0x2010('0x10')],transfers[_0x13d06d['uniqueid']][_0x2010('0x3')],transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')],transfers[_0x13d06d['uniqueid']][_0x2010('0x6')]));writeDB(transfers[_0x13d06d[_0x2010('0x10')]],!![]);}if(agents[_0x13d06d['uniqueid']]&&agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x2e')]){agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0xa')]=!![];agents[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt']=utils[_0x2010('0x1f')]();agents[_0x13d06d[_0x2010('0x10')]]['talktime']=utils[_0x2010('0x36')](agents[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt'],agents[_0x13d06d[_0x2010('0x10')]]['agentconnectAt']);agents[_0x13d06d['uniqueid']][_0x2010('0x20')]=agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x3b')]?_0x2010('0x3b'):_0x2010('0x53');agents[_0x13d06d[_0x2010('0x10')]]['lastevent']=_0x2010('0x37');utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d['uniqueid'],agents[_0x13d06d[_0x2010('0x10')]]['membername'],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]));writeDB(agents[_0x13d06d['uniqueid']]);}}catch(_0x496280){utils['error'](util[_0x2010('0x13')]('[%s][agents][hangup]',_0x13d06d[_0x2010('0x10')]),_0x496280);}}; \ No newline at end of file +var _0xbc9d=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','lodash','util','./utils','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','debug','format','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','timeout','reason','ringtime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','talktime','answered_elsewhere','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected'];(function(_0x591a16,_0xefbc1d){var _0x2106a9=function(_0x18e592){while(--_0x18e592){_0x591a16['push'](_0x591a16['shift']());}};_0x2106a9(++_0xefbc1d);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x2b2606,_0x1954d9){_0x2b2606=_0x2b2606-0x0;var _0x333503=_0xbc9d[_0x2b2606];return _0x333503;};'use strict';var _=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var utils=require(_0xdbc9('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x434f6e,_0x35f89c){utils['info'](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x434f6e[_0xdbc9('0x3')],_0x434f6e[_0xdbc9('0x4')],_0x434f6e[_0xdbc9('0x5')],_0x434f6e[_0xdbc9('0x6')],_0x434f6e[_0xdbc9('0x7')],_0x434f6e[_0xdbc9('0x8')],_0x434f6e[_0xdbc9('0x9')],_0x434f6e['lastevent']));if(_0x434f6e[_0xdbc9('0x5')]){utils[_0xdbc9('0xa')](_0x434f6e[_0xdbc9('0x5')])['then'](function(_0x2c7ba5){if(_0x2c7ba5){_0x434f6e['type']=_0x2c7ba5['type'];_0x434f6e[_0xdbc9('0xb')]=_0x434f6e[_0xdbc9('0xc')]?_0x2c7ba5[_0xdbc9('0xd')]:![];_0x434f6e[_0xdbc9('0xe')]=_0x434f6e['agentacw']?_0x2c7ba5[_0xdbc9('0xf')]:0x0;}utils[_0xdbc9('0x10')](_0xdbc9('0x11'),_0x434f6e);});}else{utils[_0xdbc9('0x10')](_0xdbc9('0x11'),_0x434f6e);}if(_0x35f89c){delete transfers[_0x434f6e[_0xdbc9('0x3')]];}else{delete agents[_0x434f6e['destuniqueid']];}}exports['agentcalled']=function(_0x3d0fdd){try{utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x14'),_0x3d0fdd[_0xdbc9('0x3')]),_0x3d0fdd);agents[_0x3d0fdd['destuniqueid']]=_0x3d0fdd;agents[_0x3d0fdd[_0xdbc9('0x15')]][_0xdbc9('0x16')]=utils[_0xdbc9('0x17')]();agents[_0x3d0fdd['destuniqueid']][_0xdbc9('0x18')]=_0xdbc9('0x19');agents[_0x3d0fdd['destuniqueid']][_0xdbc9('0x9')]=null;agents[_0x3d0fdd[_0xdbc9('0x15')]][_0xdbc9('0x1a')]=null;utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')](_0xdbc9('0x1c'),_0x3d0fdd[_0xdbc9('0x3')],agents[_0x3d0fdd[_0xdbc9('0x15')]][_0xdbc9('0x6')],_0x3d0fdd[_0xdbc9('0x15')]));}catch(_0x57a546){utils[_0xdbc9('0x1d')](util['format'](_0xdbc9('0x14'),_0x3d0fdd[_0xdbc9('0x3')]),_0x57a546);}};exports['agentringnoanswer']=function(_0x4408e9){try{if(!_['isNil'](agents[_0x4408e9['destuniqueid']])){utils['debug'](util['format'](_0xdbc9('0x1e'),_0x4408e9[_0xdbc9('0x3')]),_0x4408e9);utils['info'](util[_0xdbc9('0x13')](_0xdbc9('0x1f'),_0x4408e9['uniqueid'],agents[_0x4408e9[_0xdbc9('0x15')]][_0xdbc9('0x6')],_0x4408e9[_0xdbc9('0x15')]));agents[_0x4408e9[_0xdbc9('0x15')]][_0xdbc9('0x20')]=!![];agents[_0x4408e9[_0xdbc9('0x15')]][_0xdbc9('0x21')]=utils[_0xdbc9('0x17')]();agents[_0x4408e9[_0xdbc9('0x15')]]['lastevent']=_0xdbc9('0x22');agents[_0x4408e9[_0xdbc9('0x15')]][_0xdbc9('0x23')]=_0xdbc9('0x22');agents[_0x4408e9[_0xdbc9('0x15')]]['holdtime']=_0x4408e9[_0xdbc9('0x24')]?parseInt(_0x4408e9[_0xdbc9('0x24')])/0x3e8:0x0;agents[_0x4408e9['destuniqueid']]['talktime']=0x0;unanswered[_0xdbc9('0x25')](_0x4408e9[_0xdbc9('0x15')]);}}catch(_0x473430){utils['error'](util[_0xdbc9('0x13')]('[%s][agents][agentringnoanswer]',_0x4408e9['uniqueid']),_0x473430);}};exports[_0xdbc9('0x26')]=function(_0x49da36){try{_['forIn'](agents,function(_0x417b17,_0x20eb4f){if(_0x417b17[_0xdbc9('0x3')]==_0x49da36['uniqueid']&&!_[_0xdbc9('0x27')](unanswered,_0x417b17[_0xdbc9('0x15')])){utils['debug'](util['format'](_0xdbc9('0x28'),_0x49da36[_0xdbc9('0x3')]),_0x49da36);utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')](_0xdbc9('0x29'),_0x49da36[_0xdbc9('0x3')],_0x417b17[_0xdbc9('0x6')],_0x417b17['destuniqueid']));_0x417b17[_0xdbc9('0x20')]=!![];_0x417b17[_0xdbc9('0x21')]=utils[_0xdbc9('0x17')]();_0x417b17[_0xdbc9('0x18')]=_0xdbc9('0x2a');_0x417b17[_0xdbc9('0x23')]='abandoned';_0x417b17[_0xdbc9('0x2b')]=_0x49da36['holdtime'];_0x417b17['talktime']=0x0;writeDB(_0x417b17);}});}catch(_0x495c0e){utils['error'](util['format'](_0xdbc9('0x28'),_0x49da36[_0xdbc9('0x3')]),_0x495c0e);}};exports[_0xdbc9('0x2c')]=function(_0x5527fc){try{if(agents[_0x5527fc[_0xdbc9('0x15')]]){utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x2d'),_0x5527fc[_0xdbc9('0x3')]),_0x5527fc);utils[_0xdbc9('0x1b')](util['format'](_0xdbc9('0x2e'),_0x5527fc[_0xdbc9('0x3')],agents[_0x5527fc[_0xdbc9('0x15')]]['membername'],_0x5527fc[_0xdbc9('0x15')]));agents[_0x5527fc[_0xdbc9('0x15')]][_0xdbc9('0x2f')]=utils[_0xdbc9('0x17')]();agents[_0x5527fc['destuniqueid']]['connectedlinenum']=_0x5527fc[_0xdbc9('0x9')];agents[_0x5527fc[_0xdbc9('0x15')]][_0xdbc9('0x1a')]=_0x5527fc[_0xdbc9('0x1a')];agents[_0x5527fc['destuniqueid']][_0xdbc9('0x2b')]=_0x5527fc[_0xdbc9('0x24')];agents[_0x5527fc[_0xdbc9('0x15')]]['lastevent']=_0xdbc9('0x30');_[_0xdbc9('0x31')](agents,function(_0x444219,_0x523c79){if(_0x444219[_0xdbc9('0x15')]!=_0x5527fc[_0xdbc9('0x15')]&&_0x444219['uniqueid']==_0x5527fc['uniqueid']){_0x444219[_0xdbc9('0x32')]=0x0;_0x444219[_0xdbc9('0x2b')]=_0x5527fc[_0xdbc9('0x24')];_0x444219[_0xdbc9('0x20')]=!![];_0x444219['agentringnoanswerAt']=utils[_0xdbc9('0x17')]();_0x444219[_0xdbc9('0x18')]='answered_elsewhere';_0x444219[_0xdbc9('0x23')]=_0xdbc9('0x33');_0x444219['answeredelsewheredestinationuniqueid']=_0x5527fc[_0xdbc9('0x15')];_0x444219[_0xdbc9('0x34')]=_0x5527fc[_0xdbc9('0x6')];writeDB(_0x444219);}});}}catch(_0x3415c3){utils[_0xdbc9('0x1d')](util[_0xdbc9('0x13')](_0xdbc9('0x2d'),_0x5527fc['uniqueid']),_0x3415c3);}};exports['agentcomplete']=function(_0x768856){try{if(!_[_0xdbc9('0x35')](agents[_0x768856[_0xdbc9('0x15')]])){utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x36'),_0x768856[_0xdbc9('0x3')]),_0x768856);utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')](_0xdbc9('0x37'),_0x768856[_0xdbc9('0x3')],agents[_0x768856['destuniqueid']]['membername'],_0x768856[_0xdbc9('0x15')]));agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0xc')]=!![];agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x38')]=utils[_0xdbc9('0x17')]();agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x32')]=utils['diffTime'](agents[_0x768856['destuniqueid']][_0xdbc9('0x38')],agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x2f')]);agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x23')]=_0x768856[_0xdbc9('0x23')];agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x18')]=_0xdbc9('0x39');writeDB(agents[_0x768856['destuniqueid']]);}}catch(_0x2c24a9){utils[_0xdbc9('0x1d')](util['format']('[%s][agents][agentcomplete]',_0x768856[_0xdbc9('0x3')]),_0x2c24a9);}};exports[_0xdbc9('0x3a')]=function(_0x133a13){try{if(!_['isNil'](agents[_0x133a13[_0xdbc9('0x3b')]])){utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x3c'),_0x133a13['uniqueid']),_0x133a13);utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')](_0xdbc9('0x3d'),_0x133a13[_0xdbc9('0x3')],agents[_0x133a13['transfereruniqueid']][_0xdbc9('0x6')],agents[_0x133a13[_0xdbc9('0x3b')]][_0xdbc9('0x3')]));agents[_0x133a13[_0xdbc9('0x3b')]][_0xdbc9('0x3e')]=!![];agents[_0x133a13[_0xdbc9('0x3b')]][_0xdbc9('0x3f')]=_0xdbc9('0x40');agents[_0x133a13['transfereruniqueid']][_0xdbc9('0x41')]=_0x133a13['extension'];agents[_0x133a13[_0xdbc9('0x3b')]][_0xdbc9('0x42')]=agents[_0x133a13['transfereruniqueid']]['uniqueid'];}}catch(_0xc7335d){utils['error'](util[_0xdbc9('0x13')](_0xdbc9('0x3c'),_0x133a13[_0xdbc9('0x3')]),_0xc7335d);}};exports['attendedtransfer']=function(_0x32b38d){try{utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x43'),_0x32b38d[_0xdbc9('0x44')]),_0x32b38d);if(_0x32b38d[_0xdbc9('0x44')]==_0x32b38d[_0xdbc9('0x45')]){if(!_[_0xdbc9('0x35')](agents[_0x32b38d['secondtransfereruniqueid']])){utils['info'](util['format'](_0xdbc9('0x46'),_0x32b38d[_0xdbc9('0x44')],agents[_0x32b38d[_0xdbc9('0x47')]]['membername']));agents[_0x32b38d['secondtransfereruniqueid']][_0xdbc9('0x3e')]=!![];agents[_0x32b38d[_0xdbc9('0x47')]]['transfertype']='ATTENDED';agents[_0x32b38d[_0xdbc9('0x47')]][_0xdbc9('0x41')]=_0x32b38d[_0xdbc9('0x48')];agents[_0x32b38d[_0xdbc9('0x47')]][_0xdbc9('0x42')]=_0x32b38d[_0xdbc9('0x44')];}if(_0x32b38d['transfereeuniqueid']&&agents[_0x32b38d[_0xdbc9('0x49')]]){agents[_0x32b38d[_0xdbc9('0x49')]][_0xdbc9('0x4a')]=0x1;transfers[_0x32b38d['transfereeuniqueid']]=_[_0xdbc9('0x4b')](agents[_0x32b38d[_0xdbc9('0x49')]]);transfers[_0x32b38d[_0xdbc9('0x49')]]['calleridnum']=agents[_0x32b38d[_0xdbc9('0x47')]]['calleridnum'];transfers[_0x32b38d[_0xdbc9('0x49')]][_0xdbc9('0x4c')]=agents[_0x32b38d[_0xdbc9('0x47')]][_0xdbc9('0x4c')];transfers[_0x32b38d[_0xdbc9('0x49')]][_0xdbc9('0x16')]=utils['now']();transfers[_0x32b38d[_0xdbc9('0x49')]]['agentconnectAt']=utils[_0xdbc9('0x17')]();transfers[_0x32b38d[_0xdbc9('0x49')]]['holdtime']=0x0;transfers[_0x32b38d[_0xdbc9('0x49')]][_0xdbc9('0x4a')]=0x2;}}else if(_0x32b38d['secondtransfereruniqueid']==_0x32b38d['secondtransfererlinkedid']){if(!_[_0xdbc9('0x35')](agents[_0x32b38d[_0xdbc9('0x44')]])){utils[_0xdbc9('0x1b')](util['format'](_0xdbc9('0x46'),_0x32b38d[_0xdbc9('0x44')],agents[_0x32b38d['origtransfereruniqueid']][_0xdbc9('0x6')]));agents[_0x32b38d[_0xdbc9('0x44')]]['transfer']=!![];agents[_0x32b38d['origtransfereruniqueid']][_0xdbc9('0x3f')]=_0xdbc9('0x4d');agents[_0x32b38d[_0xdbc9('0x44')]][_0xdbc9('0x41')]=_0x32b38d[_0xdbc9('0x4e')];agents[_0x32b38d[_0xdbc9('0x44')]][_0xdbc9('0x42')]=_0x32b38d[_0xdbc9('0x47')];}if(_0x32b38d['transfertargetuniqueid']&&agents[_0x32b38d[_0xdbc9('0x4f')]]){agents[_0x32b38d[_0xdbc9('0x4f')]][_0xdbc9('0x4a')]=0x1;transfers[_0x32b38d[_0xdbc9('0x4f')]]=_[_0xdbc9('0x4b')](agents[_0x32b38d[_0xdbc9('0x4f')]]);transfers[_0x32b38d[_0xdbc9('0x4f')]][_0xdbc9('0x8')]=agents[_0x32b38d['origtransfereruniqueid']][_0xdbc9('0x8')];transfers[_0x32b38d['transfertargetuniqueid']][_0xdbc9('0x4c')]=agents[_0x32b38d['origtransfereruniqueid']][_0xdbc9('0x4c')];transfers[_0x32b38d[_0xdbc9('0x4f')]]['agentcalledAt']=utils['now']();transfers[_0x32b38d['transfertargetuniqueid']][_0xdbc9('0x2f')]=utils[_0xdbc9('0x17')]();transfers[_0x32b38d[_0xdbc9('0x4f')]]['holdtime']=0x0;transfers[_0x32b38d[_0xdbc9('0x4f')]][_0xdbc9('0x4a')]=0x2;}}}catch(_0x53843c){utils[_0xdbc9('0x1d')](util[_0xdbc9('0x13')](_0xdbc9('0x43'),_0x32b38d[_0xdbc9('0x44')]),_0x53843c);}};exports[_0xdbc9('0x50')]=function(_0xfdfb20){try{utils['debug'](util[_0xdbc9('0x13')](_0xdbc9('0x51'),_0xfdfb20['uniqueid']),_0xfdfb20);if(agents[_0xfdfb20['uniqueid']]&&agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x23')]===_0xdbc9('0x22')){if(_0xfdfb20[_0xdbc9('0x52')]==='21'){agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x23')]=_0xdbc9('0x53');agents[_0xfdfb20['uniqueid']][_0xdbc9('0x18')]=_0xdbc9('0x53');}utils[_0xdbc9('0x1b')](util['format'](_0xdbc9('0x54'),_0xfdfb20[_0xdbc9('0x3')],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x6')],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x23')],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x18')]));writeDB(agents[_0xfdfb20[_0xdbc9('0x3')]]);var _0x1afbcd=unanswered[_0xdbc9('0x55')](_0xfdfb20[_0xdbc9('0x3')]);if(_0x1afbcd>-0x1){unanswered['splice'](_0x1afbcd,0x1);}}if(transfers[_0xfdfb20['uniqueid']]){transfers[_0xfdfb20[_0xdbc9('0x3')]]['agentcomplete']=!![];transfers[_0xfdfb20['uniqueid']][_0xdbc9('0x38')]=utils[_0xdbc9('0x17')]();transfers[_0xfdfb20[_0xdbc9('0x3')]]['talktime']=utils[_0xdbc9('0x56')](transfers[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x38')],transfers[_0xfdfb20['uniqueid']][_0xdbc9('0x2f')]);transfers[_0xfdfb20[_0xdbc9('0x3')]]['reason']=_0xdbc9('0x57');transfers[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x18')]=_0xdbc9('0x39');utils[_0xdbc9('0x1b')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xfdfb20[_0xdbc9('0x3')],transfers[_0xfdfb20[_0xdbc9('0x3')]]['membername'],transfers[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x23')],transfers[_0xfdfb20[_0xdbc9('0x3')]]['lastevent']));writeDB(transfers[_0xfdfb20[_0xdbc9('0x3')]],!![]);}if(agents[_0xfdfb20[_0xdbc9('0x3')]]&&agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x2f')]){agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0xc')]=!![];agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x38')]=utils['now']();agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x32')]=utils[_0xdbc9('0x56')](agents[_0xfdfb20[_0xdbc9('0x3')]]['agentcompleteAt'],agents[_0xfdfb20[_0xdbc9('0x3')]]['agentconnectAt']);agents[_0xfdfb20['uniqueid']][_0xdbc9('0x23')]=agents[_0xfdfb20[_0xdbc9('0x3')]]['transfer']?_0xdbc9('0x3e'):_0xdbc9('0x57');agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x18')]=_0xdbc9('0x39');utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xfdfb20['uniqueid'],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x6')],agents[_0xfdfb20[_0xdbc9('0x3')]]['reason'],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x18')]));writeDB(agents[_0xfdfb20[_0xdbc9('0x3')]]);}}catch(_0x1839e4){utils[_0xdbc9('0x1d')](util[_0xdbc9('0x13')](_0xdbc9('0x51'),_0xfdfb20[_0xdbc9('0x3')]),_0x1839e4);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index d2fec54..2335dd8 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 _0xca35=['lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','./utils','FAILED','NO\x20ANSWER','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','debug','[%s][calls][newchannel]','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','context','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','ANSWERED','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','transfertargetchannel','origtransfererchannel','_attended','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','set','toLowerCase','cdr','substring'];(function(_0x508c10,_0x5a15f0){var _0x3108b5=function(_0x4bccaa){while(--_0x4bccaa){_0x508c10['push'](_0x508c10['shift']());}};_0x3108b5(++_0x5a15f0);}(_0xca35,0x1aa));var _0x5ca3=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0xca35[_0x5b34c0];return _0x242bd3;};'use strict';var _=require(_0x5ca3('0x0'));var util=require('util');var utils=require(_0x5ca3('0x1'));var dispositions=['NO\x20ANSWER',_0x5ca3('0x2'),'FAILED',_0x5ca3('0x3'),_0x5ca3('0x3'),_0x5ca3('0x3'),'ANSWERED',_0x5ca3('0x4'),_0x5ca3('0x2'),'FAILED',_0x5ca3('0x2')];var channels={};function writeDB(_0x5f4ee8){utils[_0x5ca3('0x5')](util['format'](_0x5ca3('0x6'),_0x5f4ee8['uniqueid'],_0x5f4ee8[_0x5ca3('0x7')],_0x5f4ee8[_0x5ca3('0x8')],_0x5f4ee8[_0x5ca3('0x9')],_0x5f4ee8[_0x5ca3('0xa')],_0x5f4ee8[_0x5ca3('0xb')],_0x5f4ee8[_0x5ca3('0xc')],_0x5f4ee8[_0x5ca3('0xd')]));if(_0x5f4ee8[_0x5ca3('0xe')]){utils['getUserByInternal'](_0x5f4ee8['accountcode'])[_0x5ca3('0xf')](function(_0x5dd622){if(_0x5dd622){_0x5f4ee8[_0x5ca3('0x10')]=_0x5dd622['id'];}utils[_0x5ca3('0x11')](_0x5ca3('0x12'),_0x5f4ee8);});}else{utils['request'](_0x5ca3('0x12'),_0x5f4ee8);}if(channels[_0x5f4ee8[_0x5ca3('0x13')]]){delete channels[_0x5f4ee8[_0x5ca3('0x13')]];}}exports[_0x5ca3('0x14')]=function(_0x1dbec9){try{utils[_0x5ca3('0x15')](util['format'](_0x5ca3('0x16'),_0x1dbec9[_0x5ca3('0x13')]),_0x1dbec9);if(_0x1dbec9['uniqueid']==_0x1dbec9['linkedid']&&_0x1dbec9[_0x5ca3('0x7')]!='OutgoingSpoolFailed'){utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')](_0x5ca3('0x18'),_0x1dbec9[_0x5ca3('0x13')],_0x1dbec9['context'],_0x1dbec9[_0x5ca3('0x19')]));channels[_0x1dbec9[_0x5ca3('0x13')]]={'uniqueid':_0x1dbec9[_0x5ca3('0x13')],'accountcode':_0x1dbec9[_0x5ca3('0xe')],'source':_0x1dbec9[_0x5ca3('0xb')],'destination':_0x1dbec9[_0x5ca3('0x19')],'destinationcontext':_0x1dbec9['context'],'channel':_0x1dbec9['channel'],'starttime':utils[_0x5ca3('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x5ca3('0x1b')};}}catch(_0x3be43d){utils[_0x5ca3('0x1c')](util[_0x5ca3('0x17')](_0x5ca3('0x16'),_0x1dbec9[_0x5ca3('0x13')]),_0x3be43d);}};exports[_0x5ca3('0x1d')]=function(_0x582a38){try{utils[_0x5ca3('0x15')](util[_0x5ca3('0x17')](_0x5ca3('0x1e'),_0x582a38[_0x5ca3('0x13')]),_0x582a38);if(!_[_0x5ca3('0x1f')](channels[_0x582a38['uniqueid']])&&_0x582a38[_0x5ca3('0x20')]==0x6){utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x582a38[_0x5ca3('0x13')],_0x582a38[_0x5ca3('0x21')],_0x582a38[_0x5ca3('0x7')]));if(_[_0x5ca3('0x1f')](channels[_0x582a38[_0x5ca3('0x13')]][_0x5ca3('0x22')])){channels[_0x582a38[_0x5ca3('0x13')]]['systemanswertime']=utils[_0x5ca3('0x1a')]();}}else if(!_[_0x5ca3('0x1f')](channels[_0x582a38['linkedid']])&&_0x582a38['channelstate']==0x6&&_0x582a38['context']!=_0x5ca3('0x23')){utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')](_0x5ca3('0x24'),_0x582a38[_0x5ca3('0x13')],_0x582a38['linkedid'],_0x582a38['context'],_0x582a38[_0x5ca3('0x7')]));channels[_0x582a38['linkedid']][_0x5ca3('0xe')]=_0x582a38[_0x5ca3('0xe')];channels[_0x582a38[_0x5ca3('0x25')]][_0x5ca3('0x26')]=_0x582a38[_0x5ca3('0x7')];if(_['isNil'](channels[_0x582a38[_0x5ca3('0x25')]][_0x5ca3('0x27')])){channels[_0x582a38[_0x5ca3('0x25')]]['answertime']=utils[_0x5ca3('0x1a')]();}channels[_0x582a38['linkedid']]['disposition']=dispositions[_['toNumber'](_0x582a38[_0x5ca3('0x20')])]||_0x5ca3('0x28');}}catch(_0x28bba7){utils['error'](util[_0x5ca3('0x17')]('[%s][calls][newstate]',_0x582a38['uniqueid']),_0x28bba7);}};exports['hangup']=function(_0x55abd0){try{if(!_['isNil'](channels[_0x55abd0[_0x5ca3('0x13')]])){utils[_0x5ca3('0x15')](util[_0x5ca3('0x17')](_0x5ca3('0x29'),_0x55abd0[_0x5ca3('0x13')]),_0x55abd0);if(_[_0x5ca3('0x1f')](channels[_0x55abd0[_0x5ca3('0x13')]][_0x5ca3('0x2a')])){channels[_0x55abd0[_0x5ca3('0x13')]]['callerid']=_0x55abd0['calleridname']+'\x20<'+_0x55abd0[_0x5ca3('0xb')]+'>';}utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')](_0x5ca3('0x2b'),_0x55abd0[_0x5ca3('0x13')],channels[_0x55abd0[_0x5ca3('0x13')]][_0x5ca3('0x2a')],_0x55abd0[_0x5ca3('0x2c')]));channels[_0x55abd0[_0x5ca3('0x13')]]['endtime']=utils[_0x5ca3('0x1a')]();channels[_0x55abd0[_0x5ca3('0x13')]][_0x5ca3('0x2d')]=utils[_0x5ca3('0x2e')](channels[_0x55abd0[_0x5ca3('0x13')]][_0x5ca3('0x2f')],channels[_0x55abd0[_0x5ca3('0x13')]][_0x5ca3('0x30')]);channels[_0x55abd0['uniqueid']][_0x5ca3('0x31')]=channels[_0x55abd0[_0x5ca3('0x13')]]['answertime']?utils[_0x5ca3('0x2e')](channels[_0x55abd0[_0x5ca3('0x13')]][_0x5ca3('0x2f')],channels[_0x55abd0[_0x5ca3('0x13')]][_0x5ca3('0x27')]):0x0;writeDB(channels[_0x55abd0[_0x5ca3('0x13')]]);}}catch(_0x74a227){utils[_0x5ca3('0x1c')](util[_0x5ca3('0x17')](_0x5ca3('0x29'),_0x55abd0[_0x5ca3('0x13')]),_0x74a227);}};exports['attendedtransfer']=function(_0x281d31){try{if(!_[_0x5ca3('0x1f')](channels[_0x281d31['localtwolinkedid']])){utils[_0x5ca3('0x15')](util[_0x5ca3('0x17')]('[%s][calls][attendedtransfer]',_0x281d31[_0x5ca3('0x32')]),_0x281d31);if(channels[_0x281d31[_0x5ca3('0x33')]][_0x5ca3('0x7')]==_0x281d31[_0x5ca3('0x34')]){utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')](_0x5ca3('0x35'),_0x281d31['origtransfereruniqueid'],_0x281d31['localtwolinkedid'],_0x281d31[_0x5ca3('0x36')]));channels[_0x281d31[_0x5ca3('0x33')]]['destinationchannel']=_0x281d31['secondtransfererchannel'];channels[_0x281d31[_0x5ca3('0x33')]]['userfield']='_attended';}else if(channels[_0x281d31['localtwolinkedid']][_0x5ca3('0x7')]=_0x281d31[_0x5ca3('0x37')]){utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x281d31[_0x5ca3('0x32')],_0x281d31['localtwolinkedid'],_0x281d31[_0x5ca3('0x38')]));channels[_0x281d31[_0x5ca3('0x33')]]['destinationchannel']=_0x281d31[_0x5ca3('0x38')];channels[_0x281d31[_0x5ca3('0x33')]]['userfield']=_0x5ca3('0x39');}}}catch(_0x3668bb){utils[_0x5ca3('0x1c')](util[_0x5ca3('0x17')](_0x5ca3('0x3a'),_0x281d31[_0x5ca3('0x32')]),_0x3668bb);}};exports['musiconholdstart']=function(_0x35ede0){try{if(!_['isNil'](channels[_0x35ede0[_0x5ca3('0x13')]])){utils['debug'](util['format'](_0x5ca3('0x3b'),_0x35ede0[_0x5ca3('0x13')]),_0x35ede0);channels[_0x35ede0[_0x5ca3('0x13')]][_0x5ca3('0x3c')]=utils[_0x5ca3('0x1a')]();utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')](_0x5ca3('0x3d'),_0x35ede0[_0x5ca3('0x13')],channels[_0x35ede0['uniqueid']][_0x5ca3('0x3c')]));}}catch(_0x54df97){utils[_0x5ca3('0x1c')](util[_0x5ca3('0x17')](_0x5ca3('0x3b'),_0x35ede0[_0x5ca3('0x13')]),_0x54df97);}};exports['musiconholdstop']=function(_0x14e9c){try{if(!_['isNil'](channels[_0x14e9c['uniqueid']])){utils[_0x5ca3('0x15')](util[_0x5ca3('0x17')]('[%s][calls][musiconholdstop]',_0x14e9c[_0x5ca3('0x13')]),_0x14e9c);if(!_['isNil'](channels[_0x14e9c['uniqueid']][_0x5ca3('0x3c')])){channels[_0x14e9c[_0x5ca3('0x13')]][_0x5ca3('0x3e')]+=utils['diffTime'](utils[_0x5ca3('0x1a')](),channels[_0x14e9c['uniqueid']][_0x5ca3('0x3c')]);utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')](_0x5ca3('0x3f'),_0x14e9c[_0x5ca3('0x13')],channels[_0x14e9c[_0x5ca3('0x13')]]['mohtime']));delete channels[_0x14e9c[_0x5ca3('0x13')]][_0x5ca3('0x3c')];}}}catch(_0x1cc220){utils['error'](util[_0x5ca3('0x17')](_0x5ca3('0x40'),_0x14e9c[_0x5ca3('0x13')]),_0x1cc220);}};exports[_0x5ca3('0x41')]=function(_0x4e2066){try{if(!_[_0x5ca3('0x1f')](channels[_0x4e2066[_0x5ca3('0x13')]])){utils['debug'](util[_0x5ca3('0x17')](_0x5ca3('0x42'),_0x4e2066[_0x5ca3('0x13')]),_0x4e2066);if(!_[_0x5ca3('0x1f')](_0x4e2066['variable'][_0x5ca3('0x43')])){utils[_0x5ca3('0x5')](util['format'](_0x5ca3('0x44'),_0x4e2066[_0x5ca3('0x13')],_0x4e2066[_0x5ca3('0x45')]));channels[_0x4e2066[_0x5ca3('0x13')]][_0x5ca3('0x46')]=_0x4e2066['value'];}if(!_[_0x5ca3('0x1f')](_0x4e2066[_0x5ca3('0x47')][_0x5ca3('0x48')])){utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')](_0x5ca3('0x49'),_0x4e2066[_0x5ca3('0x13')],_0x4e2066[_0x5ca3('0x45')]));channels[_0x4e2066[_0x5ca3('0x13')]][_0x5ca3('0x4a')]=_0x4e2066['value'];channels[_0x4e2066[_0x5ca3('0x13')]]['callerid']='\x22'+_0x4e2066[_0x5ca3('0x45')]+_0x5ca3('0x4b')+_0x4e2066[_0x5ca3('0x45')]+'>';}if(!_['isNil'](_0x4e2066['variable'][_0x5ca3('0x4c')])||!_[_0x5ca3('0x1f')](_0x4e2066[_0x5ca3('0x47')][_0x5ca3('0x4d')])){utils[_0x5ca3('0x5')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4e2066[_0x5ca3('0x13')],!_[_0x5ca3('0x1f')](_0x4e2066[_0x5ca3('0x47')][_0x5ca3('0x4c')])?_0x5ca3('0x4c'):_0x5ca3('0x4d'),_0x4e2066[_0x5ca3('0x45')]));channels[_0x4e2066[_0x5ca3('0x13')]][_0x5ca3('0x2a')]=_0x4e2066[_0x5ca3('0x45')];}if(!_['isNil'](_0x4e2066['variable'][_0x5ca3('0x4e')])||!_[_0x5ca3('0x1f')](_0x4e2066[_0x5ca3('0x47')][_0x5ca3('0x4f')])){utils[_0x5ca3('0x5')](util['format'](_0x5ca3('0x50'),_0x4e2066[_0x5ca3('0x13')],!_[_0x5ca3('0x1f')](_0x4e2066['variable']['xmd-queue'])?'xmd-queue':'xmcs-queue',_0x4e2066['value']));channels[_0x4e2066[_0x5ca3('0x13')]][_0x5ca3('0x51')]=_0x5ca3('0x52');channels[_0x4e2066[_0x5ca3('0x13')]]['lastdata']=_0x4e2066['value'];channels[_0x4e2066[_0x5ca3('0x13')]]['queue']=!![];}if(!_[_0x5ca3('0x1f')](_0x4e2066['variable'][_0x5ca3('0x53')])){utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')](_0x5ca3('0x54'),_0x4e2066[_0x5ca3('0x13')],_0x4e2066[_0x5ca3('0x45')]));channels[_0x4e2066['uniqueid']]['ContactId']=_0x4e2066['value'];}if(!_[_0x5ca3('0x1f')](_0x4e2066[_0x5ca3('0x47')][_0x5ca3('0x55')])){utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4e2066[_0x5ca3('0x13')],_0x4e2066[_0x5ca3('0x45')]));channels[_0x4e2066[_0x5ca3('0x13')]][_0x5ca3('0x56')]=_0x4e2066[_0x5ca3('0x45')];}if(!_['isNil'](_0x4e2066[_0x5ca3('0x47')][_0x5ca3('0x57')])){utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')](_0x5ca3('0x58'),_0x4e2066[_0x5ca3('0x13')],_0x4e2066[_0x5ca3('0x45')]));channels[_0x4e2066[_0x5ca3('0x13')]]['routeid']=_0x4e2066[_0x5ca3('0x45')];}if(!_[_0x5ca3('0x1f')](_0x4e2066['variable'][_0x5ca3('0x59')])){utils[_0x5ca3('0x5')](util[_0x5ca3('0x17')](_0x5ca3('0x5a'),_0x4e2066['uniqueid'],_0x4e2066['value']));channels[_0x4e2066['uniqueid']][_0x5ca3('0x59')]=_0x4e2066['value'];}}}catch(_0x1a3aaa){utils[_0x5ca3('0x1c')](util[_0x5ca3('0x17')](_0x5ca3('0x42'),_0x4e2066[_0x5ca3('0x13')]),_0x1a3aaa);}};exports[_0x5ca3('0x5b')]=function(_0x1fd9bd){try{if(!_['isNil'](channels[_0x1fd9bd['uniqueid']])){utils[_0x5ca3('0x15')](util[_0x5ca3('0x17')](_0x5ca3('0x5c'),_0x1fd9bd[_0x5ca3('0x13')]),_0x1fd9bd);utils['info'](util[_0x5ca3('0x17')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x1fd9bd[_0x5ca3('0x13')],_0x1fd9bd[_0x5ca3('0x5d')],_0x1fd9bd[_0x5ca3('0x5e')]));if(_0x1fd9bd[_0x5ca3('0x5d')]['toLowerCase']()==_0x5ca3('0x5f')&&_['startsWith'](_0x1fd9bd['appdata'][_0x5ca3('0x60')](),_0x5ca3('0x61'))){var _0x332bd9=_0x1fd9bd[_0x5ca3('0x5e')]['split']('=');var _0x11c058=_0x332bd9[0x0][_0x5ca3('0x62')](_0x332bd9[0x0][_0x5ca3('0x63')]('(')+0x1,_0x332bd9[0x0][_0x5ca3('0x63')](')'));var _0x2a75f6=_0x332bd9[0x1];channels[_0x1fd9bd[_0x5ca3('0x13')]][_0x11c058]=_0x2a75f6;}if(!_[_0x5ca3('0x64')]([_0x5ca3('0x65'),_0x5ca3('0x66'),_0x5ca3('0x67'),_0x5ca3('0x5f'),_0x5ca3('0x68')],_0x1fd9bd[_0x5ca3('0x5d')][_0x5ca3('0x60')]())){channels[_0x1fd9bd[_0x5ca3('0x13')]][_0x5ca3('0x51')]=_0x1fd9bd[_0x5ca3('0x5d')];channels[_0x1fd9bd[_0x5ca3('0x13')]]['lastdata']=_0x1fd9bd['appdata'];}}}catch(_0x40f17e){utils[_0x5ca3('0x1c')](util[_0x5ca3('0x17')](_0x5ca3('0x5c'),_0x1fd9bd[_0x5ca3('0x13')]),_0x40f17e);}}; \ No newline at end of file +var _0x14ad=['newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','now','toNumber','hangup','debug','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','variable','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','noop','gotoif','lodash','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','getUserByInternal','accountcode','then','UserId','request','uniqueid','newchannel','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','[%s][calls][newchannel]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14ad,0x121));var _0xd14a=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x14ad[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xd14a('0x0'));var util=require('util');var utils=require(_0xd14a('0x1'));var dispositions=[_0xd14a('0x2'),_0xd14a('0x3'),_0xd14a('0x3'),_0xd14a('0x2'),_0xd14a('0x2'),_0xd14a('0x2'),'ANSWERED',_0xd14a('0x4'),_0xd14a('0x3'),'FAILED',_0xd14a('0x3')];var channels={};function writeDB(_0x5325f2){utils[_0xd14a('0x5')](util[_0xd14a('0x6')](_0xd14a('0x7'),_0x5325f2['uniqueid'],_0x5325f2['channel'],_0x5325f2[_0xd14a('0x8')],_0x5325f2[_0xd14a('0x9')],_0x5325f2[_0xd14a('0xa')],_0x5325f2[_0xd14a('0xb')],_0x5325f2[_0xd14a('0xc')],_0x5325f2['lastevent']));if(_0x5325f2['accountcode']){utils[_0xd14a('0xd')](_0x5325f2[_0xd14a('0xe')])[_0xd14a('0xf')](function(_0x583527){if(_0x583527){_0x5325f2[_0xd14a('0x10')]=_0x583527['id'];}utils[_0xd14a('0x11')]('CreateVoiceCallReport',_0x5325f2);});}else{utils[_0xd14a('0x11')]('CreateVoiceCallReport',_0x5325f2);}if(channels[_0x5325f2[_0xd14a('0x12')]]){delete channels[_0x5325f2[_0xd14a('0x12')]];}}exports[_0xd14a('0x13')]=function(_0x6a1e5){try{utils['debug'](util['format']('[%s][calls][newchannel]',_0x6a1e5['uniqueid']),_0x6a1e5);if(_0x6a1e5[_0xd14a('0x12')]==_0x6a1e5[_0xd14a('0x14')]&&_0x6a1e5[_0xd14a('0x15')]!=_0xd14a('0x16')){utils[_0xd14a('0x5')](util['format'](_0xd14a('0x17'),_0x6a1e5['uniqueid'],_0x6a1e5[_0xd14a('0x18')],_0x6a1e5[_0xd14a('0x19')]));channels[_0x6a1e5[_0xd14a('0x12')]]={'uniqueid':_0x6a1e5[_0xd14a('0x12')],'accountcode':_0x6a1e5[_0xd14a('0xe')],'source':_0x6a1e5[_0xd14a('0xb')],'destination':_0x6a1e5[_0xd14a('0x19')],'destinationcontext':_0x6a1e5[_0xd14a('0x18')],'channel':_0x6a1e5[_0xd14a('0x15')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd14a('0x2'),'amaflags':_0xd14a('0x1a')};}}catch(_0x2ed9a7){utils[_0xd14a('0x1b')](util[_0xd14a('0x6')](_0xd14a('0x1c'),_0x6a1e5[_0xd14a('0x12')]),_0x2ed9a7);}};exports[_0xd14a('0x1d')]=function(_0x184e87){try{utils['debug'](util[_0xd14a('0x6')](_0xd14a('0x1e'),_0x184e87[_0xd14a('0x12')]),_0x184e87);if(!_[_0xd14a('0x1f')](channels[_0x184e87[_0xd14a('0x12')]])&&_0x184e87['channelstate']==0x6){utils[_0xd14a('0x5')](util[_0xd14a('0x6')](_0xd14a('0x20'),_0x184e87[_0xd14a('0x12')],_0x184e87['context'],_0x184e87[_0xd14a('0x15')]));if(_[_0xd14a('0x1f')](channels[_0x184e87[_0xd14a('0x12')]][_0xd14a('0x21')])){channels[_0x184e87[_0xd14a('0x12')]][_0xd14a('0x21')]=utils['now']();}}else if(!_['isNil'](channels[_0x184e87[_0xd14a('0x14')]])&&_0x184e87[_0xd14a('0x22')]==0x6&&_0x184e87[_0xd14a('0x18')]!=_0xd14a('0x23')){utils[_0xd14a('0x5')](util[_0xd14a('0x6')](_0xd14a('0x24'),_0x184e87[_0xd14a('0x12')],_0x184e87[_0xd14a('0x14')],_0x184e87[_0xd14a('0x18')],_0x184e87[_0xd14a('0x15')]));channels[_0x184e87['linkedid']][_0xd14a('0xe')]=_0x184e87[_0xd14a('0xe')];channels[_0x184e87[_0xd14a('0x14')]][_0xd14a('0x25')]=_0x184e87[_0xd14a('0x15')];if(_[_0xd14a('0x1f')](channels[_0x184e87[_0xd14a('0x14')]][_0xd14a('0x26')])){channels[_0x184e87[_0xd14a('0x14')]][_0xd14a('0x26')]=utils[_0xd14a('0x27')]();}channels[_0x184e87[_0xd14a('0x14')]]['disposition']=dispositions[_[_0xd14a('0x28')](_0x184e87[_0xd14a('0x22')])]||'ANSWERED';}}catch(_0x4984e8){utils['error'](util[_0xd14a('0x6')](_0xd14a('0x1e'),_0x184e87[_0xd14a('0x12')]),_0x4984e8);}};exports[_0xd14a('0x29')]=function(_0x2bab06){try{if(!_['isNil'](channels[_0x2bab06[_0xd14a('0x12')]])){utils[_0xd14a('0x2a')](util['format'](_0xd14a('0x2b'),_0x2bab06['uniqueid']),_0x2bab06);if(_[_0xd14a('0x1f')](channels[_0x2bab06[_0xd14a('0x12')]][_0xd14a('0x2c')])){channels[_0x2bab06[_0xd14a('0x12')]]['callerid']=_0x2bab06[_0xd14a('0x2d')]+'\x20<'+_0x2bab06['calleridnum']+'>';}utils['info'](util[_0xd14a('0x6')](_0xd14a('0x2e'),_0x2bab06[_0xd14a('0x12')],channels[_0x2bab06[_0xd14a('0x12')]][_0xd14a('0x2c')],_0x2bab06[_0xd14a('0x2f')]));channels[_0x2bab06[_0xd14a('0x12')]][_0xd14a('0x30')]=utils[_0xd14a('0x27')]();channels[_0x2bab06[_0xd14a('0x12')]][_0xd14a('0x31')]=utils['diffTime'](channels[_0x2bab06['uniqueid']][_0xd14a('0x30')],channels[_0x2bab06[_0xd14a('0x12')]][_0xd14a('0x32')]);channels[_0x2bab06['uniqueid']]['billableseconds']=channels[_0x2bab06[_0xd14a('0x12')]][_0xd14a('0x26')]?utils[_0xd14a('0x33')](channels[_0x2bab06[_0xd14a('0x12')]][_0xd14a('0x30')],channels[_0x2bab06['uniqueid']][_0xd14a('0x26')]):0x0;writeDB(channels[_0x2bab06[_0xd14a('0x12')]]);}}catch(_0x4a10bf){utils[_0xd14a('0x1b')](util[_0xd14a('0x6')](_0xd14a('0x2b'),_0x2bab06[_0xd14a('0x12')]),_0x4a10bf);}};exports[_0xd14a('0x34')]=function(_0x55cc05){try{if(!_[_0xd14a('0x1f')](channels[_0x55cc05[_0xd14a('0x35')]])){utils[_0xd14a('0x2a')](util[_0xd14a('0x6')](_0xd14a('0x36'),_0x55cc05[_0xd14a('0x37')]),_0x55cc05);if(channels[_0x55cc05['localtwolinkedid']][_0xd14a('0x15')]==_0x55cc05[_0xd14a('0x38')]){utils[_0xd14a('0x5')](util[_0xd14a('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x55cc05['origtransfereruniqueid'],_0x55cc05[_0xd14a('0x35')],_0x55cc05[_0xd14a('0x39')]));channels[_0x55cc05[_0xd14a('0x35')]][_0xd14a('0x25')]=_0x55cc05['secondtransfererchannel'];channels[_0x55cc05[_0xd14a('0x35')]][_0xd14a('0x3a')]=_0xd14a('0x3b');}else if(channels[_0x55cc05[_0xd14a('0x35')]][_0xd14a('0x15')]=_0x55cc05[_0xd14a('0x3c')]){utils[_0xd14a('0x5')](util[_0xd14a('0x6')](_0xd14a('0x3d'),_0x55cc05[_0xd14a('0x37')],_0x55cc05[_0xd14a('0x35')],_0x55cc05['origtransfererchannel']));channels[_0x55cc05['localtwolinkedid']][_0xd14a('0x25')]=_0x55cc05[_0xd14a('0x3e')];channels[_0x55cc05[_0xd14a('0x35')]]['userfield']=_0xd14a('0x3b');}}}catch(_0x5d85b0){utils[_0xd14a('0x1b')](util[_0xd14a('0x6')](_0xd14a('0x36'),_0x55cc05[_0xd14a('0x37')]),_0x5d85b0);}};exports[_0xd14a('0x3f')]=function(_0x1e71ff){try{if(!_[_0xd14a('0x1f')](channels[_0x1e71ff['uniqueid']])){utils[_0xd14a('0x2a')](util['format'](_0xd14a('0x40'),_0x1e71ff[_0xd14a('0x12')]),_0x1e71ff);channels[_0x1e71ff[_0xd14a('0x12')]][_0xd14a('0x41')]=utils[_0xd14a('0x27')]();utils[_0xd14a('0x5')](util[_0xd14a('0x6')](_0xd14a('0x42'),_0x1e71ff[_0xd14a('0x12')],channels[_0x1e71ff[_0xd14a('0x12')]][_0xd14a('0x41')]));}}catch(_0x5b6323){utils[_0xd14a('0x1b')](util[_0xd14a('0x6')]('[%s][calls][musiconholdstart]',_0x1e71ff[_0xd14a('0x12')]),_0x5b6323);}};exports['musiconholdstop']=function(_0x6f22df){try{if(!_[_0xd14a('0x1f')](channels[_0x6f22df['uniqueid']])){utils[_0xd14a('0x2a')](util[_0xd14a('0x6')]('[%s][calls][musiconholdstop]',_0x6f22df['uniqueid']),_0x6f22df);if(!_[_0xd14a('0x1f')](channels[_0x6f22df[_0xd14a('0x12')]][_0xd14a('0x41')])){channels[_0x6f22df[_0xd14a('0x12')]][_0xd14a('0x43')]+=utils['diffTime'](utils[_0xd14a('0x27')](),channels[_0x6f22df[_0xd14a('0x12')]][_0xd14a('0x41')]);utils[_0xd14a('0x5')](util[_0xd14a('0x6')](_0xd14a('0x44'),_0x6f22df[_0xd14a('0x12')],channels[_0x6f22df[_0xd14a('0x12')]][_0xd14a('0x43')]));delete channels[_0x6f22df[_0xd14a('0x12')]]['musiconholdstartAt'];}}}catch(_0x24ead8){utils[_0xd14a('0x1b')](util[_0xd14a('0x6')](_0xd14a('0x45'),_0x6f22df['uniqueid']),_0x24ead8);}};exports['varset']=function(_0x52b1e7){try{if(!_[_0xd14a('0x1f')](channels[_0x52b1e7[_0xd14a('0x12')]])){utils[_0xd14a('0x2a')](util['format'](_0xd14a('0x46'),_0x52b1e7[_0xd14a('0x12')]),_0x52b1e7);if(!_['isNil'](_0x52b1e7['variable'][_0xd14a('0x47')])){utils[_0xd14a('0x5')](util[_0xd14a('0x6')](_0xd14a('0x48'),_0x52b1e7['uniqueid'],_0x52b1e7['value']));channels[_0x52b1e7[_0xd14a('0x12')]][_0xd14a('0x49')]=_0x52b1e7[_0xd14a('0x4a')];}if(!_[_0xd14a('0x1f')](_0x52b1e7['variable']['xmd-phone'])){utils[_0xd14a('0x5')](util[_0xd14a('0x6')](_0xd14a('0x4b'),_0x52b1e7[_0xd14a('0x12')],_0x52b1e7[_0xd14a('0x4a')]));channels[_0x52b1e7['uniqueid']][_0xd14a('0x4c')]=_0x52b1e7[_0xd14a('0x4a')];channels[_0x52b1e7[_0xd14a('0x12')]][_0xd14a('0x2c')]='\x22'+_0x52b1e7['value']+'\x22\x20<'+_0x52b1e7[_0xd14a('0x4a')]+'>';}if(!_['isNil'](_0x52b1e7['variable'][_0xd14a('0x4d')])||!_[_0xd14a('0x1f')](_0x52b1e7[_0xd14a('0x4e')]['xmd-callerid'])){utils[_0xd14a('0x5')](util[_0xd14a('0x6')](_0xd14a('0x4f'),_0x52b1e7['uniqueid'],!_[_0xd14a('0x1f')](_0x52b1e7[_0xd14a('0x4e')]['xmd-callerid-preview'])?_0xd14a('0x4d'):_0xd14a('0x50'),_0x52b1e7[_0xd14a('0x4a')]));channels[_0x52b1e7[_0xd14a('0x12')]][_0xd14a('0x2c')]=_0x52b1e7['value'];}if(!_[_0xd14a('0x1f')](_0x52b1e7[_0xd14a('0x4e')]['xmd-queue'])||!_[_0xd14a('0x1f')](_0x52b1e7['variable']['xmcs-queue'])){utils[_0xd14a('0x5')](util[_0xd14a('0x6')](_0xd14a('0x4f'),_0x52b1e7[_0xd14a('0x12')],!_[_0xd14a('0x1f')](_0x52b1e7[_0xd14a('0x4e')][_0xd14a('0x51')])?_0xd14a('0x51'):_0xd14a('0x52'),_0x52b1e7['value']));channels[_0x52b1e7[_0xd14a('0x12')]][_0xd14a('0x53')]=_0xd14a('0x54');channels[_0x52b1e7[_0xd14a('0x12')]][_0xd14a('0x55')]=_0x52b1e7['value'];channels[_0x52b1e7[_0xd14a('0x12')]][_0xd14a('0x8')]=!![];}if(!_[_0xd14a('0x1f')](_0x52b1e7[_0xd14a('0x4e')][_0xd14a('0x56')])){utils[_0xd14a('0x5')](util['format'](_0xd14a('0x57'),_0x52b1e7[_0xd14a('0x12')],_0x52b1e7[_0xd14a('0x4a')]));channels[_0x52b1e7[_0xd14a('0x12')]]['ContactId']=_0x52b1e7[_0xd14a('0x4a')];}if(!_[_0xd14a('0x1f')](_0x52b1e7[_0xd14a('0x4e')]['xmd-cdrtype'])){utils[_0xd14a('0x5')](util[_0xd14a('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x52b1e7[_0xd14a('0x12')],_0x52b1e7['value']));channels[_0x52b1e7[_0xd14a('0x12')]]['type']=_0x52b1e7[_0xd14a('0x4a')];}if(!_[_0xd14a('0x1f')](_0x52b1e7[_0xd14a('0x4e')][_0xd14a('0x58')])){utils[_0xd14a('0x5')](util['format'](_0xd14a('0x59'),_0x52b1e7[_0xd14a('0x12')],_0x52b1e7[_0xd14a('0x4a')]));channels[_0x52b1e7[_0xd14a('0x12')]][_0xd14a('0x5a')]=_0x52b1e7[_0xd14a('0x4a')];}if(!_[_0xd14a('0x1f')](_0x52b1e7['variable']['sipcallid'])){utils[_0xd14a('0x5')](util[_0xd14a('0x6')](_0xd14a('0x5b'),_0x52b1e7[_0xd14a('0x12')],_0x52b1e7[_0xd14a('0x4a')]));channels[_0x52b1e7[_0xd14a('0x12')]][_0xd14a('0x5c')]=_0x52b1e7[_0xd14a('0x4a')];}}}catch(_0x424509){utils[_0xd14a('0x1b')](util['format']('[%s][calls][varset]',_0x52b1e7[_0xd14a('0x12')]),_0x424509);}};exports['newexten']=function(_0x68fed2){try{if(!_[_0xd14a('0x1f')](channels[_0x68fed2[_0xd14a('0x12')]])){utils[_0xd14a('0x2a')](util['format'](_0xd14a('0x5d'),_0x68fed2[_0xd14a('0x12')]),_0x68fed2);utils['info'](util[_0xd14a('0x6')](_0xd14a('0x5e'),_0x68fed2[_0xd14a('0x12')],_0x68fed2[_0xd14a('0x5f')],_0x68fed2[_0xd14a('0x60')]));if(_0x68fed2[_0xd14a('0x5f')][_0xd14a('0x61')]()==_0xd14a('0x62')&&_[_0xd14a('0x63')](_0x68fed2['appdata']['toLowerCase'](),_0xd14a('0x64'))){var _0x4ee8c7=_0x68fed2[_0xd14a('0x60')][_0xd14a('0x65')]('=');var _0x254227=_0x4ee8c7[0x0][_0xd14a('0x66')](_0x4ee8c7[0x0][_0xd14a('0x67')]('(')+0x1,_0x4ee8c7[0x0][_0xd14a('0x67')](')'));var _0x3fd367=_0x4ee8c7[0x1];channels[_0x68fed2[_0xd14a('0x12')]][_0x254227]=_0x3fd367;}if(!_['includes']([_0xd14a('0x29'),_0xd14a('0x68'),'execif','set',_0xd14a('0x69')],_0x68fed2[_0xd14a('0x5f')][_0xd14a('0x61')]())){channels[_0x68fed2[_0xd14a('0x12')]][_0xd14a('0x53')]=_0x68fed2['application'];channels[_0x68fed2[_0xd14a('0x12')]]['lastdata']=_0x68fed2[_0xd14a('0x60')];}}}catch(_0x22bf8){utils[_0xd14a('0x1b')](util[_0xd14a('0x6')]('[%s][calls][newexten]',_0x68fed2['uniqueid']),_0x22bf8);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 3bb4dd9..28c3743 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 _0x7f53=['./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent'];(function(_0x9dd96a,_0x2da48b){var _0x579627=function(_0x46fb0d){while(--_0x46fb0d){_0x9dd96a['push'](_0x9dd96a['shift']());}};_0x579627(++_0x2da48b);}(_0x7f53,0x84));var _0x37f5=function(_0xc8a11,_0x347a33){_0xc8a11=_0xc8a11-0x0;var _0x55a500=_0x7f53[_0xc8a11];return _0x55a500;};'use strict';var utils=require(_0x37f5('0x0'));exports[_0x37f5('0x1')]=function(){utils[_0x37f5('0x2')](_0x37f5('0x3'));};exports[_0x37f5('0x4')]=function(){utils[_0x37f5('0x2')](_0x37f5('0x5'));};exports[_0x37f5('0x6')]=function(){utils[_0x37f5('0x2')](_0x37f5('0x7'));};exports[_0x37f5('0x8')]=function(_0x5dd3f3){utils[_0x37f5('0x8')](_0x37f5('0x9'),_0x5dd3f3);};exports[_0x37f5('0xa')]=function(){utils[_0x37f5('0x2')]('[core]\x20close');};exports[_0x37f5('0xb')]=function(_0x19f3d0){}; \ No newline at end of file +var _0xefca=['fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xefca,0x1ad));var _0xaefc=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xefca[_0x43f881];return _0x365c14;};'use strict';var utils=require(_0xaefc('0x0'));exports[_0xaefc('0x1')]=function(){utils[_0xaefc('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0xaefc('0x2')]('[core]\x20shutdown');};exports[_0xaefc('0x3')]=function(){utils[_0xaefc('0x2')]('[core]\x20fullybooted');};exports['error']=function(_0x4c8798){utils[_0xaefc('0x4')](_0xaefc('0x5'),_0x4c8798);};exports[_0xaefc('0x6')]=function(){utils[_0xaefc('0x2')](_0xaefc('0x7'));};exports[_0xaefc('0x8')]=function(_0x158a4c){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 8735b19..d27735b 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 _0x954e=['channel','dialstring','connectedlinenum','dialstatus','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','assign','starttime','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','isNil','answertime','lastevent','connect','info','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0x954e,0x1b4));var _0xe954=function(_0x60b4b5,_0x4b9f3c){_0x60b4b5=_0x60b4b5-0x0;var _0x5ce041=_0x954e[_0x60b4b5];return _0x5ce041;};'use strict';var _=require(_0xe954('0x0'));var util=require(_0xe954('0x1'));var utils=require(_0xe954('0x2'));var dials={};function writeDB(_0x11321c){utils['info'](util[_0xe954('0x3')](_0xe954('0x4'),_0x11321c['uniqueid'],_0x11321c[_0xe954('0x5')],_0x11321c[_0xe954('0x6')],_0x11321c['calleridnum'],_0x11321c[_0xe954('0x7')],_0x11321c[_0xe954('0x8')]));utils['request'](_0xe954('0x9'),_0x11321c);delete dials[_0x11321c[_0xe954('0xa')]];}exports[_0xe954('0xb')]=function(_0x5a841a){try{utils[_0xe954('0xc')](util[_0xe954('0x3')]('[%s][dials][newexten]',_0x5a841a[_0xe954('0xa')]),_0x5a841a);utils['info'](util[_0xe954('0x3')](_0xe954('0xd'),_0x5a841a['uniqueid'],_0x5a841a['application'],_0x5a841a[_0xe954('0xe')]));if(_0x5a841a[_0xe954('0xf')][_0xe954('0x10')]()==_0xe954('0x11')&&_[_0xe954('0x12')](_0x5a841a[_0xe954('0xe')]['toLowerCase'](),'cdr(routeid)')){var _0x1f65e7=_0x5a841a[_0xe954('0xe')][_0xe954('0x13')]('=');dials[_0x5a841a[_0xe954('0xa')]]={'routeId':_0x1f65e7[0x1]};}}catch(_0x14c53a){utils[_0xe954('0x14')](util['format'](_0xe954('0x15'),_0x5a841a[_0xe954('0xa')]),_0x14c53a);}};exports[_0xe954('0x16')]=function(_0x127f9d){try{utils[_0xe954('0xc')](util[_0xe954('0x3')](_0xe954('0x17'),_0x127f9d[_0xe954('0xa')]),_0x127f9d);if(!_['isNil'](_0x127f9d['variable'][_0xe954('0x18')])){utils['info'](util[_0xe954('0x3')](_0xe954('0x19'),_0x127f9d[_0xe954('0xa')],_0x127f9d[_0xe954('0x1a')]));dials[_0x127f9d[_0xe954('0xa')]]={'routeId':_0x127f9d[_0xe954('0x1a')]};}}catch(_0xeec64c){utils['error'](util['format'](_0xe954('0x17'),_0x127f9d['uniqueid']),_0xeec64c);}};exports['dialbegin']=function(_0x5bb227){try{if(!_['isNil'](dials[_0x5bb227[_0xe954('0xa')]])){utils[_0xe954('0xc')](util['format']('[%s][dials][dialbegin]',_0x5bb227[_0xe954('0xa')]),_0x5bb227);dials[_0x5bb227[_0xe954('0xa')]]=_[_0xe954('0x1b')](dials[_0x5bb227[_0xe954('0xa')]],_0x5bb227);dials[_0x5bb227[_0xe954('0xa')]][_0xe954('0x1c')]=utils['now']();dials[_0x5bb227['uniqueid']]['lastevent']=_0xe954('0x1d');utils['info'](util[_0xe954('0x3')](_0xe954('0x1e'),_0x5bb227[_0xe954('0xa')],dials[_0x5bb227[_0xe954('0xa')]][_0xe954('0x1c')]));}}catch(_0x216c0d){utils[_0xe954('0x14')](util[_0xe954('0x3')](_0xe954('0x1f'),_0x5bb227[_0xe954('0xa')]),_0x216c0d);}};exports['dialend']=function(_0x32f75b){try{if(!_[_0xe954('0x20')](dials[_0x32f75b[_0xe954('0xa')]])){utils[_0xe954('0xc')](util[_0xe954('0x3')]('[%s][dials][dialend]',_0x32f75b['uniqueid']),_0x32f75b);dials[_0x32f75b[_0xe954('0xa')]][_0xe954('0x8')]=_0x32f75b[_0xe954('0x8')];if(_0x32f75b[_0xe954('0x8')]=='ANSWER'){dials[_0x32f75b['uniqueid']]=_['assign'](dials[_0x32f75b['uniqueid']],_0x32f75b);dials[_0x32f75b[_0xe954('0xa')]][_0xe954('0x21')]=utils['now']();dials[_0x32f75b[_0xe954('0xa')]][_0xe954('0x22')]=_0xe954('0x23');utils[_0xe954('0x24')](util['format'](_0xe954('0x25'),_0x32f75b[_0xe954('0xa')],_0x32f75b[_0xe954('0x8')],dials[_0x32f75b['uniqueid']][_0xe954('0x21')]));}else{utils[_0xe954('0x24')](util[_0xe954('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x32f75b[_0xe954('0xa')],_0x32f75b[_0xe954('0x8')]));}}}catch(_0x4160cf){utils[_0xe954('0x14')](util[_0xe954('0x3')](_0xe954('0x26'),_0x32f75b['uniqueid']),_0x4160cf);}};exports['hangup']=function(_0x1156ea){try{if(!_[_0xe954('0x20')](dials[_0x1156ea[_0xe954('0xa')]])){utils['debug'](util['format'](_0xe954('0x27'),_0x1156ea[_0xe954('0xa')]),_0x1156ea);utils[_0xe954('0x24')](util[_0xe954('0x3')](_0xe954('0x28'),_0x1156ea[_0xe954('0xa')],_0x1156ea[_0xe954('0x29')],_0x1156ea['calleridname'],_0x1156ea[_0xe954('0x2a')]));dials[_0x1156ea[_0xe954('0xa')]]=_[_0xe954('0x1b')](dials[_0x1156ea[_0xe954('0xa')]],{'endtime':utils['now'](),'lastevent':_0xe954('0x2b')});dials[_0x1156ea[_0xe954('0xa')]][_0xe954('0x2c')]=utils[_0xe954('0x2d')](dials[_0x1156ea['uniqueid']][_0xe954('0x2e')],dials[_0x1156ea[_0xe954('0xa')]]['starttime']);dials[_0x1156ea[_0xe954('0xa')]][_0xe954('0x2f')]=utils['diffTime'](dials[_0x1156ea[_0xe954('0xa')]][_0xe954('0x21')]||dials[_0x1156ea[_0xe954('0xa')]][_0xe954('0x2e')],dials[_0x1156ea[_0xe954('0xa')]][_0xe954('0x1c')]);dials[_0x1156ea[_0xe954('0xa')]][_0xe954('0x30')]=dials[_0x1156ea[_0xe954('0xa')]][_0xe954('0x21')]?utils[_0xe954('0x2d')](dials[_0x1156ea['uniqueid']]['endtime'],dials[_0x1156ea['uniqueid']][_0xe954('0x21')]):0x0;writeDB(dials[_0x1156ea[_0xe954('0xa')]]);}}catch(_0x228cd8){utils[_0xe954('0x14')](util['format']('[%s][dials][hangup]',_0x1156ea[_0xe954('0xa')]),_0x228cd8);}}; \ No newline at end of file +var _0x439d=['assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','answertime','now','connect','cause-txt','duration','diffTime','billableseconds','endtime','[%s][dials][hangup]','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','[%s][dials][varset]','isNil','debug','[%s][dials][dialbegin]'];(function(_0x504d0e,_0x56b84b){var _0x5f408a=function(_0x396c76){while(--_0x396c76){_0x504d0e['push'](_0x504d0e['shift']());}};_0x5f408a(++_0x56b84b);}(_0x439d,0x94));var _0xd439=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0x439d[_0x56daff];return _0x132c82;};'use strict';var _=require(_0xd439('0x0'));var util=require(_0xd439('0x1'));var utils=require(_0xd439('0x2'));var dials={};function writeDB(_0x23ddb6){utils[_0xd439('0x3')](util[_0xd439('0x4')](_0xd439('0x5'),_0x23ddb6[_0xd439('0x6')],_0x23ddb6[_0xd439('0x7')],_0x23ddb6[_0xd439('0x8')],_0x23ddb6[_0xd439('0x9')],_0x23ddb6[_0xd439('0xa')],_0x23ddb6[_0xd439('0xb')]));utils[_0xd439('0xc')](_0xd439('0xd'),_0x23ddb6);delete dials[_0x23ddb6[_0xd439('0x6')]];}exports[_0xd439('0xe')]=function(_0x2294d2){try{utils['debug'](util[_0xd439('0x4')](_0xd439('0xf'),_0x2294d2[_0xd439('0x6')]),_0x2294d2);utils[_0xd439('0x3')](util['format'](_0xd439('0x10'),_0x2294d2[_0xd439('0x6')],_0x2294d2[_0xd439('0x11')],_0x2294d2[_0xd439('0x12')]));if(_0x2294d2['application'][_0xd439('0x13')]()==_0xd439('0x14')&&_[_0xd439('0x15')](_0x2294d2[_0xd439('0x12')][_0xd439('0x13')](),_0xd439('0x16'))){var _0x1d524a=_0x2294d2[_0xd439('0x12')]['split']('=');dials[_0x2294d2['uniqueid']]={'routeId':_0x1d524a[0x1]};}}catch(_0x4fca5e){utils[_0xd439('0x17')](util['format'](_0xd439('0xf'),_0x2294d2[_0xd439('0x6')]),_0x4fca5e);}};exports['varset']=function(_0x46d536){try{utils['debug'](util[_0xd439('0x4')](_0xd439('0x18'),_0x46d536[_0xd439('0x6')]),_0x46d536);if(!_[_0xd439('0x19')](_0x46d536['variable']['outboundrouteid'])){utils['info'](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x46d536[_0xd439('0x6')],_0x46d536['value']));dials[_0x46d536[_0xd439('0x6')]]={'routeId':_0x46d536['value']};}}catch(_0x1abe4d){utils[_0xd439('0x17')](util[_0xd439('0x4')](_0xd439('0x18'),_0x46d536['uniqueid']),_0x1abe4d);}};exports['dialbegin']=function(_0x3b1832){try{if(!_[_0xd439('0x19')](dials[_0x3b1832[_0xd439('0x6')]])){utils[_0xd439('0x1a')](util[_0xd439('0x4')](_0xd439('0x1b'),_0x3b1832[_0xd439('0x6')]),_0x3b1832);dials[_0x3b1832[_0xd439('0x6')]]=_[_0xd439('0x1c')](dials[_0x3b1832[_0xd439('0x6')]],_0x3b1832);dials[_0x3b1832[_0xd439('0x6')]][_0xd439('0x1d')]=utils['now']();dials[_0x3b1832[_0xd439('0x6')]][_0xd439('0x1e')]=_0xd439('0x1f');utils[_0xd439('0x3')](util[_0xd439('0x4')](_0xd439('0x20'),_0x3b1832['uniqueid'],dials[_0x3b1832[_0xd439('0x6')]]['starttime']));}}catch(_0x1d355a){utils['error'](util[_0xd439('0x4')](_0xd439('0x1b'),_0x3b1832['uniqueid']),_0x1d355a);}};exports['dialend']=function(_0x2ac4fc){try{if(!_['isNil'](dials[_0x2ac4fc['uniqueid']])){utils['debug'](util['format'](_0xd439('0x21'),_0x2ac4fc['uniqueid']),_0x2ac4fc);dials[_0x2ac4fc[_0xd439('0x6')]]['dialstatus']=_0x2ac4fc[_0xd439('0xb')];if(_0x2ac4fc[_0xd439('0xb')]==_0xd439('0x22')){dials[_0x2ac4fc[_0xd439('0x6')]]=_[_0xd439('0x1c')](dials[_0x2ac4fc[_0xd439('0x6')]],_0x2ac4fc);dials[_0x2ac4fc[_0xd439('0x6')]][_0xd439('0x23')]=utils[_0xd439('0x24')]();dials[_0x2ac4fc[_0xd439('0x6')]][_0xd439('0x1e')]=_0xd439('0x25');utils['info'](util[_0xd439('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x2ac4fc['uniqueid'],_0x2ac4fc[_0xd439('0xb')],dials[_0x2ac4fc[_0xd439('0x6')]][_0xd439('0x23')]));}else{utils[_0xd439('0x3')](util[_0xd439('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x2ac4fc[_0xd439('0x6')],_0x2ac4fc[_0xd439('0xb')]));}}}catch(_0xb4456b){utils[_0xd439('0x17')](util['format'](_0xd439('0x21'),_0x2ac4fc[_0xd439('0x6')]),_0xb4456b);}};exports['hangup']=function(_0x10fca4){try{if(!_[_0xd439('0x19')](dials[_0x10fca4[_0xd439('0x6')]])){utils[_0xd439('0x1a')](util[_0xd439('0x4')]('[%s][dials][hangup]',_0x10fca4[_0xd439('0x6')]),_0x10fca4);utils['info'](util[_0xd439('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x10fca4['uniqueid'],_0x10fca4[_0xd439('0x9')],_0x10fca4['calleridname'],_0x10fca4[_0xd439('0x26')]));dials[_0x10fca4[_0xd439('0x6')]]=_[_0xd439('0x1c')](dials[_0x10fca4['uniqueid']],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x10fca4[_0xd439('0x6')]][_0xd439('0x27')]=utils[_0xd439('0x28')](dials[_0x10fca4[_0xd439('0x6')]]['endtime'],dials[_0x10fca4[_0xd439('0x6')]]['starttime']);dials[_0x10fca4[_0xd439('0x6')]]['holdtime']=utils[_0xd439('0x28')](dials[_0x10fca4[_0xd439('0x6')]][_0xd439('0x23')]||dials[_0x10fca4[_0xd439('0x6')]]['endtime'],dials[_0x10fca4[_0xd439('0x6')]][_0xd439('0x1d')]);dials[_0x10fca4['uniqueid']][_0xd439('0x29')]=dials[_0x10fca4['uniqueid']][_0xd439('0x23')]?utils['diffTime'](dials[_0x10fca4[_0xd439('0x6')]][_0xd439('0x2a')],dials[_0x10fca4['uniqueid']][_0xd439('0x23')]):0x0;writeDB(dials[_0x10fca4[_0xd439('0x6')]]);}}catch(_0x24d443){utils[_0xd439('0x17')](util['format'](_0xd439('0x2b'),_0x10fca4[_0xd439('0x6')]),_0x24d443);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 98f7e77..0122a77 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 _0x4fb3=['origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./dials.controller','./transfers.controller','./core.controller','connect','fullybooted','error','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]'];(function(_0x13c3d3,_0x4a5e96){var _0x3cc755=function(_0x3675cd){while(--_0x3675cd){_0x13c3d3['push'](_0x13c3d3['shift']());}};_0x3cc755(++_0x4a5e96);}(_0x4fb3,0x11c));var _0x34fb=function(_0x42c13e,_0x2f0c23){_0x42c13e=_0x42c13e-0x0;var _0x138eaf=_0x4fb3[_0x42c13e];return _0x138eaf;};var AsteriskManager=require(_0x34fb('0x0'));var config=require('../../config/environment');var utils=require(_0x34fb('0x1'));var util=require(_0x34fb('0x2'));var isXDREnabled=config[_0x34fb('0x3')]&&config[_0x34fb('0x3')][_0x34fb('0x4')]?!config[_0x34fb('0x3')][_0x34fb('0x4')]:!![];var isProduction=config[_0x34fb('0x5')]===_0x34fb('0x6')||![];var isLocalAsterisk=config[_0x34fb('0x3')]&&config[_0x34fb('0x3')][_0x34fb('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x34fb('0x8')][_0x34fb('0x9')],config[_0x34fb('0x8')]['ip'],config['asterisk'][_0x34fb('0xa')],config['asterisk'][_0x34fb('0xb')],!![]);ami[_0x34fb('0xc')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x34fb('0xd')](_0x34fb('0xe'));}else{var agents=require('./agents.controller');var calls=require(_0x34fb('0xf'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x34fb('0x10'));var transfers=require(_0x34fb('0x11'));var core=require(_0x34fb('0x12'));ami['on'](_0x34fb('0x13'),core['connect']);ami['on']('shutdown',core['shutdown']);ami['on'](_0x34fb('0x14'),core['fullybooted']);ami['on'](_0x34fb('0x15'),core[_0x34fb('0x15')]);ami['on']('close',core['close']);ami['on']('managerevent',core[_0x34fb('0x16')]);ami['on'](_0x34fb('0x17'),function(_0x188cc0){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x1a'),_0x188cc0[_0x34fb('0x1b')]),_0x188cc0);members[_0x34fb('0x17')](_0x188cc0);}catch(_0x172d3a){utils[_0x34fb('0x15')](util['format'](_0x34fb('0x1a'),_0x188cc0['device']),_0x172d3a);}});ami['on'](_0x34fb('0x1c'),function(_0x552dc2){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x1d'),_0x552dc2[_0x34fb('0x1e')]),_0x552dc2);agents[_0x34fb('0x1c')](_0x552dc2);}catch(_0x13c3b3){utils[_0x34fb('0x15')](util[_0x34fb('0x19')]('[%s][index][agentcalled]',_0x552dc2['uniqueid']),_0x13c3b3);}});ami['on'](_0x34fb('0x1f'),function(_0x1f9228){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x20'),_0x1f9228[_0x34fb('0x1e')]),_0x1f9228);agents[_0x34fb('0x1f')](_0x1f9228);}catch(_0x204b7e){utils[_0x34fb('0x15')](util['format'](_0x34fb('0x20'),_0x1f9228[_0x34fb('0x1e')]),_0x204b7e);}});ami['on'](_0x34fb('0x21'),function(_0x31e0f6){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x22'),_0x31e0f6[_0x34fb('0x1e')]),_0x31e0f6);agents[_0x34fb('0x21')](_0x31e0f6);queues[_0x34fb('0x21')](_0x31e0f6);}catch(_0x5d2394){utils[_0x34fb('0x15')](util[_0x34fb('0x19')](_0x34fb('0x22'),_0x31e0f6[_0x34fb('0x1e')]),_0x5d2394);}});ami['on'](_0x34fb('0x23'),function(_0x3c16e3){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x24'),_0x3c16e3['uniqueid']),_0x3c16e3);agents[_0x34fb('0x23')](_0x3c16e3);queues[_0x34fb('0x23')](_0x3c16e3);members[_0x34fb('0x23')](_0x3c16e3);}catch(_0x21e8b3){utils['error'](util[_0x34fb('0x19')](_0x34fb('0x24'),_0x3c16e3[_0x34fb('0x1e')]),_0x21e8b3);}});ami['on'](_0x34fb('0x25'),function(_0x350c71){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x26'),_0x350c71[_0x34fb('0x1e')]),_0x350c71);agents['queuecallerabandon'](_0x350c71);queues[_0x34fb('0x25')](_0x350c71);}catch(_0x53defa){utils[_0x34fb('0x15')](util[_0x34fb('0x19')](_0x34fb('0x26'),_0x350c71[_0x34fb('0x1e')]),_0x53defa);}});ami['on'](_0x34fb('0x27'),function(_0x27eed0){try{utils['debug'](util[_0x34fb('0x19')](_0x34fb('0x28'),_0x27eed0[_0x34fb('0x1e')]),_0x27eed0);queues[_0x34fb('0x27')](_0x27eed0);recordings[_0x34fb('0x27')](_0x27eed0);}catch(_0xdf156a){utils[_0x34fb('0x15')](util[_0x34fb('0x19')](_0x34fb('0x28'),_0x27eed0[_0x34fb('0x1e')]),_0xdf156a);}});ami['on'](_0x34fb('0x29'),function(_0xf933a7){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x2a'),_0xf933a7[_0x34fb('0x1e')]),_0xf933a7);queues[_0x34fb('0x29')](_0xf933a7);}catch(_0x876ff9){utils[_0x34fb('0x15')](util['format'](_0x34fb('0x2a'),_0xf933a7[_0x34fb('0x1e')]),_0x876ff9);}});ami['on'](_0x34fb('0x2b'),function(_0x52cbf0){try{utils[_0x34fb('0x18')](util['format'](_0x34fb('0x2c'),_0x52cbf0['uniqueid']),_0x52cbf0);queues[_0x34fb('0x2b')](_0x52cbf0);calls[_0x34fb('0x2b')](_0x52cbf0);}catch(_0x3e4770){utils[_0x34fb('0x15')](util[_0x34fb('0x19')](_0x34fb('0x2c'),_0x52cbf0[_0x34fb('0x1e')]),_0x3e4770);}});ami['on'](_0x34fb('0x2d'),function(_0x2c0006){try{utils['debug'](util[_0x34fb('0x19')](_0x34fb('0x2e'),_0x2c0006['uniqueid']),_0x2c0006);queues[_0x34fb('0x2d')](_0x2c0006);calls[_0x34fb('0x2d')](_0x2c0006);}catch(_0x4c42f0){utils[_0x34fb('0x15')](util['format']('[%s][index][musiconholdstop]',_0x2c0006[_0x34fb('0x1e')]),_0x4c42f0);}});ami['on'](_0x34fb('0x2f'),function(_0x29c6f4){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x30'),_0x29c6f4[_0x34fb('0x1e')]),_0x29c6f4);calls[_0x34fb('0x2f')](_0x29c6f4);recordings['newstate'](_0x29c6f4);}catch(_0x4ad8e1){utils[_0x34fb('0x15')](util[_0x34fb('0x19')]('[%s][index][newstate]',_0x29c6f4[_0x34fb('0x1e')]),_0x4ad8e1);}});ami['on']('hangup',function(_0x36865a){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x31'),_0x36865a[_0x34fb('0x1e')]),_0x36865a);calls[_0x34fb('0x32')](_0x36865a);recordings[_0x34fb('0x32')](_0x36865a);dials[_0x34fb('0x32')](_0x36865a);agents[_0x34fb('0x32')](_0x36865a);queues[_0x34fb('0x32')](_0x36865a);}catch(_0x10e036){utils[_0x34fb('0x15')](util[_0x34fb('0x19')](_0x34fb('0x31'),_0x36865a[_0x34fb('0x1e')]),_0x10e036);}});ami['on']('cdr',function(_0x3c7202){try{utils[_0x34fb('0x18')](util['format']('[%s][index][cdr]',_0x3c7202[_0x34fb('0x1e')]),_0x3c7202);members[_0x34fb('0x33')](_0x3c7202);}catch(_0x4d0f1a){utils['error'](util['format'](_0x34fb('0x34'),_0x3c7202[_0x34fb('0x1e')]),_0x4d0f1a);}});ami['on'](_0x34fb('0x35'),function(_0x3c2c4b){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x36'),_0x3c2c4b[_0x34fb('0x1e')]),_0x3c2c4b);queues['blindtransfer'](_0x3c2c4b);agents[_0x34fb('0x35')](_0x3c2c4b);transfers[_0x34fb('0x35')](_0x3c2c4b);}catch(_0x157c5f){utils[_0x34fb('0x15')](util[_0x34fb('0x19')]('[%s][index][blindtransfer]',_0x3c2c4b[_0x34fb('0x1e')]),_0x157c5f);}});ami['on']('attendedtransfer',function(_0x1a6207){try{utils[_0x34fb('0x18')](util['format'](_0x34fb('0x37'),_0x1a6207[_0x34fb('0x38')]),_0x1a6207);queues[_0x34fb('0x39')](_0x1a6207);transfers[_0x34fb('0x39')](_0x1a6207);agents[_0x34fb('0x39')](_0x1a6207);calls['attendedtransfer'](_0x1a6207);}catch(_0x1b4867){utils[_0x34fb('0x15')](util[_0x34fb('0x19')](_0x34fb('0x37'),_0x1a6207[_0x34fb('0x38')]),_0x1b4867);}});ami['on'](_0x34fb('0x3a'),function(_0x27a6df){try{utils['debug'](util[_0x34fb('0x19')]('[%s][index][varset]',_0x27a6df['uniqueid']),_0x27a6df);queues[_0x34fb('0x3a')](_0x27a6df);recordings[_0x34fb('0x3a')](_0x27a6df);calls[_0x34fb('0x3a')](_0x27a6df);dials[_0x34fb('0x3a')](_0x27a6df);}catch(_0x54c316){utils[_0x34fb('0x15')](util[_0x34fb('0x19')](_0x34fb('0x3b'),_0x27a6df['uniqueid']),_0x54c316);}});ami['on'](_0x34fb('0x3c'),function(_0x3f36c2){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x3d'),_0x3f36c2[_0x34fb('0x1e')]),_0x3f36c2);calls[_0x34fb('0x3c')](_0x3f36c2);recordings[_0x34fb('0x3c')](_0x3f36c2);dials[_0x34fb('0x3c')](_0x3f36c2);}catch(_0x1de796){utils[_0x34fb('0x15')](util[_0x34fb('0x19')](_0x34fb('0x3d'),_0x3f36c2['uniqueid']),_0x1de796);}});ami['on']('newchannel',function(_0xf8932a){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x3e'),_0xf8932a['uniqueid']),_0xf8932a);calls[_0x34fb('0x3f')](_0xf8932a);recordings[_0x34fb('0x3f')](_0xf8932a);}catch(_0x5f027e){utils['error'](util[_0x34fb('0x19')]('[%s][index][newchannel]',_0xf8932a[_0x34fb('0x1e')]),_0x5f027e);}});ami['on']('dialbegin',function(_0xf43c0){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x40'),_0xf43c0['uniqueid']),_0xf43c0);dials['dialbegin'](_0xf43c0);}catch(_0x280194){utils['error'](util[_0x34fb('0x19')](_0x34fb('0x41'),_0xf43c0['uniqueid']),_0x280194);}});ami['on'](_0x34fb('0x42'),function(_0x57f6c9){try{utils[_0x34fb('0x18')](util[_0x34fb('0x19')](_0x34fb('0x43'),_0x57f6c9[_0x34fb('0x1e')]),_0x57f6c9);dials['dialend'](_0x57f6c9);}catch(_0x214579){utils[_0x34fb('0x15')](util['format'](_0x34fb('0x43'),_0x57f6c9['uniqueid']),_0x214579);}});} \ No newline at end of file +var _0x49f4=['./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x49f4,0xc2));var _0x449f=function(_0x3e2489,_0x41d9dd){_0x3e2489=_0x3e2489-0x0;var _0x2254ce=_0x49f4[_0x3e2489];return _0x2254ce;};var AsteriskManager=require('asterisk-manager');var config=require(_0x449f('0x0'));var utils=require(_0x449f('0x1'));var util=require(_0x449f('0x2'));var isXDREnabled=config[_0x449f('0x3')]&&config[_0x449f('0x3')][_0x449f('0x4')]?!config[_0x449f('0x3')][_0x449f('0x4')]:!![];var isProduction=config[_0x449f('0x5')]===_0x449f('0x6')||![];var isLocalAsterisk=config[_0x449f('0x3')]&&config[_0x449f('0x3')][_0x449f('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x449f('0x8')][_0x449f('0x9')],config[_0x449f('0x8')]['ip'],config[_0x449f('0x8')][_0x449f('0xa')],config[_0x449f('0x8')][_0x449f('0xb')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x449f('0xc')](_0x449f('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x449f('0xc')](_0x449f('0xe'));}else{var agents=require(_0x449f('0xf'));var calls=require(_0x449f('0x10'));var queues=require(_0x449f('0x11'));var recordings=require(_0x449f('0x12'));var members=require('./members.controller');var dials=require(_0x449f('0x13'));var transfers=require(_0x449f('0x14'));var core=require(_0x449f('0x15'));ami['on'](_0x449f('0x16'),core[_0x449f('0x16')]);ami['on'](_0x449f('0x17'),core[_0x449f('0x17')]);ami['on'](_0x449f('0x18'),core[_0x449f('0x18')]);ami['on'](_0x449f('0x19'),core[_0x449f('0x19')]);ami['on'](_0x449f('0x1a'),core[_0x449f('0x1a')]);ami['on']('managerevent',core['managerevent']);ami['on']('devicestatechange',function(_0x3c5d17){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')](_0x449f('0x1d'),_0x3c5d17[_0x449f('0x1e')]),_0x3c5d17);members[_0x449f('0x1f')](_0x3c5d17);}catch(_0x30f8cb){utils[_0x449f('0x19')](util['format'](_0x449f('0x1d'),_0x3c5d17['device']),_0x30f8cb);}});ami['on'](_0x449f('0x20'),function(_0x24764c){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')]('[%s][index][agentcalled]',_0x24764c['uniqueid']),_0x24764c);agents[_0x449f('0x20')](_0x24764c);}catch(_0x109595){utils[_0x449f('0x19')](util[_0x449f('0x1c')](_0x449f('0x21'),_0x24764c[_0x449f('0x22')]),_0x109595);}});ami['on'](_0x449f('0x23'),function(_0x2b2efe){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')](_0x449f('0x24'),_0x2b2efe[_0x449f('0x22')]),_0x2b2efe);agents['agentringnoanswer'](_0x2b2efe);}catch(_0x5ae909){utils[_0x449f('0x19')](util['format'](_0x449f('0x24'),_0x2b2efe['uniqueid']),_0x5ae909);}});ami['on'](_0x449f('0x25'),function(_0x2a6596){try{utils['debug'](util['format'](_0x449f('0x26'),_0x2a6596[_0x449f('0x22')]),_0x2a6596);agents[_0x449f('0x25')](_0x2a6596);queues[_0x449f('0x25')](_0x2a6596);}catch(_0x5b7ee9){utils[_0x449f('0x19')](util[_0x449f('0x1c')](_0x449f('0x26'),_0x2a6596[_0x449f('0x22')]),_0x5b7ee9);}});ami['on'](_0x449f('0x27'),function(_0x3f04e5){try{utils[_0x449f('0x1b')](util['format'](_0x449f('0x28'),_0x3f04e5[_0x449f('0x22')]),_0x3f04e5);agents['agentcomplete'](_0x3f04e5);queues[_0x449f('0x27')](_0x3f04e5);members[_0x449f('0x27')](_0x3f04e5);}catch(_0x154803){utils[_0x449f('0x19')](util[_0x449f('0x1c')](_0x449f('0x28'),_0x3f04e5['uniqueid']),_0x154803);}});ami['on'](_0x449f('0x29'),function(_0x1e8f77){try{utils[_0x449f('0x1b')](util['format'](_0x449f('0x2a'),_0x1e8f77['uniqueid']),_0x1e8f77);agents[_0x449f('0x29')](_0x1e8f77);queues[_0x449f('0x29')](_0x1e8f77);}catch(_0x58cee0){utils[_0x449f('0x19')](util[_0x449f('0x1c')](_0x449f('0x2a'),_0x1e8f77['uniqueid']),_0x58cee0);}});ami['on'](_0x449f('0x2b'),function(_0x22b192){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')](_0x449f('0x2c'),_0x22b192[_0x449f('0x22')]),_0x22b192);queues[_0x449f('0x2b')](_0x22b192);recordings['queuecallerjoin'](_0x22b192);}catch(_0xaf52b9){utils[_0x449f('0x19')](util['format']('[%s][index][queuecallerjoin]',_0x22b192[_0x449f('0x22')]),_0xaf52b9);}});ami['on'](_0x449f('0x2d'),function(_0x30e024){try{utils[_0x449f('0x1b')](util['format'](_0x449f('0x2e'),_0x30e024[_0x449f('0x22')]),_0x30e024);queues[_0x449f('0x2d')](_0x30e024);}catch(_0x2c8e03){utils['error'](util[_0x449f('0x1c')]('[%s][index][queuecallerleave]',_0x30e024['uniqueid']),_0x2c8e03);}});ami['on']('musiconholdstart',function(_0x57d40f){try{utils[_0x449f('0x1b')](util['format'](_0x449f('0x2f'),_0x57d40f['uniqueid']),_0x57d40f);queues[_0x449f('0x30')](_0x57d40f);calls['musiconholdstart'](_0x57d40f);}catch(_0x16f6f3){utils[_0x449f('0x19')](util['format'](_0x449f('0x2f'),_0x57d40f['uniqueid']),_0x16f6f3);}});ami['on']('musiconholdstop',function(_0x48d347){try{utils['debug'](util[_0x449f('0x1c')](_0x449f('0x31'),_0x48d347['uniqueid']),_0x48d347);queues['musiconholdstop'](_0x48d347);calls['musiconholdstop'](_0x48d347);}catch(_0x39482e){utils[_0x449f('0x19')](util['format'](_0x449f('0x31'),_0x48d347[_0x449f('0x22')]),_0x39482e);}});ami['on'](_0x449f('0x32'),function(_0x497779){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')]('[%s][index][newstate]',_0x497779[_0x449f('0x22')]),_0x497779);calls[_0x449f('0x32')](_0x497779);recordings[_0x449f('0x32')](_0x497779);}catch(_0x3ee6d2){utils[_0x449f('0x19')](util[_0x449f('0x1c')]('[%s][index][newstate]',_0x497779[_0x449f('0x22')]),_0x3ee6d2);}});ami['on'](_0x449f('0x33'),function(_0x1fbda8){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')](_0x449f('0x34'),_0x1fbda8['uniqueid']),_0x1fbda8);calls[_0x449f('0x33')](_0x1fbda8);recordings[_0x449f('0x33')](_0x1fbda8);dials['hangup'](_0x1fbda8);agents[_0x449f('0x33')](_0x1fbda8);queues[_0x449f('0x33')](_0x1fbda8);}catch(_0x11fd94){utils[_0x449f('0x19')](util[_0x449f('0x1c')](_0x449f('0x34'),_0x1fbda8[_0x449f('0x22')]),_0x11fd94);}});ami['on']('cdr',function(_0x187832){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')](_0x449f('0x35'),_0x187832['uniqueid']),_0x187832);members[_0x449f('0x36')](_0x187832);}catch(_0x10c27a){utils[_0x449f('0x19')](util[_0x449f('0x1c')](_0x449f('0x35'),_0x187832[_0x449f('0x22')]),_0x10c27a);}});ami['on'](_0x449f('0x37'),function(_0x59b9b7){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')](_0x449f('0x38'),_0x59b9b7[_0x449f('0x22')]),_0x59b9b7);queues['blindtransfer'](_0x59b9b7);agents[_0x449f('0x37')](_0x59b9b7);transfers['blindtransfer'](_0x59b9b7);}catch(_0x1aa6f2){utils[_0x449f('0x19')](util[_0x449f('0x1c')](_0x449f('0x38'),_0x59b9b7[_0x449f('0x22')]),_0x1aa6f2);}});ami['on'](_0x449f('0x39'),function(_0x2ff1fa){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')]('[%s][index][attendedtransfer]',_0x2ff1fa[_0x449f('0x3a')]),_0x2ff1fa);queues['attendedtransfer'](_0x2ff1fa);transfers[_0x449f('0x39')](_0x2ff1fa);agents[_0x449f('0x39')](_0x2ff1fa);calls[_0x449f('0x39')](_0x2ff1fa);}catch(_0x2efb89){utils[_0x449f('0x19')](util[_0x449f('0x1c')](_0x449f('0x3b'),_0x2ff1fa[_0x449f('0x3a')]),_0x2efb89);}});ami['on']('varset',function(_0x5dbdec){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')](_0x449f('0x3c'),_0x5dbdec[_0x449f('0x22')]),_0x5dbdec);queues[_0x449f('0x3d')](_0x5dbdec);recordings[_0x449f('0x3d')](_0x5dbdec);calls[_0x449f('0x3d')](_0x5dbdec);dials['varset'](_0x5dbdec);}catch(_0x5b4130){utils['error'](util['format'](_0x449f('0x3c'),_0x5dbdec[_0x449f('0x22')]),_0x5b4130);}});ami['on']('newexten',function(_0x90a934){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')](_0x449f('0x3e'),_0x90a934['uniqueid']),_0x90a934);calls[_0x449f('0x3f')](_0x90a934);recordings['newexten'](_0x90a934);dials[_0x449f('0x3f')](_0x90a934);}catch(_0x4ce907){utils['error'](util[_0x449f('0x1c')](_0x449f('0x3e'),_0x90a934['uniqueid']),_0x4ce907);}});ami['on'](_0x449f('0x40'),function(_0x4c6d35){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')]('[%s][index][newchannel]',_0x4c6d35[_0x449f('0x22')]),_0x4c6d35);calls['newchannel'](_0x4c6d35);recordings[_0x449f('0x40')](_0x4c6d35);}catch(_0x4eca50){utils['error'](util['format'](_0x449f('0x41'),_0x4c6d35[_0x449f('0x22')]),_0x4eca50);}});ami['on'](_0x449f('0x42'),function(_0x54b01b){try{utils[_0x449f('0x1b')](util[_0x449f('0x1c')](_0x449f('0x43'),_0x54b01b['uniqueid']),_0x54b01b);dials['dialbegin'](_0x54b01b);}catch(_0x1cf490){utils['error'](util[_0x449f('0x1c')]('[%s]dialbegin',_0x54b01b[_0x449f('0x22')]),_0x1cf490);}});ami['on'](_0x449f('0x44'),function(_0x37705f){try{utils['debug'](util['format']('[%s][index][dialend]',_0x37705f[_0x449f('0x22')]),_0x37705f);dials[_0x449f('0x44')](_0x37705f);}catch(_0x3e75a7){utils['error'](util[_0x449f('0x1c')](_0x449f('0x45'),_0x37705f[_0x449f('0x22')]),_0x3e75a7);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 589679f..9067aec 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 _0x1502=['[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','getUserByInterface','name','internal','request','CreateMemberReport','split','then','catch','error','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','INUSE','BUSY','voice','TALKING','now','isNil','exitAt','duration','enterAt','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','channel','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x1502,0x1c3));var _0x2150=function(_0x54fb8e,_0x4c1800){_0x54fb8e=_0x54fb8e-0x0;var _0x5a8fd6=_0x1502[_0x54fb8e];return _0x5a8fd6;};'use strict';var _=require(_0x2150('0x0'));var util=require(_0x2150('0x1'));var utils=require(_0x2150('0x2'));var members={};var exclude=[_0x2150('0x3'),_0x2150('0x4')];function writeDB(_0x208af9){utils['info'](util[_0x2150('0x5')](_0x2150('0x6'),_0x208af9[_0x2150('0x7')],_0x208af9[_0x2150('0x8')],_0x208af9['channel'],_0x208af9[_0x2150('0x9')],_0x208af9[_0x2150('0xa')],_0x208af9['type']));if(_0x208af9[_0x2150('0x8')]){utils[_0x2150('0xb')](_0x208af9[_0x2150('0x8')])['then'](function(_0x31a4f){if(_0x31a4f){_0x208af9[_0x2150('0xa')]=_0x31a4f[_0x2150('0xc')];_0x208af9['internal']=_0x31a4f[_0x2150('0xd')];utils[_0x2150('0xe')](_0x2150('0xf'),_0x208af9);}else{utils['getUserByName'](_0x208af9[_0x2150('0x8')][_0x2150('0x10')]('/')[0x1])[_0x2150('0x11')](function(_0x30975e){if(_0x30975e){_0x208af9['membername']=_0x30975e['name'];_0x208af9[_0x2150('0xd')]=_0x30975e[_0x2150('0xd')];utils['request']('CreateMemberReport',_0x208af9);}});}})[_0x2150('0x12')](function(_0x1536f){utils[_0x2150('0x13')](util['format']('[%s][members][writeDB]',_0x208af9[_0x2150('0x7')]),_0x1536f);});}delete members[_0x208af9[_0x2150('0x8')]];}function startsWith(_0x4beabc,_0x13ad4b){return _[_0x2150('0x14')](_0x4beabc,function(_0x3543a1){return _[_0x2150('0x15')](_0x13ad4b,_0x3543a1);});}exports[_0x2150('0x16')]=function(_0x31b9fb){try{utils[_0x2150('0x17')](util[_0x2150('0x5')](_0x2150('0x18'),members[_0x31b9fb[_0x2150('0x19')]]?members[_0x31b9fb[_0x2150('0x19')]][_0x2150('0x7')]:_0x31b9fb[_0x2150('0x19')]),_0x31b9fb);utils['info'](util['format'](_0x2150('0x1a'),members[_0x31b9fb[_0x2150('0x19')]]?members[_0x31b9fb[_0x2150('0x19')]][_0x2150('0x7')]:_0x31b9fb['device'],_0x31b9fb['state'],_0x31b9fb[_0x2150('0x19')]));switch(_0x31b9fb['state']){case _0x2150('0x1b'):case _0x2150('0x1c'):if(!startsWith(exclude,_0x31b9fb[_0x2150('0x19')])){members[_0x31b9fb[_0x2150('0x19')]]={'channel':_0x2150('0x1d'),'interface':_0x31b9fb['device'],'type':_0x2150('0x1e'),'enterAt':utils[_0x2150('0x1f')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x2150('0x20')](members[_0x31b9fb[_0x2150('0x19')]])){members[_0x31b9fb[_0x2150('0x19')]][_0x2150('0x21')]=utils[_0x2150('0x1f')]();members[_0x31b9fb[_0x2150('0x19')]][_0x2150('0x22')]=utils['diffTime'](members[_0x31b9fb[_0x2150('0x19')]]['exitAt'],members[_0x31b9fb['device']][_0x2150('0x23')]);if(members[_0x31b9fb[_0x2150('0x19')]]['uniqueid']){writeDB(members[_0x31b9fb['device']]);}}break;default:break;}}catch(_0xabd935){utils['error'](util[_0x2150('0x5')](_0x2150('0x18'),members[_0x31b9fb[_0x2150('0x19')]]?members[_0x31b9fb[_0x2150('0x19')]]['uniqueid']:_0x31b9fb[_0x2150('0x19')]),_0xabd935);}};exports['agentcomplete']=function(_0x1b1d6a){try{if(!_['isNil'](members[_0x1b1d6a[_0x2150('0x8')]])){utils[_0x2150('0x17')](util[_0x2150('0x5')](_0x2150('0x24'),_0x1b1d6a[_0x2150('0x7')]),_0x1b1d6a);utils[_0x2150('0x25')](util[_0x2150('0x5')](_0x2150('0x26'),_0x1b1d6a[_0x2150('0x7')],_0x1b1d6a[_0x2150('0x8')],_0x1b1d6a[_0x2150('0x27')]));members[_0x1b1d6a[_0x2150('0x8')]]=_[_0x2150('0x28')](members[_0x1b1d6a['interface']],{'data4':_0x1b1d6a[_0x2150('0x27')],'uniqueid':_0x1b1d6a[_0x2150('0x7')]});}}catch(_0x656c7f){utils[_0x2150('0x13')](util[_0x2150('0x5')](_0x2150('0x24'),_0x1b1d6a['uniqueid']),_0x656c7f);}};exports['cdr']=function(_0x253c5f){try{utils[_0x2150('0x17')](util[_0x2150('0x5')]('[%s][members][cdr]',_0x253c5f[_0x2150('0x7')]),_0x253c5f);if(_0x253c5f[_0x2150('0x29')]){var _0x2b4050=_0x253c5f['channel']['split']('-')[0x0];if(!_[_0x2150('0x20')](members[_0x2b4050])){members[_0x2b4050]=_[_0x2150('0x28')](members[_0x2b4050],{'data1':members[_0x2b4050][_0x2150('0x2a')]||_0x253c5f[_0x2150('0x2b')],'data2':members[_0x2b4050][_0x2150('0x9')]||_0x253c5f[_0x2150('0x2c')],'data3':members[_0x2b4050][_0x2150('0x2d')]||_0x253c5f[_0x2150('0x2e')],'uniqueid':members[_0x2b4050][_0x2150('0x7')]||_0x253c5f[_0x2150('0x7')]});utils[_0x2150('0x25')](util[_0x2150('0x5')](_0x2150('0x2f'),_0x253c5f[_0x2150('0x7')],members[_0x2b4050][_0x2150('0x2a')],members[_0x2b4050]['data2'],members[_0x2b4050]['data3']));if(members[_0x2b4050]['exitAt']){writeDB(members[_0x2b4050]);}}}if(_0x253c5f[_0x2150('0x30')]){var _0x5b240e=_0x253c5f[_0x2150('0x30')]['split']('-')[0x0];if(!_['isNil'](members[_0x5b240e])){members[_0x5b240e]=_[_0x2150('0x28')](members[_0x5b240e],{'data1':members[_0x5b240e][_0x2150('0x2a')]||_0x253c5f[_0x2150('0x2b')],'data2':members[_0x5b240e][_0x2150('0x9')]||_0x253c5f[_0x2150('0x2c')],'data3':members[_0x5b240e]['data3']||_0x253c5f[_0x2150('0x2e')],'uniqueid':members[_0x5b240e][_0x2150('0x7')]||_0x253c5f[_0x2150('0x7')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x253c5f[_0x2150('0x7')],members[_0x5b240e][_0x2150('0x2a')],members[_0x5b240e]['data2'],members[_0x5b240e][_0x2150('0x2d')]));if(members[_0x5b240e][_0x2150('0x21')]){writeDB(members[_0x5b240e]);}}}}catch(_0x555ec6){utils[_0x2150('0x13')](util['format'](_0x2150('0x31'),_0x253c5f['uniqueid']),_0x555ec6);}}; \ No newline at end of file +var _0x4156=['interface','channel','data2','type','getUserByInterface','membername','name','internal','request','split','then','CreateMemberReport','catch','error','some','debug','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][cdr]','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data3','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid'];(function(_0x408ff1,_0x4eecd6){var _0x1ecf19=function(_0x4a7cda){while(--_0x4a7cda){_0x408ff1['push'](_0x408ff1['shift']());}};_0x1ecf19(++_0x4eecd6);}(_0x4156,0xf1));var _0x6415=function(_0x1ff687,_0x3f1062){_0x1ff687=_0x1ff687-0x0;var _0x398f2e=_0x4156[_0x1ff687];return _0x398f2e;};'use strict';var _=require(_0x6415('0x0'));var util=require(_0x6415('0x1'));var utils=require(_0x6415('0x2'));var members={};var exclude=[_0x6415('0x3'),_0x6415('0x4')];function writeDB(_0x5438c5){utils[_0x6415('0x5')](util[_0x6415('0x6')](_0x6415('0x7'),_0x5438c5[_0x6415('0x8')],_0x5438c5[_0x6415('0x9')],_0x5438c5[_0x6415('0xa')],_0x5438c5[_0x6415('0xb')],_0x5438c5['membername'],_0x5438c5[_0x6415('0xc')]));if(_0x5438c5['interface']){utils[_0x6415('0xd')](_0x5438c5[_0x6415('0x9')])['then'](function(_0x919b59){if(_0x919b59){_0x5438c5[_0x6415('0xe')]=_0x919b59[_0x6415('0xf')];_0x5438c5[_0x6415('0x10')]=_0x919b59['internal'];utils[_0x6415('0x11')]('CreateMemberReport',_0x5438c5);}else{utils['getUserByName'](_0x5438c5[_0x6415('0x9')][_0x6415('0x12')]('/')[0x1])[_0x6415('0x13')](function(_0x83ac72){if(_0x83ac72){_0x5438c5[_0x6415('0xe')]=_0x83ac72[_0x6415('0xf')];_0x5438c5[_0x6415('0x10')]=_0x83ac72['internal'];utils['request'](_0x6415('0x14'),_0x5438c5);}});}})[_0x6415('0x15')](function(_0x2a4d5c){utils[_0x6415('0x16')](util[_0x6415('0x6')]('[%s][members][writeDB]',_0x5438c5['uniqueid']),_0x2a4d5c);});}delete members[_0x5438c5[_0x6415('0x9')]];}function startsWith(_0x780643,_0x48017d){return _[_0x6415('0x17')](_0x780643,function(_0x41f9b0){return _['startsWith'](_0x48017d,_0x41f9b0);});}exports['devicestatechange']=function(_0x352a04){try{utils[_0x6415('0x18')](util[_0x6415('0x6')](_0x6415('0x19'),members[_0x352a04[_0x6415('0x1a')]]?members[_0x352a04[_0x6415('0x1a')]][_0x6415('0x8')]:_0x352a04[_0x6415('0x1a')]),_0x352a04);utils[_0x6415('0x5')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x352a04['device']]?members[_0x352a04[_0x6415('0x1a')]][_0x6415('0x8')]:_0x352a04[_0x6415('0x1a')],_0x352a04[_0x6415('0x1b')],_0x352a04['device']));switch(_0x352a04[_0x6415('0x1b')]){case _0x6415('0x1c'):case _0x6415('0x1d'):if(!startsWith(exclude,_0x352a04['device'])){members[_0x352a04[_0x6415('0x1a')]]={'channel':_0x6415('0x1e'),'interface':_0x352a04[_0x6415('0x1a')],'type':_0x6415('0x1f'),'enterAt':utils[_0x6415('0x20')](),'role':_0x6415('0x21')};}break;case _0x6415('0x22'):if(!_[_0x6415('0x23')](members[_0x352a04[_0x6415('0x1a')]])){members[_0x352a04['device']][_0x6415('0x24')]=utils[_0x6415('0x20')]();members[_0x352a04['device']][_0x6415('0x25')]=utils[_0x6415('0x26')](members[_0x352a04[_0x6415('0x1a')]][_0x6415('0x24')],members[_0x352a04[_0x6415('0x1a')]]['enterAt']);if(members[_0x352a04[_0x6415('0x1a')]]['uniqueid']){writeDB(members[_0x352a04[_0x6415('0x1a')]]);}}break;default:break;}}catch(_0xbe3a32){utils[_0x6415('0x16')](util['format']('[%s][members][devicestatechange]',members[_0x352a04['device']]?members[_0x352a04[_0x6415('0x1a')]][_0x6415('0x8')]:_0x352a04['device']),_0xbe3a32);}};exports['agentcomplete']=function(_0xf3e415){try{if(!_[_0x6415('0x23')](members[_0xf3e415[_0x6415('0x9')]])){utils[_0x6415('0x18')](util[_0x6415('0x6')](_0x6415('0x27'),_0xf3e415['uniqueid']),_0xf3e415);utils[_0x6415('0x5')](util[_0x6415('0x6')](_0x6415('0x28'),_0xf3e415[_0x6415('0x8')],_0xf3e415['interface'],_0xf3e415['queue']));members[_0xf3e415['interface']]=_[_0x6415('0x29')](members[_0xf3e415['interface']],{'data4':_0xf3e415[_0x6415('0x2a')],'uniqueid':_0xf3e415['uniqueid']});}}catch(_0x1ee01f){utils[_0x6415('0x16')](util[_0x6415('0x6')](_0x6415('0x27'),_0xf3e415['uniqueid']),_0x1ee01f);}};exports['cdr']=function(_0x29eb29){try{utils[_0x6415('0x18')](util[_0x6415('0x6')](_0x6415('0x2b'),_0x29eb29[_0x6415('0x8')]),_0x29eb29);if(_0x29eb29[_0x6415('0xa')]){var _0x551dda=_0x29eb29[_0x6415('0xa')]['split']('-')[0x0];if(!_['isNil'](members[_0x551dda])){members[_0x551dda]=_['assign'](members[_0x551dda],{'data1':members[_0x551dda]['data1']||_0x29eb29[_0x6415('0xc')],'data2':members[_0x551dda][_0x6415('0xb')]||_0x29eb29[_0x6415('0x2c')],'data3':members[_0x551dda]['data3']||_0x29eb29[_0x6415('0x2d')],'uniqueid':members[_0x551dda][_0x6415('0x8')]||_0x29eb29['uniqueid']});utils[_0x6415('0x5')](util[_0x6415('0x6')](_0x6415('0x2e'),_0x29eb29[_0x6415('0x8')],members[_0x551dda][_0x6415('0x2f')],members[_0x551dda]['data2'],members[_0x551dda][_0x6415('0x30')]));if(members[_0x551dda]['exitAt']){writeDB(members[_0x551dda]);}}}if(_0x29eb29[_0x6415('0x31')]){var _0x1ddab3=_0x29eb29['destinationchannel'][_0x6415('0x12')]('-')[0x0];if(!_[_0x6415('0x23')](members[_0x1ddab3])){members[_0x1ddab3]=_['assign'](members[_0x1ddab3],{'data1':members[_0x1ddab3]['data1']||_0x29eb29[_0x6415('0xc')],'data2':members[_0x1ddab3]['data2']||_0x29eb29[_0x6415('0x2c')],'data3':members[_0x1ddab3]['data3']||_0x29eb29[_0x6415('0x2d')],'uniqueid':members[_0x1ddab3][_0x6415('0x8')]||_0x29eb29['uniqueid']});utils[_0x6415('0x5')](util['format'](_0x6415('0x2e'),_0x29eb29[_0x6415('0x8')],members[_0x1ddab3][_0x6415('0x2f')],members[_0x1ddab3][_0x6415('0xb')],members[_0x1ddab3][_0x6415('0x30')]));if(members[_0x1ddab3][_0x6415('0x24')]){writeDB(members[_0x1ddab3]);}}}}catch(_0x366b4d){utils[_0x6415('0x16')](util[_0x6415('0x6')](_0x6415('0x2b'),_0x29eb29[_0x6415('0x8')]),_0x366b4d);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 8a65370..1e31733 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 _0x0d52=['queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','variable','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','[%s][queues][agentconnect]','agentcomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','secondtransfereruniqueid','secondtransfererexten','transfertype','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]'];(function(_0x583aa3,_0x16854){var _0x37a92c=function(_0x1a6259){while(--_0x1a6259){_0x583aa3['push'](_0x583aa3['shift']());}};_0x37a92c(++_0x16854);}(_0x0d52,0x1f2));var _0x20d5=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x0d52[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x20d5('0x0'));var util=require(_0x20d5('0x1'));var utils=require(_0x20d5('0x2'));var queues={};function writeDB(_0x5964ad){utils[_0x20d5('0x3')](util['format'](_0x20d5('0x4'),_0x5964ad[_0x20d5('0x5')],_0x5964ad[_0x20d5('0x6')],_0x5964ad[_0x20d5('0x7')],_0x5964ad['lastAssignedTo'],_0x5964ad[_0x20d5('0x8')],_0x5964ad[_0x20d5('0x9')],_0x5964ad[_0x20d5('0xa')]));if(_0x5964ad['queue']){utils[_0x20d5('0xb')](_0x5964ad['queue'])[_0x20d5('0xc')](function(_0x585bbf){if(_0x585bbf){_0x5964ad[_0x20d5('0xd')]=_0x585bbf['type'];}utils[_0x20d5('0xe')](_0x20d5('0xf'),_0x5964ad);});}else{utils[_0x20d5('0xe')](_0x20d5('0xf'),_0x5964ad);}if(_0x5964ad[_0x20d5('0x10')]){delete queues[_0x5964ad[_0x20d5('0x10')]];}else{delete queues[_0x5964ad['uniqueid']];}}exports[_0x20d5('0x11')]=function(_0x20dd6b){try{utils[_0x20d5('0x12')](util[_0x20d5('0x13')](_0x20d5('0x14'),_0x20dd6b['uniqueid']),_0x20dd6b);utils[_0x20d5('0x3')](util[_0x20d5('0x13')](_0x20d5('0x15'),_0x20dd6b[_0x20d5('0x5')],_0x20dd6b[_0x20d5('0x7')],_0x20dd6b[_0x20d5('0x16')]));queues[_0x20dd6b[_0x20d5('0x5')]]=_[_0x20d5('0x17')](_0x20dd6b,{'originalposition':_0x20dd6b[_0x20d5('0x16')],'queuecallerjoinAt':utils[_0x20d5('0x18')](),'mohtime':0x0});}catch(_0x117c4e){utils[_0x20d5('0x19')](util[_0x20d5('0x13')](_0x20d5('0x14'),_0x20dd6b[_0x20d5('0x5')]),_0x117c4e);}};exports[_0x20d5('0x1a')]=function(_0x5f10a9){try{if(!_[_0x20d5('0x1b')](queues[_0x5f10a9[_0x20d5('0x5')]])){utils['debug'](util[_0x20d5('0x13')]('[%s][queues][hangup]',_0x5f10a9[_0x20d5('0x5')]),_0x5f10a9);if(queues[_0x5f10a9[_0x20d5('0x5')]]['queuecallerleaveAt']){if(!queues[_0x5f10a9['uniqueid']][_0x20d5('0x1c')]&&!queues[_0x5f10a9['uniqueid']]['queuecallerexit']){queues[_0x5f10a9[_0x20d5('0x5')]][_0x20d5('0x1d')]=!![];queues[_0x5f10a9[_0x20d5('0x5')]][_0x20d5('0x1e')]=utils['now']();queues[_0x5f10a9[_0x20d5('0x5')]][_0x20d5('0xa')]=_0x20d5('0x1f');}utils[_0x20d5('0x3')](util[_0x20d5('0x13')](_0x20d5('0x20'),_0x5f10a9[_0x20d5('0x5')],queues[_0x5f10a9[_0x20d5('0x5')]][_0x20d5('0x21')],queues[_0x5f10a9[_0x20d5('0x5')]][_0x20d5('0xa')]));writeDB(queues[_0x5f10a9[_0x20d5('0x5')]]);}else if(queues[_0x5f10a9[_0x20d5('0x5')]][_0x20d5('0x10')]){utils[_0x20d5('0x3')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x5f10a9[_0x20d5('0x5')],queues[_0x5f10a9[_0x20d5('0x5')]][_0x20d5('0x21')],queues[_0x5f10a9[_0x20d5('0x5')]][_0x20d5('0x10')]));queues[queues[_0x5f10a9[_0x20d5('0x5')]]['transfereduniqueid']]=queues[_0x5f10a9[_0x20d5('0x5')]];queues[queues[_0x5f10a9[_0x20d5('0x5')]][_0x20d5('0x10')]][_0x20d5('0x22')]=0x2;delete queues[_0x5f10a9['uniqueid']];}}}catch(_0x5d92c5){utils[_0x20d5('0x19')](util[_0x20d5('0x13')](_0x20d5('0x23'),_0x5f10a9['uniqueid']),_0x5d92c5);}};exports['varset']=function(_0x331ec9){try{utils['debug'](util[_0x20d5('0x13')](_0x20d5('0x24'),_0x331ec9['uniqueid']),_0x331ec9);if(!_[_0x20d5('0x1b')](_0x331ec9['variable'][_0x20d5('0x25')])&&_0x331ec9['value'][_0x20d5('0x26')]()!==_0x20d5('0x27')){if(!_[_0x20d5('0x1b')](queues[_0x331ec9[_0x20d5('0x5')]])){queues[_0x331ec9[_0x20d5('0x5')]][_0x20d5('0x1c')]=![];queues[_0x331ec9[_0x20d5('0x5')]][_0x20d5('0x28')]=null;queues[_0x331ec9[_0x20d5('0x5')]][_0x20d5('0x29')]=!![];queues[_0x331ec9[_0x20d5('0x5')]]['queuecallerexitAt']=utils[_0x20d5('0x18')]();queues[_0x331ec9['uniqueid']][_0x20d5('0xa')]=_0x331ec9['value'][_0x20d5('0x26')]();utils['info'](util['format'](_0x20d5('0x2a'),_0x331ec9[_0x20d5('0x5')],queues[_0x331ec9[_0x20d5('0x5')]]['name'],_0x331ec9[_0x20d5('0x2b')],queues[_0x331ec9['uniqueid']][_0x20d5('0xa')]));writeDB(queues[_0x331ec9['uniqueid']]);}}else if(!_[_0x20d5('0x1b')](_0x331ec9[_0x20d5('0x2c')][_0x20d5('0x2d')])){if(!_[_0x20d5('0x1b')](queues[_0x331ec9[_0x20d5('0x5')]])&&!queues[_0x331ec9['uniqueid']][_0x20d5('0x1c')]){queues[_0x331ec9[_0x20d5('0x5')]]['queuecallerabandon']=![];queues[_0x331ec9[_0x20d5('0x5')]][_0x20d5('0x28')]=null;queues[_0x331ec9[_0x20d5('0x5')]][_0x20d5('0x29')]=!![];queues[_0x331ec9['uniqueid']][_0x20d5('0x2e')]=utils[_0x20d5('0x18')]();queues[_0x331ec9[_0x20d5('0x5')]]['queuecallerexitreason']=_0x20d5('0x2f');utils[_0x20d5('0x3')](util[_0x20d5('0x13')](_0x20d5('0x30'),_0x331ec9['uniqueid'],queues[_0x331ec9['uniqueid']][_0x20d5('0x21')],_0x331ec9[_0x20d5('0x2b')],queues[_0x331ec9[_0x20d5('0x5')]][_0x20d5('0xa')]));}}}catch(_0x1cc52e){utils[_0x20d5('0x19')](util[_0x20d5('0x13')](_0x20d5('0x24'),_0x331ec9[_0x20d5('0x5')]),_0x1cc52e);}};exports[_0x20d5('0x1c')]=function(_0x536ad5){try{if(!_[_0x20d5('0x1b')](queues[_0x536ad5[_0x20d5('0x5')]])){utils[_0x20d5('0x12')](util[_0x20d5('0x13')](_0x20d5('0x31'),_0x536ad5[_0x20d5('0x5')]),_0x536ad5);queues[_0x536ad5[_0x20d5('0x5')]][_0x20d5('0x29')]=![];queues[_0x536ad5[_0x20d5('0x5')]][_0x20d5('0x2e')]=null;queues[_0x536ad5[_0x20d5('0x5')]]['queuecallerabandon']=!![];queues[_0x536ad5['uniqueid']][_0x20d5('0x28')]=utils[_0x20d5('0x18')]();queues[_0x536ad5[_0x20d5('0x5')]][_0x20d5('0xa')]=_0x20d5('0x32');utils[_0x20d5('0x3')](util[_0x20d5('0x13')](_0x20d5('0x33'),_0x536ad5[_0x20d5('0x5')],queues[_0x536ad5[_0x20d5('0x5')]][_0x20d5('0x21')],queues[_0x536ad5[_0x20d5('0x5')]]['queuecallerexitreason']));}}catch(_0x1796a4){utils[_0x20d5('0x19')](util['format'](_0x20d5('0x31'),_0x536ad5['uniqueid']),_0x1796a4);}};exports['queuecallerleave']=function(_0x1f371d){try{if(!_[_0x20d5('0x1b')](queues[_0x1f371d[_0x20d5('0x5')]])){utils[_0x20d5('0x12')](util[_0x20d5('0x13')](_0x20d5('0x34'),_0x1f371d[_0x20d5('0x5')]),_0x1f371d);utils[_0x20d5('0x3')](util[_0x20d5('0x13')](_0x20d5('0x35'),_0x1f371d[_0x20d5('0x5')],queues[_0x1f371d[_0x20d5('0x5')]][_0x20d5('0x21')],_0x1f371d['connectedlinenum'],_0x1f371d[_0x20d5('0x36')]));queues[_0x1f371d[_0x20d5('0x5')]][_0x20d5('0x37')]=!![];queues[_0x1f371d[_0x20d5('0x5')]][_0x20d5('0x38')]=utils['now']();queues[_0x1f371d[_0x20d5('0x5')]][_0x20d5('0x39')]=utils[_0x20d5('0x3a')](queues[_0x1f371d[_0x20d5('0x5')]]['queuecallerleaveAt'],queues[_0x1f371d[_0x20d5('0x5')]]['queuecallerjoinAt']);queues[_0x1f371d[_0x20d5('0x5')]][_0x20d5('0x16')]=_0x1f371d[_0x20d5('0x16')];queues[_0x1f371d['uniqueid']]['count']=_0x1f371d[_0x20d5('0x3b')];queues[_0x1f371d[_0x20d5('0x5')]][_0x20d5('0x3c')]=_0x1f371d[_0x20d5('0x3c')];queues[_0x1f371d[_0x20d5('0x5')]][_0x20d5('0x36')]=_0x1f371d[_0x20d5('0x36')];}}catch(_0x586026){utils['error'](util[_0x20d5('0x13')](_0x20d5('0x34'),_0x1f371d[_0x20d5('0x5')]),_0x586026);}};exports[_0x20d5('0x3d')]=function(_0x4404e1){try{if(!_[_0x20d5('0x1b')](queues[_0x4404e1[_0x20d5('0x5')]])){utils['debug'](util['format']('[%s][queues][agentconnect]',_0x4404e1['uniqueid']),_0x4404e1);utils[_0x20d5('0x3')](util['format'](_0x20d5('0x3e'),_0x4404e1[_0x20d5('0x5')],queues[_0x4404e1[_0x20d5('0x5')]][_0x20d5('0x21')],_0x4404e1[_0x20d5('0x3f')],_0x4404e1[_0x20d5('0x40')]));queues[_0x4404e1['uniqueid']]['queuecallerabandon']=![];queues[_0x4404e1[_0x20d5('0x5')]][_0x20d5('0x1c')]=![];queues[_0x4404e1['uniqueid']]['queuecallerabandonAt']=null;queues[_0x4404e1['uniqueid']][_0x20d5('0x29')]=![];queues[_0x4404e1[_0x20d5('0x5')]][_0x20d5('0xa')]=null;queues[_0x4404e1[_0x20d5('0x5')]][_0x20d5('0x2e')]=null;queues[_0x4404e1[_0x20d5('0x5')]]['assigned']=!![];queues[_0x4404e1[_0x20d5('0x5')]][_0x20d5('0x9')]=_0x4404e1[_0x20d5('0x40')];queues[_0x4404e1['uniqueid']][_0x20d5('0x41')]=_0x4404e1[_0x20d5('0x3f')];}}catch(_0x3f91cd){utils[_0x20d5('0x19')](util['format'](_0x20d5('0x42'),_0x4404e1[_0x20d5('0x5')]),_0x3f91cd);}};exports[_0x20d5('0x43')]=function(_0x2e89c7){try{if(!_[_0x20d5('0x1b')](queues[_0x2e89c7[_0x20d5('0x5')]])){if(queues[_0x2e89c7[_0x20d5('0x5')]][_0x20d5('0x38')]){utils[_0x20d5('0x12')](util['format']('[%s][queues][agentcomplete]',_0x2e89c7[_0x20d5('0x5')]),_0x2e89c7);queues[_0x2e89c7[_0x20d5('0x5')]][_0x20d5('0x1c')]=![];queues[_0x2e89c7[_0x20d5('0x5')]][_0x20d5('0x1c')]=![];queues[_0x2e89c7[_0x20d5('0x5')]][_0x20d5('0x28')]=null;queues[_0x2e89c7[_0x20d5('0x5')]][_0x20d5('0x29')]=![];queues[_0x2e89c7[_0x20d5('0x5')]][_0x20d5('0x2e')]=null;queues[_0x2e89c7[_0x20d5('0x5')]]['assigned']=!![];queues[_0x2e89c7['uniqueid']][_0x20d5('0x41')]=_0x2e89c7[_0x20d5('0x3f')];queues[_0x2e89c7[_0x20d5('0x5')]][_0x20d5('0x1d')]=!![];queues[_0x2e89c7[_0x20d5('0x5')]]['queuecallercompleteAt']=utils[_0x20d5('0x18')]();if(_0x2e89c7[_0x20d5('0x44')]==_0x20d5('0x45')){if(!queues[_0x2e89c7[_0x20d5('0x5')]][_0x20d5('0x45')]){queues[_0x2e89c7[_0x20d5('0x5')]][_0x20d5('0xa')]=_0x20d5('0x46');}}else{queues[_0x2e89c7[_0x20d5('0x5')]][_0x20d5('0xa')]='COMPLETEDBY'+_0x2e89c7[_0x20d5('0x44')][_0x20d5('0x26')]();}utils[_0x20d5('0x3')](util['format'](_0x20d5('0x47'),_0x2e89c7[_0x20d5('0x5')],queues[_0x2e89c7['uniqueid']][_0x20d5('0x21')],_0x2e89c7['membername'],queues[_0x2e89c7[_0x20d5('0x5')]][_0x20d5('0xa')]));writeDB(queues[_0x2e89c7[_0x20d5('0x5')]]);}}}catch(_0x513276){utils[_0x20d5('0x19')](util['format'](_0x20d5('0x48'),_0x2e89c7[_0x20d5('0x5')]),_0x513276);}};exports[_0x20d5('0x49')]=function(_0x2bf8b5){try{if(!_[_0x20d5('0x1b')](queues[_0x2bf8b5[_0x20d5('0x4a')]])){utils[_0x20d5('0x12')](util[_0x20d5('0x13')](_0x20d5('0x4b'),_0x2bf8b5[_0x20d5('0x5')]),_0x2bf8b5);queues[_0x2bf8b5['transfereeuniqueid']][_0x20d5('0x45')]=!![];queues[_0x2bf8b5['transfereeuniqueid']]['transfertype']=_0x20d5('0x4c');queues[_0x2bf8b5['transfereeuniqueid']][_0x20d5('0x4d')]=_0x2bf8b5['extension'];queues[_0x2bf8b5[_0x20d5('0x4a')]][_0x20d5('0x4e')]=_0x2bf8b5[_0x20d5('0x4a')];queues[_0x2bf8b5[_0x20d5('0x4a')]][_0x20d5('0xa')]=_0x20d5('0x4f');utils[_0x20d5('0x3')](util[_0x20d5('0x13')](_0x20d5('0x50'),_0x2bf8b5[_0x20d5('0x5')],queues[_0x2bf8b5['transfereeuniqueid']][_0x20d5('0x21')],_0x2bf8b5[_0x20d5('0x4a')],_0x2bf8b5['extension']));}}catch(_0x5ec2cd){utils[_0x20d5('0x19')](util[_0x20d5('0x13')](_0x20d5('0x4b'),_0x2bf8b5['uniqueid']),_0x5ec2cd);}};exports[_0x20d5('0x51')]=function(_0x1833df){try{utils[_0x20d5('0x12')](util[_0x20d5('0x13')](_0x20d5('0x52'),_0x1833df[_0x20d5('0x53')]),_0x1833df);if(_0x1833df[_0x20d5('0x53')]==_0x1833df['origtransfererlinkedid']){if(!_[_0x20d5('0x1b')](queues[_0x1833df[_0x20d5('0x54')]])){utils[_0x20d5('0x3')](util[_0x20d5('0x13')](_0x20d5('0x55'),_0x1833df[_0x20d5('0x53')],queues[_0x1833df[_0x20d5('0x54')]][_0x20d5('0x21')],_0x1833df[_0x20d5('0x56')]));queues[_0x1833df['secondtransfererlinkedid']][_0x20d5('0x45')]=!![];queues[_0x1833df[_0x20d5('0x54')]]['transfertype']=_0x20d5('0x57');queues[_0x1833df['secondtransfererlinkedid']]['transferexten']=_0x1833df[_0x20d5('0x56')];queues[_0x1833df[_0x20d5('0x54')]][_0x20d5('0x4e')]=_0x1833df[_0x20d5('0x53')];queues[_0x1833df['secondtransfererlinkedid']][_0x20d5('0xa')]=_0x20d5('0x58');}if(!_['isNil'](queues[_0x1833df[_0x20d5('0x59')]])){if(_0x1833df['transfereelinkedid']&&queues[_0x1833df[_0x20d5('0x5a')]]){queues[_0x1833df['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x1833df[_0x20d5('0x4a')]]=_[_0x20d5('0x5b')](queues[_0x1833df[_0x20d5('0x5a')]]);queues[_0x1833df[_0x20d5('0x4a')]][_0x20d5('0x10')]=_0x1833df[_0x20d5('0x5c')];queues[_0x1833df['transfereeuniqueid']][_0x20d5('0x22')]=0x2;queues[_0x1833df[_0x20d5('0x4a')]][_0x20d5('0x8')]=queues[_0x1833df[_0x20d5('0x54')]][_0x20d5('0x8')];queues[_0x1833df[_0x20d5('0x4a')]][_0x20d5('0x5d')]=queues[_0x1833df[_0x20d5('0x54')]][_0x20d5('0x5d')];queues[_0x1833df[_0x20d5('0x4a')]][_0x20d5('0x5e')]=utils['now']();queues[_0x1833df[_0x20d5('0x4a')]][_0x20d5('0x38')]=utils[_0x20d5('0x18')]();queues[_0x1833df[_0x20d5('0x4a')]][_0x20d5('0x39')]=0x0;queues[_0x1833df[_0x20d5('0x4a')]]['mohtime']=0x0;utils[_0x20d5('0x3')](util[_0x20d5('0x13')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1833df['origtransfereruniqueid'],queues[_0x1833df['transfereeuniqueid']][_0x20d5('0x21')],queues[_0x1833df['transfereeuniqueid']]['calleridnum'],queues[_0x1833df[_0x20d5('0x4a')]][_0x20d5('0x5d')]));}else{utils[_0x20d5('0x3')](util[_0x20d5('0x13')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1833df[_0x20d5('0x53')],queues[_0x1833df[_0x20d5('0x59')]][_0x20d5('0x21')],_0x1833df[_0x20d5('0x54')]));queues[_0x1833df[_0x20d5('0x59')]][_0x20d5('0x10')]=_0x1833df[_0x20d5('0x54')];}}}else if(_0x1833df['secondtransfereruniqueid']==_0x1833df[_0x20d5('0x54')]){if(!_[_0x20d5('0x1b')](queues[_0x1833df['origtransfererlinkedid']])){utils[_0x20d5('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1833df[_0x20d5('0x53')],queues[_0x1833df[_0x20d5('0x59')]][_0x20d5('0x21')],_0x1833df[_0x20d5('0x5f')],_0x1833df[_0x20d5('0x60')]));queues[_0x1833df[_0x20d5('0x59')]]['transfer']=!![];queues[_0x1833df[_0x20d5('0x59')]][_0x20d5('0x61')]=_0x20d5('0x57');queues[_0x1833df['origtransfererlinkedid']][_0x20d5('0x4d')]=_0x1833df[_0x20d5('0x60')];queues[_0x1833df[_0x20d5('0x59')]][_0x20d5('0x4e')]=_0x1833df[_0x20d5('0x5f')];queues[_0x1833df['origtransfererlinkedid']][_0x20d5('0xa')]=_0x20d5('0x58');}if(!_[_0x20d5('0x1b')](queues[_0x1833df[_0x20d5('0x54')]])){if(_0x1833df['transfertargetlinkedid']&&queues[_0x1833df['transfertargetlinkedid']]){queues[_0x1833df[_0x20d5('0x62')]]['queuecallerenterreason']=0x1;queues[_0x1833df[_0x20d5('0x5c')]]=_[_0x20d5('0x5b')](queues[_0x1833df[_0x20d5('0x62')]]);queues[_0x1833df[_0x20d5('0x5c')]][_0x20d5('0x10')]=_0x1833df[_0x20d5('0x5c')];queues[_0x1833df[_0x20d5('0x5c')]][_0x20d5('0x22')]=0x2;queues[_0x1833df[_0x20d5('0x5c')]][_0x20d5('0x8')]=queues[_0x1833df[_0x20d5('0x59')]]['calleridnum'];queues[_0x1833df[_0x20d5('0x5c')]][_0x20d5('0x5d')]=queues[_0x1833df[_0x20d5('0x59')]][_0x20d5('0x5d')];queues[_0x1833df['transfertargetuniqueid']][_0x20d5('0x5e')]=utils[_0x20d5('0x18')]();queues[_0x1833df[_0x20d5('0x5c')]]['queuecallerleaveAt']=utils[_0x20d5('0x18')]();queues[_0x1833df[_0x20d5('0x5c')]][_0x20d5('0x39')]=0x0;queues[_0x1833df[_0x20d5('0x5c')]]['mohtime']=0x0;utils[_0x20d5('0x3')](util[_0x20d5('0x13')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x1833df[_0x20d5('0x53')],queues[_0x1833df[_0x20d5('0x5c')]][_0x20d5('0x21')],queues[_0x1833df[_0x20d5('0x5c')]]['transfereduniqueid'],queues[_0x1833df['transfertargetuniqueid']][_0x20d5('0x8')],queues[_0x1833df[_0x20d5('0x5c')]][_0x20d5('0x5d')]));}else{utils[_0x20d5('0x3')](util['format'](_0x20d5('0x63'),_0x1833df[_0x20d5('0x53')],queues[_0x1833df[_0x20d5('0x54')]]['name'],_0x1833df[_0x20d5('0x59')]));queues[_0x1833df[_0x20d5('0x54')]][_0x20d5('0x10')]=_0x1833df[_0x20d5('0x59')];}}}}catch(_0x5f34af){utils[_0x20d5('0x19')](util[_0x20d5('0x13')](_0x20d5('0x52'),_0x1833df['origtransfereruniqueid']),_0x5f34af);}};exports[_0x20d5('0x64')]=function(_0xc30db){try{if(!_[_0x20d5('0x1b')](queues[_0xc30db[_0x20d5('0x5')]])){utils[_0x20d5('0x12')](util[_0x20d5('0x13')]('[%s][queues][musiconholdstart]',_0xc30db[_0x20d5('0x5')]),_0xc30db);queues[_0xc30db[_0x20d5('0x5')]][_0x20d5('0x65')]=utils[_0x20d5('0x18')]();utils[_0x20d5('0x3')](util[_0x20d5('0x13')](_0x20d5('0x66'),_0xc30db['uniqueid'],queues[_0xc30db[_0x20d5('0x5')]][_0x20d5('0x21')],queues[_0xc30db['uniqueid']][_0x20d5('0x65')]));}}catch(_0x18c7c6){utils[_0x20d5('0x19')](util['format']('[%s][queues][musiconholdstart]',_0xc30db[_0x20d5('0x5')]),_0x18c7c6);}};exports[_0x20d5('0x67')]=function(_0x52c0a4){try{if(!_[_0x20d5('0x1b')](queues[_0x52c0a4[_0x20d5('0x5')]])){if(!_[_0x20d5('0x1b')](queues[_0x52c0a4[_0x20d5('0x5')]][_0x20d5('0x65')])){utils[_0x20d5('0x12')](util[_0x20d5('0x13')]('[%s][queues][musiconholdstop]',_0x52c0a4['uniqueid']),_0x52c0a4);queues[_0x52c0a4['uniqueid']][_0x20d5('0x68')]+=utils[_0x20d5('0x3a')](utils['now'](),queues[_0x52c0a4[_0x20d5('0x5')]][_0x20d5('0x65')]);utils[_0x20d5('0x3')](util['format'](_0x20d5('0x69'),_0x52c0a4[_0x20d5('0x5')],queues[_0x52c0a4[_0x20d5('0x5')]][_0x20d5('0x21')],queues[_0x52c0a4[_0x20d5('0x5')]][_0x20d5('0x68')]));delete queues[_0x52c0a4[_0x20d5('0x5')]][_0x20d5('0x65')];}}}catch(_0x40b7be){utils[_0x20d5('0x19')](util[_0x20d5('0x13')](_0x20d5('0x6a'),_0x52c0a4['uniqueid']),_0x40b7be);}}; \ No newline at end of file +var _0x90df=['[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','debug','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexit','queuecallerexitAt','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerabandonAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','error','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridnum','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','info','format','uniqueid','channel','lastAssignedTo','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x90df,0xc4));var _0xf90d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90df[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf90d('0x0'));var util=require('util');var utils=require(_0xf90d('0x1'));var queues={};function writeDB(_0x5f4e85){utils[_0xf90d('0x2')](util[_0xf90d('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x5f4e85[_0xf90d('0x4')],_0x5f4e85[_0xf90d('0x5')],_0x5f4e85['queue'],_0x5f4e85[_0xf90d('0x6')],_0x5f4e85['calleridnum'],_0x5f4e85[_0xf90d('0x7')],_0x5f4e85[_0xf90d('0x8')]));if(_0x5f4e85[_0xf90d('0x9')]){utils[_0xf90d('0xa')](_0x5f4e85[_0xf90d('0x9')])['then'](function(_0x35642a){if(_0x35642a){_0x5f4e85[_0xf90d('0xb')]=_0x35642a['type'];}utils[_0xf90d('0xc')](_0xf90d('0xd'),_0x5f4e85);});}else{utils[_0xf90d('0xc')]('CreateVoiceQueueReport',_0x5f4e85);}if(_0x5f4e85[_0xf90d('0xe')]){delete queues[_0x5f4e85[_0xf90d('0xe')]];}else{delete queues[_0x5f4e85[_0xf90d('0x4')]];}}exports[_0xf90d('0xf')]=function(_0x101cec){try{utils['debug'](util[_0xf90d('0x3')](_0xf90d('0x10'),_0x101cec[_0xf90d('0x4')]),_0x101cec);utils[_0xf90d('0x2')](util[_0xf90d('0x3')](_0xf90d('0x11'),_0x101cec[_0xf90d('0x4')],_0x101cec[_0xf90d('0x9')],_0x101cec['position']));queues[_0x101cec[_0xf90d('0x4')]]=_[_0xf90d('0x12')](_0x101cec,{'originalposition':_0x101cec[_0xf90d('0x13')],'queuecallerjoinAt':utils[_0xf90d('0x14')](),'mohtime':0x0});}catch(_0x248bc3){utils['error'](util['format']('[%s][queues][queuecallerjoin]',_0x101cec[_0xf90d('0x4')]),_0x248bc3);}};exports[_0xf90d('0x15')]=function(_0xe8a87a){try{if(!_[_0xf90d('0x16')](queues[_0xe8a87a[_0xf90d('0x4')]])){utils['debug'](util[_0xf90d('0x3')](_0xf90d('0x17'),_0xe8a87a[_0xf90d('0x4')]),_0xe8a87a);if(queues[_0xe8a87a[_0xf90d('0x4')]][_0xf90d('0x18')]){if(!queues[_0xe8a87a[_0xf90d('0x4')]][_0xf90d('0x19')]&&!queues[_0xe8a87a[_0xf90d('0x4')]]['queuecallerexit']){queues[_0xe8a87a[_0xf90d('0x4')]][_0xf90d('0x1a')]=!![];queues[_0xe8a87a[_0xf90d('0x4')]][_0xf90d('0x1b')]=utils['now']();queues[_0xe8a87a[_0xf90d('0x4')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils['info'](util[_0xf90d('0x3')](_0xf90d('0x1c'),_0xe8a87a[_0xf90d('0x4')],queues[_0xe8a87a[_0xf90d('0x4')]][_0xf90d('0x1d')],queues[_0xe8a87a[_0xf90d('0x4')]][_0xf90d('0x8')]));writeDB(queues[_0xe8a87a[_0xf90d('0x4')]]);}else if(queues[_0xe8a87a[_0xf90d('0x4')]][_0xf90d('0xe')]){utils[_0xf90d('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0xe8a87a[_0xf90d('0x4')],queues[_0xe8a87a[_0xf90d('0x4')]][_0xf90d('0x1d')],queues[_0xe8a87a['uniqueid']][_0xf90d('0xe')]));queues[queues[_0xe8a87a['uniqueid']][_0xf90d('0xe')]]=queues[_0xe8a87a[_0xf90d('0x4')]];queues[queues[_0xe8a87a[_0xf90d('0x4')]][_0xf90d('0xe')]][_0xf90d('0x1e')]=0x2;delete queues[_0xe8a87a[_0xf90d('0x4')]];}}}catch(_0x2a2ccf){utils['error'](util[_0xf90d('0x3')]('[%s][queues][hangup]',_0xe8a87a[_0xf90d('0x4')]),_0x2a2ccf);}};exports[_0xf90d('0x1f')]=function(_0x4a5c50){try{utils[_0xf90d('0x20')](util[_0xf90d('0x3')]('[%s][queues][varset]',_0x4a5c50[_0xf90d('0x4')]),_0x4a5c50);if(!_[_0xf90d('0x16')](_0x4a5c50[_0xf90d('0x21')][_0xf90d('0x22')])&&_0x4a5c50[_0xf90d('0x23')][_0xf90d('0x24')]()!==_0xf90d('0x25')){if(!_[_0xf90d('0x16')](queues[_0x4a5c50['uniqueid']])){queues[_0x4a5c50['uniqueid']]['queuecallerabandon']=![];queues[_0x4a5c50[_0xf90d('0x4')]]['queuecallerabandonAt']=null;queues[_0x4a5c50[_0xf90d('0x4')]][_0xf90d('0x26')]=!![];queues[_0x4a5c50[_0xf90d('0x4')]][_0xf90d('0x27')]=utils[_0xf90d('0x14')]();queues[_0x4a5c50[_0xf90d('0x4')]]['queuecallerexitreason']=_0x4a5c50['value']['toUpperCase']();utils[_0xf90d('0x2')](util[_0xf90d('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4a5c50[_0xf90d('0x4')],queues[_0x4a5c50[_0xf90d('0x4')]][_0xf90d('0x1d')],_0x4a5c50[_0xf90d('0x23')],queues[_0x4a5c50[_0xf90d('0x4')]][_0xf90d('0x8')]));writeDB(queues[_0x4a5c50[_0xf90d('0x4')]]);}}else if(!_[_0xf90d('0x16')](_0x4a5c50[_0xf90d('0x21')][_0xf90d('0x28')])){if(!_[_0xf90d('0x16')](queues[_0x4a5c50[_0xf90d('0x4')]])&&!queues[_0x4a5c50['uniqueid']][_0xf90d('0x19')]){queues[_0x4a5c50[_0xf90d('0x4')]][_0xf90d('0x19')]=![];queues[_0x4a5c50['uniqueid']]['queuecallerabandonAt']=null;queues[_0x4a5c50[_0xf90d('0x4')]][_0xf90d('0x26')]=!![];queues[_0x4a5c50[_0xf90d('0x4')]]['queuecallerexitAt']=utils[_0xf90d('0x14')]();queues[_0x4a5c50[_0xf90d('0x4')]][_0xf90d('0x8')]=_0xf90d('0x29');utils[_0xf90d('0x2')](util['format'](_0xf90d('0x2a'),_0x4a5c50['uniqueid'],queues[_0x4a5c50['uniqueid']]['name'],_0x4a5c50[_0xf90d('0x23')],queues[_0x4a5c50[_0xf90d('0x4')]]['queuecallerexitreason']));}}}catch(_0x17a578){utils['error'](util[_0xf90d('0x3')](_0xf90d('0x2b'),_0x4a5c50[_0xf90d('0x4')]),_0x17a578);}};exports[_0xf90d('0x19')]=function(_0xd52610){try{if(!_[_0xf90d('0x16')](queues[_0xd52610[_0xf90d('0x4')]])){utils[_0xf90d('0x20')](util[_0xf90d('0x3')](_0xf90d('0x2c'),_0xd52610[_0xf90d('0x4')]),_0xd52610);queues[_0xd52610[_0xf90d('0x4')]][_0xf90d('0x26')]=![];queues[_0xd52610[_0xf90d('0x4')]][_0xf90d('0x27')]=null;queues[_0xd52610['uniqueid']][_0xf90d('0x19')]=!![];queues[_0xd52610[_0xf90d('0x4')]][_0xf90d('0x2d')]=utils[_0xf90d('0x14')]();queues[_0xd52610[_0xf90d('0x4')]]['queuecallerexitreason']=_0xf90d('0x2e');utils[_0xf90d('0x2')](util['format'](_0xf90d('0x2f'),_0xd52610['uniqueid'],queues[_0xd52610[_0xf90d('0x4')]][_0xf90d('0x1d')],queues[_0xd52610[_0xf90d('0x4')]][_0xf90d('0x8')]));}}catch(_0x3cb337){utils[_0xf90d('0x30')](util[_0xf90d('0x3')](_0xf90d('0x2c'),_0xd52610[_0xf90d('0x4')]),_0x3cb337);}};exports[_0xf90d('0x31')]=function(_0x41ae0e){try{if(!_[_0xf90d('0x16')](queues[_0x41ae0e[_0xf90d('0x4')]])){utils[_0xf90d('0x20')](util[_0xf90d('0x3')](_0xf90d('0x32'),_0x41ae0e['uniqueid']),_0x41ae0e);utils[_0xf90d('0x2')](util[_0xf90d('0x3')](_0xf90d('0x33'),_0x41ae0e[_0xf90d('0x4')],queues[_0x41ae0e[_0xf90d('0x4')]][_0xf90d('0x1d')],_0x41ae0e[_0xf90d('0x34')],_0x41ae0e[_0xf90d('0x35')]));queues[_0x41ae0e[_0xf90d('0x4')]][_0xf90d('0x31')]=!![];queues[_0x41ae0e['uniqueid']]['queuecallerleaveAt']=utils[_0xf90d('0x14')]();queues[_0x41ae0e[_0xf90d('0x4')]]['holdtime']=utils[_0xf90d('0x36')](queues[_0x41ae0e[_0xf90d('0x4')]][_0xf90d('0x18')],queues[_0x41ae0e['uniqueid']][_0xf90d('0x37')]);queues[_0x41ae0e[_0xf90d('0x4')]][_0xf90d('0x13')]=_0x41ae0e[_0xf90d('0x13')];queues[_0x41ae0e[_0xf90d('0x4')]][_0xf90d('0x38')]=_0x41ae0e['count'];queues[_0x41ae0e['uniqueid']][_0xf90d('0x34')]=_0x41ae0e[_0xf90d('0x34')];queues[_0x41ae0e[_0xf90d('0x4')]][_0xf90d('0x35')]=_0x41ae0e['connectedlinename'];}}catch(_0x316cb0){utils[_0xf90d('0x30')](util[_0xf90d('0x3')](_0xf90d('0x32'),_0x41ae0e[_0xf90d('0x4')]),_0x316cb0);}};exports[_0xf90d('0x39')]=function(_0x5a1c21){try{if(!_[_0xf90d('0x16')](queues[_0x5a1c21[_0xf90d('0x4')]])){utils[_0xf90d('0x20')](util[_0xf90d('0x3')](_0xf90d('0x3a'),_0x5a1c21['uniqueid']),_0x5a1c21);utils['info'](util[_0xf90d('0x3')](_0xf90d('0x3b'),_0x5a1c21[_0xf90d('0x4')],queues[_0x5a1c21[_0xf90d('0x4')]][_0xf90d('0x1d')],_0x5a1c21[_0xf90d('0x3c')],_0x5a1c21[_0xf90d('0x3d')]));queues[_0x5a1c21[_0xf90d('0x4')]][_0xf90d('0x19')]=![];queues[_0x5a1c21[_0xf90d('0x4')]]['queuecallerabandon']=![];queues[_0x5a1c21[_0xf90d('0x4')]][_0xf90d('0x2d')]=null;queues[_0x5a1c21[_0xf90d('0x4')]]['queuecallerexit']=![];queues[_0x5a1c21[_0xf90d('0x4')]]['queuecallerexitreason']=null;queues[_0x5a1c21['uniqueid']][_0xf90d('0x27')]=null;queues[_0x5a1c21['uniqueid']][_0xf90d('0x3e')]=!![];queues[_0x5a1c21[_0xf90d('0x4')]]['accountcode']=_0x5a1c21[_0xf90d('0x3d')];queues[_0x5a1c21['uniqueid']]['lastAssignedTo']=_0x5a1c21[_0xf90d('0x3c')];}}catch(_0x3d6787){utils[_0xf90d('0x30')](util[_0xf90d('0x3')]('[%s][queues][agentconnect]',_0x5a1c21[_0xf90d('0x4')]),_0x3d6787);}};exports[_0xf90d('0x3f')]=function(_0x226546){try{if(!_[_0xf90d('0x16')](queues[_0x226546[_0xf90d('0x4')]])){if(queues[_0x226546[_0xf90d('0x4')]][_0xf90d('0x18')]){utils[_0xf90d('0x20')](util['format']('[%s][queues][agentcomplete]',_0x226546['uniqueid']),_0x226546);queues[_0x226546[_0xf90d('0x4')]][_0xf90d('0x19')]=![];queues[_0x226546[_0xf90d('0x4')]][_0xf90d('0x19')]=![];queues[_0x226546['uniqueid']][_0xf90d('0x2d')]=null;queues[_0x226546[_0xf90d('0x4')]]['queuecallerexit']=![];queues[_0x226546[_0xf90d('0x4')]][_0xf90d('0x27')]=null;queues[_0x226546[_0xf90d('0x4')]][_0xf90d('0x3e')]=!![];queues[_0x226546[_0xf90d('0x4')]][_0xf90d('0x6')]=_0x226546['membername'];queues[_0x226546[_0xf90d('0x4')]][_0xf90d('0x1a')]=!![];queues[_0x226546[_0xf90d('0x4')]]['queuecallercompleteAt']=utils['now']();if(_0x226546['reason']==_0xf90d('0x40')){if(!queues[_0x226546[_0xf90d('0x4')]][_0xf90d('0x40')]){queues[_0x226546['uniqueid']][_0xf90d('0x8')]=_0xf90d('0x41');}}else{queues[_0x226546[_0xf90d('0x4')]][_0xf90d('0x8')]=_0xf90d('0x42')+_0x226546[_0xf90d('0x43')][_0xf90d('0x24')]();}utils['info'](util[_0xf90d('0x3')](_0xf90d('0x44'),_0x226546[_0xf90d('0x4')],queues[_0x226546['uniqueid']][_0xf90d('0x1d')],_0x226546[_0xf90d('0x3c')],queues[_0x226546[_0xf90d('0x4')]][_0xf90d('0x8')]));writeDB(queues[_0x226546[_0xf90d('0x4')]]);}}}catch(_0x2f9cb8){utils[_0xf90d('0x30')](util['format']('[%s][queues][agentcomplete]',_0x226546[_0xf90d('0x4')]),_0x2f9cb8);}};exports[_0xf90d('0x45')]=function(_0x1f5649){try{if(!_[_0xf90d('0x16')](queues[_0x1f5649[_0xf90d('0x46')]])){utils[_0xf90d('0x20')](util['format'](_0xf90d('0x47'),_0x1f5649['uniqueid']),_0x1f5649);queues[_0x1f5649[_0xf90d('0x46')]][_0xf90d('0x40')]=!![];queues[_0x1f5649['transfereeuniqueid']][_0xf90d('0x48')]='BLIND';queues[_0x1f5649[_0xf90d('0x46')]][_0xf90d('0x49')]=_0x1f5649[_0xf90d('0x4a')];queues[_0x1f5649[_0xf90d('0x46')]]['transferuniqueid']=_0x1f5649[_0xf90d('0x46')];queues[_0x1f5649[_0xf90d('0x46')]][_0xf90d('0x8')]=_0xf90d('0x4b');utils[_0xf90d('0x2')](util['format'](_0xf90d('0x4c'),_0x1f5649['uniqueid'],queues[_0x1f5649['transfereeuniqueid']][_0xf90d('0x1d')],_0x1f5649[_0xf90d('0x46')],_0x1f5649[_0xf90d('0x4a')]));}}catch(_0x2fb53a){utils[_0xf90d('0x30')](util['format']('[%s][queues][blindtransfer]',_0x1f5649[_0xf90d('0x4')]),_0x2fb53a);}};exports[_0xf90d('0x4d')]=function(_0x23bec6){try{utils[_0xf90d('0x20')](util[_0xf90d('0x3')](_0xf90d('0x4e'),_0x23bec6['origtransfereruniqueid']),_0x23bec6);if(_0x23bec6[_0xf90d('0x4f')]==_0x23bec6[_0xf90d('0x50')]){if(!_[_0xf90d('0x16')](queues[_0x23bec6['secondtransfererlinkedid']])){utils[_0xf90d('0x2')](util['format'](_0xf90d('0x51'),_0x23bec6[_0xf90d('0x4f')],queues[_0x23bec6['secondtransfererlinkedid']][_0xf90d('0x1d')],_0x23bec6[_0xf90d('0x52')]));queues[_0x23bec6[_0xf90d('0x53')]][_0xf90d('0x40')]=!![];queues[_0x23bec6[_0xf90d('0x53')]][_0xf90d('0x48')]=_0xf90d('0x54');queues[_0x23bec6['secondtransfererlinkedid']]['transferexten']=_0x23bec6[_0xf90d('0x52')];queues[_0x23bec6['secondtransfererlinkedid']][_0xf90d('0x55')]=_0x23bec6[_0xf90d('0x4f')];queues[_0x23bec6[_0xf90d('0x53')]][_0xf90d('0x8')]=_0xf90d('0x56');}if(!_['isNil'](queues[_0x23bec6[_0xf90d('0x50')]])){if(_0x23bec6[_0xf90d('0x57')]&&queues[_0x23bec6[_0xf90d('0x57')]]){queues[_0x23bec6['transfereelinkedid']][_0xf90d('0x1e')]=0x1;queues[_0x23bec6['transfereeuniqueid']]=_[_0xf90d('0x58')](queues[_0x23bec6[_0xf90d('0x57')]]);queues[_0x23bec6[_0xf90d('0x46')]][_0xf90d('0xe')]=_0x23bec6[_0xf90d('0x59')];queues[_0x23bec6['transfereeuniqueid']][_0xf90d('0x1e')]=0x2;queues[_0x23bec6[_0xf90d('0x46')]]['calleridnum']=queues[_0x23bec6[_0xf90d('0x53')]]['calleridnum'];queues[_0x23bec6[_0xf90d('0x46')]][_0xf90d('0x5a')]=queues[_0x23bec6[_0xf90d('0x53')]][_0xf90d('0x5a')];queues[_0x23bec6[_0xf90d('0x46')]][_0xf90d('0x37')]=utils[_0xf90d('0x14')]();queues[_0x23bec6[_0xf90d('0x46')]]['queuecallerleaveAt']=utils['now']();queues[_0x23bec6[_0xf90d('0x46')]][_0xf90d('0x5b')]=0x0;queues[_0x23bec6['transfereeuniqueid']][_0xf90d('0x5c')]=0x0;utils[_0xf90d('0x2')](util[_0xf90d('0x3')](_0xf90d('0x5d'),_0x23bec6[_0xf90d('0x4f')],queues[_0x23bec6[_0xf90d('0x46')]][_0xf90d('0x1d')],queues[_0x23bec6[_0xf90d('0x46')]][_0xf90d('0x5e')],queues[_0x23bec6[_0xf90d('0x46')]]['calleridname']));}else{utils[_0xf90d('0x2')](util[_0xf90d('0x3')](_0xf90d('0x5f'),_0x23bec6['origtransfereruniqueid'],queues[_0x23bec6[_0xf90d('0x50')]][_0xf90d('0x1d')],_0x23bec6[_0xf90d('0x53')]));queues[_0x23bec6['origtransfererlinkedid']][_0xf90d('0xe')]=_0x23bec6[_0xf90d('0x53')];}}}else if(_0x23bec6[_0xf90d('0x60')]==_0x23bec6[_0xf90d('0x53')]){if(!_[_0xf90d('0x16')](queues[_0x23bec6[_0xf90d('0x50')]])){utils[_0xf90d('0x2')](util['format'](_0xf90d('0x61'),_0x23bec6['origtransfereruniqueid'],queues[_0x23bec6[_0xf90d('0x50')]][_0xf90d('0x1d')],_0x23bec6[_0xf90d('0x60')],_0x23bec6[_0xf90d('0x62')]));queues[_0x23bec6['origtransfererlinkedid']][_0xf90d('0x40')]=!![];queues[_0x23bec6[_0xf90d('0x50')]]['transfertype']=_0xf90d('0x54');queues[_0x23bec6[_0xf90d('0x50')]][_0xf90d('0x49')]=_0x23bec6[_0xf90d('0x62')];queues[_0x23bec6['origtransfererlinkedid']][_0xf90d('0x55')]=_0x23bec6['secondtransfereruniqueid'];queues[_0x23bec6[_0xf90d('0x50')]][_0xf90d('0x8')]=_0xf90d('0x56');}if(!_[_0xf90d('0x16')](queues[_0x23bec6[_0xf90d('0x53')]])){if(_0x23bec6[_0xf90d('0x63')]&&queues[_0x23bec6[_0xf90d('0x63')]]){queues[_0x23bec6[_0xf90d('0x63')]][_0xf90d('0x1e')]=0x1;queues[_0x23bec6[_0xf90d('0x59')]]=_[_0xf90d('0x58')](queues[_0x23bec6[_0xf90d('0x63')]]);queues[_0x23bec6[_0xf90d('0x59')]]['transfereduniqueid']=_0x23bec6['transfertargetuniqueid'];queues[_0x23bec6[_0xf90d('0x59')]][_0xf90d('0x1e')]=0x2;queues[_0x23bec6[_0xf90d('0x59')]][_0xf90d('0x5e')]=queues[_0x23bec6[_0xf90d('0x50')]][_0xf90d('0x5e')];queues[_0x23bec6[_0xf90d('0x59')]]['calleridname']=queues[_0x23bec6[_0xf90d('0x50')]][_0xf90d('0x5a')];queues[_0x23bec6['transfertargetuniqueid']][_0xf90d('0x37')]=utils[_0xf90d('0x14')]();queues[_0x23bec6[_0xf90d('0x59')]]['queuecallerleaveAt']=utils['now']();queues[_0x23bec6[_0xf90d('0x59')]]['holdtime']=0x0;queues[_0x23bec6[_0xf90d('0x59')]][_0xf90d('0x5c')]=0x0;utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x23bec6['origtransfereruniqueid'],queues[_0x23bec6[_0xf90d('0x59')]]['name'],queues[_0x23bec6[_0xf90d('0x59')]][_0xf90d('0xe')],queues[_0x23bec6[_0xf90d('0x59')]][_0xf90d('0x5e')],queues[_0x23bec6[_0xf90d('0x59')]][_0xf90d('0x5a')]));}else{utils['info'](util[_0xf90d('0x3')](_0xf90d('0x5f'),_0x23bec6[_0xf90d('0x4f')],queues[_0x23bec6[_0xf90d('0x53')]]['name'],_0x23bec6[_0xf90d('0x50')]));queues[_0x23bec6[_0xf90d('0x53')]][_0xf90d('0xe')]=_0x23bec6[_0xf90d('0x50')];}}}}catch(_0x146edb){utils[_0xf90d('0x30')](util[_0xf90d('0x3')]('[%s][queues][attendedtransfer]',_0x23bec6[_0xf90d('0x4f')]),_0x146edb);}};exports[_0xf90d('0x64')]=function(_0x4000a7){try{if(!_[_0xf90d('0x16')](queues[_0x4000a7[_0xf90d('0x4')]])){utils[_0xf90d('0x20')](util[_0xf90d('0x3')]('[%s][queues][musiconholdstart]',_0x4000a7[_0xf90d('0x4')]),_0x4000a7);queues[_0x4000a7['uniqueid']][_0xf90d('0x65')]=utils[_0xf90d('0x14')]();utils[_0xf90d('0x2')](util[_0xf90d('0x3')](_0xf90d('0x66'),_0x4000a7[_0xf90d('0x4')],queues[_0x4000a7[_0xf90d('0x4')]][_0xf90d('0x1d')],queues[_0x4000a7[_0xf90d('0x4')]]['musiconholdstartAt']));}}catch(_0x3c2238){utils[_0xf90d('0x30')](util[_0xf90d('0x3')](_0xf90d('0x67'),_0x4000a7[_0xf90d('0x4')]),_0x3c2238);}};exports['musiconholdstop']=function(_0x455a0c){try{if(!_[_0xf90d('0x16')](queues[_0x455a0c[_0xf90d('0x4')]])){if(!_[_0xf90d('0x16')](queues[_0x455a0c[_0xf90d('0x4')]][_0xf90d('0x65')])){utils[_0xf90d('0x20')](util[_0xf90d('0x3')]('[%s][queues][musiconholdstop]',_0x455a0c[_0xf90d('0x4')]),_0x455a0c);queues[_0x455a0c[_0xf90d('0x4')]][_0xf90d('0x5c')]+=utils['diffTime'](utils[_0xf90d('0x14')](),queues[_0x455a0c['uniqueid']][_0xf90d('0x65')]);utils[_0xf90d('0x2')](util[_0xf90d('0x3')](_0xf90d('0x68'),_0x455a0c[_0xf90d('0x4')],queues[_0x455a0c[_0xf90d('0x4')]][_0xf90d('0x1d')],queues[_0x455a0c['uniqueid']]['mohtime']));delete queues[_0x455a0c[_0xf90d('0x4')]][_0xf90d('0x65')];}}}catch(_0x185c40){utils[_0xf90d('0x30')](util[_0xf90d('0x3')](_0xf90d('0x69'),_0x455a0c[_0xf90d('0x4')]),_0x185c40);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 895e454..a3b03fe 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 _0x9e1a=['split','substring','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','then','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','accountcode','context','channel','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr'];(function(_0x1e4133,_0x1ad0f4){var _0x4b3b9a=function(_0x3ef530){while(--_0x3ef530){_0x1e4133['push'](_0x1e4133['shift']());}};_0x4b3b9a(++_0x1ad0f4);}(_0x9e1a,0x1ef));var _0xa9e1=function(_0x57d6e4,_0x4e6f53){_0x57d6e4=_0x57d6e4-0x0;var _0x2426f1=_0x9e1a[_0x57d6e4];return _0x2426f1;};'use strict';var _=require('lodash');var util=require(_0xa9e1('0x0'));var utils=require(_0xa9e1('0x1'));var recordings={};function writeDB(_0xf68d4){utils[_0xa9e1('0x2')](util[_0xa9e1('0x3')](_0xa9e1('0x4'),_0xf68d4[_0xa9e1('0x5')]));if(_0xf68d4['accountcode']){utils[_0xa9e1('0x6')](_0xf68d4['accountcode'])[_0xa9e1('0x7')](function(_0xe731c9){if(_0xe731c9){_0xf68d4['membername']=_0xe731c9['name'];_0xf68d4[_0xa9e1('0x8')]=_0xe731c9['id'];}utils['request'](_0xa9e1('0x9'),_0xf68d4);});}else{utils[_0xa9e1('0xa')](_0xa9e1('0x9'),_0xf68d4);}}exports[_0xa9e1('0xb')]=function(_0x592b6c){try{utils[_0xa9e1('0xc')](util[_0xa9e1('0x3')](_0xa9e1('0xd'),_0x592b6c[_0xa9e1('0x5')]),_0x592b6c);if(_0x592b6c[_0xa9e1('0x5')]==_0x592b6c[_0xa9e1('0xe')]){utils['info'](util[_0xa9e1('0x3')](_0xa9e1('0xf'),_0x592b6c[_0xa9e1('0x5')],_0x592b6c['context'],_0x592b6c[_0xa9e1('0x10')]));recordings[_0x592b6c[_0xa9e1('0x5')]]={'uniqueid':_0x592b6c[_0xa9e1('0x5')],'accountcode':_0x592b6c[_0xa9e1('0x11')],'exten':_0x592b6c[_0xa9e1('0x10')],'context':_0x592b6c[_0xa9e1('0x12')],'channel':_0x592b6c[_0xa9e1('0x13')],'monitors':[]};}}catch(_0x3a54ec){utils[_0xa9e1('0x14')](util[_0xa9e1('0x3')](_0xa9e1('0xd'),_0x592b6c[_0xa9e1('0x5')]),_0x3a54ec);}};exports['newstate']=function(_0x325d6c){try{utils[_0xa9e1('0xc')](util[_0xa9e1('0x3')](_0xa9e1('0x15'),_0x325d6c[_0xa9e1('0x5')]),_0x325d6c);if(!_[_0xa9e1('0x16')](recordings[_0x325d6c['uniqueid']])&&_0x325d6c[_0xa9e1('0x17')]==0x6){utils[_0xa9e1('0x2')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x325d6c[_0xa9e1('0x5')],_0x325d6c[_0xa9e1('0x12')],_0x325d6c[_0xa9e1('0x13')]));}else if(!_[_0xa9e1('0x16')](recordings[_0x325d6c[_0xa9e1('0xe')]])&&_0x325d6c['channelstate']==0x6&&_0x325d6c[_0xa9e1('0x12')]!='transfer'){utils['info'](util[_0xa9e1('0x3')](_0xa9e1('0x18'),_0x325d6c[_0xa9e1('0x5')],_0x325d6c[_0xa9e1('0xe')],_0x325d6c[_0xa9e1('0x12')],_0x325d6c['channel']));recordings[_0x325d6c[_0xa9e1('0xe')]][_0xa9e1('0x11')]=_0x325d6c[_0xa9e1('0x11')];}}catch(_0x5dd58a){utils[_0xa9e1('0x14')](util[_0xa9e1('0x3')](_0xa9e1('0x15'),_0x325d6c[_0xa9e1('0x5')]),_0x5dd58a);}};exports[_0xa9e1('0x19')]=function(_0x5931b0){try{if(!_[_0xa9e1('0x16')](_0x5931b0[_0xa9e1('0x1a')])&&!_[_0xa9e1('0x16')](_0x5931b0[_0xa9e1('0x1a')][_0xa9e1('0x1b')])){utils[_0xa9e1('0xc')](util[_0xa9e1('0x3')](_0xa9e1('0x1c'),_0x5931b0['uniqueid']),_0x5931b0);utils['info'](util[_0xa9e1('0x3')](_0xa9e1('0x1d'),_0x5931b0[_0xa9e1('0x5')],_0x5931b0[_0xa9e1('0x1a')],_0x5931b0[_0xa9e1('0x1e')]));if(_['endsWith'](_0x5931b0['value'],_0xa9e1('0x1f'))){_0x5931b0[_0xa9e1('0x1e')]=_0x5931b0['value'][_0xa9e1('0x20')]('.wav49',_0xa9e1('0x21'));}if(recordings[_0x5931b0[_0xa9e1('0xe')]]){var _0x120c6c=_[_0xa9e1('0x22')](recordings[_0x5931b0[_0xa9e1('0xe')]][_0xa9e1('0x23')],{'value':_0x5931b0[_0xa9e1('0x1e')]});if(_['isNil'](_0x120c6c)){recordings[_0x5931b0[_0xa9e1('0xe')]][_0xa9e1('0x23')][_0xa9e1('0x24')]({'value':_0x5931b0[_0xa9e1('0x1e')]});}}}}catch(_0x1eaa8c){utils[_0xa9e1('0x14')](util['format'](_0xa9e1('0x1c'),_0x5931b0[_0xa9e1('0x5')]),_0x1eaa8c);}};exports[_0xa9e1('0x25')]=function(_0x572ced){try{if(!_['isNil'](recordings[_0x572ced['uniqueid']])){utils[_0xa9e1('0xc')](util['format'](_0xa9e1('0x26'),_0x572ced[_0xa9e1('0x5')]),_0x572ced);utils[_0xa9e1('0x2')](util['format'](_0xa9e1('0x27'),_0x572ced[_0xa9e1('0x5')],_0x572ced[_0xa9e1('0x28')],_0x572ced[_0xa9e1('0x29')],_0x572ced[_0xa9e1('0x2a')]));recordings[_0x572ced[_0xa9e1('0x5')]]['calleridnum']=_0x572ced['calleridnum'];recordings[_0x572ced[_0xa9e1('0x5')]][_0xa9e1('0x29')]=_0x572ced['calleridname'];recordings[_0x572ced[_0xa9e1('0x5')]]['connectedlinenum']=_0x572ced[_0xa9e1('0x2b')];recordings[_0x572ced['uniqueid']]['connectedlinename']=_0x572ced[_0xa9e1('0x2c')];if(recordings[_0x572ced[_0xa9e1('0x5')]]['type']==_0xa9e1('0x2d')&&recordings[_0x572ced[_0xa9e1('0x5')]][_0xa9e1('0x11')]){recordings[_0x572ced[_0xa9e1('0x5')]][_0xa9e1('0x2b')]=recordings[_0x572ced['uniqueid']][_0xa9e1('0x11')];recordings[_0x572ced[_0xa9e1('0x5')]][_0xa9e1('0x2c')]='';}recordings[_0x572ced['uniqueid']][_0xa9e1('0x23')]['forEach'](function(_0x26eb14){var _0x434fcf=_[_0xa9e1('0x2e')](recordings[_0x572ced[_0xa9e1('0x5')]]);_0x434fcf[_0xa9e1('0x1e')]=_0x26eb14[_0xa9e1('0x1e')];writeDB(_0x434fcf);});delete recordings[_0x572ced['uniqueid']];}}catch(_0x36fd0e){utils['error'](util[_0xa9e1('0x3')]('[%s][recordings][hangup]',_0x572ced['uniqueid']),_0x36fd0e);}};exports[_0xa9e1('0x2f')]=function(_0xacc9b4){try{if(!_['isNil'](recordings[_0xacc9b4['uniqueid']])){utils[_0xa9e1('0xc')](util[_0xa9e1('0x3')]('[%s][recordings][newexten]',_0xacc9b4['uniqueid']),_0xacc9b4);utils[_0xa9e1('0x2')](util[_0xa9e1('0x3')](_0xa9e1('0x30'),_0xacc9b4[_0xa9e1('0x5')],_0xacc9b4[_0xa9e1('0x31')],_0xacc9b4[_0xa9e1('0x32')]));if(_0xacc9b4[_0xa9e1('0x31')][_0xa9e1('0x33')]()=='set'&&_[_0xa9e1('0x34')](_0xacc9b4['appdata'][_0xa9e1('0x33')](),_0xa9e1('0x35'))){var _0x351331=_0xacc9b4[_0xa9e1('0x32')][_0xa9e1('0x36')]('=');var _0x409d04=_0x351331[0x0][_0xa9e1('0x37')](_0x351331[0x0][_0xa9e1('0x38')]('(')+0x1,_0x351331[0x0]['lastIndexOf'](')'));var _0x43625e=_0x351331[0x1];recordings[_0xacc9b4[_0xa9e1('0x5')]][_0x409d04]=_0x43625e;}}}catch(_0x128b33){utils[_0xa9e1('0x14')](util[_0xa9e1('0x3')](_0xa9e1('0x39'),_0xacc9b4[_0xa9e1('0x5')]),_0x128b33);}};exports['queuecallerjoin']=function(_0x22477f){try{if(!_[_0xa9e1('0x16')](recordings[_0x22477f['uniqueid']])){utils[_0xa9e1('0xc')](util[_0xa9e1('0x3')](_0xa9e1('0x3a'),_0x22477f[_0xa9e1('0x5')]),_0x22477f);utils[_0xa9e1('0x2')](util[_0xa9e1('0x3')](_0xa9e1('0x3b'),_0x22477f[_0xa9e1('0x5')],_0x22477f['queue']));recordings[_0x22477f[_0xa9e1('0x5')]][_0xa9e1('0x3c')]=_0x22477f[_0xa9e1('0x3c')];}}catch(_0x2e7026){utils[_0xa9e1('0x14')](util['format'](_0xa9e1('0x3a'),_0x22477f[_0xa9e1('0x5')]),_0x2e7026);}}; \ No newline at end of file +var _0xe441=['channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','mixmonitor_filename','[%s][recordings][varset]','variable','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','[%s][recordings][newexten]','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','isNil'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xe441,0x64));var _0x1e44=function(_0x2cbd53,_0xb41686){_0x2cbd53=_0x2cbd53-0x0;var _0x532777=_0xe441[_0x2cbd53];return _0x532777;};'use strict';var _=require(_0x1e44('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x3a2d50){utils['info'](util[_0x1e44('0x1')](_0x1e44('0x2'),_0x3a2d50['uniqueid']));if(_0x3a2d50[_0x1e44('0x3')]){utils[_0x1e44('0x4')](_0x3a2d50[_0x1e44('0x3')])[_0x1e44('0x5')](function(_0x4bcefc){if(_0x4bcefc){_0x3a2d50[_0x1e44('0x6')]=_0x4bcefc['name'];_0x3a2d50[_0x1e44('0x7')]=_0x4bcefc['id'];}utils[_0x1e44('0x8')](_0x1e44('0x9'),_0x3a2d50);});}else{utils['request'](_0x1e44('0x9'),_0x3a2d50);}}exports[_0x1e44('0xa')]=function(_0x5ceb7b){try{utils[_0x1e44('0xb')](util['format'](_0x1e44('0xc'),_0x5ceb7b[_0x1e44('0xd')]),_0x5ceb7b);if(_0x5ceb7b[_0x1e44('0xd')]==_0x5ceb7b[_0x1e44('0xe')]){utils[_0x1e44('0xf')](util['format'](_0x1e44('0x10'),_0x5ceb7b['uniqueid'],_0x5ceb7b[_0x1e44('0x11')],_0x5ceb7b['exten']));recordings[_0x5ceb7b[_0x1e44('0xd')]]={'uniqueid':_0x5ceb7b[_0x1e44('0xd')],'accountcode':_0x5ceb7b['accountcode'],'exten':_0x5ceb7b[_0x1e44('0x12')],'context':_0x5ceb7b[_0x1e44('0x11')],'channel':_0x5ceb7b[_0x1e44('0x13')],'monitors':[]};}}catch(_0x2de64c){utils['error'](util[_0x1e44('0x1')](_0x1e44('0xc'),_0x5ceb7b['uniqueid']),_0x2de64c);}};exports[_0x1e44('0x14')]=function(_0x1ddf74){try{utils[_0x1e44('0xb')](util[_0x1e44('0x1')]('[%s][recordings][newstate]',_0x1ddf74[_0x1e44('0xd')]),_0x1ddf74);if(!_[_0x1e44('0x15')](recordings[_0x1ddf74['uniqueid']])&&_0x1ddf74[_0x1e44('0x16')]==0x6){utils['info'](util[_0x1e44('0x1')](_0x1e44('0x17'),_0x1ddf74[_0x1e44('0xd')],_0x1ddf74[_0x1e44('0x11')],_0x1ddf74['channel']));}else if(!_['isNil'](recordings[_0x1ddf74['linkedid']])&&_0x1ddf74[_0x1e44('0x16')]==0x6&&_0x1ddf74[_0x1e44('0x11')]!=_0x1e44('0x18')){utils[_0x1e44('0xf')](util[_0x1e44('0x1')](_0x1e44('0x19'),_0x1ddf74[_0x1e44('0xd')],_0x1ddf74['linkedid'],_0x1ddf74[_0x1e44('0x11')],_0x1ddf74['channel']));recordings[_0x1ddf74[_0x1e44('0xe')]][_0x1e44('0x3')]=_0x1ddf74['accountcode'];}}catch(_0x391ec2){utils[_0x1e44('0x1a')](util[_0x1e44('0x1')]('[%s][recordings][newstate]',_0x1ddf74[_0x1e44('0xd')]),_0x391ec2);}};exports['varset']=function(_0x3f9705){try{if(!_[_0x1e44('0x15')](_0x3f9705['variable'])&&!_[_0x1e44('0x15')](_0x3f9705['variable'][_0x1e44('0x1b')])){utils[_0x1e44('0xb')](util['format'](_0x1e44('0x1c'),_0x3f9705[_0x1e44('0xd')]),_0x3f9705);utils['info'](util[_0x1e44('0x1')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3f9705[_0x1e44('0xd')],_0x3f9705[_0x1e44('0x1d')],_0x3f9705[_0x1e44('0x1e')]));if(_[_0x1e44('0x1f')](_0x3f9705[_0x1e44('0x1e')],_0x1e44('0x20'))){_0x3f9705[_0x1e44('0x1e')]=_0x3f9705[_0x1e44('0x1e')][_0x1e44('0x21')](_0x1e44('0x20'),_0x1e44('0x22'));}if(recordings[_0x3f9705[_0x1e44('0xe')]]){var _0xc2dc50=_[_0x1e44('0x23')](recordings[_0x3f9705[_0x1e44('0xe')]][_0x1e44('0x24')],{'value':_0x3f9705['value']});if(_['isNil'](_0xc2dc50)){recordings[_0x3f9705[_0x1e44('0xe')]][_0x1e44('0x24')][_0x1e44('0x25')]({'value':_0x3f9705[_0x1e44('0x1e')]});}}}}catch(_0x391b76){utils[_0x1e44('0x1a')](util[_0x1e44('0x1')](_0x1e44('0x1c'),_0x3f9705[_0x1e44('0xd')]),_0x391b76);}};exports[_0x1e44('0x26')]=function(_0x3e8e3d){try{if(!_[_0x1e44('0x15')](recordings[_0x3e8e3d[_0x1e44('0xd')]])){utils[_0x1e44('0xb')](util[_0x1e44('0x1')]('[%s][recordings][hangup]',_0x3e8e3d[_0x1e44('0xd')]),_0x3e8e3d);utils[_0x1e44('0xf')](util[_0x1e44('0x1')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x3e8e3d[_0x1e44('0xd')],_0x3e8e3d[_0x1e44('0x27')],_0x3e8e3d[_0x1e44('0x28')],_0x3e8e3d[_0x1e44('0x29')]));recordings[_0x3e8e3d[_0x1e44('0xd')]]['calleridnum']=_0x3e8e3d[_0x1e44('0x27')];recordings[_0x3e8e3d[_0x1e44('0xd')]][_0x1e44('0x28')]=_0x3e8e3d['calleridname'];recordings[_0x3e8e3d[_0x1e44('0xd')]][_0x1e44('0x2a')]=_0x3e8e3d[_0x1e44('0x2a')];recordings[_0x3e8e3d[_0x1e44('0xd')]][_0x1e44('0x2b')]=_0x3e8e3d['connectedlinename'];if(recordings[_0x3e8e3d[_0x1e44('0xd')]][_0x1e44('0x2c')]==_0x1e44('0x2d')&&recordings[_0x3e8e3d[_0x1e44('0xd')]][_0x1e44('0x3')]){recordings[_0x3e8e3d[_0x1e44('0xd')]][_0x1e44('0x2a')]=recordings[_0x3e8e3d[_0x1e44('0xd')]]['accountcode'];recordings[_0x3e8e3d[_0x1e44('0xd')]][_0x1e44('0x2b')]='';}recordings[_0x3e8e3d[_0x1e44('0xd')]]['monitors'][_0x1e44('0x2e')](function(_0xa743b5){var _0x66d7e=_['clone'](recordings[_0x3e8e3d[_0x1e44('0xd')]]);_0x66d7e['value']=_0xa743b5[_0x1e44('0x1e')];writeDB(_0x66d7e);});delete recordings[_0x3e8e3d[_0x1e44('0xd')]];}}catch(_0x4e1842){utils['error'](util['format'](_0x1e44('0x2f'),_0x3e8e3d[_0x1e44('0xd')]),_0x4e1842);}};exports['newexten']=function(_0x39db76){try{if(!_[_0x1e44('0x15')](recordings[_0x39db76[_0x1e44('0xd')]])){utils[_0x1e44('0xb')](util[_0x1e44('0x1')](_0x1e44('0x30'),_0x39db76[_0x1e44('0xd')]),_0x39db76);utils[_0x1e44('0xf')](util[_0x1e44('0x1')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x39db76[_0x1e44('0xd')],_0x39db76['application'],_0x39db76[_0x1e44('0x31')]));if(_0x39db76[_0x1e44('0x32')][_0x1e44('0x33')]()==_0x1e44('0x34')&&_[_0x1e44('0x35')](_0x39db76[_0x1e44('0x31')][_0x1e44('0x33')](),_0x1e44('0x36'))){var _0x3df42c=_0x39db76['appdata'][_0x1e44('0x37')]('=');var _0x3154d6=_0x3df42c[0x0][_0x1e44('0x38')](_0x3df42c[0x0]['lastIndexOf']('(')+0x1,_0x3df42c[0x0][_0x1e44('0x39')](')'));var _0x469bad=_0x3df42c[0x1];recordings[_0x39db76[_0x1e44('0xd')]][_0x3154d6]=_0x469bad;}}}catch(_0x27fb37){utils[_0x1e44('0x1a')](util[_0x1e44('0x1')](_0x1e44('0x30'),_0x39db76[_0x1e44('0xd')]),_0x27fb37);}};exports[_0x1e44('0x3a')]=function(_0x249c81){try{if(!_['isNil'](recordings[_0x249c81['uniqueid']])){utils[_0x1e44('0xb')](util[_0x1e44('0x1')](_0x1e44('0x3b'),_0x249c81[_0x1e44('0xd')]),_0x249c81);utils[_0x1e44('0xf')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x249c81[_0x1e44('0xd')],_0x249c81[_0x1e44('0x3c')]));recordings[_0x249c81[_0x1e44('0xd')]][_0x1e44('0x3c')]=_0x249c81[_0x1e44('0x3c')];}}catch(_0x53a68a){utils[_0x1e44('0x1a')](util[_0x1e44('0x1')](_0x1e44('0x3b'),_0x249c81[_0x1e44('0xd')]),_0x53a68a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index bb79e14..5201752 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 _0x6585=['isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','./utils','type','uniqueid','request','CreateVoiceTransferReport','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','origtransfereruniqueid','info','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0x6585,0xc1));var _0x5658=function(_0x38ed42,_0x3d9a37){_0x38ed42=_0x38ed42-0x0;var _0x474931=_0x6585[_0x38ed42];return _0x474931;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x5658('0x0'));function writeDB(_0x4f528c){utils['info'](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x4f528c[_0x5658('0x1')]==='attended'?_0x4f528c['origtransfereruniqueid']:_0x4f528c[_0x5658('0x2')],_0x4f528c[_0x5658('0x1')]));utils[_0x5658('0x3')](_0x5658('0x4'),_0x4f528c);}exports['blindtransfer']=function(_0x16bb23){try{utils[_0x5658('0x5')](util[_0x5658('0x6')](_0x5658('0x7'),_0x16bb23['uniqueid']),_0x16bb23);utils['info'](util[_0x5658('0x6')](_0x5658('0x8'),_0x16bb23[_0x5658('0x2')],_0x16bb23[_0x5658('0x9')],_0x16bb23[_0x5658('0xa')],_0x16bb23[_0x5658('0xb')],_0x16bb23[_0x5658('0xc')]));_0x16bb23['type']=_0x5658('0xd');writeDB(_0x16bb23);}catch(_0x5b938f){utils[_0x5658('0xe')](util[_0x5658('0x6')](_0x5658('0x7'),_0x16bb23[_0x5658('0x2')]),_0x5b938f);}};exports[_0x5658('0xf')]=function(_0x131ffd){try{utils[_0x5658('0x5')](util['format']('[%s][transfers][attendedtransfer]',_0x131ffd[_0x5658('0x10')]),_0x131ffd);utils[_0x5658('0x11')](util[_0x5658('0x6')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x131ffd['origtransfereruniqueid'],_0x131ffd[_0x5658('0x12')],_0x131ffd[_0x5658('0x13')],_0x131ffd[_0x5658('0x14')],_0x131ffd[_0x5658('0x15')]));_0x131ffd=_[_0x5658('0x16')](_0x131ffd,{'transfererchannel':_0x131ffd[_0x5658('0x17')],'transferercalleridnum':_0x131ffd[_0x5658('0x12')],'transferercalleridname':_0x131ffd[_0x5658('0x13')],'transfererconnectedlinenum':_0x131ffd['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x131ffd[_0x5658('0x18')],'transfereraccountcode':_0x131ffd['origtransfereraccountcode'],'transferercontext':_0x131ffd[_0x5658('0x19')],'transfererexten':_0x131ffd[_0x5658('0x1a')],'transfererlinkedid':_0x131ffd[_0x5658('0x1b')],'context':_0x131ffd[_0x5658('0x1c')],'extension':_0x131ffd['origtransfererexten'],'type':'attended'});if(_[_0x5658('0x1d')](_0x131ffd[_0x5658('0x1e')])){_0x131ffd=_[_0x5658('0x16')](_0x131ffd,{'transfereechannel':_0x131ffd[_0x5658('0x1f')],'transfereecalleridnum':_0x131ffd[_0x5658('0x14')],'transfereecalleridname':_0x131ffd[_0x5658('0x15')],'transfereeconnectedlinenum':_0x131ffd['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x131ffd[_0x5658('0x20')],'transfereeaccountcode':_0x131ffd[_0x5658('0x21')],'transfereecontext':_0x131ffd['transfertargetcontext'],'transfereeexten':_0x131ffd[_0x5658('0x22')],'transfereelinkedid':_0x131ffd[_0x5658('0x23')]});}writeDB(_0x131ffd);}catch(_0xce2337){utils[_0x5658('0xe')](util['format'](_0x5658('0x24'),_0x131ffd[_0x5658('0x10')]),_0xce2337);}}; \ No newline at end of file +var _0xb706=['[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]'];(function(_0x3a8b7c,_0x3e5db2){var _0x40eb80=function(_0x8db6a3){while(--_0x8db6a3){_0x3a8b7c['push'](_0x3a8b7c['shift']());}};_0x40eb80(++_0x3e5db2);}(_0xb706,0x1eb));var _0x6b70=function(_0x3098ef,_0x12614d){_0x3098ef=_0x3098ef-0x0;var _0x681e21=_0xb706[_0x3098ef];return _0x681e21;};'use strict';var _=require(_0x6b70('0x0'));var util=require(_0x6b70('0x1'));var utils=require(_0x6b70('0x2'));function writeDB(_0x3c2498){utils[_0x6b70('0x3')](util[_0x6b70('0x4')](_0x6b70('0x5'),_0x3c2498[_0x6b70('0x6')]===_0x6b70('0x7')?_0x3c2498[_0x6b70('0x8')]:_0x3c2498[_0x6b70('0x9')],_0x3c2498['type']));utils[_0x6b70('0xa')](_0x6b70('0xb'),_0x3c2498);}exports[_0x6b70('0xc')]=function(_0x5cb101){try{utils[_0x6b70('0xd')](util['format'](_0x6b70('0xe'),_0x5cb101['uniqueid']),_0x5cb101);utils[_0x6b70('0x3')](util['format'](_0x6b70('0xf'),_0x5cb101[_0x6b70('0x9')],_0x5cb101[_0x6b70('0x10')],_0x5cb101[_0x6b70('0x11')],_0x5cb101[_0x6b70('0x12')],_0x5cb101[_0x6b70('0x13')]));_0x5cb101['type']='blind';writeDB(_0x5cb101);}catch(_0x1a5e88){utils[_0x6b70('0x14')](util[_0x6b70('0x4')](_0x6b70('0xe'),_0x5cb101[_0x6b70('0x9')]),_0x1a5e88);}};exports[_0x6b70('0x15')]=function(_0x52579f){try{utils[_0x6b70('0xd')](util[_0x6b70('0x4')](_0x6b70('0x16'),_0x52579f[_0x6b70('0x8')]),_0x52579f);utils[_0x6b70('0x3')](util[_0x6b70('0x4')](_0x6b70('0x17'),_0x52579f[_0x6b70('0x8')],_0x52579f[_0x6b70('0x18')],_0x52579f[_0x6b70('0x19')],_0x52579f[_0x6b70('0x1a')],_0x52579f[_0x6b70('0x1b')]));_0x52579f=_['assign'](_0x52579f,{'transfererchannel':_0x52579f[_0x6b70('0x1c')],'transferercalleridnum':_0x52579f[_0x6b70('0x18')],'transferercalleridname':_0x52579f[_0x6b70('0x19')],'transfererconnectedlinenum':_0x52579f[_0x6b70('0x1d')],'transfererconnectedlinename':_0x52579f[_0x6b70('0x1e')],'transfereraccountcode':_0x52579f[_0x6b70('0x1f')],'transferercontext':_0x52579f[_0x6b70('0x20')],'transfererexten':_0x52579f[_0x6b70('0x21')],'transfererlinkedid':_0x52579f[_0x6b70('0x22')],'context':_0x52579f['origtransferercontext'],'extension':_0x52579f[_0x6b70('0x23')],'type':_0x6b70('0x7')});if(_[_0x6b70('0x24')](_0x52579f[_0x6b70('0x25')])){_0x52579f=_[_0x6b70('0x26')](_0x52579f,{'transfereechannel':_0x52579f[_0x6b70('0x27')],'transfereecalleridnum':_0x52579f[_0x6b70('0x1a')],'transfereecalleridname':_0x52579f['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x52579f[_0x6b70('0x28')],'transfereeconnectedlinename':_0x52579f[_0x6b70('0x29')],'transfereeaccountcode':_0x52579f[_0x6b70('0x2a')],'transfereecontext':_0x52579f[_0x6b70('0x2b')],'transfereeexten':_0x52579f[_0x6b70('0x2c')],'transfereelinkedid':_0x52579f[_0x6b70('0x2d')]});}writeDB(_0x52579f);}catch(_0x42fe3f){utils[_0x6b70('0x14')](util['format'](_0x6b70('0x16'),_0x52579f[_0x6b70('0x8')]),_0x42fe3f);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index eb1d14f..245fcf8 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 _0x3c9f=['getUserByName','[utils][getUserByName]\x20name:%s\x20%s','found','getVoiceQueueByName','GetVoiceQueue','name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','internal','interface','then','[utils][getUser]\x20where:%s','result','length','getUserByInternal','notfound','getUserByInterface','[utils][getUserByInterface]'];(function(_0x396588,_0x222305){var _0x408d3b=function(_0x263eb3){while(--_0x263eb3){_0x396588['push'](_0x396588['shift']());}};_0x408d3b(++_0x222305);}(_0x3c9f,0x148));var _0xf3c9=function(_0x41b9ff,_0x5ae1dd){_0x41b9ff=_0x41b9ff-0x0;var _0x5d6352=_0x3c9f[_0x41b9ff];return _0x5d6352;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xf3c9('0x0'));var moment=require(_0xf3c9('0x1'));var util=require(_0xf3c9('0x2'));var client=jayson[_0xf3c9('0x3')][_0xf3c9('0x4')]({'port':0x2329});var logger=require(_0xf3c9('0x5'))(_0xf3c9('0x6'));exports['info']=function(_0x10bc04,_0x1888d1){logger[_0xf3c9('0x7')](_0x10bc04,_0x1888d1?util[_0xf3c9('0x8')](_0x1888d1,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x3ab952,_0x4c25c2){logger[_0xf3c9('0x9')](_0x3ab952,_0x4c25c2?util[_0xf3c9('0x8')](_0x4c25c2,{'showHidden':![],'depth':null}):'');};exports[_0xf3c9('0xa')]=function(_0x29b4af,_0x80858f){logger[_0xf3c9('0xa')](_0x29b4af,_0x80858f?util[_0xf3c9('0x8')](_0x80858f,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x513a95,_0xf4a849){return client[_0xf3c9('0xb')](_0x513a95,{'body':_0xf4a849})['then'](function(_0x34e8e6){logger[_0xf3c9('0x9')](_0xf3c9('0xc'),_0x513a95,_0x34e8e6?util['inspect'](_0x34e8e6,{'showHidden':![],'depth':null}):'');})[_0xf3c9('0xd')](function(_0xba0072){logger[_0xf3c9('0xa')](_0xf3c9('0xc'),_0x513a95,_0xba0072?util[_0xf3c9('0x8')](_0xba0072,{'showHidden':![],'depth':null}):'');});};function getUser(_0x17bcc2){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0xf3c9('0xe'),'name',_0xf3c9('0xf')],'where':_0x17bcc2,'limit':0x1}})[_0xf3c9('0x10')](function(_0x1f26d4){logger['debug'](_0xf3c9('0x11'),JSON['stringify'](_0x17bcc2),_0x1f26d4?util[_0xf3c9('0x8')](_0x1f26d4,{'showHidden':![],'depth':null}):'');return _0x1f26d4[_0xf3c9('0x12')][_0xf3c9('0x13')]?_0x1f26d4[_0xf3c9('0x12')][0x0]:null;});}exports[_0xf3c9('0x14')]=function(_0xc3483d){return new BPromise(function(_0x4ba7e5,_0x871c75){if(_0xc3483d){return getUser({'internal':_0xc3483d})[_0xf3c9('0x10')](function(_0x15921f){logger[_0xf3c9('0x7')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0xc3483d,_0x15921f?'found':_0xf3c9('0x15'));return _0x4ba7e5(_0x15921f);})[_0xf3c9('0xd')](function(_0x1b9c78){logger[_0xf3c9('0xa')]('[utils][getUserByInternal]',_0x1b9c78?util['inspect'](_0x1b9c78,{'showHidden':![],'depth':null}):'');return _0x4ba7e5(null);});}return _0x4ba7e5(null);});};exports[_0xf3c9('0x16')]=function(_0x3bddd0){return new BPromise(function(_0x1a97bc,_0x4cd4f9){if(_0x3bddd0){return getUser({'interface':_0x3bddd0})[_0xf3c9('0x10')](function(_0x4a706c){logger[_0xf3c9('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x3bddd0,_0x4a706c?'found':'notfound');return _0x1a97bc(_0x4a706c);})[_0xf3c9('0xd')](function(_0x16cd3b){logger['error'](_0xf3c9('0x17'),_0x16cd3b?util[_0xf3c9('0x8')](_0x16cd3b,{'showHidden':![],'depth':null}):'');return _0x1a97bc(null);});}return _0x1a97bc(null);});};exports[_0xf3c9('0x18')]=function(_0x3a1eec){return new BPromise(function(_0x3cb474,_0x49f93a){if(_0x3a1eec){return getUser({'name':_0x3a1eec})[_0xf3c9('0x10')](function(_0x542f60){logger[_0xf3c9('0x7')](_0xf3c9('0x19'),_0x3a1eec,_0x542f60?_0xf3c9('0x1a'):_0xf3c9('0x15'));return _0x3cb474(_0x542f60);})[_0xf3c9('0xd')](function(_0xcc4cbd){logger[_0xf3c9('0xa')]('[utils][getUserByName]',_0xcc4cbd?util[_0xf3c9('0x8')](_0xcc4cbd,{'showHidden':![],'depth':null}):'');return _0x3cb474(null);});}return _0x3cb474(null);});};exports[_0xf3c9('0x1b')]=function(_0x498320){return new BPromise(function(_0x4539c0,_0x4b616d){if(_0x498320){return client[_0xf3c9('0xb')](_0xf3c9('0x1c'),{'options':{'raw':!![],'attributes':['id',_0xf3c9('0x1d'),'type',_0xf3c9('0x1e'),_0xf3c9('0x1f')],'where':{'name':_0x498320},'limit':0x1}})[_0xf3c9('0x10')](function(_0x190b28){logger['debug'](_0xf3c9('0x20'),_0x498320,_0x190b28?util[_0xf3c9('0x8')](_0x190b28,{'showHidden':![],'depth':null}):'');logger[_0xf3c9('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x498320,_0x190b28?_0xf3c9('0x1a'):'notfound');return _0x4539c0(_0x190b28['result']['length']?_0x190b28['result'][0x0]:null);})[_0xf3c9('0xd')](function(_0x3d8853){logger[_0xf3c9('0xa')](_0xf3c9('0x21'),_0x3d8853?util[_0xf3c9('0x8')](_0x3d8853,{'showHidden':![],'depth':null}):'');return _0x4539c0(null);});}return _0x4539c0(null);});};exports['addTime']=function(_0x388697,_0x39a6fc){return moment(_0x388697)['add'](_0x39a6fc,'seconds')[_0xf3c9('0x22')](_0xf3c9('0x23'));};exports[_0xf3c9('0x24')]=function(_0x58f764,_0x2397cb){return moment(_0x58f764)[_0xf3c9('0x25')](_0x2397cb,_0xf3c9('0x26'))[_0xf3c9('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf3c9('0x27')]=function(_0x55c887,_0x44cb75){return moment(_0x55c887)['diff'](moment(_0x44cb75),_0xf3c9('0x26'));};exports[_0xf3c9('0x28')]=function(_0x4f56fa,_0x6e272f){return parseInt(_0x4f56fa,0xa)+parseInt(_0x6e272f,0xa);};exports[_0xf3c9('0x29')]=function(){return moment()['format'](_0xf3c9('0x23'));};exports[_0xf3c9('0x2a')]=function(_0x480423,_0x384369){if(_0x384369){return moment(_0x480423)[_0xf3c9('0x2a')](_0x384369);}return!![];};exports[_0xf3c9('0x2b')]=function(_0x58c0ef,_0x270331){if(_0x270331){return moment(_0x58c0ef)[_0xf3c9('0x2b')](_0x270331);}else if(_0x58c0ef){return!![];}return![];}; \ No newline at end of file +var _0xa13a=['inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]','addTime','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','isAfter','isBefore','bluebird','util','client','http','../../config/logger','info'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0xa13a,0xae));var _0xaa13=function(_0x354762,_0x1e7ca0){_0x354762=_0x354762-0x0;var _0x599958=_0xa13a[_0x354762];return _0x599958;};'use strict';var BPromise=require(_0xaa13('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0xaa13('0x1'));var client=jayson[_0xaa13('0x2')][_0xaa13('0x3')]({'port':0x2329});var logger=require(_0xaa13('0x4'))('xdr');exports[_0xaa13('0x5')]=function(_0x390c72,_0x284253){logger[_0xaa13('0x5')](_0x390c72,_0x284253?util[_0xaa13('0x6')](_0x284253,{'showHidden':![],'depth':null}):'');};exports[_0xaa13('0x7')]=function(_0x3207e5,_0x48cf11){logger[_0xaa13('0x7')](_0x3207e5,_0x48cf11?util['inspect'](_0x48cf11,{'showHidden':![],'depth':null}):'');};exports[_0xaa13('0x8')]=function(_0x15f9f7,_0x4bced6){logger[_0xaa13('0x8')](_0x15f9f7,_0x4bced6?util[_0xaa13('0x6')](_0x4bced6,{'showHidden':![],'depth':null}):'');};exports[_0xaa13('0x9')]=function(_0x52e8fc,_0x551ee8){return client[_0xaa13('0x9')](_0x52e8fc,{'body':_0x551ee8})[_0xaa13('0xa')](function(_0x57b40c){logger[_0xaa13('0x7')](_0xaa13('0xb'),_0x52e8fc,_0x57b40c?util[_0xaa13('0x6')](_0x57b40c,{'showHidden':![],'depth':null}):'');})[_0xaa13('0xc')](function(_0x1b792c){logger['error']('[utils][request]\x20name:%s',_0x52e8fc,_0x1b792c?util['inspect'](_0x1b792c,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2fb4ee){return client[_0xaa13('0x9')](_0xaa13('0xd'),{'options':{'raw':!![],'attributes':['id',_0xaa13('0xe'),'name',_0xaa13('0xf')],'where':_0x2fb4ee,'limit':0x1}})[_0xaa13('0xa')](function(_0x285024){logger['debug'](_0xaa13('0x10'),JSON[_0xaa13('0x11')](_0x2fb4ee),_0x285024?util[_0xaa13('0x6')](_0x285024,{'showHidden':![],'depth':null}):'');return _0x285024[_0xaa13('0x12')]['length']?_0x285024[_0xaa13('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x2b5a5f){return new BPromise(function(_0x22061f,_0x469e04){if(_0x2b5a5f){return getUser({'internal':_0x2b5a5f})['then'](function(_0x295dd9){logger['info'](_0xaa13('0x13'),_0x2b5a5f,_0x295dd9?_0xaa13('0x14'):_0xaa13('0x15'));return _0x22061f(_0x295dd9);})[_0xaa13('0xc')](function(_0x2a375d){logger[_0xaa13('0x8')](_0xaa13('0x16'),_0x2a375d?util[_0xaa13('0x6')](_0x2a375d,{'showHidden':![],'depth':null}):'');return _0x22061f(null);});}return _0x22061f(null);});};exports[_0xaa13('0x17')]=function(_0x3ad316){return new BPromise(function(_0x4cc971,_0x7f6240){if(_0x3ad316){return getUser({'interface':_0x3ad316})[_0xaa13('0xa')](function(_0x1340d0){logger['info'](_0xaa13('0x18'),_0x3ad316,_0x1340d0?_0xaa13('0x14'):'notfound');return _0x4cc971(_0x1340d0);})['catch'](function(_0x4136bf){logger[_0xaa13('0x8')]('[utils][getUserByInterface]',_0x4136bf?util['inspect'](_0x4136bf,{'showHidden':![],'depth':null}):'');return _0x4cc971(null);});}return _0x4cc971(null);});};exports[_0xaa13('0x19')]=function(_0x32a0a1){return new BPromise(function(_0x10fc63,_0x497fde){if(_0x32a0a1){return getUser({'name':_0x32a0a1})['then'](function(_0x674e5b){logger['info'](_0xaa13('0x1a'),_0x32a0a1,_0x674e5b?_0xaa13('0x14'):_0xaa13('0x15'));return _0x10fc63(_0x674e5b);})[_0xaa13('0xc')](function(_0x1bb54d){logger['error'](_0xaa13('0x1b'),_0x1bb54d?util[_0xaa13('0x6')](_0x1bb54d,{'showHidden':![],'depth':null}):'');return _0x10fc63(null);});}return _0x10fc63(null);});};exports[_0xaa13('0x1c')]=function(_0x151bb4){return new BPromise(function(_0x44b3c2,_0x463353){if(_0x151bb4){return client['request'](_0xaa13('0x1d'),{'options':{'raw':!![],'attributes':['id','name','type',_0xaa13('0x1e'),'acwTimeout'],'where':{'name':_0x151bb4},'limit':0x1}})[_0xaa13('0xa')](function(_0x634576){logger[_0xaa13('0x7')](_0xaa13('0x1f'),_0x151bb4,_0x634576?util[_0xaa13('0x6')](_0x634576,{'showHidden':![],'depth':null}):'');logger[_0xaa13('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x151bb4,_0x634576?_0xaa13('0x14'):_0xaa13('0x15'));return _0x44b3c2(_0x634576['result'][_0xaa13('0x20')]?_0x634576['result'][0x0]:null);})[_0xaa13('0xc')](function(_0x58a112){logger[_0xaa13('0x8')](_0xaa13('0x21'),_0x58a112?util[_0xaa13('0x6')](_0x58a112,{'showHidden':![],'depth':null}):'');return _0x44b3c2(null);});}return _0x44b3c2(null);});};exports[_0xaa13('0x22')]=function(_0x3f747d,_0x5b752b){return moment(_0x3f747d)['add'](_0x5b752b,_0xaa13('0x23'))[_0xaa13('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xaa13('0x25')]=function(_0x239eef,_0x3c5449){return moment(_0x239eef)[_0xaa13('0x26')](_0x3c5449,'seconds')[_0xaa13('0x24')](_0xaa13('0x27'));};exports[_0xaa13('0x28')]=function(_0x18c828,_0x132797){return moment(_0x18c828)[_0xaa13('0x29')](moment(_0x132797),_0xaa13('0x23'));};exports[_0xaa13('0x2a')]=function(_0x2839fb,_0x72bbe2){return parseInt(_0x2839fb,0xa)+parseInt(_0x72bbe2,0xa);};exports['now']=function(){return moment()[_0xaa13('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xaa13('0x2b')]=function(_0x27d00d,_0xcdd658){if(_0xcdd658){return moment(_0x27d00d)[_0xaa13('0x2b')](_0xcdd658);}return!![];};exports[_0xaa13('0x2c')]=function(_0x55c133,_0x3b99c3){if(_0x3b99c3){return moment(_0x55c133)[_0xaa13('0x2c')](_0x3b99c3);}else if(_0x55c133){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 167f721..10a041b 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 _0xf91d=['agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','url','device','other','lodash','express-winston','path','util','./loggers','./safe-template','./mask-sensitive-data','join','log','client','role','then','user','no-user','data','timestamp','catch','error','auth','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s'];(function(_0x292236,_0x2c0f0e){var _0x107e37=function(_0xc99bfc){while(--_0xc99bfc){_0x292236['push'](_0x292236['shift']());}};_0x107e37(++_0x2c0f0e);}(_0xf91d,0x1e6));var _0xdf91=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf91d[_0x40a045];return _0x1a687c;};var fs=require('fs-extra');var _=require(_0xdf91('0x0'));var ewinston=require(_0xdf91('0x1'));var path=require(_0xdf91('0x2'));var util=require(_0xdf91('0x3'));var fileLogger=require(_0xdf91('0x4'))['fileLogger'];var safeTemplate=require(_0xdf91('0x5'))['safeTemplate'];var maskSensitiveData=require(_0xdf91('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x2ba60e(_0x308304){var _0x4a8eb8=path[_0xdf91('0x7')]('/var',_0xdf91('0x8'),'xcally');var _0x43f0ce=path[_0xdf91('0x7')](_0xdf91('0x9'),_0x308304[_0xdf91('0xa')]+'-'+_0x308304['name']);return fs['ensureDir'](path[_0xdf91('0x7')](_0x4a8eb8,_0x43f0ce))[_0xdf91('0xb')](function(){var _0x3d0d5c=fileLogger(_0xdf91('0x9'),path[_0xdf91('0x7')](_0x4a8eb8,_0x43f0ce));return _0x3d0d5c;})['catch'](function(_0x4f72c3){throw _0x4f72c3;});}this[_0xdf91('0x8')]=function(_0x5ce0c0,_0xcd1e74,_0x13ad21,_0x2d254c){return _0x2ba60e(_0x5ce0c0[_0xdf91('0xc')])[_0xdf91('0xb')](function(_0x16cd95){var _0x3ff193=_0x16cd95[_0xcd1e74];return _0x3ff193;})[_0xdf91('0xb')](function(_0x4cde8d){var _0x66d4e9=_0x5ce0c0[_0xdf91('0xc')]?_0x5ce0c0[_0xdf91('0xc')]['id']:_0xdf91('0xd');var _0x2a2d85=_0x2d254c[_0xdf91('0xe')];var _0xc1da14=_0x2d254c[_0xdf91('0xf')];var _0x45413a=new Date(Number(_0xc1da14));return _0x4cde8d(_0x66d4e9,_0x45413a,_0x13ad21,_0x2a2d85);})[_0xdf91('0x10')](function(_0x2ab2a5){fileLogger('client')[_0xdf91('0x11')](_0x2ab2a5);});};}function setupLoggers(_0x3fd188){return new Promise(function(_0x416951){var _0x51c285=new ClientSideLogger();var _0xce00fe=fileLogger('api');var _0x7ca0b7=fileLogger(_0xdf91('0x12'));_0x3fd188['set'](_0xdf91('0x13'),_0x51c285);_0x3fd188['use'](ewinston[_0xdf91('0x14')]({'winstonInstance':_0xce00fe,'meta':![],'statusLevels':!![],'msg':function(_0x399e0a,_0xcb77bb){var _0x3ba07c=_0xdf91('0x15');if(!_['isEmpty'](_0x399e0a[_0xdf91('0x16')])){_0x3ba07c+=_0xdf91('0x17');var _0x87be29=_0x399e0a[_0xdf91('0x16')];maskSensitiveData(_0x87be29);}return safeTemplate(util['format'](_0x3ba07c,_0x399e0a[_0xdf91('0x18')],_0x399e0a[_0xdf91('0x19')]['x-forwarded-for']?_0x399e0a[_0xdf91('0x19')][_0xdf91('0x1a')]:_0x399e0a[_0xdf91('0x1b')][_0xdf91('0x1c')]||_0x399e0a['ip'],_0x399e0a['url'],_0xcb77bb[_0xdf91('0x1d')],_0xcb77bb[_0xdf91('0x1e')],_0x399e0a[_0xdf91('0xc')]?_0x399e0a[_0xdf91('0xc')]['id']:null,_0x399e0a[_0xdf91('0xc')]?_0x399e0a[_0xdf91('0xc')][_0xdf91('0x1f')]:null,_0x399e0a[_0xdf91('0xc')]?_0x399e0a['user']['role']:null,_0x87be29?util[_0xdf91('0x20')](_0x87be29,![],null):''));}}));_0x3fd188['use'](ewinston['logger']({'winstonInstance':_0x7ca0b7,'meta':![],'statusLevels':!![],'msg':function(_0xf1e9db,_0x510545){var _0xc88f18=_0xdf91('0x21');if(_0xf1e9db['body']&&_0xf1e9db[_0xdf91('0x16')]['device']&&_0xf1e9db['body'][_0xdf91('0x22')]){_0xc88f18=_0xdf91('0x23');}return util[_0xdf91('0x24')](_0xc88f18,_0xf1e9db['method'],_0xf1e9db[_0xdf91('0x19')]['x-forwarded-for']?_0xf1e9db[_0xdf91('0x19')][_0xdf91('0x1a')]:_0xf1e9db[_0xdf91('0x1b')][_0xdf91('0x1c')]||_0xf1e9db['ip'],_0xf1e9db[_0xdf91('0x25')],_0x510545[_0xdf91('0x1d')],_0x510545[_0xdf91('0x1e')],_0xf1e9db[_0xdf91('0xc')]?_0xf1e9db[_0xdf91('0xc')]['id']:null,_0xf1e9db[_0xdf91('0xc')]?_0xf1e9db['user'][_0xdf91('0x1f')]:null,_0xf1e9db[_0xdf91('0xc')]?_0xf1e9db[_0xdf91('0xc')]['role']:null,_0xf1e9db[_0xdf91('0x16')]&&_0xf1e9db[_0xdf91('0x16')][_0xdf91('0x26')]?_0xf1e9db[_0xdf91('0x16')][_0xdf91('0x26')]:_0xdf91('0x27'),_0xf1e9db[_0xdf91('0x16')]&&_0xf1e9db[_0xdf91('0x16')]['agent_id']?_0xf1e9db[_0xdf91('0x16')][_0xdf91('0x22')]:'',_0xf1e9db[_0xdf91('0x16')]&&_0xf1e9db['body']['agent_name']?_0xf1e9db[_0xdf91('0x16')]['agent_name']:'');},'ignoreRoute':function(_0x4053e9){var _0x159e74=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x159e74['test'](_0x4053e9[_0xdf91('0x25')]);}}));return _0x416951();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x6998=['headers','connection','remoteAddress','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','agent_id','agent_name','test','setupLoggers','util','./loggers','./safe-template','./mask-sensitive-data','maskSensitiveData','log','xcally','join','role','name','ensureDir','then','client','catch','user','timestamp','error','api','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','x-forwarded-for'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0x6998,0x134));var _0x8699=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0x6998[_0x5e9a69];return _0x5979c8;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require('express-winston');var path=require('path');var util=require(_0x8699('0x0'));var fileLogger=require(_0x8699('0x1'))['fileLogger'];var safeTemplate=require(_0x8699('0x2'))['safeTemplate'];var maskSensitiveData=require(_0x8699('0x3'))[_0x8699('0x4')];function ClientSideLogger(){function _0x33d3a7(_0x55bc40){var _0x1dd845=path['join']('/var',_0x8699('0x5'),_0x8699('0x6'));var _0x41ef38=path[_0x8699('0x7')]('client',_0x55bc40[_0x8699('0x8')]+'-'+_0x55bc40[_0x8699('0x9')]);return fs[_0x8699('0xa')](path[_0x8699('0x7')](_0x1dd845,_0x41ef38))[_0x8699('0xb')](function(){var _0x79961f=fileLogger(_0x8699('0xc'),path[_0x8699('0x7')](_0x1dd845,_0x41ef38));return _0x79961f;})[_0x8699('0xd')](function(_0x2cf94a){throw _0x2cf94a;});}this[_0x8699('0x5')]=function(_0x165ef8,_0x3d4ab8,_0x192cf6,_0x12a1d1){return _0x33d3a7(_0x165ef8[_0x8699('0xe')])['then'](function(_0x323130){var _0x449fb2=_0x323130[_0x3d4ab8];return _0x449fb2;})[_0x8699('0xb')](function(_0x13ff30){var _0x1f4bef=_0x165ef8[_0x8699('0xe')]?_0x165ef8[_0x8699('0xe')]['id']:'no-user';var _0x1a543a=_0x12a1d1['data'];var _0x5cc1e1=_0x12a1d1[_0x8699('0xf')];var _0x3ac430=new Date(Number(_0x5cc1e1));return _0x13ff30(_0x1f4bef,_0x3ac430,_0x192cf6,_0x1a543a);})[_0x8699('0xd')](function(_0x42f302){fileLogger('client')[_0x8699('0x10')](_0x42f302);});};}function setupLoggers(_0x5ce0fc){return new Promise(function(_0x482beb){var _0x2278c5=new ClientSideLogger();var _0x2380e3=fileLogger(_0x8699('0x11'));var _0x564f30=fileLogger(_0x8699('0x12'));_0x5ce0fc['set'](_0x8699('0x13'),_0x2278c5);_0x5ce0fc[_0x8699('0x14')](ewinston[_0x8699('0x15')]({'winstonInstance':_0x2380e3,'meta':![],'statusLevels':!![],'msg':function(_0x53bf18,_0x38acf0){var _0x255eec=_0x8699('0x16');if(!_[_0x8699('0x17')](_0x53bf18[_0x8699('0x18')])){_0x255eec+=_0x8699('0x19');var _0x501cdc=_0x53bf18[_0x8699('0x18')];maskSensitiveData(_0x501cdc);}return safeTemplate(util[_0x8699('0x1a')](_0x255eec,_0x53bf18['method'],_0x53bf18['headers'][_0x8699('0x1b')]?_0x53bf18[_0x8699('0x1c')]['x-forwarded-for']:_0x53bf18[_0x8699('0x1d')][_0x8699('0x1e')]||_0x53bf18['ip'],_0x53bf18[_0x8699('0x1f')],_0x38acf0[_0x8699('0x20')],_0x38acf0['responseTime'],_0x53bf18[_0x8699('0xe')]?_0x53bf18[_0x8699('0xe')]['id']:null,_0x53bf18[_0x8699('0xe')]?_0x53bf18['user'][_0x8699('0x9')]:null,_0x53bf18[_0x8699('0xe')]?_0x53bf18[_0x8699('0xe')][_0x8699('0x8')]:null,_0x501cdc?util[_0x8699('0x21')](_0x501cdc,![],null):''));}}));_0x5ce0fc['use'](ewinston[_0x8699('0x15')]({'winstonInstance':_0x564f30,'meta':![],'statusLevels':!![],'msg':function(_0x4226b8,_0x30a073){var _0x4bc81d=_0x8699('0x22');if(_0x4226b8['body']&&_0x4226b8[_0x8699('0x18')][_0x8699('0x23')]&&_0x4226b8[_0x8699('0x18')]['agent_id']){_0x4bc81d=_0x8699('0x24');}return util['format'](_0x4bc81d,_0x4226b8[_0x8699('0x25')],_0x4226b8['headers']['x-forwarded-for']?_0x4226b8[_0x8699('0x1c')][_0x8699('0x1b')]:_0x4226b8[_0x8699('0x1d')][_0x8699('0x1e')]||_0x4226b8['ip'],_0x4226b8[_0x8699('0x1f')],_0x30a073[_0x8699('0x20')],_0x30a073['responseTime'],_0x4226b8[_0x8699('0xe')]?_0x4226b8[_0x8699('0xe')]['id']:null,_0x4226b8['user']?_0x4226b8['user'][_0x8699('0x9')]:null,_0x4226b8[_0x8699('0xe')]?_0x4226b8[_0x8699('0xe')][_0x8699('0x8')]:null,_0x4226b8['body']&&_0x4226b8['body']['device']?_0x4226b8[_0x8699('0x18')][_0x8699('0x23')]:'other',_0x4226b8[_0x8699('0x18')]&&_0x4226b8[_0x8699('0x18')][_0x8699('0x26')]?_0x4226b8[_0x8699('0x18')][_0x8699('0x26')]:'',_0x4226b8['body']&&_0x4226b8[_0x8699('0x18')][_0x8699('0x27')]?_0x4226b8[_0x8699('0x18')][_0x8699('0x27')]:'');},'ignoreRoute':function(_0xbcc94d){var _0x5f2a21=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5f2a21[_0x8699('0x28')](_0xbcc94d['url']);}}));return _0x482beb();});}exports[_0x8699('0x29')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index bc09220..4feb4fa 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a42=['daysInMonth','min','max','domCompare','monthCompare','guess','test','isMoment','split','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','weekdaysShort','toLowerCase','indexOf','slice','exports','concat','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','format','ddd','includes','dowCompare','date'];(function(_0x1f2aa4,_0xb618f3){var _0x499e5c=function(_0x287cb8){while(--_0x287cb8){_0x1f2aa4['push'](_0x1f2aa4['shift']());}};_0x499e5c(++_0xb618f3);}(_0x9a42,0xac));var _0x29a4=function(_0x4fd624,_0x48dca4){_0x4fd624=_0x4fd624-0x0;var _0x105239=_0x9a42[_0x4fd624];return _0x105239;};var _=require(_0x29a4('0x0'));var moment=require(_0x29a4('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][_0x29a4('0x2')](function(_0x6859b9){return _0x6859b9[_0x29a4('0x3')];})[_0x29a4('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x29a4('0x5');var EINVALID_DATE=_0x29a4('0x6');function throwIfDateNotValid(_0x2c3d62){if(!_0x2c3d62[_0x29a4('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xe99c90){var _0x24477f=_0xe99c90['split'](':')[_0x29a4('0x2')](function(_0x22f4c){return parseInt(_0x22f4c,0xa);});var _0x2e3f76=_0x24477f[0x0];var _0x2f5825=_0x24477f[0x1];if(_0x2e3f76<0x0||_0x2e3f76>0x17||_0x2f5825<0x0||_0x2f5825>0x3b){throw new Error(EINVALID_DATE);}return[_0x2e3f76,_0x2f5825];}function circularDoWInterval(_0x22852e,_0x5d0871){if(_0x22852e===_0x5d0871){return[_0x22852e];}else{var _0x4fdd6e=moment[_0x29a4('0x8')]();moment[_0x29a4('0x8')]('en');var _0x4a7b59=moment[_0x29a4('0x9')]()[_0x29a4('0x2')](function(_0x117faf){return _0x117faf[_0x29a4('0xa')]();});moment[_0x29a4('0x8')](_0x4fdd6e);var _0x3efaa9=_0x4a7b59[_0x29a4('0xb')](_0x22852e);var _0x3f7f95=_0x4a7b59[_0x29a4('0xb')](_0x5d0871);if(_0x3f7f95>_0x3efaa9){return _0x4a7b59['slice'](_0x3efaa9,_0x3f7f95+0x1);}else{var _0x11aa05=_0x4a7b59[_0x29a4('0xc')](0x0,_0x3f7f95+0x1);var _0x2b92c8=_0x4a7b59['slice'](_0x3efaa9);return _0x2b92c8['concat'](_0x11aa05);}}}module[_0x29a4('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x442183,_0x57d6c6){if(_0x442183===_0x57d6c6){return[_0x442183];}else{var _0x3b487a=moment['locale']();moment[_0x29a4('0x8')]('en');var _0x113255=moment['monthsShort']()['map'](function(_0x2c3b1d){return _0x2c3b1d[_0x29a4('0xa')]();});moment[_0x29a4('0x8')](_0x3b487a);var _0x170222=_0x113255[_0x29a4('0xb')](_0x442183);var _0x52e671=_0x113255[_0x29a4('0xb')](_0x57d6c6);if(_0x52e671>_0x170222){return _0x113255[_0x29a4('0xc')](_0x170222,_0x52e671+0x1);}else{var _0x5b55b9=_0x113255[_0x29a4('0xc')](0x0,_0x52e671+0x1);var _0x4cb00b=_0x113255[_0x29a4('0xc')](_0x170222);return _0x4cb00b[_0x29a4('0xe')](_0x5b55b9);}}}module[_0x29a4('0xd')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x2b98d1){var _0x346200=parseInt(_0x2b98d1,0xa);if(_0x346200<0x1||_0x346200>0x1f){throw new Error(EINVALID_DATE);}return _0x346200;}function timeCompare(_0x54d7ab,_0x3b6a32,_0x34b4fd){var _0x260831=_0x54d7ab[_0x29a4('0xf')]();var _0x139765=extractTime(_0x3b6a32);var _0x128ecb=_0x139765[0x0];var _0x3bf706=_0x139765[0x1];var _0x2ee0a9=_0x54d7ab[_0x29a4('0xf')]()[_0x29a4('0x10')](_0x128ecb)[_0x29a4('0x11')](_0x3bf706);throwIfDateNotValid(_0x2ee0a9);var _0x5abe03=extractTime(_0x34b4fd);var _0x160f6d=_0x5abe03[0x0];var _0x146e18=_0x5abe03[0x1];var _0x4117a1=_0x54d7ab[_0x29a4('0xf')]()[_0x29a4('0x10')](_0x160f6d)['minutes'](_0x146e18);throwIfDateNotValid(_0x4117a1);if(_0x4117a1[_0x29a4('0x12')](_0x2ee0a9)){var _0x32bcc6=_0x260831['clone']()[_0x29a4('0x13')](_0x29a4('0x14'));var _0x40742f=_0x260831['clone']()[_0x29a4('0x15')]('day');return _0x260831[_0x29a4('0x16')](_0x2ee0a9,_0x40742f,undefined,'[]')||_0x260831[_0x29a4('0x16')](_0x32bcc6,_0x4117a1,undefined,'[]');}else{return _0x260831[_0x29a4('0x16')](_0x2ee0a9,_0x4117a1,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x246161,_0x103480,_0x177299){var _0xa331dc=_0x246161[_0x29a4('0x8')]('en')[_0x29a4('0x17')](_0x29a4('0x18'))[_0x29a4('0xa')]();return circularDoWInterval(_0x103480,_0x177299)[_0x29a4('0x19')](_0xa331dc);}module[_0x29a4('0xd')][_0x29a4('0x1a')]=dowCompare;function domCompare(_0x440898,_0x399538,_0x7ffbf0){var _0x5ee659=_0x440898[_0x29a4('0x1b')]();if(_0x399538===_0x7ffbf0){return _0x5ee659===_0x399538;}else{var _0x5036c6=_0x440898[_0x29a4('0x1c')]();var _0x4026c2=_0x399538<_0x7ffbf0;let _0x1118be=![];var _0x155198=0x0;var _0x10e0c3=0x0;if(_0x4026c2){_0x155198=Math['max'](0x1,_0x399538);_0x10e0c3=Math['min'](_0x7ffbf0,_0x5036c6);_0x1118be=_0x5ee659>=_0x155198&&_0x5ee659<=_0x10e0c3;}else{_0x155198=Math[_0x29a4('0x1d')](_0x399538,_0x5036c6);_0x10e0c3=Math[_0x29a4('0x1e')](0x1,_0x7ffbf0);_0x1118be=_0x5ee659>=_0x155198||_0x5ee659<=_0x10e0c3;}return _0x1118be;}}module['exports'][_0x29a4('0x1f')]=domCompare;function monthCompare(_0x370b41,_0xbf87f1,_0x2333d6){var _0x3a492d=_0x370b41[_0x29a4('0x8')]('en')[_0x29a4('0x17')]('MMM')[_0x29a4('0xa')]();return circularMonthInterval(_0xbf87f1,_0x2333d6)[_0x29a4('0x19')](_0x3a492d);}module['exports'][_0x29a4('0x20')]=monthCompare;function iftime(_0x5f4ed8,_0x155fc2=moment['tz'][_0x29a4('0x21')](),_0x3fa6c2=moment()){if(!validateRx[_0x29a4('0x22')](_0x5f4ed8)){throw new Error(EINVALID_STRING);}else{var _0x1c1e09=(moment[_0x29a4('0x23')](_0x3fa6c2)?_0x3fa6c2[_0x29a4('0xf')]():moment(_0x3fa6c2))['tz'](_0x155fc2)[_0x29a4('0x8')]('en');throwIfDateNotValid(_0x1c1e09);var _0xda25b4=_0x5f4ed8[_0x29a4('0x24')](',');var _0x41813d=_0xda25b4[0x0];var _0x2bf64a=_0xda25b4[0x1];var _0x4a7625=_0xda25b4[0x2];var _0x608a67=_0xda25b4[0x3];let _0x2405ad=!![];if(_0x41813d!=='*'){var _0x5ae119=_0x41813d[_0x29a4('0x24')]('-');var _0xbbddcf=_[_0x29a4('0x25')](_0x5ae119[0x0],0x5,'0');var _0x3145e6=_0x5ae119[_0x29a4('0x26')]===0x2?_[_0x29a4('0x25')](_0x5ae119[0x1],0x5,'0'):_0xbbddcf;_0x2405ad=timeCompare(_0x1c1e09,_0xbbddcf,_0x3145e6);}let _0x1c45d1=!![];if(_0x2bf64a!=='*'){var _0x3b5b64=_0x2bf64a[_0x29a4('0x24')]('-');var _0x5397da=_0x3b5b64[0x0];var _0xa985e2=_0x3b5b64[_0x29a4('0x26')]===0x2?_0x3b5b64[0x1]:_0x5397da;_0x1c45d1=dowCompare(_0x1c1e09,_0x5397da,_0xa985e2);}let _0x1eeea7=!![];if(_0x4a7625!=='*'){var _0x77fb39=_0x4a7625[_0x29a4('0x24')]('-');var _0x273420=parseDom(_0x77fb39[0x0]);var _0x306756=_0x77fb39[_0x29a4('0x26')]===0x2?parseDom(_0x77fb39[0x1]):_0x273420;_0x1eeea7=domCompare(_0x1c1e09,_0x273420,_0x306756);}let _0x32e316=!![];if(_0x608a67!=='*'){var _0xedf1a8=_0x608a67['split']('-');var _0x3851a4=_0xedf1a8[0x0];var _0x119d79=_0xedf1a8['length']===0x2?_0xedf1a8[0x1]:_0xedf1a8[0x0];_0x32e316=monthCompare(_0x1c1e09,_0x3851a4,_0x119d79);}return _0x2405ad&&_0x1c45d1&&_0x1eeea7&&_0x32e316;}}module['exports'][_0x29a4('0x27')]=iftime; \ No newline at end of file +var _0x9e5d=['date','max','domCompare','MMM','isMoment','padStart','length','lodash','map','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','slice','concat','exports','monthsShort','indexOf','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e5d,0x19f));var _0xd9e5=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9e5d[_0x53ccf2];return _0x5a2964;};var _=require(_0xd9e5('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][_0xd9e5('0x1')](function(_0x1cd755){return _0x1cd755['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xd9e5('0x2');var EINVALID_DATE=_0xd9e5('0x3');function throwIfDateNotValid(_0x4b9790){if(!_0x4b9790[_0xd9e5('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3e4355){var _0x357571=_0x3e4355[_0xd9e5('0x5')](':')['map'](function(_0x1fe488){return parseInt(_0x1fe488,0xa);});var _0x14707c=_0x357571[0x0];var _0x3baeca=_0x357571[0x1];if(_0x14707c<0x0||_0x14707c>0x17||_0x3baeca<0x0||_0x3baeca>0x3b){throw new Error(EINVALID_DATE);}return[_0x14707c,_0x3baeca];}function circularDoWInterval(_0x3b829f,_0x1f34ba){if(_0x3b829f===_0x1f34ba){return[_0x3b829f];}else{var _0x1dba7f=moment['locale']();moment[_0xd9e5('0x6')]('en');var _0x5e659e=moment[_0xd9e5('0x7')]()[_0xd9e5('0x1')](function(_0x272333){return _0x272333[_0xd9e5('0x8')]();});moment[_0xd9e5('0x6')](_0x1dba7f);var _0x301f4c=_0x5e659e['indexOf'](_0x3b829f);var _0x389c00=_0x5e659e['indexOf'](_0x1f34ba);if(_0x389c00>_0x301f4c){return _0x5e659e['slice'](_0x301f4c,_0x389c00+0x1);}else{var _0x3b23b6=_0x5e659e[_0xd9e5('0x9')](0x0,_0x389c00+0x1);var _0x4b2414=_0x5e659e[_0xd9e5('0x9')](_0x301f4c);return _0x4b2414[_0xd9e5('0xa')](_0x3b23b6);}}}module[_0xd9e5('0xb')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x433c14,_0x2d783e){if(_0x433c14===_0x2d783e){return[_0x433c14];}else{var _0x2fe47b=moment[_0xd9e5('0x6')]();moment['locale']('en');var _0x38605e=moment[_0xd9e5('0xc')]()[_0xd9e5('0x1')](function(_0x4d78ce){return _0x4d78ce[_0xd9e5('0x8')]();});moment[_0xd9e5('0x6')](_0x2fe47b);var _0x485601=_0x38605e['indexOf'](_0x433c14);var _0x3bb8dd=_0x38605e[_0xd9e5('0xd')](_0x2d783e);if(_0x3bb8dd>_0x485601){return _0x38605e[_0xd9e5('0x9')](_0x485601,_0x3bb8dd+0x1);}else{var _0x52ef00=_0x38605e['slice'](0x0,_0x3bb8dd+0x1);var _0x22fe56=_0x38605e[_0xd9e5('0x9')](_0x485601);return _0x22fe56[_0xd9e5('0xa')](_0x52ef00);}}}module[_0xd9e5('0xb')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x5cbf75){var _0x5d7f43=parseInt(_0x5cbf75,0xa);if(_0x5d7f43<0x1||_0x5d7f43>0x1f){throw new Error(EINVALID_DATE);}return _0x5d7f43;}function timeCompare(_0x3a49f4,_0x14d168,_0x5af77c){var _0x5916ad=_0x3a49f4[_0xd9e5('0xe')]();var _0x7c8e2f=extractTime(_0x14d168);var _0x18c29a=_0x7c8e2f[0x0];var _0x72317d=_0x7c8e2f[0x1];var _0x2e3d54=_0x3a49f4[_0xd9e5('0xe')]()[_0xd9e5('0xf')](_0x18c29a)[_0xd9e5('0x10')](_0x72317d);throwIfDateNotValid(_0x2e3d54);var _0x559b26=extractTime(_0x5af77c);var _0x4a1538=_0x559b26[0x0];var _0x2c2e17=_0x559b26[0x1];var _0x22e131=_0x3a49f4[_0xd9e5('0xe')]()[_0xd9e5('0xf')](_0x4a1538)['minutes'](_0x2c2e17);throwIfDateNotValid(_0x22e131);if(_0x22e131[_0xd9e5('0x11')](_0x2e3d54)){var _0x27b304=_0x5916ad[_0xd9e5('0xe')]()[_0xd9e5('0x12')](_0xd9e5('0x13'));var _0x5a854e=_0x5916ad[_0xd9e5('0xe')]()[_0xd9e5('0x14')](_0xd9e5('0x13'));return _0x5916ad[_0xd9e5('0x15')](_0x2e3d54,_0x5a854e,undefined,'[]')||_0x5916ad[_0xd9e5('0x15')](_0x27b304,_0x22e131,undefined,'[]');}else{return _0x5916ad[_0xd9e5('0x15')](_0x2e3d54,_0x22e131,undefined,'[]');}}module[_0xd9e5('0xb')][_0xd9e5('0x16')]=timeCompare;function dowCompare(_0x39ec58,_0x571477,_0x50cb04){var _0x2811a6=_0x39ec58[_0xd9e5('0x6')]('en')[_0xd9e5('0x17')](_0xd9e5('0x18'))[_0xd9e5('0x8')]();return circularDoWInterval(_0x571477,_0x50cb04)[_0xd9e5('0x19')](_0x2811a6);}module['exports'][_0xd9e5('0x1a')]=dowCompare;function domCompare(_0x2e214a,_0x15d6fb,_0x591649){var _0x975267=_0x2e214a[_0xd9e5('0x1b')]();if(_0x15d6fb===_0x591649){return _0x975267===_0x15d6fb;}else{var _0x40966d=_0x2e214a['daysInMonth']();var _0x474f8d=_0x15d6fb<_0x591649;let _0x352f71=![];var _0x6019e0=0x0;var _0x59d3b5=0x0;if(_0x474f8d){_0x6019e0=Math[_0xd9e5('0x1c')](0x1,_0x15d6fb);_0x59d3b5=Math['min'](_0x591649,_0x40966d);_0x352f71=_0x975267>=_0x6019e0&&_0x975267<=_0x59d3b5;}else{_0x6019e0=Math['min'](_0x15d6fb,_0x40966d);_0x59d3b5=Math[_0xd9e5('0x1c')](0x1,_0x591649);_0x352f71=_0x975267>=_0x6019e0||_0x975267<=_0x59d3b5;}return _0x352f71;}}module[_0xd9e5('0xb')][_0xd9e5('0x1d')]=domCompare;function monthCompare(_0x2509b1,_0x586c79,_0x443feb){var _0x474bff=_0x2509b1[_0xd9e5('0x6')]('en')['format'](_0xd9e5('0x1e'))[_0xd9e5('0x8')]();return circularMonthInterval(_0x586c79,_0x443feb)[_0xd9e5('0x19')](_0x474bff);}module[_0xd9e5('0xb')]['monthCompare']=monthCompare;function iftime(_0x105c62,_0x52edb2=moment['tz']['guess'](),_0x51be62=moment()){if(!validateRx['test'](_0x105c62)){throw new Error(EINVALID_STRING);}else{var _0x4debbe=(moment[_0xd9e5('0x1f')](_0x51be62)?_0x51be62[_0xd9e5('0xe')]():moment(_0x51be62))['tz'](_0x52edb2)[_0xd9e5('0x6')]('en');throwIfDateNotValid(_0x4debbe);var _0x138ea7=_0x105c62['split'](',');var _0x4a1bb2=_0x138ea7[0x0];var _0x29b1a4=_0x138ea7[0x1];var _0x1acea4=_0x138ea7[0x2];var _0xe18b63=_0x138ea7[0x3];let _0x14b5f2=!![];if(_0x4a1bb2!=='*'){var _0x1cdda6=_0x4a1bb2[_0xd9e5('0x5')]('-');var _0x1be3d8=_[_0xd9e5('0x20')](_0x1cdda6[0x0],0x5,'0');var _0x4841a3=_0x1cdda6[_0xd9e5('0x21')]===0x2?_[_0xd9e5('0x20')](_0x1cdda6[0x1],0x5,'0'):_0x1be3d8;_0x14b5f2=timeCompare(_0x4debbe,_0x1be3d8,_0x4841a3);}let _0x4c8edf=!![];if(_0x29b1a4!=='*'){var _0x589464=_0x29b1a4[_0xd9e5('0x5')]('-');var _0x3ecfcc=_0x589464[0x0];var _0x1aa06f=_0x589464['length']===0x2?_0x589464[0x1]:_0x3ecfcc;_0x4c8edf=dowCompare(_0x4debbe,_0x3ecfcc,_0x1aa06f);}let _0x5f3f7d=!![];if(_0x1acea4!=='*'){var _0x34d57b=_0x1acea4['split']('-');var _0x358dc1=parseDom(_0x34d57b[0x0]);var _0x3e2e19=_0x34d57b[_0xd9e5('0x21')]===0x2?parseDom(_0x34d57b[0x1]):_0x358dc1;_0x5f3f7d=domCompare(_0x4debbe,_0x358dc1,_0x3e2e19);}let _0x399ead=!![];if(_0xe18b63!=='*'){var _0x16626a=_0xe18b63[_0xd9e5('0x5')]('-');var _0x29882a=_0x16626a[0x0];var _0x212a21=_0x16626a['length']===0x2?_0x16626a[0x1]:_0x16626a[0x0];_0x399ead=monthCompare(_0x4debbe,_0x29882a,_0x212a21);}return _0x14b5f2&&_0x4c8edf&&_0x5f3f7d&&_0x399ead;}}module[_0xd9e5('0xb')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 94a5f19..76807c3 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeefe=['format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','}}}','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Console','warn','transports','File','%s-%s','error','consoleLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20green','gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join'];(function(_0x429dac,_0x4c83e3){var _0x24d7f4=function(_0x4bcf3f){while(--_0x4bcf3f){_0x429dac['push'](_0x429dac['shift']());}};_0x24d7f4(++_0x4c83e3);}(_0xeefe,0xcc));var _0xeeef=function(_0x29584e,_0x387aee){_0x29584e=_0x29584e-0x0;var _0x5df1a2=_0xeefe[_0x29584e];return _0x5df1a2;};'use strict';var path=require(_0xeeef('0x0'));var util=require(_0xeeef('0x1'));var moment=require(_0xeeef('0x2'));var winston=require(_0xeeef('0x3'));var config=require(_0xeeef('0x4'));var debugLevel=config[_0xeeef('0x5')]?config['debugLevel'][_0xeeef('0x6')]():_0xeeef('0x7');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':_0xeeef('0x8'),'error':_0xeeef('0x9'),'warn':_0xeeef('0xa'),'info':'white','print':'bold\x20white','success':_0xeeef('0xb'),'http':_0xeeef('0xc'),'verbose':'bold\x20magenta','debug':_0xeeef('0xd'),'silly':_0xeeef('0xe')};winston[_0xeeef('0xf')](XC_LOG_COLORS);function getLogFileName(_0x13fa69,_0x3846fe,_0x2027fa){var _0x21446b=_0x13fa69||_0xeeef('0x10');return path[_0xeeef('0x11')](_0x21446b,util[_0xeeef('0x12')](_0xeeef('0x13'),_0x3846fe,_0x2027fa));}function formatter(_0x1455d0,_0x37a713){_0x37a713[_0xeeef('0x14')]=_0x37a713[_0xeeef('0x14')][_0xeeef('0x15')](/@@{/g,_0xeeef('0x16'))[_0xeeef('0x15')](/}@@/g,'}}}')[_0xeeef('0x15')](/@{/g,'{{')[_0xeeef('0x15')](/}@/g,'}}');return util[_0xeeef('0x12')](_0xeeef('0x17'),moment()[_0xeeef('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),_0x37a713['level'][_0xeeef('0x18')](),_0x1455d0,_0x37a713[_0xeeef('0x14')]);}function fileFormat(_0x2a3b32,_0x2d6e96){_0x2d6e96['message']=_0x2d6e96[_0xeeef('0x14')][_0xeeef('0x15')](/@@{/g,_0xeeef('0x16'))[_0xeeef('0x15')](/}@@/g,_0xeeef('0x19'))[_0xeeef('0x15')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x4364b0=_0x2d6e96[_0xeeef('0x1a')]&&Object[_0xeeef('0x1b')](_0x2d6e96['meta'])[_0xeeef('0x1c')]?'\x0a\x09'+JSON['stringify'](_0x2d6e96[_0xeeef('0x1a')]):'';return util[_0xeeef('0x12')](_0xeeef('0x1d'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x2d6e96['level'][_0xeeef('0x18')](),_0x2a3b32,_0x2d6e96[_0xeeef('0x14')],_0x4364b0);}function consoleLogger(){var _0x1471e6=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xeeef('0x1e'))]({'level':_0xeeef('0x1f'),'json':![],'formatter':function(_0x5286a0){return formatter('',_0x5286a0);}})]});return _0x1471e6;}function fileLogger(_0x58b62f,_0x5a0cf1){var _0x5380d9=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xeeef('0x20'))][(_0xeeef('0x21'))]({'name':util[_0xeeef('0x12')](_0xeeef('0x22'),_0x58b62f,_0xeeef('0x23')),'filename':getLogFileName(_0x5a0cf1,_0x58b62f,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x193d09){return fileFormat(_0x58b62f,_0x193d09);}}),new winston[(_0xeeef('0x20'))][(_0xeeef('0x21'))]({'name':util[_0xeeef('0x12')](_0xeeef('0x22'),_0x58b62f,debugLevel),'filename':getLogFileName(_0x5a0cf1,_0x58b62f,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x198798){return fileFormat(_0x58b62f,_0x198798);}}),new winston[(_0xeeef('0x20'))][(_0xeeef('0x1e'))]({'level':_0xeeef('0x1f'),'json':![],'formatter':function(_0x4e6b85){return fileFormat(_0x58b62f,_0x4e6b85);}})]});return _0x5380d9;}exports[_0xeeef('0x24')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x347f=['addColors','join','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','error','%s-%s','consoleLogger','fileLogger','util','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','white','bold\x20white','bold\x20green','gray','bold\x20cyan'];(function(_0x58f83c,_0x563967){var _0x5d2f70=function(_0x22d679){while(--_0x22d679){_0x58f83c['push'](_0x58f83c['shift']());}};_0x5d2f70(++_0x563967);}(_0x347f,0x7c));var _0xf347=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x347f[_0xa464c9];return _0x3d73c4;};'use strict';var path=require('path');var util=require(_0xf347('0x0'));var moment=require('moment');var winston=require(_0xf347('0x1'));var config=require(_0xf347('0x2'));var debugLevel=config[_0xf347('0x3')]?config[_0xf347('0x3')][_0xf347('0x4')]():_0xf347('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':_0xf347('0x6'),'error':'red','warn':'bold\x20yellow','info':_0xf347('0x7'),'print':_0xf347('0x8'),'success':_0xf347('0x9'),'http':_0xf347('0xa'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0xf347('0xb')};winston[_0xf347('0xc')](XC_LOG_COLORS);function getLogFileName(_0x4dc7c4,_0x4d8e06,_0x42da9c){var _0x2cfbcd=_0x4dc7c4||'/var/log/xcally';return path[_0xf347('0xd')](_0x2cfbcd,util[_0xf347('0xe')]('%s-%s.log',_0x4d8e06,_0x42da9c));}function formatter(_0x5aa316,_0x43a857){_0x43a857[_0xf347('0xf')]=_0x43a857[_0xf347('0xf')][_0xf347('0x10')](/@@{/g,_0xf347('0x11'))[_0xf347('0x10')](/}@@/g,_0xf347('0x12'))[_0xf347('0x10')](/@{/g,'{{')[_0xf347('0x10')](/}@/g,'}}');return util['format'](_0xf347('0x13'),moment()['format'](_0xf347('0x14')),_0x43a857[_0xf347('0x15')]['toUpperCase'](),_0x5aa316,_0x43a857['message']);}function fileFormat(_0x3ab840,_0x5d3f4b){_0x5d3f4b[_0xf347('0xf')]=_0x5d3f4b[_0xf347('0xf')][_0xf347('0x10')](/@@{/g,'{{{')[_0xf347('0x10')](/}@@/g,_0xf347('0x12'))['replace'](/@{/g,'{{')[_0xf347('0x10')](/}@/g,'}}');var _0x2d3b2b=_0x5d3f4b[_0xf347('0x16')]&&Object[_0xf347('0x17')](_0x5d3f4b['meta'])['length']?'\x0a\x09'+JSON['stringify'](_0x5d3f4b[_0xf347('0x16')]):'';return util[_0xf347('0xe')](_0xf347('0x18'),moment()[_0xf347('0xe')](_0xf347('0x14')),_0x5d3f4b[_0xf347('0x15')]['toUpperCase'](),_0x3ab840,_0x5d3f4b[_0xf347('0xf')],_0x2d3b2b);}function consoleLogger(){var _0x406334=new winston[(_0xf347('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf347('0x1a'))][(_0xf347('0x1b'))]({'level':_0xf347('0x1c'),'json':![],'formatter':function(_0x431e6e){return formatter('',_0x431e6e);}})]});return _0x406334;}function fileLogger(_0x10afac,_0x5c2954){var _0x2f22df=new winston[(_0xf347('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf347('0x1a'))][(_0xf347('0x1d'))]({'name':util[_0xf347('0xe')]('%s-%s',_0x10afac,_0xf347('0x1e')),'filename':getLogFileName(_0x5c2954,_0x10afac,_0xf347('0x1e')),'level':_0xf347('0x1e'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x37461a){return fileFormat(_0x10afac,_0x37461a);}}),new winston[(_0xf347('0x1a'))][(_0xf347('0x1d'))]({'name':util[_0xf347('0xe')](_0xf347('0x1f'),_0x10afac,debugLevel),'filename':getLogFileName(_0x5c2954,_0x10afac,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x54943d){return fileFormat(_0x10afac,_0x54943d);}}),new winston[(_0xf347('0x1a'))]['Console']({'level':_0xf347('0x1c'),'json':![],'formatter':function(_0x347f1f){return fileFormat(_0x10afac,_0x347f1f);}})]});return _0x2f22df;}exports[_0xf347('0x20')]=consoleLogger;exports[_0xf347('0x21')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index ff087c1..95d9681 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 _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x5ac676,_0x2a6dd9){var _0x139eee=function(_0x388d48){while(--_0x388d48){_0x5ac676['push'](_0x5ac676['shift']());}};_0x139eee(++_0x2a6dd9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0x0b0e[_0x2f37e0];return _0x43ccce;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0x13fa14,_0x5dd0f1){var _0x14a55e=function(_0x3b8a5a){while(--_0x3b8a5a){_0x13fa14['push'](_0x13fa14['shift']());}};_0x14a55e(++_0x5dd0f1);}(_0x14a0,0x8e));var _0x014a=function(_0x3e21cc,_0x12ed23){_0x3e21cc=_0x3e21cc-0x0;var _0x13e4c7=_0x14a0[_0x3e21cc];return _0x13e4c7;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 8006496..c0888bd 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['exports','replace'];(function(_0x2f32c4,_0x2597ba){var _0x95b5dc=function(_0x4ee89e){while(--_0x4ee89e){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x95b5dc(++_0x2597ba);}(_0x0295,0x1f0));var _0x5029=function(_0x14d175,_0x230bf7){_0x14d175=_0x14d175-0x0;var _0x2946e9=_0x0295[_0x14d175];return _0x2946e9;};module[_0x5029('0x0')]={'escapeRegExp'(_0x4e737b,_0x5e71d0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4e737b[_0x5029('0x1')](_0x5e71d0,'\x5c$&');}}; \ No newline at end of file +var _0xdb28=['exports','replace'];(function(_0xddc9da,_0x2f6511){var _0x2474ac=function(_0x4cfebb){while(--_0x4cfebb){_0xddc9da['push'](_0xddc9da['shift']());}};_0x2474ac(++_0x2f6511);}(_0xdb28,0x106));var _0x8db2=function(_0x296373,_0x416adf){_0x296373=_0x296373-0x0;var _0x5ebf39=_0xdb28[_0x296373];return _0x5ebf39;};module[_0x8db2('0x0')]={'escapeRegExp'(_0x4221b3,_0x1dc797=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4221b3[_0x8db2('0x1')](_0x1dc797,'\x5c$&');}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 2933927..bd5b210 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 _0xe605=['isArray','map','isPlainObject','keys','reduce','exports','lodash','\x20}\x20}','string','replace'];(function(_0x5b37ef,_0x32f8ea){var _0x4f5779=function(_0x12b5d2){while(--_0x12b5d2){_0x5b37ef['push'](_0x5b37ef['shift']());}};_0x4f5779(++_0x32f8ea);}(_0xe605,0x92));var _0x5e60=function(_0x2bbf51,_0x4cf88c){_0x2bbf51=_0x2bbf51-0x0;var _0x2f6718=_0xe605[_0x2bbf51];return _0x2f6718;};var _=require(_0x5e60('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x455628){return _0x455628==='{{'?'{\x20{\x20':_0x5e60('0x1');}function safeTemplate(_0x455efd){var _0x342132=_0x455efd;if(typeof _0x455efd===_0x5e60('0x2')){_0x342132=_0x455efd[_0x5e60('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5e60('0x4')](_0x455efd)){_0x342132=_0x455efd[_0x5e60('0x5')](function(_0x30d8fb){return safeTemplate(_0x30d8fb);});}else if(_[_0x5e60('0x6')](_0x455efd)){_0x342132=Object[_0x5e60('0x7')](_0x455efd)[_0x5e60('0x8')](function(_0x168a14,_0x4e3501){_0x168a14[_0x4e3501]=safeTemplate(_0x455efd[_0x4e3501]);return _0x168a14;},{});}return _0x342132;}module[_0x5e60('0x9')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x9ffd=['{\x20{\x20','string','replace','map','keys','reduce','exports','safeTemplate','lodash'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1a9acd,_0x1f4643){_0x1a9acd=_0x1a9acd-0x0;var _0x930b7a=_0x9ffd[_0x1a9acd];return _0x930b7a;};var _=require(_0xd9ff('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x413161){return _0x413161==='{{'?_0xd9ff('0x1'):'\x20}\x20}';}function safeTemplate(_0x3480c0){var _0x1530b1=_0x3480c0;if(typeof _0x3480c0===_0xd9ff('0x2')){_0x1530b1=_0x3480c0[_0xd9ff('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x3480c0)){_0x1530b1=_0x3480c0[_0xd9ff('0x4')](function(_0x111697){return safeTemplate(_0x111697);});}else if(_['isPlainObject'](_0x3480c0)){_0x1530b1=Object[_0xd9ff('0x5')](_0x3480c0)[_0xd9ff('0x6')](function(_0x13ea8c,_0x270eb2){_0x13ea8c[_0x270eb2]=safeTemplate(_0x3480c0[_0x270eb2]);return _0x13ea8c;},{});}return _0x1530b1;}module[_0xd9ff('0x7')][_0xd9ff('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 2492dcc..1766c51 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 _0x8996=['path','../config/environment','root','resolve','server/app.json','isArray','apps','name','motion2','env','NODE_PATH','string','then','readJSON','info','Updating\x20app.json','writeJSON','exports'];(function(_0x13169e,_0x1cba7c){var _0x3a4f74=function(_0x253625){while(--_0x253625){_0x13169e['push'](_0x13169e['shift']());}};_0x3a4f74(++_0x1cba7c);}(_0x8996,0x1b0));var _0x6899=function(_0x33920e,_0xc28394){_0x33920e=_0x33920e-0x0;var _0x762791=_0x8996[_0x33920e];return _0x762791;};var fs=require('fs-extra');var path=require(_0x6899('0x0'));var config=require(_0x6899('0x1'));var root=config[_0x6899('0x2')];var APP_JSON_PATH=path[_0x6899('0x3')](root,_0x6899('0x4'));var NODEPATH=path[_0x6899('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x4207f8){let _0x1bef5b=![];if(Array[_0x6899('0x5')](_0x4207f8[_0x6899('0x6')])){var _0x5bf152=_0x4207f8[_0x6899('0x6')]['findIndex'](function(_0x45234){return _0x45234[_0x6899('0x7')]===_0x6899('0x8');});if(_0x5bf152>-0x1){var _0x2b7f91=_0x4207f8[_0x6899('0x6')][_0x5bf152];if(typeof _0x2b7f91[_0x6899('0x9')][_0x6899('0xa')]!==_0x6899('0xb')){_0x2b7f91[_0x6899('0x9')][_0x6899('0xa')]=NODEPATH;_0x1bef5b=!![];}}return{'appConfig':_0x4207f8,'updated':_0x1bef5b};}}function updateAppConfig(_0xed80b){return fs['pathExists'](APP_JSON_PATH)[_0x6899('0xc')](function(_0x4990ad){if(_0x4990ad){return fs[_0x6899('0xd')](APP_JSON_PATH)[_0x6899('0xc')](function(_0x5d20ae){var _0x5610b3=setLegacyLibsNodeEnvPath(_0x5d20ae);if(_0x5610b3['updated']){_0xed80b[_0x6899('0xe')](_0x6899('0xf'));return fs[_0x6899('0x10')](APP_JSON_PATH,_0x5d20ae,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x6899('0x3')]();}});}module[_0x6899('0x11')]=updateAppConfig; \ No newline at end of file +var _0x5f5a=['NODE_PATH','pathExists','then','readJSON','updated','info','writeJSON','exports','path','../config/environment','root','resolve','legacy-libs','isArray','apps','findIndex','motion2','env'];(function(_0x277e1d,_0x5b9cbc){var _0x28d571=function(_0x52dfe9){while(--_0x52dfe9){_0x277e1d['push'](_0x277e1d['shift']());}};_0x28d571(++_0x5b9cbc);}(_0x5f5a,0xaa));var _0xa5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5a[_0x3dd15e];return _0x231fd0;};var fs=require('fs-extra');var path=require(_0xa5f5('0x0'));var config=require(_0xa5f5('0x1'));var root=config[_0xa5f5('0x2')];var APP_JSON_PATH=path[_0xa5f5('0x3')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0xa5f5('0x4'));function setLegacyLibsNodeEnvPath(_0x415a85){let _0x5a8530=![];if(Array[_0xa5f5('0x5')](_0x415a85['apps'])){var _0x2ce299=_0x415a85[_0xa5f5('0x6')][_0xa5f5('0x7')](function(_0x259ee8){return _0x259ee8['name']===_0xa5f5('0x8');});if(_0x2ce299>-0x1){var _0x4a6044=_0x415a85[_0xa5f5('0x6')][_0x2ce299];if(typeof _0x4a6044[_0xa5f5('0x9')][_0xa5f5('0xa')]!=='string'){_0x4a6044[_0xa5f5('0x9')]['NODE_PATH']=NODEPATH;_0x5a8530=!![];}}return{'appConfig':_0x415a85,'updated':_0x5a8530};}}function updateAppConfig(_0x7efe87){return fs[_0xa5f5('0xb')](APP_JSON_PATH)[_0xa5f5('0xc')](function(_0x5f5dcf){if(_0x5f5dcf){return fs[_0xa5f5('0xd')](APP_JSON_PATH)[_0xa5f5('0xc')](function(_0x255034){var _0x4ab3c1=setLegacyLibsNodeEnvPath(_0x255034);if(_0x4ab3c1[_0xa5f5('0xe')]){_0x7efe87[_0xa5f5('0xf')]('Updating\x20app.json');return fs[_0xa5f5('0x10')](APP_JSON_PATH,_0x255034,{'spaces':0x2});}else{return Promise[_0xa5f5('0x3')]();}});}else{return Promise['resolve']();}});}module[_0xa5f5('0x11')]=updateAppConfig; \ No newline at end of file